diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,537 @@
+# Revision history for hs-bindgen
+
+## 1.0.0.0 -- 2026-10-08
+
+### Breaking changes
+
+* Drop support for GHC 9.2.
+* Bindings generated by earlier versions do not compile against the new
+  `hs-bindgen-runtime`; regenerate them. See the `hs-bindgen-runtime`
+  changelog.
+* Macros defined on the command line are no longer passed to Clang as `-D`
+  arguments but are *root directives*: an ordered list of `#include` and
+  `#define` directives. The root header is rendered from this list, and the
+  generated C wrapper source starts with the same rendering, so that binding
+  generation and binding compilation agree by construction. The wrapper
+  translation unit of a module therefore includes every main header.
+  Previously, `-D FOO` had to be stated twice: once for `hs-bindgen` and once
+  as `ghc-options: -optc-DFOO` in the `.cabal` file. See [issue
+  #2214][is-2214] and the [C stages][manual-c-stages] manual page.
+  * The CLI option `-D`/`--define-macro` is replaced by `--hash-define NAME
+    VALUE`. The order of `--hash-define` and `HEADER` arguments matters.
+    `--hash-define` takes *two* arguments: `-DFOO` becomes `--hash-define FOO
+    1`; an empty replacement list is `--hash-define FOO ''`.
+  * `ClangArgsConfig.defineMacros` is removed. In Template Haskell mode, use
+    the new `hashDefine :: String -> String -> BindgenM ()` next to
+    `hashInclude`. This is `#define` syntax, not `-D` syntax: `hashDefine
+    "FOO" ""` is `#define FOO`, `hashDefine "FOO" "1"` is `#define FOO 1`.
+  * As before, raw `-D` options passed via `argsBefore`/`argsInner`/`argsAfter`
+    or `BINDGEN_EXTRA_CLANG_ARGS` reach binding generation only, not the
+    compilation of the C wrapper.
+* Macros defined by `-D` Clang options or by `#define` root directives are now
+  declarations. See [issue #2280][is-2280].
+  * They are not in any header, so the default selection predicate does not
+    select them; program slicing selects the ones a selected declaration uses.
+  * Consider `struct S { T x; };` with `-DT=int`. Previously, `x` was a
+    `CInt`. Now, `S` is deselected without program slicing, just as if `T`
+    were defined in a header that is not a main header; with program slicing,
+    `x` has the macro type `T`.
+  * `--select-all` selects all of these macros, including those the Clang
+    driver defines itself, such as `__GCC_HAVE_DWARF2_CFI_ASM`. So does
+    `--select-by-decl-name` when its pattern matches their names. See also the
+    new selection predicate `--select-from-all-headers`.
+  * Generated binding specifications do not list these macros.
+* The `IncludeDir` data constructors have been renamed: `Dir` → `AbsDir` and
+  `Pkg` → `PkgDir`. Their paths are now checked in Template Haskell mode: a
+  relative `AbsDir` path warns (it is resolved against the working directory of
+  the compiler invocation), and an absolute `PkgDir` path is an error (the
+  package root would be discarded). See [issue #2217][is-2217].
+* The `SelectPredicate` type has been renamed to `SelectionPredicate`, and the
+  `selectPredicate` field of `Config_` has been renamed to
+  `selectionPredicate`.
+* The `--select-by-header-path` regex now matches against canonical absolute
+  paths. See [issue #2236][is-2236].
+* The `--path-style` CLI option and the corresponding `PathStyle` type and
+  `haddockPathStyle` field of `Config_` have been removed. They had no effect:
+  generated Haddock comments show the header path as written in the `#include`
+  directive. See [issue #2266][is-2266].
+* The `--log-show-time` CLI option has been removed. Trace output no longer
+  includes timestamps.
+* CLI exit codes have changed. Exit code 2 is now used for CLI usage errors;
+  a failed call to `libclang` now exits with code 3 (previously 2), and an
+  error in `hs-bindgen` with code 4 (previously 3). See the invocation section
+  of the manual.
+* The `LLVM_CONFIG` environment variable is no longer used to locate
+  `llvm-config`. Set `LLVM_PATH`, or configure `PATH` so that the desired
+  `llvm-config` is found.
+* Generated field names referencing anonymous structs and unions are now
+  prefixed with `anon'`. This highlights that the field is generated by
+  `hs-bindgen`; the tick ensures that the name cannot clash with a C field,
+  since ticks are not allowed in C identifiers. Since anonymous structs and
+  unions are named after the generated fields, these names now also include an
+  `anon'` infix. Code rarely needs to refer to these names: the fields of an
+  anonymous struct or union can be accessed as indirect fields of the
+  enclosing struct or union (see below). See [issue #2064][is-2064] and [PR
+  #2070][pr-2070].
+* Tagged types that would clash with the name of a typedef that refers to them
+  are now disambiguated with a `_struct`/`_union`/`_enum` suffix (mirroring the
+  C keyword) instead of `_Aux`. Clash detection now also looks through arrays,
+  blocks, and function types (argument and result types), not just pointers,
+  so e.g. `typedef struct {…} foo[10];` no longer produces clashing names.
+  Qualifiers (e.g. `const`) are treated as transparent, so `typedef const
+  struct {…} foo;` is now squashed like its unqualified counterpart. This
+  renames affected generated identifiers. See [issue #1445][is-1445].
+* Derived names (data constructors, record fields, union getters and setters,
+  enum constants, and `_Aux` types for flexible array members and function
+  pointers) are now checked for collisions. A declaration whose derived names
+  collide is deselected with a warning instead of producing uncompilable
+  Haskell. In particular, under `OmitFieldPrefixes`, a struct with two fields
+  that mangle to the same Haskell name is deselected. See [issue
+  #1432][is-1432].
+* Modules generated under `OmitFieldPrefixes` now enable `NoFieldSelectors` (in
+  addition to `DuplicateRecordFields`). No top-level field selector is emitted,
+  so an unprefixed field name can no longer clash with a non-field declaration
+  of the same name; fields are accessed via `HasField`/record dot syntax.
+* Remove the generated union getters and setters (e.g. `get_u_c`). Use the new
+  `get` and `set` functions from `hs-bindgen-runtime` instead. See [issue
+  #2060][is-2060] and [PR #2091][pr-2091].
+* Character literal macros are now translated to `CChar` (previously
+  `CharValue` from `c-expr-runtime`), and string literal macros to a strict
+  `ByteString` (previously `(Ptr CChar, Int)`). Multi-character literal macros
+  (e.g. `#define X 'ab'`) are no longer supported, as their value is
+  implementation-defined.
+* The types used in `foreign import` declarations (FFI types) have been
+  overhauled. Previously, every argument and result type was reduced to a
+  primitive type with a fixed size, which made the generated bindings less
+  portable than necessary. See the [FFI types][manual-ffi-types] manual page
+  and [PR #2267][pr-2267].
+  * An external binding specification can (and should) specify the FFI type of
+    a Haskell type: a module and a type that may appear in a `foreign import`
+    when that module is in scope. Generated `foreign import`s use the FFI type,
+    and convert from and to the Haskell type with `toFFIType`/`fromFFIType` of
+    the `HasFFIType` class.
+  * `HasFFIType` instances are now only generated for types that can be used in
+    `foreign import` argument and result positions.
+  * `HasFFIType` is an open class: users can write instances, e.g. for types
+    referenced by external binding specifications.
+* In external binding specifications, the class name `HasField` now records
+  that a type has the usual `HasField` instances for the fields of record
+  datatypes. Specifications that use `HasField` for the `HasField` instances of
+  the pointer manipulation API must rename it to `HasFieldPtr`. See [PR
+  #2094][pr-2094].
+* The name mangler reserves the names that generated modules import
+  unqualified from the `Prelude`, each in its namespace. See [issue
+  #2287][is-2287].
+  * `String` and `fmap` are now reserved: a C type `string` becomes `String'`,
+    a C function `fmap` becomes `fmap'`.
+  * `Void`, `FiniteBits` and `showsPrec` are no longer reserved: a C type
+    `Void` becomes `Void`, not `Void'`.
+  * Reserved names apply only in their own namespace: a C enumeration constant
+    `Eq` becomes the pattern `Eq`, not `Eq'`. The names of `Foreign.C.Types`,
+    such as `CInt`, remain reserved for types and constructors alike.
+
+### New features
+
+* Macro handling has been overhauled. See [PR #1862][pr-1862].
+  * Type-like macros (e.g. `#define A int`) are now parsed and typechecked
+    together with value-like macros (e.g. `#define FOO 1`) using `c-expr-dsl`,
+    rather than `language-c`, and translated directly to Haskell types. See
+    [issue #1953][is-1953].
+  * Names in macro bodies are resolved against all declarations in the
+    translation unit.
+  * Program slicing follows the dependencies of macros: selecting a macro also
+    selects the declarations it uses.
+  * When reparsing a declaration that uses macros, only the macros Clang
+    expanded *in that declaration* are substituted.
+  * Macro expansions in global variable declarations are supported. See [issue
+    #831][is-831].
+* Declarations may use type macros together with other macros, including
+  macros that `hs-bindgen` cannot translate, such as macros expanding to
+  attributes. The type macros are reflected in the generated bindings, and the
+  other macros are expanded as Clang expands them. Previously, type macros were
+  only supported in bindings that used no other macros at all.
+  Support is decided per declaration: it works as long as no macro the
+  declaration expands is ambiguous, that is, neither the macro nor any macro it
+  depends on has conflicting redefinitions (see below). See [issue
+  #1225][is-1225], [issue #2012][is-2012], [PR #1892][pr-1892] and [PR
+  #2034][pr-2034].
+* Benign macro redefinitions now collapse into one declaration, and do not
+  make the expansion of the macro ambiguous. A macro redefinition is benign if
+  and only if all definitions have the same name, parameter list and
+  replacement list (white space within the replacement list is ignored), and
+  none of the macros they depend on, directly or indirectly, has conflicting
+  redefinitions; all other redefinitions conflict. In particular, repeating a
+  definition word for word conflicts if a macro it uses is redefined
+  differently in between. We generate no bindings for a macro with conflicting
+  redefinitions. For any repeated
+  declaration, macro or not, we keep the definition in a main header, or the
+  first if none is in a main header. A declaration first defined in an
+  included header and repeated in a main header is therefore now selected by
+  the default selection predicate. See [issue #2264][is-2264] and [PR
+  #2281][pr-2281].
+* In Template Haskell mode, the macro language (how macro bodies are parsed,
+  typechecked and translated) can be chosen:
+  `HsBindgen.TH.withHsBindgenMacroLang` takes the macro language as an
+  argument, while `withHsBindgen` uses the default. `HsBindgen.Macro` provides
+  `cExpr` (the default), `empty` (recognises no macros; Clang's own expansions
+  are used), and `raw` (every macro becomes a `HsBindgen.Runtime.Macro.Raw
+  String` value holding its name, parameter list and token spellings).
+  The macro language argument is a function of the C standard, which
+  `withHsBindgenMacroLang` detects. The macro language interface is opaque, so
+  custom macro languages are not yet supported; they will be once the
+  `hs-bindgen` library API is finalised (see [issue #1003][is-1003]). See
+  [issue #2242][is-2242] and [issue #2243][is-2243].
+* A new CLI option `--parse-empty-macros` (`EmptyMacros` with
+  `ParseEmptyMacros`/`DoNotParseEmptyMacros` in Template Haskell mode) passes
+  macros with an empty replacement list on to the macro language. `raw` can
+  translate such macros. The default `cExpr` has no expression to translate and
+  declines them; they are reported like any other macro that failed to
+  translate. By default, empty macros are not parsed at all, since include
+  guards have this shape. See [issue #2246][is-2246].
+* `hs-bindgen` now emits a single, default-visible summary line reporting how
+  many selected macros it failed to translate, e.g. `14 macros failed to
+  translate; use --log-enable-macro-warnings for details`. Previously these
+  failures were only logged at `Info` level and hidden at the default
+  verbosity, giving the impression that macros were not translated at all. See
+  [issue #2185][is-2185].
+* A new CLI option `--select-from-all-headers` (`SelectHeader FromAllHeaders`
+  in Template Haskell mode) selects every declaration in any header, main or
+  included. Unlike `--select-all`, it does not select macros defined by `-D`
+  Clang options or by root directives. See [issue #2280][is-2280].
+* Extract Haddock documentation from C headers using Doxygen. When the
+  `doxygen` binary is available on `PATH`, `hs-bindgen` invokes it to parse
+  structured documentation comments (Javadoc/Doxygen-style `/** ... */`) and
+  translates them into Haddock comments on the generated bindings. If `doxygen`
+  is not found, `hs-bindgen` warns and generates metadata-only comments (source
+  location and C name).
+* Mirror Doxygen `@defgroup` sections (including nested `@ingroup` groupings)
+  as Haddock section headers in the export lists of generated modules.
+* The `hs-bindgen-cli info doxygen` subcommand dumps the parsed Doxygen
+  comments.
+* Generate class instances for field access and zero values of structs,
+  unions and newtypes:
+  * `GHC.Records.Compat.HasField` instances for struct fields, union fields,
+    and the fields of generated newtypes (for typedefs, enums, and macro
+    types), with Haddock comments;
+  * `GHC.Records.HasField` instances for union fields;
+  * `HsBindgen.Runtime.Struct.IsStruct` instances for structs;
+  * `HsBindgen.Runtime.Union.IsUnion` instances for unions.
+
+  With `OverloadedRecordUpdate` (see `HsBindgen.Runtime.Overloading`), struct
+  and union values can be constructed by record updates of the zero value of
+  `IsStruct` or `IsUnion`. This is particularly useful for unions, which are
+  opaque datatypes, and combines with indirect fields (see below).
+
+  See [issue #2059][is-2059], [issue #2060][is-2060], [issue #2083][is-2083],
+  [issue #2121][is-2121], [PR #2075][pr-2075], [PR #2087][pr-2087], [PR
+  #2091][pr-2091], [PR #2150][pr-2150] and [PR #2164][pr-2164].
+* Generate `HasField` instances for indirect fields, both for values and, for
+  the pointer manipulation API, for pointers. Indirect fields are fields of
+  anonymous structs and unions that can be accessed as if they were fields of
+  the enclosing struct or union, as in C. With `OverloadedRecordDot`, a field
+  of an anonymous union inside a struct can thus be read from a value of, or a
+  pointer to, the struct directly, without naming the generated union type.
+  See [issue #2061][is-2061] and [PR #2136][pr-2136].
+* Support bit-fields in unions. See [issue #1253][is-1253].
+* Generate `_Aux` newtypes for function types that are indirectly referenced by
+  `typedef`s. Previously these newtypes were only generated when function types
+  were indirectly referenced through pointers. Now any type of indirection is
+  supported, such as arrays, qualifiers, and blocks. Likewise, generate
+  `ToFunPtr` and `FromFunPtr` instances for all nested function types,
+  including those nested in global variables and typedefs. See [issue
+  #1520][is-1520] and [PR #2068][pr-2068].
+* Generate a `StaticSize` instance for `emptydata` types whose underlying C
+  type is complete (a struct, union, or enum with a known size and alignment,
+  or a typedef of one), so that callers can allocate the type from Haskell even
+  though its fields are hidden. Types that are opaque in C (such as forward
+  declarations) get no instance. See [issue #2014][is-2014].
+* The C type specification of binding specifications gains an `enum` key with
+  values `open` (default) or `closed`. For a closed `enum`, we generate a
+  `COMPLETE` pragma for the declared patterns, so that GHC considers a match
+  on all of them exhaustive. See [issue #2101][is-2101].
+* In Template Haskell mode, external types referenced via external binding
+  specifications that are not in scope now produce a helpful compile error
+  suggesting the missing import.
+* A new CLI option `--color WHEN` controls ANSI colours in diagnostics, where
+  `WHEN` is `always`, `auto` (default: detect terminal support), or `never`.
+  See [issue #2166][is-2166].
+* A new CLI option `--log-squashed-as-info` (and matching
+  `CustomLogLevelSetting` constructor `MakeMangleNamesSquashedInfo`) demotes
+  the `select-mangle-names-squashed` trace from `Notice` to `Info`, so the
+  per-typedef squash messages no longer appear at the default verbosity. See
+  [issue #1574][is-1574].
+* A new CLI option `--log-as-error-bugs` turns bug-level trace messages into
+  errors. This is useful when `hs-bindgen` is used in a CI pipeline.
+* The `hs-bindgen-cli info include-graph` command gained a `--toposort` flag
+  that outputs the headers as a topologically sorted list (one per line, each
+  header after the ones it `#include`s) instead of a Mermaid graph. Respects
+  `--include`/`--exclude` and `--show-paths`. See [issue #2080][is-2080].
+* Support LLVM/Clang 23. See [issue #2235][is-2235].
+
+### Minor changes
+
+* The `c-expr-dsl` and `c-expr-runtime` libraries have been extracted into
+  their own repository ([well-typed/c-expr](https://github.com/well-typed/c-expr))
+  and are consumed from Hackage.
+* Print types without redundant parentheses, and type operators with infix
+  notation, in generated bindings. See [issue #1790][is-1790], [issue
+  #1715][is-1715] and [PR #1917][pr-1917].
+* `HsBindgen.TH` now also exports `BindgenM` (opaque).
+* `hs-bindgen-cli info builtin-macros` no longer lists macros defined by `-D`
+  Clang options, including the ones the Clang driver adds itself. See [issue
+  #2280][is-2280].
+* Trace messages capture call stacks where they are created rather than where
+  they are emitted, making `--log-show-call-stack` output point at the code
+  that produced the message.
+
+### Bug fixes
+
+* Generated modules no longer clash with `Prelude` names. Previously, C
+  declarations such as `typedef int Maybe` or `enum { LT, EQ, GT }` resulted in
+  ambiguous names. See [issue #2287][is-2287].
+* Object-like macros whose replacement list starts with `(`, such as
+  `#define G (x, y) x + y`, are no longer parsed as function-like macros. A
+  macro is function-like only if there is no white space between its name and
+  the opening parenthesis.
+* A function-like macro whose parameter is spelled like a C keyword, such as
+  `#define F(bool) bool`, is no longer dropped. Such a parameter shadows the
+  keyword in the replacement list: the body of `#define F(bool) bool` is the
+  parameter, not the type.
+* A header that uses a macro defined by a `-D` Clang option, and then redefines
+  it, no longer makes `hs-bindgen` panic. The redefinition is now a conflict,
+  like two differing definitions in a header. See [issue #2280][is-2280].
+* Fix the parsing of primitive types in declarations that involve macro
+  expansions. The bug would, for example, cause `long long int` to be parsed as
+  `long int` in some cases. See [issue #1685][is-1685] and [PR #1921][pr-1921].
+* Fix the reparser to ignore storage class specifiers, function specifiers, and
+  attribute specifier sequences. Previously, macro-using declarations carrying
+  any of these failed to reparse and silently fell back to the un-reparsed
+  type, dropping macro typedef names from generated bindings. See [issue
+  #1891][is-1891] and [PR #1955][pr-1955].
+* Prevent confusing info-level messages for reparse errors involving
+  declarations that contain nested declarations. For example, for a nested
+  declaration such as `typedef struct { MyInt x; } * foo;` where `MyInt` is a
+  macro type, a message would be traced that `foo` could not be reparsed, even
+  though the struct field `x` is still reparsed successfully. See [issue
+  #1382][is-1382] and [PR #2021][pr-2021].
+* Unnamed declarations originating from the same macro expansion no longer
+  make `hs-bindgen` panic. Their identifiers now include a hash of the
+  declaration, which makes them unique on all supported LLVM versions. See
+  [issue #1860][is-1860] and [issue #2210][is-2210].
+* Support untagged structs, unions and enums that are indirectly referenced
+  by global variables. For example, `struct { int x; } var;` was
+  previously supported but `struct { int x; } * var;` or `struct { int x; }
+  var[];` would cause a panic. See [PR #2017][pr-2017].
+* External binding specifications now match correctly when the same header is
+  reached by different `#include` spellings (e.g. `../core.h` vs `core.h`).
+  Identity comparisons use canonical paths instead of the Clang-reported
+  filename, which depends on include order. See [issue #2236][is-2236].
+* Declarations using `_Float16`, `__fp16`, `__bf16`, or `__ibm128` now fail to
+  parse with an unsupported-feature warning, instead of being reported as a
+  bug in `hs-bindgen`. See [issue #2230][is-2230].
+* Declarations using SIMD vector types now fail to parse with an
+  unsupported-feature warning. See [issue #2198][is-2198].
+* Declarations with unexposed types (such as the type of `malloc` with
+  LLVM/Clang 22) now fail to parse with a warning.
+* Silently ignore `__declspec(dllimport)` and `__declspec(dllexport)`
+  attributes when parsing function, variable, and enum declarations.
+  Previously, these triggered a `Bug`-level `Unexpected cursor kind` trace on
+  Windows for every CRT declaration carrying `__declspec(dllimport)`. See
+  [issue #1910][is-1910].
+* `_Static_assert` declarations are now ignored, rather than reported as an
+  unexpected cursor kind.
+* Generated modules now enable every language extension they need, such as
+  `FlexibleInstances` and `ForeignFunctionInterface`, so that they compile
+  with `Haskell2010` or `Haskell98` as the default language. Previously, some
+  of these were covered only implicitly by `GHC2021`.
+* Stop emitting the `CApiFFI` language pragma in generated modules that do not
+  use the `capi` calling convention. See [issue #1868][is-1868].
+* Fix reversed order of Haddock documentation in Template Haskell mode. See
+  [issue #1832][is-1832] and [PR #1895][pr-1895].
+* In Template Haskell mode, traces are no longer prefixed with "Template
+  Haskell error: ", which made warnings look like errors. All traces now go to
+  `stderr` (previously, only warnings and errors did). See [issue
+  #2216][is-2216].
+* Fix duplicated `--safe`, `--unsafe`, and `--pointer` options in the
+  `preprocess --help` output. See [issue #2010][is-2010].
+
+[manual-c-stages]: https://github.com/well-typed/hs-bindgen/blob/main/manual/low-level/usage/c-stages.md
+[manual-ffi-types]: https://github.com/well-typed/hs-bindgen/blob/main/manual/low-level/translation/ffi-types.md
+[is-831]: https://github.com/well-typed/hs-bindgen/issues/831
+[is-1003]: https://github.com/well-typed/hs-bindgen/issues/1003
+[is-1225]: https://github.com/well-typed/hs-bindgen/issues/1225
+[is-1253]: https://github.com/well-typed/hs-bindgen/issues/1253
+[is-1382]: https://github.com/well-typed/hs-bindgen/issues/1382
+[is-1432]: https://github.com/well-typed/hs-bindgen/issues/1432
+[is-1445]: https://github.com/well-typed/hs-bindgen/issues/1445
+[is-1520]: https://github.com/well-typed/hs-bindgen/issues/1520
+[is-1574]: https://github.com/well-typed/hs-bindgen/issues/1574
+[is-1685]: https://github.com/well-typed/hs-bindgen/issues/1685
+[is-1715]: https://github.com/well-typed/hs-bindgen/issues/1715
+[is-1790]: https://github.com/well-typed/hs-bindgen/issues/1790
+[is-1832]: https://github.com/well-typed/hs-bindgen/issues/1832
+[is-1860]: https://github.com/well-typed/hs-bindgen/issues/1860
+[is-1868]: https://github.com/well-typed/hs-bindgen/issues/1868
+[is-1891]: https://github.com/well-typed/hs-bindgen/issues/1891
+[is-1910]: https://github.com/well-typed/hs-bindgen/issues/1910
+[is-1953]: https://github.com/well-typed/hs-bindgen/issues/1953
+[is-2010]: https://github.com/well-typed/hs-bindgen/issues/2010
+[is-2012]: https://github.com/well-typed/hs-bindgen/issues/2012
+[is-2014]: https://github.com/well-typed/hs-bindgen/issues/2014
+[is-2059]: https://github.com/well-typed/hs-bindgen/issues/2059
+[is-2060]: https://github.com/well-typed/hs-bindgen/issues/2060
+[is-2061]: https://github.com/well-typed/hs-bindgen/issues/2061
+[is-2064]: https://github.com/well-typed/hs-bindgen/issues/2064
+[is-2080]: https://github.com/well-typed/hs-bindgen/issues/2080
+[is-2083]: https://github.com/well-typed/hs-bindgen/issues/2083
+[is-2101]: https://github.com/well-typed/hs-bindgen/issues/2101
+[is-2121]: https://github.com/well-typed/hs-bindgen/issues/2121
+[is-2166]: https://github.com/well-typed/hs-bindgen/issues/2166
+[is-2185]: https://github.com/well-typed/hs-bindgen/issues/2185
+[is-2198]: https://github.com/well-typed/hs-bindgen/issues/2198
+[is-2210]: https://github.com/well-typed/hs-bindgen/issues/2210
+[is-2214]: https://github.com/well-typed/hs-bindgen/issues/2214
+[is-2216]: https://github.com/well-typed/hs-bindgen/issues/2216
+[is-2217]: https://github.com/well-typed/hs-bindgen/issues/2217
+[is-2230]: https://github.com/well-typed/hs-bindgen/issues/2230
+[is-2235]: https://github.com/well-typed/hs-bindgen/issues/2235
+[is-2236]: https://github.com/well-typed/hs-bindgen/issues/2236
+[is-2242]: https://github.com/well-typed/hs-bindgen/issues/2242
+[is-2243]: https://github.com/well-typed/hs-bindgen/issues/2243
+[is-2246]: https://github.com/well-typed/hs-bindgen/issues/2246
+[is-2264]: https://github.com/well-typed/hs-bindgen/issues/2264
+[is-2266]: https://github.com/well-typed/hs-bindgen/issues/2266
+[is-2280]: https://github.com/well-typed/hs-bindgen/issues/2280
+[is-2287]: https://github.com/well-typed/hs-bindgen/issues/2287
+[pr-1862]: https://github.com/well-typed/hs-bindgen/pull/1862
+[pr-1892]: https://github.com/well-typed/hs-bindgen/pull/1892
+[pr-1895]: https://github.com/well-typed/hs-bindgen/pull/1895
+[pr-1917]: https://github.com/well-typed/hs-bindgen/pull/1917
+[pr-1921]: https://github.com/well-typed/hs-bindgen/pull/1921
+[pr-1955]: https://github.com/well-typed/hs-bindgen/pull/1955
+[pr-2017]: https://github.com/well-typed/hs-bindgen/pull/2017
+[pr-2021]: https://github.com/well-typed/hs-bindgen/pull/2021
+[pr-2034]: https://github.com/well-typed/hs-bindgen/pull/2034
+[pr-2068]: https://github.com/well-typed/hs-bindgen/pull/2068
+[pr-2070]: https://github.com/well-typed/hs-bindgen/pull/2070
+[pr-2075]: https://github.com/well-typed/hs-bindgen/pull/2075
+[pr-2087]: https://github.com/well-typed/hs-bindgen/pull/2087
+[pr-2091]: https://github.com/well-typed/hs-bindgen/pull/2091
+[pr-2094]: https://github.com/well-typed/hs-bindgen/pull/2094
+[pr-2136]: https://github.com/well-typed/hs-bindgen/pull/2136
+[pr-2150]: https://github.com/well-typed/hs-bindgen/pull/2150
+[pr-2164]: https://github.com/well-typed/hs-bindgen/pull/2164
+[pr-2267]: https://github.com/well-typed/hs-bindgen/pull/2267
+[pr-2281]: https://github.com/well-typed/hs-bindgen/pull/2281
+
+## 0.1.0-alpha2 -- 2026-03-27
+
+### Breaking changes
+
+* Rename option `--enable-record-dot` to `--omit-field-prefixes`, which is more
+  to the point.
+* Occurrences of the `CFieldType`/`CBitfieldType` type families in
+  class instance heads are now replaced by their definition.
+* `--enable-blocks` CLI option renamed to `-fblocks`, matching `clang`
+* Macro declarations are now handled internally using a separate namespace.
+  Binding specifications and selection predicates now refer to macros using
+  `macro`.  For example, a macro named `foo` is referred to as `macro foo`.
+* For C function *declarations* that take arrays as arguments, generate Haskell
+  function declarations that take pointers to their corresponding array
+  *elements* as arguments. This uses the `Elem` associated type class from the
+  new `IsArray` class. See [PR #1712][pr-1712].
+* For C function *types* (.e.g, `typedef`s) that take arrays as arguments,
+  generate Haskell function types (.e.g, `newtype`s) that take pointers to their
+  corresponding array *elements* as arguments. This uses the `Elem` associated
+  type class from the new `IsArray` class. See [PR #1712][pr-1712].
+* Parse predicates have been removed. Now, `hs-bindgen` always parses and
+  reifies all declarations, reducing code complexity and cognitive overhead
+  imposed on users. To migrate, remove `--parse-*` command line client options,
+  or the parse-related configuration option when using Template Haskell model.
+
+### New features
+
+* The `info include-graph` sub-command has received new options: `--include
+  PCRE`, and `--exclude PCRE` allow fine-tuned choice of headers to include or
+  exclude from the include graph; `--simple` reduces include graph verbosity,
+  for example, by removing edge labels.
+* Generate explicit export lists in preprocessor-generated modules, hiding
+  internal `hs_bindgen_` helper bindings from the public API and documentation
+  ([#76](https://github.com/well-typed/hs-bindgen/issues/76)). Export items
+  are module-qualified (e.g. `Example.myFunc`) to avoid ambiguity with
+  Prelude names.
+* The command line client has a new `internal frontend` sub-command. It takes a
+  `--pass` option (e.g. `internal frontend --pass select`), dumping the result
+  of the provided frontend pass. Defaults to `adjust-types` (the final pass)
+  when omitted.
+* Add `--post-qualified-imports` flag to generate post-qualified imports
+  (`import Data.Proxy qualified`) instead of pre-qualified imports. This adds
+  the `ImportQualifiedPost` language extension to generated modules.
+* Support top-level untagged structs and enums as global variables
+  (e.g., `struct { int x; int y; } point;`). The untagged type is named
+  after the global variable. Extern untagged declarations
+  (e.g., `extern struct { .. } config;`) are rejected as unusable.
+* Generate an `IsArray` instance for each newtype of a type with an `IsArray`
+* Support unnamed bit-field declarations, used for padding.
+* Generate bindings for nested struct and union declarations even if we failed
+  to generate bindings for the enclosing struct or union. See [PR
+  #1849][pr-1849].
+* Generate bindings for nested anonymous structs and unions. See [PR
+  #1839][pr-1839] and [PR #1869][pr-1869].
+
+### Minor changes
+
+* Support `language-c` 0.9.x through 0.10.2
+  ([#1662](https://github.com/well-typed/hs-bindgen/issues/1662)).
+* Re-export all global definitions used by `hs-bindgen` generated code from
+  `hs-bindgen-runtime`. This may affect required packages when using
+  `hs-bindgen` generated code. In particular, the packages `ghc-prim` and
+  `primitive` are not required by `hs-bindgen` generated code anymore.
+* Improve and disambiguate delayed parse trace messages.
+* Improve error handling in `hs-bindgen` frontend, see [issue #1009][is-1009]
+
+### Bug fixes
+
+* Fix generation of documentation for record fields in Template Haskell mode
+  with `OmitFieldPrefixes`. Previously, duplicate record fields induced "ambiguous
+  occurrence" errors. This fix is only available for GHC versions 9.8 and newer.
+  For older versions of GHC, we deactivated creation of documentation for record
+  fields in Template Haskell mode.
+* Generate bindings for `static` (non-`const`) declarations. Previously these
+  were rejected as an unsupported, even though the duplicate-symbols warning
+  suggested using `static`
+  ([#1769](https://github.com/well-typed/hs-bindgen/issues/1769)).
+* Wrap function names in parentheses in generated C wrappers (`(erf)(x)`
+  instead of `erf(x)`) to prevent function-like macro expansion when a macro
+  shadows the function name.
+* Fix incorrect enum constant values for enums with unsigned underlying types
+  (e.g. `enum : uint8_t`). Values above the signed range (such as 128 or 255
+  for `uint8_t`) were incorrectly stored as negative numbers because
+  `hs-bindgen` used the signed libclang API.
+* Include `FunPtr` for macro-defined newtypes. See [PR #1711][pr-1711].
+* Fix a panic that occurred in some cases when generating `_Aux` newtypes for
+  function pointers. See [issue #1694][is-1694] and [PR #1724][pr-1724].
+* Fix a panic that occurred when the argument to a `#include` is a macro. In
+  Haddock documentation of declarations in the included header, we just
+  document the filename of the header.
+* Fix `--create-output-dirs` not creating directories for `--gen-binding-spec`
+  output paths. See [issue #1806][is-1806].
+* Skip functions whose parameters reference struct/union declarations that
+  will not be visible outside of the function, including both forward
+  references and inline definitions. This could indicate a missing `#include`
+  in the C header. Previously, forward references caused a panic in
+  `MangleNames`; now they are skipped with a warning.
+
+[is-1009]: https://github.com/well-typed/hs-bindgen/issues/1009
+[is-1694]: https://github.com/well-typed/hs-bindgen/issues/1694
+[is-1806]: https://github.com/well-typed/hs-bindgen/issues/1806
+[pr-1711]: https://github.com/well-typed/hs-bindgen/pull/1711
+[pr-1712]: https://github.com/well-typed/hs-bindgen/pull/1712
+[pr-1724]: https://github.com/well-typed/hs-bindgen/pull/1724
+[pr-1839]: https://github.com/well-typed/hs-bindgen/pull/1839
+[pr-1849]: https://github.com/well-typed/hs-bindgen/pull/1849
+[pr-1869]: https://github.com/well-typed/hs-bindgen/pull/1869
+
+## 0.1.0-alpha -- 2026-02-06
+
+* First public pre-release.
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,29 @@
+Copyright (c) 2024-2026, Well-Typed LLP and Anduril Industries Inc.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of the copyright holder nor the names of its
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+# `hs-bindgen`
+
+`hs-bindgen` is a [Haskell][] library that *automatically* generates Haskell FFI
+bindings from C header files.
+
+See the [repository README][] for the manual and other information.
+
+[Haskell]: https://www.haskell.org/
+[repository README]: https://github.com/well-typed/hs-bindgen#hs-bindgen
diff --git a/app/HsBindgen/App.hs b/app/HsBindgen/App.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/App.hs
@@ -0,0 +1,617 @@
+{-# LANGUAGE ApplicativeDo #-}
+
+-- | @hs-bindgen@ application common types and functions
+module HsBindgen.App (
+    hsBindgen
+
+    -- * Global options
+  , GlobalOpts(..)
+  , parseGlobalOpts
+
+    -- * Argument/option parsers
+    -- ** Bindgen configuration
+  , Config
+  , parseConfig
+    -- ** Clang arguments
+  , parseClangArgsConfig
+    -- ** Translation option
+  , parseUniqueId
+    -- ** Module option
+  , parseBaseModuleName
+  , parseQualifiedStyle
+    -- ** Output options
+  , parseHsOutputDir
+  , parseDirPolicy
+  , parseFilePolicy
+  , parseGenBindingSpec
+  , parseGenTestsOutput
+    -- ** Input arguments
+  , parseInputs
+
+    -- * Auxiliary optparse-applicative functions
+  , cmd
+  , cmd_
+  ) where
+
+import Data.Char qualified as Char
+import Data.Default (Default (..))
+import Data.Either (partitionEithers)
+import Data.Maybe (catMaybes)
+import Options.Applicative
+import Options.Applicative.Extra (helperWith)
+import System.IO (stderr)
+
+import HsBindgen
+import HsBindgen.ArtefactM (DirPolicy (..), FilePolicy (..))
+import HsBindgen.BindingSpec
+import HsBindgen.Config
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Pass.Parse.IsPass (EmptyMacros (..))
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro (CExpr)
+import HsBindgen.Macro qualified as Macro
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+-- | Convenience entry point using the default C macro language.
+hsBindgen ::
+     TracerConfig Level     TraceMsg
+  -> TracerConfig SafeLevel SafeTraceMsg
+  -> BindgenConfig
+  -> [C.UncheckedRootDirective]
+  -> Artefact CExpr a
+  -> IO a
+hsBindgen = hsBindgenMacroLang (pure . Macro.cExpr)
+
+{-------------------------------------------------------------------------------
+  Global options
+-------------------------------------------------------------------------------}
+
+data GlobalOpts = GlobalOpts {
+      unsafe :: TracerConfig Level     TraceMsg
+    , safe   :: TracerConfig SafeLevel SafeTraceMsg
+    }
+
+parseGlobalOpts :: Parser GlobalOpts
+parseGlobalOpts = aux <$> parseAnsiColor <*> parseTracerConfig
+  where
+    aux :: Maybe AnsiColor -> TracerConfig Level TraceMsg -> GlobalOpts
+    aux ansiColor tracerConfig =
+      let tracerConfigUnsafe :: TracerConfig Level TraceMsg
+          tracerConfigUnsafe =
+            tracerConfig { outputConfig = mkOutputConfig ansiColor }
+          tracerConfigSafe :: TracerConfig SafeLevel SafeTraceMsg
+          tracerConfigSafe = TracerConfig {
+              verbosity      = tracerConfig.verbosity
+            , outputConfig   = mkOutputConfig ansiColor
+            , customLogLevel = mempty
+            , showCallStack  = tracerConfig.showCallStack
+            }
+      in  GlobalOpts tracerConfigUnsafe tracerConfigSafe
+
+{-------------------------------------------------------------------------------
+  Output configuration
+-------------------------------------------------------------------------------}
+
+-- | Output configuration writing to 'stderr' with the given ANSI color setting.
+--
+-- 'Nothing' auto-detects color support from the handle.
+mkOutputConfig :: Maybe AnsiColor -> OutputConfig e
+mkOutputConfig ansiColor = OutputConfigHandle OutputHandle {
+      handle    = stderr
+    , ansiColor = ansiColor
+    }
+
+-- | Parse the @--color WHEN@ option: 'Nothing' (auto) is the default.
+parseAnsiColor :: Parser (Maybe AnsiColor)
+parseAnsiColor = option (eitherReader auxParse) $ mconcat [
+      long "color"
+    , metavar "WHEN"
+    , value Nothing
+    , showDefaultWith auxRender
+    , help "Colorize diagnostics WHEN (supported: always, auto, never)"
+    ]
+  where
+    auxParse :: String -> Either String (Maybe AnsiColor)
+    auxParse = \case
+      "always" -> Right (Just EnableAnsiColor)
+      "auto"   -> Right Nothing
+      "never"  -> Right (Just DisableAnsiColor)
+      other    -> Left $
+        "invalid color mode: " ++ other ++ " (supported: always, auto, never)"
+
+    auxRender :: Maybe AnsiColor -> String
+    auxRender = \case
+      Just EnableAnsiColor  -> "always"
+      Nothing               -> "auto"
+      Just DisableAnsiColor -> "never"
+
+{-------------------------------------------------------------------------------
+  Tracer configuration
+-------------------------------------------------------------------------------}
+
+parseTracerConfig :: Parser (TracerConfig Level TraceMsg)
+parseTracerConfig =
+    TracerConfig
+      <$> parseVerbosity
+      <*> pure def
+      <*> parseCustomLogLevel
+      <*> parseShowCallStack
+
+parseVerbosity :: Parser Verbosity
+parseVerbosity = fmap nToVerbosity . option auto $ mconcat [
+      short 'v'
+    , long "verbosity"
+    , metavar "INT"
+    , value 2
+    , help "Verbosity (0: error, 1: warning, 2: notice, 3: info, 4: debug)"
+    , showDefault
+    ]
+  where
+    nToVerbosity :: Int -> Verbosity
+    nToVerbosity = Verbosity . \case
+      n | n <= 0 -> Error
+      1          -> Warning
+      2          -> Notice
+      3          -> Info
+      _otherwise -> Debug
+
+parseCustomLogLevel :: Parser (CustomLogLevel Level TraceMsg)
+parseCustomLogLevel = do
+    -- Generic setters
+    makeTraceInfos    <- many $ parseMakeTrace Info
+    makeTraceWarnings <- many $ parseMakeTrace Warning
+    makeTraceErrors   <- many $ parseMakeTrace Error
+    -- Generic modifiers
+    makeBugsErrors     <- optional parseMakeBugsErrors
+    makeWarningsErrors <- optional parseMakeWarningsErrors
+    -- Specific setters
+    enableMacroWarnings         <- optional parseEnableMacroWarnings
+    makeMangleNamesSquashedInfo <- optional parseMakeMangleNamesSquashedInfo
+    pure $ getCustomLogLevel $ catMaybes [
+        enableMacroWarnings
+      , makeMangleNamesSquashedInfo
+      , makeBugsErrors
+      , makeWarningsErrors
+      ]
+      ++ makeTraceInfos
+      ++ makeTraceWarnings
+      ++ makeTraceErrors
+  where
+    parseMakeTrace :: Level -> Parser CustomLogLevelSetting
+    parseMakeTrace level =
+      let levelStr = map Char.toLower $ show level
+      in  fmap (MakeTrace level) . strOption $ mconcat [
+              long $ "log-as-" <> levelStr
+            , metavar "TRACE_ID"
+            , help $ "Set log level of traces with TRACE_ID to " <> levelStr
+            ]
+
+    parseMakeBugsErrors :: Parser CustomLogLevelSetting
+    parseMakeBugsErrors = flag' MakeBugsErrors $ mconcat [
+        long "log-as-error-bugs"
+      , help "Set log level of bugs to error"
+      ]
+
+    parseMakeWarningsErrors :: Parser CustomLogLevelSetting
+    parseMakeWarningsErrors = flag' MakeWarningsErrors $ mconcat [
+        long "log-as-error-warnings"
+      , help "Set log level of warnings and bugs to error"
+      ]
+
+    parseEnableMacroWarnings :: Parser CustomLogLevelSetting
+    parseEnableMacroWarnings = flag' EnableMacroWarnings $ mconcat [
+        long "log-enable-macro-warnings"
+      , help $ concat [
+            "Set log level of macro reparse and typecheck errors to warning"
+          , " (default: info)"
+          ]
+      ]
+
+    parseMakeMangleNamesSquashedInfo :: Parser CustomLogLevelSetting
+    parseMakeMangleNamesSquashedInfo =
+        flag' MakeMangleNamesSquashedInfo $ mconcat [
+            long "log-squashed-as-info"
+          , help $ concat [
+                "Set log level of squashed-typedef traces to info"
+              , " (default: notice)"
+              ]
+          ]
+
+parseShowCallStack :: Parser ShowCallStack
+parseShowCallStack = flag DisableCallStack EnableCallStack $ mconcat [
+      long "log-show-call-stack"
+    , help "Show call stacks in traces"
+    ]
+
+{-------------------------------------------------------------------------------
+  Configuration
+-------------------------------------------------------------------------------}
+
+type Config = Config_ FilePath
+
+parseConfig :: Parser Config
+parseConfig = Config
+    <$> parseClangArgsConfig
+    <*> parseBindingSpec
+    <*> parseSelectionPredicate
+    <*> parseProgramSlicing
+    <*> parseFieldNamingStrategy
+    <*> parseEmptyMacros
+
+{-------------------------------------------------------------------------------
+  Binding specifications
+-------------------------------------------------------------------------------}
+
+parseBindingSpec :: Parser BindingSpecConfig
+parseBindingSpec = BindingSpecConfig
+  <$> parseEnableStdlibBindingSpec
+  <*> parseBindingSpecAllowNewer
+  <*> many parseExtBindingSpec
+  <*> optional parsePrescriptiveBindingSpec
+
+parseEnableStdlibBindingSpec :: Parser EnableStdlibBindingSpec
+parseEnableStdlibBindingSpec =
+    flag EnableStdlibBindingSpec DisableStdlibBindingSpec $ mconcat [
+        long "no-stdlib"
+      , help "Do not automatically use stdlib external binding specification"
+      ]
+
+parseBindingSpecAllowNewer :: Parser BindingSpecCompatibility
+parseBindingSpecAllowNewer =
+    flag BindingSpecStrict BindingSpecAllowNewer $ mconcat [
+        long "binding-spec-allow-newer"
+      , help "Parse binding specifications with newer minor version"
+      ]
+
+parseExtBindingSpec :: Parser FilePath
+parseExtBindingSpec = strOption $ mconcat [
+      long "external-binding-spec"
+    , metavar "FILE"
+    , help "External binding specification (YAML file)"
+    ]
+
+parsePrescriptiveBindingSpec :: Parser FilePath
+parsePrescriptiveBindingSpec = strOption $ mconcat [
+      long "prescriptive-binding-spec"
+    , metavar "FILE"
+    , help "Prescriptive binding specification (YAML file)"
+    ]
+
+{-------------------------------------------------------------------------------
+  Builtin include directory
+-------------------------------------------------------------------------------}
+
+parseBuiltinIncDirConfig :: Parser BuiltinIncDirConfig
+parseBuiltinIncDirConfig = option (eitherReader auxParse) $ mconcat [
+      long "builtin-include-dir"
+    , metavar "MODE"
+    , showDefaultWith auxRender
+    , value BuiltinIncDirClang
+    , help
+        "Configure builtin include directory (supported: clang, disable)"
+    ]
+  where
+    auxParse :: String -> Either String BuiltinIncDirConfig
+    auxParse = \case
+      "clang"   -> Right BuiltinIncDirClang
+      "disable" -> Right BuiltinIncDirDisable
+      other     -> Left $ "invalid builtin include directory mode: " ++ other
+
+    auxRender :: BuiltinIncDirConfig -> String
+    auxRender = \case
+      BuiltinIncDirClang   -> "clang"
+      BuiltinIncDirDisable -> "disable"
+
+{-------------------------------------------------------------------------------
+  Clang arguments
+-------------------------------------------------------------------------------}
+
+parseClangArgsConfig :: Parser (ClangArgsConfig FilePath)
+parseClangArgsConfig = do
+    -- ApplicativeDo to be able to reorder arguments for --help, and to use
+    -- record construction (i.e., to avoid bool or string/path blindness)
+    -- instead of positional one.
+    enableBlocks     <- parseEnableBlocks
+    builtinIncDir    <- parseBuiltinIncDirConfig
+    extraIncludeDirs <- many parseIncludeDir
+    argsBefore       <- many parseClangOptionBefore
+    argsInner        <- many parseClangOptionInner
+    argsAfter        <- many parseClangOptionAfter
+    pure $ ClangArgsConfig{
+        enableBlocks     = enableBlocks
+      , builtinIncDir    = builtinIncDir
+      , extraIncludeDirs = extraIncludeDirs
+      , argsBefore       = argsBefore
+      , argsInner        = argsInner
+      , argsAfter        = argsAfter
+      }
+
+parseEnableBlocks :: Parser Bool
+parseEnableBlocks = switch $ mconcat [
+      long "fblocks"
+    , help "Enable the 'blocks' language feature"
+    ]
+
+parseIncludeDir :: Parser FilePath
+parseIncludeDir = strOption $ mconcat [
+      short 'I'
+    , metavar "DIR"
+    , help "Include search path directory"
+    ]
+
+parseClangOptionBefore :: Parser String
+parseClangOptionBefore = strOption $ mconcat [
+      long "clang-option-before"
+    , metavar "OPTION"
+    , help "Prepend option when calling Clang; see also --clang-option"
+    ]
+
+parseClangOptionInner :: Parser String
+parseClangOptionInner = strOption $ mconcat [
+      long "clang-option"
+    , metavar "OPTION"
+    , help "Pass option to Clang"
+    ]
+
+parseClangOptionAfter :: Parser String
+parseClangOptionAfter = strOption $ mconcat [
+      long "clang-option-after"
+    , metavar "OPTION"
+    , help "Append option when calling Clang; see also --clang-option"
+    ]
+
+{-------------------------------------------------------------------------------
+  Predicates and slicing
+-------------------------------------------------------------------------------}
+
+parseSelectionPredicate :: Parser (Boolean SelectionPredicate)
+parseSelectionPredicate = fmap aux . many . asum $ [
+      flag' (Right BTrue) $ mconcat [
+          long "select-all"
+        , help "Select all declarations"
+        ]
+    , flag' (Right (BIf (SelectHeader FromMainHeaders))) $ mconcat [
+          long "select-from-main-headers"
+        , help "Select declarations in main headers (default)"
+        ]
+    , flag' (Right (BIf (SelectHeader FromMainHeaderDirs))) $ mconcat [
+          long "select-from-main-header-dirs"
+        , help "Select declarations in main header directories"
+        ]
+    , flag' (Right (BIf (SelectHeader FromAllHeaders))) $ mconcat [
+          long "select-from-all-headers"
+        , help $ concat [
+              "Select declarations in any header"
+            , " (unlike --select-all, not root directives or -D options)"
+            ]
+        ]
+    , fmap (Right . BIf . SelectHeader . HeaderPathMatches) $ strOption $ mconcat [
+          long "select-by-header-path"
+        , metavar "PCRE"
+        , help "Select declarations in headers with paths that match PCRE"
+        ]
+    , fmap (Left . BIf . SelectHeader . HeaderPathMatches) $ strOption $ mconcat [
+          long "select-except-by-header-path"
+        , metavar "PCRE"
+        , help $ concat [
+              "Select except declarations in headers with paths that match"
+            , " PCRE"
+            ]
+        ]
+    , fmap (Right . BIf . SelectDecl . DeclNameMatches) $ strOption $ mconcat [
+          long "select-by-decl-name"
+        , metavar "PCRE"
+        , help "Select declarations with C names that match PCRE"
+        ]
+    , fmap (Left . BIf . SelectDecl . DeclNameMatches) $ strOption $ mconcat [
+          long "select-except-by-decl-name"
+        , metavar "PCRE"
+        , help "Select except (i.e., do not select) declarations with C names that match PCRE"
+        ]
+    , flag' (Left $ BIf $ SelectDecl DeclDeprecated) $ mconcat [
+          long "select-except-deprecated"
+        , help "Select except (i.e., do not select) deprecated declarations"
+        ]
+    ]
+  where
+    aux ::
+         [Either (Boolean SelectionPredicate) (Boolean SelectionPredicate)]
+      -> (Boolean SelectionPredicate)
+    aux = uncurry mergeBooleans . fmap applyDefault . partitionEithers
+
+    applyDefault :: Default a => [a] -> [a]
+    applyDefault = \case
+      [] -> [def]
+      ps -> ps
+
+parseProgramSlicing :: Parser ProgramSlicing
+parseProgramSlicing =
+    flag DisableProgramSlicing EnableProgramSlicing $ mconcat [
+        long "enable-program-slicing"
+      , help $ concat [
+            "Enable program slicing:"
+          , " Select declarations using the selection predicate,"
+          , " and also select their transitive dependencies;"
+          , " program slicing can cause declarations to be included"
+          , " even if they are explicitly deselected by a selection predicate"
+          ]
+      ]
+
+{-------------------------------------------------------------------------------
+  Macros
+-------------------------------------------------------------------------------}
+
+parseEmptyMacros :: Parser EmptyMacros
+parseEmptyMacros =
+    flag DoNotParseEmptyMacros ParseEmptyMacros $ mconcat [
+        long "parse-empty-macros"
+      , help $ concat [
+            "Parse macros with an empty replacement list (e.g. '#define FOO');"
+          , " by default, empty macros are not parsed"
+          ]
+      ]
+
+{-------------------------------------------------------------------------------
+  Translation options
+-------------------------------------------------------------------------------}
+
+parseUniqueId :: Parser UniqueId
+parseUniqueId = fmap UniqueId . strOption $ mconcat [
+      long "unique-id"
+    , metavar "ID"
+    , value ""
+    , help $ concat [
+          "Use unique ID to discriminate global C identifiers"
+        , " (default: empty string)"
+        ]
+    ]
+
+{-------------------------------------------------------------------------------
+  Module option
+-------------------------------------------------------------------------------}
+
+
+parseFieldNamingStrategy :: Parser FieldNamingStrategy
+parseFieldNamingStrategy =
+    flag AddFieldPrefixes OmitFieldPrefixes $ mconcat [
+        long "omit-field-prefixes"
+      , help $ concat [
+            "Use unprefixed field names (e.g. 'x' instead of 'structName_x'). "
+          , "All newtype unwrap functions are called 'unwrap'. "
+          , "Requires 'DuplicateRecordFields' extension."
+          ]
+      ]
+
+parseQualifiedStyle :: Parser QualifiedStyle
+parseQualifiedStyle =
+    flag PreQualified PostQualified $ mconcat [
+        long "post-qualified-imports"
+      , help $ concat [
+            "Use post-qualified imports (e.g. 'import Data.Proxy qualified')"
+          , " instead of pre-qualified imports."
+          , " Adds 'ImportQualifiedPost' extension."
+          ]
+      ]
+
+parseBaseModuleName :: Parser BaseModuleName
+parseBaseModuleName = strOption $ mconcat [
+      long "module"
+    , metavar "NAME"
+    , showDefault
+    , value def
+    , help "Base name of the generated Haskell modules"
+    ]
+
+{-------------------------------------------------------------------------------
+  Output options
+-------------------------------------------------------------------------------}
+
+parseHsOutputDir :: Parser FilePath
+parseHsOutputDir = strOption $ mconcat [
+      long "hs-output-dir"
+    , metavar "PATH"
+    , help "Output directory of generated Haskell modules"
+    ]
+
+parseDirPolicy :: Parser DirPolicy
+parseDirPolicy = flag DoNotCreateOutputDirs CreateOutputDirs $ mconcat [
+      long "create-output-dirs"
+    , help "Create the specified output directories if they do not exist"
+    ]
+
+parseFilePolicy :: Parser FilePolicy
+parseFilePolicy = flag DoNotOverwriteFiles AllowFileOverwrite $ mconcat [
+      long "overwrite-files"
+    , help "Allow overwriting existing output files"
+    ]
+
+parseGenBindingSpec :: Parser FilePath
+parseGenBindingSpec = strOption $ mconcat [
+      long "gen-binding-spec"
+    , metavar "PATH"
+    , help "Binding specification to generate"
+    ]
+
+parseGenTestsOutput :: Parser FilePath
+parseGenTestsOutput = strOption $ mconcat [
+      short 'o'
+    , long "output"
+    , metavar "PATH"
+    , showDefault
+    , value "test-hs-bindgen"
+    , help "Output directory for the test suite"
+    ]
+
+{-------------------------------------------------------------------------------
+  Input arguments
+-------------------------------------------------------------------------------}
+
+-- | Parse one or more input root directives
+--
+-- @#include@s and @#define@s form a single ordered list: a @#define@ only
+-- affects the headers listed after it.
+--
+-- We check that at least one directive is of type @#include@ when the root
+-- header is constructed ('HsBindgen.Frontend.RootHeader.fromRootDirectives').
+-- This ensures that CLI and TH mode have the same behavior. Also,
+-- @optparse-applicative@ can only reject the parsed list with monadic
+-- sequencing, but its usage renderer does not distinguish monadic sequencing
+-- from repetition, so every bind picks up the @multiSuffix@ marker.
+parseInputs :: Parser [C.UncheckedRootDirective]
+parseInputs = some . asum $ [
+      C.DirectiveHashInclude <$> parseHashInclude
+    , C.DirectiveHashDefine  <$> parseHashDefine
+    ]
+  where
+    parseHashInclude :: Parser C.UncheckedHashIncludeArg
+    parseHashInclude = strArgument $ mconcat [
+        metavar "HEADER"
+      , help "Input C header(s), relative to an include path directory"
+      ]
+
+    parseHashDefine :: Parser C.HashDefine
+    parseHashDefine =
+        C.HashDefine
+          -- The metavar covers both arguments, so that @--help@ shows the
+          -- @#define@ shape; the value argument itself renders nothing.
+          <$> strOption   (long "hash-define" <> metavar "NAME VALUE" <> help hashDefineHelp)
+          <*> strArgument mempty
+
+    hashDefineHelp :: String
+    hashDefineHelp = unwords [
+        "Emit '#define NAME VALUE' before the following headers."
+      , "See 'Root directives' in the manual"
+      , "(manual/low-level/usage/c-stages.md)."
+      ]
+
+{-------------------------------------------------------------------------------
+  Auxiliary optparse-applicative functions
+-------------------------------------------------------------------------------}
+
+-- | Command with @-h@ and @--help@
+cmd ::
+     String     -- ^ Name
+  -> (a -> c)   -- ^ Constructor
+  -> Parser a   -- ^ Options parser
+  -> InfoMod c  -- ^ Information
+  -> Mod CommandFields c
+cmd name mk parser = command name . info (helper <*> (mk <$> parser))
+
+-- | Command with @--help@ (but no @-h@)
+cmd_ ::
+     String     -- ^ Name
+  -> (a -> c)   -- ^ Constructor
+  -> Parser a   -- ^ Options parser
+  -> InfoMod c  -- ^ Information
+  -> Mod CommandFields c
+cmd_ name mk parser = command name . info (helper' <*> (mk <$> parser))
+  where
+    helper' :: Parser (a -> a)
+    helper' = helperWith $ mconcat [
+        long "help"
+      , help "Show this help text"
+      ]
diff --git a/app/HsBindgen/App/Output.hs b/app/HsBindgen/App/Output.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/App/Output.hs
@@ -0,0 +1,160 @@
+{-# LANGUAGE ApplicativeDo #-}
+{-# LANGUAGE RecordWildCards #-}
+
+-- | Output mode and category selection options for @hs-bindgen@
+module HsBindgen.App.Output (
+    -- * Output mode
+    OutputMode(..)
+  , parseOutputMode
+    -- * Single-file category selection
+  , SingleFileCategory(..)
+  , parseSingleFileCategories
+    -- * Output options
+  , OutputOptions(..)
+  , parseOutputOptions
+    -- * Builder
+  , buildCategoryChoice
+  ) where
+
+import Data.Default (Default (..))
+import Data.List.NonEmpty (NonEmpty (..))
+import Data.Text (Text)
+import GHC.Generics (Generic)
+import Options.Applicative
+import Options.Applicative.NonEmpty (some1)
+
+import HsBindgen.Backend.Category (ByCategory (..), Choice (..),
+                                   RenameTerm (..))
+import HsBindgen.Backend.Level (Level (..))
+
+{-------------------------------------------------------------------------------
+  Output mode
+-------------------------------------------------------------------------------}
+
+-- | Output mode (single-file vs multi-module)
+data OutputMode =
+    FilePerModule
+      -- ^ One file per category (default)
+  | SingleFile (NonEmpty SingleFileCategory)
+      -- ^ Single file combining categories
+  deriving (Show, Eq)
+
+-- | Parse output mode
+parseOutputMode :: OutputMode -> Parser OutputMode
+parseOutputMode defMode =
+  asum [
+    (flag' FilePerModule $ mconcat [
+        long "file-per-module"
+      , help "Generate one file per binding category (default)"
+      ])
+  , (flag' SingleFile $ mconcat [
+        long "single-file"
+      , help (  "Generate a single module file. If more than one category selected "
+             ++ "they will be combined. If more than one of the same category is "
+             ++ "selected only the last suffix is used."
+             )
+      ]) <*> parseSingleFileCategories
+  , pure defMode
+  ]
+
+{-------------------------------------------------------------------------------
+  Single-file category selection
+-------------------------------------------------------------------------------}
+
+-- | Which category to include in single-file mode (required when mode=SingleFile)
+data SingleFileCategory =
+    SingleFileSafe Text
+      -- ^ Safe only, with optional suffix (empty = none)
+  | SingleFileUnsafe Text
+      -- ^ Unsafe only, with optional suffix
+  | SingleFilePointer Text
+      -- ^ Pointer only, with optional suffix
+  deriving (Show, Eq)
+
+-- | Parse single-file category selections (one or more required)
+parseSingleFileCategories :: Parser (NonEmpty SingleFileCategory)
+parseSingleFileCategories = some1 parseSingleFileCategory
+  where
+    parseSingleFileCategory :: Parser SingleFileCategory
+    parseSingleFileCategory =
+          (SingleFileSafe <$> strOption (mconcat [
+                long "safe"
+              , metavar "SUFFIX"
+              , help "Include safe bindings (empty suffix for no suffix)"
+              ]))
+      <|> (SingleFileUnsafe <$> strOption (mconcat [
+                long "unsafe"
+              , metavar "SUFFIX"
+              , help "Include unsafe bindings (empty suffix for no suffix)"
+              ]))
+      <|> (SingleFilePointer <$> strOption (mconcat [
+                long "pointer"
+              , metavar "SUFFIX"
+              , help "Include pointer bindings (empty suffix for no suffix)"
+              ]))
+
+{-------------------------------------------------------------------------------
+  Output options
+-------------------------------------------------------------------------------}
+
+-- | Output options
+newtype OutputOptions = OutputOptions { mode :: OutputMode }
+  deriving (Show, Eq, Generic)
+
+-- | Parse output options
+parseOutputOptions :: OutputMode -> Parser OutputOptions
+parseOutputOptions defMode = OutputOptions <$> parseOutputMode defMode
+
+{-------------------------------------------------------------------------------
+  Builder
+-------------------------------------------------------------------------------}
+
+-- | Build 'ByCategory' 'Choice' from output options
+--
+-- When multiple categories are selected, each category gets the specified suffix
+-- to avoid duplicate symbols. When only one category is selected with an empty
+-- suffix, no renaming occurs.
+--
+buildCategoryChoice :: OutputOptions -> ByCategory Choice
+buildCategoryChoice opts = case opts.mode of
+  FilePerModule       -> useAllCategories
+  SingleFile cats     -> buildSingleFileChoice cats
+  where
+    -- Multi-module: all categories, no renaming
+    useAllCategories :: ByCategory Choice
+    useAllCategories = ByCategory {
+          cType   = IncludeTypeCategory
+        , cSafe   = IncludeTermCategory def
+        , cUnsafe = IncludeTermCategory def
+        , cFunPtr = IncludeTermCategory def
+        , cGlobal = IncludeTermCategory def
+        }
+
+    -- Single-file: build based on category selections
+    buildSingleFileChoice :: NonEmpty SingleFileCategory -> ByCategory Choice
+    buildSingleFileChoice cats = ByCategory {
+          cType   = IncludeTypeCategory
+        , cSafe   = foldMap safeChoice cats
+        , cUnsafe = foldMap unsafeChoice cats
+        , cFunPtr = foldMap pointerChoice cats
+        , cGlobal = IncludeTermCategory def
+        }
+
+    safeChoice :: SingleFileCategory -> Choice LvlTerm
+    safeChoice = \case
+      SingleFileSafe s    -> IncludeTermCategory (rename s)
+      _                   -> ExcludeCategory
+
+    unsafeChoice :: SingleFileCategory -> Choice LvlTerm
+    unsafeChoice = \case
+      SingleFileUnsafe s  -> IncludeTermCategory (rename s)
+      _                   -> ExcludeCategory
+
+    pointerChoice :: SingleFileCategory -> Choice LvlTerm
+    pointerChoice = \case
+      SingleFilePointer s -> IncludeTermCategory (rename s)
+      _                   -> ExcludeCategory
+
+    rename :: Text -> RenameTerm
+    rename "" = def  -- Empty suffix = no renaming
+    rename s  = RenameTerm (<> s)
diff --git a/app/HsBindgen/Cli.hs b/app/HsBindgen/Cli.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli.hs
@@ -0,0 +1,58 @@
+-- | @hs-bindgen-cli@ commands
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli qualified as Cli
+module HsBindgen.Cli (
+    -- * Commands
+    Cmd(..)
+  , parseCmd
+    -- * Execution
+  , exec
+  ) where
+
+import Options.Applicative
+
+import HsBindgen.App
+import HsBindgen.Cli.BindingSpec qualified as BindingSpec
+import HsBindgen.Cli.GenTests qualified as GenTests
+import HsBindgen.Cli.Info qualified as Info
+import HsBindgen.Cli.Internal qualified as Internal
+import HsBindgen.Cli.Preprocess qualified as Preprocess
+import HsBindgen.Cli.ToolSupport qualified as ToolSupport
+
+{-------------------------------------------------------------------------------
+  Commands
+-------------------------------------------------------------------------------}
+
+-- Ordered by usage
+data Cmd =
+    CmdPreprocess  Preprocess.Opts
+  | CmdGenTests    GenTests.Opts
+  | CmdBindingSpec BindingSpec.Cmd
+  | CmdInfo        Info.Cmd
+  | CmdInternal    Internal.Cmd
+  | CmdToolSupport ToolSupport.Cmd
+
+parseCmd :: Parser Cmd
+parseCmd = subparser $ mconcat [
+      cmd  "preprocess"   CmdPreprocess  Preprocess.parseOpts Preprocess.info
+    , cmd  "gen-tests"    CmdGenTests    GenTests.parseOpts   GenTests.info
+    , cmd  "binding-spec" CmdBindingSpec BindingSpec.parseCmd BindingSpec.info
+    , cmd  "info"         CmdInfo        Info.parseCmd        Info.info
+    , cmd  "internal"     CmdInternal    Internal.parseCmd    Internal.info
+    , cmd_ "tool-support" CmdToolSupport ToolSupport.parseCmd ToolSupport.info
+    ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Cmd -> IO ()
+exec gopts = \case
+    CmdPreprocess  opts -> Preprocess.exec  gopts opts
+    CmdGenTests    opts -> GenTests.exec    gopts opts
+    CmdBindingSpec cmd' -> BindingSpec.exec gopts cmd'
+    CmdInfo        cmd' -> Info.exec        gopts cmd'
+    CmdInternal    cmd' -> Internal.exec    gopts cmd'
+    CmdToolSupport cmd' -> ToolSupport.exec gopts cmd'
diff --git a/app/HsBindgen/Cli/BindingSpec.hs b/app/HsBindgen/Cli/BindingSpec.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/BindingSpec.hs
@@ -0,0 +1,47 @@
+-- | @hs-bindgen-cli binding-spec@ commands
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.BindingSpec qualified as BindingSpec
+module HsBindgen.Cli.BindingSpec (
+    -- * CLI help
+    info
+    -- * Commands
+  , Cmd(..)
+  , parseCmd
+    -- * Execution
+  , exec
+  ) where
+
+import Options.Applicative hiding (info)
+
+import HsBindgen.App
+import HsBindgen.Cli.BindingSpec.StdLib qualified as StdLib
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Binding specification commands"
+
+{-------------------------------------------------------------------------------
+  Commands
+-------------------------------------------------------------------------------}
+
+-- Ordered lexicographically
+newtype Cmd =
+    CmdStdLib StdLib.Opts
+
+parseCmd :: Parser Cmd
+parseCmd = subparser $ mconcat [
+      cmd "stdlib" CmdStdLib StdLib.parseOpts StdLib.info
+    ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Cmd -> IO ()
+exec gopts = \case
+    CmdStdLib opts -> StdLib.exec gopts opts
diff --git a/app/HsBindgen/Cli/BindingSpec/StdLib.hs b/app/HsBindgen/Cli/BindingSpec/StdLib.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/BindingSpec/StdLib.hs
@@ -0,0 +1,76 @@
+-- | @hs-bindgen-cli binding-spec stdlib@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.BindingSpec.StdLib qualified as StdLib
+module HsBindgen.Cli.BindingSpec.StdLib (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Data.ByteString qualified as BS
+import Options.Applicative hiding (info)
+import System.Exit (exitFailure)
+
+import HsBindgen.App
+import HsBindgen.BindingSpec
+import HsBindgen.Boot
+import HsBindgen.Config.ClangArgs
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Write stdlib external binding specification"
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+data Opts = Opts {
+      clangArgsConfig :: ClangArgsConfig FilePath
+    , output          :: Maybe FilePath
+    }
+
+parseOpts :: Parser Opts
+parseOpts =
+    Opts
+      <$> parseClangArgsConfig
+      <*> optional parseOutput'
+  where
+    parseOutput' :: Parser FilePath
+    parseOutput' = strOption $ mconcat [
+        short 'o'
+      , long "output"
+      , metavar "PATH"
+      , help "Output path for the binding specification"
+      ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts = do
+    mSpec <- withTracer global.unsafe $ \tracer -> do
+      clangArgs <- (.clangArgs) <$>
+        getClangArtefacts (contramap TraceBoot tracer) opts.clangArgsConfig
+      getStdlibBindingSpec
+        (contramap (TraceBoot . BootBindingSpec) tracer)
+        clangArgs
+    case mSpec of
+      Left _ -> do
+        putStrLn $ "An error happened (see above)"
+        exitFailure
+      Right spec ->
+        case opts.output of
+          Just path -> BS.writeFile path $ encode (getFormat path) spec
+          Nothing   -> BS.putStr         $ encode FormatYAML       spec
diff --git a/app/HsBindgen/Cli/GenTests.hs b/app/HsBindgen/Cli/GenTests.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/GenTests.hs
@@ -0,0 +1,76 @@
+-- | @hs-bindgen-cli gentests@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.GenTests qualified as GenTests
+module HsBindgen.Cli.GenTests (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Data.Default (Default (..))
+import Options.Applicative hiding (info)
+
+import HsBindgen
+import HsBindgen.App
+import HsBindgen.Config
+import HsBindgen.Config.Internal
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Generate tests for generated Haskell code"
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+data Opts = Opts {
+      config         :: Config
+    , uniqueId       :: UniqueId
+    , baseModuleName :: BaseModuleName
+    , output         :: FilePath
+    , inputs         :: [C.UncheckedRootDirective]
+    }
+
+parseOpts :: Parser Opts
+parseOpts =
+    Opts
+      <$> parseConfig
+      <*> parseUniqueId
+      <*> parseBaseModuleName
+      <*> parseGenTestsOutput
+      <*> parseInputs
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts =
+    hsBindgen
+      global.unsafe
+      global.safe
+      bindgenConfig
+      opts.inputs
+      artefact
+  where
+    artefact :: Artefact CExpr ()
+    artefact = writeTests opts.output
+
+    bindgenConfig :: BindgenConfig
+    bindgenConfig =
+        toBindgenConfig
+          opts.config
+          opts.uniqueId
+          opts.baseModuleName
+          def
diff --git a/app/HsBindgen/Cli/Info.hs b/app/HsBindgen/Cli/Info.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Info.hs
@@ -0,0 +1,99 @@
+-- | @hs-bindgen-cli info@ commands
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Info qualified as Info
+module HsBindgen.Cli.Info (
+    -- * CLI help
+    info
+    -- * Commands
+  , Cmd(..)
+  , parseCmd
+    -- * Execution
+  , exec
+  ) where
+
+import Options.Applicative hiding (info)
+
+import HsBindgen.App
+import HsBindgen.Cli.Info.BuiltinMacros qualified as BuiltinMacros
+import HsBindgen.Cli.Info.Doxygen qualified as Doxygen
+import HsBindgen.Cli.Info.IncludeGraph qualified as IncludeGraph
+import HsBindgen.Cli.Info.Instances qualified as Instances
+import HsBindgen.Cli.Info.Libclang qualified as Libclang
+import HsBindgen.Cli.Info.ResolveHeader qualified as ResolveHeader
+import HsBindgen.Cli.Info.UseDeclGraph qualified as UseDeclGraph
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Informational commands, useful when creating bindings"
+
+{-------------------------------------------------------------------------------
+  Commands
+-------------------------------------------------------------------------------}
+
+-- Ordered lexicographically
+data Cmd =
+    CmdBuiltinMacros BuiltinMacros.Opts
+  | CmdDoxygen       Doxygen.Opts
+  | CmdIncludeGraph  IncludeGraph.Opts
+  | CmdInstances     ()
+  | CmdLibclang      Libclang.Opts
+  | CmdResolveHeader ResolveHeader.Opts
+  | CmdUseDeclGraph  UseDeclGraph.Opts
+
+parseCmd :: Parser Cmd
+parseCmd = subparser $ mconcat [
+      cmd
+        "builtin-macros"
+        CmdBuiltinMacros
+        BuiltinMacros.parseOpts
+        BuiltinMacros.info
+    , cmd
+        "doxygen"
+        CmdDoxygen
+        Doxygen.parseOpts
+        Doxygen.info
+    , cmd
+        "include-graph"
+        CmdIncludeGraph
+        IncludeGraph.parseOpts
+        IncludeGraph.info
+    , cmd
+        "instances"
+        CmdInstances
+        (pure ())
+        Instances.info
+    , cmd
+        "libclang"
+        CmdLibclang
+        Libclang.parseOpts
+        Libclang.info
+    , cmd
+        "resolve-header"
+        CmdResolveHeader
+        ResolveHeader.parseOpts
+        ResolveHeader.info
+    , cmd
+        "use-decl-graph"
+        CmdUseDeclGraph
+        UseDeclGraph.parseOpts
+        UseDeclGraph.info
+    ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Cmd -> IO ()
+exec gopts = \case
+    CmdBuiltinMacros opts -> BuiltinMacros.exec gopts opts
+    CmdDoxygen       opts -> Doxygen.exec       gopts opts
+    CmdIncludeGraph  opts -> IncludeGraph.exec  gopts opts
+    CmdInstances     ()   -> Instances.exec
+    CmdLibclang      opts -> Libclang.exec      gopts opts
+    CmdResolveHeader opts -> ResolveHeader.exec gopts opts
+    CmdUseDeclGraph  opts -> UseDeclGraph.exec  gopts opts
diff --git a/app/HsBindgen/Cli/Info/BuiltinMacros.hs b/app/HsBindgen/Cli/Info/BuiltinMacros.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Info/BuiltinMacros.hs
@@ -0,0 +1,231 @@
+-- | @hs-bindgen-cli info builtin-macros@ command
+--
+-- This command dumps builtin macros using @libclang@.  The same can be done
+-- using @clang@ with command @clang -dM -E -x c /dev/null@.  This command
+-- exists because @libclang@ exposes some different macros than @clang@.
+--
+-- This command is different from the @clang@ dump command in that it fully
+-- expands macros.
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Info.BuiltinMacros qualified as BuiltinMacros
+module HsBindgen.Cli.Info.BuiltinMacros (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+import Data.Text qualified as Text
+import Options.Applicative hiding (info)
+
+import Clang.Args
+import Clang.Enum.Simple
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types
+import Clang.LowLevel.Core
+
+import HsBindgen.App
+import HsBindgen.Boot
+import HsBindgen.Clang
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Frontend.Pass.Parse.Builtin
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "List LLVM/Clang builtin macros"
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+newtype Opts = Opts {
+      clangArgsConfig :: ClangArgsConfig FilePath
+    }
+
+parseOpts :: Parser Opts
+parseOpts = Opts <$> parseClangArgsConfig
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts =
+    void . withTracer global.unsafe $ \tracer -> do
+      let tracerBoot  = contramap TraceBoot tracer
+          tracerClang = contramap (TraceFrontend . FrontendClang) tracer
+      clangArgs <-
+        (.clangArgs) <$> getClangArtefacts tracerBoot opts.clangArgsConfig
+      -- 1. Get the names of the builtin macros
+      names <- getBuiltinMacroNames tracerClang clangArgs
+      -- 2. Try to get stringified values for all macros
+      results1 <- getMacros tracerClang clangArgs names
+      -- 3. Find failed macros, where the stringified macro is the macro name,
+      --    and remove them from the results
+      let failedNames =
+            [n | (n, v) <- Map.toList results1, Text.unpack n == v]
+          results2 = foldr Map.delete results1 failedNames
+      -- 4. Try to get stringified values for the failed macros by passing a
+      --    single paramater
+      paramResults <- getParamMacros tracerClang clangArgs failedNames
+      -- 5. Compute the final results and the set of all names, with the
+      --    parameterized macro names
+      let results3 = results2 <> paramResults
+          paramNamesSet = Map.keysSet paramResults
+          namesSet =
+            Set.difference
+              (Set.fromList names <> paramNamesSet)
+              (Set.map stripParams paramNamesSet)
+      -- 6. Print all macros, including any failed ones
+      forM_ (Set.toAscList namesSet) $ \name ->
+        putStrLn $ renderResult name (Map.lookup name results3)
+  where
+    -- Output space even when @v@ is empty to match @clang@ behavior
+    renderResult :: Text -> Maybe String -> String
+    renderResult builtinName mValue =
+      let n = Text.unpack builtinName
+          v = fromMaybe "UNKNOWN_MACRO_DEFINITION" mValue
+      in  "#define " ++ n ++ ' ' : v
+
+    stripParams :: Text -> Text
+    stripParams = Text.takeWhile (/= '(')
+
+-- | Get the names of all builtin macros
+--
+-- Parameterized macros do /not/ include the parameters.
+getBuiltinMacroNames :: Tracer ClangMsg -> ClangArgs -> IO [Text]
+getBuiltinMacroNames tracer clangArgs =
+    fmap (fromMaybe []) . withClang' tracer setup $ \unit -> do
+      root <- clang_getTranslationUnitCursor unit
+      Just <$> HighLevel.clang_visitChildren root visit
+  where
+    setup :: ClangSetup
+    setup = defaultClangSetup clangArgs $
+      ClangInputMemory "hs-bindgen-builtins.h" ""
+
+    visit :: Fold IO Text
+    visit = simpleFold $ \curr -> do
+      mBuiltin <- checkIsBuiltin curr
+      case mBuiltin of
+        Just name -> foldContinueWith name
+        Nothing   -> foldBreak
+
+-- | Get stringified definitions of the specified macros
+--
+-- The stringified definition of a parameteried macro is the macro name itself
+-- (not including the parameters).
+getMacros :: Tracer ClangMsg -> ClangArgs -> [Text] -> IO (Map Text String)
+getMacros tracer clangArgs names =
+    fmap (maybe Map.empty Map.fromList) . withClang' tracer setup $ \unit -> do
+      root <- clang_getTranslationUnitCursor unit
+      Just <$> HighLevel.clang_visitChildren root visit
+  where
+    setup :: ClangSetup
+    setup =
+        defaultClangSetup clangArgs
+      . ClangInputMemory "hs-bindgen-builtins.h"
+      . unlines
+      $ helperMacros ++ map mkDecl names
+
+    -- https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html
+    helperMacros :: [String]
+    helperMacros = [
+        "#define STREX(x) #x"
+      , "#define STR(x) STREX(x)"
+      ]
+
+    mkDecl :: Text -> String
+    mkDecl builtinName =
+      let name = Text.unpack builtinName
+      in  "const char *BUILTIN_X_" ++ name ++ " = STR(" ++ name ++ ");"
+
+    parseName :: Text -> Maybe Text
+    parseName = Text.stripPrefix "BUILTIN_X_"
+
+    visit :: Fold IO (Text, String)
+    visit = simpleFold $ \curr -> do
+      C.prelimDeclIdAtCursor curr C.NameKindOrdinary >>= \case
+        C.PrelimDeclIdUnnamed{}  -> foldContinue
+        C.PrelimDeclIdNamed name ->
+          (fromSimpleEnum <$> clang_getCursorKind curr) >>= \case
+            Right CXCursor_VarDecl -> case parseName name.text of
+              Nothing          -> foldContinue
+              Just builtinName -> HighLevel.clang_evaluate curr >>= \case
+                Just (EvalResultString s) -> foldContinueWith (builtinName, s)
+                _otherwise                -> foldContinue
+            _otherwise -> foldContinue
+
+-- | Get stringified definitions of the specified macros with a single parameter
+--
+-- This is a dirty hack just for the builtin macros.  It just passes a single
+-- parameter and expects the stringified result to either be unchanged for
+-- append some string.
+getParamMacros ::
+     Tracer ClangMsg
+  -> ClangArgs
+  -> [Text]
+  -> IO (Map Text String)
+getParamMacros tracer clangArgs names =
+    fmap (maybe Map.empty Map.fromList) . withClang' tracer setup $ \unit -> do
+      root <- clang_getTranslationUnitCursor unit
+      Just <$> HighLevel.clang_visitChildren root visit
+  where
+    setup :: ClangSetup
+    setup =
+        defaultClangSetup clangArgs
+      . ClangInputMemory "hs-bindgen-builtins.h"
+      . unlines
+      $ helperMacros ++ map mkDecl names
+
+    -- https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html
+    helperMacros :: [String]
+    helperMacros = [
+        "#define STREX(x) #x"
+      , "#define STR(x) STREX(x)"
+      ]
+
+    mkDecl :: Text -> String
+    mkDecl builtinName =
+      let name = Text.unpack builtinName
+      in  "const char *BUILTIN_X_" ++ name ++ " = STR(" ++ name ++ "(c));"
+
+    parseName :: Text -> Maybe Text
+    parseName = Text.stripPrefix "BUILTIN_X_"
+
+    visit :: Fold IO (Text, String)
+    visit = simpleFold $ \curr ->
+      C.prelimDeclIdAtCursor curr C.NameKindOrdinary >>= \case
+        C.PrelimDeclIdUnnamed{}  -> foldContinue
+        C.PrelimDeclIdNamed name ->
+          (fromSimpleEnum <$> clang_getCursorKind curr) >>= \case
+            Right CXCursor_VarDecl -> case parseName name.text of
+              Nothing          -> foldContinue
+              Just builtinName -> HighLevel.clang_evaluate curr >>= \case
+                Just (EvalResultString s) -> case mangleValue s of
+                  Just s' -> foldContinueWith (mangleName builtinName, s')
+                  Nothing -> foldContinue
+                _otherwise -> foldContinue
+            _otherwise -> foldContinue
+
+    mangleName :: Text -> Text
+    mangleName = (<> "(c)")
+
+    mangleValue :: String -> Maybe String
+    mangleValue = \case
+      "c"        -> Just "c"
+      'c' : s    -> Just ("c##" ++ s)
+      _otherwise -> Nothing
diff --git a/app/HsBindgen/Cli/Info/Doxygen.hs b/app/HsBindgen/Cli/Info/Doxygen.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Info/Doxygen.hs
@@ -0,0 +1,86 @@
+-- | @hs-bindgen-cli info doxygen@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Info.Doxygen qualified as Doxygen
+module HsBindgen.Cli.Info.Doxygen (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Options.Applicative hiding (info)
+
+import HsBindgen
+import HsBindgen.App
+import HsBindgen.ArtefactM
+import HsBindgen.Backend.Category
+import HsBindgen.Config
+import HsBindgen.Config.Internal (BindgenConfig)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Output the parsed doxygen state"
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+data Opts = Opts {
+      config     :: Config
+    , output     :: Maybe FilePath
+    , inputs     :: [C.UncheckedRootDirective]
+    , filePolicy :: FilePolicy
+    , dirPolicy  :: DirPolicy
+    }
+
+parseOpts :: Parser Opts
+parseOpts =
+    Opts
+      <$> parseConfig
+      <*> optional parseOutput'
+      <*> parseInputs
+      <*> parseFilePolicy
+      <*> parseDirPolicy
+
+parseOutput' :: Parser FilePath
+parseOutput' = strOption $ mconcat [
+      short 'o'
+    , long "output"
+    , metavar "PATH"
+    , help "Output path for the doxygen state"
+    ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts =
+    hsBindgen
+      global.unsafe
+      global.safe
+      bindgenConfig
+      opts.inputs
+      artefact
+  where
+    artefact :: Artefact CExpr ()
+    artefact = writeDoxygen opts.filePolicy opts.dirPolicy opts.output
+
+    bindgenConfig :: BindgenConfig
+    bindgenConfig =
+        toBindgenConfig
+          opts.config
+          (UniqueId       "unused-unique-id")
+          (BaseModuleName "unused-module-name")
+          (def :: ByCategory Choice)
diff --git a/app/HsBindgen/Cli/Info/IncludeGraph.hs b/app/HsBindgen/Cli/Info/IncludeGraph.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Info/IncludeGraph.hs
@@ -0,0 +1,137 @@
+-- | @hs-bindgen-cli info include-graph@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Info.IncludeGraph qualified as IncludeGraph
+module HsBindgen.Cli.Info.IncludeGraph (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Data.Either (partitionEithers)
+import Options.Applicative hiding (info)
+
+import HsBindgen
+import HsBindgen.App
+import HsBindgen.ArtefactM
+import HsBindgen.Backend.Category
+import HsBindgen.Config
+import HsBindgen.Config.Internal (BindgenConfig)
+import HsBindgen.Frontend.Analysis.IncludeGraph (HeaderLabelStyle (..),
+                                                 IncludeGraphFormat (..))
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Output the include graph"
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+data Opts = Opts {
+      config         :: Config
+    , predicate      :: Boolean Regex
+    , labelStyle     :: HeaderLabelStyle
+    , format         :: IncludeGraphFormat
+    , output         :: Maybe FilePath
+    , inputs         :: [C.UncheckedRootDirective]
+    , filePolicy     :: FilePolicy
+    , dirPolicy      :: DirPolicy
+    }
+
+parseOpts :: Parser Opts
+parseOpts =
+    Opts
+      <$> parseConfig
+      <*> parsePredicate
+      <*> parseHeaderLabelStyle
+      <*> parseIncludeGraphFormat
+      <*> optional parseOutput'
+      <*> parseInputs
+      <*> parseFilePolicy
+      <*> parseDirPolicy
+
+parsePredicate :: Parser (Boolean Regex)
+parsePredicate = fmap merge . many . asum $ [
+      fmap (Right . BIf) $ strOption $ mconcat [
+          long "include"
+        , metavar "PCRE"
+        , help "Only include headers with paths that match PCRE (by default, include all)"
+        ]
+    , fmap (Left . BIf) $ strOption $ mconcat [
+          long "exclude"
+        , metavar "PCRE"
+        , help "Exclude headers with paths that match PCRE"
+        ]
+    ]
+  where
+    merge :: Eq a => [Either (Boolean a) (Boolean a)] -> Boolean a
+    merge = uncurry mergeBooleans . fmap defaultIncludeAll . partitionEithers
+
+    defaultIncludeAll :: [Boolean a] -> [Boolean a]
+    defaultIncludeAll = \case
+      [] -> [BTrue]
+      xs -> xs
+
+parseHeaderLabelStyle :: Parser HeaderLabelStyle
+parseHeaderLabelStyle = flag ShowIncludeArgs ShowPaths $ mconcat [
+      long "show-paths"
+    , help "Show paths of include header files instead of their '#include' arguments"
+    ]
+
+parseIncludeGraphFormat :: Parser IncludeGraphFormat
+parseIncludeGraphFormat = flag Mermaid SortedList $ mconcat [
+      long "toposort"
+    , help "Output a topologically sorted list of headers instead of a Mermaid graph"
+    ]
+
+parseOutput' :: Parser FilePath
+parseOutput' = strOption $ mconcat [
+      short 'o'
+    , long "output"
+    , metavar "PATH"
+    , help "Output path for the graph"
+    ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts =
+    hsBindgen
+      global.unsafe
+      global.safe
+      bindgenConfig
+      opts.inputs
+      artefact
+  where
+    artefact :: Artefact CExpr ()
+    artefact =
+      writeIncludeGraph
+        opts.predicate
+        opts.labelStyle
+        opts.format
+        opts.filePolicy
+        opts.dirPolicy
+        opts.output
+
+    bindgenConfig :: BindgenConfig
+    bindgenConfig =
+        toBindgenConfig
+          opts.config
+          (UniqueId       "unused-unique-id")
+          (BaseModuleName "unused-module-name")
+          (def :: ByCategory Choice)
diff --git a/app/HsBindgen/Cli/Info/Instances.hs b/app/HsBindgen/Cli/Info/Instances.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Info/Instances.hs
@@ -0,0 +1,62 @@
+-- | @hs-bindgen-cli info instances@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Info.Instances qualified as Instances
+module HsBindgen.Cli.Info.Instances (
+    -- * CLI help
+    info
+    -- * Execution
+  , exec
+  ) where
+
+import Data.List qualified as List
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+import Options.Applicative hiding (info)
+
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "List supported instances and strategies"
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: IO ()
+exec = mapM_ putStrLn (aux def)
+  where
+    aux :: Inst.SupportedInstances -> [String]
+    aux supportedInstances =
+         auxKind "struct"    supportedInstances.struct
+      ++ auxKind "union"     supportedInstances.union
+      ++ auxKind "enum"      supportedInstances.enum
+      ++ auxKind "typedef"   supportedInstances.typedef
+      ++ auxKind "emptydata" supportedInstances.emptydata
+
+    auxKind :: String -> Map Inst.TypeClass Inst.SupportedStrategies -> [String]
+    auxKind kind classMap =
+        ("* `" ++ kind ++ "`")
+      : map (indent . uncurry auxClass) (Map.toAscList classMap)
+
+    auxClass :: Inst.TypeClass -> Inst.SupportedStrategies -> String
+    auxClass clss supportedStrategies = "* `" ++ show clss ++ "`: "
+      ++  List.intercalate ", "
+            ( map
+                (auxStrategy supportedStrategies.defStrategy)
+                (Set.toAscList supportedStrategies.strategies)
+            )
+
+    auxStrategy :: Maybe Inst.Strategy -> Inst.Strategy -> String
+    auxStrategy mDefStrat strat = '`' : show strat ++ "`" ++ case mDefStrat of
+      Just defStrat | strat == defStrat -> " (default)"
+      _otherwise                        -> ""
+
+    indent :: String -> String
+    indent = ("    " ++)
diff --git a/app/HsBindgen/Cli/Info/Libclang.hs b/app/HsBindgen/Cli/Info/Libclang.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Info/Libclang.hs
@@ -0,0 +1,110 @@
+-- | @hs-bindgen-cli info libclang@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Info.Libclang qualified as Libclang
+module HsBindgen.Cli.Info.Libclang (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Options.Applicative hiding (info)
+import Prettyprinter.Util qualified as PP
+import System.Exit (exitFailure)
+
+import Clang.Enum.Simple (SimpleEnum (..), simpleFromC)
+import Clang.LowLevel.Core (CXErrorCode (..))
+
+import HsBindgen.App
+import HsBindgen.Boot
+import HsBindgen.Clang
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Imports
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = mconcat [
+      progDesc "Run libclang with empty input"
+    , footerDoc . Just . PP.reflow $ mconcat infoHelpMessage
+    ]
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+newtype Opts = Opts {
+      clangArgsConfig :: ClangArgsConfig FilePath
+    }
+
+parseOpts :: Parser Opts
+parseOpts = Opts <$> parseClangArgsConfig
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts = do
+    eRes <- withTracer tracerConfigWithoutASTReadError $ \tracer -> do
+      clangArgs <- (.clangArgs) <$>
+        getClangArtefacts (contramap TraceBoot tracer) opts.clangArgsConfig
+      let hasNoUserOptions = hasNoUserClangOptions opts.clangArgsConfig
+          setup = defaultClangSetup clangArgs $
+            ClangInputMemory "hs-bindgen-nop.h" ""
+
+      -- Emit informational message if no user options provided
+      when (   hasNoUserOptions
+            && global.unsafe.verbosity.level >= Info) $ do
+        traceWith (contramap (TraceFrontend . FrontendClang) tracer) $
+                  withCallStack ClangInvokedWithoutOptions
+
+      withClang
+        (contramap (TraceFrontend . FrontendClang) tracer)
+        setup
+        (const (pure ()))
+    case eRes of
+      Left e  -> do
+        print $ prettyForTrace e
+        exitFailure
+      Right _ -> pure ()
+  where
+    -- Check if user provided any Clang options via command line
+    --
+    hasNoUserClangOptions :: ClangArgsConfig FilePath -> Bool
+    hasNoUserClangOptions clangArgs = and [
+          null clangArgs.argsBefore
+        , null clangArgs.argsInner
+        , null clangArgs.argsAfter
+        ]
+
+    -- Check if a trace is CXError_ASTReadError.
+    -- This error is benign in the context of 'info libclang' when users
+    -- provide diagnostic flags, as they cause Clang to exit without building an AST.
+    --
+    -- If trace is CXError_ASTReadError make it debug level which should
+    -- supress it but still make it available if needed with Debug level
+    -- logging
+    --
+    tracerConfigWithoutASTReadError =
+      global.unsafe {
+          customLogLevel = CustomLogLevel $ \trace actualLevel ->
+            case trace of
+              TraceFrontend (FrontendClang (ClangErrorCode (SimpleEnum x)))
+                | Just CXError_ASTReadError <- simpleFromC x ->
+                  Debug
+              _ ->
+                applyCustomLogLevel
+                  global.unsafe.customLogLevel
+                  trace
+                  actualLevel
+        }
diff --git a/app/HsBindgen/Cli/Info/ResolveHeader.hs b/app/HsBindgen/Cli/Info/ResolveHeader.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Info/ResolveHeader.hs
@@ -0,0 +1,107 @@
+-- | @hs-bindgen-cli info resolve-header@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Info.ResolveHeader qualified as ResolveHeader
+module HsBindgen.Cli.Info.ResolveHeader (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+import Options.Applicative hiding (info)
+import System.Exit (ExitCode (ExitFailure))
+
+import HsBindgen.App
+import HsBindgen.Boot
+import HsBindgen.Clang.Macos
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Resolve
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Resolve C headers to source paths"
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+data Opts = Opts {
+      clangArgsConfig :: ClangArgsConfig FilePath
+    , inputs          :: [C.UncheckedRootDirective]
+    }
+
+parseOpts :: Parser Opts
+parseOpts =
+    Opts
+      <$> parseClangArgsConfig
+      <*> parseInputs
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts = do
+    eErr <- withTracer tracerConfig' $ \tracer -> do
+      -- This command only resolves headers; #define directives play no role.
+      hashIncludeArgs <- checkInputs tracer (C.hashIncludeArgsOf opts.inputs)
+      checkMacosEnv (contramap (TraceBoot . BootMacos) tracer)
+      clangArgs <- (.clangArgs) <$>
+        getClangArtefacts (contramap TraceBoot tracer) opts.clangArgsConfig
+      includes <-
+        resolveHeaders
+          (contramap TraceResolveHeader tracer)
+          clangArgs
+          (Set.fromList hashIncludeArgs)
+      fmap or . forM hashIncludeArgs $ \header' ->
+        case Map.lookup header' includes of
+          Just path -> (False <$) . putStrLn $ concat [
+              "#include <"
+            , header'.path
+            , "> resolved to "
+            , show path
+            ]
+          Nothing   -> (True  <$) . putStrLn $ concat [
+              "#include <"
+            , header'.path
+            , "> could not be resolved (header not found)"
+            ]
+    case eErr of
+      Right False -> return ()
+      Right True  -> throwIO (ExitFailure 1)
+      Left e      -> do
+        print $ prettyForTrace e
+  where
+    tracerConfig' :: TracerConfig Level TraceMsg
+    tracerConfig' = global.unsafe{
+        customLogLevel = customLogLevel <> global.unsafe.customLogLevel
+      }
+
+    customLogLevel :: CustomLogLevel Level TraceMsg
+    customLogLevel = CustomLogLevel $ \case
+      TraceResolveHeader ResolveHeaderFound{}    -> const Debug
+      TraceResolveHeader ResolveHeaderNotAttempted{} -> const Debug
+      _otherTrace                                -> id
+
+    -- | Check the @#include@ arguments, emitting trace messages
+    checkInputs ::
+        Tracer TraceMsg
+      -> [C.UncheckedHashIncludeArg]
+      -> IO [C.HashIncludeArg]
+    checkInputs tracer = mapM $
+        C.hashIncludeArgWithTrace
+          (contramap (TraceBoot . BootHashIncludeArg) tracer)
diff --git a/app/HsBindgen/Cli/Info/UseDeclGraph.hs b/app/HsBindgen/Cli/Info/UseDeclGraph.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Info/UseDeclGraph.hs
@@ -0,0 +1,89 @@
+-- | @hs-bindgen-cli info use-decl-graph@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Info.UseDeclGraph qualified as UseDeclGraph
+module HsBindgen.Cli.Info.UseDeclGraph (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Options.Applicative hiding (info)
+
+import HsBindgen
+import HsBindgen.App
+import HsBindgen.ArtefactM
+import HsBindgen.Config
+import HsBindgen.Config.Internal (BindgenConfig)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Output the use-decl graph"
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+data Opts = Opts {
+      config         :: Config
+    , uniqueId       :: UniqueId
+    , baseModuleName :: BaseModuleName
+    , output         :: Maybe FilePath
+    , inputs         :: [C.UncheckedRootDirective]
+    , filePolicy     :: FilePolicy
+    , dirPolicy      :: DirPolicy
+    }
+
+parseOpts :: Parser Opts
+parseOpts =
+    Opts
+      <$> parseConfig
+      <*> parseUniqueId
+      <*> parseBaseModuleName
+      <*> optional parseOutput'
+      <*> parseInputs
+      <*> parseFilePolicy
+      <*> parseDirPolicy
+
+parseOutput' :: Parser FilePath
+parseOutput' = strOption $ mconcat [
+      short 'o'
+    , long "output"
+    , metavar "PATH"
+    , help "Output path for the graph"
+    ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts =
+    hsBindgen
+      global.unsafe
+      global.safe
+      bindgenConfig
+      opts.inputs
+      artefact
+  where
+    artefact :: Artefact CExpr ()
+    artefact = writeUseDeclGraph opts.filePolicy opts.dirPolicy opts.output
+
+    bindgenConfig :: BindgenConfig
+    bindgenConfig =
+        toBindgenConfig
+          opts.config
+          opts.uniqueId
+          opts.baseModuleName
+          def
diff --git a/app/HsBindgen/Cli/Internal.hs b/app/HsBindgen/Cli/Internal.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Internal.hs
@@ -0,0 +1,45 @@
+-- | @hs-bindgen-cli internal@ commands
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Internal qualified as Internal
+module HsBindgen.Cli.Internal (
+    -- * CLI help
+    info
+    -- * Commands
+  , Cmd(..)
+  , parseCmd
+    -- * Execution
+  , exec
+  ) where
+
+import Options.Applicative hiding (info)
+
+import HsBindgen.App
+import HsBindgen.Cli.Internal.Frontend qualified as Frontend
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Internal commands, for hs-bindgen development"
+
+{-------------------------------------------------------------------------------
+  Commands
+-------------------------------------------------------------------------------}
+
+newtype Cmd = CmdFrontend Frontend.Opts
+
+parseCmd :: Parser Cmd
+parseCmd = subparser $ mconcat [
+      cmd "frontend" CmdFrontend Frontend.parseOpts Frontend.info
+    ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Cmd -> IO ()
+exec gopts = \case
+    CmdFrontend opts -> Frontend.exec gopts opts
diff --git a/app/HsBindgen/Cli/Internal/Frontend.hs b/app/HsBindgen/Cli/Internal/Frontend.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Internal/Frontend.hs
@@ -0,0 +1,149 @@
+-- | @hs-bindgen-cli internal frontend@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Internal.Frontend qualified as Frontend
+module HsBindgen.Cli.Internal.Frontend (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Data.List (intercalate)
+import Options.Applicative hiding (info)
+
+import HsBindgen
+import HsBindgen.App
+import HsBindgen.Artefact
+import HsBindgen.ArtefactM
+import HsBindgen.Config
+import HsBindgen.Config.Internal
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro
+
+{-------------------------------------------------------------------------------
+  Existential wrapper
+-------------------------------------------------------------------------------}
+
+-- | Existential wrapper pairing 'FrontendPass' with a 'Show' constraint.
+data SomeFrontendPass where
+  SomeFrontendPass :: Show result => FrontendPass CExpr result -> SomeFrontendPass
+
+-- | Parse a frontend pass name (inverse of 'frontendPassName').
+--
+-- Returns 'Left' with an error message listing valid names on failure.
+parseFrontendPassName :: String -> Either String SomeFrontendPass
+parseFrontendPassName s = case lookup s knownPasses of
+    Just d  -> Right d
+    Nothing -> Left $
+      "unknown pass " ++ show s ++ "; valid passes: "
+        ++ intercalate ", " (map fst knownPasses)
+  where
+    knownPasses :: [(String, SomeFrontendPass)]
+    knownPasses = [
+          mk ParsePass
+        , mk SimplifyASTPass
+        , mk FillUnnamedIdsPass
+        , mk EnrichCommentsPass
+        , mk ConstructTranslationUnitPass
+        , mk TypecheckMacrosPass
+        , mk ReparseMacroExpansionsPass
+        , mk ResolveBindingSpecsPass
+        , mk MangleNamesPass
+        , mk AdjustTypesPass
+        , mk SelectPass
+        , mk FinalPass
+        ]
+
+    mk :: Show result => FrontendPass CExpr result -> (String, SomeFrontendPass)
+    mk d = (frontendPassName d, SomeFrontendPass d)
+
+-- Ensure that we handle all 'FrontendPass' constructors.
+frontendPassName :: FrontendPass CExpr result -> String
+frontendPassName = \case
+  ParsePass                    -> "parse"
+  SimplifyASTPass              -> "simplify-ast"
+  FillUnnamedIdsPass           -> "fill-unnamed-ids"
+  EnrichCommentsPass           -> "enrich-comments"
+  ConstructTranslationUnitPass -> "construct-translation-unit"
+  TypecheckMacrosPass          -> "typecheck-macros"
+  ReparseMacroExpansionsPass   -> "reparse-macro-expansions"
+  ResolveBindingSpecsPass      -> "resolve-binding-specs"
+  MangleNamesPass              -> "mangle-names"
+  AdjustTypesPass              -> "adjust-types"
+  SelectPass                   -> "select"
+  FinalPass                    -> "final"
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Dump the result of a frontend pass"
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+data Opts = Opts {
+      dump           :: SomeFrontendPass
+    , config         :: Config
+    , uniqueId       :: UniqueId
+    , baseModuleName :: BaseModuleName
+    , dirPolicy      :: DirPolicy
+    , inputs         :: [C.UncheckedRootDirective]
+    , filePolicy     :: FilePolicy
+    }
+
+parseOpts :: Parser Opts
+parseOpts =
+    Opts
+      <$> parseDump
+      <*> parseConfig
+      <*> parseUniqueId
+      <*> parseBaseModuleName
+      <*> parseDirPolicy
+      <*> parseInputs
+      <*> parseFilePolicy
+
+parseDump :: Parser SomeFrontendPass
+parseDump = option (eitherReader parseFrontendPassName) $ mconcat [
+      long "pass"
+    , value (SomeFrontendPass AdjustTypesPass)
+    , showDefaultWith (\(SomeFrontendPass d) -> frontendPassName d)
+    , help "Frontend pass to dump"
+    , metavar "PASS"
+    ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts = do
+    case opts.dump of
+      SomeFrontendPass pass ->
+        hsBindgen
+          global.unsafe
+          global.safe
+          bindgenConfig
+          opts.inputs
+          (artefact pass)
+  where
+    artefact :: Show result => FrontendPass CExpr result -> Artefact CExpr ()
+    artefact pass = do
+        result <- FrontendPassA pass
+        Lift $ delay . WriteToStdOut . StringContent $ show result
+
+    bindgenConfig :: BindgenConfig
+    bindgenConfig =
+        toBindgenConfig
+          opts.config
+          opts.uniqueId
+          opts.baseModuleName
+          def
diff --git a/app/HsBindgen/Cli/Preprocess.hs b/app/HsBindgen/Cli/Preprocess.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/Preprocess.hs
@@ -0,0 +1,127 @@
+-- | @hs-bindgen-cli preprocess@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.Preprocess qualified as Preprocess
+module HsBindgen.Cli.Preprocess (
+    -- * CLI help
+    info
+    -- * Options
+  , Opts(..)
+  , parseOpts
+  , ConfigCLI(..)
+    -- * Execution
+  , exec
+  ) where
+
+import Options.Applicative hiding (info)
+
+import HsBindgen
+import HsBindgen.App
+import HsBindgen.App.Output (OutputMode (..), OutputOptions (..),
+                             buildCategoryChoice, parseOutputOptions)
+import HsBindgen.ArtefactM
+import HsBindgen.Config
+import HsBindgen.Config.Internal
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Generate Haskell module from C headers"
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+data Opts = Opts {
+      config              :: Config
+    , configCLI           :: ConfigCLI
+    }
+  deriving (Generic)
+
+parseOpts :: Parser Opts
+parseOpts =
+    Opts
+      <$> parseConfig
+      <*> parseConfigCLI
+
+-- | CLI options; the TH equivalent of ConfigCLI' is 'HsBindgen.Config.ConfigTH'.
+data ConfigCLI = ConfigCLI {
+      uniqueId          :: UniqueId
+    , baseModuleName    :: BaseModuleName
+    , qualifiedStyle    :: QualifiedStyle
+    , outputOptions     :: OutputOptions
+    , hsOutputDir       :: FilePath
+    , outputBindingSpec :: Maybe FilePath
+    , dirPolicy         :: DirPolicy
+    , filePolicy        :: FilePolicy
+    -- NOTE: Inputs (arguments) must be last, options must go before it.
+    , inputs            :: [C.UncheckedRootDirective]
+    }
+  deriving (Generic)
+
+parseConfigCLI :: Parser ConfigCLI
+parseConfigCLI =
+    ConfigCLI
+      <$> parseUniqueId
+      <*> parseBaseModuleName
+      <*> parseQualifiedStyle
+      <*> parseOutputOptions FilePerModule
+      <*> parseHsOutputDir
+      <*> optional parseGenBindingSpec
+      <*> parseDirPolicy
+      <*> parseFilePolicy
+      <*> parseInputs
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Opts -> IO ()
+exec global opts = do
+    hsBindgen
+      global.unsafe
+      global.safe
+      bindgenConfig
+      opts.configCLI.inputs
+      artefact
+  where
+    bindgenConfig :: BindgenConfig
+    bindgenConfig =
+        toBindgenConfig
+          opts.config
+          opts.configCLI.uniqueId
+          opts.configCLI.baseModuleName
+          (buildCategoryChoice opts.configCLI.outputOptions)
+
+    mrc :: ModuleRenderConfig
+    mrc = ModuleRenderConfig {
+        qualifiedStyle = opts.configCLI.qualifiedStyle
+      }
+
+    artefact :: Artefact CExpr ()
+    artefact = do
+      case opts.configCLI.outputOptions of
+        OutputOptions (SingleFile _) ->
+          writeBindingsSingle
+            mrc
+            opts.configCLI.filePolicy
+            opts.configCLI.dirPolicy
+            opts.configCLI.hsOutputDir
+        _ ->
+          writeBindingsMultiple
+            mrc
+            opts.configCLI.filePolicy
+            opts.configCLI.dirPolicy
+            opts.configCLI.hsOutputDir
+
+      forM_ opts.configCLI.outputBindingSpec $ \path ->
+        writeBindingSpec
+          opts.configCLI.filePolicy
+          opts.configCLI.dirPolicy
+          path
diff --git a/app/HsBindgen/Cli/ToolSupport.hs b/app/HsBindgen/Cli/ToolSupport.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/ToolSupport.hs
@@ -0,0 +1,47 @@
+-- | @hs-bindgen-cli tool-support@ commands
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.ToolSupport qualified as ToolSupport
+module HsBindgen.Cli.ToolSupport (
+    -- * CLI help
+    info
+    -- * Commands
+  , Cmd(..)
+  , parseCmd
+    -- * Execution
+  , exec
+  ) where
+
+import Options.Applicative hiding (info)
+
+import HsBindgen.App
+import HsBindgen.Cli.ToolSupport.Literate qualified as Literate
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc "Tool support commands, not meant to be used directly"
+
+{-------------------------------------------------------------------------------
+  Commands
+-------------------------------------------------------------------------------}
+
+-- | Ordered lexicographically
+newtype Cmd =
+    CmdLiterate Literate.Opts
+
+parseCmd :: Parser Cmd
+parseCmd = subparser $ mconcat [
+      cmd_ "literate" CmdLiterate Literate.parseOpts Literate.info
+    ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: GlobalOpts -> Cmd -> IO ()
+exec _gopts = \case
+    CmdLiterate opts -> Literate.exec opts
diff --git a/app/HsBindgen/Cli/ToolSupport/Literate.hs b/app/HsBindgen/Cli/ToolSupport/Literate.hs
new file mode 100644
--- /dev/null
+++ b/app/HsBindgen/Cli/ToolSupport/Literate.hs
@@ -0,0 +1,160 @@
+{-# LANGUAGE ApplicativeDo #-}
+
+-- | @hs-bindgen-cli tool-support literate@ command
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Cli.ToolSupport.Literate qualified as Literate
+module HsBindgen.Cli.ToolSupport.Literate (
+    -- * CLI help
+    info
+    -- * Options (provided by @cabal-install@ on the command line)
+  , Opts(..)
+  , parseOpts
+    -- * Execution
+  , exec
+  ) where
+
+import Control.Exception (throwIO)
+import Data.List.NonEmpty (NonEmpty (..))
+import GHC.Exception (Exception (..))
+import Options.Applicative hiding (info)
+import Options.Applicative qualified as O
+import Text.Read (readMaybe)
+
+import HsBindgen
+import HsBindgen.App
+import HsBindgen.App.Output (OutputMode (..), OutputOptions,
+                             SingleFileCategory (..), buildCategoryChoice,
+                             parseOutputOptions)
+import HsBindgen.ArtefactM
+import HsBindgen.Config
+import HsBindgen.Config.Internal (BindgenConfig)
+import HsBindgen.Errors
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro
+
+{-------------------------------------------------------------------------------
+  CLI help
+-------------------------------------------------------------------------------}
+
+info :: InfoMod a
+info = progDesc $ mconcat [
+      "Generate Haskell module from C header, acting as literate Haskell"
+    , " preprocessor"
+    ]
+
+{-------------------------------------------------------------------------------
+  Options (provided by @cabal-install@ on the command line)
+-------------------------------------------------------------------------------}
+
+-- | Command line options when the literate preprocessor is invoked
+--
+-- NOTE: Most of the /actual/ @hs-bindgen-cli@ arguments come from parsing the
+-- /contents/ of the file we are processing.
+data Opts = Opts {
+      input  :: FilePath
+    , output :: FilePath
+    }
+  deriving (Show, Eq)
+
+parseOpts :: Parser Opts
+parseOpts = do
+    -- When @cabal-install@ calls GHC and the preprocessor, it passes some
+    -- standard flags, which we do not (all) use.  In particular, it passes
+    -- @-hide-all-packages@.
+    _ <- strOption @String $ mconcat [
+             short 'h'
+           , metavar "IGNORED"
+           , help "Ignore some preprocessor options provided by cabal-install"
+           ]
+
+    input  <- strArgument $ metavar "IN"
+    output <- strArgument $ metavar "OUT"
+
+    return Opts{
+        input  = input
+      , output = output
+      }
+
+{-------------------------------------------------------------------------------
+  Options (provided at the top of literate Haskell files)
+-------------------------------------------------------------------------------}
+
+data Lit = Lit {
+      globalOpts     :: GlobalOpts
+    , config         :: Config
+    , uniqueId       :: UniqueId
+    , baseModuleName :: BaseModuleName
+    , qualifiedStyle :: QualifiedStyle
+    , outputOptions  :: OutputOptions
+    , inputs         :: [C.UncheckedRootDirective]
+    }
+
+parseLit :: Parser Lit
+parseLit = Lit
+  <$> parseGlobalOpts
+  <*> parseConfig
+  <*> parseUniqueId
+  <*> parseBaseModuleName
+  <*> parseQualifiedStyle
+  <*> parseOutputOptions (SingleFile (SingleFileSafe "" :| []))
+  <*> parseInputs
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+exec :: Opts -> IO ()
+exec opts = do
+    args <- maybe (throwIO' "cannot parse literate file") return . readMaybe
+      =<< readFile opts.input
+    lit <- handleParseResult $ pureParseLit args
+
+    let bindgenConfig :: BindgenConfig
+        bindgenConfig =
+          toBindgenConfig
+            lit.config
+            lit.uniqueId
+            lit.baseModuleName
+            (buildCategoryChoice lit.outputOptions)
+
+        -- It is understood that literate mode will overwrite existing files
+        -- (generated files will anyway live in @dist-newstyle@ or similar)
+        filePolicy :: FilePolicy
+        filePolicy = AllowFileOverwrite
+
+        mrc :: ModuleRenderConfig
+        mrc = ModuleRenderConfig {
+            qualifiedStyle = lit.qualifiedStyle
+          }
+
+        artefact :: Artefact CExpr ()
+        artefact = writeBindings mrc filePolicy DoNotCreateOutputDirs opts.output
+
+    hsBindgen
+      lit.globalOpts.unsafe
+      lit.globalOpts.safe
+      bindgenConfig
+      lit.inputs
+      artefact
+  where
+    throwIO' :: String -> IO a
+    throwIO' = throwIO . LiterateFileException opts.input
+
+    pureParseLit :: [String] -> ParserResult Lit
+    pureParseLit =
+        execParserPure (prefs subparserInline) (O.info parseLit mempty)
+
+{-------------------------------------------------------------------------------
+  Exception
+-------------------------------------------------------------------------------}
+
+data LiterateFileException = LiterateFileException FilePath String
+  deriving Show
+
+instance Exception LiterateFileException where
+    toException = hsBindgenExceptionToException
+    fromException = hsBindgenExceptionFromException
+    displayException (LiterateFileException path err) =
+      "error loading " ++ path ++ ": " ++ err
diff --git a/app/hs-bindgen-cli.hs b/app/hs-bindgen-cli.hs
new file mode 100644
--- /dev/null
+++ b/app/hs-bindgen-cli.hs
@@ -0,0 +1,144 @@
+module Main (main) where
+
+import Control.Exception (Exception (..), SomeException (..), handle)
+import Data.List qualified as List
+import Data.Text qualified as Text
+import Data.Version (showVersion)
+import Options.Applicative
+import Options.Applicative.Help qualified as Help
+import Prettyprinter.Util qualified as PP
+import System.Exit (ExitCode, exitFailure)
+
+import Clang.Version (compileTimeClangVersionString, runtimeClangVersionString)
+
+import HsBindgen.App
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Cli qualified as Cli
+import HsBindgen.Errors
+import HsBindgen.Imports
+
+import Paths_hs_bindgen qualified as Package
+
+{-------------------------------------------------------------------------------
+  CLI parser
+-------------------------------------------------------------------------------}
+
+data Cli = Cli {
+      globalOpts :: GlobalOpts
+    , cmd        :: Cli.Cmd
+    }
+
+parseCli :: Parser Cli
+parseCli =
+    Cli
+      <$> parseGlobalOpts
+      <*> Cli.parseCmd
+
+execCliParser :: IO Cli
+execCliParser = customExecParser prefs' opts
+  where
+    prefs' :: ParserPrefs
+    -- 'multiSuffix' marks repeatable options and arguments in the usage
+    -- synopsis; without it, @(HEADER | --hash-define NAME VALUE)@ reads as an
+    -- exclusive choice of one.
+    prefs' = prefs $ multiSuffix "..." <> helpShowGlobals <> subparserInline
+
+    opts :: ParserInfo Cli
+    opts = info (parseCli <**> simpleVersioner vers <**> helper) $
+      mconcat [
+          progDesc "Generate Haskell bindings from C headers"
+        , failureCode 2
+        , footerDoc . Just . Help.vcat $ List.intersperse "" [
+              envVarsFooter
+            , clangArgsFooter
+            , selectSliceFooter
+            , exitCodeFooter
+            ]
+        ]
+
+    vers :: String
+    vers = List.intercalate "\n" [
+        "hs-bindgen " ++ showVersion Package.version
+      , "binding specification " ++ show BindingSpec.currentBindingSpecVersion
+      , "clang compile time version: "
+          ++ Text.unpack compileTimeClangVersionString
+      , "clang runtime version:      " ++ Text.unpack runtimeClangVersionString
+      ]
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+main :: IO ()
+main = handle exceptionHandler $ do
+    cli <- execCliParser
+    Cli.exec cli.globalOpts cli.cmd
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions: exception handling
+-------------------------------------------------------------------------------}
+
+exceptionHandler :: SomeException -> IO ()
+exceptionHandler e
+    | Just _ <- fromException e :: Maybe ExitCode
+    = throwIO e
+
+    | Just (HsBindgenException e'') <- fromException e = do
+      putStrLn $ displayException e''
+      exitFailure
+
+    -- truly unexpected exceptions
+    | otherwise = do
+      putStrLn $ "Uncaught exception: " ++ displayException e
+      putStrLn
+        "Please report this at https://github.com/well-typed/hs-bindgen/issues"
+      exitFailure
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions: footers
+-------------------------------------------------------------------------------}
+
+envVarsFooter :: Help.Doc
+envVarsFooter = Help.vcat [
+      "Environment variables:"
+    , li $ "BINDGEN_EXTRA_CLANG_ARGS: Arguments passed to Clang"
+    ]
+
+clangArgsFooter :: Help.Doc
+clangArgsFooter = Help.vcat [
+      "Options passed to Clang have the following order:"
+    , "  1. --clang-option-before options"
+    , "  2. Clang options managed by hs-bindgen (e.g., -I options)"
+    , "  3. --clang-option options"
+    , "  4. BINDGEN_EXTRA_CLANG_ARGS options"
+    , "  5. --clang-option-after options"
+    , "  6. Builtin include directory options"
+    ]
+
+selectSliceFooter :: Help.Doc
+selectSliceFooter = Help.vcat [
+      "Selection and program slicing:"
+    , li $ mconcat [
+          "Program slicing disabled (default):"
+        , " only select declarations according to the selection predicate"
+        ]
+    , li $ mconcat [
+          "Program slicing enabled ('--enable-program-slicing'):"
+        , " select declarations using the selection predicate,"
+        , " and also select their transitive dependencies;"
+        , " program slicing can cause declarations to be included"
+        , " even if they are explicitly deselected by a selection predicate"
+        ]
+    ]
+
+exitCodeFooter :: Help.Doc
+exitCodeFooter = Help.vcat [
+      "Exit codes:"
+    , "  0: Success"
+    , "  1: Other errors (panics)"
+    , "  2: Invocation of `libclang` has failed"
+    , "  3: An `hs-bindgen`-specific error has happened"
+    ]
+
+li :: Text -> Help.Doc
+li = ("  -" Help.<+>) . Help.align . PP.reflow
diff --git a/bootstrap/standard_headers.h b/bootstrap/standard_headers.h
new file mode 100644
--- /dev/null
+++ b/bootstrap/standard_headers.h
@@ -0,0 +1,119 @@
+#ifndef STANDARD_HEADERS_H
+#define STANDARD_HEADERS_H
+
+/**
+ * C Standard Library header files
+ *
+ * Reference:
+ *
+ * * https://en.cppreference.com/w/c/header
+ * * https://en.wikipedia.org/wiki/C_standard_library
+ */
+
+/**
+ * C89/C90
+ *
+ * Reference:
+ *
+ * * https://web.archive.org/web/20161223125339/http://flash-gordon.me.uk/ansi.c.txt
+ *   4.1.2 Standard headers
+ */
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <float.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+/**
+* C95 (Normative Addendum 1)
+*
+* Reference:
+*
+* * http://www.lysator.liu.se/c/na1.html
+*/
+
+#include <iso646.h>
+#include <wchar.h>
+#include <wctype.h>
+
+/**
+ * C99
+ *
+ * Reference:
+ *
+ * * https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
+ *   7.1.2 Standard headers
+ *
+ * Notes:
+ *
+ * * complex.h is optional
+ * * stdbool.h is deprecated in C23
+ */
+
+#include <complex.h>
+#include <fenv.h>
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <tgmath.h>
+
+/**
+ * C11
+ *
+ * Reference:
+ *
+ * * https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
+ *   7.1.2 Standard headers
+ *
+ * Notes:
+ *
+ * * stdalign.h is deprecated in C23
+ * * stdatomic.h is optional, and it is not included in musl
+ * * stdnoreturn.h is deprecated in C23
+ * * threads.h is optional
+ */
+
+#include <stdalign.h>
+// #include <stdatomic.h>
+#include <stdnoreturn.h>
+#include <threads.h>
+#include <uchar.h>
+
+/**
+ * C17
+ *
+ * Reference:
+ *
+ * * https://web.archive.org/web/20181230041359/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf
+ *   7.1.2 Standard headers
+ */
+
+/**
+ * C23
+ *
+ * Reference:
+ *
+ * * https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf
+ *   7.1.2 Standard headers
+ *
+ * Notes:
+ *
+ * * stdbit.h is not included in musl
+ * * stdckdint.h is not included in musl
+ */
+
+// #include <stdbit.h>
+// #include <stdckdint.h>
+
+#endif
diff --git a/clang-ast-dump/Main.hs b/clang-ast-dump/Main.hs
new file mode 100644
--- /dev/null
+++ b/clang-ast-dump/Main.hs
@@ -0,0 +1,519 @@
+{-# LANGUAGE ApplicativeDo #-}
+
+module Main (main) where
+
+import Control.Exception
+import Control.Monad
+import Control.Monad.IO.Class
+import Data.Bifunctor
+import Data.Default (Default (def))
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+import Data.Text (Text)
+import Data.Text qualified as T
+import Foreign.C.Types (CUInt)
+import GHC.Generics (Generic)
+import Options.Applicative qualified as OA
+import System.Exit (exitFailure)
+
+import Clang.Enum.Bitfield
+import Clang.Enum.Simple
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types hiding (FoldException (..))
+import Clang.LowLevel.Core
+import Clang.LowLevel.Doxygen
+import Clang.Paths
+
+import HsBindgen.Clang
+import HsBindgen.Config.ClangArgs
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Resolve (resolveHeaders)
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Options
+-------------------------------------------------------------------------------}
+
+data Options = Options {
+      builtin         :: Bool
+    , comments        :: Bool
+    , extents         :: Bool
+    , file            :: C.HashIncludeArg
+    , kind            :: Bool
+    , includePath     :: [FilePath]
+    , clangArgsInner  :: [String]
+    , sameFile        :: Bool
+    , typ             :: Bool
+    }
+
+{-------------------------------------------------------------------------------
+  Errors
+-------------------------------------------------------------------------------}
+
+data AstDumpException =
+    HeaderNotFound
+  | ClangError
+  deriving stock (Show)
+
+instance Exception AstDumpException where
+  displayException HeaderNotFound = "header not found"
+  displayException ClangError     = "clang error"
+
+{-------------------------------------------------------------------------------
+  Implementation
+-------------------------------------------------------------------------------}
+
+data DumpTrace =
+    DumpTraceResolveHeader ResolveHeaderMsg
+  | DumpTraceClang         ClangMsg
+  deriving stock (Show, Generic)
+  deriving anyclass (PrettyForTrace, IsTrace Level)
+
+clangAstDump :: Options -> IO ()
+clangAstDump opts = do
+    putStrLn $ "## `" ++ opts.file.path ++ "`"
+    putStrLn ""
+
+    eitherRes <- withTracer tracerConf $ \tracer -> do
+      let clangArgs     = clangArgsConfigToClangArgs cArgsConfig
+          tracerResolve = contramap DumpTraceResolveHeader tracer
+          tracerClang   = contramap DumpTraceClang         tracer
+      src <- maybe (throwIO HeaderNotFound) return . Map.lookup opts.file
+          =<< resolveHeaders tracerResolve clangArgs (Set.singleton opts.file)
+      let setup :: ClangSetup
+          setup = (defaultClangSetup clangArgs $ ClangInputFile (realPathToSourcePath src)) {
+                flags = cOpts
+              }
+
+      maybe (throwIO ClangError) return <=< withClang tracerClang setup $ \unit -> Just <$> do
+        rootCursor <- clang_getTranslationUnitCursor unit
+        void . HighLevel.clang_visitChildren rootCursor $ simpleFold $ \cursor -> do
+          loc <- clang_getPresumedLocation =<< clang_getCursorLocation cursor
+          case loc of
+            (file, _, _)
+              | opts.sameFile && file /= getRealPathText src -> foldContinue
+              | not opts.builtin && isBuiltIn file           -> foldContinue
+              | otherwise                                    -> foldDecls opts cursor
+    case eitherRes of
+      Left  e  -> do
+        print $ prettyForTrace e
+        exitFailure
+      Right _  -> pure ()
+  where
+    tracerConf :: TracerConfig Level DumpTrace
+    tracerConf = def {
+        verbosity = Verbosity Debug
+      }
+
+    cArgsConfig :: ClangArgsConfig FilePath
+    cArgsConfig = def {
+        extraIncludeDirs = opts.includePath
+      , argsInner        = opts.clangArgsInner
+      }
+
+    cOpts :: BitfieldEnum CXTranslationUnit_Flags
+    cOpts = bitfieldEnum [
+        CXTranslationUnit_DetailedPreprocessingRecord
+      , CXTranslationUnit_IncludeAttributedTypes
+      , CXTranslationUnit_VisitImplicitAttributes
+      ]
+
+    isBuiltIn :: Text -> Bool
+    isBuiltIn = (`elem` [T.pack "<built-in>", T.pack "<command line>"])
+
+
+foldDecls :: Options -> CXCursor -> IO (Next IO ())
+foldDecls opts = \cursor -> do
+    traceU_ 0 =<< clang_getCursorDisplayName cursor
+
+    dumpParents cursor
+    when opts.extents $ dumpExtent cursor
+
+    cursorKind <- clang_getCursorKind cursor
+    traceU 1 "cursor kind" cursorKind
+    isDecl <- clang_isDeclaration cursorKind
+    when opts.kind $
+      traceWhen 2 "declaration" id isDecl
+
+    cursorType <- clang_getCursorType cursor
+
+    isRecurse <- case fromSimpleEnum cursorKind of
+      Right CXCursor_StructDecl -> do
+        dumpType cursor cursorType isDecl
+        pure True
+      Right CXCursor_EnumDecl -> do
+        dumpType cursor cursorType isDecl
+        traceU 1 "integer type" =<< clang_getEnumDeclIntegerType cursor
+        pure True
+      Right CXCursor_FieldDecl -> do
+        dumpType cursor cursorType isDecl
+        traceU 1 "field offset" =<< clang_Cursor_getOffsetOfField cursor
+        isBitField <- clang_Cursor_isBitField cursor
+        when isBitField $
+          traceU 1 "bit width" =<< clang_getFieldDeclBitWidth cursor
+        pure False -- leaf
+      Right CXCursor_EnumConstantDecl -> do
+        dumpType cursor cursorType isDecl
+        traceU 1 "integer value" =<< clang_getEnumConstantDeclValue cursor
+        pure False -- leaf
+      Right CXCursor_FunctionDecl -> do
+        dumpType cursor cursorType isDecl
+        numArgs <- clang_getNumArgTypes cursorType
+        traceU 1 "args" numArgs
+        forM_ [0 .. numArgs - 1] $ \i -> do
+          argType <- clang_getArgType cursorType (fromIntegral i)
+          traceO_ 2 i =<< clang_getTypeSpelling argType
+        resultType <- clang_getResultType cursorType
+        traceU 1 "result" =<< clang_getTypeSpelling resultType
+        pure False
+      Right CXCursor_VarDecl -> do
+        traceU 1 "eval result" =<< HighLevel.clang_evaluate cursor
+        pure False
+      Right CXCursor_TypedefDecl -> do
+        dumpType cursor cursorType isDecl
+        traceU 1 "typedef name" =<< clang_getTypedefName cursorType
+        -- Results in repeated information unless the `typedef` is a
+        -- declaration.
+        pure True
+      Right CXCursor_MacroDefinition ->
+        -- TODO: Not defined yet.
+        pure True
+      Right CXCursor_InclusionDirective ->
+        pure False -- does not matter
+      Right CXCursor_UnionDecl -> do
+        dumpType cursor cursorType isDecl
+        pure True
+      Right CXCursor_LinkageSpec -> do
+        -- NOTE: The linkage specification has no display name, and so the
+        -- parents of the children are unknown, that is, the empty string "".
+        pure True
+      Right{} -> False <$ traceL 1 "CURSOR_KIND_NOT_IMPLEMENTED"
+      Left n  -> False <$ traceU 1 "CURSOR_KIND_ENUM_OUT_OF_RANGE" n
+
+    when (isDecl && opts.comments) $ do
+      commentText <- clang_Cursor_getRawCommentText cursor
+      unless (T.null commentText) $ do
+        traceU 1 "comment" commentText
+        traceU 2 "brief" =<< clang_Cursor_getBriefCommentText cursor
+        dumpComment 2 Nothing =<< clang_Cursor_getParsedComment cursor
+
+    if isRecurse
+      then foldRecurse $ simpleFold (foldDecls opts)
+      else foldContinue
+  where
+    dumpParents :: CXCursor -> IO ()
+    dumpParents cursor = do
+      semanticParent <- clang_getCursorSemanticParent cursor
+      lexicalParent  <- clang_getCursorLexicalParent  cursor
+      parentsEq      <- clang_equalCursors semanticParent lexicalParent
+      if parentsEq
+        then
+          traceU 1 "parent"
+            =<< clang_getCursorDisplayName semanticParent
+        else do
+          traceU 1 "semantic parent"
+            =<< clang_getCursorDisplayName semanticParent
+          traceU 1 "lexical parent"
+            =<< clang_getCursorDisplayName lexicalParent
+
+    dumpExtent :: CXCursor -> IO ()
+    dumpExtent cursor = do
+      extent <- clang_getCursorExtent cursor
+      (file, startLine, startCol) <-
+        clang_getPresumedLocation =<< clang_getRangeStart extent
+      (_, endLine, endCol) <-
+        clang_getPresumedLocation =<< clang_getRangeEnd extent
+      traceU 1 "extent" (file, (startLine, startCol), (endLine, endCol))
+
+    dumpType :: CXCursor -> CXType -> Bool -> IO ()
+    dumpType cursor cursorType isDecl = do
+      traceU 1 "cursor type" =<< clang_getTypeSpelling cursorType
+      when opts.typ $ do
+        let typeKind = cxtKind cursorType
+        traceU 2 "kind" $ fromSimpleEnum typeKind
+        traceU 3 "spelling" =<< clang_getTypeKindSpelling typeKind
+        traceU 2 "canonical"
+          =<< clang_getTypeSpelling =<< clang_getCanonicalType cursorType
+        when isDecl $ do
+          decl <- HighLevel.classifyDeclaration cursor
+          case decl of
+            Definition -> do
+              traceU 2 "declaration type" ("Definition" :: String)
+              traceU 2 "sizeof"
+                =<< handleCallFailed (clang_Type_getSizeOf cursorType)
+              traceU 2 "alignment"
+                =<< handleCallFailed (clang_Type_getAlignOf cursorType)
+            DefinitionElsewhere{} ->
+              traceU 2 "declaration type" ("DefinitionElsewhere" :: String)
+            DefinitionUnavailable ->
+              traceU 2 "declaration type" ("DefinitionUnavailable" :: String)
+
+dumpComment :: Int -> Maybe CUInt -> CXComment -> IO ()
+dumpComment level mIdx comment = do
+    commentKind <- clang_Comment_getKind comment
+    maybe (traceU level) (traceO level) mIdx "kind" $ fromSimpleEnum commentKind
+    traceWhen level1 "whitespace" id =<< clang_Comment_isWhitespace comment
+
+    case fromSimpleEnum commentKind of
+      Right CXComment_Null -> pure ()
+
+      Right CXComment_Text ->
+        traceU level1 "text" =<< clang_TextComment_getText comment
+
+      Right CXComment_InlineCommand -> do
+        traceU level1 "name"
+          =<< clang_InlineCommandComment_getCommandName comment
+        traceU level1 "render kind" . fromSimpleEnum
+          =<< clang_InlineCommandComment_getRenderKind comment
+        numArgs <- clang_InlineCommandComment_getNumArgs comment
+        when (numArgs > 0) $ do
+          traceU level1 "args" numArgs
+          forM_ [0 .. numArgs - 1] $ \i ->
+            traceO_ level2 i =<< clang_InlineCommandComment_getArgText comment i
+
+      Right CXComment_HTMLStartTag -> do
+        traceU level1 "name" =<< clang_HTMLTagComment_getTagName comment
+        traceWhen level1 "self-closing" id
+          =<< clang_HTMLStartTagComment_isSelfClosing comment
+        numAttrs <- clang_HTMLStartTag_getNumAttrs comment
+        when (numAttrs > 0) $ do
+          traceU level1 "attributes" numAttrs
+          forM_ [0 .. numAttrs - 1] $ \i -> do
+            traceO_ level2 i =<< clang_HTMLStartTag_getAttrName comment i
+            traceU level3 "value" =<< clang_HTMLStartTag_getAttrValue comment i
+
+      Right CXComment_HTMLEndTag -> do
+        traceU level1 "name" =<< clang_HTMLTagComment_getTagName comment
+
+      Right CXComment_Paragraph -> pure ()
+
+      Right CXComment_BlockCommand -> do
+        traceU level1 "name" =<<
+          clang_BlockCommandComment_getCommandName comment
+        numArgs <- clang_BlockCommandComment_getNumArgs comment
+        when (numArgs > 0) $ do
+          traceU level1 "args" numArgs
+          forM_ [0 .. numArgs - 1] $ \i ->
+            traceO_ level2 i =<< clang_BlockCommandComment_getArgText comment i
+        -- NOTE paragraph is also provided by children
+        -- para <- clang_BlockCommandComment_getParagraph comment
+        -- traceL level1 "paragraph"
+        -- dumpComment level2 Nothing para
+
+      Right CXComment_ParamCommand -> do
+        traceU level1 "name" =<< clang_ParamCommandComment_getParamName comment
+        traceU level1 "index"
+          =<< clang_ParamCommandComment_getParamIndex comment
+        traceUnless level2 "invalid" id
+          =<< clang_ParamCommandComment_isParamIndexValid comment
+        traceU level1 "direction" . fromSimpleEnum
+          =<< clang_ParamCommandComment_getDirection comment
+        traceU level2 "explicit"
+          =<< clang_ParamCommandComment_isDirectionExplicit comment
+
+      Right CXComment_TParamCommand -> do
+        traceU level1 "name" =<< clang_TParamCommandComment_getParamName comment
+        traceUnless level1 "position invalid" id
+          =<< clang_TParamCommandComment_isParamPositionValid comment
+        depth <- clang_TParamCommandComment_getDepth comment
+        traceU level1 "depth" depth
+        forM_ [0 .. depth] $ \i ->
+          traceO level2 i "index"
+            =<< clang_TParamCommandComment_getIndex comment i
+
+      Right CXComment_VerbatimBlockCommand -> pure ()
+
+      Right CXComment_VerbatimBlockLine ->
+        traceU level1 "text" =<< clang_VerbatimBlockLineComment_getText comment
+
+      Right CXComment_VerbatimLine ->
+        traceU level1 "text" =<< clang_VerbatimLineComment_getText comment
+
+      Right CXComment_FullComment -> do
+        traceUnless level "HTML" T.null =<< clang_FullComment_getAsHTML comment
+        traceUnless level "XML"  T.null =<< clang_FullComment_getAsXML  comment
+
+      Left n -> traceU level1 "COMMENT_KIND_ENUM_OUT_OF_RANGE" n
+
+    numChildren <- clang_Comment_getNumChildren comment
+    when (numChildren > 0) $ do
+      traceU level1 "children" numChildren
+      forM_ [0 .. numChildren - 1] $ \i ->
+        dumpComment level2 (Just i) =<< clang_Comment_getChild comment i
+  where
+    level1, level2, level3 :: Int
+    level1 = level + 1
+    level2 = level + 2
+    level3 = level + 3
+
+{-------------------------------------------------------------------------------
+  Error handling
+-------------------------------------------------------------------------------}
+
+-- | Handle 'CallFailed' exceptions, returning the hint on error
+handleCallFailed :: forall a m.
+     MonadIO m
+  => IO a
+  -> m (Either String a)
+handleCallFailed action = liftIO $ first getHint <$> try action
+  where
+    getHint :: CallFailed -> String
+    getHint (CallFailed hint _backtrace) = hint
+
+{-------------------------------------------------------------------------------
+  Trace Functions
+-------------------------------------------------------------------------------}
+
+-- | Trace Markdown list item (internal)
+--
+-- This function is not meant to be used directly.  Use one of the below
+-- functions instead.
+trace' :: (Show a, MonadIO m)
+  => Int           -- ^ indentation level, from 0
+  -> Maybe Int     -- ^ index of ordered list
+  -> Maybe String  -- ^ label
+  -> Maybe a       -- ^ value
+  -> m ()
+trace' level mIndex mLabel mValue = liftIO . putStrLn $ concat
+    [ replicate (level * 4) ' '
+    , maybe "* " ((++ ". ") . show) mIndex
+    , case (mLabel, mValue) of
+        (Just label, Just value) -> label ++ ": " ++ show value
+        (Just label, Nothing)    -> label
+        (Nothing,    Just value) -> show value
+        (Nothing,    Nothing)    -> ""
+    ]
+
+-- | Trace label (unordered)
+traceL :: MonadIO m
+  => Int     -- ^ indentation level, from 0
+  -> String  -- ^ label
+  -> m ()
+traceL level label = trace' @() level Nothing (Just label) Nothing
+
+-- | Trace value (unordered, no label)
+traceU_ :: (Show a, MonadIO m)
+  => Int  -- ^ indentation level, from 0
+  -> a    -- ^ value
+  -> m ()
+traceU_ level value = trace' level Nothing Nothing (Just value)
+
+-- | Trace value (unordered, with label)
+traceU :: (Show a, MonadIO m)
+  => Int     -- ^ indentation level, from 0
+  -> String  -- ^ label
+  -> a       -- ^ value
+  -> m ()
+traceU level label value = trace' level Nothing (Just label) (Just value)
+
+-- | Trace value (ordered, no label)
+traceO_ :: (Integral i, Show a, MonadIO m)
+  => Int  -- ^ indentation level, from 0
+  -> i    -- ^ index of ordered list
+  -> a    -- ^ value
+  -> m ()
+traceO_ level index value =
+    trace' level (Just $ fromIntegral index) Nothing (Just value)
+
+-- | Trace value (ordered, with label)
+traceO :: (Integral i, Show a, MonadIO m)
+  => Int     -- ^ indentation level, from 0
+  -> i       -- ^ index of ordered list
+  -> String  -- ^ label
+  -> a       -- ^ value
+  -> m ()
+traceO level index label value =
+    trace' level (Just $ fromIntegral index) (Just label) (Just value)
+
+-- | Trace value when predicate holds (unordered, with label)
+traceWhen :: (Show a, MonadIO m)
+  => Int          -- ^ indentation level, from 0
+  -> String       -- ^ label
+  -> (a -> Bool)  -- ^ predicate
+  -> a            -- ^ value
+  -> m ()
+traceWhen level label p value = when (p value) $ traceU level label value
+
+-- | Trace value when predicate does not hold (unordered, with label)
+traceUnless :: (Show a, MonadIO m)
+  => Int          -- ^ indentation level, from 0
+  -> String       -- ^ label
+  -> (a -> Bool)  -- ^ predicate
+  -> a            -- ^ value
+  -> m ()
+traceUnless level label p value = unless (p value) $ traceU level label value
+
+{-------------------------------------------------------------------------------
+  CLI
+-------------------------------------------------------------------------------}
+
+main :: IO ()
+main = clangAstDump . uncurry applyAll =<< OA.execParser pinfo
+  where
+    pinfo :: OA.ParserInfo (Bool, Options)
+    pinfo = OA.info (OA.helper <*> parseOptions) $ mconcat
+      [ OA.fullDesc
+      , OA.progDesc "Clang AST dump"
+      , OA.failureCode 2
+      ]
+
+    parseOptions :: OA.Parser (Bool, Options)
+    parseOptions = do
+      -- flags enabled by all flag
+      optComments        <- mkFlag "comments"  "show comments"
+      optExtents         <- mkFlag "extents"   "show extents"
+      optKind            <- mkFlag "kind"      "show kind details"
+      optType            <- mkFlag "type"      "show type details"
+      -- all flag
+      optAll             <- mkFlag "all"       "enable all above flags"
+      -- other options/arguments
+      optBuiltin         <- mkFlag "builtin"   "show builtin macros"
+      optSameFile        <- mkFlag "same-file" "only show from specified file"
+      optIncludePath     <- includeDirOptions
+      optClangArgsInner  <- clangArgsInnerOption
+      optFile            <- fileArgument
+
+      pure (optAll, Options{
+          builtin        = optBuiltin
+        , comments       = optComments
+        , extents        = optExtents
+        , file           = optFile
+        , kind           = optKind
+        , includePath    = optIncludePath
+        , clangArgsInner = optClangArgsInner
+        , sameFile       = optSameFile
+        , typ            = optType
+        })
+
+    includeDirOptions :: OA.Parser [FilePath]
+    includeDirOptions = OA.many . OA.strOption $ mconcat
+      [ OA.short 'I'
+      , OA.metavar "DIR"
+      , OA.help "Include search path directory"
+      ]
+
+    clangArgsInnerOption :: OA.Parser [String]
+    clangArgsInnerOption = OA.many . OA.strOption $ mconcat [
+        OA.long "clang-option"
+      , OA.metavar "OPTION"
+      , OA.help "Pass option to clang"
+      ]
+
+    fileArgument :: OA.Parser C.HashIncludeArg
+    fileArgument = fmap C.HashIncludeArg . OA.strArgument $ mconcat
+      [ OA.metavar "FILE"
+      , OA.help "C (header) file to parse"
+      ]
+
+    mkFlag :: String -> String -> OA.Parser Bool
+    mkFlag flag doc = OA.switch $ OA.long flag <> OA.help doc
+
+    applyAll :: Bool -> Options -> Options
+    applyAll False opts = opts
+    applyAll True  opts = opts {
+        comments = True
+      , extents  = True
+      , kind     = True
+      , typ      = True
+      }
diff --git a/hs-bindgen.cabal b/hs-bindgen.cabal
new file mode 100644
--- /dev/null
+++ b/hs-bindgen.cabal
@@ -0,0 +1,681 @@
+cabal-version:      3.0
+name:               hs-bindgen
+version:            1.0.0.0
+license:            BSD-3-Clause
+license-file:       LICENSE
+author:             Well-Typed LLP
+maintainer:         info@well-typed.com
+category:           Development
+build-type:         Simple
+synopsis:           Generate Haskell bindings from C headers
+description:        Automatically generate Haskell bindings from C headers
+tested-with:
+  GHC ==9.4.8
+   || ==9.6.7
+   || ==9.8.4
+   || ==9.10.3
+   || ==9.12.2
+   || ==9.14.1
+
+extra-source-files:
+  bootstrap/*.h
+  musl-include/**/*.h
+  musl-include/COPYRIGHT
+  musl-include/VERSION
+  test-artefacts/fixtures/**/*.hs
+  test-artefacts/fixtures/**/*.txt
+  test-artefacts/fixtures/**/*.yaml
+  test-artefacts/headers/**/*.h
+  test-artefacts/headers/**/*.yaml
+
+extra-doc-files:
+  CHANGELOG.md
+  known-issues.md
+  README.md
+
+source-repository head
+  type:     git
+  location: https://github.com/well-typed/hs-bindgen
+  subdir:   hs-bindgen
+
+source-repository this
+  type:     git
+  location: https://github.com/well-typed/hs-bindgen
+  subdir:   hs-bindgen
+  tag:      release-1.0.0.0
+
+flag dev
+  description: Build debugging utilities for developing hs-bindgen itself
+  default:     False
+  manual:      True
+
+common lang
+  ghc-options:
+    -Wall -Widentities -Wprepositive-qualified-module
+    -Wredundant-constraints -Wunused-packages
+    -Wno-unticked-promoted-constructors
+
+  build-depends:      base >=4.17 && <4.23
+  default-language:   GHC2021
+  default-extensions:
+    DataKinds
+    DefaultSignatures
+    DeriveAnyClass
+    DerivingStrategies
+    DerivingVia
+    DisambiguateRecordFields
+    DuplicateRecordFields
+    FunctionalDependencies
+    LambdaCase
+    MultiWayIf
+    NoFieldSelectors
+    NoNamedFieldPuns
+    OverloadedLabels
+    OverloadedRecordDot
+    OverloadedStrings
+    PatternSynonyms
+    QuantifiedConstraints
+    TypeApplications
+    TypeFamilies
+    UndecidableInstances
+    ViewPatterns
+
+  if impl(ghc >=9.8)
+    default-extensions: TypeAbstractions
+
+library internal
+  import:           lang
+  hs-source-dirs:   src-internal
+  ghc-options:      -Wmissing-export-lists
+
+  -- Modules containing public API.
+  exposed-modules:  HsBindgen.Config
+
+  -- Internal modules
+  --
+  -- Rules:
+  --
+  -- * HsBindgen.IR.* modules must not (transitively) import from Frontend or
+  --   Backend
+  exposed-modules:
+    Data.Digraph
+    HsBindgen
+    HsBindgen.Artefact
+    HsBindgen.ArtefactM
+    HsBindgen.Backend
+    HsBindgen.Backend.Category
+    HsBindgen.Backend.Category.ApplyChoice
+    HsBindgen.Backend.Extensions
+    HsBindgen.Backend.Global
+    HsBindgen.Backend.Hs.AST
+    HsBindgen.Backend.Hs.AST.CompletePragma
+    HsBindgen.Backend.Hs.AST.Strategy
+    HsBindgen.Backend.Hs.CallConv
+    HsBindgen.Backend.Hs.Haddock.Documentation
+    HsBindgen.Backend.Hs.Haddock.Translation
+    HsBindgen.Backend.Hs.Name
+    HsBindgen.Backend.Hs.Origin
+    HsBindgen.Backend.Hs.Translation
+    HsBindgen.Backend.Hs.Translation.Field
+    HsBindgen.Backend.Hs.Translation.ForeignImport
+    HsBindgen.Backend.Hs.Translation.Function
+    HsBindgen.Backend.Hs.Translation.Instances
+    HsBindgen.Backend.Hs.Translation.Monad
+    HsBindgen.Backend.Hs.Translation.Newtype
+    HsBindgen.Backend.Hs.Translation.Structure
+    HsBindgen.Backend.Hs.Translation.ToFromFunPtr
+    HsBindgen.Backend.Hs.Translation.Union
+    HsBindgen.Backend.HsModule.Names
+    HsBindgen.Backend.HsModule.Pretty
+    HsBindgen.Backend.HsModule.Pretty.CAPI
+    HsBindgen.Backend.HsModule.Pretty.Comment
+    HsBindgen.Backend.HsModule.Pretty.Common
+    HsBindgen.Backend.HsModule.Pretty.Decl
+    HsBindgen.Backend.HsModule.Pretty.Expr
+    HsBindgen.Backend.HsModule.Pretty.Type
+    HsBindgen.Backend.HsModule.Render
+    HsBindgen.Backend.HsModule.Translation
+    HsBindgen.Backend.HsModule.Translation.Doxygen
+    HsBindgen.Backend.Level
+    HsBindgen.Backend.Runtime
+    HsBindgen.Backend.SHs.AST
+    HsBindgen.Backend.SHs.AST.Expr
+    HsBindgen.Backend.SHs.AST.Type
+    HsBindgen.Backend.SHs.Simplify
+    HsBindgen.Backend.SHs.Translation
+    HsBindgen.Backend.SHs.Translation.Common
+    HsBindgen.Backend.SHs.Translation.MapFunction
+    HsBindgen.Backend.TH.Translation
+    HsBindgen.Backend.UniqueSymbol
+    HsBindgen.BindingSpec
+    HsBindgen.BindingSpec.Gen
+    HsBindgen.BindingSpec.Private.Common
+    HsBindgen.BindingSpec.Private.Stdlib
+    HsBindgen.BindingSpec.Private.V1
+    HsBindgen.BindingSpec.Private.Version
+    HsBindgen.Boot
+    HsBindgen.Cache
+    HsBindgen.Clang
+    HsBindgen.Clang.CompareVersions
+    HsBindgen.Clang.Discover
+    HsBindgen.Clang.ExtraClangArgs
+    HsBindgen.Clang.Macos
+    HsBindgen.Clang.Tokens
+    HsBindgen.Config.ClangArgs
+    HsBindgen.Config.Internal
+    HsBindgen.Config.MangleCandidate
+    HsBindgen.Config.MangleCandidate.ReservedNames
+    HsBindgen.Config.Prelims
+    HsBindgen.Doxygen
+    HsBindgen.Eff
+    HsBindgen.Errors
+    HsBindgen.Frontend
+    HsBindgen.Frontend.Analysis
+    HsBindgen.Frontend.Analysis.DeclIndex
+    HsBindgen.Frontend.Analysis.DeclIndex.ResolveMacro
+    HsBindgen.Frontend.Analysis.DeclUseGraph
+    HsBindgen.Frontend.Analysis.DeclUseGraph.Construction
+    HsBindgen.Frontend.Analysis.DeclUseGraph.Definition
+    HsBindgen.Frontend.Analysis.DeclUseGraph.Query
+    HsBindgen.Frontend.Analysis.Deps
+    HsBindgen.Frontend.Analysis.IncludeGraph
+    HsBindgen.Frontend.Analysis.Typedefs
+    HsBindgen.Frontend.Analysis.UnnamedIdUsage
+    HsBindgen.Frontend.Analysis.UseDeclGraph
+    HsBindgen.Frontend.DeclMeta
+    HsBindgen.Frontend.LanguageC
+    HsBindgen.Frontend.LanguageC.Error
+    HsBindgen.Frontend.LanguageC.Monad
+    HsBindgen.Frontend.LanguageC.PartialAST
+    HsBindgen.Frontend.LanguageC.PartialAST.FromLanC
+    HsBindgen.Frontend.LanguageC.PartialAST.ToBindgen
+    HsBindgen.Frontend.Pass.AdjustTypes
+    HsBindgen.Frontend.Pass.AdjustTypes.IsPass
+    HsBindgen.Frontend.Pass.ConstructTranslationUnit
+    HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+    HsBindgen.Frontend.Pass.EnrichComments
+    HsBindgen.Frontend.Pass.EnrichComments.IsPass
+    HsBindgen.Frontend.Pass.FillUnnamedIds
+    HsBindgen.Frontend.Pass.FillUnnamedIds.ChooseNames
+    HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass
+    HsBindgen.Frontend.Pass.Final
+    HsBindgen.Frontend.Pass.MangleNames
+    HsBindgen.Frontend.Pass.MangleNames.CreateNames
+    HsBindgen.Frontend.Pass.MangleNames.DetectClashes
+    HsBindgen.Frontend.Pass.MangleNames.Error
+    HsBindgen.Frontend.Pass.MangleNames.IsPass
+    HsBindgen.Frontend.Pass.MangleNames.Names
+    HsBindgen.Frontend.Pass.MangleNames.ResolveNames
+    HsBindgen.Frontend.Pass.Parse
+    HsBindgen.Frontend.Pass.Parse.Builtin
+    HsBindgen.Frontend.Pass.Parse.Context
+    HsBindgen.Frontend.Pass.Parse.Decl
+    HsBindgen.Frontend.Pass.Parse.Decl.Field
+    HsBindgen.Frontend.Pass.Parse.Decl.ImplicitFields
+    HsBindgen.Frontend.Pass.Parse.Decl.Macro
+    HsBindgen.Frontend.Pass.Parse.Decl.Members
+    HsBindgen.Frontend.Pass.Parse.IsPass
+    HsBindgen.Frontend.Pass.Parse.Monad.Decl
+    HsBindgen.Frontend.Pass.Parse.Monad.SourceRangeMap
+    HsBindgen.Frontend.Pass.Parse.Monad.Type
+    HsBindgen.Frontend.Pass.Parse.Msg
+    HsBindgen.Frontend.Pass.Parse.Result
+    HsBindgen.Frontend.Pass.Parse.Type
+    HsBindgen.Frontend.Pass.PrepareReparse
+    HsBindgen.Frontend.Pass.PrepareReparse.AST
+    HsBindgen.Frontend.Pass.PrepareReparse.Flatten
+    HsBindgen.Frontend.Pass.PrepareReparse.IsPass
+    HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg
+    HsBindgen.Frontend.Pass.PrepareReparse.Lexer
+    HsBindgen.Frontend.Pass.PrepareReparse.Parser
+    HsBindgen.Frontend.Pass.PrepareReparse.Preprocessor
+    HsBindgen.Frontend.Pass.PrepareReparse.Printer
+    HsBindgen.Frontend.Pass.PrepareReparse.Printer.Util
+    HsBindgen.Frontend.Pass.PrepareReparse.Simplifier
+    HsBindgen.Frontend.Pass.PrepareReparse.Tracer
+    HsBindgen.Frontend.Pass.PrepareReparse.Update
+    HsBindgen.Frontend.Pass.ReparseMacroExpansions
+    HsBindgen.Frontend.Pass.ReparseMacroExpansions.ForgetAnn
+    HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass
+    HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.Msg
+    HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC
+    HsBindgen.Frontend.Pass.ReparseMacroExpansions.Zip
+    HsBindgen.Frontend.Pass.ReparseMacroExpansions.Zip.Error
+    HsBindgen.Frontend.Pass.ResolveBindingSpecs
+    HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+    HsBindgen.Frontend.Pass.Select
+    HsBindgen.Frontend.Pass.Select.IsPass
+    HsBindgen.Frontend.Pass.SimplifyAST
+    HsBindgen.Frontend.Pass.SimplifyAST.IsPass
+    HsBindgen.Frontend.Pass.TranslateTypes
+    HsBindgen.Frontend.Pass.TranslateTypes.IsPass
+    HsBindgen.Frontend.Pass.TranslateTypes.IsPass.Msg
+    HsBindgen.Frontend.Pass.TranslateTypes.Translation
+    HsBindgen.Frontend.Pass.TypecheckMacros
+    HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+    HsBindgen.Frontend.Pass.TypecheckMacros.KnownTypes
+    HsBindgen.Frontend.Pass.TypecheckMacros.Typecheck
+    HsBindgen.Frontend.Predicate
+    HsBindgen.Frontend.PrettyC
+    HsBindgen.Frontend.ProcessIncludes
+    HsBindgen.Frontend.RootHeader
+    HsBindgen.Frontend.TranslationUnit
+    HsBindgen.Guasi
+    HsBindgen.Imports
+    HsBindgen.Instances
+    HsBindgen.IR.C
+    HsBindgen.IR.C.Conflict
+    HsBindgen.IR.C.Decl
+    HsBindgen.IR.C.DeclPath
+    HsBindgen.IR.C.HashDefine
+    HsBindgen.IR.C.HashIncludeArg
+    HsBindgen.IR.C.LocationInfo
+    HsBindgen.IR.C.Naming
+    HsBindgen.IR.C.PrettyPrinter
+    HsBindgen.IR.C.RootDirective
+    HsBindgen.IR.C.Type
+    HsBindgen.IR.Hs
+    HsBindgen.IR.Hs.Type
+    HsBindgen.IR.Pass
+    HsBindgen.IR.Pass.Ann
+    HsBindgen.IR.Pass.CommentDecl
+    HsBindgen.IR.Pass.Definition
+    HsBindgen.IR.Pass.ExtBinding
+    HsBindgen.IR.Pass.Id
+    HsBindgen.IR.Pass.Macro
+    HsBindgen.IR.Pass.Msg
+    HsBindgen.IR.Pass.ScopedName
+    HsBindgen.IR.Pass.Types
+    HsBindgen.IR.Translation
+    HsBindgen.Language.C
+    HsBindgen.Language.Haskell
+    HsBindgen.Macro.Empty
+    HsBindgen.Macro.Error
+    HsBindgen.Macro.Flip
+    HsBindgen.Macro.Interface
+    HsBindgen.Macro.Parse
+    HsBindgen.Macro.Raw
+    HsBindgen.Macro.Raw.Lang
+    HsBindgen.Macro.Raw.Parse
+    HsBindgen.Macro.Syntax
+    HsBindgen.Macro.Type
+    HsBindgen.Macro.UniqueExpansion
+    HsBindgen.Macro.UniqueExpansion.Parse
+    HsBindgen.Macro.UniqueExpansion.Types
+    HsBindgen.NameHint
+    HsBindgen.Orphans
+    HsBindgen.Resolve
+    HsBindgen.Test
+    HsBindgen.Test.C
+    HsBindgen.Test.Hs
+    HsBindgen.Test.Internal
+    HsBindgen.Test.Readme
+    HsBindgen.TH.Internal
+    HsBindgen.TraceMsg
+    HsBindgen.Util.Monad
+    HsBindgen.Util.Process
+    HsBindgen.Util.Rational
+    HsBindgen.Util.Tracer
+    Text.SimplePrettyPrint
+
+  other-modules:    Paths_hs_bindgen
+  autogen-modules:  Paths_hs_bindgen
+  other-extensions: TemplateHaskellQuotes
+
+  -- Internal dependencies
+  build-depends:    hs-bindgen-runtime >=1.0.0.0 && <1.1
+
+  -- External dependencies
+  build-depends:
+    , aeson               >=2.2.1.0    && <2.3
+    , ansi-terminal       >=1.0.0      && <1.2
+    , array               >=0.5.4.0    && <0.6
+    , base-compat         >=0.13.1     && <0.16
+    , base16-bytestring   >=1.0.2.0    && <1.1
+    , bytestring          >=0.11.4.0   && <0.13
+    , containers          >=0.6.5.1    && <0.9
+    , contra-tracer       >=0.2        && <0.3
+    , cryptohash-sha256   >=0.11.102.1 && <0.12
+    , data-default        >=0.7        && <0.9
+    , debruijn            ^>=0.3.1
+    , directory           >=1.3.6.2    && <1.4
+    , doxygen-parser      >=0.1        && <0.2
+    , exceptions          >=0.10       && <0.11
+    , filepath            >=1.4        && <1.6
+    , fin                 >=0.3.2      && <0.4
+    , language-c          >=0.9        && <0.11
+    , libclang-bindings   >=0.2        && <0.3
+    , mtl                 >=2.2        && <2.4
+    , optics-core         >=0.4        && <0.5
+    , parsec              >=3.1        && <3.2
+    , pretty              >=1.1.3.6    && <1.2
+    , process             >=1.6        && <1.7
+    , regex-pcre-builtin  >=0.95       && <0.96
+    , some                >=1.0.6      && <1.1
+    , template-haskell    >=2.19       && <2.25
+    , temporary           >=1.3        && <1.4
+    , text                >=1.2        && <2.2
+    , transformers        >=0.5        && <0.7
+    , unliftio-core       >=0.2.1      && <0.3
+    , vec                 >=0.5        && <0.6
+    , yaml                >=0.11.11.1  && <0.12
+
+library
+  import:             lang
+  hs-source-dirs:     src
+  exposed-modules:
+    HsBindgen.Macro
+    HsBindgen.TH
+
+  other-modules:
+    HsBindgen.Internal.Macro.CExpr
+    HsBindgen.Internal.Macro.CExpr.Global
+    HsBindgen.Internal.Macro.CExpr.Parse
+    HsBindgen.Internal.Macro.CExpr.Resolution
+    HsBindgen.Internal.Macro.CExpr.Translation.Type
+    HsBindgen.Internal.Macro.CExpr.Translation.Value
+    HsBindgen.Internal.Macro.CExpr.Type
+    HsBindgen.Internal.Macro.CExpr.Typecheck
+
+  reexported-modules:
+  other-extensions:   TemplateHaskellQuotes
+
+  -- Internal dependencies
+  build-depends:
+    , hs-bindgen-runtime
+    , hs-bindgen:internal
+
+  -- External dependencies
+  build-depends:
+    , c-expr-dsl      >=0.2 && <0.3
+    , c-expr-runtime  >=0.1 && <0.2
+
+  -- Inherited dependencies
+  build-depends:
+    , containers
+    , data-default
+    , debruijn
+    , fin
+    , libclang-bindings
+    , template-haskell
+    , text
+    , vec
+
+executable hs-bindgen-cli
+  import:             lang
+  default-extensions: NoFieldSelectors
+  main-is:            hs-bindgen-cli.hs
+  hs-source-dirs:     app
+  other-modules:
+    HsBindgen.App
+    HsBindgen.App.Output
+    HsBindgen.Cli
+    HsBindgen.Cli.BindingSpec
+    HsBindgen.Cli.BindingSpec.StdLib
+    HsBindgen.Cli.GenTests
+    HsBindgen.Cli.Info
+    HsBindgen.Cli.Info.BuiltinMacros
+    HsBindgen.Cli.Info.Doxygen
+    HsBindgen.Cli.Info.IncludeGraph
+    HsBindgen.Cli.Info.Instances
+    HsBindgen.Cli.Info.Libclang
+    HsBindgen.Cli.Info.ResolveHeader
+    HsBindgen.Cli.Info.UseDeclGraph
+    HsBindgen.Cli.Internal
+    HsBindgen.Cli.Internal.Frontend
+    HsBindgen.Cli.Preprocess
+    HsBindgen.Cli.ToolSupport
+    HsBindgen.Cli.ToolSupport.Literate
+    Paths_hs_bindgen
+
+  autogen-modules:    Paths_hs_bindgen
+
+  -- Internal dependencies
+  build-depends:
+    , hs-bindgen
+    , hs-bindgen:internal
+
+  -- Inherited dependencies
+  build-depends:
+    , containers
+    , data-default
+    , libclang-bindings
+
+  -- External dependencies
+  build-depends:
+    , bytestring            >=0.11.4.0 && <0.13
+    , optparse-applicative  >=0.18     && <0.20
+    , prettyprinter         >=1.7.1    && <1.8
+    , text                  >=1.2      && <2.2
+
+executable clang-ast-dump
+  import:         lang
+  main-is:        Main.hs
+  hs-source-dirs: clang-ast-dump
+
+  if flag(dev)
+    buildable: True
+
+  else
+    buildable: False
+
+  -- Internal dependencies
+  build-depends:  hs-bindgen:internal
+
+  -- Inherited dependencies
+  build-depends:
+    , containers
+    , data-default
+    , libclang-bindings
+    , text
+
+  -- External dependencies
+  build-depends:  optparse-applicative >=0.18 && <0.20
+
+library test-common
+  import:          lang
+  hs-source-dirs:  test/common
+  exposed-modules:
+    Test.Common.HsBindgen.Trace
+    Test.Common.HsBindgen.Trace.Patterns
+    Test.Common.HsBindgen.Trace.Predicate
+    Test.Common.Util.AnsiDiff
+    Test.Common.Util.Cabal
+    Test.Common.Util.Tasty
+    Test.Common.Util.Tasty.Golden
+
+  -- Internal dependencies
+  build-depends:   hs-bindgen:internal
+
+  -- Inherited dependencies
+  build-depends:
+    , ansi-terminal
+    , bytestring
+    , containers
+    , directory
+    , filepath
+    , mtl
+    , text
+    , transformers
+
+  -- External dependencies
+  build-depends:
+    , deepseq        >=1.4     && <1.6
+    , Diff           >=1.0     && <1.1
+    , edit-distance  >=0.2.2.1 && <0.3
+    , primitive      >=0.9     && <0.10
+    , tasty          >=1.5     && <1.6
+    , tasty-hunit    >=0.10.2  && <0.11
+    , utf8-string    >=1.0.2   && <1.1
+
+test-suite test-hs-bindgen
+  import:             lang
+  type:               exitcode-stdio-1.0
+  main-is:            test-hs-bindgen.hs
+  hs-source-dirs:     test/hs-bindgen
+
+  -- -threaded is needed for parallel fixture compilation via direct GHC
+  -- invocations.
+  -- Suppress warning about hs-bindgen being unused in test code
+  -- (it's only used when compiling generated TH modules)
+  ghc-options:        -threaded -Wno-unused-packages
+  other-modules:
+    Test.HsBindgen.Clang
+    Test.HsBindgen.Fixtures.Haddock
+    Test.HsBindgen.Fixtures.TestCases
+    Test.HsBindgen.Fixtures.Utils
+    Test.HsBindgen.Frontend.LanguageC
+    Test.HsBindgen.Frontend.Pass.PrepareReparse
+    Test.HsBindgen.Golden
+    Test.HsBindgen.Golden.Arrays
+    Test.HsBindgen.Golden.Attributes
+    Test.HsBindgen.Golden.BindingSpecs
+    Test.HsBindgen.Golden.Comprehensive
+    Test.HsBindgen.Golden.Declarations
+    Test.HsBindgen.Golden.Documentation
+    Test.HsBindgen.Golden.EdgeCases
+    Test.HsBindgen.Golden.Functions
+    Test.HsBindgen.Golden.Globals
+    Test.HsBindgen.Golden.Infra.Check.BindingSpec
+    Test.HsBindgen.Golden.Infra.Check.FailureBindgen
+    Test.HsBindgen.Golden.Infra.Check.FailureLibclang
+    Test.HsBindgen.Golden.Infra.Check.PP
+    Test.HsBindgen.Golden.Infra.Check.TH
+    Test.HsBindgen.Golden.Infra.TestCase
+    Test.HsBindgen.Golden.Infra.TestCaseTree
+    Test.HsBindgen.Golden.Macros
+    Test.HsBindgen.Golden.Macros.Lang
+    Test.HsBindgen.Golden.Macros.Redeclaration
+    Test.HsBindgen.Golden.Macros.Reparse
+    Test.HsBindgen.Golden.ProgramAnalysis
+    Test.HsBindgen.Golden.Types
+    Test.HsBindgen.Integration.ExitCode
+    Test.HsBindgen.Integration.OverwritePolicy
+    Test.HsBindgen.Macro.CExpr
+    Test.HsBindgen.Macro.Infra
+    Test.HsBindgen.Macro.Syntax
+    Test.HsBindgen.Macro.Syntax.Clang
+    Test.HsBindgen.Macro.UniqueExpansion
+    Test.HsBindgen.PPFixtures
+    Test.HsBindgen.PPFixtures.Compile
+    Test.HsBindgen.PPFixtures.TestCases
+    Test.HsBindgen.Prop.Selection
+    Test.HsBindgen.Resources
+    Test.HsBindgen.THFixtures
+    Test.HsBindgen.THFixtures.Compile
+    Test.HsBindgen.THFixtures.Generate
+    Test.HsBindgen.THFixtures.TestCases
+    Test.HsBindgen.Unit.ClangArgs
+    Test.HsBindgen.Unit.Digraph
+    Test.HsBindgen.Unit.Frontend
+    Test.HsBindgen.Unit.Pretty
+    Test.HsBindgen.Unit.RootDirective
+    Test.HsBindgen.Unit.Runtime
+    Test.HsBindgen.Unit.Tracer
+
+  -- Internal dependencies
+  build-depends:
+    , hs-bindgen
+    , hs-bindgen-runtime
+    , hs-bindgen:internal
+    , test-common
+
+  -- Inherited dependencies
+  build-depends:
+    , c-expr-dsl
+    , containers
+    , data-default
+    , debruijn
+    , directory
+    , filepath
+    , libclang-bindings
+    , mtl
+    , optics-core
+    , parsec
+    , process
+    , tasty
+    , tasty-hunit
+    , template-haskell
+    , temporary
+    , text
+    , utf8-string
+
+  -- External dependencies
+  build-depends:
+    , async             >=2.2     && <2.3
+    , syb               >=0.7.2.4 && <0.8
+    , tasty-quickcheck  >=0.11    && <0.12
+
+  -- Build tools needed for integration tests
+  build-tool-depends: hs-bindgen:hs-bindgen-cli
+
+-- Test TH mode
+--
+-- We're intentionally /not/ importing the common @lang@ section here: this
+-- forces us to explicitly declare whatever language extensions are needed
+-- when using hs-bindgen's TH mode.
+test-suite test-th
+  type:             exitcode-stdio-1.0
+  main-is:          test-th.hs
+  hs-source-dirs:   test/th
+  include-dirs:     test-artefacts/headers
+  default-language: GHC2021
+  ghc-options:
+    -Wall -Widentities -Wprepositive-qualified-module
+    -Wredundant-constraints -Wunused-packages
+    -Wno-unticked-promoted-constructors
+
+  other-modules:
+    Test.TH.RecordDot
+    Test.TH.StaticCounterA
+    Test.TH.StaticCounterB
+    Test.TH.Test01
+    Test.TH.Test02
+
+  -- Internal dependencies
+  build-depends:
+    , hs-bindgen
+    , hs-bindgen-runtime
+    , test-common
+
+  -- Inherited dependencies
+  build-depends:
+    , base
+    , filepath
+    , optics
+    , tasty
+    , tasty-hunit
+
+  -- External dependencies
+  build-depends:    vector ^>=0.13.2.0
+
+test-suite test-literate
+  type:               exitcode-stdio-1.0
+  main-is:            test-literate.hs
+  hs-source-dirs:     test/literate
+  include-dirs:       test-artefacts/headers
+  default-language:   GHC2021
+  build-depends:      base >=4.17 && <4.23
+  ghc-options:
+    -Wall -Widentities -Wredundant-constraints -Wunused-packages
+    -Wno-unticked-promoted-constructors
+
+  other-modules:
+    Test.Literate.Test01
+    Test.Literate.Test02
+    Test.Literate.TestPointer
+    Test.Literate.TestSafe
+    Test.Literate.TestSafeAndUnsafe
+    Test.Literate.TestUnsafe
+
+  -- Here we use literate haskell "hook" to avoid setting up true preprocessors
+  -- (which would require either build-type: Custom or Hooks - both not a great options, at least yet).
+  --
+  -- The source files contains the actual options and arguments to be used with hs-bindgen
+  ghc-options:        -pgmL hs-bindgen-cli -optL tool-support -optL literate
+  build-tool-depends: hs-bindgen:hs-bindgen-cli
+
+  -- Internal dependencies
+  build-depends:
+    , c-expr-runtime
+    , hs-bindgen-runtime
diff --git a/known-issues.md b/known-issues.md
new file mode 100644
--- /dev/null
+++ b/known-issues.md
@@ -0,0 +1,140 @@
+# Known Issues
+
+Whenever we cut a `hs-bindgen` release, our goal is of course to release a
+product without known bugs. However, this is not always practical: some bugs
+have so little impact that holding up a release until they are fixed would be
+counterproductive. We list these known issues in this file.
+
+This file is bundled with each release, and is a record of which bugs are known
+to be present in that specific release. Its purpose is to enable users to
+quickly scan through and see if any are relevant to them. It does not replace
+the [issue tracker][issue-tracker]: bugs should be reported and discussed there,
+and the details of each bug can be found there also.
+
+## Missing type class instances can result in invalid generated code
+
+> https://github.com/well-typed/hs-bindgen/issues/2253
+> https://github.com/well-typed/hs-bindgen/issues/786
+> https://github.com/well-typed/hs-bindgen/issues/1621
+> https://github.com/well-typed/hs-bindgen/issues/2200
+
+Datatypes generated by `hs-bindgen` are equipped with a number of type class
+instances. If an instance of class `C` for some type `B` depends on the `C`
+instance for another type `A`, but that instance is missing, we might generate
+invalid code (that fails to compile). The primary reason why `A` might not
+have the instance is a hand-written binding specification.
+
+## Return-by-value of const-struct results in invalid code
+
+> https://github.com/well-typed/hs-bindgen/issues/1514
+
+Related to #1515, but even more obscure: we generate invalid code for functions
+that return a struct _by value_ which is _itself_ marked `const`:
+
+```c
+struct S { int x; };
+const struct S f1();
+```
+
+Note that this `const` qualifier here is pointless anyway.
+
+## Return-by-value of struct-of-const results in invalid code
+
+> https://github.com/well-typed/hs-bindgen/issues/1515
+
+We generate invalid code for functions that return a struct _by value_ where
+that struct has _const_ fields:
+
+```c
+struct S { const int x; int y; };
+struct S f1();
+```
+
+## Literate mode fails to detect changes in dependent C files
+
+> https://github.com/well-typed/hs-bindgen/issues/1583
+
+When using `hs-bindgen` in literate mode, bindings won't be re-generated when
+the C headers have changed.
+
+## Some parse failures are not printed
+
+> https://github.com/well-typed/hs-bindgen/issues/1851
+
+Trace messages for unnamed declarations that cannot be selected are lost in some
+cases. In the following example, the reason that the declarations cannot be
+selected (`long double` is not supported) is not shown.
+
+```c
+struct foo {
+  struct {
+     long double not_supported;
+  } field;
+};
+```
+
+## Generated bindings for undef-ed macros fail to compile
+
+> https://github.com/well-typed/hs-bindgen/issues/1956
+
+Bindings for a declaration that uses a macro that is later undefined still
+use the macro and therefore fail to compile. Example:
+
+```c
+#define T int
+void foo (T x);
+#undef T
+```
+
+## Enums with a macro-defined underlying type are not reparsed
+
+> https://github.com/well-typed/hs-bindgen/issues/2119
+
+Given
+
+```c
+#define A int
+enum E : A { enumerator };
+```
+
+we will use `CInt` rather than the `A` newtype as the enum's underlying type.
+
+## Reparsing of some headers may fail
+
+> https://github.com/well-typed/hs-bindgen/issues/2148
+
+In `hs-bindgen`, parsing and initial analysis of the C code (memory layout etc.)
+are offloaded to `clang`; we use `clang` both in "compile" and in "preprocess"
+mode; the latter when we are "reparsing" C code to recover macro information. In
+rare cases `clang` in "compile" mode succeeds where "preprocess" mode fails;
+when this happens, you might see an error such as
+
+```
+We tried to run the clang executable to preprocess select macro invocations, but it failed to run.
+```
+
+## Selection might miss redeclared declarations
+
+> https://github.com/well-typed/hs-bindgen/issues/2282
+
+When, say, a `struct` declaration occurs _twice_ in a header (or its transitive
+`#include`s), we only store one of the locations. Consequently, if a selection
+predicate matches the _other_ location, the declaration might not be selected
+and would be omitted from the generated bindings.
+
+## Reparse range is sometimes inaccurate
+
+> https://github.com/well-typed/hs-bindgen/issues/2286
+
+In order to recover macro information, `hs-bindgen` needs to reparse
+declarations; this process starts by asking `libclang` for the location of the
+first and final token. Sometimes `libclang` reports these locations incorrectly;
+we try to correct for this, but don't always succeed. When we don't succeed, we
+will fail to recover macro information and fall back on the parse as `libclang`
+itself previously reported it. This only happens in rare circumstances, and only
+with macros with arguments.
+
+
+
+
+[issue-tracker]: https://github.com/well-typed/hs-bindgen/issues
diff --git a/musl-include/COPYRIGHT b/musl-include/COPYRIGHT
new file mode 100644
--- /dev/null
+++ b/musl-include/COPYRIGHT
@@ -0,0 +1,193 @@
+musl as a whole is licensed under the following standard MIT license:
+
+----------------------------------------------------------------------
+Copyright © 2005-2020 Rich Felker, et al.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+----------------------------------------------------------------------
+
+Authors/contributors include:
+
+A. Wilcox
+Ada Worcester
+Alex Dowad
+Alex Suykov
+Alexander Monakov
+Andre McCurdy
+Andrew Kelley
+Anthony G. Basile
+Aric Belsito
+Arvid Picciani
+Bartosz Brachaczek
+Benjamin Peterson
+Bobby Bingham
+Boris Brezillon
+Brent Cook
+Chris Spiegel
+Clément Vasseur
+Daniel Micay
+Daniel Sabogal
+Daurnimator
+David Carlier
+David Edelsohn
+Denys Vlasenko
+Dmitry Ivanov
+Dmitry V. Levin
+Drew DeVault
+Emil Renner Berthing
+Fangrui Song
+Felix Fietkau
+Felix Janda
+Gianluca Anzolin
+Hauke Mehrtens
+He X
+Hiltjo Posthuma
+Isaac Dunham
+Jaydeep Patil
+Jens Gustedt
+Jeremy Huntwork
+Jo-Philipp Wich
+Joakim Sindholt
+John Spencer
+Julien Ramseier
+Justin Cormack
+Kaarle Ritvanen
+Khem Raj
+Kylie McClain
+Leah Neukirchen
+Luca Barbato
+Luka Perkov
+M Farkas-Dyck (Strake)
+Mahesh Bodapati
+Markus Wichmann
+Masanori Ogino
+Michael Clark
+Michael Forney
+Mikhail Kremnyov
+Natanael Copa
+Nicholas J. Kain
+orc
+Pascal Cuoq
+Patrick Oppenlander
+Petr Hosek
+Petr Skocik
+Pierre Carrier
+Reini Urban
+Rich Felker
+Richard Pennington
+Ryan Fairfax
+Samuel Holland
+Segev Finer
+Shiz
+sin
+Solar Designer
+Stefan Kristiansson
+Stefan O'Rear
+Szabolcs Nagy
+Timo Teräs
+Trutz Behn
+Valentin Ochs
+Will Dietz
+William Haddon
+William Pitcock
+
+Portions of this software are derived from third-party works licensed
+under terms compatible with the above MIT license:
+
+The TRE regular expression implementation (src/regex/reg* and
+src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
+under a 2-clause BSD license (license text in the source files). The
+included version has been heavily modified by Rich Felker in 2012, in
+the interests of size, simplicity, and namespace cleanliness.
+
+Much of the math library code (src/math/* and src/complex/*) is
+Copyright © 1993,2004 Sun Microsystems or
+Copyright © 2003-2011 David Schultz or
+Copyright © 2003-2009 Steven G. Kargl or
+Copyright © 2003-2009 Bruce D. Evans or
+Copyright © 2008 Stephen L. Moshier or
+Copyright © 2017-2018 Arm Limited
+and labelled as such in comments in the individual source files. All
+have been licensed under extremely permissive terms.
+
+The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
+The Android Open Source Project and is licensed under a two-clause BSD
+license. It was taken from Bionic libc, used on Android.
+
+The AArch64 memcpy and memset code (src/string/aarch64/*) are
+Copyright © 1999-2019, Arm Limited.
+
+The implementation of DES for crypt (src/crypt/crypt_des.c) is
+Copyright © 1994 David Burren. It is licensed under a BSD license.
+
+The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
+originally written by Solar Designer and placed into the public
+domain. The code also comes with a fallback permissive license for use
+in jurisdictions that may not recognize the public domain.
+
+The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
+Valentin Ochs and is licensed under an MIT-style license.
+
+The x86_64 port was written by Nicholas J. Kain and is licensed under
+the standard MIT terms.
+
+The mips and microblaze ports were originally written by Richard
+Pennington for use in the ellcc project. The original code was adapted
+by Rich Felker for build system and code conventions during upstream
+integration. It is licensed under the standard MIT terms.
+
+The mips64 port was contributed by Imagination Technologies and is
+licensed under the standard MIT terms.
+
+The powerpc port was also originally written by Richard Pennington,
+and later supplemented and integrated by John Spencer. It is licensed
+under the standard MIT terms.
+
+All other files which have no copyright comments are original works
+produced specifically for use as part of this library, written either
+by Rich Felker, the main author of the library, or by one or more
+contibutors listed above. Details on authorship of individual files
+can be found in the git version control history of the project. The
+omission of copyright and license comments in each file is in the
+interest of source tree size.
+
+In addition, permission is hereby granted for all public header files
+(include/* and arch/*/bits/*) and crt files intended to be linked into
+applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
+the copyright notice and permission notice otherwise required by the
+license, and to use these files without any requirement of
+attribution. These files include substantial contributions from:
+
+Bobby Bingham
+John Spencer
+Nicholas J. Kain
+Rich Felker
+Richard Pennington
+Stefan Kristiansson
+Szabolcs Nagy
+
+all of whom have explicitly granted such permission.
+
+This file previously contained text expressing a belief that most of
+the files covered by the above exception were sufficiently trivial not
+to be subject to copyright, resulting in confusion over whether it
+negated the permissions granted in the license. In the spirit of
+permissive licensing, and of not having licensing issues being an
+obstacle to adoption, that text has been removed.
diff --git a/musl-include/VERSION b/musl-include/VERSION
new file mode 100644
--- /dev/null
+++ b/musl-include/VERSION
@@ -0,0 +1,1 @@
+1.2.5
diff --git a/musl-include/aarch64/aio.h b/musl-include/aarch64/aio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/aio.h
@@ -0,0 +1,73 @@
+#ifndef _AIO_H
+#define _AIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <signal.h>
+#include <time.h>
+
+#define __NEED_ssize_t
+#define __NEED_off_t
+
+#include <bits/alltypes.h>
+
+struct aiocb {
+	int aio_fildes, aio_lio_opcode, aio_reqprio;
+	volatile void *aio_buf;
+	size_t aio_nbytes;
+	struct sigevent aio_sigevent;
+	void *__td;
+	int __lock[2];
+	volatile int __err;
+	ssize_t __ret;
+	off_t aio_offset;
+	void *__next, *__prev;
+	char __dummy4[32-2*sizeof(void *)];
+};
+
+#define AIO_CANCELED 0
+#define AIO_NOTCANCELED 1
+#define AIO_ALLDONE 2
+
+#define LIO_READ 0
+#define LIO_WRITE 1
+#define LIO_NOP 2
+
+#define LIO_WAIT 0
+#define LIO_NOWAIT 1
+
+int aio_read(struct aiocb *);
+int aio_write(struct aiocb *);
+int aio_error(const struct aiocb *);
+ssize_t aio_return(struct aiocb *);
+int aio_cancel(int, struct aiocb *);
+int aio_suspend(const struct aiocb *const [], int, const struct timespec *);
+int aio_fsync(int, struct aiocb *);
+
+int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define aiocb64 aiocb
+#define aio_read64 aio_read
+#define aio_write64 aio_write
+#define aio_error64 aio_error
+#define aio_return64 aio_return
+#define aio_cancel64 aio_cancel
+#define aio_suspend64 aio_suspend
+#define aio_fsync64 aio_fsync
+#define lio_listio64 lio_listio
+#define off64_t off_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(aio_suspend, __aio_suspend_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/alloca.h b/musl-include/aarch64/alloca.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/alloca.h
@@ -0,0 +1,19 @@
+#ifndef	_ALLOCA_H
+#define	_ALLOCA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	__NEED_size_t
+#include <bits/alltypes.h>
+
+void *alloca(size_t);
+
+#define alloca __builtin_alloca
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/ar.h b/musl-include/aarch64/ar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/ar.h
@@ -0,0 +1,25 @@
+#ifndef _AR_H
+#define _AR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ARMAG "!<arch>\n"
+#define SARMAG 8
+#define ARFMAG "`\n"
+
+struct ar_hdr {
+	char ar_name[16];
+	char ar_date[12];
+	char ar_uid[6], ar_gid[6];
+	char ar_mode[8];
+	char ar_size[10];
+	char ar_fmag[2];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/arpa/ftp.h b/musl-include/aarch64/arpa/ftp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/arpa/ftp.h
@@ -0,0 +1,35 @@
+#ifndef _ARPA_FTP_H
+#define _ARPA_FTP_H
+#define PRELIM 1
+#define COMPLETE 2
+#define CONTINUE 3
+#define TRANSIENT 4
+#define ERROR 5
+#define TYPE_A 1
+#define TYPE_E 2
+#define TYPE_I 3
+#define TYPE_L 4
+#define FORM_N 1
+#define FORM_T 2
+#define FORM_C 3
+#define STRU_F 1
+#define STRU_R 2
+#define STRU_P 3
+#define MODE_S 1
+#define MODE_B 2
+#define MODE_C 3
+#define REC_ESC '\377'
+#define REC_EOR '\001'
+#define REC_EOF '\002'
+#define BLK_EOR 0x80
+#define BLK_EOF 0x40
+#define BLK_ERRORS 0x20
+#define BLK_RESTART 0x10
+#define BLK_BYTECOUNT 2
+#ifdef FTP_NAMES
+char *modenames[] =  {"0", "Stream", "Block", "Compressed" };
+char *strunames[] =  {"0", "File", "Record", "Page" };
+char *typenames[] =  {"0", "ASCII", "EBCDIC", "Image", "Local" };
+char *formnames[] =  {"0", "Nonprint", "Telnet", "Carriage-control" };
+#endif
+#endif
diff --git a/musl-include/aarch64/arpa/inet.h b/musl-include/aarch64/arpa/inet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/arpa/inet.h
@@ -0,0 +1,31 @@
+#ifndef _ARPA_INET_H
+#define	_ARPA_INET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+
+uint32_t htonl(uint32_t);
+uint16_t htons(uint16_t);
+uint32_t ntohl(uint32_t);
+uint16_t ntohs(uint16_t);
+
+in_addr_t inet_addr (const char *);
+in_addr_t inet_network (const char *);
+char *inet_ntoa (struct in_addr);
+int inet_pton (int, const char *__restrict, void *__restrict);
+const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
+
+int inet_aton (const char *, struct in_addr *);
+struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
+in_addr_t inet_lnaof(struct in_addr);
+in_addr_t inet_netof(struct in_addr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/arpa/nameser.h b/musl-include/aarch64/arpa/nameser.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/arpa/nameser.h
@@ -0,0 +1,526 @@
+#ifndef _ARPA_NAMESER_H
+#define _ARPA_NAMESER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+#include <stdint.h>
+
+#define __NAMESER	19991006
+#define NS_PACKETSZ	512
+#define NS_MAXDNAME	1025
+#define NS_MAXMSG	65535
+#define NS_MAXCDNAME	255
+#define NS_MAXLABEL	63
+#define NS_HFIXEDSZ	12
+#define NS_QFIXEDSZ	4
+#define NS_RRFIXEDSZ	10
+#define NS_INT32SZ	4
+#define NS_INT16SZ	2
+#define NS_INT8SZ	1
+#define NS_INADDRSZ	4
+#define NS_IN6ADDRSZ	16
+#define NS_CMPRSFLGS	0xc0
+#define NS_DEFAULTPORT	53
+
+typedef enum __ns_sect {
+	ns_s_qd = 0,
+	ns_s_zn = 0,
+	ns_s_an = 1,
+	ns_s_pr = 1,
+	ns_s_ns = 2,
+	ns_s_ud = 2,
+	ns_s_ar = 3,
+	ns_s_max = 4
+} ns_sect;
+
+typedef struct __ns_msg {
+	const unsigned char *_msg, *_eom;
+	uint16_t _id, _flags, _counts[ns_s_max];
+	const unsigned char *_sections[ns_s_max];
+	ns_sect _sect;
+	int _rrnum;
+	const unsigned char *_msg_ptr;
+} ns_msg;
+
+struct _ns_flagdata {  int mask, shift;  };
+extern const struct _ns_flagdata _ns_flagdata[];
+
+#define ns_msg_id(handle) ((handle)._id + 0)
+#define ns_msg_base(handle) ((handle)._msg + 0)
+#define ns_msg_end(handle) ((handle)._eom + 0)
+#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
+#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
+#define ns_msg_getflag(handle, flag) \
+	(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
+
+typedef	struct __ns_rr {
+	char		name[NS_MAXDNAME];
+	uint16_t	type;
+	uint16_t	rr_class;
+	uint32_t	ttl;
+	uint16_t	rdlength;
+	const unsigned char *rdata;
+} ns_rr;
+
+#define ns_rr_name(rr)	(((rr).name[0] != '\0') ? (rr).name : ".")
+#define ns_rr_type(rr)	((ns_type)((rr).type + 0))
+#define ns_rr_class(rr)	((ns_class)((rr).rr_class + 0))
+#define ns_rr_ttl(rr)	((rr).ttl + 0)
+#define ns_rr_rdlen(rr)	((rr).rdlength + 0)
+#define ns_rr_rdata(rr)	((rr).rdata + 0)
+
+typedef enum __ns_flag {
+	ns_f_qr,
+	ns_f_opcode,
+	ns_f_aa,
+	ns_f_tc,
+	ns_f_rd,
+	ns_f_ra,
+	ns_f_z,
+	ns_f_ad,
+	ns_f_cd,
+	ns_f_rcode,
+	ns_f_max
+} ns_flag;
+
+typedef enum __ns_opcode {
+	ns_o_query = 0,
+	ns_o_iquery = 1,
+	ns_o_status = 2,
+	ns_o_notify = 4,
+	ns_o_update = 5,
+	ns_o_max = 6
+} ns_opcode;
+
+typedef	enum __ns_rcode {
+	ns_r_noerror = 0,
+	ns_r_formerr = 1,
+	ns_r_servfail = 2,
+	ns_r_nxdomain = 3,
+	ns_r_notimpl = 4,
+	ns_r_refused = 5,
+	ns_r_yxdomain = 6,
+	ns_r_yxrrset = 7,
+	ns_r_nxrrset = 8,
+	ns_r_notauth = 9,
+	ns_r_notzone = 10,
+	ns_r_max = 11,
+	ns_r_badvers = 16,
+	ns_r_badsig = 16,
+	ns_r_badkey = 17,
+	ns_r_badtime = 18
+} ns_rcode;
+
+typedef enum __ns_update_operation {
+	ns_uop_delete = 0,
+	ns_uop_add = 1,
+	ns_uop_max = 2
+} ns_update_operation;
+
+struct ns_tsig_key {
+        char name[NS_MAXDNAME], alg[NS_MAXDNAME];
+        unsigned char *data;
+        int len;
+};
+typedef struct ns_tsig_key ns_tsig_key;
+
+struct ns_tcp_tsig_state {
+	int counter;
+	struct dst_key *key;
+	void *ctx;
+	unsigned char sig[NS_PACKETSZ];
+	int siglen;
+};
+typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
+
+#define NS_TSIG_FUDGE 300
+#define NS_TSIG_TCP_COUNT 100
+#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
+
+#define NS_TSIG_ERROR_NO_TSIG -10
+#define NS_TSIG_ERROR_NO_SPACE -11
+#define NS_TSIG_ERROR_FORMERR -12
+
+typedef enum __ns_type {
+	ns_t_invalid = 0,
+	ns_t_a = 1,
+	ns_t_ns = 2,
+	ns_t_md = 3,
+	ns_t_mf = 4,
+	ns_t_cname = 5,
+	ns_t_soa = 6,
+	ns_t_mb = 7,
+	ns_t_mg = 8,
+	ns_t_mr = 9,
+	ns_t_null = 10,
+	ns_t_wks = 11,
+	ns_t_ptr = 12,
+	ns_t_hinfo = 13,
+	ns_t_minfo = 14,
+	ns_t_mx = 15,
+	ns_t_txt = 16,
+	ns_t_rp = 17,
+	ns_t_afsdb = 18,
+	ns_t_x25 = 19,
+	ns_t_isdn = 20,
+	ns_t_rt = 21,
+	ns_t_nsap = 22,
+	ns_t_nsap_ptr = 23,
+	ns_t_sig = 24,
+	ns_t_key = 25,
+	ns_t_px = 26,
+	ns_t_gpos = 27,
+	ns_t_aaaa = 28,
+	ns_t_loc = 29,
+	ns_t_nxt = 30,
+	ns_t_eid = 31,
+	ns_t_nimloc = 32,
+	ns_t_srv = 33,
+	ns_t_atma = 34,
+	ns_t_naptr = 35,
+	ns_t_kx = 36,
+	ns_t_cert = 37,
+	ns_t_a6 = 38,
+	ns_t_dname = 39,
+	ns_t_sink = 40,
+	ns_t_opt = 41,
+	ns_t_apl = 42,
+	ns_t_ds = 43,
+	ns_t_sshfp = 44,
+	ns_t_ipseckey = 45,
+	ns_t_rrsig = 46,
+	ns_t_nsec = 47,
+	ns_t_dnskey = 48,
+	ns_t_dhcid = 49,
+	ns_t_nsec3 = 50,
+	ns_t_nsec3param = 51,
+	ns_t_tlsa = 52,
+	ns_t_smimea = 53,
+	ns_t_hip = 55,
+	ns_t_ninfo = 56,
+	ns_t_rkey = 57,
+	ns_t_talink = 58,
+	ns_t_cds = 59,
+	ns_t_cdnskey = 60,
+	ns_t_openpgpkey = 61,
+	ns_t_csync = 62,
+	ns_t_spf = 99,
+	ns_t_uinfo = 100,
+	ns_t_uid = 101,
+	ns_t_gid = 102,
+	ns_t_unspec = 103,
+	ns_t_nid = 104,
+	ns_t_l32 = 105,
+	ns_t_l64 = 106,
+	ns_t_lp = 107,
+	ns_t_eui48 = 108,
+	ns_t_eui64 = 109,
+	ns_t_tkey = 249,
+	ns_t_tsig = 250,
+	ns_t_ixfr = 251,
+	ns_t_axfr = 252,
+	ns_t_mailb = 253,
+	ns_t_maila = 254,
+	ns_t_any = 255,
+	ns_t_zxfr = 256,
+	ns_t_uri = 256,
+	ns_t_caa = 257,
+	ns_t_avc = 258,
+	ns_t_ta = 32768,
+	ns_t_dlv = 32769,
+	ns_t_max = 65536
+} ns_type;
+
+#define	ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
+		      (t) == ns_t_mailb || (t) == ns_t_maila)
+#define	ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
+#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
+#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
+#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
+		       (t) == ns_t_zxfr)
+
+typedef enum __ns_class {
+	ns_c_invalid = 0,
+	ns_c_in = 1,
+	ns_c_2 = 2,
+	ns_c_chaos = 3,
+	ns_c_hs = 4,
+	ns_c_none = 254,
+	ns_c_any = 255,
+	ns_c_max = 65536
+} ns_class;
+
+typedef enum __ns_key_types {
+	ns_kt_rsa = 1,
+	ns_kt_dh  = 2,
+	ns_kt_dsa = 3,
+	ns_kt_private = 254
+} ns_key_types;
+
+typedef enum __ns_cert_types {
+	cert_t_pkix = 1,
+	cert_t_spki = 2,
+	cert_t_pgp  = 3,
+	cert_t_url  = 253,
+	cert_t_oid  = 254
+} ns_cert_types;
+
+#define	NS_KEY_TYPEMASK		0xC000
+#define	NS_KEY_TYPE_AUTH_CONF	0x0000
+#define	NS_KEY_TYPE_CONF_ONLY	0x8000
+#define	NS_KEY_TYPE_AUTH_ONLY	0x4000
+#define	NS_KEY_TYPE_NO_KEY	0xC000
+#define	NS_KEY_NO_AUTH		0x8000
+#define	NS_KEY_NO_CONF		0x4000
+#define	NS_KEY_RESERVED2	0x2000
+#define	NS_KEY_EXTENDED_FLAGS	0x1000
+#define	NS_KEY_RESERVED4	0x0800
+#define	NS_KEY_RESERVED5	0x0400
+#define	NS_KEY_NAME_TYPE	0x0300
+#define	NS_KEY_NAME_USER	0x0000
+#define	NS_KEY_NAME_ENTITY	0x0200
+#define	NS_KEY_NAME_ZONE	0x0100
+#define	NS_KEY_NAME_RESERVED	0x0300
+#define	NS_KEY_RESERVED8	0x0080
+#define	NS_KEY_RESERVED9	0x0040
+#define	NS_KEY_RESERVED10	0x0020
+#define	NS_KEY_RESERVED11	0x0010
+#define	NS_KEY_SIGNATORYMASK	0x000F
+#define	NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
+				  NS_KEY_RESERVED4 | \
+				  NS_KEY_RESERVED5 | \
+				  NS_KEY_RESERVED8 | \
+				  NS_KEY_RESERVED9 | \
+				  NS_KEY_RESERVED10 | \
+				  NS_KEY_RESERVED11 )
+#define NS_KEY_RESERVED_BITMASK2 0xFFFF
+#define	NS_ALG_MD5RSA		1
+#define	NS_ALG_DH               2
+#define	NS_ALG_DSA              3
+#define	NS_ALG_DSS              NS_ALG_DSA
+#define	NS_ALG_EXPIRE_ONLY	253
+#define	NS_ALG_PRIVATE_OID	254
+
+#define NS_KEY_PROT_TLS         1
+#define NS_KEY_PROT_EMAIL       2
+#define NS_KEY_PROT_DNSSEC      3
+#define NS_KEY_PROT_IPSEC       4
+#define NS_KEY_PROT_ANY		255
+
+#define	NS_MD5RSA_MIN_BITS	 512
+#define	NS_MD5RSA_MAX_BITS	4096
+#define	NS_MD5RSA_MAX_BYTES	((NS_MD5RSA_MAX_BITS+7/8)*2+3)
+#define	NS_MD5RSA_MAX_BASE64	(((NS_MD5RSA_MAX_BYTES+2)/3)*4)
+#define NS_MD5RSA_MIN_SIZE	((NS_MD5RSA_MIN_BITS+7)/8)
+#define NS_MD5RSA_MAX_SIZE	((NS_MD5RSA_MAX_BITS+7)/8)
+
+#define NS_DSA_SIG_SIZE         41
+#define NS_DSA_MIN_SIZE         213
+#define NS_DSA_MAX_BYTES        405
+
+#define	NS_SIG_TYPE	0
+#define	NS_SIG_ALG	2
+#define	NS_SIG_LABELS	3
+#define	NS_SIG_OTTL	4
+#define	NS_SIG_EXPIR	8
+#define	NS_SIG_SIGNED	12
+#define	NS_SIG_FOOT	16
+#define	NS_SIG_SIGNER	18
+#define	NS_NXT_BITS 8
+#define	NS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_MAX 127
+
+#define NS_OPT_DNSSEC_OK        0x8000U
+#define NS_OPT_NSID		3
+
+#define NS_GET16(s, cp) (void)((s) = ns_get16(((cp)+=2)-2))
+#define NS_GET32(l, cp) (void)((l) = ns_get32(((cp)+=4)-4))
+#define NS_PUT16(s, cp) ns_put16((s), ((cp)+=2)-2)
+#define NS_PUT32(l, cp) ns_put32((l), ((cp)+=4)-4)
+
+unsigned ns_get16(const unsigned char *);
+unsigned long ns_get32(const unsigned char *);
+void ns_put16(unsigned, unsigned char *);
+void ns_put32(unsigned long, unsigned char *);
+
+int ns_initparse(const unsigned char *, int, ns_msg *);
+int ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
+int ns_skiprr(const unsigned char *, const unsigned char *, ns_sect, int);
+int ns_name_uncompress(const unsigned char *, const unsigned char *, const unsigned char *, char *, size_t);
+
+
+#define	__BIND		19950621
+
+typedef struct {
+	unsigned	id :16;
+#if __BYTE_ORDER == __BIG_ENDIAN
+	unsigned	qr: 1;
+	unsigned	opcode: 4;
+	unsigned	aa: 1;
+	unsigned	tc: 1;
+	unsigned	rd: 1;
+	unsigned	ra: 1;
+	unsigned	unused :1;
+	unsigned	ad: 1;
+	unsigned	cd: 1;
+	unsigned	rcode :4;
+#else
+	unsigned	rd :1;
+	unsigned	tc :1;
+	unsigned	aa :1;
+	unsigned	opcode :4;
+	unsigned	qr :1;
+	unsigned	rcode :4;
+	unsigned	cd: 1;
+	unsigned	ad: 1;
+	unsigned	unused :1;
+	unsigned	ra :1;
+#endif
+	unsigned	qdcount :16;
+	unsigned	ancount :16;
+	unsigned	nscount :16;
+	unsigned	arcount :16;
+} HEADER;
+
+#define PACKETSZ	NS_PACKETSZ
+#define MAXDNAME	NS_MAXDNAME
+#define MAXCDNAME	NS_MAXCDNAME
+#define MAXLABEL	NS_MAXLABEL
+#define	HFIXEDSZ	NS_HFIXEDSZ
+#define QFIXEDSZ	NS_QFIXEDSZ
+#define RRFIXEDSZ	NS_RRFIXEDSZ
+#define	INT32SZ		NS_INT32SZ
+#define	INT16SZ		NS_INT16SZ
+#define INT8SZ		NS_INT8SZ
+#define	INADDRSZ	NS_INADDRSZ
+#define	IN6ADDRSZ	NS_IN6ADDRSZ
+#define	INDIR_MASK	NS_CMPRSFLGS
+#define NAMESERVER_PORT	NS_DEFAULTPORT
+
+#define S_ZONE		ns_s_zn
+#define S_PREREQ	ns_s_pr
+#define S_UPDATE	ns_s_ud
+#define S_ADDT		ns_s_ar
+
+#define QUERY		ns_o_query
+#define IQUERY		ns_o_iquery
+#define STATUS		ns_o_status
+#define	NS_NOTIFY_OP	ns_o_notify
+#define	NS_UPDATE_OP	ns_o_update
+
+#define NOERROR		ns_r_noerror
+#define FORMERR		ns_r_formerr
+#define SERVFAIL	ns_r_servfail
+#define NXDOMAIN	ns_r_nxdomain
+#define NOTIMP		ns_r_notimpl
+#define REFUSED		ns_r_refused
+#define YXDOMAIN	ns_r_yxdomain
+#define YXRRSET		ns_r_yxrrset
+#define NXRRSET		ns_r_nxrrset
+#define NOTAUTH		ns_r_notauth
+#define NOTZONE		ns_r_notzone
+
+#define DELETE		ns_uop_delete
+#define ADD		ns_uop_add
+
+#define T_A		ns_t_a
+#define T_NS		ns_t_ns
+#define T_MD		ns_t_md
+#define T_MF		ns_t_mf
+#define T_CNAME		ns_t_cname
+#define T_SOA		ns_t_soa
+#define T_MB		ns_t_mb
+#define T_MG		ns_t_mg
+#define T_MR		ns_t_mr
+#define T_NULL		ns_t_null
+#define T_WKS		ns_t_wks
+#define T_PTR		ns_t_ptr
+#define T_HINFO		ns_t_hinfo
+#define T_MINFO		ns_t_minfo
+#define T_MX		ns_t_mx
+#define T_TXT		ns_t_txt
+#define	T_RP		ns_t_rp
+#define T_AFSDB		ns_t_afsdb
+#define T_X25		ns_t_x25
+#define T_ISDN		ns_t_isdn
+#define T_RT		ns_t_rt
+#define T_NSAP		ns_t_nsap
+#define T_NSAP_PTR	ns_t_nsap_ptr
+#define	T_SIG		ns_t_sig
+#define	T_KEY		ns_t_key
+#define	T_PX		ns_t_px
+#define	T_GPOS		ns_t_gpos
+#define	T_AAAA		ns_t_aaaa
+#define	T_LOC		ns_t_loc
+#define	T_NXT		ns_t_nxt
+#define	T_EID		ns_t_eid
+#define	T_NIMLOC	ns_t_nimloc
+#define	T_SRV		ns_t_srv
+#define T_ATMA		ns_t_atma
+#define T_NAPTR		ns_t_naptr
+#define T_A6		ns_t_a6
+#define T_DNAME		ns_t_dname
+#define T_DS		ns_t_ds
+#define T_SSHFP		ns_t_sshfp
+#define T_IPSECKEY	ns_t_ipseckey
+#define T_RRSIG		ns_t_rrsig
+#define T_NSEC		ns_t_nsec
+#define T_DNSKEY	ns_t_dnskey
+#define T_DHCID		ns_t_dhcid
+#define T_NSEC3		ns_t_nsec3
+#define T_NSEC3PARAM	ns_t_nsec3param
+#define T_TLSA		ns_t_tlsa
+#define T_SMIMEA	ns_t_smimea
+#define T_HIP		ns_t_hip
+#define T_NINFO		ns_t_ninfo
+#define T_RKEY		ns_t_rkey
+#define T_TALINK	ns_t_talink
+#define T_CDS		ns_t_cds
+#define T_CDNSKEY	ns_t_cdnskey
+#define T_OPENPGPKEY	ns_t_openpgpkey
+#define T_CSYNC		ns_t_csync
+#define T_SPF		ns_t_spf
+#define T_UINFO		ns_t_uinfo
+#define T_UID		ns_t_uid
+#define T_GID		ns_t_gid
+#define T_UNSPEC	ns_t_unspec
+#define T_NID		ns_t_nid
+#define T_L32		ns_t_l32
+#define T_L64		ns_t_l64
+#define T_LP		ns_t_lp
+#define T_EUI48		ns_t_eui48
+#define T_EUI64		ns_t_eui64
+#define T_TKEY		ns_t_tkey
+#define	T_TSIG		ns_t_tsig
+#define	T_IXFR		ns_t_ixfr
+#define T_AXFR		ns_t_axfr
+#define T_MAILB		ns_t_mailb
+#define T_MAILA		ns_t_maila
+#define T_ANY		ns_t_any
+#define T_URI		ns_t_uri
+#define T_CAA		ns_t_caa
+#define T_AVC		ns_t_avc
+#define T_TA		ns_t_ta
+#define T_DLV		ns_t_dlv
+
+#define C_IN		ns_c_in
+#define C_CHAOS		ns_c_chaos
+#define C_HS		ns_c_hs
+#define C_NONE		ns_c_none
+#define C_ANY		ns_c_any
+
+#define	GETSHORT		NS_GET16
+#define	GETLONG			NS_GET32
+#define	PUTSHORT		NS_PUT16
+#define	PUTLONG			NS_PUT32
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/arpa/nameser_compat.h b/musl-include/aarch64/arpa/nameser_compat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/arpa/nameser_compat.h
@@ -0,0 +1,2 @@
+#include <arpa/nameser.h>
+
diff --git a/musl-include/aarch64/arpa/telnet.h b/musl-include/aarch64/arpa/telnet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/arpa/telnet.h
@@ -0,0 +1,251 @@
+#ifndef _ARPA_TELNET_H
+#define	_ARPA_TELNET_H
+
+#define	IAC	255
+#define	DONT	254
+#define	DO	253
+#define	WONT	252
+#define	WILL	251
+#define	SB	250
+#define	GA	249
+#define	EL	248
+#define	EC	247
+#define	AYT	246
+#define	AO	245
+#define	IP	244
+#define	BREAK	243
+#define	DM	242
+#define	NOP	241
+#define	SE	240
+#define EOR     239
+#define	ABORT	238
+#define	SUSP	237
+#define	xEOF	236
+
+#define SYNCH	242
+
+#define telcmds ((char [][6]){ "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0 })
+
+#define	TELCMD_FIRST	xEOF
+#define	TELCMD_LAST	IAC
+#define	TELCMD_OK(x)	((unsigned int)(x) <= TELCMD_LAST && \
+			 (unsigned int)(x) >= TELCMD_FIRST)
+#define	TELCMD(x)	telcmds[(x)-TELCMD_FIRST]
+
+#define TELOPT_BINARY	0
+#define TELOPT_ECHO	1
+#define	TELOPT_RCP	2
+#define	TELOPT_SGA	3
+#define	TELOPT_NAMS	4
+#define	TELOPT_STATUS	5
+#define	TELOPT_TM	6
+#define	TELOPT_RCTE	7
+#define TELOPT_NAOL 	8
+#define TELOPT_NAOP 	9
+#define TELOPT_NAOCRD	10
+#define TELOPT_NAOHTS	11
+#define TELOPT_NAOHTD	12
+#define TELOPT_NAOFFD	13
+#define TELOPT_NAOVTS	14
+#define TELOPT_NAOVTD	15
+#define TELOPT_NAOLFD	16
+#define TELOPT_XASCII	17
+#define	TELOPT_LOGOUT	18
+#define	TELOPT_BM	19
+#define	TELOPT_DET	20
+#define	TELOPT_SUPDUP	21
+#define	TELOPT_SUPDUPOUTPUT 22
+#define	TELOPT_SNDLOC	23
+#define	TELOPT_TTYPE	24
+#define	TELOPT_EOR	25
+#define	TELOPT_TUID	26
+#define	TELOPT_OUTMRK	27
+#define	TELOPT_TTYLOC	28
+#define	TELOPT_3270REGIME 29
+#define	TELOPT_X3PAD	30
+#define	TELOPT_NAWS	31
+#define	TELOPT_TSPEED	32
+#define	TELOPT_LFLOW	33
+#define TELOPT_LINEMODE	34
+#define TELOPT_XDISPLOC	35
+#define TELOPT_OLD_ENVIRON 36
+#define	TELOPT_AUTHENTICATION 37/* Authenticate */
+#define	TELOPT_ENCRYPT	38
+#define TELOPT_NEW_ENVIRON 39
+#define	TELOPT_EXOPL	255
+
+
+#define	NTELOPTS	(1+TELOPT_NEW_ENVIRON)
+#ifdef TELOPTS
+char *telopts[NTELOPTS+1] = {
+	"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
+	"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
+	"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
+	"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
+	"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
+	"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
+	"TACACS UID", "OUTPUT MARKING", "TTYLOC",
+	"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
+	"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
+	"ENCRYPT", "NEW-ENVIRON",
+	0,
+};
+#define	TELOPT_FIRST	TELOPT_BINARY
+#define	TELOPT_LAST	TELOPT_NEW_ENVIRON
+#define	TELOPT_OK(x)	((unsigned int)(x) <= TELOPT_LAST)
+#define	TELOPT(x)	telopts[(x)-TELOPT_FIRST]
+#endif
+
+#define	TELQUAL_IS	0
+#define	TELQUAL_SEND	1
+#define	TELQUAL_INFO	2
+#define	TELQUAL_REPLY	2
+#define	TELQUAL_NAME	3
+
+#define	LFLOW_OFF		0
+#define	LFLOW_ON		1
+#define	LFLOW_RESTART_ANY	2
+#define	LFLOW_RESTART_XON	3
+
+
+#define	LM_MODE		1
+#define	LM_FORWARDMASK	2
+#define	LM_SLC		3
+
+#define	MODE_EDIT	0x01
+#define	MODE_TRAPSIG	0x02
+#define	MODE_ACK	0x04
+#define MODE_SOFT_TAB	0x08
+#define MODE_LIT_ECHO	0x10
+
+#define	MODE_MASK	0x1f
+
+#define MODE_FLOW		0x0100
+#define MODE_ECHO		0x0200
+#define MODE_INBIN		0x0400
+#define MODE_OUTBIN		0x0800
+#define MODE_FORCE		0x1000
+
+#define	SLC_SYNCH	1
+#define	SLC_BRK		2
+#define	SLC_IP		3
+#define	SLC_AO		4
+#define	SLC_AYT		5
+#define	SLC_EOR		6
+#define	SLC_ABORT	7
+#define	SLC_EOF		8
+#define	SLC_SUSP	9
+#define	SLC_EC		10
+#define	SLC_EL		11
+#define	SLC_EW		12
+#define	SLC_RP		13
+#define	SLC_LNEXT	14
+#define	SLC_XON		15
+#define	SLC_XOFF	16
+#define	SLC_FORW1	17
+#define	SLC_FORW2	18
+
+#define	NSLC		18
+
+#define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
+			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
+			"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
+#ifdef	SLC_NAMES
+char *slc_names[] = {
+	SLC_NAMELIST
+};
+#else
+extern char *slc_names[];
+#define	SLC_NAMES SLC_NAMELIST
+#endif
+
+#define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)
+#define SLC_NAME(x)	slc_names[x]
+
+#define	SLC_NOSUPPORT	0
+#define	SLC_CANTCHANGE	1
+#define	SLC_VARIABLE	2
+#define	SLC_DEFAULT	3
+#define	SLC_LEVELBITS	0x03
+
+#define	SLC_FUNC	0
+#define	SLC_FLAGS	1
+#define	SLC_VALUE	2
+
+#define	SLC_ACK		0x80
+#define	SLC_FLUSHIN	0x40
+#define	SLC_FLUSHOUT	0x20
+
+#define	OLD_ENV_VAR	1
+#define	OLD_ENV_VALUE	0
+#define	NEW_ENV_VAR	0
+#define	NEW_ENV_VALUE	1
+#define	ENV_ESC		2
+#define ENV_USERVAR	3
+
+#define	AUTH_WHO_CLIENT		0
+#define	AUTH_WHO_SERVER		1
+#define	AUTH_WHO_MASK		1
+
+#define	AUTH_HOW_ONE_WAY	0
+#define	AUTH_HOW_MUTUAL		2
+#define	AUTH_HOW_MASK		2
+
+#define	AUTHTYPE_NULL		0
+#define	AUTHTYPE_KERBEROS_V4	1
+#define	AUTHTYPE_KERBEROS_V5	2
+#define	AUTHTYPE_SPX		3
+#define	AUTHTYPE_MINK		4
+#define	AUTHTYPE_CNT		5
+
+#define	AUTHTYPE_TEST		99
+
+#ifdef	AUTH_NAMES
+char *authtype_names[] = {
+	"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
+};
+#else
+extern char *authtype_names[];
+#endif
+
+#define	AUTHTYPE_NAME_OK(x)	((unsigned int)(x) < AUTHTYPE_CNT)
+#define	AUTHTYPE_NAME(x)	authtype_names[x]
+
+#define	ENCRYPT_IS		0
+#define	ENCRYPT_SUPPORT		1
+#define	ENCRYPT_REPLY		2
+#define	ENCRYPT_START		3
+#define	ENCRYPT_END		4
+#define	ENCRYPT_REQSTART	5
+#define	ENCRYPT_REQEND		6
+#define	ENCRYPT_ENC_KEYID	7
+#define	ENCRYPT_DEC_KEYID	8
+#define	ENCRYPT_CNT		9
+
+#define	ENCTYPE_ANY		0
+#define	ENCTYPE_DES_CFB64	1
+#define	ENCTYPE_DES_OFB64	2
+#define	ENCTYPE_CNT		3
+
+#ifdef	ENCRYPT_NAMES
+char *encrypt_names[] = {
+	"IS", "SUPPORT", "REPLY", "START", "END",
+	"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
+	0,
+};
+char *enctype_names[] = {
+	"ANY", "DES_CFB64",  "DES_OFB64",  0,
+};
+#else
+extern char *encrypt_names[];
+extern char *enctype_names[];
+#endif
+
+
+#define	ENCRYPT_NAME_OK(x)	((unsigned int)(x) < ENCRYPT_CNT)
+#define	ENCRYPT_NAME(x)		encrypt_names[x]
+
+#define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
+#define	ENCTYPE_NAME(x)		enctype_names[x]
+
+#endif
diff --git a/musl-include/aarch64/arpa/tftp.h b/musl-include/aarch64/arpa/tftp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/arpa/tftp.h
@@ -0,0 +1,31 @@
+#ifndef _ARPA_TFTP_H
+#define _ARPA_TFTP_H
+#define SEGSIZE 512
+#define RRQ 01
+#define WRQ 02
+#define DATA 03
+#define ACK 04
+#define ERROR 05
+struct tftphdr {
+	short th_opcode;
+	union {
+		unsigned short tu_block;
+		short tu_code;
+		char tu_stuff[1];
+	} th_u;
+	char th_data[1];
+};
+#define th_block th_u.tu_block
+#define th_code th_u.tu_code
+#define th_stuff th_u.tu_stuff
+#define th_msg th_data
+#define EUNDEF 0
+#define ENOTFOUND 1
+#define EACCESS 2
+#define ENOSPACE 3
+#define EBADOP 4
+#define EBADID 5
+#define EEXISTS 6
+#define ENOUSER 7
+#endif
+
diff --git a/musl-include/aarch64/assert.h b/musl-include/aarch64/assert.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/assert.h
@@ -0,0 +1,23 @@
+#include <features.h>
+
+#undef assert
+
+#ifdef NDEBUG
+#define	assert(x) (void)0
+#else
+#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
+#endif
+
+#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
+#define static_assert _Static_assert
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_Noreturn void __assert_fail (const char *, const char *, int, const char *);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/musl-include/aarch64/bits/alltypes.h b/musl-include/aarch64/bits/alltypes.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/alltypes.h
@@ -0,0 +1,423 @@
+#define _Addr long
+#define _Int64 long
+#define _Reg long
+
+#if __AARCH64EB__
+#define __BYTE_ORDER 4321
+#else
+#define __BYTE_ORDER 1234
+#endif
+
+#define __LONG_MAX 0x7fffffffffffffffL
+
+#ifndef __cplusplus
+#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
+typedef unsigned wchar_t;
+#define __DEFINED_wchar_t
+#endif
+
+#endif
+#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
+typedef unsigned wint_t;
+#define __DEFINED_wint_t
+#endif
+
+
+#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
+typedef int blksize_t;
+#define __DEFINED_blksize_t
+#endif
+
+#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
+typedef unsigned int nlink_t;
+#define __DEFINED_nlink_t
+#endif
+
+
+#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
+typedef float float_t;
+#define __DEFINED_float_t
+#endif
+
+#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
+typedef double double_t;
+#define __DEFINED_double_t
+#endif
+
+
+#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
+typedef struct { long long __ll; long double __ld; } max_align_t;
+#define __DEFINED_max_align_t
+#endif
+
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+#define __USE_TIME_BITS64 1
+
+#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
+typedef unsigned _Addr size_t;
+#define __DEFINED_size_t
+#endif
+
+#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
+typedef unsigned _Addr uintptr_t;
+#define __DEFINED_uintptr_t
+#endif
+
+#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
+typedef _Addr ptrdiff_t;
+#define __DEFINED_ptrdiff_t
+#endif
+
+#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t)
+typedef _Addr ssize_t;
+#define __DEFINED_ssize_t
+#endif
+
+#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
+typedef _Addr intptr_t;
+#define __DEFINED_intptr_t
+#endif
+
+#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t)
+typedef _Addr regoff_t;
+#define __DEFINED_regoff_t
+#endif
+
+#if defined(__NEED_register_t) && !defined(__DEFINED_register_t)
+typedef _Reg register_t;
+#define __DEFINED_register_t
+#endif
+
+#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
+typedef _Int64 time_t;
+#define __DEFINED_time_t
+#endif
+
+#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
+typedef _Int64 suseconds_t;
+#define __DEFINED_suseconds_t
+#endif
+
+
+#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t)
+typedef signed char     int8_t;
+#define __DEFINED_int8_t
+#endif
+
+#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t)
+typedef signed short    int16_t;
+#define __DEFINED_int16_t
+#endif
+
+#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t)
+typedef signed int      int32_t;
+#define __DEFINED_int32_t
+#endif
+
+#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t)
+typedef signed _Int64   int64_t;
+#define __DEFINED_int64_t
+#endif
+
+#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
+typedef signed _Int64   intmax_t;
+#define __DEFINED_intmax_t
+#endif
+
+#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t)
+typedef unsigned char   uint8_t;
+#define __DEFINED_uint8_t
+#endif
+
+#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t)
+typedef unsigned short  uint16_t;
+#define __DEFINED_uint16_t
+#endif
+
+#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t)
+typedef unsigned int    uint32_t;
+#define __DEFINED_uint32_t
+#endif
+
+#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t)
+typedef unsigned _Int64 uint64_t;
+#define __DEFINED_uint64_t
+#endif
+
+#if defined(__NEED_u_int64_t) && !defined(__DEFINED_u_int64_t)
+typedef unsigned _Int64 u_int64_t;
+#define __DEFINED_u_int64_t
+#endif
+
+#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
+typedef unsigned _Int64 uintmax_t;
+#define __DEFINED_uintmax_t
+#endif
+
+
+#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t)
+typedef unsigned mode_t;
+#define __DEFINED_mode_t
+#endif
+
+#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
+typedef unsigned _Reg nlink_t;
+#define __DEFINED_nlink_t
+#endif
+
+#if defined(__NEED_off_t) && !defined(__DEFINED_off_t)
+typedef _Int64 off_t;
+#define __DEFINED_off_t
+#endif
+
+#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
+typedef unsigned _Int64 ino_t;
+#define __DEFINED_ino_t
+#endif
+
+#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
+typedef unsigned _Int64 dev_t;
+#define __DEFINED_dev_t
+#endif
+
+#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
+typedef long blksize_t;
+#define __DEFINED_blksize_t
+#endif
+
+#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
+typedef _Int64 blkcnt_t;
+#define __DEFINED_blkcnt_t
+#endif
+
+#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
+typedef unsigned _Int64 fsblkcnt_t;
+#define __DEFINED_fsblkcnt_t
+#endif
+
+#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
+typedef unsigned _Int64 fsfilcnt_t;
+#define __DEFINED_fsfilcnt_t
+#endif
+
+
+#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
+typedef unsigned wint_t;
+#define __DEFINED_wint_t
+#endif
+
+#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t)
+typedef unsigned long wctype_t;
+#define __DEFINED_wctype_t
+#endif
+
+
+#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t)
+typedef void * timer_t;
+#define __DEFINED_timer_t
+#endif
+
+#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t)
+typedef int clockid_t;
+#define __DEFINED_clockid_t
+#endif
+
+#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
+typedef long clock_t;
+#define __DEFINED_clock_t
+#endif
+
+#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval)
+struct timeval { time_t tv_sec; suseconds_t tv_usec; };
+#define __DEFINED_struct_timeval
+#endif
+
+#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
+struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
+#define __DEFINED_struct_timespec
+#endif
+
+
+#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
+typedef int pid_t;
+#define __DEFINED_pid_t
+#endif
+
+#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
+typedef unsigned id_t;
+#define __DEFINED_id_t
+#endif
+
+#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
+typedef unsigned uid_t;
+#define __DEFINED_uid_t
+#endif
+
+#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
+typedef unsigned gid_t;
+#define __DEFINED_gid_t
+#endif
+
+#if defined(__NEED_key_t) && !defined(__DEFINED_key_t)
+typedef int key_t;
+#define __DEFINED_key_t
+#endif
+
+#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
+typedef unsigned useconds_t;
+#define __DEFINED_useconds_t
+#endif
+
+
+#ifdef __cplusplus
+#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
+typedef unsigned long pthread_t;
+#define __DEFINED_pthread_t
+#endif
+
+#else
+#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
+typedef struct __pthread * pthread_t;
+#define __DEFINED_pthread_t
+#endif
+
+#endif
+#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t)
+typedef int pthread_once_t;
+#define __DEFINED_pthread_once_t
+#endif
+
+#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t)
+typedef unsigned pthread_key_t;
+#define __DEFINED_pthread_key_t
+#endif
+
+#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t)
+typedef int pthread_spinlock_t;
+#define __DEFINED_pthread_spinlock_t
+#endif
+
+#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t)
+typedef struct { unsigned __attr; } pthread_mutexattr_t;
+#define __DEFINED_pthread_mutexattr_t
+#endif
+
+#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t)
+typedef struct { unsigned __attr; } pthread_condattr_t;
+#define __DEFINED_pthread_condattr_t
+#endif
+
+#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t)
+typedef struct { unsigned __attr; } pthread_barrierattr_t;
+#define __DEFINED_pthread_barrierattr_t
+#endif
+
+#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t)
+typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t;
+#define __DEFINED_pthread_rwlockattr_t
+#endif
+
+
+#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE)
+struct _IO_FILE { char __x; };
+#define __DEFINED_struct__IO_FILE
+#endif
+
+#if defined(__NEED_FILE) && !defined(__DEFINED_FILE)
+typedef struct _IO_FILE FILE;
+#define __DEFINED_FILE
+#endif
+
+
+#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
+typedef __builtin_va_list va_list;
+#define __DEFINED_va_list
+#endif
+
+#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list)
+typedef __builtin_va_list __isoc_va_list;
+#define __DEFINED___isoc_va_list
+#endif
+
+
+#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t)
+typedef struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
+#define __DEFINED_mbstate_t
+#endif
+
+
+#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
+typedef struct __locale_struct * locale_t;
+#define __DEFINED_locale_t
+#endif
+
+
+#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
+typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
+#define __DEFINED_sigset_t
+#endif
+
+
+#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
+struct iovec { void *iov_base; size_t iov_len; };
+#define __DEFINED_struct_iovec
+#endif
+
+
+#if defined(__NEED_struct_winsize) && !defined(__DEFINED_struct_winsize)
+struct winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
+#define __DEFINED_struct_winsize
+#endif
+
+
+#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t)
+typedef unsigned socklen_t;
+#define __DEFINED_socklen_t
+#endif
+
+#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t)
+typedef unsigned short sa_family_t;
+#define __DEFINED_sa_family_t
+#endif
+
+
+#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t)
+typedef struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;
+#define __DEFINED_pthread_attr_t
+#endif
+
+#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t)
+typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t;
+#define __DEFINED_pthread_mutex_t
+#endif
+
+#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t)
+typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t;
+#define __DEFINED_mtx_t
+#endif
+
+#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t)
+typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
+#define __DEFINED_pthread_cond_t
+#endif
+
+#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t)
+typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t;
+#define __DEFINED_cnd_t
+#endif
+
+#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t)
+typedef struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t;
+#define __DEFINED_pthread_rwlock_t
+#endif
+
+#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t)
+typedef struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t;
+#define __DEFINED_pthread_barrier_t
+#endif
+
+
+#undef _Addr
+#undef _Int64
+#undef _Reg
diff --git a/musl-include/aarch64/bits/dirent.h b/musl-include/aarch64/bits/dirent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/dirent.h
@@ -0,0 +1,11 @@
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
+
+struct dirent {
+	ino_t d_ino;
+	off_t d_off;
+	unsigned short d_reclen;
+	unsigned char d_type;
+	char d_name[256];
+};
diff --git a/musl-include/aarch64/bits/errno.h b/musl-include/aarch64/bits/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM            1
+#define ENOENT           2
+#define ESRCH            3
+#define EINTR            4
+#define EIO              5
+#define ENXIO            6
+#define E2BIG            7
+#define ENOEXEC          8
+#define EBADF            9
+#define ECHILD          10
+#define EAGAIN          11
+#define ENOMEM          12
+#define EACCES          13
+#define EFAULT          14
+#define ENOTBLK         15
+#define EBUSY           16
+#define EEXIST          17
+#define EXDEV           18
+#define ENODEV          19
+#define ENOTDIR         20
+#define EISDIR          21
+#define EINVAL          22
+#define ENFILE          23
+#define EMFILE          24
+#define ENOTTY          25
+#define ETXTBSY         26
+#define EFBIG           27
+#define ENOSPC          28
+#define ESPIPE          29
+#define EROFS           30
+#define EMLINK          31
+#define EPIPE           32
+#define EDOM            33
+#define ERANGE          34
+#define EDEADLK         35
+#define ENAMETOOLONG    36
+#define ENOLCK          37
+#define ENOSYS          38
+#define ENOTEMPTY       39
+#define ELOOP           40
+#define EWOULDBLOCK     EAGAIN
+#define ENOMSG          42
+#define EIDRM           43
+#define ECHRNG          44
+#define EL2NSYNC        45
+#define EL3HLT          46
+#define EL3RST          47
+#define ELNRNG          48
+#define EUNATCH         49
+#define ENOCSI          50
+#define EL2HLT          51
+#define EBADE           52
+#define EBADR           53
+#define EXFULL          54
+#define ENOANO          55
+#define EBADRQC         56
+#define EBADSLT         57
+#define EDEADLOCK       EDEADLK
+#define EBFONT          59
+#define ENOSTR          60
+#define ENODATA         61
+#define ETIME           62
+#define ENOSR           63
+#define ENONET          64
+#define ENOPKG          65
+#define EREMOTE         66
+#define ENOLINK         67
+#define EADV            68
+#define ESRMNT          69
+#define ECOMM           70
+#define EPROTO          71
+#define EMULTIHOP       72
+#define EDOTDOT         73
+#define EBADMSG         74
+#define EOVERFLOW       75
+#define ENOTUNIQ        76
+#define EBADFD          77
+#define EREMCHG         78
+#define ELIBACC         79
+#define ELIBBAD         80
+#define ELIBSCN         81
+#define ELIBMAX         82
+#define ELIBEXEC        83
+#define EILSEQ          84
+#define ERESTART        85
+#define ESTRPIPE        86
+#define EUSERS          87
+#define ENOTSOCK        88
+#define EDESTADDRREQ    89
+#define EMSGSIZE        90
+#define EPROTOTYPE      91
+#define ENOPROTOOPT     92
+#define EPROTONOSUPPORT 93
+#define ESOCKTNOSUPPORT 94
+#define EOPNOTSUPP      95
+#define ENOTSUP         EOPNOTSUPP
+#define EPFNOSUPPORT    96
+#define EAFNOSUPPORT    97
+#define EADDRINUSE      98
+#define EADDRNOTAVAIL   99
+#define ENETDOWN        100
+#define ENETUNREACH     101
+#define ENETRESET       102
+#define ECONNABORTED    103
+#define ECONNRESET      104
+#define ENOBUFS         105
+#define EISCONN         106
+#define ENOTCONN        107
+#define ESHUTDOWN       108
+#define ETOOMANYREFS    109
+#define ETIMEDOUT       110
+#define ECONNREFUSED    111
+#define EHOSTDOWN       112
+#define EHOSTUNREACH    113
+#define EALREADY        114
+#define EINPROGRESS     115
+#define ESTALE          116
+#define EUCLEAN         117
+#define ENOTNAM         118
+#define ENAVAIL         119
+#define EISNAM          120
+#define EREMOTEIO       121
+#define EDQUOT          122
+#define ENOMEDIUM       123
+#define EMEDIUMTYPE     124
+#define ECANCELED       125
+#define ENOKEY          126
+#define EKEYEXPIRED     127
+#define EKEYREVOKED     128
+#define EKEYREJECTED    129
+#define EOWNERDEAD      130
+#define ENOTRECOVERABLE 131
+#define ERFKILL         132
+#define EHWPOISON       133
diff --git a/musl-include/aarch64/bits/fcntl.h b/musl-include/aarch64/bits/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/fcntl.h
@@ -0,0 +1,38 @@
+#define O_CREAT        0100
+#define O_EXCL         0200
+#define O_NOCTTY       0400
+#define O_TRUNC       01000
+#define O_APPEND      02000
+#define O_NONBLOCK    04000
+#define O_DSYNC      010000
+#define O_SYNC     04010000
+#define O_RSYNC    04010000
+#define O_DIRECTORY  040000
+#define O_NOFOLLOW  0100000
+#define O_CLOEXEC  02000000
+
+#define O_ASYNC      020000
+#define O_DIRECT    0200000
+#define O_LARGEFILE 0400000
+#define O_NOATIME  01000000
+#define O_PATH    010000000
+#define O_TMPFILE 020040000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD  0
+#define F_GETFD  1
+#define F_SETFD  2
+#define F_GETFL  3
+#define F_SETFL  4
+#define F_GETLK  5
+#define F_SETLK  6
+#define F_SETLKW 7
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/musl-include/aarch64/bits/fenv.h b/musl-include/aarch64/bits/fenv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/fenv.h
@@ -0,0 +1,19 @@
+#define FE_INVALID    1
+#define FE_DIVBYZERO  2
+#define FE_OVERFLOW   4
+#define FE_UNDERFLOW  8
+#define FE_INEXACT    16
+#define FE_ALL_EXCEPT 31
+#define FE_TONEAREST  0
+#define FE_DOWNWARD   0x800000
+#define FE_UPWARD     0x400000
+#define FE_TOWARDZERO 0xc00000
+
+typedef unsigned int fexcept_t;
+
+typedef struct {
+	unsigned int __fpcr;
+	unsigned int __fpsr;
+} fenv_t;
+
+#define FE_DFL_ENV      ((const fenv_t *) -1)
diff --git a/musl-include/aarch64/bits/float.h b/musl-include/aarch64/bits/float.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L
+#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
+#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
+#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
+
+#define LDBL_MANT_DIG 113
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 33
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 36
diff --git a/musl-include/aarch64/bits/hwcap.h b/musl-include/aarch64/bits/hwcap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/hwcap.h
@@ -0,0 +1,52 @@
+#define HWCAP_FP		(1 << 0)
+#define HWCAP_ASIMD		(1 << 1)
+#define HWCAP_EVTSTRM		(1 << 2)
+#define HWCAP_AES		(1 << 3)
+#define HWCAP_PMULL		(1 << 4)
+#define HWCAP_SHA1		(1 << 5)
+#define HWCAP_SHA2		(1 << 6)
+#define HWCAP_CRC32		(1 << 7)
+#define HWCAP_ATOMICS		(1 << 8)
+#define HWCAP_FPHP		(1 << 9)
+#define HWCAP_ASIMDHP		(1 << 10)
+#define HWCAP_CPUID		(1 << 11)
+#define HWCAP_ASIMDRDM		(1 << 12)
+#define HWCAP_JSCVT		(1 << 13)
+#define HWCAP_FCMA		(1 << 14)
+#define HWCAP_LRCPC		(1 << 15)
+#define HWCAP_DCPOP		(1 << 16)
+#define HWCAP_SHA3		(1 << 17)
+#define HWCAP_SM3		(1 << 18)
+#define HWCAP_SM4		(1 << 19)
+#define HWCAP_ASIMDDP		(1 << 20)
+#define HWCAP_SHA512		(1 << 21)
+#define HWCAP_SVE		(1 << 22)
+#define HWCAP_ASIMDFHM		(1 << 23)
+#define HWCAP_DIT		(1 << 24)
+#define HWCAP_USCAT		(1 << 25)
+#define HWCAP_ILRCPC		(1 << 26)
+#define HWCAP_FLAGM		(1 << 27)
+#define HWCAP_SSBS		(1 << 28)
+#define HWCAP_SB		(1 << 29)
+#define HWCAP_PACA		(1 << 30)
+#define HWCAP_PACG		(1UL << 31)
+
+#define HWCAP2_DCPODP		(1 << 0)
+#define HWCAP2_SVE2		(1 << 1)
+#define HWCAP2_SVEAES		(1 << 2)
+#define HWCAP2_SVEPMULL		(1 << 3)
+#define HWCAP2_SVEBITPERM	(1 << 4)
+#define HWCAP2_SVESHA3		(1 << 5)
+#define HWCAP2_SVESM4		(1 << 6)
+#define HWCAP2_FLAGM2		(1 << 7)
+#define HWCAP2_FRINT		(1 << 8)
+#define HWCAP2_SVEI8MM		(1 << 9)
+#define HWCAP2_SVEF32MM		(1 << 10)
+#define HWCAP2_SVEF64MM		(1 << 11)
+#define HWCAP2_SVEBF16		(1 << 12)
+#define HWCAP2_I8MM		(1 << 13)
+#define HWCAP2_BF16		(1 << 14)
+#define HWCAP2_DGH		(1 << 15)
+#define HWCAP2_RNG		(1 << 16)
+#define HWCAP2_BTI		(1 << 17)
+#define HWCAP2_MTE		(1 << 18)
diff --git a/musl-include/aarch64/bits/io.h b/musl-include/aarch64/bits/io.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/io.h
diff --git a/musl-include/aarch64/bits/ioctl.h b/musl-include/aarch64/bits/ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/ioctl.h
@@ -0,0 +1,115 @@
+#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE  0U
+#define _IOC_WRITE 1U
+#define _IOC_READ  2U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define TCGETS		0x5401
+#define TCSETS		0x5402
+#define TCSETSW		0x5403
+#define TCSETSF		0x5404
+#define TCGETA		0x5405
+#define TCSETA		0x5406
+#define TCSETAW		0x5407
+#define TCSETAF		0x5408
+#define TCSBRK		0x5409
+#define TCXONC		0x540A
+#define TCFLSH		0x540B
+#define TIOCEXCL	0x540C
+#define TIOCNXCL	0x540D
+#define TIOCSCTTY	0x540E
+#define TIOCGPGRP	0x540F
+#define TIOCSPGRP	0x5410
+#define TIOCOUTQ	0x5411
+#define TIOCSTI		0x5412
+#define TIOCGWINSZ	0x5413
+#define TIOCSWINSZ	0x5414
+#define TIOCMGET	0x5415
+#define TIOCMBIS	0x5416
+#define TIOCMBIC	0x5417
+#define TIOCMSET	0x5418
+#define TIOCGSOFTCAR	0x5419
+#define TIOCSSOFTCAR	0x541A
+#define FIONREAD	0x541B
+#define TIOCINQ		FIONREAD
+#define TIOCLINUX	0x541C
+#define TIOCCONS	0x541D
+#define TIOCGSERIAL	0x541E
+#define TIOCSSERIAL	0x541F
+#define TIOCPKT		0x5420
+#define FIONBIO		0x5421
+#define TIOCNOTTY	0x5422
+#define TIOCSETD	0x5423
+#define TIOCGETD	0x5424
+#define TCSBRKP		0x5425
+#define TIOCSBRK	0x5427
+#define TIOCCBRK	0x5428
+#define TIOCGSID	0x5429
+#define TIOCGRS485	0x542E
+#define TIOCSRS485	0x542F
+#define TIOCGPTN	0x80045430
+#define TIOCSPTLCK	0x40045431
+#define TIOCGDEV	0x80045432
+#define TCGETX		0x5432
+#define TCSETX		0x5433
+#define TCSETXF		0x5434
+#define TCSETXW		0x5435
+#define TIOCSIG		0x40045436
+#define TIOCVHANGUP	0x5437
+#define TIOCGPKT	0x80045438
+#define TIOCGPTLCK	0x80045439
+#define TIOCGEXCL	0x80045440
+#define TIOCGPTPEER	0x5441
+#define TIOCGISO7816	0x80285442
+#define TIOCSISO7816	0xc0285443
+
+#define FIONCLEX	0x5450
+#define FIOCLEX		0x5451
+#define FIOASYNC	0x5452
+#define TIOCSERCONFIG	0x5453
+#define TIOCSERGWILD	0x5454
+#define TIOCSERSWILD	0x5455
+#define TIOCGLCKTRMIOS	0x5456
+#define TIOCSLCKTRMIOS	0x5457
+#define TIOCSERGSTRUCT	0x5458
+#define TIOCSERGETLSR   0x5459
+#define TIOCSERGETMULTI 0x545A
+#define TIOCSERSETMULTI 0x545B
+
+#define TIOCMIWAIT	0x545C
+#define TIOCGICOUNT	0x545D
+#define FIOQSIZE	0x5460
+
+#define TIOCM_LE        0x001
+#define TIOCM_DTR       0x002
+#define TIOCM_RTS       0x004
+#define TIOCM_ST        0x008
+#define TIOCM_SR        0x010
+#define TIOCM_CTS       0x020
+#define TIOCM_CAR       0x040
+#define TIOCM_RNG       0x080
+#define TIOCM_DSR       0x100
+#define TIOCM_CD        TIOCM_CAR
+#define TIOCM_RI        TIOCM_RNG
+#define TIOCM_OUT1      0x2000
+#define TIOCM_OUT2      0x4000
+#define TIOCM_LOOP      0x8000
+
+#define FIOSETOWN       0x8901
+#define SIOCSPGRP       0x8902
+#define FIOGETOWN       0x8903
+#define SIOCGPGRP       0x8904
+#define SIOCATMARK      0x8905
+#if __LONG_MAX == 0x7fffffff
+#define SIOCGSTAMP      _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS    _IOR(0x89, 7, char[16])
+#else
+#define SIOCGSTAMP      0x8906
+#define SIOCGSTAMPNS    0x8907
+#endif
+
+#include <bits/ioctl_fix.h>
diff --git a/musl-include/aarch64/bits/ioctl_fix.h b/musl-include/aarch64/bits/ioctl_fix.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/ioctl_fix.h
diff --git a/musl-include/aarch64/bits/ipc.h b/musl-include/aarch64/bits/ipc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/ipc.h
@@ -0,0 +1,11 @@
+struct ipc_perm {
+	key_t __ipc_perm_key;
+	uid_t uid;
+	gid_t gid;
+	uid_t cuid;
+	gid_t cgid;
+	mode_t mode;
+	int __ipc_perm_seq;
+	long __pad1;
+	long __pad2;
+};
diff --git a/musl-include/aarch64/bits/ipcstat.h b/musl-include/aarch64/bits/ipcstat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/ipcstat.h
@@ -0,0 +1,1 @@
+#define IPC_STAT 2
diff --git a/musl-include/aarch64/bits/kd.h b/musl-include/aarch64/bits/kd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/kd.h
@@ -0,0 +1,1 @@
+#include <linux/kd.h>
diff --git a/musl-include/aarch64/bits/limits.h b/musl-include/aarch64/bits/limits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/limits.h
diff --git a/musl-include/aarch64/bits/link.h b/musl-include/aarch64/bits/link.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/link.h
@@ -0,0 +1,1 @@
+typedef uint32_t Elf_Symndx;
diff --git a/musl-include/aarch64/bits/mman.h b/musl-include/aarch64/bits/mman.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/mman.h
@@ -0,0 +1,2 @@
+#define PROT_BTI 0x10
+#define PROT_MTE 0x20
diff --git a/musl-include/aarch64/bits/msg.h b/musl-include/aarch64/bits/msg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/msg.h
@@ -0,0 +1,12 @@
+struct msqid_ds {
+	struct ipc_perm msg_perm;
+	time_t msg_stime;
+	time_t msg_rtime;
+	time_t msg_ctime;
+	unsigned long msg_cbytes;
+	msgqnum_t msg_qnum;
+	msglen_t msg_qbytes;
+	pid_t msg_lspid;
+	pid_t msg_lrpid;
+	unsigned long __unused[2];
+};
diff --git a/musl-include/aarch64/bits/poll.h b/musl-include/aarch64/bits/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/poll.h
diff --git a/musl-include/aarch64/bits/posix.h b/musl-include/aarch64/bits/posix.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_LP64_OFF64  1
+#define _POSIX_V7_LP64_OFF64  1
diff --git a/musl-include/aarch64/bits/ptrace.h b/musl-include/aarch64/bits/ptrace.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/ptrace.h
diff --git a/musl-include/aarch64/bits/reg.h b/musl-include/aarch64/bits/reg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/reg.h
@@ -0,0 +1,2 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
diff --git a/musl-include/aarch64/bits/resource.h b/musl-include/aarch64/bits/resource.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/resource.h
diff --git a/musl-include/aarch64/bits/sem.h b/musl-include/aarch64/bits/sem.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/sem.h
@@ -0,0 +1,14 @@
+struct semid_ds {
+	struct ipc_perm sem_perm;
+	time_t sem_otime;
+	time_t sem_ctime;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned short sem_nsems;
+	char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+#else
+	char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+	unsigned short sem_nsems;
+#endif
+	long __unused3;
+	long __unused4;
+};
diff --git a/musl-include/aarch64/bits/setjmp.h b/musl-include/aarch64/bits/setjmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/setjmp.h
@@ -0,0 +1,1 @@
+typedef unsigned long __jmp_buf[22];
diff --git a/musl-include/aarch64/bits/shm.h b/musl-include/aarch64/bits/shm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/shm.h
@@ -0,0 +1,24 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+	struct ipc_perm shm_perm;
+	size_t shm_segsz;
+	time_t shm_atime;
+	time_t shm_dtime;
+	time_t shm_ctime;
+	pid_t shm_cpid;
+	pid_t shm_lpid;
+	unsigned long shm_nattch;
+	unsigned long __pad1;
+	unsigned long __pad2;
+};
+
+struct shminfo {
+	unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+	int __used_ids;
+	unsigned long shm_tot, shm_rss, shm_swp;
+	unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/musl-include/aarch64/bits/signal.h b/musl-include/aarch64/bits/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/signal.h
@@ -0,0 +1,153 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 6144
+#define SIGSTKSZ 12288
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned long greg_t;
+typedef unsigned long gregset_t[34];
+
+typedef struct {
+	__uint128_t vregs[32];
+	unsigned int fpsr;
+	unsigned int fpcr;
+} fpregset_t;
+typedef struct sigcontext {
+	unsigned long fault_address;
+	unsigned long regs[31];
+	unsigned long sp, pc, pstate;
+	long double __reserved[256];
+} mcontext_t;
+
+#define FPSIMD_MAGIC 0x46508001
+#define ESR_MAGIC 0x45535201
+#define EXTRA_MAGIC 0x45585401
+#define SVE_MAGIC 0x53564501
+struct _aarch64_ctx {
+	unsigned int magic;
+	unsigned int size;
+};
+struct fpsimd_context {
+	struct _aarch64_ctx head;
+	unsigned int fpsr;
+	unsigned int fpcr;
+	__uint128_t vregs[32];
+};
+struct esr_context {
+	struct _aarch64_ctx head;
+	unsigned long esr;
+};
+struct extra_context {
+	struct _aarch64_ctx head;
+	unsigned long datap;
+	unsigned int size;
+	unsigned int __reserved[3];
+};
+struct sve_context {
+	struct _aarch64_ctx head;
+	unsigned short vl;
+	unsigned short __reserved[3];
+};
+#define SVE_VQ_BYTES		16
+#define SVE_VQ_MIN		1
+#define SVE_VQ_MAX		512
+#define SVE_VL_MIN		(SVE_VQ_MIN * SVE_VQ_BYTES)
+#define SVE_VL_MAX		(SVE_VQ_MAX * SVE_VQ_BYTES)
+#define SVE_NUM_ZREGS		32
+#define SVE_NUM_PREGS		16
+#define sve_vl_valid(vl) \
+	((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
+#define sve_vq_from_vl(vl)	((vl) / SVE_VQ_BYTES)
+#define sve_vl_from_vq(vq)	((vq) * SVE_VQ_BYTES)
+#define SVE_SIG_ZREG_SIZE(vq)	((unsigned)(vq) * SVE_VQ_BYTES)
+#define SVE_SIG_PREG_SIZE(vq)	((unsigned)(vq) * (SVE_VQ_BYTES / 8))
+#define SVE_SIG_FFR_SIZE(vq)	SVE_SIG_PREG_SIZE(vq)
+#define SVE_SIG_REGS_OFFSET					\
+	((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1))	\
+		/ SVE_VQ_BYTES * SVE_VQ_BYTES)
+#define SVE_SIG_ZREGS_OFFSET	SVE_SIG_REGS_OFFSET
+#define SVE_SIG_ZREG_OFFSET(vq, n) \
+	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
+#define SVE_SIG_ZREGS_SIZE(vq) \
+	(SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
+#define SVE_SIG_PREGS_OFFSET(vq) \
+	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
+#define SVE_SIG_PREG_OFFSET(vq, n) \
+	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
+#define SVE_SIG_PREGS_SIZE(vq) \
+	(SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
+#define SVE_SIG_FFR_OFFSET(vq) \
+	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
+#define SVE_SIG_REGS_SIZE(vq) \
+	(SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
+#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
+#else
+typedef struct {
+	long double __regs[18+256];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+	void *ss_sp;
+	int ss_flags;
+	size_t ss_size;
+};
+
+typedef struct __ucontext {
+	unsigned long uc_flags;
+	struct __ucontext *uc_link;
+	stack_t uc_stack;
+	sigset_t uc_sigmask;
+	mcontext_t uc_mcontext;
+} ucontext_t;
+
+#define SA_NOCLDSTOP  1
+#define SA_NOCLDWAIT  2
+#define SA_SIGINFO    4
+#define SA_ONSTACK    0x08000000
+#define SA_RESTART    0x10000000
+#define SA_NODEFER    0x40000000
+#define SA_RESETHAND  0x80000000
+#define SA_RESTORER   0x04000000
+
+#endif
+
+#define SIGHUP    1
+#define SIGINT    2
+#define SIGQUIT   3
+#define SIGILL    4
+#define SIGTRAP   5
+#define SIGABRT   6
+#define SIGIOT    SIGABRT
+#define SIGBUS    7
+#define SIGFPE    8
+#define SIGKILL   9
+#define SIGUSR1   10
+#define SIGSEGV   11
+#define SIGUSR2   12
+#define SIGPIPE   13
+#define SIGALRM   14
+#define SIGTERM   15
+#define SIGSTKFLT 16
+#define SIGCHLD   17
+#define SIGCONT   18
+#define SIGSTOP   19
+#define SIGTSTP   20
+#define SIGTTIN   21
+#define SIGTTOU   22
+#define SIGURG    23
+#define SIGXCPU   24
+#define SIGXFSZ   25
+#define SIGVTALRM 26
+#define SIGPROF   27
+#define SIGWINCH  28
+#define SIGIO     29
+#define SIGPOLL   29
+#define SIGPWR    30
+#define SIGSYS    31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
diff --git a/musl-include/aarch64/bits/socket.h b/musl-include/aarch64/bits/socket.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/socket.h
diff --git a/musl-include/aarch64/bits/soundcard.h b/musl-include/aarch64/bits/soundcard.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/soundcard.h
@@ -0,0 +1,1 @@
+#include <linux/soundcard.h>
diff --git a/musl-include/aarch64/bits/stat.h b/musl-include/aarch64/bits/stat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/stat.h
@@ -0,0 +1,18 @@
+struct stat {
+	dev_t st_dev;
+	ino_t st_ino;
+	mode_t st_mode;
+	nlink_t st_nlink;
+	uid_t st_uid;
+	gid_t st_gid;
+	dev_t st_rdev;
+	unsigned long __pad;
+	off_t st_size;
+	blksize_t st_blksize;
+	int __pad2;
+	blkcnt_t st_blocks;
+	struct timespec st_atim;
+	struct timespec st_mtim;
+	struct timespec st_ctim;
+	unsigned __unused[2];
+};
diff --git a/musl-include/aarch64/bits/statfs.h b/musl-include/aarch64/bits/statfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/statfs.h
@@ -0,0 +1,7 @@
+struct statfs {
+	unsigned long f_type, f_bsize;
+	fsblkcnt_t f_blocks, f_bfree, f_bavail;
+	fsfilcnt_t f_files, f_ffree;
+	fsid_t f_fsid;
+	unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
+};
diff --git a/musl-include/aarch64/bits/stdint.h b/musl-include/aarch64/bits/stdint.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN  INT32_MIN
+#define INT_FAST32_MIN  INT32_MIN
+
+#define INT_FAST16_MAX  INT32_MAX
+#define INT_FAST32_MAX  INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN      INT64_MIN
+#define INTPTR_MAX      INT64_MAX
+#define UINTPTR_MAX     UINT64_MAX
+#define PTRDIFF_MIN     INT64_MIN
+#define PTRDIFF_MAX     INT64_MAX
+#define SIZE_MAX        UINT64_MAX
diff --git a/musl-include/aarch64/bits/syscall.h b/musl-include/aarch64/bits/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/syscall.h
@@ -0,0 +1,613 @@
+#define __NR_io_setup 0
+#define __NR_io_destroy 1
+#define __NR_io_submit 2
+#define __NR_io_cancel 3
+#define __NR_io_getevents 4
+#define __NR_setxattr 5
+#define __NR_lsetxattr 6
+#define __NR_fsetxattr 7
+#define __NR_getxattr 8
+#define __NR_lgetxattr 9
+#define __NR_fgetxattr 10
+#define __NR_listxattr 11
+#define __NR_llistxattr 12
+#define __NR_flistxattr 13
+#define __NR_removexattr 14
+#define __NR_lremovexattr 15
+#define __NR_fremovexattr 16
+#define __NR_getcwd 17
+#define __NR_lookup_dcookie 18
+#define __NR_eventfd2 19
+#define __NR_epoll_create1 20
+#define __NR_epoll_ctl 21
+#define __NR_epoll_pwait 22
+#define __NR_dup 23
+#define __NR_dup3 24
+#define __NR_fcntl 25
+#define __NR_inotify_init1 26
+#define __NR_inotify_add_watch 27
+#define __NR_inotify_rm_watch 28
+#define __NR_ioctl 29
+#define __NR_ioprio_set 30
+#define __NR_ioprio_get 31
+#define __NR_flock 32
+#define __NR_mknodat 33
+#define __NR_mkdirat 34
+#define __NR_unlinkat 35
+#define __NR_symlinkat 36
+#define __NR_linkat 37
+#define __NR_renameat 38
+#define __NR_umount2 39
+#define __NR_mount 40
+#define __NR_pivot_root 41
+#define __NR_nfsservctl 42
+#define __NR_statfs 43
+#define __NR_fstatfs 44
+#define __NR_truncate 45
+#define __NR_ftruncate 46
+#define __NR_fallocate 47
+#define __NR_faccessat 48
+#define __NR_chdir 49
+#define __NR_fchdir 50
+#define __NR_chroot 51
+#define __NR_fchmod 52
+#define __NR_fchmodat 53
+#define __NR_fchownat 54
+#define __NR_fchown 55
+#define __NR_openat 56
+#define __NR_close 57
+#define __NR_vhangup 58
+#define __NR_pipe2 59
+#define __NR_quotactl 60
+#define __NR_getdents64 61
+#define __NR_lseek 62
+#define __NR_read 63
+#define __NR_write 64
+#define __NR_readv 65
+#define __NR_writev 66
+#define __NR_pread64 67
+#define __NR_pwrite64 68
+#define __NR_preadv 69
+#define __NR_pwritev 70
+#define __NR_sendfile 71
+#define __NR_pselect6 72
+#define __NR_ppoll 73
+#define __NR_signalfd4 74
+#define __NR_vmsplice 75
+#define __NR_splice 76
+#define __NR_tee 77
+#define __NR_readlinkat 78
+#define __NR_newfstatat 79
+#define __NR_fstat 80
+#define __NR_sync 81
+#define __NR_fsync 82
+#define __NR_fdatasync 83
+#define __NR_sync_file_range 84
+#define __NR_timerfd_create 85
+#define __NR_timerfd_settime 86
+#define __NR_timerfd_gettime 87
+#define __NR_utimensat 88
+#define __NR_acct 89
+#define __NR_capget 90
+#define __NR_capset 91
+#define __NR_personality 92
+#define __NR_exit 93
+#define __NR_exit_group 94
+#define __NR_waitid 95
+#define __NR_set_tid_address 96
+#define __NR_unshare 97
+#define __NR_futex 98
+#define __NR_set_robust_list 99
+#define __NR_get_robust_list 100
+#define __NR_nanosleep 101
+#define __NR_getitimer 102
+#define __NR_setitimer 103
+#define __NR_kexec_load 104
+#define __NR_init_module 105
+#define __NR_delete_module 106
+#define __NR_timer_create 107
+#define __NR_timer_gettime 108
+#define __NR_timer_getoverrun 109
+#define __NR_timer_settime 110
+#define __NR_timer_delete 111
+#define __NR_clock_settime 112
+#define __NR_clock_gettime 113
+#define __NR_clock_getres 114
+#define __NR_clock_nanosleep 115
+#define __NR_syslog 116
+#define __NR_ptrace 117
+#define __NR_sched_setparam 118
+#define __NR_sched_setscheduler 119
+#define __NR_sched_getscheduler 120
+#define __NR_sched_getparam 121
+#define __NR_sched_setaffinity 122
+#define __NR_sched_getaffinity 123
+#define __NR_sched_yield 124
+#define __NR_sched_get_priority_max 125
+#define __NR_sched_get_priority_min 126
+#define __NR_sched_rr_get_interval 127
+#define __NR_restart_syscall 128
+#define __NR_kill 129
+#define __NR_tkill 130
+#define __NR_tgkill 131
+#define __NR_sigaltstack 132
+#define __NR_rt_sigsuspend 133
+#define __NR_rt_sigaction 134
+#define __NR_rt_sigprocmask 135
+#define __NR_rt_sigpending 136
+#define __NR_rt_sigtimedwait 137
+#define __NR_rt_sigqueueinfo 138
+#define __NR_rt_sigreturn 139
+#define __NR_setpriority 140
+#define __NR_getpriority 141
+#define __NR_reboot 142
+#define __NR_setregid 143
+#define __NR_setgid 144
+#define __NR_setreuid 145
+#define __NR_setuid 146
+#define __NR_setresuid 147
+#define __NR_getresuid 148
+#define __NR_setresgid 149
+#define __NR_getresgid 150
+#define __NR_setfsuid 151
+#define __NR_setfsgid 152
+#define __NR_times 153
+#define __NR_setpgid 154
+#define __NR_getpgid 155
+#define __NR_getsid 156
+#define __NR_setsid 157
+#define __NR_getgroups 158
+#define __NR_setgroups 159
+#define __NR_uname 160
+#define __NR_sethostname 161
+#define __NR_setdomainname 162
+#define __NR_getrlimit 163
+#define __NR_setrlimit 164
+#define __NR_getrusage 165
+#define __NR_umask 166
+#define __NR_prctl 167
+#define __NR_getcpu 168
+#define __NR_gettimeofday 169
+#define __NR_settimeofday 170
+#define __NR_adjtimex 171
+#define __NR_getpid 172
+#define __NR_getppid 173
+#define __NR_getuid 174
+#define __NR_geteuid 175
+#define __NR_getgid 176
+#define __NR_getegid 177
+#define __NR_gettid 178
+#define __NR_sysinfo 179
+#define __NR_mq_open 180
+#define __NR_mq_unlink 181
+#define __NR_mq_timedsend 182
+#define __NR_mq_timedreceive 183
+#define __NR_mq_notify 184
+#define __NR_mq_getsetattr 185
+#define __NR_msgget 186
+#define __NR_msgctl 187
+#define __NR_msgrcv 188
+#define __NR_msgsnd 189
+#define __NR_semget 190
+#define __NR_semctl 191
+#define __NR_semtimedop 192
+#define __NR_semop 193
+#define __NR_shmget 194
+#define __NR_shmctl 195
+#define __NR_shmat 196
+#define __NR_shmdt 197
+#define __NR_socket 198
+#define __NR_socketpair 199
+#define __NR_bind 200
+#define __NR_listen 201
+#define __NR_accept 202
+#define __NR_connect 203
+#define __NR_getsockname 204
+#define __NR_getpeername 205
+#define __NR_sendto 206
+#define __NR_recvfrom 207
+#define __NR_setsockopt 208
+#define __NR_getsockopt 209
+#define __NR_shutdown 210
+#define __NR_sendmsg 211
+#define __NR_recvmsg 212
+#define __NR_readahead 213
+#define __NR_brk 214
+#define __NR_munmap 215
+#define __NR_mremap 216
+#define __NR_add_key 217
+#define __NR_request_key 218
+#define __NR_keyctl 219
+#define __NR_clone 220
+#define __NR_execve 221
+#define __NR_mmap 222
+#define __NR_fadvise64 223
+#define __NR_swapon 224
+#define __NR_swapoff 225
+#define __NR_mprotect 226
+#define __NR_msync 227
+#define __NR_mlock 228
+#define __NR_munlock 229
+#define __NR_mlockall 230
+#define __NR_munlockall 231
+#define __NR_mincore 232
+#define __NR_madvise 233
+#define __NR_remap_file_pages 234
+#define __NR_mbind 235
+#define __NR_get_mempolicy 236
+#define __NR_set_mempolicy 237
+#define __NR_migrate_pages 238
+#define __NR_move_pages 239
+#define __NR_rt_tgsigqueueinfo 240
+#define __NR_perf_event_open 241
+#define __NR_accept4 242
+#define __NR_recvmmsg 243
+#define __NR_wait4 260
+#define __NR_prlimit64 261
+#define __NR_fanotify_init 262
+#define __NR_fanotify_mark 263
+#define __NR_name_to_handle_at 264
+#define __NR_open_by_handle_at 265
+#define __NR_clock_adjtime 266
+#define __NR_syncfs 267
+#define __NR_setns 268
+#define __NR_sendmmsg 269
+#define __NR_process_vm_readv 270
+#define __NR_process_vm_writev 271
+#define __NR_kcmp 272
+#define __NR_finit_module 273
+#define __NR_sched_setattr 274
+#define __NR_sched_getattr 275
+#define __NR_renameat2 276
+#define __NR_seccomp 277
+#define __NR_getrandom 278
+#define __NR_memfd_create 279
+#define __NR_bpf 280
+#define __NR_execveat 281
+#define __NR_userfaultfd 282
+#define __NR_membarrier 283
+#define __NR_mlock2 284
+#define __NR_copy_file_range 285
+#define __NR_preadv2 286
+#define __NR_pwritev2 287
+#define __NR_pkey_mprotect 288
+#define __NR_pkey_alloc 289
+#define __NR_pkey_free 290
+#define __NR_statx 291
+#define __NR_io_pgetevents 292
+#define __NR_rseq 293
+#define __NR_kexec_file_load 294
+#define __NR_pidfd_send_signal 424
+#define __NR_io_uring_setup 425
+#define __NR_io_uring_enter 426
+#define __NR_io_uring_register 427
+#define __NR_open_tree		428
+#define __NR_move_mount		429
+#define __NR_fsopen		430
+#define __NR_fsconfig		431
+#define __NR_fsmount		432
+#define __NR_fspick		433
+#define __NR_pidfd_open		434
+#define __NR_clone3		435
+#define __NR_close_range	436
+#define __NR_openat2		437
+#define __NR_pidfd_getfd	438
+#define __NR_faccessat2		439
+#define __NR_process_madvise	440
+#define __NR_epoll_pwait2	441
+#define __NR_mount_setattr	442
+#define __NR_landlock_create_ruleset	444
+#define __NR_landlock_add_rule	445
+#define __NR_landlock_restrict_self	446
+#define __NR_process_mrelease	448
+#define __NR_futex_waitv	449
+#define __NR_set_mempolicy_home_node	450
+#define __NR_cachestat		451
+#define __NR_fchmodat2		452
+
+#define SYS_io_setup 0
+#define SYS_io_destroy 1
+#define SYS_io_submit 2
+#define SYS_io_cancel 3
+#define SYS_io_getevents 4
+#define SYS_setxattr 5
+#define SYS_lsetxattr 6
+#define SYS_fsetxattr 7
+#define SYS_getxattr 8
+#define SYS_lgetxattr 9
+#define SYS_fgetxattr 10
+#define SYS_listxattr 11
+#define SYS_llistxattr 12
+#define SYS_flistxattr 13
+#define SYS_removexattr 14
+#define SYS_lremovexattr 15
+#define SYS_fremovexattr 16
+#define SYS_getcwd 17
+#define SYS_lookup_dcookie 18
+#define SYS_eventfd2 19
+#define SYS_epoll_create1 20
+#define SYS_epoll_ctl 21
+#define SYS_epoll_pwait 22
+#define SYS_dup 23
+#define SYS_dup3 24
+#define SYS_fcntl 25
+#define SYS_inotify_init1 26
+#define SYS_inotify_add_watch 27
+#define SYS_inotify_rm_watch 28
+#define SYS_ioctl 29
+#define SYS_ioprio_set 30
+#define SYS_ioprio_get 31
+#define SYS_flock 32
+#define SYS_mknodat 33
+#define SYS_mkdirat 34
+#define SYS_unlinkat 35
+#define SYS_symlinkat 36
+#define SYS_linkat 37
+#define SYS_renameat 38
+#define SYS_umount2 39
+#define SYS_mount 40
+#define SYS_pivot_root 41
+#define SYS_nfsservctl 42
+#define SYS_statfs 43
+#define SYS_fstatfs 44
+#define SYS_truncate 45
+#define SYS_ftruncate 46
+#define SYS_fallocate 47
+#define SYS_faccessat 48
+#define SYS_chdir 49
+#define SYS_fchdir 50
+#define SYS_chroot 51
+#define SYS_fchmod 52
+#define SYS_fchmodat 53
+#define SYS_fchownat 54
+#define SYS_fchown 55
+#define SYS_openat 56
+#define SYS_close 57
+#define SYS_vhangup 58
+#define SYS_pipe2 59
+#define SYS_quotactl 60
+#define SYS_getdents64 61
+#define SYS_lseek 62
+#define SYS_read 63
+#define SYS_write 64
+#define SYS_readv 65
+#define SYS_writev 66
+#define SYS_pread64 67
+#define SYS_pwrite64 68
+#define SYS_preadv 69
+#define SYS_pwritev 70
+#define SYS_sendfile 71
+#define SYS_pselect6 72
+#define SYS_ppoll 73
+#define SYS_signalfd4 74
+#define SYS_vmsplice 75
+#define SYS_splice 76
+#define SYS_tee 77
+#define SYS_readlinkat 78
+#define SYS_newfstatat 79
+#define SYS_fstat 80
+#define SYS_sync 81
+#define SYS_fsync 82
+#define SYS_fdatasync 83
+#define SYS_sync_file_range 84
+#define SYS_timerfd_create 85
+#define SYS_timerfd_settime 86
+#define SYS_timerfd_gettime 87
+#define SYS_utimensat 88
+#define SYS_acct 89
+#define SYS_capget 90
+#define SYS_capset 91
+#define SYS_personality 92
+#define SYS_exit 93
+#define SYS_exit_group 94
+#define SYS_waitid 95
+#define SYS_set_tid_address 96
+#define SYS_unshare 97
+#define SYS_futex 98
+#define SYS_set_robust_list 99
+#define SYS_get_robust_list 100
+#define SYS_nanosleep 101
+#define SYS_getitimer 102
+#define SYS_setitimer 103
+#define SYS_kexec_load 104
+#define SYS_init_module 105
+#define SYS_delete_module 106
+#define SYS_timer_create 107
+#define SYS_timer_gettime 108
+#define SYS_timer_getoverrun 109
+#define SYS_timer_settime 110
+#define SYS_timer_delete 111
+#define SYS_clock_settime 112
+#define SYS_clock_gettime 113
+#define SYS_clock_getres 114
+#define SYS_clock_nanosleep 115
+#define SYS_syslog 116
+#define SYS_ptrace 117
+#define SYS_sched_setparam 118
+#define SYS_sched_setscheduler 119
+#define SYS_sched_getscheduler 120
+#define SYS_sched_getparam 121
+#define SYS_sched_setaffinity 122
+#define SYS_sched_getaffinity 123
+#define SYS_sched_yield 124
+#define SYS_sched_get_priority_max 125
+#define SYS_sched_get_priority_min 126
+#define SYS_sched_rr_get_interval 127
+#define SYS_restart_syscall 128
+#define SYS_kill 129
+#define SYS_tkill 130
+#define SYS_tgkill 131
+#define SYS_sigaltstack 132
+#define SYS_rt_sigsuspend 133
+#define SYS_rt_sigaction 134
+#define SYS_rt_sigprocmask 135
+#define SYS_rt_sigpending 136
+#define SYS_rt_sigtimedwait 137
+#define SYS_rt_sigqueueinfo 138
+#define SYS_rt_sigreturn 139
+#define SYS_setpriority 140
+#define SYS_getpriority 141
+#define SYS_reboot 142
+#define SYS_setregid 143
+#define SYS_setgid 144
+#define SYS_setreuid 145
+#define SYS_setuid 146
+#define SYS_setresuid 147
+#define SYS_getresuid 148
+#define SYS_setresgid 149
+#define SYS_getresgid 150
+#define SYS_setfsuid 151
+#define SYS_setfsgid 152
+#define SYS_times 153
+#define SYS_setpgid 154
+#define SYS_getpgid 155
+#define SYS_getsid 156
+#define SYS_setsid 157
+#define SYS_getgroups 158
+#define SYS_setgroups 159
+#define SYS_uname 160
+#define SYS_sethostname 161
+#define SYS_setdomainname 162
+#define SYS_getrlimit 163
+#define SYS_setrlimit 164
+#define SYS_getrusage 165
+#define SYS_umask 166
+#define SYS_prctl 167
+#define SYS_getcpu 168
+#define SYS_gettimeofday 169
+#define SYS_settimeofday 170
+#define SYS_adjtimex 171
+#define SYS_getpid 172
+#define SYS_getppid 173
+#define SYS_getuid 174
+#define SYS_geteuid 175
+#define SYS_getgid 176
+#define SYS_getegid 177
+#define SYS_gettid 178
+#define SYS_sysinfo 179
+#define SYS_mq_open 180
+#define SYS_mq_unlink 181
+#define SYS_mq_timedsend 182
+#define SYS_mq_timedreceive 183
+#define SYS_mq_notify 184
+#define SYS_mq_getsetattr 185
+#define SYS_msgget 186
+#define SYS_msgctl 187
+#define SYS_msgrcv 188
+#define SYS_msgsnd 189
+#define SYS_semget 190
+#define SYS_semctl 191
+#define SYS_semtimedop 192
+#define SYS_semop 193
+#define SYS_shmget 194
+#define SYS_shmctl 195
+#define SYS_shmat 196
+#define SYS_shmdt 197
+#define SYS_socket 198
+#define SYS_socketpair 199
+#define SYS_bind 200
+#define SYS_listen 201
+#define SYS_accept 202
+#define SYS_connect 203
+#define SYS_getsockname 204
+#define SYS_getpeername 205
+#define SYS_sendto 206
+#define SYS_recvfrom 207
+#define SYS_setsockopt 208
+#define SYS_getsockopt 209
+#define SYS_shutdown 210
+#define SYS_sendmsg 211
+#define SYS_recvmsg 212
+#define SYS_readahead 213
+#define SYS_brk 214
+#define SYS_munmap 215
+#define SYS_mremap 216
+#define SYS_add_key 217
+#define SYS_request_key 218
+#define SYS_keyctl 219
+#define SYS_clone 220
+#define SYS_execve 221
+#define SYS_mmap 222
+#define SYS_fadvise64 223
+#define SYS_swapon 224
+#define SYS_swapoff 225
+#define SYS_mprotect 226
+#define SYS_msync 227
+#define SYS_mlock 228
+#define SYS_munlock 229
+#define SYS_mlockall 230
+#define SYS_munlockall 231
+#define SYS_mincore 232
+#define SYS_madvise 233
+#define SYS_remap_file_pages 234
+#define SYS_mbind 235
+#define SYS_get_mempolicy 236
+#define SYS_set_mempolicy 237
+#define SYS_migrate_pages 238
+#define SYS_move_pages 239
+#define SYS_rt_tgsigqueueinfo 240
+#define SYS_perf_event_open 241
+#define SYS_accept4 242
+#define SYS_recvmmsg 243
+#define SYS_wait4 260
+#define SYS_prlimit64 261
+#define SYS_fanotify_init 262
+#define SYS_fanotify_mark 263
+#define SYS_name_to_handle_at 264
+#define SYS_open_by_handle_at 265
+#define SYS_clock_adjtime 266
+#define SYS_syncfs 267
+#define SYS_setns 268
+#define SYS_sendmmsg 269
+#define SYS_process_vm_readv 270
+#define SYS_process_vm_writev 271
+#define SYS_kcmp 272
+#define SYS_finit_module 273
+#define SYS_sched_setattr 274
+#define SYS_sched_getattr 275
+#define SYS_renameat2 276
+#define SYS_seccomp 277
+#define SYS_getrandom 278
+#define SYS_memfd_create 279
+#define SYS_bpf 280
+#define SYS_execveat 281
+#define SYS_userfaultfd 282
+#define SYS_membarrier 283
+#define SYS_mlock2 284
+#define SYS_copy_file_range 285
+#define SYS_preadv2 286
+#define SYS_pwritev2 287
+#define SYS_pkey_mprotect 288
+#define SYS_pkey_alloc 289
+#define SYS_pkey_free 290
+#define SYS_statx 291
+#define SYS_io_pgetevents 292
+#define SYS_rseq 293
+#define SYS_kexec_file_load 294
+#define SYS_pidfd_send_signal 424
+#define SYS_io_uring_setup 425
+#define SYS_io_uring_enter 426
+#define SYS_io_uring_register 427
+#define SYS_open_tree		428
+#define SYS_move_mount		429
+#define SYS_fsopen		430
+#define SYS_fsconfig		431
+#define SYS_fsmount		432
+#define SYS_fspick		433
+#define SYS_pidfd_open		434
+#define SYS_clone3		435
+#define SYS_close_range	436
+#define SYS_openat2		437
+#define SYS_pidfd_getfd	438
+#define SYS_faccessat2		439
+#define SYS_process_madvise	440
+#define SYS_epoll_pwait2	441
+#define SYS_mount_setattr	442
+#define SYS_landlock_create_ruleset	444
+#define SYS_landlock_add_rule	445
+#define SYS_landlock_restrict_self	446
+#define SYS_process_mrelease	448
+#define SYS_futex_waitv	449
+#define SYS_set_mempolicy_home_node	450
+#define SYS_cachestat		451
+#define SYS_fchmodat2		452
diff --git a/musl-include/aarch64/bits/termios.h b/musl-include/aarch64/bits/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/termios.h
@@ -0,0 +1,166 @@
+struct termios {
+	tcflag_t c_iflag;
+	tcflag_t c_oflag;
+	tcflag_t c_cflag;
+	tcflag_t c_lflag;
+	cc_t c_line;
+	cc_t c_cc[NCCS];
+	speed_t __c_ispeed;
+	speed_t __c_ospeed;
+};
+
+#define VINTR     0
+#define VQUIT     1
+#define VERASE    2
+#define VKILL     3
+#define VEOF      4
+#define VTIME     5
+#define VMIN      6
+#define VSWTC     7
+#define VSTART    8
+#define VSTOP     9
+#define VSUSP    10
+#define VEOL     11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE  14
+#define VLNEXT   15
+#define VEOL2    16
+
+#define IGNBRK  0000001
+#define BRKINT  0000002
+#define IGNPAR  0000004
+#define PARMRK  0000010
+#define INPCK   0000020
+#define ISTRIP  0000040
+#define INLCR   0000100
+#define IGNCR   0000200
+#define ICRNL   0000400
+#define IUCLC   0001000
+#define IXON    0002000
+#define IXANY   0004000
+#define IXOFF   0010000
+#define IMAXBEL 0020000
+#define IUTF8   0040000
+
+#define OPOST  0000001
+#define OLCUC  0000002
+#define ONLCR  0000004
+#define OCRNL  0000010
+#define ONOCR  0000020
+#define ONLRET 0000040
+#define OFILL  0000100
+#define OFDEL  0000200
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY  0000400
+#define NL0    0000000
+#define NL1    0000400
+#define CRDLY  0003000
+#define CR0    0000000
+#define CR1    0001000
+#define CR2    0002000
+#define CR3    0003000
+#define TABDLY 0014000
+#define TAB0   0000000
+#define TAB1   0004000
+#define TAB2   0010000
+#define TAB3   0014000
+#define BSDLY  0020000
+#define BS0    0000000
+#define BS1    0020000
+#define FFDLY  0100000
+#define FF0    0000000
+#define FF1    0100000
+#endif
+
+#define VTDLY  0040000
+#define VT0    0000000
+#define VT1    0040000
+
+#define B0       0000000
+#define B50      0000001
+#define B75      0000002
+#define B110     0000003
+#define B134     0000004
+#define B150     0000005
+#define B200     0000006
+#define B300     0000007
+#define B600     0000010
+#define B1200    0000011
+#define B1800    0000012
+#define B2400    0000013
+#define B4800    0000014
+#define B9600    0000015
+#define B19200   0000016
+#define B38400   0000017
+
+#define B57600   0010001
+#define B115200  0010002
+#define B230400  0010003
+#define B460800  0010004
+#define B500000  0010005
+#define B576000  0010006
+#define B921600  0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+
+#define CSIZE  0000060
+#define CS5    0000000
+#define CS6    0000020
+#define CS7    0000040
+#define CS8    0000060
+#define CSTOPB 0000100
+#define CREAD  0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL  0002000
+#define CLOCAL 0004000
+
+#define ISIG   0000001
+#define ICANON 0000002
+#define ECHO   0000010
+#define ECHOE  0000020
+#define ECHOK  0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#define IEXTEN 0100000
+
+#define TCOOFF 0
+#define TCOON  1
+#define TCIOFF 2
+#define TCION  3
+
+#define TCIFLUSH  0
+#define TCOFLUSH  1
+#define TCIOFLUSH 2
+
+#define TCSANOW   0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA    0000016
+#define EXTB    0000017
+#define CBAUD   0010017
+#define CBAUDEX 0010000
+#define CIBAUD  002003600000
+#define CMSPAR  010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE   0000004
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE  0004000
+#define FLUSHO  0010000
+#define PENDIN  0040000
+#define EXTPROC 0200000
+
+#define XTABS  0014000
+#endif
diff --git a/musl-include/aarch64/bits/user.h b/musl-include/aarch64/bits/user.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/user.h
@@ -0,0 +1,16 @@
+struct user_regs_struct {
+	unsigned long long regs[31];
+	unsigned long long sp;
+	unsigned long long pc;
+	unsigned long long pstate;
+};
+
+struct user_fpsimd_struct {
+	__uint128_t vregs[32];
+	unsigned int fpsr;
+	unsigned int fpcr;
+};
+
+#define ELF_NREG 34
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NREG];
+typedef struct user_fpsimd_struct elf_fpregset_t;
diff --git a/musl-include/aarch64/bits/vt.h b/musl-include/aarch64/bits/vt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/bits/vt.h
@@ -0,0 +1,1 @@
+#include <linux/vt.h>
diff --git a/musl-include/aarch64/byteswap.h b/musl-include/aarch64/byteswap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/byteswap.h
@@ -0,0 +1,26 @@
+#ifndef _BYTESWAP_H
+#define _BYTESWAP_H
+
+#include <features.h>
+#include <stdint.h>
+
+static __inline uint16_t __bswap_16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap_32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap_64(uint64_t __x)
+{
+	return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
+}
+
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
+
+#endif
diff --git a/musl-include/aarch64/complex.h b/musl-include/aarch64/complex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/complex.h
@@ -0,0 +1,133 @@
+#ifndef _COMPLEX_H
+#define _COMPLEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define complex _Complex
+#ifdef __GNUC__
+#define _Complex_I (__extension__ (0.0f+1.0fi))
+#else
+#define _Complex_I (0.0f+1.0fi)
+#endif
+#define I _Complex_I
+
+double complex cacos(double complex);
+float complex cacosf(float complex);
+long double complex cacosl(long double complex);
+
+double complex casin(double complex);
+float complex casinf(float complex);
+long double complex casinl(long double complex);
+
+double complex catan(double complex);
+float complex catanf(float complex);
+long double complex catanl(long double complex);
+
+double complex ccos(double complex);
+float complex ccosf(float complex);
+long double complex ccosl(long double complex);
+
+double complex csin(double complex);
+float complex csinf(float complex);
+long double complex csinl(long double complex);
+
+double complex ctan(double complex);
+float complex ctanf(float complex);
+long double complex ctanl(long double complex);
+
+double complex cacosh(double complex);
+float complex cacoshf(float complex);
+long double complex cacoshl(long double complex);
+
+double complex casinh(double complex);
+float complex casinhf(float complex);
+long double complex casinhl(long double complex);
+
+double complex catanh(double complex);
+float complex catanhf(float complex);
+long double complex catanhl(long double complex);
+
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+long double complex ccoshl(long double complex);
+
+double complex csinh(double complex);
+float complex csinhf(float complex);
+long double complex csinhl(long double complex);
+
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+long double complex ctanhl(long double complex);
+
+double complex cexp(double complex);
+float complex cexpf(float complex);
+long double complex cexpl(long double complex);
+
+double complex clog(double complex);
+float complex clogf(float complex);
+long double complex clogl(long double complex);
+
+double cabs(double complex);
+float cabsf(float complex);
+long double cabsl(long double complex);
+
+double complex cpow(double complex, double complex);
+float complex cpowf(float complex, float complex);
+long double complex cpowl(long double complex, long double complex);
+
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
+long double complex csqrtl(long double complex);
+
+double carg(double complex);
+float cargf(float complex);
+long double cargl(long double complex);
+
+double cimag(double complex);
+float cimagf(float complex);
+long double cimagl(long double complex);
+
+double complex conj(double complex);
+float complex conjf(float complex);
+long double complex conjl(long double complex);
+
+double complex cproj(double complex);
+float complex cprojf(float complex);
+long double complex cprojl(long double complex);
+
+double creal(double complex);
+float crealf(float complex);
+long double creall(long double complex);
+
+#ifndef __cplusplus
+#define __CIMAG(x, t) \
+	(+(union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1])
+
+#define creal(x) ((double)(x))
+#define crealf(x) ((float)(x))
+#define creall(x) ((long double)(x))
+
+#define cimag(x) __CIMAG(x, double)
+#define cimagf(x) __CIMAG(x, float)
+#define cimagl(x) __CIMAG(x, long double)
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#if defined(_Imaginary_I)
+#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I*(t)(y))
+#elif defined(__clang__)
+#define __CMPLX(x, y, t) (+(_Complex t){ (t)(x), (t)(y) })
+#else
+#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y)))
+#endif
+#define CMPLX(x, y) __CMPLX(x, y, double)
+#define CMPLXF(x, y) __CMPLX(x, y, float)
+#define CMPLXL(x, y) __CMPLX(x, y, long double)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/cpio.h b/musl-include/aarch64/cpio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/cpio.h
@@ -0,0 +1,29 @@
+#ifndef _CPIO_H
+#define _CPIO_H
+
+#define MAGIC "070707"
+
+#define C_IRUSR  000400
+#define C_IWUSR  000200
+#define C_IXUSR  000100
+#define C_IRGRP  000040
+#define C_IWGRP  000020
+#define C_IXGRP  000010
+#define C_IROTH  000004
+#define C_IWOTH  000002
+#define C_IXOTH  000001
+
+#define C_ISUID  004000
+#define C_ISGID  002000
+#define C_ISVTX  001000
+
+#define C_ISBLK  060000
+#define C_ISCHR  020000
+#define C_ISDIR  040000
+#define C_ISFIFO 010000
+#define C_ISSOCK 0140000
+#define C_ISLNK  0120000
+#define C_ISCTG  0110000
+#define C_ISREG  0100000
+
+#endif
diff --git a/musl-include/aarch64/crypt.h b/musl-include/aarch64/crypt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/crypt.h
@@ -0,0 +1,20 @@
+#ifndef _CRYPT_H
+#define _CRYPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct crypt_data {
+	int initialized;
+	char __buf[256];
+};
+
+char *crypt(const char *, const char *);
+char *crypt_r(const char *, const char *, struct crypt_data *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/ctype.h b/musl-include/aarch64/ctype.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/ctype.h
@@ -0,0 +1,77 @@
+#ifndef	_CTYPE_H
+#define	_CTYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+int   isalnum(int);
+int   isalpha(int);
+int   isblank(int);
+int   iscntrl(int);
+int   isdigit(int);
+int   isgraph(int);
+int   islower(int);
+int   isprint(int);
+int   ispunct(int);
+int   isspace(int);
+int   isupper(int);
+int   isxdigit(int);
+int   tolower(int);
+int   toupper(int);
+
+#ifndef __cplusplus
+static __inline int __isspace(int _c)
+{
+	return _c == ' ' || (unsigned)_c-'\t' < 5;
+}
+
+#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a)|32)-'a') < 26)
+#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a)-'0') < 10)
+#define islower(a) (0 ? islower(a) : ((unsigned)(a)-'a') < 26)
+#define isupper(a) (0 ? isupper(a) : ((unsigned)(a)-'A') < 26)
+#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f)
+#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e)
+#define isspace(a) __isspace(a)
+#endif
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define __NEED_locale_t
+#include <bits/alltypes.h>
+
+int   isalnum_l(int, locale_t);
+int   isalpha_l(int, locale_t);
+int   isblank_l(int, locale_t);
+int   iscntrl_l(int, locale_t);
+int   isdigit_l(int, locale_t);
+int   isgraph_l(int, locale_t);
+int   islower_l(int, locale_t);
+int   isprint_l(int, locale_t);
+int   ispunct_l(int, locale_t);
+int   isspace_l(int, locale_t);
+int   isupper_l(int, locale_t);
+int   isxdigit_l(int, locale_t);
+int   tolower_l(int, locale_t);
+int   toupper_l(int, locale_t);
+
+int   isascii(int);
+int   toascii(int);
+#define _tolower(a) ((a)|0x20)
+#define _toupper(a) ((a)&0x5f)
+#ifndef __cplusplus
+#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128)
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/dirent.h b/musl-include/aarch64/dirent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/dirent.h
@@ -0,0 +1,75 @@
+#ifndef	_DIRENT_H
+#define	_DIRENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ino_t
+#define __NEED_off_t
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/dirent.h>
+
+typedef struct __dirstream DIR;
+
+#define d_fileno d_ino
+
+int            closedir(DIR *);
+DIR           *fdopendir(int);
+DIR           *opendir(const char *);
+struct dirent *readdir(DIR *);
+int            readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict);
+void           rewinddir(DIR *);
+int            dirfd(DIR *);
+
+int alphasort(const struct dirent **, const struct dirent **);
+int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void           seekdir(DIR *, long);
+long           telldir(DIR *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+#define IFTODT(x) ((x)>>12 & 017)
+#define DTTOIF(x) ((x)<<12)
+int getdents(int, struct dirent *, size_t);
+#endif
+
+#ifdef _GNU_SOURCE
+int versionsort(const struct dirent **, const struct dirent **);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define dirent64 dirent
+#define readdir64 readdir
+#define readdir64_r readdir_r
+#define scandir64 scandir
+#define alphasort64 alphasort
+#define versionsort64 versionsort
+#define off64_t off_t
+#define ino64_t ino_t
+#define getdents64 getdents
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/dlfcn.h b/musl-include/aarch64/dlfcn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/dlfcn.h
@@ -0,0 +1,46 @@
+#ifndef	_DLFCN_H
+#define	_DLFCN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define RTLD_LAZY   1
+#define RTLD_NOW    2
+#define RTLD_NOLOAD 4
+#define RTLD_NODELETE 4096
+#define RTLD_GLOBAL 256
+#define RTLD_LOCAL  0
+
+#define RTLD_NEXT    ((void *)-1)
+#define RTLD_DEFAULT ((void *)0)
+
+#define RTLD_DI_LINKMAP 2
+
+int    dlclose(void *);
+char  *dlerror(void);
+void  *dlopen(const char *, int);
+void  *dlsym(void *__restrict, const char *__restrict);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef struct {
+	const char *dli_fname;
+	void *dli_fbase;
+	const char *dli_sname;
+	void *dli_saddr;
+} Dl_info;
+int dladdr(const void *, Dl_info *);
+int dlinfo(void *, int, void *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(dlsym, __dlsym_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/elf.h b/musl-include/aarch64/elf.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/elf.h
@@ -0,0 +1,3414 @@
+#ifndef _ELF_H
+#define _ELF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+typedef uint16_t Elf32_Half;
+typedef uint16_t Elf64_Half;
+
+typedef uint32_t Elf32_Word;
+typedef	int32_t  Elf32_Sword;
+typedef uint32_t Elf64_Word;
+typedef	int32_t  Elf64_Sword;
+
+typedef uint64_t Elf32_Xword;
+typedef	int64_t  Elf32_Sxword;
+typedef uint64_t Elf64_Xword;
+typedef	int64_t  Elf64_Sxword;
+
+typedef uint32_t Elf32_Addr;
+typedef uint64_t Elf64_Addr;
+
+typedef uint32_t Elf32_Off;
+typedef uint64_t Elf64_Off;
+
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+
+typedef Elf32_Half Elf32_Versym;
+typedef Elf64_Half Elf64_Versym;
+
+#define EI_NIDENT (16)
+
+typedef struct {
+  unsigned char	e_ident[EI_NIDENT];
+  Elf32_Half	e_type;
+  Elf32_Half	e_machine;
+  Elf32_Word	e_version;
+  Elf32_Addr	e_entry;
+  Elf32_Off	e_phoff;
+  Elf32_Off	e_shoff;
+  Elf32_Word	e_flags;
+  Elf32_Half	e_ehsize;
+  Elf32_Half	e_phentsize;
+  Elf32_Half	e_phnum;
+  Elf32_Half	e_shentsize;
+  Elf32_Half	e_shnum;
+  Elf32_Half	e_shstrndx;
+} Elf32_Ehdr;
+
+typedef struct {
+  unsigned char	e_ident[EI_NIDENT];
+  Elf64_Half	e_type;
+  Elf64_Half	e_machine;
+  Elf64_Word	e_version;
+  Elf64_Addr	e_entry;
+  Elf64_Off	e_phoff;
+  Elf64_Off	e_shoff;
+  Elf64_Word	e_flags;
+  Elf64_Half	e_ehsize;
+  Elf64_Half	e_phentsize;
+  Elf64_Half	e_phnum;
+  Elf64_Half	e_shentsize;
+  Elf64_Half	e_shnum;
+  Elf64_Half	e_shstrndx;
+} Elf64_Ehdr;
+
+#define EI_MAG0		0
+#define ELFMAG0		0x7f
+
+#define EI_MAG1		1
+#define ELFMAG1		'E'
+
+#define EI_MAG2		2
+#define ELFMAG2		'L'
+
+#define EI_MAG3		3
+#define ELFMAG3		'F'
+
+
+#define	ELFMAG		"\177ELF"
+#define	SELFMAG		4
+
+#define EI_CLASS	4
+#define ELFCLASSNONE	0
+#define ELFCLASS32	1
+#define ELFCLASS64	2
+#define ELFCLASSNUM	3
+
+#define EI_DATA		5
+#define ELFDATANONE	0
+#define ELFDATA2LSB	1
+#define ELFDATA2MSB	2
+#define ELFDATANUM	3
+
+#define EI_VERSION	6
+
+
+#define EI_OSABI	7
+#define ELFOSABI_NONE		0
+#define ELFOSABI_SYSV		0
+#define ELFOSABI_HPUX		1
+#define ELFOSABI_NETBSD		2
+#define ELFOSABI_LINUX		3
+#define ELFOSABI_GNU		3
+#define ELFOSABI_SOLARIS	6
+#define ELFOSABI_AIX		7
+#define ELFOSABI_IRIX		8
+#define ELFOSABI_FREEBSD	9
+#define ELFOSABI_TRU64		10
+#define ELFOSABI_MODESTO	11
+#define ELFOSABI_OPENBSD	12
+#define ELFOSABI_ARM		97
+#define ELFOSABI_STANDALONE	255
+
+#define EI_ABIVERSION	8
+
+#define EI_PAD		9
+
+
+
+#define ET_NONE		0
+#define ET_REL		1
+#define ET_EXEC		2
+#define ET_DYN		3
+#define ET_CORE		4
+#define	ET_NUM		5
+#define ET_LOOS		0xfe00
+#define ET_HIOS		0xfeff
+#define ET_LOPROC	0xff00
+#define ET_HIPROC	0xffff
+
+
+
+#define EM_NONE		 0
+#define EM_M32		 1
+#define EM_SPARC	 2
+#define EM_386		 3
+#define EM_68K		 4
+#define EM_88K		 5
+#define EM_860		 7
+#define EM_MIPS		 8
+#define EM_S370		 9
+#define EM_MIPS_RS3_LE	10
+
+#define EM_PARISC	15
+#define EM_VPP500	17
+#define EM_SPARC32PLUS	18
+#define EM_960		19
+#define EM_PPC		20
+#define EM_PPC64	21
+#define EM_S390		22
+
+#define EM_V800		36
+#define EM_FR20		37
+#define EM_RH32		38
+#define EM_RCE		39
+#define EM_ARM		40
+#define EM_FAKE_ALPHA	41
+#define EM_SH		42
+#define EM_SPARCV9	43
+#define EM_TRICORE	44
+#define EM_ARC		45
+#define EM_H8_300	46
+#define EM_H8_300H	47
+#define EM_H8S		48
+#define EM_H8_500	49
+#define EM_IA_64	50
+#define EM_MIPS_X	51
+#define EM_COLDFIRE	52
+#define EM_68HC12	53
+#define EM_MMA		54
+#define EM_PCP		55
+#define EM_NCPU		56
+#define EM_NDR1		57
+#define EM_STARCORE	58
+#define EM_ME16		59
+#define EM_ST100	60
+#define EM_TINYJ	61
+#define EM_X86_64	62
+#define EM_PDSP		63
+
+#define EM_FX66		66
+#define EM_ST9PLUS	67
+#define EM_ST7		68
+#define EM_68HC16	69
+#define EM_68HC11	70
+#define EM_68HC08	71
+#define EM_68HC05	72
+#define EM_SVX		73
+#define EM_ST19		74
+#define EM_VAX		75
+#define EM_CRIS		76
+#define EM_JAVELIN	77
+#define EM_FIREPATH	78
+#define EM_ZSP		79
+#define EM_MMIX		80
+#define EM_HUANY	81
+#define EM_PRISM	82
+#define EM_AVR		83
+#define EM_FR30		84
+#define EM_D10V		85
+#define EM_D30V		86
+#define EM_V850		87
+#define EM_M32R		88
+#define EM_MN10300	89
+#define EM_MN10200	90
+#define EM_PJ		91
+#define EM_OR1K		92
+#define EM_OPENRISC	92
+#define EM_ARC_A5	93
+#define EM_ARC_COMPACT	93
+#define EM_XTENSA	94
+#define EM_VIDEOCORE	95
+#define EM_TMM_GPP	96
+#define EM_NS32K	97
+#define EM_TPC		98
+#define EM_SNP1K	99
+#define EM_ST200	100
+#define EM_IP2K		101
+#define EM_MAX		102
+#define EM_CR		103
+#define EM_F2MC16	104
+#define EM_MSP430	105
+#define EM_BLACKFIN	106
+#define EM_SE_C33	107
+#define EM_SEP		108
+#define EM_ARCA		109
+#define EM_UNICORE	110
+#define EM_EXCESS	111
+#define EM_DXP		112
+#define EM_ALTERA_NIOS2 113
+#define EM_CRX		114
+#define EM_XGATE	115
+#define EM_C166		116
+#define EM_M16C		117
+#define EM_DSPIC30F	118
+#define EM_CE		119
+#define EM_M32C		120
+#define EM_TSK3000	131
+#define EM_RS08		132
+#define EM_SHARC	133
+#define EM_ECOG2	134
+#define EM_SCORE7	135
+#define EM_DSP24	136
+#define EM_VIDEOCORE3	137
+#define EM_LATTICEMICO32 138
+#define EM_SE_C17	139
+#define EM_TI_C6000	140
+#define EM_TI_C2000	141
+#define EM_TI_C5500	142
+#define EM_TI_ARP32	143
+#define EM_TI_PRU	144
+#define EM_MMDSP_PLUS	160
+#define EM_CYPRESS_M8C	161
+#define EM_R32C		162
+#define EM_TRIMEDIA	163
+#define EM_QDSP6	164
+#define EM_8051		165
+#define EM_STXP7X	166
+#define EM_NDS32	167
+#define EM_ECOG1X	168
+#define EM_MAXQ30	169
+#define EM_XIMO16	170
+#define EM_MANIK	171
+#define EM_CRAYNV2	172
+#define EM_RX		173
+#define EM_METAG	174
+#define EM_MCST_ELBRUS	175
+#define EM_ECOG16	176
+#define EM_CR16		177
+#define EM_ETPU		178
+#define EM_SLE9X	179
+#define EM_L10M		180
+#define EM_K10M		181
+#define EM_AARCH64	183
+#define EM_AVR32	185
+#define EM_STM8		186
+#define EM_TILE64	187
+#define EM_TILEPRO	188
+#define EM_MICROBLAZE	189
+#define EM_CUDA		190
+#define EM_TILEGX	191
+#define EM_CLOUDSHIELD	192
+#define EM_COREA_1ST	193
+#define EM_COREA_2ND	194
+#define EM_ARC_COMPACT2	195
+#define EM_OPEN8	196
+#define EM_RL78		197
+#define EM_VIDEOCORE5	198
+#define EM_78KOR	199
+#define EM_56800EX	200
+#define EM_BA1		201
+#define EM_BA2		202
+#define EM_XCORE	203
+#define EM_MCHP_PIC	204
+#define EM_KM32		210
+#define EM_KMX32	211
+#define EM_EMX16	212
+#define EM_EMX8		213
+#define EM_KVARC	214
+#define EM_CDP		215
+#define EM_COGE		216
+#define EM_COOL		217
+#define EM_NORC		218
+#define EM_CSR_KALIMBA	219
+#define EM_Z80		220
+#define EM_VISIUM	221
+#define EM_FT32		222
+#define EM_MOXIE	223
+#define EM_AMDGPU	224
+#define EM_RISCV	243
+#define EM_BPF		247
+#define EM_CSKY		252
+#define EM_LOONGARCH	258
+#define EM_NUM		259
+
+#define EM_ALPHA	0x9026
+
+#define EV_NONE		0
+#define EV_CURRENT	1
+#define EV_NUM		2
+
+typedef struct {
+  Elf32_Word	sh_name;
+  Elf32_Word	sh_type;
+  Elf32_Word	sh_flags;
+  Elf32_Addr	sh_addr;
+  Elf32_Off	sh_offset;
+  Elf32_Word	sh_size;
+  Elf32_Word	sh_link;
+  Elf32_Word	sh_info;
+  Elf32_Word	sh_addralign;
+  Elf32_Word	sh_entsize;
+} Elf32_Shdr;
+
+typedef struct {
+  Elf64_Word	sh_name;
+  Elf64_Word	sh_type;
+  Elf64_Xword	sh_flags;
+  Elf64_Addr	sh_addr;
+  Elf64_Off	sh_offset;
+  Elf64_Xword	sh_size;
+  Elf64_Word	sh_link;
+  Elf64_Word	sh_info;
+  Elf64_Xword	sh_addralign;
+  Elf64_Xword	sh_entsize;
+} Elf64_Shdr;
+
+
+
+#define SHN_UNDEF	0
+#define SHN_LORESERVE	0xff00
+#define SHN_LOPROC	0xff00
+#define SHN_BEFORE	0xff00
+
+#define SHN_AFTER	0xff01
+
+#define SHN_HIPROC	0xff1f
+#define SHN_LOOS	0xff20
+#define SHN_HIOS	0xff3f
+#define SHN_ABS		0xfff1
+#define SHN_COMMON	0xfff2
+#define SHN_XINDEX	0xffff
+#define SHN_HIRESERVE	0xffff
+
+
+
+#define SHT_NULL	  0
+#define SHT_PROGBITS	  1
+#define SHT_SYMTAB	  2
+#define SHT_STRTAB	  3
+#define SHT_RELA	  4
+#define SHT_HASH	  5
+#define SHT_DYNAMIC	  6
+#define SHT_NOTE	  7
+#define SHT_NOBITS	  8
+#define SHT_REL		  9
+#define SHT_SHLIB	  10
+#define SHT_DYNSYM	  11
+#define SHT_INIT_ARRAY	  14
+#define SHT_FINI_ARRAY	  15
+#define SHT_PREINIT_ARRAY 16
+#define SHT_GROUP	  17
+#define SHT_SYMTAB_SHNDX  18
+#define SHT_RELR	  19
+#define	SHT_NUM		  20
+#define SHT_LOOS	  0x60000000
+#define SHT_GNU_ATTRIBUTES 0x6ffffff5
+#define SHT_GNU_HASH	  0x6ffffff6
+#define SHT_GNU_LIBLIST	  0x6ffffff7
+#define SHT_CHECKSUM	  0x6ffffff8
+#define SHT_LOSUNW	  0x6ffffffa
+#define SHT_SUNW_move	  0x6ffffffa
+#define SHT_SUNW_COMDAT   0x6ffffffb
+#define SHT_SUNW_syminfo  0x6ffffffc
+#define SHT_GNU_verdef	  0x6ffffffd
+#define SHT_GNU_verneed	  0x6ffffffe
+#define SHT_GNU_versym	  0x6fffffff
+#define SHT_HISUNW	  0x6fffffff
+#define SHT_HIOS	  0x6fffffff
+#define SHT_LOPROC	  0x70000000
+#define SHT_HIPROC	  0x7fffffff
+#define SHT_LOUSER	  0x80000000
+#define SHT_HIUSER	  0x8fffffff
+
+#define SHF_WRITE	     (1 << 0)
+#define SHF_ALLOC	     (1 << 1)
+#define SHF_EXECINSTR	     (1 << 2)
+#define SHF_MERGE	     (1 << 4)
+#define SHF_STRINGS	     (1 << 5)
+#define SHF_INFO_LINK	     (1 << 6)
+#define SHF_LINK_ORDER	     (1 << 7)
+#define SHF_OS_NONCONFORMING (1 << 8)
+
+#define SHF_GROUP	     (1 << 9)
+#define SHF_TLS		     (1 << 10)
+#define SHF_COMPRESSED	     (1 << 11)
+#define SHF_MASKOS	     0x0ff00000
+#define SHF_MASKPROC	     0xf0000000
+#define SHF_ORDERED	     (1 << 30)
+#define SHF_EXCLUDE	     (1U << 31)
+
+typedef struct {
+  Elf32_Word	ch_type;
+  Elf32_Word	ch_size;
+  Elf32_Word	ch_addralign;
+} Elf32_Chdr;
+
+typedef struct {
+  Elf64_Word	ch_type;
+  Elf64_Word	ch_reserved;
+  Elf64_Xword	ch_size;
+  Elf64_Xword	ch_addralign;
+} Elf64_Chdr;
+
+#define ELFCOMPRESS_ZLIB	1
+#define ELFCOMPRESS_ZSTD	2
+#define ELFCOMPRESS_LOOS	0x60000000
+#define ELFCOMPRESS_HIOS	0x6fffffff
+#define ELFCOMPRESS_LOPROC	0x70000000
+#define ELFCOMPRESS_HIPROC	0x7fffffff
+
+
+#define GRP_COMDAT	0x1
+
+typedef struct {
+  Elf32_Word	st_name;
+  Elf32_Addr	st_value;
+  Elf32_Word	st_size;
+  unsigned char	st_info;
+  unsigned char	st_other;
+  Elf32_Section	st_shndx;
+} Elf32_Sym;
+
+typedef struct {
+  Elf64_Word	st_name;
+  unsigned char	st_info;
+  unsigned char st_other;
+  Elf64_Section	st_shndx;
+  Elf64_Addr	st_value;
+  Elf64_Xword	st_size;
+} Elf64_Sym;
+
+typedef struct {
+  Elf32_Half si_boundto;
+  Elf32_Half si_flags;
+} Elf32_Syminfo;
+
+typedef struct {
+  Elf64_Half si_boundto;
+  Elf64_Half si_flags;
+} Elf64_Syminfo;
+
+#define SYMINFO_BT_SELF		0xffff
+#define SYMINFO_BT_PARENT	0xfffe
+#define SYMINFO_BT_LOWRESERVE	0xff00
+
+#define SYMINFO_FLG_DIRECT	0x0001
+#define SYMINFO_FLG_PASSTHRU	0x0002
+#define SYMINFO_FLG_COPY	0x0004
+#define SYMINFO_FLG_LAZYLOAD	0x0008
+
+#define SYMINFO_NONE		0
+#define SYMINFO_CURRENT		1
+#define SYMINFO_NUM		2
+
+#define ELF32_ST_BIND(val)		(((unsigned char) (val)) >> 4)
+#define ELF32_ST_TYPE(val)		((val) & 0xf)
+#define ELF32_ST_INFO(bind, type)	(((bind) << 4) + ((type) & 0xf))
+
+#define ELF64_ST_BIND(val)		ELF32_ST_BIND (val)
+#define ELF64_ST_TYPE(val)		ELF32_ST_TYPE (val)
+#define ELF64_ST_INFO(bind, type)	ELF32_ST_INFO ((bind), (type))
+
+#define STB_LOCAL	0
+#define STB_GLOBAL	1
+#define STB_WEAK	2
+#define	STB_NUM		3
+#define STB_LOOS	10
+#define STB_GNU_UNIQUE	10
+#define STB_HIOS	12
+#define STB_LOPROC	13
+#define STB_HIPROC	15
+
+#define STT_NOTYPE	0
+#define STT_OBJECT	1
+#define STT_FUNC	2
+#define STT_SECTION	3
+#define STT_FILE	4
+#define STT_COMMON	5
+#define STT_TLS		6
+#define	STT_NUM		7
+#define STT_LOOS	10
+#define STT_GNU_IFUNC	10
+#define STT_HIOS	12
+#define STT_LOPROC	13
+#define STT_HIPROC	15
+
+#define STN_UNDEF	0
+
+#define ELF32_ST_VISIBILITY(o)	((o) & 0x03)
+#define ELF64_ST_VISIBILITY(o)	ELF32_ST_VISIBILITY (o)
+
+#define STV_DEFAULT	0
+#define STV_INTERNAL	1
+#define STV_HIDDEN	2
+#define STV_PROTECTED	3
+
+
+
+
+typedef struct {
+  Elf32_Addr	r_offset;
+  Elf32_Word	r_info;
+} Elf32_Rel;
+
+typedef struct {
+  Elf64_Addr	r_offset;
+  Elf64_Xword	r_info;
+} Elf64_Rel;
+
+
+
+typedef struct {
+  Elf32_Addr	r_offset;
+  Elf32_Word	r_info;
+  Elf32_Sword	r_addend;
+} Elf32_Rela;
+
+typedef struct {
+  Elf64_Addr	r_offset;
+  Elf64_Xword	r_info;
+  Elf64_Sxword	r_addend;
+} Elf64_Rela;
+
+
+
+typedef Elf32_Word Elf32_Relr;
+typedef Elf64_Xword Elf64_Relr;
+
+
+
+#define ELF32_R_SYM(val)		((val) >> 8)
+#define ELF32_R_TYPE(val)		((val) & 0xff)
+#define ELF32_R_INFO(sym, type)		(((sym) << 8) + ((type) & 0xff))
+
+#define ELF64_R_SYM(i)			((i) >> 32)
+#define ELF64_R_TYPE(i)			((i) & 0xffffffff)
+#define ELF64_R_INFO(sym,type)		((((Elf64_Xword) (sym)) << 32) + (type))
+
+
+
+typedef struct {
+  Elf32_Word	p_type;
+  Elf32_Off	p_offset;
+  Elf32_Addr	p_vaddr;
+  Elf32_Addr	p_paddr;
+  Elf32_Word	p_filesz;
+  Elf32_Word	p_memsz;
+  Elf32_Word	p_flags;
+  Elf32_Word	p_align;
+} Elf32_Phdr;
+
+typedef struct {
+  Elf64_Word	p_type;
+  Elf64_Word	p_flags;
+  Elf64_Off	p_offset;
+  Elf64_Addr	p_vaddr;
+  Elf64_Addr	p_paddr;
+  Elf64_Xword	p_filesz;
+  Elf64_Xword	p_memsz;
+  Elf64_Xword	p_align;
+} Elf64_Phdr;
+
+
+
+#define	PT_NULL		0
+#define PT_LOAD		1
+#define PT_DYNAMIC	2
+#define PT_INTERP	3
+#define PT_NOTE		4
+#define PT_SHLIB	5
+#define PT_PHDR		6
+#define PT_TLS		7
+#define	PT_NUM		8
+#define PT_LOOS		0x60000000
+#define PT_GNU_EH_FRAME	0x6474e550
+#define PT_GNU_STACK	0x6474e551
+#define PT_GNU_RELRO	0x6474e552
+#define PT_GNU_PROPERTY	0x6474e553
+#define PT_LOSUNW	0x6ffffffa
+#define PT_SUNWBSS	0x6ffffffa
+#define PT_SUNWSTACK	0x6ffffffb
+#define PT_HISUNW	0x6fffffff
+#define PT_HIOS		0x6fffffff
+#define PT_LOPROC	0x70000000
+#define PT_HIPROC	0x7fffffff
+
+
+#define PN_XNUM 0xffff
+
+
+#define PF_X		(1 << 0)
+#define PF_W		(1 << 1)
+#define PF_R		(1 << 2)
+#define PF_MASKOS	0x0ff00000
+#define PF_MASKPROC	0xf0000000
+
+
+
+#define NT_PRSTATUS	1
+#define NT_PRFPREG	2
+#define NT_FPREGSET	2
+#define NT_PRPSINFO	3
+#define NT_PRXREG	4
+#define NT_TASKSTRUCT	4
+#define NT_PLATFORM	5
+#define NT_AUXV		6
+#define NT_GWINDOWS	7
+#define NT_ASRS		8
+#define NT_PSTATUS	10
+#define NT_PSINFO	13
+#define NT_PRCRED	14
+#define NT_UTSNAME	15
+#define NT_LWPSTATUS	16
+#define NT_LWPSINFO	17
+#define NT_PRFPXREG	20
+#define NT_SIGINFO	0x53494749
+#define NT_FILE		0x46494c45
+#define NT_PRXFPREG	0x46e62b7f
+#define NT_PPC_VMX	0x100
+#define NT_PPC_SPE	0x101
+#define NT_PPC_VSX	0x102
+#define NT_PPC_TAR	0x103
+#define NT_PPC_PPR	0x104
+#define NT_PPC_DSCR	0x105
+#define NT_PPC_EBB	0x106
+#define NT_PPC_PMU	0x107
+#define NT_PPC_TM_CGPR	0x108
+#define NT_PPC_TM_CFPR	0x109
+#define NT_PPC_TM_CVMX	0x10a
+#define NT_PPC_TM_CVSX	0x10b
+#define NT_PPC_TM_SPR	0x10c
+#define NT_PPC_TM_CTAR	0x10d
+#define NT_PPC_TM_CPPR	0x10e
+#define NT_PPC_TM_CDSCR	0x10f
+#define NT_386_TLS	0x200
+#define NT_386_IOPERM	0x201
+#define NT_X86_XSTATE	0x202
+#define NT_S390_HIGH_GPRS	0x300
+#define NT_S390_TIMER	0x301
+#define NT_S390_TODCMP	0x302
+#define NT_S390_TODPREG	0x303
+#define NT_S390_CTRS	0x304
+#define NT_S390_PREFIX	0x305
+#define NT_S390_LAST_BREAK	0x306
+#define NT_S390_SYSTEM_CALL	0x307
+#define NT_S390_TDB	0x308
+#define NT_S390_VXRS_LOW	0x309
+#define NT_S390_VXRS_HIGH	0x30a
+#define NT_S390_GS_CB	0x30b
+#define NT_S390_GS_BC	0x30c
+#define NT_S390_RI_CB	0x30d
+#define NT_ARM_VFP	0x400
+#define NT_ARM_TLS	0x401
+#define NT_ARM_HW_BREAK	0x402
+#define NT_ARM_HW_WATCH	0x403
+#define NT_ARM_SYSTEM_CALL	0x404
+#define NT_ARM_SVE	0x405
+#define NT_ARM_PAC_MASK	0x406
+#define NT_ARM_PACA_KEYS	0x407
+#define NT_ARM_PACG_KEYS	0x408
+#define NT_ARM_TAGGED_ADDR_CTRL	0x409
+#define NT_ARM_PAC_ENABLED_KEYS	0x40a
+#define NT_METAG_CBUF	0x500
+#define NT_METAG_RPIPE	0x501
+#define NT_METAG_TLS	0x502
+#define NT_ARC_V2	0x600
+#define NT_VMCOREDD	0x700
+#define NT_MIPS_DSP	0x800
+#define NT_MIPS_FP_MODE	0x801
+#define NT_MIPS_MSA	0x802
+#define NT_RISCV_CSR	0x900
+#define NT_RISCV_VECTOR	0x901
+#define NT_VERSION	1
+#define NT_LOONGARCH_CPUCFG	0xa00
+#define NT_LOONGARCH_CSR	0xa01
+#define NT_LOONGARCH_LSX	0xa02
+#define NT_LOONGARCH_LASX	0xa03
+#define NT_LOONGARCH_LBT	0xa04
+
+
+
+
+typedef struct {
+  Elf32_Sword d_tag;
+  union {
+      Elf32_Word d_val;
+      Elf32_Addr d_ptr;
+  } d_un;
+} Elf32_Dyn;
+
+typedef struct {
+  Elf64_Sxword d_tag;
+  union {
+      Elf64_Xword d_val;
+      Elf64_Addr d_ptr;
+  } d_un;
+} Elf64_Dyn;
+
+
+
+#define DT_NULL		0
+#define DT_NEEDED	1
+#define DT_PLTRELSZ	2
+#define DT_PLTGOT	3
+#define DT_HASH		4
+#define DT_STRTAB	5
+#define DT_SYMTAB	6
+#define DT_RELA		7
+#define DT_RELASZ	8
+#define DT_RELAENT	9
+#define DT_STRSZ	10
+#define DT_SYMENT	11
+#define DT_INIT		12
+#define DT_FINI		13
+#define DT_SONAME	14
+#define DT_RPATH	15
+#define DT_SYMBOLIC	16
+#define DT_REL		17
+#define DT_RELSZ	18
+#define DT_RELENT	19
+#define DT_PLTREL	20
+#define DT_DEBUG	21
+#define DT_TEXTREL	22
+#define DT_JMPREL	23
+#define	DT_BIND_NOW	24
+#define	DT_INIT_ARRAY	25
+#define	DT_FINI_ARRAY	26
+#define	DT_INIT_ARRAYSZ	27
+#define	DT_FINI_ARRAYSZ	28
+#define DT_RUNPATH	29
+#define DT_FLAGS	30
+#define DT_ENCODING	32
+#define DT_PREINIT_ARRAY 32
+#define DT_PREINIT_ARRAYSZ 33
+#define DT_SYMTAB_SHNDX	34
+#define DT_RELRSZ	35
+#define DT_RELR		36
+#define DT_RELRENT	37
+#define	DT_NUM		38
+#define DT_LOOS		0x6000000d
+#define DT_HIOS		0x6ffff000
+#define DT_LOPROC	0x70000000
+#define DT_HIPROC	0x7fffffff
+#define	DT_PROCNUM	DT_MIPS_NUM
+
+#define DT_VALRNGLO	0x6ffffd00
+#define DT_GNU_PRELINKED 0x6ffffdf5
+#define DT_GNU_CONFLICTSZ 0x6ffffdf6
+#define DT_GNU_LIBLISTSZ 0x6ffffdf7
+#define DT_CHECKSUM	0x6ffffdf8
+#define DT_PLTPADSZ	0x6ffffdf9
+#define DT_MOVEENT	0x6ffffdfa
+#define DT_MOVESZ	0x6ffffdfb
+#define DT_FEATURE_1	0x6ffffdfc
+#define DT_POSFLAG_1	0x6ffffdfd
+
+#define DT_SYMINSZ	0x6ffffdfe
+#define DT_SYMINENT	0x6ffffdff
+#define DT_VALRNGHI	0x6ffffdff
+#define DT_VALTAGIDX(tag)	(DT_VALRNGHI - (tag))
+#define DT_VALNUM 12
+
+#define DT_ADDRRNGLO	0x6ffffe00
+#define DT_GNU_HASH	0x6ffffef5
+#define DT_TLSDESC_PLT	0x6ffffef6
+#define DT_TLSDESC_GOT	0x6ffffef7
+#define DT_GNU_CONFLICT	0x6ffffef8
+#define DT_GNU_LIBLIST	0x6ffffef9
+#define DT_CONFIG	0x6ffffefa
+#define DT_DEPAUDIT	0x6ffffefb
+#define DT_AUDIT	0x6ffffefc
+#define	DT_PLTPAD	0x6ffffefd
+#define	DT_MOVETAB	0x6ffffefe
+#define DT_SYMINFO	0x6ffffeff
+#define DT_ADDRRNGHI	0x6ffffeff
+#define DT_ADDRTAGIDX(tag)	(DT_ADDRRNGHI - (tag))
+#define DT_ADDRNUM 11
+
+
+
+#define DT_VERSYM	0x6ffffff0
+
+#define DT_RELACOUNT	0x6ffffff9
+#define DT_RELCOUNT	0x6ffffffa
+
+
+#define DT_FLAGS_1	0x6ffffffb
+#define	DT_VERDEF	0x6ffffffc
+
+#define	DT_VERDEFNUM	0x6ffffffd
+#define	DT_VERNEED	0x6ffffffe
+
+#define	DT_VERNEEDNUM	0x6fffffff
+#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))
+#define DT_VERSIONTAGNUM 16
+
+
+
+#define DT_AUXILIARY    0x7ffffffd
+#define DT_FILTER       0x7fffffff
+#define DT_EXTRATAGIDX(tag)	((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
+#define DT_EXTRANUM	3
+
+
+#define DF_ORIGIN	0x00000001
+#define DF_SYMBOLIC	0x00000002
+#define DF_TEXTREL	0x00000004
+#define DF_BIND_NOW	0x00000008
+#define DF_STATIC_TLS	0x00000010
+
+
+
+#define DF_1_NOW	0x00000001
+#define DF_1_GLOBAL	0x00000002
+#define DF_1_GROUP	0x00000004
+#define DF_1_NODELETE	0x00000008
+#define DF_1_LOADFLTR	0x00000010
+#define DF_1_INITFIRST	0x00000020
+#define DF_1_NOOPEN	0x00000040
+#define DF_1_ORIGIN	0x00000080
+#define DF_1_DIRECT	0x00000100
+#define DF_1_TRANS	0x00000200
+#define DF_1_INTERPOSE	0x00000400
+#define DF_1_NODEFLIB	0x00000800
+#define DF_1_NODUMP	0x00001000
+#define DF_1_CONFALT	0x00002000
+#define DF_1_ENDFILTEE	0x00004000
+#define	DF_1_DISPRELDNE	0x00008000
+#define	DF_1_DISPRELPND	0x00010000
+#define	DF_1_NODIRECT	0x00020000
+#define	DF_1_IGNMULDEF	0x00040000
+#define	DF_1_NOKSYMS	0x00080000
+#define	DF_1_NOHDR	0x00100000
+#define	DF_1_EDITED	0x00200000
+#define	DF_1_NORELOC	0x00400000
+#define	DF_1_SYMINTPOSE	0x00800000
+#define	DF_1_GLOBAUDIT	0x01000000
+#define	DF_1_SINGLETON	0x02000000
+#define	DF_1_STUB	0x04000000
+#define	DF_1_PIE	0x08000000
+
+#define DTF_1_PARINIT	0x00000001
+#define DTF_1_CONFEXP	0x00000002
+
+
+#define DF_P1_LAZYLOAD	0x00000001
+#define DF_P1_GROUPPERM	0x00000002
+
+
+
+
+typedef struct {
+  Elf32_Half	vd_version;
+  Elf32_Half	vd_flags;
+  Elf32_Half	vd_ndx;
+  Elf32_Half	vd_cnt;
+  Elf32_Word	vd_hash;
+  Elf32_Word	vd_aux;
+  Elf32_Word	vd_next;
+} Elf32_Verdef;
+
+typedef struct {
+  Elf64_Half	vd_version;
+  Elf64_Half	vd_flags;
+  Elf64_Half	vd_ndx;
+  Elf64_Half	vd_cnt;
+  Elf64_Word	vd_hash;
+  Elf64_Word	vd_aux;
+  Elf64_Word	vd_next;
+} Elf64_Verdef;
+
+
+
+#define VER_DEF_NONE	0
+#define VER_DEF_CURRENT	1
+#define VER_DEF_NUM	2
+
+
+#define VER_FLG_BASE	0x1
+#define VER_FLG_WEAK	0x2
+
+
+#define	VER_NDX_LOCAL		0
+#define	VER_NDX_GLOBAL		1
+#define	VER_NDX_LORESERVE	0xff00
+#define	VER_NDX_ELIMINATE	0xff01
+
+
+
+typedef struct {
+  Elf32_Word	vda_name;
+  Elf32_Word	vda_next;
+} Elf32_Verdaux;
+
+typedef struct {
+  Elf64_Word	vda_name;
+  Elf64_Word	vda_next;
+} Elf64_Verdaux;
+
+
+
+
+typedef struct {
+  Elf32_Half	vn_version;
+  Elf32_Half	vn_cnt;
+  Elf32_Word	vn_file;
+  Elf32_Word	vn_aux;
+  Elf32_Word	vn_next;
+} Elf32_Verneed;
+
+typedef struct {
+  Elf64_Half	vn_version;
+  Elf64_Half	vn_cnt;
+  Elf64_Word	vn_file;
+  Elf64_Word	vn_aux;
+  Elf64_Word	vn_next;
+} Elf64_Verneed;
+
+
+
+#define VER_NEED_NONE	 0
+#define VER_NEED_CURRENT 1
+#define VER_NEED_NUM	 2
+
+
+
+typedef struct {
+  Elf32_Word	vna_hash;
+  Elf32_Half	vna_flags;
+  Elf32_Half	vna_other;
+  Elf32_Word	vna_name;
+  Elf32_Word	vna_next;
+} Elf32_Vernaux;
+
+typedef struct {
+  Elf64_Word	vna_hash;
+  Elf64_Half	vna_flags;
+  Elf64_Half	vna_other;
+  Elf64_Word	vna_name;
+  Elf64_Word	vna_next;
+} Elf64_Vernaux;
+
+
+
+#define VER_FLG_WEAK	0x2
+
+
+
+typedef struct {
+  uint32_t a_type;
+  union {
+      uint32_t a_val;
+  } a_un;
+} Elf32_auxv_t;
+
+typedef struct {
+  uint64_t a_type;
+  union {
+      uint64_t a_val;
+  } a_un;
+} Elf64_auxv_t;
+
+
+
+#define AT_NULL		0
+#define AT_IGNORE	1
+#define AT_EXECFD	2
+#define AT_PHDR		3
+#define AT_PHENT	4
+#define AT_PHNUM	5
+#define AT_PAGESZ	6
+#define AT_BASE		7
+#define AT_FLAGS	8
+#define AT_ENTRY	9
+#define AT_NOTELF	10
+#define AT_UID		11
+#define AT_EUID		12
+#define AT_GID		13
+#define AT_EGID		14
+#define AT_CLKTCK	17
+
+
+#define AT_PLATFORM	15
+#define AT_HWCAP	16
+
+
+
+
+#define AT_FPUCW	18
+
+
+#define AT_DCACHEBSIZE	19
+#define AT_ICACHEBSIZE	20
+#define AT_UCACHEBSIZE	21
+
+
+
+#define AT_IGNOREPPC	22
+
+#define	AT_SECURE	23
+
+#define AT_BASE_PLATFORM 24
+
+#define AT_RANDOM	25
+
+#define AT_HWCAP2	26
+
+#define AT_EXECFN	31
+
+
+
+#define AT_SYSINFO	32
+#define AT_SYSINFO_EHDR	33
+
+
+
+#define AT_L1I_CACHESHAPE	34
+#define AT_L1D_CACHESHAPE	35
+#define AT_L2_CACHESHAPE	36
+#define AT_L3_CACHESHAPE	37
+
+#define AT_L1I_CACHESIZE	40
+#define AT_L1I_CACHEGEOMETRY	41
+#define AT_L1D_CACHESIZE	42
+#define AT_L1D_CACHEGEOMETRY	43
+#define AT_L2_CACHESIZE		44
+#define AT_L2_CACHEGEOMETRY	45
+#define AT_L3_CACHESIZE		46
+#define AT_L3_CACHEGEOMETRY	47
+
+#define AT_MINSIGSTKSZ		51
+
+
+typedef struct {
+  Elf32_Word n_namesz;
+  Elf32_Word n_descsz;
+  Elf32_Word n_type;
+} Elf32_Nhdr;
+
+typedef struct {
+  Elf64_Word n_namesz;
+  Elf64_Word n_descsz;
+  Elf64_Word n_type;
+} Elf64_Nhdr;
+
+
+
+
+#define ELF_NOTE_SOLARIS	"SUNW Solaris"
+
+
+#define ELF_NOTE_GNU		"GNU"
+
+
+
+
+
+#define ELF_NOTE_PAGESIZE_HINT	1
+
+
+#define NT_GNU_ABI_TAG	1
+#define ELF_NOTE_ABI	NT_GNU_ABI_TAG
+
+
+
+#define ELF_NOTE_OS_LINUX	0
+#define ELF_NOTE_OS_GNU		1
+#define ELF_NOTE_OS_SOLARIS2	2
+#define ELF_NOTE_OS_FREEBSD	3
+
+#define NT_GNU_BUILD_ID	3
+#define NT_GNU_GOLD_VERSION	4
+#define NT_GNU_PROPERTY_TYPE_0	5
+
+
+
+typedef struct {
+  Elf32_Xword m_value;
+  Elf32_Word m_info;
+  Elf32_Word m_poffset;
+  Elf32_Half m_repeat;
+  Elf32_Half m_stride;
+} Elf32_Move;
+
+typedef struct {
+  Elf64_Xword m_value;
+  Elf64_Xword m_info;
+  Elf64_Xword m_poffset;
+  Elf64_Half m_repeat;
+  Elf64_Half m_stride;
+} Elf64_Move;
+
+
+#define ELF32_M_SYM(info)	((info) >> 8)
+#define ELF32_M_SIZE(info)	((unsigned char) (info))
+#define ELF32_M_INFO(sym, size)	(((sym) << 8) + (unsigned char) (size))
+
+#define ELF64_M_SYM(info)	ELF32_M_SYM (info)
+#define ELF64_M_SIZE(info)	ELF32_M_SIZE (info)
+#define ELF64_M_INFO(sym, size)	ELF32_M_INFO (sym, size)
+
+#define EF_CPU32	0x00810000
+
+#define R_68K_NONE	0
+#define R_68K_32	1
+#define R_68K_16	2
+#define R_68K_8		3
+#define R_68K_PC32	4
+#define R_68K_PC16	5
+#define R_68K_PC8	6
+#define R_68K_GOT32	7
+#define R_68K_GOT16	8
+#define R_68K_GOT8	9
+#define R_68K_GOT32O	10
+#define R_68K_GOT16O	11
+#define R_68K_GOT8O	12
+#define R_68K_PLT32	13
+#define R_68K_PLT16	14
+#define R_68K_PLT8	15
+#define R_68K_PLT32O	16
+#define R_68K_PLT16O	17
+#define R_68K_PLT8O	18
+#define R_68K_COPY	19
+#define R_68K_GLOB_DAT	20
+#define R_68K_JMP_SLOT	21
+#define R_68K_RELATIVE	22
+#define R_68K_TLS_GD32	25
+#define R_68K_TLS_GD16	26
+#define R_68K_TLS_GD8	27
+#define R_68K_TLS_LDM32	28
+#define R_68K_TLS_LDM16	29
+#define R_68K_TLS_LDM8	30
+#define R_68K_TLS_LDO32	31
+#define R_68K_TLS_LDO16	32
+#define R_68K_TLS_LDO8	33
+#define R_68K_TLS_IE32	34
+#define R_68K_TLS_IE16	35
+#define R_68K_TLS_IE8	36
+#define R_68K_TLS_LE32	37
+#define R_68K_TLS_LE16	38
+#define R_68K_TLS_LE8	39
+#define R_68K_TLS_DTPMOD32	40
+#define R_68K_TLS_DTPREL32	41
+#define R_68K_TLS_TPREL32	42
+#define R_68K_NUM	43
+
+#define R_386_NONE	   0
+#define R_386_32	   1
+#define R_386_PC32	   2
+#define R_386_GOT32	   3
+#define R_386_PLT32	   4
+#define R_386_COPY	   5
+#define R_386_GLOB_DAT	   6
+#define R_386_JMP_SLOT	   7
+#define R_386_RELATIVE	   8
+#define R_386_GOTOFF	   9
+#define R_386_GOTPC	   10
+#define R_386_32PLT	   11
+#define R_386_TLS_TPOFF	   14
+#define R_386_TLS_IE	   15
+#define R_386_TLS_GOTIE	   16
+#define R_386_TLS_LE	   17
+#define R_386_TLS_GD	   18
+#define R_386_TLS_LDM	   19
+#define R_386_16	   20
+#define R_386_PC16	   21
+#define R_386_8		   22
+#define R_386_PC8	   23
+#define R_386_TLS_GD_32	   24
+#define R_386_TLS_GD_PUSH  25
+#define R_386_TLS_GD_CALL  26
+#define R_386_TLS_GD_POP   27
+#define R_386_TLS_LDM_32   28
+#define R_386_TLS_LDM_PUSH 29
+#define R_386_TLS_LDM_CALL 30
+#define R_386_TLS_LDM_POP  31
+#define R_386_TLS_LDO_32   32
+#define R_386_TLS_IE_32	   33
+#define R_386_TLS_LE_32	   34
+#define R_386_TLS_DTPMOD32 35
+#define R_386_TLS_DTPOFF32 36
+#define R_386_TLS_TPOFF32  37
+#define R_386_SIZE32       38
+#define R_386_TLS_GOTDESC  39
+#define R_386_TLS_DESC_CALL 40
+#define R_386_TLS_DESC     41
+#define R_386_IRELATIVE	   42
+#define R_386_GOT32X	   43
+#define R_386_NUM	   44
+
+
+
+
+
+#define STT_SPARC_REGISTER	13
+
+
+
+#define EF_SPARCV9_MM		3
+#define EF_SPARCV9_TSO		0
+#define EF_SPARCV9_PSO		1
+#define EF_SPARCV9_RMO		2
+#define EF_SPARC_LEDATA		0x800000
+#define EF_SPARC_EXT_MASK	0xFFFF00
+#define EF_SPARC_32PLUS		0x000100
+#define EF_SPARC_SUN_US1	0x000200
+#define EF_SPARC_HAL_R1		0x000400
+#define EF_SPARC_SUN_US3	0x000800
+
+
+
+#define R_SPARC_NONE		0
+#define R_SPARC_8		1
+#define R_SPARC_16		2
+#define R_SPARC_32		3
+#define R_SPARC_DISP8		4
+#define R_SPARC_DISP16		5
+#define R_SPARC_DISP32		6
+#define R_SPARC_WDISP30		7
+#define R_SPARC_WDISP22		8
+#define R_SPARC_HI22		9
+#define R_SPARC_22		10
+#define R_SPARC_13		11
+#define R_SPARC_LO10		12
+#define R_SPARC_GOT10		13
+#define R_SPARC_GOT13		14
+#define R_SPARC_GOT22		15
+#define R_SPARC_PC10		16
+#define R_SPARC_PC22		17
+#define R_SPARC_WPLT30		18
+#define R_SPARC_COPY		19
+#define R_SPARC_GLOB_DAT	20
+#define R_SPARC_JMP_SLOT	21
+#define R_SPARC_RELATIVE	22
+#define R_SPARC_UA32		23
+
+
+
+#define R_SPARC_PLT32		24
+#define R_SPARC_HIPLT22		25
+#define R_SPARC_LOPLT10		26
+#define R_SPARC_PCPLT32		27
+#define R_SPARC_PCPLT22		28
+#define R_SPARC_PCPLT10		29
+#define R_SPARC_10		30
+#define R_SPARC_11		31
+#define R_SPARC_64		32
+#define R_SPARC_OLO10		33
+#define R_SPARC_HH22		34
+#define R_SPARC_HM10		35
+#define R_SPARC_LM22		36
+#define R_SPARC_PC_HH22		37
+#define R_SPARC_PC_HM10		38
+#define R_SPARC_PC_LM22		39
+#define R_SPARC_WDISP16		40
+#define R_SPARC_WDISP19		41
+#define R_SPARC_GLOB_JMP	42
+#define R_SPARC_7		43
+#define R_SPARC_5		44
+#define R_SPARC_6		45
+#define R_SPARC_DISP64		46
+#define R_SPARC_PLT64		47
+#define R_SPARC_HIX22		48
+#define R_SPARC_LOX10		49
+#define R_SPARC_H44		50
+#define R_SPARC_M44		51
+#define R_SPARC_L44		52
+#define R_SPARC_REGISTER	53
+#define R_SPARC_UA64		54
+#define R_SPARC_UA16		55
+#define R_SPARC_TLS_GD_HI22	56
+#define R_SPARC_TLS_GD_LO10	57
+#define R_SPARC_TLS_GD_ADD	58
+#define R_SPARC_TLS_GD_CALL	59
+#define R_SPARC_TLS_LDM_HI22	60
+#define R_SPARC_TLS_LDM_LO10	61
+#define R_SPARC_TLS_LDM_ADD	62
+#define R_SPARC_TLS_LDM_CALL	63
+#define R_SPARC_TLS_LDO_HIX22	64
+#define R_SPARC_TLS_LDO_LOX10	65
+#define R_SPARC_TLS_LDO_ADD	66
+#define R_SPARC_TLS_IE_HI22	67
+#define R_SPARC_TLS_IE_LO10	68
+#define R_SPARC_TLS_IE_LD	69
+#define R_SPARC_TLS_IE_LDX	70
+#define R_SPARC_TLS_IE_ADD	71
+#define R_SPARC_TLS_LE_HIX22	72
+#define R_SPARC_TLS_LE_LOX10	73
+#define R_SPARC_TLS_DTPMOD32	74
+#define R_SPARC_TLS_DTPMOD64	75
+#define R_SPARC_TLS_DTPOFF32	76
+#define R_SPARC_TLS_DTPOFF64	77
+#define R_SPARC_TLS_TPOFF32	78
+#define R_SPARC_TLS_TPOFF64	79
+#define R_SPARC_GOTDATA_HIX22	80
+#define R_SPARC_GOTDATA_LOX10	81
+#define R_SPARC_GOTDATA_OP_HIX22	82
+#define R_SPARC_GOTDATA_OP_LOX10	83
+#define R_SPARC_GOTDATA_OP	84
+#define R_SPARC_H34		85
+#define R_SPARC_SIZE32		86
+#define R_SPARC_SIZE64		87
+#define R_SPARC_GNU_VTINHERIT	250
+#define R_SPARC_GNU_VTENTRY	251
+#define R_SPARC_REV32		252
+
+#define R_SPARC_NUM		253
+
+
+
+#define DT_SPARC_REGISTER 0x70000001
+#define DT_SPARC_NUM	2
+
+
+#define EF_MIPS_NOREORDER   1
+#define EF_MIPS_PIC	    2
+#define EF_MIPS_CPIC	    4
+#define EF_MIPS_XGOT	    8
+#define EF_MIPS_64BIT_WHIRL 16
+#define EF_MIPS_ABI2	    32
+#define EF_MIPS_ABI_ON32    64
+#define EF_MIPS_FP64	    512
+#define EF_MIPS_NAN2008     1024
+#define EF_MIPS_ARCH	    0xf0000000
+
+
+
+#define EF_MIPS_ARCH_1	    0x00000000
+#define EF_MIPS_ARCH_2	    0x10000000
+#define EF_MIPS_ARCH_3	    0x20000000
+#define EF_MIPS_ARCH_4	    0x30000000
+#define EF_MIPS_ARCH_5	    0x40000000
+#define EF_MIPS_ARCH_32     0x50000000
+#define EF_MIPS_ARCH_64     0x60000000
+#define EF_MIPS_ARCH_32R2   0x70000000
+#define EF_MIPS_ARCH_64R2   0x80000000
+
+
+#define E_MIPS_ARCH_1	  0x00000000
+#define E_MIPS_ARCH_2	  0x10000000
+#define E_MIPS_ARCH_3	  0x20000000
+#define E_MIPS_ARCH_4	  0x30000000
+#define E_MIPS_ARCH_5	  0x40000000
+#define E_MIPS_ARCH_32	  0x50000000
+#define E_MIPS_ARCH_64	  0x60000000
+
+
+
+#define SHN_MIPS_ACOMMON    0xff00
+#define SHN_MIPS_TEXT	    0xff01
+#define SHN_MIPS_DATA	    0xff02
+#define SHN_MIPS_SCOMMON    0xff03
+#define SHN_MIPS_SUNDEFINED 0xff04
+
+
+
+#define SHT_MIPS_LIBLIST       0x70000000
+#define SHT_MIPS_MSYM	       0x70000001
+#define SHT_MIPS_CONFLICT      0x70000002
+#define SHT_MIPS_GPTAB	       0x70000003
+#define SHT_MIPS_UCODE	       0x70000004
+#define SHT_MIPS_DEBUG	       0x70000005
+#define SHT_MIPS_REGINFO       0x70000006
+#define SHT_MIPS_PACKAGE       0x70000007
+#define SHT_MIPS_PACKSYM       0x70000008
+#define SHT_MIPS_RELD	       0x70000009
+#define SHT_MIPS_IFACE         0x7000000b
+#define SHT_MIPS_CONTENT       0x7000000c
+#define SHT_MIPS_OPTIONS       0x7000000d
+#define SHT_MIPS_SHDR	       0x70000010
+#define SHT_MIPS_FDESC	       0x70000011
+#define SHT_MIPS_EXTSYM	       0x70000012
+#define SHT_MIPS_DENSE	       0x70000013
+#define SHT_MIPS_PDESC	       0x70000014
+#define SHT_MIPS_LOCSYM	       0x70000015
+#define SHT_MIPS_AUXSYM	       0x70000016
+#define SHT_MIPS_OPTSYM	       0x70000017
+#define SHT_MIPS_LOCSTR	       0x70000018
+#define SHT_MIPS_LINE	       0x70000019
+#define SHT_MIPS_RFDESC	       0x7000001a
+#define SHT_MIPS_DELTASYM      0x7000001b
+#define SHT_MIPS_DELTAINST     0x7000001c
+#define SHT_MIPS_DELTACLASS    0x7000001d
+#define SHT_MIPS_DWARF         0x7000001e
+#define SHT_MIPS_DELTADECL     0x7000001f
+#define SHT_MIPS_SYMBOL_LIB    0x70000020
+#define SHT_MIPS_EVENTS	       0x70000021
+#define SHT_MIPS_TRANSLATE     0x70000022
+#define SHT_MIPS_PIXIE	       0x70000023
+#define SHT_MIPS_XLATE	       0x70000024
+#define SHT_MIPS_XLATE_DEBUG   0x70000025
+#define SHT_MIPS_WHIRL	       0x70000026
+#define SHT_MIPS_EH_REGION     0x70000027
+#define SHT_MIPS_XLATE_OLD     0x70000028
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+
+
+
+#define SHF_MIPS_GPREL	 0x10000000
+#define SHF_MIPS_MERGE	 0x20000000
+#define SHF_MIPS_ADDR	 0x40000000
+#define SHF_MIPS_STRINGS 0x80000000
+#define SHF_MIPS_NOSTRIP 0x08000000
+#define SHF_MIPS_LOCAL	 0x04000000
+#define SHF_MIPS_NAMES	 0x02000000
+#define SHF_MIPS_NODUPE	 0x01000000
+
+
+
+
+
+#define STO_MIPS_DEFAULT		0x0
+#define STO_MIPS_INTERNAL		0x1
+#define STO_MIPS_HIDDEN			0x2
+#define STO_MIPS_PROTECTED		0x3
+#define STO_MIPS_PLT			0x8
+#define STO_MIPS_SC_ALIGN_UNUSED	0xff
+
+
+#define STB_MIPS_SPLIT_COMMON		13
+
+
+
+typedef union {
+  struct {
+      Elf32_Word gt_current_g_value;
+      Elf32_Word gt_unused;
+  } gt_header;
+  struct {
+      Elf32_Word gt_g_value;
+      Elf32_Word gt_bytes;
+  } gt_entry;
+} Elf32_gptab;
+
+
+
+typedef struct {
+  Elf32_Word	ri_gprmask;
+  Elf32_Word	ri_cprmask[4];
+  Elf32_Sword	ri_gp_value;
+} Elf32_RegInfo;
+
+
+
+typedef struct {
+  unsigned char kind;
+
+  unsigned char size;
+  Elf32_Section section;
+
+  Elf32_Word info;
+} Elf_Options;
+
+
+
+#define ODK_NULL	0
+#define ODK_REGINFO	1
+#define ODK_EXCEPTIONS	2
+#define ODK_PAD		3
+#define ODK_HWPATCH	4
+#define ODK_FILL	5
+#define ODK_TAGS	6
+#define ODK_HWAND	7
+#define ODK_HWOR	8
+
+
+
+#define OEX_FPU_MIN	0x1f
+#define OEX_FPU_MAX	0x1f00
+#define OEX_PAGE0	0x10000
+#define OEX_SMM		0x20000
+#define OEX_FPDBUG	0x40000
+#define OEX_PRECISEFP	OEX_FPDBUG
+#define OEX_DISMISS	0x80000
+
+#define OEX_FPU_INVAL	0x10
+#define OEX_FPU_DIV0	0x08
+#define OEX_FPU_OFLO	0x04
+#define OEX_FPU_UFLO	0x02
+#define OEX_FPU_INEX	0x01
+
+
+
+#define OHW_R4KEOP	0x1
+#define OHW_R8KPFETCH	0x2
+#define OHW_R5KEOP	0x4
+#define OHW_R5KCVTL	0x8
+
+#define OPAD_PREFIX	0x1
+#define OPAD_POSTFIX	0x2
+#define OPAD_SYMBOL	0x4
+
+
+
+typedef struct {
+  Elf32_Word hwp_flags1;
+  Elf32_Word hwp_flags2;
+} Elf_Options_Hw;
+
+
+
+#define OHWA0_R4KEOP_CHECKED	0x00000001
+#define OHWA1_R4KEOP_CLEAN	0x00000002
+
+
+
+#define R_MIPS_NONE		0
+#define R_MIPS_16		1
+#define R_MIPS_32		2
+#define R_MIPS_REL32		3
+#define R_MIPS_26		4
+#define R_MIPS_HI16		5
+#define R_MIPS_LO16		6
+#define R_MIPS_GPREL16		7
+#define R_MIPS_LITERAL		8
+#define R_MIPS_GOT16		9
+#define R_MIPS_PC16		10
+#define R_MIPS_CALL16		11
+#define R_MIPS_GPREL32		12
+
+#define R_MIPS_SHIFT5		16
+#define R_MIPS_SHIFT6		17
+#define R_MIPS_64		18
+#define R_MIPS_GOT_DISP		19
+#define R_MIPS_GOT_PAGE		20
+#define R_MIPS_GOT_OFST		21
+#define R_MIPS_GOT_HI16		22
+#define R_MIPS_GOT_LO16		23
+#define R_MIPS_SUB		24
+#define R_MIPS_INSERT_A		25
+#define R_MIPS_INSERT_B		26
+#define R_MIPS_DELETE		27
+#define R_MIPS_HIGHER		28
+#define R_MIPS_HIGHEST		29
+#define R_MIPS_CALL_HI16	30
+#define R_MIPS_CALL_LO16	31
+#define R_MIPS_SCN_DISP		32
+#define R_MIPS_REL16		33
+#define R_MIPS_ADD_IMMEDIATE	34
+#define R_MIPS_PJUMP		35
+#define R_MIPS_RELGOT		36
+#define R_MIPS_JALR		37
+#define R_MIPS_TLS_DTPMOD32	38
+#define R_MIPS_TLS_DTPREL32	39
+#define R_MIPS_TLS_DTPMOD64	40
+#define R_MIPS_TLS_DTPREL64	41
+#define R_MIPS_TLS_GD		42
+#define R_MIPS_TLS_LDM		43
+#define R_MIPS_TLS_DTPREL_HI16	44
+#define R_MIPS_TLS_DTPREL_LO16	45
+#define R_MIPS_TLS_GOTTPREL	46
+#define R_MIPS_TLS_TPREL32	47
+#define R_MIPS_TLS_TPREL64	48
+#define R_MIPS_TLS_TPREL_HI16	49
+#define R_MIPS_TLS_TPREL_LO16	50
+#define R_MIPS_GLOB_DAT		51
+#define R_MIPS_COPY		126
+#define R_MIPS_JUMP_SLOT        127
+
+#define R_MIPS_NUM		128
+
+
+
+#define PT_MIPS_REGINFO	0x70000000
+#define PT_MIPS_RTPROC  0x70000001
+#define PT_MIPS_OPTIONS 0x70000002
+#define PT_MIPS_ABIFLAGS 0x70000003
+
+
+
+#define PF_MIPS_LOCAL	0x10000000
+
+
+
+#define DT_MIPS_RLD_VERSION  0x70000001
+#define DT_MIPS_TIME_STAMP   0x70000002
+#define DT_MIPS_ICHECKSUM    0x70000003
+#define DT_MIPS_IVERSION     0x70000004
+#define DT_MIPS_FLAGS	     0x70000005
+#define DT_MIPS_BASE_ADDRESS 0x70000006
+#define DT_MIPS_MSYM	     0x70000007
+#define DT_MIPS_CONFLICT     0x70000008
+#define DT_MIPS_LIBLIST	     0x70000009
+#define DT_MIPS_LOCAL_GOTNO  0x7000000a
+#define DT_MIPS_CONFLICTNO   0x7000000b
+#define DT_MIPS_LIBLISTNO    0x70000010
+#define DT_MIPS_SYMTABNO     0x70000011
+#define DT_MIPS_UNREFEXTNO   0x70000012
+#define DT_MIPS_GOTSYM	     0x70000013
+#define DT_MIPS_HIPAGENO     0x70000014
+#define DT_MIPS_RLD_MAP	     0x70000016
+#define DT_MIPS_DELTA_CLASS  0x70000017
+#define DT_MIPS_DELTA_CLASS_NO    0x70000018
+
+#define DT_MIPS_DELTA_INSTANCE    0x70000019
+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a
+
+#define DT_MIPS_DELTA_RELOC  0x7000001b
+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c
+
+#define DT_MIPS_DELTA_SYM    0x7000001d
+
+#define DT_MIPS_DELTA_SYM_NO 0x7000001e
+
+#define DT_MIPS_DELTA_CLASSSYM 0x70000020
+
+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021
+
+#define DT_MIPS_CXX_FLAGS    0x70000022
+#define DT_MIPS_PIXIE_INIT   0x70000023
+#define DT_MIPS_SYMBOL_LIB   0x70000024
+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
+#define DT_MIPS_LOCAL_GOTIDX 0x70000026
+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
+#define DT_MIPS_OPTIONS	     0x70000029
+#define DT_MIPS_INTERFACE    0x7000002a
+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
+#define DT_MIPS_INTERFACE_SIZE 0x7000002c
+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d
+
+#define DT_MIPS_PERF_SUFFIX  0x7000002e
+
+#define DT_MIPS_COMPACT_SIZE 0x7000002f
+#define DT_MIPS_GP_VALUE     0x70000030
+#define DT_MIPS_AUX_DYNAMIC  0x70000031
+
+#define DT_MIPS_PLTGOT	     0x70000032
+
+#define DT_MIPS_RWPLT        0x70000034
+#define DT_MIPS_RLD_MAP_REL  0x70000035
+#define DT_MIPS_NUM	     0x36
+
+
+
+#define RHF_NONE		   0
+#define RHF_QUICKSTART		   (1 << 0)
+#define RHF_NOTPOT		   (1 << 1)
+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)
+#define RHF_NO_MOVE		   (1 << 3)
+#define RHF_SGI_ONLY		   (1 << 4)
+#define RHF_GUARANTEE_INIT	   (1 << 5)
+#define RHF_DELTA_C_PLUS_PLUS	   (1 << 6)
+#define RHF_GUARANTEE_START_INIT   (1 << 7)
+#define RHF_PIXIE		   (1 << 8)
+#define RHF_DEFAULT_DELAY_LOAD	   (1 << 9)
+#define RHF_REQUICKSTART	   (1 << 10)
+#define RHF_REQUICKSTARTED	   (1 << 11)
+#define RHF_CORD		   (1 << 12)
+#define RHF_NO_UNRES_UNDEF	   (1 << 13)
+#define RHF_RLD_ORDER_SAFE	   (1 << 14)
+
+
+
+typedef struct {
+  Elf32_Word l_name;
+  Elf32_Word l_time_stamp;
+  Elf32_Word l_checksum;
+  Elf32_Word l_version;
+  Elf32_Word l_flags;
+} Elf32_Lib;
+
+typedef struct {
+  Elf64_Word l_name;
+  Elf64_Word l_time_stamp;
+  Elf64_Word l_checksum;
+  Elf64_Word l_version;
+  Elf64_Word l_flags;
+} Elf64_Lib;
+
+
+
+
+#define LL_NONE		  0
+#define LL_EXACT_MATCH	  (1 << 0)
+#define LL_IGNORE_INT_VER (1 << 1)
+#define LL_REQUIRE_MINOR  (1 << 2)
+#define LL_EXPORTS	  (1 << 3)
+#define LL_DELAY_LOAD	  (1 << 4)
+#define LL_DELTA	  (1 << 5)
+
+
+
+typedef Elf32_Addr Elf32_Conflict;
+
+typedef struct {
+  Elf32_Half version;
+  unsigned char isa_level;
+  unsigned char isa_rev;
+  unsigned char gpr_size;
+  unsigned char cpr1_size;
+  unsigned char cpr2_size;
+  unsigned char fp_abi;
+  Elf32_Word isa_ext;
+  Elf32_Word ases;
+  Elf32_Word flags1;
+  Elf32_Word flags2;
+} Elf_MIPS_ABIFlags_v0;
+
+#define MIPS_AFL_REG_NONE	0x00
+#define MIPS_AFL_REG_32		0x01
+#define MIPS_AFL_REG_64		0x02
+#define MIPS_AFL_REG_128	0x03
+
+#define MIPS_AFL_ASE_DSP	0x00000001
+#define MIPS_AFL_ASE_DSPR2	0x00000002
+#define MIPS_AFL_ASE_EVA	0x00000004
+#define MIPS_AFL_ASE_MCU	0x00000008
+#define MIPS_AFL_ASE_MDMX	0x00000010
+#define MIPS_AFL_ASE_MIPS3D	0x00000020
+#define MIPS_AFL_ASE_MT		0x00000040
+#define MIPS_AFL_ASE_SMARTMIPS	0x00000080
+#define MIPS_AFL_ASE_VIRT	0x00000100
+#define MIPS_AFL_ASE_MSA	0x00000200
+#define MIPS_AFL_ASE_MIPS16	0x00000400
+#define MIPS_AFL_ASE_MICROMIPS	0x00000800
+#define MIPS_AFL_ASE_XPA	0x00001000
+#define MIPS_AFL_ASE_MASK	0x00001fff
+
+#define MIPS_AFL_EXT_XLR	  1
+#define MIPS_AFL_EXT_OCTEON2	  2
+#define MIPS_AFL_EXT_OCTEONP	  3
+#define MIPS_AFL_EXT_LOONGSON_3A  4
+#define MIPS_AFL_EXT_OCTEON	  5
+#define MIPS_AFL_EXT_5900	  6
+#define MIPS_AFL_EXT_4650	  7
+#define MIPS_AFL_EXT_4010	  8
+#define MIPS_AFL_EXT_4100	  9
+#define MIPS_AFL_EXT_3900	  10
+#define MIPS_AFL_EXT_10000	  11
+#define MIPS_AFL_EXT_SB1	  12
+#define MIPS_AFL_EXT_4111	  13
+#define MIPS_AFL_EXT_4120	  14
+#define MIPS_AFL_EXT_5400	  15
+#define MIPS_AFL_EXT_5500	  16
+#define MIPS_AFL_EXT_LOONGSON_2E  17
+#define MIPS_AFL_EXT_LOONGSON_2F  18
+
+#define MIPS_AFL_FLAGS1_ODDSPREG  1
+
+enum
+{
+  Val_GNU_MIPS_ABI_FP_ANY = 0,
+  Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
+  Val_GNU_MIPS_ABI_FP_SINGLE = 2,
+  Val_GNU_MIPS_ABI_FP_SOFT = 3,
+  Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
+  Val_GNU_MIPS_ABI_FP_XX = 5,
+  Val_GNU_MIPS_ABI_FP_64 = 6,
+  Val_GNU_MIPS_ABI_FP_64A = 7,
+  Val_GNU_MIPS_ABI_FP_MAX = 7
+};
+
+
+
+
+#define EF_PARISC_TRAPNIL	0x00010000
+#define EF_PARISC_EXT		0x00020000
+#define EF_PARISC_LSB		0x00040000
+#define EF_PARISC_WIDE		0x00080000
+#define EF_PARISC_NO_KABP	0x00100000
+
+#define EF_PARISC_LAZYSWAP	0x00400000
+#define EF_PARISC_ARCH		0x0000ffff
+
+
+
+#define EFA_PARISC_1_0		    0x020b
+#define EFA_PARISC_1_1		    0x0210
+#define EFA_PARISC_2_0		    0x0214
+
+
+
+#define SHN_PARISC_ANSI_COMMON	0xff00
+
+#define SHN_PARISC_HUGE_COMMON	0xff01
+
+
+
+#define SHT_PARISC_EXT		0x70000000
+#define SHT_PARISC_UNWIND	0x70000001
+#define SHT_PARISC_DOC		0x70000002
+
+
+
+#define SHF_PARISC_SHORT	0x20000000
+#define SHF_PARISC_HUGE		0x40000000
+#define SHF_PARISC_SBP		0x80000000
+
+
+
+#define STT_PARISC_MILLICODE	13
+
+#define STT_HP_OPAQUE		(STT_LOOS + 0x1)
+#define STT_HP_STUB		(STT_LOOS + 0x2)
+
+
+
+#define R_PARISC_NONE		0
+#define R_PARISC_DIR32		1
+#define R_PARISC_DIR21L		2
+#define R_PARISC_DIR17R		3
+#define R_PARISC_DIR17F		4
+#define R_PARISC_DIR14R		6
+#define R_PARISC_PCREL32	9
+#define R_PARISC_PCREL21L	10
+#define R_PARISC_PCREL17R	11
+#define R_PARISC_PCREL17F	12
+#define R_PARISC_PCREL14R	14
+#define R_PARISC_DPREL21L	18
+#define R_PARISC_DPREL14R	22
+#define R_PARISC_GPREL21L	26
+#define R_PARISC_GPREL14R	30
+#define R_PARISC_LTOFF21L	34
+#define R_PARISC_LTOFF14R	38
+#define R_PARISC_SECREL32	41
+#define R_PARISC_SEGBASE	48
+#define R_PARISC_SEGREL32	49
+#define R_PARISC_PLTOFF21L	50
+#define R_PARISC_PLTOFF14R	54
+#define R_PARISC_LTOFF_FPTR32	57
+#define R_PARISC_LTOFF_FPTR21L	58
+#define R_PARISC_LTOFF_FPTR14R	62
+#define R_PARISC_FPTR64		64
+#define R_PARISC_PLABEL32	65
+#define R_PARISC_PLABEL21L	66
+#define R_PARISC_PLABEL14R	70
+#define R_PARISC_PCREL64	72
+#define R_PARISC_PCREL22F	74
+#define R_PARISC_PCREL14WR	75
+#define R_PARISC_PCREL14DR	76
+#define R_PARISC_PCREL16F	77
+#define R_PARISC_PCREL16WF	78
+#define R_PARISC_PCREL16DF	79
+#define R_PARISC_DIR64		80
+#define R_PARISC_DIR14WR	83
+#define R_PARISC_DIR14DR	84
+#define R_PARISC_DIR16F		85
+#define R_PARISC_DIR16WF	86
+#define R_PARISC_DIR16DF	87
+#define R_PARISC_GPREL64	88
+#define R_PARISC_GPREL14WR	91
+#define R_PARISC_GPREL14DR	92
+#define R_PARISC_GPREL16F	93
+#define R_PARISC_GPREL16WF	94
+#define R_PARISC_GPREL16DF	95
+#define R_PARISC_LTOFF64	96
+#define R_PARISC_LTOFF14WR	99
+#define R_PARISC_LTOFF14DR	100
+#define R_PARISC_LTOFF16F	101
+#define R_PARISC_LTOFF16WF	102
+#define R_PARISC_LTOFF16DF	103
+#define R_PARISC_SECREL64	104
+#define R_PARISC_SEGREL64	112
+#define R_PARISC_PLTOFF14WR	115
+#define R_PARISC_PLTOFF14DR	116
+#define R_PARISC_PLTOFF16F	117
+#define R_PARISC_PLTOFF16WF	118
+#define R_PARISC_PLTOFF16DF	119
+#define R_PARISC_LTOFF_FPTR64	120
+#define R_PARISC_LTOFF_FPTR14WR	123
+#define R_PARISC_LTOFF_FPTR14DR	124
+#define R_PARISC_LTOFF_FPTR16F	125
+#define R_PARISC_LTOFF_FPTR16WF	126
+#define R_PARISC_LTOFF_FPTR16DF	127
+#define R_PARISC_LORESERVE	128
+#define R_PARISC_COPY		128
+#define R_PARISC_IPLT		129
+#define R_PARISC_EPLT		130
+#define R_PARISC_TPREL32	153
+#define R_PARISC_TPREL21L	154
+#define R_PARISC_TPREL14R	158
+#define R_PARISC_LTOFF_TP21L	162
+#define R_PARISC_LTOFF_TP14R	166
+#define R_PARISC_LTOFF_TP14F	167
+#define R_PARISC_TPREL64	216
+#define R_PARISC_TPREL14WR	219
+#define R_PARISC_TPREL14DR	220
+#define R_PARISC_TPREL16F	221
+#define R_PARISC_TPREL16WF	222
+#define R_PARISC_TPREL16DF	223
+#define R_PARISC_LTOFF_TP64	224
+#define R_PARISC_LTOFF_TP14WR	227
+#define R_PARISC_LTOFF_TP14DR	228
+#define R_PARISC_LTOFF_TP16F	229
+#define R_PARISC_LTOFF_TP16WF	230
+#define R_PARISC_LTOFF_TP16DF	231
+#define R_PARISC_GNU_VTENTRY	232
+#define R_PARISC_GNU_VTINHERIT	233
+#define R_PARISC_TLS_GD21L	234
+#define R_PARISC_TLS_GD14R	235
+#define R_PARISC_TLS_GDCALL	236
+#define R_PARISC_TLS_LDM21L	237
+#define R_PARISC_TLS_LDM14R	238
+#define R_PARISC_TLS_LDMCALL	239
+#define R_PARISC_TLS_LDO21L	240
+#define R_PARISC_TLS_LDO14R	241
+#define R_PARISC_TLS_DTPMOD32	242
+#define R_PARISC_TLS_DTPMOD64	243
+#define R_PARISC_TLS_DTPOFF32	244
+#define R_PARISC_TLS_DTPOFF64	245
+#define R_PARISC_TLS_LE21L	R_PARISC_TPREL21L
+#define R_PARISC_TLS_LE14R	R_PARISC_TPREL14R
+#define R_PARISC_TLS_IE21L	R_PARISC_LTOFF_TP21L
+#define R_PARISC_TLS_IE14R	R_PARISC_LTOFF_TP14R
+#define R_PARISC_TLS_TPREL32	R_PARISC_TPREL32
+#define R_PARISC_TLS_TPREL64	R_PARISC_TPREL64
+#define R_PARISC_HIRESERVE	255
+
+
+
+#define PT_HP_TLS		(PT_LOOS + 0x0)
+#define PT_HP_CORE_NONE		(PT_LOOS + 0x1)
+#define PT_HP_CORE_VERSION	(PT_LOOS + 0x2)
+#define PT_HP_CORE_KERNEL	(PT_LOOS + 0x3)
+#define PT_HP_CORE_COMM		(PT_LOOS + 0x4)
+#define PT_HP_CORE_PROC		(PT_LOOS + 0x5)
+#define PT_HP_CORE_LOADABLE	(PT_LOOS + 0x6)
+#define PT_HP_CORE_STACK	(PT_LOOS + 0x7)
+#define PT_HP_CORE_SHM		(PT_LOOS + 0x8)
+#define PT_HP_CORE_MMF		(PT_LOOS + 0x9)
+#define PT_HP_PARALLEL		(PT_LOOS + 0x10)
+#define PT_HP_FASTBIND		(PT_LOOS + 0x11)
+#define PT_HP_OPT_ANNOT		(PT_LOOS + 0x12)
+#define PT_HP_HSL_ANNOT		(PT_LOOS + 0x13)
+#define PT_HP_STACK		(PT_LOOS + 0x14)
+
+#define PT_PARISC_ARCHEXT	0x70000000
+#define PT_PARISC_UNWIND	0x70000001
+
+
+
+#define PF_PARISC_SBP		0x08000000
+
+#define PF_HP_PAGE_SIZE		0x00100000
+#define PF_HP_FAR_SHARED	0x00200000
+#define PF_HP_NEAR_SHARED	0x00400000
+#define PF_HP_CODE		0x01000000
+#define PF_HP_MODIFY		0x02000000
+#define PF_HP_LAZYSWAP		0x04000000
+#define PF_HP_SBP		0x08000000
+
+
+
+
+
+
+#define EF_ALPHA_32BIT		1
+#define EF_ALPHA_CANRELAX	2
+
+
+
+
+#define SHT_ALPHA_DEBUG		0x70000001
+#define SHT_ALPHA_REGINFO	0x70000002
+
+
+
+#define SHF_ALPHA_GPREL		0x10000000
+
+
+#define STO_ALPHA_NOPV		0x80
+#define STO_ALPHA_STD_GPLOAD	0x88
+
+
+
+#define R_ALPHA_NONE		0
+#define R_ALPHA_REFLONG		1
+#define R_ALPHA_REFQUAD		2
+#define R_ALPHA_GPREL32		3
+#define R_ALPHA_LITERAL		4
+#define R_ALPHA_LITUSE		5
+#define R_ALPHA_GPDISP		6
+#define R_ALPHA_BRADDR		7
+#define R_ALPHA_HINT		8
+#define R_ALPHA_SREL16		9
+#define R_ALPHA_SREL32		10
+#define R_ALPHA_SREL64		11
+#define R_ALPHA_GPRELHIGH	17
+#define R_ALPHA_GPRELLOW	18
+#define R_ALPHA_GPREL16		19
+#define R_ALPHA_COPY		24
+#define R_ALPHA_GLOB_DAT	25
+#define R_ALPHA_JMP_SLOT	26
+#define R_ALPHA_RELATIVE	27
+#define R_ALPHA_TLS_GD_HI	28
+#define R_ALPHA_TLSGD		29
+#define R_ALPHA_TLS_LDM		30
+#define R_ALPHA_DTPMOD64	31
+#define R_ALPHA_GOTDTPREL	32
+#define R_ALPHA_DTPREL64	33
+#define R_ALPHA_DTPRELHI	34
+#define R_ALPHA_DTPRELLO	35
+#define R_ALPHA_DTPREL16	36
+#define R_ALPHA_GOTTPREL	37
+#define R_ALPHA_TPREL64		38
+#define R_ALPHA_TPRELHI		39
+#define R_ALPHA_TPRELLO		40
+#define R_ALPHA_TPREL16		41
+
+#define R_ALPHA_NUM		46
+
+
+#define LITUSE_ALPHA_ADDR	0
+#define LITUSE_ALPHA_BASE	1
+#define LITUSE_ALPHA_BYTOFF	2
+#define LITUSE_ALPHA_JSR	3
+#define LITUSE_ALPHA_TLS_GD	4
+#define LITUSE_ALPHA_TLS_LDM	5
+
+
+#define DT_ALPHA_PLTRO		(DT_LOPROC + 0)
+#define DT_ALPHA_NUM		1
+
+
+
+
+#define EF_PPC_EMB		0x80000000
+
+
+#define EF_PPC_RELOCATABLE	0x00010000
+#define EF_PPC_RELOCATABLE_LIB	0x00008000
+
+
+
+#define R_PPC_NONE		0
+#define R_PPC_ADDR32		1
+#define R_PPC_ADDR24		2
+#define R_PPC_ADDR16		3
+#define R_PPC_ADDR16_LO		4
+#define R_PPC_ADDR16_HI		5
+#define R_PPC_ADDR16_HA		6
+#define R_PPC_ADDR14		7
+#define R_PPC_ADDR14_BRTAKEN	8
+#define R_PPC_ADDR14_BRNTAKEN	9
+#define R_PPC_REL24		10
+#define R_PPC_REL14		11
+#define R_PPC_REL14_BRTAKEN	12
+#define R_PPC_REL14_BRNTAKEN	13
+#define R_PPC_GOT16		14
+#define R_PPC_GOT16_LO		15
+#define R_PPC_GOT16_HI		16
+#define R_PPC_GOT16_HA		17
+#define R_PPC_PLTREL24		18
+#define R_PPC_COPY		19
+#define R_PPC_GLOB_DAT		20
+#define R_PPC_JMP_SLOT		21
+#define R_PPC_RELATIVE		22
+#define R_PPC_LOCAL24PC		23
+#define R_PPC_UADDR32		24
+#define R_PPC_UADDR16		25
+#define R_PPC_REL32		26
+#define R_PPC_PLT32		27
+#define R_PPC_PLTREL32		28
+#define R_PPC_PLT16_LO		29
+#define R_PPC_PLT16_HI		30
+#define R_PPC_PLT16_HA		31
+#define R_PPC_SDAREL16		32
+#define R_PPC_SECTOFF		33
+#define R_PPC_SECTOFF_LO	34
+#define R_PPC_SECTOFF_HI	35
+#define R_PPC_SECTOFF_HA	36
+
+
+#define R_PPC_TLS		67
+#define R_PPC_DTPMOD32		68
+#define R_PPC_TPREL16		69
+#define R_PPC_TPREL16_LO	70
+#define R_PPC_TPREL16_HI	71
+#define R_PPC_TPREL16_HA	72
+#define R_PPC_TPREL32		73
+#define R_PPC_DTPREL16		74
+#define R_PPC_DTPREL16_LO	75
+#define R_PPC_DTPREL16_HI	76
+#define R_PPC_DTPREL16_HA	77
+#define R_PPC_DTPREL32		78
+#define R_PPC_GOT_TLSGD16	79
+#define R_PPC_GOT_TLSGD16_LO	80
+#define R_PPC_GOT_TLSGD16_HI	81
+#define R_PPC_GOT_TLSGD16_HA	82
+#define R_PPC_GOT_TLSLD16	83
+#define R_PPC_GOT_TLSLD16_LO	84
+#define R_PPC_GOT_TLSLD16_HI	85
+#define R_PPC_GOT_TLSLD16_HA	86
+#define R_PPC_GOT_TPREL16	87
+#define R_PPC_GOT_TPREL16_LO	88
+#define R_PPC_GOT_TPREL16_HI	89
+#define R_PPC_GOT_TPREL16_HA	90
+#define R_PPC_GOT_DTPREL16	91
+#define R_PPC_GOT_DTPREL16_LO	92
+#define R_PPC_GOT_DTPREL16_HI	93
+#define R_PPC_GOT_DTPREL16_HA	94
+#define R_PPC_TLSGD		95
+#define R_PPC_TLSLD		96
+
+
+#define R_PPC_EMB_NADDR32	101
+#define R_PPC_EMB_NADDR16	102
+#define R_PPC_EMB_NADDR16_LO	103
+#define R_PPC_EMB_NADDR16_HI	104
+#define R_PPC_EMB_NADDR16_HA	105
+#define R_PPC_EMB_SDAI16	106
+#define R_PPC_EMB_SDA2I16	107
+#define R_PPC_EMB_SDA2REL	108
+#define R_PPC_EMB_SDA21		109
+#define R_PPC_EMB_MRKREF	110
+#define R_PPC_EMB_RELSEC16	111
+#define R_PPC_EMB_RELST_LO	112
+#define R_PPC_EMB_RELST_HI	113
+#define R_PPC_EMB_RELST_HA	114
+#define R_PPC_EMB_BIT_FLD	115
+#define R_PPC_EMB_RELSDA	116
+
+
+#define R_PPC_DIAB_SDA21_LO	180
+#define R_PPC_DIAB_SDA21_HI	181
+#define R_PPC_DIAB_SDA21_HA	182
+#define R_PPC_DIAB_RELSDA_LO	183
+#define R_PPC_DIAB_RELSDA_HI	184
+#define R_PPC_DIAB_RELSDA_HA	185
+
+
+#define R_PPC_IRELATIVE		248
+
+
+#define R_PPC_REL16		249
+#define R_PPC_REL16_LO		250
+#define R_PPC_REL16_HI		251
+#define R_PPC_REL16_HA		252
+
+
+
+#define R_PPC_TOC16		255
+
+
+#define DT_PPC_GOT		(DT_LOPROC + 0)
+#define DT_PPC_OPT		(DT_LOPROC + 1)
+#define DT_PPC_NUM		2
+
+#define PPC_OPT_TLS		1
+
+
+#define R_PPC64_NONE		R_PPC_NONE
+#define R_PPC64_ADDR32		R_PPC_ADDR32
+#define R_PPC64_ADDR24		R_PPC_ADDR24
+#define R_PPC64_ADDR16		R_PPC_ADDR16
+#define R_PPC64_ADDR16_LO	R_PPC_ADDR16_LO
+#define R_PPC64_ADDR16_HI	R_PPC_ADDR16_HI
+#define R_PPC64_ADDR16_HA	R_PPC_ADDR16_HA
+#define R_PPC64_ADDR14		R_PPC_ADDR14
+#define R_PPC64_ADDR14_BRTAKEN	R_PPC_ADDR14_BRTAKEN
+#define R_PPC64_ADDR14_BRNTAKEN	R_PPC_ADDR14_BRNTAKEN
+#define R_PPC64_REL24		R_PPC_REL24
+#define R_PPC64_REL14		R_PPC_REL14
+#define R_PPC64_REL14_BRTAKEN	R_PPC_REL14_BRTAKEN
+#define R_PPC64_REL14_BRNTAKEN	R_PPC_REL14_BRNTAKEN
+#define R_PPC64_GOT16		R_PPC_GOT16
+#define R_PPC64_GOT16_LO	R_PPC_GOT16_LO
+#define R_PPC64_GOT16_HI	R_PPC_GOT16_HI
+#define R_PPC64_GOT16_HA	R_PPC_GOT16_HA
+
+#define R_PPC64_COPY		R_PPC_COPY
+#define R_PPC64_GLOB_DAT	R_PPC_GLOB_DAT
+#define R_PPC64_JMP_SLOT	R_PPC_JMP_SLOT
+#define R_PPC64_RELATIVE	R_PPC_RELATIVE
+
+#define R_PPC64_UADDR32		R_PPC_UADDR32
+#define R_PPC64_UADDR16		R_PPC_UADDR16
+#define R_PPC64_REL32		R_PPC_REL32
+#define R_PPC64_PLT32		R_PPC_PLT32
+#define R_PPC64_PLTREL32	R_PPC_PLTREL32
+#define R_PPC64_PLT16_LO	R_PPC_PLT16_LO
+#define R_PPC64_PLT16_HI	R_PPC_PLT16_HI
+#define R_PPC64_PLT16_HA	R_PPC_PLT16_HA
+
+#define R_PPC64_SECTOFF		R_PPC_SECTOFF
+#define R_PPC64_SECTOFF_LO	R_PPC_SECTOFF_LO
+#define R_PPC64_SECTOFF_HI	R_PPC_SECTOFF_HI
+#define R_PPC64_SECTOFF_HA	R_PPC_SECTOFF_HA
+#define R_PPC64_ADDR30		37
+#define R_PPC64_ADDR64		38
+#define R_PPC64_ADDR16_HIGHER	39
+#define R_PPC64_ADDR16_HIGHERA	40
+#define R_PPC64_ADDR16_HIGHEST	41
+#define R_PPC64_ADDR16_HIGHESTA	42
+#define R_PPC64_UADDR64		43
+#define R_PPC64_REL64		44
+#define R_PPC64_PLT64		45
+#define R_PPC64_PLTREL64	46
+#define R_PPC64_TOC16		47
+#define R_PPC64_TOC16_LO	48
+#define R_PPC64_TOC16_HI	49
+#define R_PPC64_TOC16_HA	50
+#define R_PPC64_TOC		51
+#define R_PPC64_PLTGOT16	52
+#define R_PPC64_PLTGOT16_LO	53
+#define R_PPC64_PLTGOT16_HI	54
+#define R_PPC64_PLTGOT16_HA	55
+
+#define R_PPC64_ADDR16_DS	56
+#define R_PPC64_ADDR16_LO_DS	57
+#define R_PPC64_GOT16_DS	58
+#define R_PPC64_GOT16_LO_DS	59
+#define R_PPC64_PLT16_LO_DS	60
+#define R_PPC64_SECTOFF_DS	61
+#define R_PPC64_SECTOFF_LO_DS	62
+#define R_PPC64_TOC16_DS	63
+#define R_PPC64_TOC16_LO_DS	64
+#define R_PPC64_PLTGOT16_DS	65
+#define R_PPC64_PLTGOT16_LO_DS	66
+
+
+#define R_PPC64_TLS		67
+#define R_PPC64_DTPMOD64	68
+#define R_PPC64_TPREL16		69
+#define R_PPC64_TPREL16_LO	70
+#define R_PPC64_TPREL16_HI	71
+#define R_PPC64_TPREL16_HA	72
+#define R_PPC64_TPREL64		73
+#define R_PPC64_DTPREL16	74
+#define R_PPC64_DTPREL16_LO	75
+#define R_PPC64_DTPREL16_HI	76
+#define R_PPC64_DTPREL16_HA	77
+#define R_PPC64_DTPREL64	78
+#define R_PPC64_GOT_TLSGD16	79
+#define R_PPC64_GOT_TLSGD16_LO	80
+#define R_PPC64_GOT_TLSGD16_HI	81
+#define R_PPC64_GOT_TLSGD16_HA	82
+#define R_PPC64_GOT_TLSLD16	83
+#define R_PPC64_GOT_TLSLD16_LO	84
+#define R_PPC64_GOT_TLSLD16_HI	85
+#define R_PPC64_GOT_TLSLD16_HA	86
+#define R_PPC64_GOT_TPREL16_DS	87
+#define R_PPC64_GOT_TPREL16_LO_DS 88
+#define R_PPC64_GOT_TPREL16_HI	89
+#define R_PPC64_GOT_TPREL16_HA	90
+#define R_PPC64_GOT_DTPREL16_DS	91
+#define R_PPC64_GOT_DTPREL16_LO_DS 92
+#define R_PPC64_GOT_DTPREL16_HI	93
+#define R_PPC64_GOT_DTPREL16_HA	94
+#define R_PPC64_TPREL16_DS	95
+#define R_PPC64_TPREL16_LO_DS	96
+#define R_PPC64_TPREL16_HIGHER	97
+#define R_PPC64_TPREL16_HIGHERA	98
+#define R_PPC64_TPREL16_HIGHEST	99
+#define R_PPC64_TPREL16_HIGHESTA 100
+#define R_PPC64_DTPREL16_DS	101
+#define R_PPC64_DTPREL16_LO_DS	102
+#define R_PPC64_DTPREL16_HIGHER	103
+#define R_PPC64_DTPREL16_HIGHERA 104
+#define R_PPC64_DTPREL16_HIGHEST 105
+#define R_PPC64_DTPREL16_HIGHESTA 106
+#define R_PPC64_TLSGD		107
+#define R_PPC64_TLSLD		108
+#define R_PPC64_TOCSAVE		109
+#define R_PPC64_ADDR16_HIGH	110
+#define R_PPC64_ADDR16_HIGHA	111
+#define R_PPC64_TPREL16_HIGH	112
+#define R_PPC64_TPREL16_HIGHA	113
+#define R_PPC64_DTPREL16_HIGH	114
+#define R_PPC64_DTPREL16_HIGHA	115
+
+
+#define R_PPC64_JMP_IREL	247
+#define R_PPC64_IRELATIVE	248
+#define R_PPC64_REL16		249
+#define R_PPC64_REL16_LO	250
+#define R_PPC64_REL16_HI	251
+#define R_PPC64_REL16_HA	252
+
+#define EF_PPC64_ABI	3
+
+#define DT_PPC64_GLINK  (DT_LOPROC + 0)
+#define DT_PPC64_OPD	(DT_LOPROC + 1)
+#define DT_PPC64_OPDSZ	(DT_LOPROC + 2)
+#define DT_PPC64_OPT	(DT_LOPROC + 3)
+#define DT_PPC64_NUM	4
+
+#define PPC64_OPT_TLS		1
+#define PPC64_OPT_MULTI_TOC	2
+#define PPC64_OPT_LOCALENTRY	4
+
+#define STO_PPC64_LOCAL_BIT	5
+#define STO_PPC64_LOCAL_MASK	0xe0
+#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc)
+
+
+#define EF_ARM_RELEXEC		0x01
+#define EF_ARM_HASENTRY		0x02
+#define EF_ARM_INTERWORK	0x04
+#define EF_ARM_APCS_26		0x08
+#define EF_ARM_APCS_FLOAT	0x10
+#define EF_ARM_PIC		0x20
+#define EF_ARM_ALIGN8		0x40
+#define EF_ARM_NEW_ABI		0x80
+#define EF_ARM_OLD_ABI		0x100
+#define EF_ARM_SOFT_FLOAT	0x200
+#define EF_ARM_VFP_FLOAT	0x400
+#define EF_ARM_MAVERICK_FLOAT	0x800
+
+#define EF_ARM_ABI_FLOAT_SOFT	0x200
+#define EF_ARM_ABI_FLOAT_HARD	0x400
+
+
+#define EF_ARM_SYMSARESORTED	0x04
+#define EF_ARM_DYNSYMSUSESEGIDX	0x08
+#define EF_ARM_MAPSYMSFIRST	0x10
+#define EF_ARM_EABIMASK		0XFF000000
+
+
+#define EF_ARM_BE8	    0x00800000
+#define EF_ARM_LE8	    0x00400000
+
+#define EF_ARM_EABI_VERSION(flags)	((flags) & EF_ARM_EABIMASK)
+#define EF_ARM_EABI_UNKNOWN	0x00000000
+#define EF_ARM_EABI_VER1	0x01000000
+#define EF_ARM_EABI_VER2	0x02000000
+#define EF_ARM_EABI_VER3	0x03000000
+#define EF_ARM_EABI_VER4	0x04000000
+#define EF_ARM_EABI_VER5	0x05000000
+
+
+#define STT_ARM_TFUNC		STT_LOPROC
+#define STT_ARM_16BIT		STT_HIPROC
+
+
+#define SHF_ARM_ENTRYSECT	0x10000000
+#define SHF_ARM_COMDEF		0x80000000
+
+
+
+#define PF_ARM_SB		0x10000000
+
+#define PF_ARM_PI		0x20000000
+#define PF_ARM_ABS		0x40000000
+
+
+#define PT_ARM_EXIDX		(PT_LOPROC + 1)
+
+
+#define SHT_ARM_EXIDX		(SHT_LOPROC + 1)
+#define SHT_ARM_PREEMPTMAP	(SHT_LOPROC + 2)
+#define SHT_ARM_ATTRIBUTES	(SHT_LOPROC + 3)
+
+#define R_AARCH64_NONE            0
+#define R_AARCH64_P32_ABS32	1
+#define R_AARCH64_P32_COPY	180
+#define R_AARCH64_P32_GLOB_DAT	181
+#define R_AARCH64_P32_JUMP_SLOT	182
+#define R_AARCH64_P32_RELATIVE	183
+#define R_AARCH64_P32_TLS_DTPMOD 184
+#define R_AARCH64_P32_TLS_DTPREL 185
+#define R_AARCH64_P32_TLS_TPREL	186
+#define R_AARCH64_P32_TLSDESC	187
+#define R_AARCH64_P32_IRELATIVE	188
+#define R_AARCH64_ABS64         257
+#define R_AARCH64_ABS32         258
+#define R_AARCH64_ABS16		259
+#define R_AARCH64_PREL64	260
+#define R_AARCH64_PREL32	261
+#define R_AARCH64_PREL16	262
+#define R_AARCH64_MOVW_UABS_G0	263
+#define R_AARCH64_MOVW_UABS_G0_NC 264
+#define R_AARCH64_MOVW_UABS_G1	265
+#define R_AARCH64_MOVW_UABS_G1_NC 266
+#define R_AARCH64_MOVW_UABS_G2	267
+#define R_AARCH64_MOVW_UABS_G2_NC 268
+#define R_AARCH64_MOVW_UABS_G3	269
+#define R_AARCH64_MOVW_SABS_G0	270
+#define R_AARCH64_MOVW_SABS_G1	271
+#define R_AARCH64_MOVW_SABS_G2	272
+#define R_AARCH64_LD_PREL_LO19	273
+#define R_AARCH64_ADR_PREL_LO21	274
+#define R_AARCH64_ADR_PREL_PG_HI21 275
+#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
+#define R_AARCH64_ADD_ABS_LO12_NC 277
+#define R_AARCH64_LDST8_ABS_LO12_NC 278
+#define R_AARCH64_TSTBR14	279
+#define R_AARCH64_CONDBR19	280
+#define R_AARCH64_JUMP26	282
+#define R_AARCH64_CALL26	283
+#define R_AARCH64_LDST16_ABS_LO12_NC 284
+#define R_AARCH64_LDST32_ABS_LO12_NC 285
+#define R_AARCH64_LDST64_ABS_LO12_NC 286
+#define R_AARCH64_MOVW_PREL_G0	287
+#define R_AARCH64_MOVW_PREL_G0_NC 288
+#define R_AARCH64_MOVW_PREL_G1	289
+#define R_AARCH64_MOVW_PREL_G1_NC 290
+#define R_AARCH64_MOVW_PREL_G2	291
+#define R_AARCH64_MOVW_PREL_G2_NC 292
+#define R_AARCH64_MOVW_PREL_G3	293
+#define R_AARCH64_LDST128_ABS_LO12_NC 299
+#define R_AARCH64_MOVW_GOTOFF_G0 300
+#define R_AARCH64_MOVW_GOTOFF_G0_NC 301
+#define R_AARCH64_MOVW_GOTOFF_G1 302
+#define R_AARCH64_MOVW_GOTOFF_G1_NC 303
+#define R_AARCH64_MOVW_GOTOFF_G2 304
+#define R_AARCH64_MOVW_GOTOFF_G2_NC 305
+#define R_AARCH64_MOVW_GOTOFF_G3 306
+#define R_AARCH64_GOTREL64	307
+#define R_AARCH64_GOTREL32	308
+#define R_AARCH64_GOT_LD_PREL19	309
+#define R_AARCH64_LD64_GOTOFF_LO15 310
+#define R_AARCH64_ADR_GOT_PAGE	311
+#define R_AARCH64_LD64_GOT_LO12_NC 312
+#define R_AARCH64_LD64_GOTPAGE_LO15 313
+#define R_AARCH64_TLSGD_ADR_PREL21 512
+#define R_AARCH64_TLSGD_ADR_PAGE21 513
+#define R_AARCH64_TLSGD_ADD_LO12_NC 514
+#define R_AARCH64_TLSGD_MOVW_G1	515
+#define R_AARCH64_TLSGD_MOVW_G0_NC 516
+#define R_AARCH64_TLSLD_ADR_PREL21 517
+#define R_AARCH64_TLSLD_ADR_PAGE21 518
+#define R_AARCH64_TLSLD_ADD_LO12_NC 519
+#define R_AARCH64_TLSLD_MOVW_G1	520
+#define R_AARCH64_TLSLD_MOVW_G0_NC 521
+#define R_AARCH64_TLSLD_LD_PREL19 522
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527
+#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540
+#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541
+#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542
+#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543
+#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548
+#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559
+#define R_AARCH64_TLSDESC_LD_PREL19 560
+#define R_AARCH64_TLSDESC_ADR_PREL21 561
+#define R_AARCH64_TLSDESC_ADR_PAGE21 562
+#define R_AARCH64_TLSDESC_LD64_LO12 563
+#define R_AARCH64_TLSDESC_ADD_LO12 564
+#define R_AARCH64_TLSDESC_OFF_G1 565
+#define R_AARCH64_TLSDESC_OFF_G0_NC 566
+#define R_AARCH64_TLSDESC_LDR	567
+#define R_AARCH64_TLSDESC_ADD	568
+#define R_AARCH64_TLSDESC_CALL	569
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573
+#define R_AARCH64_COPY         1024
+#define R_AARCH64_GLOB_DAT     1025
+#define R_AARCH64_JUMP_SLOT    1026
+#define R_AARCH64_RELATIVE     1027
+#define R_AARCH64_TLS_DTPMOD   1028
+#define R_AARCH64_TLS_DTPMOD64 1028
+#define R_AARCH64_TLS_DTPREL   1029
+#define R_AARCH64_TLS_DTPREL64 1029
+#define R_AARCH64_TLS_TPREL    1030
+#define R_AARCH64_TLS_TPREL64  1030
+#define R_AARCH64_TLSDESC      1031
+
+
+#define R_ARM_NONE		0
+#define R_ARM_PC24		1
+#define R_ARM_ABS32		2
+#define R_ARM_REL32		3
+#define R_ARM_PC13		4
+#define R_ARM_ABS16		5
+#define R_ARM_ABS12		6
+#define R_ARM_THM_ABS5		7
+#define R_ARM_ABS8		8
+#define R_ARM_SBREL32		9
+#define R_ARM_THM_PC22		10
+#define R_ARM_THM_PC8		11
+#define R_ARM_AMP_VCALL9	12
+#define R_ARM_TLS_DESC		13
+#define R_ARM_THM_SWI8		14
+#define R_ARM_XPC25		15
+#define R_ARM_THM_XPC22		16
+#define R_ARM_TLS_DTPMOD32	17
+#define R_ARM_TLS_DTPOFF32	18
+#define R_ARM_TLS_TPOFF32	19
+#define R_ARM_COPY		20
+#define R_ARM_GLOB_DAT		21
+#define R_ARM_JUMP_SLOT		22
+#define R_ARM_RELATIVE		23
+#define R_ARM_GOTOFF		24
+#define R_ARM_GOTPC		25
+#define R_ARM_GOT32		26
+#define R_ARM_PLT32		27
+#define R_ARM_CALL		28
+#define R_ARM_JUMP24		29
+#define R_ARM_THM_JUMP24	30
+#define R_ARM_BASE_ABS		31
+#define R_ARM_ALU_PCREL_7_0	32
+#define R_ARM_ALU_PCREL_15_8	33
+#define R_ARM_ALU_PCREL_23_15	34
+#define R_ARM_LDR_SBREL_11_0	35
+#define R_ARM_ALU_SBREL_19_12	36
+#define R_ARM_ALU_SBREL_27_20	37
+#define R_ARM_TARGET1		38
+#define R_ARM_SBREL31		39
+#define R_ARM_V4BX		40
+#define R_ARM_TARGET2		41
+#define R_ARM_PREL31		42
+#define R_ARM_MOVW_ABS_NC	43
+#define R_ARM_MOVT_ABS		44
+#define R_ARM_MOVW_PREL_NC	45
+#define R_ARM_MOVT_PREL		46
+#define R_ARM_THM_MOVW_ABS_NC	47
+#define R_ARM_THM_MOVT_ABS	48
+#define R_ARM_THM_MOVW_PREL_NC	49
+#define R_ARM_THM_MOVT_PREL	50
+#define R_ARM_THM_JUMP19	51
+#define R_ARM_THM_JUMP6		52
+#define R_ARM_THM_ALU_PREL_11_0	53
+#define R_ARM_THM_PC12		54
+#define R_ARM_ABS32_NOI		55
+#define R_ARM_REL32_NOI		56
+#define R_ARM_ALU_PC_G0_NC	57
+#define R_ARM_ALU_PC_G0		58
+#define R_ARM_ALU_PC_G1_NC	59
+#define R_ARM_ALU_PC_G1		60
+#define R_ARM_ALU_PC_G2		61
+#define R_ARM_LDR_PC_G1		62
+#define R_ARM_LDR_PC_G2		63
+#define R_ARM_LDRS_PC_G0	64
+#define R_ARM_LDRS_PC_G1	65
+#define R_ARM_LDRS_PC_G2	66
+#define R_ARM_LDC_PC_G0		67
+#define R_ARM_LDC_PC_G1		68
+#define R_ARM_LDC_PC_G2		69
+#define R_ARM_ALU_SB_G0_NC	70
+#define R_ARM_ALU_SB_G0		71
+#define R_ARM_ALU_SB_G1_NC	72
+#define R_ARM_ALU_SB_G1		73
+#define R_ARM_ALU_SB_G2		74
+#define R_ARM_LDR_SB_G0		75
+#define R_ARM_LDR_SB_G1		76
+#define R_ARM_LDR_SB_G2		77
+#define R_ARM_LDRS_SB_G0	78
+#define R_ARM_LDRS_SB_G1	79
+#define R_ARM_LDRS_SB_G2	80
+#define R_ARM_LDC_SB_G0		81
+#define R_ARM_LDC_SB_G1		82
+#define R_ARM_LDC_SB_G2		83
+#define R_ARM_MOVW_BREL_NC	84
+#define R_ARM_MOVT_BREL		85
+#define R_ARM_MOVW_BREL		86
+#define R_ARM_THM_MOVW_BREL_NC	87
+#define R_ARM_THM_MOVT_BREL	88
+#define R_ARM_THM_MOVW_BREL	89
+#define R_ARM_TLS_GOTDESC	90
+#define R_ARM_TLS_CALL		91
+#define R_ARM_TLS_DESCSEQ	92
+#define R_ARM_THM_TLS_CALL	93
+#define R_ARM_PLT32_ABS		94
+#define R_ARM_GOT_ABS		95
+#define R_ARM_GOT_PREL		96
+#define R_ARM_GOT_BREL12	97
+#define R_ARM_GOTOFF12		98
+#define R_ARM_GOTRELAX		99
+#define R_ARM_GNU_VTENTRY	100
+#define R_ARM_GNU_VTINHERIT	101
+#define R_ARM_THM_PC11		102
+#define R_ARM_THM_PC9		103
+#define R_ARM_TLS_GD32		104
+
+#define R_ARM_TLS_LDM32		105
+
+#define R_ARM_TLS_LDO32		106
+
+#define R_ARM_TLS_IE32		107
+
+#define R_ARM_TLS_LE32		108
+#define R_ARM_TLS_LDO12		109
+#define R_ARM_TLS_LE12		110
+#define R_ARM_TLS_IE12GP	111
+#define R_ARM_ME_TOO		128
+#define R_ARM_THM_TLS_DESCSEQ	129
+#define R_ARM_THM_TLS_DESCSEQ16	129
+#define R_ARM_THM_TLS_DESCSEQ32	130
+#define R_ARM_THM_GOT_BREL12	131
+#define R_ARM_IRELATIVE		160
+#define R_ARM_RXPC25		249
+#define R_ARM_RSBREL32		250
+#define R_ARM_THM_RPC22		251
+#define R_ARM_RREL32		252
+#define R_ARM_RABS22		253
+#define R_ARM_RPC24		254
+#define R_ARM_RBASE		255
+
+#define R_ARM_NUM		256
+
+
+#define R_CKCORE_NONE               0
+#define R_CKCORE_ADDR32             1
+#define R_CKCORE_PCRELIMM8BY4       2
+#define R_CKCORE_PCRELIMM11BY2      3
+#define R_CKCORE_PCREL32            5
+#define R_CKCORE_PCRELJSR_IMM11BY2  6
+#define R_CKCORE_RELATIVE           9
+#define R_CKCORE_COPY               10
+#define R_CKCORE_GLOB_DAT           11
+#define R_CKCORE_JUMP_SLOT          12
+#define R_CKCORE_GOTOFF             13
+#define R_CKCORE_GOTPC              14
+#define R_CKCORE_GOT32              15
+#define R_CKCORE_PLT32              16
+#define R_CKCORE_ADDRGOT            17
+#define R_CKCORE_ADDRPLT            18
+#define R_CKCORE_PCREL_IMM26BY2     19
+#define R_CKCORE_PCREL_IMM16BY2     20
+#define R_CKCORE_PCREL_IMM16BY4     21
+#define R_CKCORE_PCREL_IMM10BY2     22
+#define R_CKCORE_PCREL_IMM10BY4     23
+#define R_CKCORE_ADDR_HI16          24
+#define R_CKCORE_ADDR_LO16          25
+#define R_CKCORE_GOTPC_HI16         26
+#define R_CKCORE_GOTPC_LO16         27
+#define R_CKCORE_GOTOFF_HI16        28
+#define R_CKCORE_GOTOFF_LO16        29
+#define R_CKCORE_GOT12              30
+#define R_CKCORE_GOT_HI16           31
+#define R_CKCORE_GOT_LO16           32
+#define R_CKCORE_PLT12              33
+#define R_CKCORE_PLT_HI16           34
+#define R_CKCORE_PLT_LO16           35
+#define R_CKCORE_ADDRGOT_HI16       36
+#define R_CKCORE_ADDRGOT_LO16       37
+#define R_CKCORE_ADDRPLT_HI16       38
+#define R_CKCORE_ADDRPLT_LO16       39
+#define R_CKCORE_PCREL_JSR_IMM26BY2 40
+#define R_CKCORE_TOFFSET_LO16       41
+#define R_CKCORE_DOFFSET_LO16       42
+#define R_CKCORE_PCREL_IMM18BY2     43
+#define R_CKCORE_DOFFSET_IMM18      44
+#define R_CKCORE_DOFFSET_IMM18BY2   45
+#define R_CKCORE_DOFFSET_IMM18BY4   46
+#define R_CKCORE_GOT_IMM18BY4       48
+#define R_CKCORE_PLT_IMM18BY4       49
+#define R_CKCORE_PCREL_IMM7BY4      50
+#define R_CKCORE_TLS_LE32           51
+#define R_CKCORE_TLS_IE32           52
+#define R_CKCORE_TLS_GD32           53
+#define R_CKCORE_TLS_LDM32          54
+#define R_CKCORE_TLS_LDO32          55
+#define R_CKCORE_TLS_DTPMOD32       56
+#define R_CKCORE_TLS_DTPOFF32       57
+#define R_CKCORE_TLS_TPOFF32        58
+
+
+#define EF_IA_64_MASKOS		0x0000000f
+#define EF_IA_64_ABI64		0x00000010
+#define EF_IA_64_ARCH		0xff000000
+
+
+#define PT_IA_64_ARCHEXT	(PT_LOPROC + 0)
+#define PT_IA_64_UNWIND		(PT_LOPROC + 1)
+#define PT_IA_64_HP_OPT_ANOT	(PT_LOOS + 0x12)
+#define PT_IA_64_HP_HSL_ANOT	(PT_LOOS + 0x13)
+#define PT_IA_64_HP_STACK	(PT_LOOS + 0x14)
+
+
+#define PF_IA_64_NORECOV	0x80000000
+
+
+#define SHT_IA_64_EXT		(SHT_LOPROC + 0)
+#define SHT_IA_64_UNWIND	(SHT_LOPROC + 1)
+
+
+#define SHF_IA_64_SHORT		0x10000000
+#define SHF_IA_64_NORECOV	0x20000000
+
+
+#define DT_IA_64_PLT_RESERVE	(DT_LOPROC + 0)
+#define DT_IA_64_NUM		1
+
+
+#define R_IA64_NONE		0x00
+#define R_IA64_IMM14		0x21
+#define R_IA64_IMM22		0x22
+#define R_IA64_IMM64		0x23
+#define R_IA64_DIR32MSB		0x24
+#define R_IA64_DIR32LSB		0x25
+#define R_IA64_DIR64MSB		0x26
+#define R_IA64_DIR64LSB		0x27
+#define R_IA64_GPREL22		0x2a
+#define R_IA64_GPREL64I		0x2b
+#define R_IA64_GPREL32MSB	0x2c
+#define R_IA64_GPREL32LSB	0x2d
+#define R_IA64_GPREL64MSB	0x2e
+#define R_IA64_GPREL64LSB	0x2f
+#define R_IA64_LTOFF22		0x32
+#define R_IA64_LTOFF64I		0x33
+#define R_IA64_PLTOFF22		0x3a
+#define R_IA64_PLTOFF64I	0x3b
+#define R_IA64_PLTOFF64MSB	0x3e
+#define R_IA64_PLTOFF64LSB	0x3f
+#define R_IA64_FPTR64I		0x43
+#define R_IA64_FPTR32MSB	0x44
+#define R_IA64_FPTR32LSB	0x45
+#define R_IA64_FPTR64MSB	0x46
+#define R_IA64_FPTR64LSB	0x47
+#define R_IA64_PCREL60B		0x48
+#define R_IA64_PCREL21B		0x49
+#define R_IA64_PCREL21M		0x4a
+#define R_IA64_PCREL21F		0x4b
+#define R_IA64_PCREL32MSB	0x4c
+#define R_IA64_PCREL32LSB	0x4d
+#define R_IA64_PCREL64MSB	0x4e
+#define R_IA64_PCREL64LSB	0x4f
+#define R_IA64_LTOFF_FPTR22	0x52
+#define R_IA64_LTOFF_FPTR64I	0x53
+#define R_IA64_LTOFF_FPTR32MSB	0x54
+#define R_IA64_LTOFF_FPTR32LSB	0x55
+#define R_IA64_LTOFF_FPTR64MSB	0x56
+#define R_IA64_LTOFF_FPTR64LSB	0x57
+#define R_IA64_SEGREL32MSB	0x5c
+#define R_IA64_SEGREL32LSB	0x5d
+#define R_IA64_SEGREL64MSB	0x5e
+#define R_IA64_SEGREL64LSB	0x5f
+#define R_IA64_SECREL32MSB	0x64
+#define R_IA64_SECREL32LSB	0x65
+#define R_IA64_SECREL64MSB	0x66
+#define R_IA64_SECREL64LSB	0x67
+#define R_IA64_REL32MSB		0x6c
+#define R_IA64_REL32LSB		0x6d
+#define R_IA64_REL64MSB		0x6e
+#define R_IA64_REL64LSB		0x6f
+#define R_IA64_LTV32MSB		0x74
+#define R_IA64_LTV32LSB		0x75
+#define R_IA64_LTV64MSB		0x76
+#define R_IA64_LTV64LSB		0x77
+#define R_IA64_PCREL21BI	0x79
+#define R_IA64_PCREL22		0x7a
+#define R_IA64_PCREL64I		0x7b
+#define R_IA64_IPLTMSB		0x80
+#define R_IA64_IPLTLSB		0x81
+#define R_IA64_COPY		0x84
+#define R_IA64_SUB		0x85
+#define R_IA64_LTOFF22X		0x86
+#define R_IA64_LDXMOV		0x87
+#define R_IA64_TPREL14		0x91
+#define R_IA64_TPREL22		0x92
+#define R_IA64_TPREL64I		0x93
+#define R_IA64_TPREL64MSB	0x96
+#define R_IA64_TPREL64LSB	0x97
+#define R_IA64_LTOFF_TPREL22	0x9a
+#define R_IA64_DTPMOD64MSB	0xa6
+#define R_IA64_DTPMOD64LSB	0xa7
+#define R_IA64_LTOFF_DTPMOD22	0xaa
+#define R_IA64_DTPREL14		0xb1
+#define R_IA64_DTPREL22		0xb2
+#define R_IA64_DTPREL64I	0xb3
+#define R_IA64_DTPREL32MSB	0xb4
+#define R_IA64_DTPREL32LSB	0xb5
+#define R_IA64_DTPREL64MSB	0xb6
+#define R_IA64_DTPREL64LSB	0xb7
+#define R_IA64_LTOFF_DTPREL22	0xba
+
+
+#define EF_SH_MACH_MASK		0x1f
+#define EF_SH_UNKNOWN		0x0
+#define EF_SH1			0x1
+#define EF_SH2			0x2
+#define EF_SH3			0x3
+#define EF_SH_DSP		0x4
+#define EF_SH3_DSP		0x5
+#define EF_SH4AL_DSP		0x6
+#define EF_SH3E			0x8
+#define EF_SH4			0x9
+#define EF_SH2E			0xb
+#define EF_SH4A			0xc
+#define EF_SH2A			0xd
+#define EF_SH4_NOFPU		0x10
+#define EF_SH4A_NOFPU		0x11
+#define EF_SH4_NOMMU_NOFPU	0x12
+#define EF_SH2A_NOFPU		0x13
+#define EF_SH3_NOMMU		0x14
+#define EF_SH2A_SH4_NOFPU	0x15
+#define EF_SH2A_SH3_NOFPU	0x16
+#define EF_SH2A_SH4		0x17
+#define EF_SH2A_SH3E		0x18
+
+#define	R_SH_NONE		0
+#define	R_SH_DIR32		1
+#define	R_SH_REL32		2
+#define	R_SH_DIR8WPN		3
+#define	R_SH_IND12W		4
+#define	R_SH_DIR8WPL		5
+#define	R_SH_DIR8WPZ		6
+#define	R_SH_DIR8BP		7
+#define	R_SH_DIR8W		8
+#define	R_SH_DIR8L		9
+#define	R_SH_SWITCH16		25
+#define	R_SH_SWITCH32		26
+#define	R_SH_USES		27
+#define	R_SH_COUNT		28
+#define	R_SH_ALIGN		29
+#define	R_SH_CODE		30
+#define	R_SH_DATA		31
+#define	R_SH_LABEL		32
+#define	R_SH_SWITCH8		33
+#define	R_SH_GNU_VTINHERIT	34
+#define	R_SH_GNU_VTENTRY	35
+#define	R_SH_TLS_GD_32		144
+#define	R_SH_TLS_LD_32		145
+#define	R_SH_TLS_LDO_32		146
+#define	R_SH_TLS_IE_32		147
+#define	R_SH_TLS_LE_32		148
+#define	R_SH_TLS_DTPMOD32	149
+#define	R_SH_TLS_DTPOFF32	150
+#define	R_SH_TLS_TPOFF32	151
+#define	R_SH_GOT32		160
+#define	R_SH_PLT32		161
+#define	R_SH_COPY		162
+#define	R_SH_GLOB_DAT		163
+#define	R_SH_JMP_SLOT		164
+#define	R_SH_RELATIVE		165
+#define	R_SH_GOTOFF		166
+#define	R_SH_GOTPC		167
+#define	R_SH_GOT20		201
+#define	R_SH_GOTOFF20		202
+#define	R_SH_GOTFUNCDESC	203
+#define	R_SH_GOTFUNCDEST20	204
+#define	R_SH_GOTOFFFUNCDESC	205
+#define	R_SH_GOTOFFFUNCDEST20	206
+#define	R_SH_FUNCDESC		207
+#define	R_SH_FUNCDESC_VALUE	208
+
+#define	R_SH_NUM		256
+
+
+
+#define R_390_NONE		0
+#define R_390_8			1
+#define R_390_12		2
+#define R_390_16		3
+#define R_390_32		4
+#define R_390_PC32		5
+#define R_390_GOT12		6
+#define R_390_GOT32		7
+#define R_390_PLT32		8
+#define R_390_COPY		9
+#define R_390_GLOB_DAT		10
+#define R_390_JMP_SLOT		11
+#define R_390_RELATIVE		12
+#define R_390_GOTOFF32		13
+#define R_390_GOTPC		14
+#define R_390_GOT16		15
+#define R_390_PC16		16
+#define R_390_PC16DBL		17
+#define R_390_PLT16DBL		18
+#define R_390_PC32DBL		19
+#define R_390_PLT32DBL		20
+#define R_390_GOTPCDBL		21
+#define R_390_64		22
+#define R_390_PC64		23
+#define R_390_GOT64		24
+#define R_390_PLT64		25
+#define R_390_GOTENT		26
+#define R_390_GOTOFF16		27
+#define R_390_GOTOFF64		28
+#define R_390_GOTPLT12		29
+#define R_390_GOTPLT16		30
+#define R_390_GOTPLT32		31
+#define R_390_GOTPLT64		32
+#define R_390_GOTPLTENT		33
+#define R_390_PLTOFF16		34
+#define R_390_PLTOFF32		35
+#define R_390_PLTOFF64		36
+#define R_390_TLS_LOAD		37
+#define R_390_TLS_GDCALL	38
+
+#define R_390_TLS_LDCALL	39
+
+#define R_390_TLS_GD32		40
+
+#define R_390_TLS_GD64		41
+
+#define R_390_TLS_GOTIE12	42
+
+#define R_390_TLS_GOTIE32	43
+
+#define R_390_TLS_GOTIE64	44
+
+#define R_390_TLS_LDM32		45
+
+#define R_390_TLS_LDM64		46
+
+#define R_390_TLS_IE32		47
+
+#define R_390_TLS_IE64		48
+
+#define R_390_TLS_IEENT		49
+
+#define R_390_TLS_LE32		50
+
+#define R_390_TLS_LE64		51
+
+#define R_390_TLS_LDO32		52
+
+#define R_390_TLS_LDO64		53
+
+#define R_390_TLS_DTPMOD	54
+#define R_390_TLS_DTPOFF	55
+#define R_390_TLS_TPOFF		56
+
+#define R_390_20		57
+#define R_390_GOT20		58
+#define R_390_GOTPLT20		59
+#define R_390_TLS_GOTIE20	60
+
+
+#define R_390_NUM		61
+
+
+
+#define R_CRIS_NONE		0
+#define R_CRIS_8		1
+#define R_CRIS_16		2
+#define R_CRIS_32		3
+#define R_CRIS_8_PCREL		4
+#define R_CRIS_16_PCREL		5
+#define R_CRIS_32_PCREL		6
+#define R_CRIS_GNU_VTINHERIT	7
+#define R_CRIS_GNU_VTENTRY	8
+#define R_CRIS_COPY		9
+#define R_CRIS_GLOB_DAT		10
+#define R_CRIS_JUMP_SLOT	11
+#define R_CRIS_RELATIVE		12
+#define R_CRIS_16_GOT		13
+#define R_CRIS_32_GOT		14
+#define R_CRIS_16_GOTPLT	15
+#define R_CRIS_32_GOTPLT	16
+#define R_CRIS_32_GOTREL	17
+#define R_CRIS_32_PLT_GOTREL	18
+#define R_CRIS_32_PLT_PCREL	19
+
+#define R_CRIS_NUM		20
+
+
+
+#define R_X86_64_NONE		0
+#define R_X86_64_64		1
+#define R_X86_64_PC32		2
+#define R_X86_64_GOT32		3
+#define R_X86_64_PLT32		4
+#define R_X86_64_COPY		5
+#define R_X86_64_GLOB_DAT	6
+#define R_X86_64_JUMP_SLOT	7
+#define R_X86_64_RELATIVE	8
+#define R_X86_64_GOTPCREL	9
+
+#define R_X86_64_32		10
+#define R_X86_64_32S		11
+#define R_X86_64_16		12
+#define R_X86_64_PC16		13
+#define R_X86_64_8		14
+#define R_X86_64_PC8		15
+#define R_X86_64_DTPMOD64	16
+#define R_X86_64_DTPOFF64	17
+#define R_X86_64_TPOFF64	18
+#define R_X86_64_TLSGD		19
+
+#define R_X86_64_TLSLD		20
+
+#define R_X86_64_DTPOFF32	21
+#define R_X86_64_GOTTPOFF	22
+
+#define R_X86_64_TPOFF32	23
+#define R_X86_64_PC64		24
+#define R_X86_64_GOTOFF64	25
+#define R_X86_64_GOTPC32	26
+#define R_X86_64_GOT64		27
+#define R_X86_64_GOTPCREL64	28
+#define R_X86_64_GOTPC64	29
+#define R_X86_64_GOTPLT64	30
+#define R_X86_64_PLTOFF64	31
+#define R_X86_64_SIZE32		32
+#define R_X86_64_SIZE64		33
+
+#define R_X86_64_GOTPC32_TLSDESC 34
+#define R_X86_64_TLSDESC_CALL   35
+
+#define R_X86_64_TLSDESC        36
+#define R_X86_64_IRELATIVE	37
+#define R_X86_64_RELATIVE64	38
+#define R_X86_64_GOTPCRELX	41
+#define R_X86_64_REX_GOTPCRELX	42
+#define R_X86_64_NUM		43
+
+
+
+#define R_MN10300_NONE		0
+#define R_MN10300_32		1
+#define R_MN10300_16		2
+#define R_MN10300_8		3
+#define R_MN10300_PCREL32	4
+#define R_MN10300_PCREL16	5
+#define R_MN10300_PCREL8	6
+#define R_MN10300_GNU_VTINHERIT	7
+#define R_MN10300_GNU_VTENTRY	8
+#define R_MN10300_24		9
+#define R_MN10300_GOTPC32	10
+#define R_MN10300_GOTPC16	11
+#define R_MN10300_GOTOFF32	12
+#define R_MN10300_GOTOFF24	13
+#define R_MN10300_GOTOFF16	14
+#define R_MN10300_PLT32		15
+#define R_MN10300_PLT16		16
+#define R_MN10300_GOT32		17
+#define R_MN10300_GOT24		18
+#define R_MN10300_GOT16		19
+#define R_MN10300_COPY		20
+#define R_MN10300_GLOB_DAT	21
+#define R_MN10300_JMP_SLOT	22
+#define R_MN10300_RELATIVE	23
+
+#define R_MN10300_NUM		24
+
+
+
+#define R_M32R_NONE		0
+#define R_M32R_16		1
+#define R_M32R_32		2
+#define R_M32R_24		3
+#define R_M32R_10_PCREL		4
+#define R_M32R_18_PCREL		5
+#define R_M32R_26_PCREL		6
+#define R_M32R_HI16_ULO		7
+#define R_M32R_HI16_SLO		8
+#define R_M32R_LO16		9
+#define R_M32R_SDA16		10
+#define R_M32R_GNU_VTINHERIT	11
+#define R_M32R_GNU_VTENTRY	12
+
+#define R_M32R_16_RELA		33
+#define R_M32R_32_RELA		34
+#define R_M32R_24_RELA		35
+#define R_M32R_10_PCREL_RELA	36
+#define R_M32R_18_PCREL_RELA	37
+#define R_M32R_26_PCREL_RELA	38
+#define R_M32R_HI16_ULO_RELA	39
+#define R_M32R_HI16_SLO_RELA	40
+#define R_M32R_LO16_RELA	41
+#define R_M32R_SDA16_RELA	42
+#define R_M32R_RELA_GNU_VTINHERIT	43
+#define R_M32R_RELA_GNU_VTENTRY	44
+#define R_M32R_REL32		45
+
+#define R_M32R_GOT24		48
+#define R_M32R_26_PLTREL	49
+#define R_M32R_COPY		50
+#define R_M32R_GLOB_DAT		51
+#define R_M32R_JMP_SLOT		52
+#define R_M32R_RELATIVE		53
+#define R_M32R_GOTOFF		54
+#define R_M32R_GOTPC24		55
+#define R_M32R_GOT16_HI_ULO	56
+
+#define R_M32R_GOT16_HI_SLO	57
+
+#define R_M32R_GOT16_LO		58
+#define R_M32R_GOTPC_HI_ULO	59
+
+#define R_M32R_GOTPC_HI_SLO	60
+
+#define R_M32R_GOTPC_LO		61
+
+#define R_M32R_GOTOFF_HI_ULO	62
+
+#define R_M32R_GOTOFF_HI_SLO	63
+
+#define R_M32R_GOTOFF_LO	64
+#define R_M32R_NUM		256
+
+#define R_MICROBLAZE_NONE 0
+#define R_MICROBLAZE_32 1
+#define R_MICROBLAZE_32_PCREL 2
+#define R_MICROBLAZE_64_PCREL 3
+#define R_MICROBLAZE_32_PCREL_LO 4
+#define R_MICROBLAZE_64 5
+#define R_MICROBLAZE_32_LO 6
+#define R_MICROBLAZE_SRO32 7
+#define R_MICROBLAZE_SRW32 8
+#define R_MICROBLAZE_64_NONE 9
+#define R_MICROBLAZE_32_SYM_OP_SYM 10
+#define R_MICROBLAZE_GNU_VTINHERIT 11
+#define R_MICROBLAZE_GNU_VTENTRY 12
+#define R_MICROBLAZE_GOTPC_64 13
+#define R_MICROBLAZE_GOT_64 14
+#define R_MICROBLAZE_PLT_64 15
+#define R_MICROBLAZE_REL 16
+#define R_MICROBLAZE_JUMP_SLOT 17
+#define R_MICROBLAZE_GLOB_DAT 18
+#define R_MICROBLAZE_GOTOFF_64 19
+#define R_MICROBLAZE_GOTOFF_32 20
+#define R_MICROBLAZE_COPY 21
+#define R_MICROBLAZE_TLS 22
+#define R_MICROBLAZE_TLSGD 23
+#define R_MICROBLAZE_TLSLD 24
+#define R_MICROBLAZE_TLSDTPMOD32 25
+#define R_MICROBLAZE_TLSDTPREL32 26
+#define R_MICROBLAZE_TLSDTPREL64 27
+#define R_MICROBLAZE_TLSGOTTPREL32 28
+#define R_MICROBLAZE_TLSTPREL32	 29
+
+#define DT_NIOS2_GP             0x70000002
+
+#define R_NIOS2_NONE		0
+#define R_NIOS2_S16		1
+#define R_NIOS2_U16		2
+#define R_NIOS2_PCREL16		3
+#define R_NIOS2_CALL26		4
+#define R_NIOS2_IMM5		5
+#define R_NIOS2_CACHE_OPX	6
+#define R_NIOS2_IMM6		7
+#define R_NIOS2_IMM8		8
+#define R_NIOS2_HI16		9
+#define R_NIOS2_LO16		10
+#define R_NIOS2_HIADJ16		11
+#define R_NIOS2_BFD_RELOC_32	12
+#define R_NIOS2_BFD_RELOC_16	13
+#define R_NIOS2_BFD_RELOC_8	14
+#define R_NIOS2_GPREL		15
+#define R_NIOS2_GNU_VTINHERIT	16
+#define R_NIOS2_GNU_VTENTRY	17
+#define R_NIOS2_UJMP		18
+#define R_NIOS2_CJMP		19
+#define R_NIOS2_CALLR		20
+#define R_NIOS2_ALIGN		21
+#define R_NIOS2_GOT16		22
+#define R_NIOS2_CALL16		23
+#define R_NIOS2_GOTOFF_LO	24
+#define R_NIOS2_GOTOFF_HA	25
+#define R_NIOS2_PCREL_LO	26
+#define R_NIOS2_PCREL_HA	27
+#define R_NIOS2_TLS_GD16	28
+#define R_NIOS2_TLS_LDM16	29
+#define R_NIOS2_TLS_LDO16	30
+#define R_NIOS2_TLS_IE16	31
+#define R_NIOS2_TLS_LE16	32
+#define R_NIOS2_TLS_DTPMOD	33
+#define R_NIOS2_TLS_DTPREL	34
+#define R_NIOS2_TLS_TPREL	35
+#define R_NIOS2_COPY		36
+#define R_NIOS2_GLOB_DAT	37
+#define R_NIOS2_JUMP_SLOT	38
+#define R_NIOS2_RELATIVE	39
+#define R_NIOS2_GOTOFF		40
+#define R_NIOS2_CALL26_NOAT	41
+#define R_NIOS2_GOT_LO		42
+#define R_NIOS2_GOT_HA		43
+#define R_NIOS2_CALL_LO		44
+#define R_NIOS2_CALL_HA		45
+
+#define R_OR1K_NONE		0
+#define R_OR1K_32		1
+#define R_OR1K_16		2
+#define R_OR1K_8		3
+#define R_OR1K_LO_16_IN_INSN	4
+#define R_OR1K_HI_16_IN_INSN	5
+#define R_OR1K_INSN_REL_26	6
+#define R_OR1K_GNU_VTENTRY	7
+#define R_OR1K_GNU_VTINHERIT	8
+#define R_OR1K_32_PCREL		9
+#define R_OR1K_16_PCREL		10
+#define R_OR1K_8_PCREL		11
+#define R_OR1K_GOTPC_HI16	12
+#define R_OR1K_GOTPC_LO16	13
+#define R_OR1K_GOT16		14
+#define R_OR1K_PLT26		15
+#define R_OR1K_GOTOFF_HI16	16
+#define R_OR1K_GOTOFF_LO16	17
+#define R_OR1K_COPY		18
+#define R_OR1K_GLOB_DAT		19
+#define R_OR1K_JMP_SLOT		20
+#define R_OR1K_RELATIVE		21
+#define R_OR1K_TLS_GD_HI16	22
+#define R_OR1K_TLS_GD_LO16	23
+#define R_OR1K_TLS_LDM_HI16	24
+#define R_OR1K_TLS_LDM_LO16	25
+#define R_OR1K_TLS_LDO_HI16	26
+#define R_OR1K_TLS_LDO_LO16	27
+#define R_OR1K_TLS_IE_HI16	28
+#define R_OR1K_TLS_IE_LO16	29
+#define R_OR1K_TLS_LE_HI16	30
+#define R_OR1K_TLS_LE_LO16	31
+#define R_OR1K_TLS_TPOFF	32
+#define R_OR1K_TLS_DTPOFF	33
+#define R_OR1K_TLS_DTPMOD	34
+
+#define R_BPF_NONE		0
+#define R_BPF_MAP_FD		1
+
+#define R_RISCV_NONE            0
+#define R_RISCV_32              1
+#define R_RISCV_64              2
+#define R_RISCV_RELATIVE        3
+#define R_RISCV_COPY            4
+#define R_RISCV_JUMP_SLOT       5
+#define R_RISCV_TLS_DTPMOD32    6
+#define R_RISCV_TLS_DTPMOD64    7
+#define R_RISCV_TLS_DTPREL32    8
+#define R_RISCV_TLS_DTPREL64    9
+#define R_RISCV_TLS_TPREL32     10
+#define R_RISCV_TLS_TPREL64     11
+#define R_RISCV_TLSDESC         12
+
+#define R_RISCV_BRANCH          16
+#define R_RISCV_JAL             17
+#define R_RISCV_CALL            18
+#define R_RISCV_CALL_PLT        19
+#define R_RISCV_GOT_HI20        20
+#define R_RISCV_TLS_GOT_HI20    21
+#define R_RISCV_TLS_GD_HI20     22
+#define R_RISCV_PCREL_HI20      23
+#define R_RISCV_PCREL_LO12_I    24
+#define R_RISCV_PCREL_LO12_S    25
+#define R_RISCV_HI20            26
+#define R_RISCV_LO12_I          27
+#define R_RISCV_LO12_S          28
+#define R_RISCV_TPREL_HI20      29
+#define R_RISCV_TPREL_LO12_I    30
+#define R_RISCV_TPREL_LO12_S    31
+#define R_RISCV_TPREL_ADD       32
+#define R_RISCV_ADD8            33
+#define R_RISCV_ADD16           34
+#define R_RISCV_ADD32           35
+#define R_RISCV_ADD64           36
+#define R_RISCV_SUB8            37
+#define R_RISCV_SUB16           38
+#define R_RISCV_SUB32           39
+#define R_RISCV_SUB64           40
+#define R_RISCV_GOT32_PCREL     41
+#define R_RISCV_ALIGN           43
+#define R_RISCV_RVC_BRANCH      44
+#define R_RISCV_RVC_JUMP        45
+#define R_RISCV_RVC_LUI         46
+#define R_RISCV_RELAX           51
+#define R_RISCV_SUB6            52
+#define R_RISCV_SET6            53
+#define R_RISCV_SET8            54
+#define R_RISCV_SET16           55
+#define R_RISCV_SET32           56
+#define R_RISCV_32_PCREL        57
+#define R_RISCV_IRELATIVE       58
+#define R_RISCV_PLT32           59
+#define R_RISCV_SET_ULEB128     60
+#define R_RISCV_SUB_ULEB128     61
+#define R_RISCV_TLSDESC_HI20    62
+#define R_RISCV_TLSDESC_LOAD_LO12 63
+#define R_RISCV_TLSDESC_ADD_LO12  64
+#define R_RISCV_TLSDESC_CALL    65
+
+#define EF_LARCH_ABI_MODIFIER_MASK    0x07
+#define EF_LARCH_ABI_SOFT_FLOAT       0x01
+#define EF_LARCH_ABI_SINGLE_FLOAT     0x02
+#define EF_LARCH_ABI_DOUBLE_FLOAT     0x03
+#define EF_LARCH_OBJABI_V1            0x40
+
+#define R_LARCH_NONE                        0
+#define R_LARCH_32                          1
+#define R_LARCH_64                          2
+#define R_LARCH_RELATIVE                    3
+#define R_LARCH_COPY                        4
+#define R_LARCH_JUMP_SLOT                   5
+#define R_LARCH_TLS_DTPMOD32                6
+#define R_LARCH_TLS_DTPMOD64                7
+#define R_LARCH_TLS_DTPREL32                8
+#define R_LARCH_TLS_DTPREL64                9
+#define R_LARCH_TLS_TPREL32                 10
+#define R_LARCH_TLS_TPREL64                 11
+#define R_LARCH_IRELATIVE                   12
+#define R_LARCH_MARK_LA                     20
+#define R_LARCH_MARK_PCREL                  21
+#define R_LARCH_SOP_PUSH_PCREL              22
+#define R_LARCH_SOP_PUSH_ABSOLUTE           23
+#define R_LARCH_SOP_PUSH_DUP                24
+#define R_LARCH_SOP_PUSH_GPREL              25
+#define R_LARCH_SOP_PUSH_TLS_TPREL          26
+#define R_LARCH_SOP_PUSH_TLS_GOT            27
+#define R_LARCH_SOP_PUSH_TLS_GD             28
+#define R_LARCH_SOP_PUSH_PLT_PCREL          29
+#define R_LARCH_SOP_ASSERT                  30
+#define R_LARCH_SOP_NOT                     31
+#define R_LARCH_SOP_SUB                     32
+#define R_LARCH_SOP_SL                      33
+#define R_LARCH_SOP_SR                      34
+#define R_LARCH_SOP_ADD                     35
+#define R_LARCH_SOP_AND                     36
+#define R_LARCH_SOP_IF_ELSE                 37
+#define R_LARCH_SOP_POP_32_S_10_5           38
+#define R_LARCH_SOP_POP_32_U_10_12          39
+#define R_LARCH_SOP_POP_32_S_10_12          40
+#define R_LARCH_SOP_POP_32_S_10_16          41
+#define R_LARCH_SOP_POP_32_S_10_16_S2       42
+#define R_LARCH_SOP_POP_32_S_5_20           43
+#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2   44
+#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2  45
+#define R_LARCH_SOP_POP_32_U                46
+#define R_LARCH_ADD8                        47
+#define R_LARCH_ADD16                       48
+#define R_LARCH_ADD24                       49
+#define R_LARCH_ADD32                       50
+#define R_LARCH_ADD64                       51
+#define R_LARCH_SUB8                        52
+#define R_LARCH_SUB16                       53
+#define R_LARCH_SUB24                       54
+#define R_LARCH_SUB32                       55
+#define R_LARCH_SUB64                       56
+#define R_LARCH_GNU_VTINHERIT               57
+#define R_LARCH_GNU_VTENTRY                 58
+#define R_LARCH_B16                         64
+#define R_LARCH_B21                         65
+#define R_LARCH_B26                         66
+#define R_LARCH_ABS_HI20                    67
+#define R_LARCH_ABS_LO12                    68
+#define R_LARCH_ABS64_LO20                  69
+#define R_LARCH_ABS64_HI12                  70
+#define R_LARCH_PCALA_HI20                  71
+#define R_LARCH_PCALA_LO12                  72
+#define R_LARCH_PCALA64_LO20                73
+#define R_LARCH_PCALA64_HI12                74
+#define R_LARCH_GOT_PC_HI20                 75
+#define R_LARCH_GOT_PC_LO12                 76
+#define R_LARCH_GOT64_PC_LO20               77
+#define R_LARCH_GOT64_PC_HI12               78
+#define R_LARCH_GOT_HI20                    79
+#define R_LARCH_GOT_LO12                    80
+#define R_LARCH_GOT64_LO20                  81
+#define R_LARCH_GOT64_HI12                  82
+#define R_LARCH_TLS_LE_HI20                 83
+#define R_LARCH_TLS_LE_LO12                 84
+#define R_LARCH_TLS_LE64_LO20               85
+#define R_LARCH_TLS_LE64_HI12               86
+#define R_LARCH_TLS_IE_PC_HI20              87
+#define R_LARCH_TLS_IE_PC_LO12              88
+#define R_LARCH_TLS_IE64_PC_LO20            89
+#define R_LARCH_TLS_IE64_PC_HI12            90
+#define R_LARCH_TLS_IE_HI20                 91
+#define R_LARCH_TLS_IE_LO12                 92
+#define R_LARCH_TLS_IE64_LO20               93
+#define R_LARCH_TLS_IE64_HI12               94
+#define R_LARCH_TLS_LD_PC_HI20              95
+#define R_LARCH_TLS_LD_HI20                 96
+#define R_LARCH_TLS_GD_PC_HI20              97
+#define R_LARCH_TLS_GD_HI20                 98
+#define R_LARCH_32_PCREL                    99
+#define R_LARCH_RELAX                       100
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/musl-include/aarch64/endian.h b/musl-include/aarch64/endian.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/endian.h
@@ -0,0 +1,80 @@
+#ifndef _ENDIAN_H
+#define _ENDIAN_H
+
+#include <features.h>
+
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#include <bits/alltypes.h>
+
+#define __PDP_ENDIAN 3412
+
+#define BIG_ENDIAN __BIG_ENDIAN
+#define LITTLE_ENDIAN __LITTLE_ENDIAN
+#define PDP_ENDIAN __PDP_ENDIAN
+#define BYTE_ORDER __BYTE_ORDER
+
+static __inline uint16_t __bswap16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap64(uint64_t __x)
+{
+	return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
+}
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define htobe16(x) __bswap16(x)
+#define be16toh(x) __bswap16(x)
+#define htobe32(x) __bswap32(x)
+#define be32toh(x) __bswap32(x)
+#define htobe64(x) __bswap64(x)
+#define be64toh(x) __bswap64(x)
+#define htole16(x) (uint16_t)(x)
+#define le16toh(x) (uint16_t)(x)
+#define htole32(x) (uint32_t)(x)
+#define le32toh(x) (uint32_t)(x)
+#define htole64(x) (uint64_t)(x)
+#define le64toh(x) (uint64_t)(x)
+#else
+#define htobe16(x) (uint16_t)(x)
+#define be16toh(x) (uint16_t)(x)
+#define htobe32(x) (uint32_t)(x)
+#define be32toh(x) (uint32_t)(x)
+#define htobe64(x) (uint64_t)(x)
+#define be64toh(x) (uint64_t)(x)
+#define htole16(x) __bswap16(x)
+#define le16toh(x) __bswap16(x)
+#define htole32(x) __bswap32(x)
+#define le32toh(x) __bswap32(x)
+#define htole64(x) __bswap64(x)
+#define le64toh(x) __bswap64(x)
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define betoh16(x) __bswap16(x)
+#define betoh32(x) __bswap32(x)
+#define betoh64(x) __bswap64(x)
+#define letoh16(x) (uint16_t)(x)
+#define letoh32(x) (uint32_t)(x)
+#define letoh64(x) (uint64_t)(x)
+#else
+#define betoh16(x) (uint16_t)(x)
+#define betoh32(x) (uint32_t)(x)
+#define betoh64(x) (uint64_t)(x)
+#define letoh16(x) __bswap16(x)
+#define letoh32(x) __bswap32(x)
+#define letoh64(x) __bswap64(x)
+#endif
+#endif
+
+#endif
diff --git a/musl-include/aarch64/err.h b/musl-include/aarch64/err.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/err.h
@@ -0,0 +1,25 @@
+#ifndef _ERR_H
+#define _ERR_H
+
+#include <features.h>
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void warn(const char *, ...);
+void vwarn(const char *, va_list);
+void warnx(const char *, ...);
+void vwarnx(const char *, va_list);
+
+_Noreturn void err(int, const char *, ...);
+_Noreturn void verr(int, const char *, va_list);
+_Noreturn void errx(int, const char *, ...);
+_Noreturn void verrx(int, const char *, va_list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/errno.h b/musl-include/aarch64/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/errno.h
@@ -0,0 +1,27 @@
+#ifndef	_ERRNO_H
+#define _ERRNO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/errno.h>
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int *__errno_location(void);
+#define errno (*__errno_location())
+
+#ifdef _GNU_SOURCE
+extern char *program_invocation_short_name, *program_invocation_name;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/aarch64/fcntl.h b/musl-include/aarch64/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/fcntl.h
@@ -0,0 +1,218 @@
+#ifndef	_FCNTL_H
+#define	_FCNTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_mode_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_struct_iovec
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/fcntl.h>
+
+struct flock {
+	short l_type;
+	short l_whence;
+	off_t l_start;
+	off_t l_len;
+	pid_t l_pid;
+};
+
+int creat(const char *, mode_t);
+int fcntl(int, int, ...);
+int open(const char *, int, ...);
+int openat(int, const char *, int, ...);
+int posix_fadvise(int, off_t, off_t, int);
+int posix_fallocate(int, off_t, off_t);
+
+#define O_SEARCH   O_PATH
+#define O_EXEC     O_PATH
+#define O_TTY_INIT 0
+
+#define O_ACCMODE (03|O_SEARCH)
+#define O_RDONLY  00
+#define O_WRONLY  01
+#define O_RDWR    02
+
+#define F_OFD_GETLK 36
+#define F_OFD_SETLK 37
+#define F_OFD_SETLKW 38
+
+#define F_DUPFD_CLOEXEC 1030
+
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+#define FD_CLOEXEC 1
+
+#define AT_FDCWD (-100)
+#define AT_SYMLINK_NOFOLLOW 0x100
+#define AT_REMOVEDIR 0x200
+#define AT_SYMLINK_FOLLOW 0x400
+#define AT_EACCESS 0x200
+
+#define POSIX_FADV_NORMAL     0
+#define POSIX_FADV_RANDOM     1
+#define POSIX_FADV_SEQUENTIAL 2
+#define POSIX_FADV_WILLNEED   3
+#ifndef POSIX_FADV_DONTNEED
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
+#endif
+
+#undef SEEK_SET
+#undef SEEK_CUR
+#undef SEEK_END
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#ifndef S_IRUSR
+#define S_ISUID 04000
+#define S_ISGID 02000
+#define S_ISVTX 01000
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXU 0700
+#define S_IRGRP 0040
+#define S_IWGRP 0020
+#define S_IXGRP 0010
+#define S_IRWXG 0070
+#define S_IROTH 0004
+#define S_IWOTH 0002
+#define S_IXOTH 0001
+#define S_IRWXO 0007
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define AT_NO_AUTOMOUNT 0x800
+#define AT_EMPTY_PATH 0x1000
+#define AT_STATX_SYNC_TYPE 0x6000
+#define AT_STATX_SYNC_AS_STAT 0x0000
+#define AT_STATX_FORCE_SYNC 0x2000
+#define AT_STATX_DONT_SYNC 0x4000
+#define AT_RECURSIVE 0x8000
+
+#define FAPPEND O_APPEND
+#define FFSYNC O_SYNC
+#define FASYNC O_ASYNC
+#define FNONBLOCK O_NONBLOCK
+#define FNDELAY O_NDELAY
+
+#define F_OK 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#define F_ULOCK 0
+#define F_LOCK  1
+#define F_TLOCK 2
+#define F_TEST  3
+
+#define F_SETLEASE	1024
+#define F_GETLEASE	1025
+#define F_NOTIFY	1026
+#define F_CANCELLK	1029
+#define F_SETPIPE_SZ	1031
+#define F_GETPIPE_SZ	1032
+#define F_ADD_SEALS	1033
+#define F_GET_SEALS	1034
+
+#define F_SEAL_SEAL	0x0001
+#define F_SEAL_SHRINK	0x0002
+#define F_SEAL_GROW	0x0004
+#define F_SEAL_WRITE	0x0008
+#define F_SEAL_FUTURE_WRITE	0x0010
+
+#define F_GET_RW_HINT		1035
+#define F_SET_RW_HINT		1036
+#define F_GET_FILE_RW_HINT	1037
+#define F_SET_FILE_RW_HINT	1038
+
+#define RWF_WRITE_LIFE_NOT_SET	0
+#define RWH_WRITE_LIFE_NONE	1
+#define RWH_WRITE_LIFE_SHORT	2
+#define RWH_WRITE_LIFE_MEDIUM	3
+#define RWH_WRITE_LIFE_LONG	4
+#define RWH_WRITE_LIFE_EXTREME	5
+
+#define DN_ACCESS	0x00000001
+#define DN_MODIFY	0x00000002
+#define DN_CREATE	0x00000004
+#define DN_DELETE	0x00000008
+#define DN_RENAME	0x00000010
+#define DN_ATTRIB	0x00000020
+#define DN_MULTISHOT	0x80000000
+
+int lockf(int, int, off_t);
+#endif
+
+#if defined(_GNU_SOURCE)
+#define F_OWNER_TID 0
+#define F_OWNER_PID 1
+#define F_OWNER_PGRP 2
+#define F_OWNER_GID 2
+struct file_handle {
+	unsigned handle_bytes;
+	int handle_type;
+	unsigned char f_handle[];
+};
+struct f_owner_ex {
+	int type;
+	pid_t pid;
+};
+#define FALLOC_FL_KEEP_SIZE 1
+#define FALLOC_FL_PUNCH_HOLE 2
+#define MAX_HANDLE_SZ 128
+#define SYNC_FILE_RANGE_WAIT_BEFORE 1
+#define SYNC_FILE_RANGE_WRITE 2
+#define SYNC_FILE_RANGE_WAIT_AFTER 4
+#define SPLICE_F_MOVE 1
+#define SPLICE_F_NONBLOCK 2
+#define SPLICE_F_MORE 4
+#define SPLICE_F_GIFT 8
+int fallocate(int, int, off_t, off_t);
+int name_to_handle_at(int, const char *, struct file_handle *, int *, int);
+int open_by_handle_at(int, struct file_handle *, int);
+ssize_t readahead(int, off_t, size_t);
+int sync_file_range(int, off_t, off_t, unsigned);
+ssize_t vmsplice(int, const struct iovec *, size_t, unsigned);
+ssize_t splice(int, off_t *, int, off_t *, size_t, unsigned);
+ssize_t tee(int, int, size_t, unsigned);
+#define loff_t off_t
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define F_GETLK64 F_GETLK
+#define F_SETLK64 F_SETLK
+#define F_SETLKW64 F_SETLKW
+#define flock64 flock
+#define open64 open
+#define openat64 openat
+#define creat64 creat
+#define lockf64 lockf
+#define posix_fadvise64 posix_fadvise
+#define posix_fallocate64 posix_fallocate
+#define off64_t off_t
+#if defined(_GNU_SOURCE)
+#define fallocate64 fallocate
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/features.h b/musl-include/aarch64/features.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/features.h
@@ -0,0 +1,40 @@
+#ifndef _FEATURES_H
+#define _FEATURES_H
+
+#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE)
+#define _GNU_SOURCE 1
+#endif
+
+#if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE)
+#define _BSD_SOURCE 1
+#endif
+
+#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
+ && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
+ && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)
+#define _BSD_SOURCE 1
+#define _XOPEN_SOURCE 700
+#endif
+
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
+#if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
+#define __inline inline
+#elif !defined(__GNUC__)
+#define __inline
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#elif defined(__GNUC__)
+#define _Noreturn __attribute__((__noreturn__))
+#else
+#define _Noreturn
+#endif
+
+#define __REDIR(x,y) __typeof__(x) x __asm__(#y)
+
+#endif
diff --git a/musl-include/aarch64/fenv.h b/musl-include/aarch64/fenv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/fenv.h
@@ -0,0 +1,28 @@
+#ifndef _FENV_H
+#define _FENV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bits/fenv.h>
+
+int feclearexcept(int);
+int fegetexceptflag(fexcept_t *, int);
+int feraiseexcept(int);
+int fesetexceptflag(const fexcept_t *, int);
+int fetestexcept(int);
+
+int fegetround(void);
+int fesetround(int);
+
+int fegetenv(fenv_t *);
+int feholdexcept(fenv_t *);
+int fesetenv(const fenv_t *);
+int feupdateenv(const fenv_t *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/musl-include/aarch64/float.h b/musl-include/aarch64/float.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/float.h
@@ -0,0 +1,52 @@
+#ifndef _FLOAT_H
+#define _FLOAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __flt_rounds(void);
+#define FLT_ROUNDS (__flt_rounds())
+
+#define FLT_RADIX 2
+
+#define FLT_TRUE_MIN 1.40129846432481707092e-45F
+#define FLT_MIN 1.17549435082228750797e-38F
+#define FLT_MAX 3.40282346638528859812e+38F
+#define FLT_EPSILON 1.1920928955078125e-07F
+
+#define FLT_MANT_DIG 24
+#define FLT_MIN_EXP (-125)
+#define FLT_MAX_EXP 128
+#define FLT_HAS_SUBNORM 1
+
+#define FLT_DIG 6
+#define FLT_DECIMAL_DIG 9
+#define FLT_MIN_10_EXP (-37)
+#define FLT_MAX_10_EXP 38
+
+#define DBL_TRUE_MIN 4.94065645841246544177e-324
+#define DBL_MIN 2.22507385850720138309e-308
+#define DBL_MAX 1.79769313486231570815e+308
+#define DBL_EPSILON 2.22044604925031308085e-16
+
+#define DBL_MANT_DIG 53
+#define DBL_MIN_EXP (-1021)
+#define DBL_MAX_EXP 1024
+#define DBL_HAS_SUBNORM 1
+
+#define DBL_DIG 15
+#define DBL_DECIMAL_DIG 17
+#define DBL_MIN_10_EXP (-307)
+#define DBL_MAX_10_EXP 308
+
+#define LDBL_HAS_SUBNORM 1
+#define LDBL_DECIMAL_DIG DECIMAL_DIG
+
+#include <bits/float.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/fmtmsg.h b/musl-include/aarch64/fmtmsg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/fmtmsg.h
@@ -0,0 +1,47 @@
+#ifndef _FMTMSG_H
+#define _FMTMSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MM_HARD		1
+#define MM_SOFT		2
+#define MM_FIRM		4
+
+#define MM_APPL		8
+#define MM_UTIL		16
+#define MM_OPSYS	32
+
+#define MM_RECOVER	64
+#define MM_NRECOV	128
+
+#define MM_PRINT	256
+#define MM_CONSOLE	512
+
+#define MM_NULLMC	0L
+
+#define MM_HALT		1
+#define MM_ERROR	2
+#define MM_WARNING	3
+#define MM_INFO		4
+#define MM_NOSEV	0
+
+#define MM_OK		0
+#define MM_NOTOK	(-1)
+#define MM_NOMSG	1
+#define MM_NOCON	4
+
+#define MM_NULLLBL	((char*)0)
+#define MM_NULLTXT	((char*)0)
+#define MM_NULLACT	((char*)0)
+#define MM_NULLTAG	((char*)0)
+#define MM_NULLSEV	0
+
+int fmtmsg(long, const char *, int, const char *, const char *, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/fnmatch.h b/musl-include/aarch64/fnmatch.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/fnmatch.h
@@ -0,0 +1,24 @@
+#ifndef	_FNMATCH_H
+#define	_FNMATCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	FNM_PATHNAME 0x1
+#define	FNM_NOESCAPE 0x2
+#define	FNM_PERIOD   0x4
+#define	FNM_LEADING_DIR	0x8           
+#define	FNM_CASEFOLD	0x10
+#define	FNM_FILE_NAME	FNM_PATHNAME
+
+#define	FNM_NOMATCH 1
+#define FNM_NOSYS   (-1)
+
+int fnmatch(const char *, const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/ftw.h b/musl-include/aarch64/ftw.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/ftw.h
@@ -0,0 +1,41 @@
+#ifndef _FTW_H
+#define	_FTW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/stat.h>
+
+#define FTW_F   1
+#define FTW_D   2
+#define FTW_DNR 3
+#define FTW_NS  4
+#define FTW_SL  5
+#define FTW_DP  6
+#define FTW_SLN 7
+
+#define FTW_PHYS  1
+#define FTW_MOUNT 2
+#define FTW_CHDIR 4
+#define FTW_DEPTH 8
+
+struct FTW {
+	int base;
+	int level;
+};
+
+int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
+int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define ftw64 ftw
+#define nftw64 nftw
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/getopt.h b/musl-include/aarch64/getopt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/getopt.h
@@ -0,0 +1,30 @@
+#ifndef _GETOPT_H
+#define _GETOPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int getopt(int, char * const [], const char *);
+extern char *optarg;
+extern int optind, opterr, optopt, optreset;
+
+struct option {
+	const char *name;
+	int has_arg;
+	int *flag;
+	int val;
+};
+
+int getopt_long(int, char *const *, const char *, const struct option *, int *);
+int getopt_long_only(int, char *const *, const char *, const struct option *, int *);
+
+#define no_argument        0
+#define required_argument  1
+#define optional_argument  2
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/glob.h b/musl-include/aarch64/glob.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/glob.h
@@ -0,0 +1,52 @@
+#ifndef	_GLOB_H
+#define	_GLOB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef struct {
+	size_t gl_pathc;
+	char **gl_pathv;
+	size_t gl_offs;
+	int __dummy1;
+	void *__dummy2[5];
+} glob_t;
+
+int  glob(const char *__restrict, int, int (*)(const char *, int), glob_t *__restrict);
+void globfree(glob_t *);
+
+#define GLOB_ERR      0x01
+#define GLOB_MARK     0x02
+#define GLOB_NOSORT   0x04
+#define GLOB_DOOFFS   0x08
+#define GLOB_NOCHECK  0x10
+#define GLOB_APPEND   0x20
+#define GLOB_NOESCAPE 0x40
+#define	GLOB_PERIOD   0x80
+
+#define GLOB_TILDE       0x1000
+#define GLOB_TILDE_CHECK 0x4000
+
+#define GLOB_NOSPACE 1
+#define GLOB_ABORTED 2
+#define GLOB_NOMATCH 3
+#define GLOB_NOSYS   4
+
+#if defined(_LARGEFILE64_SOURCE)
+#define glob64 glob
+#define globfree64 globfree
+#define glob64_t glob_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/grp.h b/musl-include/aarch64/grp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/grp.h
@@ -0,0 +1,53 @@
+#ifndef	_GRP_H
+#define	_GRP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_gid_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_FILE
+#endif
+
+#include <bits/alltypes.h>
+
+struct group {
+	char *gr_name;
+	char *gr_passwd;
+	gid_t gr_gid;
+	char **gr_mem;
+};
+
+struct group  *getgrgid(gid_t);
+struct group  *getgrnam(const char *);
+
+int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
+int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct group  *getgrent(void);
+void           endgrent(void);
+void           setgrent(void);
+#endif
+
+#ifdef _GNU_SOURCE
+struct group  *fgetgrent(FILE *);
+int putgrent(const struct group *, FILE *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int getgrouplist(const char *, gid_t, gid_t *, int *);
+int setgroups(size_t, const gid_t *);
+int initgroups(const char *, gid_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/iconv.h b/musl-include/aarch64/iconv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/iconv.h
@@ -0,0 +1,24 @@
+#ifndef _ICONV_H
+#define _ICONV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef void *iconv_t;
+
+iconv_t iconv_open(const char *, const char *);
+size_t iconv(iconv_t, char **__restrict, size_t *__restrict, char **__restrict, size_t *__restrict);
+int iconv_close(iconv_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/ifaddrs.h b/musl-include/aarch64/ifaddrs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/ifaddrs.h
@@ -0,0 +1,35 @@
+#ifndef _IFADDRS_H
+#define _IFADDRS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+
+struct ifaddrs {
+	struct ifaddrs *ifa_next;
+	char *ifa_name;
+	unsigned ifa_flags;
+	struct sockaddr *ifa_addr;
+	struct sockaddr *ifa_netmask;
+	union {
+		struct sockaddr *ifu_broadaddr;
+		struct sockaddr *ifu_dstaddr;
+	} ifa_ifu;
+	void *ifa_data;
+};
+#define ifa_broadaddr ifa_ifu.ifu_broadaddr
+#define ifa_dstaddr ifa_ifu.ifu_dstaddr
+
+void freeifaddrs(struct ifaddrs *);
+int getifaddrs(struct ifaddrs **);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/aarch64/inttypes.h b/musl-include/aarch64/inttypes.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/inttypes.h
@@ -0,0 +1,229 @@
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <stdint.h>
+
+#define __NEED_wchar_t
+#include <bits/alltypes.h>
+
+typedef struct { intmax_t quot, rem; } imaxdiv_t;
+
+intmax_t imaxabs(intmax_t);
+imaxdiv_t imaxdiv(intmax_t, intmax_t);
+
+intmax_t strtoimax(const char *__restrict, char **__restrict, int);
+uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
+
+intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
+uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
+
+#if UINTPTR_MAX == UINT64_MAX
+#define __PRI64  "l"
+#define __PRIPTR "l"
+#else
+#define __PRI64  "ll"
+#define __PRIPTR ""
+#endif
+
+#define PRId8  "d"
+#define PRId16 "d"
+#define PRId32 "d"
+#define PRId64 __PRI64 "d"
+
+#define PRIdLEAST8  "d"
+#define PRIdLEAST16 "d"
+#define PRIdLEAST32 "d"
+#define PRIdLEAST64 __PRI64 "d"
+
+#define PRIdFAST8  "d"
+#define PRIdFAST16 "d"
+#define PRIdFAST32 "d"
+#define PRIdFAST64 __PRI64 "d"
+
+#define PRIi8  "i"
+#define PRIi16 "i"
+#define PRIi32 "i"
+#define PRIi64 __PRI64 "i"
+
+#define PRIiLEAST8  "i"
+#define PRIiLEAST16 "i"
+#define PRIiLEAST32 "i"
+#define PRIiLEAST64 __PRI64 "i"
+
+#define PRIiFAST8  "i"
+#define PRIiFAST16 "i"
+#define PRIiFAST32 "i"
+#define PRIiFAST64 __PRI64 "i"
+
+#define PRIo8  "o"
+#define PRIo16 "o"
+#define PRIo32 "o"
+#define PRIo64 __PRI64 "o"
+
+#define PRIoLEAST8  "o"
+#define PRIoLEAST16 "o"
+#define PRIoLEAST32 "o"
+#define PRIoLEAST64 __PRI64 "o"
+
+#define PRIoFAST8  "o"
+#define PRIoFAST16 "o"
+#define PRIoFAST32 "o"
+#define PRIoFAST64 __PRI64 "o"
+
+#define PRIu8  "u"
+#define PRIu16 "u"
+#define PRIu32 "u"
+#define PRIu64 __PRI64 "u"
+
+#define PRIuLEAST8  "u"
+#define PRIuLEAST16 "u"
+#define PRIuLEAST32 "u"
+#define PRIuLEAST64 __PRI64 "u"
+
+#define PRIuFAST8  "u"
+#define PRIuFAST16 "u"
+#define PRIuFAST32 "u"
+#define PRIuFAST64 __PRI64 "u"
+
+#define PRIx8  "x"
+#define PRIx16 "x"
+#define PRIx32 "x"
+#define PRIx64 __PRI64 "x"
+
+#define PRIxLEAST8  "x"
+#define PRIxLEAST16 "x"
+#define PRIxLEAST32 "x"
+#define PRIxLEAST64 __PRI64 "x"
+
+#define PRIxFAST8  "x"
+#define PRIxFAST16 "x"
+#define PRIxFAST32 "x"
+#define PRIxFAST64 __PRI64 "x"
+
+#define PRIX8  "X"
+#define PRIX16 "X"
+#define PRIX32 "X"
+#define PRIX64 __PRI64 "X"
+
+#define PRIXLEAST8  "X"
+#define PRIXLEAST16 "X"
+#define PRIXLEAST32 "X"
+#define PRIXLEAST64 __PRI64 "X"
+
+#define PRIXFAST8  "X"
+#define PRIXFAST16 "X"
+#define PRIXFAST32 "X"
+#define PRIXFAST64 __PRI64 "X"
+
+#define PRIdMAX __PRI64 "d"
+#define PRIiMAX __PRI64 "i"
+#define PRIoMAX __PRI64 "o"
+#define PRIuMAX __PRI64 "u"
+#define PRIxMAX __PRI64 "x"
+#define PRIXMAX __PRI64 "X"
+
+#define PRIdPTR __PRIPTR "d"
+#define PRIiPTR __PRIPTR "i"
+#define PRIoPTR __PRIPTR "o"
+#define PRIuPTR __PRIPTR "u"
+#define PRIxPTR __PRIPTR "x"
+#define PRIXPTR __PRIPTR "X"
+
+#define SCNd8   "hhd"
+#define SCNd16  "hd"
+#define SCNd32  "d"
+#define SCNd64  __PRI64 "d"
+
+#define SCNdLEAST8  "hhd"
+#define SCNdLEAST16 "hd"
+#define SCNdLEAST32 "d"
+#define SCNdLEAST64 __PRI64 "d"
+
+#define SCNdFAST8  "hhd"
+#define SCNdFAST16 "d"
+#define SCNdFAST32 "d"
+#define SCNdFAST64 __PRI64 "d"
+
+#define SCNi8   "hhi"
+#define SCNi16  "hi"
+#define SCNi32  "i"
+#define SCNi64  __PRI64 "i"
+
+#define SCNiLEAST8  "hhi"
+#define SCNiLEAST16 "hi"
+#define SCNiLEAST32 "i"
+#define SCNiLEAST64 __PRI64 "i"
+
+#define SCNiFAST8  "hhi"
+#define SCNiFAST16 "i"
+#define SCNiFAST32 "i"
+#define SCNiFAST64 __PRI64 "i"
+
+#define SCNu8   "hhu"
+#define SCNu16  "hu"
+#define SCNu32  "u"
+#define SCNu64  __PRI64 "u"
+
+#define SCNuLEAST8  "hhu"
+#define SCNuLEAST16 "hu"
+#define SCNuLEAST32 "u"
+#define SCNuLEAST64 __PRI64 "u"
+
+#define SCNuFAST8 "hhu"
+#define SCNuFAST16 "u"
+#define SCNuFAST32 "u"
+#define SCNuFAST64 __PRI64 "u"
+
+#define SCNo8   "hho"
+#define SCNo16  "ho"
+#define SCNo32  "o"
+#define SCNo64  __PRI64 "o"
+
+#define SCNoLEAST8  "hho"
+#define SCNoLEAST16 "ho"
+#define SCNoLEAST32 "o"
+#define SCNoLEAST64 __PRI64 "o"
+
+#define SCNoFAST8  "hho"
+#define SCNoFAST16 "o"
+#define SCNoFAST32 "o"
+#define SCNoFAST64 __PRI64 "o"
+
+#define SCNx8   "hhx"
+#define SCNx16  "hx"
+#define SCNx32  "x"
+#define SCNx64  __PRI64 "x"
+
+#define SCNxLEAST8  "hhx"
+#define SCNxLEAST16 "hx"
+#define SCNxLEAST32 "x"
+#define SCNxLEAST64 __PRI64 "x"
+
+#define SCNxFAST8  "hhx"
+#define SCNxFAST16 "x"
+#define SCNxFAST32 "x"
+#define SCNxFAST64 __PRI64 "x"
+
+#define SCNdMAX __PRI64 "d"
+#define SCNiMAX __PRI64 "i"
+#define SCNoMAX __PRI64 "o"
+#define SCNuMAX __PRI64 "u"
+#define SCNxMAX __PRI64 "x"
+
+#define SCNdPTR __PRIPTR "d"
+#define SCNiPTR __PRIPTR "i"
+#define SCNoPTR __PRIPTR "o"
+#define SCNuPTR __PRIPTR "u"
+#define SCNxPTR __PRIPTR "x"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/aarch64/iso646.h b/musl-include/aarch64/iso646.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/iso646.h
@@ -0,0 +1,20 @@
+#ifndef _ISO646_H
+#define _ISO646_H
+
+#ifndef __cplusplus
+
+#define and    &&
+#define and_eq &=
+#define bitand &
+#define bitor  |
+#define compl  ~
+#define not    !
+#define not_eq !=
+#define or     ||
+#define or_eq  |=
+#define xor    ^
+#define xor_eq ^=
+
+#endif
+
+#endif
diff --git a/musl-include/aarch64/langinfo.h b/musl-include/aarch64/langinfo.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/langinfo.h
@@ -0,0 +1,98 @@
+#ifndef _LANGINFO_H
+#define _LANGINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <nl_types.h>
+
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+#define ABDAY_1 0x20000
+#define ABDAY_2 0x20001
+#define ABDAY_3 0x20002
+#define ABDAY_4 0x20003
+#define ABDAY_5 0x20004
+#define ABDAY_6 0x20005
+#define ABDAY_7 0x20006
+
+#define DAY_1 0x20007
+#define DAY_2 0x20008
+#define DAY_3 0x20009
+#define DAY_4 0x2000A
+#define DAY_5 0x2000B
+#define DAY_6 0x2000C
+#define DAY_7 0x2000D
+
+#define ABMON_1 0x2000E
+#define ABMON_2 0x2000F
+#define ABMON_3 0x20010
+#define ABMON_4 0x20011
+#define ABMON_5 0x20012
+#define ABMON_6 0x20013
+#define ABMON_7 0x20014
+#define ABMON_8 0x20015
+#define ABMON_9 0x20016
+#define ABMON_10 0x20017
+#define ABMON_11 0x20018
+#define ABMON_12 0x20019
+
+#define MON_1 0x2001A
+#define MON_2 0x2001B
+#define MON_3 0x2001C
+#define MON_4 0x2001D
+#define MON_5 0x2001E
+#define MON_6 0x2001F
+#define MON_7 0x20020
+#define MON_8 0x20021
+#define MON_9 0x20022
+#define MON_10 0x20023
+#define MON_11 0x20024
+#define MON_12 0x20025
+
+#define AM_STR 0x20026
+#define PM_STR 0x20027
+
+#define D_T_FMT 0x20028
+#define D_FMT 0x20029
+#define T_FMT 0x2002A
+#define T_FMT_AMPM 0x2002B
+
+#define ERA 0x2002C
+#define ERA_D_FMT 0x2002E
+#define ALT_DIGITS 0x2002F
+#define ERA_D_T_FMT 0x20030
+#define ERA_T_FMT 0x20031
+
+#define CODESET 14
+
+#define CRNCYSTR 0x4000F
+
+#define RADIXCHAR 0x10000
+#define THOUSEP 0x10001
+#define YESEXPR 0x50000
+#define NOEXPR 0x50001
+
+#define _NL_LOCALE_NAME(cat) (((cat)<<16) | 0xffff)
+
+#if defined(_GNU_SOURCE)
+#define NL_LOCALE_NAME(cat) _NL_LOCALE_NAME(cat)
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define YESSTR 0x50002
+#define NOSTR 0x50003
+#endif
+
+char *nl_langinfo(nl_item);
+char *nl_langinfo_l(nl_item, locale_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/lastlog.h b/musl-include/aarch64/lastlog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/lastlog.h
@@ -0,0 +1,1 @@
+#include <utmp.h>
diff --git a/musl-include/aarch64/libgen.h b/musl-include/aarch64/libgen.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/libgen.h
@@ -0,0 +1,15 @@
+#ifndef _LIBGEN_H
+#define _LIBGEN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *dirname(char *);
+char *basename(char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/libintl.h b/musl-include/aarch64/libintl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/libintl.h
@@ -0,0 +1,33 @@
+#ifndef _LIBINTL_H
+#define _LIBINTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __USE_GNU_GETTEXT 1
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 1 : -1)
+
+#if __GNUC__ >= 3
+#define __fa(n) __attribute__ ((__format_arg__ (n)))
+#else
+#define __fa(n)
+#endif
+
+char *gettext(const char *) __fa(1);
+char *dgettext(const char *, const char *) __fa(2);
+char *dcgettext(const char *, const char *, int) __fa(2);
+char *ngettext(const char *, const char *, unsigned long) __fa(1) __fa(2);
+char *dngettext(const char *, const char *, const char *, unsigned long) __fa(2) __fa(3);
+char *dcngettext(const char *, const char *, const char *, unsigned long, int) __fa(2) __fa(3);
+char *textdomain(const char *);
+char *bindtextdomain (const char *, const char *);
+char *bind_textdomain_codeset(const char *, const char *);
+
+#undef __fa
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/limits.h b/musl-include/aarch64/limits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/limits.h
@@ -0,0 +1,166 @@
+#ifndef _LIMITS_H
+#define _LIMITS_H
+
+#include <features.h>
+
+#include <bits/alltypes.h> /* __LONG_MAX */
+
+/* Support signed or unsigned plain-char */
+
+#if '\xff' > 0
+#define CHAR_MIN 0
+#define CHAR_MAX 255
+#else
+#define CHAR_MIN (-128)
+#define CHAR_MAX 127
+#endif
+
+#define CHAR_BIT 8
+#define SCHAR_MIN (-128)
+#define SCHAR_MAX 127
+#define UCHAR_MAX 255
+#define SHRT_MIN  (-1-0x7fff)
+#define SHRT_MAX  0x7fff
+#define USHRT_MAX 0xffff
+#define INT_MIN  (-1-0x7fffffff)
+#define INT_MAX  0x7fffffff
+#define UINT_MAX 0xffffffffU
+#define LONG_MIN (-LONG_MAX-1)
+#define LONG_MAX __LONG_MAX
+#define ULONG_MAX (2UL*LONG_MAX+1)
+#define LLONG_MIN (-LLONG_MAX-1)
+#define LLONG_MAX  0x7fffffffffffffffLL
+#define ULLONG_MAX (2ULL*LLONG_MAX+1)
+
+#define MB_LEN_MAX 4
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#include <bits/limits.h>
+
+#define PIPE_BUF 4096
+#define FILESIZEBITS 64
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+#define PATH_MAX 4096
+#define NGROUPS_MAX 32
+#define ARG_MAX 131072
+#define IOV_MAX 1024
+#define SYMLOOP_MAX 40
+#define WORD_BIT 32
+#define SSIZE_MAX LONG_MAX
+#define TZNAME_MAX 6
+#define TTY_NAME_MAX 32
+#define HOST_NAME_MAX 255
+
+#if LONG_MAX == 0x7fffffffL
+#define LONG_BIT 32
+#else
+#define LONG_BIT 64
+#endif
+
+/* Implementation choices... */
+
+#define PTHREAD_KEYS_MAX 128
+#define PTHREAD_STACK_MIN 2048
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+#define SEM_VALUE_MAX 0x7fffffff
+#define SEM_NSEMS_MAX 256
+#define DELAYTIMER_MAX 0x7fffffff
+#define MQ_PRIO_MAX 32768
+#define LOGIN_NAME_MAX 256
+
+/* Arbitrary numbers... */
+
+#define BC_BASE_MAX 99
+#define BC_DIM_MAX 2048
+#define BC_SCALE_MAX 99
+#define BC_STRING_MAX 1000
+#define CHARCLASS_NAME_MAX 14
+#define COLL_WEIGHTS_MAX 2
+#define EXPR_NEST_MAX 32
+#define LINE_MAX 4096
+#define RE_DUP_MAX 255
+
+#define NL_ARGMAX 9
+#define NL_MSGMAX 32767
+#define NL_SETMAX 255
+#define NL_TEXTMAX 2048
+
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+
+#ifdef PAGESIZE
+#define PAGE_SIZE PAGESIZE
+#endif
+#define NZERO 20
+#define NL_LANGMAX 32
+
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+
+#define NL_NMAX 16
+
+#endif
+
+/* POSIX/SUS requirements follow. These numbers come directly
+ * from SUS and have nothing to do with the host system. */
+
+#define _POSIX_AIO_LISTIO_MAX   2
+#define _POSIX_AIO_MAX          1
+#define _POSIX_ARG_MAX          4096
+#define _POSIX_CHILD_MAX        25
+#define _POSIX_CLOCKRES_MIN     20000000
+#define _POSIX_DELAYTIMER_MAX   32
+#define _POSIX_HOST_NAME_MAX    255
+#define _POSIX_LINK_MAX         8
+#define _POSIX_LOGIN_NAME_MAX   9
+#define _POSIX_MAX_CANON        255
+#define _POSIX_MAX_INPUT        255
+#define _POSIX_MQ_OPEN_MAX      8
+#define _POSIX_MQ_PRIO_MAX      32
+#define _POSIX_NAME_MAX         14
+#define _POSIX_NGROUPS_MAX      8
+#define _POSIX_OPEN_MAX         20
+#define _POSIX_PATH_MAX         256
+#define _POSIX_PIPE_BUF         512
+#define _POSIX_RE_DUP_MAX       255
+#define _POSIX_RTSIG_MAX        8
+#define _POSIX_SEM_NSEMS_MAX    256
+#define _POSIX_SEM_VALUE_MAX    32767
+#define _POSIX_SIGQUEUE_MAX     32
+#define _POSIX_SSIZE_MAX        32767
+#define _POSIX_STREAM_MAX       8
+#define _POSIX_SS_REPL_MAX      4
+#define _POSIX_SYMLINK_MAX      255
+#define _POSIX_SYMLOOP_MAX      8
+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
+#define _POSIX_THREAD_KEYS_MAX  128
+#define _POSIX_THREAD_THREADS_MAX 64
+#define _POSIX_TIMER_MAX        32
+#define _POSIX_TRACE_EVENT_NAME_MAX 30
+#define _POSIX_TRACE_NAME_MAX   8
+#define _POSIX_TRACE_SYS_MAX    8
+#define _POSIX_TRACE_USER_EVENT_MAX 32
+#define _POSIX_TTY_NAME_MAX     9
+#define _POSIX_TZNAME_MAX       6
+#define _POSIX2_BC_BASE_MAX     99
+#define _POSIX2_BC_DIM_MAX      2048
+#define _POSIX2_BC_SCALE_MAX    99
+#define _POSIX2_BC_STRING_MAX   1000
+#define _POSIX2_CHARCLASS_NAME_MAX 14
+#define _POSIX2_COLL_WEIGHTS_MAX 2
+#define _POSIX2_EXPR_NEST_MAX   32
+#define _POSIX2_LINE_MAX        2048
+#define _POSIX2_RE_DUP_MAX      255
+
+#define _XOPEN_IOV_MAX          16
+#define _XOPEN_NAME_MAX         255
+#define _XOPEN_PATH_MAX         1024
+
+#endif
diff --git a/musl-include/aarch64/link.h b/musl-include/aarch64/link.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/link.h
@@ -0,0 +1,53 @@
+#ifndef _LINK_H
+#define _LINK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+#define __NEED_size_t
+#define __NEED_uint32_t
+#include <bits/alltypes.h>
+
+#if UINTPTR_MAX > 0xffffffff
+#define ElfW(type) Elf64_ ## type
+#else
+#define ElfW(type) Elf32_ ## type
+#endif
+
+#include <bits/link.h>
+
+struct dl_phdr_info {
+	ElfW(Addr) dlpi_addr;
+	const char *dlpi_name;
+	const ElfW(Phdr) *dlpi_phdr;
+	ElfW(Half) dlpi_phnum;
+	unsigned long long int dlpi_adds;
+	unsigned long long int dlpi_subs;
+	size_t dlpi_tls_modid;
+	void *dlpi_tls_data;
+};
+
+struct link_map {
+	ElfW(Addr) l_addr;
+	char *l_name;
+	ElfW(Dyn) *l_ld;
+	struct link_map *l_next, *l_prev;
+};
+
+struct r_debug {
+	int r_version;
+	struct link_map *r_map;
+	ElfW(Addr) r_brk;
+	enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state;
+	ElfW(Addr) r_ldbase;
+};
+
+int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/locale.h b/musl-include/aarch64/locale.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/locale.h
@@ -0,0 +1,88 @@
+#ifndef	_LOCALE_H
+#define	_LOCALE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define LC_CTYPE    0
+#define LC_NUMERIC  1
+#define LC_TIME     2
+#define LC_COLLATE  3
+#define LC_MONETARY 4
+#define LC_MESSAGES 5
+#define LC_ALL      6
+
+struct lconv {
+	char *decimal_point;
+	char *thousands_sep;
+	char *grouping;
+
+	char *int_curr_symbol;
+	char *currency_symbol;
+	char *mon_decimal_point;
+	char *mon_thousands_sep;
+	char *mon_grouping;
+	char *positive_sign;
+	char *negative_sign;
+	char int_frac_digits;
+	char frac_digits;
+	char p_cs_precedes;
+	char p_sep_by_space;
+	char n_cs_precedes;
+	char n_sep_by_space;
+	char p_sign_posn;
+	char n_sign_posn;
+	char int_p_cs_precedes;
+	char int_p_sep_by_space;
+	char int_n_cs_precedes;
+	char int_n_sep_by_space;
+	char int_p_sign_posn;
+	char int_n_sign_posn;
+};
+
+
+char *setlocale (int, const char *);
+struct lconv *localeconv(void);
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+#define LC_GLOBAL_LOCALE ((locale_t)-1)
+
+#define LC_CTYPE_MASK    (1<<LC_CTYPE)
+#define LC_NUMERIC_MASK  (1<<LC_NUMERIC)
+#define LC_TIME_MASK     (1<<LC_TIME)
+#define LC_COLLATE_MASK  (1<<LC_COLLATE)
+#define LC_MONETARY_MASK (1<<LC_MONETARY)
+#define LC_MESSAGES_MASK (1<<LC_MESSAGES)
+#define LC_ALL_MASK      0x7fffffff
+
+locale_t duplocale(locale_t);
+void freelocale(locale_t);
+locale_t newlocale(int, const char *, locale_t);
+locale_t uselocale(locale_t);
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/malloc.h b/musl-include/aarch64/malloc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/malloc.h
@@ -0,0 +1,25 @@
+#ifndef _MALLOC_H
+#define _MALLOC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+void *malloc (size_t);
+void *calloc (size_t, size_t);
+void *realloc (void *, size_t);
+void free (void *);
+void *valloc (size_t);
+void *memalign(size_t, size_t);
+
+size_t malloc_usable_size(void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/math.h b/musl-include/aarch64/math.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/math.h
@@ -0,0 +1,442 @@
+#ifndef _MATH_H
+#define _MATH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_float_t
+#define __NEED_double_t
+#include <bits/alltypes.h>
+
+#if 100*__GNUC__+__GNUC_MINOR__ >= 303
+#define NAN       __builtin_nanf("")
+#define INFINITY  __builtin_inff()
+#else
+#define NAN       (0.0f/0.0f)
+#define INFINITY  1e5000f
+#endif
+
+#define HUGE_VALF INFINITY
+#define HUGE_VAL  ((double)INFINITY)
+#define HUGE_VALL ((long double)INFINITY)
+
+#define MATH_ERRNO  1
+#define MATH_ERREXCEPT 2
+#define math_errhandling 2
+
+#define FP_ILOGBNAN (-1-0x7fffffff)
+#define FP_ILOGB0 FP_ILOGBNAN
+
+#define FP_NAN       0
+#define FP_INFINITE  1
+#define FP_ZERO      2
+#define FP_SUBNORMAL 3
+#define FP_NORMAL    4
+
+#ifdef __FP_FAST_FMA
+#define FP_FAST_FMA 1
+#endif
+
+#ifdef __FP_FAST_FMAF
+#define FP_FAST_FMAF 1
+#endif
+
+#ifdef __FP_FAST_FMAL
+#define FP_FAST_FMAL 1
+#endif
+
+int __fpclassify(double);
+int __fpclassifyf(float);
+int __fpclassifyl(long double);
+
+static __inline unsigned __FLOAT_BITS(float __f)
+{
+	union {float __f; unsigned __i;} __u;
+	__u.__f = __f;
+	return __u.__i;
+}
+static __inline unsigned long long __DOUBLE_BITS(double __f)
+{
+	union {double __f; unsigned long long __i;} __u;
+	__u.__f = __f;
+	return __u.__i;
+}
+
+#define fpclassify(x) ( \
+	sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \
+	sizeof(x) == sizeof(double) ? __fpclassify(x) : \
+	__fpclassifyl(x) )
+
+#define isinf(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \
+	__fpclassifyl(x) == FP_INFINITE)
+
+#define isnan(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \
+	__fpclassifyl(x) == FP_NAN)
+
+#define isnormal(x) ( \
+	sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \
+	sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \
+	__fpclassifyl(x) == FP_NORMAL)
+
+#define isfinite(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \
+	__fpclassifyl(x) > FP_INFINITE)
+
+int __signbit(double);
+int __signbitf(float);
+int __signbitl(long double);
+
+#define signbit(x) ( \
+	sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \
+	sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \
+	__signbitl(x) )
+
+#define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y)))
+
+#define __ISREL_DEF(rel, op, type) \
+static __inline int __is##rel(type __x, type __y) \
+{ return !isunordered(__x,__y) && __x op __y; }
+
+__ISREL_DEF(lessf, <, float_t)
+__ISREL_DEF(less, <, double_t)
+__ISREL_DEF(lessl, <, long double)
+__ISREL_DEF(lessequalf, <=, float_t)
+__ISREL_DEF(lessequal, <=, double_t)
+__ISREL_DEF(lessequall, <=, long double)
+__ISREL_DEF(lessgreaterf, !=, float_t)
+__ISREL_DEF(lessgreater, !=, double_t)
+__ISREL_DEF(lessgreaterl, !=, long double)
+__ISREL_DEF(greaterf, >, float_t)
+__ISREL_DEF(greater, >, double_t)
+__ISREL_DEF(greaterl, >, long double)
+__ISREL_DEF(greaterequalf, >=, float_t)
+__ISREL_DEF(greaterequal, >=, double_t)
+__ISREL_DEF(greaterequall, >=, long double)
+
+#define __tg_pred_2(x, y, p) ( \
+	sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \
+	sizeof((x)+(y)) == sizeof(double) ? p(x, y) : \
+	p##l(x, y) )
+
+#define isless(x, y)            __tg_pred_2(x, y, __isless)
+#define islessequal(x, y)       __tg_pred_2(x, y, __islessequal)
+#define islessgreater(x, y)     __tg_pred_2(x, y, __islessgreater)
+#define isgreater(x, y)         __tg_pred_2(x, y, __isgreater)
+#define isgreaterequal(x, y)    __tg_pred_2(x, y, __isgreaterequal)
+
+double      acos(double);
+float       acosf(float);
+long double acosl(long double);
+
+double      acosh(double);
+float       acoshf(float);
+long double acoshl(long double);
+
+double      asin(double);
+float       asinf(float);
+long double asinl(long double);
+
+double      asinh(double);
+float       asinhf(float);
+long double asinhl(long double);
+
+double      atan(double);
+float       atanf(float);
+long double atanl(long double);
+
+double      atan2(double, double);
+float       atan2f(float, float);
+long double atan2l(long double, long double);
+
+double      atanh(double);
+float       atanhf(float);
+long double atanhl(long double);
+
+double      cbrt(double);
+float       cbrtf(float);
+long double cbrtl(long double);
+
+double      ceil(double);
+float       ceilf(float);
+long double ceill(long double);
+
+double      copysign(double, double);
+float       copysignf(float, float);
+long double copysignl(long double, long double);
+
+double      cos(double);
+float       cosf(float);
+long double cosl(long double);
+
+double      cosh(double);
+float       coshf(float);
+long double coshl(long double);
+
+double      erf(double);
+float       erff(float);
+long double erfl(long double);
+
+double      erfc(double);
+float       erfcf(float);
+long double erfcl(long double);
+
+double      exp(double);
+float       expf(float);
+long double expl(long double);
+
+double      exp2(double);
+float       exp2f(float);
+long double exp2l(long double);
+
+double      expm1(double);
+float       expm1f(float);
+long double expm1l(long double);
+
+double      fabs(double);
+float       fabsf(float);
+long double fabsl(long double);
+
+double      fdim(double, double);
+float       fdimf(float, float);
+long double fdiml(long double, long double);
+
+double      floor(double);
+float       floorf(float);
+long double floorl(long double);
+
+double      fma(double, double, double);
+float       fmaf(float, float, float);
+long double fmal(long double, long double, long double);
+
+double      fmax(double, double);
+float       fmaxf(float, float);
+long double fmaxl(long double, long double);
+
+double      fmin(double, double);
+float       fminf(float, float);
+long double fminl(long double, long double);
+
+double      fmod(double, double);
+float       fmodf(float, float);
+long double fmodl(long double, long double);
+
+double      frexp(double, int *);
+float       frexpf(float, int *);
+long double frexpl(long double, int *);
+
+double      hypot(double, double);
+float       hypotf(float, float);
+long double hypotl(long double, long double);
+
+int         ilogb(double);
+int         ilogbf(float);
+int         ilogbl(long double);
+
+double      ldexp(double, int);
+float       ldexpf(float, int);
+long double ldexpl(long double, int);
+
+double      lgamma(double);
+float       lgammaf(float);
+long double lgammal(long double);
+
+long long   llrint(double);
+long long   llrintf(float);
+long long   llrintl(long double);
+
+long long   llround(double);
+long long   llroundf(float);
+long long   llroundl(long double);
+
+double      log(double);
+float       logf(float);
+long double logl(long double);
+
+double      log10(double);
+float       log10f(float);
+long double log10l(long double);
+
+double      log1p(double);
+float       log1pf(float);
+long double log1pl(long double);
+
+double      log2(double);
+float       log2f(float);
+long double log2l(long double);
+
+double      logb(double);
+float       logbf(float);
+long double logbl(long double);
+
+long        lrint(double);
+long        lrintf(float);
+long        lrintl(long double);
+
+long        lround(double);
+long        lroundf(float);
+long        lroundl(long double);
+
+double      modf(double, double *);
+float       modff(float, float *);
+long double modfl(long double, long double *);
+
+double      nan(const char *);
+float       nanf(const char *);
+long double nanl(const char *);
+
+double      nearbyint(double);
+float       nearbyintf(float);
+long double nearbyintl(long double);
+
+double      nextafter(double, double);
+float       nextafterf(float, float);
+long double nextafterl(long double, long double);
+
+double      nexttoward(double, long double);
+float       nexttowardf(float, long double);
+long double nexttowardl(long double, long double);
+
+double      pow(double, double);
+float       powf(float, float);
+long double powl(long double, long double);
+
+double      remainder(double, double);
+float       remainderf(float, float);
+long double remainderl(long double, long double);
+
+double      remquo(double, double, int *);
+float       remquof(float, float, int *);
+long double remquol(long double, long double, int *);
+
+double      rint(double);
+float       rintf(float);
+long double rintl(long double);
+
+double      round(double);
+float       roundf(float);
+long double roundl(long double);
+
+double      scalbln(double, long);
+float       scalblnf(float, long);
+long double scalblnl(long double, long);
+
+double      scalbn(double, int);
+float       scalbnf(float, int);
+long double scalbnl(long double, int);
+
+double      sin(double);
+float       sinf(float);
+long double sinl(long double);
+
+double      sinh(double);
+float       sinhf(float);
+long double sinhl(long double);
+
+double      sqrt(double);
+float       sqrtf(float);
+long double sqrtl(long double);
+
+double      tan(double);
+float       tanf(float);
+long double tanl(long double);
+
+double      tanh(double);
+float       tanhf(float);
+long double tanhl(long double);
+
+double      tgamma(double);
+float       tgammaf(float);
+long double tgammal(long double);
+
+double      trunc(double);
+float       truncf(float);
+long double truncl(long double);
+
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE)
+#undef  MAXFLOAT
+#define MAXFLOAT        3.40282346638528859812e+38F
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define M_E             2.7182818284590452354   /* e */
+#define M_LOG2E         1.4426950408889634074   /* log_2 e */
+#define M_LOG10E        0.43429448190325182765  /* log_10 e */
+#define M_LN2           0.69314718055994530942  /* log_e 2 */
+#define M_LN10          2.30258509299404568402  /* log_e 10 */
+#define M_PI            3.14159265358979323846  /* pi */
+#define M_PI_2          1.57079632679489661923  /* pi/2 */
+#define M_PI_4          0.78539816339744830962  /* pi/4 */
+#define M_1_PI          0.31830988618379067154  /* 1/pi */
+#define M_2_PI          0.63661977236758134308  /* 2/pi */
+#define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
+#define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
+#define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
+
+extern int signgam;
+
+double      j0(double);
+double      j1(double);
+double      jn(int, double);
+
+double      y0(double);
+double      y1(double);
+double      yn(int, double);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define HUGE            3.40282346638528859812e+38F
+
+double      drem(double, double);
+float       dremf(float, float);
+
+int         finite(double);
+int         finitef(float);
+
+double      scalb(double, double);
+float       scalbf(float, float);
+
+double      significand(double);
+float       significandf(float);
+
+double      lgamma_r(double, int*);
+float       lgammaf_r(float, int*);
+
+float       j0f(float);
+float       j1f(float);
+float       jnf(int, float);
+
+float       y0f(float);
+float       y1f(float);
+float       ynf(int, float);
+#endif
+
+#ifdef _GNU_SOURCE
+long double lgammal_r(long double, int*);
+
+void        sincos(double, double*, double*);
+void        sincosf(float, float*, float*);
+void        sincosl(long double, long double*, long double*);
+
+double      exp10(double);
+float       exp10f(float);
+long double exp10l(long double);
+
+double      pow10(double);
+float       pow10f(float);
+long double pow10l(long double);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/memory.h b/musl-include/aarch64/memory.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/memory.h
@@ -0,0 +1,1 @@
+#include <string.h>
diff --git a/musl-include/aarch64/mntent.h b/musl-include/aarch64/mntent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/mntent.h
@@ -0,0 +1,43 @@
+#ifndef _MNTENT_H
+#define _MNTENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_FILE
+#include <bits/alltypes.h>
+
+#define MOUNTED "/etc/mtab"
+
+#define MNTTYPE_IGNORE	"ignore"
+#define MNTTYPE_NFS	"nfs"
+#define MNTTYPE_SWAP	"swap"
+#define MNTOPT_DEFAULTS	"defaults"
+#define MNTOPT_RO	"ro"
+#define MNTOPT_RW	"rw"
+#define MNTOPT_SUID	"suid"
+#define MNTOPT_NOSUID	"nosuid"
+#define MNTOPT_NOAUTO	"noauto"
+
+struct mntent {
+	char *mnt_fsname;
+	char *mnt_dir;
+	char *mnt_type;
+	char *mnt_opts;
+	int mnt_freq;
+	int mnt_passno;
+};
+
+FILE *setmntent(const char *, const char *);
+int endmntent(FILE *);
+struct mntent *getmntent(FILE *);
+struct mntent *getmntent_r(FILE *, struct mntent *, char *, int);
+int addmntent(FILE *, const struct mntent *);
+char *hasmntopt(const struct mntent *, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/monetary.h b/musl-include/aarch64/monetary.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/monetary.h
@@ -0,0 +1,23 @@
+#ifndef _MONETARY_H
+#define _MONETARY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ssize_t
+#define __NEED_size_t
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...);
+ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/mqueue.h b/musl-include/aarch64/mqueue.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/mqueue.h
@@ -0,0 +1,41 @@
+#ifndef _MQUEUE_H
+#define _MQUEUE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_pthread_attr_t
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+typedef int mqd_t;
+struct mq_attr {
+	long mq_flags, mq_maxmsg, mq_msgsize, mq_curmsgs, __unused[4];
+};
+struct sigevent;
+
+int mq_close(mqd_t);
+int mq_getattr(mqd_t, struct mq_attr *);
+int mq_notify(mqd_t, const struct sigevent *);
+mqd_t mq_open(const char *, int, ...);
+ssize_t mq_receive(mqd_t, char *, size_t, unsigned *);
+int mq_send(mqd_t, const char *, size_t, unsigned);
+int mq_setattr(mqd_t, const struct mq_attr *__restrict, struct mq_attr *__restrict);
+ssize_t mq_timedreceive(mqd_t, char *__restrict, size_t, unsigned *__restrict, const struct timespec *__restrict);
+int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct timespec *);
+int mq_unlink(const char *);
+
+#if _REDIR_TIME64
+__REDIR(mq_timedreceive, __mq_timedreceive_time64);
+__REDIR(mq_timedsend, __mq_timedsend_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/net/ethernet.h b/musl-include/aarch64/net/ethernet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/net/ethernet.h
@@ -0,0 +1,55 @@
+#ifndef _NET_ETHERNET_H
+#define _NET_ETHERNET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <netinet/if_ether.h>
+
+struct ether_addr {
+	uint8_t ether_addr_octet[ETH_ALEN];
+};
+
+struct ether_header {
+	uint8_t  ether_dhost[ETH_ALEN];
+	uint8_t  ether_shost[ETH_ALEN];
+	uint16_t ether_type;
+};
+
+#define	ETHERTYPE_PUP		0x0200
+#define ETHERTYPE_SPRITE	0x0500
+#define	ETHERTYPE_IP		0x0800
+#define	ETHERTYPE_ARP		0x0806
+#define	ETHERTYPE_REVARP	0x8035
+#define ETHERTYPE_AT		0x809B
+#define ETHERTYPE_AARP		0x80F3
+#define	ETHERTYPE_VLAN		0x8100
+#define ETHERTYPE_IPX		0x8137
+#define	ETHERTYPE_IPV6		0x86dd
+#define ETHERTYPE_LOOPBACK	0x9000
+
+
+#define	ETHER_ADDR_LEN	ETH_ALEN
+#define	ETHER_TYPE_LEN	2
+#define	ETHER_CRC_LEN	4
+#define	ETHER_HDR_LEN	ETH_HLEN
+#define	ETHER_MIN_LEN	(ETH_ZLEN + ETHER_CRC_LEN)
+#define	ETHER_MAX_LEN	(ETH_FRAME_LEN + ETHER_CRC_LEN)
+
+#define	ETHER_IS_VALID_LEN(foo)	\
+	((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
+
+#define	ETHERTYPE_TRAIL		0x1000
+#define	ETHERTYPE_NTRAILER	16
+
+#define	ETHERMTU	ETH_DATA_LEN
+#define	ETHERMIN	(ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/net/if.h b/musl-include/aarch64/net/if.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/net/if.h
@@ -0,0 +1,141 @@
+#ifndef _NET_IF_H
+#define _NET_IF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define IF_NAMESIZE 16
+
+struct if_nameindex {
+	unsigned int if_index;
+	char *if_name;
+};
+
+unsigned int if_nametoindex (const char *);
+char *if_indextoname (unsigned int, char *);
+struct if_nameindex *if_nameindex (void);
+void if_freenameindex (struct if_nameindex *);
+
+
+
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#include <sys/socket.h>
+
+#define IFF_UP	0x1
+#define IFF_BROADCAST 0x2
+#define IFF_DEBUG 0x4
+#define IFF_LOOPBACK 0x8
+#define IFF_POINTOPOINT 0x10
+#define IFF_NOTRAILERS 0x20
+#define IFF_RUNNING 0x40
+#define IFF_NOARP 0x80
+#define IFF_PROMISC 0x100
+#define IFF_ALLMULTI 0x200
+#define IFF_MASTER 0x400
+#define IFF_SLAVE 0x800
+#define IFF_MULTICAST 0x1000
+#define IFF_PORTSEL 0x2000
+#define IFF_AUTOMEDIA 0x4000
+#define IFF_DYNAMIC 0x8000
+#define IFF_LOWER_UP 0x10000
+#define IFF_DORMANT 0x20000
+#define IFF_ECHO 0x40000
+#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
+        IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
+
+struct ifaddr {
+	struct sockaddr ifa_addr;
+	union {
+		struct sockaddr	ifu_broadaddr;
+		struct sockaddr	ifu_dstaddr;
+	} ifa_ifu;
+	struct iface *ifa_ifp;
+	struct ifaddr *ifa_next;
+};
+
+#define ifa_broadaddr	ifa_ifu.ifu_broadaddr
+#define ifa_dstaddr	ifa_ifu.ifu_dstaddr
+
+struct ifmap {
+	unsigned long int mem_start;
+	unsigned long int mem_end;
+	unsigned short int base_addr;
+	unsigned char irq;
+	unsigned char dma;
+	unsigned char port;
+};
+
+#define IFHWADDRLEN	6
+#define IFNAMSIZ	IF_NAMESIZE
+
+struct ifreq {
+	union {
+		char ifrn_name[IFNAMSIZ];
+	} ifr_ifrn;
+	union {
+		struct sockaddr ifru_addr;
+		struct sockaddr ifru_dstaddr;
+		struct sockaddr ifru_broadaddr;
+		struct sockaddr ifru_netmask;
+		struct sockaddr ifru_hwaddr;
+		short int ifru_flags;
+		int ifru_ivalue;
+		int ifru_mtu;
+		struct ifmap ifru_map;
+		char ifru_slave[IFNAMSIZ];
+		char ifru_newname[IFNAMSIZ];
+		char *ifru_data;
+	} ifr_ifru;
+};
+
+#define ifr_name	ifr_ifrn.ifrn_name
+#define ifr_hwaddr	ifr_ifru.ifru_hwaddr
+#define ifr_addr	ifr_ifru.ifru_addr
+#define ifr_dstaddr	ifr_ifru.ifru_dstaddr
+#define ifr_broadaddr	ifr_ifru.ifru_broadaddr
+#define ifr_netmask	ifr_ifru.ifru_netmask
+#define ifr_flags	ifr_ifru.ifru_flags
+#define ifr_metric	ifr_ifru.ifru_ivalue
+#define ifr_mtu		ifr_ifru.ifru_mtu
+#define ifr_map		ifr_ifru.ifru_map
+#define ifr_slave	ifr_ifru.ifru_slave
+#define ifr_data	ifr_ifru.ifru_data
+#define ifr_ifindex	ifr_ifru.ifru_ivalue
+#define ifr_bandwidth	ifr_ifru.ifru_ivalue
+#define ifr_qlen	ifr_ifru.ifru_ivalue
+#define ifr_newname	ifr_ifru.ifru_newname
+#define _IOT_ifreq	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0)
+#define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0)
+#define _IOT_ifreq_int	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
+
+struct ifconf {
+	int ifc_len;		
+	union {
+		char *ifcu_buf;
+		struct ifreq *ifcu_req;
+	} ifc_ifcu;
+};
+
+#define ifc_buf		ifc_ifcu.ifcu_buf
+#define ifc_req		ifc_ifcu.ifcu_req
+#define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
+
+#define __UAPI_DEF_IF_IFCONF                                    0
+#define __UAPI_DEF_IF_IFMAP                                     0
+#define __UAPI_DEF_IF_IFNAMSIZ                                  0
+#define __UAPI_DEF_IF_IFREQ                                     0
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS                          0
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO    0
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/net/if_arp.h b/musl-include/aarch64/net/if_arp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/net/if_arp.h
@@ -0,0 +1,142 @@
+/* Nonstandard header */
+#ifndef _NET_IF_ARP_H
+#define _NET_IF_ARP_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#define MAX_ADDR_LEN	7
+
+#define	ARPOP_REQUEST	1
+#define	ARPOP_REPLY	2
+#define	ARPOP_RREQUEST	3
+#define	ARPOP_RREPLY	4
+#define	ARPOP_InREQUEST	8
+#define	ARPOP_InREPLY	9
+#define	ARPOP_NAK	10
+
+struct arphdr {
+	uint16_t ar_hrd;
+	uint16_t ar_pro;
+	uint8_t ar_hln;
+	uint8_t ar_pln;
+	uint16_t ar_op;
+};
+
+
+#define ARPHRD_NETROM	0
+#define ARPHRD_ETHER 	1
+#define	ARPHRD_EETHER	2
+#define	ARPHRD_AX25	3
+#define	ARPHRD_PRONET	4
+#define	ARPHRD_CHAOS	5
+#define	ARPHRD_IEEE802	6
+#define	ARPHRD_ARCNET	7
+#define	ARPHRD_APPLETLK	8
+#define	ARPHRD_DLCI	15
+#define	ARPHRD_ATM	19
+#define	ARPHRD_METRICOM	23
+#define ARPHRD_IEEE1394	24
+#define ARPHRD_EUI64		27
+#define ARPHRD_INFINIBAND	32
+#define ARPHRD_SLIP	256
+#define ARPHRD_CSLIP	257
+#define ARPHRD_SLIP6	258
+#define ARPHRD_CSLIP6	259
+#define ARPHRD_RSRVD	260
+#define ARPHRD_ADAPT	264
+#define ARPHRD_ROSE	270
+#define ARPHRD_X25	271
+#define ARPHRD_HWX25	272
+#define ARPHRD_CAN	280
+#define ARPHRD_PPP	512
+#define ARPHRD_CISCO	513
+#define ARPHRD_HDLC	ARPHRD_CISCO
+#define ARPHRD_LAPB	516
+#define ARPHRD_DDCMP	517
+#define	ARPHRD_RAWHDLC	518
+#define ARPHRD_RAWIP	519
+
+#define ARPHRD_TUNNEL	768
+#define ARPHRD_TUNNEL6	769
+#define ARPHRD_FRAD	770
+#define ARPHRD_SKIP	771
+#define ARPHRD_LOOPBACK	772
+#define ARPHRD_LOCALTLK 773
+#define ARPHRD_FDDI	774
+#define ARPHRD_BIF	775
+#define ARPHRD_SIT	776
+#define ARPHRD_IPDDP	777
+#define ARPHRD_IPGRE	778
+#define ARPHRD_PIMREG	779
+#define ARPHRD_HIPPI	780
+#define ARPHRD_ASH	781
+#define ARPHRD_ECONET	782
+#define ARPHRD_IRDA	783
+#define ARPHRD_FCPP	784
+#define ARPHRD_FCAL	785
+#define ARPHRD_FCPL	786
+#define ARPHRD_FCFABRIC 787
+#define ARPHRD_IEEE802_TR 800
+#define ARPHRD_IEEE80211 801
+#define ARPHRD_IEEE80211_PRISM 802
+#define ARPHRD_IEEE80211_RADIOTAP 803
+#define ARPHRD_IEEE802154 804
+#define ARPHRD_IEEE802154_MONITOR 805
+#define ARPHRD_PHONET 820
+#define ARPHRD_PHONET_PIPE 821
+#define ARPHRD_CAIF 822
+#define ARPHRD_IP6GRE 823
+#define ARPHRD_NETLINK 824
+#define ARPHRD_6LOWPAN 825
+#define ARPHRD_VSOCKMON 826
+
+#define ARPHRD_VOID	  0xFFFF
+#define ARPHRD_NONE	  0xFFFE
+
+struct arpreq {
+	struct sockaddr arp_pa;
+	struct sockaddr arp_ha;
+	int arp_flags;
+	struct sockaddr arp_netmask;
+	char arp_dev[16];
+};
+
+struct arpreq_old {
+	struct sockaddr arp_pa;
+	struct sockaddr arp_ha;
+	int arp_flags;
+	struct sockaddr arp_netmask;
+};
+
+#define ATF_COM		0x02
+#define	ATF_PERM	0x04
+#define	ATF_PUBL	0x08
+#define	ATF_USETRAILERS	0x10
+#define ATF_NETMASK     0x20
+#define ATF_DONTPUB	0x40
+#define ATF_MAGIC	0x80
+
+#define ARPD_UPDATE	0x01
+#define ARPD_LOOKUP	0x02
+#define ARPD_FLUSH	0x03
+
+struct arpd_request {
+	unsigned short req;
+	uint32_t ip;
+	unsigned long dev;
+	unsigned long stamp;
+	unsigned long updated;
+	unsigned char ha[MAX_ADDR_LEN];
+};
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/net/route.h b/musl-include/aarch64/net/route.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/net/route.h
@@ -0,0 +1,124 @@
+#ifndef _NET_ROUTE_H
+#define _NET_ROUTE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+
+struct rtentry {
+	unsigned long int rt_pad1;
+	struct sockaddr rt_dst;
+	struct sockaddr rt_gateway;
+	struct sockaddr rt_genmask;
+	unsigned short int rt_flags;
+	short int rt_pad2;
+	unsigned long int rt_pad3;
+	unsigned char rt_tos;
+	unsigned char rt_class;
+	short int rt_pad4[sizeof(long)/2-1];
+	short int rt_metric;
+	char *rt_dev;
+	unsigned long int rt_mtu;
+	unsigned long int rt_window;
+	unsigned short int rt_irtt;
+};
+
+#define rt_mss	rt_mtu
+
+
+struct in6_rtmsg {
+	struct in6_addr rtmsg_dst;
+	struct in6_addr rtmsg_src;
+	struct in6_addr rtmsg_gateway;
+	uint32_t rtmsg_type;
+	uint16_t rtmsg_dst_len;
+	uint16_t rtmsg_src_len;
+	uint32_t rtmsg_metric;
+	unsigned long int rtmsg_info;
+	uint32_t rtmsg_flags;
+	int rtmsg_ifindex;
+};
+
+
+#define	RTF_UP		0x0001
+#define	RTF_GATEWAY	0x0002
+
+#define	RTF_HOST	0x0004
+#define RTF_REINSTATE	0x0008
+#define	RTF_DYNAMIC	0x0010
+#define	RTF_MODIFIED	0x0020
+#define RTF_MTU		0x0040
+#define RTF_MSS		RTF_MTU
+#define RTF_WINDOW	0x0080
+#define RTF_IRTT	0x0100
+#define RTF_REJECT	0x0200
+#define	RTF_STATIC	0x0400
+#define	RTF_XRESOLVE	0x0800
+#define RTF_NOFORWARD   0x1000
+#define RTF_THROW	0x2000
+#define RTF_NOPMTUDISC  0x4000
+
+#define RTF_DEFAULT	0x00010000
+#define RTF_ALLONLINK	0x00020000
+#define RTF_ADDRCONF	0x00040000
+
+#define RTF_LINKRT	0x00100000
+#define RTF_NONEXTHOP	0x00200000
+
+#define RTF_CACHE	0x01000000
+#define RTF_FLOW	0x02000000
+#define RTF_POLICY	0x04000000
+
+#define RTCF_VALVE	0x00200000
+#define RTCF_MASQ	0x00400000
+#define RTCF_NAT	0x00800000
+#define RTCF_DOREDIRECT 0x01000000
+#define RTCF_LOG	0x02000000
+#define RTCF_DIRECTSRC	0x04000000
+
+#define RTF_LOCAL	0x80000000
+#define RTF_INTERFACE	0x40000000
+#define RTF_MULTICAST	0x20000000
+#define RTF_BROADCAST	0x10000000
+#define RTF_NAT		0x08000000
+
+#define RTF_ADDRCLASSMASK	0xF8000000
+#define RT_ADDRCLASS(flags)	((uint32_t) flags >> 23)
+
+#define RT_TOS(tos)		((tos) & IPTOS_TOS_MASK)
+
+#define RT_LOCALADDR(flags)	((flags & RTF_ADDRCLASSMASK) \
+				 == (RTF_LOCAL|RTF_INTERFACE))
+
+#define RT_CLASS_UNSPEC		0
+#define RT_CLASS_DEFAULT	253
+
+#define RT_CLASS_MAIN		254
+#define RT_CLASS_LOCAL		255
+#define RT_CLASS_MAX		255
+
+
+#define RTMSG_ACK		NLMSG_ACK
+#define RTMSG_OVERRUN		NLMSG_OVERRUN
+
+#define RTMSG_NEWDEVICE		0x11
+#define RTMSG_DELDEVICE		0x12
+#define RTMSG_NEWROUTE		0x21
+#define RTMSG_DELROUTE		0x22
+#define RTMSG_NEWRULE		0x31
+#define RTMSG_DELRULE		0x32
+#define RTMSG_CONTROL		0x40
+
+#define RTMSG_AR_FAILED		0x51
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netdb.h b/musl-include/aarch64/netdb.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netdb.h
@@ -0,0 +1,157 @@
+#ifndef	_NETDB_H
+#define	_NETDB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_size_t
+#include <bits/alltypes.h>
+#endif
+
+struct addrinfo {
+	int ai_flags;
+	int ai_family;
+	int ai_socktype;
+	int ai_protocol;
+	socklen_t ai_addrlen;
+	struct sockaddr *ai_addr;
+	char *ai_canonname;
+	struct addrinfo *ai_next;
+};
+
+#define AI_PASSIVE      0x01
+#define AI_CANONNAME    0x02
+#define AI_NUMERICHOST  0x04
+#define AI_V4MAPPED     0x08
+#define AI_ALL          0x10
+#define AI_ADDRCONFIG   0x20
+#define AI_NUMERICSERV  0x400
+
+
+#define NI_NUMERICHOST  0x01
+#define NI_NUMERICSERV  0x02
+#define NI_NOFQDN       0x04
+#define NI_NAMEREQD     0x08
+#define NI_DGRAM        0x10
+#define NI_NUMERICSCOPE 0x100
+
+#define EAI_BADFLAGS   -1
+#define EAI_NONAME     -2
+#define EAI_AGAIN      -3
+#define EAI_FAIL       -4
+#define EAI_NODATA     -5
+#define EAI_FAMILY     -6
+#define EAI_SOCKTYPE   -7
+#define EAI_SERVICE    -8
+#define EAI_MEMORY     -10
+#define EAI_SYSTEM     -11
+#define EAI_OVERFLOW   -12
+
+int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
+void freeaddrinfo (struct addrinfo *);
+int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
+const char *gai_strerror(int);
+
+
+/* Legacy functions follow (marked OBsolete in SUS) */
+
+struct netent {
+	char *n_name;
+	char **n_aliases;
+	int n_addrtype;
+	uint32_t n_net;
+};
+
+struct hostent {
+	char *h_name;
+	char **h_aliases;
+	int h_addrtype;
+	int h_length;
+	char **h_addr_list;
+};
+#define h_addr h_addr_list[0]
+
+struct servent {
+	char *s_name;
+	char **s_aliases;
+	int s_port;
+	char *s_proto;
+};
+
+struct protoent {
+	char *p_name;
+	char **p_aliases;
+	int p_proto;
+};
+
+void sethostent (int);
+void endhostent (void);
+struct hostent *gethostent (void);
+
+void setnetent (int);
+void endnetent (void);
+struct netent *getnetent (void);
+struct netent *getnetbyaddr (uint32_t, int);
+struct netent *getnetbyname (const char *);
+
+void setservent (int);
+void endservent (void);
+struct servent *getservent (void);
+struct servent *getservbyname (const char *, const char *);
+struct servent *getservbyport (int, const char *);
+
+void setprotoent (int);
+void endprotoent (void);
+struct protoent *getprotoent (void);
+struct protoent *getprotobyname (const char *);
+struct protoent *getprotobynumber (int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+struct hostent *gethostbyname (const char *);
+struct hostent *gethostbyaddr (const void *, socklen_t, int);
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int *__h_errno_location(void);
+#define h_errno (*__h_errno_location())
+#define HOST_NOT_FOUND 1
+#define TRY_AGAIN      2
+#define NO_RECOVERY    3
+#define NO_DATA        4
+#define NO_ADDRESS     NO_DATA
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void herror(const char *);
+const char *hstrerror(int);
+int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
+int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
+struct hostent *gethostbyname2(const char *, int);
+int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
+int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
+int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
+#define EAI_NODATA     -5
+#define EAI_ADDRFAMILY -9
+#define EAI_INPROGRESS -100
+#define EAI_CANCELED   -101
+#define EAI_NOTCANCELED -102
+#define EAI_ALLDONE    -103
+#define EAI_INTR       -104
+#define EAI_IDN_ENCODE -105
+#define NI_MAXHOST 255
+#define NI_MAXSERV 32
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netinet/ether.h b/musl-include/aarch64/netinet/ether.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/ether.h
@@ -0,0 +1,22 @@
+#ifndef _NETINET_ETHER_H
+#define _NETINET_ETHER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <netinet/if_ether.h>
+
+char *ether_ntoa (const struct ether_addr *);
+struct ether_addr *ether_aton (const char *);
+char *ether_ntoa_r (const struct ether_addr *, char *);
+struct ether_addr *ether_aton_r (const char *, struct ether_addr *);
+int ether_line(const char *, struct ether_addr *, char *);
+int ether_ntohost(char *, const struct ether_addr *);
+int ether_hostton(const char *, struct ether_addr *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netinet/icmp6.h b/musl-include/aarch64/netinet/icmp6.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/icmp6.h
@@ -0,0 +1,305 @@
+#ifndef _NETINET_ICMP6_H
+#define _NETINET_ICMP6_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#define ICMP6_FILTER 1
+
+#define ICMP6_FILTER_BLOCK		1
+#define ICMP6_FILTER_PASS		2
+#define ICMP6_FILTER_BLOCKOTHERS	3
+#define ICMP6_FILTER_PASSONLY		4
+
+struct icmp6_filter {
+	uint32_t icmp6_filt[8];
+};
+
+struct icmp6_hdr {
+	uint8_t     icmp6_type;
+	uint8_t     icmp6_code;
+	uint16_t    icmp6_cksum;
+	union {
+		uint32_t  icmp6_un_data32[1];
+		uint16_t  icmp6_un_data16[2];
+		uint8_t   icmp6_un_data8[4];
+	} icmp6_dataun;
+};
+
+#define icmp6_data32    icmp6_dataun.icmp6_un_data32
+#define icmp6_data16    icmp6_dataun.icmp6_un_data16
+#define icmp6_data8     icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr      icmp6_data32[0]
+#define icmp6_mtu       icmp6_data32[0]
+#define icmp6_id        icmp6_data16[0]
+#define icmp6_seq       icmp6_data16[1]
+#define icmp6_maxdelay  icmp6_data16[0]
+
+#define ICMP6_DST_UNREACH             1
+#define ICMP6_PACKET_TOO_BIG          2
+#define ICMP6_TIME_EXCEEDED           3
+#define ICMP6_PARAM_PROB              4
+
+#define ICMP6_INFOMSG_MASK  0x80
+
+#define ICMP6_ECHO_REQUEST          128
+#define ICMP6_ECHO_REPLY            129
+#define MLD_LISTENER_QUERY          130
+#define MLD_LISTENER_REPORT         131
+#define MLD_LISTENER_REDUCTION      132
+
+#define ICMP6_DST_UNREACH_NOROUTE     0
+#define ICMP6_DST_UNREACH_ADMIN       1
+#define ICMP6_DST_UNREACH_BEYONDSCOPE 2
+#define ICMP6_DST_UNREACH_ADDR        3
+#define ICMP6_DST_UNREACH_NOPORT      4
+
+#define ICMP6_TIME_EXCEED_TRANSIT     0
+#define ICMP6_TIME_EXCEED_REASSEMBLY  1
+
+#define ICMP6_PARAMPROB_HEADER        0
+#define ICMP6_PARAMPROB_NEXTHEADER    1
+#define ICMP6_PARAMPROB_OPTION        2
+
+#define ICMP6_FILTER_WILLPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+
+#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+
+#define ICMP6_FILTER_SETPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) |=  (1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETPASSALL(filterp) \
+	memset (filterp, 0, sizeof (struct icmp6_filter));
+
+#define ICMP6_FILTER_SETBLOCKALL(filterp) \
+	memset (filterp, 0xFF, sizeof (struct icmp6_filter));
+
+#define ND_ROUTER_SOLICIT           133
+#define ND_ROUTER_ADVERT            134
+#define ND_NEIGHBOR_SOLICIT         135
+#define ND_NEIGHBOR_ADVERT          136
+#define ND_REDIRECT                 137
+
+struct nd_router_solicit {
+	struct icmp6_hdr  nd_rs_hdr;
+};
+
+#define nd_rs_type               nd_rs_hdr.icmp6_type
+#define nd_rs_code               nd_rs_hdr.icmp6_code
+#define nd_rs_cksum              nd_rs_hdr.icmp6_cksum
+#define nd_rs_reserved           nd_rs_hdr.icmp6_data32[0]
+
+struct nd_router_advert {
+	struct icmp6_hdr  nd_ra_hdr;
+	uint32_t   nd_ra_reachable;
+	uint32_t   nd_ra_retransmit;
+};
+
+#define nd_ra_type               nd_ra_hdr.icmp6_type
+#define nd_ra_code               nd_ra_hdr.icmp6_code
+#define nd_ra_cksum              nd_ra_hdr.icmp6_cksum
+#define nd_ra_curhoplimit        nd_ra_hdr.icmp6_data8[0]
+#define nd_ra_flags_reserved     nd_ra_hdr.icmp6_data8[1]
+#define ND_RA_FLAG_MANAGED       0x80
+#define ND_RA_FLAG_OTHER         0x40
+#define ND_RA_FLAG_HOME_AGENT    0x20
+#define nd_ra_router_lifetime    nd_ra_hdr.icmp6_data16[1]
+
+struct nd_neighbor_solicit {
+	struct icmp6_hdr  nd_ns_hdr;
+	struct in6_addr   nd_ns_target;
+};
+
+#define nd_ns_type               nd_ns_hdr.icmp6_type
+#define nd_ns_code               nd_ns_hdr.icmp6_code
+#define nd_ns_cksum              nd_ns_hdr.icmp6_cksum
+#define nd_ns_reserved           nd_ns_hdr.icmp6_data32[0]
+
+struct nd_neighbor_advert {
+	struct icmp6_hdr  nd_na_hdr;
+	struct in6_addr   nd_na_target;
+};
+
+#define nd_na_type               nd_na_hdr.icmp6_type
+#define nd_na_code               nd_na_hdr.icmp6_code
+#define nd_na_cksum              nd_na_hdr.icmp6_cksum
+#define nd_na_flags_reserved     nd_na_hdr.icmp6_data32[0]
+#if     __BYTE_ORDER == __BIG_ENDIAN
+#define ND_NA_FLAG_ROUTER        0x80000000
+#define ND_NA_FLAG_SOLICITED     0x40000000
+#define ND_NA_FLAG_OVERRIDE      0x20000000
+#else
+#define ND_NA_FLAG_ROUTER        0x00000080
+#define ND_NA_FLAG_SOLICITED     0x00000040
+#define ND_NA_FLAG_OVERRIDE      0x00000020
+#endif
+
+struct nd_redirect {
+	struct icmp6_hdr  nd_rd_hdr;
+	struct in6_addr   nd_rd_target;
+	struct in6_addr   nd_rd_dst;
+};
+
+#define nd_rd_type               nd_rd_hdr.icmp6_type
+#define nd_rd_code               nd_rd_hdr.icmp6_code
+#define nd_rd_cksum              nd_rd_hdr.icmp6_cksum
+#define nd_rd_reserved           nd_rd_hdr.icmp6_data32[0]
+
+struct nd_opt_hdr {
+	uint8_t  nd_opt_type;
+	uint8_t  nd_opt_len;
+};
+
+#define ND_OPT_SOURCE_LINKADDR		1
+#define ND_OPT_TARGET_LINKADDR		2
+#define ND_OPT_PREFIX_INFORMATION	3
+#define ND_OPT_REDIRECTED_HEADER	4
+#define ND_OPT_MTU			5
+#define ND_OPT_RTR_ADV_INTERVAL		7
+#define ND_OPT_HOME_AGENT_INFO		8
+
+struct nd_opt_prefix_info {
+	uint8_t   nd_opt_pi_type;
+	uint8_t   nd_opt_pi_len;
+	uint8_t   nd_opt_pi_prefix_len;
+	uint8_t   nd_opt_pi_flags_reserved;
+	uint32_t  nd_opt_pi_valid_time;
+	uint32_t  nd_opt_pi_preferred_time;
+	uint32_t  nd_opt_pi_reserved2;
+	struct in6_addr  nd_opt_pi_prefix;
+};
+
+#define ND_OPT_PI_FLAG_ONLINK	0x80
+#define ND_OPT_PI_FLAG_AUTO	0x40
+#define ND_OPT_PI_FLAG_RADDR	0x20
+
+struct nd_opt_rd_hdr {
+	uint8_t   nd_opt_rh_type;
+	uint8_t   nd_opt_rh_len;
+	uint16_t  nd_opt_rh_reserved1;
+	uint32_t  nd_opt_rh_reserved2;
+};
+
+struct nd_opt_mtu {
+	uint8_t   nd_opt_mtu_type;
+	uint8_t   nd_opt_mtu_len;
+	uint16_t  nd_opt_mtu_reserved;
+	uint32_t  nd_opt_mtu_mtu;
+};
+
+struct mld_hdr {
+	struct icmp6_hdr    mld_icmp6_hdr;
+	struct in6_addr     mld_addr;
+};
+
+#define mld_type        mld_icmp6_hdr.icmp6_type
+#define mld_code        mld_icmp6_hdr.icmp6_code
+#define mld_cksum       mld_icmp6_hdr.icmp6_cksum
+#define mld_maxdelay    mld_icmp6_hdr.icmp6_data16[0]
+#define mld_reserved    mld_icmp6_hdr.icmp6_data16[1]
+
+#define ICMP6_ROUTER_RENUMBERING    138
+
+struct icmp6_router_renum {
+	struct icmp6_hdr    rr_hdr;
+	uint8_t             rr_segnum;
+	uint8_t             rr_flags;
+	uint16_t            rr_maxdelay;
+	uint32_t            rr_reserved;
+};
+
+#define rr_type		rr_hdr.icmp6_type
+#define rr_code         rr_hdr.icmp6_code
+#define rr_cksum        rr_hdr.icmp6_cksum
+#define rr_seqnum       rr_hdr.icmp6_data32[0]
+
+#define ICMP6_RR_FLAGS_TEST             0x80
+#define ICMP6_RR_FLAGS_REQRESULT        0x40
+#define ICMP6_RR_FLAGS_FORCEAPPLY       0x20
+#define ICMP6_RR_FLAGS_SPECSITE         0x10
+#define ICMP6_RR_FLAGS_PREVDONE         0x08
+
+struct rr_pco_match {
+	uint8_t             rpm_code;
+	uint8_t             rpm_len;
+	uint8_t             rpm_ordinal;
+	uint8_t             rpm_matchlen;
+	uint8_t             rpm_minlen;
+	uint8_t             rpm_maxlen;
+	uint16_t            rpm_reserved;
+	struct in6_addr     rpm_prefix;
+};
+
+#define RPM_PCO_ADD             1
+#define RPM_PCO_CHANGE          2
+#define RPM_PCO_SETGLOBAL       3
+
+struct rr_pco_use {
+	uint8_t             rpu_uselen;
+	uint8_t             rpu_keeplen;
+	uint8_t             rpu_ramask;
+	uint8_t             rpu_raflags;
+	uint32_t            rpu_vltime;
+	uint32_t            rpu_pltime;
+	uint32_t            rpu_flags;
+	struct in6_addr     rpu_prefix;
+};
+
+#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK  0x20
+#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO    0x10
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
+#else
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
+#endif
+
+struct rr_result {
+	uint16_t            rrr_flags;
+	uint8_t             rrr_ordinal;
+	uint8_t             rrr_matchedlen;
+	uint32_t            rrr_ifid;
+	struct in6_addr     rrr_prefix;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ICMP6_RR_RESULT_FLAGS_OOB       0x0002
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
+#else
+#define ICMP6_RR_RESULT_FLAGS_OOB       0x0200
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
+#endif
+
+struct nd_opt_adv_interval {
+	uint8_t   nd_opt_adv_interval_type;
+	uint8_t   nd_opt_adv_interval_len;
+	uint16_t  nd_opt_adv_interval_reserved;
+	uint32_t  nd_opt_adv_interval_ival;
+};
+
+struct nd_opt_home_agent_info {
+	uint8_t   nd_opt_home_agent_info_type;
+	uint8_t   nd_opt_home_agent_info_len;
+	uint16_t  nd_opt_home_agent_info_reserved;
+	uint16_t  nd_opt_home_agent_info_preference;
+	uint16_t  nd_opt_home_agent_info_lifetime;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netinet/if_ether.h b/musl-include/aarch64/netinet/if_ether.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/if_ether.h
@@ -0,0 +1,149 @@
+#ifndef _NETINET_IF_ETHER_H
+#define _NETINET_IF_ETHER_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#define ETH_ALEN	6
+#define ETH_TLEN	2
+#define ETH_HLEN	14
+#define ETH_ZLEN	60
+#define ETH_DATA_LEN	1500
+#define ETH_FRAME_LEN	1514
+#define ETH_FCS_LEN	4
+#define ETH_MIN_MTU	68
+#define ETH_MAX_MTU	0xFFFFU
+
+#define ETH_P_LOOP	0x0060
+#define ETH_P_PUP	0x0200
+#define ETH_P_PUPAT	0x0201
+#define ETH_P_TSN	0x22F0
+#define ETH_P_ERSPAN2	0x22EB
+#define ETH_P_IP	0x0800
+#define ETH_P_X25	0x0805
+#define ETH_P_ARP	0x0806
+#define	ETH_P_BPQ	0x08FF
+#define ETH_P_IEEEPUP	0x0a00
+#define ETH_P_IEEEPUPAT	0x0a01
+#define ETH_P_BATMAN	0x4305
+#define ETH_P_DEC       0x6000
+#define ETH_P_DNA_DL    0x6001
+#define ETH_P_DNA_RC    0x6002
+#define ETH_P_DNA_RT    0x6003
+#define ETH_P_LAT       0x6004
+#define ETH_P_DIAG      0x6005
+#define ETH_P_CUST      0x6006
+#define ETH_P_SCA       0x6007
+#define ETH_P_TEB	0x6558
+#define ETH_P_RARP      0x8035
+#define ETH_P_ATALK	0x809B
+#define ETH_P_AARP	0x80F3
+#define ETH_P_8021Q	0x8100
+#define ETH_P_IPX	0x8137
+#define ETH_P_IPV6	0x86DD
+#define ETH_P_PAUSE	0x8808
+#define ETH_P_SLOW	0x8809
+#define ETH_P_WCCP	0x883E
+#define ETH_P_MPLS_UC	0x8847
+#define ETH_P_MPLS_MC	0x8848
+#define ETH_P_ATMMPOA	0x884c
+#define ETH_P_PPP_DISC	0x8863
+#define ETH_P_PPP_SES	0x8864
+#define ETH_P_LINK_CTL	0x886c
+#define ETH_P_ATMFATE	0x8884
+#define ETH_P_PAE	0x888E
+#define ETH_P_AOE	0x88A2
+#define ETH_P_8021AD	0x88A8
+#define ETH_P_802_EX1	0x88B5
+#define ETH_P_ERSPAN	0x88BE
+#define ETH_P_PREAUTH	0x88C7
+#define ETH_P_TIPC	0x88CA
+#define ETH_P_LLDP	0x88CC
+#define ETH_P_MRP	0x88E3
+#define ETH_P_MACSEC	0x88E5
+#define ETH_P_8021AH	0x88E7
+#define ETH_P_MVRP	0x88F5
+#define ETH_P_1588	0x88F7
+#define ETH_P_NCSI	0x88F8
+#define ETH_P_PRP	0x88FB
+#define ETH_P_CFM	0x8902
+#define ETH_P_FCOE	0x8906
+#define ETH_P_TDLS	0x890D
+#define ETH_P_FIP	0x8914
+#define ETH_P_IBOE	0x8915
+#define ETH_P_80221	0x8917
+#define ETH_P_HSR	0x892F
+#define ETH_P_NSH	0x894F
+#define ETH_P_LOOPBACK	0x9000
+#define ETH_P_QINQ1	0x9100
+#define ETH_P_QINQ2	0x9200
+#define ETH_P_QINQ3	0x9300
+#define ETH_P_EDSA	0xDADA
+#define ETH_P_DSA_8021Q	0xDADB
+#define ETH_P_IFE	0xED3E
+#define ETH_P_AF_IUCV	0xFBFB
+
+#define ETH_P_802_3_MIN	0x0600
+
+#define ETH_P_802_3	0x0001
+#define ETH_P_AX25	0x0002
+#define ETH_P_ALL	0x0003
+#define ETH_P_802_2	0x0004
+#define ETH_P_SNAP	0x0005
+#define ETH_P_DDCMP     0x0006
+#define ETH_P_WAN_PPP   0x0007
+#define ETH_P_PPP_MP    0x0008
+#define ETH_P_LOCALTALK 0x0009
+#define ETH_P_CAN	0x000C
+#define ETH_P_CANFD	0x000D
+#define ETH_P_PPPTALK	0x0010
+#define ETH_P_TR_802_2	0x0011
+#define ETH_P_MOBITEX	0x0015
+#define ETH_P_CONTROL	0x0016
+#define ETH_P_IRDA	0x0017
+#define ETH_P_ECONET	0x0018
+#define ETH_P_HDLC	0x0019
+#define ETH_P_ARCNET	0x001A
+#define ETH_P_DSA	0x001B
+#define ETH_P_TRAILER	0x001C
+#define ETH_P_PHONET	0x00F5
+#define ETH_P_IEEE802154 0x00F6
+#define ETH_P_CAIF	0x00F7
+#define ETH_P_XDSA	0x00F8
+#define ETH_P_MAP	0x00F9
+
+struct ethhdr {
+	uint8_t h_dest[ETH_ALEN];
+	uint8_t h_source[ETH_ALEN];
+	uint16_t h_proto;
+};
+
+#include <net/ethernet.h>
+#include <net/if_arp.h>
+
+struct	ether_arp {
+	struct	arphdr ea_hdr;
+	uint8_t arp_sha[ETH_ALEN];
+	uint8_t arp_spa[4];
+	uint8_t arp_tha[ETH_ALEN];
+	uint8_t arp_tpa[4];
+};
+#define	arp_hrd	ea_hdr.ar_hrd
+#define	arp_pro	ea_hdr.ar_pro
+#define	arp_hln	ea_hdr.ar_hln
+#define	arp_pln	ea_hdr.ar_pln
+#define	arp_op	ea_hdr.ar_op
+
+#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
+do { \
+	(enaddr)[0] = 0x01; \
+	(enaddr)[1] = 0x00; \
+	(enaddr)[2] = 0x5e; \
+	(enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
+	(enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
+	(enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
+} while(0)
+
+#define __UAPI_DEF_ETHHDR       0
+
+#endif
diff --git a/musl-include/aarch64/netinet/igmp.h b/musl-include/aarch64/netinet/igmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/igmp.h
@@ -0,0 +1,45 @@
+#ifndef _NETINET_IGMP_H
+#define _NETINET_IGMP_H
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct igmp {
+	uint8_t igmp_type;
+	uint8_t igmp_code;
+	uint16_t igmp_cksum;
+	struct in_addr igmp_group;
+};
+
+#define IGMP_MINLEN			8
+
+#define IGMP_MEMBERSHIP_QUERY   	0x11
+#define IGMP_V1_MEMBERSHIP_REPORT	0x12
+#define IGMP_V2_MEMBERSHIP_REPORT	0x16
+#define IGMP_V2_LEAVE_GROUP		0x17
+
+#define IGMP_DVMRP			0x13
+#define IGMP_PIM			0x14
+#define IGMP_TRACE			0x15
+
+#define IGMP_MTRACE_RESP		0x1e
+#define IGMP_MTRACE			0x1f
+
+#define IGMP_MAX_HOST_REPORT_DELAY	10
+#define IGMP_TIMER_SCALE		10
+
+#define IGMP_DELAYING_MEMBER	1
+#define IGMP_IDLE_MEMBER	2
+#define IGMP_LAZY_MEMBER	3
+#define IGMP_SLEEPING_MEMBER	4
+#define IGMP_AWAKENING_MEMBER	5
+
+#define IGMP_v1_ROUTER		1
+#define IGMP_v2_ROUTER		2
+
+#define IGMP_HOST_MEMBERSHIP_QUERY	IGMP_MEMBERSHIP_QUERY
+#define IGMP_HOST_MEMBERSHIP_REPORT	IGMP_V1_MEMBERSHIP_REPORT
+#define IGMP_HOST_NEW_MEMBERSHIP_REPORT	IGMP_V2_MEMBERSHIP_REPORT
+#define IGMP_HOST_LEAVE_MESSAGE		IGMP_V2_LEAVE_GROUP
+
+#endif
diff --git a/musl-include/aarch64/netinet/in.h b/musl-include/aarch64/netinet/in.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/in.h
@@ -0,0 +1,417 @@
+#ifndef	_NETINET_IN_H
+#define	_NETINET_IN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <inttypes.h>
+#include <sys/socket.h>
+
+typedef uint16_t in_port_t;
+typedef uint32_t in_addr_t;
+struct in_addr { in_addr_t s_addr; };
+
+struct sockaddr_in {
+	sa_family_t sin_family;
+	in_port_t sin_port;
+	struct in_addr sin_addr;
+	uint8_t sin_zero[8];
+};
+
+struct in6_addr {
+	union {
+		uint8_t __s6_addr[16];
+		uint16_t __s6_addr16[8];
+		uint32_t __s6_addr32[4];
+	} __in6_union;
+};
+#define s6_addr __in6_union.__s6_addr
+#define s6_addr16 __in6_union.__s6_addr16
+#define s6_addr32 __in6_union.__s6_addr32
+
+struct sockaddr_in6 {
+	sa_family_t     sin6_family;
+	in_port_t       sin6_port;
+	uint32_t        sin6_flowinfo;
+	struct in6_addr sin6_addr;
+	uint32_t        sin6_scope_id;
+};
+
+struct ipv6_mreq {
+	struct in6_addr ipv6mr_multiaddr;
+	unsigned        ipv6mr_interface;
+};
+
+#define INADDR_ANY        ((in_addr_t) 0x00000000)
+#define INADDR_BROADCAST  ((in_addr_t) 0xffffffff)
+#define INADDR_NONE       ((in_addr_t) 0xffffffff)
+#define INADDR_LOOPBACK   ((in_addr_t) 0x7f000001)
+#define INADDR_DUMMY      ((in_addr_t) 0xc0000008)
+
+#define INADDR_UNSPEC_GROUP     ((in_addr_t) 0xe0000000)
+#define INADDR_ALLHOSTS_GROUP   ((in_addr_t) 0xe0000001)
+#define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002)
+#define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a)
+#define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff)
+
+#define IN6ADDR_ANY_INIT      { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
+#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
+
+extern const struct in6_addr in6addr_any, in6addr_loopback;
+
+#define INET_ADDRSTRLEN  16
+#define INET6_ADDRSTRLEN 46
+
+uint32_t htonl(uint32_t);
+uint16_t htons(uint16_t);
+uint32_t ntohl(uint32_t);
+uint16_t ntohs(uint16_t);
+
+#define IPPORT_RESERVED 1024
+
+#define IPPROTO_IP       0
+#define IPPROTO_HOPOPTS  0
+#define IPPROTO_ICMP     1
+#define IPPROTO_IGMP     2
+#define IPPROTO_IPIP     4
+#define IPPROTO_TCP      6
+#define IPPROTO_EGP      8
+#define IPPROTO_PUP      12
+#define IPPROTO_UDP      17
+#define IPPROTO_IDP      22
+#define IPPROTO_TP       29
+#define IPPROTO_DCCP     33
+#define IPPROTO_IPV6     41
+#define IPPROTO_ROUTING  43
+#define IPPROTO_FRAGMENT 44
+#define IPPROTO_RSVP     46
+#define IPPROTO_GRE      47
+#define IPPROTO_ESP      50
+#define IPPROTO_AH       51
+#define IPPROTO_ICMPV6   58
+#define IPPROTO_NONE     59
+#define IPPROTO_DSTOPTS  60
+#define IPPROTO_MTP      92
+#define IPPROTO_BEETPH   94
+#define IPPROTO_ENCAP    98
+#define IPPROTO_PIM      103
+#define IPPROTO_COMP     108
+#define IPPROTO_SCTP     132
+#define IPPROTO_MH       135
+#define IPPROTO_UDPLITE  136
+#define IPPROTO_MPLS     137
+#define IPPROTO_ETHERNET 143
+#define IPPROTO_RAW      255
+#define IPPROTO_MPTCP    262
+#define IPPROTO_MAX      263
+
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
+
+#define IN6_IS_ADDR_LOOPBACK(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && \
+         ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \
+         ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
+
+#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
+
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
+
+#define IN6_IS_ADDR_SITELOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \
+         ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
+
+#define IN6_IS_ADDR_V4COMPAT(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
+
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
+
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
+
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
+
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
+
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
+
+#define __ARE_4_EQUAL(a,b) \
+	(!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) ))
+#define IN6_ARE_ADDR_EQUAL(a,b) \
+	__ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
+
+#define	IN_CLASSA(a)		((((in_addr_t)(a)) & 0x80000000) == 0)
+#define	IN_CLASSA_NET		0xff000000
+#define	IN_CLASSA_NSHIFT	24
+#define	IN_CLASSA_HOST		(0xffffffff & ~IN_CLASSA_NET)
+#define	IN_CLASSA_MAX		128
+#define	IN_CLASSB(a)		((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
+#define	IN_CLASSB_NET		0xffff0000
+#define	IN_CLASSB_NSHIFT	16
+#define	IN_CLASSB_HOST		(0xffffffff & ~IN_CLASSB_NET)
+#define	IN_CLASSB_MAX		65536
+#define	IN_CLASSC(a)		((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
+#define	IN_CLASSC_NET		0xffffff00
+#define	IN_CLASSC_NSHIFT	8
+#define	IN_CLASSC_HOST		(0xffffffff & ~IN_CLASSC_NET)
+#define	IN_CLASSD(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
+#define	IN_MULTICAST(a)		IN_CLASSD(a)
+#define	IN_EXPERIMENTAL(a)	((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
+#define	IN_BADCLASS(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
+
+#define IN_LOOPBACKNET 127
+
+
+#define IP_TOS             1
+#define IP_TTL             2
+#define IP_HDRINCL         3
+#define IP_OPTIONS         4
+#define IP_ROUTER_ALERT    5
+#define IP_RECVOPTS        6
+#define IP_RETOPTS         7
+#define IP_PKTINFO         8
+#define IP_PKTOPTIONS      9
+#define IP_PMTUDISC        10
+#define IP_MTU_DISCOVER    10
+#define IP_RECVERR         11
+#define IP_RECVTTL         12
+#define IP_RECVTOS         13
+#define IP_MTU             14
+#define IP_FREEBIND        15
+#define IP_IPSEC_POLICY    16
+#define IP_XFRM_POLICY     17
+#define IP_PASSSEC         18
+#define IP_TRANSPARENT     19
+#define IP_ORIGDSTADDR     20
+#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
+#define IP_MINTTL          21
+#define IP_NODEFRAG        22
+#define IP_CHECKSUM        23
+#define IP_BIND_ADDRESS_NO_PORT 24
+#define IP_RECVFRAGSIZE    25
+#define IP_RECVERR_RFC4884 26
+#define IP_MULTICAST_IF    32
+#define IP_MULTICAST_TTL   33
+#define IP_MULTICAST_LOOP  34
+#define IP_ADD_MEMBERSHIP  35
+#define IP_DROP_MEMBERSHIP 36
+#define IP_UNBLOCK_SOURCE  37
+#define IP_BLOCK_SOURCE    38
+#define IP_ADD_SOURCE_MEMBERSHIP  39
+#define IP_DROP_SOURCE_MEMBERSHIP 40
+#define IP_MSFILTER        41
+#define IP_MULTICAST_ALL   49
+#define IP_UNICAST_IF      50
+
+#define IP_RECVRETOPTS IP_RETOPTS
+
+#define IP_PMTUDISC_DONT   0
+#define IP_PMTUDISC_WANT   1
+#define IP_PMTUDISC_DO     2
+#define IP_PMTUDISC_PROBE  3
+#define IP_PMTUDISC_INTERFACE 4
+#define IP_PMTUDISC_OMIT   5
+
+#define IP_DEFAULT_MULTICAST_TTL        1
+#define IP_DEFAULT_MULTICAST_LOOP       1
+#define IP_MAX_MEMBERSHIPS              20
+
+struct ip_opts {
+	struct in_addr ip_dst;
+	char ip_opts[40];
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define MCAST_JOIN_GROUP   42
+#define MCAST_BLOCK_SOURCE 43
+#define MCAST_UNBLOCK_SOURCE      44
+#define MCAST_LEAVE_GROUP  45
+#define MCAST_JOIN_SOURCE_GROUP   46
+#define MCAST_LEAVE_SOURCE_GROUP  47
+#define MCAST_MSFILTER     48
+
+#define MCAST_EXCLUDE 0
+#define MCAST_INCLUDE 1
+
+struct ip_mreq {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_interface;
+};
+
+struct ip_mreqn {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_address;
+	int imr_ifindex;
+};
+
+struct ip_mreq_source {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_interface;
+	struct in_addr imr_sourceaddr;
+};
+
+struct ip_msfilter {
+	struct in_addr imsf_multiaddr;
+	struct in_addr imsf_interface;
+	uint32_t imsf_fmode;
+	uint32_t imsf_numsrc;
+	struct in_addr imsf_slist[1];
+};
+#define IP_MSFILTER_SIZE(numsrc) \
+	(sizeof(struct ip_msfilter) - sizeof(struct in_addr) \
+	+ (numsrc) * sizeof(struct in_addr))
+
+struct group_req {
+	uint32_t gr_interface;
+	struct sockaddr_storage gr_group;
+};
+
+struct group_source_req {
+	uint32_t gsr_interface;
+	struct sockaddr_storage gsr_group;
+	struct sockaddr_storage gsr_source;
+};
+
+struct group_filter {
+	uint32_t gf_interface;
+	struct sockaddr_storage gf_group;
+	uint32_t gf_fmode;
+	uint32_t gf_numsrc;
+	struct sockaddr_storage gf_slist[1];
+};
+#define GROUP_FILTER_SIZE(numsrc) \
+	(sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \
+	+ (numsrc) * sizeof(struct sockaddr_storage))
+
+struct in_pktinfo {
+	int ipi_ifindex;
+	struct in_addr ipi_spec_dst;
+	struct in_addr ipi_addr;
+};
+
+struct in6_pktinfo {
+	struct in6_addr ipi6_addr;
+	unsigned ipi6_ifindex;
+};
+
+struct ip6_mtuinfo {
+	struct sockaddr_in6 ip6m_addr;
+	uint32_t ip6m_mtu;
+};
+#endif
+
+#define IPV6_ADDRFORM           1
+#define IPV6_2292PKTINFO        2
+#define IPV6_2292HOPOPTS        3
+#define IPV6_2292DSTOPTS        4
+#define IPV6_2292RTHDR          5
+#define IPV6_2292PKTOPTIONS     6
+#define IPV6_CHECKSUM           7
+#define IPV6_2292HOPLIMIT       8
+#define IPV6_NEXTHOP            9
+#define IPV6_AUTHHDR            10
+#define IPV6_UNICAST_HOPS       16
+#define IPV6_MULTICAST_IF       17
+#define IPV6_MULTICAST_HOPS     18
+#define IPV6_MULTICAST_LOOP     19
+#define IPV6_JOIN_GROUP         20
+#define IPV6_LEAVE_GROUP        21
+#define IPV6_ROUTER_ALERT       22
+#define IPV6_MTU_DISCOVER       23
+#define IPV6_MTU                24
+#define IPV6_RECVERR            25
+#define IPV6_V6ONLY             26
+#define IPV6_JOIN_ANYCAST       27
+#define IPV6_LEAVE_ANYCAST      28
+#define IPV6_MULTICAST_ALL      29
+#define IPV6_ROUTER_ALERT_ISOLATE 30
+#define IPV6_IPSEC_POLICY       34
+#define IPV6_XFRM_POLICY        35
+#define IPV6_HDRINCL            36
+
+#define IPV6_RECVPKTINFO        49
+#define IPV6_PKTINFO            50
+#define IPV6_RECVHOPLIMIT       51
+#define IPV6_HOPLIMIT           52
+#define IPV6_RECVHOPOPTS        53
+#define IPV6_HOPOPTS            54
+#define IPV6_RTHDRDSTOPTS       55
+#define IPV6_RECVRTHDR          56
+#define IPV6_RTHDR              57
+#define IPV6_RECVDSTOPTS        58
+#define IPV6_DSTOPTS            59
+#define IPV6_RECVPATHMTU        60
+#define IPV6_PATHMTU            61
+#define IPV6_DONTFRAG           62
+#define IPV6_RECVTCLASS         66
+#define IPV6_TCLASS             67
+#define IPV6_AUTOFLOWLABEL      70
+#define IPV6_ADDR_PREFERENCES   72
+#define IPV6_MINHOPCOUNT        73
+#define IPV6_ORIGDSTADDR        74
+#define IPV6_RECVORIGDSTADDR    IPV6_ORIGDSTADDR
+#define IPV6_TRANSPARENT        75
+#define IPV6_UNICAST_IF         76
+#define IPV6_RECVFRAGSIZE       77
+#define IPV6_FREEBIND           78
+
+#define IPV6_ADD_MEMBERSHIP     IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP    IPV6_LEAVE_GROUP
+#define IPV6_RXHOPOPTS          IPV6_HOPOPTS
+#define IPV6_RXDSTOPTS          IPV6_DSTOPTS
+
+#define IPV6_PMTUDISC_DONT      0
+#define IPV6_PMTUDISC_WANT      1
+#define IPV6_PMTUDISC_DO        2
+#define IPV6_PMTUDISC_PROBE     3
+#define IPV6_PMTUDISC_INTERFACE 4
+#define IPV6_PMTUDISC_OMIT      5
+
+#define IPV6_PREFER_SRC_TMP            0x0001
+#define IPV6_PREFER_SRC_PUBLIC         0x0002
+#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
+#define IPV6_PREFER_SRC_COA            0x0004
+#define IPV6_PREFER_SRC_HOME           0x0400
+#define IPV6_PREFER_SRC_CGA            0x0008
+#define IPV6_PREFER_SRC_NONCGA         0x0800
+
+#define IPV6_RTHDR_LOOSE        0
+#define IPV6_RTHDR_STRICT       1
+
+#define IPV6_RTHDR_TYPE_0       0
+
+#define __UAPI_DEF_IN_ADDR      0
+#define __UAPI_DEF_IN_IPPROTO   0
+#define __UAPI_DEF_IN_PKTINFO   0
+#define __UAPI_DEF_IP_MREQ      0
+#define __UAPI_DEF_SOCKADDR_IN  0
+#define __UAPI_DEF_IN_CLASS     0
+#define __UAPI_DEF_IN6_ADDR     0
+#define __UAPI_DEF_IN6_ADDR_ALT 0
+#define __UAPI_DEF_SOCKADDR_IN6 0
+#define __UAPI_DEF_IPV6_MREQ    0
+#define __UAPI_DEF_IPPROTO_V6   0
+#define __UAPI_DEF_IPV6_OPTIONS 0
+#define __UAPI_DEF_IN6_PKTINFO  0
+#define __UAPI_DEF_IP6_MTUINFO  0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netinet/in_systm.h b/musl-include/aarch64/netinet/in_systm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/in_systm.h
@@ -0,0 +1,9 @@
+#ifndef _NETINET_IN_SYSTM_H
+#define _NETINET_IN_SYSTM_H
+
+#include <stdint.h>
+
+typedef uint16_t n_short;
+typedef uint32_t n_long, n_time;
+
+#endif
diff --git a/musl-include/aarch64/netinet/ip.h b/musl-include/aarch64/netinet/ip.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/ip.h
@@ -0,0 +1,199 @@
+#ifndef _NETINET_IP_H
+#define _NETINET_IP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct timestamp {
+	uint8_t len;
+	uint8_t ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int flags:4;
+	unsigned int overflow:4;
+#else
+	unsigned int overflow:4;
+	unsigned int flags:4;
+#endif
+	uint32_t data[9];
+  };
+
+struct iphdr {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ihl:4;
+	unsigned int version:4;
+#else
+	unsigned int version:4;
+	unsigned int ihl:4;
+#endif
+	uint8_t tos;
+	uint16_t tot_len;
+	uint16_t id;
+	uint16_t frag_off;
+	uint8_t ttl;
+	uint8_t protocol;
+	uint16_t check;
+	uint32_t saddr;
+	uint32_t daddr;
+};
+
+struct ip {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ip_hl:4;
+	unsigned int ip_v:4;
+#else
+	unsigned int ip_v:4;
+	unsigned int ip_hl:4;
+#endif
+	uint8_t ip_tos;
+	uint16_t ip_len;
+	uint16_t ip_id;
+	uint16_t ip_off;
+	uint8_t ip_ttl;
+	uint8_t ip_p;
+	uint16_t ip_sum;
+	struct in_addr ip_src, ip_dst;
+};
+
+#define	IP_RF 0x8000
+#define	IP_DF 0x4000
+#define	IP_MF 0x2000
+#define	IP_OFFMASK 0x1fff
+
+struct ip_timestamp {
+	uint8_t ipt_code;
+	uint8_t ipt_len;
+	uint8_t ipt_ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ipt_flg:4;
+	unsigned int ipt_oflw:4;
+#else
+	unsigned int ipt_oflw:4;
+	unsigned int ipt_flg:4;
+#endif
+	uint32_t data[9];
+};
+
+#define	IPVERSION	4
+#define	IP_MAXPACKET	65535
+
+#define	IPTOS_ECN_MASK		0x03
+#define	IPTOS_ECN(x)		((x) & IPTOS_ECN_MASK)
+#define	IPTOS_ECN_NOT_ECT	0x00
+#define	IPTOS_ECN_ECT1		0x01
+#define	IPTOS_ECN_ECT0		0x02
+#define	IPTOS_ECN_CE		0x03
+
+#define	IPTOS_DSCP_MASK		0xfc
+#define	IPTOS_DSCP(x)		((x) & IPTOS_DSCP_MASK)
+#define	IPTOS_DSCP_AF11		0x28
+#define	IPTOS_DSCP_AF12		0x30
+#define	IPTOS_DSCP_AF13		0x38
+#define	IPTOS_DSCP_AF21		0x48
+#define	IPTOS_DSCP_AF22		0x50
+#define	IPTOS_DSCP_AF23		0x58
+#define	IPTOS_DSCP_AF31		0x68
+#define	IPTOS_DSCP_AF32		0x70
+#define	IPTOS_DSCP_AF33		0x78
+#define	IPTOS_DSCP_AF41		0x88
+#define	IPTOS_DSCP_AF42		0x90
+#define	IPTOS_DSCP_AF43		0x98
+#define	IPTOS_DSCP_EF		0xb8
+
+#define	IPTOS_CLASS_MASK	0xe0
+#define	IPTOS_CLASS(x)		((x) & IPTOS_CLASS_MASK)
+#define	IPTOS_CLASS_CS0		0x00
+#define	IPTOS_CLASS_CS1		0x20
+#define	IPTOS_CLASS_CS2		0x40
+#define	IPTOS_CLASS_CS3		0x60
+#define	IPTOS_CLASS_CS4		0x80
+#define	IPTOS_CLASS_CS5		0xa0
+#define	IPTOS_CLASS_CS6		0xc0
+#define	IPTOS_CLASS_CS7		0xe0
+#define	IPTOS_CLASS_DEFAULT	IPTOS_CLASS_CS0
+
+#define	IPTOS_TOS_MASK		0x1E
+#define	IPTOS_TOS(tos)		((tos) & IPTOS_TOS_MASK)
+#define	IPTOS_LOWDELAY		0x10
+#define	IPTOS_THROUGHPUT	0x08
+#define	IPTOS_RELIABILITY	0x04
+#define	IPTOS_LOWCOST		0x02
+#define	IPTOS_MINCOST		IPTOS_LOWCOST
+
+#define	IPTOS_PREC_MASK			0xe0
+#define	IPTOS_PREC(tos)                ((tos) & IPTOS_PREC_MASK)
+#define	IPTOS_PREC_NETCONTROL		0xe0
+#define	IPTOS_PREC_INTERNETCONTROL	0xc0
+#define	IPTOS_PREC_CRITIC_ECP		0xa0
+#define	IPTOS_PREC_FLASHOVERRIDE	0x80
+#define	IPTOS_PREC_FLASH		0x60
+#define	IPTOS_PREC_IMMEDIATE		0x40
+#define	IPTOS_PREC_PRIORITY		0x20
+#define	IPTOS_PREC_ROUTINE		0x00
+
+#define	IPOPT_COPY		0x80
+#define	IPOPT_CLASS_MASK	0x60
+#define	IPOPT_NUMBER_MASK	0x1f
+
+#define	IPOPT_COPIED(o)		((o) & IPOPT_COPY)
+#define	IPOPT_CLASS(o)		((o) & IPOPT_CLASS_MASK)
+#define	IPOPT_NUMBER(o)		((o) & IPOPT_NUMBER_MASK)
+
+#define	IPOPT_CONTROL		0x00
+#define	IPOPT_RESERVED1		0x20
+#define	IPOPT_DEBMEAS		0x40
+#define	IPOPT_MEASUREMENT       IPOPT_DEBMEAS
+#define	IPOPT_RESERVED2		0x60
+
+#define	IPOPT_EOL		0
+#define	IPOPT_END		IPOPT_EOL
+#define	IPOPT_NOP		1
+#define	IPOPT_NOOP		IPOPT_NOP
+
+#define	IPOPT_RR		7
+#define	IPOPT_TS		68
+#define	IPOPT_TIMESTAMP		IPOPT_TS
+#define	IPOPT_SECURITY		130
+#define	IPOPT_SEC		IPOPT_SECURITY
+#define	IPOPT_LSRR		131
+#define	IPOPT_SATID		136
+#define	IPOPT_SID		IPOPT_SATID
+#define	IPOPT_SSRR		137
+#define	IPOPT_RA		148
+
+#define	IPOPT_OPTVAL		0
+#define	IPOPT_OLEN		1
+#define	IPOPT_OFFSET		2
+#define	IPOPT_MINOFF		4
+
+#define	MAX_IPOPTLEN		40
+
+#define	IPOPT_TS_TSONLY		0
+#define	IPOPT_TS_TSANDADDR	1
+#define	IPOPT_TS_PRESPEC	3
+
+#define	IPOPT_SECUR_UNCLASS	0x0000
+#define	IPOPT_SECUR_CONFID	0xf135
+#define	IPOPT_SECUR_EFTO	0x789a
+#define	IPOPT_SECUR_MMMM	0xbc4d
+#define	IPOPT_SECUR_RESTR	0xaf13
+#define	IPOPT_SECUR_SECRET	0xd788
+#define	IPOPT_SECUR_TOPSECRET	0x6bc5
+
+#define	MAXTTL		255
+#define	IPDEFTTL	64
+#define	IPFRAGTTL	60
+#define	IPTTLDEC	1
+
+#define	IP_MSS		576
+
+#define __UAPI_DEF_IPHDR	0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netinet/ip6.h b/musl-include/aarch64/netinet/ip6.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/ip6.h
@@ -0,0 +1,141 @@
+#ifndef _NETINET_IP6_H
+#define _NETINET_IP6_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct ip6_hdr {
+	union {
+		struct ip6_hdrctl {
+			uint32_t ip6_un1_flow;
+			uint16_t ip6_un1_plen;
+			uint8_t  ip6_un1_nxt;
+			uint8_t  ip6_un1_hlim;
+		} ip6_un1;
+		uint8_t ip6_un2_vfc;
+	} ip6_ctlun;
+	struct in6_addr ip6_src;
+	struct in6_addr ip6_dst;
+};
+
+#define ip6_vfc   ip6_ctlun.ip6_un2_vfc
+#define ip6_flow  ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen  ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt   ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim  ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops  ip6_ctlun.ip6_un1.ip6_un1_hlim
+
+struct ip6_ext {
+	uint8_t  ip6e_nxt;
+	uint8_t  ip6e_len;
+};
+
+struct ip6_hbh {
+	uint8_t  ip6h_nxt;
+	uint8_t  ip6h_len;
+};
+
+struct ip6_dest {
+	uint8_t  ip6d_nxt;
+	uint8_t  ip6d_len;
+};
+
+struct ip6_rthdr {
+	uint8_t  ip6r_nxt;
+	uint8_t  ip6r_len;
+	uint8_t  ip6r_type;
+	uint8_t  ip6r_segleft;
+};
+
+struct ip6_rthdr0 {
+	uint8_t  ip6r0_nxt;
+	uint8_t  ip6r0_len;
+	uint8_t  ip6r0_type;
+	uint8_t  ip6r0_segleft;
+	uint8_t  ip6r0_reserved;
+	uint8_t  ip6r0_slmap[3];
+	struct in6_addr ip6r0_addr[];
+};
+
+struct ip6_frag {
+	uint8_t   ip6f_nxt;
+	uint8_t   ip6f_reserved;
+	uint16_t  ip6f_offlg;
+	uint32_t  ip6f_ident;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IP6F_OFF_MASK       0xfff8
+#define IP6F_RESERVED_MASK  0x0006
+#define IP6F_MORE_FRAG      0x0001
+#else
+#define IP6F_OFF_MASK       0xf8ff
+#define IP6F_RESERVED_MASK  0x0600
+#define IP6F_MORE_FRAG      0x0100
+#endif
+
+struct ip6_opt {
+	uint8_t  ip6o_type;
+	uint8_t  ip6o_len;
+};
+
+#define IP6OPT_TYPE(o)		((o) & 0xc0)
+#define IP6OPT_TYPE_SKIP	0x00
+#define IP6OPT_TYPE_DISCARD	0x40
+#define IP6OPT_TYPE_FORCEICMP	0x80
+#define IP6OPT_TYPE_ICMP	0xc0
+#define IP6OPT_TYPE_MUTABLE	0x20
+
+#define IP6OPT_PAD1	0
+#define IP6OPT_PADN	1
+
+#define IP6OPT_JUMBO		0xc2
+#define IP6OPT_NSAP_ADDR	0xc3
+#define IP6OPT_TUNNEL_LIMIT	0x04
+#define IP6OPT_ROUTER_ALERT	0x05
+
+struct ip6_opt_jumbo {
+	uint8_t  ip6oj_type;
+	uint8_t  ip6oj_len;
+	uint8_t  ip6oj_jumbo_len[4];
+};
+#define IP6OPT_JUMBO_LEN	6
+
+struct ip6_opt_nsap {
+	uint8_t  ip6on_type;
+	uint8_t  ip6on_len;
+	uint8_t  ip6on_src_nsap_len;
+	uint8_t  ip6on_dst_nsap_len;
+};
+
+struct ip6_opt_tunnel {
+	uint8_t  ip6ot_type;
+	uint8_t  ip6ot_len;
+	uint8_t  ip6ot_encap_limit;
+};
+
+struct ip6_opt_router {
+	uint8_t  ip6or_type;
+	uint8_t  ip6or_len;
+	uint8_t  ip6or_value[2];
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0001
+#define IP6_ALERT_AN	0x0002
+#else
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0100
+#define IP6_ALERT_AN	0x0200
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netinet/ip_icmp.h b/musl-include/aarch64/netinet/ip_icmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/ip_icmp.h
@@ -0,0 +1,193 @@
+#ifndef _NETINET_IP_ICMP_H
+#define _NETINET_IP_ICMP_H
+
+#include <stdint.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct icmphdr {
+	uint8_t type;
+	uint8_t code;
+	uint16_t checksum;
+	union {
+		struct {
+			uint16_t id;
+			uint16_t sequence;
+		} echo;
+		uint32_t gateway;
+		struct {
+			uint16_t __unused;
+			uint16_t mtu;
+		} frag;
+		uint8_t reserved[4];
+	} un;
+};
+
+#define ICMP_ECHOREPLY		0
+#define ICMP_DEST_UNREACH	3
+#define ICMP_SOURCE_QUENCH	4
+#define ICMP_REDIRECT		5
+#define ICMP_ECHO		8
+#define ICMP_TIME_EXCEEDED	11
+#define ICMP_PARAMETERPROB	12
+#define ICMP_TIMESTAMP		13
+#define ICMP_TIMESTAMPREPLY	14
+#define ICMP_INFO_REQUEST	15
+#define ICMP_INFO_REPLY		16
+#define ICMP_ADDRESS		17
+#define ICMP_ADDRESSREPLY	18
+#define NR_ICMP_TYPES		18
+
+
+#define ICMP_NET_UNREACH	0
+#define ICMP_HOST_UNREACH	1
+#define ICMP_PROT_UNREACH	2
+#define ICMP_PORT_UNREACH	3
+#define ICMP_FRAG_NEEDED	4
+#define ICMP_SR_FAILED		5
+#define ICMP_NET_UNKNOWN	6
+#define ICMP_HOST_UNKNOWN	7
+#define ICMP_HOST_ISOLATED	8
+#define ICMP_NET_ANO		9
+#define ICMP_HOST_ANO		10
+#define ICMP_NET_UNR_TOS	11
+#define ICMP_HOST_UNR_TOS	12
+#define ICMP_PKT_FILTERED	13
+#define ICMP_PREC_VIOLATION	14
+#define ICMP_PREC_CUTOFF	15
+#define NR_ICMP_UNREACH		15
+
+#define ICMP_REDIR_NET		0
+#define ICMP_REDIR_HOST		1
+#define ICMP_REDIR_NETTOS	2
+#define ICMP_REDIR_HOSTTOS	3
+
+#define ICMP_EXC_TTL		0
+#define ICMP_EXC_FRAGTIME	1
+
+
+struct icmp_ra_addr {
+	uint32_t ira_addr;
+	uint32_t ira_preference;
+};
+
+struct icmp {
+	uint8_t  icmp_type;
+	uint8_t  icmp_code;
+	uint16_t icmp_cksum;
+	union {
+		uint8_t ih_pptr;
+		struct in_addr ih_gwaddr;
+		struct ih_idseq {
+			uint16_t icd_id;
+			uint16_t icd_seq;
+		} ih_idseq;
+		uint32_t ih_void;
+
+		struct ih_pmtu {
+			uint16_t ipm_void;
+			uint16_t ipm_nextmtu;
+		} ih_pmtu;
+
+		struct ih_rtradv {
+			uint8_t irt_num_addrs;
+			uint8_t irt_wpa;
+			uint16_t irt_lifetime;
+		} ih_rtradv;
+	} icmp_hun;
+	union {
+		struct {
+			uint32_t its_otime;
+			uint32_t its_rtime;
+			uint32_t its_ttime;
+		} id_ts;
+		struct {
+			struct ip idi_ip;
+		} id_ip;
+		struct icmp_ra_addr id_radv;
+		uint32_t   id_mask;
+		uint8_t    id_data[1];
+	} icmp_dun;
+};
+
+#define	icmp_pptr	icmp_hun.ih_pptr
+#define	icmp_gwaddr	icmp_hun.ih_gwaddr
+#define	icmp_id		icmp_hun.ih_idseq.icd_id
+#define	icmp_seq	icmp_hun.ih_idseq.icd_seq
+#define	icmp_void	icmp_hun.ih_void
+#define	icmp_pmvoid	icmp_hun.ih_pmtu.ipm_void
+#define	icmp_nextmtu	icmp_hun.ih_pmtu.ipm_nextmtu
+#define	icmp_num_addrs	icmp_hun.ih_rtradv.irt_num_addrs
+#define	icmp_wpa	icmp_hun.ih_rtradv.irt_wpa
+#define	icmp_lifetime	icmp_hun.ih_rtradv.irt_lifetime
+#define	icmp_otime	icmp_dun.id_ts.its_otime
+#define	icmp_rtime	icmp_dun.id_ts.its_rtime
+#define	icmp_ttime	icmp_dun.id_ts.its_ttime
+#define	icmp_ip		icmp_dun.id_ip.idi_ip
+#define	icmp_radv	icmp_dun.id_radv
+#define	icmp_mask	icmp_dun.id_mask
+#define	icmp_data	icmp_dun.id_data
+
+#define	ICMP_MINLEN	8
+#define	ICMP_TSLEN	(8 + 3 * sizeof (n_time))
+#define	ICMP_MASKLEN	12
+#define	ICMP_ADVLENMIN	(8 + sizeof (struct ip) + 8)
+#define	ICMP_ADVLEN(p)	(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+
+#define	ICMP_UNREACH		3
+#define	ICMP_SOURCEQUENCH	4
+#define	ICMP_ROUTERADVERT	9
+#define	ICMP_ROUTERSOLICIT	10
+#define	ICMP_TIMXCEED		11
+#define	ICMP_PARAMPROB		12
+#define	ICMP_TSTAMP		13
+#define	ICMP_TSTAMPREPLY	14
+#define	ICMP_IREQ		15
+#define	ICMP_IREQREPLY		16
+#define	ICMP_MASKREQ		17
+#define	ICMP_MASKREPLY		18
+#define	ICMP_MAXTYPE		18
+
+#define	ICMP_UNREACH_NET	        0
+#define	ICMP_UNREACH_HOST	        1
+#define	ICMP_UNREACH_PROTOCOL	        2
+#define	ICMP_UNREACH_PORT	        3
+#define	ICMP_UNREACH_NEEDFRAG	        4
+#define	ICMP_UNREACH_SRCFAIL	        5
+#define	ICMP_UNREACH_NET_UNKNOWN        6
+#define	ICMP_UNREACH_HOST_UNKNOWN       7
+#define	ICMP_UNREACH_ISOLATED	        8
+#define	ICMP_UNREACH_NET_PROHIB	        9
+#define	ICMP_UNREACH_HOST_PROHIB        10
+#define	ICMP_UNREACH_TOSNET	        11
+#define	ICMP_UNREACH_TOSHOST	        12
+#define	ICMP_UNREACH_FILTER_PROHIB      13
+#define	ICMP_UNREACH_HOST_PRECEDENCE    14
+#define	ICMP_UNREACH_PRECEDENCE_CUTOFF  15
+
+#define	ICMP_REDIRECT_NET	0
+#define	ICMP_REDIRECT_HOST	1
+#define	ICMP_REDIRECT_TOSNET	2
+#define	ICMP_REDIRECT_TOSHOST	3
+
+#define	ICMP_TIMXCEED_INTRANS	0
+#define	ICMP_TIMXCEED_REASS	1
+
+#define	ICMP_PARAMPROB_OPTABSENT 1
+
+#define	ICMP_INFOTYPE(type) \
+	((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+	(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+	(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+	(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+	(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netinet/tcp.h b/musl-include/aarch64/netinet/tcp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/tcp.h
@@ -0,0 +1,305 @@
+#ifndef _NETINET_TCP_H
+#define _NETINET_TCP_H
+
+#include <features.h>
+
+#define TCP_NODELAY 1
+#define TCP_MAXSEG	 2
+#define TCP_CORK	 3
+#define TCP_KEEPIDLE	 4
+#define TCP_KEEPINTVL	 5
+#define TCP_KEEPCNT	 6
+#define TCP_SYNCNT	 7
+#define TCP_LINGER2	 8
+#define TCP_DEFER_ACCEPT 9
+#define TCP_WINDOW_CLAMP 10
+#define TCP_INFO	 11
+#define	TCP_QUICKACK	 12
+#define TCP_CONGESTION	 13
+#define TCP_MD5SIG	 14
+#define TCP_THIN_LINEAR_TIMEOUTS 16
+#define TCP_THIN_DUPACK  17
+#define TCP_USER_TIMEOUT 18
+#define TCP_REPAIR       19
+#define TCP_REPAIR_QUEUE 20
+#define TCP_QUEUE_SEQ    21
+#define TCP_REPAIR_OPTIONS 22
+#define TCP_FASTOPEN     23
+#define TCP_TIMESTAMP    24
+#define TCP_NOTSENT_LOWAT 25
+#define TCP_CC_INFO      26
+#define TCP_SAVE_SYN     27
+#define TCP_SAVED_SYN    28
+#define TCP_REPAIR_WINDOW 29
+#define TCP_FASTOPEN_CONNECT 30
+#define TCP_ULP          31
+#define TCP_MD5SIG_EXT   32
+#define TCP_FASTOPEN_KEY 33
+#define TCP_FASTOPEN_NO_COOKIE 34
+#define TCP_ZEROCOPY_RECEIVE   35
+#define TCP_INQ          36
+#define TCP_TX_DELAY     37
+
+#define TCP_CM_INQ TCP_INQ
+
+#define TCP_ESTABLISHED  1
+#define TCP_SYN_SENT     2
+#define TCP_SYN_RECV     3
+#define TCP_FIN_WAIT1    4
+#define TCP_FIN_WAIT2    5
+#define TCP_TIME_WAIT    6
+#define TCP_CLOSE        7
+#define TCP_CLOSE_WAIT   8
+#define TCP_LAST_ACK     9
+#define TCP_LISTEN       10
+#define TCP_CLOSING      11
+
+enum {
+	TCP_NLA_PAD,
+	TCP_NLA_BUSY,
+	TCP_NLA_RWND_LIMITED,
+	TCP_NLA_SNDBUF_LIMITED,
+	TCP_NLA_DATA_SEGS_OUT,
+	TCP_NLA_TOTAL_RETRANS,
+	TCP_NLA_PACING_RATE,
+	TCP_NLA_DELIVERY_RATE,
+	TCP_NLA_SND_CWND,
+	TCP_NLA_REORDERING,
+	TCP_NLA_MIN_RTT,
+	TCP_NLA_RECUR_RETRANS,
+	TCP_NLA_DELIVERY_RATE_APP_LMT,
+	TCP_NLA_SNDQ_SIZE,
+	TCP_NLA_CA_STATE,
+	TCP_NLA_SND_SSTHRESH,
+	TCP_NLA_DELIVERED,
+	TCP_NLA_DELIVERED_CE,
+	TCP_NLA_BYTES_SENT,
+	TCP_NLA_BYTES_RETRANS,
+	TCP_NLA_DSACK_DUPS,
+	TCP_NLA_REORD_SEEN,
+	TCP_NLA_SRTT,
+	TCP_NLA_TIMEOUT_REHASH,
+	TCP_NLA_BYTES_NOTSENT,
+	TCP_NLA_EDT,
+	TCP_NLA_TTL,
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define TCPOPT_EOL              0
+#define TCPOPT_NOP              1
+#define TCPOPT_MAXSEG           2
+#define TCPOPT_WINDOW           3
+#define TCPOPT_SACK_PERMITTED   4
+#define TCPOPT_SACK             5
+#define TCPOPT_TIMESTAMP        8
+#define TCPOLEN_SACK_PERMITTED  2
+#define TCPOLEN_WINDOW          3
+#define TCPOLEN_MAXSEG          4
+#define TCPOLEN_TIMESTAMP       10
+
+#define SOL_TCP 6
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdint.h>
+
+typedef uint32_t tcp_seq;
+
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+
+struct tcphdr {
+#ifdef _GNU_SOURCE
+#ifdef __GNUC__
+	__extension__
+#endif
+	union { struct {
+
+	uint16_t source;
+	uint16_t dest;
+	uint32_t seq;
+	uint32_t ack_seq;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	uint16_t res1:4;
+	uint16_t doff:4;
+	uint16_t fin:1;
+	uint16_t syn:1;
+	uint16_t rst:1;
+	uint16_t psh:1;
+	uint16_t ack:1;
+	uint16_t urg:1;
+	uint16_t res2:2;
+#else
+	uint16_t doff:4;
+	uint16_t res1:4;
+	uint16_t res2:2;
+	uint16_t urg:1;
+	uint16_t ack:1;
+	uint16_t psh:1;
+	uint16_t rst:1;
+	uint16_t syn:1;
+	uint16_t fin:1;
+#endif
+	uint16_t window;
+	uint16_t check;
+	uint16_t urg_ptr;
+
+	}; struct {
+#endif
+
+	uint16_t th_sport;
+	uint16_t th_dport;
+	uint32_t th_seq;
+	uint32_t th_ack;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	uint8_t th_x2:4;
+	uint8_t th_off:4;
+#else
+	uint8_t th_off:4;
+	uint8_t th_x2:4;
+#endif
+	uint8_t th_flags;
+	uint16_t th_win;
+	uint16_t th_sum;
+	uint16_t th_urp;
+
+#ifdef _GNU_SOURCE
+	}; };
+#endif
+};
+#endif
+
+#ifdef _GNU_SOURCE
+#define TCPI_OPT_TIMESTAMPS	1
+#define TCPI_OPT_SACK		2
+#define TCPI_OPT_WSCALE		4
+#define TCPI_OPT_ECN		8
+
+#define TCP_CA_Open		0
+#define TCP_CA_Disorder		1
+#define TCP_CA_CWR		2
+#define TCP_CA_Recovery		3
+#define TCP_CA_Loss		4
+
+enum tcp_fastopen_client_fail {
+	TFO_STATUS_UNSPEC,
+	TFO_COOKIE_UNAVAILABLE,
+	TFO_DATA_NOT_ACKED,
+	TFO_SYN_RETRANSMITTED,
+};
+
+struct tcp_info {
+	uint8_t tcpi_state;
+	uint8_t tcpi_ca_state;
+	uint8_t tcpi_retransmits;
+	uint8_t tcpi_probes;
+	uint8_t tcpi_backoff;
+	uint8_t tcpi_options;
+	uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
+	uint8_t tcpi_delivery_rate_app_limited : 1, tcpi_fastopen_client_fail : 2;
+	uint32_t tcpi_rto;
+	uint32_t tcpi_ato;
+	uint32_t tcpi_snd_mss;
+	uint32_t tcpi_rcv_mss;
+	uint32_t tcpi_unacked;
+	uint32_t tcpi_sacked;
+	uint32_t tcpi_lost;
+	uint32_t tcpi_retrans;
+	uint32_t tcpi_fackets;
+	uint32_t tcpi_last_data_sent;
+	uint32_t tcpi_last_ack_sent;
+	uint32_t tcpi_last_data_recv;
+	uint32_t tcpi_last_ack_recv;
+	uint32_t tcpi_pmtu;
+	uint32_t tcpi_rcv_ssthresh;
+	uint32_t tcpi_rtt;
+	uint32_t tcpi_rttvar;
+	uint32_t tcpi_snd_ssthresh;
+	uint32_t tcpi_snd_cwnd;
+	uint32_t tcpi_advmss;
+	uint32_t tcpi_reordering;
+	uint32_t tcpi_rcv_rtt;
+	uint32_t tcpi_rcv_space;
+	uint32_t tcpi_total_retrans;
+	uint64_t tcpi_pacing_rate;
+	uint64_t tcpi_max_pacing_rate;
+	uint64_t tcpi_bytes_acked;
+	uint64_t tcpi_bytes_received;
+	uint32_t tcpi_segs_out;
+	uint32_t tcpi_segs_in;
+	uint32_t tcpi_notsent_bytes;
+	uint32_t tcpi_min_rtt;
+	uint32_t tcpi_data_segs_in;
+	uint32_t tcpi_data_segs_out;
+	uint64_t tcpi_delivery_rate;
+	uint64_t tcpi_busy_time;
+	uint64_t tcpi_rwnd_limited;
+	uint64_t tcpi_sndbuf_limited;
+	uint32_t tcpi_delivered;
+	uint32_t tcpi_delivered_ce;
+	uint64_t tcpi_bytes_sent;
+	uint64_t tcpi_bytes_retrans;
+	uint32_t tcpi_dsack_dups;
+	uint32_t tcpi_reord_seen;
+	uint32_t tcpi_rcv_ooopack;
+	uint32_t tcpi_snd_wnd;
+};
+
+#define TCP_MD5SIG_MAXKEYLEN    80
+
+#define TCP_MD5SIG_FLAG_PREFIX  0x1
+#define TCP_MD5SIG_FLAG_IFINDEX 0x2
+
+struct tcp_md5sig {
+	struct sockaddr_storage tcpm_addr;
+	uint8_t tcpm_flags;
+	uint8_t tcpm_prefixlen;
+	uint16_t tcpm_keylen;
+	int tcpm_ifindex;
+	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
+};
+
+struct tcp_diag_md5sig {
+	uint8_t tcpm_family;
+	uint8_t tcpm_prefixlen;
+	uint16_t tcpm_keylen;
+	uint32_t tcpm_addr[4];
+	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
+};
+
+#define TCP_REPAIR_ON		1
+#define TCP_REPAIR_OFF		0
+#define TCP_REPAIR_OFF_NO_WP	-1
+
+struct tcp_repair_window {
+	uint32_t snd_wl1;
+	uint32_t snd_wnd;
+	uint32_t max_window;
+	uint32_t rcv_wnd;
+	uint32_t rcv_wup;
+};
+
+#define TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT 0x1
+
+struct tcp_zerocopy_receive {
+	uint64_t address;
+	uint32_t length;
+	uint32_t recv_skip_hint;
+	uint32_t inq;
+	int32_t err;
+	uint64_t copybuf_address;
+	int32_t copybuf_len;
+	uint32_t flags;
+	uint64_t msg_control;
+	uint64_t msg_controllen;
+	uint32_t msg_flags;
+	uint32_t reserved;
+};
+
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netinet/udp.h b/musl-include/aarch64/netinet/udp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netinet/udp.h
@@ -0,0 +1,46 @@
+#ifndef _NETINET_UDP_H
+#define _NETINET_UDP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <stdint.h>
+
+#ifdef _GNU_SOURCE
+#define uh_sport source
+#define uh_dport dest
+#define uh_ulen len
+#define uh_sum check
+#endif
+
+struct udphdr {
+	uint16_t uh_sport;
+	uint16_t uh_dport;
+	uint16_t uh_ulen;
+	uint16_t uh_sum;
+};
+
+#define UDP_CORK	1
+#define UDP_ENCAP	100
+#define UDP_NO_CHECK6_TX 101
+#define UDP_NO_CHECK6_RX 102
+#define UDP_SEGMENT	103
+#define UDP_GRO		104
+
+#define UDP_ENCAP_ESPINUDP_NON_IKE 1
+#define UDP_ENCAP_ESPINUDP	2
+#define UDP_ENCAP_L2TPINUDP	3
+#define UDP_ENCAP_GTP0		4
+#define UDP_ENCAP_GTP1U		5
+#define UDP_ENCAP_RXRPC		6
+#define TCP_ENCAP_ESPINTCP	7
+
+#define SOL_UDP            17
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/netpacket/packet.h b/musl-include/aarch64/netpacket/packet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/netpacket/packet.h
@@ -0,0 +1,62 @@
+#ifndef _NETPACKET_PACKET_H
+#define _NETPACKET_PACKET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sockaddr_ll {
+	unsigned short sll_family, sll_protocol;
+	int sll_ifindex;
+	unsigned short sll_hatype;
+	unsigned char sll_pkttype, sll_halen;
+	unsigned char sll_addr[8];
+};
+
+struct packet_mreq {
+	int mr_ifindex;
+	unsigned short int mr_type,  mr_alen;
+	unsigned char mr_address[8];
+};
+
+#define PACKET_HOST		0
+#define PACKET_BROADCAST	1
+#define PACKET_MULTICAST	2
+#define PACKET_OTHERHOST	3
+#define PACKET_OUTGOING		4
+#define PACKET_LOOPBACK		5
+#define PACKET_FASTROUTE	6
+
+#define PACKET_ADD_MEMBERSHIP		1
+#define PACKET_DROP_MEMBERSHIP		2
+#define	PACKET_RECV_OUTPUT		3
+#define	PACKET_RX_RING			5
+#define	PACKET_STATISTICS		6
+#define PACKET_COPY_THRESH		7
+#define PACKET_AUXDATA			8
+#define PACKET_ORIGDEV			9
+#define PACKET_VERSION			10
+#define PACKET_HDRLEN			11
+#define PACKET_RESERVE			12
+#define PACKET_TX_RING			13
+#define PACKET_LOSS			14
+#define PACKET_VNET_HDR			15
+#define PACKET_TX_TIMESTAMP		16
+#define PACKET_TIMESTAMP		17
+#define PACKET_FANOUT			18
+#define PACKET_TX_HAS_OFF		19
+#define PACKET_QDISC_BYPASS		20
+#define PACKET_ROLLOVER_STATS		21
+#define PACKET_FANOUT_DATA		22
+#define PACKET_IGNORE_OUTGOING		23
+
+#define PACKET_MR_MULTICAST	0
+#define PACKET_MR_PROMISC	1
+#define PACKET_MR_ALLMULTI	2
+#define PACKET_MR_UNICAST	3
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/nl_types.h b/musl-include/aarch64/nl_types.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/nl_types.h
@@ -0,0 +1,22 @@
+#ifndef _NL_TYPES_H
+#define _NL_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NL_SETD 1
+#define NL_CAT_LOCALE 1
+
+typedef int nl_item;
+typedef void *nl_catd;
+
+nl_catd catopen (const char *, int);
+char *catgets (nl_catd, int, int, const char *);
+int catclose (nl_catd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/paths.h b/musl-include/aarch64/paths.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/paths.h
@@ -0,0 +1,31 @@
+#ifndef _PATHS_H
+#define _PATHS_H
+
+#define	_PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin"
+#define	_PATH_STDPATH "/bin:/usr/bin:/sbin:/usr/sbin"
+
+#define	_PATH_BSHELL	"/bin/sh"
+#define	_PATH_CONSOLE	"/dev/console"
+#define	_PATH_DEVNULL	"/dev/null"
+#define	_PATH_KLOG	"/proc/kmsg"
+#define	_PATH_LASTLOG	"/var/log/lastlog"
+#define	_PATH_MAILDIR	"/var/mail"
+#define	_PATH_MAN	"/usr/share/man"
+#define	_PATH_MNTTAB	"/etc/fstab"
+#define	_PATH_MOUNTED	"/etc/mtab"
+#define	_PATH_NOLOGIN	"/etc/nologin"
+#define	_PATH_SENDMAIL	"/usr/sbin/sendmail"
+#define	_PATH_SHADOW	"/etc/shadow"
+#define	_PATH_SHELLS	"/etc/shells"
+#define	_PATH_TTY	"/dev/tty"
+#define _PATH_UTMP	"/dev/null/utmp"
+#define	_PATH_VI	"/usr/bin/vi"
+#define _PATH_WTMP	"/dev/null/wtmp"
+
+#define	_PATH_DEV	"/dev/"
+#define	_PATH_TMP	"/tmp/"
+#define	_PATH_VARDB	"/var/lib/misc/"
+#define	_PATH_VARRUN	"/var/run/"
+#define	_PATH_VARTMP	"/var/tmp/"
+
+#endif
diff --git a/musl-include/aarch64/poll.h b/musl-include/aarch64/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/poll.h
@@ -0,0 +1,57 @@
+#ifndef	_POLL_H
+#define	_POLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/poll.h>
+
+#define POLLIN     0x001
+#define POLLPRI    0x002
+#define POLLOUT    0x004
+#define POLLERR    0x008
+#define POLLHUP    0x010
+#define POLLNVAL   0x020
+#define POLLRDNORM 0x040
+#define POLLRDBAND 0x080
+#ifndef POLLWRNORM
+#define POLLWRNORM 0x100
+#define POLLWRBAND 0x200
+#endif
+#ifndef POLLMSG
+#define POLLMSG    0x400
+#define POLLRDHUP  0x2000
+#endif
+
+typedef unsigned long nfds_t;
+
+struct pollfd {
+	int fd;
+	short events;
+	short revents;
+};
+
+int poll (struct pollfd *, nfds_t, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+#include <bits/alltypes.h>
+int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *);
+#endif
+
+#if _REDIR_TIME64
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(ppoll, __ppoll_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/pthread.h b/musl-include/aarch64/pthread.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/pthread.h
@@ -0,0 +1,244 @@
+#ifndef _PTHREAD_H
+#define _PTHREAD_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_clockid_t
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_pthread_mutexattr_t
+#define __NEED_pthread_condattr_t
+#define __NEED_pthread_rwlockattr_t
+#define __NEED_pthread_barrierattr_t
+#define __NEED_pthread_mutex_t
+#define __NEED_pthread_cond_t
+#define __NEED_pthread_rwlock_t
+#define __NEED_pthread_barrier_t
+#define __NEED_pthread_spinlock_t
+#define __NEED_pthread_key_t
+#define __NEED_pthread_once_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#include <sched.h>
+#include <time.h>
+
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 1
+
+#define PTHREAD_MUTEX_NORMAL 0
+#define PTHREAD_MUTEX_DEFAULT 0
+#define PTHREAD_MUTEX_RECURSIVE 1
+#define PTHREAD_MUTEX_ERRORCHECK 2
+
+#define PTHREAD_MUTEX_STALLED 0
+#define PTHREAD_MUTEX_ROBUST 1
+
+#define PTHREAD_PRIO_NONE 0
+#define PTHREAD_PRIO_INHERIT 1
+#define PTHREAD_PRIO_PROTECT 2
+
+#define PTHREAD_INHERIT_SCHED 0
+#define PTHREAD_EXPLICIT_SCHED 1
+
+#define PTHREAD_SCOPE_SYSTEM 0
+#define PTHREAD_SCOPE_PROCESS 1
+
+#define PTHREAD_PROCESS_PRIVATE 0
+#define PTHREAD_PROCESS_SHARED 1
+
+
+#define PTHREAD_MUTEX_INITIALIZER {{{0}}}
+#define PTHREAD_RWLOCK_INITIALIZER {{{0}}}
+#define PTHREAD_COND_INITIALIZER {{{0}}}
+#define PTHREAD_ONCE_INIT 0
+
+
+#define PTHREAD_CANCEL_ENABLE 0
+#define PTHREAD_CANCEL_DISABLE 1
+#define PTHREAD_CANCEL_MASKED 2
+
+#define PTHREAD_CANCEL_DEFERRED 0
+#define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+#define PTHREAD_CANCELED ((void *)-1)
+
+
+#define PTHREAD_BARRIER_SERIAL_THREAD (-1)
+
+
+#define PTHREAD_NULL ((pthread_t)0)
+
+
+int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
+int pthread_detach(pthread_t);
+_Noreturn void pthread_exit(void *);
+int pthread_join(pthread_t, void **);
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+pthread_t pthread_self(void);
+
+int pthread_equal(pthread_t, pthread_t);
+#ifndef __cplusplus
+#define pthread_equal(x,y) ((x)==(y))
+#endif
+
+int pthread_setcancelstate(int, int *);
+int pthread_setcanceltype(int, int *);
+void pthread_testcancel(void);
+int pthread_cancel(pthread_t);
+
+int pthread_getschedparam(pthread_t, int *__restrict, struct sched_param *__restrict);
+int pthread_setschedparam(pthread_t, int, const struct sched_param *);
+int pthread_setschedprio(pthread_t, int);
+
+int pthread_once(pthread_once_t *, void (*)(void));
+
+int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict);
+int pthread_mutex_lock(pthread_mutex_t *);
+int pthread_mutex_unlock(pthread_mutex_t *);
+int pthread_mutex_trylock(pthread_mutex_t *);
+int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_mutex_destroy(pthread_mutex_t *);
+int pthread_mutex_consistent(pthread_mutex_t *);
+
+int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *__restrict);
+int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict, int, int *__restrict);
+
+int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict);
+int pthread_cond_destroy(pthread_cond_t *);
+int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
+int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_cond_broadcast(pthread_cond_t *);
+int pthread_cond_signal(pthread_cond_t *);
+
+int pthread_rwlock_init(pthread_rwlock_t *__restrict, const pthread_rwlockattr_t *__restrict);
+int pthread_rwlock_destroy(pthread_rwlock_t *);
+int pthread_rwlock_rdlock(pthread_rwlock_t *);
+int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+int pthread_rwlock_wrlock(pthread_rwlock_t *);
+int pthread_rwlock_trywrlock(pthread_rwlock_t *);
+int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+int pthread_rwlock_unlock(pthread_rwlock_t *);
+
+int pthread_spin_init(pthread_spinlock_t *, int);
+int pthread_spin_destroy(pthread_spinlock_t *);
+int pthread_spin_lock(pthread_spinlock_t *);
+int pthread_spin_trylock(pthread_spinlock_t *);
+int pthread_spin_unlock(pthread_spinlock_t *);
+
+int pthread_barrier_init(pthread_barrier_t *__restrict, const pthread_barrierattr_t *__restrict, unsigned);
+int pthread_barrier_destroy(pthread_barrier_t *);
+int pthread_barrier_wait(pthread_barrier_t *);
+
+int pthread_key_create(pthread_key_t *, void (*)(void *));
+int pthread_key_delete(pthread_key_t);
+void *pthread_getspecific(pthread_key_t);
+int pthread_setspecific(pthread_key_t, const void *);
+
+int pthread_attr_init(pthread_attr_t *);
+int pthread_attr_destroy(pthread_attr_t *);
+
+int pthread_attr_getguardsize(const pthread_attr_t *__restrict, size_t *__restrict);
+int pthread_attr_setguardsize(pthread_attr_t *, size_t);
+int pthread_attr_getstacksize(const pthread_attr_t *__restrict, size_t *__restrict);
+int pthread_attr_setstacksize(pthread_attr_t *, size_t);
+int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
+int pthread_attr_setdetachstate(pthread_attr_t *, int);
+int pthread_attr_getstack(const pthread_attr_t *__restrict, void **__restrict, size_t *__restrict);
+int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
+int pthread_attr_getscope(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setscope(pthread_attr_t *, int);
+int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setschedpolicy(pthread_attr_t *, int);
+int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict);
+int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict);
+int pthread_attr_getinheritsched(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setinheritsched(pthread_attr_t *, int);
+
+int pthread_mutexattr_destroy(pthread_mutexattr_t *);
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_init(pthread_mutexattr_t *);
+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
+int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
+
+int pthread_condattr_init(pthread_condattr_t *);
+int pthread_condattr_destroy(pthread_condattr_t *);
+int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
+int pthread_condattr_setpshared(pthread_condattr_t *, int);
+int pthread_condattr_getclock(const pthread_condattr_t *__restrict, clockid_t *__restrict);
+int pthread_condattr_getpshared(const pthread_condattr_t *__restrict, int *__restrict);
+
+int pthread_rwlockattr_init(pthread_rwlockattr_t *);
+int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
+int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
+int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *__restrict, int *__restrict);
+
+int pthread_barrierattr_destroy(pthread_barrierattr_t *);
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t *__restrict, int *__restrict);
+int pthread_barrierattr_init(pthread_barrierattr_t *);
+int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
+
+int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
+
+int pthread_getconcurrency(void);
+int pthread_setconcurrency(int);
+
+int pthread_getcpuclockid(pthread_t, clockid_t *);
+
+struct __ptcb {
+	void (*__f)(void *);
+	void *__x;
+	struct __ptcb *__next;
+};
+
+void _pthread_cleanup_push(struct __ptcb *, void (*)(void *), void *);
+void _pthread_cleanup_pop(struct __ptcb *, int);
+
+#define pthread_cleanup_push(f, x) do { struct __ptcb __cb; _pthread_cleanup_push(&__cb, f, x);
+#define pthread_cleanup_pop(r) _pthread_cleanup_pop(&__cb, (r)); } while(0)
+
+#ifdef _GNU_SOURCE
+struct cpu_set_t;
+int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *);
+int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *);
+int pthread_getattr_np(pthread_t, pthread_attr_t *);
+int pthread_setname_np(pthread_t, const char *);
+int pthread_getname_np(pthread_t, char *, size_t);
+int pthread_getattr_default_np(pthread_attr_t *);
+int pthread_setattr_default_np(const pthread_attr_t *);
+int pthread_tryjoin_np(pthread_t, void **);
+int pthread_timedjoin_np(pthread_t, void **, const struct timespec *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(pthread_mutex_timedlock, __pthread_mutex_timedlock_time64);
+__REDIR(pthread_cond_timedwait, __pthread_cond_timedwait_time64);
+__REDIR(pthread_rwlock_timedrdlock, __pthread_rwlock_timedrdlock_time64);
+__REDIR(pthread_rwlock_timedwrlock, __pthread_rwlock_timedwrlock_time64);
+#ifdef _GNU_SOURCE
+__REDIR(pthread_timedjoin_np, __pthread_timedjoin_np_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/pty.h b/musl-include/aarch64/pty.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/pty.h
@@ -0,0 +1,18 @@
+#ifndef	_PTY_H
+#define	_PTY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <termios.h>
+#include <sys/ioctl.h>
+
+int openpty(int *, int *, char *, const struct termios *, const struct winsize *);
+int forkpty(int *, char *, const struct termios *, const struct winsize *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/pwd.h b/musl-include/aarch64/pwd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/pwd.h
@@ -0,0 +1,50 @@
+#ifndef _PWD_H
+#define _PWD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_FILE
+#endif
+
+#include <bits/alltypes.h>
+
+struct passwd {
+	char *pw_name;
+	char *pw_passwd;
+	uid_t pw_uid;
+	gid_t pw_gid;
+	char *pw_gecos;
+	char *pw_dir;
+	char *pw_shell;
+};
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void setpwent (void);
+void endpwent (void);
+struct passwd *getpwent (void);
+#endif
+
+struct passwd *getpwuid (uid_t);
+struct passwd *getpwnam (const char *);
+int getpwuid_r (uid_t, struct passwd *, char *, size_t, struct passwd **);
+int getpwnam_r (const char *, struct passwd *, char *, size_t, struct passwd **);
+
+#ifdef _GNU_SOURCE
+struct passwd *fgetpwent(FILE *);
+int putpwent(const struct passwd *, FILE *);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/regex.h b/musl-include/aarch64/regex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/regex.h
@@ -0,0 +1,62 @@
+#ifndef _REGEX_H
+#define _REGEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_regoff_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef struct re_pattern_buffer {
+	size_t re_nsub;
+	void *__opaque, *__padding[4];
+	size_t __nsub2;
+	char __padding2;
+} regex_t;
+
+typedef struct {
+	regoff_t rm_so;
+	regoff_t rm_eo;
+} regmatch_t;
+
+#define REG_EXTENDED    1
+#define REG_ICASE       2
+#define REG_NEWLINE     4
+#define REG_NOSUB       8
+
+#define REG_NOTBOL      1
+#define REG_NOTEOL      2
+
+#define REG_OK          0
+#define REG_NOMATCH     1
+#define REG_BADPAT      2
+#define REG_ECOLLATE    3
+#define REG_ECTYPE      4
+#define REG_EESCAPE     5
+#define REG_ESUBREG     6
+#define REG_EBRACK      7
+#define REG_EPAREN      8
+#define REG_EBRACE      9
+#define REG_BADBR       10
+#define REG_ERANGE      11
+#define REG_ESPACE      12
+#define REG_BADRPT      13
+
+#define REG_ENOSYS      -1
+
+int regcomp(regex_t *__restrict, const char *__restrict, int);
+int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int);
+void regfree(regex_t *);
+
+size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/resolv.h b/musl-include/aarch64/resolv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/resolv.h
@@ -0,0 +1,142 @@
+#ifndef _RESOLV_H
+#define _RESOLV_H
+
+#include <stdint.h>
+#include <arpa/nameser.h>
+#include <netinet/in.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAXNS			3
+#define MAXDFLSRCH		3
+#define MAXDNSRCH		6
+#define LOCALDOMAINPARTS	2
+
+#define RES_TIMEOUT		5
+#define MAXRESOLVSORT		10
+#define RES_MAXNDOTS		15
+#define RES_MAXRETRANS		30
+#define RES_MAXRETRY		5
+#define RES_DFLRETRY		2
+#define RES_MAXTIME		65535
+
+/* unused; purely for broken apps */
+typedef struct __res_state {
+	int retrans;
+	int retry;
+	unsigned long options;
+	int nscount;
+	struct sockaddr_in nsaddr_list[MAXNS];
+# define nsaddr	nsaddr_list[0]
+	unsigned short id;
+	char *dnsrch[MAXDNSRCH+1];
+	char defdname[256];
+	unsigned long pfcode;
+	unsigned ndots:4;
+	unsigned nsort:4;
+	unsigned ipv6_unavail:1;
+	unsigned unused:23;
+	struct {
+		struct in_addr addr;
+		uint32_t mask;
+	} sort_list[MAXRESOLVSORT];
+	void *qhook;
+	void *rhook;
+	int res_h_errno;
+	int _vcsock;
+	unsigned _flags;
+	union {
+		char pad[52];
+		struct {
+			uint16_t		nscount;
+			uint16_t		nsmap[MAXNS];
+			int			nssocks[MAXNS];
+			uint16_t		nscount6;
+			uint16_t		nsinit;
+			struct sockaddr_in6	*nsaddrs[MAXNS];
+			unsigned int		_initstamp[2];
+		} _ext;
+	} _u;
+} *res_state;
+
+#define	__RES	19960801
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF        "/etc/resolv.conf"
+#endif
+
+struct res_sym {
+	int number;
+	char *name;
+	char *humanname;
+};
+
+#define	RES_F_VC	0x00000001
+#define	RES_F_CONN	0x00000002
+#define RES_F_EDNS0ERR	0x00000004
+
+#define	RES_EXHAUSTIVE	0x00000001
+
+#define RES_INIT	0x00000001
+#define RES_DEBUG	0x00000002
+#define RES_AAONLY	0x00000004
+#define RES_USEVC	0x00000008
+#define RES_PRIMARY	0x00000010
+#define RES_IGNTC	0x00000020
+#define RES_RECURSE	0x00000040
+#define RES_DEFNAMES	0x00000080
+#define RES_STAYOPEN	0x00000100
+#define RES_DNSRCH	0x00000200
+#define	RES_INSECURE1	0x00000400
+#define	RES_INSECURE2	0x00000800
+#define	RES_NOALIASES	0x00001000
+#define	RES_USE_INET6	0x00002000
+#define RES_ROTATE	0x00004000
+#define	RES_NOCHECKNAME	0x00008000
+#define	RES_KEEPTSIG	0x00010000
+#define	RES_BLAST	0x00020000
+#define RES_USEBSTRING	0x00040000
+#define RES_NOIP6DOTINT	0x00080000
+#define RES_USE_EDNS0	0x00100000
+#define RES_SNGLKUP	0x00200000
+#define RES_SNGLKUPREOP	0x00400000
+#define RES_USE_DNSSEC	0x00800000
+
+#define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
+
+#define RES_PRF_STATS	0x00000001
+#define RES_PRF_UPDATE	0x00000002
+#define RES_PRF_CLASS   0x00000004
+#define RES_PRF_CMD	0x00000008
+#define RES_PRF_QUES	0x00000010
+#define RES_PRF_ANS	0x00000020
+#define RES_PRF_AUTH	0x00000040
+#define RES_PRF_ADD	0x00000080
+#define RES_PRF_HEAD1	0x00000100
+#define RES_PRF_HEAD2	0x00000200
+#define RES_PRF_TTLID	0x00000400
+#define RES_PRF_HEADX	0x00000800
+#define RES_PRF_QUERY	0x00001000
+#define RES_PRF_REPLY	0x00002000
+#define RES_PRF_INIT	0x00004000
+
+struct __res_state *__res_state(void);
+#define _res (*__res_state())
+
+int res_init(void);
+int res_query(const char *, int, int, unsigned char *, int);
+int res_querydomain(const char *, const char *, int, int, unsigned char *, int);
+int res_search(const char *, int, int, unsigned char *, int);
+int res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
+int res_send(const unsigned char *, int, unsigned char *, int);
+int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **);
+int dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
+int dn_skipname(const unsigned char *, const unsigned char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sched.h b/musl-include/aarch64/sched.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sched.h
@@ -0,0 +1,148 @@
+#ifndef _SCHED_H
+#define _SCHED_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_struct_timespec
+#define __NEED_pid_t
+#define __NEED_time_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+struct sched_param {
+	int sched_priority;
+	int __reserved1;
+#if _REDIR_TIME64
+	long __reserved2[4];
+#else
+	struct {
+		time_t __reserved1;
+		long __reserved2;
+	} __reserved2[2];
+#endif
+	int __reserved3;
+};
+
+int    sched_get_priority_max(int);
+int    sched_get_priority_min(int);
+int    sched_getparam(pid_t, struct sched_param *);
+int    sched_getscheduler(pid_t);
+int    sched_rr_get_interval(pid_t, struct timespec *);
+int    sched_setparam(pid_t, const struct sched_param *);
+int    sched_setscheduler(pid_t, int, const struct sched_param *);
+int     sched_yield(void);
+
+#define SCHED_OTHER 0
+#define SCHED_FIFO 1
+#define SCHED_RR 2
+#define SCHED_BATCH 3
+#define SCHED_IDLE 5
+#define SCHED_DEADLINE 6
+#define SCHED_RESET_ON_FORK 0x40000000
+
+#ifdef _GNU_SOURCE
+#define CSIGNAL		0x000000ff
+#define CLONE_NEWTIME	0x00000080
+#define CLONE_VM	0x00000100
+#define CLONE_FS	0x00000200
+#define CLONE_FILES	0x00000400
+#define CLONE_SIGHAND	0x00000800
+#define CLONE_PIDFD	0x00001000
+#define CLONE_PTRACE	0x00002000
+#define CLONE_VFORK	0x00004000
+#define CLONE_PARENT	0x00008000
+#define CLONE_THREAD	0x00010000
+#define CLONE_NEWNS	0x00020000
+#define CLONE_SYSVSEM	0x00040000
+#define CLONE_SETTLS	0x00080000
+#define CLONE_PARENT_SETTID	0x00100000
+#define CLONE_CHILD_CLEARTID	0x00200000
+#define CLONE_DETACHED	0x00400000
+#define CLONE_UNTRACED	0x00800000
+#define CLONE_CHILD_SETTID	0x01000000
+#define CLONE_NEWCGROUP	0x02000000
+#define CLONE_NEWUTS	0x04000000
+#define CLONE_NEWIPC	0x08000000
+#define CLONE_NEWUSER	0x10000000
+#define CLONE_NEWPID	0x20000000
+#define CLONE_NEWNET	0x40000000
+#define CLONE_IO	0x80000000
+int clone (int (*)(void *), void *, int, void *, ...);
+int unshare(int);
+int setns(int, int);
+
+void *memcpy(void *__restrict, const void *__restrict, size_t);
+int memcmp(const void *, const void *, size_t);
+void *memset (void *, int, size_t);
+void *calloc(size_t, size_t);
+void free(void *);
+
+typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t;
+int __sched_cpucount(size_t, const cpu_set_t *);
+int sched_getcpu(void);
+int sched_getaffinity(pid_t, size_t, cpu_set_t *);
+int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
+
+#define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \
+	(((unsigned long *)(set))[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) )
+
+#define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=)
+#define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &=~)
+#define CPU_ISSET_S(i, size, set) __CPU_op_S(i, size, set, &)
+
+#define __CPU_op_func_S(func, op) \
+static __inline void __CPU_##func##_S(size_t __size, cpu_set_t *__dest, \
+	const cpu_set_t *__src1, const cpu_set_t *__src2) \
+{ \
+	size_t __i; \
+	for (__i=0; __i<__size/sizeof(long); __i++) \
+		((unsigned long *)__dest)[__i] = ((unsigned long *)__src1)[__i] \
+			op ((unsigned long *)__src2)[__i] ; \
+}
+
+__CPU_op_func_S(AND, &)
+__CPU_op_func_S(OR, |)
+__CPU_op_func_S(XOR, ^)
+
+#define CPU_AND_S(a,b,c,d) __CPU_AND_S(a,b,c,d)
+#define CPU_OR_S(a,b,c,d) __CPU_OR_S(a,b,c,d)
+#define CPU_XOR_S(a,b,c,d) __CPU_XOR_S(a,b,c,d)
+
+#define CPU_COUNT_S(size,set) __sched_cpucount(size,set)
+#define CPU_ZERO_S(size,set) memset(set,0,size)
+#define CPU_EQUAL_S(size,set1,set2) (!memcmp(set1,set2,size))
+
+#define CPU_ALLOC_SIZE(n) (sizeof(long) * ( (n)/(8*sizeof(long)) \
+	+ ((n)%(8*sizeof(long)) + 8*sizeof(long)-1)/(8*sizeof(long)) ) )
+#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
+#define CPU_FREE(set) free(set)
+
+#define CPU_SETSIZE 1024
+
+#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
+#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)
+#define CPU_ISSET(i, set) CPU_ISSET_S(i,sizeof(cpu_set_t),set)
+#define CPU_AND(d,s1,s2) CPU_AND_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_OR(d,s1,s2) CPU_OR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_XOR(d,s1,s2) CPU_XOR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t),set)
+#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set)
+#define CPU_EQUAL(s1,s2) CPU_EQUAL_S(sizeof(cpu_set_t),s1,s2)
+
+#endif
+
+#if _REDIR_TIME64
+__REDIR(sched_rr_get_interval, __sched_rr_get_interval_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/scsi/scsi.h b/musl-include/aarch64/scsi/scsi.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/scsi/scsi.h
@@ -0,0 +1,150 @@
+#ifndef _SCSI_SCSI_H
+#define _SCSI_SCSI_H
+
+#define TEST_UNIT_READY 0x00
+#define REZERO_UNIT 0x01
+#define REQUEST_SENSE 0x03
+#define FORMAT_UNIT 0x04
+#define READ_BLOCK_LIMITS 0x05
+#define REASSIGN_BLOCKS 0x07
+#define READ_6 0x08
+#define WRITE_6 0x0a
+#define SEEK_6 0x0b
+#define READ_REVERSE 0x0f
+#define WRITE_FILEMARKS 0x10
+#define SPACE 0x11
+#define INQUIRY 0x12
+#define RECOVER_BUFFERED_DATA 0x14
+#define MODE_SELECT 0x15
+#define RESERVE 0x16
+#define RELEASE 0x17
+#define COPY 0x18
+#define ERASE 0x19
+#define MODE_SENSE 0x1a
+#define START_STOP 0x1b
+#define RECEIVE_DIAGNOSTIC 0x1c
+#define SEND_DIAGNOSTIC 0x1d
+#define ALLOW_MEDIUM_REMOVAL 0x1e
+#define SET_WINDOW 0x24
+#define READ_CAPACITY 0x25
+#define READ_10 0x28
+#define WRITE_10 0x2a
+#define SEEK_10 0x2b
+#define WRITE_VERIFY 0x2e
+#define VERIFY 0x2f
+#define SEARCH_HIGH 0x30
+#define SEARCH_EQUAL 0x31
+#define SEARCH_LOW 0x32
+#define SET_LIMITS 0x33
+#define PRE_FETCH 0x34
+#define READ_POSITION 0x34
+#define SYNCHRONIZE_CACHE 0x35
+#define LOCK_UNLOCK_CACHE 0x36
+#define READ_DEFECT_DATA 0x37
+#define MEDIUM_SCAN 0x38
+#define COMPARE 0x39
+#define COPY_VERIFY 0x3a
+#define WRITE_BUFFER 0x3b
+#define READ_BUFFER 0x3c
+#define UPDATE_BLOCK 0x3d
+#define READ_LONG 0x3e
+#define WRITE_LONG 0x3f
+#define CHANGE_DEFINITION 0x40
+#define WRITE_SAME 0x41
+#define READ_TOC 0x43
+#define LOG_SELECT 0x4c
+#define LOG_SENSE 0x4d
+#define MODE_SELECT_10 0x55
+#define RESERVE_10 0x56
+#define RELEASE_10 0x57
+#define MODE_SENSE_10 0x5a
+#define PERSISTENT_RESERVE_IN 0x5e
+#define PERSISTENT_RESERVE_OUT 0x5f
+#define MOVE_MEDIUM 0xa5
+#define READ_12 0xa8
+#define WRITE_12 0xaa
+#define WRITE_VERIFY_12 0xae
+#define SEARCH_HIGH_12 0xb0
+#define SEARCH_EQUAL_12 0xb1
+#define SEARCH_LOW_12 0xb2
+#define READ_ELEMENT_STATUS 0xb8
+#define SEND_VOLUME_TAG 0xb6
+#define WRITE_LONG_2 0xea
+#define GOOD 0x00
+#define CHECK_CONDITION 0x01
+#define CONDITION_GOOD 0x02
+#define BUSY 0x04
+#define INTERMEDIATE_GOOD 0x08
+#define INTERMEDIATE_C_GOOD 0x0a
+#define RESERVATION_CONFLICT 0x0c
+#define COMMAND_TERMINATED 0x11
+#define QUEUE_FULL 0x14
+#define STATUS_MASK 0x3e
+#define NO_SENSE 0x00
+#define RECOVERED_ERROR 0x01
+#define NOT_READY 0x02
+#define MEDIUM_ERROR 0x03
+#define HARDWARE_ERROR 0x04
+#define ILLEGAL_REQUEST 0x05
+#define UNIT_ATTENTION 0x06
+#define DATA_PROTECT 0x07
+#define BLANK_CHECK 0x08
+#define COPY_ABORTED 0x0a
+#define ABORTED_COMMAND 0x0b
+#define VOLUME_OVERFLOW 0x0d
+#define MISCOMPARE 0x0e
+#define TYPE_DISK 0x00
+#define TYPE_TAPE 0x01
+#define TYPE_PROCESSOR 0x03
+#define TYPE_WORM 0x04
+#define TYPE_ROM 0x05
+#define TYPE_SCANNER 0x06
+#define TYPE_MOD 0x07
+#define TYPE_MEDIUM_CHANGER 0x08
+#define TYPE_ENCLOSURE 0x0d
+#define TYPE_NO_LUN 0x7f
+#define COMMAND_COMPLETE 0x00
+#define EXTENDED_MESSAGE 0x01
+#define EXTENDED_MODIFY_DATA_POINTER 0x00
+#define EXTENDED_SDTR 0x01
+#define EXTENDED_EXTENDED_IDENTIFY 0x02
+#define EXTENDED_WDTR 0x03
+#define SAVE_POINTERS 0x02
+#define RESTORE_POINTERS 0x03
+#define DISCONNECT 0x04
+#define INITIATOR_ERROR 0x05
+#define ABORT 0x06
+#define MESSAGE_REJECT 0x07
+#define NOP 0x08
+#define MSG_PARITY_ERROR 0x09
+#define LINKED_CMD_COMPLETE 0x0a
+#define LINKED_FLG_CMD_COMPLETE 0x0b
+#define BUS_DEVICE_RESET 0x0c
+#define INITIATE_RECOVERY 0x0f
+#define RELEASE_RECOVERY 0x10
+#define SIMPLE_QUEUE_TAG 0x20
+#define HEAD_OF_QUEUE_TAG 0x21
+#define ORDERED_QUEUE_TAG 0x22
+#define SCSI_IOCTL_GET_IDLUN 0x5382
+#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
+#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
+#define SCSI_IOCTL_PROBE_HOST 0x5385
+#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
+
+struct ccs_modesel_head {
+	unsigned char _r1;
+	unsigned char medium;
+	unsigned char _r2;
+	unsigned char block_desc_length;
+	unsigned char density;
+	unsigned char number_blocks_hi;
+	unsigned char number_blocks_med;
+	unsigned char number_blocks_lo;
+	unsigned char _r3;
+	unsigned char block_length_hi;
+	unsigned char block_length_med;
+	unsigned char block_length_lo;
+};
+
+#endif
+
diff --git a/musl-include/aarch64/scsi/scsi_ioctl.h b/musl-include/aarch64/scsi/scsi_ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/scsi/scsi_ioctl.h
@@ -0,0 +1,11 @@
+#ifndef _SCSI_IOCTL_H
+#define _SCSI_IOCTL_H
+#define SCSI_IOCTL_SEND_COMMAND 1
+#define SCSI_IOCTL_TEST_UNIT_READY 2
+#define SCSI_IOCTL_BENCHMARK_COMMAND 3
+#define SCSI_IOCTL_SYNC 4
+#define SCSI_IOCTL_START_UNIT 5
+#define SCSI_IOCTL_STOP_UNIT 6
+#define SCSI_IOCTL_DOORLOCK 0x5380
+#define SCSI_IOCTL_DOORUNLOCK 0x5381
+#endif
diff --git a/musl-include/aarch64/scsi/sg.h b/musl-include/aarch64/scsi/sg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/scsi/sg.h
@@ -0,0 +1,129 @@
+#ifndef _SCSI_SG_H
+#define _SCSI_SG_H
+
+#define SG_DXFER_NONE -1
+#define SG_DXFER_TO_DEV -2
+#define SG_DXFER_FROM_DEV -3
+#define SG_DXFER_TO_FROM_DEV -4
+#define SG_FLAG_DIRECT_IO 1
+#define SG_FLAG_LUN_INHIBIT 2
+#define SG_FLAG_NO_DXFER 0x10000
+#define SG_INFO_OK_MASK 0x1
+#define SG_INFO_OK 0x0
+#define SG_INFO_CHECK 0x1
+#define SG_INFO_DIRECT_IO_MASK 0x6
+#define SG_INFO_INDIRECT_IO 0x0
+#define SG_INFO_DIRECT_IO 0x2
+#define SG_INFO_MIXED_IO 0x4
+#define SG_EMULATED_HOST 0x2203
+#define SG_SET_TRANSFORM 0x2204
+#define SG_GET_TRANSFORM 0x2205
+#define SG_SET_RESERVED_SIZE 0x2275
+#define SG_GET_RESERVED_SIZE 0x2272
+#define SG_GET_SCSI_ID 0x2276
+#define SG_SET_FORCE_LOW_DMA 0x2279
+#define SG_GET_LOW_DMA 0x227a
+#define SG_SET_FORCE_PACK_ID 0x227b
+#define SG_GET_PACK_ID 0x227c
+#define SG_GET_NUM_WAITING 0x227d
+#define SG_GET_SG_TABLESIZE 0x227F
+#define SG_GET_VERSION_NUM 0x2282
+#define SG_SCSI_RESET 0x2284
+#define SG_SCSI_RESET_NOTHING 0
+#define SG_SCSI_RESET_DEVICE 1
+#define SG_SCSI_RESET_BUS 2
+#define SG_SCSI_RESET_HOST 3
+#define SG_IO 0x2285
+#define SG_GET_REQUEST_TABLE 0x2286
+#define SG_SET_KEEP_ORPHAN 0x2287
+#define SG_GET_KEEP_ORPHAN 0x2288
+#define SG_SCATTER_SZ (8 * 4096)
+#define SG_DEFAULT_RETRIES 1
+#define SG_DEF_FORCE_LOW_DMA 0
+#define SG_DEF_FORCE_PACK_ID 0
+#define SG_DEF_KEEP_ORPHAN 0
+#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
+#define SG_MAX_QUEUE 16
+#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
+#define SG_MAX_SENSE 16
+#define SG_SET_TIMEOUT 0x2201
+#define SG_GET_TIMEOUT 0x2202
+#define SG_GET_COMMAND_Q 0x2270
+#define SG_SET_COMMAND_Q 0x2271
+#define SG_SET_DEBUG 0x227e
+#define SG_NEXT_CMD_LEN 0x2283
+#define SG_DEFAULT_TIMEOUT (60*100) /* 60*HZ */
+#define SG_DEF_COMMAND_Q 0
+#define SG_DEF_UNDERRUN_FLAG 0
+
+typedef struct sg_iovec {
+	void *iov_base;
+	unsigned long iov_len;
+} sg_iovec_t;
+
+typedef struct sg_io_hdr { 
+	int interface_id; 
+	int dxfer_direction; 
+	unsigned char cmd_len;
+	unsigned char mx_sb_len;
+	unsigned short iovec_count;
+	unsigned dxfer_len;
+	void *dxferp;
+	unsigned char *cmdp;
+	unsigned char *sbp;
+	unsigned timeout;
+	unsigned flags;
+	int pack_id;
+	void *usr_ptr;
+	unsigned char status;
+	unsigned char masked_status;
+	unsigned char msg_status;
+	unsigned char sb_len_wr;
+	unsigned short host_status;
+	unsigned short driver_status;
+	int resid; 
+	unsigned int duration;
+	unsigned int info;
+} sg_io_hdr_t;
+
+struct sg_scsi_id {
+	int host_no;
+	int channel;
+	int scsi_id;
+	int lun;
+	int scsi_type;
+	short h_cmd_per_lun;
+	short d_queue_depth;
+	int unused[2];
+};
+
+typedef struct sg_req_info {
+	char req_state;
+	char orphan;
+	char sg_io_owned;
+	char problem;
+	int pack_id;
+	void *usr_ptr;
+	unsigned duration; 
+	int unused; 
+} sg_req_info_t;
+
+typedef struct sg_io_hdr Sg_io_hdr;
+typedef struct sg_io_vec Sg_io_vec;
+typedef struct sg_scsi_id Sg_scsi_id;
+typedef struct sg_req_info Sg_req_info;
+
+struct sg_header {
+	int pack_len;
+	int reply_len;
+	int pack_id;
+	int result;
+	unsigned twelve_byte:1;
+	unsigned target_status:5;
+	unsigned host_status:8;
+	unsigned driver_status:8;
+	unsigned other_flags:10;
+	unsigned char sense_buffer[SG_MAX_SENSE];
+};
+
+#endif
diff --git a/musl-include/aarch64/search.h b/musl-include/aarch64/search.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/search.h
@@ -0,0 +1,63 @@
+#ifndef _SEARCH_H
+#define _SEARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+typedef enum { FIND, ENTER } ACTION;
+typedef enum { preorder, postorder, endorder, leaf } VISIT;
+
+typedef struct entry {
+	char *key;
+	void *data;
+} ENTRY;
+
+int hcreate(size_t);
+void hdestroy(void);
+ENTRY *hsearch(ENTRY, ACTION);
+
+#ifdef _GNU_SOURCE
+struct hsearch_data {
+	struct __tab *__tab;
+	unsigned int __unused1;
+	unsigned int __unused2;
+};
+
+int hcreate_r(size_t, struct hsearch_data *);
+void hdestroy_r(struct hsearch_data *);
+int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
+#endif
+
+void insque(void *, void *);
+void remque(void *);
+
+void *lsearch(const void *, void *, size_t *, size_t,
+	int (*)(const void *, const void *));
+void *lfind(const void *, const void *, size_t *, size_t,
+	int (*)(const void *, const void *));
+
+void *tdelete(const void *__restrict, void **__restrict, int(*)(const void *, const void *));
+void *tfind(const void *, void *const *, int(*)(const void *, const void *));
+void *tsearch(const void *, void **, int (*)(const void *, const void *));
+void twalk(const void *, void (*)(const void *, VISIT, int));
+
+#ifdef _GNU_SOURCE
+struct qelem {
+	struct qelem *q_forw, *q_back;
+	char q_data[1];
+};
+
+void tdestroy(void *, void (*)(void *));
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/semaphore.h b/musl-include/aarch64/semaphore.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/semaphore.h
@@ -0,0 +1,39 @@
+#ifndef _SEMAPHORE_H
+#define _SEMAPHORE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+#include <fcntl.h>
+
+#define SEM_FAILED ((sem_t *)0)
+
+typedef struct {
+	volatile int __val[4*sizeof(long)/sizeof(int)];
+} sem_t;
+
+int    sem_close(sem_t *);
+int    sem_destroy(sem_t *);
+int    sem_getvalue(sem_t *__restrict, int *__restrict);
+int    sem_init(sem_t *, int, unsigned);
+sem_t *sem_open(const char *, int, ...);
+int    sem_post(sem_t *);
+int    sem_timedwait(sem_t *__restrict, const struct timespec *__restrict);
+int    sem_trywait(sem_t *);
+int    sem_unlink(const char *);
+int    sem_wait(sem_t *);
+
+#if _REDIR_TIME64
+__REDIR(sem_timedwait, __sem_timedwait_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/setjmp.h b/musl-include/aarch64/setjmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/setjmp.h
@@ -0,0 +1,49 @@
+#ifndef	_SETJMP_H
+#define	_SETJMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/setjmp.h>
+
+typedef struct __jmp_buf_tag {
+	__jmp_buf __jb;
+	unsigned long __fl;
+	unsigned long __ss[128/sizeof(long)];
+} jmp_buf[1];
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
+#define __setjmp_attr __attribute__((__returns_twice__))
+#else
+#define __setjmp_attr
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+typedef jmp_buf sigjmp_buf;
+int sigsetjmp (sigjmp_buf, int) __setjmp_attr;
+_Noreturn void siglongjmp (sigjmp_buf, int);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+int _setjmp (jmp_buf) __setjmp_attr;
+_Noreturn void _longjmp (jmp_buf, int);
+#endif
+
+int setjmp (jmp_buf) __setjmp_attr;
+_Noreturn void longjmp (jmp_buf, int);
+
+#define setjmp setjmp
+
+#undef __setjmp_attr
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/shadow.h b/musl-include/aarch64/shadow.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/shadow.h
@@ -0,0 +1,44 @@
+#ifndef _SHADOW_H
+#define _SHADOW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	__NEED_FILE
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#define	SHADOW "/etc/shadow"
+
+struct spwd {
+	char *sp_namp;
+	char *sp_pwdp;
+	long sp_lstchg;
+	long sp_min;
+	long sp_max;
+	long sp_warn;
+	long sp_inact;
+	long sp_expire;
+	unsigned long sp_flag;
+};
+
+void setspent(void);
+void endspent(void);
+struct spwd *getspent(void);
+struct spwd *fgetspent(FILE *);
+struct spwd *sgetspent(const char *);
+int putspent(const struct spwd *, FILE *);
+
+struct spwd *getspnam(const char *);
+int getspnam_r(const char *, struct spwd *, char *, size_t, struct spwd **);
+
+int lckpwdf(void);
+int ulckpwdf(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/signal.h b/musl-include/aarch64/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/signal.h
@@ -0,0 +1,304 @@
+#ifndef _SIGNAL_H
+#define _SIGNAL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#ifdef _GNU_SOURCE
+#define __ucontext ucontext
+#endif
+
+#define __NEED_size_t
+#define __NEED_pid_t
+#define __NEED_uid_t
+#define __NEED_struct_timespec
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_time_t
+#define __NEED_clock_t
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define SIG_BLOCK     0
+#define SIG_UNBLOCK   1
+#define SIG_SETMASK   2
+
+#define SI_ASYNCNL (-60)
+#define SI_TKILL (-6)
+#define SI_SIGIO (-5)
+#define SI_ASYNCIO (-4)
+#define SI_MESGQ (-3)
+#define SI_TIMER (-2)
+#define SI_QUEUE (-1)
+#define SI_USER 0
+#define SI_KERNEL 128
+
+typedef struct sigaltstack stack_t;
+
+#endif
+
+#include <bits/signal.h>
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define SIG_HOLD ((void (*)(int)) 2)
+
+#define FPE_INTDIV 1
+#define FPE_INTOVF 2
+#define FPE_FLTDIV 3
+#define FPE_FLTOVF 4
+#define FPE_FLTUND 5
+#define FPE_FLTRES 6
+#define FPE_FLTINV 7
+#define FPE_FLTSUB 8
+
+#define ILL_ILLOPC 1
+#define ILL_ILLOPN 2
+#define ILL_ILLADR 3
+#define ILL_ILLTRP 4
+#define ILL_PRVOPC 5
+#define ILL_PRVREG 6
+#define ILL_COPROC 7
+#define ILL_BADSTK 8
+
+#define SEGV_MAPERR 1
+#define SEGV_ACCERR 2
+#define SEGV_BNDERR 3
+#define SEGV_PKUERR 4
+#define SEGV_MTEAERR 8
+#define SEGV_MTESERR 9
+
+#define BUS_ADRALN 1
+#define BUS_ADRERR 2
+#define BUS_OBJERR 3
+#define BUS_MCEERR_AR 4
+#define BUS_MCEERR_AO 5
+
+#define CLD_EXITED 1
+#define CLD_KILLED 2
+#define CLD_DUMPED 3
+#define CLD_TRAPPED 4
+#define CLD_STOPPED 5
+#define CLD_CONTINUED 6
+
+union sigval {
+	int sival_int;
+	void *sival_ptr;
+};
+
+typedef struct {
+#ifdef __SI_SWAP_ERRNO_CODE
+	int si_signo, si_code, si_errno;
+#else
+	int si_signo, si_errno, si_code;
+#endif
+	union {
+		char __pad[128 - 2*sizeof(int) - sizeof(long)];
+		struct {
+			union {
+				struct {
+					pid_t si_pid;
+					uid_t si_uid;
+				} __piduid;
+				struct {
+					int si_timerid;
+					int si_overrun;
+				} __timer;
+			} __first;
+			union {
+				union sigval si_value;
+				struct {
+					int si_status;
+					clock_t si_utime, si_stime;
+				} __sigchld;
+			} __second;
+		} __si_common;
+		struct {
+			void *si_addr;
+			short si_addr_lsb;
+			union {
+				struct {
+					void *si_lower;
+					void *si_upper;
+				} __addr_bnd;
+				unsigned si_pkey;
+			} __first;
+		} __sigfault;
+		struct {
+			long si_band;
+			int si_fd;
+		} __sigpoll;
+		struct {
+			void *si_call_addr;
+			int si_syscall;
+			unsigned si_arch;
+		} __sigsys;
+	} __si_fields;
+} siginfo_t;
+#define si_pid     __si_fields.__si_common.__first.__piduid.si_pid
+#define si_uid     __si_fields.__si_common.__first.__piduid.si_uid
+#define si_status  __si_fields.__si_common.__second.__sigchld.si_status
+#define si_utime   __si_fields.__si_common.__second.__sigchld.si_utime
+#define si_stime   __si_fields.__si_common.__second.__sigchld.si_stime
+#define si_value   __si_fields.__si_common.__second.si_value
+#define si_addr    __si_fields.__sigfault.si_addr
+#define si_addr_lsb __si_fields.__sigfault.si_addr_lsb
+#define si_lower   __si_fields.__sigfault.__first.__addr_bnd.si_lower
+#define si_upper   __si_fields.__sigfault.__first.__addr_bnd.si_upper
+#define si_pkey    __si_fields.__sigfault.__first.si_pkey
+#define si_band    __si_fields.__sigpoll.si_band
+#define si_fd      __si_fields.__sigpoll.si_fd
+#define si_timerid __si_fields.__si_common.__first.__timer.si_timerid
+#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun
+#define si_ptr     si_value.sival_ptr
+#define si_int     si_value.sival_int
+#define si_call_addr __si_fields.__sigsys.si_call_addr
+#define si_syscall __si_fields.__sigsys.si_syscall
+#define si_arch    __si_fields.__sigsys.si_arch
+
+struct sigaction {
+	union {
+		void (*sa_handler)(int);
+		void (*sa_sigaction)(int, siginfo_t *, void *);
+	} __sa_handler;
+	sigset_t sa_mask;
+	int sa_flags;
+	void (*sa_restorer)(void);
+};
+#define sa_handler   __sa_handler.sa_handler
+#define sa_sigaction __sa_handler.sa_sigaction
+
+#define SA_UNSUPPORTED 0x00000400
+#define SA_EXPOSE_TAGBITS 0x00000800
+
+struct sigevent {
+	union sigval sigev_value;
+	int sigev_signo;
+	int sigev_notify;
+	union {
+		char __pad[64 - 2*sizeof(int) - sizeof(union sigval)];
+		pid_t sigev_notify_thread_id;
+		struct {
+			void (*sigev_notify_function)(union sigval);
+			pthread_attr_t *sigev_notify_attributes;
+		} __sev_thread;
+	} __sev_fields;
+};
+
+#define sigev_notify_thread_id __sev_fields.sigev_notify_thread_id
+#define sigev_notify_function __sev_fields.__sev_thread.sigev_notify_function
+#define sigev_notify_attributes __sev_fields.__sev_thread.sigev_notify_attributes
+
+#define SIGEV_SIGNAL 0
+#define SIGEV_NONE 1
+#define SIGEV_THREAD 2
+#define SIGEV_THREAD_ID 4
+
+int __libc_current_sigrtmin(void);
+int __libc_current_sigrtmax(void);
+
+#define SIGRTMIN  (__libc_current_sigrtmin())
+#define SIGRTMAX  (__libc_current_sigrtmax())
+
+int kill(pid_t, int);
+
+int sigemptyset(sigset_t *);
+int sigfillset(sigset_t *);
+int sigaddset(sigset_t *, int);
+int sigdelset(sigset_t *, int);
+int sigismember(const sigset_t *, int);
+
+int sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict);
+int sigsuspend(const sigset_t *);
+int sigaction(int, const struct sigaction *__restrict, struct sigaction *__restrict);
+int sigpending(sigset_t *);
+int sigwait(const sigset_t *__restrict, int *__restrict);
+int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict);
+int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct timespec *__restrict);
+int sigqueue(pid_t, int, union sigval);
+
+int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict);
+int pthread_kill(pthread_t, int);
+
+void psiginfo(const siginfo_t *, const char *);
+void psignal(int, const char *);
+
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+int killpg(pid_t, int);
+int sigaltstack(const stack_t *__restrict, stack_t *__restrict);
+int sighold(int);
+int sigignore(int);
+int siginterrupt(int, int);
+int sigpause(int);
+int sigrelse(int);
+void (*sigset(int, void (*)(int)))(int);
+#define TRAP_BRKPT 1
+#define TRAP_TRACE 2
+#define TRAP_BRANCH 3
+#define TRAP_HWBKPT 4
+#define TRAP_UNK 5
+#define POLL_IN 1
+#define POLL_OUT 2
+#define POLL_MSG 3
+#define POLL_ERR 4
+#define POLL_PRI 5
+#define POLL_HUP 6
+#define SS_ONSTACK    1
+#define SS_DISABLE    2
+#define SS_AUTODISARM (1U << 31)
+#define SS_FLAG_BITS SS_AUTODISARM
+#endif
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define NSIG _NSIG
+typedef void (*sig_t)(int);
+
+#define SYS_SECCOMP 1
+#define SYS_USER_DISPATCH 2
+#endif
+
+#ifdef _GNU_SOURCE
+typedef void (*sighandler_t)(int);
+void (*bsd_signal(int, void (*)(int)))(int);
+int sigisemptyset(const sigset_t *);
+int sigorset (sigset_t *, const sigset_t *, const sigset_t *);
+int sigandset(sigset_t *, const sigset_t *, const sigset_t *);
+
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
+#endif
+
+#define SIG_ERR  ((void (*)(int))-1)
+#define SIG_DFL  ((void (*)(int)) 0)
+#define SIG_IGN  ((void (*)(int)) 1)
+
+typedef int sig_atomic_t;
+
+void (*signal(int, void (*)(int)))(int);
+int raise(int);
+
+#if _REDIR_TIME64
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+__REDIR(sigtimedwait, __sigtimedwait_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/spawn.h b/musl-include/aarch64/spawn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/spawn.h
@@ -0,0 +1,83 @@
+#ifndef _SPAWN_H
+#define _SPAWN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_mode_t
+#define __NEED_pid_t
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+struct sched_param;
+
+#define POSIX_SPAWN_RESETIDS 1
+#define POSIX_SPAWN_SETPGROUP 2
+#define POSIX_SPAWN_SETSIGDEF 4
+#define POSIX_SPAWN_SETSIGMASK 8
+#define POSIX_SPAWN_SETSCHEDPARAM 16
+#define POSIX_SPAWN_SETSCHEDULER 32
+#define POSIX_SPAWN_USEVFORK 64
+#define POSIX_SPAWN_SETSID 128
+
+typedef struct {
+	int __flags;
+	pid_t __pgrp;
+	sigset_t __def, __mask;
+	int __prio, __pol;
+	void *__fn;
+	char __pad[64-sizeof(void *)];
+} posix_spawnattr_t;
+
+typedef struct {
+	int __pad0[2];
+	void *__actions;
+	int __pad[16];
+} posix_spawn_file_actions_t;
+
+int posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
+int posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
+
+int posix_spawnattr_init(posix_spawnattr_t *);
+int posix_spawnattr_destroy(posix_spawnattr_t *);
+
+int posix_spawnattr_setflags(posix_spawnattr_t *, short);
+int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict);
+
+int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
+int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict);
+
+int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
+
+int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
+
+int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict, const struct sched_param *__restrict);
+int posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict, struct sched_param *__restrict);
+int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
+int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict, int *__restrict);
+
+int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
+int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
+
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t);
+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
+int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/stdalign.h b/musl-include/aarch64/stdalign.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stdalign.h
@@ -0,0 +1,20 @@
+#ifndef _STDALIGN_H
+#define _STDALIGN_H
+
+#ifndef __cplusplus
+
+/* this whole header only works in C11 or with compiler extensions */
+#if __STDC_VERSION__ < 201112L && defined( __GNUC__)
+#define _Alignas(t) __attribute__((__aligned__(t)))
+#define _Alignof(t) __alignof__(t)
+#endif
+
+#define alignas _Alignas
+#define alignof _Alignof
+
+#endif
+
+#define __alignas_is_defined 1
+#define __alignof_is_defined 1
+
+#endif
diff --git a/musl-include/aarch64/stdarg.h b/musl-include/aarch64/stdarg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stdarg.h
@@ -0,0 +1,21 @@
+#ifndef _STDARG_H
+#define _STDARG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_va_list
+
+#include <bits/alltypes.h>
+
+#define va_start(v,l)   __builtin_va_start(v,l)
+#define va_end(v)       __builtin_va_end(v)
+#define va_arg(v,l)     __builtin_va_arg(v,l)
+#define va_copy(d,s)    __builtin_va_copy(d,s)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/stdbool.h b/musl-include/aarch64/stdbool.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stdbool.h
@@ -0,0 +1,14 @@
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+#ifndef __cplusplus
+
+#define true 1
+#define false 0
+#define bool _Bool
+
+#endif
+
+#define __bool_true_false_are_defined 1
+
+#endif
diff --git a/musl-include/aarch64/stdc-predef.h b/musl-include/aarch64/stdc-predef.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stdc-predef.h
@@ -0,0 +1,18 @@
+#ifndef _STDC_PREDEF_H
+#define _STDC_PREDEF_H
+
+#define __STDC_ISO_10646__ 201206L
+
+#if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0
+#define __STDC_IEC_559__ 1
+#endif
+
+#if !defined(__STDC_UTF_16__)
+#define __STDC_UTF_16__ 1
+#endif
+
+#if !defined(__STDC_UTF_32__)
+#define __STDC_UTF_32__ 1
+#endif
+
+#endif
diff --git a/musl-include/aarch64/stddef.h b/musl-include/aarch64/stddef.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stddef.h
@@ -0,0 +1,27 @@
+#ifndef _STDDEF_H
+#define _STDDEF_H
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_ptrdiff_t
+#define __NEED_size_t
+#define __NEED_wchar_t
+#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
+#define __NEED_max_align_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if __GNUC__ > 3
+#define offsetof(type, member) __builtin_offsetof(type, member)
+#else
+#define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 ))
+#endif
+
+#endif
diff --git a/musl-include/aarch64/stdint.h b/musl-include/aarch64/stdint.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stdint.h
@@ -0,0 +1,117 @@
+#ifndef _STDINT_H
+#define _STDINT_H
+
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+
+#define __NEED_uint8_t
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#define __NEED_intptr_t
+#define __NEED_uintptr_t
+
+#define __NEED_intmax_t
+#define __NEED_uintmax_t
+
+#include <bits/alltypes.h>
+
+typedef int8_t int_fast8_t;
+typedef int64_t int_fast64_t;
+
+typedef int8_t  int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+
+typedef uint8_t uint_fast8_t;
+typedef uint64_t uint_fast64_t;
+
+typedef uint8_t  uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+#define INT8_MIN   (-1-0x7f)
+#define INT16_MIN  (-1-0x7fff)
+#define INT32_MIN  (-1-0x7fffffff)
+#define INT64_MIN  (-1-0x7fffffffffffffff)
+
+#define INT8_MAX   (0x7f)
+#define INT16_MAX  (0x7fff)
+#define INT32_MAX  (0x7fffffff)
+#define INT64_MAX  (0x7fffffffffffffff)
+
+#define UINT8_MAX  (0xff)
+#define UINT16_MAX (0xffff)
+#define UINT32_MAX (0xffffffffu)
+#define UINT64_MAX (0xffffffffffffffffu)
+
+#define INT_FAST8_MIN   INT8_MIN
+#define INT_FAST64_MIN  INT64_MIN
+
+#define INT_LEAST8_MIN   INT8_MIN
+#define INT_LEAST16_MIN  INT16_MIN
+#define INT_LEAST32_MIN  INT32_MIN
+#define INT_LEAST64_MIN  INT64_MIN
+
+#define INT_FAST8_MAX   INT8_MAX
+#define INT_FAST64_MAX  INT64_MAX
+
+#define INT_LEAST8_MAX   INT8_MAX
+#define INT_LEAST16_MAX  INT16_MAX
+#define INT_LEAST32_MAX  INT32_MAX
+#define INT_LEAST64_MAX  INT64_MAX
+
+#define UINT_FAST8_MAX  UINT8_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define UINT_LEAST8_MAX  UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INTMAX_MIN  INT64_MIN
+#define INTMAX_MAX  INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define WINT_MIN 0U
+#define WINT_MAX UINT32_MAX
+
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
+
+#define SIG_ATOMIC_MIN  INT32_MIN
+#define SIG_ATOMIC_MAX  INT32_MAX
+
+#include <bits/stdint.h>
+
+#define INT8_C(c)  c
+#define INT16_C(c) c
+#define INT32_C(c) c
+
+#define UINT8_C(c)  c
+#define UINT16_C(c) c
+#define UINT32_C(c) c ## U
+
+#if UINTPTR_MAX == UINT64_MAX
+#define INT64_C(c) c ## L
+#define UINT64_C(c) c ## UL
+#define INTMAX_C(c)  c ## L
+#define UINTMAX_C(c) c ## UL
+#else
+#define INT64_C(c) c ## LL
+#define UINT64_C(c) c ## ULL
+#define INTMAX_C(c)  c ## LL
+#define UINTMAX_C(c) c ## ULL
+#endif
+
+#endif
diff --git a/musl-include/aarch64/stdio.h b/musl-include/aarch64/stdio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stdio.h
@@ -0,0 +1,224 @@
+#ifndef _STDIO_H
+#define _STDIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_FILE
+#define __NEED___isoc_va_list
+#define __NEED_size_t
+
+#if __STDC_VERSION__ < 201112L
+#define __NEED_struct__IO_FILE
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_ssize_t
+#define __NEED_off_t
+#define __NEED_va_list
+#endif
+
+#include <bits/alltypes.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#undef EOF
+#define EOF (-1)
+
+#undef SEEK_SET
+#undef SEEK_CUR
+#undef SEEK_END
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#define _IOFBF 0
+#define _IOLBF 1
+#define _IONBF 2
+
+#define BUFSIZ 1024
+#define FILENAME_MAX 4096
+#define FOPEN_MAX 1000
+#define TMP_MAX 10000
+#define L_tmpnam 20
+
+typedef union _G_fpos64_t {
+	char __opaque[16];
+	long long __lldata;
+	double __align;
+} fpos_t;
+
+extern FILE *const stdin;
+extern FILE *const stdout;
+extern FILE *const stderr;
+
+#define stdin  (stdin)
+#define stdout (stdout)
+#define stderr (stderr)
+
+FILE *fopen(const char *__restrict, const char *__restrict);
+FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict);
+int fclose(FILE *);
+
+int remove(const char *);
+int rename(const char *, const char *);
+
+int feof(FILE *);
+int ferror(FILE *);
+int fflush(FILE *);
+void clearerr(FILE *);
+
+int fseek(FILE *, long, int);
+long ftell(FILE *);
+void rewind(FILE *);
+
+int fgetpos(FILE *__restrict, fpos_t *__restrict);
+int fsetpos(FILE *, const fpos_t *);
+
+size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
+size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict);
+
+int fgetc(FILE *);
+int getc(FILE *);
+int getchar(void);
+int ungetc(int, FILE *);
+
+int fputc(int, FILE *);
+int putc(int, FILE *);
+int putchar(int);
+
+char *fgets(char *__restrict, int, FILE *__restrict);
+#if __STDC_VERSION__ < 201112L
+char *gets(char *);
+#endif
+
+int fputs(const char *__restrict, FILE *__restrict);
+int puts(const char *);
+
+int printf(const char *__restrict, ...);
+int fprintf(FILE *__restrict, const char *__restrict, ...);
+int sprintf(char *__restrict, const char *__restrict, ...);
+int snprintf(char *__restrict, size_t, const char *__restrict, ...);
+
+int vprintf(const char *__restrict, __isoc_va_list);
+int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
+int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list);
+
+int scanf(const char *__restrict, ...);
+int fscanf(FILE *__restrict, const char *__restrict, ...);
+int sscanf(const char *__restrict, const char *__restrict, ...);
+int vscanf(const char *__restrict, __isoc_va_list);
+int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list);
+
+void perror(const char *);
+
+int setvbuf(FILE *__restrict, char *__restrict, int, size_t);
+void setbuf(FILE *__restrict, char *__restrict);
+
+char *tmpnam(char *);
+FILE *tmpfile(void);
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+FILE *fmemopen(void *__restrict, size_t, const char *__restrict);
+FILE *open_memstream(char **, size_t *);
+FILE *fdopen(int, const char *);
+FILE *popen(const char *, const char *);
+int pclose(FILE *);
+int fileno(FILE *);
+int fseeko(FILE *, off_t, int);
+off_t ftello(FILE *);
+int dprintf(int, const char *__restrict, ...);
+int vdprintf(int, const char *__restrict, __isoc_va_list);
+void flockfile(FILE *);
+int ftrylockfile(FILE *);
+void funlockfile(FILE *);
+int getc_unlocked(FILE *);
+int getchar_unlocked(void);
+int putc_unlocked(int, FILE *);
+int putchar_unlocked(int);
+ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict);
+ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict);
+int renameat(int, const char *, int, const char *);
+char *ctermid(char *);
+#define L_ctermid 20
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define P_tmpdir "/tmp"
+char *tempnam(const char *, const char *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define L_cuserid 20
+char *cuserid(char *);
+void setlinebuf(FILE *);
+void setbuffer(FILE *, char *, size_t);
+int fgetc_unlocked(FILE *);
+int fputc_unlocked(int, FILE *);
+int fflush_unlocked(FILE *);
+size_t fread_unlocked(void *, size_t, size_t, FILE *);
+size_t fwrite_unlocked(const void *, size_t, size_t, FILE *);
+void clearerr_unlocked(FILE *);
+int feof_unlocked(FILE *);
+int ferror_unlocked(FILE *);
+int fileno_unlocked(FILE *);
+int getw(FILE *);
+int putw(int, FILE *);
+char *fgetln(FILE *, size_t *);
+int asprintf(char **, const char *, ...);
+int vasprintf(char **, const char *, __isoc_va_list);
+#endif
+
+#ifdef _GNU_SOURCE
+char *fgets_unlocked(char *, int, FILE *);
+int fputs_unlocked(const char *, FILE *);
+
+typedef ssize_t (cookie_read_function_t)(void *, char *, size_t);
+typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
+typedef int (cookie_seek_function_t)(void *, off_t *, int);
+typedef int (cookie_close_function_t)(void *);
+
+typedef struct _IO_cookie_io_functions_t {
+	cookie_read_function_t *read;
+	cookie_write_function_t *write;
+	cookie_seek_function_t *seek;
+	cookie_close_function_t *close;
+} cookie_io_functions_t;
+
+FILE *fopencookie(void *, const char *, cookie_io_functions_t);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define tmpfile64 tmpfile
+#define fopen64 fopen
+#define freopen64 freopen
+#define fseeko64 fseeko
+#define ftello64 ftello
+#define fgetpos64 fgetpos
+#define fsetpos64 fsetpos
+#define fpos64_t fpos_t
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/stdio_ext.h b/musl-include/aarch64/stdio_ext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stdio_ext.h
@@ -0,0 +1,34 @@
+#ifndef _STDIO_EXT_H
+#define _STDIO_EXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+#define FSETLOCKING_QUERY 0
+#define FSETLOCKING_INTERNAL 1
+#define FSETLOCKING_BYCALLER 2
+
+void _flushlbf(void);
+int __fsetlocking(FILE *, int);
+int __fwriting(FILE *);
+int __freading(FILE *);
+int __freadable(FILE *);
+int __fwritable(FILE *);
+int __flbf(FILE *);
+size_t __fbufsize(FILE *);
+size_t __fpending(FILE *);
+int __fpurge(FILE *);
+
+size_t __freadahead(FILE *);
+const char *__freadptr(FILE *, size_t *);
+void __freadptrinc(FILE *, size_t);
+void __fseterr(FILE *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/stdlib.h b/musl-include/aarch64/stdlib.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stdlib.h
@@ -0,0 +1,179 @@
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#define __NEED_wchar_t
+
+#include <bits/alltypes.h>
+
+int atoi (const char *);
+long atol (const char *);
+long long atoll (const char *);
+double atof (const char *);
+
+float strtof (const char *__restrict, char **__restrict);
+double strtod (const char *__restrict, char **__restrict);
+long double strtold (const char *__restrict, char **__restrict);
+
+long strtol (const char *__restrict, char **__restrict, int);
+unsigned long strtoul (const char *__restrict, char **__restrict, int);
+long long strtoll (const char *__restrict, char **__restrict, int);
+unsigned long long strtoull (const char *__restrict, char **__restrict, int);
+
+int rand (void);
+void srand (unsigned);
+
+void *malloc (size_t);
+void *calloc (size_t, size_t);
+void *realloc (void *, size_t);
+void free (void *);
+void *aligned_alloc(size_t, size_t);
+
+_Noreturn void abort (void);
+int atexit (void (*) (void));
+_Noreturn void exit (int);
+_Noreturn void _Exit (int);
+int at_quick_exit (void (*) (void));
+_Noreturn void quick_exit (int);
+
+char *getenv (const char *);
+
+int system (const char *);
+
+void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
+void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
+
+int abs (int);
+long labs (long);
+long long llabs (long long);
+
+typedef struct { int quot, rem; } div_t;
+typedef struct { long quot, rem; } ldiv_t;
+typedef struct { long long quot, rem; } lldiv_t;
+
+div_t div (int, int);
+ldiv_t ldiv (long, long);
+lldiv_t lldiv (long long, long long);
+
+int mblen (const char *, size_t);
+int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
+int wctomb (char *, wchar_t);
+size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
+size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+size_t __ctype_get_mb_cur_max(void);
+#define MB_CUR_MAX (__ctype_get_mb_cur_max())
+
+#define RAND_MAX (0x7fffffff)
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define WNOHANG    1
+#define WUNTRACED  2
+
+#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
+#define WTERMSIG(s) ((s) & 0x7f)
+#define WSTOPSIG(s) WEXITSTATUS(s)
+#define WIFEXITED(s) (!WTERMSIG(s))
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
+
+int posix_memalign (void **, size_t, size_t);
+int setenv (const char *, const char *, int);
+int unsetenv (const char *);
+int mkstemp (char *);
+int mkostemp (char *, int);
+char *mkdtemp (char *);
+int getsubopt (char **, char *const *, char **);
+int rand_r (unsigned *);
+
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+char *realpath (const char *__restrict, char *__restrict);
+long int random (void);
+void srandom (unsigned int);
+char *initstate (unsigned int, char *, size_t);
+char *setstate (char *);
+int putenv (char *);
+int posix_openpt (int);
+int grantpt (int);
+int unlockpt (int);
+char *ptsname (int);
+char *l64a (long);
+long a64l (const char *);
+void setkey (const char *);
+double drand48 (void);
+double erand48 (unsigned short [3]);
+long int lrand48 (void);
+long int nrand48 (unsigned short [3]);
+long mrand48 (void);
+long jrand48 (unsigned short [3]);
+void srand48 (long);
+unsigned short *seed48 (unsigned short [3]);
+void lcong48 (unsigned short [7]);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#include <alloca.h>
+char *mktemp (char *);
+int mkstemps (char *, int);
+int mkostemps (char *, int, int);
+void *valloc (size_t);
+void *memalign(size_t, size_t);
+int getloadavg(double *, int);
+int clearenv(void);
+#define WCOREDUMP(s) ((s) & 0x80)
+#define WIFCONTINUED(s) ((s) == 0xffff)
+void *reallocarray (void *, size_t, size_t);
+void qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *);
+#endif
+
+#ifdef _GNU_SOURCE
+int ptsname_r(int, char *, size_t);
+char *ecvt(double, int, int *, int *);
+char *fcvt(double, int, int *, int *);
+char *gcvt(double, int, char *);
+char *secure_getenv(const char *);
+struct __locale_struct;
+float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define mkstemp64 mkstemp
+#define mkostemp64 mkostemp
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define mkstemps64 mkstemps
+#define mkostemps64 mkostemps
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/stdnoreturn.h b/musl-include/aarch64/stdnoreturn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stdnoreturn.h
@@ -0,0 +1,7 @@
+#ifndef _STDNORETURN_H
+#define _STDNORETURN_H
+#ifndef __cplusplus
+#include <features.h>
+#define noreturn _Noreturn
+#endif
+#endif
diff --git a/musl-include/aarch64/string.h b/musl-include/aarch64/string.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/string.h
@@ -0,0 +1,104 @@
+#ifndef	_STRING_H
+#define	_STRING_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+void *memcpy (void *__restrict, const void *__restrict, size_t);
+void *memmove (void *, const void *, size_t);
+void *memset (void *, int, size_t);
+int memcmp (const void *, const void *, size_t);
+void *memchr (const void *, int, size_t);
+
+char *strcpy (char *__restrict, const char *__restrict);
+char *strncpy (char *__restrict, const char *__restrict, size_t);
+
+char *strcat (char *__restrict, const char *__restrict);
+char *strncat (char *__restrict, const char *__restrict, size_t);
+
+int strcmp (const char *, const char *);
+int strncmp (const char *, const char *, size_t);
+
+int strcoll (const char *, const char *);
+size_t strxfrm (char *__restrict, const char *__restrict, size_t);
+
+char *strchr (const char *, int);
+char *strrchr (const char *, int);
+
+size_t strcspn (const char *, const char *);
+size_t strspn (const char *, const char *);
+char *strpbrk (const char *, const char *);
+char *strstr (const char *, const char *);
+char *strtok (char *__restrict, const char *__restrict);
+
+size_t strlen (const char *);
+
+char *strerror (int);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#include <strings.h>
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
+int strerror_r (int, char *, size_t);
+char *stpcpy(char *__restrict, const char *__restrict);
+char *stpncpy(char *__restrict, const char *__restrict, size_t);
+size_t strnlen (const char *, size_t);
+char *strdup (const char *);
+char *strndup (const char *, size_t);
+char *strsignal(int);
+char *strerror_l (int, locale_t);
+int strcoll_l (const char *, const char *, locale_t);
+size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
+void *memmem(const void *, size_t, const void *, size_t);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+void *memccpy (void *__restrict, const void *__restrict, int, size_t);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+char *strsep(char **, const char *);
+size_t strlcat (char *, const char *, size_t);
+size_t strlcpy (char *, const char *, size_t);
+void explicit_bzero (void *, size_t);
+#endif
+
+#ifdef _GNU_SOURCE
+#define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)
+int strverscmp (const char *, const char *);
+char *strchrnul(const char *, int);
+char *strcasestr(const char *, const char *);
+void *memrchr(const void *, int, size_t);
+void *mempcpy(void *, const void *, size_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/strings.h b/musl-include/aarch64/strings.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/strings.h
@@ -0,0 +1,40 @@
+#ifndef	_STRINGS_H
+#define	_STRINGS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_locale_t
+#include <bits/alltypes.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+int bcmp (const void *, const void *, size_t);
+void bcopy (const void *, void *, size_t);
+void bzero (void *, size_t);
+char *index (const char *, int);
+char *rindex (const char *, int);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)  || defined(_BSD_SOURCE)
+int ffs (int);
+int ffsl (long);
+int ffsll (long long);
+#endif
+
+int strcasecmp (const char *, const char *);
+int strncasecmp (const char *, const char *, size_t);
+
+int strcasecmp_l (const char *, const char *, locale_t);
+int strncasecmp_l (const char *, const char *, size_t, locale_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/stropts.h b/musl-include/aarch64/stropts.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/stropts.h
@@ -0,0 +1,139 @@
+#ifndef _STROPTS_H
+#define _STROPTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __SID		('S' << 8)
+
+#define I_NREAD		(__SID | 1)
+#define I_PUSH		(__SID | 2)
+#define I_POP		(__SID | 3)
+#define I_LOOK		(__SID | 4)
+#define I_FLUSH		(__SID | 5)
+#define I_SRDOPT	(__SID | 6)
+#define I_GRDOPT	(__SID | 7)
+#define I_STR		(__SID | 8)
+#define I_SETSIG	(__SID | 9)
+#define I_GETSIG	(__SID |10)
+#define I_FIND		(__SID |11)
+#define I_LINK		(__SID |12)
+#define I_UNLINK	(__SID |13)
+#define I_PEEK		(__SID |15)
+#define I_FDINSERT	(__SID |16)
+#define I_SENDFD	(__SID |17)
+#define I_RECVFD	(__SID |14)
+#define I_SWROPT	(__SID |19)
+#define I_GWROPT	(__SID |20)
+#define I_LIST		(__SID |21)
+#define I_PLINK		(__SID |22)
+#define I_PUNLINK	(__SID |23)
+#define I_FLUSHBAND	(__SID |28)
+#define I_CKBAND	(__SID |29)
+#define I_GETBAND	(__SID |30)
+#define I_ATMARK	(__SID |31)
+#define I_SETCLTIME	(__SID |32)
+#define I_GETCLTIME	(__SID |33)
+#define I_CANPUT	(__SID |34)
+
+#define FMNAMESZ	8
+
+#define FLUSHR		0x01
+#define FLUSHW		0x02
+#define FLUSHRW		0x03
+#define FLUSHBAND	0x04
+
+#define S_INPUT		0x0001
+#define S_HIPRI		0x0002
+#define S_OUTPUT	0x0004
+#define S_MSG		0x0008
+#define S_ERROR		0x0010
+#define S_HANGUP	0x0020
+#define S_RDNORM	0x0040
+#define S_WRNORM	S_OUTPUT
+#define S_RDBAND	0x0080
+#define S_WRBAND	0x0100
+#define S_BANDURG	0x0200
+
+#define RS_HIPRI	0x01
+
+#define RNORM		0x0000
+#define RMSGD		0x0001
+#define RMSGN		0x0002
+#define RPROTDAT	0x0004
+#define RPROTDIS	0x0008
+#define RPROTNORM	0x0010
+#define RPROTMASK	0x001C
+
+#define SNDZERO		0x001
+#define SNDPIPE		0x002
+
+#define ANYMARK		0x01
+#define LASTMARK	0x02
+
+#define MUXID_ALL	(-1)
+
+#define MSG_HIPRI	0x01
+#define MSG_ANY		0x02
+#define MSG_BAND	0x04
+
+#define MORECTL		1
+#define MOREDATA	2
+
+struct bandinfo {
+	unsigned char bi_pri;
+	int bi_flag;
+};
+
+struct strbuf {
+	int maxlen;
+	int len;
+	char *buf;
+};
+
+struct strpeek {
+	struct strbuf ctlbuf;
+	struct strbuf databuf;
+	unsigned flags;
+};
+
+struct strfdinsert {
+	struct strbuf ctlbuf;
+	struct strbuf databuf;
+	unsigned flags;
+	int fildes;
+	int offset;
+};
+
+struct strioctl {
+	int ic_cmd;
+	int ic_timout;
+	int ic_len;
+	char *ic_dp;
+};
+
+struct strrecvfd {
+	int fd;
+	int uid;
+	int gid;
+	char __fill[8];
+};
+
+struct str_mlist {
+	char l_name[FMNAMESZ + 1];
+};
+
+struct str_list {
+	int sl_nmods;
+	struct str_mlist *sl_modlist;
+};
+
+int isastream(int);
+int ioctl(int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/acct.h b/musl-include/aarch64/sys/acct.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/acct.h
@@ -0,0 +1,72 @@
+#ifndef _SYS_ACCT_H
+#define _SYS_ACCT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <time.h>
+#include <stdint.h>
+
+#define ACCT_COMM 16
+
+typedef uint16_t comp_t;
+
+struct acct {
+	char ac_flag;
+	uint16_t ac_uid;
+	uint16_t ac_gid;
+	uint16_t ac_tty;
+	uint32_t ac_btime;
+	comp_t ac_utime;
+	comp_t ac_stime;
+	comp_t ac_etime;
+	comp_t ac_mem;
+	comp_t ac_io;
+	comp_t ac_rw;
+	comp_t ac_minflt;
+	comp_t ac_majflt;
+	comp_t ac_swaps;
+	uint32_t ac_exitcode;
+	char ac_comm[ACCT_COMM+1];
+	char ac_pad[10];
+};
+
+
+struct acct_v3 {
+	char ac_flag;
+	char ac_version;
+	uint16_t ac_tty;
+	uint32_t ac_exitcode;
+	uint32_t ac_uid;
+	uint32_t ac_gid;
+	uint32_t ac_pid;
+	uint32_t ac_ppid;
+	uint32_t ac_btime;
+	float ac_etime;
+	comp_t ac_utime;
+	comp_t ac_stime;
+	comp_t ac_mem;
+	comp_t ac_io;
+	comp_t ac_rw;
+	comp_t ac_minflt;
+	comp_t ac_majflt;
+	comp_t ac_swaps;
+	char ac_comm[ACCT_COMM];
+};
+
+#define AFORK 1
+#define ASU 2
+#define ACORE 8
+#define AXSIG 16
+#define ACCT_BYTEORDER (128*(__BYTE_ORDER==__BIG_ENDIAN))
+#define AHZ 100
+
+int acct(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/auxv.h b/musl-include/aarch64/sys/auxv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/auxv.h
@@ -0,0 +1,17 @@
+#ifndef _SYS_AUXV_H
+#define _SYS_AUXV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+#include <bits/hwcap.h>
+
+unsigned long getauxval(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/cachectl.h b/musl-include/aarch64/sys/cachectl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/cachectl.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_CACHECTL_H
+#define _SYS_CACHECTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ICACHE (1<<0)
+#define DCACHE (1<<1)
+#define BCACHE (ICACHE|DCACHE)
+#define CACHEABLE 0
+#define UNCACHEABLE 1
+ 
+int cachectl(void *, int, int);
+int cacheflush(void *, int, int);
+int _flush_cache(void *, int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/dir.h b/musl-include/aarch64/sys/dir.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/dir.h
@@ -0,0 +1,2 @@
+#include <dirent.h>
+#define direct dirent
diff --git a/musl-include/aarch64/sys/epoll.h b/musl-include/aarch64/sys/epoll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/epoll.h
@@ -0,0 +1,69 @@
+#ifndef	_SYS_EPOLL_H
+#define	_SYS_EPOLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define EPOLL_CLOEXEC O_CLOEXEC
+#define EPOLL_NONBLOCK O_NONBLOCK
+
+enum EPOLL_EVENTS { __EPOLL_DUMMY };
+#define EPOLLIN 0x001
+#define EPOLLPRI 0x002
+#define EPOLLOUT 0x004
+#define EPOLLRDNORM 0x040
+#define EPOLLNVAL 0x020
+#define EPOLLRDBAND 0x080
+#define EPOLLWRNORM 0x100
+#define EPOLLWRBAND 0x200
+#define EPOLLMSG 0x400
+#define EPOLLERR 0x008
+#define EPOLLHUP 0x010
+#define EPOLLRDHUP 0x2000
+#define EPOLLEXCLUSIVE (1U<<28)
+#define EPOLLWAKEUP (1U<<29)
+#define EPOLLONESHOT (1U<<30)
+#define EPOLLET (1U<<31)
+
+#define EPOLL_CTL_ADD 1
+#define EPOLL_CTL_DEL 2
+#define EPOLL_CTL_MOD 3
+
+typedef union epoll_data {
+	void *ptr;
+	int fd;
+	uint32_t u32;
+	uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event {
+	uint32_t events;
+	epoll_data_t data;
+}
+#ifdef __x86_64__
+__attribute__ ((__packed__))
+#endif
+;
+
+
+int epoll_create(int);
+int epoll_create1(int);
+int epoll_ctl(int, int, int, struct epoll_event *);
+int epoll_wait(int, struct epoll_event *, int, int);
+int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/epoll.h */
diff --git a/musl-include/aarch64/sys/errno.h b/musl-include/aarch64/sys/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/errno.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/errno.h> to <errno.h>
+#include <errno.h>
diff --git a/musl-include/aarch64/sys/eventfd.h b/musl-include/aarch64/sys/eventfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/eventfd.h
@@ -0,0 +1,26 @@
+#ifndef _SYS_EVENTFD_H
+#define _SYS_EVENTFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+typedef uint64_t eventfd_t;
+
+#define EFD_SEMAPHORE 1
+#define EFD_CLOEXEC O_CLOEXEC
+#define EFD_NONBLOCK O_NONBLOCK
+
+int eventfd(unsigned int, int);
+int eventfd_read(int, eventfd_t *);
+int eventfd_write(int, eventfd_t);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/eventfd.h */
diff --git a/musl-include/aarch64/sys/fanotify.h b/musl-include/aarch64/sys/fanotify.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/fanotify.h
@@ -0,0 +1,111 @@
+#ifndef _FANOTIFY_H
+#define _FANOTIFY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/statfs.h>
+
+struct fanotify_event_metadata {
+	unsigned event_len;
+	unsigned char vers;
+	unsigned char reserved;
+	unsigned short metadata_len;
+	unsigned long long mask
+#ifdef __GNUC__
+	__attribute__((__aligned__(8)))
+#endif
+	;
+	int fd;
+	int pid;
+};
+
+struct fanotify_event_info_header {
+	unsigned char info_type;
+	unsigned char pad;
+	unsigned short len;
+};
+
+struct fanotify_event_info_fid {
+	struct fanotify_event_info_header hdr;
+	fsid_t fsid;
+	unsigned char handle[];
+};
+
+struct fanotify_response {
+	int fd;
+	unsigned response;
+};
+
+#define FAN_ACCESS 0x01
+#define FAN_MODIFY 0x02
+#define FAN_ATTRIB 0x04
+#define FAN_CLOSE_WRITE 0x08
+#define FAN_CLOSE_NOWRITE 0x10
+#define FAN_OPEN 0x20
+#define FAN_MOVED_FROM 0x40
+#define FAN_MOVED_TO 0x80
+#define FAN_CREATE 0x100
+#define FAN_DELETE 0x200
+#define FAN_DELETE_SELF 0x400
+#define FAN_MOVE_SELF 0x800
+#define FAN_OPEN_EXEC 0x1000
+#define FAN_Q_OVERFLOW 0x4000
+#define FAN_OPEN_PERM 0x10000
+#define FAN_ACCESS_PERM 0x20000
+#define FAN_OPEN_EXEC_PERM 0x40000
+#define FAN_DIR_MODIFY 0x00080000
+#define FAN_EVENT_ON_CHILD 0x08000000
+#define FAN_ONDIR 0x40000000
+#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
+#define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO)
+#define FAN_CLOEXEC 0x01
+#define FAN_NONBLOCK 0x02
+#define FAN_CLASS_NOTIF 0
+#define FAN_CLASS_CONTENT 0x04
+#define FAN_CLASS_PRE_CONTENT 0x08
+#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
+#define FAN_UNLIMITED_QUEUE 0x10
+#define FAN_UNLIMITED_MARKS 0x20
+#define FAN_ENABLE_AUDIT 0x40
+#define FAN_REPORT_TID 0x100
+#define FAN_REPORT_FID 0x200
+#define FAN_REPORT_DIR_FID 0x00000400
+#define FAN_REPORT_NAME 0x00000800
+#define FAN_REPORT_DFID_NAME (FAN_REPORT_DIR_FID | FAN_REPORT_NAME)
+#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
+#define FAN_MARK_ADD 0x01
+#define FAN_MARK_REMOVE 0x02
+#define FAN_MARK_DONT_FOLLOW 0x04
+#define FAN_MARK_ONLYDIR 0x08
+#define FAN_MARK_IGNORED_MASK 0x20
+#define FAN_MARK_IGNORED_SURV_MODIFY 0x40
+#define FAN_MARK_FLUSH 0x80
+#define FAN_MARK_INODE 0x00
+#define FAN_MARK_MOUNT 0x10
+#define FAN_MARK_FILESYSTEM 0x100
+#define FAN_MARK_TYPE_MASK (FAN_MARK_INODE | FAN_MARK_MOUNT | FAN_MARK_FILESYSTEM)
+#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_DONT_FOLLOW | FAN_MARK_ONLYDIR | FAN_MARK_MOUNT | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY | FAN_MARK_FLUSH)
+#define FAN_ALL_EVENTS (FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN)
+#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
+#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS | FAN_ALL_PERM_EVENTS | FAN_Q_OVERFLOW)
+#define FANOTIFY_METADATA_VERSION 3
+#define FAN_EVENT_INFO_TYPE_FID 1
+#define FAN_EVENT_INFO_TYPE_DFID_NAME 2
+#define FAN_EVENT_INFO_TYPE_DFID 3
+#define FAN_ALLOW 0x01
+#define FAN_DENY 0x02
+#define FAN_AUDIT 0x10
+#define FAN_NOFD -1
+#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
+#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, (struct fanotify_event_metadata*)(((char *)(meta)) + (meta)->event_len))
+#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len <= (long)(len))
+
+int fanotify_init(unsigned, unsigned);
+int fanotify_mark(int, unsigned, unsigned long long, int, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/fcntl.h b/musl-include/aarch64/sys/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/fcntl.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
+#include <fcntl.h>
diff --git a/musl-include/aarch64/sys/file.h b/musl-include/aarch64/sys/file.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/file.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_FILE_H
+#define _SYS_FILE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOCK_SH	1
+#define LOCK_EX	2
+#define LOCK_NB	4
+#define LOCK_UN	8
+
+#define L_SET 0
+#define L_INCR 1
+#define L_XTND 2
+
+int flock(int, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/fsuid.h b/musl-include/aarch64/sys/fsuid.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/fsuid.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_FSUID_H
+#define _SYS_FSUID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_uid_t
+#define __NEED_gid_t
+
+#include <bits/alltypes.h>
+
+int setfsuid(uid_t);
+int setfsgid(gid_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/inotify.h b/musl-include/aarch64/sys/inotify.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/inotify.h
@@ -0,0 +1,58 @@
+#ifndef _SYS_INOTIFY_H
+#define _SYS_INOTIFY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+struct inotify_event {
+	int wd;
+	uint32_t mask, cookie, len;
+	char name[];
+};
+
+#define IN_CLOEXEC O_CLOEXEC
+#define IN_NONBLOCK O_NONBLOCK
+
+#define IN_ACCESS        0x00000001
+#define IN_MODIFY        0x00000002
+#define IN_ATTRIB        0x00000004
+#define IN_CLOSE_WRITE   0x00000008
+#define IN_CLOSE_NOWRITE 0x00000010
+#define IN_CLOSE         (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
+#define IN_OPEN          0x00000020
+#define IN_MOVED_FROM    0x00000040
+#define IN_MOVED_TO      0x00000080
+#define IN_MOVE          (IN_MOVED_FROM | IN_MOVED_TO)
+#define IN_CREATE        0x00000100
+#define IN_DELETE        0x00000200
+#define IN_DELETE_SELF   0x00000400
+#define IN_MOVE_SELF     0x00000800
+#define IN_ALL_EVENTS    0x00000fff
+
+#define IN_UNMOUNT       0x00002000
+#define IN_Q_OVERFLOW    0x00004000
+#define IN_IGNORED       0x00008000
+
+#define IN_ONLYDIR       0x01000000
+#define IN_DONT_FOLLOW   0x02000000
+#define IN_EXCL_UNLINK   0x04000000
+#define IN_MASK_CREATE   0x10000000
+#define IN_MASK_ADD      0x20000000
+
+#define IN_ISDIR         0x40000000
+#define IN_ONESHOT       0x80000000
+
+int inotify_init(void);
+int inotify_init1(int);
+int inotify_add_watch(int, const char *, uint32_t);
+int inotify_rm_watch(int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/io.h b/musl-include/aarch64/sys/io.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/io.h
@@ -0,0 +1,17 @@
+#ifndef	_SYS_IO_H
+#define	_SYS_IO_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/io.h>
+
+int iopl(int);
+int ioperm(unsigned long, unsigned long, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/ioctl.h b/musl-include/aarch64/sys/ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/ioctl.h
@@ -0,0 +1,120 @@
+#ifndef	_SYS_IOCTL_H
+#define	_SYS_IOCTL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_struct_winsize
+
+#include <bits/alltypes.h>
+#include <bits/ioctl.h>
+
+#define N_TTY           0
+#define N_SLIP          1
+#define N_MOUSE         2
+#define N_PPP           3
+#define N_STRIP         4
+#define N_AX25          5
+#define N_X25           6
+#define N_6PACK         7
+#define N_MASC          8
+#define N_R3964         9
+#define N_PROFIBUS_FDL  10
+#define N_IRDA          11
+#define N_SMSBLOCK      12
+#define N_HDLC          13
+#define N_SYNC_PPP      14
+#define N_HCI           15
+#define N_GIGASET_M101  16
+#define N_SLCAN         17
+#define N_PPS           18
+#define N_V253          19
+#define N_CAIF          20
+#define N_GSM0710       21
+#define N_TI_WL         22
+#define N_TRACESINK     23
+#define N_TRACEROUTER   24
+#define N_NCI           25
+#define N_SPEAKUP       26
+#define N_NULL          27
+
+#define TIOCPKT_DATA       0
+#define TIOCPKT_FLUSHREAD  1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP       4
+#define TIOCPKT_START      8
+#define TIOCPKT_NOSTOP    16
+#define TIOCPKT_DOSTOP    32
+#define TIOCPKT_IOCTL     64
+
+#define TIOCSER_TEMT 1
+
+#define SIOCADDRT          0x890B
+#define SIOCDELRT          0x890C
+#define SIOCRTMSG          0x890D
+
+#define SIOCGIFNAME        0x8910
+#define SIOCSIFLINK        0x8911
+#define SIOCGIFCONF        0x8912
+#define SIOCGIFFLAGS       0x8913
+#define SIOCSIFFLAGS       0x8914
+#define SIOCGIFADDR        0x8915
+#define SIOCSIFADDR        0x8916
+#define SIOCGIFDSTADDR     0x8917
+#define SIOCSIFDSTADDR     0x8918
+#define SIOCGIFBRDADDR     0x8919
+#define SIOCSIFBRDADDR     0x891a
+#define SIOCGIFNETMASK     0x891b
+#define SIOCSIFNETMASK     0x891c
+#define SIOCGIFMETRIC      0x891d
+#define SIOCSIFMETRIC      0x891e
+#define SIOCGIFMEM         0x891f
+#define SIOCSIFMEM         0x8920
+#define SIOCGIFMTU         0x8921
+#define SIOCSIFMTU         0x8922
+#define SIOCSIFNAME        0x8923
+#define SIOCSIFHWADDR      0x8924
+#define SIOCGIFENCAP       0x8925
+#define SIOCSIFENCAP       0x8926
+#define SIOCGIFHWADDR      0x8927
+#define SIOCGIFSLAVE       0x8929
+#define SIOCSIFSLAVE       0x8930
+#define SIOCADDMULTI       0x8931
+#define SIOCDELMULTI       0x8932
+#define SIOCGIFINDEX       0x8933
+#define SIOGIFINDEX        SIOCGIFINDEX
+#define SIOCSIFPFLAGS      0x8934
+#define SIOCGIFPFLAGS      0x8935
+#define SIOCDIFADDR        0x8936
+#define SIOCSIFHWBROADCAST 0x8937
+#define SIOCGIFCOUNT       0x8938
+
+#define SIOCGIFBR          0x8940
+#define SIOCSIFBR          0x8941
+
+#define SIOCGIFTXQLEN      0x8942
+#define SIOCSIFTXQLEN      0x8943
+
+#define SIOCDARP           0x8953
+#define SIOCGARP           0x8954
+#define SIOCSARP           0x8955
+
+#define SIOCDRARP          0x8960
+#define SIOCGRARP          0x8961
+#define SIOCSRARP          0x8962
+
+#define SIOCGIFMAP         0x8970
+#define SIOCSIFMAP         0x8971
+
+#define SIOCADDDLCI        0x8980
+#define SIOCDELDLCI        0x8981
+
+#define SIOCDEVPRIVATE     0x89F0
+#define SIOCPROTOPRIVATE   0x89E0
+
+int ioctl (int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/ipc.h b/musl-include/aarch64/sys/ipc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/ipc.h
@@ -0,0 +1,42 @@
+#ifndef _SYS_IPC_H
+#define _SYS_IPC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_key_t
+
+#include <bits/alltypes.h>
+
+#define __ipc_perm_key __key
+#define __ipc_perm_seq __seq
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __key key
+#define __seq seq
+#endif
+
+#include <bits/ipc.h>
+#include <bits/ipcstat.h>
+
+#define IPC_CREAT  01000
+#define IPC_EXCL   02000
+#define IPC_NOWAIT 04000
+
+#define IPC_RMID 0
+#define IPC_SET  1
+#define IPC_INFO 3
+
+#define IPC_PRIVATE ((key_t) 0)
+
+key_t ftok (const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/kd.h b/musl-include/aarch64/sys/kd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/kd.h
@@ -0,0 +1,1 @@
+#include <bits/kd.h>
diff --git a/musl-include/aarch64/sys/klog.h b/musl-include/aarch64/sys/klog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/klog.h
@@ -0,0 +1,14 @@
+#ifndef	_SYS_KLOG_H
+#define	_SYS_KLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int klogctl (int, char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/membarrier.h b/musl-include/aarch64/sys/membarrier.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/membarrier.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_MEMBARRIER_H
+#define _SYS_MEMBARRIER_H
+
+#define MEMBARRIER_CMD_QUERY 0
+#define MEMBARRIER_CMD_GLOBAL 1
+#define MEMBARRIER_CMD_GLOBAL_EXPEDITED 2
+#define MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED 4
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED 8
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 32
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 64
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ 128
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ 256
+
+#define MEMBARRIER_CMD_SHARED MEMBARRIER_CMD_GLOBAL
+
+#define MEMBARRIER_CMD_FLAG_CPU 1
+
+int membarrier(int, int);
+
+#endif
diff --git a/musl-include/aarch64/sys/mman.h b/musl-include/aarch64/sys/mman.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/mman.h
@@ -0,0 +1,152 @@
+#ifndef	_SYS_MMAN_H
+#define	_SYS_MMAN_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_mode_t
+#define __NEED_size_t
+#define __NEED_off_t
+
+#if defined(_GNU_SOURCE)
+#define __NEED_ssize_t
+#endif
+
+#include <bits/alltypes.h>
+
+#define MAP_FAILED ((void *) -1)
+
+#define MAP_SHARED     0x01
+#define MAP_PRIVATE    0x02
+#define MAP_SHARED_VALIDATE 0x03
+#define MAP_TYPE       0x0f
+#define MAP_FIXED      0x10
+#define MAP_ANON       0x20
+#define MAP_ANONYMOUS  MAP_ANON
+#define MAP_NORESERVE  0x4000
+#define MAP_GROWSDOWN  0x0100
+#define MAP_DENYWRITE  0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_LOCKED     0x2000
+#define MAP_POPULATE   0x8000
+#define MAP_NONBLOCK   0x10000
+#define MAP_STACK      0x20000
+#define MAP_HUGETLB    0x40000
+#define MAP_SYNC       0x80000
+#define MAP_FIXED_NOREPLACE 0x100000
+#define MAP_FILE       0
+
+#define MAP_HUGE_SHIFT 26
+#define MAP_HUGE_MASK  0x3f
+#define MAP_HUGE_16KB  (14 << 26)
+#define MAP_HUGE_64KB  (16 << 26)
+#define MAP_HUGE_512KB (19 << 26)
+#define MAP_HUGE_1MB   (20 << 26)
+#define MAP_HUGE_2MB   (21 << 26)
+#define MAP_HUGE_8MB   (23 << 26)
+#define MAP_HUGE_16MB  (24 << 26)
+#define MAP_HUGE_32MB  (25 << 26)
+#define MAP_HUGE_256MB (28 << 26)
+#define MAP_HUGE_512MB (29 << 26)
+#define MAP_HUGE_1GB   (30 << 26)
+#define MAP_HUGE_2GB   (31 << 26)
+#define MAP_HUGE_16GB  (34U << 26)
+
+#define PROT_NONE      0
+#define PROT_READ      1
+#define PROT_WRITE     2
+#define PROT_EXEC      4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP   0x02000000
+
+#define MS_ASYNC       1
+#define MS_INVALIDATE  2
+#define MS_SYNC        4
+
+#define MCL_CURRENT    1
+#define MCL_FUTURE     2
+#define MCL_ONFAULT    4
+
+#define POSIX_MADV_NORMAL     0
+#define POSIX_MADV_RANDOM     1
+#define POSIX_MADV_SEQUENTIAL 2
+#define POSIX_MADV_WILLNEED   3
+#define POSIX_MADV_DONTNEED   4
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MADV_NORMAL      0
+#define MADV_RANDOM      1
+#define MADV_SEQUENTIAL  2
+#define MADV_WILLNEED    3
+#define MADV_DONTNEED    4
+#define MADV_FREE        8
+#define MADV_REMOVE      9
+#define MADV_DONTFORK    10
+#define MADV_DOFORK      11
+#define MADV_MERGEABLE   12
+#define MADV_UNMERGEABLE 13
+#define MADV_HUGEPAGE    14
+#define MADV_NOHUGEPAGE  15
+#define MADV_DONTDUMP    16
+#define MADV_DODUMP      17
+#define MADV_WIPEONFORK  18
+#define MADV_KEEPONFORK  19
+#define MADV_COLD        20
+#define MADV_PAGEOUT     21
+#define MADV_HWPOISON    100
+#define MADV_SOFT_OFFLINE 101
+#endif
+
+#ifdef _GNU_SOURCE
+#define MREMAP_MAYMOVE 1
+#define MREMAP_FIXED 2
+#define MREMAP_DONTUNMAP 4
+
+#define MLOCK_ONFAULT 0x01
+
+#define MFD_CLOEXEC 0x0001U
+#define MFD_ALLOW_SEALING 0x0002U
+#define MFD_HUGETLB 0x0004U
+#endif
+
+#include <bits/mman.h>
+
+void *mmap (void *, size_t, int, int, int, off_t);
+int munmap (void *, size_t);
+
+int mprotect (void *, size_t, int);
+int msync (void *, size_t, int);
+
+int posix_madvise (void *, size_t, int);
+
+int mlock (const void *, size_t);
+int munlock (const void *, size_t);
+int mlockall (int);
+int munlockall (void);
+
+#ifdef _GNU_SOURCE
+void *mremap (void *, size_t, size_t, int, ...);
+int remap_file_pages (void *, size_t, int, size_t, int);
+int memfd_create (const char *, unsigned);
+int mlock2 (const void *, size_t, unsigned);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int madvise (void *, size_t, int);
+int mincore (void *, size_t, unsigned char *);
+#endif
+
+int shm_open (const char *, int, mode_t);
+int shm_unlink (const char *);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define mmap64 mmap
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/mount.h b/musl-include/aarch64/sys/mount.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/mount.h
@@ -0,0 +1,75 @@
+#ifndef _SYS_MOUNT_H
+#define _SYS_MOUNT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ioctl.h>
+
+#define BLKROSET   _IO(0x12, 93)
+#define BLKROGET   _IO(0x12, 94)
+#define BLKRRPART  _IO(0x12, 95)
+#define BLKGETSIZE _IO(0x12, 96)
+#define BLKFLSBUF  _IO(0x12, 97)
+#define BLKRASET   _IO(0x12, 98)
+#define BLKRAGET   _IO(0x12, 99)
+#define BLKFRASET  _IO(0x12,100)
+#define BLKFRAGET  _IO(0x12,101)
+#define BLKSECTSET _IO(0x12,102)
+#define BLKSECTGET _IO(0x12,103)
+#define BLKSSZGET  _IO(0x12,104)
+#define BLKBSZGET  _IOR(0x12,112,size_t)
+#define BLKBSZSET  _IOW(0x12,113,size_t)
+#define BLKGETSIZE64 _IOR(0x12,114,size_t)
+
+#define MS_RDONLY      1
+#define MS_NOSUID      2
+#define MS_NODEV       4
+#define MS_NOEXEC      8
+#define MS_SYNCHRONOUS 16
+#define MS_REMOUNT     32
+#define MS_MANDLOCK    64
+#define MS_DIRSYNC     128
+#define MS_NOSYMFOLLOW 256
+#define MS_NOATIME     1024
+#define MS_NODIRATIME  2048
+#define MS_BIND        4096
+#define MS_MOVE        8192
+#define MS_REC         16384
+#define MS_SILENT      32768
+#define MS_POSIXACL    (1<<16)
+#define MS_UNBINDABLE  (1<<17)
+#define MS_PRIVATE     (1<<18)
+#define MS_SLAVE       (1<<19)
+#define MS_SHARED      (1<<20)
+#define MS_RELATIME    (1<<21)
+#define MS_KERNMOUNT   (1<<22)
+#define MS_I_VERSION   (1<<23)
+#define MS_STRICTATIME (1<<24)
+#define MS_LAZYTIME    (1<<25)
+#define MS_NOREMOTELOCK (1<<27)
+#define MS_NOSEC       (1<<28)
+#define MS_BORN        (1<<29)
+#define MS_ACTIVE      (1<<30)
+#define MS_NOUSER      (1U<<31)
+
+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
+
+#define MS_MGC_VAL 0xc0ed0000
+#define MS_MGC_MSK 0xffff0000
+
+#define MNT_FORCE       1
+#define MNT_DETACH      2
+#define MNT_EXPIRE      4
+#define UMOUNT_NOFOLLOW 8
+
+int mount(const char *, const char *, const char *, unsigned long, const void *);
+int umount(const char *);
+int umount2(const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/msg.h b/musl-include/aarch64/sys/msg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/msg.h
@@ -0,0 +1,53 @@
+#ifndef _SYS_MSG_H
+#define _SYS_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ipc.h>
+
+#define __NEED_pid_t
+#define __NEED_key_t
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+
+#include <bits/alltypes.h>
+
+typedef unsigned long msgqnum_t;
+typedef unsigned long msglen_t;
+
+#include <bits/msg.h>
+
+#define __msg_cbytes msg_cbytes
+
+#define MSG_NOERROR 010000
+#define MSG_EXCEPT  020000
+
+#define MSG_STAT (11 | (IPC_STAT & 0x100))
+#define MSG_INFO 12
+#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100))
+
+struct msginfo {
+	int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;
+	unsigned short msgseg;
+};
+
+int msgctl (int, int, struct msqid_ds *);
+int msgget (key_t, int);
+ssize_t msgrcv (int, void *, size_t, long, int);
+int msgsnd (int, const void *, size_t, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct msgbuf {
+	long mtype;
+	char mtext[1];
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/mtio.h b/musl-include/aarch64/sys/mtio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/mtio.h
@@ -0,0 +1,188 @@
+#ifndef _SYS_MTIO_H
+#define _SYS_MTIO_H
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+struct mtop {
+	short mt_op;
+	int mt_count;
+};
+
+#define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0)
+#define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0)
+#define _IOT_mtpos _IOT_SIMPLE (long)
+#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1)
+
+
+#define MTRESET 0
+#define MTFSF	1
+#define MTBSF	2
+#define MTFSR	3
+#define MTBSR	4
+#define MTWEOF	5
+#define MTREW	6
+#define MTOFFL	7
+#define MTNOP	8
+#define MTRETEN 9
+#define MTBSFM	10
+#define MTFSFM  11
+#define MTEOM	12
+#define MTERASE 13
+#define MTRAS1  14
+#define MTRAS2	15
+#define MTRAS3  16
+#define MTSETBLK 20
+#define MTSETDENSITY 21
+#define MTSEEK	22
+#define MTTELL	23
+#define MTSETDRVBUFFER 24
+#define MTFSS	25
+#define MTBSS	26
+#define MTWSM	27
+#define MTLOCK  28
+#define MTUNLOCK 29
+#define MTLOAD  30
+#define MTUNLOAD 31
+#define MTCOMPRESSION 32
+#define MTSETPART 33
+#define MTMKPART  34
+
+struct mtget {
+	long mt_type;
+	long mt_resid;
+	long mt_dsreg;
+	long mt_gstat;
+	long mt_erreg;
+	int mt_fileno;
+	int mt_blkno;
+};
+
+#define MT_ISUNKNOWN		0x01
+#define MT_ISQIC02		0x02
+#define MT_ISWT5150		0x03
+#define MT_ISARCHIVE_5945L2	0x04
+#define MT_ISCMSJ500		0x05
+#define MT_ISTDC3610		0x06
+#define MT_ISARCHIVE_VP60I	0x07
+#define MT_ISARCHIVE_2150L	0x08
+#define MT_ISARCHIVE_2060L	0x09
+#define MT_ISARCHIVESC499	0x0A
+#define MT_ISQIC02_ALL_FEATURES	0x0F
+#define MT_ISWT5099EEN24	0x11
+#define MT_ISTEAC_MT2ST		0x12
+#define MT_ISEVEREX_FT40A	0x32
+#define MT_ISDDS1		0x51
+#define MT_ISDDS2		0x52
+#define MT_ISSCSI1		0x71
+#define MT_ISSCSI2		0x72
+#define MT_ISFTAPE_UNKNOWN	0x800000
+#define MT_ISFTAPE_FLAG		0x800000
+
+struct mt_tape_info {
+	long t_type;
+	char *t_name;
+};
+
+#define MT_TAPE_INFO \
+{									      \
+	{MT_ISUNKNOWN,		"Unknown type of tape device"},		      \
+	{MT_ISQIC02,		"Generic QIC-02 tape streamer"},	      \
+	{MT_ISWT5150,		"Wangtek 5150, QIC-150"},		      \
+	{MT_ISARCHIVE_5945L2,	"Archive 5945L-2"},			      \
+	{MT_ISCMSJ500,		"CMS Jumbo 500"},			      \
+	{MT_ISTDC3610,		"Tandberg TDC 3610, QIC-24"},		      \
+	{MT_ISARCHIVE_VP60I,	"Archive VP60i, QIC-02"},		      \
+	{MT_ISARCHIVE_2150L,	"Archive Viper 2150L"},			      \
+	{MT_ISARCHIVE_2060L,	"Archive Viper 2060L"},			      \
+	{MT_ISARCHIVESC499,	"Archive SC-499 QIC-36 controller"},	      \
+	{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"},	      \
+	{MT_ISWT5099EEN24,	"Wangtek 5099-een24, 60MB"},		      \
+	{MT_ISTEAC_MT2ST,	"Teac MT-2ST 155mb data cassette drive"},     \
+	{MT_ISEVEREX_FT40A,	"Everex FT40A, QIC-40"},		      \
+	{MT_ISSCSI1,		"Generic SCSI-1 tape"},			      \
+	{MT_ISSCSI2,		"Generic SCSI-2 tape"},			      \
+	{0, 0}								      \
+}
+
+struct mtpos {
+	long mt_blkno;
+};
+
+struct mtconfiginfo  {
+	long mt_type;
+	long ifc_type;
+	unsigned short irqnr;
+	unsigned short dmanr;
+	unsigned short port;
+	unsigned long debug;
+	unsigned have_dens:1;
+	unsigned have_bsf:1;
+	unsigned have_fsr:1;
+	unsigned have_bsr:1;
+	unsigned have_eod:1;
+	unsigned have_seek:1;
+	unsigned have_tell:1;
+	unsigned have_ras1:1;
+	unsigned have_ras2:1;
+	unsigned have_ras3:1;
+	unsigned have_qfa:1;
+	unsigned pad1:5;
+	char reserved[10];
+};
+
+#define	MTIOCTOP _IOW('m', 1, struct mtop)
+#define	MTIOCGET _IOR('m', 2, struct mtget)
+#define	MTIOCPOS _IOR('m', 3, struct mtpos)
+
+#define	MTIOCGETCONFIG	_IOR('m', 4, struct mtconfiginfo)
+#define	MTIOCSETCONFIG	_IOW('m', 5, struct mtconfiginfo)
+
+#define GMT_EOF(x)              ((x) & 0x80000000)
+#define GMT_BOT(x)              ((x) & 0x40000000)
+#define GMT_EOT(x)              ((x) & 0x20000000)
+#define GMT_SM(x)               ((x) & 0x10000000)
+#define GMT_EOD(x)              ((x) & 0x08000000)
+#define GMT_WR_PROT(x)          ((x) & 0x04000000)
+#define GMT_ONLINE(x)           ((x) & 0x01000000)
+#define GMT_D_6250(x)           ((x) & 0x00800000)
+#define GMT_D_1600(x)           ((x) & 0x00400000)
+#define GMT_D_800(x)            ((x) & 0x00200000)
+#define GMT_DR_OPEN(x)          ((x) & 0x00040000)
+#define GMT_IM_REP_EN(x)        ((x) & 0x00010000)
+
+#define MT_ST_BLKSIZE_SHIFT	0
+#define MT_ST_BLKSIZE_MASK	0xffffff
+#define MT_ST_DENSITY_SHIFT	24
+#define MT_ST_DENSITY_MASK	0xff000000
+#define MT_ST_SOFTERR_SHIFT	0
+#define MT_ST_SOFTERR_MASK	0xffff
+#define MT_ST_OPTIONS		0xf0000000
+#define MT_ST_BOOLEANS		0x10000000
+#define MT_ST_SETBOOLEANS	0x30000000
+#define MT_ST_CLEARBOOLEANS	0x40000000
+#define MT_ST_WRITE_THRESHOLD	0x20000000
+#define MT_ST_DEF_BLKSIZE	0x50000000
+#define MT_ST_DEF_OPTIONS	0x60000000
+#define MT_ST_BUFFER_WRITES	0x1
+#define MT_ST_ASYNC_WRITES	0x2
+#define MT_ST_READ_AHEAD	0x4
+#define MT_ST_DEBUGGING		0x8
+#define MT_ST_TWO_FM		0x10
+#define MT_ST_FAST_MTEOM	0x20
+#define MT_ST_AUTO_LOCK		0x40
+#define MT_ST_DEF_WRITES	0x80
+#define MT_ST_CAN_BSR		0x100
+#define MT_ST_NO_BLKLIMS	0x200
+#define MT_ST_CAN_PARTITIONS    0x400
+#define MT_ST_SCSI2LOGICAL      0x800
+#define MT_ST_CLEAR_DEFAULT	0xfffff
+#define MT_ST_DEF_DENSITY	(MT_ST_DEF_OPTIONS | 0x100000)
+#define MT_ST_DEF_COMPRESSION	(MT_ST_DEF_OPTIONS | 0x200000)
+#define MT_ST_DEF_DRVBUFFER	(MT_ST_DEF_OPTIONS | 0x300000)
+#define MT_ST_HPLOADER_OFFSET 10000
+#ifndef DEFTAPE
+# define DEFTAPE	"/dev/tape"
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/param.h b/musl-include/aarch64/sys/param.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/param.h
@@ -0,0 +1,35 @@
+#ifndef _SYS_PARAM_H
+#define _SYS_PARAM_H
+
+#define MAXSYMLINKS 20
+#define MAXHOSTNAMELEN 64
+#define MAXNAMLEN 255
+#define MAXPATHLEN 4096
+#define NBBY 8
+#define NGROUPS 32
+#define CANBSIZ 255
+#define NOFILE 256
+#define NCARGS 131072
+#define DEV_BSIZE 512
+#define NOGROUP (-1)
+
+#undef MIN
+#undef MAX
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
+#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8))
+#define setbit(x,i) __bitop(x,i,|=)
+#define clrbit(x,i) __bitop(x,i,&=~)
+#define isset(x,i) __bitop(x,i,&)
+#define isclr(x,i) !isset(x,i)
+
+#define howmany(n,d) (((n)+((d)-1))/(d))
+#define roundup(n,d) (howmany(n,d)*(d))
+#define powerof2(n) !(((n)-1) & (n))
+
+#include <sys/resource.h>
+#include <endian.h>
+#include <limits.h>
+
+#endif
diff --git a/musl-include/aarch64/sys/personality.h b/musl-include/aarch64/sys/personality.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/personality.h
@@ -0,0 +1,49 @@
+#ifndef _PERSONALITY_H
+#define _PERSONALITY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UNAME26            0x0020000
+#define ADDR_NO_RANDOMIZE  0x0040000
+#define FDPIC_FUNCPTRS     0x0080000
+#define MMAP_PAGE_ZERO     0x0100000
+#define ADDR_COMPAT_LAYOUT 0x0200000
+#define READ_IMPLIES_EXEC  0x0400000
+#define ADDR_LIMIT_32BIT   0x0800000
+#define SHORT_INODE        0x1000000
+#define WHOLE_SECONDS      0x2000000
+#define STICKY_TIMEOUTS    0x4000000
+#define ADDR_LIMIT_3GB     0x8000000
+
+#define PER_LINUX 0
+#define PER_LINUX_32BIT ADDR_LIMIT_32BIT
+#define PER_LINUX_FDPIC FDPIC_FUNCPTRS
+#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE)
+#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS)
+#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_ISCR4 (5 | STICKY_TIMEOUTS)
+#define PER_BSD 6
+#define PER_SUNOS (6 | STICKY_TIMEOUTS)
+#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_LINUX32 8
+#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB)
+#define PER_IRIX32 (9 | STICKY_TIMEOUTS)
+#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS)
+#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS)
+#define PER_RISCOS 0xc
+#define PER_SOLARIS (0xd | STICKY_TIMEOUTS)
+#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_OSF4 0xf
+#define PER_HPUX 0x10
+#define PER_MASK 0xff
+
+int personality(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/poll.h b/musl-include/aarch64/sys/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/poll.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
+#include <poll.h>
diff --git a/musl-include/aarch64/sys/prctl.h b/musl-include/aarch64/sys/prctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/prctl.h
@@ -0,0 +1,186 @@
+#ifndef _SYS_PRCTL_H
+#define _SYS_PRCTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define PR_SET_PDEATHSIG  1
+#define PR_GET_PDEATHSIG  2
+#define PR_GET_DUMPABLE   3
+#define PR_SET_DUMPABLE   4
+#define PR_GET_UNALIGN   5
+#define PR_SET_UNALIGN   6
+#define PR_UNALIGN_NOPRINT 1
+#define PR_UNALIGN_SIGBUS 2
+#define PR_GET_KEEPCAPS   7
+#define PR_SET_KEEPCAPS   8
+#define PR_GET_FPEMU  9
+#define PR_SET_FPEMU 10
+#define PR_FPEMU_NOPRINT 1
+#define PR_FPEMU_SIGFPE 2
+#define PR_GET_FPEXC 11
+#define PR_SET_FPEXC 12
+#define PR_FP_EXC_SW_ENABLE 0x80
+#define PR_FP_EXC_DIV  0x010000
+#define PR_FP_EXC_OVF  0x020000
+#define PR_FP_EXC_UND  0x040000
+#define PR_FP_EXC_RES  0x080000
+#define PR_FP_EXC_INV  0x100000
+#define PR_FP_EXC_DISABLED 0
+#define PR_FP_EXC_NONRECOV 1
+#define PR_FP_EXC_ASYNC 2
+#define PR_FP_EXC_PRECISE 3
+#define PR_GET_TIMING   13
+#define PR_SET_TIMING   14
+#define PR_TIMING_STATISTICAL  0
+#define PR_TIMING_TIMESTAMP    1
+#define PR_SET_NAME    15
+#define PR_GET_NAME    16
+#define PR_GET_ENDIAN 19
+#define PR_SET_ENDIAN 20
+#define PR_ENDIAN_BIG 0
+#define PR_ENDIAN_LITTLE 1
+#define PR_ENDIAN_PPC_LITTLE 2
+#define PR_GET_SECCOMP 21
+#define PR_SET_SECCOMP 22
+#define PR_CAPBSET_READ 23
+#define PR_CAPBSET_DROP 24
+#define PR_GET_TSC 25
+#define PR_SET_TSC 26
+#define PR_TSC_ENABLE 1
+#define PR_TSC_SIGSEGV 2
+#define PR_GET_SECUREBITS 27
+#define PR_SET_SECUREBITS 28
+#define PR_SET_TIMERSLACK 29
+#define PR_GET_TIMERSLACK 30
+
+#define PR_TASK_PERF_EVENTS_DISABLE             31
+#define PR_TASK_PERF_EVENTS_ENABLE              32
+
+#define PR_MCE_KILL     33
+#define PR_MCE_KILL_CLEAR   0
+#define PR_MCE_KILL_SET     1
+#define PR_MCE_KILL_LATE    0
+#define PR_MCE_KILL_EARLY   1
+#define PR_MCE_KILL_DEFAULT 2
+#define PR_MCE_KILL_GET 34
+
+#define PR_SET_MM               35
+#define PR_SET_MM_START_CODE           1
+#define PR_SET_MM_END_CODE             2
+#define PR_SET_MM_START_DATA           3
+#define PR_SET_MM_END_DATA             4
+#define PR_SET_MM_START_STACK          5
+#define PR_SET_MM_START_BRK            6
+#define PR_SET_MM_BRK                  7
+#define PR_SET_MM_ARG_START            8
+#define PR_SET_MM_ARG_END              9
+#define PR_SET_MM_ENV_START            10
+#define PR_SET_MM_ENV_END              11
+#define PR_SET_MM_AUXV                 12
+#define PR_SET_MM_EXE_FILE             13
+#define PR_SET_MM_MAP                  14
+#define PR_SET_MM_MAP_SIZE             15
+
+struct prctl_mm_map {
+	uint64_t start_code;
+	uint64_t end_code;
+	uint64_t start_data;
+	uint64_t end_data;
+	uint64_t start_brk;
+	uint64_t brk;
+	uint64_t start_stack;
+	uint64_t arg_start;
+	uint64_t arg_end;
+	uint64_t env_start;
+	uint64_t env_end;
+	uint64_t *auxv;
+	uint32_t auxv_size;
+	uint32_t exe_fd;
+};
+
+#define PR_SET_PTRACER 0x59616d61
+#define PR_SET_PTRACER_ANY (-1UL)
+
+#define PR_SET_CHILD_SUBREAPER  36
+#define PR_GET_CHILD_SUBREAPER  37
+
+#define PR_SET_NO_NEW_PRIVS     38
+#define PR_GET_NO_NEW_PRIVS     39
+
+#define PR_GET_TID_ADDRESS      40
+
+#define PR_SET_THP_DISABLE      41
+#define PR_GET_THP_DISABLE      42
+
+#define PR_MPX_ENABLE_MANAGEMENT  43
+#define PR_MPX_DISABLE_MANAGEMENT 44
+
+#define PR_SET_FP_MODE          45
+#define PR_GET_FP_MODE          46
+#define PR_FP_MODE_FR (1 << 0)
+#define PR_FP_MODE_FRE (1 << 1)
+
+#define PR_CAP_AMBIENT          47
+#define PR_CAP_AMBIENT_IS_SET   1
+#define PR_CAP_AMBIENT_RAISE    2
+#define PR_CAP_AMBIENT_LOWER    3
+#define PR_CAP_AMBIENT_CLEAR_ALL 4
+
+#define PR_SVE_SET_VL           50
+#define PR_SVE_SET_VL_ONEXEC (1 << 18)
+#define PR_SVE_GET_VL           51
+#define PR_SVE_VL_LEN_MASK 0xffff
+#define PR_SVE_VL_INHERIT (1 << 17)
+
+#define PR_GET_SPECULATION_CTRL 52
+#define PR_SET_SPECULATION_CTRL 53
+#define PR_SPEC_STORE_BYPASS 0
+#define PR_SPEC_INDIRECT_BRANCH 1
+#define PR_SPEC_NOT_AFFECTED 0
+#define PR_SPEC_PRCTL (1UL << 0)
+#define PR_SPEC_ENABLE (1UL << 1)
+#define PR_SPEC_DISABLE (1UL << 2)
+#define PR_SPEC_FORCE_DISABLE (1UL << 3)
+#define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
+
+#define PR_PAC_RESET_KEYS       54
+#define PR_PAC_APIAKEY (1UL << 0)
+#define PR_PAC_APIBKEY (1UL << 1)
+#define PR_PAC_APDAKEY (1UL << 2)
+#define PR_PAC_APDBKEY (1UL << 3)
+#define PR_PAC_APGAKEY (1UL << 4)
+
+#define PR_SET_TAGGED_ADDR_CTRL 55
+#define PR_GET_TAGGED_ADDR_CTRL 56
+#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
+#define PR_MTE_TCF_SHIFT 1
+#define PR_MTE_TCF_NONE  (0UL << 1)
+#define PR_MTE_TCF_SYNC  (1UL << 1)
+#define PR_MTE_TCF_ASYNC (2UL << 1)
+#define PR_MTE_TCF_MASK  (3UL << 1)
+#define PR_MTE_TAG_SHIFT 3
+#define PR_MTE_TAG_MASK  (0xffffUL << 3)
+
+#define PR_SET_IO_FLUSHER 57
+#define PR_GET_IO_FLUSHER 58
+
+#define PR_SET_SYSCALL_USER_DISPATCH 59
+#define PR_SYS_DISPATCH_OFF 0
+#define PR_SYS_DISPATCH_ON 1
+#define SYSCALL_DISPATCH_FILTER_ALLOW 0
+#define SYSCALL_DISPATCH_FILTER_BLOCK 1
+
+#define PR_PAC_SET_ENABLED_KEYS 60
+#define PR_PAC_GET_ENABLED_KEYS 61
+
+int prctl (int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/procfs.h b/musl-include/aarch64/sys/procfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/procfs.h
@@ -0,0 +1,63 @@
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+struct elf_siginfo {
+	int si_signo;
+	int si_code;
+	int si_errno;
+};
+
+struct elf_prstatus {
+	struct elf_siginfo pr_info;
+	short int pr_cursig;
+	unsigned long int pr_sigpend;
+	unsigned long int pr_sighold;
+	pid_t pr_pid;
+	pid_t pr_ppid;
+	pid_t pr_pgrp;
+	pid_t pr_sid;
+	struct {
+		long tv_sec, tv_usec;
+	} pr_utime, pr_stime, pr_cutime, pr_cstime;
+	elf_gregset_t pr_reg;
+	int pr_fpvalid;
+};
+
+#define ELF_PRARGSZ 80
+
+struct elf_prpsinfo {
+	char pr_state;
+	char pr_sname;
+	char pr_zomb;
+	char pr_nice;
+	unsigned long int pr_flag;
+#if UINTPTR_MAX == 0xffffffff
+	unsigned short int pr_uid;
+	unsigned short int pr_gid;
+#else
+	unsigned int pr_uid;
+	unsigned int pr_gid;
+#endif
+	int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+	char pr_fname[16];
+	char pr_psargs[ELF_PRARGSZ];
+};
+
+typedef void *psaddr_t;
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+typedef pid_t lwpid_t;
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/ptrace.h b/musl-include/aarch64/sys/ptrace.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/ptrace.h
@@ -0,0 +1,147 @@
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define PTRACE_TRACEME 0
+#define PT_TRACE_ME PTRACE_TRACEME
+
+#define PTRACE_PEEKTEXT 1
+#define PTRACE_PEEKDATA 2
+#define PTRACE_PEEKUSER 3
+#define PTRACE_POKETEXT 4
+#define PTRACE_POKEDATA 5
+#define PTRACE_POKEUSER 6
+#define PTRACE_CONT 7
+#define PTRACE_KILL 8
+#define PTRACE_SINGLESTEP 9
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+#define PTRACE_ATTACH 16
+#define PTRACE_DETACH 17
+#define PTRACE_GETFPXREGS 18
+#define PTRACE_SETFPXREGS 19
+#define PTRACE_SYSCALL 24
+#define PTRACE_SETOPTIONS 0x4200
+#define PTRACE_GETEVENTMSG 0x4201
+#define PTRACE_GETSIGINFO 0x4202
+#define PTRACE_SETSIGINFO 0x4203
+#define PTRACE_GETREGSET 0x4204
+#define PTRACE_SETREGSET 0x4205
+#define PTRACE_SEIZE 0x4206
+#define PTRACE_INTERRUPT 0x4207
+#define PTRACE_LISTEN 0x4208
+#define PTRACE_PEEKSIGINFO 0x4209
+#define PTRACE_GETSIGMASK 0x420a
+#define PTRACE_SETSIGMASK 0x420b
+#define PTRACE_SECCOMP_GET_FILTER 0x420c
+#define PTRACE_SECCOMP_GET_METADATA 0x420d
+#define PTRACE_GET_SYSCALL_INFO 0x420e
+#define PTRACE_GET_RSEQ_CONFIGURATION	0x420f
+
+#define PT_READ_I PTRACE_PEEKTEXT
+#define PT_READ_D PTRACE_PEEKDATA
+#define PT_READ_U PTRACE_PEEKUSER
+#define PT_WRITE_I PTRACE_POKETEXT
+#define PT_WRITE_D PTRACE_POKEDATA
+#define PT_WRITE_U PTRACE_POKEUSER
+#define PT_CONTINUE PTRACE_CONT
+#define PT_KILL PTRACE_KILL
+#define PT_STEP PTRACE_SINGLESTEP
+#define PT_GETREGS PTRACE_GETREGS
+#define PT_SETREGS PTRACE_SETREGS
+#define PT_GETFPREGS PTRACE_GETFPREGS
+#define PT_SETFPREGS PTRACE_SETFPREGS
+#define PT_ATTACH PTRACE_ATTACH
+#define PT_DETACH PTRACE_DETACH
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+#define PT_SYSCALL PTRACE_SYSCALL
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+
+#define PTRACE_O_TRACESYSGOOD   0x00000001
+#define PTRACE_O_TRACEFORK      0x00000002
+#define PTRACE_O_TRACEVFORK     0x00000004
+#define PTRACE_O_TRACECLONE     0x00000008
+#define PTRACE_O_TRACEEXEC      0x00000010
+#define PTRACE_O_TRACEVFORKDONE 0x00000020
+#define PTRACE_O_TRACEEXIT      0x00000040
+#define PTRACE_O_TRACESECCOMP   0x00000080
+#define PTRACE_O_EXITKILL       0x00100000
+#define PTRACE_O_SUSPEND_SECCOMP 0x00200000
+#define PTRACE_O_MASK           0x003000ff
+
+#define PTRACE_EVENT_FORK 1
+#define PTRACE_EVENT_VFORK 2
+#define PTRACE_EVENT_CLONE 3
+#define PTRACE_EVENT_EXEC 4
+#define PTRACE_EVENT_VFORK_DONE 5
+#define PTRACE_EVENT_EXIT 6
+#define PTRACE_EVENT_SECCOMP 7
+#define PTRACE_EVENT_STOP 128
+
+#define PTRACE_PEEKSIGINFO_SHARED 1
+
+#define PTRACE_SYSCALL_INFO_NONE 0
+#define PTRACE_SYSCALL_INFO_ENTRY 1
+#define PTRACE_SYSCALL_INFO_EXIT 2
+#define PTRACE_SYSCALL_INFO_SECCOMP 3
+
+#include <bits/ptrace.h>
+
+struct __ptrace_peeksiginfo_args {
+	uint64_t off;
+	uint32_t flags;
+	int32_t nr;
+};
+
+struct __ptrace_seccomp_metadata {
+	uint64_t filter_off;
+	uint64_t flags;
+};
+
+struct __ptrace_syscall_info {
+	uint8_t op;
+	uint8_t __pad[3];
+	uint32_t arch;
+	uint64_t instruction_pointer;
+	uint64_t stack_pointer;
+	union {
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+		} entry;
+		struct {
+			int64_t rval;
+			uint8_t is_error;
+		} exit;
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+			uint32_t ret_data;
+		} seccomp;
+	};
+};
+
+struct __ptrace_rseq_configuration {
+	uint64_t rseq_abi_pointer;
+	uint32_t rseq_abi_size;
+	uint32_t signature;
+	uint32_t flags;
+	uint32_t pad;
+};
+
+long ptrace(int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/quota.h b/musl-include/aarch64/sys/quota.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/quota.h
@@ -0,0 +1,102 @@
+#ifndef _SYS_QUOTA_H
+#define _SYS_QUOTA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define _LINUX_QUOTA_VERSION 2
+
+#define dbtob(num) ((num) << 10)
+#define btodb(num) ((num) >> 10)
+#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024)
+
+#define MAX_IQ_TIME 604800
+#define MAX_DQ_TIME 604800
+
+#define MAXQUOTAS 2
+#define USRQUOTA  0
+#define GRPQUOTA  1
+
+#define INITQFNAMES { "user", "group", "undefined" };
+
+#define QUOTAFILENAME "quota"
+#define QUOTAGROUP "staff"
+
+#define NR_DQHASH 43
+#define NR_DQUOTS 256
+
+#define SUBCMDMASK       0x00ff
+#define SUBCMDSHIFT      8
+#define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
+
+#define Q_SYNC     0x800001
+#define Q_QUOTAON  0x800002
+#define Q_QUOTAOFF 0x800003
+#define Q_GETFMT   0x800004
+#define Q_GETINFO  0x800005
+#define Q_SETINFO  0x800006
+#define Q_GETQUOTA 0x800007
+#define Q_SETQUOTA 0x800008
+
+#define	QFMT_VFS_OLD 1
+#define	QFMT_VFS_V0 2
+#define QFMT_OCFS2 3
+#define	QFMT_VFS_V1 4
+
+#define QIF_BLIMITS	1
+#define QIF_SPACE	2
+#define QIF_ILIMITS	4
+#define QIF_INODES	8
+#define QIF_BTIME	16
+#define QIF_ITIME	32
+#define QIF_LIMITS	(QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE	(QIF_SPACE | QIF_INODES)
+#define QIF_TIMES	(QIF_BTIME | QIF_ITIME)
+#define QIF_ALL		(QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk {
+	uint64_t dqb_bhardlimit;
+	uint64_t dqb_bsoftlimit;
+	uint64_t dqb_curspace;
+	uint64_t dqb_ihardlimit;
+	uint64_t dqb_isoftlimit;
+	uint64_t dqb_curinodes;
+	uint64_t dqb_btime;
+	uint64_t dqb_itime;
+	uint32_t dqb_valid;
+};
+
+#define	dq_bhardlimit	dq_dqb.dqb_bhardlimit
+#define	dq_bsoftlimit	dq_dqb.dqb_bsoftlimit
+#define dq_curspace	dq_dqb.dqb_curspace
+#define dq_valid	dq_dqb.dqb_valid
+#define	dq_ihardlimit	dq_dqb.dqb_ihardlimit
+#define	dq_isoftlimit	dq_dqb.dqb_isoftlimit
+#define	dq_curinodes	dq_dqb.dqb_curinodes
+#define	dq_btime	dq_dqb.dqb_btime
+#define	dq_itime	dq_dqb.dqb_itime
+
+#define dqoff(UID)      ((long long)(UID) * sizeof (struct dqblk))
+
+#define IIF_BGRACE	1
+#define IIF_IGRACE	2
+#define IIF_FLAGS	4
+#define IIF_ALL		(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo {
+	uint64_t dqi_bgrace;
+	uint64_t dqi_igrace;
+	uint32_t dqi_flags;
+	uint32_t dqi_valid;
+};
+
+int quotactl(int, const char *, int, char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/random.h b/musl-include/aarch64/sys/random.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/random.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_RANDOM_H
+#define _SYS_RANDOM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#include <bits/alltypes.h>
+
+#define GRND_NONBLOCK	0x0001
+#define GRND_RANDOM	0x0002
+#define GRND_INSECURE	0x0004
+
+ssize_t getrandom(void *, size_t, unsigned);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/reboot.h b/musl-include/aarch64/sys/reboot.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/reboot.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_REBOOT_H
+#define _SYS_REBOOT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RB_AUTOBOOT     0x01234567
+#define RB_HALT_SYSTEM  0xcdef0123
+#define RB_ENABLE_CAD   0x89abcdef
+#define RB_DISABLE_CAD  0
+#define RB_POWER_OFF    0x4321fedc
+#define RB_SW_SUSPEND   0xd000fce2
+#define RB_KEXEC        0x45584543
+
+int reboot(int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/reg.h b/musl-include/aarch64/sys/reg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/reg.h
@@ -0,0 +1,9 @@
+#ifndef _SYS_REG_H
+#define _SYS_REG_H
+
+#include <limits.h>
+#include <unistd.h>
+
+#include <bits/reg.h>
+
+#endif
diff --git a/musl-include/aarch64/sys/resource.h b/musl-include/aarch64/sys/resource.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/resource.h
@@ -0,0 +1,116 @@
+#ifndef	_SYS_RESOURCE_H
+#define	_SYS_RESOURCE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/time.h>
+
+#define __NEED_id_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_pid_t
+#endif
+
+#include <bits/alltypes.h>
+#include <bits/resource.h>
+
+typedef unsigned long long rlim_t;
+
+struct rlimit {
+	rlim_t rlim_cur;
+	rlim_t rlim_max;
+};
+
+struct rusage {
+	struct timeval ru_utime;
+	struct timeval ru_stime;
+	/* linux extentions, but useful */
+	long	ru_maxrss;
+	long	ru_ixrss;
+	long	ru_idrss;
+	long	ru_isrss;
+	long	ru_minflt;
+	long	ru_majflt;
+	long	ru_nswap;
+	long	ru_inblock;
+	long	ru_oublock;
+	long	ru_msgsnd;
+	long	ru_msgrcv;
+	long	ru_nsignals;
+	long	ru_nvcsw;
+	long	ru_nivcsw;
+	/* room for more... */
+	long    __reserved[16];
+};
+
+int getrlimit (int, struct rlimit *);
+int setrlimit (int, const struct rlimit *);
+int getrusage (int, struct rusage *);
+
+int getpriority (int, id_t);
+int setpriority (int, id_t, int);
+
+#ifdef _GNU_SOURCE
+int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
+#define prlimit64 prlimit
+#endif
+
+#define PRIO_MIN (-20)
+#define PRIO_MAX 20
+
+#define PRIO_PROCESS 0
+#define PRIO_PGRP    1
+#define PRIO_USER    2
+
+#define RUSAGE_SELF     0
+#define RUSAGE_CHILDREN (-1)
+#define RUSAGE_THREAD   1
+
+#define RLIM_INFINITY (~0ULL)
+#define RLIM_SAVED_CUR RLIM_INFINITY
+#define RLIM_SAVED_MAX RLIM_INFINITY
+
+#define RLIMIT_CPU     0
+#define RLIMIT_FSIZE   1
+#define RLIMIT_DATA    2
+#define RLIMIT_STACK   3
+#define RLIMIT_CORE    4
+#ifndef RLIMIT_RSS
+#define RLIMIT_RSS     5
+#define RLIMIT_NPROC   6
+#define RLIMIT_NOFILE  7
+#define RLIMIT_MEMLOCK 8
+#define RLIMIT_AS      9
+#endif
+#define RLIMIT_LOCKS   10
+#define RLIMIT_SIGPENDING 11
+#define RLIMIT_MSGQUEUE 12
+#define RLIMIT_NICE    13
+#define RLIMIT_RTPRIO  14
+#define RLIMIT_RTTIME  15
+#define RLIMIT_NLIMITS 16
+
+#define RLIM_NLIMITS RLIMIT_NLIMITS
+
+#if defined(_LARGEFILE64_SOURCE)
+#define RLIM64_INFINITY RLIM_INFINITY
+#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
+#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
+#define getrlimit64 getrlimit
+#define setrlimit64 setrlimit
+#define rlimit64 rlimit
+#define rlim64_t rlim_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(getrusage, __getrusage_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/select.h b/musl-include/aarch64/sys/select.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/select.h
@@ -0,0 +1,46 @@
+#ifndef _SYS_SELECT_H
+#define _SYS_SELECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_struct_timeval
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define FD_SETSIZE 1024
+
+typedef unsigned long fd_mask;
+
+typedef struct {
+	unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)];
+} fd_set;
+
+#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0)
+#define FD_SET(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
+#define FD_CLR(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
+#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
+
+int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict);
+int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define NFDBITS (8*(int)sizeof(long))
+#endif
+
+#if _REDIR_TIME64
+__REDIR(select, __select_time64);
+__REDIR(pselect, __pselect_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/sem.h b/musl-include/aarch64/sys/sem.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/sem.h
@@ -0,0 +1,72 @@
+#ifndef _SYS_SEM_H
+#define _SYS_SEM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_pid_t
+#define __NEED_time_t
+#ifdef _GNU_SOURCE
+#define __NEED_struct_timespec
+#endif
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+
+#define SEM_UNDO	0x1000
+#define GETPID		11
+#define GETVAL		12
+#define GETALL		13
+#define GETNCNT		14
+#define GETZCNT		15
+#define SETVAL		16
+#define SETALL		17
+
+#include <bits/sem.h>
+
+#define _SEM_SEMUN_UNDEFINED 1
+
+#define SEM_STAT (18 | (IPC_STAT & 0x100))
+#define SEM_INFO 19
+#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100))
+
+struct  seminfo {
+	int semmap;
+	int semmni;
+	int semmns;
+	int semmnu;
+	int semmsl;
+	int semopm;
+	int semume;
+	int semusz;
+	int semvmx;
+	int semaem;
+};
+
+struct sembuf {
+	unsigned short sem_num;
+	short sem_op;
+	short sem_flg;
+};
+
+int semctl(int, int, int, ...);
+int semget(key_t, int, int);
+int semop(int, struct sembuf *, size_t);
+
+#ifdef _GNU_SOURCE
+int semtimedop(int, struct sembuf *, size_t, const struct timespec *);
+#endif
+
+#if _REDIR_TIME64
+#ifdef _GNU_SOURCE
+__REDIR(semtimedop, __semtimedop_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/sendfile.h b/musl-include/aarch64/sys/sendfile.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/sendfile.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_SENDFILE_H
+#define _SYS_SENDFILE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <unistd.h>
+
+ssize_t sendfile(int, int, off_t *, size_t);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define sendfile64 sendfile
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/shm.h b/musl-include/aarch64/sys/shm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/shm.h
@@ -0,0 +1,70 @@
+#ifndef _SYS_SHM_H
+#define _SYS_SHM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_pid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+
+#ifdef _GNU_SOURCE
+#define __used_ids used_ids
+#define __swap_attempts swap_attempts
+#define __swap_successes swap_successes
+#endif
+
+#include <bits/shm.h>
+
+#define SHM_R 0400
+#define SHM_W 0200
+
+#define SHM_RDONLY 010000
+#define SHM_RND    020000
+#define SHM_REMAP  040000
+#define SHM_EXEC   0100000
+
+#define SHM_LOCK 11
+#define SHM_UNLOCK 12
+#define SHM_STAT (13 | (IPC_STAT & 0x100))
+#define SHM_INFO 14
+#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100))
+#define SHM_DEST 01000
+#define SHM_LOCKED 02000
+#define SHM_HUGETLB 04000
+#define SHM_NORESERVE 010000
+
+#define SHM_HUGE_SHIFT 26
+#define SHM_HUGE_MASK  0x3f
+#define SHM_HUGE_64KB  (16 << 26)
+#define SHM_HUGE_512KB (19 << 26)
+#define SHM_HUGE_1MB   (20 << 26)
+#define SHM_HUGE_2MB   (21 << 26)
+#define SHM_HUGE_8MB   (23 << 26)
+#define SHM_HUGE_16MB  (24 << 26)
+#define SHM_HUGE_32MB  (25 << 26)
+#define SHM_HUGE_256MB (28 << 26)
+#define SHM_HUGE_512MB (29 << 26)
+#define SHM_HUGE_1GB   (30 << 26)
+#define SHM_HUGE_2GB   (31 << 26)
+#define SHM_HUGE_16GB  (34U << 26)
+
+typedef unsigned long shmatt_t;
+
+void *shmat(int, const void *, int);
+int shmctl(int, int, struct shmid_ds *);
+int shmdt(const void *);
+int shmget(key_t, size_t, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/signal.h b/musl-include/aarch64/sys/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/signal.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/signal.h> to <signal.h>
+#include <signal.h>
diff --git a/musl-include/aarch64/sys/signalfd.h b/musl-include/aarch64/sys/signalfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/signalfd.h
@@ -0,0 +1,49 @@
+#ifndef _SYS_SIGNALFD_H
+#define _SYS_SIGNALFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define SFD_CLOEXEC O_CLOEXEC
+#define SFD_NONBLOCK O_NONBLOCK
+
+int signalfd(int, const sigset_t *, int);
+
+struct signalfd_siginfo {
+	uint32_t  ssi_signo;
+	int32_t   ssi_errno;
+	int32_t   ssi_code;
+	uint32_t  ssi_pid;
+	uint32_t  ssi_uid;
+	int32_t   ssi_fd;
+	uint32_t  ssi_tid;
+	uint32_t  ssi_band;
+	uint32_t  ssi_overrun;
+	uint32_t  ssi_trapno;
+	int32_t   ssi_status;
+	int32_t   ssi_int;
+	uint64_t  ssi_ptr;
+	uint64_t  ssi_utime;
+	uint64_t  ssi_stime;
+	uint64_t  ssi_addr;
+	uint16_t  ssi_addr_lsb;
+	uint16_t  __pad2;
+	int32_t   ssi_syscall;
+	uint64_t  ssi_call_addr;
+	uint32_t  ssi_arch;
+	uint8_t   __pad[128-14*4-5*8-2*2];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/socket.h b/musl-include/aarch64/sys/socket.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/socket.h
@@ -0,0 +1,415 @@
+#ifndef	_SYS_SOCKET_H
+#define	_SYS_SOCKET_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_socklen_t
+#define __NEED_sa_family_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_uid_t
+#define __NEED_pid_t
+#define __NEED_gid_t
+#define __NEED_struct_iovec
+
+#include <bits/alltypes.h>
+
+#include <bits/socket.h>
+
+struct msghdr {
+	void *msg_name;
+	socklen_t msg_namelen;
+	struct iovec *msg_iov;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad1;
+#endif
+	int msg_iovlen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad1;
+#endif
+	void *msg_control;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad2;
+#endif
+	socklen_t msg_controllen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad2;
+#endif
+	int msg_flags;
+};
+
+struct cmsghdr {
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad1;
+#endif
+	socklen_t cmsg_len;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad1;
+#endif
+	int cmsg_level;
+	int cmsg_type;
+};
+
+#ifdef _GNU_SOURCE
+struct ucred {
+	pid_t pid;
+	uid_t uid;
+	gid_t gid;
+};
+
+struct mmsghdr {
+	struct msghdr msg_hdr;
+	unsigned int  msg_len;
+};
+
+struct timespec;
+
+int sendmmsg (int, struct mmsghdr *, unsigned int, unsigned int);
+int recvmmsg (int, struct mmsghdr *, unsigned int, unsigned int, struct timespec *);
+#endif
+
+struct linger {
+	int l_onoff;
+	int l_linger;
+};
+
+#define SHUT_RD 0
+#define SHUT_WR 1
+#define SHUT_RDWR 2
+
+#ifndef SOCK_STREAM
+#define SOCK_STREAM    1
+#define SOCK_DGRAM     2
+#endif
+
+#define SOCK_RAW       3
+#define SOCK_RDM       4
+#define SOCK_SEQPACKET 5
+#define SOCK_DCCP      6
+#define SOCK_PACKET    10
+
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC   02000000
+#define SOCK_NONBLOCK  04000
+#endif
+
+#define PF_UNSPEC       0
+#define PF_LOCAL        1
+#define PF_UNIX         PF_LOCAL
+#define PF_FILE         PF_LOCAL
+#define PF_INET         2
+#define PF_AX25         3
+#define PF_IPX          4
+#define PF_APPLETALK    5
+#define PF_NETROM       6
+#define PF_BRIDGE       7
+#define PF_ATMPVC       8
+#define PF_X25          9
+#define PF_INET6        10
+#define PF_ROSE         11
+#define PF_DECnet       12
+#define PF_NETBEUI      13
+#define PF_SECURITY     14
+#define PF_KEY          15
+#define PF_NETLINK      16
+#define PF_ROUTE        PF_NETLINK
+#define PF_PACKET       17
+#define PF_ASH          18
+#define PF_ECONET       19
+#define PF_ATMSVC       20
+#define PF_RDS          21
+#define PF_SNA          22
+#define PF_IRDA         23
+#define PF_PPPOX        24
+#define PF_WANPIPE      25
+#define PF_LLC          26
+#define PF_IB           27
+#define PF_MPLS         28
+#define PF_CAN          29
+#define PF_TIPC         30
+#define PF_BLUETOOTH    31
+#define PF_IUCV         32
+#define PF_RXRPC        33
+#define PF_ISDN         34
+#define PF_PHONET       35
+#define PF_IEEE802154   36
+#define PF_CAIF         37
+#define PF_ALG          38
+#define PF_NFC          39
+#define PF_VSOCK        40
+#define PF_KCM          41
+#define PF_QIPCRTR      42
+#define PF_SMC          43
+#define PF_XDP          44
+#define PF_MAX          45
+
+#define AF_UNSPEC       PF_UNSPEC
+#define AF_LOCAL        PF_LOCAL
+#define AF_UNIX         AF_LOCAL
+#define AF_FILE         AF_LOCAL
+#define AF_INET         PF_INET
+#define AF_AX25         PF_AX25
+#define AF_IPX          PF_IPX
+#define AF_APPLETALK    PF_APPLETALK
+#define AF_NETROM       PF_NETROM
+#define AF_BRIDGE       PF_BRIDGE
+#define AF_ATMPVC       PF_ATMPVC
+#define AF_X25          PF_X25
+#define AF_INET6        PF_INET6
+#define AF_ROSE         PF_ROSE
+#define AF_DECnet       PF_DECnet
+#define AF_NETBEUI      PF_NETBEUI
+#define AF_SECURITY     PF_SECURITY
+#define AF_KEY          PF_KEY
+#define AF_NETLINK      PF_NETLINK
+#define AF_ROUTE        PF_ROUTE
+#define AF_PACKET       PF_PACKET
+#define AF_ASH          PF_ASH
+#define AF_ECONET       PF_ECONET
+#define AF_ATMSVC       PF_ATMSVC
+#define AF_RDS          PF_RDS
+#define AF_SNA          PF_SNA
+#define AF_IRDA         PF_IRDA
+#define AF_PPPOX        PF_PPPOX
+#define AF_WANPIPE      PF_WANPIPE
+#define AF_LLC          PF_LLC
+#define AF_IB           PF_IB
+#define AF_MPLS         PF_MPLS
+#define AF_CAN          PF_CAN
+#define AF_TIPC         PF_TIPC
+#define AF_BLUETOOTH    PF_BLUETOOTH
+#define AF_IUCV         PF_IUCV
+#define AF_RXRPC        PF_RXRPC
+#define AF_ISDN         PF_ISDN
+#define AF_PHONET       PF_PHONET
+#define AF_IEEE802154   PF_IEEE802154
+#define AF_CAIF         PF_CAIF
+#define AF_ALG          PF_ALG
+#define AF_NFC          PF_NFC
+#define AF_VSOCK        PF_VSOCK
+#define AF_KCM          PF_KCM
+#define AF_QIPCRTR      PF_QIPCRTR
+#define AF_SMC          PF_SMC
+#define AF_XDP          PF_XDP
+#define AF_MAX          PF_MAX
+
+#ifndef SO_DEBUG
+#define SO_DEBUG        1
+#define SO_REUSEADDR    2
+#define SO_TYPE         3
+#define SO_ERROR        4
+#define SO_DONTROUTE    5
+#define SO_BROADCAST    6
+#define SO_SNDBUF       7
+#define SO_RCVBUF       8
+#define SO_KEEPALIVE    9
+#define SO_OOBINLINE    10
+#define SO_NO_CHECK     11
+#define SO_PRIORITY     12
+#define SO_LINGER       13
+#define SO_BSDCOMPAT    14
+#define SO_REUSEPORT    15
+#define SO_PASSCRED     16
+#define SO_PEERCRED     17
+#define SO_RCVLOWAT     18
+#define SO_SNDLOWAT     19
+#define SO_ACCEPTCONN   30
+#define SO_PEERSEC      31
+#define SO_SNDBUFFORCE  32
+#define SO_RCVBUFFORCE  33
+#define SO_PROTOCOL     38
+#define SO_DOMAIN       39
+#endif
+
+#ifndef SO_RCVTIMEO
+#if __LONG_MAX == 0x7fffffff
+#define SO_RCVTIMEO     66
+#define SO_SNDTIMEO     67
+#else
+#define SO_RCVTIMEO     20
+#define SO_SNDTIMEO     21
+#endif
+#endif
+
+#ifndef SO_TIMESTAMP
+#if __LONG_MAX == 0x7fffffff
+#define SO_TIMESTAMP    63
+#define SO_TIMESTAMPNS  64
+#define SO_TIMESTAMPING 65
+#else
+#define SO_TIMESTAMP    29
+#define SO_TIMESTAMPNS  35
+#define SO_TIMESTAMPING 37
+#endif
+#endif
+
+#define SO_SECURITY_AUTHENTICATION              22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT        23
+#define SO_SECURITY_ENCRYPTION_NETWORK          24
+
+#define SO_BINDTODEVICE 25
+
+#define SO_ATTACH_FILTER        26
+#define SO_DETACH_FILTER        27
+#define SO_GET_FILTER           SO_ATTACH_FILTER
+
+#define SO_PEERNAME             28
+#define SCM_TIMESTAMP           SO_TIMESTAMP
+#define SO_PASSSEC              34
+#define SCM_TIMESTAMPNS         SO_TIMESTAMPNS
+#define SO_MARK                 36
+#define SCM_TIMESTAMPING        SO_TIMESTAMPING
+#define SO_RXQ_OVFL             40
+#define SO_WIFI_STATUS          41
+#define SCM_WIFI_STATUS         SO_WIFI_STATUS
+#define SO_PEEK_OFF             42
+#define SO_NOFCS                43
+#define SO_LOCK_FILTER          44
+#define SO_SELECT_ERR_QUEUE     45
+#define SO_BUSY_POLL            46
+#define SO_MAX_PACING_RATE      47
+#define SO_BPF_EXTENSIONS       48
+#define SO_INCOMING_CPU         49
+#define SO_ATTACH_BPF           50
+#define SO_DETACH_BPF           SO_DETACH_FILTER
+#define SO_ATTACH_REUSEPORT_CBPF 51
+#define SO_ATTACH_REUSEPORT_EBPF 52
+#define SO_CNX_ADVICE           53
+#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO              55
+#define SO_INCOMING_NAPI_ID     56
+#define SO_COOKIE               57
+#define SCM_TIMESTAMPING_PKTINFO 58
+#define SO_PEERGROUPS           59
+#define SO_ZEROCOPY             60
+#define SO_TXTIME               61
+#define SCM_TXTIME              SO_TXTIME
+#define SO_BINDTOIFINDEX        62
+#define SO_DETACH_REUSEPORT_BPF 68
+#define SO_PREFER_BUSY_POLL     69
+#define SO_BUSY_POLL_BUDGET     70
+
+#ifndef SOL_SOCKET
+#define SOL_SOCKET      1
+#endif
+
+#define SOL_IP          0
+#define SOL_IPV6        41
+#define SOL_ICMPV6      58
+
+#define SOL_RAW         255
+#define SOL_DECNET      261
+#define SOL_X25         262
+#define SOL_PACKET      263
+#define SOL_ATM         264
+#define SOL_AAL         265
+#define SOL_IRDA        266
+#define SOL_NETBEUI     267
+#define SOL_LLC         268
+#define SOL_DCCP        269
+#define SOL_NETLINK     270
+#define SOL_TIPC        271
+#define SOL_RXRPC       272
+#define SOL_PPPOL2TP    273
+#define SOL_BLUETOOTH   274
+#define SOL_PNPIPE      275
+#define SOL_RDS         276
+#define SOL_IUCV        277
+#define SOL_CAIF        278
+#define SOL_ALG         279
+#define SOL_NFC         280
+#define SOL_KCM         281
+#define SOL_TLS         282
+#define SOL_XDP         283
+
+#define SOMAXCONN       128
+
+#define MSG_OOB       0x0001
+#define MSG_PEEK      0x0002
+#define MSG_DONTROUTE 0x0004
+#define MSG_CTRUNC    0x0008
+#define MSG_PROXY     0x0010
+#define MSG_TRUNC     0x0020
+#define MSG_DONTWAIT  0x0040
+#define MSG_EOR       0x0080
+#define MSG_WAITALL   0x0100
+#define MSG_FIN       0x0200
+#define MSG_SYN       0x0400
+#define MSG_CONFIRM   0x0800
+#define MSG_RST       0x1000
+#define MSG_ERRQUEUE  0x2000
+#define MSG_NOSIGNAL  0x4000
+#define MSG_MORE      0x8000
+#define MSG_WAITFORONE 0x10000
+#define MSG_BATCH     0x40000
+#define MSG_ZEROCOPY  0x4000000
+#define MSG_FASTOPEN  0x20000000
+#define MSG_CMSG_CLOEXEC 0x40000000
+
+#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1))
+#define __CMSG_NEXT(cmsg) ((unsigned char *)(cmsg) + __CMSG_LEN(cmsg))
+#define __MHDR_END(mhdr) ((unsigned char *)(mhdr)->msg_control + (mhdr)->msg_controllen)
+
+#define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1))
+#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \
+	__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
+	? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg))
+#define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
+
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+#define SCM_RIGHTS      0x01
+#define SCM_CREDENTIALS 0x02
+
+struct sockaddr {
+	sa_family_t sa_family;
+	char sa_data[14];
+};
+
+struct sockaddr_storage {
+	sa_family_t ss_family;
+	char __ss_padding[128-sizeof(long)-sizeof(sa_family_t)];
+	unsigned long __ss_align;
+};
+
+int socket (int, int, int);
+int socketpair (int, int, int, int [2]);
+
+int shutdown (int, int);
+
+int bind (int, const struct sockaddr *, socklen_t);
+int connect (int, const struct sockaddr *, socklen_t);
+int listen (int, int);
+int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
+int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
+
+int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
+int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
+
+ssize_t send (int, const void *, size_t, int);
+ssize_t recv (int, void *, size_t, int);
+ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
+ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
+ssize_t sendmsg (int, const struct msghdr *, int);
+ssize_t recvmsg (int, struct msghdr *, int);
+
+int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
+int setsockopt (int, int, int, const void *, socklen_t);
+
+int sockatmark (int);
+
+#if _REDIR_TIME64
+#ifdef _GNU_SOURCE
+__REDIR(recvmmsg, __recvmmsg_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/soundcard.h b/musl-include/aarch64/sys/soundcard.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/soundcard.h
@@ -0,0 +1,1 @@
+#include <bits/soundcard.h>
diff --git a/musl-include/aarch64/sys/stat.h b/musl-include/aarch64/sys/stat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/stat.h
@@ -0,0 +1,182 @@
+#ifndef	_SYS_STAT_H
+#define	_SYS_STAT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_dev_t
+#define __NEED_ino_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_off_t
+#define __NEED_time_t
+#define __NEED_blksize_t
+#define __NEED_blkcnt_t
+#define __NEED_struct_timespec
+
+#ifdef _GNU_SOURCE
+#define __NEED_int64_t
+#define __NEED_uint64_t
+#define __NEED_uint32_t
+#define __NEED_uint16_t
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/stat.h>
+
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+
+#define S_IFMT  0170000
+
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFBLK 0060000
+#define S_IFREG 0100000
+#define S_IFIFO 0010000
+#define S_IFLNK 0120000
+#define S_IFSOCK 0140000
+
+#define S_TYPEISMQ(buf)  0
+#define S_TYPEISSEM(buf) 0
+#define S_TYPEISSHM(buf) 0
+#define S_TYPEISTMO(buf) 0
+
+#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK)
+#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
+#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
+#define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK)
+#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+
+#ifndef S_IRUSR
+#define S_ISUID 04000
+#define S_ISGID 02000
+#define S_ISVTX 01000
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXU 0700
+#define S_IRGRP 0040
+#define S_IWGRP 0020
+#define S_IXGRP 0010
+#define S_IRWXG 0070
+#define S_IROTH 0004
+#define S_IWOTH 0002
+#define S_IXOTH 0001
+#define S_IRWXO 0007
+#endif
+
+#define UTIME_NOW  0x3fffffff
+#define UTIME_OMIT 0x3ffffffe
+
+int stat(const char *__restrict, struct stat *__restrict);
+int fstat(int, struct stat *);
+int lstat(const char *__restrict, struct stat *__restrict);
+int fstatat(int, const char *__restrict, struct stat *__restrict, int);
+int chmod(const char *, mode_t);
+int fchmod(int, mode_t);
+int fchmodat(int, const char *, mode_t, int);
+mode_t umask(mode_t);
+int mkdir(const char *, mode_t);
+int mkfifo(const char *, mode_t);
+int mkdirat(int, const char *, mode_t);
+int mkfifoat(int, const char *, mode_t);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int mknod(const char *, mode_t, dev_t);
+int mknodat(int, const char *, mode_t, dev_t);
+#endif
+
+int futimens(int, const struct timespec [2]);
+int utimensat(int, const char *, const struct timespec [2], int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int lchmod(const char *, mode_t);
+#define S_IREAD S_IRUSR
+#define S_IWRITE S_IWUSR
+#define S_IEXEC S_IXUSR
+#endif
+
+#if defined(_GNU_SOURCE)
+#define STATX_TYPE 1U
+#define STATX_MODE 2U
+#define STATX_NLINK 4U
+#define STATX_UID 8U
+#define STATX_GID 0x10U
+#define STATX_ATIME 0x20U
+#define STATX_MTIME 0x40U
+#define STATX_CTIME 0x80U
+#define STATX_INO 0x100U
+#define STATX_SIZE 0x200U
+#define STATX_BLOCKS 0x400U
+#define STATX_BASIC_STATS 0x7ffU
+#define STATX_BTIME 0x800U
+#define STATX_ALL 0xfffU
+
+struct statx_timestamp {
+	int64_t tv_sec;
+	uint32_t tv_nsec, __pad;
+};
+
+struct statx {
+	uint32_t stx_mask;
+	uint32_t stx_blksize;
+	uint64_t stx_attributes;
+	uint32_t stx_nlink;
+	uint32_t stx_uid;
+	uint32_t stx_gid;
+	uint16_t stx_mode;
+	uint16_t __pad0[1];
+	uint64_t stx_ino;
+	uint64_t stx_size;
+	uint64_t stx_blocks;
+	uint64_t stx_attributes_mask;
+	struct statx_timestamp stx_atime;
+	struct statx_timestamp stx_btime;
+	struct statx_timestamp stx_ctime;
+	struct statx_timestamp stx_mtime;
+	uint32_t stx_rdev_major;
+	uint32_t stx_rdev_minor;
+	uint32_t stx_dev_major;
+	uint32_t stx_dev_minor;
+	uint64_t __pad1[14];
+};
+
+int statx(int, const char *__restrict, int, unsigned, struct statx *__restrict);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define stat64 stat
+#define fstat64 fstat
+#define lstat64 lstat
+#define fstatat64 fstatat
+#define blkcnt64_t blkcnt_t
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#define ino64_t ino_t
+#define off64_t off_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(stat, __stat_time64);
+__REDIR(fstat, __fstat_time64);
+__REDIR(lstat, __lstat_time64);
+__REDIR(fstatat, __fstatat_time64);
+__REDIR(futimens, __futimens_time64);
+__REDIR(utimensat, __utimensat_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
diff --git a/musl-include/aarch64/sys/statfs.h b/musl-include/aarch64/sys/statfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/statfs.h
@@ -0,0 +1,32 @@
+#ifndef	_SYS_STATFS_H
+#define	_SYS_STATFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <sys/statvfs.h>
+
+typedef struct __fsid_t {
+	int __val[2];
+} fsid_t;
+
+#include <bits/statfs.h>
+
+int statfs (const char *, struct statfs *);
+int fstatfs (int, struct statfs *);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define statfs64 statfs
+#define fstatfs64 fstatfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/statvfs.h b/musl-include/aarch64/sys/statvfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/statvfs.h
@@ -0,0 +1,57 @@
+#ifndef	_SYS_STATVFS_H
+#define	_SYS_STATVFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+#include <bits/alltypes.h>
+
+struct statvfs {
+	unsigned long f_bsize, f_frsize;
+	fsblkcnt_t f_blocks, f_bfree, f_bavail;
+	fsfilcnt_t f_files, f_ffree, f_favail;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned long f_fsid;
+	unsigned :8*(2*sizeof(int)-sizeof(long));
+#else
+	unsigned :8*(2*sizeof(int)-sizeof(long));
+	unsigned long f_fsid;
+#endif
+	unsigned long f_flag, f_namemax;
+	unsigned int f_type;
+	int __reserved[5];
+};
+
+int statvfs (const char *__restrict, struct statvfs *__restrict);
+int fstatvfs (int, struct statvfs *);
+
+#define ST_RDONLY 1
+#define ST_NOSUID 2
+#define ST_NODEV  4
+#define ST_NOEXEC 8
+#define ST_SYNCHRONOUS 16
+#define ST_MANDLOCK    64
+#define ST_WRITE       128
+#define ST_APPEND      256
+#define ST_IMMUTABLE   512
+#define ST_NOATIME     1024
+#define ST_NODIRATIME  2048
+#define ST_RELATIME    4096
+
+#if defined(_LARGEFILE64_SOURCE)
+#define statvfs64 statvfs
+#define fstatvfs64 fstatvfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/stropts.h b/musl-include/aarch64/sys/stropts.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/stropts.h
@@ -0,0 +1,1 @@
+#include <stropts.h>
diff --git a/musl-include/aarch64/sys/swap.h b/musl-include/aarch64/sys/swap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/swap.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_SWAP_H
+#define _SYS_SWAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define	SWAP_FLAG_PREFER        0x8000
+#define	SWAP_FLAG_PRIO_MASK     0x7fff
+#define	SWAP_FLAG_PRIO_SHIFT    0
+#define SWAP_FLAG_DISCARD       0x10000
+
+int swapon (const char *, int);
+int swapoff (const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/syscall.h b/musl-include/aarch64/sys/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/syscall.h
@@ -0,0 +1,6 @@
+#ifndef _SYS_SYSCALL_H
+#define _SYS_SYSCALL_H
+
+#include <bits/syscall.h>
+
+#endif
diff --git a/musl-include/aarch64/sys/sysinfo.h b/musl-include/aarch64/sys/sysinfo.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/sysinfo.h
@@ -0,0 +1,36 @@
+#ifndef _SYS_SYSINFO_H
+#define _SYS_SYSINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SI_LOAD_SHIFT 16
+
+struct sysinfo {
+	unsigned long uptime;
+	unsigned long loads[3];
+	unsigned long totalram;
+	unsigned long freeram;
+	unsigned long sharedram;
+	unsigned long bufferram;
+	unsigned long totalswap;
+	unsigned long freeswap;
+	unsigned short procs, pad;
+	unsigned long totalhigh;
+	unsigned long freehigh;
+	unsigned mem_unit;
+	char __reserved[256];
+};
+
+int sysinfo (struct sysinfo *);
+int get_nprocs_conf (void);
+int get_nprocs (void);
+long get_phys_pages (void);
+long get_avphys_pages (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/syslog.h b/musl-include/aarch64/sys/syslog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/syslog.h
@@ -0,0 +1,1 @@
+#include <syslog.h>
diff --git a/musl-include/aarch64/sys/sysmacros.h b/musl-include/aarch64/sys/sysmacros.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/sysmacros.h
@@ -0,0 +1,15 @@
+#ifndef _SYS_SYSMACROS_H
+#define _SYS_SYSMACROS_H
+
+#define major(x) \
+	((unsigned)( (((x)>>31>>1) & 0xfffff000) | (((x)>>8) & 0x00000fff) ))
+#define minor(x) \
+	((unsigned)( (((x)>>12) & 0xffffff00) | ((x) & 0x000000ff) ))
+
+#define makedev(x,y) ( \
+        (((x)&0xfffff000ULL) << 32) | \
+	(((x)&0x00000fffULL) << 8) | \
+        (((y)&0xffffff00ULL) << 12) | \
+	(((y)&0x000000ffULL)) )
+
+#endif
diff --git a/musl-include/aarch64/sys/termios.h b/musl-include/aarch64/sys/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/termios.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/termios.h> to <termios.h>
+#include <termios.h>
diff --git a/musl-include/aarch64/sys/time.h b/musl-include/aarch64/sys/time.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/time.h
@@ -0,0 +1,76 @@
+#ifndef _SYS_TIME_H
+#define _SYS_TIME_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <sys/select.h>
+
+int gettimeofday (struct timeval *__restrict, void *__restrict);
+
+#define ITIMER_REAL    0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF    2
+
+struct itimerval {
+	struct timeval it_interval;
+	struct timeval it_value;
+};
+
+int getitimer (int, struct itimerval *);
+int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict);
+int utimes (const char *, const struct timeval [2]);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct timezone {
+	int tz_minuteswest;
+	int tz_dsttime;
+};
+int futimes(int, const struct timeval [2]);
+int futimesat(int, const char *, const struct timeval [2]);
+int lutimes(const char *, const struct timeval [2]);
+int settimeofday(const struct timeval *, const struct timezone *);
+int adjtime (const struct timeval *, struct timeval *);
+#define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
+#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
+#define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
+	(s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
+#define timeradd(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
+	((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
+	((a)->tv_usec -= 1000000, (a)->tv_sec++) )
+#define timersub(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
+	((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
+	((a)->tv_usec += 1000000, (a)->tv_sec--) )
+#endif
+
+#if defined(_GNU_SOURCE)
+#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \
+	(ts)->tv_sec = (tv)->tv_sec, \
+	(ts)->tv_nsec = (tv)->tv_usec * 1000, \
+	(void)0 )
+#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \
+	(tv)->tv_sec = (ts)->tv_sec, \
+	(tv)->tv_usec = (ts)->tv_nsec / 1000, \
+	(void)0 )
+#endif
+
+#if _REDIR_TIME64
+__REDIR(gettimeofday, __gettimeofday_time64);
+__REDIR(getitimer, __getitimer_time64);
+__REDIR(setitimer, __setitimer_time64);
+__REDIR(utimes, __utimes_time64);
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(futimes, __futimes_time64);
+__REDIR(futimesat, __futimesat_time64);
+__REDIR(lutimes, __lutimes_time64);
+__REDIR(settimeofday, __settimeofday_time64);
+__REDIR(adjtime, __adjtime64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/timeb.h b/musl-include/aarch64/sys/timeb.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/timeb.h
@@ -0,0 +1,28 @@
+#ifndef _SYS_TIMEB_H
+#define _SYS_TIMEB_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+
+#include <bits/alltypes.h>
+
+struct timeb {
+	time_t time;
+	unsigned short millitm;
+	short timezone, dstflag;
+};
+
+int ftime(struct timeb *);
+
+#if _REDIR_TIME64
+__REDIR(ftime, __ftime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/timerfd.h b/musl-include/aarch64/sys/timerfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/timerfd.h
@@ -0,0 +1,32 @@
+#ifndef _SYS_TIMERFD_H
+#define _SYS_TIMERFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <time.h>
+#include <fcntl.h>
+
+#define TFD_NONBLOCK O_NONBLOCK
+#define TFD_CLOEXEC O_CLOEXEC
+
+#define TFD_TIMER_ABSTIME 1
+#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
+
+struct itimerspec;
+
+int timerfd_create(int, int);
+int timerfd_settime(int, int, const struct itimerspec *, struct itimerspec *);
+int timerfd_gettime(int, struct itimerspec *);
+
+#if _REDIR_TIME64
+__REDIR(timerfd_settime, __timerfd_settime64);
+__REDIR(timerfd_gettime, __timerfd_gettime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/times.h b/musl-include/aarch64/sys/times.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/times.h
@@ -0,0 +1,25 @@
+#ifndef	_SYS_TIMES_H
+#define	_SYS_TIMES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clock_t
+#include <bits/alltypes.h>
+
+struct tms {
+	clock_t tms_utime;
+	clock_t tms_stime;
+	clock_t tms_cutime;
+	clock_t tms_cstime;
+};
+
+clock_t times (struct tms *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/aarch64/sys/timex.h b/musl-include/aarch64/sys/timex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/timex.h
@@ -0,0 +1,103 @@
+#ifndef _SYS_TIMEX_H
+#define _SYS_TIMEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clockid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/time.h>
+
+struct ntptimeval {
+	struct timeval time;
+	long maxerror, esterror;
+};
+
+struct timex {
+	unsigned modes;
+	long offset, freq, maxerror, esterror;
+	int status;
+	long constant, precision, tolerance;
+	struct timeval time;
+	long tick, ppsfreq, jitter;
+	int shift;
+	long stabil, jitcnt, calcnt, errcnt, stbcnt;
+	int tai;
+	int __padding[11];
+};
+
+#define ADJ_OFFSET		0x0001
+#define ADJ_FREQUENCY		0x0002
+#define ADJ_MAXERROR		0x0004
+#define ADJ_ESTERROR		0x0008
+#define ADJ_STATUS		0x0010
+#define ADJ_TIMECONST		0x0020
+#define ADJ_TAI			0x0080
+#define ADJ_SETOFFSET		0x0100
+#define ADJ_MICRO		0x1000
+#define ADJ_NANO		0x2000
+#define ADJ_TICK		0x4000
+#define ADJ_OFFSET_SINGLESHOT	0x8001
+#define ADJ_OFFSET_SS_READ	0xa001
+
+#define MOD_OFFSET	ADJ_OFFSET
+#define MOD_FREQUENCY	ADJ_FREQUENCY
+#define MOD_MAXERROR	ADJ_MAXERROR
+#define MOD_ESTERROR	ADJ_ESTERROR
+#define MOD_STATUS	ADJ_STATUS
+#define MOD_TIMECONST	ADJ_TIMECONST
+#define MOD_CLKB	ADJ_TICK
+#define MOD_CLKA	ADJ_OFFSET_SINGLESHOT
+#define MOD_TAI		ADJ_TAI
+#define MOD_MICRO	ADJ_MICRO
+#define MOD_NANO	ADJ_NANO
+
+#define STA_PLL		0x0001
+#define STA_PPSFREQ	0x0002
+#define STA_PPSTIME	0x0004
+#define STA_FLL		0x0008
+
+#define STA_INS		0x0010
+#define STA_DEL		0x0020
+#define STA_UNSYNC	0x0040
+#define STA_FREQHOLD	0x0080
+
+#define STA_PPSSIGNAL	0x0100
+#define STA_PPSJITTER	0x0200
+#define STA_PPSWANDER	0x0400
+#define STA_PPSERROR	0x0800
+
+#define STA_CLOCKERR	0x1000
+#define STA_NANO	0x2000
+#define STA_MODE	0x4000
+#define STA_CLK		0x8000
+
+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
+    STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
+
+#define TIME_OK		0
+#define TIME_INS	1
+#define TIME_DEL	2
+#define TIME_OOP	3
+#define TIME_WAIT	4
+#define TIME_ERROR	5
+#define TIME_BAD	TIME_ERROR
+
+#define MAXTC		6
+
+int adjtimex(struct timex *);
+int clock_adjtime(clockid_t, struct timex *);
+
+#if _REDIR_TIME64
+__REDIR(adjtimex, __adjtimex_time64);
+__REDIR(clock_adjtime, __clock_adjtime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/ttydefaults.h b/musl-include/aarch64/sys/ttydefaults.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/ttydefaults.h
@@ -0,0 +1,34 @@
+#ifndef _SYS_TTYDEFAULTS_H
+#define _SYS_TTYDEFAULTS_H
+
+#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
+#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
+#define TTYDEF_SPEED (B9600)
+#define CTRL(x) ((x)&037)
+#define CEOF CTRL('d')
+
+#define CEOL '\0'
+#define CSTATUS '\0'
+
+#define CERASE 0177
+#define CINTR CTRL('c')
+#define CKILL CTRL('u')
+#define CMIN 1
+#define CQUIT 034
+#define CSUSP CTRL('z')
+#define CTIME 0
+#define CDSUSP CTRL('y')
+#define CSTART CTRL('q')
+#define CSTOP CTRL('s')
+#define CLNEXT CTRL('v')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
+#define CEOT CEOF
+#define CBRK CEOL
+#define CRPRNT CREPRINT
+#define CFLUSH CDISCARD
+
+#endif
diff --git a/musl-include/aarch64/sys/types.h b/musl-include/aarch64/sys/types.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/types.h
@@ -0,0 +1,85 @@
+#ifndef	_SYS_TYPES_H
+#define	_SYS_TYPES_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ino_t
+#define __NEED_dev_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_time_t
+#define __NEED_timer_t
+#define __NEED_clockid_t
+
+#define __NEED_blkcnt_t
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+
+#define __NEED_id_t
+#define __NEED_key_t
+#define __NEED_clock_t
+#define __NEED_suseconds_t
+#define __NEED_blksize_t
+
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_pthread_mutexattr_t
+#define __NEED_pthread_condattr_t
+#define __NEED_pthread_rwlockattr_t
+#define __NEED_pthread_barrierattr_t
+#define __NEED_pthread_mutex_t
+#define __NEED_pthread_cond_t
+#define __NEED_pthread_rwlock_t
+#define __NEED_pthread_barrier_t
+#define __NEED_pthread_spinlock_t
+#define __NEED_pthread_key_t
+#define __NEED_pthread_once_t
+#define __NEED_useconds_t
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+#define __NEED_u_int64_t
+#define __NEED_register_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned char u_int8_t;
+typedef unsigned short u_int16_t;
+typedef unsigned u_int32_t;
+typedef char *caddr_t;
+typedef unsigned char u_char;
+typedef unsigned short u_short, ushort;
+typedef unsigned u_int, uint;
+typedef unsigned long u_long, ulong;
+typedef long long quad_t;
+typedef unsigned long long u_quad_t;
+#include <endian.h>
+#include <sys/select.h>
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define blkcnt64_t blkcnt_t
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#define ino64_t ino_t
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/ucontext.h b/musl-include/aarch64/sys/ucontext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/ucontext.h
@@ -0,0 +1,1 @@
+#include <ucontext.h>
diff --git a/musl-include/aarch64/sys/uio.h b/musl-include/aarch64/sys/uio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/uio.h
@@ -0,0 +1,55 @@
+#ifndef _SYS_UIO_H
+#define _SYS_UIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_struct_iovec
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_off_t
+#endif
+
+#ifdef _GNU_SOURCE
+#define __NEED_pid_t
+#endif
+
+#include <bits/alltypes.h>
+
+#define UIO_MAXIOV 1024
+
+ssize_t readv (int, const struct iovec *, int);
+ssize_t writev (int, const struct iovec *, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+ssize_t preadv (int, const struct iovec *, int, off_t);
+ssize_t pwritev (int, const struct iovec *, int, off_t);
+#if defined(_LARGEFILE64_SOURCE)
+#define preadv64 preadv
+#define pwritev64 pwritev
+#define off64_t off_t
+#endif
+#endif
+
+#ifdef _GNU_SOURCE
+ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
+ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
+ssize_t preadv2 (int, const struct iovec *, int, off_t, int);
+ssize_t pwritev2 (int, const struct iovec *, int, off_t, int);
+#define RWF_HIPRI 0x00000001
+#define RWF_DSYNC 0x00000002
+#define RWF_SYNC 0x00000004
+#define RWF_NOWAIT 0x00000008
+#define RWF_APPEND 0x00000010
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/un.h b/musl-include/aarch64/sys/un.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/un.h
@@ -0,0 +1,31 @@
+#ifndef	_SYS_UN_H
+#define	_SYS_UN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_sa_family_t
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+struct sockaddr_un {
+	sa_family_t sun_family;
+	char sun_path[108];
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+size_t strlen(const char *);
+#define SUN_LEN(s) (2+strlen((s)->sun_path))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/user.h b/musl-include/aarch64/sys/user.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/user.h
@@ -0,0 +1,16 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <limits.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include <bits/user.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/utsname.h b/musl-include/aarch64/sys/utsname.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/utsname.h
@@ -0,0 +1,29 @@
+#ifndef	_SYS_UTSNAME_H
+#define	_SYS_UTSNAME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+struct utsname {
+	char sysname[65];
+	char nodename[65];
+	char release[65];
+	char version[65];
+	char machine[65];
+#ifdef _GNU_SOURCE
+	char domainname[65];
+#else
+	char __domainname[65];
+#endif
+};
+
+int uname (struct utsname *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/sys/vfs.h b/musl-include/aarch64/sys/vfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/vfs.h
@@ -0,0 +1,1 @@
+#include <sys/statfs.h>
diff --git a/musl-include/aarch64/sys/vt.h b/musl-include/aarch64/sys/vt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/vt.h
@@ -0,0 +1,1 @@
+#include <bits/vt.h>
diff --git a/musl-include/aarch64/sys/wait.h b/musl-include/aarch64/sys/wait.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/wait.h
@@ -0,0 +1,67 @@
+#ifndef	_SYS_WAIT_H
+#define	_SYS_WAIT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_id_t
+#include <bits/alltypes.h>
+
+typedef enum {
+	P_ALL = 0,
+	P_PID = 1,
+	P_PGID = 2,
+	P_PIDFD = 3
+} idtype_t;
+
+pid_t wait (int *);
+pid_t waitpid (pid_t, int *, int );
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#include <signal.h>
+int waitid (idtype_t, id_t, siginfo_t *, int);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#include <sys/resource.h>
+pid_t wait3 (int *, int, struct rusage *);
+pid_t wait4 (pid_t, int *, int, struct rusage *);
+#endif
+
+#define WNOHANG    1
+#define WUNTRACED  2
+
+#define WSTOPPED   2
+#define WEXITED    4
+#define WCONTINUED 8
+#define WNOWAIT    0x1000000
+
+#define __WNOTHREAD 0x20000000
+#define __WALL      0x40000000
+#define __WCLONE    0x80000000
+
+#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
+#define WTERMSIG(s) ((s) & 0x7f)
+#define WSTOPSIG(s) WEXITSTATUS(s)
+#define WCOREDUMP(s) ((s) & 0x80)
+#define WIFEXITED(s) (!WTERMSIG(s))
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
+#define WIFCONTINUED(s) ((s) == 0xffff)
+
+#if _REDIR_TIME64
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(wait3, __wait3_time64);
+__REDIR(wait4, __wait4_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/sys/xattr.h b/musl-include/aarch64/sys/xattr.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sys/xattr.h
@@ -0,0 +1,32 @@
+#ifndef	_SYS_XATTR_H
+#define	_SYS_XATTR_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_ssize_t
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+#define XATTR_CREATE 1
+#define XATTR_REPLACE 2
+
+ssize_t getxattr(const char *, const char *, void *, size_t);
+ssize_t lgetxattr(const char *, const char *, void *, size_t);
+ssize_t fgetxattr(int, const char *, void *, size_t);
+ssize_t listxattr(const char *, char *, size_t);
+ssize_t llistxattr(const char *, char *, size_t);
+ssize_t flistxattr(int, char *, size_t);
+int setxattr(const char *, const char *, const void *, size_t, int);
+int lsetxattr(const char *, const char *, const void *, size_t, int);
+int fsetxattr(int, const char *, const void *, size_t, int);
+int removexattr(const char *, const char *);
+int lremovexattr(const char *, const char *);
+int fremovexattr(int, const char *);
+
+#define __UAPI_DEF_XATTR        0
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/syscall.h b/musl-include/aarch64/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/syscall.h
@@ -0,0 +1,1 @@
+#include <sys/syscall.h>
diff --git a/musl-include/aarch64/sysexits.h b/musl-include/aarch64/sysexits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/sysexits.h
@@ -0,0 +1,21 @@
+#ifndef	_SYSEXITS_H
+#define _SYSEXITS_H
+#define EX_OK 0
+#define EX__BASE 64
+#define EX_USAGE 64
+#define EX_DATAERR 65
+#define EX_NOINPUT 66
+#define EX_NOUSER 67
+#define EX_NOHOST 68
+#define EX_UNAVAILABLE 69
+#define EX_SOFTWARE 70
+#define EX_OSERR 71
+#define EX_OSFILE 72
+#define EX_CANTCREAT 73
+#define EX_IOERR 74
+#define EX_TEMPFAIL 75
+#define EX_PROTOCOL 76
+#define EX_NOPERM 77
+#define EX_CONFIG 78
+#define EX__MAX 78
+#endif
diff --git a/musl-include/aarch64/syslog.h b/musl-include/aarch64/syslog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/syslog.h
@@ -0,0 +1,100 @@
+#ifndef _SYSLOG_H
+#define _SYSLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define LOG_EMERG   0
+#define LOG_ALERT   1
+#define LOG_CRIT    2
+#define LOG_ERR     3
+#define LOG_WARNING 4
+#define LOG_NOTICE  5
+#define LOG_INFO    6
+#define LOG_DEBUG   7
+
+#define LOG_PRIMASK 7
+#define LOG_PRI(p) ((p)&LOG_PRIMASK)
+#define	LOG_MAKEPRI(f, p) (((f)<<3)|(p))
+
+#define LOG_MASK(p) (1<<(p))
+#define LOG_UPTO(p) ((1<<((p)+1))-1)
+
+#define LOG_KERN     (0<<3)
+#define LOG_USER     (1<<3)
+#define LOG_MAIL     (2<<3)
+#define LOG_DAEMON   (3<<3)
+#define LOG_AUTH     (4<<3)
+#define LOG_SYSLOG   (5<<3)
+#define LOG_LPR      (6<<3)
+#define LOG_NEWS     (7<<3)
+#define LOG_UUCP     (8<<3)
+#define LOG_CRON     (9<<3)
+#define	LOG_AUTHPRIV (10<<3)
+#define	LOG_FTP      (11<<3)
+
+#define LOG_LOCAL0   (16<<3)
+#define LOG_LOCAL1   (17<<3)
+#define LOG_LOCAL2   (18<<3)
+#define LOG_LOCAL3   (19<<3)
+#define LOG_LOCAL4   (20<<3)
+#define LOG_LOCAL5   (21<<3)
+#define LOG_LOCAL6   (22<<3)
+#define LOG_LOCAL7   (23<<3)
+
+#define LOG_NFACILITIES 24
+#define LOG_FACMASK 0x3f8
+#define LOG_FAC(p) (((p)&LOG_FACMASK)>>3)
+
+#define LOG_PID    0x01
+#define LOG_CONS   0x02
+#define LOG_ODELAY 0x04
+#define LOG_NDELAY 0x08
+#define LOG_NOWAIT 0x10
+#define LOG_PERROR 0x20
+
+void closelog (void);
+void openlog (const char *, int, int);
+int setlogmask (int);
+void syslog (int, const char *, ...);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define _PATH_LOG "/dev/log"
+#define __NEED_va_list
+#include <bits/alltypes.h>
+void vsyslog (int, const char *, va_list);
+#if defined(SYSLOG_NAMES)
+#define	INTERNAL_NOPRI 0x10
+#define	INTERNAL_MARK (LOG_NFACILITIES<<3)
+typedef struct {
+	char *c_name;
+	int c_val;
+} CODE;
+#define prioritynames ((CODE *)(const CODE []){ \
+	{ "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, \
+	{ "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, \
+	{ "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, \
+	{ "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, \
+	{ "warn", LOG_WARNING }, { "warning", LOG_WARNING }, { 0, -1 } })
+#define facilitynames ((CODE *)(const CODE []){ \
+	{ "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, \
+	{ "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, \
+	{ "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, \
+	{ "mark", INTERNAL_MARK }, { "news", LOG_NEWS }, \
+	{ "security", LOG_AUTH }, { "syslog", LOG_SYSLOG }, \
+	{ "user", LOG_USER }, { "uucp", LOG_UUCP }, \
+	{ "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, \
+	{ "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, \
+	{ "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, \
+	{ "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { 0, -1 } })
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/tar.h b/musl-include/aarch64/tar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/tar.h
@@ -0,0 +1,33 @@
+#ifndef	_TAR_H
+#define	_TAR_H
+
+#define TSUID   04000
+#define TSGID   02000
+#define TSVTX   01000
+#define TUREAD  00400
+#define TUWRITE 00200
+#define TUEXEC  00100
+#define TGREAD  00040
+#define TGWRITE 00020
+#define TGEXEC  00010
+#define TOREAD  00004
+#define TOWRITE 00002
+#define TOEXEC  00001
+
+#define REGTYPE  '0'
+#define AREGTYPE '\0'
+#define LNKTYPE  '1'
+#define SYMTYPE  '2'
+#define CHRTYPE  '3'
+#define BLKTYPE  '4'
+#define DIRTYPE  '5'
+#define FIFOTYPE '6'
+#define CONTTYPE '7'
+
+#define TMAGIC "ustar"
+#define TMAGLEN 6
+
+#define TVERSION "00"
+#define TVERSLEN 2
+
+#endif
diff --git a/musl-include/aarch64/termios.h b/musl-include/aarch64/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/termios.h
@@ -0,0 +1,50 @@
+#ifndef	_TERMIOS_H
+#define	_TERMIOS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_struct_winsize
+
+#include <bits/alltypes.h>
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 32
+
+#include <bits/termios.h>
+
+speed_t cfgetospeed (const struct termios *);
+speed_t cfgetispeed (const struct termios *);
+int cfsetospeed (struct termios *, speed_t);
+int cfsetispeed (struct termios *, speed_t);
+
+int tcgetattr (int, struct termios *);
+int tcsetattr (int, int, const struct termios *);
+
+int tcgetwinsize (int, struct winsize *);
+int tcsetwinsize (int, const struct winsize *);
+
+int tcsendbreak (int, int);
+int tcdrain (int);
+int tcflush (int, int);
+int tcflow (int, int);
+
+pid_t tcgetsid (int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void cfmakeraw(struct termios *);
+int cfsetspeed(struct termios *, speed_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/tgmath.h b/musl-include/aarch64/tgmath.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/tgmath.h
@@ -0,0 +1,270 @@
+#ifndef _TGMATH_H
+#define _TGMATH_H
+
+/*
+the return types are only correct with gcc (__GNUC__)
+otherwise they are long double or long double complex
+
+the long double version of a function is never chosen when
+sizeof(double) == sizeof(long double)
+(but the return type is set correctly with gcc)
+*/
+
+#include <math.h>
+#include <complex.h>
+
+#define __IS_FP(x) (sizeof((x)+1ULL) == sizeof((x)+1.0f))
+#define __IS_CX(x) (__IS_FP(x) && sizeof(x) == sizeof((x)+I))
+#define __IS_REAL(x) (__IS_FP(x) && 2*sizeof(x) == sizeof((x)+I))
+
+#define __FLT(x) (__IS_REAL(x) && sizeof(x) == sizeof(float))
+#define __LDBL(x) (__IS_REAL(x) && sizeof(x) == sizeof(long double) && sizeof(long double) != sizeof(double))
+
+#define __FLTCX(x) (__IS_CX(x) && sizeof(x) == sizeof(float complex))
+#define __DBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(double complex))
+#define __LDBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(long double complex) && sizeof(long double) != sizeof(double))
+
+/* return type */
+
+#ifdef __GNUC__
+/*
+the result must be casted to the right type
+(otherwise the result type is determined by the conversion
+rules applied to all the function return types so it is long
+double or long double complex except for integral functions)
+
+this cannot be done in c99, so the typeof gcc extension is
+used and that the type of ?: depends on wether an operand is
+a null pointer constant or not
+(in c11 _Generic can be used)
+
+the c arguments below must be integer constant expressions
+so they can be in null pointer constants
+(__IS_FP above was carefully chosen this way)
+*/
+/* if c then t else void */
+#define __type1(c,t) __typeof__(*(0?(t*)0:(void*)!(c)))
+/* if c then t1 else t2 */
+#define __type2(c,t1,t2) __typeof__(*(0?(__type1(c,t1)*)0:(__type1(!(c),t2)*)0))
+/* cast to double when x is integral, otherwise use typeof(x) */
+#define __RETCAST(x) ( \
+	__type2(__IS_FP(x), __typeof__(x), double))
+/* 2 args case, should work for complex types (cpow) */
+#define __RETCAST_2(x, y) ( \
+	__type2(__IS_FP(x) && __IS_FP(y), \
+		__typeof__((x)+(y)), \
+		__typeof__((x)+(y)+1.0)))
+/* 3 args case (fma only) */
+#define __RETCAST_3(x, y, z) ( \
+	__type2(__IS_FP(x) && __IS_FP(y) && __IS_FP(z), \
+		__typeof__((x)+(y)+(z)), \
+		__typeof__((x)+(y)+(z)+1.0)))
+/* drop complex from the type of x */
+/* TODO: wrong when sizeof(long double)==sizeof(double) */
+#define __RETCAST_REAL(x) (  \
+	__type2(__IS_FP(x) && sizeof((x)+I) == sizeof(float complex), float, \
+	__type2(sizeof((x)+1.0+I) == sizeof(double complex), double, \
+		long double)))
+/* add complex to the type of x */
+#define __RETCAST_CX(x) (__typeof__(__RETCAST(x)0+I))
+#else
+#define __RETCAST(x)
+#define __RETCAST_2(x, y)
+#define __RETCAST_3(x, y, z)
+#define __RETCAST_REAL(x)
+#define __RETCAST_CX(x)
+#endif
+
+/* function selection */
+
+#define __tg_real_nocast(fun, x) ( \
+	__FLT(x) ? fun ## f (x) : \
+	__LDBL(x) ? fun ## l (x) : \
+	fun(x) )
+
+#define __tg_real(fun, x) (__RETCAST(x)__tg_real_nocast(fun, x))
+
+#define __tg_real_2_1(fun, x, y) (__RETCAST(x)( \
+	__FLT(x) ? fun ## f (x, y) : \
+	__LDBL(x) ? fun ## l (x, y) : \
+	fun(x, y) ))
+
+#define __tg_real_2(fun, x, y) (__RETCAST_2(x, y)( \
+	__FLT(x) && __FLT(y) ? fun ## f (x, y) : \
+	__LDBL((x)+(y)) ? fun ## l (x, y) : \
+	fun(x, y) ))
+
+#define __tg_complex(fun, x) (__RETCAST_CX(x)( \
+	__FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \
+	__LDBLCX((x)+I) ? fun ## l (x) : \
+	fun(x) ))
+
+#define __tg_complex_retreal(fun, x) (__RETCAST_REAL(x)( \
+	__FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \
+	__LDBLCX((x)+I) ? fun ## l (x) : \
+	fun(x) ))
+
+#define __tg_real_complex(fun, x) (__RETCAST(x)( \
+	__FLTCX(x) ? c ## fun ## f (x) : \
+	__DBLCX(x) ? c ## fun (x) : \
+	__LDBLCX(x) ? c ## fun ## l (x) : \
+	__FLT(x) ? fun ## f (x) : \
+	__LDBL(x) ? fun ## l (x) : \
+	fun(x) ))
+
+/* special cases */
+
+#define __tg_real_remquo(x, y, z) (__RETCAST_2(x, y)( \
+	__FLT(x) && __FLT(y) ? remquof(x, y, z) : \
+	__LDBL((x)+(y)) ? remquol(x, y, z) : \
+	remquo(x, y, z) ))
+
+#define __tg_real_fma(x, y, z) (__RETCAST_3(x, y, z)( \
+	__FLT(x) && __FLT(y) && __FLT(z) ? fmaf(x, y, z) : \
+	__LDBL((x)+(y)+(z)) ? fmal(x, y, z) : \
+	fma(x, y, z) ))
+
+#define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
+	__FLTCX((x)+(y)) && __IS_FP(x) && __IS_FP(y) ? cpowf(x, y) : \
+	__FLTCX((x)+(y)) ? cpow(x, y) : \
+	__DBLCX((x)+(y)) ? cpow(x, y) : \
+	__LDBLCX((x)+(y)) ? cpowl(x, y) : \
+	__FLT(x) && __FLT(y) ? powf(x, y) : \
+	__LDBL((x)+(y)) ? powl(x, y) : \
+	pow(x, y) ))
+
+#define __tg_real_complex_fabs(x) (__RETCAST_REAL(x)( \
+	__FLTCX(x) ? cabsf(x) : \
+	__DBLCX(x) ? cabs(x) : \
+	__LDBLCX(x) ? cabsl(x) : \
+	__FLT(x) ? fabsf(x) : \
+	__LDBL(x) ? fabsl(x) : \
+	fabs(x) ))
+
+/* suppress any macros in math.h or complex.h */
+
+#undef acos
+#undef acosh
+#undef asin
+#undef asinh
+#undef atan
+#undef atan2
+#undef atanh
+#undef carg
+#undef cbrt
+#undef ceil
+#undef cimag
+#undef conj
+#undef copysign
+#undef cos
+#undef cosh
+#undef cproj
+#undef creal
+#undef erf
+#undef erfc
+#undef exp
+#undef exp2
+#undef expm1
+#undef fabs
+#undef fdim
+#undef floor
+#undef fma
+#undef fmax
+#undef fmin
+#undef fmod
+#undef frexp
+#undef hypot
+#undef ilogb
+#undef ldexp
+#undef lgamma
+#undef llrint
+#undef llround
+#undef log
+#undef log10
+#undef log1p
+#undef log2
+#undef logb
+#undef lrint
+#undef lround
+#undef nearbyint
+#undef nextafter
+#undef nexttoward
+#undef pow
+#undef remainder
+#undef remquo
+#undef rint
+#undef round
+#undef scalbln
+#undef scalbn
+#undef sin
+#undef sinh
+#undef sqrt
+#undef tan
+#undef tanh
+#undef tgamma
+#undef trunc
+
+/* tg functions */
+
+#define acos(x)         __tg_real_complex(acos, (x))
+#define acosh(x)        __tg_real_complex(acosh, (x))
+#define asin(x)         __tg_real_complex(asin, (x))
+#define asinh(x)        __tg_real_complex(asinh, (x))
+#define atan(x)         __tg_real_complex(atan, (x))
+#define atan2(x,y)      __tg_real_2(atan2, (x), (y))
+#define atanh(x)        __tg_real_complex(atanh, (x))
+#define carg(x)         __tg_complex_retreal(carg, (x))
+#define cbrt(x)         __tg_real(cbrt, (x))
+#define ceil(x)         __tg_real(ceil, (x))
+#define cimag(x)        __tg_complex_retreal(cimag, (x))
+#define conj(x)         __tg_complex(conj, (x))
+#define copysign(x,y)   __tg_real_2(copysign, (x), (y))
+#define cos(x)          __tg_real_complex(cos, (x))
+#define cosh(x)         __tg_real_complex(cosh, (x))
+#define cproj(x)        __tg_complex(cproj, (x))
+#define creal(x)        __tg_complex_retreal(creal, (x))
+#define erf(x)          __tg_real(erf, (x))
+#define erfc(x)         __tg_real(erfc, (x))
+#define exp(x)          __tg_real_complex(exp, (x))
+#define exp2(x)         __tg_real(exp2, (x))
+#define expm1(x)        __tg_real(expm1, (x))
+#define fabs(x)         __tg_real_complex_fabs(x)
+#define fdim(x,y)       __tg_real_2(fdim, (x), (y))
+#define floor(x)        __tg_real(floor, (x))
+#define fma(x,y,z)      __tg_real_fma((x), (y), (z))
+#define fmax(x,y)       __tg_real_2(fmax, (x), (y))
+#define fmin(x,y)       __tg_real_2(fmin, (x), (y))
+#define fmod(x,y)       __tg_real_2(fmod, (x), (y))
+#define frexp(x,y)      __tg_real_2_1(frexp, (x), (y))
+#define hypot(x,y)      __tg_real_2(hypot, (x), (y))
+#define ilogb(x)        __tg_real_nocast(ilogb, (x))
+#define ldexp(x,y)      __tg_real_2_1(ldexp, (x), (y))
+#define lgamma(x)       __tg_real(lgamma, (x))
+#define llrint(x)       __tg_real_nocast(llrint, (x))
+#define llround(x)      __tg_real_nocast(llround, (x))
+#define log(x)          __tg_real_complex(log, (x))
+#define log10(x)        __tg_real(log10, (x))
+#define log1p(x)        __tg_real(log1p, (x))
+#define log2(x)         __tg_real(log2, (x))
+#define logb(x)         __tg_real(logb, (x))
+#define lrint(x)        __tg_real_nocast(lrint, (x))
+#define lround(x)       __tg_real_nocast(lround, (x))
+#define nearbyint(x)    __tg_real(nearbyint, (x))
+#define nextafter(x,y)  __tg_real_2(nextafter, (x), (y))
+#define nexttoward(x,y) __tg_real_2(nexttoward, (x), (y))
+#define pow(x,y)        __tg_real_complex_pow((x), (y))
+#define remainder(x,y)  __tg_real_2(remainder, (x), (y))
+#define remquo(x,y,z)   __tg_real_remquo((x), (y), (z))
+#define rint(x)         __tg_real(rint, (x))
+#define round(x)        __tg_real(round, (x))
+#define scalbln(x,y)    __tg_real_2_1(scalbln, (x), (y))
+#define scalbn(x,y)     __tg_real_2_1(scalbn, (x), (y))
+#define sin(x)          __tg_real_complex(sin, (x))
+#define sinh(x)         __tg_real_complex(sinh, (x))
+#define sqrt(x)         __tg_real_complex(sqrt, (x))
+#define tan(x)          __tg_real_complex(tan, (x))
+#define tanh(x)         __tg_real_complex(tanh, (x))
+#define tgamma(x)       __tg_real(tgamma, (x))
+#define trunc(x)        __tg_real(trunc, (x))
+
+#endif
diff --git a/musl-include/aarch64/threads.h b/musl-include/aarch64/threads.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/threads.h
@@ -0,0 +1,93 @@
+#ifndef _THREADS_H
+#define _THREADS_H
+
+#include <features.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+typedef unsigned long thrd_t;
+#else
+typedef struct __pthread *thrd_t;
+#define thread_local _Thread_local
+#endif
+
+typedef int once_flag;
+typedef unsigned tss_t;
+typedef int (*thrd_start_t)(void *);
+typedef void (*tss_dtor_t)(void *);
+
+#define __NEED_cnd_t
+#define __NEED_mtx_t
+
+#include <bits/alltypes.h>
+
+#define TSS_DTOR_ITERATIONS 4
+
+enum {
+	thrd_success  = 0,
+	thrd_busy     = 1,
+	thrd_error    = 2,
+	thrd_nomem    = 3,
+	thrd_timedout = 4,
+};
+
+enum {
+	mtx_plain     = 0,
+	mtx_recursive = 1,
+	mtx_timed     = 2,
+};
+
+#define ONCE_FLAG_INIT 0
+
+int thrd_create(thrd_t *, thrd_start_t, void *);
+_Noreturn void thrd_exit(int);
+
+int thrd_detach(thrd_t);
+int thrd_join(thrd_t, int *);
+
+int thrd_sleep(const struct timespec *, struct timespec *);
+void thrd_yield(void);
+
+thrd_t thrd_current(void);
+int thrd_equal(thrd_t, thrd_t);
+#ifndef __cplusplus
+#define thrd_equal(A, B) ((A) == (B))
+#endif
+
+void call_once(once_flag *, void (*)(void));
+
+int mtx_init(mtx_t *, int);
+void mtx_destroy(mtx_t *);
+
+int mtx_lock(mtx_t *);
+int mtx_timedlock(mtx_t *__restrict, const struct timespec *__restrict);
+int mtx_trylock(mtx_t *);
+int mtx_unlock(mtx_t *);
+
+int cnd_init(cnd_t *);
+void cnd_destroy(cnd_t *);
+
+int cnd_broadcast(cnd_t *);
+int cnd_signal(cnd_t *);
+
+int cnd_timedwait(cnd_t *__restrict, mtx_t *__restrict, const struct timespec *__restrict);
+int cnd_wait(cnd_t *, mtx_t *);
+
+int tss_create(tss_t *, tss_dtor_t);
+void tss_delete(tss_t);
+
+int tss_set(tss_t, void *);
+void *tss_get(tss_t);
+
+#if _REDIR_TIME64
+__REDIR(thrd_sleep, __thrd_sleep_time64);
+__REDIR(mtx_timedlock, __mtx_timedlock_time64);
+__REDIR(cnd_timedwait, __cnd_timedwait_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/time.h b/musl-include/aarch64/time.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/time.h
@@ -0,0 +1,168 @@
+#ifndef	_TIME_H
+#define _TIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+
+#define __NEED_size_t
+#define __NEED_time_t
+#define __NEED_clock_t
+#define __NEED_struct_timespec
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_clockid_t
+#define __NEED_timer_t
+#define __NEED_pid_t
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define __tm_gmtoff tm_gmtoff
+#define __tm_zone tm_zone
+#endif
+
+struct tm {
+	int tm_sec;
+	int tm_min;
+	int tm_hour;
+	int tm_mday;
+	int tm_mon;
+	int tm_year;
+	int tm_wday;
+	int tm_yday;
+	int tm_isdst;
+	long __tm_gmtoff;
+	const char *__tm_zone;
+};
+
+clock_t clock (void);
+time_t time (time_t *);
+double difftime (time_t, time_t);
+time_t mktime (struct tm *);
+size_t strftime (char *__restrict, size_t, const char *__restrict, const struct tm *__restrict);
+struct tm *gmtime (const time_t *);
+struct tm *localtime (const time_t *);
+char *asctime (const struct tm *);
+char *ctime (const time_t *);
+int timespec_get(struct timespec *, int);
+
+#define CLOCKS_PER_SEC 1000000L
+
+#define TIME_UTC 1
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+size_t strftime_l (char *  __restrict, size_t, const char *  __restrict, const struct tm *  __restrict, locale_t);
+
+struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict);
+struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict);
+char *asctime_r (const struct tm *__restrict, char *__restrict);
+char *ctime_r (const time_t *, char *);
+
+void tzset (void);
+
+struct itimerspec {
+	struct timespec it_interval;
+	struct timespec it_value;
+};
+
+#define CLOCK_REALTIME           0
+#define CLOCK_MONOTONIC          1
+#define CLOCK_PROCESS_CPUTIME_ID 2
+#define CLOCK_THREAD_CPUTIME_ID  3
+#define CLOCK_MONOTONIC_RAW      4
+#define CLOCK_REALTIME_COARSE    5
+#define CLOCK_MONOTONIC_COARSE   6
+#define CLOCK_BOOTTIME           7
+#define CLOCK_REALTIME_ALARM     8
+#define CLOCK_BOOTTIME_ALARM     9
+#define CLOCK_SGI_CYCLE         10
+#define CLOCK_TAI               11
+
+#define TIMER_ABSTIME 1
+
+int nanosleep (const struct timespec *, struct timespec *);
+int clock_getres (clockid_t, struct timespec *);
+int clock_gettime (clockid_t, struct timespec *);
+int clock_settime (clockid_t, const struct timespec *);
+int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *);
+int clock_getcpuclockid (pid_t, clockid_t *);
+
+struct sigevent;
+int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict);
+int timer_delete (timer_t);
+int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict);
+int timer_gettime (timer_t, struct itimerspec *);
+int timer_getoverrun (timer_t);
+
+extern char *tzname[2];
+
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+char *strptime (const char *__restrict, const char *__restrict, struct tm *__restrict);
+extern int daylight;
+extern long timezone;
+extern int getdate_err;
+struct tm *getdate (const char *);
+#endif
+
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int stime(const time_t *);
+time_t timegm(struct tm *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(time, __time64);
+__REDIR(difftime, __difftime64);
+__REDIR(mktime, __mktime64);
+__REDIR(gmtime, __gmtime64);
+__REDIR(localtime, __localtime64);
+__REDIR(ctime, __ctime64);
+__REDIR(timespec_get, __timespec_get_time64);
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+__REDIR(gmtime_r, __gmtime64_r);
+__REDIR(localtime_r, __localtime64_r);
+__REDIR(ctime_r, __ctime64_r);
+__REDIR(nanosleep, __nanosleep_time64);
+__REDIR(clock_getres, __clock_getres_time64);
+__REDIR(clock_gettime, __clock_gettime64);
+__REDIR(clock_settime, __clock_settime64);
+__REDIR(clock_nanosleep, __clock_nanosleep_time64);
+__REDIR(timer_settime, __timer_settime64);
+__REDIR(timer_gettime, __timer_gettime64);
+#endif
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(stime, __stime64);
+__REDIR(timegm, __timegm_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/musl-include/aarch64/uchar.h b/musl-include/aarch64/uchar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/uchar.h
@@ -0,0 +1,29 @@
+#ifndef _UCHAR_H
+#define _UCHAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if __cplusplus < 201103L
+typedef unsigned short char16_t;
+typedef unsigned char32_t;
+#endif
+
+#define __NEED_mbstate_t
+#define __NEED_size_t
+
+#include <features.h>
+#include <bits/alltypes.h>
+
+size_t c16rtomb(char *__restrict, char16_t, mbstate_t *__restrict);
+size_t mbrtoc16(char16_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+
+size_t c32rtomb(char *__restrict, char32_t, mbstate_t *__restrict);
+size_t mbrtoc32(char32_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/ucontext.h b/musl-include/aarch64/ucontext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/ucontext.h
@@ -0,0 +1,25 @@
+#ifndef _UCONTEXT_H
+#define _UCONTEXT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <signal.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define NGREG (sizeof(gregset_t)/sizeof(greg_t))
+#endif
+
+struct __ucontext;
+
+int  getcontext(struct __ucontext *);
+void makecontext(struct __ucontext *, void (*)(), int, ...);
+int  setcontext(const struct __ucontext *);
+int  swapcontext(struct __ucontext *, const struct __ucontext *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/aarch64/ulimit.h b/musl-include/aarch64/ulimit.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/ulimit.h
@@ -0,0 +1,17 @@
+#ifndef _ULIMIT_H
+#define _ULIMIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UL_GETFSIZE 1
+#define UL_SETFSIZE 2
+
+long ulimit (int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/unistd.h b/musl-include/aarch64/unistd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/unistd.h
@@ -0,0 +1,479 @@
+#ifndef	_UNISTD_H
+#define	_UNISTD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define STDIN_FILENO  0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+#define SEEK_DATA 3
+#define SEEK_HOLE 4
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_intptr_t
+#define __NEED_useconds_t
+
+#include <bits/alltypes.h>
+
+int pipe(int [2]);
+int pipe2(int [2], int);
+int close(int);
+int posix_close(int, int);
+int dup(int);
+int dup2(int, int);
+int dup3(int, int, int);
+off_t lseek(int, off_t, int);
+int fsync(int);
+int fdatasync(int);
+
+ssize_t read(int, void *, size_t);
+ssize_t write(int, const void *, size_t);
+ssize_t pread(int, void *, size_t, off_t);
+ssize_t pwrite(int, const void *, size_t, off_t);
+
+int chown(const char *, uid_t, gid_t);
+int fchown(int, uid_t, gid_t);
+int lchown(const char *, uid_t, gid_t);
+int fchownat(int, const char *, uid_t, gid_t, int);
+
+int link(const char *, const char *);
+int linkat(int, const char *, int, const char *, int);
+int symlink(const char *, const char *);
+int symlinkat(const char *, int, const char *);
+ssize_t readlink(const char *__restrict, char *__restrict, size_t);
+ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t);
+int unlink(const char *);
+int unlinkat(int, const char *, int);
+int rmdir(const char *);
+int truncate(const char *, off_t);
+int ftruncate(int, off_t);
+
+#define F_OK 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+
+int access(const char *, int);
+int faccessat(int, const char *, int, int);
+
+int chdir(const char *);
+int fchdir(int);
+char *getcwd(char *, size_t);
+
+unsigned alarm(unsigned);
+unsigned sleep(unsigned);
+int pause(void);
+
+pid_t fork(void);
+pid_t _Fork(void);
+int execve(const char *, char *const [], char *const []);
+int execv(const char *, char *const []);
+int execle(const char *, const char *, ...);
+int execl(const char *, const char *, ...);
+int execvp(const char *, char *const []);
+int execlp(const char *, const char *, ...);
+int fexecve(int, char *const [], char *const []);
+_Noreturn void _exit(int);
+
+pid_t getpid(void);
+pid_t getppid(void);
+pid_t getpgrp(void);
+pid_t getpgid(pid_t);
+int setpgid(pid_t, pid_t);
+pid_t setsid(void);
+pid_t getsid(pid_t);
+char *ttyname(int);
+int ttyname_r(int, char *, size_t);
+int isatty(int);
+pid_t tcgetpgrp(int);
+int tcsetpgrp(int, pid_t);
+
+uid_t getuid(void);
+uid_t geteuid(void);
+gid_t getgid(void);
+gid_t getegid(void);
+int getgroups(int, gid_t []);
+int setuid(uid_t);
+int seteuid(uid_t);
+int setgid(gid_t);
+int setegid(gid_t);
+
+char *getlogin(void);
+int getlogin_r(char *, size_t);
+int gethostname(char *, size_t);
+char *ctermid(char *);
+
+int getopt(int, char * const [], const char *);
+extern char *optarg;
+extern int optind, opterr, optopt;
+
+long pathconf(const char *, int);
+long fpathconf(int, int);
+long sysconf(int);
+size_t confstr(int, char *, size_t);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define F_ULOCK 0
+#define F_LOCK  1
+#define F_TLOCK 2
+#define F_TEST  3
+int setreuid(uid_t, uid_t);
+int setregid(gid_t, gid_t);
+int lockf(int, int, off_t);
+long gethostid(void);
+int nice(int);
+void sync(void);
+pid_t setpgrp(void);
+char *crypt(const char *, const char *);
+void encrypt(char *, int);
+void swab(const void *__restrict, void *__restrict, ssize_t);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+int usleep(unsigned);
+unsigned ualarm(unsigned, unsigned);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define L_SET 0
+#define L_INCR 1
+#define L_XTND 2
+int brk(void *);
+void *sbrk(intptr_t);
+pid_t vfork(void);
+int vhangup(void);
+int chroot(const char *);
+int getpagesize(void);
+int getdtablesize(void);
+int sethostname(const char *, size_t);
+int getdomainname(char *, size_t);
+int setdomainname(const char *, size_t);
+int setgroups(size_t, const gid_t *);
+char *getpass(const char *);
+int daemon(int, int);
+void setusershell(void);
+void endusershell(void);
+char *getusershell(void);
+int acct(const char *);
+long syscall(long, ...);
+int execvpe(const char *, char *const [], char *const []);
+int issetugid(void);
+int getentropy(void *, size_t);
+extern int optreset;
+#endif
+
+#ifdef _GNU_SOURCE
+extern char **environ;
+int setresuid(uid_t, uid_t, uid_t);
+int setresgid(gid_t, gid_t, gid_t);
+int getresuid(uid_t *, uid_t *, uid_t *);
+int getresgid(gid_t *, gid_t *, gid_t *);
+char *get_current_dir_name(void);
+int syncfs(int);
+int euidaccess(const char *, int);
+int eaccess(const char *, int);
+ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
+pid_t gettid(void);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define lseek64 lseek
+#define pread64 pread
+#define pwrite64 pwrite
+#define truncate64 truncate
+#define ftruncate64 ftruncate
+#define lockf64 lockf
+#define off64_t off_t
+#endif
+
+#define POSIX_CLOSE_RESTART     0
+
+#define _XOPEN_VERSION          700
+#define _XOPEN_UNIX             1
+#define _XOPEN_ENH_I18N         1
+
+#define _POSIX_VERSION          200809L
+#define _POSIX2_VERSION         _POSIX_VERSION
+
+#define _POSIX_ADVISORY_INFO    _POSIX_VERSION
+#define _POSIX_CHOWN_RESTRICTED 1
+#define _POSIX_IPV6             _POSIX_VERSION
+#define _POSIX_JOB_CONTROL      1
+#define _POSIX_MAPPED_FILES     _POSIX_VERSION
+#define _POSIX_MEMLOCK          _POSIX_VERSION
+#define _POSIX_MEMLOCK_RANGE    _POSIX_VERSION
+#define _POSIX_MEMORY_PROTECTION _POSIX_VERSION
+#define _POSIX_MESSAGE_PASSING  _POSIX_VERSION
+#define _POSIX_FSYNC            _POSIX_VERSION
+#define _POSIX_NO_TRUNC         1
+#define _POSIX_RAW_SOCKETS      _POSIX_VERSION
+#define _POSIX_REALTIME_SIGNALS _POSIX_VERSION
+#define _POSIX_REGEXP           1
+#define _POSIX_SAVED_IDS        1
+#define _POSIX_SHELL            1
+#define _POSIX_SPAWN            _POSIX_VERSION
+#define _POSIX_VDISABLE         0
+
+#define _POSIX_THREADS          _POSIX_VERSION
+#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
+#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
+#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
+#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
+#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
+#define _POSIX_THREAD_CPUTIME   _POSIX_VERSION
+#define _POSIX_TIMERS           _POSIX_VERSION
+#define _POSIX_TIMEOUTS         _POSIX_VERSION
+#define _POSIX_MONOTONIC_CLOCK  _POSIX_VERSION
+#define _POSIX_CPUTIME          _POSIX_VERSION
+#define _POSIX_CLOCK_SELECTION  _POSIX_VERSION
+#define _POSIX_BARRIERS         _POSIX_VERSION
+#define _POSIX_SPIN_LOCKS       _POSIX_VERSION
+#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION
+#define _POSIX_ASYNCHRONOUS_IO  _POSIX_VERSION
+#define _POSIX_SEMAPHORES       _POSIX_VERSION
+#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION
+
+#define _POSIX2_C_BIND          _POSIX_VERSION
+
+#include <bits/posix.h>
+
+
+
+#define _PC_LINK_MAX	0
+#define _PC_MAX_CANON	1
+#define _PC_MAX_INPUT	2
+#define _PC_NAME_MAX	3
+#define _PC_PATH_MAX	4
+#define _PC_PIPE_BUF	5
+#define _PC_CHOWN_RESTRICTED	6
+#define _PC_NO_TRUNC	7
+#define _PC_VDISABLE	8
+#define _PC_SYNC_IO	9
+#define _PC_ASYNC_IO	10
+#define _PC_PRIO_IO	11
+#define _PC_SOCK_MAXBUF	12
+#define _PC_FILESIZEBITS	13
+#define _PC_REC_INCR_XFER_SIZE	14
+#define _PC_REC_MAX_XFER_SIZE	15
+#define _PC_REC_MIN_XFER_SIZE	16
+#define _PC_REC_XFER_ALIGN	17
+#define _PC_ALLOC_SIZE_MIN	18
+#define _PC_SYMLINK_MAX	19
+#define _PC_2_SYMLINKS	20
+
+#define _SC_ARG_MAX	0
+#define _SC_CHILD_MAX	1
+#define _SC_CLK_TCK	2
+#define _SC_NGROUPS_MAX	3
+#define _SC_OPEN_MAX	4
+#define _SC_STREAM_MAX	5
+#define _SC_TZNAME_MAX	6
+#define _SC_JOB_CONTROL	7
+#define _SC_SAVED_IDS	8
+#define _SC_REALTIME_SIGNALS	9
+#define _SC_PRIORITY_SCHEDULING	10
+#define _SC_TIMERS	11
+#define _SC_ASYNCHRONOUS_IO	12
+#define _SC_PRIORITIZED_IO	13
+#define _SC_SYNCHRONIZED_IO	14
+#define _SC_FSYNC	15
+#define _SC_MAPPED_FILES	16
+#define _SC_MEMLOCK	17
+#define _SC_MEMLOCK_RANGE	18
+#define _SC_MEMORY_PROTECTION	19
+#define _SC_MESSAGE_PASSING	20
+#define _SC_SEMAPHORES	21
+#define _SC_SHARED_MEMORY_OBJECTS	22
+#define _SC_AIO_LISTIO_MAX	23
+#define _SC_AIO_MAX	24
+#define _SC_AIO_PRIO_DELTA_MAX	25
+#define _SC_DELAYTIMER_MAX	26
+#define _SC_MQ_OPEN_MAX	27
+#define _SC_MQ_PRIO_MAX	28
+#define _SC_VERSION	29
+#define _SC_PAGE_SIZE	30
+#define _SC_PAGESIZE	30 /* !! */
+#define _SC_RTSIG_MAX	31
+#define _SC_SEM_NSEMS_MAX	32
+#define _SC_SEM_VALUE_MAX	33
+#define _SC_SIGQUEUE_MAX	34
+#define _SC_TIMER_MAX	35
+#define _SC_BC_BASE_MAX	36
+#define _SC_BC_DIM_MAX	37
+#define _SC_BC_SCALE_MAX	38
+#define _SC_BC_STRING_MAX	39
+#define _SC_COLL_WEIGHTS_MAX	40
+#define _SC_EXPR_NEST_MAX	42
+#define _SC_LINE_MAX	43
+#define _SC_RE_DUP_MAX	44
+#define _SC_2_VERSION	46
+#define _SC_2_C_BIND	47
+#define _SC_2_C_DEV	48
+#define _SC_2_FORT_DEV	49
+#define _SC_2_FORT_RUN	50
+#define _SC_2_SW_DEV	51
+#define _SC_2_LOCALEDEF	52
+#define _SC_UIO_MAXIOV	60 /* !! */
+#define _SC_IOV_MAX	60
+#define _SC_THREADS	67
+#define _SC_THREAD_SAFE_FUNCTIONS	68
+#define _SC_GETGR_R_SIZE_MAX	69
+#define _SC_GETPW_R_SIZE_MAX	70
+#define _SC_LOGIN_NAME_MAX	71
+#define _SC_TTY_NAME_MAX	72
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS	73
+#define _SC_THREAD_KEYS_MAX	74
+#define _SC_THREAD_STACK_MIN	75
+#define _SC_THREAD_THREADS_MAX	76
+#define _SC_THREAD_ATTR_STACKADDR	77
+#define _SC_THREAD_ATTR_STACKSIZE	78
+#define _SC_THREAD_PRIORITY_SCHEDULING	79
+#define _SC_THREAD_PRIO_INHERIT	80
+#define _SC_THREAD_PRIO_PROTECT	81
+#define _SC_THREAD_PROCESS_SHARED	82
+#define _SC_NPROCESSORS_CONF	83
+#define _SC_NPROCESSORS_ONLN	84
+#define _SC_PHYS_PAGES	85
+#define _SC_AVPHYS_PAGES	86
+#define _SC_ATEXIT_MAX	87
+#define _SC_PASS_MAX	88
+#define _SC_XOPEN_VERSION	89
+#define _SC_XOPEN_XCU_VERSION	90
+#define _SC_XOPEN_UNIX	91
+#define _SC_XOPEN_CRYPT	92
+#define _SC_XOPEN_ENH_I18N	93
+#define _SC_XOPEN_SHM	94
+#define _SC_2_CHAR_TERM	95
+#define _SC_2_UPE	97
+#define _SC_XOPEN_XPG2	98
+#define _SC_XOPEN_XPG3	99
+#define _SC_XOPEN_XPG4	100
+#define _SC_NZERO	109
+#define _SC_XBS5_ILP32_OFF32	125
+#define _SC_XBS5_ILP32_OFFBIG	126
+#define _SC_XBS5_LP64_OFF64	127
+#define _SC_XBS5_LPBIG_OFFBIG	128
+#define _SC_XOPEN_LEGACY	129
+#define _SC_XOPEN_REALTIME	130
+#define _SC_XOPEN_REALTIME_THREADS	131
+#define _SC_ADVISORY_INFO	132
+#define _SC_BARRIERS	133
+#define _SC_CLOCK_SELECTION	137
+#define _SC_CPUTIME	138
+#define _SC_THREAD_CPUTIME	139
+#define _SC_MONOTONIC_CLOCK	149
+#define _SC_READER_WRITER_LOCKS	153
+#define _SC_SPIN_LOCKS	154
+#define _SC_REGEXP	155
+#define _SC_SHELL	157
+#define _SC_SPAWN	159
+#define _SC_SPORADIC_SERVER	160
+#define _SC_THREAD_SPORADIC_SERVER	161
+#define _SC_TIMEOUTS	164
+#define _SC_TYPED_MEMORY_OBJECTS	165
+#define _SC_2_PBS	168
+#define _SC_2_PBS_ACCOUNTING	169
+#define _SC_2_PBS_LOCATE	170
+#define _SC_2_PBS_MESSAGE	171
+#define _SC_2_PBS_TRACK	172
+#define _SC_SYMLOOP_MAX	173
+#define _SC_STREAMS	174
+#define _SC_2_PBS_CHECKPOINT	175
+#define _SC_V6_ILP32_OFF32	176
+#define _SC_V6_ILP32_OFFBIG	177
+#define _SC_V6_LP64_OFF64	178
+#define _SC_V6_LPBIG_OFFBIG	179
+#define _SC_HOST_NAME_MAX	180
+#define _SC_TRACE	181
+#define _SC_TRACE_EVENT_FILTER	182
+#define _SC_TRACE_INHERIT	183
+#define _SC_TRACE_LOG	184
+
+#define _SC_IPV6	235
+#define _SC_RAW_SOCKETS	236
+#define _SC_V7_ILP32_OFF32	237
+#define _SC_V7_ILP32_OFFBIG	238
+#define _SC_V7_LP64_OFF64	239
+#define _SC_V7_LPBIG_OFFBIG	240
+#define _SC_SS_REPL_MAX	241
+#define _SC_TRACE_EVENT_NAME_MAX	242
+#define _SC_TRACE_NAME_MAX	243
+#define _SC_TRACE_SYS_MAX	244
+#define _SC_TRACE_USER_EVENT_MAX	245
+#define _SC_XOPEN_STREAMS	246
+#define _SC_THREAD_ROBUST_PRIO_INHERIT	247
+#define _SC_THREAD_ROBUST_PRIO_PROTECT	248
+#define _SC_MINSIGSTKSZ	249
+#define _SC_SIGSTKSZ	250
+
+#define _CS_PATH	0
+#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS	1
+#define _CS_GNU_LIBC_VERSION	2
+#define _CS_GNU_LIBPTHREAD_VERSION	3
+#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS	4
+#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS	5
+
+#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS	1116
+#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS	1117
+#define _CS_POSIX_V6_ILP32_OFF32_LIBS	1118
+#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS	1119
+#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS	1120
+#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS	1121
+#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS	1122
+#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS	1123
+#define _CS_POSIX_V6_LP64_OFF64_CFLAGS	1124
+#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS	1125
+#define _CS_POSIX_V6_LP64_OFF64_LIBS	1126
+#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS	1127
+#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS	1128
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS	1129
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS	1130
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS	1131
+#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS	1132
+#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS	1133
+#define _CS_POSIX_V7_ILP32_OFF32_LIBS	1134
+#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS	1135
+#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS	1136
+#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS	1137
+#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS	1138
+#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS	1139
+#define _CS_POSIX_V7_LP64_OFF64_CFLAGS	1140
+#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS	1141
+#define _CS_POSIX_V7_LP64_OFF64_LIBS	1142
+#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS	1143
+#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS	1144
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS	1145
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS	1146
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS	1147
+#define _CS_V6_ENV	1148
+#define _CS_V7_ENV	1149
+#define _CS_POSIX_V7_THREADS_CFLAGS	1150
+#define _CS_POSIX_V7_THREADS_LDFLAGS	1151
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/utime.h b/musl-include/aarch64/utime.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/utime.h
@@ -0,0 +1,29 @@
+#ifndef	_UTIME_H
+#define	_UTIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+
+#include <bits/alltypes.h>
+
+struct utimbuf {
+	time_t actime;
+	time_t modtime;
+};
+
+int utime (const char *, const struct utimbuf *);
+
+#if _REDIR_TIME64
+__REDIR(utime, __utime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/utmp.h b/musl-include/aarch64/utmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/utmp.h
@@ -0,0 +1,52 @@
+#ifndef _UTMP_H
+#define _UTMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <utmpx.h>
+
+#define ACCOUNTING 9
+#define UT_NAMESIZE 32
+#define UT_HOSTSIZE 256
+#define UT_LINESIZE 32
+
+struct lastlog {
+	time_t ll_time;
+	char ll_line[UT_LINESIZE];
+	char ll_host[UT_HOSTSIZE];
+};
+
+#define ut_time ut_tv.tv_sec
+#define ut_name ut_user
+#define ut_addr ut_addr_v6[0]
+#define utmp utmpx
+#define e_exit __e_exit
+#define e_termination __e_termination
+
+void         endutent(void);
+struct utmp *getutent(void);
+struct utmp *getutid(const struct utmp *);
+struct utmp *getutline(const struct utmp *);
+struct utmp *pututline(const struct utmp *);
+void         setutent(void);
+
+void updwtmp(const char *, const struct utmp *);
+int utmpname(const char *);
+
+int login_tty(int);
+
+#define _PATH_UTMP "/dev/null/utmp"
+#define _PATH_WTMP "/dev/null/wtmp"
+
+#define UTMP_FILE _PATH_UTMP
+#define WTMP_FILE _PATH_WTMP
+#define UTMP_FILENAME _PATH_UTMP
+#define WTMP_FILENAME _PATH_WTMP
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/utmpx.h b/musl-include/aarch64/utmpx.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/utmpx.h
@@ -0,0 +1,67 @@
+#ifndef _UTMPX_H
+#define _UTMPX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_struct_timeval
+
+#include <bits/alltypes.h>
+
+struct utmpx {
+	short ut_type;
+	short __ut_pad1;
+	pid_t ut_pid;
+	char ut_line[32];
+	char ut_id[4];
+	char ut_user[32];
+	char ut_host[256];
+	struct {
+		short __e_termination;
+		short __e_exit;
+	} ut_exit;
+#if __BYTE_ORDER == 1234
+	int ut_session, __ut_pad2;
+#else
+	int __ut_pad2, ut_session;
+#endif
+	struct timeval ut_tv;
+	unsigned ut_addr_v6[4];
+	char __unused[20];
+};
+
+void          endutxent(void);
+struct utmpx *getutxent(void);
+struct utmpx *getutxid(const struct utmpx *);
+struct utmpx *getutxline(const struct utmpx *);
+struct utmpx *pututxline(const struct utmpx *);
+void          setutxent(void);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define e_exit __e_exit
+#define e_termination __e_termination
+void updwtmpx(const char *, const struct utmpx *);
+int utmpxname(const char *);
+#endif
+
+#define EMPTY           0
+#define RUN_LVL         1
+#define BOOT_TIME       2
+#define NEW_TIME        3
+#define OLD_TIME        4
+#define INIT_PROCESS    5
+#define LOGIN_PROCESS   6
+#define USER_PROCESS    7
+#define DEAD_PROCESS    8
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/values.h b/musl-include/aarch64/values.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/values.h
@@ -0,0 +1,39 @@
+#ifndef _VALUES_H
+#define _VALUES_H
+
+#include <limits.h>
+
+#define CHARBITS   (sizeof(char)   * 8)
+#define SHORTBITS  (sizeof(short)  * 8)
+#define INTBITS    (sizeof(int)    * 8)
+#define LONGBITS   (sizeof(long)   * 8)
+#define PTRBITS    (sizeof(char *) * 8)
+#define DOUBLEBITS (sizeof(double) * 8)
+#define FLOATBITS  (sizeof(float)  * 8)
+
+#define MINSHORT SHRT_MIN
+#define MININT   INT_MIN
+#define MINLONG  LONG_MIN
+
+#define MAXSHORT SHRT_MAX
+#define MAXINT   INT_MAX
+#define MAXLONG  LONG_MAX
+
+#define HIBITS   MINSHORT
+#define HIBITL   MINLONG
+
+#include <float.h>
+
+#define MAXDOUBLE DBL_MAX
+#undef  MAXFLOAT
+#define MAXFLOAT  FLT_MAX
+#define MINDOUBLE DBL_MIN
+#define MINFLOAT  FLT_MIN
+#define DMINEXP   DBL_MIN_EXP
+#define FMINEXP   FLT_MIN_EXP
+#define DMAXEXP   DBL_MAX_EXP
+#define FMAXEXP   FLT_MAX_EXP
+
+#define BITSPERBYTE CHAR_BIT
+
+#endif
diff --git a/musl-include/aarch64/wait.h b/musl-include/aarch64/wait.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/wait.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <wait.h> to <sys/wait.h>
+#include <sys/wait.h>
diff --git a/musl-include/aarch64/wchar.h b/musl-include/aarch64/wchar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/wchar.h
@@ -0,0 +1,207 @@
+#ifndef _WCHAR_H
+#define _WCHAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_FILE
+#define __NEED___isoc_va_list
+#define __NEED_size_t
+#define __NEED_wchar_t
+#define __NEED_wint_t
+#define __NEED_mbstate_t
+
+#if __STDC_VERSION__ < 201112L
+#define __NEED_struct__IO_FILE
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#define __NEED_va_list
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_wctype_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#undef WEOF
+#define WEOF 0xffffffffU
+
+wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+int wcscmp (const wchar_t *, const wchar_t *);
+int wcsncmp (const wchar_t *, const wchar_t *, size_t);
+
+int wcscoll(const wchar_t *, const wchar_t *);
+size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+wchar_t *wcschr (const wchar_t *, wchar_t);
+wchar_t *wcsrchr (const wchar_t *, wchar_t);
+
+size_t wcscspn (const wchar_t *, const wchar_t *);
+size_t wcsspn (const wchar_t *, const wchar_t *);
+wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
+
+wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
+
+size_t wcslen (const wchar_t *);
+
+wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcswcs (const wchar_t *, const wchar_t *);
+
+wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
+int wmemcmp (const wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemset (wchar_t *, wchar_t, size_t);
+
+wint_t btowc (int);
+int wctob (wint_t);
+
+int mbsinit (const mbstate_t *);
+size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
+
+size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
+
+size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
+size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
+
+float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
+double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
+long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
+
+long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
+
+long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
+
+
+
+int fwide (FILE *, int);
+
+
+int wprintf (const wchar_t *__restrict, ...);
+int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
+
+int vwprintf (const wchar_t *__restrict, __isoc_va_list);
+int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
+int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
+
+int wscanf (const wchar_t *__restrict, ...);
+int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
+
+int vwscanf (const wchar_t *__restrict, __isoc_va_list);
+int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
+int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
+
+wint_t fgetwc (FILE *);
+wint_t getwc (FILE *);
+wint_t getwchar (void);
+
+wint_t fputwc (wchar_t, FILE *);
+wint_t putwc (wchar_t, FILE *);
+wint_t putwchar (wchar_t);
+
+wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
+int fputws (const wchar_t *__restrict, FILE *__restrict);
+
+wint_t ungetwc (wint_t, FILE *);
+
+struct tm;
+size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
+
+#undef iswdigit
+
+#if defined(_GNU_SOURCE)
+wint_t fgetwc_unlocked (FILE *);
+wint_t getwc_unlocked (FILE *);
+wint_t getwchar_unlocked (void);
+wint_t fputwc_unlocked (wchar_t, FILE *);
+wint_t putwc_unlocked (wchar_t, FILE *);
+wint_t putwchar_unlocked (wchar_t);
+wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict);
+int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t);
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)  || defined(_BSD_SOURCE)
+FILE *open_wmemstream(wchar_t **, size_t *);
+size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
+size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
+wchar_t *wcsdup(const wchar_t *);
+size_t wcsnlen (const wchar_t *, size_t);
+wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+int wcscasecmp(const wchar_t *, const wchar_t *);
+int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
+int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
+int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
+int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
+size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int wcwidth (wchar_t);
+int wcswidth (const wchar_t *, size_t);
+int       iswalnum(wint_t);
+int       iswalpha(wint_t);
+int       iswblank(wint_t);
+int       iswcntrl(wint_t);
+int       iswdigit(wint_t);
+int       iswgraph(wint_t);
+int       iswlower(wint_t);
+int       iswprint(wint_t);
+int       iswpunct(wint_t);
+int       iswspace(wint_t);
+int       iswupper(wint_t);
+int       iswxdigit(wint_t);
+int       iswctype(wint_t, wctype_t);
+wint_t    towlower(wint_t);
+wint_t    towupper(wint_t);
+wctype_t  wctype(const char *);
+
+#ifndef __cplusplus
+#undef iswdigit
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/wctype.h b/musl-include/aarch64/wctype.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/wctype.h
@@ -0,0 +1,79 @@
+#ifndef _WCTYPE_H
+#define _WCTYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_wint_t
+#define __NEED_wctype_t
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+typedef const int * wctrans_t;
+
+#undef WEOF
+#define WEOF 0xffffffffU
+
+#undef iswdigit
+
+int       iswalnum(wint_t);
+int       iswalpha(wint_t);
+int       iswblank(wint_t);
+int       iswcntrl(wint_t);
+int       iswdigit(wint_t);
+int       iswgraph(wint_t);
+int       iswlower(wint_t);
+int       iswprint(wint_t);
+int       iswpunct(wint_t);
+int       iswspace(wint_t);
+int       iswupper(wint_t);
+int       iswxdigit(wint_t);
+int       iswctype(wint_t, wctype_t);
+wint_t    towctrans(wint_t, wctrans_t);
+wint_t    towlower(wint_t);
+wint_t    towupper(wint_t);
+wctrans_t wctrans(const char *);
+wctype_t  wctype(const char *);
+
+#ifndef __cplusplus
+#undef iswdigit
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+int iswalnum_l(wint_t, locale_t);
+int iswalpha_l(wint_t, locale_t);
+int iswblank_l(wint_t, locale_t);
+int iswcntrl_l(wint_t, locale_t);
+int iswdigit_l(wint_t, locale_t);
+int iswgraph_l(wint_t, locale_t);
+int iswlower_l(wint_t, locale_t);
+int iswprint_l(wint_t, locale_t);
+int iswpunct_l(wint_t, locale_t);
+int iswspace_l(wint_t, locale_t);
+int iswupper_l(wint_t, locale_t);
+int iswxdigit_l(wint_t, locale_t);
+int iswctype_l(wint_t, wctype_t, locale_t);
+wint_t towlower_l(wint_t, locale_t);
+wint_t towupper_l(wint_t, locale_t);
+wint_t towctrans_l(wint_t, wctrans_t, locale_t);
+wctrans_t wctrans_l(const char *, locale_t);
+wctype_t  wctype_l(const char *, locale_t);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/aarch64/wordexp.h b/musl-include/aarch64/wordexp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/aarch64/wordexp.h
@@ -0,0 +1,41 @@
+#ifndef	_WORDEXP_H
+#define	_WORDEXP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#define WRDE_DOOFFS  1
+#define WRDE_APPEND  2
+#define WRDE_NOCMD   4
+#define WRDE_REUSE   8
+#define WRDE_SHOWERR 16
+#define WRDE_UNDEF   32
+
+typedef struct {
+	size_t we_wordc;
+	char **we_wordv;
+	size_t we_offs;
+} wordexp_t;
+
+#define WRDE_NOSYS   -1
+#define WRDE_NOSPACE 1
+#define WRDE_BADCHAR 2
+#define WRDE_BADVAL  3
+#define WRDE_CMDSUB  4
+#define WRDE_SYNTAX  5
+
+int wordexp (const char *__restrict, wordexp_t *__restrict, int);
+void wordfree (wordexp_t *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/aio.h b/musl-include/arm/aio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/aio.h
@@ -0,0 +1,73 @@
+#ifndef _AIO_H
+#define _AIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <signal.h>
+#include <time.h>
+
+#define __NEED_ssize_t
+#define __NEED_off_t
+
+#include <bits/alltypes.h>
+
+struct aiocb {
+	int aio_fildes, aio_lio_opcode, aio_reqprio;
+	volatile void *aio_buf;
+	size_t aio_nbytes;
+	struct sigevent aio_sigevent;
+	void *__td;
+	int __lock[2];
+	volatile int __err;
+	ssize_t __ret;
+	off_t aio_offset;
+	void *__next, *__prev;
+	char __dummy4[32-2*sizeof(void *)];
+};
+
+#define AIO_CANCELED 0
+#define AIO_NOTCANCELED 1
+#define AIO_ALLDONE 2
+
+#define LIO_READ 0
+#define LIO_WRITE 1
+#define LIO_NOP 2
+
+#define LIO_WAIT 0
+#define LIO_NOWAIT 1
+
+int aio_read(struct aiocb *);
+int aio_write(struct aiocb *);
+int aio_error(const struct aiocb *);
+ssize_t aio_return(struct aiocb *);
+int aio_cancel(int, struct aiocb *);
+int aio_suspend(const struct aiocb *const [], int, const struct timespec *);
+int aio_fsync(int, struct aiocb *);
+
+int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define aiocb64 aiocb
+#define aio_read64 aio_read
+#define aio_write64 aio_write
+#define aio_error64 aio_error
+#define aio_return64 aio_return
+#define aio_cancel64 aio_cancel
+#define aio_suspend64 aio_suspend
+#define aio_fsync64 aio_fsync
+#define lio_listio64 lio_listio
+#define off64_t off_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(aio_suspend, __aio_suspend_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/alloca.h b/musl-include/arm/alloca.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/alloca.h
@@ -0,0 +1,19 @@
+#ifndef	_ALLOCA_H
+#define	_ALLOCA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	__NEED_size_t
+#include <bits/alltypes.h>
+
+void *alloca(size_t);
+
+#define alloca __builtin_alloca
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/ar.h b/musl-include/arm/ar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/ar.h
@@ -0,0 +1,25 @@
+#ifndef _AR_H
+#define _AR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ARMAG "!<arch>\n"
+#define SARMAG 8
+#define ARFMAG "`\n"
+
+struct ar_hdr {
+	char ar_name[16];
+	char ar_date[12];
+	char ar_uid[6], ar_gid[6];
+	char ar_mode[8];
+	char ar_size[10];
+	char ar_fmag[2];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/arpa/ftp.h b/musl-include/arm/arpa/ftp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/arpa/ftp.h
@@ -0,0 +1,35 @@
+#ifndef _ARPA_FTP_H
+#define _ARPA_FTP_H
+#define PRELIM 1
+#define COMPLETE 2
+#define CONTINUE 3
+#define TRANSIENT 4
+#define ERROR 5
+#define TYPE_A 1
+#define TYPE_E 2
+#define TYPE_I 3
+#define TYPE_L 4
+#define FORM_N 1
+#define FORM_T 2
+#define FORM_C 3
+#define STRU_F 1
+#define STRU_R 2
+#define STRU_P 3
+#define MODE_S 1
+#define MODE_B 2
+#define MODE_C 3
+#define REC_ESC '\377'
+#define REC_EOR '\001'
+#define REC_EOF '\002'
+#define BLK_EOR 0x80
+#define BLK_EOF 0x40
+#define BLK_ERRORS 0x20
+#define BLK_RESTART 0x10
+#define BLK_BYTECOUNT 2
+#ifdef FTP_NAMES
+char *modenames[] =  {"0", "Stream", "Block", "Compressed" };
+char *strunames[] =  {"0", "File", "Record", "Page" };
+char *typenames[] =  {"0", "ASCII", "EBCDIC", "Image", "Local" };
+char *formnames[] =  {"0", "Nonprint", "Telnet", "Carriage-control" };
+#endif
+#endif
diff --git a/musl-include/arm/arpa/inet.h b/musl-include/arm/arpa/inet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/arpa/inet.h
@@ -0,0 +1,31 @@
+#ifndef _ARPA_INET_H
+#define	_ARPA_INET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+
+uint32_t htonl(uint32_t);
+uint16_t htons(uint16_t);
+uint32_t ntohl(uint32_t);
+uint16_t ntohs(uint16_t);
+
+in_addr_t inet_addr (const char *);
+in_addr_t inet_network (const char *);
+char *inet_ntoa (struct in_addr);
+int inet_pton (int, const char *__restrict, void *__restrict);
+const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
+
+int inet_aton (const char *, struct in_addr *);
+struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
+in_addr_t inet_lnaof(struct in_addr);
+in_addr_t inet_netof(struct in_addr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/arpa/nameser.h b/musl-include/arm/arpa/nameser.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/arpa/nameser.h
@@ -0,0 +1,526 @@
+#ifndef _ARPA_NAMESER_H
+#define _ARPA_NAMESER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+#include <stdint.h>
+
+#define __NAMESER	19991006
+#define NS_PACKETSZ	512
+#define NS_MAXDNAME	1025
+#define NS_MAXMSG	65535
+#define NS_MAXCDNAME	255
+#define NS_MAXLABEL	63
+#define NS_HFIXEDSZ	12
+#define NS_QFIXEDSZ	4
+#define NS_RRFIXEDSZ	10
+#define NS_INT32SZ	4
+#define NS_INT16SZ	2
+#define NS_INT8SZ	1
+#define NS_INADDRSZ	4
+#define NS_IN6ADDRSZ	16
+#define NS_CMPRSFLGS	0xc0
+#define NS_DEFAULTPORT	53
+
+typedef enum __ns_sect {
+	ns_s_qd = 0,
+	ns_s_zn = 0,
+	ns_s_an = 1,
+	ns_s_pr = 1,
+	ns_s_ns = 2,
+	ns_s_ud = 2,
+	ns_s_ar = 3,
+	ns_s_max = 4
+} ns_sect;
+
+typedef struct __ns_msg {
+	const unsigned char *_msg, *_eom;
+	uint16_t _id, _flags, _counts[ns_s_max];
+	const unsigned char *_sections[ns_s_max];
+	ns_sect _sect;
+	int _rrnum;
+	const unsigned char *_msg_ptr;
+} ns_msg;
+
+struct _ns_flagdata {  int mask, shift;  };
+extern const struct _ns_flagdata _ns_flagdata[];
+
+#define ns_msg_id(handle) ((handle)._id + 0)
+#define ns_msg_base(handle) ((handle)._msg + 0)
+#define ns_msg_end(handle) ((handle)._eom + 0)
+#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
+#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
+#define ns_msg_getflag(handle, flag) \
+	(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
+
+typedef	struct __ns_rr {
+	char		name[NS_MAXDNAME];
+	uint16_t	type;
+	uint16_t	rr_class;
+	uint32_t	ttl;
+	uint16_t	rdlength;
+	const unsigned char *rdata;
+} ns_rr;
+
+#define ns_rr_name(rr)	(((rr).name[0] != '\0') ? (rr).name : ".")
+#define ns_rr_type(rr)	((ns_type)((rr).type + 0))
+#define ns_rr_class(rr)	((ns_class)((rr).rr_class + 0))
+#define ns_rr_ttl(rr)	((rr).ttl + 0)
+#define ns_rr_rdlen(rr)	((rr).rdlength + 0)
+#define ns_rr_rdata(rr)	((rr).rdata + 0)
+
+typedef enum __ns_flag {
+	ns_f_qr,
+	ns_f_opcode,
+	ns_f_aa,
+	ns_f_tc,
+	ns_f_rd,
+	ns_f_ra,
+	ns_f_z,
+	ns_f_ad,
+	ns_f_cd,
+	ns_f_rcode,
+	ns_f_max
+} ns_flag;
+
+typedef enum __ns_opcode {
+	ns_o_query = 0,
+	ns_o_iquery = 1,
+	ns_o_status = 2,
+	ns_o_notify = 4,
+	ns_o_update = 5,
+	ns_o_max = 6
+} ns_opcode;
+
+typedef	enum __ns_rcode {
+	ns_r_noerror = 0,
+	ns_r_formerr = 1,
+	ns_r_servfail = 2,
+	ns_r_nxdomain = 3,
+	ns_r_notimpl = 4,
+	ns_r_refused = 5,
+	ns_r_yxdomain = 6,
+	ns_r_yxrrset = 7,
+	ns_r_nxrrset = 8,
+	ns_r_notauth = 9,
+	ns_r_notzone = 10,
+	ns_r_max = 11,
+	ns_r_badvers = 16,
+	ns_r_badsig = 16,
+	ns_r_badkey = 17,
+	ns_r_badtime = 18
+} ns_rcode;
+
+typedef enum __ns_update_operation {
+	ns_uop_delete = 0,
+	ns_uop_add = 1,
+	ns_uop_max = 2
+} ns_update_operation;
+
+struct ns_tsig_key {
+        char name[NS_MAXDNAME], alg[NS_MAXDNAME];
+        unsigned char *data;
+        int len;
+};
+typedef struct ns_tsig_key ns_tsig_key;
+
+struct ns_tcp_tsig_state {
+	int counter;
+	struct dst_key *key;
+	void *ctx;
+	unsigned char sig[NS_PACKETSZ];
+	int siglen;
+};
+typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
+
+#define NS_TSIG_FUDGE 300
+#define NS_TSIG_TCP_COUNT 100
+#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
+
+#define NS_TSIG_ERROR_NO_TSIG -10
+#define NS_TSIG_ERROR_NO_SPACE -11
+#define NS_TSIG_ERROR_FORMERR -12
+
+typedef enum __ns_type {
+	ns_t_invalid = 0,
+	ns_t_a = 1,
+	ns_t_ns = 2,
+	ns_t_md = 3,
+	ns_t_mf = 4,
+	ns_t_cname = 5,
+	ns_t_soa = 6,
+	ns_t_mb = 7,
+	ns_t_mg = 8,
+	ns_t_mr = 9,
+	ns_t_null = 10,
+	ns_t_wks = 11,
+	ns_t_ptr = 12,
+	ns_t_hinfo = 13,
+	ns_t_minfo = 14,
+	ns_t_mx = 15,
+	ns_t_txt = 16,
+	ns_t_rp = 17,
+	ns_t_afsdb = 18,
+	ns_t_x25 = 19,
+	ns_t_isdn = 20,
+	ns_t_rt = 21,
+	ns_t_nsap = 22,
+	ns_t_nsap_ptr = 23,
+	ns_t_sig = 24,
+	ns_t_key = 25,
+	ns_t_px = 26,
+	ns_t_gpos = 27,
+	ns_t_aaaa = 28,
+	ns_t_loc = 29,
+	ns_t_nxt = 30,
+	ns_t_eid = 31,
+	ns_t_nimloc = 32,
+	ns_t_srv = 33,
+	ns_t_atma = 34,
+	ns_t_naptr = 35,
+	ns_t_kx = 36,
+	ns_t_cert = 37,
+	ns_t_a6 = 38,
+	ns_t_dname = 39,
+	ns_t_sink = 40,
+	ns_t_opt = 41,
+	ns_t_apl = 42,
+	ns_t_ds = 43,
+	ns_t_sshfp = 44,
+	ns_t_ipseckey = 45,
+	ns_t_rrsig = 46,
+	ns_t_nsec = 47,
+	ns_t_dnskey = 48,
+	ns_t_dhcid = 49,
+	ns_t_nsec3 = 50,
+	ns_t_nsec3param = 51,
+	ns_t_tlsa = 52,
+	ns_t_smimea = 53,
+	ns_t_hip = 55,
+	ns_t_ninfo = 56,
+	ns_t_rkey = 57,
+	ns_t_talink = 58,
+	ns_t_cds = 59,
+	ns_t_cdnskey = 60,
+	ns_t_openpgpkey = 61,
+	ns_t_csync = 62,
+	ns_t_spf = 99,
+	ns_t_uinfo = 100,
+	ns_t_uid = 101,
+	ns_t_gid = 102,
+	ns_t_unspec = 103,
+	ns_t_nid = 104,
+	ns_t_l32 = 105,
+	ns_t_l64 = 106,
+	ns_t_lp = 107,
+	ns_t_eui48 = 108,
+	ns_t_eui64 = 109,
+	ns_t_tkey = 249,
+	ns_t_tsig = 250,
+	ns_t_ixfr = 251,
+	ns_t_axfr = 252,
+	ns_t_mailb = 253,
+	ns_t_maila = 254,
+	ns_t_any = 255,
+	ns_t_zxfr = 256,
+	ns_t_uri = 256,
+	ns_t_caa = 257,
+	ns_t_avc = 258,
+	ns_t_ta = 32768,
+	ns_t_dlv = 32769,
+	ns_t_max = 65536
+} ns_type;
+
+#define	ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
+		      (t) == ns_t_mailb || (t) == ns_t_maila)
+#define	ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
+#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
+#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
+#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
+		       (t) == ns_t_zxfr)
+
+typedef enum __ns_class {
+	ns_c_invalid = 0,
+	ns_c_in = 1,
+	ns_c_2 = 2,
+	ns_c_chaos = 3,
+	ns_c_hs = 4,
+	ns_c_none = 254,
+	ns_c_any = 255,
+	ns_c_max = 65536
+} ns_class;
+
+typedef enum __ns_key_types {
+	ns_kt_rsa = 1,
+	ns_kt_dh  = 2,
+	ns_kt_dsa = 3,
+	ns_kt_private = 254
+} ns_key_types;
+
+typedef enum __ns_cert_types {
+	cert_t_pkix = 1,
+	cert_t_spki = 2,
+	cert_t_pgp  = 3,
+	cert_t_url  = 253,
+	cert_t_oid  = 254
+} ns_cert_types;
+
+#define	NS_KEY_TYPEMASK		0xC000
+#define	NS_KEY_TYPE_AUTH_CONF	0x0000
+#define	NS_KEY_TYPE_CONF_ONLY	0x8000
+#define	NS_KEY_TYPE_AUTH_ONLY	0x4000
+#define	NS_KEY_TYPE_NO_KEY	0xC000
+#define	NS_KEY_NO_AUTH		0x8000
+#define	NS_KEY_NO_CONF		0x4000
+#define	NS_KEY_RESERVED2	0x2000
+#define	NS_KEY_EXTENDED_FLAGS	0x1000
+#define	NS_KEY_RESERVED4	0x0800
+#define	NS_KEY_RESERVED5	0x0400
+#define	NS_KEY_NAME_TYPE	0x0300
+#define	NS_KEY_NAME_USER	0x0000
+#define	NS_KEY_NAME_ENTITY	0x0200
+#define	NS_KEY_NAME_ZONE	0x0100
+#define	NS_KEY_NAME_RESERVED	0x0300
+#define	NS_KEY_RESERVED8	0x0080
+#define	NS_KEY_RESERVED9	0x0040
+#define	NS_KEY_RESERVED10	0x0020
+#define	NS_KEY_RESERVED11	0x0010
+#define	NS_KEY_SIGNATORYMASK	0x000F
+#define	NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
+				  NS_KEY_RESERVED4 | \
+				  NS_KEY_RESERVED5 | \
+				  NS_KEY_RESERVED8 | \
+				  NS_KEY_RESERVED9 | \
+				  NS_KEY_RESERVED10 | \
+				  NS_KEY_RESERVED11 )
+#define NS_KEY_RESERVED_BITMASK2 0xFFFF
+#define	NS_ALG_MD5RSA		1
+#define	NS_ALG_DH               2
+#define	NS_ALG_DSA              3
+#define	NS_ALG_DSS              NS_ALG_DSA
+#define	NS_ALG_EXPIRE_ONLY	253
+#define	NS_ALG_PRIVATE_OID	254
+
+#define NS_KEY_PROT_TLS         1
+#define NS_KEY_PROT_EMAIL       2
+#define NS_KEY_PROT_DNSSEC      3
+#define NS_KEY_PROT_IPSEC       4
+#define NS_KEY_PROT_ANY		255
+
+#define	NS_MD5RSA_MIN_BITS	 512
+#define	NS_MD5RSA_MAX_BITS	4096
+#define	NS_MD5RSA_MAX_BYTES	((NS_MD5RSA_MAX_BITS+7/8)*2+3)
+#define	NS_MD5RSA_MAX_BASE64	(((NS_MD5RSA_MAX_BYTES+2)/3)*4)
+#define NS_MD5RSA_MIN_SIZE	((NS_MD5RSA_MIN_BITS+7)/8)
+#define NS_MD5RSA_MAX_SIZE	((NS_MD5RSA_MAX_BITS+7)/8)
+
+#define NS_DSA_SIG_SIZE         41
+#define NS_DSA_MIN_SIZE         213
+#define NS_DSA_MAX_BYTES        405
+
+#define	NS_SIG_TYPE	0
+#define	NS_SIG_ALG	2
+#define	NS_SIG_LABELS	3
+#define	NS_SIG_OTTL	4
+#define	NS_SIG_EXPIR	8
+#define	NS_SIG_SIGNED	12
+#define	NS_SIG_FOOT	16
+#define	NS_SIG_SIGNER	18
+#define	NS_NXT_BITS 8
+#define	NS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_MAX 127
+
+#define NS_OPT_DNSSEC_OK        0x8000U
+#define NS_OPT_NSID		3
+
+#define NS_GET16(s, cp) (void)((s) = ns_get16(((cp)+=2)-2))
+#define NS_GET32(l, cp) (void)((l) = ns_get32(((cp)+=4)-4))
+#define NS_PUT16(s, cp) ns_put16((s), ((cp)+=2)-2)
+#define NS_PUT32(l, cp) ns_put32((l), ((cp)+=4)-4)
+
+unsigned ns_get16(const unsigned char *);
+unsigned long ns_get32(const unsigned char *);
+void ns_put16(unsigned, unsigned char *);
+void ns_put32(unsigned long, unsigned char *);
+
+int ns_initparse(const unsigned char *, int, ns_msg *);
+int ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
+int ns_skiprr(const unsigned char *, const unsigned char *, ns_sect, int);
+int ns_name_uncompress(const unsigned char *, const unsigned char *, const unsigned char *, char *, size_t);
+
+
+#define	__BIND		19950621
+
+typedef struct {
+	unsigned	id :16;
+#if __BYTE_ORDER == __BIG_ENDIAN
+	unsigned	qr: 1;
+	unsigned	opcode: 4;
+	unsigned	aa: 1;
+	unsigned	tc: 1;
+	unsigned	rd: 1;
+	unsigned	ra: 1;
+	unsigned	unused :1;
+	unsigned	ad: 1;
+	unsigned	cd: 1;
+	unsigned	rcode :4;
+#else
+	unsigned	rd :1;
+	unsigned	tc :1;
+	unsigned	aa :1;
+	unsigned	opcode :4;
+	unsigned	qr :1;
+	unsigned	rcode :4;
+	unsigned	cd: 1;
+	unsigned	ad: 1;
+	unsigned	unused :1;
+	unsigned	ra :1;
+#endif
+	unsigned	qdcount :16;
+	unsigned	ancount :16;
+	unsigned	nscount :16;
+	unsigned	arcount :16;
+} HEADER;
+
+#define PACKETSZ	NS_PACKETSZ
+#define MAXDNAME	NS_MAXDNAME
+#define MAXCDNAME	NS_MAXCDNAME
+#define MAXLABEL	NS_MAXLABEL
+#define	HFIXEDSZ	NS_HFIXEDSZ
+#define QFIXEDSZ	NS_QFIXEDSZ
+#define RRFIXEDSZ	NS_RRFIXEDSZ
+#define	INT32SZ		NS_INT32SZ
+#define	INT16SZ		NS_INT16SZ
+#define INT8SZ		NS_INT8SZ
+#define	INADDRSZ	NS_INADDRSZ
+#define	IN6ADDRSZ	NS_IN6ADDRSZ
+#define	INDIR_MASK	NS_CMPRSFLGS
+#define NAMESERVER_PORT	NS_DEFAULTPORT
+
+#define S_ZONE		ns_s_zn
+#define S_PREREQ	ns_s_pr
+#define S_UPDATE	ns_s_ud
+#define S_ADDT		ns_s_ar
+
+#define QUERY		ns_o_query
+#define IQUERY		ns_o_iquery
+#define STATUS		ns_o_status
+#define	NS_NOTIFY_OP	ns_o_notify
+#define	NS_UPDATE_OP	ns_o_update
+
+#define NOERROR		ns_r_noerror
+#define FORMERR		ns_r_formerr
+#define SERVFAIL	ns_r_servfail
+#define NXDOMAIN	ns_r_nxdomain
+#define NOTIMP		ns_r_notimpl
+#define REFUSED		ns_r_refused
+#define YXDOMAIN	ns_r_yxdomain
+#define YXRRSET		ns_r_yxrrset
+#define NXRRSET		ns_r_nxrrset
+#define NOTAUTH		ns_r_notauth
+#define NOTZONE		ns_r_notzone
+
+#define DELETE		ns_uop_delete
+#define ADD		ns_uop_add
+
+#define T_A		ns_t_a
+#define T_NS		ns_t_ns
+#define T_MD		ns_t_md
+#define T_MF		ns_t_mf
+#define T_CNAME		ns_t_cname
+#define T_SOA		ns_t_soa
+#define T_MB		ns_t_mb
+#define T_MG		ns_t_mg
+#define T_MR		ns_t_mr
+#define T_NULL		ns_t_null
+#define T_WKS		ns_t_wks
+#define T_PTR		ns_t_ptr
+#define T_HINFO		ns_t_hinfo
+#define T_MINFO		ns_t_minfo
+#define T_MX		ns_t_mx
+#define T_TXT		ns_t_txt
+#define	T_RP		ns_t_rp
+#define T_AFSDB		ns_t_afsdb
+#define T_X25		ns_t_x25
+#define T_ISDN		ns_t_isdn
+#define T_RT		ns_t_rt
+#define T_NSAP		ns_t_nsap
+#define T_NSAP_PTR	ns_t_nsap_ptr
+#define	T_SIG		ns_t_sig
+#define	T_KEY		ns_t_key
+#define	T_PX		ns_t_px
+#define	T_GPOS		ns_t_gpos
+#define	T_AAAA		ns_t_aaaa
+#define	T_LOC		ns_t_loc
+#define	T_NXT		ns_t_nxt
+#define	T_EID		ns_t_eid
+#define	T_NIMLOC	ns_t_nimloc
+#define	T_SRV		ns_t_srv
+#define T_ATMA		ns_t_atma
+#define T_NAPTR		ns_t_naptr
+#define T_A6		ns_t_a6
+#define T_DNAME		ns_t_dname
+#define T_DS		ns_t_ds
+#define T_SSHFP		ns_t_sshfp
+#define T_IPSECKEY	ns_t_ipseckey
+#define T_RRSIG		ns_t_rrsig
+#define T_NSEC		ns_t_nsec
+#define T_DNSKEY	ns_t_dnskey
+#define T_DHCID		ns_t_dhcid
+#define T_NSEC3		ns_t_nsec3
+#define T_NSEC3PARAM	ns_t_nsec3param
+#define T_TLSA		ns_t_tlsa
+#define T_SMIMEA	ns_t_smimea
+#define T_HIP		ns_t_hip
+#define T_NINFO		ns_t_ninfo
+#define T_RKEY		ns_t_rkey
+#define T_TALINK	ns_t_talink
+#define T_CDS		ns_t_cds
+#define T_CDNSKEY	ns_t_cdnskey
+#define T_OPENPGPKEY	ns_t_openpgpkey
+#define T_CSYNC		ns_t_csync
+#define T_SPF		ns_t_spf
+#define T_UINFO		ns_t_uinfo
+#define T_UID		ns_t_uid
+#define T_GID		ns_t_gid
+#define T_UNSPEC	ns_t_unspec
+#define T_NID		ns_t_nid
+#define T_L32		ns_t_l32
+#define T_L64		ns_t_l64
+#define T_LP		ns_t_lp
+#define T_EUI48		ns_t_eui48
+#define T_EUI64		ns_t_eui64
+#define T_TKEY		ns_t_tkey
+#define	T_TSIG		ns_t_tsig
+#define	T_IXFR		ns_t_ixfr
+#define T_AXFR		ns_t_axfr
+#define T_MAILB		ns_t_mailb
+#define T_MAILA		ns_t_maila
+#define T_ANY		ns_t_any
+#define T_URI		ns_t_uri
+#define T_CAA		ns_t_caa
+#define T_AVC		ns_t_avc
+#define T_TA		ns_t_ta
+#define T_DLV		ns_t_dlv
+
+#define C_IN		ns_c_in
+#define C_CHAOS		ns_c_chaos
+#define C_HS		ns_c_hs
+#define C_NONE		ns_c_none
+#define C_ANY		ns_c_any
+
+#define	GETSHORT		NS_GET16
+#define	GETLONG			NS_GET32
+#define	PUTSHORT		NS_PUT16
+#define	PUTLONG			NS_PUT32
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/arpa/nameser_compat.h b/musl-include/arm/arpa/nameser_compat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/arpa/nameser_compat.h
@@ -0,0 +1,2 @@
+#include <arpa/nameser.h>
+
diff --git a/musl-include/arm/arpa/telnet.h b/musl-include/arm/arpa/telnet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/arpa/telnet.h
@@ -0,0 +1,251 @@
+#ifndef _ARPA_TELNET_H
+#define	_ARPA_TELNET_H
+
+#define	IAC	255
+#define	DONT	254
+#define	DO	253
+#define	WONT	252
+#define	WILL	251
+#define	SB	250
+#define	GA	249
+#define	EL	248
+#define	EC	247
+#define	AYT	246
+#define	AO	245
+#define	IP	244
+#define	BREAK	243
+#define	DM	242
+#define	NOP	241
+#define	SE	240
+#define EOR     239
+#define	ABORT	238
+#define	SUSP	237
+#define	xEOF	236
+
+#define SYNCH	242
+
+#define telcmds ((char [][6]){ "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0 })
+
+#define	TELCMD_FIRST	xEOF
+#define	TELCMD_LAST	IAC
+#define	TELCMD_OK(x)	((unsigned int)(x) <= TELCMD_LAST && \
+			 (unsigned int)(x) >= TELCMD_FIRST)
+#define	TELCMD(x)	telcmds[(x)-TELCMD_FIRST]
+
+#define TELOPT_BINARY	0
+#define TELOPT_ECHO	1
+#define	TELOPT_RCP	2
+#define	TELOPT_SGA	3
+#define	TELOPT_NAMS	4
+#define	TELOPT_STATUS	5
+#define	TELOPT_TM	6
+#define	TELOPT_RCTE	7
+#define TELOPT_NAOL 	8
+#define TELOPT_NAOP 	9
+#define TELOPT_NAOCRD	10
+#define TELOPT_NAOHTS	11
+#define TELOPT_NAOHTD	12
+#define TELOPT_NAOFFD	13
+#define TELOPT_NAOVTS	14
+#define TELOPT_NAOVTD	15
+#define TELOPT_NAOLFD	16
+#define TELOPT_XASCII	17
+#define	TELOPT_LOGOUT	18
+#define	TELOPT_BM	19
+#define	TELOPT_DET	20
+#define	TELOPT_SUPDUP	21
+#define	TELOPT_SUPDUPOUTPUT 22
+#define	TELOPT_SNDLOC	23
+#define	TELOPT_TTYPE	24
+#define	TELOPT_EOR	25
+#define	TELOPT_TUID	26
+#define	TELOPT_OUTMRK	27
+#define	TELOPT_TTYLOC	28
+#define	TELOPT_3270REGIME 29
+#define	TELOPT_X3PAD	30
+#define	TELOPT_NAWS	31
+#define	TELOPT_TSPEED	32
+#define	TELOPT_LFLOW	33
+#define TELOPT_LINEMODE	34
+#define TELOPT_XDISPLOC	35
+#define TELOPT_OLD_ENVIRON 36
+#define	TELOPT_AUTHENTICATION 37/* Authenticate */
+#define	TELOPT_ENCRYPT	38
+#define TELOPT_NEW_ENVIRON 39
+#define	TELOPT_EXOPL	255
+
+
+#define	NTELOPTS	(1+TELOPT_NEW_ENVIRON)
+#ifdef TELOPTS
+char *telopts[NTELOPTS+1] = {
+	"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
+	"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
+	"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
+	"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
+	"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
+	"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
+	"TACACS UID", "OUTPUT MARKING", "TTYLOC",
+	"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
+	"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
+	"ENCRYPT", "NEW-ENVIRON",
+	0,
+};
+#define	TELOPT_FIRST	TELOPT_BINARY
+#define	TELOPT_LAST	TELOPT_NEW_ENVIRON
+#define	TELOPT_OK(x)	((unsigned int)(x) <= TELOPT_LAST)
+#define	TELOPT(x)	telopts[(x)-TELOPT_FIRST]
+#endif
+
+#define	TELQUAL_IS	0
+#define	TELQUAL_SEND	1
+#define	TELQUAL_INFO	2
+#define	TELQUAL_REPLY	2
+#define	TELQUAL_NAME	3
+
+#define	LFLOW_OFF		0
+#define	LFLOW_ON		1
+#define	LFLOW_RESTART_ANY	2
+#define	LFLOW_RESTART_XON	3
+
+
+#define	LM_MODE		1
+#define	LM_FORWARDMASK	2
+#define	LM_SLC		3
+
+#define	MODE_EDIT	0x01
+#define	MODE_TRAPSIG	0x02
+#define	MODE_ACK	0x04
+#define MODE_SOFT_TAB	0x08
+#define MODE_LIT_ECHO	0x10
+
+#define	MODE_MASK	0x1f
+
+#define MODE_FLOW		0x0100
+#define MODE_ECHO		0x0200
+#define MODE_INBIN		0x0400
+#define MODE_OUTBIN		0x0800
+#define MODE_FORCE		0x1000
+
+#define	SLC_SYNCH	1
+#define	SLC_BRK		2
+#define	SLC_IP		3
+#define	SLC_AO		4
+#define	SLC_AYT		5
+#define	SLC_EOR		6
+#define	SLC_ABORT	7
+#define	SLC_EOF		8
+#define	SLC_SUSP	9
+#define	SLC_EC		10
+#define	SLC_EL		11
+#define	SLC_EW		12
+#define	SLC_RP		13
+#define	SLC_LNEXT	14
+#define	SLC_XON		15
+#define	SLC_XOFF	16
+#define	SLC_FORW1	17
+#define	SLC_FORW2	18
+
+#define	NSLC		18
+
+#define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
+			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
+			"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
+#ifdef	SLC_NAMES
+char *slc_names[] = {
+	SLC_NAMELIST
+};
+#else
+extern char *slc_names[];
+#define	SLC_NAMES SLC_NAMELIST
+#endif
+
+#define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)
+#define SLC_NAME(x)	slc_names[x]
+
+#define	SLC_NOSUPPORT	0
+#define	SLC_CANTCHANGE	1
+#define	SLC_VARIABLE	2
+#define	SLC_DEFAULT	3
+#define	SLC_LEVELBITS	0x03
+
+#define	SLC_FUNC	0
+#define	SLC_FLAGS	1
+#define	SLC_VALUE	2
+
+#define	SLC_ACK		0x80
+#define	SLC_FLUSHIN	0x40
+#define	SLC_FLUSHOUT	0x20
+
+#define	OLD_ENV_VAR	1
+#define	OLD_ENV_VALUE	0
+#define	NEW_ENV_VAR	0
+#define	NEW_ENV_VALUE	1
+#define	ENV_ESC		2
+#define ENV_USERVAR	3
+
+#define	AUTH_WHO_CLIENT		0
+#define	AUTH_WHO_SERVER		1
+#define	AUTH_WHO_MASK		1
+
+#define	AUTH_HOW_ONE_WAY	0
+#define	AUTH_HOW_MUTUAL		2
+#define	AUTH_HOW_MASK		2
+
+#define	AUTHTYPE_NULL		0
+#define	AUTHTYPE_KERBEROS_V4	1
+#define	AUTHTYPE_KERBEROS_V5	2
+#define	AUTHTYPE_SPX		3
+#define	AUTHTYPE_MINK		4
+#define	AUTHTYPE_CNT		5
+
+#define	AUTHTYPE_TEST		99
+
+#ifdef	AUTH_NAMES
+char *authtype_names[] = {
+	"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
+};
+#else
+extern char *authtype_names[];
+#endif
+
+#define	AUTHTYPE_NAME_OK(x)	((unsigned int)(x) < AUTHTYPE_CNT)
+#define	AUTHTYPE_NAME(x)	authtype_names[x]
+
+#define	ENCRYPT_IS		0
+#define	ENCRYPT_SUPPORT		1
+#define	ENCRYPT_REPLY		2
+#define	ENCRYPT_START		3
+#define	ENCRYPT_END		4
+#define	ENCRYPT_REQSTART	5
+#define	ENCRYPT_REQEND		6
+#define	ENCRYPT_ENC_KEYID	7
+#define	ENCRYPT_DEC_KEYID	8
+#define	ENCRYPT_CNT		9
+
+#define	ENCTYPE_ANY		0
+#define	ENCTYPE_DES_CFB64	1
+#define	ENCTYPE_DES_OFB64	2
+#define	ENCTYPE_CNT		3
+
+#ifdef	ENCRYPT_NAMES
+char *encrypt_names[] = {
+	"IS", "SUPPORT", "REPLY", "START", "END",
+	"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
+	0,
+};
+char *enctype_names[] = {
+	"ANY", "DES_CFB64",  "DES_OFB64",  0,
+};
+#else
+extern char *encrypt_names[];
+extern char *enctype_names[];
+#endif
+
+
+#define	ENCRYPT_NAME_OK(x)	((unsigned int)(x) < ENCRYPT_CNT)
+#define	ENCRYPT_NAME(x)		encrypt_names[x]
+
+#define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
+#define	ENCTYPE_NAME(x)		enctype_names[x]
+
+#endif
diff --git a/musl-include/arm/arpa/tftp.h b/musl-include/arm/arpa/tftp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/arpa/tftp.h
@@ -0,0 +1,31 @@
+#ifndef _ARPA_TFTP_H
+#define _ARPA_TFTP_H
+#define SEGSIZE 512
+#define RRQ 01
+#define WRQ 02
+#define DATA 03
+#define ACK 04
+#define ERROR 05
+struct tftphdr {
+	short th_opcode;
+	union {
+		unsigned short tu_block;
+		short tu_code;
+		char tu_stuff[1];
+	} th_u;
+	char th_data[1];
+};
+#define th_block th_u.tu_block
+#define th_code th_u.tu_code
+#define th_stuff th_u.tu_stuff
+#define th_msg th_data
+#define EUNDEF 0
+#define ENOTFOUND 1
+#define EACCESS 2
+#define ENOSPACE 3
+#define EBADOP 4
+#define EBADID 5
+#define EEXISTS 6
+#define ENOUSER 7
+#endif
+
diff --git a/musl-include/arm/assert.h b/musl-include/arm/assert.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/assert.h
@@ -0,0 +1,23 @@
+#include <features.h>
+
+#undef assert
+
+#ifdef NDEBUG
+#define	assert(x) (void)0
+#else
+#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
+#endif
+
+#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
+#define static_assert _Static_assert
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_Noreturn void __assert_fail (const char *, const char *, int, const char *);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/musl-include/arm/bits/alltypes.h b/musl-include/arm/bits/alltypes.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/alltypes.h
@@ -0,0 +1,408 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#if __ARMEB__
+#define __BYTE_ORDER 4321
+#else
+#define __BYTE_ORDER 1234
+#endif
+
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
+typedef unsigned wchar_t;
+#define __DEFINED_wchar_t
+#endif
+
+#endif
+
+#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
+typedef float float_t;
+#define __DEFINED_float_t
+#endif
+
+#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
+typedef double double_t;
+#define __DEFINED_double_t
+#endif
+
+
+#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
+typedef struct { long long __ll; long double __ld; } max_align_t;
+#define __DEFINED_max_align_t
+#endif
+
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+#define __USE_TIME_BITS64 1
+
+#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
+typedef unsigned _Addr size_t;
+#define __DEFINED_size_t
+#endif
+
+#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
+typedef unsigned _Addr uintptr_t;
+#define __DEFINED_uintptr_t
+#endif
+
+#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
+typedef _Addr ptrdiff_t;
+#define __DEFINED_ptrdiff_t
+#endif
+
+#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t)
+typedef _Addr ssize_t;
+#define __DEFINED_ssize_t
+#endif
+
+#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
+typedef _Addr intptr_t;
+#define __DEFINED_intptr_t
+#endif
+
+#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t)
+typedef _Addr regoff_t;
+#define __DEFINED_regoff_t
+#endif
+
+#if defined(__NEED_register_t) && !defined(__DEFINED_register_t)
+typedef _Reg register_t;
+#define __DEFINED_register_t
+#endif
+
+#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
+typedef _Int64 time_t;
+#define __DEFINED_time_t
+#endif
+
+#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
+typedef _Int64 suseconds_t;
+#define __DEFINED_suseconds_t
+#endif
+
+
+#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t)
+typedef signed char     int8_t;
+#define __DEFINED_int8_t
+#endif
+
+#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t)
+typedef signed short    int16_t;
+#define __DEFINED_int16_t
+#endif
+
+#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t)
+typedef signed int      int32_t;
+#define __DEFINED_int32_t
+#endif
+
+#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t)
+typedef signed _Int64   int64_t;
+#define __DEFINED_int64_t
+#endif
+
+#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
+typedef signed _Int64   intmax_t;
+#define __DEFINED_intmax_t
+#endif
+
+#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t)
+typedef unsigned char   uint8_t;
+#define __DEFINED_uint8_t
+#endif
+
+#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t)
+typedef unsigned short  uint16_t;
+#define __DEFINED_uint16_t
+#endif
+
+#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t)
+typedef unsigned int    uint32_t;
+#define __DEFINED_uint32_t
+#endif
+
+#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t)
+typedef unsigned _Int64 uint64_t;
+#define __DEFINED_uint64_t
+#endif
+
+#if defined(__NEED_u_int64_t) && !defined(__DEFINED_u_int64_t)
+typedef unsigned _Int64 u_int64_t;
+#define __DEFINED_u_int64_t
+#endif
+
+#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
+typedef unsigned _Int64 uintmax_t;
+#define __DEFINED_uintmax_t
+#endif
+
+
+#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t)
+typedef unsigned mode_t;
+#define __DEFINED_mode_t
+#endif
+
+#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
+typedef unsigned _Reg nlink_t;
+#define __DEFINED_nlink_t
+#endif
+
+#if defined(__NEED_off_t) && !defined(__DEFINED_off_t)
+typedef _Int64 off_t;
+#define __DEFINED_off_t
+#endif
+
+#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
+typedef unsigned _Int64 ino_t;
+#define __DEFINED_ino_t
+#endif
+
+#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
+typedef unsigned _Int64 dev_t;
+#define __DEFINED_dev_t
+#endif
+
+#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
+typedef long blksize_t;
+#define __DEFINED_blksize_t
+#endif
+
+#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
+typedef _Int64 blkcnt_t;
+#define __DEFINED_blkcnt_t
+#endif
+
+#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
+typedef unsigned _Int64 fsblkcnt_t;
+#define __DEFINED_fsblkcnt_t
+#endif
+
+#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
+typedef unsigned _Int64 fsfilcnt_t;
+#define __DEFINED_fsfilcnt_t
+#endif
+
+
+#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
+typedef unsigned wint_t;
+#define __DEFINED_wint_t
+#endif
+
+#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t)
+typedef unsigned long wctype_t;
+#define __DEFINED_wctype_t
+#endif
+
+
+#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t)
+typedef void * timer_t;
+#define __DEFINED_timer_t
+#endif
+
+#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t)
+typedef int clockid_t;
+#define __DEFINED_clockid_t
+#endif
+
+#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
+typedef long clock_t;
+#define __DEFINED_clock_t
+#endif
+
+#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval)
+struct timeval { time_t tv_sec; suseconds_t tv_usec; };
+#define __DEFINED_struct_timeval
+#endif
+
+#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
+struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
+#define __DEFINED_struct_timespec
+#endif
+
+
+#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
+typedef int pid_t;
+#define __DEFINED_pid_t
+#endif
+
+#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
+typedef unsigned id_t;
+#define __DEFINED_id_t
+#endif
+
+#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
+typedef unsigned uid_t;
+#define __DEFINED_uid_t
+#endif
+
+#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
+typedef unsigned gid_t;
+#define __DEFINED_gid_t
+#endif
+
+#if defined(__NEED_key_t) && !defined(__DEFINED_key_t)
+typedef int key_t;
+#define __DEFINED_key_t
+#endif
+
+#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
+typedef unsigned useconds_t;
+#define __DEFINED_useconds_t
+#endif
+
+
+#ifdef __cplusplus
+#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
+typedef unsigned long pthread_t;
+#define __DEFINED_pthread_t
+#endif
+
+#else
+#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
+typedef struct __pthread * pthread_t;
+#define __DEFINED_pthread_t
+#endif
+
+#endif
+#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t)
+typedef int pthread_once_t;
+#define __DEFINED_pthread_once_t
+#endif
+
+#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t)
+typedef unsigned pthread_key_t;
+#define __DEFINED_pthread_key_t
+#endif
+
+#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t)
+typedef int pthread_spinlock_t;
+#define __DEFINED_pthread_spinlock_t
+#endif
+
+#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t)
+typedef struct { unsigned __attr; } pthread_mutexattr_t;
+#define __DEFINED_pthread_mutexattr_t
+#endif
+
+#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t)
+typedef struct { unsigned __attr; } pthread_condattr_t;
+#define __DEFINED_pthread_condattr_t
+#endif
+
+#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t)
+typedef struct { unsigned __attr; } pthread_barrierattr_t;
+#define __DEFINED_pthread_barrierattr_t
+#endif
+
+#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t)
+typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t;
+#define __DEFINED_pthread_rwlockattr_t
+#endif
+
+
+#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE)
+struct _IO_FILE { char __x; };
+#define __DEFINED_struct__IO_FILE
+#endif
+
+#if defined(__NEED_FILE) && !defined(__DEFINED_FILE)
+typedef struct _IO_FILE FILE;
+#define __DEFINED_FILE
+#endif
+
+
+#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
+typedef __builtin_va_list va_list;
+#define __DEFINED_va_list
+#endif
+
+#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list)
+typedef __builtin_va_list __isoc_va_list;
+#define __DEFINED___isoc_va_list
+#endif
+
+
+#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t)
+typedef struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
+#define __DEFINED_mbstate_t
+#endif
+
+
+#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
+typedef struct __locale_struct * locale_t;
+#define __DEFINED_locale_t
+#endif
+
+
+#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
+typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
+#define __DEFINED_sigset_t
+#endif
+
+
+#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
+struct iovec { void *iov_base; size_t iov_len; };
+#define __DEFINED_struct_iovec
+#endif
+
+
+#if defined(__NEED_struct_winsize) && !defined(__DEFINED_struct_winsize)
+struct winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
+#define __DEFINED_struct_winsize
+#endif
+
+
+#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t)
+typedef unsigned socklen_t;
+#define __DEFINED_socklen_t
+#endif
+
+#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t)
+typedef unsigned short sa_family_t;
+#define __DEFINED_sa_family_t
+#endif
+
+
+#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t)
+typedef struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;
+#define __DEFINED_pthread_attr_t
+#endif
+
+#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t)
+typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t;
+#define __DEFINED_pthread_mutex_t
+#endif
+
+#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t)
+typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t;
+#define __DEFINED_mtx_t
+#endif
+
+#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t)
+typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
+#define __DEFINED_pthread_cond_t
+#endif
+
+#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t)
+typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t;
+#define __DEFINED_cnd_t
+#endif
+
+#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t)
+typedef struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t;
+#define __DEFINED_pthread_rwlock_t
+#endif
+
+#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t)
+typedef struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t;
+#define __DEFINED_pthread_barrier_t
+#endif
+
+
+#undef _Addr
+#undef _Int64
+#undef _Reg
diff --git a/musl-include/arm/bits/dirent.h b/musl-include/arm/bits/dirent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/dirent.h
@@ -0,0 +1,11 @@
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
+
+struct dirent {
+	ino_t d_ino;
+	off_t d_off;
+	unsigned short d_reclen;
+	unsigned char d_type;
+	char d_name[256];
+};
diff --git a/musl-include/arm/bits/errno.h b/musl-include/arm/bits/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM            1
+#define ENOENT           2
+#define ESRCH            3
+#define EINTR            4
+#define EIO              5
+#define ENXIO            6
+#define E2BIG            7
+#define ENOEXEC          8
+#define EBADF            9
+#define ECHILD          10
+#define EAGAIN          11
+#define ENOMEM          12
+#define EACCES          13
+#define EFAULT          14
+#define ENOTBLK         15
+#define EBUSY           16
+#define EEXIST          17
+#define EXDEV           18
+#define ENODEV          19
+#define ENOTDIR         20
+#define EISDIR          21
+#define EINVAL          22
+#define ENFILE          23
+#define EMFILE          24
+#define ENOTTY          25
+#define ETXTBSY         26
+#define EFBIG           27
+#define ENOSPC          28
+#define ESPIPE          29
+#define EROFS           30
+#define EMLINK          31
+#define EPIPE           32
+#define EDOM            33
+#define ERANGE          34
+#define EDEADLK         35
+#define ENAMETOOLONG    36
+#define ENOLCK          37
+#define ENOSYS          38
+#define ENOTEMPTY       39
+#define ELOOP           40
+#define EWOULDBLOCK     EAGAIN
+#define ENOMSG          42
+#define EIDRM           43
+#define ECHRNG          44
+#define EL2NSYNC        45
+#define EL3HLT          46
+#define EL3RST          47
+#define ELNRNG          48
+#define EUNATCH         49
+#define ENOCSI          50
+#define EL2HLT          51
+#define EBADE           52
+#define EBADR           53
+#define EXFULL          54
+#define ENOANO          55
+#define EBADRQC         56
+#define EBADSLT         57
+#define EDEADLOCK       EDEADLK
+#define EBFONT          59
+#define ENOSTR          60
+#define ENODATA         61
+#define ETIME           62
+#define ENOSR           63
+#define ENONET          64
+#define ENOPKG          65
+#define EREMOTE         66
+#define ENOLINK         67
+#define EADV            68
+#define ESRMNT          69
+#define ECOMM           70
+#define EPROTO          71
+#define EMULTIHOP       72
+#define EDOTDOT         73
+#define EBADMSG         74
+#define EOVERFLOW       75
+#define ENOTUNIQ        76
+#define EBADFD          77
+#define EREMCHG         78
+#define ELIBACC         79
+#define ELIBBAD         80
+#define ELIBSCN         81
+#define ELIBMAX         82
+#define ELIBEXEC        83
+#define EILSEQ          84
+#define ERESTART        85
+#define ESTRPIPE        86
+#define EUSERS          87
+#define ENOTSOCK        88
+#define EDESTADDRREQ    89
+#define EMSGSIZE        90
+#define EPROTOTYPE      91
+#define ENOPROTOOPT     92
+#define EPROTONOSUPPORT 93
+#define ESOCKTNOSUPPORT 94
+#define EOPNOTSUPP      95
+#define ENOTSUP         EOPNOTSUPP
+#define EPFNOSUPPORT    96
+#define EAFNOSUPPORT    97
+#define EADDRINUSE      98
+#define EADDRNOTAVAIL   99
+#define ENETDOWN        100
+#define ENETUNREACH     101
+#define ENETRESET       102
+#define ECONNABORTED    103
+#define ECONNRESET      104
+#define ENOBUFS         105
+#define EISCONN         106
+#define ENOTCONN        107
+#define ESHUTDOWN       108
+#define ETOOMANYREFS    109
+#define ETIMEDOUT       110
+#define ECONNREFUSED    111
+#define EHOSTDOWN       112
+#define EHOSTUNREACH    113
+#define EALREADY        114
+#define EINPROGRESS     115
+#define ESTALE          116
+#define EUCLEAN         117
+#define ENOTNAM         118
+#define ENAVAIL         119
+#define EISNAM          120
+#define EREMOTEIO       121
+#define EDQUOT          122
+#define ENOMEDIUM       123
+#define EMEDIUMTYPE     124
+#define ECANCELED       125
+#define ENOKEY          126
+#define EKEYEXPIRED     127
+#define EKEYREVOKED     128
+#define EKEYREJECTED    129
+#define EOWNERDEAD      130
+#define ENOTRECOVERABLE 131
+#define ERFKILL         132
+#define EHWPOISON       133
diff --git a/musl-include/arm/bits/fcntl.h b/musl-include/arm/bits/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/fcntl.h
@@ -0,0 +1,40 @@
+#define O_CREAT        0100
+#define O_EXCL         0200
+#define O_NOCTTY       0400
+#define O_TRUNC       01000
+#define O_APPEND      02000
+#define O_NONBLOCK    04000
+#define O_DSYNC      010000
+#define O_SYNC     04010000
+#define O_RSYNC    04010000
+#define O_DIRECTORY  040000
+#define O_NOFOLLOW  0100000
+#define O_CLOEXEC  02000000
+
+#define O_ASYNC      020000
+#define O_DIRECT    0200000
+#define O_LARGEFILE 0400000
+#define O_NOATIME  01000000
+#define O_PATH    010000000
+#define O_TMPFILE 020040000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD  0
+#define F_GETFD  1
+#define F_SETFD  2
+#define F_GETFL  3
+#define F_SETFL  4
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#define F_GETLK 12
+#define F_SETLK 13
+#define F_SETLKW 14
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/musl-include/arm/bits/fenv.h b/musl-include/arm/bits/fenv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/fenv.h
@@ -0,0 +1,23 @@
+#ifndef __ARM_PCS_VFP
+#define FE_ALL_EXCEPT 0
+#define FE_TONEAREST  0
+#else
+#define FE_INVALID    1
+#define FE_DIVBYZERO  2
+#define FE_OVERFLOW   4
+#define FE_UNDERFLOW  8
+#define FE_INEXACT    16
+#define FE_ALL_EXCEPT 31
+#define FE_TONEAREST  0
+#define FE_DOWNWARD   0x800000
+#define FE_UPWARD     0x400000
+#define FE_TOWARDZERO 0xc00000
+#endif
+
+typedef unsigned long fexcept_t;
+
+typedef struct {
+	unsigned long __cw;
+} fenv_t;
+
+#define FE_DFL_ENV      ((const fenv_t *) -1)
diff --git a/musl-include/arm/bits/float.h b/musl-include/arm/bits/float.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/float.h
@@ -0,0 +1,16 @@
+#define FLT_EVAL_METHOD 0
+
+#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
+#define LDBL_MIN 2.22507385850720138309e-308L
+#define LDBL_MAX 1.79769313486231570815e+308L
+#define LDBL_EPSILON 2.22044604925031308085e-16L
+
+#define LDBL_MANT_DIG 53
+#define LDBL_MIN_EXP (-1021)
+#define LDBL_MAX_EXP 1024
+
+#define LDBL_DIG 15
+#define LDBL_MIN_10_EXP (-307)
+#define LDBL_MAX_10_EXP 308
+
+#define DECIMAL_DIG 17
diff --git a/musl-include/arm/bits/hwcap.h b/musl-include/arm/bits/hwcap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/hwcap.h
@@ -0,0 +1,53 @@
+#define HWCAP_SWP	(1 << 0)
+#define HWCAP_HALF	(1 << 1)
+#define HWCAP_THUMB	(1 << 2)
+#define HWCAP_26BIT	(1 << 3)
+#define HWCAP_FAST_MULT	(1 << 4)
+#define HWCAP_FPA	(1 << 5)
+#define HWCAP_VFP	(1 << 6)
+#define HWCAP_EDSP	(1 << 7)
+#define HWCAP_JAVA	(1 << 8)
+#define HWCAP_IWMMXT	(1 << 9)
+#define HWCAP_CRUNCH	(1 << 10)
+#define HWCAP_THUMBEE	(1 << 11)
+#define HWCAP_NEON	(1 << 12)
+#define HWCAP_VFPv3	(1 << 13)
+#define HWCAP_VFPv3D16	(1 << 14)
+#define HWCAP_TLS	(1 << 15)
+#define HWCAP_VFPv4	(1 << 16)
+#define HWCAP_IDIVA	(1 << 17)
+#define HWCAP_IDIVT	(1 << 18)
+#define HWCAP_VFPD32	(1 << 19)
+#define HWCAP_IDIV	(HWCAP_IDIVA | HWCAP_IDIVT)
+#define HWCAP_LPAE	(1 << 20)
+#define HWCAP_EVTSTRM	(1 << 21)
+
+#define HWCAP2_AES	(1 << 0)
+#define HWCAP2_PMULL	(1 << 1)
+#define HWCAP2_SHA1	(1 << 2)
+#define HWCAP2_SHA2	(1 << 3)
+#define HWCAP2_CRC32	(1 << 4)
+
+#define HWCAP_ARM_SWP	(1 << 0)
+#define HWCAP_ARM_HALF	(1 << 1)
+#define HWCAP_ARM_THUMB	(1 << 2)
+#define HWCAP_ARM_26BIT	(1 << 3)
+#define HWCAP_ARM_FAST_MULT	(1 << 4)
+#define HWCAP_ARM_FPA	(1 << 5)
+#define HWCAP_ARM_VFP	(1 << 6)
+#define HWCAP_ARM_EDSP	(1 << 7)
+#define HWCAP_ARM_JAVA	(1 << 8)
+#define HWCAP_ARM_IWMMXT	(1 << 9)
+#define HWCAP_ARM_CRUNCH	(1 << 10)
+#define HWCAP_ARM_THUMBEE	(1 << 11)
+#define HWCAP_ARM_NEON	(1 << 12)
+#define HWCAP_ARM_VFPv3	(1 << 13)
+#define HWCAP_ARM_VFPv3D16	(1 << 14)
+#define HWCAP_ARM_TLS	(1 << 15)
+#define HWCAP_ARM_VFPv4	(1 << 16)
+#define HWCAP_ARM_IDIVA	(1 << 17)
+#define HWCAP_ARM_IDIVT	(1 << 18)
+#define HWCAP_ARM_VFPD32	(1 << 19)
+#define HWCAP_ARM_IDIV	(HWCAP_ARM_IDIVA | HWCAP_ARM_IDIVT)
+#define HWCAP_ARM_LPAE	(1 << 20)
+#define HWCAP_ARM_EVTSTRM	(1 << 21)
diff --git a/musl-include/arm/bits/io.h b/musl-include/arm/bits/io.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/io.h
diff --git a/musl-include/arm/bits/ioctl.h b/musl-include/arm/bits/ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/ioctl.h
@@ -0,0 +1,115 @@
+#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE  0U
+#define _IOC_WRITE 1U
+#define _IOC_READ  2U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define TCGETS		0x5401
+#define TCSETS		0x5402
+#define TCSETSW		0x5403
+#define TCSETSF		0x5404
+#define TCGETA		0x5405
+#define TCSETA		0x5406
+#define TCSETAW		0x5407
+#define TCSETAF		0x5408
+#define TCSBRK		0x5409
+#define TCXONC		0x540A
+#define TCFLSH		0x540B
+#define TIOCEXCL	0x540C
+#define TIOCNXCL	0x540D
+#define TIOCSCTTY	0x540E
+#define TIOCGPGRP	0x540F
+#define TIOCSPGRP	0x5410
+#define TIOCOUTQ	0x5411
+#define TIOCSTI		0x5412
+#define TIOCGWINSZ	0x5413
+#define TIOCSWINSZ	0x5414
+#define TIOCMGET	0x5415
+#define TIOCMBIS	0x5416
+#define TIOCMBIC	0x5417
+#define TIOCMSET	0x5418
+#define TIOCGSOFTCAR	0x5419
+#define TIOCSSOFTCAR	0x541A
+#define FIONREAD	0x541B
+#define TIOCINQ		FIONREAD
+#define TIOCLINUX	0x541C
+#define TIOCCONS	0x541D
+#define TIOCGSERIAL	0x541E
+#define TIOCSSERIAL	0x541F
+#define TIOCPKT		0x5420
+#define FIONBIO		0x5421
+#define TIOCNOTTY	0x5422
+#define TIOCSETD	0x5423
+#define TIOCGETD	0x5424
+#define TCSBRKP		0x5425
+#define TIOCSBRK	0x5427
+#define TIOCCBRK	0x5428
+#define TIOCGSID	0x5429
+#define TIOCGRS485	0x542E
+#define TIOCSRS485	0x542F
+#define TIOCGPTN	0x80045430
+#define TIOCSPTLCK	0x40045431
+#define TIOCGDEV	0x80045432
+#define TCGETX		0x5432
+#define TCSETX		0x5433
+#define TCSETXF		0x5434
+#define TCSETXW		0x5435
+#define TIOCSIG		0x40045436
+#define TIOCVHANGUP	0x5437
+#define TIOCGPKT	0x80045438
+#define TIOCGPTLCK	0x80045439
+#define TIOCGEXCL	0x80045440
+#define TIOCGPTPEER	0x5441
+#define TIOCGISO7816	0x80285442
+#define TIOCSISO7816	0xc0285443
+
+#define FIONCLEX	0x5450
+#define FIOCLEX		0x5451
+#define FIOASYNC	0x5452
+#define TIOCSERCONFIG	0x5453
+#define TIOCSERGWILD	0x5454
+#define TIOCSERSWILD	0x5455
+#define TIOCGLCKTRMIOS	0x5456
+#define TIOCSLCKTRMIOS	0x5457
+#define TIOCSERGSTRUCT	0x5458
+#define TIOCSERGETLSR   0x5459
+#define TIOCSERGETMULTI 0x545A
+#define TIOCSERSETMULTI 0x545B
+
+#define TIOCMIWAIT	0x545C
+#define TIOCGICOUNT	0x545D
+#define FIOQSIZE	0x5460
+
+#define TIOCM_LE        0x001
+#define TIOCM_DTR       0x002
+#define TIOCM_RTS       0x004
+#define TIOCM_ST        0x008
+#define TIOCM_SR        0x010
+#define TIOCM_CTS       0x020
+#define TIOCM_CAR       0x040
+#define TIOCM_RNG       0x080
+#define TIOCM_DSR       0x100
+#define TIOCM_CD        TIOCM_CAR
+#define TIOCM_RI        TIOCM_RNG
+#define TIOCM_OUT1      0x2000
+#define TIOCM_OUT2      0x4000
+#define TIOCM_LOOP      0x8000
+
+#define FIOSETOWN       0x8901
+#define SIOCSPGRP       0x8902
+#define FIOGETOWN       0x8903
+#define SIOCGPGRP       0x8904
+#define SIOCATMARK      0x8905
+#if __LONG_MAX == 0x7fffffff
+#define SIOCGSTAMP      _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS    _IOR(0x89, 7, char[16])
+#else
+#define SIOCGSTAMP      0x8906
+#define SIOCGSTAMPNS    0x8907
+#endif
+
+#include <bits/ioctl_fix.h>
diff --git a/musl-include/arm/bits/ioctl_fix.h b/musl-include/arm/bits/ioctl_fix.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/ioctl_fix.h
@@ -0,0 +1,2 @@
+#undef FIOQSIZE
+#define FIOQSIZE 0x545e
diff --git a/musl-include/arm/bits/ipc.h b/musl-include/arm/bits/ipc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/ipc.h
@@ -0,0 +1,11 @@
+struct ipc_perm {
+	key_t __ipc_perm_key;
+	uid_t uid;
+	gid_t gid;
+	uid_t cuid;
+	gid_t cgid;
+	mode_t mode;
+	int __ipc_perm_seq;
+	long __pad1;
+	long __pad2;
+};
diff --git a/musl-include/arm/bits/ipcstat.h b/musl-include/arm/bits/ipcstat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/ipcstat.h
@@ -0,0 +1,1 @@
+#define IPC_STAT 0x102
diff --git a/musl-include/arm/bits/kd.h b/musl-include/arm/bits/kd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/kd.h
@@ -0,0 +1,1 @@
+#include <linux/kd.h>
diff --git a/musl-include/arm/bits/limits.h b/musl-include/arm/bits/limits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/limits.h
diff --git a/musl-include/arm/bits/link.h b/musl-include/arm/bits/link.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/link.h
@@ -0,0 +1,1 @@
+typedef uint32_t Elf_Symndx;
diff --git a/musl-include/arm/bits/mman.h b/musl-include/arm/bits/mman.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/mman.h
diff --git a/musl-include/arm/bits/msg.h b/musl-include/arm/bits/msg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/msg.h
@@ -0,0 +1,18 @@
+struct msqid_ds {
+	struct ipc_perm msg_perm;
+	unsigned long __msg_stime_lo;
+	unsigned long __msg_stime_hi;
+	unsigned long __msg_rtime_lo;
+	unsigned long __msg_rtime_hi;
+	unsigned long __msg_ctime_lo;
+	unsigned long __msg_ctime_hi;
+	unsigned long msg_cbytes;
+	msgqnum_t msg_qnum;
+	msglen_t msg_qbytes;
+	pid_t msg_lspid;
+	pid_t msg_lrpid;
+	unsigned long __unused[2];
+	time_t msg_stime;
+	time_t msg_rtime;
+	time_t msg_ctime;
+};
diff --git a/musl-include/arm/bits/poll.h b/musl-include/arm/bits/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/poll.h
diff --git a/musl-include/arm/bits/posix.h b/musl-include/arm/bits/posix.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG  1
+#define _POSIX_V7_ILP32_OFFBIG  1
diff --git a/musl-include/arm/bits/ptrace.h b/musl-include/arm/bits/ptrace.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/ptrace.h
@@ -0,0 +1,25 @@
+#define PTRACE_GETWMMXREGS	18
+#define PTRACE_SETWMMXREGS	19
+#define PTRACE_GET_THREAD_AREA	22
+#define PTRACE_SET_SYSCALL	23
+#define PTRACE_GETCRUNCHREGS	25
+#define PTRACE_SETCRUNCHREGS	26
+#define PTRACE_GETVFPREGS	27
+#define PTRACE_SETVFPREGS	28
+#define PTRACE_GETHBPREGS	29
+#define PTRACE_SETHBPREGS	30
+#define PTRACE_GETFDPIC		31
+#define PTRACE_GETFDPIC_EXEC	0
+#define PTRACE_GETFDPIC_INTERP	1
+
+#define PT_GETWMMXREGS PTRACE_GETWMMXREGS
+#define PT_SETWMMXREGS PTRACE_SETWMMXREGS
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+#define PT_SET_SYSCALL PTRACE_SET_SYSCALL
+#define PT_GETCRUNCHREGS PTRACE_GETCRUNCHREGS
+#define PT_SETCRUNCHREGS PTRACE_SETCRUNCHREGS
+#define PT_GETVFPREGS PTRACE_GETVFPREGS
+#define PT_SETVFPREGS PTRACE_SETVFPREGS
+#define PT_GETHBPREGS PTRACE_GETHBPREGS
+#define PT_SETHBPREGS PTRACE_SETHBPREGS
+#define PT_GETFDPIC PTRACE_GETFDPIC
diff --git a/musl-include/arm/bits/reg.h b/musl-include/arm/bits/reg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/reg.h
@@ -0,0 +1,3 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+/* FIXME */
diff --git a/musl-include/arm/bits/resource.h b/musl-include/arm/bits/resource.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/resource.h
diff --git a/musl-include/arm/bits/sem.h b/musl-include/arm/bits/sem.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/sem.h
@@ -0,0 +1,18 @@
+struct semid_ds {
+	struct ipc_perm sem_perm;
+	unsigned long __sem_otime_lo;
+	unsigned long __sem_otime_hi;
+	unsigned long __sem_ctime_lo;
+	unsigned long __sem_ctime_hi;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned short sem_nsems;
+	char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+#else
+	char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+	unsigned short sem_nsems;
+#endif
+	long __unused3;
+	long __unused4;
+	time_t sem_otime;
+	time_t sem_ctime;
+};
diff --git a/musl-include/arm/bits/setjmp.h b/musl-include/arm/bits/setjmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/setjmp.h
@@ -0,0 +1,1 @@
+typedef unsigned long long __jmp_buf[32];
diff --git a/musl-include/arm/bits/shm.h b/musl-include/arm/bits/shm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/shm.h
@@ -0,0 +1,31 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+	struct ipc_perm shm_perm;
+	size_t shm_segsz;
+	unsigned long __shm_atime_lo;
+	unsigned long __shm_atime_hi;
+	unsigned long __shm_dtime_lo;
+	unsigned long __shm_dtime_hi;
+	unsigned long __shm_ctime_lo;
+	unsigned long __shm_ctime_hi;
+	pid_t shm_cpid;
+	pid_t shm_lpid;
+	unsigned long shm_nattch;
+	unsigned long __pad1;
+	unsigned long __pad2;
+	unsigned long __pad3;
+	time_t shm_atime;
+	time_t shm_dtime;
+	time_t shm_ctime;
+};
+
+struct shminfo {
+	unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+	int __used_ids;
+	unsigned long shm_tot, shm_rss, shm_swp;
+	unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/musl-include/arm/bits/signal.h b/musl-include/arm/bits/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/signal.h
@@ -0,0 +1,86 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef int greg_t, gregset_t[18];
+typedef struct sigcontext {
+	unsigned long trap_no, error_code, oldmask;
+	unsigned long arm_r0, arm_r1, arm_r2, arm_r3;
+	unsigned long arm_r4, arm_r5, arm_r6, arm_r7;
+	unsigned long arm_r8, arm_r9, arm_r10, arm_fp;
+	unsigned long arm_ip, arm_sp, arm_lr, arm_pc;
+	unsigned long arm_cpsr, fault_address;
+} mcontext_t;
+#else
+typedef struct {
+	unsigned long __regs[21];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+	void *ss_sp;
+	int ss_flags;
+	size_t ss_size;
+};
+
+typedef struct __ucontext {
+	unsigned long uc_flags;
+	struct __ucontext *uc_link;
+	stack_t uc_stack;
+	mcontext_t uc_mcontext;
+	sigset_t uc_sigmask;
+	unsigned long long uc_regspace[64];
+} ucontext_t;
+
+#define SA_NOCLDSTOP  1
+#define SA_NOCLDWAIT  2
+#define SA_SIGINFO    4
+#define SA_ONSTACK    0x08000000
+#define SA_RESTART    0x10000000
+#define SA_NODEFER    0x40000000
+#define SA_RESETHAND  0x80000000
+#define SA_RESTORER   0x04000000
+
+#endif
+
+#define SIGHUP    1
+#define SIGINT    2
+#define SIGQUIT   3
+#define SIGILL    4
+#define SIGTRAP   5
+#define SIGABRT   6
+#define SIGIOT    SIGABRT
+#define SIGBUS    7
+#define SIGFPE    8
+#define SIGKILL   9
+#define SIGUSR1   10
+#define SIGSEGV   11
+#define SIGUSR2   12
+#define SIGPIPE   13
+#define SIGALRM   14
+#define SIGTERM   15
+#define SIGSTKFLT 16
+#define SIGCHLD   17
+#define SIGCONT   18
+#define SIGSTOP   19
+#define SIGTSTP   20
+#define SIGTTIN   21
+#define SIGTTOU   22
+#define SIGURG    23
+#define SIGXCPU   24
+#define SIGXFSZ   25
+#define SIGVTALRM 26
+#define SIGPROF   27
+#define SIGWINCH  28
+#define SIGIO     29
+#define SIGPOLL   29
+#define SIGPWR    30
+#define SIGSYS    31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
diff --git a/musl-include/arm/bits/socket.h b/musl-include/arm/bits/socket.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/socket.h
diff --git a/musl-include/arm/bits/soundcard.h b/musl-include/arm/bits/soundcard.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/soundcard.h
@@ -0,0 +1,1 @@
+#include <linux/soundcard.h>
diff --git a/musl-include/arm/bits/stat.h b/musl-include/arm/bits/stat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/stat.h
@@ -0,0 +1,25 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+	dev_t st_dev;
+	int __st_dev_padding;
+	long __st_ino_truncated;
+	mode_t st_mode;
+	nlink_t st_nlink;
+	uid_t st_uid;
+	gid_t st_gid;
+	dev_t st_rdev;
+	int __st_rdev_padding;
+	off_t st_size;
+	blksize_t st_blksize;
+	blkcnt_t st_blocks;
+	struct {
+		long tv_sec;
+		long tv_nsec;
+	} __st_atim32, __st_mtim32, __st_ctim32;
+	ino_t st_ino;
+	struct timespec st_atim;
+	struct timespec st_mtim;
+	struct timespec st_ctim;
+};
diff --git a/musl-include/arm/bits/statfs.h b/musl-include/arm/bits/statfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/statfs.h
@@ -0,0 +1,7 @@
+struct statfs {
+	unsigned long f_type, f_bsize;
+	fsblkcnt_t f_blocks, f_bfree, f_bavail;
+	fsfilcnt_t f_files, f_ffree;
+	fsid_t f_fsid;
+	unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
+};
diff --git a/musl-include/arm/bits/stdint.h b/musl-include/arm/bits/stdint.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN  INT32_MIN
+#define INT_FAST32_MIN  INT32_MIN
+
+#define INT_FAST16_MAX  INT32_MAX
+#define INT_FAST32_MAX  INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN      INT32_MIN
+#define INTPTR_MAX      INT32_MAX
+#define UINTPTR_MAX     UINT32_MAX
+#define PTRDIFF_MIN     INT32_MIN
+#define PTRDIFF_MAX     INT32_MAX
+#define SIZE_MAX        UINT32_MAX
diff --git a/musl-include/arm/bits/syscall.h b/musl-include/arm/bits/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/syscall.h
@@ -0,0 +1,820 @@
+#define __NR_restart_syscall	0
+#define __NR_exit	1
+#define __NR_fork	2
+#define __NR_read	3
+#define __NR_write	4
+#define __NR_open	5
+#define __NR_close	6
+#define __NR_creat	8
+#define __NR_link	9
+#define __NR_unlink	10
+#define __NR_execve	11
+#define __NR_chdir	12
+#define __NR_mknod	14
+#define __NR_chmod	15
+#define __NR_lchown	16
+#define __NR_lseek	19
+#define __NR_getpid	20
+#define __NR_mount	21
+#define __NR_setuid	23
+#define __NR_getuid	24
+#define __NR_ptrace	26
+#define __NR_pause	29
+#define __NR_access	33
+#define __NR_nice	34
+#define __NR_sync	36
+#define __NR_kill	37
+#define __NR_rename	38
+#define __NR_mkdir	39
+#define __NR_rmdir	40
+#define __NR_dup	41
+#define __NR_pipe	42
+#define __NR_times	43
+#define __NR_brk	45
+#define __NR_setgid	46
+#define __NR_getgid	47
+#define __NR_geteuid	49
+#define __NR_getegid	50
+#define __NR_acct	51
+#define __NR_umount2	52
+#define __NR_ioctl	54
+#define __NR_fcntl	55
+#define __NR_setpgid	57
+#define __NR_umask	60
+#define __NR_chroot	61
+#define __NR_ustat	62
+#define __NR_dup2	63
+#define __NR_getppid	64
+#define __NR_getpgrp	65
+#define __NR_setsid	66
+#define __NR_sigaction	67
+#define __NR_setreuid	70
+#define __NR_setregid	71
+#define __NR_sigsuspend	72
+#define __NR_sigpending	73
+#define __NR_sethostname	74
+#define __NR_setrlimit	75
+#define __NR_getrusage	77
+#define __NR_gettimeofday_time32	78
+#define __NR_settimeofday_time32	79
+#define __NR_getgroups	80
+#define __NR_setgroups	81
+#define __NR_symlink	83
+#define __NR_readlink	85
+#define __NR_uselib	86
+#define __NR_swapon	87
+#define __NR_reboot	88
+#define __NR_munmap	91
+#define __NR_truncate	92
+#define __NR_ftruncate	93
+#define __NR_fchmod	94
+#define __NR_fchown	95
+#define __NR_getpriority	96
+#define __NR_setpriority	97
+#define __NR_statfs	99
+#define __NR_fstatfs	100
+#define __NR_syslog	103
+#define __NR_setitimer	104
+#define __NR_getitimer	105
+#define __NR_stat	106
+#define __NR_lstat	107
+#define __NR_fstat	108
+#define __NR_vhangup	111
+#define __NR_wait4	114
+#define __NR_swapoff	115
+#define __NR_sysinfo	116
+#define __NR_fsync	118
+#define __NR_sigreturn	119
+#define __NR_clone	120
+#define __NR_setdomainname	121
+#define __NR_uname	122
+#define __NR_adjtimex	124
+#define __NR_mprotect	125
+#define __NR_sigprocmask	126
+#define __NR_init_module	128
+#define __NR_delete_module	129
+#define __NR_quotactl	131
+#define __NR_getpgid	132
+#define __NR_fchdir	133
+#define __NR_bdflush	134
+#define __NR_sysfs	135
+#define __NR_personality	136
+#define __NR_setfsuid	138
+#define __NR_setfsgid	139
+#define __NR__llseek	140
+#define __NR_getdents	141
+#define __NR__newselect	142
+#define __NR_flock	143
+#define __NR_msync	144
+#define __NR_readv	145
+#define __NR_writev	146
+#define __NR_getsid	147
+#define __NR_fdatasync	148
+#define __NR__sysctl	149
+#define __NR_mlock	150
+#define __NR_munlock	151
+#define __NR_mlockall	152
+#define __NR_munlockall	153
+#define __NR_sched_setparam	154
+#define __NR_sched_getparam	155
+#define __NR_sched_setscheduler	156
+#define __NR_sched_getscheduler	157
+#define __NR_sched_yield	158
+#define __NR_sched_get_priority_max	159
+#define __NR_sched_get_priority_min	160
+#define __NR_sched_rr_get_interval	161
+#define __NR_nanosleep	162
+#define __NR_mremap	163
+#define __NR_setresuid	164
+#define __NR_getresuid	165
+#define __NR_poll	168
+#define __NR_nfsservctl	169
+#define __NR_setresgid	170
+#define __NR_getresgid	171
+#define __NR_prctl	172
+#define __NR_rt_sigreturn	173
+#define __NR_rt_sigaction	174
+#define __NR_rt_sigprocmask	175
+#define __NR_rt_sigpending	176
+#define __NR_rt_sigtimedwait	177
+#define __NR_rt_sigqueueinfo	178
+#define __NR_rt_sigsuspend	179
+#define __NR_pread64	180
+#define __NR_pwrite64	181
+#define __NR_chown	182
+#define __NR_getcwd	183
+#define __NR_capget	184
+#define __NR_capset	185
+#define __NR_sigaltstack	186
+#define __NR_sendfile	187
+#define __NR_vfork	190
+#define __NR_ugetrlimit	191
+#define __NR_mmap2	192
+#define __NR_truncate64	193
+#define __NR_ftruncate64	194
+#define __NR_stat64	195
+#define __NR_lstat64	196
+#define __NR_fstat64	197
+#define __NR_lchown32	198
+#define __NR_getuid32	199
+#define __NR_getgid32	200
+#define __NR_geteuid32	201
+#define __NR_getegid32	202
+#define __NR_setreuid32	203
+#define __NR_setregid32	204
+#define __NR_getgroups32	205
+#define __NR_setgroups32	206
+#define __NR_fchown32	207
+#define __NR_setresuid32	208
+#define __NR_getresuid32	209
+#define __NR_setresgid32	210
+#define __NR_getresgid32	211
+#define __NR_chown32	212
+#define __NR_setuid32	213
+#define __NR_setgid32	214
+#define __NR_setfsuid32	215
+#define __NR_setfsgid32	216
+#define __NR_getdents64	217
+#define __NR_pivot_root	218
+#define __NR_mincore	219
+#define __NR_madvise	220
+#define __NR_fcntl64	221
+#define __NR_gettid	224
+#define __NR_readahead	225
+#define __NR_setxattr	226
+#define __NR_lsetxattr	227
+#define __NR_fsetxattr	228
+#define __NR_getxattr	229
+#define __NR_lgetxattr	230
+#define __NR_fgetxattr	231
+#define __NR_listxattr	232
+#define __NR_llistxattr	233
+#define __NR_flistxattr	234
+#define __NR_removexattr	235
+#define __NR_lremovexattr	236
+#define __NR_fremovexattr	237
+#define __NR_tkill	238
+#define __NR_sendfile64	239
+#define __NR_futex	240
+#define __NR_sched_setaffinity	241
+#define __NR_sched_getaffinity	242
+#define __NR_io_setup	243
+#define __NR_io_destroy	244
+#define __NR_io_getevents	245
+#define __NR_io_submit	246
+#define __NR_io_cancel	247
+#define __NR_exit_group	248
+#define __NR_lookup_dcookie	249
+#define __NR_epoll_create	250
+#define __NR_epoll_ctl	251
+#define __NR_epoll_wait	252
+#define __NR_remap_file_pages	253
+#define __NR_set_tid_address	256
+#define __NR_timer_create	257
+#define __NR_timer_settime32	258
+#define __NR_timer_gettime32	259
+#define __NR_timer_getoverrun	260
+#define __NR_timer_delete	261
+#define __NR_clock_settime32	262
+#define __NR_clock_gettime32	263
+#define __NR_clock_getres_time32	264
+#define __NR_clock_nanosleep_time32	265
+#define __NR_statfs64	266
+#define __NR_fstatfs64	267
+#define __NR_tgkill	268
+#define __NR_utimes	269
+#define __NR_fadvise64_64	270
+#define __NR_arm_fadvise64_64	270
+#define __NR_pciconfig_iobase	271
+#define __NR_pciconfig_read	272
+#define __NR_pciconfig_write	273
+#define __NR_mq_open	274
+#define __NR_mq_unlink	275
+#define __NR_mq_timedsend	276
+#define __NR_mq_timedreceive	277
+#define __NR_mq_notify	278
+#define __NR_mq_getsetattr	279
+#define __NR_waitid	280
+#define __NR_socket	281
+#define __NR_bind	282
+#define __NR_connect	283
+#define __NR_listen	284
+#define __NR_accept	285
+#define __NR_getsockname	286
+#define __NR_getpeername	287
+#define __NR_socketpair	288
+#define __NR_send	289
+#define __NR_sendto	290
+#define __NR_recv	291
+#define __NR_recvfrom	292
+#define __NR_shutdown	293
+#define __NR_setsockopt	294
+#define __NR_getsockopt	295
+#define __NR_sendmsg	296
+#define __NR_recvmsg	297
+#define __NR_semop	298
+#define __NR_semget	299
+#define __NR_semctl	300
+#define __NR_msgsnd	301
+#define __NR_msgrcv	302
+#define __NR_msgget	303
+#define __NR_msgctl	304
+#define __NR_shmat	305
+#define __NR_shmdt	306
+#define __NR_shmget	307
+#define __NR_shmctl	308
+#define __NR_add_key	309
+#define __NR_request_key	310
+#define __NR_keyctl	311
+#define __NR_semtimedop	312
+#define __NR_vserver	313
+#define __NR_ioprio_set	314
+#define __NR_ioprio_get	315
+#define __NR_inotify_init	316
+#define __NR_inotify_add_watch	317
+#define __NR_inotify_rm_watch	318
+#define __NR_mbind	319
+#define __NR_get_mempolicy	320
+#define __NR_set_mempolicy	321
+#define __NR_openat	322
+#define __NR_mkdirat	323
+#define __NR_mknodat	324
+#define __NR_fchownat	325
+#define __NR_futimesat	326
+#define __NR_fstatat64	327
+#define __NR_unlinkat	328
+#define __NR_renameat	329
+#define __NR_linkat	330
+#define __NR_symlinkat	331
+#define __NR_readlinkat	332
+#define __NR_fchmodat	333
+#define __NR_faccessat	334
+#define __NR_pselect6	335
+#define __NR_ppoll	336
+#define __NR_unshare	337
+#define __NR_set_robust_list	338
+#define __NR_get_robust_list	339
+#define __NR_splice	340
+#define __NR_sync_file_range2	341
+#define __NR_arm_sync_file_range	341
+#define __NR_tee	342
+#define __NR_vmsplice	343
+#define __NR_move_pages	344
+#define __NR_getcpu	345
+#define __NR_epoll_pwait	346
+#define __NR_kexec_load	347
+#define __NR_utimensat	348
+#define __NR_signalfd	349
+#define __NR_timerfd_create	350
+#define __NR_eventfd	351
+#define __NR_fallocate	352
+#define __NR_timerfd_settime32	353
+#define __NR_timerfd_gettime32	354
+#define __NR_signalfd4	355
+#define __NR_eventfd2	356
+#define __NR_epoll_create1	357
+#define __NR_dup3	358
+#define __NR_pipe2	359
+#define __NR_inotify_init1	360
+#define __NR_preadv	361
+#define __NR_pwritev	362
+#define __NR_rt_tgsigqueueinfo	363
+#define __NR_perf_event_open	364
+#define __NR_recvmmsg	365
+#define __NR_accept4	366
+#define __NR_fanotify_init	367
+#define __NR_fanotify_mark	368
+#define __NR_prlimit64	369
+#define __NR_name_to_handle_at	370
+#define __NR_open_by_handle_at	371
+#define __NR_clock_adjtime	372
+#define __NR_syncfs	373
+#define __NR_sendmmsg	374
+#define __NR_setns	375
+#define __NR_process_vm_readv	376
+#define __NR_process_vm_writev	377
+#define __NR_kcmp		378
+#define __NR_finit_module	379
+#define __NR_sched_setattr	380
+#define __NR_sched_getattr	381
+#define __NR_renameat2	382
+#define __NR_seccomp	383
+#define __NR_getrandom	384
+#define __NR_memfd_create	385
+#define __NR_bpf	386
+#define __NR_execveat	387
+#define __NR_userfaultfd	388
+#define __NR_membarrier		389
+#define __NR_mlock2		390
+#define __NR_copy_file_range	391
+#define __NR_preadv2	392
+#define __NR_pwritev2	393
+#define __NR_pkey_mprotect	394
+#define __NR_pkey_alloc	395
+#define __NR_pkey_free	396
+#define __NR_statx	397
+#define __NR_rseq	398
+#define __NR_io_pgetevents	399
+#define __NR_migrate_pages	400
+#define __NR_kexec_file_load	401
+#define __NR_clock_gettime64	403
+#define __NR_clock_settime64	404
+#define __NR_clock_adjtime64	405
+#define __NR_clock_getres_time64	406
+#define __NR_clock_nanosleep_time64	407
+#define __NR_timer_gettime64	408
+#define __NR_timer_settime64	409
+#define __NR_timerfd_gettime64	410
+#define __NR_timerfd_settime64	411
+#define __NR_utimensat_time64	412
+#define __NR_pselect6_time64	413
+#define __NR_ppoll_time64	414
+#define __NR_io_pgetevents_time64	416
+#define __NR_recvmmsg_time64	417
+#define __NR_mq_timedsend_time64	418
+#define __NR_mq_timedreceive_time64	419
+#define __NR_semtimedop_time64	420
+#define __NR_rt_sigtimedwait_time64	421
+#define __NR_futex_time64	422
+#define __NR_sched_rr_get_interval_time64	423
+#define __NR_pidfd_send_signal	424
+#define __NR_io_uring_setup	425
+#define __NR_io_uring_enter	426
+#define __NR_io_uring_register	427
+#define __NR_open_tree		428
+#define __NR_move_mount		429
+#define __NR_fsopen		430
+#define __NR_fsconfig		431
+#define __NR_fsmount		432
+#define __NR_fspick		433
+#define __NR_pidfd_open		434
+#define __NR_clone3		435
+#define __NR_close_range	436
+#define __NR_openat2		437
+#define __NR_pidfd_getfd	438
+#define __NR_faccessat2		439
+#define __NR_process_madvise	440
+#define __NR_epoll_pwait2	441
+#define __NR_mount_setattr	442
+#define __NR_landlock_create_ruleset	444
+#define __NR_landlock_add_rule	445
+#define __NR_landlock_restrict_self	446
+#define __NR_process_mrelease	448
+#define __NR_futex_waitv	449
+#define __NR_set_mempolicy_home_node	450
+#define __NR_cachestat		451
+#define __NR_fchmodat2		452
+
+#define __ARM_NR_breakpoint	0x0f0001
+#define __ARM_NR_cacheflush	0x0f0002
+#define __ARM_NR_usr26		0x0f0003
+#define __ARM_NR_usr32		0x0f0004
+#define __ARM_NR_set_tls	0x0f0005
+#define __ARM_NR_get_tls	0x0f0006
+
+#define SYS_restart_syscall	0
+#define SYS_exit	1
+#define SYS_fork	2
+#define SYS_read	3
+#define SYS_write	4
+#define SYS_open	5
+#define SYS_close	6
+#define SYS_creat	8
+#define SYS_link	9
+#define SYS_unlink	10
+#define SYS_execve	11
+#define SYS_chdir	12
+#define SYS_mknod	14
+#define SYS_chmod	15
+#define SYS_lchown	16
+#define SYS_lseek	19
+#define SYS_getpid	20
+#define SYS_mount	21
+#define SYS_setuid	23
+#define SYS_getuid	24
+#define SYS_ptrace	26
+#define SYS_pause	29
+#define SYS_access	33
+#define SYS_nice	34
+#define SYS_sync	36
+#define SYS_kill	37
+#define SYS_rename	38
+#define SYS_mkdir	39
+#define SYS_rmdir	40
+#define SYS_dup	41
+#define SYS_pipe	42
+#define SYS_times	43
+#define SYS_brk	45
+#define SYS_setgid	46
+#define SYS_getgid	47
+#define SYS_geteuid	49
+#define SYS_getegid	50
+#define SYS_acct	51
+#define SYS_umount2	52
+#define SYS_ioctl	54
+#define SYS_fcntl	55
+#define SYS_setpgid	57
+#define SYS_umask	60
+#define SYS_chroot	61
+#define SYS_ustat	62
+#define SYS_dup2	63
+#define SYS_getppid	64
+#define SYS_getpgrp	65
+#define SYS_setsid	66
+#define SYS_sigaction	67
+#define SYS_setreuid	70
+#define SYS_setregid	71
+#define SYS_sigsuspend	72
+#define SYS_sigpending	73
+#define SYS_sethostname	74
+#define SYS_setrlimit	75
+#define SYS_getrusage	77
+#define SYS_gettimeofday_time32	78
+#define SYS_settimeofday_time32	79
+#define SYS_getgroups	80
+#define SYS_setgroups	81
+#define SYS_symlink	83
+#define SYS_readlink	85
+#define SYS_uselib	86
+#define SYS_swapon	87
+#define SYS_reboot	88
+#define SYS_munmap	91
+#define SYS_truncate	92
+#define SYS_ftruncate	93
+#define SYS_fchmod	94
+#define SYS_fchown	95
+#define SYS_getpriority	96
+#define SYS_setpriority	97
+#define SYS_statfs	99
+#define SYS_fstatfs	100
+#define SYS_syslog	103
+#define SYS_setitimer	104
+#define SYS_getitimer	105
+#define SYS_stat	106
+#define SYS_lstat	107
+#define SYS_fstat	108
+#define SYS_vhangup	111
+#define SYS_wait4	114
+#define SYS_swapoff	115
+#define SYS_sysinfo	116
+#define SYS_fsync	118
+#define SYS_sigreturn	119
+#define SYS_clone	120
+#define SYS_setdomainname	121
+#define SYS_uname	122
+#define SYS_adjtimex	124
+#define SYS_mprotect	125
+#define SYS_sigprocmask	126
+#define SYS_init_module	128
+#define SYS_delete_module	129
+#define SYS_quotactl	131
+#define SYS_getpgid	132
+#define SYS_fchdir	133
+#define SYS_bdflush	134
+#define SYS_sysfs	135
+#define SYS_personality	136
+#define SYS_setfsuid	138
+#define SYS_setfsgid	139
+#define SYS__llseek	140
+#define SYS_getdents	141
+#define SYS__newselect	142
+#define SYS_flock	143
+#define SYS_msync	144
+#define SYS_readv	145
+#define SYS_writev	146
+#define SYS_getsid	147
+#define SYS_fdatasync	148
+#define SYS__sysctl	149
+#define SYS_mlock	150
+#define SYS_munlock	151
+#define SYS_mlockall	152
+#define SYS_munlockall	153
+#define SYS_sched_setparam	154
+#define SYS_sched_getparam	155
+#define SYS_sched_setscheduler	156
+#define SYS_sched_getscheduler	157
+#define SYS_sched_yield	158
+#define SYS_sched_get_priority_max	159
+#define SYS_sched_get_priority_min	160
+#define SYS_sched_rr_get_interval	161
+#define SYS_nanosleep	162
+#define SYS_mremap	163
+#define SYS_setresuid	164
+#define SYS_getresuid	165
+#define SYS_poll	168
+#define SYS_nfsservctl	169
+#define SYS_setresgid	170
+#define SYS_getresgid	171
+#define SYS_prctl	172
+#define SYS_rt_sigreturn	173
+#define SYS_rt_sigaction	174
+#define SYS_rt_sigprocmask	175
+#define SYS_rt_sigpending	176
+#define SYS_rt_sigtimedwait	177
+#define SYS_rt_sigqueueinfo	178
+#define SYS_rt_sigsuspend	179
+#define SYS_pread64	180
+#define SYS_pwrite64	181
+#define SYS_chown	182
+#define SYS_getcwd	183
+#define SYS_capget	184
+#define SYS_capset	185
+#define SYS_sigaltstack	186
+#define SYS_sendfile	187
+#define SYS_vfork	190
+#define SYS_ugetrlimit	191
+#define SYS_mmap2	192
+#define SYS_truncate64	193
+#define SYS_ftruncate64	194
+#define SYS_stat64	195
+#define SYS_lstat64	196
+#define SYS_fstat64	197
+#define SYS_lchown32	198
+#define SYS_getuid32	199
+#define SYS_getgid32	200
+#define SYS_geteuid32	201
+#define SYS_getegid32	202
+#define SYS_setreuid32	203
+#define SYS_setregid32	204
+#define SYS_getgroups32	205
+#define SYS_setgroups32	206
+#define SYS_fchown32	207
+#define SYS_setresuid32	208
+#define SYS_getresuid32	209
+#define SYS_setresgid32	210
+#define SYS_getresgid32	211
+#define SYS_chown32	212
+#define SYS_setuid32	213
+#define SYS_setgid32	214
+#define SYS_setfsuid32	215
+#define SYS_setfsgid32	216
+#define SYS_getdents64	217
+#define SYS_pivot_root	218
+#define SYS_mincore	219
+#define SYS_madvise	220
+#define SYS_fcntl64	221
+#define SYS_gettid	224
+#define SYS_readahead	225
+#define SYS_setxattr	226
+#define SYS_lsetxattr	227
+#define SYS_fsetxattr	228
+#define SYS_getxattr	229
+#define SYS_lgetxattr	230
+#define SYS_fgetxattr	231
+#define SYS_listxattr	232
+#define SYS_llistxattr	233
+#define SYS_flistxattr	234
+#define SYS_removexattr	235
+#define SYS_lremovexattr	236
+#define SYS_fremovexattr	237
+#define SYS_tkill	238
+#define SYS_sendfile64	239
+#define SYS_futex	240
+#define SYS_sched_setaffinity	241
+#define SYS_sched_getaffinity	242
+#define SYS_io_setup	243
+#define SYS_io_destroy	244
+#define SYS_io_getevents	245
+#define SYS_io_submit	246
+#define SYS_io_cancel	247
+#define SYS_exit_group	248
+#define SYS_lookup_dcookie	249
+#define SYS_epoll_create	250
+#define SYS_epoll_ctl	251
+#define SYS_epoll_wait	252
+#define SYS_remap_file_pages	253
+#define SYS_set_tid_address	256
+#define SYS_timer_create	257
+#define SYS_timer_settime32	258
+#define SYS_timer_gettime32	259
+#define SYS_timer_getoverrun	260
+#define SYS_timer_delete	261
+#define SYS_clock_settime32	262
+#define SYS_clock_gettime32	263
+#define SYS_clock_getres_time32	264
+#define SYS_clock_nanosleep_time32	265
+#define SYS_statfs64	266
+#define SYS_fstatfs64	267
+#define SYS_tgkill	268
+#define SYS_utimes	269
+#define SYS_fadvise64_64	270
+#define SYS_arm_fadvise64_64	270
+#define SYS_pciconfig_iobase	271
+#define SYS_pciconfig_read	272
+#define SYS_pciconfig_write	273
+#define SYS_mq_open	274
+#define SYS_mq_unlink	275
+#define SYS_mq_timedsend	276
+#define SYS_mq_timedreceive	277
+#define SYS_mq_notify	278
+#define SYS_mq_getsetattr	279
+#define SYS_waitid	280
+#define SYS_socket	281
+#define SYS_bind	282
+#define SYS_connect	283
+#define SYS_listen	284
+#define SYS_accept	285
+#define SYS_getsockname	286
+#define SYS_getpeername	287
+#define SYS_socketpair	288
+#define SYS_send	289
+#define SYS_sendto	290
+#define SYS_recv	291
+#define SYS_recvfrom	292
+#define SYS_shutdown	293
+#define SYS_setsockopt	294
+#define SYS_getsockopt	295
+#define SYS_sendmsg	296
+#define SYS_recvmsg	297
+#define SYS_semop	298
+#define SYS_semget	299
+#define SYS_semctl	300
+#define SYS_msgsnd	301
+#define SYS_msgrcv	302
+#define SYS_msgget	303
+#define SYS_msgctl	304
+#define SYS_shmat	305
+#define SYS_shmdt	306
+#define SYS_shmget	307
+#define SYS_shmctl	308
+#define SYS_add_key	309
+#define SYS_request_key	310
+#define SYS_keyctl	311
+#define SYS_semtimedop	312
+#define SYS_vserver	313
+#define SYS_ioprio_set	314
+#define SYS_ioprio_get	315
+#define SYS_inotify_init	316
+#define SYS_inotify_add_watch	317
+#define SYS_inotify_rm_watch	318
+#define SYS_mbind	319
+#define SYS_get_mempolicy	320
+#define SYS_set_mempolicy	321
+#define SYS_openat	322
+#define SYS_mkdirat	323
+#define SYS_mknodat	324
+#define SYS_fchownat	325
+#define SYS_futimesat	326
+#define SYS_fstatat64	327
+#define SYS_unlinkat	328
+#define SYS_renameat	329
+#define SYS_linkat	330
+#define SYS_symlinkat	331
+#define SYS_readlinkat	332
+#define SYS_fchmodat	333
+#define SYS_faccessat	334
+#define SYS_pselect6	335
+#define SYS_ppoll	336
+#define SYS_unshare	337
+#define SYS_set_robust_list	338
+#define SYS_get_robust_list	339
+#define SYS_splice	340
+#define SYS_sync_file_range2	341
+#define SYS_arm_sync_file_range	341
+#define SYS_tee	342
+#define SYS_vmsplice	343
+#define SYS_move_pages	344
+#define SYS_getcpu	345
+#define SYS_epoll_pwait	346
+#define SYS_kexec_load	347
+#define SYS_utimensat	348
+#define SYS_signalfd	349
+#define SYS_timerfd_create	350
+#define SYS_eventfd	351
+#define SYS_fallocate	352
+#define SYS_timerfd_settime32	353
+#define SYS_timerfd_gettime32	354
+#define SYS_signalfd4	355
+#define SYS_eventfd2	356
+#define SYS_epoll_create1	357
+#define SYS_dup3	358
+#define SYS_pipe2	359
+#define SYS_inotify_init1	360
+#define SYS_preadv	361
+#define SYS_pwritev	362
+#define SYS_rt_tgsigqueueinfo	363
+#define SYS_perf_event_open	364
+#define SYS_recvmmsg	365
+#define SYS_accept4	366
+#define SYS_fanotify_init	367
+#define SYS_fanotify_mark	368
+#define SYS_prlimit64	369
+#define SYS_name_to_handle_at	370
+#define SYS_open_by_handle_at	371
+#define SYS_clock_adjtime	372
+#define SYS_syncfs	373
+#define SYS_sendmmsg	374
+#define SYS_setns	375
+#define SYS_process_vm_readv	376
+#define SYS_process_vm_writev	377
+#define SYS_kcmp		378
+#define SYS_finit_module	379
+#define SYS_sched_setattr	380
+#define SYS_sched_getattr	381
+#define SYS_renameat2	382
+#define SYS_seccomp	383
+#define SYS_getrandom	384
+#define SYS_memfd_create	385
+#define SYS_bpf	386
+#define SYS_execveat	387
+#define SYS_userfaultfd	388
+#define SYS_membarrier		389
+#define SYS_mlock2		390
+#define SYS_copy_file_range	391
+#define SYS_preadv2	392
+#define SYS_pwritev2	393
+#define SYS_pkey_mprotect	394
+#define SYS_pkey_alloc	395
+#define SYS_pkey_free	396
+#define SYS_statx	397
+#define SYS_rseq	398
+#define SYS_io_pgetevents	399
+#define SYS_migrate_pages	400
+#define SYS_kexec_file_load	401
+#define SYS_clock_gettime64	403
+#define SYS_clock_settime64	404
+#define SYS_clock_adjtime64	405
+#define SYS_clock_getres_time64	406
+#define SYS_clock_nanosleep_time64	407
+#define SYS_timer_gettime64	408
+#define SYS_timer_settime64	409
+#define SYS_timerfd_gettime64	410
+#define SYS_timerfd_settime64	411
+#define SYS_utimensat_time64	412
+#define SYS_pselect6_time64	413
+#define SYS_ppoll_time64	414
+#define SYS_io_pgetevents_time64	416
+#define SYS_recvmmsg_time64	417
+#define SYS_mq_timedsend_time64	418
+#define SYS_mq_timedreceive_time64	419
+#define SYS_semtimedop_time64	420
+#define SYS_rt_sigtimedwait_time64	421
+#define SYS_futex_time64	422
+#define SYS_sched_rr_get_interval_time64	423
+#define SYS_pidfd_send_signal	424
+#define SYS_io_uring_setup	425
+#define SYS_io_uring_enter	426
+#define SYS_io_uring_register	427
+#define SYS_open_tree		428
+#define SYS_move_mount		429
+#define SYS_fsopen		430
+#define SYS_fsconfig		431
+#define SYS_fsmount		432
+#define SYS_fspick		433
+#define SYS_pidfd_open		434
+#define SYS_clone3		435
+#define SYS_close_range	436
+#define SYS_openat2		437
+#define SYS_pidfd_getfd	438
+#define SYS_faccessat2		439
+#define SYS_process_madvise	440
+#define SYS_epoll_pwait2	441
+#define SYS_mount_setattr	442
+#define SYS_landlock_create_ruleset	444
+#define SYS_landlock_add_rule	445
+#define SYS_landlock_restrict_self	446
+#define SYS_process_mrelease	448
+#define SYS_futex_waitv	449
+#define SYS_set_mempolicy_home_node	450
+#define SYS_cachestat		451
+#define SYS_fchmodat2		452
diff --git a/musl-include/arm/bits/termios.h b/musl-include/arm/bits/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/termios.h
@@ -0,0 +1,166 @@
+struct termios {
+	tcflag_t c_iflag;
+	tcflag_t c_oflag;
+	tcflag_t c_cflag;
+	tcflag_t c_lflag;
+	cc_t c_line;
+	cc_t c_cc[NCCS];
+	speed_t __c_ispeed;
+	speed_t __c_ospeed;
+};
+
+#define VINTR     0
+#define VQUIT     1
+#define VERASE    2
+#define VKILL     3
+#define VEOF      4
+#define VTIME     5
+#define VMIN      6
+#define VSWTC     7
+#define VSTART    8
+#define VSTOP     9
+#define VSUSP    10
+#define VEOL     11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE  14
+#define VLNEXT   15
+#define VEOL2    16
+
+#define IGNBRK  0000001
+#define BRKINT  0000002
+#define IGNPAR  0000004
+#define PARMRK  0000010
+#define INPCK   0000020
+#define ISTRIP  0000040
+#define INLCR   0000100
+#define IGNCR   0000200
+#define ICRNL   0000400
+#define IUCLC   0001000
+#define IXON    0002000
+#define IXANY   0004000
+#define IXOFF   0010000
+#define IMAXBEL 0020000
+#define IUTF8   0040000
+
+#define OPOST  0000001
+#define OLCUC  0000002
+#define ONLCR  0000004
+#define OCRNL  0000010
+#define ONOCR  0000020
+#define ONLRET 0000040
+#define OFILL  0000100
+#define OFDEL  0000200
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY  0000400
+#define NL0    0000000
+#define NL1    0000400
+#define CRDLY  0003000
+#define CR0    0000000
+#define CR1    0001000
+#define CR2    0002000
+#define CR3    0003000
+#define TABDLY 0014000
+#define TAB0   0000000
+#define TAB1   0004000
+#define TAB2   0010000
+#define TAB3   0014000
+#define BSDLY  0020000
+#define BS0    0000000
+#define BS1    0020000
+#define FFDLY  0100000
+#define FF0    0000000
+#define FF1    0100000
+#endif
+
+#define VTDLY  0040000
+#define VT0    0000000
+#define VT1    0040000
+
+#define B0       0000000
+#define B50      0000001
+#define B75      0000002
+#define B110     0000003
+#define B134     0000004
+#define B150     0000005
+#define B200     0000006
+#define B300     0000007
+#define B600     0000010
+#define B1200    0000011
+#define B1800    0000012
+#define B2400    0000013
+#define B4800    0000014
+#define B9600    0000015
+#define B19200   0000016
+#define B38400   0000017
+
+#define B57600   0010001
+#define B115200  0010002
+#define B230400  0010003
+#define B460800  0010004
+#define B500000  0010005
+#define B576000  0010006
+#define B921600  0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+
+#define CSIZE  0000060
+#define CS5    0000000
+#define CS6    0000020
+#define CS7    0000040
+#define CS8    0000060
+#define CSTOPB 0000100
+#define CREAD  0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL  0002000
+#define CLOCAL 0004000
+
+#define ISIG   0000001
+#define ICANON 0000002
+#define ECHO   0000010
+#define ECHOE  0000020
+#define ECHOK  0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#define IEXTEN 0100000
+
+#define TCOOFF 0
+#define TCOON  1
+#define TCIOFF 2
+#define TCION  3
+
+#define TCIFLUSH  0
+#define TCOFLUSH  1
+#define TCIOFLUSH 2
+
+#define TCSANOW   0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA    0000016
+#define EXTB    0000017
+#define CBAUD   0010017
+#define CBAUDEX 0010000
+#define CIBAUD  002003600000
+#define CMSPAR  010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE   0000004
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE  0004000
+#define FLUSHO  0010000
+#define PENDIN  0040000
+#define EXTPROC 0200000
+
+#define XTABS  0014000
+#endif
diff --git a/musl-include/arm/bits/user.h b/musl-include/arm/bits/user.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/user.h
@@ -0,0 +1,36 @@
+typedef struct user_fpregs {
+	struct fp_reg {
+		unsigned sign1:1;
+		unsigned unused:15;
+		unsigned sign2:1;
+		unsigned exponent:14;
+		unsigned j:1;
+		unsigned mantissa1:31;
+		unsigned mantissa0:32;
+	} fpregs[8];
+	unsigned fpsr:32;
+	unsigned fpcr:32;
+	unsigned char ftype[8];
+	unsigned int init_flag;
+} elf_fpregset_t;
+
+struct user_regs {
+	unsigned long uregs[18];
+};
+#define ELF_NGREG 18
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+
+struct user {
+	struct user_regs regs;
+	int u_fpvalid;
+	unsigned long u_tsize, u_dsize, u_ssize;
+	unsigned long start_code, start_stack;
+	long signal;
+	int reserved;
+	struct user_regs *u_ar0;
+	unsigned long magic;
+	char u_comm[32];
+	int u_debugreg[8];
+	struct user_fpregs u_fp;
+	struct user_fpregs *u_fp0;
+};
diff --git a/musl-include/arm/bits/vt.h b/musl-include/arm/bits/vt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/bits/vt.h
@@ -0,0 +1,1 @@
+#include <linux/vt.h>
diff --git a/musl-include/arm/byteswap.h b/musl-include/arm/byteswap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/byteswap.h
@@ -0,0 +1,26 @@
+#ifndef _BYTESWAP_H
+#define _BYTESWAP_H
+
+#include <features.h>
+#include <stdint.h>
+
+static __inline uint16_t __bswap_16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap_32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap_64(uint64_t __x)
+{
+	return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
+}
+
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
+
+#endif
diff --git a/musl-include/arm/complex.h b/musl-include/arm/complex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/complex.h
@@ -0,0 +1,133 @@
+#ifndef _COMPLEX_H
+#define _COMPLEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define complex _Complex
+#ifdef __GNUC__
+#define _Complex_I (__extension__ (0.0f+1.0fi))
+#else
+#define _Complex_I (0.0f+1.0fi)
+#endif
+#define I _Complex_I
+
+double complex cacos(double complex);
+float complex cacosf(float complex);
+long double complex cacosl(long double complex);
+
+double complex casin(double complex);
+float complex casinf(float complex);
+long double complex casinl(long double complex);
+
+double complex catan(double complex);
+float complex catanf(float complex);
+long double complex catanl(long double complex);
+
+double complex ccos(double complex);
+float complex ccosf(float complex);
+long double complex ccosl(long double complex);
+
+double complex csin(double complex);
+float complex csinf(float complex);
+long double complex csinl(long double complex);
+
+double complex ctan(double complex);
+float complex ctanf(float complex);
+long double complex ctanl(long double complex);
+
+double complex cacosh(double complex);
+float complex cacoshf(float complex);
+long double complex cacoshl(long double complex);
+
+double complex casinh(double complex);
+float complex casinhf(float complex);
+long double complex casinhl(long double complex);
+
+double complex catanh(double complex);
+float complex catanhf(float complex);
+long double complex catanhl(long double complex);
+
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+long double complex ccoshl(long double complex);
+
+double complex csinh(double complex);
+float complex csinhf(float complex);
+long double complex csinhl(long double complex);
+
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+long double complex ctanhl(long double complex);
+
+double complex cexp(double complex);
+float complex cexpf(float complex);
+long double complex cexpl(long double complex);
+
+double complex clog(double complex);
+float complex clogf(float complex);
+long double complex clogl(long double complex);
+
+double cabs(double complex);
+float cabsf(float complex);
+long double cabsl(long double complex);
+
+double complex cpow(double complex, double complex);
+float complex cpowf(float complex, float complex);
+long double complex cpowl(long double complex, long double complex);
+
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
+long double complex csqrtl(long double complex);
+
+double carg(double complex);
+float cargf(float complex);
+long double cargl(long double complex);
+
+double cimag(double complex);
+float cimagf(float complex);
+long double cimagl(long double complex);
+
+double complex conj(double complex);
+float complex conjf(float complex);
+long double complex conjl(long double complex);
+
+double complex cproj(double complex);
+float complex cprojf(float complex);
+long double complex cprojl(long double complex);
+
+double creal(double complex);
+float crealf(float complex);
+long double creall(long double complex);
+
+#ifndef __cplusplus
+#define __CIMAG(x, t) \
+	(+(union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1])
+
+#define creal(x) ((double)(x))
+#define crealf(x) ((float)(x))
+#define creall(x) ((long double)(x))
+
+#define cimag(x) __CIMAG(x, double)
+#define cimagf(x) __CIMAG(x, float)
+#define cimagl(x) __CIMAG(x, long double)
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#if defined(_Imaginary_I)
+#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I*(t)(y))
+#elif defined(__clang__)
+#define __CMPLX(x, y, t) (+(_Complex t){ (t)(x), (t)(y) })
+#else
+#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y)))
+#endif
+#define CMPLX(x, y) __CMPLX(x, y, double)
+#define CMPLXF(x, y) __CMPLX(x, y, float)
+#define CMPLXL(x, y) __CMPLX(x, y, long double)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/cpio.h b/musl-include/arm/cpio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/cpio.h
@@ -0,0 +1,29 @@
+#ifndef _CPIO_H
+#define _CPIO_H
+
+#define MAGIC "070707"
+
+#define C_IRUSR  000400
+#define C_IWUSR  000200
+#define C_IXUSR  000100
+#define C_IRGRP  000040
+#define C_IWGRP  000020
+#define C_IXGRP  000010
+#define C_IROTH  000004
+#define C_IWOTH  000002
+#define C_IXOTH  000001
+
+#define C_ISUID  004000
+#define C_ISGID  002000
+#define C_ISVTX  001000
+
+#define C_ISBLK  060000
+#define C_ISCHR  020000
+#define C_ISDIR  040000
+#define C_ISFIFO 010000
+#define C_ISSOCK 0140000
+#define C_ISLNK  0120000
+#define C_ISCTG  0110000
+#define C_ISREG  0100000
+
+#endif
diff --git a/musl-include/arm/crypt.h b/musl-include/arm/crypt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/crypt.h
@@ -0,0 +1,20 @@
+#ifndef _CRYPT_H
+#define _CRYPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct crypt_data {
+	int initialized;
+	char __buf[256];
+};
+
+char *crypt(const char *, const char *);
+char *crypt_r(const char *, const char *, struct crypt_data *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/ctype.h b/musl-include/arm/ctype.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/ctype.h
@@ -0,0 +1,77 @@
+#ifndef	_CTYPE_H
+#define	_CTYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+int   isalnum(int);
+int   isalpha(int);
+int   isblank(int);
+int   iscntrl(int);
+int   isdigit(int);
+int   isgraph(int);
+int   islower(int);
+int   isprint(int);
+int   ispunct(int);
+int   isspace(int);
+int   isupper(int);
+int   isxdigit(int);
+int   tolower(int);
+int   toupper(int);
+
+#ifndef __cplusplus
+static __inline int __isspace(int _c)
+{
+	return _c == ' ' || (unsigned)_c-'\t' < 5;
+}
+
+#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a)|32)-'a') < 26)
+#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a)-'0') < 10)
+#define islower(a) (0 ? islower(a) : ((unsigned)(a)-'a') < 26)
+#define isupper(a) (0 ? isupper(a) : ((unsigned)(a)-'A') < 26)
+#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f)
+#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e)
+#define isspace(a) __isspace(a)
+#endif
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define __NEED_locale_t
+#include <bits/alltypes.h>
+
+int   isalnum_l(int, locale_t);
+int   isalpha_l(int, locale_t);
+int   isblank_l(int, locale_t);
+int   iscntrl_l(int, locale_t);
+int   isdigit_l(int, locale_t);
+int   isgraph_l(int, locale_t);
+int   islower_l(int, locale_t);
+int   isprint_l(int, locale_t);
+int   ispunct_l(int, locale_t);
+int   isspace_l(int, locale_t);
+int   isupper_l(int, locale_t);
+int   isxdigit_l(int, locale_t);
+int   tolower_l(int, locale_t);
+int   toupper_l(int, locale_t);
+
+int   isascii(int);
+int   toascii(int);
+#define _tolower(a) ((a)|0x20)
+#define _toupper(a) ((a)&0x5f)
+#ifndef __cplusplus
+#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128)
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/dirent.h b/musl-include/arm/dirent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/dirent.h
@@ -0,0 +1,75 @@
+#ifndef	_DIRENT_H
+#define	_DIRENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ino_t
+#define __NEED_off_t
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/dirent.h>
+
+typedef struct __dirstream DIR;
+
+#define d_fileno d_ino
+
+int            closedir(DIR *);
+DIR           *fdopendir(int);
+DIR           *opendir(const char *);
+struct dirent *readdir(DIR *);
+int            readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict);
+void           rewinddir(DIR *);
+int            dirfd(DIR *);
+
+int alphasort(const struct dirent **, const struct dirent **);
+int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void           seekdir(DIR *, long);
+long           telldir(DIR *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+#define IFTODT(x) ((x)>>12 & 017)
+#define DTTOIF(x) ((x)<<12)
+int getdents(int, struct dirent *, size_t);
+#endif
+
+#ifdef _GNU_SOURCE
+int versionsort(const struct dirent **, const struct dirent **);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define dirent64 dirent
+#define readdir64 readdir
+#define readdir64_r readdir_r
+#define scandir64 scandir
+#define alphasort64 alphasort
+#define versionsort64 versionsort
+#define off64_t off_t
+#define ino64_t ino_t
+#define getdents64 getdents
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/dlfcn.h b/musl-include/arm/dlfcn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/dlfcn.h
@@ -0,0 +1,46 @@
+#ifndef	_DLFCN_H
+#define	_DLFCN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define RTLD_LAZY   1
+#define RTLD_NOW    2
+#define RTLD_NOLOAD 4
+#define RTLD_NODELETE 4096
+#define RTLD_GLOBAL 256
+#define RTLD_LOCAL  0
+
+#define RTLD_NEXT    ((void *)-1)
+#define RTLD_DEFAULT ((void *)0)
+
+#define RTLD_DI_LINKMAP 2
+
+int    dlclose(void *);
+char  *dlerror(void);
+void  *dlopen(const char *, int);
+void  *dlsym(void *__restrict, const char *__restrict);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef struct {
+	const char *dli_fname;
+	void *dli_fbase;
+	const char *dli_sname;
+	void *dli_saddr;
+} Dl_info;
+int dladdr(const void *, Dl_info *);
+int dlinfo(void *, int, void *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(dlsym, __dlsym_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/elf.h b/musl-include/arm/elf.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/elf.h
@@ -0,0 +1,3414 @@
+#ifndef _ELF_H
+#define _ELF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+typedef uint16_t Elf32_Half;
+typedef uint16_t Elf64_Half;
+
+typedef uint32_t Elf32_Word;
+typedef	int32_t  Elf32_Sword;
+typedef uint32_t Elf64_Word;
+typedef	int32_t  Elf64_Sword;
+
+typedef uint64_t Elf32_Xword;
+typedef	int64_t  Elf32_Sxword;
+typedef uint64_t Elf64_Xword;
+typedef	int64_t  Elf64_Sxword;
+
+typedef uint32_t Elf32_Addr;
+typedef uint64_t Elf64_Addr;
+
+typedef uint32_t Elf32_Off;
+typedef uint64_t Elf64_Off;
+
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+
+typedef Elf32_Half Elf32_Versym;
+typedef Elf64_Half Elf64_Versym;
+
+#define EI_NIDENT (16)
+
+typedef struct {
+  unsigned char	e_ident[EI_NIDENT];
+  Elf32_Half	e_type;
+  Elf32_Half	e_machine;
+  Elf32_Word	e_version;
+  Elf32_Addr	e_entry;
+  Elf32_Off	e_phoff;
+  Elf32_Off	e_shoff;
+  Elf32_Word	e_flags;
+  Elf32_Half	e_ehsize;
+  Elf32_Half	e_phentsize;
+  Elf32_Half	e_phnum;
+  Elf32_Half	e_shentsize;
+  Elf32_Half	e_shnum;
+  Elf32_Half	e_shstrndx;
+} Elf32_Ehdr;
+
+typedef struct {
+  unsigned char	e_ident[EI_NIDENT];
+  Elf64_Half	e_type;
+  Elf64_Half	e_machine;
+  Elf64_Word	e_version;
+  Elf64_Addr	e_entry;
+  Elf64_Off	e_phoff;
+  Elf64_Off	e_shoff;
+  Elf64_Word	e_flags;
+  Elf64_Half	e_ehsize;
+  Elf64_Half	e_phentsize;
+  Elf64_Half	e_phnum;
+  Elf64_Half	e_shentsize;
+  Elf64_Half	e_shnum;
+  Elf64_Half	e_shstrndx;
+} Elf64_Ehdr;
+
+#define EI_MAG0		0
+#define ELFMAG0		0x7f
+
+#define EI_MAG1		1
+#define ELFMAG1		'E'
+
+#define EI_MAG2		2
+#define ELFMAG2		'L'
+
+#define EI_MAG3		3
+#define ELFMAG3		'F'
+
+
+#define	ELFMAG		"\177ELF"
+#define	SELFMAG		4
+
+#define EI_CLASS	4
+#define ELFCLASSNONE	0
+#define ELFCLASS32	1
+#define ELFCLASS64	2
+#define ELFCLASSNUM	3
+
+#define EI_DATA		5
+#define ELFDATANONE	0
+#define ELFDATA2LSB	1
+#define ELFDATA2MSB	2
+#define ELFDATANUM	3
+
+#define EI_VERSION	6
+
+
+#define EI_OSABI	7
+#define ELFOSABI_NONE		0
+#define ELFOSABI_SYSV		0
+#define ELFOSABI_HPUX		1
+#define ELFOSABI_NETBSD		2
+#define ELFOSABI_LINUX		3
+#define ELFOSABI_GNU		3
+#define ELFOSABI_SOLARIS	6
+#define ELFOSABI_AIX		7
+#define ELFOSABI_IRIX		8
+#define ELFOSABI_FREEBSD	9
+#define ELFOSABI_TRU64		10
+#define ELFOSABI_MODESTO	11
+#define ELFOSABI_OPENBSD	12
+#define ELFOSABI_ARM		97
+#define ELFOSABI_STANDALONE	255
+
+#define EI_ABIVERSION	8
+
+#define EI_PAD		9
+
+
+
+#define ET_NONE		0
+#define ET_REL		1
+#define ET_EXEC		2
+#define ET_DYN		3
+#define ET_CORE		4
+#define	ET_NUM		5
+#define ET_LOOS		0xfe00
+#define ET_HIOS		0xfeff
+#define ET_LOPROC	0xff00
+#define ET_HIPROC	0xffff
+
+
+
+#define EM_NONE		 0
+#define EM_M32		 1
+#define EM_SPARC	 2
+#define EM_386		 3
+#define EM_68K		 4
+#define EM_88K		 5
+#define EM_860		 7
+#define EM_MIPS		 8
+#define EM_S370		 9
+#define EM_MIPS_RS3_LE	10
+
+#define EM_PARISC	15
+#define EM_VPP500	17
+#define EM_SPARC32PLUS	18
+#define EM_960		19
+#define EM_PPC		20
+#define EM_PPC64	21
+#define EM_S390		22
+
+#define EM_V800		36
+#define EM_FR20		37
+#define EM_RH32		38
+#define EM_RCE		39
+#define EM_ARM		40
+#define EM_FAKE_ALPHA	41
+#define EM_SH		42
+#define EM_SPARCV9	43
+#define EM_TRICORE	44
+#define EM_ARC		45
+#define EM_H8_300	46
+#define EM_H8_300H	47
+#define EM_H8S		48
+#define EM_H8_500	49
+#define EM_IA_64	50
+#define EM_MIPS_X	51
+#define EM_COLDFIRE	52
+#define EM_68HC12	53
+#define EM_MMA		54
+#define EM_PCP		55
+#define EM_NCPU		56
+#define EM_NDR1		57
+#define EM_STARCORE	58
+#define EM_ME16		59
+#define EM_ST100	60
+#define EM_TINYJ	61
+#define EM_X86_64	62
+#define EM_PDSP		63
+
+#define EM_FX66		66
+#define EM_ST9PLUS	67
+#define EM_ST7		68
+#define EM_68HC16	69
+#define EM_68HC11	70
+#define EM_68HC08	71
+#define EM_68HC05	72
+#define EM_SVX		73
+#define EM_ST19		74
+#define EM_VAX		75
+#define EM_CRIS		76
+#define EM_JAVELIN	77
+#define EM_FIREPATH	78
+#define EM_ZSP		79
+#define EM_MMIX		80
+#define EM_HUANY	81
+#define EM_PRISM	82
+#define EM_AVR		83
+#define EM_FR30		84
+#define EM_D10V		85
+#define EM_D30V		86
+#define EM_V850		87
+#define EM_M32R		88
+#define EM_MN10300	89
+#define EM_MN10200	90
+#define EM_PJ		91
+#define EM_OR1K		92
+#define EM_OPENRISC	92
+#define EM_ARC_A5	93
+#define EM_ARC_COMPACT	93
+#define EM_XTENSA	94
+#define EM_VIDEOCORE	95
+#define EM_TMM_GPP	96
+#define EM_NS32K	97
+#define EM_TPC		98
+#define EM_SNP1K	99
+#define EM_ST200	100
+#define EM_IP2K		101
+#define EM_MAX		102
+#define EM_CR		103
+#define EM_F2MC16	104
+#define EM_MSP430	105
+#define EM_BLACKFIN	106
+#define EM_SE_C33	107
+#define EM_SEP		108
+#define EM_ARCA		109
+#define EM_UNICORE	110
+#define EM_EXCESS	111
+#define EM_DXP		112
+#define EM_ALTERA_NIOS2 113
+#define EM_CRX		114
+#define EM_XGATE	115
+#define EM_C166		116
+#define EM_M16C		117
+#define EM_DSPIC30F	118
+#define EM_CE		119
+#define EM_M32C		120
+#define EM_TSK3000	131
+#define EM_RS08		132
+#define EM_SHARC	133
+#define EM_ECOG2	134
+#define EM_SCORE7	135
+#define EM_DSP24	136
+#define EM_VIDEOCORE3	137
+#define EM_LATTICEMICO32 138
+#define EM_SE_C17	139
+#define EM_TI_C6000	140
+#define EM_TI_C2000	141
+#define EM_TI_C5500	142
+#define EM_TI_ARP32	143
+#define EM_TI_PRU	144
+#define EM_MMDSP_PLUS	160
+#define EM_CYPRESS_M8C	161
+#define EM_R32C		162
+#define EM_TRIMEDIA	163
+#define EM_QDSP6	164
+#define EM_8051		165
+#define EM_STXP7X	166
+#define EM_NDS32	167
+#define EM_ECOG1X	168
+#define EM_MAXQ30	169
+#define EM_XIMO16	170
+#define EM_MANIK	171
+#define EM_CRAYNV2	172
+#define EM_RX		173
+#define EM_METAG	174
+#define EM_MCST_ELBRUS	175
+#define EM_ECOG16	176
+#define EM_CR16		177
+#define EM_ETPU		178
+#define EM_SLE9X	179
+#define EM_L10M		180
+#define EM_K10M		181
+#define EM_AARCH64	183
+#define EM_AVR32	185
+#define EM_STM8		186
+#define EM_TILE64	187
+#define EM_TILEPRO	188
+#define EM_MICROBLAZE	189
+#define EM_CUDA		190
+#define EM_TILEGX	191
+#define EM_CLOUDSHIELD	192
+#define EM_COREA_1ST	193
+#define EM_COREA_2ND	194
+#define EM_ARC_COMPACT2	195
+#define EM_OPEN8	196
+#define EM_RL78		197
+#define EM_VIDEOCORE5	198
+#define EM_78KOR	199
+#define EM_56800EX	200
+#define EM_BA1		201
+#define EM_BA2		202
+#define EM_XCORE	203
+#define EM_MCHP_PIC	204
+#define EM_KM32		210
+#define EM_KMX32	211
+#define EM_EMX16	212
+#define EM_EMX8		213
+#define EM_KVARC	214
+#define EM_CDP		215
+#define EM_COGE		216
+#define EM_COOL		217
+#define EM_NORC		218
+#define EM_CSR_KALIMBA	219
+#define EM_Z80		220
+#define EM_VISIUM	221
+#define EM_FT32		222
+#define EM_MOXIE	223
+#define EM_AMDGPU	224
+#define EM_RISCV	243
+#define EM_BPF		247
+#define EM_CSKY		252
+#define EM_LOONGARCH	258
+#define EM_NUM		259
+
+#define EM_ALPHA	0x9026
+
+#define EV_NONE		0
+#define EV_CURRENT	1
+#define EV_NUM		2
+
+typedef struct {
+  Elf32_Word	sh_name;
+  Elf32_Word	sh_type;
+  Elf32_Word	sh_flags;
+  Elf32_Addr	sh_addr;
+  Elf32_Off	sh_offset;
+  Elf32_Word	sh_size;
+  Elf32_Word	sh_link;
+  Elf32_Word	sh_info;
+  Elf32_Word	sh_addralign;
+  Elf32_Word	sh_entsize;
+} Elf32_Shdr;
+
+typedef struct {
+  Elf64_Word	sh_name;
+  Elf64_Word	sh_type;
+  Elf64_Xword	sh_flags;
+  Elf64_Addr	sh_addr;
+  Elf64_Off	sh_offset;
+  Elf64_Xword	sh_size;
+  Elf64_Word	sh_link;
+  Elf64_Word	sh_info;
+  Elf64_Xword	sh_addralign;
+  Elf64_Xword	sh_entsize;
+} Elf64_Shdr;
+
+
+
+#define SHN_UNDEF	0
+#define SHN_LORESERVE	0xff00
+#define SHN_LOPROC	0xff00
+#define SHN_BEFORE	0xff00
+
+#define SHN_AFTER	0xff01
+
+#define SHN_HIPROC	0xff1f
+#define SHN_LOOS	0xff20
+#define SHN_HIOS	0xff3f
+#define SHN_ABS		0xfff1
+#define SHN_COMMON	0xfff2
+#define SHN_XINDEX	0xffff
+#define SHN_HIRESERVE	0xffff
+
+
+
+#define SHT_NULL	  0
+#define SHT_PROGBITS	  1
+#define SHT_SYMTAB	  2
+#define SHT_STRTAB	  3
+#define SHT_RELA	  4
+#define SHT_HASH	  5
+#define SHT_DYNAMIC	  6
+#define SHT_NOTE	  7
+#define SHT_NOBITS	  8
+#define SHT_REL		  9
+#define SHT_SHLIB	  10
+#define SHT_DYNSYM	  11
+#define SHT_INIT_ARRAY	  14
+#define SHT_FINI_ARRAY	  15
+#define SHT_PREINIT_ARRAY 16
+#define SHT_GROUP	  17
+#define SHT_SYMTAB_SHNDX  18
+#define SHT_RELR	  19
+#define	SHT_NUM		  20
+#define SHT_LOOS	  0x60000000
+#define SHT_GNU_ATTRIBUTES 0x6ffffff5
+#define SHT_GNU_HASH	  0x6ffffff6
+#define SHT_GNU_LIBLIST	  0x6ffffff7
+#define SHT_CHECKSUM	  0x6ffffff8
+#define SHT_LOSUNW	  0x6ffffffa
+#define SHT_SUNW_move	  0x6ffffffa
+#define SHT_SUNW_COMDAT   0x6ffffffb
+#define SHT_SUNW_syminfo  0x6ffffffc
+#define SHT_GNU_verdef	  0x6ffffffd
+#define SHT_GNU_verneed	  0x6ffffffe
+#define SHT_GNU_versym	  0x6fffffff
+#define SHT_HISUNW	  0x6fffffff
+#define SHT_HIOS	  0x6fffffff
+#define SHT_LOPROC	  0x70000000
+#define SHT_HIPROC	  0x7fffffff
+#define SHT_LOUSER	  0x80000000
+#define SHT_HIUSER	  0x8fffffff
+
+#define SHF_WRITE	     (1 << 0)
+#define SHF_ALLOC	     (1 << 1)
+#define SHF_EXECINSTR	     (1 << 2)
+#define SHF_MERGE	     (1 << 4)
+#define SHF_STRINGS	     (1 << 5)
+#define SHF_INFO_LINK	     (1 << 6)
+#define SHF_LINK_ORDER	     (1 << 7)
+#define SHF_OS_NONCONFORMING (1 << 8)
+
+#define SHF_GROUP	     (1 << 9)
+#define SHF_TLS		     (1 << 10)
+#define SHF_COMPRESSED	     (1 << 11)
+#define SHF_MASKOS	     0x0ff00000
+#define SHF_MASKPROC	     0xf0000000
+#define SHF_ORDERED	     (1 << 30)
+#define SHF_EXCLUDE	     (1U << 31)
+
+typedef struct {
+  Elf32_Word	ch_type;
+  Elf32_Word	ch_size;
+  Elf32_Word	ch_addralign;
+} Elf32_Chdr;
+
+typedef struct {
+  Elf64_Word	ch_type;
+  Elf64_Word	ch_reserved;
+  Elf64_Xword	ch_size;
+  Elf64_Xword	ch_addralign;
+} Elf64_Chdr;
+
+#define ELFCOMPRESS_ZLIB	1
+#define ELFCOMPRESS_ZSTD	2
+#define ELFCOMPRESS_LOOS	0x60000000
+#define ELFCOMPRESS_HIOS	0x6fffffff
+#define ELFCOMPRESS_LOPROC	0x70000000
+#define ELFCOMPRESS_HIPROC	0x7fffffff
+
+
+#define GRP_COMDAT	0x1
+
+typedef struct {
+  Elf32_Word	st_name;
+  Elf32_Addr	st_value;
+  Elf32_Word	st_size;
+  unsigned char	st_info;
+  unsigned char	st_other;
+  Elf32_Section	st_shndx;
+} Elf32_Sym;
+
+typedef struct {
+  Elf64_Word	st_name;
+  unsigned char	st_info;
+  unsigned char st_other;
+  Elf64_Section	st_shndx;
+  Elf64_Addr	st_value;
+  Elf64_Xword	st_size;
+} Elf64_Sym;
+
+typedef struct {
+  Elf32_Half si_boundto;
+  Elf32_Half si_flags;
+} Elf32_Syminfo;
+
+typedef struct {
+  Elf64_Half si_boundto;
+  Elf64_Half si_flags;
+} Elf64_Syminfo;
+
+#define SYMINFO_BT_SELF		0xffff
+#define SYMINFO_BT_PARENT	0xfffe
+#define SYMINFO_BT_LOWRESERVE	0xff00
+
+#define SYMINFO_FLG_DIRECT	0x0001
+#define SYMINFO_FLG_PASSTHRU	0x0002
+#define SYMINFO_FLG_COPY	0x0004
+#define SYMINFO_FLG_LAZYLOAD	0x0008
+
+#define SYMINFO_NONE		0
+#define SYMINFO_CURRENT		1
+#define SYMINFO_NUM		2
+
+#define ELF32_ST_BIND(val)		(((unsigned char) (val)) >> 4)
+#define ELF32_ST_TYPE(val)		((val) & 0xf)
+#define ELF32_ST_INFO(bind, type)	(((bind) << 4) + ((type) & 0xf))
+
+#define ELF64_ST_BIND(val)		ELF32_ST_BIND (val)
+#define ELF64_ST_TYPE(val)		ELF32_ST_TYPE (val)
+#define ELF64_ST_INFO(bind, type)	ELF32_ST_INFO ((bind), (type))
+
+#define STB_LOCAL	0
+#define STB_GLOBAL	1
+#define STB_WEAK	2
+#define	STB_NUM		3
+#define STB_LOOS	10
+#define STB_GNU_UNIQUE	10
+#define STB_HIOS	12
+#define STB_LOPROC	13
+#define STB_HIPROC	15
+
+#define STT_NOTYPE	0
+#define STT_OBJECT	1
+#define STT_FUNC	2
+#define STT_SECTION	3
+#define STT_FILE	4
+#define STT_COMMON	5
+#define STT_TLS		6
+#define	STT_NUM		7
+#define STT_LOOS	10
+#define STT_GNU_IFUNC	10
+#define STT_HIOS	12
+#define STT_LOPROC	13
+#define STT_HIPROC	15
+
+#define STN_UNDEF	0
+
+#define ELF32_ST_VISIBILITY(o)	((o) & 0x03)
+#define ELF64_ST_VISIBILITY(o)	ELF32_ST_VISIBILITY (o)
+
+#define STV_DEFAULT	0
+#define STV_INTERNAL	1
+#define STV_HIDDEN	2
+#define STV_PROTECTED	3
+
+
+
+
+typedef struct {
+  Elf32_Addr	r_offset;
+  Elf32_Word	r_info;
+} Elf32_Rel;
+
+typedef struct {
+  Elf64_Addr	r_offset;
+  Elf64_Xword	r_info;
+} Elf64_Rel;
+
+
+
+typedef struct {
+  Elf32_Addr	r_offset;
+  Elf32_Word	r_info;
+  Elf32_Sword	r_addend;
+} Elf32_Rela;
+
+typedef struct {
+  Elf64_Addr	r_offset;
+  Elf64_Xword	r_info;
+  Elf64_Sxword	r_addend;
+} Elf64_Rela;
+
+
+
+typedef Elf32_Word Elf32_Relr;
+typedef Elf64_Xword Elf64_Relr;
+
+
+
+#define ELF32_R_SYM(val)		((val) >> 8)
+#define ELF32_R_TYPE(val)		((val) & 0xff)
+#define ELF32_R_INFO(sym, type)		(((sym) << 8) + ((type) & 0xff))
+
+#define ELF64_R_SYM(i)			((i) >> 32)
+#define ELF64_R_TYPE(i)			((i) & 0xffffffff)
+#define ELF64_R_INFO(sym,type)		((((Elf64_Xword) (sym)) << 32) + (type))
+
+
+
+typedef struct {
+  Elf32_Word	p_type;
+  Elf32_Off	p_offset;
+  Elf32_Addr	p_vaddr;
+  Elf32_Addr	p_paddr;
+  Elf32_Word	p_filesz;
+  Elf32_Word	p_memsz;
+  Elf32_Word	p_flags;
+  Elf32_Word	p_align;
+} Elf32_Phdr;
+
+typedef struct {
+  Elf64_Word	p_type;
+  Elf64_Word	p_flags;
+  Elf64_Off	p_offset;
+  Elf64_Addr	p_vaddr;
+  Elf64_Addr	p_paddr;
+  Elf64_Xword	p_filesz;
+  Elf64_Xword	p_memsz;
+  Elf64_Xword	p_align;
+} Elf64_Phdr;
+
+
+
+#define	PT_NULL		0
+#define PT_LOAD		1
+#define PT_DYNAMIC	2
+#define PT_INTERP	3
+#define PT_NOTE		4
+#define PT_SHLIB	5
+#define PT_PHDR		6
+#define PT_TLS		7
+#define	PT_NUM		8
+#define PT_LOOS		0x60000000
+#define PT_GNU_EH_FRAME	0x6474e550
+#define PT_GNU_STACK	0x6474e551
+#define PT_GNU_RELRO	0x6474e552
+#define PT_GNU_PROPERTY	0x6474e553
+#define PT_LOSUNW	0x6ffffffa
+#define PT_SUNWBSS	0x6ffffffa
+#define PT_SUNWSTACK	0x6ffffffb
+#define PT_HISUNW	0x6fffffff
+#define PT_HIOS		0x6fffffff
+#define PT_LOPROC	0x70000000
+#define PT_HIPROC	0x7fffffff
+
+
+#define PN_XNUM 0xffff
+
+
+#define PF_X		(1 << 0)
+#define PF_W		(1 << 1)
+#define PF_R		(1 << 2)
+#define PF_MASKOS	0x0ff00000
+#define PF_MASKPROC	0xf0000000
+
+
+
+#define NT_PRSTATUS	1
+#define NT_PRFPREG	2
+#define NT_FPREGSET	2
+#define NT_PRPSINFO	3
+#define NT_PRXREG	4
+#define NT_TASKSTRUCT	4
+#define NT_PLATFORM	5
+#define NT_AUXV		6
+#define NT_GWINDOWS	7
+#define NT_ASRS		8
+#define NT_PSTATUS	10
+#define NT_PSINFO	13
+#define NT_PRCRED	14
+#define NT_UTSNAME	15
+#define NT_LWPSTATUS	16
+#define NT_LWPSINFO	17
+#define NT_PRFPXREG	20
+#define NT_SIGINFO	0x53494749
+#define NT_FILE		0x46494c45
+#define NT_PRXFPREG	0x46e62b7f
+#define NT_PPC_VMX	0x100
+#define NT_PPC_SPE	0x101
+#define NT_PPC_VSX	0x102
+#define NT_PPC_TAR	0x103
+#define NT_PPC_PPR	0x104
+#define NT_PPC_DSCR	0x105
+#define NT_PPC_EBB	0x106
+#define NT_PPC_PMU	0x107
+#define NT_PPC_TM_CGPR	0x108
+#define NT_PPC_TM_CFPR	0x109
+#define NT_PPC_TM_CVMX	0x10a
+#define NT_PPC_TM_CVSX	0x10b
+#define NT_PPC_TM_SPR	0x10c
+#define NT_PPC_TM_CTAR	0x10d
+#define NT_PPC_TM_CPPR	0x10e
+#define NT_PPC_TM_CDSCR	0x10f
+#define NT_386_TLS	0x200
+#define NT_386_IOPERM	0x201
+#define NT_X86_XSTATE	0x202
+#define NT_S390_HIGH_GPRS	0x300
+#define NT_S390_TIMER	0x301
+#define NT_S390_TODCMP	0x302
+#define NT_S390_TODPREG	0x303
+#define NT_S390_CTRS	0x304
+#define NT_S390_PREFIX	0x305
+#define NT_S390_LAST_BREAK	0x306
+#define NT_S390_SYSTEM_CALL	0x307
+#define NT_S390_TDB	0x308
+#define NT_S390_VXRS_LOW	0x309
+#define NT_S390_VXRS_HIGH	0x30a
+#define NT_S390_GS_CB	0x30b
+#define NT_S390_GS_BC	0x30c
+#define NT_S390_RI_CB	0x30d
+#define NT_ARM_VFP	0x400
+#define NT_ARM_TLS	0x401
+#define NT_ARM_HW_BREAK	0x402
+#define NT_ARM_HW_WATCH	0x403
+#define NT_ARM_SYSTEM_CALL	0x404
+#define NT_ARM_SVE	0x405
+#define NT_ARM_PAC_MASK	0x406
+#define NT_ARM_PACA_KEYS	0x407
+#define NT_ARM_PACG_KEYS	0x408
+#define NT_ARM_TAGGED_ADDR_CTRL	0x409
+#define NT_ARM_PAC_ENABLED_KEYS	0x40a
+#define NT_METAG_CBUF	0x500
+#define NT_METAG_RPIPE	0x501
+#define NT_METAG_TLS	0x502
+#define NT_ARC_V2	0x600
+#define NT_VMCOREDD	0x700
+#define NT_MIPS_DSP	0x800
+#define NT_MIPS_FP_MODE	0x801
+#define NT_MIPS_MSA	0x802
+#define NT_RISCV_CSR	0x900
+#define NT_RISCV_VECTOR	0x901
+#define NT_VERSION	1
+#define NT_LOONGARCH_CPUCFG	0xa00
+#define NT_LOONGARCH_CSR	0xa01
+#define NT_LOONGARCH_LSX	0xa02
+#define NT_LOONGARCH_LASX	0xa03
+#define NT_LOONGARCH_LBT	0xa04
+
+
+
+
+typedef struct {
+  Elf32_Sword d_tag;
+  union {
+      Elf32_Word d_val;
+      Elf32_Addr d_ptr;
+  } d_un;
+} Elf32_Dyn;
+
+typedef struct {
+  Elf64_Sxword d_tag;
+  union {
+      Elf64_Xword d_val;
+      Elf64_Addr d_ptr;
+  } d_un;
+} Elf64_Dyn;
+
+
+
+#define DT_NULL		0
+#define DT_NEEDED	1
+#define DT_PLTRELSZ	2
+#define DT_PLTGOT	3
+#define DT_HASH		4
+#define DT_STRTAB	5
+#define DT_SYMTAB	6
+#define DT_RELA		7
+#define DT_RELASZ	8
+#define DT_RELAENT	9
+#define DT_STRSZ	10
+#define DT_SYMENT	11
+#define DT_INIT		12
+#define DT_FINI		13
+#define DT_SONAME	14
+#define DT_RPATH	15
+#define DT_SYMBOLIC	16
+#define DT_REL		17
+#define DT_RELSZ	18
+#define DT_RELENT	19
+#define DT_PLTREL	20
+#define DT_DEBUG	21
+#define DT_TEXTREL	22
+#define DT_JMPREL	23
+#define	DT_BIND_NOW	24
+#define	DT_INIT_ARRAY	25
+#define	DT_FINI_ARRAY	26
+#define	DT_INIT_ARRAYSZ	27
+#define	DT_FINI_ARRAYSZ	28
+#define DT_RUNPATH	29
+#define DT_FLAGS	30
+#define DT_ENCODING	32
+#define DT_PREINIT_ARRAY 32
+#define DT_PREINIT_ARRAYSZ 33
+#define DT_SYMTAB_SHNDX	34
+#define DT_RELRSZ	35
+#define DT_RELR		36
+#define DT_RELRENT	37
+#define	DT_NUM		38
+#define DT_LOOS		0x6000000d
+#define DT_HIOS		0x6ffff000
+#define DT_LOPROC	0x70000000
+#define DT_HIPROC	0x7fffffff
+#define	DT_PROCNUM	DT_MIPS_NUM
+
+#define DT_VALRNGLO	0x6ffffd00
+#define DT_GNU_PRELINKED 0x6ffffdf5
+#define DT_GNU_CONFLICTSZ 0x6ffffdf6
+#define DT_GNU_LIBLISTSZ 0x6ffffdf7
+#define DT_CHECKSUM	0x6ffffdf8
+#define DT_PLTPADSZ	0x6ffffdf9
+#define DT_MOVEENT	0x6ffffdfa
+#define DT_MOVESZ	0x6ffffdfb
+#define DT_FEATURE_1	0x6ffffdfc
+#define DT_POSFLAG_1	0x6ffffdfd
+
+#define DT_SYMINSZ	0x6ffffdfe
+#define DT_SYMINENT	0x6ffffdff
+#define DT_VALRNGHI	0x6ffffdff
+#define DT_VALTAGIDX(tag)	(DT_VALRNGHI - (tag))
+#define DT_VALNUM 12
+
+#define DT_ADDRRNGLO	0x6ffffe00
+#define DT_GNU_HASH	0x6ffffef5
+#define DT_TLSDESC_PLT	0x6ffffef6
+#define DT_TLSDESC_GOT	0x6ffffef7
+#define DT_GNU_CONFLICT	0x6ffffef8
+#define DT_GNU_LIBLIST	0x6ffffef9
+#define DT_CONFIG	0x6ffffefa
+#define DT_DEPAUDIT	0x6ffffefb
+#define DT_AUDIT	0x6ffffefc
+#define	DT_PLTPAD	0x6ffffefd
+#define	DT_MOVETAB	0x6ffffefe
+#define DT_SYMINFO	0x6ffffeff
+#define DT_ADDRRNGHI	0x6ffffeff
+#define DT_ADDRTAGIDX(tag)	(DT_ADDRRNGHI - (tag))
+#define DT_ADDRNUM 11
+
+
+
+#define DT_VERSYM	0x6ffffff0
+
+#define DT_RELACOUNT	0x6ffffff9
+#define DT_RELCOUNT	0x6ffffffa
+
+
+#define DT_FLAGS_1	0x6ffffffb
+#define	DT_VERDEF	0x6ffffffc
+
+#define	DT_VERDEFNUM	0x6ffffffd
+#define	DT_VERNEED	0x6ffffffe
+
+#define	DT_VERNEEDNUM	0x6fffffff
+#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))
+#define DT_VERSIONTAGNUM 16
+
+
+
+#define DT_AUXILIARY    0x7ffffffd
+#define DT_FILTER       0x7fffffff
+#define DT_EXTRATAGIDX(tag)	((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
+#define DT_EXTRANUM	3
+
+
+#define DF_ORIGIN	0x00000001
+#define DF_SYMBOLIC	0x00000002
+#define DF_TEXTREL	0x00000004
+#define DF_BIND_NOW	0x00000008
+#define DF_STATIC_TLS	0x00000010
+
+
+
+#define DF_1_NOW	0x00000001
+#define DF_1_GLOBAL	0x00000002
+#define DF_1_GROUP	0x00000004
+#define DF_1_NODELETE	0x00000008
+#define DF_1_LOADFLTR	0x00000010
+#define DF_1_INITFIRST	0x00000020
+#define DF_1_NOOPEN	0x00000040
+#define DF_1_ORIGIN	0x00000080
+#define DF_1_DIRECT	0x00000100
+#define DF_1_TRANS	0x00000200
+#define DF_1_INTERPOSE	0x00000400
+#define DF_1_NODEFLIB	0x00000800
+#define DF_1_NODUMP	0x00001000
+#define DF_1_CONFALT	0x00002000
+#define DF_1_ENDFILTEE	0x00004000
+#define	DF_1_DISPRELDNE	0x00008000
+#define	DF_1_DISPRELPND	0x00010000
+#define	DF_1_NODIRECT	0x00020000
+#define	DF_1_IGNMULDEF	0x00040000
+#define	DF_1_NOKSYMS	0x00080000
+#define	DF_1_NOHDR	0x00100000
+#define	DF_1_EDITED	0x00200000
+#define	DF_1_NORELOC	0x00400000
+#define	DF_1_SYMINTPOSE	0x00800000
+#define	DF_1_GLOBAUDIT	0x01000000
+#define	DF_1_SINGLETON	0x02000000
+#define	DF_1_STUB	0x04000000
+#define	DF_1_PIE	0x08000000
+
+#define DTF_1_PARINIT	0x00000001
+#define DTF_1_CONFEXP	0x00000002
+
+
+#define DF_P1_LAZYLOAD	0x00000001
+#define DF_P1_GROUPPERM	0x00000002
+
+
+
+
+typedef struct {
+  Elf32_Half	vd_version;
+  Elf32_Half	vd_flags;
+  Elf32_Half	vd_ndx;
+  Elf32_Half	vd_cnt;
+  Elf32_Word	vd_hash;
+  Elf32_Word	vd_aux;
+  Elf32_Word	vd_next;
+} Elf32_Verdef;
+
+typedef struct {
+  Elf64_Half	vd_version;
+  Elf64_Half	vd_flags;
+  Elf64_Half	vd_ndx;
+  Elf64_Half	vd_cnt;
+  Elf64_Word	vd_hash;
+  Elf64_Word	vd_aux;
+  Elf64_Word	vd_next;
+} Elf64_Verdef;
+
+
+
+#define VER_DEF_NONE	0
+#define VER_DEF_CURRENT	1
+#define VER_DEF_NUM	2
+
+
+#define VER_FLG_BASE	0x1
+#define VER_FLG_WEAK	0x2
+
+
+#define	VER_NDX_LOCAL		0
+#define	VER_NDX_GLOBAL		1
+#define	VER_NDX_LORESERVE	0xff00
+#define	VER_NDX_ELIMINATE	0xff01
+
+
+
+typedef struct {
+  Elf32_Word	vda_name;
+  Elf32_Word	vda_next;
+} Elf32_Verdaux;
+
+typedef struct {
+  Elf64_Word	vda_name;
+  Elf64_Word	vda_next;
+} Elf64_Verdaux;
+
+
+
+
+typedef struct {
+  Elf32_Half	vn_version;
+  Elf32_Half	vn_cnt;
+  Elf32_Word	vn_file;
+  Elf32_Word	vn_aux;
+  Elf32_Word	vn_next;
+} Elf32_Verneed;
+
+typedef struct {
+  Elf64_Half	vn_version;
+  Elf64_Half	vn_cnt;
+  Elf64_Word	vn_file;
+  Elf64_Word	vn_aux;
+  Elf64_Word	vn_next;
+} Elf64_Verneed;
+
+
+
+#define VER_NEED_NONE	 0
+#define VER_NEED_CURRENT 1
+#define VER_NEED_NUM	 2
+
+
+
+typedef struct {
+  Elf32_Word	vna_hash;
+  Elf32_Half	vna_flags;
+  Elf32_Half	vna_other;
+  Elf32_Word	vna_name;
+  Elf32_Word	vna_next;
+} Elf32_Vernaux;
+
+typedef struct {
+  Elf64_Word	vna_hash;
+  Elf64_Half	vna_flags;
+  Elf64_Half	vna_other;
+  Elf64_Word	vna_name;
+  Elf64_Word	vna_next;
+} Elf64_Vernaux;
+
+
+
+#define VER_FLG_WEAK	0x2
+
+
+
+typedef struct {
+  uint32_t a_type;
+  union {
+      uint32_t a_val;
+  } a_un;
+} Elf32_auxv_t;
+
+typedef struct {
+  uint64_t a_type;
+  union {
+      uint64_t a_val;
+  } a_un;
+} Elf64_auxv_t;
+
+
+
+#define AT_NULL		0
+#define AT_IGNORE	1
+#define AT_EXECFD	2
+#define AT_PHDR		3
+#define AT_PHENT	4
+#define AT_PHNUM	5
+#define AT_PAGESZ	6
+#define AT_BASE		7
+#define AT_FLAGS	8
+#define AT_ENTRY	9
+#define AT_NOTELF	10
+#define AT_UID		11
+#define AT_EUID		12
+#define AT_GID		13
+#define AT_EGID		14
+#define AT_CLKTCK	17
+
+
+#define AT_PLATFORM	15
+#define AT_HWCAP	16
+
+
+
+
+#define AT_FPUCW	18
+
+
+#define AT_DCACHEBSIZE	19
+#define AT_ICACHEBSIZE	20
+#define AT_UCACHEBSIZE	21
+
+
+
+#define AT_IGNOREPPC	22
+
+#define	AT_SECURE	23
+
+#define AT_BASE_PLATFORM 24
+
+#define AT_RANDOM	25
+
+#define AT_HWCAP2	26
+
+#define AT_EXECFN	31
+
+
+
+#define AT_SYSINFO	32
+#define AT_SYSINFO_EHDR	33
+
+
+
+#define AT_L1I_CACHESHAPE	34
+#define AT_L1D_CACHESHAPE	35
+#define AT_L2_CACHESHAPE	36
+#define AT_L3_CACHESHAPE	37
+
+#define AT_L1I_CACHESIZE	40
+#define AT_L1I_CACHEGEOMETRY	41
+#define AT_L1D_CACHESIZE	42
+#define AT_L1D_CACHEGEOMETRY	43
+#define AT_L2_CACHESIZE		44
+#define AT_L2_CACHEGEOMETRY	45
+#define AT_L3_CACHESIZE		46
+#define AT_L3_CACHEGEOMETRY	47
+
+#define AT_MINSIGSTKSZ		51
+
+
+typedef struct {
+  Elf32_Word n_namesz;
+  Elf32_Word n_descsz;
+  Elf32_Word n_type;
+} Elf32_Nhdr;
+
+typedef struct {
+  Elf64_Word n_namesz;
+  Elf64_Word n_descsz;
+  Elf64_Word n_type;
+} Elf64_Nhdr;
+
+
+
+
+#define ELF_NOTE_SOLARIS	"SUNW Solaris"
+
+
+#define ELF_NOTE_GNU		"GNU"
+
+
+
+
+
+#define ELF_NOTE_PAGESIZE_HINT	1
+
+
+#define NT_GNU_ABI_TAG	1
+#define ELF_NOTE_ABI	NT_GNU_ABI_TAG
+
+
+
+#define ELF_NOTE_OS_LINUX	0
+#define ELF_NOTE_OS_GNU		1
+#define ELF_NOTE_OS_SOLARIS2	2
+#define ELF_NOTE_OS_FREEBSD	3
+
+#define NT_GNU_BUILD_ID	3
+#define NT_GNU_GOLD_VERSION	4
+#define NT_GNU_PROPERTY_TYPE_0	5
+
+
+
+typedef struct {
+  Elf32_Xword m_value;
+  Elf32_Word m_info;
+  Elf32_Word m_poffset;
+  Elf32_Half m_repeat;
+  Elf32_Half m_stride;
+} Elf32_Move;
+
+typedef struct {
+  Elf64_Xword m_value;
+  Elf64_Xword m_info;
+  Elf64_Xword m_poffset;
+  Elf64_Half m_repeat;
+  Elf64_Half m_stride;
+} Elf64_Move;
+
+
+#define ELF32_M_SYM(info)	((info) >> 8)
+#define ELF32_M_SIZE(info)	((unsigned char) (info))
+#define ELF32_M_INFO(sym, size)	(((sym) << 8) + (unsigned char) (size))
+
+#define ELF64_M_SYM(info)	ELF32_M_SYM (info)
+#define ELF64_M_SIZE(info)	ELF32_M_SIZE (info)
+#define ELF64_M_INFO(sym, size)	ELF32_M_INFO (sym, size)
+
+#define EF_CPU32	0x00810000
+
+#define R_68K_NONE	0
+#define R_68K_32	1
+#define R_68K_16	2
+#define R_68K_8		3
+#define R_68K_PC32	4
+#define R_68K_PC16	5
+#define R_68K_PC8	6
+#define R_68K_GOT32	7
+#define R_68K_GOT16	8
+#define R_68K_GOT8	9
+#define R_68K_GOT32O	10
+#define R_68K_GOT16O	11
+#define R_68K_GOT8O	12
+#define R_68K_PLT32	13
+#define R_68K_PLT16	14
+#define R_68K_PLT8	15
+#define R_68K_PLT32O	16
+#define R_68K_PLT16O	17
+#define R_68K_PLT8O	18
+#define R_68K_COPY	19
+#define R_68K_GLOB_DAT	20
+#define R_68K_JMP_SLOT	21
+#define R_68K_RELATIVE	22
+#define R_68K_TLS_GD32	25
+#define R_68K_TLS_GD16	26
+#define R_68K_TLS_GD8	27
+#define R_68K_TLS_LDM32	28
+#define R_68K_TLS_LDM16	29
+#define R_68K_TLS_LDM8	30
+#define R_68K_TLS_LDO32	31
+#define R_68K_TLS_LDO16	32
+#define R_68K_TLS_LDO8	33
+#define R_68K_TLS_IE32	34
+#define R_68K_TLS_IE16	35
+#define R_68K_TLS_IE8	36
+#define R_68K_TLS_LE32	37
+#define R_68K_TLS_LE16	38
+#define R_68K_TLS_LE8	39
+#define R_68K_TLS_DTPMOD32	40
+#define R_68K_TLS_DTPREL32	41
+#define R_68K_TLS_TPREL32	42
+#define R_68K_NUM	43
+
+#define R_386_NONE	   0
+#define R_386_32	   1
+#define R_386_PC32	   2
+#define R_386_GOT32	   3
+#define R_386_PLT32	   4
+#define R_386_COPY	   5
+#define R_386_GLOB_DAT	   6
+#define R_386_JMP_SLOT	   7
+#define R_386_RELATIVE	   8
+#define R_386_GOTOFF	   9
+#define R_386_GOTPC	   10
+#define R_386_32PLT	   11
+#define R_386_TLS_TPOFF	   14
+#define R_386_TLS_IE	   15
+#define R_386_TLS_GOTIE	   16
+#define R_386_TLS_LE	   17
+#define R_386_TLS_GD	   18
+#define R_386_TLS_LDM	   19
+#define R_386_16	   20
+#define R_386_PC16	   21
+#define R_386_8		   22
+#define R_386_PC8	   23
+#define R_386_TLS_GD_32	   24
+#define R_386_TLS_GD_PUSH  25
+#define R_386_TLS_GD_CALL  26
+#define R_386_TLS_GD_POP   27
+#define R_386_TLS_LDM_32   28
+#define R_386_TLS_LDM_PUSH 29
+#define R_386_TLS_LDM_CALL 30
+#define R_386_TLS_LDM_POP  31
+#define R_386_TLS_LDO_32   32
+#define R_386_TLS_IE_32	   33
+#define R_386_TLS_LE_32	   34
+#define R_386_TLS_DTPMOD32 35
+#define R_386_TLS_DTPOFF32 36
+#define R_386_TLS_TPOFF32  37
+#define R_386_SIZE32       38
+#define R_386_TLS_GOTDESC  39
+#define R_386_TLS_DESC_CALL 40
+#define R_386_TLS_DESC     41
+#define R_386_IRELATIVE	   42
+#define R_386_GOT32X	   43
+#define R_386_NUM	   44
+
+
+
+
+
+#define STT_SPARC_REGISTER	13
+
+
+
+#define EF_SPARCV9_MM		3
+#define EF_SPARCV9_TSO		0
+#define EF_SPARCV9_PSO		1
+#define EF_SPARCV9_RMO		2
+#define EF_SPARC_LEDATA		0x800000
+#define EF_SPARC_EXT_MASK	0xFFFF00
+#define EF_SPARC_32PLUS		0x000100
+#define EF_SPARC_SUN_US1	0x000200
+#define EF_SPARC_HAL_R1		0x000400
+#define EF_SPARC_SUN_US3	0x000800
+
+
+
+#define R_SPARC_NONE		0
+#define R_SPARC_8		1
+#define R_SPARC_16		2
+#define R_SPARC_32		3
+#define R_SPARC_DISP8		4
+#define R_SPARC_DISP16		5
+#define R_SPARC_DISP32		6
+#define R_SPARC_WDISP30		7
+#define R_SPARC_WDISP22		8
+#define R_SPARC_HI22		9
+#define R_SPARC_22		10
+#define R_SPARC_13		11
+#define R_SPARC_LO10		12
+#define R_SPARC_GOT10		13
+#define R_SPARC_GOT13		14
+#define R_SPARC_GOT22		15
+#define R_SPARC_PC10		16
+#define R_SPARC_PC22		17
+#define R_SPARC_WPLT30		18
+#define R_SPARC_COPY		19
+#define R_SPARC_GLOB_DAT	20
+#define R_SPARC_JMP_SLOT	21
+#define R_SPARC_RELATIVE	22
+#define R_SPARC_UA32		23
+
+
+
+#define R_SPARC_PLT32		24
+#define R_SPARC_HIPLT22		25
+#define R_SPARC_LOPLT10		26
+#define R_SPARC_PCPLT32		27
+#define R_SPARC_PCPLT22		28
+#define R_SPARC_PCPLT10		29
+#define R_SPARC_10		30
+#define R_SPARC_11		31
+#define R_SPARC_64		32
+#define R_SPARC_OLO10		33
+#define R_SPARC_HH22		34
+#define R_SPARC_HM10		35
+#define R_SPARC_LM22		36
+#define R_SPARC_PC_HH22		37
+#define R_SPARC_PC_HM10		38
+#define R_SPARC_PC_LM22		39
+#define R_SPARC_WDISP16		40
+#define R_SPARC_WDISP19		41
+#define R_SPARC_GLOB_JMP	42
+#define R_SPARC_7		43
+#define R_SPARC_5		44
+#define R_SPARC_6		45
+#define R_SPARC_DISP64		46
+#define R_SPARC_PLT64		47
+#define R_SPARC_HIX22		48
+#define R_SPARC_LOX10		49
+#define R_SPARC_H44		50
+#define R_SPARC_M44		51
+#define R_SPARC_L44		52
+#define R_SPARC_REGISTER	53
+#define R_SPARC_UA64		54
+#define R_SPARC_UA16		55
+#define R_SPARC_TLS_GD_HI22	56
+#define R_SPARC_TLS_GD_LO10	57
+#define R_SPARC_TLS_GD_ADD	58
+#define R_SPARC_TLS_GD_CALL	59
+#define R_SPARC_TLS_LDM_HI22	60
+#define R_SPARC_TLS_LDM_LO10	61
+#define R_SPARC_TLS_LDM_ADD	62
+#define R_SPARC_TLS_LDM_CALL	63
+#define R_SPARC_TLS_LDO_HIX22	64
+#define R_SPARC_TLS_LDO_LOX10	65
+#define R_SPARC_TLS_LDO_ADD	66
+#define R_SPARC_TLS_IE_HI22	67
+#define R_SPARC_TLS_IE_LO10	68
+#define R_SPARC_TLS_IE_LD	69
+#define R_SPARC_TLS_IE_LDX	70
+#define R_SPARC_TLS_IE_ADD	71
+#define R_SPARC_TLS_LE_HIX22	72
+#define R_SPARC_TLS_LE_LOX10	73
+#define R_SPARC_TLS_DTPMOD32	74
+#define R_SPARC_TLS_DTPMOD64	75
+#define R_SPARC_TLS_DTPOFF32	76
+#define R_SPARC_TLS_DTPOFF64	77
+#define R_SPARC_TLS_TPOFF32	78
+#define R_SPARC_TLS_TPOFF64	79
+#define R_SPARC_GOTDATA_HIX22	80
+#define R_SPARC_GOTDATA_LOX10	81
+#define R_SPARC_GOTDATA_OP_HIX22	82
+#define R_SPARC_GOTDATA_OP_LOX10	83
+#define R_SPARC_GOTDATA_OP	84
+#define R_SPARC_H34		85
+#define R_SPARC_SIZE32		86
+#define R_SPARC_SIZE64		87
+#define R_SPARC_GNU_VTINHERIT	250
+#define R_SPARC_GNU_VTENTRY	251
+#define R_SPARC_REV32		252
+
+#define R_SPARC_NUM		253
+
+
+
+#define DT_SPARC_REGISTER 0x70000001
+#define DT_SPARC_NUM	2
+
+
+#define EF_MIPS_NOREORDER   1
+#define EF_MIPS_PIC	    2
+#define EF_MIPS_CPIC	    4
+#define EF_MIPS_XGOT	    8
+#define EF_MIPS_64BIT_WHIRL 16
+#define EF_MIPS_ABI2	    32
+#define EF_MIPS_ABI_ON32    64
+#define EF_MIPS_FP64	    512
+#define EF_MIPS_NAN2008     1024
+#define EF_MIPS_ARCH	    0xf0000000
+
+
+
+#define EF_MIPS_ARCH_1	    0x00000000
+#define EF_MIPS_ARCH_2	    0x10000000
+#define EF_MIPS_ARCH_3	    0x20000000
+#define EF_MIPS_ARCH_4	    0x30000000
+#define EF_MIPS_ARCH_5	    0x40000000
+#define EF_MIPS_ARCH_32     0x50000000
+#define EF_MIPS_ARCH_64     0x60000000
+#define EF_MIPS_ARCH_32R2   0x70000000
+#define EF_MIPS_ARCH_64R2   0x80000000
+
+
+#define E_MIPS_ARCH_1	  0x00000000
+#define E_MIPS_ARCH_2	  0x10000000
+#define E_MIPS_ARCH_3	  0x20000000
+#define E_MIPS_ARCH_4	  0x30000000
+#define E_MIPS_ARCH_5	  0x40000000
+#define E_MIPS_ARCH_32	  0x50000000
+#define E_MIPS_ARCH_64	  0x60000000
+
+
+
+#define SHN_MIPS_ACOMMON    0xff00
+#define SHN_MIPS_TEXT	    0xff01
+#define SHN_MIPS_DATA	    0xff02
+#define SHN_MIPS_SCOMMON    0xff03
+#define SHN_MIPS_SUNDEFINED 0xff04
+
+
+
+#define SHT_MIPS_LIBLIST       0x70000000
+#define SHT_MIPS_MSYM	       0x70000001
+#define SHT_MIPS_CONFLICT      0x70000002
+#define SHT_MIPS_GPTAB	       0x70000003
+#define SHT_MIPS_UCODE	       0x70000004
+#define SHT_MIPS_DEBUG	       0x70000005
+#define SHT_MIPS_REGINFO       0x70000006
+#define SHT_MIPS_PACKAGE       0x70000007
+#define SHT_MIPS_PACKSYM       0x70000008
+#define SHT_MIPS_RELD	       0x70000009
+#define SHT_MIPS_IFACE         0x7000000b
+#define SHT_MIPS_CONTENT       0x7000000c
+#define SHT_MIPS_OPTIONS       0x7000000d
+#define SHT_MIPS_SHDR	       0x70000010
+#define SHT_MIPS_FDESC	       0x70000011
+#define SHT_MIPS_EXTSYM	       0x70000012
+#define SHT_MIPS_DENSE	       0x70000013
+#define SHT_MIPS_PDESC	       0x70000014
+#define SHT_MIPS_LOCSYM	       0x70000015
+#define SHT_MIPS_AUXSYM	       0x70000016
+#define SHT_MIPS_OPTSYM	       0x70000017
+#define SHT_MIPS_LOCSTR	       0x70000018
+#define SHT_MIPS_LINE	       0x70000019
+#define SHT_MIPS_RFDESC	       0x7000001a
+#define SHT_MIPS_DELTASYM      0x7000001b
+#define SHT_MIPS_DELTAINST     0x7000001c
+#define SHT_MIPS_DELTACLASS    0x7000001d
+#define SHT_MIPS_DWARF         0x7000001e
+#define SHT_MIPS_DELTADECL     0x7000001f
+#define SHT_MIPS_SYMBOL_LIB    0x70000020
+#define SHT_MIPS_EVENTS	       0x70000021
+#define SHT_MIPS_TRANSLATE     0x70000022
+#define SHT_MIPS_PIXIE	       0x70000023
+#define SHT_MIPS_XLATE	       0x70000024
+#define SHT_MIPS_XLATE_DEBUG   0x70000025
+#define SHT_MIPS_WHIRL	       0x70000026
+#define SHT_MIPS_EH_REGION     0x70000027
+#define SHT_MIPS_XLATE_OLD     0x70000028
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+
+
+
+#define SHF_MIPS_GPREL	 0x10000000
+#define SHF_MIPS_MERGE	 0x20000000
+#define SHF_MIPS_ADDR	 0x40000000
+#define SHF_MIPS_STRINGS 0x80000000
+#define SHF_MIPS_NOSTRIP 0x08000000
+#define SHF_MIPS_LOCAL	 0x04000000
+#define SHF_MIPS_NAMES	 0x02000000
+#define SHF_MIPS_NODUPE	 0x01000000
+
+
+
+
+
+#define STO_MIPS_DEFAULT		0x0
+#define STO_MIPS_INTERNAL		0x1
+#define STO_MIPS_HIDDEN			0x2
+#define STO_MIPS_PROTECTED		0x3
+#define STO_MIPS_PLT			0x8
+#define STO_MIPS_SC_ALIGN_UNUSED	0xff
+
+
+#define STB_MIPS_SPLIT_COMMON		13
+
+
+
+typedef union {
+  struct {
+      Elf32_Word gt_current_g_value;
+      Elf32_Word gt_unused;
+  } gt_header;
+  struct {
+      Elf32_Word gt_g_value;
+      Elf32_Word gt_bytes;
+  } gt_entry;
+} Elf32_gptab;
+
+
+
+typedef struct {
+  Elf32_Word	ri_gprmask;
+  Elf32_Word	ri_cprmask[4];
+  Elf32_Sword	ri_gp_value;
+} Elf32_RegInfo;
+
+
+
+typedef struct {
+  unsigned char kind;
+
+  unsigned char size;
+  Elf32_Section section;
+
+  Elf32_Word info;
+} Elf_Options;
+
+
+
+#define ODK_NULL	0
+#define ODK_REGINFO	1
+#define ODK_EXCEPTIONS	2
+#define ODK_PAD		3
+#define ODK_HWPATCH	4
+#define ODK_FILL	5
+#define ODK_TAGS	6
+#define ODK_HWAND	7
+#define ODK_HWOR	8
+
+
+
+#define OEX_FPU_MIN	0x1f
+#define OEX_FPU_MAX	0x1f00
+#define OEX_PAGE0	0x10000
+#define OEX_SMM		0x20000
+#define OEX_FPDBUG	0x40000
+#define OEX_PRECISEFP	OEX_FPDBUG
+#define OEX_DISMISS	0x80000
+
+#define OEX_FPU_INVAL	0x10
+#define OEX_FPU_DIV0	0x08
+#define OEX_FPU_OFLO	0x04
+#define OEX_FPU_UFLO	0x02
+#define OEX_FPU_INEX	0x01
+
+
+
+#define OHW_R4KEOP	0x1
+#define OHW_R8KPFETCH	0x2
+#define OHW_R5KEOP	0x4
+#define OHW_R5KCVTL	0x8
+
+#define OPAD_PREFIX	0x1
+#define OPAD_POSTFIX	0x2
+#define OPAD_SYMBOL	0x4
+
+
+
+typedef struct {
+  Elf32_Word hwp_flags1;
+  Elf32_Word hwp_flags2;
+} Elf_Options_Hw;
+
+
+
+#define OHWA0_R4KEOP_CHECKED	0x00000001
+#define OHWA1_R4KEOP_CLEAN	0x00000002
+
+
+
+#define R_MIPS_NONE		0
+#define R_MIPS_16		1
+#define R_MIPS_32		2
+#define R_MIPS_REL32		3
+#define R_MIPS_26		4
+#define R_MIPS_HI16		5
+#define R_MIPS_LO16		6
+#define R_MIPS_GPREL16		7
+#define R_MIPS_LITERAL		8
+#define R_MIPS_GOT16		9
+#define R_MIPS_PC16		10
+#define R_MIPS_CALL16		11
+#define R_MIPS_GPREL32		12
+
+#define R_MIPS_SHIFT5		16
+#define R_MIPS_SHIFT6		17
+#define R_MIPS_64		18
+#define R_MIPS_GOT_DISP		19
+#define R_MIPS_GOT_PAGE		20
+#define R_MIPS_GOT_OFST		21
+#define R_MIPS_GOT_HI16		22
+#define R_MIPS_GOT_LO16		23
+#define R_MIPS_SUB		24
+#define R_MIPS_INSERT_A		25
+#define R_MIPS_INSERT_B		26
+#define R_MIPS_DELETE		27
+#define R_MIPS_HIGHER		28
+#define R_MIPS_HIGHEST		29
+#define R_MIPS_CALL_HI16	30
+#define R_MIPS_CALL_LO16	31
+#define R_MIPS_SCN_DISP		32
+#define R_MIPS_REL16		33
+#define R_MIPS_ADD_IMMEDIATE	34
+#define R_MIPS_PJUMP		35
+#define R_MIPS_RELGOT		36
+#define R_MIPS_JALR		37
+#define R_MIPS_TLS_DTPMOD32	38
+#define R_MIPS_TLS_DTPREL32	39
+#define R_MIPS_TLS_DTPMOD64	40
+#define R_MIPS_TLS_DTPREL64	41
+#define R_MIPS_TLS_GD		42
+#define R_MIPS_TLS_LDM		43
+#define R_MIPS_TLS_DTPREL_HI16	44
+#define R_MIPS_TLS_DTPREL_LO16	45
+#define R_MIPS_TLS_GOTTPREL	46
+#define R_MIPS_TLS_TPREL32	47
+#define R_MIPS_TLS_TPREL64	48
+#define R_MIPS_TLS_TPREL_HI16	49
+#define R_MIPS_TLS_TPREL_LO16	50
+#define R_MIPS_GLOB_DAT		51
+#define R_MIPS_COPY		126
+#define R_MIPS_JUMP_SLOT        127
+
+#define R_MIPS_NUM		128
+
+
+
+#define PT_MIPS_REGINFO	0x70000000
+#define PT_MIPS_RTPROC  0x70000001
+#define PT_MIPS_OPTIONS 0x70000002
+#define PT_MIPS_ABIFLAGS 0x70000003
+
+
+
+#define PF_MIPS_LOCAL	0x10000000
+
+
+
+#define DT_MIPS_RLD_VERSION  0x70000001
+#define DT_MIPS_TIME_STAMP   0x70000002
+#define DT_MIPS_ICHECKSUM    0x70000003
+#define DT_MIPS_IVERSION     0x70000004
+#define DT_MIPS_FLAGS	     0x70000005
+#define DT_MIPS_BASE_ADDRESS 0x70000006
+#define DT_MIPS_MSYM	     0x70000007
+#define DT_MIPS_CONFLICT     0x70000008
+#define DT_MIPS_LIBLIST	     0x70000009
+#define DT_MIPS_LOCAL_GOTNO  0x7000000a
+#define DT_MIPS_CONFLICTNO   0x7000000b
+#define DT_MIPS_LIBLISTNO    0x70000010
+#define DT_MIPS_SYMTABNO     0x70000011
+#define DT_MIPS_UNREFEXTNO   0x70000012
+#define DT_MIPS_GOTSYM	     0x70000013
+#define DT_MIPS_HIPAGENO     0x70000014
+#define DT_MIPS_RLD_MAP	     0x70000016
+#define DT_MIPS_DELTA_CLASS  0x70000017
+#define DT_MIPS_DELTA_CLASS_NO    0x70000018
+
+#define DT_MIPS_DELTA_INSTANCE    0x70000019
+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a
+
+#define DT_MIPS_DELTA_RELOC  0x7000001b
+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c
+
+#define DT_MIPS_DELTA_SYM    0x7000001d
+
+#define DT_MIPS_DELTA_SYM_NO 0x7000001e
+
+#define DT_MIPS_DELTA_CLASSSYM 0x70000020
+
+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021
+
+#define DT_MIPS_CXX_FLAGS    0x70000022
+#define DT_MIPS_PIXIE_INIT   0x70000023
+#define DT_MIPS_SYMBOL_LIB   0x70000024
+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
+#define DT_MIPS_LOCAL_GOTIDX 0x70000026
+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
+#define DT_MIPS_OPTIONS	     0x70000029
+#define DT_MIPS_INTERFACE    0x7000002a
+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
+#define DT_MIPS_INTERFACE_SIZE 0x7000002c
+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d
+
+#define DT_MIPS_PERF_SUFFIX  0x7000002e
+
+#define DT_MIPS_COMPACT_SIZE 0x7000002f
+#define DT_MIPS_GP_VALUE     0x70000030
+#define DT_MIPS_AUX_DYNAMIC  0x70000031
+
+#define DT_MIPS_PLTGOT	     0x70000032
+
+#define DT_MIPS_RWPLT        0x70000034
+#define DT_MIPS_RLD_MAP_REL  0x70000035
+#define DT_MIPS_NUM	     0x36
+
+
+
+#define RHF_NONE		   0
+#define RHF_QUICKSTART		   (1 << 0)
+#define RHF_NOTPOT		   (1 << 1)
+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)
+#define RHF_NO_MOVE		   (1 << 3)
+#define RHF_SGI_ONLY		   (1 << 4)
+#define RHF_GUARANTEE_INIT	   (1 << 5)
+#define RHF_DELTA_C_PLUS_PLUS	   (1 << 6)
+#define RHF_GUARANTEE_START_INIT   (1 << 7)
+#define RHF_PIXIE		   (1 << 8)
+#define RHF_DEFAULT_DELAY_LOAD	   (1 << 9)
+#define RHF_REQUICKSTART	   (1 << 10)
+#define RHF_REQUICKSTARTED	   (1 << 11)
+#define RHF_CORD		   (1 << 12)
+#define RHF_NO_UNRES_UNDEF	   (1 << 13)
+#define RHF_RLD_ORDER_SAFE	   (1 << 14)
+
+
+
+typedef struct {
+  Elf32_Word l_name;
+  Elf32_Word l_time_stamp;
+  Elf32_Word l_checksum;
+  Elf32_Word l_version;
+  Elf32_Word l_flags;
+} Elf32_Lib;
+
+typedef struct {
+  Elf64_Word l_name;
+  Elf64_Word l_time_stamp;
+  Elf64_Word l_checksum;
+  Elf64_Word l_version;
+  Elf64_Word l_flags;
+} Elf64_Lib;
+
+
+
+
+#define LL_NONE		  0
+#define LL_EXACT_MATCH	  (1 << 0)
+#define LL_IGNORE_INT_VER (1 << 1)
+#define LL_REQUIRE_MINOR  (1 << 2)
+#define LL_EXPORTS	  (1 << 3)
+#define LL_DELAY_LOAD	  (1 << 4)
+#define LL_DELTA	  (1 << 5)
+
+
+
+typedef Elf32_Addr Elf32_Conflict;
+
+typedef struct {
+  Elf32_Half version;
+  unsigned char isa_level;
+  unsigned char isa_rev;
+  unsigned char gpr_size;
+  unsigned char cpr1_size;
+  unsigned char cpr2_size;
+  unsigned char fp_abi;
+  Elf32_Word isa_ext;
+  Elf32_Word ases;
+  Elf32_Word flags1;
+  Elf32_Word flags2;
+} Elf_MIPS_ABIFlags_v0;
+
+#define MIPS_AFL_REG_NONE	0x00
+#define MIPS_AFL_REG_32		0x01
+#define MIPS_AFL_REG_64		0x02
+#define MIPS_AFL_REG_128	0x03
+
+#define MIPS_AFL_ASE_DSP	0x00000001
+#define MIPS_AFL_ASE_DSPR2	0x00000002
+#define MIPS_AFL_ASE_EVA	0x00000004
+#define MIPS_AFL_ASE_MCU	0x00000008
+#define MIPS_AFL_ASE_MDMX	0x00000010
+#define MIPS_AFL_ASE_MIPS3D	0x00000020
+#define MIPS_AFL_ASE_MT		0x00000040
+#define MIPS_AFL_ASE_SMARTMIPS	0x00000080
+#define MIPS_AFL_ASE_VIRT	0x00000100
+#define MIPS_AFL_ASE_MSA	0x00000200
+#define MIPS_AFL_ASE_MIPS16	0x00000400
+#define MIPS_AFL_ASE_MICROMIPS	0x00000800
+#define MIPS_AFL_ASE_XPA	0x00001000
+#define MIPS_AFL_ASE_MASK	0x00001fff
+
+#define MIPS_AFL_EXT_XLR	  1
+#define MIPS_AFL_EXT_OCTEON2	  2
+#define MIPS_AFL_EXT_OCTEONP	  3
+#define MIPS_AFL_EXT_LOONGSON_3A  4
+#define MIPS_AFL_EXT_OCTEON	  5
+#define MIPS_AFL_EXT_5900	  6
+#define MIPS_AFL_EXT_4650	  7
+#define MIPS_AFL_EXT_4010	  8
+#define MIPS_AFL_EXT_4100	  9
+#define MIPS_AFL_EXT_3900	  10
+#define MIPS_AFL_EXT_10000	  11
+#define MIPS_AFL_EXT_SB1	  12
+#define MIPS_AFL_EXT_4111	  13
+#define MIPS_AFL_EXT_4120	  14
+#define MIPS_AFL_EXT_5400	  15
+#define MIPS_AFL_EXT_5500	  16
+#define MIPS_AFL_EXT_LOONGSON_2E  17
+#define MIPS_AFL_EXT_LOONGSON_2F  18
+
+#define MIPS_AFL_FLAGS1_ODDSPREG  1
+
+enum
+{
+  Val_GNU_MIPS_ABI_FP_ANY = 0,
+  Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
+  Val_GNU_MIPS_ABI_FP_SINGLE = 2,
+  Val_GNU_MIPS_ABI_FP_SOFT = 3,
+  Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
+  Val_GNU_MIPS_ABI_FP_XX = 5,
+  Val_GNU_MIPS_ABI_FP_64 = 6,
+  Val_GNU_MIPS_ABI_FP_64A = 7,
+  Val_GNU_MIPS_ABI_FP_MAX = 7
+};
+
+
+
+
+#define EF_PARISC_TRAPNIL	0x00010000
+#define EF_PARISC_EXT		0x00020000
+#define EF_PARISC_LSB		0x00040000
+#define EF_PARISC_WIDE		0x00080000
+#define EF_PARISC_NO_KABP	0x00100000
+
+#define EF_PARISC_LAZYSWAP	0x00400000
+#define EF_PARISC_ARCH		0x0000ffff
+
+
+
+#define EFA_PARISC_1_0		    0x020b
+#define EFA_PARISC_1_1		    0x0210
+#define EFA_PARISC_2_0		    0x0214
+
+
+
+#define SHN_PARISC_ANSI_COMMON	0xff00
+
+#define SHN_PARISC_HUGE_COMMON	0xff01
+
+
+
+#define SHT_PARISC_EXT		0x70000000
+#define SHT_PARISC_UNWIND	0x70000001
+#define SHT_PARISC_DOC		0x70000002
+
+
+
+#define SHF_PARISC_SHORT	0x20000000
+#define SHF_PARISC_HUGE		0x40000000
+#define SHF_PARISC_SBP		0x80000000
+
+
+
+#define STT_PARISC_MILLICODE	13
+
+#define STT_HP_OPAQUE		(STT_LOOS + 0x1)
+#define STT_HP_STUB		(STT_LOOS + 0x2)
+
+
+
+#define R_PARISC_NONE		0
+#define R_PARISC_DIR32		1
+#define R_PARISC_DIR21L		2
+#define R_PARISC_DIR17R		3
+#define R_PARISC_DIR17F		4
+#define R_PARISC_DIR14R		6
+#define R_PARISC_PCREL32	9
+#define R_PARISC_PCREL21L	10
+#define R_PARISC_PCREL17R	11
+#define R_PARISC_PCREL17F	12
+#define R_PARISC_PCREL14R	14
+#define R_PARISC_DPREL21L	18
+#define R_PARISC_DPREL14R	22
+#define R_PARISC_GPREL21L	26
+#define R_PARISC_GPREL14R	30
+#define R_PARISC_LTOFF21L	34
+#define R_PARISC_LTOFF14R	38
+#define R_PARISC_SECREL32	41
+#define R_PARISC_SEGBASE	48
+#define R_PARISC_SEGREL32	49
+#define R_PARISC_PLTOFF21L	50
+#define R_PARISC_PLTOFF14R	54
+#define R_PARISC_LTOFF_FPTR32	57
+#define R_PARISC_LTOFF_FPTR21L	58
+#define R_PARISC_LTOFF_FPTR14R	62
+#define R_PARISC_FPTR64		64
+#define R_PARISC_PLABEL32	65
+#define R_PARISC_PLABEL21L	66
+#define R_PARISC_PLABEL14R	70
+#define R_PARISC_PCREL64	72
+#define R_PARISC_PCREL22F	74
+#define R_PARISC_PCREL14WR	75
+#define R_PARISC_PCREL14DR	76
+#define R_PARISC_PCREL16F	77
+#define R_PARISC_PCREL16WF	78
+#define R_PARISC_PCREL16DF	79
+#define R_PARISC_DIR64		80
+#define R_PARISC_DIR14WR	83
+#define R_PARISC_DIR14DR	84
+#define R_PARISC_DIR16F		85
+#define R_PARISC_DIR16WF	86
+#define R_PARISC_DIR16DF	87
+#define R_PARISC_GPREL64	88
+#define R_PARISC_GPREL14WR	91
+#define R_PARISC_GPREL14DR	92
+#define R_PARISC_GPREL16F	93
+#define R_PARISC_GPREL16WF	94
+#define R_PARISC_GPREL16DF	95
+#define R_PARISC_LTOFF64	96
+#define R_PARISC_LTOFF14WR	99
+#define R_PARISC_LTOFF14DR	100
+#define R_PARISC_LTOFF16F	101
+#define R_PARISC_LTOFF16WF	102
+#define R_PARISC_LTOFF16DF	103
+#define R_PARISC_SECREL64	104
+#define R_PARISC_SEGREL64	112
+#define R_PARISC_PLTOFF14WR	115
+#define R_PARISC_PLTOFF14DR	116
+#define R_PARISC_PLTOFF16F	117
+#define R_PARISC_PLTOFF16WF	118
+#define R_PARISC_PLTOFF16DF	119
+#define R_PARISC_LTOFF_FPTR64	120
+#define R_PARISC_LTOFF_FPTR14WR	123
+#define R_PARISC_LTOFF_FPTR14DR	124
+#define R_PARISC_LTOFF_FPTR16F	125
+#define R_PARISC_LTOFF_FPTR16WF	126
+#define R_PARISC_LTOFF_FPTR16DF	127
+#define R_PARISC_LORESERVE	128
+#define R_PARISC_COPY		128
+#define R_PARISC_IPLT		129
+#define R_PARISC_EPLT		130
+#define R_PARISC_TPREL32	153
+#define R_PARISC_TPREL21L	154
+#define R_PARISC_TPREL14R	158
+#define R_PARISC_LTOFF_TP21L	162
+#define R_PARISC_LTOFF_TP14R	166
+#define R_PARISC_LTOFF_TP14F	167
+#define R_PARISC_TPREL64	216
+#define R_PARISC_TPREL14WR	219
+#define R_PARISC_TPREL14DR	220
+#define R_PARISC_TPREL16F	221
+#define R_PARISC_TPREL16WF	222
+#define R_PARISC_TPREL16DF	223
+#define R_PARISC_LTOFF_TP64	224
+#define R_PARISC_LTOFF_TP14WR	227
+#define R_PARISC_LTOFF_TP14DR	228
+#define R_PARISC_LTOFF_TP16F	229
+#define R_PARISC_LTOFF_TP16WF	230
+#define R_PARISC_LTOFF_TP16DF	231
+#define R_PARISC_GNU_VTENTRY	232
+#define R_PARISC_GNU_VTINHERIT	233
+#define R_PARISC_TLS_GD21L	234
+#define R_PARISC_TLS_GD14R	235
+#define R_PARISC_TLS_GDCALL	236
+#define R_PARISC_TLS_LDM21L	237
+#define R_PARISC_TLS_LDM14R	238
+#define R_PARISC_TLS_LDMCALL	239
+#define R_PARISC_TLS_LDO21L	240
+#define R_PARISC_TLS_LDO14R	241
+#define R_PARISC_TLS_DTPMOD32	242
+#define R_PARISC_TLS_DTPMOD64	243
+#define R_PARISC_TLS_DTPOFF32	244
+#define R_PARISC_TLS_DTPOFF64	245
+#define R_PARISC_TLS_LE21L	R_PARISC_TPREL21L
+#define R_PARISC_TLS_LE14R	R_PARISC_TPREL14R
+#define R_PARISC_TLS_IE21L	R_PARISC_LTOFF_TP21L
+#define R_PARISC_TLS_IE14R	R_PARISC_LTOFF_TP14R
+#define R_PARISC_TLS_TPREL32	R_PARISC_TPREL32
+#define R_PARISC_TLS_TPREL64	R_PARISC_TPREL64
+#define R_PARISC_HIRESERVE	255
+
+
+
+#define PT_HP_TLS		(PT_LOOS + 0x0)
+#define PT_HP_CORE_NONE		(PT_LOOS + 0x1)
+#define PT_HP_CORE_VERSION	(PT_LOOS + 0x2)
+#define PT_HP_CORE_KERNEL	(PT_LOOS + 0x3)
+#define PT_HP_CORE_COMM		(PT_LOOS + 0x4)
+#define PT_HP_CORE_PROC		(PT_LOOS + 0x5)
+#define PT_HP_CORE_LOADABLE	(PT_LOOS + 0x6)
+#define PT_HP_CORE_STACK	(PT_LOOS + 0x7)
+#define PT_HP_CORE_SHM		(PT_LOOS + 0x8)
+#define PT_HP_CORE_MMF		(PT_LOOS + 0x9)
+#define PT_HP_PARALLEL		(PT_LOOS + 0x10)
+#define PT_HP_FASTBIND		(PT_LOOS + 0x11)
+#define PT_HP_OPT_ANNOT		(PT_LOOS + 0x12)
+#define PT_HP_HSL_ANNOT		(PT_LOOS + 0x13)
+#define PT_HP_STACK		(PT_LOOS + 0x14)
+
+#define PT_PARISC_ARCHEXT	0x70000000
+#define PT_PARISC_UNWIND	0x70000001
+
+
+
+#define PF_PARISC_SBP		0x08000000
+
+#define PF_HP_PAGE_SIZE		0x00100000
+#define PF_HP_FAR_SHARED	0x00200000
+#define PF_HP_NEAR_SHARED	0x00400000
+#define PF_HP_CODE		0x01000000
+#define PF_HP_MODIFY		0x02000000
+#define PF_HP_LAZYSWAP		0x04000000
+#define PF_HP_SBP		0x08000000
+
+
+
+
+
+
+#define EF_ALPHA_32BIT		1
+#define EF_ALPHA_CANRELAX	2
+
+
+
+
+#define SHT_ALPHA_DEBUG		0x70000001
+#define SHT_ALPHA_REGINFO	0x70000002
+
+
+
+#define SHF_ALPHA_GPREL		0x10000000
+
+
+#define STO_ALPHA_NOPV		0x80
+#define STO_ALPHA_STD_GPLOAD	0x88
+
+
+
+#define R_ALPHA_NONE		0
+#define R_ALPHA_REFLONG		1
+#define R_ALPHA_REFQUAD		2
+#define R_ALPHA_GPREL32		3
+#define R_ALPHA_LITERAL		4
+#define R_ALPHA_LITUSE		5
+#define R_ALPHA_GPDISP		6
+#define R_ALPHA_BRADDR		7
+#define R_ALPHA_HINT		8
+#define R_ALPHA_SREL16		9
+#define R_ALPHA_SREL32		10
+#define R_ALPHA_SREL64		11
+#define R_ALPHA_GPRELHIGH	17
+#define R_ALPHA_GPRELLOW	18
+#define R_ALPHA_GPREL16		19
+#define R_ALPHA_COPY		24
+#define R_ALPHA_GLOB_DAT	25
+#define R_ALPHA_JMP_SLOT	26
+#define R_ALPHA_RELATIVE	27
+#define R_ALPHA_TLS_GD_HI	28
+#define R_ALPHA_TLSGD		29
+#define R_ALPHA_TLS_LDM		30
+#define R_ALPHA_DTPMOD64	31
+#define R_ALPHA_GOTDTPREL	32
+#define R_ALPHA_DTPREL64	33
+#define R_ALPHA_DTPRELHI	34
+#define R_ALPHA_DTPRELLO	35
+#define R_ALPHA_DTPREL16	36
+#define R_ALPHA_GOTTPREL	37
+#define R_ALPHA_TPREL64		38
+#define R_ALPHA_TPRELHI		39
+#define R_ALPHA_TPRELLO		40
+#define R_ALPHA_TPREL16		41
+
+#define R_ALPHA_NUM		46
+
+
+#define LITUSE_ALPHA_ADDR	0
+#define LITUSE_ALPHA_BASE	1
+#define LITUSE_ALPHA_BYTOFF	2
+#define LITUSE_ALPHA_JSR	3
+#define LITUSE_ALPHA_TLS_GD	4
+#define LITUSE_ALPHA_TLS_LDM	5
+
+
+#define DT_ALPHA_PLTRO		(DT_LOPROC + 0)
+#define DT_ALPHA_NUM		1
+
+
+
+
+#define EF_PPC_EMB		0x80000000
+
+
+#define EF_PPC_RELOCATABLE	0x00010000
+#define EF_PPC_RELOCATABLE_LIB	0x00008000
+
+
+
+#define R_PPC_NONE		0
+#define R_PPC_ADDR32		1
+#define R_PPC_ADDR24		2
+#define R_PPC_ADDR16		3
+#define R_PPC_ADDR16_LO		4
+#define R_PPC_ADDR16_HI		5
+#define R_PPC_ADDR16_HA		6
+#define R_PPC_ADDR14		7
+#define R_PPC_ADDR14_BRTAKEN	8
+#define R_PPC_ADDR14_BRNTAKEN	9
+#define R_PPC_REL24		10
+#define R_PPC_REL14		11
+#define R_PPC_REL14_BRTAKEN	12
+#define R_PPC_REL14_BRNTAKEN	13
+#define R_PPC_GOT16		14
+#define R_PPC_GOT16_LO		15
+#define R_PPC_GOT16_HI		16
+#define R_PPC_GOT16_HA		17
+#define R_PPC_PLTREL24		18
+#define R_PPC_COPY		19
+#define R_PPC_GLOB_DAT		20
+#define R_PPC_JMP_SLOT		21
+#define R_PPC_RELATIVE		22
+#define R_PPC_LOCAL24PC		23
+#define R_PPC_UADDR32		24
+#define R_PPC_UADDR16		25
+#define R_PPC_REL32		26
+#define R_PPC_PLT32		27
+#define R_PPC_PLTREL32		28
+#define R_PPC_PLT16_LO		29
+#define R_PPC_PLT16_HI		30
+#define R_PPC_PLT16_HA		31
+#define R_PPC_SDAREL16		32
+#define R_PPC_SECTOFF		33
+#define R_PPC_SECTOFF_LO	34
+#define R_PPC_SECTOFF_HI	35
+#define R_PPC_SECTOFF_HA	36
+
+
+#define R_PPC_TLS		67
+#define R_PPC_DTPMOD32		68
+#define R_PPC_TPREL16		69
+#define R_PPC_TPREL16_LO	70
+#define R_PPC_TPREL16_HI	71
+#define R_PPC_TPREL16_HA	72
+#define R_PPC_TPREL32		73
+#define R_PPC_DTPREL16		74
+#define R_PPC_DTPREL16_LO	75
+#define R_PPC_DTPREL16_HI	76
+#define R_PPC_DTPREL16_HA	77
+#define R_PPC_DTPREL32		78
+#define R_PPC_GOT_TLSGD16	79
+#define R_PPC_GOT_TLSGD16_LO	80
+#define R_PPC_GOT_TLSGD16_HI	81
+#define R_PPC_GOT_TLSGD16_HA	82
+#define R_PPC_GOT_TLSLD16	83
+#define R_PPC_GOT_TLSLD16_LO	84
+#define R_PPC_GOT_TLSLD16_HI	85
+#define R_PPC_GOT_TLSLD16_HA	86
+#define R_PPC_GOT_TPREL16	87
+#define R_PPC_GOT_TPREL16_LO	88
+#define R_PPC_GOT_TPREL16_HI	89
+#define R_PPC_GOT_TPREL16_HA	90
+#define R_PPC_GOT_DTPREL16	91
+#define R_PPC_GOT_DTPREL16_LO	92
+#define R_PPC_GOT_DTPREL16_HI	93
+#define R_PPC_GOT_DTPREL16_HA	94
+#define R_PPC_TLSGD		95
+#define R_PPC_TLSLD		96
+
+
+#define R_PPC_EMB_NADDR32	101
+#define R_PPC_EMB_NADDR16	102
+#define R_PPC_EMB_NADDR16_LO	103
+#define R_PPC_EMB_NADDR16_HI	104
+#define R_PPC_EMB_NADDR16_HA	105
+#define R_PPC_EMB_SDAI16	106
+#define R_PPC_EMB_SDA2I16	107
+#define R_PPC_EMB_SDA2REL	108
+#define R_PPC_EMB_SDA21		109
+#define R_PPC_EMB_MRKREF	110
+#define R_PPC_EMB_RELSEC16	111
+#define R_PPC_EMB_RELST_LO	112
+#define R_PPC_EMB_RELST_HI	113
+#define R_PPC_EMB_RELST_HA	114
+#define R_PPC_EMB_BIT_FLD	115
+#define R_PPC_EMB_RELSDA	116
+
+
+#define R_PPC_DIAB_SDA21_LO	180
+#define R_PPC_DIAB_SDA21_HI	181
+#define R_PPC_DIAB_SDA21_HA	182
+#define R_PPC_DIAB_RELSDA_LO	183
+#define R_PPC_DIAB_RELSDA_HI	184
+#define R_PPC_DIAB_RELSDA_HA	185
+
+
+#define R_PPC_IRELATIVE		248
+
+
+#define R_PPC_REL16		249
+#define R_PPC_REL16_LO		250
+#define R_PPC_REL16_HI		251
+#define R_PPC_REL16_HA		252
+
+
+
+#define R_PPC_TOC16		255
+
+
+#define DT_PPC_GOT		(DT_LOPROC + 0)
+#define DT_PPC_OPT		(DT_LOPROC + 1)
+#define DT_PPC_NUM		2
+
+#define PPC_OPT_TLS		1
+
+
+#define R_PPC64_NONE		R_PPC_NONE
+#define R_PPC64_ADDR32		R_PPC_ADDR32
+#define R_PPC64_ADDR24		R_PPC_ADDR24
+#define R_PPC64_ADDR16		R_PPC_ADDR16
+#define R_PPC64_ADDR16_LO	R_PPC_ADDR16_LO
+#define R_PPC64_ADDR16_HI	R_PPC_ADDR16_HI
+#define R_PPC64_ADDR16_HA	R_PPC_ADDR16_HA
+#define R_PPC64_ADDR14		R_PPC_ADDR14
+#define R_PPC64_ADDR14_BRTAKEN	R_PPC_ADDR14_BRTAKEN
+#define R_PPC64_ADDR14_BRNTAKEN	R_PPC_ADDR14_BRNTAKEN
+#define R_PPC64_REL24		R_PPC_REL24
+#define R_PPC64_REL14		R_PPC_REL14
+#define R_PPC64_REL14_BRTAKEN	R_PPC_REL14_BRTAKEN
+#define R_PPC64_REL14_BRNTAKEN	R_PPC_REL14_BRNTAKEN
+#define R_PPC64_GOT16		R_PPC_GOT16
+#define R_PPC64_GOT16_LO	R_PPC_GOT16_LO
+#define R_PPC64_GOT16_HI	R_PPC_GOT16_HI
+#define R_PPC64_GOT16_HA	R_PPC_GOT16_HA
+
+#define R_PPC64_COPY		R_PPC_COPY
+#define R_PPC64_GLOB_DAT	R_PPC_GLOB_DAT
+#define R_PPC64_JMP_SLOT	R_PPC_JMP_SLOT
+#define R_PPC64_RELATIVE	R_PPC_RELATIVE
+
+#define R_PPC64_UADDR32		R_PPC_UADDR32
+#define R_PPC64_UADDR16		R_PPC_UADDR16
+#define R_PPC64_REL32		R_PPC_REL32
+#define R_PPC64_PLT32		R_PPC_PLT32
+#define R_PPC64_PLTREL32	R_PPC_PLTREL32
+#define R_PPC64_PLT16_LO	R_PPC_PLT16_LO
+#define R_PPC64_PLT16_HI	R_PPC_PLT16_HI
+#define R_PPC64_PLT16_HA	R_PPC_PLT16_HA
+
+#define R_PPC64_SECTOFF		R_PPC_SECTOFF
+#define R_PPC64_SECTOFF_LO	R_PPC_SECTOFF_LO
+#define R_PPC64_SECTOFF_HI	R_PPC_SECTOFF_HI
+#define R_PPC64_SECTOFF_HA	R_PPC_SECTOFF_HA
+#define R_PPC64_ADDR30		37
+#define R_PPC64_ADDR64		38
+#define R_PPC64_ADDR16_HIGHER	39
+#define R_PPC64_ADDR16_HIGHERA	40
+#define R_PPC64_ADDR16_HIGHEST	41
+#define R_PPC64_ADDR16_HIGHESTA	42
+#define R_PPC64_UADDR64		43
+#define R_PPC64_REL64		44
+#define R_PPC64_PLT64		45
+#define R_PPC64_PLTREL64	46
+#define R_PPC64_TOC16		47
+#define R_PPC64_TOC16_LO	48
+#define R_PPC64_TOC16_HI	49
+#define R_PPC64_TOC16_HA	50
+#define R_PPC64_TOC		51
+#define R_PPC64_PLTGOT16	52
+#define R_PPC64_PLTGOT16_LO	53
+#define R_PPC64_PLTGOT16_HI	54
+#define R_PPC64_PLTGOT16_HA	55
+
+#define R_PPC64_ADDR16_DS	56
+#define R_PPC64_ADDR16_LO_DS	57
+#define R_PPC64_GOT16_DS	58
+#define R_PPC64_GOT16_LO_DS	59
+#define R_PPC64_PLT16_LO_DS	60
+#define R_PPC64_SECTOFF_DS	61
+#define R_PPC64_SECTOFF_LO_DS	62
+#define R_PPC64_TOC16_DS	63
+#define R_PPC64_TOC16_LO_DS	64
+#define R_PPC64_PLTGOT16_DS	65
+#define R_PPC64_PLTGOT16_LO_DS	66
+
+
+#define R_PPC64_TLS		67
+#define R_PPC64_DTPMOD64	68
+#define R_PPC64_TPREL16		69
+#define R_PPC64_TPREL16_LO	70
+#define R_PPC64_TPREL16_HI	71
+#define R_PPC64_TPREL16_HA	72
+#define R_PPC64_TPREL64		73
+#define R_PPC64_DTPREL16	74
+#define R_PPC64_DTPREL16_LO	75
+#define R_PPC64_DTPREL16_HI	76
+#define R_PPC64_DTPREL16_HA	77
+#define R_PPC64_DTPREL64	78
+#define R_PPC64_GOT_TLSGD16	79
+#define R_PPC64_GOT_TLSGD16_LO	80
+#define R_PPC64_GOT_TLSGD16_HI	81
+#define R_PPC64_GOT_TLSGD16_HA	82
+#define R_PPC64_GOT_TLSLD16	83
+#define R_PPC64_GOT_TLSLD16_LO	84
+#define R_PPC64_GOT_TLSLD16_HI	85
+#define R_PPC64_GOT_TLSLD16_HA	86
+#define R_PPC64_GOT_TPREL16_DS	87
+#define R_PPC64_GOT_TPREL16_LO_DS 88
+#define R_PPC64_GOT_TPREL16_HI	89
+#define R_PPC64_GOT_TPREL16_HA	90
+#define R_PPC64_GOT_DTPREL16_DS	91
+#define R_PPC64_GOT_DTPREL16_LO_DS 92
+#define R_PPC64_GOT_DTPREL16_HI	93
+#define R_PPC64_GOT_DTPREL16_HA	94
+#define R_PPC64_TPREL16_DS	95
+#define R_PPC64_TPREL16_LO_DS	96
+#define R_PPC64_TPREL16_HIGHER	97
+#define R_PPC64_TPREL16_HIGHERA	98
+#define R_PPC64_TPREL16_HIGHEST	99
+#define R_PPC64_TPREL16_HIGHESTA 100
+#define R_PPC64_DTPREL16_DS	101
+#define R_PPC64_DTPREL16_LO_DS	102
+#define R_PPC64_DTPREL16_HIGHER	103
+#define R_PPC64_DTPREL16_HIGHERA 104
+#define R_PPC64_DTPREL16_HIGHEST 105
+#define R_PPC64_DTPREL16_HIGHESTA 106
+#define R_PPC64_TLSGD		107
+#define R_PPC64_TLSLD		108
+#define R_PPC64_TOCSAVE		109
+#define R_PPC64_ADDR16_HIGH	110
+#define R_PPC64_ADDR16_HIGHA	111
+#define R_PPC64_TPREL16_HIGH	112
+#define R_PPC64_TPREL16_HIGHA	113
+#define R_PPC64_DTPREL16_HIGH	114
+#define R_PPC64_DTPREL16_HIGHA	115
+
+
+#define R_PPC64_JMP_IREL	247
+#define R_PPC64_IRELATIVE	248
+#define R_PPC64_REL16		249
+#define R_PPC64_REL16_LO	250
+#define R_PPC64_REL16_HI	251
+#define R_PPC64_REL16_HA	252
+
+#define EF_PPC64_ABI	3
+
+#define DT_PPC64_GLINK  (DT_LOPROC + 0)
+#define DT_PPC64_OPD	(DT_LOPROC + 1)
+#define DT_PPC64_OPDSZ	(DT_LOPROC + 2)
+#define DT_PPC64_OPT	(DT_LOPROC + 3)
+#define DT_PPC64_NUM	4
+
+#define PPC64_OPT_TLS		1
+#define PPC64_OPT_MULTI_TOC	2
+#define PPC64_OPT_LOCALENTRY	4
+
+#define STO_PPC64_LOCAL_BIT	5
+#define STO_PPC64_LOCAL_MASK	0xe0
+#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc)
+
+
+#define EF_ARM_RELEXEC		0x01
+#define EF_ARM_HASENTRY		0x02
+#define EF_ARM_INTERWORK	0x04
+#define EF_ARM_APCS_26		0x08
+#define EF_ARM_APCS_FLOAT	0x10
+#define EF_ARM_PIC		0x20
+#define EF_ARM_ALIGN8		0x40
+#define EF_ARM_NEW_ABI		0x80
+#define EF_ARM_OLD_ABI		0x100
+#define EF_ARM_SOFT_FLOAT	0x200
+#define EF_ARM_VFP_FLOAT	0x400
+#define EF_ARM_MAVERICK_FLOAT	0x800
+
+#define EF_ARM_ABI_FLOAT_SOFT	0x200
+#define EF_ARM_ABI_FLOAT_HARD	0x400
+
+
+#define EF_ARM_SYMSARESORTED	0x04
+#define EF_ARM_DYNSYMSUSESEGIDX	0x08
+#define EF_ARM_MAPSYMSFIRST	0x10
+#define EF_ARM_EABIMASK		0XFF000000
+
+
+#define EF_ARM_BE8	    0x00800000
+#define EF_ARM_LE8	    0x00400000
+
+#define EF_ARM_EABI_VERSION(flags)	((flags) & EF_ARM_EABIMASK)
+#define EF_ARM_EABI_UNKNOWN	0x00000000
+#define EF_ARM_EABI_VER1	0x01000000
+#define EF_ARM_EABI_VER2	0x02000000
+#define EF_ARM_EABI_VER3	0x03000000
+#define EF_ARM_EABI_VER4	0x04000000
+#define EF_ARM_EABI_VER5	0x05000000
+
+
+#define STT_ARM_TFUNC		STT_LOPROC
+#define STT_ARM_16BIT		STT_HIPROC
+
+
+#define SHF_ARM_ENTRYSECT	0x10000000
+#define SHF_ARM_COMDEF		0x80000000
+
+
+
+#define PF_ARM_SB		0x10000000
+
+#define PF_ARM_PI		0x20000000
+#define PF_ARM_ABS		0x40000000
+
+
+#define PT_ARM_EXIDX		(PT_LOPROC + 1)
+
+
+#define SHT_ARM_EXIDX		(SHT_LOPROC + 1)
+#define SHT_ARM_PREEMPTMAP	(SHT_LOPROC + 2)
+#define SHT_ARM_ATTRIBUTES	(SHT_LOPROC + 3)
+
+#define R_AARCH64_NONE            0
+#define R_AARCH64_P32_ABS32	1
+#define R_AARCH64_P32_COPY	180
+#define R_AARCH64_P32_GLOB_DAT	181
+#define R_AARCH64_P32_JUMP_SLOT	182
+#define R_AARCH64_P32_RELATIVE	183
+#define R_AARCH64_P32_TLS_DTPMOD 184
+#define R_AARCH64_P32_TLS_DTPREL 185
+#define R_AARCH64_P32_TLS_TPREL	186
+#define R_AARCH64_P32_TLSDESC	187
+#define R_AARCH64_P32_IRELATIVE	188
+#define R_AARCH64_ABS64         257
+#define R_AARCH64_ABS32         258
+#define R_AARCH64_ABS16		259
+#define R_AARCH64_PREL64	260
+#define R_AARCH64_PREL32	261
+#define R_AARCH64_PREL16	262
+#define R_AARCH64_MOVW_UABS_G0	263
+#define R_AARCH64_MOVW_UABS_G0_NC 264
+#define R_AARCH64_MOVW_UABS_G1	265
+#define R_AARCH64_MOVW_UABS_G1_NC 266
+#define R_AARCH64_MOVW_UABS_G2	267
+#define R_AARCH64_MOVW_UABS_G2_NC 268
+#define R_AARCH64_MOVW_UABS_G3	269
+#define R_AARCH64_MOVW_SABS_G0	270
+#define R_AARCH64_MOVW_SABS_G1	271
+#define R_AARCH64_MOVW_SABS_G2	272
+#define R_AARCH64_LD_PREL_LO19	273
+#define R_AARCH64_ADR_PREL_LO21	274
+#define R_AARCH64_ADR_PREL_PG_HI21 275
+#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
+#define R_AARCH64_ADD_ABS_LO12_NC 277
+#define R_AARCH64_LDST8_ABS_LO12_NC 278
+#define R_AARCH64_TSTBR14	279
+#define R_AARCH64_CONDBR19	280
+#define R_AARCH64_JUMP26	282
+#define R_AARCH64_CALL26	283
+#define R_AARCH64_LDST16_ABS_LO12_NC 284
+#define R_AARCH64_LDST32_ABS_LO12_NC 285
+#define R_AARCH64_LDST64_ABS_LO12_NC 286
+#define R_AARCH64_MOVW_PREL_G0	287
+#define R_AARCH64_MOVW_PREL_G0_NC 288
+#define R_AARCH64_MOVW_PREL_G1	289
+#define R_AARCH64_MOVW_PREL_G1_NC 290
+#define R_AARCH64_MOVW_PREL_G2	291
+#define R_AARCH64_MOVW_PREL_G2_NC 292
+#define R_AARCH64_MOVW_PREL_G3	293
+#define R_AARCH64_LDST128_ABS_LO12_NC 299
+#define R_AARCH64_MOVW_GOTOFF_G0 300
+#define R_AARCH64_MOVW_GOTOFF_G0_NC 301
+#define R_AARCH64_MOVW_GOTOFF_G1 302
+#define R_AARCH64_MOVW_GOTOFF_G1_NC 303
+#define R_AARCH64_MOVW_GOTOFF_G2 304
+#define R_AARCH64_MOVW_GOTOFF_G2_NC 305
+#define R_AARCH64_MOVW_GOTOFF_G3 306
+#define R_AARCH64_GOTREL64	307
+#define R_AARCH64_GOTREL32	308
+#define R_AARCH64_GOT_LD_PREL19	309
+#define R_AARCH64_LD64_GOTOFF_LO15 310
+#define R_AARCH64_ADR_GOT_PAGE	311
+#define R_AARCH64_LD64_GOT_LO12_NC 312
+#define R_AARCH64_LD64_GOTPAGE_LO15 313
+#define R_AARCH64_TLSGD_ADR_PREL21 512
+#define R_AARCH64_TLSGD_ADR_PAGE21 513
+#define R_AARCH64_TLSGD_ADD_LO12_NC 514
+#define R_AARCH64_TLSGD_MOVW_G1	515
+#define R_AARCH64_TLSGD_MOVW_G0_NC 516
+#define R_AARCH64_TLSLD_ADR_PREL21 517
+#define R_AARCH64_TLSLD_ADR_PAGE21 518
+#define R_AARCH64_TLSLD_ADD_LO12_NC 519
+#define R_AARCH64_TLSLD_MOVW_G1	520
+#define R_AARCH64_TLSLD_MOVW_G0_NC 521
+#define R_AARCH64_TLSLD_LD_PREL19 522
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527
+#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540
+#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541
+#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542
+#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543
+#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548
+#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559
+#define R_AARCH64_TLSDESC_LD_PREL19 560
+#define R_AARCH64_TLSDESC_ADR_PREL21 561
+#define R_AARCH64_TLSDESC_ADR_PAGE21 562
+#define R_AARCH64_TLSDESC_LD64_LO12 563
+#define R_AARCH64_TLSDESC_ADD_LO12 564
+#define R_AARCH64_TLSDESC_OFF_G1 565
+#define R_AARCH64_TLSDESC_OFF_G0_NC 566
+#define R_AARCH64_TLSDESC_LDR	567
+#define R_AARCH64_TLSDESC_ADD	568
+#define R_AARCH64_TLSDESC_CALL	569
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573
+#define R_AARCH64_COPY         1024
+#define R_AARCH64_GLOB_DAT     1025
+#define R_AARCH64_JUMP_SLOT    1026
+#define R_AARCH64_RELATIVE     1027
+#define R_AARCH64_TLS_DTPMOD   1028
+#define R_AARCH64_TLS_DTPMOD64 1028
+#define R_AARCH64_TLS_DTPREL   1029
+#define R_AARCH64_TLS_DTPREL64 1029
+#define R_AARCH64_TLS_TPREL    1030
+#define R_AARCH64_TLS_TPREL64  1030
+#define R_AARCH64_TLSDESC      1031
+
+
+#define R_ARM_NONE		0
+#define R_ARM_PC24		1
+#define R_ARM_ABS32		2
+#define R_ARM_REL32		3
+#define R_ARM_PC13		4
+#define R_ARM_ABS16		5
+#define R_ARM_ABS12		6
+#define R_ARM_THM_ABS5		7
+#define R_ARM_ABS8		8
+#define R_ARM_SBREL32		9
+#define R_ARM_THM_PC22		10
+#define R_ARM_THM_PC8		11
+#define R_ARM_AMP_VCALL9	12
+#define R_ARM_TLS_DESC		13
+#define R_ARM_THM_SWI8		14
+#define R_ARM_XPC25		15
+#define R_ARM_THM_XPC22		16
+#define R_ARM_TLS_DTPMOD32	17
+#define R_ARM_TLS_DTPOFF32	18
+#define R_ARM_TLS_TPOFF32	19
+#define R_ARM_COPY		20
+#define R_ARM_GLOB_DAT		21
+#define R_ARM_JUMP_SLOT		22
+#define R_ARM_RELATIVE		23
+#define R_ARM_GOTOFF		24
+#define R_ARM_GOTPC		25
+#define R_ARM_GOT32		26
+#define R_ARM_PLT32		27
+#define R_ARM_CALL		28
+#define R_ARM_JUMP24		29
+#define R_ARM_THM_JUMP24	30
+#define R_ARM_BASE_ABS		31
+#define R_ARM_ALU_PCREL_7_0	32
+#define R_ARM_ALU_PCREL_15_8	33
+#define R_ARM_ALU_PCREL_23_15	34
+#define R_ARM_LDR_SBREL_11_0	35
+#define R_ARM_ALU_SBREL_19_12	36
+#define R_ARM_ALU_SBREL_27_20	37
+#define R_ARM_TARGET1		38
+#define R_ARM_SBREL31		39
+#define R_ARM_V4BX		40
+#define R_ARM_TARGET2		41
+#define R_ARM_PREL31		42
+#define R_ARM_MOVW_ABS_NC	43
+#define R_ARM_MOVT_ABS		44
+#define R_ARM_MOVW_PREL_NC	45
+#define R_ARM_MOVT_PREL		46
+#define R_ARM_THM_MOVW_ABS_NC	47
+#define R_ARM_THM_MOVT_ABS	48
+#define R_ARM_THM_MOVW_PREL_NC	49
+#define R_ARM_THM_MOVT_PREL	50
+#define R_ARM_THM_JUMP19	51
+#define R_ARM_THM_JUMP6		52
+#define R_ARM_THM_ALU_PREL_11_0	53
+#define R_ARM_THM_PC12		54
+#define R_ARM_ABS32_NOI		55
+#define R_ARM_REL32_NOI		56
+#define R_ARM_ALU_PC_G0_NC	57
+#define R_ARM_ALU_PC_G0		58
+#define R_ARM_ALU_PC_G1_NC	59
+#define R_ARM_ALU_PC_G1		60
+#define R_ARM_ALU_PC_G2		61
+#define R_ARM_LDR_PC_G1		62
+#define R_ARM_LDR_PC_G2		63
+#define R_ARM_LDRS_PC_G0	64
+#define R_ARM_LDRS_PC_G1	65
+#define R_ARM_LDRS_PC_G2	66
+#define R_ARM_LDC_PC_G0		67
+#define R_ARM_LDC_PC_G1		68
+#define R_ARM_LDC_PC_G2		69
+#define R_ARM_ALU_SB_G0_NC	70
+#define R_ARM_ALU_SB_G0		71
+#define R_ARM_ALU_SB_G1_NC	72
+#define R_ARM_ALU_SB_G1		73
+#define R_ARM_ALU_SB_G2		74
+#define R_ARM_LDR_SB_G0		75
+#define R_ARM_LDR_SB_G1		76
+#define R_ARM_LDR_SB_G2		77
+#define R_ARM_LDRS_SB_G0	78
+#define R_ARM_LDRS_SB_G1	79
+#define R_ARM_LDRS_SB_G2	80
+#define R_ARM_LDC_SB_G0		81
+#define R_ARM_LDC_SB_G1		82
+#define R_ARM_LDC_SB_G2		83
+#define R_ARM_MOVW_BREL_NC	84
+#define R_ARM_MOVT_BREL		85
+#define R_ARM_MOVW_BREL		86
+#define R_ARM_THM_MOVW_BREL_NC	87
+#define R_ARM_THM_MOVT_BREL	88
+#define R_ARM_THM_MOVW_BREL	89
+#define R_ARM_TLS_GOTDESC	90
+#define R_ARM_TLS_CALL		91
+#define R_ARM_TLS_DESCSEQ	92
+#define R_ARM_THM_TLS_CALL	93
+#define R_ARM_PLT32_ABS		94
+#define R_ARM_GOT_ABS		95
+#define R_ARM_GOT_PREL		96
+#define R_ARM_GOT_BREL12	97
+#define R_ARM_GOTOFF12		98
+#define R_ARM_GOTRELAX		99
+#define R_ARM_GNU_VTENTRY	100
+#define R_ARM_GNU_VTINHERIT	101
+#define R_ARM_THM_PC11		102
+#define R_ARM_THM_PC9		103
+#define R_ARM_TLS_GD32		104
+
+#define R_ARM_TLS_LDM32		105
+
+#define R_ARM_TLS_LDO32		106
+
+#define R_ARM_TLS_IE32		107
+
+#define R_ARM_TLS_LE32		108
+#define R_ARM_TLS_LDO12		109
+#define R_ARM_TLS_LE12		110
+#define R_ARM_TLS_IE12GP	111
+#define R_ARM_ME_TOO		128
+#define R_ARM_THM_TLS_DESCSEQ	129
+#define R_ARM_THM_TLS_DESCSEQ16	129
+#define R_ARM_THM_TLS_DESCSEQ32	130
+#define R_ARM_THM_GOT_BREL12	131
+#define R_ARM_IRELATIVE		160
+#define R_ARM_RXPC25		249
+#define R_ARM_RSBREL32		250
+#define R_ARM_THM_RPC22		251
+#define R_ARM_RREL32		252
+#define R_ARM_RABS22		253
+#define R_ARM_RPC24		254
+#define R_ARM_RBASE		255
+
+#define R_ARM_NUM		256
+
+
+#define R_CKCORE_NONE               0
+#define R_CKCORE_ADDR32             1
+#define R_CKCORE_PCRELIMM8BY4       2
+#define R_CKCORE_PCRELIMM11BY2      3
+#define R_CKCORE_PCREL32            5
+#define R_CKCORE_PCRELJSR_IMM11BY2  6
+#define R_CKCORE_RELATIVE           9
+#define R_CKCORE_COPY               10
+#define R_CKCORE_GLOB_DAT           11
+#define R_CKCORE_JUMP_SLOT          12
+#define R_CKCORE_GOTOFF             13
+#define R_CKCORE_GOTPC              14
+#define R_CKCORE_GOT32              15
+#define R_CKCORE_PLT32              16
+#define R_CKCORE_ADDRGOT            17
+#define R_CKCORE_ADDRPLT            18
+#define R_CKCORE_PCREL_IMM26BY2     19
+#define R_CKCORE_PCREL_IMM16BY2     20
+#define R_CKCORE_PCREL_IMM16BY4     21
+#define R_CKCORE_PCREL_IMM10BY2     22
+#define R_CKCORE_PCREL_IMM10BY4     23
+#define R_CKCORE_ADDR_HI16          24
+#define R_CKCORE_ADDR_LO16          25
+#define R_CKCORE_GOTPC_HI16         26
+#define R_CKCORE_GOTPC_LO16         27
+#define R_CKCORE_GOTOFF_HI16        28
+#define R_CKCORE_GOTOFF_LO16        29
+#define R_CKCORE_GOT12              30
+#define R_CKCORE_GOT_HI16           31
+#define R_CKCORE_GOT_LO16           32
+#define R_CKCORE_PLT12              33
+#define R_CKCORE_PLT_HI16           34
+#define R_CKCORE_PLT_LO16           35
+#define R_CKCORE_ADDRGOT_HI16       36
+#define R_CKCORE_ADDRGOT_LO16       37
+#define R_CKCORE_ADDRPLT_HI16       38
+#define R_CKCORE_ADDRPLT_LO16       39
+#define R_CKCORE_PCREL_JSR_IMM26BY2 40
+#define R_CKCORE_TOFFSET_LO16       41
+#define R_CKCORE_DOFFSET_LO16       42
+#define R_CKCORE_PCREL_IMM18BY2     43
+#define R_CKCORE_DOFFSET_IMM18      44
+#define R_CKCORE_DOFFSET_IMM18BY2   45
+#define R_CKCORE_DOFFSET_IMM18BY4   46
+#define R_CKCORE_GOT_IMM18BY4       48
+#define R_CKCORE_PLT_IMM18BY4       49
+#define R_CKCORE_PCREL_IMM7BY4      50
+#define R_CKCORE_TLS_LE32           51
+#define R_CKCORE_TLS_IE32           52
+#define R_CKCORE_TLS_GD32           53
+#define R_CKCORE_TLS_LDM32          54
+#define R_CKCORE_TLS_LDO32          55
+#define R_CKCORE_TLS_DTPMOD32       56
+#define R_CKCORE_TLS_DTPOFF32       57
+#define R_CKCORE_TLS_TPOFF32        58
+
+
+#define EF_IA_64_MASKOS		0x0000000f
+#define EF_IA_64_ABI64		0x00000010
+#define EF_IA_64_ARCH		0xff000000
+
+
+#define PT_IA_64_ARCHEXT	(PT_LOPROC + 0)
+#define PT_IA_64_UNWIND		(PT_LOPROC + 1)
+#define PT_IA_64_HP_OPT_ANOT	(PT_LOOS + 0x12)
+#define PT_IA_64_HP_HSL_ANOT	(PT_LOOS + 0x13)
+#define PT_IA_64_HP_STACK	(PT_LOOS + 0x14)
+
+
+#define PF_IA_64_NORECOV	0x80000000
+
+
+#define SHT_IA_64_EXT		(SHT_LOPROC + 0)
+#define SHT_IA_64_UNWIND	(SHT_LOPROC + 1)
+
+
+#define SHF_IA_64_SHORT		0x10000000
+#define SHF_IA_64_NORECOV	0x20000000
+
+
+#define DT_IA_64_PLT_RESERVE	(DT_LOPROC + 0)
+#define DT_IA_64_NUM		1
+
+
+#define R_IA64_NONE		0x00
+#define R_IA64_IMM14		0x21
+#define R_IA64_IMM22		0x22
+#define R_IA64_IMM64		0x23
+#define R_IA64_DIR32MSB		0x24
+#define R_IA64_DIR32LSB		0x25
+#define R_IA64_DIR64MSB		0x26
+#define R_IA64_DIR64LSB		0x27
+#define R_IA64_GPREL22		0x2a
+#define R_IA64_GPREL64I		0x2b
+#define R_IA64_GPREL32MSB	0x2c
+#define R_IA64_GPREL32LSB	0x2d
+#define R_IA64_GPREL64MSB	0x2e
+#define R_IA64_GPREL64LSB	0x2f
+#define R_IA64_LTOFF22		0x32
+#define R_IA64_LTOFF64I		0x33
+#define R_IA64_PLTOFF22		0x3a
+#define R_IA64_PLTOFF64I	0x3b
+#define R_IA64_PLTOFF64MSB	0x3e
+#define R_IA64_PLTOFF64LSB	0x3f
+#define R_IA64_FPTR64I		0x43
+#define R_IA64_FPTR32MSB	0x44
+#define R_IA64_FPTR32LSB	0x45
+#define R_IA64_FPTR64MSB	0x46
+#define R_IA64_FPTR64LSB	0x47
+#define R_IA64_PCREL60B		0x48
+#define R_IA64_PCREL21B		0x49
+#define R_IA64_PCREL21M		0x4a
+#define R_IA64_PCREL21F		0x4b
+#define R_IA64_PCREL32MSB	0x4c
+#define R_IA64_PCREL32LSB	0x4d
+#define R_IA64_PCREL64MSB	0x4e
+#define R_IA64_PCREL64LSB	0x4f
+#define R_IA64_LTOFF_FPTR22	0x52
+#define R_IA64_LTOFF_FPTR64I	0x53
+#define R_IA64_LTOFF_FPTR32MSB	0x54
+#define R_IA64_LTOFF_FPTR32LSB	0x55
+#define R_IA64_LTOFF_FPTR64MSB	0x56
+#define R_IA64_LTOFF_FPTR64LSB	0x57
+#define R_IA64_SEGREL32MSB	0x5c
+#define R_IA64_SEGREL32LSB	0x5d
+#define R_IA64_SEGREL64MSB	0x5e
+#define R_IA64_SEGREL64LSB	0x5f
+#define R_IA64_SECREL32MSB	0x64
+#define R_IA64_SECREL32LSB	0x65
+#define R_IA64_SECREL64MSB	0x66
+#define R_IA64_SECREL64LSB	0x67
+#define R_IA64_REL32MSB		0x6c
+#define R_IA64_REL32LSB		0x6d
+#define R_IA64_REL64MSB		0x6e
+#define R_IA64_REL64LSB		0x6f
+#define R_IA64_LTV32MSB		0x74
+#define R_IA64_LTV32LSB		0x75
+#define R_IA64_LTV64MSB		0x76
+#define R_IA64_LTV64LSB		0x77
+#define R_IA64_PCREL21BI	0x79
+#define R_IA64_PCREL22		0x7a
+#define R_IA64_PCREL64I		0x7b
+#define R_IA64_IPLTMSB		0x80
+#define R_IA64_IPLTLSB		0x81
+#define R_IA64_COPY		0x84
+#define R_IA64_SUB		0x85
+#define R_IA64_LTOFF22X		0x86
+#define R_IA64_LDXMOV		0x87
+#define R_IA64_TPREL14		0x91
+#define R_IA64_TPREL22		0x92
+#define R_IA64_TPREL64I		0x93
+#define R_IA64_TPREL64MSB	0x96
+#define R_IA64_TPREL64LSB	0x97
+#define R_IA64_LTOFF_TPREL22	0x9a
+#define R_IA64_DTPMOD64MSB	0xa6
+#define R_IA64_DTPMOD64LSB	0xa7
+#define R_IA64_LTOFF_DTPMOD22	0xaa
+#define R_IA64_DTPREL14		0xb1
+#define R_IA64_DTPREL22		0xb2
+#define R_IA64_DTPREL64I	0xb3
+#define R_IA64_DTPREL32MSB	0xb4
+#define R_IA64_DTPREL32LSB	0xb5
+#define R_IA64_DTPREL64MSB	0xb6
+#define R_IA64_DTPREL64LSB	0xb7
+#define R_IA64_LTOFF_DTPREL22	0xba
+
+
+#define EF_SH_MACH_MASK		0x1f
+#define EF_SH_UNKNOWN		0x0
+#define EF_SH1			0x1
+#define EF_SH2			0x2
+#define EF_SH3			0x3
+#define EF_SH_DSP		0x4
+#define EF_SH3_DSP		0x5
+#define EF_SH4AL_DSP		0x6
+#define EF_SH3E			0x8
+#define EF_SH4			0x9
+#define EF_SH2E			0xb
+#define EF_SH4A			0xc
+#define EF_SH2A			0xd
+#define EF_SH4_NOFPU		0x10
+#define EF_SH4A_NOFPU		0x11
+#define EF_SH4_NOMMU_NOFPU	0x12
+#define EF_SH2A_NOFPU		0x13
+#define EF_SH3_NOMMU		0x14
+#define EF_SH2A_SH4_NOFPU	0x15
+#define EF_SH2A_SH3_NOFPU	0x16
+#define EF_SH2A_SH4		0x17
+#define EF_SH2A_SH3E		0x18
+
+#define	R_SH_NONE		0
+#define	R_SH_DIR32		1
+#define	R_SH_REL32		2
+#define	R_SH_DIR8WPN		3
+#define	R_SH_IND12W		4
+#define	R_SH_DIR8WPL		5
+#define	R_SH_DIR8WPZ		6
+#define	R_SH_DIR8BP		7
+#define	R_SH_DIR8W		8
+#define	R_SH_DIR8L		9
+#define	R_SH_SWITCH16		25
+#define	R_SH_SWITCH32		26
+#define	R_SH_USES		27
+#define	R_SH_COUNT		28
+#define	R_SH_ALIGN		29
+#define	R_SH_CODE		30
+#define	R_SH_DATA		31
+#define	R_SH_LABEL		32
+#define	R_SH_SWITCH8		33
+#define	R_SH_GNU_VTINHERIT	34
+#define	R_SH_GNU_VTENTRY	35
+#define	R_SH_TLS_GD_32		144
+#define	R_SH_TLS_LD_32		145
+#define	R_SH_TLS_LDO_32		146
+#define	R_SH_TLS_IE_32		147
+#define	R_SH_TLS_LE_32		148
+#define	R_SH_TLS_DTPMOD32	149
+#define	R_SH_TLS_DTPOFF32	150
+#define	R_SH_TLS_TPOFF32	151
+#define	R_SH_GOT32		160
+#define	R_SH_PLT32		161
+#define	R_SH_COPY		162
+#define	R_SH_GLOB_DAT		163
+#define	R_SH_JMP_SLOT		164
+#define	R_SH_RELATIVE		165
+#define	R_SH_GOTOFF		166
+#define	R_SH_GOTPC		167
+#define	R_SH_GOT20		201
+#define	R_SH_GOTOFF20		202
+#define	R_SH_GOTFUNCDESC	203
+#define	R_SH_GOTFUNCDEST20	204
+#define	R_SH_GOTOFFFUNCDESC	205
+#define	R_SH_GOTOFFFUNCDEST20	206
+#define	R_SH_FUNCDESC		207
+#define	R_SH_FUNCDESC_VALUE	208
+
+#define	R_SH_NUM		256
+
+
+
+#define R_390_NONE		0
+#define R_390_8			1
+#define R_390_12		2
+#define R_390_16		3
+#define R_390_32		4
+#define R_390_PC32		5
+#define R_390_GOT12		6
+#define R_390_GOT32		7
+#define R_390_PLT32		8
+#define R_390_COPY		9
+#define R_390_GLOB_DAT		10
+#define R_390_JMP_SLOT		11
+#define R_390_RELATIVE		12
+#define R_390_GOTOFF32		13
+#define R_390_GOTPC		14
+#define R_390_GOT16		15
+#define R_390_PC16		16
+#define R_390_PC16DBL		17
+#define R_390_PLT16DBL		18
+#define R_390_PC32DBL		19
+#define R_390_PLT32DBL		20
+#define R_390_GOTPCDBL		21
+#define R_390_64		22
+#define R_390_PC64		23
+#define R_390_GOT64		24
+#define R_390_PLT64		25
+#define R_390_GOTENT		26
+#define R_390_GOTOFF16		27
+#define R_390_GOTOFF64		28
+#define R_390_GOTPLT12		29
+#define R_390_GOTPLT16		30
+#define R_390_GOTPLT32		31
+#define R_390_GOTPLT64		32
+#define R_390_GOTPLTENT		33
+#define R_390_PLTOFF16		34
+#define R_390_PLTOFF32		35
+#define R_390_PLTOFF64		36
+#define R_390_TLS_LOAD		37
+#define R_390_TLS_GDCALL	38
+
+#define R_390_TLS_LDCALL	39
+
+#define R_390_TLS_GD32		40
+
+#define R_390_TLS_GD64		41
+
+#define R_390_TLS_GOTIE12	42
+
+#define R_390_TLS_GOTIE32	43
+
+#define R_390_TLS_GOTIE64	44
+
+#define R_390_TLS_LDM32		45
+
+#define R_390_TLS_LDM64		46
+
+#define R_390_TLS_IE32		47
+
+#define R_390_TLS_IE64		48
+
+#define R_390_TLS_IEENT		49
+
+#define R_390_TLS_LE32		50
+
+#define R_390_TLS_LE64		51
+
+#define R_390_TLS_LDO32		52
+
+#define R_390_TLS_LDO64		53
+
+#define R_390_TLS_DTPMOD	54
+#define R_390_TLS_DTPOFF	55
+#define R_390_TLS_TPOFF		56
+
+#define R_390_20		57
+#define R_390_GOT20		58
+#define R_390_GOTPLT20		59
+#define R_390_TLS_GOTIE20	60
+
+
+#define R_390_NUM		61
+
+
+
+#define R_CRIS_NONE		0
+#define R_CRIS_8		1
+#define R_CRIS_16		2
+#define R_CRIS_32		3
+#define R_CRIS_8_PCREL		4
+#define R_CRIS_16_PCREL		5
+#define R_CRIS_32_PCREL		6
+#define R_CRIS_GNU_VTINHERIT	7
+#define R_CRIS_GNU_VTENTRY	8
+#define R_CRIS_COPY		9
+#define R_CRIS_GLOB_DAT		10
+#define R_CRIS_JUMP_SLOT	11
+#define R_CRIS_RELATIVE		12
+#define R_CRIS_16_GOT		13
+#define R_CRIS_32_GOT		14
+#define R_CRIS_16_GOTPLT	15
+#define R_CRIS_32_GOTPLT	16
+#define R_CRIS_32_GOTREL	17
+#define R_CRIS_32_PLT_GOTREL	18
+#define R_CRIS_32_PLT_PCREL	19
+
+#define R_CRIS_NUM		20
+
+
+
+#define R_X86_64_NONE		0
+#define R_X86_64_64		1
+#define R_X86_64_PC32		2
+#define R_X86_64_GOT32		3
+#define R_X86_64_PLT32		4
+#define R_X86_64_COPY		5
+#define R_X86_64_GLOB_DAT	6
+#define R_X86_64_JUMP_SLOT	7
+#define R_X86_64_RELATIVE	8
+#define R_X86_64_GOTPCREL	9
+
+#define R_X86_64_32		10
+#define R_X86_64_32S		11
+#define R_X86_64_16		12
+#define R_X86_64_PC16		13
+#define R_X86_64_8		14
+#define R_X86_64_PC8		15
+#define R_X86_64_DTPMOD64	16
+#define R_X86_64_DTPOFF64	17
+#define R_X86_64_TPOFF64	18
+#define R_X86_64_TLSGD		19
+
+#define R_X86_64_TLSLD		20
+
+#define R_X86_64_DTPOFF32	21
+#define R_X86_64_GOTTPOFF	22
+
+#define R_X86_64_TPOFF32	23
+#define R_X86_64_PC64		24
+#define R_X86_64_GOTOFF64	25
+#define R_X86_64_GOTPC32	26
+#define R_X86_64_GOT64		27
+#define R_X86_64_GOTPCREL64	28
+#define R_X86_64_GOTPC64	29
+#define R_X86_64_GOTPLT64	30
+#define R_X86_64_PLTOFF64	31
+#define R_X86_64_SIZE32		32
+#define R_X86_64_SIZE64		33
+
+#define R_X86_64_GOTPC32_TLSDESC 34
+#define R_X86_64_TLSDESC_CALL   35
+
+#define R_X86_64_TLSDESC        36
+#define R_X86_64_IRELATIVE	37
+#define R_X86_64_RELATIVE64	38
+#define R_X86_64_GOTPCRELX	41
+#define R_X86_64_REX_GOTPCRELX	42
+#define R_X86_64_NUM		43
+
+
+
+#define R_MN10300_NONE		0
+#define R_MN10300_32		1
+#define R_MN10300_16		2
+#define R_MN10300_8		3
+#define R_MN10300_PCREL32	4
+#define R_MN10300_PCREL16	5
+#define R_MN10300_PCREL8	6
+#define R_MN10300_GNU_VTINHERIT	7
+#define R_MN10300_GNU_VTENTRY	8
+#define R_MN10300_24		9
+#define R_MN10300_GOTPC32	10
+#define R_MN10300_GOTPC16	11
+#define R_MN10300_GOTOFF32	12
+#define R_MN10300_GOTOFF24	13
+#define R_MN10300_GOTOFF16	14
+#define R_MN10300_PLT32		15
+#define R_MN10300_PLT16		16
+#define R_MN10300_GOT32		17
+#define R_MN10300_GOT24		18
+#define R_MN10300_GOT16		19
+#define R_MN10300_COPY		20
+#define R_MN10300_GLOB_DAT	21
+#define R_MN10300_JMP_SLOT	22
+#define R_MN10300_RELATIVE	23
+
+#define R_MN10300_NUM		24
+
+
+
+#define R_M32R_NONE		0
+#define R_M32R_16		1
+#define R_M32R_32		2
+#define R_M32R_24		3
+#define R_M32R_10_PCREL		4
+#define R_M32R_18_PCREL		5
+#define R_M32R_26_PCREL		6
+#define R_M32R_HI16_ULO		7
+#define R_M32R_HI16_SLO		8
+#define R_M32R_LO16		9
+#define R_M32R_SDA16		10
+#define R_M32R_GNU_VTINHERIT	11
+#define R_M32R_GNU_VTENTRY	12
+
+#define R_M32R_16_RELA		33
+#define R_M32R_32_RELA		34
+#define R_M32R_24_RELA		35
+#define R_M32R_10_PCREL_RELA	36
+#define R_M32R_18_PCREL_RELA	37
+#define R_M32R_26_PCREL_RELA	38
+#define R_M32R_HI16_ULO_RELA	39
+#define R_M32R_HI16_SLO_RELA	40
+#define R_M32R_LO16_RELA	41
+#define R_M32R_SDA16_RELA	42
+#define R_M32R_RELA_GNU_VTINHERIT	43
+#define R_M32R_RELA_GNU_VTENTRY	44
+#define R_M32R_REL32		45
+
+#define R_M32R_GOT24		48
+#define R_M32R_26_PLTREL	49
+#define R_M32R_COPY		50
+#define R_M32R_GLOB_DAT		51
+#define R_M32R_JMP_SLOT		52
+#define R_M32R_RELATIVE		53
+#define R_M32R_GOTOFF		54
+#define R_M32R_GOTPC24		55
+#define R_M32R_GOT16_HI_ULO	56
+
+#define R_M32R_GOT16_HI_SLO	57
+
+#define R_M32R_GOT16_LO		58
+#define R_M32R_GOTPC_HI_ULO	59
+
+#define R_M32R_GOTPC_HI_SLO	60
+
+#define R_M32R_GOTPC_LO		61
+
+#define R_M32R_GOTOFF_HI_ULO	62
+
+#define R_M32R_GOTOFF_HI_SLO	63
+
+#define R_M32R_GOTOFF_LO	64
+#define R_M32R_NUM		256
+
+#define R_MICROBLAZE_NONE 0
+#define R_MICROBLAZE_32 1
+#define R_MICROBLAZE_32_PCREL 2
+#define R_MICROBLAZE_64_PCREL 3
+#define R_MICROBLAZE_32_PCREL_LO 4
+#define R_MICROBLAZE_64 5
+#define R_MICROBLAZE_32_LO 6
+#define R_MICROBLAZE_SRO32 7
+#define R_MICROBLAZE_SRW32 8
+#define R_MICROBLAZE_64_NONE 9
+#define R_MICROBLAZE_32_SYM_OP_SYM 10
+#define R_MICROBLAZE_GNU_VTINHERIT 11
+#define R_MICROBLAZE_GNU_VTENTRY 12
+#define R_MICROBLAZE_GOTPC_64 13
+#define R_MICROBLAZE_GOT_64 14
+#define R_MICROBLAZE_PLT_64 15
+#define R_MICROBLAZE_REL 16
+#define R_MICROBLAZE_JUMP_SLOT 17
+#define R_MICROBLAZE_GLOB_DAT 18
+#define R_MICROBLAZE_GOTOFF_64 19
+#define R_MICROBLAZE_GOTOFF_32 20
+#define R_MICROBLAZE_COPY 21
+#define R_MICROBLAZE_TLS 22
+#define R_MICROBLAZE_TLSGD 23
+#define R_MICROBLAZE_TLSLD 24
+#define R_MICROBLAZE_TLSDTPMOD32 25
+#define R_MICROBLAZE_TLSDTPREL32 26
+#define R_MICROBLAZE_TLSDTPREL64 27
+#define R_MICROBLAZE_TLSGOTTPREL32 28
+#define R_MICROBLAZE_TLSTPREL32	 29
+
+#define DT_NIOS2_GP             0x70000002
+
+#define R_NIOS2_NONE		0
+#define R_NIOS2_S16		1
+#define R_NIOS2_U16		2
+#define R_NIOS2_PCREL16		3
+#define R_NIOS2_CALL26		4
+#define R_NIOS2_IMM5		5
+#define R_NIOS2_CACHE_OPX	6
+#define R_NIOS2_IMM6		7
+#define R_NIOS2_IMM8		8
+#define R_NIOS2_HI16		9
+#define R_NIOS2_LO16		10
+#define R_NIOS2_HIADJ16		11
+#define R_NIOS2_BFD_RELOC_32	12
+#define R_NIOS2_BFD_RELOC_16	13
+#define R_NIOS2_BFD_RELOC_8	14
+#define R_NIOS2_GPREL		15
+#define R_NIOS2_GNU_VTINHERIT	16
+#define R_NIOS2_GNU_VTENTRY	17
+#define R_NIOS2_UJMP		18
+#define R_NIOS2_CJMP		19
+#define R_NIOS2_CALLR		20
+#define R_NIOS2_ALIGN		21
+#define R_NIOS2_GOT16		22
+#define R_NIOS2_CALL16		23
+#define R_NIOS2_GOTOFF_LO	24
+#define R_NIOS2_GOTOFF_HA	25
+#define R_NIOS2_PCREL_LO	26
+#define R_NIOS2_PCREL_HA	27
+#define R_NIOS2_TLS_GD16	28
+#define R_NIOS2_TLS_LDM16	29
+#define R_NIOS2_TLS_LDO16	30
+#define R_NIOS2_TLS_IE16	31
+#define R_NIOS2_TLS_LE16	32
+#define R_NIOS2_TLS_DTPMOD	33
+#define R_NIOS2_TLS_DTPREL	34
+#define R_NIOS2_TLS_TPREL	35
+#define R_NIOS2_COPY		36
+#define R_NIOS2_GLOB_DAT	37
+#define R_NIOS2_JUMP_SLOT	38
+#define R_NIOS2_RELATIVE	39
+#define R_NIOS2_GOTOFF		40
+#define R_NIOS2_CALL26_NOAT	41
+#define R_NIOS2_GOT_LO		42
+#define R_NIOS2_GOT_HA		43
+#define R_NIOS2_CALL_LO		44
+#define R_NIOS2_CALL_HA		45
+
+#define R_OR1K_NONE		0
+#define R_OR1K_32		1
+#define R_OR1K_16		2
+#define R_OR1K_8		3
+#define R_OR1K_LO_16_IN_INSN	4
+#define R_OR1K_HI_16_IN_INSN	5
+#define R_OR1K_INSN_REL_26	6
+#define R_OR1K_GNU_VTENTRY	7
+#define R_OR1K_GNU_VTINHERIT	8
+#define R_OR1K_32_PCREL		9
+#define R_OR1K_16_PCREL		10
+#define R_OR1K_8_PCREL		11
+#define R_OR1K_GOTPC_HI16	12
+#define R_OR1K_GOTPC_LO16	13
+#define R_OR1K_GOT16		14
+#define R_OR1K_PLT26		15
+#define R_OR1K_GOTOFF_HI16	16
+#define R_OR1K_GOTOFF_LO16	17
+#define R_OR1K_COPY		18
+#define R_OR1K_GLOB_DAT		19
+#define R_OR1K_JMP_SLOT		20
+#define R_OR1K_RELATIVE		21
+#define R_OR1K_TLS_GD_HI16	22
+#define R_OR1K_TLS_GD_LO16	23
+#define R_OR1K_TLS_LDM_HI16	24
+#define R_OR1K_TLS_LDM_LO16	25
+#define R_OR1K_TLS_LDO_HI16	26
+#define R_OR1K_TLS_LDO_LO16	27
+#define R_OR1K_TLS_IE_HI16	28
+#define R_OR1K_TLS_IE_LO16	29
+#define R_OR1K_TLS_LE_HI16	30
+#define R_OR1K_TLS_LE_LO16	31
+#define R_OR1K_TLS_TPOFF	32
+#define R_OR1K_TLS_DTPOFF	33
+#define R_OR1K_TLS_DTPMOD	34
+
+#define R_BPF_NONE		0
+#define R_BPF_MAP_FD		1
+
+#define R_RISCV_NONE            0
+#define R_RISCV_32              1
+#define R_RISCV_64              2
+#define R_RISCV_RELATIVE        3
+#define R_RISCV_COPY            4
+#define R_RISCV_JUMP_SLOT       5
+#define R_RISCV_TLS_DTPMOD32    6
+#define R_RISCV_TLS_DTPMOD64    7
+#define R_RISCV_TLS_DTPREL32    8
+#define R_RISCV_TLS_DTPREL64    9
+#define R_RISCV_TLS_TPREL32     10
+#define R_RISCV_TLS_TPREL64     11
+#define R_RISCV_TLSDESC         12
+
+#define R_RISCV_BRANCH          16
+#define R_RISCV_JAL             17
+#define R_RISCV_CALL            18
+#define R_RISCV_CALL_PLT        19
+#define R_RISCV_GOT_HI20        20
+#define R_RISCV_TLS_GOT_HI20    21
+#define R_RISCV_TLS_GD_HI20     22
+#define R_RISCV_PCREL_HI20      23
+#define R_RISCV_PCREL_LO12_I    24
+#define R_RISCV_PCREL_LO12_S    25
+#define R_RISCV_HI20            26
+#define R_RISCV_LO12_I          27
+#define R_RISCV_LO12_S          28
+#define R_RISCV_TPREL_HI20      29
+#define R_RISCV_TPREL_LO12_I    30
+#define R_RISCV_TPREL_LO12_S    31
+#define R_RISCV_TPREL_ADD       32
+#define R_RISCV_ADD8            33
+#define R_RISCV_ADD16           34
+#define R_RISCV_ADD32           35
+#define R_RISCV_ADD64           36
+#define R_RISCV_SUB8            37
+#define R_RISCV_SUB16           38
+#define R_RISCV_SUB32           39
+#define R_RISCV_SUB64           40
+#define R_RISCV_GOT32_PCREL     41
+#define R_RISCV_ALIGN           43
+#define R_RISCV_RVC_BRANCH      44
+#define R_RISCV_RVC_JUMP        45
+#define R_RISCV_RVC_LUI         46
+#define R_RISCV_RELAX           51
+#define R_RISCV_SUB6            52
+#define R_RISCV_SET6            53
+#define R_RISCV_SET8            54
+#define R_RISCV_SET16           55
+#define R_RISCV_SET32           56
+#define R_RISCV_32_PCREL        57
+#define R_RISCV_IRELATIVE       58
+#define R_RISCV_PLT32           59
+#define R_RISCV_SET_ULEB128     60
+#define R_RISCV_SUB_ULEB128     61
+#define R_RISCV_TLSDESC_HI20    62
+#define R_RISCV_TLSDESC_LOAD_LO12 63
+#define R_RISCV_TLSDESC_ADD_LO12  64
+#define R_RISCV_TLSDESC_CALL    65
+
+#define EF_LARCH_ABI_MODIFIER_MASK    0x07
+#define EF_LARCH_ABI_SOFT_FLOAT       0x01
+#define EF_LARCH_ABI_SINGLE_FLOAT     0x02
+#define EF_LARCH_ABI_DOUBLE_FLOAT     0x03
+#define EF_LARCH_OBJABI_V1            0x40
+
+#define R_LARCH_NONE                        0
+#define R_LARCH_32                          1
+#define R_LARCH_64                          2
+#define R_LARCH_RELATIVE                    3
+#define R_LARCH_COPY                        4
+#define R_LARCH_JUMP_SLOT                   5
+#define R_LARCH_TLS_DTPMOD32                6
+#define R_LARCH_TLS_DTPMOD64                7
+#define R_LARCH_TLS_DTPREL32                8
+#define R_LARCH_TLS_DTPREL64                9
+#define R_LARCH_TLS_TPREL32                 10
+#define R_LARCH_TLS_TPREL64                 11
+#define R_LARCH_IRELATIVE                   12
+#define R_LARCH_MARK_LA                     20
+#define R_LARCH_MARK_PCREL                  21
+#define R_LARCH_SOP_PUSH_PCREL              22
+#define R_LARCH_SOP_PUSH_ABSOLUTE           23
+#define R_LARCH_SOP_PUSH_DUP                24
+#define R_LARCH_SOP_PUSH_GPREL              25
+#define R_LARCH_SOP_PUSH_TLS_TPREL          26
+#define R_LARCH_SOP_PUSH_TLS_GOT            27
+#define R_LARCH_SOP_PUSH_TLS_GD             28
+#define R_LARCH_SOP_PUSH_PLT_PCREL          29
+#define R_LARCH_SOP_ASSERT                  30
+#define R_LARCH_SOP_NOT                     31
+#define R_LARCH_SOP_SUB                     32
+#define R_LARCH_SOP_SL                      33
+#define R_LARCH_SOP_SR                      34
+#define R_LARCH_SOP_ADD                     35
+#define R_LARCH_SOP_AND                     36
+#define R_LARCH_SOP_IF_ELSE                 37
+#define R_LARCH_SOP_POP_32_S_10_5           38
+#define R_LARCH_SOP_POP_32_U_10_12          39
+#define R_LARCH_SOP_POP_32_S_10_12          40
+#define R_LARCH_SOP_POP_32_S_10_16          41
+#define R_LARCH_SOP_POP_32_S_10_16_S2       42
+#define R_LARCH_SOP_POP_32_S_5_20           43
+#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2   44
+#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2  45
+#define R_LARCH_SOP_POP_32_U                46
+#define R_LARCH_ADD8                        47
+#define R_LARCH_ADD16                       48
+#define R_LARCH_ADD24                       49
+#define R_LARCH_ADD32                       50
+#define R_LARCH_ADD64                       51
+#define R_LARCH_SUB8                        52
+#define R_LARCH_SUB16                       53
+#define R_LARCH_SUB24                       54
+#define R_LARCH_SUB32                       55
+#define R_LARCH_SUB64                       56
+#define R_LARCH_GNU_VTINHERIT               57
+#define R_LARCH_GNU_VTENTRY                 58
+#define R_LARCH_B16                         64
+#define R_LARCH_B21                         65
+#define R_LARCH_B26                         66
+#define R_LARCH_ABS_HI20                    67
+#define R_LARCH_ABS_LO12                    68
+#define R_LARCH_ABS64_LO20                  69
+#define R_LARCH_ABS64_HI12                  70
+#define R_LARCH_PCALA_HI20                  71
+#define R_LARCH_PCALA_LO12                  72
+#define R_LARCH_PCALA64_LO20                73
+#define R_LARCH_PCALA64_HI12                74
+#define R_LARCH_GOT_PC_HI20                 75
+#define R_LARCH_GOT_PC_LO12                 76
+#define R_LARCH_GOT64_PC_LO20               77
+#define R_LARCH_GOT64_PC_HI12               78
+#define R_LARCH_GOT_HI20                    79
+#define R_LARCH_GOT_LO12                    80
+#define R_LARCH_GOT64_LO20                  81
+#define R_LARCH_GOT64_HI12                  82
+#define R_LARCH_TLS_LE_HI20                 83
+#define R_LARCH_TLS_LE_LO12                 84
+#define R_LARCH_TLS_LE64_LO20               85
+#define R_LARCH_TLS_LE64_HI12               86
+#define R_LARCH_TLS_IE_PC_HI20              87
+#define R_LARCH_TLS_IE_PC_LO12              88
+#define R_LARCH_TLS_IE64_PC_LO20            89
+#define R_LARCH_TLS_IE64_PC_HI12            90
+#define R_LARCH_TLS_IE_HI20                 91
+#define R_LARCH_TLS_IE_LO12                 92
+#define R_LARCH_TLS_IE64_LO20               93
+#define R_LARCH_TLS_IE64_HI12               94
+#define R_LARCH_TLS_LD_PC_HI20              95
+#define R_LARCH_TLS_LD_HI20                 96
+#define R_LARCH_TLS_GD_PC_HI20              97
+#define R_LARCH_TLS_GD_HI20                 98
+#define R_LARCH_32_PCREL                    99
+#define R_LARCH_RELAX                       100
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/musl-include/arm/endian.h b/musl-include/arm/endian.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/endian.h
@@ -0,0 +1,80 @@
+#ifndef _ENDIAN_H
+#define _ENDIAN_H
+
+#include <features.h>
+
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#include <bits/alltypes.h>
+
+#define __PDP_ENDIAN 3412
+
+#define BIG_ENDIAN __BIG_ENDIAN
+#define LITTLE_ENDIAN __LITTLE_ENDIAN
+#define PDP_ENDIAN __PDP_ENDIAN
+#define BYTE_ORDER __BYTE_ORDER
+
+static __inline uint16_t __bswap16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap64(uint64_t __x)
+{
+	return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
+}
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define htobe16(x) __bswap16(x)
+#define be16toh(x) __bswap16(x)
+#define htobe32(x) __bswap32(x)
+#define be32toh(x) __bswap32(x)
+#define htobe64(x) __bswap64(x)
+#define be64toh(x) __bswap64(x)
+#define htole16(x) (uint16_t)(x)
+#define le16toh(x) (uint16_t)(x)
+#define htole32(x) (uint32_t)(x)
+#define le32toh(x) (uint32_t)(x)
+#define htole64(x) (uint64_t)(x)
+#define le64toh(x) (uint64_t)(x)
+#else
+#define htobe16(x) (uint16_t)(x)
+#define be16toh(x) (uint16_t)(x)
+#define htobe32(x) (uint32_t)(x)
+#define be32toh(x) (uint32_t)(x)
+#define htobe64(x) (uint64_t)(x)
+#define be64toh(x) (uint64_t)(x)
+#define htole16(x) __bswap16(x)
+#define le16toh(x) __bswap16(x)
+#define htole32(x) __bswap32(x)
+#define le32toh(x) __bswap32(x)
+#define htole64(x) __bswap64(x)
+#define le64toh(x) __bswap64(x)
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define betoh16(x) __bswap16(x)
+#define betoh32(x) __bswap32(x)
+#define betoh64(x) __bswap64(x)
+#define letoh16(x) (uint16_t)(x)
+#define letoh32(x) (uint32_t)(x)
+#define letoh64(x) (uint64_t)(x)
+#else
+#define betoh16(x) (uint16_t)(x)
+#define betoh32(x) (uint32_t)(x)
+#define betoh64(x) (uint64_t)(x)
+#define letoh16(x) __bswap16(x)
+#define letoh32(x) __bswap32(x)
+#define letoh64(x) __bswap64(x)
+#endif
+#endif
+
+#endif
diff --git a/musl-include/arm/err.h b/musl-include/arm/err.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/err.h
@@ -0,0 +1,25 @@
+#ifndef _ERR_H
+#define _ERR_H
+
+#include <features.h>
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void warn(const char *, ...);
+void vwarn(const char *, va_list);
+void warnx(const char *, ...);
+void vwarnx(const char *, va_list);
+
+_Noreturn void err(int, const char *, ...);
+_Noreturn void verr(int, const char *, va_list);
+_Noreturn void errx(int, const char *, ...);
+_Noreturn void verrx(int, const char *, va_list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/errno.h b/musl-include/arm/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/errno.h
@@ -0,0 +1,27 @@
+#ifndef	_ERRNO_H
+#define _ERRNO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/errno.h>
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int *__errno_location(void);
+#define errno (*__errno_location())
+
+#ifdef _GNU_SOURCE
+extern char *program_invocation_short_name, *program_invocation_name;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/arm/fcntl.h b/musl-include/arm/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/fcntl.h
@@ -0,0 +1,218 @@
+#ifndef	_FCNTL_H
+#define	_FCNTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_mode_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_struct_iovec
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/fcntl.h>
+
+struct flock {
+	short l_type;
+	short l_whence;
+	off_t l_start;
+	off_t l_len;
+	pid_t l_pid;
+};
+
+int creat(const char *, mode_t);
+int fcntl(int, int, ...);
+int open(const char *, int, ...);
+int openat(int, const char *, int, ...);
+int posix_fadvise(int, off_t, off_t, int);
+int posix_fallocate(int, off_t, off_t);
+
+#define O_SEARCH   O_PATH
+#define O_EXEC     O_PATH
+#define O_TTY_INIT 0
+
+#define O_ACCMODE (03|O_SEARCH)
+#define O_RDONLY  00
+#define O_WRONLY  01
+#define O_RDWR    02
+
+#define F_OFD_GETLK 36
+#define F_OFD_SETLK 37
+#define F_OFD_SETLKW 38
+
+#define F_DUPFD_CLOEXEC 1030
+
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+#define FD_CLOEXEC 1
+
+#define AT_FDCWD (-100)
+#define AT_SYMLINK_NOFOLLOW 0x100
+#define AT_REMOVEDIR 0x200
+#define AT_SYMLINK_FOLLOW 0x400
+#define AT_EACCESS 0x200
+
+#define POSIX_FADV_NORMAL     0
+#define POSIX_FADV_RANDOM     1
+#define POSIX_FADV_SEQUENTIAL 2
+#define POSIX_FADV_WILLNEED   3
+#ifndef POSIX_FADV_DONTNEED
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
+#endif
+
+#undef SEEK_SET
+#undef SEEK_CUR
+#undef SEEK_END
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#ifndef S_IRUSR
+#define S_ISUID 04000
+#define S_ISGID 02000
+#define S_ISVTX 01000
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXU 0700
+#define S_IRGRP 0040
+#define S_IWGRP 0020
+#define S_IXGRP 0010
+#define S_IRWXG 0070
+#define S_IROTH 0004
+#define S_IWOTH 0002
+#define S_IXOTH 0001
+#define S_IRWXO 0007
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define AT_NO_AUTOMOUNT 0x800
+#define AT_EMPTY_PATH 0x1000
+#define AT_STATX_SYNC_TYPE 0x6000
+#define AT_STATX_SYNC_AS_STAT 0x0000
+#define AT_STATX_FORCE_SYNC 0x2000
+#define AT_STATX_DONT_SYNC 0x4000
+#define AT_RECURSIVE 0x8000
+
+#define FAPPEND O_APPEND
+#define FFSYNC O_SYNC
+#define FASYNC O_ASYNC
+#define FNONBLOCK O_NONBLOCK
+#define FNDELAY O_NDELAY
+
+#define F_OK 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#define F_ULOCK 0
+#define F_LOCK  1
+#define F_TLOCK 2
+#define F_TEST  3
+
+#define F_SETLEASE	1024
+#define F_GETLEASE	1025
+#define F_NOTIFY	1026
+#define F_CANCELLK	1029
+#define F_SETPIPE_SZ	1031
+#define F_GETPIPE_SZ	1032
+#define F_ADD_SEALS	1033
+#define F_GET_SEALS	1034
+
+#define F_SEAL_SEAL	0x0001
+#define F_SEAL_SHRINK	0x0002
+#define F_SEAL_GROW	0x0004
+#define F_SEAL_WRITE	0x0008
+#define F_SEAL_FUTURE_WRITE	0x0010
+
+#define F_GET_RW_HINT		1035
+#define F_SET_RW_HINT		1036
+#define F_GET_FILE_RW_HINT	1037
+#define F_SET_FILE_RW_HINT	1038
+
+#define RWF_WRITE_LIFE_NOT_SET	0
+#define RWH_WRITE_LIFE_NONE	1
+#define RWH_WRITE_LIFE_SHORT	2
+#define RWH_WRITE_LIFE_MEDIUM	3
+#define RWH_WRITE_LIFE_LONG	4
+#define RWH_WRITE_LIFE_EXTREME	5
+
+#define DN_ACCESS	0x00000001
+#define DN_MODIFY	0x00000002
+#define DN_CREATE	0x00000004
+#define DN_DELETE	0x00000008
+#define DN_RENAME	0x00000010
+#define DN_ATTRIB	0x00000020
+#define DN_MULTISHOT	0x80000000
+
+int lockf(int, int, off_t);
+#endif
+
+#if defined(_GNU_SOURCE)
+#define F_OWNER_TID 0
+#define F_OWNER_PID 1
+#define F_OWNER_PGRP 2
+#define F_OWNER_GID 2
+struct file_handle {
+	unsigned handle_bytes;
+	int handle_type;
+	unsigned char f_handle[];
+};
+struct f_owner_ex {
+	int type;
+	pid_t pid;
+};
+#define FALLOC_FL_KEEP_SIZE 1
+#define FALLOC_FL_PUNCH_HOLE 2
+#define MAX_HANDLE_SZ 128
+#define SYNC_FILE_RANGE_WAIT_BEFORE 1
+#define SYNC_FILE_RANGE_WRITE 2
+#define SYNC_FILE_RANGE_WAIT_AFTER 4
+#define SPLICE_F_MOVE 1
+#define SPLICE_F_NONBLOCK 2
+#define SPLICE_F_MORE 4
+#define SPLICE_F_GIFT 8
+int fallocate(int, int, off_t, off_t);
+int name_to_handle_at(int, const char *, struct file_handle *, int *, int);
+int open_by_handle_at(int, struct file_handle *, int);
+ssize_t readahead(int, off_t, size_t);
+int sync_file_range(int, off_t, off_t, unsigned);
+ssize_t vmsplice(int, const struct iovec *, size_t, unsigned);
+ssize_t splice(int, off_t *, int, off_t *, size_t, unsigned);
+ssize_t tee(int, int, size_t, unsigned);
+#define loff_t off_t
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define F_GETLK64 F_GETLK
+#define F_SETLK64 F_SETLK
+#define F_SETLKW64 F_SETLKW
+#define flock64 flock
+#define open64 open
+#define openat64 openat
+#define creat64 creat
+#define lockf64 lockf
+#define posix_fadvise64 posix_fadvise
+#define posix_fallocate64 posix_fallocate
+#define off64_t off_t
+#if defined(_GNU_SOURCE)
+#define fallocate64 fallocate
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/features.h b/musl-include/arm/features.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/features.h
@@ -0,0 +1,40 @@
+#ifndef _FEATURES_H
+#define _FEATURES_H
+
+#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE)
+#define _GNU_SOURCE 1
+#endif
+
+#if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE)
+#define _BSD_SOURCE 1
+#endif
+
+#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
+ && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
+ && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)
+#define _BSD_SOURCE 1
+#define _XOPEN_SOURCE 700
+#endif
+
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
+#if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
+#define __inline inline
+#elif !defined(__GNUC__)
+#define __inline
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#elif defined(__GNUC__)
+#define _Noreturn __attribute__((__noreturn__))
+#else
+#define _Noreturn
+#endif
+
+#define __REDIR(x,y) __typeof__(x) x __asm__(#y)
+
+#endif
diff --git a/musl-include/arm/fenv.h b/musl-include/arm/fenv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/fenv.h
@@ -0,0 +1,28 @@
+#ifndef _FENV_H
+#define _FENV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bits/fenv.h>
+
+int feclearexcept(int);
+int fegetexceptflag(fexcept_t *, int);
+int feraiseexcept(int);
+int fesetexceptflag(const fexcept_t *, int);
+int fetestexcept(int);
+
+int fegetround(void);
+int fesetround(int);
+
+int fegetenv(fenv_t *);
+int feholdexcept(fenv_t *);
+int fesetenv(const fenv_t *);
+int feupdateenv(const fenv_t *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/musl-include/arm/float.h b/musl-include/arm/float.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/float.h
@@ -0,0 +1,52 @@
+#ifndef _FLOAT_H
+#define _FLOAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __flt_rounds(void);
+#define FLT_ROUNDS (__flt_rounds())
+
+#define FLT_RADIX 2
+
+#define FLT_TRUE_MIN 1.40129846432481707092e-45F
+#define FLT_MIN 1.17549435082228750797e-38F
+#define FLT_MAX 3.40282346638528859812e+38F
+#define FLT_EPSILON 1.1920928955078125e-07F
+
+#define FLT_MANT_DIG 24
+#define FLT_MIN_EXP (-125)
+#define FLT_MAX_EXP 128
+#define FLT_HAS_SUBNORM 1
+
+#define FLT_DIG 6
+#define FLT_DECIMAL_DIG 9
+#define FLT_MIN_10_EXP (-37)
+#define FLT_MAX_10_EXP 38
+
+#define DBL_TRUE_MIN 4.94065645841246544177e-324
+#define DBL_MIN 2.22507385850720138309e-308
+#define DBL_MAX 1.79769313486231570815e+308
+#define DBL_EPSILON 2.22044604925031308085e-16
+
+#define DBL_MANT_DIG 53
+#define DBL_MIN_EXP (-1021)
+#define DBL_MAX_EXP 1024
+#define DBL_HAS_SUBNORM 1
+
+#define DBL_DIG 15
+#define DBL_DECIMAL_DIG 17
+#define DBL_MIN_10_EXP (-307)
+#define DBL_MAX_10_EXP 308
+
+#define LDBL_HAS_SUBNORM 1
+#define LDBL_DECIMAL_DIG DECIMAL_DIG
+
+#include <bits/float.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/fmtmsg.h b/musl-include/arm/fmtmsg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/fmtmsg.h
@@ -0,0 +1,47 @@
+#ifndef _FMTMSG_H
+#define _FMTMSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MM_HARD		1
+#define MM_SOFT		2
+#define MM_FIRM		4
+
+#define MM_APPL		8
+#define MM_UTIL		16
+#define MM_OPSYS	32
+
+#define MM_RECOVER	64
+#define MM_NRECOV	128
+
+#define MM_PRINT	256
+#define MM_CONSOLE	512
+
+#define MM_NULLMC	0L
+
+#define MM_HALT		1
+#define MM_ERROR	2
+#define MM_WARNING	3
+#define MM_INFO		4
+#define MM_NOSEV	0
+
+#define MM_OK		0
+#define MM_NOTOK	(-1)
+#define MM_NOMSG	1
+#define MM_NOCON	4
+
+#define MM_NULLLBL	((char*)0)
+#define MM_NULLTXT	((char*)0)
+#define MM_NULLACT	((char*)0)
+#define MM_NULLTAG	((char*)0)
+#define MM_NULLSEV	0
+
+int fmtmsg(long, const char *, int, const char *, const char *, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/fnmatch.h b/musl-include/arm/fnmatch.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/fnmatch.h
@@ -0,0 +1,24 @@
+#ifndef	_FNMATCH_H
+#define	_FNMATCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	FNM_PATHNAME 0x1
+#define	FNM_NOESCAPE 0x2
+#define	FNM_PERIOD   0x4
+#define	FNM_LEADING_DIR	0x8           
+#define	FNM_CASEFOLD	0x10
+#define	FNM_FILE_NAME	FNM_PATHNAME
+
+#define	FNM_NOMATCH 1
+#define FNM_NOSYS   (-1)
+
+int fnmatch(const char *, const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/ftw.h b/musl-include/arm/ftw.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/ftw.h
@@ -0,0 +1,41 @@
+#ifndef _FTW_H
+#define	_FTW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/stat.h>
+
+#define FTW_F   1
+#define FTW_D   2
+#define FTW_DNR 3
+#define FTW_NS  4
+#define FTW_SL  5
+#define FTW_DP  6
+#define FTW_SLN 7
+
+#define FTW_PHYS  1
+#define FTW_MOUNT 2
+#define FTW_CHDIR 4
+#define FTW_DEPTH 8
+
+struct FTW {
+	int base;
+	int level;
+};
+
+int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
+int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define ftw64 ftw
+#define nftw64 nftw
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/getopt.h b/musl-include/arm/getopt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/getopt.h
@@ -0,0 +1,30 @@
+#ifndef _GETOPT_H
+#define _GETOPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int getopt(int, char * const [], const char *);
+extern char *optarg;
+extern int optind, opterr, optopt, optreset;
+
+struct option {
+	const char *name;
+	int has_arg;
+	int *flag;
+	int val;
+};
+
+int getopt_long(int, char *const *, const char *, const struct option *, int *);
+int getopt_long_only(int, char *const *, const char *, const struct option *, int *);
+
+#define no_argument        0
+#define required_argument  1
+#define optional_argument  2
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/glob.h b/musl-include/arm/glob.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/glob.h
@@ -0,0 +1,52 @@
+#ifndef	_GLOB_H
+#define	_GLOB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef struct {
+	size_t gl_pathc;
+	char **gl_pathv;
+	size_t gl_offs;
+	int __dummy1;
+	void *__dummy2[5];
+} glob_t;
+
+int  glob(const char *__restrict, int, int (*)(const char *, int), glob_t *__restrict);
+void globfree(glob_t *);
+
+#define GLOB_ERR      0x01
+#define GLOB_MARK     0x02
+#define GLOB_NOSORT   0x04
+#define GLOB_DOOFFS   0x08
+#define GLOB_NOCHECK  0x10
+#define GLOB_APPEND   0x20
+#define GLOB_NOESCAPE 0x40
+#define	GLOB_PERIOD   0x80
+
+#define GLOB_TILDE       0x1000
+#define GLOB_TILDE_CHECK 0x4000
+
+#define GLOB_NOSPACE 1
+#define GLOB_ABORTED 2
+#define GLOB_NOMATCH 3
+#define GLOB_NOSYS   4
+
+#if defined(_LARGEFILE64_SOURCE)
+#define glob64 glob
+#define globfree64 globfree
+#define glob64_t glob_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/grp.h b/musl-include/arm/grp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/grp.h
@@ -0,0 +1,53 @@
+#ifndef	_GRP_H
+#define	_GRP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_gid_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_FILE
+#endif
+
+#include <bits/alltypes.h>
+
+struct group {
+	char *gr_name;
+	char *gr_passwd;
+	gid_t gr_gid;
+	char **gr_mem;
+};
+
+struct group  *getgrgid(gid_t);
+struct group  *getgrnam(const char *);
+
+int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
+int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct group  *getgrent(void);
+void           endgrent(void);
+void           setgrent(void);
+#endif
+
+#ifdef _GNU_SOURCE
+struct group  *fgetgrent(FILE *);
+int putgrent(const struct group *, FILE *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int getgrouplist(const char *, gid_t, gid_t *, int *);
+int setgroups(size_t, const gid_t *);
+int initgroups(const char *, gid_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/iconv.h b/musl-include/arm/iconv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/iconv.h
@@ -0,0 +1,24 @@
+#ifndef _ICONV_H
+#define _ICONV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef void *iconv_t;
+
+iconv_t iconv_open(const char *, const char *);
+size_t iconv(iconv_t, char **__restrict, size_t *__restrict, char **__restrict, size_t *__restrict);
+int iconv_close(iconv_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/ifaddrs.h b/musl-include/arm/ifaddrs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/ifaddrs.h
@@ -0,0 +1,35 @@
+#ifndef _IFADDRS_H
+#define _IFADDRS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+
+struct ifaddrs {
+	struct ifaddrs *ifa_next;
+	char *ifa_name;
+	unsigned ifa_flags;
+	struct sockaddr *ifa_addr;
+	struct sockaddr *ifa_netmask;
+	union {
+		struct sockaddr *ifu_broadaddr;
+		struct sockaddr *ifu_dstaddr;
+	} ifa_ifu;
+	void *ifa_data;
+};
+#define ifa_broadaddr ifa_ifu.ifu_broadaddr
+#define ifa_dstaddr ifa_ifu.ifu_dstaddr
+
+void freeifaddrs(struct ifaddrs *);
+int getifaddrs(struct ifaddrs **);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/arm/inttypes.h b/musl-include/arm/inttypes.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/inttypes.h
@@ -0,0 +1,229 @@
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <stdint.h>
+
+#define __NEED_wchar_t
+#include <bits/alltypes.h>
+
+typedef struct { intmax_t quot, rem; } imaxdiv_t;
+
+intmax_t imaxabs(intmax_t);
+imaxdiv_t imaxdiv(intmax_t, intmax_t);
+
+intmax_t strtoimax(const char *__restrict, char **__restrict, int);
+uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
+
+intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
+uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
+
+#if UINTPTR_MAX == UINT64_MAX
+#define __PRI64  "l"
+#define __PRIPTR "l"
+#else
+#define __PRI64  "ll"
+#define __PRIPTR ""
+#endif
+
+#define PRId8  "d"
+#define PRId16 "d"
+#define PRId32 "d"
+#define PRId64 __PRI64 "d"
+
+#define PRIdLEAST8  "d"
+#define PRIdLEAST16 "d"
+#define PRIdLEAST32 "d"
+#define PRIdLEAST64 __PRI64 "d"
+
+#define PRIdFAST8  "d"
+#define PRIdFAST16 "d"
+#define PRIdFAST32 "d"
+#define PRIdFAST64 __PRI64 "d"
+
+#define PRIi8  "i"
+#define PRIi16 "i"
+#define PRIi32 "i"
+#define PRIi64 __PRI64 "i"
+
+#define PRIiLEAST8  "i"
+#define PRIiLEAST16 "i"
+#define PRIiLEAST32 "i"
+#define PRIiLEAST64 __PRI64 "i"
+
+#define PRIiFAST8  "i"
+#define PRIiFAST16 "i"
+#define PRIiFAST32 "i"
+#define PRIiFAST64 __PRI64 "i"
+
+#define PRIo8  "o"
+#define PRIo16 "o"
+#define PRIo32 "o"
+#define PRIo64 __PRI64 "o"
+
+#define PRIoLEAST8  "o"
+#define PRIoLEAST16 "o"
+#define PRIoLEAST32 "o"
+#define PRIoLEAST64 __PRI64 "o"
+
+#define PRIoFAST8  "o"
+#define PRIoFAST16 "o"
+#define PRIoFAST32 "o"
+#define PRIoFAST64 __PRI64 "o"
+
+#define PRIu8  "u"
+#define PRIu16 "u"
+#define PRIu32 "u"
+#define PRIu64 __PRI64 "u"
+
+#define PRIuLEAST8  "u"
+#define PRIuLEAST16 "u"
+#define PRIuLEAST32 "u"
+#define PRIuLEAST64 __PRI64 "u"
+
+#define PRIuFAST8  "u"
+#define PRIuFAST16 "u"
+#define PRIuFAST32 "u"
+#define PRIuFAST64 __PRI64 "u"
+
+#define PRIx8  "x"
+#define PRIx16 "x"
+#define PRIx32 "x"
+#define PRIx64 __PRI64 "x"
+
+#define PRIxLEAST8  "x"
+#define PRIxLEAST16 "x"
+#define PRIxLEAST32 "x"
+#define PRIxLEAST64 __PRI64 "x"
+
+#define PRIxFAST8  "x"
+#define PRIxFAST16 "x"
+#define PRIxFAST32 "x"
+#define PRIxFAST64 __PRI64 "x"
+
+#define PRIX8  "X"
+#define PRIX16 "X"
+#define PRIX32 "X"
+#define PRIX64 __PRI64 "X"
+
+#define PRIXLEAST8  "X"
+#define PRIXLEAST16 "X"
+#define PRIXLEAST32 "X"
+#define PRIXLEAST64 __PRI64 "X"
+
+#define PRIXFAST8  "X"
+#define PRIXFAST16 "X"
+#define PRIXFAST32 "X"
+#define PRIXFAST64 __PRI64 "X"
+
+#define PRIdMAX __PRI64 "d"
+#define PRIiMAX __PRI64 "i"
+#define PRIoMAX __PRI64 "o"
+#define PRIuMAX __PRI64 "u"
+#define PRIxMAX __PRI64 "x"
+#define PRIXMAX __PRI64 "X"
+
+#define PRIdPTR __PRIPTR "d"
+#define PRIiPTR __PRIPTR "i"
+#define PRIoPTR __PRIPTR "o"
+#define PRIuPTR __PRIPTR "u"
+#define PRIxPTR __PRIPTR "x"
+#define PRIXPTR __PRIPTR "X"
+
+#define SCNd8   "hhd"
+#define SCNd16  "hd"
+#define SCNd32  "d"
+#define SCNd64  __PRI64 "d"
+
+#define SCNdLEAST8  "hhd"
+#define SCNdLEAST16 "hd"
+#define SCNdLEAST32 "d"
+#define SCNdLEAST64 __PRI64 "d"
+
+#define SCNdFAST8  "hhd"
+#define SCNdFAST16 "d"
+#define SCNdFAST32 "d"
+#define SCNdFAST64 __PRI64 "d"
+
+#define SCNi8   "hhi"
+#define SCNi16  "hi"
+#define SCNi32  "i"
+#define SCNi64  __PRI64 "i"
+
+#define SCNiLEAST8  "hhi"
+#define SCNiLEAST16 "hi"
+#define SCNiLEAST32 "i"
+#define SCNiLEAST64 __PRI64 "i"
+
+#define SCNiFAST8  "hhi"
+#define SCNiFAST16 "i"
+#define SCNiFAST32 "i"
+#define SCNiFAST64 __PRI64 "i"
+
+#define SCNu8   "hhu"
+#define SCNu16  "hu"
+#define SCNu32  "u"
+#define SCNu64  __PRI64 "u"
+
+#define SCNuLEAST8  "hhu"
+#define SCNuLEAST16 "hu"
+#define SCNuLEAST32 "u"
+#define SCNuLEAST64 __PRI64 "u"
+
+#define SCNuFAST8 "hhu"
+#define SCNuFAST16 "u"
+#define SCNuFAST32 "u"
+#define SCNuFAST64 __PRI64 "u"
+
+#define SCNo8   "hho"
+#define SCNo16  "ho"
+#define SCNo32  "o"
+#define SCNo64  __PRI64 "o"
+
+#define SCNoLEAST8  "hho"
+#define SCNoLEAST16 "ho"
+#define SCNoLEAST32 "o"
+#define SCNoLEAST64 __PRI64 "o"
+
+#define SCNoFAST8  "hho"
+#define SCNoFAST16 "o"
+#define SCNoFAST32 "o"
+#define SCNoFAST64 __PRI64 "o"
+
+#define SCNx8   "hhx"
+#define SCNx16  "hx"
+#define SCNx32  "x"
+#define SCNx64  __PRI64 "x"
+
+#define SCNxLEAST8  "hhx"
+#define SCNxLEAST16 "hx"
+#define SCNxLEAST32 "x"
+#define SCNxLEAST64 __PRI64 "x"
+
+#define SCNxFAST8  "hhx"
+#define SCNxFAST16 "x"
+#define SCNxFAST32 "x"
+#define SCNxFAST64 __PRI64 "x"
+
+#define SCNdMAX __PRI64 "d"
+#define SCNiMAX __PRI64 "i"
+#define SCNoMAX __PRI64 "o"
+#define SCNuMAX __PRI64 "u"
+#define SCNxMAX __PRI64 "x"
+
+#define SCNdPTR __PRIPTR "d"
+#define SCNiPTR __PRIPTR "i"
+#define SCNoPTR __PRIPTR "o"
+#define SCNuPTR __PRIPTR "u"
+#define SCNxPTR __PRIPTR "x"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/arm/iso646.h b/musl-include/arm/iso646.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/iso646.h
@@ -0,0 +1,20 @@
+#ifndef _ISO646_H
+#define _ISO646_H
+
+#ifndef __cplusplus
+
+#define and    &&
+#define and_eq &=
+#define bitand &
+#define bitor  |
+#define compl  ~
+#define not    !
+#define not_eq !=
+#define or     ||
+#define or_eq  |=
+#define xor    ^
+#define xor_eq ^=
+
+#endif
+
+#endif
diff --git a/musl-include/arm/langinfo.h b/musl-include/arm/langinfo.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/langinfo.h
@@ -0,0 +1,98 @@
+#ifndef _LANGINFO_H
+#define _LANGINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <nl_types.h>
+
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+#define ABDAY_1 0x20000
+#define ABDAY_2 0x20001
+#define ABDAY_3 0x20002
+#define ABDAY_4 0x20003
+#define ABDAY_5 0x20004
+#define ABDAY_6 0x20005
+#define ABDAY_7 0x20006
+
+#define DAY_1 0x20007
+#define DAY_2 0x20008
+#define DAY_3 0x20009
+#define DAY_4 0x2000A
+#define DAY_5 0x2000B
+#define DAY_6 0x2000C
+#define DAY_7 0x2000D
+
+#define ABMON_1 0x2000E
+#define ABMON_2 0x2000F
+#define ABMON_3 0x20010
+#define ABMON_4 0x20011
+#define ABMON_5 0x20012
+#define ABMON_6 0x20013
+#define ABMON_7 0x20014
+#define ABMON_8 0x20015
+#define ABMON_9 0x20016
+#define ABMON_10 0x20017
+#define ABMON_11 0x20018
+#define ABMON_12 0x20019
+
+#define MON_1 0x2001A
+#define MON_2 0x2001B
+#define MON_3 0x2001C
+#define MON_4 0x2001D
+#define MON_5 0x2001E
+#define MON_6 0x2001F
+#define MON_7 0x20020
+#define MON_8 0x20021
+#define MON_9 0x20022
+#define MON_10 0x20023
+#define MON_11 0x20024
+#define MON_12 0x20025
+
+#define AM_STR 0x20026
+#define PM_STR 0x20027
+
+#define D_T_FMT 0x20028
+#define D_FMT 0x20029
+#define T_FMT 0x2002A
+#define T_FMT_AMPM 0x2002B
+
+#define ERA 0x2002C
+#define ERA_D_FMT 0x2002E
+#define ALT_DIGITS 0x2002F
+#define ERA_D_T_FMT 0x20030
+#define ERA_T_FMT 0x20031
+
+#define CODESET 14
+
+#define CRNCYSTR 0x4000F
+
+#define RADIXCHAR 0x10000
+#define THOUSEP 0x10001
+#define YESEXPR 0x50000
+#define NOEXPR 0x50001
+
+#define _NL_LOCALE_NAME(cat) (((cat)<<16) | 0xffff)
+
+#if defined(_GNU_SOURCE)
+#define NL_LOCALE_NAME(cat) _NL_LOCALE_NAME(cat)
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define YESSTR 0x50002
+#define NOSTR 0x50003
+#endif
+
+char *nl_langinfo(nl_item);
+char *nl_langinfo_l(nl_item, locale_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/lastlog.h b/musl-include/arm/lastlog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/lastlog.h
@@ -0,0 +1,1 @@
+#include <utmp.h>
diff --git a/musl-include/arm/libgen.h b/musl-include/arm/libgen.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/libgen.h
@@ -0,0 +1,15 @@
+#ifndef _LIBGEN_H
+#define _LIBGEN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *dirname(char *);
+char *basename(char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/libintl.h b/musl-include/arm/libintl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/libintl.h
@@ -0,0 +1,33 @@
+#ifndef _LIBINTL_H
+#define _LIBINTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __USE_GNU_GETTEXT 1
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 1 : -1)
+
+#if __GNUC__ >= 3
+#define __fa(n) __attribute__ ((__format_arg__ (n)))
+#else
+#define __fa(n)
+#endif
+
+char *gettext(const char *) __fa(1);
+char *dgettext(const char *, const char *) __fa(2);
+char *dcgettext(const char *, const char *, int) __fa(2);
+char *ngettext(const char *, const char *, unsigned long) __fa(1) __fa(2);
+char *dngettext(const char *, const char *, const char *, unsigned long) __fa(2) __fa(3);
+char *dcngettext(const char *, const char *, const char *, unsigned long, int) __fa(2) __fa(3);
+char *textdomain(const char *);
+char *bindtextdomain (const char *, const char *);
+char *bind_textdomain_codeset(const char *, const char *);
+
+#undef __fa
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/limits.h b/musl-include/arm/limits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/limits.h
@@ -0,0 +1,166 @@
+#ifndef _LIMITS_H
+#define _LIMITS_H
+
+#include <features.h>
+
+#include <bits/alltypes.h> /* __LONG_MAX */
+
+/* Support signed or unsigned plain-char */
+
+#if '\xff' > 0
+#define CHAR_MIN 0
+#define CHAR_MAX 255
+#else
+#define CHAR_MIN (-128)
+#define CHAR_MAX 127
+#endif
+
+#define CHAR_BIT 8
+#define SCHAR_MIN (-128)
+#define SCHAR_MAX 127
+#define UCHAR_MAX 255
+#define SHRT_MIN  (-1-0x7fff)
+#define SHRT_MAX  0x7fff
+#define USHRT_MAX 0xffff
+#define INT_MIN  (-1-0x7fffffff)
+#define INT_MAX  0x7fffffff
+#define UINT_MAX 0xffffffffU
+#define LONG_MIN (-LONG_MAX-1)
+#define LONG_MAX __LONG_MAX
+#define ULONG_MAX (2UL*LONG_MAX+1)
+#define LLONG_MIN (-LLONG_MAX-1)
+#define LLONG_MAX  0x7fffffffffffffffLL
+#define ULLONG_MAX (2ULL*LLONG_MAX+1)
+
+#define MB_LEN_MAX 4
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#include <bits/limits.h>
+
+#define PIPE_BUF 4096
+#define FILESIZEBITS 64
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+#define PATH_MAX 4096
+#define NGROUPS_MAX 32
+#define ARG_MAX 131072
+#define IOV_MAX 1024
+#define SYMLOOP_MAX 40
+#define WORD_BIT 32
+#define SSIZE_MAX LONG_MAX
+#define TZNAME_MAX 6
+#define TTY_NAME_MAX 32
+#define HOST_NAME_MAX 255
+
+#if LONG_MAX == 0x7fffffffL
+#define LONG_BIT 32
+#else
+#define LONG_BIT 64
+#endif
+
+/* Implementation choices... */
+
+#define PTHREAD_KEYS_MAX 128
+#define PTHREAD_STACK_MIN 2048
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+#define SEM_VALUE_MAX 0x7fffffff
+#define SEM_NSEMS_MAX 256
+#define DELAYTIMER_MAX 0x7fffffff
+#define MQ_PRIO_MAX 32768
+#define LOGIN_NAME_MAX 256
+
+/* Arbitrary numbers... */
+
+#define BC_BASE_MAX 99
+#define BC_DIM_MAX 2048
+#define BC_SCALE_MAX 99
+#define BC_STRING_MAX 1000
+#define CHARCLASS_NAME_MAX 14
+#define COLL_WEIGHTS_MAX 2
+#define EXPR_NEST_MAX 32
+#define LINE_MAX 4096
+#define RE_DUP_MAX 255
+
+#define NL_ARGMAX 9
+#define NL_MSGMAX 32767
+#define NL_SETMAX 255
+#define NL_TEXTMAX 2048
+
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+
+#ifdef PAGESIZE
+#define PAGE_SIZE PAGESIZE
+#endif
+#define NZERO 20
+#define NL_LANGMAX 32
+
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+
+#define NL_NMAX 16
+
+#endif
+
+/* POSIX/SUS requirements follow. These numbers come directly
+ * from SUS and have nothing to do with the host system. */
+
+#define _POSIX_AIO_LISTIO_MAX   2
+#define _POSIX_AIO_MAX          1
+#define _POSIX_ARG_MAX          4096
+#define _POSIX_CHILD_MAX        25
+#define _POSIX_CLOCKRES_MIN     20000000
+#define _POSIX_DELAYTIMER_MAX   32
+#define _POSIX_HOST_NAME_MAX    255
+#define _POSIX_LINK_MAX         8
+#define _POSIX_LOGIN_NAME_MAX   9
+#define _POSIX_MAX_CANON        255
+#define _POSIX_MAX_INPUT        255
+#define _POSIX_MQ_OPEN_MAX      8
+#define _POSIX_MQ_PRIO_MAX      32
+#define _POSIX_NAME_MAX         14
+#define _POSIX_NGROUPS_MAX      8
+#define _POSIX_OPEN_MAX         20
+#define _POSIX_PATH_MAX         256
+#define _POSIX_PIPE_BUF         512
+#define _POSIX_RE_DUP_MAX       255
+#define _POSIX_RTSIG_MAX        8
+#define _POSIX_SEM_NSEMS_MAX    256
+#define _POSIX_SEM_VALUE_MAX    32767
+#define _POSIX_SIGQUEUE_MAX     32
+#define _POSIX_SSIZE_MAX        32767
+#define _POSIX_STREAM_MAX       8
+#define _POSIX_SS_REPL_MAX      4
+#define _POSIX_SYMLINK_MAX      255
+#define _POSIX_SYMLOOP_MAX      8
+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
+#define _POSIX_THREAD_KEYS_MAX  128
+#define _POSIX_THREAD_THREADS_MAX 64
+#define _POSIX_TIMER_MAX        32
+#define _POSIX_TRACE_EVENT_NAME_MAX 30
+#define _POSIX_TRACE_NAME_MAX   8
+#define _POSIX_TRACE_SYS_MAX    8
+#define _POSIX_TRACE_USER_EVENT_MAX 32
+#define _POSIX_TTY_NAME_MAX     9
+#define _POSIX_TZNAME_MAX       6
+#define _POSIX2_BC_BASE_MAX     99
+#define _POSIX2_BC_DIM_MAX      2048
+#define _POSIX2_BC_SCALE_MAX    99
+#define _POSIX2_BC_STRING_MAX   1000
+#define _POSIX2_CHARCLASS_NAME_MAX 14
+#define _POSIX2_COLL_WEIGHTS_MAX 2
+#define _POSIX2_EXPR_NEST_MAX   32
+#define _POSIX2_LINE_MAX        2048
+#define _POSIX2_RE_DUP_MAX      255
+
+#define _XOPEN_IOV_MAX          16
+#define _XOPEN_NAME_MAX         255
+#define _XOPEN_PATH_MAX         1024
+
+#endif
diff --git a/musl-include/arm/link.h b/musl-include/arm/link.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/link.h
@@ -0,0 +1,53 @@
+#ifndef _LINK_H
+#define _LINK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+#define __NEED_size_t
+#define __NEED_uint32_t
+#include <bits/alltypes.h>
+
+#if UINTPTR_MAX > 0xffffffff
+#define ElfW(type) Elf64_ ## type
+#else
+#define ElfW(type) Elf32_ ## type
+#endif
+
+#include <bits/link.h>
+
+struct dl_phdr_info {
+	ElfW(Addr) dlpi_addr;
+	const char *dlpi_name;
+	const ElfW(Phdr) *dlpi_phdr;
+	ElfW(Half) dlpi_phnum;
+	unsigned long long int dlpi_adds;
+	unsigned long long int dlpi_subs;
+	size_t dlpi_tls_modid;
+	void *dlpi_tls_data;
+};
+
+struct link_map {
+	ElfW(Addr) l_addr;
+	char *l_name;
+	ElfW(Dyn) *l_ld;
+	struct link_map *l_next, *l_prev;
+};
+
+struct r_debug {
+	int r_version;
+	struct link_map *r_map;
+	ElfW(Addr) r_brk;
+	enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state;
+	ElfW(Addr) r_ldbase;
+};
+
+int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/locale.h b/musl-include/arm/locale.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/locale.h
@@ -0,0 +1,88 @@
+#ifndef	_LOCALE_H
+#define	_LOCALE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define LC_CTYPE    0
+#define LC_NUMERIC  1
+#define LC_TIME     2
+#define LC_COLLATE  3
+#define LC_MONETARY 4
+#define LC_MESSAGES 5
+#define LC_ALL      6
+
+struct lconv {
+	char *decimal_point;
+	char *thousands_sep;
+	char *grouping;
+
+	char *int_curr_symbol;
+	char *currency_symbol;
+	char *mon_decimal_point;
+	char *mon_thousands_sep;
+	char *mon_grouping;
+	char *positive_sign;
+	char *negative_sign;
+	char int_frac_digits;
+	char frac_digits;
+	char p_cs_precedes;
+	char p_sep_by_space;
+	char n_cs_precedes;
+	char n_sep_by_space;
+	char p_sign_posn;
+	char n_sign_posn;
+	char int_p_cs_precedes;
+	char int_p_sep_by_space;
+	char int_n_cs_precedes;
+	char int_n_sep_by_space;
+	char int_p_sign_posn;
+	char int_n_sign_posn;
+};
+
+
+char *setlocale (int, const char *);
+struct lconv *localeconv(void);
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+#define LC_GLOBAL_LOCALE ((locale_t)-1)
+
+#define LC_CTYPE_MASK    (1<<LC_CTYPE)
+#define LC_NUMERIC_MASK  (1<<LC_NUMERIC)
+#define LC_TIME_MASK     (1<<LC_TIME)
+#define LC_COLLATE_MASK  (1<<LC_COLLATE)
+#define LC_MONETARY_MASK (1<<LC_MONETARY)
+#define LC_MESSAGES_MASK (1<<LC_MESSAGES)
+#define LC_ALL_MASK      0x7fffffff
+
+locale_t duplocale(locale_t);
+void freelocale(locale_t);
+locale_t newlocale(int, const char *, locale_t);
+locale_t uselocale(locale_t);
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/malloc.h b/musl-include/arm/malloc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/malloc.h
@@ -0,0 +1,25 @@
+#ifndef _MALLOC_H
+#define _MALLOC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+void *malloc (size_t);
+void *calloc (size_t, size_t);
+void *realloc (void *, size_t);
+void free (void *);
+void *valloc (size_t);
+void *memalign(size_t, size_t);
+
+size_t malloc_usable_size(void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/math.h b/musl-include/arm/math.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/math.h
@@ -0,0 +1,442 @@
+#ifndef _MATH_H
+#define _MATH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_float_t
+#define __NEED_double_t
+#include <bits/alltypes.h>
+
+#if 100*__GNUC__+__GNUC_MINOR__ >= 303
+#define NAN       __builtin_nanf("")
+#define INFINITY  __builtin_inff()
+#else
+#define NAN       (0.0f/0.0f)
+#define INFINITY  1e5000f
+#endif
+
+#define HUGE_VALF INFINITY
+#define HUGE_VAL  ((double)INFINITY)
+#define HUGE_VALL ((long double)INFINITY)
+
+#define MATH_ERRNO  1
+#define MATH_ERREXCEPT 2
+#define math_errhandling 2
+
+#define FP_ILOGBNAN (-1-0x7fffffff)
+#define FP_ILOGB0 FP_ILOGBNAN
+
+#define FP_NAN       0
+#define FP_INFINITE  1
+#define FP_ZERO      2
+#define FP_SUBNORMAL 3
+#define FP_NORMAL    4
+
+#ifdef __FP_FAST_FMA
+#define FP_FAST_FMA 1
+#endif
+
+#ifdef __FP_FAST_FMAF
+#define FP_FAST_FMAF 1
+#endif
+
+#ifdef __FP_FAST_FMAL
+#define FP_FAST_FMAL 1
+#endif
+
+int __fpclassify(double);
+int __fpclassifyf(float);
+int __fpclassifyl(long double);
+
+static __inline unsigned __FLOAT_BITS(float __f)
+{
+	union {float __f; unsigned __i;} __u;
+	__u.__f = __f;
+	return __u.__i;
+}
+static __inline unsigned long long __DOUBLE_BITS(double __f)
+{
+	union {double __f; unsigned long long __i;} __u;
+	__u.__f = __f;
+	return __u.__i;
+}
+
+#define fpclassify(x) ( \
+	sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \
+	sizeof(x) == sizeof(double) ? __fpclassify(x) : \
+	__fpclassifyl(x) )
+
+#define isinf(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \
+	__fpclassifyl(x) == FP_INFINITE)
+
+#define isnan(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \
+	__fpclassifyl(x) == FP_NAN)
+
+#define isnormal(x) ( \
+	sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \
+	sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \
+	__fpclassifyl(x) == FP_NORMAL)
+
+#define isfinite(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \
+	__fpclassifyl(x) > FP_INFINITE)
+
+int __signbit(double);
+int __signbitf(float);
+int __signbitl(long double);
+
+#define signbit(x) ( \
+	sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \
+	sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \
+	__signbitl(x) )
+
+#define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y)))
+
+#define __ISREL_DEF(rel, op, type) \
+static __inline int __is##rel(type __x, type __y) \
+{ return !isunordered(__x,__y) && __x op __y; }
+
+__ISREL_DEF(lessf, <, float_t)
+__ISREL_DEF(less, <, double_t)
+__ISREL_DEF(lessl, <, long double)
+__ISREL_DEF(lessequalf, <=, float_t)
+__ISREL_DEF(lessequal, <=, double_t)
+__ISREL_DEF(lessequall, <=, long double)
+__ISREL_DEF(lessgreaterf, !=, float_t)
+__ISREL_DEF(lessgreater, !=, double_t)
+__ISREL_DEF(lessgreaterl, !=, long double)
+__ISREL_DEF(greaterf, >, float_t)
+__ISREL_DEF(greater, >, double_t)
+__ISREL_DEF(greaterl, >, long double)
+__ISREL_DEF(greaterequalf, >=, float_t)
+__ISREL_DEF(greaterequal, >=, double_t)
+__ISREL_DEF(greaterequall, >=, long double)
+
+#define __tg_pred_2(x, y, p) ( \
+	sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \
+	sizeof((x)+(y)) == sizeof(double) ? p(x, y) : \
+	p##l(x, y) )
+
+#define isless(x, y)            __tg_pred_2(x, y, __isless)
+#define islessequal(x, y)       __tg_pred_2(x, y, __islessequal)
+#define islessgreater(x, y)     __tg_pred_2(x, y, __islessgreater)
+#define isgreater(x, y)         __tg_pred_2(x, y, __isgreater)
+#define isgreaterequal(x, y)    __tg_pred_2(x, y, __isgreaterequal)
+
+double      acos(double);
+float       acosf(float);
+long double acosl(long double);
+
+double      acosh(double);
+float       acoshf(float);
+long double acoshl(long double);
+
+double      asin(double);
+float       asinf(float);
+long double asinl(long double);
+
+double      asinh(double);
+float       asinhf(float);
+long double asinhl(long double);
+
+double      atan(double);
+float       atanf(float);
+long double atanl(long double);
+
+double      atan2(double, double);
+float       atan2f(float, float);
+long double atan2l(long double, long double);
+
+double      atanh(double);
+float       atanhf(float);
+long double atanhl(long double);
+
+double      cbrt(double);
+float       cbrtf(float);
+long double cbrtl(long double);
+
+double      ceil(double);
+float       ceilf(float);
+long double ceill(long double);
+
+double      copysign(double, double);
+float       copysignf(float, float);
+long double copysignl(long double, long double);
+
+double      cos(double);
+float       cosf(float);
+long double cosl(long double);
+
+double      cosh(double);
+float       coshf(float);
+long double coshl(long double);
+
+double      erf(double);
+float       erff(float);
+long double erfl(long double);
+
+double      erfc(double);
+float       erfcf(float);
+long double erfcl(long double);
+
+double      exp(double);
+float       expf(float);
+long double expl(long double);
+
+double      exp2(double);
+float       exp2f(float);
+long double exp2l(long double);
+
+double      expm1(double);
+float       expm1f(float);
+long double expm1l(long double);
+
+double      fabs(double);
+float       fabsf(float);
+long double fabsl(long double);
+
+double      fdim(double, double);
+float       fdimf(float, float);
+long double fdiml(long double, long double);
+
+double      floor(double);
+float       floorf(float);
+long double floorl(long double);
+
+double      fma(double, double, double);
+float       fmaf(float, float, float);
+long double fmal(long double, long double, long double);
+
+double      fmax(double, double);
+float       fmaxf(float, float);
+long double fmaxl(long double, long double);
+
+double      fmin(double, double);
+float       fminf(float, float);
+long double fminl(long double, long double);
+
+double      fmod(double, double);
+float       fmodf(float, float);
+long double fmodl(long double, long double);
+
+double      frexp(double, int *);
+float       frexpf(float, int *);
+long double frexpl(long double, int *);
+
+double      hypot(double, double);
+float       hypotf(float, float);
+long double hypotl(long double, long double);
+
+int         ilogb(double);
+int         ilogbf(float);
+int         ilogbl(long double);
+
+double      ldexp(double, int);
+float       ldexpf(float, int);
+long double ldexpl(long double, int);
+
+double      lgamma(double);
+float       lgammaf(float);
+long double lgammal(long double);
+
+long long   llrint(double);
+long long   llrintf(float);
+long long   llrintl(long double);
+
+long long   llround(double);
+long long   llroundf(float);
+long long   llroundl(long double);
+
+double      log(double);
+float       logf(float);
+long double logl(long double);
+
+double      log10(double);
+float       log10f(float);
+long double log10l(long double);
+
+double      log1p(double);
+float       log1pf(float);
+long double log1pl(long double);
+
+double      log2(double);
+float       log2f(float);
+long double log2l(long double);
+
+double      logb(double);
+float       logbf(float);
+long double logbl(long double);
+
+long        lrint(double);
+long        lrintf(float);
+long        lrintl(long double);
+
+long        lround(double);
+long        lroundf(float);
+long        lroundl(long double);
+
+double      modf(double, double *);
+float       modff(float, float *);
+long double modfl(long double, long double *);
+
+double      nan(const char *);
+float       nanf(const char *);
+long double nanl(const char *);
+
+double      nearbyint(double);
+float       nearbyintf(float);
+long double nearbyintl(long double);
+
+double      nextafter(double, double);
+float       nextafterf(float, float);
+long double nextafterl(long double, long double);
+
+double      nexttoward(double, long double);
+float       nexttowardf(float, long double);
+long double nexttowardl(long double, long double);
+
+double      pow(double, double);
+float       powf(float, float);
+long double powl(long double, long double);
+
+double      remainder(double, double);
+float       remainderf(float, float);
+long double remainderl(long double, long double);
+
+double      remquo(double, double, int *);
+float       remquof(float, float, int *);
+long double remquol(long double, long double, int *);
+
+double      rint(double);
+float       rintf(float);
+long double rintl(long double);
+
+double      round(double);
+float       roundf(float);
+long double roundl(long double);
+
+double      scalbln(double, long);
+float       scalblnf(float, long);
+long double scalblnl(long double, long);
+
+double      scalbn(double, int);
+float       scalbnf(float, int);
+long double scalbnl(long double, int);
+
+double      sin(double);
+float       sinf(float);
+long double sinl(long double);
+
+double      sinh(double);
+float       sinhf(float);
+long double sinhl(long double);
+
+double      sqrt(double);
+float       sqrtf(float);
+long double sqrtl(long double);
+
+double      tan(double);
+float       tanf(float);
+long double tanl(long double);
+
+double      tanh(double);
+float       tanhf(float);
+long double tanhl(long double);
+
+double      tgamma(double);
+float       tgammaf(float);
+long double tgammal(long double);
+
+double      trunc(double);
+float       truncf(float);
+long double truncl(long double);
+
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE)
+#undef  MAXFLOAT
+#define MAXFLOAT        3.40282346638528859812e+38F
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define M_E             2.7182818284590452354   /* e */
+#define M_LOG2E         1.4426950408889634074   /* log_2 e */
+#define M_LOG10E        0.43429448190325182765  /* log_10 e */
+#define M_LN2           0.69314718055994530942  /* log_e 2 */
+#define M_LN10          2.30258509299404568402  /* log_e 10 */
+#define M_PI            3.14159265358979323846  /* pi */
+#define M_PI_2          1.57079632679489661923  /* pi/2 */
+#define M_PI_4          0.78539816339744830962  /* pi/4 */
+#define M_1_PI          0.31830988618379067154  /* 1/pi */
+#define M_2_PI          0.63661977236758134308  /* 2/pi */
+#define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
+#define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
+#define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
+
+extern int signgam;
+
+double      j0(double);
+double      j1(double);
+double      jn(int, double);
+
+double      y0(double);
+double      y1(double);
+double      yn(int, double);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define HUGE            3.40282346638528859812e+38F
+
+double      drem(double, double);
+float       dremf(float, float);
+
+int         finite(double);
+int         finitef(float);
+
+double      scalb(double, double);
+float       scalbf(float, float);
+
+double      significand(double);
+float       significandf(float);
+
+double      lgamma_r(double, int*);
+float       lgammaf_r(float, int*);
+
+float       j0f(float);
+float       j1f(float);
+float       jnf(int, float);
+
+float       y0f(float);
+float       y1f(float);
+float       ynf(int, float);
+#endif
+
+#ifdef _GNU_SOURCE
+long double lgammal_r(long double, int*);
+
+void        sincos(double, double*, double*);
+void        sincosf(float, float*, float*);
+void        sincosl(long double, long double*, long double*);
+
+double      exp10(double);
+float       exp10f(float);
+long double exp10l(long double);
+
+double      pow10(double);
+float       pow10f(float);
+long double pow10l(long double);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/memory.h b/musl-include/arm/memory.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/memory.h
@@ -0,0 +1,1 @@
+#include <string.h>
diff --git a/musl-include/arm/mntent.h b/musl-include/arm/mntent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/mntent.h
@@ -0,0 +1,43 @@
+#ifndef _MNTENT_H
+#define _MNTENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_FILE
+#include <bits/alltypes.h>
+
+#define MOUNTED "/etc/mtab"
+
+#define MNTTYPE_IGNORE	"ignore"
+#define MNTTYPE_NFS	"nfs"
+#define MNTTYPE_SWAP	"swap"
+#define MNTOPT_DEFAULTS	"defaults"
+#define MNTOPT_RO	"ro"
+#define MNTOPT_RW	"rw"
+#define MNTOPT_SUID	"suid"
+#define MNTOPT_NOSUID	"nosuid"
+#define MNTOPT_NOAUTO	"noauto"
+
+struct mntent {
+	char *mnt_fsname;
+	char *mnt_dir;
+	char *mnt_type;
+	char *mnt_opts;
+	int mnt_freq;
+	int mnt_passno;
+};
+
+FILE *setmntent(const char *, const char *);
+int endmntent(FILE *);
+struct mntent *getmntent(FILE *);
+struct mntent *getmntent_r(FILE *, struct mntent *, char *, int);
+int addmntent(FILE *, const struct mntent *);
+char *hasmntopt(const struct mntent *, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/monetary.h b/musl-include/arm/monetary.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/monetary.h
@@ -0,0 +1,23 @@
+#ifndef _MONETARY_H
+#define _MONETARY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ssize_t
+#define __NEED_size_t
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...);
+ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/mqueue.h b/musl-include/arm/mqueue.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/mqueue.h
@@ -0,0 +1,41 @@
+#ifndef _MQUEUE_H
+#define _MQUEUE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_pthread_attr_t
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+typedef int mqd_t;
+struct mq_attr {
+	long mq_flags, mq_maxmsg, mq_msgsize, mq_curmsgs, __unused[4];
+};
+struct sigevent;
+
+int mq_close(mqd_t);
+int mq_getattr(mqd_t, struct mq_attr *);
+int mq_notify(mqd_t, const struct sigevent *);
+mqd_t mq_open(const char *, int, ...);
+ssize_t mq_receive(mqd_t, char *, size_t, unsigned *);
+int mq_send(mqd_t, const char *, size_t, unsigned);
+int mq_setattr(mqd_t, const struct mq_attr *__restrict, struct mq_attr *__restrict);
+ssize_t mq_timedreceive(mqd_t, char *__restrict, size_t, unsigned *__restrict, const struct timespec *__restrict);
+int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct timespec *);
+int mq_unlink(const char *);
+
+#if _REDIR_TIME64
+__REDIR(mq_timedreceive, __mq_timedreceive_time64);
+__REDIR(mq_timedsend, __mq_timedsend_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/net/ethernet.h b/musl-include/arm/net/ethernet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/net/ethernet.h
@@ -0,0 +1,55 @@
+#ifndef _NET_ETHERNET_H
+#define _NET_ETHERNET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <netinet/if_ether.h>
+
+struct ether_addr {
+	uint8_t ether_addr_octet[ETH_ALEN];
+};
+
+struct ether_header {
+	uint8_t  ether_dhost[ETH_ALEN];
+	uint8_t  ether_shost[ETH_ALEN];
+	uint16_t ether_type;
+};
+
+#define	ETHERTYPE_PUP		0x0200
+#define ETHERTYPE_SPRITE	0x0500
+#define	ETHERTYPE_IP		0x0800
+#define	ETHERTYPE_ARP		0x0806
+#define	ETHERTYPE_REVARP	0x8035
+#define ETHERTYPE_AT		0x809B
+#define ETHERTYPE_AARP		0x80F3
+#define	ETHERTYPE_VLAN		0x8100
+#define ETHERTYPE_IPX		0x8137
+#define	ETHERTYPE_IPV6		0x86dd
+#define ETHERTYPE_LOOPBACK	0x9000
+
+
+#define	ETHER_ADDR_LEN	ETH_ALEN
+#define	ETHER_TYPE_LEN	2
+#define	ETHER_CRC_LEN	4
+#define	ETHER_HDR_LEN	ETH_HLEN
+#define	ETHER_MIN_LEN	(ETH_ZLEN + ETHER_CRC_LEN)
+#define	ETHER_MAX_LEN	(ETH_FRAME_LEN + ETHER_CRC_LEN)
+
+#define	ETHER_IS_VALID_LEN(foo)	\
+	((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
+
+#define	ETHERTYPE_TRAIL		0x1000
+#define	ETHERTYPE_NTRAILER	16
+
+#define	ETHERMTU	ETH_DATA_LEN
+#define	ETHERMIN	(ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/net/if.h b/musl-include/arm/net/if.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/net/if.h
@@ -0,0 +1,141 @@
+#ifndef _NET_IF_H
+#define _NET_IF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define IF_NAMESIZE 16
+
+struct if_nameindex {
+	unsigned int if_index;
+	char *if_name;
+};
+
+unsigned int if_nametoindex (const char *);
+char *if_indextoname (unsigned int, char *);
+struct if_nameindex *if_nameindex (void);
+void if_freenameindex (struct if_nameindex *);
+
+
+
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#include <sys/socket.h>
+
+#define IFF_UP	0x1
+#define IFF_BROADCAST 0x2
+#define IFF_DEBUG 0x4
+#define IFF_LOOPBACK 0x8
+#define IFF_POINTOPOINT 0x10
+#define IFF_NOTRAILERS 0x20
+#define IFF_RUNNING 0x40
+#define IFF_NOARP 0x80
+#define IFF_PROMISC 0x100
+#define IFF_ALLMULTI 0x200
+#define IFF_MASTER 0x400
+#define IFF_SLAVE 0x800
+#define IFF_MULTICAST 0x1000
+#define IFF_PORTSEL 0x2000
+#define IFF_AUTOMEDIA 0x4000
+#define IFF_DYNAMIC 0x8000
+#define IFF_LOWER_UP 0x10000
+#define IFF_DORMANT 0x20000
+#define IFF_ECHO 0x40000
+#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
+        IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
+
+struct ifaddr {
+	struct sockaddr ifa_addr;
+	union {
+		struct sockaddr	ifu_broadaddr;
+		struct sockaddr	ifu_dstaddr;
+	} ifa_ifu;
+	struct iface *ifa_ifp;
+	struct ifaddr *ifa_next;
+};
+
+#define ifa_broadaddr	ifa_ifu.ifu_broadaddr
+#define ifa_dstaddr	ifa_ifu.ifu_dstaddr
+
+struct ifmap {
+	unsigned long int mem_start;
+	unsigned long int mem_end;
+	unsigned short int base_addr;
+	unsigned char irq;
+	unsigned char dma;
+	unsigned char port;
+};
+
+#define IFHWADDRLEN	6
+#define IFNAMSIZ	IF_NAMESIZE
+
+struct ifreq {
+	union {
+		char ifrn_name[IFNAMSIZ];
+	} ifr_ifrn;
+	union {
+		struct sockaddr ifru_addr;
+		struct sockaddr ifru_dstaddr;
+		struct sockaddr ifru_broadaddr;
+		struct sockaddr ifru_netmask;
+		struct sockaddr ifru_hwaddr;
+		short int ifru_flags;
+		int ifru_ivalue;
+		int ifru_mtu;
+		struct ifmap ifru_map;
+		char ifru_slave[IFNAMSIZ];
+		char ifru_newname[IFNAMSIZ];
+		char *ifru_data;
+	} ifr_ifru;
+};
+
+#define ifr_name	ifr_ifrn.ifrn_name
+#define ifr_hwaddr	ifr_ifru.ifru_hwaddr
+#define ifr_addr	ifr_ifru.ifru_addr
+#define ifr_dstaddr	ifr_ifru.ifru_dstaddr
+#define ifr_broadaddr	ifr_ifru.ifru_broadaddr
+#define ifr_netmask	ifr_ifru.ifru_netmask
+#define ifr_flags	ifr_ifru.ifru_flags
+#define ifr_metric	ifr_ifru.ifru_ivalue
+#define ifr_mtu		ifr_ifru.ifru_mtu
+#define ifr_map		ifr_ifru.ifru_map
+#define ifr_slave	ifr_ifru.ifru_slave
+#define ifr_data	ifr_ifru.ifru_data
+#define ifr_ifindex	ifr_ifru.ifru_ivalue
+#define ifr_bandwidth	ifr_ifru.ifru_ivalue
+#define ifr_qlen	ifr_ifru.ifru_ivalue
+#define ifr_newname	ifr_ifru.ifru_newname
+#define _IOT_ifreq	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0)
+#define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0)
+#define _IOT_ifreq_int	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
+
+struct ifconf {
+	int ifc_len;		
+	union {
+		char *ifcu_buf;
+		struct ifreq *ifcu_req;
+	} ifc_ifcu;
+};
+
+#define ifc_buf		ifc_ifcu.ifcu_buf
+#define ifc_req		ifc_ifcu.ifcu_req
+#define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
+
+#define __UAPI_DEF_IF_IFCONF                                    0
+#define __UAPI_DEF_IF_IFMAP                                     0
+#define __UAPI_DEF_IF_IFNAMSIZ                                  0
+#define __UAPI_DEF_IF_IFREQ                                     0
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS                          0
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO    0
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/net/if_arp.h b/musl-include/arm/net/if_arp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/net/if_arp.h
@@ -0,0 +1,142 @@
+/* Nonstandard header */
+#ifndef _NET_IF_ARP_H
+#define _NET_IF_ARP_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#define MAX_ADDR_LEN	7
+
+#define	ARPOP_REQUEST	1
+#define	ARPOP_REPLY	2
+#define	ARPOP_RREQUEST	3
+#define	ARPOP_RREPLY	4
+#define	ARPOP_InREQUEST	8
+#define	ARPOP_InREPLY	9
+#define	ARPOP_NAK	10
+
+struct arphdr {
+	uint16_t ar_hrd;
+	uint16_t ar_pro;
+	uint8_t ar_hln;
+	uint8_t ar_pln;
+	uint16_t ar_op;
+};
+
+
+#define ARPHRD_NETROM	0
+#define ARPHRD_ETHER 	1
+#define	ARPHRD_EETHER	2
+#define	ARPHRD_AX25	3
+#define	ARPHRD_PRONET	4
+#define	ARPHRD_CHAOS	5
+#define	ARPHRD_IEEE802	6
+#define	ARPHRD_ARCNET	7
+#define	ARPHRD_APPLETLK	8
+#define	ARPHRD_DLCI	15
+#define	ARPHRD_ATM	19
+#define	ARPHRD_METRICOM	23
+#define ARPHRD_IEEE1394	24
+#define ARPHRD_EUI64		27
+#define ARPHRD_INFINIBAND	32
+#define ARPHRD_SLIP	256
+#define ARPHRD_CSLIP	257
+#define ARPHRD_SLIP6	258
+#define ARPHRD_CSLIP6	259
+#define ARPHRD_RSRVD	260
+#define ARPHRD_ADAPT	264
+#define ARPHRD_ROSE	270
+#define ARPHRD_X25	271
+#define ARPHRD_HWX25	272
+#define ARPHRD_CAN	280
+#define ARPHRD_PPP	512
+#define ARPHRD_CISCO	513
+#define ARPHRD_HDLC	ARPHRD_CISCO
+#define ARPHRD_LAPB	516
+#define ARPHRD_DDCMP	517
+#define	ARPHRD_RAWHDLC	518
+#define ARPHRD_RAWIP	519
+
+#define ARPHRD_TUNNEL	768
+#define ARPHRD_TUNNEL6	769
+#define ARPHRD_FRAD	770
+#define ARPHRD_SKIP	771
+#define ARPHRD_LOOPBACK	772
+#define ARPHRD_LOCALTLK 773
+#define ARPHRD_FDDI	774
+#define ARPHRD_BIF	775
+#define ARPHRD_SIT	776
+#define ARPHRD_IPDDP	777
+#define ARPHRD_IPGRE	778
+#define ARPHRD_PIMREG	779
+#define ARPHRD_HIPPI	780
+#define ARPHRD_ASH	781
+#define ARPHRD_ECONET	782
+#define ARPHRD_IRDA	783
+#define ARPHRD_FCPP	784
+#define ARPHRD_FCAL	785
+#define ARPHRD_FCPL	786
+#define ARPHRD_FCFABRIC 787
+#define ARPHRD_IEEE802_TR 800
+#define ARPHRD_IEEE80211 801
+#define ARPHRD_IEEE80211_PRISM 802
+#define ARPHRD_IEEE80211_RADIOTAP 803
+#define ARPHRD_IEEE802154 804
+#define ARPHRD_IEEE802154_MONITOR 805
+#define ARPHRD_PHONET 820
+#define ARPHRD_PHONET_PIPE 821
+#define ARPHRD_CAIF 822
+#define ARPHRD_IP6GRE 823
+#define ARPHRD_NETLINK 824
+#define ARPHRD_6LOWPAN 825
+#define ARPHRD_VSOCKMON 826
+
+#define ARPHRD_VOID	  0xFFFF
+#define ARPHRD_NONE	  0xFFFE
+
+struct arpreq {
+	struct sockaddr arp_pa;
+	struct sockaddr arp_ha;
+	int arp_flags;
+	struct sockaddr arp_netmask;
+	char arp_dev[16];
+};
+
+struct arpreq_old {
+	struct sockaddr arp_pa;
+	struct sockaddr arp_ha;
+	int arp_flags;
+	struct sockaddr arp_netmask;
+};
+
+#define ATF_COM		0x02
+#define	ATF_PERM	0x04
+#define	ATF_PUBL	0x08
+#define	ATF_USETRAILERS	0x10
+#define ATF_NETMASK     0x20
+#define ATF_DONTPUB	0x40
+#define ATF_MAGIC	0x80
+
+#define ARPD_UPDATE	0x01
+#define ARPD_LOOKUP	0x02
+#define ARPD_FLUSH	0x03
+
+struct arpd_request {
+	unsigned short req;
+	uint32_t ip;
+	unsigned long dev;
+	unsigned long stamp;
+	unsigned long updated;
+	unsigned char ha[MAX_ADDR_LEN];
+};
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/net/route.h b/musl-include/arm/net/route.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/net/route.h
@@ -0,0 +1,124 @@
+#ifndef _NET_ROUTE_H
+#define _NET_ROUTE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+
+struct rtentry {
+	unsigned long int rt_pad1;
+	struct sockaddr rt_dst;
+	struct sockaddr rt_gateway;
+	struct sockaddr rt_genmask;
+	unsigned short int rt_flags;
+	short int rt_pad2;
+	unsigned long int rt_pad3;
+	unsigned char rt_tos;
+	unsigned char rt_class;
+	short int rt_pad4[sizeof(long)/2-1];
+	short int rt_metric;
+	char *rt_dev;
+	unsigned long int rt_mtu;
+	unsigned long int rt_window;
+	unsigned short int rt_irtt;
+};
+
+#define rt_mss	rt_mtu
+
+
+struct in6_rtmsg {
+	struct in6_addr rtmsg_dst;
+	struct in6_addr rtmsg_src;
+	struct in6_addr rtmsg_gateway;
+	uint32_t rtmsg_type;
+	uint16_t rtmsg_dst_len;
+	uint16_t rtmsg_src_len;
+	uint32_t rtmsg_metric;
+	unsigned long int rtmsg_info;
+	uint32_t rtmsg_flags;
+	int rtmsg_ifindex;
+};
+
+
+#define	RTF_UP		0x0001
+#define	RTF_GATEWAY	0x0002
+
+#define	RTF_HOST	0x0004
+#define RTF_REINSTATE	0x0008
+#define	RTF_DYNAMIC	0x0010
+#define	RTF_MODIFIED	0x0020
+#define RTF_MTU		0x0040
+#define RTF_MSS		RTF_MTU
+#define RTF_WINDOW	0x0080
+#define RTF_IRTT	0x0100
+#define RTF_REJECT	0x0200
+#define	RTF_STATIC	0x0400
+#define	RTF_XRESOLVE	0x0800
+#define RTF_NOFORWARD   0x1000
+#define RTF_THROW	0x2000
+#define RTF_NOPMTUDISC  0x4000
+
+#define RTF_DEFAULT	0x00010000
+#define RTF_ALLONLINK	0x00020000
+#define RTF_ADDRCONF	0x00040000
+
+#define RTF_LINKRT	0x00100000
+#define RTF_NONEXTHOP	0x00200000
+
+#define RTF_CACHE	0x01000000
+#define RTF_FLOW	0x02000000
+#define RTF_POLICY	0x04000000
+
+#define RTCF_VALVE	0x00200000
+#define RTCF_MASQ	0x00400000
+#define RTCF_NAT	0x00800000
+#define RTCF_DOREDIRECT 0x01000000
+#define RTCF_LOG	0x02000000
+#define RTCF_DIRECTSRC	0x04000000
+
+#define RTF_LOCAL	0x80000000
+#define RTF_INTERFACE	0x40000000
+#define RTF_MULTICAST	0x20000000
+#define RTF_BROADCAST	0x10000000
+#define RTF_NAT		0x08000000
+
+#define RTF_ADDRCLASSMASK	0xF8000000
+#define RT_ADDRCLASS(flags)	((uint32_t) flags >> 23)
+
+#define RT_TOS(tos)		((tos) & IPTOS_TOS_MASK)
+
+#define RT_LOCALADDR(flags)	((flags & RTF_ADDRCLASSMASK) \
+				 == (RTF_LOCAL|RTF_INTERFACE))
+
+#define RT_CLASS_UNSPEC		0
+#define RT_CLASS_DEFAULT	253
+
+#define RT_CLASS_MAIN		254
+#define RT_CLASS_LOCAL		255
+#define RT_CLASS_MAX		255
+
+
+#define RTMSG_ACK		NLMSG_ACK
+#define RTMSG_OVERRUN		NLMSG_OVERRUN
+
+#define RTMSG_NEWDEVICE		0x11
+#define RTMSG_DELDEVICE		0x12
+#define RTMSG_NEWROUTE		0x21
+#define RTMSG_DELROUTE		0x22
+#define RTMSG_NEWRULE		0x31
+#define RTMSG_DELRULE		0x32
+#define RTMSG_CONTROL		0x40
+
+#define RTMSG_AR_FAILED		0x51
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/netdb.h b/musl-include/arm/netdb.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netdb.h
@@ -0,0 +1,157 @@
+#ifndef	_NETDB_H
+#define	_NETDB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_size_t
+#include <bits/alltypes.h>
+#endif
+
+struct addrinfo {
+	int ai_flags;
+	int ai_family;
+	int ai_socktype;
+	int ai_protocol;
+	socklen_t ai_addrlen;
+	struct sockaddr *ai_addr;
+	char *ai_canonname;
+	struct addrinfo *ai_next;
+};
+
+#define AI_PASSIVE      0x01
+#define AI_CANONNAME    0x02
+#define AI_NUMERICHOST  0x04
+#define AI_V4MAPPED     0x08
+#define AI_ALL          0x10
+#define AI_ADDRCONFIG   0x20
+#define AI_NUMERICSERV  0x400
+
+
+#define NI_NUMERICHOST  0x01
+#define NI_NUMERICSERV  0x02
+#define NI_NOFQDN       0x04
+#define NI_NAMEREQD     0x08
+#define NI_DGRAM        0x10
+#define NI_NUMERICSCOPE 0x100
+
+#define EAI_BADFLAGS   -1
+#define EAI_NONAME     -2
+#define EAI_AGAIN      -3
+#define EAI_FAIL       -4
+#define EAI_NODATA     -5
+#define EAI_FAMILY     -6
+#define EAI_SOCKTYPE   -7
+#define EAI_SERVICE    -8
+#define EAI_MEMORY     -10
+#define EAI_SYSTEM     -11
+#define EAI_OVERFLOW   -12
+
+int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
+void freeaddrinfo (struct addrinfo *);
+int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
+const char *gai_strerror(int);
+
+
+/* Legacy functions follow (marked OBsolete in SUS) */
+
+struct netent {
+	char *n_name;
+	char **n_aliases;
+	int n_addrtype;
+	uint32_t n_net;
+};
+
+struct hostent {
+	char *h_name;
+	char **h_aliases;
+	int h_addrtype;
+	int h_length;
+	char **h_addr_list;
+};
+#define h_addr h_addr_list[0]
+
+struct servent {
+	char *s_name;
+	char **s_aliases;
+	int s_port;
+	char *s_proto;
+};
+
+struct protoent {
+	char *p_name;
+	char **p_aliases;
+	int p_proto;
+};
+
+void sethostent (int);
+void endhostent (void);
+struct hostent *gethostent (void);
+
+void setnetent (int);
+void endnetent (void);
+struct netent *getnetent (void);
+struct netent *getnetbyaddr (uint32_t, int);
+struct netent *getnetbyname (const char *);
+
+void setservent (int);
+void endservent (void);
+struct servent *getservent (void);
+struct servent *getservbyname (const char *, const char *);
+struct servent *getservbyport (int, const char *);
+
+void setprotoent (int);
+void endprotoent (void);
+struct protoent *getprotoent (void);
+struct protoent *getprotobyname (const char *);
+struct protoent *getprotobynumber (int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+struct hostent *gethostbyname (const char *);
+struct hostent *gethostbyaddr (const void *, socklen_t, int);
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int *__h_errno_location(void);
+#define h_errno (*__h_errno_location())
+#define HOST_NOT_FOUND 1
+#define TRY_AGAIN      2
+#define NO_RECOVERY    3
+#define NO_DATA        4
+#define NO_ADDRESS     NO_DATA
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void herror(const char *);
+const char *hstrerror(int);
+int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
+int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
+struct hostent *gethostbyname2(const char *, int);
+int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
+int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
+int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
+#define EAI_NODATA     -5
+#define EAI_ADDRFAMILY -9
+#define EAI_INPROGRESS -100
+#define EAI_CANCELED   -101
+#define EAI_NOTCANCELED -102
+#define EAI_ALLDONE    -103
+#define EAI_INTR       -104
+#define EAI_IDN_ENCODE -105
+#define NI_MAXHOST 255
+#define NI_MAXSERV 32
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/netinet/ether.h b/musl-include/arm/netinet/ether.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/ether.h
@@ -0,0 +1,22 @@
+#ifndef _NETINET_ETHER_H
+#define _NETINET_ETHER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <netinet/if_ether.h>
+
+char *ether_ntoa (const struct ether_addr *);
+struct ether_addr *ether_aton (const char *);
+char *ether_ntoa_r (const struct ether_addr *, char *);
+struct ether_addr *ether_aton_r (const char *, struct ether_addr *);
+int ether_line(const char *, struct ether_addr *, char *);
+int ether_ntohost(char *, const struct ether_addr *);
+int ether_hostton(const char *, struct ether_addr *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/netinet/icmp6.h b/musl-include/arm/netinet/icmp6.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/icmp6.h
@@ -0,0 +1,305 @@
+#ifndef _NETINET_ICMP6_H
+#define _NETINET_ICMP6_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#define ICMP6_FILTER 1
+
+#define ICMP6_FILTER_BLOCK		1
+#define ICMP6_FILTER_PASS		2
+#define ICMP6_FILTER_BLOCKOTHERS	3
+#define ICMP6_FILTER_PASSONLY		4
+
+struct icmp6_filter {
+	uint32_t icmp6_filt[8];
+};
+
+struct icmp6_hdr {
+	uint8_t     icmp6_type;
+	uint8_t     icmp6_code;
+	uint16_t    icmp6_cksum;
+	union {
+		uint32_t  icmp6_un_data32[1];
+		uint16_t  icmp6_un_data16[2];
+		uint8_t   icmp6_un_data8[4];
+	} icmp6_dataun;
+};
+
+#define icmp6_data32    icmp6_dataun.icmp6_un_data32
+#define icmp6_data16    icmp6_dataun.icmp6_un_data16
+#define icmp6_data8     icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr      icmp6_data32[0]
+#define icmp6_mtu       icmp6_data32[0]
+#define icmp6_id        icmp6_data16[0]
+#define icmp6_seq       icmp6_data16[1]
+#define icmp6_maxdelay  icmp6_data16[0]
+
+#define ICMP6_DST_UNREACH             1
+#define ICMP6_PACKET_TOO_BIG          2
+#define ICMP6_TIME_EXCEEDED           3
+#define ICMP6_PARAM_PROB              4
+
+#define ICMP6_INFOMSG_MASK  0x80
+
+#define ICMP6_ECHO_REQUEST          128
+#define ICMP6_ECHO_REPLY            129
+#define MLD_LISTENER_QUERY          130
+#define MLD_LISTENER_REPORT         131
+#define MLD_LISTENER_REDUCTION      132
+
+#define ICMP6_DST_UNREACH_NOROUTE     0
+#define ICMP6_DST_UNREACH_ADMIN       1
+#define ICMP6_DST_UNREACH_BEYONDSCOPE 2
+#define ICMP6_DST_UNREACH_ADDR        3
+#define ICMP6_DST_UNREACH_NOPORT      4
+
+#define ICMP6_TIME_EXCEED_TRANSIT     0
+#define ICMP6_TIME_EXCEED_REASSEMBLY  1
+
+#define ICMP6_PARAMPROB_HEADER        0
+#define ICMP6_PARAMPROB_NEXTHEADER    1
+#define ICMP6_PARAMPROB_OPTION        2
+
+#define ICMP6_FILTER_WILLPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+
+#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+
+#define ICMP6_FILTER_SETPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) |=  (1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETPASSALL(filterp) \
+	memset (filterp, 0, sizeof (struct icmp6_filter));
+
+#define ICMP6_FILTER_SETBLOCKALL(filterp) \
+	memset (filterp, 0xFF, sizeof (struct icmp6_filter));
+
+#define ND_ROUTER_SOLICIT           133
+#define ND_ROUTER_ADVERT            134
+#define ND_NEIGHBOR_SOLICIT         135
+#define ND_NEIGHBOR_ADVERT          136
+#define ND_REDIRECT                 137
+
+struct nd_router_solicit {
+	struct icmp6_hdr  nd_rs_hdr;
+};
+
+#define nd_rs_type               nd_rs_hdr.icmp6_type
+#define nd_rs_code               nd_rs_hdr.icmp6_code
+#define nd_rs_cksum              nd_rs_hdr.icmp6_cksum
+#define nd_rs_reserved           nd_rs_hdr.icmp6_data32[0]
+
+struct nd_router_advert {
+	struct icmp6_hdr  nd_ra_hdr;
+	uint32_t   nd_ra_reachable;
+	uint32_t   nd_ra_retransmit;
+};
+
+#define nd_ra_type               nd_ra_hdr.icmp6_type
+#define nd_ra_code               nd_ra_hdr.icmp6_code
+#define nd_ra_cksum              nd_ra_hdr.icmp6_cksum
+#define nd_ra_curhoplimit        nd_ra_hdr.icmp6_data8[0]
+#define nd_ra_flags_reserved     nd_ra_hdr.icmp6_data8[1]
+#define ND_RA_FLAG_MANAGED       0x80
+#define ND_RA_FLAG_OTHER         0x40
+#define ND_RA_FLAG_HOME_AGENT    0x20
+#define nd_ra_router_lifetime    nd_ra_hdr.icmp6_data16[1]
+
+struct nd_neighbor_solicit {
+	struct icmp6_hdr  nd_ns_hdr;
+	struct in6_addr   nd_ns_target;
+};
+
+#define nd_ns_type               nd_ns_hdr.icmp6_type
+#define nd_ns_code               nd_ns_hdr.icmp6_code
+#define nd_ns_cksum              nd_ns_hdr.icmp6_cksum
+#define nd_ns_reserved           nd_ns_hdr.icmp6_data32[0]
+
+struct nd_neighbor_advert {
+	struct icmp6_hdr  nd_na_hdr;
+	struct in6_addr   nd_na_target;
+};
+
+#define nd_na_type               nd_na_hdr.icmp6_type
+#define nd_na_code               nd_na_hdr.icmp6_code
+#define nd_na_cksum              nd_na_hdr.icmp6_cksum
+#define nd_na_flags_reserved     nd_na_hdr.icmp6_data32[0]
+#if     __BYTE_ORDER == __BIG_ENDIAN
+#define ND_NA_FLAG_ROUTER        0x80000000
+#define ND_NA_FLAG_SOLICITED     0x40000000
+#define ND_NA_FLAG_OVERRIDE      0x20000000
+#else
+#define ND_NA_FLAG_ROUTER        0x00000080
+#define ND_NA_FLAG_SOLICITED     0x00000040
+#define ND_NA_FLAG_OVERRIDE      0x00000020
+#endif
+
+struct nd_redirect {
+	struct icmp6_hdr  nd_rd_hdr;
+	struct in6_addr   nd_rd_target;
+	struct in6_addr   nd_rd_dst;
+};
+
+#define nd_rd_type               nd_rd_hdr.icmp6_type
+#define nd_rd_code               nd_rd_hdr.icmp6_code
+#define nd_rd_cksum              nd_rd_hdr.icmp6_cksum
+#define nd_rd_reserved           nd_rd_hdr.icmp6_data32[0]
+
+struct nd_opt_hdr {
+	uint8_t  nd_opt_type;
+	uint8_t  nd_opt_len;
+};
+
+#define ND_OPT_SOURCE_LINKADDR		1
+#define ND_OPT_TARGET_LINKADDR		2
+#define ND_OPT_PREFIX_INFORMATION	3
+#define ND_OPT_REDIRECTED_HEADER	4
+#define ND_OPT_MTU			5
+#define ND_OPT_RTR_ADV_INTERVAL		7
+#define ND_OPT_HOME_AGENT_INFO		8
+
+struct nd_opt_prefix_info {
+	uint8_t   nd_opt_pi_type;
+	uint8_t   nd_opt_pi_len;
+	uint8_t   nd_opt_pi_prefix_len;
+	uint8_t   nd_opt_pi_flags_reserved;
+	uint32_t  nd_opt_pi_valid_time;
+	uint32_t  nd_opt_pi_preferred_time;
+	uint32_t  nd_opt_pi_reserved2;
+	struct in6_addr  nd_opt_pi_prefix;
+};
+
+#define ND_OPT_PI_FLAG_ONLINK	0x80
+#define ND_OPT_PI_FLAG_AUTO	0x40
+#define ND_OPT_PI_FLAG_RADDR	0x20
+
+struct nd_opt_rd_hdr {
+	uint8_t   nd_opt_rh_type;
+	uint8_t   nd_opt_rh_len;
+	uint16_t  nd_opt_rh_reserved1;
+	uint32_t  nd_opt_rh_reserved2;
+};
+
+struct nd_opt_mtu {
+	uint8_t   nd_opt_mtu_type;
+	uint8_t   nd_opt_mtu_len;
+	uint16_t  nd_opt_mtu_reserved;
+	uint32_t  nd_opt_mtu_mtu;
+};
+
+struct mld_hdr {
+	struct icmp6_hdr    mld_icmp6_hdr;
+	struct in6_addr     mld_addr;
+};
+
+#define mld_type        mld_icmp6_hdr.icmp6_type
+#define mld_code        mld_icmp6_hdr.icmp6_code
+#define mld_cksum       mld_icmp6_hdr.icmp6_cksum
+#define mld_maxdelay    mld_icmp6_hdr.icmp6_data16[0]
+#define mld_reserved    mld_icmp6_hdr.icmp6_data16[1]
+
+#define ICMP6_ROUTER_RENUMBERING    138
+
+struct icmp6_router_renum {
+	struct icmp6_hdr    rr_hdr;
+	uint8_t             rr_segnum;
+	uint8_t             rr_flags;
+	uint16_t            rr_maxdelay;
+	uint32_t            rr_reserved;
+};
+
+#define rr_type		rr_hdr.icmp6_type
+#define rr_code         rr_hdr.icmp6_code
+#define rr_cksum        rr_hdr.icmp6_cksum
+#define rr_seqnum       rr_hdr.icmp6_data32[0]
+
+#define ICMP6_RR_FLAGS_TEST             0x80
+#define ICMP6_RR_FLAGS_REQRESULT        0x40
+#define ICMP6_RR_FLAGS_FORCEAPPLY       0x20
+#define ICMP6_RR_FLAGS_SPECSITE         0x10
+#define ICMP6_RR_FLAGS_PREVDONE         0x08
+
+struct rr_pco_match {
+	uint8_t             rpm_code;
+	uint8_t             rpm_len;
+	uint8_t             rpm_ordinal;
+	uint8_t             rpm_matchlen;
+	uint8_t             rpm_minlen;
+	uint8_t             rpm_maxlen;
+	uint16_t            rpm_reserved;
+	struct in6_addr     rpm_prefix;
+};
+
+#define RPM_PCO_ADD             1
+#define RPM_PCO_CHANGE          2
+#define RPM_PCO_SETGLOBAL       3
+
+struct rr_pco_use {
+	uint8_t             rpu_uselen;
+	uint8_t             rpu_keeplen;
+	uint8_t             rpu_ramask;
+	uint8_t             rpu_raflags;
+	uint32_t            rpu_vltime;
+	uint32_t            rpu_pltime;
+	uint32_t            rpu_flags;
+	struct in6_addr     rpu_prefix;
+};
+
+#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK  0x20
+#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO    0x10
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
+#else
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
+#endif
+
+struct rr_result {
+	uint16_t            rrr_flags;
+	uint8_t             rrr_ordinal;
+	uint8_t             rrr_matchedlen;
+	uint32_t            rrr_ifid;
+	struct in6_addr     rrr_prefix;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ICMP6_RR_RESULT_FLAGS_OOB       0x0002
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
+#else
+#define ICMP6_RR_RESULT_FLAGS_OOB       0x0200
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
+#endif
+
+struct nd_opt_adv_interval {
+	uint8_t   nd_opt_adv_interval_type;
+	uint8_t   nd_opt_adv_interval_len;
+	uint16_t  nd_opt_adv_interval_reserved;
+	uint32_t  nd_opt_adv_interval_ival;
+};
+
+struct nd_opt_home_agent_info {
+	uint8_t   nd_opt_home_agent_info_type;
+	uint8_t   nd_opt_home_agent_info_len;
+	uint16_t  nd_opt_home_agent_info_reserved;
+	uint16_t  nd_opt_home_agent_info_preference;
+	uint16_t  nd_opt_home_agent_info_lifetime;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/netinet/if_ether.h b/musl-include/arm/netinet/if_ether.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/if_ether.h
@@ -0,0 +1,149 @@
+#ifndef _NETINET_IF_ETHER_H
+#define _NETINET_IF_ETHER_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#define ETH_ALEN	6
+#define ETH_TLEN	2
+#define ETH_HLEN	14
+#define ETH_ZLEN	60
+#define ETH_DATA_LEN	1500
+#define ETH_FRAME_LEN	1514
+#define ETH_FCS_LEN	4
+#define ETH_MIN_MTU	68
+#define ETH_MAX_MTU	0xFFFFU
+
+#define ETH_P_LOOP	0x0060
+#define ETH_P_PUP	0x0200
+#define ETH_P_PUPAT	0x0201
+#define ETH_P_TSN	0x22F0
+#define ETH_P_ERSPAN2	0x22EB
+#define ETH_P_IP	0x0800
+#define ETH_P_X25	0x0805
+#define ETH_P_ARP	0x0806
+#define	ETH_P_BPQ	0x08FF
+#define ETH_P_IEEEPUP	0x0a00
+#define ETH_P_IEEEPUPAT	0x0a01
+#define ETH_P_BATMAN	0x4305
+#define ETH_P_DEC       0x6000
+#define ETH_P_DNA_DL    0x6001
+#define ETH_P_DNA_RC    0x6002
+#define ETH_P_DNA_RT    0x6003
+#define ETH_P_LAT       0x6004
+#define ETH_P_DIAG      0x6005
+#define ETH_P_CUST      0x6006
+#define ETH_P_SCA       0x6007
+#define ETH_P_TEB	0x6558
+#define ETH_P_RARP      0x8035
+#define ETH_P_ATALK	0x809B
+#define ETH_P_AARP	0x80F3
+#define ETH_P_8021Q	0x8100
+#define ETH_P_IPX	0x8137
+#define ETH_P_IPV6	0x86DD
+#define ETH_P_PAUSE	0x8808
+#define ETH_P_SLOW	0x8809
+#define ETH_P_WCCP	0x883E
+#define ETH_P_MPLS_UC	0x8847
+#define ETH_P_MPLS_MC	0x8848
+#define ETH_P_ATMMPOA	0x884c
+#define ETH_P_PPP_DISC	0x8863
+#define ETH_P_PPP_SES	0x8864
+#define ETH_P_LINK_CTL	0x886c
+#define ETH_P_ATMFATE	0x8884
+#define ETH_P_PAE	0x888E
+#define ETH_P_AOE	0x88A2
+#define ETH_P_8021AD	0x88A8
+#define ETH_P_802_EX1	0x88B5
+#define ETH_P_ERSPAN	0x88BE
+#define ETH_P_PREAUTH	0x88C7
+#define ETH_P_TIPC	0x88CA
+#define ETH_P_LLDP	0x88CC
+#define ETH_P_MRP	0x88E3
+#define ETH_P_MACSEC	0x88E5
+#define ETH_P_8021AH	0x88E7
+#define ETH_P_MVRP	0x88F5
+#define ETH_P_1588	0x88F7
+#define ETH_P_NCSI	0x88F8
+#define ETH_P_PRP	0x88FB
+#define ETH_P_CFM	0x8902
+#define ETH_P_FCOE	0x8906
+#define ETH_P_TDLS	0x890D
+#define ETH_P_FIP	0x8914
+#define ETH_P_IBOE	0x8915
+#define ETH_P_80221	0x8917
+#define ETH_P_HSR	0x892F
+#define ETH_P_NSH	0x894F
+#define ETH_P_LOOPBACK	0x9000
+#define ETH_P_QINQ1	0x9100
+#define ETH_P_QINQ2	0x9200
+#define ETH_P_QINQ3	0x9300
+#define ETH_P_EDSA	0xDADA
+#define ETH_P_DSA_8021Q	0xDADB
+#define ETH_P_IFE	0xED3E
+#define ETH_P_AF_IUCV	0xFBFB
+
+#define ETH_P_802_3_MIN	0x0600
+
+#define ETH_P_802_3	0x0001
+#define ETH_P_AX25	0x0002
+#define ETH_P_ALL	0x0003
+#define ETH_P_802_2	0x0004
+#define ETH_P_SNAP	0x0005
+#define ETH_P_DDCMP     0x0006
+#define ETH_P_WAN_PPP   0x0007
+#define ETH_P_PPP_MP    0x0008
+#define ETH_P_LOCALTALK 0x0009
+#define ETH_P_CAN	0x000C
+#define ETH_P_CANFD	0x000D
+#define ETH_P_PPPTALK	0x0010
+#define ETH_P_TR_802_2	0x0011
+#define ETH_P_MOBITEX	0x0015
+#define ETH_P_CONTROL	0x0016
+#define ETH_P_IRDA	0x0017
+#define ETH_P_ECONET	0x0018
+#define ETH_P_HDLC	0x0019
+#define ETH_P_ARCNET	0x001A
+#define ETH_P_DSA	0x001B
+#define ETH_P_TRAILER	0x001C
+#define ETH_P_PHONET	0x00F5
+#define ETH_P_IEEE802154 0x00F6
+#define ETH_P_CAIF	0x00F7
+#define ETH_P_XDSA	0x00F8
+#define ETH_P_MAP	0x00F9
+
+struct ethhdr {
+	uint8_t h_dest[ETH_ALEN];
+	uint8_t h_source[ETH_ALEN];
+	uint16_t h_proto;
+};
+
+#include <net/ethernet.h>
+#include <net/if_arp.h>
+
+struct	ether_arp {
+	struct	arphdr ea_hdr;
+	uint8_t arp_sha[ETH_ALEN];
+	uint8_t arp_spa[4];
+	uint8_t arp_tha[ETH_ALEN];
+	uint8_t arp_tpa[4];
+};
+#define	arp_hrd	ea_hdr.ar_hrd
+#define	arp_pro	ea_hdr.ar_pro
+#define	arp_hln	ea_hdr.ar_hln
+#define	arp_pln	ea_hdr.ar_pln
+#define	arp_op	ea_hdr.ar_op
+
+#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
+do { \
+	(enaddr)[0] = 0x01; \
+	(enaddr)[1] = 0x00; \
+	(enaddr)[2] = 0x5e; \
+	(enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
+	(enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
+	(enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
+} while(0)
+
+#define __UAPI_DEF_ETHHDR       0
+
+#endif
diff --git a/musl-include/arm/netinet/igmp.h b/musl-include/arm/netinet/igmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/igmp.h
@@ -0,0 +1,45 @@
+#ifndef _NETINET_IGMP_H
+#define _NETINET_IGMP_H
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct igmp {
+	uint8_t igmp_type;
+	uint8_t igmp_code;
+	uint16_t igmp_cksum;
+	struct in_addr igmp_group;
+};
+
+#define IGMP_MINLEN			8
+
+#define IGMP_MEMBERSHIP_QUERY   	0x11
+#define IGMP_V1_MEMBERSHIP_REPORT	0x12
+#define IGMP_V2_MEMBERSHIP_REPORT	0x16
+#define IGMP_V2_LEAVE_GROUP		0x17
+
+#define IGMP_DVMRP			0x13
+#define IGMP_PIM			0x14
+#define IGMP_TRACE			0x15
+
+#define IGMP_MTRACE_RESP		0x1e
+#define IGMP_MTRACE			0x1f
+
+#define IGMP_MAX_HOST_REPORT_DELAY	10
+#define IGMP_TIMER_SCALE		10
+
+#define IGMP_DELAYING_MEMBER	1
+#define IGMP_IDLE_MEMBER	2
+#define IGMP_LAZY_MEMBER	3
+#define IGMP_SLEEPING_MEMBER	4
+#define IGMP_AWAKENING_MEMBER	5
+
+#define IGMP_v1_ROUTER		1
+#define IGMP_v2_ROUTER		2
+
+#define IGMP_HOST_MEMBERSHIP_QUERY	IGMP_MEMBERSHIP_QUERY
+#define IGMP_HOST_MEMBERSHIP_REPORT	IGMP_V1_MEMBERSHIP_REPORT
+#define IGMP_HOST_NEW_MEMBERSHIP_REPORT	IGMP_V2_MEMBERSHIP_REPORT
+#define IGMP_HOST_LEAVE_MESSAGE		IGMP_V2_LEAVE_GROUP
+
+#endif
diff --git a/musl-include/arm/netinet/in.h b/musl-include/arm/netinet/in.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/in.h
@@ -0,0 +1,417 @@
+#ifndef	_NETINET_IN_H
+#define	_NETINET_IN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <inttypes.h>
+#include <sys/socket.h>
+
+typedef uint16_t in_port_t;
+typedef uint32_t in_addr_t;
+struct in_addr { in_addr_t s_addr; };
+
+struct sockaddr_in {
+	sa_family_t sin_family;
+	in_port_t sin_port;
+	struct in_addr sin_addr;
+	uint8_t sin_zero[8];
+};
+
+struct in6_addr {
+	union {
+		uint8_t __s6_addr[16];
+		uint16_t __s6_addr16[8];
+		uint32_t __s6_addr32[4];
+	} __in6_union;
+};
+#define s6_addr __in6_union.__s6_addr
+#define s6_addr16 __in6_union.__s6_addr16
+#define s6_addr32 __in6_union.__s6_addr32
+
+struct sockaddr_in6 {
+	sa_family_t     sin6_family;
+	in_port_t       sin6_port;
+	uint32_t        sin6_flowinfo;
+	struct in6_addr sin6_addr;
+	uint32_t        sin6_scope_id;
+};
+
+struct ipv6_mreq {
+	struct in6_addr ipv6mr_multiaddr;
+	unsigned        ipv6mr_interface;
+};
+
+#define INADDR_ANY        ((in_addr_t) 0x00000000)
+#define INADDR_BROADCAST  ((in_addr_t) 0xffffffff)
+#define INADDR_NONE       ((in_addr_t) 0xffffffff)
+#define INADDR_LOOPBACK   ((in_addr_t) 0x7f000001)
+#define INADDR_DUMMY      ((in_addr_t) 0xc0000008)
+
+#define INADDR_UNSPEC_GROUP     ((in_addr_t) 0xe0000000)
+#define INADDR_ALLHOSTS_GROUP   ((in_addr_t) 0xe0000001)
+#define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002)
+#define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a)
+#define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff)
+
+#define IN6ADDR_ANY_INIT      { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
+#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
+
+extern const struct in6_addr in6addr_any, in6addr_loopback;
+
+#define INET_ADDRSTRLEN  16
+#define INET6_ADDRSTRLEN 46
+
+uint32_t htonl(uint32_t);
+uint16_t htons(uint16_t);
+uint32_t ntohl(uint32_t);
+uint16_t ntohs(uint16_t);
+
+#define IPPORT_RESERVED 1024
+
+#define IPPROTO_IP       0
+#define IPPROTO_HOPOPTS  0
+#define IPPROTO_ICMP     1
+#define IPPROTO_IGMP     2
+#define IPPROTO_IPIP     4
+#define IPPROTO_TCP      6
+#define IPPROTO_EGP      8
+#define IPPROTO_PUP      12
+#define IPPROTO_UDP      17
+#define IPPROTO_IDP      22
+#define IPPROTO_TP       29
+#define IPPROTO_DCCP     33
+#define IPPROTO_IPV6     41
+#define IPPROTO_ROUTING  43
+#define IPPROTO_FRAGMENT 44
+#define IPPROTO_RSVP     46
+#define IPPROTO_GRE      47
+#define IPPROTO_ESP      50
+#define IPPROTO_AH       51
+#define IPPROTO_ICMPV6   58
+#define IPPROTO_NONE     59
+#define IPPROTO_DSTOPTS  60
+#define IPPROTO_MTP      92
+#define IPPROTO_BEETPH   94
+#define IPPROTO_ENCAP    98
+#define IPPROTO_PIM      103
+#define IPPROTO_COMP     108
+#define IPPROTO_SCTP     132
+#define IPPROTO_MH       135
+#define IPPROTO_UDPLITE  136
+#define IPPROTO_MPLS     137
+#define IPPROTO_ETHERNET 143
+#define IPPROTO_RAW      255
+#define IPPROTO_MPTCP    262
+#define IPPROTO_MAX      263
+
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
+
+#define IN6_IS_ADDR_LOOPBACK(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && \
+         ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \
+         ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
+
+#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
+
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
+
+#define IN6_IS_ADDR_SITELOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \
+         ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
+
+#define IN6_IS_ADDR_V4COMPAT(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
+
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
+
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
+
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
+
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
+
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
+
+#define __ARE_4_EQUAL(a,b) \
+	(!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) ))
+#define IN6_ARE_ADDR_EQUAL(a,b) \
+	__ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
+
+#define	IN_CLASSA(a)		((((in_addr_t)(a)) & 0x80000000) == 0)
+#define	IN_CLASSA_NET		0xff000000
+#define	IN_CLASSA_NSHIFT	24
+#define	IN_CLASSA_HOST		(0xffffffff & ~IN_CLASSA_NET)
+#define	IN_CLASSA_MAX		128
+#define	IN_CLASSB(a)		((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
+#define	IN_CLASSB_NET		0xffff0000
+#define	IN_CLASSB_NSHIFT	16
+#define	IN_CLASSB_HOST		(0xffffffff & ~IN_CLASSB_NET)
+#define	IN_CLASSB_MAX		65536
+#define	IN_CLASSC(a)		((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
+#define	IN_CLASSC_NET		0xffffff00
+#define	IN_CLASSC_NSHIFT	8
+#define	IN_CLASSC_HOST		(0xffffffff & ~IN_CLASSC_NET)
+#define	IN_CLASSD(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
+#define	IN_MULTICAST(a)		IN_CLASSD(a)
+#define	IN_EXPERIMENTAL(a)	((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
+#define	IN_BADCLASS(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
+
+#define IN_LOOPBACKNET 127
+
+
+#define IP_TOS             1
+#define IP_TTL             2
+#define IP_HDRINCL         3
+#define IP_OPTIONS         4
+#define IP_ROUTER_ALERT    5
+#define IP_RECVOPTS        6
+#define IP_RETOPTS         7
+#define IP_PKTINFO         8
+#define IP_PKTOPTIONS      9
+#define IP_PMTUDISC        10
+#define IP_MTU_DISCOVER    10
+#define IP_RECVERR         11
+#define IP_RECVTTL         12
+#define IP_RECVTOS         13
+#define IP_MTU             14
+#define IP_FREEBIND        15
+#define IP_IPSEC_POLICY    16
+#define IP_XFRM_POLICY     17
+#define IP_PASSSEC         18
+#define IP_TRANSPARENT     19
+#define IP_ORIGDSTADDR     20
+#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
+#define IP_MINTTL          21
+#define IP_NODEFRAG        22
+#define IP_CHECKSUM        23
+#define IP_BIND_ADDRESS_NO_PORT 24
+#define IP_RECVFRAGSIZE    25
+#define IP_RECVERR_RFC4884 26
+#define IP_MULTICAST_IF    32
+#define IP_MULTICAST_TTL   33
+#define IP_MULTICAST_LOOP  34
+#define IP_ADD_MEMBERSHIP  35
+#define IP_DROP_MEMBERSHIP 36
+#define IP_UNBLOCK_SOURCE  37
+#define IP_BLOCK_SOURCE    38
+#define IP_ADD_SOURCE_MEMBERSHIP  39
+#define IP_DROP_SOURCE_MEMBERSHIP 40
+#define IP_MSFILTER        41
+#define IP_MULTICAST_ALL   49
+#define IP_UNICAST_IF      50
+
+#define IP_RECVRETOPTS IP_RETOPTS
+
+#define IP_PMTUDISC_DONT   0
+#define IP_PMTUDISC_WANT   1
+#define IP_PMTUDISC_DO     2
+#define IP_PMTUDISC_PROBE  3
+#define IP_PMTUDISC_INTERFACE 4
+#define IP_PMTUDISC_OMIT   5
+
+#define IP_DEFAULT_MULTICAST_TTL        1
+#define IP_DEFAULT_MULTICAST_LOOP       1
+#define IP_MAX_MEMBERSHIPS              20
+
+struct ip_opts {
+	struct in_addr ip_dst;
+	char ip_opts[40];
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define MCAST_JOIN_GROUP   42
+#define MCAST_BLOCK_SOURCE 43
+#define MCAST_UNBLOCK_SOURCE      44
+#define MCAST_LEAVE_GROUP  45
+#define MCAST_JOIN_SOURCE_GROUP   46
+#define MCAST_LEAVE_SOURCE_GROUP  47
+#define MCAST_MSFILTER     48
+
+#define MCAST_EXCLUDE 0
+#define MCAST_INCLUDE 1
+
+struct ip_mreq {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_interface;
+};
+
+struct ip_mreqn {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_address;
+	int imr_ifindex;
+};
+
+struct ip_mreq_source {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_interface;
+	struct in_addr imr_sourceaddr;
+};
+
+struct ip_msfilter {
+	struct in_addr imsf_multiaddr;
+	struct in_addr imsf_interface;
+	uint32_t imsf_fmode;
+	uint32_t imsf_numsrc;
+	struct in_addr imsf_slist[1];
+};
+#define IP_MSFILTER_SIZE(numsrc) \
+	(sizeof(struct ip_msfilter) - sizeof(struct in_addr) \
+	+ (numsrc) * sizeof(struct in_addr))
+
+struct group_req {
+	uint32_t gr_interface;
+	struct sockaddr_storage gr_group;
+};
+
+struct group_source_req {
+	uint32_t gsr_interface;
+	struct sockaddr_storage gsr_group;
+	struct sockaddr_storage gsr_source;
+};
+
+struct group_filter {
+	uint32_t gf_interface;
+	struct sockaddr_storage gf_group;
+	uint32_t gf_fmode;
+	uint32_t gf_numsrc;
+	struct sockaddr_storage gf_slist[1];
+};
+#define GROUP_FILTER_SIZE(numsrc) \
+	(sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \
+	+ (numsrc) * sizeof(struct sockaddr_storage))
+
+struct in_pktinfo {
+	int ipi_ifindex;
+	struct in_addr ipi_spec_dst;
+	struct in_addr ipi_addr;
+};
+
+struct in6_pktinfo {
+	struct in6_addr ipi6_addr;
+	unsigned ipi6_ifindex;
+};
+
+struct ip6_mtuinfo {
+	struct sockaddr_in6 ip6m_addr;
+	uint32_t ip6m_mtu;
+};
+#endif
+
+#define IPV6_ADDRFORM           1
+#define IPV6_2292PKTINFO        2
+#define IPV6_2292HOPOPTS        3
+#define IPV6_2292DSTOPTS        4
+#define IPV6_2292RTHDR          5
+#define IPV6_2292PKTOPTIONS     6
+#define IPV6_CHECKSUM           7
+#define IPV6_2292HOPLIMIT       8
+#define IPV6_NEXTHOP            9
+#define IPV6_AUTHHDR            10
+#define IPV6_UNICAST_HOPS       16
+#define IPV6_MULTICAST_IF       17
+#define IPV6_MULTICAST_HOPS     18
+#define IPV6_MULTICAST_LOOP     19
+#define IPV6_JOIN_GROUP         20
+#define IPV6_LEAVE_GROUP        21
+#define IPV6_ROUTER_ALERT       22
+#define IPV6_MTU_DISCOVER       23
+#define IPV6_MTU                24
+#define IPV6_RECVERR            25
+#define IPV6_V6ONLY             26
+#define IPV6_JOIN_ANYCAST       27
+#define IPV6_LEAVE_ANYCAST      28
+#define IPV6_MULTICAST_ALL      29
+#define IPV6_ROUTER_ALERT_ISOLATE 30
+#define IPV6_IPSEC_POLICY       34
+#define IPV6_XFRM_POLICY        35
+#define IPV6_HDRINCL            36
+
+#define IPV6_RECVPKTINFO        49
+#define IPV6_PKTINFO            50
+#define IPV6_RECVHOPLIMIT       51
+#define IPV6_HOPLIMIT           52
+#define IPV6_RECVHOPOPTS        53
+#define IPV6_HOPOPTS            54
+#define IPV6_RTHDRDSTOPTS       55
+#define IPV6_RECVRTHDR          56
+#define IPV6_RTHDR              57
+#define IPV6_RECVDSTOPTS        58
+#define IPV6_DSTOPTS            59
+#define IPV6_RECVPATHMTU        60
+#define IPV6_PATHMTU            61
+#define IPV6_DONTFRAG           62
+#define IPV6_RECVTCLASS         66
+#define IPV6_TCLASS             67
+#define IPV6_AUTOFLOWLABEL      70
+#define IPV6_ADDR_PREFERENCES   72
+#define IPV6_MINHOPCOUNT        73
+#define IPV6_ORIGDSTADDR        74
+#define IPV6_RECVORIGDSTADDR    IPV6_ORIGDSTADDR
+#define IPV6_TRANSPARENT        75
+#define IPV6_UNICAST_IF         76
+#define IPV6_RECVFRAGSIZE       77
+#define IPV6_FREEBIND           78
+
+#define IPV6_ADD_MEMBERSHIP     IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP    IPV6_LEAVE_GROUP
+#define IPV6_RXHOPOPTS          IPV6_HOPOPTS
+#define IPV6_RXDSTOPTS          IPV6_DSTOPTS
+
+#define IPV6_PMTUDISC_DONT      0
+#define IPV6_PMTUDISC_WANT      1
+#define IPV6_PMTUDISC_DO        2
+#define IPV6_PMTUDISC_PROBE     3
+#define IPV6_PMTUDISC_INTERFACE 4
+#define IPV6_PMTUDISC_OMIT      5
+
+#define IPV6_PREFER_SRC_TMP            0x0001
+#define IPV6_PREFER_SRC_PUBLIC         0x0002
+#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
+#define IPV6_PREFER_SRC_COA            0x0004
+#define IPV6_PREFER_SRC_HOME           0x0400
+#define IPV6_PREFER_SRC_CGA            0x0008
+#define IPV6_PREFER_SRC_NONCGA         0x0800
+
+#define IPV6_RTHDR_LOOSE        0
+#define IPV6_RTHDR_STRICT       1
+
+#define IPV6_RTHDR_TYPE_0       0
+
+#define __UAPI_DEF_IN_ADDR      0
+#define __UAPI_DEF_IN_IPPROTO   0
+#define __UAPI_DEF_IN_PKTINFO   0
+#define __UAPI_DEF_IP_MREQ      0
+#define __UAPI_DEF_SOCKADDR_IN  0
+#define __UAPI_DEF_IN_CLASS     0
+#define __UAPI_DEF_IN6_ADDR     0
+#define __UAPI_DEF_IN6_ADDR_ALT 0
+#define __UAPI_DEF_SOCKADDR_IN6 0
+#define __UAPI_DEF_IPV6_MREQ    0
+#define __UAPI_DEF_IPPROTO_V6   0
+#define __UAPI_DEF_IPV6_OPTIONS 0
+#define __UAPI_DEF_IN6_PKTINFO  0
+#define __UAPI_DEF_IP6_MTUINFO  0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/netinet/in_systm.h b/musl-include/arm/netinet/in_systm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/in_systm.h
@@ -0,0 +1,9 @@
+#ifndef _NETINET_IN_SYSTM_H
+#define _NETINET_IN_SYSTM_H
+
+#include <stdint.h>
+
+typedef uint16_t n_short;
+typedef uint32_t n_long, n_time;
+
+#endif
diff --git a/musl-include/arm/netinet/ip.h b/musl-include/arm/netinet/ip.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/ip.h
@@ -0,0 +1,199 @@
+#ifndef _NETINET_IP_H
+#define _NETINET_IP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct timestamp {
+	uint8_t len;
+	uint8_t ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int flags:4;
+	unsigned int overflow:4;
+#else
+	unsigned int overflow:4;
+	unsigned int flags:4;
+#endif
+	uint32_t data[9];
+  };
+
+struct iphdr {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ihl:4;
+	unsigned int version:4;
+#else
+	unsigned int version:4;
+	unsigned int ihl:4;
+#endif
+	uint8_t tos;
+	uint16_t tot_len;
+	uint16_t id;
+	uint16_t frag_off;
+	uint8_t ttl;
+	uint8_t protocol;
+	uint16_t check;
+	uint32_t saddr;
+	uint32_t daddr;
+};
+
+struct ip {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ip_hl:4;
+	unsigned int ip_v:4;
+#else
+	unsigned int ip_v:4;
+	unsigned int ip_hl:4;
+#endif
+	uint8_t ip_tos;
+	uint16_t ip_len;
+	uint16_t ip_id;
+	uint16_t ip_off;
+	uint8_t ip_ttl;
+	uint8_t ip_p;
+	uint16_t ip_sum;
+	struct in_addr ip_src, ip_dst;
+};
+
+#define	IP_RF 0x8000
+#define	IP_DF 0x4000
+#define	IP_MF 0x2000
+#define	IP_OFFMASK 0x1fff
+
+struct ip_timestamp {
+	uint8_t ipt_code;
+	uint8_t ipt_len;
+	uint8_t ipt_ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ipt_flg:4;
+	unsigned int ipt_oflw:4;
+#else
+	unsigned int ipt_oflw:4;
+	unsigned int ipt_flg:4;
+#endif
+	uint32_t data[9];
+};
+
+#define	IPVERSION	4
+#define	IP_MAXPACKET	65535
+
+#define	IPTOS_ECN_MASK		0x03
+#define	IPTOS_ECN(x)		((x) & IPTOS_ECN_MASK)
+#define	IPTOS_ECN_NOT_ECT	0x00
+#define	IPTOS_ECN_ECT1		0x01
+#define	IPTOS_ECN_ECT0		0x02
+#define	IPTOS_ECN_CE		0x03
+
+#define	IPTOS_DSCP_MASK		0xfc
+#define	IPTOS_DSCP(x)		((x) & IPTOS_DSCP_MASK)
+#define	IPTOS_DSCP_AF11		0x28
+#define	IPTOS_DSCP_AF12		0x30
+#define	IPTOS_DSCP_AF13		0x38
+#define	IPTOS_DSCP_AF21		0x48
+#define	IPTOS_DSCP_AF22		0x50
+#define	IPTOS_DSCP_AF23		0x58
+#define	IPTOS_DSCP_AF31		0x68
+#define	IPTOS_DSCP_AF32		0x70
+#define	IPTOS_DSCP_AF33		0x78
+#define	IPTOS_DSCP_AF41		0x88
+#define	IPTOS_DSCP_AF42		0x90
+#define	IPTOS_DSCP_AF43		0x98
+#define	IPTOS_DSCP_EF		0xb8
+
+#define	IPTOS_CLASS_MASK	0xe0
+#define	IPTOS_CLASS(x)		((x) & IPTOS_CLASS_MASK)
+#define	IPTOS_CLASS_CS0		0x00
+#define	IPTOS_CLASS_CS1		0x20
+#define	IPTOS_CLASS_CS2		0x40
+#define	IPTOS_CLASS_CS3		0x60
+#define	IPTOS_CLASS_CS4		0x80
+#define	IPTOS_CLASS_CS5		0xa0
+#define	IPTOS_CLASS_CS6		0xc0
+#define	IPTOS_CLASS_CS7		0xe0
+#define	IPTOS_CLASS_DEFAULT	IPTOS_CLASS_CS0
+
+#define	IPTOS_TOS_MASK		0x1E
+#define	IPTOS_TOS(tos)		((tos) & IPTOS_TOS_MASK)
+#define	IPTOS_LOWDELAY		0x10
+#define	IPTOS_THROUGHPUT	0x08
+#define	IPTOS_RELIABILITY	0x04
+#define	IPTOS_LOWCOST		0x02
+#define	IPTOS_MINCOST		IPTOS_LOWCOST
+
+#define	IPTOS_PREC_MASK			0xe0
+#define	IPTOS_PREC(tos)                ((tos) & IPTOS_PREC_MASK)
+#define	IPTOS_PREC_NETCONTROL		0xe0
+#define	IPTOS_PREC_INTERNETCONTROL	0xc0
+#define	IPTOS_PREC_CRITIC_ECP		0xa0
+#define	IPTOS_PREC_FLASHOVERRIDE	0x80
+#define	IPTOS_PREC_FLASH		0x60
+#define	IPTOS_PREC_IMMEDIATE		0x40
+#define	IPTOS_PREC_PRIORITY		0x20
+#define	IPTOS_PREC_ROUTINE		0x00
+
+#define	IPOPT_COPY		0x80
+#define	IPOPT_CLASS_MASK	0x60
+#define	IPOPT_NUMBER_MASK	0x1f
+
+#define	IPOPT_COPIED(o)		((o) & IPOPT_COPY)
+#define	IPOPT_CLASS(o)		((o) & IPOPT_CLASS_MASK)
+#define	IPOPT_NUMBER(o)		((o) & IPOPT_NUMBER_MASK)
+
+#define	IPOPT_CONTROL		0x00
+#define	IPOPT_RESERVED1		0x20
+#define	IPOPT_DEBMEAS		0x40
+#define	IPOPT_MEASUREMENT       IPOPT_DEBMEAS
+#define	IPOPT_RESERVED2		0x60
+
+#define	IPOPT_EOL		0
+#define	IPOPT_END		IPOPT_EOL
+#define	IPOPT_NOP		1
+#define	IPOPT_NOOP		IPOPT_NOP
+
+#define	IPOPT_RR		7
+#define	IPOPT_TS		68
+#define	IPOPT_TIMESTAMP		IPOPT_TS
+#define	IPOPT_SECURITY		130
+#define	IPOPT_SEC		IPOPT_SECURITY
+#define	IPOPT_LSRR		131
+#define	IPOPT_SATID		136
+#define	IPOPT_SID		IPOPT_SATID
+#define	IPOPT_SSRR		137
+#define	IPOPT_RA		148
+
+#define	IPOPT_OPTVAL		0
+#define	IPOPT_OLEN		1
+#define	IPOPT_OFFSET		2
+#define	IPOPT_MINOFF		4
+
+#define	MAX_IPOPTLEN		40
+
+#define	IPOPT_TS_TSONLY		0
+#define	IPOPT_TS_TSANDADDR	1
+#define	IPOPT_TS_PRESPEC	3
+
+#define	IPOPT_SECUR_UNCLASS	0x0000
+#define	IPOPT_SECUR_CONFID	0xf135
+#define	IPOPT_SECUR_EFTO	0x789a
+#define	IPOPT_SECUR_MMMM	0xbc4d
+#define	IPOPT_SECUR_RESTR	0xaf13
+#define	IPOPT_SECUR_SECRET	0xd788
+#define	IPOPT_SECUR_TOPSECRET	0x6bc5
+
+#define	MAXTTL		255
+#define	IPDEFTTL	64
+#define	IPFRAGTTL	60
+#define	IPTTLDEC	1
+
+#define	IP_MSS		576
+
+#define __UAPI_DEF_IPHDR	0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/netinet/ip6.h b/musl-include/arm/netinet/ip6.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/ip6.h
@@ -0,0 +1,141 @@
+#ifndef _NETINET_IP6_H
+#define _NETINET_IP6_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct ip6_hdr {
+	union {
+		struct ip6_hdrctl {
+			uint32_t ip6_un1_flow;
+			uint16_t ip6_un1_plen;
+			uint8_t  ip6_un1_nxt;
+			uint8_t  ip6_un1_hlim;
+		} ip6_un1;
+		uint8_t ip6_un2_vfc;
+	} ip6_ctlun;
+	struct in6_addr ip6_src;
+	struct in6_addr ip6_dst;
+};
+
+#define ip6_vfc   ip6_ctlun.ip6_un2_vfc
+#define ip6_flow  ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen  ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt   ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim  ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops  ip6_ctlun.ip6_un1.ip6_un1_hlim
+
+struct ip6_ext {
+	uint8_t  ip6e_nxt;
+	uint8_t  ip6e_len;
+};
+
+struct ip6_hbh {
+	uint8_t  ip6h_nxt;
+	uint8_t  ip6h_len;
+};
+
+struct ip6_dest {
+	uint8_t  ip6d_nxt;
+	uint8_t  ip6d_len;
+};
+
+struct ip6_rthdr {
+	uint8_t  ip6r_nxt;
+	uint8_t  ip6r_len;
+	uint8_t  ip6r_type;
+	uint8_t  ip6r_segleft;
+};
+
+struct ip6_rthdr0 {
+	uint8_t  ip6r0_nxt;
+	uint8_t  ip6r0_len;
+	uint8_t  ip6r0_type;
+	uint8_t  ip6r0_segleft;
+	uint8_t  ip6r0_reserved;
+	uint8_t  ip6r0_slmap[3];
+	struct in6_addr ip6r0_addr[];
+};
+
+struct ip6_frag {
+	uint8_t   ip6f_nxt;
+	uint8_t   ip6f_reserved;
+	uint16_t  ip6f_offlg;
+	uint32_t  ip6f_ident;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IP6F_OFF_MASK       0xfff8
+#define IP6F_RESERVED_MASK  0x0006
+#define IP6F_MORE_FRAG      0x0001
+#else
+#define IP6F_OFF_MASK       0xf8ff
+#define IP6F_RESERVED_MASK  0x0600
+#define IP6F_MORE_FRAG      0x0100
+#endif
+
+struct ip6_opt {
+	uint8_t  ip6o_type;
+	uint8_t  ip6o_len;
+};
+
+#define IP6OPT_TYPE(o)		((o) & 0xc0)
+#define IP6OPT_TYPE_SKIP	0x00
+#define IP6OPT_TYPE_DISCARD	0x40
+#define IP6OPT_TYPE_FORCEICMP	0x80
+#define IP6OPT_TYPE_ICMP	0xc0
+#define IP6OPT_TYPE_MUTABLE	0x20
+
+#define IP6OPT_PAD1	0
+#define IP6OPT_PADN	1
+
+#define IP6OPT_JUMBO		0xc2
+#define IP6OPT_NSAP_ADDR	0xc3
+#define IP6OPT_TUNNEL_LIMIT	0x04
+#define IP6OPT_ROUTER_ALERT	0x05
+
+struct ip6_opt_jumbo {
+	uint8_t  ip6oj_type;
+	uint8_t  ip6oj_len;
+	uint8_t  ip6oj_jumbo_len[4];
+};
+#define IP6OPT_JUMBO_LEN	6
+
+struct ip6_opt_nsap {
+	uint8_t  ip6on_type;
+	uint8_t  ip6on_len;
+	uint8_t  ip6on_src_nsap_len;
+	uint8_t  ip6on_dst_nsap_len;
+};
+
+struct ip6_opt_tunnel {
+	uint8_t  ip6ot_type;
+	uint8_t  ip6ot_len;
+	uint8_t  ip6ot_encap_limit;
+};
+
+struct ip6_opt_router {
+	uint8_t  ip6or_type;
+	uint8_t  ip6or_len;
+	uint8_t  ip6or_value[2];
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0001
+#define IP6_ALERT_AN	0x0002
+#else
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0100
+#define IP6_ALERT_AN	0x0200
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/netinet/ip_icmp.h b/musl-include/arm/netinet/ip_icmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/ip_icmp.h
@@ -0,0 +1,193 @@
+#ifndef _NETINET_IP_ICMP_H
+#define _NETINET_IP_ICMP_H
+
+#include <stdint.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct icmphdr {
+	uint8_t type;
+	uint8_t code;
+	uint16_t checksum;
+	union {
+		struct {
+			uint16_t id;
+			uint16_t sequence;
+		} echo;
+		uint32_t gateway;
+		struct {
+			uint16_t __unused;
+			uint16_t mtu;
+		} frag;
+		uint8_t reserved[4];
+	} un;
+};
+
+#define ICMP_ECHOREPLY		0
+#define ICMP_DEST_UNREACH	3
+#define ICMP_SOURCE_QUENCH	4
+#define ICMP_REDIRECT		5
+#define ICMP_ECHO		8
+#define ICMP_TIME_EXCEEDED	11
+#define ICMP_PARAMETERPROB	12
+#define ICMP_TIMESTAMP		13
+#define ICMP_TIMESTAMPREPLY	14
+#define ICMP_INFO_REQUEST	15
+#define ICMP_INFO_REPLY		16
+#define ICMP_ADDRESS		17
+#define ICMP_ADDRESSREPLY	18
+#define NR_ICMP_TYPES		18
+
+
+#define ICMP_NET_UNREACH	0
+#define ICMP_HOST_UNREACH	1
+#define ICMP_PROT_UNREACH	2
+#define ICMP_PORT_UNREACH	3
+#define ICMP_FRAG_NEEDED	4
+#define ICMP_SR_FAILED		5
+#define ICMP_NET_UNKNOWN	6
+#define ICMP_HOST_UNKNOWN	7
+#define ICMP_HOST_ISOLATED	8
+#define ICMP_NET_ANO		9
+#define ICMP_HOST_ANO		10
+#define ICMP_NET_UNR_TOS	11
+#define ICMP_HOST_UNR_TOS	12
+#define ICMP_PKT_FILTERED	13
+#define ICMP_PREC_VIOLATION	14
+#define ICMP_PREC_CUTOFF	15
+#define NR_ICMP_UNREACH		15
+
+#define ICMP_REDIR_NET		0
+#define ICMP_REDIR_HOST		1
+#define ICMP_REDIR_NETTOS	2
+#define ICMP_REDIR_HOSTTOS	3
+
+#define ICMP_EXC_TTL		0
+#define ICMP_EXC_FRAGTIME	1
+
+
+struct icmp_ra_addr {
+	uint32_t ira_addr;
+	uint32_t ira_preference;
+};
+
+struct icmp {
+	uint8_t  icmp_type;
+	uint8_t  icmp_code;
+	uint16_t icmp_cksum;
+	union {
+		uint8_t ih_pptr;
+		struct in_addr ih_gwaddr;
+		struct ih_idseq {
+			uint16_t icd_id;
+			uint16_t icd_seq;
+		} ih_idseq;
+		uint32_t ih_void;
+
+		struct ih_pmtu {
+			uint16_t ipm_void;
+			uint16_t ipm_nextmtu;
+		} ih_pmtu;
+
+		struct ih_rtradv {
+			uint8_t irt_num_addrs;
+			uint8_t irt_wpa;
+			uint16_t irt_lifetime;
+		} ih_rtradv;
+	} icmp_hun;
+	union {
+		struct {
+			uint32_t its_otime;
+			uint32_t its_rtime;
+			uint32_t its_ttime;
+		} id_ts;
+		struct {
+			struct ip idi_ip;
+		} id_ip;
+		struct icmp_ra_addr id_radv;
+		uint32_t   id_mask;
+		uint8_t    id_data[1];
+	} icmp_dun;
+};
+
+#define	icmp_pptr	icmp_hun.ih_pptr
+#define	icmp_gwaddr	icmp_hun.ih_gwaddr
+#define	icmp_id		icmp_hun.ih_idseq.icd_id
+#define	icmp_seq	icmp_hun.ih_idseq.icd_seq
+#define	icmp_void	icmp_hun.ih_void
+#define	icmp_pmvoid	icmp_hun.ih_pmtu.ipm_void
+#define	icmp_nextmtu	icmp_hun.ih_pmtu.ipm_nextmtu
+#define	icmp_num_addrs	icmp_hun.ih_rtradv.irt_num_addrs
+#define	icmp_wpa	icmp_hun.ih_rtradv.irt_wpa
+#define	icmp_lifetime	icmp_hun.ih_rtradv.irt_lifetime
+#define	icmp_otime	icmp_dun.id_ts.its_otime
+#define	icmp_rtime	icmp_dun.id_ts.its_rtime
+#define	icmp_ttime	icmp_dun.id_ts.its_ttime
+#define	icmp_ip		icmp_dun.id_ip.idi_ip
+#define	icmp_radv	icmp_dun.id_radv
+#define	icmp_mask	icmp_dun.id_mask
+#define	icmp_data	icmp_dun.id_data
+
+#define	ICMP_MINLEN	8
+#define	ICMP_TSLEN	(8 + 3 * sizeof (n_time))
+#define	ICMP_MASKLEN	12
+#define	ICMP_ADVLENMIN	(8 + sizeof (struct ip) + 8)
+#define	ICMP_ADVLEN(p)	(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+
+#define	ICMP_UNREACH		3
+#define	ICMP_SOURCEQUENCH	4
+#define	ICMP_ROUTERADVERT	9
+#define	ICMP_ROUTERSOLICIT	10
+#define	ICMP_TIMXCEED		11
+#define	ICMP_PARAMPROB		12
+#define	ICMP_TSTAMP		13
+#define	ICMP_TSTAMPREPLY	14
+#define	ICMP_IREQ		15
+#define	ICMP_IREQREPLY		16
+#define	ICMP_MASKREQ		17
+#define	ICMP_MASKREPLY		18
+#define	ICMP_MAXTYPE		18
+
+#define	ICMP_UNREACH_NET	        0
+#define	ICMP_UNREACH_HOST	        1
+#define	ICMP_UNREACH_PROTOCOL	        2
+#define	ICMP_UNREACH_PORT	        3
+#define	ICMP_UNREACH_NEEDFRAG	        4
+#define	ICMP_UNREACH_SRCFAIL	        5
+#define	ICMP_UNREACH_NET_UNKNOWN        6
+#define	ICMP_UNREACH_HOST_UNKNOWN       7
+#define	ICMP_UNREACH_ISOLATED	        8
+#define	ICMP_UNREACH_NET_PROHIB	        9
+#define	ICMP_UNREACH_HOST_PROHIB        10
+#define	ICMP_UNREACH_TOSNET	        11
+#define	ICMP_UNREACH_TOSHOST	        12
+#define	ICMP_UNREACH_FILTER_PROHIB      13
+#define	ICMP_UNREACH_HOST_PRECEDENCE    14
+#define	ICMP_UNREACH_PRECEDENCE_CUTOFF  15
+
+#define	ICMP_REDIRECT_NET	0
+#define	ICMP_REDIRECT_HOST	1
+#define	ICMP_REDIRECT_TOSNET	2
+#define	ICMP_REDIRECT_TOSHOST	3
+
+#define	ICMP_TIMXCEED_INTRANS	0
+#define	ICMP_TIMXCEED_REASS	1
+
+#define	ICMP_PARAMPROB_OPTABSENT 1
+
+#define	ICMP_INFOTYPE(type) \
+	((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+	(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+	(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+	(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+	(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/netinet/tcp.h b/musl-include/arm/netinet/tcp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/tcp.h
@@ -0,0 +1,305 @@
+#ifndef _NETINET_TCP_H
+#define _NETINET_TCP_H
+
+#include <features.h>
+
+#define TCP_NODELAY 1
+#define TCP_MAXSEG	 2
+#define TCP_CORK	 3
+#define TCP_KEEPIDLE	 4
+#define TCP_KEEPINTVL	 5
+#define TCP_KEEPCNT	 6
+#define TCP_SYNCNT	 7
+#define TCP_LINGER2	 8
+#define TCP_DEFER_ACCEPT 9
+#define TCP_WINDOW_CLAMP 10
+#define TCP_INFO	 11
+#define	TCP_QUICKACK	 12
+#define TCP_CONGESTION	 13
+#define TCP_MD5SIG	 14
+#define TCP_THIN_LINEAR_TIMEOUTS 16
+#define TCP_THIN_DUPACK  17
+#define TCP_USER_TIMEOUT 18
+#define TCP_REPAIR       19
+#define TCP_REPAIR_QUEUE 20
+#define TCP_QUEUE_SEQ    21
+#define TCP_REPAIR_OPTIONS 22
+#define TCP_FASTOPEN     23
+#define TCP_TIMESTAMP    24
+#define TCP_NOTSENT_LOWAT 25
+#define TCP_CC_INFO      26
+#define TCP_SAVE_SYN     27
+#define TCP_SAVED_SYN    28
+#define TCP_REPAIR_WINDOW 29
+#define TCP_FASTOPEN_CONNECT 30
+#define TCP_ULP          31
+#define TCP_MD5SIG_EXT   32
+#define TCP_FASTOPEN_KEY 33
+#define TCP_FASTOPEN_NO_COOKIE 34
+#define TCP_ZEROCOPY_RECEIVE   35
+#define TCP_INQ          36
+#define TCP_TX_DELAY     37
+
+#define TCP_CM_INQ TCP_INQ
+
+#define TCP_ESTABLISHED  1
+#define TCP_SYN_SENT     2
+#define TCP_SYN_RECV     3
+#define TCP_FIN_WAIT1    4
+#define TCP_FIN_WAIT2    5
+#define TCP_TIME_WAIT    6
+#define TCP_CLOSE        7
+#define TCP_CLOSE_WAIT   8
+#define TCP_LAST_ACK     9
+#define TCP_LISTEN       10
+#define TCP_CLOSING      11
+
+enum {
+	TCP_NLA_PAD,
+	TCP_NLA_BUSY,
+	TCP_NLA_RWND_LIMITED,
+	TCP_NLA_SNDBUF_LIMITED,
+	TCP_NLA_DATA_SEGS_OUT,
+	TCP_NLA_TOTAL_RETRANS,
+	TCP_NLA_PACING_RATE,
+	TCP_NLA_DELIVERY_RATE,
+	TCP_NLA_SND_CWND,
+	TCP_NLA_REORDERING,
+	TCP_NLA_MIN_RTT,
+	TCP_NLA_RECUR_RETRANS,
+	TCP_NLA_DELIVERY_RATE_APP_LMT,
+	TCP_NLA_SNDQ_SIZE,
+	TCP_NLA_CA_STATE,
+	TCP_NLA_SND_SSTHRESH,
+	TCP_NLA_DELIVERED,
+	TCP_NLA_DELIVERED_CE,
+	TCP_NLA_BYTES_SENT,
+	TCP_NLA_BYTES_RETRANS,
+	TCP_NLA_DSACK_DUPS,
+	TCP_NLA_REORD_SEEN,
+	TCP_NLA_SRTT,
+	TCP_NLA_TIMEOUT_REHASH,
+	TCP_NLA_BYTES_NOTSENT,
+	TCP_NLA_EDT,
+	TCP_NLA_TTL,
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define TCPOPT_EOL              0
+#define TCPOPT_NOP              1
+#define TCPOPT_MAXSEG           2
+#define TCPOPT_WINDOW           3
+#define TCPOPT_SACK_PERMITTED   4
+#define TCPOPT_SACK             5
+#define TCPOPT_TIMESTAMP        8
+#define TCPOLEN_SACK_PERMITTED  2
+#define TCPOLEN_WINDOW          3
+#define TCPOLEN_MAXSEG          4
+#define TCPOLEN_TIMESTAMP       10
+
+#define SOL_TCP 6
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdint.h>
+
+typedef uint32_t tcp_seq;
+
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+
+struct tcphdr {
+#ifdef _GNU_SOURCE
+#ifdef __GNUC__
+	__extension__
+#endif
+	union { struct {
+
+	uint16_t source;
+	uint16_t dest;
+	uint32_t seq;
+	uint32_t ack_seq;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	uint16_t res1:4;
+	uint16_t doff:4;
+	uint16_t fin:1;
+	uint16_t syn:1;
+	uint16_t rst:1;
+	uint16_t psh:1;
+	uint16_t ack:1;
+	uint16_t urg:1;
+	uint16_t res2:2;
+#else
+	uint16_t doff:4;
+	uint16_t res1:4;
+	uint16_t res2:2;
+	uint16_t urg:1;
+	uint16_t ack:1;
+	uint16_t psh:1;
+	uint16_t rst:1;
+	uint16_t syn:1;
+	uint16_t fin:1;
+#endif
+	uint16_t window;
+	uint16_t check;
+	uint16_t urg_ptr;
+
+	}; struct {
+#endif
+
+	uint16_t th_sport;
+	uint16_t th_dport;
+	uint32_t th_seq;
+	uint32_t th_ack;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	uint8_t th_x2:4;
+	uint8_t th_off:4;
+#else
+	uint8_t th_off:4;
+	uint8_t th_x2:4;
+#endif
+	uint8_t th_flags;
+	uint16_t th_win;
+	uint16_t th_sum;
+	uint16_t th_urp;
+
+#ifdef _GNU_SOURCE
+	}; };
+#endif
+};
+#endif
+
+#ifdef _GNU_SOURCE
+#define TCPI_OPT_TIMESTAMPS	1
+#define TCPI_OPT_SACK		2
+#define TCPI_OPT_WSCALE		4
+#define TCPI_OPT_ECN		8
+
+#define TCP_CA_Open		0
+#define TCP_CA_Disorder		1
+#define TCP_CA_CWR		2
+#define TCP_CA_Recovery		3
+#define TCP_CA_Loss		4
+
+enum tcp_fastopen_client_fail {
+	TFO_STATUS_UNSPEC,
+	TFO_COOKIE_UNAVAILABLE,
+	TFO_DATA_NOT_ACKED,
+	TFO_SYN_RETRANSMITTED,
+};
+
+struct tcp_info {
+	uint8_t tcpi_state;
+	uint8_t tcpi_ca_state;
+	uint8_t tcpi_retransmits;
+	uint8_t tcpi_probes;
+	uint8_t tcpi_backoff;
+	uint8_t tcpi_options;
+	uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
+	uint8_t tcpi_delivery_rate_app_limited : 1, tcpi_fastopen_client_fail : 2;
+	uint32_t tcpi_rto;
+	uint32_t tcpi_ato;
+	uint32_t tcpi_snd_mss;
+	uint32_t tcpi_rcv_mss;
+	uint32_t tcpi_unacked;
+	uint32_t tcpi_sacked;
+	uint32_t tcpi_lost;
+	uint32_t tcpi_retrans;
+	uint32_t tcpi_fackets;
+	uint32_t tcpi_last_data_sent;
+	uint32_t tcpi_last_ack_sent;
+	uint32_t tcpi_last_data_recv;
+	uint32_t tcpi_last_ack_recv;
+	uint32_t tcpi_pmtu;
+	uint32_t tcpi_rcv_ssthresh;
+	uint32_t tcpi_rtt;
+	uint32_t tcpi_rttvar;
+	uint32_t tcpi_snd_ssthresh;
+	uint32_t tcpi_snd_cwnd;
+	uint32_t tcpi_advmss;
+	uint32_t tcpi_reordering;
+	uint32_t tcpi_rcv_rtt;
+	uint32_t tcpi_rcv_space;
+	uint32_t tcpi_total_retrans;
+	uint64_t tcpi_pacing_rate;
+	uint64_t tcpi_max_pacing_rate;
+	uint64_t tcpi_bytes_acked;
+	uint64_t tcpi_bytes_received;
+	uint32_t tcpi_segs_out;
+	uint32_t tcpi_segs_in;
+	uint32_t tcpi_notsent_bytes;
+	uint32_t tcpi_min_rtt;
+	uint32_t tcpi_data_segs_in;
+	uint32_t tcpi_data_segs_out;
+	uint64_t tcpi_delivery_rate;
+	uint64_t tcpi_busy_time;
+	uint64_t tcpi_rwnd_limited;
+	uint64_t tcpi_sndbuf_limited;
+	uint32_t tcpi_delivered;
+	uint32_t tcpi_delivered_ce;
+	uint64_t tcpi_bytes_sent;
+	uint64_t tcpi_bytes_retrans;
+	uint32_t tcpi_dsack_dups;
+	uint32_t tcpi_reord_seen;
+	uint32_t tcpi_rcv_ooopack;
+	uint32_t tcpi_snd_wnd;
+};
+
+#define TCP_MD5SIG_MAXKEYLEN    80
+
+#define TCP_MD5SIG_FLAG_PREFIX  0x1
+#define TCP_MD5SIG_FLAG_IFINDEX 0x2
+
+struct tcp_md5sig {
+	struct sockaddr_storage tcpm_addr;
+	uint8_t tcpm_flags;
+	uint8_t tcpm_prefixlen;
+	uint16_t tcpm_keylen;
+	int tcpm_ifindex;
+	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
+};
+
+struct tcp_diag_md5sig {
+	uint8_t tcpm_family;
+	uint8_t tcpm_prefixlen;
+	uint16_t tcpm_keylen;
+	uint32_t tcpm_addr[4];
+	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
+};
+
+#define TCP_REPAIR_ON		1
+#define TCP_REPAIR_OFF		0
+#define TCP_REPAIR_OFF_NO_WP	-1
+
+struct tcp_repair_window {
+	uint32_t snd_wl1;
+	uint32_t snd_wnd;
+	uint32_t max_window;
+	uint32_t rcv_wnd;
+	uint32_t rcv_wup;
+};
+
+#define TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT 0x1
+
+struct tcp_zerocopy_receive {
+	uint64_t address;
+	uint32_t length;
+	uint32_t recv_skip_hint;
+	uint32_t inq;
+	int32_t err;
+	uint64_t copybuf_address;
+	int32_t copybuf_len;
+	uint32_t flags;
+	uint64_t msg_control;
+	uint64_t msg_controllen;
+	uint32_t msg_flags;
+	uint32_t reserved;
+};
+
+#endif
+
+#endif
diff --git a/musl-include/arm/netinet/udp.h b/musl-include/arm/netinet/udp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netinet/udp.h
@@ -0,0 +1,46 @@
+#ifndef _NETINET_UDP_H
+#define _NETINET_UDP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <stdint.h>
+
+#ifdef _GNU_SOURCE
+#define uh_sport source
+#define uh_dport dest
+#define uh_ulen len
+#define uh_sum check
+#endif
+
+struct udphdr {
+	uint16_t uh_sport;
+	uint16_t uh_dport;
+	uint16_t uh_ulen;
+	uint16_t uh_sum;
+};
+
+#define UDP_CORK	1
+#define UDP_ENCAP	100
+#define UDP_NO_CHECK6_TX 101
+#define UDP_NO_CHECK6_RX 102
+#define UDP_SEGMENT	103
+#define UDP_GRO		104
+
+#define UDP_ENCAP_ESPINUDP_NON_IKE 1
+#define UDP_ENCAP_ESPINUDP	2
+#define UDP_ENCAP_L2TPINUDP	3
+#define UDP_ENCAP_GTP0		4
+#define UDP_ENCAP_GTP1U		5
+#define UDP_ENCAP_RXRPC		6
+#define TCP_ENCAP_ESPINTCP	7
+
+#define SOL_UDP            17
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/netpacket/packet.h b/musl-include/arm/netpacket/packet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/netpacket/packet.h
@@ -0,0 +1,62 @@
+#ifndef _NETPACKET_PACKET_H
+#define _NETPACKET_PACKET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sockaddr_ll {
+	unsigned short sll_family, sll_protocol;
+	int sll_ifindex;
+	unsigned short sll_hatype;
+	unsigned char sll_pkttype, sll_halen;
+	unsigned char sll_addr[8];
+};
+
+struct packet_mreq {
+	int mr_ifindex;
+	unsigned short int mr_type,  mr_alen;
+	unsigned char mr_address[8];
+};
+
+#define PACKET_HOST		0
+#define PACKET_BROADCAST	1
+#define PACKET_MULTICAST	2
+#define PACKET_OTHERHOST	3
+#define PACKET_OUTGOING		4
+#define PACKET_LOOPBACK		5
+#define PACKET_FASTROUTE	6
+
+#define PACKET_ADD_MEMBERSHIP		1
+#define PACKET_DROP_MEMBERSHIP		2
+#define	PACKET_RECV_OUTPUT		3
+#define	PACKET_RX_RING			5
+#define	PACKET_STATISTICS		6
+#define PACKET_COPY_THRESH		7
+#define PACKET_AUXDATA			8
+#define PACKET_ORIGDEV			9
+#define PACKET_VERSION			10
+#define PACKET_HDRLEN			11
+#define PACKET_RESERVE			12
+#define PACKET_TX_RING			13
+#define PACKET_LOSS			14
+#define PACKET_VNET_HDR			15
+#define PACKET_TX_TIMESTAMP		16
+#define PACKET_TIMESTAMP		17
+#define PACKET_FANOUT			18
+#define PACKET_TX_HAS_OFF		19
+#define PACKET_QDISC_BYPASS		20
+#define PACKET_ROLLOVER_STATS		21
+#define PACKET_FANOUT_DATA		22
+#define PACKET_IGNORE_OUTGOING		23
+
+#define PACKET_MR_MULTICAST	0
+#define PACKET_MR_PROMISC	1
+#define PACKET_MR_ALLMULTI	2
+#define PACKET_MR_UNICAST	3
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/nl_types.h b/musl-include/arm/nl_types.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/nl_types.h
@@ -0,0 +1,22 @@
+#ifndef _NL_TYPES_H
+#define _NL_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NL_SETD 1
+#define NL_CAT_LOCALE 1
+
+typedef int nl_item;
+typedef void *nl_catd;
+
+nl_catd catopen (const char *, int);
+char *catgets (nl_catd, int, int, const char *);
+int catclose (nl_catd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/paths.h b/musl-include/arm/paths.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/paths.h
@@ -0,0 +1,31 @@
+#ifndef _PATHS_H
+#define _PATHS_H
+
+#define	_PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin"
+#define	_PATH_STDPATH "/bin:/usr/bin:/sbin:/usr/sbin"
+
+#define	_PATH_BSHELL	"/bin/sh"
+#define	_PATH_CONSOLE	"/dev/console"
+#define	_PATH_DEVNULL	"/dev/null"
+#define	_PATH_KLOG	"/proc/kmsg"
+#define	_PATH_LASTLOG	"/var/log/lastlog"
+#define	_PATH_MAILDIR	"/var/mail"
+#define	_PATH_MAN	"/usr/share/man"
+#define	_PATH_MNTTAB	"/etc/fstab"
+#define	_PATH_MOUNTED	"/etc/mtab"
+#define	_PATH_NOLOGIN	"/etc/nologin"
+#define	_PATH_SENDMAIL	"/usr/sbin/sendmail"
+#define	_PATH_SHADOW	"/etc/shadow"
+#define	_PATH_SHELLS	"/etc/shells"
+#define	_PATH_TTY	"/dev/tty"
+#define _PATH_UTMP	"/dev/null/utmp"
+#define	_PATH_VI	"/usr/bin/vi"
+#define _PATH_WTMP	"/dev/null/wtmp"
+
+#define	_PATH_DEV	"/dev/"
+#define	_PATH_TMP	"/tmp/"
+#define	_PATH_VARDB	"/var/lib/misc/"
+#define	_PATH_VARRUN	"/var/run/"
+#define	_PATH_VARTMP	"/var/tmp/"
+
+#endif
diff --git a/musl-include/arm/poll.h b/musl-include/arm/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/poll.h
@@ -0,0 +1,57 @@
+#ifndef	_POLL_H
+#define	_POLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/poll.h>
+
+#define POLLIN     0x001
+#define POLLPRI    0x002
+#define POLLOUT    0x004
+#define POLLERR    0x008
+#define POLLHUP    0x010
+#define POLLNVAL   0x020
+#define POLLRDNORM 0x040
+#define POLLRDBAND 0x080
+#ifndef POLLWRNORM
+#define POLLWRNORM 0x100
+#define POLLWRBAND 0x200
+#endif
+#ifndef POLLMSG
+#define POLLMSG    0x400
+#define POLLRDHUP  0x2000
+#endif
+
+typedef unsigned long nfds_t;
+
+struct pollfd {
+	int fd;
+	short events;
+	short revents;
+};
+
+int poll (struct pollfd *, nfds_t, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+#include <bits/alltypes.h>
+int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *);
+#endif
+
+#if _REDIR_TIME64
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(ppoll, __ppoll_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/pthread.h b/musl-include/arm/pthread.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/pthread.h
@@ -0,0 +1,244 @@
+#ifndef _PTHREAD_H
+#define _PTHREAD_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_clockid_t
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_pthread_mutexattr_t
+#define __NEED_pthread_condattr_t
+#define __NEED_pthread_rwlockattr_t
+#define __NEED_pthread_barrierattr_t
+#define __NEED_pthread_mutex_t
+#define __NEED_pthread_cond_t
+#define __NEED_pthread_rwlock_t
+#define __NEED_pthread_barrier_t
+#define __NEED_pthread_spinlock_t
+#define __NEED_pthread_key_t
+#define __NEED_pthread_once_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#include <sched.h>
+#include <time.h>
+
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 1
+
+#define PTHREAD_MUTEX_NORMAL 0
+#define PTHREAD_MUTEX_DEFAULT 0
+#define PTHREAD_MUTEX_RECURSIVE 1
+#define PTHREAD_MUTEX_ERRORCHECK 2
+
+#define PTHREAD_MUTEX_STALLED 0
+#define PTHREAD_MUTEX_ROBUST 1
+
+#define PTHREAD_PRIO_NONE 0
+#define PTHREAD_PRIO_INHERIT 1
+#define PTHREAD_PRIO_PROTECT 2
+
+#define PTHREAD_INHERIT_SCHED 0
+#define PTHREAD_EXPLICIT_SCHED 1
+
+#define PTHREAD_SCOPE_SYSTEM 0
+#define PTHREAD_SCOPE_PROCESS 1
+
+#define PTHREAD_PROCESS_PRIVATE 0
+#define PTHREAD_PROCESS_SHARED 1
+
+
+#define PTHREAD_MUTEX_INITIALIZER {{{0}}}
+#define PTHREAD_RWLOCK_INITIALIZER {{{0}}}
+#define PTHREAD_COND_INITIALIZER {{{0}}}
+#define PTHREAD_ONCE_INIT 0
+
+
+#define PTHREAD_CANCEL_ENABLE 0
+#define PTHREAD_CANCEL_DISABLE 1
+#define PTHREAD_CANCEL_MASKED 2
+
+#define PTHREAD_CANCEL_DEFERRED 0
+#define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+#define PTHREAD_CANCELED ((void *)-1)
+
+
+#define PTHREAD_BARRIER_SERIAL_THREAD (-1)
+
+
+#define PTHREAD_NULL ((pthread_t)0)
+
+
+int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
+int pthread_detach(pthread_t);
+_Noreturn void pthread_exit(void *);
+int pthread_join(pthread_t, void **);
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+pthread_t pthread_self(void);
+
+int pthread_equal(pthread_t, pthread_t);
+#ifndef __cplusplus
+#define pthread_equal(x,y) ((x)==(y))
+#endif
+
+int pthread_setcancelstate(int, int *);
+int pthread_setcanceltype(int, int *);
+void pthread_testcancel(void);
+int pthread_cancel(pthread_t);
+
+int pthread_getschedparam(pthread_t, int *__restrict, struct sched_param *__restrict);
+int pthread_setschedparam(pthread_t, int, const struct sched_param *);
+int pthread_setschedprio(pthread_t, int);
+
+int pthread_once(pthread_once_t *, void (*)(void));
+
+int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict);
+int pthread_mutex_lock(pthread_mutex_t *);
+int pthread_mutex_unlock(pthread_mutex_t *);
+int pthread_mutex_trylock(pthread_mutex_t *);
+int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_mutex_destroy(pthread_mutex_t *);
+int pthread_mutex_consistent(pthread_mutex_t *);
+
+int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *__restrict);
+int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict, int, int *__restrict);
+
+int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict);
+int pthread_cond_destroy(pthread_cond_t *);
+int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
+int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_cond_broadcast(pthread_cond_t *);
+int pthread_cond_signal(pthread_cond_t *);
+
+int pthread_rwlock_init(pthread_rwlock_t *__restrict, const pthread_rwlockattr_t *__restrict);
+int pthread_rwlock_destroy(pthread_rwlock_t *);
+int pthread_rwlock_rdlock(pthread_rwlock_t *);
+int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+int pthread_rwlock_wrlock(pthread_rwlock_t *);
+int pthread_rwlock_trywrlock(pthread_rwlock_t *);
+int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+int pthread_rwlock_unlock(pthread_rwlock_t *);
+
+int pthread_spin_init(pthread_spinlock_t *, int);
+int pthread_spin_destroy(pthread_spinlock_t *);
+int pthread_spin_lock(pthread_spinlock_t *);
+int pthread_spin_trylock(pthread_spinlock_t *);
+int pthread_spin_unlock(pthread_spinlock_t *);
+
+int pthread_barrier_init(pthread_barrier_t *__restrict, const pthread_barrierattr_t *__restrict, unsigned);
+int pthread_barrier_destroy(pthread_barrier_t *);
+int pthread_barrier_wait(pthread_barrier_t *);
+
+int pthread_key_create(pthread_key_t *, void (*)(void *));
+int pthread_key_delete(pthread_key_t);
+void *pthread_getspecific(pthread_key_t);
+int pthread_setspecific(pthread_key_t, const void *);
+
+int pthread_attr_init(pthread_attr_t *);
+int pthread_attr_destroy(pthread_attr_t *);
+
+int pthread_attr_getguardsize(const pthread_attr_t *__restrict, size_t *__restrict);
+int pthread_attr_setguardsize(pthread_attr_t *, size_t);
+int pthread_attr_getstacksize(const pthread_attr_t *__restrict, size_t *__restrict);
+int pthread_attr_setstacksize(pthread_attr_t *, size_t);
+int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
+int pthread_attr_setdetachstate(pthread_attr_t *, int);
+int pthread_attr_getstack(const pthread_attr_t *__restrict, void **__restrict, size_t *__restrict);
+int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
+int pthread_attr_getscope(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setscope(pthread_attr_t *, int);
+int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setschedpolicy(pthread_attr_t *, int);
+int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict);
+int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict);
+int pthread_attr_getinheritsched(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setinheritsched(pthread_attr_t *, int);
+
+int pthread_mutexattr_destroy(pthread_mutexattr_t *);
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_init(pthread_mutexattr_t *);
+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
+int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
+
+int pthread_condattr_init(pthread_condattr_t *);
+int pthread_condattr_destroy(pthread_condattr_t *);
+int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
+int pthread_condattr_setpshared(pthread_condattr_t *, int);
+int pthread_condattr_getclock(const pthread_condattr_t *__restrict, clockid_t *__restrict);
+int pthread_condattr_getpshared(const pthread_condattr_t *__restrict, int *__restrict);
+
+int pthread_rwlockattr_init(pthread_rwlockattr_t *);
+int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
+int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
+int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *__restrict, int *__restrict);
+
+int pthread_barrierattr_destroy(pthread_barrierattr_t *);
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t *__restrict, int *__restrict);
+int pthread_barrierattr_init(pthread_barrierattr_t *);
+int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
+
+int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
+
+int pthread_getconcurrency(void);
+int pthread_setconcurrency(int);
+
+int pthread_getcpuclockid(pthread_t, clockid_t *);
+
+struct __ptcb {
+	void (*__f)(void *);
+	void *__x;
+	struct __ptcb *__next;
+};
+
+void _pthread_cleanup_push(struct __ptcb *, void (*)(void *), void *);
+void _pthread_cleanup_pop(struct __ptcb *, int);
+
+#define pthread_cleanup_push(f, x) do { struct __ptcb __cb; _pthread_cleanup_push(&__cb, f, x);
+#define pthread_cleanup_pop(r) _pthread_cleanup_pop(&__cb, (r)); } while(0)
+
+#ifdef _GNU_SOURCE
+struct cpu_set_t;
+int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *);
+int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *);
+int pthread_getattr_np(pthread_t, pthread_attr_t *);
+int pthread_setname_np(pthread_t, const char *);
+int pthread_getname_np(pthread_t, char *, size_t);
+int pthread_getattr_default_np(pthread_attr_t *);
+int pthread_setattr_default_np(const pthread_attr_t *);
+int pthread_tryjoin_np(pthread_t, void **);
+int pthread_timedjoin_np(pthread_t, void **, const struct timespec *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(pthread_mutex_timedlock, __pthread_mutex_timedlock_time64);
+__REDIR(pthread_cond_timedwait, __pthread_cond_timedwait_time64);
+__REDIR(pthread_rwlock_timedrdlock, __pthread_rwlock_timedrdlock_time64);
+__REDIR(pthread_rwlock_timedwrlock, __pthread_rwlock_timedwrlock_time64);
+#ifdef _GNU_SOURCE
+__REDIR(pthread_timedjoin_np, __pthread_timedjoin_np_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/pty.h b/musl-include/arm/pty.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/pty.h
@@ -0,0 +1,18 @@
+#ifndef	_PTY_H
+#define	_PTY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <termios.h>
+#include <sys/ioctl.h>
+
+int openpty(int *, int *, char *, const struct termios *, const struct winsize *);
+int forkpty(int *, char *, const struct termios *, const struct winsize *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/pwd.h b/musl-include/arm/pwd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/pwd.h
@@ -0,0 +1,50 @@
+#ifndef _PWD_H
+#define _PWD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_FILE
+#endif
+
+#include <bits/alltypes.h>
+
+struct passwd {
+	char *pw_name;
+	char *pw_passwd;
+	uid_t pw_uid;
+	gid_t pw_gid;
+	char *pw_gecos;
+	char *pw_dir;
+	char *pw_shell;
+};
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void setpwent (void);
+void endpwent (void);
+struct passwd *getpwent (void);
+#endif
+
+struct passwd *getpwuid (uid_t);
+struct passwd *getpwnam (const char *);
+int getpwuid_r (uid_t, struct passwd *, char *, size_t, struct passwd **);
+int getpwnam_r (const char *, struct passwd *, char *, size_t, struct passwd **);
+
+#ifdef _GNU_SOURCE
+struct passwd *fgetpwent(FILE *);
+int putpwent(const struct passwd *, FILE *);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/regex.h b/musl-include/arm/regex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/regex.h
@@ -0,0 +1,62 @@
+#ifndef _REGEX_H
+#define _REGEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_regoff_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef struct re_pattern_buffer {
+	size_t re_nsub;
+	void *__opaque, *__padding[4];
+	size_t __nsub2;
+	char __padding2;
+} regex_t;
+
+typedef struct {
+	regoff_t rm_so;
+	regoff_t rm_eo;
+} regmatch_t;
+
+#define REG_EXTENDED    1
+#define REG_ICASE       2
+#define REG_NEWLINE     4
+#define REG_NOSUB       8
+
+#define REG_NOTBOL      1
+#define REG_NOTEOL      2
+
+#define REG_OK          0
+#define REG_NOMATCH     1
+#define REG_BADPAT      2
+#define REG_ECOLLATE    3
+#define REG_ECTYPE      4
+#define REG_EESCAPE     5
+#define REG_ESUBREG     6
+#define REG_EBRACK      7
+#define REG_EPAREN      8
+#define REG_EBRACE      9
+#define REG_BADBR       10
+#define REG_ERANGE      11
+#define REG_ESPACE      12
+#define REG_BADRPT      13
+
+#define REG_ENOSYS      -1
+
+int regcomp(regex_t *__restrict, const char *__restrict, int);
+int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int);
+void regfree(regex_t *);
+
+size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/resolv.h b/musl-include/arm/resolv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/resolv.h
@@ -0,0 +1,142 @@
+#ifndef _RESOLV_H
+#define _RESOLV_H
+
+#include <stdint.h>
+#include <arpa/nameser.h>
+#include <netinet/in.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAXNS			3
+#define MAXDFLSRCH		3
+#define MAXDNSRCH		6
+#define LOCALDOMAINPARTS	2
+
+#define RES_TIMEOUT		5
+#define MAXRESOLVSORT		10
+#define RES_MAXNDOTS		15
+#define RES_MAXRETRANS		30
+#define RES_MAXRETRY		5
+#define RES_DFLRETRY		2
+#define RES_MAXTIME		65535
+
+/* unused; purely for broken apps */
+typedef struct __res_state {
+	int retrans;
+	int retry;
+	unsigned long options;
+	int nscount;
+	struct sockaddr_in nsaddr_list[MAXNS];
+# define nsaddr	nsaddr_list[0]
+	unsigned short id;
+	char *dnsrch[MAXDNSRCH+1];
+	char defdname[256];
+	unsigned long pfcode;
+	unsigned ndots:4;
+	unsigned nsort:4;
+	unsigned ipv6_unavail:1;
+	unsigned unused:23;
+	struct {
+		struct in_addr addr;
+		uint32_t mask;
+	} sort_list[MAXRESOLVSORT];
+	void *qhook;
+	void *rhook;
+	int res_h_errno;
+	int _vcsock;
+	unsigned _flags;
+	union {
+		char pad[52];
+		struct {
+			uint16_t		nscount;
+			uint16_t		nsmap[MAXNS];
+			int			nssocks[MAXNS];
+			uint16_t		nscount6;
+			uint16_t		nsinit;
+			struct sockaddr_in6	*nsaddrs[MAXNS];
+			unsigned int		_initstamp[2];
+		} _ext;
+	} _u;
+} *res_state;
+
+#define	__RES	19960801
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF        "/etc/resolv.conf"
+#endif
+
+struct res_sym {
+	int number;
+	char *name;
+	char *humanname;
+};
+
+#define	RES_F_VC	0x00000001
+#define	RES_F_CONN	0x00000002
+#define RES_F_EDNS0ERR	0x00000004
+
+#define	RES_EXHAUSTIVE	0x00000001
+
+#define RES_INIT	0x00000001
+#define RES_DEBUG	0x00000002
+#define RES_AAONLY	0x00000004
+#define RES_USEVC	0x00000008
+#define RES_PRIMARY	0x00000010
+#define RES_IGNTC	0x00000020
+#define RES_RECURSE	0x00000040
+#define RES_DEFNAMES	0x00000080
+#define RES_STAYOPEN	0x00000100
+#define RES_DNSRCH	0x00000200
+#define	RES_INSECURE1	0x00000400
+#define	RES_INSECURE2	0x00000800
+#define	RES_NOALIASES	0x00001000
+#define	RES_USE_INET6	0x00002000
+#define RES_ROTATE	0x00004000
+#define	RES_NOCHECKNAME	0x00008000
+#define	RES_KEEPTSIG	0x00010000
+#define	RES_BLAST	0x00020000
+#define RES_USEBSTRING	0x00040000
+#define RES_NOIP6DOTINT	0x00080000
+#define RES_USE_EDNS0	0x00100000
+#define RES_SNGLKUP	0x00200000
+#define RES_SNGLKUPREOP	0x00400000
+#define RES_USE_DNSSEC	0x00800000
+
+#define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
+
+#define RES_PRF_STATS	0x00000001
+#define RES_PRF_UPDATE	0x00000002
+#define RES_PRF_CLASS   0x00000004
+#define RES_PRF_CMD	0x00000008
+#define RES_PRF_QUES	0x00000010
+#define RES_PRF_ANS	0x00000020
+#define RES_PRF_AUTH	0x00000040
+#define RES_PRF_ADD	0x00000080
+#define RES_PRF_HEAD1	0x00000100
+#define RES_PRF_HEAD2	0x00000200
+#define RES_PRF_TTLID	0x00000400
+#define RES_PRF_HEADX	0x00000800
+#define RES_PRF_QUERY	0x00001000
+#define RES_PRF_REPLY	0x00002000
+#define RES_PRF_INIT	0x00004000
+
+struct __res_state *__res_state(void);
+#define _res (*__res_state())
+
+int res_init(void);
+int res_query(const char *, int, int, unsigned char *, int);
+int res_querydomain(const char *, const char *, int, int, unsigned char *, int);
+int res_search(const char *, int, int, unsigned char *, int);
+int res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
+int res_send(const unsigned char *, int, unsigned char *, int);
+int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **);
+int dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
+int dn_skipname(const unsigned char *, const unsigned char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sched.h b/musl-include/arm/sched.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sched.h
@@ -0,0 +1,148 @@
+#ifndef _SCHED_H
+#define _SCHED_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_struct_timespec
+#define __NEED_pid_t
+#define __NEED_time_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+struct sched_param {
+	int sched_priority;
+	int __reserved1;
+#if _REDIR_TIME64
+	long __reserved2[4];
+#else
+	struct {
+		time_t __reserved1;
+		long __reserved2;
+	} __reserved2[2];
+#endif
+	int __reserved3;
+};
+
+int    sched_get_priority_max(int);
+int    sched_get_priority_min(int);
+int    sched_getparam(pid_t, struct sched_param *);
+int    sched_getscheduler(pid_t);
+int    sched_rr_get_interval(pid_t, struct timespec *);
+int    sched_setparam(pid_t, const struct sched_param *);
+int    sched_setscheduler(pid_t, int, const struct sched_param *);
+int     sched_yield(void);
+
+#define SCHED_OTHER 0
+#define SCHED_FIFO 1
+#define SCHED_RR 2
+#define SCHED_BATCH 3
+#define SCHED_IDLE 5
+#define SCHED_DEADLINE 6
+#define SCHED_RESET_ON_FORK 0x40000000
+
+#ifdef _GNU_SOURCE
+#define CSIGNAL		0x000000ff
+#define CLONE_NEWTIME	0x00000080
+#define CLONE_VM	0x00000100
+#define CLONE_FS	0x00000200
+#define CLONE_FILES	0x00000400
+#define CLONE_SIGHAND	0x00000800
+#define CLONE_PIDFD	0x00001000
+#define CLONE_PTRACE	0x00002000
+#define CLONE_VFORK	0x00004000
+#define CLONE_PARENT	0x00008000
+#define CLONE_THREAD	0x00010000
+#define CLONE_NEWNS	0x00020000
+#define CLONE_SYSVSEM	0x00040000
+#define CLONE_SETTLS	0x00080000
+#define CLONE_PARENT_SETTID	0x00100000
+#define CLONE_CHILD_CLEARTID	0x00200000
+#define CLONE_DETACHED	0x00400000
+#define CLONE_UNTRACED	0x00800000
+#define CLONE_CHILD_SETTID	0x01000000
+#define CLONE_NEWCGROUP	0x02000000
+#define CLONE_NEWUTS	0x04000000
+#define CLONE_NEWIPC	0x08000000
+#define CLONE_NEWUSER	0x10000000
+#define CLONE_NEWPID	0x20000000
+#define CLONE_NEWNET	0x40000000
+#define CLONE_IO	0x80000000
+int clone (int (*)(void *), void *, int, void *, ...);
+int unshare(int);
+int setns(int, int);
+
+void *memcpy(void *__restrict, const void *__restrict, size_t);
+int memcmp(const void *, const void *, size_t);
+void *memset (void *, int, size_t);
+void *calloc(size_t, size_t);
+void free(void *);
+
+typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t;
+int __sched_cpucount(size_t, const cpu_set_t *);
+int sched_getcpu(void);
+int sched_getaffinity(pid_t, size_t, cpu_set_t *);
+int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
+
+#define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \
+	(((unsigned long *)(set))[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) )
+
+#define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=)
+#define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &=~)
+#define CPU_ISSET_S(i, size, set) __CPU_op_S(i, size, set, &)
+
+#define __CPU_op_func_S(func, op) \
+static __inline void __CPU_##func##_S(size_t __size, cpu_set_t *__dest, \
+	const cpu_set_t *__src1, const cpu_set_t *__src2) \
+{ \
+	size_t __i; \
+	for (__i=0; __i<__size/sizeof(long); __i++) \
+		((unsigned long *)__dest)[__i] = ((unsigned long *)__src1)[__i] \
+			op ((unsigned long *)__src2)[__i] ; \
+}
+
+__CPU_op_func_S(AND, &)
+__CPU_op_func_S(OR, |)
+__CPU_op_func_S(XOR, ^)
+
+#define CPU_AND_S(a,b,c,d) __CPU_AND_S(a,b,c,d)
+#define CPU_OR_S(a,b,c,d) __CPU_OR_S(a,b,c,d)
+#define CPU_XOR_S(a,b,c,d) __CPU_XOR_S(a,b,c,d)
+
+#define CPU_COUNT_S(size,set) __sched_cpucount(size,set)
+#define CPU_ZERO_S(size,set) memset(set,0,size)
+#define CPU_EQUAL_S(size,set1,set2) (!memcmp(set1,set2,size))
+
+#define CPU_ALLOC_SIZE(n) (sizeof(long) * ( (n)/(8*sizeof(long)) \
+	+ ((n)%(8*sizeof(long)) + 8*sizeof(long)-1)/(8*sizeof(long)) ) )
+#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
+#define CPU_FREE(set) free(set)
+
+#define CPU_SETSIZE 1024
+
+#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
+#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)
+#define CPU_ISSET(i, set) CPU_ISSET_S(i,sizeof(cpu_set_t),set)
+#define CPU_AND(d,s1,s2) CPU_AND_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_OR(d,s1,s2) CPU_OR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_XOR(d,s1,s2) CPU_XOR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t),set)
+#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set)
+#define CPU_EQUAL(s1,s2) CPU_EQUAL_S(sizeof(cpu_set_t),s1,s2)
+
+#endif
+
+#if _REDIR_TIME64
+__REDIR(sched_rr_get_interval, __sched_rr_get_interval_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/scsi/scsi.h b/musl-include/arm/scsi/scsi.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/scsi/scsi.h
@@ -0,0 +1,150 @@
+#ifndef _SCSI_SCSI_H
+#define _SCSI_SCSI_H
+
+#define TEST_UNIT_READY 0x00
+#define REZERO_UNIT 0x01
+#define REQUEST_SENSE 0x03
+#define FORMAT_UNIT 0x04
+#define READ_BLOCK_LIMITS 0x05
+#define REASSIGN_BLOCKS 0x07
+#define READ_6 0x08
+#define WRITE_6 0x0a
+#define SEEK_6 0x0b
+#define READ_REVERSE 0x0f
+#define WRITE_FILEMARKS 0x10
+#define SPACE 0x11
+#define INQUIRY 0x12
+#define RECOVER_BUFFERED_DATA 0x14
+#define MODE_SELECT 0x15
+#define RESERVE 0x16
+#define RELEASE 0x17
+#define COPY 0x18
+#define ERASE 0x19
+#define MODE_SENSE 0x1a
+#define START_STOP 0x1b
+#define RECEIVE_DIAGNOSTIC 0x1c
+#define SEND_DIAGNOSTIC 0x1d
+#define ALLOW_MEDIUM_REMOVAL 0x1e
+#define SET_WINDOW 0x24
+#define READ_CAPACITY 0x25
+#define READ_10 0x28
+#define WRITE_10 0x2a
+#define SEEK_10 0x2b
+#define WRITE_VERIFY 0x2e
+#define VERIFY 0x2f
+#define SEARCH_HIGH 0x30
+#define SEARCH_EQUAL 0x31
+#define SEARCH_LOW 0x32
+#define SET_LIMITS 0x33
+#define PRE_FETCH 0x34
+#define READ_POSITION 0x34
+#define SYNCHRONIZE_CACHE 0x35
+#define LOCK_UNLOCK_CACHE 0x36
+#define READ_DEFECT_DATA 0x37
+#define MEDIUM_SCAN 0x38
+#define COMPARE 0x39
+#define COPY_VERIFY 0x3a
+#define WRITE_BUFFER 0x3b
+#define READ_BUFFER 0x3c
+#define UPDATE_BLOCK 0x3d
+#define READ_LONG 0x3e
+#define WRITE_LONG 0x3f
+#define CHANGE_DEFINITION 0x40
+#define WRITE_SAME 0x41
+#define READ_TOC 0x43
+#define LOG_SELECT 0x4c
+#define LOG_SENSE 0x4d
+#define MODE_SELECT_10 0x55
+#define RESERVE_10 0x56
+#define RELEASE_10 0x57
+#define MODE_SENSE_10 0x5a
+#define PERSISTENT_RESERVE_IN 0x5e
+#define PERSISTENT_RESERVE_OUT 0x5f
+#define MOVE_MEDIUM 0xa5
+#define READ_12 0xa8
+#define WRITE_12 0xaa
+#define WRITE_VERIFY_12 0xae
+#define SEARCH_HIGH_12 0xb0
+#define SEARCH_EQUAL_12 0xb1
+#define SEARCH_LOW_12 0xb2
+#define READ_ELEMENT_STATUS 0xb8
+#define SEND_VOLUME_TAG 0xb6
+#define WRITE_LONG_2 0xea
+#define GOOD 0x00
+#define CHECK_CONDITION 0x01
+#define CONDITION_GOOD 0x02
+#define BUSY 0x04
+#define INTERMEDIATE_GOOD 0x08
+#define INTERMEDIATE_C_GOOD 0x0a
+#define RESERVATION_CONFLICT 0x0c
+#define COMMAND_TERMINATED 0x11
+#define QUEUE_FULL 0x14
+#define STATUS_MASK 0x3e
+#define NO_SENSE 0x00
+#define RECOVERED_ERROR 0x01
+#define NOT_READY 0x02
+#define MEDIUM_ERROR 0x03
+#define HARDWARE_ERROR 0x04
+#define ILLEGAL_REQUEST 0x05
+#define UNIT_ATTENTION 0x06
+#define DATA_PROTECT 0x07
+#define BLANK_CHECK 0x08
+#define COPY_ABORTED 0x0a
+#define ABORTED_COMMAND 0x0b
+#define VOLUME_OVERFLOW 0x0d
+#define MISCOMPARE 0x0e
+#define TYPE_DISK 0x00
+#define TYPE_TAPE 0x01
+#define TYPE_PROCESSOR 0x03
+#define TYPE_WORM 0x04
+#define TYPE_ROM 0x05
+#define TYPE_SCANNER 0x06
+#define TYPE_MOD 0x07
+#define TYPE_MEDIUM_CHANGER 0x08
+#define TYPE_ENCLOSURE 0x0d
+#define TYPE_NO_LUN 0x7f
+#define COMMAND_COMPLETE 0x00
+#define EXTENDED_MESSAGE 0x01
+#define EXTENDED_MODIFY_DATA_POINTER 0x00
+#define EXTENDED_SDTR 0x01
+#define EXTENDED_EXTENDED_IDENTIFY 0x02
+#define EXTENDED_WDTR 0x03
+#define SAVE_POINTERS 0x02
+#define RESTORE_POINTERS 0x03
+#define DISCONNECT 0x04
+#define INITIATOR_ERROR 0x05
+#define ABORT 0x06
+#define MESSAGE_REJECT 0x07
+#define NOP 0x08
+#define MSG_PARITY_ERROR 0x09
+#define LINKED_CMD_COMPLETE 0x0a
+#define LINKED_FLG_CMD_COMPLETE 0x0b
+#define BUS_DEVICE_RESET 0x0c
+#define INITIATE_RECOVERY 0x0f
+#define RELEASE_RECOVERY 0x10
+#define SIMPLE_QUEUE_TAG 0x20
+#define HEAD_OF_QUEUE_TAG 0x21
+#define ORDERED_QUEUE_TAG 0x22
+#define SCSI_IOCTL_GET_IDLUN 0x5382
+#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
+#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
+#define SCSI_IOCTL_PROBE_HOST 0x5385
+#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
+
+struct ccs_modesel_head {
+	unsigned char _r1;
+	unsigned char medium;
+	unsigned char _r2;
+	unsigned char block_desc_length;
+	unsigned char density;
+	unsigned char number_blocks_hi;
+	unsigned char number_blocks_med;
+	unsigned char number_blocks_lo;
+	unsigned char _r3;
+	unsigned char block_length_hi;
+	unsigned char block_length_med;
+	unsigned char block_length_lo;
+};
+
+#endif
+
diff --git a/musl-include/arm/scsi/scsi_ioctl.h b/musl-include/arm/scsi/scsi_ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/scsi/scsi_ioctl.h
@@ -0,0 +1,11 @@
+#ifndef _SCSI_IOCTL_H
+#define _SCSI_IOCTL_H
+#define SCSI_IOCTL_SEND_COMMAND 1
+#define SCSI_IOCTL_TEST_UNIT_READY 2
+#define SCSI_IOCTL_BENCHMARK_COMMAND 3
+#define SCSI_IOCTL_SYNC 4
+#define SCSI_IOCTL_START_UNIT 5
+#define SCSI_IOCTL_STOP_UNIT 6
+#define SCSI_IOCTL_DOORLOCK 0x5380
+#define SCSI_IOCTL_DOORUNLOCK 0x5381
+#endif
diff --git a/musl-include/arm/scsi/sg.h b/musl-include/arm/scsi/sg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/scsi/sg.h
@@ -0,0 +1,129 @@
+#ifndef _SCSI_SG_H
+#define _SCSI_SG_H
+
+#define SG_DXFER_NONE -1
+#define SG_DXFER_TO_DEV -2
+#define SG_DXFER_FROM_DEV -3
+#define SG_DXFER_TO_FROM_DEV -4
+#define SG_FLAG_DIRECT_IO 1
+#define SG_FLAG_LUN_INHIBIT 2
+#define SG_FLAG_NO_DXFER 0x10000
+#define SG_INFO_OK_MASK 0x1
+#define SG_INFO_OK 0x0
+#define SG_INFO_CHECK 0x1
+#define SG_INFO_DIRECT_IO_MASK 0x6
+#define SG_INFO_INDIRECT_IO 0x0
+#define SG_INFO_DIRECT_IO 0x2
+#define SG_INFO_MIXED_IO 0x4
+#define SG_EMULATED_HOST 0x2203
+#define SG_SET_TRANSFORM 0x2204
+#define SG_GET_TRANSFORM 0x2205
+#define SG_SET_RESERVED_SIZE 0x2275
+#define SG_GET_RESERVED_SIZE 0x2272
+#define SG_GET_SCSI_ID 0x2276
+#define SG_SET_FORCE_LOW_DMA 0x2279
+#define SG_GET_LOW_DMA 0x227a
+#define SG_SET_FORCE_PACK_ID 0x227b
+#define SG_GET_PACK_ID 0x227c
+#define SG_GET_NUM_WAITING 0x227d
+#define SG_GET_SG_TABLESIZE 0x227F
+#define SG_GET_VERSION_NUM 0x2282
+#define SG_SCSI_RESET 0x2284
+#define SG_SCSI_RESET_NOTHING 0
+#define SG_SCSI_RESET_DEVICE 1
+#define SG_SCSI_RESET_BUS 2
+#define SG_SCSI_RESET_HOST 3
+#define SG_IO 0x2285
+#define SG_GET_REQUEST_TABLE 0x2286
+#define SG_SET_KEEP_ORPHAN 0x2287
+#define SG_GET_KEEP_ORPHAN 0x2288
+#define SG_SCATTER_SZ (8 * 4096)
+#define SG_DEFAULT_RETRIES 1
+#define SG_DEF_FORCE_LOW_DMA 0
+#define SG_DEF_FORCE_PACK_ID 0
+#define SG_DEF_KEEP_ORPHAN 0
+#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
+#define SG_MAX_QUEUE 16
+#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
+#define SG_MAX_SENSE 16
+#define SG_SET_TIMEOUT 0x2201
+#define SG_GET_TIMEOUT 0x2202
+#define SG_GET_COMMAND_Q 0x2270
+#define SG_SET_COMMAND_Q 0x2271
+#define SG_SET_DEBUG 0x227e
+#define SG_NEXT_CMD_LEN 0x2283
+#define SG_DEFAULT_TIMEOUT (60*100) /* 60*HZ */
+#define SG_DEF_COMMAND_Q 0
+#define SG_DEF_UNDERRUN_FLAG 0
+
+typedef struct sg_iovec {
+	void *iov_base;
+	unsigned long iov_len;
+} sg_iovec_t;
+
+typedef struct sg_io_hdr { 
+	int interface_id; 
+	int dxfer_direction; 
+	unsigned char cmd_len;
+	unsigned char mx_sb_len;
+	unsigned short iovec_count;
+	unsigned dxfer_len;
+	void *dxferp;
+	unsigned char *cmdp;
+	unsigned char *sbp;
+	unsigned timeout;
+	unsigned flags;
+	int pack_id;
+	void *usr_ptr;
+	unsigned char status;
+	unsigned char masked_status;
+	unsigned char msg_status;
+	unsigned char sb_len_wr;
+	unsigned short host_status;
+	unsigned short driver_status;
+	int resid; 
+	unsigned int duration;
+	unsigned int info;
+} sg_io_hdr_t;
+
+struct sg_scsi_id {
+	int host_no;
+	int channel;
+	int scsi_id;
+	int lun;
+	int scsi_type;
+	short h_cmd_per_lun;
+	short d_queue_depth;
+	int unused[2];
+};
+
+typedef struct sg_req_info {
+	char req_state;
+	char orphan;
+	char sg_io_owned;
+	char problem;
+	int pack_id;
+	void *usr_ptr;
+	unsigned duration; 
+	int unused; 
+} sg_req_info_t;
+
+typedef struct sg_io_hdr Sg_io_hdr;
+typedef struct sg_io_vec Sg_io_vec;
+typedef struct sg_scsi_id Sg_scsi_id;
+typedef struct sg_req_info Sg_req_info;
+
+struct sg_header {
+	int pack_len;
+	int reply_len;
+	int pack_id;
+	int result;
+	unsigned twelve_byte:1;
+	unsigned target_status:5;
+	unsigned host_status:8;
+	unsigned driver_status:8;
+	unsigned other_flags:10;
+	unsigned char sense_buffer[SG_MAX_SENSE];
+};
+
+#endif
diff --git a/musl-include/arm/search.h b/musl-include/arm/search.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/search.h
@@ -0,0 +1,63 @@
+#ifndef _SEARCH_H
+#define _SEARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+typedef enum { FIND, ENTER } ACTION;
+typedef enum { preorder, postorder, endorder, leaf } VISIT;
+
+typedef struct entry {
+	char *key;
+	void *data;
+} ENTRY;
+
+int hcreate(size_t);
+void hdestroy(void);
+ENTRY *hsearch(ENTRY, ACTION);
+
+#ifdef _GNU_SOURCE
+struct hsearch_data {
+	struct __tab *__tab;
+	unsigned int __unused1;
+	unsigned int __unused2;
+};
+
+int hcreate_r(size_t, struct hsearch_data *);
+void hdestroy_r(struct hsearch_data *);
+int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
+#endif
+
+void insque(void *, void *);
+void remque(void *);
+
+void *lsearch(const void *, void *, size_t *, size_t,
+	int (*)(const void *, const void *));
+void *lfind(const void *, const void *, size_t *, size_t,
+	int (*)(const void *, const void *));
+
+void *tdelete(const void *__restrict, void **__restrict, int(*)(const void *, const void *));
+void *tfind(const void *, void *const *, int(*)(const void *, const void *));
+void *tsearch(const void *, void **, int (*)(const void *, const void *));
+void twalk(const void *, void (*)(const void *, VISIT, int));
+
+#ifdef _GNU_SOURCE
+struct qelem {
+	struct qelem *q_forw, *q_back;
+	char q_data[1];
+};
+
+void tdestroy(void *, void (*)(void *));
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/semaphore.h b/musl-include/arm/semaphore.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/semaphore.h
@@ -0,0 +1,39 @@
+#ifndef _SEMAPHORE_H
+#define _SEMAPHORE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+#include <fcntl.h>
+
+#define SEM_FAILED ((sem_t *)0)
+
+typedef struct {
+	volatile int __val[4*sizeof(long)/sizeof(int)];
+} sem_t;
+
+int    sem_close(sem_t *);
+int    sem_destroy(sem_t *);
+int    sem_getvalue(sem_t *__restrict, int *__restrict);
+int    sem_init(sem_t *, int, unsigned);
+sem_t *sem_open(const char *, int, ...);
+int    sem_post(sem_t *);
+int    sem_timedwait(sem_t *__restrict, const struct timespec *__restrict);
+int    sem_trywait(sem_t *);
+int    sem_unlink(const char *);
+int    sem_wait(sem_t *);
+
+#if _REDIR_TIME64
+__REDIR(sem_timedwait, __sem_timedwait_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/setjmp.h b/musl-include/arm/setjmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/setjmp.h
@@ -0,0 +1,49 @@
+#ifndef	_SETJMP_H
+#define	_SETJMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/setjmp.h>
+
+typedef struct __jmp_buf_tag {
+	__jmp_buf __jb;
+	unsigned long __fl;
+	unsigned long __ss[128/sizeof(long)];
+} jmp_buf[1];
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
+#define __setjmp_attr __attribute__((__returns_twice__))
+#else
+#define __setjmp_attr
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+typedef jmp_buf sigjmp_buf;
+int sigsetjmp (sigjmp_buf, int) __setjmp_attr;
+_Noreturn void siglongjmp (sigjmp_buf, int);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+int _setjmp (jmp_buf) __setjmp_attr;
+_Noreturn void _longjmp (jmp_buf, int);
+#endif
+
+int setjmp (jmp_buf) __setjmp_attr;
+_Noreturn void longjmp (jmp_buf, int);
+
+#define setjmp setjmp
+
+#undef __setjmp_attr
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/shadow.h b/musl-include/arm/shadow.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/shadow.h
@@ -0,0 +1,44 @@
+#ifndef _SHADOW_H
+#define _SHADOW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	__NEED_FILE
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#define	SHADOW "/etc/shadow"
+
+struct spwd {
+	char *sp_namp;
+	char *sp_pwdp;
+	long sp_lstchg;
+	long sp_min;
+	long sp_max;
+	long sp_warn;
+	long sp_inact;
+	long sp_expire;
+	unsigned long sp_flag;
+};
+
+void setspent(void);
+void endspent(void);
+struct spwd *getspent(void);
+struct spwd *fgetspent(FILE *);
+struct spwd *sgetspent(const char *);
+int putspent(const struct spwd *, FILE *);
+
+struct spwd *getspnam(const char *);
+int getspnam_r(const char *, struct spwd *, char *, size_t, struct spwd **);
+
+int lckpwdf(void);
+int ulckpwdf(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/signal.h b/musl-include/arm/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/signal.h
@@ -0,0 +1,304 @@
+#ifndef _SIGNAL_H
+#define _SIGNAL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#ifdef _GNU_SOURCE
+#define __ucontext ucontext
+#endif
+
+#define __NEED_size_t
+#define __NEED_pid_t
+#define __NEED_uid_t
+#define __NEED_struct_timespec
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_time_t
+#define __NEED_clock_t
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define SIG_BLOCK     0
+#define SIG_UNBLOCK   1
+#define SIG_SETMASK   2
+
+#define SI_ASYNCNL (-60)
+#define SI_TKILL (-6)
+#define SI_SIGIO (-5)
+#define SI_ASYNCIO (-4)
+#define SI_MESGQ (-3)
+#define SI_TIMER (-2)
+#define SI_QUEUE (-1)
+#define SI_USER 0
+#define SI_KERNEL 128
+
+typedef struct sigaltstack stack_t;
+
+#endif
+
+#include <bits/signal.h>
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define SIG_HOLD ((void (*)(int)) 2)
+
+#define FPE_INTDIV 1
+#define FPE_INTOVF 2
+#define FPE_FLTDIV 3
+#define FPE_FLTOVF 4
+#define FPE_FLTUND 5
+#define FPE_FLTRES 6
+#define FPE_FLTINV 7
+#define FPE_FLTSUB 8
+
+#define ILL_ILLOPC 1
+#define ILL_ILLOPN 2
+#define ILL_ILLADR 3
+#define ILL_ILLTRP 4
+#define ILL_PRVOPC 5
+#define ILL_PRVREG 6
+#define ILL_COPROC 7
+#define ILL_BADSTK 8
+
+#define SEGV_MAPERR 1
+#define SEGV_ACCERR 2
+#define SEGV_BNDERR 3
+#define SEGV_PKUERR 4
+#define SEGV_MTEAERR 8
+#define SEGV_MTESERR 9
+
+#define BUS_ADRALN 1
+#define BUS_ADRERR 2
+#define BUS_OBJERR 3
+#define BUS_MCEERR_AR 4
+#define BUS_MCEERR_AO 5
+
+#define CLD_EXITED 1
+#define CLD_KILLED 2
+#define CLD_DUMPED 3
+#define CLD_TRAPPED 4
+#define CLD_STOPPED 5
+#define CLD_CONTINUED 6
+
+union sigval {
+	int sival_int;
+	void *sival_ptr;
+};
+
+typedef struct {
+#ifdef __SI_SWAP_ERRNO_CODE
+	int si_signo, si_code, si_errno;
+#else
+	int si_signo, si_errno, si_code;
+#endif
+	union {
+		char __pad[128 - 2*sizeof(int) - sizeof(long)];
+		struct {
+			union {
+				struct {
+					pid_t si_pid;
+					uid_t si_uid;
+				} __piduid;
+				struct {
+					int si_timerid;
+					int si_overrun;
+				} __timer;
+			} __first;
+			union {
+				union sigval si_value;
+				struct {
+					int si_status;
+					clock_t si_utime, si_stime;
+				} __sigchld;
+			} __second;
+		} __si_common;
+		struct {
+			void *si_addr;
+			short si_addr_lsb;
+			union {
+				struct {
+					void *si_lower;
+					void *si_upper;
+				} __addr_bnd;
+				unsigned si_pkey;
+			} __first;
+		} __sigfault;
+		struct {
+			long si_band;
+			int si_fd;
+		} __sigpoll;
+		struct {
+			void *si_call_addr;
+			int si_syscall;
+			unsigned si_arch;
+		} __sigsys;
+	} __si_fields;
+} siginfo_t;
+#define si_pid     __si_fields.__si_common.__first.__piduid.si_pid
+#define si_uid     __si_fields.__si_common.__first.__piduid.si_uid
+#define si_status  __si_fields.__si_common.__second.__sigchld.si_status
+#define si_utime   __si_fields.__si_common.__second.__sigchld.si_utime
+#define si_stime   __si_fields.__si_common.__second.__sigchld.si_stime
+#define si_value   __si_fields.__si_common.__second.si_value
+#define si_addr    __si_fields.__sigfault.si_addr
+#define si_addr_lsb __si_fields.__sigfault.si_addr_lsb
+#define si_lower   __si_fields.__sigfault.__first.__addr_bnd.si_lower
+#define si_upper   __si_fields.__sigfault.__first.__addr_bnd.si_upper
+#define si_pkey    __si_fields.__sigfault.__first.si_pkey
+#define si_band    __si_fields.__sigpoll.si_band
+#define si_fd      __si_fields.__sigpoll.si_fd
+#define si_timerid __si_fields.__si_common.__first.__timer.si_timerid
+#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun
+#define si_ptr     si_value.sival_ptr
+#define si_int     si_value.sival_int
+#define si_call_addr __si_fields.__sigsys.si_call_addr
+#define si_syscall __si_fields.__sigsys.si_syscall
+#define si_arch    __si_fields.__sigsys.si_arch
+
+struct sigaction {
+	union {
+		void (*sa_handler)(int);
+		void (*sa_sigaction)(int, siginfo_t *, void *);
+	} __sa_handler;
+	sigset_t sa_mask;
+	int sa_flags;
+	void (*sa_restorer)(void);
+};
+#define sa_handler   __sa_handler.sa_handler
+#define sa_sigaction __sa_handler.sa_sigaction
+
+#define SA_UNSUPPORTED 0x00000400
+#define SA_EXPOSE_TAGBITS 0x00000800
+
+struct sigevent {
+	union sigval sigev_value;
+	int sigev_signo;
+	int sigev_notify;
+	union {
+		char __pad[64 - 2*sizeof(int) - sizeof(union sigval)];
+		pid_t sigev_notify_thread_id;
+		struct {
+			void (*sigev_notify_function)(union sigval);
+			pthread_attr_t *sigev_notify_attributes;
+		} __sev_thread;
+	} __sev_fields;
+};
+
+#define sigev_notify_thread_id __sev_fields.sigev_notify_thread_id
+#define sigev_notify_function __sev_fields.__sev_thread.sigev_notify_function
+#define sigev_notify_attributes __sev_fields.__sev_thread.sigev_notify_attributes
+
+#define SIGEV_SIGNAL 0
+#define SIGEV_NONE 1
+#define SIGEV_THREAD 2
+#define SIGEV_THREAD_ID 4
+
+int __libc_current_sigrtmin(void);
+int __libc_current_sigrtmax(void);
+
+#define SIGRTMIN  (__libc_current_sigrtmin())
+#define SIGRTMAX  (__libc_current_sigrtmax())
+
+int kill(pid_t, int);
+
+int sigemptyset(sigset_t *);
+int sigfillset(sigset_t *);
+int sigaddset(sigset_t *, int);
+int sigdelset(sigset_t *, int);
+int sigismember(const sigset_t *, int);
+
+int sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict);
+int sigsuspend(const sigset_t *);
+int sigaction(int, const struct sigaction *__restrict, struct sigaction *__restrict);
+int sigpending(sigset_t *);
+int sigwait(const sigset_t *__restrict, int *__restrict);
+int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict);
+int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct timespec *__restrict);
+int sigqueue(pid_t, int, union sigval);
+
+int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict);
+int pthread_kill(pthread_t, int);
+
+void psiginfo(const siginfo_t *, const char *);
+void psignal(int, const char *);
+
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+int killpg(pid_t, int);
+int sigaltstack(const stack_t *__restrict, stack_t *__restrict);
+int sighold(int);
+int sigignore(int);
+int siginterrupt(int, int);
+int sigpause(int);
+int sigrelse(int);
+void (*sigset(int, void (*)(int)))(int);
+#define TRAP_BRKPT 1
+#define TRAP_TRACE 2
+#define TRAP_BRANCH 3
+#define TRAP_HWBKPT 4
+#define TRAP_UNK 5
+#define POLL_IN 1
+#define POLL_OUT 2
+#define POLL_MSG 3
+#define POLL_ERR 4
+#define POLL_PRI 5
+#define POLL_HUP 6
+#define SS_ONSTACK    1
+#define SS_DISABLE    2
+#define SS_AUTODISARM (1U << 31)
+#define SS_FLAG_BITS SS_AUTODISARM
+#endif
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define NSIG _NSIG
+typedef void (*sig_t)(int);
+
+#define SYS_SECCOMP 1
+#define SYS_USER_DISPATCH 2
+#endif
+
+#ifdef _GNU_SOURCE
+typedef void (*sighandler_t)(int);
+void (*bsd_signal(int, void (*)(int)))(int);
+int sigisemptyset(const sigset_t *);
+int sigorset (sigset_t *, const sigset_t *, const sigset_t *);
+int sigandset(sigset_t *, const sigset_t *, const sigset_t *);
+
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
+#endif
+
+#define SIG_ERR  ((void (*)(int))-1)
+#define SIG_DFL  ((void (*)(int)) 0)
+#define SIG_IGN  ((void (*)(int)) 1)
+
+typedef int sig_atomic_t;
+
+void (*signal(int, void (*)(int)))(int);
+int raise(int);
+
+#if _REDIR_TIME64
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+__REDIR(sigtimedwait, __sigtimedwait_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/spawn.h b/musl-include/arm/spawn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/spawn.h
@@ -0,0 +1,83 @@
+#ifndef _SPAWN_H
+#define _SPAWN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_mode_t
+#define __NEED_pid_t
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+struct sched_param;
+
+#define POSIX_SPAWN_RESETIDS 1
+#define POSIX_SPAWN_SETPGROUP 2
+#define POSIX_SPAWN_SETSIGDEF 4
+#define POSIX_SPAWN_SETSIGMASK 8
+#define POSIX_SPAWN_SETSCHEDPARAM 16
+#define POSIX_SPAWN_SETSCHEDULER 32
+#define POSIX_SPAWN_USEVFORK 64
+#define POSIX_SPAWN_SETSID 128
+
+typedef struct {
+	int __flags;
+	pid_t __pgrp;
+	sigset_t __def, __mask;
+	int __prio, __pol;
+	void *__fn;
+	char __pad[64-sizeof(void *)];
+} posix_spawnattr_t;
+
+typedef struct {
+	int __pad0[2];
+	void *__actions;
+	int __pad[16];
+} posix_spawn_file_actions_t;
+
+int posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
+int posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
+
+int posix_spawnattr_init(posix_spawnattr_t *);
+int posix_spawnattr_destroy(posix_spawnattr_t *);
+
+int posix_spawnattr_setflags(posix_spawnattr_t *, short);
+int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict);
+
+int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
+int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict);
+
+int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
+
+int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
+
+int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict, const struct sched_param *__restrict);
+int posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict, struct sched_param *__restrict);
+int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
+int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict, int *__restrict);
+
+int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
+int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
+
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t);
+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
+int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/stdalign.h b/musl-include/arm/stdalign.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stdalign.h
@@ -0,0 +1,20 @@
+#ifndef _STDALIGN_H
+#define _STDALIGN_H
+
+#ifndef __cplusplus
+
+/* this whole header only works in C11 or with compiler extensions */
+#if __STDC_VERSION__ < 201112L && defined( __GNUC__)
+#define _Alignas(t) __attribute__((__aligned__(t)))
+#define _Alignof(t) __alignof__(t)
+#endif
+
+#define alignas _Alignas
+#define alignof _Alignof
+
+#endif
+
+#define __alignas_is_defined 1
+#define __alignof_is_defined 1
+
+#endif
diff --git a/musl-include/arm/stdarg.h b/musl-include/arm/stdarg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stdarg.h
@@ -0,0 +1,21 @@
+#ifndef _STDARG_H
+#define _STDARG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_va_list
+
+#include <bits/alltypes.h>
+
+#define va_start(v,l)   __builtin_va_start(v,l)
+#define va_end(v)       __builtin_va_end(v)
+#define va_arg(v,l)     __builtin_va_arg(v,l)
+#define va_copy(d,s)    __builtin_va_copy(d,s)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/stdbool.h b/musl-include/arm/stdbool.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stdbool.h
@@ -0,0 +1,14 @@
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+#ifndef __cplusplus
+
+#define true 1
+#define false 0
+#define bool _Bool
+
+#endif
+
+#define __bool_true_false_are_defined 1
+
+#endif
diff --git a/musl-include/arm/stdc-predef.h b/musl-include/arm/stdc-predef.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stdc-predef.h
@@ -0,0 +1,18 @@
+#ifndef _STDC_PREDEF_H
+#define _STDC_PREDEF_H
+
+#define __STDC_ISO_10646__ 201206L
+
+#if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0
+#define __STDC_IEC_559__ 1
+#endif
+
+#if !defined(__STDC_UTF_16__)
+#define __STDC_UTF_16__ 1
+#endif
+
+#if !defined(__STDC_UTF_32__)
+#define __STDC_UTF_32__ 1
+#endif
+
+#endif
diff --git a/musl-include/arm/stddef.h b/musl-include/arm/stddef.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stddef.h
@@ -0,0 +1,27 @@
+#ifndef _STDDEF_H
+#define _STDDEF_H
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_ptrdiff_t
+#define __NEED_size_t
+#define __NEED_wchar_t
+#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
+#define __NEED_max_align_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if __GNUC__ > 3
+#define offsetof(type, member) __builtin_offsetof(type, member)
+#else
+#define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 ))
+#endif
+
+#endif
diff --git a/musl-include/arm/stdint.h b/musl-include/arm/stdint.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stdint.h
@@ -0,0 +1,117 @@
+#ifndef _STDINT_H
+#define _STDINT_H
+
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+
+#define __NEED_uint8_t
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#define __NEED_intptr_t
+#define __NEED_uintptr_t
+
+#define __NEED_intmax_t
+#define __NEED_uintmax_t
+
+#include <bits/alltypes.h>
+
+typedef int8_t int_fast8_t;
+typedef int64_t int_fast64_t;
+
+typedef int8_t  int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+
+typedef uint8_t uint_fast8_t;
+typedef uint64_t uint_fast64_t;
+
+typedef uint8_t  uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+#define INT8_MIN   (-1-0x7f)
+#define INT16_MIN  (-1-0x7fff)
+#define INT32_MIN  (-1-0x7fffffff)
+#define INT64_MIN  (-1-0x7fffffffffffffff)
+
+#define INT8_MAX   (0x7f)
+#define INT16_MAX  (0x7fff)
+#define INT32_MAX  (0x7fffffff)
+#define INT64_MAX  (0x7fffffffffffffff)
+
+#define UINT8_MAX  (0xff)
+#define UINT16_MAX (0xffff)
+#define UINT32_MAX (0xffffffffu)
+#define UINT64_MAX (0xffffffffffffffffu)
+
+#define INT_FAST8_MIN   INT8_MIN
+#define INT_FAST64_MIN  INT64_MIN
+
+#define INT_LEAST8_MIN   INT8_MIN
+#define INT_LEAST16_MIN  INT16_MIN
+#define INT_LEAST32_MIN  INT32_MIN
+#define INT_LEAST64_MIN  INT64_MIN
+
+#define INT_FAST8_MAX   INT8_MAX
+#define INT_FAST64_MAX  INT64_MAX
+
+#define INT_LEAST8_MAX   INT8_MAX
+#define INT_LEAST16_MAX  INT16_MAX
+#define INT_LEAST32_MAX  INT32_MAX
+#define INT_LEAST64_MAX  INT64_MAX
+
+#define UINT_FAST8_MAX  UINT8_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define UINT_LEAST8_MAX  UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INTMAX_MIN  INT64_MIN
+#define INTMAX_MAX  INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define WINT_MIN 0U
+#define WINT_MAX UINT32_MAX
+
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
+
+#define SIG_ATOMIC_MIN  INT32_MIN
+#define SIG_ATOMIC_MAX  INT32_MAX
+
+#include <bits/stdint.h>
+
+#define INT8_C(c)  c
+#define INT16_C(c) c
+#define INT32_C(c) c
+
+#define UINT8_C(c)  c
+#define UINT16_C(c) c
+#define UINT32_C(c) c ## U
+
+#if UINTPTR_MAX == UINT64_MAX
+#define INT64_C(c) c ## L
+#define UINT64_C(c) c ## UL
+#define INTMAX_C(c)  c ## L
+#define UINTMAX_C(c) c ## UL
+#else
+#define INT64_C(c) c ## LL
+#define UINT64_C(c) c ## ULL
+#define INTMAX_C(c)  c ## LL
+#define UINTMAX_C(c) c ## ULL
+#endif
+
+#endif
diff --git a/musl-include/arm/stdio.h b/musl-include/arm/stdio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stdio.h
@@ -0,0 +1,224 @@
+#ifndef _STDIO_H
+#define _STDIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_FILE
+#define __NEED___isoc_va_list
+#define __NEED_size_t
+
+#if __STDC_VERSION__ < 201112L
+#define __NEED_struct__IO_FILE
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_ssize_t
+#define __NEED_off_t
+#define __NEED_va_list
+#endif
+
+#include <bits/alltypes.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#undef EOF
+#define EOF (-1)
+
+#undef SEEK_SET
+#undef SEEK_CUR
+#undef SEEK_END
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#define _IOFBF 0
+#define _IOLBF 1
+#define _IONBF 2
+
+#define BUFSIZ 1024
+#define FILENAME_MAX 4096
+#define FOPEN_MAX 1000
+#define TMP_MAX 10000
+#define L_tmpnam 20
+
+typedef union _G_fpos64_t {
+	char __opaque[16];
+	long long __lldata;
+	double __align;
+} fpos_t;
+
+extern FILE *const stdin;
+extern FILE *const stdout;
+extern FILE *const stderr;
+
+#define stdin  (stdin)
+#define stdout (stdout)
+#define stderr (stderr)
+
+FILE *fopen(const char *__restrict, const char *__restrict);
+FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict);
+int fclose(FILE *);
+
+int remove(const char *);
+int rename(const char *, const char *);
+
+int feof(FILE *);
+int ferror(FILE *);
+int fflush(FILE *);
+void clearerr(FILE *);
+
+int fseek(FILE *, long, int);
+long ftell(FILE *);
+void rewind(FILE *);
+
+int fgetpos(FILE *__restrict, fpos_t *__restrict);
+int fsetpos(FILE *, const fpos_t *);
+
+size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
+size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict);
+
+int fgetc(FILE *);
+int getc(FILE *);
+int getchar(void);
+int ungetc(int, FILE *);
+
+int fputc(int, FILE *);
+int putc(int, FILE *);
+int putchar(int);
+
+char *fgets(char *__restrict, int, FILE *__restrict);
+#if __STDC_VERSION__ < 201112L
+char *gets(char *);
+#endif
+
+int fputs(const char *__restrict, FILE *__restrict);
+int puts(const char *);
+
+int printf(const char *__restrict, ...);
+int fprintf(FILE *__restrict, const char *__restrict, ...);
+int sprintf(char *__restrict, const char *__restrict, ...);
+int snprintf(char *__restrict, size_t, const char *__restrict, ...);
+
+int vprintf(const char *__restrict, __isoc_va_list);
+int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
+int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list);
+
+int scanf(const char *__restrict, ...);
+int fscanf(FILE *__restrict, const char *__restrict, ...);
+int sscanf(const char *__restrict, const char *__restrict, ...);
+int vscanf(const char *__restrict, __isoc_va_list);
+int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list);
+
+void perror(const char *);
+
+int setvbuf(FILE *__restrict, char *__restrict, int, size_t);
+void setbuf(FILE *__restrict, char *__restrict);
+
+char *tmpnam(char *);
+FILE *tmpfile(void);
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+FILE *fmemopen(void *__restrict, size_t, const char *__restrict);
+FILE *open_memstream(char **, size_t *);
+FILE *fdopen(int, const char *);
+FILE *popen(const char *, const char *);
+int pclose(FILE *);
+int fileno(FILE *);
+int fseeko(FILE *, off_t, int);
+off_t ftello(FILE *);
+int dprintf(int, const char *__restrict, ...);
+int vdprintf(int, const char *__restrict, __isoc_va_list);
+void flockfile(FILE *);
+int ftrylockfile(FILE *);
+void funlockfile(FILE *);
+int getc_unlocked(FILE *);
+int getchar_unlocked(void);
+int putc_unlocked(int, FILE *);
+int putchar_unlocked(int);
+ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict);
+ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict);
+int renameat(int, const char *, int, const char *);
+char *ctermid(char *);
+#define L_ctermid 20
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define P_tmpdir "/tmp"
+char *tempnam(const char *, const char *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define L_cuserid 20
+char *cuserid(char *);
+void setlinebuf(FILE *);
+void setbuffer(FILE *, char *, size_t);
+int fgetc_unlocked(FILE *);
+int fputc_unlocked(int, FILE *);
+int fflush_unlocked(FILE *);
+size_t fread_unlocked(void *, size_t, size_t, FILE *);
+size_t fwrite_unlocked(const void *, size_t, size_t, FILE *);
+void clearerr_unlocked(FILE *);
+int feof_unlocked(FILE *);
+int ferror_unlocked(FILE *);
+int fileno_unlocked(FILE *);
+int getw(FILE *);
+int putw(int, FILE *);
+char *fgetln(FILE *, size_t *);
+int asprintf(char **, const char *, ...);
+int vasprintf(char **, const char *, __isoc_va_list);
+#endif
+
+#ifdef _GNU_SOURCE
+char *fgets_unlocked(char *, int, FILE *);
+int fputs_unlocked(const char *, FILE *);
+
+typedef ssize_t (cookie_read_function_t)(void *, char *, size_t);
+typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
+typedef int (cookie_seek_function_t)(void *, off_t *, int);
+typedef int (cookie_close_function_t)(void *);
+
+typedef struct _IO_cookie_io_functions_t {
+	cookie_read_function_t *read;
+	cookie_write_function_t *write;
+	cookie_seek_function_t *seek;
+	cookie_close_function_t *close;
+} cookie_io_functions_t;
+
+FILE *fopencookie(void *, const char *, cookie_io_functions_t);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define tmpfile64 tmpfile
+#define fopen64 fopen
+#define freopen64 freopen
+#define fseeko64 fseeko
+#define ftello64 ftello
+#define fgetpos64 fgetpos
+#define fsetpos64 fsetpos
+#define fpos64_t fpos_t
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/stdio_ext.h b/musl-include/arm/stdio_ext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stdio_ext.h
@@ -0,0 +1,34 @@
+#ifndef _STDIO_EXT_H
+#define _STDIO_EXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+#define FSETLOCKING_QUERY 0
+#define FSETLOCKING_INTERNAL 1
+#define FSETLOCKING_BYCALLER 2
+
+void _flushlbf(void);
+int __fsetlocking(FILE *, int);
+int __fwriting(FILE *);
+int __freading(FILE *);
+int __freadable(FILE *);
+int __fwritable(FILE *);
+int __flbf(FILE *);
+size_t __fbufsize(FILE *);
+size_t __fpending(FILE *);
+int __fpurge(FILE *);
+
+size_t __freadahead(FILE *);
+const char *__freadptr(FILE *, size_t *);
+void __freadptrinc(FILE *, size_t);
+void __fseterr(FILE *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/stdlib.h b/musl-include/arm/stdlib.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stdlib.h
@@ -0,0 +1,179 @@
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#define __NEED_wchar_t
+
+#include <bits/alltypes.h>
+
+int atoi (const char *);
+long atol (const char *);
+long long atoll (const char *);
+double atof (const char *);
+
+float strtof (const char *__restrict, char **__restrict);
+double strtod (const char *__restrict, char **__restrict);
+long double strtold (const char *__restrict, char **__restrict);
+
+long strtol (const char *__restrict, char **__restrict, int);
+unsigned long strtoul (const char *__restrict, char **__restrict, int);
+long long strtoll (const char *__restrict, char **__restrict, int);
+unsigned long long strtoull (const char *__restrict, char **__restrict, int);
+
+int rand (void);
+void srand (unsigned);
+
+void *malloc (size_t);
+void *calloc (size_t, size_t);
+void *realloc (void *, size_t);
+void free (void *);
+void *aligned_alloc(size_t, size_t);
+
+_Noreturn void abort (void);
+int atexit (void (*) (void));
+_Noreturn void exit (int);
+_Noreturn void _Exit (int);
+int at_quick_exit (void (*) (void));
+_Noreturn void quick_exit (int);
+
+char *getenv (const char *);
+
+int system (const char *);
+
+void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
+void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
+
+int abs (int);
+long labs (long);
+long long llabs (long long);
+
+typedef struct { int quot, rem; } div_t;
+typedef struct { long quot, rem; } ldiv_t;
+typedef struct { long long quot, rem; } lldiv_t;
+
+div_t div (int, int);
+ldiv_t ldiv (long, long);
+lldiv_t lldiv (long long, long long);
+
+int mblen (const char *, size_t);
+int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
+int wctomb (char *, wchar_t);
+size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
+size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+size_t __ctype_get_mb_cur_max(void);
+#define MB_CUR_MAX (__ctype_get_mb_cur_max())
+
+#define RAND_MAX (0x7fffffff)
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define WNOHANG    1
+#define WUNTRACED  2
+
+#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
+#define WTERMSIG(s) ((s) & 0x7f)
+#define WSTOPSIG(s) WEXITSTATUS(s)
+#define WIFEXITED(s) (!WTERMSIG(s))
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
+
+int posix_memalign (void **, size_t, size_t);
+int setenv (const char *, const char *, int);
+int unsetenv (const char *);
+int mkstemp (char *);
+int mkostemp (char *, int);
+char *mkdtemp (char *);
+int getsubopt (char **, char *const *, char **);
+int rand_r (unsigned *);
+
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+char *realpath (const char *__restrict, char *__restrict);
+long int random (void);
+void srandom (unsigned int);
+char *initstate (unsigned int, char *, size_t);
+char *setstate (char *);
+int putenv (char *);
+int posix_openpt (int);
+int grantpt (int);
+int unlockpt (int);
+char *ptsname (int);
+char *l64a (long);
+long a64l (const char *);
+void setkey (const char *);
+double drand48 (void);
+double erand48 (unsigned short [3]);
+long int lrand48 (void);
+long int nrand48 (unsigned short [3]);
+long mrand48 (void);
+long jrand48 (unsigned short [3]);
+void srand48 (long);
+unsigned short *seed48 (unsigned short [3]);
+void lcong48 (unsigned short [7]);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#include <alloca.h>
+char *mktemp (char *);
+int mkstemps (char *, int);
+int mkostemps (char *, int, int);
+void *valloc (size_t);
+void *memalign(size_t, size_t);
+int getloadavg(double *, int);
+int clearenv(void);
+#define WCOREDUMP(s) ((s) & 0x80)
+#define WIFCONTINUED(s) ((s) == 0xffff)
+void *reallocarray (void *, size_t, size_t);
+void qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *);
+#endif
+
+#ifdef _GNU_SOURCE
+int ptsname_r(int, char *, size_t);
+char *ecvt(double, int, int *, int *);
+char *fcvt(double, int, int *, int *);
+char *gcvt(double, int, char *);
+char *secure_getenv(const char *);
+struct __locale_struct;
+float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define mkstemp64 mkstemp
+#define mkostemp64 mkostemp
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define mkstemps64 mkstemps
+#define mkostemps64 mkostemps
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/stdnoreturn.h b/musl-include/arm/stdnoreturn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stdnoreturn.h
@@ -0,0 +1,7 @@
+#ifndef _STDNORETURN_H
+#define _STDNORETURN_H
+#ifndef __cplusplus
+#include <features.h>
+#define noreturn _Noreturn
+#endif
+#endif
diff --git a/musl-include/arm/string.h b/musl-include/arm/string.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/string.h
@@ -0,0 +1,104 @@
+#ifndef	_STRING_H
+#define	_STRING_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+void *memcpy (void *__restrict, const void *__restrict, size_t);
+void *memmove (void *, const void *, size_t);
+void *memset (void *, int, size_t);
+int memcmp (const void *, const void *, size_t);
+void *memchr (const void *, int, size_t);
+
+char *strcpy (char *__restrict, const char *__restrict);
+char *strncpy (char *__restrict, const char *__restrict, size_t);
+
+char *strcat (char *__restrict, const char *__restrict);
+char *strncat (char *__restrict, const char *__restrict, size_t);
+
+int strcmp (const char *, const char *);
+int strncmp (const char *, const char *, size_t);
+
+int strcoll (const char *, const char *);
+size_t strxfrm (char *__restrict, const char *__restrict, size_t);
+
+char *strchr (const char *, int);
+char *strrchr (const char *, int);
+
+size_t strcspn (const char *, const char *);
+size_t strspn (const char *, const char *);
+char *strpbrk (const char *, const char *);
+char *strstr (const char *, const char *);
+char *strtok (char *__restrict, const char *__restrict);
+
+size_t strlen (const char *);
+
+char *strerror (int);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#include <strings.h>
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
+int strerror_r (int, char *, size_t);
+char *stpcpy(char *__restrict, const char *__restrict);
+char *stpncpy(char *__restrict, const char *__restrict, size_t);
+size_t strnlen (const char *, size_t);
+char *strdup (const char *);
+char *strndup (const char *, size_t);
+char *strsignal(int);
+char *strerror_l (int, locale_t);
+int strcoll_l (const char *, const char *, locale_t);
+size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
+void *memmem(const void *, size_t, const void *, size_t);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+void *memccpy (void *__restrict, const void *__restrict, int, size_t);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+char *strsep(char **, const char *);
+size_t strlcat (char *, const char *, size_t);
+size_t strlcpy (char *, const char *, size_t);
+void explicit_bzero (void *, size_t);
+#endif
+
+#ifdef _GNU_SOURCE
+#define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)
+int strverscmp (const char *, const char *);
+char *strchrnul(const char *, int);
+char *strcasestr(const char *, const char *);
+void *memrchr(const void *, int, size_t);
+void *mempcpy(void *, const void *, size_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/strings.h b/musl-include/arm/strings.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/strings.h
@@ -0,0 +1,40 @@
+#ifndef	_STRINGS_H
+#define	_STRINGS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_locale_t
+#include <bits/alltypes.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+int bcmp (const void *, const void *, size_t);
+void bcopy (const void *, void *, size_t);
+void bzero (void *, size_t);
+char *index (const char *, int);
+char *rindex (const char *, int);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)  || defined(_BSD_SOURCE)
+int ffs (int);
+int ffsl (long);
+int ffsll (long long);
+#endif
+
+int strcasecmp (const char *, const char *);
+int strncasecmp (const char *, const char *, size_t);
+
+int strcasecmp_l (const char *, const char *, locale_t);
+int strncasecmp_l (const char *, const char *, size_t, locale_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/stropts.h b/musl-include/arm/stropts.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/stropts.h
@@ -0,0 +1,139 @@
+#ifndef _STROPTS_H
+#define _STROPTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __SID		('S' << 8)
+
+#define I_NREAD		(__SID | 1)
+#define I_PUSH		(__SID | 2)
+#define I_POP		(__SID | 3)
+#define I_LOOK		(__SID | 4)
+#define I_FLUSH		(__SID | 5)
+#define I_SRDOPT	(__SID | 6)
+#define I_GRDOPT	(__SID | 7)
+#define I_STR		(__SID | 8)
+#define I_SETSIG	(__SID | 9)
+#define I_GETSIG	(__SID |10)
+#define I_FIND		(__SID |11)
+#define I_LINK		(__SID |12)
+#define I_UNLINK	(__SID |13)
+#define I_PEEK		(__SID |15)
+#define I_FDINSERT	(__SID |16)
+#define I_SENDFD	(__SID |17)
+#define I_RECVFD	(__SID |14)
+#define I_SWROPT	(__SID |19)
+#define I_GWROPT	(__SID |20)
+#define I_LIST		(__SID |21)
+#define I_PLINK		(__SID |22)
+#define I_PUNLINK	(__SID |23)
+#define I_FLUSHBAND	(__SID |28)
+#define I_CKBAND	(__SID |29)
+#define I_GETBAND	(__SID |30)
+#define I_ATMARK	(__SID |31)
+#define I_SETCLTIME	(__SID |32)
+#define I_GETCLTIME	(__SID |33)
+#define I_CANPUT	(__SID |34)
+
+#define FMNAMESZ	8
+
+#define FLUSHR		0x01
+#define FLUSHW		0x02
+#define FLUSHRW		0x03
+#define FLUSHBAND	0x04
+
+#define S_INPUT		0x0001
+#define S_HIPRI		0x0002
+#define S_OUTPUT	0x0004
+#define S_MSG		0x0008
+#define S_ERROR		0x0010
+#define S_HANGUP	0x0020
+#define S_RDNORM	0x0040
+#define S_WRNORM	S_OUTPUT
+#define S_RDBAND	0x0080
+#define S_WRBAND	0x0100
+#define S_BANDURG	0x0200
+
+#define RS_HIPRI	0x01
+
+#define RNORM		0x0000
+#define RMSGD		0x0001
+#define RMSGN		0x0002
+#define RPROTDAT	0x0004
+#define RPROTDIS	0x0008
+#define RPROTNORM	0x0010
+#define RPROTMASK	0x001C
+
+#define SNDZERO		0x001
+#define SNDPIPE		0x002
+
+#define ANYMARK		0x01
+#define LASTMARK	0x02
+
+#define MUXID_ALL	(-1)
+
+#define MSG_HIPRI	0x01
+#define MSG_ANY		0x02
+#define MSG_BAND	0x04
+
+#define MORECTL		1
+#define MOREDATA	2
+
+struct bandinfo {
+	unsigned char bi_pri;
+	int bi_flag;
+};
+
+struct strbuf {
+	int maxlen;
+	int len;
+	char *buf;
+};
+
+struct strpeek {
+	struct strbuf ctlbuf;
+	struct strbuf databuf;
+	unsigned flags;
+};
+
+struct strfdinsert {
+	struct strbuf ctlbuf;
+	struct strbuf databuf;
+	unsigned flags;
+	int fildes;
+	int offset;
+};
+
+struct strioctl {
+	int ic_cmd;
+	int ic_timout;
+	int ic_len;
+	char *ic_dp;
+};
+
+struct strrecvfd {
+	int fd;
+	int uid;
+	int gid;
+	char __fill[8];
+};
+
+struct str_mlist {
+	char l_name[FMNAMESZ + 1];
+};
+
+struct str_list {
+	int sl_nmods;
+	struct str_mlist *sl_modlist;
+};
+
+int isastream(int);
+int ioctl(int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/acct.h b/musl-include/arm/sys/acct.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/acct.h
@@ -0,0 +1,72 @@
+#ifndef _SYS_ACCT_H
+#define _SYS_ACCT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <time.h>
+#include <stdint.h>
+
+#define ACCT_COMM 16
+
+typedef uint16_t comp_t;
+
+struct acct {
+	char ac_flag;
+	uint16_t ac_uid;
+	uint16_t ac_gid;
+	uint16_t ac_tty;
+	uint32_t ac_btime;
+	comp_t ac_utime;
+	comp_t ac_stime;
+	comp_t ac_etime;
+	comp_t ac_mem;
+	comp_t ac_io;
+	comp_t ac_rw;
+	comp_t ac_minflt;
+	comp_t ac_majflt;
+	comp_t ac_swaps;
+	uint32_t ac_exitcode;
+	char ac_comm[ACCT_COMM+1];
+	char ac_pad[10];
+};
+
+
+struct acct_v3 {
+	char ac_flag;
+	char ac_version;
+	uint16_t ac_tty;
+	uint32_t ac_exitcode;
+	uint32_t ac_uid;
+	uint32_t ac_gid;
+	uint32_t ac_pid;
+	uint32_t ac_ppid;
+	uint32_t ac_btime;
+	float ac_etime;
+	comp_t ac_utime;
+	comp_t ac_stime;
+	comp_t ac_mem;
+	comp_t ac_io;
+	comp_t ac_rw;
+	comp_t ac_minflt;
+	comp_t ac_majflt;
+	comp_t ac_swaps;
+	char ac_comm[ACCT_COMM];
+};
+
+#define AFORK 1
+#define ASU 2
+#define ACORE 8
+#define AXSIG 16
+#define ACCT_BYTEORDER (128*(__BYTE_ORDER==__BIG_ENDIAN))
+#define AHZ 100
+
+int acct(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/auxv.h b/musl-include/arm/sys/auxv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/auxv.h
@@ -0,0 +1,17 @@
+#ifndef _SYS_AUXV_H
+#define _SYS_AUXV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+#include <bits/hwcap.h>
+
+unsigned long getauxval(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/cachectl.h b/musl-include/arm/sys/cachectl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/cachectl.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_CACHECTL_H
+#define _SYS_CACHECTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ICACHE (1<<0)
+#define DCACHE (1<<1)
+#define BCACHE (ICACHE|DCACHE)
+#define CACHEABLE 0
+#define UNCACHEABLE 1
+ 
+int cachectl(void *, int, int);
+int cacheflush(void *, int, int);
+int _flush_cache(void *, int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/dir.h b/musl-include/arm/sys/dir.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/dir.h
@@ -0,0 +1,2 @@
+#include <dirent.h>
+#define direct dirent
diff --git a/musl-include/arm/sys/epoll.h b/musl-include/arm/sys/epoll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/epoll.h
@@ -0,0 +1,69 @@
+#ifndef	_SYS_EPOLL_H
+#define	_SYS_EPOLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define EPOLL_CLOEXEC O_CLOEXEC
+#define EPOLL_NONBLOCK O_NONBLOCK
+
+enum EPOLL_EVENTS { __EPOLL_DUMMY };
+#define EPOLLIN 0x001
+#define EPOLLPRI 0x002
+#define EPOLLOUT 0x004
+#define EPOLLRDNORM 0x040
+#define EPOLLNVAL 0x020
+#define EPOLLRDBAND 0x080
+#define EPOLLWRNORM 0x100
+#define EPOLLWRBAND 0x200
+#define EPOLLMSG 0x400
+#define EPOLLERR 0x008
+#define EPOLLHUP 0x010
+#define EPOLLRDHUP 0x2000
+#define EPOLLEXCLUSIVE (1U<<28)
+#define EPOLLWAKEUP (1U<<29)
+#define EPOLLONESHOT (1U<<30)
+#define EPOLLET (1U<<31)
+
+#define EPOLL_CTL_ADD 1
+#define EPOLL_CTL_DEL 2
+#define EPOLL_CTL_MOD 3
+
+typedef union epoll_data {
+	void *ptr;
+	int fd;
+	uint32_t u32;
+	uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event {
+	uint32_t events;
+	epoll_data_t data;
+}
+#ifdef __x86_64__
+__attribute__ ((__packed__))
+#endif
+;
+
+
+int epoll_create(int);
+int epoll_create1(int);
+int epoll_ctl(int, int, int, struct epoll_event *);
+int epoll_wait(int, struct epoll_event *, int, int);
+int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/epoll.h */
diff --git a/musl-include/arm/sys/errno.h b/musl-include/arm/sys/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/errno.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/errno.h> to <errno.h>
+#include <errno.h>
diff --git a/musl-include/arm/sys/eventfd.h b/musl-include/arm/sys/eventfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/eventfd.h
@@ -0,0 +1,26 @@
+#ifndef _SYS_EVENTFD_H
+#define _SYS_EVENTFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+typedef uint64_t eventfd_t;
+
+#define EFD_SEMAPHORE 1
+#define EFD_CLOEXEC O_CLOEXEC
+#define EFD_NONBLOCK O_NONBLOCK
+
+int eventfd(unsigned int, int);
+int eventfd_read(int, eventfd_t *);
+int eventfd_write(int, eventfd_t);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/eventfd.h */
diff --git a/musl-include/arm/sys/fanotify.h b/musl-include/arm/sys/fanotify.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/fanotify.h
@@ -0,0 +1,111 @@
+#ifndef _FANOTIFY_H
+#define _FANOTIFY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/statfs.h>
+
+struct fanotify_event_metadata {
+	unsigned event_len;
+	unsigned char vers;
+	unsigned char reserved;
+	unsigned short metadata_len;
+	unsigned long long mask
+#ifdef __GNUC__
+	__attribute__((__aligned__(8)))
+#endif
+	;
+	int fd;
+	int pid;
+};
+
+struct fanotify_event_info_header {
+	unsigned char info_type;
+	unsigned char pad;
+	unsigned short len;
+};
+
+struct fanotify_event_info_fid {
+	struct fanotify_event_info_header hdr;
+	fsid_t fsid;
+	unsigned char handle[];
+};
+
+struct fanotify_response {
+	int fd;
+	unsigned response;
+};
+
+#define FAN_ACCESS 0x01
+#define FAN_MODIFY 0x02
+#define FAN_ATTRIB 0x04
+#define FAN_CLOSE_WRITE 0x08
+#define FAN_CLOSE_NOWRITE 0x10
+#define FAN_OPEN 0x20
+#define FAN_MOVED_FROM 0x40
+#define FAN_MOVED_TO 0x80
+#define FAN_CREATE 0x100
+#define FAN_DELETE 0x200
+#define FAN_DELETE_SELF 0x400
+#define FAN_MOVE_SELF 0x800
+#define FAN_OPEN_EXEC 0x1000
+#define FAN_Q_OVERFLOW 0x4000
+#define FAN_OPEN_PERM 0x10000
+#define FAN_ACCESS_PERM 0x20000
+#define FAN_OPEN_EXEC_PERM 0x40000
+#define FAN_DIR_MODIFY 0x00080000
+#define FAN_EVENT_ON_CHILD 0x08000000
+#define FAN_ONDIR 0x40000000
+#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
+#define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO)
+#define FAN_CLOEXEC 0x01
+#define FAN_NONBLOCK 0x02
+#define FAN_CLASS_NOTIF 0
+#define FAN_CLASS_CONTENT 0x04
+#define FAN_CLASS_PRE_CONTENT 0x08
+#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
+#define FAN_UNLIMITED_QUEUE 0x10
+#define FAN_UNLIMITED_MARKS 0x20
+#define FAN_ENABLE_AUDIT 0x40
+#define FAN_REPORT_TID 0x100
+#define FAN_REPORT_FID 0x200
+#define FAN_REPORT_DIR_FID 0x00000400
+#define FAN_REPORT_NAME 0x00000800
+#define FAN_REPORT_DFID_NAME (FAN_REPORT_DIR_FID | FAN_REPORT_NAME)
+#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
+#define FAN_MARK_ADD 0x01
+#define FAN_MARK_REMOVE 0x02
+#define FAN_MARK_DONT_FOLLOW 0x04
+#define FAN_MARK_ONLYDIR 0x08
+#define FAN_MARK_IGNORED_MASK 0x20
+#define FAN_MARK_IGNORED_SURV_MODIFY 0x40
+#define FAN_MARK_FLUSH 0x80
+#define FAN_MARK_INODE 0x00
+#define FAN_MARK_MOUNT 0x10
+#define FAN_MARK_FILESYSTEM 0x100
+#define FAN_MARK_TYPE_MASK (FAN_MARK_INODE | FAN_MARK_MOUNT | FAN_MARK_FILESYSTEM)
+#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_DONT_FOLLOW | FAN_MARK_ONLYDIR | FAN_MARK_MOUNT | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY | FAN_MARK_FLUSH)
+#define FAN_ALL_EVENTS (FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN)
+#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
+#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS | FAN_ALL_PERM_EVENTS | FAN_Q_OVERFLOW)
+#define FANOTIFY_METADATA_VERSION 3
+#define FAN_EVENT_INFO_TYPE_FID 1
+#define FAN_EVENT_INFO_TYPE_DFID_NAME 2
+#define FAN_EVENT_INFO_TYPE_DFID 3
+#define FAN_ALLOW 0x01
+#define FAN_DENY 0x02
+#define FAN_AUDIT 0x10
+#define FAN_NOFD -1
+#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
+#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, (struct fanotify_event_metadata*)(((char *)(meta)) + (meta)->event_len))
+#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len <= (long)(len))
+
+int fanotify_init(unsigned, unsigned);
+int fanotify_mark(int, unsigned, unsigned long long, int, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/fcntl.h b/musl-include/arm/sys/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/fcntl.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
+#include <fcntl.h>
diff --git a/musl-include/arm/sys/file.h b/musl-include/arm/sys/file.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/file.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_FILE_H
+#define _SYS_FILE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOCK_SH	1
+#define LOCK_EX	2
+#define LOCK_NB	4
+#define LOCK_UN	8
+
+#define L_SET 0
+#define L_INCR 1
+#define L_XTND 2
+
+int flock(int, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/fsuid.h b/musl-include/arm/sys/fsuid.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/fsuid.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_FSUID_H
+#define _SYS_FSUID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_uid_t
+#define __NEED_gid_t
+
+#include <bits/alltypes.h>
+
+int setfsuid(uid_t);
+int setfsgid(gid_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/inotify.h b/musl-include/arm/sys/inotify.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/inotify.h
@@ -0,0 +1,58 @@
+#ifndef _SYS_INOTIFY_H
+#define _SYS_INOTIFY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+struct inotify_event {
+	int wd;
+	uint32_t mask, cookie, len;
+	char name[];
+};
+
+#define IN_CLOEXEC O_CLOEXEC
+#define IN_NONBLOCK O_NONBLOCK
+
+#define IN_ACCESS        0x00000001
+#define IN_MODIFY        0x00000002
+#define IN_ATTRIB        0x00000004
+#define IN_CLOSE_WRITE   0x00000008
+#define IN_CLOSE_NOWRITE 0x00000010
+#define IN_CLOSE         (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
+#define IN_OPEN          0x00000020
+#define IN_MOVED_FROM    0x00000040
+#define IN_MOVED_TO      0x00000080
+#define IN_MOVE          (IN_MOVED_FROM | IN_MOVED_TO)
+#define IN_CREATE        0x00000100
+#define IN_DELETE        0x00000200
+#define IN_DELETE_SELF   0x00000400
+#define IN_MOVE_SELF     0x00000800
+#define IN_ALL_EVENTS    0x00000fff
+
+#define IN_UNMOUNT       0x00002000
+#define IN_Q_OVERFLOW    0x00004000
+#define IN_IGNORED       0x00008000
+
+#define IN_ONLYDIR       0x01000000
+#define IN_DONT_FOLLOW   0x02000000
+#define IN_EXCL_UNLINK   0x04000000
+#define IN_MASK_CREATE   0x10000000
+#define IN_MASK_ADD      0x20000000
+
+#define IN_ISDIR         0x40000000
+#define IN_ONESHOT       0x80000000
+
+int inotify_init(void);
+int inotify_init1(int);
+int inotify_add_watch(int, const char *, uint32_t);
+int inotify_rm_watch(int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/io.h b/musl-include/arm/sys/io.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/io.h
@@ -0,0 +1,17 @@
+#ifndef	_SYS_IO_H
+#define	_SYS_IO_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/io.h>
+
+int iopl(int);
+int ioperm(unsigned long, unsigned long, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/ioctl.h b/musl-include/arm/sys/ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/ioctl.h
@@ -0,0 +1,120 @@
+#ifndef	_SYS_IOCTL_H
+#define	_SYS_IOCTL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_struct_winsize
+
+#include <bits/alltypes.h>
+#include <bits/ioctl.h>
+
+#define N_TTY           0
+#define N_SLIP          1
+#define N_MOUSE         2
+#define N_PPP           3
+#define N_STRIP         4
+#define N_AX25          5
+#define N_X25           6
+#define N_6PACK         7
+#define N_MASC          8
+#define N_R3964         9
+#define N_PROFIBUS_FDL  10
+#define N_IRDA          11
+#define N_SMSBLOCK      12
+#define N_HDLC          13
+#define N_SYNC_PPP      14
+#define N_HCI           15
+#define N_GIGASET_M101  16
+#define N_SLCAN         17
+#define N_PPS           18
+#define N_V253          19
+#define N_CAIF          20
+#define N_GSM0710       21
+#define N_TI_WL         22
+#define N_TRACESINK     23
+#define N_TRACEROUTER   24
+#define N_NCI           25
+#define N_SPEAKUP       26
+#define N_NULL          27
+
+#define TIOCPKT_DATA       0
+#define TIOCPKT_FLUSHREAD  1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP       4
+#define TIOCPKT_START      8
+#define TIOCPKT_NOSTOP    16
+#define TIOCPKT_DOSTOP    32
+#define TIOCPKT_IOCTL     64
+
+#define TIOCSER_TEMT 1
+
+#define SIOCADDRT          0x890B
+#define SIOCDELRT          0x890C
+#define SIOCRTMSG          0x890D
+
+#define SIOCGIFNAME        0x8910
+#define SIOCSIFLINK        0x8911
+#define SIOCGIFCONF        0x8912
+#define SIOCGIFFLAGS       0x8913
+#define SIOCSIFFLAGS       0x8914
+#define SIOCGIFADDR        0x8915
+#define SIOCSIFADDR        0x8916
+#define SIOCGIFDSTADDR     0x8917
+#define SIOCSIFDSTADDR     0x8918
+#define SIOCGIFBRDADDR     0x8919
+#define SIOCSIFBRDADDR     0x891a
+#define SIOCGIFNETMASK     0x891b
+#define SIOCSIFNETMASK     0x891c
+#define SIOCGIFMETRIC      0x891d
+#define SIOCSIFMETRIC      0x891e
+#define SIOCGIFMEM         0x891f
+#define SIOCSIFMEM         0x8920
+#define SIOCGIFMTU         0x8921
+#define SIOCSIFMTU         0x8922
+#define SIOCSIFNAME        0x8923
+#define SIOCSIFHWADDR      0x8924
+#define SIOCGIFENCAP       0x8925
+#define SIOCSIFENCAP       0x8926
+#define SIOCGIFHWADDR      0x8927
+#define SIOCGIFSLAVE       0x8929
+#define SIOCSIFSLAVE       0x8930
+#define SIOCADDMULTI       0x8931
+#define SIOCDELMULTI       0x8932
+#define SIOCGIFINDEX       0x8933
+#define SIOGIFINDEX        SIOCGIFINDEX
+#define SIOCSIFPFLAGS      0x8934
+#define SIOCGIFPFLAGS      0x8935
+#define SIOCDIFADDR        0x8936
+#define SIOCSIFHWBROADCAST 0x8937
+#define SIOCGIFCOUNT       0x8938
+
+#define SIOCGIFBR          0x8940
+#define SIOCSIFBR          0x8941
+
+#define SIOCGIFTXQLEN      0x8942
+#define SIOCSIFTXQLEN      0x8943
+
+#define SIOCDARP           0x8953
+#define SIOCGARP           0x8954
+#define SIOCSARP           0x8955
+
+#define SIOCDRARP          0x8960
+#define SIOCGRARP          0x8961
+#define SIOCSRARP          0x8962
+
+#define SIOCGIFMAP         0x8970
+#define SIOCSIFMAP         0x8971
+
+#define SIOCADDDLCI        0x8980
+#define SIOCDELDLCI        0x8981
+
+#define SIOCDEVPRIVATE     0x89F0
+#define SIOCPROTOPRIVATE   0x89E0
+
+int ioctl (int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/ipc.h b/musl-include/arm/sys/ipc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/ipc.h
@@ -0,0 +1,42 @@
+#ifndef _SYS_IPC_H
+#define _SYS_IPC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_key_t
+
+#include <bits/alltypes.h>
+
+#define __ipc_perm_key __key
+#define __ipc_perm_seq __seq
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __key key
+#define __seq seq
+#endif
+
+#include <bits/ipc.h>
+#include <bits/ipcstat.h>
+
+#define IPC_CREAT  01000
+#define IPC_EXCL   02000
+#define IPC_NOWAIT 04000
+
+#define IPC_RMID 0
+#define IPC_SET  1
+#define IPC_INFO 3
+
+#define IPC_PRIVATE ((key_t) 0)
+
+key_t ftok (const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/kd.h b/musl-include/arm/sys/kd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/kd.h
@@ -0,0 +1,1 @@
+#include <bits/kd.h>
diff --git a/musl-include/arm/sys/klog.h b/musl-include/arm/sys/klog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/klog.h
@@ -0,0 +1,14 @@
+#ifndef	_SYS_KLOG_H
+#define	_SYS_KLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int klogctl (int, char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/membarrier.h b/musl-include/arm/sys/membarrier.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/membarrier.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_MEMBARRIER_H
+#define _SYS_MEMBARRIER_H
+
+#define MEMBARRIER_CMD_QUERY 0
+#define MEMBARRIER_CMD_GLOBAL 1
+#define MEMBARRIER_CMD_GLOBAL_EXPEDITED 2
+#define MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED 4
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED 8
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 32
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 64
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ 128
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ 256
+
+#define MEMBARRIER_CMD_SHARED MEMBARRIER_CMD_GLOBAL
+
+#define MEMBARRIER_CMD_FLAG_CPU 1
+
+int membarrier(int, int);
+
+#endif
diff --git a/musl-include/arm/sys/mman.h b/musl-include/arm/sys/mman.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/mman.h
@@ -0,0 +1,152 @@
+#ifndef	_SYS_MMAN_H
+#define	_SYS_MMAN_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_mode_t
+#define __NEED_size_t
+#define __NEED_off_t
+
+#if defined(_GNU_SOURCE)
+#define __NEED_ssize_t
+#endif
+
+#include <bits/alltypes.h>
+
+#define MAP_FAILED ((void *) -1)
+
+#define MAP_SHARED     0x01
+#define MAP_PRIVATE    0x02
+#define MAP_SHARED_VALIDATE 0x03
+#define MAP_TYPE       0x0f
+#define MAP_FIXED      0x10
+#define MAP_ANON       0x20
+#define MAP_ANONYMOUS  MAP_ANON
+#define MAP_NORESERVE  0x4000
+#define MAP_GROWSDOWN  0x0100
+#define MAP_DENYWRITE  0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_LOCKED     0x2000
+#define MAP_POPULATE   0x8000
+#define MAP_NONBLOCK   0x10000
+#define MAP_STACK      0x20000
+#define MAP_HUGETLB    0x40000
+#define MAP_SYNC       0x80000
+#define MAP_FIXED_NOREPLACE 0x100000
+#define MAP_FILE       0
+
+#define MAP_HUGE_SHIFT 26
+#define MAP_HUGE_MASK  0x3f
+#define MAP_HUGE_16KB  (14 << 26)
+#define MAP_HUGE_64KB  (16 << 26)
+#define MAP_HUGE_512KB (19 << 26)
+#define MAP_HUGE_1MB   (20 << 26)
+#define MAP_HUGE_2MB   (21 << 26)
+#define MAP_HUGE_8MB   (23 << 26)
+#define MAP_HUGE_16MB  (24 << 26)
+#define MAP_HUGE_32MB  (25 << 26)
+#define MAP_HUGE_256MB (28 << 26)
+#define MAP_HUGE_512MB (29 << 26)
+#define MAP_HUGE_1GB   (30 << 26)
+#define MAP_HUGE_2GB   (31 << 26)
+#define MAP_HUGE_16GB  (34U << 26)
+
+#define PROT_NONE      0
+#define PROT_READ      1
+#define PROT_WRITE     2
+#define PROT_EXEC      4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP   0x02000000
+
+#define MS_ASYNC       1
+#define MS_INVALIDATE  2
+#define MS_SYNC        4
+
+#define MCL_CURRENT    1
+#define MCL_FUTURE     2
+#define MCL_ONFAULT    4
+
+#define POSIX_MADV_NORMAL     0
+#define POSIX_MADV_RANDOM     1
+#define POSIX_MADV_SEQUENTIAL 2
+#define POSIX_MADV_WILLNEED   3
+#define POSIX_MADV_DONTNEED   4
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MADV_NORMAL      0
+#define MADV_RANDOM      1
+#define MADV_SEQUENTIAL  2
+#define MADV_WILLNEED    3
+#define MADV_DONTNEED    4
+#define MADV_FREE        8
+#define MADV_REMOVE      9
+#define MADV_DONTFORK    10
+#define MADV_DOFORK      11
+#define MADV_MERGEABLE   12
+#define MADV_UNMERGEABLE 13
+#define MADV_HUGEPAGE    14
+#define MADV_NOHUGEPAGE  15
+#define MADV_DONTDUMP    16
+#define MADV_DODUMP      17
+#define MADV_WIPEONFORK  18
+#define MADV_KEEPONFORK  19
+#define MADV_COLD        20
+#define MADV_PAGEOUT     21
+#define MADV_HWPOISON    100
+#define MADV_SOFT_OFFLINE 101
+#endif
+
+#ifdef _GNU_SOURCE
+#define MREMAP_MAYMOVE 1
+#define MREMAP_FIXED 2
+#define MREMAP_DONTUNMAP 4
+
+#define MLOCK_ONFAULT 0x01
+
+#define MFD_CLOEXEC 0x0001U
+#define MFD_ALLOW_SEALING 0x0002U
+#define MFD_HUGETLB 0x0004U
+#endif
+
+#include <bits/mman.h>
+
+void *mmap (void *, size_t, int, int, int, off_t);
+int munmap (void *, size_t);
+
+int mprotect (void *, size_t, int);
+int msync (void *, size_t, int);
+
+int posix_madvise (void *, size_t, int);
+
+int mlock (const void *, size_t);
+int munlock (const void *, size_t);
+int mlockall (int);
+int munlockall (void);
+
+#ifdef _GNU_SOURCE
+void *mremap (void *, size_t, size_t, int, ...);
+int remap_file_pages (void *, size_t, int, size_t, int);
+int memfd_create (const char *, unsigned);
+int mlock2 (const void *, size_t, unsigned);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int madvise (void *, size_t, int);
+int mincore (void *, size_t, unsigned char *);
+#endif
+
+int shm_open (const char *, int, mode_t);
+int shm_unlink (const char *);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define mmap64 mmap
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/mount.h b/musl-include/arm/sys/mount.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/mount.h
@@ -0,0 +1,75 @@
+#ifndef _SYS_MOUNT_H
+#define _SYS_MOUNT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ioctl.h>
+
+#define BLKROSET   _IO(0x12, 93)
+#define BLKROGET   _IO(0x12, 94)
+#define BLKRRPART  _IO(0x12, 95)
+#define BLKGETSIZE _IO(0x12, 96)
+#define BLKFLSBUF  _IO(0x12, 97)
+#define BLKRASET   _IO(0x12, 98)
+#define BLKRAGET   _IO(0x12, 99)
+#define BLKFRASET  _IO(0x12,100)
+#define BLKFRAGET  _IO(0x12,101)
+#define BLKSECTSET _IO(0x12,102)
+#define BLKSECTGET _IO(0x12,103)
+#define BLKSSZGET  _IO(0x12,104)
+#define BLKBSZGET  _IOR(0x12,112,size_t)
+#define BLKBSZSET  _IOW(0x12,113,size_t)
+#define BLKGETSIZE64 _IOR(0x12,114,size_t)
+
+#define MS_RDONLY      1
+#define MS_NOSUID      2
+#define MS_NODEV       4
+#define MS_NOEXEC      8
+#define MS_SYNCHRONOUS 16
+#define MS_REMOUNT     32
+#define MS_MANDLOCK    64
+#define MS_DIRSYNC     128
+#define MS_NOSYMFOLLOW 256
+#define MS_NOATIME     1024
+#define MS_NODIRATIME  2048
+#define MS_BIND        4096
+#define MS_MOVE        8192
+#define MS_REC         16384
+#define MS_SILENT      32768
+#define MS_POSIXACL    (1<<16)
+#define MS_UNBINDABLE  (1<<17)
+#define MS_PRIVATE     (1<<18)
+#define MS_SLAVE       (1<<19)
+#define MS_SHARED      (1<<20)
+#define MS_RELATIME    (1<<21)
+#define MS_KERNMOUNT   (1<<22)
+#define MS_I_VERSION   (1<<23)
+#define MS_STRICTATIME (1<<24)
+#define MS_LAZYTIME    (1<<25)
+#define MS_NOREMOTELOCK (1<<27)
+#define MS_NOSEC       (1<<28)
+#define MS_BORN        (1<<29)
+#define MS_ACTIVE      (1<<30)
+#define MS_NOUSER      (1U<<31)
+
+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
+
+#define MS_MGC_VAL 0xc0ed0000
+#define MS_MGC_MSK 0xffff0000
+
+#define MNT_FORCE       1
+#define MNT_DETACH      2
+#define MNT_EXPIRE      4
+#define UMOUNT_NOFOLLOW 8
+
+int mount(const char *, const char *, const char *, unsigned long, const void *);
+int umount(const char *);
+int umount2(const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/msg.h b/musl-include/arm/sys/msg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/msg.h
@@ -0,0 +1,53 @@
+#ifndef _SYS_MSG_H
+#define _SYS_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ipc.h>
+
+#define __NEED_pid_t
+#define __NEED_key_t
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+
+#include <bits/alltypes.h>
+
+typedef unsigned long msgqnum_t;
+typedef unsigned long msglen_t;
+
+#include <bits/msg.h>
+
+#define __msg_cbytes msg_cbytes
+
+#define MSG_NOERROR 010000
+#define MSG_EXCEPT  020000
+
+#define MSG_STAT (11 | (IPC_STAT & 0x100))
+#define MSG_INFO 12
+#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100))
+
+struct msginfo {
+	int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;
+	unsigned short msgseg;
+};
+
+int msgctl (int, int, struct msqid_ds *);
+int msgget (key_t, int);
+ssize_t msgrcv (int, void *, size_t, long, int);
+int msgsnd (int, const void *, size_t, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct msgbuf {
+	long mtype;
+	char mtext[1];
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/mtio.h b/musl-include/arm/sys/mtio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/mtio.h
@@ -0,0 +1,188 @@
+#ifndef _SYS_MTIO_H
+#define _SYS_MTIO_H
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+struct mtop {
+	short mt_op;
+	int mt_count;
+};
+
+#define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0)
+#define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0)
+#define _IOT_mtpos _IOT_SIMPLE (long)
+#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1)
+
+
+#define MTRESET 0
+#define MTFSF	1
+#define MTBSF	2
+#define MTFSR	3
+#define MTBSR	4
+#define MTWEOF	5
+#define MTREW	6
+#define MTOFFL	7
+#define MTNOP	8
+#define MTRETEN 9
+#define MTBSFM	10
+#define MTFSFM  11
+#define MTEOM	12
+#define MTERASE 13
+#define MTRAS1  14
+#define MTRAS2	15
+#define MTRAS3  16
+#define MTSETBLK 20
+#define MTSETDENSITY 21
+#define MTSEEK	22
+#define MTTELL	23
+#define MTSETDRVBUFFER 24
+#define MTFSS	25
+#define MTBSS	26
+#define MTWSM	27
+#define MTLOCK  28
+#define MTUNLOCK 29
+#define MTLOAD  30
+#define MTUNLOAD 31
+#define MTCOMPRESSION 32
+#define MTSETPART 33
+#define MTMKPART  34
+
+struct mtget {
+	long mt_type;
+	long mt_resid;
+	long mt_dsreg;
+	long mt_gstat;
+	long mt_erreg;
+	int mt_fileno;
+	int mt_blkno;
+};
+
+#define MT_ISUNKNOWN		0x01
+#define MT_ISQIC02		0x02
+#define MT_ISWT5150		0x03
+#define MT_ISARCHIVE_5945L2	0x04
+#define MT_ISCMSJ500		0x05
+#define MT_ISTDC3610		0x06
+#define MT_ISARCHIVE_VP60I	0x07
+#define MT_ISARCHIVE_2150L	0x08
+#define MT_ISARCHIVE_2060L	0x09
+#define MT_ISARCHIVESC499	0x0A
+#define MT_ISQIC02_ALL_FEATURES	0x0F
+#define MT_ISWT5099EEN24	0x11
+#define MT_ISTEAC_MT2ST		0x12
+#define MT_ISEVEREX_FT40A	0x32
+#define MT_ISDDS1		0x51
+#define MT_ISDDS2		0x52
+#define MT_ISSCSI1		0x71
+#define MT_ISSCSI2		0x72
+#define MT_ISFTAPE_UNKNOWN	0x800000
+#define MT_ISFTAPE_FLAG		0x800000
+
+struct mt_tape_info {
+	long t_type;
+	char *t_name;
+};
+
+#define MT_TAPE_INFO \
+{									      \
+	{MT_ISUNKNOWN,		"Unknown type of tape device"},		      \
+	{MT_ISQIC02,		"Generic QIC-02 tape streamer"},	      \
+	{MT_ISWT5150,		"Wangtek 5150, QIC-150"},		      \
+	{MT_ISARCHIVE_5945L2,	"Archive 5945L-2"},			      \
+	{MT_ISCMSJ500,		"CMS Jumbo 500"},			      \
+	{MT_ISTDC3610,		"Tandberg TDC 3610, QIC-24"},		      \
+	{MT_ISARCHIVE_VP60I,	"Archive VP60i, QIC-02"},		      \
+	{MT_ISARCHIVE_2150L,	"Archive Viper 2150L"},			      \
+	{MT_ISARCHIVE_2060L,	"Archive Viper 2060L"},			      \
+	{MT_ISARCHIVESC499,	"Archive SC-499 QIC-36 controller"},	      \
+	{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"},	      \
+	{MT_ISWT5099EEN24,	"Wangtek 5099-een24, 60MB"},		      \
+	{MT_ISTEAC_MT2ST,	"Teac MT-2ST 155mb data cassette drive"},     \
+	{MT_ISEVEREX_FT40A,	"Everex FT40A, QIC-40"},		      \
+	{MT_ISSCSI1,		"Generic SCSI-1 tape"},			      \
+	{MT_ISSCSI2,		"Generic SCSI-2 tape"},			      \
+	{0, 0}								      \
+}
+
+struct mtpos {
+	long mt_blkno;
+};
+
+struct mtconfiginfo  {
+	long mt_type;
+	long ifc_type;
+	unsigned short irqnr;
+	unsigned short dmanr;
+	unsigned short port;
+	unsigned long debug;
+	unsigned have_dens:1;
+	unsigned have_bsf:1;
+	unsigned have_fsr:1;
+	unsigned have_bsr:1;
+	unsigned have_eod:1;
+	unsigned have_seek:1;
+	unsigned have_tell:1;
+	unsigned have_ras1:1;
+	unsigned have_ras2:1;
+	unsigned have_ras3:1;
+	unsigned have_qfa:1;
+	unsigned pad1:5;
+	char reserved[10];
+};
+
+#define	MTIOCTOP _IOW('m', 1, struct mtop)
+#define	MTIOCGET _IOR('m', 2, struct mtget)
+#define	MTIOCPOS _IOR('m', 3, struct mtpos)
+
+#define	MTIOCGETCONFIG	_IOR('m', 4, struct mtconfiginfo)
+#define	MTIOCSETCONFIG	_IOW('m', 5, struct mtconfiginfo)
+
+#define GMT_EOF(x)              ((x) & 0x80000000)
+#define GMT_BOT(x)              ((x) & 0x40000000)
+#define GMT_EOT(x)              ((x) & 0x20000000)
+#define GMT_SM(x)               ((x) & 0x10000000)
+#define GMT_EOD(x)              ((x) & 0x08000000)
+#define GMT_WR_PROT(x)          ((x) & 0x04000000)
+#define GMT_ONLINE(x)           ((x) & 0x01000000)
+#define GMT_D_6250(x)           ((x) & 0x00800000)
+#define GMT_D_1600(x)           ((x) & 0x00400000)
+#define GMT_D_800(x)            ((x) & 0x00200000)
+#define GMT_DR_OPEN(x)          ((x) & 0x00040000)
+#define GMT_IM_REP_EN(x)        ((x) & 0x00010000)
+
+#define MT_ST_BLKSIZE_SHIFT	0
+#define MT_ST_BLKSIZE_MASK	0xffffff
+#define MT_ST_DENSITY_SHIFT	24
+#define MT_ST_DENSITY_MASK	0xff000000
+#define MT_ST_SOFTERR_SHIFT	0
+#define MT_ST_SOFTERR_MASK	0xffff
+#define MT_ST_OPTIONS		0xf0000000
+#define MT_ST_BOOLEANS		0x10000000
+#define MT_ST_SETBOOLEANS	0x30000000
+#define MT_ST_CLEARBOOLEANS	0x40000000
+#define MT_ST_WRITE_THRESHOLD	0x20000000
+#define MT_ST_DEF_BLKSIZE	0x50000000
+#define MT_ST_DEF_OPTIONS	0x60000000
+#define MT_ST_BUFFER_WRITES	0x1
+#define MT_ST_ASYNC_WRITES	0x2
+#define MT_ST_READ_AHEAD	0x4
+#define MT_ST_DEBUGGING		0x8
+#define MT_ST_TWO_FM		0x10
+#define MT_ST_FAST_MTEOM	0x20
+#define MT_ST_AUTO_LOCK		0x40
+#define MT_ST_DEF_WRITES	0x80
+#define MT_ST_CAN_BSR		0x100
+#define MT_ST_NO_BLKLIMS	0x200
+#define MT_ST_CAN_PARTITIONS    0x400
+#define MT_ST_SCSI2LOGICAL      0x800
+#define MT_ST_CLEAR_DEFAULT	0xfffff
+#define MT_ST_DEF_DENSITY	(MT_ST_DEF_OPTIONS | 0x100000)
+#define MT_ST_DEF_COMPRESSION	(MT_ST_DEF_OPTIONS | 0x200000)
+#define MT_ST_DEF_DRVBUFFER	(MT_ST_DEF_OPTIONS | 0x300000)
+#define MT_ST_HPLOADER_OFFSET 10000
+#ifndef DEFTAPE
+# define DEFTAPE	"/dev/tape"
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/param.h b/musl-include/arm/sys/param.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/param.h
@@ -0,0 +1,35 @@
+#ifndef _SYS_PARAM_H
+#define _SYS_PARAM_H
+
+#define MAXSYMLINKS 20
+#define MAXHOSTNAMELEN 64
+#define MAXNAMLEN 255
+#define MAXPATHLEN 4096
+#define NBBY 8
+#define NGROUPS 32
+#define CANBSIZ 255
+#define NOFILE 256
+#define NCARGS 131072
+#define DEV_BSIZE 512
+#define NOGROUP (-1)
+
+#undef MIN
+#undef MAX
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
+#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8))
+#define setbit(x,i) __bitop(x,i,|=)
+#define clrbit(x,i) __bitop(x,i,&=~)
+#define isset(x,i) __bitop(x,i,&)
+#define isclr(x,i) !isset(x,i)
+
+#define howmany(n,d) (((n)+((d)-1))/(d))
+#define roundup(n,d) (howmany(n,d)*(d))
+#define powerof2(n) !(((n)-1) & (n))
+
+#include <sys/resource.h>
+#include <endian.h>
+#include <limits.h>
+
+#endif
diff --git a/musl-include/arm/sys/personality.h b/musl-include/arm/sys/personality.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/personality.h
@@ -0,0 +1,49 @@
+#ifndef _PERSONALITY_H
+#define _PERSONALITY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UNAME26            0x0020000
+#define ADDR_NO_RANDOMIZE  0x0040000
+#define FDPIC_FUNCPTRS     0x0080000
+#define MMAP_PAGE_ZERO     0x0100000
+#define ADDR_COMPAT_LAYOUT 0x0200000
+#define READ_IMPLIES_EXEC  0x0400000
+#define ADDR_LIMIT_32BIT   0x0800000
+#define SHORT_INODE        0x1000000
+#define WHOLE_SECONDS      0x2000000
+#define STICKY_TIMEOUTS    0x4000000
+#define ADDR_LIMIT_3GB     0x8000000
+
+#define PER_LINUX 0
+#define PER_LINUX_32BIT ADDR_LIMIT_32BIT
+#define PER_LINUX_FDPIC FDPIC_FUNCPTRS
+#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE)
+#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS)
+#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_ISCR4 (5 | STICKY_TIMEOUTS)
+#define PER_BSD 6
+#define PER_SUNOS (6 | STICKY_TIMEOUTS)
+#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_LINUX32 8
+#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB)
+#define PER_IRIX32 (9 | STICKY_TIMEOUTS)
+#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS)
+#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS)
+#define PER_RISCOS 0xc
+#define PER_SOLARIS (0xd | STICKY_TIMEOUTS)
+#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_OSF4 0xf
+#define PER_HPUX 0x10
+#define PER_MASK 0xff
+
+int personality(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/poll.h b/musl-include/arm/sys/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/poll.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
+#include <poll.h>
diff --git a/musl-include/arm/sys/prctl.h b/musl-include/arm/sys/prctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/prctl.h
@@ -0,0 +1,186 @@
+#ifndef _SYS_PRCTL_H
+#define _SYS_PRCTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define PR_SET_PDEATHSIG  1
+#define PR_GET_PDEATHSIG  2
+#define PR_GET_DUMPABLE   3
+#define PR_SET_DUMPABLE   4
+#define PR_GET_UNALIGN   5
+#define PR_SET_UNALIGN   6
+#define PR_UNALIGN_NOPRINT 1
+#define PR_UNALIGN_SIGBUS 2
+#define PR_GET_KEEPCAPS   7
+#define PR_SET_KEEPCAPS   8
+#define PR_GET_FPEMU  9
+#define PR_SET_FPEMU 10
+#define PR_FPEMU_NOPRINT 1
+#define PR_FPEMU_SIGFPE 2
+#define PR_GET_FPEXC 11
+#define PR_SET_FPEXC 12
+#define PR_FP_EXC_SW_ENABLE 0x80
+#define PR_FP_EXC_DIV  0x010000
+#define PR_FP_EXC_OVF  0x020000
+#define PR_FP_EXC_UND  0x040000
+#define PR_FP_EXC_RES  0x080000
+#define PR_FP_EXC_INV  0x100000
+#define PR_FP_EXC_DISABLED 0
+#define PR_FP_EXC_NONRECOV 1
+#define PR_FP_EXC_ASYNC 2
+#define PR_FP_EXC_PRECISE 3
+#define PR_GET_TIMING   13
+#define PR_SET_TIMING   14
+#define PR_TIMING_STATISTICAL  0
+#define PR_TIMING_TIMESTAMP    1
+#define PR_SET_NAME    15
+#define PR_GET_NAME    16
+#define PR_GET_ENDIAN 19
+#define PR_SET_ENDIAN 20
+#define PR_ENDIAN_BIG 0
+#define PR_ENDIAN_LITTLE 1
+#define PR_ENDIAN_PPC_LITTLE 2
+#define PR_GET_SECCOMP 21
+#define PR_SET_SECCOMP 22
+#define PR_CAPBSET_READ 23
+#define PR_CAPBSET_DROP 24
+#define PR_GET_TSC 25
+#define PR_SET_TSC 26
+#define PR_TSC_ENABLE 1
+#define PR_TSC_SIGSEGV 2
+#define PR_GET_SECUREBITS 27
+#define PR_SET_SECUREBITS 28
+#define PR_SET_TIMERSLACK 29
+#define PR_GET_TIMERSLACK 30
+
+#define PR_TASK_PERF_EVENTS_DISABLE             31
+#define PR_TASK_PERF_EVENTS_ENABLE              32
+
+#define PR_MCE_KILL     33
+#define PR_MCE_KILL_CLEAR   0
+#define PR_MCE_KILL_SET     1
+#define PR_MCE_KILL_LATE    0
+#define PR_MCE_KILL_EARLY   1
+#define PR_MCE_KILL_DEFAULT 2
+#define PR_MCE_KILL_GET 34
+
+#define PR_SET_MM               35
+#define PR_SET_MM_START_CODE           1
+#define PR_SET_MM_END_CODE             2
+#define PR_SET_MM_START_DATA           3
+#define PR_SET_MM_END_DATA             4
+#define PR_SET_MM_START_STACK          5
+#define PR_SET_MM_START_BRK            6
+#define PR_SET_MM_BRK                  7
+#define PR_SET_MM_ARG_START            8
+#define PR_SET_MM_ARG_END              9
+#define PR_SET_MM_ENV_START            10
+#define PR_SET_MM_ENV_END              11
+#define PR_SET_MM_AUXV                 12
+#define PR_SET_MM_EXE_FILE             13
+#define PR_SET_MM_MAP                  14
+#define PR_SET_MM_MAP_SIZE             15
+
+struct prctl_mm_map {
+	uint64_t start_code;
+	uint64_t end_code;
+	uint64_t start_data;
+	uint64_t end_data;
+	uint64_t start_brk;
+	uint64_t brk;
+	uint64_t start_stack;
+	uint64_t arg_start;
+	uint64_t arg_end;
+	uint64_t env_start;
+	uint64_t env_end;
+	uint64_t *auxv;
+	uint32_t auxv_size;
+	uint32_t exe_fd;
+};
+
+#define PR_SET_PTRACER 0x59616d61
+#define PR_SET_PTRACER_ANY (-1UL)
+
+#define PR_SET_CHILD_SUBREAPER  36
+#define PR_GET_CHILD_SUBREAPER  37
+
+#define PR_SET_NO_NEW_PRIVS     38
+#define PR_GET_NO_NEW_PRIVS     39
+
+#define PR_GET_TID_ADDRESS      40
+
+#define PR_SET_THP_DISABLE      41
+#define PR_GET_THP_DISABLE      42
+
+#define PR_MPX_ENABLE_MANAGEMENT  43
+#define PR_MPX_DISABLE_MANAGEMENT 44
+
+#define PR_SET_FP_MODE          45
+#define PR_GET_FP_MODE          46
+#define PR_FP_MODE_FR (1 << 0)
+#define PR_FP_MODE_FRE (1 << 1)
+
+#define PR_CAP_AMBIENT          47
+#define PR_CAP_AMBIENT_IS_SET   1
+#define PR_CAP_AMBIENT_RAISE    2
+#define PR_CAP_AMBIENT_LOWER    3
+#define PR_CAP_AMBIENT_CLEAR_ALL 4
+
+#define PR_SVE_SET_VL           50
+#define PR_SVE_SET_VL_ONEXEC (1 << 18)
+#define PR_SVE_GET_VL           51
+#define PR_SVE_VL_LEN_MASK 0xffff
+#define PR_SVE_VL_INHERIT (1 << 17)
+
+#define PR_GET_SPECULATION_CTRL 52
+#define PR_SET_SPECULATION_CTRL 53
+#define PR_SPEC_STORE_BYPASS 0
+#define PR_SPEC_INDIRECT_BRANCH 1
+#define PR_SPEC_NOT_AFFECTED 0
+#define PR_SPEC_PRCTL (1UL << 0)
+#define PR_SPEC_ENABLE (1UL << 1)
+#define PR_SPEC_DISABLE (1UL << 2)
+#define PR_SPEC_FORCE_DISABLE (1UL << 3)
+#define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
+
+#define PR_PAC_RESET_KEYS       54
+#define PR_PAC_APIAKEY (1UL << 0)
+#define PR_PAC_APIBKEY (1UL << 1)
+#define PR_PAC_APDAKEY (1UL << 2)
+#define PR_PAC_APDBKEY (1UL << 3)
+#define PR_PAC_APGAKEY (1UL << 4)
+
+#define PR_SET_TAGGED_ADDR_CTRL 55
+#define PR_GET_TAGGED_ADDR_CTRL 56
+#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
+#define PR_MTE_TCF_SHIFT 1
+#define PR_MTE_TCF_NONE  (0UL << 1)
+#define PR_MTE_TCF_SYNC  (1UL << 1)
+#define PR_MTE_TCF_ASYNC (2UL << 1)
+#define PR_MTE_TCF_MASK  (3UL << 1)
+#define PR_MTE_TAG_SHIFT 3
+#define PR_MTE_TAG_MASK  (0xffffUL << 3)
+
+#define PR_SET_IO_FLUSHER 57
+#define PR_GET_IO_FLUSHER 58
+
+#define PR_SET_SYSCALL_USER_DISPATCH 59
+#define PR_SYS_DISPATCH_OFF 0
+#define PR_SYS_DISPATCH_ON 1
+#define SYSCALL_DISPATCH_FILTER_ALLOW 0
+#define SYSCALL_DISPATCH_FILTER_BLOCK 1
+
+#define PR_PAC_SET_ENABLED_KEYS 60
+#define PR_PAC_GET_ENABLED_KEYS 61
+
+int prctl (int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/procfs.h b/musl-include/arm/sys/procfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/procfs.h
@@ -0,0 +1,63 @@
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+struct elf_siginfo {
+	int si_signo;
+	int si_code;
+	int si_errno;
+};
+
+struct elf_prstatus {
+	struct elf_siginfo pr_info;
+	short int pr_cursig;
+	unsigned long int pr_sigpend;
+	unsigned long int pr_sighold;
+	pid_t pr_pid;
+	pid_t pr_ppid;
+	pid_t pr_pgrp;
+	pid_t pr_sid;
+	struct {
+		long tv_sec, tv_usec;
+	} pr_utime, pr_stime, pr_cutime, pr_cstime;
+	elf_gregset_t pr_reg;
+	int pr_fpvalid;
+};
+
+#define ELF_PRARGSZ 80
+
+struct elf_prpsinfo {
+	char pr_state;
+	char pr_sname;
+	char pr_zomb;
+	char pr_nice;
+	unsigned long int pr_flag;
+#if UINTPTR_MAX == 0xffffffff
+	unsigned short int pr_uid;
+	unsigned short int pr_gid;
+#else
+	unsigned int pr_uid;
+	unsigned int pr_gid;
+#endif
+	int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+	char pr_fname[16];
+	char pr_psargs[ELF_PRARGSZ];
+};
+
+typedef void *psaddr_t;
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+typedef pid_t lwpid_t;
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/ptrace.h b/musl-include/arm/sys/ptrace.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/ptrace.h
@@ -0,0 +1,147 @@
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define PTRACE_TRACEME 0
+#define PT_TRACE_ME PTRACE_TRACEME
+
+#define PTRACE_PEEKTEXT 1
+#define PTRACE_PEEKDATA 2
+#define PTRACE_PEEKUSER 3
+#define PTRACE_POKETEXT 4
+#define PTRACE_POKEDATA 5
+#define PTRACE_POKEUSER 6
+#define PTRACE_CONT 7
+#define PTRACE_KILL 8
+#define PTRACE_SINGLESTEP 9
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+#define PTRACE_ATTACH 16
+#define PTRACE_DETACH 17
+#define PTRACE_GETFPXREGS 18
+#define PTRACE_SETFPXREGS 19
+#define PTRACE_SYSCALL 24
+#define PTRACE_SETOPTIONS 0x4200
+#define PTRACE_GETEVENTMSG 0x4201
+#define PTRACE_GETSIGINFO 0x4202
+#define PTRACE_SETSIGINFO 0x4203
+#define PTRACE_GETREGSET 0x4204
+#define PTRACE_SETREGSET 0x4205
+#define PTRACE_SEIZE 0x4206
+#define PTRACE_INTERRUPT 0x4207
+#define PTRACE_LISTEN 0x4208
+#define PTRACE_PEEKSIGINFO 0x4209
+#define PTRACE_GETSIGMASK 0x420a
+#define PTRACE_SETSIGMASK 0x420b
+#define PTRACE_SECCOMP_GET_FILTER 0x420c
+#define PTRACE_SECCOMP_GET_METADATA 0x420d
+#define PTRACE_GET_SYSCALL_INFO 0x420e
+#define PTRACE_GET_RSEQ_CONFIGURATION	0x420f
+
+#define PT_READ_I PTRACE_PEEKTEXT
+#define PT_READ_D PTRACE_PEEKDATA
+#define PT_READ_U PTRACE_PEEKUSER
+#define PT_WRITE_I PTRACE_POKETEXT
+#define PT_WRITE_D PTRACE_POKEDATA
+#define PT_WRITE_U PTRACE_POKEUSER
+#define PT_CONTINUE PTRACE_CONT
+#define PT_KILL PTRACE_KILL
+#define PT_STEP PTRACE_SINGLESTEP
+#define PT_GETREGS PTRACE_GETREGS
+#define PT_SETREGS PTRACE_SETREGS
+#define PT_GETFPREGS PTRACE_GETFPREGS
+#define PT_SETFPREGS PTRACE_SETFPREGS
+#define PT_ATTACH PTRACE_ATTACH
+#define PT_DETACH PTRACE_DETACH
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+#define PT_SYSCALL PTRACE_SYSCALL
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+
+#define PTRACE_O_TRACESYSGOOD   0x00000001
+#define PTRACE_O_TRACEFORK      0x00000002
+#define PTRACE_O_TRACEVFORK     0x00000004
+#define PTRACE_O_TRACECLONE     0x00000008
+#define PTRACE_O_TRACEEXEC      0x00000010
+#define PTRACE_O_TRACEVFORKDONE 0x00000020
+#define PTRACE_O_TRACEEXIT      0x00000040
+#define PTRACE_O_TRACESECCOMP   0x00000080
+#define PTRACE_O_EXITKILL       0x00100000
+#define PTRACE_O_SUSPEND_SECCOMP 0x00200000
+#define PTRACE_O_MASK           0x003000ff
+
+#define PTRACE_EVENT_FORK 1
+#define PTRACE_EVENT_VFORK 2
+#define PTRACE_EVENT_CLONE 3
+#define PTRACE_EVENT_EXEC 4
+#define PTRACE_EVENT_VFORK_DONE 5
+#define PTRACE_EVENT_EXIT 6
+#define PTRACE_EVENT_SECCOMP 7
+#define PTRACE_EVENT_STOP 128
+
+#define PTRACE_PEEKSIGINFO_SHARED 1
+
+#define PTRACE_SYSCALL_INFO_NONE 0
+#define PTRACE_SYSCALL_INFO_ENTRY 1
+#define PTRACE_SYSCALL_INFO_EXIT 2
+#define PTRACE_SYSCALL_INFO_SECCOMP 3
+
+#include <bits/ptrace.h>
+
+struct __ptrace_peeksiginfo_args {
+	uint64_t off;
+	uint32_t flags;
+	int32_t nr;
+};
+
+struct __ptrace_seccomp_metadata {
+	uint64_t filter_off;
+	uint64_t flags;
+};
+
+struct __ptrace_syscall_info {
+	uint8_t op;
+	uint8_t __pad[3];
+	uint32_t arch;
+	uint64_t instruction_pointer;
+	uint64_t stack_pointer;
+	union {
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+		} entry;
+		struct {
+			int64_t rval;
+			uint8_t is_error;
+		} exit;
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+			uint32_t ret_data;
+		} seccomp;
+	};
+};
+
+struct __ptrace_rseq_configuration {
+	uint64_t rseq_abi_pointer;
+	uint32_t rseq_abi_size;
+	uint32_t signature;
+	uint32_t flags;
+	uint32_t pad;
+};
+
+long ptrace(int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/quota.h b/musl-include/arm/sys/quota.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/quota.h
@@ -0,0 +1,102 @@
+#ifndef _SYS_QUOTA_H
+#define _SYS_QUOTA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define _LINUX_QUOTA_VERSION 2
+
+#define dbtob(num) ((num) << 10)
+#define btodb(num) ((num) >> 10)
+#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024)
+
+#define MAX_IQ_TIME 604800
+#define MAX_DQ_TIME 604800
+
+#define MAXQUOTAS 2
+#define USRQUOTA  0
+#define GRPQUOTA  1
+
+#define INITQFNAMES { "user", "group", "undefined" };
+
+#define QUOTAFILENAME "quota"
+#define QUOTAGROUP "staff"
+
+#define NR_DQHASH 43
+#define NR_DQUOTS 256
+
+#define SUBCMDMASK       0x00ff
+#define SUBCMDSHIFT      8
+#define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
+
+#define Q_SYNC     0x800001
+#define Q_QUOTAON  0x800002
+#define Q_QUOTAOFF 0x800003
+#define Q_GETFMT   0x800004
+#define Q_GETINFO  0x800005
+#define Q_SETINFO  0x800006
+#define Q_GETQUOTA 0x800007
+#define Q_SETQUOTA 0x800008
+
+#define	QFMT_VFS_OLD 1
+#define	QFMT_VFS_V0 2
+#define QFMT_OCFS2 3
+#define	QFMT_VFS_V1 4
+
+#define QIF_BLIMITS	1
+#define QIF_SPACE	2
+#define QIF_ILIMITS	4
+#define QIF_INODES	8
+#define QIF_BTIME	16
+#define QIF_ITIME	32
+#define QIF_LIMITS	(QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE	(QIF_SPACE | QIF_INODES)
+#define QIF_TIMES	(QIF_BTIME | QIF_ITIME)
+#define QIF_ALL		(QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk {
+	uint64_t dqb_bhardlimit;
+	uint64_t dqb_bsoftlimit;
+	uint64_t dqb_curspace;
+	uint64_t dqb_ihardlimit;
+	uint64_t dqb_isoftlimit;
+	uint64_t dqb_curinodes;
+	uint64_t dqb_btime;
+	uint64_t dqb_itime;
+	uint32_t dqb_valid;
+};
+
+#define	dq_bhardlimit	dq_dqb.dqb_bhardlimit
+#define	dq_bsoftlimit	dq_dqb.dqb_bsoftlimit
+#define dq_curspace	dq_dqb.dqb_curspace
+#define dq_valid	dq_dqb.dqb_valid
+#define	dq_ihardlimit	dq_dqb.dqb_ihardlimit
+#define	dq_isoftlimit	dq_dqb.dqb_isoftlimit
+#define	dq_curinodes	dq_dqb.dqb_curinodes
+#define	dq_btime	dq_dqb.dqb_btime
+#define	dq_itime	dq_dqb.dqb_itime
+
+#define dqoff(UID)      ((long long)(UID) * sizeof (struct dqblk))
+
+#define IIF_BGRACE	1
+#define IIF_IGRACE	2
+#define IIF_FLAGS	4
+#define IIF_ALL		(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo {
+	uint64_t dqi_bgrace;
+	uint64_t dqi_igrace;
+	uint32_t dqi_flags;
+	uint32_t dqi_valid;
+};
+
+int quotactl(int, const char *, int, char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/random.h b/musl-include/arm/sys/random.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/random.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_RANDOM_H
+#define _SYS_RANDOM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#include <bits/alltypes.h>
+
+#define GRND_NONBLOCK	0x0001
+#define GRND_RANDOM	0x0002
+#define GRND_INSECURE	0x0004
+
+ssize_t getrandom(void *, size_t, unsigned);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/reboot.h b/musl-include/arm/sys/reboot.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/reboot.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_REBOOT_H
+#define _SYS_REBOOT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RB_AUTOBOOT     0x01234567
+#define RB_HALT_SYSTEM  0xcdef0123
+#define RB_ENABLE_CAD   0x89abcdef
+#define RB_DISABLE_CAD  0
+#define RB_POWER_OFF    0x4321fedc
+#define RB_SW_SUSPEND   0xd000fce2
+#define RB_KEXEC        0x45584543
+
+int reboot(int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/reg.h b/musl-include/arm/sys/reg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/reg.h
@@ -0,0 +1,9 @@
+#ifndef _SYS_REG_H
+#define _SYS_REG_H
+
+#include <limits.h>
+#include <unistd.h>
+
+#include <bits/reg.h>
+
+#endif
diff --git a/musl-include/arm/sys/resource.h b/musl-include/arm/sys/resource.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/resource.h
@@ -0,0 +1,116 @@
+#ifndef	_SYS_RESOURCE_H
+#define	_SYS_RESOURCE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/time.h>
+
+#define __NEED_id_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_pid_t
+#endif
+
+#include <bits/alltypes.h>
+#include <bits/resource.h>
+
+typedef unsigned long long rlim_t;
+
+struct rlimit {
+	rlim_t rlim_cur;
+	rlim_t rlim_max;
+};
+
+struct rusage {
+	struct timeval ru_utime;
+	struct timeval ru_stime;
+	/* linux extentions, but useful */
+	long	ru_maxrss;
+	long	ru_ixrss;
+	long	ru_idrss;
+	long	ru_isrss;
+	long	ru_minflt;
+	long	ru_majflt;
+	long	ru_nswap;
+	long	ru_inblock;
+	long	ru_oublock;
+	long	ru_msgsnd;
+	long	ru_msgrcv;
+	long	ru_nsignals;
+	long	ru_nvcsw;
+	long	ru_nivcsw;
+	/* room for more... */
+	long    __reserved[16];
+};
+
+int getrlimit (int, struct rlimit *);
+int setrlimit (int, const struct rlimit *);
+int getrusage (int, struct rusage *);
+
+int getpriority (int, id_t);
+int setpriority (int, id_t, int);
+
+#ifdef _GNU_SOURCE
+int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
+#define prlimit64 prlimit
+#endif
+
+#define PRIO_MIN (-20)
+#define PRIO_MAX 20
+
+#define PRIO_PROCESS 0
+#define PRIO_PGRP    1
+#define PRIO_USER    2
+
+#define RUSAGE_SELF     0
+#define RUSAGE_CHILDREN (-1)
+#define RUSAGE_THREAD   1
+
+#define RLIM_INFINITY (~0ULL)
+#define RLIM_SAVED_CUR RLIM_INFINITY
+#define RLIM_SAVED_MAX RLIM_INFINITY
+
+#define RLIMIT_CPU     0
+#define RLIMIT_FSIZE   1
+#define RLIMIT_DATA    2
+#define RLIMIT_STACK   3
+#define RLIMIT_CORE    4
+#ifndef RLIMIT_RSS
+#define RLIMIT_RSS     5
+#define RLIMIT_NPROC   6
+#define RLIMIT_NOFILE  7
+#define RLIMIT_MEMLOCK 8
+#define RLIMIT_AS      9
+#endif
+#define RLIMIT_LOCKS   10
+#define RLIMIT_SIGPENDING 11
+#define RLIMIT_MSGQUEUE 12
+#define RLIMIT_NICE    13
+#define RLIMIT_RTPRIO  14
+#define RLIMIT_RTTIME  15
+#define RLIMIT_NLIMITS 16
+
+#define RLIM_NLIMITS RLIMIT_NLIMITS
+
+#if defined(_LARGEFILE64_SOURCE)
+#define RLIM64_INFINITY RLIM_INFINITY
+#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
+#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
+#define getrlimit64 getrlimit
+#define setrlimit64 setrlimit
+#define rlimit64 rlimit
+#define rlim64_t rlim_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(getrusage, __getrusage_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/select.h b/musl-include/arm/sys/select.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/select.h
@@ -0,0 +1,46 @@
+#ifndef _SYS_SELECT_H
+#define _SYS_SELECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_struct_timeval
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define FD_SETSIZE 1024
+
+typedef unsigned long fd_mask;
+
+typedef struct {
+	unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)];
+} fd_set;
+
+#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0)
+#define FD_SET(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
+#define FD_CLR(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
+#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
+
+int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict);
+int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define NFDBITS (8*(int)sizeof(long))
+#endif
+
+#if _REDIR_TIME64
+__REDIR(select, __select_time64);
+__REDIR(pselect, __pselect_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/sem.h b/musl-include/arm/sys/sem.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/sem.h
@@ -0,0 +1,72 @@
+#ifndef _SYS_SEM_H
+#define _SYS_SEM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_pid_t
+#define __NEED_time_t
+#ifdef _GNU_SOURCE
+#define __NEED_struct_timespec
+#endif
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+
+#define SEM_UNDO	0x1000
+#define GETPID		11
+#define GETVAL		12
+#define GETALL		13
+#define GETNCNT		14
+#define GETZCNT		15
+#define SETVAL		16
+#define SETALL		17
+
+#include <bits/sem.h>
+
+#define _SEM_SEMUN_UNDEFINED 1
+
+#define SEM_STAT (18 | (IPC_STAT & 0x100))
+#define SEM_INFO 19
+#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100))
+
+struct  seminfo {
+	int semmap;
+	int semmni;
+	int semmns;
+	int semmnu;
+	int semmsl;
+	int semopm;
+	int semume;
+	int semusz;
+	int semvmx;
+	int semaem;
+};
+
+struct sembuf {
+	unsigned short sem_num;
+	short sem_op;
+	short sem_flg;
+};
+
+int semctl(int, int, int, ...);
+int semget(key_t, int, int);
+int semop(int, struct sembuf *, size_t);
+
+#ifdef _GNU_SOURCE
+int semtimedop(int, struct sembuf *, size_t, const struct timespec *);
+#endif
+
+#if _REDIR_TIME64
+#ifdef _GNU_SOURCE
+__REDIR(semtimedop, __semtimedop_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/sendfile.h b/musl-include/arm/sys/sendfile.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/sendfile.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_SENDFILE_H
+#define _SYS_SENDFILE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <unistd.h>
+
+ssize_t sendfile(int, int, off_t *, size_t);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define sendfile64 sendfile
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/shm.h b/musl-include/arm/sys/shm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/shm.h
@@ -0,0 +1,70 @@
+#ifndef _SYS_SHM_H
+#define _SYS_SHM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_pid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+
+#ifdef _GNU_SOURCE
+#define __used_ids used_ids
+#define __swap_attempts swap_attempts
+#define __swap_successes swap_successes
+#endif
+
+#include <bits/shm.h>
+
+#define SHM_R 0400
+#define SHM_W 0200
+
+#define SHM_RDONLY 010000
+#define SHM_RND    020000
+#define SHM_REMAP  040000
+#define SHM_EXEC   0100000
+
+#define SHM_LOCK 11
+#define SHM_UNLOCK 12
+#define SHM_STAT (13 | (IPC_STAT & 0x100))
+#define SHM_INFO 14
+#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100))
+#define SHM_DEST 01000
+#define SHM_LOCKED 02000
+#define SHM_HUGETLB 04000
+#define SHM_NORESERVE 010000
+
+#define SHM_HUGE_SHIFT 26
+#define SHM_HUGE_MASK  0x3f
+#define SHM_HUGE_64KB  (16 << 26)
+#define SHM_HUGE_512KB (19 << 26)
+#define SHM_HUGE_1MB   (20 << 26)
+#define SHM_HUGE_2MB   (21 << 26)
+#define SHM_HUGE_8MB   (23 << 26)
+#define SHM_HUGE_16MB  (24 << 26)
+#define SHM_HUGE_32MB  (25 << 26)
+#define SHM_HUGE_256MB (28 << 26)
+#define SHM_HUGE_512MB (29 << 26)
+#define SHM_HUGE_1GB   (30 << 26)
+#define SHM_HUGE_2GB   (31 << 26)
+#define SHM_HUGE_16GB  (34U << 26)
+
+typedef unsigned long shmatt_t;
+
+void *shmat(int, const void *, int);
+int shmctl(int, int, struct shmid_ds *);
+int shmdt(const void *);
+int shmget(key_t, size_t, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/signal.h b/musl-include/arm/sys/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/signal.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/signal.h> to <signal.h>
+#include <signal.h>
diff --git a/musl-include/arm/sys/signalfd.h b/musl-include/arm/sys/signalfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/signalfd.h
@@ -0,0 +1,49 @@
+#ifndef _SYS_SIGNALFD_H
+#define _SYS_SIGNALFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define SFD_CLOEXEC O_CLOEXEC
+#define SFD_NONBLOCK O_NONBLOCK
+
+int signalfd(int, const sigset_t *, int);
+
+struct signalfd_siginfo {
+	uint32_t  ssi_signo;
+	int32_t   ssi_errno;
+	int32_t   ssi_code;
+	uint32_t  ssi_pid;
+	uint32_t  ssi_uid;
+	int32_t   ssi_fd;
+	uint32_t  ssi_tid;
+	uint32_t  ssi_band;
+	uint32_t  ssi_overrun;
+	uint32_t  ssi_trapno;
+	int32_t   ssi_status;
+	int32_t   ssi_int;
+	uint64_t  ssi_ptr;
+	uint64_t  ssi_utime;
+	uint64_t  ssi_stime;
+	uint64_t  ssi_addr;
+	uint16_t  ssi_addr_lsb;
+	uint16_t  __pad2;
+	int32_t   ssi_syscall;
+	uint64_t  ssi_call_addr;
+	uint32_t  ssi_arch;
+	uint8_t   __pad[128-14*4-5*8-2*2];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/socket.h b/musl-include/arm/sys/socket.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/socket.h
@@ -0,0 +1,415 @@
+#ifndef	_SYS_SOCKET_H
+#define	_SYS_SOCKET_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_socklen_t
+#define __NEED_sa_family_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_uid_t
+#define __NEED_pid_t
+#define __NEED_gid_t
+#define __NEED_struct_iovec
+
+#include <bits/alltypes.h>
+
+#include <bits/socket.h>
+
+struct msghdr {
+	void *msg_name;
+	socklen_t msg_namelen;
+	struct iovec *msg_iov;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad1;
+#endif
+	int msg_iovlen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad1;
+#endif
+	void *msg_control;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad2;
+#endif
+	socklen_t msg_controllen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad2;
+#endif
+	int msg_flags;
+};
+
+struct cmsghdr {
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad1;
+#endif
+	socklen_t cmsg_len;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad1;
+#endif
+	int cmsg_level;
+	int cmsg_type;
+};
+
+#ifdef _GNU_SOURCE
+struct ucred {
+	pid_t pid;
+	uid_t uid;
+	gid_t gid;
+};
+
+struct mmsghdr {
+	struct msghdr msg_hdr;
+	unsigned int  msg_len;
+};
+
+struct timespec;
+
+int sendmmsg (int, struct mmsghdr *, unsigned int, unsigned int);
+int recvmmsg (int, struct mmsghdr *, unsigned int, unsigned int, struct timespec *);
+#endif
+
+struct linger {
+	int l_onoff;
+	int l_linger;
+};
+
+#define SHUT_RD 0
+#define SHUT_WR 1
+#define SHUT_RDWR 2
+
+#ifndef SOCK_STREAM
+#define SOCK_STREAM    1
+#define SOCK_DGRAM     2
+#endif
+
+#define SOCK_RAW       3
+#define SOCK_RDM       4
+#define SOCK_SEQPACKET 5
+#define SOCK_DCCP      6
+#define SOCK_PACKET    10
+
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC   02000000
+#define SOCK_NONBLOCK  04000
+#endif
+
+#define PF_UNSPEC       0
+#define PF_LOCAL        1
+#define PF_UNIX         PF_LOCAL
+#define PF_FILE         PF_LOCAL
+#define PF_INET         2
+#define PF_AX25         3
+#define PF_IPX          4
+#define PF_APPLETALK    5
+#define PF_NETROM       6
+#define PF_BRIDGE       7
+#define PF_ATMPVC       8
+#define PF_X25          9
+#define PF_INET6        10
+#define PF_ROSE         11
+#define PF_DECnet       12
+#define PF_NETBEUI      13
+#define PF_SECURITY     14
+#define PF_KEY          15
+#define PF_NETLINK      16
+#define PF_ROUTE        PF_NETLINK
+#define PF_PACKET       17
+#define PF_ASH          18
+#define PF_ECONET       19
+#define PF_ATMSVC       20
+#define PF_RDS          21
+#define PF_SNA          22
+#define PF_IRDA         23
+#define PF_PPPOX        24
+#define PF_WANPIPE      25
+#define PF_LLC          26
+#define PF_IB           27
+#define PF_MPLS         28
+#define PF_CAN          29
+#define PF_TIPC         30
+#define PF_BLUETOOTH    31
+#define PF_IUCV         32
+#define PF_RXRPC        33
+#define PF_ISDN         34
+#define PF_PHONET       35
+#define PF_IEEE802154   36
+#define PF_CAIF         37
+#define PF_ALG          38
+#define PF_NFC          39
+#define PF_VSOCK        40
+#define PF_KCM          41
+#define PF_QIPCRTR      42
+#define PF_SMC          43
+#define PF_XDP          44
+#define PF_MAX          45
+
+#define AF_UNSPEC       PF_UNSPEC
+#define AF_LOCAL        PF_LOCAL
+#define AF_UNIX         AF_LOCAL
+#define AF_FILE         AF_LOCAL
+#define AF_INET         PF_INET
+#define AF_AX25         PF_AX25
+#define AF_IPX          PF_IPX
+#define AF_APPLETALK    PF_APPLETALK
+#define AF_NETROM       PF_NETROM
+#define AF_BRIDGE       PF_BRIDGE
+#define AF_ATMPVC       PF_ATMPVC
+#define AF_X25          PF_X25
+#define AF_INET6        PF_INET6
+#define AF_ROSE         PF_ROSE
+#define AF_DECnet       PF_DECnet
+#define AF_NETBEUI      PF_NETBEUI
+#define AF_SECURITY     PF_SECURITY
+#define AF_KEY          PF_KEY
+#define AF_NETLINK      PF_NETLINK
+#define AF_ROUTE        PF_ROUTE
+#define AF_PACKET       PF_PACKET
+#define AF_ASH          PF_ASH
+#define AF_ECONET       PF_ECONET
+#define AF_ATMSVC       PF_ATMSVC
+#define AF_RDS          PF_RDS
+#define AF_SNA          PF_SNA
+#define AF_IRDA         PF_IRDA
+#define AF_PPPOX        PF_PPPOX
+#define AF_WANPIPE      PF_WANPIPE
+#define AF_LLC          PF_LLC
+#define AF_IB           PF_IB
+#define AF_MPLS         PF_MPLS
+#define AF_CAN          PF_CAN
+#define AF_TIPC         PF_TIPC
+#define AF_BLUETOOTH    PF_BLUETOOTH
+#define AF_IUCV         PF_IUCV
+#define AF_RXRPC        PF_RXRPC
+#define AF_ISDN         PF_ISDN
+#define AF_PHONET       PF_PHONET
+#define AF_IEEE802154   PF_IEEE802154
+#define AF_CAIF         PF_CAIF
+#define AF_ALG          PF_ALG
+#define AF_NFC          PF_NFC
+#define AF_VSOCK        PF_VSOCK
+#define AF_KCM          PF_KCM
+#define AF_QIPCRTR      PF_QIPCRTR
+#define AF_SMC          PF_SMC
+#define AF_XDP          PF_XDP
+#define AF_MAX          PF_MAX
+
+#ifndef SO_DEBUG
+#define SO_DEBUG        1
+#define SO_REUSEADDR    2
+#define SO_TYPE         3
+#define SO_ERROR        4
+#define SO_DONTROUTE    5
+#define SO_BROADCAST    6
+#define SO_SNDBUF       7
+#define SO_RCVBUF       8
+#define SO_KEEPALIVE    9
+#define SO_OOBINLINE    10
+#define SO_NO_CHECK     11
+#define SO_PRIORITY     12
+#define SO_LINGER       13
+#define SO_BSDCOMPAT    14
+#define SO_REUSEPORT    15
+#define SO_PASSCRED     16
+#define SO_PEERCRED     17
+#define SO_RCVLOWAT     18
+#define SO_SNDLOWAT     19
+#define SO_ACCEPTCONN   30
+#define SO_PEERSEC      31
+#define SO_SNDBUFFORCE  32
+#define SO_RCVBUFFORCE  33
+#define SO_PROTOCOL     38
+#define SO_DOMAIN       39
+#endif
+
+#ifndef SO_RCVTIMEO
+#if __LONG_MAX == 0x7fffffff
+#define SO_RCVTIMEO     66
+#define SO_SNDTIMEO     67
+#else
+#define SO_RCVTIMEO     20
+#define SO_SNDTIMEO     21
+#endif
+#endif
+
+#ifndef SO_TIMESTAMP
+#if __LONG_MAX == 0x7fffffff
+#define SO_TIMESTAMP    63
+#define SO_TIMESTAMPNS  64
+#define SO_TIMESTAMPING 65
+#else
+#define SO_TIMESTAMP    29
+#define SO_TIMESTAMPNS  35
+#define SO_TIMESTAMPING 37
+#endif
+#endif
+
+#define SO_SECURITY_AUTHENTICATION              22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT        23
+#define SO_SECURITY_ENCRYPTION_NETWORK          24
+
+#define SO_BINDTODEVICE 25
+
+#define SO_ATTACH_FILTER        26
+#define SO_DETACH_FILTER        27
+#define SO_GET_FILTER           SO_ATTACH_FILTER
+
+#define SO_PEERNAME             28
+#define SCM_TIMESTAMP           SO_TIMESTAMP
+#define SO_PASSSEC              34
+#define SCM_TIMESTAMPNS         SO_TIMESTAMPNS
+#define SO_MARK                 36
+#define SCM_TIMESTAMPING        SO_TIMESTAMPING
+#define SO_RXQ_OVFL             40
+#define SO_WIFI_STATUS          41
+#define SCM_WIFI_STATUS         SO_WIFI_STATUS
+#define SO_PEEK_OFF             42
+#define SO_NOFCS                43
+#define SO_LOCK_FILTER          44
+#define SO_SELECT_ERR_QUEUE     45
+#define SO_BUSY_POLL            46
+#define SO_MAX_PACING_RATE      47
+#define SO_BPF_EXTENSIONS       48
+#define SO_INCOMING_CPU         49
+#define SO_ATTACH_BPF           50
+#define SO_DETACH_BPF           SO_DETACH_FILTER
+#define SO_ATTACH_REUSEPORT_CBPF 51
+#define SO_ATTACH_REUSEPORT_EBPF 52
+#define SO_CNX_ADVICE           53
+#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO              55
+#define SO_INCOMING_NAPI_ID     56
+#define SO_COOKIE               57
+#define SCM_TIMESTAMPING_PKTINFO 58
+#define SO_PEERGROUPS           59
+#define SO_ZEROCOPY             60
+#define SO_TXTIME               61
+#define SCM_TXTIME              SO_TXTIME
+#define SO_BINDTOIFINDEX        62
+#define SO_DETACH_REUSEPORT_BPF 68
+#define SO_PREFER_BUSY_POLL     69
+#define SO_BUSY_POLL_BUDGET     70
+
+#ifndef SOL_SOCKET
+#define SOL_SOCKET      1
+#endif
+
+#define SOL_IP          0
+#define SOL_IPV6        41
+#define SOL_ICMPV6      58
+
+#define SOL_RAW         255
+#define SOL_DECNET      261
+#define SOL_X25         262
+#define SOL_PACKET      263
+#define SOL_ATM         264
+#define SOL_AAL         265
+#define SOL_IRDA        266
+#define SOL_NETBEUI     267
+#define SOL_LLC         268
+#define SOL_DCCP        269
+#define SOL_NETLINK     270
+#define SOL_TIPC        271
+#define SOL_RXRPC       272
+#define SOL_PPPOL2TP    273
+#define SOL_BLUETOOTH   274
+#define SOL_PNPIPE      275
+#define SOL_RDS         276
+#define SOL_IUCV        277
+#define SOL_CAIF        278
+#define SOL_ALG         279
+#define SOL_NFC         280
+#define SOL_KCM         281
+#define SOL_TLS         282
+#define SOL_XDP         283
+
+#define SOMAXCONN       128
+
+#define MSG_OOB       0x0001
+#define MSG_PEEK      0x0002
+#define MSG_DONTROUTE 0x0004
+#define MSG_CTRUNC    0x0008
+#define MSG_PROXY     0x0010
+#define MSG_TRUNC     0x0020
+#define MSG_DONTWAIT  0x0040
+#define MSG_EOR       0x0080
+#define MSG_WAITALL   0x0100
+#define MSG_FIN       0x0200
+#define MSG_SYN       0x0400
+#define MSG_CONFIRM   0x0800
+#define MSG_RST       0x1000
+#define MSG_ERRQUEUE  0x2000
+#define MSG_NOSIGNAL  0x4000
+#define MSG_MORE      0x8000
+#define MSG_WAITFORONE 0x10000
+#define MSG_BATCH     0x40000
+#define MSG_ZEROCOPY  0x4000000
+#define MSG_FASTOPEN  0x20000000
+#define MSG_CMSG_CLOEXEC 0x40000000
+
+#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1))
+#define __CMSG_NEXT(cmsg) ((unsigned char *)(cmsg) + __CMSG_LEN(cmsg))
+#define __MHDR_END(mhdr) ((unsigned char *)(mhdr)->msg_control + (mhdr)->msg_controllen)
+
+#define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1))
+#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \
+	__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
+	? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg))
+#define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
+
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+#define SCM_RIGHTS      0x01
+#define SCM_CREDENTIALS 0x02
+
+struct sockaddr {
+	sa_family_t sa_family;
+	char sa_data[14];
+};
+
+struct sockaddr_storage {
+	sa_family_t ss_family;
+	char __ss_padding[128-sizeof(long)-sizeof(sa_family_t)];
+	unsigned long __ss_align;
+};
+
+int socket (int, int, int);
+int socketpair (int, int, int, int [2]);
+
+int shutdown (int, int);
+
+int bind (int, const struct sockaddr *, socklen_t);
+int connect (int, const struct sockaddr *, socklen_t);
+int listen (int, int);
+int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
+int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
+
+int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
+int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
+
+ssize_t send (int, const void *, size_t, int);
+ssize_t recv (int, void *, size_t, int);
+ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
+ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
+ssize_t sendmsg (int, const struct msghdr *, int);
+ssize_t recvmsg (int, struct msghdr *, int);
+
+int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
+int setsockopt (int, int, int, const void *, socklen_t);
+
+int sockatmark (int);
+
+#if _REDIR_TIME64
+#ifdef _GNU_SOURCE
+__REDIR(recvmmsg, __recvmmsg_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/soundcard.h b/musl-include/arm/sys/soundcard.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/soundcard.h
@@ -0,0 +1,1 @@
+#include <bits/soundcard.h>
diff --git a/musl-include/arm/sys/stat.h b/musl-include/arm/sys/stat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/stat.h
@@ -0,0 +1,182 @@
+#ifndef	_SYS_STAT_H
+#define	_SYS_STAT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_dev_t
+#define __NEED_ino_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_off_t
+#define __NEED_time_t
+#define __NEED_blksize_t
+#define __NEED_blkcnt_t
+#define __NEED_struct_timespec
+
+#ifdef _GNU_SOURCE
+#define __NEED_int64_t
+#define __NEED_uint64_t
+#define __NEED_uint32_t
+#define __NEED_uint16_t
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/stat.h>
+
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+
+#define S_IFMT  0170000
+
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFBLK 0060000
+#define S_IFREG 0100000
+#define S_IFIFO 0010000
+#define S_IFLNK 0120000
+#define S_IFSOCK 0140000
+
+#define S_TYPEISMQ(buf)  0
+#define S_TYPEISSEM(buf) 0
+#define S_TYPEISSHM(buf) 0
+#define S_TYPEISTMO(buf) 0
+
+#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK)
+#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
+#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
+#define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK)
+#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+
+#ifndef S_IRUSR
+#define S_ISUID 04000
+#define S_ISGID 02000
+#define S_ISVTX 01000
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXU 0700
+#define S_IRGRP 0040
+#define S_IWGRP 0020
+#define S_IXGRP 0010
+#define S_IRWXG 0070
+#define S_IROTH 0004
+#define S_IWOTH 0002
+#define S_IXOTH 0001
+#define S_IRWXO 0007
+#endif
+
+#define UTIME_NOW  0x3fffffff
+#define UTIME_OMIT 0x3ffffffe
+
+int stat(const char *__restrict, struct stat *__restrict);
+int fstat(int, struct stat *);
+int lstat(const char *__restrict, struct stat *__restrict);
+int fstatat(int, const char *__restrict, struct stat *__restrict, int);
+int chmod(const char *, mode_t);
+int fchmod(int, mode_t);
+int fchmodat(int, const char *, mode_t, int);
+mode_t umask(mode_t);
+int mkdir(const char *, mode_t);
+int mkfifo(const char *, mode_t);
+int mkdirat(int, const char *, mode_t);
+int mkfifoat(int, const char *, mode_t);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int mknod(const char *, mode_t, dev_t);
+int mknodat(int, const char *, mode_t, dev_t);
+#endif
+
+int futimens(int, const struct timespec [2]);
+int utimensat(int, const char *, const struct timespec [2], int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int lchmod(const char *, mode_t);
+#define S_IREAD S_IRUSR
+#define S_IWRITE S_IWUSR
+#define S_IEXEC S_IXUSR
+#endif
+
+#if defined(_GNU_SOURCE)
+#define STATX_TYPE 1U
+#define STATX_MODE 2U
+#define STATX_NLINK 4U
+#define STATX_UID 8U
+#define STATX_GID 0x10U
+#define STATX_ATIME 0x20U
+#define STATX_MTIME 0x40U
+#define STATX_CTIME 0x80U
+#define STATX_INO 0x100U
+#define STATX_SIZE 0x200U
+#define STATX_BLOCKS 0x400U
+#define STATX_BASIC_STATS 0x7ffU
+#define STATX_BTIME 0x800U
+#define STATX_ALL 0xfffU
+
+struct statx_timestamp {
+	int64_t tv_sec;
+	uint32_t tv_nsec, __pad;
+};
+
+struct statx {
+	uint32_t stx_mask;
+	uint32_t stx_blksize;
+	uint64_t stx_attributes;
+	uint32_t stx_nlink;
+	uint32_t stx_uid;
+	uint32_t stx_gid;
+	uint16_t stx_mode;
+	uint16_t __pad0[1];
+	uint64_t stx_ino;
+	uint64_t stx_size;
+	uint64_t stx_blocks;
+	uint64_t stx_attributes_mask;
+	struct statx_timestamp stx_atime;
+	struct statx_timestamp stx_btime;
+	struct statx_timestamp stx_ctime;
+	struct statx_timestamp stx_mtime;
+	uint32_t stx_rdev_major;
+	uint32_t stx_rdev_minor;
+	uint32_t stx_dev_major;
+	uint32_t stx_dev_minor;
+	uint64_t __pad1[14];
+};
+
+int statx(int, const char *__restrict, int, unsigned, struct statx *__restrict);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define stat64 stat
+#define fstat64 fstat
+#define lstat64 lstat
+#define fstatat64 fstatat
+#define blkcnt64_t blkcnt_t
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#define ino64_t ino_t
+#define off64_t off_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(stat, __stat_time64);
+__REDIR(fstat, __fstat_time64);
+__REDIR(lstat, __lstat_time64);
+__REDIR(fstatat, __fstatat_time64);
+__REDIR(futimens, __futimens_time64);
+__REDIR(utimensat, __utimensat_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
diff --git a/musl-include/arm/sys/statfs.h b/musl-include/arm/sys/statfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/statfs.h
@@ -0,0 +1,32 @@
+#ifndef	_SYS_STATFS_H
+#define	_SYS_STATFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <sys/statvfs.h>
+
+typedef struct __fsid_t {
+	int __val[2];
+} fsid_t;
+
+#include <bits/statfs.h>
+
+int statfs (const char *, struct statfs *);
+int fstatfs (int, struct statfs *);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define statfs64 statfs
+#define fstatfs64 fstatfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/statvfs.h b/musl-include/arm/sys/statvfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/statvfs.h
@@ -0,0 +1,57 @@
+#ifndef	_SYS_STATVFS_H
+#define	_SYS_STATVFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+#include <bits/alltypes.h>
+
+struct statvfs {
+	unsigned long f_bsize, f_frsize;
+	fsblkcnt_t f_blocks, f_bfree, f_bavail;
+	fsfilcnt_t f_files, f_ffree, f_favail;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned long f_fsid;
+	unsigned :8*(2*sizeof(int)-sizeof(long));
+#else
+	unsigned :8*(2*sizeof(int)-sizeof(long));
+	unsigned long f_fsid;
+#endif
+	unsigned long f_flag, f_namemax;
+	unsigned int f_type;
+	int __reserved[5];
+};
+
+int statvfs (const char *__restrict, struct statvfs *__restrict);
+int fstatvfs (int, struct statvfs *);
+
+#define ST_RDONLY 1
+#define ST_NOSUID 2
+#define ST_NODEV  4
+#define ST_NOEXEC 8
+#define ST_SYNCHRONOUS 16
+#define ST_MANDLOCK    64
+#define ST_WRITE       128
+#define ST_APPEND      256
+#define ST_IMMUTABLE   512
+#define ST_NOATIME     1024
+#define ST_NODIRATIME  2048
+#define ST_RELATIME    4096
+
+#if defined(_LARGEFILE64_SOURCE)
+#define statvfs64 statvfs
+#define fstatvfs64 fstatvfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/stropts.h b/musl-include/arm/sys/stropts.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/stropts.h
@@ -0,0 +1,1 @@
+#include <stropts.h>
diff --git a/musl-include/arm/sys/swap.h b/musl-include/arm/sys/swap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/swap.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_SWAP_H
+#define _SYS_SWAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define	SWAP_FLAG_PREFER        0x8000
+#define	SWAP_FLAG_PRIO_MASK     0x7fff
+#define	SWAP_FLAG_PRIO_SHIFT    0
+#define SWAP_FLAG_DISCARD       0x10000
+
+int swapon (const char *, int);
+int swapoff (const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/syscall.h b/musl-include/arm/sys/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/syscall.h
@@ -0,0 +1,6 @@
+#ifndef _SYS_SYSCALL_H
+#define _SYS_SYSCALL_H
+
+#include <bits/syscall.h>
+
+#endif
diff --git a/musl-include/arm/sys/sysinfo.h b/musl-include/arm/sys/sysinfo.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/sysinfo.h
@@ -0,0 +1,36 @@
+#ifndef _SYS_SYSINFO_H
+#define _SYS_SYSINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SI_LOAD_SHIFT 16
+
+struct sysinfo {
+	unsigned long uptime;
+	unsigned long loads[3];
+	unsigned long totalram;
+	unsigned long freeram;
+	unsigned long sharedram;
+	unsigned long bufferram;
+	unsigned long totalswap;
+	unsigned long freeswap;
+	unsigned short procs, pad;
+	unsigned long totalhigh;
+	unsigned long freehigh;
+	unsigned mem_unit;
+	char __reserved[256];
+};
+
+int sysinfo (struct sysinfo *);
+int get_nprocs_conf (void);
+int get_nprocs (void);
+long get_phys_pages (void);
+long get_avphys_pages (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/syslog.h b/musl-include/arm/sys/syslog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/syslog.h
@@ -0,0 +1,1 @@
+#include <syslog.h>
diff --git a/musl-include/arm/sys/sysmacros.h b/musl-include/arm/sys/sysmacros.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/sysmacros.h
@@ -0,0 +1,15 @@
+#ifndef _SYS_SYSMACROS_H
+#define _SYS_SYSMACROS_H
+
+#define major(x) \
+	((unsigned)( (((x)>>31>>1) & 0xfffff000) | (((x)>>8) & 0x00000fff) ))
+#define minor(x) \
+	((unsigned)( (((x)>>12) & 0xffffff00) | ((x) & 0x000000ff) ))
+
+#define makedev(x,y) ( \
+        (((x)&0xfffff000ULL) << 32) | \
+	(((x)&0x00000fffULL) << 8) | \
+        (((y)&0xffffff00ULL) << 12) | \
+	(((y)&0x000000ffULL)) )
+
+#endif
diff --git a/musl-include/arm/sys/termios.h b/musl-include/arm/sys/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/termios.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/termios.h> to <termios.h>
+#include <termios.h>
diff --git a/musl-include/arm/sys/time.h b/musl-include/arm/sys/time.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/time.h
@@ -0,0 +1,76 @@
+#ifndef _SYS_TIME_H
+#define _SYS_TIME_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <sys/select.h>
+
+int gettimeofday (struct timeval *__restrict, void *__restrict);
+
+#define ITIMER_REAL    0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF    2
+
+struct itimerval {
+	struct timeval it_interval;
+	struct timeval it_value;
+};
+
+int getitimer (int, struct itimerval *);
+int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict);
+int utimes (const char *, const struct timeval [2]);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct timezone {
+	int tz_minuteswest;
+	int tz_dsttime;
+};
+int futimes(int, const struct timeval [2]);
+int futimesat(int, const char *, const struct timeval [2]);
+int lutimes(const char *, const struct timeval [2]);
+int settimeofday(const struct timeval *, const struct timezone *);
+int adjtime (const struct timeval *, struct timeval *);
+#define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
+#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
+#define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
+	(s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
+#define timeradd(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
+	((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
+	((a)->tv_usec -= 1000000, (a)->tv_sec++) )
+#define timersub(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
+	((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
+	((a)->tv_usec += 1000000, (a)->tv_sec--) )
+#endif
+
+#if defined(_GNU_SOURCE)
+#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \
+	(ts)->tv_sec = (tv)->tv_sec, \
+	(ts)->tv_nsec = (tv)->tv_usec * 1000, \
+	(void)0 )
+#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \
+	(tv)->tv_sec = (ts)->tv_sec, \
+	(tv)->tv_usec = (ts)->tv_nsec / 1000, \
+	(void)0 )
+#endif
+
+#if _REDIR_TIME64
+__REDIR(gettimeofday, __gettimeofday_time64);
+__REDIR(getitimer, __getitimer_time64);
+__REDIR(setitimer, __setitimer_time64);
+__REDIR(utimes, __utimes_time64);
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(futimes, __futimes_time64);
+__REDIR(futimesat, __futimesat_time64);
+__REDIR(lutimes, __lutimes_time64);
+__REDIR(settimeofday, __settimeofday_time64);
+__REDIR(adjtime, __adjtime64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/timeb.h b/musl-include/arm/sys/timeb.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/timeb.h
@@ -0,0 +1,28 @@
+#ifndef _SYS_TIMEB_H
+#define _SYS_TIMEB_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+
+#include <bits/alltypes.h>
+
+struct timeb {
+	time_t time;
+	unsigned short millitm;
+	short timezone, dstflag;
+};
+
+int ftime(struct timeb *);
+
+#if _REDIR_TIME64
+__REDIR(ftime, __ftime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/timerfd.h b/musl-include/arm/sys/timerfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/timerfd.h
@@ -0,0 +1,32 @@
+#ifndef _SYS_TIMERFD_H
+#define _SYS_TIMERFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <time.h>
+#include <fcntl.h>
+
+#define TFD_NONBLOCK O_NONBLOCK
+#define TFD_CLOEXEC O_CLOEXEC
+
+#define TFD_TIMER_ABSTIME 1
+#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
+
+struct itimerspec;
+
+int timerfd_create(int, int);
+int timerfd_settime(int, int, const struct itimerspec *, struct itimerspec *);
+int timerfd_gettime(int, struct itimerspec *);
+
+#if _REDIR_TIME64
+__REDIR(timerfd_settime, __timerfd_settime64);
+__REDIR(timerfd_gettime, __timerfd_gettime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/times.h b/musl-include/arm/sys/times.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/times.h
@@ -0,0 +1,25 @@
+#ifndef	_SYS_TIMES_H
+#define	_SYS_TIMES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clock_t
+#include <bits/alltypes.h>
+
+struct tms {
+	clock_t tms_utime;
+	clock_t tms_stime;
+	clock_t tms_cutime;
+	clock_t tms_cstime;
+};
+
+clock_t times (struct tms *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/arm/sys/timex.h b/musl-include/arm/sys/timex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/timex.h
@@ -0,0 +1,103 @@
+#ifndef _SYS_TIMEX_H
+#define _SYS_TIMEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clockid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/time.h>
+
+struct ntptimeval {
+	struct timeval time;
+	long maxerror, esterror;
+};
+
+struct timex {
+	unsigned modes;
+	long offset, freq, maxerror, esterror;
+	int status;
+	long constant, precision, tolerance;
+	struct timeval time;
+	long tick, ppsfreq, jitter;
+	int shift;
+	long stabil, jitcnt, calcnt, errcnt, stbcnt;
+	int tai;
+	int __padding[11];
+};
+
+#define ADJ_OFFSET		0x0001
+#define ADJ_FREQUENCY		0x0002
+#define ADJ_MAXERROR		0x0004
+#define ADJ_ESTERROR		0x0008
+#define ADJ_STATUS		0x0010
+#define ADJ_TIMECONST		0x0020
+#define ADJ_TAI			0x0080
+#define ADJ_SETOFFSET		0x0100
+#define ADJ_MICRO		0x1000
+#define ADJ_NANO		0x2000
+#define ADJ_TICK		0x4000
+#define ADJ_OFFSET_SINGLESHOT	0x8001
+#define ADJ_OFFSET_SS_READ	0xa001
+
+#define MOD_OFFSET	ADJ_OFFSET
+#define MOD_FREQUENCY	ADJ_FREQUENCY
+#define MOD_MAXERROR	ADJ_MAXERROR
+#define MOD_ESTERROR	ADJ_ESTERROR
+#define MOD_STATUS	ADJ_STATUS
+#define MOD_TIMECONST	ADJ_TIMECONST
+#define MOD_CLKB	ADJ_TICK
+#define MOD_CLKA	ADJ_OFFSET_SINGLESHOT
+#define MOD_TAI		ADJ_TAI
+#define MOD_MICRO	ADJ_MICRO
+#define MOD_NANO	ADJ_NANO
+
+#define STA_PLL		0x0001
+#define STA_PPSFREQ	0x0002
+#define STA_PPSTIME	0x0004
+#define STA_FLL		0x0008
+
+#define STA_INS		0x0010
+#define STA_DEL		0x0020
+#define STA_UNSYNC	0x0040
+#define STA_FREQHOLD	0x0080
+
+#define STA_PPSSIGNAL	0x0100
+#define STA_PPSJITTER	0x0200
+#define STA_PPSWANDER	0x0400
+#define STA_PPSERROR	0x0800
+
+#define STA_CLOCKERR	0x1000
+#define STA_NANO	0x2000
+#define STA_MODE	0x4000
+#define STA_CLK		0x8000
+
+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
+    STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
+
+#define TIME_OK		0
+#define TIME_INS	1
+#define TIME_DEL	2
+#define TIME_OOP	3
+#define TIME_WAIT	4
+#define TIME_ERROR	5
+#define TIME_BAD	TIME_ERROR
+
+#define MAXTC		6
+
+int adjtimex(struct timex *);
+int clock_adjtime(clockid_t, struct timex *);
+
+#if _REDIR_TIME64
+__REDIR(adjtimex, __adjtimex_time64);
+__REDIR(clock_adjtime, __clock_adjtime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/ttydefaults.h b/musl-include/arm/sys/ttydefaults.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/ttydefaults.h
@@ -0,0 +1,34 @@
+#ifndef _SYS_TTYDEFAULTS_H
+#define _SYS_TTYDEFAULTS_H
+
+#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
+#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
+#define TTYDEF_SPEED (B9600)
+#define CTRL(x) ((x)&037)
+#define CEOF CTRL('d')
+
+#define CEOL '\0'
+#define CSTATUS '\0'
+
+#define CERASE 0177
+#define CINTR CTRL('c')
+#define CKILL CTRL('u')
+#define CMIN 1
+#define CQUIT 034
+#define CSUSP CTRL('z')
+#define CTIME 0
+#define CDSUSP CTRL('y')
+#define CSTART CTRL('q')
+#define CSTOP CTRL('s')
+#define CLNEXT CTRL('v')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
+#define CEOT CEOF
+#define CBRK CEOL
+#define CRPRNT CREPRINT
+#define CFLUSH CDISCARD
+
+#endif
diff --git a/musl-include/arm/sys/types.h b/musl-include/arm/sys/types.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/types.h
@@ -0,0 +1,85 @@
+#ifndef	_SYS_TYPES_H
+#define	_SYS_TYPES_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ino_t
+#define __NEED_dev_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_time_t
+#define __NEED_timer_t
+#define __NEED_clockid_t
+
+#define __NEED_blkcnt_t
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+
+#define __NEED_id_t
+#define __NEED_key_t
+#define __NEED_clock_t
+#define __NEED_suseconds_t
+#define __NEED_blksize_t
+
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_pthread_mutexattr_t
+#define __NEED_pthread_condattr_t
+#define __NEED_pthread_rwlockattr_t
+#define __NEED_pthread_barrierattr_t
+#define __NEED_pthread_mutex_t
+#define __NEED_pthread_cond_t
+#define __NEED_pthread_rwlock_t
+#define __NEED_pthread_barrier_t
+#define __NEED_pthread_spinlock_t
+#define __NEED_pthread_key_t
+#define __NEED_pthread_once_t
+#define __NEED_useconds_t
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+#define __NEED_u_int64_t
+#define __NEED_register_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned char u_int8_t;
+typedef unsigned short u_int16_t;
+typedef unsigned u_int32_t;
+typedef char *caddr_t;
+typedef unsigned char u_char;
+typedef unsigned short u_short, ushort;
+typedef unsigned u_int, uint;
+typedef unsigned long u_long, ulong;
+typedef long long quad_t;
+typedef unsigned long long u_quad_t;
+#include <endian.h>
+#include <sys/select.h>
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define blkcnt64_t blkcnt_t
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#define ino64_t ino_t
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/ucontext.h b/musl-include/arm/sys/ucontext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/ucontext.h
@@ -0,0 +1,1 @@
+#include <ucontext.h>
diff --git a/musl-include/arm/sys/uio.h b/musl-include/arm/sys/uio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/uio.h
@@ -0,0 +1,55 @@
+#ifndef _SYS_UIO_H
+#define _SYS_UIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_struct_iovec
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_off_t
+#endif
+
+#ifdef _GNU_SOURCE
+#define __NEED_pid_t
+#endif
+
+#include <bits/alltypes.h>
+
+#define UIO_MAXIOV 1024
+
+ssize_t readv (int, const struct iovec *, int);
+ssize_t writev (int, const struct iovec *, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+ssize_t preadv (int, const struct iovec *, int, off_t);
+ssize_t pwritev (int, const struct iovec *, int, off_t);
+#if defined(_LARGEFILE64_SOURCE)
+#define preadv64 preadv
+#define pwritev64 pwritev
+#define off64_t off_t
+#endif
+#endif
+
+#ifdef _GNU_SOURCE
+ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
+ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
+ssize_t preadv2 (int, const struct iovec *, int, off_t, int);
+ssize_t pwritev2 (int, const struct iovec *, int, off_t, int);
+#define RWF_HIPRI 0x00000001
+#define RWF_DSYNC 0x00000002
+#define RWF_SYNC 0x00000004
+#define RWF_NOWAIT 0x00000008
+#define RWF_APPEND 0x00000010
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/un.h b/musl-include/arm/sys/un.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/un.h
@@ -0,0 +1,31 @@
+#ifndef	_SYS_UN_H
+#define	_SYS_UN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_sa_family_t
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+struct sockaddr_un {
+	sa_family_t sun_family;
+	char sun_path[108];
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+size_t strlen(const char *);
+#define SUN_LEN(s) (2+strlen((s)->sun_path))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/user.h b/musl-include/arm/sys/user.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/user.h
@@ -0,0 +1,16 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <limits.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include <bits/user.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/utsname.h b/musl-include/arm/sys/utsname.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/utsname.h
@@ -0,0 +1,29 @@
+#ifndef	_SYS_UTSNAME_H
+#define	_SYS_UTSNAME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+struct utsname {
+	char sysname[65];
+	char nodename[65];
+	char release[65];
+	char version[65];
+	char machine[65];
+#ifdef _GNU_SOURCE
+	char domainname[65];
+#else
+	char __domainname[65];
+#endif
+};
+
+int uname (struct utsname *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/sys/vfs.h b/musl-include/arm/sys/vfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/vfs.h
@@ -0,0 +1,1 @@
+#include <sys/statfs.h>
diff --git a/musl-include/arm/sys/vt.h b/musl-include/arm/sys/vt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/vt.h
@@ -0,0 +1,1 @@
+#include <bits/vt.h>
diff --git a/musl-include/arm/sys/wait.h b/musl-include/arm/sys/wait.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/wait.h
@@ -0,0 +1,67 @@
+#ifndef	_SYS_WAIT_H
+#define	_SYS_WAIT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_id_t
+#include <bits/alltypes.h>
+
+typedef enum {
+	P_ALL = 0,
+	P_PID = 1,
+	P_PGID = 2,
+	P_PIDFD = 3
+} idtype_t;
+
+pid_t wait (int *);
+pid_t waitpid (pid_t, int *, int );
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#include <signal.h>
+int waitid (idtype_t, id_t, siginfo_t *, int);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#include <sys/resource.h>
+pid_t wait3 (int *, int, struct rusage *);
+pid_t wait4 (pid_t, int *, int, struct rusage *);
+#endif
+
+#define WNOHANG    1
+#define WUNTRACED  2
+
+#define WSTOPPED   2
+#define WEXITED    4
+#define WCONTINUED 8
+#define WNOWAIT    0x1000000
+
+#define __WNOTHREAD 0x20000000
+#define __WALL      0x40000000
+#define __WCLONE    0x80000000
+
+#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
+#define WTERMSIG(s) ((s) & 0x7f)
+#define WSTOPSIG(s) WEXITSTATUS(s)
+#define WCOREDUMP(s) ((s) & 0x80)
+#define WIFEXITED(s) (!WTERMSIG(s))
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
+#define WIFCONTINUED(s) ((s) == 0xffff)
+
+#if _REDIR_TIME64
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(wait3, __wait3_time64);
+__REDIR(wait4, __wait4_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/sys/xattr.h b/musl-include/arm/sys/xattr.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sys/xattr.h
@@ -0,0 +1,32 @@
+#ifndef	_SYS_XATTR_H
+#define	_SYS_XATTR_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_ssize_t
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+#define XATTR_CREATE 1
+#define XATTR_REPLACE 2
+
+ssize_t getxattr(const char *, const char *, void *, size_t);
+ssize_t lgetxattr(const char *, const char *, void *, size_t);
+ssize_t fgetxattr(int, const char *, void *, size_t);
+ssize_t listxattr(const char *, char *, size_t);
+ssize_t llistxattr(const char *, char *, size_t);
+ssize_t flistxattr(int, char *, size_t);
+int setxattr(const char *, const char *, const void *, size_t, int);
+int lsetxattr(const char *, const char *, const void *, size_t, int);
+int fsetxattr(int, const char *, const void *, size_t, int);
+int removexattr(const char *, const char *);
+int lremovexattr(const char *, const char *);
+int fremovexattr(int, const char *);
+
+#define __UAPI_DEF_XATTR        0
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/syscall.h b/musl-include/arm/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/syscall.h
@@ -0,0 +1,1 @@
+#include <sys/syscall.h>
diff --git a/musl-include/arm/sysexits.h b/musl-include/arm/sysexits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/sysexits.h
@@ -0,0 +1,21 @@
+#ifndef	_SYSEXITS_H
+#define _SYSEXITS_H
+#define EX_OK 0
+#define EX__BASE 64
+#define EX_USAGE 64
+#define EX_DATAERR 65
+#define EX_NOINPUT 66
+#define EX_NOUSER 67
+#define EX_NOHOST 68
+#define EX_UNAVAILABLE 69
+#define EX_SOFTWARE 70
+#define EX_OSERR 71
+#define EX_OSFILE 72
+#define EX_CANTCREAT 73
+#define EX_IOERR 74
+#define EX_TEMPFAIL 75
+#define EX_PROTOCOL 76
+#define EX_NOPERM 77
+#define EX_CONFIG 78
+#define EX__MAX 78
+#endif
diff --git a/musl-include/arm/syslog.h b/musl-include/arm/syslog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/syslog.h
@@ -0,0 +1,100 @@
+#ifndef _SYSLOG_H
+#define _SYSLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define LOG_EMERG   0
+#define LOG_ALERT   1
+#define LOG_CRIT    2
+#define LOG_ERR     3
+#define LOG_WARNING 4
+#define LOG_NOTICE  5
+#define LOG_INFO    6
+#define LOG_DEBUG   7
+
+#define LOG_PRIMASK 7
+#define LOG_PRI(p) ((p)&LOG_PRIMASK)
+#define	LOG_MAKEPRI(f, p) (((f)<<3)|(p))
+
+#define LOG_MASK(p) (1<<(p))
+#define LOG_UPTO(p) ((1<<((p)+1))-1)
+
+#define LOG_KERN     (0<<3)
+#define LOG_USER     (1<<3)
+#define LOG_MAIL     (2<<3)
+#define LOG_DAEMON   (3<<3)
+#define LOG_AUTH     (4<<3)
+#define LOG_SYSLOG   (5<<3)
+#define LOG_LPR      (6<<3)
+#define LOG_NEWS     (7<<3)
+#define LOG_UUCP     (8<<3)
+#define LOG_CRON     (9<<3)
+#define	LOG_AUTHPRIV (10<<3)
+#define	LOG_FTP      (11<<3)
+
+#define LOG_LOCAL0   (16<<3)
+#define LOG_LOCAL1   (17<<3)
+#define LOG_LOCAL2   (18<<3)
+#define LOG_LOCAL3   (19<<3)
+#define LOG_LOCAL4   (20<<3)
+#define LOG_LOCAL5   (21<<3)
+#define LOG_LOCAL6   (22<<3)
+#define LOG_LOCAL7   (23<<3)
+
+#define LOG_NFACILITIES 24
+#define LOG_FACMASK 0x3f8
+#define LOG_FAC(p) (((p)&LOG_FACMASK)>>3)
+
+#define LOG_PID    0x01
+#define LOG_CONS   0x02
+#define LOG_ODELAY 0x04
+#define LOG_NDELAY 0x08
+#define LOG_NOWAIT 0x10
+#define LOG_PERROR 0x20
+
+void closelog (void);
+void openlog (const char *, int, int);
+int setlogmask (int);
+void syslog (int, const char *, ...);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define _PATH_LOG "/dev/log"
+#define __NEED_va_list
+#include <bits/alltypes.h>
+void vsyslog (int, const char *, va_list);
+#if defined(SYSLOG_NAMES)
+#define	INTERNAL_NOPRI 0x10
+#define	INTERNAL_MARK (LOG_NFACILITIES<<3)
+typedef struct {
+	char *c_name;
+	int c_val;
+} CODE;
+#define prioritynames ((CODE *)(const CODE []){ \
+	{ "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, \
+	{ "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, \
+	{ "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, \
+	{ "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, \
+	{ "warn", LOG_WARNING }, { "warning", LOG_WARNING }, { 0, -1 } })
+#define facilitynames ((CODE *)(const CODE []){ \
+	{ "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, \
+	{ "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, \
+	{ "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, \
+	{ "mark", INTERNAL_MARK }, { "news", LOG_NEWS }, \
+	{ "security", LOG_AUTH }, { "syslog", LOG_SYSLOG }, \
+	{ "user", LOG_USER }, { "uucp", LOG_UUCP }, \
+	{ "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, \
+	{ "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, \
+	{ "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, \
+	{ "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { 0, -1 } })
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/tar.h b/musl-include/arm/tar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/tar.h
@@ -0,0 +1,33 @@
+#ifndef	_TAR_H
+#define	_TAR_H
+
+#define TSUID   04000
+#define TSGID   02000
+#define TSVTX   01000
+#define TUREAD  00400
+#define TUWRITE 00200
+#define TUEXEC  00100
+#define TGREAD  00040
+#define TGWRITE 00020
+#define TGEXEC  00010
+#define TOREAD  00004
+#define TOWRITE 00002
+#define TOEXEC  00001
+
+#define REGTYPE  '0'
+#define AREGTYPE '\0'
+#define LNKTYPE  '1'
+#define SYMTYPE  '2'
+#define CHRTYPE  '3'
+#define BLKTYPE  '4'
+#define DIRTYPE  '5'
+#define FIFOTYPE '6'
+#define CONTTYPE '7'
+
+#define TMAGIC "ustar"
+#define TMAGLEN 6
+
+#define TVERSION "00"
+#define TVERSLEN 2
+
+#endif
diff --git a/musl-include/arm/termios.h b/musl-include/arm/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/termios.h
@@ -0,0 +1,50 @@
+#ifndef	_TERMIOS_H
+#define	_TERMIOS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_struct_winsize
+
+#include <bits/alltypes.h>
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 32
+
+#include <bits/termios.h>
+
+speed_t cfgetospeed (const struct termios *);
+speed_t cfgetispeed (const struct termios *);
+int cfsetospeed (struct termios *, speed_t);
+int cfsetispeed (struct termios *, speed_t);
+
+int tcgetattr (int, struct termios *);
+int tcsetattr (int, int, const struct termios *);
+
+int tcgetwinsize (int, struct winsize *);
+int tcsetwinsize (int, const struct winsize *);
+
+int tcsendbreak (int, int);
+int tcdrain (int);
+int tcflush (int, int);
+int tcflow (int, int);
+
+pid_t tcgetsid (int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void cfmakeraw(struct termios *);
+int cfsetspeed(struct termios *, speed_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/tgmath.h b/musl-include/arm/tgmath.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/tgmath.h
@@ -0,0 +1,270 @@
+#ifndef _TGMATH_H
+#define _TGMATH_H
+
+/*
+the return types are only correct with gcc (__GNUC__)
+otherwise they are long double or long double complex
+
+the long double version of a function is never chosen when
+sizeof(double) == sizeof(long double)
+(but the return type is set correctly with gcc)
+*/
+
+#include <math.h>
+#include <complex.h>
+
+#define __IS_FP(x) (sizeof((x)+1ULL) == sizeof((x)+1.0f))
+#define __IS_CX(x) (__IS_FP(x) && sizeof(x) == sizeof((x)+I))
+#define __IS_REAL(x) (__IS_FP(x) && 2*sizeof(x) == sizeof((x)+I))
+
+#define __FLT(x) (__IS_REAL(x) && sizeof(x) == sizeof(float))
+#define __LDBL(x) (__IS_REAL(x) && sizeof(x) == sizeof(long double) && sizeof(long double) != sizeof(double))
+
+#define __FLTCX(x) (__IS_CX(x) && sizeof(x) == sizeof(float complex))
+#define __DBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(double complex))
+#define __LDBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(long double complex) && sizeof(long double) != sizeof(double))
+
+/* return type */
+
+#ifdef __GNUC__
+/*
+the result must be casted to the right type
+(otherwise the result type is determined by the conversion
+rules applied to all the function return types so it is long
+double or long double complex except for integral functions)
+
+this cannot be done in c99, so the typeof gcc extension is
+used and that the type of ?: depends on wether an operand is
+a null pointer constant or not
+(in c11 _Generic can be used)
+
+the c arguments below must be integer constant expressions
+so they can be in null pointer constants
+(__IS_FP above was carefully chosen this way)
+*/
+/* if c then t else void */
+#define __type1(c,t) __typeof__(*(0?(t*)0:(void*)!(c)))
+/* if c then t1 else t2 */
+#define __type2(c,t1,t2) __typeof__(*(0?(__type1(c,t1)*)0:(__type1(!(c),t2)*)0))
+/* cast to double when x is integral, otherwise use typeof(x) */
+#define __RETCAST(x) ( \
+	__type2(__IS_FP(x), __typeof__(x), double))
+/* 2 args case, should work for complex types (cpow) */
+#define __RETCAST_2(x, y) ( \
+	__type2(__IS_FP(x) && __IS_FP(y), \
+		__typeof__((x)+(y)), \
+		__typeof__((x)+(y)+1.0)))
+/* 3 args case (fma only) */
+#define __RETCAST_3(x, y, z) ( \
+	__type2(__IS_FP(x) && __IS_FP(y) && __IS_FP(z), \
+		__typeof__((x)+(y)+(z)), \
+		__typeof__((x)+(y)+(z)+1.0)))
+/* drop complex from the type of x */
+/* TODO: wrong when sizeof(long double)==sizeof(double) */
+#define __RETCAST_REAL(x) (  \
+	__type2(__IS_FP(x) && sizeof((x)+I) == sizeof(float complex), float, \
+	__type2(sizeof((x)+1.0+I) == sizeof(double complex), double, \
+		long double)))
+/* add complex to the type of x */
+#define __RETCAST_CX(x) (__typeof__(__RETCAST(x)0+I))
+#else
+#define __RETCAST(x)
+#define __RETCAST_2(x, y)
+#define __RETCAST_3(x, y, z)
+#define __RETCAST_REAL(x)
+#define __RETCAST_CX(x)
+#endif
+
+/* function selection */
+
+#define __tg_real_nocast(fun, x) ( \
+	__FLT(x) ? fun ## f (x) : \
+	__LDBL(x) ? fun ## l (x) : \
+	fun(x) )
+
+#define __tg_real(fun, x) (__RETCAST(x)__tg_real_nocast(fun, x))
+
+#define __tg_real_2_1(fun, x, y) (__RETCAST(x)( \
+	__FLT(x) ? fun ## f (x, y) : \
+	__LDBL(x) ? fun ## l (x, y) : \
+	fun(x, y) ))
+
+#define __tg_real_2(fun, x, y) (__RETCAST_2(x, y)( \
+	__FLT(x) && __FLT(y) ? fun ## f (x, y) : \
+	__LDBL((x)+(y)) ? fun ## l (x, y) : \
+	fun(x, y) ))
+
+#define __tg_complex(fun, x) (__RETCAST_CX(x)( \
+	__FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \
+	__LDBLCX((x)+I) ? fun ## l (x) : \
+	fun(x) ))
+
+#define __tg_complex_retreal(fun, x) (__RETCAST_REAL(x)( \
+	__FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \
+	__LDBLCX((x)+I) ? fun ## l (x) : \
+	fun(x) ))
+
+#define __tg_real_complex(fun, x) (__RETCAST(x)( \
+	__FLTCX(x) ? c ## fun ## f (x) : \
+	__DBLCX(x) ? c ## fun (x) : \
+	__LDBLCX(x) ? c ## fun ## l (x) : \
+	__FLT(x) ? fun ## f (x) : \
+	__LDBL(x) ? fun ## l (x) : \
+	fun(x) ))
+
+/* special cases */
+
+#define __tg_real_remquo(x, y, z) (__RETCAST_2(x, y)( \
+	__FLT(x) && __FLT(y) ? remquof(x, y, z) : \
+	__LDBL((x)+(y)) ? remquol(x, y, z) : \
+	remquo(x, y, z) ))
+
+#define __tg_real_fma(x, y, z) (__RETCAST_3(x, y, z)( \
+	__FLT(x) && __FLT(y) && __FLT(z) ? fmaf(x, y, z) : \
+	__LDBL((x)+(y)+(z)) ? fmal(x, y, z) : \
+	fma(x, y, z) ))
+
+#define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
+	__FLTCX((x)+(y)) && __IS_FP(x) && __IS_FP(y) ? cpowf(x, y) : \
+	__FLTCX((x)+(y)) ? cpow(x, y) : \
+	__DBLCX((x)+(y)) ? cpow(x, y) : \
+	__LDBLCX((x)+(y)) ? cpowl(x, y) : \
+	__FLT(x) && __FLT(y) ? powf(x, y) : \
+	__LDBL((x)+(y)) ? powl(x, y) : \
+	pow(x, y) ))
+
+#define __tg_real_complex_fabs(x) (__RETCAST_REAL(x)( \
+	__FLTCX(x) ? cabsf(x) : \
+	__DBLCX(x) ? cabs(x) : \
+	__LDBLCX(x) ? cabsl(x) : \
+	__FLT(x) ? fabsf(x) : \
+	__LDBL(x) ? fabsl(x) : \
+	fabs(x) ))
+
+/* suppress any macros in math.h or complex.h */
+
+#undef acos
+#undef acosh
+#undef asin
+#undef asinh
+#undef atan
+#undef atan2
+#undef atanh
+#undef carg
+#undef cbrt
+#undef ceil
+#undef cimag
+#undef conj
+#undef copysign
+#undef cos
+#undef cosh
+#undef cproj
+#undef creal
+#undef erf
+#undef erfc
+#undef exp
+#undef exp2
+#undef expm1
+#undef fabs
+#undef fdim
+#undef floor
+#undef fma
+#undef fmax
+#undef fmin
+#undef fmod
+#undef frexp
+#undef hypot
+#undef ilogb
+#undef ldexp
+#undef lgamma
+#undef llrint
+#undef llround
+#undef log
+#undef log10
+#undef log1p
+#undef log2
+#undef logb
+#undef lrint
+#undef lround
+#undef nearbyint
+#undef nextafter
+#undef nexttoward
+#undef pow
+#undef remainder
+#undef remquo
+#undef rint
+#undef round
+#undef scalbln
+#undef scalbn
+#undef sin
+#undef sinh
+#undef sqrt
+#undef tan
+#undef tanh
+#undef tgamma
+#undef trunc
+
+/* tg functions */
+
+#define acos(x)         __tg_real_complex(acos, (x))
+#define acosh(x)        __tg_real_complex(acosh, (x))
+#define asin(x)         __tg_real_complex(asin, (x))
+#define asinh(x)        __tg_real_complex(asinh, (x))
+#define atan(x)         __tg_real_complex(atan, (x))
+#define atan2(x,y)      __tg_real_2(atan2, (x), (y))
+#define atanh(x)        __tg_real_complex(atanh, (x))
+#define carg(x)         __tg_complex_retreal(carg, (x))
+#define cbrt(x)         __tg_real(cbrt, (x))
+#define ceil(x)         __tg_real(ceil, (x))
+#define cimag(x)        __tg_complex_retreal(cimag, (x))
+#define conj(x)         __tg_complex(conj, (x))
+#define copysign(x,y)   __tg_real_2(copysign, (x), (y))
+#define cos(x)          __tg_real_complex(cos, (x))
+#define cosh(x)         __tg_real_complex(cosh, (x))
+#define cproj(x)        __tg_complex(cproj, (x))
+#define creal(x)        __tg_complex_retreal(creal, (x))
+#define erf(x)          __tg_real(erf, (x))
+#define erfc(x)         __tg_real(erfc, (x))
+#define exp(x)          __tg_real_complex(exp, (x))
+#define exp2(x)         __tg_real(exp2, (x))
+#define expm1(x)        __tg_real(expm1, (x))
+#define fabs(x)         __tg_real_complex_fabs(x)
+#define fdim(x,y)       __tg_real_2(fdim, (x), (y))
+#define floor(x)        __tg_real(floor, (x))
+#define fma(x,y,z)      __tg_real_fma((x), (y), (z))
+#define fmax(x,y)       __tg_real_2(fmax, (x), (y))
+#define fmin(x,y)       __tg_real_2(fmin, (x), (y))
+#define fmod(x,y)       __tg_real_2(fmod, (x), (y))
+#define frexp(x,y)      __tg_real_2_1(frexp, (x), (y))
+#define hypot(x,y)      __tg_real_2(hypot, (x), (y))
+#define ilogb(x)        __tg_real_nocast(ilogb, (x))
+#define ldexp(x,y)      __tg_real_2_1(ldexp, (x), (y))
+#define lgamma(x)       __tg_real(lgamma, (x))
+#define llrint(x)       __tg_real_nocast(llrint, (x))
+#define llround(x)      __tg_real_nocast(llround, (x))
+#define log(x)          __tg_real_complex(log, (x))
+#define log10(x)        __tg_real(log10, (x))
+#define log1p(x)        __tg_real(log1p, (x))
+#define log2(x)         __tg_real(log2, (x))
+#define logb(x)         __tg_real(logb, (x))
+#define lrint(x)        __tg_real_nocast(lrint, (x))
+#define lround(x)       __tg_real_nocast(lround, (x))
+#define nearbyint(x)    __tg_real(nearbyint, (x))
+#define nextafter(x,y)  __tg_real_2(nextafter, (x), (y))
+#define nexttoward(x,y) __tg_real_2(nexttoward, (x), (y))
+#define pow(x,y)        __tg_real_complex_pow((x), (y))
+#define remainder(x,y)  __tg_real_2(remainder, (x), (y))
+#define remquo(x,y,z)   __tg_real_remquo((x), (y), (z))
+#define rint(x)         __tg_real(rint, (x))
+#define round(x)        __tg_real(round, (x))
+#define scalbln(x,y)    __tg_real_2_1(scalbln, (x), (y))
+#define scalbn(x,y)     __tg_real_2_1(scalbn, (x), (y))
+#define sin(x)          __tg_real_complex(sin, (x))
+#define sinh(x)         __tg_real_complex(sinh, (x))
+#define sqrt(x)         __tg_real_complex(sqrt, (x))
+#define tan(x)          __tg_real_complex(tan, (x))
+#define tanh(x)         __tg_real_complex(tanh, (x))
+#define tgamma(x)       __tg_real(tgamma, (x))
+#define trunc(x)        __tg_real(trunc, (x))
+
+#endif
diff --git a/musl-include/arm/threads.h b/musl-include/arm/threads.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/threads.h
@@ -0,0 +1,93 @@
+#ifndef _THREADS_H
+#define _THREADS_H
+
+#include <features.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+typedef unsigned long thrd_t;
+#else
+typedef struct __pthread *thrd_t;
+#define thread_local _Thread_local
+#endif
+
+typedef int once_flag;
+typedef unsigned tss_t;
+typedef int (*thrd_start_t)(void *);
+typedef void (*tss_dtor_t)(void *);
+
+#define __NEED_cnd_t
+#define __NEED_mtx_t
+
+#include <bits/alltypes.h>
+
+#define TSS_DTOR_ITERATIONS 4
+
+enum {
+	thrd_success  = 0,
+	thrd_busy     = 1,
+	thrd_error    = 2,
+	thrd_nomem    = 3,
+	thrd_timedout = 4,
+};
+
+enum {
+	mtx_plain     = 0,
+	mtx_recursive = 1,
+	mtx_timed     = 2,
+};
+
+#define ONCE_FLAG_INIT 0
+
+int thrd_create(thrd_t *, thrd_start_t, void *);
+_Noreturn void thrd_exit(int);
+
+int thrd_detach(thrd_t);
+int thrd_join(thrd_t, int *);
+
+int thrd_sleep(const struct timespec *, struct timespec *);
+void thrd_yield(void);
+
+thrd_t thrd_current(void);
+int thrd_equal(thrd_t, thrd_t);
+#ifndef __cplusplus
+#define thrd_equal(A, B) ((A) == (B))
+#endif
+
+void call_once(once_flag *, void (*)(void));
+
+int mtx_init(mtx_t *, int);
+void mtx_destroy(mtx_t *);
+
+int mtx_lock(mtx_t *);
+int mtx_timedlock(mtx_t *__restrict, const struct timespec *__restrict);
+int mtx_trylock(mtx_t *);
+int mtx_unlock(mtx_t *);
+
+int cnd_init(cnd_t *);
+void cnd_destroy(cnd_t *);
+
+int cnd_broadcast(cnd_t *);
+int cnd_signal(cnd_t *);
+
+int cnd_timedwait(cnd_t *__restrict, mtx_t *__restrict, const struct timespec *__restrict);
+int cnd_wait(cnd_t *, mtx_t *);
+
+int tss_create(tss_t *, tss_dtor_t);
+void tss_delete(tss_t);
+
+int tss_set(tss_t, void *);
+void *tss_get(tss_t);
+
+#if _REDIR_TIME64
+__REDIR(thrd_sleep, __thrd_sleep_time64);
+__REDIR(mtx_timedlock, __mtx_timedlock_time64);
+__REDIR(cnd_timedwait, __cnd_timedwait_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/time.h b/musl-include/arm/time.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/time.h
@@ -0,0 +1,168 @@
+#ifndef	_TIME_H
+#define _TIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+
+#define __NEED_size_t
+#define __NEED_time_t
+#define __NEED_clock_t
+#define __NEED_struct_timespec
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_clockid_t
+#define __NEED_timer_t
+#define __NEED_pid_t
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define __tm_gmtoff tm_gmtoff
+#define __tm_zone tm_zone
+#endif
+
+struct tm {
+	int tm_sec;
+	int tm_min;
+	int tm_hour;
+	int tm_mday;
+	int tm_mon;
+	int tm_year;
+	int tm_wday;
+	int tm_yday;
+	int tm_isdst;
+	long __tm_gmtoff;
+	const char *__tm_zone;
+};
+
+clock_t clock (void);
+time_t time (time_t *);
+double difftime (time_t, time_t);
+time_t mktime (struct tm *);
+size_t strftime (char *__restrict, size_t, const char *__restrict, const struct tm *__restrict);
+struct tm *gmtime (const time_t *);
+struct tm *localtime (const time_t *);
+char *asctime (const struct tm *);
+char *ctime (const time_t *);
+int timespec_get(struct timespec *, int);
+
+#define CLOCKS_PER_SEC 1000000L
+
+#define TIME_UTC 1
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+size_t strftime_l (char *  __restrict, size_t, const char *  __restrict, const struct tm *  __restrict, locale_t);
+
+struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict);
+struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict);
+char *asctime_r (const struct tm *__restrict, char *__restrict);
+char *ctime_r (const time_t *, char *);
+
+void tzset (void);
+
+struct itimerspec {
+	struct timespec it_interval;
+	struct timespec it_value;
+};
+
+#define CLOCK_REALTIME           0
+#define CLOCK_MONOTONIC          1
+#define CLOCK_PROCESS_CPUTIME_ID 2
+#define CLOCK_THREAD_CPUTIME_ID  3
+#define CLOCK_MONOTONIC_RAW      4
+#define CLOCK_REALTIME_COARSE    5
+#define CLOCK_MONOTONIC_COARSE   6
+#define CLOCK_BOOTTIME           7
+#define CLOCK_REALTIME_ALARM     8
+#define CLOCK_BOOTTIME_ALARM     9
+#define CLOCK_SGI_CYCLE         10
+#define CLOCK_TAI               11
+
+#define TIMER_ABSTIME 1
+
+int nanosleep (const struct timespec *, struct timespec *);
+int clock_getres (clockid_t, struct timespec *);
+int clock_gettime (clockid_t, struct timespec *);
+int clock_settime (clockid_t, const struct timespec *);
+int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *);
+int clock_getcpuclockid (pid_t, clockid_t *);
+
+struct sigevent;
+int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict);
+int timer_delete (timer_t);
+int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict);
+int timer_gettime (timer_t, struct itimerspec *);
+int timer_getoverrun (timer_t);
+
+extern char *tzname[2];
+
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+char *strptime (const char *__restrict, const char *__restrict, struct tm *__restrict);
+extern int daylight;
+extern long timezone;
+extern int getdate_err;
+struct tm *getdate (const char *);
+#endif
+
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int stime(const time_t *);
+time_t timegm(struct tm *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(time, __time64);
+__REDIR(difftime, __difftime64);
+__REDIR(mktime, __mktime64);
+__REDIR(gmtime, __gmtime64);
+__REDIR(localtime, __localtime64);
+__REDIR(ctime, __ctime64);
+__REDIR(timespec_get, __timespec_get_time64);
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+__REDIR(gmtime_r, __gmtime64_r);
+__REDIR(localtime_r, __localtime64_r);
+__REDIR(ctime_r, __ctime64_r);
+__REDIR(nanosleep, __nanosleep_time64);
+__REDIR(clock_getres, __clock_getres_time64);
+__REDIR(clock_gettime, __clock_gettime64);
+__REDIR(clock_settime, __clock_settime64);
+__REDIR(clock_nanosleep, __clock_nanosleep_time64);
+__REDIR(timer_settime, __timer_settime64);
+__REDIR(timer_gettime, __timer_gettime64);
+#endif
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(stime, __stime64);
+__REDIR(timegm, __timegm_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/musl-include/arm/uchar.h b/musl-include/arm/uchar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/uchar.h
@@ -0,0 +1,29 @@
+#ifndef _UCHAR_H
+#define _UCHAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if __cplusplus < 201103L
+typedef unsigned short char16_t;
+typedef unsigned char32_t;
+#endif
+
+#define __NEED_mbstate_t
+#define __NEED_size_t
+
+#include <features.h>
+#include <bits/alltypes.h>
+
+size_t c16rtomb(char *__restrict, char16_t, mbstate_t *__restrict);
+size_t mbrtoc16(char16_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+
+size_t c32rtomb(char *__restrict, char32_t, mbstate_t *__restrict);
+size_t mbrtoc32(char32_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/ucontext.h b/musl-include/arm/ucontext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/ucontext.h
@@ -0,0 +1,25 @@
+#ifndef _UCONTEXT_H
+#define _UCONTEXT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <signal.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define NGREG (sizeof(gregset_t)/sizeof(greg_t))
+#endif
+
+struct __ucontext;
+
+int  getcontext(struct __ucontext *);
+void makecontext(struct __ucontext *, void (*)(), int, ...);
+int  setcontext(const struct __ucontext *);
+int  swapcontext(struct __ucontext *, const struct __ucontext *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/arm/ulimit.h b/musl-include/arm/ulimit.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/ulimit.h
@@ -0,0 +1,17 @@
+#ifndef _ULIMIT_H
+#define _ULIMIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UL_GETFSIZE 1
+#define UL_SETFSIZE 2
+
+long ulimit (int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/unistd.h b/musl-include/arm/unistd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/unistd.h
@@ -0,0 +1,479 @@
+#ifndef	_UNISTD_H
+#define	_UNISTD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define STDIN_FILENO  0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+#define SEEK_DATA 3
+#define SEEK_HOLE 4
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_intptr_t
+#define __NEED_useconds_t
+
+#include <bits/alltypes.h>
+
+int pipe(int [2]);
+int pipe2(int [2], int);
+int close(int);
+int posix_close(int, int);
+int dup(int);
+int dup2(int, int);
+int dup3(int, int, int);
+off_t lseek(int, off_t, int);
+int fsync(int);
+int fdatasync(int);
+
+ssize_t read(int, void *, size_t);
+ssize_t write(int, const void *, size_t);
+ssize_t pread(int, void *, size_t, off_t);
+ssize_t pwrite(int, const void *, size_t, off_t);
+
+int chown(const char *, uid_t, gid_t);
+int fchown(int, uid_t, gid_t);
+int lchown(const char *, uid_t, gid_t);
+int fchownat(int, const char *, uid_t, gid_t, int);
+
+int link(const char *, const char *);
+int linkat(int, const char *, int, const char *, int);
+int symlink(const char *, const char *);
+int symlinkat(const char *, int, const char *);
+ssize_t readlink(const char *__restrict, char *__restrict, size_t);
+ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t);
+int unlink(const char *);
+int unlinkat(int, const char *, int);
+int rmdir(const char *);
+int truncate(const char *, off_t);
+int ftruncate(int, off_t);
+
+#define F_OK 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+
+int access(const char *, int);
+int faccessat(int, const char *, int, int);
+
+int chdir(const char *);
+int fchdir(int);
+char *getcwd(char *, size_t);
+
+unsigned alarm(unsigned);
+unsigned sleep(unsigned);
+int pause(void);
+
+pid_t fork(void);
+pid_t _Fork(void);
+int execve(const char *, char *const [], char *const []);
+int execv(const char *, char *const []);
+int execle(const char *, const char *, ...);
+int execl(const char *, const char *, ...);
+int execvp(const char *, char *const []);
+int execlp(const char *, const char *, ...);
+int fexecve(int, char *const [], char *const []);
+_Noreturn void _exit(int);
+
+pid_t getpid(void);
+pid_t getppid(void);
+pid_t getpgrp(void);
+pid_t getpgid(pid_t);
+int setpgid(pid_t, pid_t);
+pid_t setsid(void);
+pid_t getsid(pid_t);
+char *ttyname(int);
+int ttyname_r(int, char *, size_t);
+int isatty(int);
+pid_t tcgetpgrp(int);
+int tcsetpgrp(int, pid_t);
+
+uid_t getuid(void);
+uid_t geteuid(void);
+gid_t getgid(void);
+gid_t getegid(void);
+int getgroups(int, gid_t []);
+int setuid(uid_t);
+int seteuid(uid_t);
+int setgid(gid_t);
+int setegid(gid_t);
+
+char *getlogin(void);
+int getlogin_r(char *, size_t);
+int gethostname(char *, size_t);
+char *ctermid(char *);
+
+int getopt(int, char * const [], const char *);
+extern char *optarg;
+extern int optind, opterr, optopt;
+
+long pathconf(const char *, int);
+long fpathconf(int, int);
+long sysconf(int);
+size_t confstr(int, char *, size_t);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define F_ULOCK 0
+#define F_LOCK  1
+#define F_TLOCK 2
+#define F_TEST  3
+int setreuid(uid_t, uid_t);
+int setregid(gid_t, gid_t);
+int lockf(int, int, off_t);
+long gethostid(void);
+int nice(int);
+void sync(void);
+pid_t setpgrp(void);
+char *crypt(const char *, const char *);
+void encrypt(char *, int);
+void swab(const void *__restrict, void *__restrict, ssize_t);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+int usleep(unsigned);
+unsigned ualarm(unsigned, unsigned);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define L_SET 0
+#define L_INCR 1
+#define L_XTND 2
+int brk(void *);
+void *sbrk(intptr_t);
+pid_t vfork(void);
+int vhangup(void);
+int chroot(const char *);
+int getpagesize(void);
+int getdtablesize(void);
+int sethostname(const char *, size_t);
+int getdomainname(char *, size_t);
+int setdomainname(const char *, size_t);
+int setgroups(size_t, const gid_t *);
+char *getpass(const char *);
+int daemon(int, int);
+void setusershell(void);
+void endusershell(void);
+char *getusershell(void);
+int acct(const char *);
+long syscall(long, ...);
+int execvpe(const char *, char *const [], char *const []);
+int issetugid(void);
+int getentropy(void *, size_t);
+extern int optreset;
+#endif
+
+#ifdef _GNU_SOURCE
+extern char **environ;
+int setresuid(uid_t, uid_t, uid_t);
+int setresgid(gid_t, gid_t, gid_t);
+int getresuid(uid_t *, uid_t *, uid_t *);
+int getresgid(gid_t *, gid_t *, gid_t *);
+char *get_current_dir_name(void);
+int syncfs(int);
+int euidaccess(const char *, int);
+int eaccess(const char *, int);
+ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
+pid_t gettid(void);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define lseek64 lseek
+#define pread64 pread
+#define pwrite64 pwrite
+#define truncate64 truncate
+#define ftruncate64 ftruncate
+#define lockf64 lockf
+#define off64_t off_t
+#endif
+
+#define POSIX_CLOSE_RESTART     0
+
+#define _XOPEN_VERSION          700
+#define _XOPEN_UNIX             1
+#define _XOPEN_ENH_I18N         1
+
+#define _POSIX_VERSION          200809L
+#define _POSIX2_VERSION         _POSIX_VERSION
+
+#define _POSIX_ADVISORY_INFO    _POSIX_VERSION
+#define _POSIX_CHOWN_RESTRICTED 1
+#define _POSIX_IPV6             _POSIX_VERSION
+#define _POSIX_JOB_CONTROL      1
+#define _POSIX_MAPPED_FILES     _POSIX_VERSION
+#define _POSIX_MEMLOCK          _POSIX_VERSION
+#define _POSIX_MEMLOCK_RANGE    _POSIX_VERSION
+#define _POSIX_MEMORY_PROTECTION _POSIX_VERSION
+#define _POSIX_MESSAGE_PASSING  _POSIX_VERSION
+#define _POSIX_FSYNC            _POSIX_VERSION
+#define _POSIX_NO_TRUNC         1
+#define _POSIX_RAW_SOCKETS      _POSIX_VERSION
+#define _POSIX_REALTIME_SIGNALS _POSIX_VERSION
+#define _POSIX_REGEXP           1
+#define _POSIX_SAVED_IDS        1
+#define _POSIX_SHELL            1
+#define _POSIX_SPAWN            _POSIX_VERSION
+#define _POSIX_VDISABLE         0
+
+#define _POSIX_THREADS          _POSIX_VERSION
+#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
+#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
+#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
+#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
+#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
+#define _POSIX_THREAD_CPUTIME   _POSIX_VERSION
+#define _POSIX_TIMERS           _POSIX_VERSION
+#define _POSIX_TIMEOUTS         _POSIX_VERSION
+#define _POSIX_MONOTONIC_CLOCK  _POSIX_VERSION
+#define _POSIX_CPUTIME          _POSIX_VERSION
+#define _POSIX_CLOCK_SELECTION  _POSIX_VERSION
+#define _POSIX_BARRIERS         _POSIX_VERSION
+#define _POSIX_SPIN_LOCKS       _POSIX_VERSION
+#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION
+#define _POSIX_ASYNCHRONOUS_IO  _POSIX_VERSION
+#define _POSIX_SEMAPHORES       _POSIX_VERSION
+#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION
+
+#define _POSIX2_C_BIND          _POSIX_VERSION
+
+#include <bits/posix.h>
+
+
+
+#define _PC_LINK_MAX	0
+#define _PC_MAX_CANON	1
+#define _PC_MAX_INPUT	2
+#define _PC_NAME_MAX	3
+#define _PC_PATH_MAX	4
+#define _PC_PIPE_BUF	5
+#define _PC_CHOWN_RESTRICTED	6
+#define _PC_NO_TRUNC	7
+#define _PC_VDISABLE	8
+#define _PC_SYNC_IO	9
+#define _PC_ASYNC_IO	10
+#define _PC_PRIO_IO	11
+#define _PC_SOCK_MAXBUF	12
+#define _PC_FILESIZEBITS	13
+#define _PC_REC_INCR_XFER_SIZE	14
+#define _PC_REC_MAX_XFER_SIZE	15
+#define _PC_REC_MIN_XFER_SIZE	16
+#define _PC_REC_XFER_ALIGN	17
+#define _PC_ALLOC_SIZE_MIN	18
+#define _PC_SYMLINK_MAX	19
+#define _PC_2_SYMLINKS	20
+
+#define _SC_ARG_MAX	0
+#define _SC_CHILD_MAX	1
+#define _SC_CLK_TCK	2
+#define _SC_NGROUPS_MAX	3
+#define _SC_OPEN_MAX	4
+#define _SC_STREAM_MAX	5
+#define _SC_TZNAME_MAX	6
+#define _SC_JOB_CONTROL	7
+#define _SC_SAVED_IDS	8
+#define _SC_REALTIME_SIGNALS	9
+#define _SC_PRIORITY_SCHEDULING	10
+#define _SC_TIMERS	11
+#define _SC_ASYNCHRONOUS_IO	12
+#define _SC_PRIORITIZED_IO	13
+#define _SC_SYNCHRONIZED_IO	14
+#define _SC_FSYNC	15
+#define _SC_MAPPED_FILES	16
+#define _SC_MEMLOCK	17
+#define _SC_MEMLOCK_RANGE	18
+#define _SC_MEMORY_PROTECTION	19
+#define _SC_MESSAGE_PASSING	20
+#define _SC_SEMAPHORES	21
+#define _SC_SHARED_MEMORY_OBJECTS	22
+#define _SC_AIO_LISTIO_MAX	23
+#define _SC_AIO_MAX	24
+#define _SC_AIO_PRIO_DELTA_MAX	25
+#define _SC_DELAYTIMER_MAX	26
+#define _SC_MQ_OPEN_MAX	27
+#define _SC_MQ_PRIO_MAX	28
+#define _SC_VERSION	29
+#define _SC_PAGE_SIZE	30
+#define _SC_PAGESIZE	30 /* !! */
+#define _SC_RTSIG_MAX	31
+#define _SC_SEM_NSEMS_MAX	32
+#define _SC_SEM_VALUE_MAX	33
+#define _SC_SIGQUEUE_MAX	34
+#define _SC_TIMER_MAX	35
+#define _SC_BC_BASE_MAX	36
+#define _SC_BC_DIM_MAX	37
+#define _SC_BC_SCALE_MAX	38
+#define _SC_BC_STRING_MAX	39
+#define _SC_COLL_WEIGHTS_MAX	40
+#define _SC_EXPR_NEST_MAX	42
+#define _SC_LINE_MAX	43
+#define _SC_RE_DUP_MAX	44
+#define _SC_2_VERSION	46
+#define _SC_2_C_BIND	47
+#define _SC_2_C_DEV	48
+#define _SC_2_FORT_DEV	49
+#define _SC_2_FORT_RUN	50
+#define _SC_2_SW_DEV	51
+#define _SC_2_LOCALEDEF	52
+#define _SC_UIO_MAXIOV	60 /* !! */
+#define _SC_IOV_MAX	60
+#define _SC_THREADS	67
+#define _SC_THREAD_SAFE_FUNCTIONS	68
+#define _SC_GETGR_R_SIZE_MAX	69
+#define _SC_GETPW_R_SIZE_MAX	70
+#define _SC_LOGIN_NAME_MAX	71
+#define _SC_TTY_NAME_MAX	72
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS	73
+#define _SC_THREAD_KEYS_MAX	74
+#define _SC_THREAD_STACK_MIN	75
+#define _SC_THREAD_THREADS_MAX	76
+#define _SC_THREAD_ATTR_STACKADDR	77
+#define _SC_THREAD_ATTR_STACKSIZE	78
+#define _SC_THREAD_PRIORITY_SCHEDULING	79
+#define _SC_THREAD_PRIO_INHERIT	80
+#define _SC_THREAD_PRIO_PROTECT	81
+#define _SC_THREAD_PROCESS_SHARED	82
+#define _SC_NPROCESSORS_CONF	83
+#define _SC_NPROCESSORS_ONLN	84
+#define _SC_PHYS_PAGES	85
+#define _SC_AVPHYS_PAGES	86
+#define _SC_ATEXIT_MAX	87
+#define _SC_PASS_MAX	88
+#define _SC_XOPEN_VERSION	89
+#define _SC_XOPEN_XCU_VERSION	90
+#define _SC_XOPEN_UNIX	91
+#define _SC_XOPEN_CRYPT	92
+#define _SC_XOPEN_ENH_I18N	93
+#define _SC_XOPEN_SHM	94
+#define _SC_2_CHAR_TERM	95
+#define _SC_2_UPE	97
+#define _SC_XOPEN_XPG2	98
+#define _SC_XOPEN_XPG3	99
+#define _SC_XOPEN_XPG4	100
+#define _SC_NZERO	109
+#define _SC_XBS5_ILP32_OFF32	125
+#define _SC_XBS5_ILP32_OFFBIG	126
+#define _SC_XBS5_LP64_OFF64	127
+#define _SC_XBS5_LPBIG_OFFBIG	128
+#define _SC_XOPEN_LEGACY	129
+#define _SC_XOPEN_REALTIME	130
+#define _SC_XOPEN_REALTIME_THREADS	131
+#define _SC_ADVISORY_INFO	132
+#define _SC_BARRIERS	133
+#define _SC_CLOCK_SELECTION	137
+#define _SC_CPUTIME	138
+#define _SC_THREAD_CPUTIME	139
+#define _SC_MONOTONIC_CLOCK	149
+#define _SC_READER_WRITER_LOCKS	153
+#define _SC_SPIN_LOCKS	154
+#define _SC_REGEXP	155
+#define _SC_SHELL	157
+#define _SC_SPAWN	159
+#define _SC_SPORADIC_SERVER	160
+#define _SC_THREAD_SPORADIC_SERVER	161
+#define _SC_TIMEOUTS	164
+#define _SC_TYPED_MEMORY_OBJECTS	165
+#define _SC_2_PBS	168
+#define _SC_2_PBS_ACCOUNTING	169
+#define _SC_2_PBS_LOCATE	170
+#define _SC_2_PBS_MESSAGE	171
+#define _SC_2_PBS_TRACK	172
+#define _SC_SYMLOOP_MAX	173
+#define _SC_STREAMS	174
+#define _SC_2_PBS_CHECKPOINT	175
+#define _SC_V6_ILP32_OFF32	176
+#define _SC_V6_ILP32_OFFBIG	177
+#define _SC_V6_LP64_OFF64	178
+#define _SC_V6_LPBIG_OFFBIG	179
+#define _SC_HOST_NAME_MAX	180
+#define _SC_TRACE	181
+#define _SC_TRACE_EVENT_FILTER	182
+#define _SC_TRACE_INHERIT	183
+#define _SC_TRACE_LOG	184
+
+#define _SC_IPV6	235
+#define _SC_RAW_SOCKETS	236
+#define _SC_V7_ILP32_OFF32	237
+#define _SC_V7_ILP32_OFFBIG	238
+#define _SC_V7_LP64_OFF64	239
+#define _SC_V7_LPBIG_OFFBIG	240
+#define _SC_SS_REPL_MAX	241
+#define _SC_TRACE_EVENT_NAME_MAX	242
+#define _SC_TRACE_NAME_MAX	243
+#define _SC_TRACE_SYS_MAX	244
+#define _SC_TRACE_USER_EVENT_MAX	245
+#define _SC_XOPEN_STREAMS	246
+#define _SC_THREAD_ROBUST_PRIO_INHERIT	247
+#define _SC_THREAD_ROBUST_PRIO_PROTECT	248
+#define _SC_MINSIGSTKSZ	249
+#define _SC_SIGSTKSZ	250
+
+#define _CS_PATH	0
+#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS	1
+#define _CS_GNU_LIBC_VERSION	2
+#define _CS_GNU_LIBPTHREAD_VERSION	3
+#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS	4
+#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS	5
+
+#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS	1116
+#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS	1117
+#define _CS_POSIX_V6_ILP32_OFF32_LIBS	1118
+#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS	1119
+#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS	1120
+#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS	1121
+#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS	1122
+#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS	1123
+#define _CS_POSIX_V6_LP64_OFF64_CFLAGS	1124
+#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS	1125
+#define _CS_POSIX_V6_LP64_OFF64_LIBS	1126
+#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS	1127
+#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS	1128
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS	1129
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS	1130
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS	1131
+#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS	1132
+#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS	1133
+#define _CS_POSIX_V7_ILP32_OFF32_LIBS	1134
+#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS	1135
+#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS	1136
+#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS	1137
+#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS	1138
+#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS	1139
+#define _CS_POSIX_V7_LP64_OFF64_CFLAGS	1140
+#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS	1141
+#define _CS_POSIX_V7_LP64_OFF64_LIBS	1142
+#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS	1143
+#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS	1144
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS	1145
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS	1146
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS	1147
+#define _CS_V6_ENV	1148
+#define _CS_V7_ENV	1149
+#define _CS_POSIX_V7_THREADS_CFLAGS	1150
+#define _CS_POSIX_V7_THREADS_LDFLAGS	1151
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/utime.h b/musl-include/arm/utime.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/utime.h
@@ -0,0 +1,29 @@
+#ifndef	_UTIME_H
+#define	_UTIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+
+#include <bits/alltypes.h>
+
+struct utimbuf {
+	time_t actime;
+	time_t modtime;
+};
+
+int utime (const char *, const struct utimbuf *);
+
+#if _REDIR_TIME64
+__REDIR(utime, __utime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/utmp.h b/musl-include/arm/utmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/utmp.h
@@ -0,0 +1,52 @@
+#ifndef _UTMP_H
+#define _UTMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <utmpx.h>
+
+#define ACCOUNTING 9
+#define UT_NAMESIZE 32
+#define UT_HOSTSIZE 256
+#define UT_LINESIZE 32
+
+struct lastlog {
+	time_t ll_time;
+	char ll_line[UT_LINESIZE];
+	char ll_host[UT_HOSTSIZE];
+};
+
+#define ut_time ut_tv.tv_sec
+#define ut_name ut_user
+#define ut_addr ut_addr_v6[0]
+#define utmp utmpx
+#define e_exit __e_exit
+#define e_termination __e_termination
+
+void         endutent(void);
+struct utmp *getutent(void);
+struct utmp *getutid(const struct utmp *);
+struct utmp *getutline(const struct utmp *);
+struct utmp *pututline(const struct utmp *);
+void         setutent(void);
+
+void updwtmp(const char *, const struct utmp *);
+int utmpname(const char *);
+
+int login_tty(int);
+
+#define _PATH_UTMP "/dev/null/utmp"
+#define _PATH_WTMP "/dev/null/wtmp"
+
+#define UTMP_FILE _PATH_UTMP
+#define WTMP_FILE _PATH_WTMP
+#define UTMP_FILENAME _PATH_UTMP
+#define WTMP_FILENAME _PATH_WTMP
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/utmpx.h b/musl-include/arm/utmpx.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/utmpx.h
@@ -0,0 +1,67 @@
+#ifndef _UTMPX_H
+#define _UTMPX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_struct_timeval
+
+#include <bits/alltypes.h>
+
+struct utmpx {
+	short ut_type;
+	short __ut_pad1;
+	pid_t ut_pid;
+	char ut_line[32];
+	char ut_id[4];
+	char ut_user[32];
+	char ut_host[256];
+	struct {
+		short __e_termination;
+		short __e_exit;
+	} ut_exit;
+#if __BYTE_ORDER == 1234
+	int ut_session, __ut_pad2;
+#else
+	int __ut_pad2, ut_session;
+#endif
+	struct timeval ut_tv;
+	unsigned ut_addr_v6[4];
+	char __unused[20];
+};
+
+void          endutxent(void);
+struct utmpx *getutxent(void);
+struct utmpx *getutxid(const struct utmpx *);
+struct utmpx *getutxline(const struct utmpx *);
+struct utmpx *pututxline(const struct utmpx *);
+void          setutxent(void);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define e_exit __e_exit
+#define e_termination __e_termination
+void updwtmpx(const char *, const struct utmpx *);
+int utmpxname(const char *);
+#endif
+
+#define EMPTY           0
+#define RUN_LVL         1
+#define BOOT_TIME       2
+#define NEW_TIME        3
+#define OLD_TIME        4
+#define INIT_PROCESS    5
+#define LOGIN_PROCESS   6
+#define USER_PROCESS    7
+#define DEAD_PROCESS    8
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/values.h b/musl-include/arm/values.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/values.h
@@ -0,0 +1,39 @@
+#ifndef _VALUES_H
+#define _VALUES_H
+
+#include <limits.h>
+
+#define CHARBITS   (sizeof(char)   * 8)
+#define SHORTBITS  (sizeof(short)  * 8)
+#define INTBITS    (sizeof(int)    * 8)
+#define LONGBITS   (sizeof(long)   * 8)
+#define PTRBITS    (sizeof(char *) * 8)
+#define DOUBLEBITS (sizeof(double) * 8)
+#define FLOATBITS  (sizeof(float)  * 8)
+
+#define MINSHORT SHRT_MIN
+#define MININT   INT_MIN
+#define MINLONG  LONG_MIN
+
+#define MAXSHORT SHRT_MAX
+#define MAXINT   INT_MAX
+#define MAXLONG  LONG_MAX
+
+#define HIBITS   MINSHORT
+#define HIBITL   MINLONG
+
+#include <float.h>
+
+#define MAXDOUBLE DBL_MAX
+#undef  MAXFLOAT
+#define MAXFLOAT  FLT_MAX
+#define MINDOUBLE DBL_MIN
+#define MINFLOAT  FLT_MIN
+#define DMINEXP   DBL_MIN_EXP
+#define FMINEXP   FLT_MIN_EXP
+#define DMAXEXP   DBL_MAX_EXP
+#define FMAXEXP   FLT_MAX_EXP
+
+#define BITSPERBYTE CHAR_BIT
+
+#endif
diff --git a/musl-include/arm/wait.h b/musl-include/arm/wait.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/wait.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <wait.h> to <sys/wait.h>
+#include <sys/wait.h>
diff --git a/musl-include/arm/wchar.h b/musl-include/arm/wchar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/wchar.h
@@ -0,0 +1,207 @@
+#ifndef _WCHAR_H
+#define _WCHAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_FILE
+#define __NEED___isoc_va_list
+#define __NEED_size_t
+#define __NEED_wchar_t
+#define __NEED_wint_t
+#define __NEED_mbstate_t
+
+#if __STDC_VERSION__ < 201112L
+#define __NEED_struct__IO_FILE
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#define __NEED_va_list
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_wctype_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#undef WEOF
+#define WEOF 0xffffffffU
+
+wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+int wcscmp (const wchar_t *, const wchar_t *);
+int wcsncmp (const wchar_t *, const wchar_t *, size_t);
+
+int wcscoll(const wchar_t *, const wchar_t *);
+size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+wchar_t *wcschr (const wchar_t *, wchar_t);
+wchar_t *wcsrchr (const wchar_t *, wchar_t);
+
+size_t wcscspn (const wchar_t *, const wchar_t *);
+size_t wcsspn (const wchar_t *, const wchar_t *);
+wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
+
+wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
+
+size_t wcslen (const wchar_t *);
+
+wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcswcs (const wchar_t *, const wchar_t *);
+
+wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
+int wmemcmp (const wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemset (wchar_t *, wchar_t, size_t);
+
+wint_t btowc (int);
+int wctob (wint_t);
+
+int mbsinit (const mbstate_t *);
+size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
+
+size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
+
+size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
+size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
+
+float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
+double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
+long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
+
+long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
+
+long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
+
+
+
+int fwide (FILE *, int);
+
+
+int wprintf (const wchar_t *__restrict, ...);
+int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
+
+int vwprintf (const wchar_t *__restrict, __isoc_va_list);
+int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
+int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
+
+int wscanf (const wchar_t *__restrict, ...);
+int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
+
+int vwscanf (const wchar_t *__restrict, __isoc_va_list);
+int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
+int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
+
+wint_t fgetwc (FILE *);
+wint_t getwc (FILE *);
+wint_t getwchar (void);
+
+wint_t fputwc (wchar_t, FILE *);
+wint_t putwc (wchar_t, FILE *);
+wint_t putwchar (wchar_t);
+
+wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
+int fputws (const wchar_t *__restrict, FILE *__restrict);
+
+wint_t ungetwc (wint_t, FILE *);
+
+struct tm;
+size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
+
+#undef iswdigit
+
+#if defined(_GNU_SOURCE)
+wint_t fgetwc_unlocked (FILE *);
+wint_t getwc_unlocked (FILE *);
+wint_t getwchar_unlocked (void);
+wint_t fputwc_unlocked (wchar_t, FILE *);
+wint_t putwc_unlocked (wchar_t, FILE *);
+wint_t putwchar_unlocked (wchar_t);
+wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict);
+int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t);
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)  || defined(_BSD_SOURCE)
+FILE *open_wmemstream(wchar_t **, size_t *);
+size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
+size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
+wchar_t *wcsdup(const wchar_t *);
+size_t wcsnlen (const wchar_t *, size_t);
+wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+int wcscasecmp(const wchar_t *, const wchar_t *);
+int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
+int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
+int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
+int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
+size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int wcwidth (wchar_t);
+int wcswidth (const wchar_t *, size_t);
+int       iswalnum(wint_t);
+int       iswalpha(wint_t);
+int       iswblank(wint_t);
+int       iswcntrl(wint_t);
+int       iswdigit(wint_t);
+int       iswgraph(wint_t);
+int       iswlower(wint_t);
+int       iswprint(wint_t);
+int       iswpunct(wint_t);
+int       iswspace(wint_t);
+int       iswupper(wint_t);
+int       iswxdigit(wint_t);
+int       iswctype(wint_t, wctype_t);
+wint_t    towlower(wint_t);
+wint_t    towupper(wint_t);
+wctype_t  wctype(const char *);
+
+#ifndef __cplusplus
+#undef iswdigit
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/wctype.h b/musl-include/arm/wctype.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/wctype.h
@@ -0,0 +1,79 @@
+#ifndef _WCTYPE_H
+#define _WCTYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_wint_t
+#define __NEED_wctype_t
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+typedef const int * wctrans_t;
+
+#undef WEOF
+#define WEOF 0xffffffffU
+
+#undef iswdigit
+
+int       iswalnum(wint_t);
+int       iswalpha(wint_t);
+int       iswblank(wint_t);
+int       iswcntrl(wint_t);
+int       iswdigit(wint_t);
+int       iswgraph(wint_t);
+int       iswlower(wint_t);
+int       iswprint(wint_t);
+int       iswpunct(wint_t);
+int       iswspace(wint_t);
+int       iswupper(wint_t);
+int       iswxdigit(wint_t);
+int       iswctype(wint_t, wctype_t);
+wint_t    towctrans(wint_t, wctrans_t);
+wint_t    towlower(wint_t);
+wint_t    towupper(wint_t);
+wctrans_t wctrans(const char *);
+wctype_t  wctype(const char *);
+
+#ifndef __cplusplus
+#undef iswdigit
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+int iswalnum_l(wint_t, locale_t);
+int iswalpha_l(wint_t, locale_t);
+int iswblank_l(wint_t, locale_t);
+int iswcntrl_l(wint_t, locale_t);
+int iswdigit_l(wint_t, locale_t);
+int iswgraph_l(wint_t, locale_t);
+int iswlower_l(wint_t, locale_t);
+int iswprint_l(wint_t, locale_t);
+int iswpunct_l(wint_t, locale_t);
+int iswspace_l(wint_t, locale_t);
+int iswupper_l(wint_t, locale_t);
+int iswxdigit_l(wint_t, locale_t);
+int iswctype_l(wint_t, wctype_t, locale_t);
+wint_t towlower_l(wint_t, locale_t);
+wint_t towupper_l(wint_t, locale_t);
+wint_t towctrans_l(wint_t, wctrans_t, locale_t);
+wctrans_t wctrans_l(const char *, locale_t);
+wctype_t  wctype_l(const char *, locale_t);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/arm/wordexp.h b/musl-include/arm/wordexp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/arm/wordexp.h
@@ -0,0 +1,41 @@
+#ifndef	_WORDEXP_H
+#define	_WORDEXP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#define WRDE_DOOFFS  1
+#define WRDE_APPEND  2
+#define WRDE_NOCMD   4
+#define WRDE_REUSE   8
+#define WRDE_SHOWERR 16
+#define WRDE_UNDEF   32
+
+typedef struct {
+	size_t we_wordc;
+	char **we_wordv;
+	size_t we_offs;
+} wordexp_t;
+
+#define WRDE_NOSYS   -1
+#define WRDE_NOSPACE 1
+#define WRDE_BADCHAR 2
+#define WRDE_BADVAL  3
+#define WRDE_CMDSUB  4
+#define WRDE_SYNTAX  5
+
+int wordexp (const char *__restrict, wordexp_t *__restrict, int);
+void wordfree (wordexp_t *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/aio.h b/musl-include/i386/aio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/aio.h
@@ -0,0 +1,73 @@
+#ifndef _AIO_H
+#define _AIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <signal.h>
+#include <time.h>
+
+#define __NEED_ssize_t
+#define __NEED_off_t
+
+#include <bits/alltypes.h>
+
+struct aiocb {
+	int aio_fildes, aio_lio_opcode, aio_reqprio;
+	volatile void *aio_buf;
+	size_t aio_nbytes;
+	struct sigevent aio_sigevent;
+	void *__td;
+	int __lock[2];
+	volatile int __err;
+	ssize_t __ret;
+	off_t aio_offset;
+	void *__next, *__prev;
+	char __dummy4[32-2*sizeof(void *)];
+};
+
+#define AIO_CANCELED 0
+#define AIO_NOTCANCELED 1
+#define AIO_ALLDONE 2
+
+#define LIO_READ 0
+#define LIO_WRITE 1
+#define LIO_NOP 2
+
+#define LIO_WAIT 0
+#define LIO_NOWAIT 1
+
+int aio_read(struct aiocb *);
+int aio_write(struct aiocb *);
+int aio_error(const struct aiocb *);
+ssize_t aio_return(struct aiocb *);
+int aio_cancel(int, struct aiocb *);
+int aio_suspend(const struct aiocb *const [], int, const struct timespec *);
+int aio_fsync(int, struct aiocb *);
+
+int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define aiocb64 aiocb
+#define aio_read64 aio_read
+#define aio_write64 aio_write
+#define aio_error64 aio_error
+#define aio_return64 aio_return
+#define aio_cancel64 aio_cancel
+#define aio_suspend64 aio_suspend
+#define aio_fsync64 aio_fsync
+#define lio_listio64 lio_listio
+#define off64_t off_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(aio_suspend, __aio_suspend_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/alloca.h b/musl-include/i386/alloca.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/alloca.h
@@ -0,0 +1,19 @@
+#ifndef	_ALLOCA_H
+#define	_ALLOCA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	__NEED_size_t
+#include <bits/alltypes.h>
+
+void *alloca(size_t);
+
+#define alloca __builtin_alloca
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/ar.h b/musl-include/i386/ar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/ar.h
@@ -0,0 +1,25 @@
+#ifndef _AR_H
+#define _AR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ARMAG "!<arch>\n"
+#define SARMAG 8
+#define ARFMAG "`\n"
+
+struct ar_hdr {
+	char ar_name[16];
+	char ar_date[12];
+	char ar_uid[6], ar_gid[6];
+	char ar_mode[8];
+	char ar_size[10];
+	char ar_fmag[2];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/arpa/ftp.h b/musl-include/i386/arpa/ftp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/arpa/ftp.h
@@ -0,0 +1,35 @@
+#ifndef _ARPA_FTP_H
+#define _ARPA_FTP_H
+#define PRELIM 1
+#define COMPLETE 2
+#define CONTINUE 3
+#define TRANSIENT 4
+#define ERROR 5
+#define TYPE_A 1
+#define TYPE_E 2
+#define TYPE_I 3
+#define TYPE_L 4
+#define FORM_N 1
+#define FORM_T 2
+#define FORM_C 3
+#define STRU_F 1
+#define STRU_R 2
+#define STRU_P 3
+#define MODE_S 1
+#define MODE_B 2
+#define MODE_C 3
+#define REC_ESC '\377'
+#define REC_EOR '\001'
+#define REC_EOF '\002'
+#define BLK_EOR 0x80
+#define BLK_EOF 0x40
+#define BLK_ERRORS 0x20
+#define BLK_RESTART 0x10
+#define BLK_BYTECOUNT 2
+#ifdef FTP_NAMES
+char *modenames[] =  {"0", "Stream", "Block", "Compressed" };
+char *strunames[] =  {"0", "File", "Record", "Page" };
+char *typenames[] =  {"0", "ASCII", "EBCDIC", "Image", "Local" };
+char *formnames[] =  {"0", "Nonprint", "Telnet", "Carriage-control" };
+#endif
+#endif
diff --git a/musl-include/i386/arpa/inet.h b/musl-include/i386/arpa/inet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/arpa/inet.h
@@ -0,0 +1,31 @@
+#ifndef _ARPA_INET_H
+#define	_ARPA_INET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+
+uint32_t htonl(uint32_t);
+uint16_t htons(uint16_t);
+uint32_t ntohl(uint32_t);
+uint16_t ntohs(uint16_t);
+
+in_addr_t inet_addr (const char *);
+in_addr_t inet_network (const char *);
+char *inet_ntoa (struct in_addr);
+int inet_pton (int, const char *__restrict, void *__restrict);
+const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
+
+int inet_aton (const char *, struct in_addr *);
+struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
+in_addr_t inet_lnaof(struct in_addr);
+in_addr_t inet_netof(struct in_addr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/arpa/nameser.h b/musl-include/i386/arpa/nameser.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/arpa/nameser.h
@@ -0,0 +1,526 @@
+#ifndef _ARPA_NAMESER_H
+#define _ARPA_NAMESER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+#include <stdint.h>
+
+#define __NAMESER	19991006
+#define NS_PACKETSZ	512
+#define NS_MAXDNAME	1025
+#define NS_MAXMSG	65535
+#define NS_MAXCDNAME	255
+#define NS_MAXLABEL	63
+#define NS_HFIXEDSZ	12
+#define NS_QFIXEDSZ	4
+#define NS_RRFIXEDSZ	10
+#define NS_INT32SZ	4
+#define NS_INT16SZ	2
+#define NS_INT8SZ	1
+#define NS_INADDRSZ	4
+#define NS_IN6ADDRSZ	16
+#define NS_CMPRSFLGS	0xc0
+#define NS_DEFAULTPORT	53
+
+typedef enum __ns_sect {
+	ns_s_qd = 0,
+	ns_s_zn = 0,
+	ns_s_an = 1,
+	ns_s_pr = 1,
+	ns_s_ns = 2,
+	ns_s_ud = 2,
+	ns_s_ar = 3,
+	ns_s_max = 4
+} ns_sect;
+
+typedef struct __ns_msg {
+	const unsigned char *_msg, *_eom;
+	uint16_t _id, _flags, _counts[ns_s_max];
+	const unsigned char *_sections[ns_s_max];
+	ns_sect _sect;
+	int _rrnum;
+	const unsigned char *_msg_ptr;
+} ns_msg;
+
+struct _ns_flagdata {  int mask, shift;  };
+extern const struct _ns_flagdata _ns_flagdata[];
+
+#define ns_msg_id(handle) ((handle)._id + 0)
+#define ns_msg_base(handle) ((handle)._msg + 0)
+#define ns_msg_end(handle) ((handle)._eom + 0)
+#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
+#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
+#define ns_msg_getflag(handle, flag) \
+	(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
+
+typedef	struct __ns_rr {
+	char		name[NS_MAXDNAME];
+	uint16_t	type;
+	uint16_t	rr_class;
+	uint32_t	ttl;
+	uint16_t	rdlength;
+	const unsigned char *rdata;
+} ns_rr;
+
+#define ns_rr_name(rr)	(((rr).name[0] != '\0') ? (rr).name : ".")
+#define ns_rr_type(rr)	((ns_type)((rr).type + 0))
+#define ns_rr_class(rr)	((ns_class)((rr).rr_class + 0))
+#define ns_rr_ttl(rr)	((rr).ttl + 0)
+#define ns_rr_rdlen(rr)	((rr).rdlength + 0)
+#define ns_rr_rdata(rr)	((rr).rdata + 0)
+
+typedef enum __ns_flag {
+	ns_f_qr,
+	ns_f_opcode,
+	ns_f_aa,
+	ns_f_tc,
+	ns_f_rd,
+	ns_f_ra,
+	ns_f_z,
+	ns_f_ad,
+	ns_f_cd,
+	ns_f_rcode,
+	ns_f_max
+} ns_flag;
+
+typedef enum __ns_opcode {
+	ns_o_query = 0,
+	ns_o_iquery = 1,
+	ns_o_status = 2,
+	ns_o_notify = 4,
+	ns_o_update = 5,
+	ns_o_max = 6
+} ns_opcode;
+
+typedef	enum __ns_rcode {
+	ns_r_noerror = 0,
+	ns_r_formerr = 1,
+	ns_r_servfail = 2,
+	ns_r_nxdomain = 3,
+	ns_r_notimpl = 4,
+	ns_r_refused = 5,
+	ns_r_yxdomain = 6,
+	ns_r_yxrrset = 7,
+	ns_r_nxrrset = 8,
+	ns_r_notauth = 9,
+	ns_r_notzone = 10,
+	ns_r_max = 11,
+	ns_r_badvers = 16,
+	ns_r_badsig = 16,
+	ns_r_badkey = 17,
+	ns_r_badtime = 18
+} ns_rcode;
+
+typedef enum __ns_update_operation {
+	ns_uop_delete = 0,
+	ns_uop_add = 1,
+	ns_uop_max = 2
+} ns_update_operation;
+
+struct ns_tsig_key {
+        char name[NS_MAXDNAME], alg[NS_MAXDNAME];
+        unsigned char *data;
+        int len;
+};
+typedef struct ns_tsig_key ns_tsig_key;
+
+struct ns_tcp_tsig_state {
+	int counter;
+	struct dst_key *key;
+	void *ctx;
+	unsigned char sig[NS_PACKETSZ];
+	int siglen;
+};
+typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
+
+#define NS_TSIG_FUDGE 300
+#define NS_TSIG_TCP_COUNT 100
+#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
+
+#define NS_TSIG_ERROR_NO_TSIG -10
+#define NS_TSIG_ERROR_NO_SPACE -11
+#define NS_TSIG_ERROR_FORMERR -12
+
+typedef enum __ns_type {
+	ns_t_invalid = 0,
+	ns_t_a = 1,
+	ns_t_ns = 2,
+	ns_t_md = 3,
+	ns_t_mf = 4,
+	ns_t_cname = 5,
+	ns_t_soa = 6,
+	ns_t_mb = 7,
+	ns_t_mg = 8,
+	ns_t_mr = 9,
+	ns_t_null = 10,
+	ns_t_wks = 11,
+	ns_t_ptr = 12,
+	ns_t_hinfo = 13,
+	ns_t_minfo = 14,
+	ns_t_mx = 15,
+	ns_t_txt = 16,
+	ns_t_rp = 17,
+	ns_t_afsdb = 18,
+	ns_t_x25 = 19,
+	ns_t_isdn = 20,
+	ns_t_rt = 21,
+	ns_t_nsap = 22,
+	ns_t_nsap_ptr = 23,
+	ns_t_sig = 24,
+	ns_t_key = 25,
+	ns_t_px = 26,
+	ns_t_gpos = 27,
+	ns_t_aaaa = 28,
+	ns_t_loc = 29,
+	ns_t_nxt = 30,
+	ns_t_eid = 31,
+	ns_t_nimloc = 32,
+	ns_t_srv = 33,
+	ns_t_atma = 34,
+	ns_t_naptr = 35,
+	ns_t_kx = 36,
+	ns_t_cert = 37,
+	ns_t_a6 = 38,
+	ns_t_dname = 39,
+	ns_t_sink = 40,
+	ns_t_opt = 41,
+	ns_t_apl = 42,
+	ns_t_ds = 43,
+	ns_t_sshfp = 44,
+	ns_t_ipseckey = 45,
+	ns_t_rrsig = 46,
+	ns_t_nsec = 47,
+	ns_t_dnskey = 48,
+	ns_t_dhcid = 49,
+	ns_t_nsec3 = 50,
+	ns_t_nsec3param = 51,
+	ns_t_tlsa = 52,
+	ns_t_smimea = 53,
+	ns_t_hip = 55,
+	ns_t_ninfo = 56,
+	ns_t_rkey = 57,
+	ns_t_talink = 58,
+	ns_t_cds = 59,
+	ns_t_cdnskey = 60,
+	ns_t_openpgpkey = 61,
+	ns_t_csync = 62,
+	ns_t_spf = 99,
+	ns_t_uinfo = 100,
+	ns_t_uid = 101,
+	ns_t_gid = 102,
+	ns_t_unspec = 103,
+	ns_t_nid = 104,
+	ns_t_l32 = 105,
+	ns_t_l64 = 106,
+	ns_t_lp = 107,
+	ns_t_eui48 = 108,
+	ns_t_eui64 = 109,
+	ns_t_tkey = 249,
+	ns_t_tsig = 250,
+	ns_t_ixfr = 251,
+	ns_t_axfr = 252,
+	ns_t_mailb = 253,
+	ns_t_maila = 254,
+	ns_t_any = 255,
+	ns_t_zxfr = 256,
+	ns_t_uri = 256,
+	ns_t_caa = 257,
+	ns_t_avc = 258,
+	ns_t_ta = 32768,
+	ns_t_dlv = 32769,
+	ns_t_max = 65536
+} ns_type;
+
+#define	ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
+		      (t) == ns_t_mailb || (t) == ns_t_maila)
+#define	ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
+#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
+#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
+#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
+		       (t) == ns_t_zxfr)
+
+typedef enum __ns_class {
+	ns_c_invalid = 0,
+	ns_c_in = 1,
+	ns_c_2 = 2,
+	ns_c_chaos = 3,
+	ns_c_hs = 4,
+	ns_c_none = 254,
+	ns_c_any = 255,
+	ns_c_max = 65536
+} ns_class;
+
+typedef enum __ns_key_types {
+	ns_kt_rsa = 1,
+	ns_kt_dh  = 2,
+	ns_kt_dsa = 3,
+	ns_kt_private = 254
+} ns_key_types;
+
+typedef enum __ns_cert_types {
+	cert_t_pkix = 1,
+	cert_t_spki = 2,
+	cert_t_pgp  = 3,
+	cert_t_url  = 253,
+	cert_t_oid  = 254
+} ns_cert_types;
+
+#define	NS_KEY_TYPEMASK		0xC000
+#define	NS_KEY_TYPE_AUTH_CONF	0x0000
+#define	NS_KEY_TYPE_CONF_ONLY	0x8000
+#define	NS_KEY_TYPE_AUTH_ONLY	0x4000
+#define	NS_KEY_TYPE_NO_KEY	0xC000
+#define	NS_KEY_NO_AUTH		0x8000
+#define	NS_KEY_NO_CONF		0x4000
+#define	NS_KEY_RESERVED2	0x2000
+#define	NS_KEY_EXTENDED_FLAGS	0x1000
+#define	NS_KEY_RESERVED4	0x0800
+#define	NS_KEY_RESERVED5	0x0400
+#define	NS_KEY_NAME_TYPE	0x0300
+#define	NS_KEY_NAME_USER	0x0000
+#define	NS_KEY_NAME_ENTITY	0x0200
+#define	NS_KEY_NAME_ZONE	0x0100
+#define	NS_KEY_NAME_RESERVED	0x0300
+#define	NS_KEY_RESERVED8	0x0080
+#define	NS_KEY_RESERVED9	0x0040
+#define	NS_KEY_RESERVED10	0x0020
+#define	NS_KEY_RESERVED11	0x0010
+#define	NS_KEY_SIGNATORYMASK	0x000F
+#define	NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
+				  NS_KEY_RESERVED4 | \
+				  NS_KEY_RESERVED5 | \
+				  NS_KEY_RESERVED8 | \
+				  NS_KEY_RESERVED9 | \
+				  NS_KEY_RESERVED10 | \
+				  NS_KEY_RESERVED11 )
+#define NS_KEY_RESERVED_BITMASK2 0xFFFF
+#define	NS_ALG_MD5RSA		1
+#define	NS_ALG_DH               2
+#define	NS_ALG_DSA              3
+#define	NS_ALG_DSS              NS_ALG_DSA
+#define	NS_ALG_EXPIRE_ONLY	253
+#define	NS_ALG_PRIVATE_OID	254
+
+#define NS_KEY_PROT_TLS         1
+#define NS_KEY_PROT_EMAIL       2
+#define NS_KEY_PROT_DNSSEC      3
+#define NS_KEY_PROT_IPSEC       4
+#define NS_KEY_PROT_ANY		255
+
+#define	NS_MD5RSA_MIN_BITS	 512
+#define	NS_MD5RSA_MAX_BITS	4096
+#define	NS_MD5RSA_MAX_BYTES	((NS_MD5RSA_MAX_BITS+7/8)*2+3)
+#define	NS_MD5RSA_MAX_BASE64	(((NS_MD5RSA_MAX_BYTES+2)/3)*4)
+#define NS_MD5RSA_MIN_SIZE	((NS_MD5RSA_MIN_BITS+7)/8)
+#define NS_MD5RSA_MAX_SIZE	((NS_MD5RSA_MAX_BITS+7)/8)
+
+#define NS_DSA_SIG_SIZE         41
+#define NS_DSA_MIN_SIZE         213
+#define NS_DSA_MAX_BYTES        405
+
+#define	NS_SIG_TYPE	0
+#define	NS_SIG_ALG	2
+#define	NS_SIG_LABELS	3
+#define	NS_SIG_OTTL	4
+#define	NS_SIG_EXPIR	8
+#define	NS_SIG_SIGNED	12
+#define	NS_SIG_FOOT	16
+#define	NS_SIG_SIGNER	18
+#define	NS_NXT_BITS 8
+#define	NS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_MAX 127
+
+#define NS_OPT_DNSSEC_OK        0x8000U
+#define NS_OPT_NSID		3
+
+#define NS_GET16(s, cp) (void)((s) = ns_get16(((cp)+=2)-2))
+#define NS_GET32(l, cp) (void)((l) = ns_get32(((cp)+=4)-4))
+#define NS_PUT16(s, cp) ns_put16((s), ((cp)+=2)-2)
+#define NS_PUT32(l, cp) ns_put32((l), ((cp)+=4)-4)
+
+unsigned ns_get16(const unsigned char *);
+unsigned long ns_get32(const unsigned char *);
+void ns_put16(unsigned, unsigned char *);
+void ns_put32(unsigned long, unsigned char *);
+
+int ns_initparse(const unsigned char *, int, ns_msg *);
+int ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
+int ns_skiprr(const unsigned char *, const unsigned char *, ns_sect, int);
+int ns_name_uncompress(const unsigned char *, const unsigned char *, const unsigned char *, char *, size_t);
+
+
+#define	__BIND		19950621
+
+typedef struct {
+	unsigned	id :16;
+#if __BYTE_ORDER == __BIG_ENDIAN
+	unsigned	qr: 1;
+	unsigned	opcode: 4;
+	unsigned	aa: 1;
+	unsigned	tc: 1;
+	unsigned	rd: 1;
+	unsigned	ra: 1;
+	unsigned	unused :1;
+	unsigned	ad: 1;
+	unsigned	cd: 1;
+	unsigned	rcode :4;
+#else
+	unsigned	rd :1;
+	unsigned	tc :1;
+	unsigned	aa :1;
+	unsigned	opcode :4;
+	unsigned	qr :1;
+	unsigned	rcode :4;
+	unsigned	cd: 1;
+	unsigned	ad: 1;
+	unsigned	unused :1;
+	unsigned	ra :1;
+#endif
+	unsigned	qdcount :16;
+	unsigned	ancount :16;
+	unsigned	nscount :16;
+	unsigned	arcount :16;
+} HEADER;
+
+#define PACKETSZ	NS_PACKETSZ
+#define MAXDNAME	NS_MAXDNAME
+#define MAXCDNAME	NS_MAXCDNAME
+#define MAXLABEL	NS_MAXLABEL
+#define	HFIXEDSZ	NS_HFIXEDSZ
+#define QFIXEDSZ	NS_QFIXEDSZ
+#define RRFIXEDSZ	NS_RRFIXEDSZ
+#define	INT32SZ		NS_INT32SZ
+#define	INT16SZ		NS_INT16SZ
+#define INT8SZ		NS_INT8SZ
+#define	INADDRSZ	NS_INADDRSZ
+#define	IN6ADDRSZ	NS_IN6ADDRSZ
+#define	INDIR_MASK	NS_CMPRSFLGS
+#define NAMESERVER_PORT	NS_DEFAULTPORT
+
+#define S_ZONE		ns_s_zn
+#define S_PREREQ	ns_s_pr
+#define S_UPDATE	ns_s_ud
+#define S_ADDT		ns_s_ar
+
+#define QUERY		ns_o_query
+#define IQUERY		ns_o_iquery
+#define STATUS		ns_o_status
+#define	NS_NOTIFY_OP	ns_o_notify
+#define	NS_UPDATE_OP	ns_o_update
+
+#define NOERROR		ns_r_noerror
+#define FORMERR		ns_r_formerr
+#define SERVFAIL	ns_r_servfail
+#define NXDOMAIN	ns_r_nxdomain
+#define NOTIMP		ns_r_notimpl
+#define REFUSED		ns_r_refused
+#define YXDOMAIN	ns_r_yxdomain
+#define YXRRSET		ns_r_yxrrset
+#define NXRRSET		ns_r_nxrrset
+#define NOTAUTH		ns_r_notauth
+#define NOTZONE		ns_r_notzone
+
+#define DELETE		ns_uop_delete
+#define ADD		ns_uop_add
+
+#define T_A		ns_t_a
+#define T_NS		ns_t_ns
+#define T_MD		ns_t_md
+#define T_MF		ns_t_mf
+#define T_CNAME		ns_t_cname
+#define T_SOA		ns_t_soa
+#define T_MB		ns_t_mb
+#define T_MG		ns_t_mg
+#define T_MR		ns_t_mr
+#define T_NULL		ns_t_null
+#define T_WKS		ns_t_wks
+#define T_PTR		ns_t_ptr
+#define T_HINFO		ns_t_hinfo
+#define T_MINFO		ns_t_minfo
+#define T_MX		ns_t_mx
+#define T_TXT		ns_t_txt
+#define	T_RP		ns_t_rp
+#define T_AFSDB		ns_t_afsdb
+#define T_X25		ns_t_x25
+#define T_ISDN		ns_t_isdn
+#define T_RT		ns_t_rt
+#define T_NSAP		ns_t_nsap
+#define T_NSAP_PTR	ns_t_nsap_ptr
+#define	T_SIG		ns_t_sig
+#define	T_KEY		ns_t_key
+#define	T_PX		ns_t_px
+#define	T_GPOS		ns_t_gpos
+#define	T_AAAA		ns_t_aaaa
+#define	T_LOC		ns_t_loc
+#define	T_NXT		ns_t_nxt
+#define	T_EID		ns_t_eid
+#define	T_NIMLOC	ns_t_nimloc
+#define	T_SRV		ns_t_srv
+#define T_ATMA		ns_t_atma
+#define T_NAPTR		ns_t_naptr
+#define T_A6		ns_t_a6
+#define T_DNAME		ns_t_dname
+#define T_DS		ns_t_ds
+#define T_SSHFP		ns_t_sshfp
+#define T_IPSECKEY	ns_t_ipseckey
+#define T_RRSIG		ns_t_rrsig
+#define T_NSEC		ns_t_nsec
+#define T_DNSKEY	ns_t_dnskey
+#define T_DHCID		ns_t_dhcid
+#define T_NSEC3		ns_t_nsec3
+#define T_NSEC3PARAM	ns_t_nsec3param
+#define T_TLSA		ns_t_tlsa
+#define T_SMIMEA	ns_t_smimea
+#define T_HIP		ns_t_hip
+#define T_NINFO		ns_t_ninfo
+#define T_RKEY		ns_t_rkey
+#define T_TALINK	ns_t_talink
+#define T_CDS		ns_t_cds
+#define T_CDNSKEY	ns_t_cdnskey
+#define T_OPENPGPKEY	ns_t_openpgpkey
+#define T_CSYNC		ns_t_csync
+#define T_SPF		ns_t_spf
+#define T_UINFO		ns_t_uinfo
+#define T_UID		ns_t_uid
+#define T_GID		ns_t_gid
+#define T_UNSPEC	ns_t_unspec
+#define T_NID		ns_t_nid
+#define T_L32		ns_t_l32
+#define T_L64		ns_t_l64
+#define T_LP		ns_t_lp
+#define T_EUI48		ns_t_eui48
+#define T_EUI64		ns_t_eui64
+#define T_TKEY		ns_t_tkey
+#define	T_TSIG		ns_t_tsig
+#define	T_IXFR		ns_t_ixfr
+#define T_AXFR		ns_t_axfr
+#define T_MAILB		ns_t_mailb
+#define T_MAILA		ns_t_maila
+#define T_ANY		ns_t_any
+#define T_URI		ns_t_uri
+#define T_CAA		ns_t_caa
+#define T_AVC		ns_t_avc
+#define T_TA		ns_t_ta
+#define T_DLV		ns_t_dlv
+
+#define C_IN		ns_c_in
+#define C_CHAOS		ns_c_chaos
+#define C_HS		ns_c_hs
+#define C_NONE		ns_c_none
+#define C_ANY		ns_c_any
+
+#define	GETSHORT		NS_GET16
+#define	GETLONG			NS_GET32
+#define	PUTSHORT		NS_PUT16
+#define	PUTLONG			NS_PUT32
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/arpa/nameser_compat.h b/musl-include/i386/arpa/nameser_compat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/arpa/nameser_compat.h
@@ -0,0 +1,2 @@
+#include <arpa/nameser.h>
+
diff --git a/musl-include/i386/arpa/telnet.h b/musl-include/i386/arpa/telnet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/arpa/telnet.h
@@ -0,0 +1,251 @@
+#ifndef _ARPA_TELNET_H
+#define	_ARPA_TELNET_H
+
+#define	IAC	255
+#define	DONT	254
+#define	DO	253
+#define	WONT	252
+#define	WILL	251
+#define	SB	250
+#define	GA	249
+#define	EL	248
+#define	EC	247
+#define	AYT	246
+#define	AO	245
+#define	IP	244
+#define	BREAK	243
+#define	DM	242
+#define	NOP	241
+#define	SE	240
+#define EOR     239
+#define	ABORT	238
+#define	SUSP	237
+#define	xEOF	236
+
+#define SYNCH	242
+
+#define telcmds ((char [][6]){ "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0 })
+
+#define	TELCMD_FIRST	xEOF
+#define	TELCMD_LAST	IAC
+#define	TELCMD_OK(x)	((unsigned int)(x) <= TELCMD_LAST && \
+			 (unsigned int)(x) >= TELCMD_FIRST)
+#define	TELCMD(x)	telcmds[(x)-TELCMD_FIRST]
+
+#define TELOPT_BINARY	0
+#define TELOPT_ECHO	1
+#define	TELOPT_RCP	2
+#define	TELOPT_SGA	3
+#define	TELOPT_NAMS	4
+#define	TELOPT_STATUS	5
+#define	TELOPT_TM	6
+#define	TELOPT_RCTE	7
+#define TELOPT_NAOL 	8
+#define TELOPT_NAOP 	9
+#define TELOPT_NAOCRD	10
+#define TELOPT_NAOHTS	11
+#define TELOPT_NAOHTD	12
+#define TELOPT_NAOFFD	13
+#define TELOPT_NAOVTS	14
+#define TELOPT_NAOVTD	15
+#define TELOPT_NAOLFD	16
+#define TELOPT_XASCII	17
+#define	TELOPT_LOGOUT	18
+#define	TELOPT_BM	19
+#define	TELOPT_DET	20
+#define	TELOPT_SUPDUP	21
+#define	TELOPT_SUPDUPOUTPUT 22
+#define	TELOPT_SNDLOC	23
+#define	TELOPT_TTYPE	24
+#define	TELOPT_EOR	25
+#define	TELOPT_TUID	26
+#define	TELOPT_OUTMRK	27
+#define	TELOPT_TTYLOC	28
+#define	TELOPT_3270REGIME 29
+#define	TELOPT_X3PAD	30
+#define	TELOPT_NAWS	31
+#define	TELOPT_TSPEED	32
+#define	TELOPT_LFLOW	33
+#define TELOPT_LINEMODE	34
+#define TELOPT_XDISPLOC	35
+#define TELOPT_OLD_ENVIRON 36
+#define	TELOPT_AUTHENTICATION 37/* Authenticate */
+#define	TELOPT_ENCRYPT	38
+#define TELOPT_NEW_ENVIRON 39
+#define	TELOPT_EXOPL	255
+
+
+#define	NTELOPTS	(1+TELOPT_NEW_ENVIRON)
+#ifdef TELOPTS
+char *telopts[NTELOPTS+1] = {
+	"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
+	"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
+	"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
+	"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
+	"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
+	"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
+	"TACACS UID", "OUTPUT MARKING", "TTYLOC",
+	"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
+	"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
+	"ENCRYPT", "NEW-ENVIRON",
+	0,
+};
+#define	TELOPT_FIRST	TELOPT_BINARY
+#define	TELOPT_LAST	TELOPT_NEW_ENVIRON
+#define	TELOPT_OK(x)	((unsigned int)(x) <= TELOPT_LAST)
+#define	TELOPT(x)	telopts[(x)-TELOPT_FIRST]
+#endif
+
+#define	TELQUAL_IS	0
+#define	TELQUAL_SEND	1
+#define	TELQUAL_INFO	2
+#define	TELQUAL_REPLY	2
+#define	TELQUAL_NAME	3
+
+#define	LFLOW_OFF		0
+#define	LFLOW_ON		1
+#define	LFLOW_RESTART_ANY	2
+#define	LFLOW_RESTART_XON	3
+
+
+#define	LM_MODE		1
+#define	LM_FORWARDMASK	2
+#define	LM_SLC		3
+
+#define	MODE_EDIT	0x01
+#define	MODE_TRAPSIG	0x02
+#define	MODE_ACK	0x04
+#define MODE_SOFT_TAB	0x08
+#define MODE_LIT_ECHO	0x10
+
+#define	MODE_MASK	0x1f
+
+#define MODE_FLOW		0x0100
+#define MODE_ECHO		0x0200
+#define MODE_INBIN		0x0400
+#define MODE_OUTBIN		0x0800
+#define MODE_FORCE		0x1000
+
+#define	SLC_SYNCH	1
+#define	SLC_BRK		2
+#define	SLC_IP		3
+#define	SLC_AO		4
+#define	SLC_AYT		5
+#define	SLC_EOR		6
+#define	SLC_ABORT	7
+#define	SLC_EOF		8
+#define	SLC_SUSP	9
+#define	SLC_EC		10
+#define	SLC_EL		11
+#define	SLC_EW		12
+#define	SLC_RP		13
+#define	SLC_LNEXT	14
+#define	SLC_XON		15
+#define	SLC_XOFF	16
+#define	SLC_FORW1	17
+#define	SLC_FORW2	18
+
+#define	NSLC		18
+
+#define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
+			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
+			"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
+#ifdef	SLC_NAMES
+char *slc_names[] = {
+	SLC_NAMELIST
+};
+#else
+extern char *slc_names[];
+#define	SLC_NAMES SLC_NAMELIST
+#endif
+
+#define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)
+#define SLC_NAME(x)	slc_names[x]
+
+#define	SLC_NOSUPPORT	0
+#define	SLC_CANTCHANGE	1
+#define	SLC_VARIABLE	2
+#define	SLC_DEFAULT	3
+#define	SLC_LEVELBITS	0x03
+
+#define	SLC_FUNC	0
+#define	SLC_FLAGS	1
+#define	SLC_VALUE	2
+
+#define	SLC_ACK		0x80
+#define	SLC_FLUSHIN	0x40
+#define	SLC_FLUSHOUT	0x20
+
+#define	OLD_ENV_VAR	1
+#define	OLD_ENV_VALUE	0
+#define	NEW_ENV_VAR	0
+#define	NEW_ENV_VALUE	1
+#define	ENV_ESC		2
+#define ENV_USERVAR	3
+
+#define	AUTH_WHO_CLIENT		0
+#define	AUTH_WHO_SERVER		1
+#define	AUTH_WHO_MASK		1
+
+#define	AUTH_HOW_ONE_WAY	0
+#define	AUTH_HOW_MUTUAL		2
+#define	AUTH_HOW_MASK		2
+
+#define	AUTHTYPE_NULL		0
+#define	AUTHTYPE_KERBEROS_V4	1
+#define	AUTHTYPE_KERBEROS_V5	2
+#define	AUTHTYPE_SPX		3
+#define	AUTHTYPE_MINK		4
+#define	AUTHTYPE_CNT		5
+
+#define	AUTHTYPE_TEST		99
+
+#ifdef	AUTH_NAMES
+char *authtype_names[] = {
+	"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
+};
+#else
+extern char *authtype_names[];
+#endif
+
+#define	AUTHTYPE_NAME_OK(x)	((unsigned int)(x) < AUTHTYPE_CNT)
+#define	AUTHTYPE_NAME(x)	authtype_names[x]
+
+#define	ENCRYPT_IS		0
+#define	ENCRYPT_SUPPORT		1
+#define	ENCRYPT_REPLY		2
+#define	ENCRYPT_START		3
+#define	ENCRYPT_END		4
+#define	ENCRYPT_REQSTART	5
+#define	ENCRYPT_REQEND		6
+#define	ENCRYPT_ENC_KEYID	7
+#define	ENCRYPT_DEC_KEYID	8
+#define	ENCRYPT_CNT		9
+
+#define	ENCTYPE_ANY		0
+#define	ENCTYPE_DES_CFB64	1
+#define	ENCTYPE_DES_OFB64	2
+#define	ENCTYPE_CNT		3
+
+#ifdef	ENCRYPT_NAMES
+char *encrypt_names[] = {
+	"IS", "SUPPORT", "REPLY", "START", "END",
+	"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
+	0,
+};
+char *enctype_names[] = {
+	"ANY", "DES_CFB64",  "DES_OFB64",  0,
+};
+#else
+extern char *encrypt_names[];
+extern char *enctype_names[];
+#endif
+
+
+#define	ENCRYPT_NAME_OK(x)	((unsigned int)(x) < ENCRYPT_CNT)
+#define	ENCRYPT_NAME(x)		encrypt_names[x]
+
+#define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
+#define	ENCTYPE_NAME(x)		enctype_names[x]
+
+#endif
diff --git a/musl-include/i386/arpa/tftp.h b/musl-include/i386/arpa/tftp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/arpa/tftp.h
@@ -0,0 +1,31 @@
+#ifndef _ARPA_TFTP_H
+#define _ARPA_TFTP_H
+#define SEGSIZE 512
+#define RRQ 01
+#define WRQ 02
+#define DATA 03
+#define ACK 04
+#define ERROR 05
+struct tftphdr {
+	short th_opcode;
+	union {
+		unsigned short tu_block;
+		short tu_code;
+		char tu_stuff[1];
+	} th_u;
+	char th_data[1];
+};
+#define th_block th_u.tu_block
+#define th_code th_u.tu_code
+#define th_stuff th_u.tu_stuff
+#define th_msg th_data
+#define EUNDEF 0
+#define ENOTFOUND 1
+#define EACCESS 2
+#define ENOSPACE 3
+#define EBADOP 4
+#define EBADID 5
+#define EEXISTS 6
+#define ENOUSER 7
+#endif
+
diff --git a/musl-include/i386/assert.h b/musl-include/i386/assert.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/assert.h
@@ -0,0 +1,23 @@
+#include <features.h>
+
+#undef assert
+
+#ifdef NDEBUG
+#define	assert(x) (void)0
+#else
+#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
+#endif
+
+#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
+#define static_assert _Static_assert
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_Noreturn void __assert_fail (const char *, const char *, int, const char *);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/musl-include/i386/bits/alltypes.h b/musl-include/i386/bits/alltypes.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/alltypes.h
@@ -0,0 +1,438 @@
+#define _REDIR_TIME64 1
+#define _Addr int
+#define _Int64 long long
+#define _Reg int
+
+#define __BYTE_ORDER 1234
+#define __LONG_MAX 0x7fffffffL
+
+#ifndef __cplusplus
+#ifdef __WCHAR_TYPE__
+#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
+typedef __WCHAR_TYPE__ wchar_t;
+#define __DEFINED_wchar_t
+#endif
+
+#else
+#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
+typedef long wchar_t;
+#define __DEFINED_wchar_t
+#endif
+
+#endif
+#endif
+
+#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 0
+#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
+typedef float float_t;
+#define __DEFINED_float_t
+#endif
+
+#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
+typedef double double_t;
+#define __DEFINED_double_t
+#endif
+
+#else
+#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
+typedef long double float_t;
+#define __DEFINED_float_t
+#endif
+
+#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
+typedef long double double_t;
+#define __DEFINED_double_t
+#endif
+
+#endif
+
+#if !defined(__cplusplus)
+#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
+typedef struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
+#define __DEFINED_max_align_t
+#endif
+
+#elif defined(__GNUC__)
+#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
+typedef struct { __attribute__((__aligned__(8))) long long __ll; long double __ld; } max_align_t;
+#define __DEFINED_max_align_t
+#endif
+
+#else
+#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
+typedef struct { alignas(8) long long __ll; long double __ld; } max_align_t;
+#define __DEFINED_max_align_t
+#endif
+
+#endif
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+#define __USE_TIME_BITS64 1
+
+#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
+typedef unsigned _Addr size_t;
+#define __DEFINED_size_t
+#endif
+
+#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
+typedef unsigned _Addr uintptr_t;
+#define __DEFINED_uintptr_t
+#endif
+
+#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
+typedef _Addr ptrdiff_t;
+#define __DEFINED_ptrdiff_t
+#endif
+
+#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t)
+typedef _Addr ssize_t;
+#define __DEFINED_ssize_t
+#endif
+
+#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
+typedef _Addr intptr_t;
+#define __DEFINED_intptr_t
+#endif
+
+#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t)
+typedef _Addr regoff_t;
+#define __DEFINED_regoff_t
+#endif
+
+#if defined(__NEED_register_t) && !defined(__DEFINED_register_t)
+typedef _Reg register_t;
+#define __DEFINED_register_t
+#endif
+
+#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
+typedef _Int64 time_t;
+#define __DEFINED_time_t
+#endif
+
+#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
+typedef _Int64 suseconds_t;
+#define __DEFINED_suseconds_t
+#endif
+
+
+#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t)
+typedef signed char     int8_t;
+#define __DEFINED_int8_t
+#endif
+
+#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t)
+typedef signed short    int16_t;
+#define __DEFINED_int16_t
+#endif
+
+#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t)
+typedef signed int      int32_t;
+#define __DEFINED_int32_t
+#endif
+
+#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t)
+typedef signed _Int64   int64_t;
+#define __DEFINED_int64_t
+#endif
+
+#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
+typedef signed _Int64   intmax_t;
+#define __DEFINED_intmax_t
+#endif
+
+#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t)
+typedef unsigned char   uint8_t;
+#define __DEFINED_uint8_t
+#endif
+
+#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t)
+typedef unsigned short  uint16_t;
+#define __DEFINED_uint16_t
+#endif
+
+#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t)
+typedef unsigned int    uint32_t;
+#define __DEFINED_uint32_t
+#endif
+
+#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t)
+typedef unsigned _Int64 uint64_t;
+#define __DEFINED_uint64_t
+#endif
+
+#if defined(__NEED_u_int64_t) && !defined(__DEFINED_u_int64_t)
+typedef unsigned _Int64 u_int64_t;
+#define __DEFINED_u_int64_t
+#endif
+
+#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
+typedef unsigned _Int64 uintmax_t;
+#define __DEFINED_uintmax_t
+#endif
+
+
+#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t)
+typedef unsigned mode_t;
+#define __DEFINED_mode_t
+#endif
+
+#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
+typedef unsigned _Reg nlink_t;
+#define __DEFINED_nlink_t
+#endif
+
+#if defined(__NEED_off_t) && !defined(__DEFINED_off_t)
+typedef _Int64 off_t;
+#define __DEFINED_off_t
+#endif
+
+#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
+typedef unsigned _Int64 ino_t;
+#define __DEFINED_ino_t
+#endif
+
+#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
+typedef unsigned _Int64 dev_t;
+#define __DEFINED_dev_t
+#endif
+
+#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
+typedef long blksize_t;
+#define __DEFINED_blksize_t
+#endif
+
+#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
+typedef _Int64 blkcnt_t;
+#define __DEFINED_blkcnt_t
+#endif
+
+#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
+typedef unsigned _Int64 fsblkcnt_t;
+#define __DEFINED_fsblkcnt_t
+#endif
+
+#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
+typedef unsigned _Int64 fsfilcnt_t;
+#define __DEFINED_fsfilcnt_t
+#endif
+
+
+#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
+typedef unsigned wint_t;
+#define __DEFINED_wint_t
+#endif
+
+#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t)
+typedef unsigned long wctype_t;
+#define __DEFINED_wctype_t
+#endif
+
+
+#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t)
+typedef void * timer_t;
+#define __DEFINED_timer_t
+#endif
+
+#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t)
+typedef int clockid_t;
+#define __DEFINED_clockid_t
+#endif
+
+#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
+typedef long clock_t;
+#define __DEFINED_clock_t
+#endif
+
+#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval)
+struct timeval { time_t tv_sec; suseconds_t tv_usec; };
+#define __DEFINED_struct_timeval
+#endif
+
+#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
+struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
+#define __DEFINED_struct_timespec
+#endif
+
+
+#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
+typedef int pid_t;
+#define __DEFINED_pid_t
+#endif
+
+#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
+typedef unsigned id_t;
+#define __DEFINED_id_t
+#endif
+
+#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
+typedef unsigned uid_t;
+#define __DEFINED_uid_t
+#endif
+
+#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
+typedef unsigned gid_t;
+#define __DEFINED_gid_t
+#endif
+
+#if defined(__NEED_key_t) && !defined(__DEFINED_key_t)
+typedef int key_t;
+#define __DEFINED_key_t
+#endif
+
+#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
+typedef unsigned useconds_t;
+#define __DEFINED_useconds_t
+#endif
+
+
+#ifdef __cplusplus
+#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
+typedef unsigned long pthread_t;
+#define __DEFINED_pthread_t
+#endif
+
+#else
+#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
+typedef struct __pthread * pthread_t;
+#define __DEFINED_pthread_t
+#endif
+
+#endif
+#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t)
+typedef int pthread_once_t;
+#define __DEFINED_pthread_once_t
+#endif
+
+#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t)
+typedef unsigned pthread_key_t;
+#define __DEFINED_pthread_key_t
+#endif
+
+#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t)
+typedef int pthread_spinlock_t;
+#define __DEFINED_pthread_spinlock_t
+#endif
+
+#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t)
+typedef struct { unsigned __attr; } pthread_mutexattr_t;
+#define __DEFINED_pthread_mutexattr_t
+#endif
+
+#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t)
+typedef struct { unsigned __attr; } pthread_condattr_t;
+#define __DEFINED_pthread_condattr_t
+#endif
+
+#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t)
+typedef struct { unsigned __attr; } pthread_barrierattr_t;
+#define __DEFINED_pthread_barrierattr_t
+#endif
+
+#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t)
+typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t;
+#define __DEFINED_pthread_rwlockattr_t
+#endif
+
+
+#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE)
+struct _IO_FILE { char __x; };
+#define __DEFINED_struct__IO_FILE
+#endif
+
+#if defined(__NEED_FILE) && !defined(__DEFINED_FILE)
+typedef struct _IO_FILE FILE;
+#define __DEFINED_FILE
+#endif
+
+
+#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
+typedef __builtin_va_list va_list;
+#define __DEFINED_va_list
+#endif
+
+#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list)
+typedef __builtin_va_list __isoc_va_list;
+#define __DEFINED___isoc_va_list
+#endif
+
+
+#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t)
+typedef struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
+#define __DEFINED_mbstate_t
+#endif
+
+
+#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
+typedef struct __locale_struct * locale_t;
+#define __DEFINED_locale_t
+#endif
+
+
+#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
+typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
+#define __DEFINED_sigset_t
+#endif
+
+
+#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
+struct iovec { void *iov_base; size_t iov_len; };
+#define __DEFINED_struct_iovec
+#endif
+
+
+#if defined(__NEED_struct_winsize) && !defined(__DEFINED_struct_winsize)
+struct winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
+#define __DEFINED_struct_winsize
+#endif
+
+
+#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t)
+typedef unsigned socklen_t;
+#define __DEFINED_socklen_t
+#endif
+
+#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t)
+typedef unsigned short sa_family_t;
+#define __DEFINED_sa_family_t
+#endif
+
+
+#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t)
+typedef struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;
+#define __DEFINED_pthread_attr_t
+#endif
+
+#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t)
+typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t;
+#define __DEFINED_pthread_mutex_t
+#endif
+
+#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t)
+typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t;
+#define __DEFINED_mtx_t
+#endif
+
+#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t)
+typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
+#define __DEFINED_pthread_cond_t
+#endif
+
+#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t)
+typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t;
+#define __DEFINED_cnd_t
+#endif
+
+#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t)
+typedef struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t;
+#define __DEFINED_pthread_rwlock_t
+#endif
+
+#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t)
+typedef struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t;
+#define __DEFINED_pthread_barrier_t
+#endif
+
+
+#undef _Addr
+#undef _Int64
+#undef _Reg
diff --git a/musl-include/i386/bits/dirent.h b/musl-include/i386/bits/dirent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/dirent.h
@@ -0,0 +1,11 @@
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
+
+struct dirent {
+	ino_t d_ino;
+	off_t d_off;
+	unsigned short d_reclen;
+	unsigned char d_type;
+	char d_name[256];
+};
diff --git a/musl-include/i386/bits/errno.h b/musl-include/i386/bits/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM            1
+#define ENOENT           2
+#define ESRCH            3
+#define EINTR            4
+#define EIO              5
+#define ENXIO            6
+#define E2BIG            7
+#define ENOEXEC          8
+#define EBADF            9
+#define ECHILD          10
+#define EAGAIN          11
+#define ENOMEM          12
+#define EACCES          13
+#define EFAULT          14
+#define ENOTBLK         15
+#define EBUSY           16
+#define EEXIST          17
+#define EXDEV           18
+#define ENODEV          19
+#define ENOTDIR         20
+#define EISDIR          21
+#define EINVAL          22
+#define ENFILE          23
+#define EMFILE          24
+#define ENOTTY          25
+#define ETXTBSY         26
+#define EFBIG           27
+#define ENOSPC          28
+#define ESPIPE          29
+#define EROFS           30
+#define EMLINK          31
+#define EPIPE           32
+#define EDOM            33
+#define ERANGE          34
+#define EDEADLK         35
+#define ENAMETOOLONG    36
+#define ENOLCK          37
+#define ENOSYS          38
+#define ENOTEMPTY       39
+#define ELOOP           40
+#define EWOULDBLOCK     EAGAIN
+#define ENOMSG          42
+#define EIDRM           43
+#define ECHRNG          44
+#define EL2NSYNC        45
+#define EL3HLT          46
+#define EL3RST          47
+#define ELNRNG          48
+#define EUNATCH         49
+#define ENOCSI          50
+#define EL2HLT          51
+#define EBADE           52
+#define EBADR           53
+#define EXFULL          54
+#define ENOANO          55
+#define EBADRQC         56
+#define EBADSLT         57
+#define EDEADLOCK       EDEADLK
+#define EBFONT          59
+#define ENOSTR          60
+#define ENODATA         61
+#define ETIME           62
+#define ENOSR           63
+#define ENONET          64
+#define ENOPKG          65
+#define EREMOTE         66
+#define ENOLINK         67
+#define EADV            68
+#define ESRMNT          69
+#define ECOMM           70
+#define EPROTO          71
+#define EMULTIHOP       72
+#define EDOTDOT         73
+#define EBADMSG         74
+#define EOVERFLOW       75
+#define ENOTUNIQ        76
+#define EBADFD          77
+#define EREMCHG         78
+#define ELIBACC         79
+#define ELIBBAD         80
+#define ELIBSCN         81
+#define ELIBMAX         82
+#define ELIBEXEC        83
+#define EILSEQ          84
+#define ERESTART        85
+#define ESTRPIPE        86
+#define EUSERS          87
+#define ENOTSOCK        88
+#define EDESTADDRREQ    89
+#define EMSGSIZE        90
+#define EPROTOTYPE      91
+#define ENOPROTOOPT     92
+#define EPROTONOSUPPORT 93
+#define ESOCKTNOSUPPORT 94
+#define EOPNOTSUPP      95
+#define ENOTSUP         EOPNOTSUPP
+#define EPFNOSUPPORT    96
+#define EAFNOSUPPORT    97
+#define EADDRINUSE      98
+#define EADDRNOTAVAIL   99
+#define ENETDOWN        100
+#define ENETUNREACH     101
+#define ENETRESET       102
+#define ECONNABORTED    103
+#define ECONNRESET      104
+#define ENOBUFS         105
+#define EISCONN         106
+#define ENOTCONN        107
+#define ESHUTDOWN       108
+#define ETOOMANYREFS    109
+#define ETIMEDOUT       110
+#define ECONNREFUSED    111
+#define EHOSTDOWN       112
+#define EHOSTUNREACH    113
+#define EALREADY        114
+#define EINPROGRESS     115
+#define ESTALE          116
+#define EUCLEAN         117
+#define ENOTNAM         118
+#define ENAVAIL         119
+#define EISNAM          120
+#define EREMOTEIO       121
+#define EDQUOT          122
+#define ENOMEDIUM       123
+#define EMEDIUMTYPE     124
+#define ECANCELED       125
+#define ENOKEY          126
+#define EKEYEXPIRED     127
+#define EKEYREVOKED     128
+#define EKEYREJECTED    129
+#define EOWNERDEAD      130
+#define ENOTRECOVERABLE 131
+#define ERFKILL         132
+#define EHWPOISON       133
diff --git a/musl-include/i386/bits/fcntl.h b/musl-include/i386/bits/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/fcntl.h
@@ -0,0 +1,46 @@
+#define O_CREAT        0100
+#define O_EXCL         0200
+#define O_NOCTTY       0400
+#define O_TRUNC       01000
+#define O_APPEND      02000
+#define O_NONBLOCK    04000
+#define O_DSYNC      010000
+#define O_SYNC     04010000
+#define O_RSYNC    04010000
+#define O_DIRECTORY 0200000
+#define O_NOFOLLOW  0400000
+#define O_CLOEXEC  02000000
+
+#define O_ASYNC      020000
+#define O_DIRECT     040000
+#define O_LARGEFILE 0100000
+#define O_NOATIME  01000000
+#define O_PATH    010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD  0
+#define F_GETFD  1
+#define F_SETFD  2
+#define F_GETFL  3
+#define F_SETFL  4
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#if __LONG_MAX == 0x7fffffffL
+#define F_GETLK 12
+#define F_SETLK 13
+#define F_SETLKW 14
+#else
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+#endif
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/musl-include/i386/bits/fenv.h b/musl-include/i386/bits/fenv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/fenv.h
@@ -0,0 +1,33 @@
+#define FE_INVALID    1
+#define __FE_DENORM   2
+#define FE_DIVBYZERO  4
+#define FE_OVERFLOW   8
+#define FE_UNDERFLOW  16
+#define FE_INEXACT    32
+
+#define FE_ALL_EXCEPT 63
+
+#define FE_TONEAREST  0
+#define FE_DOWNWARD   0x400
+#define FE_UPWARD     0x800
+#define FE_TOWARDZERO 0xc00
+
+typedef unsigned short fexcept_t;
+
+typedef struct {
+	unsigned short __control_word;
+	unsigned short __unused1;
+	unsigned short __status_word;
+	unsigned short __unused2;
+	unsigned short __tags;
+	unsigned short __unused3;
+	unsigned int __eip;
+	unsigned short __cs_selector;
+	unsigned int __opcode:11;
+	unsigned int __unused4:5;
+	unsigned int __data_offset;
+	unsigned short __data_selector;
+	unsigned short __unused5;
+} fenv_t;
+
+#define FE_DFL_ENV      ((const fenv_t *) -1)
diff --git a/musl-include/i386/bits/float.h b/musl-include/i386/bits/float.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/float.h
@@ -0,0 +1,20 @@
+#ifdef __FLT_EVAL_METHOD__
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#else
+#define FLT_EVAL_METHOD 2
+#endif
+
+#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
+#define LDBL_MIN     3.3621031431120935063e-4932L
+#define LDBL_MAX     1.1897314953572317650e+4932L
+#define LDBL_EPSILON 1.0842021724855044340e-19L
+
+#define LDBL_MANT_DIG 64
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 18
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 21
diff --git a/musl-include/i386/bits/hwcap.h b/musl-include/i386/bits/hwcap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/hwcap.h
diff --git a/musl-include/i386/bits/io.h b/musl-include/i386/bits/io.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/io.h
@@ -0,0 +1,77 @@
+static __inline void outb(unsigned char __val, unsigned short __port)
+{
+	__asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outw(unsigned short __val, unsigned short __port)
+{
+	__asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outl(unsigned int __val, unsigned short __port)
+{
+	__asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline unsigned char inb(unsigned short __port)
+{
+	unsigned char __val;
+	__asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
+	return __val;
+}
+
+static __inline unsigned short inw(unsigned short __port)
+{
+	unsigned short __val;
+	__asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
+	return __val;
+}
+
+static __inline unsigned int inl(unsigned short __port)
+{
+	unsigned int __val;
+	__asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
+	return __val;
+}
+
+static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; outsb"
+		      : "+S" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
+
+static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; outsw"
+		      : "+S" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
+
+static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; outsl"
+		      : "+S" (__buf), "+c"(__n)
+		      : "d" (__port));
+}
+
+static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; insb"
+		      : "+D" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
+
+static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; insw"
+		      : "+D" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
+
+static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; insl"
+		      : "+D" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
diff --git a/musl-include/i386/bits/ioctl.h b/musl-include/i386/bits/ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/ioctl.h
@@ -0,0 +1,115 @@
+#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE  0U
+#define _IOC_WRITE 1U
+#define _IOC_READ  2U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define TCGETS		0x5401
+#define TCSETS		0x5402
+#define TCSETSW		0x5403
+#define TCSETSF		0x5404
+#define TCGETA		0x5405
+#define TCSETA		0x5406
+#define TCSETAW		0x5407
+#define TCSETAF		0x5408
+#define TCSBRK		0x5409
+#define TCXONC		0x540A
+#define TCFLSH		0x540B
+#define TIOCEXCL	0x540C
+#define TIOCNXCL	0x540D
+#define TIOCSCTTY	0x540E
+#define TIOCGPGRP	0x540F
+#define TIOCSPGRP	0x5410
+#define TIOCOUTQ	0x5411
+#define TIOCSTI		0x5412
+#define TIOCGWINSZ	0x5413
+#define TIOCSWINSZ	0x5414
+#define TIOCMGET	0x5415
+#define TIOCMBIS	0x5416
+#define TIOCMBIC	0x5417
+#define TIOCMSET	0x5418
+#define TIOCGSOFTCAR	0x5419
+#define TIOCSSOFTCAR	0x541A
+#define FIONREAD	0x541B
+#define TIOCINQ		FIONREAD
+#define TIOCLINUX	0x541C
+#define TIOCCONS	0x541D
+#define TIOCGSERIAL	0x541E
+#define TIOCSSERIAL	0x541F
+#define TIOCPKT		0x5420
+#define FIONBIO		0x5421
+#define TIOCNOTTY	0x5422
+#define TIOCSETD	0x5423
+#define TIOCGETD	0x5424
+#define TCSBRKP		0x5425
+#define TIOCSBRK	0x5427
+#define TIOCCBRK	0x5428
+#define TIOCGSID	0x5429
+#define TIOCGRS485	0x542E
+#define TIOCSRS485	0x542F
+#define TIOCGPTN	0x80045430
+#define TIOCSPTLCK	0x40045431
+#define TIOCGDEV	0x80045432
+#define TCGETX		0x5432
+#define TCSETX		0x5433
+#define TCSETXF		0x5434
+#define TCSETXW		0x5435
+#define TIOCSIG		0x40045436
+#define TIOCVHANGUP	0x5437
+#define TIOCGPKT	0x80045438
+#define TIOCGPTLCK	0x80045439
+#define TIOCGEXCL	0x80045440
+#define TIOCGPTPEER	0x5441
+#define TIOCGISO7816	0x80285442
+#define TIOCSISO7816	0xc0285443
+
+#define FIONCLEX	0x5450
+#define FIOCLEX		0x5451
+#define FIOASYNC	0x5452
+#define TIOCSERCONFIG	0x5453
+#define TIOCSERGWILD	0x5454
+#define TIOCSERSWILD	0x5455
+#define TIOCGLCKTRMIOS	0x5456
+#define TIOCSLCKTRMIOS	0x5457
+#define TIOCSERGSTRUCT	0x5458
+#define TIOCSERGETLSR   0x5459
+#define TIOCSERGETMULTI 0x545A
+#define TIOCSERSETMULTI 0x545B
+
+#define TIOCMIWAIT	0x545C
+#define TIOCGICOUNT	0x545D
+#define FIOQSIZE	0x5460
+
+#define TIOCM_LE        0x001
+#define TIOCM_DTR       0x002
+#define TIOCM_RTS       0x004
+#define TIOCM_ST        0x008
+#define TIOCM_SR        0x010
+#define TIOCM_CTS       0x020
+#define TIOCM_CAR       0x040
+#define TIOCM_RNG       0x080
+#define TIOCM_DSR       0x100
+#define TIOCM_CD        TIOCM_CAR
+#define TIOCM_RI        TIOCM_RNG
+#define TIOCM_OUT1      0x2000
+#define TIOCM_OUT2      0x4000
+#define TIOCM_LOOP      0x8000
+
+#define FIOSETOWN       0x8901
+#define SIOCSPGRP       0x8902
+#define FIOGETOWN       0x8903
+#define SIOCGPGRP       0x8904
+#define SIOCATMARK      0x8905
+#if __LONG_MAX == 0x7fffffff
+#define SIOCGSTAMP      _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS    _IOR(0x89, 7, char[16])
+#else
+#define SIOCGSTAMP      0x8906
+#define SIOCGSTAMPNS    0x8907
+#endif
+
+#include <bits/ioctl_fix.h>
diff --git a/musl-include/i386/bits/ioctl_fix.h b/musl-include/i386/bits/ioctl_fix.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/ioctl_fix.h
diff --git a/musl-include/i386/bits/ipc.h b/musl-include/i386/bits/ipc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/ipc.h
@@ -0,0 +1,11 @@
+struct ipc_perm {
+	key_t __ipc_perm_key;
+	uid_t uid;
+	gid_t gid;
+	uid_t cuid;
+	gid_t cgid;
+	mode_t mode;
+	int __ipc_perm_seq;
+	long __pad1;
+	long __pad2;
+};
diff --git a/musl-include/i386/bits/ipcstat.h b/musl-include/i386/bits/ipcstat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/ipcstat.h
@@ -0,0 +1,1 @@
+#define IPC_STAT 0x102
diff --git a/musl-include/i386/bits/kd.h b/musl-include/i386/bits/kd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/kd.h
@@ -0,0 +1,1 @@
+#include <linux/kd.h>
diff --git a/musl-include/i386/bits/limits.h b/musl-include/i386/bits/limits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/limits.h
@@ -0,0 +1,1 @@
+#define PAGESIZE 4096
diff --git a/musl-include/i386/bits/link.h b/musl-include/i386/bits/link.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/link.h
@@ -0,0 +1,1 @@
+typedef uint32_t Elf_Symndx;
diff --git a/musl-include/i386/bits/mman.h b/musl-include/i386/bits/mman.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/mman.h
@@ -0,0 +1,1 @@
+#define MAP_32BIT      0x40
diff --git a/musl-include/i386/bits/msg.h b/musl-include/i386/bits/msg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/msg.h
@@ -0,0 +1,18 @@
+struct msqid_ds {
+	struct ipc_perm msg_perm;
+	unsigned long __msg_stime_lo;
+	unsigned long __msg_stime_hi;
+	unsigned long __msg_rtime_lo;
+	unsigned long __msg_rtime_hi;
+	unsigned long __msg_ctime_lo;
+	unsigned long __msg_ctime_hi;
+	unsigned long msg_cbytes;
+	msgqnum_t msg_qnum;
+	msglen_t msg_qbytes;
+	pid_t msg_lspid;
+	pid_t msg_lrpid;
+	unsigned long __unused[2];
+	time_t msg_stime;
+	time_t msg_rtime;
+	time_t msg_ctime;
+};
diff --git a/musl-include/i386/bits/poll.h b/musl-include/i386/bits/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/poll.h
diff --git a/musl-include/i386/bits/posix.h b/musl-include/i386/bits/posix.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_ILP32_OFFBIG  1
+#define _POSIX_V7_ILP32_OFFBIG  1
diff --git a/musl-include/i386/bits/ptrace.h b/musl-include/i386/bits/ptrace.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/ptrace.h
@@ -0,0 +1,11 @@
+#define PTRACE_GET_THREAD_AREA		25
+#define PTRACE_SET_THREAD_AREA		26
+#define PTRACE_SYSEMU			31
+#define PTRACE_SYSEMU_SINGLESTEP	32
+#define PTRACE_SINGLEBLOCK		33
+
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
+#define PT_SYSEMU PTRACE_SYSEMU
+#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
diff --git a/musl-include/i386/bits/reg.h b/musl-include/i386/bits/reg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/reg.h
@@ -0,0 +1,19 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+#define EBX 0
+#define ECX 1
+#define EDX 2
+#define ESI 3
+#define EDI 4
+#define EBP 5
+#define EAX 6
+#define DS 7
+#define ES 8
+#define FS 9
+#define GS 10
+#define ORIG_EAX 11
+#define EIP 12
+#define CS 13
+#define EFL 14
+#define UESP 15
+#define SS 16
diff --git a/musl-include/i386/bits/resource.h b/musl-include/i386/bits/resource.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/resource.h
diff --git a/musl-include/i386/bits/sem.h b/musl-include/i386/bits/sem.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/sem.h
@@ -0,0 +1,13 @@
+struct semid_ds {
+	struct ipc_perm sem_perm;
+	unsigned long __sem_otime_lo;
+	unsigned long __sem_otime_hi;
+	unsigned long __sem_ctime_lo;
+	unsigned long __sem_ctime_hi;
+	unsigned short sem_nsems;
+	char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+	long __unused3;
+	long __unused4;
+	time_t sem_otime;
+	time_t sem_ctime;
+};
diff --git a/musl-include/i386/bits/setjmp.h b/musl-include/i386/bits/setjmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/setjmp.h
@@ -0,0 +1,1 @@
+typedef unsigned long __jmp_buf[6];
diff --git a/musl-include/i386/bits/shm.h b/musl-include/i386/bits/shm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/shm.h
@@ -0,0 +1,31 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+	struct ipc_perm shm_perm;
+	size_t shm_segsz;
+	unsigned long __shm_atime_lo;
+	unsigned long __shm_atime_hi;
+	unsigned long __shm_dtime_lo;
+	unsigned long __shm_dtime_hi;
+	unsigned long __shm_ctime_lo;
+	unsigned long __shm_ctime_hi;
+	pid_t shm_cpid;
+	pid_t shm_lpid;
+	unsigned long shm_nattch;
+	unsigned long __pad1;
+	unsigned long __pad2;
+	unsigned long __pad3;
+	time_t shm_atime;
+	time_t shm_dtime;
+	time_t shm_ctime;
+};
+
+struct shminfo {
+	unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+	int __used_ids;
+	unsigned long shm_tot, shm_rss, shm_swp;
+	unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/musl-include/i386/bits/signal.h b/musl-include/i386/bits/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/signal.h
@@ -0,0 +1,142 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#ifdef _GNU_SOURCE
+enum { REG_GS = 0 };
+#define REG_GS REG_GS
+enum { REG_FS = 1 };
+#define REG_FS REG_FS
+enum { REG_ES = 2 };
+#define REG_ES REG_ES
+enum { REG_DS = 3 };
+#define REG_DS REG_DS
+enum { REG_EDI = 4 };
+#define REG_EDI REG_EDI
+enum { REG_ESI = 5 };
+#define REG_ESI REG_ESI
+enum { REG_EBP = 6 };
+#define REG_EBP REG_EBP
+enum { REG_ESP = 7 };
+#define REG_ESP REG_ESP
+enum { REG_EBX = 8 };
+#define REG_EBX REG_EBX
+enum { REG_EDX = 9 };
+#define REG_EDX REG_EDX
+enum { REG_ECX = 10 };
+#define REG_ECX REG_ECX
+enum { REG_EAX = 11 };
+#define REG_EAX REG_EAX
+enum { REG_TRAPNO = 12 };
+#define REG_TRAPNO REG_TRAPNO
+enum { REG_ERR = 13 };
+#define REG_ERR REG_ERR
+enum { REG_EIP = 14 };
+#define REG_EIP REG_EIP
+enum { REG_CS = 15 };
+#define REG_CS REG_CS
+enum { REG_EFL = 16 };
+#define REG_EFL REG_EFL
+enum { REG_UESP = 17 };
+#define REG_UESP REG_UESP
+enum { REG_SS = 18 };
+#define REG_SS REG_SS
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef int greg_t, gregset_t[19];
+typedef struct _fpstate {
+	unsigned long cw, sw, tag, ipoff, cssel, dataoff, datasel;
+	struct {
+		unsigned short significand[4], exponent;
+	} _st[8];
+	unsigned long status;
+} *fpregset_t;
+struct sigcontext {
+	unsigned short gs, __gsh, fs, __fsh, es, __esh, ds, __dsh;
+	unsigned long edi, esi, ebp, esp, ebx, edx, ecx, eax;
+	unsigned long trapno, err, eip;
+	unsigned short cs, __csh;
+	unsigned long eflags, esp_at_signal;
+	unsigned short ss, __ssh;
+	struct _fpstate *fpstate;
+	unsigned long oldmask, cr2;
+};
+typedef struct {
+	gregset_t gregs;
+	fpregset_t fpregs;
+	unsigned long oldmask, cr2;
+} mcontext_t;
+#else
+typedef struct {
+	unsigned __space[22];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+	void *ss_sp;
+	int ss_flags;
+	size_t ss_size;
+};
+
+typedef struct __ucontext {
+	unsigned long uc_flags;
+	struct __ucontext *uc_link;
+	stack_t uc_stack;
+	mcontext_t uc_mcontext;
+	sigset_t uc_sigmask;
+	unsigned long __fpregs_mem[28];
+} ucontext_t;
+
+#define SA_NOCLDSTOP  1
+#define SA_NOCLDWAIT  2
+#define SA_SIGINFO    4
+#define SA_ONSTACK    0x08000000
+#define SA_RESTART    0x10000000
+#define SA_NODEFER    0x40000000
+#define SA_RESETHAND  0x80000000
+#define SA_RESTORER   0x04000000
+
+#endif
+
+#define SIGHUP    1
+#define SIGINT    2
+#define SIGQUIT   3
+#define SIGILL    4
+#define SIGTRAP   5
+#define SIGABRT   6
+#define SIGIOT    SIGABRT
+#define SIGBUS    7
+#define SIGFPE    8
+#define SIGKILL   9
+#define SIGUSR1   10
+#define SIGSEGV   11
+#define SIGUSR2   12
+#define SIGPIPE   13
+#define SIGALRM   14
+#define SIGTERM   15
+#define SIGSTKFLT 16
+#define SIGCHLD   17
+#define SIGCONT   18
+#define SIGSTOP   19
+#define SIGTSTP   20
+#define SIGTTIN   21
+#define SIGTTOU   22
+#define SIGURG    23
+#define SIGXCPU   24
+#define SIGXFSZ   25
+#define SIGVTALRM 26
+#define SIGPROF   27
+#define SIGWINCH  28
+#define SIGIO     29
+#define SIGPOLL   29
+#define SIGPWR    30
+#define SIGSYS    31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
+
diff --git a/musl-include/i386/bits/socket.h b/musl-include/i386/bits/socket.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/socket.h
diff --git a/musl-include/i386/bits/soundcard.h b/musl-include/i386/bits/soundcard.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/soundcard.h
@@ -0,0 +1,1 @@
+#include <linux/soundcard.h>
diff --git a/musl-include/i386/bits/stat.h b/musl-include/i386/bits/stat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/stat.h
@@ -0,0 +1,25 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+	dev_t st_dev;
+	int __st_dev_padding;
+	long __st_ino_truncated;
+	mode_t st_mode;
+	nlink_t st_nlink;
+	uid_t st_uid;
+	gid_t st_gid;
+	dev_t st_rdev;
+	int __st_rdev_padding;
+	off_t st_size;
+	blksize_t st_blksize;
+	blkcnt_t st_blocks;
+	struct {
+		long tv_sec;
+		long tv_nsec;
+	} __st_atim32, __st_mtim32, __st_ctim32;
+	ino_t st_ino;
+	struct timespec st_atim;
+	struct timespec st_mtim;
+	struct timespec st_ctim;
+};
diff --git a/musl-include/i386/bits/statfs.h b/musl-include/i386/bits/statfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/statfs.h
@@ -0,0 +1,7 @@
+struct statfs {
+	unsigned long f_type, f_bsize;
+	fsblkcnt_t f_blocks, f_bfree, f_bavail;
+	fsfilcnt_t f_files, f_ffree;
+	fsid_t f_fsid;
+	unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
+};
diff --git a/musl-include/i386/bits/stdint.h b/musl-include/i386/bits/stdint.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN  INT32_MIN
+#define INT_FAST32_MIN  INT32_MIN
+
+#define INT_FAST16_MAX  INT32_MAX
+#define INT_FAST32_MAX  INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN      INT32_MIN
+#define INTPTR_MAX      INT32_MAX
+#define UINTPTR_MAX     UINT32_MAX
+#define PTRDIFF_MIN     INT32_MIN
+#define PTRDIFF_MAX     INT32_MAX
+#define SIZE_MAX        UINT32_MAX
diff --git a/musl-include/i386/bits/syscall.h b/musl-include/i386/bits/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/syscall.h
@@ -0,0 +1,887 @@
+#define __NR_restart_syscall      0
+#define __NR_exit		  1
+#define __NR_fork		  2
+#define __NR_read		  3
+#define __NR_write		  4
+#define __NR_open		  5
+#define __NR_close		  6
+#define __NR_waitpid		  7
+#define __NR_creat		  8
+#define __NR_link		  9
+#define __NR_unlink		 10
+#define __NR_execve		 11
+#define __NR_chdir		 12
+#define __NR_time		 13
+#define __NR_mknod		 14
+#define __NR_chmod		 15
+#define __NR_lchown		 16
+#define __NR_break		 17
+#define __NR_oldstat		 18
+#define __NR_lseek		 19
+#define __NR_getpid		 20
+#define __NR_mount		 21
+#define __NR_umount		 22
+#define __NR_setuid		 23
+#define __NR_getuid		 24
+#define __NR_stime		 25
+#define __NR_ptrace		 26
+#define __NR_alarm		 27
+#define __NR_oldfstat		 28
+#define __NR_pause		 29
+#define __NR_utime		 30
+#define __NR_stty		 31
+#define __NR_gtty		 32
+#define __NR_access		 33
+#define __NR_nice		 34
+#define __NR_ftime		 35
+#define __NR_sync		 36
+#define __NR_kill		 37
+#define __NR_rename		 38
+#define __NR_mkdir		 39
+#define __NR_rmdir		 40
+#define __NR_dup		 41
+#define __NR_pipe		 42
+#define __NR_times		 43
+#define __NR_prof		 44
+#define __NR_brk		 45
+#define __NR_setgid		 46
+#define __NR_getgid		 47
+#define __NR_signal		 48
+#define __NR_geteuid		 49
+#define __NR_getegid		 50
+#define __NR_acct		 51
+#define __NR_umount2		 52
+#define __NR_lock		 53
+#define __NR_ioctl		 54
+#define __NR_fcntl		 55
+#define __NR_mpx		 56
+#define __NR_setpgid		 57
+#define __NR_ulimit		 58
+#define __NR_oldolduname	 59
+#define __NR_umask		 60
+#define __NR_chroot		 61
+#define __NR_ustat		 62
+#define __NR_dup2		 63
+#define __NR_getppid		 64
+#define __NR_getpgrp		 65
+#define __NR_setsid		 66
+#define __NR_sigaction		 67
+#define __NR_sgetmask		 68
+#define __NR_ssetmask		 69
+#define __NR_setreuid		 70
+#define __NR_setregid		 71
+#define __NR_sigsuspend		 72
+#define __NR_sigpending		 73
+#define __NR_sethostname	 74
+#define __NR_setrlimit		 75
+#define __NR_getrlimit		 76   /* Back compatible 2Gig limited rlimit */
+#define __NR_getrusage		 77
+#define __NR_gettimeofday_time32	 78
+#define __NR_settimeofday_time32	 79
+#define __NR_getgroups		 80
+#define __NR_setgroups		 81
+#define __NR_select		 82
+#define __NR_symlink		 83
+#define __NR_oldlstat		 84
+#define __NR_readlink		 85
+#define __NR_uselib		 86
+#define __NR_swapon		 87
+#define __NR_reboot		 88
+#define __NR_readdir		 89
+#define __NR_mmap		 90
+#define __NR_munmap		 91
+#define __NR_truncate		 92
+#define __NR_ftruncate		 93
+#define __NR_fchmod		 94
+#define __NR_fchown		 95
+#define __NR_getpriority	 96
+#define __NR_setpriority	 97
+#define __NR_profil		 98
+#define __NR_statfs		99
+#define __NR_fstatfs		100
+#define __NR_ioperm		101
+#define __NR_socketcall		102
+#define __NR_syslog		103
+#define __NR_setitimer		104
+#define __NR_getitimer		105
+#define __NR_stat		106
+#define __NR_lstat		107
+#define __NR_fstat		108
+#define __NR_olduname		109
+#define __NR_iopl		110
+#define __NR_vhangup		111
+#define __NR_idle		112
+#define __NR_vm86old		113
+#define __NR_wait4		114
+#define __NR_swapoff		115
+#define __NR_sysinfo		116
+#define __NR_ipc		117
+#define __NR_fsync		118
+#define __NR_sigreturn		119
+#define __NR_clone		120
+#define __NR_setdomainname	121
+#define __NR_uname		122
+#define __NR_modify_ldt		123
+#define __NR_adjtimex		124
+#define __NR_mprotect		125
+#define __NR_sigprocmask	126
+#define __NR_create_module	127
+#define __NR_init_module	128
+#define __NR_delete_module	129
+#define __NR_get_kernel_syms	130
+#define __NR_quotactl		131
+#define __NR_getpgid		132
+#define __NR_fchdir		133
+#define __NR_bdflush		134
+#define __NR_sysfs		135
+#define __NR_personality	136
+#define __NR_afs_syscall	137
+#define __NR_setfsuid		138
+#define __NR_setfsgid		139
+#define __NR__llseek		140
+#define __NR_getdents		141
+#define __NR__newselect		142
+#define __NR_flock		143
+#define __NR_msync		144
+#define __NR_readv		145
+#define __NR_writev		146
+#define __NR_getsid		147
+#define __NR_fdatasync		148
+#define __NR__sysctl		149
+#define __NR_mlock		150
+#define __NR_munlock		151
+#define __NR_mlockall		152
+#define __NR_munlockall		153
+#define __NR_sched_setparam		154
+#define __NR_sched_getparam		155
+#define __NR_sched_setscheduler		156
+#define __NR_sched_getscheduler		157
+#define __NR_sched_yield		158
+#define __NR_sched_get_priority_max	159
+#define __NR_sched_get_priority_min	160
+#define __NR_sched_rr_get_interval	161
+#define __NR_nanosleep		162
+#define __NR_mremap		163
+#define __NR_setresuid		164
+#define __NR_getresuid		165
+#define __NR_vm86		166
+#define __NR_query_module	167
+#define __NR_poll		168
+#define __NR_nfsservctl		169
+#define __NR_setresgid		170
+#define __NR_getresgid		171
+#define __NR_prctl              172
+#define __NR_rt_sigreturn	173
+#define __NR_rt_sigaction	174
+#define __NR_rt_sigprocmask	175
+#define __NR_rt_sigpending	176
+#define __NR_rt_sigtimedwait	177
+#define __NR_rt_sigqueueinfo	178
+#define __NR_rt_sigsuspend	179
+#define __NR_pread64		180
+#define __NR_pwrite64		181
+#define __NR_chown		182
+#define __NR_getcwd		183
+#define __NR_capget		184
+#define __NR_capset		185
+#define __NR_sigaltstack	186
+#define __NR_sendfile		187
+#define __NR_getpmsg		188
+#define __NR_putpmsg		189
+#define __NR_vfork		190
+#define __NR_ugetrlimit		191
+#define __NR_mmap2		192
+#define __NR_truncate64		193
+#define __NR_ftruncate64	194
+#define __NR_stat64		195
+#define __NR_lstat64		196
+#define __NR_fstat64		197
+#define __NR_lchown32		198
+#define __NR_getuid32		199
+#define __NR_getgid32		200
+#define __NR_geteuid32		201
+#define __NR_getegid32		202
+#define __NR_setreuid32		203
+#define __NR_setregid32		204
+#define __NR_getgroups32	205
+#define __NR_setgroups32	206
+#define __NR_fchown32		207
+#define __NR_setresuid32	208
+#define __NR_getresuid32	209
+#define __NR_setresgid32	210
+#define __NR_getresgid32	211
+#define __NR_chown32		212
+#define __NR_setuid32		213
+#define __NR_setgid32		214
+#define __NR_setfsuid32		215
+#define __NR_setfsgid32		216
+#define __NR_pivot_root		217
+#define __NR_mincore		218
+#define __NR_madvise		219
+#define __NR_getdents64		220
+#define __NR_fcntl64		221
+/* 223 is unused */
+#define __NR_gettid		224
+#define __NR_readahead		225
+#define __NR_setxattr		226
+#define __NR_lsetxattr		227
+#define __NR_fsetxattr		228
+#define __NR_getxattr		229
+#define __NR_lgetxattr		230
+#define __NR_fgetxattr		231
+#define __NR_listxattr		232
+#define __NR_llistxattr		233
+#define __NR_flistxattr		234
+#define __NR_removexattr	235
+#define __NR_lremovexattr	236
+#define __NR_fremovexattr	237
+#define __NR_tkill		238
+#define __NR_sendfile64		239
+#define __NR_futex		240
+#define __NR_sched_setaffinity	241
+#define __NR_sched_getaffinity	242
+#define __NR_set_thread_area	243
+#define __NR_get_thread_area	244
+#define __NR_io_setup		245
+#define __NR_io_destroy		246
+#define __NR_io_getevents	247
+#define __NR_io_submit		248
+#define __NR_io_cancel		249
+#define __NR_fadvise64		250
+/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
+#define __NR_exit_group		252
+#define __NR_lookup_dcookie	253
+#define __NR_epoll_create	254
+#define __NR_epoll_ctl		255
+#define __NR_epoll_wait		256
+#define __NR_remap_file_pages	257
+#define __NR_set_tid_address	258
+#define __NR_timer_create	259
+#define __NR_timer_settime32	(__NR_timer_create+1)
+#define __NR_timer_gettime32	(__NR_timer_create+2)
+#define __NR_timer_getoverrun	(__NR_timer_create+3)
+#define __NR_timer_delete	(__NR_timer_create+4)
+#define __NR_clock_settime32	(__NR_timer_create+5)
+#define __NR_clock_gettime32	(__NR_timer_create+6)
+#define __NR_clock_getres_time32	(__NR_timer_create+7)
+#define __NR_clock_nanosleep_time32	(__NR_timer_create+8)
+#define __NR_statfs64		268
+#define __NR_fstatfs64		269
+#define __NR_tgkill		270
+#define __NR_utimes		271
+#define __NR_fadvise64_64	272
+#define __NR_vserver		273
+#define __NR_mbind		274
+#define __NR_get_mempolicy	275
+#define __NR_set_mempolicy	276
+#define __NR_mq_open 		277
+#define __NR_mq_unlink		(__NR_mq_open+1)
+#define __NR_mq_timedsend	(__NR_mq_open+2)
+#define __NR_mq_timedreceive	(__NR_mq_open+3)
+#define __NR_mq_notify		(__NR_mq_open+4)
+#define __NR_mq_getsetattr	(__NR_mq_open+5)
+#define __NR_kexec_load		283
+#define __NR_waitid		284
+/* #define __NR_sys_setaltroot	285 */
+#define __NR_add_key		286
+#define __NR_request_key	287
+#define __NR_keyctl		288
+#define __NR_ioprio_set		289
+#define __NR_ioprio_get		290
+#define __NR_inotify_init	291
+#define __NR_inotify_add_watch	292
+#define __NR_inotify_rm_watch	293
+#define __NR_migrate_pages	294
+#define __NR_openat		295
+#define __NR_mkdirat		296
+#define __NR_mknodat		297
+#define __NR_fchownat		298
+#define __NR_futimesat		299
+#define __NR_fstatat64		300
+#define __NR_unlinkat		301
+#define __NR_renameat		302
+#define __NR_linkat		303
+#define __NR_symlinkat		304
+#define __NR_readlinkat		305
+#define __NR_fchmodat		306
+#define __NR_faccessat		307
+#define __NR_pselect6		308
+#define __NR_ppoll		309
+#define __NR_unshare		310
+#define __NR_set_robust_list	311
+#define __NR_get_robust_list	312
+#define __NR_splice		313
+#define __NR_sync_file_range	314
+#define __NR_tee		315
+#define __NR_vmsplice		316
+#define __NR_move_pages		317
+#define __NR_getcpu		318
+#define __NR_epoll_pwait	319
+#define __NR_utimensat		320
+#define __NR_signalfd		321
+#define __NR_timerfd_create	322
+#define __NR_eventfd		323
+#define __NR_fallocate		324
+#define __NR_timerfd_settime32	325
+#define __NR_timerfd_gettime32	326
+#define __NR_signalfd4		327
+#define __NR_eventfd2		328
+#define __NR_epoll_create1	329
+#define __NR_dup3		330
+#define __NR_pipe2		331
+#define __NR_inotify_init1	332
+#define __NR_preadv		333
+#define __NR_pwritev		334
+#define __NR_rt_tgsigqueueinfo	335
+#define __NR_perf_event_open	336
+#define __NR_recvmmsg		337
+#define __NR_fanotify_init	338
+#define __NR_fanotify_mark	339
+#define __NR_prlimit64		340
+#define __NR_name_to_handle_at	341
+#define __NR_open_by_handle_at	342
+#define __NR_clock_adjtime	343
+#define __NR_syncfs		344
+#define __NR_sendmmsg		345
+#define __NR_setns		346
+#define __NR_process_vm_readv	347
+#define __NR_process_vm_writev	348
+#define __NR_kcmp		349
+#define __NR_finit_module	350
+#define __NR_sched_setattr	351
+#define __NR_sched_getattr	352
+#define __NR_renameat2		353
+#define __NR_seccomp		354
+#define __NR_getrandom		355
+#define __NR_memfd_create	356
+#define __NR_bpf		357
+#define __NR_execveat		358
+#define __NR_socket		359
+#define __NR_socketpair		360
+#define __NR_bind		361
+#define __NR_connect		362
+#define __NR_listen		363
+#define __NR_accept4		364
+#define __NR_getsockopt		365
+#define __NR_setsockopt		366
+#define __NR_getsockname	367
+#define __NR_getpeername	368
+#define __NR_sendto		369
+#define __NR_sendmsg		370
+#define __NR_recvfrom		371
+#define __NR_recvmsg		372
+#define __NR_shutdown		373
+#define __NR_userfaultfd	374
+#define __NR_membarrier		375
+#define __NR_mlock2		376
+#define __NR_copy_file_range	377
+#define __NR_preadv2		378
+#define __NR_pwritev2		379
+#define __NR_pkey_mprotect	380
+#define __NR_pkey_alloc		381
+#define __NR_pkey_free		382
+#define __NR_statx		383
+#define __NR_arch_prctl		384
+#define __NR_io_pgetevents	385
+#define __NR_rseq		386
+#define __NR_semget		393
+#define __NR_semctl		394
+#define __NR_shmget		395
+#define __NR_shmctl		396
+#define __NR_shmat		397
+#define __NR_shmdt		398
+#define __NR_msgget		399
+#define __NR_msgsnd		400
+#define __NR_msgrcv		401
+#define __NR_msgctl		402
+#define __NR_clock_gettime64	403
+#define __NR_clock_settime64	404
+#define __NR_clock_adjtime64	405
+#define __NR_clock_getres_time64 406
+#define __NR_clock_nanosleep_time64 407
+#define __NR_timer_gettime64	408
+#define __NR_timer_settime64	409
+#define __NR_timerfd_gettime64	410
+#define __NR_timerfd_settime64	411
+#define __NR_utimensat_time64	412
+#define __NR_pselect6_time64	413
+#define __NR_ppoll_time64	414
+#define __NR_io_pgetevents_time64 416
+#define __NR_recvmmsg_time64	417
+#define __NR_mq_timedsend_time64 418
+#define __NR_mq_timedreceive_time64 419
+#define __NR_semtimedop_time64	420
+#define __NR_rt_sigtimedwait_time64 421
+#define __NR_futex_time64	422
+#define __NR_sched_rr_get_interval_time64 423
+#define __NR_pidfd_send_signal	424
+#define __NR_io_uring_setup	425
+#define __NR_io_uring_enter	426
+#define __NR_io_uring_register	427
+#define __NR_open_tree		428
+#define __NR_move_mount		429
+#define __NR_fsopen		430
+#define __NR_fsconfig		431
+#define __NR_fsmount		432
+#define __NR_fspick		433
+#define __NR_pidfd_open		434
+#define __NR_clone3		435
+#define __NR_close_range	436
+#define __NR_openat2		437
+#define __NR_pidfd_getfd	438
+#define __NR_faccessat2		439
+#define __NR_process_madvise	440
+#define __NR_epoll_pwait2	441
+#define __NR_mount_setattr	442
+#define __NR_landlock_create_ruleset	444
+#define __NR_landlock_add_rule	445
+#define __NR_landlock_restrict_self	446
+#define __NR_memfd_secret	447
+#define __NR_process_mrelease	448
+#define __NR_futex_waitv	449
+#define __NR_set_mempolicy_home_node	450
+#define __NR_cachestat		451
+#define __NR_fchmodat2		452
+
+#define SYS_restart_syscall      0
+#define SYS_exit		  1
+#define SYS_fork		  2
+#define SYS_read		  3
+#define SYS_write		  4
+#define SYS_open		  5
+#define SYS_close		  6
+#define SYS_waitpid		  7
+#define SYS_creat		  8
+#define SYS_link		  9
+#define SYS_unlink		 10
+#define SYS_execve		 11
+#define SYS_chdir		 12
+#define SYS_time		 13
+#define SYS_mknod		 14
+#define SYS_chmod		 15
+#define SYS_lchown		 16
+#define SYS_break		 17
+#define SYS_oldstat		 18
+#define SYS_lseek		 19
+#define SYS_getpid		 20
+#define SYS_mount		 21
+#define SYS_umount		 22
+#define SYS_setuid		 23
+#define SYS_getuid		 24
+#define SYS_stime		 25
+#define SYS_ptrace		 26
+#define SYS_alarm		 27
+#define SYS_oldfstat		 28
+#define SYS_pause		 29
+#define SYS_utime		 30
+#define SYS_stty		 31
+#define SYS_gtty		 32
+#define SYS_access		 33
+#define SYS_nice		 34
+#define SYS_ftime		 35
+#define SYS_sync		 36
+#define SYS_kill		 37
+#define SYS_rename		 38
+#define SYS_mkdir		 39
+#define SYS_rmdir		 40
+#define SYS_dup		 41
+#define SYS_pipe		 42
+#define SYS_times		 43
+#define SYS_prof		 44
+#define SYS_brk		 45
+#define SYS_setgid		 46
+#define SYS_getgid		 47
+#define SYS_signal		 48
+#define SYS_geteuid		 49
+#define SYS_getegid		 50
+#define SYS_acct		 51
+#define SYS_umount2		 52
+#define SYS_lock		 53
+#define SYS_ioctl		 54
+#define SYS_fcntl		 55
+#define SYS_mpx		 56
+#define SYS_setpgid		 57
+#define SYS_ulimit		 58
+#define SYS_oldolduname	 59
+#define SYS_umask		 60
+#define SYS_chroot		 61
+#define SYS_ustat		 62
+#define SYS_dup2		 63
+#define SYS_getppid		 64
+#define SYS_getpgrp		 65
+#define SYS_setsid		 66
+#define SYS_sigaction		 67
+#define SYS_sgetmask		 68
+#define SYS_ssetmask		 69
+#define SYS_setreuid		 70
+#define SYS_setregid		 71
+#define SYS_sigsuspend		 72
+#define SYS_sigpending		 73
+#define SYS_sethostname	 74
+#define SYS_setrlimit		 75
+#define SYS_getrlimit		 76   /* Back compatible 2Gig limited rlimit */
+#define SYS_getrusage		 77
+#define SYS_gettimeofday_time32	 78
+#define SYS_settimeofday_time32	 79
+#define SYS_getgroups		 80
+#define SYS_setgroups		 81
+#define SYS_select		 82
+#define SYS_symlink		 83
+#define SYS_oldlstat		 84
+#define SYS_readlink		 85
+#define SYS_uselib		 86
+#define SYS_swapon		 87
+#define SYS_reboot		 88
+#define SYS_readdir		 89
+#define SYS_mmap		 90
+#define SYS_munmap		 91
+#define SYS_truncate		 92
+#define SYS_ftruncate		 93
+#define SYS_fchmod		 94
+#define SYS_fchown		 95
+#define SYS_getpriority	 96
+#define SYS_setpriority	 97
+#define SYS_profil		 98
+#define SYS_statfs		99
+#define SYS_fstatfs		100
+#define SYS_ioperm		101
+#define SYS_socketcall		102
+#define SYS_syslog		103
+#define SYS_setitimer		104
+#define SYS_getitimer		105
+#define SYS_stat		106
+#define SYS_lstat		107
+#define SYS_fstat		108
+#define SYS_olduname		109
+#define SYS_iopl		110
+#define SYS_vhangup		111
+#define SYS_idle		112
+#define SYS_vm86old		113
+#define SYS_wait4		114
+#define SYS_swapoff		115
+#define SYS_sysinfo		116
+#define SYS_ipc		117
+#define SYS_fsync		118
+#define SYS_sigreturn		119
+#define SYS_clone		120
+#define SYS_setdomainname	121
+#define SYS_uname		122
+#define SYS_modify_ldt		123
+#define SYS_adjtimex		124
+#define SYS_mprotect		125
+#define SYS_sigprocmask	126
+#define SYS_create_module	127
+#define SYS_init_module	128
+#define SYS_delete_module	129
+#define SYS_get_kernel_syms	130
+#define SYS_quotactl		131
+#define SYS_getpgid		132
+#define SYS_fchdir		133
+#define SYS_bdflush		134
+#define SYS_sysfs		135
+#define SYS_personality	136
+#define SYS_afs_syscall	137
+#define SYS_setfsuid		138
+#define SYS_setfsgid		139
+#define SYS__llseek		140
+#define SYS_getdents		141
+#define SYS__newselect		142
+#define SYS_flock		143
+#define SYS_msync		144
+#define SYS_readv		145
+#define SYS_writev		146
+#define SYS_getsid		147
+#define SYS_fdatasync		148
+#define SYS__sysctl		149
+#define SYS_mlock		150
+#define SYS_munlock		151
+#define SYS_mlockall		152
+#define SYS_munlockall		153
+#define SYS_sched_setparam		154
+#define SYS_sched_getparam		155
+#define SYS_sched_setscheduler		156
+#define SYS_sched_getscheduler		157
+#define SYS_sched_yield		158
+#define SYS_sched_get_priority_max	159
+#define SYS_sched_get_priority_min	160
+#define SYS_sched_rr_get_interval	161
+#define SYS_nanosleep		162
+#define SYS_mremap		163
+#define SYS_setresuid		164
+#define SYS_getresuid		165
+#define SYS_vm86		166
+#define SYS_query_module	167
+#define SYS_poll		168
+#define SYS_nfsservctl		169
+#define SYS_setresgid		170
+#define SYS_getresgid		171
+#define SYS_prctl              172
+#define SYS_rt_sigreturn	173
+#define SYS_rt_sigaction	174
+#define SYS_rt_sigprocmask	175
+#define SYS_rt_sigpending	176
+#define SYS_rt_sigtimedwait	177
+#define SYS_rt_sigqueueinfo	178
+#define SYS_rt_sigsuspend	179
+#define SYS_pread64		180
+#define SYS_pwrite64		181
+#define SYS_chown		182
+#define SYS_getcwd		183
+#define SYS_capget		184
+#define SYS_capset		185
+#define SYS_sigaltstack	186
+#define SYS_sendfile		187
+#define SYS_getpmsg		188
+#define SYS_putpmsg		189
+#define SYS_vfork		190
+#define SYS_ugetrlimit		191
+#define SYS_mmap2		192
+#define SYS_truncate64		193
+#define SYS_ftruncate64	194
+#define SYS_stat64		195
+#define SYS_lstat64		196
+#define SYS_fstat64		197
+#define SYS_lchown32		198
+#define SYS_getuid32		199
+#define SYS_getgid32		200
+#define SYS_geteuid32		201
+#define SYS_getegid32		202
+#define SYS_setreuid32		203
+#define SYS_setregid32		204
+#define SYS_getgroups32	205
+#define SYS_setgroups32	206
+#define SYS_fchown32		207
+#define SYS_setresuid32	208
+#define SYS_getresuid32	209
+#define SYS_setresgid32	210
+#define SYS_getresgid32	211
+#define SYS_chown32		212
+#define SYS_setuid32		213
+#define SYS_setgid32		214
+#define SYS_setfsuid32		215
+#define SYS_setfsgid32		216
+#define SYS_pivot_root		217
+#define SYS_mincore		218
+#define SYS_madvise		219
+#define SYS_getdents64		220
+#define SYS_fcntl64		221
+#define SYS_gettid		224
+#define SYS_readahead		225
+#define SYS_setxattr		226
+#define SYS_lsetxattr		227
+#define SYS_fsetxattr		228
+#define SYS_getxattr		229
+#define SYS_lgetxattr		230
+#define SYS_fgetxattr		231
+#define SYS_listxattr		232
+#define SYS_llistxattr		233
+#define SYS_flistxattr		234
+#define SYS_removexattr	235
+#define SYS_lremovexattr	236
+#define SYS_fremovexattr	237
+#define SYS_tkill		238
+#define SYS_sendfile64		239
+#define SYS_futex		240
+#define SYS_sched_setaffinity	241
+#define SYS_sched_getaffinity	242
+#define SYS_set_thread_area	243
+#define SYS_get_thread_area	244
+#define SYS_io_setup		245
+#define SYS_io_destroy		246
+#define SYS_io_getevents	247
+#define SYS_io_submit		248
+#define SYS_io_cancel		249
+#define SYS_fadvise64		250
+#define SYS_exit_group		252
+#define SYS_lookup_dcookie	253
+#define SYS_epoll_create	254
+#define SYS_epoll_ctl		255
+#define SYS_epoll_wait		256
+#define SYS_remap_file_pages	257
+#define SYS_set_tid_address	258
+#define SYS_timer_create	259
+#define SYS_timer_settime32	(__NR_timer_create+1)
+#define SYS_timer_gettime32	(__NR_timer_create+2)
+#define SYS_timer_getoverrun	(__NR_timer_create+3)
+#define SYS_timer_delete	(__NR_timer_create+4)
+#define SYS_clock_settime32	(__NR_timer_create+5)
+#define SYS_clock_gettime32	(__NR_timer_create+6)
+#define SYS_clock_getres_time32	(__NR_timer_create+7)
+#define SYS_clock_nanosleep_time32	(__NR_timer_create+8)
+#define SYS_statfs64		268
+#define SYS_fstatfs64		269
+#define SYS_tgkill		270
+#define SYS_utimes		271
+#define SYS_fadvise64_64	272
+#define SYS_vserver		273
+#define SYS_mbind		274
+#define SYS_get_mempolicy	275
+#define SYS_set_mempolicy	276
+#define SYS_mq_open 		277
+#define SYS_mq_unlink		(__NR_mq_open+1)
+#define SYS_mq_timedsend	(__NR_mq_open+2)
+#define SYS_mq_timedreceive	(__NR_mq_open+3)
+#define SYS_mq_notify		(__NR_mq_open+4)
+#define SYS_mq_getsetattr	(__NR_mq_open+5)
+#define SYS_kexec_load		283
+#define SYS_waitid		284
+/* #define SYS_sys_setaltroot	285 */
+#define SYS_add_key		286
+#define SYS_request_key	287
+#define SYS_keyctl		288
+#define SYS_ioprio_set		289
+#define SYS_ioprio_get		290
+#define SYS_inotify_init	291
+#define SYS_inotify_add_watch	292
+#define SYS_inotify_rm_watch	293
+#define SYS_migrate_pages	294
+#define SYS_openat		295
+#define SYS_mkdirat		296
+#define SYS_mknodat		297
+#define SYS_fchownat		298
+#define SYS_futimesat		299
+#define SYS_fstatat64		300
+#define SYS_unlinkat		301
+#define SYS_renameat		302
+#define SYS_linkat		303
+#define SYS_symlinkat		304
+#define SYS_readlinkat		305
+#define SYS_fchmodat		306
+#define SYS_faccessat		307
+#define SYS_pselect6		308
+#define SYS_ppoll		309
+#define SYS_unshare		310
+#define SYS_set_robust_list	311
+#define SYS_get_robust_list	312
+#define SYS_splice		313
+#define SYS_sync_file_range	314
+#define SYS_tee		315
+#define SYS_vmsplice		316
+#define SYS_move_pages		317
+#define SYS_getcpu		318
+#define SYS_epoll_pwait	319
+#define SYS_utimensat		320
+#define SYS_signalfd		321
+#define SYS_timerfd_create	322
+#define SYS_eventfd		323
+#define SYS_fallocate		324
+#define SYS_timerfd_settime32	325
+#define SYS_timerfd_gettime32	326
+#define SYS_signalfd4		327
+#define SYS_eventfd2		328
+#define SYS_epoll_create1	329
+#define SYS_dup3		330
+#define SYS_pipe2		331
+#define SYS_inotify_init1	332
+#define SYS_preadv		333
+#define SYS_pwritev		334
+#define SYS_rt_tgsigqueueinfo	335
+#define SYS_perf_event_open	336
+#define SYS_recvmmsg		337
+#define SYS_fanotify_init	338
+#define SYS_fanotify_mark	339
+#define SYS_prlimit64		340
+#define SYS_name_to_handle_at	341
+#define SYS_open_by_handle_at	342
+#define SYS_clock_adjtime	343
+#define SYS_syncfs		344
+#define SYS_sendmmsg		345
+#define SYS_setns		346
+#define SYS_process_vm_readv	347
+#define SYS_process_vm_writev	348
+#define SYS_kcmp		349
+#define SYS_finit_module	350
+#define SYS_sched_setattr	351
+#define SYS_sched_getattr	352
+#define SYS_renameat2		353
+#define SYS_seccomp		354
+#define SYS_getrandom		355
+#define SYS_memfd_create	356
+#define SYS_bpf		357
+#define SYS_execveat		358
+#define SYS_socket		359
+#define SYS_socketpair		360
+#define SYS_bind		361
+#define SYS_connect		362
+#define SYS_listen		363
+#define SYS_accept4		364
+#define SYS_getsockopt		365
+#define SYS_setsockopt		366
+#define SYS_getsockname	367
+#define SYS_getpeername	368
+#define SYS_sendto		369
+#define SYS_sendmsg		370
+#define SYS_recvfrom		371
+#define SYS_recvmsg		372
+#define SYS_shutdown		373
+#define SYS_userfaultfd	374
+#define SYS_membarrier		375
+#define SYS_mlock2		376
+#define SYS_copy_file_range	377
+#define SYS_preadv2		378
+#define SYS_pwritev2		379
+#define SYS_pkey_mprotect	380
+#define SYS_pkey_alloc		381
+#define SYS_pkey_free		382
+#define SYS_statx		383
+#define SYS_arch_prctl		384
+#define SYS_io_pgetevents	385
+#define SYS_rseq		386
+#define SYS_semget		393
+#define SYS_semctl		394
+#define SYS_shmget		395
+#define SYS_shmctl		396
+#define SYS_shmat		397
+#define SYS_shmdt		398
+#define SYS_msgget		399
+#define SYS_msgsnd		400
+#define SYS_msgrcv		401
+#define SYS_msgctl		402
+#define SYS_clock_gettime64	403
+#define SYS_clock_settime64	404
+#define SYS_clock_adjtime64	405
+#define SYS_clock_getres_time64 406
+#define SYS_clock_nanosleep_time64 407
+#define SYS_timer_gettime64	408
+#define SYS_timer_settime64	409
+#define SYS_timerfd_gettime64	410
+#define SYS_timerfd_settime64	411
+#define SYS_utimensat_time64	412
+#define SYS_pselect6_time64	413
+#define SYS_ppoll_time64	414
+#define SYS_io_pgetevents_time64 416
+#define SYS_recvmmsg_time64	417
+#define SYS_mq_timedsend_time64 418
+#define SYS_mq_timedreceive_time64 419
+#define SYS_semtimedop_time64	420
+#define SYS_rt_sigtimedwait_time64 421
+#define SYS_futex_time64	422
+#define SYS_sched_rr_get_interval_time64 423
+#define SYS_pidfd_send_signal	424
+#define SYS_io_uring_setup	425
+#define SYS_io_uring_enter	426
+#define SYS_io_uring_register	427
+#define SYS_open_tree		428
+#define SYS_move_mount		429
+#define SYS_fsopen		430
+#define SYS_fsconfig		431
+#define SYS_fsmount		432
+#define SYS_fspick		433
+#define SYS_pidfd_open		434
+#define SYS_clone3		435
+#define SYS_close_range	436
+#define SYS_openat2		437
+#define SYS_pidfd_getfd	438
+#define SYS_faccessat2		439
+#define SYS_process_madvise	440
+#define SYS_epoll_pwait2	441
+#define SYS_mount_setattr	442
+#define SYS_landlock_create_ruleset	444
+#define SYS_landlock_add_rule	445
+#define SYS_landlock_restrict_self	446
+#define SYS_memfd_secret	447
+#define SYS_process_mrelease	448
+#define SYS_futex_waitv	449
+#define SYS_set_mempolicy_home_node	450
+#define SYS_cachestat		451
+#define SYS_fchmodat2		452
diff --git a/musl-include/i386/bits/termios.h b/musl-include/i386/bits/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/termios.h
@@ -0,0 +1,166 @@
+struct termios {
+	tcflag_t c_iflag;
+	tcflag_t c_oflag;
+	tcflag_t c_cflag;
+	tcflag_t c_lflag;
+	cc_t c_line;
+	cc_t c_cc[NCCS];
+	speed_t __c_ispeed;
+	speed_t __c_ospeed;
+};
+
+#define VINTR     0
+#define VQUIT     1
+#define VERASE    2
+#define VKILL     3
+#define VEOF      4
+#define VTIME     5
+#define VMIN      6
+#define VSWTC     7
+#define VSTART    8
+#define VSTOP     9
+#define VSUSP    10
+#define VEOL     11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE  14
+#define VLNEXT   15
+#define VEOL2    16
+
+#define IGNBRK  0000001
+#define BRKINT  0000002
+#define IGNPAR  0000004
+#define PARMRK  0000010
+#define INPCK   0000020
+#define ISTRIP  0000040
+#define INLCR   0000100
+#define IGNCR   0000200
+#define ICRNL   0000400
+#define IUCLC   0001000
+#define IXON    0002000
+#define IXANY   0004000
+#define IXOFF   0010000
+#define IMAXBEL 0020000
+#define IUTF8   0040000
+
+#define OPOST  0000001
+#define OLCUC  0000002
+#define ONLCR  0000004
+#define OCRNL  0000010
+#define ONOCR  0000020
+#define ONLRET 0000040
+#define OFILL  0000100
+#define OFDEL  0000200
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY  0000400
+#define NL0    0000000
+#define NL1    0000400
+#define CRDLY  0003000
+#define CR0    0000000
+#define CR1    0001000
+#define CR2    0002000
+#define CR3    0003000
+#define TABDLY 0014000
+#define TAB0   0000000
+#define TAB1   0004000
+#define TAB2   0010000
+#define TAB3   0014000
+#define BSDLY  0020000
+#define BS0    0000000
+#define BS1    0020000
+#define FFDLY  0100000
+#define FF0    0000000
+#define FF1    0100000
+#endif
+
+#define VTDLY  0040000
+#define VT0    0000000
+#define VT1    0040000
+
+#define B0       0000000
+#define B50      0000001
+#define B75      0000002
+#define B110     0000003
+#define B134     0000004
+#define B150     0000005
+#define B200     0000006
+#define B300     0000007
+#define B600     0000010
+#define B1200    0000011
+#define B1800    0000012
+#define B2400    0000013
+#define B4800    0000014
+#define B9600    0000015
+#define B19200   0000016
+#define B38400   0000017
+
+#define B57600   0010001
+#define B115200  0010002
+#define B230400  0010003
+#define B460800  0010004
+#define B500000  0010005
+#define B576000  0010006
+#define B921600  0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+
+#define CSIZE  0000060
+#define CS5    0000000
+#define CS6    0000020
+#define CS7    0000040
+#define CS8    0000060
+#define CSTOPB 0000100
+#define CREAD  0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL  0002000
+#define CLOCAL 0004000
+
+#define ISIG   0000001
+#define ICANON 0000002
+#define ECHO   0000010
+#define ECHOE  0000020
+#define ECHOK  0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#define IEXTEN 0100000
+
+#define TCOOFF 0
+#define TCOON  1
+#define TCIOFF 2
+#define TCION  3
+
+#define TCIFLUSH  0
+#define TCOFLUSH  1
+#define TCIOFLUSH 2
+
+#define TCSANOW   0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA    0000016
+#define EXTB    0000017
+#define CBAUD   0010017
+#define CBAUDEX 0010000
+#define CIBAUD  002003600000
+#define CMSPAR  010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE   0000004
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE  0004000
+#define FLUSHO  0010000
+#define PENDIN  0040000
+#define EXTPROC 0200000
+
+#define XTABS  0014000
+#endif
diff --git a/musl-include/i386/bits/user.h b/musl-include/i386/bits/user.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/user.h
@@ -0,0 +1,44 @@
+#undef __WORDSIZE
+#define __WORDSIZE 32
+
+typedef struct user_fpregs_struct {
+	long cwd, swd, twd, fip, fcs, foo, fos, st_space[20];
+} elf_fpregset_t;
+
+typedef struct user_fpxregs_struct {
+	unsigned short cwd, swd, twd, fop;
+	long fip, fcs, foo, fos, mxcsr, reserved;
+	long st_space[32], xmm_space[32], padding[56];
+} elf_fpxregset_t;
+
+struct user_regs_struct {
+	long ebx, ecx, edx, esi, edi, ebp, eax, xds, xes, xfs, xgs;
+	long orig_eax, eip, xcs, eflags, esp, xss;
+};
+
+#define ELF_NGREG 17
+typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+
+struct user {
+	struct user_regs_struct		regs;
+	int				u_fpvalid;
+	struct user_fpregs_struct	i387;
+	unsigned long			u_tsize;
+	unsigned long			u_dsize;
+	unsigned long			u_ssize;
+	unsigned long			start_code;
+	unsigned long			start_stack;
+	long				signal;
+	int				reserved;
+	struct user_regs_struct		*u_ar0;
+	struct user_fpregs_struct	*u_fpstate;
+	unsigned long			magic;
+	char				u_comm[32];
+	int				u_debugreg[8];
+};
+
+#define PAGE_MASK		(~(PAGESIZE-1))
+#define NBPG			PAGESIZE
+#define UPAGES			1
+#define HOST_TEXT_START_ADDR	(u.start_code)
+#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
diff --git a/musl-include/i386/bits/vt.h b/musl-include/i386/bits/vt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/bits/vt.h
@@ -0,0 +1,1 @@
+#include <linux/vt.h>
diff --git a/musl-include/i386/byteswap.h b/musl-include/i386/byteswap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/byteswap.h
@@ -0,0 +1,26 @@
+#ifndef _BYTESWAP_H
+#define _BYTESWAP_H
+
+#include <features.h>
+#include <stdint.h>
+
+static __inline uint16_t __bswap_16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap_32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap_64(uint64_t __x)
+{
+	return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
+}
+
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
+
+#endif
diff --git a/musl-include/i386/complex.h b/musl-include/i386/complex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/complex.h
@@ -0,0 +1,133 @@
+#ifndef _COMPLEX_H
+#define _COMPLEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define complex _Complex
+#ifdef __GNUC__
+#define _Complex_I (__extension__ (0.0f+1.0fi))
+#else
+#define _Complex_I (0.0f+1.0fi)
+#endif
+#define I _Complex_I
+
+double complex cacos(double complex);
+float complex cacosf(float complex);
+long double complex cacosl(long double complex);
+
+double complex casin(double complex);
+float complex casinf(float complex);
+long double complex casinl(long double complex);
+
+double complex catan(double complex);
+float complex catanf(float complex);
+long double complex catanl(long double complex);
+
+double complex ccos(double complex);
+float complex ccosf(float complex);
+long double complex ccosl(long double complex);
+
+double complex csin(double complex);
+float complex csinf(float complex);
+long double complex csinl(long double complex);
+
+double complex ctan(double complex);
+float complex ctanf(float complex);
+long double complex ctanl(long double complex);
+
+double complex cacosh(double complex);
+float complex cacoshf(float complex);
+long double complex cacoshl(long double complex);
+
+double complex casinh(double complex);
+float complex casinhf(float complex);
+long double complex casinhl(long double complex);
+
+double complex catanh(double complex);
+float complex catanhf(float complex);
+long double complex catanhl(long double complex);
+
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+long double complex ccoshl(long double complex);
+
+double complex csinh(double complex);
+float complex csinhf(float complex);
+long double complex csinhl(long double complex);
+
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+long double complex ctanhl(long double complex);
+
+double complex cexp(double complex);
+float complex cexpf(float complex);
+long double complex cexpl(long double complex);
+
+double complex clog(double complex);
+float complex clogf(float complex);
+long double complex clogl(long double complex);
+
+double cabs(double complex);
+float cabsf(float complex);
+long double cabsl(long double complex);
+
+double complex cpow(double complex, double complex);
+float complex cpowf(float complex, float complex);
+long double complex cpowl(long double complex, long double complex);
+
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
+long double complex csqrtl(long double complex);
+
+double carg(double complex);
+float cargf(float complex);
+long double cargl(long double complex);
+
+double cimag(double complex);
+float cimagf(float complex);
+long double cimagl(long double complex);
+
+double complex conj(double complex);
+float complex conjf(float complex);
+long double complex conjl(long double complex);
+
+double complex cproj(double complex);
+float complex cprojf(float complex);
+long double complex cprojl(long double complex);
+
+double creal(double complex);
+float crealf(float complex);
+long double creall(long double complex);
+
+#ifndef __cplusplus
+#define __CIMAG(x, t) \
+	(+(union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1])
+
+#define creal(x) ((double)(x))
+#define crealf(x) ((float)(x))
+#define creall(x) ((long double)(x))
+
+#define cimag(x) __CIMAG(x, double)
+#define cimagf(x) __CIMAG(x, float)
+#define cimagl(x) __CIMAG(x, long double)
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#if defined(_Imaginary_I)
+#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I*(t)(y))
+#elif defined(__clang__)
+#define __CMPLX(x, y, t) (+(_Complex t){ (t)(x), (t)(y) })
+#else
+#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y)))
+#endif
+#define CMPLX(x, y) __CMPLX(x, y, double)
+#define CMPLXF(x, y) __CMPLX(x, y, float)
+#define CMPLXL(x, y) __CMPLX(x, y, long double)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/cpio.h b/musl-include/i386/cpio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/cpio.h
@@ -0,0 +1,29 @@
+#ifndef _CPIO_H
+#define _CPIO_H
+
+#define MAGIC "070707"
+
+#define C_IRUSR  000400
+#define C_IWUSR  000200
+#define C_IXUSR  000100
+#define C_IRGRP  000040
+#define C_IWGRP  000020
+#define C_IXGRP  000010
+#define C_IROTH  000004
+#define C_IWOTH  000002
+#define C_IXOTH  000001
+
+#define C_ISUID  004000
+#define C_ISGID  002000
+#define C_ISVTX  001000
+
+#define C_ISBLK  060000
+#define C_ISCHR  020000
+#define C_ISDIR  040000
+#define C_ISFIFO 010000
+#define C_ISSOCK 0140000
+#define C_ISLNK  0120000
+#define C_ISCTG  0110000
+#define C_ISREG  0100000
+
+#endif
diff --git a/musl-include/i386/crypt.h b/musl-include/i386/crypt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/crypt.h
@@ -0,0 +1,20 @@
+#ifndef _CRYPT_H
+#define _CRYPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct crypt_data {
+	int initialized;
+	char __buf[256];
+};
+
+char *crypt(const char *, const char *);
+char *crypt_r(const char *, const char *, struct crypt_data *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/ctype.h b/musl-include/i386/ctype.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/ctype.h
@@ -0,0 +1,77 @@
+#ifndef	_CTYPE_H
+#define	_CTYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+int   isalnum(int);
+int   isalpha(int);
+int   isblank(int);
+int   iscntrl(int);
+int   isdigit(int);
+int   isgraph(int);
+int   islower(int);
+int   isprint(int);
+int   ispunct(int);
+int   isspace(int);
+int   isupper(int);
+int   isxdigit(int);
+int   tolower(int);
+int   toupper(int);
+
+#ifndef __cplusplus
+static __inline int __isspace(int _c)
+{
+	return _c == ' ' || (unsigned)_c-'\t' < 5;
+}
+
+#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a)|32)-'a') < 26)
+#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a)-'0') < 10)
+#define islower(a) (0 ? islower(a) : ((unsigned)(a)-'a') < 26)
+#define isupper(a) (0 ? isupper(a) : ((unsigned)(a)-'A') < 26)
+#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f)
+#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e)
+#define isspace(a) __isspace(a)
+#endif
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define __NEED_locale_t
+#include <bits/alltypes.h>
+
+int   isalnum_l(int, locale_t);
+int   isalpha_l(int, locale_t);
+int   isblank_l(int, locale_t);
+int   iscntrl_l(int, locale_t);
+int   isdigit_l(int, locale_t);
+int   isgraph_l(int, locale_t);
+int   islower_l(int, locale_t);
+int   isprint_l(int, locale_t);
+int   ispunct_l(int, locale_t);
+int   isspace_l(int, locale_t);
+int   isupper_l(int, locale_t);
+int   isxdigit_l(int, locale_t);
+int   tolower_l(int, locale_t);
+int   toupper_l(int, locale_t);
+
+int   isascii(int);
+int   toascii(int);
+#define _tolower(a) ((a)|0x20)
+#define _toupper(a) ((a)&0x5f)
+#ifndef __cplusplus
+#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128)
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/dirent.h b/musl-include/i386/dirent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/dirent.h
@@ -0,0 +1,75 @@
+#ifndef	_DIRENT_H
+#define	_DIRENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ino_t
+#define __NEED_off_t
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/dirent.h>
+
+typedef struct __dirstream DIR;
+
+#define d_fileno d_ino
+
+int            closedir(DIR *);
+DIR           *fdopendir(int);
+DIR           *opendir(const char *);
+struct dirent *readdir(DIR *);
+int            readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict);
+void           rewinddir(DIR *);
+int            dirfd(DIR *);
+
+int alphasort(const struct dirent **, const struct dirent **);
+int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void           seekdir(DIR *, long);
+long           telldir(DIR *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+#define IFTODT(x) ((x)>>12 & 017)
+#define DTTOIF(x) ((x)<<12)
+int getdents(int, struct dirent *, size_t);
+#endif
+
+#ifdef _GNU_SOURCE
+int versionsort(const struct dirent **, const struct dirent **);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define dirent64 dirent
+#define readdir64 readdir
+#define readdir64_r readdir_r
+#define scandir64 scandir
+#define alphasort64 alphasort
+#define versionsort64 versionsort
+#define off64_t off_t
+#define ino64_t ino_t
+#define getdents64 getdents
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/dlfcn.h b/musl-include/i386/dlfcn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/dlfcn.h
@@ -0,0 +1,46 @@
+#ifndef	_DLFCN_H
+#define	_DLFCN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define RTLD_LAZY   1
+#define RTLD_NOW    2
+#define RTLD_NOLOAD 4
+#define RTLD_NODELETE 4096
+#define RTLD_GLOBAL 256
+#define RTLD_LOCAL  0
+
+#define RTLD_NEXT    ((void *)-1)
+#define RTLD_DEFAULT ((void *)0)
+
+#define RTLD_DI_LINKMAP 2
+
+int    dlclose(void *);
+char  *dlerror(void);
+void  *dlopen(const char *, int);
+void  *dlsym(void *__restrict, const char *__restrict);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef struct {
+	const char *dli_fname;
+	void *dli_fbase;
+	const char *dli_sname;
+	void *dli_saddr;
+} Dl_info;
+int dladdr(const void *, Dl_info *);
+int dlinfo(void *, int, void *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(dlsym, __dlsym_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/elf.h b/musl-include/i386/elf.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/elf.h
@@ -0,0 +1,3414 @@
+#ifndef _ELF_H
+#define _ELF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+typedef uint16_t Elf32_Half;
+typedef uint16_t Elf64_Half;
+
+typedef uint32_t Elf32_Word;
+typedef	int32_t  Elf32_Sword;
+typedef uint32_t Elf64_Word;
+typedef	int32_t  Elf64_Sword;
+
+typedef uint64_t Elf32_Xword;
+typedef	int64_t  Elf32_Sxword;
+typedef uint64_t Elf64_Xword;
+typedef	int64_t  Elf64_Sxword;
+
+typedef uint32_t Elf32_Addr;
+typedef uint64_t Elf64_Addr;
+
+typedef uint32_t Elf32_Off;
+typedef uint64_t Elf64_Off;
+
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+
+typedef Elf32_Half Elf32_Versym;
+typedef Elf64_Half Elf64_Versym;
+
+#define EI_NIDENT (16)
+
+typedef struct {
+  unsigned char	e_ident[EI_NIDENT];
+  Elf32_Half	e_type;
+  Elf32_Half	e_machine;
+  Elf32_Word	e_version;
+  Elf32_Addr	e_entry;
+  Elf32_Off	e_phoff;
+  Elf32_Off	e_shoff;
+  Elf32_Word	e_flags;
+  Elf32_Half	e_ehsize;
+  Elf32_Half	e_phentsize;
+  Elf32_Half	e_phnum;
+  Elf32_Half	e_shentsize;
+  Elf32_Half	e_shnum;
+  Elf32_Half	e_shstrndx;
+} Elf32_Ehdr;
+
+typedef struct {
+  unsigned char	e_ident[EI_NIDENT];
+  Elf64_Half	e_type;
+  Elf64_Half	e_machine;
+  Elf64_Word	e_version;
+  Elf64_Addr	e_entry;
+  Elf64_Off	e_phoff;
+  Elf64_Off	e_shoff;
+  Elf64_Word	e_flags;
+  Elf64_Half	e_ehsize;
+  Elf64_Half	e_phentsize;
+  Elf64_Half	e_phnum;
+  Elf64_Half	e_shentsize;
+  Elf64_Half	e_shnum;
+  Elf64_Half	e_shstrndx;
+} Elf64_Ehdr;
+
+#define EI_MAG0		0
+#define ELFMAG0		0x7f
+
+#define EI_MAG1		1
+#define ELFMAG1		'E'
+
+#define EI_MAG2		2
+#define ELFMAG2		'L'
+
+#define EI_MAG3		3
+#define ELFMAG3		'F'
+
+
+#define	ELFMAG		"\177ELF"
+#define	SELFMAG		4
+
+#define EI_CLASS	4
+#define ELFCLASSNONE	0
+#define ELFCLASS32	1
+#define ELFCLASS64	2
+#define ELFCLASSNUM	3
+
+#define EI_DATA		5
+#define ELFDATANONE	0
+#define ELFDATA2LSB	1
+#define ELFDATA2MSB	2
+#define ELFDATANUM	3
+
+#define EI_VERSION	6
+
+
+#define EI_OSABI	7
+#define ELFOSABI_NONE		0
+#define ELFOSABI_SYSV		0
+#define ELFOSABI_HPUX		1
+#define ELFOSABI_NETBSD		2
+#define ELFOSABI_LINUX		3
+#define ELFOSABI_GNU		3
+#define ELFOSABI_SOLARIS	6
+#define ELFOSABI_AIX		7
+#define ELFOSABI_IRIX		8
+#define ELFOSABI_FREEBSD	9
+#define ELFOSABI_TRU64		10
+#define ELFOSABI_MODESTO	11
+#define ELFOSABI_OPENBSD	12
+#define ELFOSABI_ARM		97
+#define ELFOSABI_STANDALONE	255
+
+#define EI_ABIVERSION	8
+
+#define EI_PAD		9
+
+
+
+#define ET_NONE		0
+#define ET_REL		1
+#define ET_EXEC		2
+#define ET_DYN		3
+#define ET_CORE		4
+#define	ET_NUM		5
+#define ET_LOOS		0xfe00
+#define ET_HIOS		0xfeff
+#define ET_LOPROC	0xff00
+#define ET_HIPROC	0xffff
+
+
+
+#define EM_NONE		 0
+#define EM_M32		 1
+#define EM_SPARC	 2
+#define EM_386		 3
+#define EM_68K		 4
+#define EM_88K		 5
+#define EM_860		 7
+#define EM_MIPS		 8
+#define EM_S370		 9
+#define EM_MIPS_RS3_LE	10
+
+#define EM_PARISC	15
+#define EM_VPP500	17
+#define EM_SPARC32PLUS	18
+#define EM_960		19
+#define EM_PPC		20
+#define EM_PPC64	21
+#define EM_S390		22
+
+#define EM_V800		36
+#define EM_FR20		37
+#define EM_RH32		38
+#define EM_RCE		39
+#define EM_ARM		40
+#define EM_FAKE_ALPHA	41
+#define EM_SH		42
+#define EM_SPARCV9	43
+#define EM_TRICORE	44
+#define EM_ARC		45
+#define EM_H8_300	46
+#define EM_H8_300H	47
+#define EM_H8S		48
+#define EM_H8_500	49
+#define EM_IA_64	50
+#define EM_MIPS_X	51
+#define EM_COLDFIRE	52
+#define EM_68HC12	53
+#define EM_MMA		54
+#define EM_PCP		55
+#define EM_NCPU		56
+#define EM_NDR1		57
+#define EM_STARCORE	58
+#define EM_ME16		59
+#define EM_ST100	60
+#define EM_TINYJ	61
+#define EM_X86_64	62
+#define EM_PDSP		63
+
+#define EM_FX66		66
+#define EM_ST9PLUS	67
+#define EM_ST7		68
+#define EM_68HC16	69
+#define EM_68HC11	70
+#define EM_68HC08	71
+#define EM_68HC05	72
+#define EM_SVX		73
+#define EM_ST19		74
+#define EM_VAX		75
+#define EM_CRIS		76
+#define EM_JAVELIN	77
+#define EM_FIREPATH	78
+#define EM_ZSP		79
+#define EM_MMIX		80
+#define EM_HUANY	81
+#define EM_PRISM	82
+#define EM_AVR		83
+#define EM_FR30		84
+#define EM_D10V		85
+#define EM_D30V		86
+#define EM_V850		87
+#define EM_M32R		88
+#define EM_MN10300	89
+#define EM_MN10200	90
+#define EM_PJ		91
+#define EM_OR1K		92
+#define EM_OPENRISC	92
+#define EM_ARC_A5	93
+#define EM_ARC_COMPACT	93
+#define EM_XTENSA	94
+#define EM_VIDEOCORE	95
+#define EM_TMM_GPP	96
+#define EM_NS32K	97
+#define EM_TPC		98
+#define EM_SNP1K	99
+#define EM_ST200	100
+#define EM_IP2K		101
+#define EM_MAX		102
+#define EM_CR		103
+#define EM_F2MC16	104
+#define EM_MSP430	105
+#define EM_BLACKFIN	106
+#define EM_SE_C33	107
+#define EM_SEP		108
+#define EM_ARCA		109
+#define EM_UNICORE	110
+#define EM_EXCESS	111
+#define EM_DXP		112
+#define EM_ALTERA_NIOS2 113
+#define EM_CRX		114
+#define EM_XGATE	115
+#define EM_C166		116
+#define EM_M16C		117
+#define EM_DSPIC30F	118
+#define EM_CE		119
+#define EM_M32C		120
+#define EM_TSK3000	131
+#define EM_RS08		132
+#define EM_SHARC	133
+#define EM_ECOG2	134
+#define EM_SCORE7	135
+#define EM_DSP24	136
+#define EM_VIDEOCORE3	137
+#define EM_LATTICEMICO32 138
+#define EM_SE_C17	139
+#define EM_TI_C6000	140
+#define EM_TI_C2000	141
+#define EM_TI_C5500	142
+#define EM_TI_ARP32	143
+#define EM_TI_PRU	144
+#define EM_MMDSP_PLUS	160
+#define EM_CYPRESS_M8C	161
+#define EM_R32C		162
+#define EM_TRIMEDIA	163
+#define EM_QDSP6	164
+#define EM_8051		165
+#define EM_STXP7X	166
+#define EM_NDS32	167
+#define EM_ECOG1X	168
+#define EM_MAXQ30	169
+#define EM_XIMO16	170
+#define EM_MANIK	171
+#define EM_CRAYNV2	172
+#define EM_RX		173
+#define EM_METAG	174
+#define EM_MCST_ELBRUS	175
+#define EM_ECOG16	176
+#define EM_CR16		177
+#define EM_ETPU		178
+#define EM_SLE9X	179
+#define EM_L10M		180
+#define EM_K10M		181
+#define EM_AARCH64	183
+#define EM_AVR32	185
+#define EM_STM8		186
+#define EM_TILE64	187
+#define EM_TILEPRO	188
+#define EM_MICROBLAZE	189
+#define EM_CUDA		190
+#define EM_TILEGX	191
+#define EM_CLOUDSHIELD	192
+#define EM_COREA_1ST	193
+#define EM_COREA_2ND	194
+#define EM_ARC_COMPACT2	195
+#define EM_OPEN8	196
+#define EM_RL78		197
+#define EM_VIDEOCORE5	198
+#define EM_78KOR	199
+#define EM_56800EX	200
+#define EM_BA1		201
+#define EM_BA2		202
+#define EM_XCORE	203
+#define EM_MCHP_PIC	204
+#define EM_KM32		210
+#define EM_KMX32	211
+#define EM_EMX16	212
+#define EM_EMX8		213
+#define EM_KVARC	214
+#define EM_CDP		215
+#define EM_COGE		216
+#define EM_COOL		217
+#define EM_NORC		218
+#define EM_CSR_KALIMBA	219
+#define EM_Z80		220
+#define EM_VISIUM	221
+#define EM_FT32		222
+#define EM_MOXIE	223
+#define EM_AMDGPU	224
+#define EM_RISCV	243
+#define EM_BPF		247
+#define EM_CSKY		252
+#define EM_LOONGARCH	258
+#define EM_NUM		259
+
+#define EM_ALPHA	0x9026
+
+#define EV_NONE		0
+#define EV_CURRENT	1
+#define EV_NUM		2
+
+typedef struct {
+  Elf32_Word	sh_name;
+  Elf32_Word	sh_type;
+  Elf32_Word	sh_flags;
+  Elf32_Addr	sh_addr;
+  Elf32_Off	sh_offset;
+  Elf32_Word	sh_size;
+  Elf32_Word	sh_link;
+  Elf32_Word	sh_info;
+  Elf32_Word	sh_addralign;
+  Elf32_Word	sh_entsize;
+} Elf32_Shdr;
+
+typedef struct {
+  Elf64_Word	sh_name;
+  Elf64_Word	sh_type;
+  Elf64_Xword	sh_flags;
+  Elf64_Addr	sh_addr;
+  Elf64_Off	sh_offset;
+  Elf64_Xword	sh_size;
+  Elf64_Word	sh_link;
+  Elf64_Word	sh_info;
+  Elf64_Xword	sh_addralign;
+  Elf64_Xword	sh_entsize;
+} Elf64_Shdr;
+
+
+
+#define SHN_UNDEF	0
+#define SHN_LORESERVE	0xff00
+#define SHN_LOPROC	0xff00
+#define SHN_BEFORE	0xff00
+
+#define SHN_AFTER	0xff01
+
+#define SHN_HIPROC	0xff1f
+#define SHN_LOOS	0xff20
+#define SHN_HIOS	0xff3f
+#define SHN_ABS		0xfff1
+#define SHN_COMMON	0xfff2
+#define SHN_XINDEX	0xffff
+#define SHN_HIRESERVE	0xffff
+
+
+
+#define SHT_NULL	  0
+#define SHT_PROGBITS	  1
+#define SHT_SYMTAB	  2
+#define SHT_STRTAB	  3
+#define SHT_RELA	  4
+#define SHT_HASH	  5
+#define SHT_DYNAMIC	  6
+#define SHT_NOTE	  7
+#define SHT_NOBITS	  8
+#define SHT_REL		  9
+#define SHT_SHLIB	  10
+#define SHT_DYNSYM	  11
+#define SHT_INIT_ARRAY	  14
+#define SHT_FINI_ARRAY	  15
+#define SHT_PREINIT_ARRAY 16
+#define SHT_GROUP	  17
+#define SHT_SYMTAB_SHNDX  18
+#define SHT_RELR	  19
+#define	SHT_NUM		  20
+#define SHT_LOOS	  0x60000000
+#define SHT_GNU_ATTRIBUTES 0x6ffffff5
+#define SHT_GNU_HASH	  0x6ffffff6
+#define SHT_GNU_LIBLIST	  0x6ffffff7
+#define SHT_CHECKSUM	  0x6ffffff8
+#define SHT_LOSUNW	  0x6ffffffa
+#define SHT_SUNW_move	  0x6ffffffa
+#define SHT_SUNW_COMDAT   0x6ffffffb
+#define SHT_SUNW_syminfo  0x6ffffffc
+#define SHT_GNU_verdef	  0x6ffffffd
+#define SHT_GNU_verneed	  0x6ffffffe
+#define SHT_GNU_versym	  0x6fffffff
+#define SHT_HISUNW	  0x6fffffff
+#define SHT_HIOS	  0x6fffffff
+#define SHT_LOPROC	  0x70000000
+#define SHT_HIPROC	  0x7fffffff
+#define SHT_LOUSER	  0x80000000
+#define SHT_HIUSER	  0x8fffffff
+
+#define SHF_WRITE	     (1 << 0)
+#define SHF_ALLOC	     (1 << 1)
+#define SHF_EXECINSTR	     (1 << 2)
+#define SHF_MERGE	     (1 << 4)
+#define SHF_STRINGS	     (1 << 5)
+#define SHF_INFO_LINK	     (1 << 6)
+#define SHF_LINK_ORDER	     (1 << 7)
+#define SHF_OS_NONCONFORMING (1 << 8)
+
+#define SHF_GROUP	     (1 << 9)
+#define SHF_TLS		     (1 << 10)
+#define SHF_COMPRESSED	     (1 << 11)
+#define SHF_MASKOS	     0x0ff00000
+#define SHF_MASKPROC	     0xf0000000
+#define SHF_ORDERED	     (1 << 30)
+#define SHF_EXCLUDE	     (1U << 31)
+
+typedef struct {
+  Elf32_Word	ch_type;
+  Elf32_Word	ch_size;
+  Elf32_Word	ch_addralign;
+} Elf32_Chdr;
+
+typedef struct {
+  Elf64_Word	ch_type;
+  Elf64_Word	ch_reserved;
+  Elf64_Xword	ch_size;
+  Elf64_Xword	ch_addralign;
+} Elf64_Chdr;
+
+#define ELFCOMPRESS_ZLIB	1
+#define ELFCOMPRESS_ZSTD	2
+#define ELFCOMPRESS_LOOS	0x60000000
+#define ELFCOMPRESS_HIOS	0x6fffffff
+#define ELFCOMPRESS_LOPROC	0x70000000
+#define ELFCOMPRESS_HIPROC	0x7fffffff
+
+
+#define GRP_COMDAT	0x1
+
+typedef struct {
+  Elf32_Word	st_name;
+  Elf32_Addr	st_value;
+  Elf32_Word	st_size;
+  unsigned char	st_info;
+  unsigned char	st_other;
+  Elf32_Section	st_shndx;
+} Elf32_Sym;
+
+typedef struct {
+  Elf64_Word	st_name;
+  unsigned char	st_info;
+  unsigned char st_other;
+  Elf64_Section	st_shndx;
+  Elf64_Addr	st_value;
+  Elf64_Xword	st_size;
+} Elf64_Sym;
+
+typedef struct {
+  Elf32_Half si_boundto;
+  Elf32_Half si_flags;
+} Elf32_Syminfo;
+
+typedef struct {
+  Elf64_Half si_boundto;
+  Elf64_Half si_flags;
+} Elf64_Syminfo;
+
+#define SYMINFO_BT_SELF		0xffff
+#define SYMINFO_BT_PARENT	0xfffe
+#define SYMINFO_BT_LOWRESERVE	0xff00
+
+#define SYMINFO_FLG_DIRECT	0x0001
+#define SYMINFO_FLG_PASSTHRU	0x0002
+#define SYMINFO_FLG_COPY	0x0004
+#define SYMINFO_FLG_LAZYLOAD	0x0008
+
+#define SYMINFO_NONE		0
+#define SYMINFO_CURRENT		1
+#define SYMINFO_NUM		2
+
+#define ELF32_ST_BIND(val)		(((unsigned char) (val)) >> 4)
+#define ELF32_ST_TYPE(val)		((val) & 0xf)
+#define ELF32_ST_INFO(bind, type)	(((bind) << 4) + ((type) & 0xf))
+
+#define ELF64_ST_BIND(val)		ELF32_ST_BIND (val)
+#define ELF64_ST_TYPE(val)		ELF32_ST_TYPE (val)
+#define ELF64_ST_INFO(bind, type)	ELF32_ST_INFO ((bind), (type))
+
+#define STB_LOCAL	0
+#define STB_GLOBAL	1
+#define STB_WEAK	2
+#define	STB_NUM		3
+#define STB_LOOS	10
+#define STB_GNU_UNIQUE	10
+#define STB_HIOS	12
+#define STB_LOPROC	13
+#define STB_HIPROC	15
+
+#define STT_NOTYPE	0
+#define STT_OBJECT	1
+#define STT_FUNC	2
+#define STT_SECTION	3
+#define STT_FILE	4
+#define STT_COMMON	5
+#define STT_TLS		6
+#define	STT_NUM		7
+#define STT_LOOS	10
+#define STT_GNU_IFUNC	10
+#define STT_HIOS	12
+#define STT_LOPROC	13
+#define STT_HIPROC	15
+
+#define STN_UNDEF	0
+
+#define ELF32_ST_VISIBILITY(o)	((o) & 0x03)
+#define ELF64_ST_VISIBILITY(o)	ELF32_ST_VISIBILITY (o)
+
+#define STV_DEFAULT	0
+#define STV_INTERNAL	1
+#define STV_HIDDEN	2
+#define STV_PROTECTED	3
+
+
+
+
+typedef struct {
+  Elf32_Addr	r_offset;
+  Elf32_Word	r_info;
+} Elf32_Rel;
+
+typedef struct {
+  Elf64_Addr	r_offset;
+  Elf64_Xword	r_info;
+} Elf64_Rel;
+
+
+
+typedef struct {
+  Elf32_Addr	r_offset;
+  Elf32_Word	r_info;
+  Elf32_Sword	r_addend;
+} Elf32_Rela;
+
+typedef struct {
+  Elf64_Addr	r_offset;
+  Elf64_Xword	r_info;
+  Elf64_Sxword	r_addend;
+} Elf64_Rela;
+
+
+
+typedef Elf32_Word Elf32_Relr;
+typedef Elf64_Xword Elf64_Relr;
+
+
+
+#define ELF32_R_SYM(val)		((val) >> 8)
+#define ELF32_R_TYPE(val)		((val) & 0xff)
+#define ELF32_R_INFO(sym, type)		(((sym) << 8) + ((type) & 0xff))
+
+#define ELF64_R_SYM(i)			((i) >> 32)
+#define ELF64_R_TYPE(i)			((i) & 0xffffffff)
+#define ELF64_R_INFO(sym,type)		((((Elf64_Xword) (sym)) << 32) + (type))
+
+
+
+typedef struct {
+  Elf32_Word	p_type;
+  Elf32_Off	p_offset;
+  Elf32_Addr	p_vaddr;
+  Elf32_Addr	p_paddr;
+  Elf32_Word	p_filesz;
+  Elf32_Word	p_memsz;
+  Elf32_Word	p_flags;
+  Elf32_Word	p_align;
+} Elf32_Phdr;
+
+typedef struct {
+  Elf64_Word	p_type;
+  Elf64_Word	p_flags;
+  Elf64_Off	p_offset;
+  Elf64_Addr	p_vaddr;
+  Elf64_Addr	p_paddr;
+  Elf64_Xword	p_filesz;
+  Elf64_Xword	p_memsz;
+  Elf64_Xword	p_align;
+} Elf64_Phdr;
+
+
+
+#define	PT_NULL		0
+#define PT_LOAD		1
+#define PT_DYNAMIC	2
+#define PT_INTERP	3
+#define PT_NOTE		4
+#define PT_SHLIB	5
+#define PT_PHDR		6
+#define PT_TLS		7
+#define	PT_NUM		8
+#define PT_LOOS		0x60000000
+#define PT_GNU_EH_FRAME	0x6474e550
+#define PT_GNU_STACK	0x6474e551
+#define PT_GNU_RELRO	0x6474e552
+#define PT_GNU_PROPERTY	0x6474e553
+#define PT_LOSUNW	0x6ffffffa
+#define PT_SUNWBSS	0x6ffffffa
+#define PT_SUNWSTACK	0x6ffffffb
+#define PT_HISUNW	0x6fffffff
+#define PT_HIOS		0x6fffffff
+#define PT_LOPROC	0x70000000
+#define PT_HIPROC	0x7fffffff
+
+
+#define PN_XNUM 0xffff
+
+
+#define PF_X		(1 << 0)
+#define PF_W		(1 << 1)
+#define PF_R		(1 << 2)
+#define PF_MASKOS	0x0ff00000
+#define PF_MASKPROC	0xf0000000
+
+
+
+#define NT_PRSTATUS	1
+#define NT_PRFPREG	2
+#define NT_FPREGSET	2
+#define NT_PRPSINFO	3
+#define NT_PRXREG	4
+#define NT_TASKSTRUCT	4
+#define NT_PLATFORM	5
+#define NT_AUXV		6
+#define NT_GWINDOWS	7
+#define NT_ASRS		8
+#define NT_PSTATUS	10
+#define NT_PSINFO	13
+#define NT_PRCRED	14
+#define NT_UTSNAME	15
+#define NT_LWPSTATUS	16
+#define NT_LWPSINFO	17
+#define NT_PRFPXREG	20
+#define NT_SIGINFO	0x53494749
+#define NT_FILE		0x46494c45
+#define NT_PRXFPREG	0x46e62b7f
+#define NT_PPC_VMX	0x100
+#define NT_PPC_SPE	0x101
+#define NT_PPC_VSX	0x102
+#define NT_PPC_TAR	0x103
+#define NT_PPC_PPR	0x104
+#define NT_PPC_DSCR	0x105
+#define NT_PPC_EBB	0x106
+#define NT_PPC_PMU	0x107
+#define NT_PPC_TM_CGPR	0x108
+#define NT_PPC_TM_CFPR	0x109
+#define NT_PPC_TM_CVMX	0x10a
+#define NT_PPC_TM_CVSX	0x10b
+#define NT_PPC_TM_SPR	0x10c
+#define NT_PPC_TM_CTAR	0x10d
+#define NT_PPC_TM_CPPR	0x10e
+#define NT_PPC_TM_CDSCR	0x10f
+#define NT_386_TLS	0x200
+#define NT_386_IOPERM	0x201
+#define NT_X86_XSTATE	0x202
+#define NT_S390_HIGH_GPRS	0x300
+#define NT_S390_TIMER	0x301
+#define NT_S390_TODCMP	0x302
+#define NT_S390_TODPREG	0x303
+#define NT_S390_CTRS	0x304
+#define NT_S390_PREFIX	0x305
+#define NT_S390_LAST_BREAK	0x306
+#define NT_S390_SYSTEM_CALL	0x307
+#define NT_S390_TDB	0x308
+#define NT_S390_VXRS_LOW	0x309
+#define NT_S390_VXRS_HIGH	0x30a
+#define NT_S390_GS_CB	0x30b
+#define NT_S390_GS_BC	0x30c
+#define NT_S390_RI_CB	0x30d
+#define NT_ARM_VFP	0x400
+#define NT_ARM_TLS	0x401
+#define NT_ARM_HW_BREAK	0x402
+#define NT_ARM_HW_WATCH	0x403
+#define NT_ARM_SYSTEM_CALL	0x404
+#define NT_ARM_SVE	0x405
+#define NT_ARM_PAC_MASK	0x406
+#define NT_ARM_PACA_KEYS	0x407
+#define NT_ARM_PACG_KEYS	0x408
+#define NT_ARM_TAGGED_ADDR_CTRL	0x409
+#define NT_ARM_PAC_ENABLED_KEYS	0x40a
+#define NT_METAG_CBUF	0x500
+#define NT_METAG_RPIPE	0x501
+#define NT_METAG_TLS	0x502
+#define NT_ARC_V2	0x600
+#define NT_VMCOREDD	0x700
+#define NT_MIPS_DSP	0x800
+#define NT_MIPS_FP_MODE	0x801
+#define NT_MIPS_MSA	0x802
+#define NT_RISCV_CSR	0x900
+#define NT_RISCV_VECTOR	0x901
+#define NT_VERSION	1
+#define NT_LOONGARCH_CPUCFG	0xa00
+#define NT_LOONGARCH_CSR	0xa01
+#define NT_LOONGARCH_LSX	0xa02
+#define NT_LOONGARCH_LASX	0xa03
+#define NT_LOONGARCH_LBT	0xa04
+
+
+
+
+typedef struct {
+  Elf32_Sword d_tag;
+  union {
+      Elf32_Word d_val;
+      Elf32_Addr d_ptr;
+  } d_un;
+} Elf32_Dyn;
+
+typedef struct {
+  Elf64_Sxword d_tag;
+  union {
+      Elf64_Xword d_val;
+      Elf64_Addr d_ptr;
+  } d_un;
+} Elf64_Dyn;
+
+
+
+#define DT_NULL		0
+#define DT_NEEDED	1
+#define DT_PLTRELSZ	2
+#define DT_PLTGOT	3
+#define DT_HASH		4
+#define DT_STRTAB	5
+#define DT_SYMTAB	6
+#define DT_RELA		7
+#define DT_RELASZ	8
+#define DT_RELAENT	9
+#define DT_STRSZ	10
+#define DT_SYMENT	11
+#define DT_INIT		12
+#define DT_FINI		13
+#define DT_SONAME	14
+#define DT_RPATH	15
+#define DT_SYMBOLIC	16
+#define DT_REL		17
+#define DT_RELSZ	18
+#define DT_RELENT	19
+#define DT_PLTREL	20
+#define DT_DEBUG	21
+#define DT_TEXTREL	22
+#define DT_JMPREL	23
+#define	DT_BIND_NOW	24
+#define	DT_INIT_ARRAY	25
+#define	DT_FINI_ARRAY	26
+#define	DT_INIT_ARRAYSZ	27
+#define	DT_FINI_ARRAYSZ	28
+#define DT_RUNPATH	29
+#define DT_FLAGS	30
+#define DT_ENCODING	32
+#define DT_PREINIT_ARRAY 32
+#define DT_PREINIT_ARRAYSZ 33
+#define DT_SYMTAB_SHNDX	34
+#define DT_RELRSZ	35
+#define DT_RELR		36
+#define DT_RELRENT	37
+#define	DT_NUM		38
+#define DT_LOOS		0x6000000d
+#define DT_HIOS		0x6ffff000
+#define DT_LOPROC	0x70000000
+#define DT_HIPROC	0x7fffffff
+#define	DT_PROCNUM	DT_MIPS_NUM
+
+#define DT_VALRNGLO	0x6ffffd00
+#define DT_GNU_PRELINKED 0x6ffffdf5
+#define DT_GNU_CONFLICTSZ 0x6ffffdf6
+#define DT_GNU_LIBLISTSZ 0x6ffffdf7
+#define DT_CHECKSUM	0x6ffffdf8
+#define DT_PLTPADSZ	0x6ffffdf9
+#define DT_MOVEENT	0x6ffffdfa
+#define DT_MOVESZ	0x6ffffdfb
+#define DT_FEATURE_1	0x6ffffdfc
+#define DT_POSFLAG_1	0x6ffffdfd
+
+#define DT_SYMINSZ	0x6ffffdfe
+#define DT_SYMINENT	0x6ffffdff
+#define DT_VALRNGHI	0x6ffffdff
+#define DT_VALTAGIDX(tag)	(DT_VALRNGHI - (tag))
+#define DT_VALNUM 12
+
+#define DT_ADDRRNGLO	0x6ffffe00
+#define DT_GNU_HASH	0x6ffffef5
+#define DT_TLSDESC_PLT	0x6ffffef6
+#define DT_TLSDESC_GOT	0x6ffffef7
+#define DT_GNU_CONFLICT	0x6ffffef8
+#define DT_GNU_LIBLIST	0x6ffffef9
+#define DT_CONFIG	0x6ffffefa
+#define DT_DEPAUDIT	0x6ffffefb
+#define DT_AUDIT	0x6ffffefc
+#define	DT_PLTPAD	0x6ffffefd
+#define	DT_MOVETAB	0x6ffffefe
+#define DT_SYMINFO	0x6ffffeff
+#define DT_ADDRRNGHI	0x6ffffeff
+#define DT_ADDRTAGIDX(tag)	(DT_ADDRRNGHI - (tag))
+#define DT_ADDRNUM 11
+
+
+
+#define DT_VERSYM	0x6ffffff0
+
+#define DT_RELACOUNT	0x6ffffff9
+#define DT_RELCOUNT	0x6ffffffa
+
+
+#define DT_FLAGS_1	0x6ffffffb
+#define	DT_VERDEF	0x6ffffffc
+
+#define	DT_VERDEFNUM	0x6ffffffd
+#define	DT_VERNEED	0x6ffffffe
+
+#define	DT_VERNEEDNUM	0x6fffffff
+#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))
+#define DT_VERSIONTAGNUM 16
+
+
+
+#define DT_AUXILIARY    0x7ffffffd
+#define DT_FILTER       0x7fffffff
+#define DT_EXTRATAGIDX(tag)	((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
+#define DT_EXTRANUM	3
+
+
+#define DF_ORIGIN	0x00000001
+#define DF_SYMBOLIC	0x00000002
+#define DF_TEXTREL	0x00000004
+#define DF_BIND_NOW	0x00000008
+#define DF_STATIC_TLS	0x00000010
+
+
+
+#define DF_1_NOW	0x00000001
+#define DF_1_GLOBAL	0x00000002
+#define DF_1_GROUP	0x00000004
+#define DF_1_NODELETE	0x00000008
+#define DF_1_LOADFLTR	0x00000010
+#define DF_1_INITFIRST	0x00000020
+#define DF_1_NOOPEN	0x00000040
+#define DF_1_ORIGIN	0x00000080
+#define DF_1_DIRECT	0x00000100
+#define DF_1_TRANS	0x00000200
+#define DF_1_INTERPOSE	0x00000400
+#define DF_1_NODEFLIB	0x00000800
+#define DF_1_NODUMP	0x00001000
+#define DF_1_CONFALT	0x00002000
+#define DF_1_ENDFILTEE	0x00004000
+#define	DF_1_DISPRELDNE	0x00008000
+#define	DF_1_DISPRELPND	0x00010000
+#define	DF_1_NODIRECT	0x00020000
+#define	DF_1_IGNMULDEF	0x00040000
+#define	DF_1_NOKSYMS	0x00080000
+#define	DF_1_NOHDR	0x00100000
+#define	DF_1_EDITED	0x00200000
+#define	DF_1_NORELOC	0x00400000
+#define	DF_1_SYMINTPOSE	0x00800000
+#define	DF_1_GLOBAUDIT	0x01000000
+#define	DF_1_SINGLETON	0x02000000
+#define	DF_1_STUB	0x04000000
+#define	DF_1_PIE	0x08000000
+
+#define DTF_1_PARINIT	0x00000001
+#define DTF_1_CONFEXP	0x00000002
+
+
+#define DF_P1_LAZYLOAD	0x00000001
+#define DF_P1_GROUPPERM	0x00000002
+
+
+
+
+typedef struct {
+  Elf32_Half	vd_version;
+  Elf32_Half	vd_flags;
+  Elf32_Half	vd_ndx;
+  Elf32_Half	vd_cnt;
+  Elf32_Word	vd_hash;
+  Elf32_Word	vd_aux;
+  Elf32_Word	vd_next;
+} Elf32_Verdef;
+
+typedef struct {
+  Elf64_Half	vd_version;
+  Elf64_Half	vd_flags;
+  Elf64_Half	vd_ndx;
+  Elf64_Half	vd_cnt;
+  Elf64_Word	vd_hash;
+  Elf64_Word	vd_aux;
+  Elf64_Word	vd_next;
+} Elf64_Verdef;
+
+
+
+#define VER_DEF_NONE	0
+#define VER_DEF_CURRENT	1
+#define VER_DEF_NUM	2
+
+
+#define VER_FLG_BASE	0x1
+#define VER_FLG_WEAK	0x2
+
+
+#define	VER_NDX_LOCAL		0
+#define	VER_NDX_GLOBAL		1
+#define	VER_NDX_LORESERVE	0xff00
+#define	VER_NDX_ELIMINATE	0xff01
+
+
+
+typedef struct {
+  Elf32_Word	vda_name;
+  Elf32_Word	vda_next;
+} Elf32_Verdaux;
+
+typedef struct {
+  Elf64_Word	vda_name;
+  Elf64_Word	vda_next;
+} Elf64_Verdaux;
+
+
+
+
+typedef struct {
+  Elf32_Half	vn_version;
+  Elf32_Half	vn_cnt;
+  Elf32_Word	vn_file;
+  Elf32_Word	vn_aux;
+  Elf32_Word	vn_next;
+} Elf32_Verneed;
+
+typedef struct {
+  Elf64_Half	vn_version;
+  Elf64_Half	vn_cnt;
+  Elf64_Word	vn_file;
+  Elf64_Word	vn_aux;
+  Elf64_Word	vn_next;
+} Elf64_Verneed;
+
+
+
+#define VER_NEED_NONE	 0
+#define VER_NEED_CURRENT 1
+#define VER_NEED_NUM	 2
+
+
+
+typedef struct {
+  Elf32_Word	vna_hash;
+  Elf32_Half	vna_flags;
+  Elf32_Half	vna_other;
+  Elf32_Word	vna_name;
+  Elf32_Word	vna_next;
+} Elf32_Vernaux;
+
+typedef struct {
+  Elf64_Word	vna_hash;
+  Elf64_Half	vna_flags;
+  Elf64_Half	vna_other;
+  Elf64_Word	vna_name;
+  Elf64_Word	vna_next;
+} Elf64_Vernaux;
+
+
+
+#define VER_FLG_WEAK	0x2
+
+
+
+typedef struct {
+  uint32_t a_type;
+  union {
+      uint32_t a_val;
+  } a_un;
+} Elf32_auxv_t;
+
+typedef struct {
+  uint64_t a_type;
+  union {
+      uint64_t a_val;
+  } a_un;
+} Elf64_auxv_t;
+
+
+
+#define AT_NULL		0
+#define AT_IGNORE	1
+#define AT_EXECFD	2
+#define AT_PHDR		3
+#define AT_PHENT	4
+#define AT_PHNUM	5
+#define AT_PAGESZ	6
+#define AT_BASE		7
+#define AT_FLAGS	8
+#define AT_ENTRY	9
+#define AT_NOTELF	10
+#define AT_UID		11
+#define AT_EUID		12
+#define AT_GID		13
+#define AT_EGID		14
+#define AT_CLKTCK	17
+
+
+#define AT_PLATFORM	15
+#define AT_HWCAP	16
+
+
+
+
+#define AT_FPUCW	18
+
+
+#define AT_DCACHEBSIZE	19
+#define AT_ICACHEBSIZE	20
+#define AT_UCACHEBSIZE	21
+
+
+
+#define AT_IGNOREPPC	22
+
+#define	AT_SECURE	23
+
+#define AT_BASE_PLATFORM 24
+
+#define AT_RANDOM	25
+
+#define AT_HWCAP2	26
+
+#define AT_EXECFN	31
+
+
+
+#define AT_SYSINFO	32
+#define AT_SYSINFO_EHDR	33
+
+
+
+#define AT_L1I_CACHESHAPE	34
+#define AT_L1D_CACHESHAPE	35
+#define AT_L2_CACHESHAPE	36
+#define AT_L3_CACHESHAPE	37
+
+#define AT_L1I_CACHESIZE	40
+#define AT_L1I_CACHEGEOMETRY	41
+#define AT_L1D_CACHESIZE	42
+#define AT_L1D_CACHEGEOMETRY	43
+#define AT_L2_CACHESIZE		44
+#define AT_L2_CACHEGEOMETRY	45
+#define AT_L3_CACHESIZE		46
+#define AT_L3_CACHEGEOMETRY	47
+
+#define AT_MINSIGSTKSZ		51
+
+
+typedef struct {
+  Elf32_Word n_namesz;
+  Elf32_Word n_descsz;
+  Elf32_Word n_type;
+} Elf32_Nhdr;
+
+typedef struct {
+  Elf64_Word n_namesz;
+  Elf64_Word n_descsz;
+  Elf64_Word n_type;
+} Elf64_Nhdr;
+
+
+
+
+#define ELF_NOTE_SOLARIS	"SUNW Solaris"
+
+
+#define ELF_NOTE_GNU		"GNU"
+
+
+
+
+
+#define ELF_NOTE_PAGESIZE_HINT	1
+
+
+#define NT_GNU_ABI_TAG	1
+#define ELF_NOTE_ABI	NT_GNU_ABI_TAG
+
+
+
+#define ELF_NOTE_OS_LINUX	0
+#define ELF_NOTE_OS_GNU		1
+#define ELF_NOTE_OS_SOLARIS2	2
+#define ELF_NOTE_OS_FREEBSD	3
+
+#define NT_GNU_BUILD_ID	3
+#define NT_GNU_GOLD_VERSION	4
+#define NT_GNU_PROPERTY_TYPE_0	5
+
+
+
+typedef struct {
+  Elf32_Xword m_value;
+  Elf32_Word m_info;
+  Elf32_Word m_poffset;
+  Elf32_Half m_repeat;
+  Elf32_Half m_stride;
+} Elf32_Move;
+
+typedef struct {
+  Elf64_Xword m_value;
+  Elf64_Xword m_info;
+  Elf64_Xword m_poffset;
+  Elf64_Half m_repeat;
+  Elf64_Half m_stride;
+} Elf64_Move;
+
+
+#define ELF32_M_SYM(info)	((info) >> 8)
+#define ELF32_M_SIZE(info)	((unsigned char) (info))
+#define ELF32_M_INFO(sym, size)	(((sym) << 8) + (unsigned char) (size))
+
+#define ELF64_M_SYM(info)	ELF32_M_SYM (info)
+#define ELF64_M_SIZE(info)	ELF32_M_SIZE (info)
+#define ELF64_M_INFO(sym, size)	ELF32_M_INFO (sym, size)
+
+#define EF_CPU32	0x00810000
+
+#define R_68K_NONE	0
+#define R_68K_32	1
+#define R_68K_16	2
+#define R_68K_8		3
+#define R_68K_PC32	4
+#define R_68K_PC16	5
+#define R_68K_PC8	6
+#define R_68K_GOT32	7
+#define R_68K_GOT16	8
+#define R_68K_GOT8	9
+#define R_68K_GOT32O	10
+#define R_68K_GOT16O	11
+#define R_68K_GOT8O	12
+#define R_68K_PLT32	13
+#define R_68K_PLT16	14
+#define R_68K_PLT8	15
+#define R_68K_PLT32O	16
+#define R_68K_PLT16O	17
+#define R_68K_PLT8O	18
+#define R_68K_COPY	19
+#define R_68K_GLOB_DAT	20
+#define R_68K_JMP_SLOT	21
+#define R_68K_RELATIVE	22
+#define R_68K_TLS_GD32	25
+#define R_68K_TLS_GD16	26
+#define R_68K_TLS_GD8	27
+#define R_68K_TLS_LDM32	28
+#define R_68K_TLS_LDM16	29
+#define R_68K_TLS_LDM8	30
+#define R_68K_TLS_LDO32	31
+#define R_68K_TLS_LDO16	32
+#define R_68K_TLS_LDO8	33
+#define R_68K_TLS_IE32	34
+#define R_68K_TLS_IE16	35
+#define R_68K_TLS_IE8	36
+#define R_68K_TLS_LE32	37
+#define R_68K_TLS_LE16	38
+#define R_68K_TLS_LE8	39
+#define R_68K_TLS_DTPMOD32	40
+#define R_68K_TLS_DTPREL32	41
+#define R_68K_TLS_TPREL32	42
+#define R_68K_NUM	43
+
+#define R_386_NONE	   0
+#define R_386_32	   1
+#define R_386_PC32	   2
+#define R_386_GOT32	   3
+#define R_386_PLT32	   4
+#define R_386_COPY	   5
+#define R_386_GLOB_DAT	   6
+#define R_386_JMP_SLOT	   7
+#define R_386_RELATIVE	   8
+#define R_386_GOTOFF	   9
+#define R_386_GOTPC	   10
+#define R_386_32PLT	   11
+#define R_386_TLS_TPOFF	   14
+#define R_386_TLS_IE	   15
+#define R_386_TLS_GOTIE	   16
+#define R_386_TLS_LE	   17
+#define R_386_TLS_GD	   18
+#define R_386_TLS_LDM	   19
+#define R_386_16	   20
+#define R_386_PC16	   21
+#define R_386_8		   22
+#define R_386_PC8	   23
+#define R_386_TLS_GD_32	   24
+#define R_386_TLS_GD_PUSH  25
+#define R_386_TLS_GD_CALL  26
+#define R_386_TLS_GD_POP   27
+#define R_386_TLS_LDM_32   28
+#define R_386_TLS_LDM_PUSH 29
+#define R_386_TLS_LDM_CALL 30
+#define R_386_TLS_LDM_POP  31
+#define R_386_TLS_LDO_32   32
+#define R_386_TLS_IE_32	   33
+#define R_386_TLS_LE_32	   34
+#define R_386_TLS_DTPMOD32 35
+#define R_386_TLS_DTPOFF32 36
+#define R_386_TLS_TPOFF32  37
+#define R_386_SIZE32       38
+#define R_386_TLS_GOTDESC  39
+#define R_386_TLS_DESC_CALL 40
+#define R_386_TLS_DESC     41
+#define R_386_IRELATIVE	   42
+#define R_386_GOT32X	   43
+#define R_386_NUM	   44
+
+
+
+
+
+#define STT_SPARC_REGISTER	13
+
+
+
+#define EF_SPARCV9_MM		3
+#define EF_SPARCV9_TSO		0
+#define EF_SPARCV9_PSO		1
+#define EF_SPARCV9_RMO		2
+#define EF_SPARC_LEDATA		0x800000
+#define EF_SPARC_EXT_MASK	0xFFFF00
+#define EF_SPARC_32PLUS		0x000100
+#define EF_SPARC_SUN_US1	0x000200
+#define EF_SPARC_HAL_R1		0x000400
+#define EF_SPARC_SUN_US3	0x000800
+
+
+
+#define R_SPARC_NONE		0
+#define R_SPARC_8		1
+#define R_SPARC_16		2
+#define R_SPARC_32		3
+#define R_SPARC_DISP8		4
+#define R_SPARC_DISP16		5
+#define R_SPARC_DISP32		6
+#define R_SPARC_WDISP30		7
+#define R_SPARC_WDISP22		8
+#define R_SPARC_HI22		9
+#define R_SPARC_22		10
+#define R_SPARC_13		11
+#define R_SPARC_LO10		12
+#define R_SPARC_GOT10		13
+#define R_SPARC_GOT13		14
+#define R_SPARC_GOT22		15
+#define R_SPARC_PC10		16
+#define R_SPARC_PC22		17
+#define R_SPARC_WPLT30		18
+#define R_SPARC_COPY		19
+#define R_SPARC_GLOB_DAT	20
+#define R_SPARC_JMP_SLOT	21
+#define R_SPARC_RELATIVE	22
+#define R_SPARC_UA32		23
+
+
+
+#define R_SPARC_PLT32		24
+#define R_SPARC_HIPLT22		25
+#define R_SPARC_LOPLT10		26
+#define R_SPARC_PCPLT32		27
+#define R_SPARC_PCPLT22		28
+#define R_SPARC_PCPLT10		29
+#define R_SPARC_10		30
+#define R_SPARC_11		31
+#define R_SPARC_64		32
+#define R_SPARC_OLO10		33
+#define R_SPARC_HH22		34
+#define R_SPARC_HM10		35
+#define R_SPARC_LM22		36
+#define R_SPARC_PC_HH22		37
+#define R_SPARC_PC_HM10		38
+#define R_SPARC_PC_LM22		39
+#define R_SPARC_WDISP16		40
+#define R_SPARC_WDISP19		41
+#define R_SPARC_GLOB_JMP	42
+#define R_SPARC_7		43
+#define R_SPARC_5		44
+#define R_SPARC_6		45
+#define R_SPARC_DISP64		46
+#define R_SPARC_PLT64		47
+#define R_SPARC_HIX22		48
+#define R_SPARC_LOX10		49
+#define R_SPARC_H44		50
+#define R_SPARC_M44		51
+#define R_SPARC_L44		52
+#define R_SPARC_REGISTER	53
+#define R_SPARC_UA64		54
+#define R_SPARC_UA16		55
+#define R_SPARC_TLS_GD_HI22	56
+#define R_SPARC_TLS_GD_LO10	57
+#define R_SPARC_TLS_GD_ADD	58
+#define R_SPARC_TLS_GD_CALL	59
+#define R_SPARC_TLS_LDM_HI22	60
+#define R_SPARC_TLS_LDM_LO10	61
+#define R_SPARC_TLS_LDM_ADD	62
+#define R_SPARC_TLS_LDM_CALL	63
+#define R_SPARC_TLS_LDO_HIX22	64
+#define R_SPARC_TLS_LDO_LOX10	65
+#define R_SPARC_TLS_LDO_ADD	66
+#define R_SPARC_TLS_IE_HI22	67
+#define R_SPARC_TLS_IE_LO10	68
+#define R_SPARC_TLS_IE_LD	69
+#define R_SPARC_TLS_IE_LDX	70
+#define R_SPARC_TLS_IE_ADD	71
+#define R_SPARC_TLS_LE_HIX22	72
+#define R_SPARC_TLS_LE_LOX10	73
+#define R_SPARC_TLS_DTPMOD32	74
+#define R_SPARC_TLS_DTPMOD64	75
+#define R_SPARC_TLS_DTPOFF32	76
+#define R_SPARC_TLS_DTPOFF64	77
+#define R_SPARC_TLS_TPOFF32	78
+#define R_SPARC_TLS_TPOFF64	79
+#define R_SPARC_GOTDATA_HIX22	80
+#define R_SPARC_GOTDATA_LOX10	81
+#define R_SPARC_GOTDATA_OP_HIX22	82
+#define R_SPARC_GOTDATA_OP_LOX10	83
+#define R_SPARC_GOTDATA_OP	84
+#define R_SPARC_H34		85
+#define R_SPARC_SIZE32		86
+#define R_SPARC_SIZE64		87
+#define R_SPARC_GNU_VTINHERIT	250
+#define R_SPARC_GNU_VTENTRY	251
+#define R_SPARC_REV32		252
+
+#define R_SPARC_NUM		253
+
+
+
+#define DT_SPARC_REGISTER 0x70000001
+#define DT_SPARC_NUM	2
+
+
+#define EF_MIPS_NOREORDER   1
+#define EF_MIPS_PIC	    2
+#define EF_MIPS_CPIC	    4
+#define EF_MIPS_XGOT	    8
+#define EF_MIPS_64BIT_WHIRL 16
+#define EF_MIPS_ABI2	    32
+#define EF_MIPS_ABI_ON32    64
+#define EF_MIPS_FP64	    512
+#define EF_MIPS_NAN2008     1024
+#define EF_MIPS_ARCH	    0xf0000000
+
+
+
+#define EF_MIPS_ARCH_1	    0x00000000
+#define EF_MIPS_ARCH_2	    0x10000000
+#define EF_MIPS_ARCH_3	    0x20000000
+#define EF_MIPS_ARCH_4	    0x30000000
+#define EF_MIPS_ARCH_5	    0x40000000
+#define EF_MIPS_ARCH_32     0x50000000
+#define EF_MIPS_ARCH_64     0x60000000
+#define EF_MIPS_ARCH_32R2   0x70000000
+#define EF_MIPS_ARCH_64R2   0x80000000
+
+
+#define E_MIPS_ARCH_1	  0x00000000
+#define E_MIPS_ARCH_2	  0x10000000
+#define E_MIPS_ARCH_3	  0x20000000
+#define E_MIPS_ARCH_4	  0x30000000
+#define E_MIPS_ARCH_5	  0x40000000
+#define E_MIPS_ARCH_32	  0x50000000
+#define E_MIPS_ARCH_64	  0x60000000
+
+
+
+#define SHN_MIPS_ACOMMON    0xff00
+#define SHN_MIPS_TEXT	    0xff01
+#define SHN_MIPS_DATA	    0xff02
+#define SHN_MIPS_SCOMMON    0xff03
+#define SHN_MIPS_SUNDEFINED 0xff04
+
+
+
+#define SHT_MIPS_LIBLIST       0x70000000
+#define SHT_MIPS_MSYM	       0x70000001
+#define SHT_MIPS_CONFLICT      0x70000002
+#define SHT_MIPS_GPTAB	       0x70000003
+#define SHT_MIPS_UCODE	       0x70000004
+#define SHT_MIPS_DEBUG	       0x70000005
+#define SHT_MIPS_REGINFO       0x70000006
+#define SHT_MIPS_PACKAGE       0x70000007
+#define SHT_MIPS_PACKSYM       0x70000008
+#define SHT_MIPS_RELD	       0x70000009
+#define SHT_MIPS_IFACE         0x7000000b
+#define SHT_MIPS_CONTENT       0x7000000c
+#define SHT_MIPS_OPTIONS       0x7000000d
+#define SHT_MIPS_SHDR	       0x70000010
+#define SHT_MIPS_FDESC	       0x70000011
+#define SHT_MIPS_EXTSYM	       0x70000012
+#define SHT_MIPS_DENSE	       0x70000013
+#define SHT_MIPS_PDESC	       0x70000014
+#define SHT_MIPS_LOCSYM	       0x70000015
+#define SHT_MIPS_AUXSYM	       0x70000016
+#define SHT_MIPS_OPTSYM	       0x70000017
+#define SHT_MIPS_LOCSTR	       0x70000018
+#define SHT_MIPS_LINE	       0x70000019
+#define SHT_MIPS_RFDESC	       0x7000001a
+#define SHT_MIPS_DELTASYM      0x7000001b
+#define SHT_MIPS_DELTAINST     0x7000001c
+#define SHT_MIPS_DELTACLASS    0x7000001d
+#define SHT_MIPS_DWARF         0x7000001e
+#define SHT_MIPS_DELTADECL     0x7000001f
+#define SHT_MIPS_SYMBOL_LIB    0x70000020
+#define SHT_MIPS_EVENTS	       0x70000021
+#define SHT_MIPS_TRANSLATE     0x70000022
+#define SHT_MIPS_PIXIE	       0x70000023
+#define SHT_MIPS_XLATE	       0x70000024
+#define SHT_MIPS_XLATE_DEBUG   0x70000025
+#define SHT_MIPS_WHIRL	       0x70000026
+#define SHT_MIPS_EH_REGION     0x70000027
+#define SHT_MIPS_XLATE_OLD     0x70000028
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+
+
+
+#define SHF_MIPS_GPREL	 0x10000000
+#define SHF_MIPS_MERGE	 0x20000000
+#define SHF_MIPS_ADDR	 0x40000000
+#define SHF_MIPS_STRINGS 0x80000000
+#define SHF_MIPS_NOSTRIP 0x08000000
+#define SHF_MIPS_LOCAL	 0x04000000
+#define SHF_MIPS_NAMES	 0x02000000
+#define SHF_MIPS_NODUPE	 0x01000000
+
+
+
+
+
+#define STO_MIPS_DEFAULT		0x0
+#define STO_MIPS_INTERNAL		0x1
+#define STO_MIPS_HIDDEN			0x2
+#define STO_MIPS_PROTECTED		0x3
+#define STO_MIPS_PLT			0x8
+#define STO_MIPS_SC_ALIGN_UNUSED	0xff
+
+
+#define STB_MIPS_SPLIT_COMMON		13
+
+
+
+typedef union {
+  struct {
+      Elf32_Word gt_current_g_value;
+      Elf32_Word gt_unused;
+  } gt_header;
+  struct {
+      Elf32_Word gt_g_value;
+      Elf32_Word gt_bytes;
+  } gt_entry;
+} Elf32_gptab;
+
+
+
+typedef struct {
+  Elf32_Word	ri_gprmask;
+  Elf32_Word	ri_cprmask[4];
+  Elf32_Sword	ri_gp_value;
+} Elf32_RegInfo;
+
+
+
+typedef struct {
+  unsigned char kind;
+
+  unsigned char size;
+  Elf32_Section section;
+
+  Elf32_Word info;
+} Elf_Options;
+
+
+
+#define ODK_NULL	0
+#define ODK_REGINFO	1
+#define ODK_EXCEPTIONS	2
+#define ODK_PAD		3
+#define ODK_HWPATCH	4
+#define ODK_FILL	5
+#define ODK_TAGS	6
+#define ODK_HWAND	7
+#define ODK_HWOR	8
+
+
+
+#define OEX_FPU_MIN	0x1f
+#define OEX_FPU_MAX	0x1f00
+#define OEX_PAGE0	0x10000
+#define OEX_SMM		0x20000
+#define OEX_FPDBUG	0x40000
+#define OEX_PRECISEFP	OEX_FPDBUG
+#define OEX_DISMISS	0x80000
+
+#define OEX_FPU_INVAL	0x10
+#define OEX_FPU_DIV0	0x08
+#define OEX_FPU_OFLO	0x04
+#define OEX_FPU_UFLO	0x02
+#define OEX_FPU_INEX	0x01
+
+
+
+#define OHW_R4KEOP	0x1
+#define OHW_R8KPFETCH	0x2
+#define OHW_R5KEOP	0x4
+#define OHW_R5KCVTL	0x8
+
+#define OPAD_PREFIX	0x1
+#define OPAD_POSTFIX	0x2
+#define OPAD_SYMBOL	0x4
+
+
+
+typedef struct {
+  Elf32_Word hwp_flags1;
+  Elf32_Word hwp_flags2;
+} Elf_Options_Hw;
+
+
+
+#define OHWA0_R4KEOP_CHECKED	0x00000001
+#define OHWA1_R4KEOP_CLEAN	0x00000002
+
+
+
+#define R_MIPS_NONE		0
+#define R_MIPS_16		1
+#define R_MIPS_32		2
+#define R_MIPS_REL32		3
+#define R_MIPS_26		4
+#define R_MIPS_HI16		5
+#define R_MIPS_LO16		6
+#define R_MIPS_GPREL16		7
+#define R_MIPS_LITERAL		8
+#define R_MIPS_GOT16		9
+#define R_MIPS_PC16		10
+#define R_MIPS_CALL16		11
+#define R_MIPS_GPREL32		12
+
+#define R_MIPS_SHIFT5		16
+#define R_MIPS_SHIFT6		17
+#define R_MIPS_64		18
+#define R_MIPS_GOT_DISP		19
+#define R_MIPS_GOT_PAGE		20
+#define R_MIPS_GOT_OFST		21
+#define R_MIPS_GOT_HI16		22
+#define R_MIPS_GOT_LO16		23
+#define R_MIPS_SUB		24
+#define R_MIPS_INSERT_A		25
+#define R_MIPS_INSERT_B		26
+#define R_MIPS_DELETE		27
+#define R_MIPS_HIGHER		28
+#define R_MIPS_HIGHEST		29
+#define R_MIPS_CALL_HI16	30
+#define R_MIPS_CALL_LO16	31
+#define R_MIPS_SCN_DISP		32
+#define R_MIPS_REL16		33
+#define R_MIPS_ADD_IMMEDIATE	34
+#define R_MIPS_PJUMP		35
+#define R_MIPS_RELGOT		36
+#define R_MIPS_JALR		37
+#define R_MIPS_TLS_DTPMOD32	38
+#define R_MIPS_TLS_DTPREL32	39
+#define R_MIPS_TLS_DTPMOD64	40
+#define R_MIPS_TLS_DTPREL64	41
+#define R_MIPS_TLS_GD		42
+#define R_MIPS_TLS_LDM		43
+#define R_MIPS_TLS_DTPREL_HI16	44
+#define R_MIPS_TLS_DTPREL_LO16	45
+#define R_MIPS_TLS_GOTTPREL	46
+#define R_MIPS_TLS_TPREL32	47
+#define R_MIPS_TLS_TPREL64	48
+#define R_MIPS_TLS_TPREL_HI16	49
+#define R_MIPS_TLS_TPREL_LO16	50
+#define R_MIPS_GLOB_DAT		51
+#define R_MIPS_COPY		126
+#define R_MIPS_JUMP_SLOT        127
+
+#define R_MIPS_NUM		128
+
+
+
+#define PT_MIPS_REGINFO	0x70000000
+#define PT_MIPS_RTPROC  0x70000001
+#define PT_MIPS_OPTIONS 0x70000002
+#define PT_MIPS_ABIFLAGS 0x70000003
+
+
+
+#define PF_MIPS_LOCAL	0x10000000
+
+
+
+#define DT_MIPS_RLD_VERSION  0x70000001
+#define DT_MIPS_TIME_STAMP   0x70000002
+#define DT_MIPS_ICHECKSUM    0x70000003
+#define DT_MIPS_IVERSION     0x70000004
+#define DT_MIPS_FLAGS	     0x70000005
+#define DT_MIPS_BASE_ADDRESS 0x70000006
+#define DT_MIPS_MSYM	     0x70000007
+#define DT_MIPS_CONFLICT     0x70000008
+#define DT_MIPS_LIBLIST	     0x70000009
+#define DT_MIPS_LOCAL_GOTNO  0x7000000a
+#define DT_MIPS_CONFLICTNO   0x7000000b
+#define DT_MIPS_LIBLISTNO    0x70000010
+#define DT_MIPS_SYMTABNO     0x70000011
+#define DT_MIPS_UNREFEXTNO   0x70000012
+#define DT_MIPS_GOTSYM	     0x70000013
+#define DT_MIPS_HIPAGENO     0x70000014
+#define DT_MIPS_RLD_MAP	     0x70000016
+#define DT_MIPS_DELTA_CLASS  0x70000017
+#define DT_MIPS_DELTA_CLASS_NO    0x70000018
+
+#define DT_MIPS_DELTA_INSTANCE    0x70000019
+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a
+
+#define DT_MIPS_DELTA_RELOC  0x7000001b
+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c
+
+#define DT_MIPS_DELTA_SYM    0x7000001d
+
+#define DT_MIPS_DELTA_SYM_NO 0x7000001e
+
+#define DT_MIPS_DELTA_CLASSSYM 0x70000020
+
+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021
+
+#define DT_MIPS_CXX_FLAGS    0x70000022
+#define DT_MIPS_PIXIE_INIT   0x70000023
+#define DT_MIPS_SYMBOL_LIB   0x70000024
+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
+#define DT_MIPS_LOCAL_GOTIDX 0x70000026
+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
+#define DT_MIPS_OPTIONS	     0x70000029
+#define DT_MIPS_INTERFACE    0x7000002a
+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
+#define DT_MIPS_INTERFACE_SIZE 0x7000002c
+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d
+
+#define DT_MIPS_PERF_SUFFIX  0x7000002e
+
+#define DT_MIPS_COMPACT_SIZE 0x7000002f
+#define DT_MIPS_GP_VALUE     0x70000030
+#define DT_MIPS_AUX_DYNAMIC  0x70000031
+
+#define DT_MIPS_PLTGOT	     0x70000032
+
+#define DT_MIPS_RWPLT        0x70000034
+#define DT_MIPS_RLD_MAP_REL  0x70000035
+#define DT_MIPS_NUM	     0x36
+
+
+
+#define RHF_NONE		   0
+#define RHF_QUICKSTART		   (1 << 0)
+#define RHF_NOTPOT		   (1 << 1)
+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)
+#define RHF_NO_MOVE		   (1 << 3)
+#define RHF_SGI_ONLY		   (1 << 4)
+#define RHF_GUARANTEE_INIT	   (1 << 5)
+#define RHF_DELTA_C_PLUS_PLUS	   (1 << 6)
+#define RHF_GUARANTEE_START_INIT   (1 << 7)
+#define RHF_PIXIE		   (1 << 8)
+#define RHF_DEFAULT_DELAY_LOAD	   (1 << 9)
+#define RHF_REQUICKSTART	   (1 << 10)
+#define RHF_REQUICKSTARTED	   (1 << 11)
+#define RHF_CORD		   (1 << 12)
+#define RHF_NO_UNRES_UNDEF	   (1 << 13)
+#define RHF_RLD_ORDER_SAFE	   (1 << 14)
+
+
+
+typedef struct {
+  Elf32_Word l_name;
+  Elf32_Word l_time_stamp;
+  Elf32_Word l_checksum;
+  Elf32_Word l_version;
+  Elf32_Word l_flags;
+} Elf32_Lib;
+
+typedef struct {
+  Elf64_Word l_name;
+  Elf64_Word l_time_stamp;
+  Elf64_Word l_checksum;
+  Elf64_Word l_version;
+  Elf64_Word l_flags;
+} Elf64_Lib;
+
+
+
+
+#define LL_NONE		  0
+#define LL_EXACT_MATCH	  (1 << 0)
+#define LL_IGNORE_INT_VER (1 << 1)
+#define LL_REQUIRE_MINOR  (1 << 2)
+#define LL_EXPORTS	  (1 << 3)
+#define LL_DELAY_LOAD	  (1 << 4)
+#define LL_DELTA	  (1 << 5)
+
+
+
+typedef Elf32_Addr Elf32_Conflict;
+
+typedef struct {
+  Elf32_Half version;
+  unsigned char isa_level;
+  unsigned char isa_rev;
+  unsigned char gpr_size;
+  unsigned char cpr1_size;
+  unsigned char cpr2_size;
+  unsigned char fp_abi;
+  Elf32_Word isa_ext;
+  Elf32_Word ases;
+  Elf32_Word flags1;
+  Elf32_Word flags2;
+} Elf_MIPS_ABIFlags_v0;
+
+#define MIPS_AFL_REG_NONE	0x00
+#define MIPS_AFL_REG_32		0x01
+#define MIPS_AFL_REG_64		0x02
+#define MIPS_AFL_REG_128	0x03
+
+#define MIPS_AFL_ASE_DSP	0x00000001
+#define MIPS_AFL_ASE_DSPR2	0x00000002
+#define MIPS_AFL_ASE_EVA	0x00000004
+#define MIPS_AFL_ASE_MCU	0x00000008
+#define MIPS_AFL_ASE_MDMX	0x00000010
+#define MIPS_AFL_ASE_MIPS3D	0x00000020
+#define MIPS_AFL_ASE_MT		0x00000040
+#define MIPS_AFL_ASE_SMARTMIPS	0x00000080
+#define MIPS_AFL_ASE_VIRT	0x00000100
+#define MIPS_AFL_ASE_MSA	0x00000200
+#define MIPS_AFL_ASE_MIPS16	0x00000400
+#define MIPS_AFL_ASE_MICROMIPS	0x00000800
+#define MIPS_AFL_ASE_XPA	0x00001000
+#define MIPS_AFL_ASE_MASK	0x00001fff
+
+#define MIPS_AFL_EXT_XLR	  1
+#define MIPS_AFL_EXT_OCTEON2	  2
+#define MIPS_AFL_EXT_OCTEONP	  3
+#define MIPS_AFL_EXT_LOONGSON_3A  4
+#define MIPS_AFL_EXT_OCTEON	  5
+#define MIPS_AFL_EXT_5900	  6
+#define MIPS_AFL_EXT_4650	  7
+#define MIPS_AFL_EXT_4010	  8
+#define MIPS_AFL_EXT_4100	  9
+#define MIPS_AFL_EXT_3900	  10
+#define MIPS_AFL_EXT_10000	  11
+#define MIPS_AFL_EXT_SB1	  12
+#define MIPS_AFL_EXT_4111	  13
+#define MIPS_AFL_EXT_4120	  14
+#define MIPS_AFL_EXT_5400	  15
+#define MIPS_AFL_EXT_5500	  16
+#define MIPS_AFL_EXT_LOONGSON_2E  17
+#define MIPS_AFL_EXT_LOONGSON_2F  18
+
+#define MIPS_AFL_FLAGS1_ODDSPREG  1
+
+enum
+{
+  Val_GNU_MIPS_ABI_FP_ANY = 0,
+  Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
+  Val_GNU_MIPS_ABI_FP_SINGLE = 2,
+  Val_GNU_MIPS_ABI_FP_SOFT = 3,
+  Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
+  Val_GNU_MIPS_ABI_FP_XX = 5,
+  Val_GNU_MIPS_ABI_FP_64 = 6,
+  Val_GNU_MIPS_ABI_FP_64A = 7,
+  Val_GNU_MIPS_ABI_FP_MAX = 7
+};
+
+
+
+
+#define EF_PARISC_TRAPNIL	0x00010000
+#define EF_PARISC_EXT		0x00020000
+#define EF_PARISC_LSB		0x00040000
+#define EF_PARISC_WIDE		0x00080000
+#define EF_PARISC_NO_KABP	0x00100000
+
+#define EF_PARISC_LAZYSWAP	0x00400000
+#define EF_PARISC_ARCH		0x0000ffff
+
+
+
+#define EFA_PARISC_1_0		    0x020b
+#define EFA_PARISC_1_1		    0x0210
+#define EFA_PARISC_2_0		    0x0214
+
+
+
+#define SHN_PARISC_ANSI_COMMON	0xff00
+
+#define SHN_PARISC_HUGE_COMMON	0xff01
+
+
+
+#define SHT_PARISC_EXT		0x70000000
+#define SHT_PARISC_UNWIND	0x70000001
+#define SHT_PARISC_DOC		0x70000002
+
+
+
+#define SHF_PARISC_SHORT	0x20000000
+#define SHF_PARISC_HUGE		0x40000000
+#define SHF_PARISC_SBP		0x80000000
+
+
+
+#define STT_PARISC_MILLICODE	13
+
+#define STT_HP_OPAQUE		(STT_LOOS + 0x1)
+#define STT_HP_STUB		(STT_LOOS + 0x2)
+
+
+
+#define R_PARISC_NONE		0
+#define R_PARISC_DIR32		1
+#define R_PARISC_DIR21L		2
+#define R_PARISC_DIR17R		3
+#define R_PARISC_DIR17F		4
+#define R_PARISC_DIR14R		6
+#define R_PARISC_PCREL32	9
+#define R_PARISC_PCREL21L	10
+#define R_PARISC_PCREL17R	11
+#define R_PARISC_PCREL17F	12
+#define R_PARISC_PCREL14R	14
+#define R_PARISC_DPREL21L	18
+#define R_PARISC_DPREL14R	22
+#define R_PARISC_GPREL21L	26
+#define R_PARISC_GPREL14R	30
+#define R_PARISC_LTOFF21L	34
+#define R_PARISC_LTOFF14R	38
+#define R_PARISC_SECREL32	41
+#define R_PARISC_SEGBASE	48
+#define R_PARISC_SEGREL32	49
+#define R_PARISC_PLTOFF21L	50
+#define R_PARISC_PLTOFF14R	54
+#define R_PARISC_LTOFF_FPTR32	57
+#define R_PARISC_LTOFF_FPTR21L	58
+#define R_PARISC_LTOFF_FPTR14R	62
+#define R_PARISC_FPTR64		64
+#define R_PARISC_PLABEL32	65
+#define R_PARISC_PLABEL21L	66
+#define R_PARISC_PLABEL14R	70
+#define R_PARISC_PCREL64	72
+#define R_PARISC_PCREL22F	74
+#define R_PARISC_PCREL14WR	75
+#define R_PARISC_PCREL14DR	76
+#define R_PARISC_PCREL16F	77
+#define R_PARISC_PCREL16WF	78
+#define R_PARISC_PCREL16DF	79
+#define R_PARISC_DIR64		80
+#define R_PARISC_DIR14WR	83
+#define R_PARISC_DIR14DR	84
+#define R_PARISC_DIR16F		85
+#define R_PARISC_DIR16WF	86
+#define R_PARISC_DIR16DF	87
+#define R_PARISC_GPREL64	88
+#define R_PARISC_GPREL14WR	91
+#define R_PARISC_GPREL14DR	92
+#define R_PARISC_GPREL16F	93
+#define R_PARISC_GPREL16WF	94
+#define R_PARISC_GPREL16DF	95
+#define R_PARISC_LTOFF64	96
+#define R_PARISC_LTOFF14WR	99
+#define R_PARISC_LTOFF14DR	100
+#define R_PARISC_LTOFF16F	101
+#define R_PARISC_LTOFF16WF	102
+#define R_PARISC_LTOFF16DF	103
+#define R_PARISC_SECREL64	104
+#define R_PARISC_SEGREL64	112
+#define R_PARISC_PLTOFF14WR	115
+#define R_PARISC_PLTOFF14DR	116
+#define R_PARISC_PLTOFF16F	117
+#define R_PARISC_PLTOFF16WF	118
+#define R_PARISC_PLTOFF16DF	119
+#define R_PARISC_LTOFF_FPTR64	120
+#define R_PARISC_LTOFF_FPTR14WR	123
+#define R_PARISC_LTOFF_FPTR14DR	124
+#define R_PARISC_LTOFF_FPTR16F	125
+#define R_PARISC_LTOFF_FPTR16WF	126
+#define R_PARISC_LTOFF_FPTR16DF	127
+#define R_PARISC_LORESERVE	128
+#define R_PARISC_COPY		128
+#define R_PARISC_IPLT		129
+#define R_PARISC_EPLT		130
+#define R_PARISC_TPREL32	153
+#define R_PARISC_TPREL21L	154
+#define R_PARISC_TPREL14R	158
+#define R_PARISC_LTOFF_TP21L	162
+#define R_PARISC_LTOFF_TP14R	166
+#define R_PARISC_LTOFF_TP14F	167
+#define R_PARISC_TPREL64	216
+#define R_PARISC_TPREL14WR	219
+#define R_PARISC_TPREL14DR	220
+#define R_PARISC_TPREL16F	221
+#define R_PARISC_TPREL16WF	222
+#define R_PARISC_TPREL16DF	223
+#define R_PARISC_LTOFF_TP64	224
+#define R_PARISC_LTOFF_TP14WR	227
+#define R_PARISC_LTOFF_TP14DR	228
+#define R_PARISC_LTOFF_TP16F	229
+#define R_PARISC_LTOFF_TP16WF	230
+#define R_PARISC_LTOFF_TP16DF	231
+#define R_PARISC_GNU_VTENTRY	232
+#define R_PARISC_GNU_VTINHERIT	233
+#define R_PARISC_TLS_GD21L	234
+#define R_PARISC_TLS_GD14R	235
+#define R_PARISC_TLS_GDCALL	236
+#define R_PARISC_TLS_LDM21L	237
+#define R_PARISC_TLS_LDM14R	238
+#define R_PARISC_TLS_LDMCALL	239
+#define R_PARISC_TLS_LDO21L	240
+#define R_PARISC_TLS_LDO14R	241
+#define R_PARISC_TLS_DTPMOD32	242
+#define R_PARISC_TLS_DTPMOD64	243
+#define R_PARISC_TLS_DTPOFF32	244
+#define R_PARISC_TLS_DTPOFF64	245
+#define R_PARISC_TLS_LE21L	R_PARISC_TPREL21L
+#define R_PARISC_TLS_LE14R	R_PARISC_TPREL14R
+#define R_PARISC_TLS_IE21L	R_PARISC_LTOFF_TP21L
+#define R_PARISC_TLS_IE14R	R_PARISC_LTOFF_TP14R
+#define R_PARISC_TLS_TPREL32	R_PARISC_TPREL32
+#define R_PARISC_TLS_TPREL64	R_PARISC_TPREL64
+#define R_PARISC_HIRESERVE	255
+
+
+
+#define PT_HP_TLS		(PT_LOOS + 0x0)
+#define PT_HP_CORE_NONE		(PT_LOOS + 0x1)
+#define PT_HP_CORE_VERSION	(PT_LOOS + 0x2)
+#define PT_HP_CORE_KERNEL	(PT_LOOS + 0x3)
+#define PT_HP_CORE_COMM		(PT_LOOS + 0x4)
+#define PT_HP_CORE_PROC		(PT_LOOS + 0x5)
+#define PT_HP_CORE_LOADABLE	(PT_LOOS + 0x6)
+#define PT_HP_CORE_STACK	(PT_LOOS + 0x7)
+#define PT_HP_CORE_SHM		(PT_LOOS + 0x8)
+#define PT_HP_CORE_MMF		(PT_LOOS + 0x9)
+#define PT_HP_PARALLEL		(PT_LOOS + 0x10)
+#define PT_HP_FASTBIND		(PT_LOOS + 0x11)
+#define PT_HP_OPT_ANNOT		(PT_LOOS + 0x12)
+#define PT_HP_HSL_ANNOT		(PT_LOOS + 0x13)
+#define PT_HP_STACK		(PT_LOOS + 0x14)
+
+#define PT_PARISC_ARCHEXT	0x70000000
+#define PT_PARISC_UNWIND	0x70000001
+
+
+
+#define PF_PARISC_SBP		0x08000000
+
+#define PF_HP_PAGE_SIZE		0x00100000
+#define PF_HP_FAR_SHARED	0x00200000
+#define PF_HP_NEAR_SHARED	0x00400000
+#define PF_HP_CODE		0x01000000
+#define PF_HP_MODIFY		0x02000000
+#define PF_HP_LAZYSWAP		0x04000000
+#define PF_HP_SBP		0x08000000
+
+
+
+
+
+
+#define EF_ALPHA_32BIT		1
+#define EF_ALPHA_CANRELAX	2
+
+
+
+
+#define SHT_ALPHA_DEBUG		0x70000001
+#define SHT_ALPHA_REGINFO	0x70000002
+
+
+
+#define SHF_ALPHA_GPREL		0x10000000
+
+
+#define STO_ALPHA_NOPV		0x80
+#define STO_ALPHA_STD_GPLOAD	0x88
+
+
+
+#define R_ALPHA_NONE		0
+#define R_ALPHA_REFLONG		1
+#define R_ALPHA_REFQUAD		2
+#define R_ALPHA_GPREL32		3
+#define R_ALPHA_LITERAL		4
+#define R_ALPHA_LITUSE		5
+#define R_ALPHA_GPDISP		6
+#define R_ALPHA_BRADDR		7
+#define R_ALPHA_HINT		8
+#define R_ALPHA_SREL16		9
+#define R_ALPHA_SREL32		10
+#define R_ALPHA_SREL64		11
+#define R_ALPHA_GPRELHIGH	17
+#define R_ALPHA_GPRELLOW	18
+#define R_ALPHA_GPREL16		19
+#define R_ALPHA_COPY		24
+#define R_ALPHA_GLOB_DAT	25
+#define R_ALPHA_JMP_SLOT	26
+#define R_ALPHA_RELATIVE	27
+#define R_ALPHA_TLS_GD_HI	28
+#define R_ALPHA_TLSGD		29
+#define R_ALPHA_TLS_LDM		30
+#define R_ALPHA_DTPMOD64	31
+#define R_ALPHA_GOTDTPREL	32
+#define R_ALPHA_DTPREL64	33
+#define R_ALPHA_DTPRELHI	34
+#define R_ALPHA_DTPRELLO	35
+#define R_ALPHA_DTPREL16	36
+#define R_ALPHA_GOTTPREL	37
+#define R_ALPHA_TPREL64		38
+#define R_ALPHA_TPRELHI		39
+#define R_ALPHA_TPRELLO		40
+#define R_ALPHA_TPREL16		41
+
+#define R_ALPHA_NUM		46
+
+
+#define LITUSE_ALPHA_ADDR	0
+#define LITUSE_ALPHA_BASE	1
+#define LITUSE_ALPHA_BYTOFF	2
+#define LITUSE_ALPHA_JSR	3
+#define LITUSE_ALPHA_TLS_GD	4
+#define LITUSE_ALPHA_TLS_LDM	5
+
+
+#define DT_ALPHA_PLTRO		(DT_LOPROC + 0)
+#define DT_ALPHA_NUM		1
+
+
+
+
+#define EF_PPC_EMB		0x80000000
+
+
+#define EF_PPC_RELOCATABLE	0x00010000
+#define EF_PPC_RELOCATABLE_LIB	0x00008000
+
+
+
+#define R_PPC_NONE		0
+#define R_PPC_ADDR32		1
+#define R_PPC_ADDR24		2
+#define R_PPC_ADDR16		3
+#define R_PPC_ADDR16_LO		4
+#define R_PPC_ADDR16_HI		5
+#define R_PPC_ADDR16_HA		6
+#define R_PPC_ADDR14		7
+#define R_PPC_ADDR14_BRTAKEN	8
+#define R_PPC_ADDR14_BRNTAKEN	9
+#define R_PPC_REL24		10
+#define R_PPC_REL14		11
+#define R_PPC_REL14_BRTAKEN	12
+#define R_PPC_REL14_BRNTAKEN	13
+#define R_PPC_GOT16		14
+#define R_PPC_GOT16_LO		15
+#define R_PPC_GOT16_HI		16
+#define R_PPC_GOT16_HA		17
+#define R_PPC_PLTREL24		18
+#define R_PPC_COPY		19
+#define R_PPC_GLOB_DAT		20
+#define R_PPC_JMP_SLOT		21
+#define R_PPC_RELATIVE		22
+#define R_PPC_LOCAL24PC		23
+#define R_PPC_UADDR32		24
+#define R_PPC_UADDR16		25
+#define R_PPC_REL32		26
+#define R_PPC_PLT32		27
+#define R_PPC_PLTREL32		28
+#define R_PPC_PLT16_LO		29
+#define R_PPC_PLT16_HI		30
+#define R_PPC_PLT16_HA		31
+#define R_PPC_SDAREL16		32
+#define R_PPC_SECTOFF		33
+#define R_PPC_SECTOFF_LO	34
+#define R_PPC_SECTOFF_HI	35
+#define R_PPC_SECTOFF_HA	36
+
+
+#define R_PPC_TLS		67
+#define R_PPC_DTPMOD32		68
+#define R_PPC_TPREL16		69
+#define R_PPC_TPREL16_LO	70
+#define R_PPC_TPREL16_HI	71
+#define R_PPC_TPREL16_HA	72
+#define R_PPC_TPREL32		73
+#define R_PPC_DTPREL16		74
+#define R_PPC_DTPREL16_LO	75
+#define R_PPC_DTPREL16_HI	76
+#define R_PPC_DTPREL16_HA	77
+#define R_PPC_DTPREL32		78
+#define R_PPC_GOT_TLSGD16	79
+#define R_PPC_GOT_TLSGD16_LO	80
+#define R_PPC_GOT_TLSGD16_HI	81
+#define R_PPC_GOT_TLSGD16_HA	82
+#define R_PPC_GOT_TLSLD16	83
+#define R_PPC_GOT_TLSLD16_LO	84
+#define R_PPC_GOT_TLSLD16_HI	85
+#define R_PPC_GOT_TLSLD16_HA	86
+#define R_PPC_GOT_TPREL16	87
+#define R_PPC_GOT_TPREL16_LO	88
+#define R_PPC_GOT_TPREL16_HI	89
+#define R_PPC_GOT_TPREL16_HA	90
+#define R_PPC_GOT_DTPREL16	91
+#define R_PPC_GOT_DTPREL16_LO	92
+#define R_PPC_GOT_DTPREL16_HI	93
+#define R_PPC_GOT_DTPREL16_HA	94
+#define R_PPC_TLSGD		95
+#define R_PPC_TLSLD		96
+
+
+#define R_PPC_EMB_NADDR32	101
+#define R_PPC_EMB_NADDR16	102
+#define R_PPC_EMB_NADDR16_LO	103
+#define R_PPC_EMB_NADDR16_HI	104
+#define R_PPC_EMB_NADDR16_HA	105
+#define R_PPC_EMB_SDAI16	106
+#define R_PPC_EMB_SDA2I16	107
+#define R_PPC_EMB_SDA2REL	108
+#define R_PPC_EMB_SDA21		109
+#define R_PPC_EMB_MRKREF	110
+#define R_PPC_EMB_RELSEC16	111
+#define R_PPC_EMB_RELST_LO	112
+#define R_PPC_EMB_RELST_HI	113
+#define R_PPC_EMB_RELST_HA	114
+#define R_PPC_EMB_BIT_FLD	115
+#define R_PPC_EMB_RELSDA	116
+
+
+#define R_PPC_DIAB_SDA21_LO	180
+#define R_PPC_DIAB_SDA21_HI	181
+#define R_PPC_DIAB_SDA21_HA	182
+#define R_PPC_DIAB_RELSDA_LO	183
+#define R_PPC_DIAB_RELSDA_HI	184
+#define R_PPC_DIAB_RELSDA_HA	185
+
+
+#define R_PPC_IRELATIVE		248
+
+
+#define R_PPC_REL16		249
+#define R_PPC_REL16_LO		250
+#define R_PPC_REL16_HI		251
+#define R_PPC_REL16_HA		252
+
+
+
+#define R_PPC_TOC16		255
+
+
+#define DT_PPC_GOT		(DT_LOPROC + 0)
+#define DT_PPC_OPT		(DT_LOPROC + 1)
+#define DT_PPC_NUM		2
+
+#define PPC_OPT_TLS		1
+
+
+#define R_PPC64_NONE		R_PPC_NONE
+#define R_PPC64_ADDR32		R_PPC_ADDR32
+#define R_PPC64_ADDR24		R_PPC_ADDR24
+#define R_PPC64_ADDR16		R_PPC_ADDR16
+#define R_PPC64_ADDR16_LO	R_PPC_ADDR16_LO
+#define R_PPC64_ADDR16_HI	R_PPC_ADDR16_HI
+#define R_PPC64_ADDR16_HA	R_PPC_ADDR16_HA
+#define R_PPC64_ADDR14		R_PPC_ADDR14
+#define R_PPC64_ADDR14_BRTAKEN	R_PPC_ADDR14_BRTAKEN
+#define R_PPC64_ADDR14_BRNTAKEN	R_PPC_ADDR14_BRNTAKEN
+#define R_PPC64_REL24		R_PPC_REL24
+#define R_PPC64_REL14		R_PPC_REL14
+#define R_PPC64_REL14_BRTAKEN	R_PPC_REL14_BRTAKEN
+#define R_PPC64_REL14_BRNTAKEN	R_PPC_REL14_BRNTAKEN
+#define R_PPC64_GOT16		R_PPC_GOT16
+#define R_PPC64_GOT16_LO	R_PPC_GOT16_LO
+#define R_PPC64_GOT16_HI	R_PPC_GOT16_HI
+#define R_PPC64_GOT16_HA	R_PPC_GOT16_HA
+
+#define R_PPC64_COPY		R_PPC_COPY
+#define R_PPC64_GLOB_DAT	R_PPC_GLOB_DAT
+#define R_PPC64_JMP_SLOT	R_PPC_JMP_SLOT
+#define R_PPC64_RELATIVE	R_PPC_RELATIVE
+
+#define R_PPC64_UADDR32		R_PPC_UADDR32
+#define R_PPC64_UADDR16		R_PPC_UADDR16
+#define R_PPC64_REL32		R_PPC_REL32
+#define R_PPC64_PLT32		R_PPC_PLT32
+#define R_PPC64_PLTREL32	R_PPC_PLTREL32
+#define R_PPC64_PLT16_LO	R_PPC_PLT16_LO
+#define R_PPC64_PLT16_HI	R_PPC_PLT16_HI
+#define R_PPC64_PLT16_HA	R_PPC_PLT16_HA
+
+#define R_PPC64_SECTOFF		R_PPC_SECTOFF
+#define R_PPC64_SECTOFF_LO	R_PPC_SECTOFF_LO
+#define R_PPC64_SECTOFF_HI	R_PPC_SECTOFF_HI
+#define R_PPC64_SECTOFF_HA	R_PPC_SECTOFF_HA
+#define R_PPC64_ADDR30		37
+#define R_PPC64_ADDR64		38
+#define R_PPC64_ADDR16_HIGHER	39
+#define R_PPC64_ADDR16_HIGHERA	40
+#define R_PPC64_ADDR16_HIGHEST	41
+#define R_PPC64_ADDR16_HIGHESTA	42
+#define R_PPC64_UADDR64		43
+#define R_PPC64_REL64		44
+#define R_PPC64_PLT64		45
+#define R_PPC64_PLTREL64	46
+#define R_PPC64_TOC16		47
+#define R_PPC64_TOC16_LO	48
+#define R_PPC64_TOC16_HI	49
+#define R_PPC64_TOC16_HA	50
+#define R_PPC64_TOC		51
+#define R_PPC64_PLTGOT16	52
+#define R_PPC64_PLTGOT16_LO	53
+#define R_PPC64_PLTGOT16_HI	54
+#define R_PPC64_PLTGOT16_HA	55
+
+#define R_PPC64_ADDR16_DS	56
+#define R_PPC64_ADDR16_LO_DS	57
+#define R_PPC64_GOT16_DS	58
+#define R_PPC64_GOT16_LO_DS	59
+#define R_PPC64_PLT16_LO_DS	60
+#define R_PPC64_SECTOFF_DS	61
+#define R_PPC64_SECTOFF_LO_DS	62
+#define R_PPC64_TOC16_DS	63
+#define R_PPC64_TOC16_LO_DS	64
+#define R_PPC64_PLTGOT16_DS	65
+#define R_PPC64_PLTGOT16_LO_DS	66
+
+
+#define R_PPC64_TLS		67
+#define R_PPC64_DTPMOD64	68
+#define R_PPC64_TPREL16		69
+#define R_PPC64_TPREL16_LO	70
+#define R_PPC64_TPREL16_HI	71
+#define R_PPC64_TPREL16_HA	72
+#define R_PPC64_TPREL64		73
+#define R_PPC64_DTPREL16	74
+#define R_PPC64_DTPREL16_LO	75
+#define R_PPC64_DTPREL16_HI	76
+#define R_PPC64_DTPREL16_HA	77
+#define R_PPC64_DTPREL64	78
+#define R_PPC64_GOT_TLSGD16	79
+#define R_PPC64_GOT_TLSGD16_LO	80
+#define R_PPC64_GOT_TLSGD16_HI	81
+#define R_PPC64_GOT_TLSGD16_HA	82
+#define R_PPC64_GOT_TLSLD16	83
+#define R_PPC64_GOT_TLSLD16_LO	84
+#define R_PPC64_GOT_TLSLD16_HI	85
+#define R_PPC64_GOT_TLSLD16_HA	86
+#define R_PPC64_GOT_TPREL16_DS	87
+#define R_PPC64_GOT_TPREL16_LO_DS 88
+#define R_PPC64_GOT_TPREL16_HI	89
+#define R_PPC64_GOT_TPREL16_HA	90
+#define R_PPC64_GOT_DTPREL16_DS	91
+#define R_PPC64_GOT_DTPREL16_LO_DS 92
+#define R_PPC64_GOT_DTPREL16_HI	93
+#define R_PPC64_GOT_DTPREL16_HA	94
+#define R_PPC64_TPREL16_DS	95
+#define R_PPC64_TPREL16_LO_DS	96
+#define R_PPC64_TPREL16_HIGHER	97
+#define R_PPC64_TPREL16_HIGHERA	98
+#define R_PPC64_TPREL16_HIGHEST	99
+#define R_PPC64_TPREL16_HIGHESTA 100
+#define R_PPC64_DTPREL16_DS	101
+#define R_PPC64_DTPREL16_LO_DS	102
+#define R_PPC64_DTPREL16_HIGHER	103
+#define R_PPC64_DTPREL16_HIGHERA 104
+#define R_PPC64_DTPREL16_HIGHEST 105
+#define R_PPC64_DTPREL16_HIGHESTA 106
+#define R_PPC64_TLSGD		107
+#define R_PPC64_TLSLD		108
+#define R_PPC64_TOCSAVE		109
+#define R_PPC64_ADDR16_HIGH	110
+#define R_PPC64_ADDR16_HIGHA	111
+#define R_PPC64_TPREL16_HIGH	112
+#define R_PPC64_TPREL16_HIGHA	113
+#define R_PPC64_DTPREL16_HIGH	114
+#define R_PPC64_DTPREL16_HIGHA	115
+
+
+#define R_PPC64_JMP_IREL	247
+#define R_PPC64_IRELATIVE	248
+#define R_PPC64_REL16		249
+#define R_PPC64_REL16_LO	250
+#define R_PPC64_REL16_HI	251
+#define R_PPC64_REL16_HA	252
+
+#define EF_PPC64_ABI	3
+
+#define DT_PPC64_GLINK  (DT_LOPROC + 0)
+#define DT_PPC64_OPD	(DT_LOPROC + 1)
+#define DT_PPC64_OPDSZ	(DT_LOPROC + 2)
+#define DT_PPC64_OPT	(DT_LOPROC + 3)
+#define DT_PPC64_NUM	4
+
+#define PPC64_OPT_TLS		1
+#define PPC64_OPT_MULTI_TOC	2
+#define PPC64_OPT_LOCALENTRY	4
+
+#define STO_PPC64_LOCAL_BIT	5
+#define STO_PPC64_LOCAL_MASK	0xe0
+#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc)
+
+
+#define EF_ARM_RELEXEC		0x01
+#define EF_ARM_HASENTRY		0x02
+#define EF_ARM_INTERWORK	0x04
+#define EF_ARM_APCS_26		0x08
+#define EF_ARM_APCS_FLOAT	0x10
+#define EF_ARM_PIC		0x20
+#define EF_ARM_ALIGN8		0x40
+#define EF_ARM_NEW_ABI		0x80
+#define EF_ARM_OLD_ABI		0x100
+#define EF_ARM_SOFT_FLOAT	0x200
+#define EF_ARM_VFP_FLOAT	0x400
+#define EF_ARM_MAVERICK_FLOAT	0x800
+
+#define EF_ARM_ABI_FLOAT_SOFT	0x200
+#define EF_ARM_ABI_FLOAT_HARD	0x400
+
+
+#define EF_ARM_SYMSARESORTED	0x04
+#define EF_ARM_DYNSYMSUSESEGIDX	0x08
+#define EF_ARM_MAPSYMSFIRST	0x10
+#define EF_ARM_EABIMASK		0XFF000000
+
+
+#define EF_ARM_BE8	    0x00800000
+#define EF_ARM_LE8	    0x00400000
+
+#define EF_ARM_EABI_VERSION(flags)	((flags) & EF_ARM_EABIMASK)
+#define EF_ARM_EABI_UNKNOWN	0x00000000
+#define EF_ARM_EABI_VER1	0x01000000
+#define EF_ARM_EABI_VER2	0x02000000
+#define EF_ARM_EABI_VER3	0x03000000
+#define EF_ARM_EABI_VER4	0x04000000
+#define EF_ARM_EABI_VER5	0x05000000
+
+
+#define STT_ARM_TFUNC		STT_LOPROC
+#define STT_ARM_16BIT		STT_HIPROC
+
+
+#define SHF_ARM_ENTRYSECT	0x10000000
+#define SHF_ARM_COMDEF		0x80000000
+
+
+
+#define PF_ARM_SB		0x10000000
+
+#define PF_ARM_PI		0x20000000
+#define PF_ARM_ABS		0x40000000
+
+
+#define PT_ARM_EXIDX		(PT_LOPROC + 1)
+
+
+#define SHT_ARM_EXIDX		(SHT_LOPROC + 1)
+#define SHT_ARM_PREEMPTMAP	(SHT_LOPROC + 2)
+#define SHT_ARM_ATTRIBUTES	(SHT_LOPROC + 3)
+
+#define R_AARCH64_NONE            0
+#define R_AARCH64_P32_ABS32	1
+#define R_AARCH64_P32_COPY	180
+#define R_AARCH64_P32_GLOB_DAT	181
+#define R_AARCH64_P32_JUMP_SLOT	182
+#define R_AARCH64_P32_RELATIVE	183
+#define R_AARCH64_P32_TLS_DTPMOD 184
+#define R_AARCH64_P32_TLS_DTPREL 185
+#define R_AARCH64_P32_TLS_TPREL	186
+#define R_AARCH64_P32_TLSDESC	187
+#define R_AARCH64_P32_IRELATIVE	188
+#define R_AARCH64_ABS64         257
+#define R_AARCH64_ABS32         258
+#define R_AARCH64_ABS16		259
+#define R_AARCH64_PREL64	260
+#define R_AARCH64_PREL32	261
+#define R_AARCH64_PREL16	262
+#define R_AARCH64_MOVW_UABS_G0	263
+#define R_AARCH64_MOVW_UABS_G0_NC 264
+#define R_AARCH64_MOVW_UABS_G1	265
+#define R_AARCH64_MOVW_UABS_G1_NC 266
+#define R_AARCH64_MOVW_UABS_G2	267
+#define R_AARCH64_MOVW_UABS_G2_NC 268
+#define R_AARCH64_MOVW_UABS_G3	269
+#define R_AARCH64_MOVW_SABS_G0	270
+#define R_AARCH64_MOVW_SABS_G1	271
+#define R_AARCH64_MOVW_SABS_G2	272
+#define R_AARCH64_LD_PREL_LO19	273
+#define R_AARCH64_ADR_PREL_LO21	274
+#define R_AARCH64_ADR_PREL_PG_HI21 275
+#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
+#define R_AARCH64_ADD_ABS_LO12_NC 277
+#define R_AARCH64_LDST8_ABS_LO12_NC 278
+#define R_AARCH64_TSTBR14	279
+#define R_AARCH64_CONDBR19	280
+#define R_AARCH64_JUMP26	282
+#define R_AARCH64_CALL26	283
+#define R_AARCH64_LDST16_ABS_LO12_NC 284
+#define R_AARCH64_LDST32_ABS_LO12_NC 285
+#define R_AARCH64_LDST64_ABS_LO12_NC 286
+#define R_AARCH64_MOVW_PREL_G0	287
+#define R_AARCH64_MOVW_PREL_G0_NC 288
+#define R_AARCH64_MOVW_PREL_G1	289
+#define R_AARCH64_MOVW_PREL_G1_NC 290
+#define R_AARCH64_MOVW_PREL_G2	291
+#define R_AARCH64_MOVW_PREL_G2_NC 292
+#define R_AARCH64_MOVW_PREL_G3	293
+#define R_AARCH64_LDST128_ABS_LO12_NC 299
+#define R_AARCH64_MOVW_GOTOFF_G0 300
+#define R_AARCH64_MOVW_GOTOFF_G0_NC 301
+#define R_AARCH64_MOVW_GOTOFF_G1 302
+#define R_AARCH64_MOVW_GOTOFF_G1_NC 303
+#define R_AARCH64_MOVW_GOTOFF_G2 304
+#define R_AARCH64_MOVW_GOTOFF_G2_NC 305
+#define R_AARCH64_MOVW_GOTOFF_G3 306
+#define R_AARCH64_GOTREL64	307
+#define R_AARCH64_GOTREL32	308
+#define R_AARCH64_GOT_LD_PREL19	309
+#define R_AARCH64_LD64_GOTOFF_LO15 310
+#define R_AARCH64_ADR_GOT_PAGE	311
+#define R_AARCH64_LD64_GOT_LO12_NC 312
+#define R_AARCH64_LD64_GOTPAGE_LO15 313
+#define R_AARCH64_TLSGD_ADR_PREL21 512
+#define R_AARCH64_TLSGD_ADR_PAGE21 513
+#define R_AARCH64_TLSGD_ADD_LO12_NC 514
+#define R_AARCH64_TLSGD_MOVW_G1	515
+#define R_AARCH64_TLSGD_MOVW_G0_NC 516
+#define R_AARCH64_TLSLD_ADR_PREL21 517
+#define R_AARCH64_TLSLD_ADR_PAGE21 518
+#define R_AARCH64_TLSLD_ADD_LO12_NC 519
+#define R_AARCH64_TLSLD_MOVW_G1	520
+#define R_AARCH64_TLSLD_MOVW_G0_NC 521
+#define R_AARCH64_TLSLD_LD_PREL19 522
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527
+#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540
+#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541
+#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542
+#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543
+#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548
+#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559
+#define R_AARCH64_TLSDESC_LD_PREL19 560
+#define R_AARCH64_TLSDESC_ADR_PREL21 561
+#define R_AARCH64_TLSDESC_ADR_PAGE21 562
+#define R_AARCH64_TLSDESC_LD64_LO12 563
+#define R_AARCH64_TLSDESC_ADD_LO12 564
+#define R_AARCH64_TLSDESC_OFF_G1 565
+#define R_AARCH64_TLSDESC_OFF_G0_NC 566
+#define R_AARCH64_TLSDESC_LDR	567
+#define R_AARCH64_TLSDESC_ADD	568
+#define R_AARCH64_TLSDESC_CALL	569
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573
+#define R_AARCH64_COPY         1024
+#define R_AARCH64_GLOB_DAT     1025
+#define R_AARCH64_JUMP_SLOT    1026
+#define R_AARCH64_RELATIVE     1027
+#define R_AARCH64_TLS_DTPMOD   1028
+#define R_AARCH64_TLS_DTPMOD64 1028
+#define R_AARCH64_TLS_DTPREL   1029
+#define R_AARCH64_TLS_DTPREL64 1029
+#define R_AARCH64_TLS_TPREL    1030
+#define R_AARCH64_TLS_TPREL64  1030
+#define R_AARCH64_TLSDESC      1031
+
+
+#define R_ARM_NONE		0
+#define R_ARM_PC24		1
+#define R_ARM_ABS32		2
+#define R_ARM_REL32		3
+#define R_ARM_PC13		4
+#define R_ARM_ABS16		5
+#define R_ARM_ABS12		6
+#define R_ARM_THM_ABS5		7
+#define R_ARM_ABS8		8
+#define R_ARM_SBREL32		9
+#define R_ARM_THM_PC22		10
+#define R_ARM_THM_PC8		11
+#define R_ARM_AMP_VCALL9	12
+#define R_ARM_TLS_DESC		13
+#define R_ARM_THM_SWI8		14
+#define R_ARM_XPC25		15
+#define R_ARM_THM_XPC22		16
+#define R_ARM_TLS_DTPMOD32	17
+#define R_ARM_TLS_DTPOFF32	18
+#define R_ARM_TLS_TPOFF32	19
+#define R_ARM_COPY		20
+#define R_ARM_GLOB_DAT		21
+#define R_ARM_JUMP_SLOT		22
+#define R_ARM_RELATIVE		23
+#define R_ARM_GOTOFF		24
+#define R_ARM_GOTPC		25
+#define R_ARM_GOT32		26
+#define R_ARM_PLT32		27
+#define R_ARM_CALL		28
+#define R_ARM_JUMP24		29
+#define R_ARM_THM_JUMP24	30
+#define R_ARM_BASE_ABS		31
+#define R_ARM_ALU_PCREL_7_0	32
+#define R_ARM_ALU_PCREL_15_8	33
+#define R_ARM_ALU_PCREL_23_15	34
+#define R_ARM_LDR_SBREL_11_0	35
+#define R_ARM_ALU_SBREL_19_12	36
+#define R_ARM_ALU_SBREL_27_20	37
+#define R_ARM_TARGET1		38
+#define R_ARM_SBREL31		39
+#define R_ARM_V4BX		40
+#define R_ARM_TARGET2		41
+#define R_ARM_PREL31		42
+#define R_ARM_MOVW_ABS_NC	43
+#define R_ARM_MOVT_ABS		44
+#define R_ARM_MOVW_PREL_NC	45
+#define R_ARM_MOVT_PREL		46
+#define R_ARM_THM_MOVW_ABS_NC	47
+#define R_ARM_THM_MOVT_ABS	48
+#define R_ARM_THM_MOVW_PREL_NC	49
+#define R_ARM_THM_MOVT_PREL	50
+#define R_ARM_THM_JUMP19	51
+#define R_ARM_THM_JUMP6		52
+#define R_ARM_THM_ALU_PREL_11_0	53
+#define R_ARM_THM_PC12		54
+#define R_ARM_ABS32_NOI		55
+#define R_ARM_REL32_NOI		56
+#define R_ARM_ALU_PC_G0_NC	57
+#define R_ARM_ALU_PC_G0		58
+#define R_ARM_ALU_PC_G1_NC	59
+#define R_ARM_ALU_PC_G1		60
+#define R_ARM_ALU_PC_G2		61
+#define R_ARM_LDR_PC_G1		62
+#define R_ARM_LDR_PC_G2		63
+#define R_ARM_LDRS_PC_G0	64
+#define R_ARM_LDRS_PC_G1	65
+#define R_ARM_LDRS_PC_G2	66
+#define R_ARM_LDC_PC_G0		67
+#define R_ARM_LDC_PC_G1		68
+#define R_ARM_LDC_PC_G2		69
+#define R_ARM_ALU_SB_G0_NC	70
+#define R_ARM_ALU_SB_G0		71
+#define R_ARM_ALU_SB_G1_NC	72
+#define R_ARM_ALU_SB_G1		73
+#define R_ARM_ALU_SB_G2		74
+#define R_ARM_LDR_SB_G0		75
+#define R_ARM_LDR_SB_G1		76
+#define R_ARM_LDR_SB_G2		77
+#define R_ARM_LDRS_SB_G0	78
+#define R_ARM_LDRS_SB_G1	79
+#define R_ARM_LDRS_SB_G2	80
+#define R_ARM_LDC_SB_G0		81
+#define R_ARM_LDC_SB_G1		82
+#define R_ARM_LDC_SB_G2		83
+#define R_ARM_MOVW_BREL_NC	84
+#define R_ARM_MOVT_BREL		85
+#define R_ARM_MOVW_BREL		86
+#define R_ARM_THM_MOVW_BREL_NC	87
+#define R_ARM_THM_MOVT_BREL	88
+#define R_ARM_THM_MOVW_BREL	89
+#define R_ARM_TLS_GOTDESC	90
+#define R_ARM_TLS_CALL		91
+#define R_ARM_TLS_DESCSEQ	92
+#define R_ARM_THM_TLS_CALL	93
+#define R_ARM_PLT32_ABS		94
+#define R_ARM_GOT_ABS		95
+#define R_ARM_GOT_PREL		96
+#define R_ARM_GOT_BREL12	97
+#define R_ARM_GOTOFF12		98
+#define R_ARM_GOTRELAX		99
+#define R_ARM_GNU_VTENTRY	100
+#define R_ARM_GNU_VTINHERIT	101
+#define R_ARM_THM_PC11		102
+#define R_ARM_THM_PC9		103
+#define R_ARM_TLS_GD32		104
+
+#define R_ARM_TLS_LDM32		105
+
+#define R_ARM_TLS_LDO32		106
+
+#define R_ARM_TLS_IE32		107
+
+#define R_ARM_TLS_LE32		108
+#define R_ARM_TLS_LDO12		109
+#define R_ARM_TLS_LE12		110
+#define R_ARM_TLS_IE12GP	111
+#define R_ARM_ME_TOO		128
+#define R_ARM_THM_TLS_DESCSEQ	129
+#define R_ARM_THM_TLS_DESCSEQ16	129
+#define R_ARM_THM_TLS_DESCSEQ32	130
+#define R_ARM_THM_GOT_BREL12	131
+#define R_ARM_IRELATIVE		160
+#define R_ARM_RXPC25		249
+#define R_ARM_RSBREL32		250
+#define R_ARM_THM_RPC22		251
+#define R_ARM_RREL32		252
+#define R_ARM_RABS22		253
+#define R_ARM_RPC24		254
+#define R_ARM_RBASE		255
+
+#define R_ARM_NUM		256
+
+
+#define R_CKCORE_NONE               0
+#define R_CKCORE_ADDR32             1
+#define R_CKCORE_PCRELIMM8BY4       2
+#define R_CKCORE_PCRELIMM11BY2      3
+#define R_CKCORE_PCREL32            5
+#define R_CKCORE_PCRELJSR_IMM11BY2  6
+#define R_CKCORE_RELATIVE           9
+#define R_CKCORE_COPY               10
+#define R_CKCORE_GLOB_DAT           11
+#define R_CKCORE_JUMP_SLOT          12
+#define R_CKCORE_GOTOFF             13
+#define R_CKCORE_GOTPC              14
+#define R_CKCORE_GOT32              15
+#define R_CKCORE_PLT32              16
+#define R_CKCORE_ADDRGOT            17
+#define R_CKCORE_ADDRPLT            18
+#define R_CKCORE_PCREL_IMM26BY2     19
+#define R_CKCORE_PCREL_IMM16BY2     20
+#define R_CKCORE_PCREL_IMM16BY4     21
+#define R_CKCORE_PCREL_IMM10BY2     22
+#define R_CKCORE_PCREL_IMM10BY4     23
+#define R_CKCORE_ADDR_HI16          24
+#define R_CKCORE_ADDR_LO16          25
+#define R_CKCORE_GOTPC_HI16         26
+#define R_CKCORE_GOTPC_LO16         27
+#define R_CKCORE_GOTOFF_HI16        28
+#define R_CKCORE_GOTOFF_LO16        29
+#define R_CKCORE_GOT12              30
+#define R_CKCORE_GOT_HI16           31
+#define R_CKCORE_GOT_LO16           32
+#define R_CKCORE_PLT12              33
+#define R_CKCORE_PLT_HI16           34
+#define R_CKCORE_PLT_LO16           35
+#define R_CKCORE_ADDRGOT_HI16       36
+#define R_CKCORE_ADDRGOT_LO16       37
+#define R_CKCORE_ADDRPLT_HI16       38
+#define R_CKCORE_ADDRPLT_LO16       39
+#define R_CKCORE_PCREL_JSR_IMM26BY2 40
+#define R_CKCORE_TOFFSET_LO16       41
+#define R_CKCORE_DOFFSET_LO16       42
+#define R_CKCORE_PCREL_IMM18BY2     43
+#define R_CKCORE_DOFFSET_IMM18      44
+#define R_CKCORE_DOFFSET_IMM18BY2   45
+#define R_CKCORE_DOFFSET_IMM18BY4   46
+#define R_CKCORE_GOT_IMM18BY4       48
+#define R_CKCORE_PLT_IMM18BY4       49
+#define R_CKCORE_PCREL_IMM7BY4      50
+#define R_CKCORE_TLS_LE32           51
+#define R_CKCORE_TLS_IE32           52
+#define R_CKCORE_TLS_GD32           53
+#define R_CKCORE_TLS_LDM32          54
+#define R_CKCORE_TLS_LDO32          55
+#define R_CKCORE_TLS_DTPMOD32       56
+#define R_CKCORE_TLS_DTPOFF32       57
+#define R_CKCORE_TLS_TPOFF32        58
+
+
+#define EF_IA_64_MASKOS		0x0000000f
+#define EF_IA_64_ABI64		0x00000010
+#define EF_IA_64_ARCH		0xff000000
+
+
+#define PT_IA_64_ARCHEXT	(PT_LOPROC + 0)
+#define PT_IA_64_UNWIND		(PT_LOPROC + 1)
+#define PT_IA_64_HP_OPT_ANOT	(PT_LOOS + 0x12)
+#define PT_IA_64_HP_HSL_ANOT	(PT_LOOS + 0x13)
+#define PT_IA_64_HP_STACK	(PT_LOOS + 0x14)
+
+
+#define PF_IA_64_NORECOV	0x80000000
+
+
+#define SHT_IA_64_EXT		(SHT_LOPROC + 0)
+#define SHT_IA_64_UNWIND	(SHT_LOPROC + 1)
+
+
+#define SHF_IA_64_SHORT		0x10000000
+#define SHF_IA_64_NORECOV	0x20000000
+
+
+#define DT_IA_64_PLT_RESERVE	(DT_LOPROC + 0)
+#define DT_IA_64_NUM		1
+
+
+#define R_IA64_NONE		0x00
+#define R_IA64_IMM14		0x21
+#define R_IA64_IMM22		0x22
+#define R_IA64_IMM64		0x23
+#define R_IA64_DIR32MSB		0x24
+#define R_IA64_DIR32LSB		0x25
+#define R_IA64_DIR64MSB		0x26
+#define R_IA64_DIR64LSB		0x27
+#define R_IA64_GPREL22		0x2a
+#define R_IA64_GPREL64I		0x2b
+#define R_IA64_GPREL32MSB	0x2c
+#define R_IA64_GPREL32LSB	0x2d
+#define R_IA64_GPREL64MSB	0x2e
+#define R_IA64_GPREL64LSB	0x2f
+#define R_IA64_LTOFF22		0x32
+#define R_IA64_LTOFF64I		0x33
+#define R_IA64_PLTOFF22		0x3a
+#define R_IA64_PLTOFF64I	0x3b
+#define R_IA64_PLTOFF64MSB	0x3e
+#define R_IA64_PLTOFF64LSB	0x3f
+#define R_IA64_FPTR64I		0x43
+#define R_IA64_FPTR32MSB	0x44
+#define R_IA64_FPTR32LSB	0x45
+#define R_IA64_FPTR64MSB	0x46
+#define R_IA64_FPTR64LSB	0x47
+#define R_IA64_PCREL60B		0x48
+#define R_IA64_PCREL21B		0x49
+#define R_IA64_PCREL21M		0x4a
+#define R_IA64_PCREL21F		0x4b
+#define R_IA64_PCREL32MSB	0x4c
+#define R_IA64_PCREL32LSB	0x4d
+#define R_IA64_PCREL64MSB	0x4e
+#define R_IA64_PCREL64LSB	0x4f
+#define R_IA64_LTOFF_FPTR22	0x52
+#define R_IA64_LTOFF_FPTR64I	0x53
+#define R_IA64_LTOFF_FPTR32MSB	0x54
+#define R_IA64_LTOFF_FPTR32LSB	0x55
+#define R_IA64_LTOFF_FPTR64MSB	0x56
+#define R_IA64_LTOFF_FPTR64LSB	0x57
+#define R_IA64_SEGREL32MSB	0x5c
+#define R_IA64_SEGREL32LSB	0x5d
+#define R_IA64_SEGREL64MSB	0x5e
+#define R_IA64_SEGREL64LSB	0x5f
+#define R_IA64_SECREL32MSB	0x64
+#define R_IA64_SECREL32LSB	0x65
+#define R_IA64_SECREL64MSB	0x66
+#define R_IA64_SECREL64LSB	0x67
+#define R_IA64_REL32MSB		0x6c
+#define R_IA64_REL32LSB		0x6d
+#define R_IA64_REL64MSB		0x6e
+#define R_IA64_REL64LSB		0x6f
+#define R_IA64_LTV32MSB		0x74
+#define R_IA64_LTV32LSB		0x75
+#define R_IA64_LTV64MSB		0x76
+#define R_IA64_LTV64LSB		0x77
+#define R_IA64_PCREL21BI	0x79
+#define R_IA64_PCREL22		0x7a
+#define R_IA64_PCREL64I		0x7b
+#define R_IA64_IPLTMSB		0x80
+#define R_IA64_IPLTLSB		0x81
+#define R_IA64_COPY		0x84
+#define R_IA64_SUB		0x85
+#define R_IA64_LTOFF22X		0x86
+#define R_IA64_LDXMOV		0x87
+#define R_IA64_TPREL14		0x91
+#define R_IA64_TPREL22		0x92
+#define R_IA64_TPREL64I		0x93
+#define R_IA64_TPREL64MSB	0x96
+#define R_IA64_TPREL64LSB	0x97
+#define R_IA64_LTOFF_TPREL22	0x9a
+#define R_IA64_DTPMOD64MSB	0xa6
+#define R_IA64_DTPMOD64LSB	0xa7
+#define R_IA64_LTOFF_DTPMOD22	0xaa
+#define R_IA64_DTPREL14		0xb1
+#define R_IA64_DTPREL22		0xb2
+#define R_IA64_DTPREL64I	0xb3
+#define R_IA64_DTPREL32MSB	0xb4
+#define R_IA64_DTPREL32LSB	0xb5
+#define R_IA64_DTPREL64MSB	0xb6
+#define R_IA64_DTPREL64LSB	0xb7
+#define R_IA64_LTOFF_DTPREL22	0xba
+
+
+#define EF_SH_MACH_MASK		0x1f
+#define EF_SH_UNKNOWN		0x0
+#define EF_SH1			0x1
+#define EF_SH2			0x2
+#define EF_SH3			0x3
+#define EF_SH_DSP		0x4
+#define EF_SH3_DSP		0x5
+#define EF_SH4AL_DSP		0x6
+#define EF_SH3E			0x8
+#define EF_SH4			0x9
+#define EF_SH2E			0xb
+#define EF_SH4A			0xc
+#define EF_SH2A			0xd
+#define EF_SH4_NOFPU		0x10
+#define EF_SH4A_NOFPU		0x11
+#define EF_SH4_NOMMU_NOFPU	0x12
+#define EF_SH2A_NOFPU		0x13
+#define EF_SH3_NOMMU		0x14
+#define EF_SH2A_SH4_NOFPU	0x15
+#define EF_SH2A_SH3_NOFPU	0x16
+#define EF_SH2A_SH4		0x17
+#define EF_SH2A_SH3E		0x18
+
+#define	R_SH_NONE		0
+#define	R_SH_DIR32		1
+#define	R_SH_REL32		2
+#define	R_SH_DIR8WPN		3
+#define	R_SH_IND12W		4
+#define	R_SH_DIR8WPL		5
+#define	R_SH_DIR8WPZ		6
+#define	R_SH_DIR8BP		7
+#define	R_SH_DIR8W		8
+#define	R_SH_DIR8L		9
+#define	R_SH_SWITCH16		25
+#define	R_SH_SWITCH32		26
+#define	R_SH_USES		27
+#define	R_SH_COUNT		28
+#define	R_SH_ALIGN		29
+#define	R_SH_CODE		30
+#define	R_SH_DATA		31
+#define	R_SH_LABEL		32
+#define	R_SH_SWITCH8		33
+#define	R_SH_GNU_VTINHERIT	34
+#define	R_SH_GNU_VTENTRY	35
+#define	R_SH_TLS_GD_32		144
+#define	R_SH_TLS_LD_32		145
+#define	R_SH_TLS_LDO_32		146
+#define	R_SH_TLS_IE_32		147
+#define	R_SH_TLS_LE_32		148
+#define	R_SH_TLS_DTPMOD32	149
+#define	R_SH_TLS_DTPOFF32	150
+#define	R_SH_TLS_TPOFF32	151
+#define	R_SH_GOT32		160
+#define	R_SH_PLT32		161
+#define	R_SH_COPY		162
+#define	R_SH_GLOB_DAT		163
+#define	R_SH_JMP_SLOT		164
+#define	R_SH_RELATIVE		165
+#define	R_SH_GOTOFF		166
+#define	R_SH_GOTPC		167
+#define	R_SH_GOT20		201
+#define	R_SH_GOTOFF20		202
+#define	R_SH_GOTFUNCDESC	203
+#define	R_SH_GOTFUNCDEST20	204
+#define	R_SH_GOTOFFFUNCDESC	205
+#define	R_SH_GOTOFFFUNCDEST20	206
+#define	R_SH_FUNCDESC		207
+#define	R_SH_FUNCDESC_VALUE	208
+
+#define	R_SH_NUM		256
+
+
+
+#define R_390_NONE		0
+#define R_390_8			1
+#define R_390_12		2
+#define R_390_16		3
+#define R_390_32		4
+#define R_390_PC32		5
+#define R_390_GOT12		6
+#define R_390_GOT32		7
+#define R_390_PLT32		8
+#define R_390_COPY		9
+#define R_390_GLOB_DAT		10
+#define R_390_JMP_SLOT		11
+#define R_390_RELATIVE		12
+#define R_390_GOTOFF32		13
+#define R_390_GOTPC		14
+#define R_390_GOT16		15
+#define R_390_PC16		16
+#define R_390_PC16DBL		17
+#define R_390_PLT16DBL		18
+#define R_390_PC32DBL		19
+#define R_390_PLT32DBL		20
+#define R_390_GOTPCDBL		21
+#define R_390_64		22
+#define R_390_PC64		23
+#define R_390_GOT64		24
+#define R_390_PLT64		25
+#define R_390_GOTENT		26
+#define R_390_GOTOFF16		27
+#define R_390_GOTOFF64		28
+#define R_390_GOTPLT12		29
+#define R_390_GOTPLT16		30
+#define R_390_GOTPLT32		31
+#define R_390_GOTPLT64		32
+#define R_390_GOTPLTENT		33
+#define R_390_PLTOFF16		34
+#define R_390_PLTOFF32		35
+#define R_390_PLTOFF64		36
+#define R_390_TLS_LOAD		37
+#define R_390_TLS_GDCALL	38
+
+#define R_390_TLS_LDCALL	39
+
+#define R_390_TLS_GD32		40
+
+#define R_390_TLS_GD64		41
+
+#define R_390_TLS_GOTIE12	42
+
+#define R_390_TLS_GOTIE32	43
+
+#define R_390_TLS_GOTIE64	44
+
+#define R_390_TLS_LDM32		45
+
+#define R_390_TLS_LDM64		46
+
+#define R_390_TLS_IE32		47
+
+#define R_390_TLS_IE64		48
+
+#define R_390_TLS_IEENT		49
+
+#define R_390_TLS_LE32		50
+
+#define R_390_TLS_LE64		51
+
+#define R_390_TLS_LDO32		52
+
+#define R_390_TLS_LDO64		53
+
+#define R_390_TLS_DTPMOD	54
+#define R_390_TLS_DTPOFF	55
+#define R_390_TLS_TPOFF		56
+
+#define R_390_20		57
+#define R_390_GOT20		58
+#define R_390_GOTPLT20		59
+#define R_390_TLS_GOTIE20	60
+
+
+#define R_390_NUM		61
+
+
+
+#define R_CRIS_NONE		0
+#define R_CRIS_8		1
+#define R_CRIS_16		2
+#define R_CRIS_32		3
+#define R_CRIS_8_PCREL		4
+#define R_CRIS_16_PCREL		5
+#define R_CRIS_32_PCREL		6
+#define R_CRIS_GNU_VTINHERIT	7
+#define R_CRIS_GNU_VTENTRY	8
+#define R_CRIS_COPY		9
+#define R_CRIS_GLOB_DAT		10
+#define R_CRIS_JUMP_SLOT	11
+#define R_CRIS_RELATIVE		12
+#define R_CRIS_16_GOT		13
+#define R_CRIS_32_GOT		14
+#define R_CRIS_16_GOTPLT	15
+#define R_CRIS_32_GOTPLT	16
+#define R_CRIS_32_GOTREL	17
+#define R_CRIS_32_PLT_GOTREL	18
+#define R_CRIS_32_PLT_PCREL	19
+
+#define R_CRIS_NUM		20
+
+
+
+#define R_X86_64_NONE		0
+#define R_X86_64_64		1
+#define R_X86_64_PC32		2
+#define R_X86_64_GOT32		3
+#define R_X86_64_PLT32		4
+#define R_X86_64_COPY		5
+#define R_X86_64_GLOB_DAT	6
+#define R_X86_64_JUMP_SLOT	7
+#define R_X86_64_RELATIVE	8
+#define R_X86_64_GOTPCREL	9
+
+#define R_X86_64_32		10
+#define R_X86_64_32S		11
+#define R_X86_64_16		12
+#define R_X86_64_PC16		13
+#define R_X86_64_8		14
+#define R_X86_64_PC8		15
+#define R_X86_64_DTPMOD64	16
+#define R_X86_64_DTPOFF64	17
+#define R_X86_64_TPOFF64	18
+#define R_X86_64_TLSGD		19
+
+#define R_X86_64_TLSLD		20
+
+#define R_X86_64_DTPOFF32	21
+#define R_X86_64_GOTTPOFF	22
+
+#define R_X86_64_TPOFF32	23
+#define R_X86_64_PC64		24
+#define R_X86_64_GOTOFF64	25
+#define R_X86_64_GOTPC32	26
+#define R_X86_64_GOT64		27
+#define R_X86_64_GOTPCREL64	28
+#define R_X86_64_GOTPC64	29
+#define R_X86_64_GOTPLT64	30
+#define R_X86_64_PLTOFF64	31
+#define R_X86_64_SIZE32		32
+#define R_X86_64_SIZE64		33
+
+#define R_X86_64_GOTPC32_TLSDESC 34
+#define R_X86_64_TLSDESC_CALL   35
+
+#define R_X86_64_TLSDESC        36
+#define R_X86_64_IRELATIVE	37
+#define R_X86_64_RELATIVE64	38
+#define R_X86_64_GOTPCRELX	41
+#define R_X86_64_REX_GOTPCRELX	42
+#define R_X86_64_NUM		43
+
+
+
+#define R_MN10300_NONE		0
+#define R_MN10300_32		1
+#define R_MN10300_16		2
+#define R_MN10300_8		3
+#define R_MN10300_PCREL32	4
+#define R_MN10300_PCREL16	5
+#define R_MN10300_PCREL8	6
+#define R_MN10300_GNU_VTINHERIT	7
+#define R_MN10300_GNU_VTENTRY	8
+#define R_MN10300_24		9
+#define R_MN10300_GOTPC32	10
+#define R_MN10300_GOTPC16	11
+#define R_MN10300_GOTOFF32	12
+#define R_MN10300_GOTOFF24	13
+#define R_MN10300_GOTOFF16	14
+#define R_MN10300_PLT32		15
+#define R_MN10300_PLT16		16
+#define R_MN10300_GOT32		17
+#define R_MN10300_GOT24		18
+#define R_MN10300_GOT16		19
+#define R_MN10300_COPY		20
+#define R_MN10300_GLOB_DAT	21
+#define R_MN10300_JMP_SLOT	22
+#define R_MN10300_RELATIVE	23
+
+#define R_MN10300_NUM		24
+
+
+
+#define R_M32R_NONE		0
+#define R_M32R_16		1
+#define R_M32R_32		2
+#define R_M32R_24		3
+#define R_M32R_10_PCREL		4
+#define R_M32R_18_PCREL		5
+#define R_M32R_26_PCREL		6
+#define R_M32R_HI16_ULO		7
+#define R_M32R_HI16_SLO		8
+#define R_M32R_LO16		9
+#define R_M32R_SDA16		10
+#define R_M32R_GNU_VTINHERIT	11
+#define R_M32R_GNU_VTENTRY	12
+
+#define R_M32R_16_RELA		33
+#define R_M32R_32_RELA		34
+#define R_M32R_24_RELA		35
+#define R_M32R_10_PCREL_RELA	36
+#define R_M32R_18_PCREL_RELA	37
+#define R_M32R_26_PCREL_RELA	38
+#define R_M32R_HI16_ULO_RELA	39
+#define R_M32R_HI16_SLO_RELA	40
+#define R_M32R_LO16_RELA	41
+#define R_M32R_SDA16_RELA	42
+#define R_M32R_RELA_GNU_VTINHERIT	43
+#define R_M32R_RELA_GNU_VTENTRY	44
+#define R_M32R_REL32		45
+
+#define R_M32R_GOT24		48
+#define R_M32R_26_PLTREL	49
+#define R_M32R_COPY		50
+#define R_M32R_GLOB_DAT		51
+#define R_M32R_JMP_SLOT		52
+#define R_M32R_RELATIVE		53
+#define R_M32R_GOTOFF		54
+#define R_M32R_GOTPC24		55
+#define R_M32R_GOT16_HI_ULO	56
+
+#define R_M32R_GOT16_HI_SLO	57
+
+#define R_M32R_GOT16_LO		58
+#define R_M32R_GOTPC_HI_ULO	59
+
+#define R_M32R_GOTPC_HI_SLO	60
+
+#define R_M32R_GOTPC_LO		61
+
+#define R_M32R_GOTOFF_HI_ULO	62
+
+#define R_M32R_GOTOFF_HI_SLO	63
+
+#define R_M32R_GOTOFF_LO	64
+#define R_M32R_NUM		256
+
+#define R_MICROBLAZE_NONE 0
+#define R_MICROBLAZE_32 1
+#define R_MICROBLAZE_32_PCREL 2
+#define R_MICROBLAZE_64_PCREL 3
+#define R_MICROBLAZE_32_PCREL_LO 4
+#define R_MICROBLAZE_64 5
+#define R_MICROBLAZE_32_LO 6
+#define R_MICROBLAZE_SRO32 7
+#define R_MICROBLAZE_SRW32 8
+#define R_MICROBLAZE_64_NONE 9
+#define R_MICROBLAZE_32_SYM_OP_SYM 10
+#define R_MICROBLAZE_GNU_VTINHERIT 11
+#define R_MICROBLAZE_GNU_VTENTRY 12
+#define R_MICROBLAZE_GOTPC_64 13
+#define R_MICROBLAZE_GOT_64 14
+#define R_MICROBLAZE_PLT_64 15
+#define R_MICROBLAZE_REL 16
+#define R_MICROBLAZE_JUMP_SLOT 17
+#define R_MICROBLAZE_GLOB_DAT 18
+#define R_MICROBLAZE_GOTOFF_64 19
+#define R_MICROBLAZE_GOTOFF_32 20
+#define R_MICROBLAZE_COPY 21
+#define R_MICROBLAZE_TLS 22
+#define R_MICROBLAZE_TLSGD 23
+#define R_MICROBLAZE_TLSLD 24
+#define R_MICROBLAZE_TLSDTPMOD32 25
+#define R_MICROBLAZE_TLSDTPREL32 26
+#define R_MICROBLAZE_TLSDTPREL64 27
+#define R_MICROBLAZE_TLSGOTTPREL32 28
+#define R_MICROBLAZE_TLSTPREL32	 29
+
+#define DT_NIOS2_GP             0x70000002
+
+#define R_NIOS2_NONE		0
+#define R_NIOS2_S16		1
+#define R_NIOS2_U16		2
+#define R_NIOS2_PCREL16		3
+#define R_NIOS2_CALL26		4
+#define R_NIOS2_IMM5		5
+#define R_NIOS2_CACHE_OPX	6
+#define R_NIOS2_IMM6		7
+#define R_NIOS2_IMM8		8
+#define R_NIOS2_HI16		9
+#define R_NIOS2_LO16		10
+#define R_NIOS2_HIADJ16		11
+#define R_NIOS2_BFD_RELOC_32	12
+#define R_NIOS2_BFD_RELOC_16	13
+#define R_NIOS2_BFD_RELOC_8	14
+#define R_NIOS2_GPREL		15
+#define R_NIOS2_GNU_VTINHERIT	16
+#define R_NIOS2_GNU_VTENTRY	17
+#define R_NIOS2_UJMP		18
+#define R_NIOS2_CJMP		19
+#define R_NIOS2_CALLR		20
+#define R_NIOS2_ALIGN		21
+#define R_NIOS2_GOT16		22
+#define R_NIOS2_CALL16		23
+#define R_NIOS2_GOTOFF_LO	24
+#define R_NIOS2_GOTOFF_HA	25
+#define R_NIOS2_PCREL_LO	26
+#define R_NIOS2_PCREL_HA	27
+#define R_NIOS2_TLS_GD16	28
+#define R_NIOS2_TLS_LDM16	29
+#define R_NIOS2_TLS_LDO16	30
+#define R_NIOS2_TLS_IE16	31
+#define R_NIOS2_TLS_LE16	32
+#define R_NIOS2_TLS_DTPMOD	33
+#define R_NIOS2_TLS_DTPREL	34
+#define R_NIOS2_TLS_TPREL	35
+#define R_NIOS2_COPY		36
+#define R_NIOS2_GLOB_DAT	37
+#define R_NIOS2_JUMP_SLOT	38
+#define R_NIOS2_RELATIVE	39
+#define R_NIOS2_GOTOFF		40
+#define R_NIOS2_CALL26_NOAT	41
+#define R_NIOS2_GOT_LO		42
+#define R_NIOS2_GOT_HA		43
+#define R_NIOS2_CALL_LO		44
+#define R_NIOS2_CALL_HA		45
+
+#define R_OR1K_NONE		0
+#define R_OR1K_32		1
+#define R_OR1K_16		2
+#define R_OR1K_8		3
+#define R_OR1K_LO_16_IN_INSN	4
+#define R_OR1K_HI_16_IN_INSN	5
+#define R_OR1K_INSN_REL_26	6
+#define R_OR1K_GNU_VTENTRY	7
+#define R_OR1K_GNU_VTINHERIT	8
+#define R_OR1K_32_PCREL		9
+#define R_OR1K_16_PCREL		10
+#define R_OR1K_8_PCREL		11
+#define R_OR1K_GOTPC_HI16	12
+#define R_OR1K_GOTPC_LO16	13
+#define R_OR1K_GOT16		14
+#define R_OR1K_PLT26		15
+#define R_OR1K_GOTOFF_HI16	16
+#define R_OR1K_GOTOFF_LO16	17
+#define R_OR1K_COPY		18
+#define R_OR1K_GLOB_DAT		19
+#define R_OR1K_JMP_SLOT		20
+#define R_OR1K_RELATIVE		21
+#define R_OR1K_TLS_GD_HI16	22
+#define R_OR1K_TLS_GD_LO16	23
+#define R_OR1K_TLS_LDM_HI16	24
+#define R_OR1K_TLS_LDM_LO16	25
+#define R_OR1K_TLS_LDO_HI16	26
+#define R_OR1K_TLS_LDO_LO16	27
+#define R_OR1K_TLS_IE_HI16	28
+#define R_OR1K_TLS_IE_LO16	29
+#define R_OR1K_TLS_LE_HI16	30
+#define R_OR1K_TLS_LE_LO16	31
+#define R_OR1K_TLS_TPOFF	32
+#define R_OR1K_TLS_DTPOFF	33
+#define R_OR1K_TLS_DTPMOD	34
+
+#define R_BPF_NONE		0
+#define R_BPF_MAP_FD		1
+
+#define R_RISCV_NONE            0
+#define R_RISCV_32              1
+#define R_RISCV_64              2
+#define R_RISCV_RELATIVE        3
+#define R_RISCV_COPY            4
+#define R_RISCV_JUMP_SLOT       5
+#define R_RISCV_TLS_DTPMOD32    6
+#define R_RISCV_TLS_DTPMOD64    7
+#define R_RISCV_TLS_DTPREL32    8
+#define R_RISCV_TLS_DTPREL64    9
+#define R_RISCV_TLS_TPREL32     10
+#define R_RISCV_TLS_TPREL64     11
+#define R_RISCV_TLSDESC         12
+
+#define R_RISCV_BRANCH          16
+#define R_RISCV_JAL             17
+#define R_RISCV_CALL            18
+#define R_RISCV_CALL_PLT        19
+#define R_RISCV_GOT_HI20        20
+#define R_RISCV_TLS_GOT_HI20    21
+#define R_RISCV_TLS_GD_HI20     22
+#define R_RISCV_PCREL_HI20      23
+#define R_RISCV_PCREL_LO12_I    24
+#define R_RISCV_PCREL_LO12_S    25
+#define R_RISCV_HI20            26
+#define R_RISCV_LO12_I          27
+#define R_RISCV_LO12_S          28
+#define R_RISCV_TPREL_HI20      29
+#define R_RISCV_TPREL_LO12_I    30
+#define R_RISCV_TPREL_LO12_S    31
+#define R_RISCV_TPREL_ADD       32
+#define R_RISCV_ADD8            33
+#define R_RISCV_ADD16           34
+#define R_RISCV_ADD32           35
+#define R_RISCV_ADD64           36
+#define R_RISCV_SUB8            37
+#define R_RISCV_SUB16           38
+#define R_RISCV_SUB32           39
+#define R_RISCV_SUB64           40
+#define R_RISCV_GOT32_PCREL     41
+#define R_RISCV_ALIGN           43
+#define R_RISCV_RVC_BRANCH      44
+#define R_RISCV_RVC_JUMP        45
+#define R_RISCV_RVC_LUI         46
+#define R_RISCV_RELAX           51
+#define R_RISCV_SUB6            52
+#define R_RISCV_SET6            53
+#define R_RISCV_SET8            54
+#define R_RISCV_SET16           55
+#define R_RISCV_SET32           56
+#define R_RISCV_32_PCREL        57
+#define R_RISCV_IRELATIVE       58
+#define R_RISCV_PLT32           59
+#define R_RISCV_SET_ULEB128     60
+#define R_RISCV_SUB_ULEB128     61
+#define R_RISCV_TLSDESC_HI20    62
+#define R_RISCV_TLSDESC_LOAD_LO12 63
+#define R_RISCV_TLSDESC_ADD_LO12  64
+#define R_RISCV_TLSDESC_CALL    65
+
+#define EF_LARCH_ABI_MODIFIER_MASK    0x07
+#define EF_LARCH_ABI_SOFT_FLOAT       0x01
+#define EF_LARCH_ABI_SINGLE_FLOAT     0x02
+#define EF_LARCH_ABI_DOUBLE_FLOAT     0x03
+#define EF_LARCH_OBJABI_V1            0x40
+
+#define R_LARCH_NONE                        0
+#define R_LARCH_32                          1
+#define R_LARCH_64                          2
+#define R_LARCH_RELATIVE                    3
+#define R_LARCH_COPY                        4
+#define R_LARCH_JUMP_SLOT                   5
+#define R_LARCH_TLS_DTPMOD32                6
+#define R_LARCH_TLS_DTPMOD64                7
+#define R_LARCH_TLS_DTPREL32                8
+#define R_LARCH_TLS_DTPREL64                9
+#define R_LARCH_TLS_TPREL32                 10
+#define R_LARCH_TLS_TPREL64                 11
+#define R_LARCH_IRELATIVE                   12
+#define R_LARCH_MARK_LA                     20
+#define R_LARCH_MARK_PCREL                  21
+#define R_LARCH_SOP_PUSH_PCREL              22
+#define R_LARCH_SOP_PUSH_ABSOLUTE           23
+#define R_LARCH_SOP_PUSH_DUP                24
+#define R_LARCH_SOP_PUSH_GPREL              25
+#define R_LARCH_SOP_PUSH_TLS_TPREL          26
+#define R_LARCH_SOP_PUSH_TLS_GOT            27
+#define R_LARCH_SOP_PUSH_TLS_GD             28
+#define R_LARCH_SOP_PUSH_PLT_PCREL          29
+#define R_LARCH_SOP_ASSERT                  30
+#define R_LARCH_SOP_NOT                     31
+#define R_LARCH_SOP_SUB                     32
+#define R_LARCH_SOP_SL                      33
+#define R_LARCH_SOP_SR                      34
+#define R_LARCH_SOP_ADD                     35
+#define R_LARCH_SOP_AND                     36
+#define R_LARCH_SOP_IF_ELSE                 37
+#define R_LARCH_SOP_POP_32_S_10_5           38
+#define R_LARCH_SOP_POP_32_U_10_12          39
+#define R_LARCH_SOP_POP_32_S_10_12          40
+#define R_LARCH_SOP_POP_32_S_10_16          41
+#define R_LARCH_SOP_POP_32_S_10_16_S2       42
+#define R_LARCH_SOP_POP_32_S_5_20           43
+#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2   44
+#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2  45
+#define R_LARCH_SOP_POP_32_U                46
+#define R_LARCH_ADD8                        47
+#define R_LARCH_ADD16                       48
+#define R_LARCH_ADD24                       49
+#define R_LARCH_ADD32                       50
+#define R_LARCH_ADD64                       51
+#define R_LARCH_SUB8                        52
+#define R_LARCH_SUB16                       53
+#define R_LARCH_SUB24                       54
+#define R_LARCH_SUB32                       55
+#define R_LARCH_SUB64                       56
+#define R_LARCH_GNU_VTINHERIT               57
+#define R_LARCH_GNU_VTENTRY                 58
+#define R_LARCH_B16                         64
+#define R_LARCH_B21                         65
+#define R_LARCH_B26                         66
+#define R_LARCH_ABS_HI20                    67
+#define R_LARCH_ABS_LO12                    68
+#define R_LARCH_ABS64_LO20                  69
+#define R_LARCH_ABS64_HI12                  70
+#define R_LARCH_PCALA_HI20                  71
+#define R_LARCH_PCALA_LO12                  72
+#define R_LARCH_PCALA64_LO20                73
+#define R_LARCH_PCALA64_HI12                74
+#define R_LARCH_GOT_PC_HI20                 75
+#define R_LARCH_GOT_PC_LO12                 76
+#define R_LARCH_GOT64_PC_LO20               77
+#define R_LARCH_GOT64_PC_HI12               78
+#define R_LARCH_GOT_HI20                    79
+#define R_LARCH_GOT_LO12                    80
+#define R_LARCH_GOT64_LO20                  81
+#define R_LARCH_GOT64_HI12                  82
+#define R_LARCH_TLS_LE_HI20                 83
+#define R_LARCH_TLS_LE_LO12                 84
+#define R_LARCH_TLS_LE64_LO20               85
+#define R_LARCH_TLS_LE64_HI12               86
+#define R_LARCH_TLS_IE_PC_HI20              87
+#define R_LARCH_TLS_IE_PC_LO12              88
+#define R_LARCH_TLS_IE64_PC_LO20            89
+#define R_LARCH_TLS_IE64_PC_HI12            90
+#define R_LARCH_TLS_IE_HI20                 91
+#define R_LARCH_TLS_IE_LO12                 92
+#define R_LARCH_TLS_IE64_LO20               93
+#define R_LARCH_TLS_IE64_HI12               94
+#define R_LARCH_TLS_LD_PC_HI20              95
+#define R_LARCH_TLS_LD_HI20                 96
+#define R_LARCH_TLS_GD_PC_HI20              97
+#define R_LARCH_TLS_GD_HI20                 98
+#define R_LARCH_32_PCREL                    99
+#define R_LARCH_RELAX                       100
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/musl-include/i386/endian.h b/musl-include/i386/endian.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/endian.h
@@ -0,0 +1,80 @@
+#ifndef _ENDIAN_H
+#define _ENDIAN_H
+
+#include <features.h>
+
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#include <bits/alltypes.h>
+
+#define __PDP_ENDIAN 3412
+
+#define BIG_ENDIAN __BIG_ENDIAN
+#define LITTLE_ENDIAN __LITTLE_ENDIAN
+#define PDP_ENDIAN __PDP_ENDIAN
+#define BYTE_ORDER __BYTE_ORDER
+
+static __inline uint16_t __bswap16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap64(uint64_t __x)
+{
+	return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
+}
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define htobe16(x) __bswap16(x)
+#define be16toh(x) __bswap16(x)
+#define htobe32(x) __bswap32(x)
+#define be32toh(x) __bswap32(x)
+#define htobe64(x) __bswap64(x)
+#define be64toh(x) __bswap64(x)
+#define htole16(x) (uint16_t)(x)
+#define le16toh(x) (uint16_t)(x)
+#define htole32(x) (uint32_t)(x)
+#define le32toh(x) (uint32_t)(x)
+#define htole64(x) (uint64_t)(x)
+#define le64toh(x) (uint64_t)(x)
+#else
+#define htobe16(x) (uint16_t)(x)
+#define be16toh(x) (uint16_t)(x)
+#define htobe32(x) (uint32_t)(x)
+#define be32toh(x) (uint32_t)(x)
+#define htobe64(x) (uint64_t)(x)
+#define be64toh(x) (uint64_t)(x)
+#define htole16(x) __bswap16(x)
+#define le16toh(x) __bswap16(x)
+#define htole32(x) __bswap32(x)
+#define le32toh(x) __bswap32(x)
+#define htole64(x) __bswap64(x)
+#define le64toh(x) __bswap64(x)
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define betoh16(x) __bswap16(x)
+#define betoh32(x) __bswap32(x)
+#define betoh64(x) __bswap64(x)
+#define letoh16(x) (uint16_t)(x)
+#define letoh32(x) (uint32_t)(x)
+#define letoh64(x) (uint64_t)(x)
+#else
+#define betoh16(x) (uint16_t)(x)
+#define betoh32(x) (uint32_t)(x)
+#define betoh64(x) (uint64_t)(x)
+#define letoh16(x) __bswap16(x)
+#define letoh32(x) __bswap32(x)
+#define letoh64(x) __bswap64(x)
+#endif
+#endif
+
+#endif
diff --git a/musl-include/i386/err.h b/musl-include/i386/err.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/err.h
@@ -0,0 +1,25 @@
+#ifndef _ERR_H
+#define _ERR_H
+
+#include <features.h>
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void warn(const char *, ...);
+void vwarn(const char *, va_list);
+void warnx(const char *, ...);
+void vwarnx(const char *, va_list);
+
+_Noreturn void err(int, const char *, ...);
+_Noreturn void verr(int, const char *, va_list);
+_Noreturn void errx(int, const char *, ...);
+_Noreturn void verrx(int, const char *, va_list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/errno.h b/musl-include/i386/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/errno.h
@@ -0,0 +1,27 @@
+#ifndef	_ERRNO_H
+#define _ERRNO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/errno.h>
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int *__errno_location(void);
+#define errno (*__errno_location())
+
+#ifdef _GNU_SOURCE
+extern char *program_invocation_short_name, *program_invocation_name;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/i386/fcntl.h b/musl-include/i386/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/fcntl.h
@@ -0,0 +1,218 @@
+#ifndef	_FCNTL_H
+#define	_FCNTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_mode_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_struct_iovec
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/fcntl.h>
+
+struct flock {
+	short l_type;
+	short l_whence;
+	off_t l_start;
+	off_t l_len;
+	pid_t l_pid;
+};
+
+int creat(const char *, mode_t);
+int fcntl(int, int, ...);
+int open(const char *, int, ...);
+int openat(int, const char *, int, ...);
+int posix_fadvise(int, off_t, off_t, int);
+int posix_fallocate(int, off_t, off_t);
+
+#define O_SEARCH   O_PATH
+#define O_EXEC     O_PATH
+#define O_TTY_INIT 0
+
+#define O_ACCMODE (03|O_SEARCH)
+#define O_RDONLY  00
+#define O_WRONLY  01
+#define O_RDWR    02
+
+#define F_OFD_GETLK 36
+#define F_OFD_SETLK 37
+#define F_OFD_SETLKW 38
+
+#define F_DUPFD_CLOEXEC 1030
+
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+#define FD_CLOEXEC 1
+
+#define AT_FDCWD (-100)
+#define AT_SYMLINK_NOFOLLOW 0x100
+#define AT_REMOVEDIR 0x200
+#define AT_SYMLINK_FOLLOW 0x400
+#define AT_EACCESS 0x200
+
+#define POSIX_FADV_NORMAL     0
+#define POSIX_FADV_RANDOM     1
+#define POSIX_FADV_SEQUENTIAL 2
+#define POSIX_FADV_WILLNEED   3
+#ifndef POSIX_FADV_DONTNEED
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
+#endif
+
+#undef SEEK_SET
+#undef SEEK_CUR
+#undef SEEK_END
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#ifndef S_IRUSR
+#define S_ISUID 04000
+#define S_ISGID 02000
+#define S_ISVTX 01000
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXU 0700
+#define S_IRGRP 0040
+#define S_IWGRP 0020
+#define S_IXGRP 0010
+#define S_IRWXG 0070
+#define S_IROTH 0004
+#define S_IWOTH 0002
+#define S_IXOTH 0001
+#define S_IRWXO 0007
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define AT_NO_AUTOMOUNT 0x800
+#define AT_EMPTY_PATH 0x1000
+#define AT_STATX_SYNC_TYPE 0x6000
+#define AT_STATX_SYNC_AS_STAT 0x0000
+#define AT_STATX_FORCE_SYNC 0x2000
+#define AT_STATX_DONT_SYNC 0x4000
+#define AT_RECURSIVE 0x8000
+
+#define FAPPEND O_APPEND
+#define FFSYNC O_SYNC
+#define FASYNC O_ASYNC
+#define FNONBLOCK O_NONBLOCK
+#define FNDELAY O_NDELAY
+
+#define F_OK 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#define F_ULOCK 0
+#define F_LOCK  1
+#define F_TLOCK 2
+#define F_TEST  3
+
+#define F_SETLEASE	1024
+#define F_GETLEASE	1025
+#define F_NOTIFY	1026
+#define F_CANCELLK	1029
+#define F_SETPIPE_SZ	1031
+#define F_GETPIPE_SZ	1032
+#define F_ADD_SEALS	1033
+#define F_GET_SEALS	1034
+
+#define F_SEAL_SEAL	0x0001
+#define F_SEAL_SHRINK	0x0002
+#define F_SEAL_GROW	0x0004
+#define F_SEAL_WRITE	0x0008
+#define F_SEAL_FUTURE_WRITE	0x0010
+
+#define F_GET_RW_HINT		1035
+#define F_SET_RW_HINT		1036
+#define F_GET_FILE_RW_HINT	1037
+#define F_SET_FILE_RW_HINT	1038
+
+#define RWF_WRITE_LIFE_NOT_SET	0
+#define RWH_WRITE_LIFE_NONE	1
+#define RWH_WRITE_LIFE_SHORT	2
+#define RWH_WRITE_LIFE_MEDIUM	3
+#define RWH_WRITE_LIFE_LONG	4
+#define RWH_WRITE_LIFE_EXTREME	5
+
+#define DN_ACCESS	0x00000001
+#define DN_MODIFY	0x00000002
+#define DN_CREATE	0x00000004
+#define DN_DELETE	0x00000008
+#define DN_RENAME	0x00000010
+#define DN_ATTRIB	0x00000020
+#define DN_MULTISHOT	0x80000000
+
+int lockf(int, int, off_t);
+#endif
+
+#if defined(_GNU_SOURCE)
+#define F_OWNER_TID 0
+#define F_OWNER_PID 1
+#define F_OWNER_PGRP 2
+#define F_OWNER_GID 2
+struct file_handle {
+	unsigned handle_bytes;
+	int handle_type;
+	unsigned char f_handle[];
+};
+struct f_owner_ex {
+	int type;
+	pid_t pid;
+};
+#define FALLOC_FL_KEEP_SIZE 1
+#define FALLOC_FL_PUNCH_HOLE 2
+#define MAX_HANDLE_SZ 128
+#define SYNC_FILE_RANGE_WAIT_BEFORE 1
+#define SYNC_FILE_RANGE_WRITE 2
+#define SYNC_FILE_RANGE_WAIT_AFTER 4
+#define SPLICE_F_MOVE 1
+#define SPLICE_F_NONBLOCK 2
+#define SPLICE_F_MORE 4
+#define SPLICE_F_GIFT 8
+int fallocate(int, int, off_t, off_t);
+int name_to_handle_at(int, const char *, struct file_handle *, int *, int);
+int open_by_handle_at(int, struct file_handle *, int);
+ssize_t readahead(int, off_t, size_t);
+int sync_file_range(int, off_t, off_t, unsigned);
+ssize_t vmsplice(int, const struct iovec *, size_t, unsigned);
+ssize_t splice(int, off_t *, int, off_t *, size_t, unsigned);
+ssize_t tee(int, int, size_t, unsigned);
+#define loff_t off_t
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define F_GETLK64 F_GETLK
+#define F_SETLK64 F_SETLK
+#define F_SETLKW64 F_SETLKW
+#define flock64 flock
+#define open64 open
+#define openat64 openat
+#define creat64 creat
+#define lockf64 lockf
+#define posix_fadvise64 posix_fadvise
+#define posix_fallocate64 posix_fallocate
+#define off64_t off_t
+#if defined(_GNU_SOURCE)
+#define fallocate64 fallocate
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/features.h b/musl-include/i386/features.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/features.h
@@ -0,0 +1,40 @@
+#ifndef _FEATURES_H
+#define _FEATURES_H
+
+#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE)
+#define _GNU_SOURCE 1
+#endif
+
+#if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE)
+#define _BSD_SOURCE 1
+#endif
+
+#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
+ && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
+ && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)
+#define _BSD_SOURCE 1
+#define _XOPEN_SOURCE 700
+#endif
+
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
+#if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
+#define __inline inline
+#elif !defined(__GNUC__)
+#define __inline
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#elif defined(__GNUC__)
+#define _Noreturn __attribute__((__noreturn__))
+#else
+#define _Noreturn
+#endif
+
+#define __REDIR(x,y) __typeof__(x) x __asm__(#y)
+
+#endif
diff --git a/musl-include/i386/fenv.h b/musl-include/i386/fenv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/fenv.h
@@ -0,0 +1,28 @@
+#ifndef _FENV_H
+#define _FENV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bits/fenv.h>
+
+int feclearexcept(int);
+int fegetexceptflag(fexcept_t *, int);
+int feraiseexcept(int);
+int fesetexceptflag(const fexcept_t *, int);
+int fetestexcept(int);
+
+int fegetround(void);
+int fesetround(int);
+
+int fegetenv(fenv_t *);
+int feholdexcept(fenv_t *);
+int fesetenv(const fenv_t *);
+int feupdateenv(const fenv_t *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/musl-include/i386/float.h b/musl-include/i386/float.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/float.h
@@ -0,0 +1,52 @@
+#ifndef _FLOAT_H
+#define _FLOAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __flt_rounds(void);
+#define FLT_ROUNDS (__flt_rounds())
+
+#define FLT_RADIX 2
+
+#define FLT_TRUE_MIN 1.40129846432481707092e-45F
+#define FLT_MIN 1.17549435082228750797e-38F
+#define FLT_MAX 3.40282346638528859812e+38F
+#define FLT_EPSILON 1.1920928955078125e-07F
+
+#define FLT_MANT_DIG 24
+#define FLT_MIN_EXP (-125)
+#define FLT_MAX_EXP 128
+#define FLT_HAS_SUBNORM 1
+
+#define FLT_DIG 6
+#define FLT_DECIMAL_DIG 9
+#define FLT_MIN_10_EXP (-37)
+#define FLT_MAX_10_EXP 38
+
+#define DBL_TRUE_MIN 4.94065645841246544177e-324
+#define DBL_MIN 2.22507385850720138309e-308
+#define DBL_MAX 1.79769313486231570815e+308
+#define DBL_EPSILON 2.22044604925031308085e-16
+
+#define DBL_MANT_DIG 53
+#define DBL_MIN_EXP (-1021)
+#define DBL_MAX_EXP 1024
+#define DBL_HAS_SUBNORM 1
+
+#define DBL_DIG 15
+#define DBL_DECIMAL_DIG 17
+#define DBL_MIN_10_EXP (-307)
+#define DBL_MAX_10_EXP 308
+
+#define LDBL_HAS_SUBNORM 1
+#define LDBL_DECIMAL_DIG DECIMAL_DIG
+
+#include <bits/float.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/fmtmsg.h b/musl-include/i386/fmtmsg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/fmtmsg.h
@@ -0,0 +1,47 @@
+#ifndef _FMTMSG_H
+#define _FMTMSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MM_HARD		1
+#define MM_SOFT		2
+#define MM_FIRM		4
+
+#define MM_APPL		8
+#define MM_UTIL		16
+#define MM_OPSYS	32
+
+#define MM_RECOVER	64
+#define MM_NRECOV	128
+
+#define MM_PRINT	256
+#define MM_CONSOLE	512
+
+#define MM_NULLMC	0L
+
+#define MM_HALT		1
+#define MM_ERROR	2
+#define MM_WARNING	3
+#define MM_INFO		4
+#define MM_NOSEV	0
+
+#define MM_OK		0
+#define MM_NOTOK	(-1)
+#define MM_NOMSG	1
+#define MM_NOCON	4
+
+#define MM_NULLLBL	((char*)0)
+#define MM_NULLTXT	((char*)0)
+#define MM_NULLACT	((char*)0)
+#define MM_NULLTAG	((char*)0)
+#define MM_NULLSEV	0
+
+int fmtmsg(long, const char *, int, const char *, const char *, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/fnmatch.h b/musl-include/i386/fnmatch.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/fnmatch.h
@@ -0,0 +1,24 @@
+#ifndef	_FNMATCH_H
+#define	_FNMATCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	FNM_PATHNAME 0x1
+#define	FNM_NOESCAPE 0x2
+#define	FNM_PERIOD   0x4
+#define	FNM_LEADING_DIR	0x8           
+#define	FNM_CASEFOLD	0x10
+#define	FNM_FILE_NAME	FNM_PATHNAME
+
+#define	FNM_NOMATCH 1
+#define FNM_NOSYS   (-1)
+
+int fnmatch(const char *, const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/ftw.h b/musl-include/i386/ftw.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/ftw.h
@@ -0,0 +1,41 @@
+#ifndef _FTW_H
+#define	_FTW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/stat.h>
+
+#define FTW_F   1
+#define FTW_D   2
+#define FTW_DNR 3
+#define FTW_NS  4
+#define FTW_SL  5
+#define FTW_DP  6
+#define FTW_SLN 7
+
+#define FTW_PHYS  1
+#define FTW_MOUNT 2
+#define FTW_CHDIR 4
+#define FTW_DEPTH 8
+
+struct FTW {
+	int base;
+	int level;
+};
+
+int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
+int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define ftw64 ftw
+#define nftw64 nftw
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/getopt.h b/musl-include/i386/getopt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/getopt.h
@@ -0,0 +1,30 @@
+#ifndef _GETOPT_H
+#define _GETOPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int getopt(int, char * const [], const char *);
+extern char *optarg;
+extern int optind, opterr, optopt, optreset;
+
+struct option {
+	const char *name;
+	int has_arg;
+	int *flag;
+	int val;
+};
+
+int getopt_long(int, char *const *, const char *, const struct option *, int *);
+int getopt_long_only(int, char *const *, const char *, const struct option *, int *);
+
+#define no_argument        0
+#define required_argument  1
+#define optional_argument  2
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/glob.h b/musl-include/i386/glob.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/glob.h
@@ -0,0 +1,52 @@
+#ifndef	_GLOB_H
+#define	_GLOB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef struct {
+	size_t gl_pathc;
+	char **gl_pathv;
+	size_t gl_offs;
+	int __dummy1;
+	void *__dummy2[5];
+} glob_t;
+
+int  glob(const char *__restrict, int, int (*)(const char *, int), glob_t *__restrict);
+void globfree(glob_t *);
+
+#define GLOB_ERR      0x01
+#define GLOB_MARK     0x02
+#define GLOB_NOSORT   0x04
+#define GLOB_DOOFFS   0x08
+#define GLOB_NOCHECK  0x10
+#define GLOB_APPEND   0x20
+#define GLOB_NOESCAPE 0x40
+#define	GLOB_PERIOD   0x80
+
+#define GLOB_TILDE       0x1000
+#define GLOB_TILDE_CHECK 0x4000
+
+#define GLOB_NOSPACE 1
+#define GLOB_ABORTED 2
+#define GLOB_NOMATCH 3
+#define GLOB_NOSYS   4
+
+#if defined(_LARGEFILE64_SOURCE)
+#define glob64 glob
+#define globfree64 globfree
+#define glob64_t glob_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/grp.h b/musl-include/i386/grp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/grp.h
@@ -0,0 +1,53 @@
+#ifndef	_GRP_H
+#define	_GRP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_gid_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_FILE
+#endif
+
+#include <bits/alltypes.h>
+
+struct group {
+	char *gr_name;
+	char *gr_passwd;
+	gid_t gr_gid;
+	char **gr_mem;
+};
+
+struct group  *getgrgid(gid_t);
+struct group  *getgrnam(const char *);
+
+int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
+int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct group  *getgrent(void);
+void           endgrent(void);
+void           setgrent(void);
+#endif
+
+#ifdef _GNU_SOURCE
+struct group  *fgetgrent(FILE *);
+int putgrent(const struct group *, FILE *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int getgrouplist(const char *, gid_t, gid_t *, int *);
+int setgroups(size_t, const gid_t *);
+int initgroups(const char *, gid_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/iconv.h b/musl-include/i386/iconv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/iconv.h
@@ -0,0 +1,24 @@
+#ifndef _ICONV_H
+#define _ICONV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef void *iconv_t;
+
+iconv_t iconv_open(const char *, const char *);
+size_t iconv(iconv_t, char **__restrict, size_t *__restrict, char **__restrict, size_t *__restrict);
+int iconv_close(iconv_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/ifaddrs.h b/musl-include/i386/ifaddrs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/ifaddrs.h
@@ -0,0 +1,35 @@
+#ifndef _IFADDRS_H
+#define _IFADDRS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+
+struct ifaddrs {
+	struct ifaddrs *ifa_next;
+	char *ifa_name;
+	unsigned ifa_flags;
+	struct sockaddr *ifa_addr;
+	struct sockaddr *ifa_netmask;
+	union {
+		struct sockaddr *ifu_broadaddr;
+		struct sockaddr *ifu_dstaddr;
+	} ifa_ifu;
+	void *ifa_data;
+};
+#define ifa_broadaddr ifa_ifu.ifu_broadaddr
+#define ifa_dstaddr ifa_ifu.ifu_dstaddr
+
+void freeifaddrs(struct ifaddrs *);
+int getifaddrs(struct ifaddrs **);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/i386/inttypes.h b/musl-include/i386/inttypes.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/inttypes.h
@@ -0,0 +1,229 @@
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <stdint.h>
+
+#define __NEED_wchar_t
+#include <bits/alltypes.h>
+
+typedef struct { intmax_t quot, rem; } imaxdiv_t;
+
+intmax_t imaxabs(intmax_t);
+imaxdiv_t imaxdiv(intmax_t, intmax_t);
+
+intmax_t strtoimax(const char *__restrict, char **__restrict, int);
+uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
+
+intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
+uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
+
+#if UINTPTR_MAX == UINT64_MAX
+#define __PRI64  "l"
+#define __PRIPTR "l"
+#else
+#define __PRI64  "ll"
+#define __PRIPTR ""
+#endif
+
+#define PRId8  "d"
+#define PRId16 "d"
+#define PRId32 "d"
+#define PRId64 __PRI64 "d"
+
+#define PRIdLEAST8  "d"
+#define PRIdLEAST16 "d"
+#define PRIdLEAST32 "d"
+#define PRIdLEAST64 __PRI64 "d"
+
+#define PRIdFAST8  "d"
+#define PRIdFAST16 "d"
+#define PRIdFAST32 "d"
+#define PRIdFAST64 __PRI64 "d"
+
+#define PRIi8  "i"
+#define PRIi16 "i"
+#define PRIi32 "i"
+#define PRIi64 __PRI64 "i"
+
+#define PRIiLEAST8  "i"
+#define PRIiLEAST16 "i"
+#define PRIiLEAST32 "i"
+#define PRIiLEAST64 __PRI64 "i"
+
+#define PRIiFAST8  "i"
+#define PRIiFAST16 "i"
+#define PRIiFAST32 "i"
+#define PRIiFAST64 __PRI64 "i"
+
+#define PRIo8  "o"
+#define PRIo16 "o"
+#define PRIo32 "o"
+#define PRIo64 __PRI64 "o"
+
+#define PRIoLEAST8  "o"
+#define PRIoLEAST16 "o"
+#define PRIoLEAST32 "o"
+#define PRIoLEAST64 __PRI64 "o"
+
+#define PRIoFAST8  "o"
+#define PRIoFAST16 "o"
+#define PRIoFAST32 "o"
+#define PRIoFAST64 __PRI64 "o"
+
+#define PRIu8  "u"
+#define PRIu16 "u"
+#define PRIu32 "u"
+#define PRIu64 __PRI64 "u"
+
+#define PRIuLEAST8  "u"
+#define PRIuLEAST16 "u"
+#define PRIuLEAST32 "u"
+#define PRIuLEAST64 __PRI64 "u"
+
+#define PRIuFAST8  "u"
+#define PRIuFAST16 "u"
+#define PRIuFAST32 "u"
+#define PRIuFAST64 __PRI64 "u"
+
+#define PRIx8  "x"
+#define PRIx16 "x"
+#define PRIx32 "x"
+#define PRIx64 __PRI64 "x"
+
+#define PRIxLEAST8  "x"
+#define PRIxLEAST16 "x"
+#define PRIxLEAST32 "x"
+#define PRIxLEAST64 __PRI64 "x"
+
+#define PRIxFAST8  "x"
+#define PRIxFAST16 "x"
+#define PRIxFAST32 "x"
+#define PRIxFAST64 __PRI64 "x"
+
+#define PRIX8  "X"
+#define PRIX16 "X"
+#define PRIX32 "X"
+#define PRIX64 __PRI64 "X"
+
+#define PRIXLEAST8  "X"
+#define PRIXLEAST16 "X"
+#define PRIXLEAST32 "X"
+#define PRIXLEAST64 __PRI64 "X"
+
+#define PRIXFAST8  "X"
+#define PRIXFAST16 "X"
+#define PRIXFAST32 "X"
+#define PRIXFAST64 __PRI64 "X"
+
+#define PRIdMAX __PRI64 "d"
+#define PRIiMAX __PRI64 "i"
+#define PRIoMAX __PRI64 "o"
+#define PRIuMAX __PRI64 "u"
+#define PRIxMAX __PRI64 "x"
+#define PRIXMAX __PRI64 "X"
+
+#define PRIdPTR __PRIPTR "d"
+#define PRIiPTR __PRIPTR "i"
+#define PRIoPTR __PRIPTR "o"
+#define PRIuPTR __PRIPTR "u"
+#define PRIxPTR __PRIPTR "x"
+#define PRIXPTR __PRIPTR "X"
+
+#define SCNd8   "hhd"
+#define SCNd16  "hd"
+#define SCNd32  "d"
+#define SCNd64  __PRI64 "d"
+
+#define SCNdLEAST8  "hhd"
+#define SCNdLEAST16 "hd"
+#define SCNdLEAST32 "d"
+#define SCNdLEAST64 __PRI64 "d"
+
+#define SCNdFAST8  "hhd"
+#define SCNdFAST16 "d"
+#define SCNdFAST32 "d"
+#define SCNdFAST64 __PRI64 "d"
+
+#define SCNi8   "hhi"
+#define SCNi16  "hi"
+#define SCNi32  "i"
+#define SCNi64  __PRI64 "i"
+
+#define SCNiLEAST8  "hhi"
+#define SCNiLEAST16 "hi"
+#define SCNiLEAST32 "i"
+#define SCNiLEAST64 __PRI64 "i"
+
+#define SCNiFAST8  "hhi"
+#define SCNiFAST16 "i"
+#define SCNiFAST32 "i"
+#define SCNiFAST64 __PRI64 "i"
+
+#define SCNu8   "hhu"
+#define SCNu16  "hu"
+#define SCNu32  "u"
+#define SCNu64  __PRI64 "u"
+
+#define SCNuLEAST8  "hhu"
+#define SCNuLEAST16 "hu"
+#define SCNuLEAST32 "u"
+#define SCNuLEAST64 __PRI64 "u"
+
+#define SCNuFAST8 "hhu"
+#define SCNuFAST16 "u"
+#define SCNuFAST32 "u"
+#define SCNuFAST64 __PRI64 "u"
+
+#define SCNo8   "hho"
+#define SCNo16  "ho"
+#define SCNo32  "o"
+#define SCNo64  __PRI64 "o"
+
+#define SCNoLEAST8  "hho"
+#define SCNoLEAST16 "ho"
+#define SCNoLEAST32 "o"
+#define SCNoLEAST64 __PRI64 "o"
+
+#define SCNoFAST8  "hho"
+#define SCNoFAST16 "o"
+#define SCNoFAST32 "o"
+#define SCNoFAST64 __PRI64 "o"
+
+#define SCNx8   "hhx"
+#define SCNx16  "hx"
+#define SCNx32  "x"
+#define SCNx64  __PRI64 "x"
+
+#define SCNxLEAST8  "hhx"
+#define SCNxLEAST16 "hx"
+#define SCNxLEAST32 "x"
+#define SCNxLEAST64 __PRI64 "x"
+
+#define SCNxFAST8  "hhx"
+#define SCNxFAST16 "x"
+#define SCNxFAST32 "x"
+#define SCNxFAST64 __PRI64 "x"
+
+#define SCNdMAX __PRI64 "d"
+#define SCNiMAX __PRI64 "i"
+#define SCNoMAX __PRI64 "o"
+#define SCNuMAX __PRI64 "u"
+#define SCNxMAX __PRI64 "x"
+
+#define SCNdPTR __PRIPTR "d"
+#define SCNiPTR __PRIPTR "i"
+#define SCNoPTR __PRIPTR "o"
+#define SCNuPTR __PRIPTR "u"
+#define SCNxPTR __PRIPTR "x"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/i386/iso646.h b/musl-include/i386/iso646.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/iso646.h
@@ -0,0 +1,20 @@
+#ifndef _ISO646_H
+#define _ISO646_H
+
+#ifndef __cplusplus
+
+#define and    &&
+#define and_eq &=
+#define bitand &
+#define bitor  |
+#define compl  ~
+#define not    !
+#define not_eq !=
+#define or     ||
+#define or_eq  |=
+#define xor    ^
+#define xor_eq ^=
+
+#endif
+
+#endif
diff --git a/musl-include/i386/langinfo.h b/musl-include/i386/langinfo.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/langinfo.h
@@ -0,0 +1,98 @@
+#ifndef _LANGINFO_H
+#define _LANGINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <nl_types.h>
+
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+#define ABDAY_1 0x20000
+#define ABDAY_2 0x20001
+#define ABDAY_3 0x20002
+#define ABDAY_4 0x20003
+#define ABDAY_5 0x20004
+#define ABDAY_6 0x20005
+#define ABDAY_7 0x20006
+
+#define DAY_1 0x20007
+#define DAY_2 0x20008
+#define DAY_3 0x20009
+#define DAY_4 0x2000A
+#define DAY_5 0x2000B
+#define DAY_6 0x2000C
+#define DAY_7 0x2000D
+
+#define ABMON_1 0x2000E
+#define ABMON_2 0x2000F
+#define ABMON_3 0x20010
+#define ABMON_4 0x20011
+#define ABMON_5 0x20012
+#define ABMON_6 0x20013
+#define ABMON_7 0x20014
+#define ABMON_8 0x20015
+#define ABMON_9 0x20016
+#define ABMON_10 0x20017
+#define ABMON_11 0x20018
+#define ABMON_12 0x20019
+
+#define MON_1 0x2001A
+#define MON_2 0x2001B
+#define MON_3 0x2001C
+#define MON_4 0x2001D
+#define MON_5 0x2001E
+#define MON_6 0x2001F
+#define MON_7 0x20020
+#define MON_8 0x20021
+#define MON_9 0x20022
+#define MON_10 0x20023
+#define MON_11 0x20024
+#define MON_12 0x20025
+
+#define AM_STR 0x20026
+#define PM_STR 0x20027
+
+#define D_T_FMT 0x20028
+#define D_FMT 0x20029
+#define T_FMT 0x2002A
+#define T_FMT_AMPM 0x2002B
+
+#define ERA 0x2002C
+#define ERA_D_FMT 0x2002E
+#define ALT_DIGITS 0x2002F
+#define ERA_D_T_FMT 0x20030
+#define ERA_T_FMT 0x20031
+
+#define CODESET 14
+
+#define CRNCYSTR 0x4000F
+
+#define RADIXCHAR 0x10000
+#define THOUSEP 0x10001
+#define YESEXPR 0x50000
+#define NOEXPR 0x50001
+
+#define _NL_LOCALE_NAME(cat) (((cat)<<16) | 0xffff)
+
+#if defined(_GNU_SOURCE)
+#define NL_LOCALE_NAME(cat) _NL_LOCALE_NAME(cat)
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define YESSTR 0x50002
+#define NOSTR 0x50003
+#endif
+
+char *nl_langinfo(nl_item);
+char *nl_langinfo_l(nl_item, locale_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/lastlog.h b/musl-include/i386/lastlog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/lastlog.h
@@ -0,0 +1,1 @@
+#include <utmp.h>
diff --git a/musl-include/i386/libgen.h b/musl-include/i386/libgen.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/libgen.h
@@ -0,0 +1,15 @@
+#ifndef _LIBGEN_H
+#define _LIBGEN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *dirname(char *);
+char *basename(char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/libintl.h b/musl-include/i386/libintl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/libintl.h
@@ -0,0 +1,33 @@
+#ifndef _LIBINTL_H
+#define _LIBINTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __USE_GNU_GETTEXT 1
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 1 : -1)
+
+#if __GNUC__ >= 3
+#define __fa(n) __attribute__ ((__format_arg__ (n)))
+#else
+#define __fa(n)
+#endif
+
+char *gettext(const char *) __fa(1);
+char *dgettext(const char *, const char *) __fa(2);
+char *dcgettext(const char *, const char *, int) __fa(2);
+char *ngettext(const char *, const char *, unsigned long) __fa(1) __fa(2);
+char *dngettext(const char *, const char *, const char *, unsigned long) __fa(2) __fa(3);
+char *dcngettext(const char *, const char *, const char *, unsigned long, int) __fa(2) __fa(3);
+char *textdomain(const char *);
+char *bindtextdomain (const char *, const char *);
+char *bind_textdomain_codeset(const char *, const char *);
+
+#undef __fa
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/limits.h b/musl-include/i386/limits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/limits.h
@@ -0,0 +1,166 @@
+#ifndef _LIMITS_H
+#define _LIMITS_H
+
+#include <features.h>
+
+#include <bits/alltypes.h> /* __LONG_MAX */
+
+/* Support signed or unsigned plain-char */
+
+#if '\xff' > 0
+#define CHAR_MIN 0
+#define CHAR_MAX 255
+#else
+#define CHAR_MIN (-128)
+#define CHAR_MAX 127
+#endif
+
+#define CHAR_BIT 8
+#define SCHAR_MIN (-128)
+#define SCHAR_MAX 127
+#define UCHAR_MAX 255
+#define SHRT_MIN  (-1-0x7fff)
+#define SHRT_MAX  0x7fff
+#define USHRT_MAX 0xffff
+#define INT_MIN  (-1-0x7fffffff)
+#define INT_MAX  0x7fffffff
+#define UINT_MAX 0xffffffffU
+#define LONG_MIN (-LONG_MAX-1)
+#define LONG_MAX __LONG_MAX
+#define ULONG_MAX (2UL*LONG_MAX+1)
+#define LLONG_MIN (-LLONG_MAX-1)
+#define LLONG_MAX  0x7fffffffffffffffLL
+#define ULLONG_MAX (2ULL*LLONG_MAX+1)
+
+#define MB_LEN_MAX 4
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#include <bits/limits.h>
+
+#define PIPE_BUF 4096
+#define FILESIZEBITS 64
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+#define PATH_MAX 4096
+#define NGROUPS_MAX 32
+#define ARG_MAX 131072
+#define IOV_MAX 1024
+#define SYMLOOP_MAX 40
+#define WORD_BIT 32
+#define SSIZE_MAX LONG_MAX
+#define TZNAME_MAX 6
+#define TTY_NAME_MAX 32
+#define HOST_NAME_MAX 255
+
+#if LONG_MAX == 0x7fffffffL
+#define LONG_BIT 32
+#else
+#define LONG_BIT 64
+#endif
+
+/* Implementation choices... */
+
+#define PTHREAD_KEYS_MAX 128
+#define PTHREAD_STACK_MIN 2048
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+#define SEM_VALUE_MAX 0x7fffffff
+#define SEM_NSEMS_MAX 256
+#define DELAYTIMER_MAX 0x7fffffff
+#define MQ_PRIO_MAX 32768
+#define LOGIN_NAME_MAX 256
+
+/* Arbitrary numbers... */
+
+#define BC_BASE_MAX 99
+#define BC_DIM_MAX 2048
+#define BC_SCALE_MAX 99
+#define BC_STRING_MAX 1000
+#define CHARCLASS_NAME_MAX 14
+#define COLL_WEIGHTS_MAX 2
+#define EXPR_NEST_MAX 32
+#define LINE_MAX 4096
+#define RE_DUP_MAX 255
+
+#define NL_ARGMAX 9
+#define NL_MSGMAX 32767
+#define NL_SETMAX 255
+#define NL_TEXTMAX 2048
+
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+
+#ifdef PAGESIZE
+#define PAGE_SIZE PAGESIZE
+#endif
+#define NZERO 20
+#define NL_LANGMAX 32
+
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+
+#define NL_NMAX 16
+
+#endif
+
+/* POSIX/SUS requirements follow. These numbers come directly
+ * from SUS and have nothing to do with the host system. */
+
+#define _POSIX_AIO_LISTIO_MAX   2
+#define _POSIX_AIO_MAX          1
+#define _POSIX_ARG_MAX          4096
+#define _POSIX_CHILD_MAX        25
+#define _POSIX_CLOCKRES_MIN     20000000
+#define _POSIX_DELAYTIMER_MAX   32
+#define _POSIX_HOST_NAME_MAX    255
+#define _POSIX_LINK_MAX         8
+#define _POSIX_LOGIN_NAME_MAX   9
+#define _POSIX_MAX_CANON        255
+#define _POSIX_MAX_INPUT        255
+#define _POSIX_MQ_OPEN_MAX      8
+#define _POSIX_MQ_PRIO_MAX      32
+#define _POSIX_NAME_MAX         14
+#define _POSIX_NGROUPS_MAX      8
+#define _POSIX_OPEN_MAX         20
+#define _POSIX_PATH_MAX         256
+#define _POSIX_PIPE_BUF         512
+#define _POSIX_RE_DUP_MAX       255
+#define _POSIX_RTSIG_MAX        8
+#define _POSIX_SEM_NSEMS_MAX    256
+#define _POSIX_SEM_VALUE_MAX    32767
+#define _POSIX_SIGQUEUE_MAX     32
+#define _POSIX_SSIZE_MAX        32767
+#define _POSIX_STREAM_MAX       8
+#define _POSIX_SS_REPL_MAX      4
+#define _POSIX_SYMLINK_MAX      255
+#define _POSIX_SYMLOOP_MAX      8
+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
+#define _POSIX_THREAD_KEYS_MAX  128
+#define _POSIX_THREAD_THREADS_MAX 64
+#define _POSIX_TIMER_MAX        32
+#define _POSIX_TRACE_EVENT_NAME_MAX 30
+#define _POSIX_TRACE_NAME_MAX   8
+#define _POSIX_TRACE_SYS_MAX    8
+#define _POSIX_TRACE_USER_EVENT_MAX 32
+#define _POSIX_TTY_NAME_MAX     9
+#define _POSIX_TZNAME_MAX       6
+#define _POSIX2_BC_BASE_MAX     99
+#define _POSIX2_BC_DIM_MAX      2048
+#define _POSIX2_BC_SCALE_MAX    99
+#define _POSIX2_BC_STRING_MAX   1000
+#define _POSIX2_CHARCLASS_NAME_MAX 14
+#define _POSIX2_COLL_WEIGHTS_MAX 2
+#define _POSIX2_EXPR_NEST_MAX   32
+#define _POSIX2_LINE_MAX        2048
+#define _POSIX2_RE_DUP_MAX      255
+
+#define _XOPEN_IOV_MAX          16
+#define _XOPEN_NAME_MAX         255
+#define _XOPEN_PATH_MAX         1024
+
+#endif
diff --git a/musl-include/i386/link.h b/musl-include/i386/link.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/link.h
@@ -0,0 +1,53 @@
+#ifndef _LINK_H
+#define _LINK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+#define __NEED_size_t
+#define __NEED_uint32_t
+#include <bits/alltypes.h>
+
+#if UINTPTR_MAX > 0xffffffff
+#define ElfW(type) Elf64_ ## type
+#else
+#define ElfW(type) Elf32_ ## type
+#endif
+
+#include <bits/link.h>
+
+struct dl_phdr_info {
+	ElfW(Addr) dlpi_addr;
+	const char *dlpi_name;
+	const ElfW(Phdr) *dlpi_phdr;
+	ElfW(Half) dlpi_phnum;
+	unsigned long long int dlpi_adds;
+	unsigned long long int dlpi_subs;
+	size_t dlpi_tls_modid;
+	void *dlpi_tls_data;
+};
+
+struct link_map {
+	ElfW(Addr) l_addr;
+	char *l_name;
+	ElfW(Dyn) *l_ld;
+	struct link_map *l_next, *l_prev;
+};
+
+struct r_debug {
+	int r_version;
+	struct link_map *r_map;
+	ElfW(Addr) r_brk;
+	enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state;
+	ElfW(Addr) r_ldbase;
+};
+
+int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/locale.h b/musl-include/i386/locale.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/locale.h
@@ -0,0 +1,88 @@
+#ifndef	_LOCALE_H
+#define	_LOCALE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define LC_CTYPE    0
+#define LC_NUMERIC  1
+#define LC_TIME     2
+#define LC_COLLATE  3
+#define LC_MONETARY 4
+#define LC_MESSAGES 5
+#define LC_ALL      6
+
+struct lconv {
+	char *decimal_point;
+	char *thousands_sep;
+	char *grouping;
+
+	char *int_curr_symbol;
+	char *currency_symbol;
+	char *mon_decimal_point;
+	char *mon_thousands_sep;
+	char *mon_grouping;
+	char *positive_sign;
+	char *negative_sign;
+	char int_frac_digits;
+	char frac_digits;
+	char p_cs_precedes;
+	char p_sep_by_space;
+	char n_cs_precedes;
+	char n_sep_by_space;
+	char p_sign_posn;
+	char n_sign_posn;
+	char int_p_cs_precedes;
+	char int_p_sep_by_space;
+	char int_n_cs_precedes;
+	char int_n_sep_by_space;
+	char int_p_sign_posn;
+	char int_n_sign_posn;
+};
+
+
+char *setlocale (int, const char *);
+struct lconv *localeconv(void);
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+#define LC_GLOBAL_LOCALE ((locale_t)-1)
+
+#define LC_CTYPE_MASK    (1<<LC_CTYPE)
+#define LC_NUMERIC_MASK  (1<<LC_NUMERIC)
+#define LC_TIME_MASK     (1<<LC_TIME)
+#define LC_COLLATE_MASK  (1<<LC_COLLATE)
+#define LC_MONETARY_MASK (1<<LC_MONETARY)
+#define LC_MESSAGES_MASK (1<<LC_MESSAGES)
+#define LC_ALL_MASK      0x7fffffff
+
+locale_t duplocale(locale_t);
+void freelocale(locale_t);
+locale_t newlocale(int, const char *, locale_t);
+locale_t uselocale(locale_t);
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/malloc.h b/musl-include/i386/malloc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/malloc.h
@@ -0,0 +1,25 @@
+#ifndef _MALLOC_H
+#define _MALLOC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+void *malloc (size_t);
+void *calloc (size_t, size_t);
+void *realloc (void *, size_t);
+void free (void *);
+void *valloc (size_t);
+void *memalign(size_t, size_t);
+
+size_t malloc_usable_size(void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/math.h b/musl-include/i386/math.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/math.h
@@ -0,0 +1,442 @@
+#ifndef _MATH_H
+#define _MATH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_float_t
+#define __NEED_double_t
+#include <bits/alltypes.h>
+
+#if 100*__GNUC__+__GNUC_MINOR__ >= 303
+#define NAN       __builtin_nanf("")
+#define INFINITY  __builtin_inff()
+#else
+#define NAN       (0.0f/0.0f)
+#define INFINITY  1e5000f
+#endif
+
+#define HUGE_VALF INFINITY
+#define HUGE_VAL  ((double)INFINITY)
+#define HUGE_VALL ((long double)INFINITY)
+
+#define MATH_ERRNO  1
+#define MATH_ERREXCEPT 2
+#define math_errhandling 2
+
+#define FP_ILOGBNAN (-1-0x7fffffff)
+#define FP_ILOGB0 FP_ILOGBNAN
+
+#define FP_NAN       0
+#define FP_INFINITE  1
+#define FP_ZERO      2
+#define FP_SUBNORMAL 3
+#define FP_NORMAL    4
+
+#ifdef __FP_FAST_FMA
+#define FP_FAST_FMA 1
+#endif
+
+#ifdef __FP_FAST_FMAF
+#define FP_FAST_FMAF 1
+#endif
+
+#ifdef __FP_FAST_FMAL
+#define FP_FAST_FMAL 1
+#endif
+
+int __fpclassify(double);
+int __fpclassifyf(float);
+int __fpclassifyl(long double);
+
+static __inline unsigned __FLOAT_BITS(float __f)
+{
+	union {float __f; unsigned __i;} __u;
+	__u.__f = __f;
+	return __u.__i;
+}
+static __inline unsigned long long __DOUBLE_BITS(double __f)
+{
+	union {double __f; unsigned long long __i;} __u;
+	__u.__f = __f;
+	return __u.__i;
+}
+
+#define fpclassify(x) ( \
+	sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \
+	sizeof(x) == sizeof(double) ? __fpclassify(x) : \
+	__fpclassifyl(x) )
+
+#define isinf(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \
+	__fpclassifyl(x) == FP_INFINITE)
+
+#define isnan(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \
+	__fpclassifyl(x) == FP_NAN)
+
+#define isnormal(x) ( \
+	sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \
+	sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \
+	__fpclassifyl(x) == FP_NORMAL)
+
+#define isfinite(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \
+	__fpclassifyl(x) > FP_INFINITE)
+
+int __signbit(double);
+int __signbitf(float);
+int __signbitl(long double);
+
+#define signbit(x) ( \
+	sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \
+	sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \
+	__signbitl(x) )
+
+#define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y)))
+
+#define __ISREL_DEF(rel, op, type) \
+static __inline int __is##rel(type __x, type __y) \
+{ return !isunordered(__x,__y) && __x op __y; }
+
+__ISREL_DEF(lessf, <, float_t)
+__ISREL_DEF(less, <, double_t)
+__ISREL_DEF(lessl, <, long double)
+__ISREL_DEF(lessequalf, <=, float_t)
+__ISREL_DEF(lessequal, <=, double_t)
+__ISREL_DEF(lessequall, <=, long double)
+__ISREL_DEF(lessgreaterf, !=, float_t)
+__ISREL_DEF(lessgreater, !=, double_t)
+__ISREL_DEF(lessgreaterl, !=, long double)
+__ISREL_DEF(greaterf, >, float_t)
+__ISREL_DEF(greater, >, double_t)
+__ISREL_DEF(greaterl, >, long double)
+__ISREL_DEF(greaterequalf, >=, float_t)
+__ISREL_DEF(greaterequal, >=, double_t)
+__ISREL_DEF(greaterequall, >=, long double)
+
+#define __tg_pred_2(x, y, p) ( \
+	sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \
+	sizeof((x)+(y)) == sizeof(double) ? p(x, y) : \
+	p##l(x, y) )
+
+#define isless(x, y)            __tg_pred_2(x, y, __isless)
+#define islessequal(x, y)       __tg_pred_2(x, y, __islessequal)
+#define islessgreater(x, y)     __tg_pred_2(x, y, __islessgreater)
+#define isgreater(x, y)         __tg_pred_2(x, y, __isgreater)
+#define isgreaterequal(x, y)    __tg_pred_2(x, y, __isgreaterequal)
+
+double      acos(double);
+float       acosf(float);
+long double acosl(long double);
+
+double      acosh(double);
+float       acoshf(float);
+long double acoshl(long double);
+
+double      asin(double);
+float       asinf(float);
+long double asinl(long double);
+
+double      asinh(double);
+float       asinhf(float);
+long double asinhl(long double);
+
+double      atan(double);
+float       atanf(float);
+long double atanl(long double);
+
+double      atan2(double, double);
+float       atan2f(float, float);
+long double atan2l(long double, long double);
+
+double      atanh(double);
+float       atanhf(float);
+long double atanhl(long double);
+
+double      cbrt(double);
+float       cbrtf(float);
+long double cbrtl(long double);
+
+double      ceil(double);
+float       ceilf(float);
+long double ceill(long double);
+
+double      copysign(double, double);
+float       copysignf(float, float);
+long double copysignl(long double, long double);
+
+double      cos(double);
+float       cosf(float);
+long double cosl(long double);
+
+double      cosh(double);
+float       coshf(float);
+long double coshl(long double);
+
+double      erf(double);
+float       erff(float);
+long double erfl(long double);
+
+double      erfc(double);
+float       erfcf(float);
+long double erfcl(long double);
+
+double      exp(double);
+float       expf(float);
+long double expl(long double);
+
+double      exp2(double);
+float       exp2f(float);
+long double exp2l(long double);
+
+double      expm1(double);
+float       expm1f(float);
+long double expm1l(long double);
+
+double      fabs(double);
+float       fabsf(float);
+long double fabsl(long double);
+
+double      fdim(double, double);
+float       fdimf(float, float);
+long double fdiml(long double, long double);
+
+double      floor(double);
+float       floorf(float);
+long double floorl(long double);
+
+double      fma(double, double, double);
+float       fmaf(float, float, float);
+long double fmal(long double, long double, long double);
+
+double      fmax(double, double);
+float       fmaxf(float, float);
+long double fmaxl(long double, long double);
+
+double      fmin(double, double);
+float       fminf(float, float);
+long double fminl(long double, long double);
+
+double      fmod(double, double);
+float       fmodf(float, float);
+long double fmodl(long double, long double);
+
+double      frexp(double, int *);
+float       frexpf(float, int *);
+long double frexpl(long double, int *);
+
+double      hypot(double, double);
+float       hypotf(float, float);
+long double hypotl(long double, long double);
+
+int         ilogb(double);
+int         ilogbf(float);
+int         ilogbl(long double);
+
+double      ldexp(double, int);
+float       ldexpf(float, int);
+long double ldexpl(long double, int);
+
+double      lgamma(double);
+float       lgammaf(float);
+long double lgammal(long double);
+
+long long   llrint(double);
+long long   llrintf(float);
+long long   llrintl(long double);
+
+long long   llround(double);
+long long   llroundf(float);
+long long   llroundl(long double);
+
+double      log(double);
+float       logf(float);
+long double logl(long double);
+
+double      log10(double);
+float       log10f(float);
+long double log10l(long double);
+
+double      log1p(double);
+float       log1pf(float);
+long double log1pl(long double);
+
+double      log2(double);
+float       log2f(float);
+long double log2l(long double);
+
+double      logb(double);
+float       logbf(float);
+long double logbl(long double);
+
+long        lrint(double);
+long        lrintf(float);
+long        lrintl(long double);
+
+long        lround(double);
+long        lroundf(float);
+long        lroundl(long double);
+
+double      modf(double, double *);
+float       modff(float, float *);
+long double modfl(long double, long double *);
+
+double      nan(const char *);
+float       nanf(const char *);
+long double nanl(const char *);
+
+double      nearbyint(double);
+float       nearbyintf(float);
+long double nearbyintl(long double);
+
+double      nextafter(double, double);
+float       nextafterf(float, float);
+long double nextafterl(long double, long double);
+
+double      nexttoward(double, long double);
+float       nexttowardf(float, long double);
+long double nexttowardl(long double, long double);
+
+double      pow(double, double);
+float       powf(float, float);
+long double powl(long double, long double);
+
+double      remainder(double, double);
+float       remainderf(float, float);
+long double remainderl(long double, long double);
+
+double      remquo(double, double, int *);
+float       remquof(float, float, int *);
+long double remquol(long double, long double, int *);
+
+double      rint(double);
+float       rintf(float);
+long double rintl(long double);
+
+double      round(double);
+float       roundf(float);
+long double roundl(long double);
+
+double      scalbln(double, long);
+float       scalblnf(float, long);
+long double scalblnl(long double, long);
+
+double      scalbn(double, int);
+float       scalbnf(float, int);
+long double scalbnl(long double, int);
+
+double      sin(double);
+float       sinf(float);
+long double sinl(long double);
+
+double      sinh(double);
+float       sinhf(float);
+long double sinhl(long double);
+
+double      sqrt(double);
+float       sqrtf(float);
+long double sqrtl(long double);
+
+double      tan(double);
+float       tanf(float);
+long double tanl(long double);
+
+double      tanh(double);
+float       tanhf(float);
+long double tanhl(long double);
+
+double      tgamma(double);
+float       tgammaf(float);
+long double tgammal(long double);
+
+double      trunc(double);
+float       truncf(float);
+long double truncl(long double);
+
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE)
+#undef  MAXFLOAT
+#define MAXFLOAT        3.40282346638528859812e+38F
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define M_E             2.7182818284590452354   /* e */
+#define M_LOG2E         1.4426950408889634074   /* log_2 e */
+#define M_LOG10E        0.43429448190325182765  /* log_10 e */
+#define M_LN2           0.69314718055994530942  /* log_e 2 */
+#define M_LN10          2.30258509299404568402  /* log_e 10 */
+#define M_PI            3.14159265358979323846  /* pi */
+#define M_PI_2          1.57079632679489661923  /* pi/2 */
+#define M_PI_4          0.78539816339744830962  /* pi/4 */
+#define M_1_PI          0.31830988618379067154  /* 1/pi */
+#define M_2_PI          0.63661977236758134308  /* 2/pi */
+#define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
+#define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
+#define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
+
+extern int signgam;
+
+double      j0(double);
+double      j1(double);
+double      jn(int, double);
+
+double      y0(double);
+double      y1(double);
+double      yn(int, double);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define HUGE            3.40282346638528859812e+38F
+
+double      drem(double, double);
+float       dremf(float, float);
+
+int         finite(double);
+int         finitef(float);
+
+double      scalb(double, double);
+float       scalbf(float, float);
+
+double      significand(double);
+float       significandf(float);
+
+double      lgamma_r(double, int*);
+float       lgammaf_r(float, int*);
+
+float       j0f(float);
+float       j1f(float);
+float       jnf(int, float);
+
+float       y0f(float);
+float       y1f(float);
+float       ynf(int, float);
+#endif
+
+#ifdef _GNU_SOURCE
+long double lgammal_r(long double, int*);
+
+void        sincos(double, double*, double*);
+void        sincosf(float, float*, float*);
+void        sincosl(long double, long double*, long double*);
+
+double      exp10(double);
+float       exp10f(float);
+long double exp10l(long double);
+
+double      pow10(double);
+float       pow10f(float);
+long double pow10l(long double);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/memory.h b/musl-include/i386/memory.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/memory.h
@@ -0,0 +1,1 @@
+#include <string.h>
diff --git a/musl-include/i386/mntent.h b/musl-include/i386/mntent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/mntent.h
@@ -0,0 +1,43 @@
+#ifndef _MNTENT_H
+#define _MNTENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_FILE
+#include <bits/alltypes.h>
+
+#define MOUNTED "/etc/mtab"
+
+#define MNTTYPE_IGNORE	"ignore"
+#define MNTTYPE_NFS	"nfs"
+#define MNTTYPE_SWAP	"swap"
+#define MNTOPT_DEFAULTS	"defaults"
+#define MNTOPT_RO	"ro"
+#define MNTOPT_RW	"rw"
+#define MNTOPT_SUID	"suid"
+#define MNTOPT_NOSUID	"nosuid"
+#define MNTOPT_NOAUTO	"noauto"
+
+struct mntent {
+	char *mnt_fsname;
+	char *mnt_dir;
+	char *mnt_type;
+	char *mnt_opts;
+	int mnt_freq;
+	int mnt_passno;
+};
+
+FILE *setmntent(const char *, const char *);
+int endmntent(FILE *);
+struct mntent *getmntent(FILE *);
+struct mntent *getmntent_r(FILE *, struct mntent *, char *, int);
+int addmntent(FILE *, const struct mntent *);
+char *hasmntopt(const struct mntent *, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/monetary.h b/musl-include/i386/monetary.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/monetary.h
@@ -0,0 +1,23 @@
+#ifndef _MONETARY_H
+#define _MONETARY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ssize_t
+#define __NEED_size_t
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...);
+ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/mqueue.h b/musl-include/i386/mqueue.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/mqueue.h
@@ -0,0 +1,41 @@
+#ifndef _MQUEUE_H
+#define _MQUEUE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_pthread_attr_t
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+typedef int mqd_t;
+struct mq_attr {
+	long mq_flags, mq_maxmsg, mq_msgsize, mq_curmsgs, __unused[4];
+};
+struct sigevent;
+
+int mq_close(mqd_t);
+int mq_getattr(mqd_t, struct mq_attr *);
+int mq_notify(mqd_t, const struct sigevent *);
+mqd_t mq_open(const char *, int, ...);
+ssize_t mq_receive(mqd_t, char *, size_t, unsigned *);
+int mq_send(mqd_t, const char *, size_t, unsigned);
+int mq_setattr(mqd_t, const struct mq_attr *__restrict, struct mq_attr *__restrict);
+ssize_t mq_timedreceive(mqd_t, char *__restrict, size_t, unsigned *__restrict, const struct timespec *__restrict);
+int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct timespec *);
+int mq_unlink(const char *);
+
+#if _REDIR_TIME64
+__REDIR(mq_timedreceive, __mq_timedreceive_time64);
+__REDIR(mq_timedsend, __mq_timedsend_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/net/ethernet.h b/musl-include/i386/net/ethernet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/net/ethernet.h
@@ -0,0 +1,55 @@
+#ifndef _NET_ETHERNET_H
+#define _NET_ETHERNET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <netinet/if_ether.h>
+
+struct ether_addr {
+	uint8_t ether_addr_octet[ETH_ALEN];
+};
+
+struct ether_header {
+	uint8_t  ether_dhost[ETH_ALEN];
+	uint8_t  ether_shost[ETH_ALEN];
+	uint16_t ether_type;
+};
+
+#define	ETHERTYPE_PUP		0x0200
+#define ETHERTYPE_SPRITE	0x0500
+#define	ETHERTYPE_IP		0x0800
+#define	ETHERTYPE_ARP		0x0806
+#define	ETHERTYPE_REVARP	0x8035
+#define ETHERTYPE_AT		0x809B
+#define ETHERTYPE_AARP		0x80F3
+#define	ETHERTYPE_VLAN		0x8100
+#define ETHERTYPE_IPX		0x8137
+#define	ETHERTYPE_IPV6		0x86dd
+#define ETHERTYPE_LOOPBACK	0x9000
+
+
+#define	ETHER_ADDR_LEN	ETH_ALEN
+#define	ETHER_TYPE_LEN	2
+#define	ETHER_CRC_LEN	4
+#define	ETHER_HDR_LEN	ETH_HLEN
+#define	ETHER_MIN_LEN	(ETH_ZLEN + ETHER_CRC_LEN)
+#define	ETHER_MAX_LEN	(ETH_FRAME_LEN + ETHER_CRC_LEN)
+
+#define	ETHER_IS_VALID_LEN(foo)	\
+	((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
+
+#define	ETHERTYPE_TRAIL		0x1000
+#define	ETHERTYPE_NTRAILER	16
+
+#define	ETHERMTU	ETH_DATA_LEN
+#define	ETHERMIN	(ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/net/if.h b/musl-include/i386/net/if.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/net/if.h
@@ -0,0 +1,141 @@
+#ifndef _NET_IF_H
+#define _NET_IF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define IF_NAMESIZE 16
+
+struct if_nameindex {
+	unsigned int if_index;
+	char *if_name;
+};
+
+unsigned int if_nametoindex (const char *);
+char *if_indextoname (unsigned int, char *);
+struct if_nameindex *if_nameindex (void);
+void if_freenameindex (struct if_nameindex *);
+
+
+
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#include <sys/socket.h>
+
+#define IFF_UP	0x1
+#define IFF_BROADCAST 0x2
+#define IFF_DEBUG 0x4
+#define IFF_LOOPBACK 0x8
+#define IFF_POINTOPOINT 0x10
+#define IFF_NOTRAILERS 0x20
+#define IFF_RUNNING 0x40
+#define IFF_NOARP 0x80
+#define IFF_PROMISC 0x100
+#define IFF_ALLMULTI 0x200
+#define IFF_MASTER 0x400
+#define IFF_SLAVE 0x800
+#define IFF_MULTICAST 0x1000
+#define IFF_PORTSEL 0x2000
+#define IFF_AUTOMEDIA 0x4000
+#define IFF_DYNAMIC 0x8000
+#define IFF_LOWER_UP 0x10000
+#define IFF_DORMANT 0x20000
+#define IFF_ECHO 0x40000
+#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
+        IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
+
+struct ifaddr {
+	struct sockaddr ifa_addr;
+	union {
+		struct sockaddr	ifu_broadaddr;
+		struct sockaddr	ifu_dstaddr;
+	} ifa_ifu;
+	struct iface *ifa_ifp;
+	struct ifaddr *ifa_next;
+};
+
+#define ifa_broadaddr	ifa_ifu.ifu_broadaddr
+#define ifa_dstaddr	ifa_ifu.ifu_dstaddr
+
+struct ifmap {
+	unsigned long int mem_start;
+	unsigned long int mem_end;
+	unsigned short int base_addr;
+	unsigned char irq;
+	unsigned char dma;
+	unsigned char port;
+};
+
+#define IFHWADDRLEN	6
+#define IFNAMSIZ	IF_NAMESIZE
+
+struct ifreq {
+	union {
+		char ifrn_name[IFNAMSIZ];
+	} ifr_ifrn;
+	union {
+		struct sockaddr ifru_addr;
+		struct sockaddr ifru_dstaddr;
+		struct sockaddr ifru_broadaddr;
+		struct sockaddr ifru_netmask;
+		struct sockaddr ifru_hwaddr;
+		short int ifru_flags;
+		int ifru_ivalue;
+		int ifru_mtu;
+		struct ifmap ifru_map;
+		char ifru_slave[IFNAMSIZ];
+		char ifru_newname[IFNAMSIZ];
+		char *ifru_data;
+	} ifr_ifru;
+};
+
+#define ifr_name	ifr_ifrn.ifrn_name
+#define ifr_hwaddr	ifr_ifru.ifru_hwaddr
+#define ifr_addr	ifr_ifru.ifru_addr
+#define ifr_dstaddr	ifr_ifru.ifru_dstaddr
+#define ifr_broadaddr	ifr_ifru.ifru_broadaddr
+#define ifr_netmask	ifr_ifru.ifru_netmask
+#define ifr_flags	ifr_ifru.ifru_flags
+#define ifr_metric	ifr_ifru.ifru_ivalue
+#define ifr_mtu		ifr_ifru.ifru_mtu
+#define ifr_map		ifr_ifru.ifru_map
+#define ifr_slave	ifr_ifru.ifru_slave
+#define ifr_data	ifr_ifru.ifru_data
+#define ifr_ifindex	ifr_ifru.ifru_ivalue
+#define ifr_bandwidth	ifr_ifru.ifru_ivalue
+#define ifr_qlen	ifr_ifru.ifru_ivalue
+#define ifr_newname	ifr_ifru.ifru_newname
+#define _IOT_ifreq	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0)
+#define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0)
+#define _IOT_ifreq_int	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
+
+struct ifconf {
+	int ifc_len;		
+	union {
+		char *ifcu_buf;
+		struct ifreq *ifcu_req;
+	} ifc_ifcu;
+};
+
+#define ifc_buf		ifc_ifcu.ifcu_buf
+#define ifc_req		ifc_ifcu.ifcu_req
+#define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
+
+#define __UAPI_DEF_IF_IFCONF                                    0
+#define __UAPI_DEF_IF_IFMAP                                     0
+#define __UAPI_DEF_IF_IFNAMSIZ                                  0
+#define __UAPI_DEF_IF_IFREQ                                     0
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS                          0
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO    0
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/net/if_arp.h b/musl-include/i386/net/if_arp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/net/if_arp.h
@@ -0,0 +1,142 @@
+/* Nonstandard header */
+#ifndef _NET_IF_ARP_H
+#define _NET_IF_ARP_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#define MAX_ADDR_LEN	7
+
+#define	ARPOP_REQUEST	1
+#define	ARPOP_REPLY	2
+#define	ARPOP_RREQUEST	3
+#define	ARPOP_RREPLY	4
+#define	ARPOP_InREQUEST	8
+#define	ARPOP_InREPLY	9
+#define	ARPOP_NAK	10
+
+struct arphdr {
+	uint16_t ar_hrd;
+	uint16_t ar_pro;
+	uint8_t ar_hln;
+	uint8_t ar_pln;
+	uint16_t ar_op;
+};
+
+
+#define ARPHRD_NETROM	0
+#define ARPHRD_ETHER 	1
+#define	ARPHRD_EETHER	2
+#define	ARPHRD_AX25	3
+#define	ARPHRD_PRONET	4
+#define	ARPHRD_CHAOS	5
+#define	ARPHRD_IEEE802	6
+#define	ARPHRD_ARCNET	7
+#define	ARPHRD_APPLETLK	8
+#define	ARPHRD_DLCI	15
+#define	ARPHRD_ATM	19
+#define	ARPHRD_METRICOM	23
+#define ARPHRD_IEEE1394	24
+#define ARPHRD_EUI64		27
+#define ARPHRD_INFINIBAND	32
+#define ARPHRD_SLIP	256
+#define ARPHRD_CSLIP	257
+#define ARPHRD_SLIP6	258
+#define ARPHRD_CSLIP6	259
+#define ARPHRD_RSRVD	260
+#define ARPHRD_ADAPT	264
+#define ARPHRD_ROSE	270
+#define ARPHRD_X25	271
+#define ARPHRD_HWX25	272
+#define ARPHRD_CAN	280
+#define ARPHRD_PPP	512
+#define ARPHRD_CISCO	513
+#define ARPHRD_HDLC	ARPHRD_CISCO
+#define ARPHRD_LAPB	516
+#define ARPHRD_DDCMP	517
+#define	ARPHRD_RAWHDLC	518
+#define ARPHRD_RAWIP	519
+
+#define ARPHRD_TUNNEL	768
+#define ARPHRD_TUNNEL6	769
+#define ARPHRD_FRAD	770
+#define ARPHRD_SKIP	771
+#define ARPHRD_LOOPBACK	772
+#define ARPHRD_LOCALTLK 773
+#define ARPHRD_FDDI	774
+#define ARPHRD_BIF	775
+#define ARPHRD_SIT	776
+#define ARPHRD_IPDDP	777
+#define ARPHRD_IPGRE	778
+#define ARPHRD_PIMREG	779
+#define ARPHRD_HIPPI	780
+#define ARPHRD_ASH	781
+#define ARPHRD_ECONET	782
+#define ARPHRD_IRDA	783
+#define ARPHRD_FCPP	784
+#define ARPHRD_FCAL	785
+#define ARPHRD_FCPL	786
+#define ARPHRD_FCFABRIC 787
+#define ARPHRD_IEEE802_TR 800
+#define ARPHRD_IEEE80211 801
+#define ARPHRD_IEEE80211_PRISM 802
+#define ARPHRD_IEEE80211_RADIOTAP 803
+#define ARPHRD_IEEE802154 804
+#define ARPHRD_IEEE802154_MONITOR 805
+#define ARPHRD_PHONET 820
+#define ARPHRD_PHONET_PIPE 821
+#define ARPHRD_CAIF 822
+#define ARPHRD_IP6GRE 823
+#define ARPHRD_NETLINK 824
+#define ARPHRD_6LOWPAN 825
+#define ARPHRD_VSOCKMON 826
+
+#define ARPHRD_VOID	  0xFFFF
+#define ARPHRD_NONE	  0xFFFE
+
+struct arpreq {
+	struct sockaddr arp_pa;
+	struct sockaddr arp_ha;
+	int arp_flags;
+	struct sockaddr arp_netmask;
+	char arp_dev[16];
+};
+
+struct arpreq_old {
+	struct sockaddr arp_pa;
+	struct sockaddr arp_ha;
+	int arp_flags;
+	struct sockaddr arp_netmask;
+};
+
+#define ATF_COM		0x02
+#define	ATF_PERM	0x04
+#define	ATF_PUBL	0x08
+#define	ATF_USETRAILERS	0x10
+#define ATF_NETMASK     0x20
+#define ATF_DONTPUB	0x40
+#define ATF_MAGIC	0x80
+
+#define ARPD_UPDATE	0x01
+#define ARPD_LOOKUP	0x02
+#define ARPD_FLUSH	0x03
+
+struct arpd_request {
+	unsigned short req;
+	uint32_t ip;
+	unsigned long dev;
+	unsigned long stamp;
+	unsigned long updated;
+	unsigned char ha[MAX_ADDR_LEN];
+};
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/net/route.h b/musl-include/i386/net/route.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/net/route.h
@@ -0,0 +1,124 @@
+#ifndef _NET_ROUTE_H
+#define _NET_ROUTE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+
+struct rtentry {
+	unsigned long int rt_pad1;
+	struct sockaddr rt_dst;
+	struct sockaddr rt_gateway;
+	struct sockaddr rt_genmask;
+	unsigned short int rt_flags;
+	short int rt_pad2;
+	unsigned long int rt_pad3;
+	unsigned char rt_tos;
+	unsigned char rt_class;
+	short int rt_pad4[sizeof(long)/2-1];
+	short int rt_metric;
+	char *rt_dev;
+	unsigned long int rt_mtu;
+	unsigned long int rt_window;
+	unsigned short int rt_irtt;
+};
+
+#define rt_mss	rt_mtu
+
+
+struct in6_rtmsg {
+	struct in6_addr rtmsg_dst;
+	struct in6_addr rtmsg_src;
+	struct in6_addr rtmsg_gateway;
+	uint32_t rtmsg_type;
+	uint16_t rtmsg_dst_len;
+	uint16_t rtmsg_src_len;
+	uint32_t rtmsg_metric;
+	unsigned long int rtmsg_info;
+	uint32_t rtmsg_flags;
+	int rtmsg_ifindex;
+};
+
+
+#define	RTF_UP		0x0001
+#define	RTF_GATEWAY	0x0002
+
+#define	RTF_HOST	0x0004
+#define RTF_REINSTATE	0x0008
+#define	RTF_DYNAMIC	0x0010
+#define	RTF_MODIFIED	0x0020
+#define RTF_MTU		0x0040
+#define RTF_MSS		RTF_MTU
+#define RTF_WINDOW	0x0080
+#define RTF_IRTT	0x0100
+#define RTF_REJECT	0x0200
+#define	RTF_STATIC	0x0400
+#define	RTF_XRESOLVE	0x0800
+#define RTF_NOFORWARD   0x1000
+#define RTF_THROW	0x2000
+#define RTF_NOPMTUDISC  0x4000
+
+#define RTF_DEFAULT	0x00010000
+#define RTF_ALLONLINK	0x00020000
+#define RTF_ADDRCONF	0x00040000
+
+#define RTF_LINKRT	0x00100000
+#define RTF_NONEXTHOP	0x00200000
+
+#define RTF_CACHE	0x01000000
+#define RTF_FLOW	0x02000000
+#define RTF_POLICY	0x04000000
+
+#define RTCF_VALVE	0x00200000
+#define RTCF_MASQ	0x00400000
+#define RTCF_NAT	0x00800000
+#define RTCF_DOREDIRECT 0x01000000
+#define RTCF_LOG	0x02000000
+#define RTCF_DIRECTSRC	0x04000000
+
+#define RTF_LOCAL	0x80000000
+#define RTF_INTERFACE	0x40000000
+#define RTF_MULTICAST	0x20000000
+#define RTF_BROADCAST	0x10000000
+#define RTF_NAT		0x08000000
+
+#define RTF_ADDRCLASSMASK	0xF8000000
+#define RT_ADDRCLASS(flags)	((uint32_t) flags >> 23)
+
+#define RT_TOS(tos)		((tos) & IPTOS_TOS_MASK)
+
+#define RT_LOCALADDR(flags)	((flags & RTF_ADDRCLASSMASK) \
+				 == (RTF_LOCAL|RTF_INTERFACE))
+
+#define RT_CLASS_UNSPEC		0
+#define RT_CLASS_DEFAULT	253
+
+#define RT_CLASS_MAIN		254
+#define RT_CLASS_LOCAL		255
+#define RT_CLASS_MAX		255
+
+
+#define RTMSG_ACK		NLMSG_ACK
+#define RTMSG_OVERRUN		NLMSG_OVERRUN
+
+#define RTMSG_NEWDEVICE		0x11
+#define RTMSG_DELDEVICE		0x12
+#define RTMSG_NEWROUTE		0x21
+#define RTMSG_DELROUTE		0x22
+#define RTMSG_NEWRULE		0x31
+#define RTMSG_DELRULE		0x32
+#define RTMSG_CONTROL		0x40
+
+#define RTMSG_AR_FAILED		0x51
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/netdb.h b/musl-include/i386/netdb.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netdb.h
@@ -0,0 +1,157 @@
+#ifndef	_NETDB_H
+#define	_NETDB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_size_t
+#include <bits/alltypes.h>
+#endif
+
+struct addrinfo {
+	int ai_flags;
+	int ai_family;
+	int ai_socktype;
+	int ai_protocol;
+	socklen_t ai_addrlen;
+	struct sockaddr *ai_addr;
+	char *ai_canonname;
+	struct addrinfo *ai_next;
+};
+
+#define AI_PASSIVE      0x01
+#define AI_CANONNAME    0x02
+#define AI_NUMERICHOST  0x04
+#define AI_V4MAPPED     0x08
+#define AI_ALL          0x10
+#define AI_ADDRCONFIG   0x20
+#define AI_NUMERICSERV  0x400
+
+
+#define NI_NUMERICHOST  0x01
+#define NI_NUMERICSERV  0x02
+#define NI_NOFQDN       0x04
+#define NI_NAMEREQD     0x08
+#define NI_DGRAM        0x10
+#define NI_NUMERICSCOPE 0x100
+
+#define EAI_BADFLAGS   -1
+#define EAI_NONAME     -2
+#define EAI_AGAIN      -3
+#define EAI_FAIL       -4
+#define EAI_NODATA     -5
+#define EAI_FAMILY     -6
+#define EAI_SOCKTYPE   -7
+#define EAI_SERVICE    -8
+#define EAI_MEMORY     -10
+#define EAI_SYSTEM     -11
+#define EAI_OVERFLOW   -12
+
+int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
+void freeaddrinfo (struct addrinfo *);
+int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
+const char *gai_strerror(int);
+
+
+/* Legacy functions follow (marked OBsolete in SUS) */
+
+struct netent {
+	char *n_name;
+	char **n_aliases;
+	int n_addrtype;
+	uint32_t n_net;
+};
+
+struct hostent {
+	char *h_name;
+	char **h_aliases;
+	int h_addrtype;
+	int h_length;
+	char **h_addr_list;
+};
+#define h_addr h_addr_list[0]
+
+struct servent {
+	char *s_name;
+	char **s_aliases;
+	int s_port;
+	char *s_proto;
+};
+
+struct protoent {
+	char *p_name;
+	char **p_aliases;
+	int p_proto;
+};
+
+void sethostent (int);
+void endhostent (void);
+struct hostent *gethostent (void);
+
+void setnetent (int);
+void endnetent (void);
+struct netent *getnetent (void);
+struct netent *getnetbyaddr (uint32_t, int);
+struct netent *getnetbyname (const char *);
+
+void setservent (int);
+void endservent (void);
+struct servent *getservent (void);
+struct servent *getservbyname (const char *, const char *);
+struct servent *getservbyport (int, const char *);
+
+void setprotoent (int);
+void endprotoent (void);
+struct protoent *getprotoent (void);
+struct protoent *getprotobyname (const char *);
+struct protoent *getprotobynumber (int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+struct hostent *gethostbyname (const char *);
+struct hostent *gethostbyaddr (const void *, socklen_t, int);
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int *__h_errno_location(void);
+#define h_errno (*__h_errno_location())
+#define HOST_NOT_FOUND 1
+#define TRY_AGAIN      2
+#define NO_RECOVERY    3
+#define NO_DATA        4
+#define NO_ADDRESS     NO_DATA
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void herror(const char *);
+const char *hstrerror(int);
+int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
+int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
+struct hostent *gethostbyname2(const char *, int);
+int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
+int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
+int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
+#define EAI_NODATA     -5
+#define EAI_ADDRFAMILY -9
+#define EAI_INPROGRESS -100
+#define EAI_CANCELED   -101
+#define EAI_NOTCANCELED -102
+#define EAI_ALLDONE    -103
+#define EAI_INTR       -104
+#define EAI_IDN_ENCODE -105
+#define NI_MAXHOST 255
+#define NI_MAXSERV 32
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/netinet/ether.h b/musl-include/i386/netinet/ether.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/ether.h
@@ -0,0 +1,22 @@
+#ifndef _NETINET_ETHER_H
+#define _NETINET_ETHER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <netinet/if_ether.h>
+
+char *ether_ntoa (const struct ether_addr *);
+struct ether_addr *ether_aton (const char *);
+char *ether_ntoa_r (const struct ether_addr *, char *);
+struct ether_addr *ether_aton_r (const char *, struct ether_addr *);
+int ether_line(const char *, struct ether_addr *, char *);
+int ether_ntohost(char *, const struct ether_addr *);
+int ether_hostton(const char *, struct ether_addr *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/netinet/icmp6.h b/musl-include/i386/netinet/icmp6.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/icmp6.h
@@ -0,0 +1,305 @@
+#ifndef _NETINET_ICMP6_H
+#define _NETINET_ICMP6_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#define ICMP6_FILTER 1
+
+#define ICMP6_FILTER_BLOCK		1
+#define ICMP6_FILTER_PASS		2
+#define ICMP6_FILTER_BLOCKOTHERS	3
+#define ICMP6_FILTER_PASSONLY		4
+
+struct icmp6_filter {
+	uint32_t icmp6_filt[8];
+};
+
+struct icmp6_hdr {
+	uint8_t     icmp6_type;
+	uint8_t     icmp6_code;
+	uint16_t    icmp6_cksum;
+	union {
+		uint32_t  icmp6_un_data32[1];
+		uint16_t  icmp6_un_data16[2];
+		uint8_t   icmp6_un_data8[4];
+	} icmp6_dataun;
+};
+
+#define icmp6_data32    icmp6_dataun.icmp6_un_data32
+#define icmp6_data16    icmp6_dataun.icmp6_un_data16
+#define icmp6_data8     icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr      icmp6_data32[0]
+#define icmp6_mtu       icmp6_data32[0]
+#define icmp6_id        icmp6_data16[0]
+#define icmp6_seq       icmp6_data16[1]
+#define icmp6_maxdelay  icmp6_data16[0]
+
+#define ICMP6_DST_UNREACH             1
+#define ICMP6_PACKET_TOO_BIG          2
+#define ICMP6_TIME_EXCEEDED           3
+#define ICMP6_PARAM_PROB              4
+
+#define ICMP6_INFOMSG_MASK  0x80
+
+#define ICMP6_ECHO_REQUEST          128
+#define ICMP6_ECHO_REPLY            129
+#define MLD_LISTENER_QUERY          130
+#define MLD_LISTENER_REPORT         131
+#define MLD_LISTENER_REDUCTION      132
+
+#define ICMP6_DST_UNREACH_NOROUTE     0
+#define ICMP6_DST_UNREACH_ADMIN       1
+#define ICMP6_DST_UNREACH_BEYONDSCOPE 2
+#define ICMP6_DST_UNREACH_ADDR        3
+#define ICMP6_DST_UNREACH_NOPORT      4
+
+#define ICMP6_TIME_EXCEED_TRANSIT     0
+#define ICMP6_TIME_EXCEED_REASSEMBLY  1
+
+#define ICMP6_PARAMPROB_HEADER        0
+#define ICMP6_PARAMPROB_NEXTHEADER    1
+#define ICMP6_PARAMPROB_OPTION        2
+
+#define ICMP6_FILTER_WILLPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+
+#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+
+#define ICMP6_FILTER_SETPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) |=  (1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETPASSALL(filterp) \
+	memset (filterp, 0, sizeof (struct icmp6_filter));
+
+#define ICMP6_FILTER_SETBLOCKALL(filterp) \
+	memset (filterp, 0xFF, sizeof (struct icmp6_filter));
+
+#define ND_ROUTER_SOLICIT           133
+#define ND_ROUTER_ADVERT            134
+#define ND_NEIGHBOR_SOLICIT         135
+#define ND_NEIGHBOR_ADVERT          136
+#define ND_REDIRECT                 137
+
+struct nd_router_solicit {
+	struct icmp6_hdr  nd_rs_hdr;
+};
+
+#define nd_rs_type               nd_rs_hdr.icmp6_type
+#define nd_rs_code               nd_rs_hdr.icmp6_code
+#define nd_rs_cksum              nd_rs_hdr.icmp6_cksum
+#define nd_rs_reserved           nd_rs_hdr.icmp6_data32[0]
+
+struct nd_router_advert {
+	struct icmp6_hdr  nd_ra_hdr;
+	uint32_t   nd_ra_reachable;
+	uint32_t   nd_ra_retransmit;
+};
+
+#define nd_ra_type               nd_ra_hdr.icmp6_type
+#define nd_ra_code               nd_ra_hdr.icmp6_code
+#define nd_ra_cksum              nd_ra_hdr.icmp6_cksum
+#define nd_ra_curhoplimit        nd_ra_hdr.icmp6_data8[0]
+#define nd_ra_flags_reserved     nd_ra_hdr.icmp6_data8[1]
+#define ND_RA_FLAG_MANAGED       0x80
+#define ND_RA_FLAG_OTHER         0x40
+#define ND_RA_FLAG_HOME_AGENT    0x20
+#define nd_ra_router_lifetime    nd_ra_hdr.icmp6_data16[1]
+
+struct nd_neighbor_solicit {
+	struct icmp6_hdr  nd_ns_hdr;
+	struct in6_addr   nd_ns_target;
+};
+
+#define nd_ns_type               nd_ns_hdr.icmp6_type
+#define nd_ns_code               nd_ns_hdr.icmp6_code
+#define nd_ns_cksum              nd_ns_hdr.icmp6_cksum
+#define nd_ns_reserved           nd_ns_hdr.icmp6_data32[0]
+
+struct nd_neighbor_advert {
+	struct icmp6_hdr  nd_na_hdr;
+	struct in6_addr   nd_na_target;
+};
+
+#define nd_na_type               nd_na_hdr.icmp6_type
+#define nd_na_code               nd_na_hdr.icmp6_code
+#define nd_na_cksum              nd_na_hdr.icmp6_cksum
+#define nd_na_flags_reserved     nd_na_hdr.icmp6_data32[0]
+#if     __BYTE_ORDER == __BIG_ENDIAN
+#define ND_NA_FLAG_ROUTER        0x80000000
+#define ND_NA_FLAG_SOLICITED     0x40000000
+#define ND_NA_FLAG_OVERRIDE      0x20000000
+#else
+#define ND_NA_FLAG_ROUTER        0x00000080
+#define ND_NA_FLAG_SOLICITED     0x00000040
+#define ND_NA_FLAG_OVERRIDE      0x00000020
+#endif
+
+struct nd_redirect {
+	struct icmp6_hdr  nd_rd_hdr;
+	struct in6_addr   nd_rd_target;
+	struct in6_addr   nd_rd_dst;
+};
+
+#define nd_rd_type               nd_rd_hdr.icmp6_type
+#define nd_rd_code               nd_rd_hdr.icmp6_code
+#define nd_rd_cksum              nd_rd_hdr.icmp6_cksum
+#define nd_rd_reserved           nd_rd_hdr.icmp6_data32[0]
+
+struct nd_opt_hdr {
+	uint8_t  nd_opt_type;
+	uint8_t  nd_opt_len;
+};
+
+#define ND_OPT_SOURCE_LINKADDR		1
+#define ND_OPT_TARGET_LINKADDR		2
+#define ND_OPT_PREFIX_INFORMATION	3
+#define ND_OPT_REDIRECTED_HEADER	4
+#define ND_OPT_MTU			5
+#define ND_OPT_RTR_ADV_INTERVAL		7
+#define ND_OPT_HOME_AGENT_INFO		8
+
+struct nd_opt_prefix_info {
+	uint8_t   nd_opt_pi_type;
+	uint8_t   nd_opt_pi_len;
+	uint8_t   nd_opt_pi_prefix_len;
+	uint8_t   nd_opt_pi_flags_reserved;
+	uint32_t  nd_opt_pi_valid_time;
+	uint32_t  nd_opt_pi_preferred_time;
+	uint32_t  nd_opt_pi_reserved2;
+	struct in6_addr  nd_opt_pi_prefix;
+};
+
+#define ND_OPT_PI_FLAG_ONLINK	0x80
+#define ND_OPT_PI_FLAG_AUTO	0x40
+#define ND_OPT_PI_FLAG_RADDR	0x20
+
+struct nd_opt_rd_hdr {
+	uint8_t   nd_opt_rh_type;
+	uint8_t   nd_opt_rh_len;
+	uint16_t  nd_opt_rh_reserved1;
+	uint32_t  nd_opt_rh_reserved2;
+};
+
+struct nd_opt_mtu {
+	uint8_t   nd_opt_mtu_type;
+	uint8_t   nd_opt_mtu_len;
+	uint16_t  nd_opt_mtu_reserved;
+	uint32_t  nd_opt_mtu_mtu;
+};
+
+struct mld_hdr {
+	struct icmp6_hdr    mld_icmp6_hdr;
+	struct in6_addr     mld_addr;
+};
+
+#define mld_type        mld_icmp6_hdr.icmp6_type
+#define mld_code        mld_icmp6_hdr.icmp6_code
+#define mld_cksum       mld_icmp6_hdr.icmp6_cksum
+#define mld_maxdelay    mld_icmp6_hdr.icmp6_data16[0]
+#define mld_reserved    mld_icmp6_hdr.icmp6_data16[1]
+
+#define ICMP6_ROUTER_RENUMBERING    138
+
+struct icmp6_router_renum {
+	struct icmp6_hdr    rr_hdr;
+	uint8_t             rr_segnum;
+	uint8_t             rr_flags;
+	uint16_t            rr_maxdelay;
+	uint32_t            rr_reserved;
+};
+
+#define rr_type		rr_hdr.icmp6_type
+#define rr_code         rr_hdr.icmp6_code
+#define rr_cksum        rr_hdr.icmp6_cksum
+#define rr_seqnum       rr_hdr.icmp6_data32[0]
+
+#define ICMP6_RR_FLAGS_TEST             0x80
+#define ICMP6_RR_FLAGS_REQRESULT        0x40
+#define ICMP6_RR_FLAGS_FORCEAPPLY       0x20
+#define ICMP6_RR_FLAGS_SPECSITE         0x10
+#define ICMP6_RR_FLAGS_PREVDONE         0x08
+
+struct rr_pco_match {
+	uint8_t             rpm_code;
+	uint8_t             rpm_len;
+	uint8_t             rpm_ordinal;
+	uint8_t             rpm_matchlen;
+	uint8_t             rpm_minlen;
+	uint8_t             rpm_maxlen;
+	uint16_t            rpm_reserved;
+	struct in6_addr     rpm_prefix;
+};
+
+#define RPM_PCO_ADD             1
+#define RPM_PCO_CHANGE          2
+#define RPM_PCO_SETGLOBAL       3
+
+struct rr_pco_use {
+	uint8_t             rpu_uselen;
+	uint8_t             rpu_keeplen;
+	uint8_t             rpu_ramask;
+	uint8_t             rpu_raflags;
+	uint32_t            rpu_vltime;
+	uint32_t            rpu_pltime;
+	uint32_t            rpu_flags;
+	struct in6_addr     rpu_prefix;
+};
+
+#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK  0x20
+#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO    0x10
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
+#else
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
+#endif
+
+struct rr_result {
+	uint16_t            rrr_flags;
+	uint8_t             rrr_ordinal;
+	uint8_t             rrr_matchedlen;
+	uint32_t            rrr_ifid;
+	struct in6_addr     rrr_prefix;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ICMP6_RR_RESULT_FLAGS_OOB       0x0002
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
+#else
+#define ICMP6_RR_RESULT_FLAGS_OOB       0x0200
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
+#endif
+
+struct nd_opt_adv_interval {
+	uint8_t   nd_opt_adv_interval_type;
+	uint8_t   nd_opt_adv_interval_len;
+	uint16_t  nd_opt_adv_interval_reserved;
+	uint32_t  nd_opt_adv_interval_ival;
+};
+
+struct nd_opt_home_agent_info {
+	uint8_t   nd_opt_home_agent_info_type;
+	uint8_t   nd_opt_home_agent_info_len;
+	uint16_t  nd_opt_home_agent_info_reserved;
+	uint16_t  nd_opt_home_agent_info_preference;
+	uint16_t  nd_opt_home_agent_info_lifetime;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/netinet/if_ether.h b/musl-include/i386/netinet/if_ether.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/if_ether.h
@@ -0,0 +1,149 @@
+#ifndef _NETINET_IF_ETHER_H
+#define _NETINET_IF_ETHER_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#define ETH_ALEN	6
+#define ETH_TLEN	2
+#define ETH_HLEN	14
+#define ETH_ZLEN	60
+#define ETH_DATA_LEN	1500
+#define ETH_FRAME_LEN	1514
+#define ETH_FCS_LEN	4
+#define ETH_MIN_MTU	68
+#define ETH_MAX_MTU	0xFFFFU
+
+#define ETH_P_LOOP	0x0060
+#define ETH_P_PUP	0x0200
+#define ETH_P_PUPAT	0x0201
+#define ETH_P_TSN	0x22F0
+#define ETH_P_ERSPAN2	0x22EB
+#define ETH_P_IP	0x0800
+#define ETH_P_X25	0x0805
+#define ETH_P_ARP	0x0806
+#define	ETH_P_BPQ	0x08FF
+#define ETH_P_IEEEPUP	0x0a00
+#define ETH_P_IEEEPUPAT	0x0a01
+#define ETH_P_BATMAN	0x4305
+#define ETH_P_DEC       0x6000
+#define ETH_P_DNA_DL    0x6001
+#define ETH_P_DNA_RC    0x6002
+#define ETH_P_DNA_RT    0x6003
+#define ETH_P_LAT       0x6004
+#define ETH_P_DIAG      0x6005
+#define ETH_P_CUST      0x6006
+#define ETH_P_SCA       0x6007
+#define ETH_P_TEB	0x6558
+#define ETH_P_RARP      0x8035
+#define ETH_P_ATALK	0x809B
+#define ETH_P_AARP	0x80F3
+#define ETH_P_8021Q	0x8100
+#define ETH_P_IPX	0x8137
+#define ETH_P_IPV6	0x86DD
+#define ETH_P_PAUSE	0x8808
+#define ETH_P_SLOW	0x8809
+#define ETH_P_WCCP	0x883E
+#define ETH_P_MPLS_UC	0x8847
+#define ETH_P_MPLS_MC	0x8848
+#define ETH_P_ATMMPOA	0x884c
+#define ETH_P_PPP_DISC	0x8863
+#define ETH_P_PPP_SES	0x8864
+#define ETH_P_LINK_CTL	0x886c
+#define ETH_P_ATMFATE	0x8884
+#define ETH_P_PAE	0x888E
+#define ETH_P_AOE	0x88A2
+#define ETH_P_8021AD	0x88A8
+#define ETH_P_802_EX1	0x88B5
+#define ETH_P_ERSPAN	0x88BE
+#define ETH_P_PREAUTH	0x88C7
+#define ETH_P_TIPC	0x88CA
+#define ETH_P_LLDP	0x88CC
+#define ETH_P_MRP	0x88E3
+#define ETH_P_MACSEC	0x88E5
+#define ETH_P_8021AH	0x88E7
+#define ETH_P_MVRP	0x88F5
+#define ETH_P_1588	0x88F7
+#define ETH_P_NCSI	0x88F8
+#define ETH_P_PRP	0x88FB
+#define ETH_P_CFM	0x8902
+#define ETH_P_FCOE	0x8906
+#define ETH_P_TDLS	0x890D
+#define ETH_P_FIP	0x8914
+#define ETH_P_IBOE	0x8915
+#define ETH_P_80221	0x8917
+#define ETH_P_HSR	0x892F
+#define ETH_P_NSH	0x894F
+#define ETH_P_LOOPBACK	0x9000
+#define ETH_P_QINQ1	0x9100
+#define ETH_P_QINQ2	0x9200
+#define ETH_P_QINQ3	0x9300
+#define ETH_P_EDSA	0xDADA
+#define ETH_P_DSA_8021Q	0xDADB
+#define ETH_P_IFE	0xED3E
+#define ETH_P_AF_IUCV	0xFBFB
+
+#define ETH_P_802_3_MIN	0x0600
+
+#define ETH_P_802_3	0x0001
+#define ETH_P_AX25	0x0002
+#define ETH_P_ALL	0x0003
+#define ETH_P_802_2	0x0004
+#define ETH_P_SNAP	0x0005
+#define ETH_P_DDCMP     0x0006
+#define ETH_P_WAN_PPP   0x0007
+#define ETH_P_PPP_MP    0x0008
+#define ETH_P_LOCALTALK 0x0009
+#define ETH_P_CAN	0x000C
+#define ETH_P_CANFD	0x000D
+#define ETH_P_PPPTALK	0x0010
+#define ETH_P_TR_802_2	0x0011
+#define ETH_P_MOBITEX	0x0015
+#define ETH_P_CONTROL	0x0016
+#define ETH_P_IRDA	0x0017
+#define ETH_P_ECONET	0x0018
+#define ETH_P_HDLC	0x0019
+#define ETH_P_ARCNET	0x001A
+#define ETH_P_DSA	0x001B
+#define ETH_P_TRAILER	0x001C
+#define ETH_P_PHONET	0x00F5
+#define ETH_P_IEEE802154 0x00F6
+#define ETH_P_CAIF	0x00F7
+#define ETH_P_XDSA	0x00F8
+#define ETH_P_MAP	0x00F9
+
+struct ethhdr {
+	uint8_t h_dest[ETH_ALEN];
+	uint8_t h_source[ETH_ALEN];
+	uint16_t h_proto;
+};
+
+#include <net/ethernet.h>
+#include <net/if_arp.h>
+
+struct	ether_arp {
+	struct	arphdr ea_hdr;
+	uint8_t arp_sha[ETH_ALEN];
+	uint8_t arp_spa[4];
+	uint8_t arp_tha[ETH_ALEN];
+	uint8_t arp_tpa[4];
+};
+#define	arp_hrd	ea_hdr.ar_hrd
+#define	arp_pro	ea_hdr.ar_pro
+#define	arp_hln	ea_hdr.ar_hln
+#define	arp_pln	ea_hdr.ar_pln
+#define	arp_op	ea_hdr.ar_op
+
+#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
+do { \
+	(enaddr)[0] = 0x01; \
+	(enaddr)[1] = 0x00; \
+	(enaddr)[2] = 0x5e; \
+	(enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
+	(enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
+	(enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
+} while(0)
+
+#define __UAPI_DEF_ETHHDR       0
+
+#endif
diff --git a/musl-include/i386/netinet/igmp.h b/musl-include/i386/netinet/igmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/igmp.h
@@ -0,0 +1,45 @@
+#ifndef _NETINET_IGMP_H
+#define _NETINET_IGMP_H
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct igmp {
+	uint8_t igmp_type;
+	uint8_t igmp_code;
+	uint16_t igmp_cksum;
+	struct in_addr igmp_group;
+};
+
+#define IGMP_MINLEN			8
+
+#define IGMP_MEMBERSHIP_QUERY   	0x11
+#define IGMP_V1_MEMBERSHIP_REPORT	0x12
+#define IGMP_V2_MEMBERSHIP_REPORT	0x16
+#define IGMP_V2_LEAVE_GROUP		0x17
+
+#define IGMP_DVMRP			0x13
+#define IGMP_PIM			0x14
+#define IGMP_TRACE			0x15
+
+#define IGMP_MTRACE_RESP		0x1e
+#define IGMP_MTRACE			0x1f
+
+#define IGMP_MAX_HOST_REPORT_DELAY	10
+#define IGMP_TIMER_SCALE		10
+
+#define IGMP_DELAYING_MEMBER	1
+#define IGMP_IDLE_MEMBER	2
+#define IGMP_LAZY_MEMBER	3
+#define IGMP_SLEEPING_MEMBER	4
+#define IGMP_AWAKENING_MEMBER	5
+
+#define IGMP_v1_ROUTER		1
+#define IGMP_v2_ROUTER		2
+
+#define IGMP_HOST_MEMBERSHIP_QUERY	IGMP_MEMBERSHIP_QUERY
+#define IGMP_HOST_MEMBERSHIP_REPORT	IGMP_V1_MEMBERSHIP_REPORT
+#define IGMP_HOST_NEW_MEMBERSHIP_REPORT	IGMP_V2_MEMBERSHIP_REPORT
+#define IGMP_HOST_LEAVE_MESSAGE		IGMP_V2_LEAVE_GROUP
+
+#endif
diff --git a/musl-include/i386/netinet/in.h b/musl-include/i386/netinet/in.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/in.h
@@ -0,0 +1,417 @@
+#ifndef	_NETINET_IN_H
+#define	_NETINET_IN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <inttypes.h>
+#include <sys/socket.h>
+
+typedef uint16_t in_port_t;
+typedef uint32_t in_addr_t;
+struct in_addr { in_addr_t s_addr; };
+
+struct sockaddr_in {
+	sa_family_t sin_family;
+	in_port_t sin_port;
+	struct in_addr sin_addr;
+	uint8_t sin_zero[8];
+};
+
+struct in6_addr {
+	union {
+		uint8_t __s6_addr[16];
+		uint16_t __s6_addr16[8];
+		uint32_t __s6_addr32[4];
+	} __in6_union;
+};
+#define s6_addr __in6_union.__s6_addr
+#define s6_addr16 __in6_union.__s6_addr16
+#define s6_addr32 __in6_union.__s6_addr32
+
+struct sockaddr_in6 {
+	sa_family_t     sin6_family;
+	in_port_t       sin6_port;
+	uint32_t        sin6_flowinfo;
+	struct in6_addr sin6_addr;
+	uint32_t        sin6_scope_id;
+};
+
+struct ipv6_mreq {
+	struct in6_addr ipv6mr_multiaddr;
+	unsigned        ipv6mr_interface;
+};
+
+#define INADDR_ANY        ((in_addr_t) 0x00000000)
+#define INADDR_BROADCAST  ((in_addr_t) 0xffffffff)
+#define INADDR_NONE       ((in_addr_t) 0xffffffff)
+#define INADDR_LOOPBACK   ((in_addr_t) 0x7f000001)
+#define INADDR_DUMMY      ((in_addr_t) 0xc0000008)
+
+#define INADDR_UNSPEC_GROUP     ((in_addr_t) 0xe0000000)
+#define INADDR_ALLHOSTS_GROUP   ((in_addr_t) 0xe0000001)
+#define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002)
+#define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a)
+#define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff)
+
+#define IN6ADDR_ANY_INIT      { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
+#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
+
+extern const struct in6_addr in6addr_any, in6addr_loopback;
+
+#define INET_ADDRSTRLEN  16
+#define INET6_ADDRSTRLEN 46
+
+uint32_t htonl(uint32_t);
+uint16_t htons(uint16_t);
+uint32_t ntohl(uint32_t);
+uint16_t ntohs(uint16_t);
+
+#define IPPORT_RESERVED 1024
+
+#define IPPROTO_IP       0
+#define IPPROTO_HOPOPTS  0
+#define IPPROTO_ICMP     1
+#define IPPROTO_IGMP     2
+#define IPPROTO_IPIP     4
+#define IPPROTO_TCP      6
+#define IPPROTO_EGP      8
+#define IPPROTO_PUP      12
+#define IPPROTO_UDP      17
+#define IPPROTO_IDP      22
+#define IPPROTO_TP       29
+#define IPPROTO_DCCP     33
+#define IPPROTO_IPV6     41
+#define IPPROTO_ROUTING  43
+#define IPPROTO_FRAGMENT 44
+#define IPPROTO_RSVP     46
+#define IPPROTO_GRE      47
+#define IPPROTO_ESP      50
+#define IPPROTO_AH       51
+#define IPPROTO_ICMPV6   58
+#define IPPROTO_NONE     59
+#define IPPROTO_DSTOPTS  60
+#define IPPROTO_MTP      92
+#define IPPROTO_BEETPH   94
+#define IPPROTO_ENCAP    98
+#define IPPROTO_PIM      103
+#define IPPROTO_COMP     108
+#define IPPROTO_SCTP     132
+#define IPPROTO_MH       135
+#define IPPROTO_UDPLITE  136
+#define IPPROTO_MPLS     137
+#define IPPROTO_ETHERNET 143
+#define IPPROTO_RAW      255
+#define IPPROTO_MPTCP    262
+#define IPPROTO_MAX      263
+
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
+
+#define IN6_IS_ADDR_LOOPBACK(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && \
+         ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \
+         ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
+
+#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
+
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
+
+#define IN6_IS_ADDR_SITELOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \
+         ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
+
+#define IN6_IS_ADDR_V4COMPAT(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
+
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
+
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
+
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
+
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
+
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
+
+#define __ARE_4_EQUAL(a,b) \
+	(!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) ))
+#define IN6_ARE_ADDR_EQUAL(a,b) \
+	__ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
+
+#define	IN_CLASSA(a)		((((in_addr_t)(a)) & 0x80000000) == 0)
+#define	IN_CLASSA_NET		0xff000000
+#define	IN_CLASSA_NSHIFT	24
+#define	IN_CLASSA_HOST		(0xffffffff & ~IN_CLASSA_NET)
+#define	IN_CLASSA_MAX		128
+#define	IN_CLASSB(a)		((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
+#define	IN_CLASSB_NET		0xffff0000
+#define	IN_CLASSB_NSHIFT	16
+#define	IN_CLASSB_HOST		(0xffffffff & ~IN_CLASSB_NET)
+#define	IN_CLASSB_MAX		65536
+#define	IN_CLASSC(a)		((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
+#define	IN_CLASSC_NET		0xffffff00
+#define	IN_CLASSC_NSHIFT	8
+#define	IN_CLASSC_HOST		(0xffffffff & ~IN_CLASSC_NET)
+#define	IN_CLASSD(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
+#define	IN_MULTICAST(a)		IN_CLASSD(a)
+#define	IN_EXPERIMENTAL(a)	((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
+#define	IN_BADCLASS(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
+
+#define IN_LOOPBACKNET 127
+
+
+#define IP_TOS             1
+#define IP_TTL             2
+#define IP_HDRINCL         3
+#define IP_OPTIONS         4
+#define IP_ROUTER_ALERT    5
+#define IP_RECVOPTS        6
+#define IP_RETOPTS         7
+#define IP_PKTINFO         8
+#define IP_PKTOPTIONS      9
+#define IP_PMTUDISC        10
+#define IP_MTU_DISCOVER    10
+#define IP_RECVERR         11
+#define IP_RECVTTL         12
+#define IP_RECVTOS         13
+#define IP_MTU             14
+#define IP_FREEBIND        15
+#define IP_IPSEC_POLICY    16
+#define IP_XFRM_POLICY     17
+#define IP_PASSSEC         18
+#define IP_TRANSPARENT     19
+#define IP_ORIGDSTADDR     20
+#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
+#define IP_MINTTL          21
+#define IP_NODEFRAG        22
+#define IP_CHECKSUM        23
+#define IP_BIND_ADDRESS_NO_PORT 24
+#define IP_RECVFRAGSIZE    25
+#define IP_RECVERR_RFC4884 26
+#define IP_MULTICAST_IF    32
+#define IP_MULTICAST_TTL   33
+#define IP_MULTICAST_LOOP  34
+#define IP_ADD_MEMBERSHIP  35
+#define IP_DROP_MEMBERSHIP 36
+#define IP_UNBLOCK_SOURCE  37
+#define IP_BLOCK_SOURCE    38
+#define IP_ADD_SOURCE_MEMBERSHIP  39
+#define IP_DROP_SOURCE_MEMBERSHIP 40
+#define IP_MSFILTER        41
+#define IP_MULTICAST_ALL   49
+#define IP_UNICAST_IF      50
+
+#define IP_RECVRETOPTS IP_RETOPTS
+
+#define IP_PMTUDISC_DONT   0
+#define IP_PMTUDISC_WANT   1
+#define IP_PMTUDISC_DO     2
+#define IP_PMTUDISC_PROBE  3
+#define IP_PMTUDISC_INTERFACE 4
+#define IP_PMTUDISC_OMIT   5
+
+#define IP_DEFAULT_MULTICAST_TTL        1
+#define IP_DEFAULT_MULTICAST_LOOP       1
+#define IP_MAX_MEMBERSHIPS              20
+
+struct ip_opts {
+	struct in_addr ip_dst;
+	char ip_opts[40];
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define MCAST_JOIN_GROUP   42
+#define MCAST_BLOCK_SOURCE 43
+#define MCAST_UNBLOCK_SOURCE      44
+#define MCAST_LEAVE_GROUP  45
+#define MCAST_JOIN_SOURCE_GROUP   46
+#define MCAST_LEAVE_SOURCE_GROUP  47
+#define MCAST_MSFILTER     48
+
+#define MCAST_EXCLUDE 0
+#define MCAST_INCLUDE 1
+
+struct ip_mreq {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_interface;
+};
+
+struct ip_mreqn {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_address;
+	int imr_ifindex;
+};
+
+struct ip_mreq_source {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_interface;
+	struct in_addr imr_sourceaddr;
+};
+
+struct ip_msfilter {
+	struct in_addr imsf_multiaddr;
+	struct in_addr imsf_interface;
+	uint32_t imsf_fmode;
+	uint32_t imsf_numsrc;
+	struct in_addr imsf_slist[1];
+};
+#define IP_MSFILTER_SIZE(numsrc) \
+	(sizeof(struct ip_msfilter) - sizeof(struct in_addr) \
+	+ (numsrc) * sizeof(struct in_addr))
+
+struct group_req {
+	uint32_t gr_interface;
+	struct sockaddr_storage gr_group;
+};
+
+struct group_source_req {
+	uint32_t gsr_interface;
+	struct sockaddr_storage gsr_group;
+	struct sockaddr_storage gsr_source;
+};
+
+struct group_filter {
+	uint32_t gf_interface;
+	struct sockaddr_storage gf_group;
+	uint32_t gf_fmode;
+	uint32_t gf_numsrc;
+	struct sockaddr_storage gf_slist[1];
+};
+#define GROUP_FILTER_SIZE(numsrc) \
+	(sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \
+	+ (numsrc) * sizeof(struct sockaddr_storage))
+
+struct in_pktinfo {
+	int ipi_ifindex;
+	struct in_addr ipi_spec_dst;
+	struct in_addr ipi_addr;
+};
+
+struct in6_pktinfo {
+	struct in6_addr ipi6_addr;
+	unsigned ipi6_ifindex;
+};
+
+struct ip6_mtuinfo {
+	struct sockaddr_in6 ip6m_addr;
+	uint32_t ip6m_mtu;
+};
+#endif
+
+#define IPV6_ADDRFORM           1
+#define IPV6_2292PKTINFO        2
+#define IPV6_2292HOPOPTS        3
+#define IPV6_2292DSTOPTS        4
+#define IPV6_2292RTHDR          5
+#define IPV6_2292PKTOPTIONS     6
+#define IPV6_CHECKSUM           7
+#define IPV6_2292HOPLIMIT       8
+#define IPV6_NEXTHOP            9
+#define IPV6_AUTHHDR            10
+#define IPV6_UNICAST_HOPS       16
+#define IPV6_MULTICAST_IF       17
+#define IPV6_MULTICAST_HOPS     18
+#define IPV6_MULTICAST_LOOP     19
+#define IPV6_JOIN_GROUP         20
+#define IPV6_LEAVE_GROUP        21
+#define IPV6_ROUTER_ALERT       22
+#define IPV6_MTU_DISCOVER       23
+#define IPV6_MTU                24
+#define IPV6_RECVERR            25
+#define IPV6_V6ONLY             26
+#define IPV6_JOIN_ANYCAST       27
+#define IPV6_LEAVE_ANYCAST      28
+#define IPV6_MULTICAST_ALL      29
+#define IPV6_ROUTER_ALERT_ISOLATE 30
+#define IPV6_IPSEC_POLICY       34
+#define IPV6_XFRM_POLICY        35
+#define IPV6_HDRINCL            36
+
+#define IPV6_RECVPKTINFO        49
+#define IPV6_PKTINFO            50
+#define IPV6_RECVHOPLIMIT       51
+#define IPV6_HOPLIMIT           52
+#define IPV6_RECVHOPOPTS        53
+#define IPV6_HOPOPTS            54
+#define IPV6_RTHDRDSTOPTS       55
+#define IPV6_RECVRTHDR          56
+#define IPV6_RTHDR              57
+#define IPV6_RECVDSTOPTS        58
+#define IPV6_DSTOPTS            59
+#define IPV6_RECVPATHMTU        60
+#define IPV6_PATHMTU            61
+#define IPV6_DONTFRAG           62
+#define IPV6_RECVTCLASS         66
+#define IPV6_TCLASS             67
+#define IPV6_AUTOFLOWLABEL      70
+#define IPV6_ADDR_PREFERENCES   72
+#define IPV6_MINHOPCOUNT        73
+#define IPV6_ORIGDSTADDR        74
+#define IPV6_RECVORIGDSTADDR    IPV6_ORIGDSTADDR
+#define IPV6_TRANSPARENT        75
+#define IPV6_UNICAST_IF         76
+#define IPV6_RECVFRAGSIZE       77
+#define IPV6_FREEBIND           78
+
+#define IPV6_ADD_MEMBERSHIP     IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP    IPV6_LEAVE_GROUP
+#define IPV6_RXHOPOPTS          IPV6_HOPOPTS
+#define IPV6_RXDSTOPTS          IPV6_DSTOPTS
+
+#define IPV6_PMTUDISC_DONT      0
+#define IPV6_PMTUDISC_WANT      1
+#define IPV6_PMTUDISC_DO        2
+#define IPV6_PMTUDISC_PROBE     3
+#define IPV6_PMTUDISC_INTERFACE 4
+#define IPV6_PMTUDISC_OMIT      5
+
+#define IPV6_PREFER_SRC_TMP            0x0001
+#define IPV6_PREFER_SRC_PUBLIC         0x0002
+#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
+#define IPV6_PREFER_SRC_COA            0x0004
+#define IPV6_PREFER_SRC_HOME           0x0400
+#define IPV6_PREFER_SRC_CGA            0x0008
+#define IPV6_PREFER_SRC_NONCGA         0x0800
+
+#define IPV6_RTHDR_LOOSE        0
+#define IPV6_RTHDR_STRICT       1
+
+#define IPV6_RTHDR_TYPE_0       0
+
+#define __UAPI_DEF_IN_ADDR      0
+#define __UAPI_DEF_IN_IPPROTO   0
+#define __UAPI_DEF_IN_PKTINFO   0
+#define __UAPI_DEF_IP_MREQ      0
+#define __UAPI_DEF_SOCKADDR_IN  0
+#define __UAPI_DEF_IN_CLASS     0
+#define __UAPI_DEF_IN6_ADDR     0
+#define __UAPI_DEF_IN6_ADDR_ALT 0
+#define __UAPI_DEF_SOCKADDR_IN6 0
+#define __UAPI_DEF_IPV6_MREQ    0
+#define __UAPI_DEF_IPPROTO_V6   0
+#define __UAPI_DEF_IPV6_OPTIONS 0
+#define __UAPI_DEF_IN6_PKTINFO  0
+#define __UAPI_DEF_IP6_MTUINFO  0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/netinet/in_systm.h b/musl-include/i386/netinet/in_systm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/in_systm.h
@@ -0,0 +1,9 @@
+#ifndef _NETINET_IN_SYSTM_H
+#define _NETINET_IN_SYSTM_H
+
+#include <stdint.h>
+
+typedef uint16_t n_short;
+typedef uint32_t n_long, n_time;
+
+#endif
diff --git a/musl-include/i386/netinet/ip.h b/musl-include/i386/netinet/ip.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/ip.h
@@ -0,0 +1,199 @@
+#ifndef _NETINET_IP_H
+#define _NETINET_IP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct timestamp {
+	uint8_t len;
+	uint8_t ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int flags:4;
+	unsigned int overflow:4;
+#else
+	unsigned int overflow:4;
+	unsigned int flags:4;
+#endif
+	uint32_t data[9];
+  };
+
+struct iphdr {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ihl:4;
+	unsigned int version:4;
+#else
+	unsigned int version:4;
+	unsigned int ihl:4;
+#endif
+	uint8_t tos;
+	uint16_t tot_len;
+	uint16_t id;
+	uint16_t frag_off;
+	uint8_t ttl;
+	uint8_t protocol;
+	uint16_t check;
+	uint32_t saddr;
+	uint32_t daddr;
+};
+
+struct ip {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ip_hl:4;
+	unsigned int ip_v:4;
+#else
+	unsigned int ip_v:4;
+	unsigned int ip_hl:4;
+#endif
+	uint8_t ip_tos;
+	uint16_t ip_len;
+	uint16_t ip_id;
+	uint16_t ip_off;
+	uint8_t ip_ttl;
+	uint8_t ip_p;
+	uint16_t ip_sum;
+	struct in_addr ip_src, ip_dst;
+};
+
+#define	IP_RF 0x8000
+#define	IP_DF 0x4000
+#define	IP_MF 0x2000
+#define	IP_OFFMASK 0x1fff
+
+struct ip_timestamp {
+	uint8_t ipt_code;
+	uint8_t ipt_len;
+	uint8_t ipt_ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ipt_flg:4;
+	unsigned int ipt_oflw:4;
+#else
+	unsigned int ipt_oflw:4;
+	unsigned int ipt_flg:4;
+#endif
+	uint32_t data[9];
+};
+
+#define	IPVERSION	4
+#define	IP_MAXPACKET	65535
+
+#define	IPTOS_ECN_MASK		0x03
+#define	IPTOS_ECN(x)		((x) & IPTOS_ECN_MASK)
+#define	IPTOS_ECN_NOT_ECT	0x00
+#define	IPTOS_ECN_ECT1		0x01
+#define	IPTOS_ECN_ECT0		0x02
+#define	IPTOS_ECN_CE		0x03
+
+#define	IPTOS_DSCP_MASK		0xfc
+#define	IPTOS_DSCP(x)		((x) & IPTOS_DSCP_MASK)
+#define	IPTOS_DSCP_AF11		0x28
+#define	IPTOS_DSCP_AF12		0x30
+#define	IPTOS_DSCP_AF13		0x38
+#define	IPTOS_DSCP_AF21		0x48
+#define	IPTOS_DSCP_AF22		0x50
+#define	IPTOS_DSCP_AF23		0x58
+#define	IPTOS_DSCP_AF31		0x68
+#define	IPTOS_DSCP_AF32		0x70
+#define	IPTOS_DSCP_AF33		0x78
+#define	IPTOS_DSCP_AF41		0x88
+#define	IPTOS_DSCP_AF42		0x90
+#define	IPTOS_DSCP_AF43		0x98
+#define	IPTOS_DSCP_EF		0xb8
+
+#define	IPTOS_CLASS_MASK	0xe0
+#define	IPTOS_CLASS(x)		((x) & IPTOS_CLASS_MASK)
+#define	IPTOS_CLASS_CS0		0x00
+#define	IPTOS_CLASS_CS1		0x20
+#define	IPTOS_CLASS_CS2		0x40
+#define	IPTOS_CLASS_CS3		0x60
+#define	IPTOS_CLASS_CS4		0x80
+#define	IPTOS_CLASS_CS5		0xa0
+#define	IPTOS_CLASS_CS6		0xc0
+#define	IPTOS_CLASS_CS7		0xe0
+#define	IPTOS_CLASS_DEFAULT	IPTOS_CLASS_CS0
+
+#define	IPTOS_TOS_MASK		0x1E
+#define	IPTOS_TOS(tos)		((tos) & IPTOS_TOS_MASK)
+#define	IPTOS_LOWDELAY		0x10
+#define	IPTOS_THROUGHPUT	0x08
+#define	IPTOS_RELIABILITY	0x04
+#define	IPTOS_LOWCOST		0x02
+#define	IPTOS_MINCOST		IPTOS_LOWCOST
+
+#define	IPTOS_PREC_MASK			0xe0
+#define	IPTOS_PREC(tos)                ((tos) & IPTOS_PREC_MASK)
+#define	IPTOS_PREC_NETCONTROL		0xe0
+#define	IPTOS_PREC_INTERNETCONTROL	0xc0
+#define	IPTOS_PREC_CRITIC_ECP		0xa0
+#define	IPTOS_PREC_FLASHOVERRIDE	0x80
+#define	IPTOS_PREC_FLASH		0x60
+#define	IPTOS_PREC_IMMEDIATE		0x40
+#define	IPTOS_PREC_PRIORITY		0x20
+#define	IPTOS_PREC_ROUTINE		0x00
+
+#define	IPOPT_COPY		0x80
+#define	IPOPT_CLASS_MASK	0x60
+#define	IPOPT_NUMBER_MASK	0x1f
+
+#define	IPOPT_COPIED(o)		((o) & IPOPT_COPY)
+#define	IPOPT_CLASS(o)		((o) & IPOPT_CLASS_MASK)
+#define	IPOPT_NUMBER(o)		((o) & IPOPT_NUMBER_MASK)
+
+#define	IPOPT_CONTROL		0x00
+#define	IPOPT_RESERVED1		0x20
+#define	IPOPT_DEBMEAS		0x40
+#define	IPOPT_MEASUREMENT       IPOPT_DEBMEAS
+#define	IPOPT_RESERVED2		0x60
+
+#define	IPOPT_EOL		0
+#define	IPOPT_END		IPOPT_EOL
+#define	IPOPT_NOP		1
+#define	IPOPT_NOOP		IPOPT_NOP
+
+#define	IPOPT_RR		7
+#define	IPOPT_TS		68
+#define	IPOPT_TIMESTAMP		IPOPT_TS
+#define	IPOPT_SECURITY		130
+#define	IPOPT_SEC		IPOPT_SECURITY
+#define	IPOPT_LSRR		131
+#define	IPOPT_SATID		136
+#define	IPOPT_SID		IPOPT_SATID
+#define	IPOPT_SSRR		137
+#define	IPOPT_RA		148
+
+#define	IPOPT_OPTVAL		0
+#define	IPOPT_OLEN		1
+#define	IPOPT_OFFSET		2
+#define	IPOPT_MINOFF		4
+
+#define	MAX_IPOPTLEN		40
+
+#define	IPOPT_TS_TSONLY		0
+#define	IPOPT_TS_TSANDADDR	1
+#define	IPOPT_TS_PRESPEC	3
+
+#define	IPOPT_SECUR_UNCLASS	0x0000
+#define	IPOPT_SECUR_CONFID	0xf135
+#define	IPOPT_SECUR_EFTO	0x789a
+#define	IPOPT_SECUR_MMMM	0xbc4d
+#define	IPOPT_SECUR_RESTR	0xaf13
+#define	IPOPT_SECUR_SECRET	0xd788
+#define	IPOPT_SECUR_TOPSECRET	0x6bc5
+
+#define	MAXTTL		255
+#define	IPDEFTTL	64
+#define	IPFRAGTTL	60
+#define	IPTTLDEC	1
+
+#define	IP_MSS		576
+
+#define __UAPI_DEF_IPHDR	0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/netinet/ip6.h b/musl-include/i386/netinet/ip6.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/ip6.h
@@ -0,0 +1,141 @@
+#ifndef _NETINET_IP6_H
+#define _NETINET_IP6_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct ip6_hdr {
+	union {
+		struct ip6_hdrctl {
+			uint32_t ip6_un1_flow;
+			uint16_t ip6_un1_plen;
+			uint8_t  ip6_un1_nxt;
+			uint8_t  ip6_un1_hlim;
+		} ip6_un1;
+		uint8_t ip6_un2_vfc;
+	} ip6_ctlun;
+	struct in6_addr ip6_src;
+	struct in6_addr ip6_dst;
+};
+
+#define ip6_vfc   ip6_ctlun.ip6_un2_vfc
+#define ip6_flow  ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen  ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt   ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim  ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops  ip6_ctlun.ip6_un1.ip6_un1_hlim
+
+struct ip6_ext {
+	uint8_t  ip6e_nxt;
+	uint8_t  ip6e_len;
+};
+
+struct ip6_hbh {
+	uint8_t  ip6h_nxt;
+	uint8_t  ip6h_len;
+};
+
+struct ip6_dest {
+	uint8_t  ip6d_nxt;
+	uint8_t  ip6d_len;
+};
+
+struct ip6_rthdr {
+	uint8_t  ip6r_nxt;
+	uint8_t  ip6r_len;
+	uint8_t  ip6r_type;
+	uint8_t  ip6r_segleft;
+};
+
+struct ip6_rthdr0 {
+	uint8_t  ip6r0_nxt;
+	uint8_t  ip6r0_len;
+	uint8_t  ip6r0_type;
+	uint8_t  ip6r0_segleft;
+	uint8_t  ip6r0_reserved;
+	uint8_t  ip6r0_slmap[3];
+	struct in6_addr ip6r0_addr[];
+};
+
+struct ip6_frag {
+	uint8_t   ip6f_nxt;
+	uint8_t   ip6f_reserved;
+	uint16_t  ip6f_offlg;
+	uint32_t  ip6f_ident;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IP6F_OFF_MASK       0xfff8
+#define IP6F_RESERVED_MASK  0x0006
+#define IP6F_MORE_FRAG      0x0001
+#else
+#define IP6F_OFF_MASK       0xf8ff
+#define IP6F_RESERVED_MASK  0x0600
+#define IP6F_MORE_FRAG      0x0100
+#endif
+
+struct ip6_opt {
+	uint8_t  ip6o_type;
+	uint8_t  ip6o_len;
+};
+
+#define IP6OPT_TYPE(o)		((o) & 0xc0)
+#define IP6OPT_TYPE_SKIP	0x00
+#define IP6OPT_TYPE_DISCARD	0x40
+#define IP6OPT_TYPE_FORCEICMP	0x80
+#define IP6OPT_TYPE_ICMP	0xc0
+#define IP6OPT_TYPE_MUTABLE	0x20
+
+#define IP6OPT_PAD1	0
+#define IP6OPT_PADN	1
+
+#define IP6OPT_JUMBO		0xc2
+#define IP6OPT_NSAP_ADDR	0xc3
+#define IP6OPT_TUNNEL_LIMIT	0x04
+#define IP6OPT_ROUTER_ALERT	0x05
+
+struct ip6_opt_jumbo {
+	uint8_t  ip6oj_type;
+	uint8_t  ip6oj_len;
+	uint8_t  ip6oj_jumbo_len[4];
+};
+#define IP6OPT_JUMBO_LEN	6
+
+struct ip6_opt_nsap {
+	uint8_t  ip6on_type;
+	uint8_t  ip6on_len;
+	uint8_t  ip6on_src_nsap_len;
+	uint8_t  ip6on_dst_nsap_len;
+};
+
+struct ip6_opt_tunnel {
+	uint8_t  ip6ot_type;
+	uint8_t  ip6ot_len;
+	uint8_t  ip6ot_encap_limit;
+};
+
+struct ip6_opt_router {
+	uint8_t  ip6or_type;
+	uint8_t  ip6or_len;
+	uint8_t  ip6or_value[2];
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0001
+#define IP6_ALERT_AN	0x0002
+#else
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0100
+#define IP6_ALERT_AN	0x0200
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/netinet/ip_icmp.h b/musl-include/i386/netinet/ip_icmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/ip_icmp.h
@@ -0,0 +1,193 @@
+#ifndef _NETINET_IP_ICMP_H
+#define _NETINET_IP_ICMP_H
+
+#include <stdint.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct icmphdr {
+	uint8_t type;
+	uint8_t code;
+	uint16_t checksum;
+	union {
+		struct {
+			uint16_t id;
+			uint16_t sequence;
+		} echo;
+		uint32_t gateway;
+		struct {
+			uint16_t __unused;
+			uint16_t mtu;
+		} frag;
+		uint8_t reserved[4];
+	} un;
+};
+
+#define ICMP_ECHOREPLY		0
+#define ICMP_DEST_UNREACH	3
+#define ICMP_SOURCE_QUENCH	4
+#define ICMP_REDIRECT		5
+#define ICMP_ECHO		8
+#define ICMP_TIME_EXCEEDED	11
+#define ICMP_PARAMETERPROB	12
+#define ICMP_TIMESTAMP		13
+#define ICMP_TIMESTAMPREPLY	14
+#define ICMP_INFO_REQUEST	15
+#define ICMP_INFO_REPLY		16
+#define ICMP_ADDRESS		17
+#define ICMP_ADDRESSREPLY	18
+#define NR_ICMP_TYPES		18
+
+
+#define ICMP_NET_UNREACH	0
+#define ICMP_HOST_UNREACH	1
+#define ICMP_PROT_UNREACH	2
+#define ICMP_PORT_UNREACH	3
+#define ICMP_FRAG_NEEDED	4
+#define ICMP_SR_FAILED		5
+#define ICMP_NET_UNKNOWN	6
+#define ICMP_HOST_UNKNOWN	7
+#define ICMP_HOST_ISOLATED	8
+#define ICMP_NET_ANO		9
+#define ICMP_HOST_ANO		10
+#define ICMP_NET_UNR_TOS	11
+#define ICMP_HOST_UNR_TOS	12
+#define ICMP_PKT_FILTERED	13
+#define ICMP_PREC_VIOLATION	14
+#define ICMP_PREC_CUTOFF	15
+#define NR_ICMP_UNREACH		15
+
+#define ICMP_REDIR_NET		0
+#define ICMP_REDIR_HOST		1
+#define ICMP_REDIR_NETTOS	2
+#define ICMP_REDIR_HOSTTOS	3
+
+#define ICMP_EXC_TTL		0
+#define ICMP_EXC_FRAGTIME	1
+
+
+struct icmp_ra_addr {
+	uint32_t ira_addr;
+	uint32_t ira_preference;
+};
+
+struct icmp {
+	uint8_t  icmp_type;
+	uint8_t  icmp_code;
+	uint16_t icmp_cksum;
+	union {
+		uint8_t ih_pptr;
+		struct in_addr ih_gwaddr;
+		struct ih_idseq {
+			uint16_t icd_id;
+			uint16_t icd_seq;
+		} ih_idseq;
+		uint32_t ih_void;
+
+		struct ih_pmtu {
+			uint16_t ipm_void;
+			uint16_t ipm_nextmtu;
+		} ih_pmtu;
+
+		struct ih_rtradv {
+			uint8_t irt_num_addrs;
+			uint8_t irt_wpa;
+			uint16_t irt_lifetime;
+		} ih_rtradv;
+	} icmp_hun;
+	union {
+		struct {
+			uint32_t its_otime;
+			uint32_t its_rtime;
+			uint32_t its_ttime;
+		} id_ts;
+		struct {
+			struct ip idi_ip;
+		} id_ip;
+		struct icmp_ra_addr id_radv;
+		uint32_t   id_mask;
+		uint8_t    id_data[1];
+	} icmp_dun;
+};
+
+#define	icmp_pptr	icmp_hun.ih_pptr
+#define	icmp_gwaddr	icmp_hun.ih_gwaddr
+#define	icmp_id		icmp_hun.ih_idseq.icd_id
+#define	icmp_seq	icmp_hun.ih_idseq.icd_seq
+#define	icmp_void	icmp_hun.ih_void
+#define	icmp_pmvoid	icmp_hun.ih_pmtu.ipm_void
+#define	icmp_nextmtu	icmp_hun.ih_pmtu.ipm_nextmtu
+#define	icmp_num_addrs	icmp_hun.ih_rtradv.irt_num_addrs
+#define	icmp_wpa	icmp_hun.ih_rtradv.irt_wpa
+#define	icmp_lifetime	icmp_hun.ih_rtradv.irt_lifetime
+#define	icmp_otime	icmp_dun.id_ts.its_otime
+#define	icmp_rtime	icmp_dun.id_ts.its_rtime
+#define	icmp_ttime	icmp_dun.id_ts.its_ttime
+#define	icmp_ip		icmp_dun.id_ip.idi_ip
+#define	icmp_radv	icmp_dun.id_radv
+#define	icmp_mask	icmp_dun.id_mask
+#define	icmp_data	icmp_dun.id_data
+
+#define	ICMP_MINLEN	8
+#define	ICMP_TSLEN	(8 + 3 * sizeof (n_time))
+#define	ICMP_MASKLEN	12
+#define	ICMP_ADVLENMIN	(8 + sizeof (struct ip) + 8)
+#define	ICMP_ADVLEN(p)	(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+
+#define	ICMP_UNREACH		3
+#define	ICMP_SOURCEQUENCH	4
+#define	ICMP_ROUTERADVERT	9
+#define	ICMP_ROUTERSOLICIT	10
+#define	ICMP_TIMXCEED		11
+#define	ICMP_PARAMPROB		12
+#define	ICMP_TSTAMP		13
+#define	ICMP_TSTAMPREPLY	14
+#define	ICMP_IREQ		15
+#define	ICMP_IREQREPLY		16
+#define	ICMP_MASKREQ		17
+#define	ICMP_MASKREPLY		18
+#define	ICMP_MAXTYPE		18
+
+#define	ICMP_UNREACH_NET	        0
+#define	ICMP_UNREACH_HOST	        1
+#define	ICMP_UNREACH_PROTOCOL	        2
+#define	ICMP_UNREACH_PORT	        3
+#define	ICMP_UNREACH_NEEDFRAG	        4
+#define	ICMP_UNREACH_SRCFAIL	        5
+#define	ICMP_UNREACH_NET_UNKNOWN        6
+#define	ICMP_UNREACH_HOST_UNKNOWN       7
+#define	ICMP_UNREACH_ISOLATED	        8
+#define	ICMP_UNREACH_NET_PROHIB	        9
+#define	ICMP_UNREACH_HOST_PROHIB        10
+#define	ICMP_UNREACH_TOSNET	        11
+#define	ICMP_UNREACH_TOSHOST	        12
+#define	ICMP_UNREACH_FILTER_PROHIB      13
+#define	ICMP_UNREACH_HOST_PRECEDENCE    14
+#define	ICMP_UNREACH_PRECEDENCE_CUTOFF  15
+
+#define	ICMP_REDIRECT_NET	0
+#define	ICMP_REDIRECT_HOST	1
+#define	ICMP_REDIRECT_TOSNET	2
+#define	ICMP_REDIRECT_TOSHOST	3
+
+#define	ICMP_TIMXCEED_INTRANS	0
+#define	ICMP_TIMXCEED_REASS	1
+
+#define	ICMP_PARAMPROB_OPTABSENT 1
+
+#define	ICMP_INFOTYPE(type) \
+	((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+	(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+	(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+	(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+	(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/netinet/tcp.h b/musl-include/i386/netinet/tcp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/tcp.h
@@ -0,0 +1,305 @@
+#ifndef _NETINET_TCP_H
+#define _NETINET_TCP_H
+
+#include <features.h>
+
+#define TCP_NODELAY 1
+#define TCP_MAXSEG	 2
+#define TCP_CORK	 3
+#define TCP_KEEPIDLE	 4
+#define TCP_KEEPINTVL	 5
+#define TCP_KEEPCNT	 6
+#define TCP_SYNCNT	 7
+#define TCP_LINGER2	 8
+#define TCP_DEFER_ACCEPT 9
+#define TCP_WINDOW_CLAMP 10
+#define TCP_INFO	 11
+#define	TCP_QUICKACK	 12
+#define TCP_CONGESTION	 13
+#define TCP_MD5SIG	 14
+#define TCP_THIN_LINEAR_TIMEOUTS 16
+#define TCP_THIN_DUPACK  17
+#define TCP_USER_TIMEOUT 18
+#define TCP_REPAIR       19
+#define TCP_REPAIR_QUEUE 20
+#define TCP_QUEUE_SEQ    21
+#define TCP_REPAIR_OPTIONS 22
+#define TCP_FASTOPEN     23
+#define TCP_TIMESTAMP    24
+#define TCP_NOTSENT_LOWAT 25
+#define TCP_CC_INFO      26
+#define TCP_SAVE_SYN     27
+#define TCP_SAVED_SYN    28
+#define TCP_REPAIR_WINDOW 29
+#define TCP_FASTOPEN_CONNECT 30
+#define TCP_ULP          31
+#define TCP_MD5SIG_EXT   32
+#define TCP_FASTOPEN_KEY 33
+#define TCP_FASTOPEN_NO_COOKIE 34
+#define TCP_ZEROCOPY_RECEIVE   35
+#define TCP_INQ          36
+#define TCP_TX_DELAY     37
+
+#define TCP_CM_INQ TCP_INQ
+
+#define TCP_ESTABLISHED  1
+#define TCP_SYN_SENT     2
+#define TCP_SYN_RECV     3
+#define TCP_FIN_WAIT1    4
+#define TCP_FIN_WAIT2    5
+#define TCP_TIME_WAIT    6
+#define TCP_CLOSE        7
+#define TCP_CLOSE_WAIT   8
+#define TCP_LAST_ACK     9
+#define TCP_LISTEN       10
+#define TCP_CLOSING      11
+
+enum {
+	TCP_NLA_PAD,
+	TCP_NLA_BUSY,
+	TCP_NLA_RWND_LIMITED,
+	TCP_NLA_SNDBUF_LIMITED,
+	TCP_NLA_DATA_SEGS_OUT,
+	TCP_NLA_TOTAL_RETRANS,
+	TCP_NLA_PACING_RATE,
+	TCP_NLA_DELIVERY_RATE,
+	TCP_NLA_SND_CWND,
+	TCP_NLA_REORDERING,
+	TCP_NLA_MIN_RTT,
+	TCP_NLA_RECUR_RETRANS,
+	TCP_NLA_DELIVERY_RATE_APP_LMT,
+	TCP_NLA_SNDQ_SIZE,
+	TCP_NLA_CA_STATE,
+	TCP_NLA_SND_SSTHRESH,
+	TCP_NLA_DELIVERED,
+	TCP_NLA_DELIVERED_CE,
+	TCP_NLA_BYTES_SENT,
+	TCP_NLA_BYTES_RETRANS,
+	TCP_NLA_DSACK_DUPS,
+	TCP_NLA_REORD_SEEN,
+	TCP_NLA_SRTT,
+	TCP_NLA_TIMEOUT_REHASH,
+	TCP_NLA_BYTES_NOTSENT,
+	TCP_NLA_EDT,
+	TCP_NLA_TTL,
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define TCPOPT_EOL              0
+#define TCPOPT_NOP              1
+#define TCPOPT_MAXSEG           2
+#define TCPOPT_WINDOW           3
+#define TCPOPT_SACK_PERMITTED   4
+#define TCPOPT_SACK             5
+#define TCPOPT_TIMESTAMP        8
+#define TCPOLEN_SACK_PERMITTED  2
+#define TCPOLEN_WINDOW          3
+#define TCPOLEN_MAXSEG          4
+#define TCPOLEN_TIMESTAMP       10
+
+#define SOL_TCP 6
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdint.h>
+
+typedef uint32_t tcp_seq;
+
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+
+struct tcphdr {
+#ifdef _GNU_SOURCE
+#ifdef __GNUC__
+	__extension__
+#endif
+	union { struct {
+
+	uint16_t source;
+	uint16_t dest;
+	uint32_t seq;
+	uint32_t ack_seq;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	uint16_t res1:4;
+	uint16_t doff:4;
+	uint16_t fin:1;
+	uint16_t syn:1;
+	uint16_t rst:1;
+	uint16_t psh:1;
+	uint16_t ack:1;
+	uint16_t urg:1;
+	uint16_t res2:2;
+#else
+	uint16_t doff:4;
+	uint16_t res1:4;
+	uint16_t res2:2;
+	uint16_t urg:1;
+	uint16_t ack:1;
+	uint16_t psh:1;
+	uint16_t rst:1;
+	uint16_t syn:1;
+	uint16_t fin:1;
+#endif
+	uint16_t window;
+	uint16_t check;
+	uint16_t urg_ptr;
+
+	}; struct {
+#endif
+
+	uint16_t th_sport;
+	uint16_t th_dport;
+	uint32_t th_seq;
+	uint32_t th_ack;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	uint8_t th_x2:4;
+	uint8_t th_off:4;
+#else
+	uint8_t th_off:4;
+	uint8_t th_x2:4;
+#endif
+	uint8_t th_flags;
+	uint16_t th_win;
+	uint16_t th_sum;
+	uint16_t th_urp;
+
+#ifdef _GNU_SOURCE
+	}; };
+#endif
+};
+#endif
+
+#ifdef _GNU_SOURCE
+#define TCPI_OPT_TIMESTAMPS	1
+#define TCPI_OPT_SACK		2
+#define TCPI_OPT_WSCALE		4
+#define TCPI_OPT_ECN		8
+
+#define TCP_CA_Open		0
+#define TCP_CA_Disorder		1
+#define TCP_CA_CWR		2
+#define TCP_CA_Recovery		3
+#define TCP_CA_Loss		4
+
+enum tcp_fastopen_client_fail {
+	TFO_STATUS_UNSPEC,
+	TFO_COOKIE_UNAVAILABLE,
+	TFO_DATA_NOT_ACKED,
+	TFO_SYN_RETRANSMITTED,
+};
+
+struct tcp_info {
+	uint8_t tcpi_state;
+	uint8_t tcpi_ca_state;
+	uint8_t tcpi_retransmits;
+	uint8_t tcpi_probes;
+	uint8_t tcpi_backoff;
+	uint8_t tcpi_options;
+	uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
+	uint8_t tcpi_delivery_rate_app_limited : 1, tcpi_fastopen_client_fail : 2;
+	uint32_t tcpi_rto;
+	uint32_t tcpi_ato;
+	uint32_t tcpi_snd_mss;
+	uint32_t tcpi_rcv_mss;
+	uint32_t tcpi_unacked;
+	uint32_t tcpi_sacked;
+	uint32_t tcpi_lost;
+	uint32_t tcpi_retrans;
+	uint32_t tcpi_fackets;
+	uint32_t tcpi_last_data_sent;
+	uint32_t tcpi_last_ack_sent;
+	uint32_t tcpi_last_data_recv;
+	uint32_t tcpi_last_ack_recv;
+	uint32_t tcpi_pmtu;
+	uint32_t tcpi_rcv_ssthresh;
+	uint32_t tcpi_rtt;
+	uint32_t tcpi_rttvar;
+	uint32_t tcpi_snd_ssthresh;
+	uint32_t tcpi_snd_cwnd;
+	uint32_t tcpi_advmss;
+	uint32_t tcpi_reordering;
+	uint32_t tcpi_rcv_rtt;
+	uint32_t tcpi_rcv_space;
+	uint32_t tcpi_total_retrans;
+	uint64_t tcpi_pacing_rate;
+	uint64_t tcpi_max_pacing_rate;
+	uint64_t tcpi_bytes_acked;
+	uint64_t tcpi_bytes_received;
+	uint32_t tcpi_segs_out;
+	uint32_t tcpi_segs_in;
+	uint32_t tcpi_notsent_bytes;
+	uint32_t tcpi_min_rtt;
+	uint32_t tcpi_data_segs_in;
+	uint32_t tcpi_data_segs_out;
+	uint64_t tcpi_delivery_rate;
+	uint64_t tcpi_busy_time;
+	uint64_t tcpi_rwnd_limited;
+	uint64_t tcpi_sndbuf_limited;
+	uint32_t tcpi_delivered;
+	uint32_t tcpi_delivered_ce;
+	uint64_t tcpi_bytes_sent;
+	uint64_t tcpi_bytes_retrans;
+	uint32_t tcpi_dsack_dups;
+	uint32_t tcpi_reord_seen;
+	uint32_t tcpi_rcv_ooopack;
+	uint32_t tcpi_snd_wnd;
+};
+
+#define TCP_MD5SIG_MAXKEYLEN    80
+
+#define TCP_MD5SIG_FLAG_PREFIX  0x1
+#define TCP_MD5SIG_FLAG_IFINDEX 0x2
+
+struct tcp_md5sig {
+	struct sockaddr_storage tcpm_addr;
+	uint8_t tcpm_flags;
+	uint8_t tcpm_prefixlen;
+	uint16_t tcpm_keylen;
+	int tcpm_ifindex;
+	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
+};
+
+struct tcp_diag_md5sig {
+	uint8_t tcpm_family;
+	uint8_t tcpm_prefixlen;
+	uint16_t tcpm_keylen;
+	uint32_t tcpm_addr[4];
+	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
+};
+
+#define TCP_REPAIR_ON		1
+#define TCP_REPAIR_OFF		0
+#define TCP_REPAIR_OFF_NO_WP	-1
+
+struct tcp_repair_window {
+	uint32_t snd_wl1;
+	uint32_t snd_wnd;
+	uint32_t max_window;
+	uint32_t rcv_wnd;
+	uint32_t rcv_wup;
+};
+
+#define TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT 0x1
+
+struct tcp_zerocopy_receive {
+	uint64_t address;
+	uint32_t length;
+	uint32_t recv_skip_hint;
+	uint32_t inq;
+	int32_t err;
+	uint64_t copybuf_address;
+	int32_t copybuf_len;
+	uint32_t flags;
+	uint64_t msg_control;
+	uint64_t msg_controllen;
+	uint32_t msg_flags;
+	uint32_t reserved;
+};
+
+#endif
+
+#endif
diff --git a/musl-include/i386/netinet/udp.h b/musl-include/i386/netinet/udp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netinet/udp.h
@@ -0,0 +1,46 @@
+#ifndef _NETINET_UDP_H
+#define _NETINET_UDP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <stdint.h>
+
+#ifdef _GNU_SOURCE
+#define uh_sport source
+#define uh_dport dest
+#define uh_ulen len
+#define uh_sum check
+#endif
+
+struct udphdr {
+	uint16_t uh_sport;
+	uint16_t uh_dport;
+	uint16_t uh_ulen;
+	uint16_t uh_sum;
+};
+
+#define UDP_CORK	1
+#define UDP_ENCAP	100
+#define UDP_NO_CHECK6_TX 101
+#define UDP_NO_CHECK6_RX 102
+#define UDP_SEGMENT	103
+#define UDP_GRO		104
+
+#define UDP_ENCAP_ESPINUDP_NON_IKE 1
+#define UDP_ENCAP_ESPINUDP	2
+#define UDP_ENCAP_L2TPINUDP	3
+#define UDP_ENCAP_GTP0		4
+#define UDP_ENCAP_GTP1U		5
+#define UDP_ENCAP_RXRPC		6
+#define TCP_ENCAP_ESPINTCP	7
+
+#define SOL_UDP            17
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/netpacket/packet.h b/musl-include/i386/netpacket/packet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/netpacket/packet.h
@@ -0,0 +1,62 @@
+#ifndef _NETPACKET_PACKET_H
+#define _NETPACKET_PACKET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sockaddr_ll {
+	unsigned short sll_family, sll_protocol;
+	int sll_ifindex;
+	unsigned short sll_hatype;
+	unsigned char sll_pkttype, sll_halen;
+	unsigned char sll_addr[8];
+};
+
+struct packet_mreq {
+	int mr_ifindex;
+	unsigned short int mr_type,  mr_alen;
+	unsigned char mr_address[8];
+};
+
+#define PACKET_HOST		0
+#define PACKET_BROADCAST	1
+#define PACKET_MULTICAST	2
+#define PACKET_OTHERHOST	3
+#define PACKET_OUTGOING		4
+#define PACKET_LOOPBACK		5
+#define PACKET_FASTROUTE	6
+
+#define PACKET_ADD_MEMBERSHIP		1
+#define PACKET_DROP_MEMBERSHIP		2
+#define	PACKET_RECV_OUTPUT		3
+#define	PACKET_RX_RING			5
+#define	PACKET_STATISTICS		6
+#define PACKET_COPY_THRESH		7
+#define PACKET_AUXDATA			8
+#define PACKET_ORIGDEV			9
+#define PACKET_VERSION			10
+#define PACKET_HDRLEN			11
+#define PACKET_RESERVE			12
+#define PACKET_TX_RING			13
+#define PACKET_LOSS			14
+#define PACKET_VNET_HDR			15
+#define PACKET_TX_TIMESTAMP		16
+#define PACKET_TIMESTAMP		17
+#define PACKET_FANOUT			18
+#define PACKET_TX_HAS_OFF		19
+#define PACKET_QDISC_BYPASS		20
+#define PACKET_ROLLOVER_STATS		21
+#define PACKET_FANOUT_DATA		22
+#define PACKET_IGNORE_OUTGOING		23
+
+#define PACKET_MR_MULTICAST	0
+#define PACKET_MR_PROMISC	1
+#define PACKET_MR_ALLMULTI	2
+#define PACKET_MR_UNICAST	3
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/nl_types.h b/musl-include/i386/nl_types.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/nl_types.h
@@ -0,0 +1,22 @@
+#ifndef _NL_TYPES_H
+#define _NL_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NL_SETD 1
+#define NL_CAT_LOCALE 1
+
+typedef int nl_item;
+typedef void *nl_catd;
+
+nl_catd catopen (const char *, int);
+char *catgets (nl_catd, int, int, const char *);
+int catclose (nl_catd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/paths.h b/musl-include/i386/paths.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/paths.h
@@ -0,0 +1,31 @@
+#ifndef _PATHS_H
+#define _PATHS_H
+
+#define	_PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin"
+#define	_PATH_STDPATH "/bin:/usr/bin:/sbin:/usr/sbin"
+
+#define	_PATH_BSHELL	"/bin/sh"
+#define	_PATH_CONSOLE	"/dev/console"
+#define	_PATH_DEVNULL	"/dev/null"
+#define	_PATH_KLOG	"/proc/kmsg"
+#define	_PATH_LASTLOG	"/var/log/lastlog"
+#define	_PATH_MAILDIR	"/var/mail"
+#define	_PATH_MAN	"/usr/share/man"
+#define	_PATH_MNTTAB	"/etc/fstab"
+#define	_PATH_MOUNTED	"/etc/mtab"
+#define	_PATH_NOLOGIN	"/etc/nologin"
+#define	_PATH_SENDMAIL	"/usr/sbin/sendmail"
+#define	_PATH_SHADOW	"/etc/shadow"
+#define	_PATH_SHELLS	"/etc/shells"
+#define	_PATH_TTY	"/dev/tty"
+#define _PATH_UTMP	"/dev/null/utmp"
+#define	_PATH_VI	"/usr/bin/vi"
+#define _PATH_WTMP	"/dev/null/wtmp"
+
+#define	_PATH_DEV	"/dev/"
+#define	_PATH_TMP	"/tmp/"
+#define	_PATH_VARDB	"/var/lib/misc/"
+#define	_PATH_VARRUN	"/var/run/"
+#define	_PATH_VARTMP	"/var/tmp/"
+
+#endif
diff --git a/musl-include/i386/poll.h b/musl-include/i386/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/poll.h
@@ -0,0 +1,57 @@
+#ifndef	_POLL_H
+#define	_POLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/poll.h>
+
+#define POLLIN     0x001
+#define POLLPRI    0x002
+#define POLLOUT    0x004
+#define POLLERR    0x008
+#define POLLHUP    0x010
+#define POLLNVAL   0x020
+#define POLLRDNORM 0x040
+#define POLLRDBAND 0x080
+#ifndef POLLWRNORM
+#define POLLWRNORM 0x100
+#define POLLWRBAND 0x200
+#endif
+#ifndef POLLMSG
+#define POLLMSG    0x400
+#define POLLRDHUP  0x2000
+#endif
+
+typedef unsigned long nfds_t;
+
+struct pollfd {
+	int fd;
+	short events;
+	short revents;
+};
+
+int poll (struct pollfd *, nfds_t, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+#include <bits/alltypes.h>
+int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *);
+#endif
+
+#if _REDIR_TIME64
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(ppoll, __ppoll_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/pthread.h b/musl-include/i386/pthread.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/pthread.h
@@ -0,0 +1,244 @@
+#ifndef _PTHREAD_H
+#define _PTHREAD_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_clockid_t
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_pthread_mutexattr_t
+#define __NEED_pthread_condattr_t
+#define __NEED_pthread_rwlockattr_t
+#define __NEED_pthread_barrierattr_t
+#define __NEED_pthread_mutex_t
+#define __NEED_pthread_cond_t
+#define __NEED_pthread_rwlock_t
+#define __NEED_pthread_barrier_t
+#define __NEED_pthread_spinlock_t
+#define __NEED_pthread_key_t
+#define __NEED_pthread_once_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#include <sched.h>
+#include <time.h>
+
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 1
+
+#define PTHREAD_MUTEX_NORMAL 0
+#define PTHREAD_MUTEX_DEFAULT 0
+#define PTHREAD_MUTEX_RECURSIVE 1
+#define PTHREAD_MUTEX_ERRORCHECK 2
+
+#define PTHREAD_MUTEX_STALLED 0
+#define PTHREAD_MUTEX_ROBUST 1
+
+#define PTHREAD_PRIO_NONE 0
+#define PTHREAD_PRIO_INHERIT 1
+#define PTHREAD_PRIO_PROTECT 2
+
+#define PTHREAD_INHERIT_SCHED 0
+#define PTHREAD_EXPLICIT_SCHED 1
+
+#define PTHREAD_SCOPE_SYSTEM 0
+#define PTHREAD_SCOPE_PROCESS 1
+
+#define PTHREAD_PROCESS_PRIVATE 0
+#define PTHREAD_PROCESS_SHARED 1
+
+
+#define PTHREAD_MUTEX_INITIALIZER {{{0}}}
+#define PTHREAD_RWLOCK_INITIALIZER {{{0}}}
+#define PTHREAD_COND_INITIALIZER {{{0}}}
+#define PTHREAD_ONCE_INIT 0
+
+
+#define PTHREAD_CANCEL_ENABLE 0
+#define PTHREAD_CANCEL_DISABLE 1
+#define PTHREAD_CANCEL_MASKED 2
+
+#define PTHREAD_CANCEL_DEFERRED 0
+#define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+#define PTHREAD_CANCELED ((void *)-1)
+
+
+#define PTHREAD_BARRIER_SERIAL_THREAD (-1)
+
+
+#define PTHREAD_NULL ((pthread_t)0)
+
+
+int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
+int pthread_detach(pthread_t);
+_Noreturn void pthread_exit(void *);
+int pthread_join(pthread_t, void **);
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+pthread_t pthread_self(void);
+
+int pthread_equal(pthread_t, pthread_t);
+#ifndef __cplusplus
+#define pthread_equal(x,y) ((x)==(y))
+#endif
+
+int pthread_setcancelstate(int, int *);
+int pthread_setcanceltype(int, int *);
+void pthread_testcancel(void);
+int pthread_cancel(pthread_t);
+
+int pthread_getschedparam(pthread_t, int *__restrict, struct sched_param *__restrict);
+int pthread_setschedparam(pthread_t, int, const struct sched_param *);
+int pthread_setschedprio(pthread_t, int);
+
+int pthread_once(pthread_once_t *, void (*)(void));
+
+int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict);
+int pthread_mutex_lock(pthread_mutex_t *);
+int pthread_mutex_unlock(pthread_mutex_t *);
+int pthread_mutex_trylock(pthread_mutex_t *);
+int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_mutex_destroy(pthread_mutex_t *);
+int pthread_mutex_consistent(pthread_mutex_t *);
+
+int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *__restrict);
+int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict, int, int *__restrict);
+
+int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict);
+int pthread_cond_destroy(pthread_cond_t *);
+int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
+int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_cond_broadcast(pthread_cond_t *);
+int pthread_cond_signal(pthread_cond_t *);
+
+int pthread_rwlock_init(pthread_rwlock_t *__restrict, const pthread_rwlockattr_t *__restrict);
+int pthread_rwlock_destroy(pthread_rwlock_t *);
+int pthread_rwlock_rdlock(pthread_rwlock_t *);
+int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+int pthread_rwlock_wrlock(pthread_rwlock_t *);
+int pthread_rwlock_trywrlock(pthread_rwlock_t *);
+int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+int pthread_rwlock_unlock(pthread_rwlock_t *);
+
+int pthread_spin_init(pthread_spinlock_t *, int);
+int pthread_spin_destroy(pthread_spinlock_t *);
+int pthread_spin_lock(pthread_spinlock_t *);
+int pthread_spin_trylock(pthread_spinlock_t *);
+int pthread_spin_unlock(pthread_spinlock_t *);
+
+int pthread_barrier_init(pthread_barrier_t *__restrict, const pthread_barrierattr_t *__restrict, unsigned);
+int pthread_barrier_destroy(pthread_barrier_t *);
+int pthread_barrier_wait(pthread_barrier_t *);
+
+int pthread_key_create(pthread_key_t *, void (*)(void *));
+int pthread_key_delete(pthread_key_t);
+void *pthread_getspecific(pthread_key_t);
+int pthread_setspecific(pthread_key_t, const void *);
+
+int pthread_attr_init(pthread_attr_t *);
+int pthread_attr_destroy(pthread_attr_t *);
+
+int pthread_attr_getguardsize(const pthread_attr_t *__restrict, size_t *__restrict);
+int pthread_attr_setguardsize(pthread_attr_t *, size_t);
+int pthread_attr_getstacksize(const pthread_attr_t *__restrict, size_t *__restrict);
+int pthread_attr_setstacksize(pthread_attr_t *, size_t);
+int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
+int pthread_attr_setdetachstate(pthread_attr_t *, int);
+int pthread_attr_getstack(const pthread_attr_t *__restrict, void **__restrict, size_t *__restrict);
+int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
+int pthread_attr_getscope(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setscope(pthread_attr_t *, int);
+int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setschedpolicy(pthread_attr_t *, int);
+int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict);
+int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict);
+int pthread_attr_getinheritsched(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setinheritsched(pthread_attr_t *, int);
+
+int pthread_mutexattr_destroy(pthread_mutexattr_t *);
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_init(pthread_mutexattr_t *);
+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
+int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
+
+int pthread_condattr_init(pthread_condattr_t *);
+int pthread_condattr_destroy(pthread_condattr_t *);
+int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
+int pthread_condattr_setpshared(pthread_condattr_t *, int);
+int pthread_condattr_getclock(const pthread_condattr_t *__restrict, clockid_t *__restrict);
+int pthread_condattr_getpshared(const pthread_condattr_t *__restrict, int *__restrict);
+
+int pthread_rwlockattr_init(pthread_rwlockattr_t *);
+int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
+int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
+int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *__restrict, int *__restrict);
+
+int pthread_barrierattr_destroy(pthread_barrierattr_t *);
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t *__restrict, int *__restrict);
+int pthread_barrierattr_init(pthread_barrierattr_t *);
+int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
+
+int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
+
+int pthread_getconcurrency(void);
+int pthread_setconcurrency(int);
+
+int pthread_getcpuclockid(pthread_t, clockid_t *);
+
+struct __ptcb {
+	void (*__f)(void *);
+	void *__x;
+	struct __ptcb *__next;
+};
+
+void _pthread_cleanup_push(struct __ptcb *, void (*)(void *), void *);
+void _pthread_cleanup_pop(struct __ptcb *, int);
+
+#define pthread_cleanup_push(f, x) do { struct __ptcb __cb; _pthread_cleanup_push(&__cb, f, x);
+#define pthread_cleanup_pop(r) _pthread_cleanup_pop(&__cb, (r)); } while(0)
+
+#ifdef _GNU_SOURCE
+struct cpu_set_t;
+int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *);
+int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *);
+int pthread_getattr_np(pthread_t, pthread_attr_t *);
+int pthread_setname_np(pthread_t, const char *);
+int pthread_getname_np(pthread_t, char *, size_t);
+int pthread_getattr_default_np(pthread_attr_t *);
+int pthread_setattr_default_np(const pthread_attr_t *);
+int pthread_tryjoin_np(pthread_t, void **);
+int pthread_timedjoin_np(pthread_t, void **, const struct timespec *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(pthread_mutex_timedlock, __pthread_mutex_timedlock_time64);
+__REDIR(pthread_cond_timedwait, __pthread_cond_timedwait_time64);
+__REDIR(pthread_rwlock_timedrdlock, __pthread_rwlock_timedrdlock_time64);
+__REDIR(pthread_rwlock_timedwrlock, __pthread_rwlock_timedwrlock_time64);
+#ifdef _GNU_SOURCE
+__REDIR(pthread_timedjoin_np, __pthread_timedjoin_np_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/pty.h b/musl-include/i386/pty.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/pty.h
@@ -0,0 +1,18 @@
+#ifndef	_PTY_H
+#define	_PTY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <termios.h>
+#include <sys/ioctl.h>
+
+int openpty(int *, int *, char *, const struct termios *, const struct winsize *);
+int forkpty(int *, char *, const struct termios *, const struct winsize *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/pwd.h b/musl-include/i386/pwd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/pwd.h
@@ -0,0 +1,50 @@
+#ifndef _PWD_H
+#define _PWD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_FILE
+#endif
+
+#include <bits/alltypes.h>
+
+struct passwd {
+	char *pw_name;
+	char *pw_passwd;
+	uid_t pw_uid;
+	gid_t pw_gid;
+	char *pw_gecos;
+	char *pw_dir;
+	char *pw_shell;
+};
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void setpwent (void);
+void endpwent (void);
+struct passwd *getpwent (void);
+#endif
+
+struct passwd *getpwuid (uid_t);
+struct passwd *getpwnam (const char *);
+int getpwuid_r (uid_t, struct passwd *, char *, size_t, struct passwd **);
+int getpwnam_r (const char *, struct passwd *, char *, size_t, struct passwd **);
+
+#ifdef _GNU_SOURCE
+struct passwd *fgetpwent(FILE *);
+int putpwent(const struct passwd *, FILE *);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/regex.h b/musl-include/i386/regex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/regex.h
@@ -0,0 +1,62 @@
+#ifndef _REGEX_H
+#define _REGEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_regoff_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef struct re_pattern_buffer {
+	size_t re_nsub;
+	void *__opaque, *__padding[4];
+	size_t __nsub2;
+	char __padding2;
+} regex_t;
+
+typedef struct {
+	regoff_t rm_so;
+	regoff_t rm_eo;
+} regmatch_t;
+
+#define REG_EXTENDED    1
+#define REG_ICASE       2
+#define REG_NEWLINE     4
+#define REG_NOSUB       8
+
+#define REG_NOTBOL      1
+#define REG_NOTEOL      2
+
+#define REG_OK          0
+#define REG_NOMATCH     1
+#define REG_BADPAT      2
+#define REG_ECOLLATE    3
+#define REG_ECTYPE      4
+#define REG_EESCAPE     5
+#define REG_ESUBREG     6
+#define REG_EBRACK      7
+#define REG_EPAREN      8
+#define REG_EBRACE      9
+#define REG_BADBR       10
+#define REG_ERANGE      11
+#define REG_ESPACE      12
+#define REG_BADRPT      13
+
+#define REG_ENOSYS      -1
+
+int regcomp(regex_t *__restrict, const char *__restrict, int);
+int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int);
+void regfree(regex_t *);
+
+size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/resolv.h b/musl-include/i386/resolv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/resolv.h
@@ -0,0 +1,142 @@
+#ifndef _RESOLV_H
+#define _RESOLV_H
+
+#include <stdint.h>
+#include <arpa/nameser.h>
+#include <netinet/in.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAXNS			3
+#define MAXDFLSRCH		3
+#define MAXDNSRCH		6
+#define LOCALDOMAINPARTS	2
+
+#define RES_TIMEOUT		5
+#define MAXRESOLVSORT		10
+#define RES_MAXNDOTS		15
+#define RES_MAXRETRANS		30
+#define RES_MAXRETRY		5
+#define RES_DFLRETRY		2
+#define RES_MAXTIME		65535
+
+/* unused; purely for broken apps */
+typedef struct __res_state {
+	int retrans;
+	int retry;
+	unsigned long options;
+	int nscount;
+	struct sockaddr_in nsaddr_list[MAXNS];
+# define nsaddr	nsaddr_list[0]
+	unsigned short id;
+	char *dnsrch[MAXDNSRCH+1];
+	char defdname[256];
+	unsigned long pfcode;
+	unsigned ndots:4;
+	unsigned nsort:4;
+	unsigned ipv6_unavail:1;
+	unsigned unused:23;
+	struct {
+		struct in_addr addr;
+		uint32_t mask;
+	} sort_list[MAXRESOLVSORT];
+	void *qhook;
+	void *rhook;
+	int res_h_errno;
+	int _vcsock;
+	unsigned _flags;
+	union {
+		char pad[52];
+		struct {
+			uint16_t		nscount;
+			uint16_t		nsmap[MAXNS];
+			int			nssocks[MAXNS];
+			uint16_t		nscount6;
+			uint16_t		nsinit;
+			struct sockaddr_in6	*nsaddrs[MAXNS];
+			unsigned int		_initstamp[2];
+		} _ext;
+	} _u;
+} *res_state;
+
+#define	__RES	19960801
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF        "/etc/resolv.conf"
+#endif
+
+struct res_sym {
+	int number;
+	char *name;
+	char *humanname;
+};
+
+#define	RES_F_VC	0x00000001
+#define	RES_F_CONN	0x00000002
+#define RES_F_EDNS0ERR	0x00000004
+
+#define	RES_EXHAUSTIVE	0x00000001
+
+#define RES_INIT	0x00000001
+#define RES_DEBUG	0x00000002
+#define RES_AAONLY	0x00000004
+#define RES_USEVC	0x00000008
+#define RES_PRIMARY	0x00000010
+#define RES_IGNTC	0x00000020
+#define RES_RECURSE	0x00000040
+#define RES_DEFNAMES	0x00000080
+#define RES_STAYOPEN	0x00000100
+#define RES_DNSRCH	0x00000200
+#define	RES_INSECURE1	0x00000400
+#define	RES_INSECURE2	0x00000800
+#define	RES_NOALIASES	0x00001000
+#define	RES_USE_INET6	0x00002000
+#define RES_ROTATE	0x00004000
+#define	RES_NOCHECKNAME	0x00008000
+#define	RES_KEEPTSIG	0x00010000
+#define	RES_BLAST	0x00020000
+#define RES_USEBSTRING	0x00040000
+#define RES_NOIP6DOTINT	0x00080000
+#define RES_USE_EDNS0	0x00100000
+#define RES_SNGLKUP	0x00200000
+#define RES_SNGLKUPREOP	0x00400000
+#define RES_USE_DNSSEC	0x00800000
+
+#define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
+
+#define RES_PRF_STATS	0x00000001
+#define RES_PRF_UPDATE	0x00000002
+#define RES_PRF_CLASS   0x00000004
+#define RES_PRF_CMD	0x00000008
+#define RES_PRF_QUES	0x00000010
+#define RES_PRF_ANS	0x00000020
+#define RES_PRF_AUTH	0x00000040
+#define RES_PRF_ADD	0x00000080
+#define RES_PRF_HEAD1	0x00000100
+#define RES_PRF_HEAD2	0x00000200
+#define RES_PRF_TTLID	0x00000400
+#define RES_PRF_HEADX	0x00000800
+#define RES_PRF_QUERY	0x00001000
+#define RES_PRF_REPLY	0x00002000
+#define RES_PRF_INIT	0x00004000
+
+struct __res_state *__res_state(void);
+#define _res (*__res_state())
+
+int res_init(void);
+int res_query(const char *, int, int, unsigned char *, int);
+int res_querydomain(const char *, const char *, int, int, unsigned char *, int);
+int res_search(const char *, int, int, unsigned char *, int);
+int res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
+int res_send(const unsigned char *, int, unsigned char *, int);
+int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **);
+int dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
+int dn_skipname(const unsigned char *, const unsigned char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sched.h b/musl-include/i386/sched.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sched.h
@@ -0,0 +1,148 @@
+#ifndef _SCHED_H
+#define _SCHED_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_struct_timespec
+#define __NEED_pid_t
+#define __NEED_time_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+struct sched_param {
+	int sched_priority;
+	int __reserved1;
+#if _REDIR_TIME64
+	long __reserved2[4];
+#else
+	struct {
+		time_t __reserved1;
+		long __reserved2;
+	} __reserved2[2];
+#endif
+	int __reserved3;
+};
+
+int    sched_get_priority_max(int);
+int    sched_get_priority_min(int);
+int    sched_getparam(pid_t, struct sched_param *);
+int    sched_getscheduler(pid_t);
+int    sched_rr_get_interval(pid_t, struct timespec *);
+int    sched_setparam(pid_t, const struct sched_param *);
+int    sched_setscheduler(pid_t, int, const struct sched_param *);
+int     sched_yield(void);
+
+#define SCHED_OTHER 0
+#define SCHED_FIFO 1
+#define SCHED_RR 2
+#define SCHED_BATCH 3
+#define SCHED_IDLE 5
+#define SCHED_DEADLINE 6
+#define SCHED_RESET_ON_FORK 0x40000000
+
+#ifdef _GNU_SOURCE
+#define CSIGNAL		0x000000ff
+#define CLONE_NEWTIME	0x00000080
+#define CLONE_VM	0x00000100
+#define CLONE_FS	0x00000200
+#define CLONE_FILES	0x00000400
+#define CLONE_SIGHAND	0x00000800
+#define CLONE_PIDFD	0x00001000
+#define CLONE_PTRACE	0x00002000
+#define CLONE_VFORK	0x00004000
+#define CLONE_PARENT	0x00008000
+#define CLONE_THREAD	0x00010000
+#define CLONE_NEWNS	0x00020000
+#define CLONE_SYSVSEM	0x00040000
+#define CLONE_SETTLS	0x00080000
+#define CLONE_PARENT_SETTID	0x00100000
+#define CLONE_CHILD_CLEARTID	0x00200000
+#define CLONE_DETACHED	0x00400000
+#define CLONE_UNTRACED	0x00800000
+#define CLONE_CHILD_SETTID	0x01000000
+#define CLONE_NEWCGROUP	0x02000000
+#define CLONE_NEWUTS	0x04000000
+#define CLONE_NEWIPC	0x08000000
+#define CLONE_NEWUSER	0x10000000
+#define CLONE_NEWPID	0x20000000
+#define CLONE_NEWNET	0x40000000
+#define CLONE_IO	0x80000000
+int clone (int (*)(void *), void *, int, void *, ...);
+int unshare(int);
+int setns(int, int);
+
+void *memcpy(void *__restrict, const void *__restrict, size_t);
+int memcmp(const void *, const void *, size_t);
+void *memset (void *, int, size_t);
+void *calloc(size_t, size_t);
+void free(void *);
+
+typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t;
+int __sched_cpucount(size_t, const cpu_set_t *);
+int sched_getcpu(void);
+int sched_getaffinity(pid_t, size_t, cpu_set_t *);
+int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
+
+#define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \
+	(((unsigned long *)(set))[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) )
+
+#define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=)
+#define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &=~)
+#define CPU_ISSET_S(i, size, set) __CPU_op_S(i, size, set, &)
+
+#define __CPU_op_func_S(func, op) \
+static __inline void __CPU_##func##_S(size_t __size, cpu_set_t *__dest, \
+	const cpu_set_t *__src1, const cpu_set_t *__src2) \
+{ \
+	size_t __i; \
+	for (__i=0; __i<__size/sizeof(long); __i++) \
+		((unsigned long *)__dest)[__i] = ((unsigned long *)__src1)[__i] \
+			op ((unsigned long *)__src2)[__i] ; \
+}
+
+__CPU_op_func_S(AND, &)
+__CPU_op_func_S(OR, |)
+__CPU_op_func_S(XOR, ^)
+
+#define CPU_AND_S(a,b,c,d) __CPU_AND_S(a,b,c,d)
+#define CPU_OR_S(a,b,c,d) __CPU_OR_S(a,b,c,d)
+#define CPU_XOR_S(a,b,c,d) __CPU_XOR_S(a,b,c,d)
+
+#define CPU_COUNT_S(size,set) __sched_cpucount(size,set)
+#define CPU_ZERO_S(size,set) memset(set,0,size)
+#define CPU_EQUAL_S(size,set1,set2) (!memcmp(set1,set2,size))
+
+#define CPU_ALLOC_SIZE(n) (sizeof(long) * ( (n)/(8*sizeof(long)) \
+	+ ((n)%(8*sizeof(long)) + 8*sizeof(long)-1)/(8*sizeof(long)) ) )
+#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
+#define CPU_FREE(set) free(set)
+
+#define CPU_SETSIZE 1024
+
+#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
+#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)
+#define CPU_ISSET(i, set) CPU_ISSET_S(i,sizeof(cpu_set_t),set)
+#define CPU_AND(d,s1,s2) CPU_AND_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_OR(d,s1,s2) CPU_OR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_XOR(d,s1,s2) CPU_XOR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t),set)
+#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set)
+#define CPU_EQUAL(s1,s2) CPU_EQUAL_S(sizeof(cpu_set_t),s1,s2)
+
+#endif
+
+#if _REDIR_TIME64
+__REDIR(sched_rr_get_interval, __sched_rr_get_interval_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/scsi/scsi.h b/musl-include/i386/scsi/scsi.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/scsi/scsi.h
@@ -0,0 +1,150 @@
+#ifndef _SCSI_SCSI_H
+#define _SCSI_SCSI_H
+
+#define TEST_UNIT_READY 0x00
+#define REZERO_UNIT 0x01
+#define REQUEST_SENSE 0x03
+#define FORMAT_UNIT 0x04
+#define READ_BLOCK_LIMITS 0x05
+#define REASSIGN_BLOCKS 0x07
+#define READ_6 0x08
+#define WRITE_6 0x0a
+#define SEEK_6 0x0b
+#define READ_REVERSE 0x0f
+#define WRITE_FILEMARKS 0x10
+#define SPACE 0x11
+#define INQUIRY 0x12
+#define RECOVER_BUFFERED_DATA 0x14
+#define MODE_SELECT 0x15
+#define RESERVE 0x16
+#define RELEASE 0x17
+#define COPY 0x18
+#define ERASE 0x19
+#define MODE_SENSE 0x1a
+#define START_STOP 0x1b
+#define RECEIVE_DIAGNOSTIC 0x1c
+#define SEND_DIAGNOSTIC 0x1d
+#define ALLOW_MEDIUM_REMOVAL 0x1e
+#define SET_WINDOW 0x24
+#define READ_CAPACITY 0x25
+#define READ_10 0x28
+#define WRITE_10 0x2a
+#define SEEK_10 0x2b
+#define WRITE_VERIFY 0x2e
+#define VERIFY 0x2f
+#define SEARCH_HIGH 0x30
+#define SEARCH_EQUAL 0x31
+#define SEARCH_LOW 0x32
+#define SET_LIMITS 0x33
+#define PRE_FETCH 0x34
+#define READ_POSITION 0x34
+#define SYNCHRONIZE_CACHE 0x35
+#define LOCK_UNLOCK_CACHE 0x36
+#define READ_DEFECT_DATA 0x37
+#define MEDIUM_SCAN 0x38
+#define COMPARE 0x39
+#define COPY_VERIFY 0x3a
+#define WRITE_BUFFER 0x3b
+#define READ_BUFFER 0x3c
+#define UPDATE_BLOCK 0x3d
+#define READ_LONG 0x3e
+#define WRITE_LONG 0x3f
+#define CHANGE_DEFINITION 0x40
+#define WRITE_SAME 0x41
+#define READ_TOC 0x43
+#define LOG_SELECT 0x4c
+#define LOG_SENSE 0x4d
+#define MODE_SELECT_10 0x55
+#define RESERVE_10 0x56
+#define RELEASE_10 0x57
+#define MODE_SENSE_10 0x5a
+#define PERSISTENT_RESERVE_IN 0x5e
+#define PERSISTENT_RESERVE_OUT 0x5f
+#define MOVE_MEDIUM 0xa5
+#define READ_12 0xa8
+#define WRITE_12 0xaa
+#define WRITE_VERIFY_12 0xae
+#define SEARCH_HIGH_12 0xb0
+#define SEARCH_EQUAL_12 0xb1
+#define SEARCH_LOW_12 0xb2
+#define READ_ELEMENT_STATUS 0xb8
+#define SEND_VOLUME_TAG 0xb6
+#define WRITE_LONG_2 0xea
+#define GOOD 0x00
+#define CHECK_CONDITION 0x01
+#define CONDITION_GOOD 0x02
+#define BUSY 0x04
+#define INTERMEDIATE_GOOD 0x08
+#define INTERMEDIATE_C_GOOD 0x0a
+#define RESERVATION_CONFLICT 0x0c
+#define COMMAND_TERMINATED 0x11
+#define QUEUE_FULL 0x14
+#define STATUS_MASK 0x3e
+#define NO_SENSE 0x00
+#define RECOVERED_ERROR 0x01
+#define NOT_READY 0x02
+#define MEDIUM_ERROR 0x03
+#define HARDWARE_ERROR 0x04
+#define ILLEGAL_REQUEST 0x05
+#define UNIT_ATTENTION 0x06
+#define DATA_PROTECT 0x07
+#define BLANK_CHECK 0x08
+#define COPY_ABORTED 0x0a
+#define ABORTED_COMMAND 0x0b
+#define VOLUME_OVERFLOW 0x0d
+#define MISCOMPARE 0x0e
+#define TYPE_DISK 0x00
+#define TYPE_TAPE 0x01
+#define TYPE_PROCESSOR 0x03
+#define TYPE_WORM 0x04
+#define TYPE_ROM 0x05
+#define TYPE_SCANNER 0x06
+#define TYPE_MOD 0x07
+#define TYPE_MEDIUM_CHANGER 0x08
+#define TYPE_ENCLOSURE 0x0d
+#define TYPE_NO_LUN 0x7f
+#define COMMAND_COMPLETE 0x00
+#define EXTENDED_MESSAGE 0x01
+#define EXTENDED_MODIFY_DATA_POINTER 0x00
+#define EXTENDED_SDTR 0x01
+#define EXTENDED_EXTENDED_IDENTIFY 0x02
+#define EXTENDED_WDTR 0x03
+#define SAVE_POINTERS 0x02
+#define RESTORE_POINTERS 0x03
+#define DISCONNECT 0x04
+#define INITIATOR_ERROR 0x05
+#define ABORT 0x06
+#define MESSAGE_REJECT 0x07
+#define NOP 0x08
+#define MSG_PARITY_ERROR 0x09
+#define LINKED_CMD_COMPLETE 0x0a
+#define LINKED_FLG_CMD_COMPLETE 0x0b
+#define BUS_DEVICE_RESET 0x0c
+#define INITIATE_RECOVERY 0x0f
+#define RELEASE_RECOVERY 0x10
+#define SIMPLE_QUEUE_TAG 0x20
+#define HEAD_OF_QUEUE_TAG 0x21
+#define ORDERED_QUEUE_TAG 0x22
+#define SCSI_IOCTL_GET_IDLUN 0x5382
+#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
+#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
+#define SCSI_IOCTL_PROBE_HOST 0x5385
+#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
+
+struct ccs_modesel_head {
+	unsigned char _r1;
+	unsigned char medium;
+	unsigned char _r2;
+	unsigned char block_desc_length;
+	unsigned char density;
+	unsigned char number_blocks_hi;
+	unsigned char number_blocks_med;
+	unsigned char number_blocks_lo;
+	unsigned char _r3;
+	unsigned char block_length_hi;
+	unsigned char block_length_med;
+	unsigned char block_length_lo;
+};
+
+#endif
+
diff --git a/musl-include/i386/scsi/scsi_ioctl.h b/musl-include/i386/scsi/scsi_ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/scsi/scsi_ioctl.h
@@ -0,0 +1,11 @@
+#ifndef _SCSI_IOCTL_H
+#define _SCSI_IOCTL_H
+#define SCSI_IOCTL_SEND_COMMAND 1
+#define SCSI_IOCTL_TEST_UNIT_READY 2
+#define SCSI_IOCTL_BENCHMARK_COMMAND 3
+#define SCSI_IOCTL_SYNC 4
+#define SCSI_IOCTL_START_UNIT 5
+#define SCSI_IOCTL_STOP_UNIT 6
+#define SCSI_IOCTL_DOORLOCK 0x5380
+#define SCSI_IOCTL_DOORUNLOCK 0x5381
+#endif
diff --git a/musl-include/i386/scsi/sg.h b/musl-include/i386/scsi/sg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/scsi/sg.h
@@ -0,0 +1,129 @@
+#ifndef _SCSI_SG_H
+#define _SCSI_SG_H
+
+#define SG_DXFER_NONE -1
+#define SG_DXFER_TO_DEV -2
+#define SG_DXFER_FROM_DEV -3
+#define SG_DXFER_TO_FROM_DEV -4
+#define SG_FLAG_DIRECT_IO 1
+#define SG_FLAG_LUN_INHIBIT 2
+#define SG_FLAG_NO_DXFER 0x10000
+#define SG_INFO_OK_MASK 0x1
+#define SG_INFO_OK 0x0
+#define SG_INFO_CHECK 0x1
+#define SG_INFO_DIRECT_IO_MASK 0x6
+#define SG_INFO_INDIRECT_IO 0x0
+#define SG_INFO_DIRECT_IO 0x2
+#define SG_INFO_MIXED_IO 0x4
+#define SG_EMULATED_HOST 0x2203
+#define SG_SET_TRANSFORM 0x2204
+#define SG_GET_TRANSFORM 0x2205
+#define SG_SET_RESERVED_SIZE 0x2275
+#define SG_GET_RESERVED_SIZE 0x2272
+#define SG_GET_SCSI_ID 0x2276
+#define SG_SET_FORCE_LOW_DMA 0x2279
+#define SG_GET_LOW_DMA 0x227a
+#define SG_SET_FORCE_PACK_ID 0x227b
+#define SG_GET_PACK_ID 0x227c
+#define SG_GET_NUM_WAITING 0x227d
+#define SG_GET_SG_TABLESIZE 0x227F
+#define SG_GET_VERSION_NUM 0x2282
+#define SG_SCSI_RESET 0x2284
+#define SG_SCSI_RESET_NOTHING 0
+#define SG_SCSI_RESET_DEVICE 1
+#define SG_SCSI_RESET_BUS 2
+#define SG_SCSI_RESET_HOST 3
+#define SG_IO 0x2285
+#define SG_GET_REQUEST_TABLE 0x2286
+#define SG_SET_KEEP_ORPHAN 0x2287
+#define SG_GET_KEEP_ORPHAN 0x2288
+#define SG_SCATTER_SZ (8 * 4096)
+#define SG_DEFAULT_RETRIES 1
+#define SG_DEF_FORCE_LOW_DMA 0
+#define SG_DEF_FORCE_PACK_ID 0
+#define SG_DEF_KEEP_ORPHAN 0
+#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
+#define SG_MAX_QUEUE 16
+#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
+#define SG_MAX_SENSE 16
+#define SG_SET_TIMEOUT 0x2201
+#define SG_GET_TIMEOUT 0x2202
+#define SG_GET_COMMAND_Q 0x2270
+#define SG_SET_COMMAND_Q 0x2271
+#define SG_SET_DEBUG 0x227e
+#define SG_NEXT_CMD_LEN 0x2283
+#define SG_DEFAULT_TIMEOUT (60*100) /* 60*HZ */
+#define SG_DEF_COMMAND_Q 0
+#define SG_DEF_UNDERRUN_FLAG 0
+
+typedef struct sg_iovec {
+	void *iov_base;
+	unsigned long iov_len;
+} sg_iovec_t;
+
+typedef struct sg_io_hdr { 
+	int interface_id; 
+	int dxfer_direction; 
+	unsigned char cmd_len;
+	unsigned char mx_sb_len;
+	unsigned short iovec_count;
+	unsigned dxfer_len;
+	void *dxferp;
+	unsigned char *cmdp;
+	unsigned char *sbp;
+	unsigned timeout;
+	unsigned flags;
+	int pack_id;
+	void *usr_ptr;
+	unsigned char status;
+	unsigned char masked_status;
+	unsigned char msg_status;
+	unsigned char sb_len_wr;
+	unsigned short host_status;
+	unsigned short driver_status;
+	int resid; 
+	unsigned int duration;
+	unsigned int info;
+} sg_io_hdr_t;
+
+struct sg_scsi_id {
+	int host_no;
+	int channel;
+	int scsi_id;
+	int lun;
+	int scsi_type;
+	short h_cmd_per_lun;
+	short d_queue_depth;
+	int unused[2];
+};
+
+typedef struct sg_req_info {
+	char req_state;
+	char orphan;
+	char sg_io_owned;
+	char problem;
+	int pack_id;
+	void *usr_ptr;
+	unsigned duration; 
+	int unused; 
+} sg_req_info_t;
+
+typedef struct sg_io_hdr Sg_io_hdr;
+typedef struct sg_io_vec Sg_io_vec;
+typedef struct sg_scsi_id Sg_scsi_id;
+typedef struct sg_req_info Sg_req_info;
+
+struct sg_header {
+	int pack_len;
+	int reply_len;
+	int pack_id;
+	int result;
+	unsigned twelve_byte:1;
+	unsigned target_status:5;
+	unsigned host_status:8;
+	unsigned driver_status:8;
+	unsigned other_flags:10;
+	unsigned char sense_buffer[SG_MAX_SENSE];
+};
+
+#endif
diff --git a/musl-include/i386/search.h b/musl-include/i386/search.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/search.h
@@ -0,0 +1,63 @@
+#ifndef _SEARCH_H
+#define _SEARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+typedef enum { FIND, ENTER } ACTION;
+typedef enum { preorder, postorder, endorder, leaf } VISIT;
+
+typedef struct entry {
+	char *key;
+	void *data;
+} ENTRY;
+
+int hcreate(size_t);
+void hdestroy(void);
+ENTRY *hsearch(ENTRY, ACTION);
+
+#ifdef _GNU_SOURCE
+struct hsearch_data {
+	struct __tab *__tab;
+	unsigned int __unused1;
+	unsigned int __unused2;
+};
+
+int hcreate_r(size_t, struct hsearch_data *);
+void hdestroy_r(struct hsearch_data *);
+int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
+#endif
+
+void insque(void *, void *);
+void remque(void *);
+
+void *lsearch(const void *, void *, size_t *, size_t,
+	int (*)(const void *, const void *));
+void *lfind(const void *, const void *, size_t *, size_t,
+	int (*)(const void *, const void *));
+
+void *tdelete(const void *__restrict, void **__restrict, int(*)(const void *, const void *));
+void *tfind(const void *, void *const *, int(*)(const void *, const void *));
+void *tsearch(const void *, void **, int (*)(const void *, const void *));
+void twalk(const void *, void (*)(const void *, VISIT, int));
+
+#ifdef _GNU_SOURCE
+struct qelem {
+	struct qelem *q_forw, *q_back;
+	char q_data[1];
+};
+
+void tdestroy(void *, void (*)(void *));
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/semaphore.h b/musl-include/i386/semaphore.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/semaphore.h
@@ -0,0 +1,39 @@
+#ifndef _SEMAPHORE_H
+#define _SEMAPHORE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+#include <fcntl.h>
+
+#define SEM_FAILED ((sem_t *)0)
+
+typedef struct {
+	volatile int __val[4*sizeof(long)/sizeof(int)];
+} sem_t;
+
+int    sem_close(sem_t *);
+int    sem_destroy(sem_t *);
+int    sem_getvalue(sem_t *__restrict, int *__restrict);
+int    sem_init(sem_t *, int, unsigned);
+sem_t *sem_open(const char *, int, ...);
+int    sem_post(sem_t *);
+int    sem_timedwait(sem_t *__restrict, const struct timespec *__restrict);
+int    sem_trywait(sem_t *);
+int    sem_unlink(const char *);
+int    sem_wait(sem_t *);
+
+#if _REDIR_TIME64
+__REDIR(sem_timedwait, __sem_timedwait_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/setjmp.h b/musl-include/i386/setjmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/setjmp.h
@@ -0,0 +1,49 @@
+#ifndef	_SETJMP_H
+#define	_SETJMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/setjmp.h>
+
+typedef struct __jmp_buf_tag {
+	__jmp_buf __jb;
+	unsigned long __fl;
+	unsigned long __ss[128/sizeof(long)];
+} jmp_buf[1];
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
+#define __setjmp_attr __attribute__((__returns_twice__))
+#else
+#define __setjmp_attr
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+typedef jmp_buf sigjmp_buf;
+int sigsetjmp (sigjmp_buf, int) __setjmp_attr;
+_Noreturn void siglongjmp (sigjmp_buf, int);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+int _setjmp (jmp_buf) __setjmp_attr;
+_Noreturn void _longjmp (jmp_buf, int);
+#endif
+
+int setjmp (jmp_buf) __setjmp_attr;
+_Noreturn void longjmp (jmp_buf, int);
+
+#define setjmp setjmp
+
+#undef __setjmp_attr
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/shadow.h b/musl-include/i386/shadow.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/shadow.h
@@ -0,0 +1,44 @@
+#ifndef _SHADOW_H
+#define _SHADOW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	__NEED_FILE
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#define	SHADOW "/etc/shadow"
+
+struct spwd {
+	char *sp_namp;
+	char *sp_pwdp;
+	long sp_lstchg;
+	long sp_min;
+	long sp_max;
+	long sp_warn;
+	long sp_inact;
+	long sp_expire;
+	unsigned long sp_flag;
+};
+
+void setspent(void);
+void endspent(void);
+struct spwd *getspent(void);
+struct spwd *fgetspent(FILE *);
+struct spwd *sgetspent(const char *);
+int putspent(const struct spwd *, FILE *);
+
+struct spwd *getspnam(const char *);
+int getspnam_r(const char *, struct spwd *, char *, size_t, struct spwd **);
+
+int lckpwdf(void);
+int ulckpwdf(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/signal.h b/musl-include/i386/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/signal.h
@@ -0,0 +1,304 @@
+#ifndef _SIGNAL_H
+#define _SIGNAL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#ifdef _GNU_SOURCE
+#define __ucontext ucontext
+#endif
+
+#define __NEED_size_t
+#define __NEED_pid_t
+#define __NEED_uid_t
+#define __NEED_struct_timespec
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_time_t
+#define __NEED_clock_t
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define SIG_BLOCK     0
+#define SIG_UNBLOCK   1
+#define SIG_SETMASK   2
+
+#define SI_ASYNCNL (-60)
+#define SI_TKILL (-6)
+#define SI_SIGIO (-5)
+#define SI_ASYNCIO (-4)
+#define SI_MESGQ (-3)
+#define SI_TIMER (-2)
+#define SI_QUEUE (-1)
+#define SI_USER 0
+#define SI_KERNEL 128
+
+typedef struct sigaltstack stack_t;
+
+#endif
+
+#include <bits/signal.h>
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define SIG_HOLD ((void (*)(int)) 2)
+
+#define FPE_INTDIV 1
+#define FPE_INTOVF 2
+#define FPE_FLTDIV 3
+#define FPE_FLTOVF 4
+#define FPE_FLTUND 5
+#define FPE_FLTRES 6
+#define FPE_FLTINV 7
+#define FPE_FLTSUB 8
+
+#define ILL_ILLOPC 1
+#define ILL_ILLOPN 2
+#define ILL_ILLADR 3
+#define ILL_ILLTRP 4
+#define ILL_PRVOPC 5
+#define ILL_PRVREG 6
+#define ILL_COPROC 7
+#define ILL_BADSTK 8
+
+#define SEGV_MAPERR 1
+#define SEGV_ACCERR 2
+#define SEGV_BNDERR 3
+#define SEGV_PKUERR 4
+#define SEGV_MTEAERR 8
+#define SEGV_MTESERR 9
+
+#define BUS_ADRALN 1
+#define BUS_ADRERR 2
+#define BUS_OBJERR 3
+#define BUS_MCEERR_AR 4
+#define BUS_MCEERR_AO 5
+
+#define CLD_EXITED 1
+#define CLD_KILLED 2
+#define CLD_DUMPED 3
+#define CLD_TRAPPED 4
+#define CLD_STOPPED 5
+#define CLD_CONTINUED 6
+
+union sigval {
+	int sival_int;
+	void *sival_ptr;
+};
+
+typedef struct {
+#ifdef __SI_SWAP_ERRNO_CODE
+	int si_signo, si_code, si_errno;
+#else
+	int si_signo, si_errno, si_code;
+#endif
+	union {
+		char __pad[128 - 2*sizeof(int) - sizeof(long)];
+		struct {
+			union {
+				struct {
+					pid_t si_pid;
+					uid_t si_uid;
+				} __piduid;
+				struct {
+					int si_timerid;
+					int si_overrun;
+				} __timer;
+			} __first;
+			union {
+				union sigval si_value;
+				struct {
+					int si_status;
+					clock_t si_utime, si_stime;
+				} __sigchld;
+			} __second;
+		} __si_common;
+		struct {
+			void *si_addr;
+			short si_addr_lsb;
+			union {
+				struct {
+					void *si_lower;
+					void *si_upper;
+				} __addr_bnd;
+				unsigned si_pkey;
+			} __first;
+		} __sigfault;
+		struct {
+			long si_band;
+			int si_fd;
+		} __sigpoll;
+		struct {
+			void *si_call_addr;
+			int si_syscall;
+			unsigned si_arch;
+		} __sigsys;
+	} __si_fields;
+} siginfo_t;
+#define si_pid     __si_fields.__si_common.__first.__piduid.si_pid
+#define si_uid     __si_fields.__si_common.__first.__piduid.si_uid
+#define si_status  __si_fields.__si_common.__second.__sigchld.si_status
+#define si_utime   __si_fields.__si_common.__second.__sigchld.si_utime
+#define si_stime   __si_fields.__si_common.__second.__sigchld.si_stime
+#define si_value   __si_fields.__si_common.__second.si_value
+#define si_addr    __si_fields.__sigfault.si_addr
+#define si_addr_lsb __si_fields.__sigfault.si_addr_lsb
+#define si_lower   __si_fields.__sigfault.__first.__addr_bnd.si_lower
+#define si_upper   __si_fields.__sigfault.__first.__addr_bnd.si_upper
+#define si_pkey    __si_fields.__sigfault.__first.si_pkey
+#define si_band    __si_fields.__sigpoll.si_band
+#define si_fd      __si_fields.__sigpoll.si_fd
+#define si_timerid __si_fields.__si_common.__first.__timer.si_timerid
+#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun
+#define si_ptr     si_value.sival_ptr
+#define si_int     si_value.sival_int
+#define si_call_addr __si_fields.__sigsys.si_call_addr
+#define si_syscall __si_fields.__sigsys.si_syscall
+#define si_arch    __si_fields.__sigsys.si_arch
+
+struct sigaction {
+	union {
+		void (*sa_handler)(int);
+		void (*sa_sigaction)(int, siginfo_t *, void *);
+	} __sa_handler;
+	sigset_t sa_mask;
+	int sa_flags;
+	void (*sa_restorer)(void);
+};
+#define sa_handler   __sa_handler.sa_handler
+#define sa_sigaction __sa_handler.sa_sigaction
+
+#define SA_UNSUPPORTED 0x00000400
+#define SA_EXPOSE_TAGBITS 0x00000800
+
+struct sigevent {
+	union sigval sigev_value;
+	int sigev_signo;
+	int sigev_notify;
+	union {
+		char __pad[64 - 2*sizeof(int) - sizeof(union sigval)];
+		pid_t sigev_notify_thread_id;
+		struct {
+			void (*sigev_notify_function)(union sigval);
+			pthread_attr_t *sigev_notify_attributes;
+		} __sev_thread;
+	} __sev_fields;
+};
+
+#define sigev_notify_thread_id __sev_fields.sigev_notify_thread_id
+#define sigev_notify_function __sev_fields.__sev_thread.sigev_notify_function
+#define sigev_notify_attributes __sev_fields.__sev_thread.sigev_notify_attributes
+
+#define SIGEV_SIGNAL 0
+#define SIGEV_NONE 1
+#define SIGEV_THREAD 2
+#define SIGEV_THREAD_ID 4
+
+int __libc_current_sigrtmin(void);
+int __libc_current_sigrtmax(void);
+
+#define SIGRTMIN  (__libc_current_sigrtmin())
+#define SIGRTMAX  (__libc_current_sigrtmax())
+
+int kill(pid_t, int);
+
+int sigemptyset(sigset_t *);
+int sigfillset(sigset_t *);
+int sigaddset(sigset_t *, int);
+int sigdelset(sigset_t *, int);
+int sigismember(const sigset_t *, int);
+
+int sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict);
+int sigsuspend(const sigset_t *);
+int sigaction(int, const struct sigaction *__restrict, struct sigaction *__restrict);
+int sigpending(sigset_t *);
+int sigwait(const sigset_t *__restrict, int *__restrict);
+int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict);
+int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct timespec *__restrict);
+int sigqueue(pid_t, int, union sigval);
+
+int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict);
+int pthread_kill(pthread_t, int);
+
+void psiginfo(const siginfo_t *, const char *);
+void psignal(int, const char *);
+
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+int killpg(pid_t, int);
+int sigaltstack(const stack_t *__restrict, stack_t *__restrict);
+int sighold(int);
+int sigignore(int);
+int siginterrupt(int, int);
+int sigpause(int);
+int sigrelse(int);
+void (*sigset(int, void (*)(int)))(int);
+#define TRAP_BRKPT 1
+#define TRAP_TRACE 2
+#define TRAP_BRANCH 3
+#define TRAP_HWBKPT 4
+#define TRAP_UNK 5
+#define POLL_IN 1
+#define POLL_OUT 2
+#define POLL_MSG 3
+#define POLL_ERR 4
+#define POLL_PRI 5
+#define POLL_HUP 6
+#define SS_ONSTACK    1
+#define SS_DISABLE    2
+#define SS_AUTODISARM (1U << 31)
+#define SS_FLAG_BITS SS_AUTODISARM
+#endif
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define NSIG _NSIG
+typedef void (*sig_t)(int);
+
+#define SYS_SECCOMP 1
+#define SYS_USER_DISPATCH 2
+#endif
+
+#ifdef _GNU_SOURCE
+typedef void (*sighandler_t)(int);
+void (*bsd_signal(int, void (*)(int)))(int);
+int sigisemptyset(const sigset_t *);
+int sigorset (sigset_t *, const sigset_t *, const sigset_t *);
+int sigandset(sigset_t *, const sigset_t *, const sigset_t *);
+
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
+#endif
+
+#define SIG_ERR  ((void (*)(int))-1)
+#define SIG_DFL  ((void (*)(int)) 0)
+#define SIG_IGN  ((void (*)(int)) 1)
+
+typedef int sig_atomic_t;
+
+void (*signal(int, void (*)(int)))(int);
+int raise(int);
+
+#if _REDIR_TIME64
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+__REDIR(sigtimedwait, __sigtimedwait_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/spawn.h b/musl-include/i386/spawn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/spawn.h
@@ -0,0 +1,83 @@
+#ifndef _SPAWN_H
+#define _SPAWN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_mode_t
+#define __NEED_pid_t
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+struct sched_param;
+
+#define POSIX_SPAWN_RESETIDS 1
+#define POSIX_SPAWN_SETPGROUP 2
+#define POSIX_SPAWN_SETSIGDEF 4
+#define POSIX_SPAWN_SETSIGMASK 8
+#define POSIX_SPAWN_SETSCHEDPARAM 16
+#define POSIX_SPAWN_SETSCHEDULER 32
+#define POSIX_SPAWN_USEVFORK 64
+#define POSIX_SPAWN_SETSID 128
+
+typedef struct {
+	int __flags;
+	pid_t __pgrp;
+	sigset_t __def, __mask;
+	int __prio, __pol;
+	void *__fn;
+	char __pad[64-sizeof(void *)];
+} posix_spawnattr_t;
+
+typedef struct {
+	int __pad0[2];
+	void *__actions;
+	int __pad[16];
+} posix_spawn_file_actions_t;
+
+int posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
+int posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
+
+int posix_spawnattr_init(posix_spawnattr_t *);
+int posix_spawnattr_destroy(posix_spawnattr_t *);
+
+int posix_spawnattr_setflags(posix_spawnattr_t *, short);
+int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict);
+
+int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
+int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict);
+
+int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
+
+int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
+
+int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict, const struct sched_param *__restrict);
+int posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict, struct sched_param *__restrict);
+int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
+int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict, int *__restrict);
+
+int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
+int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
+
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t);
+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
+int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/stdalign.h b/musl-include/i386/stdalign.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stdalign.h
@@ -0,0 +1,20 @@
+#ifndef _STDALIGN_H
+#define _STDALIGN_H
+
+#ifndef __cplusplus
+
+/* this whole header only works in C11 or with compiler extensions */
+#if __STDC_VERSION__ < 201112L && defined( __GNUC__)
+#define _Alignas(t) __attribute__((__aligned__(t)))
+#define _Alignof(t) __alignof__(t)
+#endif
+
+#define alignas _Alignas
+#define alignof _Alignof
+
+#endif
+
+#define __alignas_is_defined 1
+#define __alignof_is_defined 1
+
+#endif
diff --git a/musl-include/i386/stdarg.h b/musl-include/i386/stdarg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stdarg.h
@@ -0,0 +1,21 @@
+#ifndef _STDARG_H
+#define _STDARG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_va_list
+
+#include <bits/alltypes.h>
+
+#define va_start(v,l)   __builtin_va_start(v,l)
+#define va_end(v)       __builtin_va_end(v)
+#define va_arg(v,l)     __builtin_va_arg(v,l)
+#define va_copy(d,s)    __builtin_va_copy(d,s)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/stdbool.h b/musl-include/i386/stdbool.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stdbool.h
@@ -0,0 +1,14 @@
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+#ifndef __cplusplus
+
+#define true 1
+#define false 0
+#define bool _Bool
+
+#endif
+
+#define __bool_true_false_are_defined 1
+
+#endif
diff --git a/musl-include/i386/stdc-predef.h b/musl-include/i386/stdc-predef.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stdc-predef.h
@@ -0,0 +1,18 @@
+#ifndef _STDC_PREDEF_H
+#define _STDC_PREDEF_H
+
+#define __STDC_ISO_10646__ 201206L
+
+#if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0
+#define __STDC_IEC_559__ 1
+#endif
+
+#if !defined(__STDC_UTF_16__)
+#define __STDC_UTF_16__ 1
+#endif
+
+#if !defined(__STDC_UTF_32__)
+#define __STDC_UTF_32__ 1
+#endif
+
+#endif
diff --git a/musl-include/i386/stddef.h b/musl-include/i386/stddef.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stddef.h
@@ -0,0 +1,27 @@
+#ifndef _STDDEF_H
+#define _STDDEF_H
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_ptrdiff_t
+#define __NEED_size_t
+#define __NEED_wchar_t
+#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
+#define __NEED_max_align_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if __GNUC__ > 3
+#define offsetof(type, member) __builtin_offsetof(type, member)
+#else
+#define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 ))
+#endif
+
+#endif
diff --git a/musl-include/i386/stdint.h b/musl-include/i386/stdint.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stdint.h
@@ -0,0 +1,117 @@
+#ifndef _STDINT_H
+#define _STDINT_H
+
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+
+#define __NEED_uint8_t
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#define __NEED_intptr_t
+#define __NEED_uintptr_t
+
+#define __NEED_intmax_t
+#define __NEED_uintmax_t
+
+#include <bits/alltypes.h>
+
+typedef int8_t int_fast8_t;
+typedef int64_t int_fast64_t;
+
+typedef int8_t  int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+
+typedef uint8_t uint_fast8_t;
+typedef uint64_t uint_fast64_t;
+
+typedef uint8_t  uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+#define INT8_MIN   (-1-0x7f)
+#define INT16_MIN  (-1-0x7fff)
+#define INT32_MIN  (-1-0x7fffffff)
+#define INT64_MIN  (-1-0x7fffffffffffffff)
+
+#define INT8_MAX   (0x7f)
+#define INT16_MAX  (0x7fff)
+#define INT32_MAX  (0x7fffffff)
+#define INT64_MAX  (0x7fffffffffffffff)
+
+#define UINT8_MAX  (0xff)
+#define UINT16_MAX (0xffff)
+#define UINT32_MAX (0xffffffffu)
+#define UINT64_MAX (0xffffffffffffffffu)
+
+#define INT_FAST8_MIN   INT8_MIN
+#define INT_FAST64_MIN  INT64_MIN
+
+#define INT_LEAST8_MIN   INT8_MIN
+#define INT_LEAST16_MIN  INT16_MIN
+#define INT_LEAST32_MIN  INT32_MIN
+#define INT_LEAST64_MIN  INT64_MIN
+
+#define INT_FAST8_MAX   INT8_MAX
+#define INT_FAST64_MAX  INT64_MAX
+
+#define INT_LEAST8_MAX   INT8_MAX
+#define INT_LEAST16_MAX  INT16_MAX
+#define INT_LEAST32_MAX  INT32_MAX
+#define INT_LEAST64_MAX  INT64_MAX
+
+#define UINT_FAST8_MAX  UINT8_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define UINT_LEAST8_MAX  UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INTMAX_MIN  INT64_MIN
+#define INTMAX_MAX  INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define WINT_MIN 0U
+#define WINT_MAX UINT32_MAX
+
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
+
+#define SIG_ATOMIC_MIN  INT32_MIN
+#define SIG_ATOMIC_MAX  INT32_MAX
+
+#include <bits/stdint.h>
+
+#define INT8_C(c)  c
+#define INT16_C(c) c
+#define INT32_C(c) c
+
+#define UINT8_C(c)  c
+#define UINT16_C(c) c
+#define UINT32_C(c) c ## U
+
+#if UINTPTR_MAX == UINT64_MAX
+#define INT64_C(c) c ## L
+#define UINT64_C(c) c ## UL
+#define INTMAX_C(c)  c ## L
+#define UINTMAX_C(c) c ## UL
+#else
+#define INT64_C(c) c ## LL
+#define UINT64_C(c) c ## ULL
+#define INTMAX_C(c)  c ## LL
+#define UINTMAX_C(c) c ## ULL
+#endif
+
+#endif
diff --git a/musl-include/i386/stdio.h b/musl-include/i386/stdio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stdio.h
@@ -0,0 +1,224 @@
+#ifndef _STDIO_H
+#define _STDIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_FILE
+#define __NEED___isoc_va_list
+#define __NEED_size_t
+
+#if __STDC_VERSION__ < 201112L
+#define __NEED_struct__IO_FILE
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_ssize_t
+#define __NEED_off_t
+#define __NEED_va_list
+#endif
+
+#include <bits/alltypes.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#undef EOF
+#define EOF (-1)
+
+#undef SEEK_SET
+#undef SEEK_CUR
+#undef SEEK_END
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#define _IOFBF 0
+#define _IOLBF 1
+#define _IONBF 2
+
+#define BUFSIZ 1024
+#define FILENAME_MAX 4096
+#define FOPEN_MAX 1000
+#define TMP_MAX 10000
+#define L_tmpnam 20
+
+typedef union _G_fpos64_t {
+	char __opaque[16];
+	long long __lldata;
+	double __align;
+} fpos_t;
+
+extern FILE *const stdin;
+extern FILE *const stdout;
+extern FILE *const stderr;
+
+#define stdin  (stdin)
+#define stdout (stdout)
+#define stderr (stderr)
+
+FILE *fopen(const char *__restrict, const char *__restrict);
+FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict);
+int fclose(FILE *);
+
+int remove(const char *);
+int rename(const char *, const char *);
+
+int feof(FILE *);
+int ferror(FILE *);
+int fflush(FILE *);
+void clearerr(FILE *);
+
+int fseek(FILE *, long, int);
+long ftell(FILE *);
+void rewind(FILE *);
+
+int fgetpos(FILE *__restrict, fpos_t *__restrict);
+int fsetpos(FILE *, const fpos_t *);
+
+size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
+size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict);
+
+int fgetc(FILE *);
+int getc(FILE *);
+int getchar(void);
+int ungetc(int, FILE *);
+
+int fputc(int, FILE *);
+int putc(int, FILE *);
+int putchar(int);
+
+char *fgets(char *__restrict, int, FILE *__restrict);
+#if __STDC_VERSION__ < 201112L
+char *gets(char *);
+#endif
+
+int fputs(const char *__restrict, FILE *__restrict);
+int puts(const char *);
+
+int printf(const char *__restrict, ...);
+int fprintf(FILE *__restrict, const char *__restrict, ...);
+int sprintf(char *__restrict, const char *__restrict, ...);
+int snprintf(char *__restrict, size_t, const char *__restrict, ...);
+
+int vprintf(const char *__restrict, __isoc_va_list);
+int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
+int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list);
+
+int scanf(const char *__restrict, ...);
+int fscanf(FILE *__restrict, const char *__restrict, ...);
+int sscanf(const char *__restrict, const char *__restrict, ...);
+int vscanf(const char *__restrict, __isoc_va_list);
+int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list);
+
+void perror(const char *);
+
+int setvbuf(FILE *__restrict, char *__restrict, int, size_t);
+void setbuf(FILE *__restrict, char *__restrict);
+
+char *tmpnam(char *);
+FILE *tmpfile(void);
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+FILE *fmemopen(void *__restrict, size_t, const char *__restrict);
+FILE *open_memstream(char **, size_t *);
+FILE *fdopen(int, const char *);
+FILE *popen(const char *, const char *);
+int pclose(FILE *);
+int fileno(FILE *);
+int fseeko(FILE *, off_t, int);
+off_t ftello(FILE *);
+int dprintf(int, const char *__restrict, ...);
+int vdprintf(int, const char *__restrict, __isoc_va_list);
+void flockfile(FILE *);
+int ftrylockfile(FILE *);
+void funlockfile(FILE *);
+int getc_unlocked(FILE *);
+int getchar_unlocked(void);
+int putc_unlocked(int, FILE *);
+int putchar_unlocked(int);
+ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict);
+ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict);
+int renameat(int, const char *, int, const char *);
+char *ctermid(char *);
+#define L_ctermid 20
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define P_tmpdir "/tmp"
+char *tempnam(const char *, const char *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define L_cuserid 20
+char *cuserid(char *);
+void setlinebuf(FILE *);
+void setbuffer(FILE *, char *, size_t);
+int fgetc_unlocked(FILE *);
+int fputc_unlocked(int, FILE *);
+int fflush_unlocked(FILE *);
+size_t fread_unlocked(void *, size_t, size_t, FILE *);
+size_t fwrite_unlocked(const void *, size_t, size_t, FILE *);
+void clearerr_unlocked(FILE *);
+int feof_unlocked(FILE *);
+int ferror_unlocked(FILE *);
+int fileno_unlocked(FILE *);
+int getw(FILE *);
+int putw(int, FILE *);
+char *fgetln(FILE *, size_t *);
+int asprintf(char **, const char *, ...);
+int vasprintf(char **, const char *, __isoc_va_list);
+#endif
+
+#ifdef _GNU_SOURCE
+char *fgets_unlocked(char *, int, FILE *);
+int fputs_unlocked(const char *, FILE *);
+
+typedef ssize_t (cookie_read_function_t)(void *, char *, size_t);
+typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
+typedef int (cookie_seek_function_t)(void *, off_t *, int);
+typedef int (cookie_close_function_t)(void *);
+
+typedef struct _IO_cookie_io_functions_t {
+	cookie_read_function_t *read;
+	cookie_write_function_t *write;
+	cookie_seek_function_t *seek;
+	cookie_close_function_t *close;
+} cookie_io_functions_t;
+
+FILE *fopencookie(void *, const char *, cookie_io_functions_t);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define tmpfile64 tmpfile
+#define fopen64 fopen
+#define freopen64 freopen
+#define fseeko64 fseeko
+#define ftello64 ftello
+#define fgetpos64 fgetpos
+#define fsetpos64 fsetpos
+#define fpos64_t fpos_t
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/stdio_ext.h b/musl-include/i386/stdio_ext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stdio_ext.h
@@ -0,0 +1,34 @@
+#ifndef _STDIO_EXT_H
+#define _STDIO_EXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+#define FSETLOCKING_QUERY 0
+#define FSETLOCKING_INTERNAL 1
+#define FSETLOCKING_BYCALLER 2
+
+void _flushlbf(void);
+int __fsetlocking(FILE *, int);
+int __fwriting(FILE *);
+int __freading(FILE *);
+int __freadable(FILE *);
+int __fwritable(FILE *);
+int __flbf(FILE *);
+size_t __fbufsize(FILE *);
+size_t __fpending(FILE *);
+int __fpurge(FILE *);
+
+size_t __freadahead(FILE *);
+const char *__freadptr(FILE *, size_t *);
+void __freadptrinc(FILE *, size_t);
+void __fseterr(FILE *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/stdlib.h b/musl-include/i386/stdlib.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stdlib.h
@@ -0,0 +1,179 @@
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#define __NEED_wchar_t
+
+#include <bits/alltypes.h>
+
+int atoi (const char *);
+long atol (const char *);
+long long atoll (const char *);
+double atof (const char *);
+
+float strtof (const char *__restrict, char **__restrict);
+double strtod (const char *__restrict, char **__restrict);
+long double strtold (const char *__restrict, char **__restrict);
+
+long strtol (const char *__restrict, char **__restrict, int);
+unsigned long strtoul (const char *__restrict, char **__restrict, int);
+long long strtoll (const char *__restrict, char **__restrict, int);
+unsigned long long strtoull (const char *__restrict, char **__restrict, int);
+
+int rand (void);
+void srand (unsigned);
+
+void *malloc (size_t);
+void *calloc (size_t, size_t);
+void *realloc (void *, size_t);
+void free (void *);
+void *aligned_alloc(size_t, size_t);
+
+_Noreturn void abort (void);
+int atexit (void (*) (void));
+_Noreturn void exit (int);
+_Noreturn void _Exit (int);
+int at_quick_exit (void (*) (void));
+_Noreturn void quick_exit (int);
+
+char *getenv (const char *);
+
+int system (const char *);
+
+void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
+void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
+
+int abs (int);
+long labs (long);
+long long llabs (long long);
+
+typedef struct { int quot, rem; } div_t;
+typedef struct { long quot, rem; } ldiv_t;
+typedef struct { long long quot, rem; } lldiv_t;
+
+div_t div (int, int);
+ldiv_t ldiv (long, long);
+lldiv_t lldiv (long long, long long);
+
+int mblen (const char *, size_t);
+int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
+int wctomb (char *, wchar_t);
+size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
+size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+size_t __ctype_get_mb_cur_max(void);
+#define MB_CUR_MAX (__ctype_get_mb_cur_max())
+
+#define RAND_MAX (0x7fffffff)
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define WNOHANG    1
+#define WUNTRACED  2
+
+#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
+#define WTERMSIG(s) ((s) & 0x7f)
+#define WSTOPSIG(s) WEXITSTATUS(s)
+#define WIFEXITED(s) (!WTERMSIG(s))
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
+
+int posix_memalign (void **, size_t, size_t);
+int setenv (const char *, const char *, int);
+int unsetenv (const char *);
+int mkstemp (char *);
+int mkostemp (char *, int);
+char *mkdtemp (char *);
+int getsubopt (char **, char *const *, char **);
+int rand_r (unsigned *);
+
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+char *realpath (const char *__restrict, char *__restrict);
+long int random (void);
+void srandom (unsigned int);
+char *initstate (unsigned int, char *, size_t);
+char *setstate (char *);
+int putenv (char *);
+int posix_openpt (int);
+int grantpt (int);
+int unlockpt (int);
+char *ptsname (int);
+char *l64a (long);
+long a64l (const char *);
+void setkey (const char *);
+double drand48 (void);
+double erand48 (unsigned short [3]);
+long int lrand48 (void);
+long int nrand48 (unsigned short [3]);
+long mrand48 (void);
+long jrand48 (unsigned short [3]);
+void srand48 (long);
+unsigned short *seed48 (unsigned short [3]);
+void lcong48 (unsigned short [7]);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#include <alloca.h>
+char *mktemp (char *);
+int mkstemps (char *, int);
+int mkostemps (char *, int, int);
+void *valloc (size_t);
+void *memalign(size_t, size_t);
+int getloadavg(double *, int);
+int clearenv(void);
+#define WCOREDUMP(s) ((s) & 0x80)
+#define WIFCONTINUED(s) ((s) == 0xffff)
+void *reallocarray (void *, size_t, size_t);
+void qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *);
+#endif
+
+#ifdef _GNU_SOURCE
+int ptsname_r(int, char *, size_t);
+char *ecvt(double, int, int *, int *);
+char *fcvt(double, int, int *, int *);
+char *gcvt(double, int, char *);
+char *secure_getenv(const char *);
+struct __locale_struct;
+float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define mkstemp64 mkstemp
+#define mkostemp64 mkostemp
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define mkstemps64 mkstemps
+#define mkostemps64 mkostemps
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/stdnoreturn.h b/musl-include/i386/stdnoreturn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stdnoreturn.h
@@ -0,0 +1,7 @@
+#ifndef _STDNORETURN_H
+#define _STDNORETURN_H
+#ifndef __cplusplus
+#include <features.h>
+#define noreturn _Noreturn
+#endif
+#endif
diff --git a/musl-include/i386/string.h b/musl-include/i386/string.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/string.h
@@ -0,0 +1,104 @@
+#ifndef	_STRING_H
+#define	_STRING_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+void *memcpy (void *__restrict, const void *__restrict, size_t);
+void *memmove (void *, const void *, size_t);
+void *memset (void *, int, size_t);
+int memcmp (const void *, const void *, size_t);
+void *memchr (const void *, int, size_t);
+
+char *strcpy (char *__restrict, const char *__restrict);
+char *strncpy (char *__restrict, const char *__restrict, size_t);
+
+char *strcat (char *__restrict, const char *__restrict);
+char *strncat (char *__restrict, const char *__restrict, size_t);
+
+int strcmp (const char *, const char *);
+int strncmp (const char *, const char *, size_t);
+
+int strcoll (const char *, const char *);
+size_t strxfrm (char *__restrict, const char *__restrict, size_t);
+
+char *strchr (const char *, int);
+char *strrchr (const char *, int);
+
+size_t strcspn (const char *, const char *);
+size_t strspn (const char *, const char *);
+char *strpbrk (const char *, const char *);
+char *strstr (const char *, const char *);
+char *strtok (char *__restrict, const char *__restrict);
+
+size_t strlen (const char *);
+
+char *strerror (int);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#include <strings.h>
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
+int strerror_r (int, char *, size_t);
+char *stpcpy(char *__restrict, const char *__restrict);
+char *stpncpy(char *__restrict, const char *__restrict, size_t);
+size_t strnlen (const char *, size_t);
+char *strdup (const char *);
+char *strndup (const char *, size_t);
+char *strsignal(int);
+char *strerror_l (int, locale_t);
+int strcoll_l (const char *, const char *, locale_t);
+size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
+void *memmem(const void *, size_t, const void *, size_t);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+void *memccpy (void *__restrict, const void *__restrict, int, size_t);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+char *strsep(char **, const char *);
+size_t strlcat (char *, const char *, size_t);
+size_t strlcpy (char *, const char *, size_t);
+void explicit_bzero (void *, size_t);
+#endif
+
+#ifdef _GNU_SOURCE
+#define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)
+int strverscmp (const char *, const char *);
+char *strchrnul(const char *, int);
+char *strcasestr(const char *, const char *);
+void *memrchr(const void *, int, size_t);
+void *mempcpy(void *, const void *, size_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/strings.h b/musl-include/i386/strings.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/strings.h
@@ -0,0 +1,40 @@
+#ifndef	_STRINGS_H
+#define	_STRINGS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_locale_t
+#include <bits/alltypes.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+int bcmp (const void *, const void *, size_t);
+void bcopy (const void *, void *, size_t);
+void bzero (void *, size_t);
+char *index (const char *, int);
+char *rindex (const char *, int);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)  || defined(_BSD_SOURCE)
+int ffs (int);
+int ffsl (long);
+int ffsll (long long);
+#endif
+
+int strcasecmp (const char *, const char *);
+int strncasecmp (const char *, const char *, size_t);
+
+int strcasecmp_l (const char *, const char *, locale_t);
+int strncasecmp_l (const char *, const char *, size_t, locale_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/stropts.h b/musl-include/i386/stropts.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/stropts.h
@@ -0,0 +1,139 @@
+#ifndef _STROPTS_H
+#define _STROPTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __SID		('S' << 8)
+
+#define I_NREAD		(__SID | 1)
+#define I_PUSH		(__SID | 2)
+#define I_POP		(__SID | 3)
+#define I_LOOK		(__SID | 4)
+#define I_FLUSH		(__SID | 5)
+#define I_SRDOPT	(__SID | 6)
+#define I_GRDOPT	(__SID | 7)
+#define I_STR		(__SID | 8)
+#define I_SETSIG	(__SID | 9)
+#define I_GETSIG	(__SID |10)
+#define I_FIND		(__SID |11)
+#define I_LINK		(__SID |12)
+#define I_UNLINK	(__SID |13)
+#define I_PEEK		(__SID |15)
+#define I_FDINSERT	(__SID |16)
+#define I_SENDFD	(__SID |17)
+#define I_RECVFD	(__SID |14)
+#define I_SWROPT	(__SID |19)
+#define I_GWROPT	(__SID |20)
+#define I_LIST		(__SID |21)
+#define I_PLINK		(__SID |22)
+#define I_PUNLINK	(__SID |23)
+#define I_FLUSHBAND	(__SID |28)
+#define I_CKBAND	(__SID |29)
+#define I_GETBAND	(__SID |30)
+#define I_ATMARK	(__SID |31)
+#define I_SETCLTIME	(__SID |32)
+#define I_GETCLTIME	(__SID |33)
+#define I_CANPUT	(__SID |34)
+
+#define FMNAMESZ	8
+
+#define FLUSHR		0x01
+#define FLUSHW		0x02
+#define FLUSHRW		0x03
+#define FLUSHBAND	0x04
+
+#define S_INPUT		0x0001
+#define S_HIPRI		0x0002
+#define S_OUTPUT	0x0004
+#define S_MSG		0x0008
+#define S_ERROR		0x0010
+#define S_HANGUP	0x0020
+#define S_RDNORM	0x0040
+#define S_WRNORM	S_OUTPUT
+#define S_RDBAND	0x0080
+#define S_WRBAND	0x0100
+#define S_BANDURG	0x0200
+
+#define RS_HIPRI	0x01
+
+#define RNORM		0x0000
+#define RMSGD		0x0001
+#define RMSGN		0x0002
+#define RPROTDAT	0x0004
+#define RPROTDIS	0x0008
+#define RPROTNORM	0x0010
+#define RPROTMASK	0x001C
+
+#define SNDZERO		0x001
+#define SNDPIPE		0x002
+
+#define ANYMARK		0x01
+#define LASTMARK	0x02
+
+#define MUXID_ALL	(-1)
+
+#define MSG_HIPRI	0x01
+#define MSG_ANY		0x02
+#define MSG_BAND	0x04
+
+#define MORECTL		1
+#define MOREDATA	2
+
+struct bandinfo {
+	unsigned char bi_pri;
+	int bi_flag;
+};
+
+struct strbuf {
+	int maxlen;
+	int len;
+	char *buf;
+};
+
+struct strpeek {
+	struct strbuf ctlbuf;
+	struct strbuf databuf;
+	unsigned flags;
+};
+
+struct strfdinsert {
+	struct strbuf ctlbuf;
+	struct strbuf databuf;
+	unsigned flags;
+	int fildes;
+	int offset;
+};
+
+struct strioctl {
+	int ic_cmd;
+	int ic_timout;
+	int ic_len;
+	char *ic_dp;
+};
+
+struct strrecvfd {
+	int fd;
+	int uid;
+	int gid;
+	char __fill[8];
+};
+
+struct str_mlist {
+	char l_name[FMNAMESZ + 1];
+};
+
+struct str_list {
+	int sl_nmods;
+	struct str_mlist *sl_modlist;
+};
+
+int isastream(int);
+int ioctl(int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/acct.h b/musl-include/i386/sys/acct.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/acct.h
@@ -0,0 +1,72 @@
+#ifndef _SYS_ACCT_H
+#define _SYS_ACCT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <time.h>
+#include <stdint.h>
+
+#define ACCT_COMM 16
+
+typedef uint16_t comp_t;
+
+struct acct {
+	char ac_flag;
+	uint16_t ac_uid;
+	uint16_t ac_gid;
+	uint16_t ac_tty;
+	uint32_t ac_btime;
+	comp_t ac_utime;
+	comp_t ac_stime;
+	comp_t ac_etime;
+	comp_t ac_mem;
+	comp_t ac_io;
+	comp_t ac_rw;
+	comp_t ac_minflt;
+	comp_t ac_majflt;
+	comp_t ac_swaps;
+	uint32_t ac_exitcode;
+	char ac_comm[ACCT_COMM+1];
+	char ac_pad[10];
+};
+
+
+struct acct_v3 {
+	char ac_flag;
+	char ac_version;
+	uint16_t ac_tty;
+	uint32_t ac_exitcode;
+	uint32_t ac_uid;
+	uint32_t ac_gid;
+	uint32_t ac_pid;
+	uint32_t ac_ppid;
+	uint32_t ac_btime;
+	float ac_etime;
+	comp_t ac_utime;
+	comp_t ac_stime;
+	comp_t ac_mem;
+	comp_t ac_io;
+	comp_t ac_rw;
+	comp_t ac_minflt;
+	comp_t ac_majflt;
+	comp_t ac_swaps;
+	char ac_comm[ACCT_COMM];
+};
+
+#define AFORK 1
+#define ASU 2
+#define ACORE 8
+#define AXSIG 16
+#define ACCT_BYTEORDER (128*(__BYTE_ORDER==__BIG_ENDIAN))
+#define AHZ 100
+
+int acct(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/auxv.h b/musl-include/i386/sys/auxv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/auxv.h
@@ -0,0 +1,17 @@
+#ifndef _SYS_AUXV_H
+#define _SYS_AUXV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+#include <bits/hwcap.h>
+
+unsigned long getauxval(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/cachectl.h b/musl-include/i386/sys/cachectl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/cachectl.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_CACHECTL_H
+#define _SYS_CACHECTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ICACHE (1<<0)
+#define DCACHE (1<<1)
+#define BCACHE (ICACHE|DCACHE)
+#define CACHEABLE 0
+#define UNCACHEABLE 1
+ 
+int cachectl(void *, int, int);
+int cacheflush(void *, int, int);
+int _flush_cache(void *, int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/dir.h b/musl-include/i386/sys/dir.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/dir.h
@@ -0,0 +1,2 @@
+#include <dirent.h>
+#define direct dirent
diff --git a/musl-include/i386/sys/epoll.h b/musl-include/i386/sys/epoll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/epoll.h
@@ -0,0 +1,69 @@
+#ifndef	_SYS_EPOLL_H
+#define	_SYS_EPOLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define EPOLL_CLOEXEC O_CLOEXEC
+#define EPOLL_NONBLOCK O_NONBLOCK
+
+enum EPOLL_EVENTS { __EPOLL_DUMMY };
+#define EPOLLIN 0x001
+#define EPOLLPRI 0x002
+#define EPOLLOUT 0x004
+#define EPOLLRDNORM 0x040
+#define EPOLLNVAL 0x020
+#define EPOLLRDBAND 0x080
+#define EPOLLWRNORM 0x100
+#define EPOLLWRBAND 0x200
+#define EPOLLMSG 0x400
+#define EPOLLERR 0x008
+#define EPOLLHUP 0x010
+#define EPOLLRDHUP 0x2000
+#define EPOLLEXCLUSIVE (1U<<28)
+#define EPOLLWAKEUP (1U<<29)
+#define EPOLLONESHOT (1U<<30)
+#define EPOLLET (1U<<31)
+
+#define EPOLL_CTL_ADD 1
+#define EPOLL_CTL_DEL 2
+#define EPOLL_CTL_MOD 3
+
+typedef union epoll_data {
+	void *ptr;
+	int fd;
+	uint32_t u32;
+	uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event {
+	uint32_t events;
+	epoll_data_t data;
+}
+#ifdef __x86_64__
+__attribute__ ((__packed__))
+#endif
+;
+
+
+int epoll_create(int);
+int epoll_create1(int);
+int epoll_ctl(int, int, int, struct epoll_event *);
+int epoll_wait(int, struct epoll_event *, int, int);
+int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/epoll.h */
diff --git a/musl-include/i386/sys/errno.h b/musl-include/i386/sys/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/errno.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/errno.h> to <errno.h>
+#include <errno.h>
diff --git a/musl-include/i386/sys/eventfd.h b/musl-include/i386/sys/eventfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/eventfd.h
@@ -0,0 +1,26 @@
+#ifndef _SYS_EVENTFD_H
+#define _SYS_EVENTFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+typedef uint64_t eventfd_t;
+
+#define EFD_SEMAPHORE 1
+#define EFD_CLOEXEC O_CLOEXEC
+#define EFD_NONBLOCK O_NONBLOCK
+
+int eventfd(unsigned int, int);
+int eventfd_read(int, eventfd_t *);
+int eventfd_write(int, eventfd_t);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/eventfd.h */
diff --git a/musl-include/i386/sys/fanotify.h b/musl-include/i386/sys/fanotify.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/fanotify.h
@@ -0,0 +1,111 @@
+#ifndef _FANOTIFY_H
+#define _FANOTIFY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/statfs.h>
+
+struct fanotify_event_metadata {
+	unsigned event_len;
+	unsigned char vers;
+	unsigned char reserved;
+	unsigned short metadata_len;
+	unsigned long long mask
+#ifdef __GNUC__
+	__attribute__((__aligned__(8)))
+#endif
+	;
+	int fd;
+	int pid;
+};
+
+struct fanotify_event_info_header {
+	unsigned char info_type;
+	unsigned char pad;
+	unsigned short len;
+};
+
+struct fanotify_event_info_fid {
+	struct fanotify_event_info_header hdr;
+	fsid_t fsid;
+	unsigned char handle[];
+};
+
+struct fanotify_response {
+	int fd;
+	unsigned response;
+};
+
+#define FAN_ACCESS 0x01
+#define FAN_MODIFY 0x02
+#define FAN_ATTRIB 0x04
+#define FAN_CLOSE_WRITE 0x08
+#define FAN_CLOSE_NOWRITE 0x10
+#define FAN_OPEN 0x20
+#define FAN_MOVED_FROM 0x40
+#define FAN_MOVED_TO 0x80
+#define FAN_CREATE 0x100
+#define FAN_DELETE 0x200
+#define FAN_DELETE_SELF 0x400
+#define FAN_MOVE_SELF 0x800
+#define FAN_OPEN_EXEC 0x1000
+#define FAN_Q_OVERFLOW 0x4000
+#define FAN_OPEN_PERM 0x10000
+#define FAN_ACCESS_PERM 0x20000
+#define FAN_OPEN_EXEC_PERM 0x40000
+#define FAN_DIR_MODIFY 0x00080000
+#define FAN_EVENT_ON_CHILD 0x08000000
+#define FAN_ONDIR 0x40000000
+#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
+#define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO)
+#define FAN_CLOEXEC 0x01
+#define FAN_NONBLOCK 0x02
+#define FAN_CLASS_NOTIF 0
+#define FAN_CLASS_CONTENT 0x04
+#define FAN_CLASS_PRE_CONTENT 0x08
+#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
+#define FAN_UNLIMITED_QUEUE 0x10
+#define FAN_UNLIMITED_MARKS 0x20
+#define FAN_ENABLE_AUDIT 0x40
+#define FAN_REPORT_TID 0x100
+#define FAN_REPORT_FID 0x200
+#define FAN_REPORT_DIR_FID 0x00000400
+#define FAN_REPORT_NAME 0x00000800
+#define FAN_REPORT_DFID_NAME (FAN_REPORT_DIR_FID | FAN_REPORT_NAME)
+#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
+#define FAN_MARK_ADD 0x01
+#define FAN_MARK_REMOVE 0x02
+#define FAN_MARK_DONT_FOLLOW 0x04
+#define FAN_MARK_ONLYDIR 0x08
+#define FAN_MARK_IGNORED_MASK 0x20
+#define FAN_MARK_IGNORED_SURV_MODIFY 0x40
+#define FAN_MARK_FLUSH 0x80
+#define FAN_MARK_INODE 0x00
+#define FAN_MARK_MOUNT 0x10
+#define FAN_MARK_FILESYSTEM 0x100
+#define FAN_MARK_TYPE_MASK (FAN_MARK_INODE | FAN_MARK_MOUNT | FAN_MARK_FILESYSTEM)
+#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_DONT_FOLLOW | FAN_MARK_ONLYDIR | FAN_MARK_MOUNT | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY | FAN_MARK_FLUSH)
+#define FAN_ALL_EVENTS (FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN)
+#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
+#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS | FAN_ALL_PERM_EVENTS | FAN_Q_OVERFLOW)
+#define FANOTIFY_METADATA_VERSION 3
+#define FAN_EVENT_INFO_TYPE_FID 1
+#define FAN_EVENT_INFO_TYPE_DFID_NAME 2
+#define FAN_EVENT_INFO_TYPE_DFID 3
+#define FAN_ALLOW 0x01
+#define FAN_DENY 0x02
+#define FAN_AUDIT 0x10
+#define FAN_NOFD -1
+#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
+#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, (struct fanotify_event_metadata*)(((char *)(meta)) + (meta)->event_len))
+#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len <= (long)(len))
+
+int fanotify_init(unsigned, unsigned);
+int fanotify_mark(int, unsigned, unsigned long long, int, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/fcntl.h b/musl-include/i386/sys/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/fcntl.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
+#include <fcntl.h>
diff --git a/musl-include/i386/sys/file.h b/musl-include/i386/sys/file.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/file.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_FILE_H
+#define _SYS_FILE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOCK_SH	1
+#define LOCK_EX	2
+#define LOCK_NB	4
+#define LOCK_UN	8
+
+#define L_SET 0
+#define L_INCR 1
+#define L_XTND 2
+
+int flock(int, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/fsuid.h b/musl-include/i386/sys/fsuid.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/fsuid.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_FSUID_H
+#define _SYS_FSUID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_uid_t
+#define __NEED_gid_t
+
+#include <bits/alltypes.h>
+
+int setfsuid(uid_t);
+int setfsgid(gid_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/inotify.h b/musl-include/i386/sys/inotify.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/inotify.h
@@ -0,0 +1,58 @@
+#ifndef _SYS_INOTIFY_H
+#define _SYS_INOTIFY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+struct inotify_event {
+	int wd;
+	uint32_t mask, cookie, len;
+	char name[];
+};
+
+#define IN_CLOEXEC O_CLOEXEC
+#define IN_NONBLOCK O_NONBLOCK
+
+#define IN_ACCESS        0x00000001
+#define IN_MODIFY        0x00000002
+#define IN_ATTRIB        0x00000004
+#define IN_CLOSE_WRITE   0x00000008
+#define IN_CLOSE_NOWRITE 0x00000010
+#define IN_CLOSE         (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
+#define IN_OPEN          0x00000020
+#define IN_MOVED_FROM    0x00000040
+#define IN_MOVED_TO      0x00000080
+#define IN_MOVE          (IN_MOVED_FROM | IN_MOVED_TO)
+#define IN_CREATE        0x00000100
+#define IN_DELETE        0x00000200
+#define IN_DELETE_SELF   0x00000400
+#define IN_MOVE_SELF     0x00000800
+#define IN_ALL_EVENTS    0x00000fff
+
+#define IN_UNMOUNT       0x00002000
+#define IN_Q_OVERFLOW    0x00004000
+#define IN_IGNORED       0x00008000
+
+#define IN_ONLYDIR       0x01000000
+#define IN_DONT_FOLLOW   0x02000000
+#define IN_EXCL_UNLINK   0x04000000
+#define IN_MASK_CREATE   0x10000000
+#define IN_MASK_ADD      0x20000000
+
+#define IN_ISDIR         0x40000000
+#define IN_ONESHOT       0x80000000
+
+int inotify_init(void);
+int inotify_init1(int);
+int inotify_add_watch(int, const char *, uint32_t);
+int inotify_rm_watch(int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/io.h b/musl-include/i386/sys/io.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/io.h
@@ -0,0 +1,17 @@
+#ifndef	_SYS_IO_H
+#define	_SYS_IO_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/io.h>
+
+int iopl(int);
+int ioperm(unsigned long, unsigned long, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/ioctl.h b/musl-include/i386/sys/ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/ioctl.h
@@ -0,0 +1,120 @@
+#ifndef	_SYS_IOCTL_H
+#define	_SYS_IOCTL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_struct_winsize
+
+#include <bits/alltypes.h>
+#include <bits/ioctl.h>
+
+#define N_TTY           0
+#define N_SLIP          1
+#define N_MOUSE         2
+#define N_PPP           3
+#define N_STRIP         4
+#define N_AX25          5
+#define N_X25           6
+#define N_6PACK         7
+#define N_MASC          8
+#define N_R3964         9
+#define N_PROFIBUS_FDL  10
+#define N_IRDA          11
+#define N_SMSBLOCK      12
+#define N_HDLC          13
+#define N_SYNC_PPP      14
+#define N_HCI           15
+#define N_GIGASET_M101  16
+#define N_SLCAN         17
+#define N_PPS           18
+#define N_V253          19
+#define N_CAIF          20
+#define N_GSM0710       21
+#define N_TI_WL         22
+#define N_TRACESINK     23
+#define N_TRACEROUTER   24
+#define N_NCI           25
+#define N_SPEAKUP       26
+#define N_NULL          27
+
+#define TIOCPKT_DATA       0
+#define TIOCPKT_FLUSHREAD  1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP       4
+#define TIOCPKT_START      8
+#define TIOCPKT_NOSTOP    16
+#define TIOCPKT_DOSTOP    32
+#define TIOCPKT_IOCTL     64
+
+#define TIOCSER_TEMT 1
+
+#define SIOCADDRT          0x890B
+#define SIOCDELRT          0x890C
+#define SIOCRTMSG          0x890D
+
+#define SIOCGIFNAME        0x8910
+#define SIOCSIFLINK        0x8911
+#define SIOCGIFCONF        0x8912
+#define SIOCGIFFLAGS       0x8913
+#define SIOCSIFFLAGS       0x8914
+#define SIOCGIFADDR        0x8915
+#define SIOCSIFADDR        0x8916
+#define SIOCGIFDSTADDR     0x8917
+#define SIOCSIFDSTADDR     0x8918
+#define SIOCGIFBRDADDR     0x8919
+#define SIOCSIFBRDADDR     0x891a
+#define SIOCGIFNETMASK     0x891b
+#define SIOCSIFNETMASK     0x891c
+#define SIOCGIFMETRIC      0x891d
+#define SIOCSIFMETRIC      0x891e
+#define SIOCGIFMEM         0x891f
+#define SIOCSIFMEM         0x8920
+#define SIOCGIFMTU         0x8921
+#define SIOCSIFMTU         0x8922
+#define SIOCSIFNAME        0x8923
+#define SIOCSIFHWADDR      0x8924
+#define SIOCGIFENCAP       0x8925
+#define SIOCSIFENCAP       0x8926
+#define SIOCGIFHWADDR      0x8927
+#define SIOCGIFSLAVE       0x8929
+#define SIOCSIFSLAVE       0x8930
+#define SIOCADDMULTI       0x8931
+#define SIOCDELMULTI       0x8932
+#define SIOCGIFINDEX       0x8933
+#define SIOGIFINDEX        SIOCGIFINDEX
+#define SIOCSIFPFLAGS      0x8934
+#define SIOCGIFPFLAGS      0x8935
+#define SIOCDIFADDR        0x8936
+#define SIOCSIFHWBROADCAST 0x8937
+#define SIOCGIFCOUNT       0x8938
+
+#define SIOCGIFBR          0x8940
+#define SIOCSIFBR          0x8941
+
+#define SIOCGIFTXQLEN      0x8942
+#define SIOCSIFTXQLEN      0x8943
+
+#define SIOCDARP           0x8953
+#define SIOCGARP           0x8954
+#define SIOCSARP           0x8955
+
+#define SIOCDRARP          0x8960
+#define SIOCGRARP          0x8961
+#define SIOCSRARP          0x8962
+
+#define SIOCGIFMAP         0x8970
+#define SIOCSIFMAP         0x8971
+
+#define SIOCADDDLCI        0x8980
+#define SIOCDELDLCI        0x8981
+
+#define SIOCDEVPRIVATE     0x89F0
+#define SIOCPROTOPRIVATE   0x89E0
+
+int ioctl (int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/ipc.h b/musl-include/i386/sys/ipc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/ipc.h
@@ -0,0 +1,42 @@
+#ifndef _SYS_IPC_H
+#define _SYS_IPC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_key_t
+
+#include <bits/alltypes.h>
+
+#define __ipc_perm_key __key
+#define __ipc_perm_seq __seq
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __key key
+#define __seq seq
+#endif
+
+#include <bits/ipc.h>
+#include <bits/ipcstat.h>
+
+#define IPC_CREAT  01000
+#define IPC_EXCL   02000
+#define IPC_NOWAIT 04000
+
+#define IPC_RMID 0
+#define IPC_SET  1
+#define IPC_INFO 3
+
+#define IPC_PRIVATE ((key_t) 0)
+
+key_t ftok (const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/kd.h b/musl-include/i386/sys/kd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/kd.h
@@ -0,0 +1,1 @@
+#include <bits/kd.h>
diff --git a/musl-include/i386/sys/klog.h b/musl-include/i386/sys/klog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/klog.h
@@ -0,0 +1,14 @@
+#ifndef	_SYS_KLOG_H
+#define	_SYS_KLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int klogctl (int, char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/membarrier.h b/musl-include/i386/sys/membarrier.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/membarrier.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_MEMBARRIER_H
+#define _SYS_MEMBARRIER_H
+
+#define MEMBARRIER_CMD_QUERY 0
+#define MEMBARRIER_CMD_GLOBAL 1
+#define MEMBARRIER_CMD_GLOBAL_EXPEDITED 2
+#define MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED 4
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED 8
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 32
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 64
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ 128
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ 256
+
+#define MEMBARRIER_CMD_SHARED MEMBARRIER_CMD_GLOBAL
+
+#define MEMBARRIER_CMD_FLAG_CPU 1
+
+int membarrier(int, int);
+
+#endif
diff --git a/musl-include/i386/sys/mman.h b/musl-include/i386/sys/mman.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/mman.h
@@ -0,0 +1,152 @@
+#ifndef	_SYS_MMAN_H
+#define	_SYS_MMAN_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_mode_t
+#define __NEED_size_t
+#define __NEED_off_t
+
+#if defined(_GNU_SOURCE)
+#define __NEED_ssize_t
+#endif
+
+#include <bits/alltypes.h>
+
+#define MAP_FAILED ((void *) -1)
+
+#define MAP_SHARED     0x01
+#define MAP_PRIVATE    0x02
+#define MAP_SHARED_VALIDATE 0x03
+#define MAP_TYPE       0x0f
+#define MAP_FIXED      0x10
+#define MAP_ANON       0x20
+#define MAP_ANONYMOUS  MAP_ANON
+#define MAP_NORESERVE  0x4000
+#define MAP_GROWSDOWN  0x0100
+#define MAP_DENYWRITE  0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_LOCKED     0x2000
+#define MAP_POPULATE   0x8000
+#define MAP_NONBLOCK   0x10000
+#define MAP_STACK      0x20000
+#define MAP_HUGETLB    0x40000
+#define MAP_SYNC       0x80000
+#define MAP_FIXED_NOREPLACE 0x100000
+#define MAP_FILE       0
+
+#define MAP_HUGE_SHIFT 26
+#define MAP_HUGE_MASK  0x3f
+#define MAP_HUGE_16KB  (14 << 26)
+#define MAP_HUGE_64KB  (16 << 26)
+#define MAP_HUGE_512KB (19 << 26)
+#define MAP_HUGE_1MB   (20 << 26)
+#define MAP_HUGE_2MB   (21 << 26)
+#define MAP_HUGE_8MB   (23 << 26)
+#define MAP_HUGE_16MB  (24 << 26)
+#define MAP_HUGE_32MB  (25 << 26)
+#define MAP_HUGE_256MB (28 << 26)
+#define MAP_HUGE_512MB (29 << 26)
+#define MAP_HUGE_1GB   (30 << 26)
+#define MAP_HUGE_2GB   (31 << 26)
+#define MAP_HUGE_16GB  (34U << 26)
+
+#define PROT_NONE      0
+#define PROT_READ      1
+#define PROT_WRITE     2
+#define PROT_EXEC      4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP   0x02000000
+
+#define MS_ASYNC       1
+#define MS_INVALIDATE  2
+#define MS_SYNC        4
+
+#define MCL_CURRENT    1
+#define MCL_FUTURE     2
+#define MCL_ONFAULT    4
+
+#define POSIX_MADV_NORMAL     0
+#define POSIX_MADV_RANDOM     1
+#define POSIX_MADV_SEQUENTIAL 2
+#define POSIX_MADV_WILLNEED   3
+#define POSIX_MADV_DONTNEED   4
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MADV_NORMAL      0
+#define MADV_RANDOM      1
+#define MADV_SEQUENTIAL  2
+#define MADV_WILLNEED    3
+#define MADV_DONTNEED    4
+#define MADV_FREE        8
+#define MADV_REMOVE      9
+#define MADV_DONTFORK    10
+#define MADV_DOFORK      11
+#define MADV_MERGEABLE   12
+#define MADV_UNMERGEABLE 13
+#define MADV_HUGEPAGE    14
+#define MADV_NOHUGEPAGE  15
+#define MADV_DONTDUMP    16
+#define MADV_DODUMP      17
+#define MADV_WIPEONFORK  18
+#define MADV_KEEPONFORK  19
+#define MADV_COLD        20
+#define MADV_PAGEOUT     21
+#define MADV_HWPOISON    100
+#define MADV_SOFT_OFFLINE 101
+#endif
+
+#ifdef _GNU_SOURCE
+#define MREMAP_MAYMOVE 1
+#define MREMAP_FIXED 2
+#define MREMAP_DONTUNMAP 4
+
+#define MLOCK_ONFAULT 0x01
+
+#define MFD_CLOEXEC 0x0001U
+#define MFD_ALLOW_SEALING 0x0002U
+#define MFD_HUGETLB 0x0004U
+#endif
+
+#include <bits/mman.h>
+
+void *mmap (void *, size_t, int, int, int, off_t);
+int munmap (void *, size_t);
+
+int mprotect (void *, size_t, int);
+int msync (void *, size_t, int);
+
+int posix_madvise (void *, size_t, int);
+
+int mlock (const void *, size_t);
+int munlock (const void *, size_t);
+int mlockall (int);
+int munlockall (void);
+
+#ifdef _GNU_SOURCE
+void *mremap (void *, size_t, size_t, int, ...);
+int remap_file_pages (void *, size_t, int, size_t, int);
+int memfd_create (const char *, unsigned);
+int mlock2 (const void *, size_t, unsigned);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int madvise (void *, size_t, int);
+int mincore (void *, size_t, unsigned char *);
+#endif
+
+int shm_open (const char *, int, mode_t);
+int shm_unlink (const char *);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define mmap64 mmap
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/mount.h b/musl-include/i386/sys/mount.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/mount.h
@@ -0,0 +1,75 @@
+#ifndef _SYS_MOUNT_H
+#define _SYS_MOUNT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ioctl.h>
+
+#define BLKROSET   _IO(0x12, 93)
+#define BLKROGET   _IO(0x12, 94)
+#define BLKRRPART  _IO(0x12, 95)
+#define BLKGETSIZE _IO(0x12, 96)
+#define BLKFLSBUF  _IO(0x12, 97)
+#define BLKRASET   _IO(0x12, 98)
+#define BLKRAGET   _IO(0x12, 99)
+#define BLKFRASET  _IO(0x12,100)
+#define BLKFRAGET  _IO(0x12,101)
+#define BLKSECTSET _IO(0x12,102)
+#define BLKSECTGET _IO(0x12,103)
+#define BLKSSZGET  _IO(0x12,104)
+#define BLKBSZGET  _IOR(0x12,112,size_t)
+#define BLKBSZSET  _IOW(0x12,113,size_t)
+#define BLKGETSIZE64 _IOR(0x12,114,size_t)
+
+#define MS_RDONLY      1
+#define MS_NOSUID      2
+#define MS_NODEV       4
+#define MS_NOEXEC      8
+#define MS_SYNCHRONOUS 16
+#define MS_REMOUNT     32
+#define MS_MANDLOCK    64
+#define MS_DIRSYNC     128
+#define MS_NOSYMFOLLOW 256
+#define MS_NOATIME     1024
+#define MS_NODIRATIME  2048
+#define MS_BIND        4096
+#define MS_MOVE        8192
+#define MS_REC         16384
+#define MS_SILENT      32768
+#define MS_POSIXACL    (1<<16)
+#define MS_UNBINDABLE  (1<<17)
+#define MS_PRIVATE     (1<<18)
+#define MS_SLAVE       (1<<19)
+#define MS_SHARED      (1<<20)
+#define MS_RELATIME    (1<<21)
+#define MS_KERNMOUNT   (1<<22)
+#define MS_I_VERSION   (1<<23)
+#define MS_STRICTATIME (1<<24)
+#define MS_LAZYTIME    (1<<25)
+#define MS_NOREMOTELOCK (1<<27)
+#define MS_NOSEC       (1<<28)
+#define MS_BORN        (1<<29)
+#define MS_ACTIVE      (1<<30)
+#define MS_NOUSER      (1U<<31)
+
+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
+
+#define MS_MGC_VAL 0xc0ed0000
+#define MS_MGC_MSK 0xffff0000
+
+#define MNT_FORCE       1
+#define MNT_DETACH      2
+#define MNT_EXPIRE      4
+#define UMOUNT_NOFOLLOW 8
+
+int mount(const char *, const char *, const char *, unsigned long, const void *);
+int umount(const char *);
+int umount2(const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/msg.h b/musl-include/i386/sys/msg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/msg.h
@@ -0,0 +1,53 @@
+#ifndef _SYS_MSG_H
+#define _SYS_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ipc.h>
+
+#define __NEED_pid_t
+#define __NEED_key_t
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+
+#include <bits/alltypes.h>
+
+typedef unsigned long msgqnum_t;
+typedef unsigned long msglen_t;
+
+#include <bits/msg.h>
+
+#define __msg_cbytes msg_cbytes
+
+#define MSG_NOERROR 010000
+#define MSG_EXCEPT  020000
+
+#define MSG_STAT (11 | (IPC_STAT & 0x100))
+#define MSG_INFO 12
+#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100))
+
+struct msginfo {
+	int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;
+	unsigned short msgseg;
+};
+
+int msgctl (int, int, struct msqid_ds *);
+int msgget (key_t, int);
+ssize_t msgrcv (int, void *, size_t, long, int);
+int msgsnd (int, const void *, size_t, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct msgbuf {
+	long mtype;
+	char mtext[1];
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/mtio.h b/musl-include/i386/sys/mtio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/mtio.h
@@ -0,0 +1,188 @@
+#ifndef _SYS_MTIO_H
+#define _SYS_MTIO_H
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+struct mtop {
+	short mt_op;
+	int mt_count;
+};
+
+#define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0)
+#define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0)
+#define _IOT_mtpos _IOT_SIMPLE (long)
+#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1)
+
+
+#define MTRESET 0
+#define MTFSF	1
+#define MTBSF	2
+#define MTFSR	3
+#define MTBSR	4
+#define MTWEOF	5
+#define MTREW	6
+#define MTOFFL	7
+#define MTNOP	8
+#define MTRETEN 9
+#define MTBSFM	10
+#define MTFSFM  11
+#define MTEOM	12
+#define MTERASE 13
+#define MTRAS1  14
+#define MTRAS2	15
+#define MTRAS3  16
+#define MTSETBLK 20
+#define MTSETDENSITY 21
+#define MTSEEK	22
+#define MTTELL	23
+#define MTSETDRVBUFFER 24
+#define MTFSS	25
+#define MTBSS	26
+#define MTWSM	27
+#define MTLOCK  28
+#define MTUNLOCK 29
+#define MTLOAD  30
+#define MTUNLOAD 31
+#define MTCOMPRESSION 32
+#define MTSETPART 33
+#define MTMKPART  34
+
+struct mtget {
+	long mt_type;
+	long mt_resid;
+	long mt_dsreg;
+	long mt_gstat;
+	long mt_erreg;
+	int mt_fileno;
+	int mt_blkno;
+};
+
+#define MT_ISUNKNOWN		0x01
+#define MT_ISQIC02		0x02
+#define MT_ISWT5150		0x03
+#define MT_ISARCHIVE_5945L2	0x04
+#define MT_ISCMSJ500		0x05
+#define MT_ISTDC3610		0x06
+#define MT_ISARCHIVE_VP60I	0x07
+#define MT_ISARCHIVE_2150L	0x08
+#define MT_ISARCHIVE_2060L	0x09
+#define MT_ISARCHIVESC499	0x0A
+#define MT_ISQIC02_ALL_FEATURES	0x0F
+#define MT_ISWT5099EEN24	0x11
+#define MT_ISTEAC_MT2ST		0x12
+#define MT_ISEVEREX_FT40A	0x32
+#define MT_ISDDS1		0x51
+#define MT_ISDDS2		0x52
+#define MT_ISSCSI1		0x71
+#define MT_ISSCSI2		0x72
+#define MT_ISFTAPE_UNKNOWN	0x800000
+#define MT_ISFTAPE_FLAG		0x800000
+
+struct mt_tape_info {
+	long t_type;
+	char *t_name;
+};
+
+#define MT_TAPE_INFO \
+{									      \
+	{MT_ISUNKNOWN,		"Unknown type of tape device"},		      \
+	{MT_ISQIC02,		"Generic QIC-02 tape streamer"},	      \
+	{MT_ISWT5150,		"Wangtek 5150, QIC-150"},		      \
+	{MT_ISARCHIVE_5945L2,	"Archive 5945L-2"},			      \
+	{MT_ISCMSJ500,		"CMS Jumbo 500"},			      \
+	{MT_ISTDC3610,		"Tandberg TDC 3610, QIC-24"},		      \
+	{MT_ISARCHIVE_VP60I,	"Archive VP60i, QIC-02"},		      \
+	{MT_ISARCHIVE_2150L,	"Archive Viper 2150L"},			      \
+	{MT_ISARCHIVE_2060L,	"Archive Viper 2060L"},			      \
+	{MT_ISARCHIVESC499,	"Archive SC-499 QIC-36 controller"},	      \
+	{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"},	      \
+	{MT_ISWT5099EEN24,	"Wangtek 5099-een24, 60MB"},		      \
+	{MT_ISTEAC_MT2ST,	"Teac MT-2ST 155mb data cassette drive"},     \
+	{MT_ISEVEREX_FT40A,	"Everex FT40A, QIC-40"},		      \
+	{MT_ISSCSI1,		"Generic SCSI-1 tape"},			      \
+	{MT_ISSCSI2,		"Generic SCSI-2 tape"},			      \
+	{0, 0}								      \
+}
+
+struct mtpos {
+	long mt_blkno;
+};
+
+struct mtconfiginfo  {
+	long mt_type;
+	long ifc_type;
+	unsigned short irqnr;
+	unsigned short dmanr;
+	unsigned short port;
+	unsigned long debug;
+	unsigned have_dens:1;
+	unsigned have_bsf:1;
+	unsigned have_fsr:1;
+	unsigned have_bsr:1;
+	unsigned have_eod:1;
+	unsigned have_seek:1;
+	unsigned have_tell:1;
+	unsigned have_ras1:1;
+	unsigned have_ras2:1;
+	unsigned have_ras3:1;
+	unsigned have_qfa:1;
+	unsigned pad1:5;
+	char reserved[10];
+};
+
+#define	MTIOCTOP _IOW('m', 1, struct mtop)
+#define	MTIOCGET _IOR('m', 2, struct mtget)
+#define	MTIOCPOS _IOR('m', 3, struct mtpos)
+
+#define	MTIOCGETCONFIG	_IOR('m', 4, struct mtconfiginfo)
+#define	MTIOCSETCONFIG	_IOW('m', 5, struct mtconfiginfo)
+
+#define GMT_EOF(x)              ((x) & 0x80000000)
+#define GMT_BOT(x)              ((x) & 0x40000000)
+#define GMT_EOT(x)              ((x) & 0x20000000)
+#define GMT_SM(x)               ((x) & 0x10000000)
+#define GMT_EOD(x)              ((x) & 0x08000000)
+#define GMT_WR_PROT(x)          ((x) & 0x04000000)
+#define GMT_ONLINE(x)           ((x) & 0x01000000)
+#define GMT_D_6250(x)           ((x) & 0x00800000)
+#define GMT_D_1600(x)           ((x) & 0x00400000)
+#define GMT_D_800(x)            ((x) & 0x00200000)
+#define GMT_DR_OPEN(x)          ((x) & 0x00040000)
+#define GMT_IM_REP_EN(x)        ((x) & 0x00010000)
+
+#define MT_ST_BLKSIZE_SHIFT	0
+#define MT_ST_BLKSIZE_MASK	0xffffff
+#define MT_ST_DENSITY_SHIFT	24
+#define MT_ST_DENSITY_MASK	0xff000000
+#define MT_ST_SOFTERR_SHIFT	0
+#define MT_ST_SOFTERR_MASK	0xffff
+#define MT_ST_OPTIONS		0xf0000000
+#define MT_ST_BOOLEANS		0x10000000
+#define MT_ST_SETBOOLEANS	0x30000000
+#define MT_ST_CLEARBOOLEANS	0x40000000
+#define MT_ST_WRITE_THRESHOLD	0x20000000
+#define MT_ST_DEF_BLKSIZE	0x50000000
+#define MT_ST_DEF_OPTIONS	0x60000000
+#define MT_ST_BUFFER_WRITES	0x1
+#define MT_ST_ASYNC_WRITES	0x2
+#define MT_ST_READ_AHEAD	0x4
+#define MT_ST_DEBUGGING		0x8
+#define MT_ST_TWO_FM		0x10
+#define MT_ST_FAST_MTEOM	0x20
+#define MT_ST_AUTO_LOCK		0x40
+#define MT_ST_DEF_WRITES	0x80
+#define MT_ST_CAN_BSR		0x100
+#define MT_ST_NO_BLKLIMS	0x200
+#define MT_ST_CAN_PARTITIONS    0x400
+#define MT_ST_SCSI2LOGICAL      0x800
+#define MT_ST_CLEAR_DEFAULT	0xfffff
+#define MT_ST_DEF_DENSITY	(MT_ST_DEF_OPTIONS | 0x100000)
+#define MT_ST_DEF_COMPRESSION	(MT_ST_DEF_OPTIONS | 0x200000)
+#define MT_ST_DEF_DRVBUFFER	(MT_ST_DEF_OPTIONS | 0x300000)
+#define MT_ST_HPLOADER_OFFSET 10000
+#ifndef DEFTAPE
+# define DEFTAPE	"/dev/tape"
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/param.h b/musl-include/i386/sys/param.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/param.h
@@ -0,0 +1,35 @@
+#ifndef _SYS_PARAM_H
+#define _SYS_PARAM_H
+
+#define MAXSYMLINKS 20
+#define MAXHOSTNAMELEN 64
+#define MAXNAMLEN 255
+#define MAXPATHLEN 4096
+#define NBBY 8
+#define NGROUPS 32
+#define CANBSIZ 255
+#define NOFILE 256
+#define NCARGS 131072
+#define DEV_BSIZE 512
+#define NOGROUP (-1)
+
+#undef MIN
+#undef MAX
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
+#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8))
+#define setbit(x,i) __bitop(x,i,|=)
+#define clrbit(x,i) __bitop(x,i,&=~)
+#define isset(x,i) __bitop(x,i,&)
+#define isclr(x,i) !isset(x,i)
+
+#define howmany(n,d) (((n)+((d)-1))/(d))
+#define roundup(n,d) (howmany(n,d)*(d))
+#define powerof2(n) !(((n)-1) & (n))
+
+#include <sys/resource.h>
+#include <endian.h>
+#include <limits.h>
+
+#endif
diff --git a/musl-include/i386/sys/personality.h b/musl-include/i386/sys/personality.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/personality.h
@@ -0,0 +1,49 @@
+#ifndef _PERSONALITY_H
+#define _PERSONALITY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UNAME26            0x0020000
+#define ADDR_NO_RANDOMIZE  0x0040000
+#define FDPIC_FUNCPTRS     0x0080000
+#define MMAP_PAGE_ZERO     0x0100000
+#define ADDR_COMPAT_LAYOUT 0x0200000
+#define READ_IMPLIES_EXEC  0x0400000
+#define ADDR_LIMIT_32BIT   0x0800000
+#define SHORT_INODE        0x1000000
+#define WHOLE_SECONDS      0x2000000
+#define STICKY_TIMEOUTS    0x4000000
+#define ADDR_LIMIT_3GB     0x8000000
+
+#define PER_LINUX 0
+#define PER_LINUX_32BIT ADDR_LIMIT_32BIT
+#define PER_LINUX_FDPIC FDPIC_FUNCPTRS
+#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE)
+#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS)
+#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_ISCR4 (5 | STICKY_TIMEOUTS)
+#define PER_BSD 6
+#define PER_SUNOS (6 | STICKY_TIMEOUTS)
+#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_LINUX32 8
+#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB)
+#define PER_IRIX32 (9 | STICKY_TIMEOUTS)
+#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS)
+#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS)
+#define PER_RISCOS 0xc
+#define PER_SOLARIS (0xd | STICKY_TIMEOUTS)
+#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_OSF4 0xf
+#define PER_HPUX 0x10
+#define PER_MASK 0xff
+
+int personality(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/poll.h b/musl-include/i386/sys/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/poll.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
+#include <poll.h>
diff --git a/musl-include/i386/sys/prctl.h b/musl-include/i386/sys/prctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/prctl.h
@@ -0,0 +1,186 @@
+#ifndef _SYS_PRCTL_H
+#define _SYS_PRCTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define PR_SET_PDEATHSIG  1
+#define PR_GET_PDEATHSIG  2
+#define PR_GET_DUMPABLE   3
+#define PR_SET_DUMPABLE   4
+#define PR_GET_UNALIGN   5
+#define PR_SET_UNALIGN   6
+#define PR_UNALIGN_NOPRINT 1
+#define PR_UNALIGN_SIGBUS 2
+#define PR_GET_KEEPCAPS   7
+#define PR_SET_KEEPCAPS   8
+#define PR_GET_FPEMU  9
+#define PR_SET_FPEMU 10
+#define PR_FPEMU_NOPRINT 1
+#define PR_FPEMU_SIGFPE 2
+#define PR_GET_FPEXC 11
+#define PR_SET_FPEXC 12
+#define PR_FP_EXC_SW_ENABLE 0x80
+#define PR_FP_EXC_DIV  0x010000
+#define PR_FP_EXC_OVF  0x020000
+#define PR_FP_EXC_UND  0x040000
+#define PR_FP_EXC_RES  0x080000
+#define PR_FP_EXC_INV  0x100000
+#define PR_FP_EXC_DISABLED 0
+#define PR_FP_EXC_NONRECOV 1
+#define PR_FP_EXC_ASYNC 2
+#define PR_FP_EXC_PRECISE 3
+#define PR_GET_TIMING   13
+#define PR_SET_TIMING   14
+#define PR_TIMING_STATISTICAL  0
+#define PR_TIMING_TIMESTAMP    1
+#define PR_SET_NAME    15
+#define PR_GET_NAME    16
+#define PR_GET_ENDIAN 19
+#define PR_SET_ENDIAN 20
+#define PR_ENDIAN_BIG 0
+#define PR_ENDIAN_LITTLE 1
+#define PR_ENDIAN_PPC_LITTLE 2
+#define PR_GET_SECCOMP 21
+#define PR_SET_SECCOMP 22
+#define PR_CAPBSET_READ 23
+#define PR_CAPBSET_DROP 24
+#define PR_GET_TSC 25
+#define PR_SET_TSC 26
+#define PR_TSC_ENABLE 1
+#define PR_TSC_SIGSEGV 2
+#define PR_GET_SECUREBITS 27
+#define PR_SET_SECUREBITS 28
+#define PR_SET_TIMERSLACK 29
+#define PR_GET_TIMERSLACK 30
+
+#define PR_TASK_PERF_EVENTS_DISABLE             31
+#define PR_TASK_PERF_EVENTS_ENABLE              32
+
+#define PR_MCE_KILL     33
+#define PR_MCE_KILL_CLEAR   0
+#define PR_MCE_KILL_SET     1
+#define PR_MCE_KILL_LATE    0
+#define PR_MCE_KILL_EARLY   1
+#define PR_MCE_KILL_DEFAULT 2
+#define PR_MCE_KILL_GET 34
+
+#define PR_SET_MM               35
+#define PR_SET_MM_START_CODE           1
+#define PR_SET_MM_END_CODE             2
+#define PR_SET_MM_START_DATA           3
+#define PR_SET_MM_END_DATA             4
+#define PR_SET_MM_START_STACK          5
+#define PR_SET_MM_START_BRK            6
+#define PR_SET_MM_BRK                  7
+#define PR_SET_MM_ARG_START            8
+#define PR_SET_MM_ARG_END              9
+#define PR_SET_MM_ENV_START            10
+#define PR_SET_MM_ENV_END              11
+#define PR_SET_MM_AUXV                 12
+#define PR_SET_MM_EXE_FILE             13
+#define PR_SET_MM_MAP                  14
+#define PR_SET_MM_MAP_SIZE             15
+
+struct prctl_mm_map {
+	uint64_t start_code;
+	uint64_t end_code;
+	uint64_t start_data;
+	uint64_t end_data;
+	uint64_t start_brk;
+	uint64_t brk;
+	uint64_t start_stack;
+	uint64_t arg_start;
+	uint64_t arg_end;
+	uint64_t env_start;
+	uint64_t env_end;
+	uint64_t *auxv;
+	uint32_t auxv_size;
+	uint32_t exe_fd;
+};
+
+#define PR_SET_PTRACER 0x59616d61
+#define PR_SET_PTRACER_ANY (-1UL)
+
+#define PR_SET_CHILD_SUBREAPER  36
+#define PR_GET_CHILD_SUBREAPER  37
+
+#define PR_SET_NO_NEW_PRIVS     38
+#define PR_GET_NO_NEW_PRIVS     39
+
+#define PR_GET_TID_ADDRESS      40
+
+#define PR_SET_THP_DISABLE      41
+#define PR_GET_THP_DISABLE      42
+
+#define PR_MPX_ENABLE_MANAGEMENT  43
+#define PR_MPX_DISABLE_MANAGEMENT 44
+
+#define PR_SET_FP_MODE          45
+#define PR_GET_FP_MODE          46
+#define PR_FP_MODE_FR (1 << 0)
+#define PR_FP_MODE_FRE (1 << 1)
+
+#define PR_CAP_AMBIENT          47
+#define PR_CAP_AMBIENT_IS_SET   1
+#define PR_CAP_AMBIENT_RAISE    2
+#define PR_CAP_AMBIENT_LOWER    3
+#define PR_CAP_AMBIENT_CLEAR_ALL 4
+
+#define PR_SVE_SET_VL           50
+#define PR_SVE_SET_VL_ONEXEC (1 << 18)
+#define PR_SVE_GET_VL           51
+#define PR_SVE_VL_LEN_MASK 0xffff
+#define PR_SVE_VL_INHERIT (1 << 17)
+
+#define PR_GET_SPECULATION_CTRL 52
+#define PR_SET_SPECULATION_CTRL 53
+#define PR_SPEC_STORE_BYPASS 0
+#define PR_SPEC_INDIRECT_BRANCH 1
+#define PR_SPEC_NOT_AFFECTED 0
+#define PR_SPEC_PRCTL (1UL << 0)
+#define PR_SPEC_ENABLE (1UL << 1)
+#define PR_SPEC_DISABLE (1UL << 2)
+#define PR_SPEC_FORCE_DISABLE (1UL << 3)
+#define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
+
+#define PR_PAC_RESET_KEYS       54
+#define PR_PAC_APIAKEY (1UL << 0)
+#define PR_PAC_APIBKEY (1UL << 1)
+#define PR_PAC_APDAKEY (1UL << 2)
+#define PR_PAC_APDBKEY (1UL << 3)
+#define PR_PAC_APGAKEY (1UL << 4)
+
+#define PR_SET_TAGGED_ADDR_CTRL 55
+#define PR_GET_TAGGED_ADDR_CTRL 56
+#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
+#define PR_MTE_TCF_SHIFT 1
+#define PR_MTE_TCF_NONE  (0UL << 1)
+#define PR_MTE_TCF_SYNC  (1UL << 1)
+#define PR_MTE_TCF_ASYNC (2UL << 1)
+#define PR_MTE_TCF_MASK  (3UL << 1)
+#define PR_MTE_TAG_SHIFT 3
+#define PR_MTE_TAG_MASK  (0xffffUL << 3)
+
+#define PR_SET_IO_FLUSHER 57
+#define PR_GET_IO_FLUSHER 58
+
+#define PR_SET_SYSCALL_USER_DISPATCH 59
+#define PR_SYS_DISPATCH_OFF 0
+#define PR_SYS_DISPATCH_ON 1
+#define SYSCALL_DISPATCH_FILTER_ALLOW 0
+#define SYSCALL_DISPATCH_FILTER_BLOCK 1
+
+#define PR_PAC_SET_ENABLED_KEYS 60
+#define PR_PAC_GET_ENABLED_KEYS 61
+
+int prctl (int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/procfs.h b/musl-include/i386/sys/procfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/procfs.h
@@ -0,0 +1,63 @@
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+struct elf_siginfo {
+	int si_signo;
+	int si_code;
+	int si_errno;
+};
+
+struct elf_prstatus {
+	struct elf_siginfo pr_info;
+	short int pr_cursig;
+	unsigned long int pr_sigpend;
+	unsigned long int pr_sighold;
+	pid_t pr_pid;
+	pid_t pr_ppid;
+	pid_t pr_pgrp;
+	pid_t pr_sid;
+	struct {
+		long tv_sec, tv_usec;
+	} pr_utime, pr_stime, pr_cutime, pr_cstime;
+	elf_gregset_t pr_reg;
+	int pr_fpvalid;
+};
+
+#define ELF_PRARGSZ 80
+
+struct elf_prpsinfo {
+	char pr_state;
+	char pr_sname;
+	char pr_zomb;
+	char pr_nice;
+	unsigned long int pr_flag;
+#if UINTPTR_MAX == 0xffffffff
+	unsigned short int pr_uid;
+	unsigned short int pr_gid;
+#else
+	unsigned int pr_uid;
+	unsigned int pr_gid;
+#endif
+	int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+	char pr_fname[16];
+	char pr_psargs[ELF_PRARGSZ];
+};
+
+typedef void *psaddr_t;
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+typedef pid_t lwpid_t;
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/ptrace.h b/musl-include/i386/sys/ptrace.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/ptrace.h
@@ -0,0 +1,147 @@
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define PTRACE_TRACEME 0
+#define PT_TRACE_ME PTRACE_TRACEME
+
+#define PTRACE_PEEKTEXT 1
+#define PTRACE_PEEKDATA 2
+#define PTRACE_PEEKUSER 3
+#define PTRACE_POKETEXT 4
+#define PTRACE_POKEDATA 5
+#define PTRACE_POKEUSER 6
+#define PTRACE_CONT 7
+#define PTRACE_KILL 8
+#define PTRACE_SINGLESTEP 9
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+#define PTRACE_ATTACH 16
+#define PTRACE_DETACH 17
+#define PTRACE_GETFPXREGS 18
+#define PTRACE_SETFPXREGS 19
+#define PTRACE_SYSCALL 24
+#define PTRACE_SETOPTIONS 0x4200
+#define PTRACE_GETEVENTMSG 0x4201
+#define PTRACE_GETSIGINFO 0x4202
+#define PTRACE_SETSIGINFO 0x4203
+#define PTRACE_GETREGSET 0x4204
+#define PTRACE_SETREGSET 0x4205
+#define PTRACE_SEIZE 0x4206
+#define PTRACE_INTERRUPT 0x4207
+#define PTRACE_LISTEN 0x4208
+#define PTRACE_PEEKSIGINFO 0x4209
+#define PTRACE_GETSIGMASK 0x420a
+#define PTRACE_SETSIGMASK 0x420b
+#define PTRACE_SECCOMP_GET_FILTER 0x420c
+#define PTRACE_SECCOMP_GET_METADATA 0x420d
+#define PTRACE_GET_SYSCALL_INFO 0x420e
+#define PTRACE_GET_RSEQ_CONFIGURATION	0x420f
+
+#define PT_READ_I PTRACE_PEEKTEXT
+#define PT_READ_D PTRACE_PEEKDATA
+#define PT_READ_U PTRACE_PEEKUSER
+#define PT_WRITE_I PTRACE_POKETEXT
+#define PT_WRITE_D PTRACE_POKEDATA
+#define PT_WRITE_U PTRACE_POKEUSER
+#define PT_CONTINUE PTRACE_CONT
+#define PT_KILL PTRACE_KILL
+#define PT_STEP PTRACE_SINGLESTEP
+#define PT_GETREGS PTRACE_GETREGS
+#define PT_SETREGS PTRACE_SETREGS
+#define PT_GETFPREGS PTRACE_GETFPREGS
+#define PT_SETFPREGS PTRACE_SETFPREGS
+#define PT_ATTACH PTRACE_ATTACH
+#define PT_DETACH PTRACE_DETACH
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+#define PT_SYSCALL PTRACE_SYSCALL
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+
+#define PTRACE_O_TRACESYSGOOD   0x00000001
+#define PTRACE_O_TRACEFORK      0x00000002
+#define PTRACE_O_TRACEVFORK     0x00000004
+#define PTRACE_O_TRACECLONE     0x00000008
+#define PTRACE_O_TRACEEXEC      0x00000010
+#define PTRACE_O_TRACEVFORKDONE 0x00000020
+#define PTRACE_O_TRACEEXIT      0x00000040
+#define PTRACE_O_TRACESECCOMP   0x00000080
+#define PTRACE_O_EXITKILL       0x00100000
+#define PTRACE_O_SUSPEND_SECCOMP 0x00200000
+#define PTRACE_O_MASK           0x003000ff
+
+#define PTRACE_EVENT_FORK 1
+#define PTRACE_EVENT_VFORK 2
+#define PTRACE_EVENT_CLONE 3
+#define PTRACE_EVENT_EXEC 4
+#define PTRACE_EVENT_VFORK_DONE 5
+#define PTRACE_EVENT_EXIT 6
+#define PTRACE_EVENT_SECCOMP 7
+#define PTRACE_EVENT_STOP 128
+
+#define PTRACE_PEEKSIGINFO_SHARED 1
+
+#define PTRACE_SYSCALL_INFO_NONE 0
+#define PTRACE_SYSCALL_INFO_ENTRY 1
+#define PTRACE_SYSCALL_INFO_EXIT 2
+#define PTRACE_SYSCALL_INFO_SECCOMP 3
+
+#include <bits/ptrace.h>
+
+struct __ptrace_peeksiginfo_args {
+	uint64_t off;
+	uint32_t flags;
+	int32_t nr;
+};
+
+struct __ptrace_seccomp_metadata {
+	uint64_t filter_off;
+	uint64_t flags;
+};
+
+struct __ptrace_syscall_info {
+	uint8_t op;
+	uint8_t __pad[3];
+	uint32_t arch;
+	uint64_t instruction_pointer;
+	uint64_t stack_pointer;
+	union {
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+		} entry;
+		struct {
+			int64_t rval;
+			uint8_t is_error;
+		} exit;
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+			uint32_t ret_data;
+		} seccomp;
+	};
+};
+
+struct __ptrace_rseq_configuration {
+	uint64_t rseq_abi_pointer;
+	uint32_t rseq_abi_size;
+	uint32_t signature;
+	uint32_t flags;
+	uint32_t pad;
+};
+
+long ptrace(int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/quota.h b/musl-include/i386/sys/quota.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/quota.h
@@ -0,0 +1,102 @@
+#ifndef _SYS_QUOTA_H
+#define _SYS_QUOTA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define _LINUX_QUOTA_VERSION 2
+
+#define dbtob(num) ((num) << 10)
+#define btodb(num) ((num) >> 10)
+#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024)
+
+#define MAX_IQ_TIME 604800
+#define MAX_DQ_TIME 604800
+
+#define MAXQUOTAS 2
+#define USRQUOTA  0
+#define GRPQUOTA  1
+
+#define INITQFNAMES { "user", "group", "undefined" };
+
+#define QUOTAFILENAME "quota"
+#define QUOTAGROUP "staff"
+
+#define NR_DQHASH 43
+#define NR_DQUOTS 256
+
+#define SUBCMDMASK       0x00ff
+#define SUBCMDSHIFT      8
+#define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
+
+#define Q_SYNC     0x800001
+#define Q_QUOTAON  0x800002
+#define Q_QUOTAOFF 0x800003
+#define Q_GETFMT   0x800004
+#define Q_GETINFO  0x800005
+#define Q_SETINFO  0x800006
+#define Q_GETQUOTA 0x800007
+#define Q_SETQUOTA 0x800008
+
+#define	QFMT_VFS_OLD 1
+#define	QFMT_VFS_V0 2
+#define QFMT_OCFS2 3
+#define	QFMT_VFS_V1 4
+
+#define QIF_BLIMITS	1
+#define QIF_SPACE	2
+#define QIF_ILIMITS	4
+#define QIF_INODES	8
+#define QIF_BTIME	16
+#define QIF_ITIME	32
+#define QIF_LIMITS	(QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE	(QIF_SPACE | QIF_INODES)
+#define QIF_TIMES	(QIF_BTIME | QIF_ITIME)
+#define QIF_ALL		(QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk {
+	uint64_t dqb_bhardlimit;
+	uint64_t dqb_bsoftlimit;
+	uint64_t dqb_curspace;
+	uint64_t dqb_ihardlimit;
+	uint64_t dqb_isoftlimit;
+	uint64_t dqb_curinodes;
+	uint64_t dqb_btime;
+	uint64_t dqb_itime;
+	uint32_t dqb_valid;
+};
+
+#define	dq_bhardlimit	dq_dqb.dqb_bhardlimit
+#define	dq_bsoftlimit	dq_dqb.dqb_bsoftlimit
+#define dq_curspace	dq_dqb.dqb_curspace
+#define dq_valid	dq_dqb.dqb_valid
+#define	dq_ihardlimit	dq_dqb.dqb_ihardlimit
+#define	dq_isoftlimit	dq_dqb.dqb_isoftlimit
+#define	dq_curinodes	dq_dqb.dqb_curinodes
+#define	dq_btime	dq_dqb.dqb_btime
+#define	dq_itime	dq_dqb.dqb_itime
+
+#define dqoff(UID)      ((long long)(UID) * sizeof (struct dqblk))
+
+#define IIF_BGRACE	1
+#define IIF_IGRACE	2
+#define IIF_FLAGS	4
+#define IIF_ALL		(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo {
+	uint64_t dqi_bgrace;
+	uint64_t dqi_igrace;
+	uint32_t dqi_flags;
+	uint32_t dqi_valid;
+};
+
+int quotactl(int, const char *, int, char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/random.h b/musl-include/i386/sys/random.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/random.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_RANDOM_H
+#define _SYS_RANDOM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#include <bits/alltypes.h>
+
+#define GRND_NONBLOCK	0x0001
+#define GRND_RANDOM	0x0002
+#define GRND_INSECURE	0x0004
+
+ssize_t getrandom(void *, size_t, unsigned);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/reboot.h b/musl-include/i386/sys/reboot.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/reboot.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_REBOOT_H
+#define _SYS_REBOOT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RB_AUTOBOOT     0x01234567
+#define RB_HALT_SYSTEM  0xcdef0123
+#define RB_ENABLE_CAD   0x89abcdef
+#define RB_DISABLE_CAD  0
+#define RB_POWER_OFF    0x4321fedc
+#define RB_SW_SUSPEND   0xd000fce2
+#define RB_KEXEC        0x45584543
+
+int reboot(int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/reg.h b/musl-include/i386/sys/reg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/reg.h
@@ -0,0 +1,9 @@
+#ifndef _SYS_REG_H
+#define _SYS_REG_H
+
+#include <limits.h>
+#include <unistd.h>
+
+#include <bits/reg.h>
+
+#endif
diff --git a/musl-include/i386/sys/resource.h b/musl-include/i386/sys/resource.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/resource.h
@@ -0,0 +1,116 @@
+#ifndef	_SYS_RESOURCE_H
+#define	_SYS_RESOURCE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/time.h>
+
+#define __NEED_id_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_pid_t
+#endif
+
+#include <bits/alltypes.h>
+#include <bits/resource.h>
+
+typedef unsigned long long rlim_t;
+
+struct rlimit {
+	rlim_t rlim_cur;
+	rlim_t rlim_max;
+};
+
+struct rusage {
+	struct timeval ru_utime;
+	struct timeval ru_stime;
+	/* linux extentions, but useful */
+	long	ru_maxrss;
+	long	ru_ixrss;
+	long	ru_idrss;
+	long	ru_isrss;
+	long	ru_minflt;
+	long	ru_majflt;
+	long	ru_nswap;
+	long	ru_inblock;
+	long	ru_oublock;
+	long	ru_msgsnd;
+	long	ru_msgrcv;
+	long	ru_nsignals;
+	long	ru_nvcsw;
+	long	ru_nivcsw;
+	/* room for more... */
+	long    __reserved[16];
+};
+
+int getrlimit (int, struct rlimit *);
+int setrlimit (int, const struct rlimit *);
+int getrusage (int, struct rusage *);
+
+int getpriority (int, id_t);
+int setpriority (int, id_t, int);
+
+#ifdef _GNU_SOURCE
+int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
+#define prlimit64 prlimit
+#endif
+
+#define PRIO_MIN (-20)
+#define PRIO_MAX 20
+
+#define PRIO_PROCESS 0
+#define PRIO_PGRP    1
+#define PRIO_USER    2
+
+#define RUSAGE_SELF     0
+#define RUSAGE_CHILDREN (-1)
+#define RUSAGE_THREAD   1
+
+#define RLIM_INFINITY (~0ULL)
+#define RLIM_SAVED_CUR RLIM_INFINITY
+#define RLIM_SAVED_MAX RLIM_INFINITY
+
+#define RLIMIT_CPU     0
+#define RLIMIT_FSIZE   1
+#define RLIMIT_DATA    2
+#define RLIMIT_STACK   3
+#define RLIMIT_CORE    4
+#ifndef RLIMIT_RSS
+#define RLIMIT_RSS     5
+#define RLIMIT_NPROC   6
+#define RLIMIT_NOFILE  7
+#define RLIMIT_MEMLOCK 8
+#define RLIMIT_AS      9
+#endif
+#define RLIMIT_LOCKS   10
+#define RLIMIT_SIGPENDING 11
+#define RLIMIT_MSGQUEUE 12
+#define RLIMIT_NICE    13
+#define RLIMIT_RTPRIO  14
+#define RLIMIT_RTTIME  15
+#define RLIMIT_NLIMITS 16
+
+#define RLIM_NLIMITS RLIMIT_NLIMITS
+
+#if defined(_LARGEFILE64_SOURCE)
+#define RLIM64_INFINITY RLIM_INFINITY
+#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
+#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
+#define getrlimit64 getrlimit
+#define setrlimit64 setrlimit
+#define rlimit64 rlimit
+#define rlim64_t rlim_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(getrusage, __getrusage_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/select.h b/musl-include/i386/sys/select.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/select.h
@@ -0,0 +1,46 @@
+#ifndef _SYS_SELECT_H
+#define _SYS_SELECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_struct_timeval
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define FD_SETSIZE 1024
+
+typedef unsigned long fd_mask;
+
+typedef struct {
+	unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)];
+} fd_set;
+
+#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0)
+#define FD_SET(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
+#define FD_CLR(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
+#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
+
+int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict);
+int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define NFDBITS (8*(int)sizeof(long))
+#endif
+
+#if _REDIR_TIME64
+__REDIR(select, __select_time64);
+__REDIR(pselect, __pselect_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/sem.h b/musl-include/i386/sys/sem.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/sem.h
@@ -0,0 +1,72 @@
+#ifndef _SYS_SEM_H
+#define _SYS_SEM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_pid_t
+#define __NEED_time_t
+#ifdef _GNU_SOURCE
+#define __NEED_struct_timespec
+#endif
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+
+#define SEM_UNDO	0x1000
+#define GETPID		11
+#define GETVAL		12
+#define GETALL		13
+#define GETNCNT		14
+#define GETZCNT		15
+#define SETVAL		16
+#define SETALL		17
+
+#include <bits/sem.h>
+
+#define _SEM_SEMUN_UNDEFINED 1
+
+#define SEM_STAT (18 | (IPC_STAT & 0x100))
+#define SEM_INFO 19
+#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100))
+
+struct  seminfo {
+	int semmap;
+	int semmni;
+	int semmns;
+	int semmnu;
+	int semmsl;
+	int semopm;
+	int semume;
+	int semusz;
+	int semvmx;
+	int semaem;
+};
+
+struct sembuf {
+	unsigned short sem_num;
+	short sem_op;
+	short sem_flg;
+};
+
+int semctl(int, int, int, ...);
+int semget(key_t, int, int);
+int semop(int, struct sembuf *, size_t);
+
+#ifdef _GNU_SOURCE
+int semtimedop(int, struct sembuf *, size_t, const struct timespec *);
+#endif
+
+#if _REDIR_TIME64
+#ifdef _GNU_SOURCE
+__REDIR(semtimedop, __semtimedop_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/sendfile.h b/musl-include/i386/sys/sendfile.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/sendfile.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_SENDFILE_H
+#define _SYS_SENDFILE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <unistd.h>
+
+ssize_t sendfile(int, int, off_t *, size_t);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define sendfile64 sendfile
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/shm.h b/musl-include/i386/sys/shm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/shm.h
@@ -0,0 +1,70 @@
+#ifndef _SYS_SHM_H
+#define _SYS_SHM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_pid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+
+#ifdef _GNU_SOURCE
+#define __used_ids used_ids
+#define __swap_attempts swap_attempts
+#define __swap_successes swap_successes
+#endif
+
+#include <bits/shm.h>
+
+#define SHM_R 0400
+#define SHM_W 0200
+
+#define SHM_RDONLY 010000
+#define SHM_RND    020000
+#define SHM_REMAP  040000
+#define SHM_EXEC   0100000
+
+#define SHM_LOCK 11
+#define SHM_UNLOCK 12
+#define SHM_STAT (13 | (IPC_STAT & 0x100))
+#define SHM_INFO 14
+#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100))
+#define SHM_DEST 01000
+#define SHM_LOCKED 02000
+#define SHM_HUGETLB 04000
+#define SHM_NORESERVE 010000
+
+#define SHM_HUGE_SHIFT 26
+#define SHM_HUGE_MASK  0x3f
+#define SHM_HUGE_64KB  (16 << 26)
+#define SHM_HUGE_512KB (19 << 26)
+#define SHM_HUGE_1MB   (20 << 26)
+#define SHM_HUGE_2MB   (21 << 26)
+#define SHM_HUGE_8MB   (23 << 26)
+#define SHM_HUGE_16MB  (24 << 26)
+#define SHM_HUGE_32MB  (25 << 26)
+#define SHM_HUGE_256MB (28 << 26)
+#define SHM_HUGE_512MB (29 << 26)
+#define SHM_HUGE_1GB   (30 << 26)
+#define SHM_HUGE_2GB   (31 << 26)
+#define SHM_HUGE_16GB  (34U << 26)
+
+typedef unsigned long shmatt_t;
+
+void *shmat(int, const void *, int);
+int shmctl(int, int, struct shmid_ds *);
+int shmdt(const void *);
+int shmget(key_t, size_t, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/signal.h b/musl-include/i386/sys/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/signal.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/signal.h> to <signal.h>
+#include <signal.h>
diff --git a/musl-include/i386/sys/signalfd.h b/musl-include/i386/sys/signalfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/signalfd.h
@@ -0,0 +1,49 @@
+#ifndef _SYS_SIGNALFD_H
+#define _SYS_SIGNALFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define SFD_CLOEXEC O_CLOEXEC
+#define SFD_NONBLOCK O_NONBLOCK
+
+int signalfd(int, const sigset_t *, int);
+
+struct signalfd_siginfo {
+	uint32_t  ssi_signo;
+	int32_t   ssi_errno;
+	int32_t   ssi_code;
+	uint32_t  ssi_pid;
+	uint32_t  ssi_uid;
+	int32_t   ssi_fd;
+	uint32_t  ssi_tid;
+	uint32_t  ssi_band;
+	uint32_t  ssi_overrun;
+	uint32_t  ssi_trapno;
+	int32_t   ssi_status;
+	int32_t   ssi_int;
+	uint64_t  ssi_ptr;
+	uint64_t  ssi_utime;
+	uint64_t  ssi_stime;
+	uint64_t  ssi_addr;
+	uint16_t  ssi_addr_lsb;
+	uint16_t  __pad2;
+	int32_t   ssi_syscall;
+	uint64_t  ssi_call_addr;
+	uint32_t  ssi_arch;
+	uint8_t   __pad[128-14*4-5*8-2*2];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/socket.h b/musl-include/i386/sys/socket.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/socket.h
@@ -0,0 +1,415 @@
+#ifndef	_SYS_SOCKET_H
+#define	_SYS_SOCKET_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_socklen_t
+#define __NEED_sa_family_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_uid_t
+#define __NEED_pid_t
+#define __NEED_gid_t
+#define __NEED_struct_iovec
+
+#include <bits/alltypes.h>
+
+#include <bits/socket.h>
+
+struct msghdr {
+	void *msg_name;
+	socklen_t msg_namelen;
+	struct iovec *msg_iov;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad1;
+#endif
+	int msg_iovlen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad1;
+#endif
+	void *msg_control;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad2;
+#endif
+	socklen_t msg_controllen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad2;
+#endif
+	int msg_flags;
+};
+
+struct cmsghdr {
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad1;
+#endif
+	socklen_t cmsg_len;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad1;
+#endif
+	int cmsg_level;
+	int cmsg_type;
+};
+
+#ifdef _GNU_SOURCE
+struct ucred {
+	pid_t pid;
+	uid_t uid;
+	gid_t gid;
+};
+
+struct mmsghdr {
+	struct msghdr msg_hdr;
+	unsigned int  msg_len;
+};
+
+struct timespec;
+
+int sendmmsg (int, struct mmsghdr *, unsigned int, unsigned int);
+int recvmmsg (int, struct mmsghdr *, unsigned int, unsigned int, struct timespec *);
+#endif
+
+struct linger {
+	int l_onoff;
+	int l_linger;
+};
+
+#define SHUT_RD 0
+#define SHUT_WR 1
+#define SHUT_RDWR 2
+
+#ifndef SOCK_STREAM
+#define SOCK_STREAM    1
+#define SOCK_DGRAM     2
+#endif
+
+#define SOCK_RAW       3
+#define SOCK_RDM       4
+#define SOCK_SEQPACKET 5
+#define SOCK_DCCP      6
+#define SOCK_PACKET    10
+
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC   02000000
+#define SOCK_NONBLOCK  04000
+#endif
+
+#define PF_UNSPEC       0
+#define PF_LOCAL        1
+#define PF_UNIX         PF_LOCAL
+#define PF_FILE         PF_LOCAL
+#define PF_INET         2
+#define PF_AX25         3
+#define PF_IPX          4
+#define PF_APPLETALK    5
+#define PF_NETROM       6
+#define PF_BRIDGE       7
+#define PF_ATMPVC       8
+#define PF_X25          9
+#define PF_INET6        10
+#define PF_ROSE         11
+#define PF_DECnet       12
+#define PF_NETBEUI      13
+#define PF_SECURITY     14
+#define PF_KEY          15
+#define PF_NETLINK      16
+#define PF_ROUTE        PF_NETLINK
+#define PF_PACKET       17
+#define PF_ASH          18
+#define PF_ECONET       19
+#define PF_ATMSVC       20
+#define PF_RDS          21
+#define PF_SNA          22
+#define PF_IRDA         23
+#define PF_PPPOX        24
+#define PF_WANPIPE      25
+#define PF_LLC          26
+#define PF_IB           27
+#define PF_MPLS         28
+#define PF_CAN          29
+#define PF_TIPC         30
+#define PF_BLUETOOTH    31
+#define PF_IUCV         32
+#define PF_RXRPC        33
+#define PF_ISDN         34
+#define PF_PHONET       35
+#define PF_IEEE802154   36
+#define PF_CAIF         37
+#define PF_ALG          38
+#define PF_NFC          39
+#define PF_VSOCK        40
+#define PF_KCM          41
+#define PF_QIPCRTR      42
+#define PF_SMC          43
+#define PF_XDP          44
+#define PF_MAX          45
+
+#define AF_UNSPEC       PF_UNSPEC
+#define AF_LOCAL        PF_LOCAL
+#define AF_UNIX         AF_LOCAL
+#define AF_FILE         AF_LOCAL
+#define AF_INET         PF_INET
+#define AF_AX25         PF_AX25
+#define AF_IPX          PF_IPX
+#define AF_APPLETALK    PF_APPLETALK
+#define AF_NETROM       PF_NETROM
+#define AF_BRIDGE       PF_BRIDGE
+#define AF_ATMPVC       PF_ATMPVC
+#define AF_X25          PF_X25
+#define AF_INET6        PF_INET6
+#define AF_ROSE         PF_ROSE
+#define AF_DECnet       PF_DECnet
+#define AF_NETBEUI      PF_NETBEUI
+#define AF_SECURITY     PF_SECURITY
+#define AF_KEY          PF_KEY
+#define AF_NETLINK      PF_NETLINK
+#define AF_ROUTE        PF_ROUTE
+#define AF_PACKET       PF_PACKET
+#define AF_ASH          PF_ASH
+#define AF_ECONET       PF_ECONET
+#define AF_ATMSVC       PF_ATMSVC
+#define AF_RDS          PF_RDS
+#define AF_SNA          PF_SNA
+#define AF_IRDA         PF_IRDA
+#define AF_PPPOX        PF_PPPOX
+#define AF_WANPIPE      PF_WANPIPE
+#define AF_LLC          PF_LLC
+#define AF_IB           PF_IB
+#define AF_MPLS         PF_MPLS
+#define AF_CAN          PF_CAN
+#define AF_TIPC         PF_TIPC
+#define AF_BLUETOOTH    PF_BLUETOOTH
+#define AF_IUCV         PF_IUCV
+#define AF_RXRPC        PF_RXRPC
+#define AF_ISDN         PF_ISDN
+#define AF_PHONET       PF_PHONET
+#define AF_IEEE802154   PF_IEEE802154
+#define AF_CAIF         PF_CAIF
+#define AF_ALG          PF_ALG
+#define AF_NFC          PF_NFC
+#define AF_VSOCK        PF_VSOCK
+#define AF_KCM          PF_KCM
+#define AF_QIPCRTR      PF_QIPCRTR
+#define AF_SMC          PF_SMC
+#define AF_XDP          PF_XDP
+#define AF_MAX          PF_MAX
+
+#ifndef SO_DEBUG
+#define SO_DEBUG        1
+#define SO_REUSEADDR    2
+#define SO_TYPE         3
+#define SO_ERROR        4
+#define SO_DONTROUTE    5
+#define SO_BROADCAST    6
+#define SO_SNDBUF       7
+#define SO_RCVBUF       8
+#define SO_KEEPALIVE    9
+#define SO_OOBINLINE    10
+#define SO_NO_CHECK     11
+#define SO_PRIORITY     12
+#define SO_LINGER       13
+#define SO_BSDCOMPAT    14
+#define SO_REUSEPORT    15
+#define SO_PASSCRED     16
+#define SO_PEERCRED     17
+#define SO_RCVLOWAT     18
+#define SO_SNDLOWAT     19
+#define SO_ACCEPTCONN   30
+#define SO_PEERSEC      31
+#define SO_SNDBUFFORCE  32
+#define SO_RCVBUFFORCE  33
+#define SO_PROTOCOL     38
+#define SO_DOMAIN       39
+#endif
+
+#ifndef SO_RCVTIMEO
+#if __LONG_MAX == 0x7fffffff
+#define SO_RCVTIMEO     66
+#define SO_SNDTIMEO     67
+#else
+#define SO_RCVTIMEO     20
+#define SO_SNDTIMEO     21
+#endif
+#endif
+
+#ifndef SO_TIMESTAMP
+#if __LONG_MAX == 0x7fffffff
+#define SO_TIMESTAMP    63
+#define SO_TIMESTAMPNS  64
+#define SO_TIMESTAMPING 65
+#else
+#define SO_TIMESTAMP    29
+#define SO_TIMESTAMPNS  35
+#define SO_TIMESTAMPING 37
+#endif
+#endif
+
+#define SO_SECURITY_AUTHENTICATION              22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT        23
+#define SO_SECURITY_ENCRYPTION_NETWORK          24
+
+#define SO_BINDTODEVICE 25
+
+#define SO_ATTACH_FILTER        26
+#define SO_DETACH_FILTER        27
+#define SO_GET_FILTER           SO_ATTACH_FILTER
+
+#define SO_PEERNAME             28
+#define SCM_TIMESTAMP           SO_TIMESTAMP
+#define SO_PASSSEC              34
+#define SCM_TIMESTAMPNS         SO_TIMESTAMPNS
+#define SO_MARK                 36
+#define SCM_TIMESTAMPING        SO_TIMESTAMPING
+#define SO_RXQ_OVFL             40
+#define SO_WIFI_STATUS          41
+#define SCM_WIFI_STATUS         SO_WIFI_STATUS
+#define SO_PEEK_OFF             42
+#define SO_NOFCS                43
+#define SO_LOCK_FILTER          44
+#define SO_SELECT_ERR_QUEUE     45
+#define SO_BUSY_POLL            46
+#define SO_MAX_PACING_RATE      47
+#define SO_BPF_EXTENSIONS       48
+#define SO_INCOMING_CPU         49
+#define SO_ATTACH_BPF           50
+#define SO_DETACH_BPF           SO_DETACH_FILTER
+#define SO_ATTACH_REUSEPORT_CBPF 51
+#define SO_ATTACH_REUSEPORT_EBPF 52
+#define SO_CNX_ADVICE           53
+#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO              55
+#define SO_INCOMING_NAPI_ID     56
+#define SO_COOKIE               57
+#define SCM_TIMESTAMPING_PKTINFO 58
+#define SO_PEERGROUPS           59
+#define SO_ZEROCOPY             60
+#define SO_TXTIME               61
+#define SCM_TXTIME              SO_TXTIME
+#define SO_BINDTOIFINDEX        62
+#define SO_DETACH_REUSEPORT_BPF 68
+#define SO_PREFER_BUSY_POLL     69
+#define SO_BUSY_POLL_BUDGET     70
+
+#ifndef SOL_SOCKET
+#define SOL_SOCKET      1
+#endif
+
+#define SOL_IP          0
+#define SOL_IPV6        41
+#define SOL_ICMPV6      58
+
+#define SOL_RAW         255
+#define SOL_DECNET      261
+#define SOL_X25         262
+#define SOL_PACKET      263
+#define SOL_ATM         264
+#define SOL_AAL         265
+#define SOL_IRDA        266
+#define SOL_NETBEUI     267
+#define SOL_LLC         268
+#define SOL_DCCP        269
+#define SOL_NETLINK     270
+#define SOL_TIPC        271
+#define SOL_RXRPC       272
+#define SOL_PPPOL2TP    273
+#define SOL_BLUETOOTH   274
+#define SOL_PNPIPE      275
+#define SOL_RDS         276
+#define SOL_IUCV        277
+#define SOL_CAIF        278
+#define SOL_ALG         279
+#define SOL_NFC         280
+#define SOL_KCM         281
+#define SOL_TLS         282
+#define SOL_XDP         283
+
+#define SOMAXCONN       128
+
+#define MSG_OOB       0x0001
+#define MSG_PEEK      0x0002
+#define MSG_DONTROUTE 0x0004
+#define MSG_CTRUNC    0x0008
+#define MSG_PROXY     0x0010
+#define MSG_TRUNC     0x0020
+#define MSG_DONTWAIT  0x0040
+#define MSG_EOR       0x0080
+#define MSG_WAITALL   0x0100
+#define MSG_FIN       0x0200
+#define MSG_SYN       0x0400
+#define MSG_CONFIRM   0x0800
+#define MSG_RST       0x1000
+#define MSG_ERRQUEUE  0x2000
+#define MSG_NOSIGNAL  0x4000
+#define MSG_MORE      0x8000
+#define MSG_WAITFORONE 0x10000
+#define MSG_BATCH     0x40000
+#define MSG_ZEROCOPY  0x4000000
+#define MSG_FASTOPEN  0x20000000
+#define MSG_CMSG_CLOEXEC 0x40000000
+
+#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1))
+#define __CMSG_NEXT(cmsg) ((unsigned char *)(cmsg) + __CMSG_LEN(cmsg))
+#define __MHDR_END(mhdr) ((unsigned char *)(mhdr)->msg_control + (mhdr)->msg_controllen)
+
+#define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1))
+#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \
+	__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
+	? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg))
+#define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
+
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+#define SCM_RIGHTS      0x01
+#define SCM_CREDENTIALS 0x02
+
+struct sockaddr {
+	sa_family_t sa_family;
+	char sa_data[14];
+};
+
+struct sockaddr_storage {
+	sa_family_t ss_family;
+	char __ss_padding[128-sizeof(long)-sizeof(sa_family_t)];
+	unsigned long __ss_align;
+};
+
+int socket (int, int, int);
+int socketpair (int, int, int, int [2]);
+
+int shutdown (int, int);
+
+int bind (int, const struct sockaddr *, socklen_t);
+int connect (int, const struct sockaddr *, socklen_t);
+int listen (int, int);
+int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
+int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
+
+int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
+int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
+
+ssize_t send (int, const void *, size_t, int);
+ssize_t recv (int, void *, size_t, int);
+ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
+ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
+ssize_t sendmsg (int, const struct msghdr *, int);
+ssize_t recvmsg (int, struct msghdr *, int);
+
+int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
+int setsockopt (int, int, int, const void *, socklen_t);
+
+int sockatmark (int);
+
+#if _REDIR_TIME64
+#ifdef _GNU_SOURCE
+__REDIR(recvmmsg, __recvmmsg_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/soundcard.h b/musl-include/i386/sys/soundcard.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/soundcard.h
@@ -0,0 +1,1 @@
+#include <bits/soundcard.h>
diff --git a/musl-include/i386/sys/stat.h b/musl-include/i386/sys/stat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/stat.h
@@ -0,0 +1,182 @@
+#ifndef	_SYS_STAT_H
+#define	_SYS_STAT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_dev_t
+#define __NEED_ino_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_off_t
+#define __NEED_time_t
+#define __NEED_blksize_t
+#define __NEED_blkcnt_t
+#define __NEED_struct_timespec
+
+#ifdef _GNU_SOURCE
+#define __NEED_int64_t
+#define __NEED_uint64_t
+#define __NEED_uint32_t
+#define __NEED_uint16_t
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/stat.h>
+
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+
+#define S_IFMT  0170000
+
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFBLK 0060000
+#define S_IFREG 0100000
+#define S_IFIFO 0010000
+#define S_IFLNK 0120000
+#define S_IFSOCK 0140000
+
+#define S_TYPEISMQ(buf)  0
+#define S_TYPEISSEM(buf) 0
+#define S_TYPEISSHM(buf) 0
+#define S_TYPEISTMO(buf) 0
+
+#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK)
+#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
+#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
+#define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK)
+#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+
+#ifndef S_IRUSR
+#define S_ISUID 04000
+#define S_ISGID 02000
+#define S_ISVTX 01000
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXU 0700
+#define S_IRGRP 0040
+#define S_IWGRP 0020
+#define S_IXGRP 0010
+#define S_IRWXG 0070
+#define S_IROTH 0004
+#define S_IWOTH 0002
+#define S_IXOTH 0001
+#define S_IRWXO 0007
+#endif
+
+#define UTIME_NOW  0x3fffffff
+#define UTIME_OMIT 0x3ffffffe
+
+int stat(const char *__restrict, struct stat *__restrict);
+int fstat(int, struct stat *);
+int lstat(const char *__restrict, struct stat *__restrict);
+int fstatat(int, const char *__restrict, struct stat *__restrict, int);
+int chmod(const char *, mode_t);
+int fchmod(int, mode_t);
+int fchmodat(int, const char *, mode_t, int);
+mode_t umask(mode_t);
+int mkdir(const char *, mode_t);
+int mkfifo(const char *, mode_t);
+int mkdirat(int, const char *, mode_t);
+int mkfifoat(int, const char *, mode_t);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int mknod(const char *, mode_t, dev_t);
+int mknodat(int, const char *, mode_t, dev_t);
+#endif
+
+int futimens(int, const struct timespec [2]);
+int utimensat(int, const char *, const struct timespec [2], int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int lchmod(const char *, mode_t);
+#define S_IREAD S_IRUSR
+#define S_IWRITE S_IWUSR
+#define S_IEXEC S_IXUSR
+#endif
+
+#if defined(_GNU_SOURCE)
+#define STATX_TYPE 1U
+#define STATX_MODE 2U
+#define STATX_NLINK 4U
+#define STATX_UID 8U
+#define STATX_GID 0x10U
+#define STATX_ATIME 0x20U
+#define STATX_MTIME 0x40U
+#define STATX_CTIME 0x80U
+#define STATX_INO 0x100U
+#define STATX_SIZE 0x200U
+#define STATX_BLOCKS 0x400U
+#define STATX_BASIC_STATS 0x7ffU
+#define STATX_BTIME 0x800U
+#define STATX_ALL 0xfffU
+
+struct statx_timestamp {
+	int64_t tv_sec;
+	uint32_t tv_nsec, __pad;
+};
+
+struct statx {
+	uint32_t stx_mask;
+	uint32_t stx_blksize;
+	uint64_t stx_attributes;
+	uint32_t stx_nlink;
+	uint32_t stx_uid;
+	uint32_t stx_gid;
+	uint16_t stx_mode;
+	uint16_t __pad0[1];
+	uint64_t stx_ino;
+	uint64_t stx_size;
+	uint64_t stx_blocks;
+	uint64_t stx_attributes_mask;
+	struct statx_timestamp stx_atime;
+	struct statx_timestamp stx_btime;
+	struct statx_timestamp stx_ctime;
+	struct statx_timestamp stx_mtime;
+	uint32_t stx_rdev_major;
+	uint32_t stx_rdev_minor;
+	uint32_t stx_dev_major;
+	uint32_t stx_dev_minor;
+	uint64_t __pad1[14];
+};
+
+int statx(int, const char *__restrict, int, unsigned, struct statx *__restrict);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define stat64 stat
+#define fstat64 fstat
+#define lstat64 lstat
+#define fstatat64 fstatat
+#define blkcnt64_t blkcnt_t
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#define ino64_t ino_t
+#define off64_t off_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(stat, __stat_time64);
+__REDIR(fstat, __fstat_time64);
+__REDIR(lstat, __lstat_time64);
+__REDIR(fstatat, __fstatat_time64);
+__REDIR(futimens, __futimens_time64);
+__REDIR(utimensat, __utimensat_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
diff --git a/musl-include/i386/sys/statfs.h b/musl-include/i386/sys/statfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/statfs.h
@@ -0,0 +1,32 @@
+#ifndef	_SYS_STATFS_H
+#define	_SYS_STATFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <sys/statvfs.h>
+
+typedef struct __fsid_t {
+	int __val[2];
+} fsid_t;
+
+#include <bits/statfs.h>
+
+int statfs (const char *, struct statfs *);
+int fstatfs (int, struct statfs *);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define statfs64 statfs
+#define fstatfs64 fstatfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/statvfs.h b/musl-include/i386/sys/statvfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/statvfs.h
@@ -0,0 +1,57 @@
+#ifndef	_SYS_STATVFS_H
+#define	_SYS_STATVFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+#include <bits/alltypes.h>
+
+struct statvfs {
+	unsigned long f_bsize, f_frsize;
+	fsblkcnt_t f_blocks, f_bfree, f_bavail;
+	fsfilcnt_t f_files, f_ffree, f_favail;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned long f_fsid;
+	unsigned :8*(2*sizeof(int)-sizeof(long));
+#else
+	unsigned :8*(2*sizeof(int)-sizeof(long));
+	unsigned long f_fsid;
+#endif
+	unsigned long f_flag, f_namemax;
+	unsigned int f_type;
+	int __reserved[5];
+};
+
+int statvfs (const char *__restrict, struct statvfs *__restrict);
+int fstatvfs (int, struct statvfs *);
+
+#define ST_RDONLY 1
+#define ST_NOSUID 2
+#define ST_NODEV  4
+#define ST_NOEXEC 8
+#define ST_SYNCHRONOUS 16
+#define ST_MANDLOCK    64
+#define ST_WRITE       128
+#define ST_APPEND      256
+#define ST_IMMUTABLE   512
+#define ST_NOATIME     1024
+#define ST_NODIRATIME  2048
+#define ST_RELATIME    4096
+
+#if defined(_LARGEFILE64_SOURCE)
+#define statvfs64 statvfs
+#define fstatvfs64 fstatvfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/stropts.h b/musl-include/i386/sys/stropts.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/stropts.h
@@ -0,0 +1,1 @@
+#include <stropts.h>
diff --git a/musl-include/i386/sys/swap.h b/musl-include/i386/sys/swap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/swap.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_SWAP_H
+#define _SYS_SWAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define	SWAP_FLAG_PREFER        0x8000
+#define	SWAP_FLAG_PRIO_MASK     0x7fff
+#define	SWAP_FLAG_PRIO_SHIFT    0
+#define SWAP_FLAG_DISCARD       0x10000
+
+int swapon (const char *, int);
+int swapoff (const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/syscall.h b/musl-include/i386/sys/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/syscall.h
@@ -0,0 +1,6 @@
+#ifndef _SYS_SYSCALL_H
+#define _SYS_SYSCALL_H
+
+#include <bits/syscall.h>
+
+#endif
diff --git a/musl-include/i386/sys/sysinfo.h b/musl-include/i386/sys/sysinfo.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/sysinfo.h
@@ -0,0 +1,36 @@
+#ifndef _SYS_SYSINFO_H
+#define _SYS_SYSINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SI_LOAD_SHIFT 16
+
+struct sysinfo {
+	unsigned long uptime;
+	unsigned long loads[3];
+	unsigned long totalram;
+	unsigned long freeram;
+	unsigned long sharedram;
+	unsigned long bufferram;
+	unsigned long totalswap;
+	unsigned long freeswap;
+	unsigned short procs, pad;
+	unsigned long totalhigh;
+	unsigned long freehigh;
+	unsigned mem_unit;
+	char __reserved[256];
+};
+
+int sysinfo (struct sysinfo *);
+int get_nprocs_conf (void);
+int get_nprocs (void);
+long get_phys_pages (void);
+long get_avphys_pages (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/syslog.h b/musl-include/i386/sys/syslog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/syslog.h
@@ -0,0 +1,1 @@
+#include <syslog.h>
diff --git a/musl-include/i386/sys/sysmacros.h b/musl-include/i386/sys/sysmacros.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/sysmacros.h
@@ -0,0 +1,15 @@
+#ifndef _SYS_SYSMACROS_H
+#define _SYS_SYSMACROS_H
+
+#define major(x) \
+	((unsigned)( (((x)>>31>>1) & 0xfffff000) | (((x)>>8) & 0x00000fff) ))
+#define minor(x) \
+	((unsigned)( (((x)>>12) & 0xffffff00) | ((x) & 0x000000ff) ))
+
+#define makedev(x,y) ( \
+        (((x)&0xfffff000ULL) << 32) | \
+	(((x)&0x00000fffULL) << 8) | \
+        (((y)&0xffffff00ULL) << 12) | \
+	(((y)&0x000000ffULL)) )
+
+#endif
diff --git a/musl-include/i386/sys/termios.h b/musl-include/i386/sys/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/termios.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/termios.h> to <termios.h>
+#include <termios.h>
diff --git a/musl-include/i386/sys/time.h b/musl-include/i386/sys/time.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/time.h
@@ -0,0 +1,76 @@
+#ifndef _SYS_TIME_H
+#define _SYS_TIME_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <sys/select.h>
+
+int gettimeofday (struct timeval *__restrict, void *__restrict);
+
+#define ITIMER_REAL    0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF    2
+
+struct itimerval {
+	struct timeval it_interval;
+	struct timeval it_value;
+};
+
+int getitimer (int, struct itimerval *);
+int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict);
+int utimes (const char *, const struct timeval [2]);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct timezone {
+	int tz_minuteswest;
+	int tz_dsttime;
+};
+int futimes(int, const struct timeval [2]);
+int futimesat(int, const char *, const struct timeval [2]);
+int lutimes(const char *, const struct timeval [2]);
+int settimeofday(const struct timeval *, const struct timezone *);
+int adjtime (const struct timeval *, struct timeval *);
+#define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
+#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
+#define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
+	(s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
+#define timeradd(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
+	((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
+	((a)->tv_usec -= 1000000, (a)->tv_sec++) )
+#define timersub(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
+	((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
+	((a)->tv_usec += 1000000, (a)->tv_sec--) )
+#endif
+
+#if defined(_GNU_SOURCE)
+#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \
+	(ts)->tv_sec = (tv)->tv_sec, \
+	(ts)->tv_nsec = (tv)->tv_usec * 1000, \
+	(void)0 )
+#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \
+	(tv)->tv_sec = (ts)->tv_sec, \
+	(tv)->tv_usec = (ts)->tv_nsec / 1000, \
+	(void)0 )
+#endif
+
+#if _REDIR_TIME64
+__REDIR(gettimeofday, __gettimeofday_time64);
+__REDIR(getitimer, __getitimer_time64);
+__REDIR(setitimer, __setitimer_time64);
+__REDIR(utimes, __utimes_time64);
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(futimes, __futimes_time64);
+__REDIR(futimesat, __futimesat_time64);
+__REDIR(lutimes, __lutimes_time64);
+__REDIR(settimeofday, __settimeofday_time64);
+__REDIR(adjtime, __adjtime64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/timeb.h b/musl-include/i386/sys/timeb.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/timeb.h
@@ -0,0 +1,28 @@
+#ifndef _SYS_TIMEB_H
+#define _SYS_TIMEB_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+
+#include <bits/alltypes.h>
+
+struct timeb {
+	time_t time;
+	unsigned short millitm;
+	short timezone, dstflag;
+};
+
+int ftime(struct timeb *);
+
+#if _REDIR_TIME64
+__REDIR(ftime, __ftime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/timerfd.h b/musl-include/i386/sys/timerfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/timerfd.h
@@ -0,0 +1,32 @@
+#ifndef _SYS_TIMERFD_H
+#define _SYS_TIMERFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <time.h>
+#include <fcntl.h>
+
+#define TFD_NONBLOCK O_NONBLOCK
+#define TFD_CLOEXEC O_CLOEXEC
+
+#define TFD_TIMER_ABSTIME 1
+#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
+
+struct itimerspec;
+
+int timerfd_create(int, int);
+int timerfd_settime(int, int, const struct itimerspec *, struct itimerspec *);
+int timerfd_gettime(int, struct itimerspec *);
+
+#if _REDIR_TIME64
+__REDIR(timerfd_settime, __timerfd_settime64);
+__REDIR(timerfd_gettime, __timerfd_gettime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/times.h b/musl-include/i386/sys/times.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/times.h
@@ -0,0 +1,25 @@
+#ifndef	_SYS_TIMES_H
+#define	_SYS_TIMES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clock_t
+#include <bits/alltypes.h>
+
+struct tms {
+	clock_t tms_utime;
+	clock_t tms_stime;
+	clock_t tms_cutime;
+	clock_t tms_cstime;
+};
+
+clock_t times (struct tms *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/i386/sys/timex.h b/musl-include/i386/sys/timex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/timex.h
@@ -0,0 +1,103 @@
+#ifndef _SYS_TIMEX_H
+#define _SYS_TIMEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clockid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/time.h>
+
+struct ntptimeval {
+	struct timeval time;
+	long maxerror, esterror;
+};
+
+struct timex {
+	unsigned modes;
+	long offset, freq, maxerror, esterror;
+	int status;
+	long constant, precision, tolerance;
+	struct timeval time;
+	long tick, ppsfreq, jitter;
+	int shift;
+	long stabil, jitcnt, calcnt, errcnt, stbcnt;
+	int tai;
+	int __padding[11];
+};
+
+#define ADJ_OFFSET		0x0001
+#define ADJ_FREQUENCY		0x0002
+#define ADJ_MAXERROR		0x0004
+#define ADJ_ESTERROR		0x0008
+#define ADJ_STATUS		0x0010
+#define ADJ_TIMECONST		0x0020
+#define ADJ_TAI			0x0080
+#define ADJ_SETOFFSET		0x0100
+#define ADJ_MICRO		0x1000
+#define ADJ_NANO		0x2000
+#define ADJ_TICK		0x4000
+#define ADJ_OFFSET_SINGLESHOT	0x8001
+#define ADJ_OFFSET_SS_READ	0xa001
+
+#define MOD_OFFSET	ADJ_OFFSET
+#define MOD_FREQUENCY	ADJ_FREQUENCY
+#define MOD_MAXERROR	ADJ_MAXERROR
+#define MOD_ESTERROR	ADJ_ESTERROR
+#define MOD_STATUS	ADJ_STATUS
+#define MOD_TIMECONST	ADJ_TIMECONST
+#define MOD_CLKB	ADJ_TICK
+#define MOD_CLKA	ADJ_OFFSET_SINGLESHOT
+#define MOD_TAI		ADJ_TAI
+#define MOD_MICRO	ADJ_MICRO
+#define MOD_NANO	ADJ_NANO
+
+#define STA_PLL		0x0001
+#define STA_PPSFREQ	0x0002
+#define STA_PPSTIME	0x0004
+#define STA_FLL		0x0008
+
+#define STA_INS		0x0010
+#define STA_DEL		0x0020
+#define STA_UNSYNC	0x0040
+#define STA_FREQHOLD	0x0080
+
+#define STA_PPSSIGNAL	0x0100
+#define STA_PPSJITTER	0x0200
+#define STA_PPSWANDER	0x0400
+#define STA_PPSERROR	0x0800
+
+#define STA_CLOCKERR	0x1000
+#define STA_NANO	0x2000
+#define STA_MODE	0x4000
+#define STA_CLK		0x8000
+
+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
+    STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
+
+#define TIME_OK		0
+#define TIME_INS	1
+#define TIME_DEL	2
+#define TIME_OOP	3
+#define TIME_WAIT	4
+#define TIME_ERROR	5
+#define TIME_BAD	TIME_ERROR
+
+#define MAXTC		6
+
+int adjtimex(struct timex *);
+int clock_adjtime(clockid_t, struct timex *);
+
+#if _REDIR_TIME64
+__REDIR(adjtimex, __adjtimex_time64);
+__REDIR(clock_adjtime, __clock_adjtime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/ttydefaults.h b/musl-include/i386/sys/ttydefaults.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/ttydefaults.h
@@ -0,0 +1,34 @@
+#ifndef _SYS_TTYDEFAULTS_H
+#define _SYS_TTYDEFAULTS_H
+
+#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
+#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
+#define TTYDEF_SPEED (B9600)
+#define CTRL(x) ((x)&037)
+#define CEOF CTRL('d')
+
+#define CEOL '\0'
+#define CSTATUS '\0'
+
+#define CERASE 0177
+#define CINTR CTRL('c')
+#define CKILL CTRL('u')
+#define CMIN 1
+#define CQUIT 034
+#define CSUSP CTRL('z')
+#define CTIME 0
+#define CDSUSP CTRL('y')
+#define CSTART CTRL('q')
+#define CSTOP CTRL('s')
+#define CLNEXT CTRL('v')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
+#define CEOT CEOF
+#define CBRK CEOL
+#define CRPRNT CREPRINT
+#define CFLUSH CDISCARD
+
+#endif
diff --git a/musl-include/i386/sys/types.h b/musl-include/i386/sys/types.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/types.h
@@ -0,0 +1,85 @@
+#ifndef	_SYS_TYPES_H
+#define	_SYS_TYPES_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ino_t
+#define __NEED_dev_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_time_t
+#define __NEED_timer_t
+#define __NEED_clockid_t
+
+#define __NEED_blkcnt_t
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+
+#define __NEED_id_t
+#define __NEED_key_t
+#define __NEED_clock_t
+#define __NEED_suseconds_t
+#define __NEED_blksize_t
+
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_pthread_mutexattr_t
+#define __NEED_pthread_condattr_t
+#define __NEED_pthread_rwlockattr_t
+#define __NEED_pthread_barrierattr_t
+#define __NEED_pthread_mutex_t
+#define __NEED_pthread_cond_t
+#define __NEED_pthread_rwlock_t
+#define __NEED_pthread_barrier_t
+#define __NEED_pthread_spinlock_t
+#define __NEED_pthread_key_t
+#define __NEED_pthread_once_t
+#define __NEED_useconds_t
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+#define __NEED_u_int64_t
+#define __NEED_register_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned char u_int8_t;
+typedef unsigned short u_int16_t;
+typedef unsigned u_int32_t;
+typedef char *caddr_t;
+typedef unsigned char u_char;
+typedef unsigned short u_short, ushort;
+typedef unsigned u_int, uint;
+typedef unsigned long u_long, ulong;
+typedef long long quad_t;
+typedef unsigned long long u_quad_t;
+#include <endian.h>
+#include <sys/select.h>
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define blkcnt64_t blkcnt_t
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#define ino64_t ino_t
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/ucontext.h b/musl-include/i386/sys/ucontext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/ucontext.h
@@ -0,0 +1,1 @@
+#include <ucontext.h>
diff --git a/musl-include/i386/sys/uio.h b/musl-include/i386/sys/uio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/uio.h
@@ -0,0 +1,55 @@
+#ifndef _SYS_UIO_H
+#define _SYS_UIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_struct_iovec
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_off_t
+#endif
+
+#ifdef _GNU_SOURCE
+#define __NEED_pid_t
+#endif
+
+#include <bits/alltypes.h>
+
+#define UIO_MAXIOV 1024
+
+ssize_t readv (int, const struct iovec *, int);
+ssize_t writev (int, const struct iovec *, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+ssize_t preadv (int, const struct iovec *, int, off_t);
+ssize_t pwritev (int, const struct iovec *, int, off_t);
+#if defined(_LARGEFILE64_SOURCE)
+#define preadv64 preadv
+#define pwritev64 pwritev
+#define off64_t off_t
+#endif
+#endif
+
+#ifdef _GNU_SOURCE
+ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
+ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
+ssize_t preadv2 (int, const struct iovec *, int, off_t, int);
+ssize_t pwritev2 (int, const struct iovec *, int, off_t, int);
+#define RWF_HIPRI 0x00000001
+#define RWF_DSYNC 0x00000002
+#define RWF_SYNC 0x00000004
+#define RWF_NOWAIT 0x00000008
+#define RWF_APPEND 0x00000010
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/un.h b/musl-include/i386/sys/un.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/un.h
@@ -0,0 +1,31 @@
+#ifndef	_SYS_UN_H
+#define	_SYS_UN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_sa_family_t
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+struct sockaddr_un {
+	sa_family_t sun_family;
+	char sun_path[108];
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+size_t strlen(const char *);
+#define SUN_LEN(s) (2+strlen((s)->sun_path))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/user.h b/musl-include/i386/sys/user.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/user.h
@@ -0,0 +1,16 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <limits.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include <bits/user.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/utsname.h b/musl-include/i386/sys/utsname.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/utsname.h
@@ -0,0 +1,29 @@
+#ifndef	_SYS_UTSNAME_H
+#define	_SYS_UTSNAME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+struct utsname {
+	char sysname[65];
+	char nodename[65];
+	char release[65];
+	char version[65];
+	char machine[65];
+#ifdef _GNU_SOURCE
+	char domainname[65];
+#else
+	char __domainname[65];
+#endif
+};
+
+int uname (struct utsname *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/sys/vfs.h b/musl-include/i386/sys/vfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/vfs.h
@@ -0,0 +1,1 @@
+#include <sys/statfs.h>
diff --git a/musl-include/i386/sys/vt.h b/musl-include/i386/sys/vt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/vt.h
@@ -0,0 +1,1 @@
+#include <bits/vt.h>
diff --git a/musl-include/i386/sys/wait.h b/musl-include/i386/sys/wait.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/wait.h
@@ -0,0 +1,67 @@
+#ifndef	_SYS_WAIT_H
+#define	_SYS_WAIT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_id_t
+#include <bits/alltypes.h>
+
+typedef enum {
+	P_ALL = 0,
+	P_PID = 1,
+	P_PGID = 2,
+	P_PIDFD = 3
+} idtype_t;
+
+pid_t wait (int *);
+pid_t waitpid (pid_t, int *, int );
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#include <signal.h>
+int waitid (idtype_t, id_t, siginfo_t *, int);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#include <sys/resource.h>
+pid_t wait3 (int *, int, struct rusage *);
+pid_t wait4 (pid_t, int *, int, struct rusage *);
+#endif
+
+#define WNOHANG    1
+#define WUNTRACED  2
+
+#define WSTOPPED   2
+#define WEXITED    4
+#define WCONTINUED 8
+#define WNOWAIT    0x1000000
+
+#define __WNOTHREAD 0x20000000
+#define __WALL      0x40000000
+#define __WCLONE    0x80000000
+
+#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
+#define WTERMSIG(s) ((s) & 0x7f)
+#define WSTOPSIG(s) WEXITSTATUS(s)
+#define WCOREDUMP(s) ((s) & 0x80)
+#define WIFEXITED(s) (!WTERMSIG(s))
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
+#define WIFCONTINUED(s) ((s) == 0xffff)
+
+#if _REDIR_TIME64
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(wait3, __wait3_time64);
+__REDIR(wait4, __wait4_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/sys/xattr.h b/musl-include/i386/sys/xattr.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sys/xattr.h
@@ -0,0 +1,32 @@
+#ifndef	_SYS_XATTR_H
+#define	_SYS_XATTR_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_ssize_t
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+#define XATTR_CREATE 1
+#define XATTR_REPLACE 2
+
+ssize_t getxattr(const char *, const char *, void *, size_t);
+ssize_t lgetxattr(const char *, const char *, void *, size_t);
+ssize_t fgetxattr(int, const char *, void *, size_t);
+ssize_t listxattr(const char *, char *, size_t);
+ssize_t llistxattr(const char *, char *, size_t);
+ssize_t flistxattr(int, char *, size_t);
+int setxattr(const char *, const char *, const void *, size_t, int);
+int lsetxattr(const char *, const char *, const void *, size_t, int);
+int fsetxattr(int, const char *, const void *, size_t, int);
+int removexattr(const char *, const char *);
+int lremovexattr(const char *, const char *);
+int fremovexattr(int, const char *);
+
+#define __UAPI_DEF_XATTR        0
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/syscall.h b/musl-include/i386/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/syscall.h
@@ -0,0 +1,1 @@
+#include <sys/syscall.h>
diff --git a/musl-include/i386/sysexits.h b/musl-include/i386/sysexits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/sysexits.h
@@ -0,0 +1,21 @@
+#ifndef	_SYSEXITS_H
+#define _SYSEXITS_H
+#define EX_OK 0
+#define EX__BASE 64
+#define EX_USAGE 64
+#define EX_DATAERR 65
+#define EX_NOINPUT 66
+#define EX_NOUSER 67
+#define EX_NOHOST 68
+#define EX_UNAVAILABLE 69
+#define EX_SOFTWARE 70
+#define EX_OSERR 71
+#define EX_OSFILE 72
+#define EX_CANTCREAT 73
+#define EX_IOERR 74
+#define EX_TEMPFAIL 75
+#define EX_PROTOCOL 76
+#define EX_NOPERM 77
+#define EX_CONFIG 78
+#define EX__MAX 78
+#endif
diff --git a/musl-include/i386/syslog.h b/musl-include/i386/syslog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/syslog.h
@@ -0,0 +1,100 @@
+#ifndef _SYSLOG_H
+#define _SYSLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define LOG_EMERG   0
+#define LOG_ALERT   1
+#define LOG_CRIT    2
+#define LOG_ERR     3
+#define LOG_WARNING 4
+#define LOG_NOTICE  5
+#define LOG_INFO    6
+#define LOG_DEBUG   7
+
+#define LOG_PRIMASK 7
+#define LOG_PRI(p) ((p)&LOG_PRIMASK)
+#define	LOG_MAKEPRI(f, p) (((f)<<3)|(p))
+
+#define LOG_MASK(p) (1<<(p))
+#define LOG_UPTO(p) ((1<<((p)+1))-1)
+
+#define LOG_KERN     (0<<3)
+#define LOG_USER     (1<<3)
+#define LOG_MAIL     (2<<3)
+#define LOG_DAEMON   (3<<3)
+#define LOG_AUTH     (4<<3)
+#define LOG_SYSLOG   (5<<3)
+#define LOG_LPR      (6<<3)
+#define LOG_NEWS     (7<<3)
+#define LOG_UUCP     (8<<3)
+#define LOG_CRON     (9<<3)
+#define	LOG_AUTHPRIV (10<<3)
+#define	LOG_FTP      (11<<3)
+
+#define LOG_LOCAL0   (16<<3)
+#define LOG_LOCAL1   (17<<3)
+#define LOG_LOCAL2   (18<<3)
+#define LOG_LOCAL3   (19<<3)
+#define LOG_LOCAL4   (20<<3)
+#define LOG_LOCAL5   (21<<3)
+#define LOG_LOCAL6   (22<<3)
+#define LOG_LOCAL7   (23<<3)
+
+#define LOG_NFACILITIES 24
+#define LOG_FACMASK 0x3f8
+#define LOG_FAC(p) (((p)&LOG_FACMASK)>>3)
+
+#define LOG_PID    0x01
+#define LOG_CONS   0x02
+#define LOG_ODELAY 0x04
+#define LOG_NDELAY 0x08
+#define LOG_NOWAIT 0x10
+#define LOG_PERROR 0x20
+
+void closelog (void);
+void openlog (const char *, int, int);
+int setlogmask (int);
+void syslog (int, const char *, ...);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define _PATH_LOG "/dev/log"
+#define __NEED_va_list
+#include <bits/alltypes.h>
+void vsyslog (int, const char *, va_list);
+#if defined(SYSLOG_NAMES)
+#define	INTERNAL_NOPRI 0x10
+#define	INTERNAL_MARK (LOG_NFACILITIES<<3)
+typedef struct {
+	char *c_name;
+	int c_val;
+} CODE;
+#define prioritynames ((CODE *)(const CODE []){ \
+	{ "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, \
+	{ "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, \
+	{ "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, \
+	{ "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, \
+	{ "warn", LOG_WARNING }, { "warning", LOG_WARNING }, { 0, -1 } })
+#define facilitynames ((CODE *)(const CODE []){ \
+	{ "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, \
+	{ "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, \
+	{ "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, \
+	{ "mark", INTERNAL_MARK }, { "news", LOG_NEWS }, \
+	{ "security", LOG_AUTH }, { "syslog", LOG_SYSLOG }, \
+	{ "user", LOG_USER }, { "uucp", LOG_UUCP }, \
+	{ "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, \
+	{ "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, \
+	{ "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, \
+	{ "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { 0, -1 } })
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/tar.h b/musl-include/i386/tar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/tar.h
@@ -0,0 +1,33 @@
+#ifndef	_TAR_H
+#define	_TAR_H
+
+#define TSUID   04000
+#define TSGID   02000
+#define TSVTX   01000
+#define TUREAD  00400
+#define TUWRITE 00200
+#define TUEXEC  00100
+#define TGREAD  00040
+#define TGWRITE 00020
+#define TGEXEC  00010
+#define TOREAD  00004
+#define TOWRITE 00002
+#define TOEXEC  00001
+
+#define REGTYPE  '0'
+#define AREGTYPE '\0'
+#define LNKTYPE  '1'
+#define SYMTYPE  '2'
+#define CHRTYPE  '3'
+#define BLKTYPE  '4'
+#define DIRTYPE  '5'
+#define FIFOTYPE '6'
+#define CONTTYPE '7'
+
+#define TMAGIC "ustar"
+#define TMAGLEN 6
+
+#define TVERSION "00"
+#define TVERSLEN 2
+
+#endif
diff --git a/musl-include/i386/termios.h b/musl-include/i386/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/termios.h
@@ -0,0 +1,50 @@
+#ifndef	_TERMIOS_H
+#define	_TERMIOS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_struct_winsize
+
+#include <bits/alltypes.h>
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 32
+
+#include <bits/termios.h>
+
+speed_t cfgetospeed (const struct termios *);
+speed_t cfgetispeed (const struct termios *);
+int cfsetospeed (struct termios *, speed_t);
+int cfsetispeed (struct termios *, speed_t);
+
+int tcgetattr (int, struct termios *);
+int tcsetattr (int, int, const struct termios *);
+
+int tcgetwinsize (int, struct winsize *);
+int tcsetwinsize (int, const struct winsize *);
+
+int tcsendbreak (int, int);
+int tcdrain (int);
+int tcflush (int, int);
+int tcflow (int, int);
+
+pid_t tcgetsid (int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void cfmakeraw(struct termios *);
+int cfsetspeed(struct termios *, speed_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/tgmath.h b/musl-include/i386/tgmath.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/tgmath.h
@@ -0,0 +1,270 @@
+#ifndef _TGMATH_H
+#define _TGMATH_H
+
+/*
+the return types are only correct with gcc (__GNUC__)
+otherwise they are long double or long double complex
+
+the long double version of a function is never chosen when
+sizeof(double) == sizeof(long double)
+(but the return type is set correctly with gcc)
+*/
+
+#include <math.h>
+#include <complex.h>
+
+#define __IS_FP(x) (sizeof((x)+1ULL) == sizeof((x)+1.0f))
+#define __IS_CX(x) (__IS_FP(x) && sizeof(x) == sizeof((x)+I))
+#define __IS_REAL(x) (__IS_FP(x) && 2*sizeof(x) == sizeof((x)+I))
+
+#define __FLT(x) (__IS_REAL(x) && sizeof(x) == sizeof(float))
+#define __LDBL(x) (__IS_REAL(x) && sizeof(x) == sizeof(long double) && sizeof(long double) != sizeof(double))
+
+#define __FLTCX(x) (__IS_CX(x) && sizeof(x) == sizeof(float complex))
+#define __DBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(double complex))
+#define __LDBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(long double complex) && sizeof(long double) != sizeof(double))
+
+/* return type */
+
+#ifdef __GNUC__
+/*
+the result must be casted to the right type
+(otherwise the result type is determined by the conversion
+rules applied to all the function return types so it is long
+double or long double complex except for integral functions)
+
+this cannot be done in c99, so the typeof gcc extension is
+used and that the type of ?: depends on wether an operand is
+a null pointer constant or not
+(in c11 _Generic can be used)
+
+the c arguments below must be integer constant expressions
+so they can be in null pointer constants
+(__IS_FP above was carefully chosen this way)
+*/
+/* if c then t else void */
+#define __type1(c,t) __typeof__(*(0?(t*)0:(void*)!(c)))
+/* if c then t1 else t2 */
+#define __type2(c,t1,t2) __typeof__(*(0?(__type1(c,t1)*)0:(__type1(!(c),t2)*)0))
+/* cast to double when x is integral, otherwise use typeof(x) */
+#define __RETCAST(x) ( \
+	__type2(__IS_FP(x), __typeof__(x), double))
+/* 2 args case, should work for complex types (cpow) */
+#define __RETCAST_2(x, y) ( \
+	__type2(__IS_FP(x) && __IS_FP(y), \
+		__typeof__((x)+(y)), \
+		__typeof__((x)+(y)+1.0)))
+/* 3 args case (fma only) */
+#define __RETCAST_3(x, y, z) ( \
+	__type2(__IS_FP(x) && __IS_FP(y) && __IS_FP(z), \
+		__typeof__((x)+(y)+(z)), \
+		__typeof__((x)+(y)+(z)+1.0)))
+/* drop complex from the type of x */
+/* TODO: wrong when sizeof(long double)==sizeof(double) */
+#define __RETCAST_REAL(x) (  \
+	__type2(__IS_FP(x) && sizeof((x)+I) == sizeof(float complex), float, \
+	__type2(sizeof((x)+1.0+I) == sizeof(double complex), double, \
+		long double)))
+/* add complex to the type of x */
+#define __RETCAST_CX(x) (__typeof__(__RETCAST(x)0+I))
+#else
+#define __RETCAST(x)
+#define __RETCAST_2(x, y)
+#define __RETCAST_3(x, y, z)
+#define __RETCAST_REAL(x)
+#define __RETCAST_CX(x)
+#endif
+
+/* function selection */
+
+#define __tg_real_nocast(fun, x) ( \
+	__FLT(x) ? fun ## f (x) : \
+	__LDBL(x) ? fun ## l (x) : \
+	fun(x) )
+
+#define __tg_real(fun, x) (__RETCAST(x)__tg_real_nocast(fun, x))
+
+#define __tg_real_2_1(fun, x, y) (__RETCAST(x)( \
+	__FLT(x) ? fun ## f (x, y) : \
+	__LDBL(x) ? fun ## l (x, y) : \
+	fun(x, y) ))
+
+#define __tg_real_2(fun, x, y) (__RETCAST_2(x, y)( \
+	__FLT(x) && __FLT(y) ? fun ## f (x, y) : \
+	__LDBL((x)+(y)) ? fun ## l (x, y) : \
+	fun(x, y) ))
+
+#define __tg_complex(fun, x) (__RETCAST_CX(x)( \
+	__FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \
+	__LDBLCX((x)+I) ? fun ## l (x) : \
+	fun(x) ))
+
+#define __tg_complex_retreal(fun, x) (__RETCAST_REAL(x)( \
+	__FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \
+	__LDBLCX((x)+I) ? fun ## l (x) : \
+	fun(x) ))
+
+#define __tg_real_complex(fun, x) (__RETCAST(x)( \
+	__FLTCX(x) ? c ## fun ## f (x) : \
+	__DBLCX(x) ? c ## fun (x) : \
+	__LDBLCX(x) ? c ## fun ## l (x) : \
+	__FLT(x) ? fun ## f (x) : \
+	__LDBL(x) ? fun ## l (x) : \
+	fun(x) ))
+
+/* special cases */
+
+#define __tg_real_remquo(x, y, z) (__RETCAST_2(x, y)( \
+	__FLT(x) && __FLT(y) ? remquof(x, y, z) : \
+	__LDBL((x)+(y)) ? remquol(x, y, z) : \
+	remquo(x, y, z) ))
+
+#define __tg_real_fma(x, y, z) (__RETCAST_3(x, y, z)( \
+	__FLT(x) && __FLT(y) && __FLT(z) ? fmaf(x, y, z) : \
+	__LDBL((x)+(y)+(z)) ? fmal(x, y, z) : \
+	fma(x, y, z) ))
+
+#define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
+	__FLTCX((x)+(y)) && __IS_FP(x) && __IS_FP(y) ? cpowf(x, y) : \
+	__FLTCX((x)+(y)) ? cpow(x, y) : \
+	__DBLCX((x)+(y)) ? cpow(x, y) : \
+	__LDBLCX((x)+(y)) ? cpowl(x, y) : \
+	__FLT(x) && __FLT(y) ? powf(x, y) : \
+	__LDBL((x)+(y)) ? powl(x, y) : \
+	pow(x, y) ))
+
+#define __tg_real_complex_fabs(x) (__RETCAST_REAL(x)( \
+	__FLTCX(x) ? cabsf(x) : \
+	__DBLCX(x) ? cabs(x) : \
+	__LDBLCX(x) ? cabsl(x) : \
+	__FLT(x) ? fabsf(x) : \
+	__LDBL(x) ? fabsl(x) : \
+	fabs(x) ))
+
+/* suppress any macros in math.h or complex.h */
+
+#undef acos
+#undef acosh
+#undef asin
+#undef asinh
+#undef atan
+#undef atan2
+#undef atanh
+#undef carg
+#undef cbrt
+#undef ceil
+#undef cimag
+#undef conj
+#undef copysign
+#undef cos
+#undef cosh
+#undef cproj
+#undef creal
+#undef erf
+#undef erfc
+#undef exp
+#undef exp2
+#undef expm1
+#undef fabs
+#undef fdim
+#undef floor
+#undef fma
+#undef fmax
+#undef fmin
+#undef fmod
+#undef frexp
+#undef hypot
+#undef ilogb
+#undef ldexp
+#undef lgamma
+#undef llrint
+#undef llround
+#undef log
+#undef log10
+#undef log1p
+#undef log2
+#undef logb
+#undef lrint
+#undef lround
+#undef nearbyint
+#undef nextafter
+#undef nexttoward
+#undef pow
+#undef remainder
+#undef remquo
+#undef rint
+#undef round
+#undef scalbln
+#undef scalbn
+#undef sin
+#undef sinh
+#undef sqrt
+#undef tan
+#undef tanh
+#undef tgamma
+#undef trunc
+
+/* tg functions */
+
+#define acos(x)         __tg_real_complex(acos, (x))
+#define acosh(x)        __tg_real_complex(acosh, (x))
+#define asin(x)         __tg_real_complex(asin, (x))
+#define asinh(x)        __tg_real_complex(asinh, (x))
+#define atan(x)         __tg_real_complex(atan, (x))
+#define atan2(x,y)      __tg_real_2(atan2, (x), (y))
+#define atanh(x)        __tg_real_complex(atanh, (x))
+#define carg(x)         __tg_complex_retreal(carg, (x))
+#define cbrt(x)         __tg_real(cbrt, (x))
+#define ceil(x)         __tg_real(ceil, (x))
+#define cimag(x)        __tg_complex_retreal(cimag, (x))
+#define conj(x)         __tg_complex(conj, (x))
+#define copysign(x,y)   __tg_real_2(copysign, (x), (y))
+#define cos(x)          __tg_real_complex(cos, (x))
+#define cosh(x)         __tg_real_complex(cosh, (x))
+#define cproj(x)        __tg_complex(cproj, (x))
+#define creal(x)        __tg_complex_retreal(creal, (x))
+#define erf(x)          __tg_real(erf, (x))
+#define erfc(x)         __tg_real(erfc, (x))
+#define exp(x)          __tg_real_complex(exp, (x))
+#define exp2(x)         __tg_real(exp2, (x))
+#define expm1(x)        __tg_real(expm1, (x))
+#define fabs(x)         __tg_real_complex_fabs(x)
+#define fdim(x,y)       __tg_real_2(fdim, (x), (y))
+#define floor(x)        __tg_real(floor, (x))
+#define fma(x,y,z)      __tg_real_fma((x), (y), (z))
+#define fmax(x,y)       __tg_real_2(fmax, (x), (y))
+#define fmin(x,y)       __tg_real_2(fmin, (x), (y))
+#define fmod(x,y)       __tg_real_2(fmod, (x), (y))
+#define frexp(x,y)      __tg_real_2_1(frexp, (x), (y))
+#define hypot(x,y)      __tg_real_2(hypot, (x), (y))
+#define ilogb(x)        __tg_real_nocast(ilogb, (x))
+#define ldexp(x,y)      __tg_real_2_1(ldexp, (x), (y))
+#define lgamma(x)       __tg_real(lgamma, (x))
+#define llrint(x)       __tg_real_nocast(llrint, (x))
+#define llround(x)      __tg_real_nocast(llround, (x))
+#define log(x)          __tg_real_complex(log, (x))
+#define log10(x)        __tg_real(log10, (x))
+#define log1p(x)        __tg_real(log1p, (x))
+#define log2(x)         __tg_real(log2, (x))
+#define logb(x)         __tg_real(logb, (x))
+#define lrint(x)        __tg_real_nocast(lrint, (x))
+#define lround(x)       __tg_real_nocast(lround, (x))
+#define nearbyint(x)    __tg_real(nearbyint, (x))
+#define nextafter(x,y)  __tg_real_2(nextafter, (x), (y))
+#define nexttoward(x,y) __tg_real_2(nexttoward, (x), (y))
+#define pow(x,y)        __tg_real_complex_pow((x), (y))
+#define remainder(x,y)  __tg_real_2(remainder, (x), (y))
+#define remquo(x,y,z)   __tg_real_remquo((x), (y), (z))
+#define rint(x)         __tg_real(rint, (x))
+#define round(x)        __tg_real(round, (x))
+#define scalbln(x,y)    __tg_real_2_1(scalbln, (x), (y))
+#define scalbn(x,y)     __tg_real_2_1(scalbn, (x), (y))
+#define sin(x)          __tg_real_complex(sin, (x))
+#define sinh(x)         __tg_real_complex(sinh, (x))
+#define sqrt(x)         __tg_real_complex(sqrt, (x))
+#define tan(x)          __tg_real_complex(tan, (x))
+#define tanh(x)         __tg_real_complex(tanh, (x))
+#define tgamma(x)       __tg_real(tgamma, (x))
+#define trunc(x)        __tg_real(trunc, (x))
+
+#endif
diff --git a/musl-include/i386/threads.h b/musl-include/i386/threads.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/threads.h
@@ -0,0 +1,93 @@
+#ifndef _THREADS_H
+#define _THREADS_H
+
+#include <features.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+typedef unsigned long thrd_t;
+#else
+typedef struct __pthread *thrd_t;
+#define thread_local _Thread_local
+#endif
+
+typedef int once_flag;
+typedef unsigned tss_t;
+typedef int (*thrd_start_t)(void *);
+typedef void (*tss_dtor_t)(void *);
+
+#define __NEED_cnd_t
+#define __NEED_mtx_t
+
+#include <bits/alltypes.h>
+
+#define TSS_DTOR_ITERATIONS 4
+
+enum {
+	thrd_success  = 0,
+	thrd_busy     = 1,
+	thrd_error    = 2,
+	thrd_nomem    = 3,
+	thrd_timedout = 4,
+};
+
+enum {
+	mtx_plain     = 0,
+	mtx_recursive = 1,
+	mtx_timed     = 2,
+};
+
+#define ONCE_FLAG_INIT 0
+
+int thrd_create(thrd_t *, thrd_start_t, void *);
+_Noreturn void thrd_exit(int);
+
+int thrd_detach(thrd_t);
+int thrd_join(thrd_t, int *);
+
+int thrd_sleep(const struct timespec *, struct timespec *);
+void thrd_yield(void);
+
+thrd_t thrd_current(void);
+int thrd_equal(thrd_t, thrd_t);
+#ifndef __cplusplus
+#define thrd_equal(A, B) ((A) == (B))
+#endif
+
+void call_once(once_flag *, void (*)(void));
+
+int mtx_init(mtx_t *, int);
+void mtx_destroy(mtx_t *);
+
+int mtx_lock(mtx_t *);
+int mtx_timedlock(mtx_t *__restrict, const struct timespec *__restrict);
+int mtx_trylock(mtx_t *);
+int mtx_unlock(mtx_t *);
+
+int cnd_init(cnd_t *);
+void cnd_destroy(cnd_t *);
+
+int cnd_broadcast(cnd_t *);
+int cnd_signal(cnd_t *);
+
+int cnd_timedwait(cnd_t *__restrict, mtx_t *__restrict, const struct timespec *__restrict);
+int cnd_wait(cnd_t *, mtx_t *);
+
+int tss_create(tss_t *, tss_dtor_t);
+void tss_delete(tss_t);
+
+int tss_set(tss_t, void *);
+void *tss_get(tss_t);
+
+#if _REDIR_TIME64
+__REDIR(thrd_sleep, __thrd_sleep_time64);
+__REDIR(mtx_timedlock, __mtx_timedlock_time64);
+__REDIR(cnd_timedwait, __cnd_timedwait_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/time.h b/musl-include/i386/time.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/time.h
@@ -0,0 +1,168 @@
+#ifndef	_TIME_H
+#define _TIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+
+#define __NEED_size_t
+#define __NEED_time_t
+#define __NEED_clock_t
+#define __NEED_struct_timespec
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_clockid_t
+#define __NEED_timer_t
+#define __NEED_pid_t
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define __tm_gmtoff tm_gmtoff
+#define __tm_zone tm_zone
+#endif
+
+struct tm {
+	int tm_sec;
+	int tm_min;
+	int tm_hour;
+	int tm_mday;
+	int tm_mon;
+	int tm_year;
+	int tm_wday;
+	int tm_yday;
+	int tm_isdst;
+	long __tm_gmtoff;
+	const char *__tm_zone;
+};
+
+clock_t clock (void);
+time_t time (time_t *);
+double difftime (time_t, time_t);
+time_t mktime (struct tm *);
+size_t strftime (char *__restrict, size_t, const char *__restrict, const struct tm *__restrict);
+struct tm *gmtime (const time_t *);
+struct tm *localtime (const time_t *);
+char *asctime (const struct tm *);
+char *ctime (const time_t *);
+int timespec_get(struct timespec *, int);
+
+#define CLOCKS_PER_SEC 1000000L
+
+#define TIME_UTC 1
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+size_t strftime_l (char *  __restrict, size_t, const char *  __restrict, const struct tm *  __restrict, locale_t);
+
+struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict);
+struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict);
+char *asctime_r (const struct tm *__restrict, char *__restrict);
+char *ctime_r (const time_t *, char *);
+
+void tzset (void);
+
+struct itimerspec {
+	struct timespec it_interval;
+	struct timespec it_value;
+};
+
+#define CLOCK_REALTIME           0
+#define CLOCK_MONOTONIC          1
+#define CLOCK_PROCESS_CPUTIME_ID 2
+#define CLOCK_THREAD_CPUTIME_ID  3
+#define CLOCK_MONOTONIC_RAW      4
+#define CLOCK_REALTIME_COARSE    5
+#define CLOCK_MONOTONIC_COARSE   6
+#define CLOCK_BOOTTIME           7
+#define CLOCK_REALTIME_ALARM     8
+#define CLOCK_BOOTTIME_ALARM     9
+#define CLOCK_SGI_CYCLE         10
+#define CLOCK_TAI               11
+
+#define TIMER_ABSTIME 1
+
+int nanosleep (const struct timespec *, struct timespec *);
+int clock_getres (clockid_t, struct timespec *);
+int clock_gettime (clockid_t, struct timespec *);
+int clock_settime (clockid_t, const struct timespec *);
+int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *);
+int clock_getcpuclockid (pid_t, clockid_t *);
+
+struct sigevent;
+int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict);
+int timer_delete (timer_t);
+int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict);
+int timer_gettime (timer_t, struct itimerspec *);
+int timer_getoverrun (timer_t);
+
+extern char *tzname[2];
+
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+char *strptime (const char *__restrict, const char *__restrict, struct tm *__restrict);
+extern int daylight;
+extern long timezone;
+extern int getdate_err;
+struct tm *getdate (const char *);
+#endif
+
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int stime(const time_t *);
+time_t timegm(struct tm *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(time, __time64);
+__REDIR(difftime, __difftime64);
+__REDIR(mktime, __mktime64);
+__REDIR(gmtime, __gmtime64);
+__REDIR(localtime, __localtime64);
+__REDIR(ctime, __ctime64);
+__REDIR(timespec_get, __timespec_get_time64);
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+__REDIR(gmtime_r, __gmtime64_r);
+__REDIR(localtime_r, __localtime64_r);
+__REDIR(ctime_r, __ctime64_r);
+__REDIR(nanosleep, __nanosleep_time64);
+__REDIR(clock_getres, __clock_getres_time64);
+__REDIR(clock_gettime, __clock_gettime64);
+__REDIR(clock_settime, __clock_settime64);
+__REDIR(clock_nanosleep, __clock_nanosleep_time64);
+__REDIR(timer_settime, __timer_settime64);
+__REDIR(timer_gettime, __timer_gettime64);
+#endif
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(stime, __stime64);
+__REDIR(timegm, __timegm_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/musl-include/i386/uchar.h b/musl-include/i386/uchar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/uchar.h
@@ -0,0 +1,29 @@
+#ifndef _UCHAR_H
+#define _UCHAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if __cplusplus < 201103L
+typedef unsigned short char16_t;
+typedef unsigned char32_t;
+#endif
+
+#define __NEED_mbstate_t
+#define __NEED_size_t
+
+#include <features.h>
+#include <bits/alltypes.h>
+
+size_t c16rtomb(char *__restrict, char16_t, mbstate_t *__restrict);
+size_t mbrtoc16(char16_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+
+size_t c32rtomb(char *__restrict, char32_t, mbstate_t *__restrict);
+size_t mbrtoc32(char32_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/ucontext.h b/musl-include/i386/ucontext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/ucontext.h
@@ -0,0 +1,25 @@
+#ifndef _UCONTEXT_H
+#define _UCONTEXT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <signal.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define NGREG (sizeof(gregset_t)/sizeof(greg_t))
+#endif
+
+struct __ucontext;
+
+int  getcontext(struct __ucontext *);
+void makecontext(struct __ucontext *, void (*)(), int, ...);
+int  setcontext(const struct __ucontext *);
+int  swapcontext(struct __ucontext *, const struct __ucontext *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/i386/ulimit.h b/musl-include/i386/ulimit.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/ulimit.h
@@ -0,0 +1,17 @@
+#ifndef _ULIMIT_H
+#define _ULIMIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UL_GETFSIZE 1
+#define UL_SETFSIZE 2
+
+long ulimit (int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/unistd.h b/musl-include/i386/unistd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/unistd.h
@@ -0,0 +1,479 @@
+#ifndef	_UNISTD_H
+#define	_UNISTD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define STDIN_FILENO  0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+#define SEEK_DATA 3
+#define SEEK_HOLE 4
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_intptr_t
+#define __NEED_useconds_t
+
+#include <bits/alltypes.h>
+
+int pipe(int [2]);
+int pipe2(int [2], int);
+int close(int);
+int posix_close(int, int);
+int dup(int);
+int dup2(int, int);
+int dup3(int, int, int);
+off_t lseek(int, off_t, int);
+int fsync(int);
+int fdatasync(int);
+
+ssize_t read(int, void *, size_t);
+ssize_t write(int, const void *, size_t);
+ssize_t pread(int, void *, size_t, off_t);
+ssize_t pwrite(int, const void *, size_t, off_t);
+
+int chown(const char *, uid_t, gid_t);
+int fchown(int, uid_t, gid_t);
+int lchown(const char *, uid_t, gid_t);
+int fchownat(int, const char *, uid_t, gid_t, int);
+
+int link(const char *, const char *);
+int linkat(int, const char *, int, const char *, int);
+int symlink(const char *, const char *);
+int symlinkat(const char *, int, const char *);
+ssize_t readlink(const char *__restrict, char *__restrict, size_t);
+ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t);
+int unlink(const char *);
+int unlinkat(int, const char *, int);
+int rmdir(const char *);
+int truncate(const char *, off_t);
+int ftruncate(int, off_t);
+
+#define F_OK 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+
+int access(const char *, int);
+int faccessat(int, const char *, int, int);
+
+int chdir(const char *);
+int fchdir(int);
+char *getcwd(char *, size_t);
+
+unsigned alarm(unsigned);
+unsigned sleep(unsigned);
+int pause(void);
+
+pid_t fork(void);
+pid_t _Fork(void);
+int execve(const char *, char *const [], char *const []);
+int execv(const char *, char *const []);
+int execle(const char *, const char *, ...);
+int execl(const char *, const char *, ...);
+int execvp(const char *, char *const []);
+int execlp(const char *, const char *, ...);
+int fexecve(int, char *const [], char *const []);
+_Noreturn void _exit(int);
+
+pid_t getpid(void);
+pid_t getppid(void);
+pid_t getpgrp(void);
+pid_t getpgid(pid_t);
+int setpgid(pid_t, pid_t);
+pid_t setsid(void);
+pid_t getsid(pid_t);
+char *ttyname(int);
+int ttyname_r(int, char *, size_t);
+int isatty(int);
+pid_t tcgetpgrp(int);
+int tcsetpgrp(int, pid_t);
+
+uid_t getuid(void);
+uid_t geteuid(void);
+gid_t getgid(void);
+gid_t getegid(void);
+int getgroups(int, gid_t []);
+int setuid(uid_t);
+int seteuid(uid_t);
+int setgid(gid_t);
+int setegid(gid_t);
+
+char *getlogin(void);
+int getlogin_r(char *, size_t);
+int gethostname(char *, size_t);
+char *ctermid(char *);
+
+int getopt(int, char * const [], const char *);
+extern char *optarg;
+extern int optind, opterr, optopt;
+
+long pathconf(const char *, int);
+long fpathconf(int, int);
+long sysconf(int);
+size_t confstr(int, char *, size_t);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define F_ULOCK 0
+#define F_LOCK  1
+#define F_TLOCK 2
+#define F_TEST  3
+int setreuid(uid_t, uid_t);
+int setregid(gid_t, gid_t);
+int lockf(int, int, off_t);
+long gethostid(void);
+int nice(int);
+void sync(void);
+pid_t setpgrp(void);
+char *crypt(const char *, const char *);
+void encrypt(char *, int);
+void swab(const void *__restrict, void *__restrict, ssize_t);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+int usleep(unsigned);
+unsigned ualarm(unsigned, unsigned);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define L_SET 0
+#define L_INCR 1
+#define L_XTND 2
+int brk(void *);
+void *sbrk(intptr_t);
+pid_t vfork(void);
+int vhangup(void);
+int chroot(const char *);
+int getpagesize(void);
+int getdtablesize(void);
+int sethostname(const char *, size_t);
+int getdomainname(char *, size_t);
+int setdomainname(const char *, size_t);
+int setgroups(size_t, const gid_t *);
+char *getpass(const char *);
+int daemon(int, int);
+void setusershell(void);
+void endusershell(void);
+char *getusershell(void);
+int acct(const char *);
+long syscall(long, ...);
+int execvpe(const char *, char *const [], char *const []);
+int issetugid(void);
+int getentropy(void *, size_t);
+extern int optreset;
+#endif
+
+#ifdef _GNU_SOURCE
+extern char **environ;
+int setresuid(uid_t, uid_t, uid_t);
+int setresgid(gid_t, gid_t, gid_t);
+int getresuid(uid_t *, uid_t *, uid_t *);
+int getresgid(gid_t *, gid_t *, gid_t *);
+char *get_current_dir_name(void);
+int syncfs(int);
+int euidaccess(const char *, int);
+int eaccess(const char *, int);
+ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
+pid_t gettid(void);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define lseek64 lseek
+#define pread64 pread
+#define pwrite64 pwrite
+#define truncate64 truncate
+#define ftruncate64 ftruncate
+#define lockf64 lockf
+#define off64_t off_t
+#endif
+
+#define POSIX_CLOSE_RESTART     0
+
+#define _XOPEN_VERSION          700
+#define _XOPEN_UNIX             1
+#define _XOPEN_ENH_I18N         1
+
+#define _POSIX_VERSION          200809L
+#define _POSIX2_VERSION         _POSIX_VERSION
+
+#define _POSIX_ADVISORY_INFO    _POSIX_VERSION
+#define _POSIX_CHOWN_RESTRICTED 1
+#define _POSIX_IPV6             _POSIX_VERSION
+#define _POSIX_JOB_CONTROL      1
+#define _POSIX_MAPPED_FILES     _POSIX_VERSION
+#define _POSIX_MEMLOCK          _POSIX_VERSION
+#define _POSIX_MEMLOCK_RANGE    _POSIX_VERSION
+#define _POSIX_MEMORY_PROTECTION _POSIX_VERSION
+#define _POSIX_MESSAGE_PASSING  _POSIX_VERSION
+#define _POSIX_FSYNC            _POSIX_VERSION
+#define _POSIX_NO_TRUNC         1
+#define _POSIX_RAW_SOCKETS      _POSIX_VERSION
+#define _POSIX_REALTIME_SIGNALS _POSIX_VERSION
+#define _POSIX_REGEXP           1
+#define _POSIX_SAVED_IDS        1
+#define _POSIX_SHELL            1
+#define _POSIX_SPAWN            _POSIX_VERSION
+#define _POSIX_VDISABLE         0
+
+#define _POSIX_THREADS          _POSIX_VERSION
+#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
+#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
+#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
+#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
+#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
+#define _POSIX_THREAD_CPUTIME   _POSIX_VERSION
+#define _POSIX_TIMERS           _POSIX_VERSION
+#define _POSIX_TIMEOUTS         _POSIX_VERSION
+#define _POSIX_MONOTONIC_CLOCK  _POSIX_VERSION
+#define _POSIX_CPUTIME          _POSIX_VERSION
+#define _POSIX_CLOCK_SELECTION  _POSIX_VERSION
+#define _POSIX_BARRIERS         _POSIX_VERSION
+#define _POSIX_SPIN_LOCKS       _POSIX_VERSION
+#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION
+#define _POSIX_ASYNCHRONOUS_IO  _POSIX_VERSION
+#define _POSIX_SEMAPHORES       _POSIX_VERSION
+#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION
+
+#define _POSIX2_C_BIND          _POSIX_VERSION
+
+#include <bits/posix.h>
+
+
+
+#define _PC_LINK_MAX	0
+#define _PC_MAX_CANON	1
+#define _PC_MAX_INPUT	2
+#define _PC_NAME_MAX	3
+#define _PC_PATH_MAX	4
+#define _PC_PIPE_BUF	5
+#define _PC_CHOWN_RESTRICTED	6
+#define _PC_NO_TRUNC	7
+#define _PC_VDISABLE	8
+#define _PC_SYNC_IO	9
+#define _PC_ASYNC_IO	10
+#define _PC_PRIO_IO	11
+#define _PC_SOCK_MAXBUF	12
+#define _PC_FILESIZEBITS	13
+#define _PC_REC_INCR_XFER_SIZE	14
+#define _PC_REC_MAX_XFER_SIZE	15
+#define _PC_REC_MIN_XFER_SIZE	16
+#define _PC_REC_XFER_ALIGN	17
+#define _PC_ALLOC_SIZE_MIN	18
+#define _PC_SYMLINK_MAX	19
+#define _PC_2_SYMLINKS	20
+
+#define _SC_ARG_MAX	0
+#define _SC_CHILD_MAX	1
+#define _SC_CLK_TCK	2
+#define _SC_NGROUPS_MAX	3
+#define _SC_OPEN_MAX	4
+#define _SC_STREAM_MAX	5
+#define _SC_TZNAME_MAX	6
+#define _SC_JOB_CONTROL	7
+#define _SC_SAVED_IDS	8
+#define _SC_REALTIME_SIGNALS	9
+#define _SC_PRIORITY_SCHEDULING	10
+#define _SC_TIMERS	11
+#define _SC_ASYNCHRONOUS_IO	12
+#define _SC_PRIORITIZED_IO	13
+#define _SC_SYNCHRONIZED_IO	14
+#define _SC_FSYNC	15
+#define _SC_MAPPED_FILES	16
+#define _SC_MEMLOCK	17
+#define _SC_MEMLOCK_RANGE	18
+#define _SC_MEMORY_PROTECTION	19
+#define _SC_MESSAGE_PASSING	20
+#define _SC_SEMAPHORES	21
+#define _SC_SHARED_MEMORY_OBJECTS	22
+#define _SC_AIO_LISTIO_MAX	23
+#define _SC_AIO_MAX	24
+#define _SC_AIO_PRIO_DELTA_MAX	25
+#define _SC_DELAYTIMER_MAX	26
+#define _SC_MQ_OPEN_MAX	27
+#define _SC_MQ_PRIO_MAX	28
+#define _SC_VERSION	29
+#define _SC_PAGE_SIZE	30
+#define _SC_PAGESIZE	30 /* !! */
+#define _SC_RTSIG_MAX	31
+#define _SC_SEM_NSEMS_MAX	32
+#define _SC_SEM_VALUE_MAX	33
+#define _SC_SIGQUEUE_MAX	34
+#define _SC_TIMER_MAX	35
+#define _SC_BC_BASE_MAX	36
+#define _SC_BC_DIM_MAX	37
+#define _SC_BC_SCALE_MAX	38
+#define _SC_BC_STRING_MAX	39
+#define _SC_COLL_WEIGHTS_MAX	40
+#define _SC_EXPR_NEST_MAX	42
+#define _SC_LINE_MAX	43
+#define _SC_RE_DUP_MAX	44
+#define _SC_2_VERSION	46
+#define _SC_2_C_BIND	47
+#define _SC_2_C_DEV	48
+#define _SC_2_FORT_DEV	49
+#define _SC_2_FORT_RUN	50
+#define _SC_2_SW_DEV	51
+#define _SC_2_LOCALEDEF	52
+#define _SC_UIO_MAXIOV	60 /* !! */
+#define _SC_IOV_MAX	60
+#define _SC_THREADS	67
+#define _SC_THREAD_SAFE_FUNCTIONS	68
+#define _SC_GETGR_R_SIZE_MAX	69
+#define _SC_GETPW_R_SIZE_MAX	70
+#define _SC_LOGIN_NAME_MAX	71
+#define _SC_TTY_NAME_MAX	72
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS	73
+#define _SC_THREAD_KEYS_MAX	74
+#define _SC_THREAD_STACK_MIN	75
+#define _SC_THREAD_THREADS_MAX	76
+#define _SC_THREAD_ATTR_STACKADDR	77
+#define _SC_THREAD_ATTR_STACKSIZE	78
+#define _SC_THREAD_PRIORITY_SCHEDULING	79
+#define _SC_THREAD_PRIO_INHERIT	80
+#define _SC_THREAD_PRIO_PROTECT	81
+#define _SC_THREAD_PROCESS_SHARED	82
+#define _SC_NPROCESSORS_CONF	83
+#define _SC_NPROCESSORS_ONLN	84
+#define _SC_PHYS_PAGES	85
+#define _SC_AVPHYS_PAGES	86
+#define _SC_ATEXIT_MAX	87
+#define _SC_PASS_MAX	88
+#define _SC_XOPEN_VERSION	89
+#define _SC_XOPEN_XCU_VERSION	90
+#define _SC_XOPEN_UNIX	91
+#define _SC_XOPEN_CRYPT	92
+#define _SC_XOPEN_ENH_I18N	93
+#define _SC_XOPEN_SHM	94
+#define _SC_2_CHAR_TERM	95
+#define _SC_2_UPE	97
+#define _SC_XOPEN_XPG2	98
+#define _SC_XOPEN_XPG3	99
+#define _SC_XOPEN_XPG4	100
+#define _SC_NZERO	109
+#define _SC_XBS5_ILP32_OFF32	125
+#define _SC_XBS5_ILP32_OFFBIG	126
+#define _SC_XBS5_LP64_OFF64	127
+#define _SC_XBS5_LPBIG_OFFBIG	128
+#define _SC_XOPEN_LEGACY	129
+#define _SC_XOPEN_REALTIME	130
+#define _SC_XOPEN_REALTIME_THREADS	131
+#define _SC_ADVISORY_INFO	132
+#define _SC_BARRIERS	133
+#define _SC_CLOCK_SELECTION	137
+#define _SC_CPUTIME	138
+#define _SC_THREAD_CPUTIME	139
+#define _SC_MONOTONIC_CLOCK	149
+#define _SC_READER_WRITER_LOCKS	153
+#define _SC_SPIN_LOCKS	154
+#define _SC_REGEXP	155
+#define _SC_SHELL	157
+#define _SC_SPAWN	159
+#define _SC_SPORADIC_SERVER	160
+#define _SC_THREAD_SPORADIC_SERVER	161
+#define _SC_TIMEOUTS	164
+#define _SC_TYPED_MEMORY_OBJECTS	165
+#define _SC_2_PBS	168
+#define _SC_2_PBS_ACCOUNTING	169
+#define _SC_2_PBS_LOCATE	170
+#define _SC_2_PBS_MESSAGE	171
+#define _SC_2_PBS_TRACK	172
+#define _SC_SYMLOOP_MAX	173
+#define _SC_STREAMS	174
+#define _SC_2_PBS_CHECKPOINT	175
+#define _SC_V6_ILP32_OFF32	176
+#define _SC_V6_ILP32_OFFBIG	177
+#define _SC_V6_LP64_OFF64	178
+#define _SC_V6_LPBIG_OFFBIG	179
+#define _SC_HOST_NAME_MAX	180
+#define _SC_TRACE	181
+#define _SC_TRACE_EVENT_FILTER	182
+#define _SC_TRACE_INHERIT	183
+#define _SC_TRACE_LOG	184
+
+#define _SC_IPV6	235
+#define _SC_RAW_SOCKETS	236
+#define _SC_V7_ILP32_OFF32	237
+#define _SC_V7_ILP32_OFFBIG	238
+#define _SC_V7_LP64_OFF64	239
+#define _SC_V7_LPBIG_OFFBIG	240
+#define _SC_SS_REPL_MAX	241
+#define _SC_TRACE_EVENT_NAME_MAX	242
+#define _SC_TRACE_NAME_MAX	243
+#define _SC_TRACE_SYS_MAX	244
+#define _SC_TRACE_USER_EVENT_MAX	245
+#define _SC_XOPEN_STREAMS	246
+#define _SC_THREAD_ROBUST_PRIO_INHERIT	247
+#define _SC_THREAD_ROBUST_PRIO_PROTECT	248
+#define _SC_MINSIGSTKSZ	249
+#define _SC_SIGSTKSZ	250
+
+#define _CS_PATH	0
+#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS	1
+#define _CS_GNU_LIBC_VERSION	2
+#define _CS_GNU_LIBPTHREAD_VERSION	3
+#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS	4
+#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS	5
+
+#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS	1116
+#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS	1117
+#define _CS_POSIX_V6_ILP32_OFF32_LIBS	1118
+#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS	1119
+#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS	1120
+#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS	1121
+#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS	1122
+#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS	1123
+#define _CS_POSIX_V6_LP64_OFF64_CFLAGS	1124
+#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS	1125
+#define _CS_POSIX_V6_LP64_OFF64_LIBS	1126
+#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS	1127
+#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS	1128
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS	1129
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS	1130
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS	1131
+#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS	1132
+#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS	1133
+#define _CS_POSIX_V7_ILP32_OFF32_LIBS	1134
+#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS	1135
+#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS	1136
+#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS	1137
+#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS	1138
+#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS	1139
+#define _CS_POSIX_V7_LP64_OFF64_CFLAGS	1140
+#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS	1141
+#define _CS_POSIX_V7_LP64_OFF64_LIBS	1142
+#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS	1143
+#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS	1144
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS	1145
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS	1146
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS	1147
+#define _CS_V6_ENV	1148
+#define _CS_V7_ENV	1149
+#define _CS_POSIX_V7_THREADS_CFLAGS	1150
+#define _CS_POSIX_V7_THREADS_LDFLAGS	1151
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/utime.h b/musl-include/i386/utime.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/utime.h
@@ -0,0 +1,29 @@
+#ifndef	_UTIME_H
+#define	_UTIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+
+#include <bits/alltypes.h>
+
+struct utimbuf {
+	time_t actime;
+	time_t modtime;
+};
+
+int utime (const char *, const struct utimbuf *);
+
+#if _REDIR_TIME64
+__REDIR(utime, __utime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/utmp.h b/musl-include/i386/utmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/utmp.h
@@ -0,0 +1,52 @@
+#ifndef _UTMP_H
+#define _UTMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <utmpx.h>
+
+#define ACCOUNTING 9
+#define UT_NAMESIZE 32
+#define UT_HOSTSIZE 256
+#define UT_LINESIZE 32
+
+struct lastlog {
+	time_t ll_time;
+	char ll_line[UT_LINESIZE];
+	char ll_host[UT_HOSTSIZE];
+};
+
+#define ut_time ut_tv.tv_sec
+#define ut_name ut_user
+#define ut_addr ut_addr_v6[0]
+#define utmp utmpx
+#define e_exit __e_exit
+#define e_termination __e_termination
+
+void         endutent(void);
+struct utmp *getutent(void);
+struct utmp *getutid(const struct utmp *);
+struct utmp *getutline(const struct utmp *);
+struct utmp *pututline(const struct utmp *);
+void         setutent(void);
+
+void updwtmp(const char *, const struct utmp *);
+int utmpname(const char *);
+
+int login_tty(int);
+
+#define _PATH_UTMP "/dev/null/utmp"
+#define _PATH_WTMP "/dev/null/wtmp"
+
+#define UTMP_FILE _PATH_UTMP
+#define WTMP_FILE _PATH_WTMP
+#define UTMP_FILENAME _PATH_UTMP
+#define WTMP_FILENAME _PATH_WTMP
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/utmpx.h b/musl-include/i386/utmpx.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/utmpx.h
@@ -0,0 +1,67 @@
+#ifndef _UTMPX_H
+#define _UTMPX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_struct_timeval
+
+#include <bits/alltypes.h>
+
+struct utmpx {
+	short ut_type;
+	short __ut_pad1;
+	pid_t ut_pid;
+	char ut_line[32];
+	char ut_id[4];
+	char ut_user[32];
+	char ut_host[256];
+	struct {
+		short __e_termination;
+		short __e_exit;
+	} ut_exit;
+#if __BYTE_ORDER == 1234
+	int ut_session, __ut_pad2;
+#else
+	int __ut_pad2, ut_session;
+#endif
+	struct timeval ut_tv;
+	unsigned ut_addr_v6[4];
+	char __unused[20];
+};
+
+void          endutxent(void);
+struct utmpx *getutxent(void);
+struct utmpx *getutxid(const struct utmpx *);
+struct utmpx *getutxline(const struct utmpx *);
+struct utmpx *pututxline(const struct utmpx *);
+void          setutxent(void);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define e_exit __e_exit
+#define e_termination __e_termination
+void updwtmpx(const char *, const struct utmpx *);
+int utmpxname(const char *);
+#endif
+
+#define EMPTY           0
+#define RUN_LVL         1
+#define BOOT_TIME       2
+#define NEW_TIME        3
+#define OLD_TIME        4
+#define INIT_PROCESS    5
+#define LOGIN_PROCESS   6
+#define USER_PROCESS    7
+#define DEAD_PROCESS    8
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/values.h b/musl-include/i386/values.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/values.h
@@ -0,0 +1,39 @@
+#ifndef _VALUES_H
+#define _VALUES_H
+
+#include <limits.h>
+
+#define CHARBITS   (sizeof(char)   * 8)
+#define SHORTBITS  (sizeof(short)  * 8)
+#define INTBITS    (sizeof(int)    * 8)
+#define LONGBITS   (sizeof(long)   * 8)
+#define PTRBITS    (sizeof(char *) * 8)
+#define DOUBLEBITS (sizeof(double) * 8)
+#define FLOATBITS  (sizeof(float)  * 8)
+
+#define MINSHORT SHRT_MIN
+#define MININT   INT_MIN
+#define MINLONG  LONG_MIN
+
+#define MAXSHORT SHRT_MAX
+#define MAXINT   INT_MAX
+#define MAXLONG  LONG_MAX
+
+#define HIBITS   MINSHORT
+#define HIBITL   MINLONG
+
+#include <float.h>
+
+#define MAXDOUBLE DBL_MAX
+#undef  MAXFLOAT
+#define MAXFLOAT  FLT_MAX
+#define MINDOUBLE DBL_MIN
+#define MINFLOAT  FLT_MIN
+#define DMINEXP   DBL_MIN_EXP
+#define FMINEXP   FLT_MIN_EXP
+#define DMAXEXP   DBL_MAX_EXP
+#define FMAXEXP   FLT_MAX_EXP
+
+#define BITSPERBYTE CHAR_BIT
+
+#endif
diff --git a/musl-include/i386/wait.h b/musl-include/i386/wait.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/wait.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <wait.h> to <sys/wait.h>
+#include <sys/wait.h>
diff --git a/musl-include/i386/wchar.h b/musl-include/i386/wchar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/wchar.h
@@ -0,0 +1,207 @@
+#ifndef _WCHAR_H
+#define _WCHAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_FILE
+#define __NEED___isoc_va_list
+#define __NEED_size_t
+#define __NEED_wchar_t
+#define __NEED_wint_t
+#define __NEED_mbstate_t
+
+#if __STDC_VERSION__ < 201112L
+#define __NEED_struct__IO_FILE
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#define __NEED_va_list
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_wctype_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#undef WEOF
+#define WEOF 0xffffffffU
+
+wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+int wcscmp (const wchar_t *, const wchar_t *);
+int wcsncmp (const wchar_t *, const wchar_t *, size_t);
+
+int wcscoll(const wchar_t *, const wchar_t *);
+size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+wchar_t *wcschr (const wchar_t *, wchar_t);
+wchar_t *wcsrchr (const wchar_t *, wchar_t);
+
+size_t wcscspn (const wchar_t *, const wchar_t *);
+size_t wcsspn (const wchar_t *, const wchar_t *);
+wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
+
+wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
+
+size_t wcslen (const wchar_t *);
+
+wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcswcs (const wchar_t *, const wchar_t *);
+
+wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
+int wmemcmp (const wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemset (wchar_t *, wchar_t, size_t);
+
+wint_t btowc (int);
+int wctob (wint_t);
+
+int mbsinit (const mbstate_t *);
+size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
+
+size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
+
+size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
+size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
+
+float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
+double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
+long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
+
+long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
+
+long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
+
+
+
+int fwide (FILE *, int);
+
+
+int wprintf (const wchar_t *__restrict, ...);
+int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
+
+int vwprintf (const wchar_t *__restrict, __isoc_va_list);
+int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
+int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
+
+int wscanf (const wchar_t *__restrict, ...);
+int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
+
+int vwscanf (const wchar_t *__restrict, __isoc_va_list);
+int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
+int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
+
+wint_t fgetwc (FILE *);
+wint_t getwc (FILE *);
+wint_t getwchar (void);
+
+wint_t fputwc (wchar_t, FILE *);
+wint_t putwc (wchar_t, FILE *);
+wint_t putwchar (wchar_t);
+
+wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
+int fputws (const wchar_t *__restrict, FILE *__restrict);
+
+wint_t ungetwc (wint_t, FILE *);
+
+struct tm;
+size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
+
+#undef iswdigit
+
+#if defined(_GNU_SOURCE)
+wint_t fgetwc_unlocked (FILE *);
+wint_t getwc_unlocked (FILE *);
+wint_t getwchar_unlocked (void);
+wint_t fputwc_unlocked (wchar_t, FILE *);
+wint_t putwc_unlocked (wchar_t, FILE *);
+wint_t putwchar_unlocked (wchar_t);
+wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict);
+int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t);
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)  || defined(_BSD_SOURCE)
+FILE *open_wmemstream(wchar_t **, size_t *);
+size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
+size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
+wchar_t *wcsdup(const wchar_t *);
+size_t wcsnlen (const wchar_t *, size_t);
+wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+int wcscasecmp(const wchar_t *, const wchar_t *);
+int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
+int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
+int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
+int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
+size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int wcwidth (wchar_t);
+int wcswidth (const wchar_t *, size_t);
+int       iswalnum(wint_t);
+int       iswalpha(wint_t);
+int       iswblank(wint_t);
+int       iswcntrl(wint_t);
+int       iswdigit(wint_t);
+int       iswgraph(wint_t);
+int       iswlower(wint_t);
+int       iswprint(wint_t);
+int       iswpunct(wint_t);
+int       iswspace(wint_t);
+int       iswupper(wint_t);
+int       iswxdigit(wint_t);
+int       iswctype(wint_t, wctype_t);
+wint_t    towlower(wint_t);
+wint_t    towupper(wint_t);
+wctype_t  wctype(const char *);
+
+#ifndef __cplusplus
+#undef iswdigit
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/wctype.h b/musl-include/i386/wctype.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/wctype.h
@@ -0,0 +1,79 @@
+#ifndef _WCTYPE_H
+#define _WCTYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_wint_t
+#define __NEED_wctype_t
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+typedef const int * wctrans_t;
+
+#undef WEOF
+#define WEOF 0xffffffffU
+
+#undef iswdigit
+
+int       iswalnum(wint_t);
+int       iswalpha(wint_t);
+int       iswblank(wint_t);
+int       iswcntrl(wint_t);
+int       iswdigit(wint_t);
+int       iswgraph(wint_t);
+int       iswlower(wint_t);
+int       iswprint(wint_t);
+int       iswpunct(wint_t);
+int       iswspace(wint_t);
+int       iswupper(wint_t);
+int       iswxdigit(wint_t);
+int       iswctype(wint_t, wctype_t);
+wint_t    towctrans(wint_t, wctrans_t);
+wint_t    towlower(wint_t);
+wint_t    towupper(wint_t);
+wctrans_t wctrans(const char *);
+wctype_t  wctype(const char *);
+
+#ifndef __cplusplus
+#undef iswdigit
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+int iswalnum_l(wint_t, locale_t);
+int iswalpha_l(wint_t, locale_t);
+int iswblank_l(wint_t, locale_t);
+int iswcntrl_l(wint_t, locale_t);
+int iswdigit_l(wint_t, locale_t);
+int iswgraph_l(wint_t, locale_t);
+int iswlower_l(wint_t, locale_t);
+int iswprint_l(wint_t, locale_t);
+int iswpunct_l(wint_t, locale_t);
+int iswspace_l(wint_t, locale_t);
+int iswupper_l(wint_t, locale_t);
+int iswxdigit_l(wint_t, locale_t);
+int iswctype_l(wint_t, wctype_t, locale_t);
+wint_t towlower_l(wint_t, locale_t);
+wint_t towupper_l(wint_t, locale_t);
+wint_t towctrans_l(wint_t, wctrans_t, locale_t);
+wctrans_t wctrans_l(const char *, locale_t);
+wctype_t  wctype_l(const char *, locale_t);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/i386/wordexp.h b/musl-include/i386/wordexp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/i386/wordexp.h
@@ -0,0 +1,41 @@
+#ifndef	_WORDEXP_H
+#define	_WORDEXP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#define WRDE_DOOFFS  1
+#define WRDE_APPEND  2
+#define WRDE_NOCMD   4
+#define WRDE_REUSE   8
+#define WRDE_SHOWERR 16
+#define WRDE_UNDEF   32
+
+typedef struct {
+	size_t we_wordc;
+	char **we_wordv;
+	size_t we_offs;
+} wordexp_t;
+
+#define WRDE_NOSYS   -1
+#define WRDE_NOSPACE 1
+#define WRDE_BADCHAR 2
+#define WRDE_BADVAL  3
+#define WRDE_CMDSUB  4
+#define WRDE_SYNTAX  5
+
+int wordexp (const char *__restrict, wordexp_t *__restrict, int);
+void wordfree (wordexp_t *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/aio.h b/musl-include/x86_64/aio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/aio.h
@@ -0,0 +1,73 @@
+#ifndef _AIO_H
+#define _AIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <signal.h>
+#include <time.h>
+
+#define __NEED_ssize_t
+#define __NEED_off_t
+
+#include <bits/alltypes.h>
+
+struct aiocb {
+	int aio_fildes, aio_lio_opcode, aio_reqprio;
+	volatile void *aio_buf;
+	size_t aio_nbytes;
+	struct sigevent aio_sigevent;
+	void *__td;
+	int __lock[2];
+	volatile int __err;
+	ssize_t __ret;
+	off_t aio_offset;
+	void *__next, *__prev;
+	char __dummy4[32-2*sizeof(void *)];
+};
+
+#define AIO_CANCELED 0
+#define AIO_NOTCANCELED 1
+#define AIO_ALLDONE 2
+
+#define LIO_READ 0
+#define LIO_WRITE 1
+#define LIO_NOP 2
+
+#define LIO_WAIT 0
+#define LIO_NOWAIT 1
+
+int aio_read(struct aiocb *);
+int aio_write(struct aiocb *);
+int aio_error(const struct aiocb *);
+ssize_t aio_return(struct aiocb *);
+int aio_cancel(int, struct aiocb *);
+int aio_suspend(const struct aiocb *const [], int, const struct timespec *);
+int aio_fsync(int, struct aiocb *);
+
+int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define aiocb64 aiocb
+#define aio_read64 aio_read
+#define aio_write64 aio_write
+#define aio_error64 aio_error
+#define aio_return64 aio_return
+#define aio_cancel64 aio_cancel
+#define aio_suspend64 aio_suspend
+#define aio_fsync64 aio_fsync
+#define lio_listio64 lio_listio
+#define off64_t off_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(aio_suspend, __aio_suspend_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/alloca.h b/musl-include/x86_64/alloca.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/alloca.h
@@ -0,0 +1,19 @@
+#ifndef	_ALLOCA_H
+#define	_ALLOCA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	__NEED_size_t
+#include <bits/alltypes.h>
+
+void *alloca(size_t);
+
+#define alloca __builtin_alloca
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/ar.h b/musl-include/x86_64/ar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/ar.h
@@ -0,0 +1,25 @@
+#ifndef _AR_H
+#define _AR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ARMAG "!<arch>\n"
+#define SARMAG 8
+#define ARFMAG "`\n"
+
+struct ar_hdr {
+	char ar_name[16];
+	char ar_date[12];
+	char ar_uid[6], ar_gid[6];
+	char ar_mode[8];
+	char ar_size[10];
+	char ar_fmag[2];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/arpa/ftp.h b/musl-include/x86_64/arpa/ftp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/arpa/ftp.h
@@ -0,0 +1,35 @@
+#ifndef _ARPA_FTP_H
+#define _ARPA_FTP_H
+#define PRELIM 1
+#define COMPLETE 2
+#define CONTINUE 3
+#define TRANSIENT 4
+#define ERROR 5
+#define TYPE_A 1
+#define TYPE_E 2
+#define TYPE_I 3
+#define TYPE_L 4
+#define FORM_N 1
+#define FORM_T 2
+#define FORM_C 3
+#define STRU_F 1
+#define STRU_R 2
+#define STRU_P 3
+#define MODE_S 1
+#define MODE_B 2
+#define MODE_C 3
+#define REC_ESC '\377'
+#define REC_EOR '\001'
+#define REC_EOF '\002'
+#define BLK_EOR 0x80
+#define BLK_EOF 0x40
+#define BLK_ERRORS 0x20
+#define BLK_RESTART 0x10
+#define BLK_BYTECOUNT 2
+#ifdef FTP_NAMES
+char *modenames[] =  {"0", "Stream", "Block", "Compressed" };
+char *strunames[] =  {"0", "File", "Record", "Page" };
+char *typenames[] =  {"0", "ASCII", "EBCDIC", "Image", "Local" };
+char *formnames[] =  {"0", "Nonprint", "Telnet", "Carriage-control" };
+#endif
+#endif
diff --git a/musl-include/x86_64/arpa/inet.h b/musl-include/x86_64/arpa/inet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/arpa/inet.h
@@ -0,0 +1,31 @@
+#ifndef _ARPA_INET_H
+#define	_ARPA_INET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+
+uint32_t htonl(uint32_t);
+uint16_t htons(uint16_t);
+uint32_t ntohl(uint32_t);
+uint16_t ntohs(uint16_t);
+
+in_addr_t inet_addr (const char *);
+in_addr_t inet_network (const char *);
+char *inet_ntoa (struct in_addr);
+int inet_pton (int, const char *__restrict, void *__restrict);
+const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
+
+int inet_aton (const char *, struct in_addr *);
+struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
+in_addr_t inet_lnaof(struct in_addr);
+in_addr_t inet_netof(struct in_addr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/arpa/nameser.h b/musl-include/x86_64/arpa/nameser.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/arpa/nameser.h
@@ -0,0 +1,526 @@
+#ifndef _ARPA_NAMESER_H
+#define _ARPA_NAMESER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+#include <stdint.h>
+
+#define __NAMESER	19991006
+#define NS_PACKETSZ	512
+#define NS_MAXDNAME	1025
+#define NS_MAXMSG	65535
+#define NS_MAXCDNAME	255
+#define NS_MAXLABEL	63
+#define NS_HFIXEDSZ	12
+#define NS_QFIXEDSZ	4
+#define NS_RRFIXEDSZ	10
+#define NS_INT32SZ	4
+#define NS_INT16SZ	2
+#define NS_INT8SZ	1
+#define NS_INADDRSZ	4
+#define NS_IN6ADDRSZ	16
+#define NS_CMPRSFLGS	0xc0
+#define NS_DEFAULTPORT	53
+
+typedef enum __ns_sect {
+	ns_s_qd = 0,
+	ns_s_zn = 0,
+	ns_s_an = 1,
+	ns_s_pr = 1,
+	ns_s_ns = 2,
+	ns_s_ud = 2,
+	ns_s_ar = 3,
+	ns_s_max = 4
+} ns_sect;
+
+typedef struct __ns_msg {
+	const unsigned char *_msg, *_eom;
+	uint16_t _id, _flags, _counts[ns_s_max];
+	const unsigned char *_sections[ns_s_max];
+	ns_sect _sect;
+	int _rrnum;
+	const unsigned char *_msg_ptr;
+} ns_msg;
+
+struct _ns_flagdata {  int mask, shift;  };
+extern const struct _ns_flagdata _ns_flagdata[];
+
+#define ns_msg_id(handle) ((handle)._id + 0)
+#define ns_msg_base(handle) ((handle)._msg + 0)
+#define ns_msg_end(handle) ((handle)._eom + 0)
+#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)
+#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
+#define ns_msg_getflag(handle, flag) \
+	(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
+
+typedef	struct __ns_rr {
+	char		name[NS_MAXDNAME];
+	uint16_t	type;
+	uint16_t	rr_class;
+	uint32_t	ttl;
+	uint16_t	rdlength;
+	const unsigned char *rdata;
+} ns_rr;
+
+#define ns_rr_name(rr)	(((rr).name[0] != '\0') ? (rr).name : ".")
+#define ns_rr_type(rr)	((ns_type)((rr).type + 0))
+#define ns_rr_class(rr)	((ns_class)((rr).rr_class + 0))
+#define ns_rr_ttl(rr)	((rr).ttl + 0)
+#define ns_rr_rdlen(rr)	((rr).rdlength + 0)
+#define ns_rr_rdata(rr)	((rr).rdata + 0)
+
+typedef enum __ns_flag {
+	ns_f_qr,
+	ns_f_opcode,
+	ns_f_aa,
+	ns_f_tc,
+	ns_f_rd,
+	ns_f_ra,
+	ns_f_z,
+	ns_f_ad,
+	ns_f_cd,
+	ns_f_rcode,
+	ns_f_max
+} ns_flag;
+
+typedef enum __ns_opcode {
+	ns_o_query = 0,
+	ns_o_iquery = 1,
+	ns_o_status = 2,
+	ns_o_notify = 4,
+	ns_o_update = 5,
+	ns_o_max = 6
+} ns_opcode;
+
+typedef	enum __ns_rcode {
+	ns_r_noerror = 0,
+	ns_r_formerr = 1,
+	ns_r_servfail = 2,
+	ns_r_nxdomain = 3,
+	ns_r_notimpl = 4,
+	ns_r_refused = 5,
+	ns_r_yxdomain = 6,
+	ns_r_yxrrset = 7,
+	ns_r_nxrrset = 8,
+	ns_r_notauth = 9,
+	ns_r_notzone = 10,
+	ns_r_max = 11,
+	ns_r_badvers = 16,
+	ns_r_badsig = 16,
+	ns_r_badkey = 17,
+	ns_r_badtime = 18
+} ns_rcode;
+
+typedef enum __ns_update_operation {
+	ns_uop_delete = 0,
+	ns_uop_add = 1,
+	ns_uop_max = 2
+} ns_update_operation;
+
+struct ns_tsig_key {
+        char name[NS_MAXDNAME], alg[NS_MAXDNAME];
+        unsigned char *data;
+        int len;
+};
+typedef struct ns_tsig_key ns_tsig_key;
+
+struct ns_tcp_tsig_state {
+	int counter;
+	struct dst_key *key;
+	void *ctx;
+	unsigned char sig[NS_PACKETSZ];
+	int siglen;
+};
+typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
+
+#define NS_TSIG_FUDGE 300
+#define NS_TSIG_TCP_COUNT 100
+#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
+
+#define NS_TSIG_ERROR_NO_TSIG -10
+#define NS_TSIG_ERROR_NO_SPACE -11
+#define NS_TSIG_ERROR_FORMERR -12
+
+typedef enum __ns_type {
+	ns_t_invalid = 0,
+	ns_t_a = 1,
+	ns_t_ns = 2,
+	ns_t_md = 3,
+	ns_t_mf = 4,
+	ns_t_cname = 5,
+	ns_t_soa = 6,
+	ns_t_mb = 7,
+	ns_t_mg = 8,
+	ns_t_mr = 9,
+	ns_t_null = 10,
+	ns_t_wks = 11,
+	ns_t_ptr = 12,
+	ns_t_hinfo = 13,
+	ns_t_minfo = 14,
+	ns_t_mx = 15,
+	ns_t_txt = 16,
+	ns_t_rp = 17,
+	ns_t_afsdb = 18,
+	ns_t_x25 = 19,
+	ns_t_isdn = 20,
+	ns_t_rt = 21,
+	ns_t_nsap = 22,
+	ns_t_nsap_ptr = 23,
+	ns_t_sig = 24,
+	ns_t_key = 25,
+	ns_t_px = 26,
+	ns_t_gpos = 27,
+	ns_t_aaaa = 28,
+	ns_t_loc = 29,
+	ns_t_nxt = 30,
+	ns_t_eid = 31,
+	ns_t_nimloc = 32,
+	ns_t_srv = 33,
+	ns_t_atma = 34,
+	ns_t_naptr = 35,
+	ns_t_kx = 36,
+	ns_t_cert = 37,
+	ns_t_a6 = 38,
+	ns_t_dname = 39,
+	ns_t_sink = 40,
+	ns_t_opt = 41,
+	ns_t_apl = 42,
+	ns_t_ds = 43,
+	ns_t_sshfp = 44,
+	ns_t_ipseckey = 45,
+	ns_t_rrsig = 46,
+	ns_t_nsec = 47,
+	ns_t_dnskey = 48,
+	ns_t_dhcid = 49,
+	ns_t_nsec3 = 50,
+	ns_t_nsec3param = 51,
+	ns_t_tlsa = 52,
+	ns_t_smimea = 53,
+	ns_t_hip = 55,
+	ns_t_ninfo = 56,
+	ns_t_rkey = 57,
+	ns_t_talink = 58,
+	ns_t_cds = 59,
+	ns_t_cdnskey = 60,
+	ns_t_openpgpkey = 61,
+	ns_t_csync = 62,
+	ns_t_spf = 99,
+	ns_t_uinfo = 100,
+	ns_t_uid = 101,
+	ns_t_gid = 102,
+	ns_t_unspec = 103,
+	ns_t_nid = 104,
+	ns_t_l32 = 105,
+	ns_t_l64 = 106,
+	ns_t_lp = 107,
+	ns_t_eui48 = 108,
+	ns_t_eui64 = 109,
+	ns_t_tkey = 249,
+	ns_t_tsig = 250,
+	ns_t_ixfr = 251,
+	ns_t_axfr = 252,
+	ns_t_mailb = 253,
+	ns_t_maila = 254,
+	ns_t_any = 255,
+	ns_t_zxfr = 256,
+	ns_t_uri = 256,
+	ns_t_caa = 257,
+	ns_t_avc = 258,
+	ns_t_ta = 32768,
+	ns_t_dlv = 32769,
+	ns_t_max = 65536
+} ns_type;
+
+#define	ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
+		      (t) == ns_t_mailb || (t) == ns_t_maila)
+#define	ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
+#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
+#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
+#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
+		       (t) == ns_t_zxfr)
+
+typedef enum __ns_class {
+	ns_c_invalid = 0,
+	ns_c_in = 1,
+	ns_c_2 = 2,
+	ns_c_chaos = 3,
+	ns_c_hs = 4,
+	ns_c_none = 254,
+	ns_c_any = 255,
+	ns_c_max = 65536
+} ns_class;
+
+typedef enum __ns_key_types {
+	ns_kt_rsa = 1,
+	ns_kt_dh  = 2,
+	ns_kt_dsa = 3,
+	ns_kt_private = 254
+} ns_key_types;
+
+typedef enum __ns_cert_types {
+	cert_t_pkix = 1,
+	cert_t_spki = 2,
+	cert_t_pgp  = 3,
+	cert_t_url  = 253,
+	cert_t_oid  = 254
+} ns_cert_types;
+
+#define	NS_KEY_TYPEMASK		0xC000
+#define	NS_KEY_TYPE_AUTH_CONF	0x0000
+#define	NS_KEY_TYPE_CONF_ONLY	0x8000
+#define	NS_KEY_TYPE_AUTH_ONLY	0x4000
+#define	NS_KEY_TYPE_NO_KEY	0xC000
+#define	NS_KEY_NO_AUTH		0x8000
+#define	NS_KEY_NO_CONF		0x4000
+#define	NS_KEY_RESERVED2	0x2000
+#define	NS_KEY_EXTENDED_FLAGS	0x1000
+#define	NS_KEY_RESERVED4	0x0800
+#define	NS_KEY_RESERVED5	0x0400
+#define	NS_KEY_NAME_TYPE	0x0300
+#define	NS_KEY_NAME_USER	0x0000
+#define	NS_KEY_NAME_ENTITY	0x0200
+#define	NS_KEY_NAME_ZONE	0x0100
+#define	NS_KEY_NAME_RESERVED	0x0300
+#define	NS_KEY_RESERVED8	0x0080
+#define	NS_KEY_RESERVED9	0x0040
+#define	NS_KEY_RESERVED10	0x0020
+#define	NS_KEY_RESERVED11	0x0010
+#define	NS_KEY_SIGNATORYMASK	0x000F
+#define	NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
+				  NS_KEY_RESERVED4 | \
+				  NS_KEY_RESERVED5 | \
+				  NS_KEY_RESERVED8 | \
+				  NS_KEY_RESERVED9 | \
+				  NS_KEY_RESERVED10 | \
+				  NS_KEY_RESERVED11 )
+#define NS_KEY_RESERVED_BITMASK2 0xFFFF
+#define	NS_ALG_MD5RSA		1
+#define	NS_ALG_DH               2
+#define	NS_ALG_DSA              3
+#define	NS_ALG_DSS              NS_ALG_DSA
+#define	NS_ALG_EXPIRE_ONLY	253
+#define	NS_ALG_PRIVATE_OID	254
+
+#define NS_KEY_PROT_TLS         1
+#define NS_KEY_PROT_EMAIL       2
+#define NS_KEY_PROT_DNSSEC      3
+#define NS_KEY_PROT_IPSEC       4
+#define NS_KEY_PROT_ANY		255
+
+#define	NS_MD5RSA_MIN_BITS	 512
+#define	NS_MD5RSA_MAX_BITS	4096
+#define	NS_MD5RSA_MAX_BYTES	((NS_MD5RSA_MAX_BITS+7/8)*2+3)
+#define	NS_MD5RSA_MAX_BASE64	(((NS_MD5RSA_MAX_BYTES+2)/3)*4)
+#define NS_MD5RSA_MIN_SIZE	((NS_MD5RSA_MIN_BITS+7)/8)
+#define NS_MD5RSA_MAX_SIZE	((NS_MD5RSA_MAX_BITS+7)/8)
+
+#define NS_DSA_SIG_SIZE         41
+#define NS_DSA_MIN_SIZE         213
+#define NS_DSA_MAX_BYTES        405
+
+#define	NS_SIG_TYPE	0
+#define	NS_SIG_ALG	2
+#define	NS_SIG_LABELS	3
+#define	NS_SIG_OTTL	4
+#define	NS_SIG_EXPIR	8
+#define	NS_SIG_SIGNED	12
+#define	NS_SIG_FOOT	16
+#define	NS_SIG_SIGNER	18
+#define	NS_NXT_BITS 8
+#define	NS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
+#define	NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_MAX 127
+
+#define NS_OPT_DNSSEC_OK        0x8000U
+#define NS_OPT_NSID		3
+
+#define NS_GET16(s, cp) (void)((s) = ns_get16(((cp)+=2)-2))
+#define NS_GET32(l, cp) (void)((l) = ns_get32(((cp)+=4)-4))
+#define NS_PUT16(s, cp) ns_put16((s), ((cp)+=2)-2)
+#define NS_PUT32(l, cp) ns_put32((l), ((cp)+=4)-4)
+
+unsigned ns_get16(const unsigned char *);
+unsigned long ns_get32(const unsigned char *);
+void ns_put16(unsigned, unsigned char *);
+void ns_put32(unsigned long, unsigned char *);
+
+int ns_initparse(const unsigned char *, int, ns_msg *);
+int ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
+int ns_skiprr(const unsigned char *, const unsigned char *, ns_sect, int);
+int ns_name_uncompress(const unsigned char *, const unsigned char *, const unsigned char *, char *, size_t);
+
+
+#define	__BIND		19950621
+
+typedef struct {
+	unsigned	id :16;
+#if __BYTE_ORDER == __BIG_ENDIAN
+	unsigned	qr: 1;
+	unsigned	opcode: 4;
+	unsigned	aa: 1;
+	unsigned	tc: 1;
+	unsigned	rd: 1;
+	unsigned	ra: 1;
+	unsigned	unused :1;
+	unsigned	ad: 1;
+	unsigned	cd: 1;
+	unsigned	rcode :4;
+#else
+	unsigned	rd :1;
+	unsigned	tc :1;
+	unsigned	aa :1;
+	unsigned	opcode :4;
+	unsigned	qr :1;
+	unsigned	rcode :4;
+	unsigned	cd: 1;
+	unsigned	ad: 1;
+	unsigned	unused :1;
+	unsigned	ra :1;
+#endif
+	unsigned	qdcount :16;
+	unsigned	ancount :16;
+	unsigned	nscount :16;
+	unsigned	arcount :16;
+} HEADER;
+
+#define PACKETSZ	NS_PACKETSZ
+#define MAXDNAME	NS_MAXDNAME
+#define MAXCDNAME	NS_MAXCDNAME
+#define MAXLABEL	NS_MAXLABEL
+#define	HFIXEDSZ	NS_HFIXEDSZ
+#define QFIXEDSZ	NS_QFIXEDSZ
+#define RRFIXEDSZ	NS_RRFIXEDSZ
+#define	INT32SZ		NS_INT32SZ
+#define	INT16SZ		NS_INT16SZ
+#define INT8SZ		NS_INT8SZ
+#define	INADDRSZ	NS_INADDRSZ
+#define	IN6ADDRSZ	NS_IN6ADDRSZ
+#define	INDIR_MASK	NS_CMPRSFLGS
+#define NAMESERVER_PORT	NS_DEFAULTPORT
+
+#define S_ZONE		ns_s_zn
+#define S_PREREQ	ns_s_pr
+#define S_UPDATE	ns_s_ud
+#define S_ADDT		ns_s_ar
+
+#define QUERY		ns_o_query
+#define IQUERY		ns_o_iquery
+#define STATUS		ns_o_status
+#define	NS_NOTIFY_OP	ns_o_notify
+#define	NS_UPDATE_OP	ns_o_update
+
+#define NOERROR		ns_r_noerror
+#define FORMERR		ns_r_formerr
+#define SERVFAIL	ns_r_servfail
+#define NXDOMAIN	ns_r_nxdomain
+#define NOTIMP		ns_r_notimpl
+#define REFUSED		ns_r_refused
+#define YXDOMAIN	ns_r_yxdomain
+#define YXRRSET		ns_r_yxrrset
+#define NXRRSET		ns_r_nxrrset
+#define NOTAUTH		ns_r_notauth
+#define NOTZONE		ns_r_notzone
+
+#define DELETE		ns_uop_delete
+#define ADD		ns_uop_add
+
+#define T_A		ns_t_a
+#define T_NS		ns_t_ns
+#define T_MD		ns_t_md
+#define T_MF		ns_t_mf
+#define T_CNAME		ns_t_cname
+#define T_SOA		ns_t_soa
+#define T_MB		ns_t_mb
+#define T_MG		ns_t_mg
+#define T_MR		ns_t_mr
+#define T_NULL		ns_t_null
+#define T_WKS		ns_t_wks
+#define T_PTR		ns_t_ptr
+#define T_HINFO		ns_t_hinfo
+#define T_MINFO		ns_t_minfo
+#define T_MX		ns_t_mx
+#define T_TXT		ns_t_txt
+#define	T_RP		ns_t_rp
+#define T_AFSDB		ns_t_afsdb
+#define T_X25		ns_t_x25
+#define T_ISDN		ns_t_isdn
+#define T_RT		ns_t_rt
+#define T_NSAP		ns_t_nsap
+#define T_NSAP_PTR	ns_t_nsap_ptr
+#define	T_SIG		ns_t_sig
+#define	T_KEY		ns_t_key
+#define	T_PX		ns_t_px
+#define	T_GPOS		ns_t_gpos
+#define	T_AAAA		ns_t_aaaa
+#define	T_LOC		ns_t_loc
+#define	T_NXT		ns_t_nxt
+#define	T_EID		ns_t_eid
+#define	T_NIMLOC	ns_t_nimloc
+#define	T_SRV		ns_t_srv
+#define T_ATMA		ns_t_atma
+#define T_NAPTR		ns_t_naptr
+#define T_A6		ns_t_a6
+#define T_DNAME		ns_t_dname
+#define T_DS		ns_t_ds
+#define T_SSHFP		ns_t_sshfp
+#define T_IPSECKEY	ns_t_ipseckey
+#define T_RRSIG		ns_t_rrsig
+#define T_NSEC		ns_t_nsec
+#define T_DNSKEY	ns_t_dnskey
+#define T_DHCID		ns_t_dhcid
+#define T_NSEC3		ns_t_nsec3
+#define T_NSEC3PARAM	ns_t_nsec3param
+#define T_TLSA		ns_t_tlsa
+#define T_SMIMEA	ns_t_smimea
+#define T_HIP		ns_t_hip
+#define T_NINFO		ns_t_ninfo
+#define T_RKEY		ns_t_rkey
+#define T_TALINK	ns_t_talink
+#define T_CDS		ns_t_cds
+#define T_CDNSKEY	ns_t_cdnskey
+#define T_OPENPGPKEY	ns_t_openpgpkey
+#define T_CSYNC		ns_t_csync
+#define T_SPF		ns_t_spf
+#define T_UINFO		ns_t_uinfo
+#define T_UID		ns_t_uid
+#define T_GID		ns_t_gid
+#define T_UNSPEC	ns_t_unspec
+#define T_NID		ns_t_nid
+#define T_L32		ns_t_l32
+#define T_L64		ns_t_l64
+#define T_LP		ns_t_lp
+#define T_EUI48		ns_t_eui48
+#define T_EUI64		ns_t_eui64
+#define T_TKEY		ns_t_tkey
+#define	T_TSIG		ns_t_tsig
+#define	T_IXFR		ns_t_ixfr
+#define T_AXFR		ns_t_axfr
+#define T_MAILB		ns_t_mailb
+#define T_MAILA		ns_t_maila
+#define T_ANY		ns_t_any
+#define T_URI		ns_t_uri
+#define T_CAA		ns_t_caa
+#define T_AVC		ns_t_avc
+#define T_TA		ns_t_ta
+#define T_DLV		ns_t_dlv
+
+#define C_IN		ns_c_in
+#define C_CHAOS		ns_c_chaos
+#define C_HS		ns_c_hs
+#define C_NONE		ns_c_none
+#define C_ANY		ns_c_any
+
+#define	GETSHORT		NS_GET16
+#define	GETLONG			NS_GET32
+#define	PUTSHORT		NS_PUT16
+#define	PUTLONG			NS_PUT32
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/arpa/nameser_compat.h b/musl-include/x86_64/arpa/nameser_compat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/arpa/nameser_compat.h
@@ -0,0 +1,2 @@
+#include <arpa/nameser.h>
+
diff --git a/musl-include/x86_64/arpa/telnet.h b/musl-include/x86_64/arpa/telnet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/arpa/telnet.h
@@ -0,0 +1,251 @@
+#ifndef _ARPA_TELNET_H
+#define	_ARPA_TELNET_H
+
+#define	IAC	255
+#define	DONT	254
+#define	DO	253
+#define	WONT	252
+#define	WILL	251
+#define	SB	250
+#define	GA	249
+#define	EL	248
+#define	EC	247
+#define	AYT	246
+#define	AO	245
+#define	IP	244
+#define	BREAK	243
+#define	DM	242
+#define	NOP	241
+#define	SE	240
+#define EOR     239
+#define	ABORT	238
+#define	SUSP	237
+#define	xEOF	236
+
+#define SYNCH	242
+
+#define telcmds ((char [][6]){ "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0 })
+
+#define	TELCMD_FIRST	xEOF
+#define	TELCMD_LAST	IAC
+#define	TELCMD_OK(x)	((unsigned int)(x) <= TELCMD_LAST && \
+			 (unsigned int)(x) >= TELCMD_FIRST)
+#define	TELCMD(x)	telcmds[(x)-TELCMD_FIRST]
+
+#define TELOPT_BINARY	0
+#define TELOPT_ECHO	1
+#define	TELOPT_RCP	2
+#define	TELOPT_SGA	3
+#define	TELOPT_NAMS	4
+#define	TELOPT_STATUS	5
+#define	TELOPT_TM	6
+#define	TELOPT_RCTE	7
+#define TELOPT_NAOL 	8
+#define TELOPT_NAOP 	9
+#define TELOPT_NAOCRD	10
+#define TELOPT_NAOHTS	11
+#define TELOPT_NAOHTD	12
+#define TELOPT_NAOFFD	13
+#define TELOPT_NAOVTS	14
+#define TELOPT_NAOVTD	15
+#define TELOPT_NAOLFD	16
+#define TELOPT_XASCII	17
+#define	TELOPT_LOGOUT	18
+#define	TELOPT_BM	19
+#define	TELOPT_DET	20
+#define	TELOPT_SUPDUP	21
+#define	TELOPT_SUPDUPOUTPUT 22
+#define	TELOPT_SNDLOC	23
+#define	TELOPT_TTYPE	24
+#define	TELOPT_EOR	25
+#define	TELOPT_TUID	26
+#define	TELOPT_OUTMRK	27
+#define	TELOPT_TTYLOC	28
+#define	TELOPT_3270REGIME 29
+#define	TELOPT_X3PAD	30
+#define	TELOPT_NAWS	31
+#define	TELOPT_TSPEED	32
+#define	TELOPT_LFLOW	33
+#define TELOPT_LINEMODE	34
+#define TELOPT_XDISPLOC	35
+#define TELOPT_OLD_ENVIRON 36
+#define	TELOPT_AUTHENTICATION 37/* Authenticate */
+#define	TELOPT_ENCRYPT	38
+#define TELOPT_NEW_ENVIRON 39
+#define	TELOPT_EXOPL	255
+
+
+#define	NTELOPTS	(1+TELOPT_NEW_ENVIRON)
+#ifdef TELOPTS
+char *telopts[NTELOPTS+1] = {
+	"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
+	"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
+	"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
+	"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
+	"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
+	"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
+	"TACACS UID", "OUTPUT MARKING", "TTYLOC",
+	"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
+	"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
+	"ENCRYPT", "NEW-ENVIRON",
+	0,
+};
+#define	TELOPT_FIRST	TELOPT_BINARY
+#define	TELOPT_LAST	TELOPT_NEW_ENVIRON
+#define	TELOPT_OK(x)	((unsigned int)(x) <= TELOPT_LAST)
+#define	TELOPT(x)	telopts[(x)-TELOPT_FIRST]
+#endif
+
+#define	TELQUAL_IS	0
+#define	TELQUAL_SEND	1
+#define	TELQUAL_INFO	2
+#define	TELQUAL_REPLY	2
+#define	TELQUAL_NAME	3
+
+#define	LFLOW_OFF		0
+#define	LFLOW_ON		1
+#define	LFLOW_RESTART_ANY	2
+#define	LFLOW_RESTART_XON	3
+
+
+#define	LM_MODE		1
+#define	LM_FORWARDMASK	2
+#define	LM_SLC		3
+
+#define	MODE_EDIT	0x01
+#define	MODE_TRAPSIG	0x02
+#define	MODE_ACK	0x04
+#define MODE_SOFT_TAB	0x08
+#define MODE_LIT_ECHO	0x10
+
+#define	MODE_MASK	0x1f
+
+#define MODE_FLOW		0x0100
+#define MODE_ECHO		0x0200
+#define MODE_INBIN		0x0400
+#define MODE_OUTBIN		0x0800
+#define MODE_FORCE		0x1000
+
+#define	SLC_SYNCH	1
+#define	SLC_BRK		2
+#define	SLC_IP		3
+#define	SLC_AO		4
+#define	SLC_AYT		5
+#define	SLC_EOR		6
+#define	SLC_ABORT	7
+#define	SLC_EOF		8
+#define	SLC_SUSP	9
+#define	SLC_EC		10
+#define	SLC_EL		11
+#define	SLC_EW		12
+#define	SLC_RP		13
+#define	SLC_LNEXT	14
+#define	SLC_XON		15
+#define	SLC_XOFF	16
+#define	SLC_FORW1	17
+#define	SLC_FORW2	18
+
+#define	NSLC		18
+
+#define	SLC_NAMELIST	"0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
+			"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
+			"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
+#ifdef	SLC_NAMES
+char *slc_names[] = {
+	SLC_NAMELIST
+};
+#else
+extern char *slc_names[];
+#define	SLC_NAMES SLC_NAMELIST
+#endif
+
+#define	SLC_NAME_OK(x)	((unsigned int)(x) <= NSLC)
+#define SLC_NAME(x)	slc_names[x]
+
+#define	SLC_NOSUPPORT	0
+#define	SLC_CANTCHANGE	1
+#define	SLC_VARIABLE	2
+#define	SLC_DEFAULT	3
+#define	SLC_LEVELBITS	0x03
+
+#define	SLC_FUNC	0
+#define	SLC_FLAGS	1
+#define	SLC_VALUE	2
+
+#define	SLC_ACK		0x80
+#define	SLC_FLUSHIN	0x40
+#define	SLC_FLUSHOUT	0x20
+
+#define	OLD_ENV_VAR	1
+#define	OLD_ENV_VALUE	0
+#define	NEW_ENV_VAR	0
+#define	NEW_ENV_VALUE	1
+#define	ENV_ESC		2
+#define ENV_USERVAR	3
+
+#define	AUTH_WHO_CLIENT		0
+#define	AUTH_WHO_SERVER		1
+#define	AUTH_WHO_MASK		1
+
+#define	AUTH_HOW_ONE_WAY	0
+#define	AUTH_HOW_MUTUAL		2
+#define	AUTH_HOW_MASK		2
+
+#define	AUTHTYPE_NULL		0
+#define	AUTHTYPE_KERBEROS_V4	1
+#define	AUTHTYPE_KERBEROS_V5	2
+#define	AUTHTYPE_SPX		3
+#define	AUTHTYPE_MINK		4
+#define	AUTHTYPE_CNT		5
+
+#define	AUTHTYPE_TEST		99
+
+#ifdef	AUTH_NAMES
+char *authtype_names[] = {
+	"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
+};
+#else
+extern char *authtype_names[];
+#endif
+
+#define	AUTHTYPE_NAME_OK(x)	((unsigned int)(x) < AUTHTYPE_CNT)
+#define	AUTHTYPE_NAME(x)	authtype_names[x]
+
+#define	ENCRYPT_IS		0
+#define	ENCRYPT_SUPPORT		1
+#define	ENCRYPT_REPLY		2
+#define	ENCRYPT_START		3
+#define	ENCRYPT_END		4
+#define	ENCRYPT_REQSTART	5
+#define	ENCRYPT_REQEND		6
+#define	ENCRYPT_ENC_KEYID	7
+#define	ENCRYPT_DEC_KEYID	8
+#define	ENCRYPT_CNT		9
+
+#define	ENCTYPE_ANY		0
+#define	ENCTYPE_DES_CFB64	1
+#define	ENCTYPE_DES_OFB64	2
+#define	ENCTYPE_CNT		3
+
+#ifdef	ENCRYPT_NAMES
+char *encrypt_names[] = {
+	"IS", "SUPPORT", "REPLY", "START", "END",
+	"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
+	0,
+};
+char *enctype_names[] = {
+	"ANY", "DES_CFB64",  "DES_OFB64",  0,
+};
+#else
+extern char *encrypt_names[];
+extern char *enctype_names[];
+#endif
+
+
+#define	ENCRYPT_NAME_OK(x)	((unsigned int)(x) < ENCRYPT_CNT)
+#define	ENCRYPT_NAME(x)		encrypt_names[x]
+
+#define	ENCTYPE_NAME_OK(x)	((unsigned int)(x) < ENCTYPE_CNT)
+#define	ENCTYPE_NAME(x)		enctype_names[x]
+
+#endif
diff --git a/musl-include/x86_64/arpa/tftp.h b/musl-include/x86_64/arpa/tftp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/arpa/tftp.h
@@ -0,0 +1,31 @@
+#ifndef _ARPA_TFTP_H
+#define _ARPA_TFTP_H
+#define SEGSIZE 512
+#define RRQ 01
+#define WRQ 02
+#define DATA 03
+#define ACK 04
+#define ERROR 05
+struct tftphdr {
+	short th_opcode;
+	union {
+		unsigned short tu_block;
+		short tu_code;
+		char tu_stuff[1];
+	} th_u;
+	char th_data[1];
+};
+#define th_block th_u.tu_block
+#define th_code th_u.tu_code
+#define th_stuff th_u.tu_stuff
+#define th_msg th_data
+#define EUNDEF 0
+#define ENOTFOUND 1
+#define EACCESS 2
+#define ENOSPACE 3
+#define EBADOP 4
+#define EBADID 5
+#define EEXISTS 6
+#define ENOUSER 7
+#endif
+
diff --git a/musl-include/x86_64/assert.h b/musl-include/x86_64/assert.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/assert.h
@@ -0,0 +1,23 @@
+#include <features.h>
+
+#undef assert
+
+#ifdef NDEBUG
+#define	assert(x) (void)0
+#else
+#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))
+#endif
+
+#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
+#define static_assert _Static_assert
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_Noreturn void __assert_fail (const char *, const char *, int, const char *);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/musl-include/x86_64/bits/alltypes.h b/musl-include/x86_64/bits/alltypes.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/alltypes.h
@@ -0,0 +1,415 @@
+#define _Addr long
+#define _Int64 long
+#define _Reg long
+
+#define __BYTE_ORDER 1234
+#define __LONG_MAX 0x7fffffffffffffffL
+
+#ifndef __cplusplus
+#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
+typedef int wchar_t;
+#define __DEFINED_wchar_t
+#endif
+
+#endif
+
+#if defined(__FLT_EVAL_METHOD__) && __FLT_EVAL_METHOD__ == 2
+#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
+typedef long double float_t;
+#define __DEFINED_float_t
+#endif
+
+#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
+typedef long double double_t;
+#define __DEFINED_double_t
+#endif
+
+#else
+#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)
+typedef float float_t;
+#define __DEFINED_float_t
+#endif
+
+#if defined(__NEED_double_t) && !defined(__DEFINED_double_t)
+typedef double double_t;
+#define __DEFINED_double_t
+#endif
+
+#endif
+
+#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t)
+typedef struct { long long __ll; long double __ld; } max_align_t;
+#define __DEFINED_max_align_t
+#endif
+
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+#define __USE_TIME_BITS64 1
+
+#if defined(__NEED_size_t) && !defined(__DEFINED_size_t)
+typedef unsigned _Addr size_t;
+#define __DEFINED_size_t
+#endif
+
+#if defined(__NEED_uintptr_t) && !defined(__DEFINED_uintptr_t)
+typedef unsigned _Addr uintptr_t;
+#define __DEFINED_uintptr_t
+#endif
+
+#if defined(__NEED_ptrdiff_t) && !defined(__DEFINED_ptrdiff_t)
+typedef _Addr ptrdiff_t;
+#define __DEFINED_ptrdiff_t
+#endif
+
+#if defined(__NEED_ssize_t) && !defined(__DEFINED_ssize_t)
+typedef _Addr ssize_t;
+#define __DEFINED_ssize_t
+#endif
+
+#if defined(__NEED_intptr_t) && !defined(__DEFINED_intptr_t)
+typedef _Addr intptr_t;
+#define __DEFINED_intptr_t
+#endif
+
+#if defined(__NEED_regoff_t) && !defined(__DEFINED_regoff_t)
+typedef _Addr regoff_t;
+#define __DEFINED_regoff_t
+#endif
+
+#if defined(__NEED_register_t) && !defined(__DEFINED_register_t)
+typedef _Reg register_t;
+#define __DEFINED_register_t
+#endif
+
+#if defined(__NEED_time_t) && !defined(__DEFINED_time_t)
+typedef _Int64 time_t;
+#define __DEFINED_time_t
+#endif
+
+#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t)
+typedef _Int64 suseconds_t;
+#define __DEFINED_suseconds_t
+#endif
+
+
+#if defined(__NEED_int8_t) && !defined(__DEFINED_int8_t)
+typedef signed char     int8_t;
+#define __DEFINED_int8_t
+#endif
+
+#if defined(__NEED_int16_t) && !defined(__DEFINED_int16_t)
+typedef signed short    int16_t;
+#define __DEFINED_int16_t
+#endif
+
+#if defined(__NEED_int32_t) && !defined(__DEFINED_int32_t)
+typedef signed int      int32_t;
+#define __DEFINED_int32_t
+#endif
+
+#if defined(__NEED_int64_t) && !defined(__DEFINED_int64_t)
+typedef signed _Int64   int64_t;
+#define __DEFINED_int64_t
+#endif
+
+#if defined(__NEED_intmax_t) && !defined(__DEFINED_intmax_t)
+typedef signed _Int64   intmax_t;
+#define __DEFINED_intmax_t
+#endif
+
+#if defined(__NEED_uint8_t) && !defined(__DEFINED_uint8_t)
+typedef unsigned char   uint8_t;
+#define __DEFINED_uint8_t
+#endif
+
+#if defined(__NEED_uint16_t) && !defined(__DEFINED_uint16_t)
+typedef unsigned short  uint16_t;
+#define __DEFINED_uint16_t
+#endif
+
+#if defined(__NEED_uint32_t) && !defined(__DEFINED_uint32_t)
+typedef unsigned int    uint32_t;
+#define __DEFINED_uint32_t
+#endif
+
+#if defined(__NEED_uint64_t) && !defined(__DEFINED_uint64_t)
+typedef unsigned _Int64 uint64_t;
+#define __DEFINED_uint64_t
+#endif
+
+#if defined(__NEED_u_int64_t) && !defined(__DEFINED_u_int64_t)
+typedef unsigned _Int64 u_int64_t;
+#define __DEFINED_u_int64_t
+#endif
+
+#if defined(__NEED_uintmax_t) && !defined(__DEFINED_uintmax_t)
+typedef unsigned _Int64 uintmax_t;
+#define __DEFINED_uintmax_t
+#endif
+
+
+#if defined(__NEED_mode_t) && !defined(__DEFINED_mode_t)
+typedef unsigned mode_t;
+#define __DEFINED_mode_t
+#endif
+
+#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t)
+typedef unsigned _Reg nlink_t;
+#define __DEFINED_nlink_t
+#endif
+
+#if defined(__NEED_off_t) && !defined(__DEFINED_off_t)
+typedef _Int64 off_t;
+#define __DEFINED_off_t
+#endif
+
+#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t)
+typedef unsigned _Int64 ino_t;
+#define __DEFINED_ino_t
+#endif
+
+#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t)
+typedef unsigned _Int64 dev_t;
+#define __DEFINED_dev_t
+#endif
+
+#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t)
+typedef long blksize_t;
+#define __DEFINED_blksize_t
+#endif
+
+#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t)
+typedef _Int64 blkcnt_t;
+#define __DEFINED_blkcnt_t
+#endif
+
+#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t)
+typedef unsigned _Int64 fsblkcnt_t;
+#define __DEFINED_fsblkcnt_t
+#endif
+
+#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t)
+typedef unsigned _Int64 fsfilcnt_t;
+#define __DEFINED_fsfilcnt_t
+#endif
+
+
+#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t)
+typedef unsigned wint_t;
+#define __DEFINED_wint_t
+#endif
+
+#if defined(__NEED_wctype_t) && !defined(__DEFINED_wctype_t)
+typedef unsigned long wctype_t;
+#define __DEFINED_wctype_t
+#endif
+
+
+#if defined(__NEED_timer_t) && !defined(__DEFINED_timer_t)
+typedef void * timer_t;
+#define __DEFINED_timer_t
+#endif
+
+#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t)
+typedef int clockid_t;
+#define __DEFINED_clockid_t
+#endif
+
+#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t)
+typedef long clock_t;
+#define __DEFINED_clock_t
+#endif
+
+#if defined(__NEED_struct_timeval) && !defined(__DEFINED_struct_timeval)
+struct timeval { time_t tv_sec; suseconds_t tv_usec; };
+#define __DEFINED_struct_timeval
+#endif
+
+#if defined(__NEED_struct_timespec) && !defined(__DEFINED_struct_timespec)
+struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
+#define __DEFINED_struct_timespec
+#endif
+
+
+#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t)
+typedef int pid_t;
+#define __DEFINED_pid_t
+#endif
+
+#if defined(__NEED_id_t) && !defined(__DEFINED_id_t)
+typedef unsigned id_t;
+#define __DEFINED_id_t
+#endif
+
+#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t)
+typedef unsigned uid_t;
+#define __DEFINED_uid_t
+#endif
+
+#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t)
+typedef unsigned gid_t;
+#define __DEFINED_gid_t
+#endif
+
+#if defined(__NEED_key_t) && !defined(__DEFINED_key_t)
+typedef int key_t;
+#define __DEFINED_key_t
+#endif
+
+#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t)
+typedef unsigned useconds_t;
+#define __DEFINED_useconds_t
+#endif
+
+
+#ifdef __cplusplus
+#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
+typedef unsigned long pthread_t;
+#define __DEFINED_pthread_t
+#endif
+
+#else
+#if defined(__NEED_pthread_t) && !defined(__DEFINED_pthread_t)
+typedef struct __pthread * pthread_t;
+#define __DEFINED_pthread_t
+#endif
+
+#endif
+#if defined(__NEED_pthread_once_t) && !defined(__DEFINED_pthread_once_t)
+typedef int pthread_once_t;
+#define __DEFINED_pthread_once_t
+#endif
+
+#if defined(__NEED_pthread_key_t) && !defined(__DEFINED_pthread_key_t)
+typedef unsigned pthread_key_t;
+#define __DEFINED_pthread_key_t
+#endif
+
+#if defined(__NEED_pthread_spinlock_t) && !defined(__DEFINED_pthread_spinlock_t)
+typedef int pthread_spinlock_t;
+#define __DEFINED_pthread_spinlock_t
+#endif
+
+#if defined(__NEED_pthread_mutexattr_t) && !defined(__DEFINED_pthread_mutexattr_t)
+typedef struct { unsigned __attr; } pthread_mutexattr_t;
+#define __DEFINED_pthread_mutexattr_t
+#endif
+
+#if defined(__NEED_pthread_condattr_t) && !defined(__DEFINED_pthread_condattr_t)
+typedef struct { unsigned __attr; } pthread_condattr_t;
+#define __DEFINED_pthread_condattr_t
+#endif
+
+#if defined(__NEED_pthread_barrierattr_t) && !defined(__DEFINED_pthread_barrierattr_t)
+typedef struct { unsigned __attr; } pthread_barrierattr_t;
+#define __DEFINED_pthread_barrierattr_t
+#endif
+
+#if defined(__NEED_pthread_rwlockattr_t) && !defined(__DEFINED_pthread_rwlockattr_t)
+typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t;
+#define __DEFINED_pthread_rwlockattr_t
+#endif
+
+
+#if defined(__NEED_struct__IO_FILE) && !defined(__DEFINED_struct__IO_FILE)
+struct _IO_FILE { char __x; };
+#define __DEFINED_struct__IO_FILE
+#endif
+
+#if defined(__NEED_FILE) && !defined(__DEFINED_FILE)
+typedef struct _IO_FILE FILE;
+#define __DEFINED_FILE
+#endif
+
+
+#if defined(__NEED_va_list) && !defined(__DEFINED_va_list)
+typedef __builtin_va_list va_list;
+#define __DEFINED_va_list
+#endif
+
+#if defined(__NEED___isoc_va_list) && !defined(__DEFINED___isoc_va_list)
+typedef __builtin_va_list __isoc_va_list;
+#define __DEFINED___isoc_va_list
+#endif
+
+
+#if defined(__NEED_mbstate_t) && !defined(__DEFINED_mbstate_t)
+typedef struct __mbstate_t { unsigned __opaque1, __opaque2; } mbstate_t;
+#define __DEFINED_mbstate_t
+#endif
+
+
+#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
+typedef struct __locale_struct * locale_t;
+#define __DEFINED_locale_t
+#endif
+
+
+#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
+typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
+#define __DEFINED_sigset_t
+#endif
+
+
+#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec)
+struct iovec { void *iov_base; size_t iov_len; };
+#define __DEFINED_struct_iovec
+#endif
+
+
+#if defined(__NEED_struct_winsize) && !defined(__DEFINED_struct_winsize)
+struct winsize { unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel; };
+#define __DEFINED_struct_winsize
+#endif
+
+
+#if defined(__NEED_socklen_t) && !defined(__DEFINED_socklen_t)
+typedef unsigned socklen_t;
+#define __DEFINED_socklen_t
+#endif
+
+#if defined(__NEED_sa_family_t) && !defined(__DEFINED_sa_family_t)
+typedef unsigned short sa_family_t;
+#define __DEFINED_sa_family_t
+#endif
+
+
+#if defined(__NEED_pthread_attr_t) && !defined(__DEFINED_pthread_attr_t)
+typedef struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t;
+#define __DEFINED_pthread_attr_t
+#endif
+
+#if defined(__NEED_pthread_mutex_t) && !defined(__DEFINED_pthread_mutex_t)
+typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t;
+#define __DEFINED_pthread_mutex_t
+#endif
+
+#if defined(__NEED_mtx_t) && !defined(__DEFINED_mtx_t)
+typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } mtx_t;
+#define __DEFINED_mtx_t
+#endif
+
+#if defined(__NEED_pthread_cond_t) && !defined(__DEFINED_pthread_cond_t)
+typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t;
+#define __DEFINED_pthread_cond_t
+#endif
+
+#if defined(__NEED_cnd_t) && !defined(__DEFINED_cnd_t)
+typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } cnd_t;
+#define __DEFINED_cnd_t
+#endif
+
+#if defined(__NEED_pthread_rwlock_t) && !defined(__DEFINED_pthread_rwlock_t)
+typedef struct { union { int __i[sizeof(long)==8?14:8]; volatile int __vi[sizeof(long)==8?14:8]; void *__p[sizeof(long)==8?7:8]; } __u; } pthread_rwlock_t;
+#define __DEFINED_pthread_rwlock_t
+#endif
+
+#if defined(__NEED_pthread_barrier_t) && !defined(__DEFINED_pthread_barrier_t)
+typedef struct { union { int __i[sizeof(long)==8?8:5]; volatile int __vi[sizeof(long)==8?8:5]; void *__p[sizeof(long)==8?4:5]; } __u; } pthread_barrier_t;
+#define __DEFINED_pthread_barrier_t
+#endif
+
+
+#undef _Addr
+#undef _Int64
+#undef _Reg
diff --git a/musl-include/x86_64/bits/dirent.h b/musl-include/x86_64/bits/dirent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/dirent.h
@@ -0,0 +1,11 @@
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
+
+struct dirent {
+	ino_t d_ino;
+	off_t d_off;
+	unsigned short d_reclen;
+	unsigned char d_type;
+	char d_name[256];
+};
diff --git a/musl-include/x86_64/bits/errno.h b/musl-include/x86_64/bits/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/errno.h
@@ -0,0 +1,134 @@
+#define EPERM            1
+#define ENOENT           2
+#define ESRCH            3
+#define EINTR            4
+#define EIO              5
+#define ENXIO            6
+#define E2BIG            7
+#define ENOEXEC          8
+#define EBADF            9
+#define ECHILD          10
+#define EAGAIN          11
+#define ENOMEM          12
+#define EACCES          13
+#define EFAULT          14
+#define ENOTBLK         15
+#define EBUSY           16
+#define EEXIST          17
+#define EXDEV           18
+#define ENODEV          19
+#define ENOTDIR         20
+#define EISDIR          21
+#define EINVAL          22
+#define ENFILE          23
+#define EMFILE          24
+#define ENOTTY          25
+#define ETXTBSY         26
+#define EFBIG           27
+#define ENOSPC          28
+#define ESPIPE          29
+#define EROFS           30
+#define EMLINK          31
+#define EPIPE           32
+#define EDOM            33
+#define ERANGE          34
+#define EDEADLK         35
+#define ENAMETOOLONG    36
+#define ENOLCK          37
+#define ENOSYS          38
+#define ENOTEMPTY       39
+#define ELOOP           40
+#define EWOULDBLOCK     EAGAIN
+#define ENOMSG          42
+#define EIDRM           43
+#define ECHRNG          44
+#define EL2NSYNC        45
+#define EL3HLT          46
+#define EL3RST          47
+#define ELNRNG          48
+#define EUNATCH         49
+#define ENOCSI          50
+#define EL2HLT          51
+#define EBADE           52
+#define EBADR           53
+#define EXFULL          54
+#define ENOANO          55
+#define EBADRQC         56
+#define EBADSLT         57
+#define EDEADLOCK       EDEADLK
+#define EBFONT          59
+#define ENOSTR          60
+#define ENODATA         61
+#define ETIME           62
+#define ENOSR           63
+#define ENONET          64
+#define ENOPKG          65
+#define EREMOTE         66
+#define ENOLINK         67
+#define EADV            68
+#define ESRMNT          69
+#define ECOMM           70
+#define EPROTO          71
+#define EMULTIHOP       72
+#define EDOTDOT         73
+#define EBADMSG         74
+#define EOVERFLOW       75
+#define ENOTUNIQ        76
+#define EBADFD          77
+#define EREMCHG         78
+#define ELIBACC         79
+#define ELIBBAD         80
+#define ELIBSCN         81
+#define ELIBMAX         82
+#define ELIBEXEC        83
+#define EILSEQ          84
+#define ERESTART        85
+#define ESTRPIPE        86
+#define EUSERS          87
+#define ENOTSOCK        88
+#define EDESTADDRREQ    89
+#define EMSGSIZE        90
+#define EPROTOTYPE      91
+#define ENOPROTOOPT     92
+#define EPROTONOSUPPORT 93
+#define ESOCKTNOSUPPORT 94
+#define EOPNOTSUPP      95
+#define ENOTSUP         EOPNOTSUPP
+#define EPFNOSUPPORT    96
+#define EAFNOSUPPORT    97
+#define EADDRINUSE      98
+#define EADDRNOTAVAIL   99
+#define ENETDOWN        100
+#define ENETUNREACH     101
+#define ENETRESET       102
+#define ECONNABORTED    103
+#define ECONNRESET      104
+#define ENOBUFS         105
+#define EISCONN         106
+#define ENOTCONN        107
+#define ESHUTDOWN       108
+#define ETOOMANYREFS    109
+#define ETIMEDOUT       110
+#define ECONNREFUSED    111
+#define EHOSTDOWN       112
+#define EHOSTUNREACH    113
+#define EALREADY        114
+#define EINPROGRESS     115
+#define ESTALE          116
+#define EUCLEAN         117
+#define ENOTNAM         118
+#define ENAVAIL         119
+#define EISNAM          120
+#define EREMOTEIO       121
+#define EDQUOT          122
+#define ENOMEDIUM       123
+#define EMEDIUMTYPE     124
+#define ECANCELED       125
+#define ENOKEY          126
+#define EKEYEXPIRED     127
+#define EKEYREVOKED     128
+#define EKEYREJECTED    129
+#define EOWNERDEAD      130
+#define ENOTRECOVERABLE 131
+#define ERFKILL         132
+#define EHWPOISON       133
diff --git a/musl-include/x86_64/bits/fcntl.h b/musl-include/x86_64/bits/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/fcntl.h
@@ -0,0 +1,46 @@
+#define O_CREAT        0100
+#define O_EXCL         0200
+#define O_NOCTTY       0400
+#define O_TRUNC       01000
+#define O_APPEND      02000
+#define O_NONBLOCK    04000
+#define O_DSYNC      010000
+#define O_SYNC     04010000
+#define O_RSYNC    04010000
+#define O_DIRECTORY 0200000
+#define O_NOFOLLOW  0400000
+#define O_CLOEXEC  02000000
+
+#define O_ASYNC      020000
+#define O_DIRECT     040000
+#define O_LARGEFILE 0100000
+#define O_NOATIME  01000000
+#define O_PATH    010000000
+#define O_TMPFILE 020200000
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD  0
+#define F_GETFD  1
+#define F_SETFD  2
+#define F_GETFL  3
+#define F_SETFL  4
+
+#define F_SETOWN 8
+#define F_GETOWN 9
+#define F_SETSIG 10
+#define F_GETSIG 11
+
+#if __LONG_MAX == 0x7fffffffL
+#define F_GETLK 12
+#define F_SETLK 13
+#define F_SETLKW 14
+#else
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+#endif
+
+#define F_SETOWN_EX 15
+#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
diff --git a/musl-include/x86_64/bits/fenv.h b/musl-include/x86_64/bits/fenv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/fenv.h
@@ -0,0 +1,34 @@
+#define FE_INVALID    1
+#define __FE_DENORM   2
+#define FE_DIVBYZERO  4
+#define FE_OVERFLOW   8
+#define FE_UNDERFLOW  16
+#define FE_INEXACT    32
+
+#define FE_ALL_EXCEPT 63
+
+#define FE_TONEAREST  0
+#define FE_DOWNWARD   0x400
+#define FE_UPWARD     0x800
+#define FE_TOWARDZERO 0xc00
+
+typedef unsigned short fexcept_t;
+
+typedef struct {
+	unsigned short __control_word;
+	unsigned short __unused1;
+	unsigned short __status_word;
+	unsigned short __unused2;
+	unsigned short __tags;
+	unsigned short __unused3;
+	unsigned int __eip;
+	unsigned short __cs_selector;
+	unsigned int __opcode:11;
+	unsigned int __unused4:5;
+	unsigned int __data_offset;
+	unsigned short __data_selector;
+	unsigned short __unused5;
+	unsigned int __mxcsr;
+} fenv_t;
+
+#define FE_DFL_ENV      ((const fenv_t *) -1)
diff --git a/musl-include/x86_64/bits/float.h b/musl-include/x86_64/bits/float.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/float.h
@@ -0,0 +1,20 @@
+#ifdef __FLT_EVAL_METHOD__
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#else
+#define FLT_EVAL_METHOD 0
+#endif
+
+#define LDBL_TRUE_MIN 3.6451995318824746025e-4951L
+#define LDBL_MIN     3.3621031431120935063e-4932L
+#define LDBL_MAX     1.1897314953572317650e+4932L
+#define LDBL_EPSILON 1.0842021724855044340e-19L
+
+#define LDBL_MANT_DIG 64
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MAX_EXP 16384
+
+#define LDBL_DIG 18
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_10_EXP 4932
+
+#define DECIMAL_DIG 21
diff --git a/musl-include/x86_64/bits/hwcap.h b/musl-include/x86_64/bits/hwcap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/hwcap.h
diff --git a/musl-include/x86_64/bits/io.h b/musl-include/x86_64/bits/io.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/io.h
@@ -0,0 +1,77 @@
+static __inline void outb(unsigned char __val, unsigned short __port)
+{
+	__asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outw(unsigned short __val, unsigned short __port)
+{
+	__asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline void outl(unsigned int __val, unsigned short __port)
+{
+	__asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
+}
+
+static __inline unsigned char inb(unsigned short __port)
+{
+	unsigned char __val;
+	__asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
+	return __val;
+}
+
+static __inline unsigned short inw(unsigned short __port)
+{
+	unsigned short __val;
+	__asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
+	return __val;
+}
+
+static __inline unsigned int inl(unsigned short __port)
+{
+	unsigned int __val;
+	__asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
+	return __val;
+}
+
+static __inline void outsb(unsigned short __port, const void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; outsb"
+		      : "+S" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
+
+static __inline void outsw(unsigned short __port, const void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; outsw"
+		      : "+S" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
+
+static __inline void outsl(unsigned short __port, const void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; outsl"
+		      : "+S" (__buf), "+c"(__n)
+		      : "d" (__port));
+}
+
+static __inline void insb(unsigned short __port, void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; insb"
+		      : "+D" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
+
+static __inline void insw(unsigned short __port, void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; insw"
+		      : "+D" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
+
+static __inline void insl(unsigned short __port, void *__buf, unsigned long __n)
+{
+	__asm__ volatile ("cld; rep; insl"
+		      : "+D" (__buf), "+c" (__n)
+		      : "d" (__port));
+}
diff --git a/musl-include/x86_64/bits/ioctl.h b/musl-include/x86_64/bits/ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/ioctl.h
@@ -0,0 +1,115 @@
+#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
+#define _IOC_NONE  0U
+#define _IOC_WRITE 1U
+#define _IOC_READ  2U
+
+#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
+#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
+#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
+#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
+
+#define TCGETS		0x5401
+#define TCSETS		0x5402
+#define TCSETSW		0x5403
+#define TCSETSF		0x5404
+#define TCGETA		0x5405
+#define TCSETA		0x5406
+#define TCSETAW		0x5407
+#define TCSETAF		0x5408
+#define TCSBRK		0x5409
+#define TCXONC		0x540A
+#define TCFLSH		0x540B
+#define TIOCEXCL	0x540C
+#define TIOCNXCL	0x540D
+#define TIOCSCTTY	0x540E
+#define TIOCGPGRP	0x540F
+#define TIOCSPGRP	0x5410
+#define TIOCOUTQ	0x5411
+#define TIOCSTI		0x5412
+#define TIOCGWINSZ	0x5413
+#define TIOCSWINSZ	0x5414
+#define TIOCMGET	0x5415
+#define TIOCMBIS	0x5416
+#define TIOCMBIC	0x5417
+#define TIOCMSET	0x5418
+#define TIOCGSOFTCAR	0x5419
+#define TIOCSSOFTCAR	0x541A
+#define FIONREAD	0x541B
+#define TIOCINQ		FIONREAD
+#define TIOCLINUX	0x541C
+#define TIOCCONS	0x541D
+#define TIOCGSERIAL	0x541E
+#define TIOCSSERIAL	0x541F
+#define TIOCPKT		0x5420
+#define FIONBIO		0x5421
+#define TIOCNOTTY	0x5422
+#define TIOCSETD	0x5423
+#define TIOCGETD	0x5424
+#define TCSBRKP		0x5425
+#define TIOCSBRK	0x5427
+#define TIOCCBRK	0x5428
+#define TIOCGSID	0x5429
+#define TIOCGRS485	0x542E
+#define TIOCSRS485	0x542F
+#define TIOCGPTN	0x80045430
+#define TIOCSPTLCK	0x40045431
+#define TIOCGDEV	0x80045432
+#define TCGETX		0x5432
+#define TCSETX		0x5433
+#define TCSETXF		0x5434
+#define TCSETXW		0x5435
+#define TIOCSIG		0x40045436
+#define TIOCVHANGUP	0x5437
+#define TIOCGPKT	0x80045438
+#define TIOCGPTLCK	0x80045439
+#define TIOCGEXCL	0x80045440
+#define TIOCGPTPEER	0x5441
+#define TIOCGISO7816	0x80285442
+#define TIOCSISO7816	0xc0285443
+
+#define FIONCLEX	0x5450
+#define FIOCLEX		0x5451
+#define FIOASYNC	0x5452
+#define TIOCSERCONFIG	0x5453
+#define TIOCSERGWILD	0x5454
+#define TIOCSERSWILD	0x5455
+#define TIOCGLCKTRMIOS	0x5456
+#define TIOCSLCKTRMIOS	0x5457
+#define TIOCSERGSTRUCT	0x5458
+#define TIOCSERGETLSR   0x5459
+#define TIOCSERGETMULTI 0x545A
+#define TIOCSERSETMULTI 0x545B
+
+#define TIOCMIWAIT	0x545C
+#define TIOCGICOUNT	0x545D
+#define FIOQSIZE	0x5460
+
+#define TIOCM_LE        0x001
+#define TIOCM_DTR       0x002
+#define TIOCM_RTS       0x004
+#define TIOCM_ST        0x008
+#define TIOCM_SR        0x010
+#define TIOCM_CTS       0x020
+#define TIOCM_CAR       0x040
+#define TIOCM_RNG       0x080
+#define TIOCM_DSR       0x100
+#define TIOCM_CD        TIOCM_CAR
+#define TIOCM_RI        TIOCM_RNG
+#define TIOCM_OUT1      0x2000
+#define TIOCM_OUT2      0x4000
+#define TIOCM_LOOP      0x8000
+
+#define FIOSETOWN       0x8901
+#define SIOCSPGRP       0x8902
+#define FIOGETOWN       0x8903
+#define SIOCGPGRP       0x8904
+#define SIOCATMARK      0x8905
+#if __LONG_MAX == 0x7fffffff
+#define SIOCGSTAMP      _IOR(0x89, 6, char[16])
+#define SIOCGSTAMPNS    _IOR(0x89, 7, char[16])
+#else
+#define SIOCGSTAMP      0x8906
+#define SIOCGSTAMPNS    0x8907
+#endif
+
+#include <bits/ioctl_fix.h>
diff --git a/musl-include/x86_64/bits/ioctl_fix.h b/musl-include/x86_64/bits/ioctl_fix.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/ioctl_fix.h
diff --git a/musl-include/x86_64/bits/ipc.h b/musl-include/x86_64/bits/ipc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/ipc.h
@@ -0,0 +1,11 @@
+struct ipc_perm {
+	key_t __ipc_perm_key;
+	uid_t uid;
+	gid_t gid;
+	uid_t cuid;
+	gid_t cgid;
+	mode_t mode;
+	int __ipc_perm_seq;
+	long __pad1;
+	long __pad2;
+};
diff --git a/musl-include/x86_64/bits/ipcstat.h b/musl-include/x86_64/bits/ipcstat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/ipcstat.h
@@ -0,0 +1,1 @@
+#define IPC_STAT 2
diff --git a/musl-include/x86_64/bits/kd.h b/musl-include/x86_64/bits/kd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/kd.h
@@ -0,0 +1,1 @@
+#include <linux/kd.h>
diff --git a/musl-include/x86_64/bits/limits.h b/musl-include/x86_64/bits/limits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/limits.h
@@ -0,0 +1,1 @@
+#define PAGESIZE 4096
diff --git a/musl-include/x86_64/bits/link.h b/musl-include/x86_64/bits/link.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/link.h
@@ -0,0 +1,1 @@
+typedef uint32_t Elf_Symndx;
diff --git a/musl-include/x86_64/bits/mman.h b/musl-include/x86_64/bits/mman.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/mman.h
@@ -0,0 +1,1 @@
+#define MAP_32BIT      0x40
diff --git a/musl-include/x86_64/bits/msg.h b/musl-include/x86_64/bits/msg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/msg.h
@@ -0,0 +1,12 @@
+struct msqid_ds {
+	struct ipc_perm msg_perm;
+	time_t msg_stime;
+	time_t msg_rtime;
+	time_t msg_ctime;
+	unsigned long msg_cbytes;
+	msgqnum_t msg_qnum;
+	msglen_t msg_qbytes;
+	pid_t msg_lspid;
+	pid_t msg_lrpid;
+	unsigned long __unused[2];
+};
diff --git a/musl-include/x86_64/bits/poll.h b/musl-include/x86_64/bits/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/poll.h
diff --git a/musl-include/x86_64/bits/posix.h b/musl-include/x86_64/bits/posix.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/posix.h
@@ -0,0 +1,2 @@
+#define _POSIX_V6_LP64_OFF64  1
+#define _POSIX_V7_LP64_OFF64  1
diff --git a/musl-include/x86_64/bits/ptrace.h b/musl-include/x86_64/bits/ptrace.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/ptrace.h
@@ -0,0 +1,13 @@
+#define PTRACE_GET_THREAD_AREA		25
+#define PTRACE_SET_THREAD_AREA		26
+#define PTRACE_ARCH_PRCTL		30
+#define PTRACE_SYSEMU			31
+#define PTRACE_SYSEMU_SINGLESTEP	32
+#define PTRACE_SINGLEBLOCK		33
+
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
+#define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL
+#define PT_SYSEMU PTRACE_SYSEMU
+#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
diff --git a/musl-include/x86_64/bits/reg.h b/musl-include/x86_64/bits/reg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/reg.h
@@ -0,0 +1,29 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
+#define R15    0
+#define R14    1
+#define R13    2
+#define R12    3
+#define RBP    4
+#define RBX    5
+#define R11    6
+#define R10    7
+#define R9     8
+#define R8     9
+#define RAX    10
+#define RCX    11
+#define RDX    12
+#define RSI    13
+#define RDI    14
+#define ORIG_RAX 15
+#define RIP    16
+#define CS     17
+#define EFLAGS 18
+#define RSP    19
+#define SS     20
+#define FS_BASE 21
+#define GS_BASE 22
+#define DS     23
+#define ES     24
+#define FS     25
+#define GS     26
diff --git a/musl-include/x86_64/bits/resource.h b/musl-include/x86_64/bits/resource.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/resource.h
diff --git a/musl-include/x86_64/bits/sem.h b/musl-include/x86_64/bits/sem.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/sem.h
@@ -0,0 +1,11 @@
+struct semid_ds {
+	struct ipc_perm sem_perm;
+	time_t sem_otime;
+	long __unused1;
+	time_t sem_ctime;
+	long __unused2;
+	unsigned short sem_nsems;
+	char __sem_nsems_pad[sizeof(long)-sizeof(short)];
+	long __unused3;
+	long __unused4;
+};
diff --git a/musl-include/x86_64/bits/setjmp.h b/musl-include/x86_64/bits/setjmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/setjmp.h
@@ -0,0 +1,1 @@
+typedef unsigned long __jmp_buf[8];
diff --git a/musl-include/x86_64/bits/shm.h b/musl-include/x86_64/bits/shm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/shm.h
@@ -0,0 +1,24 @@
+#define SHMLBA 4096
+
+struct shmid_ds {
+	struct ipc_perm shm_perm;
+	size_t shm_segsz;
+	time_t shm_atime;
+	time_t shm_dtime;
+	time_t shm_ctime;
+	pid_t shm_cpid;
+	pid_t shm_lpid;
+	unsigned long shm_nattch;
+	unsigned long __pad1;
+	unsigned long __pad2;
+};
+
+struct shminfo {
+	unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
+};
+
+struct shm_info {
+	int __used_ids;
+	unsigned long shm_tot, shm_rss, shm_swp;
+	unsigned long __swap_attempts, __swap_successes;
+};
diff --git a/musl-include/x86_64/bits/signal.h b/musl-include/x86_64/bits/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/signal.h
@@ -0,0 +1,153 @@
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+#endif
+
+#ifdef _GNU_SOURCE
+enum { REG_R8 = 0 };
+#define REG_R8 REG_R8
+enum { REG_R9 = 1 };
+#define REG_R9 REG_R9
+enum { REG_R10 = 2 };
+#define REG_R10 REG_R10
+enum { REG_R11 = 3 };
+#define REG_R11 REG_R11
+enum { REG_R12 = 4 };
+#define REG_R12 REG_R12
+enum { REG_R13 = 5 };
+#define REG_R13 REG_R13
+enum { REG_R14 = 6 };
+#define REG_R14 REG_R14
+enum { REG_R15 = 7 };
+#define REG_R15 REG_R15
+enum { REG_RDI = 8 };
+#define REG_RDI REG_RDI
+enum { REG_RSI = 9 };
+#define REG_RSI REG_RSI
+enum { REG_RBP = 10 };
+#define REG_RBP REG_RBP
+enum { REG_RBX = 11 };
+#define REG_RBX REG_RBX
+enum { REG_RDX = 12 };
+#define REG_RDX REG_RDX
+enum { REG_RAX = 13 };
+#define REG_RAX REG_RAX
+enum { REG_RCX = 14 };
+#define REG_RCX REG_RCX
+enum { REG_RSP = 15 };
+#define REG_RSP REG_RSP
+enum { REG_RIP = 16 };
+#define REG_RIP REG_RIP
+enum { REG_EFL = 17 };
+#define REG_EFL REG_EFL
+enum { REG_CSGSFS = 18 };
+#define REG_CSGSFS REG_CSGSFS
+enum { REG_ERR = 19 };
+#define REG_ERR REG_ERR
+enum { REG_TRAPNO = 20 };
+#define REG_TRAPNO REG_TRAPNO
+enum { REG_OLDMASK = 21 };
+#define REG_OLDMASK REG_OLDMASK
+enum { REG_CR2 = 22 };
+#define REG_CR2 REG_CR2
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef long long greg_t, gregset_t[23];
+typedef struct _fpstate {
+	unsigned short cwd, swd, ftw, fop;
+	unsigned long long rip, rdp;
+	unsigned mxcsr, mxcr_mask;
+	struct {
+		unsigned short significand[4], exponent, padding[3];
+	} _st[8];
+	struct {
+		unsigned element[4];
+	} _xmm[16];
+	unsigned padding[24];
+} *fpregset_t;
+struct sigcontext {
+	unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
+	unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
+	unsigned short cs, gs, fs, __pad0;
+	unsigned long err, trapno, oldmask, cr2;
+	struct _fpstate *fpstate;
+	unsigned long __reserved1[8];
+};
+typedef struct {
+	gregset_t gregs;
+	fpregset_t fpregs;
+	unsigned long long __reserved1[8];
+} mcontext_t;
+#else
+typedef struct {
+	unsigned long __space[32];
+} mcontext_t;
+#endif
+
+struct sigaltstack {
+	void *ss_sp;
+	int ss_flags;
+	size_t ss_size;
+};
+
+typedef struct __ucontext {
+	unsigned long uc_flags;
+	struct __ucontext *uc_link;
+	stack_t uc_stack;
+	mcontext_t uc_mcontext;
+	sigset_t uc_sigmask;
+	unsigned long __fpregs_mem[64];
+} ucontext_t;
+
+#define SA_NOCLDSTOP  1
+#define SA_NOCLDWAIT  2
+#define SA_SIGINFO    4
+#define SA_ONSTACK    0x08000000
+#define SA_RESTART    0x10000000
+#define SA_NODEFER    0x40000000
+#define SA_RESETHAND  0x80000000
+#define SA_RESTORER   0x04000000
+
+#endif
+
+#define SIGHUP    1
+#define SIGINT    2
+#define SIGQUIT   3
+#define SIGILL    4
+#define SIGTRAP   5
+#define SIGABRT   6
+#define SIGIOT    SIGABRT
+#define SIGBUS    7
+#define SIGFPE    8
+#define SIGKILL   9
+#define SIGUSR1   10
+#define SIGSEGV   11
+#define SIGUSR2   12
+#define SIGPIPE   13
+#define SIGALRM   14
+#define SIGTERM   15
+#define SIGSTKFLT 16
+#define SIGCHLD   17
+#define SIGCONT   18
+#define SIGSTOP   19
+#define SIGTSTP   20
+#define SIGTTIN   21
+#define SIGTTOU   22
+#define SIGURG    23
+#define SIGXCPU   24
+#define SIGXFSZ   25
+#define SIGVTALRM 26
+#define SIGPROF   27
+#define SIGWINCH  28
+#define SIGIO     29
+#define SIGPOLL   29
+#define SIGPWR    30
+#define SIGSYS    31
+#define SIGUNUSED SIGSYS
+
+#define _NSIG 65
+
diff --git a/musl-include/x86_64/bits/socket.h b/musl-include/x86_64/bits/socket.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/socket.h
diff --git a/musl-include/x86_64/bits/soundcard.h b/musl-include/x86_64/bits/soundcard.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/soundcard.h
@@ -0,0 +1,1 @@
+#include <linux/soundcard.h>
diff --git a/musl-include/x86_64/bits/stat.h b/musl-include/x86_64/bits/stat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/stat.h
@@ -0,0 +1,22 @@
+/* copied from kernel definition, but with padding replaced
+ * by the corresponding correctly-sized userspace types. */
+
+struct stat {
+	dev_t st_dev;
+	ino_t st_ino;
+	nlink_t st_nlink;
+
+	mode_t st_mode;
+	uid_t st_uid;
+	gid_t st_gid;
+	unsigned int    __pad0;
+	dev_t st_rdev;
+	off_t st_size;
+	blksize_t st_blksize;
+	blkcnt_t st_blocks;
+
+	struct timespec st_atim;
+	struct timespec st_mtim;
+	struct timespec st_ctim;
+	long __unused[3];
+};
diff --git a/musl-include/x86_64/bits/statfs.h b/musl-include/x86_64/bits/statfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/statfs.h
@@ -0,0 +1,7 @@
+struct statfs {
+	unsigned long f_type, f_bsize;
+	fsblkcnt_t f_blocks, f_bfree, f_bavail;
+	fsfilcnt_t f_files, f_ffree;
+	fsid_t f_fsid;
+	unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
+};
diff --git a/musl-include/x86_64/bits/stdint.h b/musl-include/x86_64/bits/stdint.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/stdint.h
@@ -0,0 +1,20 @@
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+
+#define INT_FAST16_MIN  INT32_MIN
+#define INT_FAST32_MIN  INT32_MIN
+
+#define INT_FAST16_MAX  INT32_MAX
+#define INT_FAST32_MAX  INT32_MAX
+
+#define UINT_FAST16_MAX UINT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INTPTR_MIN      INT64_MIN
+#define INTPTR_MAX      INT64_MAX
+#define UINTPTR_MAX     UINT64_MAX
+#define PTRDIFF_MIN     INT64_MIN
+#define PTRDIFF_MAX     INT64_MAX
+#define SIZE_MAX        UINT64_MAX
diff --git a/musl-include/x86_64/bits/syscall.h b/musl-include/x86_64/bits/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/syscall.h
@@ -0,0 +1,727 @@
+#define __NR_read				0
+#define __NR_write				1
+#define __NR_open				2
+#define __NR_close				3
+#define __NR_stat				4
+#define __NR_fstat				5
+#define __NR_lstat				6
+#define __NR_poll				7
+#define __NR_lseek				8
+#define __NR_mmap				9
+#define __NR_mprotect			10
+#define __NR_munmap				11
+#define __NR_brk				12
+#define __NR_rt_sigaction		13
+#define __NR_rt_sigprocmask		14
+#define __NR_rt_sigreturn		15
+#define __NR_ioctl				16
+#define __NR_pread64			17
+#define __NR_pwrite64			18
+#define __NR_readv				19
+#define __NR_writev				20
+#define __NR_access				21
+#define __NR_pipe				22
+#define __NR_select				23
+#define __NR_sched_yield		24
+#define __NR_mremap				25
+#define __NR_msync				26
+#define __NR_mincore			27
+#define __NR_madvise			28
+#define __NR_shmget				29
+#define __NR_shmat				30
+#define __NR_shmctl				31
+#define __NR_dup				32
+#define __NR_dup2				33
+#define __NR_pause				34
+#define __NR_nanosleep			35
+#define __NR_getitimer			36
+#define __NR_alarm				37
+#define __NR_setitimer			38
+#define __NR_getpid				39
+#define __NR_sendfile			40
+#define __NR_socket				41
+#define __NR_connect			42
+#define __NR_accept				43
+#define __NR_sendto				44
+#define __NR_recvfrom			45
+#define __NR_sendmsg			46
+#define __NR_recvmsg			47
+#define __NR_shutdown			48
+#define __NR_bind				49
+#define __NR_listen				50
+#define __NR_getsockname		51
+#define __NR_getpeername		52
+#define __NR_socketpair			53
+#define __NR_setsockopt			54
+#define __NR_getsockopt			55
+#define __NR_clone				56
+#define __NR_fork				57
+#define __NR_vfork				58
+#define __NR_execve				59
+#define __NR_exit				60
+#define __NR_wait4				61
+#define __NR_kill				62
+#define __NR_uname				63
+#define __NR_semget				64
+#define __NR_semop				65
+#define __NR_semctl				66
+#define __NR_shmdt				67
+#define __NR_msgget				68
+#define __NR_msgsnd				69
+#define __NR_msgrcv				70
+#define __NR_msgctl				71
+#define __NR_fcntl				72
+#define __NR_flock				73
+#define __NR_fsync				74
+#define __NR_fdatasync			75
+#define __NR_truncate			76
+#define __NR_ftruncate			77
+#define __NR_getdents			78
+#define __NR_getcwd				79
+#define __NR_chdir				80
+#define __NR_fchdir				81
+#define __NR_rename				82
+#define __NR_mkdir				83
+#define __NR_rmdir				84
+#define __NR_creat				85
+#define __NR_link				86
+#define __NR_unlink				87
+#define __NR_symlink			88
+#define __NR_readlink			89
+#define __NR_chmod				90
+#define __NR_fchmod				91
+#define __NR_chown				92
+#define __NR_fchown				93
+#define __NR_lchown				94
+#define __NR_umask				95
+#define __NR_gettimeofday		96
+#define __NR_getrlimit			97
+#define __NR_getrusage			98
+#define __NR_sysinfo			99
+#define __NR_times				100
+#define __NR_ptrace				101
+#define __NR_getuid				102
+#define __NR_syslog				103
+#define __NR_getgid				104
+#define __NR_setuid				105
+#define __NR_setgid				106
+#define __NR_geteuid			107
+#define __NR_getegid			108
+#define __NR_setpgid			109
+#define __NR_getppid			110
+#define __NR_getpgrp			111
+#define __NR_setsid				112
+#define __NR_setreuid			113
+#define __NR_setregid			114
+#define __NR_getgroups			115
+#define __NR_setgroups			116
+#define __NR_setresuid			117
+#define __NR_getresuid			118
+#define __NR_setresgid			119
+#define __NR_getresgid			120
+#define __NR_getpgid			121
+#define __NR_setfsuid			122
+#define __NR_setfsgid			123
+#define __NR_getsid				124
+#define __NR_capget				125
+#define __NR_capset				126
+#define __NR_rt_sigpending		127
+#define __NR_rt_sigtimedwait	128
+#define __NR_rt_sigqueueinfo	129
+#define __NR_rt_sigsuspend		130
+#define __NR_sigaltstack		131
+#define __NR_utime				132
+#define __NR_mknod				133
+#define __NR_uselib				134
+#define __NR_personality		135
+#define __NR_ustat				136
+#define __NR_statfs				137
+#define __NR_fstatfs			138
+#define __NR_sysfs				139
+#define __NR_getpriority			140
+#define __NR_setpriority			141
+#define __NR_sched_setparam			142
+#define __NR_sched_getparam			143
+#define __NR_sched_setscheduler		144
+#define __NR_sched_getscheduler		145
+#define __NR_sched_get_priority_max	146
+#define __NR_sched_get_priority_min	147
+#define __NR_sched_rr_get_interval	148
+#define __NR_mlock					149
+#define __NR_munlock				150
+#define __NR_mlockall				151
+#define __NR_munlockall				152
+#define __NR_vhangup				153
+#define __NR_modify_ldt				154
+#define __NR_pivot_root				155
+#define __NR__sysctl				156
+#define __NR_prctl					157
+#define __NR_arch_prctl				158
+#define __NR_adjtimex				159
+#define __NR_setrlimit				160
+#define __NR_chroot					161
+#define __NR_sync					162
+#define __NR_acct					163
+#define __NR_settimeofday			164
+#define __NR_mount					165
+#define __NR_umount2				166
+#define __NR_swapon					167
+#define __NR_swapoff				168
+#define __NR_reboot					169
+#define __NR_sethostname			170
+#define __NR_setdomainname			171
+#define __NR_iopl					172
+#define __NR_ioperm					173
+#define __NR_create_module			174
+#define __NR_init_module			175
+#define __NR_delete_module			176
+#define __NR_get_kernel_syms		177
+#define __NR_query_module			178
+#define __NR_quotactl				179
+#define __NR_nfsservctl				180
+#define __NR_getpmsg				181
+#define __NR_putpmsg				182
+#define __NR_afs_syscall			183
+#define __NR_tuxcall				184
+#define __NR_security				185
+#define __NR_gettid					186
+#define __NR_readahead				187
+#define __NR_setxattr				188
+#define __NR_lsetxattr				189
+#define __NR_fsetxattr				190
+#define __NR_getxattr				191
+#define __NR_lgetxattr				192
+#define __NR_fgetxattr				193
+#define __NR_listxattr				194
+#define __NR_llistxattr				195
+#define __NR_flistxattr				196
+#define __NR_removexattr			197
+#define __NR_lremovexattr			198
+#define __NR_fremovexattr			199
+#define __NR_tkill					200
+#define __NR_time					201
+#define __NR_futex					202
+#define __NR_sched_setaffinity		203
+#define __NR_sched_getaffinity		204
+#define __NR_set_thread_area		205
+#define __NR_io_setup				206
+#define __NR_io_destroy				207
+#define __NR_io_getevents			208
+#define __NR_io_submit				209
+#define __NR_io_cancel				210
+#define __NR_get_thread_area		211
+#define __NR_lookup_dcookie			212
+#define __NR_epoll_create			213
+#define __NR_epoll_ctl_old			214
+#define __NR_epoll_wait_old			215
+#define __NR_remap_file_pages		216
+#define __NR_getdents64				217
+#define __NR_set_tid_address		218
+#define __NR_restart_syscall		219
+#define __NR_semtimedop				220
+#define __NR_fadvise64				221
+#define __NR_timer_create			222
+#define __NR_timer_settime			223
+#define __NR_timer_gettime			224
+#define __NR_timer_getoverrun		225
+#define __NR_timer_delete			226
+#define __NR_clock_settime			227
+#define __NR_clock_gettime			228
+#define __NR_clock_getres			229
+#define __NR_clock_nanosleep		230
+#define __NR_exit_group				231
+#define __NR_epoll_wait				232
+#define __NR_epoll_ctl				233
+#define __NR_tgkill					234
+#define __NR_utimes					235
+#define __NR_vserver				236
+#define __NR_mbind					237
+#define __NR_set_mempolicy			238
+#define __NR_get_mempolicy			239
+#define __NR_mq_open				240
+#define __NR_mq_unlink				241
+#define __NR_mq_timedsend			242
+#define __NR_mq_timedreceive		243
+#define __NR_mq_notify				244
+#define __NR_mq_getsetattr			245
+#define __NR_kexec_load				246
+#define __NR_waitid					247
+#define __NR_add_key				248
+#define __NR_request_key			249
+#define __NR_keyctl					250
+#define __NR_ioprio_set				251
+#define __NR_ioprio_get				252
+#define __NR_inotify_init			253
+#define __NR_inotify_add_watch		254
+#define __NR_inotify_rm_watch		255
+#define __NR_migrate_pages			256
+#define __NR_openat					257
+#define __NR_mkdirat				258
+#define __NR_mknodat				259
+#define __NR_fchownat				260
+#define __NR_futimesat				261
+#define __NR_newfstatat				262
+#define __NR_unlinkat				263
+#define __NR_renameat				264
+#define __NR_linkat					265
+#define __NR_symlinkat				266
+#define __NR_readlinkat				267
+#define __NR_fchmodat				268
+#define __NR_faccessat				269
+#define __NR_pselect6				270
+#define __NR_ppoll					271
+#define __NR_unshare				272
+#define __NR_set_robust_list		273
+#define __NR_get_robust_list		274
+#define __NR_splice					275
+#define __NR_tee					276
+#define __NR_sync_file_range		277
+#define __NR_vmsplice				278
+#define __NR_move_pages				279
+#define __NR_utimensat				280
+#define __NR_epoll_pwait			281
+#define __NR_signalfd				282
+#define __NR_timerfd_create			283
+#define __NR_eventfd				284
+#define __NR_fallocate				285
+#define __NR_timerfd_settime		286
+#define __NR_timerfd_gettime		287
+#define __NR_accept4				288
+#define __NR_signalfd4				289
+#define __NR_eventfd2				290
+#define __NR_epoll_create1			291
+#define __NR_dup3					292
+#define __NR_pipe2					293
+#define __NR_inotify_init1			294
+#define __NR_preadv					295
+#define __NR_pwritev				296
+#define __NR_rt_tgsigqueueinfo		297
+#define __NR_perf_event_open		298
+#define __NR_recvmmsg				299
+#define __NR_fanotify_init			300
+#define __NR_fanotify_mark			301
+#define __NR_prlimit64				302
+#define __NR_name_to_handle_at			303
+#define __NR_open_by_handle_at			304
+#define __NR_clock_adjtime			305
+#define __NR_syncfs				306
+#define __NR_sendmmsg				307
+#define __NR_setns				308
+#define __NR_getcpu				309
+#define __NR_process_vm_readv			310
+#define __NR_process_vm_writev			311
+#define __NR_kcmp				312
+#define __NR_finit_module			313
+#define __NR_sched_setattr			314
+#define __NR_sched_getattr			315
+#define __NR_renameat2				316
+#define __NR_seccomp				317
+#define __NR_getrandom				318
+#define __NR_memfd_create			319
+#define __NR_kexec_file_load			320
+#define __NR_bpf				321
+#define __NR_execveat				322
+#define __NR_userfaultfd			323
+#define __NR_membarrier				324
+#define __NR_mlock2				325
+#define __NR_copy_file_range			326
+#define __NR_preadv2				327
+#define __NR_pwritev2				328
+#define __NR_pkey_mprotect			329
+#define __NR_pkey_alloc				330
+#define __NR_pkey_free				331
+#define __NR_statx				332
+#define __NR_io_pgetevents			333
+#define __NR_rseq				334
+#define __NR_pidfd_send_signal			424
+#define __NR_io_uring_setup			425
+#define __NR_io_uring_enter			426
+#define __NR_io_uring_register			427
+#define __NR_open_tree		428
+#define __NR_move_mount		429
+#define __NR_fsopen		430
+#define __NR_fsconfig		431
+#define __NR_fsmount		432
+#define __NR_fspick		433
+#define __NR_pidfd_open		434
+#define __NR_clone3		435
+#define __NR_close_range	436
+#define __NR_openat2		437
+#define __NR_pidfd_getfd	438
+#define __NR_faccessat2		439
+#define __NR_process_madvise	440
+#define __NR_epoll_pwait2	441
+#define __NR_mount_setattr	442
+#define __NR_landlock_create_ruleset	444
+#define __NR_landlock_add_rule	445
+#define __NR_landlock_restrict_self	446
+#define __NR_memfd_secret	447
+#define __NR_process_mrelease	448
+#define __NR_futex_waitv	449
+#define __NR_set_mempolicy_home_node	450
+#define __NR_cachestat		451
+#define __NR_fchmodat2		452
+
+#define SYS_read				0
+#define SYS_write				1
+#define SYS_open				2
+#define SYS_close				3
+#define SYS_stat				4
+#define SYS_fstat				5
+#define SYS_lstat				6
+#define SYS_poll				7
+#define SYS_lseek				8
+#define SYS_mmap				9
+#define SYS_mprotect			10
+#define SYS_munmap				11
+#define SYS_brk				12
+#define SYS_rt_sigaction		13
+#define SYS_rt_sigprocmask		14
+#define SYS_rt_sigreturn		15
+#define SYS_ioctl				16
+#define SYS_pread64			17
+#define SYS_pwrite64			18
+#define SYS_readv				19
+#define SYS_writev				20
+#define SYS_access				21
+#define SYS_pipe				22
+#define SYS_select				23
+#define SYS_sched_yield		24
+#define SYS_mremap				25
+#define SYS_msync				26
+#define SYS_mincore			27
+#define SYS_madvise			28
+#define SYS_shmget				29
+#define SYS_shmat				30
+#define SYS_shmctl				31
+#define SYS_dup				32
+#define SYS_dup2				33
+#define SYS_pause				34
+#define SYS_nanosleep			35
+#define SYS_getitimer			36
+#define SYS_alarm				37
+#define SYS_setitimer			38
+#define SYS_getpid				39
+#define SYS_sendfile			40
+#define SYS_socket				41
+#define SYS_connect			42
+#define SYS_accept				43
+#define SYS_sendto				44
+#define SYS_recvfrom			45
+#define SYS_sendmsg			46
+#define SYS_recvmsg			47
+#define SYS_shutdown			48
+#define SYS_bind				49
+#define SYS_listen				50
+#define SYS_getsockname		51
+#define SYS_getpeername		52
+#define SYS_socketpair			53
+#define SYS_setsockopt			54
+#define SYS_getsockopt			55
+#define SYS_clone				56
+#define SYS_fork				57
+#define SYS_vfork				58
+#define SYS_execve				59
+#define SYS_exit				60
+#define SYS_wait4				61
+#define SYS_kill				62
+#define SYS_uname				63
+#define SYS_semget				64
+#define SYS_semop				65
+#define SYS_semctl				66
+#define SYS_shmdt				67
+#define SYS_msgget				68
+#define SYS_msgsnd				69
+#define SYS_msgrcv				70
+#define SYS_msgctl				71
+#define SYS_fcntl				72
+#define SYS_flock				73
+#define SYS_fsync				74
+#define SYS_fdatasync			75
+#define SYS_truncate			76
+#define SYS_ftruncate			77
+#define SYS_getdents			78
+#define SYS_getcwd				79
+#define SYS_chdir				80
+#define SYS_fchdir				81
+#define SYS_rename				82
+#define SYS_mkdir				83
+#define SYS_rmdir				84
+#define SYS_creat				85
+#define SYS_link				86
+#define SYS_unlink				87
+#define SYS_symlink			88
+#define SYS_readlink			89
+#define SYS_chmod				90
+#define SYS_fchmod				91
+#define SYS_chown				92
+#define SYS_fchown				93
+#define SYS_lchown				94
+#define SYS_umask				95
+#define SYS_gettimeofday		96
+#define SYS_getrlimit			97
+#define SYS_getrusage			98
+#define SYS_sysinfo			99
+#define SYS_times				100
+#define SYS_ptrace				101
+#define SYS_getuid				102
+#define SYS_syslog				103
+#define SYS_getgid				104
+#define SYS_setuid				105
+#define SYS_setgid				106
+#define SYS_geteuid			107
+#define SYS_getegid			108
+#define SYS_setpgid			109
+#define SYS_getppid			110
+#define SYS_getpgrp			111
+#define SYS_setsid				112
+#define SYS_setreuid			113
+#define SYS_setregid			114
+#define SYS_getgroups			115
+#define SYS_setgroups			116
+#define SYS_setresuid			117
+#define SYS_getresuid			118
+#define SYS_setresgid			119
+#define SYS_getresgid			120
+#define SYS_getpgid			121
+#define SYS_setfsuid			122
+#define SYS_setfsgid			123
+#define SYS_getsid				124
+#define SYS_capget				125
+#define SYS_capset				126
+#define SYS_rt_sigpending		127
+#define SYS_rt_sigtimedwait	128
+#define SYS_rt_sigqueueinfo	129
+#define SYS_rt_sigsuspend		130
+#define SYS_sigaltstack		131
+#define SYS_utime				132
+#define SYS_mknod				133
+#define SYS_uselib				134
+#define SYS_personality		135
+#define SYS_ustat				136
+#define SYS_statfs				137
+#define SYS_fstatfs			138
+#define SYS_sysfs				139
+#define SYS_getpriority			140
+#define SYS_setpriority			141
+#define SYS_sched_setparam			142
+#define SYS_sched_getparam			143
+#define SYS_sched_setscheduler		144
+#define SYS_sched_getscheduler		145
+#define SYS_sched_get_priority_max	146
+#define SYS_sched_get_priority_min	147
+#define SYS_sched_rr_get_interval	148
+#define SYS_mlock					149
+#define SYS_munlock				150
+#define SYS_mlockall				151
+#define SYS_munlockall				152
+#define SYS_vhangup				153
+#define SYS_modify_ldt				154
+#define SYS_pivot_root				155
+#define SYS__sysctl				156
+#define SYS_prctl					157
+#define SYS_arch_prctl				158
+#define SYS_adjtimex				159
+#define SYS_setrlimit				160
+#define SYS_chroot					161
+#define SYS_sync					162
+#define SYS_acct					163
+#define SYS_settimeofday			164
+#define SYS_mount					165
+#define SYS_umount2				166
+#define SYS_swapon					167
+#define SYS_swapoff				168
+#define SYS_reboot					169
+#define SYS_sethostname			170
+#define SYS_setdomainname			171
+#define SYS_iopl					172
+#define SYS_ioperm					173
+#define SYS_create_module			174
+#define SYS_init_module			175
+#define SYS_delete_module			176
+#define SYS_get_kernel_syms		177
+#define SYS_query_module			178
+#define SYS_quotactl				179
+#define SYS_nfsservctl				180
+#define SYS_getpmsg				181
+#define SYS_putpmsg				182
+#define SYS_afs_syscall			183
+#define SYS_tuxcall				184
+#define SYS_security				185
+#define SYS_gettid					186
+#define SYS_readahead				187
+#define SYS_setxattr				188
+#define SYS_lsetxattr				189
+#define SYS_fsetxattr				190
+#define SYS_getxattr				191
+#define SYS_lgetxattr				192
+#define SYS_fgetxattr				193
+#define SYS_listxattr				194
+#define SYS_llistxattr				195
+#define SYS_flistxattr				196
+#define SYS_removexattr			197
+#define SYS_lremovexattr			198
+#define SYS_fremovexattr			199
+#define SYS_tkill					200
+#define SYS_time					201
+#define SYS_futex					202
+#define SYS_sched_setaffinity		203
+#define SYS_sched_getaffinity		204
+#define SYS_set_thread_area		205
+#define SYS_io_setup				206
+#define SYS_io_destroy				207
+#define SYS_io_getevents			208
+#define SYS_io_submit				209
+#define SYS_io_cancel				210
+#define SYS_get_thread_area		211
+#define SYS_lookup_dcookie			212
+#define SYS_epoll_create			213
+#define SYS_epoll_ctl_old			214
+#define SYS_epoll_wait_old			215
+#define SYS_remap_file_pages		216
+#define SYS_getdents64				217
+#define SYS_set_tid_address		218
+#define SYS_restart_syscall		219
+#define SYS_semtimedop				220
+#define SYS_fadvise64				221
+#define SYS_timer_create			222
+#define SYS_timer_settime			223
+#define SYS_timer_gettime			224
+#define SYS_timer_getoverrun		225
+#define SYS_timer_delete			226
+#define SYS_clock_settime			227
+#define SYS_clock_gettime			228
+#define SYS_clock_getres			229
+#define SYS_clock_nanosleep		230
+#define SYS_exit_group				231
+#define SYS_epoll_wait				232
+#define SYS_epoll_ctl				233
+#define SYS_tgkill					234
+#define SYS_utimes					235
+#define SYS_vserver				236
+#define SYS_mbind					237
+#define SYS_set_mempolicy			238
+#define SYS_get_mempolicy			239
+#define SYS_mq_open				240
+#define SYS_mq_unlink				241
+#define SYS_mq_timedsend			242
+#define SYS_mq_timedreceive		243
+#define SYS_mq_notify				244
+#define SYS_mq_getsetattr			245
+#define SYS_kexec_load				246
+#define SYS_waitid					247
+#define SYS_add_key				248
+#define SYS_request_key			249
+#define SYS_keyctl					250
+#define SYS_ioprio_set				251
+#define SYS_ioprio_get				252
+#define SYS_inotify_init			253
+#define SYS_inotify_add_watch		254
+#define SYS_inotify_rm_watch		255
+#define SYS_migrate_pages			256
+#define SYS_openat					257
+#define SYS_mkdirat				258
+#define SYS_mknodat				259
+#define SYS_fchownat				260
+#define SYS_futimesat				261
+#define SYS_newfstatat				262
+#define SYS_unlinkat				263
+#define SYS_renameat				264
+#define SYS_linkat					265
+#define SYS_symlinkat				266
+#define SYS_readlinkat				267
+#define SYS_fchmodat				268
+#define SYS_faccessat				269
+#define SYS_pselect6				270
+#define SYS_ppoll					271
+#define SYS_unshare				272
+#define SYS_set_robust_list		273
+#define SYS_get_robust_list		274
+#define SYS_splice					275
+#define SYS_tee					276
+#define SYS_sync_file_range		277
+#define SYS_vmsplice				278
+#define SYS_move_pages				279
+#define SYS_utimensat				280
+#define SYS_epoll_pwait			281
+#define SYS_signalfd				282
+#define SYS_timerfd_create			283
+#define SYS_eventfd				284
+#define SYS_fallocate				285
+#define SYS_timerfd_settime		286
+#define SYS_timerfd_gettime		287
+#define SYS_accept4				288
+#define SYS_signalfd4				289
+#define SYS_eventfd2				290
+#define SYS_epoll_create1			291
+#define SYS_dup3					292
+#define SYS_pipe2					293
+#define SYS_inotify_init1			294
+#define SYS_preadv					295
+#define SYS_pwritev				296
+#define SYS_rt_tgsigqueueinfo		297
+#define SYS_perf_event_open		298
+#define SYS_recvmmsg				299
+#define SYS_fanotify_init			300
+#define SYS_fanotify_mark			301
+#define SYS_prlimit64				302
+#define SYS_name_to_handle_at			303
+#define SYS_open_by_handle_at			304
+#define SYS_clock_adjtime			305
+#define SYS_syncfs				306
+#define SYS_sendmmsg				307
+#define SYS_setns				308
+#define SYS_getcpu				309
+#define SYS_process_vm_readv			310
+#define SYS_process_vm_writev			311
+#define SYS_kcmp				312
+#define SYS_finit_module			313
+#define SYS_sched_setattr			314
+#define SYS_sched_getattr			315
+#define SYS_renameat2				316
+#define SYS_seccomp				317
+#define SYS_getrandom				318
+#define SYS_memfd_create			319
+#define SYS_kexec_file_load			320
+#define SYS_bpf				321
+#define SYS_execveat				322
+#define SYS_userfaultfd			323
+#define SYS_membarrier				324
+#define SYS_mlock2				325
+#define SYS_copy_file_range			326
+#define SYS_preadv2				327
+#define SYS_pwritev2				328
+#define SYS_pkey_mprotect			329
+#define SYS_pkey_alloc				330
+#define SYS_pkey_free				331
+#define SYS_statx				332
+#define SYS_io_pgetevents			333
+#define SYS_rseq				334
+#define SYS_pidfd_send_signal			424
+#define SYS_io_uring_setup			425
+#define SYS_io_uring_enter			426
+#define SYS_io_uring_register			427
+#define SYS_open_tree		428
+#define SYS_move_mount		429
+#define SYS_fsopen		430
+#define SYS_fsconfig		431
+#define SYS_fsmount		432
+#define SYS_fspick		433
+#define SYS_pidfd_open		434
+#define SYS_clone3		435
+#define SYS_close_range	436
+#define SYS_openat2		437
+#define SYS_pidfd_getfd	438
+#define SYS_faccessat2		439
+#define SYS_process_madvise	440
+#define SYS_epoll_pwait2	441
+#define SYS_mount_setattr	442
+#define SYS_landlock_create_ruleset	444
+#define SYS_landlock_add_rule	445
+#define SYS_landlock_restrict_self	446
+#define SYS_memfd_secret	447
+#define SYS_process_mrelease	448
+#define SYS_futex_waitv	449
+#define SYS_set_mempolicy_home_node	450
+#define SYS_cachestat		451
+#define SYS_fchmodat2		452
diff --git a/musl-include/x86_64/bits/termios.h b/musl-include/x86_64/bits/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/termios.h
@@ -0,0 +1,166 @@
+struct termios {
+	tcflag_t c_iflag;
+	tcflag_t c_oflag;
+	tcflag_t c_cflag;
+	tcflag_t c_lflag;
+	cc_t c_line;
+	cc_t c_cc[NCCS];
+	speed_t __c_ispeed;
+	speed_t __c_ospeed;
+};
+
+#define VINTR     0
+#define VQUIT     1
+#define VERASE    2
+#define VKILL     3
+#define VEOF      4
+#define VTIME     5
+#define VMIN      6
+#define VSWTC     7
+#define VSTART    8
+#define VSTOP     9
+#define VSUSP    10
+#define VEOL     11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE  14
+#define VLNEXT   15
+#define VEOL2    16
+
+#define IGNBRK  0000001
+#define BRKINT  0000002
+#define IGNPAR  0000004
+#define PARMRK  0000010
+#define INPCK   0000020
+#define ISTRIP  0000040
+#define INLCR   0000100
+#define IGNCR   0000200
+#define ICRNL   0000400
+#define IUCLC   0001000
+#define IXON    0002000
+#define IXANY   0004000
+#define IXOFF   0010000
+#define IMAXBEL 0020000
+#define IUTF8   0040000
+
+#define OPOST  0000001
+#define OLCUC  0000002
+#define ONLCR  0000004
+#define OCRNL  0000010
+#define ONOCR  0000020
+#define ONLRET 0000040
+#define OFILL  0000100
+#define OFDEL  0000200
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+#define NLDLY  0000400
+#define NL0    0000000
+#define NL1    0000400
+#define CRDLY  0003000
+#define CR0    0000000
+#define CR1    0001000
+#define CR2    0002000
+#define CR3    0003000
+#define TABDLY 0014000
+#define TAB0   0000000
+#define TAB1   0004000
+#define TAB2   0010000
+#define TAB3   0014000
+#define BSDLY  0020000
+#define BS0    0000000
+#define BS1    0020000
+#define FFDLY  0100000
+#define FF0    0000000
+#define FF1    0100000
+#endif
+
+#define VTDLY  0040000
+#define VT0    0000000
+#define VT1    0040000
+
+#define B0       0000000
+#define B50      0000001
+#define B75      0000002
+#define B110     0000003
+#define B134     0000004
+#define B150     0000005
+#define B200     0000006
+#define B300     0000007
+#define B600     0000010
+#define B1200    0000011
+#define B1800    0000012
+#define B2400    0000013
+#define B4800    0000014
+#define B9600    0000015
+#define B19200   0000016
+#define B38400   0000017
+
+#define B57600   0010001
+#define B115200  0010002
+#define B230400  0010003
+#define B460800  0010004
+#define B500000  0010005
+#define B576000  0010006
+#define B921600  0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+
+#define CSIZE  0000060
+#define CS5    0000000
+#define CS6    0000020
+#define CS7    0000040
+#define CS8    0000060
+#define CSTOPB 0000100
+#define CREAD  0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL  0002000
+#define CLOCAL 0004000
+
+#define ISIG   0000001
+#define ICANON 0000002
+#define ECHO   0000010
+#define ECHOE  0000020
+#define ECHOK  0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#define IEXTEN 0100000
+
+#define TCOOFF 0
+#define TCOON  1
+#define TCIOFF 2
+#define TCION  3
+
+#define TCIFLUSH  0
+#define TCOFLUSH  1
+#define TCIOFLUSH 2
+
+#define TCSANOW   0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define EXTA    0000016
+#define EXTB    0000017
+#define CBAUD   0010017
+#define CBAUDEX 0010000
+#define CIBAUD  002003600000
+#define CMSPAR  010000000000
+#define CRTSCTS 020000000000
+
+#define XCASE   0000004
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE  0004000
+#define FLUSHO  0010000
+#define PENDIN  0040000
+#define EXTPROC 0200000
+
+#define XTABS  0014000
+#endif
diff --git a/musl-include/x86_64/bits/user.h b/musl-include/x86_64/bits/user.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/user.h
@@ -0,0 +1,41 @@
+#undef __WORDSIZE
+#define __WORDSIZE 64
+
+typedef struct user_fpregs_struct {
+	uint16_t cwd, swd, ftw, fop;
+	uint64_t rip, rdp;
+	uint32_t mxcsr, mxcr_mask;
+	uint32_t st_space[32], xmm_space[64], padding[24];
+} elf_fpregset_t;
+
+struct user_regs_struct {
+	unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
+	unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
+	unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
+};
+#define ELF_NGREG 27
+typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
+
+struct user {
+	struct user_regs_struct		regs;
+	int				u_fpvalid;
+	struct user_fpregs_struct	i387;
+	unsigned long			u_tsize;
+	unsigned long			u_dsize;
+	unsigned long			u_ssize;
+	unsigned long			start_code;
+	unsigned long			start_stack;
+	long				signal;
+	int				reserved;
+	struct user_regs_struct		*u_ar0;
+	struct user_fpregs_struct	*u_fpstate;
+	unsigned long			magic;
+	char				u_comm[32];
+	unsigned long			u_debugreg[8];
+};
+
+#define PAGE_MASK		(~(PAGESIZE-1))
+#define NBPG			PAGESIZE
+#define UPAGES			1
+#define HOST_TEXT_START_ADDR	(u.start_code)
+#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
diff --git a/musl-include/x86_64/bits/vt.h b/musl-include/x86_64/bits/vt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/bits/vt.h
@@ -0,0 +1,1 @@
+#include <linux/vt.h>
diff --git a/musl-include/x86_64/byteswap.h b/musl-include/x86_64/byteswap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/byteswap.h
@@ -0,0 +1,26 @@
+#ifndef _BYTESWAP_H
+#define _BYTESWAP_H
+
+#include <features.h>
+#include <stdint.h>
+
+static __inline uint16_t __bswap_16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap_32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap_64(uint64_t __x)
+{
+	return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
+}
+
+#define bswap_16(x) __bswap_16(x)
+#define bswap_32(x) __bswap_32(x)
+#define bswap_64(x) __bswap_64(x)
+
+#endif
diff --git a/musl-include/x86_64/complex.h b/musl-include/x86_64/complex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/complex.h
@@ -0,0 +1,133 @@
+#ifndef _COMPLEX_H
+#define _COMPLEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define complex _Complex
+#ifdef __GNUC__
+#define _Complex_I (__extension__ (0.0f+1.0fi))
+#else
+#define _Complex_I (0.0f+1.0fi)
+#endif
+#define I _Complex_I
+
+double complex cacos(double complex);
+float complex cacosf(float complex);
+long double complex cacosl(long double complex);
+
+double complex casin(double complex);
+float complex casinf(float complex);
+long double complex casinl(long double complex);
+
+double complex catan(double complex);
+float complex catanf(float complex);
+long double complex catanl(long double complex);
+
+double complex ccos(double complex);
+float complex ccosf(float complex);
+long double complex ccosl(long double complex);
+
+double complex csin(double complex);
+float complex csinf(float complex);
+long double complex csinl(long double complex);
+
+double complex ctan(double complex);
+float complex ctanf(float complex);
+long double complex ctanl(long double complex);
+
+double complex cacosh(double complex);
+float complex cacoshf(float complex);
+long double complex cacoshl(long double complex);
+
+double complex casinh(double complex);
+float complex casinhf(float complex);
+long double complex casinhl(long double complex);
+
+double complex catanh(double complex);
+float complex catanhf(float complex);
+long double complex catanhl(long double complex);
+
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+long double complex ccoshl(long double complex);
+
+double complex csinh(double complex);
+float complex csinhf(float complex);
+long double complex csinhl(long double complex);
+
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+long double complex ctanhl(long double complex);
+
+double complex cexp(double complex);
+float complex cexpf(float complex);
+long double complex cexpl(long double complex);
+
+double complex clog(double complex);
+float complex clogf(float complex);
+long double complex clogl(long double complex);
+
+double cabs(double complex);
+float cabsf(float complex);
+long double cabsl(long double complex);
+
+double complex cpow(double complex, double complex);
+float complex cpowf(float complex, float complex);
+long double complex cpowl(long double complex, long double complex);
+
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
+long double complex csqrtl(long double complex);
+
+double carg(double complex);
+float cargf(float complex);
+long double cargl(long double complex);
+
+double cimag(double complex);
+float cimagf(float complex);
+long double cimagl(long double complex);
+
+double complex conj(double complex);
+float complex conjf(float complex);
+long double complex conjl(long double complex);
+
+double complex cproj(double complex);
+float complex cprojf(float complex);
+long double complex cprojl(long double complex);
+
+double creal(double complex);
+float crealf(float complex);
+long double creall(long double complex);
+
+#ifndef __cplusplus
+#define __CIMAG(x, t) \
+	(+(union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1])
+
+#define creal(x) ((double)(x))
+#define crealf(x) ((float)(x))
+#define creall(x) ((long double)(x))
+
+#define cimag(x) __CIMAG(x, double)
+#define cimagf(x) __CIMAG(x, float)
+#define cimagl(x) __CIMAG(x, long double)
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#if defined(_Imaginary_I)
+#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I*(t)(y))
+#elif defined(__clang__)
+#define __CMPLX(x, y, t) (+(_Complex t){ (t)(x), (t)(y) })
+#else
+#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y)))
+#endif
+#define CMPLX(x, y) __CMPLX(x, y, double)
+#define CMPLXF(x, y) __CMPLX(x, y, float)
+#define CMPLXL(x, y) __CMPLX(x, y, long double)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/cpio.h b/musl-include/x86_64/cpio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/cpio.h
@@ -0,0 +1,29 @@
+#ifndef _CPIO_H
+#define _CPIO_H
+
+#define MAGIC "070707"
+
+#define C_IRUSR  000400
+#define C_IWUSR  000200
+#define C_IXUSR  000100
+#define C_IRGRP  000040
+#define C_IWGRP  000020
+#define C_IXGRP  000010
+#define C_IROTH  000004
+#define C_IWOTH  000002
+#define C_IXOTH  000001
+
+#define C_ISUID  004000
+#define C_ISGID  002000
+#define C_ISVTX  001000
+
+#define C_ISBLK  060000
+#define C_ISCHR  020000
+#define C_ISDIR  040000
+#define C_ISFIFO 010000
+#define C_ISSOCK 0140000
+#define C_ISLNK  0120000
+#define C_ISCTG  0110000
+#define C_ISREG  0100000
+
+#endif
diff --git a/musl-include/x86_64/crypt.h b/musl-include/x86_64/crypt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/crypt.h
@@ -0,0 +1,20 @@
+#ifndef _CRYPT_H
+#define _CRYPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct crypt_data {
+	int initialized;
+	char __buf[256];
+};
+
+char *crypt(const char *, const char *);
+char *crypt_r(const char *, const char *, struct crypt_data *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/ctype.h b/musl-include/x86_64/ctype.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/ctype.h
@@ -0,0 +1,77 @@
+#ifndef	_CTYPE_H
+#define	_CTYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+int   isalnum(int);
+int   isalpha(int);
+int   isblank(int);
+int   iscntrl(int);
+int   isdigit(int);
+int   isgraph(int);
+int   islower(int);
+int   isprint(int);
+int   ispunct(int);
+int   isspace(int);
+int   isupper(int);
+int   isxdigit(int);
+int   tolower(int);
+int   toupper(int);
+
+#ifndef __cplusplus
+static __inline int __isspace(int _c)
+{
+	return _c == ' ' || (unsigned)_c-'\t' < 5;
+}
+
+#define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a)|32)-'a') < 26)
+#define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a)-'0') < 10)
+#define islower(a) (0 ? islower(a) : ((unsigned)(a)-'a') < 26)
+#define isupper(a) (0 ? isupper(a) : ((unsigned)(a)-'A') < 26)
+#define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f)
+#define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e)
+#define isspace(a) __isspace(a)
+#endif
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define __NEED_locale_t
+#include <bits/alltypes.h>
+
+int   isalnum_l(int, locale_t);
+int   isalpha_l(int, locale_t);
+int   isblank_l(int, locale_t);
+int   iscntrl_l(int, locale_t);
+int   isdigit_l(int, locale_t);
+int   isgraph_l(int, locale_t);
+int   islower_l(int, locale_t);
+int   isprint_l(int, locale_t);
+int   ispunct_l(int, locale_t);
+int   isspace_l(int, locale_t);
+int   isupper_l(int, locale_t);
+int   isxdigit_l(int, locale_t);
+int   tolower_l(int, locale_t);
+int   toupper_l(int, locale_t);
+
+int   isascii(int);
+int   toascii(int);
+#define _tolower(a) ((a)|0x20)
+#define _toupper(a) ((a)&0x5f)
+#ifndef __cplusplus
+#define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128)
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/dirent.h b/musl-include/x86_64/dirent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/dirent.h
@@ -0,0 +1,75 @@
+#ifndef	_DIRENT_H
+#define	_DIRENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ino_t
+#define __NEED_off_t
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/dirent.h>
+
+typedef struct __dirstream DIR;
+
+#define d_fileno d_ino
+
+int            closedir(DIR *);
+DIR           *fdopendir(int);
+DIR           *opendir(const char *);
+struct dirent *readdir(DIR *);
+int            readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict);
+void           rewinddir(DIR *);
+int            dirfd(DIR *);
+
+int alphasort(const struct dirent **, const struct dirent **);
+int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void           seekdir(DIR *, long);
+long           telldir(DIR *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+#define IFTODT(x) ((x)>>12 & 017)
+#define DTTOIF(x) ((x)<<12)
+int getdents(int, struct dirent *, size_t);
+#endif
+
+#ifdef _GNU_SOURCE
+int versionsort(const struct dirent **, const struct dirent **);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define dirent64 dirent
+#define readdir64 readdir
+#define readdir64_r readdir_r
+#define scandir64 scandir
+#define alphasort64 alphasort
+#define versionsort64 versionsort
+#define off64_t off_t
+#define ino64_t ino_t
+#define getdents64 getdents
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/dlfcn.h b/musl-include/x86_64/dlfcn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/dlfcn.h
@@ -0,0 +1,46 @@
+#ifndef	_DLFCN_H
+#define	_DLFCN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define RTLD_LAZY   1
+#define RTLD_NOW    2
+#define RTLD_NOLOAD 4
+#define RTLD_NODELETE 4096
+#define RTLD_GLOBAL 256
+#define RTLD_LOCAL  0
+
+#define RTLD_NEXT    ((void *)-1)
+#define RTLD_DEFAULT ((void *)0)
+
+#define RTLD_DI_LINKMAP 2
+
+int    dlclose(void *);
+char  *dlerror(void);
+void  *dlopen(const char *, int);
+void  *dlsym(void *__restrict, const char *__restrict);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef struct {
+	const char *dli_fname;
+	void *dli_fbase;
+	const char *dli_sname;
+	void *dli_saddr;
+} Dl_info;
+int dladdr(const void *, Dl_info *);
+int dlinfo(void *, int, void *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(dlsym, __dlsym_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/elf.h b/musl-include/x86_64/elf.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/elf.h
@@ -0,0 +1,3414 @@
+#ifndef _ELF_H
+#define _ELF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+typedef uint16_t Elf32_Half;
+typedef uint16_t Elf64_Half;
+
+typedef uint32_t Elf32_Word;
+typedef	int32_t  Elf32_Sword;
+typedef uint32_t Elf64_Word;
+typedef	int32_t  Elf64_Sword;
+
+typedef uint64_t Elf32_Xword;
+typedef	int64_t  Elf32_Sxword;
+typedef uint64_t Elf64_Xword;
+typedef	int64_t  Elf64_Sxword;
+
+typedef uint32_t Elf32_Addr;
+typedef uint64_t Elf64_Addr;
+
+typedef uint32_t Elf32_Off;
+typedef uint64_t Elf64_Off;
+
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+
+typedef Elf32_Half Elf32_Versym;
+typedef Elf64_Half Elf64_Versym;
+
+#define EI_NIDENT (16)
+
+typedef struct {
+  unsigned char	e_ident[EI_NIDENT];
+  Elf32_Half	e_type;
+  Elf32_Half	e_machine;
+  Elf32_Word	e_version;
+  Elf32_Addr	e_entry;
+  Elf32_Off	e_phoff;
+  Elf32_Off	e_shoff;
+  Elf32_Word	e_flags;
+  Elf32_Half	e_ehsize;
+  Elf32_Half	e_phentsize;
+  Elf32_Half	e_phnum;
+  Elf32_Half	e_shentsize;
+  Elf32_Half	e_shnum;
+  Elf32_Half	e_shstrndx;
+} Elf32_Ehdr;
+
+typedef struct {
+  unsigned char	e_ident[EI_NIDENT];
+  Elf64_Half	e_type;
+  Elf64_Half	e_machine;
+  Elf64_Word	e_version;
+  Elf64_Addr	e_entry;
+  Elf64_Off	e_phoff;
+  Elf64_Off	e_shoff;
+  Elf64_Word	e_flags;
+  Elf64_Half	e_ehsize;
+  Elf64_Half	e_phentsize;
+  Elf64_Half	e_phnum;
+  Elf64_Half	e_shentsize;
+  Elf64_Half	e_shnum;
+  Elf64_Half	e_shstrndx;
+} Elf64_Ehdr;
+
+#define EI_MAG0		0
+#define ELFMAG0		0x7f
+
+#define EI_MAG1		1
+#define ELFMAG1		'E'
+
+#define EI_MAG2		2
+#define ELFMAG2		'L'
+
+#define EI_MAG3		3
+#define ELFMAG3		'F'
+
+
+#define	ELFMAG		"\177ELF"
+#define	SELFMAG		4
+
+#define EI_CLASS	4
+#define ELFCLASSNONE	0
+#define ELFCLASS32	1
+#define ELFCLASS64	2
+#define ELFCLASSNUM	3
+
+#define EI_DATA		5
+#define ELFDATANONE	0
+#define ELFDATA2LSB	1
+#define ELFDATA2MSB	2
+#define ELFDATANUM	3
+
+#define EI_VERSION	6
+
+
+#define EI_OSABI	7
+#define ELFOSABI_NONE		0
+#define ELFOSABI_SYSV		0
+#define ELFOSABI_HPUX		1
+#define ELFOSABI_NETBSD		2
+#define ELFOSABI_LINUX		3
+#define ELFOSABI_GNU		3
+#define ELFOSABI_SOLARIS	6
+#define ELFOSABI_AIX		7
+#define ELFOSABI_IRIX		8
+#define ELFOSABI_FREEBSD	9
+#define ELFOSABI_TRU64		10
+#define ELFOSABI_MODESTO	11
+#define ELFOSABI_OPENBSD	12
+#define ELFOSABI_ARM		97
+#define ELFOSABI_STANDALONE	255
+
+#define EI_ABIVERSION	8
+
+#define EI_PAD		9
+
+
+
+#define ET_NONE		0
+#define ET_REL		1
+#define ET_EXEC		2
+#define ET_DYN		3
+#define ET_CORE		4
+#define	ET_NUM		5
+#define ET_LOOS		0xfe00
+#define ET_HIOS		0xfeff
+#define ET_LOPROC	0xff00
+#define ET_HIPROC	0xffff
+
+
+
+#define EM_NONE		 0
+#define EM_M32		 1
+#define EM_SPARC	 2
+#define EM_386		 3
+#define EM_68K		 4
+#define EM_88K		 5
+#define EM_860		 7
+#define EM_MIPS		 8
+#define EM_S370		 9
+#define EM_MIPS_RS3_LE	10
+
+#define EM_PARISC	15
+#define EM_VPP500	17
+#define EM_SPARC32PLUS	18
+#define EM_960		19
+#define EM_PPC		20
+#define EM_PPC64	21
+#define EM_S390		22
+
+#define EM_V800		36
+#define EM_FR20		37
+#define EM_RH32		38
+#define EM_RCE		39
+#define EM_ARM		40
+#define EM_FAKE_ALPHA	41
+#define EM_SH		42
+#define EM_SPARCV9	43
+#define EM_TRICORE	44
+#define EM_ARC		45
+#define EM_H8_300	46
+#define EM_H8_300H	47
+#define EM_H8S		48
+#define EM_H8_500	49
+#define EM_IA_64	50
+#define EM_MIPS_X	51
+#define EM_COLDFIRE	52
+#define EM_68HC12	53
+#define EM_MMA		54
+#define EM_PCP		55
+#define EM_NCPU		56
+#define EM_NDR1		57
+#define EM_STARCORE	58
+#define EM_ME16		59
+#define EM_ST100	60
+#define EM_TINYJ	61
+#define EM_X86_64	62
+#define EM_PDSP		63
+
+#define EM_FX66		66
+#define EM_ST9PLUS	67
+#define EM_ST7		68
+#define EM_68HC16	69
+#define EM_68HC11	70
+#define EM_68HC08	71
+#define EM_68HC05	72
+#define EM_SVX		73
+#define EM_ST19		74
+#define EM_VAX		75
+#define EM_CRIS		76
+#define EM_JAVELIN	77
+#define EM_FIREPATH	78
+#define EM_ZSP		79
+#define EM_MMIX		80
+#define EM_HUANY	81
+#define EM_PRISM	82
+#define EM_AVR		83
+#define EM_FR30		84
+#define EM_D10V		85
+#define EM_D30V		86
+#define EM_V850		87
+#define EM_M32R		88
+#define EM_MN10300	89
+#define EM_MN10200	90
+#define EM_PJ		91
+#define EM_OR1K		92
+#define EM_OPENRISC	92
+#define EM_ARC_A5	93
+#define EM_ARC_COMPACT	93
+#define EM_XTENSA	94
+#define EM_VIDEOCORE	95
+#define EM_TMM_GPP	96
+#define EM_NS32K	97
+#define EM_TPC		98
+#define EM_SNP1K	99
+#define EM_ST200	100
+#define EM_IP2K		101
+#define EM_MAX		102
+#define EM_CR		103
+#define EM_F2MC16	104
+#define EM_MSP430	105
+#define EM_BLACKFIN	106
+#define EM_SE_C33	107
+#define EM_SEP		108
+#define EM_ARCA		109
+#define EM_UNICORE	110
+#define EM_EXCESS	111
+#define EM_DXP		112
+#define EM_ALTERA_NIOS2 113
+#define EM_CRX		114
+#define EM_XGATE	115
+#define EM_C166		116
+#define EM_M16C		117
+#define EM_DSPIC30F	118
+#define EM_CE		119
+#define EM_M32C		120
+#define EM_TSK3000	131
+#define EM_RS08		132
+#define EM_SHARC	133
+#define EM_ECOG2	134
+#define EM_SCORE7	135
+#define EM_DSP24	136
+#define EM_VIDEOCORE3	137
+#define EM_LATTICEMICO32 138
+#define EM_SE_C17	139
+#define EM_TI_C6000	140
+#define EM_TI_C2000	141
+#define EM_TI_C5500	142
+#define EM_TI_ARP32	143
+#define EM_TI_PRU	144
+#define EM_MMDSP_PLUS	160
+#define EM_CYPRESS_M8C	161
+#define EM_R32C		162
+#define EM_TRIMEDIA	163
+#define EM_QDSP6	164
+#define EM_8051		165
+#define EM_STXP7X	166
+#define EM_NDS32	167
+#define EM_ECOG1X	168
+#define EM_MAXQ30	169
+#define EM_XIMO16	170
+#define EM_MANIK	171
+#define EM_CRAYNV2	172
+#define EM_RX		173
+#define EM_METAG	174
+#define EM_MCST_ELBRUS	175
+#define EM_ECOG16	176
+#define EM_CR16		177
+#define EM_ETPU		178
+#define EM_SLE9X	179
+#define EM_L10M		180
+#define EM_K10M		181
+#define EM_AARCH64	183
+#define EM_AVR32	185
+#define EM_STM8		186
+#define EM_TILE64	187
+#define EM_TILEPRO	188
+#define EM_MICROBLAZE	189
+#define EM_CUDA		190
+#define EM_TILEGX	191
+#define EM_CLOUDSHIELD	192
+#define EM_COREA_1ST	193
+#define EM_COREA_2ND	194
+#define EM_ARC_COMPACT2	195
+#define EM_OPEN8	196
+#define EM_RL78		197
+#define EM_VIDEOCORE5	198
+#define EM_78KOR	199
+#define EM_56800EX	200
+#define EM_BA1		201
+#define EM_BA2		202
+#define EM_XCORE	203
+#define EM_MCHP_PIC	204
+#define EM_KM32		210
+#define EM_KMX32	211
+#define EM_EMX16	212
+#define EM_EMX8		213
+#define EM_KVARC	214
+#define EM_CDP		215
+#define EM_COGE		216
+#define EM_COOL		217
+#define EM_NORC		218
+#define EM_CSR_KALIMBA	219
+#define EM_Z80		220
+#define EM_VISIUM	221
+#define EM_FT32		222
+#define EM_MOXIE	223
+#define EM_AMDGPU	224
+#define EM_RISCV	243
+#define EM_BPF		247
+#define EM_CSKY		252
+#define EM_LOONGARCH	258
+#define EM_NUM		259
+
+#define EM_ALPHA	0x9026
+
+#define EV_NONE		0
+#define EV_CURRENT	1
+#define EV_NUM		2
+
+typedef struct {
+  Elf32_Word	sh_name;
+  Elf32_Word	sh_type;
+  Elf32_Word	sh_flags;
+  Elf32_Addr	sh_addr;
+  Elf32_Off	sh_offset;
+  Elf32_Word	sh_size;
+  Elf32_Word	sh_link;
+  Elf32_Word	sh_info;
+  Elf32_Word	sh_addralign;
+  Elf32_Word	sh_entsize;
+} Elf32_Shdr;
+
+typedef struct {
+  Elf64_Word	sh_name;
+  Elf64_Word	sh_type;
+  Elf64_Xword	sh_flags;
+  Elf64_Addr	sh_addr;
+  Elf64_Off	sh_offset;
+  Elf64_Xword	sh_size;
+  Elf64_Word	sh_link;
+  Elf64_Word	sh_info;
+  Elf64_Xword	sh_addralign;
+  Elf64_Xword	sh_entsize;
+} Elf64_Shdr;
+
+
+
+#define SHN_UNDEF	0
+#define SHN_LORESERVE	0xff00
+#define SHN_LOPROC	0xff00
+#define SHN_BEFORE	0xff00
+
+#define SHN_AFTER	0xff01
+
+#define SHN_HIPROC	0xff1f
+#define SHN_LOOS	0xff20
+#define SHN_HIOS	0xff3f
+#define SHN_ABS		0xfff1
+#define SHN_COMMON	0xfff2
+#define SHN_XINDEX	0xffff
+#define SHN_HIRESERVE	0xffff
+
+
+
+#define SHT_NULL	  0
+#define SHT_PROGBITS	  1
+#define SHT_SYMTAB	  2
+#define SHT_STRTAB	  3
+#define SHT_RELA	  4
+#define SHT_HASH	  5
+#define SHT_DYNAMIC	  6
+#define SHT_NOTE	  7
+#define SHT_NOBITS	  8
+#define SHT_REL		  9
+#define SHT_SHLIB	  10
+#define SHT_DYNSYM	  11
+#define SHT_INIT_ARRAY	  14
+#define SHT_FINI_ARRAY	  15
+#define SHT_PREINIT_ARRAY 16
+#define SHT_GROUP	  17
+#define SHT_SYMTAB_SHNDX  18
+#define SHT_RELR	  19
+#define	SHT_NUM		  20
+#define SHT_LOOS	  0x60000000
+#define SHT_GNU_ATTRIBUTES 0x6ffffff5
+#define SHT_GNU_HASH	  0x6ffffff6
+#define SHT_GNU_LIBLIST	  0x6ffffff7
+#define SHT_CHECKSUM	  0x6ffffff8
+#define SHT_LOSUNW	  0x6ffffffa
+#define SHT_SUNW_move	  0x6ffffffa
+#define SHT_SUNW_COMDAT   0x6ffffffb
+#define SHT_SUNW_syminfo  0x6ffffffc
+#define SHT_GNU_verdef	  0x6ffffffd
+#define SHT_GNU_verneed	  0x6ffffffe
+#define SHT_GNU_versym	  0x6fffffff
+#define SHT_HISUNW	  0x6fffffff
+#define SHT_HIOS	  0x6fffffff
+#define SHT_LOPROC	  0x70000000
+#define SHT_HIPROC	  0x7fffffff
+#define SHT_LOUSER	  0x80000000
+#define SHT_HIUSER	  0x8fffffff
+
+#define SHF_WRITE	     (1 << 0)
+#define SHF_ALLOC	     (1 << 1)
+#define SHF_EXECINSTR	     (1 << 2)
+#define SHF_MERGE	     (1 << 4)
+#define SHF_STRINGS	     (1 << 5)
+#define SHF_INFO_LINK	     (1 << 6)
+#define SHF_LINK_ORDER	     (1 << 7)
+#define SHF_OS_NONCONFORMING (1 << 8)
+
+#define SHF_GROUP	     (1 << 9)
+#define SHF_TLS		     (1 << 10)
+#define SHF_COMPRESSED	     (1 << 11)
+#define SHF_MASKOS	     0x0ff00000
+#define SHF_MASKPROC	     0xf0000000
+#define SHF_ORDERED	     (1 << 30)
+#define SHF_EXCLUDE	     (1U << 31)
+
+typedef struct {
+  Elf32_Word	ch_type;
+  Elf32_Word	ch_size;
+  Elf32_Word	ch_addralign;
+} Elf32_Chdr;
+
+typedef struct {
+  Elf64_Word	ch_type;
+  Elf64_Word	ch_reserved;
+  Elf64_Xword	ch_size;
+  Elf64_Xword	ch_addralign;
+} Elf64_Chdr;
+
+#define ELFCOMPRESS_ZLIB	1
+#define ELFCOMPRESS_ZSTD	2
+#define ELFCOMPRESS_LOOS	0x60000000
+#define ELFCOMPRESS_HIOS	0x6fffffff
+#define ELFCOMPRESS_LOPROC	0x70000000
+#define ELFCOMPRESS_HIPROC	0x7fffffff
+
+
+#define GRP_COMDAT	0x1
+
+typedef struct {
+  Elf32_Word	st_name;
+  Elf32_Addr	st_value;
+  Elf32_Word	st_size;
+  unsigned char	st_info;
+  unsigned char	st_other;
+  Elf32_Section	st_shndx;
+} Elf32_Sym;
+
+typedef struct {
+  Elf64_Word	st_name;
+  unsigned char	st_info;
+  unsigned char st_other;
+  Elf64_Section	st_shndx;
+  Elf64_Addr	st_value;
+  Elf64_Xword	st_size;
+} Elf64_Sym;
+
+typedef struct {
+  Elf32_Half si_boundto;
+  Elf32_Half si_flags;
+} Elf32_Syminfo;
+
+typedef struct {
+  Elf64_Half si_boundto;
+  Elf64_Half si_flags;
+} Elf64_Syminfo;
+
+#define SYMINFO_BT_SELF		0xffff
+#define SYMINFO_BT_PARENT	0xfffe
+#define SYMINFO_BT_LOWRESERVE	0xff00
+
+#define SYMINFO_FLG_DIRECT	0x0001
+#define SYMINFO_FLG_PASSTHRU	0x0002
+#define SYMINFO_FLG_COPY	0x0004
+#define SYMINFO_FLG_LAZYLOAD	0x0008
+
+#define SYMINFO_NONE		0
+#define SYMINFO_CURRENT		1
+#define SYMINFO_NUM		2
+
+#define ELF32_ST_BIND(val)		(((unsigned char) (val)) >> 4)
+#define ELF32_ST_TYPE(val)		((val) & 0xf)
+#define ELF32_ST_INFO(bind, type)	(((bind) << 4) + ((type) & 0xf))
+
+#define ELF64_ST_BIND(val)		ELF32_ST_BIND (val)
+#define ELF64_ST_TYPE(val)		ELF32_ST_TYPE (val)
+#define ELF64_ST_INFO(bind, type)	ELF32_ST_INFO ((bind), (type))
+
+#define STB_LOCAL	0
+#define STB_GLOBAL	1
+#define STB_WEAK	2
+#define	STB_NUM		3
+#define STB_LOOS	10
+#define STB_GNU_UNIQUE	10
+#define STB_HIOS	12
+#define STB_LOPROC	13
+#define STB_HIPROC	15
+
+#define STT_NOTYPE	0
+#define STT_OBJECT	1
+#define STT_FUNC	2
+#define STT_SECTION	3
+#define STT_FILE	4
+#define STT_COMMON	5
+#define STT_TLS		6
+#define	STT_NUM		7
+#define STT_LOOS	10
+#define STT_GNU_IFUNC	10
+#define STT_HIOS	12
+#define STT_LOPROC	13
+#define STT_HIPROC	15
+
+#define STN_UNDEF	0
+
+#define ELF32_ST_VISIBILITY(o)	((o) & 0x03)
+#define ELF64_ST_VISIBILITY(o)	ELF32_ST_VISIBILITY (o)
+
+#define STV_DEFAULT	0
+#define STV_INTERNAL	1
+#define STV_HIDDEN	2
+#define STV_PROTECTED	3
+
+
+
+
+typedef struct {
+  Elf32_Addr	r_offset;
+  Elf32_Word	r_info;
+} Elf32_Rel;
+
+typedef struct {
+  Elf64_Addr	r_offset;
+  Elf64_Xword	r_info;
+} Elf64_Rel;
+
+
+
+typedef struct {
+  Elf32_Addr	r_offset;
+  Elf32_Word	r_info;
+  Elf32_Sword	r_addend;
+} Elf32_Rela;
+
+typedef struct {
+  Elf64_Addr	r_offset;
+  Elf64_Xword	r_info;
+  Elf64_Sxword	r_addend;
+} Elf64_Rela;
+
+
+
+typedef Elf32_Word Elf32_Relr;
+typedef Elf64_Xword Elf64_Relr;
+
+
+
+#define ELF32_R_SYM(val)		((val) >> 8)
+#define ELF32_R_TYPE(val)		((val) & 0xff)
+#define ELF32_R_INFO(sym, type)		(((sym) << 8) + ((type) & 0xff))
+
+#define ELF64_R_SYM(i)			((i) >> 32)
+#define ELF64_R_TYPE(i)			((i) & 0xffffffff)
+#define ELF64_R_INFO(sym,type)		((((Elf64_Xword) (sym)) << 32) + (type))
+
+
+
+typedef struct {
+  Elf32_Word	p_type;
+  Elf32_Off	p_offset;
+  Elf32_Addr	p_vaddr;
+  Elf32_Addr	p_paddr;
+  Elf32_Word	p_filesz;
+  Elf32_Word	p_memsz;
+  Elf32_Word	p_flags;
+  Elf32_Word	p_align;
+} Elf32_Phdr;
+
+typedef struct {
+  Elf64_Word	p_type;
+  Elf64_Word	p_flags;
+  Elf64_Off	p_offset;
+  Elf64_Addr	p_vaddr;
+  Elf64_Addr	p_paddr;
+  Elf64_Xword	p_filesz;
+  Elf64_Xword	p_memsz;
+  Elf64_Xword	p_align;
+} Elf64_Phdr;
+
+
+
+#define	PT_NULL		0
+#define PT_LOAD		1
+#define PT_DYNAMIC	2
+#define PT_INTERP	3
+#define PT_NOTE		4
+#define PT_SHLIB	5
+#define PT_PHDR		6
+#define PT_TLS		7
+#define	PT_NUM		8
+#define PT_LOOS		0x60000000
+#define PT_GNU_EH_FRAME	0x6474e550
+#define PT_GNU_STACK	0x6474e551
+#define PT_GNU_RELRO	0x6474e552
+#define PT_GNU_PROPERTY	0x6474e553
+#define PT_LOSUNW	0x6ffffffa
+#define PT_SUNWBSS	0x6ffffffa
+#define PT_SUNWSTACK	0x6ffffffb
+#define PT_HISUNW	0x6fffffff
+#define PT_HIOS		0x6fffffff
+#define PT_LOPROC	0x70000000
+#define PT_HIPROC	0x7fffffff
+
+
+#define PN_XNUM 0xffff
+
+
+#define PF_X		(1 << 0)
+#define PF_W		(1 << 1)
+#define PF_R		(1 << 2)
+#define PF_MASKOS	0x0ff00000
+#define PF_MASKPROC	0xf0000000
+
+
+
+#define NT_PRSTATUS	1
+#define NT_PRFPREG	2
+#define NT_FPREGSET	2
+#define NT_PRPSINFO	3
+#define NT_PRXREG	4
+#define NT_TASKSTRUCT	4
+#define NT_PLATFORM	5
+#define NT_AUXV		6
+#define NT_GWINDOWS	7
+#define NT_ASRS		8
+#define NT_PSTATUS	10
+#define NT_PSINFO	13
+#define NT_PRCRED	14
+#define NT_UTSNAME	15
+#define NT_LWPSTATUS	16
+#define NT_LWPSINFO	17
+#define NT_PRFPXREG	20
+#define NT_SIGINFO	0x53494749
+#define NT_FILE		0x46494c45
+#define NT_PRXFPREG	0x46e62b7f
+#define NT_PPC_VMX	0x100
+#define NT_PPC_SPE	0x101
+#define NT_PPC_VSX	0x102
+#define NT_PPC_TAR	0x103
+#define NT_PPC_PPR	0x104
+#define NT_PPC_DSCR	0x105
+#define NT_PPC_EBB	0x106
+#define NT_PPC_PMU	0x107
+#define NT_PPC_TM_CGPR	0x108
+#define NT_PPC_TM_CFPR	0x109
+#define NT_PPC_TM_CVMX	0x10a
+#define NT_PPC_TM_CVSX	0x10b
+#define NT_PPC_TM_SPR	0x10c
+#define NT_PPC_TM_CTAR	0x10d
+#define NT_PPC_TM_CPPR	0x10e
+#define NT_PPC_TM_CDSCR	0x10f
+#define NT_386_TLS	0x200
+#define NT_386_IOPERM	0x201
+#define NT_X86_XSTATE	0x202
+#define NT_S390_HIGH_GPRS	0x300
+#define NT_S390_TIMER	0x301
+#define NT_S390_TODCMP	0x302
+#define NT_S390_TODPREG	0x303
+#define NT_S390_CTRS	0x304
+#define NT_S390_PREFIX	0x305
+#define NT_S390_LAST_BREAK	0x306
+#define NT_S390_SYSTEM_CALL	0x307
+#define NT_S390_TDB	0x308
+#define NT_S390_VXRS_LOW	0x309
+#define NT_S390_VXRS_HIGH	0x30a
+#define NT_S390_GS_CB	0x30b
+#define NT_S390_GS_BC	0x30c
+#define NT_S390_RI_CB	0x30d
+#define NT_ARM_VFP	0x400
+#define NT_ARM_TLS	0x401
+#define NT_ARM_HW_BREAK	0x402
+#define NT_ARM_HW_WATCH	0x403
+#define NT_ARM_SYSTEM_CALL	0x404
+#define NT_ARM_SVE	0x405
+#define NT_ARM_PAC_MASK	0x406
+#define NT_ARM_PACA_KEYS	0x407
+#define NT_ARM_PACG_KEYS	0x408
+#define NT_ARM_TAGGED_ADDR_CTRL	0x409
+#define NT_ARM_PAC_ENABLED_KEYS	0x40a
+#define NT_METAG_CBUF	0x500
+#define NT_METAG_RPIPE	0x501
+#define NT_METAG_TLS	0x502
+#define NT_ARC_V2	0x600
+#define NT_VMCOREDD	0x700
+#define NT_MIPS_DSP	0x800
+#define NT_MIPS_FP_MODE	0x801
+#define NT_MIPS_MSA	0x802
+#define NT_RISCV_CSR	0x900
+#define NT_RISCV_VECTOR	0x901
+#define NT_VERSION	1
+#define NT_LOONGARCH_CPUCFG	0xa00
+#define NT_LOONGARCH_CSR	0xa01
+#define NT_LOONGARCH_LSX	0xa02
+#define NT_LOONGARCH_LASX	0xa03
+#define NT_LOONGARCH_LBT	0xa04
+
+
+
+
+typedef struct {
+  Elf32_Sword d_tag;
+  union {
+      Elf32_Word d_val;
+      Elf32_Addr d_ptr;
+  } d_un;
+} Elf32_Dyn;
+
+typedef struct {
+  Elf64_Sxword d_tag;
+  union {
+      Elf64_Xword d_val;
+      Elf64_Addr d_ptr;
+  } d_un;
+} Elf64_Dyn;
+
+
+
+#define DT_NULL		0
+#define DT_NEEDED	1
+#define DT_PLTRELSZ	2
+#define DT_PLTGOT	3
+#define DT_HASH		4
+#define DT_STRTAB	5
+#define DT_SYMTAB	6
+#define DT_RELA		7
+#define DT_RELASZ	8
+#define DT_RELAENT	9
+#define DT_STRSZ	10
+#define DT_SYMENT	11
+#define DT_INIT		12
+#define DT_FINI		13
+#define DT_SONAME	14
+#define DT_RPATH	15
+#define DT_SYMBOLIC	16
+#define DT_REL		17
+#define DT_RELSZ	18
+#define DT_RELENT	19
+#define DT_PLTREL	20
+#define DT_DEBUG	21
+#define DT_TEXTREL	22
+#define DT_JMPREL	23
+#define	DT_BIND_NOW	24
+#define	DT_INIT_ARRAY	25
+#define	DT_FINI_ARRAY	26
+#define	DT_INIT_ARRAYSZ	27
+#define	DT_FINI_ARRAYSZ	28
+#define DT_RUNPATH	29
+#define DT_FLAGS	30
+#define DT_ENCODING	32
+#define DT_PREINIT_ARRAY 32
+#define DT_PREINIT_ARRAYSZ 33
+#define DT_SYMTAB_SHNDX	34
+#define DT_RELRSZ	35
+#define DT_RELR		36
+#define DT_RELRENT	37
+#define	DT_NUM		38
+#define DT_LOOS		0x6000000d
+#define DT_HIOS		0x6ffff000
+#define DT_LOPROC	0x70000000
+#define DT_HIPROC	0x7fffffff
+#define	DT_PROCNUM	DT_MIPS_NUM
+
+#define DT_VALRNGLO	0x6ffffd00
+#define DT_GNU_PRELINKED 0x6ffffdf5
+#define DT_GNU_CONFLICTSZ 0x6ffffdf6
+#define DT_GNU_LIBLISTSZ 0x6ffffdf7
+#define DT_CHECKSUM	0x6ffffdf8
+#define DT_PLTPADSZ	0x6ffffdf9
+#define DT_MOVEENT	0x6ffffdfa
+#define DT_MOVESZ	0x6ffffdfb
+#define DT_FEATURE_1	0x6ffffdfc
+#define DT_POSFLAG_1	0x6ffffdfd
+
+#define DT_SYMINSZ	0x6ffffdfe
+#define DT_SYMINENT	0x6ffffdff
+#define DT_VALRNGHI	0x6ffffdff
+#define DT_VALTAGIDX(tag)	(DT_VALRNGHI - (tag))
+#define DT_VALNUM 12
+
+#define DT_ADDRRNGLO	0x6ffffe00
+#define DT_GNU_HASH	0x6ffffef5
+#define DT_TLSDESC_PLT	0x6ffffef6
+#define DT_TLSDESC_GOT	0x6ffffef7
+#define DT_GNU_CONFLICT	0x6ffffef8
+#define DT_GNU_LIBLIST	0x6ffffef9
+#define DT_CONFIG	0x6ffffefa
+#define DT_DEPAUDIT	0x6ffffefb
+#define DT_AUDIT	0x6ffffefc
+#define	DT_PLTPAD	0x6ffffefd
+#define	DT_MOVETAB	0x6ffffefe
+#define DT_SYMINFO	0x6ffffeff
+#define DT_ADDRRNGHI	0x6ffffeff
+#define DT_ADDRTAGIDX(tag)	(DT_ADDRRNGHI - (tag))
+#define DT_ADDRNUM 11
+
+
+
+#define DT_VERSYM	0x6ffffff0
+
+#define DT_RELACOUNT	0x6ffffff9
+#define DT_RELCOUNT	0x6ffffffa
+
+
+#define DT_FLAGS_1	0x6ffffffb
+#define	DT_VERDEF	0x6ffffffc
+
+#define	DT_VERDEFNUM	0x6ffffffd
+#define	DT_VERNEED	0x6ffffffe
+
+#define	DT_VERNEEDNUM	0x6fffffff
+#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))
+#define DT_VERSIONTAGNUM 16
+
+
+
+#define DT_AUXILIARY    0x7ffffffd
+#define DT_FILTER       0x7fffffff
+#define DT_EXTRATAGIDX(tag)	((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
+#define DT_EXTRANUM	3
+
+
+#define DF_ORIGIN	0x00000001
+#define DF_SYMBOLIC	0x00000002
+#define DF_TEXTREL	0x00000004
+#define DF_BIND_NOW	0x00000008
+#define DF_STATIC_TLS	0x00000010
+
+
+
+#define DF_1_NOW	0x00000001
+#define DF_1_GLOBAL	0x00000002
+#define DF_1_GROUP	0x00000004
+#define DF_1_NODELETE	0x00000008
+#define DF_1_LOADFLTR	0x00000010
+#define DF_1_INITFIRST	0x00000020
+#define DF_1_NOOPEN	0x00000040
+#define DF_1_ORIGIN	0x00000080
+#define DF_1_DIRECT	0x00000100
+#define DF_1_TRANS	0x00000200
+#define DF_1_INTERPOSE	0x00000400
+#define DF_1_NODEFLIB	0x00000800
+#define DF_1_NODUMP	0x00001000
+#define DF_1_CONFALT	0x00002000
+#define DF_1_ENDFILTEE	0x00004000
+#define	DF_1_DISPRELDNE	0x00008000
+#define	DF_1_DISPRELPND	0x00010000
+#define	DF_1_NODIRECT	0x00020000
+#define	DF_1_IGNMULDEF	0x00040000
+#define	DF_1_NOKSYMS	0x00080000
+#define	DF_1_NOHDR	0x00100000
+#define	DF_1_EDITED	0x00200000
+#define	DF_1_NORELOC	0x00400000
+#define	DF_1_SYMINTPOSE	0x00800000
+#define	DF_1_GLOBAUDIT	0x01000000
+#define	DF_1_SINGLETON	0x02000000
+#define	DF_1_STUB	0x04000000
+#define	DF_1_PIE	0x08000000
+
+#define DTF_1_PARINIT	0x00000001
+#define DTF_1_CONFEXP	0x00000002
+
+
+#define DF_P1_LAZYLOAD	0x00000001
+#define DF_P1_GROUPPERM	0x00000002
+
+
+
+
+typedef struct {
+  Elf32_Half	vd_version;
+  Elf32_Half	vd_flags;
+  Elf32_Half	vd_ndx;
+  Elf32_Half	vd_cnt;
+  Elf32_Word	vd_hash;
+  Elf32_Word	vd_aux;
+  Elf32_Word	vd_next;
+} Elf32_Verdef;
+
+typedef struct {
+  Elf64_Half	vd_version;
+  Elf64_Half	vd_flags;
+  Elf64_Half	vd_ndx;
+  Elf64_Half	vd_cnt;
+  Elf64_Word	vd_hash;
+  Elf64_Word	vd_aux;
+  Elf64_Word	vd_next;
+} Elf64_Verdef;
+
+
+
+#define VER_DEF_NONE	0
+#define VER_DEF_CURRENT	1
+#define VER_DEF_NUM	2
+
+
+#define VER_FLG_BASE	0x1
+#define VER_FLG_WEAK	0x2
+
+
+#define	VER_NDX_LOCAL		0
+#define	VER_NDX_GLOBAL		1
+#define	VER_NDX_LORESERVE	0xff00
+#define	VER_NDX_ELIMINATE	0xff01
+
+
+
+typedef struct {
+  Elf32_Word	vda_name;
+  Elf32_Word	vda_next;
+} Elf32_Verdaux;
+
+typedef struct {
+  Elf64_Word	vda_name;
+  Elf64_Word	vda_next;
+} Elf64_Verdaux;
+
+
+
+
+typedef struct {
+  Elf32_Half	vn_version;
+  Elf32_Half	vn_cnt;
+  Elf32_Word	vn_file;
+  Elf32_Word	vn_aux;
+  Elf32_Word	vn_next;
+} Elf32_Verneed;
+
+typedef struct {
+  Elf64_Half	vn_version;
+  Elf64_Half	vn_cnt;
+  Elf64_Word	vn_file;
+  Elf64_Word	vn_aux;
+  Elf64_Word	vn_next;
+} Elf64_Verneed;
+
+
+
+#define VER_NEED_NONE	 0
+#define VER_NEED_CURRENT 1
+#define VER_NEED_NUM	 2
+
+
+
+typedef struct {
+  Elf32_Word	vna_hash;
+  Elf32_Half	vna_flags;
+  Elf32_Half	vna_other;
+  Elf32_Word	vna_name;
+  Elf32_Word	vna_next;
+} Elf32_Vernaux;
+
+typedef struct {
+  Elf64_Word	vna_hash;
+  Elf64_Half	vna_flags;
+  Elf64_Half	vna_other;
+  Elf64_Word	vna_name;
+  Elf64_Word	vna_next;
+} Elf64_Vernaux;
+
+
+
+#define VER_FLG_WEAK	0x2
+
+
+
+typedef struct {
+  uint32_t a_type;
+  union {
+      uint32_t a_val;
+  } a_un;
+} Elf32_auxv_t;
+
+typedef struct {
+  uint64_t a_type;
+  union {
+      uint64_t a_val;
+  } a_un;
+} Elf64_auxv_t;
+
+
+
+#define AT_NULL		0
+#define AT_IGNORE	1
+#define AT_EXECFD	2
+#define AT_PHDR		3
+#define AT_PHENT	4
+#define AT_PHNUM	5
+#define AT_PAGESZ	6
+#define AT_BASE		7
+#define AT_FLAGS	8
+#define AT_ENTRY	9
+#define AT_NOTELF	10
+#define AT_UID		11
+#define AT_EUID		12
+#define AT_GID		13
+#define AT_EGID		14
+#define AT_CLKTCK	17
+
+
+#define AT_PLATFORM	15
+#define AT_HWCAP	16
+
+
+
+
+#define AT_FPUCW	18
+
+
+#define AT_DCACHEBSIZE	19
+#define AT_ICACHEBSIZE	20
+#define AT_UCACHEBSIZE	21
+
+
+
+#define AT_IGNOREPPC	22
+
+#define	AT_SECURE	23
+
+#define AT_BASE_PLATFORM 24
+
+#define AT_RANDOM	25
+
+#define AT_HWCAP2	26
+
+#define AT_EXECFN	31
+
+
+
+#define AT_SYSINFO	32
+#define AT_SYSINFO_EHDR	33
+
+
+
+#define AT_L1I_CACHESHAPE	34
+#define AT_L1D_CACHESHAPE	35
+#define AT_L2_CACHESHAPE	36
+#define AT_L3_CACHESHAPE	37
+
+#define AT_L1I_CACHESIZE	40
+#define AT_L1I_CACHEGEOMETRY	41
+#define AT_L1D_CACHESIZE	42
+#define AT_L1D_CACHEGEOMETRY	43
+#define AT_L2_CACHESIZE		44
+#define AT_L2_CACHEGEOMETRY	45
+#define AT_L3_CACHESIZE		46
+#define AT_L3_CACHEGEOMETRY	47
+
+#define AT_MINSIGSTKSZ		51
+
+
+typedef struct {
+  Elf32_Word n_namesz;
+  Elf32_Word n_descsz;
+  Elf32_Word n_type;
+} Elf32_Nhdr;
+
+typedef struct {
+  Elf64_Word n_namesz;
+  Elf64_Word n_descsz;
+  Elf64_Word n_type;
+} Elf64_Nhdr;
+
+
+
+
+#define ELF_NOTE_SOLARIS	"SUNW Solaris"
+
+
+#define ELF_NOTE_GNU		"GNU"
+
+
+
+
+
+#define ELF_NOTE_PAGESIZE_HINT	1
+
+
+#define NT_GNU_ABI_TAG	1
+#define ELF_NOTE_ABI	NT_GNU_ABI_TAG
+
+
+
+#define ELF_NOTE_OS_LINUX	0
+#define ELF_NOTE_OS_GNU		1
+#define ELF_NOTE_OS_SOLARIS2	2
+#define ELF_NOTE_OS_FREEBSD	3
+
+#define NT_GNU_BUILD_ID	3
+#define NT_GNU_GOLD_VERSION	4
+#define NT_GNU_PROPERTY_TYPE_0	5
+
+
+
+typedef struct {
+  Elf32_Xword m_value;
+  Elf32_Word m_info;
+  Elf32_Word m_poffset;
+  Elf32_Half m_repeat;
+  Elf32_Half m_stride;
+} Elf32_Move;
+
+typedef struct {
+  Elf64_Xword m_value;
+  Elf64_Xword m_info;
+  Elf64_Xword m_poffset;
+  Elf64_Half m_repeat;
+  Elf64_Half m_stride;
+} Elf64_Move;
+
+
+#define ELF32_M_SYM(info)	((info) >> 8)
+#define ELF32_M_SIZE(info)	((unsigned char) (info))
+#define ELF32_M_INFO(sym, size)	(((sym) << 8) + (unsigned char) (size))
+
+#define ELF64_M_SYM(info)	ELF32_M_SYM (info)
+#define ELF64_M_SIZE(info)	ELF32_M_SIZE (info)
+#define ELF64_M_INFO(sym, size)	ELF32_M_INFO (sym, size)
+
+#define EF_CPU32	0x00810000
+
+#define R_68K_NONE	0
+#define R_68K_32	1
+#define R_68K_16	2
+#define R_68K_8		3
+#define R_68K_PC32	4
+#define R_68K_PC16	5
+#define R_68K_PC8	6
+#define R_68K_GOT32	7
+#define R_68K_GOT16	8
+#define R_68K_GOT8	9
+#define R_68K_GOT32O	10
+#define R_68K_GOT16O	11
+#define R_68K_GOT8O	12
+#define R_68K_PLT32	13
+#define R_68K_PLT16	14
+#define R_68K_PLT8	15
+#define R_68K_PLT32O	16
+#define R_68K_PLT16O	17
+#define R_68K_PLT8O	18
+#define R_68K_COPY	19
+#define R_68K_GLOB_DAT	20
+#define R_68K_JMP_SLOT	21
+#define R_68K_RELATIVE	22
+#define R_68K_TLS_GD32	25
+#define R_68K_TLS_GD16	26
+#define R_68K_TLS_GD8	27
+#define R_68K_TLS_LDM32	28
+#define R_68K_TLS_LDM16	29
+#define R_68K_TLS_LDM8	30
+#define R_68K_TLS_LDO32	31
+#define R_68K_TLS_LDO16	32
+#define R_68K_TLS_LDO8	33
+#define R_68K_TLS_IE32	34
+#define R_68K_TLS_IE16	35
+#define R_68K_TLS_IE8	36
+#define R_68K_TLS_LE32	37
+#define R_68K_TLS_LE16	38
+#define R_68K_TLS_LE8	39
+#define R_68K_TLS_DTPMOD32	40
+#define R_68K_TLS_DTPREL32	41
+#define R_68K_TLS_TPREL32	42
+#define R_68K_NUM	43
+
+#define R_386_NONE	   0
+#define R_386_32	   1
+#define R_386_PC32	   2
+#define R_386_GOT32	   3
+#define R_386_PLT32	   4
+#define R_386_COPY	   5
+#define R_386_GLOB_DAT	   6
+#define R_386_JMP_SLOT	   7
+#define R_386_RELATIVE	   8
+#define R_386_GOTOFF	   9
+#define R_386_GOTPC	   10
+#define R_386_32PLT	   11
+#define R_386_TLS_TPOFF	   14
+#define R_386_TLS_IE	   15
+#define R_386_TLS_GOTIE	   16
+#define R_386_TLS_LE	   17
+#define R_386_TLS_GD	   18
+#define R_386_TLS_LDM	   19
+#define R_386_16	   20
+#define R_386_PC16	   21
+#define R_386_8		   22
+#define R_386_PC8	   23
+#define R_386_TLS_GD_32	   24
+#define R_386_TLS_GD_PUSH  25
+#define R_386_TLS_GD_CALL  26
+#define R_386_TLS_GD_POP   27
+#define R_386_TLS_LDM_32   28
+#define R_386_TLS_LDM_PUSH 29
+#define R_386_TLS_LDM_CALL 30
+#define R_386_TLS_LDM_POP  31
+#define R_386_TLS_LDO_32   32
+#define R_386_TLS_IE_32	   33
+#define R_386_TLS_LE_32	   34
+#define R_386_TLS_DTPMOD32 35
+#define R_386_TLS_DTPOFF32 36
+#define R_386_TLS_TPOFF32  37
+#define R_386_SIZE32       38
+#define R_386_TLS_GOTDESC  39
+#define R_386_TLS_DESC_CALL 40
+#define R_386_TLS_DESC     41
+#define R_386_IRELATIVE	   42
+#define R_386_GOT32X	   43
+#define R_386_NUM	   44
+
+
+
+
+
+#define STT_SPARC_REGISTER	13
+
+
+
+#define EF_SPARCV9_MM		3
+#define EF_SPARCV9_TSO		0
+#define EF_SPARCV9_PSO		1
+#define EF_SPARCV9_RMO		2
+#define EF_SPARC_LEDATA		0x800000
+#define EF_SPARC_EXT_MASK	0xFFFF00
+#define EF_SPARC_32PLUS		0x000100
+#define EF_SPARC_SUN_US1	0x000200
+#define EF_SPARC_HAL_R1		0x000400
+#define EF_SPARC_SUN_US3	0x000800
+
+
+
+#define R_SPARC_NONE		0
+#define R_SPARC_8		1
+#define R_SPARC_16		2
+#define R_SPARC_32		3
+#define R_SPARC_DISP8		4
+#define R_SPARC_DISP16		5
+#define R_SPARC_DISP32		6
+#define R_SPARC_WDISP30		7
+#define R_SPARC_WDISP22		8
+#define R_SPARC_HI22		9
+#define R_SPARC_22		10
+#define R_SPARC_13		11
+#define R_SPARC_LO10		12
+#define R_SPARC_GOT10		13
+#define R_SPARC_GOT13		14
+#define R_SPARC_GOT22		15
+#define R_SPARC_PC10		16
+#define R_SPARC_PC22		17
+#define R_SPARC_WPLT30		18
+#define R_SPARC_COPY		19
+#define R_SPARC_GLOB_DAT	20
+#define R_SPARC_JMP_SLOT	21
+#define R_SPARC_RELATIVE	22
+#define R_SPARC_UA32		23
+
+
+
+#define R_SPARC_PLT32		24
+#define R_SPARC_HIPLT22		25
+#define R_SPARC_LOPLT10		26
+#define R_SPARC_PCPLT32		27
+#define R_SPARC_PCPLT22		28
+#define R_SPARC_PCPLT10		29
+#define R_SPARC_10		30
+#define R_SPARC_11		31
+#define R_SPARC_64		32
+#define R_SPARC_OLO10		33
+#define R_SPARC_HH22		34
+#define R_SPARC_HM10		35
+#define R_SPARC_LM22		36
+#define R_SPARC_PC_HH22		37
+#define R_SPARC_PC_HM10		38
+#define R_SPARC_PC_LM22		39
+#define R_SPARC_WDISP16		40
+#define R_SPARC_WDISP19		41
+#define R_SPARC_GLOB_JMP	42
+#define R_SPARC_7		43
+#define R_SPARC_5		44
+#define R_SPARC_6		45
+#define R_SPARC_DISP64		46
+#define R_SPARC_PLT64		47
+#define R_SPARC_HIX22		48
+#define R_SPARC_LOX10		49
+#define R_SPARC_H44		50
+#define R_SPARC_M44		51
+#define R_SPARC_L44		52
+#define R_SPARC_REGISTER	53
+#define R_SPARC_UA64		54
+#define R_SPARC_UA16		55
+#define R_SPARC_TLS_GD_HI22	56
+#define R_SPARC_TLS_GD_LO10	57
+#define R_SPARC_TLS_GD_ADD	58
+#define R_SPARC_TLS_GD_CALL	59
+#define R_SPARC_TLS_LDM_HI22	60
+#define R_SPARC_TLS_LDM_LO10	61
+#define R_SPARC_TLS_LDM_ADD	62
+#define R_SPARC_TLS_LDM_CALL	63
+#define R_SPARC_TLS_LDO_HIX22	64
+#define R_SPARC_TLS_LDO_LOX10	65
+#define R_SPARC_TLS_LDO_ADD	66
+#define R_SPARC_TLS_IE_HI22	67
+#define R_SPARC_TLS_IE_LO10	68
+#define R_SPARC_TLS_IE_LD	69
+#define R_SPARC_TLS_IE_LDX	70
+#define R_SPARC_TLS_IE_ADD	71
+#define R_SPARC_TLS_LE_HIX22	72
+#define R_SPARC_TLS_LE_LOX10	73
+#define R_SPARC_TLS_DTPMOD32	74
+#define R_SPARC_TLS_DTPMOD64	75
+#define R_SPARC_TLS_DTPOFF32	76
+#define R_SPARC_TLS_DTPOFF64	77
+#define R_SPARC_TLS_TPOFF32	78
+#define R_SPARC_TLS_TPOFF64	79
+#define R_SPARC_GOTDATA_HIX22	80
+#define R_SPARC_GOTDATA_LOX10	81
+#define R_SPARC_GOTDATA_OP_HIX22	82
+#define R_SPARC_GOTDATA_OP_LOX10	83
+#define R_SPARC_GOTDATA_OP	84
+#define R_SPARC_H34		85
+#define R_SPARC_SIZE32		86
+#define R_SPARC_SIZE64		87
+#define R_SPARC_GNU_VTINHERIT	250
+#define R_SPARC_GNU_VTENTRY	251
+#define R_SPARC_REV32		252
+
+#define R_SPARC_NUM		253
+
+
+
+#define DT_SPARC_REGISTER 0x70000001
+#define DT_SPARC_NUM	2
+
+
+#define EF_MIPS_NOREORDER   1
+#define EF_MIPS_PIC	    2
+#define EF_MIPS_CPIC	    4
+#define EF_MIPS_XGOT	    8
+#define EF_MIPS_64BIT_WHIRL 16
+#define EF_MIPS_ABI2	    32
+#define EF_MIPS_ABI_ON32    64
+#define EF_MIPS_FP64	    512
+#define EF_MIPS_NAN2008     1024
+#define EF_MIPS_ARCH	    0xf0000000
+
+
+
+#define EF_MIPS_ARCH_1	    0x00000000
+#define EF_MIPS_ARCH_2	    0x10000000
+#define EF_MIPS_ARCH_3	    0x20000000
+#define EF_MIPS_ARCH_4	    0x30000000
+#define EF_MIPS_ARCH_5	    0x40000000
+#define EF_MIPS_ARCH_32     0x50000000
+#define EF_MIPS_ARCH_64     0x60000000
+#define EF_MIPS_ARCH_32R2   0x70000000
+#define EF_MIPS_ARCH_64R2   0x80000000
+
+
+#define E_MIPS_ARCH_1	  0x00000000
+#define E_MIPS_ARCH_2	  0x10000000
+#define E_MIPS_ARCH_3	  0x20000000
+#define E_MIPS_ARCH_4	  0x30000000
+#define E_MIPS_ARCH_5	  0x40000000
+#define E_MIPS_ARCH_32	  0x50000000
+#define E_MIPS_ARCH_64	  0x60000000
+
+
+
+#define SHN_MIPS_ACOMMON    0xff00
+#define SHN_MIPS_TEXT	    0xff01
+#define SHN_MIPS_DATA	    0xff02
+#define SHN_MIPS_SCOMMON    0xff03
+#define SHN_MIPS_SUNDEFINED 0xff04
+
+
+
+#define SHT_MIPS_LIBLIST       0x70000000
+#define SHT_MIPS_MSYM	       0x70000001
+#define SHT_MIPS_CONFLICT      0x70000002
+#define SHT_MIPS_GPTAB	       0x70000003
+#define SHT_MIPS_UCODE	       0x70000004
+#define SHT_MIPS_DEBUG	       0x70000005
+#define SHT_MIPS_REGINFO       0x70000006
+#define SHT_MIPS_PACKAGE       0x70000007
+#define SHT_MIPS_PACKSYM       0x70000008
+#define SHT_MIPS_RELD	       0x70000009
+#define SHT_MIPS_IFACE         0x7000000b
+#define SHT_MIPS_CONTENT       0x7000000c
+#define SHT_MIPS_OPTIONS       0x7000000d
+#define SHT_MIPS_SHDR	       0x70000010
+#define SHT_MIPS_FDESC	       0x70000011
+#define SHT_MIPS_EXTSYM	       0x70000012
+#define SHT_MIPS_DENSE	       0x70000013
+#define SHT_MIPS_PDESC	       0x70000014
+#define SHT_MIPS_LOCSYM	       0x70000015
+#define SHT_MIPS_AUXSYM	       0x70000016
+#define SHT_MIPS_OPTSYM	       0x70000017
+#define SHT_MIPS_LOCSTR	       0x70000018
+#define SHT_MIPS_LINE	       0x70000019
+#define SHT_MIPS_RFDESC	       0x7000001a
+#define SHT_MIPS_DELTASYM      0x7000001b
+#define SHT_MIPS_DELTAINST     0x7000001c
+#define SHT_MIPS_DELTACLASS    0x7000001d
+#define SHT_MIPS_DWARF         0x7000001e
+#define SHT_MIPS_DELTADECL     0x7000001f
+#define SHT_MIPS_SYMBOL_LIB    0x70000020
+#define SHT_MIPS_EVENTS	       0x70000021
+#define SHT_MIPS_TRANSLATE     0x70000022
+#define SHT_MIPS_PIXIE	       0x70000023
+#define SHT_MIPS_XLATE	       0x70000024
+#define SHT_MIPS_XLATE_DEBUG   0x70000025
+#define SHT_MIPS_WHIRL	       0x70000026
+#define SHT_MIPS_EH_REGION     0x70000027
+#define SHT_MIPS_XLATE_OLD     0x70000028
+#define SHT_MIPS_PDR_EXCEPTION 0x70000029
+
+
+
+#define SHF_MIPS_GPREL	 0x10000000
+#define SHF_MIPS_MERGE	 0x20000000
+#define SHF_MIPS_ADDR	 0x40000000
+#define SHF_MIPS_STRINGS 0x80000000
+#define SHF_MIPS_NOSTRIP 0x08000000
+#define SHF_MIPS_LOCAL	 0x04000000
+#define SHF_MIPS_NAMES	 0x02000000
+#define SHF_MIPS_NODUPE	 0x01000000
+
+
+
+
+
+#define STO_MIPS_DEFAULT		0x0
+#define STO_MIPS_INTERNAL		0x1
+#define STO_MIPS_HIDDEN			0x2
+#define STO_MIPS_PROTECTED		0x3
+#define STO_MIPS_PLT			0x8
+#define STO_MIPS_SC_ALIGN_UNUSED	0xff
+
+
+#define STB_MIPS_SPLIT_COMMON		13
+
+
+
+typedef union {
+  struct {
+      Elf32_Word gt_current_g_value;
+      Elf32_Word gt_unused;
+  } gt_header;
+  struct {
+      Elf32_Word gt_g_value;
+      Elf32_Word gt_bytes;
+  } gt_entry;
+} Elf32_gptab;
+
+
+
+typedef struct {
+  Elf32_Word	ri_gprmask;
+  Elf32_Word	ri_cprmask[4];
+  Elf32_Sword	ri_gp_value;
+} Elf32_RegInfo;
+
+
+
+typedef struct {
+  unsigned char kind;
+
+  unsigned char size;
+  Elf32_Section section;
+
+  Elf32_Word info;
+} Elf_Options;
+
+
+
+#define ODK_NULL	0
+#define ODK_REGINFO	1
+#define ODK_EXCEPTIONS	2
+#define ODK_PAD		3
+#define ODK_HWPATCH	4
+#define ODK_FILL	5
+#define ODK_TAGS	6
+#define ODK_HWAND	7
+#define ODK_HWOR	8
+
+
+
+#define OEX_FPU_MIN	0x1f
+#define OEX_FPU_MAX	0x1f00
+#define OEX_PAGE0	0x10000
+#define OEX_SMM		0x20000
+#define OEX_FPDBUG	0x40000
+#define OEX_PRECISEFP	OEX_FPDBUG
+#define OEX_DISMISS	0x80000
+
+#define OEX_FPU_INVAL	0x10
+#define OEX_FPU_DIV0	0x08
+#define OEX_FPU_OFLO	0x04
+#define OEX_FPU_UFLO	0x02
+#define OEX_FPU_INEX	0x01
+
+
+
+#define OHW_R4KEOP	0x1
+#define OHW_R8KPFETCH	0x2
+#define OHW_R5KEOP	0x4
+#define OHW_R5KCVTL	0x8
+
+#define OPAD_PREFIX	0x1
+#define OPAD_POSTFIX	0x2
+#define OPAD_SYMBOL	0x4
+
+
+
+typedef struct {
+  Elf32_Word hwp_flags1;
+  Elf32_Word hwp_flags2;
+} Elf_Options_Hw;
+
+
+
+#define OHWA0_R4KEOP_CHECKED	0x00000001
+#define OHWA1_R4KEOP_CLEAN	0x00000002
+
+
+
+#define R_MIPS_NONE		0
+#define R_MIPS_16		1
+#define R_MIPS_32		2
+#define R_MIPS_REL32		3
+#define R_MIPS_26		4
+#define R_MIPS_HI16		5
+#define R_MIPS_LO16		6
+#define R_MIPS_GPREL16		7
+#define R_MIPS_LITERAL		8
+#define R_MIPS_GOT16		9
+#define R_MIPS_PC16		10
+#define R_MIPS_CALL16		11
+#define R_MIPS_GPREL32		12
+
+#define R_MIPS_SHIFT5		16
+#define R_MIPS_SHIFT6		17
+#define R_MIPS_64		18
+#define R_MIPS_GOT_DISP		19
+#define R_MIPS_GOT_PAGE		20
+#define R_MIPS_GOT_OFST		21
+#define R_MIPS_GOT_HI16		22
+#define R_MIPS_GOT_LO16		23
+#define R_MIPS_SUB		24
+#define R_MIPS_INSERT_A		25
+#define R_MIPS_INSERT_B		26
+#define R_MIPS_DELETE		27
+#define R_MIPS_HIGHER		28
+#define R_MIPS_HIGHEST		29
+#define R_MIPS_CALL_HI16	30
+#define R_MIPS_CALL_LO16	31
+#define R_MIPS_SCN_DISP		32
+#define R_MIPS_REL16		33
+#define R_MIPS_ADD_IMMEDIATE	34
+#define R_MIPS_PJUMP		35
+#define R_MIPS_RELGOT		36
+#define R_MIPS_JALR		37
+#define R_MIPS_TLS_DTPMOD32	38
+#define R_MIPS_TLS_DTPREL32	39
+#define R_MIPS_TLS_DTPMOD64	40
+#define R_MIPS_TLS_DTPREL64	41
+#define R_MIPS_TLS_GD		42
+#define R_MIPS_TLS_LDM		43
+#define R_MIPS_TLS_DTPREL_HI16	44
+#define R_MIPS_TLS_DTPREL_LO16	45
+#define R_MIPS_TLS_GOTTPREL	46
+#define R_MIPS_TLS_TPREL32	47
+#define R_MIPS_TLS_TPREL64	48
+#define R_MIPS_TLS_TPREL_HI16	49
+#define R_MIPS_TLS_TPREL_LO16	50
+#define R_MIPS_GLOB_DAT		51
+#define R_MIPS_COPY		126
+#define R_MIPS_JUMP_SLOT        127
+
+#define R_MIPS_NUM		128
+
+
+
+#define PT_MIPS_REGINFO	0x70000000
+#define PT_MIPS_RTPROC  0x70000001
+#define PT_MIPS_OPTIONS 0x70000002
+#define PT_MIPS_ABIFLAGS 0x70000003
+
+
+
+#define PF_MIPS_LOCAL	0x10000000
+
+
+
+#define DT_MIPS_RLD_VERSION  0x70000001
+#define DT_MIPS_TIME_STAMP   0x70000002
+#define DT_MIPS_ICHECKSUM    0x70000003
+#define DT_MIPS_IVERSION     0x70000004
+#define DT_MIPS_FLAGS	     0x70000005
+#define DT_MIPS_BASE_ADDRESS 0x70000006
+#define DT_MIPS_MSYM	     0x70000007
+#define DT_MIPS_CONFLICT     0x70000008
+#define DT_MIPS_LIBLIST	     0x70000009
+#define DT_MIPS_LOCAL_GOTNO  0x7000000a
+#define DT_MIPS_CONFLICTNO   0x7000000b
+#define DT_MIPS_LIBLISTNO    0x70000010
+#define DT_MIPS_SYMTABNO     0x70000011
+#define DT_MIPS_UNREFEXTNO   0x70000012
+#define DT_MIPS_GOTSYM	     0x70000013
+#define DT_MIPS_HIPAGENO     0x70000014
+#define DT_MIPS_RLD_MAP	     0x70000016
+#define DT_MIPS_DELTA_CLASS  0x70000017
+#define DT_MIPS_DELTA_CLASS_NO    0x70000018
+
+#define DT_MIPS_DELTA_INSTANCE    0x70000019
+#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a
+
+#define DT_MIPS_DELTA_RELOC  0x7000001b
+#define DT_MIPS_DELTA_RELOC_NO 0x7000001c
+
+#define DT_MIPS_DELTA_SYM    0x7000001d
+
+#define DT_MIPS_DELTA_SYM_NO 0x7000001e
+
+#define DT_MIPS_DELTA_CLASSSYM 0x70000020
+
+#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021
+
+#define DT_MIPS_CXX_FLAGS    0x70000022
+#define DT_MIPS_PIXIE_INIT   0x70000023
+#define DT_MIPS_SYMBOL_LIB   0x70000024
+#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
+#define DT_MIPS_LOCAL_GOTIDX 0x70000026
+#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
+#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
+#define DT_MIPS_OPTIONS	     0x70000029
+#define DT_MIPS_INTERFACE    0x7000002a
+#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
+#define DT_MIPS_INTERFACE_SIZE 0x7000002c
+#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d
+
+#define DT_MIPS_PERF_SUFFIX  0x7000002e
+
+#define DT_MIPS_COMPACT_SIZE 0x7000002f
+#define DT_MIPS_GP_VALUE     0x70000030
+#define DT_MIPS_AUX_DYNAMIC  0x70000031
+
+#define DT_MIPS_PLTGOT	     0x70000032
+
+#define DT_MIPS_RWPLT        0x70000034
+#define DT_MIPS_RLD_MAP_REL  0x70000035
+#define DT_MIPS_NUM	     0x36
+
+
+
+#define RHF_NONE		   0
+#define RHF_QUICKSTART		   (1 << 0)
+#define RHF_NOTPOT		   (1 << 1)
+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)
+#define RHF_NO_MOVE		   (1 << 3)
+#define RHF_SGI_ONLY		   (1 << 4)
+#define RHF_GUARANTEE_INIT	   (1 << 5)
+#define RHF_DELTA_C_PLUS_PLUS	   (1 << 6)
+#define RHF_GUARANTEE_START_INIT   (1 << 7)
+#define RHF_PIXIE		   (1 << 8)
+#define RHF_DEFAULT_DELAY_LOAD	   (1 << 9)
+#define RHF_REQUICKSTART	   (1 << 10)
+#define RHF_REQUICKSTARTED	   (1 << 11)
+#define RHF_CORD		   (1 << 12)
+#define RHF_NO_UNRES_UNDEF	   (1 << 13)
+#define RHF_RLD_ORDER_SAFE	   (1 << 14)
+
+
+
+typedef struct {
+  Elf32_Word l_name;
+  Elf32_Word l_time_stamp;
+  Elf32_Word l_checksum;
+  Elf32_Word l_version;
+  Elf32_Word l_flags;
+} Elf32_Lib;
+
+typedef struct {
+  Elf64_Word l_name;
+  Elf64_Word l_time_stamp;
+  Elf64_Word l_checksum;
+  Elf64_Word l_version;
+  Elf64_Word l_flags;
+} Elf64_Lib;
+
+
+
+
+#define LL_NONE		  0
+#define LL_EXACT_MATCH	  (1 << 0)
+#define LL_IGNORE_INT_VER (1 << 1)
+#define LL_REQUIRE_MINOR  (1 << 2)
+#define LL_EXPORTS	  (1 << 3)
+#define LL_DELAY_LOAD	  (1 << 4)
+#define LL_DELTA	  (1 << 5)
+
+
+
+typedef Elf32_Addr Elf32_Conflict;
+
+typedef struct {
+  Elf32_Half version;
+  unsigned char isa_level;
+  unsigned char isa_rev;
+  unsigned char gpr_size;
+  unsigned char cpr1_size;
+  unsigned char cpr2_size;
+  unsigned char fp_abi;
+  Elf32_Word isa_ext;
+  Elf32_Word ases;
+  Elf32_Word flags1;
+  Elf32_Word flags2;
+} Elf_MIPS_ABIFlags_v0;
+
+#define MIPS_AFL_REG_NONE	0x00
+#define MIPS_AFL_REG_32		0x01
+#define MIPS_AFL_REG_64		0x02
+#define MIPS_AFL_REG_128	0x03
+
+#define MIPS_AFL_ASE_DSP	0x00000001
+#define MIPS_AFL_ASE_DSPR2	0x00000002
+#define MIPS_AFL_ASE_EVA	0x00000004
+#define MIPS_AFL_ASE_MCU	0x00000008
+#define MIPS_AFL_ASE_MDMX	0x00000010
+#define MIPS_AFL_ASE_MIPS3D	0x00000020
+#define MIPS_AFL_ASE_MT		0x00000040
+#define MIPS_AFL_ASE_SMARTMIPS	0x00000080
+#define MIPS_AFL_ASE_VIRT	0x00000100
+#define MIPS_AFL_ASE_MSA	0x00000200
+#define MIPS_AFL_ASE_MIPS16	0x00000400
+#define MIPS_AFL_ASE_MICROMIPS	0x00000800
+#define MIPS_AFL_ASE_XPA	0x00001000
+#define MIPS_AFL_ASE_MASK	0x00001fff
+
+#define MIPS_AFL_EXT_XLR	  1
+#define MIPS_AFL_EXT_OCTEON2	  2
+#define MIPS_AFL_EXT_OCTEONP	  3
+#define MIPS_AFL_EXT_LOONGSON_3A  4
+#define MIPS_AFL_EXT_OCTEON	  5
+#define MIPS_AFL_EXT_5900	  6
+#define MIPS_AFL_EXT_4650	  7
+#define MIPS_AFL_EXT_4010	  8
+#define MIPS_AFL_EXT_4100	  9
+#define MIPS_AFL_EXT_3900	  10
+#define MIPS_AFL_EXT_10000	  11
+#define MIPS_AFL_EXT_SB1	  12
+#define MIPS_AFL_EXT_4111	  13
+#define MIPS_AFL_EXT_4120	  14
+#define MIPS_AFL_EXT_5400	  15
+#define MIPS_AFL_EXT_5500	  16
+#define MIPS_AFL_EXT_LOONGSON_2E  17
+#define MIPS_AFL_EXT_LOONGSON_2F  18
+
+#define MIPS_AFL_FLAGS1_ODDSPREG  1
+
+enum
+{
+  Val_GNU_MIPS_ABI_FP_ANY = 0,
+  Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
+  Val_GNU_MIPS_ABI_FP_SINGLE = 2,
+  Val_GNU_MIPS_ABI_FP_SOFT = 3,
+  Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
+  Val_GNU_MIPS_ABI_FP_XX = 5,
+  Val_GNU_MIPS_ABI_FP_64 = 6,
+  Val_GNU_MIPS_ABI_FP_64A = 7,
+  Val_GNU_MIPS_ABI_FP_MAX = 7
+};
+
+
+
+
+#define EF_PARISC_TRAPNIL	0x00010000
+#define EF_PARISC_EXT		0x00020000
+#define EF_PARISC_LSB		0x00040000
+#define EF_PARISC_WIDE		0x00080000
+#define EF_PARISC_NO_KABP	0x00100000
+
+#define EF_PARISC_LAZYSWAP	0x00400000
+#define EF_PARISC_ARCH		0x0000ffff
+
+
+
+#define EFA_PARISC_1_0		    0x020b
+#define EFA_PARISC_1_1		    0x0210
+#define EFA_PARISC_2_0		    0x0214
+
+
+
+#define SHN_PARISC_ANSI_COMMON	0xff00
+
+#define SHN_PARISC_HUGE_COMMON	0xff01
+
+
+
+#define SHT_PARISC_EXT		0x70000000
+#define SHT_PARISC_UNWIND	0x70000001
+#define SHT_PARISC_DOC		0x70000002
+
+
+
+#define SHF_PARISC_SHORT	0x20000000
+#define SHF_PARISC_HUGE		0x40000000
+#define SHF_PARISC_SBP		0x80000000
+
+
+
+#define STT_PARISC_MILLICODE	13
+
+#define STT_HP_OPAQUE		(STT_LOOS + 0x1)
+#define STT_HP_STUB		(STT_LOOS + 0x2)
+
+
+
+#define R_PARISC_NONE		0
+#define R_PARISC_DIR32		1
+#define R_PARISC_DIR21L		2
+#define R_PARISC_DIR17R		3
+#define R_PARISC_DIR17F		4
+#define R_PARISC_DIR14R		6
+#define R_PARISC_PCREL32	9
+#define R_PARISC_PCREL21L	10
+#define R_PARISC_PCREL17R	11
+#define R_PARISC_PCREL17F	12
+#define R_PARISC_PCREL14R	14
+#define R_PARISC_DPREL21L	18
+#define R_PARISC_DPREL14R	22
+#define R_PARISC_GPREL21L	26
+#define R_PARISC_GPREL14R	30
+#define R_PARISC_LTOFF21L	34
+#define R_PARISC_LTOFF14R	38
+#define R_PARISC_SECREL32	41
+#define R_PARISC_SEGBASE	48
+#define R_PARISC_SEGREL32	49
+#define R_PARISC_PLTOFF21L	50
+#define R_PARISC_PLTOFF14R	54
+#define R_PARISC_LTOFF_FPTR32	57
+#define R_PARISC_LTOFF_FPTR21L	58
+#define R_PARISC_LTOFF_FPTR14R	62
+#define R_PARISC_FPTR64		64
+#define R_PARISC_PLABEL32	65
+#define R_PARISC_PLABEL21L	66
+#define R_PARISC_PLABEL14R	70
+#define R_PARISC_PCREL64	72
+#define R_PARISC_PCREL22F	74
+#define R_PARISC_PCREL14WR	75
+#define R_PARISC_PCREL14DR	76
+#define R_PARISC_PCREL16F	77
+#define R_PARISC_PCREL16WF	78
+#define R_PARISC_PCREL16DF	79
+#define R_PARISC_DIR64		80
+#define R_PARISC_DIR14WR	83
+#define R_PARISC_DIR14DR	84
+#define R_PARISC_DIR16F		85
+#define R_PARISC_DIR16WF	86
+#define R_PARISC_DIR16DF	87
+#define R_PARISC_GPREL64	88
+#define R_PARISC_GPREL14WR	91
+#define R_PARISC_GPREL14DR	92
+#define R_PARISC_GPREL16F	93
+#define R_PARISC_GPREL16WF	94
+#define R_PARISC_GPREL16DF	95
+#define R_PARISC_LTOFF64	96
+#define R_PARISC_LTOFF14WR	99
+#define R_PARISC_LTOFF14DR	100
+#define R_PARISC_LTOFF16F	101
+#define R_PARISC_LTOFF16WF	102
+#define R_PARISC_LTOFF16DF	103
+#define R_PARISC_SECREL64	104
+#define R_PARISC_SEGREL64	112
+#define R_PARISC_PLTOFF14WR	115
+#define R_PARISC_PLTOFF14DR	116
+#define R_PARISC_PLTOFF16F	117
+#define R_PARISC_PLTOFF16WF	118
+#define R_PARISC_PLTOFF16DF	119
+#define R_PARISC_LTOFF_FPTR64	120
+#define R_PARISC_LTOFF_FPTR14WR	123
+#define R_PARISC_LTOFF_FPTR14DR	124
+#define R_PARISC_LTOFF_FPTR16F	125
+#define R_PARISC_LTOFF_FPTR16WF	126
+#define R_PARISC_LTOFF_FPTR16DF	127
+#define R_PARISC_LORESERVE	128
+#define R_PARISC_COPY		128
+#define R_PARISC_IPLT		129
+#define R_PARISC_EPLT		130
+#define R_PARISC_TPREL32	153
+#define R_PARISC_TPREL21L	154
+#define R_PARISC_TPREL14R	158
+#define R_PARISC_LTOFF_TP21L	162
+#define R_PARISC_LTOFF_TP14R	166
+#define R_PARISC_LTOFF_TP14F	167
+#define R_PARISC_TPREL64	216
+#define R_PARISC_TPREL14WR	219
+#define R_PARISC_TPREL14DR	220
+#define R_PARISC_TPREL16F	221
+#define R_PARISC_TPREL16WF	222
+#define R_PARISC_TPREL16DF	223
+#define R_PARISC_LTOFF_TP64	224
+#define R_PARISC_LTOFF_TP14WR	227
+#define R_PARISC_LTOFF_TP14DR	228
+#define R_PARISC_LTOFF_TP16F	229
+#define R_PARISC_LTOFF_TP16WF	230
+#define R_PARISC_LTOFF_TP16DF	231
+#define R_PARISC_GNU_VTENTRY	232
+#define R_PARISC_GNU_VTINHERIT	233
+#define R_PARISC_TLS_GD21L	234
+#define R_PARISC_TLS_GD14R	235
+#define R_PARISC_TLS_GDCALL	236
+#define R_PARISC_TLS_LDM21L	237
+#define R_PARISC_TLS_LDM14R	238
+#define R_PARISC_TLS_LDMCALL	239
+#define R_PARISC_TLS_LDO21L	240
+#define R_PARISC_TLS_LDO14R	241
+#define R_PARISC_TLS_DTPMOD32	242
+#define R_PARISC_TLS_DTPMOD64	243
+#define R_PARISC_TLS_DTPOFF32	244
+#define R_PARISC_TLS_DTPOFF64	245
+#define R_PARISC_TLS_LE21L	R_PARISC_TPREL21L
+#define R_PARISC_TLS_LE14R	R_PARISC_TPREL14R
+#define R_PARISC_TLS_IE21L	R_PARISC_LTOFF_TP21L
+#define R_PARISC_TLS_IE14R	R_PARISC_LTOFF_TP14R
+#define R_PARISC_TLS_TPREL32	R_PARISC_TPREL32
+#define R_PARISC_TLS_TPREL64	R_PARISC_TPREL64
+#define R_PARISC_HIRESERVE	255
+
+
+
+#define PT_HP_TLS		(PT_LOOS + 0x0)
+#define PT_HP_CORE_NONE		(PT_LOOS + 0x1)
+#define PT_HP_CORE_VERSION	(PT_LOOS + 0x2)
+#define PT_HP_CORE_KERNEL	(PT_LOOS + 0x3)
+#define PT_HP_CORE_COMM		(PT_LOOS + 0x4)
+#define PT_HP_CORE_PROC		(PT_LOOS + 0x5)
+#define PT_HP_CORE_LOADABLE	(PT_LOOS + 0x6)
+#define PT_HP_CORE_STACK	(PT_LOOS + 0x7)
+#define PT_HP_CORE_SHM		(PT_LOOS + 0x8)
+#define PT_HP_CORE_MMF		(PT_LOOS + 0x9)
+#define PT_HP_PARALLEL		(PT_LOOS + 0x10)
+#define PT_HP_FASTBIND		(PT_LOOS + 0x11)
+#define PT_HP_OPT_ANNOT		(PT_LOOS + 0x12)
+#define PT_HP_HSL_ANNOT		(PT_LOOS + 0x13)
+#define PT_HP_STACK		(PT_LOOS + 0x14)
+
+#define PT_PARISC_ARCHEXT	0x70000000
+#define PT_PARISC_UNWIND	0x70000001
+
+
+
+#define PF_PARISC_SBP		0x08000000
+
+#define PF_HP_PAGE_SIZE		0x00100000
+#define PF_HP_FAR_SHARED	0x00200000
+#define PF_HP_NEAR_SHARED	0x00400000
+#define PF_HP_CODE		0x01000000
+#define PF_HP_MODIFY		0x02000000
+#define PF_HP_LAZYSWAP		0x04000000
+#define PF_HP_SBP		0x08000000
+
+
+
+
+
+
+#define EF_ALPHA_32BIT		1
+#define EF_ALPHA_CANRELAX	2
+
+
+
+
+#define SHT_ALPHA_DEBUG		0x70000001
+#define SHT_ALPHA_REGINFO	0x70000002
+
+
+
+#define SHF_ALPHA_GPREL		0x10000000
+
+
+#define STO_ALPHA_NOPV		0x80
+#define STO_ALPHA_STD_GPLOAD	0x88
+
+
+
+#define R_ALPHA_NONE		0
+#define R_ALPHA_REFLONG		1
+#define R_ALPHA_REFQUAD		2
+#define R_ALPHA_GPREL32		3
+#define R_ALPHA_LITERAL		4
+#define R_ALPHA_LITUSE		5
+#define R_ALPHA_GPDISP		6
+#define R_ALPHA_BRADDR		7
+#define R_ALPHA_HINT		8
+#define R_ALPHA_SREL16		9
+#define R_ALPHA_SREL32		10
+#define R_ALPHA_SREL64		11
+#define R_ALPHA_GPRELHIGH	17
+#define R_ALPHA_GPRELLOW	18
+#define R_ALPHA_GPREL16		19
+#define R_ALPHA_COPY		24
+#define R_ALPHA_GLOB_DAT	25
+#define R_ALPHA_JMP_SLOT	26
+#define R_ALPHA_RELATIVE	27
+#define R_ALPHA_TLS_GD_HI	28
+#define R_ALPHA_TLSGD		29
+#define R_ALPHA_TLS_LDM		30
+#define R_ALPHA_DTPMOD64	31
+#define R_ALPHA_GOTDTPREL	32
+#define R_ALPHA_DTPREL64	33
+#define R_ALPHA_DTPRELHI	34
+#define R_ALPHA_DTPRELLO	35
+#define R_ALPHA_DTPREL16	36
+#define R_ALPHA_GOTTPREL	37
+#define R_ALPHA_TPREL64		38
+#define R_ALPHA_TPRELHI		39
+#define R_ALPHA_TPRELLO		40
+#define R_ALPHA_TPREL16		41
+
+#define R_ALPHA_NUM		46
+
+
+#define LITUSE_ALPHA_ADDR	0
+#define LITUSE_ALPHA_BASE	1
+#define LITUSE_ALPHA_BYTOFF	2
+#define LITUSE_ALPHA_JSR	3
+#define LITUSE_ALPHA_TLS_GD	4
+#define LITUSE_ALPHA_TLS_LDM	5
+
+
+#define DT_ALPHA_PLTRO		(DT_LOPROC + 0)
+#define DT_ALPHA_NUM		1
+
+
+
+
+#define EF_PPC_EMB		0x80000000
+
+
+#define EF_PPC_RELOCATABLE	0x00010000
+#define EF_PPC_RELOCATABLE_LIB	0x00008000
+
+
+
+#define R_PPC_NONE		0
+#define R_PPC_ADDR32		1
+#define R_PPC_ADDR24		2
+#define R_PPC_ADDR16		3
+#define R_PPC_ADDR16_LO		4
+#define R_PPC_ADDR16_HI		5
+#define R_PPC_ADDR16_HA		6
+#define R_PPC_ADDR14		7
+#define R_PPC_ADDR14_BRTAKEN	8
+#define R_PPC_ADDR14_BRNTAKEN	9
+#define R_PPC_REL24		10
+#define R_PPC_REL14		11
+#define R_PPC_REL14_BRTAKEN	12
+#define R_PPC_REL14_BRNTAKEN	13
+#define R_PPC_GOT16		14
+#define R_PPC_GOT16_LO		15
+#define R_PPC_GOT16_HI		16
+#define R_PPC_GOT16_HA		17
+#define R_PPC_PLTREL24		18
+#define R_PPC_COPY		19
+#define R_PPC_GLOB_DAT		20
+#define R_PPC_JMP_SLOT		21
+#define R_PPC_RELATIVE		22
+#define R_PPC_LOCAL24PC		23
+#define R_PPC_UADDR32		24
+#define R_PPC_UADDR16		25
+#define R_PPC_REL32		26
+#define R_PPC_PLT32		27
+#define R_PPC_PLTREL32		28
+#define R_PPC_PLT16_LO		29
+#define R_PPC_PLT16_HI		30
+#define R_PPC_PLT16_HA		31
+#define R_PPC_SDAREL16		32
+#define R_PPC_SECTOFF		33
+#define R_PPC_SECTOFF_LO	34
+#define R_PPC_SECTOFF_HI	35
+#define R_PPC_SECTOFF_HA	36
+
+
+#define R_PPC_TLS		67
+#define R_PPC_DTPMOD32		68
+#define R_PPC_TPREL16		69
+#define R_PPC_TPREL16_LO	70
+#define R_PPC_TPREL16_HI	71
+#define R_PPC_TPREL16_HA	72
+#define R_PPC_TPREL32		73
+#define R_PPC_DTPREL16		74
+#define R_PPC_DTPREL16_LO	75
+#define R_PPC_DTPREL16_HI	76
+#define R_PPC_DTPREL16_HA	77
+#define R_PPC_DTPREL32		78
+#define R_PPC_GOT_TLSGD16	79
+#define R_PPC_GOT_TLSGD16_LO	80
+#define R_PPC_GOT_TLSGD16_HI	81
+#define R_PPC_GOT_TLSGD16_HA	82
+#define R_PPC_GOT_TLSLD16	83
+#define R_PPC_GOT_TLSLD16_LO	84
+#define R_PPC_GOT_TLSLD16_HI	85
+#define R_PPC_GOT_TLSLD16_HA	86
+#define R_PPC_GOT_TPREL16	87
+#define R_PPC_GOT_TPREL16_LO	88
+#define R_PPC_GOT_TPREL16_HI	89
+#define R_PPC_GOT_TPREL16_HA	90
+#define R_PPC_GOT_DTPREL16	91
+#define R_PPC_GOT_DTPREL16_LO	92
+#define R_PPC_GOT_DTPREL16_HI	93
+#define R_PPC_GOT_DTPREL16_HA	94
+#define R_PPC_TLSGD		95
+#define R_PPC_TLSLD		96
+
+
+#define R_PPC_EMB_NADDR32	101
+#define R_PPC_EMB_NADDR16	102
+#define R_PPC_EMB_NADDR16_LO	103
+#define R_PPC_EMB_NADDR16_HI	104
+#define R_PPC_EMB_NADDR16_HA	105
+#define R_PPC_EMB_SDAI16	106
+#define R_PPC_EMB_SDA2I16	107
+#define R_PPC_EMB_SDA2REL	108
+#define R_PPC_EMB_SDA21		109
+#define R_PPC_EMB_MRKREF	110
+#define R_PPC_EMB_RELSEC16	111
+#define R_PPC_EMB_RELST_LO	112
+#define R_PPC_EMB_RELST_HI	113
+#define R_PPC_EMB_RELST_HA	114
+#define R_PPC_EMB_BIT_FLD	115
+#define R_PPC_EMB_RELSDA	116
+
+
+#define R_PPC_DIAB_SDA21_LO	180
+#define R_PPC_DIAB_SDA21_HI	181
+#define R_PPC_DIAB_SDA21_HA	182
+#define R_PPC_DIAB_RELSDA_LO	183
+#define R_PPC_DIAB_RELSDA_HI	184
+#define R_PPC_DIAB_RELSDA_HA	185
+
+
+#define R_PPC_IRELATIVE		248
+
+
+#define R_PPC_REL16		249
+#define R_PPC_REL16_LO		250
+#define R_PPC_REL16_HI		251
+#define R_PPC_REL16_HA		252
+
+
+
+#define R_PPC_TOC16		255
+
+
+#define DT_PPC_GOT		(DT_LOPROC + 0)
+#define DT_PPC_OPT		(DT_LOPROC + 1)
+#define DT_PPC_NUM		2
+
+#define PPC_OPT_TLS		1
+
+
+#define R_PPC64_NONE		R_PPC_NONE
+#define R_PPC64_ADDR32		R_PPC_ADDR32
+#define R_PPC64_ADDR24		R_PPC_ADDR24
+#define R_PPC64_ADDR16		R_PPC_ADDR16
+#define R_PPC64_ADDR16_LO	R_PPC_ADDR16_LO
+#define R_PPC64_ADDR16_HI	R_PPC_ADDR16_HI
+#define R_PPC64_ADDR16_HA	R_PPC_ADDR16_HA
+#define R_PPC64_ADDR14		R_PPC_ADDR14
+#define R_PPC64_ADDR14_BRTAKEN	R_PPC_ADDR14_BRTAKEN
+#define R_PPC64_ADDR14_BRNTAKEN	R_PPC_ADDR14_BRNTAKEN
+#define R_PPC64_REL24		R_PPC_REL24
+#define R_PPC64_REL14		R_PPC_REL14
+#define R_PPC64_REL14_BRTAKEN	R_PPC_REL14_BRTAKEN
+#define R_PPC64_REL14_BRNTAKEN	R_PPC_REL14_BRNTAKEN
+#define R_PPC64_GOT16		R_PPC_GOT16
+#define R_PPC64_GOT16_LO	R_PPC_GOT16_LO
+#define R_PPC64_GOT16_HI	R_PPC_GOT16_HI
+#define R_PPC64_GOT16_HA	R_PPC_GOT16_HA
+
+#define R_PPC64_COPY		R_PPC_COPY
+#define R_PPC64_GLOB_DAT	R_PPC_GLOB_DAT
+#define R_PPC64_JMP_SLOT	R_PPC_JMP_SLOT
+#define R_PPC64_RELATIVE	R_PPC_RELATIVE
+
+#define R_PPC64_UADDR32		R_PPC_UADDR32
+#define R_PPC64_UADDR16		R_PPC_UADDR16
+#define R_PPC64_REL32		R_PPC_REL32
+#define R_PPC64_PLT32		R_PPC_PLT32
+#define R_PPC64_PLTREL32	R_PPC_PLTREL32
+#define R_PPC64_PLT16_LO	R_PPC_PLT16_LO
+#define R_PPC64_PLT16_HI	R_PPC_PLT16_HI
+#define R_PPC64_PLT16_HA	R_PPC_PLT16_HA
+
+#define R_PPC64_SECTOFF		R_PPC_SECTOFF
+#define R_PPC64_SECTOFF_LO	R_PPC_SECTOFF_LO
+#define R_PPC64_SECTOFF_HI	R_PPC_SECTOFF_HI
+#define R_PPC64_SECTOFF_HA	R_PPC_SECTOFF_HA
+#define R_PPC64_ADDR30		37
+#define R_PPC64_ADDR64		38
+#define R_PPC64_ADDR16_HIGHER	39
+#define R_PPC64_ADDR16_HIGHERA	40
+#define R_PPC64_ADDR16_HIGHEST	41
+#define R_PPC64_ADDR16_HIGHESTA	42
+#define R_PPC64_UADDR64		43
+#define R_PPC64_REL64		44
+#define R_PPC64_PLT64		45
+#define R_PPC64_PLTREL64	46
+#define R_PPC64_TOC16		47
+#define R_PPC64_TOC16_LO	48
+#define R_PPC64_TOC16_HI	49
+#define R_PPC64_TOC16_HA	50
+#define R_PPC64_TOC		51
+#define R_PPC64_PLTGOT16	52
+#define R_PPC64_PLTGOT16_LO	53
+#define R_PPC64_PLTGOT16_HI	54
+#define R_PPC64_PLTGOT16_HA	55
+
+#define R_PPC64_ADDR16_DS	56
+#define R_PPC64_ADDR16_LO_DS	57
+#define R_PPC64_GOT16_DS	58
+#define R_PPC64_GOT16_LO_DS	59
+#define R_PPC64_PLT16_LO_DS	60
+#define R_PPC64_SECTOFF_DS	61
+#define R_PPC64_SECTOFF_LO_DS	62
+#define R_PPC64_TOC16_DS	63
+#define R_PPC64_TOC16_LO_DS	64
+#define R_PPC64_PLTGOT16_DS	65
+#define R_PPC64_PLTGOT16_LO_DS	66
+
+
+#define R_PPC64_TLS		67
+#define R_PPC64_DTPMOD64	68
+#define R_PPC64_TPREL16		69
+#define R_PPC64_TPREL16_LO	70
+#define R_PPC64_TPREL16_HI	71
+#define R_PPC64_TPREL16_HA	72
+#define R_PPC64_TPREL64		73
+#define R_PPC64_DTPREL16	74
+#define R_PPC64_DTPREL16_LO	75
+#define R_PPC64_DTPREL16_HI	76
+#define R_PPC64_DTPREL16_HA	77
+#define R_PPC64_DTPREL64	78
+#define R_PPC64_GOT_TLSGD16	79
+#define R_PPC64_GOT_TLSGD16_LO	80
+#define R_PPC64_GOT_TLSGD16_HI	81
+#define R_PPC64_GOT_TLSGD16_HA	82
+#define R_PPC64_GOT_TLSLD16	83
+#define R_PPC64_GOT_TLSLD16_LO	84
+#define R_PPC64_GOT_TLSLD16_HI	85
+#define R_PPC64_GOT_TLSLD16_HA	86
+#define R_PPC64_GOT_TPREL16_DS	87
+#define R_PPC64_GOT_TPREL16_LO_DS 88
+#define R_PPC64_GOT_TPREL16_HI	89
+#define R_PPC64_GOT_TPREL16_HA	90
+#define R_PPC64_GOT_DTPREL16_DS	91
+#define R_PPC64_GOT_DTPREL16_LO_DS 92
+#define R_PPC64_GOT_DTPREL16_HI	93
+#define R_PPC64_GOT_DTPREL16_HA	94
+#define R_PPC64_TPREL16_DS	95
+#define R_PPC64_TPREL16_LO_DS	96
+#define R_PPC64_TPREL16_HIGHER	97
+#define R_PPC64_TPREL16_HIGHERA	98
+#define R_PPC64_TPREL16_HIGHEST	99
+#define R_PPC64_TPREL16_HIGHESTA 100
+#define R_PPC64_DTPREL16_DS	101
+#define R_PPC64_DTPREL16_LO_DS	102
+#define R_PPC64_DTPREL16_HIGHER	103
+#define R_PPC64_DTPREL16_HIGHERA 104
+#define R_PPC64_DTPREL16_HIGHEST 105
+#define R_PPC64_DTPREL16_HIGHESTA 106
+#define R_PPC64_TLSGD		107
+#define R_PPC64_TLSLD		108
+#define R_PPC64_TOCSAVE		109
+#define R_PPC64_ADDR16_HIGH	110
+#define R_PPC64_ADDR16_HIGHA	111
+#define R_PPC64_TPREL16_HIGH	112
+#define R_PPC64_TPREL16_HIGHA	113
+#define R_PPC64_DTPREL16_HIGH	114
+#define R_PPC64_DTPREL16_HIGHA	115
+
+
+#define R_PPC64_JMP_IREL	247
+#define R_PPC64_IRELATIVE	248
+#define R_PPC64_REL16		249
+#define R_PPC64_REL16_LO	250
+#define R_PPC64_REL16_HI	251
+#define R_PPC64_REL16_HA	252
+
+#define EF_PPC64_ABI	3
+
+#define DT_PPC64_GLINK  (DT_LOPROC + 0)
+#define DT_PPC64_OPD	(DT_LOPROC + 1)
+#define DT_PPC64_OPDSZ	(DT_LOPROC + 2)
+#define DT_PPC64_OPT	(DT_LOPROC + 3)
+#define DT_PPC64_NUM	4
+
+#define PPC64_OPT_TLS		1
+#define PPC64_OPT_MULTI_TOC	2
+#define PPC64_OPT_LOCALENTRY	4
+
+#define STO_PPC64_LOCAL_BIT	5
+#define STO_PPC64_LOCAL_MASK	0xe0
+#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc)
+
+
+#define EF_ARM_RELEXEC		0x01
+#define EF_ARM_HASENTRY		0x02
+#define EF_ARM_INTERWORK	0x04
+#define EF_ARM_APCS_26		0x08
+#define EF_ARM_APCS_FLOAT	0x10
+#define EF_ARM_PIC		0x20
+#define EF_ARM_ALIGN8		0x40
+#define EF_ARM_NEW_ABI		0x80
+#define EF_ARM_OLD_ABI		0x100
+#define EF_ARM_SOFT_FLOAT	0x200
+#define EF_ARM_VFP_FLOAT	0x400
+#define EF_ARM_MAVERICK_FLOAT	0x800
+
+#define EF_ARM_ABI_FLOAT_SOFT	0x200
+#define EF_ARM_ABI_FLOAT_HARD	0x400
+
+
+#define EF_ARM_SYMSARESORTED	0x04
+#define EF_ARM_DYNSYMSUSESEGIDX	0x08
+#define EF_ARM_MAPSYMSFIRST	0x10
+#define EF_ARM_EABIMASK		0XFF000000
+
+
+#define EF_ARM_BE8	    0x00800000
+#define EF_ARM_LE8	    0x00400000
+
+#define EF_ARM_EABI_VERSION(flags)	((flags) & EF_ARM_EABIMASK)
+#define EF_ARM_EABI_UNKNOWN	0x00000000
+#define EF_ARM_EABI_VER1	0x01000000
+#define EF_ARM_EABI_VER2	0x02000000
+#define EF_ARM_EABI_VER3	0x03000000
+#define EF_ARM_EABI_VER4	0x04000000
+#define EF_ARM_EABI_VER5	0x05000000
+
+
+#define STT_ARM_TFUNC		STT_LOPROC
+#define STT_ARM_16BIT		STT_HIPROC
+
+
+#define SHF_ARM_ENTRYSECT	0x10000000
+#define SHF_ARM_COMDEF		0x80000000
+
+
+
+#define PF_ARM_SB		0x10000000
+
+#define PF_ARM_PI		0x20000000
+#define PF_ARM_ABS		0x40000000
+
+
+#define PT_ARM_EXIDX		(PT_LOPROC + 1)
+
+
+#define SHT_ARM_EXIDX		(SHT_LOPROC + 1)
+#define SHT_ARM_PREEMPTMAP	(SHT_LOPROC + 2)
+#define SHT_ARM_ATTRIBUTES	(SHT_LOPROC + 3)
+
+#define R_AARCH64_NONE            0
+#define R_AARCH64_P32_ABS32	1
+#define R_AARCH64_P32_COPY	180
+#define R_AARCH64_P32_GLOB_DAT	181
+#define R_AARCH64_P32_JUMP_SLOT	182
+#define R_AARCH64_P32_RELATIVE	183
+#define R_AARCH64_P32_TLS_DTPMOD 184
+#define R_AARCH64_P32_TLS_DTPREL 185
+#define R_AARCH64_P32_TLS_TPREL	186
+#define R_AARCH64_P32_TLSDESC	187
+#define R_AARCH64_P32_IRELATIVE	188
+#define R_AARCH64_ABS64         257
+#define R_AARCH64_ABS32         258
+#define R_AARCH64_ABS16		259
+#define R_AARCH64_PREL64	260
+#define R_AARCH64_PREL32	261
+#define R_AARCH64_PREL16	262
+#define R_AARCH64_MOVW_UABS_G0	263
+#define R_AARCH64_MOVW_UABS_G0_NC 264
+#define R_AARCH64_MOVW_UABS_G1	265
+#define R_AARCH64_MOVW_UABS_G1_NC 266
+#define R_AARCH64_MOVW_UABS_G2	267
+#define R_AARCH64_MOVW_UABS_G2_NC 268
+#define R_AARCH64_MOVW_UABS_G3	269
+#define R_AARCH64_MOVW_SABS_G0	270
+#define R_AARCH64_MOVW_SABS_G1	271
+#define R_AARCH64_MOVW_SABS_G2	272
+#define R_AARCH64_LD_PREL_LO19	273
+#define R_AARCH64_ADR_PREL_LO21	274
+#define R_AARCH64_ADR_PREL_PG_HI21 275
+#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
+#define R_AARCH64_ADD_ABS_LO12_NC 277
+#define R_AARCH64_LDST8_ABS_LO12_NC 278
+#define R_AARCH64_TSTBR14	279
+#define R_AARCH64_CONDBR19	280
+#define R_AARCH64_JUMP26	282
+#define R_AARCH64_CALL26	283
+#define R_AARCH64_LDST16_ABS_LO12_NC 284
+#define R_AARCH64_LDST32_ABS_LO12_NC 285
+#define R_AARCH64_LDST64_ABS_LO12_NC 286
+#define R_AARCH64_MOVW_PREL_G0	287
+#define R_AARCH64_MOVW_PREL_G0_NC 288
+#define R_AARCH64_MOVW_PREL_G1	289
+#define R_AARCH64_MOVW_PREL_G1_NC 290
+#define R_AARCH64_MOVW_PREL_G2	291
+#define R_AARCH64_MOVW_PREL_G2_NC 292
+#define R_AARCH64_MOVW_PREL_G3	293
+#define R_AARCH64_LDST128_ABS_LO12_NC 299
+#define R_AARCH64_MOVW_GOTOFF_G0 300
+#define R_AARCH64_MOVW_GOTOFF_G0_NC 301
+#define R_AARCH64_MOVW_GOTOFF_G1 302
+#define R_AARCH64_MOVW_GOTOFF_G1_NC 303
+#define R_AARCH64_MOVW_GOTOFF_G2 304
+#define R_AARCH64_MOVW_GOTOFF_G2_NC 305
+#define R_AARCH64_MOVW_GOTOFF_G3 306
+#define R_AARCH64_GOTREL64	307
+#define R_AARCH64_GOTREL32	308
+#define R_AARCH64_GOT_LD_PREL19	309
+#define R_AARCH64_LD64_GOTOFF_LO15 310
+#define R_AARCH64_ADR_GOT_PAGE	311
+#define R_AARCH64_LD64_GOT_LO12_NC 312
+#define R_AARCH64_LD64_GOTPAGE_LO15 313
+#define R_AARCH64_TLSGD_ADR_PREL21 512
+#define R_AARCH64_TLSGD_ADR_PAGE21 513
+#define R_AARCH64_TLSGD_ADD_LO12_NC 514
+#define R_AARCH64_TLSGD_MOVW_G1	515
+#define R_AARCH64_TLSGD_MOVW_G0_NC 516
+#define R_AARCH64_TLSLD_ADR_PREL21 517
+#define R_AARCH64_TLSLD_ADR_PAGE21 518
+#define R_AARCH64_TLSLD_ADD_LO12_NC 519
+#define R_AARCH64_TLSLD_MOVW_G1	520
+#define R_AARCH64_TLSLD_MOVW_G0_NC 521
+#define R_AARCH64_TLSLD_LD_PREL19 522
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526
+#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527
+#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529
+#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531
+#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533
+#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535
+#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537
+#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539
+#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540
+#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541
+#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542
+#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543
+#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545
+#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547
+#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548
+#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550
+#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552
+#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554
+#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556
+#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558
+#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559
+#define R_AARCH64_TLSDESC_LD_PREL19 560
+#define R_AARCH64_TLSDESC_ADR_PREL21 561
+#define R_AARCH64_TLSDESC_ADR_PAGE21 562
+#define R_AARCH64_TLSDESC_LD64_LO12 563
+#define R_AARCH64_TLSDESC_ADD_LO12 564
+#define R_AARCH64_TLSDESC_OFF_G1 565
+#define R_AARCH64_TLSDESC_OFF_G0_NC 566
+#define R_AARCH64_TLSDESC_LDR	567
+#define R_AARCH64_TLSDESC_ADD	568
+#define R_AARCH64_TLSDESC_CALL	569
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570
+#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572
+#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573
+#define R_AARCH64_COPY         1024
+#define R_AARCH64_GLOB_DAT     1025
+#define R_AARCH64_JUMP_SLOT    1026
+#define R_AARCH64_RELATIVE     1027
+#define R_AARCH64_TLS_DTPMOD   1028
+#define R_AARCH64_TLS_DTPMOD64 1028
+#define R_AARCH64_TLS_DTPREL   1029
+#define R_AARCH64_TLS_DTPREL64 1029
+#define R_AARCH64_TLS_TPREL    1030
+#define R_AARCH64_TLS_TPREL64  1030
+#define R_AARCH64_TLSDESC      1031
+
+
+#define R_ARM_NONE		0
+#define R_ARM_PC24		1
+#define R_ARM_ABS32		2
+#define R_ARM_REL32		3
+#define R_ARM_PC13		4
+#define R_ARM_ABS16		5
+#define R_ARM_ABS12		6
+#define R_ARM_THM_ABS5		7
+#define R_ARM_ABS8		8
+#define R_ARM_SBREL32		9
+#define R_ARM_THM_PC22		10
+#define R_ARM_THM_PC8		11
+#define R_ARM_AMP_VCALL9	12
+#define R_ARM_TLS_DESC		13
+#define R_ARM_THM_SWI8		14
+#define R_ARM_XPC25		15
+#define R_ARM_THM_XPC22		16
+#define R_ARM_TLS_DTPMOD32	17
+#define R_ARM_TLS_DTPOFF32	18
+#define R_ARM_TLS_TPOFF32	19
+#define R_ARM_COPY		20
+#define R_ARM_GLOB_DAT		21
+#define R_ARM_JUMP_SLOT		22
+#define R_ARM_RELATIVE		23
+#define R_ARM_GOTOFF		24
+#define R_ARM_GOTPC		25
+#define R_ARM_GOT32		26
+#define R_ARM_PLT32		27
+#define R_ARM_CALL		28
+#define R_ARM_JUMP24		29
+#define R_ARM_THM_JUMP24	30
+#define R_ARM_BASE_ABS		31
+#define R_ARM_ALU_PCREL_7_0	32
+#define R_ARM_ALU_PCREL_15_8	33
+#define R_ARM_ALU_PCREL_23_15	34
+#define R_ARM_LDR_SBREL_11_0	35
+#define R_ARM_ALU_SBREL_19_12	36
+#define R_ARM_ALU_SBREL_27_20	37
+#define R_ARM_TARGET1		38
+#define R_ARM_SBREL31		39
+#define R_ARM_V4BX		40
+#define R_ARM_TARGET2		41
+#define R_ARM_PREL31		42
+#define R_ARM_MOVW_ABS_NC	43
+#define R_ARM_MOVT_ABS		44
+#define R_ARM_MOVW_PREL_NC	45
+#define R_ARM_MOVT_PREL		46
+#define R_ARM_THM_MOVW_ABS_NC	47
+#define R_ARM_THM_MOVT_ABS	48
+#define R_ARM_THM_MOVW_PREL_NC	49
+#define R_ARM_THM_MOVT_PREL	50
+#define R_ARM_THM_JUMP19	51
+#define R_ARM_THM_JUMP6		52
+#define R_ARM_THM_ALU_PREL_11_0	53
+#define R_ARM_THM_PC12		54
+#define R_ARM_ABS32_NOI		55
+#define R_ARM_REL32_NOI		56
+#define R_ARM_ALU_PC_G0_NC	57
+#define R_ARM_ALU_PC_G0		58
+#define R_ARM_ALU_PC_G1_NC	59
+#define R_ARM_ALU_PC_G1		60
+#define R_ARM_ALU_PC_G2		61
+#define R_ARM_LDR_PC_G1		62
+#define R_ARM_LDR_PC_G2		63
+#define R_ARM_LDRS_PC_G0	64
+#define R_ARM_LDRS_PC_G1	65
+#define R_ARM_LDRS_PC_G2	66
+#define R_ARM_LDC_PC_G0		67
+#define R_ARM_LDC_PC_G1		68
+#define R_ARM_LDC_PC_G2		69
+#define R_ARM_ALU_SB_G0_NC	70
+#define R_ARM_ALU_SB_G0		71
+#define R_ARM_ALU_SB_G1_NC	72
+#define R_ARM_ALU_SB_G1		73
+#define R_ARM_ALU_SB_G2		74
+#define R_ARM_LDR_SB_G0		75
+#define R_ARM_LDR_SB_G1		76
+#define R_ARM_LDR_SB_G2		77
+#define R_ARM_LDRS_SB_G0	78
+#define R_ARM_LDRS_SB_G1	79
+#define R_ARM_LDRS_SB_G2	80
+#define R_ARM_LDC_SB_G0		81
+#define R_ARM_LDC_SB_G1		82
+#define R_ARM_LDC_SB_G2		83
+#define R_ARM_MOVW_BREL_NC	84
+#define R_ARM_MOVT_BREL		85
+#define R_ARM_MOVW_BREL		86
+#define R_ARM_THM_MOVW_BREL_NC	87
+#define R_ARM_THM_MOVT_BREL	88
+#define R_ARM_THM_MOVW_BREL	89
+#define R_ARM_TLS_GOTDESC	90
+#define R_ARM_TLS_CALL		91
+#define R_ARM_TLS_DESCSEQ	92
+#define R_ARM_THM_TLS_CALL	93
+#define R_ARM_PLT32_ABS		94
+#define R_ARM_GOT_ABS		95
+#define R_ARM_GOT_PREL		96
+#define R_ARM_GOT_BREL12	97
+#define R_ARM_GOTOFF12		98
+#define R_ARM_GOTRELAX		99
+#define R_ARM_GNU_VTENTRY	100
+#define R_ARM_GNU_VTINHERIT	101
+#define R_ARM_THM_PC11		102
+#define R_ARM_THM_PC9		103
+#define R_ARM_TLS_GD32		104
+
+#define R_ARM_TLS_LDM32		105
+
+#define R_ARM_TLS_LDO32		106
+
+#define R_ARM_TLS_IE32		107
+
+#define R_ARM_TLS_LE32		108
+#define R_ARM_TLS_LDO12		109
+#define R_ARM_TLS_LE12		110
+#define R_ARM_TLS_IE12GP	111
+#define R_ARM_ME_TOO		128
+#define R_ARM_THM_TLS_DESCSEQ	129
+#define R_ARM_THM_TLS_DESCSEQ16	129
+#define R_ARM_THM_TLS_DESCSEQ32	130
+#define R_ARM_THM_GOT_BREL12	131
+#define R_ARM_IRELATIVE		160
+#define R_ARM_RXPC25		249
+#define R_ARM_RSBREL32		250
+#define R_ARM_THM_RPC22		251
+#define R_ARM_RREL32		252
+#define R_ARM_RABS22		253
+#define R_ARM_RPC24		254
+#define R_ARM_RBASE		255
+
+#define R_ARM_NUM		256
+
+
+#define R_CKCORE_NONE               0
+#define R_CKCORE_ADDR32             1
+#define R_CKCORE_PCRELIMM8BY4       2
+#define R_CKCORE_PCRELIMM11BY2      3
+#define R_CKCORE_PCREL32            5
+#define R_CKCORE_PCRELJSR_IMM11BY2  6
+#define R_CKCORE_RELATIVE           9
+#define R_CKCORE_COPY               10
+#define R_CKCORE_GLOB_DAT           11
+#define R_CKCORE_JUMP_SLOT          12
+#define R_CKCORE_GOTOFF             13
+#define R_CKCORE_GOTPC              14
+#define R_CKCORE_GOT32              15
+#define R_CKCORE_PLT32              16
+#define R_CKCORE_ADDRGOT            17
+#define R_CKCORE_ADDRPLT            18
+#define R_CKCORE_PCREL_IMM26BY2     19
+#define R_CKCORE_PCREL_IMM16BY2     20
+#define R_CKCORE_PCREL_IMM16BY4     21
+#define R_CKCORE_PCREL_IMM10BY2     22
+#define R_CKCORE_PCREL_IMM10BY4     23
+#define R_CKCORE_ADDR_HI16          24
+#define R_CKCORE_ADDR_LO16          25
+#define R_CKCORE_GOTPC_HI16         26
+#define R_CKCORE_GOTPC_LO16         27
+#define R_CKCORE_GOTOFF_HI16        28
+#define R_CKCORE_GOTOFF_LO16        29
+#define R_CKCORE_GOT12              30
+#define R_CKCORE_GOT_HI16           31
+#define R_CKCORE_GOT_LO16           32
+#define R_CKCORE_PLT12              33
+#define R_CKCORE_PLT_HI16           34
+#define R_CKCORE_PLT_LO16           35
+#define R_CKCORE_ADDRGOT_HI16       36
+#define R_CKCORE_ADDRGOT_LO16       37
+#define R_CKCORE_ADDRPLT_HI16       38
+#define R_CKCORE_ADDRPLT_LO16       39
+#define R_CKCORE_PCREL_JSR_IMM26BY2 40
+#define R_CKCORE_TOFFSET_LO16       41
+#define R_CKCORE_DOFFSET_LO16       42
+#define R_CKCORE_PCREL_IMM18BY2     43
+#define R_CKCORE_DOFFSET_IMM18      44
+#define R_CKCORE_DOFFSET_IMM18BY2   45
+#define R_CKCORE_DOFFSET_IMM18BY4   46
+#define R_CKCORE_GOT_IMM18BY4       48
+#define R_CKCORE_PLT_IMM18BY4       49
+#define R_CKCORE_PCREL_IMM7BY4      50
+#define R_CKCORE_TLS_LE32           51
+#define R_CKCORE_TLS_IE32           52
+#define R_CKCORE_TLS_GD32           53
+#define R_CKCORE_TLS_LDM32          54
+#define R_CKCORE_TLS_LDO32          55
+#define R_CKCORE_TLS_DTPMOD32       56
+#define R_CKCORE_TLS_DTPOFF32       57
+#define R_CKCORE_TLS_TPOFF32        58
+
+
+#define EF_IA_64_MASKOS		0x0000000f
+#define EF_IA_64_ABI64		0x00000010
+#define EF_IA_64_ARCH		0xff000000
+
+
+#define PT_IA_64_ARCHEXT	(PT_LOPROC + 0)
+#define PT_IA_64_UNWIND		(PT_LOPROC + 1)
+#define PT_IA_64_HP_OPT_ANOT	(PT_LOOS + 0x12)
+#define PT_IA_64_HP_HSL_ANOT	(PT_LOOS + 0x13)
+#define PT_IA_64_HP_STACK	(PT_LOOS + 0x14)
+
+
+#define PF_IA_64_NORECOV	0x80000000
+
+
+#define SHT_IA_64_EXT		(SHT_LOPROC + 0)
+#define SHT_IA_64_UNWIND	(SHT_LOPROC + 1)
+
+
+#define SHF_IA_64_SHORT		0x10000000
+#define SHF_IA_64_NORECOV	0x20000000
+
+
+#define DT_IA_64_PLT_RESERVE	(DT_LOPROC + 0)
+#define DT_IA_64_NUM		1
+
+
+#define R_IA64_NONE		0x00
+#define R_IA64_IMM14		0x21
+#define R_IA64_IMM22		0x22
+#define R_IA64_IMM64		0x23
+#define R_IA64_DIR32MSB		0x24
+#define R_IA64_DIR32LSB		0x25
+#define R_IA64_DIR64MSB		0x26
+#define R_IA64_DIR64LSB		0x27
+#define R_IA64_GPREL22		0x2a
+#define R_IA64_GPREL64I		0x2b
+#define R_IA64_GPREL32MSB	0x2c
+#define R_IA64_GPREL32LSB	0x2d
+#define R_IA64_GPREL64MSB	0x2e
+#define R_IA64_GPREL64LSB	0x2f
+#define R_IA64_LTOFF22		0x32
+#define R_IA64_LTOFF64I		0x33
+#define R_IA64_PLTOFF22		0x3a
+#define R_IA64_PLTOFF64I	0x3b
+#define R_IA64_PLTOFF64MSB	0x3e
+#define R_IA64_PLTOFF64LSB	0x3f
+#define R_IA64_FPTR64I		0x43
+#define R_IA64_FPTR32MSB	0x44
+#define R_IA64_FPTR32LSB	0x45
+#define R_IA64_FPTR64MSB	0x46
+#define R_IA64_FPTR64LSB	0x47
+#define R_IA64_PCREL60B		0x48
+#define R_IA64_PCREL21B		0x49
+#define R_IA64_PCREL21M		0x4a
+#define R_IA64_PCREL21F		0x4b
+#define R_IA64_PCREL32MSB	0x4c
+#define R_IA64_PCREL32LSB	0x4d
+#define R_IA64_PCREL64MSB	0x4e
+#define R_IA64_PCREL64LSB	0x4f
+#define R_IA64_LTOFF_FPTR22	0x52
+#define R_IA64_LTOFF_FPTR64I	0x53
+#define R_IA64_LTOFF_FPTR32MSB	0x54
+#define R_IA64_LTOFF_FPTR32LSB	0x55
+#define R_IA64_LTOFF_FPTR64MSB	0x56
+#define R_IA64_LTOFF_FPTR64LSB	0x57
+#define R_IA64_SEGREL32MSB	0x5c
+#define R_IA64_SEGREL32LSB	0x5d
+#define R_IA64_SEGREL64MSB	0x5e
+#define R_IA64_SEGREL64LSB	0x5f
+#define R_IA64_SECREL32MSB	0x64
+#define R_IA64_SECREL32LSB	0x65
+#define R_IA64_SECREL64MSB	0x66
+#define R_IA64_SECREL64LSB	0x67
+#define R_IA64_REL32MSB		0x6c
+#define R_IA64_REL32LSB		0x6d
+#define R_IA64_REL64MSB		0x6e
+#define R_IA64_REL64LSB		0x6f
+#define R_IA64_LTV32MSB		0x74
+#define R_IA64_LTV32LSB		0x75
+#define R_IA64_LTV64MSB		0x76
+#define R_IA64_LTV64LSB		0x77
+#define R_IA64_PCREL21BI	0x79
+#define R_IA64_PCREL22		0x7a
+#define R_IA64_PCREL64I		0x7b
+#define R_IA64_IPLTMSB		0x80
+#define R_IA64_IPLTLSB		0x81
+#define R_IA64_COPY		0x84
+#define R_IA64_SUB		0x85
+#define R_IA64_LTOFF22X		0x86
+#define R_IA64_LDXMOV		0x87
+#define R_IA64_TPREL14		0x91
+#define R_IA64_TPREL22		0x92
+#define R_IA64_TPREL64I		0x93
+#define R_IA64_TPREL64MSB	0x96
+#define R_IA64_TPREL64LSB	0x97
+#define R_IA64_LTOFF_TPREL22	0x9a
+#define R_IA64_DTPMOD64MSB	0xa6
+#define R_IA64_DTPMOD64LSB	0xa7
+#define R_IA64_LTOFF_DTPMOD22	0xaa
+#define R_IA64_DTPREL14		0xb1
+#define R_IA64_DTPREL22		0xb2
+#define R_IA64_DTPREL64I	0xb3
+#define R_IA64_DTPREL32MSB	0xb4
+#define R_IA64_DTPREL32LSB	0xb5
+#define R_IA64_DTPREL64MSB	0xb6
+#define R_IA64_DTPREL64LSB	0xb7
+#define R_IA64_LTOFF_DTPREL22	0xba
+
+
+#define EF_SH_MACH_MASK		0x1f
+#define EF_SH_UNKNOWN		0x0
+#define EF_SH1			0x1
+#define EF_SH2			0x2
+#define EF_SH3			0x3
+#define EF_SH_DSP		0x4
+#define EF_SH3_DSP		0x5
+#define EF_SH4AL_DSP		0x6
+#define EF_SH3E			0x8
+#define EF_SH4			0x9
+#define EF_SH2E			0xb
+#define EF_SH4A			0xc
+#define EF_SH2A			0xd
+#define EF_SH4_NOFPU		0x10
+#define EF_SH4A_NOFPU		0x11
+#define EF_SH4_NOMMU_NOFPU	0x12
+#define EF_SH2A_NOFPU		0x13
+#define EF_SH3_NOMMU		0x14
+#define EF_SH2A_SH4_NOFPU	0x15
+#define EF_SH2A_SH3_NOFPU	0x16
+#define EF_SH2A_SH4		0x17
+#define EF_SH2A_SH3E		0x18
+
+#define	R_SH_NONE		0
+#define	R_SH_DIR32		1
+#define	R_SH_REL32		2
+#define	R_SH_DIR8WPN		3
+#define	R_SH_IND12W		4
+#define	R_SH_DIR8WPL		5
+#define	R_SH_DIR8WPZ		6
+#define	R_SH_DIR8BP		7
+#define	R_SH_DIR8W		8
+#define	R_SH_DIR8L		9
+#define	R_SH_SWITCH16		25
+#define	R_SH_SWITCH32		26
+#define	R_SH_USES		27
+#define	R_SH_COUNT		28
+#define	R_SH_ALIGN		29
+#define	R_SH_CODE		30
+#define	R_SH_DATA		31
+#define	R_SH_LABEL		32
+#define	R_SH_SWITCH8		33
+#define	R_SH_GNU_VTINHERIT	34
+#define	R_SH_GNU_VTENTRY	35
+#define	R_SH_TLS_GD_32		144
+#define	R_SH_TLS_LD_32		145
+#define	R_SH_TLS_LDO_32		146
+#define	R_SH_TLS_IE_32		147
+#define	R_SH_TLS_LE_32		148
+#define	R_SH_TLS_DTPMOD32	149
+#define	R_SH_TLS_DTPOFF32	150
+#define	R_SH_TLS_TPOFF32	151
+#define	R_SH_GOT32		160
+#define	R_SH_PLT32		161
+#define	R_SH_COPY		162
+#define	R_SH_GLOB_DAT		163
+#define	R_SH_JMP_SLOT		164
+#define	R_SH_RELATIVE		165
+#define	R_SH_GOTOFF		166
+#define	R_SH_GOTPC		167
+#define	R_SH_GOT20		201
+#define	R_SH_GOTOFF20		202
+#define	R_SH_GOTFUNCDESC	203
+#define	R_SH_GOTFUNCDEST20	204
+#define	R_SH_GOTOFFFUNCDESC	205
+#define	R_SH_GOTOFFFUNCDEST20	206
+#define	R_SH_FUNCDESC		207
+#define	R_SH_FUNCDESC_VALUE	208
+
+#define	R_SH_NUM		256
+
+
+
+#define R_390_NONE		0
+#define R_390_8			1
+#define R_390_12		2
+#define R_390_16		3
+#define R_390_32		4
+#define R_390_PC32		5
+#define R_390_GOT12		6
+#define R_390_GOT32		7
+#define R_390_PLT32		8
+#define R_390_COPY		9
+#define R_390_GLOB_DAT		10
+#define R_390_JMP_SLOT		11
+#define R_390_RELATIVE		12
+#define R_390_GOTOFF32		13
+#define R_390_GOTPC		14
+#define R_390_GOT16		15
+#define R_390_PC16		16
+#define R_390_PC16DBL		17
+#define R_390_PLT16DBL		18
+#define R_390_PC32DBL		19
+#define R_390_PLT32DBL		20
+#define R_390_GOTPCDBL		21
+#define R_390_64		22
+#define R_390_PC64		23
+#define R_390_GOT64		24
+#define R_390_PLT64		25
+#define R_390_GOTENT		26
+#define R_390_GOTOFF16		27
+#define R_390_GOTOFF64		28
+#define R_390_GOTPLT12		29
+#define R_390_GOTPLT16		30
+#define R_390_GOTPLT32		31
+#define R_390_GOTPLT64		32
+#define R_390_GOTPLTENT		33
+#define R_390_PLTOFF16		34
+#define R_390_PLTOFF32		35
+#define R_390_PLTOFF64		36
+#define R_390_TLS_LOAD		37
+#define R_390_TLS_GDCALL	38
+
+#define R_390_TLS_LDCALL	39
+
+#define R_390_TLS_GD32		40
+
+#define R_390_TLS_GD64		41
+
+#define R_390_TLS_GOTIE12	42
+
+#define R_390_TLS_GOTIE32	43
+
+#define R_390_TLS_GOTIE64	44
+
+#define R_390_TLS_LDM32		45
+
+#define R_390_TLS_LDM64		46
+
+#define R_390_TLS_IE32		47
+
+#define R_390_TLS_IE64		48
+
+#define R_390_TLS_IEENT		49
+
+#define R_390_TLS_LE32		50
+
+#define R_390_TLS_LE64		51
+
+#define R_390_TLS_LDO32		52
+
+#define R_390_TLS_LDO64		53
+
+#define R_390_TLS_DTPMOD	54
+#define R_390_TLS_DTPOFF	55
+#define R_390_TLS_TPOFF		56
+
+#define R_390_20		57
+#define R_390_GOT20		58
+#define R_390_GOTPLT20		59
+#define R_390_TLS_GOTIE20	60
+
+
+#define R_390_NUM		61
+
+
+
+#define R_CRIS_NONE		0
+#define R_CRIS_8		1
+#define R_CRIS_16		2
+#define R_CRIS_32		3
+#define R_CRIS_8_PCREL		4
+#define R_CRIS_16_PCREL		5
+#define R_CRIS_32_PCREL		6
+#define R_CRIS_GNU_VTINHERIT	7
+#define R_CRIS_GNU_VTENTRY	8
+#define R_CRIS_COPY		9
+#define R_CRIS_GLOB_DAT		10
+#define R_CRIS_JUMP_SLOT	11
+#define R_CRIS_RELATIVE		12
+#define R_CRIS_16_GOT		13
+#define R_CRIS_32_GOT		14
+#define R_CRIS_16_GOTPLT	15
+#define R_CRIS_32_GOTPLT	16
+#define R_CRIS_32_GOTREL	17
+#define R_CRIS_32_PLT_GOTREL	18
+#define R_CRIS_32_PLT_PCREL	19
+
+#define R_CRIS_NUM		20
+
+
+
+#define R_X86_64_NONE		0
+#define R_X86_64_64		1
+#define R_X86_64_PC32		2
+#define R_X86_64_GOT32		3
+#define R_X86_64_PLT32		4
+#define R_X86_64_COPY		5
+#define R_X86_64_GLOB_DAT	6
+#define R_X86_64_JUMP_SLOT	7
+#define R_X86_64_RELATIVE	8
+#define R_X86_64_GOTPCREL	9
+
+#define R_X86_64_32		10
+#define R_X86_64_32S		11
+#define R_X86_64_16		12
+#define R_X86_64_PC16		13
+#define R_X86_64_8		14
+#define R_X86_64_PC8		15
+#define R_X86_64_DTPMOD64	16
+#define R_X86_64_DTPOFF64	17
+#define R_X86_64_TPOFF64	18
+#define R_X86_64_TLSGD		19
+
+#define R_X86_64_TLSLD		20
+
+#define R_X86_64_DTPOFF32	21
+#define R_X86_64_GOTTPOFF	22
+
+#define R_X86_64_TPOFF32	23
+#define R_X86_64_PC64		24
+#define R_X86_64_GOTOFF64	25
+#define R_X86_64_GOTPC32	26
+#define R_X86_64_GOT64		27
+#define R_X86_64_GOTPCREL64	28
+#define R_X86_64_GOTPC64	29
+#define R_X86_64_GOTPLT64	30
+#define R_X86_64_PLTOFF64	31
+#define R_X86_64_SIZE32		32
+#define R_X86_64_SIZE64		33
+
+#define R_X86_64_GOTPC32_TLSDESC 34
+#define R_X86_64_TLSDESC_CALL   35
+
+#define R_X86_64_TLSDESC        36
+#define R_X86_64_IRELATIVE	37
+#define R_X86_64_RELATIVE64	38
+#define R_X86_64_GOTPCRELX	41
+#define R_X86_64_REX_GOTPCRELX	42
+#define R_X86_64_NUM		43
+
+
+
+#define R_MN10300_NONE		0
+#define R_MN10300_32		1
+#define R_MN10300_16		2
+#define R_MN10300_8		3
+#define R_MN10300_PCREL32	4
+#define R_MN10300_PCREL16	5
+#define R_MN10300_PCREL8	6
+#define R_MN10300_GNU_VTINHERIT	7
+#define R_MN10300_GNU_VTENTRY	8
+#define R_MN10300_24		9
+#define R_MN10300_GOTPC32	10
+#define R_MN10300_GOTPC16	11
+#define R_MN10300_GOTOFF32	12
+#define R_MN10300_GOTOFF24	13
+#define R_MN10300_GOTOFF16	14
+#define R_MN10300_PLT32		15
+#define R_MN10300_PLT16		16
+#define R_MN10300_GOT32		17
+#define R_MN10300_GOT24		18
+#define R_MN10300_GOT16		19
+#define R_MN10300_COPY		20
+#define R_MN10300_GLOB_DAT	21
+#define R_MN10300_JMP_SLOT	22
+#define R_MN10300_RELATIVE	23
+
+#define R_MN10300_NUM		24
+
+
+
+#define R_M32R_NONE		0
+#define R_M32R_16		1
+#define R_M32R_32		2
+#define R_M32R_24		3
+#define R_M32R_10_PCREL		4
+#define R_M32R_18_PCREL		5
+#define R_M32R_26_PCREL		6
+#define R_M32R_HI16_ULO		7
+#define R_M32R_HI16_SLO		8
+#define R_M32R_LO16		9
+#define R_M32R_SDA16		10
+#define R_M32R_GNU_VTINHERIT	11
+#define R_M32R_GNU_VTENTRY	12
+
+#define R_M32R_16_RELA		33
+#define R_M32R_32_RELA		34
+#define R_M32R_24_RELA		35
+#define R_M32R_10_PCREL_RELA	36
+#define R_M32R_18_PCREL_RELA	37
+#define R_M32R_26_PCREL_RELA	38
+#define R_M32R_HI16_ULO_RELA	39
+#define R_M32R_HI16_SLO_RELA	40
+#define R_M32R_LO16_RELA	41
+#define R_M32R_SDA16_RELA	42
+#define R_M32R_RELA_GNU_VTINHERIT	43
+#define R_M32R_RELA_GNU_VTENTRY	44
+#define R_M32R_REL32		45
+
+#define R_M32R_GOT24		48
+#define R_M32R_26_PLTREL	49
+#define R_M32R_COPY		50
+#define R_M32R_GLOB_DAT		51
+#define R_M32R_JMP_SLOT		52
+#define R_M32R_RELATIVE		53
+#define R_M32R_GOTOFF		54
+#define R_M32R_GOTPC24		55
+#define R_M32R_GOT16_HI_ULO	56
+
+#define R_M32R_GOT16_HI_SLO	57
+
+#define R_M32R_GOT16_LO		58
+#define R_M32R_GOTPC_HI_ULO	59
+
+#define R_M32R_GOTPC_HI_SLO	60
+
+#define R_M32R_GOTPC_LO		61
+
+#define R_M32R_GOTOFF_HI_ULO	62
+
+#define R_M32R_GOTOFF_HI_SLO	63
+
+#define R_M32R_GOTOFF_LO	64
+#define R_M32R_NUM		256
+
+#define R_MICROBLAZE_NONE 0
+#define R_MICROBLAZE_32 1
+#define R_MICROBLAZE_32_PCREL 2
+#define R_MICROBLAZE_64_PCREL 3
+#define R_MICROBLAZE_32_PCREL_LO 4
+#define R_MICROBLAZE_64 5
+#define R_MICROBLAZE_32_LO 6
+#define R_MICROBLAZE_SRO32 7
+#define R_MICROBLAZE_SRW32 8
+#define R_MICROBLAZE_64_NONE 9
+#define R_MICROBLAZE_32_SYM_OP_SYM 10
+#define R_MICROBLAZE_GNU_VTINHERIT 11
+#define R_MICROBLAZE_GNU_VTENTRY 12
+#define R_MICROBLAZE_GOTPC_64 13
+#define R_MICROBLAZE_GOT_64 14
+#define R_MICROBLAZE_PLT_64 15
+#define R_MICROBLAZE_REL 16
+#define R_MICROBLAZE_JUMP_SLOT 17
+#define R_MICROBLAZE_GLOB_DAT 18
+#define R_MICROBLAZE_GOTOFF_64 19
+#define R_MICROBLAZE_GOTOFF_32 20
+#define R_MICROBLAZE_COPY 21
+#define R_MICROBLAZE_TLS 22
+#define R_MICROBLAZE_TLSGD 23
+#define R_MICROBLAZE_TLSLD 24
+#define R_MICROBLAZE_TLSDTPMOD32 25
+#define R_MICROBLAZE_TLSDTPREL32 26
+#define R_MICROBLAZE_TLSDTPREL64 27
+#define R_MICROBLAZE_TLSGOTTPREL32 28
+#define R_MICROBLAZE_TLSTPREL32	 29
+
+#define DT_NIOS2_GP             0x70000002
+
+#define R_NIOS2_NONE		0
+#define R_NIOS2_S16		1
+#define R_NIOS2_U16		2
+#define R_NIOS2_PCREL16		3
+#define R_NIOS2_CALL26		4
+#define R_NIOS2_IMM5		5
+#define R_NIOS2_CACHE_OPX	6
+#define R_NIOS2_IMM6		7
+#define R_NIOS2_IMM8		8
+#define R_NIOS2_HI16		9
+#define R_NIOS2_LO16		10
+#define R_NIOS2_HIADJ16		11
+#define R_NIOS2_BFD_RELOC_32	12
+#define R_NIOS2_BFD_RELOC_16	13
+#define R_NIOS2_BFD_RELOC_8	14
+#define R_NIOS2_GPREL		15
+#define R_NIOS2_GNU_VTINHERIT	16
+#define R_NIOS2_GNU_VTENTRY	17
+#define R_NIOS2_UJMP		18
+#define R_NIOS2_CJMP		19
+#define R_NIOS2_CALLR		20
+#define R_NIOS2_ALIGN		21
+#define R_NIOS2_GOT16		22
+#define R_NIOS2_CALL16		23
+#define R_NIOS2_GOTOFF_LO	24
+#define R_NIOS2_GOTOFF_HA	25
+#define R_NIOS2_PCREL_LO	26
+#define R_NIOS2_PCREL_HA	27
+#define R_NIOS2_TLS_GD16	28
+#define R_NIOS2_TLS_LDM16	29
+#define R_NIOS2_TLS_LDO16	30
+#define R_NIOS2_TLS_IE16	31
+#define R_NIOS2_TLS_LE16	32
+#define R_NIOS2_TLS_DTPMOD	33
+#define R_NIOS2_TLS_DTPREL	34
+#define R_NIOS2_TLS_TPREL	35
+#define R_NIOS2_COPY		36
+#define R_NIOS2_GLOB_DAT	37
+#define R_NIOS2_JUMP_SLOT	38
+#define R_NIOS2_RELATIVE	39
+#define R_NIOS2_GOTOFF		40
+#define R_NIOS2_CALL26_NOAT	41
+#define R_NIOS2_GOT_LO		42
+#define R_NIOS2_GOT_HA		43
+#define R_NIOS2_CALL_LO		44
+#define R_NIOS2_CALL_HA		45
+
+#define R_OR1K_NONE		0
+#define R_OR1K_32		1
+#define R_OR1K_16		2
+#define R_OR1K_8		3
+#define R_OR1K_LO_16_IN_INSN	4
+#define R_OR1K_HI_16_IN_INSN	5
+#define R_OR1K_INSN_REL_26	6
+#define R_OR1K_GNU_VTENTRY	7
+#define R_OR1K_GNU_VTINHERIT	8
+#define R_OR1K_32_PCREL		9
+#define R_OR1K_16_PCREL		10
+#define R_OR1K_8_PCREL		11
+#define R_OR1K_GOTPC_HI16	12
+#define R_OR1K_GOTPC_LO16	13
+#define R_OR1K_GOT16		14
+#define R_OR1K_PLT26		15
+#define R_OR1K_GOTOFF_HI16	16
+#define R_OR1K_GOTOFF_LO16	17
+#define R_OR1K_COPY		18
+#define R_OR1K_GLOB_DAT		19
+#define R_OR1K_JMP_SLOT		20
+#define R_OR1K_RELATIVE		21
+#define R_OR1K_TLS_GD_HI16	22
+#define R_OR1K_TLS_GD_LO16	23
+#define R_OR1K_TLS_LDM_HI16	24
+#define R_OR1K_TLS_LDM_LO16	25
+#define R_OR1K_TLS_LDO_HI16	26
+#define R_OR1K_TLS_LDO_LO16	27
+#define R_OR1K_TLS_IE_HI16	28
+#define R_OR1K_TLS_IE_LO16	29
+#define R_OR1K_TLS_LE_HI16	30
+#define R_OR1K_TLS_LE_LO16	31
+#define R_OR1K_TLS_TPOFF	32
+#define R_OR1K_TLS_DTPOFF	33
+#define R_OR1K_TLS_DTPMOD	34
+
+#define R_BPF_NONE		0
+#define R_BPF_MAP_FD		1
+
+#define R_RISCV_NONE            0
+#define R_RISCV_32              1
+#define R_RISCV_64              2
+#define R_RISCV_RELATIVE        3
+#define R_RISCV_COPY            4
+#define R_RISCV_JUMP_SLOT       5
+#define R_RISCV_TLS_DTPMOD32    6
+#define R_RISCV_TLS_DTPMOD64    7
+#define R_RISCV_TLS_DTPREL32    8
+#define R_RISCV_TLS_DTPREL64    9
+#define R_RISCV_TLS_TPREL32     10
+#define R_RISCV_TLS_TPREL64     11
+#define R_RISCV_TLSDESC         12
+
+#define R_RISCV_BRANCH          16
+#define R_RISCV_JAL             17
+#define R_RISCV_CALL            18
+#define R_RISCV_CALL_PLT        19
+#define R_RISCV_GOT_HI20        20
+#define R_RISCV_TLS_GOT_HI20    21
+#define R_RISCV_TLS_GD_HI20     22
+#define R_RISCV_PCREL_HI20      23
+#define R_RISCV_PCREL_LO12_I    24
+#define R_RISCV_PCREL_LO12_S    25
+#define R_RISCV_HI20            26
+#define R_RISCV_LO12_I          27
+#define R_RISCV_LO12_S          28
+#define R_RISCV_TPREL_HI20      29
+#define R_RISCV_TPREL_LO12_I    30
+#define R_RISCV_TPREL_LO12_S    31
+#define R_RISCV_TPREL_ADD       32
+#define R_RISCV_ADD8            33
+#define R_RISCV_ADD16           34
+#define R_RISCV_ADD32           35
+#define R_RISCV_ADD64           36
+#define R_RISCV_SUB8            37
+#define R_RISCV_SUB16           38
+#define R_RISCV_SUB32           39
+#define R_RISCV_SUB64           40
+#define R_RISCV_GOT32_PCREL     41
+#define R_RISCV_ALIGN           43
+#define R_RISCV_RVC_BRANCH      44
+#define R_RISCV_RVC_JUMP        45
+#define R_RISCV_RVC_LUI         46
+#define R_RISCV_RELAX           51
+#define R_RISCV_SUB6            52
+#define R_RISCV_SET6            53
+#define R_RISCV_SET8            54
+#define R_RISCV_SET16           55
+#define R_RISCV_SET32           56
+#define R_RISCV_32_PCREL        57
+#define R_RISCV_IRELATIVE       58
+#define R_RISCV_PLT32           59
+#define R_RISCV_SET_ULEB128     60
+#define R_RISCV_SUB_ULEB128     61
+#define R_RISCV_TLSDESC_HI20    62
+#define R_RISCV_TLSDESC_LOAD_LO12 63
+#define R_RISCV_TLSDESC_ADD_LO12  64
+#define R_RISCV_TLSDESC_CALL    65
+
+#define EF_LARCH_ABI_MODIFIER_MASK    0x07
+#define EF_LARCH_ABI_SOFT_FLOAT       0x01
+#define EF_LARCH_ABI_SINGLE_FLOAT     0x02
+#define EF_LARCH_ABI_DOUBLE_FLOAT     0x03
+#define EF_LARCH_OBJABI_V1            0x40
+
+#define R_LARCH_NONE                        0
+#define R_LARCH_32                          1
+#define R_LARCH_64                          2
+#define R_LARCH_RELATIVE                    3
+#define R_LARCH_COPY                        4
+#define R_LARCH_JUMP_SLOT                   5
+#define R_LARCH_TLS_DTPMOD32                6
+#define R_LARCH_TLS_DTPMOD64                7
+#define R_LARCH_TLS_DTPREL32                8
+#define R_LARCH_TLS_DTPREL64                9
+#define R_LARCH_TLS_TPREL32                 10
+#define R_LARCH_TLS_TPREL64                 11
+#define R_LARCH_IRELATIVE                   12
+#define R_LARCH_MARK_LA                     20
+#define R_LARCH_MARK_PCREL                  21
+#define R_LARCH_SOP_PUSH_PCREL              22
+#define R_LARCH_SOP_PUSH_ABSOLUTE           23
+#define R_LARCH_SOP_PUSH_DUP                24
+#define R_LARCH_SOP_PUSH_GPREL              25
+#define R_LARCH_SOP_PUSH_TLS_TPREL          26
+#define R_LARCH_SOP_PUSH_TLS_GOT            27
+#define R_LARCH_SOP_PUSH_TLS_GD             28
+#define R_LARCH_SOP_PUSH_PLT_PCREL          29
+#define R_LARCH_SOP_ASSERT                  30
+#define R_LARCH_SOP_NOT                     31
+#define R_LARCH_SOP_SUB                     32
+#define R_LARCH_SOP_SL                      33
+#define R_LARCH_SOP_SR                      34
+#define R_LARCH_SOP_ADD                     35
+#define R_LARCH_SOP_AND                     36
+#define R_LARCH_SOP_IF_ELSE                 37
+#define R_LARCH_SOP_POP_32_S_10_5           38
+#define R_LARCH_SOP_POP_32_U_10_12          39
+#define R_LARCH_SOP_POP_32_S_10_12          40
+#define R_LARCH_SOP_POP_32_S_10_16          41
+#define R_LARCH_SOP_POP_32_S_10_16_S2       42
+#define R_LARCH_SOP_POP_32_S_5_20           43
+#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2   44
+#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2  45
+#define R_LARCH_SOP_POP_32_U                46
+#define R_LARCH_ADD8                        47
+#define R_LARCH_ADD16                       48
+#define R_LARCH_ADD24                       49
+#define R_LARCH_ADD32                       50
+#define R_LARCH_ADD64                       51
+#define R_LARCH_SUB8                        52
+#define R_LARCH_SUB16                       53
+#define R_LARCH_SUB24                       54
+#define R_LARCH_SUB32                       55
+#define R_LARCH_SUB64                       56
+#define R_LARCH_GNU_VTINHERIT               57
+#define R_LARCH_GNU_VTENTRY                 58
+#define R_LARCH_B16                         64
+#define R_LARCH_B21                         65
+#define R_LARCH_B26                         66
+#define R_LARCH_ABS_HI20                    67
+#define R_LARCH_ABS_LO12                    68
+#define R_LARCH_ABS64_LO20                  69
+#define R_LARCH_ABS64_HI12                  70
+#define R_LARCH_PCALA_HI20                  71
+#define R_LARCH_PCALA_LO12                  72
+#define R_LARCH_PCALA64_LO20                73
+#define R_LARCH_PCALA64_HI12                74
+#define R_LARCH_GOT_PC_HI20                 75
+#define R_LARCH_GOT_PC_LO12                 76
+#define R_LARCH_GOT64_PC_LO20               77
+#define R_LARCH_GOT64_PC_HI12               78
+#define R_LARCH_GOT_HI20                    79
+#define R_LARCH_GOT_LO12                    80
+#define R_LARCH_GOT64_LO20                  81
+#define R_LARCH_GOT64_HI12                  82
+#define R_LARCH_TLS_LE_HI20                 83
+#define R_LARCH_TLS_LE_LO12                 84
+#define R_LARCH_TLS_LE64_LO20               85
+#define R_LARCH_TLS_LE64_HI12               86
+#define R_LARCH_TLS_IE_PC_HI20              87
+#define R_LARCH_TLS_IE_PC_LO12              88
+#define R_LARCH_TLS_IE64_PC_LO20            89
+#define R_LARCH_TLS_IE64_PC_HI12            90
+#define R_LARCH_TLS_IE_HI20                 91
+#define R_LARCH_TLS_IE_LO12                 92
+#define R_LARCH_TLS_IE64_LO20               93
+#define R_LARCH_TLS_IE64_HI12               94
+#define R_LARCH_TLS_LD_PC_HI20              95
+#define R_LARCH_TLS_LD_HI20                 96
+#define R_LARCH_TLS_GD_PC_HI20              97
+#define R_LARCH_TLS_GD_HI20                 98
+#define R_LARCH_32_PCREL                    99
+#define R_LARCH_RELAX                       100
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/musl-include/x86_64/endian.h b/musl-include/x86_64/endian.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/endian.h
@@ -0,0 +1,80 @@
+#ifndef _ENDIAN_H
+#define _ENDIAN_H
+
+#include <features.h>
+
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#include <bits/alltypes.h>
+
+#define __PDP_ENDIAN 3412
+
+#define BIG_ENDIAN __BIG_ENDIAN
+#define LITTLE_ENDIAN __LITTLE_ENDIAN
+#define PDP_ENDIAN __PDP_ENDIAN
+#define BYTE_ORDER __BYTE_ORDER
+
+static __inline uint16_t __bswap16(uint16_t __x)
+{
+	return __x<<8 | __x>>8;
+}
+
+static __inline uint32_t __bswap32(uint32_t __x)
+{
+	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+}
+
+static __inline uint64_t __bswap64(uint64_t __x)
+{
+	return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
+}
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define htobe16(x) __bswap16(x)
+#define be16toh(x) __bswap16(x)
+#define htobe32(x) __bswap32(x)
+#define be32toh(x) __bswap32(x)
+#define htobe64(x) __bswap64(x)
+#define be64toh(x) __bswap64(x)
+#define htole16(x) (uint16_t)(x)
+#define le16toh(x) (uint16_t)(x)
+#define htole32(x) (uint32_t)(x)
+#define le32toh(x) (uint32_t)(x)
+#define htole64(x) (uint64_t)(x)
+#define le64toh(x) (uint64_t)(x)
+#else
+#define htobe16(x) (uint16_t)(x)
+#define be16toh(x) (uint16_t)(x)
+#define htobe32(x) (uint32_t)(x)
+#define be32toh(x) (uint32_t)(x)
+#define htobe64(x) (uint64_t)(x)
+#define be64toh(x) (uint64_t)(x)
+#define htole16(x) __bswap16(x)
+#define le16toh(x) __bswap16(x)
+#define htole32(x) __bswap32(x)
+#define le32toh(x) __bswap32(x)
+#define htole64(x) __bswap64(x)
+#define le64toh(x) __bswap64(x)
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define betoh16(x) __bswap16(x)
+#define betoh32(x) __bswap32(x)
+#define betoh64(x) __bswap64(x)
+#define letoh16(x) (uint16_t)(x)
+#define letoh32(x) (uint32_t)(x)
+#define letoh64(x) (uint64_t)(x)
+#else
+#define betoh16(x) (uint16_t)(x)
+#define betoh32(x) (uint32_t)(x)
+#define betoh64(x) (uint64_t)(x)
+#define letoh16(x) __bswap16(x)
+#define letoh32(x) __bswap32(x)
+#define letoh64(x) __bswap64(x)
+#endif
+#endif
+
+#endif
diff --git a/musl-include/x86_64/err.h b/musl-include/x86_64/err.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/err.h
@@ -0,0 +1,25 @@
+#ifndef _ERR_H
+#define _ERR_H
+
+#include <features.h>
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void warn(const char *, ...);
+void vwarn(const char *, va_list);
+void warnx(const char *, ...);
+void vwarnx(const char *, va_list);
+
+_Noreturn void err(int, const char *, ...);
+_Noreturn void verr(int, const char *, va_list);
+_Noreturn void errx(int, const char *, ...);
+_Noreturn void verrx(int, const char *, va_list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/errno.h b/musl-include/x86_64/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/errno.h
@@ -0,0 +1,27 @@
+#ifndef	_ERRNO_H
+#define _ERRNO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/errno.h>
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int *__errno_location(void);
+#define errno (*__errno_location())
+
+#ifdef _GNU_SOURCE
+extern char *program_invocation_short_name, *program_invocation_name;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/x86_64/fcntl.h b/musl-include/x86_64/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/fcntl.h
@@ -0,0 +1,218 @@
+#ifndef	_FCNTL_H
+#define	_FCNTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_mode_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_struct_iovec
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/fcntl.h>
+
+struct flock {
+	short l_type;
+	short l_whence;
+	off_t l_start;
+	off_t l_len;
+	pid_t l_pid;
+};
+
+int creat(const char *, mode_t);
+int fcntl(int, int, ...);
+int open(const char *, int, ...);
+int openat(int, const char *, int, ...);
+int posix_fadvise(int, off_t, off_t, int);
+int posix_fallocate(int, off_t, off_t);
+
+#define O_SEARCH   O_PATH
+#define O_EXEC     O_PATH
+#define O_TTY_INIT 0
+
+#define O_ACCMODE (03|O_SEARCH)
+#define O_RDONLY  00
+#define O_WRONLY  01
+#define O_RDWR    02
+
+#define F_OFD_GETLK 36
+#define F_OFD_SETLK 37
+#define F_OFD_SETLKW 38
+
+#define F_DUPFD_CLOEXEC 1030
+
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+#define FD_CLOEXEC 1
+
+#define AT_FDCWD (-100)
+#define AT_SYMLINK_NOFOLLOW 0x100
+#define AT_REMOVEDIR 0x200
+#define AT_SYMLINK_FOLLOW 0x400
+#define AT_EACCESS 0x200
+
+#define POSIX_FADV_NORMAL     0
+#define POSIX_FADV_RANDOM     1
+#define POSIX_FADV_SEQUENTIAL 2
+#define POSIX_FADV_WILLNEED   3
+#ifndef POSIX_FADV_DONTNEED
+#define POSIX_FADV_DONTNEED   4
+#define POSIX_FADV_NOREUSE    5
+#endif
+
+#undef SEEK_SET
+#undef SEEK_CUR
+#undef SEEK_END
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#ifndef S_IRUSR
+#define S_ISUID 04000
+#define S_ISGID 02000
+#define S_ISVTX 01000
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXU 0700
+#define S_IRGRP 0040
+#define S_IWGRP 0020
+#define S_IXGRP 0010
+#define S_IRWXG 0070
+#define S_IROTH 0004
+#define S_IWOTH 0002
+#define S_IXOTH 0001
+#define S_IRWXO 0007
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define AT_NO_AUTOMOUNT 0x800
+#define AT_EMPTY_PATH 0x1000
+#define AT_STATX_SYNC_TYPE 0x6000
+#define AT_STATX_SYNC_AS_STAT 0x0000
+#define AT_STATX_FORCE_SYNC 0x2000
+#define AT_STATX_DONT_SYNC 0x4000
+#define AT_RECURSIVE 0x8000
+
+#define FAPPEND O_APPEND
+#define FFSYNC O_SYNC
+#define FASYNC O_ASYNC
+#define FNONBLOCK O_NONBLOCK
+#define FNDELAY O_NDELAY
+
+#define F_OK 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+#define F_ULOCK 0
+#define F_LOCK  1
+#define F_TLOCK 2
+#define F_TEST  3
+
+#define F_SETLEASE	1024
+#define F_GETLEASE	1025
+#define F_NOTIFY	1026
+#define F_CANCELLK	1029
+#define F_SETPIPE_SZ	1031
+#define F_GETPIPE_SZ	1032
+#define F_ADD_SEALS	1033
+#define F_GET_SEALS	1034
+
+#define F_SEAL_SEAL	0x0001
+#define F_SEAL_SHRINK	0x0002
+#define F_SEAL_GROW	0x0004
+#define F_SEAL_WRITE	0x0008
+#define F_SEAL_FUTURE_WRITE	0x0010
+
+#define F_GET_RW_HINT		1035
+#define F_SET_RW_HINT		1036
+#define F_GET_FILE_RW_HINT	1037
+#define F_SET_FILE_RW_HINT	1038
+
+#define RWF_WRITE_LIFE_NOT_SET	0
+#define RWH_WRITE_LIFE_NONE	1
+#define RWH_WRITE_LIFE_SHORT	2
+#define RWH_WRITE_LIFE_MEDIUM	3
+#define RWH_WRITE_LIFE_LONG	4
+#define RWH_WRITE_LIFE_EXTREME	5
+
+#define DN_ACCESS	0x00000001
+#define DN_MODIFY	0x00000002
+#define DN_CREATE	0x00000004
+#define DN_DELETE	0x00000008
+#define DN_RENAME	0x00000010
+#define DN_ATTRIB	0x00000020
+#define DN_MULTISHOT	0x80000000
+
+int lockf(int, int, off_t);
+#endif
+
+#if defined(_GNU_SOURCE)
+#define F_OWNER_TID 0
+#define F_OWNER_PID 1
+#define F_OWNER_PGRP 2
+#define F_OWNER_GID 2
+struct file_handle {
+	unsigned handle_bytes;
+	int handle_type;
+	unsigned char f_handle[];
+};
+struct f_owner_ex {
+	int type;
+	pid_t pid;
+};
+#define FALLOC_FL_KEEP_SIZE 1
+#define FALLOC_FL_PUNCH_HOLE 2
+#define MAX_HANDLE_SZ 128
+#define SYNC_FILE_RANGE_WAIT_BEFORE 1
+#define SYNC_FILE_RANGE_WRITE 2
+#define SYNC_FILE_RANGE_WAIT_AFTER 4
+#define SPLICE_F_MOVE 1
+#define SPLICE_F_NONBLOCK 2
+#define SPLICE_F_MORE 4
+#define SPLICE_F_GIFT 8
+int fallocate(int, int, off_t, off_t);
+int name_to_handle_at(int, const char *, struct file_handle *, int *, int);
+int open_by_handle_at(int, struct file_handle *, int);
+ssize_t readahead(int, off_t, size_t);
+int sync_file_range(int, off_t, off_t, unsigned);
+ssize_t vmsplice(int, const struct iovec *, size_t, unsigned);
+ssize_t splice(int, off_t *, int, off_t *, size_t, unsigned);
+ssize_t tee(int, int, size_t, unsigned);
+#define loff_t off_t
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define F_GETLK64 F_GETLK
+#define F_SETLK64 F_SETLK
+#define F_SETLKW64 F_SETLKW
+#define flock64 flock
+#define open64 open
+#define openat64 openat
+#define creat64 creat
+#define lockf64 lockf
+#define posix_fadvise64 posix_fadvise
+#define posix_fallocate64 posix_fallocate
+#define off64_t off_t
+#if defined(_GNU_SOURCE)
+#define fallocate64 fallocate
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/features.h b/musl-include/x86_64/features.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/features.h
@@ -0,0 +1,40 @@
+#ifndef _FEATURES_H
+#define _FEATURES_H
+
+#if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE)
+#define _GNU_SOURCE 1
+#endif
+
+#if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE)
+#define _BSD_SOURCE 1
+#endif
+
+#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
+ && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
+ && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)
+#define _BSD_SOURCE 1
+#define _XOPEN_SOURCE 700
+#endif
+
+#if __STDC_VERSION__ >= 199901L
+#define __restrict restrict
+#elif !defined(__GNUC__)
+#define __restrict
+#endif
+
+#if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
+#define __inline inline
+#elif !defined(__GNUC__)
+#define __inline
+#endif
+
+#if __STDC_VERSION__ >= 201112L
+#elif defined(__GNUC__)
+#define _Noreturn __attribute__((__noreturn__))
+#else
+#define _Noreturn
+#endif
+
+#define __REDIR(x,y) __typeof__(x) x __asm__(#y)
+
+#endif
diff --git a/musl-include/x86_64/fenv.h b/musl-include/x86_64/fenv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/fenv.h
@@ -0,0 +1,28 @@
+#ifndef _FENV_H
+#define _FENV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bits/fenv.h>
+
+int feclearexcept(int);
+int fegetexceptflag(fexcept_t *, int);
+int feraiseexcept(int);
+int fesetexceptflag(const fexcept_t *, int);
+int fetestexcept(int);
+
+int fegetround(void);
+int fesetround(int);
+
+int fegetenv(fenv_t *);
+int feholdexcept(fenv_t *);
+int fesetenv(const fenv_t *);
+int feupdateenv(const fenv_t *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/musl-include/x86_64/float.h b/musl-include/x86_64/float.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/float.h
@@ -0,0 +1,52 @@
+#ifndef _FLOAT_H
+#define _FLOAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __flt_rounds(void);
+#define FLT_ROUNDS (__flt_rounds())
+
+#define FLT_RADIX 2
+
+#define FLT_TRUE_MIN 1.40129846432481707092e-45F
+#define FLT_MIN 1.17549435082228750797e-38F
+#define FLT_MAX 3.40282346638528859812e+38F
+#define FLT_EPSILON 1.1920928955078125e-07F
+
+#define FLT_MANT_DIG 24
+#define FLT_MIN_EXP (-125)
+#define FLT_MAX_EXP 128
+#define FLT_HAS_SUBNORM 1
+
+#define FLT_DIG 6
+#define FLT_DECIMAL_DIG 9
+#define FLT_MIN_10_EXP (-37)
+#define FLT_MAX_10_EXP 38
+
+#define DBL_TRUE_MIN 4.94065645841246544177e-324
+#define DBL_MIN 2.22507385850720138309e-308
+#define DBL_MAX 1.79769313486231570815e+308
+#define DBL_EPSILON 2.22044604925031308085e-16
+
+#define DBL_MANT_DIG 53
+#define DBL_MIN_EXP (-1021)
+#define DBL_MAX_EXP 1024
+#define DBL_HAS_SUBNORM 1
+
+#define DBL_DIG 15
+#define DBL_DECIMAL_DIG 17
+#define DBL_MIN_10_EXP (-307)
+#define DBL_MAX_10_EXP 308
+
+#define LDBL_HAS_SUBNORM 1
+#define LDBL_DECIMAL_DIG DECIMAL_DIG
+
+#include <bits/float.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/fmtmsg.h b/musl-include/x86_64/fmtmsg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/fmtmsg.h
@@ -0,0 +1,47 @@
+#ifndef _FMTMSG_H
+#define _FMTMSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MM_HARD		1
+#define MM_SOFT		2
+#define MM_FIRM		4
+
+#define MM_APPL		8
+#define MM_UTIL		16
+#define MM_OPSYS	32
+
+#define MM_RECOVER	64
+#define MM_NRECOV	128
+
+#define MM_PRINT	256
+#define MM_CONSOLE	512
+
+#define MM_NULLMC	0L
+
+#define MM_HALT		1
+#define MM_ERROR	2
+#define MM_WARNING	3
+#define MM_INFO		4
+#define MM_NOSEV	0
+
+#define MM_OK		0
+#define MM_NOTOK	(-1)
+#define MM_NOMSG	1
+#define MM_NOCON	4
+
+#define MM_NULLLBL	((char*)0)
+#define MM_NULLTXT	((char*)0)
+#define MM_NULLACT	((char*)0)
+#define MM_NULLTAG	((char*)0)
+#define MM_NULLSEV	0
+
+int fmtmsg(long, const char *, int, const char *, const char *, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/fnmatch.h b/musl-include/x86_64/fnmatch.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/fnmatch.h
@@ -0,0 +1,24 @@
+#ifndef	_FNMATCH_H
+#define	_FNMATCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	FNM_PATHNAME 0x1
+#define	FNM_NOESCAPE 0x2
+#define	FNM_PERIOD   0x4
+#define	FNM_LEADING_DIR	0x8           
+#define	FNM_CASEFOLD	0x10
+#define	FNM_FILE_NAME	FNM_PATHNAME
+
+#define	FNM_NOMATCH 1
+#define FNM_NOSYS   (-1)
+
+int fnmatch(const char *, const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/ftw.h b/musl-include/x86_64/ftw.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/ftw.h
@@ -0,0 +1,41 @@
+#ifndef _FTW_H
+#define	_FTW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/stat.h>
+
+#define FTW_F   1
+#define FTW_D   2
+#define FTW_DNR 3
+#define FTW_NS  4
+#define FTW_SL  5
+#define FTW_DP  6
+#define FTW_SLN 7
+
+#define FTW_PHYS  1
+#define FTW_MOUNT 2
+#define FTW_CHDIR 4
+#define FTW_DEPTH 8
+
+struct FTW {
+	int base;
+	int level;
+};
+
+int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
+int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define ftw64 ftw
+#define nftw64 nftw
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/getopt.h b/musl-include/x86_64/getopt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/getopt.h
@@ -0,0 +1,30 @@
+#ifndef _GETOPT_H
+#define _GETOPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int getopt(int, char * const [], const char *);
+extern char *optarg;
+extern int optind, opterr, optopt, optreset;
+
+struct option {
+	const char *name;
+	int has_arg;
+	int *flag;
+	int val;
+};
+
+int getopt_long(int, char *const *, const char *, const struct option *, int *);
+int getopt_long_only(int, char *const *, const char *, const struct option *, int *);
+
+#define no_argument        0
+#define required_argument  1
+#define optional_argument  2
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/glob.h b/musl-include/x86_64/glob.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/glob.h
@@ -0,0 +1,52 @@
+#ifndef	_GLOB_H
+#define	_GLOB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef struct {
+	size_t gl_pathc;
+	char **gl_pathv;
+	size_t gl_offs;
+	int __dummy1;
+	void *__dummy2[5];
+} glob_t;
+
+int  glob(const char *__restrict, int, int (*)(const char *, int), glob_t *__restrict);
+void globfree(glob_t *);
+
+#define GLOB_ERR      0x01
+#define GLOB_MARK     0x02
+#define GLOB_NOSORT   0x04
+#define GLOB_DOOFFS   0x08
+#define GLOB_NOCHECK  0x10
+#define GLOB_APPEND   0x20
+#define GLOB_NOESCAPE 0x40
+#define	GLOB_PERIOD   0x80
+
+#define GLOB_TILDE       0x1000
+#define GLOB_TILDE_CHECK 0x4000
+
+#define GLOB_NOSPACE 1
+#define GLOB_ABORTED 2
+#define GLOB_NOMATCH 3
+#define GLOB_NOSYS   4
+
+#if defined(_LARGEFILE64_SOURCE)
+#define glob64 glob
+#define globfree64 globfree
+#define glob64_t glob_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/grp.h b/musl-include/x86_64/grp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/grp.h
@@ -0,0 +1,53 @@
+#ifndef	_GRP_H
+#define	_GRP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_gid_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_FILE
+#endif
+
+#include <bits/alltypes.h>
+
+struct group {
+	char *gr_name;
+	char *gr_passwd;
+	gid_t gr_gid;
+	char **gr_mem;
+};
+
+struct group  *getgrgid(gid_t);
+struct group  *getgrnam(const char *);
+
+int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
+int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct group  *getgrent(void);
+void           endgrent(void);
+void           setgrent(void);
+#endif
+
+#ifdef _GNU_SOURCE
+struct group  *fgetgrent(FILE *);
+int putgrent(const struct group *, FILE *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int getgrouplist(const char *, gid_t, gid_t *, int *);
+int setgroups(size_t, const gid_t *);
+int initgroups(const char *, gid_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/iconv.h b/musl-include/x86_64/iconv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/iconv.h
@@ -0,0 +1,24 @@
+#ifndef _ICONV_H
+#define _ICONV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef void *iconv_t;
+
+iconv_t iconv_open(const char *, const char *);
+size_t iconv(iconv_t, char **__restrict, size_t *__restrict, char **__restrict, size_t *__restrict);
+int iconv_close(iconv_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/ifaddrs.h b/musl-include/x86_64/ifaddrs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/ifaddrs.h
@@ -0,0 +1,35 @@
+#ifndef _IFADDRS_H
+#define _IFADDRS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+
+struct ifaddrs {
+	struct ifaddrs *ifa_next;
+	char *ifa_name;
+	unsigned ifa_flags;
+	struct sockaddr *ifa_addr;
+	struct sockaddr *ifa_netmask;
+	union {
+		struct sockaddr *ifu_broadaddr;
+		struct sockaddr *ifu_dstaddr;
+	} ifa_ifu;
+	void *ifa_data;
+};
+#define ifa_broadaddr ifa_ifu.ifu_broadaddr
+#define ifa_dstaddr ifa_ifu.ifu_dstaddr
+
+void freeifaddrs(struct ifaddrs *);
+int getifaddrs(struct ifaddrs **);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/x86_64/inttypes.h b/musl-include/x86_64/inttypes.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/inttypes.h
@@ -0,0 +1,229 @@
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <stdint.h>
+
+#define __NEED_wchar_t
+#include <bits/alltypes.h>
+
+typedef struct { intmax_t quot, rem; } imaxdiv_t;
+
+intmax_t imaxabs(intmax_t);
+imaxdiv_t imaxdiv(intmax_t, intmax_t);
+
+intmax_t strtoimax(const char *__restrict, char **__restrict, int);
+uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
+
+intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
+uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
+
+#if UINTPTR_MAX == UINT64_MAX
+#define __PRI64  "l"
+#define __PRIPTR "l"
+#else
+#define __PRI64  "ll"
+#define __PRIPTR ""
+#endif
+
+#define PRId8  "d"
+#define PRId16 "d"
+#define PRId32 "d"
+#define PRId64 __PRI64 "d"
+
+#define PRIdLEAST8  "d"
+#define PRIdLEAST16 "d"
+#define PRIdLEAST32 "d"
+#define PRIdLEAST64 __PRI64 "d"
+
+#define PRIdFAST8  "d"
+#define PRIdFAST16 "d"
+#define PRIdFAST32 "d"
+#define PRIdFAST64 __PRI64 "d"
+
+#define PRIi8  "i"
+#define PRIi16 "i"
+#define PRIi32 "i"
+#define PRIi64 __PRI64 "i"
+
+#define PRIiLEAST8  "i"
+#define PRIiLEAST16 "i"
+#define PRIiLEAST32 "i"
+#define PRIiLEAST64 __PRI64 "i"
+
+#define PRIiFAST8  "i"
+#define PRIiFAST16 "i"
+#define PRIiFAST32 "i"
+#define PRIiFAST64 __PRI64 "i"
+
+#define PRIo8  "o"
+#define PRIo16 "o"
+#define PRIo32 "o"
+#define PRIo64 __PRI64 "o"
+
+#define PRIoLEAST8  "o"
+#define PRIoLEAST16 "o"
+#define PRIoLEAST32 "o"
+#define PRIoLEAST64 __PRI64 "o"
+
+#define PRIoFAST8  "o"
+#define PRIoFAST16 "o"
+#define PRIoFAST32 "o"
+#define PRIoFAST64 __PRI64 "o"
+
+#define PRIu8  "u"
+#define PRIu16 "u"
+#define PRIu32 "u"
+#define PRIu64 __PRI64 "u"
+
+#define PRIuLEAST8  "u"
+#define PRIuLEAST16 "u"
+#define PRIuLEAST32 "u"
+#define PRIuLEAST64 __PRI64 "u"
+
+#define PRIuFAST8  "u"
+#define PRIuFAST16 "u"
+#define PRIuFAST32 "u"
+#define PRIuFAST64 __PRI64 "u"
+
+#define PRIx8  "x"
+#define PRIx16 "x"
+#define PRIx32 "x"
+#define PRIx64 __PRI64 "x"
+
+#define PRIxLEAST8  "x"
+#define PRIxLEAST16 "x"
+#define PRIxLEAST32 "x"
+#define PRIxLEAST64 __PRI64 "x"
+
+#define PRIxFAST8  "x"
+#define PRIxFAST16 "x"
+#define PRIxFAST32 "x"
+#define PRIxFAST64 __PRI64 "x"
+
+#define PRIX8  "X"
+#define PRIX16 "X"
+#define PRIX32 "X"
+#define PRIX64 __PRI64 "X"
+
+#define PRIXLEAST8  "X"
+#define PRIXLEAST16 "X"
+#define PRIXLEAST32 "X"
+#define PRIXLEAST64 __PRI64 "X"
+
+#define PRIXFAST8  "X"
+#define PRIXFAST16 "X"
+#define PRIXFAST32 "X"
+#define PRIXFAST64 __PRI64 "X"
+
+#define PRIdMAX __PRI64 "d"
+#define PRIiMAX __PRI64 "i"
+#define PRIoMAX __PRI64 "o"
+#define PRIuMAX __PRI64 "u"
+#define PRIxMAX __PRI64 "x"
+#define PRIXMAX __PRI64 "X"
+
+#define PRIdPTR __PRIPTR "d"
+#define PRIiPTR __PRIPTR "i"
+#define PRIoPTR __PRIPTR "o"
+#define PRIuPTR __PRIPTR "u"
+#define PRIxPTR __PRIPTR "x"
+#define PRIXPTR __PRIPTR "X"
+
+#define SCNd8   "hhd"
+#define SCNd16  "hd"
+#define SCNd32  "d"
+#define SCNd64  __PRI64 "d"
+
+#define SCNdLEAST8  "hhd"
+#define SCNdLEAST16 "hd"
+#define SCNdLEAST32 "d"
+#define SCNdLEAST64 __PRI64 "d"
+
+#define SCNdFAST8  "hhd"
+#define SCNdFAST16 "d"
+#define SCNdFAST32 "d"
+#define SCNdFAST64 __PRI64 "d"
+
+#define SCNi8   "hhi"
+#define SCNi16  "hi"
+#define SCNi32  "i"
+#define SCNi64  __PRI64 "i"
+
+#define SCNiLEAST8  "hhi"
+#define SCNiLEAST16 "hi"
+#define SCNiLEAST32 "i"
+#define SCNiLEAST64 __PRI64 "i"
+
+#define SCNiFAST8  "hhi"
+#define SCNiFAST16 "i"
+#define SCNiFAST32 "i"
+#define SCNiFAST64 __PRI64 "i"
+
+#define SCNu8   "hhu"
+#define SCNu16  "hu"
+#define SCNu32  "u"
+#define SCNu64  __PRI64 "u"
+
+#define SCNuLEAST8  "hhu"
+#define SCNuLEAST16 "hu"
+#define SCNuLEAST32 "u"
+#define SCNuLEAST64 __PRI64 "u"
+
+#define SCNuFAST8 "hhu"
+#define SCNuFAST16 "u"
+#define SCNuFAST32 "u"
+#define SCNuFAST64 __PRI64 "u"
+
+#define SCNo8   "hho"
+#define SCNo16  "ho"
+#define SCNo32  "o"
+#define SCNo64  __PRI64 "o"
+
+#define SCNoLEAST8  "hho"
+#define SCNoLEAST16 "ho"
+#define SCNoLEAST32 "o"
+#define SCNoLEAST64 __PRI64 "o"
+
+#define SCNoFAST8  "hho"
+#define SCNoFAST16 "o"
+#define SCNoFAST32 "o"
+#define SCNoFAST64 __PRI64 "o"
+
+#define SCNx8   "hhx"
+#define SCNx16  "hx"
+#define SCNx32  "x"
+#define SCNx64  __PRI64 "x"
+
+#define SCNxLEAST8  "hhx"
+#define SCNxLEAST16 "hx"
+#define SCNxLEAST32 "x"
+#define SCNxLEAST64 __PRI64 "x"
+
+#define SCNxFAST8  "hhx"
+#define SCNxFAST16 "x"
+#define SCNxFAST32 "x"
+#define SCNxFAST64 __PRI64 "x"
+
+#define SCNdMAX __PRI64 "d"
+#define SCNiMAX __PRI64 "i"
+#define SCNoMAX __PRI64 "o"
+#define SCNuMAX __PRI64 "u"
+#define SCNxMAX __PRI64 "x"
+
+#define SCNdPTR __PRIPTR "d"
+#define SCNiPTR __PRIPTR "i"
+#define SCNoPTR __PRIPTR "o"
+#define SCNuPTR __PRIPTR "u"
+#define SCNxPTR __PRIPTR "x"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/x86_64/iso646.h b/musl-include/x86_64/iso646.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/iso646.h
@@ -0,0 +1,20 @@
+#ifndef _ISO646_H
+#define _ISO646_H
+
+#ifndef __cplusplus
+
+#define and    &&
+#define and_eq &=
+#define bitand &
+#define bitor  |
+#define compl  ~
+#define not    !
+#define not_eq !=
+#define or     ||
+#define or_eq  |=
+#define xor    ^
+#define xor_eq ^=
+
+#endif
+
+#endif
diff --git a/musl-include/x86_64/langinfo.h b/musl-include/x86_64/langinfo.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/langinfo.h
@@ -0,0 +1,98 @@
+#ifndef _LANGINFO_H
+#define _LANGINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <nl_types.h>
+
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+#define ABDAY_1 0x20000
+#define ABDAY_2 0x20001
+#define ABDAY_3 0x20002
+#define ABDAY_4 0x20003
+#define ABDAY_5 0x20004
+#define ABDAY_6 0x20005
+#define ABDAY_7 0x20006
+
+#define DAY_1 0x20007
+#define DAY_2 0x20008
+#define DAY_3 0x20009
+#define DAY_4 0x2000A
+#define DAY_5 0x2000B
+#define DAY_6 0x2000C
+#define DAY_7 0x2000D
+
+#define ABMON_1 0x2000E
+#define ABMON_2 0x2000F
+#define ABMON_3 0x20010
+#define ABMON_4 0x20011
+#define ABMON_5 0x20012
+#define ABMON_6 0x20013
+#define ABMON_7 0x20014
+#define ABMON_8 0x20015
+#define ABMON_9 0x20016
+#define ABMON_10 0x20017
+#define ABMON_11 0x20018
+#define ABMON_12 0x20019
+
+#define MON_1 0x2001A
+#define MON_2 0x2001B
+#define MON_3 0x2001C
+#define MON_4 0x2001D
+#define MON_5 0x2001E
+#define MON_6 0x2001F
+#define MON_7 0x20020
+#define MON_8 0x20021
+#define MON_9 0x20022
+#define MON_10 0x20023
+#define MON_11 0x20024
+#define MON_12 0x20025
+
+#define AM_STR 0x20026
+#define PM_STR 0x20027
+
+#define D_T_FMT 0x20028
+#define D_FMT 0x20029
+#define T_FMT 0x2002A
+#define T_FMT_AMPM 0x2002B
+
+#define ERA 0x2002C
+#define ERA_D_FMT 0x2002E
+#define ALT_DIGITS 0x2002F
+#define ERA_D_T_FMT 0x20030
+#define ERA_T_FMT 0x20031
+
+#define CODESET 14
+
+#define CRNCYSTR 0x4000F
+
+#define RADIXCHAR 0x10000
+#define THOUSEP 0x10001
+#define YESEXPR 0x50000
+#define NOEXPR 0x50001
+
+#define _NL_LOCALE_NAME(cat) (((cat)<<16) | 0xffff)
+
+#if defined(_GNU_SOURCE)
+#define NL_LOCALE_NAME(cat) _NL_LOCALE_NAME(cat)
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define YESSTR 0x50002
+#define NOSTR 0x50003
+#endif
+
+char *nl_langinfo(nl_item);
+char *nl_langinfo_l(nl_item, locale_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/lastlog.h b/musl-include/x86_64/lastlog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/lastlog.h
@@ -0,0 +1,1 @@
+#include <utmp.h>
diff --git a/musl-include/x86_64/libgen.h b/musl-include/x86_64/libgen.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/libgen.h
@@ -0,0 +1,15 @@
+#ifndef _LIBGEN_H
+#define _LIBGEN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *dirname(char *);
+char *basename(char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/libintl.h b/musl-include/x86_64/libintl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/libintl.h
@@ -0,0 +1,33 @@
+#ifndef _LIBINTL_H
+#define _LIBINTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __USE_GNU_GETTEXT 1
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 1 : -1)
+
+#if __GNUC__ >= 3
+#define __fa(n) __attribute__ ((__format_arg__ (n)))
+#else
+#define __fa(n)
+#endif
+
+char *gettext(const char *) __fa(1);
+char *dgettext(const char *, const char *) __fa(2);
+char *dcgettext(const char *, const char *, int) __fa(2);
+char *ngettext(const char *, const char *, unsigned long) __fa(1) __fa(2);
+char *dngettext(const char *, const char *, const char *, unsigned long) __fa(2) __fa(3);
+char *dcngettext(const char *, const char *, const char *, unsigned long, int) __fa(2) __fa(3);
+char *textdomain(const char *);
+char *bindtextdomain (const char *, const char *);
+char *bind_textdomain_codeset(const char *, const char *);
+
+#undef __fa
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/limits.h b/musl-include/x86_64/limits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/limits.h
@@ -0,0 +1,166 @@
+#ifndef _LIMITS_H
+#define _LIMITS_H
+
+#include <features.h>
+
+#include <bits/alltypes.h> /* __LONG_MAX */
+
+/* Support signed or unsigned plain-char */
+
+#if '\xff' > 0
+#define CHAR_MIN 0
+#define CHAR_MAX 255
+#else
+#define CHAR_MIN (-128)
+#define CHAR_MAX 127
+#endif
+
+#define CHAR_BIT 8
+#define SCHAR_MIN (-128)
+#define SCHAR_MAX 127
+#define UCHAR_MAX 255
+#define SHRT_MIN  (-1-0x7fff)
+#define SHRT_MAX  0x7fff
+#define USHRT_MAX 0xffff
+#define INT_MIN  (-1-0x7fffffff)
+#define INT_MAX  0x7fffffff
+#define UINT_MAX 0xffffffffU
+#define LONG_MIN (-LONG_MAX-1)
+#define LONG_MAX __LONG_MAX
+#define ULONG_MAX (2UL*LONG_MAX+1)
+#define LLONG_MIN (-LLONG_MAX-1)
+#define LLONG_MAX  0x7fffffffffffffffLL
+#define ULLONG_MAX (2ULL*LLONG_MAX+1)
+
+#define MB_LEN_MAX 4
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#include <bits/limits.h>
+
+#define PIPE_BUF 4096
+#define FILESIZEBITS 64
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+#define PATH_MAX 4096
+#define NGROUPS_MAX 32
+#define ARG_MAX 131072
+#define IOV_MAX 1024
+#define SYMLOOP_MAX 40
+#define WORD_BIT 32
+#define SSIZE_MAX LONG_MAX
+#define TZNAME_MAX 6
+#define TTY_NAME_MAX 32
+#define HOST_NAME_MAX 255
+
+#if LONG_MAX == 0x7fffffffL
+#define LONG_BIT 32
+#else
+#define LONG_BIT 64
+#endif
+
+/* Implementation choices... */
+
+#define PTHREAD_KEYS_MAX 128
+#define PTHREAD_STACK_MIN 2048
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+#define SEM_VALUE_MAX 0x7fffffff
+#define SEM_NSEMS_MAX 256
+#define DELAYTIMER_MAX 0x7fffffff
+#define MQ_PRIO_MAX 32768
+#define LOGIN_NAME_MAX 256
+
+/* Arbitrary numbers... */
+
+#define BC_BASE_MAX 99
+#define BC_DIM_MAX 2048
+#define BC_SCALE_MAX 99
+#define BC_STRING_MAX 1000
+#define CHARCLASS_NAME_MAX 14
+#define COLL_WEIGHTS_MAX 2
+#define EXPR_NEST_MAX 32
+#define LINE_MAX 4096
+#define RE_DUP_MAX 255
+
+#define NL_ARGMAX 9
+#define NL_MSGMAX 32767
+#define NL_SETMAX 255
+#define NL_TEXTMAX 2048
+
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
+
+#ifdef PAGESIZE
+#define PAGE_SIZE PAGESIZE
+#endif
+#define NZERO 20
+#define NL_LANGMAX 32
+
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+
+#define NL_NMAX 16
+
+#endif
+
+/* POSIX/SUS requirements follow. These numbers come directly
+ * from SUS and have nothing to do with the host system. */
+
+#define _POSIX_AIO_LISTIO_MAX   2
+#define _POSIX_AIO_MAX          1
+#define _POSIX_ARG_MAX          4096
+#define _POSIX_CHILD_MAX        25
+#define _POSIX_CLOCKRES_MIN     20000000
+#define _POSIX_DELAYTIMER_MAX   32
+#define _POSIX_HOST_NAME_MAX    255
+#define _POSIX_LINK_MAX         8
+#define _POSIX_LOGIN_NAME_MAX   9
+#define _POSIX_MAX_CANON        255
+#define _POSIX_MAX_INPUT        255
+#define _POSIX_MQ_OPEN_MAX      8
+#define _POSIX_MQ_PRIO_MAX      32
+#define _POSIX_NAME_MAX         14
+#define _POSIX_NGROUPS_MAX      8
+#define _POSIX_OPEN_MAX         20
+#define _POSIX_PATH_MAX         256
+#define _POSIX_PIPE_BUF         512
+#define _POSIX_RE_DUP_MAX       255
+#define _POSIX_RTSIG_MAX        8
+#define _POSIX_SEM_NSEMS_MAX    256
+#define _POSIX_SEM_VALUE_MAX    32767
+#define _POSIX_SIGQUEUE_MAX     32
+#define _POSIX_SSIZE_MAX        32767
+#define _POSIX_STREAM_MAX       8
+#define _POSIX_SS_REPL_MAX      4
+#define _POSIX_SYMLINK_MAX      255
+#define _POSIX_SYMLOOP_MAX      8
+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
+#define _POSIX_THREAD_KEYS_MAX  128
+#define _POSIX_THREAD_THREADS_MAX 64
+#define _POSIX_TIMER_MAX        32
+#define _POSIX_TRACE_EVENT_NAME_MAX 30
+#define _POSIX_TRACE_NAME_MAX   8
+#define _POSIX_TRACE_SYS_MAX    8
+#define _POSIX_TRACE_USER_EVENT_MAX 32
+#define _POSIX_TTY_NAME_MAX     9
+#define _POSIX_TZNAME_MAX       6
+#define _POSIX2_BC_BASE_MAX     99
+#define _POSIX2_BC_DIM_MAX      2048
+#define _POSIX2_BC_SCALE_MAX    99
+#define _POSIX2_BC_STRING_MAX   1000
+#define _POSIX2_CHARCLASS_NAME_MAX 14
+#define _POSIX2_COLL_WEIGHTS_MAX 2
+#define _POSIX2_EXPR_NEST_MAX   32
+#define _POSIX2_LINE_MAX        2048
+#define _POSIX2_RE_DUP_MAX      255
+
+#define _XOPEN_IOV_MAX          16
+#define _XOPEN_NAME_MAX         255
+#define _XOPEN_PATH_MAX         1024
+
+#endif
diff --git a/musl-include/x86_64/link.h b/musl-include/x86_64/link.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/link.h
@@ -0,0 +1,53 @@
+#ifndef _LINK_H
+#define _LINK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+#define __NEED_size_t
+#define __NEED_uint32_t
+#include <bits/alltypes.h>
+
+#if UINTPTR_MAX > 0xffffffff
+#define ElfW(type) Elf64_ ## type
+#else
+#define ElfW(type) Elf32_ ## type
+#endif
+
+#include <bits/link.h>
+
+struct dl_phdr_info {
+	ElfW(Addr) dlpi_addr;
+	const char *dlpi_name;
+	const ElfW(Phdr) *dlpi_phdr;
+	ElfW(Half) dlpi_phnum;
+	unsigned long long int dlpi_adds;
+	unsigned long long int dlpi_subs;
+	size_t dlpi_tls_modid;
+	void *dlpi_tls_data;
+};
+
+struct link_map {
+	ElfW(Addr) l_addr;
+	char *l_name;
+	ElfW(Dyn) *l_ld;
+	struct link_map *l_next, *l_prev;
+};
+
+struct r_debug {
+	int r_version;
+	struct link_map *r_map;
+	ElfW(Addr) r_brk;
+	enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state;
+	ElfW(Addr) r_ldbase;
+};
+
+int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/locale.h b/musl-include/x86_64/locale.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/locale.h
@@ -0,0 +1,88 @@
+#ifndef	_LOCALE_H
+#define	_LOCALE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define LC_CTYPE    0
+#define LC_NUMERIC  1
+#define LC_TIME     2
+#define LC_COLLATE  3
+#define LC_MONETARY 4
+#define LC_MESSAGES 5
+#define LC_ALL      6
+
+struct lconv {
+	char *decimal_point;
+	char *thousands_sep;
+	char *grouping;
+
+	char *int_curr_symbol;
+	char *currency_symbol;
+	char *mon_decimal_point;
+	char *mon_thousands_sep;
+	char *mon_grouping;
+	char *positive_sign;
+	char *negative_sign;
+	char int_frac_digits;
+	char frac_digits;
+	char p_cs_precedes;
+	char p_sep_by_space;
+	char n_cs_precedes;
+	char n_sep_by_space;
+	char p_sign_posn;
+	char n_sign_posn;
+	char int_p_cs_precedes;
+	char int_p_sep_by_space;
+	char int_n_cs_precedes;
+	char int_n_sep_by_space;
+	char int_p_sign_posn;
+	char int_n_sign_posn;
+};
+
+
+char *setlocale (int, const char *);
+struct lconv *localeconv(void);
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+#define LC_GLOBAL_LOCALE ((locale_t)-1)
+
+#define LC_CTYPE_MASK    (1<<LC_CTYPE)
+#define LC_NUMERIC_MASK  (1<<LC_NUMERIC)
+#define LC_TIME_MASK     (1<<LC_TIME)
+#define LC_COLLATE_MASK  (1<<LC_COLLATE)
+#define LC_MONETARY_MASK (1<<LC_MONETARY)
+#define LC_MESSAGES_MASK (1<<LC_MESSAGES)
+#define LC_ALL_MASK      0x7fffffff
+
+locale_t duplocale(locale_t);
+void freelocale(locale_t);
+locale_t newlocale(int, const char *, locale_t);
+locale_t uselocale(locale_t);
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/malloc.h b/musl-include/x86_64/malloc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/malloc.h
@@ -0,0 +1,25 @@
+#ifndef _MALLOC_H
+#define _MALLOC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+void *malloc (size_t);
+void *calloc (size_t, size_t);
+void *realloc (void *, size_t);
+void free (void *);
+void *valloc (size_t);
+void *memalign(size_t, size_t);
+
+size_t malloc_usable_size(void *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/math.h b/musl-include/x86_64/math.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/math.h
@@ -0,0 +1,442 @@
+#ifndef _MATH_H
+#define _MATH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_float_t
+#define __NEED_double_t
+#include <bits/alltypes.h>
+
+#if 100*__GNUC__+__GNUC_MINOR__ >= 303
+#define NAN       __builtin_nanf("")
+#define INFINITY  __builtin_inff()
+#else
+#define NAN       (0.0f/0.0f)
+#define INFINITY  1e5000f
+#endif
+
+#define HUGE_VALF INFINITY
+#define HUGE_VAL  ((double)INFINITY)
+#define HUGE_VALL ((long double)INFINITY)
+
+#define MATH_ERRNO  1
+#define MATH_ERREXCEPT 2
+#define math_errhandling 2
+
+#define FP_ILOGBNAN (-1-0x7fffffff)
+#define FP_ILOGB0 FP_ILOGBNAN
+
+#define FP_NAN       0
+#define FP_INFINITE  1
+#define FP_ZERO      2
+#define FP_SUBNORMAL 3
+#define FP_NORMAL    4
+
+#ifdef __FP_FAST_FMA
+#define FP_FAST_FMA 1
+#endif
+
+#ifdef __FP_FAST_FMAF
+#define FP_FAST_FMAF 1
+#endif
+
+#ifdef __FP_FAST_FMAL
+#define FP_FAST_FMAL 1
+#endif
+
+int __fpclassify(double);
+int __fpclassifyf(float);
+int __fpclassifyl(long double);
+
+static __inline unsigned __FLOAT_BITS(float __f)
+{
+	union {float __f; unsigned __i;} __u;
+	__u.__f = __f;
+	return __u.__i;
+}
+static __inline unsigned long long __DOUBLE_BITS(double __f)
+{
+	union {double __f; unsigned long long __i;} __u;
+	__u.__f = __f;
+	return __u.__i;
+}
+
+#define fpclassify(x) ( \
+	sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \
+	sizeof(x) == sizeof(double) ? __fpclassify(x) : \
+	__fpclassifyl(x) )
+
+#define isinf(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \
+	__fpclassifyl(x) == FP_INFINITE)
+
+#define isnan(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \
+	__fpclassifyl(x) == FP_NAN)
+
+#define isnormal(x) ( \
+	sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \
+	sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \
+	__fpclassifyl(x) == FP_NORMAL)
+
+#define isfinite(x) ( \
+	sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \
+	sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \
+	__fpclassifyl(x) > FP_INFINITE)
+
+int __signbit(double);
+int __signbitf(float);
+int __signbitl(long double);
+
+#define signbit(x) ( \
+	sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \
+	sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \
+	__signbitl(x) )
+
+#define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y)))
+
+#define __ISREL_DEF(rel, op, type) \
+static __inline int __is##rel(type __x, type __y) \
+{ return !isunordered(__x,__y) && __x op __y; }
+
+__ISREL_DEF(lessf, <, float_t)
+__ISREL_DEF(less, <, double_t)
+__ISREL_DEF(lessl, <, long double)
+__ISREL_DEF(lessequalf, <=, float_t)
+__ISREL_DEF(lessequal, <=, double_t)
+__ISREL_DEF(lessequall, <=, long double)
+__ISREL_DEF(lessgreaterf, !=, float_t)
+__ISREL_DEF(lessgreater, !=, double_t)
+__ISREL_DEF(lessgreaterl, !=, long double)
+__ISREL_DEF(greaterf, >, float_t)
+__ISREL_DEF(greater, >, double_t)
+__ISREL_DEF(greaterl, >, long double)
+__ISREL_DEF(greaterequalf, >=, float_t)
+__ISREL_DEF(greaterequal, >=, double_t)
+__ISREL_DEF(greaterequall, >=, long double)
+
+#define __tg_pred_2(x, y, p) ( \
+	sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \
+	sizeof((x)+(y)) == sizeof(double) ? p(x, y) : \
+	p##l(x, y) )
+
+#define isless(x, y)            __tg_pred_2(x, y, __isless)
+#define islessequal(x, y)       __tg_pred_2(x, y, __islessequal)
+#define islessgreater(x, y)     __tg_pred_2(x, y, __islessgreater)
+#define isgreater(x, y)         __tg_pred_2(x, y, __isgreater)
+#define isgreaterequal(x, y)    __tg_pred_2(x, y, __isgreaterequal)
+
+double      acos(double);
+float       acosf(float);
+long double acosl(long double);
+
+double      acosh(double);
+float       acoshf(float);
+long double acoshl(long double);
+
+double      asin(double);
+float       asinf(float);
+long double asinl(long double);
+
+double      asinh(double);
+float       asinhf(float);
+long double asinhl(long double);
+
+double      atan(double);
+float       atanf(float);
+long double atanl(long double);
+
+double      atan2(double, double);
+float       atan2f(float, float);
+long double atan2l(long double, long double);
+
+double      atanh(double);
+float       atanhf(float);
+long double atanhl(long double);
+
+double      cbrt(double);
+float       cbrtf(float);
+long double cbrtl(long double);
+
+double      ceil(double);
+float       ceilf(float);
+long double ceill(long double);
+
+double      copysign(double, double);
+float       copysignf(float, float);
+long double copysignl(long double, long double);
+
+double      cos(double);
+float       cosf(float);
+long double cosl(long double);
+
+double      cosh(double);
+float       coshf(float);
+long double coshl(long double);
+
+double      erf(double);
+float       erff(float);
+long double erfl(long double);
+
+double      erfc(double);
+float       erfcf(float);
+long double erfcl(long double);
+
+double      exp(double);
+float       expf(float);
+long double expl(long double);
+
+double      exp2(double);
+float       exp2f(float);
+long double exp2l(long double);
+
+double      expm1(double);
+float       expm1f(float);
+long double expm1l(long double);
+
+double      fabs(double);
+float       fabsf(float);
+long double fabsl(long double);
+
+double      fdim(double, double);
+float       fdimf(float, float);
+long double fdiml(long double, long double);
+
+double      floor(double);
+float       floorf(float);
+long double floorl(long double);
+
+double      fma(double, double, double);
+float       fmaf(float, float, float);
+long double fmal(long double, long double, long double);
+
+double      fmax(double, double);
+float       fmaxf(float, float);
+long double fmaxl(long double, long double);
+
+double      fmin(double, double);
+float       fminf(float, float);
+long double fminl(long double, long double);
+
+double      fmod(double, double);
+float       fmodf(float, float);
+long double fmodl(long double, long double);
+
+double      frexp(double, int *);
+float       frexpf(float, int *);
+long double frexpl(long double, int *);
+
+double      hypot(double, double);
+float       hypotf(float, float);
+long double hypotl(long double, long double);
+
+int         ilogb(double);
+int         ilogbf(float);
+int         ilogbl(long double);
+
+double      ldexp(double, int);
+float       ldexpf(float, int);
+long double ldexpl(long double, int);
+
+double      lgamma(double);
+float       lgammaf(float);
+long double lgammal(long double);
+
+long long   llrint(double);
+long long   llrintf(float);
+long long   llrintl(long double);
+
+long long   llround(double);
+long long   llroundf(float);
+long long   llroundl(long double);
+
+double      log(double);
+float       logf(float);
+long double logl(long double);
+
+double      log10(double);
+float       log10f(float);
+long double log10l(long double);
+
+double      log1p(double);
+float       log1pf(float);
+long double log1pl(long double);
+
+double      log2(double);
+float       log2f(float);
+long double log2l(long double);
+
+double      logb(double);
+float       logbf(float);
+long double logbl(long double);
+
+long        lrint(double);
+long        lrintf(float);
+long        lrintl(long double);
+
+long        lround(double);
+long        lroundf(float);
+long        lroundl(long double);
+
+double      modf(double, double *);
+float       modff(float, float *);
+long double modfl(long double, long double *);
+
+double      nan(const char *);
+float       nanf(const char *);
+long double nanl(const char *);
+
+double      nearbyint(double);
+float       nearbyintf(float);
+long double nearbyintl(long double);
+
+double      nextafter(double, double);
+float       nextafterf(float, float);
+long double nextafterl(long double, long double);
+
+double      nexttoward(double, long double);
+float       nexttowardf(float, long double);
+long double nexttowardl(long double, long double);
+
+double      pow(double, double);
+float       powf(float, float);
+long double powl(long double, long double);
+
+double      remainder(double, double);
+float       remainderf(float, float);
+long double remainderl(long double, long double);
+
+double      remquo(double, double, int *);
+float       remquof(float, float, int *);
+long double remquol(long double, long double, int *);
+
+double      rint(double);
+float       rintf(float);
+long double rintl(long double);
+
+double      round(double);
+float       roundf(float);
+long double roundl(long double);
+
+double      scalbln(double, long);
+float       scalblnf(float, long);
+long double scalblnl(long double, long);
+
+double      scalbn(double, int);
+float       scalbnf(float, int);
+long double scalbnl(long double, int);
+
+double      sin(double);
+float       sinf(float);
+long double sinl(long double);
+
+double      sinh(double);
+float       sinhf(float);
+long double sinhl(long double);
+
+double      sqrt(double);
+float       sqrtf(float);
+long double sqrtl(long double);
+
+double      tan(double);
+float       tanf(float);
+long double tanl(long double);
+
+double      tanh(double);
+float       tanhf(float);
+long double tanhl(long double);
+
+double      tgamma(double);
+float       tgammaf(float);
+long double tgammal(long double);
+
+double      trunc(double);
+float       truncf(float);
+long double truncl(long double);
+
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE)
+#undef  MAXFLOAT
+#define MAXFLOAT        3.40282346638528859812e+38F
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define M_E             2.7182818284590452354   /* e */
+#define M_LOG2E         1.4426950408889634074   /* log_2 e */
+#define M_LOG10E        0.43429448190325182765  /* log_10 e */
+#define M_LN2           0.69314718055994530942  /* log_e 2 */
+#define M_LN10          2.30258509299404568402  /* log_e 10 */
+#define M_PI            3.14159265358979323846  /* pi */
+#define M_PI_2          1.57079632679489661923  /* pi/2 */
+#define M_PI_4          0.78539816339744830962  /* pi/4 */
+#define M_1_PI          0.31830988618379067154  /* 1/pi */
+#define M_2_PI          0.63661977236758134308  /* 2/pi */
+#define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
+#define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
+#define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
+
+extern int signgam;
+
+double      j0(double);
+double      j1(double);
+double      jn(int, double);
+
+double      y0(double);
+double      y1(double);
+double      yn(int, double);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define HUGE            3.40282346638528859812e+38F
+
+double      drem(double, double);
+float       dremf(float, float);
+
+int         finite(double);
+int         finitef(float);
+
+double      scalb(double, double);
+float       scalbf(float, float);
+
+double      significand(double);
+float       significandf(float);
+
+double      lgamma_r(double, int*);
+float       lgammaf_r(float, int*);
+
+float       j0f(float);
+float       j1f(float);
+float       jnf(int, float);
+
+float       y0f(float);
+float       y1f(float);
+float       ynf(int, float);
+#endif
+
+#ifdef _GNU_SOURCE
+long double lgammal_r(long double, int*);
+
+void        sincos(double, double*, double*);
+void        sincosf(float, float*, float*);
+void        sincosl(long double, long double*, long double*);
+
+double      exp10(double);
+float       exp10f(float);
+long double exp10l(long double);
+
+double      pow10(double);
+float       pow10f(float);
+long double pow10l(long double);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/memory.h b/musl-include/x86_64/memory.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/memory.h
@@ -0,0 +1,1 @@
+#include <string.h>
diff --git a/musl-include/x86_64/mntent.h b/musl-include/x86_64/mntent.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/mntent.h
@@ -0,0 +1,43 @@
+#ifndef _MNTENT_H
+#define _MNTENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_FILE
+#include <bits/alltypes.h>
+
+#define MOUNTED "/etc/mtab"
+
+#define MNTTYPE_IGNORE	"ignore"
+#define MNTTYPE_NFS	"nfs"
+#define MNTTYPE_SWAP	"swap"
+#define MNTOPT_DEFAULTS	"defaults"
+#define MNTOPT_RO	"ro"
+#define MNTOPT_RW	"rw"
+#define MNTOPT_SUID	"suid"
+#define MNTOPT_NOSUID	"nosuid"
+#define MNTOPT_NOAUTO	"noauto"
+
+struct mntent {
+	char *mnt_fsname;
+	char *mnt_dir;
+	char *mnt_type;
+	char *mnt_opts;
+	int mnt_freq;
+	int mnt_passno;
+};
+
+FILE *setmntent(const char *, const char *);
+int endmntent(FILE *);
+struct mntent *getmntent(FILE *);
+struct mntent *getmntent_r(FILE *, struct mntent *, char *, int);
+int addmntent(FILE *, const struct mntent *);
+char *hasmntopt(const struct mntent *, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/monetary.h b/musl-include/x86_64/monetary.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/monetary.h
@@ -0,0 +1,23 @@
+#ifndef _MONETARY_H
+#define _MONETARY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ssize_t
+#define __NEED_size_t
+#define __NEED_locale_t
+
+#include <bits/alltypes.h>
+
+ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...);
+ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/mqueue.h b/musl-include/x86_64/mqueue.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/mqueue.h
@@ -0,0 +1,41 @@
+#ifndef _MQUEUE_H
+#define _MQUEUE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_pthread_attr_t
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+typedef int mqd_t;
+struct mq_attr {
+	long mq_flags, mq_maxmsg, mq_msgsize, mq_curmsgs, __unused[4];
+};
+struct sigevent;
+
+int mq_close(mqd_t);
+int mq_getattr(mqd_t, struct mq_attr *);
+int mq_notify(mqd_t, const struct sigevent *);
+mqd_t mq_open(const char *, int, ...);
+ssize_t mq_receive(mqd_t, char *, size_t, unsigned *);
+int mq_send(mqd_t, const char *, size_t, unsigned);
+int mq_setattr(mqd_t, const struct mq_attr *__restrict, struct mq_attr *__restrict);
+ssize_t mq_timedreceive(mqd_t, char *__restrict, size_t, unsigned *__restrict, const struct timespec *__restrict);
+int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct timespec *);
+int mq_unlink(const char *);
+
+#if _REDIR_TIME64
+__REDIR(mq_timedreceive, __mq_timedreceive_time64);
+__REDIR(mq_timedsend, __mq_timedsend_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/net/ethernet.h b/musl-include/x86_64/net/ethernet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/net/ethernet.h
@@ -0,0 +1,55 @@
+#ifndef _NET_ETHERNET_H
+#define _NET_ETHERNET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <netinet/if_ether.h>
+
+struct ether_addr {
+	uint8_t ether_addr_octet[ETH_ALEN];
+};
+
+struct ether_header {
+	uint8_t  ether_dhost[ETH_ALEN];
+	uint8_t  ether_shost[ETH_ALEN];
+	uint16_t ether_type;
+};
+
+#define	ETHERTYPE_PUP		0x0200
+#define ETHERTYPE_SPRITE	0x0500
+#define	ETHERTYPE_IP		0x0800
+#define	ETHERTYPE_ARP		0x0806
+#define	ETHERTYPE_REVARP	0x8035
+#define ETHERTYPE_AT		0x809B
+#define ETHERTYPE_AARP		0x80F3
+#define	ETHERTYPE_VLAN		0x8100
+#define ETHERTYPE_IPX		0x8137
+#define	ETHERTYPE_IPV6		0x86dd
+#define ETHERTYPE_LOOPBACK	0x9000
+
+
+#define	ETHER_ADDR_LEN	ETH_ALEN
+#define	ETHER_TYPE_LEN	2
+#define	ETHER_CRC_LEN	4
+#define	ETHER_HDR_LEN	ETH_HLEN
+#define	ETHER_MIN_LEN	(ETH_ZLEN + ETHER_CRC_LEN)
+#define	ETHER_MAX_LEN	(ETH_FRAME_LEN + ETHER_CRC_LEN)
+
+#define	ETHER_IS_VALID_LEN(foo)	\
+	((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
+
+#define	ETHERTYPE_TRAIL		0x1000
+#define	ETHERTYPE_NTRAILER	16
+
+#define	ETHERMTU	ETH_DATA_LEN
+#define	ETHERMIN	(ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/net/if.h b/musl-include/x86_64/net/if.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/net/if.h
@@ -0,0 +1,141 @@
+#ifndef _NET_IF_H
+#define _NET_IF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define IF_NAMESIZE 16
+
+struct if_nameindex {
+	unsigned int if_index;
+	char *if_name;
+};
+
+unsigned int if_nametoindex (const char *);
+char *if_indextoname (unsigned int, char *);
+struct if_nameindex *if_nameindex (void);
+void if_freenameindex (struct if_nameindex *);
+
+
+
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#include <sys/socket.h>
+
+#define IFF_UP	0x1
+#define IFF_BROADCAST 0x2
+#define IFF_DEBUG 0x4
+#define IFF_LOOPBACK 0x8
+#define IFF_POINTOPOINT 0x10
+#define IFF_NOTRAILERS 0x20
+#define IFF_RUNNING 0x40
+#define IFF_NOARP 0x80
+#define IFF_PROMISC 0x100
+#define IFF_ALLMULTI 0x200
+#define IFF_MASTER 0x400
+#define IFF_SLAVE 0x800
+#define IFF_MULTICAST 0x1000
+#define IFF_PORTSEL 0x2000
+#define IFF_AUTOMEDIA 0x4000
+#define IFF_DYNAMIC 0x8000
+#define IFF_LOWER_UP 0x10000
+#define IFF_DORMANT 0x20000
+#define IFF_ECHO 0x40000
+#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
+        IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
+
+struct ifaddr {
+	struct sockaddr ifa_addr;
+	union {
+		struct sockaddr	ifu_broadaddr;
+		struct sockaddr	ifu_dstaddr;
+	} ifa_ifu;
+	struct iface *ifa_ifp;
+	struct ifaddr *ifa_next;
+};
+
+#define ifa_broadaddr	ifa_ifu.ifu_broadaddr
+#define ifa_dstaddr	ifa_ifu.ifu_dstaddr
+
+struct ifmap {
+	unsigned long int mem_start;
+	unsigned long int mem_end;
+	unsigned short int base_addr;
+	unsigned char irq;
+	unsigned char dma;
+	unsigned char port;
+};
+
+#define IFHWADDRLEN	6
+#define IFNAMSIZ	IF_NAMESIZE
+
+struct ifreq {
+	union {
+		char ifrn_name[IFNAMSIZ];
+	} ifr_ifrn;
+	union {
+		struct sockaddr ifru_addr;
+		struct sockaddr ifru_dstaddr;
+		struct sockaddr ifru_broadaddr;
+		struct sockaddr ifru_netmask;
+		struct sockaddr ifru_hwaddr;
+		short int ifru_flags;
+		int ifru_ivalue;
+		int ifru_mtu;
+		struct ifmap ifru_map;
+		char ifru_slave[IFNAMSIZ];
+		char ifru_newname[IFNAMSIZ];
+		char *ifru_data;
+	} ifr_ifru;
+};
+
+#define ifr_name	ifr_ifrn.ifrn_name
+#define ifr_hwaddr	ifr_ifru.ifru_hwaddr
+#define ifr_addr	ifr_ifru.ifru_addr
+#define ifr_dstaddr	ifr_ifru.ifru_dstaddr
+#define ifr_broadaddr	ifr_ifru.ifru_broadaddr
+#define ifr_netmask	ifr_ifru.ifru_netmask
+#define ifr_flags	ifr_ifru.ifru_flags
+#define ifr_metric	ifr_ifru.ifru_ivalue
+#define ifr_mtu		ifr_ifru.ifru_mtu
+#define ifr_map		ifr_ifru.ifru_map
+#define ifr_slave	ifr_ifru.ifru_slave
+#define ifr_data	ifr_ifru.ifru_data
+#define ifr_ifindex	ifr_ifru.ifru_ivalue
+#define ifr_bandwidth	ifr_ifru.ifru_ivalue
+#define ifr_qlen	ifr_ifru.ifru_ivalue
+#define ifr_newname	ifr_ifru.ifru_newname
+#define _IOT_ifreq	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0)
+#define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0)
+#define _IOT_ifreq_int	_IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
+
+struct ifconf {
+	int ifc_len;		
+	union {
+		char *ifcu_buf;
+		struct ifreq *ifcu_req;
+	} ifc_ifcu;
+};
+
+#define ifc_buf		ifc_ifcu.ifcu_buf
+#define ifc_req		ifc_ifcu.ifcu_req
+#define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
+
+#define __UAPI_DEF_IF_IFCONF                                    0
+#define __UAPI_DEF_IF_IFMAP                                     0
+#define __UAPI_DEF_IF_IFNAMSIZ                                  0
+#define __UAPI_DEF_IF_IFREQ                                     0
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS                          0
+#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO    0
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/net/if_arp.h b/musl-include/x86_64/net/if_arp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/net/if_arp.h
@@ -0,0 +1,142 @@
+/* Nonstandard header */
+#ifndef _NET_IF_ARP_H
+#define _NET_IF_ARP_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#define MAX_ADDR_LEN	7
+
+#define	ARPOP_REQUEST	1
+#define	ARPOP_REPLY	2
+#define	ARPOP_RREQUEST	3
+#define	ARPOP_RREPLY	4
+#define	ARPOP_InREQUEST	8
+#define	ARPOP_InREPLY	9
+#define	ARPOP_NAK	10
+
+struct arphdr {
+	uint16_t ar_hrd;
+	uint16_t ar_pro;
+	uint8_t ar_hln;
+	uint8_t ar_pln;
+	uint16_t ar_op;
+};
+
+
+#define ARPHRD_NETROM	0
+#define ARPHRD_ETHER 	1
+#define	ARPHRD_EETHER	2
+#define	ARPHRD_AX25	3
+#define	ARPHRD_PRONET	4
+#define	ARPHRD_CHAOS	5
+#define	ARPHRD_IEEE802	6
+#define	ARPHRD_ARCNET	7
+#define	ARPHRD_APPLETLK	8
+#define	ARPHRD_DLCI	15
+#define	ARPHRD_ATM	19
+#define	ARPHRD_METRICOM	23
+#define ARPHRD_IEEE1394	24
+#define ARPHRD_EUI64		27
+#define ARPHRD_INFINIBAND	32
+#define ARPHRD_SLIP	256
+#define ARPHRD_CSLIP	257
+#define ARPHRD_SLIP6	258
+#define ARPHRD_CSLIP6	259
+#define ARPHRD_RSRVD	260
+#define ARPHRD_ADAPT	264
+#define ARPHRD_ROSE	270
+#define ARPHRD_X25	271
+#define ARPHRD_HWX25	272
+#define ARPHRD_CAN	280
+#define ARPHRD_PPP	512
+#define ARPHRD_CISCO	513
+#define ARPHRD_HDLC	ARPHRD_CISCO
+#define ARPHRD_LAPB	516
+#define ARPHRD_DDCMP	517
+#define	ARPHRD_RAWHDLC	518
+#define ARPHRD_RAWIP	519
+
+#define ARPHRD_TUNNEL	768
+#define ARPHRD_TUNNEL6	769
+#define ARPHRD_FRAD	770
+#define ARPHRD_SKIP	771
+#define ARPHRD_LOOPBACK	772
+#define ARPHRD_LOCALTLK 773
+#define ARPHRD_FDDI	774
+#define ARPHRD_BIF	775
+#define ARPHRD_SIT	776
+#define ARPHRD_IPDDP	777
+#define ARPHRD_IPGRE	778
+#define ARPHRD_PIMREG	779
+#define ARPHRD_HIPPI	780
+#define ARPHRD_ASH	781
+#define ARPHRD_ECONET	782
+#define ARPHRD_IRDA	783
+#define ARPHRD_FCPP	784
+#define ARPHRD_FCAL	785
+#define ARPHRD_FCPL	786
+#define ARPHRD_FCFABRIC 787
+#define ARPHRD_IEEE802_TR 800
+#define ARPHRD_IEEE80211 801
+#define ARPHRD_IEEE80211_PRISM 802
+#define ARPHRD_IEEE80211_RADIOTAP 803
+#define ARPHRD_IEEE802154 804
+#define ARPHRD_IEEE802154_MONITOR 805
+#define ARPHRD_PHONET 820
+#define ARPHRD_PHONET_PIPE 821
+#define ARPHRD_CAIF 822
+#define ARPHRD_IP6GRE 823
+#define ARPHRD_NETLINK 824
+#define ARPHRD_6LOWPAN 825
+#define ARPHRD_VSOCKMON 826
+
+#define ARPHRD_VOID	  0xFFFF
+#define ARPHRD_NONE	  0xFFFE
+
+struct arpreq {
+	struct sockaddr arp_pa;
+	struct sockaddr arp_ha;
+	int arp_flags;
+	struct sockaddr arp_netmask;
+	char arp_dev[16];
+};
+
+struct arpreq_old {
+	struct sockaddr arp_pa;
+	struct sockaddr arp_ha;
+	int arp_flags;
+	struct sockaddr arp_netmask;
+};
+
+#define ATF_COM		0x02
+#define	ATF_PERM	0x04
+#define	ATF_PUBL	0x08
+#define	ATF_USETRAILERS	0x10
+#define ATF_NETMASK     0x20
+#define ATF_DONTPUB	0x40
+#define ATF_MAGIC	0x80
+
+#define ARPD_UPDATE	0x01
+#define ARPD_LOOKUP	0x02
+#define ARPD_FLUSH	0x03
+
+struct arpd_request {
+	unsigned short req;
+	uint32_t ip;
+	unsigned long dev;
+	unsigned long stamp;
+	unsigned long updated;
+	unsigned char ha[MAX_ADDR_LEN];
+};
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/net/route.h b/musl-include/x86_64/net/route.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/net/route.h
@@ -0,0 +1,124 @@
+#ifndef _NET_ROUTE_H
+#define _NET_ROUTE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+
+struct rtentry {
+	unsigned long int rt_pad1;
+	struct sockaddr rt_dst;
+	struct sockaddr rt_gateway;
+	struct sockaddr rt_genmask;
+	unsigned short int rt_flags;
+	short int rt_pad2;
+	unsigned long int rt_pad3;
+	unsigned char rt_tos;
+	unsigned char rt_class;
+	short int rt_pad4[sizeof(long)/2-1];
+	short int rt_metric;
+	char *rt_dev;
+	unsigned long int rt_mtu;
+	unsigned long int rt_window;
+	unsigned short int rt_irtt;
+};
+
+#define rt_mss	rt_mtu
+
+
+struct in6_rtmsg {
+	struct in6_addr rtmsg_dst;
+	struct in6_addr rtmsg_src;
+	struct in6_addr rtmsg_gateway;
+	uint32_t rtmsg_type;
+	uint16_t rtmsg_dst_len;
+	uint16_t rtmsg_src_len;
+	uint32_t rtmsg_metric;
+	unsigned long int rtmsg_info;
+	uint32_t rtmsg_flags;
+	int rtmsg_ifindex;
+};
+
+
+#define	RTF_UP		0x0001
+#define	RTF_GATEWAY	0x0002
+
+#define	RTF_HOST	0x0004
+#define RTF_REINSTATE	0x0008
+#define	RTF_DYNAMIC	0x0010
+#define	RTF_MODIFIED	0x0020
+#define RTF_MTU		0x0040
+#define RTF_MSS		RTF_MTU
+#define RTF_WINDOW	0x0080
+#define RTF_IRTT	0x0100
+#define RTF_REJECT	0x0200
+#define	RTF_STATIC	0x0400
+#define	RTF_XRESOLVE	0x0800
+#define RTF_NOFORWARD   0x1000
+#define RTF_THROW	0x2000
+#define RTF_NOPMTUDISC  0x4000
+
+#define RTF_DEFAULT	0x00010000
+#define RTF_ALLONLINK	0x00020000
+#define RTF_ADDRCONF	0x00040000
+
+#define RTF_LINKRT	0x00100000
+#define RTF_NONEXTHOP	0x00200000
+
+#define RTF_CACHE	0x01000000
+#define RTF_FLOW	0x02000000
+#define RTF_POLICY	0x04000000
+
+#define RTCF_VALVE	0x00200000
+#define RTCF_MASQ	0x00400000
+#define RTCF_NAT	0x00800000
+#define RTCF_DOREDIRECT 0x01000000
+#define RTCF_LOG	0x02000000
+#define RTCF_DIRECTSRC	0x04000000
+
+#define RTF_LOCAL	0x80000000
+#define RTF_INTERFACE	0x40000000
+#define RTF_MULTICAST	0x20000000
+#define RTF_BROADCAST	0x10000000
+#define RTF_NAT		0x08000000
+
+#define RTF_ADDRCLASSMASK	0xF8000000
+#define RT_ADDRCLASS(flags)	((uint32_t) flags >> 23)
+
+#define RT_TOS(tos)		((tos) & IPTOS_TOS_MASK)
+
+#define RT_LOCALADDR(flags)	((flags & RTF_ADDRCLASSMASK) \
+				 == (RTF_LOCAL|RTF_INTERFACE))
+
+#define RT_CLASS_UNSPEC		0
+#define RT_CLASS_DEFAULT	253
+
+#define RT_CLASS_MAIN		254
+#define RT_CLASS_LOCAL		255
+#define RT_CLASS_MAX		255
+
+
+#define RTMSG_ACK		NLMSG_ACK
+#define RTMSG_OVERRUN		NLMSG_OVERRUN
+
+#define RTMSG_NEWDEVICE		0x11
+#define RTMSG_DELDEVICE		0x12
+#define RTMSG_NEWROUTE		0x21
+#define RTMSG_DELROUTE		0x22
+#define RTMSG_NEWRULE		0x31
+#define RTMSG_DELRULE		0x32
+#define RTMSG_CONTROL		0x40
+
+#define RTMSG_AR_FAILED		0x51
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netdb.h b/musl-include/x86_64/netdb.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netdb.h
@@ -0,0 +1,157 @@
+#ifndef	_NETDB_H
+#define	_NETDB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <netinet/in.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_size_t
+#include <bits/alltypes.h>
+#endif
+
+struct addrinfo {
+	int ai_flags;
+	int ai_family;
+	int ai_socktype;
+	int ai_protocol;
+	socklen_t ai_addrlen;
+	struct sockaddr *ai_addr;
+	char *ai_canonname;
+	struct addrinfo *ai_next;
+};
+
+#define AI_PASSIVE      0x01
+#define AI_CANONNAME    0x02
+#define AI_NUMERICHOST  0x04
+#define AI_V4MAPPED     0x08
+#define AI_ALL          0x10
+#define AI_ADDRCONFIG   0x20
+#define AI_NUMERICSERV  0x400
+
+
+#define NI_NUMERICHOST  0x01
+#define NI_NUMERICSERV  0x02
+#define NI_NOFQDN       0x04
+#define NI_NAMEREQD     0x08
+#define NI_DGRAM        0x10
+#define NI_NUMERICSCOPE 0x100
+
+#define EAI_BADFLAGS   -1
+#define EAI_NONAME     -2
+#define EAI_AGAIN      -3
+#define EAI_FAIL       -4
+#define EAI_NODATA     -5
+#define EAI_FAMILY     -6
+#define EAI_SOCKTYPE   -7
+#define EAI_SERVICE    -8
+#define EAI_MEMORY     -10
+#define EAI_SYSTEM     -11
+#define EAI_OVERFLOW   -12
+
+int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);
+void freeaddrinfo (struct addrinfo *);
+int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);
+const char *gai_strerror(int);
+
+
+/* Legacy functions follow (marked OBsolete in SUS) */
+
+struct netent {
+	char *n_name;
+	char **n_aliases;
+	int n_addrtype;
+	uint32_t n_net;
+};
+
+struct hostent {
+	char *h_name;
+	char **h_aliases;
+	int h_addrtype;
+	int h_length;
+	char **h_addr_list;
+};
+#define h_addr h_addr_list[0]
+
+struct servent {
+	char *s_name;
+	char **s_aliases;
+	int s_port;
+	char *s_proto;
+};
+
+struct protoent {
+	char *p_name;
+	char **p_aliases;
+	int p_proto;
+};
+
+void sethostent (int);
+void endhostent (void);
+struct hostent *gethostent (void);
+
+void setnetent (int);
+void endnetent (void);
+struct netent *getnetent (void);
+struct netent *getnetbyaddr (uint32_t, int);
+struct netent *getnetbyname (const char *);
+
+void setservent (int);
+void endservent (void);
+struct servent *getservent (void);
+struct servent *getservbyname (const char *, const char *);
+struct servent *getservbyport (int, const char *);
+
+void setprotoent (int);
+void endprotoent (void);
+struct protoent *getprotoent (void);
+struct protoent *getprotobyname (const char *);
+struct protoent *getprotobynumber (int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+struct hostent *gethostbyname (const char *);
+struct hostent *gethostbyaddr (const void *, socklen_t, int);
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int *__h_errno_location(void);
+#define h_errno (*__h_errno_location())
+#define HOST_NOT_FOUND 1
+#define TRY_AGAIN      2
+#define NO_RECOVERY    3
+#define NO_DATA        4
+#define NO_ADDRESS     NO_DATA
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void herror(const char *);
+const char *hstrerror(int);
+int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
+int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
+struct hostent *gethostbyname2(const char *, int);
+int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);
+int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);
+int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);
+#define EAI_NODATA     -5
+#define EAI_ADDRFAMILY -9
+#define EAI_INPROGRESS -100
+#define EAI_CANCELED   -101
+#define EAI_NOTCANCELED -102
+#define EAI_ALLDONE    -103
+#define EAI_INTR       -104
+#define EAI_IDN_ENCODE -105
+#define NI_MAXHOST 255
+#define NI_MAXSERV 32
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netinet/ether.h b/musl-include/x86_64/netinet/ether.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/ether.h
@@ -0,0 +1,22 @@
+#ifndef _NETINET_ETHER_H
+#define _NETINET_ETHER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <netinet/if_ether.h>
+
+char *ether_ntoa (const struct ether_addr *);
+struct ether_addr *ether_aton (const char *);
+char *ether_ntoa_r (const struct ether_addr *, char *);
+struct ether_addr *ether_aton_r (const char *, struct ether_addr *);
+int ether_line(const char *, struct ether_addr *, char *);
+int ether_ntohost(char *, const struct ether_addr *);
+int ether_hostton(const char *, struct ether_addr *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netinet/icmp6.h b/musl-include/x86_64/netinet/icmp6.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/icmp6.h
@@ -0,0 +1,305 @@
+#ifndef _NETINET_ICMP6_H
+#define _NETINET_ICMP6_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <string.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#define ICMP6_FILTER 1
+
+#define ICMP6_FILTER_BLOCK		1
+#define ICMP6_FILTER_PASS		2
+#define ICMP6_FILTER_BLOCKOTHERS	3
+#define ICMP6_FILTER_PASSONLY		4
+
+struct icmp6_filter {
+	uint32_t icmp6_filt[8];
+};
+
+struct icmp6_hdr {
+	uint8_t     icmp6_type;
+	uint8_t     icmp6_code;
+	uint16_t    icmp6_cksum;
+	union {
+		uint32_t  icmp6_un_data32[1];
+		uint16_t  icmp6_un_data16[2];
+		uint8_t   icmp6_un_data8[4];
+	} icmp6_dataun;
+};
+
+#define icmp6_data32    icmp6_dataun.icmp6_un_data32
+#define icmp6_data16    icmp6_dataun.icmp6_un_data16
+#define icmp6_data8     icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr      icmp6_data32[0]
+#define icmp6_mtu       icmp6_data32[0]
+#define icmp6_id        icmp6_data16[0]
+#define icmp6_seq       icmp6_data16[1]
+#define icmp6_maxdelay  icmp6_data16[0]
+
+#define ICMP6_DST_UNREACH             1
+#define ICMP6_PACKET_TOO_BIG          2
+#define ICMP6_TIME_EXCEEDED           3
+#define ICMP6_PARAM_PROB              4
+
+#define ICMP6_INFOMSG_MASK  0x80
+
+#define ICMP6_ECHO_REQUEST          128
+#define ICMP6_ECHO_REPLY            129
+#define MLD_LISTENER_QUERY          130
+#define MLD_LISTENER_REPORT         131
+#define MLD_LISTENER_REDUCTION      132
+
+#define ICMP6_DST_UNREACH_NOROUTE     0
+#define ICMP6_DST_UNREACH_ADMIN       1
+#define ICMP6_DST_UNREACH_BEYONDSCOPE 2
+#define ICMP6_DST_UNREACH_ADDR        3
+#define ICMP6_DST_UNREACH_NOPORT      4
+
+#define ICMP6_TIME_EXCEED_TRANSIT     0
+#define ICMP6_TIME_EXCEED_REASSEMBLY  1
+
+#define ICMP6_PARAMPROB_HEADER        0
+#define ICMP6_PARAMPROB_NEXTHEADER    1
+#define ICMP6_PARAMPROB_OPTION        2
+
+#define ICMP6_FILTER_WILLPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+
+#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+
+#define ICMP6_FILTER_SETPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) |=  (1 << ((type) & 31))))
+
+#define ICMP6_FILTER_SETPASSALL(filterp) \
+	memset (filterp, 0, sizeof (struct icmp6_filter));
+
+#define ICMP6_FILTER_SETBLOCKALL(filterp) \
+	memset (filterp, 0xFF, sizeof (struct icmp6_filter));
+
+#define ND_ROUTER_SOLICIT           133
+#define ND_ROUTER_ADVERT            134
+#define ND_NEIGHBOR_SOLICIT         135
+#define ND_NEIGHBOR_ADVERT          136
+#define ND_REDIRECT                 137
+
+struct nd_router_solicit {
+	struct icmp6_hdr  nd_rs_hdr;
+};
+
+#define nd_rs_type               nd_rs_hdr.icmp6_type
+#define nd_rs_code               nd_rs_hdr.icmp6_code
+#define nd_rs_cksum              nd_rs_hdr.icmp6_cksum
+#define nd_rs_reserved           nd_rs_hdr.icmp6_data32[0]
+
+struct nd_router_advert {
+	struct icmp6_hdr  nd_ra_hdr;
+	uint32_t   nd_ra_reachable;
+	uint32_t   nd_ra_retransmit;
+};
+
+#define nd_ra_type               nd_ra_hdr.icmp6_type
+#define nd_ra_code               nd_ra_hdr.icmp6_code
+#define nd_ra_cksum              nd_ra_hdr.icmp6_cksum
+#define nd_ra_curhoplimit        nd_ra_hdr.icmp6_data8[0]
+#define nd_ra_flags_reserved     nd_ra_hdr.icmp6_data8[1]
+#define ND_RA_FLAG_MANAGED       0x80
+#define ND_RA_FLAG_OTHER         0x40
+#define ND_RA_FLAG_HOME_AGENT    0x20
+#define nd_ra_router_lifetime    nd_ra_hdr.icmp6_data16[1]
+
+struct nd_neighbor_solicit {
+	struct icmp6_hdr  nd_ns_hdr;
+	struct in6_addr   nd_ns_target;
+};
+
+#define nd_ns_type               nd_ns_hdr.icmp6_type
+#define nd_ns_code               nd_ns_hdr.icmp6_code
+#define nd_ns_cksum              nd_ns_hdr.icmp6_cksum
+#define nd_ns_reserved           nd_ns_hdr.icmp6_data32[0]
+
+struct nd_neighbor_advert {
+	struct icmp6_hdr  nd_na_hdr;
+	struct in6_addr   nd_na_target;
+};
+
+#define nd_na_type               nd_na_hdr.icmp6_type
+#define nd_na_code               nd_na_hdr.icmp6_code
+#define nd_na_cksum              nd_na_hdr.icmp6_cksum
+#define nd_na_flags_reserved     nd_na_hdr.icmp6_data32[0]
+#if     __BYTE_ORDER == __BIG_ENDIAN
+#define ND_NA_FLAG_ROUTER        0x80000000
+#define ND_NA_FLAG_SOLICITED     0x40000000
+#define ND_NA_FLAG_OVERRIDE      0x20000000
+#else
+#define ND_NA_FLAG_ROUTER        0x00000080
+#define ND_NA_FLAG_SOLICITED     0x00000040
+#define ND_NA_FLAG_OVERRIDE      0x00000020
+#endif
+
+struct nd_redirect {
+	struct icmp6_hdr  nd_rd_hdr;
+	struct in6_addr   nd_rd_target;
+	struct in6_addr   nd_rd_dst;
+};
+
+#define nd_rd_type               nd_rd_hdr.icmp6_type
+#define nd_rd_code               nd_rd_hdr.icmp6_code
+#define nd_rd_cksum              nd_rd_hdr.icmp6_cksum
+#define nd_rd_reserved           nd_rd_hdr.icmp6_data32[0]
+
+struct nd_opt_hdr {
+	uint8_t  nd_opt_type;
+	uint8_t  nd_opt_len;
+};
+
+#define ND_OPT_SOURCE_LINKADDR		1
+#define ND_OPT_TARGET_LINKADDR		2
+#define ND_OPT_PREFIX_INFORMATION	3
+#define ND_OPT_REDIRECTED_HEADER	4
+#define ND_OPT_MTU			5
+#define ND_OPT_RTR_ADV_INTERVAL		7
+#define ND_OPT_HOME_AGENT_INFO		8
+
+struct nd_opt_prefix_info {
+	uint8_t   nd_opt_pi_type;
+	uint8_t   nd_opt_pi_len;
+	uint8_t   nd_opt_pi_prefix_len;
+	uint8_t   nd_opt_pi_flags_reserved;
+	uint32_t  nd_opt_pi_valid_time;
+	uint32_t  nd_opt_pi_preferred_time;
+	uint32_t  nd_opt_pi_reserved2;
+	struct in6_addr  nd_opt_pi_prefix;
+};
+
+#define ND_OPT_PI_FLAG_ONLINK	0x80
+#define ND_OPT_PI_FLAG_AUTO	0x40
+#define ND_OPT_PI_FLAG_RADDR	0x20
+
+struct nd_opt_rd_hdr {
+	uint8_t   nd_opt_rh_type;
+	uint8_t   nd_opt_rh_len;
+	uint16_t  nd_opt_rh_reserved1;
+	uint32_t  nd_opt_rh_reserved2;
+};
+
+struct nd_opt_mtu {
+	uint8_t   nd_opt_mtu_type;
+	uint8_t   nd_opt_mtu_len;
+	uint16_t  nd_opt_mtu_reserved;
+	uint32_t  nd_opt_mtu_mtu;
+};
+
+struct mld_hdr {
+	struct icmp6_hdr    mld_icmp6_hdr;
+	struct in6_addr     mld_addr;
+};
+
+#define mld_type        mld_icmp6_hdr.icmp6_type
+#define mld_code        mld_icmp6_hdr.icmp6_code
+#define mld_cksum       mld_icmp6_hdr.icmp6_cksum
+#define mld_maxdelay    mld_icmp6_hdr.icmp6_data16[0]
+#define mld_reserved    mld_icmp6_hdr.icmp6_data16[1]
+
+#define ICMP6_ROUTER_RENUMBERING    138
+
+struct icmp6_router_renum {
+	struct icmp6_hdr    rr_hdr;
+	uint8_t             rr_segnum;
+	uint8_t             rr_flags;
+	uint16_t            rr_maxdelay;
+	uint32_t            rr_reserved;
+};
+
+#define rr_type		rr_hdr.icmp6_type
+#define rr_code         rr_hdr.icmp6_code
+#define rr_cksum        rr_hdr.icmp6_cksum
+#define rr_seqnum       rr_hdr.icmp6_data32[0]
+
+#define ICMP6_RR_FLAGS_TEST             0x80
+#define ICMP6_RR_FLAGS_REQRESULT        0x40
+#define ICMP6_RR_FLAGS_FORCEAPPLY       0x20
+#define ICMP6_RR_FLAGS_SPECSITE         0x10
+#define ICMP6_RR_FLAGS_PREVDONE         0x08
+
+struct rr_pco_match {
+	uint8_t             rpm_code;
+	uint8_t             rpm_len;
+	uint8_t             rpm_ordinal;
+	uint8_t             rpm_matchlen;
+	uint8_t             rpm_minlen;
+	uint8_t             rpm_maxlen;
+	uint16_t            rpm_reserved;
+	struct in6_addr     rpm_prefix;
+};
+
+#define RPM_PCO_ADD             1
+#define RPM_PCO_CHANGE          2
+#define RPM_PCO_SETGLOBAL       3
+
+struct rr_pco_use {
+	uint8_t             rpu_uselen;
+	uint8_t             rpu_keeplen;
+	uint8_t             rpu_ramask;
+	uint8_t             rpu_raflags;
+	uint32_t            rpu_vltime;
+	uint32_t            rpu_pltime;
+	uint32_t            rpu_flags;
+	struct in6_addr     rpu_prefix;
+};
+
+#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK  0x20
+#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO    0x10
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
+#else
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
+#endif
+
+struct rr_result {
+	uint16_t            rrr_flags;
+	uint8_t             rrr_ordinal;
+	uint8_t             rrr_matchedlen;
+	uint32_t            rrr_ifid;
+	struct in6_addr     rrr_prefix;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define ICMP6_RR_RESULT_FLAGS_OOB       0x0002
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
+#else
+#define ICMP6_RR_RESULT_FLAGS_OOB       0x0200
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
+#endif
+
+struct nd_opt_adv_interval {
+	uint8_t   nd_opt_adv_interval_type;
+	uint8_t   nd_opt_adv_interval_len;
+	uint16_t  nd_opt_adv_interval_reserved;
+	uint32_t  nd_opt_adv_interval_ival;
+};
+
+struct nd_opt_home_agent_info {
+	uint8_t   nd_opt_home_agent_info_type;
+	uint8_t   nd_opt_home_agent_info_len;
+	uint16_t  nd_opt_home_agent_info_reserved;
+	uint16_t  nd_opt_home_agent_info_preference;
+	uint16_t  nd_opt_home_agent_info_lifetime;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netinet/if_ether.h b/musl-include/x86_64/netinet/if_ether.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/if_ether.h
@@ -0,0 +1,149 @@
+#ifndef _NETINET_IF_ETHER_H
+#define _NETINET_IF_ETHER_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#define ETH_ALEN	6
+#define ETH_TLEN	2
+#define ETH_HLEN	14
+#define ETH_ZLEN	60
+#define ETH_DATA_LEN	1500
+#define ETH_FRAME_LEN	1514
+#define ETH_FCS_LEN	4
+#define ETH_MIN_MTU	68
+#define ETH_MAX_MTU	0xFFFFU
+
+#define ETH_P_LOOP	0x0060
+#define ETH_P_PUP	0x0200
+#define ETH_P_PUPAT	0x0201
+#define ETH_P_TSN	0x22F0
+#define ETH_P_ERSPAN2	0x22EB
+#define ETH_P_IP	0x0800
+#define ETH_P_X25	0x0805
+#define ETH_P_ARP	0x0806
+#define	ETH_P_BPQ	0x08FF
+#define ETH_P_IEEEPUP	0x0a00
+#define ETH_P_IEEEPUPAT	0x0a01
+#define ETH_P_BATMAN	0x4305
+#define ETH_P_DEC       0x6000
+#define ETH_P_DNA_DL    0x6001
+#define ETH_P_DNA_RC    0x6002
+#define ETH_P_DNA_RT    0x6003
+#define ETH_P_LAT       0x6004
+#define ETH_P_DIAG      0x6005
+#define ETH_P_CUST      0x6006
+#define ETH_P_SCA       0x6007
+#define ETH_P_TEB	0x6558
+#define ETH_P_RARP      0x8035
+#define ETH_P_ATALK	0x809B
+#define ETH_P_AARP	0x80F3
+#define ETH_P_8021Q	0x8100
+#define ETH_P_IPX	0x8137
+#define ETH_P_IPV6	0x86DD
+#define ETH_P_PAUSE	0x8808
+#define ETH_P_SLOW	0x8809
+#define ETH_P_WCCP	0x883E
+#define ETH_P_MPLS_UC	0x8847
+#define ETH_P_MPLS_MC	0x8848
+#define ETH_P_ATMMPOA	0x884c
+#define ETH_P_PPP_DISC	0x8863
+#define ETH_P_PPP_SES	0x8864
+#define ETH_P_LINK_CTL	0x886c
+#define ETH_P_ATMFATE	0x8884
+#define ETH_P_PAE	0x888E
+#define ETH_P_AOE	0x88A2
+#define ETH_P_8021AD	0x88A8
+#define ETH_P_802_EX1	0x88B5
+#define ETH_P_ERSPAN	0x88BE
+#define ETH_P_PREAUTH	0x88C7
+#define ETH_P_TIPC	0x88CA
+#define ETH_P_LLDP	0x88CC
+#define ETH_P_MRP	0x88E3
+#define ETH_P_MACSEC	0x88E5
+#define ETH_P_8021AH	0x88E7
+#define ETH_P_MVRP	0x88F5
+#define ETH_P_1588	0x88F7
+#define ETH_P_NCSI	0x88F8
+#define ETH_P_PRP	0x88FB
+#define ETH_P_CFM	0x8902
+#define ETH_P_FCOE	0x8906
+#define ETH_P_TDLS	0x890D
+#define ETH_P_FIP	0x8914
+#define ETH_P_IBOE	0x8915
+#define ETH_P_80221	0x8917
+#define ETH_P_HSR	0x892F
+#define ETH_P_NSH	0x894F
+#define ETH_P_LOOPBACK	0x9000
+#define ETH_P_QINQ1	0x9100
+#define ETH_P_QINQ2	0x9200
+#define ETH_P_QINQ3	0x9300
+#define ETH_P_EDSA	0xDADA
+#define ETH_P_DSA_8021Q	0xDADB
+#define ETH_P_IFE	0xED3E
+#define ETH_P_AF_IUCV	0xFBFB
+
+#define ETH_P_802_3_MIN	0x0600
+
+#define ETH_P_802_3	0x0001
+#define ETH_P_AX25	0x0002
+#define ETH_P_ALL	0x0003
+#define ETH_P_802_2	0x0004
+#define ETH_P_SNAP	0x0005
+#define ETH_P_DDCMP     0x0006
+#define ETH_P_WAN_PPP   0x0007
+#define ETH_P_PPP_MP    0x0008
+#define ETH_P_LOCALTALK 0x0009
+#define ETH_P_CAN	0x000C
+#define ETH_P_CANFD	0x000D
+#define ETH_P_PPPTALK	0x0010
+#define ETH_P_TR_802_2	0x0011
+#define ETH_P_MOBITEX	0x0015
+#define ETH_P_CONTROL	0x0016
+#define ETH_P_IRDA	0x0017
+#define ETH_P_ECONET	0x0018
+#define ETH_P_HDLC	0x0019
+#define ETH_P_ARCNET	0x001A
+#define ETH_P_DSA	0x001B
+#define ETH_P_TRAILER	0x001C
+#define ETH_P_PHONET	0x00F5
+#define ETH_P_IEEE802154 0x00F6
+#define ETH_P_CAIF	0x00F7
+#define ETH_P_XDSA	0x00F8
+#define ETH_P_MAP	0x00F9
+
+struct ethhdr {
+	uint8_t h_dest[ETH_ALEN];
+	uint8_t h_source[ETH_ALEN];
+	uint16_t h_proto;
+};
+
+#include <net/ethernet.h>
+#include <net/if_arp.h>
+
+struct	ether_arp {
+	struct	arphdr ea_hdr;
+	uint8_t arp_sha[ETH_ALEN];
+	uint8_t arp_spa[4];
+	uint8_t arp_tha[ETH_ALEN];
+	uint8_t arp_tpa[4];
+};
+#define	arp_hrd	ea_hdr.ar_hrd
+#define	arp_pro	ea_hdr.ar_pro
+#define	arp_hln	ea_hdr.ar_hln
+#define	arp_pln	ea_hdr.ar_pln
+#define	arp_op	ea_hdr.ar_op
+
+#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
+do { \
+	(enaddr)[0] = 0x01; \
+	(enaddr)[1] = 0x00; \
+	(enaddr)[2] = 0x5e; \
+	(enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
+	(enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
+	(enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
+} while(0)
+
+#define __UAPI_DEF_ETHHDR       0
+
+#endif
diff --git a/musl-include/x86_64/netinet/igmp.h b/musl-include/x86_64/netinet/igmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/igmp.h
@@ -0,0 +1,45 @@
+#ifndef _NETINET_IGMP_H
+#define _NETINET_IGMP_H
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct igmp {
+	uint8_t igmp_type;
+	uint8_t igmp_code;
+	uint16_t igmp_cksum;
+	struct in_addr igmp_group;
+};
+
+#define IGMP_MINLEN			8
+
+#define IGMP_MEMBERSHIP_QUERY   	0x11
+#define IGMP_V1_MEMBERSHIP_REPORT	0x12
+#define IGMP_V2_MEMBERSHIP_REPORT	0x16
+#define IGMP_V2_LEAVE_GROUP		0x17
+
+#define IGMP_DVMRP			0x13
+#define IGMP_PIM			0x14
+#define IGMP_TRACE			0x15
+
+#define IGMP_MTRACE_RESP		0x1e
+#define IGMP_MTRACE			0x1f
+
+#define IGMP_MAX_HOST_REPORT_DELAY	10
+#define IGMP_TIMER_SCALE		10
+
+#define IGMP_DELAYING_MEMBER	1
+#define IGMP_IDLE_MEMBER	2
+#define IGMP_LAZY_MEMBER	3
+#define IGMP_SLEEPING_MEMBER	4
+#define IGMP_AWAKENING_MEMBER	5
+
+#define IGMP_v1_ROUTER		1
+#define IGMP_v2_ROUTER		2
+
+#define IGMP_HOST_MEMBERSHIP_QUERY	IGMP_MEMBERSHIP_QUERY
+#define IGMP_HOST_MEMBERSHIP_REPORT	IGMP_V1_MEMBERSHIP_REPORT
+#define IGMP_HOST_NEW_MEMBERSHIP_REPORT	IGMP_V2_MEMBERSHIP_REPORT
+#define IGMP_HOST_LEAVE_MESSAGE		IGMP_V2_LEAVE_GROUP
+
+#endif
diff --git a/musl-include/x86_64/netinet/in.h b/musl-include/x86_64/netinet/in.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/in.h
@@ -0,0 +1,417 @@
+#ifndef	_NETINET_IN_H
+#define	_NETINET_IN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <inttypes.h>
+#include <sys/socket.h>
+
+typedef uint16_t in_port_t;
+typedef uint32_t in_addr_t;
+struct in_addr { in_addr_t s_addr; };
+
+struct sockaddr_in {
+	sa_family_t sin_family;
+	in_port_t sin_port;
+	struct in_addr sin_addr;
+	uint8_t sin_zero[8];
+};
+
+struct in6_addr {
+	union {
+		uint8_t __s6_addr[16];
+		uint16_t __s6_addr16[8];
+		uint32_t __s6_addr32[4];
+	} __in6_union;
+};
+#define s6_addr __in6_union.__s6_addr
+#define s6_addr16 __in6_union.__s6_addr16
+#define s6_addr32 __in6_union.__s6_addr32
+
+struct sockaddr_in6 {
+	sa_family_t     sin6_family;
+	in_port_t       sin6_port;
+	uint32_t        sin6_flowinfo;
+	struct in6_addr sin6_addr;
+	uint32_t        sin6_scope_id;
+};
+
+struct ipv6_mreq {
+	struct in6_addr ipv6mr_multiaddr;
+	unsigned        ipv6mr_interface;
+};
+
+#define INADDR_ANY        ((in_addr_t) 0x00000000)
+#define INADDR_BROADCAST  ((in_addr_t) 0xffffffff)
+#define INADDR_NONE       ((in_addr_t) 0xffffffff)
+#define INADDR_LOOPBACK   ((in_addr_t) 0x7f000001)
+#define INADDR_DUMMY      ((in_addr_t) 0xc0000008)
+
+#define INADDR_UNSPEC_GROUP     ((in_addr_t) 0xe0000000)
+#define INADDR_ALLHOSTS_GROUP   ((in_addr_t) 0xe0000001)
+#define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002)
+#define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a)
+#define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff)
+
+#define IN6ADDR_ANY_INIT      { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
+#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
+
+extern const struct in6_addr in6addr_any, in6addr_loopback;
+
+#define INET_ADDRSTRLEN  16
+#define INET6_ADDRSTRLEN 46
+
+uint32_t htonl(uint32_t);
+uint16_t htons(uint16_t);
+uint32_t ntohl(uint32_t);
+uint16_t ntohs(uint16_t);
+
+#define IPPORT_RESERVED 1024
+
+#define IPPROTO_IP       0
+#define IPPROTO_HOPOPTS  0
+#define IPPROTO_ICMP     1
+#define IPPROTO_IGMP     2
+#define IPPROTO_IPIP     4
+#define IPPROTO_TCP      6
+#define IPPROTO_EGP      8
+#define IPPROTO_PUP      12
+#define IPPROTO_UDP      17
+#define IPPROTO_IDP      22
+#define IPPROTO_TP       29
+#define IPPROTO_DCCP     33
+#define IPPROTO_IPV6     41
+#define IPPROTO_ROUTING  43
+#define IPPROTO_FRAGMENT 44
+#define IPPROTO_RSVP     46
+#define IPPROTO_GRE      47
+#define IPPROTO_ESP      50
+#define IPPROTO_AH       51
+#define IPPROTO_ICMPV6   58
+#define IPPROTO_NONE     59
+#define IPPROTO_DSTOPTS  60
+#define IPPROTO_MTP      92
+#define IPPROTO_BEETPH   94
+#define IPPROTO_ENCAP    98
+#define IPPROTO_PIM      103
+#define IPPROTO_COMP     108
+#define IPPROTO_SCTP     132
+#define IPPROTO_MH       135
+#define IPPROTO_UDPLITE  136
+#define IPPROTO_MPLS     137
+#define IPPROTO_ETHERNET 143
+#define IPPROTO_RAW      255
+#define IPPROTO_MPTCP    262
+#define IPPROTO_MAX      263
+
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
+
+#define IN6_IS_ADDR_LOOPBACK(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && \
+         ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \
+         ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
+
+#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
+
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
+
+#define IN6_IS_ADDR_SITELOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0xc0)
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \
+         ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
+
+#define IN6_IS_ADDR_V4COMPAT(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
+
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
+
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
+
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
+
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
+
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
+
+#define __ARE_4_EQUAL(a,b) \
+	(!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) ))
+#define IN6_ARE_ADDR_EQUAL(a,b) \
+	__ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b))
+
+#define	IN_CLASSA(a)		((((in_addr_t)(a)) & 0x80000000) == 0)
+#define	IN_CLASSA_NET		0xff000000
+#define	IN_CLASSA_NSHIFT	24
+#define	IN_CLASSA_HOST		(0xffffffff & ~IN_CLASSA_NET)
+#define	IN_CLASSA_MAX		128
+#define	IN_CLASSB(a)		((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
+#define	IN_CLASSB_NET		0xffff0000
+#define	IN_CLASSB_NSHIFT	16
+#define	IN_CLASSB_HOST		(0xffffffff & ~IN_CLASSB_NET)
+#define	IN_CLASSB_MAX		65536
+#define	IN_CLASSC(a)		((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
+#define	IN_CLASSC_NET		0xffffff00
+#define	IN_CLASSC_NSHIFT	8
+#define	IN_CLASSC_HOST		(0xffffffff & ~IN_CLASSC_NET)
+#define	IN_CLASSD(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
+#define	IN_MULTICAST(a)		IN_CLASSD(a)
+#define	IN_EXPERIMENTAL(a)	((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
+#define	IN_BADCLASS(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
+
+#define IN_LOOPBACKNET 127
+
+
+#define IP_TOS             1
+#define IP_TTL             2
+#define IP_HDRINCL         3
+#define IP_OPTIONS         4
+#define IP_ROUTER_ALERT    5
+#define IP_RECVOPTS        6
+#define IP_RETOPTS         7
+#define IP_PKTINFO         8
+#define IP_PKTOPTIONS      9
+#define IP_PMTUDISC        10
+#define IP_MTU_DISCOVER    10
+#define IP_RECVERR         11
+#define IP_RECVTTL         12
+#define IP_RECVTOS         13
+#define IP_MTU             14
+#define IP_FREEBIND        15
+#define IP_IPSEC_POLICY    16
+#define IP_XFRM_POLICY     17
+#define IP_PASSSEC         18
+#define IP_TRANSPARENT     19
+#define IP_ORIGDSTADDR     20
+#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
+#define IP_MINTTL          21
+#define IP_NODEFRAG        22
+#define IP_CHECKSUM        23
+#define IP_BIND_ADDRESS_NO_PORT 24
+#define IP_RECVFRAGSIZE    25
+#define IP_RECVERR_RFC4884 26
+#define IP_MULTICAST_IF    32
+#define IP_MULTICAST_TTL   33
+#define IP_MULTICAST_LOOP  34
+#define IP_ADD_MEMBERSHIP  35
+#define IP_DROP_MEMBERSHIP 36
+#define IP_UNBLOCK_SOURCE  37
+#define IP_BLOCK_SOURCE    38
+#define IP_ADD_SOURCE_MEMBERSHIP  39
+#define IP_DROP_SOURCE_MEMBERSHIP 40
+#define IP_MSFILTER        41
+#define IP_MULTICAST_ALL   49
+#define IP_UNICAST_IF      50
+
+#define IP_RECVRETOPTS IP_RETOPTS
+
+#define IP_PMTUDISC_DONT   0
+#define IP_PMTUDISC_WANT   1
+#define IP_PMTUDISC_DO     2
+#define IP_PMTUDISC_PROBE  3
+#define IP_PMTUDISC_INTERFACE 4
+#define IP_PMTUDISC_OMIT   5
+
+#define IP_DEFAULT_MULTICAST_TTL        1
+#define IP_DEFAULT_MULTICAST_LOOP       1
+#define IP_MAX_MEMBERSHIPS              20
+
+struct ip_opts {
+	struct in_addr ip_dst;
+	char ip_opts[40];
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define MCAST_JOIN_GROUP   42
+#define MCAST_BLOCK_SOURCE 43
+#define MCAST_UNBLOCK_SOURCE      44
+#define MCAST_LEAVE_GROUP  45
+#define MCAST_JOIN_SOURCE_GROUP   46
+#define MCAST_LEAVE_SOURCE_GROUP  47
+#define MCAST_MSFILTER     48
+
+#define MCAST_EXCLUDE 0
+#define MCAST_INCLUDE 1
+
+struct ip_mreq {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_interface;
+};
+
+struct ip_mreqn {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_address;
+	int imr_ifindex;
+};
+
+struct ip_mreq_source {
+	struct in_addr imr_multiaddr;
+	struct in_addr imr_interface;
+	struct in_addr imr_sourceaddr;
+};
+
+struct ip_msfilter {
+	struct in_addr imsf_multiaddr;
+	struct in_addr imsf_interface;
+	uint32_t imsf_fmode;
+	uint32_t imsf_numsrc;
+	struct in_addr imsf_slist[1];
+};
+#define IP_MSFILTER_SIZE(numsrc) \
+	(sizeof(struct ip_msfilter) - sizeof(struct in_addr) \
+	+ (numsrc) * sizeof(struct in_addr))
+
+struct group_req {
+	uint32_t gr_interface;
+	struct sockaddr_storage gr_group;
+};
+
+struct group_source_req {
+	uint32_t gsr_interface;
+	struct sockaddr_storage gsr_group;
+	struct sockaddr_storage gsr_source;
+};
+
+struct group_filter {
+	uint32_t gf_interface;
+	struct sockaddr_storage gf_group;
+	uint32_t gf_fmode;
+	uint32_t gf_numsrc;
+	struct sockaddr_storage gf_slist[1];
+};
+#define GROUP_FILTER_SIZE(numsrc) \
+	(sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \
+	+ (numsrc) * sizeof(struct sockaddr_storage))
+
+struct in_pktinfo {
+	int ipi_ifindex;
+	struct in_addr ipi_spec_dst;
+	struct in_addr ipi_addr;
+};
+
+struct in6_pktinfo {
+	struct in6_addr ipi6_addr;
+	unsigned ipi6_ifindex;
+};
+
+struct ip6_mtuinfo {
+	struct sockaddr_in6 ip6m_addr;
+	uint32_t ip6m_mtu;
+};
+#endif
+
+#define IPV6_ADDRFORM           1
+#define IPV6_2292PKTINFO        2
+#define IPV6_2292HOPOPTS        3
+#define IPV6_2292DSTOPTS        4
+#define IPV6_2292RTHDR          5
+#define IPV6_2292PKTOPTIONS     6
+#define IPV6_CHECKSUM           7
+#define IPV6_2292HOPLIMIT       8
+#define IPV6_NEXTHOP            9
+#define IPV6_AUTHHDR            10
+#define IPV6_UNICAST_HOPS       16
+#define IPV6_MULTICAST_IF       17
+#define IPV6_MULTICAST_HOPS     18
+#define IPV6_MULTICAST_LOOP     19
+#define IPV6_JOIN_GROUP         20
+#define IPV6_LEAVE_GROUP        21
+#define IPV6_ROUTER_ALERT       22
+#define IPV6_MTU_DISCOVER       23
+#define IPV6_MTU                24
+#define IPV6_RECVERR            25
+#define IPV6_V6ONLY             26
+#define IPV6_JOIN_ANYCAST       27
+#define IPV6_LEAVE_ANYCAST      28
+#define IPV6_MULTICAST_ALL      29
+#define IPV6_ROUTER_ALERT_ISOLATE 30
+#define IPV6_IPSEC_POLICY       34
+#define IPV6_XFRM_POLICY        35
+#define IPV6_HDRINCL            36
+
+#define IPV6_RECVPKTINFO        49
+#define IPV6_PKTINFO            50
+#define IPV6_RECVHOPLIMIT       51
+#define IPV6_HOPLIMIT           52
+#define IPV6_RECVHOPOPTS        53
+#define IPV6_HOPOPTS            54
+#define IPV6_RTHDRDSTOPTS       55
+#define IPV6_RECVRTHDR          56
+#define IPV6_RTHDR              57
+#define IPV6_RECVDSTOPTS        58
+#define IPV6_DSTOPTS            59
+#define IPV6_RECVPATHMTU        60
+#define IPV6_PATHMTU            61
+#define IPV6_DONTFRAG           62
+#define IPV6_RECVTCLASS         66
+#define IPV6_TCLASS             67
+#define IPV6_AUTOFLOWLABEL      70
+#define IPV6_ADDR_PREFERENCES   72
+#define IPV6_MINHOPCOUNT        73
+#define IPV6_ORIGDSTADDR        74
+#define IPV6_RECVORIGDSTADDR    IPV6_ORIGDSTADDR
+#define IPV6_TRANSPARENT        75
+#define IPV6_UNICAST_IF         76
+#define IPV6_RECVFRAGSIZE       77
+#define IPV6_FREEBIND           78
+
+#define IPV6_ADD_MEMBERSHIP     IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP    IPV6_LEAVE_GROUP
+#define IPV6_RXHOPOPTS          IPV6_HOPOPTS
+#define IPV6_RXDSTOPTS          IPV6_DSTOPTS
+
+#define IPV6_PMTUDISC_DONT      0
+#define IPV6_PMTUDISC_WANT      1
+#define IPV6_PMTUDISC_DO        2
+#define IPV6_PMTUDISC_PROBE     3
+#define IPV6_PMTUDISC_INTERFACE 4
+#define IPV6_PMTUDISC_OMIT      5
+
+#define IPV6_PREFER_SRC_TMP            0x0001
+#define IPV6_PREFER_SRC_PUBLIC         0x0002
+#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
+#define IPV6_PREFER_SRC_COA            0x0004
+#define IPV6_PREFER_SRC_HOME           0x0400
+#define IPV6_PREFER_SRC_CGA            0x0008
+#define IPV6_PREFER_SRC_NONCGA         0x0800
+
+#define IPV6_RTHDR_LOOSE        0
+#define IPV6_RTHDR_STRICT       1
+
+#define IPV6_RTHDR_TYPE_0       0
+
+#define __UAPI_DEF_IN_ADDR      0
+#define __UAPI_DEF_IN_IPPROTO   0
+#define __UAPI_DEF_IN_PKTINFO   0
+#define __UAPI_DEF_IP_MREQ      0
+#define __UAPI_DEF_SOCKADDR_IN  0
+#define __UAPI_DEF_IN_CLASS     0
+#define __UAPI_DEF_IN6_ADDR     0
+#define __UAPI_DEF_IN6_ADDR_ALT 0
+#define __UAPI_DEF_SOCKADDR_IN6 0
+#define __UAPI_DEF_IPV6_MREQ    0
+#define __UAPI_DEF_IPPROTO_V6   0
+#define __UAPI_DEF_IPV6_OPTIONS 0
+#define __UAPI_DEF_IN6_PKTINFO  0
+#define __UAPI_DEF_IP6_MTUINFO  0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netinet/in_systm.h b/musl-include/x86_64/netinet/in_systm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/in_systm.h
@@ -0,0 +1,9 @@
+#ifndef _NETINET_IN_SYSTM_H
+#define _NETINET_IN_SYSTM_H
+
+#include <stdint.h>
+
+typedef uint16_t n_short;
+typedef uint32_t n_long, n_time;
+
+#endif
diff --git a/musl-include/x86_64/netinet/ip.h b/musl-include/x86_64/netinet/ip.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/ip.h
@@ -0,0 +1,199 @@
+#ifndef _NETINET_IP_H
+#define _NETINET_IP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct timestamp {
+	uint8_t len;
+	uint8_t ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int flags:4;
+	unsigned int overflow:4;
+#else
+	unsigned int overflow:4;
+	unsigned int flags:4;
+#endif
+	uint32_t data[9];
+  };
+
+struct iphdr {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ihl:4;
+	unsigned int version:4;
+#else
+	unsigned int version:4;
+	unsigned int ihl:4;
+#endif
+	uint8_t tos;
+	uint16_t tot_len;
+	uint16_t id;
+	uint16_t frag_off;
+	uint8_t ttl;
+	uint8_t protocol;
+	uint16_t check;
+	uint32_t saddr;
+	uint32_t daddr;
+};
+
+struct ip {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ip_hl:4;
+	unsigned int ip_v:4;
+#else
+	unsigned int ip_v:4;
+	unsigned int ip_hl:4;
+#endif
+	uint8_t ip_tos;
+	uint16_t ip_len;
+	uint16_t ip_id;
+	uint16_t ip_off;
+	uint8_t ip_ttl;
+	uint8_t ip_p;
+	uint16_t ip_sum;
+	struct in_addr ip_src, ip_dst;
+};
+
+#define	IP_RF 0x8000
+#define	IP_DF 0x4000
+#define	IP_MF 0x2000
+#define	IP_OFFMASK 0x1fff
+
+struct ip_timestamp {
+	uint8_t ipt_code;
+	uint8_t ipt_len;
+	uint8_t ipt_ptr;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int ipt_flg:4;
+	unsigned int ipt_oflw:4;
+#else
+	unsigned int ipt_oflw:4;
+	unsigned int ipt_flg:4;
+#endif
+	uint32_t data[9];
+};
+
+#define	IPVERSION	4
+#define	IP_MAXPACKET	65535
+
+#define	IPTOS_ECN_MASK		0x03
+#define	IPTOS_ECN(x)		((x) & IPTOS_ECN_MASK)
+#define	IPTOS_ECN_NOT_ECT	0x00
+#define	IPTOS_ECN_ECT1		0x01
+#define	IPTOS_ECN_ECT0		0x02
+#define	IPTOS_ECN_CE		0x03
+
+#define	IPTOS_DSCP_MASK		0xfc
+#define	IPTOS_DSCP(x)		((x) & IPTOS_DSCP_MASK)
+#define	IPTOS_DSCP_AF11		0x28
+#define	IPTOS_DSCP_AF12		0x30
+#define	IPTOS_DSCP_AF13		0x38
+#define	IPTOS_DSCP_AF21		0x48
+#define	IPTOS_DSCP_AF22		0x50
+#define	IPTOS_DSCP_AF23		0x58
+#define	IPTOS_DSCP_AF31		0x68
+#define	IPTOS_DSCP_AF32		0x70
+#define	IPTOS_DSCP_AF33		0x78
+#define	IPTOS_DSCP_AF41		0x88
+#define	IPTOS_DSCP_AF42		0x90
+#define	IPTOS_DSCP_AF43		0x98
+#define	IPTOS_DSCP_EF		0xb8
+
+#define	IPTOS_CLASS_MASK	0xe0
+#define	IPTOS_CLASS(x)		((x) & IPTOS_CLASS_MASK)
+#define	IPTOS_CLASS_CS0		0x00
+#define	IPTOS_CLASS_CS1		0x20
+#define	IPTOS_CLASS_CS2		0x40
+#define	IPTOS_CLASS_CS3		0x60
+#define	IPTOS_CLASS_CS4		0x80
+#define	IPTOS_CLASS_CS5		0xa0
+#define	IPTOS_CLASS_CS6		0xc0
+#define	IPTOS_CLASS_CS7		0xe0
+#define	IPTOS_CLASS_DEFAULT	IPTOS_CLASS_CS0
+
+#define	IPTOS_TOS_MASK		0x1E
+#define	IPTOS_TOS(tos)		((tos) & IPTOS_TOS_MASK)
+#define	IPTOS_LOWDELAY		0x10
+#define	IPTOS_THROUGHPUT	0x08
+#define	IPTOS_RELIABILITY	0x04
+#define	IPTOS_LOWCOST		0x02
+#define	IPTOS_MINCOST		IPTOS_LOWCOST
+
+#define	IPTOS_PREC_MASK			0xe0
+#define	IPTOS_PREC(tos)                ((tos) & IPTOS_PREC_MASK)
+#define	IPTOS_PREC_NETCONTROL		0xe0
+#define	IPTOS_PREC_INTERNETCONTROL	0xc0
+#define	IPTOS_PREC_CRITIC_ECP		0xa0
+#define	IPTOS_PREC_FLASHOVERRIDE	0x80
+#define	IPTOS_PREC_FLASH		0x60
+#define	IPTOS_PREC_IMMEDIATE		0x40
+#define	IPTOS_PREC_PRIORITY		0x20
+#define	IPTOS_PREC_ROUTINE		0x00
+
+#define	IPOPT_COPY		0x80
+#define	IPOPT_CLASS_MASK	0x60
+#define	IPOPT_NUMBER_MASK	0x1f
+
+#define	IPOPT_COPIED(o)		((o) & IPOPT_COPY)
+#define	IPOPT_CLASS(o)		((o) & IPOPT_CLASS_MASK)
+#define	IPOPT_NUMBER(o)		((o) & IPOPT_NUMBER_MASK)
+
+#define	IPOPT_CONTROL		0x00
+#define	IPOPT_RESERVED1		0x20
+#define	IPOPT_DEBMEAS		0x40
+#define	IPOPT_MEASUREMENT       IPOPT_DEBMEAS
+#define	IPOPT_RESERVED2		0x60
+
+#define	IPOPT_EOL		0
+#define	IPOPT_END		IPOPT_EOL
+#define	IPOPT_NOP		1
+#define	IPOPT_NOOP		IPOPT_NOP
+
+#define	IPOPT_RR		7
+#define	IPOPT_TS		68
+#define	IPOPT_TIMESTAMP		IPOPT_TS
+#define	IPOPT_SECURITY		130
+#define	IPOPT_SEC		IPOPT_SECURITY
+#define	IPOPT_LSRR		131
+#define	IPOPT_SATID		136
+#define	IPOPT_SID		IPOPT_SATID
+#define	IPOPT_SSRR		137
+#define	IPOPT_RA		148
+
+#define	IPOPT_OPTVAL		0
+#define	IPOPT_OLEN		1
+#define	IPOPT_OFFSET		2
+#define	IPOPT_MINOFF		4
+
+#define	MAX_IPOPTLEN		40
+
+#define	IPOPT_TS_TSONLY		0
+#define	IPOPT_TS_TSANDADDR	1
+#define	IPOPT_TS_PRESPEC	3
+
+#define	IPOPT_SECUR_UNCLASS	0x0000
+#define	IPOPT_SECUR_CONFID	0xf135
+#define	IPOPT_SECUR_EFTO	0x789a
+#define	IPOPT_SECUR_MMMM	0xbc4d
+#define	IPOPT_SECUR_RESTR	0xaf13
+#define	IPOPT_SECUR_SECRET	0xd788
+#define	IPOPT_SECUR_TOPSECRET	0x6bc5
+
+#define	MAXTTL		255
+#define	IPDEFTTL	64
+#define	IPFRAGTTL	60
+#define	IPTTLDEC	1
+
+#define	IP_MSS		576
+
+#define __UAPI_DEF_IPHDR	0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netinet/ip6.h b/musl-include/x86_64/netinet/ip6.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/ip6.h
@@ -0,0 +1,141 @@
+#ifndef _NETINET_IP6_H
+#define _NETINET_IP6_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <netinet/in.h>
+
+struct ip6_hdr {
+	union {
+		struct ip6_hdrctl {
+			uint32_t ip6_un1_flow;
+			uint16_t ip6_un1_plen;
+			uint8_t  ip6_un1_nxt;
+			uint8_t  ip6_un1_hlim;
+		} ip6_un1;
+		uint8_t ip6_un2_vfc;
+	} ip6_ctlun;
+	struct in6_addr ip6_src;
+	struct in6_addr ip6_dst;
+};
+
+#define ip6_vfc   ip6_ctlun.ip6_un2_vfc
+#define ip6_flow  ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen  ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt   ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim  ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops  ip6_ctlun.ip6_un1.ip6_un1_hlim
+
+struct ip6_ext {
+	uint8_t  ip6e_nxt;
+	uint8_t  ip6e_len;
+};
+
+struct ip6_hbh {
+	uint8_t  ip6h_nxt;
+	uint8_t  ip6h_len;
+};
+
+struct ip6_dest {
+	uint8_t  ip6d_nxt;
+	uint8_t  ip6d_len;
+};
+
+struct ip6_rthdr {
+	uint8_t  ip6r_nxt;
+	uint8_t  ip6r_len;
+	uint8_t  ip6r_type;
+	uint8_t  ip6r_segleft;
+};
+
+struct ip6_rthdr0 {
+	uint8_t  ip6r0_nxt;
+	uint8_t  ip6r0_len;
+	uint8_t  ip6r0_type;
+	uint8_t  ip6r0_segleft;
+	uint8_t  ip6r0_reserved;
+	uint8_t  ip6r0_slmap[3];
+	struct in6_addr ip6r0_addr[];
+};
+
+struct ip6_frag {
+	uint8_t   ip6f_nxt;
+	uint8_t   ip6f_reserved;
+	uint16_t  ip6f_offlg;
+	uint32_t  ip6f_ident;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IP6F_OFF_MASK       0xfff8
+#define IP6F_RESERVED_MASK  0x0006
+#define IP6F_MORE_FRAG      0x0001
+#else
+#define IP6F_OFF_MASK       0xf8ff
+#define IP6F_RESERVED_MASK  0x0600
+#define IP6F_MORE_FRAG      0x0100
+#endif
+
+struct ip6_opt {
+	uint8_t  ip6o_type;
+	uint8_t  ip6o_len;
+};
+
+#define IP6OPT_TYPE(o)		((o) & 0xc0)
+#define IP6OPT_TYPE_SKIP	0x00
+#define IP6OPT_TYPE_DISCARD	0x40
+#define IP6OPT_TYPE_FORCEICMP	0x80
+#define IP6OPT_TYPE_ICMP	0xc0
+#define IP6OPT_TYPE_MUTABLE	0x20
+
+#define IP6OPT_PAD1	0
+#define IP6OPT_PADN	1
+
+#define IP6OPT_JUMBO		0xc2
+#define IP6OPT_NSAP_ADDR	0xc3
+#define IP6OPT_TUNNEL_LIMIT	0x04
+#define IP6OPT_ROUTER_ALERT	0x05
+
+struct ip6_opt_jumbo {
+	uint8_t  ip6oj_type;
+	uint8_t  ip6oj_len;
+	uint8_t  ip6oj_jumbo_len[4];
+};
+#define IP6OPT_JUMBO_LEN	6
+
+struct ip6_opt_nsap {
+	uint8_t  ip6on_type;
+	uint8_t  ip6on_len;
+	uint8_t  ip6on_src_nsap_len;
+	uint8_t  ip6on_dst_nsap_len;
+};
+
+struct ip6_opt_tunnel {
+	uint8_t  ip6ot_type;
+	uint8_t  ip6ot_len;
+	uint8_t  ip6ot_encap_limit;
+};
+
+struct ip6_opt_router {
+	uint8_t  ip6or_type;
+	uint8_t  ip6or_len;
+	uint8_t  ip6or_value[2];
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0001
+#define IP6_ALERT_AN	0x0002
+#else
+#define IP6_ALERT_MLD	0x0000
+#define IP6_ALERT_RSVP	0x0100
+#define IP6_ALERT_AN	0x0200
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netinet/ip_icmp.h b/musl-include/x86_64/netinet/ip_icmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/ip_icmp.h
@@ -0,0 +1,193 @@
+#ifndef _NETINET_IP_ICMP_H
+#define _NETINET_IP_ICMP_H
+
+#include <stdint.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct icmphdr {
+	uint8_t type;
+	uint8_t code;
+	uint16_t checksum;
+	union {
+		struct {
+			uint16_t id;
+			uint16_t sequence;
+		} echo;
+		uint32_t gateway;
+		struct {
+			uint16_t __unused;
+			uint16_t mtu;
+		} frag;
+		uint8_t reserved[4];
+	} un;
+};
+
+#define ICMP_ECHOREPLY		0
+#define ICMP_DEST_UNREACH	3
+#define ICMP_SOURCE_QUENCH	4
+#define ICMP_REDIRECT		5
+#define ICMP_ECHO		8
+#define ICMP_TIME_EXCEEDED	11
+#define ICMP_PARAMETERPROB	12
+#define ICMP_TIMESTAMP		13
+#define ICMP_TIMESTAMPREPLY	14
+#define ICMP_INFO_REQUEST	15
+#define ICMP_INFO_REPLY		16
+#define ICMP_ADDRESS		17
+#define ICMP_ADDRESSREPLY	18
+#define NR_ICMP_TYPES		18
+
+
+#define ICMP_NET_UNREACH	0
+#define ICMP_HOST_UNREACH	1
+#define ICMP_PROT_UNREACH	2
+#define ICMP_PORT_UNREACH	3
+#define ICMP_FRAG_NEEDED	4
+#define ICMP_SR_FAILED		5
+#define ICMP_NET_UNKNOWN	6
+#define ICMP_HOST_UNKNOWN	7
+#define ICMP_HOST_ISOLATED	8
+#define ICMP_NET_ANO		9
+#define ICMP_HOST_ANO		10
+#define ICMP_NET_UNR_TOS	11
+#define ICMP_HOST_UNR_TOS	12
+#define ICMP_PKT_FILTERED	13
+#define ICMP_PREC_VIOLATION	14
+#define ICMP_PREC_CUTOFF	15
+#define NR_ICMP_UNREACH		15
+
+#define ICMP_REDIR_NET		0
+#define ICMP_REDIR_HOST		1
+#define ICMP_REDIR_NETTOS	2
+#define ICMP_REDIR_HOSTTOS	3
+
+#define ICMP_EXC_TTL		0
+#define ICMP_EXC_FRAGTIME	1
+
+
+struct icmp_ra_addr {
+	uint32_t ira_addr;
+	uint32_t ira_preference;
+};
+
+struct icmp {
+	uint8_t  icmp_type;
+	uint8_t  icmp_code;
+	uint16_t icmp_cksum;
+	union {
+		uint8_t ih_pptr;
+		struct in_addr ih_gwaddr;
+		struct ih_idseq {
+			uint16_t icd_id;
+			uint16_t icd_seq;
+		} ih_idseq;
+		uint32_t ih_void;
+
+		struct ih_pmtu {
+			uint16_t ipm_void;
+			uint16_t ipm_nextmtu;
+		} ih_pmtu;
+
+		struct ih_rtradv {
+			uint8_t irt_num_addrs;
+			uint8_t irt_wpa;
+			uint16_t irt_lifetime;
+		} ih_rtradv;
+	} icmp_hun;
+	union {
+		struct {
+			uint32_t its_otime;
+			uint32_t its_rtime;
+			uint32_t its_ttime;
+		} id_ts;
+		struct {
+			struct ip idi_ip;
+		} id_ip;
+		struct icmp_ra_addr id_radv;
+		uint32_t   id_mask;
+		uint8_t    id_data[1];
+	} icmp_dun;
+};
+
+#define	icmp_pptr	icmp_hun.ih_pptr
+#define	icmp_gwaddr	icmp_hun.ih_gwaddr
+#define	icmp_id		icmp_hun.ih_idseq.icd_id
+#define	icmp_seq	icmp_hun.ih_idseq.icd_seq
+#define	icmp_void	icmp_hun.ih_void
+#define	icmp_pmvoid	icmp_hun.ih_pmtu.ipm_void
+#define	icmp_nextmtu	icmp_hun.ih_pmtu.ipm_nextmtu
+#define	icmp_num_addrs	icmp_hun.ih_rtradv.irt_num_addrs
+#define	icmp_wpa	icmp_hun.ih_rtradv.irt_wpa
+#define	icmp_lifetime	icmp_hun.ih_rtradv.irt_lifetime
+#define	icmp_otime	icmp_dun.id_ts.its_otime
+#define	icmp_rtime	icmp_dun.id_ts.its_rtime
+#define	icmp_ttime	icmp_dun.id_ts.its_ttime
+#define	icmp_ip		icmp_dun.id_ip.idi_ip
+#define	icmp_radv	icmp_dun.id_radv
+#define	icmp_mask	icmp_dun.id_mask
+#define	icmp_data	icmp_dun.id_data
+
+#define	ICMP_MINLEN	8
+#define	ICMP_TSLEN	(8 + 3 * sizeof (n_time))
+#define	ICMP_MASKLEN	12
+#define	ICMP_ADVLENMIN	(8 + sizeof (struct ip) + 8)
+#define	ICMP_ADVLEN(p)	(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+
+#define	ICMP_UNREACH		3
+#define	ICMP_SOURCEQUENCH	4
+#define	ICMP_ROUTERADVERT	9
+#define	ICMP_ROUTERSOLICIT	10
+#define	ICMP_TIMXCEED		11
+#define	ICMP_PARAMPROB		12
+#define	ICMP_TSTAMP		13
+#define	ICMP_TSTAMPREPLY	14
+#define	ICMP_IREQ		15
+#define	ICMP_IREQREPLY		16
+#define	ICMP_MASKREQ		17
+#define	ICMP_MASKREPLY		18
+#define	ICMP_MAXTYPE		18
+
+#define	ICMP_UNREACH_NET	        0
+#define	ICMP_UNREACH_HOST	        1
+#define	ICMP_UNREACH_PROTOCOL	        2
+#define	ICMP_UNREACH_PORT	        3
+#define	ICMP_UNREACH_NEEDFRAG	        4
+#define	ICMP_UNREACH_SRCFAIL	        5
+#define	ICMP_UNREACH_NET_UNKNOWN        6
+#define	ICMP_UNREACH_HOST_UNKNOWN       7
+#define	ICMP_UNREACH_ISOLATED	        8
+#define	ICMP_UNREACH_NET_PROHIB	        9
+#define	ICMP_UNREACH_HOST_PROHIB        10
+#define	ICMP_UNREACH_TOSNET	        11
+#define	ICMP_UNREACH_TOSHOST	        12
+#define	ICMP_UNREACH_FILTER_PROHIB      13
+#define	ICMP_UNREACH_HOST_PRECEDENCE    14
+#define	ICMP_UNREACH_PRECEDENCE_CUTOFF  15
+
+#define	ICMP_REDIRECT_NET	0
+#define	ICMP_REDIRECT_HOST	1
+#define	ICMP_REDIRECT_TOSNET	2
+#define	ICMP_REDIRECT_TOSHOST	3
+
+#define	ICMP_TIMXCEED_INTRANS	0
+#define	ICMP_TIMXCEED_REASS	1
+
+#define	ICMP_PARAMPROB_OPTABSENT 1
+
+#define	ICMP_INFOTYPE(type) \
+	((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+	(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+	(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+	(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+	(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netinet/tcp.h b/musl-include/x86_64/netinet/tcp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/tcp.h
@@ -0,0 +1,305 @@
+#ifndef _NETINET_TCP_H
+#define _NETINET_TCP_H
+
+#include <features.h>
+
+#define TCP_NODELAY 1
+#define TCP_MAXSEG	 2
+#define TCP_CORK	 3
+#define TCP_KEEPIDLE	 4
+#define TCP_KEEPINTVL	 5
+#define TCP_KEEPCNT	 6
+#define TCP_SYNCNT	 7
+#define TCP_LINGER2	 8
+#define TCP_DEFER_ACCEPT 9
+#define TCP_WINDOW_CLAMP 10
+#define TCP_INFO	 11
+#define	TCP_QUICKACK	 12
+#define TCP_CONGESTION	 13
+#define TCP_MD5SIG	 14
+#define TCP_THIN_LINEAR_TIMEOUTS 16
+#define TCP_THIN_DUPACK  17
+#define TCP_USER_TIMEOUT 18
+#define TCP_REPAIR       19
+#define TCP_REPAIR_QUEUE 20
+#define TCP_QUEUE_SEQ    21
+#define TCP_REPAIR_OPTIONS 22
+#define TCP_FASTOPEN     23
+#define TCP_TIMESTAMP    24
+#define TCP_NOTSENT_LOWAT 25
+#define TCP_CC_INFO      26
+#define TCP_SAVE_SYN     27
+#define TCP_SAVED_SYN    28
+#define TCP_REPAIR_WINDOW 29
+#define TCP_FASTOPEN_CONNECT 30
+#define TCP_ULP          31
+#define TCP_MD5SIG_EXT   32
+#define TCP_FASTOPEN_KEY 33
+#define TCP_FASTOPEN_NO_COOKIE 34
+#define TCP_ZEROCOPY_RECEIVE   35
+#define TCP_INQ          36
+#define TCP_TX_DELAY     37
+
+#define TCP_CM_INQ TCP_INQ
+
+#define TCP_ESTABLISHED  1
+#define TCP_SYN_SENT     2
+#define TCP_SYN_RECV     3
+#define TCP_FIN_WAIT1    4
+#define TCP_FIN_WAIT2    5
+#define TCP_TIME_WAIT    6
+#define TCP_CLOSE        7
+#define TCP_CLOSE_WAIT   8
+#define TCP_LAST_ACK     9
+#define TCP_LISTEN       10
+#define TCP_CLOSING      11
+
+enum {
+	TCP_NLA_PAD,
+	TCP_NLA_BUSY,
+	TCP_NLA_RWND_LIMITED,
+	TCP_NLA_SNDBUF_LIMITED,
+	TCP_NLA_DATA_SEGS_OUT,
+	TCP_NLA_TOTAL_RETRANS,
+	TCP_NLA_PACING_RATE,
+	TCP_NLA_DELIVERY_RATE,
+	TCP_NLA_SND_CWND,
+	TCP_NLA_REORDERING,
+	TCP_NLA_MIN_RTT,
+	TCP_NLA_RECUR_RETRANS,
+	TCP_NLA_DELIVERY_RATE_APP_LMT,
+	TCP_NLA_SNDQ_SIZE,
+	TCP_NLA_CA_STATE,
+	TCP_NLA_SND_SSTHRESH,
+	TCP_NLA_DELIVERED,
+	TCP_NLA_DELIVERED_CE,
+	TCP_NLA_BYTES_SENT,
+	TCP_NLA_BYTES_RETRANS,
+	TCP_NLA_DSACK_DUPS,
+	TCP_NLA_REORD_SEEN,
+	TCP_NLA_SRTT,
+	TCP_NLA_TIMEOUT_REHASH,
+	TCP_NLA_BYTES_NOTSENT,
+	TCP_NLA_EDT,
+	TCP_NLA_TTL,
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define TCPOPT_EOL              0
+#define TCPOPT_NOP              1
+#define TCPOPT_MAXSEG           2
+#define TCPOPT_WINDOW           3
+#define TCPOPT_SACK_PERMITTED   4
+#define TCPOPT_SACK             5
+#define TCPOPT_TIMESTAMP        8
+#define TCPOLEN_SACK_PERMITTED  2
+#define TCPOLEN_WINDOW          3
+#define TCPOLEN_MAXSEG          4
+#define TCPOLEN_TIMESTAMP       10
+
+#define SOL_TCP 6
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdint.h>
+
+typedef uint32_t tcp_seq;
+
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+
+struct tcphdr {
+#ifdef _GNU_SOURCE
+#ifdef __GNUC__
+	__extension__
+#endif
+	union { struct {
+
+	uint16_t source;
+	uint16_t dest;
+	uint32_t seq;
+	uint32_t ack_seq;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	uint16_t res1:4;
+	uint16_t doff:4;
+	uint16_t fin:1;
+	uint16_t syn:1;
+	uint16_t rst:1;
+	uint16_t psh:1;
+	uint16_t ack:1;
+	uint16_t urg:1;
+	uint16_t res2:2;
+#else
+	uint16_t doff:4;
+	uint16_t res1:4;
+	uint16_t res2:2;
+	uint16_t urg:1;
+	uint16_t ack:1;
+	uint16_t psh:1;
+	uint16_t rst:1;
+	uint16_t syn:1;
+	uint16_t fin:1;
+#endif
+	uint16_t window;
+	uint16_t check;
+	uint16_t urg_ptr;
+
+	}; struct {
+#endif
+
+	uint16_t th_sport;
+	uint16_t th_dport;
+	uint32_t th_seq;
+	uint32_t th_ack;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	uint8_t th_x2:4;
+	uint8_t th_off:4;
+#else
+	uint8_t th_off:4;
+	uint8_t th_x2:4;
+#endif
+	uint8_t th_flags;
+	uint16_t th_win;
+	uint16_t th_sum;
+	uint16_t th_urp;
+
+#ifdef _GNU_SOURCE
+	}; };
+#endif
+};
+#endif
+
+#ifdef _GNU_SOURCE
+#define TCPI_OPT_TIMESTAMPS	1
+#define TCPI_OPT_SACK		2
+#define TCPI_OPT_WSCALE		4
+#define TCPI_OPT_ECN		8
+
+#define TCP_CA_Open		0
+#define TCP_CA_Disorder		1
+#define TCP_CA_CWR		2
+#define TCP_CA_Recovery		3
+#define TCP_CA_Loss		4
+
+enum tcp_fastopen_client_fail {
+	TFO_STATUS_UNSPEC,
+	TFO_COOKIE_UNAVAILABLE,
+	TFO_DATA_NOT_ACKED,
+	TFO_SYN_RETRANSMITTED,
+};
+
+struct tcp_info {
+	uint8_t tcpi_state;
+	uint8_t tcpi_ca_state;
+	uint8_t tcpi_retransmits;
+	uint8_t tcpi_probes;
+	uint8_t tcpi_backoff;
+	uint8_t tcpi_options;
+	uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
+	uint8_t tcpi_delivery_rate_app_limited : 1, tcpi_fastopen_client_fail : 2;
+	uint32_t tcpi_rto;
+	uint32_t tcpi_ato;
+	uint32_t tcpi_snd_mss;
+	uint32_t tcpi_rcv_mss;
+	uint32_t tcpi_unacked;
+	uint32_t tcpi_sacked;
+	uint32_t tcpi_lost;
+	uint32_t tcpi_retrans;
+	uint32_t tcpi_fackets;
+	uint32_t tcpi_last_data_sent;
+	uint32_t tcpi_last_ack_sent;
+	uint32_t tcpi_last_data_recv;
+	uint32_t tcpi_last_ack_recv;
+	uint32_t tcpi_pmtu;
+	uint32_t tcpi_rcv_ssthresh;
+	uint32_t tcpi_rtt;
+	uint32_t tcpi_rttvar;
+	uint32_t tcpi_snd_ssthresh;
+	uint32_t tcpi_snd_cwnd;
+	uint32_t tcpi_advmss;
+	uint32_t tcpi_reordering;
+	uint32_t tcpi_rcv_rtt;
+	uint32_t tcpi_rcv_space;
+	uint32_t tcpi_total_retrans;
+	uint64_t tcpi_pacing_rate;
+	uint64_t tcpi_max_pacing_rate;
+	uint64_t tcpi_bytes_acked;
+	uint64_t tcpi_bytes_received;
+	uint32_t tcpi_segs_out;
+	uint32_t tcpi_segs_in;
+	uint32_t tcpi_notsent_bytes;
+	uint32_t tcpi_min_rtt;
+	uint32_t tcpi_data_segs_in;
+	uint32_t tcpi_data_segs_out;
+	uint64_t tcpi_delivery_rate;
+	uint64_t tcpi_busy_time;
+	uint64_t tcpi_rwnd_limited;
+	uint64_t tcpi_sndbuf_limited;
+	uint32_t tcpi_delivered;
+	uint32_t tcpi_delivered_ce;
+	uint64_t tcpi_bytes_sent;
+	uint64_t tcpi_bytes_retrans;
+	uint32_t tcpi_dsack_dups;
+	uint32_t tcpi_reord_seen;
+	uint32_t tcpi_rcv_ooopack;
+	uint32_t tcpi_snd_wnd;
+};
+
+#define TCP_MD5SIG_MAXKEYLEN    80
+
+#define TCP_MD5SIG_FLAG_PREFIX  0x1
+#define TCP_MD5SIG_FLAG_IFINDEX 0x2
+
+struct tcp_md5sig {
+	struct sockaddr_storage tcpm_addr;
+	uint8_t tcpm_flags;
+	uint8_t tcpm_prefixlen;
+	uint16_t tcpm_keylen;
+	int tcpm_ifindex;
+	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
+};
+
+struct tcp_diag_md5sig {
+	uint8_t tcpm_family;
+	uint8_t tcpm_prefixlen;
+	uint16_t tcpm_keylen;
+	uint32_t tcpm_addr[4];
+	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
+};
+
+#define TCP_REPAIR_ON		1
+#define TCP_REPAIR_OFF		0
+#define TCP_REPAIR_OFF_NO_WP	-1
+
+struct tcp_repair_window {
+	uint32_t snd_wl1;
+	uint32_t snd_wnd;
+	uint32_t max_window;
+	uint32_t rcv_wnd;
+	uint32_t rcv_wup;
+};
+
+#define TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT 0x1
+
+struct tcp_zerocopy_receive {
+	uint64_t address;
+	uint32_t length;
+	uint32_t recv_skip_hint;
+	uint32_t inq;
+	int32_t err;
+	uint64_t copybuf_address;
+	int32_t copybuf_len;
+	uint32_t flags;
+	uint64_t msg_control;
+	uint64_t msg_controllen;
+	uint32_t msg_flags;
+	uint32_t reserved;
+};
+
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netinet/udp.h b/musl-include/x86_64/netinet/udp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netinet/udp.h
@@ -0,0 +1,46 @@
+#ifndef _NETINET_UDP_H
+#define _NETINET_UDP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <stdint.h>
+
+#ifdef _GNU_SOURCE
+#define uh_sport source
+#define uh_dport dest
+#define uh_ulen len
+#define uh_sum check
+#endif
+
+struct udphdr {
+	uint16_t uh_sport;
+	uint16_t uh_dport;
+	uint16_t uh_ulen;
+	uint16_t uh_sum;
+};
+
+#define UDP_CORK	1
+#define UDP_ENCAP	100
+#define UDP_NO_CHECK6_TX 101
+#define UDP_NO_CHECK6_RX 102
+#define UDP_SEGMENT	103
+#define UDP_GRO		104
+
+#define UDP_ENCAP_ESPINUDP_NON_IKE 1
+#define UDP_ENCAP_ESPINUDP	2
+#define UDP_ENCAP_L2TPINUDP	3
+#define UDP_ENCAP_GTP0		4
+#define UDP_ENCAP_GTP1U		5
+#define UDP_ENCAP_RXRPC		6
+#define TCP_ENCAP_ESPINTCP	7
+
+#define SOL_UDP            17
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/netpacket/packet.h b/musl-include/x86_64/netpacket/packet.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/netpacket/packet.h
@@ -0,0 +1,62 @@
+#ifndef _NETPACKET_PACKET_H
+#define _NETPACKET_PACKET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sockaddr_ll {
+	unsigned short sll_family, sll_protocol;
+	int sll_ifindex;
+	unsigned short sll_hatype;
+	unsigned char sll_pkttype, sll_halen;
+	unsigned char sll_addr[8];
+};
+
+struct packet_mreq {
+	int mr_ifindex;
+	unsigned short int mr_type,  mr_alen;
+	unsigned char mr_address[8];
+};
+
+#define PACKET_HOST		0
+#define PACKET_BROADCAST	1
+#define PACKET_MULTICAST	2
+#define PACKET_OTHERHOST	3
+#define PACKET_OUTGOING		4
+#define PACKET_LOOPBACK		5
+#define PACKET_FASTROUTE	6
+
+#define PACKET_ADD_MEMBERSHIP		1
+#define PACKET_DROP_MEMBERSHIP		2
+#define	PACKET_RECV_OUTPUT		3
+#define	PACKET_RX_RING			5
+#define	PACKET_STATISTICS		6
+#define PACKET_COPY_THRESH		7
+#define PACKET_AUXDATA			8
+#define PACKET_ORIGDEV			9
+#define PACKET_VERSION			10
+#define PACKET_HDRLEN			11
+#define PACKET_RESERVE			12
+#define PACKET_TX_RING			13
+#define PACKET_LOSS			14
+#define PACKET_VNET_HDR			15
+#define PACKET_TX_TIMESTAMP		16
+#define PACKET_TIMESTAMP		17
+#define PACKET_FANOUT			18
+#define PACKET_TX_HAS_OFF		19
+#define PACKET_QDISC_BYPASS		20
+#define PACKET_ROLLOVER_STATS		21
+#define PACKET_FANOUT_DATA		22
+#define PACKET_IGNORE_OUTGOING		23
+
+#define PACKET_MR_MULTICAST	0
+#define PACKET_MR_PROMISC	1
+#define PACKET_MR_ALLMULTI	2
+#define PACKET_MR_UNICAST	3
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/nl_types.h b/musl-include/x86_64/nl_types.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/nl_types.h
@@ -0,0 +1,22 @@
+#ifndef _NL_TYPES_H
+#define _NL_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NL_SETD 1
+#define NL_CAT_LOCALE 1
+
+typedef int nl_item;
+typedef void *nl_catd;
+
+nl_catd catopen (const char *, int);
+char *catgets (nl_catd, int, int, const char *);
+int catclose (nl_catd);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/paths.h b/musl-include/x86_64/paths.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/paths.h
@@ -0,0 +1,31 @@
+#ifndef _PATHS_H
+#define _PATHS_H
+
+#define	_PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin"
+#define	_PATH_STDPATH "/bin:/usr/bin:/sbin:/usr/sbin"
+
+#define	_PATH_BSHELL	"/bin/sh"
+#define	_PATH_CONSOLE	"/dev/console"
+#define	_PATH_DEVNULL	"/dev/null"
+#define	_PATH_KLOG	"/proc/kmsg"
+#define	_PATH_LASTLOG	"/var/log/lastlog"
+#define	_PATH_MAILDIR	"/var/mail"
+#define	_PATH_MAN	"/usr/share/man"
+#define	_PATH_MNTTAB	"/etc/fstab"
+#define	_PATH_MOUNTED	"/etc/mtab"
+#define	_PATH_NOLOGIN	"/etc/nologin"
+#define	_PATH_SENDMAIL	"/usr/sbin/sendmail"
+#define	_PATH_SHADOW	"/etc/shadow"
+#define	_PATH_SHELLS	"/etc/shells"
+#define	_PATH_TTY	"/dev/tty"
+#define _PATH_UTMP	"/dev/null/utmp"
+#define	_PATH_VI	"/usr/bin/vi"
+#define _PATH_WTMP	"/dev/null/wtmp"
+
+#define	_PATH_DEV	"/dev/"
+#define	_PATH_TMP	"/tmp/"
+#define	_PATH_VARDB	"/var/lib/misc/"
+#define	_PATH_VARRUN	"/var/run/"
+#define	_PATH_VARTMP	"/var/tmp/"
+
+#endif
diff --git a/musl-include/x86_64/poll.h b/musl-include/x86_64/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/poll.h
@@ -0,0 +1,57 @@
+#ifndef	_POLL_H
+#define	_POLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/poll.h>
+
+#define POLLIN     0x001
+#define POLLPRI    0x002
+#define POLLOUT    0x004
+#define POLLERR    0x008
+#define POLLHUP    0x010
+#define POLLNVAL   0x020
+#define POLLRDNORM 0x040
+#define POLLRDBAND 0x080
+#ifndef POLLWRNORM
+#define POLLWRNORM 0x100
+#define POLLWRBAND 0x200
+#endif
+#ifndef POLLMSG
+#define POLLMSG    0x400
+#define POLLRDHUP  0x2000
+#endif
+
+typedef unsigned long nfds_t;
+
+struct pollfd {
+	int fd;
+	short events;
+	short revents;
+};
+
+int poll (struct pollfd *, nfds_t, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+#include <bits/alltypes.h>
+int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *);
+#endif
+
+#if _REDIR_TIME64
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(ppoll, __ppoll_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/pthread.h b/musl-include/x86_64/pthread.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/pthread.h
@@ -0,0 +1,244 @@
+#ifndef _PTHREAD_H
+#define _PTHREAD_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_clockid_t
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_pthread_mutexattr_t
+#define __NEED_pthread_condattr_t
+#define __NEED_pthread_rwlockattr_t
+#define __NEED_pthread_barrierattr_t
+#define __NEED_pthread_mutex_t
+#define __NEED_pthread_cond_t
+#define __NEED_pthread_rwlock_t
+#define __NEED_pthread_barrier_t
+#define __NEED_pthread_spinlock_t
+#define __NEED_pthread_key_t
+#define __NEED_pthread_once_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#include <sched.h>
+#include <time.h>
+
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 1
+
+#define PTHREAD_MUTEX_NORMAL 0
+#define PTHREAD_MUTEX_DEFAULT 0
+#define PTHREAD_MUTEX_RECURSIVE 1
+#define PTHREAD_MUTEX_ERRORCHECK 2
+
+#define PTHREAD_MUTEX_STALLED 0
+#define PTHREAD_MUTEX_ROBUST 1
+
+#define PTHREAD_PRIO_NONE 0
+#define PTHREAD_PRIO_INHERIT 1
+#define PTHREAD_PRIO_PROTECT 2
+
+#define PTHREAD_INHERIT_SCHED 0
+#define PTHREAD_EXPLICIT_SCHED 1
+
+#define PTHREAD_SCOPE_SYSTEM 0
+#define PTHREAD_SCOPE_PROCESS 1
+
+#define PTHREAD_PROCESS_PRIVATE 0
+#define PTHREAD_PROCESS_SHARED 1
+
+
+#define PTHREAD_MUTEX_INITIALIZER {{{0}}}
+#define PTHREAD_RWLOCK_INITIALIZER {{{0}}}
+#define PTHREAD_COND_INITIALIZER {{{0}}}
+#define PTHREAD_ONCE_INIT 0
+
+
+#define PTHREAD_CANCEL_ENABLE 0
+#define PTHREAD_CANCEL_DISABLE 1
+#define PTHREAD_CANCEL_MASKED 2
+
+#define PTHREAD_CANCEL_DEFERRED 0
+#define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+#define PTHREAD_CANCELED ((void *)-1)
+
+
+#define PTHREAD_BARRIER_SERIAL_THREAD (-1)
+
+
+#define PTHREAD_NULL ((pthread_t)0)
+
+
+int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, void *(*)(void *), void *__restrict);
+int pthread_detach(pthread_t);
+_Noreturn void pthread_exit(void *);
+int pthread_join(pthread_t, void **);
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+pthread_t pthread_self(void);
+
+int pthread_equal(pthread_t, pthread_t);
+#ifndef __cplusplus
+#define pthread_equal(x,y) ((x)==(y))
+#endif
+
+int pthread_setcancelstate(int, int *);
+int pthread_setcanceltype(int, int *);
+void pthread_testcancel(void);
+int pthread_cancel(pthread_t);
+
+int pthread_getschedparam(pthread_t, int *__restrict, struct sched_param *__restrict);
+int pthread_setschedparam(pthread_t, int, const struct sched_param *);
+int pthread_setschedprio(pthread_t, int);
+
+int pthread_once(pthread_once_t *, void (*)(void));
+
+int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict);
+int pthread_mutex_lock(pthread_mutex_t *);
+int pthread_mutex_unlock(pthread_mutex_t *);
+int pthread_mutex_trylock(pthread_mutex_t *);
+int pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_mutex_destroy(pthread_mutex_t *);
+int pthread_mutex_consistent(pthread_mutex_t *);
+
+int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *__restrict);
+int pthread_mutex_setprioceiling(pthread_mutex_t *__restrict, int, int *__restrict);
+
+int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict);
+int pthread_cond_destroy(pthread_cond_t *);
+int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict);
+int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict);
+int pthread_cond_broadcast(pthread_cond_t *);
+int pthread_cond_signal(pthread_cond_t *);
+
+int pthread_rwlock_init(pthread_rwlock_t *__restrict, const pthread_rwlockattr_t *__restrict);
+int pthread_rwlock_destroy(pthread_rwlock_t *);
+int pthread_rwlock_rdlock(pthread_rwlock_t *);
+int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+int pthread_rwlock_timedrdlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+int pthread_rwlock_wrlock(pthread_rwlock_t *);
+int pthread_rwlock_trywrlock(pthread_rwlock_t *);
+int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict, const struct timespec *__restrict);
+int pthread_rwlock_unlock(pthread_rwlock_t *);
+
+int pthread_spin_init(pthread_spinlock_t *, int);
+int pthread_spin_destroy(pthread_spinlock_t *);
+int pthread_spin_lock(pthread_spinlock_t *);
+int pthread_spin_trylock(pthread_spinlock_t *);
+int pthread_spin_unlock(pthread_spinlock_t *);
+
+int pthread_barrier_init(pthread_barrier_t *__restrict, const pthread_barrierattr_t *__restrict, unsigned);
+int pthread_barrier_destroy(pthread_barrier_t *);
+int pthread_barrier_wait(pthread_barrier_t *);
+
+int pthread_key_create(pthread_key_t *, void (*)(void *));
+int pthread_key_delete(pthread_key_t);
+void *pthread_getspecific(pthread_key_t);
+int pthread_setspecific(pthread_key_t, const void *);
+
+int pthread_attr_init(pthread_attr_t *);
+int pthread_attr_destroy(pthread_attr_t *);
+
+int pthread_attr_getguardsize(const pthread_attr_t *__restrict, size_t *__restrict);
+int pthread_attr_setguardsize(pthread_attr_t *, size_t);
+int pthread_attr_getstacksize(const pthread_attr_t *__restrict, size_t *__restrict);
+int pthread_attr_setstacksize(pthread_attr_t *, size_t);
+int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
+int pthread_attr_setdetachstate(pthread_attr_t *, int);
+int pthread_attr_getstack(const pthread_attr_t *__restrict, void **__restrict, size_t *__restrict);
+int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
+int pthread_attr_getscope(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setscope(pthread_attr_t *, int);
+int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setschedpolicy(pthread_attr_t *, int);
+int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict);
+int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict);
+int pthread_attr_getinheritsched(const pthread_attr_t *__restrict, int *__restrict);
+int pthread_attr_setinheritsched(pthread_attr_t *, int);
+
+int pthread_mutexattr_destroy(pthread_mutexattr_t *);
+int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict, int *__restrict);
+int pthread_mutexattr_init(pthread_mutexattr_t *);
+int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
+int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
+int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
+
+int pthread_condattr_init(pthread_condattr_t *);
+int pthread_condattr_destroy(pthread_condattr_t *);
+int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
+int pthread_condattr_setpshared(pthread_condattr_t *, int);
+int pthread_condattr_getclock(const pthread_condattr_t *__restrict, clockid_t *__restrict);
+int pthread_condattr_getpshared(const pthread_condattr_t *__restrict, int *__restrict);
+
+int pthread_rwlockattr_init(pthread_rwlockattr_t *);
+int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
+int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
+int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *__restrict, int *__restrict);
+
+int pthread_barrierattr_destroy(pthread_barrierattr_t *);
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t *__restrict, int *__restrict);
+int pthread_barrierattr_init(pthread_barrierattr_t *);
+int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
+
+int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
+
+int pthread_getconcurrency(void);
+int pthread_setconcurrency(int);
+
+int pthread_getcpuclockid(pthread_t, clockid_t *);
+
+struct __ptcb {
+	void (*__f)(void *);
+	void *__x;
+	struct __ptcb *__next;
+};
+
+void _pthread_cleanup_push(struct __ptcb *, void (*)(void *), void *);
+void _pthread_cleanup_pop(struct __ptcb *, int);
+
+#define pthread_cleanup_push(f, x) do { struct __ptcb __cb; _pthread_cleanup_push(&__cb, f, x);
+#define pthread_cleanup_pop(r) _pthread_cleanup_pop(&__cb, (r)); } while(0)
+
+#ifdef _GNU_SOURCE
+struct cpu_set_t;
+int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *);
+int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *);
+int pthread_getattr_np(pthread_t, pthread_attr_t *);
+int pthread_setname_np(pthread_t, const char *);
+int pthread_getname_np(pthread_t, char *, size_t);
+int pthread_getattr_default_np(pthread_attr_t *);
+int pthread_setattr_default_np(const pthread_attr_t *);
+int pthread_tryjoin_np(pthread_t, void **);
+int pthread_timedjoin_np(pthread_t, void **, const struct timespec *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(pthread_mutex_timedlock, __pthread_mutex_timedlock_time64);
+__REDIR(pthread_cond_timedwait, __pthread_cond_timedwait_time64);
+__REDIR(pthread_rwlock_timedrdlock, __pthread_rwlock_timedrdlock_time64);
+__REDIR(pthread_rwlock_timedwrlock, __pthread_rwlock_timedwrlock_time64);
+#ifdef _GNU_SOURCE
+__REDIR(pthread_timedjoin_np, __pthread_timedjoin_np_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/pty.h b/musl-include/x86_64/pty.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/pty.h
@@ -0,0 +1,18 @@
+#ifndef	_PTY_H
+#define	_PTY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <termios.h>
+#include <sys/ioctl.h>
+
+int openpty(int *, int *, char *, const struct termios *, const struct winsize *);
+int forkpty(int *, char *, const struct termios *, const struct winsize *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/pwd.h b/musl-include/x86_64/pwd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/pwd.h
@@ -0,0 +1,50 @@
+#ifndef _PWD_H
+#define _PWD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_FILE
+#endif
+
+#include <bits/alltypes.h>
+
+struct passwd {
+	char *pw_name;
+	char *pw_passwd;
+	uid_t pw_uid;
+	gid_t pw_gid;
+	char *pw_gecos;
+	char *pw_dir;
+	char *pw_shell;
+};
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void setpwent (void);
+void endpwent (void);
+struct passwd *getpwent (void);
+#endif
+
+struct passwd *getpwuid (uid_t);
+struct passwd *getpwnam (const char *);
+int getpwuid_r (uid_t, struct passwd *, char *, size_t, struct passwd **);
+int getpwnam_r (const char *, struct passwd *, char *, size_t, struct passwd **);
+
+#ifdef _GNU_SOURCE
+struct passwd *fgetpwent(FILE *);
+int putpwent(const struct passwd *, FILE *);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/regex.h b/musl-include/x86_64/regex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/regex.h
@@ -0,0 +1,62 @@
+#ifndef _REGEX_H
+#define _REGEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_regoff_t
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+typedef struct re_pattern_buffer {
+	size_t re_nsub;
+	void *__opaque, *__padding[4];
+	size_t __nsub2;
+	char __padding2;
+} regex_t;
+
+typedef struct {
+	regoff_t rm_so;
+	regoff_t rm_eo;
+} regmatch_t;
+
+#define REG_EXTENDED    1
+#define REG_ICASE       2
+#define REG_NEWLINE     4
+#define REG_NOSUB       8
+
+#define REG_NOTBOL      1
+#define REG_NOTEOL      2
+
+#define REG_OK          0
+#define REG_NOMATCH     1
+#define REG_BADPAT      2
+#define REG_ECOLLATE    3
+#define REG_ECTYPE      4
+#define REG_EESCAPE     5
+#define REG_ESUBREG     6
+#define REG_EBRACK      7
+#define REG_EPAREN      8
+#define REG_EBRACE      9
+#define REG_BADBR       10
+#define REG_ERANGE      11
+#define REG_ESPACE      12
+#define REG_BADRPT      13
+
+#define REG_ENOSYS      -1
+
+int regcomp(regex_t *__restrict, const char *__restrict, int);
+int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int);
+void regfree(regex_t *);
+
+size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/resolv.h b/musl-include/x86_64/resolv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/resolv.h
@@ -0,0 +1,142 @@
+#ifndef _RESOLV_H
+#define _RESOLV_H
+
+#include <stdint.h>
+#include <arpa/nameser.h>
+#include <netinet/in.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAXNS			3
+#define MAXDFLSRCH		3
+#define MAXDNSRCH		6
+#define LOCALDOMAINPARTS	2
+
+#define RES_TIMEOUT		5
+#define MAXRESOLVSORT		10
+#define RES_MAXNDOTS		15
+#define RES_MAXRETRANS		30
+#define RES_MAXRETRY		5
+#define RES_DFLRETRY		2
+#define RES_MAXTIME		65535
+
+/* unused; purely for broken apps */
+typedef struct __res_state {
+	int retrans;
+	int retry;
+	unsigned long options;
+	int nscount;
+	struct sockaddr_in nsaddr_list[MAXNS];
+# define nsaddr	nsaddr_list[0]
+	unsigned short id;
+	char *dnsrch[MAXDNSRCH+1];
+	char defdname[256];
+	unsigned long pfcode;
+	unsigned ndots:4;
+	unsigned nsort:4;
+	unsigned ipv6_unavail:1;
+	unsigned unused:23;
+	struct {
+		struct in_addr addr;
+		uint32_t mask;
+	} sort_list[MAXRESOLVSORT];
+	void *qhook;
+	void *rhook;
+	int res_h_errno;
+	int _vcsock;
+	unsigned _flags;
+	union {
+		char pad[52];
+		struct {
+			uint16_t		nscount;
+			uint16_t		nsmap[MAXNS];
+			int			nssocks[MAXNS];
+			uint16_t		nscount6;
+			uint16_t		nsinit;
+			struct sockaddr_in6	*nsaddrs[MAXNS];
+			unsigned int		_initstamp[2];
+		} _ext;
+	} _u;
+} *res_state;
+
+#define	__RES	19960801
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF        "/etc/resolv.conf"
+#endif
+
+struct res_sym {
+	int number;
+	char *name;
+	char *humanname;
+};
+
+#define	RES_F_VC	0x00000001
+#define	RES_F_CONN	0x00000002
+#define RES_F_EDNS0ERR	0x00000004
+
+#define	RES_EXHAUSTIVE	0x00000001
+
+#define RES_INIT	0x00000001
+#define RES_DEBUG	0x00000002
+#define RES_AAONLY	0x00000004
+#define RES_USEVC	0x00000008
+#define RES_PRIMARY	0x00000010
+#define RES_IGNTC	0x00000020
+#define RES_RECURSE	0x00000040
+#define RES_DEFNAMES	0x00000080
+#define RES_STAYOPEN	0x00000100
+#define RES_DNSRCH	0x00000200
+#define	RES_INSECURE1	0x00000400
+#define	RES_INSECURE2	0x00000800
+#define	RES_NOALIASES	0x00001000
+#define	RES_USE_INET6	0x00002000
+#define RES_ROTATE	0x00004000
+#define	RES_NOCHECKNAME	0x00008000
+#define	RES_KEEPTSIG	0x00010000
+#define	RES_BLAST	0x00020000
+#define RES_USEBSTRING	0x00040000
+#define RES_NOIP6DOTINT	0x00080000
+#define RES_USE_EDNS0	0x00100000
+#define RES_SNGLKUP	0x00200000
+#define RES_SNGLKUPREOP	0x00400000
+#define RES_USE_DNSSEC	0x00800000
+
+#define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
+
+#define RES_PRF_STATS	0x00000001
+#define RES_PRF_UPDATE	0x00000002
+#define RES_PRF_CLASS   0x00000004
+#define RES_PRF_CMD	0x00000008
+#define RES_PRF_QUES	0x00000010
+#define RES_PRF_ANS	0x00000020
+#define RES_PRF_AUTH	0x00000040
+#define RES_PRF_ADD	0x00000080
+#define RES_PRF_HEAD1	0x00000100
+#define RES_PRF_HEAD2	0x00000200
+#define RES_PRF_TTLID	0x00000400
+#define RES_PRF_HEADX	0x00000800
+#define RES_PRF_QUERY	0x00001000
+#define RES_PRF_REPLY	0x00002000
+#define RES_PRF_INIT	0x00004000
+
+struct __res_state *__res_state(void);
+#define _res (*__res_state())
+
+int res_init(void);
+int res_query(const char *, int, int, unsigned char *, int);
+int res_querydomain(const char *, const char *, int, int, unsigned char *, int);
+int res_search(const char *, int, int, unsigned char *, int);
+int res_mkquery(int, const char *, int, int, const unsigned char *, int, const unsigned char*, unsigned char *, int);
+int res_send(const unsigned char *, int, unsigned char *, int);
+int dn_comp(const char *, unsigned char *, int, unsigned char **, unsigned char **);
+int dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
+int dn_skipname(const unsigned char *, const unsigned char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sched.h b/musl-include/x86_64/sched.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sched.h
@@ -0,0 +1,148 @@
+#ifndef _SCHED_H
+#define _SCHED_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_struct_timespec
+#define __NEED_pid_t
+#define __NEED_time_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+struct sched_param {
+	int sched_priority;
+	int __reserved1;
+#if _REDIR_TIME64
+	long __reserved2[4];
+#else
+	struct {
+		time_t __reserved1;
+		long __reserved2;
+	} __reserved2[2];
+#endif
+	int __reserved3;
+};
+
+int    sched_get_priority_max(int);
+int    sched_get_priority_min(int);
+int    sched_getparam(pid_t, struct sched_param *);
+int    sched_getscheduler(pid_t);
+int    sched_rr_get_interval(pid_t, struct timespec *);
+int    sched_setparam(pid_t, const struct sched_param *);
+int    sched_setscheduler(pid_t, int, const struct sched_param *);
+int     sched_yield(void);
+
+#define SCHED_OTHER 0
+#define SCHED_FIFO 1
+#define SCHED_RR 2
+#define SCHED_BATCH 3
+#define SCHED_IDLE 5
+#define SCHED_DEADLINE 6
+#define SCHED_RESET_ON_FORK 0x40000000
+
+#ifdef _GNU_SOURCE
+#define CSIGNAL		0x000000ff
+#define CLONE_NEWTIME	0x00000080
+#define CLONE_VM	0x00000100
+#define CLONE_FS	0x00000200
+#define CLONE_FILES	0x00000400
+#define CLONE_SIGHAND	0x00000800
+#define CLONE_PIDFD	0x00001000
+#define CLONE_PTRACE	0x00002000
+#define CLONE_VFORK	0x00004000
+#define CLONE_PARENT	0x00008000
+#define CLONE_THREAD	0x00010000
+#define CLONE_NEWNS	0x00020000
+#define CLONE_SYSVSEM	0x00040000
+#define CLONE_SETTLS	0x00080000
+#define CLONE_PARENT_SETTID	0x00100000
+#define CLONE_CHILD_CLEARTID	0x00200000
+#define CLONE_DETACHED	0x00400000
+#define CLONE_UNTRACED	0x00800000
+#define CLONE_CHILD_SETTID	0x01000000
+#define CLONE_NEWCGROUP	0x02000000
+#define CLONE_NEWUTS	0x04000000
+#define CLONE_NEWIPC	0x08000000
+#define CLONE_NEWUSER	0x10000000
+#define CLONE_NEWPID	0x20000000
+#define CLONE_NEWNET	0x40000000
+#define CLONE_IO	0x80000000
+int clone (int (*)(void *), void *, int, void *, ...);
+int unshare(int);
+int setns(int, int);
+
+void *memcpy(void *__restrict, const void *__restrict, size_t);
+int memcmp(const void *, const void *, size_t);
+void *memset (void *, int, size_t);
+void *calloc(size_t, size_t);
+void free(void *);
+
+typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t;
+int __sched_cpucount(size_t, const cpu_set_t *);
+int sched_getcpu(void);
+int sched_getaffinity(pid_t, size_t, cpu_set_t *);
+int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
+
+#define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \
+	(((unsigned long *)(set))[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) )
+
+#define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=)
+#define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &=~)
+#define CPU_ISSET_S(i, size, set) __CPU_op_S(i, size, set, &)
+
+#define __CPU_op_func_S(func, op) \
+static __inline void __CPU_##func##_S(size_t __size, cpu_set_t *__dest, \
+	const cpu_set_t *__src1, const cpu_set_t *__src2) \
+{ \
+	size_t __i; \
+	for (__i=0; __i<__size/sizeof(long); __i++) \
+		((unsigned long *)__dest)[__i] = ((unsigned long *)__src1)[__i] \
+			op ((unsigned long *)__src2)[__i] ; \
+}
+
+__CPU_op_func_S(AND, &)
+__CPU_op_func_S(OR, |)
+__CPU_op_func_S(XOR, ^)
+
+#define CPU_AND_S(a,b,c,d) __CPU_AND_S(a,b,c,d)
+#define CPU_OR_S(a,b,c,d) __CPU_OR_S(a,b,c,d)
+#define CPU_XOR_S(a,b,c,d) __CPU_XOR_S(a,b,c,d)
+
+#define CPU_COUNT_S(size,set) __sched_cpucount(size,set)
+#define CPU_ZERO_S(size,set) memset(set,0,size)
+#define CPU_EQUAL_S(size,set1,set2) (!memcmp(set1,set2,size))
+
+#define CPU_ALLOC_SIZE(n) (sizeof(long) * ( (n)/(8*sizeof(long)) \
+	+ ((n)%(8*sizeof(long)) + 8*sizeof(long)-1)/(8*sizeof(long)) ) )
+#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
+#define CPU_FREE(set) free(set)
+
+#define CPU_SETSIZE 1024
+
+#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
+#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)
+#define CPU_ISSET(i, set) CPU_ISSET_S(i,sizeof(cpu_set_t),set)
+#define CPU_AND(d,s1,s2) CPU_AND_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_OR(d,s1,s2) CPU_OR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_XOR(d,s1,s2) CPU_XOR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t),set)
+#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set)
+#define CPU_EQUAL(s1,s2) CPU_EQUAL_S(sizeof(cpu_set_t),s1,s2)
+
+#endif
+
+#if _REDIR_TIME64
+__REDIR(sched_rr_get_interval, __sched_rr_get_interval_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/scsi/scsi.h b/musl-include/x86_64/scsi/scsi.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/scsi/scsi.h
@@ -0,0 +1,150 @@
+#ifndef _SCSI_SCSI_H
+#define _SCSI_SCSI_H
+
+#define TEST_UNIT_READY 0x00
+#define REZERO_UNIT 0x01
+#define REQUEST_SENSE 0x03
+#define FORMAT_UNIT 0x04
+#define READ_BLOCK_LIMITS 0x05
+#define REASSIGN_BLOCKS 0x07
+#define READ_6 0x08
+#define WRITE_6 0x0a
+#define SEEK_6 0x0b
+#define READ_REVERSE 0x0f
+#define WRITE_FILEMARKS 0x10
+#define SPACE 0x11
+#define INQUIRY 0x12
+#define RECOVER_BUFFERED_DATA 0x14
+#define MODE_SELECT 0x15
+#define RESERVE 0x16
+#define RELEASE 0x17
+#define COPY 0x18
+#define ERASE 0x19
+#define MODE_SENSE 0x1a
+#define START_STOP 0x1b
+#define RECEIVE_DIAGNOSTIC 0x1c
+#define SEND_DIAGNOSTIC 0x1d
+#define ALLOW_MEDIUM_REMOVAL 0x1e
+#define SET_WINDOW 0x24
+#define READ_CAPACITY 0x25
+#define READ_10 0x28
+#define WRITE_10 0x2a
+#define SEEK_10 0x2b
+#define WRITE_VERIFY 0x2e
+#define VERIFY 0x2f
+#define SEARCH_HIGH 0x30
+#define SEARCH_EQUAL 0x31
+#define SEARCH_LOW 0x32
+#define SET_LIMITS 0x33
+#define PRE_FETCH 0x34
+#define READ_POSITION 0x34
+#define SYNCHRONIZE_CACHE 0x35
+#define LOCK_UNLOCK_CACHE 0x36
+#define READ_DEFECT_DATA 0x37
+#define MEDIUM_SCAN 0x38
+#define COMPARE 0x39
+#define COPY_VERIFY 0x3a
+#define WRITE_BUFFER 0x3b
+#define READ_BUFFER 0x3c
+#define UPDATE_BLOCK 0x3d
+#define READ_LONG 0x3e
+#define WRITE_LONG 0x3f
+#define CHANGE_DEFINITION 0x40
+#define WRITE_SAME 0x41
+#define READ_TOC 0x43
+#define LOG_SELECT 0x4c
+#define LOG_SENSE 0x4d
+#define MODE_SELECT_10 0x55
+#define RESERVE_10 0x56
+#define RELEASE_10 0x57
+#define MODE_SENSE_10 0x5a
+#define PERSISTENT_RESERVE_IN 0x5e
+#define PERSISTENT_RESERVE_OUT 0x5f
+#define MOVE_MEDIUM 0xa5
+#define READ_12 0xa8
+#define WRITE_12 0xaa
+#define WRITE_VERIFY_12 0xae
+#define SEARCH_HIGH_12 0xb0
+#define SEARCH_EQUAL_12 0xb1
+#define SEARCH_LOW_12 0xb2
+#define READ_ELEMENT_STATUS 0xb8
+#define SEND_VOLUME_TAG 0xb6
+#define WRITE_LONG_2 0xea
+#define GOOD 0x00
+#define CHECK_CONDITION 0x01
+#define CONDITION_GOOD 0x02
+#define BUSY 0x04
+#define INTERMEDIATE_GOOD 0x08
+#define INTERMEDIATE_C_GOOD 0x0a
+#define RESERVATION_CONFLICT 0x0c
+#define COMMAND_TERMINATED 0x11
+#define QUEUE_FULL 0x14
+#define STATUS_MASK 0x3e
+#define NO_SENSE 0x00
+#define RECOVERED_ERROR 0x01
+#define NOT_READY 0x02
+#define MEDIUM_ERROR 0x03
+#define HARDWARE_ERROR 0x04
+#define ILLEGAL_REQUEST 0x05
+#define UNIT_ATTENTION 0x06
+#define DATA_PROTECT 0x07
+#define BLANK_CHECK 0x08
+#define COPY_ABORTED 0x0a
+#define ABORTED_COMMAND 0x0b
+#define VOLUME_OVERFLOW 0x0d
+#define MISCOMPARE 0x0e
+#define TYPE_DISK 0x00
+#define TYPE_TAPE 0x01
+#define TYPE_PROCESSOR 0x03
+#define TYPE_WORM 0x04
+#define TYPE_ROM 0x05
+#define TYPE_SCANNER 0x06
+#define TYPE_MOD 0x07
+#define TYPE_MEDIUM_CHANGER 0x08
+#define TYPE_ENCLOSURE 0x0d
+#define TYPE_NO_LUN 0x7f
+#define COMMAND_COMPLETE 0x00
+#define EXTENDED_MESSAGE 0x01
+#define EXTENDED_MODIFY_DATA_POINTER 0x00
+#define EXTENDED_SDTR 0x01
+#define EXTENDED_EXTENDED_IDENTIFY 0x02
+#define EXTENDED_WDTR 0x03
+#define SAVE_POINTERS 0x02
+#define RESTORE_POINTERS 0x03
+#define DISCONNECT 0x04
+#define INITIATOR_ERROR 0x05
+#define ABORT 0x06
+#define MESSAGE_REJECT 0x07
+#define NOP 0x08
+#define MSG_PARITY_ERROR 0x09
+#define LINKED_CMD_COMPLETE 0x0a
+#define LINKED_FLG_CMD_COMPLETE 0x0b
+#define BUS_DEVICE_RESET 0x0c
+#define INITIATE_RECOVERY 0x0f
+#define RELEASE_RECOVERY 0x10
+#define SIMPLE_QUEUE_TAG 0x20
+#define HEAD_OF_QUEUE_TAG 0x21
+#define ORDERED_QUEUE_TAG 0x22
+#define SCSI_IOCTL_GET_IDLUN 0x5382
+#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
+#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
+#define SCSI_IOCTL_PROBE_HOST 0x5385
+#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
+
+struct ccs_modesel_head {
+	unsigned char _r1;
+	unsigned char medium;
+	unsigned char _r2;
+	unsigned char block_desc_length;
+	unsigned char density;
+	unsigned char number_blocks_hi;
+	unsigned char number_blocks_med;
+	unsigned char number_blocks_lo;
+	unsigned char _r3;
+	unsigned char block_length_hi;
+	unsigned char block_length_med;
+	unsigned char block_length_lo;
+};
+
+#endif
+
diff --git a/musl-include/x86_64/scsi/scsi_ioctl.h b/musl-include/x86_64/scsi/scsi_ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/scsi/scsi_ioctl.h
@@ -0,0 +1,11 @@
+#ifndef _SCSI_IOCTL_H
+#define _SCSI_IOCTL_H
+#define SCSI_IOCTL_SEND_COMMAND 1
+#define SCSI_IOCTL_TEST_UNIT_READY 2
+#define SCSI_IOCTL_BENCHMARK_COMMAND 3
+#define SCSI_IOCTL_SYNC 4
+#define SCSI_IOCTL_START_UNIT 5
+#define SCSI_IOCTL_STOP_UNIT 6
+#define SCSI_IOCTL_DOORLOCK 0x5380
+#define SCSI_IOCTL_DOORUNLOCK 0x5381
+#endif
diff --git a/musl-include/x86_64/scsi/sg.h b/musl-include/x86_64/scsi/sg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/scsi/sg.h
@@ -0,0 +1,129 @@
+#ifndef _SCSI_SG_H
+#define _SCSI_SG_H
+
+#define SG_DXFER_NONE -1
+#define SG_DXFER_TO_DEV -2
+#define SG_DXFER_FROM_DEV -3
+#define SG_DXFER_TO_FROM_DEV -4
+#define SG_FLAG_DIRECT_IO 1
+#define SG_FLAG_LUN_INHIBIT 2
+#define SG_FLAG_NO_DXFER 0x10000
+#define SG_INFO_OK_MASK 0x1
+#define SG_INFO_OK 0x0
+#define SG_INFO_CHECK 0x1
+#define SG_INFO_DIRECT_IO_MASK 0x6
+#define SG_INFO_INDIRECT_IO 0x0
+#define SG_INFO_DIRECT_IO 0x2
+#define SG_INFO_MIXED_IO 0x4
+#define SG_EMULATED_HOST 0x2203
+#define SG_SET_TRANSFORM 0x2204
+#define SG_GET_TRANSFORM 0x2205
+#define SG_SET_RESERVED_SIZE 0x2275
+#define SG_GET_RESERVED_SIZE 0x2272
+#define SG_GET_SCSI_ID 0x2276
+#define SG_SET_FORCE_LOW_DMA 0x2279
+#define SG_GET_LOW_DMA 0x227a
+#define SG_SET_FORCE_PACK_ID 0x227b
+#define SG_GET_PACK_ID 0x227c
+#define SG_GET_NUM_WAITING 0x227d
+#define SG_GET_SG_TABLESIZE 0x227F
+#define SG_GET_VERSION_NUM 0x2282
+#define SG_SCSI_RESET 0x2284
+#define SG_SCSI_RESET_NOTHING 0
+#define SG_SCSI_RESET_DEVICE 1
+#define SG_SCSI_RESET_BUS 2
+#define SG_SCSI_RESET_HOST 3
+#define SG_IO 0x2285
+#define SG_GET_REQUEST_TABLE 0x2286
+#define SG_SET_KEEP_ORPHAN 0x2287
+#define SG_GET_KEEP_ORPHAN 0x2288
+#define SG_SCATTER_SZ (8 * 4096)
+#define SG_DEFAULT_RETRIES 1
+#define SG_DEF_FORCE_LOW_DMA 0
+#define SG_DEF_FORCE_PACK_ID 0
+#define SG_DEF_KEEP_ORPHAN 0
+#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
+#define SG_MAX_QUEUE 16
+#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
+#define SG_MAX_SENSE 16
+#define SG_SET_TIMEOUT 0x2201
+#define SG_GET_TIMEOUT 0x2202
+#define SG_GET_COMMAND_Q 0x2270
+#define SG_SET_COMMAND_Q 0x2271
+#define SG_SET_DEBUG 0x227e
+#define SG_NEXT_CMD_LEN 0x2283
+#define SG_DEFAULT_TIMEOUT (60*100) /* 60*HZ */
+#define SG_DEF_COMMAND_Q 0
+#define SG_DEF_UNDERRUN_FLAG 0
+
+typedef struct sg_iovec {
+	void *iov_base;
+	unsigned long iov_len;
+} sg_iovec_t;
+
+typedef struct sg_io_hdr { 
+	int interface_id; 
+	int dxfer_direction; 
+	unsigned char cmd_len;
+	unsigned char mx_sb_len;
+	unsigned short iovec_count;
+	unsigned dxfer_len;
+	void *dxferp;
+	unsigned char *cmdp;
+	unsigned char *sbp;
+	unsigned timeout;
+	unsigned flags;
+	int pack_id;
+	void *usr_ptr;
+	unsigned char status;
+	unsigned char masked_status;
+	unsigned char msg_status;
+	unsigned char sb_len_wr;
+	unsigned short host_status;
+	unsigned short driver_status;
+	int resid; 
+	unsigned int duration;
+	unsigned int info;
+} sg_io_hdr_t;
+
+struct sg_scsi_id {
+	int host_no;
+	int channel;
+	int scsi_id;
+	int lun;
+	int scsi_type;
+	short h_cmd_per_lun;
+	short d_queue_depth;
+	int unused[2];
+};
+
+typedef struct sg_req_info {
+	char req_state;
+	char orphan;
+	char sg_io_owned;
+	char problem;
+	int pack_id;
+	void *usr_ptr;
+	unsigned duration; 
+	int unused; 
+} sg_req_info_t;
+
+typedef struct sg_io_hdr Sg_io_hdr;
+typedef struct sg_io_vec Sg_io_vec;
+typedef struct sg_scsi_id Sg_scsi_id;
+typedef struct sg_req_info Sg_req_info;
+
+struct sg_header {
+	int pack_len;
+	int reply_len;
+	int pack_id;
+	int result;
+	unsigned twelve_byte:1;
+	unsigned target_status:5;
+	unsigned host_status:8;
+	unsigned driver_status:8;
+	unsigned other_flags:10;
+	unsigned char sense_buffer[SG_MAX_SENSE];
+};
+
+#endif
diff --git a/musl-include/x86_64/search.h b/musl-include/x86_64/search.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/search.h
@@ -0,0 +1,63 @@
+#ifndef _SEARCH_H
+#define _SEARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+typedef enum { FIND, ENTER } ACTION;
+typedef enum { preorder, postorder, endorder, leaf } VISIT;
+
+typedef struct entry {
+	char *key;
+	void *data;
+} ENTRY;
+
+int hcreate(size_t);
+void hdestroy(void);
+ENTRY *hsearch(ENTRY, ACTION);
+
+#ifdef _GNU_SOURCE
+struct hsearch_data {
+	struct __tab *__tab;
+	unsigned int __unused1;
+	unsigned int __unused2;
+};
+
+int hcreate_r(size_t, struct hsearch_data *);
+void hdestroy_r(struct hsearch_data *);
+int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
+#endif
+
+void insque(void *, void *);
+void remque(void *);
+
+void *lsearch(const void *, void *, size_t *, size_t,
+	int (*)(const void *, const void *));
+void *lfind(const void *, const void *, size_t *, size_t,
+	int (*)(const void *, const void *));
+
+void *tdelete(const void *__restrict, void **__restrict, int(*)(const void *, const void *));
+void *tfind(const void *, void *const *, int(*)(const void *, const void *));
+void *tsearch(const void *, void **, int (*)(const void *, const void *));
+void twalk(const void *, void (*)(const void *, VISIT, int));
+
+#ifdef _GNU_SOURCE
+struct qelem {
+	struct qelem *q_forw, *q_back;
+	char q_data[1];
+};
+
+void tdestroy(void *, void (*)(void *));
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/semaphore.h b/musl-include/x86_64/semaphore.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/semaphore.h
@@ -0,0 +1,39 @@
+#ifndef _SEMAPHORE_H
+#define _SEMAPHORE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+
+#include <fcntl.h>
+
+#define SEM_FAILED ((sem_t *)0)
+
+typedef struct {
+	volatile int __val[4*sizeof(long)/sizeof(int)];
+} sem_t;
+
+int    sem_close(sem_t *);
+int    sem_destroy(sem_t *);
+int    sem_getvalue(sem_t *__restrict, int *__restrict);
+int    sem_init(sem_t *, int, unsigned);
+sem_t *sem_open(const char *, int, ...);
+int    sem_post(sem_t *);
+int    sem_timedwait(sem_t *__restrict, const struct timespec *__restrict);
+int    sem_trywait(sem_t *);
+int    sem_unlink(const char *);
+int    sem_wait(sem_t *);
+
+#if _REDIR_TIME64
+__REDIR(sem_timedwait, __sem_timedwait_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/setjmp.h b/musl-include/x86_64/setjmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/setjmp.h
@@ -0,0 +1,49 @@
+#ifndef	_SETJMP_H
+#define	_SETJMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/setjmp.h>
+
+typedef struct __jmp_buf_tag {
+	__jmp_buf __jb;
+	unsigned long __fl;
+	unsigned long __ss[128/sizeof(long)];
+} jmp_buf[1];
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
+#define __setjmp_attr __attribute__((__returns_twice__))
+#else
+#define __setjmp_attr
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+typedef jmp_buf sigjmp_buf;
+int sigsetjmp (sigjmp_buf, int) __setjmp_attr;
+_Noreturn void siglongjmp (sigjmp_buf, int);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+int _setjmp (jmp_buf) __setjmp_attr;
+_Noreturn void _longjmp (jmp_buf, int);
+#endif
+
+int setjmp (jmp_buf) __setjmp_attr;
+_Noreturn void longjmp (jmp_buf, int);
+
+#define setjmp setjmp
+
+#undef __setjmp_attr
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/shadow.h b/musl-include/x86_64/shadow.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/shadow.h
@@ -0,0 +1,44 @@
+#ifndef _SHADOW_H
+#define _SHADOW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define	__NEED_FILE
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#define	SHADOW "/etc/shadow"
+
+struct spwd {
+	char *sp_namp;
+	char *sp_pwdp;
+	long sp_lstchg;
+	long sp_min;
+	long sp_max;
+	long sp_warn;
+	long sp_inact;
+	long sp_expire;
+	unsigned long sp_flag;
+};
+
+void setspent(void);
+void endspent(void);
+struct spwd *getspent(void);
+struct spwd *fgetspent(FILE *);
+struct spwd *sgetspent(const char *);
+int putspent(const struct spwd *, FILE *);
+
+struct spwd *getspnam(const char *);
+int getspnam_r(const char *, struct spwd *, char *, size_t, struct spwd **);
+
+int lckpwdf(void);
+int ulckpwdf(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/signal.h b/musl-include/x86_64/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/signal.h
@@ -0,0 +1,304 @@
+#ifndef _SIGNAL_H
+#define _SIGNAL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#ifdef _GNU_SOURCE
+#define __ucontext ucontext
+#endif
+
+#define __NEED_size_t
+#define __NEED_pid_t
+#define __NEED_uid_t
+#define __NEED_struct_timespec
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_time_t
+#define __NEED_clock_t
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define SIG_BLOCK     0
+#define SIG_UNBLOCK   1
+#define SIG_SETMASK   2
+
+#define SI_ASYNCNL (-60)
+#define SI_TKILL (-6)
+#define SI_SIGIO (-5)
+#define SI_ASYNCIO (-4)
+#define SI_MESGQ (-3)
+#define SI_TIMER (-2)
+#define SI_QUEUE (-1)
+#define SI_USER 0
+#define SI_KERNEL 128
+
+typedef struct sigaltstack stack_t;
+
+#endif
+
+#include <bits/signal.h>
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define SIG_HOLD ((void (*)(int)) 2)
+
+#define FPE_INTDIV 1
+#define FPE_INTOVF 2
+#define FPE_FLTDIV 3
+#define FPE_FLTOVF 4
+#define FPE_FLTUND 5
+#define FPE_FLTRES 6
+#define FPE_FLTINV 7
+#define FPE_FLTSUB 8
+
+#define ILL_ILLOPC 1
+#define ILL_ILLOPN 2
+#define ILL_ILLADR 3
+#define ILL_ILLTRP 4
+#define ILL_PRVOPC 5
+#define ILL_PRVREG 6
+#define ILL_COPROC 7
+#define ILL_BADSTK 8
+
+#define SEGV_MAPERR 1
+#define SEGV_ACCERR 2
+#define SEGV_BNDERR 3
+#define SEGV_PKUERR 4
+#define SEGV_MTEAERR 8
+#define SEGV_MTESERR 9
+
+#define BUS_ADRALN 1
+#define BUS_ADRERR 2
+#define BUS_OBJERR 3
+#define BUS_MCEERR_AR 4
+#define BUS_MCEERR_AO 5
+
+#define CLD_EXITED 1
+#define CLD_KILLED 2
+#define CLD_DUMPED 3
+#define CLD_TRAPPED 4
+#define CLD_STOPPED 5
+#define CLD_CONTINUED 6
+
+union sigval {
+	int sival_int;
+	void *sival_ptr;
+};
+
+typedef struct {
+#ifdef __SI_SWAP_ERRNO_CODE
+	int si_signo, si_code, si_errno;
+#else
+	int si_signo, si_errno, si_code;
+#endif
+	union {
+		char __pad[128 - 2*sizeof(int) - sizeof(long)];
+		struct {
+			union {
+				struct {
+					pid_t si_pid;
+					uid_t si_uid;
+				} __piduid;
+				struct {
+					int si_timerid;
+					int si_overrun;
+				} __timer;
+			} __first;
+			union {
+				union sigval si_value;
+				struct {
+					int si_status;
+					clock_t si_utime, si_stime;
+				} __sigchld;
+			} __second;
+		} __si_common;
+		struct {
+			void *si_addr;
+			short si_addr_lsb;
+			union {
+				struct {
+					void *si_lower;
+					void *si_upper;
+				} __addr_bnd;
+				unsigned si_pkey;
+			} __first;
+		} __sigfault;
+		struct {
+			long si_band;
+			int si_fd;
+		} __sigpoll;
+		struct {
+			void *si_call_addr;
+			int si_syscall;
+			unsigned si_arch;
+		} __sigsys;
+	} __si_fields;
+} siginfo_t;
+#define si_pid     __si_fields.__si_common.__first.__piduid.si_pid
+#define si_uid     __si_fields.__si_common.__first.__piduid.si_uid
+#define si_status  __si_fields.__si_common.__second.__sigchld.si_status
+#define si_utime   __si_fields.__si_common.__second.__sigchld.si_utime
+#define si_stime   __si_fields.__si_common.__second.__sigchld.si_stime
+#define si_value   __si_fields.__si_common.__second.si_value
+#define si_addr    __si_fields.__sigfault.si_addr
+#define si_addr_lsb __si_fields.__sigfault.si_addr_lsb
+#define si_lower   __si_fields.__sigfault.__first.__addr_bnd.si_lower
+#define si_upper   __si_fields.__sigfault.__first.__addr_bnd.si_upper
+#define si_pkey    __si_fields.__sigfault.__first.si_pkey
+#define si_band    __si_fields.__sigpoll.si_band
+#define si_fd      __si_fields.__sigpoll.si_fd
+#define si_timerid __si_fields.__si_common.__first.__timer.si_timerid
+#define si_overrun __si_fields.__si_common.__first.__timer.si_overrun
+#define si_ptr     si_value.sival_ptr
+#define si_int     si_value.sival_int
+#define si_call_addr __si_fields.__sigsys.si_call_addr
+#define si_syscall __si_fields.__sigsys.si_syscall
+#define si_arch    __si_fields.__sigsys.si_arch
+
+struct sigaction {
+	union {
+		void (*sa_handler)(int);
+		void (*sa_sigaction)(int, siginfo_t *, void *);
+	} __sa_handler;
+	sigset_t sa_mask;
+	int sa_flags;
+	void (*sa_restorer)(void);
+};
+#define sa_handler   __sa_handler.sa_handler
+#define sa_sigaction __sa_handler.sa_sigaction
+
+#define SA_UNSUPPORTED 0x00000400
+#define SA_EXPOSE_TAGBITS 0x00000800
+
+struct sigevent {
+	union sigval sigev_value;
+	int sigev_signo;
+	int sigev_notify;
+	union {
+		char __pad[64 - 2*sizeof(int) - sizeof(union sigval)];
+		pid_t sigev_notify_thread_id;
+		struct {
+			void (*sigev_notify_function)(union sigval);
+			pthread_attr_t *sigev_notify_attributes;
+		} __sev_thread;
+	} __sev_fields;
+};
+
+#define sigev_notify_thread_id __sev_fields.sigev_notify_thread_id
+#define sigev_notify_function __sev_fields.__sev_thread.sigev_notify_function
+#define sigev_notify_attributes __sev_fields.__sev_thread.sigev_notify_attributes
+
+#define SIGEV_SIGNAL 0
+#define SIGEV_NONE 1
+#define SIGEV_THREAD 2
+#define SIGEV_THREAD_ID 4
+
+int __libc_current_sigrtmin(void);
+int __libc_current_sigrtmax(void);
+
+#define SIGRTMIN  (__libc_current_sigrtmin())
+#define SIGRTMAX  (__libc_current_sigrtmax())
+
+int kill(pid_t, int);
+
+int sigemptyset(sigset_t *);
+int sigfillset(sigset_t *);
+int sigaddset(sigset_t *, int);
+int sigdelset(sigset_t *, int);
+int sigismember(const sigset_t *, int);
+
+int sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict);
+int sigsuspend(const sigset_t *);
+int sigaction(int, const struct sigaction *__restrict, struct sigaction *__restrict);
+int sigpending(sigset_t *);
+int sigwait(const sigset_t *__restrict, int *__restrict);
+int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict);
+int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct timespec *__restrict);
+int sigqueue(pid_t, int, union sigval);
+
+int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict);
+int pthread_kill(pthread_t, int);
+
+void psiginfo(const siginfo_t *, const char *);
+void psignal(int, const char *);
+
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+int killpg(pid_t, int);
+int sigaltstack(const stack_t *__restrict, stack_t *__restrict);
+int sighold(int);
+int sigignore(int);
+int siginterrupt(int, int);
+int sigpause(int);
+int sigrelse(int);
+void (*sigset(int, void (*)(int)))(int);
+#define TRAP_BRKPT 1
+#define TRAP_TRACE 2
+#define TRAP_BRANCH 3
+#define TRAP_HWBKPT 4
+#define TRAP_UNK 5
+#define POLL_IN 1
+#define POLL_OUT 2
+#define POLL_MSG 3
+#define POLL_ERR 4
+#define POLL_PRI 5
+#define POLL_HUP 6
+#define SS_ONSTACK    1
+#define SS_DISABLE    2
+#define SS_AUTODISARM (1U << 31)
+#define SS_FLAG_BITS SS_AUTODISARM
+#endif
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define NSIG _NSIG
+typedef void (*sig_t)(int);
+
+#define SYS_SECCOMP 1
+#define SYS_USER_DISPATCH 2
+#endif
+
+#ifdef _GNU_SOURCE
+typedef void (*sighandler_t)(int);
+void (*bsd_signal(int, void (*)(int)))(int);
+int sigisemptyset(const sigset_t *);
+int sigorset (sigset_t *, const sigset_t *, const sigset_t *);
+int sigandset(sigset_t *, const sigset_t *, const sigset_t *);
+
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
+#endif
+
+#define SIG_ERR  ((void (*)(int))-1)
+#define SIG_DFL  ((void (*)(int)) 0)
+#define SIG_IGN  ((void (*)(int)) 1)
+
+typedef int sig_atomic_t;
+
+void (*signal(int, void (*)(int)))(int);
+int raise(int);
+
+#if _REDIR_TIME64
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+__REDIR(sigtimedwait, __sigtimedwait_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/spawn.h b/musl-include/x86_64/spawn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/spawn.h
@@ -0,0 +1,83 @@
+#ifndef _SPAWN_H
+#define _SPAWN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_mode_t
+#define __NEED_pid_t
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+struct sched_param;
+
+#define POSIX_SPAWN_RESETIDS 1
+#define POSIX_SPAWN_SETPGROUP 2
+#define POSIX_SPAWN_SETSIGDEF 4
+#define POSIX_SPAWN_SETSIGMASK 8
+#define POSIX_SPAWN_SETSCHEDPARAM 16
+#define POSIX_SPAWN_SETSCHEDULER 32
+#define POSIX_SPAWN_USEVFORK 64
+#define POSIX_SPAWN_SETSID 128
+
+typedef struct {
+	int __flags;
+	pid_t __pgrp;
+	sigset_t __def, __mask;
+	int __prio, __pol;
+	void *__fn;
+	char __pad[64-sizeof(void *)];
+} posix_spawnattr_t;
+
+typedef struct {
+	int __pad0[2];
+	void *__actions;
+	int __pad[16];
+} posix_spawn_file_actions_t;
+
+int posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
+int posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
+	const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
+
+int posix_spawnattr_init(posix_spawnattr_t *);
+int posix_spawnattr_destroy(posix_spawnattr_t *);
+
+int posix_spawnattr_setflags(posix_spawnattr_t *, short);
+int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict);
+
+int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
+int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict);
+
+int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
+
+int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
+
+int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict, const struct sched_param *__restrict);
+int posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict, struct sched_param *__restrict);
+int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
+int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict, int *__restrict);
+
+int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
+int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
+
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t);
+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
+int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/stdalign.h b/musl-include/x86_64/stdalign.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stdalign.h
@@ -0,0 +1,20 @@
+#ifndef _STDALIGN_H
+#define _STDALIGN_H
+
+#ifndef __cplusplus
+
+/* this whole header only works in C11 or with compiler extensions */
+#if __STDC_VERSION__ < 201112L && defined( __GNUC__)
+#define _Alignas(t) __attribute__((__aligned__(t)))
+#define _Alignof(t) __alignof__(t)
+#endif
+
+#define alignas _Alignas
+#define alignof _Alignof
+
+#endif
+
+#define __alignas_is_defined 1
+#define __alignof_is_defined 1
+
+#endif
diff --git a/musl-include/x86_64/stdarg.h b/musl-include/x86_64/stdarg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stdarg.h
@@ -0,0 +1,21 @@
+#ifndef _STDARG_H
+#define _STDARG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_va_list
+
+#include <bits/alltypes.h>
+
+#define va_start(v,l)   __builtin_va_start(v,l)
+#define va_end(v)       __builtin_va_end(v)
+#define va_arg(v,l)     __builtin_va_arg(v,l)
+#define va_copy(d,s)    __builtin_va_copy(d,s)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/stdbool.h b/musl-include/x86_64/stdbool.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stdbool.h
@@ -0,0 +1,14 @@
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+#ifndef __cplusplus
+
+#define true 1
+#define false 0
+#define bool _Bool
+
+#endif
+
+#define __bool_true_false_are_defined 1
+
+#endif
diff --git a/musl-include/x86_64/stdc-predef.h b/musl-include/x86_64/stdc-predef.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stdc-predef.h
@@ -0,0 +1,18 @@
+#ifndef _STDC_PREDEF_H
+#define _STDC_PREDEF_H
+
+#define __STDC_ISO_10646__ 201206L
+
+#if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0
+#define __STDC_IEC_559__ 1
+#endif
+
+#if !defined(__STDC_UTF_16__)
+#define __STDC_UTF_16__ 1
+#endif
+
+#if !defined(__STDC_UTF_32__)
+#define __STDC_UTF_32__ 1
+#endif
+
+#endif
diff --git a/musl-include/x86_64/stddef.h b/musl-include/x86_64/stddef.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stddef.h
@@ -0,0 +1,27 @@
+#ifndef _STDDEF_H
+#define _STDDEF_H
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_ptrdiff_t
+#define __NEED_size_t
+#define __NEED_wchar_t
+#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
+#define __NEED_max_align_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if __GNUC__ > 3
+#define offsetof(type, member) __builtin_offsetof(type, member)
+#else
+#define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 ))
+#endif
+
+#endif
diff --git a/musl-include/x86_64/stdint.h b/musl-include/x86_64/stdint.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stdint.h
@@ -0,0 +1,117 @@
+#ifndef _STDINT_H
+#define _STDINT_H
+
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+
+#define __NEED_uint8_t
+#define __NEED_uint16_t
+#define __NEED_uint32_t
+#define __NEED_uint64_t
+
+#define __NEED_intptr_t
+#define __NEED_uintptr_t
+
+#define __NEED_intmax_t
+#define __NEED_uintmax_t
+
+#include <bits/alltypes.h>
+
+typedef int8_t int_fast8_t;
+typedef int64_t int_fast64_t;
+
+typedef int8_t  int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+
+typedef uint8_t uint_fast8_t;
+typedef uint64_t uint_fast64_t;
+
+typedef uint8_t  uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+#define INT8_MIN   (-1-0x7f)
+#define INT16_MIN  (-1-0x7fff)
+#define INT32_MIN  (-1-0x7fffffff)
+#define INT64_MIN  (-1-0x7fffffffffffffff)
+
+#define INT8_MAX   (0x7f)
+#define INT16_MAX  (0x7fff)
+#define INT32_MAX  (0x7fffffff)
+#define INT64_MAX  (0x7fffffffffffffff)
+
+#define UINT8_MAX  (0xff)
+#define UINT16_MAX (0xffff)
+#define UINT32_MAX (0xffffffffu)
+#define UINT64_MAX (0xffffffffffffffffu)
+
+#define INT_FAST8_MIN   INT8_MIN
+#define INT_FAST64_MIN  INT64_MIN
+
+#define INT_LEAST8_MIN   INT8_MIN
+#define INT_LEAST16_MIN  INT16_MIN
+#define INT_LEAST32_MIN  INT32_MIN
+#define INT_LEAST64_MIN  INT64_MIN
+
+#define INT_FAST8_MAX   INT8_MAX
+#define INT_FAST64_MAX  INT64_MAX
+
+#define INT_LEAST8_MAX   INT8_MAX
+#define INT_LEAST16_MAX  INT16_MAX
+#define INT_LEAST32_MAX  INT32_MAX
+#define INT_LEAST64_MAX  INT64_MAX
+
+#define UINT_FAST8_MAX  UINT8_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define UINT_LEAST8_MAX  UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INTMAX_MIN  INT64_MIN
+#define INTMAX_MAX  INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define WINT_MIN 0U
+#define WINT_MAX UINT32_MAX
+
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
+
+#define SIG_ATOMIC_MIN  INT32_MIN
+#define SIG_ATOMIC_MAX  INT32_MAX
+
+#include <bits/stdint.h>
+
+#define INT8_C(c)  c
+#define INT16_C(c) c
+#define INT32_C(c) c
+
+#define UINT8_C(c)  c
+#define UINT16_C(c) c
+#define UINT32_C(c) c ## U
+
+#if UINTPTR_MAX == UINT64_MAX
+#define INT64_C(c) c ## L
+#define UINT64_C(c) c ## UL
+#define INTMAX_C(c)  c ## L
+#define UINTMAX_C(c) c ## UL
+#else
+#define INT64_C(c) c ## LL
+#define UINT64_C(c) c ## ULL
+#define INTMAX_C(c)  c ## LL
+#define UINTMAX_C(c) c ## ULL
+#endif
+
+#endif
diff --git a/musl-include/x86_64/stdio.h b/musl-include/x86_64/stdio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stdio.h
@@ -0,0 +1,224 @@
+#ifndef _STDIO_H
+#define _STDIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_FILE
+#define __NEED___isoc_va_list
+#define __NEED_size_t
+
+#if __STDC_VERSION__ < 201112L
+#define __NEED_struct__IO_FILE
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_ssize_t
+#define __NEED_off_t
+#define __NEED_va_list
+#endif
+
+#include <bits/alltypes.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#undef EOF
+#define EOF (-1)
+
+#undef SEEK_SET
+#undef SEEK_CUR
+#undef SEEK_END
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#define _IOFBF 0
+#define _IOLBF 1
+#define _IONBF 2
+
+#define BUFSIZ 1024
+#define FILENAME_MAX 4096
+#define FOPEN_MAX 1000
+#define TMP_MAX 10000
+#define L_tmpnam 20
+
+typedef union _G_fpos64_t {
+	char __opaque[16];
+	long long __lldata;
+	double __align;
+} fpos_t;
+
+extern FILE *const stdin;
+extern FILE *const stdout;
+extern FILE *const stderr;
+
+#define stdin  (stdin)
+#define stdout (stdout)
+#define stderr (stderr)
+
+FILE *fopen(const char *__restrict, const char *__restrict);
+FILE *freopen(const char *__restrict, const char *__restrict, FILE *__restrict);
+int fclose(FILE *);
+
+int remove(const char *);
+int rename(const char *, const char *);
+
+int feof(FILE *);
+int ferror(FILE *);
+int fflush(FILE *);
+void clearerr(FILE *);
+
+int fseek(FILE *, long, int);
+long ftell(FILE *);
+void rewind(FILE *);
+
+int fgetpos(FILE *__restrict, fpos_t *__restrict);
+int fsetpos(FILE *, const fpos_t *);
+
+size_t fread(void *__restrict, size_t, size_t, FILE *__restrict);
+size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict);
+
+int fgetc(FILE *);
+int getc(FILE *);
+int getchar(void);
+int ungetc(int, FILE *);
+
+int fputc(int, FILE *);
+int putc(int, FILE *);
+int putchar(int);
+
+char *fgets(char *__restrict, int, FILE *__restrict);
+#if __STDC_VERSION__ < 201112L
+char *gets(char *);
+#endif
+
+int fputs(const char *__restrict, FILE *__restrict);
+int puts(const char *);
+
+int printf(const char *__restrict, ...);
+int fprintf(FILE *__restrict, const char *__restrict, ...);
+int sprintf(char *__restrict, const char *__restrict, ...);
+int snprintf(char *__restrict, size_t, const char *__restrict, ...);
+
+int vprintf(const char *__restrict, __isoc_va_list);
+int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
+int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list);
+
+int scanf(const char *__restrict, ...);
+int fscanf(FILE *__restrict, const char *__restrict, ...);
+int sscanf(const char *__restrict, const char *__restrict, ...);
+int vscanf(const char *__restrict, __isoc_va_list);
+int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list);
+int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list);
+
+void perror(const char *);
+
+int setvbuf(FILE *__restrict, char *__restrict, int, size_t);
+void setbuf(FILE *__restrict, char *__restrict);
+
+char *tmpnam(char *);
+FILE *tmpfile(void);
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+FILE *fmemopen(void *__restrict, size_t, const char *__restrict);
+FILE *open_memstream(char **, size_t *);
+FILE *fdopen(int, const char *);
+FILE *popen(const char *, const char *);
+int pclose(FILE *);
+int fileno(FILE *);
+int fseeko(FILE *, off_t, int);
+off_t ftello(FILE *);
+int dprintf(int, const char *__restrict, ...);
+int vdprintf(int, const char *__restrict, __isoc_va_list);
+void flockfile(FILE *);
+int ftrylockfile(FILE *);
+void funlockfile(FILE *);
+int getc_unlocked(FILE *);
+int getchar_unlocked(void);
+int putc_unlocked(int, FILE *);
+int putchar_unlocked(int);
+ssize_t getdelim(char **__restrict, size_t *__restrict, int, FILE *__restrict);
+ssize_t getline(char **__restrict, size_t *__restrict, FILE *__restrict);
+int renameat(int, const char *, int, const char *);
+char *ctermid(char *);
+#define L_ctermid 20
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define P_tmpdir "/tmp"
+char *tempnam(const char *, const char *);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define L_cuserid 20
+char *cuserid(char *);
+void setlinebuf(FILE *);
+void setbuffer(FILE *, char *, size_t);
+int fgetc_unlocked(FILE *);
+int fputc_unlocked(int, FILE *);
+int fflush_unlocked(FILE *);
+size_t fread_unlocked(void *, size_t, size_t, FILE *);
+size_t fwrite_unlocked(const void *, size_t, size_t, FILE *);
+void clearerr_unlocked(FILE *);
+int feof_unlocked(FILE *);
+int ferror_unlocked(FILE *);
+int fileno_unlocked(FILE *);
+int getw(FILE *);
+int putw(int, FILE *);
+char *fgetln(FILE *, size_t *);
+int asprintf(char **, const char *, ...);
+int vasprintf(char **, const char *, __isoc_va_list);
+#endif
+
+#ifdef _GNU_SOURCE
+char *fgets_unlocked(char *, int, FILE *);
+int fputs_unlocked(const char *, FILE *);
+
+typedef ssize_t (cookie_read_function_t)(void *, char *, size_t);
+typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t);
+typedef int (cookie_seek_function_t)(void *, off_t *, int);
+typedef int (cookie_close_function_t)(void *);
+
+typedef struct _IO_cookie_io_functions_t {
+	cookie_read_function_t *read;
+	cookie_write_function_t *write;
+	cookie_seek_function_t *seek;
+	cookie_close_function_t *close;
+} cookie_io_functions_t;
+
+FILE *fopencookie(void *, const char *, cookie_io_functions_t);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define tmpfile64 tmpfile
+#define fopen64 fopen
+#define freopen64 freopen
+#define fseeko64 fseeko
+#define ftello64 ftello
+#define fgetpos64 fgetpos
+#define fsetpos64 fsetpos
+#define fpos64_t fpos_t
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/stdio_ext.h b/musl-include/x86_64/stdio_ext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stdio_ext.h
@@ -0,0 +1,34 @@
+#ifndef _STDIO_EXT_H
+#define _STDIO_EXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+#define FSETLOCKING_QUERY 0
+#define FSETLOCKING_INTERNAL 1
+#define FSETLOCKING_BYCALLER 2
+
+void _flushlbf(void);
+int __fsetlocking(FILE *, int);
+int __fwriting(FILE *);
+int __freading(FILE *);
+int __freadable(FILE *);
+int __fwritable(FILE *);
+int __flbf(FILE *);
+size_t __fbufsize(FILE *);
+size_t __fpending(FILE *);
+int __fpurge(FILE *);
+
+size_t __freadahead(FILE *);
+const char *__freadptr(FILE *, size_t *);
+void __freadptrinc(FILE *, size_t);
+void __fseterr(FILE *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/stdlib.h b/musl-include/x86_64/stdlib.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stdlib.h
@@ -0,0 +1,179 @@
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#define __NEED_wchar_t
+
+#include <bits/alltypes.h>
+
+int atoi (const char *);
+long atol (const char *);
+long long atoll (const char *);
+double atof (const char *);
+
+float strtof (const char *__restrict, char **__restrict);
+double strtod (const char *__restrict, char **__restrict);
+long double strtold (const char *__restrict, char **__restrict);
+
+long strtol (const char *__restrict, char **__restrict, int);
+unsigned long strtoul (const char *__restrict, char **__restrict, int);
+long long strtoll (const char *__restrict, char **__restrict, int);
+unsigned long long strtoull (const char *__restrict, char **__restrict, int);
+
+int rand (void);
+void srand (unsigned);
+
+void *malloc (size_t);
+void *calloc (size_t, size_t);
+void *realloc (void *, size_t);
+void free (void *);
+void *aligned_alloc(size_t, size_t);
+
+_Noreturn void abort (void);
+int atexit (void (*) (void));
+_Noreturn void exit (int);
+_Noreturn void _Exit (int);
+int at_quick_exit (void (*) (void));
+_Noreturn void quick_exit (int);
+
+char *getenv (const char *);
+
+int system (const char *);
+
+void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
+void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
+
+int abs (int);
+long labs (long);
+long long llabs (long long);
+
+typedef struct { int quot, rem; } div_t;
+typedef struct { long quot, rem; } ldiv_t;
+typedef struct { long long quot, rem; } lldiv_t;
+
+div_t div (int, int);
+ldiv_t ldiv (long, long);
+lldiv_t lldiv (long long, long long);
+
+int mblen (const char *, size_t);
+int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
+int wctomb (char *, wchar_t);
+size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
+size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+size_t __ctype_get_mb_cur_max(void);
+#define MB_CUR_MAX (__ctype_get_mb_cur_max())
+
+#define RAND_MAX (0x7fffffff)
+
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+#define WNOHANG    1
+#define WUNTRACED  2
+
+#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
+#define WTERMSIG(s) ((s) & 0x7f)
+#define WSTOPSIG(s) WEXITSTATUS(s)
+#define WIFEXITED(s) (!WTERMSIG(s))
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
+
+int posix_memalign (void **, size_t, size_t);
+int setenv (const char *, const char *, int);
+int unsetenv (const char *);
+int mkstemp (char *);
+int mkostemp (char *, int);
+char *mkdtemp (char *);
+int getsubopt (char **, char *const *, char **);
+int rand_r (unsigned *);
+
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+char *realpath (const char *__restrict, char *__restrict);
+long int random (void);
+void srandom (unsigned int);
+char *initstate (unsigned int, char *, size_t);
+char *setstate (char *);
+int putenv (char *);
+int posix_openpt (int);
+int grantpt (int);
+int unlockpt (int);
+char *ptsname (int);
+char *l64a (long);
+long a64l (const char *);
+void setkey (const char *);
+double drand48 (void);
+double erand48 (unsigned short [3]);
+long int lrand48 (void);
+long int nrand48 (unsigned short [3]);
+long mrand48 (void);
+long jrand48 (unsigned short [3]);
+void srand48 (long);
+unsigned short *seed48 (unsigned short [3]);
+void lcong48 (unsigned short [7]);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#include <alloca.h>
+char *mktemp (char *);
+int mkstemps (char *, int);
+int mkostemps (char *, int, int);
+void *valloc (size_t);
+void *memalign(size_t, size_t);
+int getloadavg(double *, int);
+int clearenv(void);
+#define WCOREDUMP(s) ((s) & 0x80)
+#define WIFCONTINUED(s) ((s) == 0xffff)
+void *reallocarray (void *, size_t, size_t);
+void qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *);
+#endif
+
+#ifdef _GNU_SOURCE
+int ptsname_r(int, char *, size_t);
+char *ecvt(double, int, int *, int *);
+char *fcvt(double, int, int *, int *);
+char *gcvt(double, int, char *);
+char *secure_getenv(const char *);
+struct __locale_struct;
+float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define mkstemp64 mkstemp
+#define mkostemp64 mkostemp
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define mkstemps64 mkstemps
+#define mkostemps64 mkostemps
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/stdnoreturn.h b/musl-include/x86_64/stdnoreturn.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stdnoreturn.h
@@ -0,0 +1,7 @@
+#ifndef _STDNORETURN_H
+#define _STDNORETURN_H
+#ifndef __cplusplus
+#include <features.h>
+#define noreturn _Noreturn
+#endif
+#endif
diff --git a/musl-include/x86_64/string.h b/musl-include/x86_64/string.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/string.h
@@ -0,0 +1,104 @@
+#ifndef	_STRING_H
+#define	_STRING_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+void *memcpy (void *__restrict, const void *__restrict, size_t);
+void *memmove (void *, const void *, size_t);
+void *memset (void *, int, size_t);
+int memcmp (const void *, const void *, size_t);
+void *memchr (const void *, int, size_t);
+
+char *strcpy (char *__restrict, const char *__restrict);
+char *strncpy (char *__restrict, const char *__restrict, size_t);
+
+char *strcat (char *__restrict, const char *__restrict);
+char *strncat (char *__restrict, const char *__restrict, size_t);
+
+int strcmp (const char *, const char *);
+int strncmp (const char *, const char *, size_t);
+
+int strcoll (const char *, const char *);
+size_t strxfrm (char *__restrict, const char *__restrict, size_t);
+
+char *strchr (const char *, int);
+char *strrchr (const char *, int);
+
+size_t strcspn (const char *, const char *);
+size_t strspn (const char *, const char *);
+char *strpbrk (const char *, const char *);
+char *strstr (const char *, const char *);
+char *strtok (char *__restrict, const char *__restrict);
+
+size_t strlen (const char *);
+
+char *strerror (int);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#include <strings.h>
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
+int strerror_r (int, char *, size_t);
+char *stpcpy(char *__restrict, const char *__restrict);
+char *stpncpy(char *__restrict, const char *__restrict, size_t);
+size_t strnlen (const char *, size_t);
+char *strdup (const char *);
+char *strndup (const char *, size_t);
+char *strsignal(int);
+char *strerror_l (int, locale_t);
+int strcoll_l (const char *, const char *, locale_t);
+size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
+void *memmem(const void *, size_t, const void *, size_t);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+void *memccpy (void *__restrict, const void *__restrict, int, size_t);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+char *strsep(char **, const char *);
+size_t strlcat (char *, const char *, size_t);
+size_t strlcpy (char *, const char *, size_t);
+void explicit_bzero (void *, size_t);
+#endif
+
+#ifdef _GNU_SOURCE
+#define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)
+int strverscmp (const char *, const char *);
+char *strchrnul(const char *, int);
+char *strcasestr(const char *, const char *);
+void *memrchr(const void *, int, size_t);
+void *mempcpy(void *, const void *, size_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/strings.h b/musl-include/x86_64/strings.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/strings.h
@@ -0,0 +1,40 @@
+#ifndef	_STRINGS_H
+#define	_STRINGS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_locale_t
+#include <bits/alltypes.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \
+ || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+int bcmp (const void *, const void *, size_t);
+void bcopy (const void *, void *, size_t);
+void bzero (void *, size_t);
+char *index (const char *, int);
+char *rindex (const char *, int);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)  || defined(_BSD_SOURCE)
+int ffs (int);
+int ffsl (long);
+int ffsll (long long);
+#endif
+
+int strcasecmp (const char *, const char *);
+int strncasecmp (const char *, const char *, size_t);
+
+int strcasecmp_l (const char *, const char *, locale_t);
+int strncasecmp_l (const char *, const char *, size_t, locale_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/stropts.h b/musl-include/x86_64/stropts.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/stropts.h
@@ -0,0 +1,139 @@
+#ifndef _STROPTS_H
+#define _STROPTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __SID		('S' << 8)
+
+#define I_NREAD		(__SID | 1)
+#define I_PUSH		(__SID | 2)
+#define I_POP		(__SID | 3)
+#define I_LOOK		(__SID | 4)
+#define I_FLUSH		(__SID | 5)
+#define I_SRDOPT	(__SID | 6)
+#define I_GRDOPT	(__SID | 7)
+#define I_STR		(__SID | 8)
+#define I_SETSIG	(__SID | 9)
+#define I_GETSIG	(__SID |10)
+#define I_FIND		(__SID |11)
+#define I_LINK		(__SID |12)
+#define I_UNLINK	(__SID |13)
+#define I_PEEK		(__SID |15)
+#define I_FDINSERT	(__SID |16)
+#define I_SENDFD	(__SID |17)
+#define I_RECVFD	(__SID |14)
+#define I_SWROPT	(__SID |19)
+#define I_GWROPT	(__SID |20)
+#define I_LIST		(__SID |21)
+#define I_PLINK		(__SID |22)
+#define I_PUNLINK	(__SID |23)
+#define I_FLUSHBAND	(__SID |28)
+#define I_CKBAND	(__SID |29)
+#define I_GETBAND	(__SID |30)
+#define I_ATMARK	(__SID |31)
+#define I_SETCLTIME	(__SID |32)
+#define I_GETCLTIME	(__SID |33)
+#define I_CANPUT	(__SID |34)
+
+#define FMNAMESZ	8
+
+#define FLUSHR		0x01
+#define FLUSHW		0x02
+#define FLUSHRW		0x03
+#define FLUSHBAND	0x04
+
+#define S_INPUT		0x0001
+#define S_HIPRI		0x0002
+#define S_OUTPUT	0x0004
+#define S_MSG		0x0008
+#define S_ERROR		0x0010
+#define S_HANGUP	0x0020
+#define S_RDNORM	0x0040
+#define S_WRNORM	S_OUTPUT
+#define S_RDBAND	0x0080
+#define S_WRBAND	0x0100
+#define S_BANDURG	0x0200
+
+#define RS_HIPRI	0x01
+
+#define RNORM		0x0000
+#define RMSGD		0x0001
+#define RMSGN		0x0002
+#define RPROTDAT	0x0004
+#define RPROTDIS	0x0008
+#define RPROTNORM	0x0010
+#define RPROTMASK	0x001C
+
+#define SNDZERO		0x001
+#define SNDPIPE		0x002
+
+#define ANYMARK		0x01
+#define LASTMARK	0x02
+
+#define MUXID_ALL	(-1)
+
+#define MSG_HIPRI	0x01
+#define MSG_ANY		0x02
+#define MSG_BAND	0x04
+
+#define MORECTL		1
+#define MOREDATA	2
+
+struct bandinfo {
+	unsigned char bi_pri;
+	int bi_flag;
+};
+
+struct strbuf {
+	int maxlen;
+	int len;
+	char *buf;
+};
+
+struct strpeek {
+	struct strbuf ctlbuf;
+	struct strbuf databuf;
+	unsigned flags;
+};
+
+struct strfdinsert {
+	struct strbuf ctlbuf;
+	struct strbuf databuf;
+	unsigned flags;
+	int fildes;
+	int offset;
+};
+
+struct strioctl {
+	int ic_cmd;
+	int ic_timout;
+	int ic_len;
+	char *ic_dp;
+};
+
+struct strrecvfd {
+	int fd;
+	int uid;
+	int gid;
+	char __fill[8];
+};
+
+struct str_mlist {
+	char l_name[FMNAMESZ + 1];
+};
+
+struct str_list {
+	int sl_nmods;
+	struct str_mlist *sl_modlist;
+};
+
+int isastream(int);
+int ioctl(int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/acct.h b/musl-include/x86_64/sys/acct.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/acct.h
@@ -0,0 +1,72 @@
+#ifndef _SYS_ACCT_H
+#define _SYS_ACCT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <time.h>
+#include <stdint.h>
+
+#define ACCT_COMM 16
+
+typedef uint16_t comp_t;
+
+struct acct {
+	char ac_flag;
+	uint16_t ac_uid;
+	uint16_t ac_gid;
+	uint16_t ac_tty;
+	uint32_t ac_btime;
+	comp_t ac_utime;
+	comp_t ac_stime;
+	comp_t ac_etime;
+	comp_t ac_mem;
+	comp_t ac_io;
+	comp_t ac_rw;
+	comp_t ac_minflt;
+	comp_t ac_majflt;
+	comp_t ac_swaps;
+	uint32_t ac_exitcode;
+	char ac_comm[ACCT_COMM+1];
+	char ac_pad[10];
+};
+
+
+struct acct_v3 {
+	char ac_flag;
+	char ac_version;
+	uint16_t ac_tty;
+	uint32_t ac_exitcode;
+	uint32_t ac_uid;
+	uint32_t ac_gid;
+	uint32_t ac_pid;
+	uint32_t ac_ppid;
+	uint32_t ac_btime;
+	float ac_etime;
+	comp_t ac_utime;
+	comp_t ac_stime;
+	comp_t ac_mem;
+	comp_t ac_io;
+	comp_t ac_rw;
+	comp_t ac_minflt;
+	comp_t ac_majflt;
+	comp_t ac_swaps;
+	char ac_comm[ACCT_COMM];
+};
+
+#define AFORK 1
+#define ASU 2
+#define ACORE 8
+#define AXSIG 16
+#define ACCT_BYTEORDER (128*(__BYTE_ORDER==__BIG_ENDIAN))
+#define AHZ 100
+
+int acct(const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/auxv.h b/musl-include/x86_64/sys/auxv.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/auxv.h
@@ -0,0 +1,17 @@
+#ifndef _SYS_AUXV_H
+#define _SYS_AUXV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <elf.h>
+#include <bits/hwcap.h>
+
+unsigned long getauxval(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/cachectl.h b/musl-include/x86_64/sys/cachectl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/cachectl.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_CACHECTL_H
+#define _SYS_CACHECTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ICACHE (1<<0)
+#define DCACHE (1<<1)
+#define BCACHE (ICACHE|DCACHE)
+#define CACHEABLE 0
+#define UNCACHEABLE 1
+ 
+int cachectl(void *, int, int);
+int cacheflush(void *, int, int);
+int _flush_cache(void *, int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/dir.h b/musl-include/x86_64/sys/dir.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/dir.h
@@ -0,0 +1,2 @@
+#include <dirent.h>
+#define direct dirent
diff --git a/musl-include/x86_64/sys/epoll.h b/musl-include/x86_64/sys/epoll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/epoll.h
@@ -0,0 +1,69 @@
+#ifndef	_SYS_EPOLL_H
+#define	_SYS_EPOLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define EPOLL_CLOEXEC O_CLOEXEC
+#define EPOLL_NONBLOCK O_NONBLOCK
+
+enum EPOLL_EVENTS { __EPOLL_DUMMY };
+#define EPOLLIN 0x001
+#define EPOLLPRI 0x002
+#define EPOLLOUT 0x004
+#define EPOLLRDNORM 0x040
+#define EPOLLNVAL 0x020
+#define EPOLLRDBAND 0x080
+#define EPOLLWRNORM 0x100
+#define EPOLLWRBAND 0x200
+#define EPOLLMSG 0x400
+#define EPOLLERR 0x008
+#define EPOLLHUP 0x010
+#define EPOLLRDHUP 0x2000
+#define EPOLLEXCLUSIVE (1U<<28)
+#define EPOLLWAKEUP (1U<<29)
+#define EPOLLONESHOT (1U<<30)
+#define EPOLLET (1U<<31)
+
+#define EPOLL_CTL_ADD 1
+#define EPOLL_CTL_DEL 2
+#define EPOLL_CTL_MOD 3
+
+typedef union epoll_data {
+	void *ptr;
+	int fd;
+	uint32_t u32;
+	uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event {
+	uint32_t events;
+	epoll_data_t data;
+}
+#ifdef __x86_64__
+__attribute__ ((__packed__))
+#endif
+;
+
+
+int epoll_create(int);
+int epoll_create1(int);
+int epoll_ctl(int, int, int, struct epoll_event *);
+int epoll_wait(int, struct epoll_event *, int, int);
+int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/epoll.h */
diff --git a/musl-include/x86_64/sys/errno.h b/musl-include/x86_64/sys/errno.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/errno.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/errno.h> to <errno.h>
+#include <errno.h>
diff --git a/musl-include/x86_64/sys/eventfd.h b/musl-include/x86_64/sys/eventfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/eventfd.h
@@ -0,0 +1,26 @@
+#ifndef _SYS_EVENTFD_H
+#define _SYS_EVENTFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+typedef uint64_t eventfd_t;
+
+#define EFD_SEMAPHORE 1
+#define EFD_CLOEXEC O_CLOEXEC
+#define EFD_NONBLOCK O_NONBLOCK
+
+int eventfd(unsigned int, int);
+int eventfd_read(int, eventfd_t *);
+int eventfd_write(int, eventfd_t);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/eventfd.h */
diff --git a/musl-include/x86_64/sys/fanotify.h b/musl-include/x86_64/sys/fanotify.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/fanotify.h
@@ -0,0 +1,111 @@
+#ifndef _FANOTIFY_H
+#define _FANOTIFY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/statfs.h>
+
+struct fanotify_event_metadata {
+	unsigned event_len;
+	unsigned char vers;
+	unsigned char reserved;
+	unsigned short metadata_len;
+	unsigned long long mask
+#ifdef __GNUC__
+	__attribute__((__aligned__(8)))
+#endif
+	;
+	int fd;
+	int pid;
+};
+
+struct fanotify_event_info_header {
+	unsigned char info_type;
+	unsigned char pad;
+	unsigned short len;
+};
+
+struct fanotify_event_info_fid {
+	struct fanotify_event_info_header hdr;
+	fsid_t fsid;
+	unsigned char handle[];
+};
+
+struct fanotify_response {
+	int fd;
+	unsigned response;
+};
+
+#define FAN_ACCESS 0x01
+#define FAN_MODIFY 0x02
+#define FAN_ATTRIB 0x04
+#define FAN_CLOSE_WRITE 0x08
+#define FAN_CLOSE_NOWRITE 0x10
+#define FAN_OPEN 0x20
+#define FAN_MOVED_FROM 0x40
+#define FAN_MOVED_TO 0x80
+#define FAN_CREATE 0x100
+#define FAN_DELETE 0x200
+#define FAN_DELETE_SELF 0x400
+#define FAN_MOVE_SELF 0x800
+#define FAN_OPEN_EXEC 0x1000
+#define FAN_Q_OVERFLOW 0x4000
+#define FAN_OPEN_PERM 0x10000
+#define FAN_ACCESS_PERM 0x20000
+#define FAN_OPEN_EXEC_PERM 0x40000
+#define FAN_DIR_MODIFY 0x00080000
+#define FAN_EVENT_ON_CHILD 0x08000000
+#define FAN_ONDIR 0x40000000
+#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
+#define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO)
+#define FAN_CLOEXEC 0x01
+#define FAN_NONBLOCK 0x02
+#define FAN_CLASS_NOTIF 0
+#define FAN_CLASS_CONTENT 0x04
+#define FAN_CLASS_PRE_CONTENT 0x08
+#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
+#define FAN_UNLIMITED_QUEUE 0x10
+#define FAN_UNLIMITED_MARKS 0x20
+#define FAN_ENABLE_AUDIT 0x40
+#define FAN_REPORT_TID 0x100
+#define FAN_REPORT_FID 0x200
+#define FAN_REPORT_DIR_FID 0x00000400
+#define FAN_REPORT_NAME 0x00000800
+#define FAN_REPORT_DFID_NAME (FAN_REPORT_DIR_FID | FAN_REPORT_NAME)
+#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
+#define FAN_MARK_ADD 0x01
+#define FAN_MARK_REMOVE 0x02
+#define FAN_MARK_DONT_FOLLOW 0x04
+#define FAN_MARK_ONLYDIR 0x08
+#define FAN_MARK_IGNORED_MASK 0x20
+#define FAN_MARK_IGNORED_SURV_MODIFY 0x40
+#define FAN_MARK_FLUSH 0x80
+#define FAN_MARK_INODE 0x00
+#define FAN_MARK_MOUNT 0x10
+#define FAN_MARK_FILESYSTEM 0x100
+#define FAN_MARK_TYPE_MASK (FAN_MARK_INODE | FAN_MARK_MOUNT | FAN_MARK_FILESYSTEM)
+#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_DONT_FOLLOW | FAN_MARK_ONLYDIR | FAN_MARK_MOUNT | FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY | FAN_MARK_FLUSH)
+#define FAN_ALL_EVENTS (FAN_ACCESS | FAN_MODIFY | FAN_CLOSE | FAN_OPEN)
+#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM | FAN_ACCESS_PERM)
+#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS | FAN_ALL_PERM_EVENTS | FAN_Q_OVERFLOW)
+#define FANOTIFY_METADATA_VERSION 3
+#define FAN_EVENT_INFO_TYPE_FID 1
+#define FAN_EVENT_INFO_TYPE_DFID_NAME 2
+#define FAN_EVENT_INFO_TYPE_DFID 3
+#define FAN_ALLOW 0x01
+#define FAN_DENY 0x02
+#define FAN_AUDIT 0x10
+#define FAN_NOFD -1
+#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
+#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, (struct fanotify_event_metadata*)(((char *)(meta)) + (meta)->event_len))
+#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && (long)(meta)->event_len <= (long)(len))
+
+int fanotify_init(unsigned, unsigned);
+int fanotify_mark(int, unsigned, unsigned long long, int, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/fcntl.h b/musl-include/x86_64/sys/fcntl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/fcntl.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
+#include <fcntl.h>
diff --git a/musl-include/x86_64/sys/file.h b/musl-include/x86_64/sys/file.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/file.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_FILE_H
+#define _SYS_FILE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOCK_SH	1
+#define LOCK_EX	2
+#define LOCK_NB	4
+#define LOCK_UN	8
+
+#define L_SET 0
+#define L_INCR 1
+#define L_XTND 2
+
+int flock(int, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/fsuid.h b/musl-include/x86_64/sys/fsuid.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/fsuid.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_FSUID_H
+#define _SYS_FSUID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_uid_t
+#define __NEED_gid_t
+
+#include <bits/alltypes.h>
+
+int setfsuid(uid_t);
+int setfsgid(gid_t);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/inotify.h b/musl-include/x86_64/sys/inotify.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/inotify.h
@@ -0,0 +1,58 @@
+#ifndef _SYS_INOTIFY_H
+#define _SYS_INOTIFY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+struct inotify_event {
+	int wd;
+	uint32_t mask, cookie, len;
+	char name[];
+};
+
+#define IN_CLOEXEC O_CLOEXEC
+#define IN_NONBLOCK O_NONBLOCK
+
+#define IN_ACCESS        0x00000001
+#define IN_MODIFY        0x00000002
+#define IN_ATTRIB        0x00000004
+#define IN_CLOSE_WRITE   0x00000008
+#define IN_CLOSE_NOWRITE 0x00000010
+#define IN_CLOSE         (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
+#define IN_OPEN          0x00000020
+#define IN_MOVED_FROM    0x00000040
+#define IN_MOVED_TO      0x00000080
+#define IN_MOVE          (IN_MOVED_FROM | IN_MOVED_TO)
+#define IN_CREATE        0x00000100
+#define IN_DELETE        0x00000200
+#define IN_DELETE_SELF   0x00000400
+#define IN_MOVE_SELF     0x00000800
+#define IN_ALL_EVENTS    0x00000fff
+
+#define IN_UNMOUNT       0x00002000
+#define IN_Q_OVERFLOW    0x00004000
+#define IN_IGNORED       0x00008000
+
+#define IN_ONLYDIR       0x01000000
+#define IN_DONT_FOLLOW   0x02000000
+#define IN_EXCL_UNLINK   0x04000000
+#define IN_MASK_CREATE   0x10000000
+#define IN_MASK_ADD      0x20000000
+
+#define IN_ISDIR         0x40000000
+#define IN_ONESHOT       0x80000000
+
+int inotify_init(void);
+int inotify_init1(int);
+int inotify_add_watch(int, const char *, uint32_t);
+int inotify_rm_watch(int, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/io.h b/musl-include/x86_64/sys/io.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/io.h
@@ -0,0 +1,17 @@
+#ifndef	_SYS_IO_H
+#define	_SYS_IO_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <bits/io.h>
+
+int iopl(int);
+int ioperm(unsigned long, unsigned long, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/ioctl.h b/musl-include/x86_64/sys/ioctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/ioctl.h
@@ -0,0 +1,120 @@
+#ifndef	_SYS_IOCTL_H
+#define	_SYS_IOCTL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_struct_winsize
+
+#include <bits/alltypes.h>
+#include <bits/ioctl.h>
+
+#define N_TTY           0
+#define N_SLIP          1
+#define N_MOUSE         2
+#define N_PPP           3
+#define N_STRIP         4
+#define N_AX25          5
+#define N_X25           6
+#define N_6PACK         7
+#define N_MASC          8
+#define N_R3964         9
+#define N_PROFIBUS_FDL  10
+#define N_IRDA          11
+#define N_SMSBLOCK      12
+#define N_HDLC          13
+#define N_SYNC_PPP      14
+#define N_HCI           15
+#define N_GIGASET_M101  16
+#define N_SLCAN         17
+#define N_PPS           18
+#define N_V253          19
+#define N_CAIF          20
+#define N_GSM0710       21
+#define N_TI_WL         22
+#define N_TRACESINK     23
+#define N_TRACEROUTER   24
+#define N_NCI           25
+#define N_SPEAKUP       26
+#define N_NULL          27
+
+#define TIOCPKT_DATA       0
+#define TIOCPKT_FLUSHREAD  1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP       4
+#define TIOCPKT_START      8
+#define TIOCPKT_NOSTOP    16
+#define TIOCPKT_DOSTOP    32
+#define TIOCPKT_IOCTL     64
+
+#define TIOCSER_TEMT 1
+
+#define SIOCADDRT          0x890B
+#define SIOCDELRT          0x890C
+#define SIOCRTMSG          0x890D
+
+#define SIOCGIFNAME        0x8910
+#define SIOCSIFLINK        0x8911
+#define SIOCGIFCONF        0x8912
+#define SIOCGIFFLAGS       0x8913
+#define SIOCSIFFLAGS       0x8914
+#define SIOCGIFADDR        0x8915
+#define SIOCSIFADDR        0x8916
+#define SIOCGIFDSTADDR     0x8917
+#define SIOCSIFDSTADDR     0x8918
+#define SIOCGIFBRDADDR     0x8919
+#define SIOCSIFBRDADDR     0x891a
+#define SIOCGIFNETMASK     0x891b
+#define SIOCSIFNETMASK     0x891c
+#define SIOCGIFMETRIC      0x891d
+#define SIOCSIFMETRIC      0x891e
+#define SIOCGIFMEM         0x891f
+#define SIOCSIFMEM         0x8920
+#define SIOCGIFMTU         0x8921
+#define SIOCSIFMTU         0x8922
+#define SIOCSIFNAME        0x8923
+#define SIOCSIFHWADDR      0x8924
+#define SIOCGIFENCAP       0x8925
+#define SIOCSIFENCAP       0x8926
+#define SIOCGIFHWADDR      0x8927
+#define SIOCGIFSLAVE       0x8929
+#define SIOCSIFSLAVE       0x8930
+#define SIOCADDMULTI       0x8931
+#define SIOCDELMULTI       0x8932
+#define SIOCGIFINDEX       0x8933
+#define SIOGIFINDEX        SIOCGIFINDEX
+#define SIOCSIFPFLAGS      0x8934
+#define SIOCGIFPFLAGS      0x8935
+#define SIOCDIFADDR        0x8936
+#define SIOCSIFHWBROADCAST 0x8937
+#define SIOCGIFCOUNT       0x8938
+
+#define SIOCGIFBR          0x8940
+#define SIOCSIFBR          0x8941
+
+#define SIOCGIFTXQLEN      0x8942
+#define SIOCSIFTXQLEN      0x8943
+
+#define SIOCDARP           0x8953
+#define SIOCGARP           0x8954
+#define SIOCSARP           0x8955
+
+#define SIOCDRARP          0x8960
+#define SIOCGRARP          0x8961
+#define SIOCSRARP          0x8962
+
+#define SIOCGIFMAP         0x8970
+#define SIOCSIFMAP         0x8971
+
+#define SIOCADDDLCI        0x8980
+#define SIOCDELDLCI        0x8981
+
+#define SIOCDEVPRIVATE     0x89F0
+#define SIOCPROTOPRIVATE   0x89E0
+
+int ioctl (int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/ipc.h b/musl-include/x86_64/sys/ipc.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/ipc.h
@@ -0,0 +1,42 @@
+#ifndef _SYS_IPC_H
+#define _SYS_IPC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_key_t
+
+#include <bits/alltypes.h>
+
+#define __ipc_perm_key __key
+#define __ipc_perm_seq __seq
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __key key
+#define __seq seq
+#endif
+
+#include <bits/ipc.h>
+#include <bits/ipcstat.h>
+
+#define IPC_CREAT  01000
+#define IPC_EXCL   02000
+#define IPC_NOWAIT 04000
+
+#define IPC_RMID 0
+#define IPC_SET  1
+#define IPC_INFO 3
+
+#define IPC_PRIVATE ((key_t) 0)
+
+key_t ftok (const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/kd.h b/musl-include/x86_64/sys/kd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/kd.h
@@ -0,0 +1,1 @@
+#include <bits/kd.h>
diff --git a/musl-include/x86_64/sys/klog.h b/musl-include/x86_64/sys/klog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/klog.h
@@ -0,0 +1,14 @@
+#ifndef	_SYS_KLOG_H
+#define	_SYS_KLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int klogctl (int, char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/membarrier.h b/musl-include/x86_64/sys/membarrier.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/membarrier.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_MEMBARRIER_H
+#define _SYS_MEMBARRIER_H
+
+#define MEMBARRIER_CMD_QUERY 0
+#define MEMBARRIER_CMD_GLOBAL 1
+#define MEMBARRIER_CMD_GLOBAL_EXPEDITED 2
+#define MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED 4
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED 8
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED 16
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE 32
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE 64
+#define MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ 128
+#define MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ 256
+
+#define MEMBARRIER_CMD_SHARED MEMBARRIER_CMD_GLOBAL
+
+#define MEMBARRIER_CMD_FLAG_CPU 1
+
+int membarrier(int, int);
+
+#endif
diff --git a/musl-include/x86_64/sys/mman.h b/musl-include/x86_64/sys/mman.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/mman.h
@@ -0,0 +1,152 @@
+#ifndef	_SYS_MMAN_H
+#define	_SYS_MMAN_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_mode_t
+#define __NEED_size_t
+#define __NEED_off_t
+
+#if defined(_GNU_SOURCE)
+#define __NEED_ssize_t
+#endif
+
+#include <bits/alltypes.h>
+
+#define MAP_FAILED ((void *) -1)
+
+#define MAP_SHARED     0x01
+#define MAP_PRIVATE    0x02
+#define MAP_SHARED_VALIDATE 0x03
+#define MAP_TYPE       0x0f
+#define MAP_FIXED      0x10
+#define MAP_ANON       0x20
+#define MAP_ANONYMOUS  MAP_ANON
+#define MAP_NORESERVE  0x4000
+#define MAP_GROWSDOWN  0x0100
+#define MAP_DENYWRITE  0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_LOCKED     0x2000
+#define MAP_POPULATE   0x8000
+#define MAP_NONBLOCK   0x10000
+#define MAP_STACK      0x20000
+#define MAP_HUGETLB    0x40000
+#define MAP_SYNC       0x80000
+#define MAP_FIXED_NOREPLACE 0x100000
+#define MAP_FILE       0
+
+#define MAP_HUGE_SHIFT 26
+#define MAP_HUGE_MASK  0x3f
+#define MAP_HUGE_16KB  (14 << 26)
+#define MAP_HUGE_64KB  (16 << 26)
+#define MAP_HUGE_512KB (19 << 26)
+#define MAP_HUGE_1MB   (20 << 26)
+#define MAP_HUGE_2MB   (21 << 26)
+#define MAP_HUGE_8MB   (23 << 26)
+#define MAP_HUGE_16MB  (24 << 26)
+#define MAP_HUGE_32MB  (25 << 26)
+#define MAP_HUGE_256MB (28 << 26)
+#define MAP_HUGE_512MB (29 << 26)
+#define MAP_HUGE_1GB   (30 << 26)
+#define MAP_HUGE_2GB   (31 << 26)
+#define MAP_HUGE_16GB  (34U << 26)
+
+#define PROT_NONE      0
+#define PROT_READ      1
+#define PROT_WRITE     2
+#define PROT_EXEC      4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP   0x02000000
+
+#define MS_ASYNC       1
+#define MS_INVALIDATE  2
+#define MS_SYNC        4
+
+#define MCL_CURRENT    1
+#define MCL_FUTURE     2
+#define MCL_ONFAULT    4
+
+#define POSIX_MADV_NORMAL     0
+#define POSIX_MADV_RANDOM     1
+#define POSIX_MADV_SEQUENTIAL 2
+#define POSIX_MADV_WILLNEED   3
+#define POSIX_MADV_DONTNEED   4
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define MADV_NORMAL      0
+#define MADV_RANDOM      1
+#define MADV_SEQUENTIAL  2
+#define MADV_WILLNEED    3
+#define MADV_DONTNEED    4
+#define MADV_FREE        8
+#define MADV_REMOVE      9
+#define MADV_DONTFORK    10
+#define MADV_DOFORK      11
+#define MADV_MERGEABLE   12
+#define MADV_UNMERGEABLE 13
+#define MADV_HUGEPAGE    14
+#define MADV_NOHUGEPAGE  15
+#define MADV_DONTDUMP    16
+#define MADV_DODUMP      17
+#define MADV_WIPEONFORK  18
+#define MADV_KEEPONFORK  19
+#define MADV_COLD        20
+#define MADV_PAGEOUT     21
+#define MADV_HWPOISON    100
+#define MADV_SOFT_OFFLINE 101
+#endif
+
+#ifdef _GNU_SOURCE
+#define MREMAP_MAYMOVE 1
+#define MREMAP_FIXED 2
+#define MREMAP_DONTUNMAP 4
+
+#define MLOCK_ONFAULT 0x01
+
+#define MFD_CLOEXEC 0x0001U
+#define MFD_ALLOW_SEALING 0x0002U
+#define MFD_HUGETLB 0x0004U
+#endif
+
+#include <bits/mman.h>
+
+void *mmap (void *, size_t, int, int, int, off_t);
+int munmap (void *, size_t);
+
+int mprotect (void *, size_t, int);
+int msync (void *, size_t, int);
+
+int posix_madvise (void *, size_t, int);
+
+int mlock (const void *, size_t);
+int munlock (const void *, size_t);
+int mlockall (int);
+int munlockall (void);
+
+#ifdef _GNU_SOURCE
+void *mremap (void *, size_t, size_t, int, ...);
+int remap_file_pages (void *, size_t, int, size_t, int);
+int memfd_create (const char *, unsigned);
+int mlock2 (const void *, size_t, unsigned);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int madvise (void *, size_t, int);
+int mincore (void *, size_t, unsigned char *);
+#endif
+
+int shm_open (const char *, int, mode_t);
+int shm_unlink (const char *);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define mmap64 mmap
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/mount.h b/musl-include/x86_64/sys/mount.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/mount.h
@@ -0,0 +1,75 @@
+#ifndef _SYS_MOUNT_H
+#define _SYS_MOUNT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ioctl.h>
+
+#define BLKROSET   _IO(0x12, 93)
+#define BLKROGET   _IO(0x12, 94)
+#define BLKRRPART  _IO(0x12, 95)
+#define BLKGETSIZE _IO(0x12, 96)
+#define BLKFLSBUF  _IO(0x12, 97)
+#define BLKRASET   _IO(0x12, 98)
+#define BLKRAGET   _IO(0x12, 99)
+#define BLKFRASET  _IO(0x12,100)
+#define BLKFRAGET  _IO(0x12,101)
+#define BLKSECTSET _IO(0x12,102)
+#define BLKSECTGET _IO(0x12,103)
+#define BLKSSZGET  _IO(0x12,104)
+#define BLKBSZGET  _IOR(0x12,112,size_t)
+#define BLKBSZSET  _IOW(0x12,113,size_t)
+#define BLKGETSIZE64 _IOR(0x12,114,size_t)
+
+#define MS_RDONLY      1
+#define MS_NOSUID      2
+#define MS_NODEV       4
+#define MS_NOEXEC      8
+#define MS_SYNCHRONOUS 16
+#define MS_REMOUNT     32
+#define MS_MANDLOCK    64
+#define MS_DIRSYNC     128
+#define MS_NOSYMFOLLOW 256
+#define MS_NOATIME     1024
+#define MS_NODIRATIME  2048
+#define MS_BIND        4096
+#define MS_MOVE        8192
+#define MS_REC         16384
+#define MS_SILENT      32768
+#define MS_POSIXACL    (1<<16)
+#define MS_UNBINDABLE  (1<<17)
+#define MS_PRIVATE     (1<<18)
+#define MS_SLAVE       (1<<19)
+#define MS_SHARED      (1<<20)
+#define MS_RELATIME    (1<<21)
+#define MS_KERNMOUNT   (1<<22)
+#define MS_I_VERSION   (1<<23)
+#define MS_STRICTATIME (1<<24)
+#define MS_LAZYTIME    (1<<25)
+#define MS_NOREMOTELOCK (1<<27)
+#define MS_NOSEC       (1<<28)
+#define MS_BORN        (1<<29)
+#define MS_ACTIVE      (1<<30)
+#define MS_NOUSER      (1U<<31)
+
+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
+
+#define MS_MGC_VAL 0xc0ed0000
+#define MS_MGC_MSK 0xffff0000
+
+#define MNT_FORCE       1
+#define MNT_DETACH      2
+#define MNT_EXPIRE      4
+#define UMOUNT_NOFOLLOW 8
+
+int mount(const char *, const char *, const char *, unsigned long, const void *);
+int umount(const char *);
+int umount2(const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/msg.h b/musl-include/x86_64/sys/msg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/msg.h
@@ -0,0 +1,53 @@
+#ifndef _SYS_MSG_H
+#define _SYS_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/ipc.h>
+
+#define __NEED_pid_t
+#define __NEED_key_t
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+
+#include <bits/alltypes.h>
+
+typedef unsigned long msgqnum_t;
+typedef unsigned long msglen_t;
+
+#include <bits/msg.h>
+
+#define __msg_cbytes msg_cbytes
+
+#define MSG_NOERROR 010000
+#define MSG_EXCEPT  020000
+
+#define MSG_STAT (11 | (IPC_STAT & 0x100))
+#define MSG_INFO 12
+#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100))
+
+struct msginfo {
+	int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;
+	unsigned short msgseg;
+};
+
+int msgctl (int, int, struct msqid_ds *);
+int msgget (key_t, int);
+ssize_t msgrcv (int, void *, size_t, long, int);
+int msgsnd (int, const void *, size_t, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct msgbuf {
+	long mtype;
+	char mtext[1];
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/mtio.h b/musl-include/x86_64/sys/mtio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/mtio.h
@@ -0,0 +1,188 @@
+#ifndef _SYS_MTIO_H
+#define _SYS_MTIO_H
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+struct mtop {
+	short mt_op;
+	int mt_count;
+};
+
+#define _IOT_mtop _IOT (_IOTS (short), 1, _IOTS (int), 1, 0, 0)
+#define _IOT_mtget _IOT (_IOTS (long), 7, 0, 0, 0, 0)
+#define _IOT_mtpos _IOT_SIMPLE (long)
+#define _IOT_mtconfiginfo _IOT (_IOTS (long), 2, _IOTS (short), 3, _IOTS (long), 1)
+
+
+#define MTRESET 0
+#define MTFSF	1
+#define MTBSF	2
+#define MTFSR	3
+#define MTBSR	4
+#define MTWEOF	5
+#define MTREW	6
+#define MTOFFL	7
+#define MTNOP	8
+#define MTRETEN 9
+#define MTBSFM	10
+#define MTFSFM  11
+#define MTEOM	12
+#define MTERASE 13
+#define MTRAS1  14
+#define MTRAS2	15
+#define MTRAS3  16
+#define MTSETBLK 20
+#define MTSETDENSITY 21
+#define MTSEEK	22
+#define MTTELL	23
+#define MTSETDRVBUFFER 24
+#define MTFSS	25
+#define MTBSS	26
+#define MTWSM	27
+#define MTLOCK  28
+#define MTUNLOCK 29
+#define MTLOAD  30
+#define MTUNLOAD 31
+#define MTCOMPRESSION 32
+#define MTSETPART 33
+#define MTMKPART  34
+
+struct mtget {
+	long mt_type;
+	long mt_resid;
+	long mt_dsreg;
+	long mt_gstat;
+	long mt_erreg;
+	int mt_fileno;
+	int mt_blkno;
+};
+
+#define MT_ISUNKNOWN		0x01
+#define MT_ISQIC02		0x02
+#define MT_ISWT5150		0x03
+#define MT_ISARCHIVE_5945L2	0x04
+#define MT_ISCMSJ500		0x05
+#define MT_ISTDC3610		0x06
+#define MT_ISARCHIVE_VP60I	0x07
+#define MT_ISARCHIVE_2150L	0x08
+#define MT_ISARCHIVE_2060L	0x09
+#define MT_ISARCHIVESC499	0x0A
+#define MT_ISQIC02_ALL_FEATURES	0x0F
+#define MT_ISWT5099EEN24	0x11
+#define MT_ISTEAC_MT2ST		0x12
+#define MT_ISEVEREX_FT40A	0x32
+#define MT_ISDDS1		0x51
+#define MT_ISDDS2		0x52
+#define MT_ISSCSI1		0x71
+#define MT_ISSCSI2		0x72
+#define MT_ISFTAPE_UNKNOWN	0x800000
+#define MT_ISFTAPE_FLAG		0x800000
+
+struct mt_tape_info {
+	long t_type;
+	char *t_name;
+};
+
+#define MT_TAPE_INFO \
+{									      \
+	{MT_ISUNKNOWN,		"Unknown type of tape device"},		      \
+	{MT_ISQIC02,		"Generic QIC-02 tape streamer"},	      \
+	{MT_ISWT5150,		"Wangtek 5150, QIC-150"},		      \
+	{MT_ISARCHIVE_5945L2,	"Archive 5945L-2"},			      \
+	{MT_ISCMSJ500,		"CMS Jumbo 500"},			      \
+	{MT_ISTDC3610,		"Tandberg TDC 3610, QIC-24"},		      \
+	{MT_ISARCHIVE_VP60I,	"Archive VP60i, QIC-02"},		      \
+	{MT_ISARCHIVE_2150L,	"Archive Viper 2150L"},			      \
+	{MT_ISARCHIVE_2060L,	"Archive Viper 2060L"},			      \
+	{MT_ISARCHIVESC499,	"Archive SC-499 QIC-36 controller"},	      \
+	{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"},	      \
+	{MT_ISWT5099EEN24,	"Wangtek 5099-een24, 60MB"},		      \
+	{MT_ISTEAC_MT2ST,	"Teac MT-2ST 155mb data cassette drive"},     \
+	{MT_ISEVEREX_FT40A,	"Everex FT40A, QIC-40"},		      \
+	{MT_ISSCSI1,		"Generic SCSI-1 tape"},			      \
+	{MT_ISSCSI2,		"Generic SCSI-2 tape"},			      \
+	{0, 0}								      \
+}
+
+struct mtpos {
+	long mt_blkno;
+};
+
+struct mtconfiginfo  {
+	long mt_type;
+	long ifc_type;
+	unsigned short irqnr;
+	unsigned short dmanr;
+	unsigned short port;
+	unsigned long debug;
+	unsigned have_dens:1;
+	unsigned have_bsf:1;
+	unsigned have_fsr:1;
+	unsigned have_bsr:1;
+	unsigned have_eod:1;
+	unsigned have_seek:1;
+	unsigned have_tell:1;
+	unsigned have_ras1:1;
+	unsigned have_ras2:1;
+	unsigned have_ras3:1;
+	unsigned have_qfa:1;
+	unsigned pad1:5;
+	char reserved[10];
+};
+
+#define	MTIOCTOP _IOW('m', 1, struct mtop)
+#define	MTIOCGET _IOR('m', 2, struct mtget)
+#define	MTIOCPOS _IOR('m', 3, struct mtpos)
+
+#define	MTIOCGETCONFIG	_IOR('m', 4, struct mtconfiginfo)
+#define	MTIOCSETCONFIG	_IOW('m', 5, struct mtconfiginfo)
+
+#define GMT_EOF(x)              ((x) & 0x80000000)
+#define GMT_BOT(x)              ((x) & 0x40000000)
+#define GMT_EOT(x)              ((x) & 0x20000000)
+#define GMT_SM(x)               ((x) & 0x10000000)
+#define GMT_EOD(x)              ((x) & 0x08000000)
+#define GMT_WR_PROT(x)          ((x) & 0x04000000)
+#define GMT_ONLINE(x)           ((x) & 0x01000000)
+#define GMT_D_6250(x)           ((x) & 0x00800000)
+#define GMT_D_1600(x)           ((x) & 0x00400000)
+#define GMT_D_800(x)            ((x) & 0x00200000)
+#define GMT_DR_OPEN(x)          ((x) & 0x00040000)
+#define GMT_IM_REP_EN(x)        ((x) & 0x00010000)
+
+#define MT_ST_BLKSIZE_SHIFT	0
+#define MT_ST_BLKSIZE_MASK	0xffffff
+#define MT_ST_DENSITY_SHIFT	24
+#define MT_ST_DENSITY_MASK	0xff000000
+#define MT_ST_SOFTERR_SHIFT	0
+#define MT_ST_SOFTERR_MASK	0xffff
+#define MT_ST_OPTIONS		0xf0000000
+#define MT_ST_BOOLEANS		0x10000000
+#define MT_ST_SETBOOLEANS	0x30000000
+#define MT_ST_CLEARBOOLEANS	0x40000000
+#define MT_ST_WRITE_THRESHOLD	0x20000000
+#define MT_ST_DEF_BLKSIZE	0x50000000
+#define MT_ST_DEF_OPTIONS	0x60000000
+#define MT_ST_BUFFER_WRITES	0x1
+#define MT_ST_ASYNC_WRITES	0x2
+#define MT_ST_READ_AHEAD	0x4
+#define MT_ST_DEBUGGING		0x8
+#define MT_ST_TWO_FM		0x10
+#define MT_ST_FAST_MTEOM	0x20
+#define MT_ST_AUTO_LOCK		0x40
+#define MT_ST_DEF_WRITES	0x80
+#define MT_ST_CAN_BSR		0x100
+#define MT_ST_NO_BLKLIMS	0x200
+#define MT_ST_CAN_PARTITIONS    0x400
+#define MT_ST_SCSI2LOGICAL      0x800
+#define MT_ST_CLEAR_DEFAULT	0xfffff
+#define MT_ST_DEF_DENSITY	(MT_ST_DEF_OPTIONS | 0x100000)
+#define MT_ST_DEF_COMPRESSION	(MT_ST_DEF_OPTIONS | 0x200000)
+#define MT_ST_DEF_DRVBUFFER	(MT_ST_DEF_OPTIONS | 0x300000)
+#define MT_ST_HPLOADER_OFFSET 10000
+#ifndef DEFTAPE
+# define DEFTAPE	"/dev/tape"
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/param.h b/musl-include/x86_64/sys/param.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/param.h
@@ -0,0 +1,35 @@
+#ifndef _SYS_PARAM_H
+#define _SYS_PARAM_H
+
+#define MAXSYMLINKS 20
+#define MAXHOSTNAMELEN 64
+#define MAXNAMLEN 255
+#define MAXPATHLEN 4096
+#define NBBY 8
+#define NGROUPS 32
+#define CANBSIZ 255
+#define NOFILE 256
+#define NCARGS 131072
+#define DEV_BSIZE 512
+#define NOGROUP (-1)
+
+#undef MIN
+#undef MAX
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
+#define __bitop(x,i,o) ((x)[(i)/8] o (1<<(i)%8))
+#define setbit(x,i) __bitop(x,i,|=)
+#define clrbit(x,i) __bitop(x,i,&=~)
+#define isset(x,i) __bitop(x,i,&)
+#define isclr(x,i) !isset(x,i)
+
+#define howmany(n,d) (((n)+((d)-1))/(d))
+#define roundup(n,d) (howmany(n,d)*(d))
+#define powerof2(n) !(((n)-1) & (n))
+
+#include <sys/resource.h>
+#include <endian.h>
+#include <limits.h>
+
+#endif
diff --git a/musl-include/x86_64/sys/personality.h b/musl-include/x86_64/sys/personality.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/personality.h
@@ -0,0 +1,49 @@
+#ifndef _PERSONALITY_H
+#define _PERSONALITY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UNAME26            0x0020000
+#define ADDR_NO_RANDOMIZE  0x0040000
+#define FDPIC_FUNCPTRS     0x0080000
+#define MMAP_PAGE_ZERO     0x0100000
+#define ADDR_COMPAT_LAYOUT 0x0200000
+#define READ_IMPLIES_EXEC  0x0400000
+#define ADDR_LIMIT_32BIT   0x0800000
+#define SHORT_INODE        0x1000000
+#define WHOLE_SECONDS      0x2000000
+#define STICKY_TIMEOUTS    0x4000000
+#define ADDR_LIMIT_3GB     0x8000000
+
+#define PER_LINUX 0
+#define PER_LINUX_32BIT ADDR_LIMIT_32BIT
+#define PER_LINUX_FDPIC FDPIC_FUNCPTRS
+#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE)
+#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS)
+#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_ISCR4 (5 | STICKY_TIMEOUTS)
+#define PER_BSD 6
+#define PER_SUNOS (6 | STICKY_TIMEOUTS)
+#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_LINUX32 8
+#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB)
+#define PER_IRIX32 (9 | STICKY_TIMEOUTS)
+#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS)
+#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS)
+#define PER_RISCOS 0xc
+#define PER_SOLARIS (0xd | STICKY_TIMEOUTS)
+#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_OSF4 0xf
+#define PER_HPUX 0x10
+#define PER_MASK 0xff
+
+int personality(unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/poll.h b/musl-include/x86_64/sys/poll.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/poll.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
+#include <poll.h>
diff --git a/musl-include/x86_64/sys/prctl.h b/musl-include/x86_64/sys/prctl.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/prctl.h
@@ -0,0 +1,186 @@
+#ifndef _SYS_PRCTL_H
+#define _SYS_PRCTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define PR_SET_PDEATHSIG  1
+#define PR_GET_PDEATHSIG  2
+#define PR_GET_DUMPABLE   3
+#define PR_SET_DUMPABLE   4
+#define PR_GET_UNALIGN   5
+#define PR_SET_UNALIGN   6
+#define PR_UNALIGN_NOPRINT 1
+#define PR_UNALIGN_SIGBUS 2
+#define PR_GET_KEEPCAPS   7
+#define PR_SET_KEEPCAPS   8
+#define PR_GET_FPEMU  9
+#define PR_SET_FPEMU 10
+#define PR_FPEMU_NOPRINT 1
+#define PR_FPEMU_SIGFPE 2
+#define PR_GET_FPEXC 11
+#define PR_SET_FPEXC 12
+#define PR_FP_EXC_SW_ENABLE 0x80
+#define PR_FP_EXC_DIV  0x010000
+#define PR_FP_EXC_OVF  0x020000
+#define PR_FP_EXC_UND  0x040000
+#define PR_FP_EXC_RES  0x080000
+#define PR_FP_EXC_INV  0x100000
+#define PR_FP_EXC_DISABLED 0
+#define PR_FP_EXC_NONRECOV 1
+#define PR_FP_EXC_ASYNC 2
+#define PR_FP_EXC_PRECISE 3
+#define PR_GET_TIMING   13
+#define PR_SET_TIMING   14
+#define PR_TIMING_STATISTICAL  0
+#define PR_TIMING_TIMESTAMP    1
+#define PR_SET_NAME    15
+#define PR_GET_NAME    16
+#define PR_GET_ENDIAN 19
+#define PR_SET_ENDIAN 20
+#define PR_ENDIAN_BIG 0
+#define PR_ENDIAN_LITTLE 1
+#define PR_ENDIAN_PPC_LITTLE 2
+#define PR_GET_SECCOMP 21
+#define PR_SET_SECCOMP 22
+#define PR_CAPBSET_READ 23
+#define PR_CAPBSET_DROP 24
+#define PR_GET_TSC 25
+#define PR_SET_TSC 26
+#define PR_TSC_ENABLE 1
+#define PR_TSC_SIGSEGV 2
+#define PR_GET_SECUREBITS 27
+#define PR_SET_SECUREBITS 28
+#define PR_SET_TIMERSLACK 29
+#define PR_GET_TIMERSLACK 30
+
+#define PR_TASK_PERF_EVENTS_DISABLE             31
+#define PR_TASK_PERF_EVENTS_ENABLE              32
+
+#define PR_MCE_KILL     33
+#define PR_MCE_KILL_CLEAR   0
+#define PR_MCE_KILL_SET     1
+#define PR_MCE_KILL_LATE    0
+#define PR_MCE_KILL_EARLY   1
+#define PR_MCE_KILL_DEFAULT 2
+#define PR_MCE_KILL_GET 34
+
+#define PR_SET_MM               35
+#define PR_SET_MM_START_CODE           1
+#define PR_SET_MM_END_CODE             2
+#define PR_SET_MM_START_DATA           3
+#define PR_SET_MM_END_DATA             4
+#define PR_SET_MM_START_STACK          5
+#define PR_SET_MM_START_BRK            6
+#define PR_SET_MM_BRK                  7
+#define PR_SET_MM_ARG_START            8
+#define PR_SET_MM_ARG_END              9
+#define PR_SET_MM_ENV_START            10
+#define PR_SET_MM_ENV_END              11
+#define PR_SET_MM_AUXV                 12
+#define PR_SET_MM_EXE_FILE             13
+#define PR_SET_MM_MAP                  14
+#define PR_SET_MM_MAP_SIZE             15
+
+struct prctl_mm_map {
+	uint64_t start_code;
+	uint64_t end_code;
+	uint64_t start_data;
+	uint64_t end_data;
+	uint64_t start_brk;
+	uint64_t brk;
+	uint64_t start_stack;
+	uint64_t arg_start;
+	uint64_t arg_end;
+	uint64_t env_start;
+	uint64_t env_end;
+	uint64_t *auxv;
+	uint32_t auxv_size;
+	uint32_t exe_fd;
+};
+
+#define PR_SET_PTRACER 0x59616d61
+#define PR_SET_PTRACER_ANY (-1UL)
+
+#define PR_SET_CHILD_SUBREAPER  36
+#define PR_GET_CHILD_SUBREAPER  37
+
+#define PR_SET_NO_NEW_PRIVS     38
+#define PR_GET_NO_NEW_PRIVS     39
+
+#define PR_GET_TID_ADDRESS      40
+
+#define PR_SET_THP_DISABLE      41
+#define PR_GET_THP_DISABLE      42
+
+#define PR_MPX_ENABLE_MANAGEMENT  43
+#define PR_MPX_DISABLE_MANAGEMENT 44
+
+#define PR_SET_FP_MODE          45
+#define PR_GET_FP_MODE          46
+#define PR_FP_MODE_FR (1 << 0)
+#define PR_FP_MODE_FRE (1 << 1)
+
+#define PR_CAP_AMBIENT          47
+#define PR_CAP_AMBIENT_IS_SET   1
+#define PR_CAP_AMBIENT_RAISE    2
+#define PR_CAP_AMBIENT_LOWER    3
+#define PR_CAP_AMBIENT_CLEAR_ALL 4
+
+#define PR_SVE_SET_VL           50
+#define PR_SVE_SET_VL_ONEXEC (1 << 18)
+#define PR_SVE_GET_VL           51
+#define PR_SVE_VL_LEN_MASK 0xffff
+#define PR_SVE_VL_INHERIT (1 << 17)
+
+#define PR_GET_SPECULATION_CTRL 52
+#define PR_SET_SPECULATION_CTRL 53
+#define PR_SPEC_STORE_BYPASS 0
+#define PR_SPEC_INDIRECT_BRANCH 1
+#define PR_SPEC_NOT_AFFECTED 0
+#define PR_SPEC_PRCTL (1UL << 0)
+#define PR_SPEC_ENABLE (1UL << 1)
+#define PR_SPEC_DISABLE (1UL << 2)
+#define PR_SPEC_FORCE_DISABLE (1UL << 3)
+#define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
+
+#define PR_PAC_RESET_KEYS       54
+#define PR_PAC_APIAKEY (1UL << 0)
+#define PR_PAC_APIBKEY (1UL << 1)
+#define PR_PAC_APDAKEY (1UL << 2)
+#define PR_PAC_APDBKEY (1UL << 3)
+#define PR_PAC_APGAKEY (1UL << 4)
+
+#define PR_SET_TAGGED_ADDR_CTRL 55
+#define PR_GET_TAGGED_ADDR_CTRL 56
+#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
+#define PR_MTE_TCF_SHIFT 1
+#define PR_MTE_TCF_NONE  (0UL << 1)
+#define PR_MTE_TCF_SYNC  (1UL << 1)
+#define PR_MTE_TCF_ASYNC (2UL << 1)
+#define PR_MTE_TCF_MASK  (3UL << 1)
+#define PR_MTE_TAG_SHIFT 3
+#define PR_MTE_TAG_MASK  (0xffffUL << 3)
+
+#define PR_SET_IO_FLUSHER 57
+#define PR_GET_IO_FLUSHER 58
+
+#define PR_SET_SYSCALL_USER_DISPATCH 59
+#define PR_SYS_DISPATCH_OFF 0
+#define PR_SYS_DISPATCH_ON 1
+#define SYSCALL_DISPATCH_FILTER_ALLOW 0
+#define SYSCALL_DISPATCH_FILTER_BLOCK 1
+
+#define PR_PAC_SET_ENABLED_KEYS 60
+#define PR_PAC_GET_ENABLED_KEYS 61
+
+int prctl (int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/procfs.h b/musl-include/x86_64/sys/procfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/procfs.h
@@ -0,0 +1,63 @@
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+struct elf_siginfo {
+	int si_signo;
+	int si_code;
+	int si_errno;
+};
+
+struct elf_prstatus {
+	struct elf_siginfo pr_info;
+	short int pr_cursig;
+	unsigned long int pr_sigpend;
+	unsigned long int pr_sighold;
+	pid_t pr_pid;
+	pid_t pr_ppid;
+	pid_t pr_pgrp;
+	pid_t pr_sid;
+	struct {
+		long tv_sec, tv_usec;
+	} pr_utime, pr_stime, pr_cutime, pr_cstime;
+	elf_gregset_t pr_reg;
+	int pr_fpvalid;
+};
+
+#define ELF_PRARGSZ 80
+
+struct elf_prpsinfo {
+	char pr_state;
+	char pr_sname;
+	char pr_zomb;
+	char pr_nice;
+	unsigned long int pr_flag;
+#if UINTPTR_MAX == 0xffffffff
+	unsigned short int pr_uid;
+	unsigned short int pr_gid;
+#else
+	unsigned int pr_uid;
+	unsigned int pr_gid;
+#endif
+	int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+	char pr_fname[16];
+	char pr_psargs[ELF_PRARGSZ];
+};
+
+typedef void *psaddr_t;
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+typedef pid_t lwpid_t;
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/ptrace.h b/musl-include/x86_64/sys/ptrace.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/ptrace.h
@@ -0,0 +1,147 @@
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define PTRACE_TRACEME 0
+#define PT_TRACE_ME PTRACE_TRACEME
+
+#define PTRACE_PEEKTEXT 1
+#define PTRACE_PEEKDATA 2
+#define PTRACE_PEEKUSER 3
+#define PTRACE_POKETEXT 4
+#define PTRACE_POKEDATA 5
+#define PTRACE_POKEUSER 6
+#define PTRACE_CONT 7
+#define PTRACE_KILL 8
+#define PTRACE_SINGLESTEP 9
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+#define PTRACE_ATTACH 16
+#define PTRACE_DETACH 17
+#define PTRACE_GETFPXREGS 18
+#define PTRACE_SETFPXREGS 19
+#define PTRACE_SYSCALL 24
+#define PTRACE_SETOPTIONS 0x4200
+#define PTRACE_GETEVENTMSG 0x4201
+#define PTRACE_GETSIGINFO 0x4202
+#define PTRACE_SETSIGINFO 0x4203
+#define PTRACE_GETREGSET 0x4204
+#define PTRACE_SETREGSET 0x4205
+#define PTRACE_SEIZE 0x4206
+#define PTRACE_INTERRUPT 0x4207
+#define PTRACE_LISTEN 0x4208
+#define PTRACE_PEEKSIGINFO 0x4209
+#define PTRACE_GETSIGMASK 0x420a
+#define PTRACE_SETSIGMASK 0x420b
+#define PTRACE_SECCOMP_GET_FILTER 0x420c
+#define PTRACE_SECCOMP_GET_METADATA 0x420d
+#define PTRACE_GET_SYSCALL_INFO 0x420e
+#define PTRACE_GET_RSEQ_CONFIGURATION	0x420f
+
+#define PT_READ_I PTRACE_PEEKTEXT
+#define PT_READ_D PTRACE_PEEKDATA
+#define PT_READ_U PTRACE_PEEKUSER
+#define PT_WRITE_I PTRACE_POKETEXT
+#define PT_WRITE_D PTRACE_POKEDATA
+#define PT_WRITE_U PTRACE_POKEUSER
+#define PT_CONTINUE PTRACE_CONT
+#define PT_KILL PTRACE_KILL
+#define PT_STEP PTRACE_SINGLESTEP
+#define PT_GETREGS PTRACE_GETREGS
+#define PT_SETREGS PTRACE_SETREGS
+#define PT_GETFPREGS PTRACE_GETFPREGS
+#define PT_SETFPREGS PTRACE_SETFPREGS
+#define PT_ATTACH PTRACE_ATTACH
+#define PT_DETACH PTRACE_DETACH
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+#define PT_SYSCALL PTRACE_SYSCALL
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+
+#define PTRACE_O_TRACESYSGOOD   0x00000001
+#define PTRACE_O_TRACEFORK      0x00000002
+#define PTRACE_O_TRACEVFORK     0x00000004
+#define PTRACE_O_TRACECLONE     0x00000008
+#define PTRACE_O_TRACEEXEC      0x00000010
+#define PTRACE_O_TRACEVFORKDONE 0x00000020
+#define PTRACE_O_TRACEEXIT      0x00000040
+#define PTRACE_O_TRACESECCOMP   0x00000080
+#define PTRACE_O_EXITKILL       0x00100000
+#define PTRACE_O_SUSPEND_SECCOMP 0x00200000
+#define PTRACE_O_MASK           0x003000ff
+
+#define PTRACE_EVENT_FORK 1
+#define PTRACE_EVENT_VFORK 2
+#define PTRACE_EVENT_CLONE 3
+#define PTRACE_EVENT_EXEC 4
+#define PTRACE_EVENT_VFORK_DONE 5
+#define PTRACE_EVENT_EXIT 6
+#define PTRACE_EVENT_SECCOMP 7
+#define PTRACE_EVENT_STOP 128
+
+#define PTRACE_PEEKSIGINFO_SHARED 1
+
+#define PTRACE_SYSCALL_INFO_NONE 0
+#define PTRACE_SYSCALL_INFO_ENTRY 1
+#define PTRACE_SYSCALL_INFO_EXIT 2
+#define PTRACE_SYSCALL_INFO_SECCOMP 3
+
+#include <bits/ptrace.h>
+
+struct __ptrace_peeksiginfo_args {
+	uint64_t off;
+	uint32_t flags;
+	int32_t nr;
+};
+
+struct __ptrace_seccomp_metadata {
+	uint64_t filter_off;
+	uint64_t flags;
+};
+
+struct __ptrace_syscall_info {
+	uint8_t op;
+	uint8_t __pad[3];
+	uint32_t arch;
+	uint64_t instruction_pointer;
+	uint64_t stack_pointer;
+	union {
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+		} entry;
+		struct {
+			int64_t rval;
+			uint8_t is_error;
+		} exit;
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+			uint32_t ret_data;
+		} seccomp;
+	};
+};
+
+struct __ptrace_rseq_configuration {
+	uint64_t rseq_abi_pointer;
+	uint32_t rseq_abi_size;
+	uint32_t signature;
+	uint32_t flags;
+	uint32_t pad;
+};
+
+long ptrace(int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/quota.h b/musl-include/x86_64/sys/quota.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/quota.h
@@ -0,0 +1,102 @@
+#ifndef _SYS_QUOTA_H
+#define _SYS_QUOTA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define _LINUX_QUOTA_VERSION 2
+
+#define dbtob(num) ((num) << 10)
+#define btodb(num) ((num) >> 10)
+#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / 1024)
+
+#define MAX_IQ_TIME 604800
+#define MAX_DQ_TIME 604800
+
+#define MAXQUOTAS 2
+#define USRQUOTA  0
+#define GRPQUOTA  1
+
+#define INITQFNAMES { "user", "group", "undefined" };
+
+#define QUOTAFILENAME "quota"
+#define QUOTAGROUP "staff"
+
+#define NR_DQHASH 43
+#define NR_DQUOTS 256
+
+#define SUBCMDMASK       0x00ff
+#define SUBCMDSHIFT      8
+#define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
+
+#define Q_SYNC     0x800001
+#define Q_QUOTAON  0x800002
+#define Q_QUOTAOFF 0x800003
+#define Q_GETFMT   0x800004
+#define Q_GETINFO  0x800005
+#define Q_SETINFO  0x800006
+#define Q_GETQUOTA 0x800007
+#define Q_SETQUOTA 0x800008
+
+#define	QFMT_VFS_OLD 1
+#define	QFMT_VFS_V0 2
+#define QFMT_OCFS2 3
+#define	QFMT_VFS_V1 4
+
+#define QIF_BLIMITS	1
+#define QIF_SPACE	2
+#define QIF_ILIMITS	4
+#define QIF_INODES	8
+#define QIF_BTIME	16
+#define QIF_ITIME	32
+#define QIF_LIMITS	(QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE	(QIF_SPACE | QIF_INODES)
+#define QIF_TIMES	(QIF_BTIME | QIF_ITIME)
+#define QIF_ALL		(QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk {
+	uint64_t dqb_bhardlimit;
+	uint64_t dqb_bsoftlimit;
+	uint64_t dqb_curspace;
+	uint64_t dqb_ihardlimit;
+	uint64_t dqb_isoftlimit;
+	uint64_t dqb_curinodes;
+	uint64_t dqb_btime;
+	uint64_t dqb_itime;
+	uint32_t dqb_valid;
+};
+
+#define	dq_bhardlimit	dq_dqb.dqb_bhardlimit
+#define	dq_bsoftlimit	dq_dqb.dqb_bsoftlimit
+#define dq_curspace	dq_dqb.dqb_curspace
+#define dq_valid	dq_dqb.dqb_valid
+#define	dq_ihardlimit	dq_dqb.dqb_ihardlimit
+#define	dq_isoftlimit	dq_dqb.dqb_isoftlimit
+#define	dq_curinodes	dq_dqb.dqb_curinodes
+#define	dq_btime	dq_dqb.dqb_btime
+#define	dq_itime	dq_dqb.dqb_itime
+
+#define dqoff(UID)      ((long long)(UID) * sizeof (struct dqblk))
+
+#define IIF_BGRACE	1
+#define IIF_IGRACE	2
+#define IIF_FLAGS	4
+#define IIF_ALL		(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo {
+	uint64_t dqi_bgrace;
+	uint64_t dqi_igrace;
+	uint32_t dqi_flags;
+	uint32_t dqi_valid;
+};
+
+int quotactl(int, const char *, int, char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/random.h b/musl-include/x86_64/sys/random.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/random.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_RANDOM_H
+#define _SYS_RANDOM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#include <bits/alltypes.h>
+
+#define GRND_NONBLOCK	0x0001
+#define GRND_RANDOM	0x0002
+#define GRND_INSECURE	0x0004
+
+ssize_t getrandom(void *, size_t, unsigned);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/reboot.h b/musl-include/x86_64/sys/reboot.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/reboot.h
@@ -0,0 +1,20 @@
+#ifndef _SYS_REBOOT_H
+#define _SYS_REBOOT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RB_AUTOBOOT     0x01234567
+#define RB_HALT_SYSTEM  0xcdef0123
+#define RB_ENABLE_CAD   0x89abcdef
+#define RB_DISABLE_CAD  0
+#define RB_POWER_OFF    0x4321fedc
+#define RB_SW_SUSPEND   0xd000fce2
+#define RB_KEXEC        0x45584543
+
+int reboot(int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/reg.h b/musl-include/x86_64/sys/reg.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/reg.h
@@ -0,0 +1,9 @@
+#ifndef _SYS_REG_H
+#define _SYS_REG_H
+
+#include <limits.h>
+#include <unistd.h>
+
+#include <bits/reg.h>
+
+#endif
diff --git a/musl-include/x86_64/sys/resource.h b/musl-include/x86_64/sys/resource.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/resource.h
@@ -0,0 +1,116 @@
+#ifndef	_SYS_RESOURCE_H
+#define	_SYS_RESOURCE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <sys/time.h>
+
+#define __NEED_id_t
+
+#ifdef _GNU_SOURCE
+#define __NEED_pid_t
+#endif
+
+#include <bits/alltypes.h>
+#include <bits/resource.h>
+
+typedef unsigned long long rlim_t;
+
+struct rlimit {
+	rlim_t rlim_cur;
+	rlim_t rlim_max;
+};
+
+struct rusage {
+	struct timeval ru_utime;
+	struct timeval ru_stime;
+	/* linux extentions, but useful */
+	long	ru_maxrss;
+	long	ru_ixrss;
+	long	ru_idrss;
+	long	ru_isrss;
+	long	ru_minflt;
+	long	ru_majflt;
+	long	ru_nswap;
+	long	ru_inblock;
+	long	ru_oublock;
+	long	ru_msgsnd;
+	long	ru_msgrcv;
+	long	ru_nsignals;
+	long	ru_nvcsw;
+	long	ru_nivcsw;
+	/* room for more... */
+	long    __reserved[16];
+};
+
+int getrlimit (int, struct rlimit *);
+int setrlimit (int, const struct rlimit *);
+int getrusage (int, struct rusage *);
+
+int getpriority (int, id_t);
+int setpriority (int, id_t, int);
+
+#ifdef _GNU_SOURCE
+int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
+#define prlimit64 prlimit
+#endif
+
+#define PRIO_MIN (-20)
+#define PRIO_MAX 20
+
+#define PRIO_PROCESS 0
+#define PRIO_PGRP    1
+#define PRIO_USER    2
+
+#define RUSAGE_SELF     0
+#define RUSAGE_CHILDREN (-1)
+#define RUSAGE_THREAD   1
+
+#define RLIM_INFINITY (~0ULL)
+#define RLIM_SAVED_CUR RLIM_INFINITY
+#define RLIM_SAVED_MAX RLIM_INFINITY
+
+#define RLIMIT_CPU     0
+#define RLIMIT_FSIZE   1
+#define RLIMIT_DATA    2
+#define RLIMIT_STACK   3
+#define RLIMIT_CORE    4
+#ifndef RLIMIT_RSS
+#define RLIMIT_RSS     5
+#define RLIMIT_NPROC   6
+#define RLIMIT_NOFILE  7
+#define RLIMIT_MEMLOCK 8
+#define RLIMIT_AS      9
+#endif
+#define RLIMIT_LOCKS   10
+#define RLIMIT_SIGPENDING 11
+#define RLIMIT_MSGQUEUE 12
+#define RLIMIT_NICE    13
+#define RLIMIT_RTPRIO  14
+#define RLIMIT_RTTIME  15
+#define RLIMIT_NLIMITS 16
+
+#define RLIM_NLIMITS RLIMIT_NLIMITS
+
+#if defined(_LARGEFILE64_SOURCE)
+#define RLIM64_INFINITY RLIM_INFINITY
+#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
+#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
+#define getrlimit64 getrlimit
+#define setrlimit64 setrlimit
+#define rlimit64 rlimit
+#define rlim64_t rlim_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(getrusage, __getrusage_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/select.h b/musl-include/x86_64/sys/select.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/select.h
@@ -0,0 +1,46 @@
+#ifndef _SYS_SELECT_H
+#define _SYS_SELECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_struct_timeval
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define FD_SETSIZE 1024
+
+typedef unsigned long fd_mask;
+
+typedef struct {
+	unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)];
+} fd_set;
+
+#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0)
+#define FD_SET(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1UL<<((d)%(8*sizeof(long)))))
+#define FD_CLR(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1UL<<((d)%(8*sizeof(long)))))
+#define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*sizeof(long))] & (1UL<<((d)%(8*sizeof(long)))))
+
+int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict);
+int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define NFDBITS (8*(int)sizeof(long))
+#endif
+
+#if _REDIR_TIME64
+__REDIR(select, __select_time64);
+__REDIR(pselect, __pselect_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/sem.h b/musl-include/x86_64/sys/sem.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/sem.h
@@ -0,0 +1,72 @@
+#ifndef _SYS_SEM_H
+#define _SYS_SEM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_pid_t
+#define __NEED_time_t
+#ifdef _GNU_SOURCE
+#define __NEED_struct_timespec
+#endif
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+
+#define SEM_UNDO	0x1000
+#define GETPID		11
+#define GETVAL		12
+#define GETALL		13
+#define GETNCNT		14
+#define GETZCNT		15
+#define SETVAL		16
+#define SETALL		17
+
+#include <bits/sem.h>
+
+#define _SEM_SEMUN_UNDEFINED 1
+
+#define SEM_STAT (18 | (IPC_STAT & 0x100))
+#define SEM_INFO 19
+#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100))
+
+struct  seminfo {
+	int semmap;
+	int semmni;
+	int semmns;
+	int semmnu;
+	int semmsl;
+	int semopm;
+	int semume;
+	int semusz;
+	int semvmx;
+	int semaem;
+};
+
+struct sembuf {
+	unsigned short sem_num;
+	short sem_op;
+	short sem_flg;
+};
+
+int semctl(int, int, int, ...);
+int semget(key_t, int, int);
+int semop(int, struct sembuf *, size_t);
+
+#ifdef _GNU_SOURCE
+int semtimedop(int, struct sembuf *, size_t, const struct timespec *);
+#endif
+
+#if _REDIR_TIME64
+#ifdef _GNU_SOURCE
+__REDIR(semtimedop, __semtimedop_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/sendfile.h b/musl-include/x86_64/sys/sendfile.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/sendfile.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_SENDFILE_H
+#define _SYS_SENDFILE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+#include <unistd.h>
+
+ssize_t sendfile(int, int, off_t *, size_t);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define sendfile64 sendfile
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/shm.h b/musl-include/x86_64/sys/shm.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/shm.h
@@ -0,0 +1,70 @@
+#ifndef _SYS_SHM_H
+#define _SYS_SHM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_pid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+
+#ifdef _GNU_SOURCE
+#define __used_ids used_ids
+#define __swap_attempts swap_attempts
+#define __swap_successes swap_successes
+#endif
+
+#include <bits/shm.h>
+
+#define SHM_R 0400
+#define SHM_W 0200
+
+#define SHM_RDONLY 010000
+#define SHM_RND    020000
+#define SHM_REMAP  040000
+#define SHM_EXEC   0100000
+
+#define SHM_LOCK 11
+#define SHM_UNLOCK 12
+#define SHM_STAT (13 | (IPC_STAT & 0x100))
+#define SHM_INFO 14
+#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100))
+#define SHM_DEST 01000
+#define SHM_LOCKED 02000
+#define SHM_HUGETLB 04000
+#define SHM_NORESERVE 010000
+
+#define SHM_HUGE_SHIFT 26
+#define SHM_HUGE_MASK  0x3f
+#define SHM_HUGE_64KB  (16 << 26)
+#define SHM_HUGE_512KB (19 << 26)
+#define SHM_HUGE_1MB   (20 << 26)
+#define SHM_HUGE_2MB   (21 << 26)
+#define SHM_HUGE_8MB   (23 << 26)
+#define SHM_HUGE_16MB  (24 << 26)
+#define SHM_HUGE_32MB  (25 << 26)
+#define SHM_HUGE_256MB (28 << 26)
+#define SHM_HUGE_512MB (29 << 26)
+#define SHM_HUGE_1GB   (30 << 26)
+#define SHM_HUGE_2GB   (31 << 26)
+#define SHM_HUGE_16GB  (34U << 26)
+
+typedef unsigned long shmatt_t;
+
+void *shmat(int, const void *, int);
+int shmctl(int, int, struct shmid_ds *);
+int shmdt(const void *);
+int shmget(key_t, size_t, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/signal.h b/musl-include/x86_64/sys/signal.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/signal.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/signal.h> to <signal.h>
+#include <signal.h>
diff --git a/musl-include/x86_64/sys/signalfd.h b/musl-include/x86_64/sys/signalfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/signalfd.h
@@ -0,0 +1,49 @@
+#ifndef _SYS_SIGNALFD_H
+#define _SYS_SIGNALFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <fcntl.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define SFD_CLOEXEC O_CLOEXEC
+#define SFD_NONBLOCK O_NONBLOCK
+
+int signalfd(int, const sigset_t *, int);
+
+struct signalfd_siginfo {
+	uint32_t  ssi_signo;
+	int32_t   ssi_errno;
+	int32_t   ssi_code;
+	uint32_t  ssi_pid;
+	uint32_t  ssi_uid;
+	int32_t   ssi_fd;
+	uint32_t  ssi_tid;
+	uint32_t  ssi_band;
+	uint32_t  ssi_overrun;
+	uint32_t  ssi_trapno;
+	int32_t   ssi_status;
+	int32_t   ssi_int;
+	uint64_t  ssi_ptr;
+	uint64_t  ssi_utime;
+	uint64_t  ssi_stime;
+	uint64_t  ssi_addr;
+	uint16_t  ssi_addr_lsb;
+	uint16_t  __pad2;
+	int32_t   ssi_syscall;
+	uint64_t  ssi_call_addr;
+	uint32_t  ssi_arch;
+	uint8_t   __pad[128-14*4-5*8-2*2];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/socket.h b/musl-include/x86_64/sys/socket.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/socket.h
@@ -0,0 +1,415 @@
+#ifndef	_SYS_SOCKET_H
+#define	_SYS_SOCKET_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_socklen_t
+#define __NEED_sa_family_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_uid_t
+#define __NEED_pid_t
+#define __NEED_gid_t
+#define __NEED_struct_iovec
+
+#include <bits/alltypes.h>
+
+#include <bits/socket.h>
+
+struct msghdr {
+	void *msg_name;
+	socklen_t msg_namelen;
+	struct iovec *msg_iov;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad1;
+#endif
+	int msg_iovlen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad1;
+#endif
+	void *msg_control;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad2;
+#endif
+	socklen_t msg_controllen;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad2;
+#endif
+	int msg_flags;
+};
+
+struct cmsghdr {
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __BIG_ENDIAN
+	int __pad1;
+#endif
+	socklen_t cmsg_len;
+#if __LONG_MAX > 0x7fffffff && __BYTE_ORDER == __LITTLE_ENDIAN
+	int __pad1;
+#endif
+	int cmsg_level;
+	int cmsg_type;
+};
+
+#ifdef _GNU_SOURCE
+struct ucred {
+	pid_t pid;
+	uid_t uid;
+	gid_t gid;
+};
+
+struct mmsghdr {
+	struct msghdr msg_hdr;
+	unsigned int  msg_len;
+};
+
+struct timespec;
+
+int sendmmsg (int, struct mmsghdr *, unsigned int, unsigned int);
+int recvmmsg (int, struct mmsghdr *, unsigned int, unsigned int, struct timespec *);
+#endif
+
+struct linger {
+	int l_onoff;
+	int l_linger;
+};
+
+#define SHUT_RD 0
+#define SHUT_WR 1
+#define SHUT_RDWR 2
+
+#ifndef SOCK_STREAM
+#define SOCK_STREAM    1
+#define SOCK_DGRAM     2
+#endif
+
+#define SOCK_RAW       3
+#define SOCK_RDM       4
+#define SOCK_SEQPACKET 5
+#define SOCK_DCCP      6
+#define SOCK_PACKET    10
+
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC   02000000
+#define SOCK_NONBLOCK  04000
+#endif
+
+#define PF_UNSPEC       0
+#define PF_LOCAL        1
+#define PF_UNIX         PF_LOCAL
+#define PF_FILE         PF_LOCAL
+#define PF_INET         2
+#define PF_AX25         3
+#define PF_IPX          4
+#define PF_APPLETALK    5
+#define PF_NETROM       6
+#define PF_BRIDGE       7
+#define PF_ATMPVC       8
+#define PF_X25          9
+#define PF_INET6        10
+#define PF_ROSE         11
+#define PF_DECnet       12
+#define PF_NETBEUI      13
+#define PF_SECURITY     14
+#define PF_KEY          15
+#define PF_NETLINK      16
+#define PF_ROUTE        PF_NETLINK
+#define PF_PACKET       17
+#define PF_ASH          18
+#define PF_ECONET       19
+#define PF_ATMSVC       20
+#define PF_RDS          21
+#define PF_SNA          22
+#define PF_IRDA         23
+#define PF_PPPOX        24
+#define PF_WANPIPE      25
+#define PF_LLC          26
+#define PF_IB           27
+#define PF_MPLS         28
+#define PF_CAN          29
+#define PF_TIPC         30
+#define PF_BLUETOOTH    31
+#define PF_IUCV         32
+#define PF_RXRPC        33
+#define PF_ISDN         34
+#define PF_PHONET       35
+#define PF_IEEE802154   36
+#define PF_CAIF         37
+#define PF_ALG          38
+#define PF_NFC          39
+#define PF_VSOCK        40
+#define PF_KCM          41
+#define PF_QIPCRTR      42
+#define PF_SMC          43
+#define PF_XDP          44
+#define PF_MAX          45
+
+#define AF_UNSPEC       PF_UNSPEC
+#define AF_LOCAL        PF_LOCAL
+#define AF_UNIX         AF_LOCAL
+#define AF_FILE         AF_LOCAL
+#define AF_INET         PF_INET
+#define AF_AX25         PF_AX25
+#define AF_IPX          PF_IPX
+#define AF_APPLETALK    PF_APPLETALK
+#define AF_NETROM       PF_NETROM
+#define AF_BRIDGE       PF_BRIDGE
+#define AF_ATMPVC       PF_ATMPVC
+#define AF_X25          PF_X25
+#define AF_INET6        PF_INET6
+#define AF_ROSE         PF_ROSE
+#define AF_DECnet       PF_DECnet
+#define AF_NETBEUI      PF_NETBEUI
+#define AF_SECURITY     PF_SECURITY
+#define AF_KEY          PF_KEY
+#define AF_NETLINK      PF_NETLINK
+#define AF_ROUTE        PF_ROUTE
+#define AF_PACKET       PF_PACKET
+#define AF_ASH          PF_ASH
+#define AF_ECONET       PF_ECONET
+#define AF_ATMSVC       PF_ATMSVC
+#define AF_RDS          PF_RDS
+#define AF_SNA          PF_SNA
+#define AF_IRDA         PF_IRDA
+#define AF_PPPOX        PF_PPPOX
+#define AF_WANPIPE      PF_WANPIPE
+#define AF_LLC          PF_LLC
+#define AF_IB           PF_IB
+#define AF_MPLS         PF_MPLS
+#define AF_CAN          PF_CAN
+#define AF_TIPC         PF_TIPC
+#define AF_BLUETOOTH    PF_BLUETOOTH
+#define AF_IUCV         PF_IUCV
+#define AF_RXRPC        PF_RXRPC
+#define AF_ISDN         PF_ISDN
+#define AF_PHONET       PF_PHONET
+#define AF_IEEE802154   PF_IEEE802154
+#define AF_CAIF         PF_CAIF
+#define AF_ALG          PF_ALG
+#define AF_NFC          PF_NFC
+#define AF_VSOCK        PF_VSOCK
+#define AF_KCM          PF_KCM
+#define AF_QIPCRTR      PF_QIPCRTR
+#define AF_SMC          PF_SMC
+#define AF_XDP          PF_XDP
+#define AF_MAX          PF_MAX
+
+#ifndef SO_DEBUG
+#define SO_DEBUG        1
+#define SO_REUSEADDR    2
+#define SO_TYPE         3
+#define SO_ERROR        4
+#define SO_DONTROUTE    5
+#define SO_BROADCAST    6
+#define SO_SNDBUF       7
+#define SO_RCVBUF       8
+#define SO_KEEPALIVE    9
+#define SO_OOBINLINE    10
+#define SO_NO_CHECK     11
+#define SO_PRIORITY     12
+#define SO_LINGER       13
+#define SO_BSDCOMPAT    14
+#define SO_REUSEPORT    15
+#define SO_PASSCRED     16
+#define SO_PEERCRED     17
+#define SO_RCVLOWAT     18
+#define SO_SNDLOWAT     19
+#define SO_ACCEPTCONN   30
+#define SO_PEERSEC      31
+#define SO_SNDBUFFORCE  32
+#define SO_RCVBUFFORCE  33
+#define SO_PROTOCOL     38
+#define SO_DOMAIN       39
+#endif
+
+#ifndef SO_RCVTIMEO
+#if __LONG_MAX == 0x7fffffff
+#define SO_RCVTIMEO     66
+#define SO_SNDTIMEO     67
+#else
+#define SO_RCVTIMEO     20
+#define SO_SNDTIMEO     21
+#endif
+#endif
+
+#ifndef SO_TIMESTAMP
+#if __LONG_MAX == 0x7fffffff
+#define SO_TIMESTAMP    63
+#define SO_TIMESTAMPNS  64
+#define SO_TIMESTAMPING 65
+#else
+#define SO_TIMESTAMP    29
+#define SO_TIMESTAMPNS  35
+#define SO_TIMESTAMPING 37
+#endif
+#endif
+
+#define SO_SECURITY_AUTHENTICATION              22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT        23
+#define SO_SECURITY_ENCRYPTION_NETWORK          24
+
+#define SO_BINDTODEVICE 25
+
+#define SO_ATTACH_FILTER        26
+#define SO_DETACH_FILTER        27
+#define SO_GET_FILTER           SO_ATTACH_FILTER
+
+#define SO_PEERNAME             28
+#define SCM_TIMESTAMP           SO_TIMESTAMP
+#define SO_PASSSEC              34
+#define SCM_TIMESTAMPNS         SO_TIMESTAMPNS
+#define SO_MARK                 36
+#define SCM_TIMESTAMPING        SO_TIMESTAMPING
+#define SO_RXQ_OVFL             40
+#define SO_WIFI_STATUS          41
+#define SCM_WIFI_STATUS         SO_WIFI_STATUS
+#define SO_PEEK_OFF             42
+#define SO_NOFCS                43
+#define SO_LOCK_FILTER          44
+#define SO_SELECT_ERR_QUEUE     45
+#define SO_BUSY_POLL            46
+#define SO_MAX_PACING_RATE      47
+#define SO_BPF_EXTENSIONS       48
+#define SO_INCOMING_CPU         49
+#define SO_ATTACH_BPF           50
+#define SO_DETACH_BPF           SO_DETACH_FILTER
+#define SO_ATTACH_REUSEPORT_CBPF 51
+#define SO_ATTACH_REUSEPORT_EBPF 52
+#define SO_CNX_ADVICE           53
+#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO              55
+#define SO_INCOMING_NAPI_ID     56
+#define SO_COOKIE               57
+#define SCM_TIMESTAMPING_PKTINFO 58
+#define SO_PEERGROUPS           59
+#define SO_ZEROCOPY             60
+#define SO_TXTIME               61
+#define SCM_TXTIME              SO_TXTIME
+#define SO_BINDTOIFINDEX        62
+#define SO_DETACH_REUSEPORT_BPF 68
+#define SO_PREFER_BUSY_POLL     69
+#define SO_BUSY_POLL_BUDGET     70
+
+#ifndef SOL_SOCKET
+#define SOL_SOCKET      1
+#endif
+
+#define SOL_IP          0
+#define SOL_IPV6        41
+#define SOL_ICMPV6      58
+
+#define SOL_RAW         255
+#define SOL_DECNET      261
+#define SOL_X25         262
+#define SOL_PACKET      263
+#define SOL_ATM         264
+#define SOL_AAL         265
+#define SOL_IRDA        266
+#define SOL_NETBEUI     267
+#define SOL_LLC         268
+#define SOL_DCCP        269
+#define SOL_NETLINK     270
+#define SOL_TIPC        271
+#define SOL_RXRPC       272
+#define SOL_PPPOL2TP    273
+#define SOL_BLUETOOTH   274
+#define SOL_PNPIPE      275
+#define SOL_RDS         276
+#define SOL_IUCV        277
+#define SOL_CAIF        278
+#define SOL_ALG         279
+#define SOL_NFC         280
+#define SOL_KCM         281
+#define SOL_TLS         282
+#define SOL_XDP         283
+
+#define SOMAXCONN       128
+
+#define MSG_OOB       0x0001
+#define MSG_PEEK      0x0002
+#define MSG_DONTROUTE 0x0004
+#define MSG_CTRUNC    0x0008
+#define MSG_PROXY     0x0010
+#define MSG_TRUNC     0x0020
+#define MSG_DONTWAIT  0x0040
+#define MSG_EOR       0x0080
+#define MSG_WAITALL   0x0100
+#define MSG_FIN       0x0200
+#define MSG_SYN       0x0400
+#define MSG_CONFIRM   0x0800
+#define MSG_RST       0x1000
+#define MSG_ERRQUEUE  0x2000
+#define MSG_NOSIGNAL  0x4000
+#define MSG_MORE      0x8000
+#define MSG_WAITFORONE 0x10000
+#define MSG_BATCH     0x40000
+#define MSG_ZEROCOPY  0x4000000
+#define MSG_FASTOPEN  0x20000000
+#define MSG_CMSG_CLOEXEC 0x40000000
+
+#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1))
+#define __CMSG_NEXT(cmsg) ((unsigned char *)(cmsg) + __CMSG_LEN(cmsg))
+#define __MHDR_END(mhdr) ((unsigned char *)(mhdr)->msg_control + (mhdr)->msg_controllen)
+
+#define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1))
+#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) || \
+	__CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
+	? 0 : (struct cmsghdr *)__CMSG_NEXT(cmsg))
+#define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
+
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+#define SCM_RIGHTS      0x01
+#define SCM_CREDENTIALS 0x02
+
+struct sockaddr {
+	sa_family_t sa_family;
+	char sa_data[14];
+};
+
+struct sockaddr_storage {
+	sa_family_t ss_family;
+	char __ss_padding[128-sizeof(long)-sizeof(sa_family_t)];
+	unsigned long __ss_align;
+};
+
+int socket (int, int, int);
+int socketpair (int, int, int, int [2]);
+
+int shutdown (int, int);
+
+int bind (int, const struct sockaddr *, socklen_t);
+int connect (int, const struct sockaddr *, socklen_t);
+int listen (int, int);
+int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
+int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
+
+int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
+int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);
+
+ssize_t send (int, const void *, size_t, int);
+ssize_t recv (int, void *, size_t, int);
+ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
+ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
+ssize_t sendmsg (int, const struct msghdr *, int);
+ssize_t recvmsg (int, struct msghdr *, int);
+
+int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
+int setsockopt (int, int, int, const void *, socklen_t);
+
+int sockatmark (int);
+
+#if _REDIR_TIME64
+#ifdef _GNU_SOURCE
+__REDIR(recvmmsg, __recvmmsg_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/soundcard.h b/musl-include/x86_64/sys/soundcard.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/soundcard.h
@@ -0,0 +1,1 @@
+#include <bits/soundcard.h>
diff --git a/musl-include/x86_64/sys/stat.h b/musl-include/x86_64/sys/stat.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/stat.h
@@ -0,0 +1,182 @@
+#ifndef	_SYS_STAT_H
+#define	_SYS_STAT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_dev_t
+#define __NEED_ino_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_off_t
+#define __NEED_time_t
+#define __NEED_blksize_t
+#define __NEED_blkcnt_t
+#define __NEED_struct_timespec
+
+#ifdef _GNU_SOURCE
+#define __NEED_int64_t
+#define __NEED_uint64_t
+#define __NEED_uint32_t
+#define __NEED_uint16_t
+#endif
+
+#include <bits/alltypes.h>
+
+#include <bits/stat.h>
+
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+
+#define S_IFMT  0170000
+
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFBLK 0060000
+#define S_IFREG 0100000
+#define S_IFIFO 0010000
+#define S_IFLNK 0120000
+#define S_IFSOCK 0140000
+
+#define S_TYPEISMQ(buf)  0
+#define S_TYPEISSEM(buf) 0
+#define S_TYPEISSHM(buf) 0
+#define S_TYPEISTMO(buf) 0
+
+#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK)
+#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
+#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
+#define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK)
+#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+
+#ifndef S_IRUSR
+#define S_ISUID 04000
+#define S_ISGID 02000
+#define S_ISVTX 01000
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXU 0700
+#define S_IRGRP 0040
+#define S_IWGRP 0020
+#define S_IXGRP 0010
+#define S_IRWXG 0070
+#define S_IROTH 0004
+#define S_IWOTH 0002
+#define S_IXOTH 0001
+#define S_IRWXO 0007
+#endif
+
+#define UTIME_NOW  0x3fffffff
+#define UTIME_OMIT 0x3ffffffe
+
+int stat(const char *__restrict, struct stat *__restrict);
+int fstat(int, struct stat *);
+int lstat(const char *__restrict, struct stat *__restrict);
+int fstatat(int, const char *__restrict, struct stat *__restrict, int);
+int chmod(const char *, mode_t);
+int fchmod(int, mode_t);
+int fchmodat(int, const char *, mode_t, int);
+mode_t umask(mode_t);
+int mkdir(const char *, mode_t);
+int mkfifo(const char *, mode_t);
+int mkdirat(int, const char *, mode_t);
+int mkfifoat(int, const char *, mode_t);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int mknod(const char *, mode_t, dev_t);
+int mknodat(int, const char *, mode_t, dev_t);
+#endif
+
+int futimens(int, const struct timespec [2]);
+int utimensat(int, const char *, const struct timespec [2], int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int lchmod(const char *, mode_t);
+#define S_IREAD S_IRUSR
+#define S_IWRITE S_IWUSR
+#define S_IEXEC S_IXUSR
+#endif
+
+#if defined(_GNU_SOURCE)
+#define STATX_TYPE 1U
+#define STATX_MODE 2U
+#define STATX_NLINK 4U
+#define STATX_UID 8U
+#define STATX_GID 0x10U
+#define STATX_ATIME 0x20U
+#define STATX_MTIME 0x40U
+#define STATX_CTIME 0x80U
+#define STATX_INO 0x100U
+#define STATX_SIZE 0x200U
+#define STATX_BLOCKS 0x400U
+#define STATX_BASIC_STATS 0x7ffU
+#define STATX_BTIME 0x800U
+#define STATX_ALL 0xfffU
+
+struct statx_timestamp {
+	int64_t tv_sec;
+	uint32_t tv_nsec, __pad;
+};
+
+struct statx {
+	uint32_t stx_mask;
+	uint32_t stx_blksize;
+	uint64_t stx_attributes;
+	uint32_t stx_nlink;
+	uint32_t stx_uid;
+	uint32_t stx_gid;
+	uint16_t stx_mode;
+	uint16_t __pad0[1];
+	uint64_t stx_ino;
+	uint64_t stx_size;
+	uint64_t stx_blocks;
+	uint64_t stx_attributes_mask;
+	struct statx_timestamp stx_atime;
+	struct statx_timestamp stx_btime;
+	struct statx_timestamp stx_ctime;
+	struct statx_timestamp stx_mtime;
+	uint32_t stx_rdev_major;
+	uint32_t stx_rdev_minor;
+	uint32_t stx_dev_major;
+	uint32_t stx_dev_minor;
+	uint64_t __pad1[14];
+};
+
+int statx(int, const char *__restrict, int, unsigned, struct statx *__restrict);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define stat64 stat
+#define fstat64 fstat
+#define lstat64 lstat
+#define fstatat64 fstatat
+#define blkcnt64_t blkcnt_t
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#define ino64_t ino_t
+#define off64_t off_t
+#endif
+
+#if _REDIR_TIME64
+__REDIR(stat, __stat_time64);
+__REDIR(fstat, __fstat_time64);
+__REDIR(lstat, __lstat_time64);
+__REDIR(fstatat, __fstatat_time64);
+__REDIR(futimens, __futimens_time64);
+__REDIR(utimensat, __utimensat_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
diff --git a/musl-include/x86_64/sys/statfs.h b/musl-include/x86_64/sys/statfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/statfs.h
@@ -0,0 +1,32 @@
+#ifndef	_SYS_STATFS_H
+#define	_SYS_STATFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <sys/statvfs.h>
+
+typedef struct __fsid_t {
+	int __val[2];
+} fsid_t;
+
+#include <bits/statfs.h>
+
+int statfs (const char *, struct statfs *);
+int fstatfs (int, struct statfs *);
+
+#if defined(_LARGEFILE64_SOURCE)
+#define statfs64 statfs
+#define fstatfs64 fstatfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/statvfs.h b/musl-include/x86_64/sys/statvfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/statvfs.h
@@ -0,0 +1,57 @@
+#ifndef	_SYS_STATVFS_H
+#define	_SYS_STATVFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+#include <bits/alltypes.h>
+
+struct statvfs {
+	unsigned long f_bsize, f_frsize;
+	fsblkcnt_t f_blocks, f_bfree, f_bavail;
+	fsfilcnt_t f_files, f_ffree, f_favail;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned long f_fsid;
+	unsigned :8*(2*sizeof(int)-sizeof(long));
+#else
+	unsigned :8*(2*sizeof(int)-sizeof(long));
+	unsigned long f_fsid;
+#endif
+	unsigned long f_flag, f_namemax;
+	unsigned int f_type;
+	int __reserved[5];
+};
+
+int statvfs (const char *__restrict, struct statvfs *__restrict);
+int fstatvfs (int, struct statvfs *);
+
+#define ST_RDONLY 1
+#define ST_NOSUID 2
+#define ST_NODEV  4
+#define ST_NOEXEC 8
+#define ST_SYNCHRONOUS 16
+#define ST_MANDLOCK    64
+#define ST_WRITE       128
+#define ST_APPEND      256
+#define ST_IMMUTABLE   512
+#define ST_NOATIME     1024
+#define ST_NODIRATIME  2048
+#define ST_RELATIME    4096
+
+#if defined(_LARGEFILE64_SOURCE)
+#define statvfs64 statvfs
+#define fstatvfs64 fstatvfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/stropts.h b/musl-include/x86_64/sys/stropts.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/stropts.h
@@ -0,0 +1,1 @@
+#include <stropts.h>
diff --git a/musl-include/x86_64/sys/swap.h b/musl-include/x86_64/sys/swap.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/swap.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_SWAP_H
+#define _SYS_SWAP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define	SWAP_FLAG_PREFER        0x8000
+#define	SWAP_FLAG_PRIO_MASK     0x7fff
+#define	SWAP_FLAG_PRIO_SHIFT    0
+#define SWAP_FLAG_DISCARD       0x10000
+
+int swapon (const char *, int);
+int swapoff (const char *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/syscall.h b/musl-include/x86_64/sys/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/syscall.h
@@ -0,0 +1,6 @@
+#ifndef _SYS_SYSCALL_H
+#define _SYS_SYSCALL_H
+
+#include <bits/syscall.h>
+
+#endif
diff --git a/musl-include/x86_64/sys/sysinfo.h b/musl-include/x86_64/sys/sysinfo.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/sysinfo.h
@@ -0,0 +1,36 @@
+#ifndef _SYS_SYSINFO_H
+#define _SYS_SYSINFO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SI_LOAD_SHIFT 16
+
+struct sysinfo {
+	unsigned long uptime;
+	unsigned long loads[3];
+	unsigned long totalram;
+	unsigned long freeram;
+	unsigned long sharedram;
+	unsigned long bufferram;
+	unsigned long totalswap;
+	unsigned long freeswap;
+	unsigned short procs, pad;
+	unsigned long totalhigh;
+	unsigned long freehigh;
+	unsigned mem_unit;
+	char __reserved[256];
+};
+
+int sysinfo (struct sysinfo *);
+int get_nprocs_conf (void);
+int get_nprocs (void);
+long get_phys_pages (void);
+long get_avphys_pages (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/syslog.h b/musl-include/x86_64/sys/syslog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/syslog.h
@@ -0,0 +1,1 @@
+#include <syslog.h>
diff --git a/musl-include/x86_64/sys/sysmacros.h b/musl-include/x86_64/sys/sysmacros.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/sysmacros.h
@@ -0,0 +1,15 @@
+#ifndef _SYS_SYSMACROS_H
+#define _SYS_SYSMACROS_H
+
+#define major(x) \
+	((unsigned)( (((x)>>31>>1) & 0xfffff000) | (((x)>>8) & 0x00000fff) ))
+#define minor(x) \
+	((unsigned)( (((x)>>12) & 0xffffff00) | ((x) & 0x000000ff) ))
+
+#define makedev(x,y) ( \
+        (((x)&0xfffff000ULL) << 32) | \
+	(((x)&0x00000fffULL) << 8) | \
+        (((y)&0xffffff00ULL) << 12) | \
+	(((y)&0x000000ffULL)) )
+
+#endif
diff --git a/musl-include/x86_64/sys/termios.h b/musl-include/x86_64/sys/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/termios.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <sys/termios.h> to <termios.h>
+#include <termios.h>
diff --git a/musl-include/x86_64/sys/time.h b/musl-include/x86_64/sys/time.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/time.h
@@ -0,0 +1,76 @@
+#ifndef _SYS_TIME_H
+#define _SYS_TIME_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <sys/select.h>
+
+int gettimeofday (struct timeval *__restrict, void *__restrict);
+
+#define ITIMER_REAL    0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF    2
+
+struct itimerval {
+	struct timeval it_interval;
+	struct timeval it_value;
+};
+
+int getitimer (int, struct itimerval *);
+int setitimer (int, const struct itimerval *__restrict, struct itimerval *__restrict);
+int utimes (const char *, const struct timeval [2]);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+struct timezone {
+	int tz_minuteswest;
+	int tz_dsttime;
+};
+int futimes(int, const struct timeval [2]);
+int futimesat(int, const char *, const struct timeval [2]);
+int lutimes(const char *, const struct timeval [2]);
+int settimeofday(const struct timeval *, const struct timezone *);
+int adjtime (const struct timeval *, struct timeval *);
+#define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
+#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
+#define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
+	(s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
+#define timeradd(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
+	((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
+	((a)->tv_usec -= 1000000, (a)->tv_sec++) )
+#define timersub(s,t,a) (void) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
+	((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
+	((a)->tv_usec += 1000000, (a)->tv_sec--) )
+#endif
+
+#if defined(_GNU_SOURCE)
+#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \
+	(ts)->tv_sec = (tv)->tv_sec, \
+	(ts)->tv_nsec = (tv)->tv_usec * 1000, \
+	(void)0 )
+#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \
+	(tv)->tv_sec = (ts)->tv_sec, \
+	(tv)->tv_usec = (ts)->tv_nsec / 1000, \
+	(void)0 )
+#endif
+
+#if _REDIR_TIME64
+__REDIR(gettimeofday, __gettimeofday_time64);
+__REDIR(getitimer, __getitimer_time64);
+__REDIR(setitimer, __setitimer_time64);
+__REDIR(utimes, __utimes_time64);
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(futimes, __futimes_time64);
+__REDIR(futimesat, __futimesat_time64);
+__REDIR(lutimes, __lutimes_time64);
+__REDIR(settimeofday, __settimeofday_time64);
+__REDIR(adjtime, __adjtime64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/timeb.h b/musl-include/x86_64/sys/timeb.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/timeb.h
@@ -0,0 +1,28 @@
+#ifndef _SYS_TIMEB_H
+#define _SYS_TIMEB_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+
+#include <bits/alltypes.h>
+
+struct timeb {
+	time_t time;
+	unsigned short millitm;
+	short timezone, dstflag;
+};
+
+int ftime(struct timeb *);
+
+#if _REDIR_TIME64
+__REDIR(ftime, __ftime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/timerfd.h b/musl-include/x86_64/sys/timerfd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/timerfd.h
@@ -0,0 +1,32 @@
+#ifndef _SYS_TIMERFD_H
+#define _SYS_TIMERFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <time.h>
+#include <fcntl.h>
+
+#define TFD_NONBLOCK O_NONBLOCK
+#define TFD_CLOEXEC O_CLOEXEC
+
+#define TFD_TIMER_ABSTIME 1
+#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
+
+struct itimerspec;
+
+int timerfd_create(int, int);
+int timerfd_settime(int, int, const struct itimerspec *, struct itimerspec *);
+int timerfd_gettime(int, struct itimerspec *);
+
+#if _REDIR_TIME64
+__REDIR(timerfd_settime, __timerfd_settime64);
+__REDIR(timerfd_gettime, __timerfd_gettime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/times.h b/musl-include/x86_64/sys/times.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/times.h
@@ -0,0 +1,25 @@
+#ifndef	_SYS_TIMES_H
+#define	_SYS_TIMES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clock_t
+#include <bits/alltypes.h>
+
+struct tms {
+	clock_t tms_utime;
+	clock_t tms_stime;
+	clock_t tms_cutime;
+	clock_t tms_cstime;
+};
+
+clock_t times (struct tms *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/musl-include/x86_64/sys/timex.h b/musl-include/x86_64/sys/timex.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/timex.h
@@ -0,0 +1,103 @@
+#ifndef _SYS_TIMEX_H
+#define _SYS_TIMEX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_clockid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/time.h>
+
+struct ntptimeval {
+	struct timeval time;
+	long maxerror, esterror;
+};
+
+struct timex {
+	unsigned modes;
+	long offset, freq, maxerror, esterror;
+	int status;
+	long constant, precision, tolerance;
+	struct timeval time;
+	long tick, ppsfreq, jitter;
+	int shift;
+	long stabil, jitcnt, calcnt, errcnt, stbcnt;
+	int tai;
+	int __padding[11];
+};
+
+#define ADJ_OFFSET		0x0001
+#define ADJ_FREQUENCY		0x0002
+#define ADJ_MAXERROR		0x0004
+#define ADJ_ESTERROR		0x0008
+#define ADJ_STATUS		0x0010
+#define ADJ_TIMECONST		0x0020
+#define ADJ_TAI			0x0080
+#define ADJ_SETOFFSET		0x0100
+#define ADJ_MICRO		0x1000
+#define ADJ_NANO		0x2000
+#define ADJ_TICK		0x4000
+#define ADJ_OFFSET_SINGLESHOT	0x8001
+#define ADJ_OFFSET_SS_READ	0xa001
+
+#define MOD_OFFSET	ADJ_OFFSET
+#define MOD_FREQUENCY	ADJ_FREQUENCY
+#define MOD_MAXERROR	ADJ_MAXERROR
+#define MOD_ESTERROR	ADJ_ESTERROR
+#define MOD_STATUS	ADJ_STATUS
+#define MOD_TIMECONST	ADJ_TIMECONST
+#define MOD_CLKB	ADJ_TICK
+#define MOD_CLKA	ADJ_OFFSET_SINGLESHOT
+#define MOD_TAI		ADJ_TAI
+#define MOD_MICRO	ADJ_MICRO
+#define MOD_NANO	ADJ_NANO
+
+#define STA_PLL		0x0001
+#define STA_PPSFREQ	0x0002
+#define STA_PPSTIME	0x0004
+#define STA_FLL		0x0008
+
+#define STA_INS		0x0010
+#define STA_DEL		0x0020
+#define STA_UNSYNC	0x0040
+#define STA_FREQHOLD	0x0080
+
+#define STA_PPSSIGNAL	0x0100
+#define STA_PPSJITTER	0x0200
+#define STA_PPSWANDER	0x0400
+#define STA_PPSERROR	0x0800
+
+#define STA_CLOCKERR	0x1000
+#define STA_NANO	0x2000
+#define STA_MODE	0x4000
+#define STA_CLK		0x8000
+
+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
+    STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
+
+#define TIME_OK		0
+#define TIME_INS	1
+#define TIME_DEL	2
+#define TIME_OOP	3
+#define TIME_WAIT	4
+#define TIME_ERROR	5
+#define TIME_BAD	TIME_ERROR
+
+#define MAXTC		6
+
+int adjtimex(struct timex *);
+int clock_adjtime(clockid_t, struct timex *);
+
+#if _REDIR_TIME64
+__REDIR(adjtimex, __adjtimex_time64);
+__REDIR(clock_adjtime, __clock_adjtime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/ttydefaults.h b/musl-include/x86_64/sys/ttydefaults.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/ttydefaults.h
@@ -0,0 +1,34 @@
+#ifndef _SYS_TTYDEFAULTS_H
+#define _SYS_TTYDEFAULTS_H
+
+#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
+#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
+#define TTYDEF_SPEED (B9600)
+#define CTRL(x) ((x)&037)
+#define CEOF CTRL('d')
+
+#define CEOL '\0'
+#define CSTATUS '\0'
+
+#define CERASE 0177
+#define CINTR CTRL('c')
+#define CKILL CTRL('u')
+#define CMIN 1
+#define CQUIT 034
+#define CSUSP CTRL('z')
+#define CTIME 0
+#define CDSUSP CTRL('y')
+#define CSTART CTRL('q')
+#define CSTOP CTRL('s')
+#define CLNEXT CTRL('v')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
+#define CEOT CEOF
+#define CBRK CEOL
+#define CRPRNT CREPRINT
+#define CFLUSH CDISCARD
+
+#endif
diff --git a/musl-include/x86_64/sys/types.h b/musl-include/x86_64/sys/types.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/types.h
@@ -0,0 +1,85 @@
+#ifndef	_SYS_TYPES_H
+#define	_SYS_TYPES_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_ino_t
+#define __NEED_dev_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_time_t
+#define __NEED_timer_t
+#define __NEED_clockid_t
+
+#define __NEED_blkcnt_t
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+
+#define __NEED_id_t
+#define __NEED_key_t
+#define __NEED_clock_t
+#define __NEED_suseconds_t
+#define __NEED_blksize_t
+
+#define __NEED_pthread_t
+#define __NEED_pthread_attr_t
+#define __NEED_pthread_mutexattr_t
+#define __NEED_pthread_condattr_t
+#define __NEED_pthread_rwlockattr_t
+#define __NEED_pthread_barrierattr_t
+#define __NEED_pthread_mutex_t
+#define __NEED_pthread_cond_t
+#define __NEED_pthread_rwlock_t
+#define __NEED_pthread_barrier_t
+#define __NEED_pthread_spinlock_t
+#define __NEED_pthread_key_t
+#define __NEED_pthread_once_t
+#define __NEED_useconds_t
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+#define __NEED_u_int64_t
+#define __NEED_register_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+typedef unsigned char u_int8_t;
+typedef unsigned short u_int16_t;
+typedef unsigned u_int32_t;
+typedef char *caddr_t;
+typedef unsigned char u_char;
+typedef unsigned short u_short, ushort;
+typedef unsigned u_int, uint;
+typedef unsigned long u_long, ulong;
+typedef long long quad_t;
+typedef unsigned long long u_quad_t;
+#include <endian.h>
+#include <sys/select.h>
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define blkcnt64_t blkcnt_t
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#define ino64_t ino_t
+#define off64_t off_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/ucontext.h b/musl-include/x86_64/sys/ucontext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/ucontext.h
@@ -0,0 +1,1 @@
+#include <ucontext.h>
diff --git a/musl-include/x86_64/sys/uio.h b/musl-include/x86_64/sys/uio.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/uio.h
@@ -0,0 +1,55 @@
+#ifndef _SYS_UIO_H
+#define _SYS_UIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_struct_iovec
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_off_t
+#endif
+
+#ifdef _GNU_SOURCE
+#define __NEED_pid_t
+#endif
+
+#include <bits/alltypes.h>
+
+#define UIO_MAXIOV 1024
+
+ssize_t readv (int, const struct iovec *, int);
+ssize_t writev (int, const struct iovec *, int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+ssize_t preadv (int, const struct iovec *, int, off_t);
+ssize_t pwritev (int, const struct iovec *, int, off_t);
+#if defined(_LARGEFILE64_SOURCE)
+#define preadv64 preadv
+#define pwritev64 pwritev
+#define off64_t off_t
+#endif
+#endif
+
+#ifdef _GNU_SOURCE
+ssize_t process_vm_writev(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
+ssize_t process_vm_readv(pid_t, const struct iovec *, unsigned long, const struct iovec *, unsigned long, unsigned long);
+ssize_t preadv2 (int, const struct iovec *, int, off_t, int);
+ssize_t pwritev2 (int, const struct iovec *, int, off_t, int);
+#define RWF_HIPRI 0x00000001
+#define RWF_DSYNC 0x00000002
+#define RWF_SYNC 0x00000004
+#define RWF_NOWAIT 0x00000008
+#define RWF_APPEND 0x00000010
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/un.h b/musl-include/x86_64/sys/un.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/un.h
@@ -0,0 +1,31 @@
+#ifndef	_SYS_UN_H
+#define	_SYS_UN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_sa_family_t
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_size_t
+#endif
+
+#include <bits/alltypes.h>
+
+struct sockaddr_un {
+	sa_family_t sun_family;
+	char sun_path[108];
+};
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+size_t strlen(const char *);
+#define SUN_LEN(s) (2+strlen((s)->sun_path))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/user.h b/musl-include/x86_64/sys/user.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/user.h
@@ -0,0 +1,16 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <limits.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include <bits/user.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/utsname.h b/musl-include/x86_64/sys/utsname.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/utsname.h
@@ -0,0 +1,29 @@
+#ifndef	_SYS_UTSNAME_H
+#define	_SYS_UTSNAME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+struct utsname {
+	char sysname[65];
+	char nodename[65];
+	char release[65];
+	char version[65];
+	char machine[65];
+#ifdef _GNU_SOURCE
+	char domainname[65];
+#else
+	char __domainname[65];
+#endif
+};
+
+int uname (struct utsname *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/sys/vfs.h b/musl-include/x86_64/sys/vfs.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/vfs.h
@@ -0,0 +1,1 @@
+#include <sys/statfs.h>
diff --git a/musl-include/x86_64/sys/vt.h b/musl-include/x86_64/sys/vt.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/vt.h
@@ -0,0 +1,1 @@
+#include <bits/vt.h>
diff --git a/musl-include/x86_64/sys/wait.h b/musl-include/x86_64/sys/wait.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/wait.h
@@ -0,0 +1,67 @@
+#ifndef	_SYS_WAIT_H
+#define	_SYS_WAIT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_id_t
+#include <bits/alltypes.h>
+
+typedef enum {
+	P_ALL = 0,
+	P_PID = 1,
+	P_PGID = 2,
+	P_PIDFD = 3
+} idtype_t;
+
+pid_t wait (int *);
+pid_t waitpid (pid_t, int *, int );
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#include <signal.h>
+int waitid (idtype_t, id_t, siginfo_t *, int);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#include <sys/resource.h>
+pid_t wait3 (int *, int, struct rusage *);
+pid_t wait4 (pid_t, int *, int, struct rusage *);
+#endif
+
+#define WNOHANG    1
+#define WUNTRACED  2
+
+#define WSTOPPED   2
+#define WEXITED    4
+#define WCONTINUED 8
+#define WNOWAIT    0x1000000
+
+#define __WNOTHREAD 0x20000000
+#define __WALL      0x40000000
+#define __WCLONE    0x80000000
+
+#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
+#define WTERMSIG(s) ((s) & 0x7f)
+#define WSTOPSIG(s) WEXITSTATUS(s)
+#define WCOREDUMP(s) ((s) & 0x80)
+#define WIFEXITED(s) (!WTERMSIG(s))
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001U)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
+#define WIFCONTINUED(s) ((s) == 0xffff)
+
+#if _REDIR_TIME64
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(wait3, __wait3_time64);
+__REDIR(wait4, __wait4_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/sys/xattr.h b/musl-include/x86_64/sys/xattr.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sys/xattr.h
@@ -0,0 +1,32 @@
+#ifndef	_SYS_XATTR_H
+#define	_SYS_XATTR_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_ssize_t
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+#define XATTR_CREATE 1
+#define XATTR_REPLACE 2
+
+ssize_t getxattr(const char *, const char *, void *, size_t);
+ssize_t lgetxattr(const char *, const char *, void *, size_t);
+ssize_t fgetxattr(int, const char *, void *, size_t);
+ssize_t listxattr(const char *, char *, size_t);
+ssize_t llistxattr(const char *, char *, size_t);
+ssize_t flistxattr(int, char *, size_t);
+int setxattr(const char *, const char *, const void *, size_t, int);
+int lsetxattr(const char *, const char *, const void *, size_t, int);
+int fsetxattr(int, const char *, const void *, size_t, int);
+int removexattr(const char *, const char *);
+int lremovexattr(const char *, const char *);
+int fremovexattr(int, const char *);
+
+#define __UAPI_DEF_XATTR        0
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/syscall.h b/musl-include/x86_64/syscall.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/syscall.h
@@ -0,0 +1,1 @@
+#include <sys/syscall.h>
diff --git a/musl-include/x86_64/sysexits.h b/musl-include/x86_64/sysexits.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/sysexits.h
@@ -0,0 +1,21 @@
+#ifndef	_SYSEXITS_H
+#define _SYSEXITS_H
+#define EX_OK 0
+#define EX__BASE 64
+#define EX_USAGE 64
+#define EX_DATAERR 65
+#define EX_NOINPUT 66
+#define EX_NOUSER 67
+#define EX_NOHOST 68
+#define EX_UNAVAILABLE 69
+#define EX_SOFTWARE 70
+#define EX_OSERR 71
+#define EX_OSFILE 72
+#define EX_CANTCREAT 73
+#define EX_IOERR 74
+#define EX_TEMPFAIL 75
+#define EX_PROTOCOL 76
+#define EX_NOPERM 77
+#define EX_CONFIG 78
+#define EX__MAX 78
+#endif
diff --git a/musl-include/x86_64/syslog.h b/musl-include/x86_64/syslog.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/syslog.h
@@ -0,0 +1,100 @@
+#ifndef _SYSLOG_H
+#define _SYSLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define LOG_EMERG   0
+#define LOG_ALERT   1
+#define LOG_CRIT    2
+#define LOG_ERR     3
+#define LOG_WARNING 4
+#define LOG_NOTICE  5
+#define LOG_INFO    6
+#define LOG_DEBUG   7
+
+#define LOG_PRIMASK 7
+#define LOG_PRI(p) ((p)&LOG_PRIMASK)
+#define	LOG_MAKEPRI(f, p) (((f)<<3)|(p))
+
+#define LOG_MASK(p) (1<<(p))
+#define LOG_UPTO(p) ((1<<((p)+1))-1)
+
+#define LOG_KERN     (0<<3)
+#define LOG_USER     (1<<3)
+#define LOG_MAIL     (2<<3)
+#define LOG_DAEMON   (3<<3)
+#define LOG_AUTH     (4<<3)
+#define LOG_SYSLOG   (5<<3)
+#define LOG_LPR      (6<<3)
+#define LOG_NEWS     (7<<3)
+#define LOG_UUCP     (8<<3)
+#define LOG_CRON     (9<<3)
+#define	LOG_AUTHPRIV (10<<3)
+#define	LOG_FTP      (11<<3)
+
+#define LOG_LOCAL0   (16<<3)
+#define LOG_LOCAL1   (17<<3)
+#define LOG_LOCAL2   (18<<3)
+#define LOG_LOCAL3   (19<<3)
+#define LOG_LOCAL4   (20<<3)
+#define LOG_LOCAL5   (21<<3)
+#define LOG_LOCAL6   (22<<3)
+#define LOG_LOCAL7   (23<<3)
+
+#define LOG_NFACILITIES 24
+#define LOG_FACMASK 0x3f8
+#define LOG_FAC(p) (((p)&LOG_FACMASK)>>3)
+
+#define LOG_PID    0x01
+#define LOG_CONS   0x02
+#define LOG_ODELAY 0x04
+#define LOG_NDELAY 0x08
+#define LOG_NOWAIT 0x10
+#define LOG_PERROR 0x20
+
+void closelog (void);
+void openlog (const char *, int, int);
+int setlogmask (int);
+void syslog (int, const char *, ...);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define _PATH_LOG "/dev/log"
+#define __NEED_va_list
+#include <bits/alltypes.h>
+void vsyslog (int, const char *, va_list);
+#if defined(SYSLOG_NAMES)
+#define	INTERNAL_NOPRI 0x10
+#define	INTERNAL_MARK (LOG_NFACILITIES<<3)
+typedef struct {
+	char *c_name;
+	int c_val;
+} CODE;
+#define prioritynames ((CODE *)(const CODE []){ \
+	{ "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, \
+	{ "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, \
+	{ "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, \
+	{ "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, \
+	{ "warn", LOG_WARNING }, { "warning", LOG_WARNING }, { 0, -1 } })
+#define facilitynames ((CODE *)(const CODE []){ \
+	{ "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, \
+	{ "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, \
+	{ "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, \
+	{ "mark", INTERNAL_MARK }, { "news", LOG_NEWS }, \
+	{ "security", LOG_AUTH }, { "syslog", LOG_SYSLOG }, \
+	{ "user", LOG_USER }, { "uucp", LOG_UUCP }, \
+	{ "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, \
+	{ "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, \
+	{ "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, \
+	{ "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { 0, -1 } })
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/tar.h b/musl-include/x86_64/tar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/tar.h
@@ -0,0 +1,33 @@
+#ifndef	_TAR_H
+#define	_TAR_H
+
+#define TSUID   04000
+#define TSGID   02000
+#define TSVTX   01000
+#define TUREAD  00400
+#define TUWRITE 00200
+#define TUEXEC  00100
+#define TGREAD  00040
+#define TGWRITE 00020
+#define TGEXEC  00010
+#define TOREAD  00004
+#define TOWRITE 00002
+#define TOEXEC  00001
+
+#define REGTYPE  '0'
+#define AREGTYPE '\0'
+#define LNKTYPE  '1'
+#define SYMTYPE  '2'
+#define CHRTYPE  '3'
+#define BLKTYPE  '4'
+#define DIRTYPE  '5'
+#define FIFOTYPE '6'
+#define CONTTYPE '7'
+
+#define TMAGIC "ustar"
+#define TMAGLEN 6
+
+#define TVERSION "00"
+#define TVERSLEN 2
+
+#endif
diff --git a/musl-include/x86_64/termios.h b/musl-include/x86_64/termios.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/termios.h
@@ -0,0 +1,50 @@
+#ifndef	_TERMIOS_H
+#define	_TERMIOS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_struct_winsize
+
+#include <bits/alltypes.h>
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 32
+
+#include <bits/termios.h>
+
+speed_t cfgetospeed (const struct termios *);
+speed_t cfgetispeed (const struct termios *);
+int cfsetospeed (struct termios *, speed_t);
+int cfsetispeed (struct termios *, speed_t);
+
+int tcgetattr (int, struct termios *);
+int tcsetattr (int, int, const struct termios *);
+
+int tcgetwinsize (int, struct winsize *);
+int tcsetwinsize (int, const struct winsize *);
+
+int tcsendbreak (int, int);
+int tcdrain (int);
+int tcflush (int, int);
+int tcflow (int, int);
+
+pid_t tcgetsid (int);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+void cfmakeraw(struct termios *);
+int cfsetspeed(struct termios *, speed_t);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/tgmath.h b/musl-include/x86_64/tgmath.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/tgmath.h
@@ -0,0 +1,270 @@
+#ifndef _TGMATH_H
+#define _TGMATH_H
+
+/*
+the return types are only correct with gcc (__GNUC__)
+otherwise they are long double or long double complex
+
+the long double version of a function is never chosen when
+sizeof(double) == sizeof(long double)
+(but the return type is set correctly with gcc)
+*/
+
+#include <math.h>
+#include <complex.h>
+
+#define __IS_FP(x) (sizeof((x)+1ULL) == sizeof((x)+1.0f))
+#define __IS_CX(x) (__IS_FP(x) && sizeof(x) == sizeof((x)+I))
+#define __IS_REAL(x) (__IS_FP(x) && 2*sizeof(x) == sizeof((x)+I))
+
+#define __FLT(x) (__IS_REAL(x) && sizeof(x) == sizeof(float))
+#define __LDBL(x) (__IS_REAL(x) && sizeof(x) == sizeof(long double) && sizeof(long double) != sizeof(double))
+
+#define __FLTCX(x) (__IS_CX(x) && sizeof(x) == sizeof(float complex))
+#define __DBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(double complex))
+#define __LDBLCX(x) (__IS_CX(x) && sizeof(x) == sizeof(long double complex) && sizeof(long double) != sizeof(double))
+
+/* return type */
+
+#ifdef __GNUC__
+/*
+the result must be casted to the right type
+(otherwise the result type is determined by the conversion
+rules applied to all the function return types so it is long
+double or long double complex except for integral functions)
+
+this cannot be done in c99, so the typeof gcc extension is
+used and that the type of ?: depends on wether an operand is
+a null pointer constant or not
+(in c11 _Generic can be used)
+
+the c arguments below must be integer constant expressions
+so they can be in null pointer constants
+(__IS_FP above was carefully chosen this way)
+*/
+/* if c then t else void */
+#define __type1(c,t) __typeof__(*(0?(t*)0:(void*)!(c)))
+/* if c then t1 else t2 */
+#define __type2(c,t1,t2) __typeof__(*(0?(__type1(c,t1)*)0:(__type1(!(c),t2)*)0))
+/* cast to double when x is integral, otherwise use typeof(x) */
+#define __RETCAST(x) ( \
+	__type2(__IS_FP(x), __typeof__(x), double))
+/* 2 args case, should work for complex types (cpow) */
+#define __RETCAST_2(x, y) ( \
+	__type2(__IS_FP(x) && __IS_FP(y), \
+		__typeof__((x)+(y)), \
+		__typeof__((x)+(y)+1.0)))
+/* 3 args case (fma only) */
+#define __RETCAST_3(x, y, z) ( \
+	__type2(__IS_FP(x) && __IS_FP(y) && __IS_FP(z), \
+		__typeof__((x)+(y)+(z)), \
+		__typeof__((x)+(y)+(z)+1.0)))
+/* drop complex from the type of x */
+/* TODO: wrong when sizeof(long double)==sizeof(double) */
+#define __RETCAST_REAL(x) (  \
+	__type2(__IS_FP(x) && sizeof((x)+I) == sizeof(float complex), float, \
+	__type2(sizeof((x)+1.0+I) == sizeof(double complex), double, \
+		long double)))
+/* add complex to the type of x */
+#define __RETCAST_CX(x) (__typeof__(__RETCAST(x)0+I))
+#else
+#define __RETCAST(x)
+#define __RETCAST_2(x, y)
+#define __RETCAST_3(x, y, z)
+#define __RETCAST_REAL(x)
+#define __RETCAST_CX(x)
+#endif
+
+/* function selection */
+
+#define __tg_real_nocast(fun, x) ( \
+	__FLT(x) ? fun ## f (x) : \
+	__LDBL(x) ? fun ## l (x) : \
+	fun(x) )
+
+#define __tg_real(fun, x) (__RETCAST(x)__tg_real_nocast(fun, x))
+
+#define __tg_real_2_1(fun, x, y) (__RETCAST(x)( \
+	__FLT(x) ? fun ## f (x, y) : \
+	__LDBL(x) ? fun ## l (x, y) : \
+	fun(x, y) ))
+
+#define __tg_real_2(fun, x, y) (__RETCAST_2(x, y)( \
+	__FLT(x) && __FLT(y) ? fun ## f (x, y) : \
+	__LDBL((x)+(y)) ? fun ## l (x, y) : \
+	fun(x, y) ))
+
+#define __tg_complex(fun, x) (__RETCAST_CX(x)( \
+	__FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \
+	__LDBLCX((x)+I) ? fun ## l (x) : \
+	fun(x) ))
+
+#define __tg_complex_retreal(fun, x) (__RETCAST_REAL(x)( \
+	__FLTCX((x)+I) && __IS_FP(x) ? fun ## f (x) : \
+	__LDBLCX((x)+I) ? fun ## l (x) : \
+	fun(x) ))
+
+#define __tg_real_complex(fun, x) (__RETCAST(x)( \
+	__FLTCX(x) ? c ## fun ## f (x) : \
+	__DBLCX(x) ? c ## fun (x) : \
+	__LDBLCX(x) ? c ## fun ## l (x) : \
+	__FLT(x) ? fun ## f (x) : \
+	__LDBL(x) ? fun ## l (x) : \
+	fun(x) ))
+
+/* special cases */
+
+#define __tg_real_remquo(x, y, z) (__RETCAST_2(x, y)( \
+	__FLT(x) && __FLT(y) ? remquof(x, y, z) : \
+	__LDBL((x)+(y)) ? remquol(x, y, z) : \
+	remquo(x, y, z) ))
+
+#define __tg_real_fma(x, y, z) (__RETCAST_3(x, y, z)( \
+	__FLT(x) && __FLT(y) && __FLT(z) ? fmaf(x, y, z) : \
+	__LDBL((x)+(y)+(z)) ? fmal(x, y, z) : \
+	fma(x, y, z) ))
+
+#define __tg_real_complex_pow(x, y) (__RETCAST_2(x, y)( \
+	__FLTCX((x)+(y)) && __IS_FP(x) && __IS_FP(y) ? cpowf(x, y) : \
+	__FLTCX((x)+(y)) ? cpow(x, y) : \
+	__DBLCX((x)+(y)) ? cpow(x, y) : \
+	__LDBLCX((x)+(y)) ? cpowl(x, y) : \
+	__FLT(x) && __FLT(y) ? powf(x, y) : \
+	__LDBL((x)+(y)) ? powl(x, y) : \
+	pow(x, y) ))
+
+#define __tg_real_complex_fabs(x) (__RETCAST_REAL(x)( \
+	__FLTCX(x) ? cabsf(x) : \
+	__DBLCX(x) ? cabs(x) : \
+	__LDBLCX(x) ? cabsl(x) : \
+	__FLT(x) ? fabsf(x) : \
+	__LDBL(x) ? fabsl(x) : \
+	fabs(x) ))
+
+/* suppress any macros in math.h or complex.h */
+
+#undef acos
+#undef acosh
+#undef asin
+#undef asinh
+#undef atan
+#undef atan2
+#undef atanh
+#undef carg
+#undef cbrt
+#undef ceil
+#undef cimag
+#undef conj
+#undef copysign
+#undef cos
+#undef cosh
+#undef cproj
+#undef creal
+#undef erf
+#undef erfc
+#undef exp
+#undef exp2
+#undef expm1
+#undef fabs
+#undef fdim
+#undef floor
+#undef fma
+#undef fmax
+#undef fmin
+#undef fmod
+#undef frexp
+#undef hypot
+#undef ilogb
+#undef ldexp
+#undef lgamma
+#undef llrint
+#undef llround
+#undef log
+#undef log10
+#undef log1p
+#undef log2
+#undef logb
+#undef lrint
+#undef lround
+#undef nearbyint
+#undef nextafter
+#undef nexttoward
+#undef pow
+#undef remainder
+#undef remquo
+#undef rint
+#undef round
+#undef scalbln
+#undef scalbn
+#undef sin
+#undef sinh
+#undef sqrt
+#undef tan
+#undef tanh
+#undef tgamma
+#undef trunc
+
+/* tg functions */
+
+#define acos(x)         __tg_real_complex(acos, (x))
+#define acosh(x)        __tg_real_complex(acosh, (x))
+#define asin(x)         __tg_real_complex(asin, (x))
+#define asinh(x)        __tg_real_complex(asinh, (x))
+#define atan(x)         __tg_real_complex(atan, (x))
+#define atan2(x,y)      __tg_real_2(atan2, (x), (y))
+#define atanh(x)        __tg_real_complex(atanh, (x))
+#define carg(x)         __tg_complex_retreal(carg, (x))
+#define cbrt(x)         __tg_real(cbrt, (x))
+#define ceil(x)         __tg_real(ceil, (x))
+#define cimag(x)        __tg_complex_retreal(cimag, (x))
+#define conj(x)         __tg_complex(conj, (x))
+#define copysign(x,y)   __tg_real_2(copysign, (x), (y))
+#define cos(x)          __tg_real_complex(cos, (x))
+#define cosh(x)         __tg_real_complex(cosh, (x))
+#define cproj(x)        __tg_complex(cproj, (x))
+#define creal(x)        __tg_complex_retreal(creal, (x))
+#define erf(x)          __tg_real(erf, (x))
+#define erfc(x)         __tg_real(erfc, (x))
+#define exp(x)          __tg_real_complex(exp, (x))
+#define exp2(x)         __tg_real(exp2, (x))
+#define expm1(x)        __tg_real(expm1, (x))
+#define fabs(x)         __tg_real_complex_fabs(x)
+#define fdim(x,y)       __tg_real_2(fdim, (x), (y))
+#define floor(x)        __tg_real(floor, (x))
+#define fma(x,y,z)      __tg_real_fma((x), (y), (z))
+#define fmax(x,y)       __tg_real_2(fmax, (x), (y))
+#define fmin(x,y)       __tg_real_2(fmin, (x), (y))
+#define fmod(x,y)       __tg_real_2(fmod, (x), (y))
+#define frexp(x,y)      __tg_real_2_1(frexp, (x), (y))
+#define hypot(x,y)      __tg_real_2(hypot, (x), (y))
+#define ilogb(x)        __tg_real_nocast(ilogb, (x))
+#define ldexp(x,y)      __tg_real_2_1(ldexp, (x), (y))
+#define lgamma(x)       __tg_real(lgamma, (x))
+#define llrint(x)       __tg_real_nocast(llrint, (x))
+#define llround(x)      __tg_real_nocast(llround, (x))
+#define log(x)          __tg_real_complex(log, (x))
+#define log10(x)        __tg_real(log10, (x))
+#define log1p(x)        __tg_real(log1p, (x))
+#define log2(x)         __tg_real(log2, (x))
+#define logb(x)         __tg_real(logb, (x))
+#define lrint(x)        __tg_real_nocast(lrint, (x))
+#define lround(x)       __tg_real_nocast(lround, (x))
+#define nearbyint(x)    __tg_real(nearbyint, (x))
+#define nextafter(x,y)  __tg_real_2(nextafter, (x), (y))
+#define nexttoward(x,y) __tg_real_2(nexttoward, (x), (y))
+#define pow(x,y)        __tg_real_complex_pow((x), (y))
+#define remainder(x,y)  __tg_real_2(remainder, (x), (y))
+#define remquo(x,y,z)   __tg_real_remquo((x), (y), (z))
+#define rint(x)         __tg_real(rint, (x))
+#define round(x)        __tg_real(round, (x))
+#define scalbln(x,y)    __tg_real_2_1(scalbln, (x), (y))
+#define scalbn(x,y)     __tg_real_2_1(scalbn, (x), (y))
+#define sin(x)          __tg_real_complex(sin, (x))
+#define sinh(x)         __tg_real_complex(sinh, (x))
+#define sqrt(x)         __tg_real_complex(sqrt, (x))
+#define tan(x)          __tg_real_complex(tan, (x))
+#define tanh(x)         __tg_real_complex(tanh, (x))
+#define tgamma(x)       __tg_real(tgamma, (x))
+#define trunc(x)        __tg_real(trunc, (x))
+
+#endif
diff --git a/musl-include/x86_64/threads.h b/musl-include/x86_64/threads.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/threads.h
@@ -0,0 +1,93 @@
+#ifndef _THREADS_H
+#define _THREADS_H
+
+#include <features.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+typedef unsigned long thrd_t;
+#else
+typedef struct __pthread *thrd_t;
+#define thread_local _Thread_local
+#endif
+
+typedef int once_flag;
+typedef unsigned tss_t;
+typedef int (*thrd_start_t)(void *);
+typedef void (*tss_dtor_t)(void *);
+
+#define __NEED_cnd_t
+#define __NEED_mtx_t
+
+#include <bits/alltypes.h>
+
+#define TSS_DTOR_ITERATIONS 4
+
+enum {
+	thrd_success  = 0,
+	thrd_busy     = 1,
+	thrd_error    = 2,
+	thrd_nomem    = 3,
+	thrd_timedout = 4,
+};
+
+enum {
+	mtx_plain     = 0,
+	mtx_recursive = 1,
+	mtx_timed     = 2,
+};
+
+#define ONCE_FLAG_INIT 0
+
+int thrd_create(thrd_t *, thrd_start_t, void *);
+_Noreturn void thrd_exit(int);
+
+int thrd_detach(thrd_t);
+int thrd_join(thrd_t, int *);
+
+int thrd_sleep(const struct timespec *, struct timespec *);
+void thrd_yield(void);
+
+thrd_t thrd_current(void);
+int thrd_equal(thrd_t, thrd_t);
+#ifndef __cplusplus
+#define thrd_equal(A, B) ((A) == (B))
+#endif
+
+void call_once(once_flag *, void (*)(void));
+
+int mtx_init(mtx_t *, int);
+void mtx_destroy(mtx_t *);
+
+int mtx_lock(mtx_t *);
+int mtx_timedlock(mtx_t *__restrict, const struct timespec *__restrict);
+int mtx_trylock(mtx_t *);
+int mtx_unlock(mtx_t *);
+
+int cnd_init(cnd_t *);
+void cnd_destroy(cnd_t *);
+
+int cnd_broadcast(cnd_t *);
+int cnd_signal(cnd_t *);
+
+int cnd_timedwait(cnd_t *__restrict, mtx_t *__restrict, const struct timespec *__restrict);
+int cnd_wait(cnd_t *, mtx_t *);
+
+int tss_create(tss_t *, tss_dtor_t);
+void tss_delete(tss_t);
+
+int tss_set(tss_t, void *);
+void *tss_get(tss_t);
+
+#if _REDIR_TIME64
+__REDIR(thrd_sleep, __thrd_sleep_time64);
+__REDIR(mtx_timedlock, __mtx_timedlock_time64);
+__REDIR(cnd_timedwait, __cnd_timedwait_time64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/time.h b/musl-include/x86_64/time.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/time.h
@@ -0,0 +1,168 @@
+#ifndef	_TIME_H
+#define _TIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+
+#define __NEED_size_t
+#define __NEED_time_t
+#define __NEED_clock_t
+#define __NEED_struct_timespec
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+#define __NEED_clockid_t
+#define __NEED_timer_t
+#define __NEED_pid_t
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define __tm_gmtoff tm_gmtoff
+#define __tm_zone tm_zone
+#endif
+
+struct tm {
+	int tm_sec;
+	int tm_min;
+	int tm_hour;
+	int tm_mday;
+	int tm_mon;
+	int tm_year;
+	int tm_wday;
+	int tm_yday;
+	int tm_isdst;
+	long __tm_gmtoff;
+	const char *__tm_zone;
+};
+
+clock_t clock (void);
+time_t time (time_t *);
+double difftime (time_t, time_t);
+time_t mktime (struct tm *);
+size_t strftime (char *__restrict, size_t, const char *__restrict, const struct tm *__restrict);
+struct tm *gmtime (const time_t *);
+struct tm *localtime (const time_t *);
+char *asctime (const struct tm *);
+char *ctime (const time_t *);
+int timespec_get(struct timespec *, int);
+
+#define CLOCKS_PER_SEC 1000000L
+
+#define TIME_UTC 1
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+
+size_t strftime_l (char *  __restrict, size_t, const char *  __restrict, const struct tm *  __restrict, locale_t);
+
+struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict);
+struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict);
+char *asctime_r (const struct tm *__restrict, char *__restrict);
+char *ctime_r (const time_t *, char *);
+
+void tzset (void);
+
+struct itimerspec {
+	struct timespec it_interval;
+	struct timespec it_value;
+};
+
+#define CLOCK_REALTIME           0
+#define CLOCK_MONOTONIC          1
+#define CLOCK_PROCESS_CPUTIME_ID 2
+#define CLOCK_THREAD_CPUTIME_ID  3
+#define CLOCK_MONOTONIC_RAW      4
+#define CLOCK_REALTIME_COARSE    5
+#define CLOCK_MONOTONIC_COARSE   6
+#define CLOCK_BOOTTIME           7
+#define CLOCK_REALTIME_ALARM     8
+#define CLOCK_BOOTTIME_ALARM     9
+#define CLOCK_SGI_CYCLE         10
+#define CLOCK_TAI               11
+
+#define TIMER_ABSTIME 1
+
+int nanosleep (const struct timespec *, struct timespec *);
+int clock_getres (clockid_t, struct timespec *);
+int clock_gettime (clockid_t, struct timespec *);
+int clock_settime (clockid_t, const struct timespec *);
+int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *);
+int clock_getcpuclockid (pid_t, clockid_t *);
+
+struct sigevent;
+int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict);
+int timer_delete (timer_t);
+int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict);
+int timer_gettime (timer_t, struct itimerspec *);
+int timer_getoverrun (timer_t);
+
+extern char *tzname[2];
+
+#endif
+
+
+#if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+char *strptime (const char *__restrict, const char *__restrict, struct tm *__restrict);
+extern int daylight;
+extern long timezone;
+extern int getdate_err;
+struct tm *getdate (const char *);
+#endif
+
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int stime(const time_t *);
+time_t timegm(struct tm *);
+#endif
+
+#if _REDIR_TIME64
+__REDIR(time, __time64);
+__REDIR(difftime, __difftime64);
+__REDIR(mktime, __mktime64);
+__REDIR(gmtime, __gmtime64);
+__REDIR(localtime, __localtime64);
+__REDIR(ctime, __ctime64);
+__REDIR(timespec_get, __timespec_get_time64);
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
+ || defined(_BSD_SOURCE)
+__REDIR(gmtime_r, __gmtime64_r);
+__REDIR(localtime_r, __localtime64_r);
+__REDIR(ctime_r, __ctime64_r);
+__REDIR(nanosleep, __nanosleep_time64);
+__REDIR(clock_getres, __clock_getres_time64);
+__REDIR(clock_gettime, __clock_gettime64);
+__REDIR(clock_settime, __clock_settime64);
+__REDIR(clock_nanosleep, __clock_nanosleep_time64);
+__REDIR(timer_settime, __timer_settime64);
+__REDIR(timer_gettime, __timer_gettime64);
+#endif
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+__REDIR(stime, __stime64);
+__REDIR(timegm, __timegm_time64);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/musl-include/x86_64/uchar.h b/musl-include/x86_64/uchar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/uchar.h
@@ -0,0 +1,29 @@
+#ifndef _UCHAR_H
+#define _UCHAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if __cplusplus < 201103L
+typedef unsigned short char16_t;
+typedef unsigned char32_t;
+#endif
+
+#define __NEED_mbstate_t
+#define __NEED_size_t
+
+#include <features.h>
+#include <bits/alltypes.h>
+
+size_t c16rtomb(char *__restrict, char16_t, mbstate_t *__restrict);
+size_t mbrtoc16(char16_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+
+size_t c32rtomb(char *__restrict, char32_t, mbstate_t *__restrict);
+size_t mbrtoc32(char32_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/ucontext.h b/musl-include/x86_64/ucontext.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/ucontext.h
@@ -0,0 +1,25 @@
+#ifndef _UCONTEXT_H
+#define _UCONTEXT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#include <signal.h>
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define NGREG (sizeof(gregset_t)/sizeof(greg_t))
+#endif
+
+struct __ucontext;
+
+int  getcontext(struct __ucontext *);
+void makecontext(struct __ucontext *, void (*)(), int, ...);
+int  setcontext(const struct __ucontext *);
+int  swapcontext(struct __ucontext *, const struct __ucontext *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/musl-include/x86_64/ulimit.h b/musl-include/x86_64/ulimit.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/ulimit.h
@@ -0,0 +1,17 @@
+#ifndef _ULIMIT_H
+#define _ULIMIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UL_GETFSIZE 1
+#define UL_SETFSIZE 2
+
+long ulimit (int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/unistd.h b/musl-include/x86_64/unistd.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/unistd.h
@@ -0,0 +1,479 @@
+#ifndef	_UNISTD_H
+#define	_UNISTD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define STDIN_FILENO  0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+#define SEEK_DATA 3
+#define SEEK_HOLE 4
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_intptr_t
+#define __NEED_useconds_t
+
+#include <bits/alltypes.h>
+
+int pipe(int [2]);
+int pipe2(int [2], int);
+int close(int);
+int posix_close(int, int);
+int dup(int);
+int dup2(int, int);
+int dup3(int, int, int);
+off_t lseek(int, off_t, int);
+int fsync(int);
+int fdatasync(int);
+
+ssize_t read(int, void *, size_t);
+ssize_t write(int, const void *, size_t);
+ssize_t pread(int, void *, size_t, off_t);
+ssize_t pwrite(int, const void *, size_t, off_t);
+
+int chown(const char *, uid_t, gid_t);
+int fchown(int, uid_t, gid_t);
+int lchown(const char *, uid_t, gid_t);
+int fchownat(int, const char *, uid_t, gid_t, int);
+
+int link(const char *, const char *);
+int linkat(int, const char *, int, const char *, int);
+int symlink(const char *, const char *);
+int symlinkat(const char *, int, const char *);
+ssize_t readlink(const char *__restrict, char *__restrict, size_t);
+ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t);
+int unlink(const char *);
+int unlinkat(int, const char *, int);
+int rmdir(const char *);
+int truncate(const char *, off_t);
+int ftruncate(int, off_t);
+
+#define F_OK 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+
+int access(const char *, int);
+int faccessat(int, const char *, int, int);
+
+int chdir(const char *);
+int fchdir(int);
+char *getcwd(char *, size_t);
+
+unsigned alarm(unsigned);
+unsigned sleep(unsigned);
+int pause(void);
+
+pid_t fork(void);
+pid_t _Fork(void);
+int execve(const char *, char *const [], char *const []);
+int execv(const char *, char *const []);
+int execle(const char *, const char *, ...);
+int execl(const char *, const char *, ...);
+int execvp(const char *, char *const []);
+int execlp(const char *, const char *, ...);
+int fexecve(int, char *const [], char *const []);
+_Noreturn void _exit(int);
+
+pid_t getpid(void);
+pid_t getppid(void);
+pid_t getpgrp(void);
+pid_t getpgid(pid_t);
+int setpgid(pid_t, pid_t);
+pid_t setsid(void);
+pid_t getsid(pid_t);
+char *ttyname(int);
+int ttyname_r(int, char *, size_t);
+int isatty(int);
+pid_t tcgetpgrp(int);
+int tcsetpgrp(int, pid_t);
+
+uid_t getuid(void);
+uid_t geteuid(void);
+gid_t getgid(void);
+gid_t getegid(void);
+int getgroups(int, gid_t []);
+int setuid(uid_t);
+int seteuid(uid_t);
+int setgid(gid_t);
+int setegid(gid_t);
+
+char *getlogin(void);
+int getlogin_r(char *, size_t);
+int gethostname(char *, size_t);
+char *ctermid(char *);
+
+int getopt(int, char * const [], const char *);
+extern char *optarg;
+extern int optind, opterr, optopt;
+
+long pathconf(const char *, int);
+long fpathconf(int, int);
+long sysconf(int);
+size_t confstr(int, char *, size_t);
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define F_ULOCK 0
+#define F_LOCK  1
+#define F_TLOCK 2
+#define F_TEST  3
+int setreuid(uid_t, uid_t);
+int setregid(gid_t, gid_t);
+int lockf(int, int, off_t);
+long gethostid(void);
+int nice(int);
+void sync(void);
+pid_t setpgrp(void);
+char *crypt(const char *, const char *);
+void encrypt(char *, int);
+void swab(const void *__restrict, void *__restrict, ssize_t);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) \
+ || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)
+int usleep(unsigned);
+unsigned ualarm(unsigned, unsigned);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define L_SET 0
+#define L_INCR 1
+#define L_XTND 2
+int brk(void *);
+void *sbrk(intptr_t);
+pid_t vfork(void);
+int vhangup(void);
+int chroot(const char *);
+int getpagesize(void);
+int getdtablesize(void);
+int sethostname(const char *, size_t);
+int getdomainname(char *, size_t);
+int setdomainname(const char *, size_t);
+int setgroups(size_t, const gid_t *);
+char *getpass(const char *);
+int daemon(int, int);
+void setusershell(void);
+void endusershell(void);
+char *getusershell(void);
+int acct(const char *);
+long syscall(long, ...);
+int execvpe(const char *, char *const [], char *const []);
+int issetugid(void);
+int getentropy(void *, size_t);
+extern int optreset;
+#endif
+
+#ifdef _GNU_SOURCE
+extern char **environ;
+int setresuid(uid_t, uid_t, uid_t);
+int setresgid(gid_t, gid_t, gid_t);
+int getresuid(uid_t *, uid_t *, uid_t *);
+int getresgid(gid_t *, gid_t *, gid_t *);
+char *get_current_dir_name(void);
+int syncfs(int);
+int euidaccess(const char *, int);
+int eaccess(const char *, int);
+ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
+pid_t gettid(void);
+#endif
+
+#if defined(_LARGEFILE64_SOURCE)
+#define lseek64 lseek
+#define pread64 pread
+#define pwrite64 pwrite
+#define truncate64 truncate
+#define ftruncate64 ftruncate
+#define lockf64 lockf
+#define off64_t off_t
+#endif
+
+#define POSIX_CLOSE_RESTART     0
+
+#define _XOPEN_VERSION          700
+#define _XOPEN_UNIX             1
+#define _XOPEN_ENH_I18N         1
+
+#define _POSIX_VERSION          200809L
+#define _POSIX2_VERSION         _POSIX_VERSION
+
+#define _POSIX_ADVISORY_INFO    _POSIX_VERSION
+#define _POSIX_CHOWN_RESTRICTED 1
+#define _POSIX_IPV6             _POSIX_VERSION
+#define _POSIX_JOB_CONTROL      1
+#define _POSIX_MAPPED_FILES     _POSIX_VERSION
+#define _POSIX_MEMLOCK          _POSIX_VERSION
+#define _POSIX_MEMLOCK_RANGE    _POSIX_VERSION
+#define _POSIX_MEMORY_PROTECTION _POSIX_VERSION
+#define _POSIX_MESSAGE_PASSING  _POSIX_VERSION
+#define _POSIX_FSYNC            _POSIX_VERSION
+#define _POSIX_NO_TRUNC         1
+#define _POSIX_RAW_SOCKETS      _POSIX_VERSION
+#define _POSIX_REALTIME_SIGNALS _POSIX_VERSION
+#define _POSIX_REGEXP           1
+#define _POSIX_SAVED_IDS        1
+#define _POSIX_SHELL            1
+#define _POSIX_SPAWN            _POSIX_VERSION
+#define _POSIX_VDISABLE         0
+
+#define _POSIX_THREADS          _POSIX_VERSION
+#define _POSIX_THREAD_PROCESS_SHARED _POSIX_VERSION
+#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
+#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION
+#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION
+#define _POSIX_THREAD_PRIORITY_SCHEDULING _POSIX_VERSION
+#define _POSIX_THREAD_CPUTIME   _POSIX_VERSION
+#define _POSIX_TIMERS           _POSIX_VERSION
+#define _POSIX_TIMEOUTS         _POSIX_VERSION
+#define _POSIX_MONOTONIC_CLOCK  _POSIX_VERSION
+#define _POSIX_CPUTIME          _POSIX_VERSION
+#define _POSIX_CLOCK_SELECTION  _POSIX_VERSION
+#define _POSIX_BARRIERS         _POSIX_VERSION
+#define _POSIX_SPIN_LOCKS       _POSIX_VERSION
+#define _POSIX_READER_WRITER_LOCKS _POSIX_VERSION
+#define _POSIX_ASYNCHRONOUS_IO  _POSIX_VERSION
+#define _POSIX_SEMAPHORES       _POSIX_VERSION
+#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_VERSION
+
+#define _POSIX2_C_BIND          _POSIX_VERSION
+
+#include <bits/posix.h>
+
+
+
+#define _PC_LINK_MAX	0
+#define _PC_MAX_CANON	1
+#define _PC_MAX_INPUT	2
+#define _PC_NAME_MAX	3
+#define _PC_PATH_MAX	4
+#define _PC_PIPE_BUF	5
+#define _PC_CHOWN_RESTRICTED	6
+#define _PC_NO_TRUNC	7
+#define _PC_VDISABLE	8
+#define _PC_SYNC_IO	9
+#define _PC_ASYNC_IO	10
+#define _PC_PRIO_IO	11
+#define _PC_SOCK_MAXBUF	12
+#define _PC_FILESIZEBITS	13
+#define _PC_REC_INCR_XFER_SIZE	14
+#define _PC_REC_MAX_XFER_SIZE	15
+#define _PC_REC_MIN_XFER_SIZE	16
+#define _PC_REC_XFER_ALIGN	17
+#define _PC_ALLOC_SIZE_MIN	18
+#define _PC_SYMLINK_MAX	19
+#define _PC_2_SYMLINKS	20
+
+#define _SC_ARG_MAX	0
+#define _SC_CHILD_MAX	1
+#define _SC_CLK_TCK	2
+#define _SC_NGROUPS_MAX	3
+#define _SC_OPEN_MAX	4
+#define _SC_STREAM_MAX	5
+#define _SC_TZNAME_MAX	6
+#define _SC_JOB_CONTROL	7
+#define _SC_SAVED_IDS	8
+#define _SC_REALTIME_SIGNALS	9
+#define _SC_PRIORITY_SCHEDULING	10
+#define _SC_TIMERS	11
+#define _SC_ASYNCHRONOUS_IO	12
+#define _SC_PRIORITIZED_IO	13
+#define _SC_SYNCHRONIZED_IO	14
+#define _SC_FSYNC	15
+#define _SC_MAPPED_FILES	16
+#define _SC_MEMLOCK	17
+#define _SC_MEMLOCK_RANGE	18
+#define _SC_MEMORY_PROTECTION	19
+#define _SC_MESSAGE_PASSING	20
+#define _SC_SEMAPHORES	21
+#define _SC_SHARED_MEMORY_OBJECTS	22
+#define _SC_AIO_LISTIO_MAX	23
+#define _SC_AIO_MAX	24
+#define _SC_AIO_PRIO_DELTA_MAX	25
+#define _SC_DELAYTIMER_MAX	26
+#define _SC_MQ_OPEN_MAX	27
+#define _SC_MQ_PRIO_MAX	28
+#define _SC_VERSION	29
+#define _SC_PAGE_SIZE	30
+#define _SC_PAGESIZE	30 /* !! */
+#define _SC_RTSIG_MAX	31
+#define _SC_SEM_NSEMS_MAX	32
+#define _SC_SEM_VALUE_MAX	33
+#define _SC_SIGQUEUE_MAX	34
+#define _SC_TIMER_MAX	35
+#define _SC_BC_BASE_MAX	36
+#define _SC_BC_DIM_MAX	37
+#define _SC_BC_SCALE_MAX	38
+#define _SC_BC_STRING_MAX	39
+#define _SC_COLL_WEIGHTS_MAX	40
+#define _SC_EXPR_NEST_MAX	42
+#define _SC_LINE_MAX	43
+#define _SC_RE_DUP_MAX	44
+#define _SC_2_VERSION	46
+#define _SC_2_C_BIND	47
+#define _SC_2_C_DEV	48
+#define _SC_2_FORT_DEV	49
+#define _SC_2_FORT_RUN	50
+#define _SC_2_SW_DEV	51
+#define _SC_2_LOCALEDEF	52
+#define _SC_UIO_MAXIOV	60 /* !! */
+#define _SC_IOV_MAX	60
+#define _SC_THREADS	67
+#define _SC_THREAD_SAFE_FUNCTIONS	68
+#define _SC_GETGR_R_SIZE_MAX	69
+#define _SC_GETPW_R_SIZE_MAX	70
+#define _SC_LOGIN_NAME_MAX	71
+#define _SC_TTY_NAME_MAX	72
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS	73
+#define _SC_THREAD_KEYS_MAX	74
+#define _SC_THREAD_STACK_MIN	75
+#define _SC_THREAD_THREADS_MAX	76
+#define _SC_THREAD_ATTR_STACKADDR	77
+#define _SC_THREAD_ATTR_STACKSIZE	78
+#define _SC_THREAD_PRIORITY_SCHEDULING	79
+#define _SC_THREAD_PRIO_INHERIT	80
+#define _SC_THREAD_PRIO_PROTECT	81
+#define _SC_THREAD_PROCESS_SHARED	82
+#define _SC_NPROCESSORS_CONF	83
+#define _SC_NPROCESSORS_ONLN	84
+#define _SC_PHYS_PAGES	85
+#define _SC_AVPHYS_PAGES	86
+#define _SC_ATEXIT_MAX	87
+#define _SC_PASS_MAX	88
+#define _SC_XOPEN_VERSION	89
+#define _SC_XOPEN_XCU_VERSION	90
+#define _SC_XOPEN_UNIX	91
+#define _SC_XOPEN_CRYPT	92
+#define _SC_XOPEN_ENH_I18N	93
+#define _SC_XOPEN_SHM	94
+#define _SC_2_CHAR_TERM	95
+#define _SC_2_UPE	97
+#define _SC_XOPEN_XPG2	98
+#define _SC_XOPEN_XPG3	99
+#define _SC_XOPEN_XPG4	100
+#define _SC_NZERO	109
+#define _SC_XBS5_ILP32_OFF32	125
+#define _SC_XBS5_ILP32_OFFBIG	126
+#define _SC_XBS5_LP64_OFF64	127
+#define _SC_XBS5_LPBIG_OFFBIG	128
+#define _SC_XOPEN_LEGACY	129
+#define _SC_XOPEN_REALTIME	130
+#define _SC_XOPEN_REALTIME_THREADS	131
+#define _SC_ADVISORY_INFO	132
+#define _SC_BARRIERS	133
+#define _SC_CLOCK_SELECTION	137
+#define _SC_CPUTIME	138
+#define _SC_THREAD_CPUTIME	139
+#define _SC_MONOTONIC_CLOCK	149
+#define _SC_READER_WRITER_LOCKS	153
+#define _SC_SPIN_LOCKS	154
+#define _SC_REGEXP	155
+#define _SC_SHELL	157
+#define _SC_SPAWN	159
+#define _SC_SPORADIC_SERVER	160
+#define _SC_THREAD_SPORADIC_SERVER	161
+#define _SC_TIMEOUTS	164
+#define _SC_TYPED_MEMORY_OBJECTS	165
+#define _SC_2_PBS	168
+#define _SC_2_PBS_ACCOUNTING	169
+#define _SC_2_PBS_LOCATE	170
+#define _SC_2_PBS_MESSAGE	171
+#define _SC_2_PBS_TRACK	172
+#define _SC_SYMLOOP_MAX	173
+#define _SC_STREAMS	174
+#define _SC_2_PBS_CHECKPOINT	175
+#define _SC_V6_ILP32_OFF32	176
+#define _SC_V6_ILP32_OFFBIG	177
+#define _SC_V6_LP64_OFF64	178
+#define _SC_V6_LPBIG_OFFBIG	179
+#define _SC_HOST_NAME_MAX	180
+#define _SC_TRACE	181
+#define _SC_TRACE_EVENT_FILTER	182
+#define _SC_TRACE_INHERIT	183
+#define _SC_TRACE_LOG	184
+
+#define _SC_IPV6	235
+#define _SC_RAW_SOCKETS	236
+#define _SC_V7_ILP32_OFF32	237
+#define _SC_V7_ILP32_OFFBIG	238
+#define _SC_V7_LP64_OFF64	239
+#define _SC_V7_LPBIG_OFFBIG	240
+#define _SC_SS_REPL_MAX	241
+#define _SC_TRACE_EVENT_NAME_MAX	242
+#define _SC_TRACE_NAME_MAX	243
+#define _SC_TRACE_SYS_MAX	244
+#define _SC_TRACE_USER_EVENT_MAX	245
+#define _SC_XOPEN_STREAMS	246
+#define _SC_THREAD_ROBUST_PRIO_INHERIT	247
+#define _SC_THREAD_ROBUST_PRIO_PROTECT	248
+#define _SC_MINSIGSTKSZ	249
+#define _SC_SIGSTKSZ	250
+
+#define _CS_PATH	0
+#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS	1
+#define _CS_GNU_LIBC_VERSION	2
+#define _CS_GNU_LIBPTHREAD_VERSION	3
+#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS	4
+#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS	5
+
+#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS	1116
+#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS	1117
+#define _CS_POSIX_V6_ILP32_OFF32_LIBS	1118
+#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS	1119
+#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS	1120
+#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS	1121
+#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS	1122
+#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS	1123
+#define _CS_POSIX_V6_LP64_OFF64_CFLAGS	1124
+#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS	1125
+#define _CS_POSIX_V6_LP64_OFF64_LIBS	1126
+#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS	1127
+#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS	1128
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS	1129
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS	1130
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS	1131
+#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS	1132
+#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS	1133
+#define _CS_POSIX_V7_ILP32_OFF32_LIBS	1134
+#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS	1135
+#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS	1136
+#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS	1137
+#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS	1138
+#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS	1139
+#define _CS_POSIX_V7_LP64_OFF64_CFLAGS	1140
+#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS	1141
+#define _CS_POSIX_V7_LP64_OFF64_LIBS	1142
+#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS	1143
+#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS	1144
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS	1145
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS	1146
+#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS	1147
+#define _CS_V6_ENV	1148
+#define _CS_V7_ENV	1149
+#define _CS_POSIX_V7_THREADS_CFLAGS	1150
+#define _CS_POSIX_V7_THREADS_LDFLAGS	1151
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/utime.h b/musl-include/x86_64/utime.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/utime.h
@@ -0,0 +1,29 @@
+#ifndef	_UTIME_H
+#define	_UTIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_time_t
+
+#include <bits/alltypes.h>
+
+struct utimbuf {
+	time_t actime;
+	time_t modtime;
+};
+
+int utime (const char *, const struct utimbuf *);
+
+#if _REDIR_TIME64
+__REDIR(utime, __utime64);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/utmp.h b/musl-include/x86_64/utmp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/utmp.h
@@ -0,0 +1,52 @@
+#ifndef _UTMP_H
+#define _UTMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <utmpx.h>
+
+#define ACCOUNTING 9
+#define UT_NAMESIZE 32
+#define UT_HOSTSIZE 256
+#define UT_LINESIZE 32
+
+struct lastlog {
+	time_t ll_time;
+	char ll_line[UT_LINESIZE];
+	char ll_host[UT_HOSTSIZE];
+};
+
+#define ut_time ut_tv.tv_sec
+#define ut_name ut_user
+#define ut_addr ut_addr_v6[0]
+#define utmp utmpx
+#define e_exit __e_exit
+#define e_termination __e_termination
+
+void         endutent(void);
+struct utmp *getutent(void);
+struct utmp *getutid(const struct utmp *);
+struct utmp *getutline(const struct utmp *);
+struct utmp *pututline(const struct utmp *);
+void         setutent(void);
+
+void updwtmp(const char *, const struct utmp *);
+int utmpname(const char *);
+
+int login_tty(int);
+
+#define _PATH_UTMP "/dev/null/utmp"
+#define _PATH_WTMP "/dev/null/wtmp"
+
+#define UTMP_FILE _PATH_UTMP
+#define WTMP_FILE _PATH_WTMP
+#define UTMP_FILENAME _PATH_UTMP
+#define WTMP_FILENAME _PATH_WTMP
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/utmpx.h b/musl-include/x86_64/utmpx.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/utmpx.h
@@ -0,0 +1,67 @@
+#ifndef _UTMPX_H
+#define _UTMPX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_pid_t
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_struct_timeval
+
+#include <bits/alltypes.h>
+
+struct utmpx {
+	short ut_type;
+	short __ut_pad1;
+	pid_t ut_pid;
+	char ut_line[32];
+	char ut_id[4];
+	char ut_user[32];
+	char ut_host[256];
+	struct {
+		short __e_termination;
+		short __e_exit;
+	} ut_exit;
+#if __BYTE_ORDER == 1234
+	int ut_session, __ut_pad2;
+#else
+	int __ut_pad2, ut_session;
+#endif
+	struct timeval ut_tv;
+	unsigned ut_addr_v6[4];
+	char __unused[20];
+};
+
+void          endutxent(void);
+struct utmpx *getutxent(void);
+struct utmpx *getutxid(const struct utmpx *);
+struct utmpx *getutxline(const struct utmpx *);
+struct utmpx *pututxline(const struct utmpx *);
+void          setutxent(void);
+
+#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+#define e_exit __e_exit
+#define e_termination __e_termination
+void updwtmpx(const char *, const struct utmpx *);
+int utmpxname(const char *);
+#endif
+
+#define EMPTY           0
+#define RUN_LVL         1
+#define BOOT_TIME       2
+#define NEW_TIME        3
+#define OLD_TIME        4
+#define INIT_PROCESS    5
+#define LOGIN_PROCESS   6
+#define USER_PROCESS    7
+#define DEAD_PROCESS    8
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/values.h b/musl-include/x86_64/values.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/values.h
@@ -0,0 +1,39 @@
+#ifndef _VALUES_H
+#define _VALUES_H
+
+#include <limits.h>
+
+#define CHARBITS   (sizeof(char)   * 8)
+#define SHORTBITS  (sizeof(short)  * 8)
+#define INTBITS    (sizeof(int)    * 8)
+#define LONGBITS   (sizeof(long)   * 8)
+#define PTRBITS    (sizeof(char *) * 8)
+#define DOUBLEBITS (sizeof(double) * 8)
+#define FLOATBITS  (sizeof(float)  * 8)
+
+#define MINSHORT SHRT_MIN
+#define MININT   INT_MIN
+#define MINLONG  LONG_MIN
+
+#define MAXSHORT SHRT_MAX
+#define MAXINT   INT_MAX
+#define MAXLONG  LONG_MAX
+
+#define HIBITS   MINSHORT
+#define HIBITL   MINLONG
+
+#include <float.h>
+
+#define MAXDOUBLE DBL_MAX
+#undef  MAXFLOAT
+#define MAXFLOAT  FLT_MAX
+#define MINDOUBLE DBL_MIN
+#define MINFLOAT  FLT_MIN
+#define DMINEXP   DBL_MIN_EXP
+#define FMINEXP   FLT_MIN_EXP
+#define DMAXEXP   DBL_MAX_EXP
+#define FMAXEXP   FLT_MAX_EXP
+
+#define BITSPERBYTE CHAR_BIT
+
+#endif
diff --git a/musl-include/x86_64/wait.h b/musl-include/x86_64/wait.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/wait.h
@@ -0,0 +1,2 @@
+#warning redirecting incorrect #include <wait.h> to <sys/wait.h>
+#include <sys/wait.h>
diff --git a/musl-include/x86_64/wchar.h b/musl-include/x86_64/wchar.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/wchar.h
@@ -0,0 +1,207 @@
+#ifndef _WCHAR_H
+#define _WCHAR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_FILE
+#define __NEED___isoc_va_list
+#define __NEED_size_t
+#define __NEED_wchar_t
+#define __NEED_wint_t
+#define __NEED_mbstate_t
+
+#if __STDC_VERSION__ < 201112L
+#define __NEED_struct__IO_FILE
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#define __NEED_va_list
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_wctype_t
+#endif
+
+#include <bits/alltypes.h>
+
+#if L'\0'-1 > 0
+#define WCHAR_MAX (0xffffffffu+L'\0')
+#define WCHAR_MIN (0+L'\0')
+#else
+#define WCHAR_MAX (0x7fffffff+L'\0')
+#define WCHAR_MIN (-1-0x7fffffff+L'\0')
+#endif
+
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
+#define NULL 0L
+#else
+#define NULL ((void*)0)
+#endif
+
+#undef WEOF
+#define WEOF 0xffffffffU
+
+wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcsncat (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+int wcscmp (const wchar_t *, const wchar_t *);
+int wcsncmp (const wchar_t *, const wchar_t *, size_t);
+
+int wcscoll(const wchar_t *, const wchar_t *);
+size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+
+wchar_t *wcschr (const wchar_t *, wchar_t);
+wchar_t *wcsrchr (const wchar_t *, wchar_t);
+
+size_t wcscspn (const wchar_t *, const wchar_t *);
+size_t wcsspn (const wchar_t *, const wchar_t *);
+wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
+
+wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, wchar_t **__restrict);
+
+size_t wcslen (const wchar_t *);
+
+wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcswcs (const wchar_t *, const wchar_t *);
+
+wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
+int wmemcmp (const wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemset (wchar_t *, wchar_t, size_t);
+
+wint_t btowc (int);
+int wctob (wint_t);
+
+int mbsinit (const mbstate_t *);
+size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
+size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict);
+
+size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict);
+
+size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, mbstate_t *__restrict);
+size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, size_t, mbstate_t *__restrict);
+
+float wcstof (const wchar_t *__restrict, wchar_t **__restrict);
+double wcstod (const wchar_t *__restrict, wchar_t **__restrict);
+long double wcstold (const wchar_t *__restrict, wchar_t **__restrict);
+
+long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, int);
+
+long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, int);
+unsigned long long wcstoull (const wchar_t *__restrict, wchar_t **__restrict, int);
+
+
+
+int fwide (FILE *, int);
+
+
+int wprintf (const wchar_t *__restrict, ...);
+int fwprintf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, ...);
+
+int vwprintf (const wchar_t *__restrict, __isoc_va_list);
+int vfwprintf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
+int vswprintf (wchar_t *__restrict, size_t, const wchar_t *__restrict, __isoc_va_list);
+
+int wscanf (const wchar_t *__restrict, ...);
+int fwscanf (FILE *__restrict, const wchar_t *__restrict, ...);
+int swscanf (const wchar_t *__restrict, const wchar_t *__restrict, ...);
+
+int vwscanf (const wchar_t *__restrict, __isoc_va_list);
+int vfwscanf (FILE *__restrict, const wchar_t *__restrict, __isoc_va_list);
+int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, __isoc_va_list);
+
+wint_t fgetwc (FILE *);
+wint_t getwc (FILE *);
+wint_t getwchar (void);
+
+wint_t fputwc (wchar_t, FILE *);
+wint_t putwc (wchar_t, FILE *);
+wint_t putwchar (wchar_t);
+
+wchar_t *fgetws (wchar_t *__restrict, int, FILE *__restrict);
+int fputws (const wchar_t *__restrict, FILE *__restrict);
+
+wint_t ungetwc (wint_t, FILE *);
+
+struct tm;
+size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict);
+
+#undef iswdigit
+
+#if defined(_GNU_SOURCE)
+wint_t fgetwc_unlocked (FILE *);
+wint_t getwc_unlocked (FILE *);
+wint_t getwchar_unlocked (void);
+wint_t fputwc_unlocked (wchar_t, FILE *);
+wint_t putwc_unlocked (wchar_t, FILE *);
+wint_t putwchar_unlocked (wchar_t);
+wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict);
+int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict);
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t);
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)  || defined(_BSD_SOURCE)
+FILE *open_wmemstream(wchar_t **, size_t *);
+size_t mbsnrtowcs(wchar_t *__restrict, const char **__restrict, size_t, size_t, mbstate_t *__restrict);
+size_t wcsnrtombs(char *__restrict, const wchar_t **__restrict, size_t, size_t, mbstate_t *__restrict);
+wchar_t *wcsdup(const wchar_t *);
+size_t wcsnlen (const wchar_t *, size_t);
+wchar_t *wcpcpy (wchar_t *__restrict, const wchar_t *__restrict);
+wchar_t *wcpncpy (wchar_t *__restrict, const wchar_t *__restrict, size_t);
+int wcscasecmp(const wchar_t *, const wchar_t *);
+int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
+int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
+int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
+int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
+size_t wcsxfrm_l(wchar_t *__restrict, const wchar_t *__restrict, size_t, locale_t);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+int wcwidth (wchar_t);
+int wcswidth (const wchar_t *, size_t);
+int       iswalnum(wint_t);
+int       iswalpha(wint_t);
+int       iswblank(wint_t);
+int       iswcntrl(wint_t);
+int       iswdigit(wint_t);
+int       iswgraph(wint_t);
+int       iswlower(wint_t);
+int       iswprint(wint_t);
+int       iswpunct(wint_t);
+int       iswspace(wint_t);
+int       iswupper(wint_t);
+int       iswxdigit(wint_t);
+int       iswctype(wint_t, wctype_t);
+wint_t    towlower(wint_t);
+wint_t    towupper(wint_t);
+wctype_t  wctype(const char *);
+
+#ifndef __cplusplus
+#undef iswdigit
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/wctype.h b/musl-include/x86_64/wctype.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/wctype.h
@@ -0,0 +1,79 @@
+#ifndef _WCTYPE_H
+#define _WCTYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_wint_t
+#define __NEED_wctype_t
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_locale_t
+#endif
+
+#include <bits/alltypes.h>
+
+typedef const int * wctrans_t;
+
+#undef WEOF
+#define WEOF 0xffffffffU
+
+#undef iswdigit
+
+int       iswalnum(wint_t);
+int       iswalpha(wint_t);
+int       iswblank(wint_t);
+int       iswcntrl(wint_t);
+int       iswdigit(wint_t);
+int       iswgraph(wint_t);
+int       iswlower(wint_t);
+int       iswprint(wint_t);
+int       iswpunct(wint_t);
+int       iswspace(wint_t);
+int       iswupper(wint_t);
+int       iswxdigit(wint_t);
+int       iswctype(wint_t, wctype_t);
+wint_t    towctrans(wint_t, wctrans_t);
+wint_t    towlower(wint_t);
+wint_t    towupper(wint_t);
+wctrans_t wctrans(const char *);
+wctype_t  wctype(const char *);
+
+#ifndef __cplusplus
+#undef iswdigit
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
+#endif
+
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+int iswalnum_l(wint_t, locale_t);
+int iswalpha_l(wint_t, locale_t);
+int iswblank_l(wint_t, locale_t);
+int iswcntrl_l(wint_t, locale_t);
+int iswdigit_l(wint_t, locale_t);
+int iswgraph_l(wint_t, locale_t);
+int iswlower_l(wint_t, locale_t);
+int iswprint_l(wint_t, locale_t);
+int iswpunct_l(wint_t, locale_t);
+int iswspace_l(wint_t, locale_t);
+int iswupper_l(wint_t, locale_t);
+int iswxdigit_l(wint_t, locale_t);
+int iswctype_l(wint_t, wctype_t, locale_t);
+wint_t towlower_l(wint_t, locale_t);
+wint_t towupper_l(wint_t, locale_t);
+wint_t towctrans_l(wint_t, wctrans_t, locale_t);
+wctrans_t wctrans_l(const char *, locale_t);
+wctype_t  wctype_l(const char *, locale_t);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/musl-include/x86_64/wordexp.h b/musl-include/x86_64/wordexp.h
new file mode 100644
--- /dev/null
+++ b/musl-include/x86_64/wordexp.h
@@ -0,0 +1,41 @@
+#ifndef	_WORDEXP_H
+#define	_WORDEXP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
+#define __NEED_size_t
+
+#include <bits/alltypes.h>
+
+#define WRDE_DOOFFS  1
+#define WRDE_APPEND  2
+#define WRDE_NOCMD   4
+#define WRDE_REUSE   8
+#define WRDE_SHOWERR 16
+#define WRDE_UNDEF   32
+
+typedef struct {
+	size_t we_wordc;
+	char **we_wordv;
+	size_t we_offs;
+} wordexp_t;
+
+#define WRDE_NOSYS   -1
+#define WRDE_NOSPACE 1
+#define WRDE_BADCHAR 2
+#define WRDE_BADVAL  3
+#define WRDE_CMDSUB  4
+#define WRDE_SYNTAX  5
+
+int wordexp (const char *__restrict, wordexp_t *__restrict, int);
+void wordfree (wordexp_t *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src-internal/Data/Digraph.hs b/src-internal/Data/Digraph.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/Data/Digraph.hs
@@ -0,0 +1,943 @@
+-- | Directed graph
+--
+-- Intended for qualified import.
+--
+-- > import Data.Digraph (Digraph)
+-- > import Data.Digraph qualified as Digraph
+module Data.Digraph (
+    -- * Type
+    Digraph -- opaque
+    -- * Construction
+  , empty
+  , reIndex
+  , transpose
+    -- * Insertion
+  , insertVertex
+  , insertEdge
+  , insertEdgeIfVerticesExist
+  , InsertEdgeIfVerticesExistResult(..)
+    -- * Deletion/Update
+  , deleteEdgesFrom
+  , deleteEdgesTo
+  , combineParallelEdges
+  , filterEdges
+  , filterVerticesCombineEdges
+    -- * Query
+  , hasVertex
+  , vertices
+  , neighbors
+  , reaches
+  , sort
+  , sortBy
+  , dfs
+  , dff
+  , dfFindMember
+  , traversePathFrom
+  , findEdges
+  , FindEdgesResult(..)
+    -- * Traversal
+  , mapEdges
+  , mapVerticesOutgoingEdges
+    -- * Visualization
+  , VisOptions(..)
+  , VisVertex(..)
+  , VisEdge(..)
+  , VisEdgeStyle(..)
+  , testVisOptions
+  , renderMermaid
+  ) where
+
+import Control.Monad (unless, (<=<))
+import Control.Monad.ST (ST)
+import Control.Monad.ST qualified as ST
+import Data.Array.ST.Safe qualified as Array
+import Data.Bifunctor (bimap, first)
+import Data.Foldable qualified as Foldable
+import Data.IntMap.Strict (IntMap)
+import Data.IntMap.Strict qualified as IntMap
+import Data.IntSet (IntSet)
+import Data.IntSet qualified as IntSet
+import Data.List qualified as List
+import Data.List.NonEmpty (NonEmpty)
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Map.Strict (Map)
+import Data.Map.Strict qualified as Map
+import Data.Maybe qualified as Maybe
+import Data.Set (Set)
+import Data.Set qualified as Set
+import Data.Tree (Tree)
+import Data.Tree qualified as Tree
+import GHC.Generics (Generic)
+import GHC.Stack (HasCallStack)
+
+{-------------------------------------------------------------------------------
+  Type
+-------------------------------------------------------------------------------}
+
+-- | Internal vertex index
+type Idx = Int
+
+-- | Directed graph with vertices of type @v@ and edges of type @e@
+--
+-- Functions in this module implement objective ordering of vertices, using
+-- vertex insertion order by default.  Use the 'reIndex' function to transform
+-- the internal representation of a graph so that vertices are ordered by an
+-- explicit ordering function.
+data Digraph e v = Digraph {
+      -- | Next internal vertex index to allocate
+      nextIdx :: !Idx
+
+      -- | Map from vertex to internal vertex index
+      --
+      -- Invariant: All entries have corresponding entries in @idxMap@.  For any
+      -- graph @g@:
+      --
+      -- @
+      -- and [
+      --   IntMap.lookup idx g.idxMap == Just v
+      --   | (v, idx) <- Map.toList g.vMap
+      --   ]
+      -- @
+    , vMap :: !(Map v Idx)
+
+      -- | Map from internal vertex index to vertex
+      --
+      -- Invariant: All entries have corresponding entries in @vMap@.  For any
+      -- graph @g@:
+      --
+      -- @
+      -- and [
+      --   Map.lookup v g.vMap == Just idx
+      --   | (idx, v) <- IntMap.toList g.idxMap
+      --   ]
+      -- @
+    , idxMap :: !(IntMap v)
+
+      -- | Map of directed edges between vertices
+      --
+      -- The outside 'IntMap' maps from source vertices to an 'IntMap' from
+      -- target vertices to a 'Set' of edges.
+      --
+      -- Invariant: Every entry has at least one edge, so no inside 'IntMap' or
+      -- 'Set' may be empty.  For any graph @g@:
+      --
+      -- @
+      -- not $ or [
+      --     any IntMap.null graph.edgeMap
+      --   , any (any Set.null) graph.edgeMap
+      --   ]
+      -- @
+    , edgeMap :: !(IntMap (IntMap (Set e)))
+    }
+  deriving stock (Generic)
+
+deriving instance (Eq   e, Eq   v) => Eq   (Digraph e v)
+deriving instance (Show e, Show v) => Show (Digraph e v)
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+-- | The empty graph
+empty :: Digraph e v
+empty = Digraph{
+      nextIdx = 0
+    , vMap    = Map.empty
+    , idxMap  = IntMap.empty
+    , edgeMap = IntMap.empty
+    }
+
+-- | Re-index the graph using the specified ordering function
+--
+-- The new graph has the same vertices and edges.  Only the internal ordering is
+-- updated.
+reIndex :: forall e v.
+     Ord v
+  => (v -> v -> Ordering)
+  -> Digraph e v
+  -> Digraph e v
+reIndex cmp graph = Digraph{
+      nextIdx = Map.size vMap'
+    , vMap    = vMap'
+    , idxMap  = idxMap'
+    , edgeMap = edgeMap'
+    }
+  where
+    vIdxs :: [(Idx, (v, Idx))]
+    vIdxs = zip [0..] $
+      List.sortBy (\l r -> cmp (fst l) (fst r)) (Map.toList graph.vMap)
+
+    reIdxMap :: IntMap Idx
+    reIdxMap = IntMap.fromList [
+        (oldIdx, newIdx)
+      | (newIdx, (_v, oldIdx)) <- vIdxs
+      ]
+
+    vMap' :: Map v Idx
+    vMap'   = Map.fromList    [(v, newIdx) | (newIdx, (v, _oldIdx)) <- vIdxs]
+
+    idxMap' :: IntMap v
+    idxMap' = IntMap.fromList [(newIdx, v) | (newIdx, (v, _oldIdx)) <- vIdxs]
+
+    edgeMap' :: IntMap (IntMap (Set e))
+    edgeMap' = IntMap.fromList [
+        let toMap'   = IntMap.fromList [
+                (reIdxMap IntMap.! toIdx, edges)
+              | (toIdx, edges) <- IntMap.toList toMap
+              ]
+        in  (reIdxMap IntMap.! fromIdx, toMap')
+      | (fromIdx, toMap) <- IntMap.toList graph.edgeMap
+      ]
+
+-- | Transpose an existing graph
+--
+-- The new graph has the same vertices, and edges are reversed.
+--
+-- Property: The internal representation is maintained.  For any graph @g@:
+--
+-- @
+-- Digraph.transpose (Digraph.transpose g) == g
+-- @
+transpose :: Digraph e v -> Digraph e v
+transpose graph = graph{ edgeMap = aux graph.edgeMap }
+  where
+    aux :: IntMap (IntMap es) -> IntMap (IntMap es)
+    aux = IntMap.foldrWithKey' auxF IntMap.empty
+
+    auxF :: Idx -> IntMap es -> IntMap (IntMap es) -> IntMap (IntMap es)
+    auxF fromIdx = flip (IntMap.foldrWithKey' (auxT fromIdx))
+
+    auxT :: Idx -> Idx -> es -> IntMap (IntMap es) -> IntMap (IntMap es)
+    auxT fromIdx toIdx edges = flip IntMap.alter toIdx $
+        Just
+      . maybe (IntMap.singleton fromIdx edges) (IntMap.insert fromIdx edges)
+
+{-------------------------------------------------------------------------------
+  Insertion
+-------------------------------------------------------------------------------}
+
+-- | Insert a vertex
+--
+-- Property: This function is idempotent.  The graph is not changed if the
+-- vertex already exists.  For any graph @g@:
+--
+-- @
+-- let g' = Dyngraph.insertVertex v g
+-- in  Dyngraph.insertVertex v g' == g'
+-- @
+insertVertex :: Ord v => v -> Digraph e v -> Digraph e v
+insertVertex v = snd . insertVertex' v
+
+-- | Insert an edge
+--
+-- The vertices do not have to exist, as this function inserts vertices
+-- automatically.
+--
+-- Property: This function is idempotent.  The graph is not changed if the edge
+-- already exists.  For any graph @g@:
+--
+-- @
+-- let g' = Dyngraph.insertEdge v1 e v2 g
+-- in  Dyngraph.insertEdge v1 e v2 g' == g'
+-- @
+insertEdge :: (Ord e, Ord v) => v -> e -> v -> Digraph e v -> Digraph e v
+insertEdge fromV edge toV graph =
+    let (fromIdx, graph1) = insertVertex' fromV graph
+        (toIdx,   graph2) = insertVertex' toV   graph1
+    in  graph2{ edgeMap = insertEdge' fromIdx edge toIdx graph2.edgeMap }
+
+-- | Insert an edge when both vertices are already in the graph
+--
+-- Property: This function is idempotent.  The graph is not changed if the edge
+-- already exists.  For any graph @g@ that has edges @v1@ and @v2@:
+--
+-- @
+-- let result@(InsertEdgeSuccess g') =
+--       Dyngraph.insertEdgeIfVerticesExist v1 e v2 g
+-- in  Dyngraph.insertEdgeIfVerticesExist v1 e v2 g' == result
+-- @
+insertEdgeIfVerticesExist ::
+     (Ord e, Ord v)
+  => v
+  -> e
+  -> v
+  -> Digraph e v
+  -> InsertEdgeIfVerticesExistResult e v
+insertEdgeIfVerticesExist fromV edge toV graph =
+    either id InsertEdgeSuccess $ do
+      fromIdx <- maybe (Left (InsertEdgeSourceVertexNotFound fromV)) Right $
+        Map.lookup fromV graph.vMap
+      toIdx   <- maybe (Left (InsertEdgeTargetVertexNotFound toV))   Right $
+        Map.lookup toV   graph.vMap
+      return $ graph{ edgeMap = insertEdge' fromIdx edge toIdx graph.edgeMap }
+
+-- | 'insertEdgeIfVerticesExist' result
+data InsertEdgeIfVerticesExistResult e v =
+    InsertEdgeSuccess (Digraph e v)
+  | InsertEdgeSourceVertexNotFound v
+  | InsertEdgeTargetVertexNotFound v
+  deriving stock (Eq, Show)
+
+{-------------------------------------------------------------------------------
+  Deletion/Update
+-------------------------------------------------------------------------------}
+
+-- | Delete edges from any of the specified vertices
+--
+-- This function never deletes vertices, even if removing edges results in a
+-- disconnected graph.
+deleteEdgesFrom :: Ord v => Set v -> Digraph e v -> Digraph e v
+deleteEdgesFrom fromVs graph =
+    let fromIdxs = Maybe.mapMaybe (graph.vMap Map.!?) (Set.elems fromVs)
+    in  graph{
+            edgeMap =
+              Foldable.foldl' (flip IntMap.delete) graph.edgeMap fromIdxs
+          }
+
+-- | Delete edges to any of the specified vertices
+--
+-- This function never deletes vertices, even if removing edges results in a
+-- disconnected graph.
+deleteEdgesTo :: Ord v => Set v -> Digraph e v -> Digraph e v
+deleteEdgesTo toVs graph =
+    let toIdxs = Maybe.mapMaybe (graph.vMap Map.!?) (Set.elems toVs)
+    in  graph{ edgeMap = aux toIdxs graph.edgeMap }
+  where
+    aux :: [Idx] -> IntMap (IntMap (Set e)) -> IntMap (IntMap (Set e))
+    aux idxs = IntMap.mapMaybe $
+        maybeEmpty IntMap.null
+      . IntMap.filterWithKey (\idx _ -> idx `notElem` idxs)
+
+-- | Combine parallel edges using the provided function
+--
+-- The 'Ord' instance determines the order that edges are passed to the provided
+-- function.
+--
+-- Example graph @g@, with two edges @s@ and @t@, both from vertex @A@ to vertex
+-- @B@:
+--
+-- @
+--   +-----s-----+
+--   |           |
+--   |           v
+--   A           B
+--   |           ^
+--   |           |
+--   +-----t-----+
+-- @
+--
+-- Assuming @s < t@, @combineParallelEdges f g@ replaces edges @s@ and @t@ with a
+-- single edge @f s t@:
+--
+-- @
+--   A-----(f s t)---->B
+-- @
+combineParallelEdges :: forall e v. (e -> e -> e) -> Digraph e v -> Digraph e v
+combineParallelEdges combine graph =
+    graph{ edgeMap = IntMap.map (IntMap.map aux) graph.edgeMap }
+  where
+    aux :: Set e -> Set e
+    aux = Set.singleton . Foldable.foldl1 combine
+
+-- | Filter edges of a graph
+--
+-- Only edges for which the predicate returns 'True' are kept.
+filterEdges :: forall e v. (e -> Bool) -> Digraph e v -> Digraph e v
+filterEdges p graph = graph { edgeMap = IntMap.mapMaybe aux graph.edgeMap }
+  where
+    aux :: IntMap (Set e) -> Maybe (IntMap (Set e))
+    aux =
+        maybeEmpty IntMap.null
+      . IntMap.mapMaybe (maybeEmpty Set.null . Set.filter p)
+
+-- | Filter vertices of a graph, combining edges that traverse removed vertices
+--
+-- __WARNING__ Vertices for which the predicate returns 'True' are removed,
+-- unlike normal Haskell filters.
+--
+-- The 'Ord' instance determines the order that edges are passed to the provided
+-- function.
+--
+-- Example graph @g@, with four vertices (uppercase) and four edges (lowercase):
+--
+-- @
+--   +------ac-------+
+--   |               |
+--   |               v
+--   A--ab-->B--bc-->C
+--           |
+--           +--bd-->D
+-- @
+--
+-- When using this function to remove vertex @B@ with
+-- @filterVerticesCombineEdges (== 'B') f g@:
+--
+-- * Vertex @B@ and edges @ab@, @bc@, @bd@ are removed.
+-- * Assuming @ab < bc@, a new edge @f ab bc@ from vertex @A@ to vertex @C@ is
+--   created /if/ @f ab bc /= ac@.
+-- * Assuming @ab < bd@, a new edge @f ab bd@ from vertex @A@ to vertex @D@ is
+--   created.
+--
+-- This results in the following graph when @f ab bc /= ac@:
+--
+-- @
+--   +------ac-------+
+--   |               |
+--   |               v
+--   A---(f ab bc)-->C
+--   |
+--   +---(f ab bd)-->D
+-- @
+--
+-- Alternatively, this results in the following graph when @f ab bc == ac@:
+--
+-- @
+--   A------ac------>C
+--   |
+--   +---(f ab bd)-->D
+-- @
+filterVerticesCombineEdges ::
+     (Ord e, Ord v)
+  => (v -> Bool)
+  -> (e -> e -> e)
+  -> Digraph e v
+  -> Digraph e v
+filterVerticesCombineEdges p combine graph =
+    let delIdxVs = IntMap.toList $ IntMap.filter (not . p) graph.idxMap
+    in  Foldable.foldl' (deleteVertexCombineEdges combine) graph delIdxVs
+
+{-------------------------------------------------------------------------------
+  Query
+-------------------------------------------------------------------------------}
+
+-- | Check whether a vertex exists in the graph
+hasVertex :: Ord v => v -> Digraph e v -> Bool
+hasVertex v graph = Map.member v graph.vMap
+
+-- | Get the vertices of the graph
+vertices :: Digraph e v -> [v]
+vertices graph = IntMap.elems graph.idxMap
+
+-- | Get the immediate neighbors of the specified vertex
+neighbors :: Ord v => v -> Digraph e v -> Map v (Set e)
+neighbors fromV graph = maybe Map.empty Map.fromList $ do
+    fromIdx <- Map.lookup fromV graph.vMap
+    toMap   <- IntMap.lookup fromIdx graph.edgeMap
+    return $ map (first (graph.idxMap IntMap.!)) (IntMap.toList toMap)
+
+-- | Get the set of vertices that are reachable from any of the specified
+-- vertices
+--
+-- The specified vertices are included in the set (assuming that they are in
+-- the graph).
+reaches :: Ord v => Set v -> Digraph e v -> Set v
+reaches fromVs graph =
+      Set.map (graph.idxMap IntMap.!)
+    . reaches' graph.edgeMap
+    . Maybe.mapMaybe (graph.vMap Map.!?)
+    $ Set.toList fromVs
+
+-- | Sort the vertices of a graph using a topological sort of groups of strongly
+-- connected components
+sort :: forall e v. Digraph e v -> [v]
+sort graph = vs
+  where
+    -- Get the strongly connected components for the graph.
+    sccs :: [Tree Idx]
+    sccs = scc' graph
+
+    -- Associate each group of strongly connected components with the least
+    -- vertex in that group.  @sccToMap@ is a map from each index in the graph
+    -- to the representative index for the group of strongly connected
+    -- components that it is in.  @sccFromMap@ is a map from each representative
+    -- index to an /ordered/ list of strongly connected components in that
+    -- group.
+    sccToMap   :: IntMap Idx
+    sccFromMap :: IntMap [Idx]
+    (sccToMap, sccFromMap) = foldr aux (IntMap.empty, IntMap.empty) sccs
+      where
+        aux ::
+             Tree Idx
+          -> (IntMap Idx, IntMap [Idx])
+          -> (IntMap Idx, IntMap [Idx])
+        aux tree (toMap, fromMap) =
+          let idxs = List.sort (Tree.flatten tree)
+              idx' = unsafeHead idxs  -- safe because Tree is non-empty
+          in  ( foldr (flip IntMap.insert idx') toMap idxs
+              , IntMap.insert idx' idxs fromMap
+              )
+
+    -- Construct an internal graph where vertices are the representative
+    -- indices of the groups of strongly connected components.
+    sccVs :: IntSet
+    sccVs = IntMap.keysSet sccFromMap
+
+    -- The forward and reverse edges of this graph are non-distict.
+    sccFEdgeMap, sccREdgeMap :: IntMap IntSet
+    (sccFEdgeMap, sccREdgeMap) =
+        IntMap.foldrWithKey aux (IntMap.empty, IntMap.empty) graph.edgeMap
+      where
+        aux ::
+             Idx
+          -> IntMap (Set e)
+          -> (IntMap IntSet, IntMap IntSet)
+          -> (IntMap IntSet, IntMap IntSet)
+        aux fromIdx =
+          let fromIdx' = sccToMap IntMap.! fromIdx
+          in  flip . IntMap.foldrWithKey $ \toIdx _ ->
+                case sccToMap IntMap.! toIdx of
+                  toIdx'
+                    | toIdx' /= fromIdx' ->
+                        bimap (ins fromIdx' toIdx') (ins toIdx' fromIdx')
+                    | otherwise ->
+                        id
+
+        ins :: Idx -> Idx -> IntMap IntSet -> IntMap IntSet
+        ins lIdx rIdx = IntMap.insertWith (<>) lIdx (IntSet.singleton rIdx)
+
+    -- Compute the topological sort of the internal graph.  The topological sort
+    -- always exists because there are no cycles between groups of strongly
+    -- connected components.
+    idxs' :: [Idx]
+    idxs' = Maybe.fromJust $
+        let startIdxs = sccVs IntSet.\\ IntMap.keysSet sccREdgeMap
+        in  auxF [] startIdxs sccFEdgeMap sccREdgeMap
+      where
+        auxF ::
+             [Idx]
+          -> IntSet
+          -> IntMap IntSet
+          -> IntMap IntSet
+          -> Maybe [Idx]
+        auxF acc startIdxs fEdgeMap rEdgeMap = case IntSet.minView startIdxs of
+          Just (fromIdx, startIdxs') ->
+            let (toIdxs, fEdgeMap') = first (maybe [] IntSet.elems) $
+                  IntMap.updateLookupWithKey (\_ _ -> Nothing) fromIdx fEdgeMap
+                (startIdxs'', rEdgeMap') =
+                  auxR startIdxs' rEdgeMap fromIdx toIdxs
+            in  auxF (fromIdx : acc) startIdxs'' fEdgeMap' rEdgeMap'
+          Nothing
+            | IntMap.null fEdgeMap -> Just (List.reverse acc)
+            | otherwise            -> Nothing
+
+        auxR ::
+             IntSet
+          -> IntMap IntSet
+          -> Idx
+          -> [Idx]
+          -> (IntSet, IntMap IntSet)
+        auxR startIdxs rEdgeMap fromIdx = \case
+          toIdx : toIdxs ->
+            let (mFromIdxs, rEdgeMap') =
+                  IntMap.updateLookupWithKey
+                    (\_ -> maybeEmpty IntSet.null . IntSet.delete fromIdx)
+                    toIdx
+                    rEdgeMap
+                startIdxs' = case mFromIdxs of
+                  Just fromIdxs
+                    | fromIdxs /= IntSet.singleton fromIdx -> startIdxs
+                  _otherwise -> IntSet.insert toIdx startIdxs
+            in  auxR startIdxs' rEdgeMap' fromIdx toIdxs
+          [] -> (startIdxs, rEdgeMap)
+
+    -- Transform the topological sort of the internal graph to a list of
+    -- vertices in the actual graph.  Each representative index is expanded to
+    -- the (already sorted) list of graph indices, and the actual vertices are
+    -- queried.
+    vs :: [v]
+    vs = flip Foldable.concatMap idxs' $ \idx' -> [
+        graph.idxMap IntMap.! idx
+      | idx <- sccFromMap IntMap.! idx'
+      ]
+
+-- | Sort the vertices of a graph using a topological sort of groups of strongly
+-- connected components, ordering with the specified ordering function
+sortBy :: Ord v => (v -> v -> Ordering) -> Digraph e v -> [v]
+sortBy cmp = sort . reIndex cmp
+
+-- | Depth-first traversal of the graph from the specified vertices
+--
+-- The specified vertices are traversed in the given order.  Vertices that have
+-- already been processed are omitted from subsequent trees.
+dfs :: Ord v => [v] -> Digraph e v -> [Tree v]
+dfs fromVs graph =
+      map (fmap (graph.idxMap IntMap.!))
+    . dfs' graph
+    $ Maybe.mapMaybe (graph.vMap Map.!?) fromVs
+
+-- | Depth-first traversal of the graph
+--
+-- Vertices that have already been processed are omitted from subsequent trees.
+dff :: Digraph e v -> [Tree v]
+dff graph =
+      map (fmap (graph.idxMap IntMap.!))
+    $ dfs' graph (IntMap.keys graph.idxMap)
+
+-- | Find the first vertex in a set of target vertices using a depth-first
+-- traversal from the specified vertex
+dfFindMember ::
+     Ord v
+  => v      -- ^ Vertex to search from
+  -> Set v  -- ^ Target vertices
+  -> Digraph e v
+  -> Maybe v
+dfFindMember fromV targetVs graph = fmap (graph.idxMap IntMap.!) $ do
+    fromIdx <- Map.lookup fromV graph.vMap
+    aux $ dfs' graph [fromIdx]
+  where
+    targetIdxs :: IntSet
+    targetIdxs = IntSet.fromList $
+      Maybe.mapMaybe (`Map.lookup` graph.vMap) (Set.toList targetVs)
+
+    aux :: [Tree Idx] -> Maybe Idx
+    aux = \case
+      Tree.Node idx children : trees
+        | IntSet.member idx targetIdxs -> Just idx
+        | otherwise                    -> aux $ children ++ trees
+      []                               -> Nothing
+
+-- | Traverse a path from a vertex using the specified function
+traversePathFrom :: forall e v r m.
+     (Monad m, Ord v)
+  => v                                 -- ^ Starting vertex
+  -> ([(v, Set e)] -> m (Either v r))  -- ^ Choose next step
+  -> Digraph e v
+  -> m r
+traversePathFrom fromV f graph = step fromV
+  where
+    step :: v -> m r
+    step = either step return <=< f . getSuccessors
+
+    getSuccessors :: v -> [(v, Set e)]
+    getSuccessors v = Maybe.fromMaybe [] $ do
+      idx   <- Map.lookup v graph.vMap
+      toMap <- IntMap.lookup idx graph.edgeMap
+      return $ map (first (graph.idxMap IntMap.!)) (IntMap.toAscList toMap)
+
+-- | Find edges from a vertex and edges to all terminal vertices in paths from
+-- that vertex
+findEdges :: forall e v.
+     (Ord e, Ord v)
+  => v  -- ^ Starting vertex
+  -> Digraph e v
+  -> FindEdgesResult e
+findEdges fromV graph = either id id $ do
+    fromIdx <- maybe (Left FindEdgesNone) Right $
+      Map.lookup fromV graph.vMap
+    startIdxs <- maybe (Left FindEdgesNone) (Right . IntMap.toAscList) $
+      IntMap.lookup fromIdx graph.edgeMap
+    startEdges <-
+      maybe (Left FindEdgesNone) Right . NonEmpty.nonEmpty . Set.elems $
+        Set.unions (map snd startIdxs)
+    terminalEdges <-
+      maybe (Left FindEdgesInvalid) Right . NonEmpty.nonEmpty . Set.elems $
+        getTerminalEdges startIdxs
+    return $ FindEdgesFound startEdges terminalEdges
+  where
+    getTerminalEdges :: [(Idx, Set e)] -> Set e
+    getTerminalEdges startIdxs = run (0, graph.nextIdx - 1) $
+      \(check :: Int -> ST s Bool) ->
+        let aux ::
+                 IntSet          -- ^ Known terminal vertex indices
+              -> Set e           -- ^ Accumulator
+              -> [(Idx, Set e)]  -- ^ Frontier
+              -> ST s (Set e)
+            aux termIdxs acc = \case
+              (idx, edges) : rest
+                | IntSet.member idx termIdxs -> aux termIdxs (edges <> acc) rest
+                | otherwise                  -> check idx >>= \case
+                    True  -> aux termIdxs acc rest
+                    False -> case IntMap.lookup idx graph.edgeMap of
+                      Just toIdxs | not (IntMap.null toIdxs) ->
+                        aux termIdxs acc $ IntMap.toAscList toIdxs ++ rest
+                      _otherwise ->
+                        aux (IntSet.insert idx termIdxs) (edges <> acc) rest
+              [] -> return acc
+        in  aux IntSet.empty Set.empty startIdxs
+
+    run :: (Idx, Idx) -> (forall s. (Idx -> ST s Bool) -> ST s x) -> x
+    run bounds f = ST.runST $ do
+      m <- Array.newArray bounds False :: ST s (Array.STUArray s Idx Bool)
+      f $ \idx -> do
+        visited <- Array.readArray m idx
+        unless visited $ Array.writeArray m idx True
+        return visited
+
+-- | 'findEdges' result
+data FindEdgesResult e =
+    -- | Invalid internal representation (should never happen)
+    FindEdgesInvalid
+
+    -- | Starting vertex is not in the graph or has no edges
+  | FindEdgesNone
+
+    -- | Edges from starting vertex and edges to terminal vertices
+  | FindEdgesFound (NonEmpty e) (NonEmpty e)
+  deriving stock (Eq, Show)
+
+{-------------------------------------------------------------------------------
+  Traversal
+-------------------------------------------------------------------------------}
+
+-- | Transform edges of a graph
+--
+-- This function may decrease the number of edges between two vertices.
+mapEdges :: Ord e2 => (e1 -> e2) -> Digraph e1 v -> Digraph e2 v
+mapEdges f graph =
+    graph{ edgeMap = IntMap.map (IntMap.map (Set.map f)) graph.edgeMap }
+
+-- | Transform vertices of a graph
+--
+-- The transformation function is passed the vertex and the outgoing edges from
+-- that vertex.
+mapVerticesOutgoingEdges :: forall e v1 v2.
+     (Ord e, Ord v1, Ord v2)
+  => (v1 -> Set e -> v2)
+  -> Digraph e v1
+  -> Digraph e v2
+mapVerticesOutgoingEdges f graph = graph{
+      vMap   = Map.mapKeys aux graph.vMap
+    , idxMap = IntMap.map  aux graph.idxMap
+    }
+  where
+    aux :: v1 -> v2
+    aux fromV = f fromV (outgoingEdges fromV)
+
+    outgoingEdges :: v1 -> Set e
+    outgoingEdges fromV = Maybe.fromMaybe Set.empty $ do
+      fromIdx <- Map.lookup fromV graph.vMap
+      toMap   <- IntMap.lookup fromIdx graph.edgeMap
+      return $ IntMap.foldl' (<>) Set.empty toMap
+
+{-------------------------------------------------------------------------------
+  Visualization
+-------------------------------------------------------------------------------}
+
+-- | Graph visualization options
+data VisOptions e v = VisOptions {
+      visVertex    :: v -> VisVertex  -- ^ Determine how to visualize a vertex
+    , visEdge      :: e -> VisEdge    -- ^ Determine how to visualize an edge
+    , reverseEdges :: Bool            -- ^ Visualize edges in reverse?
+    }
+
+-- | Vertex visualization
+data VisVertex = VisVertex {
+      label :: Maybe String  -- ^ Vertex label
+    }
+
+-- | Edge visualization
+data VisEdge = VisEdge {
+      label :: Maybe String  -- ^ Edge label
+    , style :: VisEdgeStyle  -- ^ Edge style
+    }
+
+-- | Edge visualization style
+data VisEdgeStyle =
+    Solid   -- ^ Solid line
+  | Dotted  -- ^ Dotted line
+
+-- | Test graph visualization options, for debugging
+testVisOptions :: (Show e, Show v) => VisOptions e v
+testVisOptions = VisOptions{
+      visVertex = \v -> VisVertex{
+          label = Just (show v)
+        }
+    , visEdge   = \e -> VisEdge{
+          label = Just (show e)
+        , style = Solid
+        }
+    , reverseEdges = False
+    }
+
+-- | Render a Mermaid diagram
+--
+-- On GitHub, put Mermaid diagram code in a @mermaid@ clode block to render it.
+--
+-- Reference:
+--
+-- * <https://mermaid.js.org/>
+renderMermaid :: VisOptions e v -> Digraph e v -> String
+renderMermaid opts graph = unlines $ header : nodes ++ links
+  where
+    header :: String
+    header = "graph TD"
+
+    nodes :: [String]
+    nodes = [
+        let nodeId  = getNodeId idx
+            nodeVis = opts.visVertex v
+            label   = case nodeVis.label of
+              Just l  -> "(\"" ++ escapeString l ++ "\")"
+              Nothing -> ""
+        in  indent ++ nodeId ++ label
+      | (idx, v) <- IntMap.toAscList graph.idxMap
+      ]
+
+    links :: [String]
+    links = [
+        let fromNodeId =
+              getNodeId $ if opts.reverseEdges then toIdx else fromIdx
+            toNodeId   =
+              getNodeId $ if opts.reverseEdges then fromIdx else toIdx
+            edgeVis    = opts.visEdge edge
+            edgeSyntax = getEdgeSyntax edgeVis.style
+            label      = case edgeVis.label of
+              Just l  -> "|\"" ++ escapeString l ++ "\"|"
+              Nothing -> ""
+        in  indent ++ fromNodeId ++ edgeSyntax ++ label ++ toNodeId
+      | (fromIdx, toMap) <- IntMap.toAscList graph.edgeMap
+      , (toIdx, edges) <- IntMap.toAscList toMap
+      , edge <- Set.elems edges
+      ]
+
+    indent :: String
+    indent = "  "
+
+    escapeString :: String -> [Char]
+    escapeString = concatMap $ \case
+        '"' -> "&quot;"
+        '<' -> "&lt;"
+        '>' -> "&gt;"
+        c   -> [c]
+
+    getNodeId :: Idx -> String
+    getNodeId idx = 'v' : show idx
+
+    getEdgeSyntax :: VisEdgeStyle -> String
+    getEdgeSyntax = \case
+      Solid  -> "-->"
+      Dotted -> "-.->"
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+-- GHC warns when using some partial functions, but there are still cases when
+-- such functions are correct.  In this module, 'Tree' must have at least one
+-- member, but 'Tree.flatten' returns a list.  This is an implementation of
+-- 'head' that uses a partial function that GHC does not warn about (yet).
+unsafeHead :: HasCallStack => [a] -> a
+unsafeHead = Maybe.fromJust . Maybe.listToMaybe
+{-# INLINE unsafeHead #-}
+
+maybeEmpty :: (a -> Bool) -> a -> Maybe a
+maybeEmpty p x
+    | p x       = Nothing
+    | otherwise = Just x
+
+insertVertex' :: Ord v => v -> Digraph e v -> (Idx, Digraph e v)
+insertVertex' v graph =
+    case Map.insertLookupWithKey keepOld v graph.nextIdx graph.vMap of
+      (Just idx, _)     -> (idx, graph)
+      (Nothing,  vMap') ->
+        let graph' = graph{
+                nextIdx = graph.nextIdx + 1
+              , vMap    = vMap'
+              , idxMap  = IntMap.insert graph.nextIdx v graph.idxMap
+              }
+        in  (graph.nextIdx, graph')
+  where
+    keepOld :: k -> v -> v -> v
+    keepOld _key _new old = old
+
+insertEdge' :: forall e.
+     Ord e
+  => Idx
+  -> e
+  -> Idx
+  -> IntMap (IntMap (Set e))
+  -> IntMap (IntMap (Set e))
+insertEdge' fromIdx edge toIdx = flip IntMap.alter fromIdx $
+      Just
+    . maybe (IntMap.singleton toIdx edges) (IntMap.insertWith (<>) toIdx edges)
+  where
+    edges :: Set e
+    edges = Set.singleton edge
+
+deleteVertexCombineEdges :: forall e v.
+     (Ord v, Ord e)
+  => (e -> e -> e)
+  -> Digraph e v
+  -> (Idx, v)
+  -> Digraph e v
+deleteVertexCombineEdges combine graph (delIdx, delV) = graph{
+      vMap    = Map.delete delV graph.vMap
+    , idxMap  = IntMap.delete delIdx graph.idxMap
+    , edgeMap = IntMap.mapMaybeWithKey auxF graph.edgeMap
+    }
+  where
+    auxF :: Idx -> IntMap (Set e) -> Maybe (IntMap (Set e))
+    auxF fromIdx toMap
+      | fromIdx == delIdx = Nothing  -- Remove all edges from vertex to remove
+      | otherwise         = Just $
+          case IntMap.updateLookupWithKey (\_ _ -> Nothing) delIdx toMap of
+            (Nothing,    _)      -> toMap
+            -- Redirect edges to vertex to remove to targets of that vertex
+            (Just edges, toMap') ->
+              Foldable.foldl' auxE toMap' (Set.elems edges)
+
+    delToIdxEdges :: [(Idx, [e])]
+    delToIdxEdges = maybe [] (map (fmap Set.elems) . IntMap.toList) $
+      IntMap.lookup delIdx graph.edgeMap
+
+    auxE :: IntMap (Set e) -> e -> IntMap (Set e)
+    auxE toMap edge = Foldable.foldl' (auxC edge) toMap delToIdxEdges
+
+    auxC :: e -> IntMap (Set e) -> (Idx, [e]) -> IntMap (Set e)
+    auxC edge toMap (delToIdx, delEdges) =
+      let edges = Set.fromList $ map (combine edge) delEdges
+      in  IntMap.insertWith (<>) delToIdx edges toMap
+
+reaches' :: IntMap (IntMap (Set e)) -> [Idx] -> Set Idx
+reaches' edgeMap = aux Map.empty
+  where
+    aux :: Map Idx () -> [Idx] -> Set Idx
+    aux acc = \case
+      []         -> Map.keysSet acc
+      idx : idxs ->
+        case Map.insertLookupWithKey nop idx () acc of
+          (Just (), _)    -> aux acc idxs
+          (Nothing, acc') -> aux acc' $
+            maybe [] IntMap.keys (IntMap.lookup idx edgeMap) ++ idxs
+
+    nop :: k -> () -> () -> ()
+    nop _key () () = ()
+
+dfs' :: Digraph e v -> [Idx] -> [Tree Idx]
+dfs' graph fromIdxs
+    | graph.nextIdx == 0 = []
+    | otherwise          = run (0, graph.nextIdx - 1) $
+        \(contains :: Idx -> ST s Bool) (include  :: Idx -> ST s ()) ->
+          let aux :: [Idx] -> ST s [Tree Idx]
+              aux = \case
+                []         -> return []
+                idx : idxs -> contains idx >>= \case
+                  True  -> aux idxs
+                  False -> do
+                    include idx
+                    children <- aux $
+                      maybe [] IntMap.keys (IntMap.lookup idx graph.edgeMap)
+                    trees <- aux idxs
+                    return $ Tree.Node idx children : trees
+          in  aux fromIdxs
+  where
+    run ::
+         (Idx, Idx)
+      -> (forall s. (Idx -> ST s Bool) -> (Idx -> ST s ()) -> ST s x)
+      -> x
+    run bounds f = ST.runST $ do
+      m <- Array.newArray bounds False :: ST s (Array.STUArray s Idx Bool)
+      f (Array.readArray m) (\idx -> Array.writeArray m idx True)
+
+postorderTree :: Tree a -> [a]
+postorderTree tree = postorderForest tree.subForest ++ [tree.rootLabel]
+
+postorderForest :: [Tree a] -> [a]
+postorderForest = concatMap postorderTree
+
+scc' :: Digraph e v -> [Tree Idx]
+scc' graph =
+      dfs' graph
+    . reverse
+    . postorderForest
+    $ dfs' (transpose graph) (IntMap.keys graph.idxMap)
diff --git a/src-internal/HsBindgen.hs b/src-internal/HsBindgen.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen.hs
@@ -0,0 +1,481 @@
+module HsBindgen (
+    hsBindgenMacroLang
+
+    -- * Artefacts
+  , Artefact(..)
+
+    -- ** High-level artefacts
+  , writeIncludeGraph
+  , writeUseDeclGraph
+  , writeDoxygen
+  , getBindings
+  , getBindingsMultiple
+  , writeBindings
+  , writeBindingsSingle
+  , writeBindingsMultiple
+  , writeBindingSpec
+  , writeTests
+
+    -- ** Low-level artefacts
+  , getConfig
+  , getIncludeGraph
+  , getDeclIndex
+  , getUseDeclGraph
+  , getDeclUseGraph
+  , getOmittedTypes
+  , getReifiedC
+  , getSquashedTypes
+  , getDependencies
+  , getGetMainHeaders
+
+    -- * Errors
+  , BindgenError(..)
+
+    -- * Traces
+  , SafeTraceMsg(..)
+
+    -- * Test infrastructure
+  , hsBindgenEMacroLang
+  ) where
+
+import Control.Exception (Exception (..), catch)
+import Control.Monad.Except (MonadError (..), withExceptT)
+import Control.Monad.Trans.Except (runExceptT)
+import Data.Map qualified as Map
+import Data.Set qualified as Set
+import System.Exit (ExitCode (..), exitWith)
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.CStandard
+import Clang.Paths
+
+import HsBindgen.Artefact
+import HsBindgen.ArtefactM
+import HsBindgen.Backend
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.HsModule.Render
+import HsBindgen.Backend.HsModule.Translation
+import HsBindgen.Backend.HsModule.Translation.Doxygen (ExportTags,
+                                                       computeExportTags,
+                                                       resolveExports)
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.BindingSpec.Gen
+import HsBindgen.Boot
+import HsBindgen.Clang
+import HsBindgen.Config.Internal
+import HsBindgen.Errors (throwPure_TODO)
+import HsBindgen.Frontend
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Analysis.DeclUseGraph (DeclUseGraph)
+import HsBindgen.Frontend.Analysis.IncludeGraph (IncludeGraph)
+import HsBindgen.Frontend.Analysis.IncludeGraph qualified as IncludeGraph
+import HsBindgen.Frontend.Analysis.UseDeclGraph (UseDeclGraph)
+import HsBindgen.Frontend.Analysis.UseDeclGraph qualified as UseDeclGraph
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Frontend.ProcessIncludes qualified as ProcessIncludes
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+-- | Main entry point to run @hs-bindgen@.
+--
+-- For a list of build artefacts, see the description and constructors of
+-- 'Artefact'.
+hsBindgenMacroLang ::
+     Macro.HasTypes l
+  => (ClangCStandard -> IO (Macro.Lang l))
+  -> TracerConfig Level     TraceMsg
+  -> TracerConfig SafeLevel SafeTraceMsg
+  -> BindgenConfig
+  -> [C.UncheckedRootDirective]
+  -> Artefact l a
+  -> IO a
+hsBindgenMacroLang mkMacroLang tu ts b i a = do
+    eRes <- hsBindgenEMacroLang mkMacroLang tu ts b i a `catch` \e ->
+      case fromException e of
+        Just (LibclangException msg) -> do
+          print $ PP.string msg
+          -- We specifically use exit code 3 here; it means that the call to
+          -- `libclang` has failed.
+          exitWith (ExitFailure 3)
+        _ -> throwIO e
+    case eRes of
+      Left err -> do
+        print $ prettyForTrace err
+        -- We specifically use exit code 4 here; it means that `hs-bindgen` ran
+        -- to completion, but an error has occurred.
+        exitWith (ExitFailure 4)
+      Right r -> pure r
+
+-- | Like 'hsBindgen' but does not exit with failure when an error has occurred.
+hsBindgenEMacroLang ::
+     forall a l. Macro.HasTypes l
+  => (ClangCStandard -> IO (Macro.Lang l))
+  -> TracerConfig Level     TraceMsg
+  -> TracerConfig SafeLevel SafeTraceMsg
+  -> BindgenConfig
+  -> [C.UncheckedRootDirective]
+  -> Artefact l a
+  -> IO (Either BindgenError a)
+hsBindgenEMacroLang
+  mkMacroLang
+  tracerConfigUnsafe
+  tracerConfigSafe
+  config
+  uncheckedRootDirectives
+  artefacts = do
+    eRes <- withTracer tracerConfigUnsafe $ \tracerUnsafe -> do
+      -- 1. Boot.
+      let tracerBoot :: Tracer BootMsg
+          tracerBoot = contramap TraceBoot tracerUnsafe
+      bootArtefact <-
+        runBoot tracerBoot mkMacroLang config uncheckedRootDirectives
+      -- 2. Frontend.
+      let tracerFrontend :: Tracer FrontendMsg
+          tracerFrontend = contramap TraceFrontend tracerUnsafe
+      frontendArtefact <-
+        runFrontend tracerFrontend config.frontend bootArtefact
+      -- 3. Backend.
+      let tracerConfigBackend :: TracerConfig SafeLevel BackendMsg
+          tracerConfigBackend = contramap SafeBackendMsg tracerConfigSafe
+      backendArtefact <-
+        withTracerSafe tracerConfigBackend  $ \tracerSafe ->
+          runBackend tracerSafe config bootArtefact frontendArtefact
+      -- 4. Artefacts.
+      let tracerConfigArtefact :: TracerConfig SafeLevel ArtefactMsg
+          tracerConfigArtefact = contramap SafeArtefactMsg tracerConfigSafe
+      withTracerSafe tracerConfigArtefact $ \tracerSafe ->
+        runArtefacts
+          tracerSafe
+          config
+          bootArtefact
+          frontendArtefact
+          backendArtefact
+          artefacts
+
+    let tracerConfigDelayedIO :: TracerConfig SafeLevel DelayedIOMsg
+        tracerConfigDelayedIO = contramap SafeDelayedIOMsg tracerConfigSafe
+    runExceptT $ withTracerSafe tracerConfigDelayedIO $ \tracerSafe ->
+      case eRes of
+        Left er       -> throwError $ BindgenErrorReported er
+        Right (r, as) -> do
+          -- Before creating directories or writing output files, we verify
+          -- adherence to the provided policies.
+          withExceptT BindgenDelayedIOError $ mapM_ checkPolicy as
+          liftIO $ executeDelayedIOActions tracerSafe as
+          pure r
+
+{-------------------------------------------------------------------------------
+  High-level artefacts
+-------------------------------------------------------------------------------}
+
+-- | Write the include graph to @STDOUT@ or a file.
+writeIncludeGraph ::
+     Boolean Regex
+  -> IncludeGraph.HeaderLabelStyle
+  -> IncludeGraph.IncludeGraphFormat
+  -> FilePolicy
+  -> DirPolicy
+  -> Maybe FilePath
+  -> Artefact l ()
+writeIncludeGraph regex labelStyle format filePolicy dirPolicy mPath = do
+    includeGraph <- getIncludeGraph
+    let predicateUser :: RealPath -> Bool
+        predicateUser rp = eval (\r -> matchTest r (getRealPathText rp)) regex
+        opts = IncludeGraph.VisOpts{
+            predicate  = predicateUser
+          , labelStyle = labelStyle
+          }
+        rendered = case format of
+          IncludeGraph.SortedList -> IncludeGraph.renderSortedList opts includeGraph
+          IncludeGraph.Mermaid    -> IncludeGraph.renderMermaid    opts includeGraph
+    case mPath of
+      Nothing   ->
+        Lift $ delay $ WriteToStdOut $ StringContent rendered
+      Just path ->
+        write filePolicy dirPolicy "include graph" (UserSpecified path) rendered
+
+-- | Write @use-decl@ graph to file.
+writeUseDeclGraph :: FilePolicy -> DirPolicy -> Maybe FilePath -> Artefact l ()
+writeUseDeclGraph filePolicy dirPolicy mPath = do
+    useDeclGraph <- getUseDeclGraph
+    let rendered = UseDeclGraph.renderMermaid useDeclGraph
+    case mPath of
+      Nothing   ->
+        Lift $ delay $ WriteToStdOut $ StringContent rendered
+      Just path ->
+        write filePolicy dirPolicy "use-decl graph" (UserSpecified path) rendered
+
+-- | Write the parsed doxygen state to @STDOUT@ or a file.
+writeDoxygen :: FilePolicy -> DirPolicy -> Maybe FilePath -> Artefact l ()
+writeDoxygen filePolicy dirPolicy mPath = do
+    doxy <- DoxygenA
+    let rendered = show doxy
+    case mPath of
+      Nothing   ->
+        Lift $ delay $ WriteToStdOut $ StringContent rendered
+      Just path ->
+        write filePolicy dirPolicy "doxygen" (UserSpecified path) rendered
+
+-- | Get bindings (single module).
+getBindings :: ModuleRenderConfig -> Artefact l String
+getBindings mrc = do
+    name   <- ModuleBaseName
+    dirs   <- RootDirectives
+    decls  <- FinalDecls
+    tags   <- getExportTags
+    when (all nullDecls decls) $ EmitTrace $ NoBindingsSingleModule name
+    config <- getConfig
+    let fns = config.frontend.fieldNamingStrategy
+    pure $ render $
+      translateModuleSingle fns mrc dirs name (resolveExports tags) decls
+
+-- | Write bindings to file.
+writeBindings ::
+     ModuleRenderConfig
+  -> FilePolicy
+  -> DirPolicy
+  -> FilePath
+  -> Artefact l ()
+writeBindings mrc filePolicy dirPolicy path = do
+    bindings <- getBindings mrc
+    write filePolicy dirPolicy "bindings" (UserSpecified path) bindings
+
+-- | Write bindings to a directory (single module combining all categories).
+--
+-- Unlike 'writeBindings', this writes to a directory and automatically
+-- constructs the file path from the module name, similar to
+-- 'writeBindingsMultiple' but generating only one file.
+writeBindingsSingle ::
+     ModuleRenderConfig
+  -> FilePolicy
+  -> DirPolicy
+  -> FilePath
+  -> Artefact l ()
+writeBindingsSingle mrc filePolicy dirPolicy hsOutputDir = do
+    moduleBaseName <- ModuleBaseName
+    bindings       <- getBindings mrc
+    let localPath :: FilePath
+        localPath = Hs.moduleNamePath $
+            fromBaseModuleName moduleBaseName Nothing
+
+        location :: FileLocation
+        location = RelativeFileLocation RelativeToOutputDir{
+              outputDir = hsOutputDir
+            , localPath = localPath
+            }
+
+    write filePolicy dirPolicy "bindings" location bindings
+
+-- | Get bindings (one module per binding category).
+getBindingsMultiple :: ModuleRenderConfig -> Artefact l (ByCategory_ (Maybe String))
+getBindingsMultiple mrc = do
+    name   <- ModuleBaseName
+    dirs   <- RootDirectives
+    decls  <- FinalDecls
+    tags   <- getExportTags
+    when (all nullDecls decls) $
+      EmitTrace $ NoBindingsMultipleModules name
+    config <- getConfig
+    let fns = config.frontend.fieldNamingStrategy
+    pure $ fmap render <$>
+      translateModuleMultiple fns mrc dirs name (resolveExports tags) decls
+
+-- | Write bindings to files in provided output directory.
+--
+-- Each file contains a different binding category.
+--
+-- If no file is given, print to standard output.
+writeBindingsMultiple ::
+     ModuleRenderConfig
+  -> FilePolicy
+  -> DirPolicy
+  -> FilePath
+  -> Artefact l ()
+writeBindingsMultiple mrc filePolicy dirPolicy hsOutputDir = do
+    moduleBaseName     <- ModuleBaseName
+    bindingsByCategory <- getBindingsMultiple mrc
+    writeByCategory
+      filePolicy
+      dirPolicy
+      "Bindings"
+      hsOutputDir
+      moduleBaseName
+      bindingsByCategory
+
+-- | Write binding specifications to file.
+writeBindingSpec ::
+     FilePolicy
+  -> DirPolicy
+  -> FilePath
+  -> Artefact l ()
+writeBindingSpec filePolicy dirPolicy path = do
+    moduleBaseName <- ModuleBaseName
+    includeGraph   <- getIncludeGraph
+    declIndex      <- getDeclIndex
+    getMainHeaders <- getGetMainHeaders
+    omittedTypes   <- getOmittedTypes
+    squashedTypes  <- getSquashedTypes
+    hsDecls        <- HsDecls
+    -- Binding specifications only specify types.
+    let bs =
+          genBindingSpec
+            (BindingSpec.getFormat path)
+            (fromBaseModuleName moduleBaseName (Just CType))
+            includeGraph
+            declIndex
+            getMainHeaders
+            omittedTypes
+            squashedTypes
+            (view (lensForCategory CType) hsDecls)
+        fileDescription = FileDescription {
+              description = "Binding specifications"
+            , location    = UserSpecified path
+            , filePolicy  = filePolicy
+            , dirPolicy   = dirPolicy
+            , content     = ByteStringContent bs
+            }
+    Lift $ delay $ WriteToFile fileDescription
+
+-- | Create test suite in directory.
+writeTests :: FilePath -> Artefact l ()
+writeTests _testDir = do
+    -- moduleBaseName  <- ModuleBaseName
+    -- rootDirectives  <- RootDirectives
+    -- hsDecls         <- HsDecls
+    -- liftIO $
+    --   genTests
+    --     rootDirectives
+    --     hsDecls
+    --     moduleBaseName
+    --     testDir
+    throwPure_TODO 22 "Test generation integrated into the artefact API"
+
+{-------------------------------------------------------------------------------
+  Low-level artefacts
+-------------------------------------------------------------------------------}
+
+getConfig :: Artefact l BindgenConfig
+getConfig = Lift askConfig
+
+getGetMainHeaders :: Artefact l ProcessIncludes.GetMainHeaders
+getGetMainHeaders = (.getMainHeaders) <$> ParseInfoA
+
+getIncludeGraph :: Artefact l IncludeGraph
+getIncludeGraph = (.includeGraph) <$> ParseInfoA
+
+getDeclIndex :: Artefact l (DeclIndex l)
+getDeclIndex = (.meta.declIndex) <$> FrontendPassA FinalPass
+
+getUseDeclGraph :: Artefact l UseDeclGraph
+getUseDeclGraph = (.meta.useDeclGraph) <$> FrontendPassA FinalPass
+
+getDeclUseGraph :: Artefact l DeclUseGraph
+getDeclUseGraph = (.meta.declUseGraph) <$> FrontendPassA FinalPass
+
+getOmittedTypes :: Artefact l [(C.DeclId, RealPath)]
+getOmittedTypes =
+    Map.toList . DeclIndex.getOmitted <$> getDeclIndex
+
+getReifiedC :: Artefact l [C.Decl l Final]
+getReifiedC = (.decls) <$> FrontendPassA FinalPass
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1549>
+-- When we properly record aliases, we may not need this anymore.
+getSquashedTypes :: Artefact l [(C.DeclId, (RealPath, Hs.Name Hs.NsTypeConstr))]
+getSquashedTypes = do
+  decls <- getReifiedC
+  let translatedDeclIds = Set.fromList $ map (.info.id.cName) decls
+  declIndex <- getDeclIndex
+  pure $ Map.toList $ DeclIndex.getSquashed declIndex translatedDeclIds
+
+getDependencies :: Artefact l [RealPath]
+getDependencies = IncludeGraph.toSortedList <$> getIncludeGraph
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+write :: FilePolicy -> DirPolicy -> String -> FileLocation -> String -> Artefact l ()
+write filePolicy dirPolicy what loc str
+  | null str =
+    EmitTrace $ SkipWriteToFileNoBindings loc
+  | otherwise =
+    Lift $ delay $
+      WriteToFile $ FileDescription what loc filePolicy dirPolicy (StringContent str)
+
+writeByCategory ::
+     FilePolicy
+  -> DirPolicy
+  -> String
+  -> FilePath
+  -> BaseModuleName
+  -> ByCategory_ (Maybe String)
+  -> Artefact l ()
+writeByCategory filePolicy dirPolicy what dir moduleBaseName =
+    sequence_ . mapWithCategory_ writeCategory
+  where
+    writeCategory :: Category -> Maybe String -> Artefact l ()
+    writeCategory _    Nothing   = pure ()
+    writeCategory cat (Just str) =
+        write filePolicy dirPolicy whatWithCategory location str
+      where
+        localPath :: FilePath
+        localPath = Hs.moduleNamePath $
+            fromBaseModuleName moduleBaseName (Just cat)
+
+        whatWithCategory :: String
+        whatWithCategory = what ++ " (" ++ show cat ++ ")"
+
+        location :: FileLocation
+        location = RelativeFileLocation RelativeToOutputDir{
+              outputDir = dir
+            , localPath = localPath
+            }
+
+nullDecls :: ([a], [b]) -> Bool
+nullDecls (xs, ys) = null xs && null ys
+
+{-------------------------------------------------------------------------------
+  Export tags
+-------------------------------------------------------------------------------}
+
+-- | Fetch doxygen data and final C declarations, then precompute export tags.
+getExportTags :: Artefact l ExportTags
+getExportTags = do
+    doxy  <- DoxygenA
+    final <- FrontendPassA FinalPass
+    pure $ computeExportTags doxy final.decls
+
+{-------------------------------------------------------------------------------
+  Errors
+-------------------------------------------------------------------------------}
+
+data BindgenError =
+      BindgenErrorReported  AnErrorHappened
+    | BindgenDelayedIOError DelayedIOError
+    deriving stock (Show)
+
+instance PrettyForTrace BindgenError where
+  prettyForTrace = \case
+    BindgenErrorReported  e -> prettyForTrace e
+    BindgenDelayedIOError e -> prettyForTrace e
+
+{-------------------------------------------------------------------------------
+  Traces
+-------------------------------------------------------------------------------}
+
+data SafeTraceMsg =
+      SafeBackendMsg   BackendMsg
+    | SafeArtefactMsg  ArtefactMsg
+    | SafeDelayedIOMsg DelayedIOMsg
+  deriving (Show, Generic, PrettyForTrace, IsTrace SafeLevel)
diff --git a/src-internal/HsBindgen/Artefact.hs b/src-internal/HsBindgen/Artefact.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Artefact.hs
@@ -0,0 +1,194 @@
+module HsBindgen.Artefact (
+    -- * Frontend passes
+    FrontendPass(..)
+    -- * Artefacts
+  , Artefact(..)
+  , runArtefacts
+  , ArtefactMsg(..)
+  )
+where
+
+import Control.Monad (liftM)
+import Text.SimplePrettyPrint ((<+>), (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.ArtefactM
+import HsBindgen.Backend
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.CallConv (CWrapper)
+import HsBindgen.Backend.SHs.AST qualified as SHs
+import HsBindgen.Boot
+import HsBindgen.Config
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend
+import HsBindgen.Frontend.Pass.AdjustTypes.IsPass (AdjustTypes)
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.EnrichComments.IsPass (EnrichComments)
+import HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass (FillUnnamedIds)
+import HsBindgen.Frontend.Pass.Final (Final)
+import HsBindgen.Frontend.Pass.MangleNames.IsPass (MangleNames)
+import HsBindgen.Frontend.Pass.Parse.IsPass (Parse)
+import HsBindgen.Frontend.Pass.Parse.Result (ParseResult)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass (ReparseMacroExpansions)
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass (ResolveBindingSpecs)
+import HsBindgen.Frontend.Pass.Select.IsPass (Select)
+import HsBindgen.Frontend.Pass.SimplifyAST.IsPass (SimplifyAST)
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass (TypecheckMacros)
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Util.Tracer
+
+import Doxygen.Parser (Doxygen)
+
+{-------------------------------------------------------------------------------
+  Frontend passes
+-------------------------------------------------------------------------------}
+
+-- | Frontend passes
+--
+-- Each constructor corresponds to a frontend pass carrying the result type of
+-- that pass. See "HsBindgen.Frontend" for the pass ordering and descriptions.
+data FrontendPass (l :: Star) (result :: Star) where
+  ParsePass
+    :: FrontendPass l [ParseResult       l Parse]
+  SimplifyASTPass
+    :: FrontendPass l [ParseResult       l SimplifyAST]
+  FillUnnamedIdsPass
+    :: FrontendPass l [ParseResult       l FillUnnamedIds]
+  EnrichCommentsPass
+    :: FrontendPass l [ParseResult       l EnrichComments]
+  ConstructTranslationUnitPass
+    :: FrontendPass l (C.TranslationUnit l ConstructTranslationUnit)
+  TypecheckMacrosPass
+    :: FrontendPass l (C.TranslationUnit l TypecheckMacros)
+  ReparseMacroExpansionsPass
+    :: FrontendPass l (C.TranslationUnit l ReparseMacroExpansions)
+  ResolveBindingSpecsPass
+    :: FrontendPass l (C.TranslationUnit l ResolveBindingSpecs)
+  MangleNamesPass
+    :: FrontendPass l (C.TranslationUnit l MangleNames)
+  AdjustTypesPass
+    :: FrontendPass l (C.TranslationUnit l AdjustTypes)
+  SelectPass
+    :: FrontendPass l (C.TranslationUnit l Select)
+  FinalPass
+    :: FrontendPass l (C.TranslationUnit l Final)
+
+{-------------------------------------------------------------------------------
+  Artefact
+-------------------------------------------------------------------------------}
+
+-- | Build artefact.
+data Artefact l (a :: Star) where
+  -- * Boot
+  RootDirectives  :: Artefact l [C.RootDirective C.HashIncludeArg]
+  ModuleBaseName  :: Artefact l BaseModuleName
+  -- * Frontend
+  ParseInfoA      :: Artefact l ParseInfo
+  DoxygenA        :: Artefact l Doxygen
+  FrontendPassA   :: FrontendPass l result -> Artefact l result
+  -- * Backend
+  HsDecls         :: Artefact l (ByCategory_ [Hs.Decl l])
+  FinalDecls      :: Artefact l (ByCategory_ ([CWrapper], [SHs.SDecl]))
+  -- * Control flow
+  EmitTrace       :: ArtefactMsg -> Artefact l ()
+  Lift            :: ArtefactM a -> Artefact l a
+  Bind            :: Artefact l b -> (b -> Artefact l c) -> Artefact l c
+
+instance Functor (Artefact l) where
+  fmap :: (a -> b) -> Artefact l a -> Artefact l b
+  fmap = liftM
+
+instance Applicative (Artefact l) where
+  pure :: a -> Artefact l a
+  pure = Lift . pure
+
+  (<*>) :: Artefact l (a -> b) -> Artefact l a -> Artefact l b
+  (<*>) = ap
+
+instance Monad (Artefact l) where
+  (>>=) :: Artefact l a -> (a -> Artefact l b) -> Artefact l b
+  (>>=) = Bind
+
+{-------------------------------------------------------------------------------
+  Run artefacts
+-------------------------------------------------------------------------------}
+
+-- | Compute the results of a list of artefacts.
+--
+-- All top-level artefacts will be cached (this is not true for computed
+-- artefacts, using, for example, the 'Functor' interface, or 'Lift').
+runArtefacts :: forall a l.
+     Tracer ArtefactMsg
+  -> BindgenConfig
+  -> BootArtefact l
+  -> FrontendArtefact l
+  -> BackendArtefact l
+  -> Artefact l a
+  -> IO (a, [DelayedIO])
+runArtefacts tracer config boot frontend backend artefact =
+    second reverse <$> (runArtefactM (runArtefact artefact) config)
+  where
+    runArtefact :: forall x. Artefact l x -> ArtefactM x
+    runArtefact = \case
+        --Boot.
+        RootDirectives  -> runCached boot.rootDirectives
+        ModuleBaseName  -> pure boot.baseModule
+        -- Frontend.
+        ParseInfoA      -> runCached frontend.parseMeta
+        DoxygenA        -> runCached frontend.doxygen
+        FrontendPassA p -> runFrontendPass p
+        -- Backend.
+        HsDecls         -> runCached backend.hsDecls
+        FinalDecls      -> runCached backend.finalDecls
+        -- Control flow
+        (EmitTrace x)   -> emitTrace tracer x
+        (Lift   f)      -> f
+        (Bind x f)      -> runArtefact x >>= runArtefact . f
+
+    runFrontendPass :: FrontendPass l result -> ArtefactM result
+    runFrontendPass = \case
+        ParsePass                    -> runCached frontend.parse
+        SimplifyASTPass              -> runCached frontend.simplifyAST
+        FillUnnamedIdsPass           -> runCached frontend.fillUnnamedIds
+        EnrichCommentsPass           -> runCached frontend.enrichComments
+        ConstructTranslationUnitPass -> runCached frontend.constructTranslationUnit
+        TypecheckMacrosPass          -> runCached frontend.typecheckMacros
+        ReparseMacroExpansionsPass   -> runCached frontend.reparseMacroExpansions
+        ResolveBindingSpecsPass      -> runCached frontend.resolveBindingSpecs
+        MangleNamesPass              -> runCached frontend.mangleNames
+        AdjustTypesPass              -> runCached frontend.adjustTypes
+        SelectPass                   -> runCached frontend.select
+        FinalPass                    -> runCached frontend.final
+
+{-------------------------------------------------------------------------------
+  Traces
+-------------------------------------------------------------------------------}
+
+data ArtefactMsg =
+      NoBindingsSingleModule BaseModuleName
+    | NoBindingsMultipleModules BaseModuleName
+    | SkipWriteToFileNoBindings FileLocation
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace ArtefactMsg where
+  prettyForTrace = \case
+    NoBindingsSingleModule md ->
+      "No output generated (module " <+> PP.show md <+> " is empty)"
+    NoBindingsMultipleModules md ->
+      "No output generated (all binding categories with base module name" <+> PP.show md <+> "are empty)"
+    SkipWriteToFileNoBindings fp ->
+      "Skipping 'write file' operation (" >< PP.show fp >< "): file is empty"
+
+instance IsTrace SafeLevel ArtefactMsg where
+  getDefaultLogLevel = \case
+    NoBindingsSingleModule{}    -> SafeNotice
+    NoBindingsMultipleModules{} -> SafeNotice
+    SkipWriteToFileNoBindings{} -> SafeNotice
+  getSource = const HsBindgen
+  getTraceId = \case
+    NoBindingsSingleModule{}    -> "artefact-no-bindings-single"
+    NoBindingsMultipleModules{} -> "artefact-no-bindings-multiple"
+    SkipWriteToFileNoBindings{} -> "artefact-skip-write-file"
diff --git a/src-internal/HsBindgen/ArtefactM.hs b/src-internal/HsBindgen/ArtefactM.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/ArtefactM.hs
@@ -0,0 +1,211 @@
+module HsBindgen.ArtefactM (
+    -- * Policies
+    FilePolicy(..)
+  , DirPolicy(..)
+  , checkPolicy
+    -- * File description
+  , FileDescription(..)
+  , FileLocation(..)
+  , fileLocationToPath
+  , RelativeToOutputDir(..)
+  , FileContent(..)
+    -- * ArtefactM monad
+  , ArtefactM -- opaque
+  , runArtefactM
+  , askConfig
+  , runCached
+  , emitTrace
+    -- ** Actions
+  , delay
+  , DelayedIO(..)
+  , executeDelayedIOActions
+    -- * Errors
+  , DelayedIOError(..)
+    -- * Traces
+  , DelayedIOMsg(..)
+  ) where
+
+import Control.Monad.Except (ExceptT, MonadError (..))
+import Control.Monad.Reader (MonadReader (..), ReaderT (..))
+import Control.Monad.State (StateT (..), modify)
+import Data.ByteString (ByteString)
+import Data.ByteString qualified as BSS
+import System.Directory qualified as Dir
+import System.FilePath (takeDirectory, (</>))
+import Text.SimplePrettyPrint ((<+>))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Cache
+import HsBindgen.Config.Internal
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Policies
+-------------------------------------------------------------------------------}
+
+data FilePolicy
+  = AllowFileOverwrite
+  | DoNotOverwriteFiles
+  deriving (Show, Eq)
+
+data DirPolicy
+  = CreateOutputDirs
+  | DoNotCreateOutputDirs
+  deriving (Show, Eq)
+
+checkPolicy :: DelayedIO -> ExceptT DelayedIOError IO ()
+checkPolicy = \case
+  WriteToStdOut{} -> pure ()
+  WriteToFile fd -> case fd.location of
+    UserSpecified path -> do
+      let baseDir = takeDirectory path
+      dirExists  <- liftIO $ Dir.doesDirectoryExist baseDir
+      fileExists <- liftIO $ Dir.doesFileExist path
+      unless (dirExists || fd.dirPolicy == CreateOutputDirs) $
+        throwError $ DirectoryDoesNotExist baseDir
+      when (fileExists && fd.filePolicy == DoNotOverwriteFiles) $
+        throwError $ FileAlreadyExists path
+    RelativeFileLocation relative -> do
+      let path = relative.outputDir </> relative.localPath
+      dirExists  <- liftIO $ Dir.doesDirectoryExist relative.outputDir
+      fileExists <- liftIO $ Dir.doesFileExist path
+      unless (dirExists || fd.dirPolicy == CreateOutputDirs) $
+        throwError $ DirectoryDoesNotExist relative.outputDir
+      when (fileExists && fd.filePolicy == DoNotOverwriteFiles) $
+        throwError $ FileAlreadyExists path
+
+{-------------------------------------------------------------------------------
+  File description
+-------------------------------------------------------------------------------}
+
+data FileDescription = FileDescription {
+      description :: String
+    , location    :: FileLocation
+    , filePolicy  :: FilePolicy
+    , dirPolicy   :: DirPolicy
+    , content     :: FileContent
+    }
+
+data FileLocation =
+      UserSpecified FilePath
+    | RelativeFileLocation RelativeToOutputDir
+  deriving stock (Show, Generic)
+
+data RelativeToOutputDir = RelativeToOutputDir {
+      outputDir :: FilePath
+    , localPath :: FilePath
+    }
+  deriving stock (Show, Generic)
+
+fileLocationToPath :: FileLocation -> FilePath
+fileLocationToPath = \case
+    UserSpecified p -> p
+    RelativeFileLocation relative -> relative.outputDir </> relative.localPath
+
+-- | Content to be written to a file
+--
+data FileContent =
+    StringContent     String
+  | ByteStringContent ByteString
+  deriving Show
+
+{-------------------------------------------------------------------------------
+  ArtefactM monad
+-------------------------------------------------------------------------------}
+
+newtype ArtefactM a =
+  WrapArtefactM (StateT [DelayedIO] (ReaderT BindgenConfig IO) a)
+  deriving newtype (
+      Functor
+    , Applicative
+    , Monad
+    , MonadReader BindgenConfig
+    )
+
+runArtefactM :: ArtefactM a -> BindgenConfig -> IO (a, [DelayedIO])
+runArtefactM (WrapArtefactM ma) = runReaderT (runStateT ma [])
+
+askConfig :: ArtefactM BindgenConfig
+askConfig = ask
+
+-- | Private (i.e., /not public/) API :-).
+unsafeIO :: IO a -> ArtefactM a
+unsafeIO = WrapArtefactM . liftIO
+
+-- | Emit a trace while running artefacts.
+emitTrace :: Tracer a -> a -> ArtefactM ()
+emitTrace t = unsafeIO . traceWith t . withCallStack
+
+runCached :: Cached a -> ArtefactM a
+runCached = unsafeIO . getCached
+
+{-------------------------------------------------------------------------------
+  Actions
+-------------------------------------------------------------------------------}
+
+-- | Register a delayed IO action. The action will only be performed if the
+--   artefacts are obtained without Error traces, and if the output policies
+--   are met.
+delay :: DelayedIO -> ArtefactM ()
+delay a = WrapArtefactM $ modify (a :)
+
+-- | Delayed IO action
+data DelayedIO =
+      WriteToStdOut  FileContent
+    | WriteToFile    FileDescription
+
+executeDelayedIOActions :: Tracer DelayedIOMsg -> [DelayedIO] -> IO ()
+executeDelayedIOActions tracer as =
+  forM_ as $ \case
+    WriteToStdOut x -> case x of
+      StringContent     s  -> putStrLn s
+      ByteStringContent bs -> BSS.putStr bs
+    WriteToFile  fd -> do
+      let path = fileLocationToPath fd.location
+      traceWith tracer $ withCallStack $ DelayedIOWriteToFile path fd.description
+      -- Creating the directory is justified by checking the policy first.
+      Dir.createDirectoryIfMissing True (takeDirectory path)
+      case fd.content of
+        StringContent     s  -> writeFile path s
+        ByteStringContent bs -> BSS.writeFile path bs
+
+{-------------------------------------------------------------------------------
+  Errors
+-------------------------------------------------------------------------------}
+
+data DelayedIOError =
+      DirectoryDoesNotExist FilePath
+    | FileAlreadyExists     FilePath
+  deriving Show
+
+instance PrettyForTrace DelayedIOError where
+  prettyForTrace = \case
+    DirectoryDoesNotExist fp -> PP.vsep [
+        "Output directory does not exist:" <+> PP.string fp
+      , "Use --create-output-dirs to create it automatically, or create the directory manually."
+      ]
+    FileAlreadyExists fp -> PP.vsep [
+        "Output file already exists:" <+> PP.string fp
+      , "Use --overwrite-files to allow overwriting existing files, or delete the file manually."
+      ]
+
+{-------------------------------------------------------------------------------
+  Traces
+-------------------------------------------------------------------------------}
+
+data DelayedIOMsg =
+      DelayedIOWriteToFile FilePath String
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace DelayedIOMsg where
+  prettyForTrace = \case
+    DelayedIOWriteToFile path what ->
+      "Writing" <+> PP.show what <+> "to file" <+> PP.show path
+
+instance IsTrace SafeLevel DelayedIOMsg where
+  getDefaultLogLevel = \case
+    DelayedIOWriteToFile{} -> SafeInfo
+  getSource = const HsBindgen
+  getTraceId = \case
+    DelayedIOWriteToFile{} -> "delayedio-write-file"
diff --git a/src-internal/HsBindgen/Backend.hs b/src-internal/HsBindgen/Backend.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend.hs
@@ -0,0 +1,95 @@
+module HsBindgen.Backend
+  ( runBackend
+  , BackendArtefact(..)
+  , BackendMsg(..)
+  ) where
+
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Category.ApplyChoice
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Translation qualified as Hs
+import HsBindgen.Backend.SHs.AST qualified as SHs
+import HsBindgen.Backend.SHs.Simplify qualified as SHs
+import HsBindgen.Backend.SHs.Translation qualified as SHs
+import HsBindgen.Boot
+import HsBindgen.Cache
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.Util.Tracer
+
+-- | The backend translates the parsed C declarations in to Haskell
+-- declarations.
+--
+-- The backend is pure and should not emit warnings or errors.
+runBackend ::
+     forall l. Macro.HasTypes l
+  => Tracer BackendMsg
+  -> BindgenConfig
+  -> BootArtefact l
+  -> FrontendArtefact l
+  -> IO (BackendArtefact l)
+runBackend tracer config boot frontend = do
+    -- 1. Reified C declarations to @Hs@ declarations.
+    backendHsDeclsAll <- cache "hsDeclsAll" $ do
+      final     <- frontend.final
+      macroLang <- boot.macroLang
+      let declIndex :: DeclIndex l
+          declIndex = final.meta.declIndex
+
+          cDecls :: [C.Decl l Final]
+          cDecls = final.decls
+      pure $ Hs.generateDeclarations
+        macroLang
+        config.backend.uniqueId
+        boot.baseModule
+        declIndex
+        cDecls
+
+    -- 2. Apply binding category choice.
+    backendHsDecls <- cache "hsDecls" $ do
+      decls <- backendHsDeclsAll
+      pure $ applyBindingCategoryChoice config.backend.categoryChoice decls
+
+    -- 3. @Hs@ declarations to simple @Hs@ declarations.
+    sHsDecls <- cache "sHsDecls" $ do
+      macroLang <- boot.macroLang
+      SHs.translateDecls macroLang <$> backendHsDecls
+
+    -- 4. Simplify.
+    backendFinalDecls <- cache "finalDecls" $ SHs.simplifySHs <$> sHsDecls
+
+    pure $ BackendArtefact {
+        hsDecls             = backendHsDecls
+      , finalDecls          = backendFinalDecls
+      }
+  where
+    cache :: String -> Cached a -> IO (Cached a)
+    cache = cacheWith (contramap BackendCache tracer) . Just
+
+{-------------------------------------------------------------------------------
+  Backend
+-------------------------------------------------------------------------------}
+
+data BackendArtefact l = BackendArtefact {
+      hsDecls    :: Cached (ByCategory_ [Hs.Decl l])
+    , finalDecls :: Cached (ByCategory_ ([CWrapper], [SHs.SDecl]))
+    }
+
+{-------------------------------------------------------------------------------
+  Trace
+-------------------------------------------------------------------------------}
+
+-- | Frontend trace messages
+--
+-- Most passes in the frontend have their own set of trace messages.
+data BackendMsg = BackendCache CacheMsg
+  deriving stock    (Show, Generic)
+  deriving anyclass (PrettyForTrace, IsTrace SafeLevel)
diff --git a/src-internal/HsBindgen/Backend/Category.hs b/src-internal/HsBindgen/Backend/Category.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Category.hs
@@ -0,0 +1,209 @@
+-- | This module is intended for unqualified import because some declarations
+-- | are reexported from the public Template Haskell interface.
+module HsBindgen.Backend.Category (
+    -- * Binding categories
+    TermCategory(..)
+  , Category(..)
+  , allCategories
+  , ByCategory(..)
+  , mapWithCategory
+  , ByCategory_(..)
+  , mapWithCategory_
+  , lensForCategory
+  , lensForTermCategory
+    -- * Binding category choices
+  , RenameTerm(..)
+  , Choice(..)
+  , useSafeCategory
+  , useUnsafeCategory
+  , useFunPtrCategory
+  ) where
+
+import Data.Functor.Const (Const (..))
+import Optics.Core (Lens', iso)
+import Optics.Iso (Iso')
+
+import HsBindgen.Backend.Level
+import HsBindgen.Imports hiding (toList)
+
+data TermCategory =
+    -- | Foreign import bindings with a @safe@ foreign import modifier.
+    CSafe
+    -- | Foreign import bindings with an @unsafe@ foreign import modifier.
+  | CUnsafe
+    -- | Pointers to functions; generally @unsafe@.
+  | CFunPtr
+    -- | Temporary category for bindings to global variables or constants.
+  | CGlobal
+  deriving stock (Show, Eq, Ord, Enum, Bounded)
+
+-- | Binding category.
+data Category =
+    -- | Types (top-level bindings).
+    CType
+  | CTerm TermCategory
+  deriving stock (Show, Eq, Ord)
+
+allCategories :: NonEmpty Category
+allCategories = CType :| map CTerm [minBound .. maxBound]
+
+-- | Like 'Data.Map.Strict.mapWithKey'.
+mapWithCategory ::
+     (f LvlType -> g LvlType)
+  -> (TermCategory -> f LvlTerm -> g LvlTerm)
+  -> ByCategory f
+  -> ByCategory g
+mapWithCategory f g x = ByCategory {
+      cType   = f         x.cType
+    , cSafe   = g CSafe   x.cSafe
+    , cUnsafe = g CUnsafe x.cUnsafe
+    , cFunPtr = g CFunPtr x.cFunPtr
+    , cGlobal = g CGlobal x.cGlobal
+    }
+
+-- | A strict, total map from 'Category' to @a@.
+type ByCategory :: (Level -> Star) -> Star
+data ByCategory f = ByCategory {
+      cType   :: !(f LvlType)
+    , cSafe   :: !(f LvlTerm)
+    , cUnsafe :: !(f LvlTerm)
+    , cFunPtr :: !(f LvlTerm)
+    , cGlobal :: !(f LvlTerm)
+  }
+  deriving stock (Generic)
+
+deriving instance (Eq (f LvlType),   Eq (f LvlTerm))         => Eq (ByCategory f)
+deriving instance (Show (f LvlType), Show (f LvlTerm))       => Show (ByCategory f)
+deriving instance (Default (f LvlType), Default (f LvlTerm)) => Default (ByCategory f)
+
+newtype ByCategory_ a = ByCategory_ (ByCategory (Const a))
+  deriving stock (Show, Eq, Generic)
+
+getByCategory_ :: ByCategory_ a -> ByCategory (Const a)
+getByCategory_ (ByCategory_ x) = x
+
+instance Functor ByCategory_ where
+  fmap f (ByCategory_ x) = ByCategory_ $
+    mapWithCategory (applyConst f) (\_ -> applyConst f) x
+
+mapWithCategory_ :: (Category -> a -> b) -> ByCategory_ a -> ByCategory_ b
+mapWithCategory_ f (ByCategory_ x) =
+  ByCategory_ $ mapWithCategory (applyConst (f CType)) (applyConst . f . CTerm) x
+
+toList :: ByCategory_ a -> [a]
+toList (ByCategory_ (ByCategory t s u f g)) = [
+      getConst t
+    , getConst s
+    , getConst u
+    , getConst f
+    , getConst g
+    ]
+
+instance Foldable ByCategory_ where
+  foldMap f = foldMap f . toList
+
+instance Semigroup a => Semigroup (ByCategory_ a) where
+  (ByCategory_ l) <> (ByCategory_ r) =
+    ByCategory_ $ ByCategory {
+        cType   = l.cType   <> r.cType
+      , cSafe   = l.cSafe   <> r.cSafe
+      , cUnsafe = l.cUnsafe <> r.cUnsafe
+      , cFunPtr = l.cFunPtr <> r.cFunPtr
+      , cGlobal = l.cGlobal <> r.cGlobal
+      }
+
+instance Monoid a => Monoid (ByCategory_ a) where
+  mempty = ByCategory_ $ ByCategory mempty mempty mempty mempty mempty
+
+isoByCategory :: Iso' (ByCategory_ a) (ByCategory (Const a))
+isoByCategory = iso getByCategory_ ByCategory_
+
+isoConst :: Iso' (Const a b) a
+isoConst = iso getConst Const
+
+lensForCategory :: Category -> Lens' (ByCategory_ a) a
+lensForCategory = \case
+    CType     -> isoByCategory % #cType % isoConst
+    CTerm cat -> isoByCategory % lensForTermCategory cat % isoConst
+
+lensForTermCategory :: TermCategory -> Lens' (ByCategory f) (f LvlTerm)
+lensForTermCategory = \case
+  CSafe   -> #cSafe
+  CUnsafe -> #cUnsafe
+  CFunPtr -> #cFunPtr
+  CGlobal -> #cGlobal
+
+newtype RenameTerm = RenameTerm (Text -> Text)
+
+instance Show RenameTerm where
+  show = const "<RenameTerm>"
+
+instance Default RenameTerm where
+  def = RenameTerm id
+
+-- | Include or exclude categories.
+--
+-- Possibly rename declarations in categories of 'Level' 'LvlTerm'. We only
+-- allow renaming of 'LvlTerm' because for 'LvlType' we would also need to
+-- rename the use sites, instances etc.
+type Choice :: Level -> Star
+data Choice lvl where
+  ExcludeCategory     :: Choice lvl
+  IncludeTypeCategory :: Choice LvlType
+  IncludeTermCategory :: RenameTerm -> Choice LvlTerm
+
+deriving instance Show (Choice lvl)
+
+instance Semigroup (Choice LvlType) where
+  ExcludeCategory <> y = y
+  x <> ExcludeCategory = x
+  IncludeTypeCategory <> IncludeTypeCategory = IncludeTypeCategory
+
+instance Semigroup (Choice LvlTerm) where
+  ExcludeCategory <> y = y
+  x <> ExcludeCategory = x
+  IncludeTermCategory _r1 <> IncludeTermCategory r2 = IncludeTermCategory r2
+
+instance Monoid (Choice LvlType) where
+  mempty = ExcludeCategory
+
+instance Monoid (Choice LvlTerm) where
+  mempty = ExcludeCategory
+
+instance Default (Choice LvlType) where
+  def = IncludeTypeCategory
+instance Default (Choice LvlTerm) where
+  def = IncludeTermCategory def
+
+-- | Use 'CType', 'CSafe', and 'CGlobal'; do not rename declarations.
+useSafeCategory :: ByCategory Choice
+useSafeCategory = ByCategory {
+      cType   = IncludeTypeCategory
+    , cSafe   = IncludeTermCategory def
+    , cUnsafe = ExcludeCategory
+    , cFunPtr = ExcludeCategory
+    , cGlobal = IncludeTermCategory def
+    }
+
+-- | Use 'CType', 'CUnsafe', and 'CGlobal'; do not rename declarations.
+useUnsafeCategory :: ByCategory Choice
+useUnsafeCategory = ByCategory {
+      cType   = IncludeTypeCategory
+    , cSafe   = ExcludeCategory
+    , cUnsafe = IncludeTermCategory def
+    , cFunPtr = ExcludeCategory
+    , cGlobal = IncludeTermCategory def
+    }
+
+-- | Use 'CType', 'CFunPtr', and 'CGlobal'; do not rename declarations.
+useFunPtrCategory :: ByCategory Choice
+useFunPtrCategory = ByCategory {
+      cType   = IncludeTypeCategory
+    , cSafe   = ExcludeCategory
+    , cUnsafe = ExcludeCategory
+    , cFunPtr = IncludeTermCategory def
+    , cGlobal = IncludeTermCategory def
+    }
+
+applyConst :: (a -> b) -> Const a c -> Const b c
+applyConst f = Const . f . getConst
diff --git a/src-internal/HsBindgen/Backend/Category/ApplyChoice.hs b/src-internal/HsBindgen/Backend/Category/ApplyChoice.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Category/ApplyChoice.hs
@@ -0,0 +1,76 @@
+module HsBindgen.Backend.Category.ApplyChoice (
+    applyBindingCategoryChoice
+  ) where
+
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.Level
+import HsBindgen.Errors (panicPure)
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Binding category choice
+-------------------------------------------------------------------------------}
+
+applyTypes :: Choice LvlType -> [a] -> [a]
+applyTypes = \case
+  ExcludeCategory     -> const []
+  IncludeTypeCategory -> id
+
+-- The list of declarations should only contain terms ('LvlTerm').
+applyTerms :: Choice LvlTerm -> [Hs.Decl l] -> [Hs.Decl l]
+applyTerms = \case
+    ExcludeCategory                    -> const []
+    IncludeTermCategory (RenameTerm f) -> map (renameHsDeclWith f)
+  where
+    renameHsDeclWith :: (Text -> Text) -> Hs.Decl l -> Hs.Decl l
+    renameHsDeclWith f d = case d of
+        Hs.DeclTypSyn{}                   -> p
+        Hs.DeclData{}                     -> p
+        Hs.DeclEmpty{}                    -> p
+        Hs.DeclNewtype{}                  -> p
+        Hs.DeclPatSyn{}                   -> p
+        Hs.DeclCompletePragma{}           -> p
+        Hs.DeclDefineInstance{}           -> p
+        Hs.DeclDeriveInstance{}           -> p
+        fi@Hs.DeclForeignImport{}         -> fi
+        fiw@Hs.DeclForeignImportWrapper{} -> fiw
+        fid@Hs.DeclForeignImportDynamic{} -> fid
+        Hs.DeclFunction fn                -> Hs.DeclFunction $ over #name renameTerm $ fn
+        Hs.DeclMacroValue{}               -> p
+        Hs.DeclVar x                      -> Hs.DeclVar $ over #name renameTerm $ x
+      where
+        p :: a
+        p = panicPure $ "Must not rename type-level declaration " <> show d
+
+        -- Only rename exported names
+        renameTerm :: Hs.TermName -> Hs.TermName
+        renameTerm = \case
+            Hs.ExportedName x ->
+              -- TODO <https://github.com/well-typed/hs-bindgen/issues/1928>
+              --
+              -- At the moment, rename of exported names is unsafe. The user
+              -- must adhere to naming rules (e.g., type constructors start with
+              -- capital letters).
+              --
+              -- However, we do have the means to parse and check the new name,
+              -- and could do so here.
+              Hs.ExportedName $ Hs.UnsafeName $ f x.text
+            Hs.InternalName x ->
+              Hs.InternalName x
+
+-- | Choose binding categories and possibly rename declarations in term-level
+-- | categories.
+applyBindingCategoryChoice ::
+     ByCategory Choice
+  -> ByCategory_ [Hs.Decl l]
+  -> ByCategory_ [Hs.Decl l]
+applyBindingCategoryChoice choice =
+    mapWithCategory_ aux
+  where
+    aux :: Category -> [Hs.Decl l] -> [Hs.Decl l]
+    aux = \case
+      CType     -> applyTypes choice.cType
+      CTerm cat -> applyTerms (view (lensForTermCategory cat) choice)
diff --git a/src-internal/HsBindgen/Backend/Extensions.hs b/src-internal/HsBindgen/Backend/Extensions.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Extensions.hs
@@ -0,0 +1,215 @@
+{-# LANGUAGE MagicHash #-}
+
+module HsBindgen.Backend.Extensions (
+    requiredExtensions,
+) where
+
+import Data.Set qualified as Set
+import Language.Haskell.TH qualified as TH
+
+import HsBindgen.Backend.Hs.AST (Strategy (..))
+import HsBindgen.Backend.Hs.CallConv (CallConv (..))
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Backend.SHs.AST.Expr (FBind (FBind))
+import HsBindgen.Config.Prelims (FieldNamingStrategy (..))
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+
+-- | Which GHC language extensions this declarations needs.
+requiredExtensions :: FieldNamingStrategy -> SDecl -> Set TH.Extension
+requiredExtensions fieldNaming = \case
+    DTypSyn typSyn -> mconcat [
+        typeExtensions typSyn.typ
+      ]
+    DInst inst -> mconcat . concat $ [
+        [ext TH.MultiParamTypeClasses | length inst.args >= 2]
+      , [ext TH.FlexibleInstances     | not (all isFlatInstanceArg inst.args)]
+      , [ext TH.TypeFamilies          | not (null inst.types)]
+      , [typeClassExtensions inst.clss]
+      , map typeExtensions inst.args
+      , map typeExtensions inst.super
+      , concat [ map typeExtensions tyVars ++ [typeExtensions tySyn]
+               | (_, tyVars, tySyn) <- inst.types ]
+      , map (exprExtensions . snd) inst.decs
+      ]
+    DRecord record -> mconcat [
+        recordExtensions record
+      , nestedDeriving record.deriv
+      , omitFieldPrefixesExtensions fieldNaming
+      , Set.singleton TH.DeriveGeneric
+      ]
+    DNewtype newtyp -> mconcat [
+        nestedDeriving newtyp.deriv
+      , typeExtensions newtyp.field.typ
+      , omitFieldPrefixesExtensions fieldNaming
+      , Set.singleton TH.DeriveGeneric
+      ]
+    DEmptyData{} -> mconcat [
+        ext TH.EmptyDataDecls
+      ]
+    DDerivingInstance deriv -> mconcat [
+        Set.fromList [
+            TH.DerivingStrategies
+          , TH.StandaloneDeriving
+          ]
+      , strategyExtensions deriv.strategy
+      , typeExtensions deriv.typ
+      ]
+    DForeignImport foreignImport -> mconcat [
+        ext TH.ForeignFunctionInterface
+      , callConvExtensions foreignImport.callConv
+      , foldMap (typeExtensions . (.typ)) foreignImport.parameters
+      , typeExtensions foreignImport.result.typ
+      ]
+    DBinding binding -> mconcat [
+        foldMap (typeExtensions . (.typ)) binding.parameters
+      , typeExtensions (binding.result.typ)
+      , exprExtensions binding.body
+      ]
+    DPatternSynonym{} -> mconcat [
+        ext TH.PatternSynonyms
+      ]
+    DCompletePragma{} -> mempty
+  where
+    ext :: TH.Extension -> Set TH.Extension
+    ext = Set.singleton
+
+-- | Check whether an instance argument has the shape @T a1 ... an@ (type
+-- constructor applied to type variables) — anything else requires
+-- @FlexibleInstances@.
+--
+-- We don't check that the type variables are distinct: @FlexibleInstances@
+-- removes that restriction too, so over-emitting on non-distinct-vars
+-- instances is harmless.
+isFlatInstanceArg :: SType ctx -> Bool
+isFlatInstanceArg = \case
+    TCon _            -> True
+    TGlobal _         -> True
+    TApp f (TBound _) -> isFlatInstanceArg f
+    TApp f (TFree _)  -> isFlatInstanceArg f
+    _                 -> False
+
+-- | Extensions for deriving clauses that are part of the datatype declaration
+nestedDeriving :: [(Strategy ClosedType, [Inst.TypeClass])] -> Set TH.Extension
+nestedDeriving deriv =
+       Set.singleton TH.DerivingStrategies
+    <> mconcat [
+          strategyExtensions s <> foldMap typeClassExtensions gs
+        | (s, gs) <- deriv
+        ]
+
+recordExtensions :: Record -> Set TH.Extension
+recordExtensions record = foldMap fieldExtensions record.fields
+
+-- | Extensions required when using 'OmitFieldPrefixes' or the
+-- "--omit-field-prefixes" flag.
+--
+-- Note that 'OmitFieldPrefixes' /also/ requires @NoFieldSelectors@, but that
+-- is a /disabled/ extension (the negation of the default-on @FieldSelectors@)
+-- and so cannot be represented in the positive 'TH.Extension' set. It is emitted
+-- as a module pragma directly; see 'omitFieldPrefixesPragmas' in
+-- "HsBindgen.Backend.HsModule.Translation".
+omitFieldPrefixesExtensions :: FieldNamingStrategy -> Set TH.Extension
+omitFieldPrefixesExtensions = \case
+    AddFieldPrefixes  -> mempty
+    OmitFieldPrefixes -> Set.singleton TH.DuplicateRecordFields
+
+fieldExtensions :: Field -> Set TH.Extension
+fieldExtensions field = typeExtensions field.typ
+
+typeClassExtensions :: Inst.TypeClass -> Set TH.Extension
+typeClassExtensions = \case
+    Inst.HasCField      -> Set.singleton TH.MagicHash
+    Inst.HasCBitfield   -> Set.singleton TH.MagicHash
+    Inst.HasField       -> Set.singleton TH.UndecidableInstances
+    Inst.HasFieldCompat -> Set.singleton TH.UndecidableInstances
+    Inst.HasFieldPtr    -> Set.singleton TH.UndecidableInstances
+    Inst.HasFFIType     -> Set.singleton TH.UndecidableInstances
+    Inst.Prim           -> Set.fromList [TH.MagicHash, TH.UnboxedTuples]
+    _ -> mempty
+
+exprExtensions :: SExpr ctx -> Set TH.Extension
+exprExtensions = \case
+    EGlobal{} -> mempty
+    EBound{} -> mempty
+    EFree{} -> mempty
+    ECon{} -> mempty
+    EIntegral{} -> mempty
+    EUnboxedIntegral{} -> mempty
+    ECChar {} -> mempty
+    EString {} -> mempty
+    ECString {} -> mempty
+    EFloat{} -> mempty
+    EDouble{} -> mempty
+    EApp f x -> exprExtensions f <> exprExtensions x
+    EInfix _op x y ->
+      exprExtensions x <> exprExtensions y
+    ELam _mPat body -> exprExtensions body
+    EUnusedLam body -> exprExtensions body
+    ECase x alts -> mconcat $
+        exprExtensions x
+      : [ case alt of
+            SAlt _con _add _hints body ->
+              exprExtensions body
+            SAltNoConstr _hints body ->
+              exprExtensions body
+            SAltUnboxedTuple _add _hints body ->
+              Set.fromList [TH.UnboxedTuples, TH.MagicHash] <> exprExtensions body
+        | alt <- alts
+        ]
+    EUnit -> mempty
+    EBoxedTup{} -> mempty
+    EUnboxedTup{} -> Set.fromList [TH.UnboxedTuples, TH.MagicHash]
+    EList xs -> foldMap exprExtensions xs
+    ETypeApp f t -> Set.singleton TH.TypeApplications <> exprExtensions f <> typeExtensions t
+    ERecCon _con fbinds -> foldMap fBindExtensions fbinds
+
+fBindExtensions :: FBind ctx -> Set TH.Extension
+fBindExtensions (FBind _label expr) = exprExtensions expr
+
+-- Note: We don't recognise whether we need RankNTypes.
+-- We probably don't generate such types
+typeExtensions :: SType ctx -> Set TH.Extension
+typeExtensions = \case
+    TGlobal{}   -> Set.empty
+    TClass cls  -> typeClassExtensions cls
+    TCon _      -> Set.empty
+    TFree _     -> Set.singleton TH.FlexibleContexts -- include like in 'predicateExtensions'
+    TFun a b    -> typeExtensions a <> typeExtensions b
+    TLit _      -> Set.singleton TH.DataKinds
+    TStrLit _   -> Set.singleton TH.DataKinds
+    TExt{}      -> Set.empty
+    TBound _    -> Set.empty
+    TApp f b    -> typeExtensions f <> typeExtensions b
+    TUnit       -> Set.empty
+    TBoxedTup{} -> Set.empty
+    TEq         -> Set.singleton TH.TypeOperators
+    TForall _names _add preds b ->
+        -- Note: GHC doesn't require ExplicitForAll for type signatures
+        Set.singleton TH.ExplicitForAll <>
+        foldMap typeExtensions preds <>
+        foldMap predicateExtensions preds <>
+        typeExtensions b
+    TList t     -> typeExtensions t
+
+-- | Whether type constraints need extra language extensions.
+--
+-- For now, we over-approximate this by always requiring FlexibleContexts
+predicateExtensions :: SType ctx' -> Set TH.Extension
+predicateExtensions _ = Set.singleton TH.FlexibleContexts
+
+strategyExtensions :: Strategy ClosedType -> Set TH.Extension
+strategyExtensions = \case
+    DeriveNewtype -> Set.singleton TH.GeneralizedNewtypeDeriving
+    DeriveStock   -> Set.empty
+    DeriveVia t   -> Set.insert TH.DerivingVia (typeExtensions t)
+
+-- | Language extensions required by a calling convention.
+--
+-- Only GHC's standard @capi@ calling convention requires @CApiFFI@; the
+-- @ccall@-based conventions (including our userland CAPI) do not.
+callConvExtensions :: CallConv -> Set TH.Extension
+callConvExtensions = \case
+    CallConvGhcCapi{}      -> Set.singleton TH.CApiFFI
+    CallConvUserlandCapi{} -> Set.empty
+    CallConvGhcCCall{}     -> Set.empty
diff --git a/src-internal/HsBindgen/Backend/Global.hs b/src-internal/HsBindgen/Backend/Global.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Global.hs
@@ -0,0 +1,581 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE TemplateHaskellQuotes #-}
+
+-- | Intended for unqualified import.
+module HsBindgen.Backend.Global (
+    -- * Global symbols
+    Global(..)
+  , GlobalCat(..)
+
+  , globalCatNamespace
+
+    -- ** Specific to @hs-bindgen@
+  , BindgenGlobalType(..)
+  , bindgenGlobalType
+  , typeClassGlobal
+  , BindgenGlobalTerm(..)
+  , bindgenGlobalTerm
+  , preludeNames
+  ) where
+
+import Data.ByteString qualified as BS
+import Data.Text qualified as Text
+import Language.Haskell.TH qualified as TH
+
+import HsBindgen.Runtime.BitfieldPtr qualified as BitfieldPtr
+import HsBindgen.Runtime.Block qualified as Block
+import HsBindgen.Runtime.CEnum qualified as CEnum
+import HsBindgen.Runtime.ConstantArray qualified as CA
+import HsBindgen.Runtime.FLAM qualified as FLAM
+import HsBindgen.Runtime.HasCBitfield qualified as HasCBitfield
+import HsBindgen.Runtime.HasCField qualified as HasCField
+import HsBindgen.Runtime.IncompleteArray qualified as IA
+import HsBindgen.Runtime.IsArray qualified as IsA
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+import HsBindgen.Runtime.Marshal qualified as Marshal
+import HsBindgen.Runtime.PtrConst qualified as PtrConst
+import HsBindgen.Runtime.Struct qualified as Struct
+import HsBindgen.Runtime.Support qualified as BG
+import HsBindgen.Runtime.Support.CompatHasField qualified as BG.CompatHasField
+import HsBindgen.Runtime.Union qualified as Union
+
+import HsBindgen.Backend.Level
+import HsBindgen.Backend.Runtime (RuntimeModule)
+import HsBindgen.Backend.Runtime qualified as Runtime
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Globals
+-------------------------------------------------------------------------------}
+
+-- | We distinguish between globals on the type (@Global LvlType@) and term
+--   (@Global LvlTerm@) level.
+data GlobalCat (lvl :: Level) where
+  GVar :: GlobalCat LvlTerm
+  GCon :: GlobalCat LvlTerm
+  GTyp :: GlobalCat LvlType
+
+deriving stock instance Eq   (GlobalCat lvl)
+deriving stock instance Ord  (GlobalCat lvl)
+deriving stock instance Show (GlobalCat lvl)
+
+globalCatNamespace :: GlobalCat lvl -> Hs.Namespace
+globalCatNamespace = \case
+    GVar -> Hs.NsVar
+    GCon -> Hs.NsConstr
+    GTyp -> Hs.NsTypeConstr
+
+-- | Global symbol
+--
+-- We use the 'Level' to distinguish between globals on the type and the term
+-- level, see 'GlobalCat'.
+--
+-- The constructor name 'CustomGlobal' highlights that users can create custom
+-- globals. However, we provide a predefined set of globals specific to
+-- @hs-bindgen@ and the standard C expression language @c-expr-runtime@.
+data Global (lvl :: Level) = CustomGlobal {
+    name  :: TH.Name
+  , cat   :: GlobalCat lvl
+  , imprt :: Hs.Import
+  }
+  deriving stock (Eq, Ord, Show)
+
+{-------------------------------------------------------------------------------
+  Globals specific to @hs-bindgen@
+-------------------------------------------------------------------------------}
+
+-- | Import specific to @hs-bindgen@
+--
+-- Internal!
+data BindgenImport =
+    -- | Unqualified import from "Prelude"; see 'preludeNames'.
+    IHaskellPrelude
+    -- | Qualified import from a module in @hs-bindgen-runtime@; the module path
+    --   and alias come from 'RN.RuntimeModule'.
+  | IRuntime RuntimeModule
+  deriving stock (Eq, Ord, Show)
+
+bindgenToHsImport :: BindgenImport -> Hs.Import
+bindgenToHsImport = \case
+    IHaskellPrelude -> Hs.UnqualifiedImport "Prelude"
+    IRuntime rm     -> Runtime.qualifiedImport rm
+
+globalExpr :: (BindgenImport, GlobalCat LvlTerm, TH.Name) -> Global LvlTerm
+globalExpr (i, c, n) = CustomGlobal n c (bindgenToHsImport i)
+
+globalType :: (BindgenImport, TH.Name) -> Global LvlType
+globalType (i, n) = CustomGlobal n GTyp (bindgenToHsImport i)
+
+data BindgenGlobalType =
+    -- Foreign function interface
+    Foreign_Ptr_type
+  | Foreign_FunPtr_type
+  | IO_type
+
+    -- Type equality
+  | TypeEquality_type
+
+      -- Arrays
+  | ConstantArray_type
+  | IncompleteArray_type
+  | IsArray_Elem
+
+    -- EquivStorable
+  | EquivStorable_type
+
+    -- Flexible array members
+  | Flam_WithFlam_type
+
+    -- HasCField
+  | HasCField_CFieldType
+
+    -- BitfieldPtr
+  | HasCBitfield_BitfieldPtr_type
+
+    -- HasCBitfield
+  | HasCBitfield_CBitfieldType
+
+    -- PtrConst
+  | PtrConst_type
+
+    -- C enumerations
+  | CEnumZ_type
+
+    -- Arrays
+  | ByteArray_type
+  | SizedByteArray_type
+  | Block_type
+
+    -- Structs
+  | IsStructViaReadRaw_type
+
+    -- Complex numbers
+  | Complex_type
+
+    -- C types
+  | Void_type
+  | Int_type
+  | Bool_type
+  | CChar_type
+  | CSChar_type
+  | CUChar_type
+  | CShort_type
+  | CUShort_type
+  | CInt_type
+  | CUInt_type
+  | CLong_type
+  | CULong_type
+  | CLLong_type
+  | CULLong_type
+  | CBool_type
+  | CFloat_type
+  | CDouble_type
+  | CPtrdiff_type
+
+    -- ByteString
+  | ByteString_type
+
+    -- String
+  | String_type
+
+    -- Raw macros
+  | Macro_Raw_type
+  deriving stock (Bounded, Enum, Eq, Ord, Show)
+
+data BindgenGlobalTerm =
+    Applicative_pure
+  | Applicative_seq
+  | Monad_seq
+
+    -- Function pointers
+  | ToFunPtr_toFunPtr
+  | FromFunPtr_fromFunPtr
+
+  | Foreign_castFunPtr
+
+    -- Foreign function interface
+  | ByteArray_setUnionPayload
+  | ByteArray_getUnionPayload
+  | ByteArray_getUnionPayloadBits
+  | ByteArray_setUnionPayloadBits
+  | Capi_with
+  | Capi_allocaAndPeek
+
+    -- StaticSize
+  | StaticSize_staticSizeOf
+  | StaticSize_staticAlignment
+
+    -- ReadRaw
+  | ReadRaw_readRaw
+  | ReadRaw_readRawByteOff
+
+    -- WriteRaw
+  | WriteRaw_writeRaw
+  | WriteRaw_writeRawByteOff
+
+    -- Storable
+  | Storable_sizeOf
+  | Storable_alignment
+  | Storable_peekByteOff
+  | Storable_pokeByteOff
+  | Storable_peek
+  | Storable_poke
+
+    -- Flexible array members
+  | Flam_Offset_offset
+
+    -- HasCField
+  | HasCField_offset#
+  | HasCField_fromPtr
+  | HasCField_peek
+  | HasCField_poke
+  | HasCField_readRaw
+  | HasCField_writeRaw
+
+    -- HasCBitfield
+  | HasCBitfield_bitfieldOffset#
+  | HasCBitfield_bitfieldWidth#
+  | HasCBitfield_toPtr
+  | HasCBitfield_peek
+  | HasCBitfield_poke
+
+    -- HasField
+  | HasField_getField
+
+    -- Compat.HasField
+  | HasFieldCompat_hasField
+  | HasFieldCompat_setField
+  | HasFieldCompat_modifyField
+
+    -- Proxy
+  | Proxy_constructor
+
+    -- HasFFIType
+  | HasFFIType_fromFFIType
+  | HasFFIType_toFFIType
+
+    -- Functor
+  | Functor_fmap
+
+    -- Unsafe
+  | IO_unsafePerformIO
+
+    -- PtrConst
+  | PtrConst_unsafeFromPtr
+  | PtrConst_peek
+
+    -- Other type classes
+  | Read_readPrec
+  | Read_readList
+  | Read_readListPrec
+  | Read_readListDefault
+  | Read_readListPrecDefault
+  | Show_showsPrec
+
+    -- Floating point numbers
+  | CFloat_constructor
+  | CDouble_constructor
+  | GHC_Float_castWord32ToFloat
+  | GHC_Float_castWord64ToDouble
+
+    -- Non-empty lists
+  | NonEmpty_constructor
+  | NonEmpty_singleton
+
+    -- C enumerations
+  | CEnum_toCEnum
+  | CEnum_fromCEnum
+  | CEnum_declaredValues
+  | CEnum_showsUndeclared
+  | CEnum_readPrecUndeclared
+  | CEnum_isDeclared
+  | CEnum_mkDeclared
+  | SequentialCEnum_minDeclaredValue
+  | SequentialCEnum_maxDeclaredValue
+  | CEnum_declaredValuesFromList
+  | CEnum_showsCEnum
+  | CEnum_showsWrappedUndeclared
+  | CEnum_readPrecCEnum
+  | CEnum_readPrecWrappedUndeclared
+  | CEnum_seqIsDeclared
+  | CEnum_seqMkDeclared
+
+    -- ByteString
+  | ByteString_pack
+
+    -- Raw macros
+  | Macro_objectLike
+  | Macro_functionLike
+  | Macro_variadicFunctionLike
+  | Macro_namedVariadicFunctionLike
+  deriving stock (Bounded, Enum, Eq, Ord, Show)
+
+bindgenGlobalType :: BindgenGlobalType -> Global LvlType
+bindgenGlobalType = globalType . \case
+    -- Foreign function interface
+    Foreign_Ptr_type       -> (IRuntime Runtime.Support, ''BG.Ptr)
+    Foreign_FunPtr_type    -> (IRuntime Runtime.Support, ''BG.FunPtr)
+    IO_type                -> (IHaskellPrelude,          ''IO)
+
+    -- Type equality
+    TypeEquality_type -> (IHaskellPrelude, ''(~))
+
+      -- Arrays
+    ConstantArray_type     -> (IRuntime Runtime.ConstantArray,   ''CA.ConstantArray)
+    IncompleteArray_type   -> (IRuntime Runtime.IncompleteArray, ''IA.IncompleteArray)
+    IsArray_Elem           -> (IRuntime Runtime.IsArray,         ''IsA.Elem)
+
+    -- EquivStorable
+    EquivStorable_type -> (IRuntime Runtime.Marshal, ''Marshal.EquivStorable)
+
+    -- Flexible array members
+    Flam_WithFlam_type -> (IRuntime Runtime.Flam, ''FLAM.WithFlam)
+
+    -- HasCField
+    HasCField_CFieldType -> (IRuntime Runtime.HasCField, ''HasCField.CFieldType)
+
+    -- BitfieldPtr
+    HasCBitfield_BitfieldPtr_type -> (IRuntime Runtime.BitfieldPtr, ''BitfieldPtr.BitfieldPtr)
+
+    -- HasCBitfield
+    HasCBitfield_CBitfieldType -> (IRuntime Runtime.HasCBitfield, ''HasCBitfield.CBitfieldType)
+
+    -- PtrConst
+    PtrConst_type -> (IRuntime Runtime.PtrConst, ''PtrConst.PtrConst)
+
+    -- C enumerations
+    CEnumZ_type            -> (IRuntime Runtime.CEnum, ''CEnum.CEnumZ)
+
+    -- Arrays
+    ByteArray_type      -> (IRuntime Runtime.Support, ''BG.ByteArray)
+    SizedByteArray_type -> (IRuntime Runtime.Support, ''BG.SizedByteArray)
+    Block_type          -> (IRuntime Runtime.Block,   ''Block.Block)
+
+    -- Structs
+    IsStructViaReadRaw_type -> (IRuntime Runtime.Struct, ''Struct.IsStructViaReadRaw)
+
+    -- Complex numbers
+    Complex_type -> (IRuntime Runtime.Support, ''BG.Complex)
+
+    -- C types
+    Void_type       -> (IRuntime Runtime.Support, ''BG.Void)
+    Int_type        -> (IHaskellPrelude,          ''Int)
+    Bool_type       -> (IHaskellPrelude,          ''Bool)
+    CChar_type      -> (IRuntime Runtime.Support, ''BG.CChar)
+    CSChar_type     -> (IRuntime Runtime.Support, ''BG.CSChar)
+    CUChar_type     -> (IRuntime Runtime.Support, ''BG.CUChar)
+    CShort_type     -> (IRuntime Runtime.Support, ''BG.CShort)
+    CUShort_type    -> (IRuntime Runtime.Support, ''BG.CUShort)
+    CInt_type       -> (IRuntime Runtime.Support, ''BG.CInt)
+    CUInt_type      -> (IRuntime Runtime.Support, ''BG.CUInt)
+    CLong_type      -> (IRuntime Runtime.Support, ''BG.CLong)
+    CULong_type     -> (IRuntime Runtime.Support, ''BG.CULong)
+    CLLong_type     -> (IRuntime Runtime.Support, ''BG.CLLong)
+    CULLong_type    -> (IRuntime Runtime.Support, ''BG.CULLong)
+    CBool_type      -> (IRuntime Runtime.Support, ''BG.CBool)
+    CFloat_type     -> (IRuntime Runtime.Support, ''BG.CFloat)
+    CDouble_type    -> (IRuntime Runtime.Support, ''BG.CDouble)
+    CPtrdiff_type   -> (IRuntime Runtime.Support, ''BG.CPtrdiff)
+
+    -- ByteString
+    ByteString_type -> (IRuntime Runtime.Support, ''BG.ByteString)
+
+    -- String
+    String_type     -> (IHaskellPrelude, ''String)
+
+    -- Raw macros
+    Macro_Raw_type  -> (IRuntime Runtime.Macro, ''Runtime.Macro.Raw)
+
+
+typeClassGlobal :: Inst.TypeClass -> Global LvlType
+typeClassGlobal = globalType . \case
+    Inst.Bitfield        -> (IRuntime Runtime.Support,        ''BG.Bitfield)
+    Inst.Bits            -> (IRuntime Runtime.Support,        ''BG.Bits)
+    Inst.Bounded         -> (IHaskellPrelude,                 ''Bounded)
+    Inst.CEnum           -> (IRuntime Runtime.CEnum,          ''CEnum.CEnum)
+    Inst.Enum            -> (IHaskellPrelude,                 ''Enum)
+    Inst.Eq              -> (IHaskellPrelude,                 ''Eq)
+    Inst.FiniteBits      -> (IRuntime Runtime.Support,        ''BG.FiniteBits)
+    Inst.Floating        -> (IHaskellPrelude,                 ''Floating)
+    Inst.Fractional      -> (IHaskellPrelude,                 ''Fractional)
+    Inst.FromFunPtr      -> (IRuntime Runtime.Support,        ''BG.FromFunPtr)
+    Inst.Generic         -> (IRuntime Runtime.Support,        ''BG.Generic)
+    Inst.HasCBitfield    -> (IRuntime Runtime.HasCBitfield,   ''HasCBitfield.HasCBitfield)
+    Inst.HasCField       -> (IRuntime Runtime.HasCField,      ''HasCField.HasCField)
+    Inst.HasFFIType      -> (IRuntime Runtime.Support,        ''BG.HasFFIType)
+    Inst.HasField        -> (IRuntime Runtime.Support,        ''BG.HasField)
+    Inst.HasFieldCompat  -> (IRuntime Runtime.CompatHasField, ''BG.CompatHasField.HasField)
+    Inst.HasFieldPtr     -> (IRuntime Runtime.Support,        ''BG.HasField)
+    Inst.Flam_Offset     -> (IRuntime Runtime.Flam,           ''FLAM.Offset)
+    Inst.Integral        -> (IHaskellPrelude,                 ''Integral)
+    Inst.IsArray         -> (IRuntime Runtime.IsArray,        ''IsA.IsArray)
+    Inst.IsStruct        -> (IRuntime Runtime.Struct,         ''Struct.IsStruct)
+    Inst.IsUnion         -> (IRuntime Runtime.Union,          ''Union.IsUnion)
+    Inst.Ix              -> (IRuntime Runtime.Support,        ''BG.Ix)
+    Inst.Num             -> (IHaskellPrelude,                 ''Num)
+    Inst.Ord             -> (IHaskellPrelude,                 ''Ord)
+    Inst.Prim            -> (IRuntime Runtime.Support,        ''BG.Prim)
+    Inst.Read            -> (IHaskellPrelude,                 ''Read)
+    Inst.ReadRaw         -> (IRuntime Runtime.Marshal,        ''Marshal.ReadRaw)
+    Inst.Real            -> (IHaskellPrelude,                 ''Real)
+    Inst.RealFloat       -> (IHaskellPrelude,                 ''RealFloat)
+    Inst.RealFrac        -> (IHaskellPrelude,                 ''RealFrac)
+    Inst.SequentialCEnum -> (IRuntime Runtime.CEnum,          ''CEnum.SequentialCEnum)
+    Inst.Show            -> (IHaskellPrelude,                 ''Show)
+    Inst.StaticSize      -> (IRuntime Runtime.Marshal,        ''Marshal.StaticSize)
+    Inst.Storable        -> (IRuntime Runtime.Support,        ''BG.Storable)
+    Inst.ToFunPtr        -> (IRuntime Runtime.Support,        ''BG.ToFunPtr)
+    Inst.WriteRaw        -> (IRuntime Runtime.Marshal,        ''Marshal.WriteRaw)
+
+bindgenGlobalTerm :: BindgenGlobalTerm -> Global LvlTerm
+bindgenGlobalTerm = globalExpr . \case
+    Applicative_pure    -> (IHaskellPrelude, GVar, 'pure)
+    Applicative_seq     -> (IHaskellPrelude, GVar, '(<*>))
+    Monad_seq           -> (IHaskellPrelude, GVar, '(>>))
+
+    -- Function pointers
+    ToFunPtr_toFunPtr     -> (IRuntime Runtime.Support, GVar, 'BG.toFunPtr)
+    FromFunPtr_fromFunPtr -> (IRuntime Runtime.Support, GVar, 'BG.fromFunPtr)
+    Foreign_castFunPtr    -> (IRuntime Runtime.Support, GVar, 'BG.castFunPtr)
+
+    -- Foreign function interface
+    ByteArray_getUnionPayload     -> (IRuntime Runtime.Support, GVar, 'BG.getUnionPayload)
+    ByteArray_setUnionPayload     -> (IRuntime Runtime.Support, GVar, 'BG.setUnionPayload)
+    ByteArray_getUnionPayloadBits -> (IRuntime Runtime.Support, GVar, 'BG.getUnionPayloadBits)
+    ByteArray_setUnionPayloadBits -> (IRuntime Runtime.Support, GVar, 'BG.setUnionPayloadBits)
+    Capi_with                     -> (IRuntime Runtime.Support, GVar, 'BG.with)
+    Capi_allocaAndPeek            -> (IRuntime Runtime.Support, GVar, 'BG.allocaAndPeek)
+
+    -- StaticSize
+    StaticSize_staticSizeOf    -> (IRuntime Runtime.Marshal, GVar, 'Marshal.staticSizeOf)
+    StaticSize_staticAlignment -> (IRuntime Runtime.Marshal, GVar, 'Marshal.staticAlignment)
+
+    -- ReadRaw
+    ReadRaw_readRaw        -> (IRuntime Runtime.Marshal, GVar, 'Marshal.readRaw)
+    ReadRaw_readRawByteOff -> (IRuntime Runtime.Marshal, GVar, 'Marshal.readRawByteOff)
+
+    -- WriteRaw
+    WriteRaw_writeRaw        -> (IRuntime Runtime.Marshal, GVar, 'Marshal.writeRaw)
+    WriteRaw_writeRawByteOff -> (IRuntime Runtime.Marshal, GVar, 'Marshal.writeRawByteOff)
+
+    -- Storable
+    Storable_sizeOf      -> (IRuntime Runtime.Support, GVar, 'BG.sizeOf)
+    Storable_alignment   -> (IRuntime Runtime.Support, GVar, 'BG.alignment)
+    Storable_peekByteOff -> (IRuntime Runtime.Support, GVar, 'BG.peekByteOff)
+    Storable_pokeByteOff -> (IRuntime Runtime.Support, GVar, 'BG.pokeByteOff)
+    Storable_peek        -> (IRuntime Runtime.Support, GVar, 'BG.peek)
+    Storable_poke        -> (IRuntime Runtime.Support, GVar, 'BG.poke)
+
+    -- Flexible array members
+    Flam_Offset_offset        -> (IRuntime Runtime.Flam, GVar, 'FLAM.offset)
+
+    -- HasCField
+    HasCField_offset#    -> (IRuntime Runtime.HasCField, GVar, 'HasCField.offset#)
+    HasCField_fromPtr    -> (IRuntime Runtime.HasCField, GVar, 'HasCField.fromPtr)
+    HasCField_peek       -> (IRuntime Runtime.HasCField, GVar, 'HasCField.peek)
+    HasCField_poke       -> (IRuntime Runtime.HasCField, GVar, 'HasCField.poke)
+    HasCField_readRaw    -> (IRuntime Runtime.HasCField, GVar, 'HasCField.readRaw)
+    HasCField_writeRaw   -> (IRuntime Runtime.HasCField, GVar, 'HasCField.writeRaw)
+
+    -- HasCBitfield
+    HasCBitfield_bitfieldOffset# -> (IRuntime Runtime.HasCBitfield, GVar, 'HasCBitfield.bitfieldOffset#)
+    HasCBitfield_bitfieldWidth#  -> (IRuntime Runtime.HasCBitfield, GVar, 'HasCBitfield.bitfieldWidth#)
+    HasCBitfield_toPtr           -> (IRuntime Runtime.HasCBitfield, GVar, 'HasCBitfield.toPtr)
+    HasCBitfield_peek            -> (IRuntime Runtime.HasCBitfield, GVar, 'HasCBitfield.peek)
+    HasCBitfield_poke            -> (IRuntime Runtime.HasCBitfield, GVar, 'HasCBitfield.poke)
+
+    -- HasField
+    HasField_getField -> (IRuntime Runtime.Support, GVar, 'BG.getField)
+
+    -- Compat.HasField
+    HasFieldCompat_hasField    -> (IRuntime Runtime.CompatHasField, GVar, 'BG.CompatHasField.hasField)
+    HasFieldCompat_setField    -> (IRuntime Runtime.CompatHasField, GVar, 'BG.CompatHasField.setField)
+    HasFieldCompat_modifyField -> (IRuntime Runtime.CompatHasField, GVar, 'BG.CompatHasField.modifyField)
+
+    -- Proxy
+    Proxy_constructor -> (IRuntime Runtime.Support, GCon, 'BG.Proxy)
+
+    -- HasFFIType
+    HasFFIType_fromFFIType           -> (IRuntime Runtime.Support, GVar, 'BG.fromFFIType)
+    HasFFIType_toFFIType             -> (IRuntime Runtime.Support, GVar, 'BG.toFFIType)
+
+    -- Functor
+    Functor_fmap -> (IHaskellPrelude, GVar, 'fmap)
+
+    -- Unsafe
+    IO_unsafePerformIO -> (IRuntime Runtime.Support, GVar, 'BG.unsafePerformIO)
+
+    -- PtrConst
+    PtrConst_unsafeFromPtr -> (IRuntime Runtime.PtrConst, GVar, 'PtrConst.unsafeFromPtr)
+    PtrConst_peek          -> (IRuntime Runtime.PtrConst, GVar, 'PtrConst.peek)
+
+    -- Other type classes
+    Read_readPrec            -> (IRuntime Runtime.Support, GVar, 'BG.readPrec)
+    Read_readList            -> (IRuntime Runtime.Support, GVar, 'BG.readList)
+    Read_readListPrec        -> (IRuntime Runtime.Support, GVar, 'BG.readListPrec)
+    Read_readListDefault     -> (IRuntime Runtime.Support, GVar, 'BG.readListDefault)
+    Read_readListPrecDefault -> (IRuntime Runtime.Support, GVar, 'BG.readListPrecDefault)
+    Show_showsPrec           -> (IRuntime Runtime.Support, GVar, 'BG.showsPrec)
+
+    -- Floating point numbers
+    CFloat_constructor           -> (IRuntime Runtime.Support, GCon, ''BG.CFloat)
+    CDouble_constructor          -> (IRuntime Runtime.Support, GCon, ''BG.CDouble)
+    GHC_Float_castWord32ToFloat  -> (IRuntime Runtime.Support, GVar, 'BG.castWord32ToFloat)
+    GHC_Float_castWord64ToDouble -> (IRuntime Runtime.Support, GVar, 'BG.castWord64ToDouble)
+
+    -- Non-empty lists
+    NonEmpty_constructor     -> (IRuntime Runtime.Support, GCon, '(BG.:|))
+    NonEmpty_singleton       -> (IRuntime Runtime.Support, GVar, 'BG.singleton)
+
+    -- C enumerations
+    CEnum_toCEnum                    -> (IRuntime Runtime.CEnum, GVar, 'CEnum.toCEnum)
+    CEnum_fromCEnum                  -> (IRuntime Runtime.CEnum, GVar, 'CEnum.fromCEnum)
+    CEnum_declaredValues             -> (IRuntime Runtime.CEnum, GVar, 'CEnum.declaredValues)
+    CEnum_showsUndeclared            -> (IRuntime Runtime.CEnum, GVar, 'CEnum.showsUndeclared)
+    CEnum_readPrecUndeclared         -> (IRuntime Runtime.CEnum, GVar, 'CEnum.readPrecUndeclared)
+    CEnum_isDeclared                 -> (IRuntime Runtime.CEnum, GVar, 'CEnum.isDeclared)
+    CEnum_mkDeclared                 -> (IRuntime Runtime.CEnum, GVar, 'CEnum.mkDeclared)
+    SequentialCEnum_minDeclaredValue -> (IRuntime Runtime.CEnum, GVar, 'CEnum.minDeclaredValue)
+    SequentialCEnum_maxDeclaredValue -> (IRuntime Runtime.CEnum, GVar, 'CEnum.maxDeclaredValue)
+    CEnum_declaredValuesFromList     -> (IRuntime Runtime.CEnum, GVar, 'CEnum.declaredValuesFromList)
+    CEnum_showsCEnum                 -> (IRuntime Runtime.CEnum, GVar, 'CEnum.shows)
+    CEnum_showsWrappedUndeclared     -> (IRuntime Runtime.CEnum, GVar, 'CEnum.showsWrappedUndeclared)
+    CEnum_readPrecCEnum              -> (IRuntime Runtime.CEnum, GVar, 'CEnum.readPrec)
+    CEnum_readPrecWrappedUndeclared  -> (IRuntime Runtime.CEnum, GVar, 'CEnum.readPrecWrappedUndeclared)
+    CEnum_seqIsDeclared              -> (IRuntime Runtime.CEnum, GVar, 'CEnum.seqIsDeclared)
+    CEnum_seqMkDeclared              -> (IRuntime Runtime.CEnum, GVar, 'CEnum.seqMkDeclared)
+
+    -- ByteString
+    ByteString_pack -> (IRuntime Runtime.Support, GVar, 'BS.pack)
+
+    -- Raw macros
+    Macro_objectLike                -> (IRuntime Runtime.Macro, GVar, 'Runtime.Macro.objectLike)
+    Macro_functionLike              -> (IRuntime Runtime.Macro, GVar, 'Runtime.Macro.functionLike)
+    Macro_variadicFunctionLike      -> (IRuntime Runtime.Macro, GVar, 'Runtime.Macro.variadic)
+    Macro_namedVariadicFunctionLike -> (IRuntime Runtime.Macro, GVar, 'Runtime.Macro.variadicNamed)
+
+{-------------------------------------------------------------------------------
+  Names imported from the "Prelude"
+-------------------------------------------------------------------------------}
+
+-- | Names of the globals imported unqualified from the "Prelude"
+--
+-- Generated modules import these names unqualified, so the name mangler must
+-- reserve them.
+preludeNames :: [Hs.SomeName]
+preludeNames = concat [
+      fromGlobals $ map bindgenGlobalType [minBound .. maxBound]
+    , fromGlobals $ map typeClassGlobal   [minBound .. maxBound]
+    , fromGlobals $ map bindgenGlobalTerm [minBound .. maxBound]
+    ]
+  where
+    fromGlobals :: [Global lvl] -> [Hs.SomeName]
+    fromGlobals globals = [
+        Hs.UnsafeSomeName {
+            ns   = globalCatNamespace g.cat
+          , text = Text.pack $ TH.nameBase g.name
+          }
+      | g <- globals
+      , g.imprt == bindgenToHsImport IHaskellPrelude
+      ]
diff --git a/src-internal/HsBindgen/Backend/Hs/AST.hs b/src-internal/HsBindgen/Backend/Hs/AST.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/AST.hs
@@ -0,0 +1,897 @@
+-- | Haskell AST
+--
+-- Abstract Haskell syntax for the specific purposes of hs-bindgen: we only
+-- cover the parts of the Haskell syntax that we need. We attempt to do this in
+-- such a way that the generated Haskell code is type correct by construction.
+--
+-- Intended for qualified import:
+--
+-- > import HsBindgen.Backend.Hs.AST qualified as Hs
+module HsBindgen.Backend.Hs.AST (
+    -- * Generated Haskell datatypes
+    Field(..)
+  , Struct(..)
+  , EmptyData(..)
+  , Newtype(..)
+    -- * Variable binding
+  , Lambda(..)
+  , Apply(..)
+  , Ap(..)
+    -- * Declarations
+  , Decl(..)
+  , InstanceDecl(..)
+  , DefineInstance(..)
+  , DeriveInstance(..)
+  , Var(..)
+    -- ** Variable declarations
+  , MacroValue(..)
+    -- ** Deriving instances
+  , Strategy(..)
+    -- ** Foreign imports
+  , ForeignImportDecl(..)
+  , FunctionParameter(..)
+    -- ** Function declarations
+  , FunctionDecl(..)
+    -- ** 'HsBindgen.Runtime.Support.FunPtr.Class.ToFunPtr'
+  , ToFunPtrInstance(..)
+  , ForeignImportWrapper(..)
+    -- ** 'HsBindgen.Runtime.Support.FunPtr.Class.FromFunPtr'
+  , FromFunPtrInstance(..)
+  , ForeignImportDynamic(..)
+    -- ** @StaticSize@, @ReadRaw@, @WriteRaw@
+  , StaticSizeInstance(..)
+  , ReadRawInstance(..)
+  , WriteRawInstance(..)
+  , ReadRawCField(..)
+  , WriteRawCField(..)
+    -- ** 'Foreign.Storable.Storable'
+  , StorableInstance(..)
+  , PeekCField(..)
+  , PokeCField(..)
+    -- ** 'HsBindgen.Instances.Prim'
+  , PrimInstance(..)
+  , IndexPrimFieldData(..)
+  , IndexByteArrayField(..)
+  , IndexOffAddrField(..)
+  , ReadPrimFieldsData(..)
+  , ReadByteArrayFields(..)
+  , ReadOffAddrFields(..)
+  , WritePrimFieldsData(..)
+  , WriteByteArrayFields(..)
+  , WriteOffAddrFields(..)
+    -- ** 'HsBindgen.Runtime.HasCField.HasCField'
+  , HasCFieldInstance(..)
+    -- ** 'HsBindgen.Runtime.HasCBitfield.HasCBitfield'
+  , HasCBitfieldInstance(..)
+    -- ** 'GHC.Records.HasField'
+  , HasFieldInstance(..)
+  , HasFieldImpl(..)
+    -- ** 'GHC.Records.Compat.HasField'
+  , HasFieldCompatInstance(..)
+  , HasFieldCompatImpl(..)
+    -- ** 'GHC.Records.HasField' for the pointer manipulation API
+  , HasFieldPtrInstance(..)
+  , HasFieldPtrInstanceVia(..)
+    -- ** 'HasFlam'
+  , HasFlamInstance(..)
+    -- ** 'CEnum'
+  , CEnumInstance(..)
+  , SequentialCEnumInstance(..)
+    -- ** Statements
+  , Seq(..)
+    -- ** Type synonyms
+  , TypSyn (..)
+    -- ** Structs
+  , StructCon (..)
+  , ElimStruct(..)
+  , makeElimStruct
+    -- ** Pattern Synonyms
+  , PatSyn(..)
+  , CompletePragma(..)
+  ) where
+
+import Data.Type.Nat (SNat, SNatI, snat)
+import Data.Type.Nat qualified as Fin
+import DeBruijn (Add (..), Ctx, EmptyCtx, Idx (..), Wk (..))
+
+import HsBindgen.Backend.Hs.AST.CompletePragma
+import HsBindgen.Backend.Hs.AST.Strategy
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.Hs.Origin qualified as Origin
+import HsBindgen.Backend.SHs.AST qualified as SHs
+import HsBindgen.Backend.UniqueSymbol
+import HsBindgen.BindingSpec.Private.V1 qualified as BindingSpec
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.NameHint
+import HsBindgen.Orphans ()
+
+{-------------------------------------------------------------------------------
+  Information about generated code
+-------------------------------------------------------------------------------}
+
+data Field = Field{
+      name    :: Hs.Name Hs.NsVar
+    , typ     :: Hs.Type
+    , origin  :: Origin.Field
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+-- | Struct
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1757>
+-- For enums we generate /both/ a newtype /and/ a struct, and then define
+-- instances only for the struct. We should get rid of this nasty hack.
+data Struct = Struct{
+      name      :: Hs.Name Hs.NsTypeConstr
+    , constr    :: Hs.Name Hs.NsConstr
+    , fields    :: [Field]
+    , origin    :: Maybe (Origin.Decl Origin.Struct)
+    , instances :: Set Inst.TypeClass
+    , comment   :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+data EmptyData = EmptyData{
+      name      :: Hs.Name Hs.NsTypeConstr
+    , origin    :: Origin.Decl Origin.EmptyData
+    , instances :: Set Inst.TypeClass
+    , comment   :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+data Newtype = Newtype{
+      name      :: Hs.Name Hs.NsTypeConstr
+    , constr    :: Hs.Name Hs.NsConstr
+    , ffiType   :: Maybe BindingSpec.HsFFIType
+    , field     :: Field
+    , origin    :: Origin.Decl Origin.Newtype
+    , instances :: Set Inst.TypeClass
+    , comment   :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+data ForeignImportDecl = ForeignImportDecl{
+      name       :: Hs.TermName
+    , parameters :: [FunctionParameter Hs.FFIType]
+    , result     :: Hs.FFIResType
+    , origName   :: C.DeclName
+    , callConv   :: CallConv
+    , origin     :: Origin.ForeignImport
+    , comment    :: Maybe HsDoc.Comment
+    , safety     :: SHs.Safety
+    }
+  deriving stock (Generic, Show)
+
+data FunctionParameter t = FunctionParameter{
+      typ     :: t
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+data FunctionDecl = FunctionDecl{
+      name       :: Hs.TermName
+    , parameters :: [FunctionParameter Hs.Type]
+    , result     :: Hs.Type
+    , body       :: SHs.ClosedExpr
+    , origin     :: Origin.ForeignImport
+    , pragmas    :: [SHs.Pragma]
+    , comment    :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+data UnionGetter = UnionGetter{
+      name    :: Hs.Name Hs.NsVar
+    , typ     :: Hs.Type
+    , constr  :: Hs.Name Hs.NsTypeConstr
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+data UnionSetter = UnionSetter{
+      name    :: Hs.Name Hs.NsVar
+    , typ     :: Hs.Type
+    , constr  :: Hs.Name Hs.NsTypeConstr
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+data DeriveInstance = DeriveInstance{
+      strategy :: Strategy Hs.Type
+    , clss     :: Inst.TypeClass
+    , name     :: Hs.Name Hs.NsTypeConstr
+    , comment  :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+data Var = Var{
+      name    :: Hs.TermName
+    , typ     :: SHs.ClosedType
+    , expr    :: SHs.ClosedExpr
+    , pragmas :: [SHs.Pragma]
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
+
+{-------------------------------------------------------------------------------
+  Variable binding
+-------------------------------------------------------------------------------}
+
+-- | Lambda abstraction
+type Lambda :: (Ctx -> Star) -> (Ctx -> Star)
+data Lambda t ctx = Lambda
+    NameHint  -- ^ name suggestion
+    (t (S ctx)) -- ^ body
+
+deriving instance Show (t (S ctx)) => Show (Lambda t ctx)
+
+-- | Direct application (non-applicative)
+--
+-- Unlike t'Ap' which uses applicative composition (<*>), DirectApply directly
+-- applies a constructor to a list of expressions.
+--
+data Apply pure xs ctx = Apply (pure ctx) [xs ctx]
+  deriving stock (Generic, Show)
+
+-- | Applicative structure
+data Ap pure xs ctx = Ap (pure ctx) [xs ctx]
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  Declarations
+-------------------------------------------------------------------------------}
+
+-- | Top-level declaration
+type Decl :: Star -> Star
+data Decl l where
+    DeclTypSyn               :: TypSyn               -> Decl l
+    DeclData                 :: Struct               -> Decl l
+    DeclEmpty                :: EmptyData            -> Decl l
+    DeclNewtype              :: Newtype              -> Decl l
+    DeclPatSyn               :: PatSyn               -> Decl l
+    DeclCompletePragma       :: CompletePragma       -> Decl l
+    DeclDefineInstance       :: DefineInstance       -> Decl l
+    DeclDeriveInstance       :: DeriveInstance       -> Decl l
+    DeclForeignImport        :: ForeignImportDecl    -> Decl l
+    DeclForeignImportDynamic :: ForeignImportDynamic -> Decl l
+    DeclForeignImportWrapper :: ForeignImportWrapper -> Decl l
+    DeclFunction             :: FunctionDecl         -> Decl l
+    DeclMacroValue           :: MacroValue l         -> Decl l
+    DeclVar                  :: Var                  -> Decl l
+deriving stock instance Show (Decl l)
+
+data DefineInstance = DefineInstance{
+      instanceDecl :: InstanceDecl
+    , comment      :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+-- | Class instance declaration (with code that /we/ generate)
+type InstanceDecl :: Star
+data InstanceDecl where
+    -- | 'StaticSize' only needs the type's name (its methods use proxies), so
+    -- it accepts a bare name rather than a 'Struct'.  This lets field-less empty
+    -- data types (the @emptydata@ representation) carry a 'StaticSize' instance.
+    InstanceStaticSize      :: Hs.Name Hs.NsTypeConstr -> StaticSizeInstance -> InstanceDecl
+    InstanceReadRaw         :: Struct -> ReadRawInstance -> InstanceDecl
+    InstanceWriteRaw        :: Struct -> WriteRawInstance -> InstanceDecl
+    InstanceStorable        :: Struct -> StorableInstance -> InstanceDecl
+    InstanceHasCField       :: HasCFieldInstance -> InstanceDecl
+    InstanceHasCBitfield    :: HasCBitfieldInstance -> InstanceDecl
+    InstanceHasField        :: HasFieldInstance -> InstanceDecl
+    InstanceHasFieldCompat  :: HasFieldCompatInstance -> InstanceDecl
+    InstanceHasFieldPtr     :: HasFieldPtrInstance -> InstanceDecl
+    InstanceHasFlam         :: Struct -> HasFlamInstance -> InstanceDecl
+    -- | The 'Struct' wraps the C enum's underlying integer field. Invariant:
+    -- exactly one field. Established at 'HsBindgen.Backend.Hs.Translation'
+    -- where these instances are built from a 'Newtype' carrying a single field.
+    InstanceCEnum           :: Struct -> CEnumInstance -> InstanceDecl
+    InstanceSequentialCEnum :: Struct -> SequentialCEnumInstance -> InstanceDecl
+    InstanceCEnumShow       :: Struct -> InstanceDecl
+    InstanceCEnumRead       :: Struct -> InstanceDecl
+    InstanceToFunPtr        :: ToFunPtrInstance -> InstanceDecl
+    InstanceFromFunPtr      :: FromFunPtrInstance -> InstanceDecl
+
+deriving instance Show InstanceDecl
+
+-- | Macro expression
+type MacroValue :: Star -> Star
+data MacroValue l = MacroValue {
+    -- | Name of variable/function.
+      name    :: Hs.Name Hs.NsVar
+    -- | Type of variable/function.
+    , expr    :: TypecheckedMacroValue l Final
+    -- | RHS of variable/function.
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  Pattern Synonyms
+-------------------------------------------------------------------------------}
+
+-- | Pattern synonyms
+--
+-- Supports pattern synonyms of the following forms:
+--
+-- @
+-- pattern P :: T
+-- pattern P = C e
+-- @
+--
+-- and
+--
+-- @
+-- pattern P :: T
+-- pattern P = e
+-- @
+--
+data PatSyn = PatSyn{
+      name    :: Hs.Name Hs.NsConstr
+    , typ     :: Hs.Type
+    , constr  :: Maybe (Hs.Name Hs.NsConstr)
+    , value   :: Integer
+    , origin  :: Origin.PatSyn
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'ToFunPtr'
+-------------------------------------------------------------------------------}
+
+-- | 'HsBindgen.Runtime.Support.FunPtr.Class.ToFunPtr' instance
+data ToFunPtrInstance = ToFunPtrInstance{
+      typ  :: Hs.Type
+    , body :: UniqueSymbol
+    }
+  deriving stock (Generic, Show)
+
+-- | A dynamic wrapper
+--
+-- For example, assuming @name = "foo"@ and @funType = ft@
+--
+-- > foreign import ccall "wrapper" foo :: ft -> IO (FunPtr ft)
+--
+-- <https://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1620008.5.1>
+data ForeignImportWrapper = ForeignImportWrapper {
+      name    :: UniqueSymbol
+    , funType :: Hs.FFIFunType
+    , origin  :: Origin.ForeignImport
+    , comment :: Maybe HsDoc.Comment
+    }
+    deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'FromFunPtr'
+-------------------------------------------------------------------------------}
+
+-- | 'HsBindgen.Runtime.Support.FunPtr.Class.FromFunPtr' instance
+data FromFunPtrInstance = FromFunPtrInstance{
+      typ  :: Hs.Type
+    , body :: UniqueSymbol
+    }
+  deriving stock (Generic, Show)
+
+-- | A dynamic import
+--
+-- For example, assuming @name = "foo"@ and @funType = ft@
+--
+-- > foreign import ccall "dynamic" foo :: FunPtr ft -> ft
+--
+-- <https://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1620008.5.1>
+data ForeignImportDynamic = ForeignImportDynamic {
+      name    :: UniqueSymbol
+    , funType :: Hs.FFIFunType
+    , origin  :: Origin.ForeignImport
+    , comment :: Maybe HsDoc.Comment
+    }
+    deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  @StaticSize@, @ReadRaw@, @WriteRaw@
+-------------------------------------------------------------------------------}
+
+-- | 'HsBindgen.Runtime.Marshal.StaticSize' instance
+--
+-- Currently this models storable instances for structs /only/.
+data StaticSizeInstance = StaticSizeInstance{
+      staticSizeOf    :: Int
+    , staticAlignment :: Int
+    }
+  deriving stock (Generic, Show)
+
+-- | 'HsBindgen.Runtime.Marshal.ReadRaw' instance
+--
+-- Currently this models storable instances for structs /only/.
+data ReadRawInstance = ReadRawInstance{
+      readRaw :: Lambda (Ap StructCon ReadRawCField) EmptyCtx
+    }
+  deriving stock (Generic, Show)
+
+-- | 'HsBindgen.Runtime.Marshal.WriteRaw' instance
+--
+-- Currently this models storable instances for structs /only/.
+data WriteRawInstance = WriteRawInstance{
+      writeRaw :: Lambda (Lambda (ElimStruct (Seq WriteRawCField))) EmptyCtx
+    }
+  deriving stock (Generic, Show)
+
+-- | A call to 'HsBindgen.Runtime.HasCField.readRawCField', 'HsBindgen.Runtime.HasCBitfield.readRawCBitfield', or 'HsBindgen.Runtime.HasCField.readRawByteOff'
+type ReadRawCField :: Ctx -> Star
+data ReadRawCField ctx =
+    ReadRawCField Hs.Type (Idx ctx)
+  | ReadRawCBitfield Hs.Type (Idx ctx)
+  | ReadRawByteOff (Idx ctx) Int
+  deriving stock (Generic, Show)
+
+-- | A call to 'HsBindgen.Runtime.HasCField.writeRawCField', 'HsBindgen.Runtime.HasCBitfield.writeRawCBitfield', or 'HsBindgen.Runtime.HasCField.writeRawByteOff'
+type WriteRawCField :: Ctx -> Star
+data WriteRawCField ctx =
+    WriteRawCField Hs.Type (Idx ctx) (Idx ctx)
+  | WriteRawCBitfield Hs.Type (Idx ctx) (Idx ctx)
+  | WriteRawByteOff (Idx ctx) Int (Idx ctx)
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'Storable'
+-------------------------------------------------------------------------------}
+
+-- | 'Foreign.Storable.Storable' instance
+--
+-- Currently this models storable instances for structs /only/.
+--
+-- <https://hackage.haskell.org/package/base/docs/Foreign-Storable.html#t:Storable>
+data StorableInstance = StorableInstance{
+      sizeOf    :: Int
+    , alignment :: Int
+    , peek      :: Lambda (Ap StructCon PeekCField) EmptyCtx
+    , poke      :: Lambda (Lambda (ElimStruct (Seq PokeCField))) EmptyCtx
+    }
+  deriving stock (Generic, Show)
+
+-- | A call to 'HsBindgen.Runtime.HasCField.peekCField', 'HsBindgen.Runtime.HasCBitfield.peekCBitfield', or 'Foreign.Storable.peekByteOff'.
+type PeekCField :: Ctx -> Star
+data PeekCField ctx =
+    PeekCField Hs.Type (Idx ctx)
+  | PeekCBitfield Hs.Type (Idx ctx)
+  | PeekByteOff (Idx ctx) Int
+  deriving stock (Generic, Show)
+
+-- | A call to 'HsBindgen.Runtime.HasCField.pokeCField', 'HsBindgen.Runtime.HasCBitfield.pokeCBitfield', or 'Foreign.Storable.pokeByteOff'.
+type PokeCField :: Ctx -> Star
+data PokeCField ctx =
+    PokeCField Hs.Type (Idx ctx) (Idx ctx)
+  | PokeCBitfield Hs.Type (Idx ctx) (Idx ctx)
+  | PokeByteOff (Idx ctx) Int (Idx ctx)
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'Prim'
+-------------------------------------------------------------------------------}
+
+-- | Prim instance for a struct
+--
+-- Generates explicit implementations of all Prim methods for structs
+-- where all fields are Prim instances.
+--
+-- Unlike Storable which uses byte offsets and pointer operations, Prim uses
+-- element indices and direct primitive operations. The key difference:
+--
+-- * Storable: @peekByteOff ptr byteOffset@
+-- * Prim: @indexByteArray# arr# (numFields# *# i# +# fieldPos#)@
+--
+-- <https://hackage.haskell.org/package/primitive/docs/Data-Primitive-Types.html#t:Prim>
+data PrimInstance = PrimInstance{
+      -- | Total size in bytes
+      sizeOf :: Int
+
+      -- | Alignment requirement
+    , alignment :: Int
+
+      -- | @indexByteArray# :: ByteArray# -> Int# -> a@
+      --
+      -- Takes array and element index, returns struct by indexing each field
+      -- Body: StructCon with direct field calls (no applicative)
+    , indexByteArray :: Lambda (Lambda (Apply StructCon IndexByteArrayField)) EmptyCtx
+
+      -- | @readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, a #)@
+      --
+      -- Takes array, element index, and state; returns new state and struct
+    , readByteArray :: Lambda (Lambda (Lambda ReadByteArrayFields)) EmptyCtx
+
+      -- | @writeByteArray# :: MutableByteArray# s -> Int# -> a -> State# s -> State# s@
+      --
+      -- Takes array, element index, struct value, and state; returns new state
+    , writeByteArray :: Lambda (Lambda (Lambda (Lambda (ElimStruct WriteByteArrayFields)))) EmptyCtx
+
+      -- | @indexOffAddr# :: Addr# -> Int# -> a@
+      --
+      -- Takes address and element index, returns struct by indexing each field
+      -- Body: StructCon with direct field calls (no applicative)
+    , indexOffAddr :: Lambda (Lambda (Apply StructCon IndexOffAddrField)) EmptyCtx
+
+      -- | readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, a #)
+      --
+      -- Takes address, element index, and state; returns new state and struct
+
+    , readOffAddr :: Lambda (Lambda (Lambda ReadOffAddrFields)) EmptyCtx
+
+      -- | writeOffAddr# :: Addr# -> Int# -> a -> State# s -> State# s
+      --
+      -- Takes address, element index, struct value, and state; returns new state
+    , writeOffAddr :: Lambda (Lambda (Lambda (Lambda (ElimStruct WriteOffAddrFields)))) EmptyCtx
+    }
+  deriving stock (Generic, Show)
+
+-- | Common field metadata for indexing operations
+type IndexPrimFieldData :: Ctx -> Star
+data IndexPrimFieldData ctx = IndexPrimFieldData{
+      typ       :: Hs.Type -- ^ Field type
+    , arg1      :: Idx ctx -- ^ First argument variable
+    , arg2      :: Idx ctx -- ^ Second argument variable
+    , pos       :: Int     -- ^ Field position (0-based)
+    , numFields :: Int     -- ^ Total number of fields
+    }
+  deriving stock (Generic, Show)
+
+-- | Index a field from ByteArray# using indexByteArray#
+--
+-- For a struct with n fields at element index i, field f is at position: n*i + f
+-- Example: @indexByteArray# arr# (3# *# i# +# 1#)@ for field 1 of a 3-field struct
+--
+type IndexByteArrayField :: Ctx -> Star
+data IndexByteArrayField ctx = IndexByteArrayField{
+      metadata :: IndexPrimFieldData ctx
+    }
+  deriving stock (Generic, Show)
+
+-- | Index a field from Addr# using indexOffAddr#
+--
+-- For a struct with n fields at element index i, field f is at position: n*i + f
+-- Example: @indexOffAddr# addr# (3# *# i# +# 1#)@ for field 1 of a 3-field struct
+type IndexOffAddrField :: Ctx -> Star
+data IndexOffAddrField ctx = IndexOffAddrField{
+      metadata :: IndexPrimFieldData ctx
+    }
+  deriving stock (Generic, Show)
+
+-- | Common field metadata for read operations
+type ReadPrimFieldsData :: Ctx -> Star
+data ReadPrimFieldsData ctx = ReadPrimFieldsData{
+      fields    :: [(Hs.Type, Int)] -- ^ Fields: (type, position)
+    , arg1      :: Idx ctx         -- ^ First argument variable
+    , arg2      :: Idx ctx         -- ^ Second argument variable
+    , arg3      :: Idx ctx         -- ^ Third argument variable
+    , numFields :: Int             -- ^ Total number of fields
+    }
+  deriving stock (Generic, Show)
+
+-- | Read fields from MutableByteArray# with state threading
+--
+-- Generates nested case expressions to thread State# through multiple reads:
+--
+-- > case readByteArray# arr# (n# *# i# +# 0#) s0 of
+-- >   (# s1, x #) -> case readByteArray# arr# (n# *# i# +# 1#) s1 of
+-- >     (# s2, y #) -> (# s2, Struct x y #)
+--
+type ReadByteArrayFields :: Ctx -> Star
+data ReadByteArrayFields ctx = ReadByteArrayFields{
+      metadata :: ReadPrimFieldsData ctx
+    }
+  deriving stock (Generic, Show)
+
+-- | Read fields from Addr# with state threading
+--
+-- Generates nested case expressions to thread State# through multiple reads:
+--
+-- > case readOffAddr# addr# (n# *# i# +# 0#) s0 of
+-- >   (# s1, x #) -> case readOffAddr# addr# (n# *# i# +# 1#) s1 of
+-- >     (# s2, y #) -> (# s2, Struct x y #)
+--
+type ReadOffAddrFields :: Ctx -> Star
+data ReadOffAddrFields ctx = ReadOffAddrFields{
+      metadata :: ReadPrimFieldsData ctx
+    }
+  deriving stock (Generic, Show)
+
+-- | Common field metadata for write operations
+data WritePrimFieldsData ctx = WritePrimFieldsData{
+      fields    :: [(Hs.Type, Int, Idx ctx)] -- ^ Fields: (type, position, value variable)
+    , arg1      :: Idx ctx                   -- ^ First argument variable
+    , arg2      :: Idx ctx                   -- ^ Second argument variable
+    , arg3      :: Idx ctx                   -- ^ Third argument variable
+    , numFields :: Int                       -- ^ Total number of fields
+    }
+  deriving stock (Generic, Show)
+
+-- | Write fields to MutableByteArray# with state threading
+--
+-- Generates sequential writes that thread State# through:
+--
+-- > case writeByteArray# arr# (n# *# i# +# 0#) x s0 of
+-- >   s1 -> writeByteArray# arr# (n# *# i# +# 1#) y s1
+--
+type WriteByteArrayFields :: Ctx -> Star
+data WriteByteArrayFields ctx = WriteByteArrayFields {
+      metadata :: WritePrimFieldsData ctx
+    }
+  deriving stock (Generic, Show)
+
+-- | Write fields to Addr# with state threading
+--
+-- Generates sequential writes that thread State# through:
+--
+-- > case writeOffAddr# addr# (n# *# i# +# 0#) x s0 of
+-- >   s1 -> writeOffAddr# addr# (n# *# i# +# 1#) y s1
+--
+type WriteOffAddrFields :: Ctx -> Star
+data WriteOffAddrFields ctx = WriteOffAddrFields {
+      metadata :: WritePrimFieldsData ctx
+    }
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'HasCField'
+-------------------------------------------------------------------------------}
+
+-- | 'HsBindgen.Runtime.HasCField.HasCField' instance
+data HasCFieldInstance = HasCFieldInstance {
+      -- | The haskell type of the parent C object
+      parentType :: Hs.Type
+
+      -- | The name of the field
+    , fieldName :: Hs.Name Hs.NsVar
+
+      -- | The haskell type of the field
+    , cFieldType :: Hs.Type
+
+      -- | The offset (in number of bytes) of the field wrt the parent object
+    , fieldOffset :: Int
+    }
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'HasCBitfield'
+-------------------------------------------------------------------------------}
+
+-- | 'HsBindgen.Runtime.HasCBitfield.HasCBitfield' instance
+data HasCBitfieldInstance = HasCBitfieldInstance {
+      -- | The haskell type of the parent C object
+      parentType :: Hs.Type
+
+      -- | The name of the bit-field
+    , fieldName :: Hs.Name Hs.NsVar
+
+      -- | The haskell type of the bit-field
+    , cBitfieldType :: Hs.Type
+
+      -- | The offset (in number of bit) of the bit-field wrt the parent object
+    , bitOffset :: Int
+
+      -- | The width (in number of bits) of the bit-field.
+    , bitWidth :: Int
+    }
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'GHC.Records.HasField'
+-------------------------------------------------------------------------------}
+
+-- | 'GHC.Records.HasField' instance
+data HasFieldInstance = HasFieldInstance {
+      -- | The Haskell type of the parent C object
+      parentType :: Hs.Type
+
+      -- | The name of the field
+    , fieldName :: Hs.Name Hs.NsVar
+
+      -- | The haskell type of the field
+    , fieldType :: Hs.Type
+
+      -- | Implementation of member functions
+    , impl :: HasFieldImpl
+    }
+  deriving stock (Generic, Show)
+
+-- | 'GHC.Records.HasField.getField' implementation
+data HasFieldImpl =
+    -- | union fields
+    HasFieldImplUnion
+    -- | union bit-fields
+  | HasFieldImplUnionBits {
+        bitOffset :: Int
+      , bitWidth :: Int
+      }
+    -- | indirect fields
+  | HasFieldImplIndirect {
+        -- | The name of the field to go from the current top-level struct/union
+        -- to an anonyous struct/union
+        nameTopToAnon :: Hs.Name Hs.NsVar
+        -- | The name of the field to go from the anonymous struct/union to the
+        -- target field (the one we are accessing indirectly)
+      , nameAnonToTarget :: Hs.Name Hs.NsVar
+      }
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'GHC.Records.Compat.HasField'
+-------------------------------------------------------------------------------}
+
+-- | 'GHC.Records.Compat.HasField' instance
+data HasFieldCompatInstance = HasFieldCompatInstance {
+      -- | The Haskell type of the parent C object
+      parentType :: Hs.Type
+
+      -- | The name of the field
+    , fieldName :: Hs.Name Hs.NsVar
+
+      -- | The haskell type of the field
+    , fieldType :: Hs.Type
+
+      -- | Implementation of member functions
+    , impl :: HasFieldCompatImpl
+    }
+  deriving stock (Generic, Show)
+
+-- | 'GHC.Records.Compat.HasField.hasField' implementation
+data HasFieldCompatImpl =
+    -- | structs, typedefs, enums, and macro types
+    HasFieldCompatImplRecord {
+        constr :: Hs.Name Hs.NsConstr
+        -- | Fields that are unchanged
+      , otherFields :: [Hs.Name Hs.NsVar]
+      }
+    -- | union fields
+  | HasFieldCompatImplUnion
+    -- | union bit-fields
+  | HasFieldCompatImplUnionBits {
+        bitOffset :: Int
+      , bitWidth :: Int
+      }
+    -- | Indirect fields
+  | HasFieldCompatImplIndirect {
+        -- | The name of the field to go from the current top-level struct/union
+        -- to an anonyous struct/union
+        nameTopToAnon :: Hs.Name Hs.NsVar
+        -- | The name of the field to go from the anonymous struct/union to the
+        -- target field (the one we are accessing indirectly)
+      , nameAnonToTarget :: Hs.Name Hs.NsVar
+      }
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'GHC.Records.HasField' for the pointer manipulation API
+-------------------------------------------------------------------------------}
+
+-- | 'GHC.Records.HasField' instance for the pointer manipulation API
+data HasFieldPtrInstance = HasFieldPtrInstance {
+      -- | The Haskell type of the parent C object
+      parentType :: Hs.Type
+
+      -- | The name of the field
+    , fieldName :: Hs.Name Hs.NsVar
+
+      -- | The haskell type of the field
+    , fieldType :: Hs.Type
+
+      -- | Implement the instance via a 'HsBindgen.Runtime.HasCField.HasCField'
+      -- or 'HsBindgen.Runtime.HasCBitfield.HasCBitfield' instance.
+    , deriveVia :: HasFieldPtrInstanceVia
+    }
+  deriving stock (Generic, Show)
+
+-- | See the @deriveVia@ field of 'HasFieldPtrInstance'.
+data HasFieldPtrInstanceVia = ViaHasCField | ViaHasCBitfield
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  'HasFlam'
+-------------------------------------------------------------------------------}
+
+data HasFlamInstance = HasFlamInstance {
+      typ    :: Hs.Type
+    , offset :: Int
+    }
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  CEnum
+-------------------------------------------------------------------------------}
+
+data CEnumInstance = CEnumInstance {
+      fieldType    :: Hs.Type
+    , valueNames   :: Map Integer (NonEmpty String)
+    , isSequential :: Bool
+    }
+  deriving stock (Generic, Show)
+
+data SequentialCEnumInstance = SequentialCEnumInstance {
+      minName :: Hs.Name Hs.NsConstr
+    , maxName :: Hs.Name Hs.NsConstr
+    }
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  Statements
+-------------------------------------------------------------------------------}
+
+-- | Simple sequential composition (no bindings)
+newtype Seq t ctx = Seq [t ctx]
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  Type synonyms
+-------------------------------------------------------------------------------}
+
+-- | Type synonyms
+--
+-- At the moment, we do not support type variables.
+data TypSyn = TypSyn{
+      name    :: Hs.Name Hs.NsTypeConstr
+    , typ     :: Hs.Type
+      -- TODO <https://github.com/well-typed/hs-bindgen/issues/1448>
+      -- Temporary: origin will be gone.
+    , origin  :: Origin.Decl Origin.EmptyData
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+
+{-------------------------------------------------------------------------------
+  Structs
+-------------------------------------------------------------------------------}
+
+type StructCon :: Ctx -> Star
+data StructCon ctx where
+    StructCon :: Struct -> StructCon ctx
+
+deriving instance Show (StructCon ctx)
+
+-- | Case split for a struct
+type ElimStruct :: (Ctx -> Star) -> (Ctx -> Star)
+data ElimStruct t ctx where
+    ElimStruct ::
+         Idx ctx
+      -> Hs.Name Hs.NsConstr
+      -> Vec n NameHint
+      -> Add n ctx ctx'
+      -> t ctx'
+      -> ElimStruct t ctx
+
+deriving instance (forall ctx'. Show (t ctx')) => Show (ElimStruct t ctx)
+
+-- | Create 'HsBindgen.Backend.Hs.AST.ElimStruct' using kind-of HOAS interface.
+makeElimStruct :: forall n ctx t.
+     SNatI n
+  => Idx ctx
+  -> Hs.Name Hs.NsConstr
+  -> Vec n NameHint
+  -> (forall ctx'. Wk ctx ctx' -> Vec n (Idx ctx') -> t ctx')
+  -> ElimStruct t ctx
+makeElimStruct s constr hints kont = makeElimStruct' (snat :: SNat n) $ \add wk xs ->
+    ElimStruct s constr hints add (kont wk xs)
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1757>
+-- - Use Data.Type.Nat.induction instead of explicit recursion.
+-- - Verify that we bind fields in right order.
+makeElimStruct' :: forall m ctx t.
+     SNat m
+  -> ( forall ctx'.
+            Add m ctx ctx'
+         -> Wk ctx ctx'
+         -> Vec m (Idx ctx')
+         -> ElimStruct t ctx
+     )
+  -> ElimStruct t ctx
+makeElimStruct' Fin.SZ      kont = kont AZ IdWk VNil
+makeElimStruct' (Fin.SS' n) kont = makeElimStruct' n $ \add wk xs ->
+    kont (AS add) (SkipWk wk) (IZ ::: fmap IS xs)
diff --git a/src-internal/HsBindgen/Backend/Hs/AST/CompletePragma.hs b/src-internal/HsBindgen/Backend/Hs/AST/CompletePragma.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/AST/CompletePragma.hs
@@ -0,0 +1,20 @@
+module HsBindgen.Backend.Hs.AST.CompletePragma (
+    -- * Type
+    CompletePragma(..)
+  ) where
+
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Type
+-------------------------------------------------------------------------------}
+
+-- | @COMPLETE@ pragma
+--
+-- This corresponds to a @COMPLETE@ pragma listing the specified pattern names.
+-- No type is specified.
+data CompletePragma = CompletePragma {
+      patterns :: [Hs.Name Hs.NsConstr]
+    }
+  deriving stock (Generic, Show)
diff --git a/src-internal/HsBindgen/Backend/Hs/AST/Strategy.hs b/src-internal/HsBindgen/Backend/Hs/AST/Strategy.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/AST/Strategy.hs
@@ -0,0 +1,12 @@
+module HsBindgen.Backend.Hs.AST.Strategy (
+    Strategy (..),
+) where
+
+import HsBindgen.Imports
+
+-- | Deriving strategy
+data Strategy ty =
+    DeriveNewtype
+  | DeriveStock
+  | DeriveVia ty
+  deriving stock (Generic, Show, Eq, Functor, Foldable, Traversable)
diff --git a/src-internal/HsBindgen/Backend/Hs/CallConv.hs b/src-internal/HsBindgen/Backend/Hs/CallConv.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/CallConv.hs
@@ -0,0 +1,83 @@
+-- | Calling conventions
+--
+-- Intended for unqualified import.
+module HsBindgen.Backend.Hs.CallConv (
+    CWrapper(..)
+  , getCWrappersSource
+  , CallConv(..)
+  , ImportStyle(..)
+  , capiModule
+  ) where
+
+import GHC.Generics (Generic)
+
+import HsBindgen.Backend.Runtime qualified as Runtime
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | The 'CallConvUserlandCapi' requires a wrapper on the C side with a
+-- corresponding import.
+newtype CWrapper = CWrapper {
+      definition :: String
+    }
+  deriving (Show, Generic)
+
+-- | Source of the C translation unit containing the wrappers
+--
+-- The wrappers are preceded by the /whole/ root header, verbatim and in order,
+-- reproducing the environment in which the declarations were parsed, including
+-- the interleaving of @#define@s and @#include@s.
+--
+-- Duplicate @#include@s are preserved deliberately: re-inclusion at a different
+-- point in the sequence is meaningful (X-macro headers). A header that cannot
+-- tolerate double inclusion fails the root header parse in the binding
+-- generation stage.
+--
+-- We emit nothing when there are no wrappers, so that a module without wrappers
+-- does not gain a C translation unit.
+getCWrappersSource :: [C.RootDirective C.HashIncludeArg] -> [CWrapper] -> String
+getCWrappersSource _         [] = ""
+getCWrappersSource directives wrappers =
+    C.renderRootDirectives directives ++ concatMap (.definition) wrappers
+
+data CallConv =
+    -- | Our default calling convention: userland CAPI
+    --
+    -- There is no need to import the C header into the Haskell source file in
+    -- this case (the C header is only used by the wrapper on the C side).
+    --
+    -- We directly attach the C-side wrappers.
+    CallConvUserlandCapi CWrapper
+
+    -- | The standard GHC @capi@ calling convention
+    --
+    -- Although the @capi@ calling convention technically supports by-reference
+    -- imports, it does not actually do anything different than @ccall@ in this
+    -- case, and ignores the C header. For this reason we only support @ccall@
+    -- here.
+    --
+    -- NOTE: At the moment, we do not use the standard @capi@ calling
+    -- convention. We used it for symbol imports, but now also create wrappers
+    -- for those to work around bugs on Windows. We decided to leave the
+    -- constructor in, in case we need it in the future.
+  | CallConvGhcCapi FilePath
+
+    -- | The standard GHC \"ccall\" calling convention
+  | CallConvGhcCCall ImportStyle
+  deriving stock (Generic, Show)
+
+data ImportStyle =
+    -- | Regular import
+    ImportAsValue
+
+    -- | @foreign import capi safe "header.h &foo" foo :: Ptr ..
+  | ImportAsPtr
+  deriving stock (Generic, Show)
+
+-- | Module providing the userland CAPI support code.
+capiModule :: Hs.ModuleName
+capiModule = Runtime.moduleName Runtime.CAPI
diff --git a/src-internal/HsBindgen/Backend/Hs/Haddock/Documentation.hs b/src-internal/HsBindgen/Backend/Hs/Haddock/Documentation.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Haddock/Documentation.hs
@@ -0,0 +1,216 @@
+-- | Haddock documentation
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+module HsBindgen.Backend.Hs.Haddock.Documentation (
+    -- * Definition
+    Comment(..)
+  , CommentInlineContent(..)
+  , CommentMeta(..)
+  , CommentBlockContent(..)
+  , HeaderLevel(..)
+  , ListType(..)
+    -- * Construction helpers
+  , title
+  , simple
+  , uniqueSymbol
+  , paragraph
+  , monospace
+  ) where
+
+import Data.Semigroup qualified as Semigroup
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Backend.UniqueSymbol
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Haddock documentation representation
+--
+data Comment = Comment {
+    -- | Comment title
+    title :: Maybe [CommentInlineContent]
+
+    -- | Original C name reference
+  , origin :: Maybe Text
+
+    -- | C literal representation (for character and string macro literals)
+  , literal :: Maybe Text
+
+    -- | The source location of the original C name reference
+  , location :: Maybe (SingleLoc C.DeclPath)
+
+    -- | Origin of the C declaration
+  , declOrigin :: Maybe C.DeclOrigin
+
+    -- | Unique symbol used to generate this binding
+  , unique :: Maybe UniqueSymbol
+
+    -- | | Comment content
+  , children :: [CommentBlockContent]
+  }
+  deriving (Show, Eq, Generic)
+
+instance Semigroup Comment where
+  a <> b = Comment {
+        title      = combine (.title)      (<>)
+      , origin     = combine (.origin)     getFirst
+      , literal    = combine (.literal)    getFirst
+      , location   = combine (.location)   getFirst
+      , declOrigin = combine (.declOrigin) getFirst
+      , unique     = combine (.unique)     getFirst
+      , children   = combine (.children)   (<>)
+      }
+    where
+      combine :: (Comment -> a) -> (a -> a -> a) -> a
+      combine f op = f a `op` f b
+
+      getFirst :: Maybe a -> Maybe a -> Maybe a
+      getFirst x y =
+          Semigroup.getFirst <$>
+            (Semigroup.First <$> x) <> (Semigroup.First <$> y)
+
+instance Monoid Comment where
+  mempty = Comment {
+        title      = Nothing
+      , origin     = Nothing
+      , literal    = Nothing
+      , location   = Nothing
+      , declOrigin = Nothing
+      , unique     = Nothing
+      , children   = []
+      }
+
+-- | Block-level Haddock content
+--
+data CommentBlockContent
+  = Paragraph
+      { paragraphContent      :: [CommentInlineContent] -- ^ Paragraph content
+      }
+  | CodeBlock
+      { codeBlockLines        :: [Text] -- ^ @ ... @
+      }
+  | Verbatim
+      { verbatimContent       :: Text -- ^ > code
+      }
+  | Example
+      { exampleContent        :: Text -- ^ >>> ... (example)
+      }
+  | Property
+      { propertyContent       :: Text -- ^ prop> ... (properties)
+      }
+  | ListItem
+      { listItemType          :: ListType
+      , listItemContent       :: [CommentBlockContent]
+      }
+  | DefinitionList                                     -- ^ [term]: definition
+      { definitionListTerm    :: CommentInlineContent  -- ^ [term]
+      , definitionListContent :: [CommentBlockContent] -- ^ definition
+      }
+  | Header
+      { headerLevel           :: HeaderLevel
+      , headerContent         :: [CommentInlineContent]
+      }
+  deriving (Show, Eq, Generic)
+
+data ListType
+  = BulletList           -- ^ * item
+  | NumberedList Natural -- ^ 1. item
+  deriving (Show, Eq, Generic)
+
+-- | Haddock levels only go up to 6. Extra '=' are treated as belonging to the
+-- text of the heading.
+--
+data HeaderLevel
+  = Level1 -- ^ =
+  | Level2 -- ^ ==
+  | Level3 -- ^ ===
+  | Level4 -- ^ ====
+  | Level5 -- ^ =====
+  | Level6 -- ^ ======
+  deriving (Show, Enum, Eq, Generic)
+
+-- | Inline content
+--
+data CommentInlineContent
+  = TextContent
+      { textContent       :: Text
+      }
+  | Monospace
+      { monospaceContent  :: [CommentInlineContent] -- ^ @ ... @
+      }
+  | Emph
+      { emphContent       :: [CommentInlineContent] -- ^ / ... /
+      }
+  | Bold
+      { boldContent       :: [CommentInlineContent] -- ^ __ ... __
+      }
+  | Module
+      { moduleContent     :: Text -- ^ "Module"
+      }
+  | Identifier
+      { identifierContent :: Text -- ^ @\'identifier\'@
+      }
+  | Type
+      { typeContent       :: Text -- ^ @t\'Type\'@
+      }
+  | Link                                            -- ^ [label](url)
+      { linkLabel         :: [CommentInlineContent] -- ^ link label
+      , linkURL           :: Text                   -- ^ link url
+      }
+  | URL
+      { urlContent        :: Text -- ^ <url>
+      }
+  | Anchor
+      { anchorContent     :: Text -- ^ #anchor#
+      }
+  | Math
+      { mathContent       :: [Text] -- ^ \( ... \) or \[ ... \]
+      }
+  | Metadata
+      { metadataContent   :: CommentMeta
+      }
+  | TypeSignature
+      { typeSignature     :: Hs.Type
+      }
+    -- ^ This constructor allows one to render a 'Hs.Type'. For example, when
+    -- generating FFI "wrapper" stubs it could be useful to take a 'HsBindgen.Backend.Hs.AST.Type.HsFun'
+    -- type and include it in the Haddocks, however one only has access to
+    -- the 'Hs.Type' pretty printer at rendering time.
+  deriving (Show, Eq, Generic)
+
+-- | Special metadata that can appear in docs
+--
+data CommentMeta
+  = Since { sinceContent :: Text } -- ^ @since 1.0
+  deriving (Show, Eq, Generic)
+
+{-------------------------------------------------------------------------------
+  Construction helpers
+-------------------------------------------------------------------------------}
+
+-- | Title only
+title :: [CommentInlineContent] -> Comment
+title content = mempty & #title .~ Just content
+
+-- | Content only
+simple :: [CommentBlockContent] -> Comment
+simple content = mempty & #children .~ content
+
+-- | Just record a unique symbol
+uniqueSymbol :: UniqueSymbol -> Comment
+uniqueSymbol unique = mempty & #unique .~ Just unique
+
+-- | Single paragraph comment
+paragraph :: [CommentInlineContent] -> Comment
+paragraph = simple . (:[]) . Paragraph
+
+monospace :: Text -> CommentInlineContent
+monospace = Monospace . (:[]) . TextContent
diff --git a/src-internal/HsBindgen/Backend/Hs/Haddock/Translation.hs b/src-internal/HsBindgen/Backend/Hs/Haddock/Translation.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Haddock/Translation.hs
@@ -0,0 +1,324 @@
+{-# LANGUAGE RecordWildCards #-}
+
+module HsBindgen.Backend.Hs.Haddock.Translation (
+    mkHaddocks
+  , mkHaddocksFieldInfo
+  , mkHaddocksDecorateParams
+  ) where
+
+import Data.Text qualified as Text
+
+import Clang.HighLevel.Types qualified as C
+
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Errors (panicPure)
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+
+import Doxygen.Parser.Types (ParamDirection (..), ParamListKind (..),
+                             SimpleSectKind (..))
+import Doxygen.Parser.Types qualified as Doxy
+
+{-------------------------------------------------------------------------------
+  Main API
+-------------------------------------------------------------------------------}
+
+-- | Convert a Doxygen comment to a Haddock comment
+--
+mkHaddocks ::
+     C.DeclInfo Final
+  -> Maybe HsDoc.Comment
+mkHaddocks info =
+    fst $ mkHaddocksWithArgs info Args{
+        isField = False
+      , loc     = info.loc
+      , cName   = C.renderDeclId info.id.cName
+      , hsName  = info.id.hsName
+      , comment = info.comment
+      , params  = []
+      }
+
+mkHaddocksFieldInfo ::
+     C.DeclInfo Final
+  -> C.FieldInfo Final
+  -> Maybe HsDoc.Comment
+mkHaddocksFieldInfo declInfo fieldInfo =
+    fst $ mkHaddocksWithArgs declInfo Args{
+        isField = True
+      , loc     = fieldInfo.loc
+      , cName   = fieldInfo.name.cName.text
+      , hsName  = fieldInfo.name.hsName
+      , comment = fieldInfo.comment
+      , params  = []
+      }
+
+-- | Extract Haddock documentation for a function; enrich function parameters
+--   with parameter-specific documentation
+mkHaddocksDecorateParams ::
+    C.DeclInfo Final
+  -> [(Maybe Text, Hs.FunctionParameter Hs.Type)]
+  -> (Maybe HsDoc.Comment, [Hs.FunctionParameter Hs.Type])
+mkHaddocksDecorateParams info params =
+    let (mbc, xs) = mkHaddocksWithArgs info Args{
+        isField = False
+      , loc     = info.loc
+      , cName   = C.renderDeclId info.id.cName
+      , hsName  = info.id.hsName
+      , comment = info.comment
+      , params  = params
+      }
+    in  (mbc, xs)
+
+{-------------------------------------------------------------------------------
+  Internal
+-------------------------------------------------------------------------------}
+
+data Args = Args{
+      isField :: Bool
+    , loc     :: C.SingleLoc C.DeclPath
+    , cName   :: Text
+    , hsName  :: Hs.SomeName
+    , comment :: Maybe (C.Comment Final)
+    , params  :: [(Maybe Text, Hs.FunctionParameter Hs.Type)]
+    }
+
+-- | Convert a Doxygen comment to a Haddock comment, updating function
+-- parameters with their documentation.
+--
+mkHaddocksWithArgs :: C.DeclInfo Final -> Args -> (Maybe HsDoc.Comment, [Hs.FunctionParameter Hs.Type])
+mkHaddocksWithArgs info Args{comment = Nothing, ..} =
+      ( Just $
+          mempty
+            & #origin     .~ Just cName
+            & #location   .~ Just loc
+            & #declOrigin .~ Just info.origin
+      , map (uncurry addFunctionParameterComment) params
+      )
+mkHaddocksWithArgs info Args{comment = Just (C.Comment Doxy.Comment{..}), ..} =
+  let commentCName    = cName
+      commentLocation = loc
+
+      -- The brief description becomes the Haddock title
+      commentTitle = case brief of
+        []      -> Nothing
+        inlines -> Just $ concatMap convertInline inlines
+
+      -- Extract param docs from detailed blocks for attaching to
+      -- function parameters
+      paramDocs = extractMatchedParams detailed
+
+      -- Match param docs to function parameters
+      updatedParams = map (uncurry addFunctionParameterComment)
+                    . processParamDocs paramDocs
+                    $ params
+
+      -- Convert detailed blocks to Haddock content.
+      -- Matched params are kept so they appear in both the function-level
+      -- comment and in individual parameter comments.
+      commentChildren = concatMap convertBlock detailed
+
+      -- When doxygen puts all text in detailed (e.g. inline enum comments
+      -- like /**< Red color */), promote the first simple paragraph to title.
+      (finalTitle, finalChildren) = case (commentTitle, commentChildren) of
+        (Nothing, HsDoc.Paragraph inlines : rest)
+          | all isSimpleInline inlines -> (Just inlines, rest)
+        _ -> (commentTitle, commentChildren)
+
+  in  ( Just $
+          mempty
+            & #title      .~ finalTitle
+            & #origin     .~ Just commentCName
+            & #location   .~ Just commentLocation
+            & #declOrigin .~ Just info.origin
+            & #children   .~ finalChildren
+      , updatedParams
+      )
+  where
+    -- Extract @param entries from detailed blocks that match provided parameters
+    extractMatchedParams :: [Doxy.Block (C.CommentRef Final)]
+                         -> [Doxy.Param (C.CommentRef Final)]
+    extractMatchedParams [] = []
+    extractMatchedParams (Doxy.ParamList ParamListParam ps : rest) =
+        filter isMatch ps ++ extractMatchedParams rest
+      where
+        isMatch p = any ((== Just p.paramName) . fst) params
+    extractMatchedParams (_ : rest) = extractMatchedParams rest
+
+    processParamDocs :: [Doxy.Param (C.CommentRef Final)]
+                     -> [(Maybe Text, Hs.FunctionParameter ty)]
+                     -> [(Maybe Text, Hs.FunctionParameter ty)]
+    processParamDocs [] currentParams = currentParams
+    processParamDocs (dp : rest) currentParams =
+        processParamDocs rest $ map (updateParam dp) currentParams
+      where
+        updateParam dp' (mbName, fp)
+          | mbName == Just (Text.strip dp'.paramName)
+          = let paramComment :: HsDoc.Comment
+                paramComment = mempty
+                  & #origin   .~ mbName
+                  & #children .~ [convertParam ParamListParam dp']
+            in  (mbName, fp & #comment .~ Just paramComment)
+          | otherwise = (mbName, fp)
+
+addFunctionParameterComment :: Maybe Text -> Hs.FunctionParameter ty -> Hs.FunctionParameter ty
+addFunctionParameterComment mbName fp =
+  case mbName of
+    Nothing -> fp
+    Just name
+      | Text.null name -> panicPure "Function parameter name is null"
+      | otherwise ->
+        case fp.comment of
+          Just{}  -> fp
+          Nothing -> fp & #comment .~ Just (
+              mempty & #origin .~ mbName
+            )
+
+{-------------------------------------------------------------------------------
+  Block content conversion
+
+  Doxy.Block maps directly to HsDoc.CommentBlockContent.  No string matching
+  on command names: the Doxygen XML has already classified everything.
+-------------------------------------------------------------------------------}
+
+-- | Convert a 'Doxy.Block' to Haddock block content
+convertBlock :: Doxy.Block (C.CommentRef Final) -> [HsDoc.CommentBlockContent]
+convertBlock = \case
+  Doxy.Paragraph inlines ->
+    [HsDoc.Paragraph $ concatMap convertInline inlines]
+
+  Doxy.ParamList kind ps ->
+    case kind of
+      ParamListParam  -> map (convertParam kind) ps
+      ParamListRetVal -> concatMap convertRetval ps
+
+  Doxy.SimpleSect kind blocks ->
+    convertSimpleSect kind blocks
+
+  Doxy.CodeBlock codeLines ->
+    [HsDoc.CodeBlock codeLines]
+
+  Doxy.ItemizedList items ->
+    map (\item -> HsDoc.ListItem HsDoc.BulletList (concatMap convertBlock item)) items
+
+  Doxy.OrderedList items ->
+    zipWith (\i item -> HsDoc.ListItem (HsDoc.NumberedList i)
+                                       (concatMap convertBlock item))
+            [1..] items
+
+  Doxy.XRefSect title blocks ->
+    prefixed (title <> ":") (concatMap convertBlock blocks)
+
+  Doxy.Tag _tag children -> concatMap convertBlock children
+
+-- | Convert a @\<simplesect\>@ to Haddock content
+convertSimpleSect :: SimpleSectKind -> [Doxy.Block (C.CommentRef Final)] -> [HsDoc.CommentBlockContent]
+convertSimpleSect kind blocks =
+    let content = concatMap convertBlock blocks
+    in  case kind of
+          SSReturn     -> prefixed "Returns:" content
+          SSWarning    -> prefixed "WARNING:" content
+          SSNote       -> prefixed "Note:" content
+          SSSee        -> prefixed "See:" content
+          SSSince      -> [HsDoc.Paragraph [HsDoc.Metadata (HsDoc.Since (extractText blocks))]]
+          SSVersion    -> prefixed "Version:" content
+          SSPre        -> prefixed "Precondition:" content
+          SSPost       -> prefixed "Postcondition:" content
+          SSPar title  -> HsDoc.Paragraph [HsDoc.Bold [HsDoc.TextContent title]] : content
+          SSDeprecated -> prefixed "Deprecated:" content
+          SSRemark     -> prefixed "Remark:" content
+          SSAttention  -> prefixed "ATTENTION:" content
+          SSTodo       -> prefixed "TODO:" content
+          SSInvariant  -> prefixed "Invariant:" content
+          SSAuthor     -> prefixed "Author:" content
+          SSDate       -> prefixed "Date:" content
+  where
+    extractText :: [Doxy.Block (C.CommentRef Final)] -> Text
+    extractText = Text.strip . Text.unwords . concatMap go
+      where
+        go (Doxy.Paragraph inlines) = map inlineText inlines
+        go _                       = []
+
+        inlineText (Doxy.Text t) = t
+        inlineText _            = ""
+
+-- | Check if an inline content element is simple enough to promote to a title
+isSimpleInline :: HsDoc.CommentInlineContent -> Bool
+isSimpleInline = \case
+  HsDoc.TextContent{} -> True
+  HsDoc.Monospace{}   -> True
+  HsDoc.Emph{}        -> True
+  HsDoc.Bold{}        -> True
+  _                   -> False
+
+-- | Inline a bold label into the first paragraph of some content
+prefixed :: Text -> [HsDoc.CommentBlockContent] -> [HsDoc.CommentBlockContent]
+prefixed label cs = case cs of
+  (HsDoc.Paragraph inlines : rest) ->
+    HsDoc.Paragraph (HsDoc.Bold [HsDoc.TextContent label] : inlines) : rest
+  _ -> HsDoc.Paragraph [HsDoc.Bold [HsDoc.TextContent label]] : cs
+
+-- | Convert a documented parameter to a Haddock definition list entry
+convertParam :: ParamListKind -> Doxy.Param (C.CommentRef Final) -> HsDoc.CommentBlockContent
+convertParam _kind p =
+    let paramNameContent = HsDoc.Monospace [HsDoc.TextContent (Text.strip p.paramName)]
+        paramNameAndDir  = HsDoc.Bold (paramNameContent : dirInline p.paramDirection)
+    in  HsDoc.DefinitionList paramNameAndDir (concatMap convertBlock p.paramDesc)
+
+-- | Convert a @\@retval@ entry to a definition list item:
+--   @[__@value@__]: description@
+convertRetval :: Doxy.Param (C.CommentRef Final) -> [HsDoc.CommentBlockContent]
+convertRetval p =
+    let code = HsDoc.Monospace [HsDoc.TextContent (Text.strip p.paramName)]
+        desc = concatMap convertBlock p.paramDesc
+    in  [HsDoc.DefinitionList (HsDoc.Bold [code]) desc]
+
+-- | Direction annotation for a parameter (empty list when unspecified)
+dirInline :: Maybe ParamDirection -> [HsDoc.CommentInlineContent]
+dirInline (Just DirIn)    = [HsDoc.Emph [HsDoc.TextContent "(input)"]]
+dirInline (Just DirOut)   = [HsDoc.Emph [HsDoc.TextContent "(output)"]]
+dirInline (Just DirInOut) = [HsDoc.Emph [HsDoc.TextContent "(input,output)"]]
+dirInline Nothing         = []
+
+{-------------------------------------------------------------------------------
+  Inline content conversion
+
+  Doxy.Inline maps directly to HsDoc.CommentInlineContent.
+  Cross-references (Doxy.Ref) are resolved via the CommentRef that was
+  threaded through the pipeline and resolved by MangleNames.
+-------------------------------------------------------------------------------}
+
+-- | Convert a 'Doxy.Inline' to Haddock inline content
+--
+-- Text content is stripped because the Haddock pretty-printer uses 'hsep'
+-- to join inline elements (adding its own inter-element spacing).
+-- The Doxygen parser preserves XML whitespace in text nodes, so we strip
+-- it here at the translation boundary.
+--
+convertInline :: Doxy.Inline (C.CommentRef Final) -> [HsDoc.CommentInlineContent]
+convertInline = \case
+  Doxy.Text t
+    | Text.null stripped -> []
+    | otherwise          -> [HsDoc.TextContent stripped]
+    where stripped = Text.strip t
+
+  Doxy.Bold inlines  -> [HsDoc.Bold $ concatMap convertInline inlines]
+  Doxy.Emph inlines  -> [HsDoc.Emph $ concatMap convertInline inlines]
+  Doxy.Mono inlines  -> [HsDoc.Monospace $ concatMap convertInline inlines]
+
+  Doxy.Ref (C.CommentRef c mHsIdent _mKind) _displayText ->
+    case mHsIdent of
+      Just namePair -> [HsDoc.Identifier namePair.hsName.text]
+      Nothing       -> [HsDoc.Monospace [HsDoc.TextContent c]]
+
+  Doxy.Anchor idText -> [HsDoc.Anchor idText]
+
+  Doxy.Link label url -> [HsDoc.Link (concatMap convertInline label) url]
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
diff --git a/src-internal/HsBindgen/Backend/Hs/Name.hs b/src-internal/HsBindgen/Backend/Hs/Name.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Name.hs
@@ -0,0 +1,45 @@
+-- | Intended for qualified import
+--
+-- > import HsBindgen.Backend.Hs.Name qualified as Hs
+module HsBindgen.Backend.Hs.Name (
+    TermName(..)
+    -- * Deconstruction
+  , termNameToText
+  , termNameToStr
+  ) where
+import Data.Text qualified as Text
+
+import HsBindgen.Backend.UniqueSymbol
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Haskell term name
+data TermName =
+      -- | Human-readable name that is to be exported
+      --
+      -- Term-level declarations with exported names should not have use sites
+      -- and therefore they can easily be renamed ('HsBindgen.Backend.Category.RenameTerm').
+      ExportedName (Hs.Name Hs.NsVar)
+
+      -- | Auxiliary name used in the implementation of other declarations
+      --
+      -- Since those functions have use-sites, we should not normally rename
+      -- them ('HsBindgen.Backend.Category.RenameTerm').
+    | InternalName UniqueSymbol
+  deriving stock (Eq, Ord, Show)
+
+{-------------------------------------------------------------------------------
+  Deconstruction
+-------------------------------------------------------------------------------}
+
+termNameToText :: TermName -> Text
+termNameToText = \case
+  ExportedName x -> x.text
+  InternalName x -> Text.pack x.unique
+
+termNameToStr :: TermName -> String
+termNameToStr = Text.unpack . termNameToText
diff --git a/src-internal/HsBindgen/Backend/Hs/Origin.hs b/src-internal/HsBindgen/Backend/Hs/Origin.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Origin.hs
@@ -0,0 +1,83 @@
+-- | Origin information
+--
+-- When we generate Haskell code, we keep a record of their \"origin\": what
+-- part of the C input corresponds to these definitions? We need this
+-- information for various purposes:
+--
+-- * Generating tests
+-- * Generating external binding specification
+-- * Generating documentation
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Backend.Hs.Origin qualified as Origin
+--
+-- TODO: <https://github.com/well-typed/hs-bindgen/issues/1448>
+-- This entire module can go once we generate binding specs based on C decls,
+-- rather than the generated Hs decls.
+module HsBindgen.Backend.Hs.Origin (
+    -- * Declarations
+    Decl(..)
+  , Struct(..)
+  , Newtype(..)
+  , EmptyData(..)
+  , ForeignImport(..)
+  , PatSyn(..)
+    -- * Fields
+  , Field(..)
+  ) where
+
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Declarations
+-------------------------------------------------------------------------------}
+
+data Decl a = Decl{
+      info :: C.DeclInfo Final
+    , kind :: a            -- ^ Kind-specific information
+    , spec :: PrescriptiveDeclSpec
+    }
+  deriving stock (Generic, Show)
+
+data Struct =
+    Struct (C.Struct Final)
+  deriving stock (Generic, Show)
+
+data Newtype =
+    Enum    (C.Enum                         Final)
+  | Typedef (C.Typedef                      Final)
+  | Union   (C.Union                        Final)
+  | Aux     (C.Typedef                      Final)
+  | forall l. Macro (TypecheckedMacroType l Final)
+
+deriving stock instance Show Newtype
+
+data EmptyData =
+    Opaque C.NameKind
+  deriving stock (Generic, Show)
+
+data ForeignImport =
+    Function   (C.Function Final)
+  | Global     (C.Type     Final)
+  | ToFunPtr   (C.Type     Final)
+  | FromFunPtr (C.Type     Final)
+  deriving stock (Generic, Show)
+
+newtype PatSyn =
+    EnumConstant (C.EnumConstant Final)
+  deriving stock (Generic, Show)
+
+{-------------------------------------------------------------------------------
+  Fields
+-------------------------------------------------------------------------------}
+
+data Field =
+    GeneratedField  -- ^ Field without a direct counterpart in C
+  | StructField (C.Field Final)
+  deriving stock (Generic, Show)
+
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation.hs b/src-internal/HsBindgen/Backend/Hs/Translation.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation.hs
@@ -0,0 +1,1184 @@
+-- | Low-level translation of the C header to a Haskell module
+module HsBindgen.Backend.Hs.Translation (
+    generateDeclarations
+  ) where
+
+import Control.Monad.Reader qualified as Reader
+import Control.Monad.State qualified as State hiding (MonadState)
+import Data.List qualified as List
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Map.Strict qualified as Map
+import Data.Maybe qualified as Maybe
+import Data.Set qualified as Set
+import Data.Text qualified as Text
+import DeBruijn (Add (..), Idx (..), pattern I2)
+
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Haddock.Translation
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.Hs.Origin qualified as Origin
+import HsBindgen.Backend.Hs.Translation.ForeignImport qualified as Hs.ForeignImport
+import HsBindgen.Backend.Hs.Translation.Function
+import HsBindgen.Backend.Hs.Translation.Instances qualified as Hs
+import HsBindgen.Backend.Hs.Translation.Monad (HsM)
+import HsBindgen.Backend.Hs.Translation.Monad qualified as HsM
+import HsBindgen.Backend.Hs.Translation.Newtype qualified as Hs
+import HsBindgen.Backend.Hs.Translation.Structure
+import HsBindgen.Backend.Hs.Translation.ToFromFunPtr qualified as ToFromFunPtr
+import HsBindgen.Backend.Hs.Translation.Union
+import HsBindgen.Backend.SHs.AST qualified as SHs
+import HsBindgen.Backend.SHs.Translation qualified as SHs
+import HsBindgen.Backend.UniqueSymbol
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Config.Internal
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.MangleNames.IsPass qualified as MangleNames
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes.Translation qualified as Translation
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.PrettyC qualified as PC
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.NameHint
+
+import Doxygen.Parser.Types qualified as Doxy
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+generateDeclarations ::
+     Macro.HasTypes l
+  => Macro.Lang l
+  -> UniqueId
+  -> BaseModuleName
+  -> DeclIndex l
+  -> [C.Decl l Final]
+  -> ByCategory_ [Hs.Decl l]
+generateDeclarations macroLang uniqueId name declIndex =
+    fmap reverse .
+      foldl' partitionBindingCategories mempty .
+      generateDeclarations' macroLang env declIndex
+  where
+    partitionBindingCategories ::
+      ByCategory_ [a] -> WithCategory a  -> ByCategory_ [a]
+    partitionBindingCategories xs (WithCategory cat decl) =
+      over (lensForCategory cat) (decl :) xs
+
+    supInsts :: Inst.SupportedInstances
+    supInsts = def
+
+    env :: HsM.Env
+    env = HsM.initEnv uniqueId name supInsts
+
+-- | Internal. Top-level declaration with foreign import category.
+data WithCategory a = WithCategory {
+    _withCategoryCategory :: Category
+  , _withCategoryDecl     :: a
+  } deriving (Show)
+
+generateDeclarations' ::
+     Macro.HasTypes l
+  => Macro.Lang l
+  -> HsM.Env
+  -> DeclIndex l
+  -> [C.Decl l Final]
+  -> [WithCategory (Hs.Decl l)]
+generateDeclarations' macroLang env declIndex decs =
+    HsM.runHsM env $ do
+      let scannedFunctionTypes = scanAllFunctionTypes decs
+          -- Generate ToFunPtr/FromFunPtr instances for nested function types
+          -- These go in the main module to avoid orphan instances
+          fFIStubsAndFunPtrInstances =
+                   [ WithCategory CType d
+                   | (args, res) <- Set.toList scannedFunctionTypes
+                   , not (any C.hasUnsupportedType (res: fmap (.typ) args))
+                   , any (isDefinedInCurrentModule declIndex) (res: fmap (.typ) args)
+                   , d <- ToFromFunPtr.forFunction (args, res)
+                   ]
+      hsDeclsAction <- mapM (generateDecs macroLang) decs
+      hsDecls <- HsM.runAction $ fmap concat $ sequence hsDeclsAction
+      pure $ hsDecls ++ fFIStubsAndFunPtrInstances
+
+-- | This function takes a list of all declarations and collects all function
+-- types (with some exceptions).
+--
+-- For example: function types that exist as arguments to other functions
+-- (nth-order functions), fields of structs, fields of unions, etc.
+--
+-- This explicitly excludes typedefs that are function types (.e.g, @typedef
+-- void F()@) or function type indirections (e.g., @typedef void (*F)()@)
+-- because these are handled separately by 'typedefDecs'
+-- and'typedefFunTypeIndirectionDecs' respectively.
+--
+scanAllFunctionTypes :: [C.Decl l Final] -> Set ([C.TypeFunArg Final], C.Type Final)
+scanAllFunctionTypes = foldMap $ \decl ->
+    case decl.kind of
+      C.DeclStruct struct -> foldMap scanField struct.fields
+      C.DeclUnion union   -> foldMap scanField union.fields
+      C.DeclTypedef typedef
+        -- Exclude function type indirections, because they are already handled
+        -- by 'typedefFuntypeIndirectionDecs'
+        | Just (args, res, _) <- C.getFirstFunTypeIndirection typedef.typ.c
+        -> foldMap C.getAllFunTypes (res : map (.typ) args)
+        -- Exclude /direct/ function types, because they are already handled by
+        -- 'typedefDecs'
+        | otherwise
+        -> C.getAllFunTypeIndirections typedef.typ.c
+      C.DeclEnum enum -> C.getAllFunTypes enum.typ.c
+      C.DeclUntaggedEnumConstant{} -> Set.empty
+      C.DeclOpaque{} -> Set.empty
+      C.DeclMacro{} -> Set.empty
+      C.DeclFunction fn ->
+        foldMap C.getAllFunTypes (fn.res.c : map (.typ.c) fn.args)
+      C.DeclGlobal g -> C.getAllFunTypes g.typ.c
+  where
+    scanField :: C.Field Final -> Set ([C.TypeFunArg Final], C.Type Final)
+    scanField = C.elimField scanRegularField scanImplicitField
+    scanRegularField  field = C.getAllFunTypes field.typ.c
+    scanImplicitField field = C.getAllFunTypes field.typ.c <>
+        foldMap (C.getAllFunTypes . (.typ.c)) field.indirect
+
+-- | Check if a type is defined in the current module
+isDefinedInCurrentModule :: DeclIndex l -> C.Type Final -> Bool
+isDefinedInCurrentModule declIndex =
+    any (isInDeclIndex . fst) . C.depsOfType
+  where
+    isInDeclIndex :: DeclIdPair -> Bool
+    isInDeclIndex declId = isJust $ DeclIndex.lookup declId.cName declIndex
+
+{-------------------------------------------------------------------------------
+  Declarations
+------------------------------------------------------------------------------}
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1758>
+-- Take the 'PrescriptiveDeclSpec' into account.
+generateDecs ::
+     Macro.HasTypes l
+  => Macro.Lang l
+  -> C.Decl l Final
+  -> HsM (HsM.Action [WithCategory (Hs.Decl l)])
+generateDecs macroLang (C.Decl info kind spec) =
+    case kind of
+      C.DeclStruct struct -> withCategoryM CType $
+        HsM.immediateM $ structDecs info struct spec
+      C.DeclUnion union -> withCategoryM CType $
+        HsM.immediateM $ unionDecs info union spec
+      C.DeclEnum enum -> withCategoryM CType $
+        HsM.immediateM $ enumDecs info enum spec
+      C.DeclUntaggedEnumConstant enumConst -> withCategoryM CType $ do
+        HsM.immediateM $ untaggedEnumConstantDecs info enumConst
+      C.DeclTypedef typedef -> withCategoryM CType $
+        case C.getFirstFunTypeIndirection typedef.typ.c of
+          Just (args, res, reconstruct) ->
+            typedefFunTypeIndirectionDecs info (args, res, reconstruct) typedef.names spec
+          Nothing ->
+            HsM.immediateM $ typedefDecs info Origin.Typedef typedef spec
+      C.DeclOpaque mSize -> withCategoryM CType $
+        HsM.immediateM $ opaqueDecs info spec mSize
+      C.DeclFunction function -> do
+        let funDeclsWith safety =
+              functionDecs safety info function spec
+            funType = C.typeOfFunction function
+            -- Declare a function pointer. We can pass this 'FunPtr' to C
+            -- functions that take a function pointer of the appropriate type.
+            funPtrDecls = fst <$>
+                addressStubDecs info funType HaskellId spec
+        safes   <- withCategoryM (CTerm CSafe)   (HsM.immediateM $ funDeclsWith SHs.Safe)
+        unsafes <- withCategoryM (CTerm CUnsafe) (HsM.immediateM $ funDeclsWith SHs.Unsafe)
+        funPtrs <- withCategoryM (CTerm CFunPtr) (HsM.immediateM $ funPtrDecls)
+        pure $ HsM.concatSequence [safes, unsafes, funPtrs]
+      C.DeclMacro macro -> withCategoryM CType $
+        HsM.immediateM $ macroDecs macroLang info macro spec
+      C.DeclGlobal g -> withCategoryM (CTerm CGlobal) $
+        HsM.immediateM $ global info g spec
+  where
+    withCategory ::
+         Category
+      -> HsM.Action [a]
+      -> HsM.Action [WithCategory a]
+    withCategory c = fmap (map (WithCategory c))
+
+    withCategoryM ::
+         Functor m
+      => Category
+      -> m (HsM.Action [a])
+      -> m (HsM.Action [WithCategory a])
+    withCategoryM c = fmap (withCategory c)
+
+{-------------------------------------------------------------------------------
+  Opaque struct and opaque enum
+-------------------------------------------------------------------------------}
+
+opaqueDecs ::
+     HasCallStack
+  => C.DeclInfo Final
+  -> PrescriptiveDeclSpec
+  -> Maybe C.OpaqueSize
+  -> HsM [Hs.Decl l]
+opaqueDecs info spec mSize = do
+    State.modify' $ #instanceMap %~ Map.insert name insts
+    return $ mkDecl : staticSizeDecls
+  where
+    name :: Hs.Name Hs.NsTypeConstr
+    name = Hs.assertNs (Proxy @Hs.NsTypeConstr) info.id.hsName
+
+    mkDecl :: Hs.Decl l
+    mkDecl = Hs.DeclEmpty Hs.EmptyData {
+          name      = name
+        , origin    = Origin.Decl{
+              info = info
+            , kind = Origin.Opaque info.id.cName.name.kind
+            , spec = spec
+            }
+        , instances = insts
+        , comment   = mkHaddocks info
+        }
+
+    -- TODO: <https://github.com/well-typed/hs-bindgen/issues/1528>
+    -- Do not generate a 'StaticSize' instance if it is omitted in a
+    -- prescriptive binding specification.
+
+    -- We generate a 'StaticSize' instance for C types with known size and
+    -- alignment that are made /opaque/ in Haskell bindings by prescribing an
+    -- @emptydata@ representation.  This makes it possible to allocate memory
+    -- for such a type, necessary to support APIs that require users to manage
+    -- the memory.
+    (insts, staticSizeDecls)
+      | Just (C.OpaqueSize sz al) <- mSize =
+          ( Set.singleton Inst.StaticSize
+          , [ Hs.DeclDefineInstance Hs.DefineInstance{
+                  comment      = Nothing
+                , instanceDecl =
+                    Hs.InstanceStaticSize name Hs.StaticSizeInstance{
+                        staticSizeOf    = sz
+                      , staticAlignment = al
+                      }
+                }
+            ]
+          )
+      | otherwise = (Set.empty, [])
+
+{-------------------------------------------------------------------------------
+  Enum
+-------------------------------------------------------------------------------}
+
+enumDecs ::
+     HasCallStack
+  => C.DeclInfo Final
+  -> C.Enum Final
+  -> PrescriptiveDeclSpec
+  -> HsM [Hs.Decl l]
+enumDecs info enum spec = do
+    env <- Reader.ask
+    nt <- newtypeDec env
+    pure $ aux env nt
+  where
+    valueMap :: Map Integer (NonEmpty (C.FieldInfo Final, Hs.Name Hs.NsConstr))
+    valueMap = Map.fromListWith (flip (<>)) [ -- preserve source order
+        let name :: Hs.Name Hs.NsConstr
+            name = Hs.assertNs (Proxy @Hs.NsConstr) constant.info.name.hsName
+        in  (constant.value, NonEmpty.singleton (constant.info, name))
+      | constant <- enum.constants
+      ]
+
+    valueNames :: Map Integer (NonEmpty String)
+    valueNames = NonEmpty.map (Hs.nameToStr . snd) <$> valueMap
+
+    mSeqBounds :: Maybe (Hs.Name Hs.NsConstr, Hs.Name Hs.NsConstr)
+    mSeqBounds = do
+      (minV, minNames) <- fmap (NonEmpty.map snd) <$> Map.lookupMin valueMap
+      (maxV, maxNames) <- fmap (NonEmpty.map snd) <$> Map.lookupMax valueMap
+      guard $ maxV - minV + 1 == fromIntegral (Map.size valueMap)
+      return (NonEmpty.head minNames, NonEmpty.head maxNames)
+
+    newtypeDec :: HsM.Env -> HsM Hs.Newtype
+    newtypeDec env = do
+        Hs.newtypeDec newtypeName newtypeConstr newtypeField
+          newtypeOrigin newtypeComment candidateInsts knownInsts
+      where
+        newtypeName :: Hs.Name Hs.NsTypeConstr
+        newtypeName = Hs.assertNs (Proxy @Hs.NsTypeConstr) info.id.hsName
+
+        newtypeConstr :: Hs.Name Hs.NsConstr
+        newtypeConstr = enum.names.dataConstr
+
+        newtypeField :: Hs.Field
+        newtypeField = Hs.Field {
+              name    = enum.names.field
+            , typ     = enum.typ.hs
+            , origin  = Origin.GeneratedField
+            , comment = Nothing
+            }
+
+        newtypeOrigin :: Origin.Decl Origin.Newtype
+        newtypeOrigin = Origin.Decl{
+              info = info
+            , kind = Origin.Enum enum
+            , spec = spec
+            }
+
+        newtypeComment :: Maybe HsDoc.Comment
+        newtypeComment = mkHaddocks info
+
+        candidateInsts :: Set Inst.TypeClass
+        candidateInsts = Hs.getCandidateInsts env.supportedInstances.enum
+
+        knownInsts :: Set Inst.TypeClass
+        knownInsts = Set.fromList $ catMaybes [
+            Just Inst.CEnum
+          , Just Inst.Generic
+          , Just Inst.HasCField
+          , Just Inst.HasField
+          , Just Inst.HasFieldCompat
+          , Just Inst.HasFieldPtr
+          , Just Inst.Prim
+          , Just Inst.Read
+          , Just Inst.ReadRaw
+          , Inst.SequentialCEnum <$ mSeqBounds
+          , Just Inst.Show
+          , Just Inst.StaticSize
+          , Just Inst.Storable
+          , Just Inst.WriteRaw
+          ]
+
+    -- everything in aux is state-dependent
+    aux :: HsM.Env -> Hs.Newtype -> [Hs.Decl l]
+    aux env nt =
+        Hs.DeclNewtype nt
+        : marshalDecls
+        ++ primDecl
+        : optDecls
+        ++ cEnumInstanceDecls
+        ++ Hs.hasFieldCompatDecs nt
+        ++ Hs.hasFieldPtrDecs nt
+        ++ valueDecls
+        ++ completeDecl
+      where
+        -- Singleton field: 'InstanceCEnum' and its siblings rely on this
+        -- struct having exactly one field (the underlying enum integer).
+        hsStruct :: Hs.Struct
+        hsStruct = Hs.Struct {
+              name      = nt.name
+            , constr    = nt.constr
+            , fields    = [nt.field]
+            , instances = nt.instances
+            , origin    = Nothing
+            , comment   = Nothing
+            }
+
+        marshalDecls :: [Hs.Decl l]
+        marshalDecls = [
+            Hs.DeclDefineInstance Hs.DefineInstance{
+                comment      = Nothing
+              , instanceDecl =
+                  Hs.InstanceStaticSize hsStruct.name Hs.StaticSizeInstance{
+                      staticSizeOf    = enum.sizeof
+                    , staticAlignment = enum.alignment
+                    }
+              }
+          , Hs.DeclDefineInstance Hs.DefineInstance{
+                comment      = Nothing
+              , instanceDecl =
+                  Hs.InstanceReadRaw hsStruct Hs.ReadRawInstance{
+                      readRaw = Hs.Lambda (NameHint "ptr") $
+                        Hs.Ap (Hs.StructCon hsStruct) [ Hs.ReadRawByteOff IZ 0 ]
+                    }
+              }
+          , Hs.DeclDefineInstance Hs.DefineInstance{
+                comment      = Nothing
+              , instanceDecl =
+                  Hs.InstanceWriteRaw hsStruct Hs.WriteRawInstance{
+                      writeRaw = Hs.Lambda (NameHint "ptr") $ Hs.Lambda (NameHint "s") $
+                        Hs.ElimStruct IZ hsStruct.constr (toNameHint nt.field.name ::: VNil) (AS AZ) $
+                          Hs.Seq [ Hs.WriteRawByteOff I2 0 IZ ]
+                    }
+              }
+          , Hs.DeclDeriveInstance Hs.DeriveInstance{
+                strategy = Hs.DeriveVia (Hs.EquivStorable (Hs.TypRef nt.name Nothing))
+              , clss     = Inst.Storable
+              , name     = nt.name
+              , comment  = Nothing
+              }
+          ]
+
+        primDecl :: Hs.Decl l
+        primDecl = Hs.DeclDeriveInstance Hs.DeriveInstance{
+              strategy = Hs.DeriveVia nt.field.typ
+            , clss     = Inst.Prim
+            , name     = nt.name
+            , comment  = Nothing
+            }
+
+        optDecls :: [Hs.Decl l]
+        optDecls = catMaybes [
+            case Hs.getDeriveStrat supStrats of
+              Nothing    -> Nothing
+              Just strat -> Just $ Hs.DeclDeriveInstance Hs.DeriveInstance{
+                  name     = nt.name
+                , clss     = clss
+                , strategy = strat
+                , comment  = Nothing
+                }
+          | (clss, supStrats) <- Map.assocs env.supportedInstances.enum
+          ]
+
+        cEnumInstanceDecls :: [Hs.Decl l]
+        cEnumInstanceDecls =
+          let cEnumDecl = Hs.DeclDefineInstance Hs.DefineInstance{
+                  comment      = Nothing
+                , instanceDecl =
+                    Hs.InstanceCEnum hsStruct $
+                      Hs.CEnumInstance nt.field.typ valueNames (isJust mSeqBounds)
+                }
+              cEnumShowDecl = Hs.DeclDefineInstance Hs.DefineInstance{
+                  comment      = Nothing
+                , instanceDecl = Hs.InstanceCEnumShow hsStruct
+                }
+              cEnumReadDecl = Hs.DeclDefineInstance Hs.DefineInstance{
+                  comment      = Nothing
+                , instanceDecl = Hs.InstanceCEnumRead hsStruct
+                }
+              sequentialCEnumDecl = case mSeqBounds of
+                Just (nameMin, nameMax) -> List.singleton $
+                  Hs.DeclDefineInstance Hs.DefineInstance{
+                      comment      = Nothing
+                    , instanceDecl =
+                        Hs.InstanceSequentialCEnum hsStruct $
+                          Hs.SequentialCEnumInstance nameMin nameMax
+                    }
+                Nothing -> []
+          in  cEnumDecl : sequentialCEnumDecl ++ [cEnumShowDecl, cEnumReadDecl]
+
+        valueDecls :: [Hs.Decl l]
+        valueDecls = [
+              Hs.DeclPatSyn Hs.PatSyn{
+                  name    = Hs.assertNs (Proxy @Hs.NsConstr) constant.info.name.hsName
+                , typ     = Hs.TypRef nt.name (Just nt.field.typ)
+                , constr  = Just nt.constr
+                , value   = constant.value
+                , origin  = Origin.EnumConstant constant
+                , comment = mkHaddocksFieldInfo info constant.info
+                }
+            | constant <- enum.constants
+            ]
+
+        completeDecl :: [Hs.Decl l]
+        completeDecl = Maybe.maybeToList $ do
+          cSpec     <- spec.cSpec
+          cEnumSpec <- cSpec.enum
+          guard $ cEnumSpec == BindingSpec.CEnumClosed
+          let pragma = Hs.CompletePragma{
+                  patterns = [
+                      Hs.assertNs (Proxy @Hs.NsConstr) constant.info.name.hsName
+                    | constant <- enum.constants
+                    ]
+                }
+          return $ Hs.DeclCompletePragma pragma
+
+{-------------------------------------------------------------------------------
+  Typedef
+-------------------------------------------------------------------------------}
+
+typedefDecs ::
+     HasCallStack
+  => C.DeclInfo Final
+  -> (C.Typedef Final -> Origin.Newtype)
+  -> C.Typedef Final
+  -> PrescriptiveDeclSpec
+  -> HsM [Hs.Decl l]
+typedefDecs info mkNewtypeOrigin typedef spec = do
+    env <- Reader.ask
+    nt <- newtypeDec env
+    pure $ aux env nt
+  where
+    newtypeDec :: HsM.Env -> HsM Hs.Newtype
+    newtypeDec env = do
+        Hs.newtypeDec newtypeName newtypeConstr newtypeField
+          newtypeOrigin newtypeComment candidateInsts knownInsts
+      where
+        newtypeName :: Hs.Name Hs.NsTypeConstr
+        newtypeName = Hs.assertNs (Proxy @Hs.NsTypeConstr) info.id.hsName
+
+        newtypeConstr :: Hs.Name Hs.NsConstr
+        newtypeConstr = typedef.names.orig.dataConstr
+
+        newtypeField :: Hs.Field
+        newtypeField = Hs.Field {
+              name    = typedef.names.orig.field
+            , typ     = typedef.typ.hs
+            , origin  = Origin.GeneratedField
+            , comment = Nothing
+            }
+
+        newtypeOrigin :: Origin.Decl Origin.Newtype
+        newtypeOrigin =  Origin.Decl{
+              info = info
+            , kind = mkNewtypeOrigin typedef
+            , spec = spec
+            }
+
+        newtypeComment :: Maybe HsDoc.Comment
+        newtypeComment = mkHaddocks info
+
+        candidateInsts :: Set Inst.TypeClass
+        candidateInsts = Hs.getCandidateInsts env.supportedInstances.typedef
+
+        knownInsts :: Set Inst.TypeClass
+        knownInsts = Set.fromList $ catMaybes [
+            Inst.FromFunPtr <$ isFunType
+          , Just Inst.Generic
+          , Just Inst.HasCField
+          , Just Inst.HasField
+          , Just Inst.HasFieldCompat
+          , Just Inst.HasFieldPtr
+          , Inst.ToFunPtr <$ isFunType
+          ]
+
+    -- See comment in 'newtypeWrapper` below
+    isFunType :: Maybe ([C.TypeFunArg Final], C.Type Final)
+    isFunType = case typedef.typ.c of
+      C.TypeFun args res | not (any C.hasUnsupportedType (res: fmap (.typ) args)) ->
+        Just (args, res)
+      _otherwise -> Nothing
+
+    -- everything in aux is state-dependent
+    aux :: HsM.Env -> Hs.Newtype -> [Hs.Decl l]
+    aux env nt =
+        Hs.DeclNewtype nt
+        : newtypeWrapper
+        ++ optDecls
+        ++ Hs.hasFieldCompatDecs nt
+        ++ Hs.hasFieldPtrDecs nt
+      where
+        optDecls :: [Hs.Decl l]
+        optDecls = catMaybes [
+            case Hs.getDeriveStrat supStrats of
+              Nothing    -> Nothing
+              Just strat -> Just $ Hs.DeclDeriveInstance Hs.DeriveInstance{
+                  name     = nt.name
+                , clss     = clss
+                , strategy = strat
+                , comment  = Nothing
+                }
+          | (clss, supStrats) <- Map.assocs env.supportedInstances.typedef
+          , clss `Set.member` nt.instances
+          ]
+
+      -- We need to be careful and not generate any wrappers for function
+      -- types that receive data types not supported by Haskell's FFI
+      -- (i.e. structs, unions by value).
+      --
+      -- Note that we don't want to explicitly see all the way through
+      -- typedefs here. See the following example
+      --
+      -- @
+      -- typedef void (f)(int);
+      -- typedef f g;
+      -- @
+      --
+      -- If we see all the way through the typedef this case will not be
+      -- handled correctly.
+      --
+        newtypeWrapper :: [Hs.Decl l]
+        newtypeWrapper  = maybe [] (ToFromFunPtr.forNewtype nt) isFunType
+
+-- | Typedef around function type indirection
+--
+-- For example, given
+--
+-- > typedef void (*f)(int x, int y);
+--
+-- We want to generate /two/ types:
+--
+-- > newtype F_Aux = F_Aux (FC.CInt -> FC.CInt -> IO ())
+-- > newtype F     = F (Ptr.FunPtr F_Aux)
+--
+-- so that @F_Aux@ can be given @ToFunPtr@/@FromFunPtr@ instances.
+typedefFunTypeIndirectionDecs ::
+     HasCallStack
+  => C.DeclInfo Final
+  -> ([C.TypeFunArg Final], C.Type Final, C.Type Final -> C.Type Final) -- ^ Function arguments and result
+  -> MangleNames.TypedefNames
+  -> PrescriptiveDeclSpec
+  -> HsM (HsM.Action [Hs.Decl l])
+typedefFunTypeIndirectionDecs origInfo (args, res, reconstruct) names origSpec =
+    fmap HsM.concatSequence $ sequence [
+        HsM.delayM     $ typedefDecs auxInfo  Origin.Aux     auxTypedef  auxSpec
+      , HsM.immediateM $ typedefDecs origInfo Origin.Typedef mainTypedef origSpec
+      ]
+  where
+    -- TODO: <https://github.com/well-typed/hs-bindgen/issues/1759>
+    -- For historical reasons we currently implement this by making a "fake" C
+    -- declaration, and then translating that immediately to Haskell. We should
+    -- fuse this, and just generate the Haskell declarations directly.
+
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/1379>
+    -- The name of this auxiliary type should be configurable.
+    auxDeclIdPair :: DeclIdPair
+    auxDeclIdPair = DeclIdPair{
+          cName  = origInfo.id.cName
+          -- Still refer to the /original/ C decl...?
+        , hsName = Hs.demoteNs auxName
+        }
+
+    auxName :: Hs.Name Hs.NsTypeConstr
+    auxNames  :: NewtypeNames
+    (auxName, auxNames) = case names.aux of
+      Nothing        -> panicPure "name of auxiliary declaration unavailable"
+      Just (nm, nms) -> (nm, nms)
+
+    auxInfo :: C.DeclInfo Final
+    auxInfo = C.DeclInfo {
+          loc              = origInfo.loc
+        , id               = auxDeclIdPair
+        , sourceOrderIndex = origInfo.sourceOrderIndex
+        , origin           = origInfo.origin
+        , availability     = C.Available
+        , comment          = Just auxComment
+        , enclosing        = []
+        }
+
+    auxComment :: C.Comment Final
+    auxComment = C.Comment $ Doxy.Comment {
+          brief = [
+              Doxy.Text "Auxiliary type used by"
+            , Doxy.Ref
+                (C.CommentRef origInfo.id.cName.name.text (Just origInfo.id) Nothing)
+                origInfo.id.cName.name.text
+            ]
+        , detailed = []
+        }
+
+    auxTypedef :: C.Typedef Final
+    auxTypedef =
+      let c = C.TypeFun args res
+      in  C.Typedef{
+              typ = TranslatedTypes{
+                  c  = c
+                , hs = Translation.topLevel c
+                }
+            , ann = MangleNames.TypedefNames{
+                  orig = auxNames
+                , aux  = Nothing
+                }
+            }
+
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/1379>
+    -- We should think about prescriptive binding specs for _Aux types.
+    auxSpec :: PrescriptiveDeclSpec
+    auxSpec = PrescriptiveDeclSpec{
+          cSpec  = Nothing
+        , hsSpec = Nothing
+        }
+
+    mainTypedef :: C.Typedef Final
+    mainTypedef =
+      let c = reconstruct $ C.TypeTypedef $ C.Ref{
+              name       = auxInfo.id
+            , underlying = C.TypeFun args res
+            }
+      in  C.Typedef{
+              typ = TranslatedTypes{
+                  c  = c
+                , hs = Translation.topLevel c
+                }
+            , ann = names
+            }
+
+{-------------------------------------------------------------------------------
+  Macros
+-------------------------------------------------------------------------------}
+
+macroDecs ::
+     Macro.HasTypes l
+  => Macro.Lang l
+  -> C.DeclInfo Final
+  -> TypecheckedMacro Final l
+  -> PrescriptiveDeclSpec
+  -> HsM [Hs.Decl l]
+macroDecs macroLang info checkedMacro spec =
+    case checkedMacro of
+      MacroType  ty  -> macroDecsTypedef macroLang info ty spec
+      MacroValue val -> macroVarDecs info val
+
+macroDecsTypedef ::
+     forall l. (Macro.HasTypes l, HasCallStack)
+  => Macro.Lang l
+  -> C.DeclInfo Final
+  -> TypecheckedMacroType l Final
+  -> PrescriptiveDeclSpec
+  -> HsM [Hs.Decl l]
+macroDecsTypedef macroLang info macroType spec = do
+    env <- Reader.ask
+    nt <- newtypeDec env
+    pure $ aux env nt
+  where
+    newtypeDec :: HsM.Env -> HsM Hs.Newtype
+    newtypeDec env = do
+        Hs.newtypeDec newtypeName newtypeConstr newtypeField
+          newtypeOrigin newtypeComment candidateInsts knownInsts
+      where
+        newtypeName :: Hs.Name Hs.NsTypeConstr
+        newtypeName = Hs.assertNs (Proxy @Hs.NsTypeConstr) info.id.hsName
+
+        newtypeConstr :: Hs.Name Hs.NsConstr
+        newtypeConstr = macroType.names.dataConstr
+
+        newtypeField :: Hs.Field
+        newtypeField = Hs.Field{
+            name    = macroType.names.field
+          , typ     = macroLang.translateType (fmap macroVarToHsType macroType.body)
+          , origin  = Origin.GeneratedField
+          , comment = Nothing
+          }
+
+        macroVarToHsType :: MacroTypeBodyVar Final -> Hs.Type
+        macroVarToHsType = \case
+          MacroTypeExtBinding ext ->
+            Hs.ExtBinding ext.hsName ext.cSpec ext.hsSpec $
+              Hs.TypRef
+                (Hs.assertNs (Proxy @Hs.NsTypeConstr) (extDeclIdPair ext).hsName)
+                Nothing
+          MacroTypeBodyVar pair ->
+            Hs.TypRef (Hs.assertNs (Proxy @Hs.NsTypeConstr) pair.hsName) Nothing
+
+        newtypeOrigin :: Origin.Decl Origin.Newtype
+        newtypeOrigin = Origin.Decl {
+              info = info
+            , kind = Origin.Macro $ macroType
+            , spec = spec
+            }
+
+        newtypeComment :: Maybe HsDoc.Comment
+        newtypeComment = mkHaddocks info
+
+        candidateInsts :: Set Inst.TypeClass
+        candidateInsts = Hs.getCandidateInsts env.supportedInstances.typedef
+
+        knownInsts :: Set Inst.TypeClass
+        knownInsts = Set.fromList [
+              Inst.HasCField
+            , Inst.HasField
+            , Inst.HasFieldCompat
+            , Inst.HasFieldPtr
+            , Inst.Generic
+            ]
+
+    -- everything in aux is state-dependent
+    aux :: HsM.Env -> Hs.Newtype -> [Hs.Decl l]
+    aux env nt =
+        Hs.DeclNewtype nt
+        : optDecls
+        ++ Hs.hasFieldCompatDecs nt
+        ++ Hs.hasFieldPtrDecs nt
+      where
+        optDecls :: [Hs.Decl l]
+        optDecls = catMaybes [
+            case Hs.getDeriveStrat supStrats of
+              Nothing    -> Nothing
+              Just strat -> Just $ Hs.DeclDeriveInstance Hs.DeriveInstance{
+                  name     = nt.name
+                , clss     = clss
+                , strategy = strat
+                , comment  = Nothing
+                }
+          | (clss, supStrats) <- Map.assocs env.supportedInstances.typedef
+          , clss `Set.member` nt.instances
+          ]
+
+{-------------------------------------------------------------------------------
+  Globals
+-------------------------------------------------------------------------------}
+
+-- | === Global variables
+--
+-- For by-reference foreign imports, @capi@ vs @ccall@ makes no difference:
+-- @ghc@ does not create a wrapper. For non-extern non-static globals however it
+-- is important that the header is imported /somewhere/, otherwise the global
+-- variable is not linked in; we therefore add an explicit import. It is
+-- important that we don't import such headers more than once, but this is taken
+-- care of in @csources@.
+--
+-- On Windows, simply generating a foreign import of a global variable's address
+-- can lead to errors (see #898). For example, given a global @int
+-- simpleGlobal@, the following foreign import might cause an error:
+--
+-- > foreign import capi safe "&simpleGlobal" simpleGlobal :: Ptr CInt
+--
+-- So, instead we generate a /stub/ function that simply returns the address of
+-- the global variable ...
+--
+-- > /* get_simpleGlobal */
+-- > __attribute__ ((const)) signed int *abc949ab (void) {
+-- >   return &simpleGlobal;
+-- > }
+--
+-- ... and then create a foreign import for the stub. Note that the name of the
+-- stub function is mangled, though the original name of the stub function is
+-- included in a comment before the stub.
+--
+-- > foreign import ccall unsafe "hs_bindgen_abc949ab" hs_bindgen_abc949ab :: IO (Ptr CInt)
+--
+-- Note that stub function also has a @const@ function attribute to emphasise
+-- that the function always returns the same address throughout the lifetime of
+-- the program. This means we could omit the 'IO' from the foreign import to
+-- make it a pure foreign import. Instead, we make the foreign import impure and
+-- we generate an additional pure Haskell function that safely unsafely runs the
+-- 'IO'.
+--
+-- > {-# NOINLINE simpleGlobal #-}
+-- > global :: Ptr CInt
+-- > global = unsafePerformIO hs_bindgen_abc949ab
+--
+-- === Global /constant/ (i.e., @const@) variables
+--
+-- We generate bindings for these as we would generate bindings for non-constant
+-- global variables.
+--
+-- However, if the type of the global constant has a 'Foreign.Storable.Storable' instance, we
+-- also generate an additional \"getter\" function in Haskell land that returns
+-- precisely the value of the constant rather than a /pointer/ to the value.
+global ::
+     C.DeclInfo Final
+  -> C.Global Final
+  -> PrescriptiveDeclSpec
+  -> HsM [Hs.Decl l]
+global info g _spec = do
+    insts <- getInsts
+    -- Generate getter if the type is @const@-qualified. We inspect the /erased/
+    -- type because we want to see through newtypes as well.
+    --
+    -- We must have a storable instance available without any constraints.
+    --
+    -- We are generating a binding for a global variable here. This binding must
+    -- be marked NOINLINE, so that it will be evaluated at most once. /If/ we
+    -- have a Storable instance, but that storable instance has a superclass
+    -- constraint, then we could _in principle_ add that superclass constraint
+    -- as a constraint to the type of the global, but this would then turn the
+    -- global into a function instead.
+    --
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/993>
+    -- We should check that the Storable instance has no superclass constraints.
+    if C.isErasedTypeConstQualified g.typ.c && Inst.Storable `elem` insts then do
+      (stubDecs :: [Hs.Decl l], pureStubName :: Hs.TermName) <- getStubDecsWith GlobalUniqueId
+      let constGetterOfType :: [Hs.Decl l]
+          constGetterOfType = constGetter g.typ.hs info pureStubName
+      pure (stubDecs ++ constGetterOfType)
+    -- Otherwise, do not generate a getter
+    else do
+      fst <$> getStubDecsWith HaskellId
+  where
+    getStubDecsWith :: RunnerNameSpec -> HsM ([Hs.Decl l], Hs.TermName)
+    getStubDecsWith x =
+      addressStubDecs info g.typ.c x _spec
+
+    getInsts :: HsM (Set Inst.TypeClass)
+    getInsts = do
+        st <- State.get
+        pure $ Hs.getInstances
+          st.instanceMap
+          Nothing
+          (Set.singleton Inst.Storable)
+          [g.typ.hs]
+
+-- | Getter for a constant (i.e., @const@) global variable
+--
+-- > simpleGlobal :: CInt
+-- > simpleGlobal = unsafePerformIO (peek simpleGlobal)
+--
+-- We only generate a getter function if the type of the global constant has a
+-- 'Foreign.Storable.Storable' instance. In such cases, a user of the generated bindings should
+-- use the foreign import of the stub function instead. Most notably, arrays of
+-- unknown size do not have a 'Foreign.Storable.Storable' instance.
+constGetter ::
+     Hs.Type
+  -> C.DeclInfo Final
+  -> Hs.TermName
+  -> [Hs.Decl l]
+constGetter ty info pureStubName = singleton getterDecl
+  where
+    -- *** Getter ***
+    --
+    -- The "getter" peeks the value from the pointer
+    getterDecl :: Hs.Decl l
+    getterDecl = Hs.DeclVar $ Hs.Var {
+          name    = Hs.ExportedName getterName
+        , typ     = getterType
+        , expr    = getterExpr
+        , pragmas = [SHs.NOINLINE]
+        , comment = Nothing
+        }
+
+    getterName = Hs.assertNs (Proxy @Hs.NsVar) info.id.hsName
+    getterType = SHs.translateType ty
+    getterExpr = SHs.eBindgenGlobal IO_unsafePerformIO
+                `SHs.EApp` (SHs.eBindgenGlobal PtrConst_peek
+                `SHs.EApp` SHs.EFree pureStubName)
+
+data RunnerNameSpec =
+      -- | The runner is public (i.e, "exported"), and we give it the human
+      --   readable Haskell ID.
+      HaskellId
+      -- | The runner is internal (i.e., "not exported"), so we use a globally
+      --   unique identifier containing a hash.
+    | GlobalUniqueId
+
+-- | Create a stub C function that returns the address of a given declaration,
+-- and create a binding to that stub C function.
+--
+-- See 'global' and @globalConst@ for example uses.
+--
+-- This function returns a pair @(stubDecs, stubImportName)@:
+--
+-- * @stubDecs@: a list of declarations for the pure\/impure stub.
+--
+-- * @pureStubName@: the identifier of the /pure/ stub.
+addressStubDecs ::
+     C.DeclInfo Final -- ^ The given declaration
+  -> C.Type Final     -- ^ The type of the given declaration
+  -> RunnerNameSpec
+  -> PrescriptiveDeclSpec
+  -> HsM ( [Hs.Decl l]
+         , Hs.TermName
+         )
+addressStubDecs info ty runnerNameSpec _spec = do
+    env <- Reader.ask
+    pure $ aux env
+  where
+    aux :: HsM.Env -> ([Hs.Decl l],  Hs.TermName)
+    aux env = (foreignImport ++ runnerDecls, runnerName)
+      where
+        -- *** Stub (impure) ***
+        stubImportType :: Hs.Type
+        stubImportType = Hs.IO $ Translation.topLevel stubType
+
+        stubSymbol :: UniqueSymbol
+        stubSymbol = globallyUnique env.uniqueId env.baseModuleName $ "get_" ++ varName
+
+        stubName :: Hs.TermName
+        stubName = Hs.InternalName stubSymbol
+
+        varName :: String
+        varName = Text.unpack $ info.id.cName.name.text
+
+        stubType :: C.Type Final
+        stubType = C.TypePointers 1 ty
+
+        -- | The C stub return type.
+        --
+        -- If that type references an untagged struct\/union\/enum, then the C type
+        -- can not be pretty-printed because there is no name to refer to. In such
+        -- cases we use @void *@ instead, or @const void *@ if the original type was
+        -- additionally const-qualified.
+        cStubType :: C.Type Final
+        cStubType =
+              C.TypePointers 1
+            $ if referencesUntagged ty
+              then if C.isErasedTypeConstQualified ty
+                  then C.TypeQual C.QualConst C.TypeVoid
+                  else C.TypeVoid
+              else ty
+
+        prettyStub :: String
+        prettyStub = concat [
+              "/* ", stubSymbol.source, " */\n"
+            , PC.prettyFunDefn stubDecl ""
+            ]
+
+        stubDecl :: PC.FunDefn
+        stubDecl =
+            PC.withArgs [] $ \args' ->
+              PC.FunDefn stubSymbol.unique cStubType C.HaskellPureFunction args' $
+                PC.CSList $
+                PC.CSStatement
+                  (PC.ExpressionStatement $ PC.Return $ PC.Address $ PC.NamedVar varName)
+                  PC.CSNil
+
+        cWrapper :: CWrapper
+        cWrapper = CWrapper {
+              definition = prettyStub
+            }
+
+        foreignImport :: [Hs.Decl l]
+        foreignImport =
+            Hs.ForeignImport.foreignImportDec
+              (Hs.ForeignImport.FunName stubSymbol)
+              []
+              (Hs.ForeignImport.FunRes stubImportType)
+              (uniqueCDeclName stubSymbol)
+              (CallConvUserlandCapi cWrapper)
+              (Origin.Global ty)
+              -- These imports can be unsafe. We're binding to simple address stubs,
+              -- so there are no callbacks into Haskell code. Moreover, they are
+              -- short running code.
+              SHs.Unsafe
+
+        -- *** Stub (pure) ***
+
+        runnerDecls :: [Hs.Decl l]
+        runnerDecls = singleton runnerDecl
+
+        runnerDecl :: Hs.Decl l
+        runnerDecl = Hs.DeclVar $ Hs.Var {
+              name    = runnerName
+            , typ     = runnerType
+            , expr    = runnerExpr
+            , pragmas = [SHs.NOINLINE]
+            , comment = mbComment <> mbUniqueSymbolComment
+            }
+
+        mbComment :: Maybe HsDoc.Comment
+        mbComment = mkHaddocks info
+
+        mbUniqueSymbolComment :: Maybe HsDoc.Comment
+        mbUniqueSymbolComment = case runnerName of
+          Hs.ExportedName _ -> Nothing
+          Hs.InternalName x -> Just $ HsDoc.uniqueSymbol x
+
+        name :: Hs.SomeName
+        name = info.id.hsName
+
+        uniquify :: Text -> UniqueSymbol
+        uniquify = globallyUnique env.uniqueId env.baseModuleName . Text.unpack
+
+        runnerName :: Hs.TermName
+        runnerName = case runnerNameSpec of
+            HaskellId      -> Hs.ExportedName $ Hs.assertNs (Proxy @Hs.NsVar) name
+            GlobalUniqueId -> Hs.InternalName $ uniquify name.text
+
+        runnerType = SHs.translateType (Translation.topLevel stubType)
+        runnerExpr = SHs.eBindgenGlobal IO_unsafePerformIO
+                    `SHs.EApp` SHs.EFree stubName
+
+-- | Does the C type reference an untagged struct\/union\/enum?
+--
+-- If so, then the C type can not be pretty-printed because there is no name to
+-- refer to.
+--
+-- This function looks trough macro references. Macro invocations are expanded
+-- by the C compiler, so whatever a macro invocation expands to (i.e., its
+-- underlying type) should also not reference untagged structs\/unions\/enums.
+referencesUntagged ::
+     forall p. (
+       HasCallStack
+     , Id p ~ DeclIdPair
+     , MacroId p ~ DeclIdPair
+     , ExtBinding p ~ BindingSpec.ResolvedExtBinding
+     , MacroUnderlying p ~ C.Type p
+     )
+  => C.Type p
+  -> Bool
+referencesUntagged = go
+  where
+    go :: C.Type p -> Bool
+    go = \case
+        C.TypePrim _pty -> False
+        C.TypeComplex _pty -> False
+        C.TypeRef ref ->
+          -- a struct or union can be untagged
+          ref.cName.isUnnamed
+        C.TypeEnum ref ->
+          -- an enum can be untagged
+          ref.name.cName.isUnnamed
+        C.TypeMacro ref
+          | ref.name.cName.isUnnamed
+          -> panicPure "macros can not be unnamed"
+          -- NOTE: macros are expanded by the C preprocessor, so if pretty-print
+          -- a macro name then we should make sure that it does not expand to a
+          -- type that references an untagged type
+          | go ref.underlying
+          -> panicPure "macros can not expand to types that reference untagged types"
+          | otherwise
+          -> False
+        C.TypeTypedef ref
+          | ref.name.cName.isUnnamed
+          -> panicPure "typedefs can not be unnamed"
+          | otherwise
+          -> False
+        C.TypePointers _n ty -> go ty
+        C.TypeConstArray _n ty -> go ty
+        C.TypeIncompleteArray ty -> go ty
+        C.TypeFun args res ->
+          any goTypeFunArg args || go res
+        C.TypeVoid -> False
+        C.TypeBlock ty -> go ty
+        C.TypeQual _qual ty -> go ty
+        C.TypeExtBinding ref ->
+          -- an external binding reference can wrap references to untagged
+          -- types
+          ref.name.cName.isUnnamed
+
+    goTypeFunArg :: C.TypeFunArg p -> Bool
+    goTypeFunArg arg = go arg.typ
+
+{-------------------------------------------------------------------------------
+  Macro
+-------------------------------------------------------------------------------}
+
+macroVarDecs ::
+     C.DeclInfo Final
+  -> TypecheckedMacroValue l Final
+  -> HsM [Hs.Decl l]
+macroVarDecs info macroValue = do
+    pure [
+        Hs.DeclMacroValue $
+          Hs.MacroValue
+            { name    = hsVarName
+            , expr    = macroValue
+            , comment = mkHaddocks info
+            }
+      ]
+  where
+    hsVarName :: Hs.Name Hs.NsVar
+    hsVarName = Hs.assertNs (Proxy @Hs.NsVar) info.id.hsName
+
+{-------------------------------------------------------------------------------
+  Untagged Enum Constants
+-------------------------------------------------------------------------------}
+
+untaggedEnumConstantDecs ::
+     HasCallStack
+  => C.DeclInfo Final
+  -> C.UntaggedEnumConstant Final
+  -> HsM [Hs.Decl l]
+untaggedEnumConstantDecs info enumConstant = do
+    pure aux
+  where
+    aux :: [Hs.Decl l]
+    aux =
+        let
+          patSynName :: Hs.Name Hs.NsConstr
+          patSynName =
+            Hs.assertNs
+              (Proxy @Hs.NsConstr)
+              enumConstant.constant.info.name.hsName
+
+          patSynType :: Hs.Type
+          patSynType = Hs.PrimType (translateCPrimType enumConstant.typ)
+
+          typeSigDecl :: Hs.Decl l
+          typeSigDecl = Hs.DeclPatSyn Hs.PatSyn{
+                name    = patSynName
+              , typ     = patSynType
+              , constr  = Nothing
+              , value   = fromInteger enumConstant.constant.value
+              , origin  = Origin.EnumConstant enumConstant.constant
+              , comment = mkHaddocks info
+              }
+        in  [typeSigDecl]
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation/Field.hs b/src-internal/HsBindgen/Backend/Hs/Translation/Field.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation/Field.hs
@@ -0,0 +1,51 @@
+-- | Utilities for dealing with fields uniformly
+module HsBindgen.Backend.Hs.Translation.Field (
+    flattenFields
+  , flattenField
+  , Field(..)
+  , getFieldInfo
+  , getFieldTyp
+  , getFieldWidth
+  , getFieldOffset
+  ) where
+
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass.Types (PassTypes (Types))
+
+flattenFields :: [C.Field Final] -> [Field]
+flattenFields = concatMap flattenField
+
+flattenField :: C.Field Final -> [Field]
+flattenField = \case
+    C.FieldRegular field  -> [RegularField field]
+    C.FieldImplicit field -> ImplicitField field : fmap (IndirectField field) field.indirect
+
+data Field =
+    RegularField  (C.RegularField Final)
+  | ImplicitField (C.ImplicitField Final)
+  | IndirectField (C.ImplicitField Final) (C.IndirectField Final)
+
+getFieldInfo :: Field -> C.FieldInfo Final
+getFieldInfo = \case
+    RegularField  field -> field.info
+    ImplicitField field -> field.info
+    IndirectField _impField indField -> indField.info
+
+getFieldTyp :: Field -> Types Final
+getFieldTyp = \case
+    RegularField  field -> field.typ
+    ImplicitField field -> field.typ
+    IndirectField _impField indField -> indField.typ
+
+getFieldWidth :: Field -> Maybe Int
+getFieldWidth = \case
+    RegularField  field -> field.width
+    ImplicitField field -> field.width
+    IndirectField _impField indField -> indField.width
+
+getFieldOffset :: Field -> Int
+getFieldOffset = \case
+    RegularField  field -> field.offset
+    ImplicitField field -> field.offset
+    IndirectField _impField indField -> indField.offset
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation/ForeignImport.hs b/src-internal/HsBindgen/Backend/Hs/Translation/ForeignImport.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation/ForeignImport.hs
@@ -0,0 +1,485 @@
+-- | Generate Haskell foreign imports (using the
+-- 'HsBindgen.Runtime.Support.HasFFIType' class)
+module HsBindgen.Backend.Hs.Translation.ForeignImport (
+    FunName (..)
+  , FunParam (..)
+  , FunRes (..)
+  , foreignImportDec
+  , foreignImportWrapperDec
+  , foreignImportDynamicDec
+  , ImportFor (..)
+  , toFFIType
+  ) where
+
+import Data.Function
+import DeBruijn (Idx (IZ), Size (SS, SZ))
+import Optics.Core
+import Text.Printf (printf)
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.Hs.Origin qualified as Origin
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Backend.SHs.AST.Expr qualified as SHs
+import HsBindgen.Backend.SHs.Translation qualified as SHs
+import HsBindgen.Backend.SHs.Translation.MapFunction
+import HsBindgen.Backend.UniqueSymbol (UniqueSymbol (..))
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Errors (panicPure)
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.NameHint
+
+-- | Info about a function name
+data FunName = FunName {
+    uniqSymbol :: UniqueSymbol
+  }
+
+-- | Info about a function argument
+data FunParam = FunParam {
+    hsParam :: Hs.FunctionParameter Hs.Type
+  }
+
+-- | Info about the function result
+data FunRes = FunRes {
+    hsType :: Hs.Type
+  }
+
+-- | Generate a foreign import
+--
+-- > foreign import ccall "foo" foo :: CInt -> IO CInt
+--
+foreignImportDec ::
+     FunName
+  -> [FunParam]
+  -> FunRes
+  -> C.DeclName
+  -> CallConv
+  -> Origin.ForeignImport
+  -> Safety
+  -> [Hs.Decl l]
+foreignImportDec name params res origName callConv origin safety =
+    [ Hs.DeclForeignImport foreignImportDecl
+    , Hs.DeclFunction funDecl
+    ]
+  where
+    foreignImportDecl :: Hs.ForeignImportDecl
+    foreignImportDecl =  Hs.ForeignImportDecl{
+          name       = fiName
+        , result     = unsafeToFFIResType res.hsType
+        , parameters = fiParameters
+        , origName   = origName
+        , callConv   = callConv
+        , origin     = origin
+        , comment    = fiComment
+        , safety     = safety
+        }
+      where
+
+    -- fiName is unique because it is created from a unique name + suffix
+    fiName = Hs.InternalName (name.uniqSymbol & #unique %~ (<> "_base"))
+    fiParameters = over each (\x ->
+        x.hsParam
+          & #comment .~ Nothing
+          & #typ .~ unsafeToFFI x.hsParam.typ
+          ) params
+
+    fiComment =  Just $ HsDoc.uniqueSymbol name.uniqSymbol
+
+    funDecl :: Hs.FunctionDecl
+    funDecl = Hs.FunctionDecl
+        { name       = fName
+        , parameters = fParameters
+        , result     = res.hsType
+        , body       = mapFromFFI importFor SZ (SHs.EFree fiName)
+        , origin     = origin
+        , pragmas    = []
+        , comment    = fComment
+        }
+
+    importFor :: ImportFor
+    importFor = ImportForFunction {
+          args = fmap (.hsParam.typ) params
+        , res = res.hsType
+        }
+
+    -- fName is unique
+    fName =  Hs.InternalName name.uniqSymbol
+    fParameters = fmap (.hsParam) params
+    fComment = Just $ HsDoc.uniqueSymbol name.uniqSymbol
+
+{-------------------------------------------------------------------------------
+  Dynamic wrapper
+-------------------------------------------------------------------------------}
+
+-- | Generate a so-called dynamic wrapper that turns a Haskell function into a C
+-- function pointer.
+--
+-- > foreign import ccall "wrapper"
+-- >   mkCallback :: IO () -> IO (FunPtr (IO ()))
+--
+-- For more information on this type of wrapper, see section "8.5.1 Standard C
+-- Calls" from the "Haskell 2010 Language" report.
+--
+-- <https://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1620008.5.1>
+--
+foreignImportWrapperDec ::
+     FunName
+  -> Hs.Type
+  -> ImportFor
+  -> Origin.ForeignImport
+  -> [Hs.Decl l]
+foreignImportWrapperDec name hsType importFor origin =
+    [ Hs.DeclForeignImportWrapper foreignImportWrapperDecl
+    , Hs.DeclFunction funDecl
+    ]
+  where
+    foreignImportWrapperDecl :: Hs.ForeignImportWrapper
+    foreignImportWrapperDecl =  Hs.ForeignImportWrapper {
+          name    = fiName
+        , funType = fiFunType
+        , origin  = origin
+        , comment = Just $ HsDoc.uniqueSymbol fiName
+        }
+
+    -- fiName is unique because it is created from a unique name + suffix
+    fiName :: UniqueSymbol
+    fiName = name.uniqSymbol & #unique %~ (<> "_base")
+    fiFunType = unsafeToFFIFunType hsType
+
+    funDecl :: Hs.FunctionDecl
+    funDecl = Hs.FunctionDecl
+        { name       = fName
+        , parameters = fParameters
+        , result     = fResult
+        , body       = fBody
+        , origin     = origin
+        , pragmas    = []
+        , comment    = fComment
+        }
+
+    -- fName is unique
+    fName =  Hs.InternalName name.uniqSymbol
+    fParameters = [
+          Hs.FunctionParameter{
+              typ     = hsType
+            , comment = Nothing
+            }
+        ]
+    fResult = Hs.IO $ Hs.FunPtr hsType
+    fBody =
+        ELam (NameHint "fun") $
+        eBindgenGlobal Functor_fmap `EApp`
+        eBindgenGlobal Foreign_castFunPtr `EApp`
+        (EFree (Hs.InternalName fiName) `EApp` mapToFFI importFor (SS SZ) (EBound IZ))
+    fComment = Just $ HsDoc.uniqueSymbol name.uniqSymbol
+
+{-------------------------------------------------------------------------------
+  Dynamic import
+-------------------------------------------------------------------------------}
+
+-- | Generate a so-called dynamic import that turns a C function pointer into a
+-- corresponding Haskell function.
+--
+-- > foreign import ccall "dynamic"
+-- >   mkFun :: FunPtr (CInt -> IO ()) -> (CInt -> IO ())
+--
+-- For more information on this type of wrapper, see section "8.5.1 Standard C
+-- Calls" from the "Haskell 2010 Language" report.
+--
+-- <https://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1620008.5.1>
+--
+foreignImportDynamicDec ::
+     FunName
+  -> Hs.Type
+  -> ImportFor
+  -> Origin.ForeignImport
+  -> [Hs.Decl l]
+foreignImportDynamicDec name hsType importFor origin =
+    [ Hs.DeclForeignImportDynamic foreignImportDynamicDecl
+    , Hs.DeclFunction funDecl
+    ]
+  where
+    foreignImportDynamicDecl :: Hs.ForeignImportDynamic
+    foreignImportDynamicDecl =  Hs.ForeignImportDynamic {
+          name    = fiName
+        , funType = fiFunType
+        , origin  = origin
+        , comment = Just $ HsDoc.uniqueSymbol fiName
+        }
+
+    -- fiName is unique because it is created from a unique name + suffix
+    fiName :: UniqueSymbol
+    fiName = name.uniqSymbol & #unique %~ (<> "_base")
+    fiFunType = unsafeToFFIFunType hsType
+
+    funDecl :: Hs.FunctionDecl
+    funDecl = Hs.FunctionDecl
+        { name       = fName
+        , parameters = fParameters
+        , result     = fResult
+        , body       = fBody
+        , origin     = origin
+        , pragmas    = []
+        , comment    = fComment
+        }
+
+    -- fName is unique
+    fName =  Hs.InternalName name.uniqSymbol
+    fParameters = [
+          Hs.FunctionParameter{
+              typ     = Hs.FunPtr hsType
+            , comment = Nothing
+            }
+        ]
+    fResult = hsType
+    fBody =
+        ELam (NameHint "funPtr") $
+        (mapFromFFI importFor (SS SZ)
+        (EFree (Hs.InternalName fiName) `EApp`
+        (eBindgenGlobal Foreign_castFunPtr `EApp`
+        EBound IZ
+        )))
+    fComment = Just $ HsDoc.uniqueSymbol name.uniqSymbol
+
+{-------------------------------------------------------------------------------
+  ImportFor
+-------------------------------------------------------------------------------}
+
+-- | The function type that we are generating a @foreign import@ for
+--
+-- When generating a @foreign import@ declaration, we do that for either a
+-- straight function type or a @newtype@ around a function type. We track this
+-- information so that we can pass it to @mapToFFI@ or @mapFromFFI@.
+--
+-- Note: for function @newtype@s we only generate dynamic wrappers and dynamic
+-- imports, not regular @foreign import@ declarations.
+data ImportFor =
+    ImportForFunction {
+        args :: [Hs.Type]
+      , res  :: Hs.Type
+      }
+  | ImportForNewtype {
+        args   :: [Hs.Type]
+      , res    :: Hs.Type
+      , newtyp :: Hs.Newtype
+      }
+
+-- | Map a function expression that uses arbitrary Haskell types to a function
+-- expression that uses FFI types
+--
+-- The mapping is type-directed, and the type of the non-FFI-type function is
+-- tracked in the 'ImportFor' argument.
+--
+-- === Example
+--
+-- Let's say @fun@ is the name of the function we are converting. Then the
+-- result of @mapToFFI@ may look something like:
+--
+-- >  \x0 -> \x1 -> \x2 ->
+-- >    fmap toFFIType (fun (fromFFIType x0) (fromFFIType x1) (fromFFIType x2))
+--
+mapToFFI :: ImportFor -> Size ctx -> SHs.SExpr ctx -> SHs.SExpr ctx
+mapToFFI dynFor size funExpr = case dynFor of
+    ImportForFunction args res -> forFunction args res
+    ImportForNewtype args res nt -> forNewtype args res nt
+  where
+    convArg = mkConvArg HasFFIType_fromFFIType
+    convRes = mkConvRes HasFFIType_toFFIType
+
+    forFunction args res =
+        mapFunctionExpr (MapFunctionParams {
+            convArg = convArg
+          , convRes = convRes
+          , args    = args
+          , res     = res
+          , funExpr = funExpr
+          , size    = size
+          })
+
+    forNewtype args res nt =
+        mapFunctionExpr (MapFunctionParams {
+            convArg = convArg
+          , convRes = convRes
+          , args    = args
+          , res     = res
+          , funExpr = eBindgenGlobal HasField_getField `ETypeApp` fieldLit `EApp` funExpr
+          , size    = size
+          })
+      where
+        fieldLit = SHs.translateType $ Hs.StrLit $ Hs.nameToStr nt.field.name
+
+
+-- | Map a function expression that uses FFI types to a function expression that
+-- uses arbitrary Haskell types types
+--
+-- The mapping is type-directed, and the type of the non-FFI-type function is
+-- tracked in the 'ImportFor' argument.
+--
+-- === Example
+--
+-- Let's say @fun@ is the name of the function we are converting. Then the
+-- result of @mapFromFFI@ may look something like:
+--
+-- >  \x0 -> \x1 -> \x2 ->
+-- >    fmap fromFFIType (fun (toFFIType x0) (toFFIType x1) (toFFIType x2))
+--
+mapFromFFI :: ImportFor -> Size ctx -> SHs.SExpr ctx -> SHs.SExpr ctx
+mapFromFFI dynFor size funExpr = case dynFor of
+    ImportForFunction args res -> forFunction args res
+    ImportForNewtype args res nt -> forNewtype args res nt
+  where
+    convArg = mkConvArg HasFFIType_toFFIType
+    convRes = mkConvRes HasFFIType_fromFFIType
+
+    forFunction args res =
+        mapFunctionExpr (MapFunctionParams {
+            convArg = convArg
+          , convRes = convRes
+          , args    = args
+          , res     = res
+          , funExpr = funExpr
+          , size    = size
+          })
+
+    forNewtype args res nt =
+        ECon nt.constr `EApp`
+        mapFunctionExpr (MapFunctionParams {
+            convArg = convArg
+          , convRes = convRes
+          , args    = args
+          , res     = res
+          , funExpr = funExpr
+          , size    = size
+          })
+
+-- | Create a convertion expression that is applied to function arguments.
+--
+-- This is used to convert function arguments to\/from FFI types.
+mkConvArg :: BindgenGlobalTerm -> ConvArg
+mkConvArg g =  ConvArg $ \_typ idx ->
+    SHs.eBindgenGlobal g  `EApp` SHs.EBound idx
+
+-- | Create a convertion expression that is applied to a function result.
+--
+-- This is used to convert a function result to\/from an FFI type.
+mkConvRes :: BindgenGlobalTerm -> ConvRes
+mkConvRes g = ConvRes $ \typ e -> case typ of
+    Hs.IO (Hs.PrimType Hs.PrimUnit) -> e
+    Hs.PrimType Hs.PrimUnit -> e
+    Hs.IO{} -> eBindgenGlobal Functor_fmap `EApp` eBindgenGlobal g `EApp` e
+    _ -> eBindgenGlobal g `EApp` e
+
+{-------------------------------------------------------------------------------
+  FFI types
+-------------------------------------------------------------------------------}
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1599>: once #1599 is
+-- resolved all the panics in this section should go away.
+
+unsafeToFFIFunType :: Hs.Type -> Hs.FFIFunType
+unsafeToFFIFunType ty = case toFFIFunType ty of
+    Nothing ->
+      panicPure $ printf "Type does not have an FFI function type: %s" (show ty)
+    Just ty' ->
+      ty'
+
+toFFIFunType :: Hs.Type -> Maybe Hs.FFIFunType
+toFFIFunType = \case
+    Hs.TypRef _ t  -> t >>= toFFIFunType
+    Hs.Fun arg res -> addArg <$> toFFIType arg <*> toFFIFunType res
+    t -> toFFIResType t >>= \res -> pure Hs.FFIFunType {args = [], res = res }
+  where
+    addArg arg t = Hs.FFIFunType {
+          args = arg : t.args
+        , res  = t.res
+        }
+
+unsafeToFFIResType :: Hs.Type -> Hs.FFIResType
+unsafeToFFIResType ty = case toFFIResType ty of
+    Nothing ->
+      panicPure $ printf "Type does not have an FFI function result type: %s" (show ty)
+    Just ty' ->
+      ty'
+
+toFFIResType :: Hs.Type -> Maybe Hs.FFIResType
+toFFIResType = \case
+    Hs.IO (Hs.PrimType Hs.PrimUnit) -> Just Hs.FFIResIOUnit
+    Hs.PrimType Hs.PrimUnit         -> Just Hs.FFIResUnit
+    Hs.IO t                         -> Hs.FFIResIO <$> toFFIType t
+    t                               -> Hs.FFIRes <$> toFFIType t
+
+unsafeToFFI :: Hs.Type -> Hs.FFIType
+unsafeToFFI ty = case toFFIType ty of
+    Nothing ->
+      panicPure $ printf "Type does not have an FFI type: %s" (show ty)
+    Just ty' ->
+      ty'
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1599>: After issue
+-- #1599 is resolved, we should reconsider whether we want to use @Hs.Type@ as
+-- an input here, or @C.Type Final@, or something else.
+toFFIType :: Hs.Type -> Maybe Hs.FFIType
+toFFIType = go
+  where
+    no = Nothing
+    yes = Just
+
+    go :: Hs.Type -> Maybe Hs.FFIType
+    go = \case
+      Hs.PrimType pt          -> goPrim pt
+      Hs.TypRef _ t           -> t >>= go
+      Hs.ConstArray{}         -> no
+      Hs.IncompleteArray{}    -> no
+      Hs.PtrArrayElem {}      -> yes Hs.FFIPtrVoid
+      Hs.PtrConstArrayElem {} -> yes Hs.FFIPtrVoid
+      Hs.Ptr{}                -> yes Hs.FFIPtrVoid
+      Hs.FunPtr{}             -> yes Hs.FFIFunPtrVoid
+      Hs.PtrConst{}           -> yes Hs.FFIPtrVoid
+      Hs.IO{}                 -> no
+      Hs.Fun{}                -> no
+      Hs.ExtBinding _ref _cSpec hsSpec t' ->
+        case BindingSpec.hsSpecFFIType hsSpec of
+          -- TODO <https://github.com/well-typed/hs-bindgen/issues/1599>: We
+          -- should warn if a type does not have an FFI type, rather than
+          -- silently continuing.
+          Nothing -> go t'
+          Just hsFFIType -> pure $ extFFIType hsFFIType
+      Hs.ByteArray            -> no
+      Hs.SizedByteArray{}     -> no
+      Hs.Block{}              -> yes Hs.FFIPtrVoid
+      Hs.ComplexType{}        -> no
+      Hs.StrLit{}             -> no
+      Hs.WithFlam{}           -> no
+      Hs.EquivStorable{}      -> no
+      Hs.IsStructViaReadRaw{} -> no
+
+    goPrim :: Hs.PrimType -> Maybe Hs.FFIType
+    goPrim pt = case pt of
+        Hs.PrimVoid    -> no
+        Hs.PrimUnit    -> no
+        -- We never generate foreign imports with the Haskell-specific @Int@
+        -- type. We use @CInt@ or similar instead.
+        Hs.PrimInt     -> no
+        -- Primitive types that correspond to C keywords
+        Hs.PrimCChar   -> yes Hs.FFIPrimCChar
+        Hs.PrimCSChar  -> yes Hs.FFIPrimCSChar
+        Hs.PrimCUChar  -> yes Hs.FFIPrimCUChar
+        Hs.PrimCShort  -> yes Hs.FFIPrimCShort
+        Hs.PrimCUShort -> yes Hs.FFIPrimCUShort
+        Hs.PrimCInt    -> yes Hs.FFIPrimCInt
+        Hs.PrimCUInt   -> yes Hs.FFIPrimCUInt
+        Hs.PrimCLong   -> yes Hs.FFIPrimCLong
+        Hs.PrimCULong  -> yes Hs.FFIPrimCULong
+        Hs.PrimCLLong  -> yes Hs.FFIPrimCLLong
+        Hs.PrimCULLong -> yes Hs.FFIPrimCULLong
+        Hs.PrimCBool   -> yes Hs.FFIPrimCBool
+        Hs.PrimCFloat  -> yes Hs.FFIPrimCFloat
+        Hs.PrimCDouble -> yes Hs.FFIPrimCDouble
+
+    extFFIType :: BindingSpec.HsFFIType -> Hs.FFIType
+    extFFIType hsFFIType =  Hs.FFIExternal hsFFIType.unwrap
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation/Function.hs b/src-internal/HsBindgen/Backend/Hs/Translation/Function.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation/Function.hs
@@ -0,0 +1,741 @@
+module HsBindgen.Backend.Hs.Translation.Function (
+    functionDecs
+  ) where
+
+import Control.Monad.Reader qualified as Reader
+import Data.Kind (Type)
+import Data.Text qualified as T
+import Data.Type.Equality ((:~:) (Refl))
+import DeBruijn (Add, Ctx, Env (..), Idx (..), lzeroAdd, sizeEnv, swapAdd,
+                 tabulateEnv, unrzeroAdd, zipWithEnv)
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Haddock.Translation
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.Hs.Origin qualified as Origin
+import HsBindgen.Backend.Hs.Translation.ForeignImport qualified as Hs.ForeignImport
+import HsBindgen.Backend.Hs.Translation.ForeignImport qualified as HsFI
+import HsBindgen.Backend.Hs.Translation.Monad (HsM)
+import HsBindgen.Backend.Hs.Translation.Monad qualified as HsM
+import HsBindgen.Backend.SHs.AST qualified as SHs
+import HsBindgen.Backend.SHs.Translation.Common qualified as SHs
+import HsBindgen.Backend.UniqueSymbol
+import HsBindgen.Config.MangleCandidate (mangleCandidateDefaultFallback)
+import HsBindgen.Errors (panicPure)
+import HsBindgen.Frontend.Pass.AdjustTypes.IsPass (AdjustedFrom (..))
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes.Translation qualified as Translation
+import HsBindgen.Frontend.PrettyC qualified as PC
+import HsBindgen.Imports hiding (def)
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.NameHint (NameHint (..))
+
+-- | Bind to a C function
+--
+-- We seek to always generate and expose a Haskell function with the same name
+-- as the C function, and with the same signature. However, we can not always
+-- directly call the original C function from Haskell. Only primitive types
+-- (e.g, pointers, integers, characters) can be passed directly by value between
+-- Haskell and C.
+--
+-- We say that functions which use only primitive types have a "primitive
+-- signature". Functions with a non-primitive signature (for example, functions
+-- that accept or return structs by value) cannot be called directly from
+-- Haskell and require additional handling.
+--
+-- We therefore have multiple objects on both the C and the Haskell sides, and
+-- have to be meticulous with names:
+--
+-- On the C side, we have:
+--
+-- - The original C function;
+--
+-- On the C side, we generate:
+--
+-- - A C wrapper (beware, we use the word "wrapper" only in this case); the C
+--   wrapper is C code, has a globally unique name, and we bind to it using the
+--   "ccall" calling convention (the combination of the C wrapper and the
+--   "ccall" foreign import is what we refer to as userland CAPI).
+--
+--   The C wrapper will always have a primitive signature, so that we can call
+--   it from Haskell. If the original C function also has a primitive signature,
+--   the C wrapper will have the same signature as the original C function.
+--
+-- On the Haskell side, we generate:
+--
+-- - The foreign import of the C wrapper. We consider the foreign import an
+--   internal, auxiliary function; we give it the same globally unique name as
+--   the C wrapper; the foreign import does _not_ have Haddock documentation.
+--
+-- - We generate a function declaration which we refer to as
+--   "restoreOrigSignature", and which has the same signature and name (modulo
+--   name mangling) as the original C function.
+functionDecs ::
+     HasCallStack
+  => SHs.Safety
+  -> C.DeclInfo Final
+  -> C.Function Final
+  -> PrescriptiveDeclSpec
+  -> HsM [Hs.Decl l]
+functionDecs safety info origCFun _spec = do
+    env <- Reader.ask
+    pure $ aux env
+  where
+    aux :: HsM.Env -> [Hs.Decl l]
+    aux env = concat [
+          foreignImport
+        , [restoreOrigSignature]
+        ]
+      where
+        origCName :: Text
+        origCName = info.id.cName.name.text
+
+        origHsName :: Hs.TermName
+        origHsName = Hs.ExportedName $ Hs.assertNs (Proxy @Hs.NsVar) info.id.hsName
+
+        cWrapperName :: UniqueSymbol
+        cWrapperName =
+            globallyUnique env.uniqueId env.baseModuleName $
+              concat [
+                  show safety
+                , "_"
+                , T.unpack origCName
+                ]
+
+        primResult :: PassResBy
+        primResult = classifyResPassingMethod origCFun.res.c
+
+        primParams :: [PassArgBy]
+        primParams = map classifyArgPassingMethod origCFun.args
+
+        foreignImport :: [Hs.Decl l]
+        foreignImport =
+            HsFI.foreignImportDec
+              (Hs.ForeignImport.FunName cWrapperName)
+              foreignImportParams
+              foreignImportResult
+              (uniqueCDeclName cWrapperName)
+              (CallConvUserlandCapi cWrapper)
+              (Origin.Function origCFun)
+              safety
+          where
+            cWrapperDecl :: PC.FunDefn
+            cWrapperDecl =
+                getCWrapperDecl
+                  (T.unpack origCName)
+                  cWrapperName.unique
+                  primResult
+                  primParams
+
+            cWrapper :: CWrapper
+            cWrapper = CWrapper {
+                  definition = PC.prettyFunDefn cWrapperDecl ""
+                }
+
+        foreignImportParams :: [Hs.ForeignImport.FunParam]
+        foreignImportParams = [
+              Hs.ForeignImport.FunParam {
+                  hsParam =
+                    Hs.FunctionParameter{
+                      typ     = toPrimitiveType Translation.FunArg arg
+                    , comment = Nothing
+                    }
+                }
+            | arg <- primParams
+            ] ++ [
+              Hs.ForeignImport.FunParam {
+                  hsParam =
+                    Hs.FunctionParameter{
+                      typ     = toPrimitiveType Translation.FunArg primResult
+                    , comment = Nothing
+                    }
+                }
+            | case primResult of
+                -- A type that is not supported by the Haskell FFI as a function result.
+                -- We pass it as a function parameter instead.
+                PassByAddress {} -> True
+                -- A "normal" result type that is supported by the Haskell FFI.
+                PassByValue {} -> False
+            ]
+
+        -- When translating a 'C.Type' there are C types which we cannot pass
+        -- directly using C FFI. We need to distinguish these.
+        --
+        -- Function arguments and result have to be passed either by value or by
+        -- address. Result types that have to be passed by address become
+        -- parameters.
+        foreignImportResult :: Hs.ForeignImport.FunRes
+        foreignImportResult = case primResult of
+            -- A type that is not supported by the Haskell FFI as a function result.
+            -- We pass it as a function parameter instead.
+            PassByAddress {} -> mkFunRes (PassByValue C.TypeVoid)
+            -- A "normal" result type that is supported by the Haskell FFI.
+            PassByValue {} -> mkFunRes primResult
+          where
+            mkFunRes :: PassResBy -> Hs.ForeignImport.FunRes
+            mkFunRes passBy = Hs.ForeignImport.FunRes {
+                  hsType   = mbHsIO $ toPrimitiveType Translation.FunRes passBy
+                }
+
+        restoreOrigSignature :: Hs.Decl l
+        restoreOrigSignature =
+            getRestoreOrigSignatureDecl
+              origHsName
+              (Hs.InternalName cWrapperName)
+              primResult
+              primParams
+              (mbHsIO $ toOrigType Translation.FunRes primResult)
+              restoreOrigSignatureParams
+              origCFun
+              (mbRestoreOrigSignatureComment <> mbIoComment)
+
+        mbRestoreOrigSignatureComment :: Maybe HsDoc.Comment
+        restoreOrigSignatureParams :: [Hs.FunctionParameter Hs.Type]
+        (mbRestoreOrigSignatureComment, restoreOrigSignatureParams) =
+          let params :: [(Maybe Text, Hs.FunctionParameter Hs.Type)]
+              params = [ ( fmap (.cName.text) arg.name
+                        , Hs.FunctionParameter{
+                            typ     = toOrigType Translation.FunArg (classifyArgPassingMethod arg)
+                          , comment = Nothing
+                          })
+                        | arg <- origCFun.args
+                        ]
+          in  mkHaddocksDecorateParams info params
+
+        runsInIO :: Bool
+        runsInIO = functionShouldRunInIO origCFun.attrs.purity primResult primParams
+
+        mbHsIO :: Hs.Type -> Hs.Type
+        mbHsIO
+          | runsInIO  = Hs.IO
+          | otherwise = id
+
+        mbIoComment :: Maybe HsDoc.Comment
+        mbIoComment = ioComment origCFun.attrs.purity
+
+{-------------------------------------------------------------------------------
+  Purity
+-------------------------------------------------------------------------------}
+
+-- | Decide whether a function has to run in 'IO'.
+--
+-- Only Haskell-pure functions are allowed to run without 'IO'. See the
+-- documentation on 'C.FunctionPurity'.
+--
+-- But, if any of the function arguments require restoration (see
+-- 'requiresRestore'), then the function has to run in 'IO' regardless of the
+-- function purity, because pointer manipulation requires 'IO'.
+--
+functionShouldRunInIO ::
+     C.FunctionPurity -- ^ C function purity (function attribute)
+  -> PassResBy        -- ^ C result type
+  -> [PassArgBy]      -- ^ C parameter types
+  -> Bool
+functionShouldRunInIO purity resType argTypes
+  | requiresRestore resType || any requiresRestore argTypes
+  = True
+  | otherwise
+  = case purity of
+      C.HaskellPureFunction -> False
+      C.CPureFunction       -> True
+      C.ImpureFunction      -> True
+
+-- | A haddock comment related to function purity
+ioComment ::
+     C.FunctionPurity     -- ^ C function purity (function attribute)
+  -> Maybe HsDoc.Comment
+ioComment purity =
+    case purity of
+      C.HaskellPureFunction -> Just constComment
+      C.CPureFunction       -> Just pureComment
+      C.ImpureFunction      -> Nothing
+  where
+    -- "Marked @__attribute((const))__@"
+    --
+    -- Haskell-pure functions can be safely encapsulated using
+    -- 'unsafePerformIO' to create a Haskell-pure function. We include a
+    -- comment in the generated bindings to this effect.
+    constComment :: HsDoc.Comment
+    constComment = HsDoc.paragraph [
+        HsDoc.TextContent "Marked"
+      , HsDoc.Monospace
+        [ HsDoc.Bold
+          [ HsDoc.TextContent "attribute((const))" ]
+        ]
+      ]
+
+    -- "Marked @__attribute((pure))__@"
+    --
+    -- C-pure functions can be safely encapsulated using 'unsafePerformIO' to
+    -- create a Haskell-pure functions. We include a comment in the generated
+    -- bindings to this effect.
+    pureComment :: HsDoc.Comment
+    pureComment = HsDoc.paragraph [
+        HsDoc.TextContent "Marked"
+      , HsDoc.Monospace
+        [ HsDoc.Bold
+          [ HsDoc.TextContent "attribute((pure))" ]
+        ]
+      ]
+
+{-------------------------------------------------------------------------------
+  Argument passing method
+-------------------------------------------------------------------------------}
+
+-- | Classification of the type of a function argument: it is either passed by
+-- value or by address.
+type PassArgBy = PassBy (C.FunctionArg Final) (C.Type Final)
+
+-- | Classification of the type of a function result: it is either passed by
+-- value or by address.
+type PassResBy = PassBy (C.Type Final) (C.Type Final)
+
+-- | Classification of the type of a function argument\/result: it is either
+-- passed by value or by address.
+data PassBy byValue byAddress =
+      -- | Types passed by value.
+      --
+      -- Ordinary, "primitive" types which can be handled by Haskell FFI
+      -- directly.
+      PassByValue byValue
+      -- | Types passed by address: union, struct, and complex
+      --
+      -- These have to be passed by address, because they can not be handled by
+      -- the Haskell FFI directly.
+    | PassByAddress byAddress
+  deriving Show
+
+isPassByAddress :: PassBy byValue byAddress -> Bool
+isPassByAddress = \case
+    PassByValue {} -> False
+    PassByAddress {} -> True
+
+-- | Classify how a function result is passed from C to Haskell
+classifyResPassingMethod :: HasCallStack => C.Type Final -> PassResBy
+classifyResPassingMethod res
+  -- Heap types
+  | C.isCanonicalTypeStruct res ||
+    C.isCanonicalTypeUnion res ||
+    C.isCanonicalTypeComplex res
+  = PassByAddress res
+
+  | C.isCanonicalTypeArray res
+  = panicPure "classifyResPassingMethod: an array can not be the result type of a function"
+
+  | C.isCanonicalTypeFunction res
+  = panicPure "classifyResPassingMethod: a function can not be the result type of a function"
+
+  -- Other types
+  | otherwise
+  = PassByValue res
+
+-- | Classify how a function argument is passed from Haskell to C
+classifyArgPassingMethod :: HasCallStack => C.FunctionArg Final -> PassArgBy
+classifyArgPassingMethod arg
+  -- Heap types
+  | C.isCanonicalTypeStruct  arg.typ.c ||
+    C.isCanonicalTypeUnion   arg.typ.c ||
+    C.isCanonicalTypeComplex arg.typ.c
+  = if arg.ann == NotAdjusted
+    then PassByAddress arg.typ.c
+    else panicPure
+          "classifyArgPassingMethod: found a function argument/result type that is \
+          \a struct/union/complex with an unexpected annotation. \
+          \Is there a bug in the AdjustTypes frontend pass?"
+
+  | C.isCanonicalTypeArray arg.typ.c
+  = panicPure
+      "classifyArgPassingMethod: found a function argument/result type that is an array, \
+      \which is unexpected because it should have been adjusted to a pointer. \
+      \Is there a bug in the AdjustTypes frontend pass?"
+
+  | C.isCanonicalTypeFunction arg.typ.c
+  = panicPure
+      "classifyArgPassingMethod: found a function argument/result type that is a function, \
+      \which is unexpected because it should have been adjusted to a pointer. \
+      \Is there a bug in the AdjustTypes frontend pass?"
+
+  -- Other types
+  | otherwise
+  = PassByValue arg
+
+class ToWrapperType a where
+-- | Recover type used in the C wrapper
+  toWrapperType :: a -> C.Type Final
+
+instance ToWrapperType PassArgBy where
+  toWrapperType = \case
+      PassByValue argTy -> argTy.typ.c
+      PassByAddress ty -> C.TypePointers 1 ty
+
+instance ToWrapperType PassResBy where
+  toWrapperType = \case
+    PassByValue ty -> ty
+    PassByAddress ty -> C.TypePointers 1 ty
+
+class ToPrimitiveType a where
+  -- | Recover type used in the foreign import
+  toPrimitiveType :: Translation.TypeContext -> a -> Hs.Type
+
+instance ToPrimitiveType PassArgBy where
+  toPrimitiveType ctx = \case
+      PassByValue argTy -> Translation.inContext ctx argTy
+      PassByAddress ty -> Translation.inContext ctx $ C.TypePointers 1 ty
+
+instance ToPrimitiveType PassResBy where
+  toPrimitiveType ctx = \case
+      PassByValue ty -> Translation.inContext ctx ty
+      PassByAddress ty -> Translation.inContext ctx $ C.TypePointers 1 ty
+
+class ToOrigType a where
+  -- | Recover type used in "restoreOrigSignature"
+  toOrigType :: Translation.TypeContext -> a -> Hs.Type
+
+instance ToOrigType PassArgBy where
+  toOrigType ctx = \case
+      PassByValue argTy -> Translation.inContext ctx argTy
+      PassByAddress ty -> Translation.inContext ctx ty
+
+instance ToOrigType PassResBy where
+  toOrigType ctx = \case
+      PassByValue ty -> Translation.inContext ctx ty
+      PassByAddress ty -> Translation.inContext ctx ty
+
+-- | Check whether a type needs to be restored
+--
+-- If a type is passed by address through the Haskell FFI when the C function
+-- takes it by value, then we restore the original type in the Haskell binding
+-- by peeking/poking the value from/to the address. This requires performing
+-- 'IO'.
+--
+requiresRestore :: PassBy byValue byAddress -> Bool
+requiresRestore = \case
+    PassByValue{}   -> False
+    PassByAddress{} -> True
+
+{-------------------------------------------------------------------------------
+  Userland-API C wrapper
+-------------------------------------------------------------------------------}
+
+-- | Userland-API C wrapper
+getCWrapperDecl ::
+     String      -- ^ original C name
+  -> String      -- ^ C wrapper name
+  -> PassResBy   -- ^ C result type
+  -> [PassArgBy] -- ^ C types of function parameters
+  -> PC.FunDefn
+getCWrapperDecl origName wrapperName res args
+    | C.isVoid (toWrapperType res)
+    = PC.withArgs args $ \args' ->
+        PC.FunDefn wrapperName C.TypeVoid C.ImpureFunction (toWrapperType <$> args') $
+        PC.CSList $
+          PC.CSStatement
+            (PC.ExpressionStatement $ PC.Call origName (callArgs args' (PC.argsToIdx args')))
+            PC.CSNil
+
+    | isPassByAddress res
+    = PC.withArgs args $ \args' ->
+        PC.FunDefn wrapperName C.TypeVoid C.ImpureFunction (fmap toWrapperType args' :> toWrapperType res) $
+        PC.CSList $
+          PC.CSStatement
+            (PC.ExpressionStatement $ PC.Assign (PC.LDeRef (PC.LVar IZ)) $ PC.Call origName (callArgs args' (IS <$> PC.argsToIdx args')))
+            PC.CSNil
+
+    | otherwise
+    = PC.withArgs args $ \args' ->
+        PC.FunDefn wrapperName (toWrapperType res) C.ImpureFunction (toWrapperType <$> args') $
+        PC.CSList $
+          PC.CSStatement
+            (PC.ExpressionStatement $ PC.Return $ PC.Call origName (callArgs args' (PC.argsToIdx args')))
+            PC.CSNil
+  where
+    callArgs :: Env ctx' PassArgBy -> Env ctx' (Idx ctx) -> [PC.Expr ctx]
+    callArgs tys ids = toList (zipWithEnv f tys ids)
+      where f ty idx = if isPassByAddress ty then PC.DeRef (PC.Var idx) else PC.Var idx
+
+{-------------------------------------------------------------------------------
+  RestoreOrigSignature
+-------------------------------------------------------------------------------}
+
+-- | Generate a function declaration restoring the signature of the original C
+-- function.
+getRestoreOrigSignatureDecl ::
+     Hs.TermName                    -- ^ name of new function
+  -> Hs.TermName                    -- ^ name of foreign import
+  -> PassResBy                      -- ^ C result type
+  -> [PassArgBy]                    -- ^ C types of function parameters
+  -> Hs.Type                        -- ^ Haskell result type
+  -> [Hs.FunctionParameter Hs.Type] -- ^ Haskell function parameters
+  -> C.Function Final               -- ^ original C function
+  -> Maybe HsDoc.Comment            -- ^ function comment
+  -> Hs.Decl l
+getRestoreOrigSignatureDecl hiName loName primResult primParams hsResult hsParams cFunc mbComment =
+    Hs.DeclFunction $ Hs.FunctionDecl{
+        name       = hiName
+      , parameters = hsParams
+        -- NOTE: the result type only includes 'IO' if 'functionShouldRunInIO'
+        -- said to include it.
+      , result     = hsResult
+      , body       =
+          if requiresRestore primResult || any requiresRestore primParams
+          then bodyExpr
+          else noRecoveryBodyExpr
+      , origin     = Origin.Function cFunc
+      , pragmas    = []
+      , comment    = mbComment
+      }
+  where
+    -- | The body of the function if no function arguments or results require
+    -- restoration (see 'requiresRestore').
+    --
+    -- For example, simply:
+    --
+    -- > foo
+    --
+    noRecoveryBodyExpr :: SHs.ClosedExpr
+    noRecoveryBodyExpr = SHs.EFree loName
+
+    -- | The body of the function if one or more function arguments or results
+    -- require restoration (see 'requiresRestore').
+    --
+    -- For example:
+    --
+    -- >  \x0 -> \x1 -> \x2 -> \x3 ->
+    -- >    with x0 $ \y4 -> with x2 $ \y5 ->
+    -- >      allocaAndPeek $ \z6 ->
+    -- >        foo y4 x1 (unsafeFromPtr y5) x3 z6
+    --
+    bodyExpr :: SHs.ClosedExpr
+    bodyExpr =
+      -- construct lambdas for all function arguments
+      lambdas EmptyEnv (zipWith3 mkFunArg cParamNames primParams hsParams) $ \env ->
+        -- pass function arguments by address if necessary
+        passArgsByAddressIfNecessary env $ \args ->
+          -- pass the function result by address if necessary
+          passResultByAddressIfNecessary args $ \args' ->
+            -- call the foreign import
+            callForeignImport args'
+      where
+        cParamNames :: [Maybe Text]
+        cParamNames = [ fmap (.cName.text) arg.name
+                      | arg <- cFunc.args
+                      ]
+
+        mkFunArg :: Maybe Text -> PassArgBy -> Hs.FunctionParameter Hs.Type -> FunArg
+        mkFunArg mbCName passBy param = FunArg{
+            typ        = passBy
+          , cParamName = mbCName
+          , funParam   = param
+          }
+
+    -- | Construct a string of lambdas
+    --
+    -- For example:
+    --
+    -- > ... \x0 -> \x1 -> \x2 -> \x3 -> ...
+    --
+    lambdas ::
+         forall ctx.
+         -- | Context of in-scope variables
+         Env ctx VarInfo
+         -- | Function arguments to create lambdas for
+      -> [FunArg]
+         -- | Construct the body of the string of lambdas
+      -> (forall ctx'. Env ctx' VarInfo -> SHs.SExpr ctx')
+      -> SHs.SExpr ctx
+    lambdas env0 xs0 kont = go env0 xs0
+      where
+        -- | Run down the context of function arguments, and include a lambda
+        -- for each.
+        go ::
+             forall ctx'.
+             Env ctx'  VarInfo
+          -> [FunArg]
+          -> SHs.SExpr ctx'
+        go env []     = kont env
+        go env (x:xs) =
+            let varInfo = funArgToVarInfo x
+            in  SHs.ELam varInfo.nameHint $ go (env :> varInfo) xs
+
+    -- | Construct expressions to pass function arguments by address, if
+    -- necessary
+    --
+    -- For example :
+    --
+    -- > ... with x0 $ \y4 -> with x2 $ \y5 -> ...
+    --
+    -- We do this only if the function argument requires restoration (see
+    -- 'requiresRestore')
+    --
+    -- If the function argument is @const@-qualified, then we also record this
+    -- information for later in the 'Var' type.
+    --
+    passArgsByAddressIfNecessary ::
+         -- | Context of in-scope variables
+         Env ctx VarInfo
+         -- | Construct the body of the string of 'Foreign.Marshal.Utils.with's
+      -> (forall ctx'. [(Var ctx')] -> SHs.SExpr ctx')
+      -> SHs.SExpr ctx
+    passArgsByAddressIfNecessary env0 kont =
+        -- NOTE: The environment is in reverse order with respect to the
+        -- function arguments, hence the need to reverse here.
+        let envTypes = reverseEnv env0
+            envIdxs = reverseEnv (tabulateEnv (sizeEnv env0) id)
+        in go envTypes envIdxs []
+      where
+        --  | Run down the context of in-scope variables, and include a 'Foreign.Marshal.Utils.with' if
+        -- if the variable is a 'PassByAddress'.
+        go ::
+             Env ctx' VarInfo
+          -> Env ctx' (Idx ctx)
+          -> [(Var ctx)]
+          -> SHs.SExpr ctx
+        go EmptyEnv EmptyEnv zs = kont (reverse zs) -- reverse again!
+        go (xs :> x) (ys :> y) zs = case x.typ of
+            PassByAddress ty -> SHs.eAppMany (SHs.eBindgenGlobal Capi_with) $
+              let wrapPtrConst = C.isErasedTypeConstQualified ty in
+              [ SHs.EBound y
+              , SHs.ELam x.nameHint $
+                  go xs (IS <$> ys) (Var IZ wrapPtrConst : fmap succVar zs)
+              ]
+
+            PassByValue{} -> go xs ys (Var y False : zs)
+
+    -- | Construct an expression to pass the function result by address, if
+    -- necessary
+    --
+    -- For example:
+    --
+    -- > ... allocaAndPeek $ \z6 -> ...
+    --
+    -- We do this only if the function result requires restoration (see
+    -- 'requiresRestore')
+    --
+    passResultByAddressIfNecessary ::
+         -- | Context of in-scope variables to be passed to the foreign import
+         [(Var ctx)]
+         -- | Construct the body of the lambda
+      -> (forall ctx'. [Var ctx'] -> SHs.SExpr ctx')
+      -> SHs.SExpr ctx
+    passResultByAddressIfNecessary zs kont
+      | requiresRestore primResult
+      = let zs' = fmap succVar zs ++ [Var IZ False] in
+        SHs.EApp
+          (SHs.eBindgenGlobal Capi_allocaAndPeek)
+          (SHs.ELam (NameHint "res") $ kont zs')
+      | otherwise
+      = kont zs
+
+    -- | Construct a call to the foreign import
+    --
+    -- For example (@foo@ is the name of the foreign import):
+    --
+    -- > ... foo y4 x1 (unsafeFromPtr y5) x3 z6
+    --
+    callForeignImport ::
+         -- | Context of in-scope variables to be passed to the foreign import
+         [Var ctx]
+      -> SHs.SExpr ctx
+    callForeignImport args = SHs.eAppMany (SHs.EFree loName) (map exprVar args)
+
+{-------------------------------------------------------------------------------
+  Function arguments
+-------------------------------------------------------------------------------}
+
+-- | Information about a function argument
+data FunArg = FunArg {
+    typ        :: PassArgBy
+  , cParamName :: Maybe Text
+  , funParam   :: Hs.FunctionParameter Hs.Type
+  }
+
+funArgToVarInfo :: FunArg -> VarInfo
+funArgToVarInfo arg = VarInfo {
+      typ = arg.typ
+    , nameHint = toHint $ case arg.cParamName of
+        Nothing -> fallback
+        Just x  -> mangleCandidateDefaultFallback fallback x
+    }
+  where
+    fallback :: Hs.Name Hs.NsVar
+    fallback = Hs.UnsafeName $ case arg.typ of
+      PassByValue{}   -> "x"
+      PassByAddress{} -> "ptr"
+
+    toHint :: Hs.Name Hs.NsVar -> NameHint
+    toHint n = NameHint $ T.unpack n.text
+
+{-------------------------------------------------------------------------------
+  Variables
+-------------------------------------------------------------------------------}
+
+-- | A variable with some additional information
+type Var :: Ctx -> Type
+data Var ctx = Var {
+    -- | The name (i.e., DeBruijn index) of the variable
+    name :: Idx ctx
+    -- | Whether to wrap the variable in a 'HsBindgen.Runtime.PtrConst.PtrConst'
+    --
+    -- 'Foreign.Marshal.Utils.with' and 'HsBindgen.Runtime.IncompleteArray.allocaAndPeek' always use 'Foreign.Ptr.Ptr' rather than 'HsBindgen.Runtime.PtrConst.PtrConst', hence
+    -- the need to convert 'Foreign.Ptr.Ptr' to 'HsBindgen.Runtime.PtrConst.PtrConst' manually.
+  , wrapPtrConst :: Bool
+  }
+
+-- | Shift the variable
+succVar :: Var ctx -> Var (S ctx)
+succVar var = Var {
+      name = IS var.name
+    , wrapPtrConst = var.wrapPtrConst
+    }
+
+-- | Turn the variable into an expression
+--
+-- For example:
+--
+-- > unsafeFromPtr y5
+--
+exprVar :: Var ctx -> SHs.SExpr ctx
+exprVar var
+  | var.wrapPtrConst
+  = SHs.EApp (SHs.eBindgenGlobal PtrConst_unsafeFromPtr) (SHs.EBound var.name)
+  | otherwise
+  = SHs.EBound var.name
+
+{-------------------------------------------------------------------------------
+  Variable info
+-------------------------------------------------------------------------------}
+
+-- | Information for variables corresponding to function arguments
+data VarInfo = VarInfo {
+    typ      :: PassArgBy
+  , nameHint :: NameHint
+  }
+
+{-------------------------------------------------------------------------------
+  Environment
+-------------------------------------------------------------------------------}
+
+-- | Reverse an 'Env'
+reverseEnv :: forall ctx a. Env ctx a -> Env ctx a
+reverseEnv = \env -> go (lzeroAdd (sizeEnv env)) EmptyEnv env
+  where
+    go ::
+         forall ctx1 ctx2 ctx3.
+         -- | Proof that the output environment 's size is the same as the the
+         -- sum of the two input environment's sizes
+         Add ctx1 ctx2 ctx3
+         -- | Accumulator
+      -> Env ctx1 a
+         -- | Input to reverse
+      -> Env ctx2 a
+      -> Env ctx3 a
+    go proof acc EmptyEnv = case unrzeroAdd proof of
+        Refl -> acc
+    go proof acc (xs :> x) = go (swapAdd proof) (acc :> x) xs
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation/Instances.hs b/src-internal/HsBindgen/Backend/Hs/Translation/Instances.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation/Instances.hs
@@ -0,0 +1,252 @@
+-- | Instance resolution
+--
+-- Instance resolution as currently implemented in the backend is /not/ feature
+-- complete.  It does not take into account prescriptive binding specifications.
+-- One therefore cannot generate/derive an instance that is not
+-- generated/derived by default or use a non-default strategy, and it cannot
+-- generate instances with constraints.  Instance resolution will be implemented
+-- in a completely different way in the frontend to support these features,
+-- where problems may emit warnings or even drop declarations.
+module HsBindgen.Backend.Hs.Translation.Instances (
+    getCandidateInsts
+  , getDeriveStrat
+  , InstanceMap
+  , getInstances
+  ) where
+
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.BindingSpec
+import HsBindgen.Errors
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.Language.Haskell
+import HsBindgen.Language.Haskell qualified as Hs
+
+--------------------------------------------------------------------------------
+
+-- | Get candidate instances for instance resolution
+--
+-- This function returns all instances that /may/ be generated/derived for a
+-- type.
+getCandidateInsts ::
+     Map Inst.TypeClass Inst.SupportedStrategies
+  -> Set Inst.TypeClass
+getCandidateInsts supInsts = Set.fromList $ catMaybes [
+      clss <$ supStrats.defStrategy
+    | (clss, supStrats) <- Map.assocs supInsts
+    , supStrats.dependency == Inst.Dependent
+    ]
+
+getDeriveStrat :: Inst.SupportedStrategies -> Maybe (Hs.Strategy ty)
+getDeriveStrat supStrats = case supStrats.defStrategy of
+    Nothing             -> Nothing
+    Just Inst.HsBindgen -> Nothing
+    Just Inst.Newtype   -> Just Hs.DeriveNewtype
+    Just Inst.Stock     -> Just Hs.DeriveStock
+
+--------------------------------------------------------------------------------
+
+type InstanceMap = Map (Hs.Name NsTypeConstr) (Set Inst.TypeClass)
+
+getInstances ::
+     HasCallStack
+  => InstanceMap                  -- ^ Current state
+  -> Maybe (Hs.Name NsTypeConstr) -- ^ Name of current type (optional)
+  -> Set Inst.TypeClass           -- ^ Candidate instances
+  -> [Hs.Type]                    -- ^ Dependencies
+  -> Set Inst.TypeClass
+getInstances instanceMap name = aux
+  where
+    aux :: Set Inst.TypeClass -> [Hs.Type] -> Set Inst.TypeClass
+    aux acc [] = acc
+    aux acc (hsType:hsTypes)
+      | Set.null acc = acc
+      | otherwise = case hsType of
+          Hs.PrimType primType ->
+            aux (acc /\ getHsPrimTypeInsts primType) hsTypes
+          Hs.TypRef name' _
+            | Just name' == name -> aux acc hsTypes
+            | otherwise -> case Map.lookup name' instanceMap of
+                Just instances -> aux (acc /\ instances) hsTypes
+                Nothing -> panicPure $ "Type not found: " ++ show name'
+          Hs.ConstArray _n hsType' ->
+            -- TODO: instance resolution for 'IsArray' is currently
+            -- special-cased because for 'IsArray' instances we don't have to
+            -- check all dependencies. See issue #1739.
+            (if Inst.IsArray `Set.member` acc
+              then Set.insert Inst.IsArray
+              else id) $
+            -- constrain by ConstantArray item type in next step
+            aux (acc /\ cArrayInsts) $ hsType' : hsTypes
+          Hs.IncompleteArray hsType' ->
+            -- TODO: instance resolution for 'IsArray' is currently
+            -- special-cased because for 'IsArray' instances we don't have to
+            -- check all dependencies. See issue #1739.
+            (if Inst.IsArray `Set.member` acc
+              then Set.insert Inst.IsArray
+              else id) $
+            -- constrain by Array item type in next step
+            aux (acc /\ arrayInsts) $ hsType' : hsTypes
+          Hs.PtrArrayElem{} -> aux (acc /\ ptrInsts) hsTypes
+          Hs.PtrConstArrayElem{} -> aux (acc /\ ptrInsts) hsTypes
+          Hs.Ptr{} -> aux (acc /\ ptrInsts) hsTypes
+          Hs.FunPtr{} -> aux (acc /\ ptrInsts) hsTypes
+          Hs.PtrConst{} -> aux (acc /\ ptrInsts) hsTypes
+          Hs.IO t  -> aux (acc /\ ioInsts) (t : hsTypes)
+          Hs.Fun arg res -> aux (acc /\ funInsts) (arg : res : hsTypes)
+          Hs.ExtBinding _ref _cTypeSpec hsTypeSpec _ ->
+            let acc' = acc /\ hsTypeSpecInsts hsTypeSpec
+            in  aux acc' hsTypes
+          Hs.ByteArray{} ->
+            let acc' = acc /\ Set.fromList [Inst.Eq, Inst.Ord, Inst.Show]
+            in  aux acc' hsTypes
+          Hs.SizedByteArray{} ->
+            let acc' = acc /\ Set.fromList [Inst.Eq, Inst.Show]
+            in  aux acc' hsTypes
+          Hs.Block{} ->
+            aux (blockInsts /\ acc) (hsTypes)
+          Hs.ComplexType primType -> aux (acc /\ getHsPrimTypeInsts primType) hsTypes
+          Hs.StrLit{} -> Set.empty
+          -- TODO <https://github.com/well-typed/hs-bindgen/issues/1572>
+          -- Instances for 'WithFlam'.
+          Hs.WithFlam{} -> Set.empty
+          Hs.EquivStorable{} -> Set.empty
+          Hs.IsStructViaReadRaw{} -> Set.empty
+
+    (/\) :: Ord a => Set a -> Set a -> Set a
+    (/\) = Set.intersection
+
+    ioInsts :: Set Inst.TypeClass
+    ioInsts = Set.empty
+
+    funInsts :: Set Inst.TypeClass
+    funInsts = Set.empty
+
+    blockInsts :: Set Inst.TypeClass
+    blockInsts = Set.singleton Inst.HasFFIType
+
+    ptrInsts :: Set Inst.TypeClass
+    ptrInsts = Set.fromList [
+        Inst.Eq
+      , Inst.HasFFIType
+      , Inst.Ord
+      , Inst.ReadRaw
+      , Inst.Show
+      , Inst.StaticSize
+      , Inst.Storable
+      , Inst.WriteRaw
+      ]
+
+    cArrayInsts :: Set Inst.TypeClass
+    cArrayInsts = Set.fromList [
+        Inst.Eq
+      , Inst.ReadRaw
+      , Inst.Show
+      , Inst.StaticSize
+      , Inst.Storable
+      , Inst.WriteRaw
+      ]
+
+    arrayInsts :: Set Inst.TypeClass
+    arrayInsts = Set.fromList [
+        Inst.Eq
+      , Inst.Show
+      ]
+
+    hsTypeSpecInsts :: HsTypeSpec -> Set Inst.TypeClass
+    hsTypeSpecInsts hsTypeSpec = Set.fromAscList [
+        cls
+      | (cls, Require{}) <- Map.toAscList hsTypeSpec.instances
+      ]
+
+getHsPrimTypeInsts :: Hs.PrimType -> Set Inst.TypeClass
+getHsPrimTypeInsts = \case
+    Hs.PrimVoid    -> voidInsts
+    Hs.PrimUnit    -> unitInsts
+    Hs.PrimInt     -> integralInsts
+    Hs.PrimCChar   -> integralInsts
+    Hs.PrimCSChar  -> integralInsts
+    Hs.PrimCUChar  -> integralInsts
+    Hs.PrimCShort  -> integralInsts
+    Hs.PrimCUShort -> integralInsts
+    Hs.PrimCInt    -> integralInsts
+    Hs.PrimCUInt   -> integralInsts
+    Hs.PrimCLong   -> integralInsts
+    Hs.PrimCULong  -> integralInsts
+    Hs.PrimCLLong  -> integralInsts
+    Hs.PrimCULLong -> integralInsts
+    Hs.PrimCBool   -> integralInsts
+    Hs.PrimCFloat  -> floatingInsts
+    Hs.PrimCDouble -> floatingInsts
+  where
+    floatingInsts :: Set Inst.TypeClass
+    floatingInsts = Set.fromList [
+        Inst.Enum
+      , Inst.Eq
+      , Inst.Floating
+      , Inst.Fractional
+      , Inst.HasFFIType
+      , Inst.Num
+      , Inst.Ord
+      , Inst.Prim
+      , Inst.Read
+      , Inst.ReadRaw
+      , Inst.Real
+      , Inst.RealFloat
+      , Inst.RealFrac
+      , Inst.Show
+      , Inst.StaticSize
+      , Inst.Storable
+      , Inst.WriteRaw
+      ]
+
+    integralInsts :: Set Inst.TypeClass
+    integralInsts = Set.fromList [
+        Inst.Bitfield
+      , Inst.Bits
+      , Inst.Bounded
+      , Inst.Enum
+      , Inst.Eq
+      , Inst.FiniteBits
+      , Inst.HasFFIType
+      , Inst.Integral
+      , Inst.Ix
+      , Inst.Num
+      , Inst.Ord
+      , Inst.Prim
+      , Inst.Read
+      , Inst.ReadRaw
+      , Inst.Real
+      , Inst.Show
+      , Inst.StaticSize
+      , Inst.Storable
+      , Inst.WriteRaw
+      ]
+
+    unitInsts :: Set Inst.TypeClass
+    unitInsts = Set.fromList [
+        Inst.Eq
+      , Inst.Generic
+      , Inst.HasFFIType
+      , Inst.Ord
+      , Inst.Read
+      , Inst.ReadRaw
+      , Inst.Show
+      , Inst.StaticSize
+      , Inst.Storable
+      , Inst.WriteRaw
+      ]
+
+    voidInsts :: Set Inst.TypeClass
+    voidInsts = Set.fromList [
+        Inst.Eq
+      , Inst.Generic
+      , Inst.Ix
+      , Inst.Ord
+      , Inst.Read
+      , Inst.Show
+      ]
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation/Monad.hs b/src-internal/HsBindgen/Backend/Hs/Translation/Monad.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation/Monad.hs
@@ -0,0 +1,190 @@
+-- |
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Backend.Hs.Translation.Monad (HsM)
+-- > import HsBindgen.Backend.Hs.Translation.Monad qualified as HsM
+--
+module HsBindgen.Backend.Hs.Translation.Monad (
+    HsM
+  , runHsM
+  , St(..)
+  , initSt
+  , Env(..)
+  , initEnv
+    -- * Actions with optional delays
+    -- $actions
+  , Action
+  , runAction
+  , immediate
+  , immediateM
+  , delayM
+  , concatSequence
+  ) where
+
+import Control.Monad.Reader
+import Control.Monad.State.Lazy
+import Data.Map.Strict qualified as Map
+
+import HsBindgen.Backend.Hs.Translation.Instances
+import HsBindgen.Config.Prelims
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+
+newtype HsM a = HsM (ReaderT Env (State St) a)
+  deriving newtype (Functor, Applicative, Monad)
+  deriving newtype (MonadState St)
+  deriving newtype (MonadReader Env)
+
+runHsM ::
+     Env
+  -> HsM a
+  -> a
+runHsM env (HsM m) =
+    evalState (runReaderT m env) initSt
+
+data St = St {
+      instanceMap :: InstanceMap
+    }
+  deriving stock (Generic)
+
+initSt :: St
+initSt = St Map.empty
+
+data Env = Env {
+    uniqueId           :: UniqueId
+  , baseModuleName     :: BaseModuleName
+  , supportedInstances :: Inst.SupportedInstances
+  }
+
+initEnv ::
+     UniqueId
+  -> BaseModuleName
+  -> Inst.SupportedInstances
+  -> Env
+initEnv uniqueId baseModuleName supportedInstances =
+    Env {
+        uniqueId = uniqueId
+      , baseModuleName = baseModuleName
+      , supportedInstances = supportedInstances
+      }
+
+{-------------------------------------------------------------------------------
+  Actions with optional delays
+-------------------------------------------------------------------------------}
+
+{- $actions
+
+Normally in the @Backend.Hs@ translation step, an action in the t'HsM' monad can
+be immediately executed with possible side effects as a result. There is one
+exception where we want to delay actions as long as possible: when we generate
+auxiliary newtypes for function pointer types.
+
+Normally for @typedef@s we will generate a single @newtype@ of the same name.
+For @typedef@s of function pointers, we generate an additional auxiliary
+@newtype@ for utility purposes. For example, if we have this C code:
+
+> typedef int T;
+> typedef void (*F)(T);
+
+Then we will generate *one* typedef for @T@, and *two* @newtype@s for @F@:
+
+> newtype T = T CInt
+> newtype F_Aux = F_Aux (T -> IO ())
+> newtype F = F (FunPtr F_Aux)
+
+For each of these newtypes we may define\/derive type class instances, and these
+type classes might have dependencies. In the example above, we have one
+dependency:
+
+* @F_Aux@ depends on @T@ by value
+
+It is important that we process @T@ before @F_Aux@ so that we have resolved (and
+cached) type class instances for @T@ before we try to resolve type instances
+class instances for @F_Aux@. It is not important when @F@ is processed because
+it has no by-value dependencies on @F_Aux@ or @T@.
+
+The tricky bit here is that @F_Aux@ is not represented in the C AST; we only
+generate the @newtype@ in the backend. As such, @F_Aux@ is not taken into
+account when deciding the order in which C declarations should be processed. We
+process @F_Aux@ when @F@ is processed, and @F@ might be processed before @T@.
+When @F@ is processed before @T@, we can see panics.
+
+The solution is this: we make a distinction between actions we want to execute
+immediately and ones we want to delay until the end of the @Backend.Hs@
+translation step. The t'HsBindgen.Backend.Hs.Translation.State.Action' abstraction is used for this distinction.
+
+Very crudely, we could process @F@ and @F_Aux@ before @T@ as long as we delay
+side effects of processing @F_Aux@ until after @T@ is processed. In pseudo-code:
+
+> example = do
+>     x <- immediateM processF     {- compute side effects -}
+>     y <- delayM     processF_Aux {- delay side effects   -}
+>     z <- immediateM processT     {- compute side effects -}
+>     mapM runAction [
+>         x {- no additional side effects -}
+>       , y {- compute delayed side effects -}
+>       , z {- no additional side effects -}
+>       ]
+
+To achieve the same goal, we could have used a different abstraction than
+t'HsBindgen.Backend.Hs.Translation.State.Action'. For example, we could have stored a list of t'HsM' actions in
+t'HsBindgen.Backend.Hs.Translation.State.TranslationState' to be computed at the very end of the @Backend.Hs@
+translation step. However, this would cause @_Aux@ newtypes to be rendered at
+the very end of Haskell bindings. t'HsBindgen.Backend.Hs.Translation.State.Action' does not have this downside.
+
+NOTE: Right now the only use case for the t'HsBindgen.Backend.Hs.Translation.State.Action' abstraction is auxiliary
+@newtype@s for function pointers. If there are other use cases in the future,
+then its use might become convoluted and hard to maintain. At that point, it
+might be worth looking into replacing the t'HsBindgen.Backend.Hs.Translation.State.Action' abstraction with a proper
+sorting phase that takes dependencies between Haskell declarations (like
+auxiliary @newtype@s) into account.
+-}
+
+-- | An action that is run in the t'HsM' monad.
+--
+-- There are two types of actions:
+--
+-- * immediate ('immediateM'): side-effects are performed immediately, and the
+--   result value can be accessed using 'runAction'.
+--
+-- * delayed ('delayM'): side-effects are postponed until the result value is
+--   accessed using 'runAction'.
+--
+-- Actions are composable using 'Functor', 'Applicative', and 'Monad'.
+newtype Action a = Action (HsM a)
+  deriving newtype (Functor, Applicative, Monad)
+
+-- | Access the result value of an action.
+--
+-- This performs delayed side-effects, if there are any.
+runAction :: Action a -> HsM a
+runAction (Action k) = k
+
+-- | Create an immediate action that has no side-effects.
+--
+-- The result value can be accessed using 'runAction'.
+--
+immediate :: a -> Action a
+immediate x = pure x
+
+-- | Create an immediate action
+--
+-- Side-effects are performed immediately, and the result value can be accessed
+-- using 'runAction'.
+--
+immediateM :: HsM a -> HsM (Action a)
+immediateM action = do
+    x <- action
+    pure $ pure x
+
+-- | Create a delayed action
+--
+-- Side-effects are postponed until the result value is accessed using
+-- 'runAction'.
+--
+delayM :: HsM a -> HsM (Action a)
+delayM action = pure $ Action action
+
+concatSequence :: [Action [a]] -> Action [a]
+concatSequence = fmap concat . sequence
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation/Newtype.hs b/src-internal/HsBindgen/Backend/Hs/Translation/Newtype.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation/Newtype.hs
@@ -0,0 +1,167 @@
+module HsBindgen.Backend.Hs.Translation.Newtype (
+    newtypeDec
+  , hasFFITypeDecs
+  , hasFieldCompatDecs
+  , hasFieldPtrDecs
+  ) where
+
+import Control.Monad.State qualified as State
+import Data.Map.Strict qualified as Map
+
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Origin qualified as Origin
+import HsBindgen.Backend.Hs.Translation.ForeignImport qualified as Hs
+import HsBindgen.Backend.Hs.Translation.Instances qualified as Hs
+import HsBindgen.Backend.Hs.Translation.Monad (HsM)
+import HsBindgen.Backend.Hs.Translation.Monad qualified as HsM
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.Language.Haskell qualified as Hs
+
+-- | Smart constructor for creating a 'Hs.Newtype'
+newtypeDec ::
+     HasCallStack
+  => Hs.Name Hs.NsTypeConstr
+  -> Hs.Name Hs.NsConstr
+  -> Hs.Field
+  -> Origin.Decl Origin.Newtype
+  -> Maybe HsDoc.Comment
+  -> Set Inst.TypeClass -- ^ Candidate instances
+  -> Set Inst.TypeClass -- ^ Known instances
+  -> HsM Hs.Newtype
+newtypeDec name constr field orig comment candidateInsts knownInsts = do
+    hsNewtype <- aux <$> State.get
+    State.modify' $ #instanceMap %~ Map.insert hsNewtype.name hsNewtype.instances
+    pure hsNewtype
+  where
+    aux :: HsM.St -> Hs.Newtype
+    aux transState = Hs.Newtype {
+            name      = name
+          , constr    = constr
+          , ffiType   = ffiType
+          , field     = field
+          , origin    = orig
+          , instances = insts
+          , comment   = comment
+          }
+      where
+        resolvedInsts :: Set Inst.TypeClass
+        resolvedInsts =
+          Hs.getInstances
+            transState.instanceMap
+            (Just name)
+            candidateInsts
+            [field.typ]
+
+        insts :: Set Inst.TypeClass
+        insts = knownInsts <> resolvedInsts
+
+        ffiType :: Maybe BindingSpec.HsFFIType
+        ffiType = BindingSpec.HsFFIType . Hs.ffiExtRef <$> Hs.toFFIType field.typ
+
+hasFFITypeDecs ::
+     Hs.Newtype
+  -> [Hs.Decl l]
+hasFFITypeDecs nt =
+    [mk | Inst.HasFFIType `elem` nt.instances]
+  where
+    mk :: Hs.Decl l
+    mk = Hs.DeclDeriveInstance Hs.DeriveInstance{
+          strategy = Hs.DeriveNewtype
+        , clss     = Inst.HasFFIType
+        , name     = nt.name
+        , comment  = Nothing
+        }
+
+{-------------------------------------------------------------------------------
+  HasField
+-------------------------------------------------------------------------------}
+
+-- | Class instances for 'GHC.Records.Compat.HasField'
+--
+-- Given a generated newtype (for a @typedef@, @enum@, or macro type):
+--
+-- > newtype MyType = MyType { unwrapMyType :: CInt }
+--
+-- GHC automatically generates 'GHC.Records.HasField' instances for the
+-- @unwrapMyType@ field.
+--
+-- 'hasFieldCompatDecs' will generate roughly the following class instances:
+--
+-- > instance GHC.Records.Compat.HasField "unwrapMyType" MyType CInt
+--
+hasFieldCompatDecs :: Hs.Newtype -> [Hs.Decl l]
+hasFieldCompatDecs nt =
+    [ Hs.DeclDefineInstance $
+        Hs.DefineInstance {
+              comment      = Nothing
+            , instanceDecl = Hs.InstanceHasFieldCompat hasFieldCompatDecl
+            }
+    | Inst.HasFieldCompat `elem` nt.instances
+    ]
+  where
+    parentType :: Hs.Type
+    parentType = Hs.TypRef nt.name (Just nt.field.typ)
+
+    hasFieldCompatDecl :: Hs.HasFieldCompatInstance
+    hasFieldCompatDecl = Hs.HasFieldCompatInstance {
+          parentType  = parentType
+        , fieldName   = nt.field.name
+        , fieldType   = nt.field.typ
+        , impl = Hs.HasFieldCompatImplRecord {
+              otherFields = []
+            , constr = nt.constr
+            }
+        }
+
+-- | Class instances for 'GHC.Records.HasField' for the pointer manipulation API
+--
+-- Given a generated newtype (for a @typedef@, @enum@, or macro type):
+--
+-- > newtype MyType = MyType { unwrapMyType :: CInt }
+--
+-- 'hasFieldPtrDecs' will generate roughly the following class instances:
+--
+-- > instance HasCField "unwrapMyType" MyType where
+-- >   type CFieldType "unwrapMyType" MyType = CInt
+-- > instance GHC.Records.HasField "unwrapMyType" (Ptr MyType) (Ptr CInt)
+--
+hasFieldPtrDecs :: Hs.Newtype -> [Hs.Decl l]
+hasFieldPtrDecs nt = concat [
+      [ Hs.DeclDefineInstance $
+          Hs.DefineInstance {
+              comment      = Nothing
+            , instanceDecl = Hs.InstanceHasFieldPtr hasFieldPtrDecl
+            }
+      | Inst.HasFieldPtr `elem` nt.instances
+      ]
+    , [ Hs.DeclDefineInstance $
+          Hs.DefineInstance {
+              comment      = Nothing
+            , instanceDecl = Hs.InstanceHasCField hasCFieldDecl
+            }
+      | Inst.HasCField `elem` nt.instances
+      ]
+    ]
+  where
+    parentType :: Hs.Type
+    parentType = Hs.TypRef nt.name (Just nt.field.typ)
+
+    hasFieldPtrDecl :: Hs.HasFieldPtrInstance
+    hasFieldPtrDecl = Hs.HasFieldPtrInstance{
+          parentType = parentType
+        , fieldName  = nt.field.name
+        , fieldType  = nt.field.typ
+        , deriveVia  = Hs.ViaHasCField
+        }
+
+    hasCFieldDecl :: Hs.HasCFieldInstance
+    hasCFieldDecl = Hs.HasCFieldInstance{
+          parentType  = parentType
+        , fieldName   = nt.field.name
+        , cFieldType  = nt.field.typ
+        , fieldOffset = 0
+        }
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation/Structure.hs b/src-internal/HsBindgen/Backend/Hs/Translation/Structure.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation/Structure.hs
@@ -0,0 +1,539 @@
+{-# LANGUAGE NamedFieldPuns #-}
+
+module HsBindgen.Backend.Hs.Translation.Structure (
+    structDecs
+  ) where
+
+import Control.Monad.Reader qualified as Reader
+import Control.Monad.State qualified as State hiding (MonadState)
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+import Data.Text qualified as Text
+import Data.Vec.Lazy qualified as Vec
+import DeBruijn (EmptyCtx, Idx (..), Weaken (..), pattern I1)
+
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Haddock.Translation
+import HsBindgen.Backend.Hs.Origin qualified as Origin
+import HsBindgen.Backend.Hs.Translation.Field
+import HsBindgen.Backend.Hs.Translation.Instances qualified as Hs
+import HsBindgen.Backend.Hs.Translation.Monad (HsM)
+import HsBindgen.Backend.Hs.Translation.Monad qualified as HsM
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.NameHint
+
+-- | Generate declarations for given C struct
+structDecs ::
+     C.DeclInfo Final
+  -> C.Struct Final
+  -> PrescriptiveDeclSpec
+  -> HsM [Hs.Decl l]
+structDecs info struct spec = do
+    case struct.flam of
+      C.NoFlam ->
+        getDeclsRegular spec info struct
+      C.Flam flam flamNames ->
+        getDeclsFlam flam flamNames.aux spec info struct
+
+getDeclsRegular ::
+     HasCallStack
+  => PrescriptiveDeclSpec
+  -> C.DeclInfo Final
+  -> C.Struct Final
+  -> HsM [Hs.Decl l]
+getDeclsRegular spec info struct = do
+    env <- Reader.ask
+    let supInsts = env.supportedInstances.struct
+    insts <-
+      getInstances supInsts name struct.fields <$> State.gets (.instanceMap)
+    let insts' = Set.insert Inst.Generic insts
+        (hsStruct, decls) =
+          getDecls supInsts spec name info struct insts'
+    State.modify' $ #instanceMap %~ Map.insert name hsStruct.instances
+    pure $ Hs.DeclData hsStruct : decls
+  where
+    name :: Hs.Name Hs.NsTypeConstr
+    name = Hs.assertNs (Proxy @Hs.NsTypeConstr) info.id.hsName
+
+getDeclsFlam ::
+     HasCallStack
+  => C.RegularField Final
+  -> Hs.Name Hs.NsTypeConstr -- ^ Auxiliary type-constructor name
+  -> PrescriptiveDeclSpec
+  -> C.DeclInfo Final
+  -> C.Struct Final
+  -> HsM [Hs.Decl l]
+getDeclsFlam flam auxName spec info struct = do
+    env <- Reader.ask
+    let supInsts = env.supportedInstances.struct
+    insts <-
+      getInstances supInsts auxName struct.fields <$> State.gets (.instanceMap)
+    let insts' = insts <> Set.fromList [Inst.Flam_Offset, Inst.Generic]
+        (hsStruct, decls) =
+          getDecls supInsts spec auxName info struct insts'
+    State.modify' $ #instanceMap %~ Map.insert auxName hsStruct.instances
+    pure $ Hs.DeclData hsStruct : decls ++ [getHasFlamInstanceDecl hsStruct, flamDecl]
+  where
+    name :: Hs.Name Hs.NsTypeConstr
+    name = Hs.assertNs (Proxy @Hs.NsTypeConstr) info.id.hsName
+
+    getHasFlamInstanceDecl :: Hs.Struct -> Hs.Decl l
+    getHasFlamInstanceDecl hsStruct =
+      Hs.DeclDefineInstance
+        Hs.DefineInstance{
+            comment      = Nothing
+          , instanceDecl =
+              Hs.InstanceHasFlam hsStruct $
+                Hs.HasFlamInstance flam.typ.hs (flam.offset `div` 8)
+          }
+
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/1760>
+    -- We generate pointer manipulation bindings for the FLAM field.
+    flamDecl :: Hs.Decl l
+    flamDecl =
+      Hs.DeclTypSyn
+        Hs.TypSyn{
+            name
+          , typ     =
+              Hs.WithFlam flam.typ.hs (Hs.TypRef auxName Nothing)
+          , origin  = Origin.Decl{
+              info = info
+            , kind = Origin.Opaque info.id.cName.name.kind
+            , spec = spec
+            }
+          , comment = mkHaddocks info
+          }
+
+getInstances ::
+     Map Inst.TypeClass Inst.SupportedStrategies
+  -> Hs.Name Hs.NsTypeConstr
+  -> [C.Field Final]
+  -> Hs.InstanceMap
+  -> Set Inst.TypeClass
+getInstances supInsts structName fields instanceMap =
+    Hs.getInstances instanceMap (Just structName) candidateInsts fieldTypes
+  where
+    fieldTypes :: [Hs.Type]
+    fieldTypes = (.typ.hs) <$> fields
+
+    candidateInsts :: Set Inst.TypeClass
+    candidateInsts = Hs.getCandidateInsts supInsts
+
+getDecls ::
+     Map Inst.TypeClass Inst.SupportedStrategies
+  -> PrescriptiveDeclSpec
+  -> Hs.Name Hs.NsTypeConstr
+  -> C.DeclInfo Final
+  -> C.Struct Final
+  -> Set Inst.TypeClass
+  -> (Hs.Struct, [Hs.Decl l])
+getDecls supInsts spec structName info struct insts =
+    ( hsStruct
+    , marshalDecls ++ optDecls ++ isStructDecl ++ fieldDecls
+    )
+  where
+    fieldName :: C.Field Final -> Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) . (.info.name.hsName)
+
+    getHsField :: C.Field Final -> Hs.Field
+    getHsField field =
+        Hs.Field {
+            name    = fieldName field
+          , typ     = field.typ.hs
+          , origin  = Origin.StructField field
+          , comment = mkHaddocksFieldInfo info field.info
+          }
+
+    fieldHint :: C.Field Final -> NameHint
+    fieldHint = toNameHint . fieldName
+
+    -- Build @\ptr s -> case s of Constr f0 f1 ... -> do { f f0; f f1; ... }@,
+    -- shared between 'writeRaw' and 'poke'.
+    elimFieldsLambda ::
+         (forall ctx. Idx ctx -> C.Field Final -> Idx ctx -> a ctx)
+      -> Hs.Lambda (Hs.Lambda (Hs.ElimStruct (Hs.Seq a))) EmptyCtx
+    elimFieldsLambda mkField =
+        Hs.Lambda (NameHint "ptr") $ Hs.Lambda (NameHint "s") $
+          Vec.reifyList struct.fields $ \fieldsVec ->
+            Hs.makeElimStruct IZ hsStruct.constr (fmap fieldHint fieldsVec) $
+              \wk xs -> Hs.Seq $ Vec.toList $
+                Vec.zipWith (mkField (weaken wk I1)) fieldsVec xs
+
+    hsStruct :: Hs.Struct
+    hsStruct = Hs.Struct {
+          name      = structName
+        , constr    = struct.names.constr
+        , fields    = map getHsField struct.fields
+        , instances = insts <> knownInsts
+        , comment   = mkHaddocks info
+        , origin    = Just Origin.Decl{
+              info
+            , kind = Origin.Struct struct
+            , spec
+            }
+        }
+
+    marshalDecls :: [Hs.Decl l]
+    marshalDecls =
+      let hasStaticSize = Inst.StaticSize `Set.member` insts
+          hasReadRaw    = Inst.ReadRaw    `Set.member` insts
+          hasWriteRaw   = Inst.WriteRaw   `Set.member` insts
+          hasStorable   = Inst.Storable   `Set.member` insts
+          justWhen p x  = if p then Just x else Nothing
+      in  catMaybes [
+              justWhen hasStaticSize $
+                Hs.DeclDefineInstance Hs.DefineInstance{
+                    comment      = Nothing
+                  , instanceDecl =
+                      Hs.InstanceStaticSize structName Hs.StaticSizeInstance{
+                          staticSizeOf    = struct.sizeof
+                        , staticAlignment = struct.alignment
+                        }
+                  }
+            , justWhen hasReadRaw $
+                Hs.DeclDefineInstance Hs.DefineInstance{
+                    comment      = Nothing
+                  , instanceDecl =
+                      Hs.InstanceReadRaw hsStruct Hs.ReadRawInstance{
+                          readRaw = Hs.Lambda (NameHint "ptr") $
+                            Hs.Ap (Hs.StructCon hsStruct) $
+                              map (readRawField IZ) struct.fields
+                        }
+                  }
+            , justWhen hasWriteRaw $
+                Hs.DeclDefineInstance Hs.DefineInstance{
+                    comment      = Nothing
+                  , instanceDecl =
+                      Hs.InstanceWriteRaw hsStruct Hs.WriteRawInstance{
+                          writeRaw = elimFieldsLambda writeRawField
+                        }
+                  }
+            , if hasStaticSize && hasReadRaw && hasWriteRaw
+                then Just $ Hs.DeclDeriveInstance Hs.DeriveInstance{
+                    strategy = Hs.DeriveVia (Hs.EquivStorable (Hs.TypRef structName Nothing))
+                  , clss     = Inst.Storable
+                  , name     = structName
+                  , comment  = Nothing
+                  }
+                else justWhen hasStorable $
+                  Hs.DeclDefineInstance Hs.DefineInstance {
+                      comment      = Nothing
+                    , instanceDecl = Hs.InstanceStorable hsStruct Hs.StorableInstance{
+                          sizeOf    = struct.sizeof
+                        , alignment = struct.alignment
+                        , peek      = Hs.Lambda (NameHint "ptr") $
+                            Hs.Ap (Hs.StructCon hsStruct) $
+                              map (peekField IZ) struct.fields
+                        , poke      = elimFieldsLambda pokeField
+                        }
+                    }
+            ]
+
+    optDecls :: [Hs.Decl l]
+    optDecls = catMaybes [
+        case Hs.getDeriveStrat supStrats of
+          Nothing    -> Nothing
+          Just strat -> Just $ Hs.DeclDeriveInstance Hs.DeriveInstance{
+              name     = structName
+            , clss     = clss
+            , strategy = strat
+            , comment  = Nothing
+            }
+      | (clss, supStrats) <- Map.assocs supInsts
+      , clss `Set.member` insts
+      ]
+
+    fieldDecls :: [Hs.Decl l]
+    fieldDecls = flip concatMap (flattenFields struct.fields) $ \field -> concat [
+          hasFieldDecs info hsStruct field
+        , hasFieldCompatDecs info hsStruct field
+        , hasFieldPtrDecs hsStruct field
+        , hasCFieldDecs hsStruct field
+        , hasCBitfieldDecs hsStruct field
+        ]
+
+    isStructDecl :: [Hs.Decl l]
+    isStructDecl = [
+          Hs.DeclDeriveInstance Hs.DeriveInstance{
+              strategy = Hs.DeriveVia (Hs.IsStructViaReadRaw (Hs.TypRef hsStruct.name Nothing))
+            , clss     = Inst.IsStruct
+            , name     = hsStruct.name
+            , comment  = Nothing
+            }
+        | Inst.IsStruct `elem` hsStruct.instances
+        ]
+
+    knownInsts :: Set Inst.TypeClass
+    knownInsts = Set.fromList $ catMaybes [
+        -- A struct with only non-bit-fields trivially satisfies
+        -- 'Inst.HasCBitfield', but we omit such trivial instances as not to
+        -- confuse the user.
+        if any (isJust . (.width)) struct.fields
+          then Just Inst.HasCBitfield
+          else Nothing
+        -- A struct with only bit-fields trivially satisfies 'Inst.HasCField',
+        -- but we omit such trivial instances as not to confuse the user.
+      , if any (isNothing . (.width)) struct.fields
+          then Just Inst.HasCField
+          else Nothing
+      , if null struct.fields then Nothing else Just Inst.HasField
+      , if null struct.fields then Nothing else Just Inst.HasFieldPtr
+      , if null struct.fields then Nothing else Just Inst.HasFieldCompat
+        -- TODO <https://github.com/well-typed/hs-bindgen/issues/1447>: this is
+        -- actually not a "known" instance because it has a superclass
+        -- constraint, but the backend instance resolution isn't strong enough
+        -- to resolve this for us
+      , if Inst.ReadRaw `elem` insts && Inst.StaticSize `elem` insts
+          then Just Inst.IsStruct else Nothing
+      ]
+
+{-------------------------------------------------------------------------------
+  HasField
+-------------------------------------------------------------------------------}
+
+-- | Class instances for 'GHC.Records.HasField'
+hasFieldDecs ::
+     C.DeclInfo Final
+  -> Hs.Struct
+  -> Field
+  -> [Hs.Decl l]
+hasFieldDecs info struct field = case field of
+    -- Regular and implicit fields are translated to Haskell record datatype
+    -- fields, so they get @HasField@ instances
+    RegularField  _ -> []
+    ImplicitField _ -> []
+    -- Indirect fields are not translated to Haskell record datatype fields, so
+    -- they get custom @HasField@ instances composed from existing @HasField@
+    -- instances
+    IndirectField impField indField -> auxIndirectField impField indField
+  where
+    fieldComment :: Maybe HsDoc.Comment
+    fieldComment = mkHaddocksFieldInfo info (getFieldInfo field)
+
+    parentType :: Hs.Type
+    parentType = Hs.TypRef struct.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    auxIndirectField :: C.ImplicitField Final -> C.IndirectField Final -> [Hs.Decl l]
+    auxIndirectField impField indField = [
+          Hs.DeclDefineInstance $
+            Hs.DefineInstance {
+                comment      = fieldComment
+              , instanceDecl = Hs.InstanceHasField decl
+              }
+        | Inst.HasField `elem` struct.instances
+        ]
+      where
+        decl :: Hs.HasFieldInstance
+        decl = Hs.HasFieldInstance {
+              parentType = parentType
+            , fieldName  = fieldName
+            , fieldType  = fieldType
+            , impl = impl
+            }
+
+        impl :: Hs.HasFieldImpl
+        impl = Hs.HasFieldImplIndirect {
+              nameTopToAnon = Hs.assertNs (Proxy @Hs.NsVar) impField.info.name.hsName
+            , nameAnonToTarget = Hs.assertNs (Proxy @Hs.NsVar) indField.ann.fieldNameInAnon.hsName
+            }
+
+-- | Class instances for 'GHC.Records.Compat.HasField'
+hasFieldCompatDecs ::
+     C.DeclInfo Final
+  -> Hs.Struct
+  -> Field
+  -> [Hs.Decl l]
+hasFieldCompatDecs info struct field = [
+      Hs.DeclDefineInstance $
+        Hs.DefineInstance {
+            comment      = fieldComment
+          , instanceDecl = Hs.InstanceHasFieldCompat decl
+          }
+    | Inst.HasFieldCompat `elem` struct.instances
+    ]
+  where
+    fieldComment :: Maybe HsDoc.Comment
+    fieldComment = mkHaddocksFieldInfo info (getFieldInfo field)
+
+    parentType :: Hs.Type
+    parentType = Hs.TypRef struct.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    decl :: Hs.HasFieldCompatInstance
+    decl = Hs.HasFieldCompatInstance {
+          parentType = parentType
+        , fieldName  = fieldName
+        , fieldType  = fieldType
+        , impl = impl
+        }
+
+    impl, implRecord :: Hs.HasFieldCompatImpl
+    impl = case field of
+            RegularField  _ -> implRecord
+            ImplicitField _ -> implRecord
+            IndirectField impF indF -> implIndirect impF indF
+
+    implRecord = Hs.HasFieldCompatImplRecord {
+          otherFields = otherFields
+        , constr = struct.constr
+        }
+      where
+        -- All fields that are /not/ the field we are creating an instance for
+        -- should stay unmodified
+        otherFields = flip mapMaybe struct.fields $ \field' ->
+            let fieldName' = field'.name in
+            if fieldName == fieldName' then Nothing else Just fieldName'
+
+    implIndirect :: C.ImplicitField Final -> C.IndirectField Final -> Hs.HasFieldCompatImpl
+    implIndirect impField indField = Hs.HasFieldCompatImplIndirect {
+          nameTopToAnon = Hs.assertNs (Proxy @Hs.NsVar) impField.info.name.hsName
+        , nameAnonToTarget = Hs.assertNs (Proxy @Hs.NsVar) indField.ann.fieldNameInAnon.hsName
+        }
+
+-- | Class instances for 'GHC.Records.HasField' for the pointer manipulation API
+hasFieldPtrDecs :: Hs.Struct -> Field -> [Hs.Decl l]
+hasFieldPtrDecs struct field =
+    [ Hs.DeclDefineInstance $
+        Hs.DefineInstance {
+            comment      = Nothing
+          , instanceDecl = Hs.InstanceHasFieldPtr hasFieldPtrDecl
+          }
+    | Inst.HasFieldPtr `elem` struct.instances
+    ]
+  where
+    parentType :: Hs.Type
+    parentType = Hs.TypRef struct.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    hasFieldPtrDecl :: Hs.HasFieldPtrInstance
+    hasFieldPtrDecl = Hs.HasFieldPtrInstance {
+          parentType = parentType
+        , fieldName  = fieldName
+        , fieldType  = fieldType
+        , deriveVia  =
+            case getFieldWidth field of
+              Nothing -> Hs.ViaHasCField
+              Just _  -> Hs.ViaHasCBitfield
+        }
+
+-- | Class instances for 'HsBindgen.Runtime.HasCField.HasCField'
+hasCFieldDecs :: Hs.Struct -> Field -> [Hs.Decl l]
+hasCFieldDecs struct field = case getFieldWidth field of
+    Just _w -> []
+    Nothing ->
+      [ Hs.DeclDefineInstance $
+          Hs.DefineInstance {
+              comment      = Nothing
+            , instanceDecl = Hs.InstanceHasCField decl
+            }
+      | Inst.HasCField `elem` struct.instances
+      ]
+  where
+    parentType :: Hs.Type
+    parentType = Hs.TypRef struct.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    decl :: Hs.HasCFieldInstance
+    decl = Hs.HasCFieldInstance {
+          parentType  = parentType
+        , fieldName   = fieldName
+        , cFieldType  = fieldType
+        , fieldOffset = getFieldOffset field `div` 8
+        }
+
+-- | Class instances for 'HsBindgen.Runtime.HasCBitfield.HasCBitfield'
+hasCBitfieldDecs :: Hs.Struct -> Field -> [Hs.Decl l]
+hasCBitfieldDecs struct field = case getFieldWidth field of
+    Nothing -> []
+    Just w ->
+      [ Hs.DeclDefineInstance $
+          Hs.DefineInstance {
+              comment      = Nothing
+            , instanceDecl = Hs.InstanceHasCBitfield $ decl w
+            }
+      | Inst.HasCBitfield `elem` struct.instances
+      ]
+  where
+    parentType :: Hs.Type
+    parentType = Hs.TypRef struct.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    decl :: Int -> Hs.HasCBitfieldInstance
+    decl w = Hs.HasCBitfieldInstance {
+          parentType    = parentType
+        , fieldName     = fieldName
+        , cBitfieldType = fieldType
+        , bitOffset     = getFieldOffset field
+        , bitWidth      = w
+        }
+
+{-------------------------------------------------------------------------------
+  Field I\/O
+-------------------------------------------------------------------------------}
+
+peekField :: Idx ctx -> C.Field Final -> Hs.PeekCField ctx
+peekField ptr field = case field.width of
+    Nothing -> Hs.PeekCField    (Hs.StrLit name) ptr
+    Just _w -> Hs.PeekCBitfield (Hs.StrLit name) ptr
+  where
+    name = Text.unpack field.info.name.hsName.text
+
+pokeField :: Idx ctx -> C.Field Final -> Idx ctx -> Hs.PokeCField ctx
+pokeField ptr field x = case field.width of
+    Nothing  -> Hs.PokeCField    (Hs.StrLit name) ptr x
+    Just _w  -> Hs.PokeCBitfield (Hs.StrLit name) ptr x
+  where
+    name = Text.unpack field.info.name.hsName.text
+
+readRawField :: Idx ctx -> C.Field Final -> Hs.ReadRawCField ctx
+readRawField ptr field = case field.width of
+    Nothing -> Hs.ReadRawCField    (Hs.StrLit name) ptr
+    Just _w -> Hs.ReadRawCBitfield (Hs.StrLit name) ptr
+  where
+    name = Text.unpack field.info.name.hsName.text
+
+writeRawField ::
+     Idx ctx
+  -> C.Field Final
+  -> Idx ctx
+  -> Hs.WriteRawCField ctx
+writeRawField ptr field x = case field.width of
+    Nothing  -> Hs.WriteRawCField    (Hs.StrLit name) ptr x
+    Just _w  -> Hs.WriteRawCBitfield (Hs.StrLit name) ptr x
+  where
+    name = Text.unpack field.info.name.hsName.text
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation/ToFromFunPtr.hs b/src-internal/HsBindgen/Backend/Hs/Translation/ToFromFunPtr.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation/ToFromFunPtr.hs
@@ -0,0 +1,148 @@
+-- | Generate @ToFunPtr@ and @FromFunPtr@ instances
+--
+-- Intended for qualified import.
+--
+-- > HsBindgen.Backend.Hs.Translation.ToFromFunPtr qualified as ToFromFunPtr
+module HsBindgen.Backend.Hs.Translation.ToFromFunPtr (
+    forFunction
+  , forNewtype
+  ) where
+
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.Origin qualified as Origin
+import HsBindgen.Backend.Hs.Translation.ForeignImport (ImportFor (..))
+import HsBindgen.Backend.Hs.Translation.ForeignImport qualified as Hs.ForeignImport
+import HsBindgen.Backend.Hs.Translation.ForeignImport qualified as HsFI
+import HsBindgen.Backend.HsModule.Pretty ()
+import HsBindgen.Backend.SHs.Translation qualified as SHs
+import HsBindgen.Backend.UniqueSymbol
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.TranslateTypes.Translation qualified as Translation
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Main API
+
+  NOTE: The names we generate here exist in Haskell only (they do not have
+  C counterparts); it therefore suffices if they are locally unique.
+-------------------------------------------------------------------------------}
+
+-- | Generate ToFunPtr/FromFunPtr instances for nested function pointer types
+--
+-- This function analyses the function declaration arguments and return types,
+-- and for each function pointer argument/return type containing at least one
+-- non-orphan type, generates the FFI wrapper and dynamic stubs along with
+-- the respective ToFunPtr and FromFunPtr instances.
+--
+-- These instances are placed in the main module to avoid orphan instances.
+forFunction ::
+     ([C.TypeFunArg Final], C.Type Final)
+  -> [Hs.Decl l]
+forFunction (args, res) =
+    instancesFor
+      nameTo
+      nameFrom
+      funC
+      funHs
+      importFor
+  where
+    funC  = C.TypeFun args res
+    funHs = Translation.topLevel funC
+
+    importFor :: ImportFor
+    importFor = ImportForFunction {
+          args = Translation.inContext Translation.FunArg <$> args
+        , res =  Hs.IO $ Translation.inContext Translation.FunRes res
+        }
+
+    nameWith :: String -> UniqueSymbol
+    nameWith s =
+      locallyUnique $ "instance " <> s <> " (" <> prettyHsType funHs <> ")"
+
+    nameTo, nameFrom :: UniqueSymbol
+    nameTo   = nameWith "ToFunPtr"
+    nameFrom = nameWith "FromFunPtr"
+
+-- | Generate instances for newtype around functions
+forNewtype ::
+     Hs.Newtype
+  -> ([C.TypeFunArg Final], C.Type Final)
+  -> [Hs.Decl l]
+forNewtype newtyp (args, res) =
+    instancesFor
+      nameTo
+      nameFrom
+      funC
+      funHs
+      importFor
+  where
+    funC  = C.TypeFun args res
+    funHs = Hs.TypRef newtyp.name (Just newtyp.field.typ)
+
+    importFor :: ImportFor
+    importFor = ImportForNewtype {
+          args = Translation.inContext Translation.FunArg <$> args
+        , res =  Hs.IO $ Translation.inContext Translation.FunRes res
+        , newtyp = newtyp
+        }
+
+    nameWith :: String -> UniqueSymbol
+    nameWith s = locallyUnique $ s <> Hs.nameToStr newtyp.name
+
+    nameTo, nameFrom :: UniqueSymbol
+    nameTo   = nameWith "to"
+    nameFrom = nameWith "from"
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+instancesFor ::
+     UniqueSymbol -- ^ Name of the @toFunPtr@ fun
+  -> UniqueSymbol -- ^ Name of the @fromFunPtr@ fun
+  -> C.Type Final -- ^ Type of the C function
+  -> Hs.Type      -- ^ Corresponding Haskell type
+  -> ImportFor
+  -> [Hs.Decl l]
+instancesFor nameTo nameFrom funC funHs importFor = concat [
+      -- import for @ToFunPtr@ instance
+      HsFI.foreignImportWrapperDec
+        (Hs.ForeignImport.FunName nameTo)
+        funHs
+        importFor
+        (Origin.ToFunPtr funC)
+
+      -- import for @FromFunPtr@ instance
+    , HsFI.foreignImportDynamicDec
+        (Hs.ForeignImport.FunName nameFrom)
+        funHs
+        importFor
+        (Origin.ToFunPtr funC)
+
+      -- @ToFunPtr@ instance proper
+    , [ Hs.DeclDefineInstance Hs.DefineInstance{
+            comment      = Nothing
+          , instanceDecl = Hs.InstanceToFunPtr Hs.ToFunPtrInstance{
+                typ  = funHs
+              , body = nameTo
+              }
+          }
+      ]
+
+      -- @FromFunPtr@ instance proper
+    , [ Hs.DeclDefineInstance Hs.DefineInstance{
+            comment      = Nothing
+          , instanceDecl = Hs.InstanceFromFunPtr Hs.FromFunPtrInstance{
+                typ  = funHs
+              , body = nameFrom
+              }
+          }
+      ]
+    ]
+
+prettyHsType :: Hs.Type -> String
+prettyHsType = show . PP.pretty . SHs.translateType
diff --git a/src-internal/HsBindgen/Backend/Hs/Translation/Union.hs b/src-internal/HsBindgen/Backend/Hs/Translation/Union.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Hs/Translation/Union.hs
@@ -0,0 +1,399 @@
+module HsBindgen.Backend.Hs.Translation.Union (
+    unionDecs
+  ) where
+
+import Control.Monad.State qualified as State hiding (MonadState)
+import Data.Set qualified as Set
+
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Haddock.Translation
+import HsBindgen.Backend.Hs.Origin qualified as Origin
+import HsBindgen.Backend.Hs.Translation.Field
+import HsBindgen.Backend.Hs.Translation.Instances qualified as Hs
+import HsBindgen.Backend.Hs.Translation.Monad (HsM)
+import HsBindgen.Backend.Hs.Translation.Monad qualified as HsM
+import HsBindgen.Backend.Hs.Translation.Newtype qualified as Hs
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.MangleNames.IsPass qualified as MangleNames
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+
+unionDecs ::
+     HasCallStack
+  => C.DeclInfo Final
+  -> C.Union Final
+  -> PrescriptiveDeclSpec
+  -> HsM [Hs.Decl l]
+unionDecs info union spec = do
+    st <- State.get
+    nt <- newtypeDec
+    pure $ aux st nt
+  where
+    newtypeDec :: HsM Hs.Newtype
+    newtypeDec = do
+        Hs.newtypeDec newtypeName newtypeConstr newtypeField
+          newtypeOrigin newtypeComment candidateInsts knownInsts
+      where
+        newtypeName :: Hs.Name Hs.NsTypeConstr
+        newtypeName = Hs.assertNs (Proxy @Hs.NsTypeConstr) info.id.hsName
+
+        newtypeConstr :: Hs.Name Hs.NsConstr
+        newtypeConstr = union.names.dataConstr
+
+        newtypeField :: Hs.Field
+        newtypeField = Hs.Field {
+              name    = union.names.field
+            , typ     = Hs.ByteArray
+            , origin  = Origin.GeneratedField
+            , comment = Nothing
+            }
+
+        newtypeOrigin :: Origin.Decl Origin.Newtype
+        newtypeOrigin =  Origin.Decl {
+              info = info
+            , kind = Origin.Union union
+            , spec = spec
+            }
+
+        newtypeComment :: Maybe HsDoc.Comment
+        newtypeComment = mkHaddocks info
+
+        candidateInsts :: Set Inst.TypeClass
+        candidateInsts = Set.empty
+
+        knownInsts :: Set Inst.TypeClass
+        knownInsts = Set.fromList $ catMaybes [
+            Just Inst.Generic
+            -- A union with only non-bit-fields trivially satisfies
+            -- 'Inst.HasCBitfield', but we omit such trivial instances as not to
+            -- confuse the user.
+          , if any (isJust . (.width)) union.fields
+              then Just Inst.HasCBitfield
+              else Nothing
+            -- A union with only bit-fields trivially satisfies
+            -- 'Inst.HasCField', but we omit such trivial instances as not to
+            -- confuse the user.
+          , if any (isNothing . (.width)) union.fields
+              then Just Inst.HasCField
+              else Nothing
+          , if null union.fields then Nothing else Just Inst.HasField
+          , if null union.fields then Nothing else Just Inst.HasFieldCompat
+          , if null union.fields then Nothing else Just Inst.HasFieldPtr
+          , Just Inst.IsUnion
+          , Just Inst.ReadRaw
+          , Just Inst.StaticSize
+          , Just Inst.Storable
+          , Just Inst.WriteRaw
+          ]
+
+    -- everything in aux is state-dependent
+    aux :: HsM.St -> Hs.Newtype -> [Hs.Decl l]
+    aux st nt =
+        Hs.DeclNewtype nt : marshalDecls ++ isUnionDecl ++
+        fieldDecls
+      where
+        marshalDecls :: [Hs.Decl l]
+        marshalDecls = [
+            Hs.DeclDeriveInstance Hs.DeriveInstance{
+                strategy = Hs.DeriveStock
+              , clss     = Inst.Generic
+              , name     = nt.name
+              , comment  = Nothing
+              }
+          , Hs.DeclDeriveInstance Hs.DeriveInstance{
+                strategy = Hs.DeriveVia sba
+              , clss     = Inst.StaticSize
+              , name     = nt.name
+              , comment  = Nothing
+              }
+          , Hs.DeclDeriveInstance Hs.DeriveInstance{
+                strategy = Hs.DeriveVia sba
+              , clss     = Inst.ReadRaw
+              , name     = nt.name
+              , comment  = Nothing
+              }
+          , Hs.DeclDeriveInstance Hs.DeriveInstance{
+                strategy = Hs.DeriveVia sba
+              , clss     = Inst.WriteRaw
+              , name     = nt.name
+              , comment  = Nothing
+              }
+          , Hs.DeclDeriveInstance Hs.DeriveInstance{
+                strategy = Hs.DeriveVia (Hs.EquivStorable (Hs.TypRef nt.name Nothing))
+              , clss     = Inst.Storable
+              , name     = nt.name
+              , comment  = Nothing
+              }
+          ]
+
+        sba :: Hs.Type
+        sba =
+            Hs.SizedByteArray
+              (fromIntegral union.sizeof)
+              (fromIntegral union.alignment)
+
+        fieldDecls :: [Hs.Decl l]
+        fieldDecls = flip concatMap (flattenFields union.fields) $ \field -> concat [
+            hasFieldDecs st info nt field
+          , hasFieldCompatDecs st info nt field
+          , hasFieldPtrDecs nt field
+          , hasCFieldDecs nt field
+          , hasCBitfieldDecs nt field
+          ]
+
+        isUnionDecl :: [Hs.Decl l]
+        isUnionDecl = [
+              Hs.DeclDeriveInstance Hs.DeriveInstance{
+                  strategy = Hs.DeriveVia sba
+                , clss     = Inst.IsUnion
+                , name     = nt.name
+                , comment  = Nothing
+                }
+            | Inst.IsUnion `Set.member` nt.instances
+            ]
+
+{-------------------------------------------------------------------------------
+  HasField
+-------------------------------------------------------------------------------}
+
+-- | Class instances for 'GHC.Records.HasField'
+hasFieldDecs ::
+     HsM.St
+  -> C.DeclInfo Final
+  -> Hs.Newtype
+  -> Field
+  -> [Hs.Decl l]
+hasFieldDecs st info union field =
+    [ Hs.DeclDefineInstance $
+        Hs.DefineInstance {
+            comment = fieldComment
+          , instanceDecl = Hs.InstanceHasField decl
+          }
+    | Inst.HasField `elem` union.instances
+    , Inst.Storable `elem` fieldInsts
+    ]
+  where
+    fieldInsts :: Set Inst.TypeClass
+    fieldInsts = Hs.getInstances
+                    st.instanceMap
+                    (Just union.name)
+                    (Set.singleton Inst.Storable)
+                    [fieldType]
+
+    fieldComment :: Maybe HsDoc.Comment
+    fieldComment = mkHaddocksFieldInfo info (getFieldInfo field)
+
+    parentType :: Hs.Type
+    parentType = Hs.TypRef union.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    decl :: Hs.HasFieldInstance
+    decl = Hs.HasFieldInstance {
+          parentType = parentType
+        , fieldName  = fieldName
+        , fieldType  = fieldType
+        , impl       = impl
+        }
+
+    impl, implUnion :: Hs.HasFieldImpl
+    impl = case field of
+        -- Unions are not translated to Haskell record datatypes. Therefore
+        -- regular and implicit fields are not translated to Haskell record
+        -- datatype fields either. Instead of getting @HasField@ instances for
+        -- free we have to define custom instances.
+        RegularField  _ -> implUnion
+        ImplicitField _ -> implUnion
+        -- Indirect fields are not translated to Haskell record datatype fields, so
+        -- they get custom @HasField@ instances composed from existing @HasField@
+        -- instances
+        IndirectField impField indField -> implIndirect impField indField
+
+    implUnion = case getFieldWidth field of
+      Nothing       -> Hs.HasFieldImplUnion
+      Just bitWidth ->
+        -- For non-bit-fields, the field offset is in terms of bytes. For
+        -- bit-fields, the field offset is in terms of bits. So, no need to do
+        -- any conversion.
+        let bitOffset = getFieldOffset field in
+        Hs.HasFieldImplUnionBits { bitOffset = bitOffset, bitWidth = bitWidth }
+
+    implIndirect :: C.ImplicitField Final -> C.IndirectField Final -> Hs.HasFieldImpl
+    implIndirect impField indField  = Hs.HasFieldImplIndirect {
+          nameTopToAnon = Hs.assertNs (Proxy @Hs.NsVar) impField.info.name.hsName
+        , nameAnonToTarget = Hs.assertNs (Proxy @Hs.NsVar) indField.ann.fieldNameInAnon.hsName
+        }
+
+-- | Class instances for 'GHC.Records.Compat.HasField'
+hasFieldCompatDecs ::
+     HsM.St
+  -> C.DeclInfo Final
+  -> Hs.Newtype
+  -> Field
+  -> [Hs.Decl l]
+hasFieldCompatDecs st info union field =
+   [ Hs.DeclDefineInstance $
+        Hs.DefineInstance {
+            comment = fieldComment
+          , instanceDecl = Hs.InstanceHasFieldCompat decl
+          }
+    | Inst.HasFieldCompat `elem` union.instances
+    , Inst.Storable `elem` fieldInsts
+    ]
+  where
+    fieldInsts :: Set Inst.TypeClass
+    fieldInsts = Hs.getInstances
+                    st.instanceMap
+                    (Just union.name)
+                    (Set.singleton Inst.Storable)
+                    [fieldType]
+
+    fieldComment :: Maybe HsDoc.Comment
+    fieldComment = mkHaddocksFieldInfo info (getFieldInfo field)
+
+    parentType :: Hs.Type
+    parentType = Hs.TypRef union.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    decl :: Hs.HasFieldCompatInstance
+    decl = Hs.HasFieldCompatInstance {
+          parentType = parentType
+        , fieldName  = fieldName
+        , fieldType  = fieldType
+        , impl       = impl
+        }
+
+    impl, implUnion :: Hs.HasFieldCompatImpl
+    impl = case field of
+        -- Unions are not translated to Haskell record datatypes. Therefore
+        -- regular and implicit fields are not translated to Haskell record
+        -- datatype fields either. Instead of getting @HasField@ instances for
+        -- free we have to define custom instances.
+        RegularField  _ -> implUnion
+        ImplicitField _ -> implUnion
+        -- Indirect fields are not translated to Haskell record datatype fields, so
+        -- they get custom @HasField@ instances composed from existing @HasField@
+        -- instances
+        IndirectField impField indField -> implIndirect impField indField
+
+    implUnion = case getFieldWidth field of
+      Nothing       -> Hs.HasFieldCompatImplUnion
+      Just bitWidth ->
+        -- For non-bit-fields, the field offset is in terms of bytes. For
+        -- bit-fields, the field offset is in terms of bits. So, no need to do
+        -- any conversion.
+        let bitOffset = getFieldOffset field in
+        Hs.HasFieldCompatImplUnionBits { bitOffset = bitOffset, bitWidth = bitWidth }
+
+    implIndirect :: C.ImplicitField Final -> C.IndirectField Final -> Hs.HasFieldCompatImpl
+    implIndirect impField indField  = Hs.HasFieldCompatImplIndirect {
+          nameTopToAnon = Hs.assertNs (Proxy @Hs.NsVar) impField.info.name.hsName
+        , nameAnonToTarget = Hs.assertNs (Proxy @Hs.NsVar) indField.ann.fieldNameInAnon.hsName
+        }
+
+-- | Class instances for 'GHC.Records.HasField' for the pointer manipulation API
+hasFieldPtrDecs :: Hs.Newtype -> Field -> [Hs.Decl l]
+hasFieldPtrDecs union field =
+    [ Hs.DeclDefineInstance $
+        Hs.DefineInstance {
+            comment      = Nothing
+          , instanceDecl = Hs.InstanceHasFieldPtr decl
+          }
+    | Inst.HasFieldPtr `elem` union.instances
+    ]
+  where
+    parentType :: Hs.Type
+    parentType = Hs.TypRef union.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    decl :: Hs.HasFieldPtrInstance
+    decl = Hs.HasFieldPtrInstance {
+          parentType = parentType
+        , fieldName  = fieldName
+        , fieldType  = fieldType
+        , deriveVia  =
+            case getFieldWidth field of
+              Nothing -> Hs.ViaHasCField
+              Just _  -> Hs.ViaHasCBitfield
+        }
+
+-- | Class instances for 'HsBindgen.Runtime.HasCField.HasCField'
+hasCFieldDecs :: Hs.Newtype -> Field -> [Hs.Decl l]
+hasCFieldDecs union field = case getFieldWidth field of
+    Just _w -> []
+    Nothing ->
+      [ Hs.DeclDefineInstance $
+          Hs.DefineInstance {
+              comment      = Nothing
+            , instanceDecl = Hs.InstanceHasCField decl
+            }
+      | Inst.HasCField `elem` union.instances
+      ]
+  where
+    parentType :: Hs.Type
+    parentType = Hs.TypRef union.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    decl :: Hs.HasCFieldInstance
+    decl = Hs.HasCFieldInstance {
+          parentType  = parentType
+        , fieldName   = fieldName
+        , cFieldType  = fieldType
+        , fieldOffset = getFieldOffset field `div` 8
+        }
+
+-- | Class instances for 'HsBindgen.Runtime.HasCBitfield.HasCBitfield'
+hasCBitfieldDecs :: Hs.Newtype -> Field -> [Hs.Decl l]
+hasCBitfieldDecs union field = case getFieldWidth field of
+    Nothing -> []
+    Just w ->
+      [ Hs.DeclDefineInstance $
+          Hs.DefineInstance {
+              comment      = Nothing
+            , instanceDecl = Hs.InstanceHasCBitfield $ decl w
+            }
+      | Inst.HasCBitfield `elem` union.instances
+      ]
+  where
+    parentType :: Hs.Type
+    parentType = Hs.TypRef union.name Nothing
+
+    fieldName :: Hs.Name Hs.NsVar
+    fieldName = Hs.assertNs (Proxy @Hs.NsVar) (getFieldInfo field).name.hsName
+
+    fieldType :: Hs.Type
+    fieldType = (getFieldTyp field).hs
+
+    decl :: Int -> Hs.HasCBitfieldInstance
+    decl w = Hs.HasCBitfieldInstance {
+          parentType    = parentType
+        , fieldName     = fieldName
+        , cBitfieldType = fieldType
+        , bitOffset     = getFieldOffset field
+        , bitWidth      = w
+        }
diff --git a/src-internal/HsBindgen/Backend/HsModule/Names.hs b/src-internal/HsBindgen/Backend/HsModule/Names.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Names.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE TemplateHaskellQuotes #-}
+
+module HsBindgen.Backend.HsModule.Names (
+    -- * Name type
+    NameType(..)
+
+    -- * Resolved name
+  , ResolvedName(..)
+  , resolveGlobal
+  ) where
+
+import Data.Char qualified as Char
+import Language.Haskell.TH.Syntax qualified as TH
+
+import HsBindgen.Backend.Global
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Name type
+-------------------------------------------------------------------------------}
+
+-- | Name type
+data NameType =
+    -- | An identifier, e.g., @foo@
+    IdentifierName
+    -- | An identifier with a magic hash at the end, e.g., @foo#@
+  | IdentifierMagicHashName
+    -- | An operator, e.g., @(+)@
+  | OperatorName
+  deriving (Eq, Ord, Show)
+
+nameType :: String -> NameType
+nameType nm
+  | all isIdentChar nm
+  = IdentifierName
+    -- nm is non-empty because of the first guard
+  | all isIdentChar (init nm) && isMagicHashChar (last nm)
+  = IdentifierMagicHashName
+  | otherwise
+  = OperatorName
+  where
+    isMagicHashChar :: Char -> Bool
+    isMagicHashChar c = c == '#'
+
+    isIdentChar :: Char -> Bool
+    isIdentChar c = Char.isAlphaNum c || c == '_' || c == '\''
+
+{-------------------------------------------------------------------------------
+  Resolved name
+-------------------------------------------------------------------------------}
+
+-- | A base name attached with information about the 'NameType', the Haskell
+--   import statement, and the namespace.
+data ResolvedName = ResolvedName {
+      string   :: String
+    , typ      :: NameType
+    , hsImport :: Hs.Import
+    , ns       :: Hs.Namespace
+    }
+  deriving (Eq, Ord, Show)
+
+resolveGlobal :: Global c -> ResolvedName
+resolveGlobal g = ResolvedName{
+      string   = baseName
+    , typ      = nameType baseName
+    , hsImport = g.imprt
+    , ns       = globalCatNamespace g.cat
+    }
+  where
+    baseName :: String
+    baseName = TH.nameBase g.name
diff --git a/src-internal/HsBindgen/Backend/HsModule/Pretty.hs b/src-internal/HsBindgen/Backend/HsModule/Pretty.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Pretty.hs
@@ -0,0 +1,165 @@
+{-# LANGUAGE MagicHash       #-}
+{-# LANGUAGE RecordWildCards #-}
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+module HsBindgen.Backend.HsModule.Pretty (
+  ) where
+
+import Data.List qualified as List
+import Text.SimplePrettyPrint (CtxDoc, Pretty (..), ($$), (<+>), (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Backend.HsModule.Names
+import HsBindgen.Backend.HsModule.Pretty.CAPI
+import HsBindgen.Backend.HsModule.Pretty.Comment ()
+import HsBindgen.Backend.HsModule.Pretty.Decl ()
+import HsBindgen.Backend.HsModule.Translation
+import HsBindgen.Config.Prelims
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Module pretty-printing
+-------------------------------------------------------------------------------}
+
+instance Pretty HsModule where
+  pretty hsModule = PP.vsep $
+      PP.vcat (map pretty hsModule.pragmas)
+    : prettyModuleHeader hsModule.name hsModule.exports
+    : PP.vcat (map (prettyImport hsModule.qualifiedStyle) hsModule.imports)
+    : (prettyCapiWrappers hsModule.rootDirectives hsModule.cWrappers)
+    : map pretty hsModule.decls
+
+-- | Render the module header with an explicit export list
+--
+-- When the export list is empty, we render @module M where@ (no export list).
+-- When there are exports, we render them in the standard style with leading
+-- commas. Export items are qualified with the module name to avoid ambiguity
+-- with imported names.
+--
+prettyModuleHeader :: Hs.ModuleName -> [ExportEntry] -> CtxDoc
+prettyModuleHeader name [] =
+    PP.hsep ["module", PP.string (Hs.moduleNameToString name), "where"]
+prettyModuleHeader name exports =
+    PP.vcat [
+        PP.hsep ["module", PP.string (Hs.moduleNameToString name)] $$ PP.nest 4 (
+          prettyExportList qualPrefix exports
+        )
+      , PP.nest 2 "where"
+      ]
+  where
+    qualPrefix :: String
+    qualPrefix = Hs.moduleNameToString name ++ "."
+
+-- | Pretty-print the export list with nested section headers
+--
+-- Section headers (@-- *@, @-- **@, …) are interleaved without commas, with
+-- the @*@ count derived from the recursion depth in the 'ExportEntry' tree.
+-- Regular export items use the standard leading-comma style.
+--
+-- Example output:
+--
+-- > ( Example.Api_version_t(..)
+-- >   -- * Core Data Types
+-- > , Example.Config_t(..)
+-- > , Example.Color_enum(..)
+-- > , pattern Example.COLOR_RED
+-- >   -- * Function Definitions
+-- > , Example.process_data
+-- >   -- ** I/O Helpers
+-- > , Example.read_data
+-- > )
+prettyExportList :: String -> [ExportEntry] -> CtxDoc
+prettyExportList qualPrefix entries =
+    PP.vcat (fst (go 1 True False entries) ++ [")"])
+  where
+    -- @depth@: 1 → @-- *@, 2 → @-- **@, etc.  Increments at each section.
+    -- @needOpen@: whether we still need to emit the opening @(@.
+    -- @needComma@: whether we've already emitted a regular export item.
+    -- Returns (rendered docs, needComma after rendering).
+    go :: Int -> Bool -> Bool -> [ExportEntry] -> ([CtxDoc], Bool)
+    go _ _ needComma [] = ([], needComma)
+    go depth needOpen needComma (entry : rest) = case entry of
+      ExportSection title children ->
+        let prefix    = if needOpen then "( " else "  "
+            stars     = replicate depth '*'
+            header    = PP.string prefix
+                     >< PP.string ("-- " ++ stars ++ " ")
+                     >< PP.hsep (map pretty title)
+            (cd, nc)  = go (depth + 1) False needComma children
+            (rd, nc') = go depth False nc rest
+        in  (header : cd ++ rd, nc')
+      ExportEntry item ->
+        let prefix | needOpen      = "( "
+                   | not needComma = "  "
+                   | otherwise     = ", "
+            (rd, nc) = go depth False True rest
+        in  ((PP.string prefix >< prettyExportItem qualPrefix item) : rd, nc)
+
+-- | Pretty-print a single export item, qualified with the module name
+prettyExportItem :: String -> ExportItem -> CtxDoc
+prettyExportItem q = \case
+    ExportTypeAll s -> PP.string q >< PP.text s >< "(..)"
+    ExportName s    -> PP.string q >< PP.text s
+    ExportPattern s -> "pattern" <+> (PP.string q >< PP.text s)
+
+{-------------------------------------------------------------------------------
+  GhcPragma pretty-printing
+-------------------------------------------------------------------------------}
+
+instance Pretty GhcPragma where
+  pretty (GhcPragma ghcPragma) = PP.hsep ["{-#", PP.string ghcPragma, "#-}"]
+
+{-------------------------------------------------------------------------------
+  Import pretty-printing
+-------------------------------------------------------------------------------}
+
+-- | Pretty-print an item of an import list
+--
+-- Type operators need the @type@ keyword, e.g. @type (~)@.
+prettyImportItem :: ResolvedName -> CtxDoc
+prettyImportItem resolved
+  | resolved.typ == OperatorName && resolved.ns == Hs.NsTypeConstr
+  = "type" <+> pretty resolved
+  | otherwise
+  = pretty resolved
+
+-- | Pretty-print an import statement, respecting 'QualifiedStyle'
+prettyImport :: QualifiedStyle -> ImportListItem -> CtxDoc
+prettyImport qualStyle = \case
+    UnqualifiedImportListItem name Nothing -> PP.hsep
+      [ "import"
+      , PP.string (Hs.moduleNameToString name)
+      ]
+    UnqualifiedImportListItem name (Just ns) -> PP.hsep
+      [ "import"
+      , PP.string (Hs.moduleNameToString name)
+      , PP.parens . PP.hcat . List.intersperse ", " $ map prettyImportItem ns
+      ]
+    QualifiedImportListItem name alias -> case qualStyle of
+      PreQualified ->
+        case alias of
+          Just q -> PP.hsep
+            [ "import qualified"
+            , PP.string (Hs.moduleNameToString name)
+            , "as"
+            , PP.string q
+            ]
+          Nothing -> PP.hsep
+            [ "import qualified"
+            , PP.string (Hs.moduleNameToString name)
+            ]
+      PostQualified ->
+        case alias of
+          Just q -> PP.hsep
+            [ "import"
+            , PP.string (Hs.moduleNameToString name)
+            , "qualified"
+            , "as"
+            , PP.string q
+            ]
+          Nothing -> PP.hsep
+            [ "import"
+            , PP.string (Hs.moduleNameToString name)
+            , "qualified"
+            ]
diff --git a/src-internal/HsBindgen/Backend/HsModule/Pretty/CAPI.hs b/src-internal/HsBindgen/Backend/HsModule/Pretty/CAPI.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Pretty/CAPI.hs
@@ -0,0 +1,51 @@
+-- We capitalize module names, but use camelCase/PascalCase in code:
+--
+-- - in types names:    CapiFoo, FooCapiBar
+-- - in variable names: capiFoo, fooCapiBar
+module HsBindgen.Backend.HsModule.Pretty.CAPI (
+    prettyCapiWrappers
+  )
+where
+
+import Text.SimplePrettyPrint (CtxDoc)
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+
+-- | Pretty print the CAPI 'HsBindgen.Config.Internal.addCSource' code fragment.
+prettyCapiWrappers ::
+     [C.RootDirective C.HashIncludeArg]
+  -> [CWrapper]
+  -> CtxDoc
+prettyCapiWrappers directives wrappers
+    | null src  = PP.empty
+    | otherwise = prettyCapiWrappers' src
+  where
+    src = getCWrappersSource directives wrappers
+
+prettyCapiWrappers' :: String -> CtxDoc
+prettyCapiWrappers' src = PP.vcat [
+     PP.hcat [
+         "$("
+       , withCapiModule "addCSource"
+       , " ("
+       , withCapiModule "unlines"
+       ]
+  , PP.hcat [
+        PP.nest 2 (PP.vlist "[" "]" linesDocs)
+      , "))"
+      ]
+  ]
+  where
+    linesDocs :: [CtxDoc]
+    linesDocs = map (fromString . show) (lines src)
+
+    withCapiModule :: String -> CtxDoc
+    withCapiModule x = PP.hcat [
+        PP.string (Hs.moduleNameToString capiModule)
+      , "."
+      , PP.string x
+      ]
diff --git a/src-internal/HsBindgen/Backend/HsModule/Pretty/Comment.hs b/src-internal/HsBindgen/Backend/HsModule/Pretty/Comment.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Pretty/Comment.hs
@@ -0,0 +1,250 @@
+{-# LANGUAGE RecordWildCards #-}
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+module HsBindgen.Backend.HsModule.Pretty.Comment (
+    CommentKind(..)
+  ) where
+
+import Data.List qualified as List
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Text qualified as Text
+import DeBruijn (Env (..))
+import Text.SimplePrettyPrint (CtxDoc, Pretty (..), ($$), ($+$), (<+>), (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.HsModule.Pretty.Type
+import HsBindgen.Backend.SHs.Translation
+import HsBindgen.Backend.UniqueSymbol
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Comment pretty-printing
+-------------------------------------------------------------------------------}
+
+-- | Here we generate valid Haddock for 'Hs.Comment'. There are roughly 4 types
+-- of Haddocks that we might be able to generate:
+--
+-- * Module Description Comments: Unfortunately, libclang doesn't allow us to
+-- parse module level comments because they are not associated with any AST
+-- node. Assuming that the comment is not immediately followed by a
+-- declaration, in that case the module level comment will get confused with a
+-- top level declaration comment.
+--
+-- * Top Level Comments: These comments are the top level comments for any
+-- declaration.
+--
+-- * Parts of a Declaration Comments: In addition to documenting the whole
+-- declaration, in some cases we can also document individual parts of the declaration.
+--
+-- * Template Haskell Comments: These comments can be either top level or
+-- parts of a declaration, but won't carry any specific documentation PP.string
+-- like \"--\".
+
+-- As mentioned above Libclang can only parse comments that immediately before
+-- a supported declaration. Any comments before a not supported declaration,
+-- e.g. macros, will be lost.
+
+-- With this being said we can only do a best effort to generate Top Level and
+-- Parts of a Declaration documentation. The following data type distinguishes
+-- these two.
+--
+data CommentKind
+  = TopLevelComment HsDoc.Comment
+    -- ^ Comments that begin with \"{-|\" for top level declarations
+  | PartOfDeclarationComment HsDoc.Comment
+    -- ^ Comments that begin with \"{-^\" for fields and part of declarations
+  | THComment HsDoc.Comment
+    -- ^ Comments that will not begin with any specific documentation PP.string
+    -- since they will be taken care of by Template Haskell
+
+instance Pretty CommentKind where
+  pretty commentKind =
+    let (commentStart, commentEnd, comment) =
+          case commentKind of
+            TopLevelComment c          -> ("{-|", "-}", c)
+            PartOfDeclarationComment c -> ("{- ^", "-}", c)
+            THComment c                -> ("", "", c)
+        indentation = length commentStart + 1
+        -- Separate user-facing metadata (for documentation) from internal metadata.
+        -- Only user-facing metadata should trigger Haddock comment syntax.
+        userFacingMetadata = catMaybes [
+            (\n -> "__C declaration:__ @"
+                >< PP.text (escapeMidLine n)
+                >< "@") <$> comment.origin
+          , (\lit -> "__C literal:__ @"
+                >< PP.text (escapeMidLine lit)
+                >< "@") <$> comment.literal
+          , (\d -> "__defined at:__ @"
+                >< d
+                >< "@"
+            ) <$> (prettyDeclOrigin =<< comment.declOrigin)
+          , (\hinfo -> "__exported by:__ @"
+                    >< prettyMainHeaders hinfo
+                    >< "@") <$> (headerInfo =<< comment.declOrigin)
+          ]
+        prettyDeclOrigin :: C.DeclOrigin -> Maybe CtxDoc
+        prettyDeclOrigin = \case
+          C.FromHeader hinfo  -> prettyHashIncludeArgLoc hinfo <$> comment.location
+          C.FromRootDirective -> Just "root directive"
+          C.FromCommandLine   -> Just "command line"
+        headerInfo :: C.DeclOrigin -> Maybe C.HeaderInfo
+        headerInfo = \case
+          C.FromHeader hinfo -> Just hinfo
+          _otherwise         -> Nothing
+        internalMetadata = catMaybes [
+            (\u -> "__unique:__ @"
+               >< PP.string u.source
+               >< "@"
+            ) <$> comment.unique
+          ]
+        allMetadata = userFacingMetadata ++ internalMetadata
+        firstContent =
+          case comment.title of
+            Nothing -> PP.empty
+            Just ct -> PP.hsep (map pretty ct)
+        singleLineStart =
+          case commentKind of
+            TopLevelComment _          -> "-- |"
+            PartOfDeclarationComment _ -> "-- ^"
+            THComment _                -> ""
+        -- If the comment only has the the origin C Name then use that has the
+        -- title.
+     in case comment.children of
+          [] | Nothing <- comment.title
+             , [singleMetadata] <- userFacingMetadata ->
+                -- Single user-facing metadata: use Haddock single-line style
+                PP.string singleLineStart <+> singleMetadata
+             | Nothing <- comment.title
+             , null userFacingMetadata
+             , [singleMetadata] <- internalMetadata ->
+                -- Only internal metadata: use regular comment
+                "--" <+> singleMetadata
+             | Nothing <- comment.title
+             , not (null allMetadata) ->
+                PP.string commentStart
+            <+> PP.vsep allMetadata
+             $$ PP.string commentEnd
+             | Just _ <- comment.title
+             , null allMetadata ->
+                PP.string commentStart
+            <+> firstContent
+             $$ PP.string commentEnd
+             | Just _  <- comment.title
+             , not (null allMetadata) ->
+                PP.string commentStart
+            <+> firstContent
+            $+$ PP.nest indentation (PP.vsep allMetadata)
+             $$ PP.string commentEnd
+             | otherwise -> PP.empty
+
+          _ -> PP.vsep (PP.string commentStart <+> firstContent
+                     : map (PP.nest indentation . pretty) comment.children)
+            $+$ PP.vcat [ PP.nest indentation (PP.vsep allMetadata)
+                     , PP.string commentEnd
+                     ]
+
+prettyHashIncludeArgLoc :: C.HeaderInfo -> SingleLoc C.DeclPath -> CtxDoc
+prettyHashIncludeArgLoc info loc =
+    -- Text like @:1:2@ is mangled by the GHC literate preprocessor, so we
+    -- cannot format source locations like that.
+    --
+    -- * @foo.h 1:2@ is fine
+    -- * @foo.h:1:2@ causes mangling issues
+    PP.string . escapeMidLineString . unwords $ catMaybes [
+        Just info.includeArg.path
+      , formatMacroArg <$> info.includeMacroArg
+      , Just sourceLoc
+      ]
+  where
+    sourceLoc :: String
+    sourceLoc = show (singleLocLine loc) ++ ':' : show (singleLocColumn loc)
+
+    formatMacroArg :: Text -> String
+    formatMacroArg = ('(' :) . (++ ")") . Text.unpack
+
+prettyMainHeaders :: C.HeaderInfo -> CtxDoc
+prettyMainHeaders info =
+      PP.string
+    . List.intercalate "@, @"
+    . map (escapeMidLineString . (.path))
+    . NonEmpty.toList
+    $ info.mainHeaders
+
+instance Pretty HsDoc.CommentBlockContent where
+  pretty = \case
+    HsDoc.Paragraph{..}      -> PP.hsep
+                              . map pretty
+                              $ paragraphContent
+    HsDoc.CodeBlock{..}      -> PP.vcat
+                              $ ["@"]
+                             ++ map PP.text codeBlockLines
+                             ++ ["@"]
+    HsDoc.Verbatim{..}       -> ">" <+> PP.text verbatimContent
+    HsDoc.Example{..}        -> ">>>" <+> PP.text exampleContent
+    HsDoc.Property{..}       -> "prop>" <+> PP.text propertyContent
+    HsDoc.ListItem{..}       ->
+      let listMarker =
+            case listItemType of
+              HsDoc.BulletList -> "*"
+              HsDoc.NumberedList n -> PP.show n >< "."
+       in listMarker <+> PP.vcat (map pretty listItemContent)
+    HsDoc.DefinitionList{..} -> "["
+                             >< pretty definitionListTerm
+                             >< "]:"
+                            <+> PP.vcat (map pretty definitionListContent)
+    HsDoc.Header{..}         -> PP.string (replicate (fromEnum headerLevel) '=')
+                            <+> (PP.hsep $ map pretty headerContent)
+
+
+instance Pretty HsDoc.CommentInlineContent where
+  pretty = \case
+    HsDoc.TextContent{..}   -> PP.text textContent
+    HsDoc.Monospace{..}     -> "@" >< PP.hsep (map pretty monospaceContent) >< "@"
+    HsDoc.Emph{..}          -> "/" >< PP.hsep (map pretty emphContent) >< "/"
+    HsDoc.Bold{..}          -> "__" >< PP.hsep (map pretty boldContent) >< "__"
+    HsDoc.Module{..}        -> "\"" >< PP.text moduleContent >< "\""
+    HsDoc.Identifier{..}    -> "'" >< PP.text identifierContent >< "'"
+    HsDoc.Type{..}          -> "t'" >< PP.text typeContent
+    HsDoc.Link{..}          -> "[" >< PP.hsep (map pretty linkLabel) >< "]"
+                            >< "(" >< PP.text linkURL >< ")"
+    HsDoc.URL{..}           -> "<" >< PP.text urlContent >< ">"
+    HsDoc.Anchor{..}        -> "#" >< PP.text anchorContent >< "#"
+    HsDoc.Math{..}          -> "\\[" >< PP.vcat (map PP.text mathContent) >< "\\]"
+    HsDoc.Metadata{..}      -> pretty metadataContent
+    HsDoc.TypeSignature{..} -> "@" >< prettyType EmptyEnv 0 (translateType typeSignature) >< "@"
+
+instance Pretty HsDoc.CommentMeta where
+  pretty HsDoc.Since{..} = "@since" <+> PP.text sinceContent
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+-- | Escape Haddock special characters in mid-line content
+--
+-- <https://haskell-haddock.readthedocs.io/latest/markup.html#special-characters>
+--
+-- This is /not/ sufficient to escape start-of-line content.
+escapeMidLine :: Text -> Text
+escapeMidLine = Text.pack . escapeMidLineString . Text.unpack
+
+escapeMidLineString :: String -> String
+escapeMidLineString = concatMap aux
+  where
+    aux :: Char -> [Char]
+    aux = \case
+      '\\' -> "\\\\"
+      '/'  -> "\\/"
+      '\'' -> "\\'"
+      '`'  -> "\\`"
+      '"'  -> "\\\""
+      '@'  -> "\\@"
+      '<'  -> "\\<"
+      '$'  -> "\\$"
+      '#'  -> "\\#"
+      c    -> [c]
diff --git a/src-internal/HsBindgen/Backend/HsModule/Pretty/Common.hs b/src-internal/HsBindgen/Backend/HsModule/Pretty/Common.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Pretty/Common.hs
@@ -0,0 +1,123 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+module HsBindgen.Backend.HsModule.Pretty.Common (
+    -- * Names
+    prettyResolvedNamePlain
+
+    -- * Tuples
+  , prettyBoxedTuple
+  , prettyUnboxedTuple
+
+    -- * Helpers
+  , withFreshNames
+  , panicWith
+  ) where
+
+import Data.Text qualified as Text
+import DeBruijn (Add (..), Env (..))
+import Text.SimplePrettyPrint (CtxDoc, Pretty (..))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.HsModule.Names
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Errors
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.NameHint
+
+{-------------------------------------------------------------------------------
+  Names
+-------------------------------------------------------------------------------}
+
+instance Pretty (Hs.Name ns) where
+  pretty nm = PP.text nm.text
+
+instance Pretty Hs.TermName where
+  pretty = PP.text . Hs.termNameToText
+
+-- | Pretty-print a 'HsBindgen.Backend.HsModule.Names.ResolvedName' in prefix notation
+--
+-- Operators are parenthesized.
+instance Pretty ResolvedName where
+  pretty resolved =
+    PP.parensWhen (resolved.typ == OperatorName) $ prettyResolvedNamePlain resolved
+
+-- | Pretty-print a 'HsBindgen.Backend.HsModule.Names.ResolvedName'
+--
+-- This auxialary function pretty-prints without parenthesizing operators or
+-- surrounding identifiers with backticks.
+prettyResolvedNamePlain :: ResolvedName -> CtxDoc
+prettyResolvedNamePlain resolved =
+    case resolved.hsImport of
+      Hs.QualifiedImport name alias ->
+        let q = fromMaybe (Hs.moduleNameToString name) alias
+        in  PP.string $ q ++ '.' : resolved.string
+      _otherwise ->
+        PP.string resolved.string
+
+{-------------------------------------------------------------------------------
+  External references
+-------------------------------------------------------------------------------}
+
+instance Pretty Hs.ModuleName where
+  pretty = PP.string . Hs.moduleNameToString
+
+instance Pretty Hs.SomeName where
+  pretty = PP.string . Text.unpack . (.text)
+
+instance Pretty Hs.ExtRef where
+  pretty extRef = PP.hcat [
+        pretty extRef.moduleName
+      , PP.char '.'
+      , PP.text extRef.name.text
+      ]
+
+{-------------------------------------------------------------------------------
+  Tuples
+-------------------------------------------------------------------------------}
+
+prettyTupleWith :: String -> String -> Plus2 -> [CtxDoc] -> CtxDoc
+prettyTupleWith pre pos n decls = case compare arity nDecls of
+    LT ->
+      panicPure $ mconcat [
+          "Too many declarations ("
+        , show nDecls
+        , ") for "
+        , show arity ++ "-tuple"
+        ]
+    _otherwise ->
+      let nMissing :: Int
+          nMissing = arity - nDecls
+
+          fakeDecls :: [CtxDoc]
+          fakeDecls = decls ++ replicate nMissing ""
+
+          lsOneLn   = PP.hlist pre pos fakeDecls
+          lsMulLn   = PP.vlist pre pos fakeDecls
+      in  PP.ifFits lsOneLn lsOneLn lsMulLn
+  where
+    arity, nDecls :: Int
+    arity  = fromIntegral $ applyPlus2 n
+    nDecls = length decls
+
+prettyBoxedTuple, prettyUnboxedTuple :: Plus2 -> [CtxDoc] -> CtxDoc
+prettyBoxedTuple   = prettyTupleWith "(" ")"
+prettyUnboxedTuple = prettyTupleWith "(#" "#)"
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+withFreshNames ::
+     Env ctx CtxDoc
+  -> Add n ctx ctx'
+  -> Vec n NameHint
+  -> (Env ctx' CtxDoc -> [CtxDoc] -> CtxDoc)
+  -> CtxDoc
+withFreshNames env AZ     _                         kont = kont env []
+withFreshNames env (AS a) (NameHint hint ::: hints) kont = PP.withFreshName hint $ \name ->
+    withFreshNames env a hints $ \env' names -> kont (env' :> name) (name : names)
+
+panicWith :: Show a => String -> a -> b
+panicWith msg x = panicPure $ msg ++ "; " ++ show x
diff --git a/src-internal/HsBindgen/Backend/HsModule/Pretty/Decl.hs b/src-internal/HsBindgen/Backend/HsModule/Pretty/Decl.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Pretty/Decl.hs
@@ -0,0 +1,249 @@
+{-# LANGUAGE RecordWildCards #-}
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+module HsBindgen.Backend.HsModule.Pretty.Decl (
+
+  ) where
+
+import Data.Text qualified as Text
+import Text.SimplePrettyPrint (CtxDoc, Pretty (..), ($$), (<+>), (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.HsModule.Names
+import HsBindgen.Backend.HsModule.Pretty.Comment
+import HsBindgen.Backend.HsModule.Pretty.Expr ()
+import HsBindgen.Backend.HsModule.Pretty.Type
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Instances as Inst
+import HsBindgen.IR.C qualified as C
+
+instance Pretty SDecl where
+  pretty = \case
+    DTypSyn typSyn ->
+         prettyTopLevelComment typSyn.comment
+      $$ PP.fsep [
+             "type" <+> pretty typSyn.name <+> PP.char '='
+           , PP.nest 2 (pretty typSyn.typ)
+           ]
+    DInst inst ->
+      let constraints = map pretty inst.super
+          -- @flist@ should either be @PP.hlist@ or @PP.vlist@
+          clsContext flist = flist "(" ")" constraints
+          clsHead = PP.hsep (pretty (resolveTypeClass inst.clss) : map (prettyPrec appPrec1) inst.args)
+          cls flist =
+                "instance"
+            <+> (if null inst.super
+                  then PP.empty
+                  else clsContext flist <+> "=>")
+            <+> clsHead
+            <+> "where"
+
+          instanceHead = PP.ifFits (cls PP.hlist) (cls PP.hlist) (cls PP.vlist)
+          typs = flip map inst.types $ \(g, typArgs, typSyn) -> PP.nest 2 $ PP.fsep
+            [ "type" <+> prettyUnqualResolvedName (resolveGlobal g) <+> PP.hsep (map (prettyPrec appPrec1) typArgs)
+                <+> PP.char '='
+            , PP.nest 2 (pretty typSyn)
+            ]
+          decs = flip map inst.decs $ \(name, expr) -> PP.nest 2 $ PP.fsep
+            [ prettyUnqualResolvedName (resolveGlobal name) <+> PP.char '='
+            , PP.nest 2 (pretty expr)
+            ]
+
+      in   prettyTopLevelComment inst.comment PP.$$
+           PP.vsep (instanceHead : typs ++ decs)
+
+    DRecord record ->
+      let d = PP.hsep ["data", pretty record.typ, PP.char '=', pretty record.con]
+      in  prettyTopLevelComment record.comment
+       $$ ( PP.hang d 2 $ PP.vcat [
+                PP.vlist "{" "}" [
+                       PP.hsep [
+                           pretty field.name
+                         , "::"
+                         , pretty field.typ
+                         ]
+                    $$ prettyFieldComment
+                  | field <- record.fields
+                  , let prettyFieldComment = maybe PP.empty (pretty . PartOfDeclarationComment) field.comment
+                  ]
+              , nestedDeriving record.deriv
+              ]
+          )
+
+    DEmptyData empty ->
+      prettyTopLevelComment empty.comment
+        $$ PP.hsep ["data", pretty empty.name]
+
+    DNewtype newtyp ->
+      let d = PP.hsep ["newtype", pretty newtyp.name, PP.char '=', pretty newtyp.con]
+          prettyFieldComment = maybe PP.empty (pretty . PartOfDeclarationComment) newtyp.field.comment
+      in  prettyTopLevelComment newtyp.comment
+       $$ ( PP.hang d 2 $ PP.vcat [
+                PP.vlist "{" "}" [
+                      PP.hsep [
+                          pretty newtyp.field.name
+                        , "::"
+                        , pretty newtyp.field.typ
+                        ]
+                    $$ prettyFieldComment
+                  ]
+              , nestedDeriving newtyp.deriv
+              ]
+          )
+
+    DForeignImport foreignImport ->
+      -- Variable names here refer to the syntax of foreign declarations at
+      -- <https://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1540008.4>
+      let callconv, impent :: CtxDoc
+          (callconv, impent) =
+            case foreignImport.callConv of
+              CallConvUserlandCapi _ -> ("ccall",
+                  PP.string $ Text.unpack foreignImport.origName.text
+                )
+              CallConvGhcCapi header -> ("capi", PP.hcat [
+                  PP.string header
+                , PP.string $ Text.unpack foreignImport.origName.text
+                ])
+              CallConvGhcCCall style -> ("ccall", PP.hcat [
+                  case style of
+                    ImportAsValue -> ""
+                    ImportAsPtr   -> "&"
+                , PP.string $ Text.unpack foreignImport.origName.text
+                ])
+
+      in  prettyTopLevelComment foreignImport.comment
+       $$ PP.hsep [ "foreign import"
+               , callconv
+               , safety foreignImport.safety
+               , "\"" >< impent >< "\""
+               , pretty foreignImport.name
+               , "::"
+               ]
+       $$ PP.nest 5 (prettyBindingType foreignImport.parameters foreignImport.result)
+
+    DBinding Binding{..} ->
+      let prettyName    = pretty name
+          prettyTyp     = prettyBindingType parameters result
+          prettySignature =
+            if null parameters; then
+              prettyName <+> "::" <+> prettyTyp
+            else
+              prettyName <+> "::" $$  PP.nest 5 prettyTyp
+      in  PP.vcat (map (prettyPragma name) pragmas)
+       $$ prettyTopLevelComment comment
+       $$ prettySignature
+       $$ PP.fsep
+            [ prettyName <+> PP.char '='
+            , PP.nest 2 $ pretty body
+            ]
+
+    DDerivingInstance deriv ->
+      prettyTopLevelComment deriv.comment
+        $$ "deriving" <+> strategy deriv.strategy
+                      <+> "instance"
+                      <+> pretty deriv.typ
+
+    DPatternSynonym patSyn ->
+      PP.vcat [
+          prettyTopLevelComment patSyn.comment
+        , "pattern" <+> pretty patSyn.name <+> "::" <+> pretty patSyn.typ
+        , "pattern" <+> pretty patSyn.name <+> "=" <+> pretty patSyn.rhs
+        ]
+
+    DCompletePragma completePragma ->
+      let patterns = map pretty completePragma.patterns
+          oneLine  = PP.hlist "{-# COMPLETE " " #-}" patterns
+      in  PP.ifFits oneLine oneLine $
+            PP.vcat . ("{-# COMPLETE" :) . (++ [PP.nest 2 "#-}"]) $
+              [ if idx == (0 :: Int)
+                  then PP.nest 6 pat
+                  else PP.nest 4 ("," <+> pat)
+              | (idx, pat) <- zip [0..] patterns
+              ]
+
+{-------------------------------------------------------------------------------
+  PatEpxr pretty-printing
+-------------------------------------------------------------------------------}
+
+instance Pretty PatExpr where
+  prettyPrec = prettyPatExpr
+
+prettyPatExpr :: Int -> PatExpr -> CtxDoc
+prettyPatExpr prec = \case
+    PELit i -> PP.parensWhen (i < 0) $ PP.show i
+    PEApps n ps -> PP.parensWhen (prec > 3) $ pretty n <+> PP.hsep (map (prettyPatExpr 4) ps)
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+-- | Nested deriving clauses (as part of a datatype declaration)
+nestedDeriving :: [(Hs.Strategy ClosedType, [Inst.TypeClass])] -> CtxDoc
+nestedDeriving = PP.vcat . map (uncurry aux)
+  where
+    aux :: Hs.Strategy ClosedType -> [Inst.TypeClass] -> CtxDoc
+    aux strat insts =
+      let l = auxOneLine strat insts
+      in  PP.ifFits l l $ auxMultiLines strat insts
+
+    auxOneLine :: Hs.Strategy ClosedType -> [Inst.TypeClass] -> CtxDoc
+    auxOneLine strat insts = PP.hsep [
+        "deriving"
+      , strategy strat
+      , PP.hlist "(" ")" (map (pretty . resolveTypeClass) insts)
+      ]
+
+    auxMultiLines :: Hs.Strategy ClosedType -> [Inst.TypeClass] -> CtxDoc
+    auxMultiLines strat insts = PP.hang ("deriving" <+> strategy strat) 2 $
+      PP.vlist "(" ")" (map (pretty . resolveTypeClass) insts)
+
+strategy :: Hs.Strategy ClosedType -> CtxDoc
+strategy Hs.DeriveNewtype  = "newtype"
+strategy Hs.DeriveStock    = "stock"
+strategy (Hs.DeriveVia ty) = "via" <+> pretty ty
+
+prettyPragma :: Hs.TermName -> Pragma -> CtxDoc
+prettyPragma n = \case
+  NOINLINE -> "{-# NOINLINE" <+> pretty n <+> "#-}"
+
+safety :: Safety -> CtxDoc
+safety Safe = "safe"
+safety Unsafe = "unsafe"
+
+prettyBindingType :: [Parameter] -> Result -> CtxDoc
+prettyBindingType params result =
+  case params of
+    [] -> prettyResultType result.typ
+    _  -> prettyParams params
+  where
+    prettyParam p =
+         prettyPrec funPrec1 p.typ
+      $$ maybe PP.empty (pretty . PartOfDeclarationComment) p.comment
+
+
+    prettyResultType t = prettyPrec funPrec t
+
+    prettyParams []     = prettyResultType result.typ
+    prettyParams (p:ps) =
+         prettyParam p
+      $$ PP.nest (-3) ("->" <+> prettyParams ps)
+
+prettyTopLevelComment :: Maybe HsDoc.Comment -> CtxDoc
+prettyTopLevelComment = maybe PP.empty (pretty . TopLevelComment)
+
+
+-- | Pretty-print a 'HsBindgen.Backend.HsModule.Names.ResolvedName' unqualified
+--
+-- This is needed in instance declarations.
+prettyUnqualResolvedName :: ResolvedName -> CtxDoc
+prettyUnqualResolvedName resolved =
+    PP.parensWhen (resolved.typ == OperatorName) $ PP.string resolved.string
+
+resolveTypeClass :: Inst.TypeClass -> ResolvedName
+resolveTypeClass = resolveGlobal . typeClassGlobal
diff --git a/src-internal/HsBindgen/Backend/HsModule/Pretty/Expr.hs b/src-internal/HsBindgen/Backend/HsModule/Pretty/Expr.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Pretty/Expr.hs
@@ -0,0 +1,278 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+module HsBindgen.Backend.HsModule.Pretty.Expr (
+    prettyExpr
+  ) where
+
+import Data.ByteString qualified as BS
+import Data.Char qualified
+import Data.List qualified as List
+import Data.Word
+import DeBruijn (Add (..), EmptyCtx, Env (..), lookupEnv)
+import GHC.Float (castDoubleToWord64, castFloatToWord32)
+import Text.SimplePrettyPrint (CtxDoc, Pretty (..), (<+>), (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.HsModule.Names
+import HsBindgen.Backend.HsModule.Pretty.Common
+import HsBindgen.Backend.HsModule.Pretty.Type
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Backend.SHs.AST.Expr (FBind (FBind))
+import HsBindgen.Backend.SHs.Translation.Common
+import HsBindgen.NameHint
+import HsBindgen.Util.Rational (canBeRepresentedAsRational)
+
+import Numeric (showHex)
+
+{-------------------------------------------------------------------------------
+  Expression pretty-printing
+-------------------------------------------------------------------------------}
+
+instance ctx ~ EmptyCtx => Pretty (SExpr ctx) where
+  prettyPrec = prettyExpr EmptyEnv
+
+prettyExpr :: Env ctx CtxDoc -> Int -> SExpr ctx -> CtxDoc
+prettyExpr env prec expr = case asNaryEApp expr of
+    (EBoxedTup n, args) ->
+      let decls = prettyExpr env 0 <$> args
+      in  prettyBoxedTuple n decls
+    (EUnboxedTup n, args) ->
+      let decls = prettyExpr env 0 <$> args
+      in  prettyUnboxedTuple n decls
+    (EApp{} , _) ->
+      panicWith
+        "Unexpected function application after unrolling function application"
+        expr
+    _otherwise -> prettyRolledExpr env prec expr
+
+-- See 'prettyExpr' but do not unroll/recognize function application.
+prettyRolledExpr :: Env ctx CtxDoc -> Int -> SExpr ctx -> CtxDoc
+prettyRolledExpr env prec expr = case expr of
+    EGlobal g -> pretty $ resolveGlobal g
+
+    EBound x -> lookupEnv x env
+    EFree x  -> pretty x
+    ECon n   -> pretty n
+
+    EIntegral i Nothing -> PP.parensWhen (prec > 0 && i < 0) (PP.show i)
+    EUnboxedIntegral i ->
+      PP.parens $ PP.hcat [PP.show i, "#"]
+    EIntegral i (Just t) ->
+      PP.parens $ PP.hcat [PP.show i, " :: ", prettyType EmptyEnv 0 t]
+    ECChar c -> PP.show c
+    EString s -> PP.show s
+    ECString bs ->
+      let
+        bytes   = BS.unpack bs
+        bsList  = PP.string $ "[" ++ List.intercalate ", " (map showHexByte bytes) ++ "]"
+        packApp = prettyExpr env 3 (eBindgenGlobal ByteString_pack) <+> bsList
+      in PP.parensWhen (prec > 3) packApp
+
+    EFloat f t -> PP.parens $ PP.hcat [
+        if canBeRepresentedAsRational f then
+          PP.show f
+        else
+          prettyExpr env prec $
+            EApp (eBindgenGlobal CFloat_constructor) $
+              EApp (eBindgenGlobal GHC_Float_castWord32ToFloat) $
+                EIntegral (toInteger $ castFloatToWord32 f) (Just $ tBindgenGlobal CUInt_type)
+      , " :: "
+      , prettyType EmptyEnv 0 t
+      ]
+    EDouble f t -> PP.parens $ PP.hcat [
+        if canBeRepresentedAsRational f then
+          PP.show f
+        else
+          prettyExpr env  prec $
+            EApp (eBindgenGlobal CDouble_constructor) $
+              EApp (eBindgenGlobal GHC_Float_castWord64ToDouble) $
+                EIntegral (toInteger $ castDoubleToWord64 f) (Just $ tBindgenGlobal CULong_type)
+      , " :: "
+      , prettyType EmptyEnv 0 t
+      ]
+
+    EApp f x -> PP.parensWhen (prec > 3) $ prettyExpr env 3 f <+> prettyExpr env 4 x
+
+    e@(EInfix op x y) -> case (prec, getInfixSpecialCase env e) of
+      -- Handle special cases only at precedence 0.
+      (0, Just ds) -> PP.vcat ds
+      -- Sub-expressions are aggressively parenthesized so that we do not have
+      -- to worry about operator fixity/precedence.
+      _otherwise ->
+        PP.parens $ PP.hsep
+          [ prettyExpr env 1 x
+          , prettyInfixResolvedName (resolveGlobal $ infixOpGlobal op)
+          , prettyExpr env 1 y
+          ]
+
+    ELam (NameHint hint) body -> PP.withFreshName hint $ \x -> PP.parensWhen (prec > 1) $ PP.fsep
+      [ PP.char '\\' >< x <+> "->"
+      , PP.nest 2 $ prettyExpr (env :> x) 0 body
+      ]
+
+    EUnusedLam body -> PP.parensWhen (prec > 1) $ PP.fsep
+      [ PP.char '\\' >< "_" <+> "->"
+      , PP.nest 2 $ prettyExpr env 0 body
+      ]
+
+    ECase x alts -> PP.vparensWhen (prec > 1) $
+      if null alts
+        then PP.hsep ["case", prettyExpr env 0 x, "of", "{}"]
+        else PP.hang (PP.hsep ["case", prettyExpr env 0 x, "of"]) 2 $ PP.vcat
+            ([ withFreshNames env add hints $ \env' params ->
+
+                let l = PP.hsep $ pretty cnst : params ++ ["->"]
+                in  PP.ifFits l (PP.fsep [l, PP.nest 2 (prettyExpr env' 0 body)]) $
+                    case unsnoc params of
+                      Nothing -> PP.fsep [l, PP.nest 2 (prettyExpr env' 0 body)]
+                      Just (lParams, rParam) -> PP.vcat $
+                          pretty cnst
+                        : [ PP.nest 2 param
+                          | param <- lParams
+                          ]
+                        ++ [PP.nest 2 (rParam <+> "->")]
+                        ++ [PP.nest 4 (prettyExpr env' 0 body)]
+
+            | SAlt cnst add hints body <- alts
+            ]
+            ++
+            [ withFreshNames env (AS AZ) hints $ \env' params ->
+                let l = PP.hsep $ params ++ ["->"]
+                in  PP.ifFits l (PP.fsep [l, PP.nest 2 (prettyExpr env' 0 body)]) $
+                    case unsnoc params of
+                      Nothing -> PP.fsep [l, PP.nest 2 (prettyExpr env' 0 body)]
+                      Just (lParams, rParam) -> PP.vcat $
+                          [ PP.nest 2 param
+                          | param <- lParams
+                          ]
+                        ++ [PP.nest 2 (rParam <+> "->")]
+                        ++ [PP.nest 4 (prettyExpr env' 0 body)]
+
+            | SAltNoConstr hints body <- alts
+            ]
+            ++
+            [ withFreshNames env add hints $ \env' params ->
+                let l  = PP.hlist "(# " " #)" params <+> "->"
+                in  PP.ifFits l (PP.fsep [l, PP.nest 2 (prettyExpr env' 0 body)]) $
+                    case unsnoc params of
+                      Nothing -> PP.fsep [l, PP.nest 2 (prettyExpr env' 0 body)]
+                      Just (lParams, rParam) -> PP.vcat $
+                          [ PP.nest 2 param
+                          | param <- lParams
+                          ]
+                        ++ [PP.nest 2 (rParam <+> "->")]
+                        ++ [PP.nest 4 (prettyExpr env' 0 body)]
+
+            | SAltUnboxedTuple add hints body <- alts
+            ]
+            )
+
+    EUnit -> PP.string "()"
+
+    -- Handled in 'prettyExpr'.
+    EBoxedTup{} ->
+      panicWith
+        "Unexpected boxed unsaturated tuple after unrolling function application"
+        expr
+
+    -- Handled in 'prettyExpr'.
+    EUnboxedTup{} ->
+      panicWith
+        "Unexpected unboxed unsaturated tuple after unrolling function application"
+        expr
+
+    EList xs ->
+      let ds = prettyExpr env 0 <$> xs
+          l  = PP.hlist "[" "]" ds
+      in  PP.ifFits l l $ PP.vlist "[" "]" ds
+
+    -- NOTE: the precedence is copied from the @EApp@ case above
+    ETypeApp f t ->
+      PP.parensWhen (prec > 3) $
+        prettyExpr env 3 f <+> "@" >< prettyType EmptyEnv 4 t
+
+    -- NOTE: the precedence is copied from the @EApp@ case above
+    ERecCon con fs ->
+      let fsDocs = fmap (prettyFBind env) fs
+          hl = PP.hlist "{" "}" fsDocs
+          vl = PP.vlist "{" "}" fsDocs
+      in  PP.parensWhen (prec > 3) $
+            pretty con <+> PP.ifFits hl hl vl
+
+-- | Pretty-print a field binding
+--
+-- Field bindings do not have to be parenthesised in the context where they are
+-- used: record construction and record update. As such, this function does not
+-- get a precedence argument.
+prettyFBind :: Env ctx CtxDoc -> FBind ctx -> CtxDoc
+prettyFBind env (FBind label expr) = PP.string label <+> "=" <+> prettyExpr env 0 expr
+
+-- | Format a byte as a two-digit uppercase hex literal, e.g. @0x00@, @0xE3@.
+showHexByte :: Word8 -> String
+showHexByte w = "0x" ++ map Data.Char.toUpper (pad2 (showHex w ""))
+  where
+    pad2 s = if length s == 1 then '0' : s else s
+
+getInfixSpecialCase :: forall ctx. Env ctx CtxDoc -> SExpr ctx -> Maybe [CtxDoc]
+getInfixSpecialCase env = \case
+    EInfix op x y ->
+      let opGlo = infixOpGlobal op
+          opDoc = prettyInfixResolvedName $ resolveGlobal opGlo
+      in  case op of
+            InfixApplicative_seq -> auxl op opDoc [opDoc <+> prettyExpr env 1 y] x
+            InfixMonad_seq       -> auxr op opDoc [sp opDoc <+> prettyExpr env 1 x] y
+            _otherwise      -> Nothing
+    _otherwise -> Nothing
+  where
+    -- | Handle left-associative special cases
+    auxl ::
+         InfixOp  -- ^ operator
+      -> CtxDoc   -- ^ operator document
+      -> [CtxDoc] -- ^ accumulated lines
+      -> SExpr ctx -- ^ left expression
+      -> Maybe [CtxDoc]
+    auxl op opDoc acc = \case
+      EInfix op' x y
+        | op' == op -> auxl op opDoc (opDoc <+> prettyExpr env 1 y : acc) x
+        | otherwise -> Nothing
+      e -> Just $ sp opDoc <+> prettyExpr env 1 e : acc
+
+    -- | Handle right-associative special cases
+    auxr ::
+         InfixOp   -- ^ operator
+      -> CtxDoc   -- ^ operator document
+      -> [CtxDoc] -- ^ accumulated lines in reverse order
+      -> SExpr ctx -- ^ right expression
+      -> Maybe [CtxDoc]
+    auxr op opDoc acc = \case
+      EInfix op' x y
+        | op' == op -> auxr op opDoc (opDoc <+> prettyExpr env 1 x : acc) y
+        | otherwise -> Nothing
+      e -> Just . reverse $ opDoc <+> prettyExpr env 1 e : acc
+
+    -- | Create document of spaces that has same width as passed document
+    sp :: CtxDoc -> CtxDoc
+    sp =
+      -- TODO compute column width, do not just count chars with length
+      PP.string . flip List.replicate ' ' . length . show
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+-- | In "Data.List" from @base-4.19.0.0@
+unsnoc :: [a] -> Maybe ([a], a)
+unsnoc = foldr (\x -> Just . maybe ([], x) (\(~(a, b)) -> (x : a, b))) Nothing
+{-# INLINABLE unsnoc #-}
+
+-- | Pretty-print a 'HsBindgen.Backend.HsModule.Names.ResolvedName' in infix notation
+--
+-- Identifiers are surrounded by backticks.
+prettyInfixResolvedName :: ResolvedName -> CtxDoc
+prettyInfixResolvedName resolved =
+    bticksWhen (resolved.typ == IdentifierName) $ prettyResolvedNamePlain resolved
+  where
+    bticksWhen :: Bool -> CtxDoc -> CtxDoc
+    bticksWhen False d = d
+    bticksWhen True  d = PP.hcat [PP.char '`', d, PP.char '`']
diff --git a/src-internal/HsBindgen/Backend/HsModule/Pretty/Type.hs b/src-internal/HsBindgen/Backend/HsModule/Pretty/Type.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Pretty/Type.hs
@@ -0,0 +1,88 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# LANGUAGE UndecidableSuperClasses #-}
+
+module HsBindgen.Backend.HsModule.Pretty.Type (
+    prettyType
+    -- * Precedences
+  , funPrec
+  , funPrec1
+  , eqPrec
+  , eqPrec1
+  , appPrec
+  , appPrec1
+  ) where
+
+import DeBruijn (Add (..), EmptyCtx, Env (..), lookupEnv)
+import Text.SimplePrettyPrint (CtxDoc, Pretty (..), (<+>), (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.HsModule.Names
+import HsBindgen.Backend.HsModule.Pretty.Common
+import HsBindgen.Backend.SHs.AST.Type
+
+{-------------------------------------------------------------------------------
+  Type pretty-printing
+-------------------------------------------------------------------------------}
+
+instance ctx ~ EmptyCtx => Pretty (SType ctx) where
+  prettyPrec = prettyType EmptyEnv
+
+prettyType :: Env ctx CtxDoc -> Int -> SType ctx -> CtxDoc
+prettyType env prec ty = case ty of
+      TGlobal g -> pretty $ resolveGlobal g
+      TClass cls -> pretty $ resolveGlobal $ typeClassGlobal cls
+      TCon n -> pretty n
+      TFree var -> pretty var
+      TLit n -> PP.show n
+      TStrLit s -> PP.string (show s)
+      TExt i -> pretty i
+      TFun a b -> PP.parensWhen (prec > funPrec) $
+        prettyType env funPrec1 a <+> "->" <+> prettyType env funPrec b
+      TBound x -> lookupEnv x env
+      TUnit -> PP.string "()"
+      TForall hints add ctxt body ->
+        case add of
+          AZ -> PP.hsep (map (\ ct -> prettyType env 0 ct <+> "=> ") ctxt) >< prettyType env 0 body
+          _  -> withFreshNames env add hints $ \env' params ->
+            "forall" <+> PP.hsep params >< "." <+>
+            PP.hsep (map (\ ct -> prettyType env' 0 ct <+> "=>") ctxt) <+> prettyType env' 0 body
+
+      --We print tuples without sections if we can
+      TApps (TBoxedTup n) args ->
+        let decls = prettyType env 0 <$> args
+        in  prettyBoxedTuple n decls
+      TBoxedTup n -> prettyBoxedTuple n []
+
+      -- When the type operator is fully applied, we print it with infix
+      -- notation. If it is not fully applied (or is applied to too many types),
+      -- we print the operator with prefix notation. Sections are not supported
+      -- for type operators.
+      TApps TEq [l, r] ->
+        prettyType env eqPrec1 l <+> prettyResolvedNamePlain typeEquality <+> prettyType env eqPrec1 r
+      TEq -> pretty typeEquality
+
+      -- This case should be last, so that TApps cases and their alternatives
+      -- are matched on first
+      TApp c x -> PP.parensWhen (prec > appPrec) $
+        prettyType env appPrec c <+> prettyType env appPrec1 x
+      TList x -> PP.brackets (prettyType env 0 x)
+
+typeEquality :: ResolvedName
+typeEquality = resolveGlobal $ bindgenGlobalType TypeEquality_type
+
+{-------------------------------------------------------------------------------
+  Precedences
+-------------------------------------------------------------------------------}
+
+funPrec, funPrec1 :: Int
+funPrec = 0
+funPrec1 = funPrec + 1
+
+eqPrec, eqPrec1 :: Int
+eqPrec = 4
+eqPrec1 = eqPrec + 1
+
+appPrec, appPrec1:: Int
+appPrec = 10
+appPrec1 = appPrec + 1
diff --git a/src-internal/HsBindgen/Backend/HsModule/Render.hs b/src-internal/HsBindgen/Backend/HsModule/Render.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Render.hs
@@ -0,0 +1,16 @@
+module HsBindgen.Backend.HsModule.Render (
+    render
+  ) where
+
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Backend.HsModule.Pretty ()
+import HsBindgen.Backend.HsModule.Translation
+
+{-------------------------------------------------------------------------------
+  Rendering
+-------------------------------------------------------------------------------}
+
+-- | Render generated bindings
+render :: HsModule -> String
+render = (++ "\n") . PP.renderPretty (PP.mkContext 80)
diff --git a/src-internal/HsBindgen/Backend/HsModule/Translation.hs b/src-internal/HsBindgen/Backend/HsModule/Translation.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Translation.hs
@@ -0,0 +1,466 @@
+module HsBindgen.Backend.HsModule.Translation (
+    -- * GhcPragma
+    GhcPragma (..)
+    -- * ImportListItem
+  , ImportListItem(..)
+    -- * Export list
+  , ExportEntry(..)
+  , ExportItem(..)
+  , resolveDeclExports
+    -- * HsModule
+  , HsModule(..)
+    -- * Translation
+  , translateModuleMultiple
+  , translateModuleSingle
+  ) where
+
+import Data.Foldable qualified as Foldable
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Extensions
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.HsModule.Names
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Backend.SHs.AST.Expr (FBind (FBind))
+import HsBindgen.Config.Prelims
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  GhcPragma
+-------------------------------------------------------------------------------}
+
+-- | GHC Pragma
+--
+-- Example: @LANGUAGE NoImplicitPrelude@
+newtype GhcPragma = GhcPragma { unGhcPragma :: String }
+  deriving newtype (Eq, Ord, IsString)
+
+{-------------------------------------------------------------------------------
+  ImportListItem
+-------------------------------------------------------------------------------}
+
+-- | Import list item
+data ImportListItem =
+    QualifiedImportListItem   Hs.ModuleName (Maybe String)
+    -- An empty import list (@Just []@) means "import instances only", and
+    -- differs greatly from having no import list (@Nothing@), which is an open,
+    -- unqualified import.
+  | UnqualifiedImportListItem Hs.ModuleName (Maybe [ResolvedName])
+  deriving stock (Eq, Ord)
+
+{-------------------------------------------------------------------------------
+  Export list
+-------------------------------------------------------------------------------}
+
+-- | An entry in the module export list.
+--
+-- Sections nest naturally: an 'ExportSection' carries its own children, so
+-- depth is implicit in the tree structure rather than tracked as an integer
+-- on each header.  The pretty-printer derives Haddock @*@ count from the
+-- recursion depth.
+--
+-- Example: a top-level @api_version_t@ followed by a @Core Data Types@
+-- group containing a record and a derived pattern synonym is rendered as:
+--
+-- > [ ExportEntry (ExportTypeAll "Api_version_t")
+-- > , ExportSection [TextContent "Core Data Types"]
+-- >     [ ExportEntry (ExportTypeAll "Config_t")
+-- >     , ExportEntry (ExportPattern "COLOR_RED")
+-- >     ]
+-- > ]
+data ExportEntry =
+    ExportEntry ExportItem
+    -- | A Haddock section header carrying its title (as inline content,
+    -- so it can mix bold\/italic\/monospace markup) and its nested children.
+  | ExportSection [HsDoc.CommentInlineContent] [ExportEntry]
+
+-- | An item in the module export list
+data ExportItem =
+    -- | Export a type with all its constructors and fields: @TypeName(..)@
+    ExportTypeAll Text
+    -- | Export a plain name (type without constructors, or term-level binding)
+  | ExportName Text
+    -- | Export a pattern synonym: @pattern PatName@
+  | ExportPattern Text
+
+{-------------------------------------------------------------------------------
+  HsModule
+-------------------------------------------------------------------------------}
+
+-- | Haskell module
+data HsModule = HsModule {
+      pragmas        :: [GhcPragma]
+    , name           ::  Hs.ModuleName
+    , exports        :: [ExportEntry]
+    , imports        :: [ImportListItem]
+    , qualifiedStyle :: QualifiedStyle
+      -- | Root directives, prepended to the CAPI wrapper source
+    , rootDirectives :: [C.RootDirective C.HashIncludeArg]
+    , cWrappers      :: [CWrapper]
+    , decls          :: [SDecl]
+    }
+
+{-------------------------------------------------------------------------------
+  Translation
+-------------------------------------------------------------------------------}
+
+translateModuleMultiple ::
+     FieldNamingStrategy
+  -> ModuleRenderConfig
+  -> [C.RootDirective C.HashIncludeArg]
+  -> BaseModuleName
+  -> ([SDecl] -> [ExportEntry])
+  -> ByCategory_ ([CWrapper], [SDecl])
+  -> ByCategory_ (Maybe HsModule)
+translateModuleMultiple fns mrc dirs moduleBaseName resolveExports declsByCat =
+    mapWithCategory_ go declsByCat
+  where
+    go :: Category -> ([CWrapper], [SDecl]) -> Maybe HsModule
+    go _ ([], []) = Nothing
+    go cat xs     = Just $
+      translateModule' fns mrc dirs (Just cat) moduleBaseName resolveExports xs
+
+translateModuleSingle ::
+     FieldNamingStrategy
+  -> ModuleRenderConfig
+  -> [C.RootDirective C.HashIncludeArg]
+  -> BaseModuleName
+  -> ([SDecl] -> [ExportEntry])
+  -> ByCategory_ ([CWrapper], [SDecl])
+  -> HsModule
+translateModuleSingle fns mrc dirs name resolveExports declsByCat =
+    translateModule' fns mrc dirs Nothing name resolveExports $
+      Foldable.fold declsByCat
+
+translateModule' ::
+     FieldNamingStrategy
+  -> ModuleRenderConfig
+  -> [C.RootDirective C.HashIncludeArg]
+  -> Maybe Category
+  -> BaseModuleName
+  -> ([SDecl] -> [ExportEntry])
+  -> ([CWrapper], [SDecl])
+  -> HsModule
+translateModule' fns mrc dirs mcat moduleBaseName resolveExports (cWrappers, decs) =
+    HsModule{
+        pragmas        = resolvePragmas fns mrc.qualifiedStyle cWrappers decs
+      , exports        = resolveExports decs
+      , imports        = resolveImports moduleBaseName mcat cWrappers decs
+      , name           = fromBaseModuleName moduleBaseName mcat
+      , qualifiedStyle = mrc.qualifiedStyle
+      , rootDirectives = dirs
+      , cWrappers      = cWrappers
+      , decls          = decs
+      }
+
+{-------------------------------------------------------------------------------
+  Auxiliary: Pragma resolution
+-------------------------------------------------------------------------------}
+
+resolvePragmas :: FieldNamingStrategy -> QualifiedStyle -> [CWrapper] -> [SDecl] -> [GhcPragma]
+resolvePragmas fieldNaming qualStyle wrappers ds =
+    Set.toAscList . mconcat $
+      noImplicitPreludePragma
+        : omitFieldPrefixesPragmas
+        : haddockPrunePragmas
+        : userlandCapiPragmas
+        : qualifiedPostPragma
+        : map (resolveDeclPragmas fieldNaming) ds
+  where
+    -- Generated modules import every name they use; see 'resolveImports'.
+    noImplicitPreludePragma :: Set GhcPragma
+    noImplicitPreludePragma = Set.singleton "LANGUAGE NoImplicitPrelude"
+
+    -- 'NoFieldSelectors' is the negation of the default-on 'FieldSelectors' and
+    -- so cannot be carried in the positive 'TH.Extension' set (see
+    -- 'HsBindgen.Backend.Extensions.omitFieldPrefixesExtensions'); we emit it as
+    -- a module pragma directly. Without top-level field selectors, an unprefixed
+    -- field name cannot clash with a non-field declaration of the same name.
+    omitFieldPrefixesPragmas :: Set GhcPragma
+    omitFieldPrefixesPragmas = case fieldNaming of
+      AddFieldPrefixes  -> Set.empty
+      OmitFieldPrefixes -> Set.singleton "LANGUAGE NoFieldSelectors"
+    userlandCapiPragmas :: Set GhcPragma
+    userlandCapiPragmas = case wrappers of
+      []  -> Set.empty
+      _xs -> Set.singleton "LANGUAGE TemplateHaskell"
+
+    haddockPrunePragmas :: Set GhcPragma
+    haddockPrunePragmas = case wrappers of
+      []  -> Set.empty
+      _xs -> Set.singleton "OPTIONS_HADDOCK prune"
+
+    qualifiedPostPragma :: Set GhcPragma
+    qualifiedPostPragma = case qualStyle of
+      PreQualified  -> Set.empty
+      PostQualified -> Set.singleton "LANGUAGE ImportQualifiedPost"
+
+resolveDeclPragmas :: FieldNamingStrategy -> SDecl -> Set GhcPragma
+resolveDeclPragmas fieldNaming decl =
+    Set.map f (requiredExtensions fieldNaming decl)
+  where
+    f ext = GhcPragma ("LANGUAGE " ++ show ext)
+
+{-------------------------------------------------------------------------------
+  Auxiliary: Import resolution
+-------------------------------------------------------------------------------}
+
+-- | Resolve imports in a list of declarations
+resolveImports ::
+     BaseModuleName
+  -> Maybe Category
+  -> [CWrapper]
+  -> [SDecl]
+  -> [ImportListItem]
+resolveImports baseModule cat wrappers ds =
+    let acc = mconcat $ map resolveDeclImports ds
+    in  Set.toAscList . mconcat $
+            bindingCatImport acc.requireTypes
+          : Set.map (uncurry QualifiedImportListItem) (userlandCapiImport <> acc.qualified)
+          : map (Set.singleton . uncurry mkUImportListItem) (Map.toList acc.unqualified)
+  where
+    mkUImportListItem :: Hs.ModuleName -> Set ResolvedName -> ImportListItem
+    mkUImportListItem m xs = UnqualifiedImportListItem m (Just $ Set.toAscList xs)
+
+    bindingCatImport :: Bool -> Set ImportListItem
+    bindingCatImport requireTypes = case requireTypes of
+      False -> mempty
+      True  -> case cat of
+        Nothing    -> mempty
+        Just CType -> mempty
+        _otherCat  ->
+          let moduleName = fromBaseModuleName baseModule (Just CType)
+          in  Set.singleton $ UnqualifiedImportListItem moduleName Nothing
+
+    userlandCapiImport :: Set (Hs.ModuleName, Maybe String)
+    userlandCapiImport = case wrappers of
+      []  -> mempty
+      _xs -> Set.singleton (capiModule, Nothing)
+
+-- | Accumulator for resolving imports
+--
+-- Both qualified imports and unqualified imports are accumulated.
+data ImportAcc = ImportAcc {
+      requireTypes :: Bool
+    , qualified    :: Set (Hs.ModuleName, Maybe String)
+    , unqualified  :: Map Hs.ModuleName (Set ResolvedName)
+    }
+
+instance Semigroup ImportAcc where
+  a <> b = ImportAcc{
+        requireTypes = combineWith (||)                 (.requireTypes)
+      , qualified    = combineWith (<>)                 (.qualified)
+      , unqualified  = combineWith (Map.unionWith (<>)) (.unqualified)
+      }
+    where
+      combineWith :: (a -> a -> a) -> (ImportAcc -> a) -> a
+      combineWith op f = f a `op` f b
+
+instance Monoid ImportAcc where
+  mempty = ImportAcc{
+        requireTypes = False
+      , qualified    = mempty
+      , unqualified  = mempty
+      }
+
+-- | Resolve imports in a declaration
+resolveDeclImports :: SDecl -> ImportAcc
+resolveDeclImports = \case
+    DTypSyn typSyn -> mconcat [
+        resolveTypeImports typSyn.typ
+      ]
+    DInst inst -> mconcat $ concat [
+        [resolveTypeClassImports inst.clss]
+      , map resolveTypeImports inst.args
+      , [ resolveTypeImports t | t <- inst.super ]
+      , concat [
+           resolveGlobalImports t : resolveTypeImports r : map resolveTypeImports as
+         | (t, as, r) <- inst.types
+         ]
+      , concat [
+            [resolveGlobalImports f, resolveExprImports e]
+          | (f, e) <- inst.decs
+          ]
+      ]
+    DRecord record -> mconcat [
+        mconcat $ map (resolveTypeImports . (.typ)) record.fields
+      , resolveNestedDeriv record.deriv
+      ]
+    DEmptyData _name ->
+      mempty
+    DNewtype newtyp -> mconcat [
+        resolveTypeImports newtyp.field.typ
+      , resolveNestedDeriv newtyp.deriv
+      ]
+    DDerivingInstance deriv -> mconcat [
+        resolveStrategyImports deriv.strategy
+      , resolveTypeImports deriv.typ
+      ]
+    DForeignImport foreignImport -> mconcat [
+        foldMap (resolveTypeImports . (.typ)) foreignImport.parameters
+      , resolveTypeImports foreignImport.result.typ
+      ]
+    DBinding binding -> mconcat [
+        foldMap (resolveTypeImports . (.typ)) binding.parameters
+      , resolveTypeImports binding.result.typ
+      , resolveExprImports binding.body
+      ]
+    DPatternSynonym patSyn -> mconcat [
+        resolveTypeImports patSyn.typ
+      , resolvePatExprImports patSyn.rhs
+      ]
+    DCompletePragma _completePragma ->
+      mempty
+
+-- | Resolve nested deriving clauses (part of a datatype declaration)
+resolveNestedDeriv :: [(Hs.Strategy ClosedType, [Inst.TypeClass])] -> ImportAcc
+resolveNestedDeriv = mconcat . map aux
+  where
+    aux :: (Hs.Strategy ClosedType, [Inst.TypeClass]) -> ImportAcc
+    aux (strategy, cls) = mconcat $
+          resolveStrategyImports strategy
+        : map resolveTypeClassImports cls
+
+resolveTypeClassImports :: Inst.TypeClass -> ImportAcc
+resolveTypeClassImports = resolveGlobalImports . typeClassGlobal
+
+-- | Resolve global imports
+resolveGlobalImports :: Global c -> ImportAcc
+resolveGlobalImports global =
+    case resolved.hsImport of
+      Hs.QualifiedImport m as -> ImportAcc{
+          requireTypes = False
+        , qualified    = Set.singleton (m, as)
+        , unqualified  = mempty
+        }
+      Hs.UnqualifiedImport m -> ImportAcc{
+          requireTypes = False
+        , qualified    = mempty
+        , unqualified  = Map.singleton m (Set.singleton resolved)
+        }
+  where
+    resolved :: ResolvedName
+    resolved = resolveGlobal global
+
+-- | Resolve imports in an expression
+resolveExprImports :: SExpr ctx -> ImportAcc
+resolveExprImports = \case
+    EGlobal g -> resolveGlobalImports g
+    EBound _x -> mempty
+    EFree {} -> mempty
+    ECon _n -> mempty
+    EIntegral _ t -> maybe mempty resolveTypeImports t
+    EUnboxedIntegral _ -> mempty
+    ECChar {} -> mempty
+    EString {} -> mempty
+    ECString {} -> resolveGlobalImports (bindgenGlobalTerm ByteString_pack)
+    EFloat _ t -> resolveTypeImports t
+    EDouble _ t -> resolveTypeImports t
+    EApp f x -> resolveExprImports f <> resolveExprImports x
+    EInfix op x y ->
+      resolveGlobalImports (infixOpGlobal op) <> resolveExprImports x <> resolveExprImports y
+    ELam _mPat body -> resolveExprImports body
+    EUnusedLam body -> resolveExprImports body
+    ECase x alts -> mconcat $
+        resolveExprImports x
+      : [ case alt of
+            SAlt _con _add _hints body -> resolveExprImports body
+            SAltNoConstr _hints body -> resolveExprImports body
+            SAltUnboxedTuple _add _hints body -> resolveExprImports body
+        | alt <- alts
+        ]
+    EUnit -> mempty
+    EBoxedTup{} -> mempty
+    EUnboxedTup{} -> mempty
+    EList xs -> foldMap resolveExprImports xs
+    ETypeApp f t -> resolveExprImports f <> resolveTypeImports t
+    ERecCon _con fbinds -> foldMap resolveFBindImports fbinds
+
+resolveFBindImports :: FBind ctx -> ImportAcc
+resolveFBindImports (FBind _label expr) = resolveExprImports expr
+
+-- | Resolve imports in a pattern|expression
+resolvePatExprImports :: PatExpr -> ImportAcc
+resolvePatExprImports = \case
+    PEApps _n xs -> foldMap resolvePatExprImports xs
+    PELit _      -> mempty
+
+-- | Resolve imports in a type
+resolveTypeImports :: SType ctx -> ImportAcc
+resolveTypeImports = \case
+    TGlobal g -> resolveGlobalImports g
+    TClass cls -> resolveTypeClassImports cls
+    TCon _n -> ImportAcc {
+        requireTypes = True
+      , qualified    = mempty
+      , unqualified  = mempty
+      }
+    TFree _ -> mempty
+    TLit _n -> mempty
+    TStrLit _s -> mempty
+    TExt ref -> resolveExtHsRefImports ref
+    TApp c x -> resolveTypeImports c <> resolveTypeImports x
+    TFun a b -> resolveTypeImports a <> resolveTypeImports b
+    TBound{} -> mempty
+    TUnit -> mempty
+    TBoxedTup{} -> mempty
+    TEq -> resolveGlobalImports (bindgenGlobalType TypeEquality_type)
+    TForall _hints _qtvs ctxt body ->
+      foldMap resolveTypeImports (body:ctxt)
+    TList t -> resolveTypeImports t
+
+resolveStrategyImports :: Hs.Strategy ClosedType -> ImportAcc
+resolveStrategyImports = \case
+    Hs.DeriveNewtype -> mempty
+    Hs.DeriveStock -> mempty
+    Hs.DeriveVia ty -> resolveTypeImports ty
+
+resolveExtHsRefImports :: Hs.ExtRef -> ImportAcc
+resolveExtHsRefImports extRef = ImportAcc{
+      requireTypes = False
+    , qualified    = Set.singleton (extRef.moduleName, Nothing)
+    , unqualified  = mempty
+    }
+
+{-------------------------------------------------------------------------------
+  Auxiliary: Export resolution
+-------------------------------------------------------------------------------}
+
+-- | Resolve the export items contributed by a single declaration.
+--
+-- Returns one or more 'ExportItem' values for declarations with exported
+-- (user-facing) names; internal names and instance declarations produce
+-- the empty list (instances are auto-exported by GHC).
+resolveDeclExports :: SDecl -> [ExportItem]
+resolveDeclExports = \case
+    DTypSyn typSyn               -> exportTypeConstr typSyn.name ExportName
+    DRecord record               -> exportTypeConstr record.typ ExportTypeAll
+    DNewtype newtyp              -> exportTypeConstr newtyp.name ExportTypeAll
+    DEmptyData empty             -> exportTypeConstr empty.name ExportName
+    DForeignImport foreignImport -> exportVar foreignImport.name
+    DBinding binding             -> exportVar binding.name
+    DPatternSynonym patSyn       -> exportPattern patSyn.name
+    DCompletePragma _            -> []
+    -- Instances are automatically exported by GHC
+    DInst _                      -> []
+    DDerivingInstance _          -> []
+  where
+    exportTypeConstr :: Hs.Name Hs.NsTypeConstr -> (Text -> ExportItem) -> [ExportItem]
+    exportTypeConstr name mkItem = [mkItem name.text]
+
+    exportVar :: Hs.TermName -> [ExportItem]
+    exportVar name = case name of
+      Hs.ExportedName n -> [ExportName n.text]
+      Hs.InternalName _ -> []
+
+    exportPattern :: Hs.Name Hs.NsConstr -> [ExportItem]
+    exportPattern name = [ExportPattern name.text]
diff --git a/src-internal/HsBindgen/Backend/HsModule/Translation/Doxygen.hs b/src-internal/HsBindgen/Backend/HsModule/Translation/Doxygen.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/HsModule/Translation/Doxygen.hs
@@ -0,0 +1,291 @@
+-- | Doxygen-driven export resolution
+--
+-- Builds a hierarchical 'ExportEntry' tree from a flat list of 'SDecl' values
+-- and an 'ExportTags' map.  Section nesting is intrinsic to the tree: depth
+-- corresponds to recursion level, so the pretty-printer never has to carry an
+-- explicit depth field.
+--
+-- Per-declaration tag computation lives upstream (see @computeExportTags@ in
+-- "HsBindgen") and walks the final C declarations.  Consumers here perform a
+-- single 'ExportTags' lookup keyed by the Haskell export name: no fallbacks,
+-- no rediscovery of C information from the Hs AST.
+module HsBindgen.Backend.HsModule.Translation.Doxygen (
+    ExportTags
+  , ExportGroupTag(..)
+  , computeExportTags
+  , resolveExports
+  ) where
+
+import Data.List (partition)
+import Data.Map.Strict qualified as Map
+
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.HsModule.Translation (ExportEntry (..), ExportItem,
+                                               resolveDeclExports)
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.MangleNames.IsPass (FlamNames (..),
+                                                   TypedefNames (..))
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+
+import Doxygen.Parser (Doxygen, lookupGroupInfo, lookupGroupMembership)
+
+{-------------------------------------------------------------------------------
+  ExportTags
+-------------------------------------------------------------------------------}
+
+-- | Per-Haskell-name precomputed export-section tag.
+--
+-- Computed at the C-declaration level (see @computeExportTags@ in "HsBindgen")
+-- and consumed by 'resolveExports'. Keys are Haskell names as they appear in
+-- the export list.
+--
+-- Backend-synthesised companion declarations such as the @_Aux@ newtypes
+-- generated from typedef function pointers, or the FLAM auxiliary struct, are
+-- inserted under their own Haskell name and inherit the tag of their parent
+-- C declaration. This makes 'resolveExports' a single-step lookup.
+--
+-- A missing key is interpreted as 'Derived', meaning the declaration inherits
+-- the preceding 'Grouped' section in source order. Top-level C declarations
+-- without group membership are explicitly inserted as 'Ungrouped'.
+--
+-- Example: for a header with an ungrouped @api_version_t@ and a
+-- @\@defgroup core "Core"@ containing @config_t@ plus an @enum color@:
+--
+-- > fromList
+-- >   [ ("Api_version_t", Ungrouped)
+-- >   , ("Config_t",      Grouped ["Core"])
+-- >   , ("Color",         Grouped ["Core"])
+-- >   ]
+type ExportTags = Map Text ExportGroupTag
+
+{-------------------------------------------------------------------------------
+  Tagging
+-------------------------------------------------------------------------------}
+
+-- | How a declaration relates to doxygen group sections.
+data ExportGroupTag =
+    -- | Top-level C declaration not in any doxygen group.  Hoisted before
+    -- all section headers by 'resolveExports'.
+    Ungrouped
+    -- | Backend-derived declaration (e.g. pattern synonyms, untagged inner
+    -- types) without its own group membership.  Inherits the enclosing
+    -- section from the preceding grouped declaration.
+  | Derived
+    -- | Member of a doxygen group.  The path lists section titles from
+    -- root to leaf (e.g. @[\"Outer Group\", \"Inner A\"]@).
+  | Grouped [Text]
+
+-- | Build an 'ExportTags' map from Doxygen metadata and the final C
+-- declarations.
+--
+-- The resulting map is keyed by Haskell name. 'resolveExports' performs a single
+-- lookup with no fallbacks.
+--
+-- For each 'C.Decl Final':
+--
+--  * If the originating C name belongs to a @\@defgroup@, the tag is
+--    @'Grouped' path@ (root-to-leaf section titles).
+--  * Otherwise, if the declaration is top-level (@null info.enclosing@), the
+--    tag is 'Ungrouped' and the declaration is explicitly hoisted before any
+--    section headers in the export list.
+--  * Otherwise (nested, no group), the declaration is omitted from the map.
+--    Missing keys are interpreted as 'Derived' by 'resolveExports', so the
+--    declaration inherits the preceding 'Grouped' section in source order.
+--
+-- Backend-synthesised companion declarations are inserted under their own
+-- Haskell name with the same tag as their parent:
+--
+--  * Typedef function pointers contribute an auxiliary newtype @F_Aux@ whose
+--    name comes from @typedef.names.aux@; the @_Aux@ form is delayed during
+--    Hs translation and therefore not adjacent to its parent in source
+--    order, so an entry under its own Hs name is necessary to keep it in
+--    its parent's section.
+--  * Structs with flexible array members contribute an auxiliary type whose
+--    name comes from the @FlamNames@ carried by the struct's @C.Flam@ field
+--    (@struct.flam@); same reasoning.
+--
+-- Example: given a C header with
+--
+-- > /** @defgroup core "Core Data Types" @{ */
+-- > typedef struct { ... } config_t;
+-- > /** @} */
+--
+-- and the Haskell name @Config_t@, this produces:
+--
+-- > fromList [("Config_t", Grouped ["Core Data Types"])]
+computeExportTags :: Doxygen -> [C.Decl l Final] -> ExportTags
+computeExportTags doxy decls =
+    Map.fromList $ concatMap declTagEntries decls
+  where
+    declTagEntries :: C.Decl l Final -> [(Text, ExportGroupTag)]
+    declTagEntries decl =
+        case declTag decl of
+          Nothing  -> []
+          Just tag ->
+            (decl.info.id.hsName.text, tag) : auxEntries decl.kind tag
+
+    -- | Compute the tag for a top-level or grouped declaration.  Returns
+    -- 'Nothing' for nested declarations without a group (those flow through
+    -- as 'Derived' by lookup miss in 'resolveExports').
+    declTag :: C.Decl l Final -> Maybe ExportGroupTag
+    declTag decl =
+      case groupPath decl.info.id.cName.name.text of
+        Just path -> Just (Grouped path)
+        Nothing
+          | null decl.info.enclosing -> Just Ungrouped
+          | otherwise                -> Nothing
+
+    -- | Extra entries for backend-synthesised companion decls that share
+    -- their parent's group membership.
+    auxEntries :: C.DeclKind l Final -> ExportGroupTag -> [(Text, ExportGroupTag)]
+    auxEntries kind tag = case kind of
+      C.DeclTypedef typedef
+        | Just (auxName, _) <- typedef.names.aux ->
+            [(auxName.text, tag)]
+      C.DeclStruct struct
+        | C.Flam _ flamNames <- struct.flam ->
+            [(flamNames.aux.text, tag)]
+      _ -> []
+
+    -- | Resolve the full group title path (root to leaf) for a C name.
+    --
+    -- Walks the Doxygen group hierarchy upward from the declaration's
+    -- immediate group to the root, collecting titles along the way.
+    --
+    -- > groupPath "config_t"
+    -- >   -- lookupGroupMembership → Just "core_types"
+    -- >   -- lookupGroupInfo "core_types" → Just ("Core Data Types", Nothing)
+    -- >   ==> Just ["Core Data Types"]
+    -- >
+    -- > groupPath "inner_typ"
+    -- >   -- lookupGroupMembership → Just "inner_a"
+    -- >   -- lookupGroupInfo "inner_a" → Just ("Inner A", Just "outer")
+    -- >   -- lookupGroupInfo "outer"   → Just ("Outer Group", Nothing)
+    -- >   ==> Just ["Outer Group", "Inner A"]
+    groupPath :: Text -> Maybe [Text]
+    groupPath declName = do
+      groupName <- lookupGroupMembership declName doxy
+      (title, mParent) <- lookupGroupInfo groupName doxy
+      pure $ buildPath [title] mParent
+
+    -- | Accumulate group titles from leaf to root, prepending each parent.
+    buildPath :: [Text] -> Maybe Text -> [Text]
+    buildPath acc Nothing = acc
+    buildPath acc (Just parentName) =
+      case lookupGroupInfo parentName doxy of
+        Just (parentTitle, grandparent) ->
+          buildPath (parentTitle : acc) grandparent
+        Nothing -> acc
+
+{-------------------------------------------------------------------------------
+  Public entry point
+-------------------------------------------------------------------------------}
+
+-- | Resolve exports for a declaration list using precomputed export tags.
+--
+-- The export list is assembled in three stages:
+--
+--  1. __Tag__ each export item by looking up the declaration's Haskell name
+--     in 'ExportTags'.  A missing key yields 'Derived'.
+--  2. __Assign paths__ to 'Derived' items by inheriting the most-recent
+--     'Grouped' path.  Items appearing before any 'Grouped' get no path
+--     and are hoisted alongside ungrouped items.
+--  3. __Build the tree__: items with paths are folded into a recursive
+--     'ExportEntry' tree where consecutive items sharing a path prefix
+--     are nested under the same 'ExportSection'.  Depth is implicit in
+--     the tree structure.
+--
+resolveExports :: ExportTags -> [SDecl] -> [ExportEntry]
+resolveExports tags decls =
+    let assigned             = assignPaths (concatMap (taggedExports tags) decls)
+        (pathless, withPath) = partition (isNothing . fst) assigned
+        pathlessEntries      = [ ExportEntry item | (_, item) <- pathless ]
+        treeEntries          = buildTree [ (p, item) | (Just p, item) <- withPath ]
+    in  pathlessEntries ++ treeEntries
+
+{-------------------------------------------------------------------------------
+  Tag pipeline
+-------------------------------------------------------------------------------}
+
+-- | Pair each export item produced by a declaration with its tag.
+--
+-- A single 'SDecl' can produce multiple export items (e.g. a record type
+-- exports both @TypeName(..)@ and its pattern synonyms).  All items derived
+-- from one declaration share the declaration's tag.
+taggedExports :: ExportTags -> SDecl -> [(ExportGroupTag, ExportItem)]
+taggedExports tags decl =
+    let tag = case sdeclExportedName decl of
+          Just n  -> Map.findWithDefault Derived n tags
+          Nothing -> Derived
+    in [ (tag, item) | item <- resolveDeclExports decl ]
+
+-- | Replace 'Derived' tags with the most-recent 'Grouped' path.
+--
+-- 'Ungrouped' items always get @Nothing@; 'Grouped' items get their own
+-- path.  'Derived' items inherit the @Just _@ from the closest preceding
+-- 'Grouped'; if none has occurred yet, they get @Nothing@ (and end up
+-- hoisted with the ungrouped items).
+assignPaths
+  :: [(ExportGroupTag, ExportItem)]
+  -> [(Maybe [Text], ExportItem)]
+assignPaths = go Nothing
+  where
+    go _   []                         = []
+    go cur ((Ungrouped,   i) : rest)  = (Nothing, i) : go cur  rest
+    go _   ((Grouped p,   i) : rest)  = (Just p, i)  : go (Just p) rest
+    go cur ((Derived,     i) : rest)  = (cur, i)     : go cur  rest
+
+{-------------------------------------------------------------------------------
+  Tree assembly
+-------------------------------------------------------------------------------}
+
+-- | Build a hierarchical export tree from items in source order.
+--
+-- Each item carries the remaining path beneath the current recursion point:
+-- an empty path means the item belongs at this level; a non-empty path
+-- starts a (or continues an existing) sub-section under its head segment.
+-- Consecutive items sharing the same head segment are grouped under one
+-- 'ExportSection' and the recursion descends one level after stripping it.
+buildTree :: [([Text], ExportItem)] -> [ExportEntry]
+buildTree []                      = []
+buildTree (([], item) : rest)     = ExportEntry item : buildTree rest
+buildTree items@((seg : _, _) : _) =
+    let (here, after) = span (startsWith seg) items
+        children      = buildTree (map (first (drop 1)) here)
+    in  ExportSection [HsDoc.TextContent seg] children : buildTree after
+  where
+    startsWith :: Text -> ([Text], a) -> Bool
+    startsWith s (s' : _, _) = s == s'
+    startsWith _ _           = False
+
+{-------------------------------------------------------------------------------
+  Declaration introspection
+-------------------------------------------------------------------------------}
+
+-- | Extract the user-facing Haskell name from a declaration.
+--
+-- Type-constructor and pattern-synonym names are always exported.  Term-level
+-- names ('DForeignImport', 'DBinding') may be internal helpers, in which case
+-- 'Nothing' is returned.  Instances and deriving-instances return 'Nothing'.
+sdeclExportedName :: SDecl -> Maybe Text
+sdeclExportedName = \case
+    DTypSyn typSyn               -> Just typSyn.name.text
+    DRecord record               -> Just record.typ.text
+    DNewtype newtyp              -> Just newtyp.name.text
+    DEmptyData empty             -> Just empty.name.text
+    DForeignImport foreignImport -> termText foreignImport.name
+    DBinding binding             -> termText binding.name
+    DPatternSynonym patSyn       -> Just patSyn.name.text
+    DCompletePragma _            -> Nothing
+    DInst _                      -> Nothing
+    DDerivingInstance _          -> Nothing
+  where
+    termText :: Hs.TermName -> Maybe Text
+    termText = \case
+      Hs.ExportedName n -> Just n.text
+      Hs.InternalName _ -> Nothing
diff --git a/src-internal/HsBindgen/Backend/Level.hs b/src-internal/HsBindgen/Backend/Level.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Level.hs
@@ -0,0 +1,7 @@
+module HsBindgen.Backend.Level (
+    Level(..)
+  ) where
+
+-- | Separate things that live on the type and term level
+data Level = LvlType | LvlTerm
+  deriving stock (Eq, Ord, Show)
diff --git a/src-internal/HsBindgen/Backend/Runtime.hs b/src-internal/HsBindgen/Backend/Runtime.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/Runtime.hs
@@ -0,0 +1,136 @@
+{-# LANGUAGE TemplateHaskellQuotes #-}
+
+-- | Centralized table of the @hs-bindgen-runtime@ modules that the generator
+-- refers to by name.
+--
+-- Most paths are derived from a representative name defined in the module (via
+-- 'TH' quotes), so renaming a runtime module only requires updating its one
+-- @import ... qualified as@ line below: the compiler re-derives the path, and a
+-- stale reference fails to compile. The exceptions are the /re-export-only/
+-- modules ('Support', 'CompatHasField', 'LibC'): a re-exported name
+-- resolves to its /defining/ module (e.g. @''RIP.Ptr@ resolves to "GHC.Ptr"),
+-- so Template Haskell cannot recover the re-export module's own path. For those
+-- we keep an explicit, centralized module name and rely on the guard test
+-- (@Test.HsBindgen.Unit.Runtime@) to catch a rename that misses the table.
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Backend.Runtime (RuntimeModule)
+-- > import HsBindgen.Backend.Runtime qualified as Runtime
+module HsBindgen.Backend.Runtime (
+    RuntimeModule(..)
+  , moduleName
+  , qualifiedImport
+  ) where
+
+import Data.Text qualified as Text
+import Language.Haskell.TH qualified as TH
+
+import HsBindgen.Runtime.BitfieldPtr qualified as BitfieldPtr
+import HsBindgen.Runtime.Block qualified as Block
+import HsBindgen.Runtime.CEnum qualified as CEnum
+import HsBindgen.Runtime.ConstantArray qualified as CA
+import HsBindgen.Runtime.FLAM qualified as FLAM
+import HsBindgen.Runtime.HasCBitfield qualified as HasCBitfield
+import HsBindgen.Runtime.HasCField qualified as HasCField
+import HsBindgen.Runtime.IncompleteArray qualified as IA
+import HsBindgen.Runtime.IsArray qualified as IsA
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+import HsBindgen.Runtime.Marshal qualified as Marshal
+import HsBindgen.Runtime.PtrConst qualified as PtrConst
+import HsBindgen.Runtime.Struct qualified as Struct
+import HsBindgen.Runtime.Support.CAPI qualified as CAPI
+import HsBindgen.Runtime.Union qualified as Union
+
+import HsBindgen.Errors (panicPure)
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Runtime modules
+-------------------------------------------------------------------------------}
+
+-- | A module in @hs-bindgen-runtime@ that the generator refers to by name.
+data RuntimeModule =
+    -- Modules whose path is derived from a representative name defined in them.
+    ConstantArray
+  | IncompleteArray
+  | IsArray
+  | Marshal
+  | Flam
+  | HasCField
+  | BitfieldPtr
+  | HasCBitfield
+  | PtrConst
+  | CEnum
+  | Block
+  | Union
+  | Struct
+  | CAPI
+  | Macro
+
+    -- Re-export-only modules: their path cannot be derived via Template Haskell
+    -- (see the module top-level documentation), so it is spelled out in
+    -- 'moduleName'.
+  | Support
+  | CompatHasField
+  | LibC
+  deriving stock (Bounded, Enum, Eq, Ord, Show)
+
+-- | The module path emitted for a runtime module.
+moduleName :: RuntimeModule -> Hs.ModuleName
+moduleName = \case
+    ConstantArray   -> derived ''CA.ConstantArray
+    IncompleteArray -> derived ''IA.IncompleteArray
+    IsArray         -> derived ''IsA.IsArray
+    Marshal         -> derived ''Marshal.EquivStorable
+    Flam            -> derived ''FLAM.WithFlam
+    HasCField       -> derived ''HasCField.HasCField
+    BitfieldPtr     -> derived ''BitfieldPtr.BitfieldPtr
+    HasCBitfield    -> derived ''HasCBitfield.HasCBitfield
+    PtrConst        -> derived ''PtrConst.PtrConst
+    CEnum           -> derived ''CEnum.CEnum
+    Block           -> derived ''Block.Block
+    Union           -> derived ''Union.IsUnion
+    Struct          -> derived ''Struct.IsStruct
+    CAPI            -> derived 'CAPI.addCSource
+    Macro           -> derived ''Runtime.Macro.Raw
+    -- Re-export-only modules; no self-defined name to derive from.
+    Support         -> "HsBindgen.Runtime.Support"
+    CompatHasField  -> "HsBindgen.Runtime.Support.CompatHasField"
+    LibC            -> "HsBindgen.Runtime.LibC"
+  where
+    derived :: TH.Name -> Hs.ModuleName
+    derived n = case TH.nameModule n of
+      Just m  -> Hs.ModuleName (Text.pack m)
+      Nothing -> panicPure $ "Expected name with module: " ++ show n
+
+-- | The qualified import emitted for a runtime module.
+qualifiedImport :: RuntimeModule -> Hs.Import
+qualifiedImport rm = Hs.QualifiedImport (moduleName rm) (qualifier rm)
+  where
+    -- The alias a qualified import of the runtime module uses (@Nothing@ =
+    -- import qualified with no alias, i.e. use of the fully qualified name).
+    --
+    -- Generated code reaches 'LibC' only through the standard library binding
+    -- specification, like any external module, and not through
+    -- 'qualifiedImport'; its qualifier is unused.
+    qualifier :: RuntimeModule -> Maybe String
+    qualifier = \case
+        ConstantArray   -> Just "CA"
+        IncompleteArray -> Just "IA"
+        IsArray         -> Just "IsA"
+        Marshal         -> Just "Marshal"
+        Flam            -> Just "FLAM"
+        HasCField       -> Just "HasCField"
+        BitfieldPtr     -> Just "BitfieldPtr"
+        HasCBitfield    -> Just "HasCBitfield"
+        PtrConst        -> Just "PtrConst"
+        CEnum           -> Just "CEnum"
+        Block           -> Just "Block"
+        Union           -> Just "Union"
+        Struct          -> Just "Struct"
+        CAPI            -> Nothing
+        Macro           -> Just "Macro"
+        Support         -> Just "BG"
+        CompatHasField  -> Just "BG.CompatHasField"
+        LibC            -> Nothing
diff --git a/src-internal/HsBindgen/Backend/SHs/AST.hs b/src-internal/HsBindgen/Backend/SHs/AST.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/SHs/AST.hs
@@ -0,0 +1,167 @@
+{-# LANGUAGE MagicHash #-}
+
+-- | Simplified HS abstract syntax tree
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1761>
+-- We should mark this module as intended for qualified import and avoid
+-- unnecessarily prefixes.
+module HsBindgen.Backend.SHs.AST (
+    ClosedExpr
+  , Plus2(..)
+  , applyPlus2
+  , SExpr(..)
+  , eBindgenGlobal
+  , eInt
+  , InfixOp(..)
+  , infixOpGlobal
+  , SAlt(..)
+  , PatExpr(..)
+  , SDecl(..)
+  , TypeSynonym(..)
+  , Pragma(..)
+  , ClosedType
+  , SType(..)
+  , tBindgenGlobal
+  , Binding(..)
+  , Instance(..)
+  , Field(..)
+  , Record(..)
+  , EmptyData(..)
+  , DerivingInstance(..)
+  , Newtype(..)
+  , ForeignImport(..)
+  , Safety(..)
+  , Parameter(..)
+  , Result(..)
+  , PatternSynonym(..)
+  ) where
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.AST.CompletePragma qualified as Hs
+import HsBindgen.Backend.Hs.AST.Strategy qualified as Hs
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.Hs.Origin qualified as Origin
+import HsBindgen.Backend.Level
+import HsBindgen.Backend.SHs.AST.Expr
+import HsBindgen.Backend.SHs.AST.Type
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Re-exports from SHs.AST.Expr and SHs.AST.Type
+-------------------------------------------------------------------------------}
+
+-- SExpr, ClosedExpr, SAlt, PatExpr, InfixOp, Binding, Parameter, Result,
+-- Pragma are re-exported from SHs.AST.Expr (imported above).
+-- SType, ClosedType, Plus2, applyPlus2, tBindgenGlobal are re-exported from
+-- SHs.AST.Type (imported above).
+
+{-------------------------------------------------------------------------------
+  Backend representation
+-------------------------------------------------------------------------------}
+
+-- | Simple declarations
+data SDecl =
+    DTypSyn TypeSynonym
+  | DInst Instance
+  | DRecord Record
+  | DNewtype Newtype
+  | DEmptyData EmptyData
+  | DDerivingInstance DerivingInstance
+  | DForeignImport ForeignImport
+  | DBinding Binding
+  | DPatternSynonym PatternSynonym
+  | DCompletePragma Hs.CompletePragma
+  deriving stock (Show)
+
+data TypeSynonym = TypeSynonym{
+      name    :: Hs.Name Hs.NsTypeConstr
+    , typ     :: ClosedType
+    , origin  :: Origin.Decl Origin.EmptyData
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
+
+data Instance = Instance{
+      clss    :: Inst.TypeClass
+    , args    :: [ClosedType]
+    , super   :: [ClosedType]
+    , types   :: [(Global LvlType, [ClosedType], ClosedType)]
+    , decs    :: [(Global LvlTerm, ClosedExpr)]
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
+
+data Field = Field{
+      name   :: Hs.Name Hs.NsVar
+    , typ    :: ClosedType
+    , origin :: Origin.Field
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
+
+data Record = Record{
+      typ     :: Hs.Name Hs.NsTypeConstr
+    , con     :: Hs.Name Hs.NsConstr
+    , fields  :: [Field]
+    , origin  :: Origin.Decl Origin.Struct
+    , deriv   :: [(Hs.Strategy ClosedType, [Inst.TypeClass])]
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
+
+data EmptyData = EmptyData{
+      name    :: Hs.Name Hs.NsTypeConstr
+    , origin  :: Origin.Decl Origin.EmptyData
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
+
+data DerivingInstance = DerivingInstance{
+      strategy :: Hs.Strategy ClosedType
+    , typ      :: ClosedType
+    , comment  :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
+
+data Newtype = Newtype{
+      name    :: Hs.Name Hs.NsTypeConstr
+    , con     :: Hs.Name Hs.NsConstr
+    , field   :: Field
+    , origin  :: Origin.Decl Origin.Newtype
+    , deriv   :: [(Hs.Strategy ClosedType, [Inst.TypeClass])]
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Generic, Show)
+
+data ForeignImport = ForeignImport{
+      name       :: Hs.TermName
+    , parameters :: [Parameter]
+    , result     :: Result
+    , origName   :: C.DeclName
+    , callConv   :: CallConv
+    , origin     :: Origin.ForeignImport
+    , comment    :: Maybe HsDoc.Comment
+    , safety     :: Safety
+    }
+  deriving stock (Show, Generic)
+
+-- | Safety of foreign import declarations
+data Safety = Safe | Unsafe
+  deriving stock (Show, Eq, Generic)
+
+instance Default Safety where
+  def = Safe
+
+data PatternSynonym = PatternSynonym{
+      name    :: Hs.Name Hs.NsConstr
+    , typ     :: ClosedType
+    , rhs     :: PatExpr
+    , origin  :: Origin.PatSyn
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
diff --git a/src-internal/HsBindgen/Backend/SHs/AST/Expr.hs b/src-internal/HsBindgen/Backend/SHs/AST/Expr.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/SHs/AST/Expr.hs
@@ -0,0 +1,161 @@
+{-# LANGUAGE MagicHash #-}
+
+-- | Expression and binding types for the simplified Haskell AST
+--
+-- These types have no dependency on 'HsBindgen.Backend.Hs.Origin' and can
+-- therefore be imported from 'HsBindgen.Macro.Interface' without creating a
+-- module cycle.
+--
+-- Intended for qualified import.
+module HsBindgen.Backend.SHs.AST.Expr (
+    -- * Expressions
+    ClosedExpr
+  , SExpr(..)
+  , eBindgenGlobal
+  , eInt
+  , InfixOp(..)
+  , infixOpGlobal
+  , SAlt(..)
+  , PatExpr(..)
+    -- * Records
+  , FBind (..)
+    -- * Bindings
+  , Binding(..)
+  , Parameter(..)
+  , Result(..)
+  , Pragma(..)
+  ) where
+
+import Data.ByteString (ByteString)
+import Data.Type.Nat (Nat1)
+import DeBruijn (Add, Ctx, EmptyCtx, Idx)
+import Foreign.C (CChar)
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.Level
+import HsBindgen.Backend.SHs.AST.Type
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.NameHint
+
+{-------------------------------------------------------------------------------
+  Expressions
+-------------------------------------------------------------------------------}
+
+type ClosedExpr = SExpr EmptyCtx
+
+-- | Simple expressions
+type SExpr :: Ctx -> Star
+data SExpr ctx =
+    EGlobal (Global LvlTerm)
+  | EBound (Idx ctx)
+  | EFree Hs.TermName
+  | ECon (Hs.Name Hs.NsConstr)
+  | EUnboxedIntegral Integer
+  | EIntegral Integer (Maybe ClosedType)
+  | EFloat Float ClosedType
+  | EDouble Double ClosedType
+  | ECChar CChar
+  | EString String
+  | ECString ByteString
+    -- ^ C string literal, represented as its execution-encoding bytes.
+    --
+    -- The bytes are bit-for-bit identical to what a C compiler would embed for
+    -- this literal. This is required because the generated binding may be
+    -- passed directly to a C function that expects the same byte sequence.
+  | EApp (SExpr ctx) (SExpr ctx)
+  | EInfix InfixOp (SExpr ctx) (SExpr ctx)
+  | ELam NameHint (SExpr (S ctx))
+  | EUnusedLam (SExpr ctx)
+  | ECase (SExpr ctx) [SAlt ctx]
+  | EUnit
+  | EBoxedTup Plus2
+  | EUnboxedTup Plus2
+  | EList [SExpr ctx]
+  | ETypeApp (SExpr ctx) ClosedType
+    -- | Record construction
+  | ERecCon (Hs.Name Hs.NsConstr) [FBind ctx]
+  deriving stock (Show)
+
+eBindgenGlobal :: BindgenGlobalTerm -> SExpr ctx
+eBindgenGlobal = EGlobal . bindgenGlobalTerm
+
+-- | Pattern&Expressions
+type PatExpr :: Star
+data PatExpr
+  = PEApps (Hs.Name Hs.NsConstr) [PatExpr]
+  | PELit Integer
+  deriving stock (Show)
+
+eInt :: Int -> SExpr be
+eInt i = EIntegral (fromIntegral i) (Just $ tBindgenGlobal Int_type)
+
+-- | Supported infix operators.
+data InfixOp =
+    InfixApplicative_seq
+  | InfixMonad_seq
+  | InfixNonEmpty_constructor
+  deriving stock (Show, Eq)
+
+infixOpGlobal :: InfixOp -> Global LvlTerm
+infixOpGlobal = bindgenGlobalTerm . \case
+  InfixApplicative_seq      -> Applicative_seq
+  InfixMonad_seq            -> Monad_seq
+  InfixNonEmpty_constructor -> NonEmpty_constructor
+
+-- | Case alternatives
+data SAlt ctx where
+    SAlt
+      :: Hs.Name Hs.NsConstr -> Add n ctx ctx' -> Vec n NameHint -> SExpr ctx' -> SAlt ctx
+    SAltNoConstr
+      :: Vec Nat1 NameHint -> SExpr (S ctx) -> SAlt ctx
+    SAltUnboxedTuple
+      :: Add n ctx ctx' -> Vec n NameHint -> SExpr ctx' -> SAlt ctx
+
+deriving stock instance Show (SAlt ctx)
+
+{-------------------------------------------------------------------------------
+  Records
+-------------------------------------------------------------------------------}
+
+-- | Field binding
+--
+-- Field bindings are used to for record construction and record updates
+--
+-- <https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-540003.15.3>
+data FBind ctx = FBind {
+    label :: String
+  , expr :: SExpr ctx
+  }
+  deriving stock Show
+
+{-------------------------------------------------------------------------------
+  Bindings
+-------------------------------------------------------------------------------}
+
+data Pragma = NOINLINE
+  deriving stock Show
+
+data Binding = Binding{
+      name       :: Hs.TermName
+    , parameters :: [Parameter]
+    , result     :: Result
+    , body       :: ClosedExpr
+    , pragmas    :: [Pragma]
+    , comment    :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
+
+data Parameter = Parameter{
+      typ     :: ClosedType
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
+
+data Result = Result{
+      typ     :: ClosedType
+    , comment :: Maybe HsDoc.Comment
+    }
+  deriving stock (Show, Generic)
diff --git a/src-internal/HsBindgen/Backend/SHs/AST/Type.hs b/src-internal/HsBindgen/Backend/SHs/AST/Type.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/SHs/AST/Type.hs
@@ -0,0 +1,100 @@
+{-# LANGUAGE MagicHash #-}
+
+-- | Simplified HS abstract syntax tree for types
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1761>
+-- We should mark this module as intended for qualified import and avoid
+-- unnecessarily prefixes.
+module HsBindgen.Backend.SHs.AST.Type (
+    ClosedType
+  , SType (.., TApps)
+  , tBindgenGlobal
+    -- * Plus2
+  , Plus2 (..)
+  , applyPlus2
+  ) where
+
+import DeBruijn (Add, Ctx, EmptyCtx, Idx)
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Level
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.NameHint
+
+{-------------------------------------------------------------------------------
+  Type
+-------------------------------------------------------------------------------}
+
+type ClosedType = SType EmptyCtx
+
+tBindgenGlobal :: BindgenGlobalType -> SType ctx
+tBindgenGlobal = TGlobal . bindgenGlobalType
+
+-- | Simple types
+type SType :: Ctx -> Star
+data SType ctx =
+    TGlobal (Global LvlType)
+  | TClass Inst.TypeClass
+  | TCon (Hs.Name Hs.NsTypeConstr)
+  | TFun (SType ctx) (SType ctx)
+  | TLit Natural
+  | TStrLit String
+  | TExt Hs.ExtRef
+  | TBound (Idx ctx)
+  | TFree (Hs.Name Hs.NsVar)
+  | TApp (SType ctx) (SType ctx)
+  | TUnit
+  | TBoxedTup Plus2
+  | TEq
+  | forall n ctx'. TForall (Vec n NameHint) (Add n ctx ctx') [SType ctx'] (SType ctx')
+  | TList (SType ctx)
+
+infixl 9 `TApp`
+
+deriving stock instance Show (SType ctx)
+
+{-# COMPLETE
+    TGlobal
+  , TClass
+  , TCon
+  , TFun
+  , TLit
+  , TStrLit
+  , TExt
+  , TBound
+  , TFree
+  , TApps
+  , TUnit
+  , TBoxedTup
+  , TEq
+  , TForall
+  , TList
+  #-}
+
+pattern TApps :: SType ctx -> [SType ctx] -> SType ctx
+pattern TApps f xs <- (unwrapTApps -> Just (f, xs))
+  where TApps f xs = wrapTApps f xs
+
+wrapTApps :: SType ctx -> [SType ctx] -> SType ctx
+wrapTApps f xs = foldl TApp f xs
+
+unwrapTApps :: SType ctx -> Maybe (SType ctx, [SType ctx])
+unwrapTApps = \case
+    TApp f x -> Just $ go [x] f
+    _        -> Nothing
+  where
+    go acc (TApp f x) = go (x : acc) f
+    go acc t          = (t, acc)
+
+{-------------------------------------------------------------------------------
+  Plus2
+-------------------------------------------------------------------------------}
+
+-- | Natural number larger equal 2.
+newtype Plus2 = Plus2 Natural
+  deriving stock (Show, Eq, Ord)
+
+applyPlus2 :: Plus2 -> Natural
+applyPlus2 (Plus2 n) = n+2
diff --git a/src-internal/HsBindgen/Backend/SHs/Simplify.hs b/src-internal/HsBindgen/Backend/SHs/Simplify.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/SHs/Simplify.hs
@@ -0,0 +1,102 @@
+-- | Simplification pass on the "HsBindgen.Backend.SHs.AST" representation
+module HsBindgen.Backend.SHs.Simplify (simplifySHs) where
+
+import Data.Either (partitionEithers)
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Hs.AST.Strategy
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+simplifySHs ::
+     ByCategory_ ([CWrapper], [SDecl])
+  -> ByCategory_ ([CWrapper], [SDecl])
+simplifySHs = fmap (\(x, y) -> (x, go y))
+  where
+    go :: [SDecl] -> [SDecl]
+    go decls =
+        let (decls', simpleInstances) =
+              second (Map.fromListWith (<>)) $
+                partitionMaybe toSimpleInstances decls
+        in reconstruct simpleInstances decls'
+
+reconstruct ::
+     Map (Hs.Name Hs.NsTypeConstr) SimpleInstances
+  -> [SDecl] -> [SDecl]
+reconstruct simpleInstances = map aux
+  where
+    aux :: SDecl -> SDecl
+    aux = \case
+        DRecord record -> DRecord $
+          record & #deriv %~ (++ instancesFor record.typ)
+        DNewtype newtyp -> DNewtype $
+          newtyp & #deriv %~ (++ instancesFor newtyp.name)
+        otherDecl ->
+          otherDecl
+
+    instancesFor ::
+         Hs.Name 'Hs.NsTypeConstr
+      -> [(Strategy ClosedType, [Inst.TypeClass])]
+    instancesFor =
+          maybe [] fromSimpleInstances
+        . flip Map.lookup simpleInstances
+
+{-------------------------------------------------------------------------------
+  Simple instances
+-------------------------------------------------------------------------------}
+
+-- | Simple instances are instances without special constraints
+--
+-- We group these per strategy, so that we can generate the most readable code.
+data SimpleInstances = SimpleInstances{
+      strategyStock   :: Set Inst.TypeClass
+    , strategyNewtype :: Set Inst.TypeClass
+    }
+  deriving stock (Show)
+
+fromSimpleInstances :: SimpleInstances -> [(Strategy ClosedType, [Inst.TypeClass])]
+fromSimpleInstances instances =
+    filter (not . null . snd) $ [
+        (DeriveStock   , Set.toList instances.strategyStock)
+      , (DeriveNewtype , Set.toList instances.strategyNewtype)
+      ]
+
+instance Semigroup SimpleInstances where
+  a <> b = SimpleInstances{
+        strategyNewtype = combine (.strategyNewtype)
+      , strategyStock   = combine (.strategyStock)
+      }
+    where
+      combine :: Semigroup a => (SimpleInstances -> a) -> a
+      combine f = f a <> f b
+
+instance Monoid SimpleInstances where
+  mempty = SimpleInstances{
+        strategyStock   = mempty
+      , strategyNewtype = mempty
+      }
+
+toSimpleInstances :: SDecl -> Maybe (Hs.Name Hs.NsTypeConstr, SimpleInstances)
+toSimpleInstances = \case
+    DDerivingInstance (DerivingInstance DeriveStock (TApp (TClass cls) (TCon name)) _) ->
+      Just (name, mempty{strategyStock = Set.singleton cls})
+    DDerivingInstance (DerivingInstance DeriveNewtype (TApp (TClass cls) (TCon name)) _)->
+      Just (name, mempty{strategyNewtype = Set.singleton cls})
+    _otherwise
+      -> Nothing
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+partitionMaybe :: (a -> Maybe b) -> [a] -> ([a], [b])
+partitionMaybe f = partitionEithers . map (\x -> maybe (Left x) Right (f x))
diff --git a/src-internal/HsBindgen/Backend/SHs/Translation.hs b/src-internal/HsBindgen/Backend/SHs/Translation.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/SHs/Translation.hs
@@ -0,0 +1,915 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE NamedFieldPuns #-}
+{-# LANGUAGE UnboxedTuples #-}
+
+-- | Simplified HS translation (from high level HS)
+module HsBindgen.Backend.SHs.Translation (
+    translateDecls,
+    translateType,
+) where
+
+import Data.ByteString qualified as BS
+import Data.Char qualified
+import Data.Map.Strict qualified as Map
+import Data.Text qualified as Text
+import DeBruijn.Idx
+
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.Level
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Backend.SHs.AST.Expr (FBind (FBind))
+import HsBindgen.Backend.SHs.Translation.Common
+import HsBindgen.Errors
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.NameHint
+
+{-------------------------------------------------------------------------------
+  Declarations
+-------------------------------------------------------------------------------}
+
+translateDecls ::
+     forall l. Macro.HasTypes l
+  => Macro.Lang l
+  -> ByCategory_ [Hs.Decl l]
+  -> ByCategory_ ([CWrapper], [SDecl])
+translateDecls macroLang = fmap go
+  where
+    go :: [Hs.Decl l] -> ([CWrapper], [SDecl])
+    go decls = (wrappers, map (translateDecl macroLang) decls)
+      where
+        wrappers = getCWrappers decls
+
+-- Find and assemble C sources required by foreign imports.
+getCWrappers :: [Hs.Decl l] -> [CWrapper]
+getCWrappers decls = mapMaybe getCWrapper decls
+  where
+    getCWrapper :: Hs.Decl l -> Maybe CWrapper
+    getCWrapper = \case
+      Hs.DeclForeignImport importDecl ->
+        case importDecl.callConv of
+          CallConvUserlandCapi w -> Just w
+          _otherCallConv         -> Nothing
+      _otherDecl -> Nothing
+
+translateDecl :: Macro.HasTypes l => Macro.Lang l -> Hs.Decl l -> SDecl
+translateDecl macroLang = \case
+  Hs.DeclTypSyn               x -> translateDeclTypSyn            x
+  Hs.DeclData                 x -> translateDeclData              x
+  Hs.DeclEmpty                x -> translateDeclEmpty             x
+  Hs.DeclNewtype              x -> translateNewtype               x
+  Hs.DeclDefineInstance       x -> translateDefineInstanceDecl    x
+  Hs.DeclDeriveInstance       x -> translateDeriveInstance        x
+  Hs.DeclMacroValue           x -> translateMacroValue' macroLang x
+  Hs.DeclForeignImport        x -> translateForeignImportDecl     x
+  Hs.DeclForeignImportWrapper x -> translateForeignImportWrapper  x
+  Hs.DeclForeignImportDynamic x -> translateForeignImportDynamic  x
+  Hs.DeclFunction             x -> translateFunctionDecl          x
+  Hs.DeclPatSyn               x -> translatePatSyn                x
+  Hs.DeclCompletePragma       x -> translateCompletePragma        x
+  Hs.DeclVar                  x -> translateDeclVar               x
+
+translateDeclTypSyn :: Hs.TypSyn -> SDecl
+translateDeclTypSyn d = DTypSyn $ TypeSynonym {
+      name    = d.name
+    , typ     = translateType d.typ
+    , origin  = d.origin
+    , comment = d.comment
+    }
+
+translateDefineInstanceDecl :: Hs.DefineInstance -> SDecl
+translateDefineInstanceDecl defInst =
+    case defInst.instanceDecl of
+      Hs.InstanceStaticSize name i ->
+        DInst $ translateStaticSizeInstance name i defInst.comment
+      Hs.InstanceReadRaw struct i ->
+        DInst $ translateReadRawInstance struct i defInst.comment
+      Hs.InstanceWriteRaw struct i ->
+        DInst $ translateWriteRawInstance struct i defInst.comment
+      Hs.InstanceStorable struct i ->
+        DInst $ translateStorableInstance struct i defInst.comment
+      Hs.InstanceHasCField i ->
+        DInst $ translateHasCFieldInstance i defInst.comment
+      Hs.InstanceHasCBitfield i ->
+        DInst $ translateHasCBitfieldInstance i defInst.comment
+      Hs.InstanceHasField i ->
+        DInst $ translateHasFieldInstance i defInst.comment
+      Hs.InstanceHasFieldCompat i ->
+        DInst $ translateHasFieldCompatInstance i defInst.comment
+      Hs.InstanceHasFieldPtr i ->
+        DInst $ translateHasFieldPtrInstance i defInst.comment
+      Hs.InstanceHasFlam struct i ->
+        DInst Instance{
+            clss    = Inst.Flam_Offset
+          , args    = [ translateType i.typ, TCon struct.name ]
+          , super   = []
+          , types   = []
+          , comment = defInst.comment
+          , decs    = [ ( bindgenGlobalTerm Flam_Offset_offset
+                        , ELam (NameHint "_proxy") $
+                            EIntegral (toInteger i.offset) Nothing)
+                      ]
+          }
+      Hs.InstanceCEnum struct i ->
+        DInst $
+          translateCEnumInstance
+            struct
+            i.fieldType
+            i.valueNames
+            i.isSequential
+            defInst.comment
+      Hs.InstanceSequentialCEnum struct i ->
+        DInst $
+          translateSequentialCEnum struct i.minName i.maxName defInst.comment
+      Hs.InstanceCEnumShow struct ->
+        DInst $ translateCEnumInstanceShow struct defInst.comment
+      Hs.InstanceCEnumRead struct ->
+        DInst $ translateCEnumInstanceRead struct defInst.comment
+      Hs.InstanceToFunPtr inst ->
+        DInst Instance{
+            clss    = Inst.ToFunPtr
+          , args    = [translateType inst.typ]
+          , super   = []
+          , types   = []
+          , comment = defInst.comment
+          , decs    = [ ( bindgenGlobalTerm ToFunPtr_toFunPtr
+                        , EFree $ Hs.InternalName inst.body
+                        )
+                      ]
+          }
+      Hs.InstanceFromFunPtr inst ->
+        DInst Instance{
+            clss    = Inst.FromFunPtr
+          , args    = [translateType inst.typ]
+          , super   = []
+          , types   = []
+          , comment = defInst.comment
+          , decs    = [ ( bindgenGlobalTerm FromFunPtr_fromFunPtr
+                        , EFree $ Hs.InternalName inst.body
+                        )
+                      ]
+          }
+
+translateDeclData :: Hs.Struct -> SDecl
+translateDeclData struct = DRecord Record{
+      typ     = struct.name
+    , con     = struct.constr
+    , deriv   = []
+    , comment = struct.comment
+    , origin  = case struct.origin of
+                  Just origin -> origin
+                  Nothing     -> panicPure "Missing structOrigin"
+    , fields  = [
+          Field{
+              name    = f.name
+            , typ     = translateType f.typ
+            , origin  = f.origin
+            , comment = f.comment
+            }
+        | f <- struct.fields
+        ]
+    }
+
+translateDeclEmpty :: Hs.EmptyData -> SDecl
+translateDeclEmpty d = DEmptyData EmptyData{
+      name    = d.name
+    , origin  = d.origin
+    , comment = d.comment
+    }
+
+translateNewtype :: Hs.Newtype -> SDecl
+translateNewtype n = DNewtype Newtype{
+      name    = n.name
+    , con     = n.constr
+    , origin  = n.origin
+    , deriv   = []
+    , comment = n.comment
+    , field   = Field {
+          name    = n.field.name
+        , typ     = translateType n.field.typ
+        , origin  = n.field.origin
+        , comment = n.field.comment
+        }
+    }
+
+translateDeriveInstance :: Hs.DeriveInstance -> SDecl
+translateDeriveInstance deriv = DDerivingInstance DerivingInstance {
+      strategy = fmap translateType deriv.strategy
+    , typ      = TApp (TClass deriv.clss) (TCon deriv.name)
+    , comment  = deriv.comment
+    }
+
+translateMacroValue' :: Macro.HasTypes l => Macro.Lang l -> Hs.MacroValue l -> SDecl
+translateMacroValue' macroLang macro = DBinding $
+    withCLiteralComment $
+    macroLang.translateValue
+      macro.name
+      (fmap macroIdToHsName macro.expr.body)
+      macro.comment
+  where
+    macroIdToHsName :: Id Final -> Hs.TermName
+    macroIdToHsName namePair =
+        Hs.ExportedName $ Hs.assertNs (Proxy @Hs.NsVar) namePair.hsName
+
+-- | Augment a macro binding's Haddock comment with the C literal representation
+-- when the binding body is a character or string literal.
+withCLiteralComment :: Binding -> Binding
+withCLiteralComment binding =
+    case cLiteralText binding.body of
+      Nothing  -> binding
+      Just lit -> binding
+        & #comment .~ Just ((fromMaybe mempty binding.comment) & #literal .~ Just lit)
+
+cLiteralText :: ClosedExpr -> Maybe Text
+cLiteralText = \case
+    ECChar c    -> Just $ Text.pack $ show (Data.Char.chr (fromIntegral c))
+    ECString bs -> Just $ Text.pack $ show (map (Data.Char.chr . fromIntegral) (BS.unpack bs))
+    _           -> Nothing
+
+translateForeignImportDecl :: Hs.ForeignImportDecl -> SDecl
+translateForeignImportDecl importDecl = DForeignImport ForeignImport{
+      parameters = map translateFFIParam importDecl.parameters
+    , result     = Result (translateFFIResType importDecl.result) Nothing
+      -- The rest of the fields are copied over as-is
+    , name       = importDecl.name
+    , origName   = importDecl.origName
+    , callConv   = importDecl.callConv
+    , origin     = importDecl.origin
+    , comment    = importDecl.comment
+    , safety     = importDecl.safety
+    }
+
+translateFFIParam :: Hs.FunctionParameter Hs.FFIType -> Parameter
+translateFFIParam param = Parameter {
+      typ     = translateFFIType param.typ
+    , comment = param.comment
+    }
+
+translateForeignImportWrapper :: Hs.ForeignImportWrapper -> SDecl
+translateForeignImportWrapper importWrapper = DForeignImport ForeignImport{
+      parameters = [
+            Parameter {
+                typ = translateFFIFunType importWrapper.funType
+              , comment = Nothing
+              }
+          ]
+    , result     = flip Result Nothing $
+          tBindgenGlobal IO_type `TApp`
+          (tBindgenGlobal Foreign_FunPtr_type `TApp`
+          translateFFIFunType importWrapper.funType)
+    , name       = Hs.InternalName importWrapper.name
+    , origName   = C.DeclName "wrapper" C.NameKindOrdinary
+    , callConv   = CallConvGhcCCall ImportAsValue
+    , origin     = importWrapper.origin
+    , comment    = importWrapper.comment
+    , safety     = Safe
+    }
+
+translateForeignImportDynamic :: Hs.ForeignImportDynamic -> SDecl
+translateForeignImportDynamic importDyn = DForeignImport ForeignImport{
+      parameters = [
+            Parameter {
+                typ =
+                    tBindgenGlobal Foreign_FunPtr_type `TApp`
+                    translateFFIFunType importDyn.funType
+              , comment = Nothing
+              }
+          ]
+    , result     = Result (translateFFIFunType importDyn.funType) Nothing
+    , name       = Hs.InternalName importDyn.name
+    , origName   = C.DeclName "dynamic" C.NameKindOrdinary
+    , callConv   = CallConvGhcCCall ImportAsValue
+    , origin     = importDyn.origin
+    , comment    = importDyn.comment
+    , safety     = Safe
+    }
+
+translateFunctionDecl :: Hs.FunctionDecl -> SDecl
+translateFunctionDecl functionDecl = DBinding Binding{
+      parameters = map translateFunctionParam functionDecl.parameters
+    , result     = Result (translateType functionDecl.result) Nothing
+      -- The other fields are copied as-is
+    , name       = functionDecl.name
+    , body       = functionDecl.body
+    , pragmas    = functionDecl.pragmas
+    , comment    = functionDecl.comment
+    }
+
+translateFunctionParam :: Hs.FunctionParameter Hs.Type -> Parameter
+translateFunctionParam param = Parameter {
+      typ     = translateType param.typ
+    , comment = param.comment
+    }
+
+translatePatSyn :: Hs.PatSyn -> SDecl
+translatePatSyn patSyn = DPatternSynonym PatternSynonym{
+      typ     = translateType patSyn.typ
+    , rhs     =
+      case patSyn.constr of
+        Just c -> PEApps c [PELit patSyn.value]
+        Nothing -> PELit patSyn.value
+      -- The other fields are copied as-is
+    , name    = patSyn.name
+    , origin  = patSyn.origin
+    , comment = patSyn.comment
+    }
+
+translateCompletePragma :: Hs.CompletePragma -> SDecl
+translateCompletePragma = DCompletePragma
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+translateHsPrimType :: Hs.PrimType -> SType ctx
+translateHsPrimType = \case
+    Hs.PrimVoid    -> tBindgenGlobal Void_type
+    Hs.PrimUnit    -> TUnit
+    Hs.PrimInt     -> tBindgenGlobal Int_type
+    Hs.PrimCChar   -> tBindgenGlobal CChar_type
+    Hs.PrimCSChar  -> tBindgenGlobal CSChar_type
+    Hs.PrimCUChar  -> tBindgenGlobal CUChar_type
+    Hs.PrimCShort  -> tBindgenGlobal CShort_type
+    Hs.PrimCUShort -> tBindgenGlobal CUShort_type
+    Hs.PrimCInt    -> tBindgenGlobal CInt_type
+    Hs.PrimCUInt   -> tBindgenGlobal CUInt_type
+    Hs.PrimCLong   -> tBindgenGlobal CLong_type
+    Hs.PrimCULong  -> tBindgenGlobal CULong_type
+    Hs.PrimCLLong  -> tBindgenGlobal CLLong_type
+    Hs.PrimCULLong -> tBindgenGlobal CULLong_type
+    Hs.PrimCBool   -> tBindgenGlobal CBool_type
+    Hs.PrimCFloat  -> tBindgenGlobal CFloat_type
+    Hs.PrimCDouble -> tBindgenGlobal CDouble_type
+
+translateType :: Hs.Type -> ClosedType
+translateType = \case
+    Hs.PrimType t           -> translateHsPrimType t
+    Hs.TypRef r _           -> TCon r
+    Hs.ConstArray n t       -> tBindgenGlobal ConstantArray_type `TApp` TLit n `TApp` (translateType t)
+    Hs.IncompleteArray t    -> tBindgenGlobal IncompleteArray_type `TApp` (translateType t)
+    Hs.PtrArrayElem t       -> tBindgenGlobal Foreign_Ptr_type `TApp` (tBindgenGlobal IsArray_Elem `TApp` translateType t)
+    Hs.PtrConstArrayElem t  -> tBindgenGlobal PtrConst_type `TApp` (tBindgenGlobal IsArray_Elem `TApp` translateType t)
+    Hs.Ptr t                -> TApp (tBindgenGlobal Foreign_Ptr_type) (translateType t)
+    Hs.FunPtr t             -> TApp (tBindgenGlobal Foreign_FunPtr_type) (translateType t)
+    Hs.PtrConst t           -> TApp (tBindgenGlobal PtrConst_type) (translateType t)
+    Hs.IO t                 -> TApp (tBindgenGlobal IO_type) (translateType t)
+    Hs.Fun a b              -> TFun (translateType a) (translateType b)
+    Hs.ExtBinding r _c _hs _-> TExt r
+    Hs.ByteArray            -> tBindgenGlobal ByteArray_type
+    Hs.SizedByteArray n m   -> tBindgenGlobal SizedByteArray_type `TApp` TLit n `TApp` TLit m
+    Hs.Block t              -> tBindgenGlobal Block_type `TApp` translateType t
+    Hs.ComplexType t        -> TApp (tBindgenGlobal Complex_type) (translateType (Hs.PrimType t))
+    Hs.StrLit s             -> TStrLit s
+    Hs.WithFlam x y         ->
+      TApp (TApp (tBindgenGlobal Flam_WithFlam_type) (translateType x)) (translateType y)
+    Hs.EquivStorable t      -> TApp (tBindgenGlobal EquivStorable_type) (translateType t)
+    Hs.IsStructViaReadRaw t -> TApp (tBindgenGlobal IsStructViaReadRaw_type) (translateType t)
+
+{-------------------------------------------------------------------------------
+  FFI types
+-------------------------------------------------------------------------------}
+
+translateFFIFunType :: Hs.FFIFunType -> ClosedType
+translateFFIFunType ty = case Hs.unconsArg ty of
+    Left (arg, ty') -> TFun (translateFFIType arg) (translateFFIFunType ty')
+    Right res -> translateFFIResType res
+
+translateFFIResType :: Hs.FFIResType -> ClosedType
+translateFFIResType = \case
+    Hs.FFIResUnit -> TUnit
+    Hs.FFIResIOUnit -> TApp (tBindgenGlobal IO_type) TUnit
+    Hs.FFIResIO ty -> TApp (tBindgenGlobal IO_type) (translateFFIType ty)
+    Hs.FFIRes ty -> translateFFIType ty
+
+translateFFIType :: Hs.FFIType -> ClosedType
+translateFFIType = \case
+    Hs.FFIExternal r -> TExt r
+    Hs.FFIPtrVoid -> TApp (tBindgenGlobal Foreign_Ptr_type) (tBindgenGlobal Void_type)
+    Hs.FFIFunPtrVoid -> TApp (tBindgenGlobal Foreign_FunPtr_type) (tBindgenGlobal Void_type)
+    Hs.FFIPrimCChar -> tBindgenGlobal CChar_type
+    Hs.FFIPrimCSChar -> tBindgenGlobal CSChar_type
+    Hs.FFIPrimCUChar -> tBindgenGlobal CUChar_type
+    Hs.FFIPrimCShort -> tBindgenGlobal CShort_type
+    Hs.FFIPrimCUShort -> tBindgenGlobal CUShort_type
+    Hs.FFIPrimCInt -> tBindgenGlobal CInt_type
+    Hs.FFIPrimCUInt -> tBindgenGlobal CUInt_type
+    Hs.FFIPrimCLong -> tBindgenGlobal CLong_type
+    Hs.FFIPrimCULong -> tBindgenGlobal CULong_type
+    Hs.FFIPrimCLLong -> tBindgenGlobal CLLong_type
+    Hs.FFIPrimCULLong -> tBindgenGlobal CULLong_type
+    Hs.FFIPrimCBool -> tBindgenGlobal CBool_type
+    Hs.FFIPrimCFloat -> tBindgenGlobal CFloat_type
+    Hs.FFIPrimCDouble  -> tBindgenGlobal CDouble_type
+
+{-------------------------------------------------------------------------------
+  @StaticSize@, @ReadRaw@, @WriteRaw@
+-------------------------------------------------------------------------------}
+
+translateStaticSizeInstance ::
+     Hs.Name Hs.NsTypeConstr
+  -> Hs.StaticSizeInstance
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateStaticSizeInstance name inst mbComment = Instance{
+      clss    = Inst.StaticSize
+    , args    = [TCon name]
+    , super   = []
+    , types   = []
+    , comment = mbComment
+    , decs    = [
+          (bindgenGlobalTerm StaticSize_staticSizeOf    , EUnusedLam $ eInt inst.staticSizeOf)
+        , (bindgenGlobalTerm StaticSize_staticAlignment , EUnusedLam $ eInt inst.staticAlignment)
+        ]
+    }
+
+translateReadRawInstance ::
+     Hs.Struct
+  -> Hs.ReadRawInstance
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateReadRawInstance struct inst mbComment = Instance{
+      clss    = Inst.ReadRaw
+    , args    = [TCon struct.name]
+    , super   = []
+    , types   = []
+    , comment = mbComment
+    , decs    = [(bindgenGlobalTerm ReadRaw_readRaw, readRaw)]
+    }
+  where
+    readRaw = lambda (idiom structCon translateReadRawCField) inst.readRaw
+
+translateWriteRawInstance ::
+     Hs.Struct
+  -> Hs.WriteRawInstance
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateWriteRawInstance struct inst mbComment = Instance{
+      clss    = Inst.WriteRaw
+    , args    = [TCon struct.name]
+    , super   = []
+    , types   = []
+    , comment = mbComment
+    , decs    = [(bindgenGlobalTerm WriteRaw_writeRaw, writeRaw)]
+    }
+  where
+    writeRaw =
+      lambda
+        (lambda (translateElimStruct (doAll translateWriteRawCField)))
+        inst.writeRaw
+
+translateReadRawCField :: Hs.ReadRawCField ctx -> SExpr ctx
+translateReadRawCField = \case
+    Hs.ReadRawCField field ptr ->
+      appMany HasCField_readRaw [
+          eBindgenGlobal Proxy_constructor `ETypeApp` translateType field
+        , EBound ptr
+        ]
+    Hs.ReadRawCBitfield field ptr ->
+      appMany HasCBitfield_peek [
+          eBindgenGlobal Proxy_constructor `ETypeApp` translateType field
+        , EBound ptr
+        ]
+    Hs.ReadRawByteOff ptr i ->
+      appMany ReadRaw_readRawByteOff [EBound ptr, eInt i]
+
+translateWriteRawCField :: Hs.WriteRawCField ctx -> SExpr ctx
+translateWriteRawCField = \case
+    Hs.WriteRawCField field ptr x ->
+      appMany HasCField_writeRaw [
+          eBindgenGlobal Proxy_constructor `ETypeApp` translateType field
+        , EBound ptr
+        , EBound x
+        ]
+    Hs.WriteRawCBitfield field ptr x ->
+      appMany HasCBitfield_poke [
+          eBindgenGlobal Proxy_constructor `ETypeApp` translateType field
+        , EBound ptr
+        , EBound x
+        ]
+    Hs.WriteRawByteOff ptr i x ->
+      appMany WriteRaw_writeRawByteOff [EBound ptr, eInt i, EBound x]
+
+{-------------------------------------------------------------------------------
+  'Storable'
+-------------------------------------------------------------------------------}
+
+translateStorableInstance ::
+     Hs.Struct
+  -> Hs.StorableInstance
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateStorableInstance struct inst mbComment = Instance{
+      clss    = Inst.Storable
+    , args    = [TCon struct.name]
+    , super   = []
+    , types   = []
+    , comment = mbComment
+    , decs    = map (first bindgenGlobalTerm) [
+          (Storable_sizeOf    , EUnusedLam $ eInt inst.sizeOf)
+        , (Storable_alignment , EUnusedLam $ eInt inst.alignment)
+        , (Storable_peek      , peek)
+        , (Storable_poke      , poke)
+        ]
+    }
+  where
+    peek = lambda (idiom structCon translatePeekCField) inst.peek
+    poke = lambda (lambda (translateElimStruct (doAll translatePokeCField))) inst.poke
+
+translatePeekCField :: Hs.PeekCField ctx -> SExpr ctx
+translatePeekCField (Hs.PeekCField field ptr) =
+    appMany HasCField_peek [eBindgenGlobal Proxy_constructor `ETypeApp` translateType field, EBound ptr]
+translatePeekCField (Hs.PeekCBitfield field ptr) =
+    appMany HasCBitfield_peek [eBindgenGlobal Proxy_constructor `ETypeApp` translateType field, EBound ptr]
+translatePeekCField (Hs.PeekByteOff ptr i) =
+    appMany Storable_peekByteOff [EBound ptr, eInt i]
+
+translatePokeCField :: Hs.PokeCField ctx -> SExpr ctx
+translatePokeCField (Hs.PokeCField field ptr x) =
+    appMany HasCField_poke [eBindgenGlobal Proxy_constructor `ETypeApp` translateType field, EBound ptr, EBound x]
+translatePokeCField (Hs.PokeCBitfield field ptr x) =
+    appMany HasCBitfield_poke [eBindgenGlobal Proxy_constructor `ETypeApp` translateType field, EBound ptr, EBound x]
+translatePokeCField (Hs.PokeByteOff ptr i x) =
+    appMany Storable_pokeByteOff [EBound ptr, eInt i, EBound x]
+
+{-------------------------------------------------------------------------------
+  'HasCField'
+-------------------------------------------------------------------------------}
+
+translateHasCFieldInstance ::
+     Hs.HasCFieldInstance
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateHasCFieldInstance inst mbComment = Instance {
+      clss    = Inst.HasCField
+    , args    = [parent, fieldLit]
+    , super   = []
+    , comment = mbComment
+    , types   = [ ( bindgenGlobalType HasCField_CFieldType
+                  , [parent, fieldLit], fieldType)
+                ]
+    , decs    = [ ( bindgenGlobalTerm HasCField_offset#
+                  , EUnusedLam $ EUnusedLam $ EIntegral o Nothing
+                  )
+                ]
+    }
+  where
+    parent    = translateType inst.parentType
+    fieldLit  = translateType $ Hs.StrLit $ Hs.nameToStr inst.fieldName
+    fieldType = translateType inst.cFieldType
+    o         = fromIntegral inst.fieldOffset
+
+{-------------------------------------------------------------------------------
+  'HasCBitfield'
+-------------------------------------------------------------------------------}
+
+translateHasCBitfieldInstance ::
+     Hs.HasCBitfieldInstance
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateHasCBitfieldInstance inst mbComment = Instance{
+      clss    = Inst.HasCBitfield
+    , args    = [parent, fieldLit]
+    , super   = []
+    , comment = mbComment
+    , types   = [ (bindgenGlobalType HasCBitfield_CBitfieldType
+                  , [parent, fieldLit], fieldType
+                  )
+                ]
+    , decs    = [ ( bindgenGlobalTerm HasCBitfield_bitfieldOffset#
+                  , EUnusedLam $ EUnusedLam $ EIntegral o Nothing
+                  )
+                , ( bindgenGlobalTerm HasCBitfield_bitfieldWidth#
+                  , EUnusedLam $ EUnusedLam $ EIntegral w Nothing
+                  )
+                ]
+    }
+  where
+    parent    = translateType inst.parentType
+    fieldLit  = translateType $ Hs.StrLit $ Hs.nameToStr inst.fieldName
+    fieldType = translateType inst.cBitfieldType
+    o         = fromIntegral inst.bitOffset
+    w         = fromIntegral inst.bitWidth
+
+{-------------------------------------------------------------------------------
+  'GHC.Records.HasField'
+-------------------------------------------------------------------------------}
+
+translateHasFieldInstance ::
+     Hs.HasFieldInstance
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateHasFieldInstance inst mbComment = Instance{
+      clss   = Inst.HasField
+    , args    = [fieldLit, parent, tyTypeVar]
+    , types   = []
+    , comment = mbComment
+    , super   = [ TApp (TApp TEq tyTypeVar) field ]
+    , decs    = [ ( bindgenGlobalTerm HasField_getField
+                  , exprGetter
+                  )
+                ]
+    }
+  where
+    parent    = translateType inst.parentType
+    field     = translateType inst.fieldType
+    fieldLit  = translateType $ Hs.StrLit $ Hs.nameToStr inst.fieldName
+
+    -- This is not actually a free type variable.
+    tyTypeVar = TFree $ Hs.UnsafeName "ty"
+
+    exprGetter :: SExpr Z
+    exprGetter = case inst.impl of
+      Hs.HasFieldImplUnion -> eBindgenGlobal ByteArray_getUnionPayload
+      Hs.HasFieldImplUnionBits {bitOffset, bitWidth} ->
+                 eBindgenGlobal ByteArray_getUnionPayloadBits
+          `EApp` EIntegral (fromIntegral bitOffset) Nothing
+          `EApp` EIntegral (fromIntegral bitWidth) Nothing
+      Hs.HasFieldImplIndirect {nameTopToAnon, nameAnonToTarget} ->
+        let strLitTopToAnon    = translateType (Hs.StrLit (Hs.nameToStr nameTopToAnon))
+            strLitAnonToTarget = translateType (Hs.StrLit (Hs.nameToStr nameAnonToTarget)) in
+        ELam (NameHint "x") $
+          EApp (eBindgenGlobal HasField_getField `ETypeApp` strLitAnonToTarget)
+               (eBindgenGlobal HasField_getField `ETypeApp` strLitTopToAnon `EApp` EBound IZ)
+
+{-------------------------------------------------------------------------------
+  'GHC.Records.Compat.HasField'
+-------------------------------------------------------------------------------}
+
+translateHasFieldCompatInstance ::
+     Hs.HasFieldCompatInstance
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateHasFieldCompatInstance inst mbComment = Instance{
+      clss   = Inst.HasFieldCompat
+    , args    = [fieldLit, parent, tyTypeVar]
+    , types   = []
+    , comment = mbComment
+    , super   = [ TApp (TApp TEq tyTypeVar) field ]
+    , decs    = [ ( bindgenGlobalTerm HasFieldCompat_hasField
+                  , ELam (NameHint "x") $ appManyExpr (EBoxedTup $ Plus2 0) [
+                        exprSetter
+                      , exprGetter
+                      ]
+                  )
+                ]
+    }
+  where
+    parent    = translateType inst.parentType
+    field     = translateType inst.fieldType
+    fieldLit  = translateType $ Hs.StrLit $ Hs.nameToStr inst.fieldName
+
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/1287>
+    -- This is not actually a free type variable.
+    tyTypeVar = TFree $ Hs.UnsafeName "ty"
+
+    exprGetter :: SExpr (S Z)
+    exprGetter = eBindgenGlobal HasField_getField `ETypeApp` fieldLit `EApp` EBound IZ
+
+    -- For the setter we use total record construction. The advantage with
+    -- record fields is that they can be used in any order regardless of the
+    -- order in which the fields were defined the datatype. This leads to a
+    -- simpler implementation compared to non-record construction. However,
+    -- because we use record fields we need total record construction instead of
+    -- a partial record update because the latter can cause warnings about
+    -- ambiguous field names. The implementation cost for record construction
+    -- compared to record update is low.
+    exprSetter :: SExpr (S Z)
+    exprSetter =
+        case inst.impl of
+          Hs.HasFieldCompatImplRecord {constr, otherFields} ->
+            ELam (NameHint "y") $
+              ERecCon constr $ concat [
+                  [ FBind (Hs.nameToStr inst.fieldName) (EBound IZ) ]
+                , map mkFBindIdentity otherFields
+                ]
+          Hs.HasFieldCompatImplUnion ->
+              ELam (NameHint "y")
+                (      eBindgenGlobal ByteArray_setUnionPayload
+                `EApp` (EBound IZ)
+                `EApp` (EBound (IS IZ))
+                )
+          Hs.HasFieldCompatImplUnionBits {bitOffset, bitWidth} ->
+            ELam (NameHint "y")
+              (      eBindgenGlobal ByteArray_setUnionPayloadBits
+              `EApp` EIntegral (fromIntegral bitOffset) Nothing
+              `EApp` EIntegral (fromIntegral bitWidth) Nothing
+              `EApp` (EBound IZ)
+              `EApp` (EBound (IS IZ))
+              )
+          Hs.HasFieldCompatImplIndirect {nameTopToAnon, nameAnonToTarget} ->
+            let strLitTopToAnon = translateType (Hs.StrLit (Hs.nameToStr nameTopToAnon))
+                strLitAnonToTarget = translateType (Hs.StrLit (Hs.nameToStr nameAnonToTarget)) in
+            ELam (NameHint "y")
+              (
+                     (          eBindgenGlobal HasFieldCompat_modifyField
+                     `ETypeApp` strLitTopToAnon
+                     )
+              `EApp` (EBound (IS IZ))
+              `EApp` (ELam (NameHint "z")
+                        (
+                                   eBindgenGlobal HasFieldCompat_setField
+                        `ETypeApp` strLitAnonToTarget
+                        `EApp`     EBound IZ
+                        `EApp`     EBound (IS IZ)
+                        )
+                      )
+              )
+      where
+        -- An 'FBind' that leaves the original field unchanged
+        mkFBindIdentity :: Hs.Name Hs.NsVar -> FBind (S (S n))
+        mkFBindIdentity fieldName = FBind (Hs.nameToStr fieldName) $
+                      eBindgenGlobal HasField_getField
+            `ETypeApp` (translateType (Hs.StrLit (Hs.nameToStr fieldName)))
+            `EApp`      EBound (IS IZ)
+
+{-------------------------------------------------------------------------------
+  'GHC.Records.HasField' for the pointer manipulation API
+-------------------------------------------------------------------------------}
+
+translateHasFieldPtrInstance ::
+     Hs.HasFieldPtrInstance
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateHasFieldPtrInstance inst mbComment = Instance{
+      clss   = Inst.HasField
+    , args    = [fieldLit, parentPtr, tyPtr]
+    , types   = []
+    , comment = mbComment
+    , super   = [ TApp (TApp TEq tyTypeVar) field ]
+    , decs    = [ ( bindgenGlobalTerm HasField_getField
+                  , eBindgenGlobal ptrToFieldGlobal `EApp`
+                      (eBindgenGlobal Proxy_constructor `ETypeApp` fieldLit)
+                  )
+                ]
+    }
+  where
+    (ptrToFieldGlobal, tyPtr) =
+      case inst.deriveVia of
+        Hs.ViaHasCField -> (
+            HasCField_fromPtr
+          , tBindgenGlobal Foreign_Ptr_type `TApp` tyTypeVar
+          )
+        Hs.ViaHasCBitfield -> (
+            HasCBitfield_toPtr
+          , tBindgenGlobal HasCBitfield_BitfieldPtr_type `TApp` tyTypeVar
+          )
+
+    parent    = translateType inst.parentType
+    parentPtr = tBindgenGlobal Foreign_Ptr_type `TApp` parent
+    field     = translateType inst.fieldType
+    fieldLit  = translateType $ Hs.StrLit $ Hs.nameToStr inst.fieldName
+
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/1287>
+    -- This is not actually a free type variable.
+    tyTypeVar = TFree $ Hs.UnsafeName "ty"
+
+{-------------------------------------------------------------------------------
+  Variables
+-------------------------------------------------------------------------------}
+
+translateDeclVar :: Hs.Var -> SDecl
+translateDeclVar var = DBinding Binding{
+      name      = var.name
+    , parameters= []
+    , result    = Result var.typ Nothing
+    , body      = var.expr
+    , pragmas   = var.pragmas
+    , comment   = var.comment
+    }
+
+{-------------------------------------------------------------------------------
+  Enums
+-------------------------------------------------------------------------------}
+
+translateCEnumInstance ::
+     Hs.Struct
+  -> Hs.Type
+  -> Map Integer (NonEmpty String)
+  -> Bool
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateCEnumInstance struct fTyp vMap isSequential mbComment = Instance {
+      clss    = Inst.CEnum
+    , args    = [tcon]
+    , super   = []
+    , types   = [(bindgenGlobalType CEnumZ_type, [tcon], translateType fTyp)]
+    , comment = mbComment
+    , decs    = map (first bindgenGlobalTerm) [
+          (CEnum_toCEnum            , ECon struct.constr)
+        , (CEnum_fromCEnum          , fromCEnumE)
+        , (CEnum_declaredValues     , EUnusedLam declaredValuesE)
+        , (CEnum_showsUndeclared    , EApp (eBindgenGlobal CEnum_showsWrappedUndeclared) dconStrE)
+        , (CEnum_readPrecUndeclared , EApp (eBindgenGlobal CEnum_readPrecWrappedUndeclared) dconStrE)
+        ] ++ seqDecs
+    }
+  where
+    tcon :: ClosedType
+    tcon = TCon struct.name
+
+    dconStrE :: SExpr ctx
+    dconStrE = EString $ Hs.nameToStr struct.constr
+
+    fname :: Hs.Name Hs.NsVar
+    fname = case struct.fields of
+        (f : _) -> f.name
+        []      -> panicPure "translateCEnumInstance: empty fields"
+
+    fnameStr :: String
+    fnameStr = Hs.nameToStr fname
+
+    fromCEnumE :: ClosedExpr
+    fromCEnumE = eBindgenGlobal HasField_getField `ETypeApp` translateType (Hs.StrLit fnameStr)
+
+    declaredValuesE :: SExpr ctx
+    declaredValuesE = EApp (eBindgenGlobal CEnum_declaredValuesFromList) $ EList [
+        appManyExpr (EBoxedTup $ Plus2 0) [
+            EIntegral v Nothing
+          , if null names
+              then EApp (eBindgenGlobal NonEmpty_singleton) (EString name)
+              else
+                EInfix
+                  InfixNonEmpty_constructor
+                  (EString name)
+                  (EList (EString <$> names))
+          ]
+      | (v, name :| names) <- Map.toList vMap
+      ]
+
+    seqDecs :: [(Global LvlTerm, ClosedExpr)]
+    seqDecs
+      | isSequential = [
+            (bindgenGlobalTerm CEnum_isDeclared, eBindgenGlobal CEnum_seqIsDeclared)
+          , (bindgenGlobalTerm CEnum_mkDeclared, eBindgenGlobal CEnum_seqMkDeclared)
+          ]
+      | otherwise = []
+
+translateSequentialCEnum ::
+     Hs.Struct
+  -> Hs.Name Hs.NsConstr
+  -> Hs.Name Hs.NsConstr
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateSequentialCEnum struct nameMin nameMax mbComment = Instance {
+      clss    = Inst.SequentialCEnum
+    , args    = [tcon]
+    , super   = []
+    , types   = []
+    , comment = mbComment
+    , decs    = [
+          (bindgenGlobalTerm SequentialCEnum_minDeclaredValue, ECon nameMin)
+        , (bindgenGlobalTerm SequentialCEnum_maxDeclaredValue, ECon nameMax)
+        ]
+    }
+  where
+    tcon :: ClosedType
+    tcon = TCon struct.name
+
+translateCEnumInstanceShow ::
+     Hs.Struct
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateCEnumInstanceShow struct mbComment = Instance {
+      clss    = Inst.Show
+    , args    = [tcon]
+    , super   = []
+    , types   = []
+    , comment = mbComment
+    , decs    = [(bindgenGlobalTerm Show_showsPrec, eBindgenGlobal CEnum_showsCEnum)]
+    }
+  where
+    tcon :: ClosedType
+    tcon = TCon struct.name
+
+translateCEnumInstanceRead ::
+     Hs.Struct
+  -> Maybe HsDoc.Comment
+  -> Instance
+translateCEnumInstanceRead struct mbComment = Instance {
+      clss    = Inst.Read
+    , args    = [tcon]
+    , super   = []
+    , types   = []
+    , comment = mbComment
+    , decs    = map (bimap bindgenGlobalTerm eBindgenGlobal) [
+          (Read_readPrec     , CEnum_readPrecCEnum)
+        , (Read_readList     , Read_readListDefault)
+        , (Read_readListPrec , Read_readListPrecDefault)
+        ]
+    }
+  where
+    tcon :: ClosedType
+    tcon = TCon struct.name
diff --git a/src-internal/HsBindgen/Backend/SHs/Translation/Common.hs b/src-internal/HsBindgen/Backend/SHs/Translation/Common.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/SHs/Translation/Common.hs
@@ -0,0 +1,230 @@
+module HsBindgen.Backend.SHs.Translation.Common (
+    translateElimStruct
+  , eAppMany
+  , appMany
+  , appManyExpr
+  , structCon
+  , idiom
+  , lambda
+  , doAll
+  , asNaryEApp
+  , asNaryTApp
+    -- * Shift
+  , shiftExpr
+    -- * DeBruijn utilities
+  , reverseEnv
+  , idxsEnv
+  , idxsPairEnv
+  ) where
+
+import Data.Foldable qualified as Foldable
+import Data.Type.Equality
+import Data.Type.Nat (Plus)
+import DeBruijn
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Backend.SHs.AST.Expr (FBind (..))
+
+{-------------------------------------------------------------------------------
+  Structs
+-------------------------------------------------------------------------------}
+
+translateElimStruct ::
+     (forall ctx'. t ctx' -> SExpr ctx')
+  -> Hs.ElimStruct t ctx
+  -> SExpr ctx
+translateElimStruct f (Hs.ElimStruct x constr hints add k) = ECase
+    (EBound x)
+    [SAlt constr add hints (f k)]
+
+{-------------------------------------------------------------------------------
+-  Internal auxiliary: derived functionality
+--------------------------------------------------------------------------------}
+
+eAppMany :: SExpr ctx -> [SExpr ctx] -> SExpr ctx
+eAppMany = Foldable.foldl' EApp
+
+-- | Apply function to many arguments
+appMany :: BindgenGlobalTerm -> [SExpr ctx] -> SExpr ctx
+appMany = appManyExpr . eBindgenGlobal
+
+appManyExpr :: SExpr ctx -> [SExpr ctx] -> SExpr ctx
+appManyExpr = Foldable.foldl' EApp
+
+-- | Struct constructor
+structCon :: Hs.StructCon ctx -> SExpr ctx
+structCon (Hs.StructCon s) = ECon s.constr
+
+-- | Idiom brackets
+idiom :: (pure ctx -> SExpr ctx) -> (xs ctx -> SExpr ctx) -> Hs.Ap pure xs ctx -> SExpr ctx
+idiom f g (Hs.Ap p xs) = Foldable.foldl'
+    (\ acc x -> EInfix InfixApplicative_seq acc (g x))
+    (EApp (eBindgenGlobal Applicative_pure) (f p))
+    xs
+
+-- | Translate lambda
+lambda :: (t (S ctx) -> SExpr (S ctx)) -> Hs.Lambda t ctx -> SExpr ctx
+lambda f (Hs.Lambda hint t) = ELam hint (f t)
+
+-- | Monad sequencing
+doAll :: (t ctx -> SExpr ctx) -> Hs.Seq t ctx -> SExpr ctx
+doAll _ (Hs.Seq []) = eBindgenGlobal Applicative_pure `EApp` EUnit
+doAll f (Hs.Seq ss) = foldr1 (EInfix InfixMonad_seq) (map f ss)
+
+-- Recognize n-ary function applications
+--
+-- Arguments are returned from left to right.
+asNaryEApp :: SExpr ctx -> (SExpr ctx, [SExpr ctx])
+asNaryEApp = go []
+  where
+    go acc (EApp f x) = go (x : acc) f
+    go acc e          = (e, acc)
+
+-- Recognize n-ary type applications
+--
+-- Arguments are returned from left to right.
+asNaryTApp :: SType ctx -> (SType ctx, [SType ctx])
+asNaryTApp = go []
+  where
+    go acc (TApp f x) = go (x : acc) f
+    go acc t          = (t, acc)
+
+{-------------------------------------------------------------------------------
+  Shift
+--------------------------------------------------------------------------------}
+
+-- | Shift an expression
+--
+-- Typically an expression needs to be shifted to accomodate newly bound
+-- variables. For example, this happens when an expression is moved under a
+-- lambda.
+shiftExpr :: SExpr ctx -> SExpr (S ctx)
+shiftExpr = shiftNExpr (AS AZ)
+
+-- | Shift an expression @n@ times
+--
+-- Typically an expression needs to be shifted to accomodate newly bound
+-- variables. For example, this happens when an expression is moved under a
+-- lambda.
+shiftNExpr :: Add n ctx ctx' -> SExpr ctx -> SExpr ctx'
+shiftNExpr add = \case
+    EGlobal g -> EGlobal g
+    EBound idx -> EBound (shiftIdxN add idx)
+    EFree tn -> EFree tn
+    ECon c -> ECon c
+    EUnboxedIntegral i -> EUnboxedIntegral i
+    EIntegral i mct -> EIntegral i mct
+    EFloat f ct -> EFloat f ct
+    EDouble d ct -> EDouble d ct
+    ECChar c -> ECChar c
+    EString s -> EString s
+    ECString bs -> ECString bs
+    EApp f g -> EApp (shiftNExpr add f) (shiftNExpr add g)
+    EInfix io e1 e2 -> EInfix io (shiftNExpr add e1) (shiftNExpr add e2)
+    ELam nh e -> ELam nh (shiftNExpr (shiftAdd add) e)
+    EUnusedLam e -> EUnusedLam (shiftNExpr add e)
+    ECase e as -> ECase (shiftNExpr add e) (map (shiftNAlt add) as)
+    EUnit -> EUnit
+    EBoxedTup p -> EBoxedTup p
+    EUnboxedTup p -> EUnboxedTup p
+    EList es -> EList (fmap (shiftNExpr add) es)
+    ETypeApp e t -> ETypeApp (shiftNExpr add e) t
+    ERecCon n fbs -> ERecCon n (fmap (shiftNFBind add) fbs)
+
+shiftAdd :: Add n ctx ctx' -> Add n (S ctx) (S ctx')
+shiftAdd = shiftNAdd (AS AZ) -- equivalent to rsuccAdd
+
+shiftNAdd :: Add n ctx1 ctx2 -> Add m ctx ctx' -> Add m (Plus n ctx) (Plus n ctx')
+shiftNAdd = \case
+  AZ -> id
+  AS x -> rsuccAdd . shiftNAdd x
+
+shiftIdxN :: Add n ctx ctx' -> Idx ctx -> Idx ctx'
+shiftIdxN add idx = case add of
+    AZ -> idx
+    AS add' -> IS (shiftIdxN add' idx)
+
+shiftNFBind :: Add n ctx ctx' -> FBind ctx -> FBind ctx'
+shiftNFBind add fb = FBind {
+      label = fb.label
+    , expr  = shiftNExpr add fb.expr
+    }
+
+shiftNAlt :: forall n ctx ctx'. Add n ctx ctx' -> SAlt ctx -> SAlt ctx'
+shiftNAlt add = \case
+    SAlt @m @_ @ctx'' n (a :: Add m ctx ctx'') nhs (e :: SExpr ctx'') ->
+        case eqSymmetry add of
+          Refl -> -- ctx' :~: Plus n ctx
+            let
+              a' :: Add m (Plus n ctx) (Plus n ctx'')
+              a' = shiftNAdd add a
+              add' :: Add n ctx'' (Plus n ctx'')
+              add' = eqReflexivity (addToSize add)
+              e' :: SExpr (Plus n ctx'')
+              e' = shiftNExpr add' e
+            in
+              SAlt n a' nhs e'
+    SAltNoConstr ns e ->
+      SAltNoConstr ns (shiftNExpr (shiftAdd add) e)
+    SAltUnboxedTuple a ns e ->
+      -- NOTE: same proof as the 'SAlt' case
+      case eqSymmetry add of
+          Refl ->
+            let
+              a' = shiftNAdd add a
+              add' = eqReflexivity (addToSize add)
+              e' = shiftNExpr add' e
+            in
+              SAltUnboxedTuple a' ns e'
+
+-- | Symmetry of equality (roughly)
+--
+-- \[
+--  forall n m p. n + m = p \implies p = n + m
+-- \]
+--
+eqSymmetry :: Add n m p -> p :~: Plus n m
+eqSymmetry = \case
+  AZ -> Refl
+  AS x -> case eqSymmetry x of
+    Refl -> Refl
+
+-- | Reflexivity of equality (roughly)
+--
+-- \[
+--  forall n m. n + m = n + m
+-- \]
+eqReflexivity :: Size n -> Add n m (Plus n m)
+eqReflexivity = \case
+  SZ -> AZ
+  SS x -> lsuccAdd $ eqReflexivity x
+
+{-------------------------------------------------------------------------------
+  DeBruijn utilities
+--------------------------------------------------------------------------------}
+
+-- | Reverse an 'Env'
+reverseEnv :: forall ctx a. Env ctx a -> Env ctx a
+reverseEnv = \env -> go (lzeroAdd (sizeEnv env)) EmptyEnv env
+  where
+    go ::
+         forall ctx1 ctx2 ctx3.
+         -- | Proof that the output environment's size is the same as the sum of
+         -- the two input environment's sizes
+         Add ctx1 ctx2 ctx3
+         -- | Accumulator
+      -> Env ctx1 a
+         -- | Input to reverse
+      -> Env ctx2 a
+      -> Env ctx3 a
+    go proof acc EmptyEnv = case unrzeroAdd proof of
+        Refl -> acc
+    go proof acc (xs :> x) = go (swapAdd proof) (acc :> x) xs
+
+idxsEnv :: Env ctx a -> Env ctx (Idx ctx)
+idxsEnv env = tabulateEnv (sizeEnv env) id
+
+idxsPairEnv :: Env ctx a -> Env ctx (Idx ctx, a)
+idxsPairEnv env = zipWithEnv (,) (idxsEnv env) env
diff --git a/src-internal/HsBindgen/Backend/SHs/Translation/MapFunction.hs b/src-internal/HsBindgen/Backend/SHs/Translation/MapFunction.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/SHs/Translation/MapFunction.hs
@@ -0,0 +1,152 @@
+-- | Map a function 'SHs.SExpr' from one type to another by converting its
+-- arguments and result
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.Backend.SHs.Translation.Convert
+module HsBindgen.Backend.SHs.Translation.MapFunction (
+    MapFunctionParams (..)
+  , ConvArg (..)
+  , ConvRes (..)
+  , mapFunctionExpr
+  ) where
+
+import DeBruijn (EmptyCtx, Env (..), Idx, Size (..), Wk (..), weakenIdx)
+
+import HsBindgen.Backend.SHs.AST qualified as SHs
+import HsBindgen.Backend.SHs.Translation.Common qualified as SHs
+import HsBindgen.Imports
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.NameHint (NameHint (NameHint))
+
+-- | Parameters for 'mapFunctionExpr'
+data MapFunctionParams ctx = MapFunctionParams {
+    -- | The conversion expression to apply to function arguments
+    convArg  :: ConvArg
+    -- | The conversion expression to apply to the function result
+  , convRes  :: ConvRes
+    -- | The type each function arguments
+  , args     :: [Hs.Type]
+    -- | The type of the function result
+  , res      :: Hs.Type
+    -- | The function expression that we apply the mapping to
+  , funExpr  :: SHs.SExpr ctx
+    -- | The size of the context of 'funExpr'
+  , size     :: Size ctx
+  }
+
+-- | The conversion expression to apply to function arguments
+newtype ConvArg = ConvArg (forall ctx. Hs.Type -> Idx ctx -> SHs.SExpr ctx)
+
+applyConvArg :: ConvArg -> Hs.Type -> Idx ctx -> SHs.SExpr ctx
+applyConvArg (ConvArg k) = k
+
+-- | The conversion expression to apply to the function result
+newtype ConvRes = ConvRes (forall ctx. Hs.Type -> SHs.SExpr ctx -> SHs.SExpr ctx)
+
+applyConvRes :: ConvRes -> Hs.Type -> SHs.SExpr ctx -> SHs.SExpr ctx
+applyConvRes (ConvRes k) = k
+
+
+-- local type synonyms
+type ArgType = Hs.Type
+type ResType = Hs.Type
+type FunExpr ctx = SHs.SExpr ctx
+
+-- | Map a function 'SHs.SExpr' from one type to another by converting its
+-- arguments and result
+--
+-- For example, let's say:
+--
+-- * @fun@ is the name of the function we are converting
+-- * @convArg@ is the expression we apply to arguments
+-- * @convRes@ is the expression we apply to the result
+--
+-- Then the result of @mapFunctionExpr@ looks roughly like:
+--
+-- >  \x0 -> \x1 -> \x2 -> \x3 ->
+-- >    convRes (fun (convArg x0) (convArg x1) (convArg x2) (convArg x3))
+--
+-- NOTE: Currently 'mapFunctionExpr' is only used by
+-- 'HsBindgen.Backend.Hs.Translation.ForeignImport.mapToFFI' and
+-- 'HsBindgen.Backend.Hs.Translation.ForeignImport.mapFromFFI'
+--
+mapFunctionExpr ::  MapFunctionParams ctx -> SHs.SExpr ctx
+mapFunctionExpr params =
+    -- construct lambdas for all function arguments
+    lambdas params.funExpr (mkWk params.size) EmptyEnv params.args $ \funExpr' wk env ->
+      -- convert the function result
+      convertRes params.res $
+        -- call the function
+        callFunction funExpr' $
+          -- convert the function arguments
+          convertArgs wk env
+  where
+    -- | We use a weakening ('Wk') to track that the context of local function
+    -- arguments is smaller than than the complete context of 'funExpr'.
+    mkWk :: forall ctx1. Size ctx1 -> Wk EmptyCtx ctx1
+    mkWk sz = case sz of
+      SZ -> IdWk
+      SS x -> SkipWk $ mkWk x
+
+    -- | Construct a sequence of lambdas:
+    --
+    -- > \x0 -> \x1 -> \x2 -> \x3 -> ...
+    --
+    lambdas ::
+         forall ctx1 ctx2.
+         -- | The function expression has to be shifted under lambdas
+         FunExpr ctx1
+      -> Wk ctx2 ctx1
+      -> Env ctx2 ArgType
+      -> [ArgType]
+      -> (forall ctx1' ctx2'. FunExpr ctx1' -> Wk ctx2' ctx1' -> Env ctx2' ArgType -> SHs.SExpr ctx1')
+      -> SHs.SExpr ctx1
+    lambdas fun0 wk0 env0 xs0 kont = go fun0 wk0 env0 xs0
+      where
+        -- | Run down the context of function arguments, and include a lambda
+        -- for each.
+        go ::
+             forall ctx1' ctx2'.
+             FunExpr ctx1'
+          -> Wk ctx2' ctx1'
+          -> Env ctx2'  ArgType
+          -> [ArgType]
+          -> SHs.SExpr ctx1'
+        go fun wk env []     = kont fun wk env
+        go fun wk env (x:xs) = SHs.ELam (NameHint "x") $ go (SHs.shiftExpr fun) (KeepWk wk) (env :> x) xs
+
+    -- | Convert the function result
+    --
+    -- > ... convRes (...)
+    --
+    convertRes ::
+         forall ctx1.
+         ResType
+      -> SHs.SExpr ctx1
+      -> SHs.SExpr ctx1
+    convertRes res e = applyConvRes params.convRes res e
+
+    -- | Construct a call to the function
+    --
+    -- > ... fun ...
+    --
+    callFunction ::
+         forall ctx1.
+         FunExpr ctx1
+      -> [SHs.SExpr ctx1]
+      -> SHs.SExpr ctx1
+    callFunction funExpr args = funExpr `SHs.eAppMany` args
+
+    -- | Convert function arguments
+    --
+    -- > ... (convArg x0) (convArg x1) (convArg x2) (convArg x3)
+    --
+    convertArgs ::
+         forall ctx1 ctx2.
+         Wk ctx2 ctx1
+      -> Env ctx2 ArgType
+      -> [SHs.SExpr ctx1]
+    convertArgs wk args = map (uncurry $ flip $ applyConvArg params.convArg) args'
+      where
+        args' = fmap (first (weakenIdx wk)) $ toList $ SHs.idxsPairEnv args
diff --git a/src-internal/HsBindgen/Backend/TH/Translation.hs b/src-internal/HsBindgen/Backend/TH/Translation.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/TH/Translation.hs
@@ -0,0 +1,530 @@
+{-# LANGUAGE MagicHash             #-}
+{-# LANGUAGE TemplateHaskellQuotes #-}
+
+module HsBindgen.Backend.TH.Translation (
+    mkDecl,
+) where
+
+import Control.Monad (liftM2)
+import Data.ByteString qualified as BS
+import Data.List qualified as List
+import Data.Set qualified as Set
+import Data.Text qualified as Text
+import DeBruijn (Add (..), EmptyCtx, Env (..), lookupEnv)
+import Foreign.C (CChar (..))
+import Foreign.C.Types qualified
+import GHC.Base qualified
+import GHC.Float (castDoubleToWord64, castFloatToWord32, castWord32ToFloat,
+                  castWord64ToDouble)
+import Language.Haskell.TH (Quote)
+import Language.Haskell.TH qualified as TH
+import Language.Haskell.TH.Syntax qualified as TH
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.Level
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Backend.SHs.AST.Expr (FBind (FBind))
+import HsBindgen.Backend.SHs.Translation.Common
+import HsBindgen.Config (FieldNamingStrategy)
+import HsBindgen.Errors
+import HsBindgen.Guasi
+import HsBindgen.Imports
+import HsBindgen.Instances as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.NameHint
+import HsBindgen.Util.Rational (canBeRepresentedAsRational)
+
+{-------------------------------------------------------------------------------
+  Backend definition
+-------------------------------------------------------------------------------}
+
+mkGlobalExpr :: Quote q => Global LvlTerm -> q TH.Exp
+mkGlobalExpr g = case g.cat of
+  GVar -> TH.varE g.name
+  GCon -> TH.conE g.name
+
+mkExpr :: Guasi q => Env ctx TH.Name -> SExpr ctx -> q TH.Exp
+mkExpr env expr = case asNaryEApp expr of
+    (EBoxedTup n, args) ->
+      prettyTupleExpr Boxed env n args
+    (EUnboxedTup n, args) ->
+      prettyTupleExpr Unboxed env n args
+    (EApp{} , _) ->
+      panicWith
+        "Unexpected function application after unrolling function applications"
+        expr
+    _otherwise -> mkRolledExpr env expr
+
+-- See 'mkExpr' but do not unroll/recognize function applications.
+mkRolledExpr :: Guasi q => Env ctx TH.Name -> SExpr ctx -> q TH.Exp
+mkRolledExpr env expr = case expr of
+    EGlobal n     -> mkGlobalExpr n
+    EFree n       -> TH.varE $ mkHsTermName n
+    EBound x      -> TH.varE (lookupEnv x env)
+    ECon n        -> TH.conE $ mkHsName n
+    EUnboxedIntegral i -> TH.sigE (TH.litE (TH.IntPrimL i)) (TH.conT ''GHC.Base.Int#)
+    EIntegral i Nothing -> TH.litE (TH.IntegerL i)
+    EIntegral i (Just t) -> TH.sigE (TH.litE (TH.IntegerL i)) (mkType EmptyEnv t)
+    -- TH doesn't have floating-point literals, because it represents them
+    -- using the Rational type, which is incorrect. (See GHC ticket #13124.)
+    --
+    -- To work around this problem, we cast floating-point numbers to
+    -- Word32/Word64 and then cast back.
+    EFloat f t ->
+      TH.sigE
+        ( if canBeRepresentedAsRational f
+            then [| f |]
+            else [| Foreign.C.Types.CFloat $ castWord32ToFloat  $( TH.lift $ castFloatToWord32  f ) |]
+        )
+        (mkType EmptyEnv t)
+    EDouble d t ->
+      TH.sigE
+        ( if canBeRepresentedAsRational d
+            then [| d |]
+            else [| Foreign.C.Types.CDouble $ castWord64ToDouble $( TH.lift $ castDoubleToWord64 d ) |]
+        )
+        (mkType EmptyEnv t)
+    ECChar (CChar i) -> [| CChar $(TH.lift i) |]
+    -- Not @[| s |]@: cross-stage lifting of a 'String' yields a list of 'Char'
+    -- literals unless the @TH:liftString@ rewrite rule fires, which needs @-O@.
+    -- This is problematic during development.
+    EString s -> TH.litE (TH.StringL s)
+    ECString bs ->
+      TH.appE
+        (mkGlobalExpr (bindgenGlobalTerm ByteString_pack))
+        (TH.listE $ map (\w -> TH.litE (TH.IntegerL (fromIntegral w))) (BS.unpack bs))
+    EApp f x      -> TH.appE (mkExpr env f) (mkExpr env x)
+    EInfix op x y -> TH.infixE
+                       (Just $ mkExpr env x)
+                       (mkGlobalExpr $ infixOpGlobal op)
+                       (Just $ mkExpr env y)
+    ELam (NameHint x) f      -> do
+        x' <- TH.newName x
+        TH.lamE [TH.varP x'] (mkExpr (env :> x') f)
+    EUnusedLam f ->
+        TH.lamE [TH.wildP] (mkExpr env f)
+    ECase x alts  -> TH.caseE (mkExpr env x)
+                       [ case alt of
+                           SAlt c add hints b -> do
+                             (xs, env') <- newNames env add hints
+                             TH.match
+                                (TH.conP (mkHsName c) (map TH.varP xs))
+                                (TH.normalB $ mkExpr env' b)
+                                []
+                           SAltNoConstr hints b -> do
+                             -- SAltNoConstr has one name hint only
+                             -- guaranteed by the type.
+                             (xs, env') <- newNames env (AS AZ) hints
+                             case xs of
+                               []    ->
+                                 panicPure "Expected one name hint, but SAltNoConstr had none"
+                               [v]   ->
+                                 TH.match
+                                   (TH.varP v)
+                                   (TH.normalB $ mkExpr env' b)
+                                   []
+                               vs ->
+                                 panicPure $ "Expected one name hint, but SAltNoConstr had more: " <> show vs
+                           SAltUnboxedTuple add hints b -> do
+                             (xs, env') <- newNames env add hints
+                             TH.match
+                                (TH.unboxedTupP $ map TH.varP xs)
+                                (TH.normalB $ mkExpr env' b)
+                                []
+                       | alt <- alts
+                       ]
+    EUnit -> TH.tupE []
+    -- Handled in 'mkExpr'.
+    EBoxedTup{} ->
+      panicWith
+        "Unexpected boxed, unsaturated tuple after unrolling function applications"
+        expr
+    -- Handled in 'mkExpr'.
+    EUnboxedTup{} ->
+      panicWith
+        "Unexpected unboxed, unsaturated tuple after unrolling function applications"
+        expr
+    EList xs -> TH.listE $ mkExpr env <$> xs
+    ETypeApp f t -> TH.appTypeE (mkExpr env f) (mkType EmptyEnv t)
+    ERecCon con fs -> TH.recConE (mkHsName con) (fmap (mkFBind env) fs)
+
+mkFBind :: Guasi q => Env ctx TH.Name -> FBind ctx -> q (TH.Name, TH.Exp)
+mkFBind env (FBind label expr) = (TH.mkName label,) <$> mkExpr env expr
+
+mkPat :: Quote q => PatExpr -> q TH.Pat
+mkPat = \case
+    PEApps n xs -> TH.conP (mkHsName n) (map mkPat xs)
+    PELit i -> TH.litP (TH.IntegerL i)
+
+mkType :: Guasi q => Env ctx TH.Name -> SType ctx -> q TH.Type
+mkType env ty = case asNaryTApp ty of
+    (TBoxedTup n, args) ->
+      prettyTupleType env n args
+    (TApp{}, _) ->
+      panicWith
+        "Unexpected type application after unrolling type applications"
+        ty
+    _otherwise ->
+      mkRolledType env ty
+
+-- See 'mkType' but do not unroll/recognize type applications.
+mkRolledType :: Guasi q => Env ctx TH.Name -> SType ctx -> q TH.Type
+mkRolledType env ty = case ty of
+    TGlobal n  -> TH.conT n.name
+    TClass cls -> TH.conT $ (.name) $ typeClassGlobal cls
+    TCon n     -> TH.conT $ mkHsName n
+    TFun a b   -> TH.arrowT `TH.appT` mkType env a `TH.appT` mkType env b
+    TLit n     -> TH.litT (TH.numTyLit (toInteger n))
+    TStrLit s  -> TH.litT (TH.strTyLit s)
+    TExt extRef -> lookupExtType extRef
+    TBound x   -> TH.varT (lookupEnv x env)
+    TFree n    -> TH.varT $ mkHsName n
+    TApp f t   -> TH.appT (mkType env f) (mkType env t)
+    TUnit -> pure $ TH.TupleT 0
+    -- Handled in 'mkType'.
+    TBoxedTup{} ->
+      panicWith
+        "Unexpected unsaturated tuple after unrolling type application"
+        ty
+    TEq -> TH.conT (bindgenGlobalType TypeEquality_type).name
+    TForall hints add ctxt body -> do
+        let bndr tv = TH.PlainTV tv TH.SpecifiedSpec
+        (xs, env') <- newNames env add hints
+        TH.forallT
+            (map bndr xs)
+            (traverse (mkType env') ctxt)
+            (mkType env' body)
+    TList t -> TH.appT TH.listT $ mkType env t
+
+mkDecl :: forall q. Guasi q => FieldNamingStrategy -> SDecl -> q [TH.Dec]
+mkDecl fns = \case
+      DTypSyn typSyn -> do
+        targetType <- mkType EmptyEnv typSyn.typ
+        pure [TH.TySynD (mkHsName typSyn.name) [] targetType]
+      DInst inst -> do
+        instanceDec <-
+          TH.instanceD
+            (return [])
+            (TH.forallT
+              []
+              (mapM (mkType EmptyEnv) inst.super)
+              (appsT (TH.conT $ (.name) $ typeClassGlobal inst.clss)
+                (map (mkType EmptyEnv) inst.args)))
+            (concat [
+                map instTySyn inst.types
+              , map (\(x, f) -> simpleDecl x.name f) inst.decs
+              ])
+
+        -- TODO <https://github.com/well-typed/hs-bindgen/issues/976>
+        -- We should add haddock comment to the class head, but we cannot due to
+        -- a GHC bug. We also don't put the comments on any of the class members
+        -- (type synonyms / functions) because that leads to similar bugs.
+        --
+        -- putDocTypeM _type_ inst.comment
+        pure [instanceDec]
+
+      DRecord record -> do
+        let fields :: [q TH.VarBangType]
+            docs   :: [(Hs.Name Hs.NsVar, Maybe HsDoc.Comment)]
+            (fields, docs) = unzip
+              [ ( TH.varBangType (mkHsName field.name) $
+                    TH.bangType
+                      (TH.bang TH.noSourceUnpackedness TH.noSourceStrictness)
+                      (mkType EmptyEnv field.typ)
+                , (field.name, field.comment)
+                )
+              | field <- record.fields
+              ]
+        traverse_ (uncurry (putLocalFieldDocM fns record.con)) docs
+
+        decl <-
+          TH.dataD
+            (TH.cxt [])
+            (mkHsName record.typ)
+            []
+            Nothing
+            [TH.recC (mkHsName record.con) fields]
+            (nestedDeriving record.deriv)
+        putLocalDocM record.typ record.comment
+
+        pure [decl]
+
+      DEmptyData empty -> do
+        decl <- TH.dataD (TH.cxt []) (mkHsName empty.name) [] Nothing [] []
+        putLocalDocM empty.name empty.comment
+        pure [decl]
+
+      DNewtype newtyp -> do
+        let field :: q TH.VarBangType
+            field = TH.varBangType (mkHsName newtyp.field.name) $
+              TH.bangType
+                (TH.bang TH.noSourceUnpackedness TH.noSourceStrictness)
+                (mkType EmptyEnv newtyp.field.typ)
+
+        putLocalFieldDocM fns newtyp.con newtyp.field.name newtyp.field.comment
+
+        decl <-
+          TH.newtypeD
+            (TH.cxt [])
+            (mkHsName newtyp.name)
+            []
+            Nothing
+            (TH.recC (mkHsName newtyp.con) [field])
+            (nestedDeriving newtyp.deriv)
+        putLocalDocM (newtyp.name) (newtyp.comment)
+        pure [decl]
+
+      DDerivingInstance deriv -> do
+        s' <- strategy deriv.strategy
+
+        -- NOTE: We can't attach documentation to standalone deriving clauses.
+        -- See 'GHC.Internal.TH.Lib.withDecDoc.doc_loc'.
+        fmap singleton $ TH.standaloneDerivWithStrategyD
+          (Just s')
+          (TH.cxt [])
+          (mkType EmptyEnv deriv.typ)
+
+      DForeignImport foreignImport -> do
+        let safety :: TH.Safety
+            safety = case foreignImport.safety of
+              Safe   -> TH.Safe
+              Unsafe -> TH.Unsafe
+
+            callconv :: TH.Callconv
+            impent   :: String
+            (callconv, impent) =
+              case foreignImport.callConv of
+                CallConvUserlandCapi _ -> (TH.CCall,
+                    Text.unpack foreignImport.origName.text
+                  )
+                CallConvGhcCapi header -> (TH.CApi, concat [
+                    header
+                  , Text.unpack foreignImport.origName.text
+                  ])
+                CallConvGhcCCall style -> (TH.CCall, concat [
+                    case style of
+                      ImportAsValue -> ""
+                      ImportAsPtr   -> "&"
+                  , Text.unpack foreignImport.origName.text
+                  ])
+
+            importType = foldr (TFun . (.typ)) foreignImport.result.typ foreignImport.parameters
+
+        decl <-
+          fmap TH.ForeignD $
+            TH.ImportF
+              <$> pure callconv
+              <*> pure safety
+              <*> pure impent
+              <*> pure (mkHsTermName foreignImport.name)
+              <*> mkType EmptyEnv importType
+        putLocalDocTermNameM foreignImport.name foreignImport.comment
+        pure [decl]
+
+      DBinding binding -> do
+        let bindingName :: TH.Name
+            bindingName = mkHsTermName binding.name
+            bindingType :: SType EmptyCtx
+            bindingType = foldr (TFun . (.typ)) binding.result.typ binding.parameters
+
+        decls <- sequence $
+          map (pragma binding.name) binding.pragmas
+          ++ [
+                TH.SigD <$> pure bindingName
+                  <*> mkType EmptyEnv bindingType
+            , simpleDecl bindingName binding.body
+            ]
+        putLocalDocTermNameM binding.name binding.comment
+        pure decls
+
+      DPatternSynonym patSyn -> do
+        let thPatSynName = mkHsName patSyn.name
+
+        decls <- sequence
+          [ TH.patSynSigD
+              thPatSynName
+              (mkType EmptyEnv patSyn.typ)
+          , TH.patSynD
+            thPatSynName
+            (TH.prefixPatSyn [])
+            TH.implBidir
+            (mkPat patSyn.rhs)
+          ]
+        putLocalDocM patSyn.name patSyn.comment
+        pure decls
+
+      DCompletePragma completePragma ->
+        List.singleton
+          <$> TH.pragCompleteD (map mkHsName completePragma.patterns) Nothing
+    where
+      simpleDecl :: TH.Name -> SExpr EmptyCtx -> q TH.Dec
+      simpleDecl x f = TH.valD (TH.varP x) (TH.normalB $ mkExpr EmptyEnv f) []
+
+      instTySyn :: (Global LvlType, [ClosedType], ClosedType) -> q TH.Dec
+      instTySyn (g, typArgs, typSyn) =
+        TH.TySynInstD
+          <$> liftM2
+                (TH.TySynEqn Nothing)
+                (mkType EmptyEnv (foldl (\acc x -> acc `TApp` x) (TGlobal g) typArgs))
+                (mkType EmptyEnv typSyn)
+
+      pragma :: Hs.TermName -> Pragma -> q TH.Dec
+      pragma n = \case
+        NOINLINE ->
+            TH.pragInlD (mkHsTermName n) TH.NoInline TH.FunLike TH.AllPhases
+
+-- | Nested deriving clauses (part of a datatype declaration)
+nestedDeriving :: forall q.
+     Guasi q
+  => [(Hs.Strategy ClosedType, [Inst.TypeClass])] -> [q TH.DerivClause]
+nestedDeriving = map aux
+  where
+    aux :: (Hs.Strategy ClosedType, [Inst.TypeClass]) -> q TH.DerivClause
+    aux (s, clss) = do
+        s' <- strategy s
+        TH.derivClause (Just s') (map (TH.conT . (.name) . typeClassGlobal) clss)
+
+strategy :: Guasi q => Hs.Strategy ClosedType -> q TH.DerivStrategy
+strategy Hs.DeriveNewtype  = return TH.NewtypeStrategy
+strategy Hs.DeriveStock    = return TH.StockStrategy
+strategy (Hs.DeriveVia ty) = TH.ViaStrategy <$> mkType EmptyEnv ty
+
+{-------------------------------------------------------------------------------
+  Monad functionality
+-------------------------------------------------------------------------------}
+
+appsT :: Quote q => q TH.Type -> [q TH.Type] -> q TH.Type
+appsT = foldl' TH.appT
+
+-- | Create a 'TH.name' from an 'Hs.Name'
+--
+-- Be careful! This function uses 'TH.mkName'. Names created with 'TH.mkName'
+-- are resolved in the context of the use site of the splice. That is, used
+-- symbols /must be in scope/, and users must import the probably only
+-- indirectly-used modules.
+mkHsName :: Hs.Name ns -> TH.Name
+mkHsName = TH.mkName . Hs.nameToStr
+
+-- | Create a 'TH.name' from an 'Hs.TermName'
+--
+-- Be careful! This function uses 'TH.mkName'. Names created with 'TH.mkName'
+-- are resolved in the context of the use site of the splice. That is, used
+-- symbols /must be in scope/, and users must import the probably only
+-- indirectly-used modules.
+mkHsTermName :: Hs.TermName -> TH.Name
+mkHsTermName = TH.mkName . Hs.termNameToStr
+
+newNames ::
+     Quote q
+  => Env ctx TH.Name
+  -> Add n ctx ctx'
+  -> Vec n NameHint
+  -> q ([TH.Name], Env ctx' TH.Name)
+newNames env AZ _ = return ([], env)
+newNames env (AS n) (NameHint hint ::: hints) = do
+    (xs, env') <- newNames env n hints
+    x <- TH.newName hint
+    return (x : xs, env' :> x)
+
+
+putLocalFieldDocM ::
+     Guasi g
+  => FieldNamingStrategy
+  -> Hs.Name Hs.NsConstr
+  -> Hs.Name Hs.NsVar
+  -> Maybe HsDoc.Comment
+  -> g ()
+putLocalFieldDocM fns parent field = traverse_ (putLocalFieldDoc fns parent field)
+
+{-------------------------------------------------------------------------------
+  Tuples
+-------------------------------------------------------------------------------}
+
+data TupleType = Boxed | Unboxed
+
+prettyTupleExpr ::
+     Guasi q
+  => TupleType
+  -> Env ctx TH.Name
+  -> Plus2
+  -> [SExpr ctx]
+  -> q TH.Exp
+prettyTupleExpr ty env n decls = case compare arity nDecls of
+  LT ->
+    panicPure $ mconcat [
+        "Too many declarations ("
+      , show nDecls
+      , ") for "
+      , show arity ++ "-tuple"
+      ]
+  _otherwise -> do
+    declExprs <- mapM (mkExpr env) decls
+    let nMissing :: Int
+        nMissing = arity - nDecls
+
+        fakeDecls :: [Maybe TH.Exp]
+        fakeDecls = map Just declExprs ++ replicate nMissing Nothing
+    pure $ thTupleCon fakeDecls
+  where
+    arity, nDecls :: Int
+    arity  = fromIntegral (applyPlus2 n)
+    nDecls = length decls
+
+    thTupleCon :: [Maybe TH.Exp] -> TH.Exp
+    thTupleCon = case ty of
+      Boxed   -> TH.TupE
+      Unboxed -> TH.UnboxedTupE
+
+prettyTupleType :: Guasi q => Env ctx TH.Name -> Plus2 -> [SType ctx] -> q TH.Type
+prettyTupleType env n decls = case compare arity nDecls of
+  LT ->
+    panicPure $ mconcat [
+        "Too many declarations ("
+      , show nDecls
+      , ") for "
+      , show arity ++ "-tuple"
+      ]
+  _otherwise -> foldl' TH.appT (TH.tupleT arity) $ mkType env <$> decls
+  where
+    arity, nDecls :: Int
+    arity  = fromIntegral (applyPlus2 n)
+    nDecls = length decls
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+panicWith :: Show a => String -> a -> b
+panicWith msg x = panicPure $ msg ++ ": " ++ show x
+
+-- | Look up a type name from an external binding spec.
+--
+-- If the name is not in scope, report a helpful error message telling the user
+-- which module they need to import, then falls back to 'TH.mkName' to avoid
+-- cascading type errors.
+--
+-- See https://github.com/well-typed/hs-bindgen/issues/1622.
+lookupExtType :: Guasi q => Hs.ExtRef -> q TH.Type
+lookupExtType extRef = do
+    mName <- lookupTypeName qualName
+    case mName of
+      Just n  -> TH.conT n
+      Nothing -> do
+          modifyGuasi (putMissingModule extRef.moduleName)
+          TH.conT (TH.mkName qualName)
+  where
+    qualName :: String
+    qualName = concat [
+          Hs.moduleNameToString extRef.moduleName
+        , "."
+        , Text.unpack extRef.name.text
+        ]
+
+    putMissingModule :: Hs.ModuleName -> GuasiState -> GuasiState
+    putMissingModule m s = s & #missingModules %~ Set.insert m
+
diff --git a/src-internal/HsBindgen/Backend/UniqueSymbol.hs b/src-internal/HsBindgen/Backend/UniqueSymbol.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Backend/UniqueSymbol.hs
@@ -0,0 +1,101 @@
+-- | Unique symbols (for use in generated C code)
+--
+-- Intended for unqualified import.
+module HsBindgen.Backend.UniqueSymbol (
+    -- * Generating unique names
+    UniqueSymbol(unique, source)
+  , uniqueCDeclName
+  , globallyUnique
+  , locallyUnique
+  ) where
+
+import Crypto.Hash.SHA256 (hash)
+import Data.ByteString.Base16 qualified as B16
+import Data.ByteString.Char8 qualified as B
+import Data.Char (isLetter)
+import Data.Text qualified as Text
+import GHC.Unicode (isDigit)
+
+import HsBindgen.Config.Prelims
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Generating unique names
+-------------------------------------------------------------------------------}
+
+data UniqueSymbol = UniqueSymbol{
+      -- | Generated unique symbol
+      unique :: String
+
+      -- | Source of the unique symbol
+      --
+      -- This is intended to be included in the generated output as a comment,
+      -- facilitating both reading the source code ("what is this function?") as
+      -- well as debugging problems with generated unique symbols (for example
+      -- if they unexpectedly change).
+    , source :: String
+    }
+  deriving (Show, Eq, Ord, Generic)
+
+uniqueCDeclName :: UniqueSymbol -> C.DeclName
+uniqueCDeclName uniqueSymbol =
+    C.DeclName (Text.pack uniqueSymbol.unique) C.NameKindOrdinary
+
+-- | Globally unique symbol
+--
+-- The C namespace is entirely flat, so when we generate new C functions, we
+-- must make sure to pick globally unique names. We do this by generating names
+-- of the following shape:
+--
+-- > "hs_bindgen_" ++ hashOf 'HsBindgen.Config.Prelims.UniqueId' 'HsBindgen.Config.Prelims.BaseModuleName' 'String'
+--
+-- where 'String' is some arbitrary string, which the caller must ensure is
+-- unique for a given 'HsBindgen.Config.Prelims.UniqueId' and 'HsBindgen.Config.Prelims.BaseModuleName'.
+--
+-- We only use the hash in the name to avoid problems with linkers that only use
+-- a fixed length prefix of names; callers should ensure that
+-- @UniqueSymbol.source@ in included in a suitable comment.
+globallyUnique :: UniqueId -> BaseModuleName -> String -> UniqueSymbol
+globallyUnique (UniqueId uniqueId) baseModuleName str =
+    locallyUnique $ concat [
+        sanitizeUniqueId uniqueId
+      , "_"
+      , baseModuleNameToString baseModuleName
+      , "_"
+      , str
+      ]
+
+-- | Produce symbol that is locally unique (that is, unique in a Haskell module)
+--
+-- This should /NOT/ be used for symbols used in C, since the C namespace is
+-- entirely flat; use 'globallyUnique' instead.
+locallyUnique :: String -> UniqueSymbol
+locallyUnique source = UniqueSymbol{
+      unique = "hs_bindgen_" ++ hashString source
+    , source = source
+    }
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+sanitizeUniqueId :: String -> String
+sanitizeUniqueId = go
+  where
+    go :: String -> String
+    go [] = []
+    go (x:xs)
+      | isLetter x          = x   : go xs
+      | isDigit  x          = x   : go xs
+      | x `elem` ['.', '_'] = '_' : go xs
+      | otherwise           =       go xs
+
+-- | Construct the actual hash
+--
+-- * We use `cryptohash-sha256` to avoid potential dynamic linker problems
+--   (https://github.com/haskell-haskey/xxhash-ffi/issues/4).
+-- * We use ByteString to avoid hash changes induced by a change of how Text
+--   is encoded in GHC 9.2.
+hashString :: String -> String
+hashString = B.unpack . B.take 16 . B16.encode . hash . B.pack
diff --git a/src-internal/HsBindgen/BindingSpec.hs b/src-internal/HsBindgen/BindingSpec.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/BindingSpec.hs
@@ -0,0 +1,324 @@
+-- | Binding specification
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.BindingSpec qualified as BindingSpec
+module HsBindgen.BindingSpec (
+    -- * Public API
+    -- ** Types
+    BindingSpec -- opaque
+  , ExternalBindingSpec
+  , PrescriptiveBindingSpec
+  , ResolvedExtBinding(..)
+    -- ** Configuration
+  , EnableStdlibBindingSpec(..)
+  , BindingSpecConfig(..)
+  , Version.BindingSpecCompatibility(..)
+    -- ** Loading
+  , getStdlibBindingSpec
+  , loadExtBindingSpecs
+  , loadPrescriptiveBindingSpec
+  , loadBindingSpecs
+    -- ** Encoding
+  , Common.Format(..)
+  , Common.getFormat
+  , encode
+    -- ** Trace messages
+  , Common.BindingSpecReadMsg(..)
+  , Common.BindingSpecResolveMsg(..)
+  , Common.BindingSpecMergeMsg(..)
+  , Common.BindingSpecMsg(..)
+
+    -- * Internal API
+  , BindingSpec.currentBindingSpecVersion
+  , empty
+  , moduleName
+    -- ** Types
+  , Common.Omittable(..)
+  , BindingSpec.CTypeSpec(..)
+  , BindingSpec.CEnumSpec(..)
+  , BindingSpec.HsTypeSpec(..)
+  , BindingSpec.HsTypeRep(..)
+  , BindingSpec.HsRecordRep(..)
+  , BindingSpec.HsNewtypeRep(..)
+  , BindingSpec.HsFFIType(..)
+  , BindingSpec.hsSpecFFIType
+  , BindingSpec.InstanceSpec(..)
+    -- ** Query
+  , getCTypes
+  , lookupCTypeSpec
+  , lookupHsTypeSpec
+    -- ** Merging
+  , BindingSpec.MergedBindingSpecs
+  , BindingSpec.lookupMergedBindingSpecs
+  ) where
+
+import Data.ByteString (ByteString)
+import Data.Ord qualified as Ord
+
+import Clang.Args (ClangArgs)
+import Clang.Paths (RealPath)
+
+import HsBindgen.BindingSpec.Private.Common qualified as Common
+import HsBindgen.BindingSpec.Private.Stdlib qualified as Stdlib
+import HsBindgen.BindingSpec.Private.V1 qualified as BindingSpec
+import HsBindgen.BindingSpec.Private.Version qualified as Version
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Util.Monad
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Public API: Types
+-------------------------------------------------------------------------------}
+
+-- | Binding specification
+--
+-- A binding specification serves two purposes:
+--
+-- * A /prescriptive binding specification/ is used to configure how bindings
+--   are generated.
+-- * An /external binding specification/ is used to specify existing bindings
+--   that should be used, /external/ from the module being generated.
+--
+-- Note that a /generated binding specification/ may be used for either/both of
+-- these two purposes.
+data BindingSpec = BindingSpec {
+      unresolved :: BindingSpec.UnresolvedBindingSpec
+    , resolved   :: BindingSpec.ResolvedBindingSpec
+    }
+  deriving stock (Show, Eq)
+
+-- | External binding specification
+--
+-- This type alias is just used as documentation.
+type ExternalBindingSpec = BindingSpec
+
+-- | Prescriptive binding specification
+--
+-- This type alias is just used as documentation.
+type PrescriptiveBindingSpec = BindingSpec
+
+-- | Resolved external binding
+data ResolvedExtBinding = ResolvedExtBinding{
+      -- | C declaration for which we are using this binding
+      cName :: C.DeclId
+
+      -- | Source location(s) of C declaration for which we are using this binding
+    , locs :: C.DeclLocs
+
+      -- | The Haskell type which will be used
+    , hsName :: Hs.ExtRef
+
+      -- | Additional information about the C type
+    , cSpec :: BindingSpec.CTypeSpec
+
+      -- | Additional information about the Haskell type
+    , hsSpec :: BindingSpec.HsTypeSpec
+    }
+  deriving stock (Eq, Ord, Generic, Show)
+
+{-------------------------------------------------------------------------------
+  Public API: Configuration
+-------------------------------------------------------------------------------}
+
+-- | Configure if the @stdlib@ binding specification should be used
+data EnableStdlibBindingSpec =
+    -- | Automatically include @stdlib@
+    EnableStdlibBindingSpec
+    -- | Do not include @stdlib@
+  | DisableStdlibBindingSpec
+  deriving stock (Show, Eq)
+
+instance Default EnableStdlibBindingSpec where
+  def = EnableStdlibBindingSpec
+
+data BindingSpecConfig = BindingSpecConfig {
+      stdlibSpec              :: EnableStdlibBindingSpec
+    , compatibility           :: Version.BindingSpecCompatibility
+    , extBindingSpecs         :: [FilePath]
+    , prescriptiveBindingSpec :: Maybe FilePath
+    }
+  deriving stock (Show, Eq, Generic)
+
+instance Default BindingSpecConfig where
+  def = BindingSpecConfig {
+      stdlibSpec              = EnableStdlibBindingSpec
+    , compatibility           = def
+    , extBindingSpecs         = []
+    , prescriptiveBindingSpec = Nothing
+    }
+
+{-------------------------------------------------------------------------------
+  Public API: Loading
+-------------------------------------------------------------------------------}
+
+-- | Get the standard library external binding specification
+getStdlibBindingSpec ::
+     Tracer Common.BindingSpecMsg
+  -> ClangArgs
+  -> IO ExternalBindingSpec
+getStdlibBindingSpec tracer args = BindingSpec Stdlib.bindingSpec <$>
+    BindingSpec.resolve
+      (contramap Common.BindingSpecResolveMsg tracer)
+      Common.BindingSpecResolveExternalHeader
+      args
+      Stdlib.bindingSpec
+
+-- | Load external binding specifications
+--
+-- The format is determined by filename extension.  The following formats are
+-- supported:
+--
+-- * YAML (@.yaml@ extension)
+-- * JSON (@.json@ extension)
+loadExtBindingSpecs ::
+     Tracer Common.BindingSpecMsg
+  -> ClangArgs
+  -> EnableStdlibBindingSpec
+  -> Version.BindingSpecCompatibility
+  -> [FilePath]
+  -> IO BindingSpec.MergedBindingSpecs
+loadExtBindingSpecs tracer args enableStdlib cmpt paths = do
+    uspecs <- withStdlib <$> mapMaybeM read' paths
+    rspecs <- mapM resolve' uspecs
+    let (msgs, mspec) = BindingSpec.merge rspecs
+    mapM_ (traceWith tracerMerge . withCallStack) msgs
+    return mspec
+  where
+    withStdlib ::
+         [BindingSpec.UnresolvedBindingSpec]
+      -> [BindingSpec.UnresolvedBindingSpec]
+    withStdlib = case enableStdlib of
+      DisableStdlibBindingSpec -> id
+      EnableStdlibBindingSpec  -> (Stdlib.bindingSpec :)
+
+    read' :: FilePath -> IO (Maybe BindingSpec.UnresolvedBindingSpec)
+    read' = BindingSpec.readFile tracerRead cmpt Nothing
+
+    resolve' ::
+         BindingSpec.UnresolvedBindingSpec
+      -> IO BindingSpec.ResolvedBindingSpec
+    resolve' =
+      BindingSpec.resolve
+        tracerResolve
+        Common.BindingSpecResolveExternalHeader
+        args
+
+    tracerRead :: Tracer Common.BindingSpecReadMsg
+    tracerRead = contramap Common.BindingSpecReadMsg tracer
+
+    tracerResolve :: Tracer Common.BindingSpecResolveMsg
+    tracerResolve = contramap Common.BindingSpecResolveMsg tracer
+
+    tracerMerge :: Tracer Common.BindingSpecMergeMsg
+    tracerMerge = contramap Common.BindingSpecMergeMsg tracer
+
+-- | Load prescriptive binding specification
+--
+-- The format is determined by filename extension.  The following formats are
+-- supported:
+--
+-- * YAML (@.yaml@ extension)
+-- * JSON (@.json@ extension)
+loadPrescriptiveBindingSpec ::
+     Tracer Common.BindingSpecMsg
+  -> ClangArgs
+  -> Hs.ModuleName
+  -> Version.BindingSpecCompatibility
+  -> Maybe FilePath
+  -> IO PrescriptiveBindingSpec
+loadPrescriptiveBindingSpec tracer args hsModuleName cmpt =
+    fmap (fromMaybe $ empty hsModuleName) . \case
+      Nothing   -> return Nothing
+      Just path ->
+        BindingSpec.readFile tracerRead cmpt (Just hsModuleName) path >>= \case
+          Nothing -> return Nothing
+          Just uspec ->
+            Just . BindingSpec uspec <$>
+              BindingSpec.resolve
+                tracerResolve
+                Common.BindingSpecResolvePrescriptiveHeader
+                args
+                uspec
+  where
+    tracerRead :: Tracer Common.BindingSpecReadMsg
+    tracerRead = contramap Common.BindingSpecReadMsg tracer
+
+    tracerResolve :: Tracer Common.BindingSpecResolveMsg
+    tracerResolve = contramap Common.BindingSpecResolveMsg tracer
+
+-- | A combination of 'loadExtBindingSpecs' and 'loadPrescriptiveBindingSpec'
+loadBindingSpecs ::
+     Tracer Common.BindingSpecMsg
+  -> ClangArgs
+  -> Hs.ModuleName
+  -> BindingSpecConfig
+  -> IO (BindingSpec.MergedBindingSpecs, PrescriptiveBindingSpec)
+loadBindingSpecs tracer args hsModuleName config =
+    (,)
+      <$> loadExtBindingSpecs
+            tracer
+            args
+            config.stdlibSpec
+            config.compatibility
+            config.extBindingSpecs
+      <*> loadPrescriptiveBindingSpec
+            tracer
+            args
+            hsModuleName
+            config.compatibility
+            config.prescriptiveBindingSpec
+
+{-------------------------------------------------------------------------------
+  Public API: Encoding
+-------------------------------------------------------------------------------}
+
+-- | Encode a binding specification
+encode :: Common.Format -> BindingSpec -> ByteString
+encode format spec = BindingSpec.encode defCompareCDeclId format spec.unresolved
+  where
+    defCompareCDeclId :: C.DeclId -> C.DeclId -> Ordering
+    defCompareCDeclId = Ord.comparing C.renderDeclId
+
+{-------------------------------------------------------------------------------
+  Internal API
+-------------------------------------------------------------------------------}
+
+-- | Construct an empty binding specification for the given module
+empty :: Hs.ModuleName -> BindingSpec
+empty hsModuleName = BindingSpec{
+      unresolved = BindingSpec.empty hsModuleName
+    , resolved   = BindingSpec.empty hsModuleName
+    }
+
+-- | Get the module name for a binding specification
+moduleName :: BindingSpec -> Hs.ModuleName
+moduleName spec = spec.unresolved.moduleName
+
+{-------------------------------------------------------------------------------
+  Internal API: Query
+-------------------------------------------------------------------------------}
+
+-- | Get the C types in a binding specification
+getCTypes :: BindingSpec -> Map C.DeclId [Set RealPath]
+getCTypes spec = BindingSpec.getCTypes spec.resolved
+
+-- | Lookup the @'Common.Omittable' 'BindingSpec.CTypeSpec'@ associated with a C
+-- type
+lookupCTypeSpec ::
+     C.DeclId
+  -> Set RealPath
+  -> BindingSpec
+  -> Maybe (Hs.ModuleName, Common.Omittable BindingSpec.CTypeSpec)
+lookupCTypeSpec cDeclId headers spec =
+    BindingSpec.lookupCTypeSpec cDeclId headers spec.resolved
+
+-- | Lookup the 'BindingSpec.HsTypeSpec' associated with a Haskell type
+lookupHsTypeSpec ::
+     Hs.Name Hs.NsTypeConstr
+  -> BindingSpec
+  -> Maybe BindingSpec.HsTypeSpec
+lookupHsTypeSpec hsIdentifier spec =
+    BindingSpec.lookupHsTypeSpec hsIdentifier spec.resolved
diff --git a/src-internal/HsBindgen/BindingSpec/Gen.hs b/src-internal/HsBindgen/BindingSpec/Gen.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/BindingSpec/Gen.hs
@@ -0,0 +1,301 @@
+-- | Binding specification generation
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.BindingSpec.Gen qualified as BindingSpec
+module HsBindgen.BindingSpec.Gen (
+    -- * Public API
+    genBindingSpec
+  ) where
+
+import Data.ByteString (ByteString)
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Map.Strict qualified as Map
+import Data.Ord qualified as Ord
+import Data.Set qualified as Set
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Backend.Hs.Origin qualified as HsOrigin
+import HsBindgen.BindingSpec.Private.Common
+import HsBindgen.BindingSpec.Private.V1 (CTypeSpec (..), UnresolvedBindingSpec)
+import HsBindgen.BindingSpec.Private.V1 qualified as BindingSpec
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Analysis.IncludeGraph (IncludeGraph)
+import HsBindgen.Frontend.Analysis.IncludeGraph qualified as IncludeGraph
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass qualified as ResolveBindingSpecs
+import HsBindgen.Frontend.ProcessIncludes
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Public API
+-------------------------------------------------------------------------------}
+
+-- | Generate binding specification
+genBindingSpec ::
+     Format
+  -> Hs.ModuleName
+  -> IncludeGraph
+  -> DeclIndex l
+  -> GetMainHeaders
+  -> [(C.DeclId, RealPath)]
+  -> [(C.DeclId, (RealPath, Hs.Name Hs.NsTypeConstr))]
+  -> [Hs.Decl l]
+  -> ByteString
+genBindingSpec
+  format
+  hsModuleName
+  includeGraph
+  declIndex
+  getMainHeaders
+  omitTypes
+  squashedTypes =
+      BindingSpec.encode compareCDeclId format
+    . genBindingSpec' hsModuleName getMainHeaders omitTypes squashedTypes
+  where
+    compareCDeclId :: C.DeclId -> C.DeclId -> Ordering
+    compareCDeclId cDeclIdL cDeclIdR = Ord.comparing aux cDeclIdL cDeclIdR
+
+    aux :: C.DeclId -> (IncludeGraph.IncludeOrderIx, Int, Int, Text)
+    aux cDeclId =
+      case DeclIndex.lookupLoc cDeclId declIndex of
+        Just locs ->
+          -- NOTE: At the moment, we attempt to get the “minimum” location and
+          -- discard other conflicting locations (e.g., the ones of other
+          -- colliding definitions). This is OK, since we only use the location
+          -- to sort the binding specifications before generating them.
+          let loc = C.declLocsMin locs
+              orderIx = IncludeGraph.lookupIncludeOrder order (singleLocPath loc)
+          in  ( orderIx
+              , loc.singleLocLine
+              , loc.singleLocColumn
+              , C.renderDeclId cDeclId
+              )
+        Nothing -> (
+            IncludeGraph.NotInIncludeGraph
+          , maxBound
+          , maxBound
+          , C.renderDeclId cDeclId
+          )
+
+    order :: IncludeGraph.IncludeOrder
+    order = IncludeGraph.toIncludeOrder includeGraph
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1436>
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1549>
+-- Once squashing is configurable (#1436), we should deal with aliases (#1549).
+genBindingSpec' ::
+     Hs.ModuleName
+  -> GetMainHeaders
+  -> [(C.DeclId, RealPath)]
+  -> [(C.DeclId, (RealPath, Hs.Name Hs.NsTypeConstr))]
+  -> [Hs.Decl l]
+  -> UnresolvedBindingSpec
+genBindingSpec' hsModuleName getMainHeaders omitTypes squashedTypes =
+    foldr aux spec0
+  where
+    spec0 :: UnresolvedBindingSpec
+    spec0 = BindingSpec.BindingSpec {
+        moduleName = hsModuleName
+      , cTypes     = Map.fromListWith (++) $
+          [ (cDeclId, [(getMainHeaders' path, Omit)])
+          | (cDeclId, path) <- omitTypes
+          ] ++
+          [ let headers   = getMainHeaders' sourcePath
+                cTypeSpec :: CTypeSpec
+                cTypeSpec = CTypeSpec{
+                    hsName = Just hsName
+                  , enum   = Nothing
+                  }
+            in  (cDeclId, [(headers, Require cTypeSpec)])
+          | (cDeclId, (sourcePath, hsName)) <- squashedTypes
+          ]
+      , hsTypes = Map.empty
+      }
+
+    getMainHeaders' :: RealPath -> Set C.HashIncludeArg
+    getMainHeaders' =
+        either
+          (\s -> panicPure ("Could not get main headers: " ++ s))
+          (Set.fromList . NonEmpty.toList)
+      . getMainHeaders
+
+    aux ::
+         Hs.Decl l
+      -> UnresolvedBindingSpec
+      -> UnresolvedBindingSpec
+    aux = \case
+      Hs.DeclTypSyn typSyn          -> insertType $ auxTypSyn    typSyn
+      Hs.DeclData struct            -> insertType $ auxStruct    struct
+      Hs.DeclEmpty edata            -> insertType $ auxEmptyData edata
+      Hs.DeclNewtype ntype          ->
+        case ntype.origin.kind of
+          HsOrigin.Aux{} -> id
+          _otherwise     -> insertType $ auxNewtype ntype
+      Hs.DeclPatSyn{}               -> id
+      Hs.DeclCompletePragma{}       -> id
+      Hs.DeclDefineInstance{}       -> id
+      Hs.DeclDeriveInstance{}       -> id
+      Hs.DeclForeignImport{}        -> id
+      Hs.DeclForeignImportWrapper{} -> id
+      Hs.DeclForeignImportDynamic{} -> id
+      Hs.DeclFunction{}             -> id
+      Hs.DeclMacroValue{}           -> id
+      Hs.DeclVar{}                  -> id
+
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/2284>
+    --
+    -- Bindings specifications for macros defined on the command line or the
+    -- root header.
+    insertType ::
+         ( (C.DeclInfo Final, BindingSpec.CTypeSpec)
+         , (Hs.Name Hs.NsTypeConstr, BindingSpec.HsTypeSpec)
+         )
+      -> UnresolvedBindingSpec
+      -> UnresolvedBindingSpec
+    insertType ((declInfo, cTypeSpec), (hsName, hsTypeSpec)) spec =
+      case singleLocPath declInfo.loc of
+        C.InHeader path ->
+          spec
+            & #cTypes %~
+                Map.insertWith (++)
+                  declInfo.id.cName
+                  [(getMainHeaders' path, Require cTypeSpec)]
+            & #hsTypes %~
+                Map.insert hsName hsTypeSpec
+        -- Not in any header, so no binding specification can refer to it
+        C.InRootHeader  -> spec
+        C.OnCommandLine -> spec
+
+    auxTypSyn ::
+         Hs.TypSyn
+      -> ( (C.DeclInfo Final, BindingSpec.CTypeSpec)
+         , (Hs.Name Hs.NsTypeConstr, BindingSpec.HsTypeSpec)
+         )
+    auxTypSyn typSyn =
+      let cTypeSpec = BindingSpec.CTypeSpec {
+              hsName = Just typSyn.name
+            , enum   = Nothing
+            }
+          hsTypeSpec = BindingSpec.HsTypeSpec {
+              hsRep     = Just BindingSpec.HsTypeRepTypeAlias
+            , instances = Map.empty
+            }
+      in  ( (typSyn.origin.info, cTypeSpec)
+          , (typSyn.name, hsTypeSpec)
+          )
+
+    auxStruct ::
+         Hs.Struct
+      -> ( (C.DeclInfo Final, BindingSpec.CTypeSpec)
+         , (Hs.Name Hs.NsTypeConstr, BindingSpec.HsTypeSpec)
+         )
+    auxStruct hsStruct = case hsStruct.origin of
+      Nothing -> panicPure "Origin of structure unavailable"
+      Just originDecl ->
+        let cTypeSpec = BindingSpec.CTypeSpec {
+                hsName = Just hsStruct.name
+              , enum   = Nothing
+              }
+            hsRecordRep = BindingSpec.HsRecordRep {
+                constructor = Just hsStruct.constr
+              , fields      = Just [
+                    field.name
+                  | field <- hsStruct.fields
+                  ]
+              }
+            hsTypeSpec = BindingSpec.HsTypeSpec {
+                hsRep     = Just $ BindingSpec.HsTypeRepRecord hsRecordRep
+              , instances =
+                  mkInstSpecs
+                    (maybe Map.empty (.instances) $ originDecl.spec.hsSpec)
+                    hsStruct.instances
+              }
+        in  ( (originDecl.info, cTypeSpec)
+            , (hsStruct.name, hsTypeSpec)
+            )
+
+    auxEmptyData ::
+         Hs.EmptyData
+      -> ( (C.DeclInfo Final, BindingSpec.CTypeSpec)
+         , (Hs.Name Hs.NsTypeConstr, BindingSpec.HsTypeSpec)
+         )
+    auxEmptyData edata =
+      let originDecl   = edata.origin
+          cTypeSpec = BindingSpec.CTypeSpec {
+              hsName = Just edata.name
+            , enum   = Nothing
+            }
+          hsTypeSpec = BindingSpec.HsTypeSpec {
+              hsRep     = Just BindingSpec.HsTypeRepEmptyData
+            , instances =
+                mkInstSpecs
+                  (maybe Map.empty (.instances) $ originDecl.spec.hsSpec)
+                  edata.instances
+            }
+      in  ( (originDecl.info, cTypeSpec)
+          , (edata.name, hsTypeSpec)
+          )
+
+    auxNewtype ::
+         Hs.Newtype
+      -> ( (C.DeclInfo Final, BindingSpec.CTypeSpec)
+         , (Hs.Name Hs.NsTypeConstr, BindingSpec.HsTypeSpec)
+         )
+    auxNewtype hsNewtype =
+      let originDecl   = hsNewtype.origin
+          cTypeSpec    = BindingSpec.CTypeSpec {
+              hsName = Just hsNewtype.name
+            , enum   =
+                case originDecl.spec.cSpec of
+                  Just spec -> spec.enum
+                  Nothing   ->
+                    case originDecl.kind of
+                      HsOrigin.Enum{} -> Just BindingSpec.CEnumOpen
+                      _otherwise      -> Nothing
+            }
+          hsNewtypeRep = BindingSpec.HsNewtypeRep {
+              constructor = Just hsNewtype.constr
+            , field       = Just hsNewtype.field.name
+            , ffiType     = hsNewtype.ffiType
+            }
+          hsTypeSpec = BindingSpec.HsTypeSpec {
+              hsRep     = Just $ BindingSpec.HsTypeRepNewtype hsNewtypeRep
+            , instances =
+                mkInstSpecs
+                  (maybe Map.empty (.instances) $ originDecl.spec.hsSpec)
+                  hsNewtype.instances
+            }
+      in  ( (originDecl.info, cTypeSpec)
+          , (hsNewtype.name, hsTypeSpec)
+          )
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1766>
+-- We should allow users to specify strategies for instance deriving.
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/648>
+-- It should be possible to generate instances with constraints.
+mkInstSpecs ::
+     Map Inst.TypeClass (Omittable BindingSpec.InstanceSpec)
+  -> Set Inst.TypeClass
+  -> Map Inst.TypeClass (Omittable BindingSpec.InstanceSpec)
+mkInstSpecs specMap insts = Map.fromList $
+    [ (cls, Require def)
+    | cls <- Set.toList insts
+    ]
+    ++
+    [ (cls, Omit)
+    | (cls, Omit) <- Map.toList specMap
+    ]
diff --git a/src-internal/HsBindgen/BindingSpec/Private/Common.hs b/src-internal/HsBindgen/BindingSpec/Private/Common.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/BindingSpec/Private/Common.hs
@@ -0,0 +1,470 @@
+-- | Binding specification code that is common across all versions
+--
+-- This /private/ module may only be used by "HsBindgen.BindingSpec" and
+-- sub-modules.
+--
+-- Intended for qualified import when re-exporting.
+--
+-- > import HsBindgen.BindingSpec.Private.Common qualified as Common
+--
+-- Intended for unqualified import otherwise.
+module HsBindgen.BindingSpec.Private.Common (
+    -- * Trace messages
+    BindingSpecReadMsg(..)
+  , BindingSpecResolveMsg(..)
+  , BindingSpecMergeMsg(..)
+  , BindingSpecMsg(..)
+    -- * Aeson representation
+  , ARepV
+  , ARep
+  , ARepIso(..)
+  , ARepKV(..)
+    -- * Omittable
+  , Omittable(..)
+  , AOmittable(..)
+  , AOmittable'
+    -- * File API
+  , Format(..)
+  , getFormat
+  , readVersion
+    -- * Aeson auxiliary functions
+  , omitWhenNull
+  , listToJSON
+  , listFromJSON
+  , typeOf
+  ) where
+
+import Control.Applicative (asum)
+import Data.Aeson ((.:), (.=))
+import Data.Aeson qualified as Aeson
+import Data.Aeson.KeyMap qualified as KM
+import Data.Aeson.Types qualified as Aeson
+import Data.Coerce
+import Data.List qualified as List
+import Data.Typeable (Typeable, typeRep)
+import Data.Yaml qualified as Yaml
+import Data.Yaml.Internal qualified
+import Text.SimplePrettyPrint ((><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.BindingSpec.Private.Version
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Resolve (ResolveHeaderMsg)
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+-- | Load binding specification file trace messages
+data BindingSpecReadMsg =
+    BindingSpecReadAesonError FilePath String
+  | BindingSpecReadYamlError FilePath String
+  | BindingSpecReadYamlWarning FilePath String
+  | BindingSpecReadParseVersion FilePath AVersion
+  | BindingSpecReadIncompatibleVersion FilePath AVersion
+  | BindingSpecReadModuleMismatch FilePath Hs.ModuleName Hs.ModuleName
+  | BindingSpecReadModuleNotSpecified FilePath
+  | BindingSpecReadInvalidCName FilePath Text
+  | BindingSpecReadCTypeConflict FilePath C.DeclId C.HashIncludeArg
+  | BindingSpecReadHsTypeNameNoRef FilePath (Hs.Name Hs.NsTypeConstr)
+  | BindingSpecReadHsTypeConflict FilePath (Hs.Name Hs.NsTypeConstr)
+  | BindingSpecReadHashIncludeArg FilePath C.HashIncludeArgMsg
+  | BindingSpecReadConvertVersion FilePath BindingSpecVersion BindingSpecVersion
+  deriving stock (Show)
+
+instance IsTrace Level BindingSpecReadMsg where
+  getDefaultLogLevel = \case
+    BindingSpecReadAesonError{}           -> Error
+    BindingSpecReadYamlError{}            -> Error
+    BindingSpecReadYamlWarning{}          -> Error
+    BindingSpecReadParseVersion{}         -> Debug
+    BindingSpecReadIncompatibleVersion{}  -> Error
+    BindingSpecReadModuleMismatch{}       -> Warning
+    BindingSpecReadModuleNotSpecified{}   -> Error
+    BindingSpecReadInvalidCName{}         -> Error
+    BindingSpecReadCTypeConflict{}        -> Error
+    BindingSpecReadHsTypeNameNoRef{}    -> Error
+    BindingSpecReadHsTypeConflict{}       -> Error
+    BindingSpecReadHashIncludeArg _ x     -> getDefaultLogLevel x
+    BindingSpecReadConvertVersion _ f t
+      | f <= t                            -> Info
+      | otherwise                         -> Notice
+  getSource = \case
+    BindingSpecReadHashIncludeArg _ x -> getSource x
+    _otherwise                        -> HsBindgen
+  getTraceId = const "binding-spec-read"
+
+instance PrettyForTrace BindingSpecReadMsg where
+  prettyForTrace = \case
+    BindingSpecReadAesonError path msg -> PP.hcat [
+        "error parsing JSON: "
+      , PP.string path
+      , ": "
+      , PP.string msg
+      ]
+    BindingSpecReadYamlError path msg ->
+      -- 'lines' is used because the error includes newlines
+      PP.hangs' ("error parsing YAML: " >< PP.string path) 2 $
+        map PP.string $ lines msg
+    BindingSpecReadYamlWarning path msg -> PP.hcat [
+        "error parsing YAML: "
+      , PP.string path
+      , ": "
+      , PP.string msg
+      ]
+    BindingSpecReadParseVersion path version ->
+      PP.hangs' ("parsing binding specification: " >< PP.string path) 2 [
+          "hs-bindgen version: " ><
+            prettyForTraceHsBindgenVersion version.bindgen
+        , "binding specification version: " ><
+            prettyForTrace version.bindingSpec
+        ]
+    BindingSpecReadIncompatibleVersion path version ->
+      PP.hangs' ("incompatible binding specification version: " >< PP.string path) 2 [
+          "hs-bindgen version: " ><
+            prettyForTraceHsBindgenVersion version.bindgen
+        , "binding specification version: " ><
+            prettyForTrace version.bindingSpec
+        ]
+    BindingSpecReadModuleMismatch path bsModule curModule ->
+      PP.hangs'
+        ("binding specification module mismatch: " >< PP.string path)
+        2
+        [ "binding specification module: " >< prettyForTrace bsModule
+        , "current module: " >< prettyForTrace curModule
+        ]
+    BindingSpecReadModuleNotSpecified path ->
+      "module not specified in external binding specification: " >< PP.string path
+    BindingSpecReadInvalidCName path t -> PP.hcat [
+        "invalid C name in "
+      , PP.string path
+      , ": "
+      , PP.text t
+      ]
+    BindingSpecReadCTypeConflict path cDeclId header -> PP.hcat [
+        "multiple entries in "
+      , PP.string path
+      , " for C type: "
+      , prettyForTrace cDeclId
+      , " ("
+      , PP.string header.path
+      , ")"
+      ]
+    BindingSpecReadHsTypeNameNoRef path hsIdentifier -> PP.hcat [
+        "Haskell identifier in "
+      , PP.string path
+      , " not referenced by C type: "
+      , PP.text hsIdentifier.text
+      ]
+    BindingSpecReadHsTypeConflict path hsIdentifier -> PP.hcat [
+        "multiple entries in "
+      , PP.string path
+      , " for Haskell type: "
+      , PP.text hsIdentifier.text
+      ]
+    BindingSpecReadHashIncludeArg path msg ->
+      prettyForTrace msg >< " in " >< PP.string path
+    BindingSpecReadConvertVersion path versionFrom versionTo -> PP.cat [
+        "converting binding specification: "
+      , PP.string path
+      , " (from version "
+      , prettyForTrace versionFrom
+      , ", to version "
+      , prettyForTrace versionTo
+      , ")"
+      ]
+
+--------------------------------------------------------------------------------
+
+-- | Resolve binding specification trace messages
+data BindingSpecResolveMsg =
+    BindingSpecResolveExternalHeader     ResolveHeaderMsg
+  | BindingSpecResolvePrescriptiveHeader ResolveHeaderMsg
+  | BindingSpecResolveTypeDropped        C.DeclId
+  deriving stock (Show)
+
+instance IsTrace Level BindingSpecResolveMsg where
+  getDefaultLogLevel = \case
+    BindingSpecResolveExternalHeader x
+      -- Any warnings/errors that happen while resolving /external/ headers are
+      -- 'Info' only: the only consequence is that those headers will then not
+      -- match against anything (and we might generate separate warnings/errors
+      -- for that anyway while resolving the binding specification).
+      | lvl > Info -> Info
+      | otherwise  -> lvl
+      where
+        lvl = getDefaultLogLevel x
+    BindingSpecResolvePrescriptiveHeader x ->
+      -- However, any errors that happen during /prescriptive/ binding specs
+      -- truly are errors.
+      getDefaultLogLevel x
+    BindingSpecResolveTypeDropped{} -> Info
+  getSource = \case
+    BindingSpecResolveExternalHeader     x -> getSource x
+    BindingSpecResolvePrescriptiveHeader x -> getSource x
+    BindingSpecResolveTypeDropped{}        -> HsBindgen
+  getTraceId = const "binding-spec-resolve"
+
+instance PrettyForTrace BindingSpecResolveMsg where
+  prettyForTrace = \case
+    BindingSpecResolveExternalHeader x ->
+      PP.hang
+        "During resolution of external binding specification:"
+        2
+        (prettyForTrace x)
+    BindingSpecResolvePrescriptiveHeader x ->
+      PP.hang
+        "During resolution of prescriptive binding specification:"
+        2
+        (prettyForTrace x)
+    BindingSpecResolveTypeDropped cDeclId ->
+      "Type dropped: " >< prettyForTrace cDeclId
+
+--------------------------------------------------------------------------------
+
+-- | Merge binding specification trace messages
+newtype BindingSpecMergeMsg =
+    BindingSpecMergeConflict C.DeclId
+  deriving stock (Show)
+
+instance IsTrace Level BindingSpecMergeMsg where
+  getDefaultLogLevel = const Error
+  getSource          = const HsBindgen
+  getTraceId         = const "binding-spec-merge"
+
+instance PrettyForTrace BindingSpecMergeMsg where
+  prettyForTrace = \case
+    BindingSpecMergeConflict cDeclId ->
+      "conflicting binding specifications for C type: "
+        >< prettyForTrace cDeclId
+
+--------------------------------------------------------------------------------
+
+-- | All binding specification trace messages
+data BindingSpecMsg =
+    BindingSpecReadMsg    BindingSpecReadMsg
+  | BindingSpecResolveMsg BindingSpecResolveMsg
+  | BindingSpecMergeMsg   BindingSpecMergeMsg
+  deriving stock    (Show, Generic)
+  deriving anyclass (IsTrace Level, PrettyForTrace)
+
+{-------------------------------------------------------------------------------
+  Aeson representation
+-------------------------------------------------------------------------------}
+
+-- | Kind of Aeson representation version
+--
+-- Each binding specification version module should define a version as follows,
+-- where the name matches the module name.
+--
+-- > type V1 :: ARepV
+-- > data V1 a
+--
+-- Version modules should always be imported qualified, except that the Aeson
+-- representation version should be imported unqualified.
+type ARepV = ARepVSimulatedOpenKind -> Star
+
+-- | Internal type used only to simulate an open kind.  Not exported.
+data ARepVSimulatedOpenKind
+
+-- | Aeson representation data family
+--
+-- All Aeson instances should be defined for Aeson representations of types, not
+-- the types themselves.  This data family organizes Aeson representations per
+-- Aeson representation version.
+--
+-- Type @ARep v a@ is the Aeson representation for version @v@ of type @a@.
+data family ARep (v :: ARepV) a :: Star
+
+-- | Aeson representation that is isomorphic to the type
+--
+-- @v@ is the Aeson representation version.  Type @ARep v a@ is the Aeson
+-- representation for type @a@ for that version.
+class ARepIso (v :: ARepV) a where
+  fromARep :: ARep v a -> a
+  toARep   :: a -> ARep v a
+
+  default fromARep :: Coercible (ARep v a) a => ARep v a -> a
+  fromARep = coerce
+
+  default toARep   :: Coercible a (ARep v a) => a -> ARep v a
+  toARep = coerce
+
+-- | Aeson representation that encodes a key in addition to the type
+--
+-- Type @ARepK v a@ is the key that is encoded within Aeson representation
+-- @ARep v a@ for version @v@ of type @a@.
+class ARepKV (v :: ARepV) a where
+  data ARepK v a
+
+  fromARepKV :: ARep v a -> (ARepK v a, a)
+
+  toARepKV :: ARepK v a -> a -> ARep v a
+
+{-------------------------------------------------------------------------------
+  Omittable
+-------------------------------------------------------------------------------}
+
+-- | Wrapper for types that may be omitted
+--
+-- This type is isomorphic with 'Maybe'.
+--
+-- In general, the following conventions are followed:
+--
+-- * If something is specified, it is required.  It is an error if @hs-bindgen@
+--   is unable to satisfy the requirement.
+-- * If something is omitted, then @hs-bindgen@ does /not/ generate the
+--   corresponding code.  Use of something that is omitted is an error.
+-- * If nothing is specified, @hs-bindgen@ generates code using defaults.  This
+--   case is /not/ represented by 'Omittable'.
+data Omittable a =
+    Require a
+  | Omit
+  deriving stock (Eq, Ord, Generic, Show)
+
+-- | Aeson representation of 'Omittable'
+--
+-- A value of type @r@ is required by specifying it as usual.
+--
+-- A value of type @o@ is omitted by wrapping it in an object as the value for
+-- single key @omit@.
+--
+-- The wrapped types differ because omitted values may not require as much
+-- information as required values.
+data AOmittable o r = AOmit o | ARequire r
+  deriving stock Show
+
+instance
+     (Aeson.FromJSON o, Aeson.FromJSON r)
+  => Aeson.FromJSON (AOmittable o r)
+  where
+    parseJSON = \case
+      Aeson.Object o | KM.size o == 1 && KM.member "omit" o ->
+        AOmit <$> o .: "omit"
+      v -> ARequire <$> Aeson.parseJSON v
+
+instance (Aeson.ToJSON o, Aeson.ToJSON r) => Aeson.ToJSON (AOmittable o r) where
+  toJSON = \case
+    ARequire x -> Aeson.toJSON x
+    AOmit    x -> Aeson.object ["omit" .= x]
+
+-- | Aeson representation of 'Omittable' with same omitted and required type
+type AOmittable' a = AOmittable a a
+
+{-------------------------------------------------------------------------------
+  File API
+-------------------------------------------------------------------------------}
+
+-- | Supported specification file formats
+data Format =
+    FormatJSON
+  | FormatYAML
+
+-- | Get format based on filename
+--
+-- YAML is used if the extension is unknown.
+getFormat :: FilePath -> Format
+getFormat path
+    | ".json" `List.isSuffixOf` path = FormatJSON
+    | otherwise                      = FormatYAML
+
+-- | Function that reads a file and gets the 'HsBindgen.BindingSpec.Private.Version.AVersion', which determines how to
+-- parse the corresponding 'Aeson.Value'
+type ReadVersionFunction =
+     Tracer BindingSpecReadMsg
+  -> FilePath
+  -> IO (Maybe (AVersion, Aeson.Value))
+
+-- | Read a binding specification file, returning the 'BindingSpecVersion' and
+-- 'Aeson.Value'
+--
+-- The format is determined by the filename extension.
+readVersion :: ReadVersionFunction
+readVersion tracer path = case getFormat path of
+    FormatYAML -> readVersionYaml tracer path
+    FormatJSON -> readVersionJson tracer path
+
+-- | Read a binding specification JSON file, returning the 'BindingSpecVersion'
+-- and 'Aeson.Value'
+readVersionJson :: ReadVersionFunction
+readVersionJson tracer path = Aeson.eitherDecodeFileStrict' path >>= \case
+    Right value -> getAVersionM tracer path value
+    Left err -> do
+      traceWith tracer $ withCallStack $ BindingSpecReadAesonError path err
+      return Nothing
+
+-- | Read a binding specification YAML file, returning the 'BindingSpecVersion'
+-- and 'Aeson.Value'
+readVersionYaml :: ReadVersionFunction
+readVersionYaml tracer path = Yaml.decodeFileWithWarnings path >>= \case
+    Right (warnings, value) -> do
+      forM_ warnings $ \case
+        Data.Yaml.Internal.DuplicateKey jsonPath -> do
+          let msg = "duplicate key: " ++ Aeson.formatPath jsonPath
+          traceWith tracer $ withCallStack $ BindingSpecReadYamlWarning path msg
+      getAVersionM tracer path value
+    Left err -> do
+      let msg = Yaml.prettyPrintParseException err
+      traceWith tracer $ withCallStack $ BindingSpecReadYamlError path msg
+      return Nothing
+
+getAVersionM ::
+     MonadIO m
+  => Tracer BindingSpecReadMsg
+  -> FilePath
+  -> Aeson.Value
+  -> m (Maybe (AVersion, Aeson.Value))
+getAVersionM tracer path value = case getAVersion value of
+    Right aVersion -> return $ Just (aVersion, value)
+    Left err -> do
+      traceWith tracer $ withCallStack $ BindingSpecReadAesonError path err
+      return Nothing
+
+{-------------------------------------------------------------------------------
+  Aeson auxiliary functions
+-------------------------------------------------------------------------------}
+
+-- | Omit empty lists in aeson output
+omitWhenNull :: [a] -> Maybe [a]
+omitWhenNull xs
+    | null xs   = Nothing
+    | otherwise = Just xs
+
+-- | Convert list to JSON, with special case for the singleton list
+--
+-- This results in format that is somewhat more friendly for human consumption.
+-- It can however not be used for lists-of-lists.
+--
+-- See also 'listFromJSON'.
+listToJSON :: Aeson.ToJSON a => [a] -> Aeson.Value
+listToJSON [x] = Aeson.toJSON x
+listToJSON xs  = Aeson.toJSON xs
+
+-- | Inverse to 'listToJSON'
+listFromJSON :: forall a.
+     (Aeson.FromJSON a, Typeable a)
+  => Aeson.Value
+  -> Aeson.Parser [a]
+listFromJSON value = asum [
+      Aeson.withArray (show (typeRep (Proxy @[a]))) parseList value
+    , parseSingleton
+    ]
+  where
+    parseList :: Aeson.Array -> Aeson.Parser [a]
+    parseList = mapM Aeson.parseJSON . toList
+
+    parseSingleton :: Aeson.Parser [a]
+    parseSingleton = List.singleton <$> Aeson.parseJSON value
+
+-- | 'Aeson.Value' constructor name, for use in error messages
+typeOf :: Aeson.Value -> String
+typeOf = \case
+    Aeson.Object{} -> "Object"
+    Aeson.Array{}  -> "Array"
+    Aeson.String{} -> "String"
+    Aeson.Number{} -> "Number"
+    Aeson.Bool{}   -> "Bool"
+    Aeson.Null     -> "Null"
diff --git a/src-internal/HsBindgen/BindingSpec/Private/Stdlib.hs b/src-internal/HsBindgen/BindingSpec/Private/Stdlib.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/BindingSpec/Private/Stdlib.hs
@@ -0,0 +1,330 @@
+-- | Standard library external binding specification
+--
+-- This /private/ module may only be used by "HsBindgen.BindingSpec".
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.BindingSpec.Private.Stdlib qualified as Stdlib
+--
+-- If you change this file, note that:
+--
+-- - The types for these bindings are defined in @HsBindgen.Runtime.Prelude@ in
+--   the @hs-bindgen-runtime@ library, in the same order.
+--
+-- - The types for these bindings are tested in
+--   @standard_library_external_binding_specs.h@ in the same order.
+module HsBindgen.BindingSpec.Private.Stdlib (
+    -- * Binding specification
+    bindingSpec
+  ) where
+
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+
+import HsBindgen.Backend.Runtime qualified as Runtime
+import HsBindgen.BindingSpec.Private.Common
+import HsBindgen.BindingSpec.Private.V1 qualified as BindingSpec
+import HsBindgen.Errors
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Binding specification
+-------------------------------------------------------------------------------}
+
+-- | All standard library bindings
+--
+-- These bindings include types defined in @base@ as well as
+-- @hs-bindgen-runtime@
+bindingSpec :: BindingSpec.UnresolvedBindingSpec
+bindingSpec = BindingSpec.BindingSpec{
+      moduleName = Runtime.moduleName Runtime.LibC
+    , cTypes     = bindingSpecCTypes
+    , hsTypes    = bindingSpecHsTypes
+    }
+  where
+    bindingSpecCTypes  :: CTypeMap
+    bindingSpecHsTypes :: HsTypeMap
+    (bindingSpecCTypes, bindingSpecHsTypes) = mkMaps $
+         boolTypes
+      ++ integralTypes
+      ++ floatingTypes
+      ++ stdTypes
+      ++ nonLocalJumpTypes
+      ++ wcharTypes
+      ++ timeTypes
+      ++ fileTypes
+      ++ signalTypes
+
+    boolTypes :: [(CTypeKV, HsTypeKV)]
+    boolTypes = [
+        mkTypeN "macro bool" "CBool" intI (Just $ mkFFITypeLibC "CBool") ["stdbool.h"]
+      ]
+
+    -- Note that the \"least\" and \"fast\" types (such as @int_least32_t@)
+    -- /cannot/ be defined in the standard library because their implementations
+    -- differ across different @libc@ implementations, and users may choose
+    -- which @libc@ to use when running @hs-bindgen@.
+    integralTypes :: [(CTypeKV, HsTypeKV)]
+    integralTypes =
+      let aux (t, hsIdentifier, ffiType) =
+            mkTypeN t hsIdentifier intI (Just ffiType) ["inttypes.h", "stdint.h"]
+      in  map aux [
+              ("int8_t",    "Int8"    , mkFFITypeLibC "Int8")
+            , ("int16_t",   "Int16"   , mkFFITypeLibC "Int16")
+            , ("int32_t",   "Int32"   , mkFFITypeLibC "Int32")
+            , ("int64_t",   "Int64"   , mkFFITypeLibC "Int64")
+            , ("uint8_t",   "Word8"   , mkFFITypeLibC "Word8")
+            , ("uint16_t",  "Word16"  , mkFFITypeLibC "Word16")
+            , ("uint32_t",  "Word32"  , mkFFITypeLibC "Word32")
+            , ("uint64_t",  "Word64"  , mkFFITypeLibC "Word64")
+            , ("intmax_t",  "CIntMax" , mkFFITypeLibC "CIntMax")
+            , ("uintmax_t", "CUIntMax", mkFFITypeLibC "CUIntMax")
+            , ("intptr_t",  "CIntPtr" , mkFFITypeLibC "CIntPtr")
+            , ("uintptr_t", "CUIntPtr", mkFFITypeLibC "CUIntPtr")
+            ]
+
+    floatingTypes :: [(CTypeKV, HsTypeKV)]
+    floatingTypes =
+      let aux (t, hsIdentifier) = mkType t hsIdentifier hsED [] ["fenv.h"]
+      in  map aux [
+              ("fenv_t",    "CFenvT")
+            , ("fexcept_t", "CFexceptT")
+            ]
+
+    stdTypes :: [(CTypeKV, HsTypeKV)]
+    stdTypes = [
+        mkTypeN "size_t" "CSize" intI (Just $ mkFFITypeLibC "CSize") [
+            "signal.h"
+          , "stddef.h"
+          , "stdio.h"
+          , "stdlib.h"
+          , "string.h"
+          , "time.h"
+          , "uchar.h"
+          , "wchar.h"
+          ]
+      , mkTypeN "ptrdiff_t" "CPtrdiff" intI (Just $ mkFFITypeLibC "CPtrdiff") ["stddef.h"]
+      ]
+
+    nonLocalJumpTypes :: [(CTypeKV, HsTypeKV)]
+    nonLocalJumpTypes = [
+        mkType "jmp_buf" "CJmpBuf" hsED [] ["setjmp.h"]
+      ]
+
+    wcharTypes :: [(CTypeKV, HsTypeKV)]
+    wcharTypes = [
+        mkTypeN "wchar_t" "CWchar" intI (Just $ mkFFITypeLibC "CWchar") [
+            "inttypes.h"
+          , "stddef.h"
+          , "stdlib.h"
+          , "wchar.h"
+          ]
+      , mkTypeN "wint_t"    "CWintT"         intI (Just $ mkFFITypeLibC "CWintT")    ["wchar.h", "wctype.h"]
+      , mkType  "mbstate_t" "CMbstateT" hsED []                                         ["uchar.h", "wchar.h"]
+      , mkTypeN "wctrans_t" "CWctransT"      nEqI (Just $ mkFFITypeLibC "CWctransT") ["wctype.h"]
+      , mkTypeN "wctype_t"  "CWctypeT"       nEqI (Just $ mkFFITypeLibC "CWctypeT" ) ["wchar.h", "wctype.h"]
+      , mkTypeN "char16_t"  "CChar16T"       intI (Just $ mkFFITypeLibC "CChar16T" ) ["uchar.h"]
+      , mkTypeN "char32_t"  "CChar32T"       intI (Just $ mkFFITypeLibC "CChar32T" ) ["uchar.h"]
+      ]
+
+    timeTypes :: [(CTypeKV, HsTypeKV)]
+    timeTypes = [
+        mkTypeN "time_t"  "CTime"  timeI (Just $ mkFFITypeLibC "CTime")  ["signal.h", "time.h"]
+      , mkTypeN "clock_t" "CClock" timeI (Just $ mkFFITypeLibC "CClock") ["signal.h", "time.h"]
+      , let hsR = mkHsR "CTm" [
+                "tm_sec"
+              , "tm_min"
+              , "tm_hour"
+              , "tm_mday"
+              , "tm_mon"
+              , "tm_year"
+              , "tm_wday"
+              , "tm_yday"
+              , "tm_isdst"
+              ]
+        in  mkType "struct tm" "CTm" hsR tmI ["time.h"]
+      ]
+
+    fileTypes :: [(CTypeKV, HsTypeKV)]
+    fileTypes = [
+        mkType "FILE"   "CFile" hsED [] ["stdio.h", "wchar.h"]
+      , mkType "fpos_t" "CFpos" hsED [] ["stdio.h"]
+      ]
+
+    signalTypes :: [(CTypeKV, HsTypeKV)]
+    signalTypes = [
+        mkTypeN "sig_atomic_t" "CSigAtomic" intI (Just $ mkFFITypeLibC "CSigAtomic") ["signal.h"]
+      ]
+
+    intI, nEqI, timeI, tmI :: [Inst.TypeClass]
+    intI = [
+        Inst.Bitfield
+      , Inst.Bits
+      , Inst.Bounded
+      , Inst.Enum
+      , Inst.Eq
+      , Inst.FiniteBits
+      , Inst.HasFFIType
+      , Inst.Integral
+      , Inst.Ix
+      , Inst.Num
+      , Inst.Ord
+      , Inst.Prim
+      , Inst.Read
+      , Inst.ReadRaw
+      , Inst.Real
+      , Inst.Show
+      , Inst.StaticSize
+      , Inst.Storable
+      , Inst.WriteRaw
+      ]
+    nEqI = [ -- newtype equality
+        Inst.Eq
+      , Inst.HasFFIType
+      , Inst.Prim
+      , Inst.ReadRaw
+      , Inst.Show
+      , Inst.StaticSize
+      , Inst.Storable
+      , Inst.WriteRaw
+      ]
+    timeI = [
+        Inst.Enum
+      , Inst.Eq
+      , Inst.HasFFIType
+      , Inst.Num
+      , Inst.Ord
+      , Inst.Read
+      , Inst.ReadRaw
+      , Inst.Real
+      , Inst.Show
+      , Inst.StaticSize
+      , Inst.Storable
+      , Inst.WriteRaw
+      ]
+    tmI = [ -- struct tm
+        Inst.Eq
+      , Inst.HasCField
+      , Inst.HasField
+      , Inst.ReadRaw
+      , Inst.Show
+      , Inst.StaticSize
+      ]
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+-- | Concise alias for the C type 'Map'
+type CTypeMap =
+  Map C.DeclId [(Set C.HashIncludeArg, Omittable BindingSpec.CTypeSpec)]
+
+-- | Concise alias for the key and value tuple corresponding to an entry in a
+-- 'CTypeMap'
+type CTypeKV =
+  (C.DeclId, [(Set C.HashIncludeArg, Omittable BindingSpec.CTypeSpec)])
+
+-- | Concise alias for the Haskell type 'Map'
+type HsTypeMap = Map (Hs.Name Hs.NsTypeConstr) BindingSpec.HsTypeSpec
+
+-- | Concise alias for the key and value tuple corresponding to an entry in a
+-- 'HsTypeMap'
+type HsTypeKV = (Hs.Name Hs.NsTypeConstr, BindingSpec.HsTypeSpec)
+
+mkMaps :: [(CTypeKV, HsTypeKV)] -> (CTypeMap, HsTypeMap)
+mkMaps = bimap Map.fromList Map.fromList . unzip
+
+-- | Construct the 'CTypeKV' and 'HsTypeKV' for a type
+mkType ::
+     Text
+  -> Text
+  -> BindingSpec.HsTypeRep
+  -> [Inst.TypeClass]
+  -> [FilePath]
+  -> (CTypeKV, HsTypeKV)
+mkType t hsId hsTypeRep insts headers' =
+    case C.parseDeclId t of
+      Just cDeclId ->
+        ( (cDeclId, [(headers, Require cTypeSpec)])
+        , (typeConstrName, hsTypeSpec)
+        )
+      Nothing -> panicPure $ "Invalid declaration ID: " ++ show t
+  where
+    -- Names in the stdlib binding spec are statically known-valid Haskell
+    -- identifiers, so 'Hs.UnsafeName' is safe here.
+    typeConstrName :: Hs.Name Hs.NsTypeConstr
+    typeConstrName = Hs.UnsafeName hsId
+
+    headers :: Set C.HashIncludeArg
+    headers = Set.fromList $ map C.HashIncludeArg headers'
+
+    cTypeSpec :: BindingSpec.CTypeSpec
+    cTypeSpec = BindingSpec.CTypeSpec {
+        hsName = Just typeConstrName
+      , enum   = Nothing -- No C @enum@ types in @stdlib@
+      }
+
+    hsTypeSpec :: BindingSpec.HsTypeSpec
+    hsTypeSpec = BindingSpec.HsTypeSpec {
+        hsRep     = Just hsTypeRep
+      , instances = Map.fromList [
+            (inst, Require def)
+          | inst <- insts
+          ]
+      }
+
+-- | Concise alias for 'BindingSpec.HsTypeRepEmptyData'
+hsED :: BindingSpec.HsTypeRep
+hsED = BindingSpec.HsTypeRepEmptyData
+
+-- | Construct a 'BindingSpec.HsTypeRepRecord' with the specified constructor
+-- and field names
+mkHsR :: Text -> [Text] -> BindingSpec.HsTypeRep
+mkHsR hsId fieldNames = BindingSpec.HsTypeRepRecord $
+    BindingSpec.HsRecordRep {
+        -- Names in the stdlib binding spec are statically known-valid Haskell
+        -- identifiers, so 'Hs.UnsafeName' is safe here.
+        constructor = Just $ Hs.UnsafeName hsId
+      , fields      = Just $ map Hs.UnsafeName fieldNames
+      }
+
+-- | Construct a 'BindingSpec.HsTypeRepNewtype' with the specified constructor
+-- name and no field names
+--
+-- The standard @newtype@ types do not have field names.
+mkHsN :: Hs.Name Hs.NsConstr -> Maybe BindingSpec.HsFFIType -> BindingSpec.HsTypeRep
+mkHsN constructorName ffiType = BindingSpec.HsTypeRepNewtype $
+    BindingSpec.HsNewtypeRep {
+        constructor = Just constructorName
+      , field       = Nothing
+      , ffiType     = ffiType
+      }
+
+-- | Variant of 'mkType' that creates a 'BindingSpec.HsTypeRepNewtype' where the
+-- constructor has the same name as the type
+mkTypeN ::
+     Text
+  -> Text
+  -> [Inst.TypeClass]
+  -> Maybe BindingSpec.HsFFIType
+  -> [FilePath]
+  -> (CTypeKV, HsTypeKV)
+mkTypeN t hsId insts ffiType headers =
+    mkType t hsId (mkHsN dataConstrName ffiType) insts headers
+  where
+    -- Names in the stdlib binding spec are statically known-valid Haskell
+    -- identifiers, so 'Hs.UnsafeName' is safe here.
+    dataConstrName :: Hs.Name Hs.NsConstr
+    dataConstrName = Hs.UnsafeName hsId
+
+mkFFIType :: Hs.ModuleName -> Text -> BindingSpec.HsFFIType
+mkFFIType moduleName typeName = BindingSpec.HsFFIType $ Hs.ExtRef {
+      moduleName = moduleName
+    , name       = Hs.UnsafeName typeName
+    }
+
+mkFFITypeLibC :: Text -> BindingSpec.HsFFIType
+mkFFITypeLibC = mkFFIType "HsBindgen.Runtime.LibC"
diff --git a/src-internal/HsBindgen/BindingSpec/Private/V1.hs b/src-internal/HsBindgen/BindingSpec/Private/V1.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/BindingSpec/Private/V1.hs
@@ -0,0 +1,1316 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+-- | Binding specification
+--
+-- This /private/ module may only be used by "HsBindgen.BindingSpec" and
+-- sub-modules.
+--
+-- Intended for qualified import.
+--
+-- When defining the current public interface:
+--
+-- > import HsBindgen.BindingSpec.Private.V1 qualified as BindingSpec
+--
+-- When distinguishing separate versions:
+--
+-- > import HsBindgen.BindingSpec.Private.V1 (V1)
+-- > import HsBindgen.BindingSpec.Private.V1 qualified as V1
+module HsBindgen.BindingSpec.Private.V1 (
+    -- * Version
+    currentBindingSpecVersion
+    -- * Types
+  , BindingSpec(..)
+  , UnresolvedBindingSpec
+  , ResolvedBindingSpec
+  , CTypeSpec(..)
+  , CEnumSpec(..)
+  , HsTypeSpec(..)
+  , HsTypeRep(..)
+  , HsRecordRep(..)
+  , HsNewtypeRep(..)
+  , HsFFIType(..)
+  , hsSpecFFIType
+    -- ** Instances
+  , InstanceSpec(..)
+    -- * API
+  , empty
+  , getCTypes
+  , lookupCTypeSpec
+  , lookupHsTypeSpec
+    -- ** YAML/JSON
+  , readFile
+  , encode
+    -- ** Header resolution
+  , resolve
+    -- ** Merging
+  , MergedBindingSpecs
+  , merge
+  , lookupMergedBindingSpecs
+    -- ** Aeson representation
+  , V1
+  ) where
+
+import Prelude hiding (readFile)
+
+import Data.Aeson ((.!=), (.:), (.:?), (.=))
+import Data.Aeson qualified as Aeson
+import Data.Aeson.KeyMap qualified as KM
+import Data.Aeson.Types qualified as Aeson
+import Data.ByteString (ByteString)
+import Data.ByteString.Lazy qualified as BSL
+import Data.Function (on)
+import Data.List qualified as List
+import Data.Map.Strict qualified as Map
+import Data.Ord qualified as Ord
+import Data.Set qualified as Set
+import Data.Text qualified as Text
+import Data.Yaml.Pretty qualified
+import Text.Read (readMaybe)
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.Args
+import Clang.Paths
+
+import HsBindgen.BindingSpec.Private.Common
+import HsBindgen.BindingSpec.Private.Version
+import HsBindgen.Config.MangleCandidate (MangleCandidate (..))
+import HsBindgen.Config.MangleCandidate qualified as MangleCandidate
+import HsBindgen.Errors
+import HsBindgen.Imports
+import HsBindgen.Instances qualified as Inst
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Orphans ()
+import HsBindgen.Resolve
+import HsBindgen.Util.Monad
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Version
+-------------------------------------------------------------------------------}
+
+-- | Binding specification version
+currentBindingSpecVersion :: BindingSpecVersion
+currentBindingSpecVersion = $$(constBindingSpecVersion 1 0)
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+-- | Binding specification
+--
+-- This type serves two purposes:
+--
+-- * A /prescriptive binding specification/ is used to configure how bindings
+--   are generated.
+-- * An /external binding specification/ is used to specify existing bindings
+--   that should be used, /external/ from the module being generated.
+--
+-- Note that a /generated binding specification/ may be used for either/both of
+-- these two purposes.
+--
+-- The @header@ type parameter determines the representation of header paths.
+-- See 'UnresolvedBindingSpec' and 'ResolvedBindingSpec'.
+data BindingSpec header = BindingSpec {
+      -- | Binding specification module
+      --
+      -- Each binding specification is specific to a Haskell module.
+      --
+      -- The module name is optional in prescriptive binding specifications.  If
+      -- one is specified, it must match the current module.  If not specified,
+      -- the current module is used.
+      --
+      -- The module name is required in external binding specifications.
+      moduleName :: Hs.ModuleName
+
+      -- | C type specifications
+      --
+      -- A C type is identified using a 'C.DeclId' and a set of headers that
+      -- provide the type.  For a given 'C.DeclId', the sets of headers are
+      -- disjoint.  The type of this map is therefore equivalent to
+      -- @'Map' 'C.DeclId' ('Map' header ('Omittable' t'CTypeSpec'))@, but this
+      -- type is used as an optimization.
+    , cTypes :: Map C.DeclId [(Set header, Omittable CTypeSpec)]
+
+      -- | Haskell type specifications
+    , hsTypes :: Map (Hs.Name Hs.NsTypeConstr) HsTypeSpec
+    }
+  deriving stock (Eq, Generic, Show)
+
+-- | Binding specification with unresolved headers
+--
+-- The headers are as specified in a C include directive, relative to a
+-- directory in the C include search path.
+type UnresolvedBindingSpec = BindingSpec C.HashIncludeArg
+
+-- | Binding specification with resolved headers
+--
+-- The resolved header is the canonical on-disk path in the current environment.
+type ResolvedBindingSpec = BindingSpec (C.HashIncludeArg, RealPath)
+
+--------------------------------------------------------------------------------
+
+-- | Binding specification for a C type
+data CTypeSpec = CTypeSpec {
+      hsName :: Maybe (Hs.Name Hs.NsTypeConstr)
+    , enum   :: Maybe CEnumSpec -- ^ Specified for C @enum@ types
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+--------------------------------------------------------------------------------
+
+-- | C @enum@ specification
+data CEnumSpec =
+    CEnumOpen   -- ^ C @enum@ may have values other than those declared
+  | CEnumClosed -- ^ C @enum@ may only have declared vlaues
+  deriving stock (Bounded, Enum, Eq, Generic, Ord, Show)
+
+instance Default CEnumSpec where
+  def = CEnumOpen
+
+--------------------------------------------------------------------------------
+
+-- | Binding specification for a Haskell type
+data HsTypeSpec = HsTypeSpec {
+      -- | Haskell type representation
+      hsRep :: Maybe HsTypeRep
+
+       -- | Instance specification
+    , instances :: Map Inst.TypeClass (Omittable InstanceSpec)
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+instance Default HsTypeSpec where
+  def = HsTypeSpec{
+      hsRep     = Nothing
+    , instances = Map.empty
+    }
+
+hsSpecFFIType :: HsTypeSpec -> Maybe HsFFIType
+hsSpecFFIType hsSpec = do
+    rep <- hsSpec.hsRep
+    case rep of
+      HsTypeRepNewtype ntRep -> ntRep.ffiType
+      _ -> Nothing
+
+--------------------------------------------------------------------------------
+
+-- | Haskell type representation
+data HsTypeRep =
+    -- | Record representation
+    --
+    -- A type and constructor is generated using @data@.
+    HsTypeRepRecord HsRecordRep
+
+  | -- | Newtype representation
+    --
+    -- A type and constructor is generated using @newtype@.
+    HsTypeRepNewtype HsNewtypeRep
+
+  | -- | Empty data representation
+    --
+    -- A type but no constructor is generated using @data@.
+    HsTypeRepEmptyData
+
+  | -- | Type alias representation
+    --
+    -- A type is generated using @type@.
+    HsTypeRepTypeAlias
+  deriving stock (Show, Eq, Ord, Generic)
+
+-- | Haskell record representation
+data HsRecordRep = HsRecordRep {
+      constructor :: Maybe (Hs.Name Hs.NsConstr)
+    , fields      :: Maybe [Hs.Name Hs.NsVar]
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+instance Default HsRecordRep where
+  def = HsRecordRep{
+        constructor = Nothing
+      , fields      = Nothing
+      }
+
+-- | Haskell newtype representation
+data HsNewtypeRep = HsNewtypeRep {
+      -- | Constructor name
+      constructor :: Maybe (Hs.Name Hs.NsConstr)
+
+      -- | Field name
+    , field :: Maybe (Hs.Name Hs.NsVar)
+
+      -- | FFI type
+    , ffiType :: Maybe HsFFIType
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+data HsFFIType = HsFFIType { unwrap :: Hs.ExtRef }
+  deriving stock (Show, Eq, Ord, Generic)
+
+instance Default HsNewtypeRep where
+  def = HsNewtypeRep{
+        constructor = Nothing
+      , field       = Nothing
+      , ffiType     = Nothing
+      }
+
+{-------------------------------------------------------------------------------
+  Types: Instances
+-------------------------------------------------------------------------------}
+
+-- | Instance specification
+data InstanceSpec = InstanceSpec {
+      -- | Strategy used to generate/derive the instance
+      --
+      -- A 'Nothing' value indicates that @hs-bindgen@ defaults should be used.
+      strategy :: Maybe Inst.Strategy
+
+      -- | Instance constraints
+      --
+      -- If specified, /all/ constraints must be listed.
+    , constraints :: [Inst.Constraint]
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+instance Default InstanceSpec where
+  def = InstanceSpec{
+      strategy    = Nothing
+    , constraints = []
+    }
+
+{-------------------------------------------------------------------------------
+  API
+-------------------------------------------------------------------------------}
+
+-- | Construct an empty binding specification for the given module
+empty :: Hs.ModuleName -> BindingSpec header
+empty hsModuleName = BindingSpec{
+      moduleName = hsModuleName
+    , cTypes     = Map.empty
+    , hsTypes    = Map.empty
+    }
+
+-- | Get the C types in a binding specification
+getCTypes :: ResolvedBindingSpec -> Map C.DeclId [Set RealPath]
+getCTypes spec = map (Set.map snd . fst) <$> spec.cTypes
+
+-- | Lookup a C type in a 'ResolvedBindingSpec'
+lookupCTypeSpec ::
+     C.DeclId
+  -> Set RealPath
+  -> ResolvedBindingSpec
+  -> Maybe (Hs.ModuleName, Omittable CTypeSpec)
+lookupCTypeSpec cDeclId headers spec = do
+    ps <- Map.lookup cDeclId spec.cTypes
+    oCTypeSpec <- lookupBy (not . Set.disjoint headers . Set.map snd) ps
+    return (spec.moduleName, oCTypeSpec)
+
+-- | Lookup a Haskell type in a 'ResolvedBindingSpec'
+lookupHsTypeSpec ::
+     Hs.Name Hs.NsTypeConstr
+  -> ResolvedBindingSpec
+  -> Maybe HsTypeSpec
+lookupHsTypeSpec hsName spec = Map.lookup hsName spec.hsTypes
+
+{-------------------------------------------------------------------------------
+  API: YAML/JSON
+-------------------------------------------------------------------------------}
+
+-- | Read a binding specification file
+--
+-- The format is determined by the filename extension.
+readFile ::
+     Tracer BindingSpecReadMsg
+  -> BindingSpecCompatibility
+  -> Maybe Hs.ModuleName
+  -> FilePath
+  -> IO (Maybe UnresolvedBindingSpec)
+readFile tracer cmpt mHsModuleName path = readVersion tracer path >>= \case
+    Nothing -> return Nothing
+    Just (aVersion, value)
+      | isCompatBindingSpecVersions
+          cmpt
+          aVersion.bindingSpec
+          currentBindingSpecVersion -> do
+            traceWith tracer $ withCallStack $ BindingSpecReadParseVersion path aVersion
+            case Aeson.fromJSON value of
+              Aeson.Success arep ->
+                case fromABindingSpec mHsModuleName path arep of
+                  Right (errs, spec) -> do
+                    mapM_ (traceWith tracer . withCallStack) errs
+                    return (Just spec)
+                  Left err -> do
+                    traceWith tracer (withCallStack err)
+                    return Nothing
+              Aeson.Error err -> do
+                traceWith tracer $ withCallStack $ BindingSpecReadAesonError path err
+                return Nothing
+      | otherwise -> do
+          traceWith tracer $ withCallStack $ BindingSpecReadIncompatibleVersion path aVersion
+          return Nothing
+
+-- | Encode a binding specification
+encode ::
+     (C.DeclId -> C.DeclId -> Ordering)
+  -> Format
+  -> UnresolvedBindingSpec
+  -> ByteString
+encode compareCDeclId = \case
+    FormatJSON -> encodeJson' . toABindingSpec compareCDeclId
+    FormatYAML -> encodeYaml' . toABindingSpec compareCDeclId
+
+encodeJson' :: ARep V1 UnresolvedBindingSpec -> ByteString
+encodeJson' = BSL.toStrict . Aeson.encode
+
+encodeYaml' :: ARep V1 UnresolvedBindingSpec -> ByteString
+encodeYaml' = Data.Yaml.Pretty.encodePretty yamlConfig
+  where
+    yamlConfig :: Data.Yaml.Pretty.Config
+    yamlConfig =
+          Data.Yaml.Pretty.setConfCompare (compare `on` keyPosition)
+        $ Data.Yaml.Pretty.defConfig
+
+    keyPosition :: Text -> Int
+    keyPosition = \case
+      -- ABindingSpec:1
+      "version"               ->  0
+      -- AVersion:1
+      "hs_bindgen"            ->  1
+      -- AVersion:2
+      "binding_specification" ->  2
+      -- AOmittable:1
+      "omit"                  ->  3
+      -- AInstanceSpec:1, AConstraintSpec:1
+      "class"                 ->  4
+      -- AInstanceSpec:2
+      "strategy"              ->  5
+      -- AInstanceSpec:3
+      "constraints"           ->  6
+      -- ABindingSpec:2, AConstraintSpec:2, HsFFIType:1
+      "hsmodule"              ->  7
+      -- ABindingSpec:3
+      "ctypes"                ->  8
+      -- ABindingSpec:4
+      "hstypes"               ->  9
+      -- ACTypeSpec:1
+      "headers"               -> 10
+      -- ACTypeSpec:2
+      "cname"                 -> 11
+      -- ACTypeSpec:3, AHsTypeSpec:1, AConstraintSpec:3, HsFFIType:2
+      "hsname"                -> 12
+      -- ACTypeSpec:4
+      "enum"                  -> 13
+      -- AHsTypeSpec:2
+      "representation"        -> 14
+      -- AHsTypeSpec:3
+      "instances"             -> 15
+      -- AHsTypeRep:1
+      "record"                -> 16
+      -- AHsTypeRep:2
+      "newtype"               -> 17
+      -- HsRecordRep:1, HsNewtypeRep:1
+      "constructor"           -> 18
+      -- HsRecordRep:2, HsNewtypeRep:2
+      "fields"                -> 19
+      -- HsNewtypeRep:3
+      "ffitype"               -> 20
+      key -> panicPure $ "Unknown key: " ++ show key
+
+{-------------------------------------------------------------------------------
+  API: Header resolution
+-------------------------------------------------------------------------------}
+
+-- | Resolve headers in a binding specification
+resolve ::
+     Tracer BindingSpecResolveMsg
+  -> (ResolveHeaderMsg -> BindingSpecResolveMsg)
+  -> ClangArgs
+  -> UnresolvedBindingSpec
+  -> IO ResolvedBindingSpec
+resolve tracer injResolveHeader args uSpec = do
+    headerMap <-
+      resolveHeaders (contramap injResolveHeader tracer) args allHeaders
+
+    let lookup' :: C.HashIncludeArg -> Maybe (C.HashIncludeArg, RealPath)
+        lookup' uHeader = (uHeader,) <$> Map.lookup uHeader headerMap
+
+        resolveSet ::
+             Set C.HashIncludeArg
+          -> Maybe (Set (C.HashIncludeArg, RealPath))
+        resolveSet uHeaders =
+          case mapMaybe lookup' (Set.toList uHeaders) of
+            []       -> Nothing
+            rHeaders -> Just (Set.fromList rHeaders)
+
+        resolveType ::
+             C.DeclId
+          -> (Set C.HashIncludeArg, a)
+          -> IO (Maybe (Set (C.HashIncludeArg, RealPath), a))
+        resolveType cDeclId (uHeaders, x) = case resolveSet uHeaders of
+          Just rHeaders -> return $ Just (rHeaders, x)
+          Nothing       -> do
+            traceWith tracer $ withCallStack $ BindingSpecResolveTypeDropped cDeclId
+            return Nothing
+
+        resolveTypes ::
+             C.DeclId
+          -> [(Set C.HashIncludeArg, a)]
+          -> IO
+               ( Maybe
+                   (C.DeclId, [(Set (C.HashIncludeArg, RealPath), a)])
+               )
+        resolveTypes cDeclId uKVs =
+          mapMaybeM (resolveType cDeclId) uKVs >>= \case
+            rKVs
+              | null rKVs -> return Nothing
+              | otherwise -> return $ Just (cDeclId, rKVs)
+
+    cTypes <- Map.fromList <$>
+      mapMaybeM (uncurry resolveTypes) (Map.toList uSpec.cTypes)
+    return BindingSpec{
+        moduleName = uSpec.moduleName
+      , cTypes     = cTypes
+      , hsTypes    = uSpec.hsTypes
+      }
+  where
+    allHeaders :: Set C.HashIncludeArg
+    allHeaders = mconcat $ fst <$> concat (Map.elems uSpec.cTypes)
+
+{-------------------------------------------------------------------------------
+  API: Merging
+-------------------------------------------------------------------------------}
+
+-- | Merged (external) binding specifications
+--
+-- While a tt'HsBindgen.BindingSpec.Private.V1.BindingSpec' is specific to a Haskell module, this type supports
+-- binding specifications across multiple Haskell modules.  It is a performance
+-- optimization for resolving external binding specifications.
+newtype MergedBindingSpecs = MergedBindingSpecs {
+      map :: Map C.DeclId [(Set RealPath, ResolvedBindingSpec)]
+    }
+  deriving stock (Show)
+
+-- | Merge (external) binding specifications
+merge ::
+     [ResolvedBindingSpec]
+  -> ([BindingSpecMergeMsg], MergedBindingSpecs)
+merge =
+      bimap mkTypeErrs (MergedBindingSpecs . snd)
+    . foldl' mergeSpec (Set.empty, (Map.empty, Map.empty))
+  where
+    mkTypeErrs :: Set C.DeclId -> [BindingSpecMergeMsg]
+    mkTypeErrs = fmap BindingSpecMergeConflict . Set.toList
+
+    mergeSpec ::
+         ( Set C.DeclId
+         , ( Map C.DeclId (Set C.HashIncludeArg)
+           , Map C.DeclId [(Set RealPath, ResolvedBindingSpec)]
+           )
+         )
+      -> ResolvedBindingSpec
+      -> ( Set C.DeclId
+         , ( Map C.DeclId (Set C.HashIncludeArg)
+           , Map C.DeclId [(Set RealPath, ResolvedBindingSpec)]
+           )
+         )
+    mergeSpec ctx spec =
+        foldl' (mergeType spec) ctx
+      . map (fmap (map fst))
+      $ Map.toList spec.cTypes
+
+    mergeType ::
+         ResolvedBindingSpec
+      -> ( Set C.DeclId
+         , ( Map C.DeclId (Set C.HashIncludeArg)
+           , Map C.DeclId [(Set RealPath, ResolvedBindingSpec)]
+           )
+         )
+      -> (C.DeclId, [Set (C.HashIncludeArg, RealPath)])
+      -> ( Set C.DeclId
+         , ( Map C.DeclId (Set C.HashIncludeArg)
+           , Map C.DeclId [(Set RealPath, ResolvedBindingSpec)]
+           )
+         )
+    mergeType spec (dupSet, (seenMap, acc)) (cDeclId, sourceSets) =
+      let seenS = Set.unions $ map (Set.map fst) sourceSets
+          keyS  = Set.unions $ map (Set.map snd) sourceSets
+          acc'  = Map.insertWith (++) cDeclId [(keyS, spec)] acc
+      in  case Map.insertLookupWithKey (const (<>)) cDeclId seenS seenMap of
+            (Nothing, seenMap') -> (dupSet, (seenMap', acc'))
+            (Just eS, seenMap')
+              | Set.disjoint eS seenS -> (dupSet, (seenMap', acc'))
+              | otherwise -> (Set.insert cDeclId dupSet, (seenMap', acc'))
+
+-- | Lookup type specs in t'MergedBindingSpecs'
+lookupMergedBindingSpecs ::
+     C.DeclId
+  -> Set RealPath
+  -> MergedBindingSpecs
+  -> Maybe (Hs.ModuleName, Omittable CTypeSpec, Maybe HsTypeSpec)
+lookupMergedBindingSpecs cDeclId headers specs = do
+    spec <- lookupBy (not . Set.disjoint headers)
+      =<< Map.lookup cDeclId specs.map
+    (hsModuleName, oCTypeSpec) <- lookupCTypeSpec cDeclId headers spec
+    let mHsTypeSpec = case oCTypeSpec of
+          Require cTypeSpec -> do
+            hsName <- cTypeSpec.hsName
+            lookupHsTypeSpec hsName spec
+          Omit -> Nothing
+    return (hsModuleName, oCTypeSpec, mHsTypeSpec)
+
+{-------------------------------------------------------------------------------
+  Aeson representation
+-------------------------------------------------------------------------------}
+
+-- | Aeson representation version
+type V1 :: ARepV
+data V1 a
+
+-- | Convert from the Aeson representation /for this version/
+fromARep' :: ARepIso V1 a => ARep V1 a -> a
+fromARep' = fromARep
+
+-- | Convert to the Aeson representation /for this version/
+toARep' :: ARepIso V1 a => a -> ARep V1 a
+toARep' = toARep
+
+--------------------------------------------------------------------------------
+
+data instance ARep V1 UnresolvedBindingSpec = ABindingSpec {
+      version  :: AVersion
+    , hsModule :: Maybe Hs.ModuleName
+    , cTypes   :: [AOCTypeSpec]
+    , hsTypes  :: [ARep V1 HsTypeSpec]
+    }
+  deriving stock (Show)
+
+instance Aeson.FromJSON (ARep V1 UnresolvedBindingSpec) where
+  parseJSON = Aeson.withObject "BindingSpec" $ \o -> do
+    aBindingSpecVersion  <- o .:  "version"
+    aBindingSpecHsModule <- o .:? "hsmodule"
+    aBindingSpecCTypes   <- o .:? "ctypes"  .!= []
+    aBindingSpecHsTypes  <- o .:? "hstypes" .!= []
+    return ABindingSpec{
+        version  = aBindingSpecVersion
+      , hsModule = fromARep' <$> aBindingSpecHsModule
+      , cTypes   = aBindingSpecCTypes
+      , hsTypes  = aBindingSpecHsTypes
+      }
+
+instance Aeson.ToJSON (ARep V1 UnresolvedBindingSpec) where
+  toJSON spec = Aeson.Object . KM.fromList $ catMaybes [
+      Just ("version" .= spec.version)
+    , ("hsmodule" .=) . toARep' <$> spec.hsModule
+    , ("ctypes"   .=) <$> omitWhenNull spec.cTypes
+    , ("hstypes"  .=) <$> omitWhenNull spec.hsTypes
+    ]
+
+fromABindingSpec ::
+     Maybe Hs.ModuleName
+  -> FilePath
+  -> ARep V1 UnresolvedBindingSpec
+  -> Either BindingSpecReadMsg ([BindingSpecReadMsg], UnresolvedBindingSpec)
+fromABindingSpec mHsModuleName path arep = do
+    (moduleErrs, hsModuleName) <- case (arep.hsModule, mHsModuleName) of
+      (Just bsModule, Just curModule)
+        | bsModule == curModule -> return ([], bsModule)
+        | otherwise -> return
+            ([BindingSpecReadModuleMismatch path bsModule curModule], bsModule)
+      (Just bsModule, Nothing) -> return ([], bsModule)
+      (Nothing, Just curModule) -> return ([], curModule)
+      (Nothing, Nothing) -> Left $ BindingSpecReadModuleNotSpecified path
+    let (cTypeErrs, hsNms, bindingSpecCTypes) =
+          fromAOCTypeSpecs path arep.cTypes
+        (hsTypeErrs, bindingSpecHsTypes) =
+          fromAHsTypeSpecs path hsNms arep.hsTypes
+    return
+      ( moduleErrs ++ cTypeErrs ++ hsTypeErrs
+      , BindingSpec{
+            moduleName = hsModuleName
+          , cTypes     = bindingSpecCTypes
+          , hsTypes    = bindingSpecHsTypes
+          }
+      )
+
+toABindingSpec ::
+     (C.DeclId -> C.DeclId -> Ordering)
+  -> UnresolvedBindingSpec
+  -> ARep V1 UnresolvedBindingSpec
+toABindingSpec compareCDeclId spec = ABindingSpec{
+      version  = mkAVersion currentBindingSpecVersion
+    , hsModule = Just spec.moduleName
+    , cTypes   = toAOCTypeSpecs compareCDeclId spec.cTypes
+    , hsTypes  = toAHsTypeSpecs spec.hsTypes
+    }
+
+--------------------------------------------------------------------------------
+
+newtype instance ARep V1 Hs.ModuleName = AModuleName Hs.ModuleName
+  deriving stock (Show)
+
+instance ARepIso V1 Hs.ModuleName
+
+instance Aeson.FromJSON (ARep V1 Hs.ModuleName) where
+  parseJSON = Aeson.withText "ModuleName" $ return . AModuleName . Hs.ModuleName
+
+instance Aeson.ToJSON (ARep V1 Hs.ModuleName) where
+  toJSON (AModuleName moduleName) = Aeson.String moduleName.text
+
+--------------------------------------------------------------------------------
+
+data instance ARep V1 CTypeSpec = ACTypeSpec {
+      headers :: [FilePath]
+    , cName   :: Text
+    , hsName  :: Maybe (Hs.Name Hs.NsTypeConstr)
+    , enum    :: Maybe CEnumSpec
+    }
+  deriving stock (Show)
+
+instance Aeson.FromJSON (ARep V1 CTypeSpec) where
+  parseJSON = Aeson.withObject "CTypeSpec" $ \o -> do
+    aCTypeSpecHeaders <- o .:  "headers" >>= listFromJSON
+    aCTypeSpecCName   <- o .:  "cname"
+    aCTypeSpecHsName  <- o .:? "hsname"
+    aCTypeSpecEnum    <- o .:? "enum"
+    return ACTypeSpec{
+        headers = aCTypeSpecHeaders
+      , cName   = aCTypeSpecCName
+      , hsName  = fromARep' <$> aCTypeSpecHsName
+      , enum    = fromARep' <$> aCTypeSpecEnum
+      }
+
+instance Aeson.ToJSON (ARep V1 CTypeSpec) where
+  toJSON arep = Aeson.Object . KM.fromList $ catMaybes [
+      Just ("headers" .= listToJSON arep.headers)
+    , Just ("cname"   .= arep.cName)
+    , ("hsname" .=) . toARep' <$> arep.hsName
+    , ("enum"   .=) . toARep' <$> arep.enum
+    ]
+
+instance ARepKV V1 CTypeSpec where
+  data ARepK V1 CTypeSpec = AKCTypeSpec {
+      headers :: [FilePath]
+    , cName   :: Text
+    }
+
+  fromARepKV arep =
+    ( AKCTypeSpec{
+          headers = arep.headers
+        , cName   = arep.cName
+        }
+    , CTypeSpec{
+          hsName = arep.hsName
+        , enum   = arep.enum
+        }
+    )
+
+  toARepKV k v = ACTypeSpec{
+      headers = k.headers
+    , cName   = k.cName
+    , hsName  = v.hsName
+    , enum    = v.enum
+    }
+
+deriving stock instance Show (ARepK V1 CTypeSpec)
+
+instance Aeson.FromJSON (ARepK V1 CTypeSpec) where
+  parseJSON = Aeson.withObject "AKCTypeSpec" $ \o -> do
+    akCTypeSpecHeaders <- o .: "headers" >>= listFromJSON
+    akCTypeSpecCName   <- o .: "cname"
+    return AKCTypeSpec{
+        headers = akCTypeSpecHeaders
+      , cName   = akCTypeSpecCName
+      }
+
+instance Aeson.ToJSON (ARepK V1 CTypeSpec) where
+  toJSON key = Aeson.Object $ KM.fromList [
+      "headers" .= listToJSON key.headers
+    , "cname"   .= key.cName
+    ]
+
+type AOCTypeSpec = AOmittable (ARepK V1 CTypeSpec) (ARep V1 CTypeSpec)
+
+fromAOCTypeSpecs ::
+     FilePath
+  -> [AOCTypeSpec]
+  -> ( [BindingSpecReadMsg]
+     , Set (Hs.Name Hs.NsTypeConstr)
+     , Map C.DeclId [(Set C.HashIncludeArg, Omittable CTypeSpec)]
+     )
+fromAOCTypeSpecs path =
+    fin . foldr auxInsert (Set.empty, [], Map.empty, Set.empty, Map.empty)
+  where
+    fin ::
+         ( Set Text
+         , [C.HashIncludeArgMsg]
+         , Map C.DeclId (Set C.HashIncludeArg)
+         , Set (Hs.Name Hs.NsTypeConstr)
+         , Map C.DeclId [(Set C.HashIncludeArg, Omittable CTypeSpec)]
+         )
+      -> ( [BindingSpecReadMsg]
+         , Set (Hs.Name Hs.NsTypeConstr)
+         , Map C.DeclId [(Set C.HashIncludeArg, Omittable CTypeSpec)]
+         )
+    fin (invalids, msgs, conflicts, hsNms, cTypeMap) =
+      let invalidErrs = BindingSpecReadInvalidCName path <$> Set.toList invalids
+          argErrs = BindingSpecReadHashIncludeArg path <$> msgs
+          conflictErrs = [
+              BindingSpecReadCTypeConflict path cDeclId header
+            | (cDeclId, headers) <- Map.toList conflicts
+            , header <- Set.toList headers
+            ]
+      in  (invalidErrs ++ argErrs ++ conflictErrs, hsNms, cTypeMap)
+
+    auxInsert ::
+         AOCTypeSpec
+      -> ( Set Text
+         , [C.HashIncludeArgMsg]
+         , Map C.DeclId (Set C.HashIncludeArg)
+         , Set (Hs.Name Hs.NsTypeConstr)
+         , Map C.DeclId [(Set C.HashIncludeArg, Omittable CTypeSpec)]
+         )
+      -> ( Set Text
+         , [C.HashIncludeArgMsg]
+         , Map C.DeclId (Set C.HashIncludeArg)
+         , Set (Hs.Name Hs.NsTypeConstr)
+         , Map C.DeclId [(Set C.HashIncludeArg, Omittable CTypeSpec)]
+         )
+    auxInsert aoCTypeMapping (invalids, msgs, conflicts, hsNms, acc) =
+      let (cname, headers, mHsNm, oCTypeSpec) = case aoCTypeMapping of
+            ARequire arep ->
+              let (k, cTypeSpec) = fromARepKV arep
+              in  (k.cName, k.headers, cTypeSpec.hsName, Require cTypeSpec)
+            AOmit k -> (k.cName, k.headers, Nothing, Omit)
+          (msgs', headers') = bimap ((msgs ++) . concat) Set.fromList $
+            unzip (map C.hashIncludeArg headers)
+          hsNms' = maybe hsNms (`Set.insert` hsNms) mHsNm
+          newV = [(headers', oCTypeSpec)]
+      in  case C.parseDeclId cname of
+            Nothing ->
+              (Set.insert cname invalids, msgs', conflicts, hsNms', acc)
+            Just cDeclId ->
+              case Map.insertLookupWithKey (const (++)) cDeclId newV acc of
+                (Nothing, acc') -> (invalids, msgs', conflicts, hsNms', acc')
+                (Just oldV, acc') ->
+                  let conflicts' = auxDup cDeclId newV oldV conflicts
+                  in  (invalids, msgs', conflicts', hsNms', acc')
+
+    auxDup ::
+         C.DeclId
+      -> [(Set C.HashIncludeArg, a)]
+      -> [(Set C.HashIncludeArg, a)]
+      -> Map C.DeclId (Set C.HashIncludeArg)
+      -> Map C.DeclId (Set C.HashIncludeArg)
+    auxDup cDeclId newV oldV =
+      case Set.intersection (mconcat (fst <$> newV)) (mconcat (fst <$> oldV)) of
+        commonHeaders
+          | Set.null commonHeaders -> id
+          | otherwise -> Map.insertWith Set.union cDeclId commonHeaders
+
+toAOCTypeSpecs ::
+     (C.DeclId -> C.DeclId -> Ordering)
+  -> Map C.DeclId [(Set C.HashIncludeArg, Omittable CTypeSpec)]
+  -> [AOCTypeSpec]
+toAOCTypeSpecs compareCDeclId cTypeMap = map snd $ List.sortBy aux [
+      (cDeclId,) $ case oCTypeSpec of
+        Require spec -> ARequire ACTypeSpec{
+            headers = map (.path) (Set.toAscList headers)
+          , cName   = C.renderDeclId cDeclId
+          , hsName  = spec.hsName
+          , enum    = spec.enum
+          }
+        Omit -> AOmit AKCTypeSpec{
+            headers = map (.path) (Set.toAscList headers)
+          , cName   = C.renderDeclId cDeclId
+          }
+    | (cDeclId, xs) <- Map.toAscList cTypeMap
+    , (headers, oCTypeSpec) <- xs
+    ]
+  where
+    aux :: (C.DeclId, AOCTypeSpec) -> (C.DeclId, AOCTypeSpec) -> Ordering
+    aux (cDeclIdL, xL) (cDeclIdR, xR) =
+      case compareCDeclId cDeclIdL cDeclIdR of
+        LT -> LT
+        GT -> GT
+        EQ -> Ord.comparing headersOf xL xR
+
+    headersOf :: AOCTypeSpec -> [FilePath]
+    headersOf = \case
+      ARequire x -> x.headers
+      AOmit    x -> x.headers
+
+--------------------------------------------------------------------------------
+
+newtype instance ARep V1 CEnumSpec = ACEnumSpec CEnumSpec
+  deriving stock (Show)
+
+instance ARepIso V1 CEnumSpec
+
+instance Aeson.FromJSON (ARep V1 CEnumSpec) where
+  parseJSON = Aeson.withText "CEnumSpec" $ \t ->
+    case Map.lookup t cEnumSpecFromText of
+      Just cEnumSpec -> return (ACEnumSpec cEnumSpec)
+      Nothing        -> Aeson.parseFail $
+        "unknown C enum specification: " ++ Text.unpack t
+
+instance Aeson.ToJSON (ARep V1 CEnumSpec) where
+  toJSON (ACEnumSpec cEnumSpec) = Aeson.String (cEnumSpecToText cEnumSpec)
+
+cEnumSpecToText :: CEnumSpec -> Text
+cEnumSpecToText = \case
+    CEnumOpen   -> "open"
+    CEnumClosed -> "closed"
+
+cEnumSpecFromText :: Map Text CEnumSpec
+cEnumSpecFromText = Map.fromList [
+      (cEnumSpecToText cEnumSpec, cEnumSpec)
+    | cEnumSpec <- [minBound..]
+    ]
+
+--------------------------------------------------------------------------------
+
+newtype instance ARep V1 (Hs.Name ns) =
+    AHsName (Hs.Name ns)
+  deriving stock (Show)
+
+instance ARepIso V1 (Hs.Name ns)
+
+instance Hs.SingNamespace ns => Aeson.FromJSON (ARep V1 (Hs.Name ns)) where
+  parseJSON = case Hs.singNamespace @ns of
+    Hs.SNsTypeConstr ->
+      Aeson.withText "Hs.Name Hs.NsTypeConstr" $ \text ->
+        case parseHsName (Proxy @Hs.NsTypeConstr) text of
+          Left err ->
+            Aeson.parseFail $
+              "failed parsing type constructor name: " <> show (prettyForTrace err)
+          Right hsName ->
+            pure $ AHsName hsName
+    Hs.SNsConstr ->
+      Aeson.withText "Hs.Name Hs.NsConstr" $ \text ->
+        case parseHsName (Proxy @Hs.NsConstr) text of
+          Left err ->
+            Aeson.parseFail $
+              "failed parsing data constructor name: " <> show (prettyForTrace err)
+          Right hsName ->
+            pure $ AHsName hsName
+    Hs.SNsVar ->
+      Aeson.withText "Hs.Name Hs.NsVar" $ \text ->
+        case parseHsName (Proxy @Hs.NsVar) text of
+          Left err ->
+            Aeson.parseFail $
+              "failed parsing variable name: " <> show (prettyForTrace err)
+          Right hsName ->
+            pure $ AHsName hsName
+
+instance Aeson.ToJSON (ARep V1 (Hs.Name ns)) where
+  toJSON (AHsName hsName) = Aeson.String (hsName.text)
+
+--------------------------------------------------------------------------------
+
+data instance ARep V1 HsTypeSpec = AHsTypeSpec {
+      hsName    :: Hs.Name Hs.NsTypeConstr
+    , hsRep     :: Maybe HsTypeRep
+    , instances :: [AOInstanceSpec]
+    }
+  deriving stock (Show)
+
+instance Aeson.FromJSON (ARep V1 HsTypeSpec) where
+  parseJSON = Aeson.withObject "HsTypeSpec" $ \o -> do
+    aHsTypeSpecHsName    <- o .:  "hsname"
+    aHsTypeSpecHsRep     <- o .:? "representation"
+    aHsTypeSpecInstances <- o .:? "instances" .!= []
+    return AHsTypeSpec{
+        hsName    = fromARep' aHsTypeSpecHsName
+      , hsRep     = fromARep' <$> aHsTypeSpecHsRep
+      , instances = aHsTypeSpecInstances
+      }
+
+instance Aeson.ToJSON (ARep V1 HsTypeSpec) where
+  toJSON arep = Aeson.Object . KM.fromList $ catMaybes [
+      Just ("hsname" .= toARep' arep.hsName)
+    , ("representation" .=) . toARep' <$> arep.hsRep
+    , ("instances" .=) <$> omitWhenNull arep.instances
+    ]
+
+instance ARepKV V1 HsTypeSpec where
+  newtype ARepK V1 HsTypeSpec = AKHsTypeSpec { unwrap :: Hs.Name Hs.NsTypeConstr }
+
+  fromARepKV arep =
+    ( AKHsTypeSpec arep.hsName
+    , HsTypeSpec{
+          hsRep     = arep.hsRep
+        , instances = fromAOInstanceSpecs arep.instances
+        }
+    )
+
+  toARepKV k v = AHsTypeSpec{
+      hsName    = k.unwrap
+    , hsRep     = v.hsRep
+    , instances = toAOInstanceSpecs v.instances
+    }
+
+deriving stock instance Show (ARepK V1 HsTypeSpec)
+
+instance Aeson.FromJSON (ARepK V1 HsTypeSpec) where
+  parseJSON = fmap (AKHsTypeSpec . fromARep') . Aeson.parseJSON
+
+instance Aeson.ToJSON (ARepK V1 HsTypeSpec) where
+  toJSON = Aeson.toJSON . toARep' . (.unwrap)
+
+fromAHsTypeSpecs ::
+     FilePath
+  -> Set (Hs.Name Hs.NsTypeConstr)
+  -> [ARep V1 HsTypeSpec]
+  -> ([BindingSpecReadMsg], Map (Hs.Name Hs.NsTypeConstr) HsTypeSpec)
+fromAHsTypeSpecs path hsNms = fin . foldr auxInsert (Set.empty, Map.empty)
+  where
+    fin ::
+         ( Set (Hs.Name Hs.NsTypeConstr)
+         , Map (Hs.Name Hs.NsTypeConstr) HsTypeSpec )
+      -> ([BindingSpecReadMsg], Map (Hs.Name Hs.NsTypeConstr) HsTypeSpec)
+    fin (conflicts, hsTypeMap) =
+      let conflictErrs = BindingSpecReadHsTypeConflict path <$>
+            Set.toList conflicts
+          noRefErrs = BindingSpecReadHsTypeNameNoRef path <$>
+            Set.toList (Map.keysSet hsTypeMap `Set.difference` hsNms)
+      in  (conflictErrs ++ noRefErrs, hsTypeMap)
+
+    auxInsert ::
+         ARep V1 HsTypeSpec
+      -> (Set (Hs.Name Hs.NsTypeConstr), Map (Hs.Name Hs.NsTypeConstr) HsTypeSpec)
+      -> (Set (Hs.Name Hs.NsTypeConstr), Map (Hs.Name Hs.NsTypeConstr) HsTypeSpec)
+    auxInsert arep (conflicts, acc) =
+      let (k, hsTypeSpec) = fromARepKV arep
+      in  case Map.insertLookupWithKey (\_ n _ -> n) k.unwrap hsTypeSpec acc of
+            (Nothing, acc') -> (conflicts,                     acc')
+            (Just{},  acc') -> (Set.insert k.unwrap conflicts, acc')
+
+toAHsTypeSpecs ::
+     Map (Hs.Name Hs.NsTypeConstr) HsTypeSpec
+  -> [ARep V1 HsTypeSpec]
+toAHsTypeSpecs hsTypeMap = [
+      toARepKV (AKHsTypeSpec hsName) spec
+    | (hsName, spec) <- Map.toAscList hsTypeMap
+    ]
+
+--------------------------------------------------------------------------------
+
+newtype instance ARep V1 HsTypeRep = AHsTypeRep HsTypeRep
+  deriving stock (Show)
+
+instance ARepIso V1 HsTypeRep
+
+instance Aeson.FromJSON (ARep V1 HsTypeRep) where
+  parseJSON = fmap AHsTypeRep . parseHsTypeRep
+    where
+      parseHsTypeRep :: Aeson.Value -> Aeson.Parser HsTypeRep
+      parseHsTypeRep = \case
+        Aeson.Object o | KM.size o == 1 && KM.member "record" o ->
+          HsTypeRepRecord
+            <$> Aeson.explicitParseField parseHsRecordRep o "record"
+        Aeson.Object o | KM.size o == 1 && KM.member "newtype" o ->
+          HsTypeRepNewtype
+            <$> Aeson.explicitParseField parseHsNewtypeRep o "newtype"
+        v -> Aeson.withText "HsTypeRep" parseHsTypeRepText v
+
+      parseHsTypeRepText :: Text -> Aeson.Parser HsTypeRep
+      parseHsTypeRepText t = case t of
+        "record"    -> return (HsTypeRepRecord def)
+        "newtype"   -> return (HsTypeRepNewtype def)
+        "emptydata" -> return HsTypeRepEmptyData
+        "typealias" -> return HsTypeRepTypeAlias
+        _           ->
+          Aeson.parseFail $ "unknown Haskell representation: " ++ Text.unpack t
+
+      parseHsRecordRep :: Aeson.Value -> Aeson.Parser HsRecordRep
+      parseHsRecordRep = Aeson.withObject "HsRecordRep" $ \o -> do
+        hsRecordRepConstructor <- o .:? "constructor"
+        hsRecordRepFields      <- o .:? "fields"
+        return HsRecordRep{
+            constructor = fromARep' <$> hsRecordRepConstructor
+          , fields      = map fromARep' <$> hsRecordRepFields
+          }
+
+      parseHsNewtypeRep :: Aeson.Value -> Aeson.Parser HsNewtypeRep
+      parseHsNewtypeRep = Aeson.withObject "HsNewtypeRep" $ \o -> do
+        hsNewtypeRepConstructor <- o .:? "constructor"
+        fields <- o .:? "fields"
+        hsNewtypeRepField <- case fields of
+          Nothing          -> return Nothing
+          Just [fieldName] -> return (Just fieldName)
+          Just []          ->
+            Aeson.parseFail "newtype representation with no fields"
+          Just{}           ->
+            Aeson.parseFail "newtype representation with more than one field"
+        hsNewtypeRepFFIType <- o .:? "ffitype"
+        return HsNewtypeRep{
+            constructor = fromARep' <$> hsNewtypeRepConstructor
+          , field       = fromARep' <$> hsNewtypeRepField
+          , ffiType     = fromARep' <$> hsNewtypeRepFFIType
+          }
+
+instance Aeson.ToJSON (ARep V1 HsTypeRep) where
+  toJSON (AHsTypeRep hsTypeRep) = case hsTypeRep of
+    HsTypeRepRecord x
+      | x == def  -> Aeson.String "record"
+      | otherwise ->
+            Aeson.Object . KM.singleton "record"
+          . Aeson.Object . KM.fromList
+          $ catMaybes [
+                ("constructor" .=) . toARep' <$> x.constructor
+              , ("fields"      .=) . map toARep' <$> x.fields
+              ]
+    HsTypeRepNewtype x
+      | x == def  -> Aeson.String "newtype"
+      | otherwise ->
+            Aeson.Object . KM.singleton "newtype"
+          . Aeson.Object . KM.fromList
+          $ catMaybes [
+                ("constructor" .=) . toARep' <$> x.constructor
+              , ("fields"      .=) . (: []) . toARep' <$> x.field
+              , ("ffitype"     .=) . toARep' <$> x.ffiType
+              ]
+    HsTypeRepEmptyData -> Aeson.String "emptydata"
+    HsTypeRepTypeAlias -> Aeson.String "typealias"
+
+--------------------------------------------------------------------------------
+
+newtype instance ARep V1 HsFFIType = AHsFFIType HsFFIType
+  deriving stock (Show)
+
+instance ARepIso V1 HsFFIType
+
+instance Aeson.FromJSON (ARep V1 HsFFIType) where
+  parseJSON = fmap AHsFFIType . parseFFIType
+    where
+      parseFFIType = Aeson.withObject "HsFFIType" $ \o -> do
+          moduleName <- o .: "hsmodule"
+          typeName   <- o .: "hsname"
+          pure $ HsFFIType $ Hs.ExtRef {
+              moduleName = fromARep' moduleName
+            , name = fromARep' typeName
+            }
+
+instance Aeson.ToJSON (ARep V1 HsFFIType) where
+  toJSON (AHsFFIType ffiType) = Aeson.object [
+        "hsmodule" .= toARep' ffiType.unwrap.moduleName
+      , "hsname"   .= toARep' ffiType.unwrap.name
+      ]
+
+--------------------------------------------------------------------------------
+
+data instance ARep V1 InstanceSpec = AInstanceSpec {
+      clss        :: Inst.TypeClass
+    , strategy    :: Maybe Inst.Strategy
+    , constraints :: [Inst.Constraint]
+    }
+  deriving stock (Show)
+
+instance Aeson.FromJSON (ARep V1 InstanceSpec) where
+  parseJSON = \case
+    s@Aeson.String{} -> do
+      aInstanceSpecClass <- Aeson.parseJSON s
+      let aInstanceSpecStrategy    = Nothing
+          aInstanceSpecConstraints = []
+      return AInstanceSpec{
+          clss        = fromARep' aInstanceSpecClass
+        , strategy    = aInstanceSpecStrategy
+        , constraints = aInstanceSpecConstraints
+        }
+    Aeson.Object o -> do
+      aInstanceSpecClass       <- o .:  "class"
+      aInstanceSpecStrategy    <- o .:? "strategy"
+      aInstanceSpecConstraints <- o .:? "constraints" .!= []
+      return AInstanceSpec{
+          clss        = fromARep' aInstanceSpecClass
+        , strategy    = fromARep' <$> aInstanceSpecStrategy
+        , constraints = fromARep' <$> aInstanceSpecConstraints
+        }
+    v -> Aeson.parseFail $
+      "expected InstanceSpec String or Object, but encountered " ++ typeOf v
+
+instance Aeson.ToJSON (ARep V1 InstanceSpec) where
+  toJSON arep
+    | isNothing arep.strategy && null arep.constraints =
+        Aeson.toJSON (toARep' arep.clss)
+    | otherwise = Aeson.Object . KM.fromList $ catMaybes [
+          Just ("class" .= toARep' arep.clss)
+        , ("strategy"    .=) . toARep' <$> arep.strategy
+        , ("constraints" .=) . fmap toARep' <$> omitWhenNull arep.constraints
+        ]
+
+instance ARepKV V1 InstanceSpec where
+  newtype ARepK V1 InstanceSpec = AKInstanceSpec { unwrap :: Inst.TypeClass }
+
+  fromARepKV arep =
+    ( AKInstanceSpec arep.clss
+    , InstanceSpec{
+          strategy    = arep.strategy
+        , constraints = arep.constraints
+        }
+    )
+
+  toARepKV k v = AInstanceSpec{
+      clss        = k.unwrap
+    , strategy    = v.strategy
+    , constraints = v.constraints
+    }
+
+deriving stock instance Show (ARepK V1 InstanceSpec)
+
+instance Aeson.FromJSON (ARepK V1 InstanceSpec) where
+  parseJSON = fmap (AKInstanceSpec . fromARep') . Aeson.parseJSON
+
+instance Aeson.ToJSON (ARepK V1 InstanceSpec) where
+  toJSON = Aeson.toJSON . toARep' . (.unwrap)
+
+type AOInstanceSpec = AOmittable (ARepK V1 InstanceSpec) (ARep V1 InstanceSpec)
+
+-- duplicates ignored, last value retained
+fromAOInstanceSpecs ::
+     [AOInstanceSpec]
+  -> Map Inst.TypeClass (Omittable InstanceSpec)
+fromAOInstanceSpecs xs = Map.fromList . flip map xs $ \case
+    ARequire arep -> bimap (.unwrap) Require (fromARepKV arep)
+    AOmit    k    -> (k.unwrap, Omit)
+
+toAOInstanceSpecs ::
+     Map Inst.TypeClass (Omittable InstanceSpec)
+  -> [AOInstanceSpec]
+toAOInstanceSpecs instMap = [
+      case oInstSpec of
+        Require spec -> ARequire $ toARepKV (AKInstanceSpec hsTypeClass) spec
+        Omit         -> AOmit (AKInstanceSpec hsTypeClass)
+    | (hsTypeClass, oInstSpec) <- Map.toAscList instMap
+    ]
+
+--------------------------------------------------------------------------------
+
+newtype instance ARep V1 Inst.TypeClass = ATypeClass Inst.TypeClass
+  deriving stock (Show)
+
+instance ARepIso V1 Inst.TypeClass
+
+instance Aeson.FromJSON (ARep V1 Inst.TypeClass) where
+  parseJSON = Aeson.withText "TypeClass" $ \t ->
+    let s = Text.unpack t
+    in  case readMaybe s of
+          Just clss -> return (ATypeClass clss)
+          Nothing   -> Aeson.parseFail $ "unknown type class: " ++ s
+
+instance Aeson.ToJSON (ARep V1 Inst.TypeClass) where
+  toJSON (ATypeClass clss) = Aeson.String $ Text.pack (show clss)
+
+--------------------------------------------------------------------------------
+
+newtype instance ARep V1 Inst.Strategy = AStrategy Inst.Strategy
+  deriving stock (Show)
+
+instance ARepIso V1 Inst.Strategy
+
+instance Aeson.FromJSON (ARep V1 Inst.Strategy) where
+  parseJSON = Aeson.withText "Strategy" $ \t ->
+    case Map.lookup t strategyFromText of
+      Just strat -> return (AStrategy strat)
+      Nothing    -> Aeson.parseFail $ "unknown strategy: " ++ Text.unpack t
+
+instance Aeson.ToJSON (ARep V1 Inst.Strategy) where
+  toJSON (AStrategy strat) = Aeson.String (strategyToText strat)
+
+strategyToText :: Inst.Strategy -> Text
+strategyToText = \case
+    Inst.HsBindgen -> "hs-bindgen"
+    Inst.Newtype   -> "newtype"
+    Inst.Stock     -> "stock"
+
+strategyFromText :: Map Text Inst.Strategy
+strategyFromText = Map.fromList [
+      (strategyToText strat, strat)
+    | strat <- [minBound..]
+    ]
+
+--------------------------------------------------------------------------------
+
+newtype instance ARep V1 Inst.Constraint = AConstraint Inst.Constraint
+  deriving stock (Show)
+
+instance ARepIso V1 Inst.Constraint
+
+instance Aeson.FromJSON (ARep V1 Inst.Constraint) where
+  parseJSON = Aeson.withObject "Constraint" $ \o -> do
+      constraintClass <- o .: "class"
+      extRefModule    <- o .: "hsmodule"
+      extRefName      <- o .: "hsname"
+      let hsName :: Hs.Name Hs.NsTypeConstr
+          hsName = fromARep' extRefName
+          -- TODO https://github.com/well-typed/hs-bindgen/issues/423
+          --
+          -- At the moment, we only handle external references to types types.
+          -- Later we may support external references to variables (e.g., in
+          -- macros).
+          constraintRef = Hs.ExtRef{
+              moduleName = fromARep' extRefModule
+            , name       = hsName
+            }
+      return $ AConstraint Inst.Constraint{
+          clss = fromARep' constraintClass
+        , ref  = constraintRef
+        }
+
+instance Aeson.ToJSON (ARep V1 Inst.Constraint) where
+  toJSON (AConstraint constraint) = Aeson.object [
+        "class"    .= toARep' constraint.clss
+      , "hsmodule" .= toARep' constraint.ref.moduleName
+        -- TODO https://github.com/well-typed/hs-bindgen/issues/423
+        --
+        -- At the moment, we only handle external references to types types.
+        -- Later we may support external references to variables (e.g., in
+        -- macros).
+      , "hsname"   .= toARep' constraint.ref.name
+      ]
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+-- 'List.lookup' using a predicate
+lookupBy :: (a -> Bool) -> [(a, b)] -> Maybe b
+lookupBy p = fmap snd . List.find (p . fst)
+
+data MangleCandidateError =
+    MangleCandidateCouldNotMangleError Text
+  | MangleCandidateParseError          MangleCandidate.ParseCandidateError
+
+instance PrettyForTrace MangleCandidateError where
+  prettyForTrace = \case
+    MangleCandidateCouldNotMangleError x -> PP.hsep [
+        "Could not mangle:"
+      , PP.text x
+      ]
+    MangleCandidateParseError err -> PP.hsep [
+        "Name does not adhere to naming rules:"
+      , prettyForTrace err
+      ]
+
+parseHsName :: forall ns.
+     Hs.SingNamespace ns
+  => Proxy ns
+  -> Text
+  -> Either MangleCandidateError (Hs.Name ns)
+parseHsName _ hsNameCandidate =
+    case MangleCandidate.parseCandidate mangleCandidateConfig hsNameCandidate of
+      Nothing ->
+        Left $ MangleCandidateCouldNotMangleError hsNameCandidate
+      Just (Left  err) ->
+        Left $ MangleCandidateParseError err
+      Just (Right hsName) ->
+        Right $ hsName
+  where
+    mangleCandidateConfig :: MangleCandidate Maybe
+    mangleCandidateConfig =
+      MangleCandidate.mangleCandidateDefault
+        -- Names in binding specs are supplied by the user and are expected to
+        -- be valid Haskell identifiers. We therefore do not check reserved
+        -- names: the user is trusted to avoid them, and checking would reject
+        -- names like @type@ that are legitimately used in external packages.
+        & #reservedNames .~ mempty
diff --git a/src-internal/HsBindgen/BindingSpec/Private/Version.hs b/src-internal/HsBindgen/BindingSpec/Private/Version.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/BindingSpec/Private/Version.hs
@@ -0,0 +1,194 @@
+{-# LANGUAGE TemplateHaskellQuotes #-}
+
+-- | Binding specification version management
+--
+-- This /private/ module may only be used by "HsBindgen.BindingSpec" and
+-- sub-modules.
+--
+-- Intended for unqualified import.
+module HsBindgen.BindingSpec.Private.Version (
+    -- * HsBindgenVersion
+    HsBindgenVersion
+  , prettyForTraceHsBindgenVersion
+    -- * BindingSpecVersion
+  , BindingSpecVersion
+  , constBindingSpecVersion
+  , parseBindingSpecVersion
+    -- * Compatibility
+  , BindingSpecCompatibility(..)
+  , isCompatBindingSpecVersions
+    -- * AVersion
+  , AVersion(..)
+  , mkAVersion
+  , getAVersion
+  ) where
+
+import Data.Aeson ((.:), (.=))
+import Data.Aeson.Types qualified as Aeson
+import Data.Char qualified as Char
+import Data.List qualified as List
+import Data.Text qualified as Text
+import Data.Version qualified
+import Language.Haskell.TH.Syntax qualified as THS
+import Text.Read (readMaybe)
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Errors (failCode)
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer (PrettyForTrace (prettyForTrace))
+
+import Paths_hs_bindgen qualified as Package
+
+{-------------------------------------------------------------------------------
+  HsBindgenVersion
+-------------------------------------------------------------------------------}
+
+-- | @hs-bindgen@ version
+type HsBindgenVersion = Data.Version.Version
+
+prettyForTraceHsBindgenVersion :: HsBindgenVersion -> PP.CtxDoc
+prettyForTraceHsBindgenVersion = PP.string . Data.Version.showVersion
+
+{-------------------------------------------------------------------------------
+  BindingSpecVersion
+-------------------------------------------------------------------------------}
+
+-- | Binding specification version
+--
+-- Binding specification versions are in @MAJOR.MINOR@ format where
+-- @MAJOR >= 1@ and @MINOR >= 0@.
+data BindingSpecVersion = UnsafeBindingSpecVersion Int Int
+  deriving stock (Eq, Ord, THS.Lift)
+
+instance Aeson.FromJSON BindingSpecVersion where
+  parseJSON = Aeson.withText "BindingSpecVersion" $ \t ->
+    case parseBindingSpecVersion t of
+      Right v -> return v
+      Left  e -> Aeson.parseFail $
+        "Invalid binding specification version: " ++ e ++ ": " ++ show t
+
+instance Aeson.ToJSON BindingSpecVersion where
+  toJSON = Aeson.String . Text.pack . show
+
+instance PrettyForTrace BindingSpecVersion where
+  prettyForTrace = PP.string . show
+
+instance Show BindingSpecVersion where
+  show (UnsafeBindingSpecVersion x y) = show x ++ '.' : show y
+
+-- | Construct a 'BindingSpecVersion'
+mkBindingSpecVersion ::
+     Int  -- ^ Major version (@>= 1@)
+  -> Int  -- ^ Minor version (@>= 0@)
+  -> Either String BindingSpecVersion
+mkBindingSpecVersion major minor
+    | major < 1 = Left "major version less than 1"
+    | minor < 0 = Left "minor version less than 0"
+    | otherwise = Right (UnsafeBindingSpecVersion major minor)
+
+-- | Construct a 'BindingSpecVersion', validating it a compile-time
+constBindingSpecVersion ::
+     (MonadFail m, THS.Quote m)
+  => Int  -- ^ Major version
+  -> Int  -- ^ Minor version
+  -> THS.Code m BindingSpecVersion
+constBindingSpecVersion major minor = case mkBindingSpecVersion major minor of
+    Right v -> [|| v ||]
+    Left  e -> failCode $ "Invalid binding specification version: " ++ e
+
+-- | Parse a 'BindingSpecVersion'
+parseBindingSpecVersion :: Text -> Either String BindingSpecVersion
+parseBindingSpecVersion t =
+    case List.uncons <$> span Char.isDigit (Text.unpack t) of
+      (majorS, Just ('.', minorS)) ->
+        case (readMaybe majorS, readMaybe minorS) of
+          (Just major, Just minor) -> mkBindingSpecVersion major minor
+          _otherwise               -> Left "not in MAJOR.MINOR format"
+      _otherwise -> Left "not in MAJOR.MINOR format"
+
+{-------------------------------------------------------------------------------
+  Compatibility
+-------------------------------------------------------------------------------}
+
+-- | Binding specification compatibility strictness
+data BindingSpecCompatibility =
+    -- | Do not allow newer minor versions
+    BindingSpecStrict
+  | -- | Allow newer minor versions
+    BindingSpecAllowNewer
+  deriving stock (Eq, Show)
+
+instance Default BindingSpecCompatibility where
+  def = BindingSpecStrict
+
+-- | Check 'BindingSpecVersion' compatibility
+isCompatBindingSpecVersions ::
+     BindingSpecCompatibility
+  -> BindingSpecVersion  -- ^ Version of binding specification being read
+  -> BindingSpecVersion  -- ^ Version of binding specification module
+  -> Bool
+isCompatBindingSpecVersions
+  BindingSpecStrict
+  (UnsafeBindingSpecVersion majorL minorL)
+  (UnsafeBindingSpecVersion majorR minorR) =
+    majorL == majorR && minorL <= minorR
+isCompatBindingSpecVersions
+  BindingSpecAllowNewer
+  (UnsafeBindingSpecVersion majorL _)
+  (UnsafeBindingSpecVersion majorR _) =
+    majorL == majorR
+
+{-------------------------------------------------------------------------------
+  AVersion
+-------------------------------------------------------------------------------}
+
+-- | JSON/YAML version information
+data AVersion = AVersion {
+      bindgen     :: HsBindgenVersion
+    , bindingSpec :: BindingSpecVersion
+    }
+  deriving stock Show
+
+instance Aeson.FromJSON AVersion where
+  parseJSON = Aeson.withObject "AVersion" $ \o -> do
+    aVersionHsBindgen            <- o .: "hs_bindgen"
+    aVersionBindingSpecification <- o .: "binding_specification"
+    return AVersion{
+        bindgen     = aVersionHsBindgen
+      , bindingSpec = aVersionBindingSpecification
+      }
+
+instance Aeson.ToJSON AVersion where
+  toJSON version = Aeson.object [
+      "hs_bindgen"            .= version.bindgen
+    , "binding_specification" .= version.bindingSpec
+    ]
+
+-- | Construct an t'AVersion' with the current versions
+mkAVersion :: BindingSpecVersion -> AVersion
+mkAVersion aVersionBindingSpecification = AVersion{
+      bindgen = Package.version
+    , bindingSpec = aVersionBindingSpecification
+    }
+
+-- | Internal type used to parse just the version information
+newtype ABindingSpecVersion = ABindingSpecVersion {
+      aVersion :: AVersion
+    }
+  deriving stock Show
+
+instance Aeson.FromJSON ABindingSpecVersion where
+  parseJSON = Aeson.withObject "file" $ \o -> do
+    aVersion <- o .: "version"
+    return $ ABindingSpecVersion aVersion
+
+instance Aeson.ToJSON ABindingSpecVersion where
+  toJSON (ABindingSpecVersion aVersion) = Aeson.object [
+      "version" .= aVersion
+    ]
+
+-- | Parse just the version information
+getAVersion :: Aeson.Value -> Either String AVersion
+getAVersion value = case Aeson.fromJSON value of
+    Aeson.Success (ABindingSpecVersion aVersion) -> Right aVersion
+    Aeson.Error   err                            -> Left  err
diff --git a/src-internal/HsBindgen/Boot.hs b/src-internal/HsBindgen/Boot.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Boot.hs
@@ -0,0 +1,258 @@
+module HsBindgen.Boot (
+    runBoot
+  , ClangArtefacts (..)
+  , getClangArtefacts
+  , BootArtefact (..)
+  , BootMsg (..)
+  ) where
+
+import Control.Exception (displayException)
+import Text.SimplePrettyPrint (CtxDoc, (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.Args
+import Clang.CStandard
+
+import HsBindgen.Backend.Category (Category (..))
+import HsBindgen.BindingSpec
+import HsBindgen.Cache
+import HsBindgen.Clang
+import HsBindgen.Clang.CompareVersions (CompareVersionsMsg,
+                                        compareClangVersions)
+import HsBindgen.Clang.Discover
+import HsBindgen.Clang.ExtraClangArgs
+import HsBindgen.Clang.Macos
+import HsBindgen.Config.ClangArgs (ClangArgsConfig)
+import HsBindgen.Config.ClangArgs qualified as ClangArgs
+import HsBindgen.Config.Internal
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Util.Tracer
+
+-- | Boot phase.
+--
+-- Basic setup and checks.
+--
+-- - Check arguments to @#include@.
+-- - Determine Clang arguments.
+-- - Load external and prescriptive binding specifications.
+runBoot ::
+     Tracer BootMsg
+  -> (ClangCStandard -> IO (Macro.Lang l))
+  -> BindgenConfig
+  -> [C.UncheckedRootDirective]
+  -> IO (BootArtefact l)
+runBoot tracer mkMacroLang config uncheckedRootDirectives = do
+    traceStatus $ BootStatusStart config
+
+    checkBackendConfig (contramap BootBackendConfig tracer) config.backend
+
+    checkMacosEnv (contramap BootMacos tracer)
+
+    getRootDirectives <- cache "rootDirectives" $ Cached $ do
+      let tracer' = contramap BootHashIncludeArg tracer
+      withTrace BootStatusRootDirectives $
+        traverse (traverse (C.hashIncludeArgWithTrace tracer'))
+          uncheckedRootDirectives
+
+    getClangArtefacts' <- cache "clangArtefacts" $ Cached $
+      getClangArtefacts tracer config.boot.clangArgs
+
+    getCStandard <- cache "cStandard" $ withTrace BootStatusCStandard $
+      (.cStandard) <$> getClangArtefacts'
+
+    getClangExe <- cache "clangExe" $ withTrace BootStatusClangExe $
+      (.clangExe) <$> getClangArtefacts'
+
+    getClangArgs <- cache "clangArgs" $ withTrace BootStatusClangArgs $
+      (.clangArgs) <$> getClangArtefacts'
+
+    getMacroLang <- cache "macroLang" $ do
+       cStandard <- getCStandard
+       liftIO $ mkMacroLang cStandard
+
+    getBindingSpecs <- cache "loadBindingSpecs" $ do
+      clangArgs <- getClangArgs
+      liftIO $ loadBindingSpecs
+        (contramap BootBindingSpec tracer)
+        clangArgs
+        (fromBaseModuleName config.boot.baseModule (Just CType))
+        config.boot.bindingSpec
+
+    getExternalBindingSpecs <- cache "getExternalBindingSpecs" $
+      withTrace BootStatusExternalBindingSpecs $
+        fmap fst $ getBindingSpecs
+
+    getPrescriptiveBindingSpec <- cache "getPrescriptiveBindingSpec" $
+      withTrace BootStatusPrescriptiveBindingSpec $
+        fmap snd $ getBindingSpecs
+
+    pure BootArtefact {
+          baseModule              = config.boot.baseModule
+        , cStandard               = getCStandard
+        , clangExe                = getClangExe
+        , clangArgs               = getClangArgs
+        , macroLang               = getMacroLang
+        , rootDirectives          = getRootDirectives
+        , externalBindingSpecs    = getExternalBindingSpecs
+        , prescriptiveBindingSpec = getPrescriptiveBindingSpec
+        }
+  where
+    tracerBootStatus :: Tracer BootStatusMsg
+    tracerBootStatus = contramap BootStatus tracer
+
+    traceStatus :: MonadIO m => BootStatusMsg -> m ()
+    traceStatus = traceWith tracerBootStatus . withCallStack
+
+    withTrace :: MonadIO m => (a -> BootStatusMsg) -> m a -> m a
+    withTrace c a = do
+      x <- a
+      traceStatus $ c x
+      pure x
+
+    cache :: String -> Cached a -> IO (Cached a)
+    cache = cacheWith (contramap (BootCache . SafeTrace) tracer) . Just
+
+data ClangArtefacts = ClangArtefacts {
+    cStandard :: ClangCStandard
+  , clangExe  :: Maybe ClangExe
+  , clangArgs :: ClangArgs
+  }
+
+-- | Determine Clang artefacts
+getClangArtefacts ::
+     Tracer BootMsg
+  -> ClangArgsConfig FilePath
+  -> IO ClangArtefacts
+getClangArtefacts tracer config0 = do
+    compareClangVersions (contramap BootCompareClangVersions tracer)
+    extraClangArgs <- getExtraClangArgs tracerExtraClangArgs
+    paths <- getPaths tracerDiscover config0.builtinIncDir
+    let config =
+            applyExtraClangArgs extraClangArgs
+          . applyPaths paths
+          $ config0
+        clangArgs' = ClangArgs.clangArgsConfigToClangArgs config
+    cStandard' <- getClangCStandard' tracer clangArgs'
+    return ClangArtefacts{
+        cStandard = cStandard'
+      , clangExe  = paths.pClangExe
+      , clangArgs = clangArgs'
+      }
+  where
+    tracerDiscover :: Tracer DiscoverMsg
+    tracerDiscover = contramap BootDiscover tracer
+
+    tracerExtraClangArgs :: Tracer ExtraClangArgsMsg
+    tracerExtraClangArgs = contramap BootExtraClangArgs tracer
+
+-- | Fatal exceptions
+data FatalException =
+    UnableToDetermineCStandardException
+  deriving Show
+
+instance Exception FatalException where
+  displayException = \case
+    UnableToDetermineCStandardException -> "Unable to determine C standard"
+
+-- | Determine the C standard using @libclang@
+--
+-- This function throws a 'UnableToDetermineCStandardException' if the call to
+-- @libclang@ fails or we are unable to determine the C standard.
+getClangCStandard' :: Tracer BootMsg -> ClangArgs -> IO ClangCStandard
+getClangCStandard' tracer clangArgs =
+    getClangCStandard clangArgs >>= \case
+      Just clangCStandard -> do
+        traceWith tracerCStandard $ withCallStack $ BootCStandardClang clangCStandard
+        return clangCStandard
+      Nothing -> do
+        traceWith tracerCStandard $ withCallStack $ BootCStandardFail
+        throwIO UnableToDetermineCStandardException
+  where
+    tracerCStandard :: Tracer BootCStandardMsg
+    tracerCStandard = contramap BootCStandard tracer
+
+{-------------------------------------------------------------------------------
+  Artefact
+-------------------------------------------------------------------------------}
+
+data BootArtefact l = BootArtefact {
+      baseModule              :: BaseModuleName
+    , cStandard               :: Cached ClangCStandard
+    , clangExe                :: Cached (Maybe ClangExe)
+    , clangArgs               :: Cached ClangArgs
+    , macroLang               :: Cached (Macro.Lang l)
+    , rootDirectives          :: Cached [C.RootDirective C.HashIncludeArg]
+    , externalBindingSpecs    :: Cached MergedBindingSpecs
+    , prescriptiveBindingSpec :: Cached PrescriptiveBindingSpec
+    }
+
+{-------------------------------------------------------------------------------
+  Trace
+-------------------------------------------------------------------------------}
+
+data BootStatusMsg =
+    BootStatusStart                   BindgenConfig
+  | BootStatusCStandard               ClangCStandard
+  | BootStatusClangExe                (Maybe ClangExe)
+  | BootStatusClangArgs               ClangArgs
+  | BootStatusRootDirectives          [C.RootDirective C.HashIncludeArg]
+  | BootStatusExternalBindingSpecs    MergedBindingSpecs
+  | BootStatusPrescriptiveBindingSpec PrescriptiveBindingSpec
+  deriving stock (Show, Generic)
+
+bootStatus :: Show a => String -> a -> CtxDoc
+bootStatus nm x =
+  PP.hang ("Boot status (" >< PP.string nm >< "):") 2 $ PP.show x
+
+instance PrettyForTrace BootStatusMsg where
+  prettyForTrace = \case
+    BootStatusStart                   x -> bootStatus "BindgenConfig"           x
+    BootStatusCStandard               x -> bootStatus "ClangCStandard"          x
+    BootStatusClangExe                x -> bootStatus "ClangExe"                x
+    BootStatusClangArgs               x -> bootStatus "ClangArgs"               x
+    BootStatusRootDirectives          x -> bootStatus "RootDirectives"          x
+    BootStatusExternalBindingSpecs    x -> bootStatus "ExternalBindingSpecs"    x
+    BootStatusPrescriptiveBindingSpec x -> bootStatus "PrescriptiveBindingSpec" x
+
+instance IsTrace Level BootStatusMsg where
+  getDefaultLogLevel = const Debug
+  getSource          = const HsBindgen
+  getTraceId         = const "boot-status"
+
+data BootCStandardMsg =
+    BootCStandardClang ClangCStandard
+  | BootCStandardFail
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace BootCStandardMsg where
+  prettyForTrace = \case
+    BootCStandardClang std ->
+      "C standard determined by libclang: " >< PP.show std
+    BootCStandardFail ->
+      "Unable to determine C standard"
+
+instance IsTrace Level BootCStandardMsg where
+  getDefaultLogLevel = \case
+    BootCStandardClang{} -> Info
+    BootCStandardFail    -> Error
+
+  getSource  = const HsBindgen
+  getTraceId = const "boot-c-standard"
+
+-- | Boot trace messages
+data BootMsg =
+    BootBackendConfig        BackendConfigMsg
+  | BootMacos                MacosMsg
+  | BootBindingSpec          BindingSpecMsg
+  | BootDiscover             DiscoverMsg
+  | BootClang                ClangMsg
+  | BootCStandard            BootCStandardMsg
+  | BootExtraClangArgs       ExtraClangArgsMsg
+  | BootHashIncludeArg       C.HashIncludeArgMsg
+  | BootCompareClangVersions CompareVersionsMsg
+  | BootStatus               BootStatusMsg
+  | BootCache                (SafeTrace CacheMsg)
+  deriving stock (Show, Generic)
+  deriving anyclass (PrettyForTrace, IsTrace Level)
diff --git a/src-internal/HsBindgen/Cache.hs b/src-internal/HsBindgen/Cache.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Cache.hs
@@ -0,0 +1,67 @@
+module HsBindgen.Cache (
+    Cached(..)
+  , getCached
+  , cacheWith
+  , CacheMsg(..)
+  ) where
+
+import Control.Concurrent (MVar, modifyMVar, newMVar)
+import Control.Monad.IO.Class
+import GHC.Generics (Generic)
+import Text.SimplePrettyPrint (CtxDoc, (<+>), (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Util.Tracer
+
+newtype Cached a = Cached (IO a)
+  deriving newtype (Functor, Applicative, Monad, MonadIO)
+
+getCached :: Cached a -> IO a
+getCached (Cached ma) = ma
+
+-- | Cache a computation with a name.
+--
+-- Names only serve for debug messages. They need not be unique.
+cacheWith :: Tracer CacheMsg -> Maybe String -> Cached a -> IO (Cached a)
+cacheWith tracerCache name action = do
+  cacheVar <- newMVar Nothing
+  pure $ getWithCache tracerCache name cacheVar action
+
+getWithCache ::
+     Tracer CacheMsg
+  -> Maybe String
+  -> MVar (Maybe a)
+  -> Cached a
+  -> Cached a
+getWithCache tracerCache name cacheVar action = Cached $
+    modifyMVar cacheVar $ \case
+      Nothing -> do
+        traceWith tracerCache $ withCallStack $ CacheMiss name
+        !newRes <- getCached action
+        pure (Just newRes, newRes)
+      Just cachedRes -> do
+        traceWith tracerCache $ withCallStack $ CacheHit name
+        pure (Just cachedRes, cachedRes)
+
+{-------------------------------------------------------------------------------
+  Traces
+-------------------------------------------------------------------------------}
+
+data CacheMsg =
+    CacheMiss (Maybe String)
+  | CacheHit  (Maybe String)
+  deriving (Show, Eq, Generic)
+
+prettyForTraceName :: Maybe String -> CtxDoc
+prettyForTraceName Nothing = "anonymous computation"
+prettyForTraceName (Just name) = PP.string name
+
+instance PrettyForTrace CacheMsg where
+  prettyForTrace = \case
+    CacheMiss mName -> "Cache miss:" <+> prettyForTraceName mName >< "; computing value"
+    CacheHit  mName -> "Cache hit: " <+> prettyForTraceName mName
+
+instance IsTrace SafeLevel CacheMsg where
+  getDefaultLogLevel = const SafeDebug
+  getSource          = const HsBindgen
+  getTraceId         = const "cache"
diff --git a/src-internal/HsBindgen/Clang.hs b/src-internal/HsBindgen/Clang.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Clang.hs
@@ -0,0 +1,189 @@
+-- | Top-level call into @clang@, with @hs-bindgen@ specific features
+module HsBindgen.Clang (
+    -- * Top-level call into @clang@
+    ClangSetup(..)
+  , ClangInput(..)
+  , defaultClangSetup
+  , withClang
+  , LibclangException(..)
+  , withClang'
+    -- * Trace messages
+  , ClangMsg(..)
+  , infoHelpMessage
+  ) where
+
+import Data.Text qualified as Text
+import Text.SimplePrettyPrint ((><))
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.Args
+import Clang.Enum.Bitfield
+import Clang.Enum.Simple
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types
+import Clang.LowLevel.Core
+
+import HsBindgen.Frontend.RootHeader qualified as RootHeader
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Top-level call into clang
+-------------------------------------------------------------------------------}
+
+data ClangSetup = ClangSetup{
+      args        :: ClangArgs
+    , diagnostics :: DisplayDiagnostics
+    , input       :: ClangInput
+    , flags       :: BitfieldEnum CXTranslationUnit_Flags
+    }
+  deriving stock (Show, Eq)
+
+instance PrettyForTrace ClangSetup where
+  prettyForTrace = PP.show
+
+data ClangInput =
+    ClangInputFile SourcePath
+  | ClangInputMemory FilePath String
+  deriving stock (Show, Eq)
+
+defaultClangSetup :: ClangArgs -> ClangInput -> ClangSetup
+defaultClangSetup args input = ClangSetup{
+      args        = args
+    , diagnostics = DontDisplayDiagnostics
+    , input       = input
+    , flags       = bitfieldEnum [CXTranslationUnit_DetailedPreprocessingRecord]
+    }
+
+-- | Call clang to parse with the specified t'ClangSetup'
+--
+-- All diagnostics are traced.
+--
+-- Exits with failure code 2 if any of them are errors.
+--
+-- The specified continuation is called only when there are no error
+-- diagnostics.
+withClang :: forall a.
+     Tracer ClangMsg
+  -> ClangSetup
+  -> (CXTranslationUnit -> IO a)
+  -> IO a
+withClang tracer setup k = do
+    mRes <- withClang' tracer setup $ \unit -> do
+      anyIsError <- traceDiagnostics unit
+      if anyIsError
+        then throwIO $ LibclangException "Call to 'libclang' returned an error"
+        else Just <$> k unit
+    case mRes of
+      Nothing  -> throwIO $ LibclangException "Call to 'libclang' failed"
+      Just res -> pure res
+  where
+    traceDiagnostics :: CXTranslationUnit -> IO Bool
+    traceDiagnostics unit =
+        go False =<< HighLevel.clang_getDiagnostics unit Nothing
+      where
+        go :: Bool -> [Diagnostic] -> IO Bool
+        go !anyIsError []     = pure anyIsError
+        go !anyIsError (d:ds) = do
+            traceWith (contramap ClangDiagnostic tracer) (withCallStack d)
+            go (anyIsError || diagnosticIsError d) ds
+
+data LibclangException = LibclangException String
+  deriving stock (Show, Eq, Ord)
+
+instance Exception LibclangException
+
+-- | Call clang to parse with the specified t'ClangSetup'
+--
+-- Diagnostics are not traced, and /the specified continuation is called even if
+-- there are error diagnostics/.
+withClang' :: forall a.
+     Tracer ClangMsg
+  -> ClangSetup
+  -> (CXTranslationUnit -> IO (Maybe a))
+  -> IO (Maybe a)
+withClang' tracer setup k = do
+    traceWith tracer $ withCallStack $ ClangSetupMsg setup
+    HighLevel.withIndex setup.diagnostics $ \index -> do
+      let withUnit :: SourcePath -> [CXUnsavedFile] -> IO (Maybe a)
+          withUnit path unsaved =
+             HighLevel.withTranslationUnit2
+               index
+               (Just path)
+               setup.args
+               unsaved
+               setup.flags
+               onErrorCode
+               k
+      case setup.input of
+        ClangInputFile path ->
+          withUnit path []
+        ClangInputMemory path contents -> do
+          HighLevel.withUnsavedFile path contents $ \file  ->
+            withUnit (SourcePath $ Text.pack path) [file]
+  where
+    onErrorCode :: SimpleEnum CXErrorCode -> IO (Maybe a)
+    onErrorCode err = do
+        traceWith tracer $ withCallStack $ ClangErrorCode err
+        return Nothing
+
+{-------------------------------------------------------------------------------
+  Log messages
+-------------------------------------------------------------------------------}
+
+-- | Errors and warnings resulting from interaction with clang
+data ClangMsg =
+    ClangErrorCode (SimpleEnum CXErrorCode)
+  | ClangDiagnostic Diagnostic
+  | ClangSetupMsg ClangSetup
+  | ClangInvokedWithoutOptions
+  deriving stock (Show)
+
+instance PrettyForTrace ClangMsg where
+  prettyForTrace = \case
+      ClangErrorCode  x -> "clang error " >< PP.show x
+      ClangDiagnostic diag
+        | RootHeader.isInRootHeader diag.diagnosticLocation -> PP.text $
+            case getFileNotFound diag.diagnosticSpelling of
+              Just header -> "unable to resolve #include <" <> header <> ">"
+              Nothing     -> case getFileNotFoundQ diag.diagnosticSpelling of
+                Just header ->
+                  "unable to resolve #include <" <> header
+                    <> "> (must specify header relative to directory in C include search path)"
+                Nothing     ->
+                  Text.stripStart $ Text.dropWhile (/= ' ') diag.diagnosticFormatted
+        | otherwise -> PP.text diag.diagnosticFormatted
+      ClangSetupMsg   x -> prettyForTrace x
+      ClangInvokedWithoutOptions ->
+        PP.cat $ map PP.text infoHelpMessage
+    where
+      getFileNotFound :: Text -> Maybe Text
+      getFileNotFound =
+        fmap (Text.dropWhile (== '\'')) . Text.stripSuffix "' file not found"
+
+      getFileNotFoundQ :: Text -> Maybe Text
+      getFileNotFoundQ =
+          fmap (Text.dropWhile (== '\'') . Text.dropWhile (/= '\''))
+        . Text.stripSuffix "' file not found with <angled> include; use \"quotes\" instead"
+
+infoHelpMessage :: [Text]
+infoHelpMessage =
+  [ "This command provides a way to get output from libclang."
+  , " For example, use --clang-option=-v to see version and include"
+  , " search path information, taking into account any other Clang"
+  , " options and environment variables."
+  ]
+
+
+instance IsTrace Level ClangMsg where
+  getDefaultLogLevel = \case
+      ClangErrorCode  _          -> Error
+      ClangDiagnostic x          -> if diagnosticIsError x then Error else Warning
+      ClangSetupMsg   _          -> Debug
+      ClangInvokedWithoutOptions -> Notice
+  getSource = \case
+      ClangErrorCode  _          -> Libclang
+      ClangDiagnostic _          -> Libclang
+      ClangSetupMsg   _          -> HsBindgen
+      ClangInvokedWithoutOptions -> Libclang
+  getTraceId = const "clang"
diff --git a/src-internal/HsBindgen/Clang/CompareVersions.hs b/src-internal/HsBindgen/Clang/CompareVersions.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Clang/CompareVersions.hs
@@ -0,0 +1,53 @@
+module HsBindgen.Clang.CompareVersions (
+    CompareVersionsMsg(..)
+  , compareClangVersions
+  ) where
+
+import Text.SimplePrettyPrint ((<+>))
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.Version
+
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+data CompareVersionsMsg =
+    CompileTimeAndRuntimeVersionMismatch Text Text
+  deriving stock (Show)
+
+instance PrettyForTrace CompareVersionsMsg where
+  prettyForTrace = \case
+    CompileTimeAndRuntimeVersionMismatch compileTimeVersion runtimeVersion ->
+      PP.hangs' "clang version mismatch:" 2 [
+          "clang compile time version:" <+> PP.text compileTimeVersion
+        , "clang runtime version:     " <+> PP.text runtimeVersion
+        ]
+
+instance IsTrace Level CompareVersionsMsg where
+  getDefaultLogLevel = \case
+    CompileTimeAndRuntimeVersionMismatch _ _ -> Warning
+
+  getSource  = const HsBindgen
+
+  getTraceId = const "compare-clang-versions"
+
+{-------------------------------------------------------------------------------
+  Comparison functions
+-------------------------------------------------------------------------------}
+
+-- | Check that the runtime version of libclang is compatible with the
+-- compile-time version
+--
+-- A warning is issued if they are incompatible.
+compareClangVersions :: Tracer CompareVersionsMsg -> IO ()
+compareClangVersions tracer
+    | isCompatibleClangVersion compileTimeClangVersion runtimeClangVersion =
+        return ()
+    | otherwise = traceWith tracer . withCallStack $
+        CompileTimeAndRuntimeVersionMismatch
+          compileTimeClangVersionString
+          runtimeClangVersionString
diff --git a/src-internal/HsBindgen/Clang/Discover.hs b/src-internal/HsBindgen/Clang/Discover.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Clang/Discover.hs
@@ -0,0 +1,218 @@
+module HsBindgen.Clang.Discover (
+    -- * Types
+    Paths(..)
+  , ClangExe
+  , BuiltinIncDir
+    -- * Trace messages
+  , DiscoverMsg(..)
+    -- * API
+  , getPaths
+  , applyPaths
+  ) where
+
+import Control.Exception (Exception (displayException))
+import Data.IORef (IORef)
+import Data.IORef qualified as IORef
+import GHC.Stack (CallStack)
+import System.Environment qualified as Env
+import System.IO.Unsafe (unsafePerformIO)
+import Text.SimplePrettyPrint (string, (<+>))
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.Discover (BuiltinIncDir, ClangExe, Paths (..))
+import Clang.Discover qualified as Discover
+
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+-- | Trace messages emitted during path discovery
+--
+-- The actual discovery is performed by @libclang-bindings@
+-- ('Discover.getPaths'); its trace messages are wrapped in 'DiscoverClang'. The
+-- remaining constructors cover the @hs-bindgen@-specific environment variable
+-- check (see 'getEnvConfig').
+data DiscoverMsg =
+    DiscoverEnvNone
+  | DiscoverEnvSet BuiltinIncDirConfig
+  | DiscoverEnvInvalid String
+  | DiscoverClang Discover.DiscoverMsg
+  deriving stock (Show)
+
+instance PrettyForTrace DiscoverMsg where
+  prettyForTrace = \case
+    DiscoverEnvNone ->
+      PP.string envName <+> "not set"
+    DiscoverEnvSet config ->
+      PP.string envName <+> "set:" <+> PP.string (show config)
+    DiscoverEnvInvalid s ->
+      PP.string envName <+> "invalid:" <+> PP.string (show s) <+> "(ignored)"
+    DiscoverClang msg -> prettyDiscoverMsg msg
+
+instance IsTrace Level DiscoverMsg where
+  getDefaultLogLevel = \case
+    DiscoverEnvNone      -> Debug
+    DiscoverEnvSet{}     -> Info
+    DiscoverEnvInvalid{} -> Warning
+    DiscoverClang msg    -> discoverMsgLevel msg
+
+  getSource  = const HsBindgen
+
+  getTraceId = const "builtin-include-dir"
+
+-- | Pretty-print an upstream 'Discover.DiscoverMsg'
+prettyDiscoverMsg :: Discover.DiscoverMsg -> PP.CtxDoc
+prettyDiscoverMsg = \case
+    Discover.DiscoverLlvmPathNotFound path ->
+      "$LLVM_PATH path not found or not directory (skipping):" <+> string path
+    Discover.DiscoverLlvmConfigPathFound path ->
+      "llvm-config found using $PATH:" <+> string path
+    Discover.DiscoverLlvmConfigPrefixUnexpected s ->
+      "llvm-config --prefix output is unexpected:" <+> string (show s)
+    Discover.DiscoverLlvmConfigPrefixIOError e ->
+      "IO error calling llvm-config --prefix:" <+> string (displayException e)
+    Discover.DiscoverClangNotFound ->
+      "clang not found"
+    Discover.DiscoverClangVersionMismatch libclangVersion clangVersion ->
+      PP.hangs' "clang version mismatch:" 2 [
+          "libclang version:" <+> PP.text libclangVersion
+        , "clang version:   " <+> PP.text clangVersion
+        ]
+    Discover.DiscoverClangIncDirNotFound path ->
+      "builtin include directory not found using clang:" <+> string path
+    Discover.DiscoverClangIncDirFound path ->
+      "builtin include directory found using clang:" <+> string path
+    Discover.DiscoverLlvmPathClangExeNotFound path ->
+      "clang not found using $LLVM_PATH:" <+> string path
+    Discover.DiscoverLlvmPathClangExeFound path ->
+      "clang found using $LLVM_PATH:" <+> string path
+    Discover.DiscoverLlvmConfigClangExeNotFound path ->
+      "clang not found using llvm-config:" <+> string path
+    Discover.DiscoverLlvmConfigClangExeFound path ->
+      "clang found using llvm-config:" <+> string path
+    Discover.DiscoverClangPathFound path ->
+      "clang found using $PATH:" <+> string path
+    Discover.DiscoverClangVersionUnexpected s ->
+      "clang --version output is unexpected:" <+> string (show s)
+    Discover.DiscoverClangVersionIOError e ->
+      "IO error calling clang --version:" <+> string (displayException e)
+    Discover.DiscoverClangPrintResourceDirUnexpected s ->
+      "clang -print-resource-dir output is unexpected:" <+> string (show s)
+    Discover.DiscoverClangPrintResourceDirIOError e ->
+      "IO error calling clang -print-resource-dir:"
+        <+> string (displayException e)
+
+-- | Default log level for an upstream 'Discover.DiscoverMsg'
+discoverMsgLevel :: Discover.DiscoverMsg -> Level
+discoverMsgLevel = \case
+    Discover.DiscoverLlvmPathNotFound{}                -> Warning
+    Discover.DiscoverLlvmConfigPathFound{}             -> Debug
+    Discover.DiscoverLlvmConfigPrefixUnexpected{}      -> Warning
+    Discover.DiscoverLlvmConfigPrefixIOError{}         -> Warning
+    Discover.DiscoverClangNotFound                     -> Debug
+    Discover.DiscoverClangVersionMismatch _ _          -> Warning
+    Discover.DiscoverClangIncDirNotFound _             -> Warning
+    Discover.DiscoverClangIncDirFound{}                -> Info
+    Discover.DiscoverLlvmPathClangExeNotFound{}        -> Debug
+    Discover.DiscoverLlvmPathClangExeFound{}           -> Debug
+    Discover.DiscoverLlvmConfigClangExeNotFound{}      -> Debug
+    Discover.DiscoverLlvmConfigClangExeFound{}         -> Debug
+    Discover.DiscoverClangPathFound{}                  -> Debug
+    Discover.DiscoverClangVersionUnexpected _          -> Warning
+    Discover.DiscoverClangVersionIOError _             -> Warning
+    Discover.DiscoverClangPrintResourceDirUnexpected _ -> Warning
+    Discover.DiscoverClangPrintResourceDirIOError _    -> Warning
+
+{-------------------------------------------------------------------------------
+  Global state
+-------------------------------------------------------------------------------}
+
+data DiscoverState =
+    DiscoverStateInitial
+  | DiscoverStateCached Discover.Paths
+
+-- | Global state for caching discovered paths
+--
+-- Paths should only be discovered a single time. Calling 'getPaths' stores the
+-- result in this global state, and any subsequent calls simply returns the
+-- cached value.
+discoverState :: IORef DiscoverState
+discoverState = unsafePerformIO $ IORef.newIORef DiscoverStateInitial
+{-# NOINLINE discoverState #-}
+
+{-------------------------------------------------------------------------------
+  API
+-------------------------------------------------------------------------------}
+
+-- | Try to discover paths for the @clang@ executable, and the builtin include
+-- directory
+--
+-- This wraps 'Discover.getPaths' from @libclang-bindings@, adding two
+-- @hs-bindgen@-specific behaviours:
+--
+-- * The @BINDGEN_BUILTIN_INCLUDE_DIR@ environment variable, when set, overrides
+--   the passed 'BuiltinIncDirConfig' (see 'getEnvConfig').
+-- * Discovered paths are cached: discovery is only performed a single time, and
+--   any subsequent call simply returns the cached value.
+--
+-- See 'Discover.getPaths' for a description of the discovery strategy.
+getPaths ::
+     Tracer DiscoverMsg
+  -> BuiltinIncDirConfig
+  -> IO Discover.Paths
+getPaths tracer config =
+    IORef.readIORef discoverState >>= \case
+      DiscoverStateCached paths -> return paths
+      DiscoverStateInitial -> do
+        mEnvConfig <- getEnvConfig tracer
+        paths <- toPaths <$>
+          Discover.getPaths trace (fromMaybe config mEnvConfig)
+        IORef.writeIORef discoverState (DiscoverStateCached paths)
+        return paths
+  where
+    -- Feed upstream trace messages (paired with their callstack) into our
+    -- tracer, wrapped in 'DiscoverClang'.
+    trace :: CallStack -> Discover.DiscoverMsg -> IO ()
+    trace cs msg = traceWith tracer (WithCallStack cs (DiscoverClang msg))
+
+    toPaths :: Discover.Paths -> Discover.Paths
+    toPaths p = Discover.Paths {
+        pClangExe      = Discover.pClangExe p
+      , pBuiltinIncDir = Discover.pBuiltinIncDir p
+      }
+
+-- | Apply the discovered paths to 'Clang.Args.ClangArgs'
+--
+-- When configured, the builtin include directory is passed with @-isystem@ as
+-- the last argument.  This ensures that it is prioritized as close to the
+-- default include directories as possible.
+applyPaths ::
+     Discover.Paths
+  -> ClangArgsConfig path
+  -> ClangArgsConfig path
+applyPaths paths = case paths.pBuiltinIncDir of
+    Nothing            -> id
+    Just builtinIncDir -> #argsAfter %~ (++ ["-isystem", builtinIncDir])
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+-- | Environment variable name
+envName :: String
+envName = "BINDGEN_BUILTIN_INCLUDE_DIR"
+
+-- | Load configuration from system environment, when available
+getEnvConfig :: Tracer DiscoverMsg -> IO (Maybe BuiltinIncDirConfig)
+getEnvConfig tracer = Env.lookupEnv envName >>= \case
+    Nothing        -> Nothing <$ traceWith tracer (withCallStack DiscoverEnvNone)
+    Just "disable" -> aux BuiltinIncDirDisable
+    Just "clang"   -> aux BuiltinIncDirClang
+    Just s         -> Nothing <$ traceWith tracer (withCallStack $ DiscoverEnvInvalid s)
+  where
+    aux :: BuiltinIncDirConfig -> IO (Maybe BuiltinIncDirConfig)
+    aux config = Just config <$ traceWith tracer (withCallStack $ DiscoverEnvSet config)
diff --git a/src-internal/HsBindgen/Clang/ExtraClangArgs.hs b/src-internal/HsBindgen/Clang/ExtraClangArgs.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Clang/ExtraClangArgs.hs
@@ -0,0 +1,77 @@
+module HsBindgen.Clang.ExtraClangArgs (
+    -- * Trace messages
+    ExtraClangArgsMsg(..)
+    -- * API
+  , getExtraClangArgs
+  , applyExtraClangArgs
+    -- * Low-level API (exported for tests)
+  , splitArguments
+  ) where
+
+import GHC.ResponseFile (unescapeArgs)
+import System.Environment (lookupEnv)
+import Text.SimplePrettyPrint ((><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+data ExtraClangArgsMsg =
+    ExtraClangArgsNotSet
+  | ExtraClangArgsEmpty
+  | ExtraClangArgsParsed [String]
+  deriving stock (Show)
+
+instance PrettyForTrace ExtraClangArgsMsg where
+  prettyForTrace = \case
+    ExtraClangArgsNotSet -> PP.string envName >< " environment variable not set"
+    ExtraClangArgsEmpty  -> PP.string envName >< " environment variable empty"
+    ExtraClangArgsParsed args ->
+      PP.string envName >< " environment variable parsed 'libclang' arguments: "
+        >< PP.show args
+
+instance IsTrace Level ExtraClangArgsMsg where
+  getDefaultLogLevel = \case
+    ExtraClangArgsNotSet   -> Debug
+    ExtraClangArgsEmpty    -> Debug
+    ExtraClangArgsParsed{} -> Info
+  getSource  = const HsBindgen
+  getTraceId = const "extra-clang-args"
+
+{-------------------------------------------------------------------------------
+  API
+-------------------------------------------------------------------------------}
+
+-- | Get extra Clang arguments from system environment
+--
+-- This function reads the @BINDGEN_EXTRA_CLANG_ARGS@ environment variable.
+-- Values are split into command-line arguments, respecting shell escapes.
+getExtraClangArgs :: Tracer ExtraClangArgsMsg -> IO [String]
+getExtraClangArgs tracer = fmap splitArguments <$> lookupEnv envName >>= \case
+    Nothing   -> []   <$ traceWith tracer (withCallStack ExtraClangArgsNotSet)
+    Just []   -> []   <$ traceWith tracer (withCallStack ExtraClangArgsEmpty)
+    Just args -> args <$ traceWith tracer (withCallStack $ ExtraClangArgsParsed args)
+
+-- | Apply extra Clang arguments to 'HsBindgen.Config.ClangArgs.ClangArgsConfig'
+--
+-- When configured, extra clang arguments are appended to 'HsBindgen.Config.ClangArgs.clangArgsInner'.
+applyExtraClangArgs :: [String] -> ClangArgsConfig path -> ClangArgsConfig path
+applyExtraClangArgs args = #argsInner %~ (++ args)
+
+{-------------------------------------------------------------------------------
+  Auxiliary
+-------------------------------------------------------------------------------}
+
+envName :: String
+envName = "BINDGEN_EXTRA_CLANG_ARGS"
+
+-- | Split string into command-line arguments, respecting shell escapes
+--
+-- For expectations, see @Test.HsBindgen.C.Environment.splitArgumentTests@.
+splitArguments :: String -> [String]
+splitArguments = unescapeArgs
diff --git a/src-internal/HsBindgen/Clang/Macos.hs b/src-internal/HsBindgen/Clang/Macos.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Clang/Macos.hs
@@ -0,0 +1,125 @@
+module HsBindgen.Clang.Macos (
+    -- * Types
+    SdkPath
+    -- * Trace messages
+  , MacosMsg(..)
+    -- * API
+  , checkMacosEnv
+  ) where
+
+import Control.Exception (Exception (displayException))
+import Control.Monad ((<=<))
+import System.Environment qualified as Env
+import System.Info qualified
+import System.Process qualified as Proc
+import Text.SimplePrettyPrint ((<+>))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Imports
+import HsBindgen.Util.Process
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+-- | SDK path
+type SdkPath = FilePath
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+data MacosMsg =
+    MacosEnvAlreadySet SdkPath
+  | MacosEnvNotSet
+  | MacosXcrunRun
+  | MacosXcrunUnexpected String
+  | MacosXcrunIOError IOError
+  | MacosEnvSet SdkPath
+  deriving stock (Show)
+
+instance PrettyForTrace MacosMsg where
+  prettyForTrace = \case
+    MacosEnvAlreadySet path ->
+      PP.string envName <+> "already set:" <+> PP.string (show path)
+    MacosEnvNotSet ->
+      PP.string envName <+> "not set"
+    MacosXcrunRun ->
+      PP.hang ("Running xcrun to determine" <+> PP.string envName) 2 $
+        "Command:" <+> cmdSpecPrettyForTrace xcrunCmd
+    MacosXcrunUnexpected s ->
+      PP.hangs ("Unable to determine" <+> PP.string envName) 2 [
+          "Command:" <+> cmdSpecPrettyForTrace xcrunCmd
+        , "Unexpected output:" <+> PP.string (show s)
+        ]
+    MacosXcrunIOError e ->
+      PP.hangs ("Unable to determine" <+> PP.string envName) 2 [
+          "Command:" <+> cmdSpecPrettyForTrace xcrunCmd
+        , "IO error:" <+> PP.string (displayException e)
+        ]
+    MacosEnvSet path ->
+      "Setting"
+        <+> PP.string (envName ++ ":")
+        <+> PP.string (show path)
+
+instance IsTrace Level MacosMsg where
+  getDefaultLogLevel = \case
+    MacosEnvAlreadySet{}   -> Debug
+    MacosEnvNotSet         -> Debug
+    MacosXcrunRun          -> Info
+    MacosXcrunUnexpected{} -> Warning
+    MacosXcrunIOError{}    -> Warning
+    MacosEnvSet{}          -> Notice
+
+  getSource  = const HsBindgen
+  getTraceId = const "macos"
+
+{-------------------------------------------------------------------------------
+  API
+-------------------------------------------------------------------------------}
+
+-- | Check @SDKROOT@ environment variable on macOS
+--
+-- If @SDKROOT@ is not set, attempt to determine it with @xcrun@ and set it when
+-- successful.
+checkMacosEnv :: Tracer MacosMsg -> IO ()
+checkMacosEnv tracer = when (System.Info.os == "darwin") $
+    getEnv tracer >>= \case
+      Just{}  -> return ()
+      Nothing -> getXcrunSdkPath tracer >>= \case
+        Nothing   -> return ()
+        Just path -> setEnv tracer path
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+envName :: String
+envName = "SDKROOT"
+
+getEnv :: Tracer MacosMsg -> IO (Maybe SdkPath)
+getEnv tracer = do
+    mx <- Env.lookupEnv envName
+    traceWith tracer $ withCallStack $ maybe MacosEnvNotSet MacosEnvAlreadySet mx
+    return mx
+
+setEnv :: Tracer MacosMsg -> SdkPath -> IO ()
+setEnv tracer path = do
+    traceWith tracer (withCallStack $ MacosEnvSet path)
+    Env.setEnv envName path
+
+--------------------------------------------------------------------------------
+
+xcrunCmd :: Proc.CmdSpec
+xcrunCmd = Proc.RawCommand "xcrun" ["--sdk", "macosx", "--show-sdk-path"]
+
+getXcrunSdkPath :: Tracer MacosMsg -> IO (Maybe SdkPath)
+getXcrunSdkPath tracer = do
+    traceWith tracer (withCallStack MacosXcrunRun)
+    checkOutput
+      tracer
+      MacosXcrunUnexpected
+      MacosXcrunIOError
+      (parseNonEmpty <=< parseSingleLine)
+      (cmdSpecReadAction xcrunCmd)
diff --git a/src-internal/HsBindgen/Clang/Tokens.hs b/src-internal/HsBindgen/Clang/Tokens.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Clang/Tokens.hs
@@ -0,0 +1,42 @@
+-- | Helpers for @libclang@ tokens
+--
+-- This module is intended to be imported qualified.
+--
+-- > import HsBindgen.Clang.Tokens qualified as Clang
+module HsBindgen.Clang.Tokens (
+    -- * Pretty-printing
+    prettyTokens
+  , prettyToken
+  ) where
+
+import Data.List qualified as List
+import Data.Text qualified as Text
+import GHC.Show (showSpace)
+
+import Clang.HighLevel.Types (Token (tokenSpelling),
+                              TokenSpelling (getTokenSpelling))
+import Clang.Paths (SourcePath)
+
+{-------------------------------------------------------------------------------
+  Pretty-printing
+-------------------------------------------------------------------------------}
+
+-- | Pretty-print tokens
+--
+-- The implementation prints all tokens in order with a single space in between.
+-- Any whitespace /inside/ tokens will be preserved. Tokens are at its core a
+-- string of characters, so for example if a token has a newline character in
+-- it, then the printed output will preserve that newline character.
+prettyTokens :: [Token SourcePath TokenSpelling] -> ShowS
+prettyTokens tokens =
+      foldr (.) id -- compose all ShowS value
+    $ List.intersperse showSpace
+    $ fmap prettyToken tokens
+
+-- | Pretty-print a token
+--
+-- Any whitespace /inside/ the token will be preserved. Tokens are at its core a
+-- string of characters, so for example if a token has a newline character in
+-- it, then the printed output will preserve that newline character.
+prettyToken :: Token SourcePath TokenSpelling -> ShowS
+prettyToken token = showString $ Text.unpack token.tokenSpelling.getTokenSpelling
diff --git a/src-internal/HsBindgen/Config.hs b/src-internal/HsBindgen/Config.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Config.hs
@@ -0,0 +1,118 @@
+-- | Configuration of @hs-bindgen@.
+module HsBindgen.Config (
+    Config_(..)
+  , UniqueId(..)
+  , BaseModuleName(..)
+  , BackendConfig(..)
+  , FieldNamingStrategy(..)
+  , QualifiedStyle(..)
+  , ModuleRenderConfig(..)
+  , toBindgenConfig
+    -- * Template Haskell
+  , ConfigTH(..)
+  )
+where
+
+import HsBindgen.Backend.Category
+import HsBindgen.BindingSpec
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Pass.Parse.IsPass (EmptyMacros)
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+import Doxygen.Parser (defaultConfig)
+
+{-------------------------------------------------------------------------------
+  Common
+-------------------------------------------------------------------------------}
+
+-- NOTE: Stable public API.
+
+-- | User-provided configuration shared between client commands and
+--   Template-Haskell mode
+data Config_ path = Config {
+    -- * Boot
+    clang       :: ClangArgsConfig path
+  , bindingSpec :: BindingSpecConfig
+
+    -- * Frontend
+  , selectionPredicate  :: Boolean SelectionPredicate
+  , programSlicing      :: ProgramSlicing
+  , fieldNamingStrategy :: FieldNamingStrategy
+  , emptyMacros         :: EmptyMacros
+
+  }
+  deriving stock (Eq, Show, Generic)
+  deriving stock (Functor, Foldable, Traversable)
+  deriving anyclass (Default)
+
+toBindgenConfig ::
+     Config_ FilePath
+  -> UniqueId
+  -> BaseModuleName
+  -> ByCategory Choice
+  -> BindgenConfig
+toBindgenConfig config uniqueId baseModuleName choice =
+  BindgenConfig{
+      boot = BootConfig {
+          clangArgs   = config.clang
+        , baseModule  = baseModuleName
+        , bindingSpec = config.bindingSpec
+        }
+    , frontend = FrontendConfig {
+          selectionPredicate  = config.selectionPredicate
+        , programSlicing      = config.programSlicing
+        , fieldNamingStrategy = config.fieldNamingStrategy
+        , emptyMacros         = config.emptyMacros
+        , doxygenConfig       = defaultConfig
+        }
+    , backend = BackendConfig {
+          uniqueId       = uniqueId
+        , categoryChoice = choice
+       }
+    }
+
+{-------------------------------------------------------------------------------
+  Template Haskell
+-------------------------------------------------------------------------------}
+
+-- NOTE: Stable public API.
+
+-- | Configuration specific to Template-Haskell mode
+data ConfigTH = ConfigTH {
+    -- | Some identifiers (e.g., identifiers of @safe@ and @unsafe@ foreign
+    -- imports) are identical, so we have to choose which ones to generate
+    -- bindings for.
+    --
+    -- We can also include all declarations, carefully renaming identifiers to
+    -- avoid name clashes.
+    --
+    -- Default: 'Category.useSafe'.
+    categoryChoice :: ByCategory Choice
+
+    -- | Show trace messages of the provided 'Level' or higher.
+    --
+    -- Default:
+    --
+    -- >>> def :: Verbosity
+    -- Notice
+  , verbosity :: Verbosity
+
+    -- | Custom log level settings
+    --
+    -- For example, use 'EnableMacroWarnings' to warn on macro parse/reparse
+    -- errors.
+  , customLogLevels :: [CustomLogLevelSetting]
+  }
+  deriving stock (Generic)
+
+instance Default ConfigTH where
+  def = ConfigTH{
+        categoryChoice  = useSafeCategory
+      , verbosity       = def
+      , customLogLevels = []
+      }
diff --git a/src-internal/HsBindgen/Config/ClangArgs.hs b/src-internal/HsBindgen/Config/ClangArgs.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Config/ClangArgs.hs
@@ -0,0 +1,107 @@
+module HsBindgen.Config.ClangArgs (
+    -- * Types
+    ClangArgsConfig(..)
+    -- ** Builtin include directory
+  , BuiltinIncDirConfig(..)
+    -- * Translation
+  , InvalidClangArgs
+  , clangArgsConfigToClangArgs
+  ) where
+
+import Clang.Args
+import Clang.Discover
+
+import HsBindgen.Imports
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+-- | Configuration of @libclang@ command-line arguments
+--
+-- t'ClangArgsConfig' is not intended to be complete; instead, we have added
+-- configuration options most relevant to @hs-bindgen@. Pass other
+-- configurations options directly using command line arguments ('argsBefore',
+-- 'argsInner', and 'argsAfter').
+--
+-- Configuration of the C standard must be done via one of these options.
+-- @hs-bindgen@ queries @libclang@ to get the C standard.
+data ClangArgsConfig path = ClangArgsConfig {
+      -- | Builtin include directory configuration
+      builtinIncDir :: BuiltinIncDirConfig
+
+      -- | Directories that will be added to the include search path
+      --
+      -- This corresponds to the [@-I@ Clang
+      -- argument](https://clang.llvm.org/docs/ClangCommandLineReference.html#include-path-management).
+    , extraIncludeDirs :: [path]
+
+      -- | Enable block support
+      --
+      -- Running code that uses blocks will need the blocks runtime. This is not
+      -- always installed with Clang; for example, on Ubuntu this is a separate
+      -- package @libblocksruntime-dev@. This package also provides the
+      -- @Block.h@ header.
+    , enableBlocks :: Bool
+
+      -- | Arguments to prepend when calling @libclang@
+      --
+      -- See 'argsInner'.
+    , argsBefore :: [String]
+
+      -- | Arguments passed to @libclang@
+      --
+      -- Complete list of arguments passed to @libclang@:
+      --
+      -- @
+      -- concat [
+      --     'argsBefore'
+      --   ,  argsInternal  -- other ClangArgsConfig options
+      --   , 'argsInner'
+      --   ,  argsExtra     -- BINDGEN_EXTRA_CLANG_ARGS
+      --   , 'argsAfter'
+      --   ,  argsBuiltin   -- builtin include directory
+      --   ]
+      -- @
+      --
+      -- See the [Clang command line
+      -- reference](https://clang.llvm.org/docs/ClangCommandLineReference.html).
+    , argsInner :: [String]
+
+      -- | Arguments to append when calling @libclang@
+      --
+      -- See 'argsInner'.
+    , argsAfter :: [String]
+    }
+  deriving stock (Show, Eq, Generic, Functor, Foldable, Traversable)
+
+instance Default (ClangArgsConfig path) where
+ def = ClangArgsConfig {
+      builtinIncDir    = BuiltinIncDirClang
+    , extraIncludeDirs = []
+    , enableBlocks     = False
+    , argsBefore       = []
+    , argsInner        = []
+    , argsAfter        = []
+    }
+
+{-------------------------------------------------------------------------------
+  Translation
+-------------------------------------------------------------------------------}
+
+clangArgsConfigToClangArgs :: ClangArgsConfig FilePath -> ClangArgs
+clangArgsConfigToClangArgs config = ClangArgs $ concat [
+      config.argsBefore
+    , argsInternal
+    , config.argsInner
+    , config.argsAfter
+    ]
+  where
+    argsInternal :: [String]
+    argsInternal = concat [
+        concat [
+            ["-I", path]
+          | path <- config.extraIncludeDirs
+          ]
+      , [ "-fblocks" | config.enableBlocks ]
+      ]
diff --git a/src-internal/HsBindgen/Config/Internal.hs b/src-internal/HsBindgen/Config/Internal.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Config/Internal.hs
@@ -0,0 +1,120 @@
+module HsBindgen.Config.Internal (
+    -- * Bindgen
+    BindgenConfig (..)
+    -- * Boot
+  , BootConfig (..)
+    -- * Frontend
+  , FrontendConfig (..)
+    -- * Backend
+  , BackendConfig (..)
+  , BackendConfigMsg (..)
+  , checkBackendConfig
+    -- * Re-exports
+  , module HsBindgen.Config.Prelims
+  ) where
+
+import HsBindgen.Backend.Category
+import HsBindgen.BindingSpec
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Config.Prelims
+import HsBindgen.Frontend.Pass.Parse.IsPass (EmptyMacros)
+import HsBindgen.Frontend.Pass.Select.IsPass (ProgramSlicing)
+import HsBindgen.Frontend.Predicate (Boolean, SelectionPredicate)
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+import Doxygen.Parser qualified as Doxygen
+
+-- | Configuration of @hs-bindgen@.
+--
+-- t'BindgenConfig' combines all configurable settings of @hs-bindgen@ that are
+-- necessary in all modes (CLI and Template Haskell).
+--
+-- Configuration types determine the "how", not the "what". For example,
+-- it should state how we process a header file, but not state which headers we
+-- want to process.
+--
+-- Configuration types should contain user-provided data, not
+-- @hs-bindgen@-provided data. @hs-bindgen@ provides data in the form of
+-- artefacts.
+--
+-- These t'BindgenConfig' options are provided /once/ (i.e., the function
+-- 'HsBindgen.hsBindgen' runs once). This is, for example, the C standard. In
+-- contrast, configuration of external artifacts that may change even for the
+-- same @hsBindgen@ run, should be directly provided to these external
+-- artifacts. This is, for example, the output file path of the generated
+-- bindings.
+data BindgenConfig = BindgenConfig {
+      boot     :: BootConfig
+    , frontend :: FrontendConfig
+    , backend  :: BackendConfig
+    }
+  deriving stock (Show, Generic)
+  deriving anyclass (Default)
+
+{-------------------------------------------------------------------------------
+  Boot configuration
+-------------------------------------------------------------------------------}
+
+data BootConfig = BootConfig {
+      clangArgs   :: ClangArgsConfig FilePath
+    , baseModule  :: BaseModuleName
+    , bindingSpec :: BindingSpecConfig
+    }
+  deriving stock (Show, Eq, Generic)
+
+instance Default BootConfig where
+  def = BootConfig {
+        clangArgs   = def
+      , baseModule  = def
+      , bindingSpec = def
+      }
+
+{-------------------------------------------------------------------------------
+  Frontend configuration
+-------------------------------------------------------------------------------}
+
+-- | Configuration of frontend of @hs-bindgen@.
+--
+-- The frontend parses the C code and reifies the C declarations.
+data FrontendConfig = FrontendConfig {
+      selectionPredicate  :: Boolean SelectionPredicate
+    , programSlicing      :: ProgramSlicing
+    , fieldNamingStrategy :: FieldNamingStrategy
+    , emptyMacros         :: EmptyMacros
+    , doxygenConfig       :: Doxygen.Config
+    }
+  deriving stock (Show, Eq, Generic)
+
+instance Default FrontendConfig where
+  def = FrontendConfig {
+      selectionPredicate  = def
+    , programSlicing      = def
+    , fieldNamingStrategy = def
+    , emptyMacros         = def
+    , doxygenConfig       = Doxygen.defaultConfig
+    }
+
+{-------------------------------------------------------------------------------
+  Backend configuration
+-------------------------------------------------------------------------------}
+
+-- | Configuration of backend of @hs-bindgen@.
+--
+-- The backend translates the reified C declarations to Haskell declarations.
+data BackendConfig = BackendConfig {
+      uniqueId            :: UniqueId
+    , categoryChoice      :: ByCategory Choice
+    }
+  deriving stock (Show, Generic)
+  deriving anyclass Default
+
+checkBackendConfig :: Tracer BackendConfigMsg -> BackendConfig -> IO ()
+checkBackendConfig tracer backendConfig =
+    checkUniqueId
+      (contramap BackendConfigUniqueId tracer)
+      backendConfig.uniqueId
+
+data BackendConfigMsg = BackendConfigUniqueId UniqueIdMsg
+  deriving stock (Show, Generic)
+  deriving anyclass (PrettyForTrace, IsTrace Level)
diff --git a/src-internal/HsBindgen/Config/MangleCandidate.hs b/src-internal/HsBindgen/Config/MangleCandidate.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Config/MangleCandidate.hs
@@ -0,0 +1,374 @@
+module HsBindgen.Config.MangleCandidate (
+    -- * Definition
+    MangleCandidate(..)
+  , mangleCandidate
+  , mangleCandidateDefaultFallback
+    -- * Parse
+  , ParseCandidateError(..)
+  , parseCandidate
+    -- * Standard instances
+  , mangleCandidateDefault
+  , mangleCandidateHaskell
+    -- * Constructing new instances
+    -- ** Dealing with invalid characters
+  , dropInvalidChar
+  , escapeInvalidChar
+    -- ** Name rule sets
+  , NameRuleSet(..)
+  , NamespaceRuleSet
+  , SNameRuleSet(..)
+  , singNameRuleSet
+  , modifyFirstLetter
+  , prefixInvalidFirst
+  , dropInvalidFirst
+    -- ** Reserved names
+  , appendSingleQuote
+  ) where
+
+import Control.Monad
+import Data.Char qualified as Char
+import Data.Proxy
+import Data.Set qualified as Set
+import Data.Text qualified as Text
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Config.MangleCandidate.ReservedNames (ReservedNames,
+                                                       allReservedNames,
+                                                       reservedNamesIn)
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Util.Tracer
+
+import Numeric (showHex)
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Mangle candidate name to conform to Haskell's naming rules
+--
+-- Name generation is allowed to fail (depending on the policy, there are
+-- circumstances in which we cannot generate a name). When this happens, we
+-- require a name override.
+data MangleCandidate m = MangleCandidate {
+      -- | Process invalid characters
+      --
+      -- Called on characters that are invalid anywhere in a Haskell identifier.
+      --
+      -- See 'dropInvalidChar' and 'escapeInvalidChar'.
+      onInvalidChar :: Char -> m String
+
+      -- | Make the name conform to the name rule set
+      --
+      --See 'modifyFirstLetter'
+    , apply :: ApplyRuleset m
+
+      -- | Reserved names
+    , reservedNames :: ReservedNames
+
+      -- | How to modify reserved names
+      --
+      -- The transformation function must return a valid Haskell name.
+      --
+      -- See 'appendSingleQuote'.
+    , onReservedName :: Text -> Text
+    }
+
+newtype ApplyRuleset m = ApplyRuleset(
+      forall ns. Hs.SingNamespace ns => Text -> m (Hs.Name ns)
+    )
+
+applyRuleset ::
+     Hs.SingNamespace ns
+  => ApplyRuleset m -> Text -> m (Hs.Name ns)
+applyRuleset (ApplyRuleset f) = f
+
+deriving stock instance Generic (MangleCandidate m)
+
+{-------------------------------------------------------------------------------
+  Instances
+-------------------------------------------------------------------------------}
+
+mangleCandidateDefault :: MangleCandidate Maybe
+mangleCandidateDefault = MangleCandidate {
+      onInvalidChar  = return . escapeInvalidChar
+    , apply          = ApplyRuleset $
+                         modifyFirstLetter (Just . prefixInvalidFirst "C" "c")
+    , reservedNames  = allReservedNames
+    , onReservedName = appendSingleQuote
+    }
+
+mangleCandidateHaskell :: MangleCandidate Maybe
+mangleCandidateHaskell = mangleCandidateDefault {
+      onInvalidChar = return . dropInvalidChar
+    , apply         = ApplyRuleset $ modifyFirstLetter dropInvalidFirst
+    }
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+-- | Translate C name to Haskell name, observing Haskell naming conventions
+--
+-- If the C name is already a valid Haskell name for its namespace, it must be
+-- preserved, provided it is not a reserved name (idempotent modulo reserved
+-- names).
+mangleCandidate :: forall ns m.
+     (Monad m, Hs.SingNamespace ns)
+  => MangleCandidate m -> Text -> m (Hs.Name ns)
+mangleCandidate mc =
+        pure . handleReservedNames
+    <=< applyRuleset mc.apply
+    <=< processInvalidChars
+  where
+    processInvalidChars :: Text -> m Text
+    processInvalidChars = fmap Text.pack . go [] . Text.unpack
+      where
+        go :: [String] -> String -> m String
+        go acc (c:cs)
+          | isValidChar c = go ([c] : acc) cs
+          | otherwise     = mc.onInvalidChar c >>= \c' -> go (c':acc) cs
+        go acc []         = return $ concat (reverse acc)
+
+        -- NOTE: @isAlphaNum@ is @True@ for non-ASCII characters too (e.g. '你')
+        -- NOTE: C names cannot include single quotes, but they can arise when
+        -- we define one class of name (say, a data constructor) from the name
+        -- that we generate for another (say, the data type).
+        isValidChar :: Char -> Bool
+        isValidChar c = Char.isAlphaNum c || c == '_' || c == '\''
+
+    handleReservedNames :: Hs.Name ns -> Hs.Name ns
+    handleReservedNames name
+      | name.text `Set.member` reservedNamesIn namespace mc.reservedNames
+      = Hs.UnsafeName $ mc.onReservedName name.text
+      | otherwise
+      = name
+
+    namespace :: Hs.Namespace
+    namespace = Hs.namespaceOf (Hs.singNamespace @ns)
+
+-- | Mangle a candidate
+--
+-- Use the default configuration 'mangleCandidateDefault'.
+--
+-- If mangling fails, return the @fallback@ value.
+mangleCandidateDefaultFallback ::
+     forall ns. Hs.SingNamespace ns
+  => Hs.Name ns -> Text -> Hs.Name ns
+mangleCandidateDefaultFallback fallback candidate =
+  case mangleCandidate mangleCandidateDefault candidate of
+    Nothing   -> fallback
+    Just name -> name
+
+{-------------------------------------------------------------------------------
+  Parse
+-------------------------------------------------------------------------------}
+
+data ParseCandidateError =
+  ParseNameMismatch Text Hs.SomeName
+  deriving stock (Show, Eq, Ord)
+
+instance PrettyForTrace ParseCandidateError where
+  prettyForTrace = \case
+    ParseNameMismatch candidate name -> PP.hcat [
+        "Mismatch of candidate ("
+      , PP.text candidate
+      , ") and name ("
+      , PP.text name.text
+      , "; namespace "
+      , prettyForTrace name.ns
+      , ")"
+      ]
+
+-- | Parse a candidate and check if it adheres to the naming rules.
+parseCandidate :: forall ns m.
+     (Monad m, Hs.SingNamespace ns)
+  => MangleCandidate m
+  -> Text
+  -> m (Either ParseCandidateError (Hs.Name ns))
+parseCandidate mc candidate = do
+    -- 'mangleCandidate' is idempotent, so applying the transformation again
+    -- must yield the same identifier.
+    name <- mangleCandidate @ns mc candidate
+    pure $
+      if candidate == name.text; then
+        Right name
+      else
+        Left $ ParseNameMismatch candidate (Hs.demoteNs name)
+
+{-------------------------------------------------------------------------------
+  Dealing with invalid characters
+-------------------------------------------------------------------------------}
+
+-- | Drop invalid characters
+dropInvalidChar :: Char -> String
+dropInvalidChar = const ""
+
+-- | Escape invalid characters
+--
+-- An invalid character transformed to a single quote (@'@) followed by the
+-- Unicode code point (four lowercase hex digits).
+escapeInvalidChar :: Char -> String
+escapeInvalidChar c =
+    let hex = showHex (Char.ord c) ""
+    in  '\'' : replicate (max 0 (4 - length hex)) '0' ++ hex
+
+{-------------------------------------------------------------------------------
+  Name rule sets
+-------------------------------------------------------------------------------}
+
+data NameRuleSet =
+    -- | Variables and type variables
+    NameRuleSetVar
+
+    -- | Constructors, type constructors, type classes and module names
+  | NameRuleSetOther
+
+type family NamespaceRuleSet (ns :: Hs.Namespace) :: NameRuleSet where
+  NamespaceRuleSet Hs.NsTypeConstr = NameRuleSetOther
+  NamespaceRuleSet Hs.NsConstr     = NameRuleSetOther
+  NamespaceRuleSet Hs.NsVar        = NameRuleSetVar
+
+data SNameRuleSet :: NameRuleSet -> Star where
+  SNameRuleSetVar   :: SNameRuleSet NameRuleSetVar
+  SNameRuleSetOther :: SNameRuleSet NameRuleSetOther
+
+singNameRuleSet :: forall ns.
+     Hs.SingNamespace ns
+  => Proxy ns -> SNameRuleSet (NamespaceRuleSet ns)
+singNameRuleSet _ =
+    case Hs.singNamespace @ns of
+      Hs.SNsTypeConstr -> SNameRuleSetOther
+      Hs.SNsConstr     -> SNameRuleSetOther
+      Hs.SNsVar        -> SNameRuleSetVar
+
+{-------------------------------------------------------------------------------
+  Applying name rule sets
+-------------------------------------------------------------------------------}
+
+data CannotApplyRuleset ns = CannotApplyRuleset{
+      -- | The ruleset we failed to apply
+      ruleset :: SNameRuleSet (NamespaceRuleSet ns)
+
+      -- | The prefix we cannot handle
+      --
+      -- This contains characters for which 'Data.Char.toUpper' to 'Data.Char.toLower' is
+      -- insufficient to enforce the ruleset.
+    , unhandledPrefix :: Text
+
+      -- | The remainder of the name
+      --
+      -- The rest of the name, after the unhandled prefix, if any; we single out
+      -- the first character, both as it appears in the original name as well as
+      -- (potentially) modified to adhere to the ruleset (or unmodified if the
+      -- remainder happens to already adhere to the rule).
+    , usableSuffix :: Maybe (Char, Char, Text)
+    }
+
+-- | Make first letter conform the name rule set
+--
+-- Haskell identifiers have different rules for the first character and the rest
+-- of the identifier. In particular, names in 'NameRuleSetOther' must start with
+-- an uppercase letter, whereas names in 'NameRuleSetVar' must start with a
+-- not-uppercase letter. This is not the same as a lowercase letter!
+--
+-- > isAlphaNum '事' == True
+-- > isUpper    '事' == False
+-- > isLower    '事' == False
+--
+-- To ensure that this rule is satisfied, we
+--
+-- 1. First check if the rule is already satisfied; if so, nothing to do.
+--
+-- 2. If the rule is not satisfied, we attempt to change the first character
+--    to uppercase or lowercase, as appropriate. If this succeeds, we are done.
+--
+-- 3. Step (2) may fail; for example;
+--
+--    > toUpper '_' == '_'
+--    > toUpper '事' == '事'
+--
+--    When this happens, we call the supplied function with the unusable prefix
+--    and the remainder of the identifier.
+modifyFirstLetter :: forall ns.
+     Hs.SingNamespace ns
+  => (CannotApplyRuleset ns -> Maybe (Hs.Name ns))
+     -- ^ @onInvalidFirst@ (see 'prefixInvalidFirst' and 'dropInvalidFirst')
+  -> Text -> Maybe (Hs.Name ns)
+modifyFirstLetter onInvalidFirst =
+    aux (singNameRuleSet (Proxy @ns))
+  where
+    aux :: SNameRuleSet (NamespaceRuleSet ns) -> Text -> Maybe (Hs.Name ns)
+    aux ruleset = \t -> do
+        (firstChar, rest) <- Text.uncons t
+        if | matchesRule firstChar ->
+               Just . Hs.UnsafeName $
+                 Text.cons firstChar rest
+           | matchesRule (adjustForRule firstChar) ->
+               Just . Hs.UnsafeName $
+                 Text.cons (adjustForRule firstChar) rest
+           | otherwise -> do
+               let unhandled, afterUnhandled :: Text
+                   (unhandled, afterUnhandled) = Text.span unusable t
+
+                   usable :: Maybe (Char, Char, Text)
+                   usable =
+                       (\(c, cs) -> if matchesRule c
+                                      then (c, c, cs)
+                                      else (c, adjustForRule c, cs)
+                       ) <$>
+                          Text.uncons afterUnhandled
+
+                   cannotApply :: CannotApplyRuleset ns
+                   cannotApply = CannotApplyRuleset{
+                         ruleset         = ruleset
+                       , unhandledPrefix = unhandled
+                       , usableSuffix    = usable
+                       }
+               onInvalidFirst cannotApply
+      where
+        matchesRule   :: Char -> Bool
+        adjustForRule :: Char -> Char
+        (matchesRule, adjustForRule) =
+            case ruleset of
+              SNameRuleSetVar   -> (not . Char.isUpper , Char.toLower)
+              SNameRuleSetOther -> (      Char.isUpper , Char.toUpper)
+
+        unusable :: Char -> Bool
+        unusable c =
+               not (matchesRule                 $ c)
+            && not (matchesRule . adjustForRule $ c)
+
+prefixInvalidFirst ::
+     Text  -- ^ Prefix for 'SNameRuleSetOther'
+  -> Text  -- ^ Prefix for 'SNameRuleSetVar' (rarely needed)
+  -> CannotApplyRuleset ns -> Hs.Name ns
+prefixInvalidFirst prefixOther prefixVar cannotApply =
+     let prefix :: Text
+         prefix = case cannotApply.ruleset of
+               SNameRuleSetOther -> prefixOther
+               SNameRuleSetVar   -> prefixVar
+     in Hs.UnsafeName $ mconcat [
+            prefix
+          , cannotApply.unhandledPrefix
+          , aux cannotApply.usableSuffix
+          ]
+  where
+    aux :: Maybe (Char, Char, Text) -> Text
+    aux Nothing           = ""
+    aux (Just (_, c, cs)) = Text.cons c cs
+
+dropInvalidFirst :: CannotApplyRuleset ns -> Maybe (Hs.Name ns)
+dropInvalidFirst cannotApply =
+    aux <$> cannotApply.usableSuffix
+  where
+    aux :: (Char, Char, Text) -> Hs.Name ns
+    aux (_, c, cs) = Hs.UnsafeName $ Text.cons c cs
+
+{-------------------------------------------------------------------------------
+  Reserved names
+-------------------------------------------------------------------------------}
+
+-- | Append a single quote (@'@) to a name
+appendSingleQuote :: Text -> Text
+appendSingleQuote = (<> "'")
diff --git a/src-internal/HsBindgen/Config/MangleCandidate/ReservedNames.hs b/src-internal/HsBindgen/Config/MangleCandidate/ReservedNames.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Config/MangleCandidate/ReservedNames.hs
@@ -0,0 +1,194 @@
+module HsBindgen.Config.MangleCandidate.ReservedNames (
+    -- $ReservedNames
+    ReservedNames(..)
+  , reservedNamesIn
+  , allReservedNames
+  , haskellKeywords
+  , ghcExtensionKeywords
+  , ghcNonReservedKeywords
+  , hsBindgenReservedNames
+  , sanityReservedNames
+  ) where
+
+import Data.Set qualified as Set
+import GHC.Generics (Generically (..))
+import Optics.Core (Lens')
+
+import HsBindgen.Backend.Global (preludeNames)
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Reserved Names
+-------------------------------------------------------------------------------}
+
+{- $ReservedNames
+
+This module defines various sets of reserved names that are used by the default
+name manglers.
+
+Users who create their own name manglers must consider the names that may be
+created.  For example, the default name manglers prefix types with @C@, so name
+@CInt@ is reserved to avoid confusion if C code defines an @Int@ type, while
+name @Int@ does not need to be reserved because the default name manglers will
+never create that name.  These sets are exported for convenience, but it is the
+responsibility of users who create their own name manglers to reserve names to
+work with the implementation of their name manglers.
+
+-}
+
+-- | Reserved names, per namespace
+data ReservedNames = ReservedNames {
+      typeConstr :: Set Text
+    , constr     :: Set Text
+    , var        :: Set Text
+    }
+  deriving stock (Show, Eq, Generic)
+  deriving (Semigroup, Monoid) via Generically ReservedNames
+
+inNamespace :: Hs.Namespace -> Lens' ReservedNames (Set Text)
+inNamespace = \case
+    Hs.NsTypeConstr -> #typeConstr
+    Hs.NsConstr     -> #constr
+    Hs.NsVar        -> #var
+
+reservedNamesIn :: Hs.Namespace -> ReservedNames -> Set Text
+reservedNamesIn ns = view (inNamespace ns)
+
+reserve :: Hs.Namespace -> [Text] -> ReservedNames
+reserve ns names = mempty & inNamespace ns .~ Set.fromList names
+
+allReservedNames :: ReservedNames
+allReservedNames = mconcat [
+      reserve Hs.NsVar haskellKeywords
+    , reserve Hs.NsVar ghcExtensionKeywords
+    , hsBindgenReservedNames
+    , reserve Hs.NsTypeConstr sanityReservedNames
+    , reserve Hs.NsConstr     sanityReservedNames
+    ]
+
+-- | Haskell keywords
+--
+-- * [Source](https://gitlab.haskell.org/ghc/ghc/-/blob/7d42b2df006c50aecfeea6f6a53b9b198f5764bf/compiler/GHC/Parser/Lexer.x#L781-805)
+haskellKeywords :: [Text]
+haskellKeywords =
+    [ "as"
+    , "case"
+    , "class"
+    , "data"
+    , "default"
+    , "deriving"
+    , "do"
+    , "else"
+    , "hiding"
+    , "foreign"
+    , "if"
+    , "import"
+    , "in"
+    , "infix"
+    , "infixl"
+    , "infixr"
+    , "instance"
+    , "let"
+    , "module"
+    , "newtype"
+    , "of"
+    , "qualified"
+    , "then"
+    , "type"
+    , "where"
+    ]
+
+-- | GHC extension keywords
+--
+-- * [Source](https://gitlab.haskell.org/ghc/ghc/-/blob/7d42b2df006c50aecfeea6f6a53b9b198f5764bf/compiler/GHC/Parser/Lexer.x#L807-829)
+-- * [Arrow notation](https://gitlab.haskell.org/ghc/ghc/-/blob/7d42b2df006c50aecfeea6f6a53b9b198f5764bf/compiler/GHC/Parser/Lexer.x#L964-966)
+-- * [cases](https://gitlab.haskell.org/ghc/ghc/-/blob/7d42b2df006c50aecfeea6f6a53b9b198f5764bf/compiler/GHC/Parser/Lexer.x#L871)
+-- * [role](https://gitlab.haskell.org/ghc/ghc/-/issues/18941)
+--
+-- Some keywords are context specific and are valid Haskell identifiers netvertheless.
+-- We list them but have commented out.
+ghcExtensionKeywords :: [Text]
+ghcExtensionKeywords = [
+      "by"
+    , "forall"
+    , "mdo"
+    , "pattern"
+    , "proc"
+    , "rec"
+    , "static"
+    , "using"
+    ]
+
+-- | Keywords that /can/ be used as identifiers
+--
+-- By default the name mangler leaves these alone, because their usage is in
+-- principle unproblematic. However, you may wish to add these to the list of
+-- reserved names to avoid confusion.
+ghcNonReservedKeywords :: [Text]
+ghcNonReservedKeywords = [
+      "anyclass"
+    , "capi"
+    , "cases"
+    , "ccall"
+    , "dynamic"
+    , "export"
+    , "family"
+    , "group"
+    , "interruptible"
+    , "javascript"
+    , "label"
+    , "prim"
+    , "role"
+    , "safe"
+    , "stdcall"
+    , "stock"
+    , "unsafe"
+    , "via"
+    ]
+
+-- | Names that @hs-bindgen@ uses unqualified, each in its namespace
+--
+-- These are the names generated modules import from the "Prelude"; see
+-- 'preludeNames'. Operators such as @~@ are included, though they are not
+-- valid C identifiers.
+hsBindgenReservedNames :: ReservedNames
+hsBindgenReservedNames =
+    foldMap (\name -> reserve name.ns [name.text]) preludeNames
+
+-- | Names of types and their constructors that are reserved because using them
+-- could cause confusion
+--
+-- * "Foreign.C.Types"
+sanityReservedNames :: [Text]
+sanityReservedNames =
+    [ "CBool"
+    , "CChar"
+    , "CClock"
+    , "CDouble"
+    , "CFile"
+    , "CFloat"
+    , "CFpos"
+    , "CInt"
+    , "CIntMax"
+    , "CIntPtr"
+    , "CJmpBuf"
+    , "CLLong"
+    , "CLong"
+    , "CPtrdiff"
+    , "CSChar"
+    , "CSUSeconds"
+    , "CShort"
+    , "CSigAtomic"
+    , "CSize"
+    , "CTime"
+    , "CUChar"
+    , "CUInt"
+    , "CUIntMax"
+    , "CUIntPtr"
+    , "CULLong"
+    , "CULong"
+    , "CUSeconds"
+    , "CUShort"
+    , "CWchar"
+    ]
diff --git a/src-internal/HsBindgen/Config/Prelims.hs b/src-internal/HsBindgen/Config/Prelims.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Config/Prelims.hs
@@ -0,0 +1,157 @@
+module HsBindgen.Config.Prelims (
+    -- * Base module name
+    BaseModuleName(..)
+  , baseModuleNameToString
+  , fromBaseModuleName
+
+    -- * Field naming strategy
+  , FieldNamingStrategy(..)
+
+    -- * Qualified style
+  , QualifiedStyle(..)
+
+    -- * Module render config
+  , ModuleRenderConfig(..)
+
+    -- * Unique IDs
+  , UniqueId (..)
+  , UniqueIdMsg (..)
+  , checkUniqueId
+  ) where
+
+import Data.Text qualified as Text
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Backend.Category
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Base module name
+-------------------------------------------------------------------------------}
+
+-- | Base module name from which other module names are derived
+--
+-- For example, the base module name might be @Generated@, from which we
+-- derive @Generated@, @Generated.Safe@, etc.
+newtype BaseModuleName = BaseModuleName { text :: Text }
+  deriving stock (Eq, Generic)
+  deriving newtype (IsString, Show)
+
+instance Default BaseModuleName where
+  def = "Generated"
+
+baseModuleNameToString :: BaseModuleName -> String
+baseModuleNameToString baseModule = Text.unpack baseModule.text
+
+fromBaseModuleName :: BaseModuleName -> Maybe Category -> Hs.ModuleName
+fromBaseModuleName (BaseModuleName base) Nothing =
+    Hs.ModuleName base
+fromBaseModuleName (BaseModuleName base) (Just CType) =
+    Hs.ModuleName base
+fromBaseModuleName (BaseModuleName base) (Just (CTerm cat)) =
+    Hs.ModuleName (base <> "." <> submodule cat)
+  where
+    -- NOTE: It is important that types are stored in a module without any
+    -- suffix; we depend on this assumption for binding specifications (which
+    -- only refer to types, never to functions or globals).
+    submodule :: TermCategory -> Text
+    submodule CSafe   = "Safe"
+    submodule CUnsafe = "Unsafe"
+    submodule CFunPtr = "FunPtr"
+    submodule CGlobal = "Global"
+
+{-------------------------------------------------------------------------------
+  Field naming strategy
+-------------------------------------------------------------------------------}
+
+-- | Strategy for naming struct\/union fields.
+--
+-- With 'AddFieldPrefixes' (the default), field names are prefixed with the
+-- struct name to avoid name collisions (e.g., @timeval_tv_sec@).
+--
+-- With 'OmitFieldPrefixes', field names are not prefixed (e.g., @tv_sec@). This
+-- usually necessitates the @DuplicateRecordFields@ GHC extension, which is
+-- automatically added when this strategy is selected.
+data FieldNamingStrategy =
+    AddFieldPrefixes
+  | OmitFieldPrefixes
+  deriving stock (Show, Eq, Generic)
+
+instance Default FieldNamingStrategy where
+  def = AddFieldPrefixes
+
+{-------------------------------------------------------------------------------
+  Qualified style
+-------------------------------------------------------------------------------}
+
+-- | Style for qualified imports in generated code.
+--
+-- With 'PreQualified' (the default), imports are prepositive:
+-- @import qualified Data.Proxy@.
+--
+-- With 'PostQualified', imports use the @ImportQualifiedPost@ extension:
+-- @import Data.Proxy qualified@. This avoids warnings from
+-- @-Wprepositive-qualified-module@.
+data QualifiedStyle =
+    PreQualified
+  | PostQualified
+  deriving stock (Show, Eq, Generic)
+
+instance Default QualifiedStyle where
+  def = PreQualified
+
+{-------------------------------------------------------------------------------
+  Module render config
+-------------------------------------------------------------------------------}
+
+-- | Configuration for rendering Haskell modules.
+--
+-- Bundles settings that affect the surface syntax of generated modules but
+-- do not change semantics.
+data ModuleRenderConfig = ModuleRenderConfig {
+      qualifiedStyle :: QualifiedStyle
+    }
+  deriving stock (Show, Eq, Generic)
+  deriving anyclass (Default)
+
+{-------------------------------------------------------------------------------
+  Unique IDs
+-------------------------------------------------------------------------------}
+
+-- | C uses a global namespace. We must ensure that identifiers generated by
+-- @hs-bindgen@ are unique.
+--
+-- Defaults to the empty string @t'UniqueId' ""@, which is __suboptimal__. We
+-- encourage using unique identifiers such as
+-- "com.well-typed.your-package-name".
+data UniqueId = UniqueId { unUniqueId :: String }
+  deriving stock (Show, Eq, Ord)
+
+instance Default UniqueId where
+  def = UniqueId ""
+
+data UniqueIdMsg =
+    UniqueIdEmpty
+  deriving (Show, Eq, Ord)
+
+instance PrettyForTrace UniqueIdMsg where
+  prettyForTrace = \case
+    UniqueIdEmpty -> PP.vcat [
+        "empty unique identifier ('UniqueId', '--unique-id'):"
+      , "  C uses a global namespace."
+      , "  We encourage using a unique identifier to avoid duplicate symbol names."
+      , "  For example, use and adapt 'com.example.package'."
+      ]
+
+instance IsTrace Level UniqueIdMsg where
+  getDefaultLogLevel = \case
+    UniqueIdEmpty     -> Warning
+  getSource  = const HsBindgen
+  getTraceId = const "unique-id"
+
+checkUniqueId :: Tracer UniqueIdMsg -> UniqueId -> IO ()
+checkUniqueId tracer (UniqueId val) = do
+  when (null val) $
+    traceWith tracer $ withCallStack UniqueIdEmpty
diff --git a/src-internal/HsBindgen/Doxygen.hs b/src-internal/HsBindgen/Doxygen.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Doxygen.hs
@@ -0,0 +1,55 @@
+-- | Trace messages for doxygen integration in @hs-bindgen@
+--
+-- This module provides hs-bindgen-specific trace message types
+-- ('DoxygenMsg') with 'PrettyForTrace' and 'IsTrace' instances.
+-- All doxygen-parser types are imported directly from "Doxygen.Parser".
+--
+module HsBindgen.Doxygen (
+    DoxygenMsg(..)
+  ) where
+
+import Data.Text qualified as Text
+import GHC.Generics (Generic)
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Util.Tracer (IsTrace (..), Level, PrettyForTrace (..),
+                              Source (..))
+import HsBindgen.Util.Tracer qualified as Tracer
+
+import Doxygen.Parser (DoxygenException (..))
+import Doxygen.Parser.Warning
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+-- | Trace messages emitted during doxygen invocation
+data DoxygenMsg
+  = DoxygenWarning DoxygenException
+    -- ^ A non-fatal doxygen error (emitted as a warning before falling back
+    -- to empty state)
+  | DoxygenUnsupported Warning
+    -- ^ Structured warning about unsupported or degraded content
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace DoxygenMsg where
+  prettyForTrace = \case
+    DoxygenWarning (DoxygenFailed code stderr) ->
+      PP.string $ "doxygen failed (exit code " ++ show code ++ "): " ++ stderr
+    DoxygenWarning (DoxygenXMLParseError path err) ->
+      PP.string $ "doxygen XML parse error in " ++ path ++ ": " ++ err
+    DoxygenWarning DoxygenNotFound ->
+      PP.string "doxygen not found on PATH; documentation comments will not be generated"
+    DoxygenWarning (DoxygenIOError ioErr) ->
+      PP.string $ "doxygen IO error: " ++ show ioErr
+    DoxygenWarning (DoxygenOutputDirMissing dir) ->
+      PP.string $ "doxygen output directory does not exist: " ++ dir
+    DoxygenUnsupported w ->
+      PP.string $ "unsupported content: " ++ Text.unpack w.explanation
+
+instance IsTrace Level DoxygenMsg where
+  getDefaultLogLevel = \case
+    DoxygenWarning{}    -> Tracer.Warning
+    DoxygenUnsupported{} -> Tracer.Info
+  getSource  = const HsBindgen
+  getTraceId = const "doxygen"
diff --git a/src-internal/HsBindgen/Eff.hs b/src-internal/HsBindgen/Eff.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Eff.hs
@@ -0,0 +1,84 @@
+module HsBindgen.Eff (
+    Eff     -- opaque
+  , Support -- opaque
+  , wrapEff
+  , unwrapEff
+  , runFoldIdentity
+  , runFoldReader
+  , runFoldState
+  ) where
+
+import Control.Monad.Reader (MonadReader, Reader, ReaderT (..))
+import Control.Monad.State (MonadState (state), State)
+import Data.IORef (IORef, atomicModifyIORef, newIORef, readIORef)
+import Data.Tuple (swap)
+
+import HsBindgen.Imports
+
+{-------------------------------------------------------------------------------
+  'Eff' monad
+
+  We work mostly in @IO@, and limited by @MonadUnliftIO@,
+  but sometimes we need more effects: @Eff@ wrapping @ReaderT r IO@
+  pattern can mimic many other monads.
+
+  NOTE: This is intentionally /not/ a member of 'MonadCatch'. We use 'Eff'
+  primarily for folding, and exception handling in folding requires special
+  care. See detailed discussion of 'foldWithHandler' in the @clang@ bindings.
+-------------------------------------------------------------------------------}
+
+newtype Eff m a = Eff (ReaderT (Support m) IO a)
+  deriving newtype (
+      Functor
+    , Applicative
+    , Monad
+    , MonadIO
+    , MonadUnliftIO
+    )
+
+getEff :: Eff m a -> ReaderT (Support m) IO a
+getEff (Eff ma) = ma
+
+wrapEff :: (Support m -> IO a) -> Eff m a
+wrapEff = Eff . ReaderT
+
+unwrapEff :: Eff m a -> Support m -> IO a
+unwrapEff = runReaderT . getEff
+
+-- | 'Control.Monad.Reader.ReaderT' argument required to support @m@
+type family Support (m :: Star -> Star) :: Star
+
+--
+-- 'Identity'
+--
+
+type instance Support Identity = ()
+
+runFoldIdentity :: Eff Identity a -> IO a
+runFoldIdentity = ($ ()) . unwrapEff
+
+--
+-- 'Reader'
+--
+
+type instance Support (Reader r) = r
+
+deriving newtype instance MonadReader r (Eff (Reader r))
+
+runFoldReader :: r -> Eff (Reader r) a -> IO a
+runFoldReader env = ($ env) . unwrapEff
+
+--
+-- 'State'
+--
+
+type instance Support (State s) = IORef s
+
+instance MonadState s (Eff (State s)) where
+  state f = wrapEff $ \ref -> atomicModifyIORef ref (swap . f)
+
+runFoldState :: s -> Eff (State s) a -> IO (a, s)
+runFoldState s f = do
+    ref <- newIORef s
+    a   <- unwrapEff f ref
+    (a,) <$> readIORef ref
diff --git a/src-internal/HsBindgen/Errors.hs b/src-internal/HsBindgen/Errors.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Errors.hs
@@ -0,0 +1,111 @@
+module HsBindgen.Errors (
+    HsBindgenException (..),
+    hsBindgenExceptionToException,
+    hsBindgenExceptionFromException,
+    TODOException (..),
+    throwPure_TODO,
+    throwIO_TODO,
+    PanicException,
+    panicPure,
+    panicIO,
+    pleaseReport,
+    failCode,
+    failQ,
+) where
+
+import Control.Exception (Exception (..), SomeException (..), throw)
+import Data.Typeable (cast)
+import GHC.Stack (CallStack, prettyCallStack)
+import Language.Haskell.TH.Syntax qualified as THS
+
+import HsBindgen.Imports
+
+-------------------------------------------------------------------------------
+-- HsBindgenException
+-------------------------------------------------------------------------------
+
+-- | Superclass for @hs-bindgen@ exceptions
+data HsBindgenException where
+    HsBindgenException :: Exception e => e -> HsBindgenException
+
+instance Show HsBindgenException where
+    showsPrec d (HsBindgenException e) = showsPrec d e
+
+hsBindgenExceptionToException :: Exception e => e -> SomeException
+hsBindgenExceptionToException = toException . HsBindgenException
+
+hsBindgenExceptionFromException :: Exception e => SomeException -> Maybe e
+hsBindgenExceptionFromException x = do
+    HsBindgenException a <- fromException x
+    cast a
+
+instance Exception HsBindgenException where
+    displayException (HsBindgenException e) = displayException e
+
+-------------------------------------------------------------------------------
+-- TODOs
+-------------------------------------------------------------------------------
+
+data TODOException = TODOException !CallStack !Int !String
+  deriving Show
+
+instance Exception TODOException where
+    toException = hsBindgenExceptionToException
+    fromException = hsBindgenExceptionFromException
+    displayException (TODOException cs issue msg) = unlines
+        [ "hs-bindgen known issue: https://github.com/well-typed/hs-bindgen/issues/" ++ show issue
+        , msg
+        , prettyCallStack cs
+        ]
+
+-- | Throw a pure, known TODO exception.
+throwPure_TODO :: HasCallStack => Int -> String -> a
+throwPure_TODO issue msg = throw (TODOException callStack issue msg)
+
+throwIO_TODO :: (HasCallStack, MonadIO m) => Int -> String -> m a
+throwIO_TODO issue msg = liftIO (throwIO (TODOException callStack issue msg))
+
+-------------------------------------------------------------------------------
+-- Panics
+-------------------------------------------------------------------------------
+
+-- | Unexpected (e.g. invariant violation) conditions.
+data PanicException = PanicException !CallStack !String
+  deriving Show
+
+instance Exception PanicException where
+    toException = hsBindgenExceptionToException
+    fromException = hsBindgenExceptionFromException
+    displayException (PanicException cs  msg) = unlines
+        [ "PANIC!: the impossible happened"
+        , pleaseReport
+        , msg
+        , prettyCallStack cs
+        ]
+
+pleaseReport :: String
+pleaseReport = "Please report this as a bug at https://github.com/well-typed/hs-bindgen/issues/"
+
+-- | Panic in pure context
+panicPure :: HasCallStack => String -> a
+panicPure msg = throw (PanicException callStack msg)
+
+-- | Panic in IO
+panicIO :: (HasCallStack, MonadIO m) => String -> m a
+panicIO msg = liftIO (throwIO (PanicException callStack msg))
+
+-------------------------------------------------------------------------------
+-- Template Haskell
+-------------------------------------------------------------------------------
+
+-- | Fail with an error in 'THS.Code'
+--
+-- 'fail' is needed to abort computation with an error in Template Haskell.
+failCode :: MonadFail m => String -> THS.Code m a
+failCode = THS.Code . fail
+
+-- | Fail with an error in 'THS.Q'
+--
+-- 'fail' is needed to abort computation with an error in Template Haskell.
+failQ :: String -> THS.Q a
+failQ = fail
diff --git a/src-internal/HsBindgen/Frontend.hs b/src-internal/HsBindgen/Frontend.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend.hs
@@ -0,0 +1,526 @@
+module HsBindgen.Frontend (
+    runFrontend
+  , FrontendArtefact (..)
+  , FrontendMsg(..)
+  , ParseInfo(..)
+  ) where
+
+
+import Prelude hiding (zip)
+
+import Control.Exception (catch)
+import Data.List.NonEmpty qualified as NE
+import Data.Map.Lazy qualified as Map
+
+import Clang.Enum.Bitfield
+import Clang.LowLevel.Core
+import Clang.Paths
+
+import HsBindgen.Boot
+import HsBindgen.Cache
+import HsBindgen.Clang
+import HsBindgen.Config.Internal
+import HsBindgen.Doxygen
+import HsBindgen.Frontend.Analysis.IncludeGraph (IncludeGraph)
+import HsBindgen.Frontend.Analysis.UnnamedIdUsage (UnnamedIdUsageAnalysis)
+import HsBindgen.Frontend.Analysis.UnnamedIdUsage qualified as UnnamedIdUsageAnalysis
+import HsBindgen.Frontend.Pass.AdjustTypes
+import HsBindgen.Frontend.Pass.AdjustTypes.IsPass
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.EnrichComments
+import HsBindgen.Frontend.Pass.EnrichComments.IsPass
+import HsBindgen.Frontend.Pass.FillUnnamedIds
+import HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Frontend.Pass.MangleNames
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.Parse
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.Parse.Monad.Decl qualified as ParseDecl
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Frontend.Pass.PrepareReparse
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.Select
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Pass.SimplifyAST
+import HsBindgen.Frontend.Pass.SimplifyAST.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes
+import HsBindgen.Frontend.Pass.TranslateTypes.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Frontend.ProcessIncludes
+import HsBindgen.Frontend.RootHeader (RootHeader, RootHeaderMsg)
+import HsBindgen.Frontend.RootHeader qualified as RootHeader
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.Macro.UniqueExpansion qualified as UniqueExpansion
+import HsBindgen.Util.Tracer
+
+import Doxygen.Parser (Doxygen, DoxygenException (..), Result (..),
+                       emptyDoxygen, parse)
+
+-- | Frontend
+--
+-- = Overview of passes
+--
+-- See the documentation of 'HsBindgen.Frontend.Pass.IsPass'.
+--
+-- == 1. "HsBindgen.Frontend.Pass.Parse"
+--
+-- "HsBindgen.Frontend.Pass.Parse" traverses the @libclang@ AST, getting all
+-- information that we need from @libclang@ and constructing a pure Haskell
+-- representation (see "HsBindgen.Frontend.AST.Decl"). It runs in 'IO', to
+-- interface with @libclang@.
+--
+-- Constraints:
+--
+-- * Must be first, to get the declarations from @libclang@
+--
+-- == 2. "HsBindgen.Frontend.Pass.SimplifyAST"
+--
+-- "HsBindgen.Frontend.Pass.SimplifyAST" simplifies the AST by converting
+-- untagged enums without use sites into pattern synonym declarations. For
+-- example, @enum { FOO, BAR }@ is converted into separate pattern synonym
+-- declarations that will later be rendered as Haskell pattern synonyms.
+--
+-- Constraints:
+--
+-- * Must run before "HsBindgen.Frontend.Pass.FillUnnamedIds" because
+--   FillUnnamedIds will delete unnamed declarations without use sites (it
+--   needs a use site to determine a name)."
+--
+-- == 3. "HsBindgen.Frontend.Pass.FillUnnamedIds"
+--
+-- "HsBindgen.Frontend.Pass.FillUnnamedIds" assigns names to all unnamed
+-- declarations, replacing 'HsBindgen.Frontend.Naming.PrelimDeclId' by
+-- 'HsBindgen.Frontend.Naming.DeclId', which is used from this point forward.
+--
+-- Constraints:
+--
+-- * Must be before "HsBindgen.Frontend.Pass.ConstructTranslationUnit" so that
+--   'HsBindgen.Frontend.Naming.DeclId' can be used as the key for the
+--   'DeclIndex.DeclIndex', 'UseDeclGraph.UseDeclGraph', and
+--   'DeclUseGraph.DeclUseGraph'
+-- * Must be before "HsBindgen.Frontend.Pass.ResolveBindingSpecs" so that
+--   binding specifications can use the assigned names
+--
+-- == 4. "HsBindgen.Frontend.Pass.EnrichComments"
+--
+-- "HsBindgen.Frontend.Pass.EnrichComments" enriches parsed declarations with
+-- doxygen comments by looking up each declaration in the 'Doxygen' state.
+--
+-- Constraints:
+--
+-- * Must be after "HsBindgen.Frontend.Pass.FillUnnamedIds" so that
+--   'HsBindgen.Frontend.Naming.DeclId' is available for the 'DeclIndex' and
+--   for building doxygen-qualified names
+--
+-- == 5. "HsBindgen.Frontend.Pass.ConstructTranslationUnit"
+--
+-- "HsBindgen.Frontend.Pass.ConstructTranslationUnit" constructs a list of
+-- sorted declarations as well as 'DeclIndex.DeclIndex',
+-- 'UseDeclGraph.UseDeclGraph', and 'DeclUseGraph.DeclUseGraph'.
+--
+-- Constraints:
+--
+-- * Must be before the rest of the passes because they use these structures and
+--   depend on the ordering of declarations
+--
+-- == 6. "HsBindgen.Frontend.Pass.TypecheckMacros"
+--
+-- "HsBindgen.Frontend.Pass.TypecheckMacros" collects known types and typechecks
+-- all macros. Note that macros may neither refer to nor introduce new unnamed
+-- declarations, so running "HsBindgen.Frontend.Pass.FillUnnamedIds" before
+-- "HsBindgen.Frontend.Pass.TypecheckMacros" is fine.
+--
+-- Constraints:
+--
+-- * Must be before "HsBindgen.Frontend.Pass.ReparseMacroExpansions", because
+--   "HsBindgen.Frontend.Pass.TypecheckMacros" typechecks macro-defined types
+--   that are required to parse declarations with macro expansions.
+--
+-- == 7. "HsBindgen.Frontend.Pass.PrepareReparse"
+--
+-- @PrepareReparse@ prepares declarations that need to be reparsed because they
+-- contain macro invocations. These declarations carry raw tokens intended to be
+-- reparsed later, and the main goal of @PrepareReparse@ is to preprocess the
+-- tokens to expand select macro invocations. If we leave macro invocations
+-- unexpanded, then declarations that contain them will very likely fail to be
+-- reparsed. In particular this is because the reparser expects its input to be
+-- preprocessed. However, we do not expand a macro invocation if its definition
+-- is identified (through parsing and typechecking) as a macro-defined type.
+-- Such definitions are instead treated by the reparser as if they are
+-- references to actual typedefs.
+--
+-- See issue #1225 for examples of how /not/ preprocessing caused problems in
+-- the past:
+--
+-- <https://github.com/well-typed/hs-bindgen/issues/1225>
+--
+-- Constraints:
+--
+-- * Must be after @TypecheckMacros@, because @PrepareReparse@ needs to know
+--   which macro definitions where identified as macro-defined types before we
+--   can decide whether to expand macro invocations.
+--
+-- * Must be before @ReparseMacroExpansions@, because @ReparseMacroExpansions@
+--   expects its reparser input to be preprocessed, which is what
+--   @PrepareReparse@ takes care of.
+--
+-- == 8. "HsBindgen.Frontend.Pass.ReparseMacroExpansions"
+--
+-- "HsBindgen.Frontend.Pass.ReparseMacroExpansions" reparses declarations that
+-- contain macro expansions.
+--
+-- Constraints:
+--
+-- * Must be before "HsBindgen.Frontend.Pass.AdjustTypes", because
+--   "HsBindgen.Frontend.Pass.ReparseMacroExpansions" reparses declarations
+--   referencing macro-defined types that may have to be adjusted.
+--
+-- == 9. "HsBindgen.Frontend.Pass.ResolveBindingSpecs"
+--
+-- "HsBindgen.Frontend.Pass.ResolveBindingSpecs" has two responsibilities:
+--
+-- * It matches declarations/uses with external binding specifications, removing
+--   matching declarations and replacing uses with external references.
+-- * It matches declarations with prescriptive binding specifications, either
+--   omitting them or annotating the declarations with specifications to be used
+--   in later passes.
+--
+-- Constraints:
+--
+-- * Must be before "HsBindgen.Frontend.Pass.Select" because prescriptive
+--   binding specs may omit declarations and external binding specs may remove
+--   declarations, and program slicing must take this into account
+-- * Must be before "HsBindgen.Frontend.Pass.MangleNames" because prescriptive
+--   binding specs may configure typedef squashing, which happens in
+--   MangleNames.
+-- * Must be before "HsBindgen.Frontend.Pass.MangleNames" because prescriptive
+--   binding specs may specify arbitrary names
+--
+-- == 10. "HsBindgen.Frontend.Pass.MangleNames"
+--
+-- "HsBindgen.Frontend.Pass.MangleNames" assigns Haskell names for types,
+-- constructors, fields, etc. It also deals with name clashes that can arise
+-- from typedefs, squashing "unneeded" typedefs.
+--
+-- == 11. "HsBindgen.Frontend.Pass.AdjustTypes"
+--
+-- "HsBindgen.Frontend.Pass.AdjustTypes" adjusts types in declarations. For
+-- example, if a function argument is a function type, then it is adjusted to a
+-- function /pointer/ type.
+--
+-- == 12. "HsBindgen.Frontend.Pass.TranslateTypes"
+--
+-- "HsBindgen.Frontend.Pass.TranslateTypes" translates types (use sites) to
+-- Haskell types.
+--
+-- == 13. "HsBindgen.Frontend.Pass.Select"
+--
+-- "HsBindgen.Frontend.Pass.Select" filters the declarations using predicates
+-- and program slicing. It also emits delayed trace messages for declarations
+-- that are selected.
+--
+-- Constraints:
+--
+-- * The 'Select' pass must come last so that if a declaration is
+--   'HsBindgen.Frontend.Analysis.DeclIndex.UnusableEntry' for whatever reason
+--   (e.g., it contains unsupported types such as @long double@, or the name
+--   mangler was unable to find a suitable name, etc.), the 'Select' pass can
+--   make sure that the unusable declaration /and all of its dependencies/ will
+--   not be selected.
+runFrontend ::
+     forall l. (Macro.HasTypes l, HasCallStack)
+  => Tracer FrontendMsg
+  -> FrontendConfig
+  -> BootArtefact l
+  -> IO (FrontendArtefact l)
+runFrontend tracer config boot = do
+    rootHeaderC <- cache "rootHeader" $ do
+      (msgs, rootHeader) <- RootHeader.fromRootDirectives <$> boot.rootDirectives
+      liftIO $ mapM_ (traceWith tracerRootHeader . withCallStack) msgs
+      pure rootHeader
+
+    parsePass <- cache "parse" $ do
+      setup     <- getSetup =<< rootHeaderC
+      macroLang <- boot.macroLang
+      liftIO $ withClang (contramap FrontendClang tracer) setup $ \unit -> do
+        (includeGraph, isMainHeader, isInMainHeaderDir, getMainHeadersAndInclude, mainHeaderPaths) <-
+          processIncludes unit
+        -- Run doxygen on the resolved main header paths to extract
+        -- structured comments.  The paths come from clang's own include
+        -- resolution (via processIncludes), so no separate path search
+        -- is needed.
+        let resolvedPaths = map getRealPath mainHeaderPaths
+            emptyResult   = Result {
+                doxygen = emptyDoxygen, warnings = [], doxygenVersion = "unknown"
+              }
+        doxyResult <- case NE.nonEmpty resolvedPaths of
+          Nothing -> pure emptyResult
+          Just paths -> parse config.doxygenConfig paths
+            `catch` \(e :: DoxygenException) -> do
+              traceWith tracer $ withCallStack $ FrontendDoxygen $ DoxygenWarning e
+              pure emptyResult
+
+        -- Emit structured warnings for unsupported content
+        forM_ doxyResult.warnings $ \w ->
+          traceWith tracer $ withCallStack $ FrontendDoxygen $ DoxygenUnsupported w
+
+        let parseEnv :: ParseDecl.Env
+            parseEnv = ParseDecl.Env{
+                unit                     = unit
+              , getMainHeadersAndInclude = getMainHeadersAndInclude
+              , emptyMacros              = config.emptyMacros
+              , tracer                   = contramap FrontendParse tracer
+              }
+        (parseResults, macroAnalysis) <- parseDecls macroLang parseEnv
+
+        let decls :: [C.Decl l Parse]
+            decls = mapMaybe getParseResultMaybeDecl parseResults
+            usageAnalysis = UnnamedIdUsageAnalysis.fromDecls decls
+
+        pure $ ParsePassResult {
+            results           = parseResults
+          , doxygen           = doxyResult.doxygen
+          , includeGraph      = includeGraph
+          , isMainHeader      = isMainHeader
+          , isInMainHeaderDir = isInMainHeaderDir
+          , getMainHeaders    = toGetMainHeaders getMainHeadersAndInclude
+          , usageAnalysis     = usageAnalysis
+          , macroAnalysis     = macroAnalysis
+          }
+
+    parseMeta <- cache "parseMeta" $ do
+      afterParse <- parsePass
+      pure ParseInfo {
+        includeGraph   = afterParse.includeGraph
+      , getMainHeaders = afterParse.getMainHeaders
+      }
+
+    simplifyASTPass <- cache "simplifyAST" $ do
+      afterParse <- parsePass
+      let (afterSimplifyAST, msgsSimplifyAST) =
+            simplifyAST afterParse.usageAnalysis afterParse.results
+      forM_ msgsSimplifyAST $ traceWith (contramap FrontendSimplifyAST tracer)
+      pure afterSimplifyAST
+
+    fillUnnamedIdsPass <- cache "fillUnnamedIds" $ do
+      afterParse       <- parsePass
+      afterSimplifyAST <- simplifyASTPass
+      let (afterFillUnnamedIds, msgsFillUnnamedIds) =
+            fillUnnamedIds afterParse.usageAnalysis afterSimplifyAST
+      forM_ msgsFillUnnamedIds $ traceWith (contramap FrontendFillUnnamedIds tracer)
+      pure afterFillUnnamedIds
+
+    enrichCommentsPass <- cache "enrichComments" $ do
+      afterParse         <- parsePass
+      afterFillUnnamedIds <- fillUnnamedIdsPass
+      pure $ enrichComments afterParse.doxygen afterFillUnnamedIds
+
+    constructTranslationUnitPass <- cache "constructTranslationUnit" $ do
+      macroLang  <- boot.macroLang
+      afterParse <- parsePass
+      afterEnrichComments <- enrichCommentsPass
+      let afterConstructTranslationUnit =
+            constructTranslationUnit
+              macroLang
+              afterParse.macroAnalysis
+              afterParse.isMainHeader
+              afterEnrichComments
+              afterParse.includeGraph
+      pure afterConstructTranslationUnit
+
+    typecheckMacrosPass <- cache "typecheckMacros" $ do
+      macroLang                     <- boot.macroLang
+      afterConstructTranslationUnit <- constructTranslationUnitPass
+      pure $ typecheckMacros macroLang afterConstructTranslationUnit
+
+    prepareReparsePass <- cache "prepareReparse" $ do
+      (afterTypecheckMacros, _, _) <- typecheckMacrosPass
+      clangExe <- boot.clangExe
+      rootHeader <- rootHeaderC
+      setup <- getSetup rootHeader
+      liftIO $ prepareReparse
+                  (contramap FrontendPrepareReparse tracer)
+                  clangExe
+                  setup
+                  rootHeader
+                  afterTypecheckMacros
+
+    reparseMacroExpansionsPass <- cache "reparseMacroExpansions" $ do
+      (_, knownTypes, knownMacros) <- typecheckMacrosPass
+      afterPrepareReparse <- prepareReparsePass
+      cStd <- boot.cStandard
+      pure $ reparseMacroExpansions cStd (Map.map coercePass knownTypes) knownMacros afterPrepareReparse
+
+    resolveBindingSpecsPass <- cache "resolveBindingSpecs" $ do
+      afterReparseMacroExpansions <- reparseMacroExpansionsPass
+      extSpecs <- boot.externalBindingSpecs
+      pSpec    <- boot.prescriptiveBindingSpec
+      let moduleName = Hs.ModuleName boot.baseModule.text -- do not import Backend
+          (afterResolveBindingSpecs, msgsResolveBindingSpecs) =
+            resolveBindingSpecs moduleName extSpecs pSpec afterReparseMacroExpansions
+      forM_ msgsResolveBindingSpecs $ traceWith (contramap FrontendResolveBindingSpecs tracer)
+      pure afterResolveBindingSpecs
+
+    mangleNamesPass <- cache "mangleNames" $ do
+      afterResolveBindingSpecs <- resolveBindingSpecsPass
+      let (afterMangleNames, msgsMangleNames) =
+            mangleNames config.fieldNamingStrategy afterResolveBindingSpecs
+      forM_ msgsMangleNames $ traceWith (contramap FrontendMangleNames tracer)
+      pure afterMangleNames
+
+    adjustTypesPass <- cache "AdjustTypes" $ do
+      afterMangleNamesPass <- mangleNamesPass
+      pure $ adjustTypes afterMangleNamesPass
+
+    translateTypesPass <- cache "TranslateTypes" $ do
+      afterAdjustTypesPass <- adjustTypesPass
+      let (afterTranslateTypes, msgsTranslateTypes) =
+            translateTypes afterAdjustTypesPass
+      forM_ msgsTranslateTypes $ traceWith (contramap FrontendTranslateTypes tracer)
+      pure afterTranslateTypes
+
+    selectPass <- cache "select" $ do
+      afterParse <- parsePass
+      afterTranslateTypesPass <- translateTypesPass
+      let (afterSelect, msgsSelect) =
+            selectDecls
+              afterParse.isMainHeader
+              afterParse.isInMainHeaderDir
+              selectConfig
+              afterTranslateTypesPass
+      forM_ msgsSelect $  traceWith (contramap FrontendSelect tracer)
+      pure afterSelect
+
+    finalPass <- cache "Final" $ selectPass
+
+    pure FrontendArtefact{
+        parseMeta                = parseMeta
+      , parse                    = (.results) <$> parsePass
+      , doxygen                  = (.doxygen) <$> parsePass
+      , simplifyAST              = simplifyASTPass
+      , fillUnnamedIds           = fillUnnamedIdsPass
+      , enrichComments           = enrichCommentsPass
+      , constructTranslationUnit = constructTranslationUnitPass
+      , typecheckMacros          = (\(x,_,_) -> x) <$> typecheckMacrosPass
+      , reparseMacroExpansions   = reparseMacroExpansionsPass
+      , resolveBindingSpecs      = resolveBindingSpecsPass
+      , mangleNames              = mangleNamesPass
+      , adjustTypes              = adjustTypesPass
+      , translateTypes           = translateTypesPass
+      , select                   = selectPass
+      , final                    = finalPass
+      }
+  where
+    getSetup :: RootHeader -> Cached ClangSetup
+    getSetup rootHeader = do
+      clangArgs <- boot.clangArgs
+      let hContent = RootHeader.content rootHeader
+          setup = defaultClangSetup clangArgs $ ClangInputMemory hFilePath hContent
+      pure $ setup {
+          flags = bitfieldEnum [
+              CXTranslationUnit_DetailedPreprocessingRecord
+            , CXTranslationUnit_IncludeAttributedTypes
+            , CXTranslationUnit_VisitImplicitAttributes
+            ]
+        }
+
+    hFilePath :: FilePath
+    hFilePath = getSourcePath RootHeader.name
+
+    selectConfig :: SelectConfig
+    selectConfig = SelectConfig{
+          programSlicing     = config.programSlicing
+        , selectionPredicate = config.selectionPredicate
+        }
+
+    cache :: String -> Cached a -> IO (Cached a)
+    cache = cacheWith (contramap (FrontendCache . SafeTrace) tracer) . Just
+
+    tracerRootHeader :: Tracer RootHeaderMsg
+    tracerRootHeader = contramap FrontendRootHeader tracer
+
+{-------------------------------------------------------------------------------
+  Artefact
+-------------------------------------------------------------------------------}
+
+data FrontendArtefact l = FrontendArtefact {
+      parseMeta                :: Cached ParseInfo
+    , parse                    :: Cached [ParseResult       l Parse]
+    , doxygen                  :: Cached Doxygen
+    , simplifyAST              :: Cached [ParseResult       l SimplifyAST]
+    , fillUnnamedIds           :: Cached [ParseResult       l FillUnnamedIds]
+    , enrichComments           :: Cached [ParseResult       l EnrichComments]
+    , constructTranslationUnit :: Cached (C.TranslationUnit l ConstructTranslationUnit)
+    , typecheckMacros          :: Cached (C.TranslationUnit l TypecheckMacros)
+    , reparseMacroExpansions   :: Cached (C.TranslationUnit l ReparseMacroExpansions)
+    , resolveBindingSpecs      :: Cached (C.TranslationUnit l ResolveBindingSpecs)
+    , mangleNames              :: Cached (C.TranslationUnit l MangleNames)
+    , adjustTypes              :: Cached (C.TranslationUnit l AdjustTypes)
+    , translateTypes           :: Cached (C.TranslationUnit l TranslateTypes)
+    , select                   :: Cached (C.TranslationUnit l Select)
+    , final                    :: Cached (C.TranslationUnit l Final)
+    }
+
+{-------------------------------------------------------------------------------
+  Traces
+-------------------------------------------------------------------------------}
+
+-- | Frontend trace messages
+--
+-- Most passes in the frontend have their own set of trace messages.
+data FrontendMsg =
+    FrontendClang                     ClangMsg
+  | FrontendParse                    (Msg Parse)
+  | FrontendSimplifyAST              (Msg SimplifyAST)
+  | FrontendFillUnnamedIds           (Msg FillUnnamedIds)
+  | FrontendPrepareReparse           (Msg PrepareReparse)
+  | FrontendReparseMacroExpansions   (Msg ReparseMacroExpansions)
+  | FrontendResolveBindingSpecs      (Msg ResolveBindingSpecs)
+  | FrontendMangleNames              (Msg MangleNames)
+  | FrontendTranslateTypes           (Msg TranslateTypes)
+  | FrontendSelect                   (Msg Select)
+  | FrontendCache                    (SafeTrace CacheMsg)
+  | FrontendDoxygen                   DoxygenMsg
+  | FrontendRootHeader                RootHeaderMsg
+  deriving stock    (Show, Generic)
+  deriving anyclass (PrettyForTrace, IsTrace Level)
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+-- | Information useful for inspection as well as peripheral tasks.
+--
+-- Excluded from the parse pass result because there is no 'Show' instance.
+data ParseInfo = ParseInfo {
+      includeGraph      :: IncludeGraph
+    , getMainHeaders    :: GetMainHeaders
+    }
+
+{-------------------------------------------------------------------------------
+  Internal helpers
+-------------------------------------------------------------------------------}
+
+data ParsePassResult l = ParsePassResult {
+      results           :: [ParseResult l Parse]
+    , doxygen           :: Doxygen
+    , includeGraph      :: IncludeGraph
+    , isMainHeader      :: IsMainHeader
+    , isInMainHeaderDir :: IsInMainHeaderDir
+    , getMainHeaders    :: GetMainHeaders
+    , usageAnalysis     :: UnnamedIdUsageAnalysis
+    , macroAnalysis     :: UniqueExpansion.Analysis
+    }
diff --git a/src-internal/HsBindgen/Frontend/Analysis.hs b/src-internal/HsBindgen/Frontend/Analysis.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis.hs
@@ -0,0 +1,51 @@
+-- | Common vocabulary for the analysis done in the frontend
+--
+-- Intended for unqualified import.
+module HsBindgen.Frontend.Analysis (
+    -- * Dependencies
+    Dependency(..)
+  ) where
+
+{-------------------------------------------------------------------------------
+  Dependencies
+-------------------------------------------------------------------------------}
+
+-- | Does the dependent require the dependency's full definition or only a
+-- name-level reference?
+--
+-- That is, when generating a binding for @B@ which depends on @A@, what do we
+-- need to know about @A@?
+data Dependency =
+    -- | We need to know the full shape (i.e., its size and instances) of the
+    -- dependency.
+    --
+    -- For example, when generating a binding for @B@, we need to know the shape
+    -- of @A@:
+    --
+    -- @
+    -- typedef int A;
+    -- struct B {
+    --   A fieldA;
+    -- };
+    -- @
+    NeedsShape
+    -- | We only need to know the name of the dependency.
+    --
+    -- For example, since @fieldA@ is a /pointer/ to @A@, when generating a
+    -- binding for @B@, we only need to know the name of @A@:
+    --
+    -- @
+    -- typedef int A;
+    -- struct B {
+    --   A* fieldA;
+    -- };
+    -- @
+    --
+    -- A more subtle example using a function pointer:
+    --
+    -- @
+    -- typedef int A;
+    -- typedef void (*B) (A);
+    -- @
+  | NeedsNameOnly
+  deriving stock (Eq, Ord, Show)
diff --git a/src-internal/HsBindgen/Frontend/Analysis/DeclIndex.hs b/src-internal/HsBindgen/Frontend/Analysis/DeclIndex.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/DeclIndex.hs
@@ -0,0 +1,831 @@
+-- | Declaration index
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+-- > import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+module HsBindgen.Frontend.Analysis.DeclIndex (
+    DeclIndex -- opaque
+    -- * Entry
+  , UsableEntry(..)
+  , UnusableEntry(..)
+  , UnusableReason(..)
+  , Success(..)
+  , Squashed(..)
+  , Entry(..)
+  , entryToLoc
+  , entryToAvailability
+    -- * Construction
+  , fromParseResults
+    -- * Filter
+  , filter
+  , restrictKeys
+  , withoutKeys
+    -- * Query parse successes
+  , lookup
+  , getDecls
+    -- * Other queries
+  , lookupEntry
+  , toList
+  , lookupLoc
+  , lookupAmbiguity
+  , unusableToLoc
+  , keysSet
+  , getOmitted
+  , getSquashed
+  , getUnusables
+    -- * Support for macro failures
+  , registerMacroTypecheckFailure
+  , registerDelayedParseMsg
+    -- * Support for the @PrepareReparse@ pass
+  , registerDelayedPrepareReparseMsg
+    -- * Support for the @ReparseMacroExpansions@ pass
+  , registerDelayedReparseMacroExpansionsMsg
+    -- * Support for binding specifications
+  , registerOmittedDeclarations
+  , registerExternalDeclarations
+    -- * Support for name mangle failures
+  , registerSquashedDeclarations
+  , registerMangleNamesFailure
+    -- * Support for the @TranslateTypes@ pass
+  , registerDelayedTranslateTypesMsg
+  ) where
+
+import Prelude hiding (filter, lookup)
+
+import Control.Monad.State
+import Data.Foldable qualified as Foldable
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+import Optics.Core (traverseOf)
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis.DeclIndex.ResolveMacro
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.EnrichComments.IsPass
+import HsBindgen.Frontend.Pass.MangleNames.Error
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.Msg (DelayedReparseMacroExpansionsMsg)
+import HsBindgen.Frontend.Pass.TranslateTypes.IsPass.Msg (DelayedTranslateTypesMsg)
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.Predicate (IsMainHeader)
+import HsBindgen.Imports hiding (toList)
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass (IsPass)
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Error
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.Macro.UniqueExpansion qualified as UniqueExpansion
+import HsBindgen.Macro.UniqueExpansion.Types qualified as UniqueExpansion
+import HsBindgen.Util.Tracer
+
+type In  = EnrichComments
+type Out = ConstructTranslationUnit
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | The declaration index, parameterized by the pass at which the indexed
+-- declarations are represented.
+--
+-- The public 'DeclIndex' fixes this to 'ConstructTranslationUnit' (macros
+-- resolved). The polymorphic form is used internally to build the index at
+-- 'EnrichComments' before resolving macros (see 'fromParseResults').
+--
+-- The declaration index indexes C types (not Haskell types); as such, it
+-- contains declarations in the source code, and never contains external
+-- declarations.
+--
+-- When we replace a declaration by an external one while resolving binding
+-- specifications, it is not deleted from the declaration index but reclassified
+-- as 'UsableExternal'. In the "HsBindgen.Frontend.Analysis.UseDeclGraph",
+-- dependency edges from use sites to the replaced declaration are deleted,
+-- because the use sites now depend on the external Haskell type.
+--
+-- For example, assume the C code
+--
+-- @
+-- typedef struct {    // D1
+--   int x;
+-- } foo_t;            // D2
+--
+-- typedef foo_t foo;  // D3
+-- @
+--
+-- - D1 declares an untagged @struct@
+-- - D2 declares the typedef @foo_t@ depending on D1
+-- - D3 declares a typedef @foo@ depending on D2
+--
+-- The use-decl graph is
+--
+-- D1 <- D2 <- D3
+--
+-- Further, assume we have an external binding specification for D2. After
+-- resolving external binding specifications, the use-decl graph will be
+--
+-- D1 <- D2    D3
+--      (R2) <-|
+--
+-- The edge from D3 to D2 was removed, since D3 now depends on a Haskell type
+-- R3, which is not part of the use-decl graph.
+data DeclIndex l = DeclIndex {
+      map             :: Map C.DeclId (Entry l)
+      -- | Macros whose expansion depends on where they are invoked
+      --
+      -- See "HsBindgen.Macro.UniqueExpansion". Ambiguity is independent of the
+      -- entries: a macro may be ambiguous whether or not it is usable, and
+      -- replacing or removing its entry does not change the verdict.
+    , ambiguousMacros :: Set UniqueExpansion.Name
+    }
+  deriving stock (Show, Generic)
+
+{-------------------------------------------------------------------------------
+  Entry
+-------------------------------------------------------------------------------}
+
+-- | Usable declaration
+--
+-- At each stage in the `hs-bindgen` pipeline, a "usable" declaration (i.e.,
+-- 'UsableEntry') is a declaration we think we can generate bindings for. Passes
+-- may replace "usable" declarations with
+--
+-- - other "usable" declarations such as external declarations
+--   ("ResolveBindingSpecs") or squashed declarations (in "MangleNames"); or
+--
+-- - "unusable" declarations (i.e, 'UnusableEntry'), for example when macro
+--   typechecking fails ("TypecheckMacros") or name mangling fails
+--   ("MangleNames").
+--
+-- At the end of the `hs-bindgen` pipeline, we can generate bindings for
+-- "usable" declarations.
+--
+-- However, usability is not concerned with _transitivity_. Usable declarations
+-- may have unusable transitive dependencies. Even though we can generate
+-- bindings for usable declarations, they may not be functional because they
+-- miss transitive dependencies.
+--
+-- (We avoid the term available, because it is overloaded with Clang's
+-- CXAvailabilityKind).
+data UsableEntry l =
+    UsableSuccess (Success l Out)
+  | UsableExternal C.DeclLocs
+    -- Squashed declarations are always "usable" because we only squash
+    -- declaration in the list of declarations attached to the declaration unit.
+  | UsableSquashed Squashed
+  deriving stock (Show, Generic)
+
+usableToLoc :: UsableEntry l -> C.DeclLocs
+usableToLoc = \case
+    UsableSuccess  x    -> C.DeclLoc x.decl.info.loc
+    UsableExternal locs -> locs
+    UsableSquashed x    -> C.DeclLoc x.typedefLoc
+
+-- | Unusable declaration
+--
+-- A declaration is unusable if we cannot generate bindings for it.
+--
+-- See 'UsableEntry'.
+--
+-- (We avoid the term available, because it is overloaded with Clang's
+-- CXAvailabilityKind).
+data UnusableEntry =
+    UnusableReason (SingleLoc C.DeclPath) UnusableReason
+  | UnusableConflict C.Conflict
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace UnusableEntry where
+  prettyForTrace = \case
+    UnusableReason   _loc unusable -> prettyForTrace unusable
+    UnusableConflict      conflict -> prettyForTrace conflict
+
+data UnusableReason =
+    UnusableUnavailable
+  | UnusableOmitted
+  | UnusableParseFailure           DelayedParseMsg
+  | UnusableMacroTypecheckFailure  MacroTypecheckError
+  | UnusableMacroResolutionFailure MacroResolutionError
+  | UnusableMangleNamesFailure     MangleNamesError
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace UnusableReason where
+  prettyForTrace = \case
+    UnusableUnavailable{} ->
+      "Declaration is 'unavailable' on this platform"
+    UnusableOmitted{} ->
+      "Omitted by prescriptive binding specification"
+    UnusableParseFailure{} ->
+      "Parse failed"
+    UnusableMangleNamesFailure{} ->
+      "Name mangler failure"
+    UnusableMacroTypecheckFailure{} ->
+      "Macro type-checking failed"
+    UnusableMacroResolutionFailure{} ->
+      "Macro name resolution failed"
+
+unusableToLoc :: UnusableEntry -> C.DeclLocs
+unusableToLoc = \case
+  UnusableReason   loc _ -> C.DeclLoc          loc
+  UnusableConflict     c -> C.DeclLocsConflict c
+
+data Success l p = Success {
+    decl                              :: C.Decl l p
+  , delayedParseMsgs                  :: [DelayedParseMsg]
+  , delayedPrepareReparseMsgs         :: [DelayedPrepareReparseMsg]
+  , delayedReparseMacroExpansionsMsgs :: [DelayedReparseMacroExpansionsMsg]
+  , delayedTranslateTypesMsgs         :: [DelayedTranslateTypesMsg]
+  }
+  deriving stock (Generic)
+
+deriving stock instance ( IsPass p
+                        , Macro.HasTypes l
+                        ) => Show (Success l p)
+
+data Squashed = Squashed {
+    -- | The location of the squashed typedef (i.e., _not_ the target)
+    typedefLoc   :: SingleLoc C.DeclPath
+  , targetNameC  :: C.DeclId
+  , targetNameHs :: Hs.Name Hs.NsTypeConstr
+  }
+  deriving stock (Show, Generic)
+
+-- | Entry of declaration index
+data Entry l =
+    UsableEntry   (UsableEntry l)
+  | UnusableEntry UnusableEntry
+  deriving stock (Show, Generic)
+
+entryToLoc :: Entry l -> C.DeclLocs
+entryToLoc = \case
+  UnusableEntry e -> unusableToLoc e
+  UsableEntry   e -> usableToLoc e
+
+entryToAvailability :: Entry l -> C.Availability
+entryToAvailability = \case
+    UsableEntry e   -> case e of
+      UsableSuccess success -> success.decl.info.availability
+      UsableExternal{}      -> C.Available
+      UsableSquashed{}      -> C.Available
+    UnusableEntry{} -> C.Available
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+-- | Construct the declaration index, resolving macro names.
+--
+-- Macro resolution needs the set of all declaration IDs, which is only known
+-- once all parse results are in. We therefore first resolve the macros in each
+-- successful declaration ('resolveMacros'), and then build the index from the
+-- resolved results ('buildIndex'), detecting conflicts even with macros that we
+-- cannot resolve.
+--
+-- The analysis of the macro definitions decides whether a macro redefinition
+-- is a conflict, and is recorded in the index as the set of ambiguous macros.
+fromParseResults ::
+     forall l. Macro.HasTypes l
+  => Macro.Lang l
+  -> UniqueExpansion.Analysis
+  -> IsMainHeader
+  -> [ParseResult l In]
+  -> DeclIndex l
+fromParseResults macroLang macroAnalysis isMainHeader parseResults = DeclIndex{
+      map             = buildIndex macroAnalysis isMainHeader $
+                          resolveMacros macroLang declIds parseResults
+    , ambiguousMacros = UniqueExpansion.ambiguous macroAnalysis
+    }
+  where
+    declIds :: Set C.DeclId
+    declIds = getDeclIds parseResults
+
+    getDeclIds :: [ParseResult l In] -> Set C.DeclId
+    getDeclIds = Set.fromList . map (.id)
+
+{-------------------------------------------------------------------------------
+  Macro resolution
+-------------------------------------------------------------------------------}
+
+-- | Result of resolving macro names in a single parse result.
+data ResolvedResult l =
+    -- | Macro names were resolved successfully (or the declaration was not a
+    -- macro, or was not a parse success to begin with).
+    Resolved (ParseResult l Out)
+    -- | Macro names could not be resolved.
+  | Unresolved C.DeclId (SingleLoc C.DeclPath) MacroResolutionError
+
+resolvedResultId :: ResolvedResult l -> C.DeclId
+resolvedResultId = \case
+    Resolved result       -> result.id
+    Unresolved declId _ _ -> declId
+
+resolvedResultLoc :: ResolvedResult l -> SingleLoc C.DeclPath
+resolvedResultLoc = \case
+    Resolved result    -> result.loc
+    Unresolved _ loc _ -> loc
+
+resolvedResultToEntry :: ResolvedResult l -> Entry l
+resolvedResultToEntry = \case
+    Resolved result      -> parseResultToEntry result
+    Unresolved _ loc err -> UnusableEntry $ UnusableReason loc (UnusableMacroResolutionFailure err)
+  where
+    parseResultToEntry :: ParseResult l Out -> Entry l
+    parseResultToEntry result = case result.classification of
+      ParseResultSuccess r ->
+        UsableEntry $ UsableSuccess (parseSuccessToSuccess r)
+      ParseResultUnavailable ->
+        UnusableEntry $ UnusableReason result.loc UnusableUnavailable
+      ParseResultFailure r ->
+        UnusableEntry $ UnusableReason result.loc $ UnusableParseFailure r
+
+parseSuccessToSuccess :: ParseSuccess l Out -> Success l Out
+parseSuccessToSuccess success = Success {
+      decl = success.decl
+    , delayedParseMsgs = success.delayedParseMsgs
+    , delayedPrepareReparseMsgs = []
+    , delayedReparseMacroExpansionsMsgs = []
+    , delayedTranslateTypesMsgs = []
+    }
+
+-- | Resolve macro names in every successful declaration.
+--
+-- A declaration whose macro names cannot be resolved becomes 'Unresolved', which
+-- 'buildIndex' turns into an 'UnusableMacroResolutionFailure' entry.
+resolveMacros ::
+     forall l.
+     Macro.Lang l
+  -> Set C.DeclId
+  -> [ParseResult l In]
+  -> [ResolvedResult l]
+resolveMacros macroLang allDeclIds = map resolveParseResult
+  where
+    resolveParseResult :: ParseResult l In -> ResolvedResult l
+    resolveParseResult result =
+      case traverseOf #classification resolveParseClassification result of
+        Right resolved -> Resolved resolved
+        Left  err      -> Unresolved result.id result.loc err
+
+    resolveParseClassification ::
+         ParseClassification l In
+      -> Either MacroResolutionError (ParseClassification l Out)
+    resolveParseClassification = \case
+      ParseResultSuccess success ->
+        case resolveMacroWith macroLang allDeclIds success.decl of
+          Right resolvedDecl -> Right $
+            ParseResultSuccess ParseSuccess{
+              decl             = resolvedDecl
+            , delayedParseMsgs = success.delayedParseMsgs
+            }
+          Left err -> Left err
+      ParseResultUnavailable ->
+        Right $ ParseResultUnavailable
+      ParseResultFailure x ->
+        Right $ ParseResultFailure x
+
+{-------------------------------------------------------------------------------
+  Build from resolved macros
+-------------------------------------------------------------------------------}
+
+-- This function checks for conflicts between ordinary declarations and macro
+-- declarations, which must be done specially because they are in separate
+-- namespaces. This is done here because we need to detect conflicts even with
+-- macros that we cannot typecheck, which are thrown out in the
+-- @TypecheckMacros@ pass.
+buildIndex ::
+     forall l. Macro.HasTypes l
+  => UniqueExpansion.Analysis
+  -> IsMainHeader
+  -> [ResolvedResult l]
+  -> Map C.DeclId (Entry l)
+buildIndex macroAnalysis isMainHeader results =
+    execState (mapM_ aux results) Map.empty
+  where
+    aux :: ResolvedResult l -> State (Map C.DeclId (Entry l)) ()
+    aux new = modify' $ \index ->
+      let declId :: C.DeclId
+          declId = resolvedResultId new
+
+          mConflict :: Maybe (IsConflict l)
+          mConflict = Foldable.asum [
+              do
+                old <- Map.lookup declId index
+                pure $ checkIsConflict macroAnalysis isMainHeader new (declId, old)
+            , case declId.name.kind of
+                C.NameKindOrdinary -> do
+                  let altDeclId = C.DeclId{
+                          name   = C.DeclName{
+                              text = declId.name.text
+                            , kind = C.NameKindMacro
+                            }
+                        , isUnnamed = False
+                        }
+                  old <- Map.lookup altDeclId index
+                  pure $ checkIsConflict macroAnalysis isMainHeader new (altDeclId, old)
+                C.NameKindMacro    -> do
+                  let altDeclId = C.DeclId{
+                          name   = C.DeclName{
+                              text = declId.name.text
+                            , kind = C.NameKindOrdinary
+                            }
+                        , isUnnamed = False
+                        }
+                  old <- Map.lookup altDeclId index
+                  pure $ checkIsConflict macroAnalysis isMainHeader new (altDeclId, old)
+                C.NameKindTagged{} -> Nothing
+            ]
+      in  case mConflict of
+            Nothing ->
+              Map.insert declId (resolvedResultToEntry new) index
+            Just (Redefinition entry) ->
+              Map.insert declId entry index
+            Just (SingleConflict ids conflict) ->
+              Map.union
+                ( Map.fromList
+                    [ (x, UnusableEntry (UnusableConflict conflict))
+                    | x <- Set.toList ids
+                    ]
+                )
+                index
+
+{-------------------------------------------------------------------------------
+  Conflicts
+-------------------------------------------------------------------------------}
+
+data IsConflict l =
+    Redefinition (Entry l)
+  | SingleConflict (Set C.DeclId) C.Conflict
+
+-- | Check whether a new declaration conflicts with an existing entry
+--
+-- A macro that is defined more than once is not a conflict if the analysis of
+-- the macro definitions deems the redefinition benign. Two ordinary
+-- declarations are not a conflict if they are successfully parsed to the same
+-- kind of declaration.
+checkIsConflict ::
+     forall l. Macro.HasTypes l
+  => UniqueExpansion.Analysis
+  -> IsMainHeader
+  -> ResolvedResult l
+  -> (C.DeclId, Entry l)
+  -> IsConflict l
+checkIsConflict macroAnalysis isMainHeader new (oldId, old)
+    | C.NameKindMacro <- newId.name.kind
+    , C.NameKindMacro <- oldId.name.kind
+    = case (redefinition, old) of
+        -- E.g., the macro conflicts with an ordinary declaration
+        (_, UnusableEntry UnusableConflict{}) -> singleConflict
+        (UniqueExpansion.Benign, _)           -> Redefinition macroRedefinition
+        (UniqueExpansion.NotBenign, _)        -> singleConflict
+    | Resolved new' <- new
+    , ParseResultSuccess newSuccess <- new'.classification
+    , UsableEntry (UsableSuccess oldSuccess) <- old
+    , newSuccess.decl.kind == oldSuccess.decl.kind
+    = Redefinition $ UsableEntry $ UsableSuccess $
+        mergeRedefinition keep (parseSuccessToSuccess newSuccess) oldSuccess
+    | otherwise
+    = singleConflict
+  where
+    newId :: C.DeclId
+    newId = resolvedResultId new
+
+    newLoc :: SingleLoc C.DeclPath
+    newLoc = resolvedResultLoc new
+
+    redefinition :: UniqueExpansion.Redefinition
+    redefinition =
+      UniqueExpansion.redefinition macroAnalysis $
+        UniqueExpansion.Name newId.name.text
+
+    -- The definitions are identical, so the macro language fared the same with
+    -- both.
+    macroRedefinition :: Entry l
+    macroRedefinition = case (resolvedResultToEntry new, old) of
+      ( UsableEntry (UsableSuccess newSuccess)
+        , UsableEntry (UsableSuccess oldSuccess) ) ->
+          UsableEntry $ UsableSuccess $
+            mergeRedefinition keep newSuccess oldSuccess
+      (newEntry, _) -> case keep of
+        KeepNew -> newEntry
+        KeepOld -> old
+
+    keep :: Keep
+    keep = keepRedefinition isMainHeader newLoc old
+
+    singleConflict :: IsConflict l
+    singleConflict =
+      let conflict :: C.Conflict
+          conflict = case old of
+            UnusableEntry (UnusableConflict c) ->
+              C.conflictInsert c newLoc
+            _otherwise ->
+              C.conflictFromList $
+                newLoc : C.declLocsToList (entryToLoc old)
+      in SingleConflict (Set.fromList [newId, oldId]) conflict
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/2282>
+--
+-- We should "keep" more information in a redefinition so we can apply the
+-- select predicate to any of the declarations.
+
+-- | Which of two definitions of the same declaration to keep
+data Keep = KeepNew | KeepOld
+
+-- | Keep the new definition if it is in a main header and the old one is not
+--
+-- The location of the kept definition decides whether the default selection
+-- predicate selects it, and its header determines the generated @#include@.
+keepRedefinition :: IsMainHeader -> SingleLoc C.DeclPath -> Entry l -> Keep
+keepRedefinition isMainHeader newLoc old
+    | inMainHeader newLoc
+    , not $ any inMainHeader $ C.declLocsToList (entryToLoc old)
+    = KeepNew
+    | otherwise
+    = KeepOld
+  where
+    inMainHeader :: SingleLoc C.DeclPath -> Bool
+    inMainHeader = maybe False isMainHeader . C.declPathRealPath . singleLocPath
+
+-- | Merge two definitions, keeping the delayed parse messages of both
+mergeRedefinition :: Keep -> Success l Out -> Success l Out -> Success l Out
+mergeRedefinition keep newSuccess oldSuccess =
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/2099?
+    --
+    -- We should make sure that we do not report delayed messages multiple
+    -- times (e.g., use 'Data.List.nub').
+    let delayedParseMsgs =
+          newSuccess.delayedParseMsgs ++ oldSuccess.delayedParseMsgs
+        delayedPrepareReparseMsgs =
+          if not (null oldSuccess.delayedPrepareReparseMsgs) then
+            panicPure "expected empty prepare reparse messages"
+          else
+            []
+        kept = case keep of
+          KeepNew -> newSuccess
+          KeepOld -> oldSuccess
+    in kept{
+           delayedParseMsgs          = delayedParseMsgs
+         , delayedPrepareReparseMsgs = delayedPrepareReparseMsgs
+         }
+
+{-------------------------------------------------------------------------------
+  Filter
+-------------------------------------------------------------------------------}
+
+filter ::
+     (C.DeclId -> Entry l -> Bool)
+  -> DeclIndex l
+  -> DeclIndex l
+filter p = #map %~ Map.filterWithKey p
+
+restrictKeys :: DeclIndex l -> Set C.DeclId -> DeclIndex l
+restrictKeys index xs = index & #map %~ (`Map.restrictKeys` xs)
+
+withoutKeys :: DeclIndex l -> Set C.DeclId -> DeclIndex l
+withoutKeys index xs = index & #map %~ (`Map.withoutKeys` xs)
+
+{-------------------------------------------------------------------------------
+  Query parse successes
+-------------------------------------------------------------------------------}
+
+-- | Lookup parse success.
+lookup :: C.DeclId -> DeclIndex l -> Maybe (C.Decl l Out)
+lookup declId index = case Map.lookup declId index.map of
+  Nothing                          -> Nothing
+  Just (UsableEntry (UsableSuccess x)) -> Just $ x.decl
+  _                                -> Nothing
+
+-- | Get all parse successes.
+getDecls :: DeclIndex l -> [C.Decl l Out]
+getDecls index = mapMaybe toDecl $ Map.elems index.map
+  where
+    toDecl = \case
+      UsableEntry (UsableSuccess x) -> Just x.decl
+      _otherEntries             -> Nothing
+
+{-------------------------------------------------------------------------------
+  Other queries
+-------------------------------------------------------------------------------}
+
+-- | Lookup an entry of a declaration index.
+lookupEntry :: C.DeclId -> DeclIndex l -> Maybe (Entry l)
+lookupEntry x index = Map.lookup x index.map
+
+-- | Get all entries of a declaration index.
+toList :: DeclIndex l -> [(C.DeclId, Entry l)]
+toList index = Map.toList index.map
+
+-- | Get the source locations of a declaration.
+--
+-- 'Nothing' indicates the declaration was /not found/.
+lookupLoc :: C.DeclId -> DeclIndex l -> Maybe C.DeclLocs
+lookupLoc d i = entryToLoc <$> lookupEntry d i
+
+-- | Does the expansion of a macro depend on where it is invoked?
+--
+-- An identifier that is not defined as a macro is
+-- 'UniqueExpansion.Unambiguous'.
+lookupAmbiguity :: UniqueExpansion.Name -> DeclIndex l -> UniqueExpansion.Ambiguity
+lookupAmbiguity name index
+    | name `Set.member` index.ambiguousMacros =
+        UniqueExpansion.Ambiguous
+    | otherwise =
+        UniqueExpansion.Unambiguous
+
+-- | Get the identifiers of all declarations in the index.
+keysSet :: DeclIndex l -> Set C.DeclId
+keysSet index = Map.keysSet index.map
+
+-- | Get omitted entries.
+getOmitted :: DeclIndex l -> Map C.DeclId RealPath
+getOmitted index = Map.mapMaybe toOmitted index.map
+  where
+    toOmitted :: Entry l -> Maybe RealPath
+    toOmitted = \case
+      UsableEntry   (UsableSquashed e) ->
+        lookupEntry e.targetNameC index >>= toOmitted
+      UsableEntry{} ->
+        Nothing
+      UnusableEntry (UnusableReason loc UnusableOmitted) ->
+        C.declPathRealPath (singleLocPath loc)
+      UnusableEntry{} ->
+        Nothing
+
+-- | Get squashed entries.
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1549>
+-- We may no longer need `getSquashed` once we properly record lists of aliases.
+getSquashed ::
+     DeclIndex l
+  -> Set C.DeclId
+  -> Map C.DeclId (RealPath, Hs.Name Hs.NsTypeConstr)
+getSquashed index targets = Map.mapMaybe onlySquashedTargetingSet index.map
+  where
+    onlySquashedTargetingSet ::
+         Entry l
+      -> Maybe (RealPath, Hs.Name Hs.NsTypeConstr)
+    onlySquashedTargetingSet = \case
+      UsableEntry (UsableSquashed e) ->
+        if Set.member e.targetNameC targets then
+          (, e.targetNameHs) <$> C.declPathRealPath (singleLocPath e.typedefLoc)
+        else
+          Nothing
+      _otherwise  -> Nothing
+
+-- | Restrict the declaration index to unusable declarations in a given set.
+getUnusables :: DeclIndex l -> Set C.DeclId -> Map C.DeclId UnusableEntry
+getUnusables index = Map.mapMaybe onlyUnusable . (.map) . restrictKeys index
+  where
+    onlyUnusable :: Entry l -> Maybe UnusableEntry
+    onlyUnusable = \case
+      UsableEntry   _ -> Nothing
+      UnusableEntry e -> Just e
+
+{-------------------------------------------------------------------------------
+  Support for delayed parse messages
+-------------------------------------------------------------------------------}
+
+-- | Append a delayed parse message to an existing 'UsableSuccess' entry.
+--
+-- Has no effect if the declaration is not a parse success (e.g., if it is a
+-- parse failure or a macro failure).
+registerDelayedParseMsg ::
+     (C.DeclId, DelayedParseMsg)
+  -> DeclIndex l
+  -> DeclIndex l
+registerDelayedParseMsg (declId, msg) =
+    #map %~ Map.adjust addMsg declId
+  where
+    addMsg :: Entry l -> Entry l
+    addMsg (UsableEntry (UsableSuccess ps)) =
+      UsableEntry $ UsableSuccess ps {
+          HsBindgen.Frontend.Analysis.DeclIndex.delayedParseMsgs =
+            ps.delayedParseMsgs ++ [msg]
+        }
+    addMsg entry = entry
+
+{-------------------------------------------------------------------------------
+  Support for macro failures
+-------------------------------------------------------------------------------}
+
+registerMacroTypecheckFailure ::
+     DeclIndex l
+  -> (C.DeclInfo TypecheckMacros, MacroTypecheckError)
+  -> DeclIndex l
+registerMacroTypecheckFailure index (info, err) = index
+    & #map %~ Map.insert info.id (UnusableEntry $ UnusableReason info.loc $
+        UnusableMacroTypecheckFailure err)
+
+{-------------------------------------------------------------------------------
+  Support for @PrepareReparse@ pass
+-------------------------------------------------------------------------------}
+
+-- | Append a delayed @PrepareReparse@ message to an existing 'UsableSuccess'
+-- entry.
+--
+-- Has no effect if the declaration is not a success
+registerDelayedPrepareReparseMsg ::
+     (C.DeclId, DelayedPrepareReparseMsg)
+  -> DeclIndex l
+  -> DeclIndex l
+registerDelayedPrepareReparseMsg (declId, msg) =
+    #map %~ Map.adjust addMsg declId
+  where
+    addMsg :: Entry l -> Entry l
+    addMsg (UsableEntry (UsableSuccess ps)) =
+      UsableEntry $ UsableSuccess ps{
+          delayedPrepareReparseMsgs = ps.delayedPrepareReparseMsgs ++ [msg]
+        }
+    addMsg entry = entry
+
+
+{-------------------------------------------------------------------------------
+  Support for @ReparseMacroExpansions@ pass
+-------------------------------------------------------------------------------}
+
+-- | Append a delayed @ReparseMacroExpansions@ message to an existing
+-- 'UsableSuccess' entry.
+--
+-- Has no effect if the declaration is not a success
+registerDelayedReparseMacroExpansionsMsg ::
+     (C.DeclId, DelayedReparseMacroExpansionsMsg)
+  -> DeclIndex l
+  -> DeclIndex l
+registerDelayedReparseMacroExpansionsMsg (declId, msg) =
+    #map %~ Map.adjust addMsg declId
+  where
+    addMsg :: Entry l -> Entry l
+    addMsg (UsableEntry (UsableSuccess ps)) =
+      UsableEntry $ UsableSuccess ps{
+          delayedReparseMacroExpansionsMsgs = ps.delayedReparseMacroExpansionsMsgs ++ [msg]
+        }
+    addMsg entry = entry
+
+{-------------------------------------------------------------------------------
+  Support for binding specifications
+-------------------------------------------------------------------------------}
+
+registerOmittedDeclarations ::
+     Map C.DeclId (SingleLoc C.DeclPath)
+  -> DeclIndex l
+  -> DeclIndex l
+registerOmittedDeclarations xs =
+    #map %~ Map.union (toOmitted <$> xs)
+  where
+    toOmitted loc = UnusableEntry $ UnusableReason loc UnusableOmitted
+
+registerExternalDeclarations ::
+     [(C.DeclId, C.DeclLocs)]
+  -> DeclIndex l
+  -> DeclIndex l
+registerExternalDeclarations xs index = Foldable.foldl' insert index xs
+  where
+    insert :: DeclIndex l -> (C.DeclId, C.DeclLocs) -> DeclIndex l
+    insert index' (declId, locs) =
+      index' & #map %~ Map.insert declId (UsableEntry $ UsableExternal locs)
+
+{-------------------------------------------------------------------------------
+  Support for mangle names
+-------------------------------------------------------------------------------}
+
+registerSquashedDeclarations ::
+     Map C.DeclId Squashed
+  -> DeclIndex l
+  -> DeclIndex l
+registerSquashedDeclarations xs =
+    #map %~ Map.union (UsableEntry . UsableSquashed <$> xs)
+
+registerMangleNamesFailure ::
+     Map C.DeclId (SingleLoc C.DeclPath, MangleNamesError)
+  -> DeclIndex l
+  -> DeclIndex l
+registerMangleNamesFailure xs =
+    #map %~ Map.union (toEntry <$> xs)
+  where
+    toEntry (loc, err) =
+      UnusableEntry $ UnusableReason loc $ UnusableMangleNamesFailure err
+
+{-------------------------------------------------------------------------------
+  Support for @TranslateTypes@ pass
+-------------------------------------------------------------------------------}
+
+-- | Append a delayed @TranslateTypes@ message to an existing
+-- 'UsableSuccess' entry.
+--
+-- Has no effect if the declaration is not a success
+registerDelayedTranslateTypesMsg ::
+     (C.DeclId, DelayedTranslateTypesMsg)
+  -> DeclIndex l
+  -> DeclIndex l
+registerDelayedTranslateTypesMsg (declId, msg) =
+    #map %~ Map.adjust addMsg declId
+  where
+    addMsg :: Entry l -> Entry l
+    addMsg (UsableEntry (UsableSuccess ps)) =
+      UsableEntry $ UsableSuccess ps{
+          delayedTranslateTypesMsgs = ps.delayedTranslateTypesMsgs ++ [msg]
+        }
+    addMsg entry = entry
diff --git a/src-internal/HsBindgen/Frontend/Analysis/DeclIndex/ResolveMacro.hs b/src-internal/HsBindgen/Frontend/Analysis/DeclIndex/ResolveMacro.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/DeclIndex/ResolveMacro.hs
@@ -0,0 +1,48 @@
+module HsBindgen.Frontend.Analysis.DeclIndex.ResolveMacro (
+    resolveMacroWith
+  ) where
+
+
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.EnrichComments.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Error
+import HsBindgen.Macro.Interface qualified as Macro
+
+type In  = EnrichComments
+type Out = ConstructTranslationUnit
+
+resolveMacroWith ::
+     Macro.Lang l
+  -> Set C.DeclId
+  -> C.Decl l In
+  -> Either MacroResolutionError (C.Decl l Out)
+resolveMacroWith macroLang allDeclIds decl = case decl.kind of
+    C.DeclStruct               x -> Right $ aux $ C.DeclStruct               $ coercePass x
+    C.DeclUnion                x -> Right $ aux $ C.DeclUnion                $ coercePass x
+    C.DeclTypedef              x -> Right $ aux $ C.DeclTypedef              $ coercePass x
+    C.DeclEnum                 x -> Right $ aux $ C.DeclEnum                 $ coercePass x
+    C.DeclUntaggedEnumConstant x -> Right $ aux $ C.DeclUntaggedEnumConstant $ coercePass x
+    C.DeclOpaque               x -> Right $ aux $ C.DeclOpaque               $ x
+    C.DeclMacro                x -> resolveMacro macroLang allDeclIds info' decl.ann x
+    C.DeclFunction             x -> Right $ aux $ C.DeclFunction             $ coercePass x
+    C.DeclGlobal               x -> Right $ aux $ C.DeclGlobal               $ coercePass x
+  where
+    info' :: C.DeclInfo Out
+    info' = coercePass decl.info
+
+    aux :: C.DeclKind l Out -> C.Decl l Out
+    aux x = C.Decl info' x decl.ann
+
+resolveMacro ::
+     Macro.Lang l
+  -> Set C.DeclId
+  -> C.DeclInfo Out
+  -> Ann "Decl" Out
+  -> MacroBody In l
+  -> Either MacroResolutionError (C.Decl l Out)
+resolveMacro macroLang allDeclIds info' ann unresolvedMacro = do
+    resolvedMacro <- macroLang.resolve allDeclIds unresolvedMacro
+    pure $ C.Decl info' (C.DeclMacro resolvedMacro) ann
diff --git a/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph.hs b/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph.hs
@@ -0,0 +1,31 @@
+-- | Declaration-usage graph
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Frontend.Analysis.DeclUseGraph (DeclUseGraph)
+-- > import HsBindgen.Frontend.Analysis.DeclUseGraph qualified as DeclUseGraph
+module HsBindgen.Frontend.Analysis.DeclUseGraph (
+    -- * Definition
+    DeclUseGraph -- opaque
+  , toDigraph
+    -- * Construction
+  , construct
+  , insertDepsOfDecl
+    -- * Deletion
+  , deleteDeps
+  , deleteRevDeps
+    -- * Query
+  , toDecls
+    -- ** Transitive usage
+  , getUseSitesTransitively
+    -- ** Direct usage
+  , getUseSites
+  , getUseSitesNoSelfReferences
+    -- * Visualization
+  , renderMermaid
+  ) where
+
+-- NOTE This module is split up in order to avoid import cycles.
+import HsBindgen.Frontend.Analysis.DeclUseGraph.Construction
+import HsBindgen.Frontend.Analysis.DeclUseGraph.Definition
+import HsBindgen.Frontend.Analysis.DeclUseGraph.Query
diff --git a/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph/Construction.hs b/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph/Construction.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph/Construction.hs
@@ -0,0 +1,157 @@
+module HsBindgen.Frontend.Analysis.DeclUseGraph.Construction (
+    -- * Construction
+    construct
+  , insertDepsOfDecl
+    -- * Deletion
+  , deleteDeps
+  , deleteRevDeps
+  ) where
+
+import Data.Digraph (Digraph)
+import Data.Digraph qualified as Digraph
+import Data.List qualified as List
+import Data.Set qualified as Set
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Analysis.DeclUseGraph.Definition
+import HsBindgen.Frontend.Analysis.Deps
+import HsBindgen.Frontend.Analysis.IncludeGraph (IncludeGraph)
+import HsBindgen.Frontend.Analysis.IncludeGraph qualified as IncludeGraph
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+construct ::
+     forall l. HasCallStack
+  => IncludeGraph
+  -> DeclIndex l
+  -> DeclUseGraph
+construct includeGraph declIndex = declUseGraph
+  where
+    -- The include graph informs us about the order of declarations which is
+    -- key.
+    order :: IncludeGraph.IncludeOrder
+    order = IncludeGraph.toIncludeOrder includeGraph
+    -- The declaration index contains declarations that we cannot use. Macros
+    -- have already been resolved while constructing the declaration index.
+    successfulDecls, sortedSuccessfulDecls :: [C.Decl l ConstructTranslationUnit]
+    successfulDecls       = DeclIndex.getDecls declIndex
+    sortedSuccessfulDecls = List.sortOn (annSortKey order) successfulDecls
+
+    allDeclIds, successfulDeclIds, failedDeclIds :: Set C.DeclId
+    allDeclIds        = DeclIndex.keysSet declIndex
+    successfulDeclIds = Set.fromList $ map (.info.id) sortedSuccessfulDecls
+    failedDeclIds     = allDeclIds Set.\\ successfulDeclIds
+
+    declUseGraph :: DeclUseGraph
+    declUseGraph = DeclUseGraph $
+      foldl'
+        (flip insertDepsOfDeclParsedMacro)
+        verticesGraph
+        sortedSuccessfulDecls
+
+    -- We first insert all declarations, so that they are assigned vertices. For
+    -- successfully parsed declarations, we do this in source order. This
+    -- ensures that we preserve source order as much as possible in 'toDecls'
+    -- (modulo dependencies).
+    verticesGraph :: Digraph Dependency C.DeclId
+    verticesGraph = foldl' (flip Digraph.insertVertex) Digraph.empty $
+      map (.info.id) sortedSuccessfulDecls ++ Set.toList failedDeclIds
+
+    -- We cannot use plain 'depsOfDecl' here because, at this pass, macros have
+    -- been resolved (in the declaration index) but not yet typechecked. We
+    -- therefore use 'depsOfDeclParsedMacro', which derives the dependencies
+    -- from the resolved (but not yet typechecked) macro body.
+    insertDepsOfDeclParsedMacro ::
+         C.Decl l ConstructTranslationUnit
+      -> Digraph Dependency C.DeclId
+      -> Digraph Dependency C.DeclId
+    insertDepsOfDeclParsedMacro decl =
+      insertDeps decl.info.id (depsOfDeclParsedMacro decl.kind)
+
+insertDeps ::
+     (HasCallStack)
+  => C.DeclId
+  -> [(C.DeclId, Dependency)]
+  -> Digraph Dependency C.DeclId
+  -> Digraph Dependency C.DeclId
+insertDeps source = flip (foldl' aux)
+  where
+    aux ::
+         Digraph Dependency C.DeclId
+      -> (C.DeclId, Dependency)
+      -> Digraph Dependency C.DeclId
+    aux graph (target, edge) =
+      case Digraph.insertEdgeIfVerticesExist target edge source graph of
+        Digraph.InsertEdgeSuccess graph' -> graph'
+        Digraph.InsertEdgeSourceVertexNotFound declId ->
+          panicPure $ "source declaration ID not in graph: " ++ show declId
+        Digraph.InsertEdgeTargetVertexNotFound declId ->
+          panicPure $ "target declaration ID not in graph: " ++ show declId
+
+-- | Inserts dependency edges of provided declaration.
+insertDepsOfDecl ::
+     HasCallStack
+  => C.Decl l ReparseMacroExpansions
+  -> DeclUseGraph
+  -> DeclUseGraph
+insertDepsOfDecl decl declUseGraph = DeclUseGraph $
+    insertDeps (decl.info.id) (depsOfDecl decl.kind) declUseGraph.graph
+
+{-------------------------------------------------------------------------------
+  Deletion
+-------------------------------------------------------------------------------}
+
+-- | Delete edges to the specified vertices, representing dependencies
+--
+-- This function is used when a type is opaqued, in which case the type no
+-- longer has dependencies.
+deleteDeps :: Set C.DeclId -> DeclUseGraph -> DeclUseGraph
+deleteDeps depIds declUseGraph = DeclUseGraph{
+      graph = Digraph.deleteEdgesTo depIds declUseGraph.graph
+    }
+
+-- | Delete edges from the specified vertices, representing uses
+--
+-- This function is used when a type is replaced with an external reference, in
+-- which case all uses of the type no longer directly depend on the type.
+deleteRevDeps :: Set C.DeclId -> DeclUseGraph -> DeclUseGraph
+deleteRevDeps depIds declUseGraph = DeclUseGraph{
+      graph = Digraph.deleteEdgesFrom depIds declUseGraph.graph
+    }
+
+{-------------------------------------------------------------------------------
+  Auxiliary
+-------------------------------------------------------------------------------}
+
+data SortKey = SortKey{
+      sortPathIx :: IncludeGraph.IncludeOrderIx
+    , sortLineNo :: Int
+    , sortColNo  :: Int
+    }
+  deriving (Eq, Ord, Show)
+
+annSortKey :: HasCallStack => IncludeGraph.IncludeOrder -> C.Decl l p -> SortKey
+annSortKey order decl = SortKey{
+      sortPathIx = sortPathIx
+    , sortLineNo = singleLocLine   decl.info.loc
+    , sortColNo  = singleLocColumn decl.info.loc
+    }
+  where
+    path = singleLocPath decl.info.loc
+    -- Unlike a trace message, a declaration whose source is not in the include
+    -- graph means the frontend is broken; there is nothing to salvage.
+    sortPathIx = case IncludeGraph.lookupIncludeOrder order path of
+      IncludeGraph.NotInIncludeGraph ->
+        panicPure $ "Source of declaration " <> show path <> " not in include graph"
+      ix -> ix
diff --git a/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph/Definition.hs b/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph/Definition.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph/Definition.hs
@@ -0,0 +1,46 @@
+module HsBindgen.Frontend.Analysis.DeclUseGraph.Definition (
+    DeclUseGraph(..)
+  , toDigraph
+    -- * Visualization
+  , renderMermaid
+  ) where
+
+import Data.Digraph (Digraph)
+import Data.Digraph qualified as Digraph
+
+import HsBindgen.Frontend.Analysis
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Declaration definition-usage graph
+--
+-- This graph has edges from definition sites to use sites.
+data DeclUseGraph = DeclUseGraph {
+      graph :: Digraph Dependency C.DeclId
+    }
+  deriving stock (Eq, Show)
+
+toDigraph :: DeclUseGraph -> Digraph Dependency C.DeclId
+toDigraph declUseGraph = declUseGraph.graph
+
+{-------------------------------------------------------------------------------
+  Visualization
+-------------------------------------------------------------------------------}
+
+renderMermaid :: DeclUseGraph -> String
+renderMermaid declUseGraph = Digraph.renderMermaid opts declUseGraph.graph
+  where
+    opts :: Digraph.VisOptions Dependency C.DeclId
+    opts = Digraph.VisOptions{
+        visVertex = \v -> Digraph.VisVertex{
+            label = Just (show v)
+          }
+      , visEdge   = \e -> Digraph.VisEdge{
+            label = Just (show e)
+          , style = Digraph.Solid
+          }
+      , reverseEdges = False
+      }
diff --git a/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph/Query.hs b/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph/Query.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/DeclUseGraph/Query.hs
@@ -0,0 +1,73 @@
+module HsBindgen.Frontend.Analysis.DeclUseGraph.Query (
+    -- * Query
+    toDecls
+    -- ** Transitive usage
+  , getUseSitesTransitively
+    -- ** Direct usage
+  , getUseSites
+  , getUseSitesNoSelfReferences
+  ) where
+
+import Data.Digraph qualified as Digraph
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+
+import HsBindgen.Frontend.Analysis
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Analysis.DeclUseGraph.Definition
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Query
+-------------------------------------------------------------------------------}
+
+-- | Construct ordered list of declarations
+--
+-- This follows source order whenever possible, but ensures that definition
+-- sites come before use sites.
+--
+-- For each declaration we provide one example of how that declaration is used
+-- (if one exists).
+toDecls :: DeclIndex l -> DeclUseGraph -> [C.Decl l ConstructTranslationUnit]
+toDecls index declUseGraph =
+    -- NOTE: There might be dependencies in the 'DeclUseGraph' on declarations
+    -- without a corresponding entry in the 'DeclIndex'.  For example, this can
+    -- happen when we are using external binding specifications.
+    mapMaybe (`DeclIndex.lookup` index) . Digraph.sort $
+      Digraph.filterEdges (== NeedsShape) declUseGraph.graph
+
+{-------------------------------------------------------------------------------
+  Transitive usage
+-------------------------------------------------------------------------------}
+
+getUseSitesTransitively :: DeclUseGraph -> Set C.DeclId -> Set C.DeclId
+getUseSitesTransitively declUseGraph declIds =
+    Digraph.reaches declIds declUseGraph.graph
+
+{-------------------------------------------------------------------------------
+  Direct usage
+-------------------------------------------------------------------------------}
+
+getUseSites :: DeclUseGraph -> C.DeclId -> [(C.DeclId, Dependency)]
+getUseSites declUseGraph declId =
+    aux $ Digraph.neighbors declId declUseGraph.graph
+  where
+    aux :: Map C.DeclId (Set Dependency) -> [(C.DeclId, Dependency)]
+    aux m = [
+        (declId', edge)
+      | (declId', edges) <- Map.toList m
+      , edge <- Set.elems edges
+      ]
+
+getUseSitesNoSelfReferences ::
+     DeclUseGraph
+  -> C.DeclId
+  -> [(C.DeclId, Dependency)]
+getUseSitesNoSelfReferences graph declId =
+  filter (not . isSelfReference) $ getUseSites graph declId
+    where
+      isSelfReference :: (C.DeclId, Dependency) -> Bool
+      isSelfReference (declId', _usage) = declId == declId'
diff --git a/src-internal/HsBindgen/Frontend/Analysis/Deps.hs b/src-internal/HsBindgen/Frontend/Analysis/Deps.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/Deps.hs
@@ -0,0 +1,132 @@
+module HsBindgen.Frontend.Analysis.Deps (
+    depsOfDecl
+    -- * Structs and unions
+  , depsOfStruct
+  , depsOfUnion
+  , depsOfField
+  , depsOfRegularField
+    -- * Parsed macros
+  , depsOfDeclParsedMacro
+  ) where
+
+import Data.Proxy (Proxy (..))
+
+import HsBindgen.Frontend.Analysis
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Interface qualified as Macro
+
+{-------------------------------------------------------------------------------
+  Get all dependencies
+-------------------------------------------------------------------------------}
+
+
+depsOfDeclWith ::
+     forall l p. IsPass p
+  => (MacroBody p l -> [(Id p, Dependency)])
+  -> C.DeclKind l p
+  -> [(Id p, Dependency)]
+depsOfDeclWith depsOfMacro = \case
+    (C.DeclStruct struct)          -> depsOfStruct struct
+    (C.DeclUnion union)            -> depsOfUnion union
+    (C.DeclEnum _)                 -> []
+    (C.DeclUntaggedEnumConstant _) -> []
+    (C.DeclTypedef ty)             -> depsOfTypedef ty
+    C.DeclOpaque{}                 -> []
+    (C.DeclMacro m)                -> depsOfMacro m
+    (C.DeclFunction function)      -> C.depsOfType (C.typeOfFunction function)
+    (C.DeclGlobal global)          -> C.depsOfType (cType (Proxy @p) global.typ)
+
+{-------------------------------------------------------------------------------
+  Dependencies of declarations with parsed macros only
+-------------------------------------------------------------------------------}
+
+-- | For parsed macros that have not been typechecked yet, we need to resolve
+--   names, using all available declaration IDs
+depsOfDeclParsedMacro ::
+     forall l p.
+     ( IsPass p
+     , MacroBody p ~ Macro.Resolved
+     , Id p ~ C.DeclId )
+  => C.DeclKind l p
+  -> [(Id p, Dependency)]
+depsOfDeclParsedMacro = depsOfDeclWith (.deps)
+
+{-------------------------------------------------------------------------------
+  Dependencies of declaration after @ReparseMacroExpansions@
+-------------------------------------------------------------------------------}
+
+-- | Get all dependencies of a declaration in the 'ReparseMacroExpansions' pass
+--
+-- Disclaimer: For a specific declaration, we can only determine the full set of
+-- dependencies after we have reparsed this declaration, because it may contain
+-- macro expansions. This step happens in the @ReparseMacroExpansions@ pass.
+--
+-- Before reparsing, the dependencies of declarations with macro expansions can
+-- only refer to the /underlying types/ of the expanded macros.
+--
+depsOfDecl ::
+     C.DeclKind l ReparseMacroExpansions
+  -> [(C.DeclId, Dependency)]
+depsOfDecl = depsOfDeclTcMacro
+
+depsOfDeclTcMacro ::
+     C.DeclKind l ReparseMacroExpansions
+  -> [(C.DeclId, Dependency)]
+depsOfDeclTcMacro = depsOfDeclWith typecheckedMacroDeps
+
+-- | Dependencies of typechecked macro declarations
+typecheckedMacroDeps ::
+     TypecheckedMacro ReparseMacroExpansions l
+  -> [(C.DeclId, Dependency)]
+typecheckedMacroDeps = \case
+    MacroType  typ -> typ.deps
+    MacroValue val -> val.deps
+
+{-------------------------------------------------------------------------------
+  Structs and unions
+-------------------------------------------------------------------------------}
+
+depsOfStruct :: IsPass p => C.Struct p -> [(Id p, Dependency)]
+depsOfStruct struct = concat [
+      concatMap depsOfField struct.fields
+    , foldMap   depsOfRegularField (C.flamStructField struct.flam)
+    ]
+
+depsOfUnion :: IsPass p => C.Union p -> [(Id p, Dependency)]
+depsOfUnion union = concatMap depsOfField union.fields
+
+-- | Dependencies of struct or union field
+depsOfField ::
+     forall p. IsPass p
+  => C.Field p
+  -> [(Id p, Dependency)]
+depsOfField = C.elimField depsOfRegularField depsOfImplicitField
+
+depsOfRegularField ::
+     forall p. IsPass p
+  => C.RegularField p
+  -> [(Id p, Dependency)]
+depsOfRegularField field = C.depsOfType (cType (Proxy @p) field.typ)
+
+depsOfImplicitField ::
+     forall p. IsPass p
+  => C.ImplicitField p
+  -> [(Id p, Dependency)]
+depsOfImplicitField field = C.depsOfType (cType (Proxy @p) field.typ)
+    ++ concatMap depsOfIndirectField field.indirect
+
+depsOfIndirectField ::
+     forall p. IsPass p
+  => C.IndirectField p
+  -> [(Id p, Dependency)]
+depsOfIndirectField field = C.depsOfType (cType (Proxy @p) field.typ)
+
+{-------------------------------------------------------------------------------
+  Typedefs
+-------------------------------------------------------------------------------}
+
+depsOfTypedef :: forall p. IsPass p => C.Typedef p -> [(Id p, Dependency)]
+depsOfTypedef typedef = C.depsOfType (cType (Proxy @p) typedef.typ)
diff --git a/src-internal/HsBindgen/Frontend/Analysis/IncludeGraph.hs b/src-internal/HsBindgen/Frontend/Analysis/IncludeGraph.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/IncludeGraph.hs
@@ -0,0 +1,368 @@
+-- | Include graph
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Frontend.Analysis.IncludeGraph (IncludeGraph)
+-- > import HsBindgen.Frontend.Analysis.IncludeGraph qualified as IncludeGraph
+module HsBindgen.Frontend.Analysis.IncludeGraph (
+    IncludeGraph(..)
+  , Node(..)
+  , Include(..)
+  , MacroArg
+  , getIncludeArg
+  , getIncludeMacroArg
+    -- * Construction
+  , empty
+  , register
+  , fromList
+    -- * Query
+  , reaches
+  , toSortedList
+  , getIncludes
+    -- * Include order
+  , IncludeOrder -- opaque
+  , IncludeOrderIx(..)
+  , toIncludeOrder
+  , lookupIncludeOrder
+    -- * Visualization
+  , Predicate
+  , HeaderLabelStyle(..)
+  , IncludeGraphFormat(..)
+  , VisOpts(..)
+  , renderMermaid
+  , renderSortedList
+  ) where
+
+import Data.Digraph (Digraph)
+import Data.Digraph qualified as Digraph
+import Data.List qualified as List
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+
+import Clang.Paths
+
+import HsBindgen.Frontend.RootHeader qualified as RootHeader
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Include graph
+--
+-- We create a DAG of C header paths with an edge for each @#include@.
+-- The edges are /reversed/ to represent an \"included by\" relation.
+--
+-- The root header is a vertex too. Nothing includes it, so every path of edges
+-- ends there, and the edges into it are the root directives that include the
+-- main headers. 'getIncludes' relies on this to find the main headers that
+-- include a header.
+data IncludeGraph = IncludeGraph{
+      graph :: Digraph Include Node
+    }
+  deriving stock (Show, Eq)
+
+-- | Vertex of the include graph
+--
+-- The root header is an in-memory file without a 'RealPath', so it gets a
+-- vertex of its own.
+data Node =
+    RootNode
+  | HeaderNode RealPath
+  deriving stock (Show, Eq, Ord)
+
+headerPath :: Node -> Maybe RealPath
+headerPath = \case
+    RootNode        -> Nothing
+    HeaderNode path -> Just path
+
+-- | Include directive as written in the source
+--
+-- This is only used for documentation and debugging.
+--
+-- Include directives may be specified using macros.  For details, see all of
+-- section 6.10 (Proprocessing directives) in the C99 specification.  In this
+-- case, we simply specify the filename.  Example:
+--
+-- > #define SOME_HEADER <stdint.h>
+-- > #include SOME_HEADER
+--
+-- In Haddock documentation, we display @stdint.h@.  In debugging output, we
+-- display @#include (stdint.h)@.
+data Include =
+    BracketInclude     C.HashIncludeArg           -- ^ @#include <...>@
+  | QuoteInclude       C.HashIncludeArg           -- ^ @#include "..."@
+  | MacroInclude       C.HashIncludeArg MacroArg  -- ^ Macro @#include@ argument
+  | BracketIncludeNext C.HashIncludeArg           -- ^ @#include_next <...>@
+  | QuoteIncludeNext   C.HashIncludeArg           -- ^ @#include_next "..."@
+  | MacroIncludeNext   C.HashIncludeArg MacroArg  -- ^ Macro @#include_next@ argument
+  deriving stock (Show, Eq, Ord)
+
+-- | Macro argument
+--
+-- This is the raw text of a macro argument to @#include@ or @#include_next@.
+type MacroArg = Text
+
+-- | Get the 'C.HashIncludeArg' for an 'Include'
+getIncludeArg :: Include -> C.HashIncludeArg
+getIncludeArg = \case
+    BracketInclude     arg   -> arg
+    QuoteInclude       arg   -> arg
+    MacroInclude       arg _ -> arg
+    BracketIncludeNext arg   -> arg
+    QuoteIncludeNext   arg   -> arg
+    MacroIncludeNext   arg _ -> arg
+
+-- | Get the 'MacroArg' for an 'Include'
+getIncludeMacroArg :: Include -> Maybe MacroArg
+getIncludeMacroArg = \case
+    BracketInclude{}                   -> Nothing
+    QuoteInclude{}                     -> Nothing
+    MacroInclude         _arg macroArg -> Just macroArg
+    BracketIncludeNext{}               -> Nothing
+    QuoteIncludeNext{}                 -> Nothing
+    MacroIncludeNext     _arg macroArg -> Just macroArg
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+empty :: IncludeGraph
+empty = IncludeGraph Digraph.empty
+
+register ::
+     Node     -- ^ Header that includes the following header
+  -> Include
+  -> RealPath -- ^ Path of the included header
+  -> IncludeGraph
+  -> IncludeGraph
+register header include incHeader includeGraph = IncludeGraph $
+    Digraph.insertEdge (HeaderNode incHeader) include header includeGraph.graph
+
+fromList :: [(Node, Include, RealPath)] -> IncludeGraph
+fromList edges = List.foldl' add empty edges
+  where
+    add :: IncludeGraph -> (Node, Include, RealPath) -> IncludeGraph
+    add graph (fr, inc, to) = register fr inc to graph
+
+{-------------------------------------------------------------------------------
+  Query
+-------------------------------------------------------------------------------}
+
+reaches :: IncludeGraph -> RealPath -> Set RealPath
+reaches includeGraph path =
+      Set.fromList
+    . mapMaybe headerPath
+    . Set.toList
+    $ Digraph.reaches (Set.singleton (HeaderNode path)) includeGraph.graph
+
+toSortedList :: IncludeGraph -> [RealPath]
+toSortedList = mapMaybe headerPath . Digraph.sort . (.graph)
+
+getIncludes ::
+     IncludeGraph
+  -> RealPath
+  -> Digraph.FindEdgesResult Include
+getIncludes includeGraph path =
+    Digraph.findEdges (HeaderNode path) includeGraph.graph
+
+{-------------------------------------------------------------------------------
+  Include order
+-------------------------------------------------------------------------------}
+
+-- | Position of a source in the include order
+--
+-- The constructor order /is/ the specification: the command line and then the
+-- root header precede every real source, and an unknown path sorts last. Do not
+-- reorder.
+data IncludeOrderIx =
+    -- | The command line
+    --
+    -- Clang processes @-D@ options before the root header.
+    InCommandLine
+    -- | The root header
+    --
+    -- The root header is synthetic and not a source file, so it is not part of
+    -- the include order proper. Anything located in it comes from a root
+    -- directive, i.e. directly from the user, and hence precedes every real
+    -- source.
+  | InRootHeader
+    -- | Position in the topologically sorted include graph
+  | InIncludeGraph Int
+    -- | Path unknown to the include graph
+    --
+    -- Reaching this is a bug; see
+    -- 'HsBindgen.Frontend.Pass.Select.IsPass.SelectSourceNotInIncludeGraph'.
+  | NotInIncludeGraph
+  deriving stock (Show, Eq, Ord)
+
+-- | The include order of a t'IncludeGraph', for repeated lookup
+newtype IncludeOrder = IncludeOrder (Map RealPath Int)
+
+toIncludeOrder :: IncludeGraph -> IncludeOrder
+toIncludeOrder graph = IncludeOrder $ Map.fromList (zip (toSortedList graph) [0..])
+
+lookupIncludeOrder :: IncludeOrder -> C.DeclPath -> IncludeOrderIx
+lookupIncludeOrder (IncludeOrder order) = \case
+    C.OnCommandLine -> InCommandLine
+    C.InRootHeader  -> InRootHeader
+    C.InHeader path ->
+      maybe NotInIncludeGraph InIncludeGraph (Map.lookup path order)
+
+{-------------------------------------------------------------------------------
+  Visualization
+-------------------------------------------------------------------------------}
+
+-- | Include graph predicate
+type Predicate = RealPath -> Bool
+
+-- | How should we show the include header?
+data HeaderLabelStyle =
+    -- | Show the @#include@ argument, which is usually shorter
+    ShowIncludeArgs
+    -- | Show paths of include header files
+  | ShowPaths
+  deriving stock (Show, Eq)
+
+-- | How should we render the include graph?
+data IncludeGraphFormat =
+    -- | Mermaid diagram
+    Mermaid
+    -- | Topologically sorted list of headers, one per line
+  | SortedList
+  deriving stock (Show, Eq)
+
+data VisOpts = VisOpts {
+      -- | Only show vertices satisfying the predicate
+      --
+      -- Edges that traverse removed vertices are combined.
+      --
+      -- Example:
+      --
+      -- @
+      --   A-->B-->C
+      --       |
+      --       +-->D
+      -- @
+      --
+      -- Removal of vertex 'B' results in the following graph:
+      --
+      -- @
+      --   A-->C
+      --   |
+      --   +-->D
+      -- @
+      --
+      -- Combined edges are rendered using dotted lines instead of solid lines.
+      predicate :: Predicate
+
+      -- | How should we show the include header?
+    , labelStyle :: HeaderLabelStyle
+    }
+
+-- | Render a Mermaid diagram
+--
+-- See t'VisOpts'.
+renderMermaid :: VisOpts -> IncludeGraph -> String
+renderMermaid o g =
+      Digraph.renderMermaid opts
+    . Digraph.combineParallelEdges combineParallel
+    . Digraph.filterVerticesCombineEdges (isShown o) combineSequential
+    . Digraph.mapEdges (const Direct)
+    $ Digraph.mapVerticesOutgoingEdges Vertex g.graph
+  where
+    opts :: Digraph.VisOptions Edge Vertex
+    opts = Digraph.VisOptions{
+        visVertex = \v -> Digraph.VisVertex{
+            label = Just (vertexLabel o v)
+          }
+      , visEdge = \e -> Digraph.VisEdge{
+            label = Nothing
+          , style = case e of
+              Direct    -> Digraph.Solid
+              Transient -> Digraph.Dotted
+          }
+      , reverseEdges = True
+      }
+
+-- | Render the include graph as a topologically sorted list of headers
+--
+-- One header per line, in an order such that a header is listed only after all
+-- the headers it @#include@s.  This is the linear form of 'toSortedList'; the
+-- t'VisOpts' 'predicate' and 'labelStyle' fields filter and label exactly as for
+-- 'renderMermaid'.
+renderSortedList :: VisOpts -> IncludeGraph -> String
+renderSortedList o g =
+      unlines
+    . map (vertexLabel o)
+    . filter (isShown o)
+    $ Digraph.sort annotated
+  where
+    annotated :: Digraph Include Vertex
+    annotated = Digraph.mapVerticesOutgoingEdges Vertex g.graph
+
+-- | Include graph vertex, annotated with the @#include@s of that vertex
+--
+-- The @#include@s are attached before filtering, so a main header keeps the
+-- root directive that includes it even though the root header is not shown.
+data Vertex = Vertex {
+      node     :: Node
+    , includes :: Set Include
+    }
+  deriving stock (Show, Eq, Ord)
+
+data Edge = Direct | Transient
+  deriving stock (Show, Eq, Ord)
+
+-- | Is the vertex shown? The root header never is.
+isShown :: VisOpts -> Vertex -> Bool
+isShown o v = maybe False o.predicate (headerPath v.node)
+
+-- | Display label for a vertex: its resolved path, or the shortest @#include@
+-- argument used to include it (see t'VisOpts' @labelStyle@).
+vertexLabel :: VisOpts -> Vertex -> String
+vertexLabel o v = case v.node of
+    RootNode        -> getSourcePath RootHeader.name
+    HeaderNode path -> case o.labelStyle of
+      ShowPaths       -> getRealPath path
+      ShowIncludeArgs -> getIncludePath path v.includes
+
+getIncludePath :: RealPath -> Set Include -> FilePath
+getIncludePath path =
+      safeHead
+    . List.sortOn length
+    . map ((.path) . getIncludeArg)
+    . Set.elems
+  where
+    safeHead :: [FilePath] -> FilePath
+    safeHead []    = getRealPath path
+    safeHead (x:_) = x
+
+-- | Sequential combination of simple include edges.
+--
+-- @
+-- A---D--->B---D--->C
+--
+-- A--------I------->C
+-- @
+combineSequential :: Edge -> Edge -> Edge
+combineSequential _ _ = Transient
+
+-- | Parallel combination of simple include edges.
+--
+-- @
+-- A---D--->B---D--->C
+-- |                 ^
+-- |                 |
+-- ---------D---------
+--
+-- A--------I------->C
+-- |                 ^
+-- |                 |
+-- ---------D---------
+-- @
+combineParallel :: Edge -> Edge -> Edge
+combineParallel (Direct   ) (_        ) = Direct
+combineParallel (_        ) (Direct   ) = Direct
+combineParallel (Transient) (Transient) = Transient
diff --git a/src-internal/HsBindgen/Frontend/Analysis/Typedefs.hs b/src-internal/HsBindgen/Frontend/Analysis/Typedefs.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/Typedefs.hs
@@ -0,0 +1,308 @@
+-- | Analyse typedefs
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Frontend.Analysis.Typedefs (TypedefAnalysis)
+-- > import HsBindgen.Frontend.Analysis.Typedefs qualified as TypedefAnalysis
+module HsBindgen.Frontend.Analysis.Typedefs (
+    TypedefAnalysis(..)
+  , Conclusion(..)
+  , Squash(..)
+  , fromDecls
+  ) where
+
+import Data.Map.Strict qualified as Map
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis
+import HsBindgen.Frontend.Analysis.DeclUseGraph (DeclUseGraph)
+import HsBindgen.Frontend.Analysis.DeclUseGraph qualified as DeclUseGraph
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass (ResolveBindingSpecs)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Typedef analysis
+--
+-- See 'Conclusion' for detailed discussion.
+data TypedefAnalysis = TypedefAnalysis{
+      map :: Map C.DeclId Conclusion
+    }
+  deriving stock (Show)
+
+instance Semigroup TypedefAnalysis where
+  a <> b = TypedefAnalysis{
+        map = Map.unionWithKey unexpectedOverlap a.map b.map
+      }
+    where
+      unexpectedOverlap :: C.DeclId -> Conclusion -> Conclusion -> Conclusion
+      unexpectedOverlap declId conclusion1 conclusion2 =
+          panicPure $ concat [
+              "Unexpected overlap for "
+            , show declId
+            , ": "
+            , show (conclusion1, conclusion2)
+            ]
+
+instance Monoid TypedefAnalysis where
+  mempty = TypedefAnalysis{
+        map = Map.empty
+      }
+
+data Squash = SquashTypedef {
+      typedefLoc :: SingleLoc C.DeclPath
+    , targetId   :: C.DeclId
+    }
+  deriving stock (Eq, Show, Generic)
+
+-- | What should we do with a particular declaration?
+--
+-- NOTE: The /absence/ of a conclusion in the t'TypedefAnalysis' indicates that
+-- we should leave the declaration as-is.
+data Conclusion =
+    -- | Squash typedef
+    --
+    -- Squashing means removing the declaration of the typedef from the list of
+    -- declarations altogether, so that we do not generate a Haskell datatype
+    -- for it. We squash typedefs if
+    --
+    -- 1. We have a typedef around a declaration of the same name
+    --
+    --    > typedef struct foo { .. } foo;
+    --
+    --    This helps avoid name clashes in Haskell.
+    --
+    -- 2. The typedef is the /only/ reference to the underlying decl:
+    --
+    --    > typedef struct foo { .. } foo_t;
+    --
+    --    In this case @foo_t@ is just a syntactic convenience for @struct foo@,
+    --    rather than indicating some kind of semantic difference. Since the
+    --    @struct@ prefix is /anyway/ not present in Haskell, that syntactic
+    --    convenience is irrelevant there and we squash this typedef also.
+    --
+    -- The name mangler must be instructed to use the name of the typedef for
+    -- the struct; this after all is how C code will most likely refer to this
+    -- struct. /If/ the only two cases for squashing are the ones listed above,
+    -- this would automatically take care of use sites: assigning the name of
+    -- the typedef to the struct (in Haskell) would make no difference if they
+    -- have the same name, and would only affect the typedef itself if the names
+    -- are different, because in that case that is the /only/ use of the struct.
+    -- However, if in the future we make squashing configurable, and for example
+    -- make it possible to squash @foo_t@ in
+    --
+    -- > typedef struct foo { .. } foo_t;
+    -- > void f(struct foo x);
+    --
+    -- then use sites would also need to be handled explicitly; see also
+    -- <https://github.com/well-typed/hs-bindgen/issues/1356>.
+    Squash Squash
+
+    -- | Instruct the name mangler to add a suffix to the Haskell type
+    --   corresponding to this C type
+    --
+    -- C distinguishes between the \"tagged\" namespace and the \"ordinary\"
+    -- namespace, so that there is no name clash in
+    --
+    -- > typedef struct foo { .. } * foo;
+    --
+    -- In Haskell these live in the /same/ namespace, and so we cannot assign
+    -- the same name to both of these types. We also cannot /squash/ the typedef
+    -- in this case, because @struct foo@ and (the typedef) @foo@ are
+    -- /different/ types. We must therefore instruct the name mangler to use
+    -- a different name for one of these two types; we add a suffix.
+  | AddSuffix Text
+
+    -- | Instruct the name mangler to use the name of another C declaration
+    --
+    -- Useful in conjunction with 'HsBindgen.Frontend.Analysis.Typedefs.Squash'. That is, the C typedef is squashed,
+    -- and the squash target is assigned the name of the typedef with
+    -- 'UseNameOf'.
+  | UseNameOf C.DeclId
+  deriving stock (Show)
+
+conclude :: C.DeclId -> Conclusion -> TypedefAnalysis
+conclude declId conclusion = TypedefAnalysis $ Map.singleton declId conclusion
+
+{-------------------------------------------------------------------------------
+  Analysis proper
+-------------------------------------------------------------------------------}
+
+fromDecls :: DeclUseGraph -> [C.Decl l ResolveBindingSpecs] -> TypedefAnalysis
+fromDecls declUseGraph = mconcat . map aux
+  where
+     aux :: C.Decl l ResolveBindingSpecs -> TypedefAnalysis
+     aux decl =
+         case decl.kind of
+           C.DeclTypedef typedef ->
+             analyseTypedef declUseGraph decl.info typedef
+           _otherwise ->
+             mempty
+
+analyseTypedef ::
+      DeclUseGraph
+  -> C.DeclInfo ResolveBindingSpecs
+  -> C.Typedef ResolveBindingSpecs
+  -> TypedefAnalysis
+analyseTypedef declUseGraph typedefInfo typedef =
+    case directPayload of
+      -- The typedef is a direct alias of a tagged type: a candidate for
+      -- squashing.
+      Just payload
+        | shouldSquash payload
+        -> mconcat [
+               conclude typedefInfo.id $ Squash $ SquashTypedef {
+                   typedefLoc = typedefInfo.loc
+                 , targetId   = payload.id
+                 }
+             , conclude payload.id $ UseNameOf typedefInfo.id
+             ]
+
+      -- Otherwise, suffix every tagged type that is referenced /within/ the
+      -- typedef's own type and that would mangle to the same Haskell name as the
+      -- typedef itself.
+      --
+      -- This is a purely /local/ decision: it depends only on this typedef's
+      -- name and its own type structure, never on which other declarations
+      -- happen to be in scope. We can only resolve a name clash here when the
+      -- clashing tagged type is syntactically referenced by the typedef; clashes
+      -- with unrelated declarations of the same name are detected (and reported)
+      -- by the collision check in "HsBindgen.Frontend.Pass.MangleNames".
+      _otherwise ->
+        foldMap suffixClashingPayload clashingPayloads
+  where
+    typedefName :: Text
+    typedefName = typedefInfo.id.name.text
+
+    -- All tagged types referenced anywhere within the typedef's type.
+    payloads :: [TaggedPayload]
+    payloads = taggedPayloads typedef.typ
+
+    -- The tagged type the typedef is a direct alias of (the head of the type,
+    -- reached without any indirection), if any.
+    directPayload :: Maybe TaggedPayload
+    directPayload = case [ p | p <- payloads, p.isDirect ] of
+        p : _      -> Just p
+        _otherwise -> Nothing
+
+    -- Tagged types referenced /through indirection/ within the typedef's type
+    -- whose name clashes with the typedef itself.
+    --
+    -- A single typedef can reference the same tagged type more than once (e.g. a
+    -- function-pointer typedef with several arguments of that type), so we
+    -- deduplicate by 'C.DeclId': each clashing tag must yield exactly one
+    -- 'AddSuffix' conclusion, otherwise the 'TypedefAnalysis' '<>' would panic on
+    -- the duplicate key.
+    clashingPayloads :: [TaggedPayload]
+    clashingPayloads = Map.elems $ Map.fromList [
+          (p.id, p)
+        | p <- payloads
+        , not p.isDirect
+        , p.id.name.text == typedefName
+        ]
+
+    shouldSquash :: TaggedPayload -> Bool
+    shouldSquash payload = or [
+          payload.id.name.text == typedefName
+        , length useSites == 1
+        ]
+      where
+        useSites :: [(C.DeclId, Dependency)]
+        useSites = DeclUseGraph.getUseSitesNoSelfReferences declUseGraph payload.id
+
+    suffixClashingPayload :: TaggedPayload -> TypedefAnalysis
+    suffixClashingPayload payload =
+        conclude payload.id $ AddSuffix $ tagSuffix payload.id.name.kind
+
+-- | The (deterministic) suffix used to disambiguate a tagged type from a
+-- same-named typedef.
+--
+-- We suffix the /tagged/ type (and not the typedef) because C code refers to a
+-- typedef by its bare name, but to a tagged type via its @struct@\/@union@\/
+-- @enum@ keyword; the suffix mirrors that keyword.
+tagSuffix :: C.NameKind -> Text
+tagSuffix = \case
+    C.NameKindTagged C.TagKindStruct -> "_struct"
+    C.NameKindTagged C.TagKindUnion  -> "_union"
+    C.NameKindTagged C.TagKindEnum   -> "_enum"
+    -- Only tagged types are ever suffixed (see 'taggedPayloads'), so this is
+    -- unreachable; we panic rather than invent a plausible-but-wrong suffix.
+    kind -> panicPure $ "tagSuffix: unexpected non-tagged name kind " ++ show kind
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: typedefs around "tagged" decls (structs, unions, enums)
+
+  We only need to worry about typedefs around tagged declarations, because only
+  then there is a chance of name clashes (in Haskell we do not distinguish
+  between the tagged and ordinary namespaces).
+-------------------------------------------------------------------------------}
+
+data TaggedPayload = TaggedPayload{
+      isDirect :: Bool
+    , id       :: C.DeclId
+    }
+
+-- | All tagged declarations (struct, union, enum) referenced within a type.
+--
+-- The 'isDirect' flag is 'True' only for a tagged type that the typedef is a
+-- direct alias of, i.e. one reached without going through any indirection
+-- (pointer, array, function, block). A qualifier (such as @const@) is
+-- transparent: it changes neither the Haskell representation nor the mangled
+-- name, so a tagged type underneath it stays direct.
+--
+-- Any layer of indirection means the tagged type and the typedef are
+-- /different/ types that nonetheless mangle to the same Haskell name, so the
+-- tagged type must be given a suffix. This covers
+--
+-- > typedef struct {..} * foo;
+-- > typedef struct {..} foo[10];
+-- > typedef struct foo (*foo)(struct bar arg);
+-- > typedef const struct foo * foo;
+--
+-- See <https://github.com/well-typed/hs-bindgen/issues/1445>. Note that we
+-- recurse into /function/ types (both the result and the argument types), so a
+-- tagged type referenced there is detected as well.
+taggedPayloads :: C.Type ResolveBindingSpecs -> [TaggedPayload]
+taggedPayloads = go True
+  where
+    go :: Bool -> C.Type ResolveBindingSpecs -> [TaggedPayload]
+    go direct = \case
+        C.TypeRef declId         -> typeRef direct declId
+        C.TypeEnum ref           -> typeRef direct ref.name
+
+        -- A qualifier (e.g. @const@) is transparent: it changes neither the
+        -- Haskell representation nor the mangled name, so the tagged type
+        -- underneath is reached with the /same/ directness.
+        C.TypeQual _qual ty      -> go direct ty
+
+        -- Indirection: the tagged type underneath is a /different/ type that
+        -- merely mangles to the same name, so it is no longer direct.
+        C.TypePointers _n ty     -> go False ty
+        C.TypeConstArray _n ty   -> go False ty
+        C.TypeIncompleteArray ty -> go False ty
+        C.TypeBlock ty           -> go False ty
+        C.TypeFun args res       ->
+          concatMap (go False . (.typ)) args ++ go False res
+
+        -- No tagged type to find.
+        C.TypePrim{}             -> []
+        C.TypeComplex{}          -> []
+        C.TypeVoid               -> []
+
+        -- A macro type and another typedef each have their own name; the tagged
+        -- type they may wrap is not /syntactically/ referenced by this typedef,
+        -- so resolving such a clash is out of scope for this local analysis.
+        C.TypeMacro{}            -> []
+        C.TypeTypedef{}          -> []
+        C.TypeExtBinding{}       -> []
+
+    typeRef :: Bool -> C.DeclId -> [TaggedPayload]
+    typeRef isDirect declId =
+        case C.checkIsTagged declId.name.kind of
+          Nothing -> []
+          Just _  -> [TaggedPayload{isDirect = isDirect, id = declId}]
diff --git a/src-internal/HsBindgen/Frontend/Analysis/UnnamedIdUsage.hs b/src-internal/HsBindgen/Frontend/Analysis/UnnamedIdUsage.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/UnnamedIdUsage.hs
@@ -0,0 +1,290 @@
+-- | Analyse usage of unnamed declarations
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Frontend.Analysis.UnnamedIdUsage (UnnamedIdUsageAnalysis)
+-- > import HsBindgen.Frontend.Analysis.UnnamedIdUsage qualified as UnnamedIdUsageAnalysis
+module HsBindgen.Frontend.Analysis.UnnamedIdUsage (
+    UnnamedIdUsageAnalysis(..)
+  , Context(..)
+  , fromDecls
+  ) where
+
+import Data.Map qualified as Map
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.Pass.Parse.IsPass (Parse)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | How are unnamed data types used?
+data UnnamedIdUsageAnalysis = UnnamedIdUsageAnalysis{
+      map :: Map C.UnnamedId Context
+    }
+  deriving stock (Show)
+
+data Context =
+    -- | Unnamed declaration inside a direct, named field
+    --
+    -- E.g.
+    --
+    -- > struct rect {
+    -- >   struct { int x; int y; } topleft;
+    -- >   struct { int x; int y; } bottomright;
+    -- > }
+    --
+    -- @topleft@ and @bottomright@ are fields that reference untagged structs.
+    -- Both fields are direct fields of struct @rect@.
+    --
+    -- NOTE: after the @Parse@ pass, unnamed fields can not exist. In case we
+    -- parse unnamed fields (i.e., implicit fields) in the @Parse@ pass, then we
+    -- generate a name for those fields. See the
+    -- "HsBindgen.Frontend.Pass.Parse.Decl.ImplicitFields" module for more
+    -- information.
+    --
+    -- Indirect fields are not analysed, because indirect fields only exist for
+    -- regular fields and those will have been analysed already.
+    --
+    -- E.g.
+    --
+    -- > struct S {
+    -- >   struct { // <-- anonymous struct
+    -- >     struct { // <-- untagged struct
+    -- >       int y;
+    -- >     } x;
+    -- >   };
+    -- > };
+    --
+    -- @x@ is a field that references an untagged struct. @x@ is a direct field
+    -- of the anonymous struct, and an indirect field of struct @rect@.
+    Field (C.DeclInfo Parse) (C.FieldInfo Parse)
+
+    -- | Direct use of unnamed declaration inside in a typedef
+    --
+    -- E.g.
+    --
+    -- > typedef struct { int; int y; } point;
+  | TypedefDirect (C.DeclInfo Parse)
+
+    -- | Indirect use of an unnamed declaration inside a typedef
+    --
+    -- The most typical example of this is
+    --
+    -- > typedef struct { int; int y; } * point;
+    --
+    -- but there are many others, such as
+    --
+    -- > typedef struct { int; int y; } points[10];
+    --
+    -- We distinguish this from 'TypedefDirect' because in the case of
+    -- 'TypedefDirect' we use the name of the typedef as the tag of the struct
+    -- (indeed, @clang >= 16@ already does this out of the box), but in the case
+    -- of 'TypedefIndirect' we add a @_Aux@ suffix, because now the two types
+    -- are meaningfully different (and @clang@ assigns no name at all).
+  | TypedefIndirect (C.DeclInfo Parse)
+
+    -- | Unnamed declaration used as the type of a global variable
+    --
+    -- E.g.
+    --
+    -- > struct { int x; int y; } a;
+    --
+    -- In this case, we use the name of the global variable as the name of
+    -- the struct.
+  | GlobalVar (C.DeclInfo Parse)
+  deriving stock (Show)
+
+{-------------------------------------------------------------------------------
+  Top-level API
+-------------------------------------------------------------------------------}
+
+fromDecls :: [C.Decl l Parse] -> UnnamedIdUsageAnalysis
+fromDecls decls = UnnamedIdUsageAnalysis{
+      map = Map.fromListWithKey resolveConflicts $
+             concatMap analyseDecl decls
+    }
+
+-- | Resolve conflicts
+--
+-- Unnamed declarations can in rare circumstances have multiple use sites.
+resolveConflicts :: C.UnnamedId -> Context -> Context -> Context
+resolveConflicts unnamedId new old =
+    case (old, new) of
+      {-----------------------------------------------------------------------------
+        Fields
+      -----------------------------------------------------------------------------}
+
+      (Field decl1 _, Field decl2 _) | decl1.id == decl2.id ->
+        -- Example:
+        --
+        -- > struct rect {
+        -- >   struct { int x; int y; } tl, br;
+        -- > };
+        --
+        -- Multiple declarators for the same field.
+        -- We choose the first field (in source order).
+        old
+
+      {-----------------------------------------------------------------------------
+        Clang < 16
+      -----------------------------------------------------------------------------}
+
+      (TypedefDirect _, TypedefIndirect _) ->
+        -- Example:
+        --
+        -- > typedef struct { int x; int y; } point2a, *point2b;
+        --
+        -- Mixed direct and indirect typedefs (direct seen first).
+        old
+
+      (TypedefIndirect _, TypedefDirect _) ->
+        -- Mirror of the above case (when indirect appears first in source order).
+        new
+
+      (TypedefDirect _, TypedefDirect _) ->
+        -- Example:
+        --
+        -- > typedef struct { int x; int y; } point1a, point1b;
+        --
+        -- Multiple direct typedefs for the same untagged struct.
+        -- We choose the first typedef (in source order).
+        old
+
+      {-----------------------------------------------------------------------------
+        Clang >= 16
+      -----------------------------------------------------------------------------}
+
+      (TypedefIndirect _, TypedefIndirect _) ->
+        -- Example:
+        --
+        -- > typedef struct { int x; int y; } *point3a, *point3b;
+        --
+        -- Multiple indirect typedefs for the same untagged struct.
+        -- We choose the first typedef (in source order).
+        --
+        -- NOTE: This is the ONLY conflict case that can occur in Clang >= 16.
+        -- In Clang >= 16, when a typedef has both direct and indirect declarators
+        -- (e.g., `typedef struct { ... } a, *b;`), Clang names the untagged struct
+        -- with the first direct typedef name (@a@), and the indirect typedef ('b')
+        -- becomes a pointer to that named type. Thus no conflict exists.
+        old
+
+      _otherwise ->
+         panicPure $ concat [
+             "Conflicting use sites for "
+           , show unnamedId
+           , ": "
+           , show (old, new)
+           ]
+
+{-------------------------------------------------------------------------------
+  Declarations
+-------------------------------------------------------------------------------}
+
+-- | Analyse declaration
+--
+-- NOTE: Unnamed declarations that appear in function signatures and
+-- global variables are unusable, and so we do not assign a name to them
+-- (this will cause them to be removed from the list of declarations).
+analyseDecl :: C.Decl l Parse -> [(C.UnnamedId, Context)]
+analyseDecl decl =
+    case decl.kind of
+      C.DeclStruct               x -> analyseStruct  decl.info x
+      C.DeclUnion                x -> analyseUnion   decl.info x
+      C.DeclTypedef              x -> analyseTypedef decl.info x
+      C.DeclEnum                 _ -> []
+      C.DeclUntaggedEnumConstant _ -> []
+      C.DeclOpaque{}               -> []
+      C.DeclMacro                _ -> []
+      C.DeclFunction             _ -> []
+      C.DeclGlobal               x -> analyseGlobal  decl.info x.typ
+
+analyseStruct :: C.DeclInfo Parse -> C.Struct Parse -> [(C.UnnamedId, Context)]
+analyseStruct info struct = concat [
+      concatMap (analyseField info)        struct.fields
+    , foldMap   (analyseRegularField info) (C.flamStructField struct.flam)
+    ]
+
+analyseUnion :: C.DeclInfo Parse -> C.Union Parse -> [(C.UnnamedId, Context)]
+analyseUnion info union =
+    concatMap (analyseField info) union.fields
+
+analyseField :: C.DeclInfo Parse -> C.Field Parse -> [(C.UnnamedId, Context)]
+analyseField info = C.elimField (analyseRegularField info) (analyseImplicitField info)
+
+analyseRegularField :: C.DeclInfo Parse -> C.RegularField Parse -> [(C.UnnamedId, Context)]
+analyseRegularField info field = analyseType (Field info field.info) field.typ
+
+analyseImplicitField :: C.DeclInfo Parse -> C.ImplicitField Parse -> [(C.UnnamedId, Context)]
+analyseImplicitField info field = concat [
+      analyseType (Field info field.info) field.typ
+    , concatMap (analyseIndirectField info) field.indirect
+    ]
+
+analyseIndirectField :: C.DeclInfo Parse -> C.IndirectField Parse -> [(C.UnnamedId, Context)]
+analyseIndirectField _info _field =
+    -- Indirect fields can only exist if there is a direct field, and we always
+    -- prefer the direct field. See also the haddocks on 'Field'.
+    []
+
+analyseTypedef :: C.DeclInfo Parse -> C.Typedef Parse -> [(C.UnnamedId, Context)]
+analyseTypedef info typedef = analyseType (TypedefDirect info) typedef.typ
+
+analyseGlobal :: C.DeclInfo Parse -> C.Type Parse -> [(C.UnnamedId, Context)]
+analyseGlobal info = analyseType (GlobalVar info)
+
+{-------------------------------------------------------------------------------
+  Types
+
+  This is where the real work happens; the rest is just setting up context.
+-------------------------------------------------------------------------------}
+
+analyseType :: Context -> C.Type Parse -> [(C.UnnamedId, Context)]
+analyseType = go
+  where
+    go :: Context -> C.Type Parse -> [(C.UnnamedId, Context)]
+    go ctxt = \case
+        -- Base case
+        C.TypeRef ref ->
+            case ref of
+              C.PrelimDeclIdNamed{}     -> []
+              C.PrelimDeclIdUnnamed unnamedId -> [(unnamedId, ctxt)]
+        C.TypeEnum ref ->
+            case ref.name of
+              C.PrelimDeclIdNamed{}     -> []
+              C.PrelimDeclIdUnnamed unnamedId -> [(unnamedId, ctxt)]
+
+        -- Recursion
+        --
+        -- For the @const@ case, something like
+        --
+        -- > typedef const struct { .. } foo;
+        --
+        -- perhaps, we follow @libclang@ and consider this an indirect usage
+        -- (\"follow\" in the sense that @libclang@ does /not/ assign the name
+        -- of the typedef to the struct in this case; we will add the suffix).
+        C.TypePointers _n     ty -> indirect ty
+        C.TypeQual _qual ty      -> indirect ty
+        C.TypeConstArray _sz  ty -> indirect ty
+        C.TypeIncompleteArray ty -> indirect ty
+        C.TypeBlock           ty -> indirect ty
+        C.TypeFun args res       -> concatMap analyseTypeFunArg args ++ indirect res
+
+        -- Trivial cases
+        C.TypeComplex{}    -> []
+        C.TypePrim{}       -> []
+        C.TypeTypedef{}    -> []
+        C.TypeVoid{}       -> []
+      where
+        indirect :: C.Type Parse -> [(C.UnnamedId, Context)]
+        indirect =
+           case ctxt of
+             TypedefDirect declInfo -> go (TypedefIndirect declInfo)
+             _otherwise             -> go ctxt
+
+        analyseTypeFunArg :: C.TypeFunArg Parse -> [(C.UnnamedId, Context)]
+        analyseTypeFunArg arg = indirect arg.typ
diff --git a/src-internal/HsBindgen/Frontend/Analysis/UseDeclGraph.hs b/src-internal/HsBindgen/Frontend/Analysis/UseDeclGraph.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Analysis/UseDeclGraph.hs
@@ -0,0 +1,78 @@
+-- | Usage-declaration graph
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Frontend.Analysis.UseDeclGraph (UseDeclGraph)
+-- > import HsBindgen.Frontend.Analysis.UseDeclGraph qualified as UseDeclGraph
+module HsBindgen.Frontend.Analysis.UseDeclGraph (
+    -- * Definition
+    UseDeclGraph -- opaque
+    -- * Construction
+  , fromDeclUseGraph
+    -- * Query
+  , getTransitiveDeps
+  , getStrictTransitiveDeps
+    -- * Visualization
+  , renderMermaid
+  ) where
+
+import Data.Digraph (Digraph)
+import Data.Digraph qualified as Digraph
+import Data.Set qualified as Set
+
+import HsBindgen.Frontend.Analysis
+import HsBindgen.Frontend.Analysis.DeclUseGraph.Definition (DeclUseGraph)
+import HsBindgen.Frontend.Analysis.DeclUseGraph.Definition qualified as DeclUseGraph
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Declaration usage-definition graph
+--
+-- Whenever declaration @A@ uses (depends on) declaration @B@, there is an edge
+-- from @A@ to @B@ in this graph.
+data UseDeclGraph = UseDeclGraph {
+      graph :: Digraph Dependency C.DeclId
+    }
+  deriving stock (Show, Eq)
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+fromDeclUseGraph :: DeclUseGraph -> UseDeclGraph
+fromDeclUseGraph declUseGraph = UseDeclGraph{
+      graph = Digraph.transpose $ DeclUseGraph.toDigraph declUseGraph
+    }
+
+{-------------------------------------------------------------------------------
+  Query
+-------------------------------------------------------------------------------}
+
+getTransitiveDeps :: UseDeclGraph -> Set C.DeclId -> Set C.DeclId
+getTransitiveDeps useDeclGraph decls = Digraph.reaches decls useDeclGraph.graph
+
+getStrictTransitiveDeps :: UseDeclGraph -> Set C.DeclId -> Set C.DeclId
+getStrictTransitiveDeps graph decls = getTransitiveDeps graph decls Set.\\ decls
+
+{-------------------------------------------------------------------------------
+  Visualization
+-------------------------------------------------------------------------------}
+
+renderMermaid :: UseDeclGraph -> String
+renderMermaid useDeclGraph = Digraph.renderMermaid opts useDeclGraph.graph
+  where
+    opts :: Digraph.VisOptions Dependency C.DeclId
+    opts = Digraph.VisOptions{
+        visVertex = \v -> Digraph.VisVertex{
+            label = Just (show v)
+          }
+      , visEdge   = \e -> Digraph.VisEdge{
+            label = Just (show e)
+          , style = Digraph.Solid
+          }
+      , reverseEdges = False
+      }
diff --git a/src-internal/HsBindgen/Frontend/DeclMeta.hs b/src-internal/HsBindgen/Frontend/DeclMeta.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/DeclMeta.hs
@@ -0,0 +1,20 @@
+-- Intended for unqualified import
+module HsBindgen.Frontend.DeclMeta (
+    DeclMeta(..)
+  ) where
+
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.Analysis.DeclUseGraph.Definition (DeclUseGraph)
+import HsBindgen.Frontend.Analysis.UseDeclGraph (UseDeclGraph)
+import HsBindgen.Imports
+
+{-------------------------------------------------------------------------------
+  Information about the declarations
+-------------------------------------------------------------------------------}
+
+data DeclMeta l = DeclMeta {
+      declIndex    :: DeclIndex l
+    , useDeclGraph :: UseDeclGraph
+    , declUseGraph :: DeclUseGraph
+    }
+  deriving stock (Show, Generic)
diff --git a/src-internal/HsBindgen/Frontend/LanguageC.hs b/src-internal/HsBindgen/Frontend/LanguageC.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/LanguageC.hs
@@ -0,0 +1,204 @@
+{-# LANGUAGE CPP #-}
+
+-- | Main entry point to the @language-c@ infrastructure
+--
+-- It should not be necessary to import any other module in @LanguageC.*@ (but
+-- to avoid circular module imports).
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Frontend.LanguageC qualified as LanC
+module HsBindgen.Frontend.LanguageC (
+    Parser
+  , Error(..)
+  , reparseFunDecl
+  , reparseTypedef
+  , reparseField
+  , reparseGlobal
+    -- * Scoping
+  , CName
+  , ReparseEnv(..)
+  , bespokeTypes
+  ) where
+
+import Control.Monad.State (State)
+import Control.Monad.State qualified as State
+import Data.Map (Map)
+import Data.Map qualified as Map
+import Data.Set qualified as Set
+import Data.Text qualified as Text
+import Data.Tuple (swap)
+import Language.C qualified as LanC
+import Language.C.Data.Position qualified as LanC
+
+import Clang.CStandard
+import Clang.HighLevel.Types qualified as Clang
+import Clang.Paths qualified as Clang
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.LanguageC.Error
+import HsBindgen.Frontend.LanguageC.Monad
+import HsBindgen.Frontend.LanguageC.PartialAST
+import HsBindgen.Frontend.LanguageC.PartialAST.FromLanC
+import HsBindgen.Frontend.LanguageC.PartialAST.ToBindgen
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC
+import HsBindgen.IR.C qualified as C
+
+#if !MIN_VERSION_language_c(0,10,2)
+import HsBindgen.Language.C qualified as C
+#endif
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+type Parser a =
+     ReparseEnv
+  -> FlatTokens
+  -> Either Error a
+
+-- | Reparse function declaration
+--
+-- Returns the function parameters, function result, and function name.
+reparseFunDecl ::
+     Parser (
+         ( [(Maybe CName, C.Type LanC)]
+         , C.Type LanC
+         )
+       , CName
+       )
+reparseFunDecl = parseWith (fmap swap . fromFunDecl)
+
+-- | Reparse typedef
+reparseTypedef :: Parser (C.Type LanC)
+reparseTypedef = parseWith (fmap snd . fromDecl)
+
+-- | Reparse struct/union field
+reparseField :: Parser (C.Type LanC, CName)
+reparseField = parseWith (fmap swap .  fromNamedDecl)
+
+-- | Reparse global variable declaration
+reparseGlobal :: Parser (C.Type LanC)
+reparseGlobal = parseWith (fmap snd . fromDecl)
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: run the language-c parser
+-------------------------------------------------------------------------------}
+
+parseWith ::
+     (PartialDecl -> FromLanC a)
+     -- ^ Construct our AST from the partial declaration
+  -> Parser a
+parseWith fromPartial env tokens =
+    runFromLanC env $ do
+      partial <- parseUsingLanC tokens.locStart tokens.flatten
+      fromPartial partial
+
+parseUsingLanC ::
+     Clang.MultiLoc Clang.SourcePath -- ^ Approximate location of the string in the source
+  -> String         -- ^ Raw string
+  -> FromLanC PartialDecl
+parseUsingLanC mloc raw = do
+    reparseEnv <- getReparseEnv
+
+    let predefinedTypes' :: [LanC.Ident]
+        uniqNameSupply   :: [LanC.Name]
+        (predefinedTypes', uniqNameSupply) = runWithNewNameSupply $ do
+            mapM declarePredefined $ Set.toList $ getKnownTypes reparseEnv
+
+    case LanC.execParser
+           LanC.extDeclP
+           (LanC.inputStreamFromString raw)
+           (multiLocToLanC mloc)
+           predefinedTypes'
+           uniqNameSupply of
+      Left err ->
+        unexpected $ show err
+      Right (fromLanC, _finalNameSupply) -> do
+        decl <- fromCDeclExt fromLanC
+        mkPartialDecl decl
+
+fromCDeclExt :: LanC.CExternalDeclaration a -> FromLanC (LanC.CDeclaration a)
+fromCDeclExt = \case
+    LanC.CDeclExt decl -> return decl
+    other              -> unexpectedF other
+
+{-------------------------------------------------------------------------------
+  Auxiliary: locations
+-------------------------------------------------------------------------------}
+
+multiLocToLanC :: Clang.MultiLoc Clang.SourcePath -> LanC.Position
+multiLocToLanC mloc =
+    LanC.position
+      (Clang.singleLocOffset sloc)
+      (Clang.getSourcePath $ Clang.singleLocPath sloc)
+      (Clang.singleLocLine   sloc)
+      (Clang.singleLocColumn sloc)
+      Nothing -- @posParentFile@ in @language-c@: "including file, if any"
+  where
+    -- NOTE: It might make sense to use 'multiLocPresumed' instead, but these
+    -- don't provide file offsets (see 'Clang.PresumedLoc').
+    sloc :: Clang.SingleLoc Clang.SourcePath
+    sloc = Clang.multiLocExpansion mloc
+
+{-------------------------------------------------------------------------------
+  Construct type environment
+-------------------------------------------------------------------------------}
+
+-- | \"Primitives\" we expect the reparser to recognize
+--
+-- The @language-c@ parser does not support these explicitly.
+bespokeTypes :: ClangCStandard -> Map CName (C.Type p)
+bespokeTypes = Map.fromList . \case
+#if !MIN_VERSION_language_c(0,10,2)
+    -- Make sure that we really only replace keywords lacking definitions.
+    --
+    -- If we add entries for types to `bespokeTypes` which are not keywords
+    -- (i.e., are not part of the standard), we will pretend to know what these
+    -- types are, but the actual type must come from a header, and we actually
+    -- do not know what that definition is.
+    ClangCStandard C23 _gnu -> [("bool", C.TypePrim C.PrimBool)]
+#endif
+    _otherwise -> []
+
+{-------------------------------------------------------------------------------
+  Auxiliary language-c: working with the unique name supply
+-------------------------------------------------------------------------------}
+
+newtype WithNameSupply a = WrapWithNameSupply (State [LanC.Name] a)
+  deriving newtype (
+      Functor
+    , Applicative
+    , Monad
+    )
+
+runWithNameSupply :: [LanC.Name] -> WithNameSupply a -> (a, [LanC.Name])
+runWithNameSupply supply (WrapWithNameSupply ma) = State.runState ma supply
+
+runWithNewNameSupply :: WithNameSupply a -> (a, [LanC.Name])
+runWithNewNameSupply = runWithNameSupply LanC.newNameSupply
+
+getUniqueName :: WithNameSupply LanC.Name
+getUniqueName = WrapWithNameSupply $ State.state aux
+  where
+    aux :: [LanC.Name] -> (LanC.Name, [LanC.Name])
+    aux (n:ns) = (n,ns)
+    aux []     = panicPure "No more unique names"
+
+declarePredefined :: CName -> WithNameSupply LanC.Ident
+declarePredefined name =
+    LanC.mkIdent LanC.nopos (Text.unpack name) <$> getUniqueName
+
+{-------------------------------------------------------------------------------
+  Debugging
+-------------------------------------------------------------------------------}
+
+_testLanCParser :: [String] -> String -> Either LanC.ParseError LanC.CExtDecl
+_testLanCParser predefinedTypes input = fst <$>
+    LanC.execParser
+      LanC.extDeclP
+      (LanC.inputStreamFromString input)
+      LanC.nopos
+      (map LanC.builtinIdent predefinedTypes)
+      LanC.newNameSupply
diff --git a/src-internal/HsBindgen/Frontend/LanguageC/Error.hs b/src-internal/HsBindgen/Frontend/LanguageC/Error.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/LanguageC/Error.hs
@@ -0,0 +1,102 @@
+-- | Errors arising from interacting with @language-c@
+--
+-- Defined in its own module to avoid cyclic module dependencies.
+module HsBindgen.Frontend.LanguageC.Error (
+    Error(..)
+  ) where
+
+import GHC.Stack
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+data Error =
+    -- | We encountered something unexpected in the AST from language-c
+    --
+    -- This indicates a bug or something not yet implemented.
+    UpdateUnexpected CallStack String
+
+    -- | We encountered something in the language-c AST we don't not support
+    --
+    -- It is useful to distinguish known-to-be-unsupported from
+    -- unknown-to-be-supported ('UpdateUnexpected'): the latter indicates that
+    -- it's simply something we haven't considered yet, the former is a
+    -- conscious decision about features we currently don't want to support.
+  | UpdateUnsupported String
+
+    -- | We encountered something in the language-c AST that allows us to skip
+    -- the current reparse
+    --
+    -- The reparser constructs an hs-bindgen AST from a language-c AST,
+    -- inserting references to macro types. We can skip the current reparse if
+    -- we are in a known case where no references to macro types can be inserted
+    -- anymore, which would mean reparsing is just the identity funcion. Such is
+    -- the case when we try to reparse a type that references a struct or union.
+    -- In such cases skipping is useful because a reference to a *nested*
+    -- struct\/union would otherwise incur an 'UpdateUnsupported' or
+    -- 'UpdateUnexpected' error.
+    --
+    -- We reparse four types of declarations:
+    -- * global variable declarations
+    -- * typedef declarations
+    -- * function declarations
+    -- * struct/union field declarations
+    --
+    -- The types of nesting that can occur are:
+    -- * struct/union (field) nested in global variable
+    -- * struct/union (field) nested in typedef
+    -- * struct/union (field) nested in function
+    -- * struct/union (field) nested in struct/union field
+    --
+    -- An enclosing declaration can not contain both a reference to a (nested)
+    -- struct or (nested) union, and a reference to a macro type. Therefore, we
+    -- know that we can skip reparsing if we identify a reference to a struct or
+    -- union.
+    --
+    -- === Example
+    --
+    -- For example, if we are reparsing typedef @foo@:
+    --
+    -- > #define MyInt int
+    -- > #define MyConst const
+    -- > typedef MyConst struct S { MyInt x; } * foo;
+    --
+    -- Even though @MyConst@ is referenced from @foo@, it is not parsed as a
+    -- macro, so there is nothing to do for the reparser there. Then we can skip
+    -- reparsing @foo@ once we see that @foo@ references struct @S@, because we
+    -- will reparse the @x@ field of struct @S@ separately.
+    --
+  | UpdateSkipped String
+  deriving stock (Show)
+
+instance PrettyForTrace Error where
+  prettyForTrace (UpdateUnexpected cs str) = PP.vsep [
+        PP.hsep [
+            "Encountered unexpected node in the language-c AST: "
+          , PP.string str
+          ]
+      , PP.string (prettyCallStack cs)
+      ]
+  prettyForTrace (UpdateUnsupported err) =
+        PP.hsep [
+            "Unsupported: "
+          , PP.string err
+          ]
+  prettyForTrace (UpdateSkipped msg) =
+        PP.hsep [
+            "Skipped: "
+          , PP.string msg
+          ]
+
+-- | Unsupported features are warnings
+instance IsTrace Level Error where
+  getDefaultLogLevel = \case
+      UpdateUnexpected{}  -> Info
+      UpdateUnsupported{} -> Info
+      UpdateSkipped{}     -> Debug
+  getSource  = const HsBindgen
+  getTraceId _ = "parse-macro"
diff --git a/src-internal/HsBindgen/Frontend/LanguageC/Monad.hs b/src-internal/HsBindgen/Frontend/LanguageC/Monad.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/LanguageC/Monad.hs
@@ -0,0 +1,147 @@
+-- | Monad we use when translating the language-c AST to our AST
+--
+-- Intended for unqualified import.
+module HsBindgen.Frontend.LanguageC.Monad (
+    FromLanC(..)
+  , ReparseEnv(..)
+  , runFromLanC
+  , getReparseEnv
+  , getKnownTypes
+  , lookupType
+    -- * Throwing errors
+  , unexpected
+  , unsupported
+  , skipped
+  , nodeOmitted
+  , unexpectedF
+    -- * Util
+  , repeatedly
+  , optionally
+  ) where
+
+import Control.Monad.Except (ExceptT, MonadError (..))
+import Control.Monad.Except qualified as Except
+import Control.Monad.Reader (Reader)
+import Control.Monad.Reader qualified as Reader
+import Data.Foldable qualified as Foldable
+import Data.Map qualified as Map
+import Data.Set qualified as Set
+import GHC.Stack
+
+import HsBindgen.Frontend.LanguageC.Error
+import HsBindgen.Frontend.LanguageC.PartialAST (CName)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC (LanC)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Monad used to translate from the @language-c@ AST to our AST
+newtype FromLanC a = WrapFromLanC (
+      ExceptT Error (Reader ReparseEnv) a
+    )
+  deriving newtype (
+      Functor
+    , Applicative
+    , Monad
+    , MonadError Error
+    )
+
+-- | Types in scope when reparsing a particular declaration
+data ReparseEnv = ReparseEnv {
+    -- | Known @typedef@s
+    knownTypes      :: Map CName (C.Type LanC)
+    -- | Known type-like macros
+    --
+    -- We store macros in a separate field, because we do not translate macros
+    -- to their full C types.
+    --
+    -- Furthermore, we only add the macros /expanded in the reparsed
+    -- declaration/ to the environment.
+  , knownMacros :: Set CName
+  }
+  deriving (Show, Eq)
+
+runFromLanC :: ReparseEnv -> FromLanC a -> Either Error a
+runFromLanC typeEnv (WrapFromLanC ma) =
+      flip Reader.runReader typeEnv $
+        Except.runExceptT ma
+
+getReparseEnv :: FromLanC ReparseEnv
+getReparseEnv = WrapFromLanC Reader.ask
+
+getKnownTypes :: ReparseEnv -> Set CName
+getKnownTypes env = Map.keysSet env.knownTypes <> env.knownMacros
+
+lookupType :: CName -> ReparseEnv -> Maybe (C.Type LanC)
+lookupType nm env =
+    case (Set.member nm env.knownMacros, Map.lookup nm env.knownTypes) of
+      -- Macro types take priority: a typedef and a type-like macro may share the
+      -- same bare name (e.g. 'bool' from stdbool.h alongside a typedef 'bool').
+      --
+      -- The underlying type '()' is a placeholder. The 'Zip' intermediate pass
+      -- fills it in by consulting the annotation carrying information from
+      -- pre-reparse 'PrepareReparse'.
+      (True,  _)            -> Just (C.TypeMacro (C.MacroRef macroId ()))
+      (False, mTypedefType) -> mTypedefType
+  where
+    macroId :: C.DeclId
+    macroId = C.DeclId{
+        name      = C.DeclName nm C.NameKindMacro
+      , isUnnamed = False
+      }
+
+{-------------------------------------------------------------------------------
+  Throwing errors
+-------------------------------------------------------------------------------}
+
+unexpected :: HasCallStack => String -> FromLanC x
+unexpected = throwError . UpdateUnexpected callStack
+
+unsupported :: String -> FromLanC x
+unsupported = throwError . UpdateUnsupported
+
+skipped :: String -> FromLanC x
+skipped = throwError . UpdateSkipped
+
+data NodeOmitted = NodeOmitted
+  deriving (Show)
+
+nodeOmitted :: Functor f => f a -> f NodeOmitted
+nodeOmitted = fmap (const NodeOmitted)
+
+unexpectedF ::
+     (HasCallStack, Functor f, Show (f NodeOmitted))
+  => f a -> FromLanC x
+unexpectedF = unexpected . show . nodeOmitted
+
+{-------------------------------------------------------------------------------
+  Utility
+-------------------------------------------------------------------------------}
+
+-- | Run updates in order
+--
+-- Given
+--
+-- > addSuffix :: Update Int String
+-- > addSuffix n str = return $ str ++ "_" ++ show n
+--
+-- We have
+--
+-- >    runUpdateM Map.empty $ repeatedly addSuffix [1..5] "str"
+-- > == Right "str_1_2_3_4_5"
+repeatedly :: forall t a b.
+     Foldable t
+  => (  a -> b -> FromLanC b)
+  -> (t a -> b -> FromLanC b)
+repeatedly f = go . Foldable.toList
+  where
+   --  go :: [a] -> b -> UpdateM b
+    go []     b = return b
+    go (a:as) b = f a b >>= \b' -> go as b'
+
+optionally :: (a -> b -> FromLanC b) -> Maybe a -> b -> FromLanC b
+optionally = repeatedly
+
diff --git a/src-internal/HsBindgen/Frontend/LanguageC/PartialAST.hs b/src-internal/HsBindgen/Frontend/LanguageC/PartialAST.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/LanguageC/PartialAST.hs
@@ -0,0 +1,189 @@
+-- | Partial AST
+--
+-- The translation from the language-c AST to our AST is a bit awkward, because
+-- language-c will feed us information in a piecemeal fashion. We therefore
+-- introduce this \"partial AST\" as a step in the middle.
+--
+-- Intended for unqualified import.
+module HsBindgen.Frontend.LanguageC.PartialAST (
+    PartialDecl(..)
+  , PartialType(..)
+  , UnknownType(
+        ..
+      , CChar, CSChar, CUChar
+      , CShort, CSShort, CUShort
+      , CInt, CSInt, CUInt
+      , CLong, CSLong, CULong
+      , CLLong, CSLLong, CULLong
+      , CFloat, CDouble, CLDouble
+      , CTypeUnknown)
+  , Base(..)
+  , Size(..)
+  , KnownType(..)
+  , CName
+    -- * Starting point: no information known
+  , unknownDecl
+  ) where
+
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC (LanC)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+data PartialDecl = PartialDecl{
+      name :: Maybe CName
+    , typ  :: PartialType
+    }
+  deriving stock (Show, Generic)
+
+data PartialType =
+    PartialUnknown UnknownType
+  | PartialKnown KnownType
+  deriving stock (Show)
+
+data KnownType =
+    KnownType (C.Type LanC)
+
+    -- | Special case for top-level functions, so we can record argument names
+    --
+    -- It's not necessary to do this recursively: we only want argument names
+    -- for top-level function declarations (not for function pointers).
+  | TopLevelFun [(Maybe CName, C.Type LanC)] (C.Type LanC)
+  deriving stock (Show)
+
+-- | Name
+--
+-- Since @language-c@ does not really distinguish between a top-level
+-- declaration or the \"declaration\" of a function argument, we use 'Text' here
+-- rather than 'C.DeclName' or 'C.ScopedName'. Since we do not actually parse
+-- top-level struct/enum/union declarations (i.e., deal with \"ordinary\" names
+-- only anyway), this causes no trouble.
+type CName = Text
+
+{-------------------------------------------------------------------------------
+  UnknownType
+-------------------------------------------------------------------------------}
+
+-- | The type itself is not yet known, but may have some qualifiers
+data UnknownType = UnknownType{
+      base      :: [Base]
+    , sign      :: [C.PrimSign]
+    , size      :: [Size]
+    , isConst   :: Bool
+    , isComplex :: Bool
+    }
+  deriving stock (Show, Generic)
+
+data Base = Char | Int | Float | Double
+  deriving stock (Show, Eq, Ord, Generic)
+
+data Size = Short | Long
+  deriving stock (Show, Eq, Ord, Generic)
+
+{-# COMPLETE
+    CChar
+  , CSChar
+  , CUChar
+  , CShort
+  , CSShort
+  , CUShort
+  , CInt
+  , CSInt
+  , CUInt
+  , CLong
+  , CSLong
+  , CULong
+  , CLLong
+  , CSLLong
+  , CULLong
+  , CFloat
+  , CDouble
+  , CLDouble
+  , CTypeUnknown
+  #-}
+
+pattern CChar :: UnknownType
+pattern CChar <- UnknownType [Char] [] [] _ _
+
+pattern CSChar :: UnknownType
+pattern CSChar <- UnknownType [Char] [C.Signed] [] _ _
+
+pattern CUChar :: UnknownType
+pattern CUChar <- UnknownType [Char] [C.Unsigned] [] _ _
+
+pattern CShort :: UnknownType
+pattern CShort <- UnknownType (optional Int -> True) [] [Short] _ _
+
+pattern CSShort :: UnknownType
+pattern CSShort <- UnknownType (optional Int -> True) [C.Signed] [Short] _ _
+
+pattern CUShort :: UnknownType
+pattern CUShort <- UnknownType (optional Int -> True) [C.Unsigned] [Short] _ _
+
+pattern CInt :: UnknownType
+pattern CInt <- UnknownType [Int] [] [] _ _
+
+pattern CSInt :: UnknownType
+pattern CSInt <- UnknownType (optional Int -> True) [C.Signed] [] _ _
+
+pattern CUInt :: UnknownType
+pattern CUInt <- UnknownType (optional Int -> True) [C.Unsigned] [] _ _
+
+pattern CLong :: UnknownType
+pattern CLong <- UnknownType (optional Int -> True) [] [Long] _ _
+
+pattern CSLong :: UnknownType
+pattern CSLong <- UnknownType (optional Int -> True) [C.Signed] [Long] _ _
+
+pattern CULong :: UnknownType
+pattern CULong <- UnknownType (optional Int -> True) [C.Unsigned] [Long] _ _
+
+pattern CLLong :: UnknownType
+pattern CLLong <- UnknownType (optional Int -> True) [] [Long, Long] _ _
+
+pattern CSLLong :: UnknownType
+pattern CSLLong <- UnknownType (optional Int -> True) [C.Signed] [Long, Long] _ _
+
+pattern CULLong :: UnknownType
+pattern CULLong <- UnknownType (optional Int -> True) [C.Unsigned] [Long, Long] _ _
+
+pattern CFloat :: UnknownType
+pattern CFloat <- UnknownType [Float] [] [] _ _
+
+pattern CDouble :: UnknownType
+pattern CDouble <- UnknownType [Double] [] [] _ _
+
+pattern CLDouble :: UnknownType
+pattern CLDouble <- UnknownType [Double] [] [Long] _ _
+
+pattern CTypeUnknown :: UnknownType
+pattern CTypeUnknown <- UnknownType{}
+
+optional :: Eq a => a -> [a] -> Bool
+optional x = \case
+    []  -> True
+    [y] -> x == y
+    _   -> False
+
+{-------------------------------------------------------------------------------
+  Starting point: no information known
+-------------------------------------------------------------------------------}
+
+unknownDecl :: PartialDecl
+unknownDecl = PartialDecl{
+      name = Nothing
+    , typ  = unknownType
+    }
+
+unknownType :: PartialType
+unknownType = PartialUnknown UnknownType{
+      base      = []
+    , sign      = []
+    , size      = []
+    , isConst   = False
+    , isComplex = False
+    }
diff --git a/src-internal/HsBindgen/Frontend/LanguageC/PartialAST/FromLanC.hs b/src-internal/HsBindgen/Frontend/LanguageC/PartialAST/FromLanC.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/LanguageC/PartialAST/FromLanC.hs
@@ -0,0 +1,334 @@
+{-# LANGUAGE CPP #-}
+
+-- | Construct the partial AST from the language-C AST
+module HsBindgen.Frontend.LanguageC.PartialAST.FromLanC (
+    mkPartialDecl
+  , mkDecl
+  ) where
+
+import Control.Monad
+import Data.Text qualified as Text
+import GHC.Stack
+import Language.C qualified as LanC
+import Language.C.Data.Ident qualified as LanC
+import Optics.Core (Lens')
+import Optics.Core qualified as Optics
+
+import HsBindgen.Frontend.LanguageC.Monad
+import HsBindgen.Frontend.LanguageC.PartialAST
+import HsBindgen.Frontend.LanguageC.PartialAST.ToBindgen
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC (LanC)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Top-level: construct the partial AST
+
+  start with no information, then gradually apply updates
+-------------------------------------------------------------------------------}
+
+mkPartialDecl :: HasCallStack => LanC.CDeclaration a -> FromLanC PartialDecl
+mkPartialDecl = \case
+    LanC.CDecl declspecs declr _a ->
+        (     repeatedly apply declspecs
+          >=> repeatedly apply declr
+        )
+      $ unknownDecl
+    other ->
+      unexpectedF other
+
+mkDecl :: LanC.CDeclaration a -> FromLanC (Maybe CName, C.Type LanC)
+mkDecl = mkPartialDecl >=> fromDecl
+
+{-------------------------------------------------------------------------------
+  Apply updates
+-------------------------------------------------------------------------------}
+
+class Apply a b where
+  apply :: Update a b
+
+type Update a b = HasCallStack => a -> b -> FromLanC b
+
+{-------------------------------------------------------------------------------
+  'PartialDecl'
+-------------------------------------------------------------------------------}
+
+instance Apply (LanC.CDeclarationSpecifier a) PartialDecl where
+  apply = \case
+      LanC.CTypeSpec x -> overM #typ $ apply x
+      LanC.CTypeQual x -> overM #typ $ apply x
+
+      -- We only care about the name and type of the declaration. The
+      -- remaining specifiers say how the symbol is linked or compiled,
+      -- not what its type is, so we leave the partial declaration
+      -- unchanged.
+      LanC.CStorageSpec (LanC.CStatic     _) -> return
+      LanC.CStorageSpec (LanC.CExtern     _) -> return
+      LanC.CStorageSpec (LanC.CTypedef    _) -> return
+      LanC.CFunSpec     (LanC.CInlineQual _) -> return
+
+      other -> \_ -> unexpectedF other
+
+-- | See discussion of @init-declarator-list@ for 'HsBindgen.Frontend.AST.Decl.CDecl'
+--
+-- <https://hackage-content.haskell.org/package/language-c-0.10.0/docs/Language-C-Syntax-AST.html#t:CDecl>
+instance Apply
+           ( Maybe (LanC.CDeclarator  a)
+           , Maybe (LanC.CInitializer a)
+           , Maybe (LanC.CExpression  a)
+           )
+           PartialDecl where
+  apply = \case
+      (Just decl, Nothing, Nothing) ->
+        apply decl
+      (declr, initr, expr) -> \_ ->
+        unexpected $ show (
+            nodeOmitted declr
+          , nodeOmitted initr
+          , nodeOmitted expr
+          )
+
+instance Apply (LanC.CDeclarator a) PartialDecl where
+  apply = \case
+      LanC.CDeclr name derived _asmname _attrs _a ->
+            optionally setName name
+        >=> repeatedly (overM #typ . apply) (reverse derived)
+    where
+      setName :: LanC.Ident -> PartialDecl -> FromLanC PartialDecl
+      setName name = return . Optics.set #name (Just $ mkCName name)
+
+{-------------------------------------------------------------------------------
+  'PartialType'
+-------------------------------------------------------------------------------}
+
+notFun :: Update (C.Type LanC) PartialType
+notFun typ = \case
+    PartialUnknown unknown -> do
+      if null unknown.base && null unknown.sign && null unknown.size then
+          return $
+              PartialKnown . KnownType
+            $ (if unknown.isConst then C.TypeQual C.QualConst else id)
+            $ typ
+      else
+          unexpected $ show (typ, unknown)
+    other ->
+      unexpected $ show other
+
+addSign :: Update C.PrimSign PartialType
+addSign sign = \case
+    PartialUnknown unknown ->
+      return $ PartialUnknown $ unknown & #sign %~ (sign:)
+    other@PartialKnown{} ->
+      unexpected $ show other
+
+addBase :: Update Base PartialType
+addBase base = \case
+    PartialUnknown unknown ->
+      return $ PartialUnknown $ unknown & #base %~ (base:)
+    other@PartialKnown{} ->
+      unexpected $ show other
+
+addSize :: Update Size PartialType
+addSize size = \case
+    PartialUnknown unknown ->
+      return $ PartialUnknown $ unknown & #size %~ (size:)
+    other@PartialKnown{} ->
+      unexpected $ show other
+
+addComplex :: Update () PartialType
+addComplex () = \case
+    PartialUnknown unknown ->
+      return $ PartialUnknown $ unknown & #isComplex .~ True
+    other@PartialKnown{} ->
+      unexpected $ show other
+
+-- | Transition from unknown types to known types
+instance Apply (LanC.CTypeSpecifier a) PartialType where
+  apply = \case
+      -- Void (for function result types only)
+      LanC.CVoidType _a -> notFun $ C.TypeVoid
+
+      -- Primitive types
+      LanC.CCharType   _a -> addBase Char
+      LanC.CShortType  _a -> addSize Short
+      LanC.CIntType    _a -> addBase Int
+      LanC.CLongType   _a -> addSize Long
+      LanC.CFloatType  _a -> addBase Float
+      LanC.CDoubleType _a -> addBase Double
+#if MIN_VERSION_language_c(0,10,2)
+      -- language-c 0.10.2 lexes both @bool@ and @_Bool@ as @CBoolType@.
+      -- If @bool@ has been redefined (via @#define@ or @typedef@), the
+      -- reparse env will contain that definition and we use it here.
+      -- The standard stdbool.h alias @#define bool _Bool@ is normalised
+      -- away by 'addKnownType' in the ReparseMacroExpansions pass, so the
+      -- lookup returns @TypePrim PrimBool@ in that case.
+      LanC.CBoolType   _a -> \partial -> do
+        env <- getReparseEnv
+        case lookupType "bool" env of
+          Just typ -> notFun typ partial
+          Nothing  -> notFun (C.TypePrim C.PrimBool) partial
+#else
+      LanC.CBoolType   _a -> notFun $ C.TypePrim $ C.PrimBool
+#endif
+
+      -- Complex types
+      LanC.CComplexType _a -> addComplex ()
+
+      -- Sign specifiers
+      LanC.CSignedType _a -> addSign C.Signed
+      LanC.CUnsigType  _a -> addSign C.Unsigned
+
+      -- Unsupported types
+      LanC.CInt128Type{}   -> \_ -> unsupported "CInt128Type"
+#if MIN_VERSION_language_c(0,9,2)
+      LanC.CUInt128Type{}  -> \_ -> unsupported "CUInt128Type"
+#endif
+#if MIN_VERSION_language_c(0,10,0)
+      LanC.CBFloat16Type{} -> \_ -> unsupported "CBFloat16Type"
+#endif
+      LanC.CFloatNType{}   -> \_ -> unsupported "CFloatNType"
+      LanC.CTypeOfExpr{}   -> \_ -> unsupported "CTypeOfExpr"
+      LanC.CTypeOfType{}   -> \_ -> unsupported "CTypeOfType"
+      LanC.CAtomicType{}   -> \_ -> unsupported "CAtomicType"
+
+      -- User-defined types
+      LanC.CSUType (LanC.CStruct su mTag mDef _attrs _a) _a' -> \partial -> do
+        let tagKind = case su of
+                        LanC.CStructTag -> C.TagKindStruct
+                        LanC.CUnionTag  -> C.TagKindUnion
+        checkNoDef "struct or union definition" mDef
+        name <- checkTagged mTag tagKind
+        notFun (typeRef name) partial
+      LanC.CEnumType (LanC.CEnum mTag mDef _attrs _a) _a' -> \partial -> do
+        name <- checkTagged mTag C.TagKindEnum
+        checkNoDef "enum definition" mDef
+        env <- getReparseEnv
+        case lookupType (C.renderDeclNameC name) env of
+          Nothing  -> unexpected $ "enum reference " ++ show name
+          Just typ -> notFun typ partial
+      LanC.CTypeDef name _a -> \partial -> do
+        let name' = mkCName name
+        env <- getReparseEnv
+        case lookupType name' env of
+          Nothing  -> unexpected $ "typedef reference " ++ show name
+          Just typ -> notFun typ partial
+    where
+      typeRef :: C.DeclName -> C.Type LanC
+      typeRef name = C.TypeRef $ C.DeclId{name = name, isUnnamed = False}
+
+      checkTagged :: Maybe LanC.Ident -> C.TagKind -> FromLanC C.DeclName
+      checkTagged mName cTagKind =
+          case mName of
+            Just name ->
+              return $ C.DeclName (mkCName name) (C.NameKindTagged cTagKind)
+            Nothing ->
+              skipped $ "Untagged " ++ show cTagKind
+
+      checkNoDef :: String -> Maybe def -> FromLanC ()
+      checkNoDef _   Nothing  = return ()
+      checkNoDef err (Just _) = skipped err
+
+instance Apply (LanC.CTypeQualifier a) PartialType where
+  apply qual = \case
+      PartialKnown   typ -> PartialKnown   <$> apply qual typ
+      PartialUnknown typ -> PartialUnknown <$> apply qual typ
+
+instance Apply (LanC.CDerivedDeclarator a) PartialType where
+  apply deriv partial = do
+      typ <- fromPartialType partial
+      PartialKnown <$> apply deriv typ
+
+{-------------------------------------------------------------------------------
+  'UnknownType'
+-------------------------------------------------------------------------------}
+
+instance Apply (LanC.CTypeQualifier a) UnknownType where
+  apply = \case
+      LanC.CConstQual _a ->
+        return . Optics.set #isConst True
+      LanC.CAttrQual  _ -> return
+      other -> \_ ->
+        unexpectedF other
+
+{-------------------------------------------------------------------------------
+  'KnownType'
+-------------------------------------------------------------------------------}
+
+defaultApplyKnownType :: Apply a (C.Type LanC) => Update a KnownType
+defaultApplyKnownType x = fmap KnownType . apply x . fromKnownType
+
+instance Apply (LanC.CTypeQualifier a) KnownType where
+  apply = defaultApplyKnownType
+
+instance Apply (LanC.CDerivedDeclarator a) KnownType where
+  apply deriv = case deriv of
+      LanC.CPtrDeclr{} -> defaultApplyKnownType deriv
+      LanC.CArrDeclr{} -> defaultApplyKnownType deriv
+
+      -- Special case for functions, to get argument names
+      LanC.CFunDeclr params _attrs _a -> \res -> do
+        params' <- mapM mkDecl =<< viewFunParams params
+        return $ TopLevelFun params' (fromKnownType res)
+
+{-------------------------------------------------------------------------------
+  'Type' 'p'
+-------------------------------------------------------------------------------}
+
+instance Apply (LanC.CTypeQualifier a) (C.Type LanC) where
+  apply = \case
+      LanC.CConstQual _ -> return . C.TypeQual C.QualConst
+      LanC.CRestrQual _ -> return -- ignore @__restrict@
+      LanC.CAttrQual _  -> return
+      other             -> \_ -> unexpectedF other
+
+instance Apply (LanC.CDerivedDeclarator a) (C.Type LanC) where
+  apply = \case
+      LanC.CPtrDeclr quals _a ->
+        repeatedly apply quals . C.TypePointers 1
+      LanC.CArrDeclr quals (LanC.CNoArrSize isCompleteType) _a ->
+        if isCompleteType
+          then \_ -> unexpected "complete array without size"
+          else repeatedly apply quals . C.TypeIncompleteArray
+      LanC.CArrDeclr quals (LanC.CArrSize _isStatic expr) _a -> \typ -> do
+        -- For arrays of known size, we only support constant sizes
+        sz <- case expr of
+                LanC.CConst (LanC.CIntConst n _a') ->
+                  return $ fromIntegral $ LanC.getCInteger n
+                other ->
+                  unsupported $ show (nodeOmitted other)
+        repeatedly apply quals $ C.TypeConstArray sz typ
+      other -> \_ ->
+        unexpectedF other
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: language-c
+-------------------------------------------------------------------------------}
+
+mkCName :: LanC.Ident -> CName
+mkCName (LanC.Ident name _hash _a) = Text.pack name
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: optics
+-------------------------------------------------------------------------------}
+
+overM :: Functor m => Lens' a b -> (b -> m b) -> a -> m a
+overM l f a = flip (Optics.set l) a <$> f (Optics.view l a)
+
+viewFunParams ::
+     Either [LanC.Ident] ([LanC.CDeclaration a], Bool)
+  -> FromLanC [LanC.CDeclaration a]
+viewFunParams = \case
+    Left params ->
+      unsupported $ "old-style parameters " ++ show params
+    Right (_params, True) ->
+      unsupported "variadic function"
+    Right (params, False) ->
+      case params of
+        [LanC.CDecl [LanC.CTypeSpec (LanC.CVoidType _)] [] _] ->
+          -- Explicitly empty parameter list, as in
+          --
+          -- > void f(void)
+          return []
+        _otherwise ->
+          return $ params
diff --git a/src-internal/HsBindgen/Frontend/LanguageC/PartialAST/ToBindgen.hs b/src-internal/HsBindgen/Frontend/LanguageC/PartialAST/ToBindgen.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/LanguageC/PartialAST/ToBindgen.hs
@@ -0,0 +1,112 @@
+-- | Translate the partial AST to our internal AST
+module HsBindgen.Frontend.LanguageC.PartialAST.ToBindgen (
+    -- * Declarations
+    fromDecl
+  , fromNamedDecl
+  , fromFunDecl
+    -- * Types
+  , fromPartialType
+  , fromUnknownType
+  , fromKnownType
+  ) where
+
+import HsBindgen.Frontend.LanguageC.Monad
+import HsBindgen.Frontend.LanguageC.PartialAST
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC (LanC)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass (NoAnn (..))
+import HsBindgen.Language.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Declarations
+-------------------------------------------------------------------------------}
+
+fromDecl :: PartialDecl -> FromLanC (Maybe CName, C.Type LanC)
+fromDecl partialDecl = do
+    typ <- fromKnownType <$> fromPartialType partialDecl.typ
+    return (partialDecl.name, typ)
+
+fromNamedDecl :: PartialDecl -> FromLanC (CName, C.Type LanC)
+fromNamedDecl partialDecl = do
+    name <- partialFromJust partialDecl.name
+    typ  <- fromKnownType <$> fromPartialType partialDecl.typ
+    return (name, typ)
+
+fromFunDecl ::
+     PartialDecl
+  -> FromLanC (
+         CName
+       , ( [(Maybe CName, C.Type LanC)]
+         , C.Type LanC
+         )
+       )
+fromFunDecl partialDecl = do
+    name          <- partialFromJust partialDecl.name
+    (params, res) <- fromTopLevelFun =<< fromPartialType partialDecl.typ
+    return (name, (params, res))
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+fromPartialType :: PartialType -> FromLanC KnownType
+fromPartialType = \case
+     PartialUnknown typ -> fromUnknownType typ
+     PartialKnown typ -> return typ
+
+fromUnknownType :: UnknownType -> FromLanC KnownType
+fromUnknownType uty =
+      fmap (
+          KnownType
+        . (if uty.isConst then C.TypeQual C.QualConst else id)
+        . (if uty.isComplex then C.TypeComplex else C.TypePrim)
+        )
+    $ case uty of
+        CChar{}  -> pure $ C.PrimChar (C.PrimSignImplicit Nothing)
+        CSChar{} -> pure $ C.PrimChar (C.PrimSignExplicit C.Signed)
+        CUChar{} -> pure $ C.PrimChar (C.PrimSignExplicit C.Unsigned)
+        CShort{} -> pure $ C.PrimIntegral C.PrimShort C.Signed
+        CSShort{} -> pure $ C.PrimIntegral C.PrimShort C.Signed
+        CUShort{} -> pure $ C.PrimIntegral C.PrimShort C.Unsigned
+        CInt{} -> pure $ C.PrimIntegral C.PrimInt C.Signed
+        CSInt{} -> pure $ C.PrimIntegral C.PrimInt C.Signed
+        CUInt{} -> pure $ C.PrimIntegral C.PrimInt C.Unsigned
+        CLong{} -> pure $ C.PrimIntegral C.PrimLong C.Signed
+        CSLong{} -> pure $ C.PrimIntegral C.PrimLong C.Signed
+        CULong{} -> pure $ C.PrimIntegral C.PrimLong C.Unsigned
+        CLLong{} -> pure $ C.PrimIntegral C.PrimLongLong C.Signed
+        CSLLong{} -> pure $ C.PrimIntegral C.PrimLongLong C.Signed
+        CULLong{} -> pure $ C.PrimIntegral C.PrimLongLong C.Unsigned
+        CFloat{} -> pure $ C.PrimFloating C.PrimFloat
+        CDouble{} -> pure $ C.PrimFloating C.PrimDouble
+        CLDouble{} -> unsupported "long double"
+        CTypeUnknown{} -> unexpected $ "incomplete or invalid type: " <> (show uty)
+
+fromKnownType :: KnownType -> C.Type LanC
+fromKnownType = \case
+    KnownType   typ        -> typ
+    TopLevelFun params res -> C.TypeFun (map (mkTypeFunArg . snd) params) res
+  where
+    mkTypeFunArg typ = C.TypeFunArgF {
+          typ = typ
+        , ann = NoAnn
+        }
+
+fromTopLevelFun ::
+     KnownType
+  -> FromLanC (
+         [(Maybe CName, C.Type LanC)]
+       , C.Type LanC
+       )
+fromTopLevelFun = \case
+    TopLevelFun params res -> return (params, res)
+    other -> unexpected $ show other
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+partialFromJust :: HasCallStack => Maybe a -> FromLanC a
+partialFromJust Nothing  = unexpected "Nothing"
+partialFromJust (Just x) = return x
diff --git a/src-internal/HsBindgen/Frontend/Pass/AdjustTypes.hs b/src-internal/HsBindgen/Frontend/Pass/AdjustTypes.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/AdjustTypes.hs
@@ -0,0 +1,340 @@
+module HsBindgen.Frontend.Pass.AdjustTypes (
+    adjustTypes
+  ) where
+
+import Data.Proxy (Proxy (Proxy))
+import Numeric.Natural (Natural)
+
+import HsBindgen.Frontend.Pass.AdjustTypes.IsPass
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+
+-- | Adjust function argument types
+--
+-- The C reference describes that function parameters of some specific types are
+-- adjusted. See:
+--
+-- <https://en.cppreference.com/w/c/language/function_declaration.html#Explanation>
+--
+-- We apply some of these adjustments to reduce ambiguity about the
+-- representation of function parameter types. These adjustments are applied
+-- everywhere that a C type occurs in the AST, even recursively. The adjustments
+-- we apply are:
+--
+-- > * any parameter of function type is adjusted to the corresponding pointer
+-- >  type
+--
+-- > * any parameter of array type is adjusted to the corresponding pointer
+-- >   type
+--
+adjustTypes ::
+     C.TranslationUnit l MangleNames
+  -> C.TranslationUnit l AdjustTypes
+adjustTypes unit =
+      let
+        decls' = map processDecl unit.decls
+        unit' =  C.TranslationUnit {
+              decls        = decls'
+            , includeGraph = unit.includeGraph
+            , meta         = unit.meta
+            }
+      in
+        unit'
+
+{-------------------------------------------------------------------------------
+  Decls
+-------------------------------------------------------------------------------}
+
+processDecl :: C.Decl l MangleNames -> C.Decl l AdjustTypes
+processDecl decl =
+    C.Decl {
+        info = coercePass decl.info
+      , ann  = decl.ann
+      , kind = processDeclKind decl.kind
+      }
+
+processDeclKind :: C.DeclKind l MangleNames -> C.DeclKind l AdjustTypes
+processDeclKind kind =
+    case kind of
+      C.DeclStruct struct                  -> C.DeclStruct               $ processStruct struct
+      C.DeclUnion union                    -> C.DeclUnion                $ processUnion union
+      C.DeclTypedef typedef                -> C.DeclTypedef              $ processTypedef typedef
+      C.DeclEnum enum                      -> C.DeclEnum                 $ processEnum enum
+      C.DeclUntaggedEnumConstant enumConst -> C.DeclUntaggedEnumConstant $ processUntaggedEnumConstant enumConst
+      C.DeclOpaque mSize                   -> C.DeclOpaque mSize
+      C.DeclMacro macro                    -> C.DeclMacro                $ processMacro macro
+      C.DeclFunction function              -> C.DeclFunction             $ processFunction function
+      C.DeclGlobal global                  -> C.DeclGlobal               $ processGlobal global
+
+processStruct :: C.Struct MangleNames -> C.Struct AdjustTypes
+processStruct struct =
+    C.Struct {
+        fields    = map processField struct.fields
+      , flam      = C.mapFlamField processRegularField struct.flam
+      , sizeof    = struct.sizeof
+      , alignment = struct.alignment
+      , ann       = struct.ann
+      }
+
+processUnion :: C.Union MangleNames -> C.Union AdjustTypes
+processUnion union =
+    C.Union {
+        sizeof    = union.sizeof
+      , alignment = union.alignment
+      , fields    = map processField union.fields
+      , ann       = union.ann
+      }
+
+processField :: C.Field MangleNames -> C.Field AdjustTypes
+processField = \case
+    C.FieldRegular field -> C.FieldRegular $ processRegularField field
+    C.FieldImplicit field -> C.FieldImplicit $ processImplicitField field
+
+processRegularField :: C.RegularField MangleNames -> C.RegularField AdjustTypes
+processRegularField field =
+    C.RegularField {
+        info   = coercePass field.info
+      , typ    = processType field.typ
+      , offset = field.offset
+      , width  = field.width
+      , ann    = field.ann
+      }
+
+processImplicitField :: C.ImplicitField MangleNames -> C.ImplicitField AdjustTypes
+processImplicitField field =
+    C.ImplicitField {
+        info   = coercePass field.info
+      , typRef = processAnonRef field.typRef
+      , offset = field.offset
+      , indirect = fmap processIndirectField field.indirect
+      , ann    = field.ann
+      }
+
+processAnonRef :: C.AnonRef MangleNames -> C.AnonRef AdjustTypes
+processAnonRef = \case
+    C.AnonRef ref -> C.AnonRef ref
+    C.AnonExtBinding ext -> C.AnonExtBinding $ processExtBindingRef ext
+
+processIndirectField :: C.IndirectField MangleNames -> C.IndirectField AdjustTypes
+processIndirectField field =
+    C.IndirectField {
+        info   = coercePass field.info
+      , typ    = processType field.typ
+      , offset = field.offset
+      , width  = field.width
+      , path   = fmap processAnonRef field.path
+      , ann    = coercePassAnn (Proxy @'("IndirectField", MangleNames, AdjustTypes)) field.ann
+      }
+
+processTypedef :: C.Typedef MangleNames -> C.Typedef AdjustTypes
+processTypedef typedef =
+    C.Typedef {
+        typ = processType typedef.typ
+      , ann = typedef.ann
+      }
+
+processEnum :: C.Enum MangleNames -> C.Enum AdjustTypes
+processEnum enum =
+    C.Enum {
+        typ       = processType enum.typ
+      , sizeof    = enum.sizeof
+      , alignment = enum.alignment
+      , constants = map processEnumConstant enum.constants
+      , ann       = enum.ann
+      }
+
+processEnumConstant :: C.EnumConstant MangleNames -> C.EnumConstant AdjustTypes
+processEnumConstant enumConstant =
+    C.EnumConstant {
+        info  = coercePass enumConstant.info
+      , value = enumConstant.value
+      }
+
+processUntaggedEnumConstant ::
+     C.UntaggedEnumConstant MangleNames
+  -> C.UntaggedEnumConstant AdjustTypes
+processUntaggedEnumConstant enumConst =
+    C.UntaggedEnumConstant {
+        typ = enumConst.typ
+      , constant = processEnumConstant enumConst.constant
+      }
+
+processMacro :: MacroBody MangleNames l -> MacroBody AdjustTypes l
+processMacro macro =
+    case macro of
+      MacroType  typ -> MacroType  $ processMacroType typ
+      MacroValue val -> MacroValue $ processMacroExpr val
+
+-- NOTE: currently type-like macro expressions don't support array or function
+-- constructors. If they do in the future, then we might have to recurse into
+-- the macro expression.
+processMacroType :: TypecheckedMacroType l MangleNames -> TypecheckedMacroType l AdjustTypes
+processMacroType macroType = coercePass macroType
+
+-- NOTE: currently value-like macro expressions don't support array or function
+-- constructors. If they do in the future, then we might have to recurse into
+-- the macro expression.
+processMacroExpr :: TypecheckedMacroValue l MangleNames -> TypecheckedMacroValue l AdjustTypes
+processMacroExpr macroExpr = coercePass macroExpr
+
+processFunction :: C.Function MangleNames -> C.Function AdjustTypes
+processFunction function =
+    C.Function{
+        args  = map processFunctionArg function.args
+      , res   = processType function.res
+      , attrs = function.attrs
+      , ann   = function.ann
+      }
+
+processFunctionArg :: C.FunctionArg MangleNames -> C.FunctionArg AdjustTypes
+processFunctionArg functionArg =
+    C.FunctionArg{
+        name = functionArg.name
+      , typ  = typ'
+      , ann  = ann'
+      }
+  where
+    (typ', ann') = adjustFunArg $ processType functionArg.typ
+
+processGlobal :: C.Global MangleNames -> C.Global AdjustTypes
+processGlobal global = C.Global{
+      typ = processType global.typ
+    , ann = global.ann
+    }
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+processType ::
+     C.Type MangleNames
+  -> C.Type AdjustTypes
+processType = \case
+    C.TypePrim primTy ->
+      C.TypePrim primTy
+    C.TypeComplex primTy ->
+      C.TypeComplex primTy
+    C.TypeRef name ->
+      C.TypeRef name
+    C.TypeEnum ref ->
+      C.TypeEnum $ C.Ref {
+          name       = ref.name
+        , underlying = processType ref.underlying
+        }
+    C.TypeMacro ref ->
+      C.TypeMacro $ C.MacroRef {
+          name       = ref.name
+        , underlying = processType ref.underlying
+        }
+    C.TypeTypedef ref ->
+      C.TypeTypedef $ C.Ref {
+          name       = ref.name
+        , underlying = processType ref.underlying
+        }
+    C.TypePointers n ty ->
+      C.TypePointers n      $ processType ty
+    C.TypeConstArray n ty ->
+      C.TypeConstArray n    $ processType ty
+    C.TypeIncompleteArray ty ->
+      C.TypeIncompleteArray $ processType ty
+    C.TypeFun args res ->
+      C.TypeFun (map processTypeFunArg args) (processType res)
+    C.TypeVoid ->
+      C.TypeVoid
+    C.TypeBlock ty ->
+      C.TypeBlock $ processType ty
+    C.TypeQual qual ty ->
+      C.TypeQual qual $ processType ty
+    C.TypeExtBinding ref ->
+      C.TypeExtBinding $ processExtBindingRef ref
+
+processExtBindingRef :: C.ExtBindingRef MangleNames -> C.ExtBindingRef AdjustTypes
+processExtBindingRef ref = C.Ref {
+          name       = ref.name
+        , underlying = processType ref.underlying
+        }
+
+processTypeFunArg :: C.TypeFunArg MangleNames -> C.TypeFunArg AdjustTypes
+processTypeFunArg arg =
+    C.TypeFunArgF {
+        typ = typ'
+      , ann = ann'
+      }
+  where
+    (typ', ann') = adjustFunArg $ processType arg.typ
+
+-- | This is where the actual adjustments take place.
+--
+-- Function arguments of function type are changed to *pointer* to function
+-- type. For example, the former is adjusted to the latter:
+--
+-- > int foo (char f (float))
+-- > int foo (char (*f)(float))
+--
+-- Function arguments of array type are changed to pointer to the array element
+-- type. For example, the former is adjusted to the latter:
+--
+-- > int foo (char xs[])
+-- > int foo (char * xs)
+--
+-- The original type before adjustment is recorded in an an 'HsBindgen.Frontend.Pass.Ann'otation.
+--
+adjustFunArg :: C.Type AdjustTypes -> (C.Type AdjustTypes, AdjustedFrom AdjustTypes)
+adjustFunArg ty
+  | Just cls <- classifyCanonicalTypeArray ty
+  , let elemTy = getArrayElementType cls
+  , let constQual
+          | C.isErasedTypeConstQualified ty
+          , not (C.isErasedTypeConstQualified elemTy)
+          = C.TypeQual C.QualConst
+          | otherwise
+          = id
+  = (C.TypePointers 1 $ constQual elemTy, AdjustedFromArray ty)
+  | C.isCanonicalTypeFunction ty
+  = (C.TypePointers 1 ty, AdjustedFromFunction ty)
+  | otherwise
+  = (ty, NotAdjusted)
+
+-- | An array of known size or unknown size
+data ArrayClassification p =
+    -- | Array of known size
+    ConstantArrayClassification
+      Natural     -- ^ Array size
+      (C.Type p)  -- ^ Array element type
+
+    -- | Array of unkown size
+  | IncompleteArrayClassification
+      (C.Type p)  -- ^ Array element type
+
+getArrayElementType :: ArrayClassification p -> C.Type p
+getArrayElementType (ConstantArrayClassification _ ty) = ty
+getArrayElementType (IncompleteArrayClassification ty) = ty
+
+-- | Is the canonical type an array type?
+--
+-- If so, is it an array of known size or unknown size? And what is the /full
+-- type/ of the array elements?
+classifyCanonicalTypeArray ::
+     C.Type AdjustTypes
+  -> Maybe (ArrayClassification AdjustTypes)
+classifyCanonicalTypeArray ty =
+    -- We do not use getCanonicalType here, because we do not want to
+    -- canonicalize the array /element/ type.
+    case ty of
+      C.TypePrim _pt          -> Nothing
+      C.TypeRef _declId       -> Nothing
+      C.TypeEnum _ref         -> Nothing
+      C.TypeMacro ref         -> classifyCanonicalTypeArray ref.underlying
+      C.TypeTypedef ref       -> classifyCanonicalTypeArray ref.underlying
+      C.TypePointers _n _t    -> Nothing
+      C.TypeConstArray n t    -> Just (ConstantArrayClassification n t)
+      C.TypeFun _args _res    -> Nothing
+      C.TypeVoid              -> Nothing
+      C.TypeIncompleteArray t -> Just (IncompleteArrayClassification t)
+      C.TypeBlock _t          -> Nothing
+      C.TypeQual _q t         -> classifyCanonicalTypeArray t
+      C.TypeExtBinding ref    -> classifyCanonicalTypeArray ref.underlying
+      C.TypeComplex _pt       -> Nothing
diff --git a/src-internal/HsBindgen/Frontend/Pass/AdjustTypes/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/AdjustTypes/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/AdjustTypes/IsPass.hs
@@ -0,0 +1,89 @@
+module HsBindgen.Frontend.Pass.AdjustTypes.IsPass (
+    AdjustTypes
+  , AdjustedFrom (..)
+  ) where
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Translation
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type AdjustTypes :: Pass
+data AdjustTypes a
+
+type family AnnAdjustTypes ix where
+  AnnAdjustTypes "Decl"                 = PrescriptiveDeclSpec
+  AnnAdjustTypes "Enum"                 = NewtypeNames
+  AnnAdjustTypes "Flam"                 = FlamNames
+  AnnAdjustTypes "IndirectField"        = IndirectFieldNames AdjustTypes
+  AnnAdjustTypes "Struct"               = StructNames
+  AnnAdjustTypes "Typedef"              = TypedefNames
+  AnnAdjustTypes "TypecheckedMacroType" = NewtypeNames
+  AnnAdjustTypes "TypeFunArg"           = AdjustedFrom AdjustTypes
+  AnnAdjustTypes "Union"                = NewtypeNames
+  AnnAdjustTypes _                      = NoAnn
+
+instance IsPass AdjustTypes
+
+instance PassId AdjustTypes where
+  type Id AdjustTypes = DeclIdPair
+
+  idNameKind     _ namePair = namePair.cName.name.kind
+  idSourceName   _ namePair = C.declIdSourceName namePair.cName
+  idLocationInfo _ namePair = C.declIdLocationInfo namePair.cName
+
+instance PassScopedName AdjustTypes where
+  type ScopedName AdjustTypes = ScopedNamePair
+
+instance PassTypes AdjustTypes
+
+instance PassMacro AdjustTypes where
+  type MacroId         AdjustTypes = Id AdjustTypes
+  type MacroBody       AdjustTypes = TypecheckedMacro AdjustTypes
+  type MacroUnderlying AdjustTypes = C.Type AdjustTypes
+
+  macroIdId _ = id
+
+instance PassExtBinding AdjustTypes where
+  type ExtBinding AdjustTypes = BindingSpec.ResolvedExtBinding
+
+  extBindingId _ extBinding = extDeclIdPair extBinding
+
+instance PassCommentDecl AdjustTypes where
+  type CommentDecl AdjustTypes = Maybe (C.Comment AdjustTypes)
+
+instance PassAnn AdjustTypes where
+  type Ann ix AdjustTypes = AnnAdjustTypes ix
+
+instance PassMsg AdjustTypes
+
+{-------------------------------------------------------------------------------
+  Annotations
+-------------------------------------------------------------------------------}
+
+data AdjustedFrom p =
+    AdjustedFromArray (C.Type p)
+  | AdjustedFromFunction (C.Type p)
+  | NotAdjusted
+  deriving stock (Show, Eq, Ord)
+
+{-------------------------------------------------------------------------------
+  CoercePass
+-------------------------------------------------------------------------------}
+
+instance CoercePassId      MangleNames AdjustTypes
+instance CoercePassMacroId MangleNames AdjustTypes
+
+instance CoercePassCommentDecl MangleNames AdjustTypes where
+  coercePassCommentDecl _ = fmap coercePass
+
+instance CoercePassAnn "IndirectField" MangleNames AdjustTypes where
+  coercePassAnn _ = \case
+      IndirectFieldNames name -> IndirectFieldNames name
diff --git a/src-internal/HsBindgen/Frontend/Pass/ConstructTranslationUnit.hs b/src-internal/HsBindgen/Frontend/Pass/ConstructTranslationUnit.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ConstructTranslationUnit.hs
@@ -0,0 +1,73 @@
+module HsBindgen.Frontend.Pass.ConstructTranslationUnit (
+    constructTranslationUnit
+  ) where
+
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Analysis.DeclUseGraph (DeclUseGraph)
+import HsBindgen.Frontend.Analysis.DeclUseGraph qualified as DeclUseGraph
+import HsBindgen.Frontend.Analysis.IncludeGraph (IncludeGraph)
+import HsBindgen.Frontend.Analysis.UseDeclGraph (UseDeclGraph)
+import HsBindgen.Frontend.Analysis.UseDeclGraph qualified as UseDeclGraph
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.EnrichComments.IsPass
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Frontend.Predicate (IsMainHeader)
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.Macro.UniqueExpansion qualified as UniqueExpansion
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+type PreviousPass = EnrichComments
+
+constructTranslationUnit ::
+     forall l. Macro.HasTypes l
+  => Macro.Lang l
+  -> UniqueExpansion.Analysis
+  -> IsMainHeader
+  -> [ParseResult l PreviousPass]
+  -> IncludeGraph
+  -> C.TranslationUnit l ConstructTranslationUnit
+constructTranslationUnit macroLang macroAnalysis isMainHeader parseResults includeGraph = C.TranslationUnit{
+      decls        = DeclUseGraph.toDecls
+                       declMeta.declIndex
+                       declMeta.declUseGraph
+    , includeGraph = includeGraph
+    , meta         = declMeta
+    }
+  where
+    declMeta :: DeclMeta l
+    declMeta =
+      mkDeclMeta macroLang macroAnalysis isMainHeader parseResults includeGraph
+
+mkDeclMeta ::
+     forall l. Macro.HasTypes l
+  => Macro.Lang l
+  -> UniqueExpansion.Analysis
+  -> IsMainHeader
+  -> [ParseResult l PreviousPass]
+  -> IncludeGraph
+  -> DeclMeta l
+mkDeclMeta macroLang macroAnalysis isMainHeader parseResults includeGraph = declMeta
+  where
+    declIndex :: DeclIndex l
+    declIndex =
+      DeclIndex.fromParseResults macroLang macroAnalysis isMainHeader parseResults
+
+    declUseGraph :: DeclUseGraph
+    declUseGraph = DeclUseGraph.construct includeGraph declIndex
+
+    useDeclGraph :: UseDeclGraph
+    useDeclGraph = UseDeclGraph.fromDeclUseGraph declUseGraph
+
+    declMeta :: DeclMeta l
+    declMeta = DeclMeta{
+      declIndex    = declIndex
+    , declUseGraph = declUseGraph
+    , useDeclGraph = useDeclGraph
+    }
diff --git a/src-internal/HsBindgen/Frontend/Pass/ConstructTranslationUnit/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/ConstructTranslationUnit/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ConstructTranslationUnit/IsPass.hs
@@ -0,0 +1,68 @@
+module HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass (
+    ConstructTranslationUnit
+  ) where
+
+import HsBindgen.Frontend.Pass.EnrichComments.IsPass
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Pass.Types (CoercePassAnonRef)
+import HsBindgen.Macro.Interface qualified as Macro
+
+{-------------------------------------------------------------------------------
+  Definition
+
+  Inspect the parse results and construct the translation unit.
+-------------------------------------------------------------------------------}
+
+type ConstructTranslationUnit :: Pass
+data ConstructTranslationUnit a
+
+type family AnnConstructTranslationUnit (ix :: Symbol) :: Star where
+  AnnConstructTranslationUnit "Function"      = ReparseInfo Tokens
+  AnnConstructTranslationUnit "Global"        = ReparseInfo Tokens
+  AnnConstructTranslationUnit "IndirectField" = ReparseInfo Tokens
+  AnnConstructTranslationUnit "RegularField"  = ReparseInfo Tokens
+  AnnConstructTranslationUnit "Typedef"       = ReparseInfo Tokens
+  AnnConstructTranslationUnit _               = NoAnn
+
+instance IsPass ConstructTranslationUnit
+
+instance PassId ConstructTranslationUnit
+
+instance PassScopedName ConstructTranslationUnit
+
+instance PassTypes ConstructTranslationUnit
+
+instance PassMacro ConstructTranslationUnit where
+  type MacroBody ConstructTranslationUnit = Macro.Resolved
+
+instance PassExtBinding ConstructTranslationUnit
+
+instance PassCommentDecl ConstructTranslationUnit where
+  type CommentDecl ConstructTranslationUnit = Maybe (C.Comment ConstructTranslationUnit)
+
+instance PassAnn ConstructTranslationUnit where
+  type Ann ix ConstructTranslationUnit = AnnConstructTranslationUnit ix
+
+instance PassMsg ConstructTranslationUnit
+
+{-------------------------------------------------------------------------------
+  CoercePass
+-------------------------------------------------------------------------------}
+
+instance CoercePassAnonRef            EnrichComments ConstructTranslationUnit
+instance CoercePassId                 EnrichComments ConstructTranslationUnit
+instance CoercePassTypes              EnrichComments ConstructTranslationUnit
+instance CoercePassMacroId            EnrichComments ConstructTranslationUnit
+instance CoercePassMacroUnderlying    EnrichComments ConstructTranslationUnit
+
+instance CoercePassAnn "Function"      EnrichComments ConstructTranslationUnit
+instance CoercePassAnn "Global"        EnrichComments ConstructTranslationUnit
+instance CoercePassAnn "IndirectField" EnrichComments ConstructTranslationUnit
+instance CoercePassAnn "RegularField"  EnrichComments ConstructTranslationUnit
+instance CoercePassAnn "TypeFunArg"    EnrichComments ConstructTranslationUnit
+instance CoercePassAnn "Typedef"       EnrichComments ConstructTranslationUnit
+instance CoercePassCommentDecl         EnrichComments ConstructTranslationUnit where
+  coercePassCommentDecl _ = fmap coercePass
diff --git a/src-internal/HsBindgen/Frontend/Pass/EnrichComments.hs b/src-internal/HsBindgen/Frontend/Pass/EnrichComments.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/EnrichComments.hs
@@ -0,0 +1,270 @@
+-- | Enrich parsed declarations with doxygen comments
+--
+-- Post-processing step after @EnrichComments@: looks up each declaration's
+-- comment in the 'Doxygen' state and fills in @DeclInfo.comment@ and
+-- per-field comments.
+--
+-- === Doxygen nesting
+--
+-- Doxygen and libclang see nested structs differently. Given:
+--
+-- @
+-- struct outer {
+--     struct inner {
+--         int x;
+--         struct {
+--             int a;
+--             struct inner_inner_inner {
+--                 int c;
+--             };
+--         } inner_inner;
+--     } field;
+--     int z;
+-- };
+-- @
+--
+-- Doxygen produces one XML file per named compound, using @\"::\"@-qualified
+-- names. Named nested structs get their own file; untagged structs are
+-- flattened into the nearest named enclosing struct:
+--
+-- @
+-- \<!-- outer.xml -->
+-- \<compounddef kind=\"struct\">
+--   \<compoundname>outer\</compoundname>
+--   \<sectiondef kind=\"public-attrib\">
+--     \<memberdef kind=\"variable\">\<name>field\</name>\</memberdef>
+--     \<memberdef kind=\"variable\">\<name>z\</name>\</memberdef>
+--   \</sectiondef>
+-- \</compounddef>
+--
+-- \<!-- outer::inner.xml — note: field \"a\" is flattened from the untagged struct -->
+-- \<compounddef kind=\"struct\">
+--   \<compoundname>outer::inner\</compoundname>
+--   \<sectiondef kind=\"public-attrib\">
+--     \<memberdef kind=\"variable\">\<name>x\</name>\</memberdef>
+--     \<memberdef kind=\"variable\">\<name>a\</name>\</memberdef>
+--     \<memberdef kind=\"variable\">\<name>inner_inner\</name>\</memberdef>
+--   \</sectiondef>
+-- \</compounddef>
+--
+-- \<!-- outer::inner::inner_inner_inner.xml -->
+-- \<compounddef kind=\"struct\">
+--   \<compoundname>outer::inner::inner_inner_inner\</compoundname>
+--   \<sectiondef kind=\"public-attrib\">
+--     \<memberdef kind=\"variable\">\<name>c\</name>\</memberdef>
+--   \</sectiondef>
+-- \</compounddef>
+-- @
+--
+-- The @doxygen-parser@ library turns this into a
+-- @'Map' 'DoxygenKey' ('Comment' 'Text')@ with keys like:
+--
+-- @
+-- KeyStruct \"outer\"                                 -- compound doc
+-- KeyField  \"outer\" \"field\"                       -- field doc
+-- KeyStruct \"outer::inner\"                          -- compound doc
+-- KeyField  \"outer::inner\" \"x\"                    -- field doc
+-- KeyField  \"outer::inner\" \"a\"                    -- flattened from untagged
+-- KeyField  \"outer::inner\" \"inner_inner\"          -- untagged struct's doc
+-- KeyStruct \"outer::inner::inner_inner_inner\"       -- compound doc
+-- KeyField  \"outer::inner::inner_inner_inner\" \"c\" -- field doc
+-- @
+--
+-- === Lookup algorithm
+--
+-- Each 'DeclInfo' carries @enclosing@: the list of enclosing declarations
+-- (innermost first), set during parsing.
+--
+-- __Named declarations__ ('lookupCommentForId'): 'resolveQualifiedName'
+-- reverses the @enclosing@ list, collects named ancestors (skipping
+-- unnamed ones), and joins with @\"::\"@.  Then we look up
+-- @'KeyDecl' qualName \<|\> 'KeyStruct' qualName@.
+--
+--  * @inner_inner_inner@ → enclosing list @[\<unnamed>, inner, outer]@, skip
+--    unnamed → @\"outer::inner::inner_inner_inner\"@
+--
+-- Unnamed declarations have no doxygen comment of their own: doxygen
+-- associates the comment with the enclosing field, which we pick up via
+-- 'enrichStructField'\/'enrichUnionField' below.
+--
+-- __Fields__ ('enrichStructField', etc.): look up directly with
+-- @'KeyField' enclosingQualName fieldName@ (or 'KeyEnumValue').
+--
+module HsBindgen.Frontend.Pass.EnrichComments (enrichComments) where
+
+import Control.Applicative ((<|>))
+import Data.Text qualified as Text
+
+import HsBindgen.Frontend.Pass.EnrichComments.IsPass (EnrichComments)
+import HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass (FillUnnamedIds)
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+
+import Doxygen.Parser (Doxygen, DoxygenKey (..), lookupComment)
+import Doxygen.Parser.Types qualified as Doxy
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+-- | Enrich parsed declarations with doxygen comments
+enrichComments ::
+     forall l. Doxygen
+  -> [ParseResult l FillUnnamedIds ]
+  -> [ParseResult l EnrichComments]
+enrichComments doxy results =
+    map enrichOne coerced
+  where
+    -- Coerce input to 'EnrichComments' before enrichment. The coercion sets
+    -- every @comment@ field to 'Nothing' (since 'CommentDecl FillUnnamedIds'
+    -- is @()@ and 'CommentDecl EnrichComments' is @Maybe (Comment EnrichComments)@)
+    -- via 'CoercePassCommentDecl'. We then fill in comments by looking up the
+    -- doxygen state.
+    coerced :: [ParseResult l EnrichComments]
+    coerced = map coercePass results
+
+    enrichOne :: ParseResult l EnrichComments -> ParseResult l EnrichComments
+    enrichOne pr = case pr.classification of
+      ParseResultSuccess success ->
+        let decl' = enrichDecl doxy success.decl
+        in  pr { classification =
+                    ParseResultSuccess success { decl = decl' }
+               }
+      _ -> pr
+
+{-------------------------------------------------------------------------------
+  Declaration-level enrichment
+-------------------------------------------------------------------------------}
+
+enrichDecl ::
+     Doxygen
+  -> C.Decl l EnrichComments
+  -> C.Decl l EnrichComments
+enrichDecl doxy decl =
+    decl & #info %~ enrichDeclInfo doxy
+         & #kind %~ enrichDeclKind doxy effectiveEnclosing
+  where
+    -- Doxygen-qualified name for field lookups (e.g., @\"outer::inner\"@)
+    effectiveEnclosing :: Text
+    effectiveEnclosing = resolveQualifiedName decl.info
+
+enrichDeclInfo ::
+     Doxygen
+  -> C.DeclInfo EnrichComments
+  -> C.DeclInfo EnrichComments
+enrichDeclInfo doxy info
+  | Just doxyComment <- lookupCommentForId doxy info
+  = info & #comment .~ Just (wrapDoxygenRefs doxyComment)
+  | otherwise
+  = info
+
+lookupCommentForId ::
+     Doxygen
+  -> C.DeclInfo EnrichComments
+  -> Maybe (Doxy.Comment Doxy.DoxyRef)
+lookupCommentForId doxy info
+  | not info.id.isUnnamed =
+      let qualName = resolveQualifiedName info
+      in  lookupComment (KeyDecl qualName) doxy
+            <|> lookupComment (KeyStruct qualName) doxy
+  | otherwise = Nothing
+
+{-------------------------------------------------------------------------------
+  Field-level enrichment
+-------------------------------------------------------------------------------}
+
+enrichDeclKind ::
+     Doxygen
+  -> Text  -- ^ Declaration C name (enclosing for field lookups)
+  -> C.DeclKind l EnrichComments
+  -> C.DeclKind l EnrichComments
+enrichDeclKind doxy name = \case
+    C.DeclStruct struct -> C.DeclStruct $ enrichStruct doxy name struct
+    C.DeclUnion  union  -> C.DeclUnion  $ enrichUnion  doxy name union
+    C.DeclEnum   enum   -> C.DeclEnum   $ enrichEnum   doxy name enum
+    C.DeclUntaggedEnumConstant uec ->
+      C.DeclUntaggedEnumConstant $
+        uec & #constant %~ enrichEnumConstant doxy name
+    other -> other
+
+enrichStruct :: Doxygen -> Text -> C.Struct EnrichComments -> C.Struct EnrichComments
+enrichStruct doxy name struct = struct
+    & #fields %~ map (enrichField doxy name)
+    & #flam   %~ C.mapFlamField (enrichRegularField doxy name)
+
+enrichUnion :: Doxygen -> Text -> C.Union EnrichComments -> C.Union EnrichComments
+enrichUnion doxy name union = union
+    & #fields %~ map (enrichField doxy name)
+
+enrichEnum :: Doxygen -> Text -> C.Enum EnrichComments -> C.Enum EnrichComments
+enrichEnum doxy name enum = enum
+    & #constants %~ map (enrichEnumConstant doxy name)
+
+enrichField ::
+     Doxygen -> Text -> C.Field EnrichComments -> C.Field EnrichComments
+enrichField doxy name = C.mapField (enrichRegularField doxy name) (enrichImplicitField doxy name)
+
+enrichRegularField ::
+     Doxygen -> Text -> C.RegularField EnrichComments -> C.RegularField EnrichComments
+enrichRegularField doxy name field =
+    maybe field (\c -> field & #info % #comment .~ Just c) $ do
+      lookupFieldComment doxy (KeyField name field.info.name.text)
+
+enrichImplicitField ::
+     Doxygen -> Text -> C.ImplicitField EnrichComments -> C.ImplicitField EnrichComments
+enrichImplicitField doxy name field =
+    #indirect %~ fmap (enrichIndirectField doxy name) $
+    maybe field (\c -> field & #info % #comment .~ Just c) $ do
+        lookupFieldComment doxy (KeyField name field.info.name.text)
+
+enrichIndirectField ::
+     Doxygen -> Text -> C.IndirectField EnrichComments -> C.IndirectField EnrichComments
+enrichIndirectField doxy name field =
+    maybe field (\c -> field & #info % #comment .~ Just c) $ do
+        lookupFieldComment doxy (KeyField name field.info.name.text)
+
+enrichEnumConstant ::
+     Doxygen -> Text -> C.EnumConstant EnrichComments -> C.EnumConstant EnrichComments
+enrichEnumConstant doxy name ec =
+    maybe ec (\c -> ec & #info % #comment .~ Just c) $ do
+      lookupFieldComment doxy (KeyEnumValue name ec.info.name.text)
+
+{-------------------------------------------------------------------------------
+  Enclosing declaration resolution
+-------------------------------------------------------------------------------}
+
+-- | Build the @\"::\"@-qualified name that doxygen uses for this declaration.
+--
+-- Named ancestors are joined with @\"::\"@ (e.g., @outer::inner@).
+-- Unnamed ancestors are skipped. Unnamed decls resolve to the nearest
+-- named ancestor.
+resolveQualifiedName :: C.DeclInfo EnrichComments -> Text
+resolveQualifiedName info =
+    Text.intercalate "::" (map (.name.text) path)
+  where
+    path :: [C.DeclId]
+    path =
+      filter (not . (.isUnnamed)) $
+      reverse (map getEnclosingRef info.enclosing) ++ [info.id]
+
+    getEnclosingRef :: C.EnclosingRef EnrichComments -> C.DeclId
+    getEnclosingRef = \case
+        C.EnclosingRef         x -> x
+        C.UnusableEnclosingRef x -> x
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+-- | Look up a doxygen comment by key and wrap its cross-references
+lookupFieldComment :: Doxygen -> DoxygenKey -> Maybe (C.Comment EnrichComments)
+lookupFieldComment doxy key = wrapDoxygenRefs <$> lookupComment key doxy
+
+-- | Wrap doxygen cross-references into 'C.CommentRef'
+wrapDoxygenRefs :: Doxy.Comment Doxy.DoxyRef -> C.Comment EnrichComments
+wrapDoxygenRefs comment = C.Comment (fmap wrapRef comment)
+  where
+    wrapRef :: Doxy.DoxyRef -> C.CommentRef EnrichComments
+    wrapRef (Doxy.DoxyRef name mKind) = C.CommentRef name Nothing mKind
diff --git a/src-internal/HsBindgen/Frontend/Pass/EnrichComments/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/EnrichComments/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/EnrichComments/IsPass.hs
@@ -0,0 +1,71 @@
+module HsBindgen.Frontend.Pass.EnrichComments.IsPass (
+    EnrichComments
+  ) where
+
+import HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Pass.Types (CoercePassAnonRef)
+import HsBindgen.Macro.Interface qualified as Macro
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type EnrichComments :: Pass
+data EnrichComments a
+
+-- We preserve the annotations from the @Parse@ pass (same as @FillUnnamedIds@)
+type family AnnEnrichComments ix where
+  AnnEnrichComments "Function"      = ReparseInfo Tokens
+  AnnEnrichComments "Global"        = ReparseInfo Tokens
+  AnnEnrichComments "IndirectField" = ReparseInfo Tokens
+  AnnEnrichComments "RegularField"  = ReparseInfo Tokens
+  AnnEnrichComments "Typedef"       = ReparseInfo Tokens
+  AnnEnrichComments _               = NoAnn
+
+instance IsPass EnrichComments
+
+instance PassId EnrichComments
+
+instance PassScopedName EnrichComments
+
+instance PassTypes EnrichComments
+
+instance PassMacro EnrichComments where
+  type MacroBody EnrichComments = Macro.Unresolved
+
+instance PassExtBinding EnrichComments
+
+instance PassCommentDecl EnrichComments where
+  type CommentDecl EnrichComments = Maybe (C.Comment EnrichComments)
+
+instance PassAnn EnrichComments where
+  type Ann ix EnrichComments = AnnEnrichComments ix
+
+instance PassMsg EnrichComments
+
+{-------------------------------------------------------------------------------
+  CoercePass
+
+  EnrichComments has the same associated types as FillUnnamedIds (same Id,
+  ScopedName, MacroBody, ExtBinding, MacroId, Ann). The only difference is
+  'C.CommentDecl', so all trivial helpers can use the default identity, and
+  'C.CoercePassCommentDecl' needs a custom instance that sets the comment to
+  'Nothing' (since @CommentDecl FillUnnamedIds = ()@ and
+  @CommentDecl EnrichComments = Maybe (Comment EnrichComments)@).
+-------------------------------------------------------------------------------}
+
+instance CoercePassAnonRef             FillUnnamedIds EnrichComments
+instance CoercePassId                  FillUnnamedIds EnrichComments
+instance CoercePassMacroBody           FillUnnamedIds EnrichComments
+instance CoercePassMacroId             FillUnnamedIds EnrichComments
+instance CoercePassMacroUnderlying     FillUnnamedIds EnrichComments
+instance CoercePassTypes               FillUnnamedIds EnrichComments
+instance CoercePassAnn "IndirectField" FillUnnamedIds EnrichComments
+instance CoercePassAnn "Global"        FillUnnamedIds EnrichComments
+instance CoercePassAnn "TypeFunArg"    FillUnnamedIds EnrichComments
+
+instance CoercePassCommentDecl FillUnnamedIds EnrichComments where
+  coercePassCommentDecl _ () = Nothing
diff --git a/src-internal/HsBindgen/Frontend/Pass/FillUnnamedIds.hs b/src-internal/HsBindgen/Frontend/Pass/FillUnnamedIds.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/FillUnnamedIds.hs
@@ -0,0 +1,442 @@
+module HsBindgen.Frontend.Pass.FillUnnamedIds (
+    fillUnnamedIds
+  ) where
+
+import Control.Monad.Except
+import Control.Monad.Reader
+import Data.Either (partitionEithers)
+import Data.Map qualified as Map
+import Data.Tuple
+
+import HsBindgen.Frontend.Analysis.UnnamedIdUsage
+import HsBindgen.Frontend.Pass.FillUnnamedIds.ChooseNames
+import HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Frontend.Pass.SimplifyAST.IsPass (SimplifyAST)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Util.Tracer (withCallStack)
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+-- | Assign name to all unnamed declarations
+fillUnnamedIds ::
+     HasCallStack
+  => UnnamedIdUsageAnalysis
+  -> [ParseResult l SimplifyAST]
+  -> ([ParseResult l FillUnnamedIds], [AnnMsg FillUnnamedIds])
+fillUnnamedIds usage parseResults =
+    swap . partitionEithers $
+      map (updateParseResult chosenNames) parseResults
+  where
+    chosenNames :: ChosenNames
+    chosenNames = chooseNames usage
+
+{-------------------------------------------------------------------------------
+  Update 'ParseResults' with chosen names
+-------------------------------------------------------------------------------}
+
+updateParseResult ::
+     forall l. HasCallStack
+  => ChosenNames
+  -> ParseResult l SimplifyAST
+  -> Either (AnnMsg FillUnnamedIds) (ParseResult l FillUnnamedIds)
+updateParseResult chosenNames result =
+    case result.classification of
+      ParseResultSuccess success -> do
+        auxSuccess success <$>
+          updateDefSite chosenNames success.decl.info.id
+      ParseResultUnavailable ->
+        auxUnavailable <$>
+          updateDefSite chosenNames result.id
+      ParseResultFailure failure ->
+        auxFailure failure <$>
+          updateDefSite chosenNames result.id
+  where
+    auxSuccess ::
+         ParseSuccess l SimplifyAST
+      -> C.DeclId
+      -> ParseResult l FillUnnamedIds
+    auxSuccess success declId' =
+        case runM chosenNames updated of
+          Left (UnusableUnnamedDecl unnamedId) -> ParseResult{
+              id             = declId'
+            , loc            = result.loc
+            , classification = ParseResultFailure $ ParseUnusableUnnamedDecl unnamedId
+            }
+          Right (declInfo', declKind') -> ParseResult{
+              id             = declInfo'.id
+            , loc            = result.loc
+            , classification = ParseResultSuccess ParseSuccess{
+                  decl = C.Decl{
+                      info = declInfo'
+                    , kind = declKind'
+                    , ann  = NoAnn
+                    }
+                , delayedParseMsgs = success.delayedParseMsgs
+                }
+            }
+
+      where
+        updated :: M (C.DeclInfo FillUnnamedIds, C.DeclKind l FillUnnamedIds)
+        updated = (,)
+            <$> updateDeclInfo declId' success.decl.info
+            <*> updateUseSites         success.decl.kind
+
+    auxUnavailable ::
+         C.DeclId
+      -> ParseResult l FillUnnamedIds
+    auxUnavailable declId' = ParseResult{
+          id             = declId'
+        , loc            = result.loc
+        , classification = ParseResultUnavailable
+        }
+
+    auxFailure ::
+         DelayedParseMsg
+      -> C.DeclId
+      -> ParseResult l FillUnnamedIds
+    auxFailure failure declId' = ParseResult{
+          id             = declId'
+        , loc            = result.loc
+        , classification = ParseResultFailure failure
+        }
+
+{-------------------------------------------------------------------------------
+  Update definition sites
+-------------------------------------------------------------------------------}
+
+updateDefSite ::
+     HasCallStack
+  => ChosenNames
+  -> Id SimplifyAST
+  -> Either (AnnMsg FillUnnamedIds) (Id FillUnnamedIds)
+updateDefSite chosenNames =
+    first (withCallStack . FillUnnamedIdsSkippedDecl) . fromPrelimDeclId chosenNames
+
+updateDeclInfo ::
+     C.DeclId
+  -> C.DeclInfo SimplifyAST
+  -> M (C.DeclInfo FillUnnamedIds)
+updateDeclInfo declId' info = do
+    enclosing' <- mapM updateEnclosing info.enclosing
+    pure C.DeclInfo{
+          loc              = info.loc
+        , id               = declId'
+        , sourceOrderIndex = info.sourceOrderIndex
+        , origin           = info.origin
+        , availability     = info.availability
+        , comment          = ()
+        , enclosing        = enclosing'
+        }
+  where
+    updateEnclosing ::
+      C.EnclosingRef SimplifyAST -> M (C.EnclosingRef FillUnnamedIds)
+    updateEnclosing = \case
+      C.EnclosingRef         x -> C.EnclosingRef <$> updateDeclId x
+      C.UnusableEnclosingRef x -> pure $ C.UnusableEnclosingRef x
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: monad for updating use sites
+-------------------------------------------------------------------------------}
+
+newtype M a = WrapM (
+      ReaderT ChosenNames (Except UnusableUnnamedDecl) a
+    )
+  deriving newtype (
+      Functor
+    , Applicative
+    , Monad
+    )
+
+-- | We encountered an unusable unnamed declaration
+--
+-- Not all use sites of unnamed decls are given a name; for example, if we have a
+-- function signature with an untagged struct, we will not even traverse that
+-- function signature in "HsBindgen.Frontend.Analysis.UnnamedIdUsage". This means
+-- that if we then try to /update/ those use sites, that will fail.
+--
+-- This is an internal type; the external equivalent is 'ParseUnusableUnnamedDecl'.
+data UnusableUnnamedDecl = UnusableUnnamedDecl C.UnnamedId
+  deriving stock (Show)
+
+runM :: ChosenNames -> M a -> Either UnusableUnnamedDecl a
+runM chosenNames (WrapM ma) = runExcept $ runReaderT ma chosenNames
+
+{-------------------------------------------------------------------------------
+  Update use sites
+-------------------------------------------------------------------------------}
+
+class UpdateUseSites a where
+  updateUseSites :: a SimplifyAST -> M (a FillUnnamedIds)
+
+instance UpdateUseSites (C.DeclKind l) where
+  updateUseSites = \case
+      C.DeclStruct               x -> C.DeclStruct               <$> updateUseSites x
+      C.DeclUnion                x -> C.DeclUnion                <$> updateUseSites x
+      C.DeclTypedef              x -> C.DeclTypedef              <$> updateUseSites x
+      C.DeclEnum                 x -> C.DeclEnum                 <$> updateUseSites x
+      C.DeclUntaggedEnumConstant x -> C.DeclUntaggedEnumConstant <$> updateUseSites x
+      C.DeclFunction             x -> C.DeclFunction             <$> updateUseSites x
+      C.DeclGlobal               x -> C.DeclGlobal               <$> updateUseSites x
+      C.DeclMacro                x -> return $ C.DeclMacro x
+      C.DeclOpaque mSize           -> return $ C.DeclOpaque mSize
+
+instance UpdateUseSites C.Struct where
+  updateUseSites struct =
+      reconstruct
+        <$> mapM updateUseSites struct.fields
+        <*> C.traverseFlamField updateUseSites struct.flam
+    where
+      reconstruct ::
+           [C.Field FillUnnamedIds]
+        -> C.Flam FillUnnamedIds
+        -> C.Struct FillUnnamedIds
+      reconstruct fields' flam' = C.Struct {
+            fields    = fields'
+          , flam      = flam'
+          , sizeof    = struct.sizeof
+          , alignment = struct.alignment
+          , ann       = NoAnn
+          }
+
+instance UpdateUseSites C.Union where
+  updateUseSites union =
+      reconstruct <$> mapM updateUseSites union.fields
+    where
+      reconstruct :: [C.Field FillUnnamedIds] -> C.Union FillUnnamedIds
+      reconstruct fields' = C.Union {
+            fields    = fields'
+          , sizeof    = union.sizeof
+          , alignment = union.alignment
+          , ann       = NoAnn
+          }
+
+instance UpdateUseSites C.Field where
+  updateUseSites = C.mapMField updateUseSites updateUseSites
+
+instance UpdateUseSites C.FieldInfo where
+  updateUseSites info = pure C.FieldInfo{
+        comment = ()
+      , name    = info.name
+      , loc     = info.loc
+      }
+
+instance UpdateUseSites C.RegularField where
+  updateUseSites field =
+      reconstruct
+        <$> updateUseSites field.info
+        <*> updateUseSites field.typ
+    where
+      reconstruct ::
+           C.FieldInfo FillUnnamedIds
+        -> C.Type FillUnnamedIds
+        -> C.RegularField FillUnnamedIds
+      reconstruct info' typ' = C.RegularField {
+            info   = info'
+          , typ    = typ'
+          , offset = field.offset
+          , width  = field.width
+          , ann    = field.ann
+          }
+
+instance UpdateUseSites C.ImplicitField where
+  updateUseSites field =
+      reconstruct
+        <$> updateUseSites field.info
+        <*> updateUseSites field.typRef
+        <*> mapM updateUseSites field.indirect
+    where
+      reconstruct ::
+           C.FieldInfo FillUnnamedIds
+        -> C.AnonRef FillUnnamedIds
+        -> [C.IndirectField FillUnnamedIds]
+        -> C.ImplicitField FillUnnamedIds
+      reconstruct info' typRef' indirect' = C.ImplicitField {
+            info     = info'
+          , typRef   = typRef'
+          , offset   = field.offset
+          , indirect = indirect'
+          , ann      = NoAnn
+          }
+
+instance UpdateUseSites C.AnonRef where
+  updateUseSites = \case
+      C.AnonRef ref -> C.AnonRef <$> updateDeclId ref
+
+instance UpdateUseSites C.IndirectField where
+  updateUseSites field =
+      reconstruct
+        <$> updateUseSites field.info
+        <*> updateUseSites field.typ
+        <*> mapM updateUseSites field.path
+    where
+      reconstruct ::
+           C.FieldInfo FillUnnamedIds
+        -> C.Type FillUnnamedIds
+        -> [C.AnonRef FillUnnamedIds]
+        -> C.IndirectField FillUnnamedIds
+      reconstruct info' typ' path' = C.IndirectField {
+            info = info'
+          , typ = typ'
+          , offset = field.offset
+          , width = Nothing
+          , path = path'
+          , ann = field.ann
+          }
+
+instance UpdateUseSites C.Typedef where
+  updateUseSites typedef =
+      reconstruct <$> updateUseSites typedef.typ
+    where
+      reconstruct :: C.Type FillUnnamedIds -> C.Typedef FillUnnamedIds
+      reconstruct typedefType' = C.Typedef {
+          typ = typedefType'
+        , ann = typedef.ann
+        }
+
+instance UpdateUseSites C.Global where
+  updateUseSites global =
+      reconstruct <$> updateUseSites global.typ
+    where
+      reconstruct :: C.Type FillUnnamedIds -> C.Global FillUnnamedIds
+      reconstruct globalType' = C.Global {
+          typ = globalType'
+        , ann = global.ann
+        }
+
+instance UpdateUseSites C.Enum where
+  updateUseSites enum =
+      reconstruct
+        <$> updateUseSites enum.typ
+        <*> mapM updateUseSites enum.constants
+    where
+      reconstruct ::
+           C.Type FillUnnamedIds
+        -> [C.EnumConstant FillUnnamedIds]
+        -> C.Enum FillUnnamedIds
+      reconstruct enumType' enumConstants' = C.Enum {
+            typ       = enumType'
+          , constants = enumConstants'
+          , sizeof    = enum.sizeof
+          , alignment = enum.alignment
+          , ann       = enum.ann
+          }
+
+instance UpdateUseSites C.Function where
+  updateUseSites function =
+      reconstruct
+        <$> mapM updateUseSites function.args
+        <*> updateUseSites function.res
+    where
+      reconstruct ::
+           [C.FunctionArg FillUnnamedIds]
+        -> C.Type FillUnnamedIds
+        -> C.Function FillUnnamedIds
+      reconstruct functionArgs' functionRes' = C.Function {
+            args  = functionArgs'
+          , res   = functionRes'
+          , attrs = function.attrs
+          , ann   = function.ann
+          }
+
+instance UpdateUseSites C.FunctionArg where
+  updateUseSites functionArg =
+      reconstruct
+        <$> updateUseSites functionArg.typ
+    where
+      reconstruct ::
+           C.Type FillUnnamedIds
+        -> C.FunctionArg FillUnnamedIds
+      reconstruct typ' = C.FunctionArg {
+            name = functionArg.name
+          , typ  = typ'
+          , ann  = functionArg.ann
+          }
+
+instance UpdateUseSites C.Type where
+  updateUseSites = go
+    where
+      go :: C.Type SimplifyAST -> M (C.Type FillUnnamedIds)
+      go = \case
+          -- Actual modifications
+          C.TypeRef     ref     -> C.TypeRef     <$> updateDeclId ref
+          C.TypeEnum    ref     ->
+            fmap C.TypeEnum $ C.Ref
+                <$> updateDeclId ref.name
+                <*> updateUseSites ref.underlying
+          C.TypeTypedef ref ->
+            fmap C.TypeTypedef $ C.Ref
+                <$> updateDeclId ref.name
+                <*> updateUseSites ref.underlying
+
+          -- Recursive cases
+          C.TypePointers n      ty -> C.TypePointers n <$> go ty
+          C.TypeConstArray n    ty -> C.TypeConstArray n <$> go ty
+          C.TypeIncompleteArray ty -> C.TypeIncompleteArray <$> go ty
+          C.TypeBlock           ty -> C.TypeBlock <$> go ty
+          C.TypeQual qual       ty -> C.TypeQual qual <$> go ty
+          C.TypeFun args res       -> C.TypeFun <$> mapM updateUseSites args <*> go res
+
+          -- SimpleCases
+          C.TypeVoid           -> return $ C.TypeVoid
+          C.TypePrim    pt     -> return $ C.TypePrim    pt
+          C.TypeComplex pt     -> return $ C.TypeComplex pt
+
+instance UpdateUseSites C.TypeFunArg where
+  updateUseSites arg = do
+      typ' <- updateUseSites arg.typ
+      pure C.TypeFunArgF {
+          typ = typ'
+        , ann = arg.ann
+        }
+
+updateDeclId :: C.PrelimDeclId -> M C.DeclId
+updateDeclId prelimDeclId = WrapM $ do
+    chosenNames <- ask
+    case fromPrelimDeclId chosenNames prelimDeclId of
+      Left  unnamedId -> throwError $ UnusableUnnamedDecl unnamedId
+      Right declId -> return declId
+
+{-------------------------------------------------------------------------------
+  Comments
+-------------------------------------------------------------------------------}
+
+instance UpdateUseSites C.EnumConstant where
+  updateUseSites constant =
+      reconstruct <$> updateUseSites constant.info
+    where
+      reconstruct :: C.FieldInfo FillUnnamedIds -> C.EnumConstant FillUnnamedIds
+      reconstruct enumConstantInfo' = C.EnumConstant{
+            info  = enumConstantInfo'
+          , value = constant.value
+          }
+
+instance UpdateUseSites C.UntaggedEnumConstant where
+  updateUseSites enumConst =
+      reconstruct <$> updateUseSites enumConst.constant
+    where
+      reconstruct :: C.EnumConstant FillUnnamedIds -> C.UntaggedEnumConstant FillUnnamedIds
+      reconstruct constant' = C.UntaggedEnumConstant{
+            typ      = enumConst.typ  -- PrimType has no use sites to update
+          , constant = constant'
+          }
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+-- | Construct 'C.DeclId' from 'C.PrelimDeclId'
+--
+-- Returns 'Left' an 'C.UnnamedId' if the 'C.PrelimDeclId' is unnamed and we
+-- have assigned no name.
+fromPrelimDeclId :: ChosenNames -> C.PrelimDeclId -> Either C.UnnamedId C.DeclId
+fromPrelimDeclId chosenNames = \case
+    C.PrelimDeclIdNamed name ->
+      Right C.DeclId{name = name, isUnnamed = False}
+    C.PrelimDeclIdUnnamed unnamedId ->
+      maybe (Left unnamedId) Right $ Map.lookup unnamedId chosenNames
diff --git a/src-internal/HsBindgen/Frontend/Pass/FillUnnamedIds/ChooseNames.hs b/src-internal/HsBindgen/Frontend/Pass/FillUnnamedIds/ChooseNames.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/FillUnnamedIds/ChooseNames.hs
@@ -0,0 +1,156 @@
+module HsBindgen.Frontend.Pass.FillUnnamedIds.ChooseNames (
+    ChosenNames
+  , chooseNames
+  ) where
+
+import Control.Monad.State
+import Data.Map qualified as Map
+
+import HsBindgen.Frontend.Analysis.UnnamedIdUsage (UnnamedIdUsageAnalysis (..))
+import HsBindgen.Frontend.Analysis.UnnamedIdUsage qualified as UnnamedIdUsageAnalysis
+import HsBindgen.Frontend.Pass.Parse.IsPass (Parse)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+type ChosenNames = Map C.UnnamedId C.DeclId
+
+-- | Choose names for unnamed declarations
+chooseNames :: UnnamedIdUsageAnalysis -> ChosenNames
+chooseNames (UnnamedIdUsageAnalysis usageAnalysis) =
+    Map.mapMaybe assignedName $
+      flip execState Map.empty $
+        -- Find name for any unnamed decl for which we found a use site
+        mapM nameFor (Map.keys usageAnalysis)
+  where
+    -- Name for the given 'C.UnnamedId'
+    --
+    -- Returns 'Nothing' if we fail to assign a name.
+    nameFor :: C.UnnamedId -> Memoize (Maybe C.DeclId)
+    nameFor = memoize $ \unnamedId ->
+        case Map.lookup unnamedId usageAnalysis of
+          Nothing    -> return Nothing      -- Unused (or unusable) unnamed decl
+          Just usage -> nameForUsage unnamedId usage
+
+    nameForUsage ::
+         C.UnnamedId
+      -> UnnamedIdUsageAnalysis.Context
+      -> Memoize (Maybe C.DeclId)
+    nameForUsage unnamedId = \case
+        UnnamedIdUsageAnalysis.Field declInfo fieldInfo ->
+          fmap (nameForField unnamedId fieldInfo) <$> declName declInfo.id
+        UnnamedIdUsageAnalysis.TypedefDirect declInfo ->
+          fmap (nameForTypedefDirect unnamedId) <$> declName declInfo.id
+        UnnamedIdUsageAnalysis.TypedefIndirect declInfo ->
+          fmap (nameForTypedefIndirect unnamedId) <$> declName declInfo.id
+        UnnamedIdUsageAnalysis.GlobalVar declInfo ->
+          fmap (nameForGlobalVar unnamedId) <$> declName declInfo.id
+
+    declName :: C.PrelimDeclId -> Memoize (Maybe C.DeclId)
+    declName = \case
+        C.PrelimDeclIdNamed name@C.DeclName{} ->
+          return $ Just C.DeclId{name = name, isUnnamed = False}
+        C.PrelimDeclIdUnnamed unnamedId ->
+          nameFor unnamedId
+
+    nameForField :: C.UnnamedId -> C.FieldInfo Parse -> C.DeclId -> C.DeclId
+    nameForField unnamedId field outerStruct = C.DeclId{
+          isUnnamed = True
+        , name   = C.DeclName{
+              text = outerStruct.name.text <> "_" <> field.name.text
+            , kind = unnamedId.kind
+            }
+        }
+
+    -- Assign the name of the typedef to the struct
+    --
+    -- In @clang >= 16@ this is done automatically; this means that we cannot
+    -- distinguish between these two declarations:
+    --
+    -- > typedef struct     { .. } foo;
+    -- > typedef struct foo { .. } foo;
+    --
+    -- Consequently we are unable to detect that @foo@ is unnamed in this
+    -- case. To emulate this behaviour older clang, we set @isUnnamed@ to @False@.
+    nameForTypedefDirect :: C.UnnamedId -> C.DeclId -> C.DeclId
+    nameForTypedefDirect unnamedId typedef = C.DeclId{
+          isUnnamed = False -- 'False' instead of 'True'!
+        , name   = C.DeclName{
+              text = typedef.name.text
+            , kind = unnamedId.kind
+            }
+        }
+
+    -- Typedef around a pointer to an untagged struct
+    --
+    -- Fortunately, clang does not assign a name to the struct in this situation
+    -- (or rather, it assigns a name such as "(untagged struct at ..)", so we can
+    -- detect this case.
+    nameForTypedefIndirect :: C.UnnamedId -> C.DeclId -> C.DeclId
+    nameForTypedefIndirect unnamedId typedef = C.DeclId{
+          isUnnamed = True
+        , name   = C.DeclName{
+              text = typedef.name.text <> "_Aux"
+            , kind = unnamedId.kind
+            }
+        }
+
+    -- | Use the name of the global variable as the tag for the untagged struct
+    --
+    -- For example, given:
+    --
+    -- > struct { int x; int y; } a;
+    --
+    -- the struct is given the tag "a".
+    --
+    -- Unlike 'nameForTypedefDirect' (where @typedef struct { .. } foo;@ creates
+    -- a real C type name @foo@), @struct { .. } bar;@ does /not/ create
+    -- any C type name — the struct remains untagged from C's perspective.
+    -- We set @isUnnamed@ to @True@ so that the backend can detect this and avoid
+    -- generating invalid C types like @struct bar *@.
+    nameForGlobalVar :: C.UnnamedId -> C.DeclId -> C.DeclId
+    nameForGlobalVar unnamedId globalVar = C.DeclId{
+          isUnnamed = True
+        , name   = C.DeclName{
+              text = globalVar.name.text
+            , kind = unnamedId.kind
+            }
+        }
+
+{-------------------------------------------------------------------------------
+  Internal: memoization
+
+  To avoid considering the same 'C.UnnamedId' over and over again, we maintain an
+  map for values already considered.
+-------------------------------------------------------------------------------}
+
+data AssignedId =
+    AssignedId C.DeclId
+  | FailedToAssignId
+  deriving stock (Show)
+
+assignedName :: AssignedId -> Maybe C.DeclId
+assignedName = \case
+    AssignedId name  -> Just name
+    FailedToAssignId -> Nothing
+
+type Memoize = State (Map C.UnnamedId AssignedId)
+
+memoize ::
+     (C.UnnamedId -> Memoize (Maybe C.DeclId))
+  -> (C.UnnamedId -> Memoize (Maybe C.DeclId))
+memoize f unnamedId = state $ \acc ->
+    case Map.lookup unnamedId acc of
+      Just memoized -> (assignedName memoized, acc)
+      Nothing       ->
+        case runState (f unnamedId) acc of
+          (mName, acc') -> (
+              mName
+            , case mName of
+                Nothing   -> Map.insert unnamedId FailedToAssignId  acc'
+                Just name -> Map.insert unnamedId (AssignedId name) acc'
+            )
+
diff --git a/src-internal/HsBindgen/Frontend/Pass/FillUnnamedIds/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/FillUnnamedIds/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/FillUnnamedIds/IsPass.hs
@@ -0,0 +1,77 @@
+module HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass (
+    FillUnnamedIds
+  , ImmediateFillUnnamedIdsMsg(..)
+  ) where
+
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type FillUnnamedIds :: Pass
+data FillUnnamedIds a
+
+-- We preserve the annotations from the @Parse@ pass
+type family AnnFillUnnamedIds ix where
+  AnnFillUnnamedIds "Function"      = ReparseInfo Tokens
+  AnnFillUnnamedIds "Global"        = ReparseInfo Tokens
+  AnnFillUnnamedIds "IndirectField" = ReparseInfo Tokens
+  AnnFillUnnamedIds "RegularField"  = ReparseInfo Tokens
+  AnnFillUnnamedIds "Typedef"       = ReparseInfo Tokens
+  AnnFillUnnamedIds _               = NoAnn
+
+instance IsPass FillUnnamedIds
+
+instance PassId FillUnnamedIds
+
+instance PassScopedName FillUnnamedIds
+
+instance PassTypes FillUnnamedIds
+
+instance PassMacro FillUnnamedIds where
+  type MacroBody FillUnnamedIds = Macro.Unresolved
+
+instance PassExtBinding FillUnnamedIds
+
+instance PassCommentDecl FillUnnamedIds
+
+instance PassAnn FillUnnamedIds where
+  type Ann ix FillUnnamedIds = AnnFillUnnamedIds ix
+
+instance PassMsg FillUnnamedIds where
+  type Msg FillUnnamedIds = ImmediateFillUnnamedIdsMsg
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+data ImmediateFillUnnamedIdsMsg =
+    -- | Skipped unused unnamed declaration
+    --
+    -- @clang@ will produce a warning for this ("declaration does not declare
+    -- anything"); we issue a separate message here in case we skip over
+    -- something that we shouldn't.
+    FillUnnamedIdsSkippedDecl C.UnnamedId
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace ImmediateFillUnnamedIdsMsg where
+  prettyForTrace = \case
+      FillUnnamedIdsSkippedDecl unnamedId -> PP.hsep [
+          "Skipped unused or unusable unnamed declaration"
+        , prettyForTrace unnamedId
+        ]
+
+instance IsTrace Level ImmediateFillUnnamedIdsMsg where
+  getDefaultLogLevel = \case
+      FillUnnamedIdsSkippedDecl{} -> Debug -- clang already warned
+
+  getSource  = const HsBindgen
+  getTraceId = const "fill-unnamed-ids"
diff --git a/src-internal/HsBindgen/Frontend/Pass/Final.hs b/src-internal/HsBindgen/Frontend/Pass/Final.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Final.hs
@@ -0,0 +1,48 @@
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+-- | Working with the frontend AST after the final pass
+--
+-- Intended for unqualified import.
+module HsBindgen.Frontend.Pass.Final (
+    Final
+  ) where
+
+import GHC.Records
+
+import HsBindgen.Frontend.Pass.MangleNames.IsPass qualified as MangleNames
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Final frontend pass
+--
+-- Backend passes should refer to 'Final' instead of the actual name of the
+-- final pass, so that if we add more passes, the backend is unaffected.
+type Final = Select
+
+{-------------------------------------------------------------------------------
+  Annotations
+
+  These virtual fields help protect the backend against changes in the frontend:
+  if we add further annotations, these virtual fields can continue to
+  exist.
+-------------------------------------------------------------------------------}
+
+instance HasField "names" (C.Struct Final) MangleNames.StructNames where
+  getField struct = struct.ann
+
+instance HasField "names" (C.Union Final) MangleNames.NewtypeNames where
+  getField union = union.ann
+
+instance HasField "names" (C.Enum Final) MangleNames.NewtypeNames where
+  getField enum = enum.ann
+
+instance HasField "names" (C.Typedef Final) MangleNames.TypedefNames where
+  getField typedef = typedef.ann
+
+instance HasField "names" (TypecheckedMacroType l Final) MangleNames.NewtypeNames where
+  getField macro = macro.ann
diff --git a/src-internal/HsBindgen/Frontend/Pass/MangleNames.hs b/src-internal/HsBindgen/Frontend/Pass/MangleNames.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/MangleNames.hs
@@ -0,0 +1,150 @@
+module HsBindgen.Frontend.Pass.MangleNames (
+    mangleNames
+  ) where
+
+import Data.Map qualified as Map
+import Data.Set qualified as Set
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Config.MangleCandidate (MangleCandidate (..))
+import HsBindgen.Config.MangleCandidate qualified as MangleCandidate
+import HsBindgen.Config.Prelims (FieldNamingStrategy)
+import HsBindgen.Frontend.Analysis.DeclIndex (Squashed (..))
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Analysis.Typedefs qualified as TypedefAnalysis
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.Pass.MangleNames.CreateNames
+import HsBindgen.Frontend.Pass.MangleNames.DetectClashes
+import HsBindgen.Frontend.Pass.MangleNames.Error
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.MangleNames.Names
+import HsBindgen.Frontend.Pass.MangleNames.ResolveNames
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.Util.Tracer (withCallStack)
+
+{-------------------------------------------------------------------------------
+  Top-level
+
+  Name mangling proceeds in three traversals:
+
+  1. 'createNames' chooses top-level names and all within-declaration names
+     (annotations and 'ScopedNamePair's), producing a 'CreateNames' AST whose
+     'Id' and 'ScopedName' references are still unresolved. It also produces the
+     'NameMap' and squash records.
+
+  2. 'detectClashes' assembles a single 'NameRegistry' from the 'NameMap'
+     (top-level names and scoped names) and the 'CreateNames' AST (local names
+     in annotations) and reports collisions.
+
+  3. 'resolveNames' rewrites 'C.DeclId' references into 'DeclIdPair's and
+     'C.ScopedName' references into 'ScopedNamePair' using the 'NameMap',
+     copying annotations across unchanged, and dropping the declarations flagged
+     by 'detectClashes'. This produces the final 'MangleNames' AST.
+
+  Importantly, name mangling can fail (Traversal 1), and names can conflict
+  (Traversal 2), ultimately leading to dangling references (Traversal 3) in
+  declarations referring to other declarations that have failed or are
+  conflicting.
+
+  In general, we commit to making /local decisions/, not caring about global
+  consequences (i.e., the fate of reverse transitive dependencies). In
+  particular, in Traversal 3, if we encounter a dangling reference, we mark the
+  declaration we currently handle as /unusable/.
+
+  /It is the job of selection to compute the consequences of all of these local
+  decisions/.
+-------------------------------------------------------------------------------}
+
+mangleNames ::
+     forall l. (HasCallStack, Macro.HasTypes l)
+  => FieldNamingStrategy
+  -> C.TranslationUnit l ResolveBindingSpecs
+  -> (C.TranslationUnit l MangleNames, [AnnMsg MangleNames])
+mangleNames fieldNaming unit = (
+         C.TranslationUnit{
+           decls        = decls3
+         , includeGraph = unit.includeGraph
+         , meta         = updateDeclMeta
+                            (failures1 ++ failures2 ++ failures3)
+                            squashes
+                            unit.meta
+        }
+    , msgs1 ++ catMaybes [
+          Just $ debugMsg $ MangleNamesNameMap nameMap
+        , bugMsg . MangleNamesNameMapDuplicates <$> nameMapDups
+        , Just $ debugMsg $ MangleNamesNameRegistry registry
+        ]
+    )
+  where
+    typedefAnalysis :: TypedefAnalysis.TypedefAnalysis
+    typedefAnalysis = TypedefAnalysis.fromDecls unit.meta.declUseGraph unit.decls
+
+    mangleCandidateConfig :: MangleCandidate Maybe
+    mangleCandidateConfig = MangleCandidate.mangleCandidateDefault
+
+    -- Traversal 1: choose top-level names and within-declaration names.
+    declsC      :: [C.Decl l CreateNames]
+    squashes    :: [(C.DeclId, Hs.Name Hs.NsTypeConstr, TypedefAnalysis.Squash)]
+    nameMap     :: NameMap
+    nameMapDups :: Maybe (NonEmpty DupAssign)
+    failures1   :: [MangleNamesFailure]
+    msgs1       :: [AnnMsg MangleNames]
+    (declsC, squashes, nameMap, nameMapDups, failures1, msgs1) =
+      createNames typedefAnalysis mangleCandidateConfig fieldNaming unit.decls
+
+    -- Traversal 2: detect clashes among all names.
+    registry  :: NameRegistry
+    failures2 :: [MangleNamesFailure]
+    (registry, failures2) = detectClashes fieldNaming nameMap declsC
+
+    dropped :: Set C.DeclId
+    dropped = Set.fromList $ map (.id) failures2
+
+    -- Traversal 3: resolve references.
+    decls3    :: [C.Decl l MangleNames]
+    failures3 :: [MangleNamesFailure]
+    (decls3, failures3) = resolveNames nameMap dropped declsC
+
+updateDeclMeta ::
+      [MangleNamesFailure]
+   -> [(C.DeclId, Hs.Name Hs.NsTypeConstr, TypedefAnalysis.Squash)]
+   -> DeclMeta l
+   -> DeclMeta l
+updateDeclMeta failures squashes declMeta = declMeta{
+      declIndex =
+        DeclIndex.registerMangleNamesFailure failuresMap $
+        DeclIndex.registerSquashedDeclarations squashesMap $
+          declMeta.declIndex
+    }
+  where
+    failuresMap :: Map C.DeclId (SingleLoc C.DeclPath, MangleNamesError)
+    failuresMap = Map.fromList $ map (\f -> (f.id, (f.loc, f.err))) failures
+
+    squashesMap ::  Map C.DeclId Squashed
+    squashesMap = Map.fromList $ map toSquashed squashes
+
+    toSquashed ::
+         (C.DeclId, Hs.Name Hs.NsTypeConstr, TypedefAnalysis.Squash)
+      -> (C.DeclId, Squashed)
+    toSquashed (cName, hsName, s) = (
+        cName
+      , Squashed {
+          typedefLoc   = s.typedefLoc
+        , targetNameC  = s.targetId
+        , targetNameHs = hsName
+        }
+      )
+
+
+debugMsg :: MangleNamesMsg -> AnnMsg MangleNames
+debugMsg = withCallStack . C.WithLocationInfo C.LocationUnavailable
+
+bugMsg :: MangleNamesMsg -> AnnMsg MangleNames
+bugMsg = withCallStack . C.WithLocationInfo C.LocationUnavailable
diff --git a/src-internal/HsBindgen/Frontend/Pass/MangleNames/CreateNames.hs b/src-internal/HsBindgen/Frontend/Pass/MangleNames/CreateNames.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/MangleNames/CreateNames.hs
@@ -0,0 +1,781 @@
+module HsBindgen.Frontend.Pass.MangleNames.CreateNames (
+    -- * Pass definition
+    CreateNames
+    -- * Traversal 1: create names
+  , createNames
+    -- * Shared types (needed by traversals 2 and 3)
+  , MangleNamesFailure(..)
+  , toFailure
+    -- * Shared utility (needed by traversal 3)
+  , withDeclNamespace
+  ) where
+
+import Control.Applicative ((<|>))
+import Control.Monad.Except (ExceptT, MonadError (..), liftEither, runExcept,
+                             runExceptT)
+import Control.Monad.Reader (Reader, asks, runReader)
+import Control.Monad.State (StateT (runStateT), modify)
+import Data.Foldable qualified as Foldable
+import Data.Map qualified as Map
+import Data.Proxy
+
+import Clang.HighLevel.Types
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Config.MangleCandidate (MangleCandidate (..))
+import HsBindgen.Config.MangleCandidate qualified as MangleCandidate
+import HsBindgen.Config.Prelims (FieldNamingStrategy (..))
+import HsBindgen.Frontend.Analysis.Typedefs (TypedefAnalysis)
+import HsBindgen.Frontend.Analysis.Typedefs qualified as TypedefAnalysis
+import HsBindgen.Frontend.Pass.MangleNames.Error
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.MangleNames.Names
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.Util.Tracer (WithCallStack, withCallStack)
+
+{-------------------------------------------------------------------------------
+  Intermediate pass: CreateNames
+
+  This pass is local to name mangling: it is /not/ exposed as a frontend
+  artefact and not selectable via the CLI. It is the result of the first of the
+  three name-mangling traversals ("create names").
+
+  'CreateNames' creates top-level declaration names (the 'Id' slots), scoped
+  names ('ScopedName'), and all local auxiliary names such as auxiliary type or
+  data constructor names.
+
+  'CreateNames', however, does not resolve names within declarations; names that
+  can be referred to from other declarations are stored in the 'NameMap'
+  (top-level names and scoped names). Names that are used purely locally are
+  stored in annotations (local auxiliary type and data constructor names).
+
+  The final 'resolveNames' traversal rewrites 'C.DeclId's into 'DeclIdPair's and
+  'C.ScopedName's into 'ScopedNamePair's, producing 'MangleNames'.
+
+  Note that @'Ann' ix 'CreateNames'@ and @'Ann' ix 'MangleNames'@ reduce to the
+  same bundle types. The annotations can therefore be carried across directly
+  during 'resolveNames'.
+-------------------------------------------------------------------------------}
+
+-- | Create names pass (local to name mangling)
+type CreateNames :: Pass
+data CreateNames a
+
+type family AnnCreateNames ix where
+  AnnCreateNames "Decl"                 = PrescriptiveDeclSpec
+  AnnCreateNames "Enum"                 = NewtypeNames
+  AnnCreateNames "Flam"                 = FlamNames
+  AnnCreateNames "Struct"               = StructNames
+  AnnCreateNames "Typedef"              = TypedefNames
+  AnnCreateNames "TypecheckedMacroType" = NewtypeNames
+  AnnCreateNames "Union"                = NewtypeNames
+  AnnCreateNames _                      = NoAnn
+
+instance IsPass CreateNames
+
+instance PassId CreateNames where
+  type Id CreateNames = C.DeclId
+
+instance PassScopedName CreateNames where
+  type ScopedName CreateNames = C.ScopedName
+
+instance PassTypes CreateNames
+
+instance PassMacro CreateNames where
+  type MacroId         CreateNames = C.DeclId
+  type MacroBody       CreateNames = TypecheckedMacro CreateNames
+  type MacroUnderlying CreateNames = C.Type CreateNames
+
+  macroIdId _ = id
+
+instance PassExtBinding CreateNames where
+  type ExtBinding CreateNames = BindingSpec.ResolvedExtBinding
+
+  extBindingId _ = (.cName)
+
+instance PassCommentDecl CreateNames where
+  type CommentDecl CreateNames = Maybe (C.Comment CreateNames)
+
+instance PassAnn CreateNames where
+  type Ann ix CreateNames = AnnCreateNames ix
+
+instance PassMsg CreateNames where
+  type Msg CreateNames = C.WithLocationInfo MangleNamesMsg
+
+{-------------------------------------------------------------------------------
+  CoercePass: ResolveBindingSpecs → CreateNames
+
+  Used by the "create names" traversal to reindex the parts of a declaration
+  that do not change representation (types, comments, scoped names, enclosing
+  references). The 'Id' (and hence 'MacroId'), 'ScopedName', and 'ExtBinding'
+  representations agree between the two passes, so these coercions are pure
+  reindexing.
+-------------------------------------------------------------------------------}
+
+instance CoercePassId               ResolveBindingSpecs CreateNames
+instance CoercePassMacroId          ResolveBindingSpecs CreateNames
+instance CoercePassAnn "TypeFunArg" ResolveBindingSpecs CreateNames
+
+instance CoercePassMacroUnderlying ResolveBindingSpecs CreateNames where
+  coercePassMacroUnderlying _ = coercePass
+
+instance CoercePassCommentDecl ResolveBindingSpecs CreateNames where
+  coercePassCommentDecl _ = fmap coercePass
+
+{-------------------------------------------------------------------------------
+  Shared types
+-------------------------------------------------------------------------------}
+
+data MangleNamesFailure = MangleNamesFailure {
+      id  :: C.DeclId
+    , loc :: SingleLoc C.DeclPath
+    , err :: MangleNamesError
+    }
+  deriving (Show, Eq, Ord, Generic)
+
+toFailure :: (Id p ~ C.DeclId) => C.DeclInfo p -> MangleNamesError -> MangleNamesFailure
+toFailure i e = MangleNamesFailure i.id i.loc e
+
+{-------------------------------------------------------------------------------
+  Shared utility
+-------------------------------------------------------------------------------}
+
+withDeclNamespace ::
+     (MacroBody p ~ TypecheckedMacro p)
+  => C.DeclKind l p
+  -> (forall ns. Hs.SingNamespace ns => Proxy ns -> r)
+  -> r
+withDeclNamespace kind k =
+    case kind of
+      C.DeclStruct{}               -> k (Proxy @Hs.NsTypeConstr)
+      C.DeclUnion{}                -> k (Proxy @Hs.NsTypeConstr)
+      C.DeclTypedef{}              -> k (Proxy @Hs.NsTypeConstr)
+      C.DeclEnum{}                 -> k (Proxy @Hs.NsTypeConstr)
+      C.DeclUntaggedEnumConstant{} -> k (Proxy @Hs.NsConstr)
+      C.DeclOpaque{}               -> k (Proxy @Hs.NsTypeConstr)
+      C.DeclFunction{}             -> k (Proxy @Hs.NsVar)
+      C.DeclGlobal{}               -> k (Proxy @Hs.NsVar)
+
+      C.DeclMacro macro ->
+        case macro of
+          MacroType{}  -> k (Proxy @Hs.NsTypeConstr)
+          MacroValue{} -> k (Proxy @Hs.NsVar)
+
+{-------------------------------------------------------------------------------
+  Internal: working with 'MangleCandidate'
+-------------------------------------------------------------------------------}
+
+type E m a = ExceptT MangleNamesCreationError m a
+
+mangleCandidate :: forall ns.
+     Hs.SingNamespace ns
+  => MangleCandidate Maybe
+  -> Proxy ns
+  -> Text
+  -> E Identity (Hs.Name ns)
+mangleCandidate mc _ cName =
+    case MangleCandidate.mangleCandidate mc cName of
+      Just hsName -> pure hsName
+      Nothing     -> throwError $ CreateNamesCouldNotMangle cName
+
+{-------------------------------------------------------------------------------
+  Traversal 1: Create names
+
+  For each declaration we first choose its top-level name (step 1a,
+  'nameForDecl'). When that succeeds, we immediately create all its
+  within-declaration names (step 1b, 'createDecl'). This includes creating
+  scoped names and purely local names.
+
+  The top-level name feeds the 'NameMap' regardless of what happens in 1b: a
+  squashed or otherwise un-emitted declaration must still be resolvable by name.
+  Scoped names are also fed into the 'NameMap'.
+-------------------------------------------------------------------------------}
+
+createNames ::
+     forall l. (HasCallStack, Macro.HasTypes l)
+  => TypedefAnalysis
+  -> MangleCandidate Maybe
+  -> FieldNamingStrategy
+  -> [C.Decl l ResolveBindingSpecs]
+  -> ( [C.Decl l CreateNames]
+     , [(C.DeclId, Hs.Name Hs.NsTypeConstr, TypedefAnalysis.Squash)]
+     , NameMap
+     , Maybe (NonEmpty DupAssign)
+     , [MangleNamesFailure]
+     , [AnnMsg MangleNames]
+     )
+createNames td mc strategy decls = (
+      map (snd . snd) successes
+    , squashes
+    , nameMap
+    , nameMapDups
+    , failures
+    , messages
+    )
+  where
+    specifiedNames :: Map C.DeclId (Hs.Name Hs.NsTypeConstr)
+    specifiedNames = Map.fromList $ mapMaybe getSpecifiedName decls
+
+    getSpecifiedName ::
+      C.Decl l ResolveBindingSpecs -> Maybe (C.DeclId, Hs.Name Hs.NsTypeConstr)
+    getSpecifiedName decl = (decl.info.id,) <$> ((.hsName) =<< decl.ann.cSpec)
+
+    env :: CreateEnv
+    env = CreateEnv{
+        mangleCandidate     = mc
+      , fieldNamingStrategy = strategy
+      }
+
+    results :: [CreateNamesResult ([ScopedNamePair], C.Decl l CreateNames)]
+    messages :: [AnnMsg MangleNames]
+    (results, messages) = second concat $ unzip $ map perDecl decls
+
+    perDecl ::
+         C.Decl l ResolveBindingSpecs
+      -> (CreateNamesResult ([ScopedNamePair], C.Decl l CreateNames), [AnnMsg MangleNames])
+    perDecl decl = (,msgs) $ case nameResult of
+        CnFailure err      -> CnFailure err
+        CnSquashed nC nH s -> CnSquashed nC nH s
+        CnMangled name ()  -> createNamesWithin env name decl
+      where
+        nameResult :: CreateNamesResult ()
+        msgs       :: [AnnMsg MangleNames]
+        (nameResult, msgs) = nameForDecl td mc specifiedNames decl
+
+    failures  :: [MangleNamesFailure]
+    squashes  :: [(C.DeclId, Hs.Name Hs.NsTypeConstr, TypedefAnalysis.Squash)]
+    successes :: [(DeclIdPair, ([ScopedNamePair], C.Decl l CreateNames))]
+    (failures, squashes, successes) = partitionCreateNamesResults results
+
+    nameMap :: NameMap
+    nameMapDups :: Maybe (NonEmpty DupAssign)
+    (nameMap, nameMapDups) = fromNames $
+         map fromSuccess successes
+      ++ map fromSquash squashes
+      where
+        fromSuccess (declIdPair, (scopedNamePairs, _)) = (declIdPair, scopedNamePairs)
+        fromSquash (cN, hN, _)                         = (declIdPair, scopedNamePairs)
+          where
+            declIdPair = DeclIdPair cN (Hs.demoteNs hN)
+            scopedNamePairs = []
+
+nameForDecl ::
+     HasCallStack
+  => TypedefAnalysis
+  -> MangleCandidate Maybe
+  -> Map C.DeclId (Hs.Name Hs.NsTypeConstr)
+  -> C.Decl l ResolveBindingSpecs
+  -> (CreateNamesResult (), [AnnMsg MangleNames])
+nameForDecl td mc specifiedNames decl =
+    second toMs $
+    withDeclNamespace decl.kind $ \(nsProxy :: Proxy ns) ->
+      let mangleNs :: Text -> Either MangleNamesCreationError (Hs.Name ns)
+          mangleNs d = runExcept $ mangleCandidate mc nsProxy d
+      in case Map.lookup declId td.map of
+        -- Squashing always affects two declarations: the surrounding typedef
+        -- (squashed) and the inner declaration, which "uses the name of" the
+        -- typedef (see 'UseNameOf' below). We generate no binding for the
+        -- typedef, but we still need _two_ name-map entries pointing at the same
+        -- Haskell name: one for the inner declaration and one for the typedef.
+        --
+        -- Crucially, this squash decision is independent of whether a name was
+        -- specified: a squashed typedef must never be emitted as an ordinary
+        -- binding, or it would collide with the inner declaration it shares a
+        -- name with. A specified name (on the typedef itself, or failing that on
+        -- its squash target) is honoured for the name-map entry; otherwise we
+        -- mangle the typedef's own name.
+        --
+        -- TODO <https://github.com/well-typed/hs-bindgen/issues/1436>
+        -- When squashing becomes configurable, revisit how a specified name
+        -- interacts with squashing here.
+        Just (TypedefAnalysis.Squash s) ->
+          case Hs.singNamespace @ns of
+            Hs.SNsTypeConstr ->
+              case Map.lookup declId specifiedNames
+                     <|> Map.lookup s.targetId specifiedNames of
+                Just hsNm -> (CnSquashed declId hsNm s, [])
+                Nothing   ->
+                  mangleType declId.name.text & \case
+                    Left err   -> failWith err
+                    Right hsNm -> (CnSquashed declId hsNm s, [])
+            _otherwise ->
+              failWith $ CreateNamesSquashMustBeTypeConstr
+                (Hs.namespaceOf $ Hs.singNamespace @ns)
+
+        mConclusion ->
+          case Map.lookup declId specifiedNames of
+            Just hsNm ->
+              -- Binding spec specified a name for this declaration. This
+              -- overrides any naming decision we might make here.
+              (succeedWith hsNm, [])
+            Nothing ->
+              case mConclusion of
+                Nothing ->
+                  mangleNs declId.name.text & \case
+                    Left err   -> failWith err
+                    Right hsNm -> (succeedWith hsNm, [])
+                Just (TypedefAnalysis.AddSuffix suffix) ->
+                  mangleNs (declId.name.text <> suffix) & \case
+                    Left err ->
+                      failWith err
+                    Right hsNm ->
+                      ( succeedWith hsNm
+                      , [MangleNamesAssignedName (Hs.demoteNs hsNm)] )
+                Just (TypedefAnalysis.UseNameOf declId') ->
+                  case Map.lookup declId' specifiedNames of
+                    Just hsNm ->
+                      ( succeedWith hsNm
+                      , [ MangleNamesReusedAssignedName (Hs.demoteNs hsNm) ] )
+                    Nothing ->
+                      mangleNs declId'.name.text & \case
+                        Left err ->
+                          failWith err
+                        Right hsNm ->
+                          ( succeedWith hsNm
+                          , [ MangleNamesAssignedName (Hs.demoteNs hsNm)
+                            | declId.name.text /= declId'.name.text ] )
+  where
+    declId :: C.DeclId
+    declId = decl.info.id
+
+    info :: C.DeclInfo ResolveBindingSpecs
+    info = decl.info
+
+    failWith :: MangleNamesCreationError -> (CreateNamesResult a, [MangleNamesMsg])
+    failWith err = (CnFailure $ toFailure info (MangleNamesCreationError err), [])
+
+    getPair :: Hs.SingNamespace ns => Hs.Name ns -> DeclIdPair
+    getPair = DeclIdPair declId . Hs.demoteNs
+
+    succeedWith :: Hs.SingNamespace ns => Hs.Name ns -> CreateNamesResult ()
+    succeedWith n = CnMangled (getPair n) ()
+
+    toMs :: HasCallStack => [a] -> [WithCallStack (C.WithLocationInfo a)]
+    toMs = map (withCallStack . withDeclLoc decl.info)
+
+    mangleType :: Text -> Either MangleNamesCreationError (Hs.Name Hs.NsTypeConstr)
+    mangleType d =
+      runExcept $
+        mangleCandidate mc (Proxy :: Proxy Hs.NsTypeConstr) d
+
+{-------------------------------------------------------------------------------
+  Traversal 1b: within-declaration names
+-------------------------------------------------------------------------------}
+
+data CreateEnv = CreateEnv{
+      mangleCandidate     :: MangleCandidate Maybe
+    , fieldNamingStrategy :: FieldNamingStrategy
+    }
+  deriving stock (Generic)
+
+type CreateM   = Reader CreateEnv
+
+data CreateSt = CreateSt{
+      scopedNames :: [ScopedNamePair]
+    }
+  deriving stock (Generic)
+
+emptyCreateSt :: CreateSt
+emptyCreateSt = CreateSt []
+
+type CreateS   = StateT CreateSt CreateM
+
+type CreateE a = ExceptT MangleNamesCreationError CreateS a
+
+runCreate :: CreateEnv -> CreateSt -> CreateE a -> (Either MangleNamesCreationError a, CreateSt)
+runCreate env st action = runReader (runStateT (runExceptT action) st) env
+
+-- | Apply Haskell naming rules to a candidate name
+mkName ::
+     Hs.SingNamespace ns
+  => Proxy ns -> Text -> CreateE (Hs.Name ns)
+mkName ns candidate = do
+    mc <- asks (.mangleCandidate)
+    liftEither . runExcept $ mangleCandidate mc ns candidate
+
+data CreateNamesResult a =
+      CnFailure   MangleNamesFailure
+    | CnSquashed  C.DeclId (Hs.Name Hs.NsTypeConstr) TypedefAnalysis.Squash
+    | CnMangled   DeclIdPair a
+
+partitionCreateNamesResults ::
+     [CreateNamesResult a]
+  -> ( [MangleNamesFailure]
+     , [(C.DeclId, Hs.Name Hs.NsTypeConstr, TypedefAnalysis.Squash)]
+     , [(DeclIdPair, a)] )
+partitionCreateNamesResults = rev . Foldable.foldl' aux ([], [], [])
+  where
+    aux (fs, ss, ds) = \case
+      CnFailure  f       -> (f:fs, ss,           ds      )
+      CnSquashed cN hN s -> (fs,   (cN,hN,s):ss, ds      )
+      CnMangled  n d     -> (fs,   ss,           (n,d):ds)
+
+    rev (fs, ss, ds) = (reverse fs, reverse ss, reverse ds)
+
+-- | Create the within-declaration names of a declaration whose top-level name
+-- ('hsName') has already been chosen in step 1a.
+createNamesWithin ::
+     Macro.HasTypes l
+  => CreateEnv
+  -> DeclIdPair
+  -> C.Decl l ResolveBindingSpecs
+  -> CreateNamesResult ([ScopedNamePair], C.Decl l CreateNames)
+createNamesWithin env declIdPair decl =
+    case runCreate env emptyCreateSt (createDeclKind declIdPair.hsName.text decl.kind) of
+      (Left err, _)   -> CnFailure $ toFailure decl.info (MangleNamesCreationError err)
+      (Right kind, st) -> CnMangled declIdPair (
+          st.scopedNames
+        , C.Decl{
+              info = coercePass decl.info
+            , kind = kind
+            , ann  = decl.ann
+            }
+        )
+
+createDeclKind ::
+     Macro.HasTypes l
+  => Text
+  -> C.DeclKind l ResolveBindingSpecs
+  -> CreateE (C.DeclKind l CreateNames)
+createDeclKind hsName = \case
+    C.DeclStruct               x -> C.DeclStruct               <$> createStruct hsName x
+    C.DeclUnion                x -> C.DeclUnion                <$> createUnion hsName x
+    C.DeclEnum                 x -> C.DeclEnum                 <$> createEnum hsName x
+    C.DeclUntaggedEnumConstant x -> C.DeclUntaggedEnumConstant <$> createUntaggedEnumConstant x
+    C.DeclTypedef              x -> C.DeclTypedef              <$> createTypedef hsName x
+    C.DeclFunction             x -> C.DeclFunction             <$> createFunction x
+    C.DeclMacro                x -> C.DeclMacro                <$> createMacro hsName x
+    C.DeclGlobal               x -> C.DeclGlobal               <$> createGlobal x
+    C.DeclOpaque mSize           -> pure (C.DeclOpaque mSize)
+
+{-------------------------------------------------------------------------------
+  Traversal 1b: name-bundle constructors
+-------------------------------------------------------------------------------}
+
+createStructNames :: Text -> CreateE StructNames
+createStructNames name = do
+    constr <- mkName (Proxy @Hs.NsConstr) name
+    pure StructNames{
+        constr = constr
+      }
+
+-- | Create names for the flexible array member (FLAM), if present
+--
+-- The auxiliary type-constructor name is created exactly when there is a FLAM
+-- and carried inside the 'C.Flam' constructor alongside the field, so that name
+-- creation cannot diverge from code generation
+-- (<https://github.com/well-typed/hs-bindgen/issues/1925>).
+createFlam :: Text -> C.Flam ResolveBindingSpecs -> CreateE (C.Flam CreateNames)
+createFlam _      C.NoFlam        = pure C.NoFlam
+createFlam hsName (C.Flam field _) = do
+    field'  <- createRegularField hsName field
+    auxName <- mkName (Proxy @Hs.NsTypeConstr) (hsName <> "_Aux")
+    pure $ C.Flam field' FlamNames{ aux = auxName }
+
+-- | Generic construction of newtype names, given only the type name
+createNewtypeNames :: FieldNamingStrategy -> Text -> CreateE NewtypeNames
+createNewtypeNames strategy name = do
+    dataConstr <- mkName (Proxy @Hs.NsConstr) name
+    field      <- mkName (Proxy @Hs.NsVar) $ case strategy of
+                    AddFieldPrefixes  -> "unwrap" <> name
+                    OmitFieldPrefixes -> "unwrap"
+    pure NewtypeNames{
+        dataConstr = dataConstr
+      , field      = field
+      }
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1925>
+--
+-- Whether we need the auxiliary name or not should be reflected in the AST, so
+-- we can use an annotation just like we do for FLAMs.
+createTypedefNames ::
+  Bool -> FieldNamingStrategy -> Text -> CreateE TypedefNames
+createTypedefNames isFunPtr strategy name = do
+    orig <- createNewtypeNames strategy name
+    aux  <-
+      if isFunPtr then do
+        auxName  <- mkName (Proxy @Hs.NsTypeConstr) $ name <> "_Aux"
+        auxNames <- createNewtypeNames strategy auxName.text
+        pure $ Just (auxName, auxNames)
+      else
+        pure Nothing
+    pure TypedefNames{
+        orig = orig
+      , aux  = aux
+      }
+
+{-------------------------------------------------------------------------------
+  Traversal 1b: scoped names
+-------------------------------------------------------------------------------}
+
+createFieldName :: Text -> C.ScopedName -> CreateE ScopedNamePair
+createFieldName hsName fieldCName = do
+    strategy <- asks (.fieldNamingStrategy)
+    let candidate :: Text
+        candidate = case strategy of
+          AddFieldPrefixes  -> hsName <> "_" <> fieldCName.text
+          OmitFieldPrefixes -> fieldCName.text
+    name <- mkName (Proxy @Hs.NsVar) candidate
+    let scopedNamePair = ScopedNamePair{
+        cName  = fieldCName
+      , hsName = Hs.demoteNs name
+      }
+    modify $ #scopedNames %~ (scopedNamePair:)
+    pure scopedNamePair
+
+-- | Create an enum constant name
+--
+-- Since these live in the global namespace, we do not prepend the name of the
+-- enclosing enum.
+createEnumConstantName :: C.ScopedName -> CreateE ScopedNamePair
+createEnumConstantName cName = do
+    name <- mkName (Proxy @Hs.NsConstr) cName.text
+    let scopedNamePair = ScopedNamePair{
+        cName  = cName
+      , hsName = Hs.demoteNs name
+      }
+    modify $ #scopedNames %~ (scopedNamePair:)
+    pure scopedNamePair
+
+-- | Create function argument name
+--
+-- Function argument names are not really used when generating Haskell code.
+-- They are more relevant for documentation purposes so we don't do any
+-- mangling.
+createArgumentName :: C.ScopedName -> CreateE ScopedNamePair
+createArgumentName argName = do
+    name <- mkName (Proxy @Hs.NsVar) argName.text
+    let scopedNamePair = ScopedNamePair{
+        cName  = argName
+      , hsName = Hs.demoteNs name
+      }
+    modify $ #scopedNames %~ (scopedNamePair:)
+    pure scopedNamePair
+
+{-------------------------------------------------------------------------------
+  Traversal 1b: per-construct creators
+-------------------------------------------------------------------------------}
+
+createStruct ::
+     Text -> C.Struct ResolveBindingSpecs -> CreateE (C.Struct CreateNames)
+createStruct hsName struct = do
+    fields <- mapM (createField hsName) struct.fields
+    flam   <- createFlam hsName struct.flam
+    names  <- createStructNames hsName
+    pure C.Struct{
+        fields    = fields
+      , flam      = flam
+      , ann       = names
+      , sizeof    = struct.sizeof
+      , alignment = struct.alignment
+      }
+
+createUnion ::
+     Text -> C.Union ResolveBindingSpecs -> CreateE (C.Union CreateNames)
+createUnion hsName union = do
+    strategy <- asks (.fieldNamingStrategy)
+    names    <- createNewtypeNames strategy hsName
+    fields   <- mapM (createField hsName) union.fields
+    pure C.Union{
+        fields    = fields
+      , ann       = names
+      , sizeof    = union.sizeof
+      , alignment = union.alignment
+      }
+
+createField ::
+     Text
+  -> C.Field ResolveBindingSpecs
+  -> CreateE (C.Field CreateNames)
+createField hsName = C.mapMField (createRegularField hsName) (createImplicitField hsName)
+
+createRegularField ::
+     Text
+  -> C.RegularField ResolveBindingSpecs
+  -> CreateE (C.RegularField CreateNames)
+createRegularField hsName field = do
+    name' <- createFieldName hsName field.info.name
+    pure C.RegularField{
+        info   = C.FieldInfo{
+                     loc     = field.info.loc
+                   , name    = name'.cName
+                   , comment = fmap coercePass field.info.comment
+                   }
+      , typ    = coercePass field.typ
+      , offset = field.offset
+      , width  = field.width
+      , ann    = field.ann
+      }
+
+createImplicitField ::
+     Text
+  -> C.ImplicitField ResolveBindingSpecs
+  -> CreateE (C.ImplicitField CreateNames)
+createImplicitField hsName field = do
+    name'     <- createFieldName hsName field.info.name
+    typRef'   <- createAnonRef field.typRef
+    indirect' <- mapM (createIndirectField hsName) field.indirect
+    pure C.ImplicitField{
+        info = C.FieldInfo{
+                   loc     = field.info.loc
+                 , name    = name'.cName
+                 , comment = fmap coercePass field.info.comment
+                 }
+      , typRef = typRef'
+      , offset = field.offset
+      , indirect = indirect'
+      , ann  = NoAnn
+      }
+
+createAnonRef ::
+     C.AnonRef ResolveBindingSpecs
+  -> CreateE (C.AnonRef CreateNames)
+createAnonRef = \case
+    C.AnonRef ref -> pure $ C.AnonRef ref
+    C.AnonExtBinding ext -> pure $ C.AnonExtBinding $ C.coercePassExtBindingRef ext
+
+createIndirectField ::
+     Text
+  -> C.IndirectField ResolveBindingSpecs
+  -> CreateE (C.IndirectField CreateNames)
+createIndirectField hsName field = do
+    name' <- createFieldName hsName field.info.name
+    path' <- mapM createAnonRef field.path
+    pure C.IndirectField{
+        info = C.FieldInfo{
+                   loc     = field.info.loc
+                 , name    = name'.cName
+                 , comment = fmap coercePass field.info.comment
+                 }
+      , typ  = coercePass field.typ
+      , offset = field.offset
+      , width = field.width
+      , path = path'
+      , ann  = NoAnn
+      }
+
+createEnum :: Text -> C.Enum ResolveBindingSpecs -> CreateE (C.Enum CreateNames)
+createEnum hsName enum = do
+    strategy  <- asks (.fieldNamingStrategy)
+    names     <- createNewtypeNames strategy hsName
+    constants <- mapM createEnumConstant enum.constants
+    pure C.Enum{
+        typ       = coercePass enum.typ
+      , constants = constants
+      , ann       = names
+      , sizeof    = enum.sizeof
+      , alignment = enum.alignment
+      }
+
+createEnumConstant ::
+     C.EnumConstant ResolveBindingSpecs
+  -> CreateE (C.EnumConstant CreateNames)
+createEnumConstant constant = do
+    name' <- createEnumConstantName constant.info.name
+    pure C.EnumConstant{
+        info  = C.FieldInfo{
+                    loc     = constant.info.loc
+                  , name    = name'.cName
+                  , comment = fmap coercePass constant.info.comment
+                  }
+      , value = constant.value
+      }
+
+createUntaggedEnumConstant ::
+     C.UntaggedEnumConstant ResolveBindingSpecs
+  -> CreateE (C.UntaggedEnumConstant CreateNames)
+createUntaggedEnumConstant (C.UntaggedEnumConstant primTyp constant) = do
+    constant' <- createEnumConstant constant
+    pure C.UntaggedEnumConstant{
+        typ      = primTyp
+      , constant = constant'
+      }
+
+createTypedef ::
+     Text -> C.Typedef ResolveBindingSpecs -> CreateE (C.Typedef CreateNames)
+createTypedef hsName typedef = do
+    strategy <- asks (.fieldNamingStrategy)
+    names    <- createTypedefNames isFunPtr strategy hsName
+    pure C.Typedef{
+        typ = coercePass typedef.typ
+      , ann = names
+      }
+  where
+    -- TODO https://github.com/well-typed/hs-bindgen/issues/1925
+    --
+    -- Tie generation of names to the generation of the associated code. This
+    -- is especially ugly.
+    isFunPtr :: Bool
+    isFunPtr = isJust $ typedef <$ C.getFirstFunTypeIndirection typedef.typ
+
+createFunction ::
+     C.Function ResolveBindingSpecs -> CreateE (C.Function CreateNames)
+createFunction function = do
+    args <- mapM createFunctionArg function.args
+    pure C.Function{
+        args  = args
+      , res   = coercePass function.res
+      , attrs = function.attrs
+      , ann   = function.ann
+      }
+  where
+    createFunctionArg ::
+         C.FunctionArg ResolveBindingSpecs
+      -> CreateE (C.FunctionArg CreateNames)
+    createFunctionArg arg = do
+      name' <- traverse createArgumentName arg.name
+      pure C.FunctionArg{
+          name = fmap (.cName) name'
+        , typ  = coercePass arg.typ
+        , ann  = arg.ann
+        }
+
+createGlobal ::
+     C.Global ResolveBindingSpecs
+  -> CreateE (C.Global CreateNames)
+createGlobal global = pure C.Global{
+      typ = coercePass global.typ
+    , ann = global.ann
+    }
+
+createMacro ::
+     Macro.HasTypes l
+  => Text
+  -> TypecheckedMacro ResolveBindingSpecs l
+  -> CreateE (TypecheckedMacro CreateNames l)
+createMacro hsName = \case
+    MacroType  typ -> MacroType <$> createMacroType hsName typ
+    MacroValue val -> pure $ MacroValue (coercePass val)
+
+createMacroType ::
+     Macro.HasTypes l
+  => Text
+  -> TypecheckedMacroType l ResolveBindingSpecs
+  -> CreateE (TypecheckedMacroType l CreateNames)
+createMacroType hsName macroType = do
+    strategy <- asks (.fieldNamingStrategy)
+    names    <- createNewtypeNames strategy hsName
+    pure TypecheckedMacroType{
+        body = fmap coercePass macroType.body
+      , deps = macroType.deps
+      , ann  = names
+      }
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+withDeclLoc :: forall p a.
+     IsPass p
+  => C.DeclInfo p -> a -> C.WithLocationInfo a
+withDeclLoc info msg = C.WithLocationInfo{
+      loc = idLocationInfo (Proxy @p) info.id [info.loc]
+    , msg = msg
+    }
diff --git a/src-internal/HsBindgen/Frontend/Pass/MangleNames/DetectClashes.hs b/src-internal/HsBindgen/Frontend/Pass/MangleNames/DetectClashes.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/MangleNames/DetectClashes.hs
@@ -0,0 +1,209 @@
+module HsBindgen.Frontend.Pass.MangleNames.DetectClashes (
+    detectClashes
+  ) where
+
+import Data.Either (partitionEithers)
+import Data.Foldable qualified as Foldable
+import Data.Map qualified as Map
+import Data.Maybe (maybeToList)
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Config.Prelims (FieldNamingStrategy (..))
+import HsBindgen.Frontend.Pass.MangleNames.CreateNames
+import HsBindgen.Frontend.Pass.MangleNames.Error
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.MangleNames.Names
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports ()
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Traversal 2: Detect clashes
+
+  Build a single 'NameRegistry' from the 'NameMap' (top-level names and scoped
+  names) and the 'CreateNames' AST (local names in annotations), then report all
+  collisions in one sweep. Over-removal is explicitly accepted: a single
+  declaration may participate in several collisions, and every participating
+  owner is dropped.
+
+  Ideally, we'd not purge all conflicts, but instead let selection resolve
+  conflict groups. While this is possible, it is also a difficult problem: If we
+  deselect a declaration in a confict group, all reverse transitive dependencies
+  of the deselected declaration also become unusable. This _may affect other
+  conflict groups_, and so is a recursive problem with a fix point.
+
+-------------------------------------------------------------------------------}
+
+detectClashes ::
+     forall l.
+     FieldNamingStrategy
+  -> NameMap
+  -> [C.Decl l CreateNames]
+  -> (NameRegistry, [MangleNamesFailure])
+detectClashes strategy nameMap decls =
+    (registry, collisionFailures (collisions registry) ++ deriveFailures)
+  where
+    registry :: NameRegistry
+    deriveFailures :: [MangleNamesFailure]
+    (registry, deriveFailures) = Foldable.foldl' aux (emptyNameRegistry, []) decls
+      where
+        aux (nameRegistry, failures) decl = fmap (++failures) (registerDecl nameRegistry decl)
+
+    registerDecl :: NameRegistry -> C.Decl l CreateNames -> (NameRegistry, [MangleNamesFailure])
+    registerDecl reg decl = (,failures) $
+        Foldable.foldl'
+          (\r (role, scope, loc', sname) -> registerSomeName role scope owner loc' sname r)
+          reg0
+          successes
+      where
+        owner :: C.DeclId
+        owner = decl.info.id
+
+        loc :: SingleLoc C.DeclPath
+        loc = decl.info.loc
+
+        -- The declaration's own top-level name. Squashed declarations do not
+        -- appear in 'decls', so they are never registered here.
+        reg0 :: NameRegistry
+        reg0 = case lookupSomeName owner nameMap of
+          Just sname -> registerSomeName Declaration GlobalScope owner loc sname reg
+          Nothing    -> reg
+
+        (failures, successes) = partitionEithers $ derivedNames strategy nameMap owner loc decl.kind
+
+-- | Looking up created names for scoped names can fail
+type DerivedNamesResult = Either MangleNamesFailure (NameRole, Scope, SingleLoc C.DeclPath, Hs.SomeName)
+
+-- | All derived (non-top-level) names of a declaration, with the role, scope,
+-- and location under which they must be unique.
+--
+-- Most derived names are blamed on (and located at) the enclosing declaration.
+-- Record field selectors are the exception: they carry the field's /own/
+-- location, so that a within-record duplicate-field collision points at the
+-- offending fields.
+derivedNames :: forall l.
+     FieldNamingStrategy
+  -> NameMap
+  -> C.DeclId
+  -> SingleLoc C.DeclPath
+  -> C.DeclKind l CreateNames
+  -> [DerivedNamesResult]
+derivedNames strategy nameMap owner loc = \case
+    C.DeclStruct struct ->
+         success (Constructor, GlobalScope, loc, Hs.demoteNs struct.ann.constr)
+       : [ success (AuxType, GlobalScope, loc, Hs.demoteNs flamNames.aux)
+         | C.Flam _ flamNames <- [struct.flam] ]
+      ++ concatMap fieldNames struct.fields
+      ++ foldMap regularFieldNames (C.flamStructField struct.flam)
+    C.DeclUnion union ->
+         newtypeNames union.ann
+      ++ concatMap fieldNames union.fields
+    C.DeclEnum enum ->
+         newtypeNames enum.ann
+      ++ concatMap enumConstantName enum.constants
+    -- An untagged enum constant is a top-level declaration in its own right;
+    -- its name is registered as a 'Declaration'. We must /not/ also register
+    -- the inner enum-constant scoped name, or it would collide with itself.
+    C.DeclUntaggedEnumConstant{}      -> []
+    C.DeclTypedef typedef             -> typedefNames typedef.ann
+    C.DeclMacro (MacroType macroType) -> newtypeNames macroType.ann
+    C.DeclMacro MacroValue{}          -> []
+    C.DeclFunction{}                  -> []
+    C.DeclGlobal{}                    -> []
+    C.DeclOpaque{}                    -> []
+  where
+    success :: (NameRole, Scope, SingleLoc C.DeclPath, Hs.SomeName) -> DerivedNamesResult
+    success = Right
+
+    failure :: C.DeclId -> C.ScopedName -> DerivedNamesResult
+    failure declId scopedName =
+        Left $ MangleNamesFailure owner loc $
+          MangleNamesCollisionError $ DetectClashesScopedNameNotMangled declId scopedName
+
+    -- Field selectors created under 'OmitFieldPrefixes' enable
+    -- @DuplicateRecordFields@, so they need only be unique within a record.
+    fieldScope :: Scope
+    fieldScope = case strategy of
+      AddFieldPrefixes  -> GlobalScope
+      OmitFieldPrefixes -> DeclScope owner
+
+    fieldNames :: C.Field CreateNames -> [DerivedNamesResult]
+    fieldNames = C.elimField regularFieldNames implicitFieldNames
+
+    regularFieldNames :: C.RegularField CreateNames -> [DerivedNamesResult]
+    regularFieldNames field =
+        case lookupScopedName owner field.info.name nameMap of
+          Nothing     -> [ failure owner field.info.name ]
+          Just hsName -> [ success (Field, fieldScope, field.info.loc, hsName) ]
+
+    implicitFieldNames :: C.ImplicitField CreateNames -> [DerivedNamesResult]
+    implicitFieldNames field =
+        ( case lookupScopedName owner field.info.name nameMap of
+            Nothing     -> [ failure owner field.info.name ]
+            Just hsName -> [ success (Field, fieldScope, field.info.loc, hsName) ]
+        ) ++ concatMap indirectFieldNames field.indirect
+
+    indirectFieldNames :: C.IndirectField CreateNames -> [DerivedNamesResult]
+    indirectFieldNames field =
+        case lookupScopedName owner field.info.name nameMap of
+          Nothing     -> [ failure owner field.info.name ]
+          Just hsName -> [ success (Field, fieldScope, field.info.loc, hsName) ]
+
+    enumConstantName :: C.EnumConstant CreateNames -> [DerivedNamesResult]
+    enumConstantName constant =
+        case lookupScopedName owner constant.info.name nameMap of
+          Nothing     -> [ failure owner constant.info.name ]
+          Just hsName -> [ success (Constructor, GlobalScope, constant.info.loc, hsName) ]
+
+    -- The newtype "unwrap" field is recorded only under 'AddFieldPrefixes',
+    -- where it is the globally-unique @unwrap<TypeName>@. Under
+    -- 'OmitFieldPrefixes' it is simply @unwrap@, lives alone in its own record,
+    -- and so can never collide.
+    newtypeNames :: NewtypeNames -> [DerivedNamesResult]
+    newtypeNames n =
+        success (Constructor, GlobalScope, loc, Hs.demoteNs n.dataConstr)
+      : [ success (Field, GlobalScope, loc, Hs.demoteNs n.field)
+        | AddFieldPrefixes <- [strategy] ]
+
+    typedefNames :: TypedefNames -> [DerivedNamesResult]
+    typedefNames t =
+         newtypeNames t.orig
+      ++ concat [ success (AuxType, GlobalScope, loc, Hs.demoteNs auxName) : newtypeNames auxNames
+                | (auxName, auxNames) <- maybeToList t.aux ]
+
+-- | Turn registry collisions into per-declaration failures
+--
+-- Each 'Collision' produced by 'collisions' lives in a single 'Scope'. A
+-- collision within a 'DeclScope' is a set of record field selectors of one
+-- declaration that mangle to the same Haskell name (only possible under
+-- 'OmitFieldPrefixes'); we report it as a more specific
+-- 'DetectClashesDuplicateFieldName'. All other collisions are reported as
+-- 'DetectClashesCollision', one failure per participating declaration.
+collisionFailures :: [Collision] -> [MangleNamesFailure]
+collisionFailures = concatMap getCollisionFailures
+  where
+    getCollisionFailures :: Collision -> [MangleNamesFailure]
+    getCollisionFailures c = case c.origins of
+        o:_ | DeclScope{} <- o.scope ->
+          -- Within-record duplicate field selector. All origins share the same
+          -- owner (the enclosing record), so this yields a single failure.
+          [ MangleNamesFailure o.owner o.loc $ MangleNamesCollisionError $
+              DetectClashesDuplicateFieldName c.name (map (.loc) c.origins)
+          ]
+        _otherwise ->
+          [ MangleNamesFailure o.owner o.loc $ MangleNamesCollisionError $
+              DetectClashesCollision c.name idsWithLocs
+          | o <- origins
+          ]
+      where
+        -- One failure per distinct declaration.
+        origins :: [NameOrigin]
+        origins = Map.elems $ Map.fromList $ map (\o -> (o.owner, o)) c.origins
+
+        idsWithLocs :: [C.WithLocationInfo C.DeclId]
+        idsWithLocs =
+          [ C.WithLocationInfo (C.declIdLocationInfo o.owner [o.loc]) o.owner
+          | o <- origins
+          ]
diff --git a/src-internal/HsBindgen/Frontend/Pass/MangleNames/Error.hs b/src-internal/HsBindgen/Frontend/Pass/MangleNames/Error.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/MangleNames/Error.hs
@@ -0,0 +1,153 @@
+module HsBindgen.Frontend.Pass.MangleNames.Error (
+    -- * Unifying error
+    MangleNamesError (..)
+    -- * Per-traversal errors
+  , MangleNamesCreationError (..)
+  , MangleNamesCollisionError (..)
+  , MangleNamesResolutionError (..)
+  ) where
+
+import Data.List qualified as List
+import Data.List.NonEmpty qualified as NonEmpty
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.HighLevel.Types (SingleLoc)
+
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Unifying error
+
+  The three traversals each produce their own error type. Selection, however,
+  consumes a single mangle-names error: it is stored in the 'DeclIndex' as the
+  reason a declaration is unusable, and threaded through the 'Select' pass.
+  'MangleNamesError' unifies the three at that boundary.
+-------------------------------------------------------------------------------}
+
+data MangleNamesError =
+    MangleNamesCreationError   MangleNamesCreationError
+  | MangleNamesCollisionError  MangleNamesCollisionError
+  | MangleNamesResolutionError MangleNamesResolutionError
+  deriving stock (Show, Eq, Ord)
+
+instance PrettyForTrace MangleNamesError where
+  prettyForTrace = \case
+      MangleNamesCreationError   e -> prettyForTrace e
+      MangleNamesCollisionError  e -> prettyForTrace e
+      MangleNamesResolutionError e -> prettyForTrace e
+
+instance IsTrace Level MangleNamesError where
+  getDefaultLogLevel = \case
+    MangleNamesCreationError CreateNamesSquashMustBeTypeConstr{} -> Bug
+    MangleNamesCreationError{}                                   -> Warning
+    MangleNamesCollisionError e -> case e of
+      DetectClashesCollision{}            -> Warning
+      DetectClashesDuplicateFieldName{}   -> Warning
+      DetectClashesScopedNameNotMangled{} -> Warning
+    MangleNamesResolutionError e -> case e of
+      ResolveNamesUnderlyingDeclNotMangled{} -> Warning
+      ResolveNamesScopedNameNotMangled{}     -> Warning
+  getSource  = const HsBindgen
+  getTraceId = const "mangle-names"
+
+{-------------------------------------------------------------------------------
+  Traversal 1: create names
+-------------------------------------------------------------------------------}
+
+-- | Errors of the "create names" traversal
+data MangleNamesCreationError =
+    -- | A C name could not be mangled into a valid Haskell name.
+    CreateNamesCouldNotMangle Text
+    -- | Bug: squash analysis produced a 'Squash' result for a declaration
+    -- whose namespace is not 'Hs.NsTypeConstr'. Squashes must always be types.
+  | CreateNamesSquashMustBeTypeConstr Hs.Namespace
+  deriving stock (Show, Eq, Ord)
+
+instance PrettyForTrace MangleNamesCreationError where
+  prettyForTrace = \case
+      CreateNamesCouldNotMangle name -> PP.hsep [
+          "Could not mangle C name:"
+        , PP.text name
+        ]
+      CreateNamesSquashMustBeTypeConstr ns -> PP.hsep [
+          "Bug: squash for non-type-constructor namespace:"
+        , prettyForTrace ns
+        ]
+
+{-------------------------------------------------------------------------------
+  Traversal 2: detect clashes
+-------------------------------------------------------------------------------}
+
+-- | Errors of the "detect clashes" traversal
+data MangleNamesCollisionError =
+    -- | Two or more declarations mangle to the same Haskell name.
+    DetectClashesCollision Hs.SomeName [C.WithLocationInfo C.DeclId]
+    -- | Two or more fields in the same struct mangle to the same Haskell name.
+    --
+    -- Only fires under 'OmitFieldPrefixes'; under 'AddFieldPrefixes' mangling
+    -- is injective within a record.
+  | DetectClashesDuplicateFieldName Hs.SomeName [SingleLoc C.DeclPath]
+    -- | A name scoped within a declaration was not mangled
+  | DetectClashesScopedNameNotMangled C.DeclId C.ScopedName
+  deriving stock (Show, Eq, Ord)
+
+instance PrettyForTrace MangleNamesCollisionError where
+  prettyForTrace = \case
+      DetectClashesCollision x xs ->
+        let intro = PP.hcat [
+                "Colliding definitions for Haskell name "
+              , prettyForTrace x
+              , ":"
+              ]
+        in PP.vcat [
+               PP.hang intro 2 $ PP.vcat $ map prettyForTrace xs
+            , "If a field name is colliding, try using"
+            , "- the option `--omit-field-prefixes` with hs-bindgen-cli;"
+            , "- the `FieldNamingStrategy` `OmitFieldPrefixes` in TH mode."
+            ]
+      DetectClashesDuplicateFieldName x locs ->
+        let intro = PP.hcat [
+                "Duplicate record field name "
+              , prettyForTrace x
+              , ":"
+              ]
+        in  PP.hang intro 2 $ PP.vcat $ map PP.show locs
+      DetectClashesScopedNameNotMangled declId scopedName -> PP.hsep [
+          "Name scoped in"
+        , prettyForTrace declId
+        , "not mangled:"
+        , prettyForTrace scopedName
+        ]
+
+{-------------------------------------------------------------------------------
+  Traversal 3: resolve names
+-------------------------------------------------------------------------------}
+
+-- | Errors of the "resolve names" traversal
+data MangleNamesResolutionError =
+    -- | A declaration references another declaration that was not mangled
+    -- (because it failed to mangle, or was dropped due to a collision), leaving
+    -- a dangling reference.
+    ResolveNamesUnderlyingDeclNotMangled C.DeclId (NonEmpty Hs.Namespace)
+    -- | A name scoped within a declaration was not mangled
+  | ResolveNamesScopedNameNotMangled C.DeclId C.ScopedName
+  deriving stock (Show, Eq, Ord)
+
+instance PrettyForTrace MangleNamesResolutionError where
+  prettyForTrace = \case
+      ResolveNamesUnderlyingDeclNotMangled declId namespaces -> PP.hsep [
+          "Underlying"
+        , PP.hsep $ List.intersperse "or" $
+            map prettyForTrace $ NonEmpty.toList namespaces
+        , "not mangled:"
+        , prettyForTrace declId
+        ]
+      ResolveNamesScopedNameNotMangled declId scopedName -> PP.hsep [
+          "Name scoped in"
+        , prettyForTrace declId
+        , "not mangled:"
+        , prettyForTrace scopedName
+        ]
diff --git a/src-internal/HsBindgen/Frontend/Pass/MangleNames/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/MangleNames/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/MangleNames/IsPass.hs
@@ -0,0 +1,188 @@
+module HsBindgen.Frontend.Pass.MangleNames.IsPass (
+    MangleNames
+    -- * Additional names
+  , StructNames(..)
+  , FlamNames(..)
+  , NewtypeNames(..)
+  , TypedefNames(..)
+  , IndirectFieldNames(..)
+    -- * Trace messages
+  , MangleNamesMsg(..)
+  ) where
+
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Frontend.Pass.MangleNames.Names
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Mangle names pass
+type MangleNames :: Pass
+data MangleNames a
+
+type family AnnMangleNames ix where
+  AnnMangleNames "Decl"                 = PrescriptiveDeclSpec
+  AnnMangleNames "Enum"                 = NewtypeNames
+  AnnMangleNames "Flam"                 = FlamNames
+  AnnMangleNames "IndirectField"        = IndirectFieldNames MangleNames
+  AnnMangleNames "Struct"               = StructNames
+  AnnMangleNames "Typedef"              = TypedefNames
+  AnnMangleNames "TypecheckedMacroType" = NewtypeNames
+  AnnMangleNames "Union"                = NewtypeNames
+  AnnMangleNames _                      = NoAnn
+
+instance IsPass MangleNames
+
+instance PassId MangleNames where
+  type Id MangleNames = DeclIdPair
+
+  idNameKind     _ namePair = namePair.cName.name.kind
+  idSourceName   _ namePair = C.declIdSourceName namePair.cName
+  idLocationInfo _ namePair = C.declIdLocationInfo namePair.cName
+
+instance PassScopedName MangleNames where
+  type ScopedName MangleNames = ScopedNamePair
+
+instance PassTypes MangleNames
+
+instance PassMacro MangleNames where
+  type MacroId         MangleNames = Id MangleNames
+  type MacroBody       MangleNames = TypecheckedMacro MangleNames
+  type MacroUnderlying MangleNames = C.Type MangleNames
+
+  macroIdId _ = id
+
+instance PassExtBinding MangleNames where
+  type ExtBinding MangleNames = BindingSpec.ResolvedExtBinding
+
+  extBindingId _ extBinding = extDeclIdPair extBinding
+
+instance PassCommentDecl MangleNames where
+  type CommentDecl MangleNames = Maybe (C.Comment MangleNames)
+
+instance PassAnn MangleNames where
+  type Ann ix MangleNames = AnnMangleNames ix
+
+instance PassMsg MangleNames where
+  type Msg MangleNames = C.WithLocationInfo MangleNamesMsg
+
+{-------------------------------------------------------------------------------
+  Additional names required for Haskell code generation
+-------------------------------------------------------------------------------}
+
+-- | The auxiliary type-constructor name for a @struct@ with a flexible array
+-- member (FLAM) no longer lives here: it is bundled with the FLAM field in the
+-- 'C.Flam' constructor (as 'FlamNames'), so that the name is created exactly when
+-- the FLAM is present (see <https://github.com/well-typed/hs-bindgen/issues/1925>).
+data StructNames = StructNames {
+      constr :: Hs.Name Hs.NsConstr
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+-- | Names required to generate the auxiliary type of a struct with a flexible
+-- array member (FLAM)
+--
+-- Bundled with the FLAM field in the 'C.Flam' constructor, so that these names
+-- exist exactly when there is a FLAM to generate code for.
+data FlamNames = FlamNames {
+      -- | Name of the auxiliary type we generate for the @struct@
+      aux :: Hs.Name Hs.NsTypeConstr
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+data NewtypeNames = NewtypeNames {
+      dataConstr :: Hs.Name Hs.NsConstr
+    , field      :: Hs.Name Hs.NsVar
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+data TypedefNames = TypedefNames {
+      orig :: NewtypeNames
+      -- TODO https://github.com/well-typed/hs-bindgen/issues/1925
+      --
+      -- Tie generation of names to the generation of the associated code.
+      --
+      -- | Names of the auxiliary type definition that we generate for function
+      --   pointers.
+    , aux  :: Maybe (Hs.Name Hs.NsTypeConstr, NewtypeNames)
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+-- | Names for Haskell code generation for indirect fields
+--
+-- We generate @HasField@ instances for indirect fields. For the implementation
+-- of the instance we need to know the name of the indirect field with respect
+-- to the enclosing struct\/union, but also the name of that indirect field with
+-- respect to the anonymous struct\/union. The former is tracked as usual inside
+-- the 'IndirectField  datatype, the latter is tracked in the
+-- 'IndirectFieldNames' annotation.
+--
+data IndirectFieldNames p = IndirectFieldNames {
+      fieldNameInAnon :: ScopedName p
+    }
+
+deriving stock instance PassScopedName p => Show (IndirectFieldNames p)
+deriving stock instance PassScopedName p => Eq (IndirectFieldNames p)
+deriving stock instance PassScopedName p => Ord (IndirectFieldNames p)
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+data MangleNamesMsg =
+    MangleNamesAssignedName       Hs.SomeName
+  | MangleNamesReusedAssignedName Hs.SomeName
+  | MangleNamesNameMap            NameMap
+  | MangleNamesNameMapDuplicates  (NonEmpty DupAssign)
+  | MangleNamesNameRegistry       NameRegistry
+  deriving stock (Show)
+
+instance PrettyForTrace MangleNamesMsg where
+  prettyForTrace = \case
+      MangleNamesAssignedName newName -> PP.hsep [
+          "Assigned name"
+        , PP.text newName.text
+        ]
+      MangleNamesReusedAssignedName newName -> PP.hsep [
+          "Reused assigned name"
+        , PP.text newName.text
+        ]
+      MangleNamesNameMap nm -> PP.hsep [
+          "The name map is:"
+        , PP.show nm
+        ]
+      MangleNamesNameMapDuplicates dups -> PP.hsep [
+          "Assigned multiple Haskel names to one C name in the name map:"
+        , PP.show dups
+        ]
+      MangleNamesNameRegistry rg -> PP.hsep [
+          "The name registry is:"
+        , PP.show rg
+        ]
+
+instance IsTrace Level MangleNamesMsg where
+  getDefaultLogLevel = \case
+      MangleNamesAssignedName{}       -> Info
+      MangleNamesReusedAssignedName{} -> Info
+      MangleNamesNameMap{}            -> Debug
+      MangleNamesNameMapDuplicates{}  -> Bug
+      MangleNamesNameRegistry{}       -> Debug
+
+  getSource  = const HsBindgen
+  getTraceId = \case
+    MangleNamesAssignedName{}       -> "mangle-names-assigned-name"
+    MangleNamesReusedAssignedName{} -> "mangle-names-reused-assigned-name"
+    MangleNamesNameMap{}            -> "mangle-names-name-map"
+    MangleNamesNameMapDuplicates{}  -> "mangle-names-name-map-duplicates"
+    MangleNamesNameRegistry{}       -> "mangle-names-name-registry"
diff --git a/src-internal/HsBindgen/Frontend/Pass/MangleNames/Names.hs b/src-internal/HsBindgen/Frontend/Pass/MangleNames/Names.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/MangleNames/Names.hs
@@ -0,0 +1,334 @@
+-- | Name bookkeeping for the name mangler
+--
+-- The name mangler maintains /two/ indices over the set of Haskell names it
+-- creates. They answer opposite questions and are keyed differently, so they are
+-- distinct structures:
+--
+-- * 'NameMap' is the /resolution index/: @'C.DeclId' -> ('Hs.Name', Map
+--   'C.ScopedName' 'HsName')@. Pass 2 uses it to resolve a /reference/ (it
+--   holds a target 'DeclId' or 'ScopedName' and wants the Haskell name that was
+--   assigned to it).
+--
+-- * 'NameRegistry' is the /collision index/: @'Hs.Name' -> ['NameOrigin']@. It
+--   records created names that may collide (top-level and derived) -- together
+--   with the declaration responsible for it. Hence, we can detect when the same
+--   Haskell name is produced more than once in the same namespace, whether by
+--   two distinct declarations (e.g. two structs) or by a single declaration via
+--   two of its members (e.g. an enum tag and one of its enumerators).
+--
+-- The types ensure that names cannot collide spuriously across namespaces.
+--
+-- Intended for unqualified import.
+module HsBindgen.Frontend.Pass.MangleNames.Names (
+    -- * Resolution index
+    NameMap(..)
+  , DupAssign(..)
+  , emptyNameMap
+  , fromNames
+  , lookupType
+  , lookupData
+  , lookupVar
+  , lookupScopedName
+  , lookupSomeName
+    -- * Collision index
+  , NameRole(..)
+  , Scope(..)
+  , NameOrigin(..)
+  , NameRegistry
+  , emptyNameRegistry
+  , registerName
+  , registerSomeName
+  , Collision(..)
+  , collisions
+  ) where
+
+import Control.Applicative (asum)
+import Control.Monad.State
+import Data.Foldable qualified as Foldable
+import Data.List.NonEmpty qualified as NE
+import Data.Map qualified as Map
+
+import Clang.HighLevel.Types (SingleLoc)
+
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Resolution index
+-------------------------------------------------------------------------------}
+
+-- | Maps each declaration to the Haskell name assigned to it. Each scoped name
+-- for a declaration is also mapped to the Haskell name assigned to it.
+data NameMap = NameMap {
+      typeConstrs :: Map C.DeclId (Hs.Name Hs.NsTypeConstr)
+    , dataConstrs :: Map C.DeclId (Hs.Name Hs.NsConstr)
+    , vars        :: Map C.DeclId (Hs.Name Hs.NsVar)
+    , scopedNames :: Map C.DeclId ScopedNameMap
+    }
+  deriving stock (Show, Generic)
+
+-- | Maps each scoped name to the Haskell name assigned to it.
+type ScopedNameMap = Map C.ScopedName Hs.SomeName
+
+emptyNameMap :: NameMap
+emptyNameMap = NameMap Map.empty Map.empty Map.empty Map.empty
+
+-- | If we assign multiple Haskell names to the same C name, then there is a
+-- bug in our code.
+--
+-- * Each 'C.DeclId' should have a single created name assigned to it
+-- * Each 'C.ScopedName' should have a single created name assigned to it
+--   (within a given scope)
+data DupAssign =
+    DupTypeConstr C.DeclId (Hs.Name Hs.NsTypeConstr) (Hs.Name Hs.NsTypeConstr)
+  | DupDataConstr C.DeclId (Hs.Name Hs.NsConstr) (Hs.Name Hs.NsConstr)
+  | DupVar        C.DeclId (Hs.Name Hs.NsVar) (Hs.Name Hs.NsVar)
+  | DupScopedName C.DeclId C.ScopedName Hs.SomeName Hs.SomeName
+  deriving stock (Show)
+
+fromNames :: [(DeclIdPair, [ScopedNamePair])] -> (NameMap, Maybe (NonEmpty DupAssign))
+fromNames names =
+    let action = Foldable.foldlM (uncurry . addNames) emptyNameMap names
+    in  NE.nonEmpty <$> runState action []
+  where
+    addNames :: NameMap -> DeclIdPair -> [ScopedNamePair] -> State [DupAssign] NameMap
+    addNames nameMap pair scopedPairs = do
+      nameMap' <- addDeclIdPair nameMap pair
+      Foldable.foldlM (addScopedNamePair pair) nameMap' scopedPairs
+
+    addDeclIdPair :: NameMap -> DeclIdPair -> State [DupAssign] NameMap
+    addDeclIdPair nameMap pair = case pair.hsName.ns of
+        Hs.NsTypeConstr -> do
+          let hsName' = Hs.assertNs (Proxy @Hs.NsTypeConstr)     pair.hsName
+              upd = insertChecked (DupTypeConstr pair.cName) hsName'
+          typeConstrs' <- Map.alterF upd pair.cName nameMap.typeConstrs
+          pure $ nameMap & #typeConstrs .~ typeConstrs'
+        Hs.NsConstr -> do
+          let hsName' = Hs.assertNs (Proxy @Hs.NsConstr)     pair.hsName
+              upd = insertChecked (DupDataConstr pair.cName) hsName'
+          dataConstrs' <- Map.alterF upd pair.cName nameMap.dataConstrs
+          pure $ nameMap & #dataConstrs .~ dataConstrs'
+        Hs.NsVar -> do
+          let hsName' = Hs.assertNs (Proxy @Hs.NsVar)     pair.hsName
+              upd = insertChecked (DupVar pair.cName) hsName'
+          vars' <- Map.alterF upd pair.cName nameMap.vars
+          pure $ nameMap & #vars .~ vars'
+
+    addScopedNamePair :: DeclIdPair -> NameMap -> ScopedNamePair -> State [DupAssign] NameMap
+    addScopedNamePair pair nameMap scopedPair = do
+        scopedNames' <- Map.alterF upd1 pair.cName nameMap.scopedNames
+        pure nameMap { scopedNames = scopedNames' }
+      where
+        upd1 :: Maybe ScopedNameMap -> State [DupAssign] (Maybe ScopedNameMap)
+        upd1 scopedNameMapMay = do
+          let scopedNameMap = fromMaybe Map.empty scopedNameMapMay
+          scopedNameMap' <- Map.alterF upd2 scopedPair.cName scopedNameMap
+          pure $ Just scopedNameMap'
+
+        upd2 :: Maybe Hs.SomeName -> State [DupAssign] (Maybe Hs.SomeName)
+        upd2 = insertChecked (DupScopedName pair.cName scopedPair.cName) scopedPair.hsName
+
+    -- | Insert a created name unless there is already a created name present
+    insertChecked ::
+         -- | In case of a duplicate insert, how to construct a 'Dup' error from
+         -- the new and existing name respectively
+         (name -> name -> DupAssign)
+         -- | New name
+      -> name
+         -- | Existing name (possibly)
+      -> Maybe name
+      -> State [DupAssign] (Maybe name)
+    insertChecked mkDup name' nameMay = do
+        case nameMay of
+          Nothing -> pure ()
+          Just name ->  modify (mkDup name' name : )
+        pure $ Just name'
+
+lookupType :: C.DeclId -> NameMap -> Maybe (Hs.Name Hs.NsTypeConstr)
+lookupType declId nameMap = Map.lookup declId nameMap.typeConstrs
+
+lookupData :: C.DeclId -> NameMap -> Maybe (Hs.Name Hs.NsConstr)
+lookupData declId nameMap = Map.lookup declId nameMap.dataConstrs
+
+lookupVar :: C.DeclId -> NameMap -> Maybe (Hs.Name Hs.NsVar)
+lookupVar declId nameMap = Map.lookup declId nameMap.vars
+
+lookupScopedName :: C.DeclId -> C.ScopedName -> NameMap -> Maybe Hs.SomeName
+lookupScopedName declId scopedName nameMap = do
+    scopedNameMap <- Map.lookup declId nameMap.scopedNames
+    Map.lookup scopedName scopedNameMap
+
+-- | Look up the (namespace-tagged) Haskell name assigned to a declaration,
+-- trying every namespace.
+--
+-- A 'DeclId' is assigned a name in exactly one namespace, so at most one of the
+-- sub-maps contains it.
+lookupSomeName :: C.DeclId -> NameMap -> Maybe Hs.SomeName
+lookupSomeName declId nameMap = asum [
+      Hs.demoteNs <$> lookupType declId nameMap
+    , Hs.demoteNs <$> lookupData declId nameMap
+    , Hs.demoteNs <$> lookupVar  declId nameMap
+    ]
+
+{-------------------------------------------------------------------------------
+  Collision index
+-------------------------------------------------------------------------------}
+
+-- | What a registered Haskell name denotes
+--
+-- Stored with every 'NameOrigin' to document what was created and to give
+-- collision diagnostics something to say.
+data NameRole =
+    -- | A top-level declaration's own name (chosen in pass 1)
+    Declaration
+    -- | A generated data constructor (including enum constants)
+  | Constructor
+    -- | A generated record field selector or newtype unwrapper
+  | Field
+    -- | A generated auxiliary type constructor (FLAM or function pointer)
+  | AuxType
+  deriving stock (Show, Eq, Ord, Generic)
+
+-- | The scope in which a created Haskell name must be unique
+--
+-- Most Haskell names we generate are top-level and must be globally unique
+-- ('GlobalScope'). Record field selectors created under
+-- 'HsBindgen.Config.Prelims.OmitFieldPrefixes' are an exception: the generated
+-- code enables @DuplicateRecordFields@, so the same selector name may appear in
+-- different records, but it must still be unique /within/ a single record. Such
+-- names are scoped to the enclosing declaration ('DeclScope').
+data Scope =
+    GlobalScope
+  | DeclScope C.DeclId
+  deriving stock (Show, Eq, Ord, Generic)
+
+-- | A single site at which a Haskell name was created
+data NameOrigin = NameOrigin {
+      -- | The declaration to blame should this name collide
+      owner :: C.DeclId
+    , loc   :: SingleLoc C.DeclPath
+    , role  :: NameRole
+      -- | The scope in which this name must be unique
+    , scope :: Scope
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+-- | Records every created Haskell name and the sites that created it
+--
+-- One map per Haskell namespace, keyed by the fully-typed name.
+data NameRegistry = NameRegistry {
+      typeConstrs :: Map (Hs.Name Hs.NsTypeConstr) [NameOrigin]
+    , dataConstrs :: Map (Hs.Name Hs.NsConstr)     [NameOrigin]
+    , vars        :: Map (Hs.Name Hs.NsVar)        [NameOrigin]
+    }
+  deriving stock (Show, Eq, Generic)
+
+emptyNameRegistry :: NameRegistry
+emptyNameRegistry = NameRegistry Map.empty Map.empty Map.empty
+
+-- | Register a created name, retaining its type-level namespace
+registerName :: forall ns.
+     Hs.SingNamespace ns
+  => NameRole
+  -> Scope
+  -> C.DeclId
+  -> SingleLoc C.DeclPath
+  -> Hs.Name ns
+  -> NameRegistry
+  -> NameRegistry
+registerName role scope owner loc name reg = case Hs.singNamespace @ns of
+    Hs.SNsTypeConstr -> reg & #typeConstrs %~ Map.alter prepend name
+    Hs.SNsConstr     -> reg & #dataConstrs %~ Map.alter prepend name
+    Hs.SNsVar        -> reg & #vars        %~ Map.alter prepend name
+  where
+    origin :: NameOrigin
+    origin = NameOrigin{
+        owner = owner
+      , loc   = loc
+      , role  = role
+      , scope = scope
+      }
+
+    prepend :: Maybe [NameOrigin] -> Maybe [NameOrigin]
+    prepend = \case
+      Nothing -> Just [origin]
+      Just xs -> Just $ origin:xs
+
+-- | Register a name whose namespace is only known at the value level
+--
+-- Used to seed the registry with pass 1 names (which are stored as
+-- 'Hs.SomeName'). The namespace is re-asserted at the type level.
+registerSomeName ::
+     NameRole
+  -> Scope
+  -> C.DeclId
+  -> SingleLoc C.DeclPath
+  -> Hs.SomeName
+  -> NameRegistry
+  -> NameRegistry
+registerSomeName role scope owner loc sname = case sname.ns of
+    Hs.NsTypeConstr ->
+      registerName role scope owner loc (Hs.assertNs (Proxy @Hs.NsTypeConstr) sname)
+    Hs.NsConstr ->
+      registerName role scope owner loc (Hs.assertNs (Proxy @Hs.NsConstr) sname)
+    Hs.NsVar ->
+      registerName role scope owner loc (Hs.assertNs (Proxy @Hs.NsVar) sname)
+
+-- | A Haskell name created by two or more distinct declarations
+data Collision = Collision {
+      name    :: Hs.SomeName
+    , origins :: [NameOrigin]
+    }
+  deriving stock (Show, Eq, Generic)
+
+-- | All collisions in the registry, across all three namespaces
+--
+-- A name collides when it was created at least twice in the same namespace
+-- /and/ the same 'Scope'. Names created in different scopes (e.g. two record
+-- field selectors in different records under @DuplicateRecordFields@) do not
+-- collide.
+--
+-- Field selectors created in a 'DeclScope' (under 'OmitFieldPrefixes') need only
+-- be unique within their record: @DuplicateRecordFields@ permits the same field
+-- name in different records, and @NoFieldSelectors@ (also enabled under
+-- 'OmitFieldPrefixes') means no top-level selector is generated, so such a name
+-- cannot clash with a non-field declaration either.
+collisions :: NameRegistry -> [Collision]
+collisions reg = concat [
+      collisionsFor reg.typeConstrs
+    , collisionsFor reg.dataConstrs
+    , collisionsFor reg.vars
+    ]
+  where
+    collisionsFor :: forall ns.
+         Hs.SingNamespace ns
+      => Map (Hs.Name ns) [NameOrigin]
+      -> [Collision]
+    collisionsFor m =
+        [ Collision (Hs.demoteNs name) scopedOrigins
+        | (name, origins) <- Map.toList m
+        , scopedOrigins   <- groupByScope origins
+        , isCollision scopedOrigins
+        ]
+
+    -- Partition origins of a single name by the scope they were created in.
+    groupByScope :: [NameOrigin] -> [[NameOrigin]]
+    groupByScope =
+        Map.elems . Map.fromListWith (++) . map (\o -> (o.scope, [o]))
+
+    -- A name is registered once per emitted top-level Haskell entity that wants
+    -- it: top-level declaration names are seeded once each (redeclarations are
+    -- deduplicated by 'DeclId' before this pass), and derived names are created
+    -- once each. So two or more registrations of the same name in the same
+    -- namespace and scope always mean two or more distinct entities competing
+    -- for it -- be they different declarations or members of the same
+    -- declaration.
+    --
+    -- We must not deduplicate by 'NameOrigin' here: derived names are recorded
+    -- with their /owner's/ location, so e.g. an enum's data constructor and one
+    -- of its enumerators share the same owner, location, and 'NameRole', and
+    -- would collapse into one.
+    isCollision :: [NameOrigin] -> Bool
+    isCollision origins = length origins >= 2
diff --git a/src-internal/HsBindgen/Frontend/Pass/MangleNames/ResolveNames.hs b/src-internal/HsBindgen/Frontend/Pass/MangleNames/ResolveNames.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/MangleNames/ResolveNames.hs
@@ -0,0 +1,515 @@
+module HsBindgen.Frontend.Pass.MangleNames.ResolveNames (
+    resolveNames
+  ) where
+
+import Control.Applicative (asum)
+import Control.Monad.Except (ExceptT, MonadError (..), runExceptT)
+import Control.Monad.Reader (Reader, ask, local, runReader)
+import Data.Either (partitionEithers)
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Map qualified as Map
+import Data.Proxy
+import Data.Set qualified as Set
+
+import HsBindgen.BindingSpec
+import HsBindgen.Frontend.Pass.MangleNames.CreateNames
+import HsBindgen.Frontend.Pass.MangleNames.Error
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.MangleNames.Names
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Type qualified as Macro
+
+import Doxygen.Parser.Types qualified as Doxy
+
+{-------------------------------------------------------------------------------
+  Traversal 3: Resolve names
+
+  Rewrite every 'C.DeclId' reference into a 'DeclIdPair' and every
+  'C.ScopedName' reference into a 'ScopedNamePair' using the 'NameMap', copying
+  annotations across unchanged. Declarations flagged by 'detectClashes' are
+  dropped (their failure is already recorded); a reference to an unmangleable
+  declaration drops the referring declaration with a
+  'ResolveNamesUnderlyingDeclNotMangled' failure. A reference to an unmangleable
+  scoped name drops the referring declaration with a
+  'ResolveNamesScopedNameNotMangled' failure.
+-------------------------------------------------------------------------------}
+
+type ResolveM   = Reader NameMap
+type ResolveE a = ExceptT MangleNamesResolutionError ResolveM a
+
+resolveNames ::
+     forall l. Macro.HasTypes l
+  => NameMap
+  -> Set C.DeclId
+  -> [C.Decl l CreateNames]
+  -> ([C.Decl l MangleNames], [MangleNamesFailure])
+resolveNames nameMap dropped decls = (oks, failures)
+  where
+    failures :: [MangleNamesFailure]
+    oks      :: [C.Decl l MangleNames]
+    (failures, oks) = partitionEithers $ mapMaybe resolveOne decls
+
+    resolveOne ::
+         C.Decl l CreateNames
+      -> Maybe (Either MangleNamesFailure (C.Decl l MangleNames))
+    resolveOne decl
+      | Set.member decl.info.id dropped = Nothing
+      | otherwise = Just $
+          case runReader (runExceptT (resolveDecl decl)) nameMap of
+            Left err    -> Left  $ toFailure decl.info (MangleNamesResolutionError err)
+            Right decl' -> Right decl'
+
+resolveDecl ::
+     Macro.HasTypes l
+  => C.Decl l CreateNames
+  -> ResolveE (C.Decl l MangleNames)
+resolveDecl decl =
+    withDeclNamespace decl.kind $ \nsProxy -> do
+      info' <- resolveDeclInfo nsProxy decl.info
+      kind' <- resolveDeclKind decl.info decl.kind
+      pure C.Decl{
+          info = info'
+        , kind = kind'
+        , ann  = decl.ann
+        }
+
+resolveDeclInfo ::
+     forall ns. Hs.SingNamespace ns
+  => Proxy ns
+  -> C.DeclInfo CreateNames
+  -> ResolveE (C.DeclInfo MangleNames)
+resolveDeclInfo nsProxy info = do
+    hsName     <- resolveDeclName nsProxy info.id
+    comment'   <- traverse (resolve info) info.comment
+    enclosing' <- mapM resolveEnclosingRef info.enclosing
+    pure C.DeclInfo{
+        loc              = info.loc
+      , id               = DeclIdPair{
+            cName  = info.id
+          , hsName = Hs.demoteNs hsName
+          }
+      , sourceOrderIndex = info.sourceOrderIndex
+      , origin           = info.origin
+      , availability     = info.availability
+      , comment          = comment'
+      , enclosing        = enclosing'
+      }
+
+resolveFieldInfo ::
+     C.DeclInfo CreateNames
+  -> C.FieldInfo CreateNames
+  -> ResolveE (C.FieldInfo MangleNames)
+resolveFieldInfo info fieldInfo = do
+    name'    <- lookupScopedNamePairR info.id fieldInfo.name
+    comment' <- traverse (resolve info) fieldInfo.comment
+    pure C.FieldInfo{
+        loc   = fieldInfo.loc
+      , name  = name'
+      , comment = comment'
+      }
+
+resolveDeclName ::
+     forall ns. Hs.SingNamespace ns
+  => Proxy ns -> C.DeclId -> ResolveE (Hs.Name ns)
+resolveDeclName _ declId = case Hs.singNamespace @ns of
+    Hs.SNsTypeConstr -> lookupTypeR declId
+    Hs.SNsConstr     -> lookupDataR declId
+    Hs.SNsVar        -> lookupVarR  declId
+
+resolveEnclosingRef ::
+     C.EnclosingRef CreateNames
+  -> ResolveE (C.EnclosingRef MangleNames)
+resolveEnclosingRef = \case
+    C.EnclosingRef e -> do
+      -- We must not propagate potential name mangler failures of the enclosing
+      -- declaration, which is a backwards reference. Instead, we mark the
+      -- reference "unusable".
+      r <- tryError $ lookupTypePairR e
+      pure $ either (const (C.UnusableEnclosingRef e)) C.EnclosingRef r
+    C.UnusableEnclosingRef e ->
+      pure $ C.UnusableEnclosingRef e
+
+resolveDeclKind ::
+     Macro.HasTypes l
+  => C.DeclInfo CreateNames
+  -> C.DeclKind l CreateNames
+  -> ResolveE (C.DeclKind l MangleNames)
+resolveDeclKind info = \case
+    C.DeclStruct               x -> C.DeclStruct               <$> resolve info x
+    C.DeclUnion                x -> C.DeclUnion                <$> resolve info x
+    C.DeclEnum                 x -> C.DeclEnum                 <$> resolve info x
+    C.DeclUntaggedEnumConstant x -> C.DeclUntaggedEnumConstant <$> resolve info x
+    C.DeclTypedef              x -> C.DeclTypedef              <$> resolve info x
+    C.DeclFunction             x -> C.DeclFunction             <$> resolve info x
+    C.DeclMacro                x -> C.DeclMacro                <$> resolveMacro x
+    C.DeclGlobal               x -> C.DeclGlobal               <$> resolve info x
+    C.DeclOpaque mSize           -> pure (C.DeclOpaque mSize)
+
+{-------------------------------------------------------------------------------
+  Traversal 3: name-map lookups
+-------------------------------------------------------------------------------}
+
+lookupTypeR :: C.DeclId -> ResolveE (Hs.Name Hs.NsTypeConstr)
+lookupTypeR declId = do
+    nameMap <- ask
+    case lookupType declId nameMap of
+      Nothing ->
+        throwError $
+          ResolveNamesUnderlyingDeclNotMangled declId (NonEmpty.singleton Hs.NsTypeConstr)
+      Just hsNm -> pure hsNm
+
+lookupDataR :: C.DeclId -> ResolveE (Hs.Name Hs.NsConstr)
+lookupDataR declId = do
+    nameMap <- ask
+    case lookupData declId nameMap of
+      Nothing ->
+        throwError $
+          ResolveNamesUnderlyingDeclNotMangled declId (NonEmpty.singleton Hs.NsConstr)
+      Just hsNm -> pure hsNm
+
+lookupVarR :: C.DeclId -> ResolveE (Hs.Name Hs.NsVar)
+lookupVarR declId = do
+    nameMap <- ask
+    case lookupVar declId nameMap of
+      Nothing ->
+        throwError $
+          ResolveNamesUnderlyingDeclNotMangled declId (NonEmpty.singleton Hs.NsVar)
+      Just hsNm -> pure hsNm
+
+lookupScopedNameR :: C.DeclId -> C.ScopedName -> ResolveE Hs.SomeName
+lookupScopedNameR declId scopedName = do
+    nameMap <- ask
+    case lookupScopedName declId scopedName nameMap of
+      Nothing ->
+        throwError $
+          ResolveNamesScopedNameNotMangled declId scopedName
+      Just hsNm -> pure hsNm
+
+lookupTypePairR :: C.DeclId -> ResolveE DeclIdPair
+lookupTypePairR declId =
+    (\hsName -> DeclIdPair declId (Hs.demoteNs hsName)) <$> lookupTypeR declId
+
+lookupVarPairR :: C.DeclId -> ResolveE DeclIdPair
+lookupVarPairR declId =
+    (\hsName -> DeclIdPair declId (Hs.demoteNs hsName)) <$> lookupVarR declId
+
+lookupScopedNamePairR :: C.DeclId -> C.ScopedName -> ResolveE ScopedNamePair
+lookupScopedNamePairR declId scopedName =
+    ScopedNamePair scopedName <$> lookupScopedNameR declId scopedName
+
+{-------------------------------------------------------------------------------
+  Traversal 3: Resolve instances
+-------------------------------------------------------------------------------}
+
+class Resolve a where
+  resolve :: C.DeclInfo CreateNames -> a CreateNames -> ResolveE (a MangleNames)
+
+instance Resolve C.Struct where
+  resolve info struct = do
+    fields <- mapM (resolve info) struct.fields
+    flam   <- C.traverseFlamField (resolve info) struct.flam
+    pure C.Struct{
+        fields    = fields
+      , flam      = flam
+      , ann       = struct.ann
+      , sizeof    = struct.sizeof
+      , alignment = struct.alignment
+      }
+
+instance Resolve C.Union where
+  resolve info union = do
+    fields <- mapM (resolve info) union.fields
+    pure C.Union{
+        fields    = fields
+      , ann       = union.ann
+      , sizeof    = union.sizeof
+      , alignment = union.alignment
+      }
+
+instance Resolve C.Field where
+  resolve info = \case
+      C.FieldRegular  field -> C.FieldRegular  <$> (resolve info) field
+      C.FieldImplicit field -> C.FieldImplicit <$> (resolve info) field
+
+instance Resolve C.RegularField where
+  resolve info field = do
+    fieldInfo' <- resolveFieldInfo info field.info
+    typ'       <- (resolve info) field.typ
+    pure C.RegularField{
+        info   = fieldInfo'
+      , typ    = typ'
+      , offset = field.offset
+      , width  = field.width
+      , ann    = field.ann
+      }
+
+instance Resolve C.ImplicitField where
+  resolve info field = do
+    fieldInfo' <- resolveFieldInfo info field.info
+    typRef'    <- resolve info field.typRef
+    indirect'  <- mapM (resolveIndirectField info field.typRef) field.indirect
+    pure C.ImplicitField{
+        info     = fieldInfo'
+      , typRef   = typRef'
+      , offset   = field.offset
+      , indirect = indirect'
+      , ann      = field.ann
+      }
+
+instance Resolve C.AnonRef where
+  resolve info = \case
+      C.AnonRef ref -> C.AnonRef <$> lookupTypePairR ref
+      C.AnonExtBinding ext -> C.AnonExtBinding <$> resolveExtBindingRef info ext
+
+resolveIndirectField ::
+     C.DeclInfo CreateNames
+  -> C.AnonRef CreateNames
+  -> C.IndirectField CreateNames
+  -> ResolveE (C.IndirectField MangleNames)
+resolveIndirectField info anonRef field = do
+    fieldInfo' <- resolveFieldInfo info field.info
+    typ' <- resolve info field.typ
+    path' <- mapM (resolve info) field.path
+    ann' <- IndirectFieldNames <$> lookupScopedNamePairR anonDeclId field.info.name
+    pure C.IndirectField{
+        info   = fieldInfo'
+      , typ    = typ'
+      , offset = field.offset
+      , width  = field.width
+      , path   = path'
+      , ann    = ann'
+      }
+  where
+    anonDeclId = case anonRef of
+        C.AnonRef declId -> declId
+        C.AnonExtBinding ext -> ext.name.cName
+
+instance Resolve C.Enum where
+  resolve info enum = do
+    typ'       <- (resolve info) enum.typ
+    constants' <- mapM (resolve info) enum.constants
+    pure C.Enum{
+        typ       = typ'
+      , constants = constants'
+      , ann       = enum.ann
+      , sizeof    = enum.sizeof
+      , alignment = enum.alignment
+      }
+
+instance Resolve C.EnumConstant where
+  resolve info constant = do
+    fieldInfo' <- resolveFieldInfo info constant.info
+    pure C.EnumConstant{
+        info  = fieldInfo'
+      , value = constant.value
+      }
+
+instance Resolve C.UntaggedEnumConstant where
+  resolve info (C.UntaggedEnumConstant primTyp constant) = do
+    constant' <- (resolve info) constant
+    pure C.UntaggedEnumConstant{
+        typ      = primTyp
+      , constant = constant'
+      }
+
+instance Resolve C.Typedef where
+  resolve info typedef = do
+    typ' <- (resolve info) typedef.typ
+    pure C.Typedef{
+        typ = typ'
+      , ann = typedef.ann
+      }
+
+instance Resolve C.Function where
+  resolve info function = do
+    args <- mapM resolveArg function.args
+    res' <- (resolve info) function.res
+    pure C.Function{
+        args  = args
+      , res   = res'
+      , attrs = function.attrs
+      , ann   = function.ann
+      }
+    where
+      resolveArg ::
+           C.FunctionArg CreateNames
+        -> ResolveE (C.FunctionArg MangleNames)
+      resolveArg arg = do
+        name' <- mapM (lookupScopedNamePairR info.id) arg.name
+        typ' <- resolve info arg.typ
+        pure C.FunctionArg{
+            name = name'
+          , typ  = typ'
+          , ann  = arg.ann
+          }
+
+instance Resolve C.Global where
+  resolve info global = do
+    typ' <- resolve info global.typ
+    pure C.Global{
+        typ = typ'
+      , ann = global.ann
+      }
+
+resolveMacro ::
+     Macro.HasTypes l
+  => TypecheckedMacro CreateNames l
+  -> ResolveE (TypecheckedMacro MangleNames l)
+resolveMacro = \case
+    MacroType  typ -> MacroType  <$> resolveMacroType typ
+    MacroValue val -> MacroValue <$> resolveMacroValue val
+
+resolveMacroType ::
+     Macro.HasTypes l
+  => TypecheckedMacroType l CreateNames
+  -> ResolveE (TypecheckedMacroType l MangleNames)
+resolveMacroType macroType = do
+    body' <- traverse resolveMacroTypeVar macroType.body
+    pure TypecheckedMacroType{
+        body = body'
+      , deps = macroType.deps
+      , ann  = macroType.ann
+      }
+  where
+    resolveMacroTypeVar ::
+         MacroTypeBodyVar CreateNames
+      -> ResolveE (MacroTypeBodyVar MangleNames)
+    resolveMacroTypeVar = \case
+      MacroTypeExtBinding ext -> pure $ MacroTypeExtBinding ext
+      MacroTypeBodyVar declId -> MacroTypeBodyVar <$> lookupTypePairR declId
+
+resolveMacroValue ::
+     Macro.HasTypes l
+  => TypecheckedMacroValue l CreateNames
+  -> ResolveE (TypecheckedMacroValue l MangleNames)
+resolveMacroValue macroValue = do
+    body' <- traverse lookupVarPairR macroValue.body
+    pure $ TypecheckedMacroValue body' macroValue.deps
+
+instance Resolve C.Comment where
+  resolve info (C.Comment comment) = C.Comment <$> mapM (resolve info) comment
+
+instance Resolve C.CommentRef where
+  resolve _info = \case
+    C.CommentRef name Nothing mKind -> do
+      nameMap <- ask
+      pure $ C.CommentRef name (searchNameMap nameMap name mKind) mKind
+    C.CommentRef name (Just declId) mKind ->
+      (\pair -> C.CommentRef name (Just pair) mKind) <$> lookupAnyPair declId
+
+instance Resolve C.Type where
+  resolve info = \case
+      -- Interesting cases
+      C.TypeRef declId  -> fmap C.TypeRef $
+        lookupTypePairR declId
+      C.TypeEnum ref -> fmap C.TypeEnum $
+        C.Ref <$> lookupTypePairR ref.name <*> resolve info ref.underlying
+      C.TypeMacro ref -> fmap C.TypeMacro $
+        C.MacroRef <$> lookupTypePairR ref.name <*> resolve info ref.underlying
+      C.TypeTypedef ref -> fmap C.TypeTypedef $
+        C.Ref <$> lookupTypePairR ref.name <*> resolve info ref.underlying
+
+      -- Recursive cases
+      C.TypePointers n typ             -> C.TypePointers n <$> resolve info typ
+      C.TypeFun args res               -> C.TypeFun <$> mapM (resolve info) args <*> resolve info res
+      C.TypeConstArray n typ           -> C.TypeConstArray n <$> resolve info typ
+      C.TypeIncompleteArray typ        -> C.TypeIncompleteArray <$> resolve info typ
+      C.TypeBlock typ                  -> C.TypeBlock <$> resolve info typ
+      C.TypeQual qual typ              -> C.TypeQual qual <$> resolve info typ
+      C.TypeExtBinding ref             -> C.TypeExtBinding <$> resolveExtBindingRef info ref
+
+      -- The other entries do not need any name mangling
+      C.TypePrim prim                  -> pure $ C.TypePrim prim
+      C.TypeVoid                       -> pure C.TypeVoid
+      C.TypeComplex prim               -> pure $ C.TypeComplex prim
+
+instance Resolve C.TypeFunArg where
+  resolve info arg = C.TypeFunArgF <$> resolve info arg.typ <*> pure arg.ann
+
+resolveExtBindingRef ::
+     C.DeclInfo CreateNames
+  -> C.ExtBindingRef CreateNames
+  -> ResolveE (C.ExtBindingRef MangleNames)
+resolveExtBindingRef info (C.Ref ext uTy) =
+    -- The underlying type may reference the external binding itself (e.g.
+    -- the typedef name that was replaced). We extend the 'NameMap' with the
+    -- external binding so that such references can be resolved.
+    C.Ref ext <$>
+      local
+        ( #typeConstrs %~ Map.insert ext.cName ext.hsName.name )
+        ( resolve info uTy )
+
+{-------------------------------------------------------------------------------
+  Resolving comment references
+-------------------------------------------------------------------------------}
+
+-- | Dispatch on the Doxygen @kindref@ attribute to choose which 'C.NameKind'
+-- values to try. Per-kind lookup is handled by 'lookupByKind', which narrows
+-- sub-map searches:
+--
+-- * Compound → only tagged kinds, only 'typeConstrs' (3 lookups)
+-- * Member  → ordinary + macro kinds, 'typeConstrs' + 'vars' (4 lookups)
+-- * Nothing → all kinds, per-kind dispatch (7 lookups, fallback)
+searchNameMap :: NameMap -> Text -> Maybe Doxy.RefKind -> Maybe DeclIdPair
+searchNameMap nameMap name = \case
+    Just Doxy.RefCompound ->
+      searchKinds
+        [ C.NameKindTagged C.TagKindStruct
+        , C.NameKindTagged C.TagKindUnion
+        , C.NameKindTagged C.TagKindEnum ]
+    Just Doxy.RefMember ->
+      searchKinds [C.NameKindOrdinary, C.NameKindMacro]
+    Nothing ->
+      searchKinds [minBound .. maxBound]
+  where
+    -- | For each 'C.NameKind', construct a 'C.DeclId' and try the appropriate
+    -- sub-maps via 'lookupByKind'. Return the first match.
+    searchKinds :: [C.NameKind] -> Maybe DeclIdPair
+    searchKinds kinds = asum
+        [ lookupByKind kind (C.DeclId (C.DeclName name kind) False) nameMap
+        | kind <- kinds
+        ]
+
+-- | Dispatch to the appropriate sub-map(s) based on 'C.NameKind'.
+--
+-- Tagged names can only be type constructors; ordinary and macro names can be
+-- type constructors or variables.
+lookupByKind :: C.NameKind -> C.DeclId -> NameMap -> Maybe DeclIdPair
+lookupByKind = \case
+    C.NameKindTagged{} -> lookupTypeNs
+    _                 -> lookupTypeOrVarNs
+  where
+    lookupTypeNs :: C.DeclId -> NameMap -> Maybe DeclIdPair
+    lookupTypeNs declId nameMap =
+        DeclIdPair declId . Hs.demoteNs <$> lookupType declId nameMap
+
+    lookupTypeOrVarNs :: C.DeclId -> NameMap -> Maybe DeclIdPair
+    lookupTypeOrVarNs declId nameMap =
+        DeclIdPair declId <$> asum
+          [ Hs.demoteNs <$> lookupType declId nameMap
+          , Hs.demoteNs <$> lookupVar  declId nameMap
+          ]
+
+lookupAnyPair :: C.DeclId -> ResolveE DeclIdPair
+lookupAnyPair declId = do
+    nameMap <- ask
+    case lookupByKind declId.name.kind declId nameMap of
+      Nothing ->
+        throwError $
+          ResolveNamesUnderlyingDeclNotMangled declId $ case declId.name.kind of
+            C.NameKindTagged{} -> NonEmpty.singleton Hs.NsTypeConstr
+            _                 -> NonEmpty.fromList [Hs.NsTypeConstr, Hs.NsVar]
+      Just pair ->
+        pure pair
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+-- The function 'tryError' is only available in `mtl` versions 2.3 and newer.
+tryError :: MonadError e m => m a -> m (Either e a)
+tryError action = (Right <$> action) `catchError` (pure . Left)
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse.hs b/src-internal/HsBindgen/Frontend/Pass/Parse.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse.hs
@@ -0,0 +1,146 @@
+{-# LANGUAGE OverloadedLabels #-}
+
+-- | Parse the clang AST
+module HsBindgen.Frontend.Pass.Parse (
+    parseDecls
+  ) where
+
+import Data.List.NonEmpty qualified as NE
+import Data.Map.Strict qualified as Map
+
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types
+import Clang.LowLevel.Core
+
+import HsBindgen.Frontend.Pass.Parse.Decl
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.Parse.Monad.Decl qualified as ParseDecl
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.UniqueExpansion (Analysis, analyseMacroDefinitions,
+                                        isFailure, parseDefinition)
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+parseDecls ::
+     forall l.
+     Macro.Lang l
+  -> ParseDecl.Env
+  -> IO ([ParseResult l Parse], Analysis)
+parseDecls macroLang parseEnv = do
+    root <- clang_getTranslationUnitCursor parseEnv.unit
+    ParseDecl.run parseEnv $ do
+      resultsWithLocs <- HighLevel.clang_visitChildren root (topLevelDecl macroLang)
+      let resultsOriginalOrder :: [ParseResult l Parse]
+          resultsOriginalOrder = concatMap snd resultsWithLocs
+      macroAnalysis <- analyseMacros
+      -- 'resultsOriginalOrder' is in sequence order (the order in which
+      -- libclang visits the declarations). We additionally record the source
+      -- order of each declaration in its 'sourceOrderIndex', obtained by
+      -- sorting the declarations by source position.
+      --
+      -- Comparing source positions across the translation unit requires
+      -- 'clang_isBeforeInTranslationUnit', available only with Clang >= 20.1.
+      -- On older versions we leave 'sourceOrderIndex' as 'Nothing' and return
+      -- the declarations in sequence order, unchanged.
+      (,macroAnalysis) <$> case clang_isBeforeInTranslationUnit of
+        Just isBeforeInUnit -> do
+          let isBefore (a, _) (b, _) = isBeforeInUnit a b
+          resultsSourceOrder :: [ParseResult l Parse] <-
+            liftIO $ concatMap snd <$> sortByM isBefore resultsWithLocs
+          let -- The map is keyed on @('Id' 'Parse', 'SingleLoc')@ rather than
+              -- just @'Id' 'Parse'@ to handle forward declarations at different
+              -- locations with the same name.
+              sourceOrderMap :: Map (Id Parse, SingleLoc C.DeclPath) Natural
+              sourceOrderMap = Map.fromList
+                [ ((r.id, r.loc), i)
+                | (i, r) <- zip [0..] resultsSourceOrder
+                ]
+          ParseDecl.traceImmediateGlobal ParseSourceOrderPopulated
+          -- We only add source-order indices to successful parses here. We
+          -- /could/ also populate them for non-successful parses.
+          pure $ map (setSourceOrderIndex sourceOrderMap) resultsOriginalOrder
+        Nothing -> do
+          ParseDecl.traceImmediateGlobal ParseSourceOrderUnavailable
+          pure resultsOriginalOrder
+
+-- | Analyse all macro definitions for ambiguity
+analyseMacros :: ParseDecl.ParseDecl Analysis
+analyseMacros = do
+    definitions <- map parseDefinition <$> ParseDecl.getMacroDefinitions
+    forM_ (NE.nonEmpty $ mapMaybe isFailure definitions) $
+      ParseDecl.traceImmediateGlobal . ParseMacroDefinitionAnalysisFailed
+    pure $ analyseMacroDefinitions definitions
+
+{-------------------------------------------------------------------------------
+  Orderings
+
+  We distinguish a few orderings of declarations (see issue #1580). These
+  definitions live here for now; they should eventually move to wherever the
+  orderings are defined and used centrally.
+
+  * Sequence order: the order in which libclang presents the declarations to
+    our parser (the order in which the cursor visits them). libclang visits
+    macros first and the remaining declarations in source order, so sequence
+    order is /not/ source order. This is the order of 'resultsOriginalOrder',
+    and the order in which 'parseDecls' returns its results.
+
+  * Source order: roughly, how the declarations appear in the C source. We
+    record it per declaration in 'DeclInfo.sourceOrderIndex', computed above by
+    sorting on source position via 'clang_isBeforeInTranslationUnit' (accurate,
+    but requires Clang >= 20.1). Note that @annSortKey@ (in
+    "HsBindgen.Frontend.Analysis.DeclUseGraph.Construction") computes a
+    /best-effort/ source order without that API, used only as a tiebreak when
+    ordering the output; it can be inaccurate, e.g. when a header includes
+    another header part-way through its own declarations.
+
+  * Dependency order: the order according to the use-decl graph; if @A@ has a
+    by-value use of @B@ then @B@ comes before @A@. This is the order the rest of
+    the frontend works in (established by @toDecls@ in
+    "HsBindgen.Frontend.Analysis.DeclUseGraph.Query").
+-------------------------------------------------------------------------------}
+
+-- | Stable merge sort using a monadic strict-less-than predicate.
+--
+-- @isBefore x y@ should return 'True' iff @x@ strictly precedes @y@. When
+-- neither element strictly precedes the other, ties are broken in favour of
+-- the left input (stable).
+sortByM :: Monad m => (a -> a -> m Bool) -> [a] -> m [a]
+sortByM isBefore = go
+  where
+    go []  = pure []
+    go [x] = pure [x]
+    go xs  = do
+      let (l, r) = splitAt (length xs `div` 2) xs
+      l' <- go l
+      r' <- go r
+      merge l' r'
+
+    merge []     ys     = pure ys
+    merge xs     []     = pure xs
+    merge (x:xs) (y:ys) = do
+      yBeforeX <- isBefore y x
+      if yBeforeX
+        then (y :) <$> merge (x:xs) ys
+        else (x :) <$> merge xs     (y:ys)
+
+{-------------------------------------------------------------------------------
+  Internal helpers
+-------------------------------------------------------------------------------}
+
+-- | Populate the source-order index in the 'DeclInfo' of a successful
+--   'ParseResult'
+setSourceOrderIndex ::
+     Map (Id Parse, SingleLoc C.DeclPath) Natural
+  -> ParseResult l Parse
+  -> ParseResult l Parse
+setSourceOrderIndex sourceOrderMap result =
+    result
+      &  #classification % #_ParseResultSuccess % #decl % #info % #sourceOrderIndex
+      .~ Map.lookup (result.id, result.loc) sourceOrderMap
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Builtin.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Builtin.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Builtin.hs
@@ -0,0 +1,90 @@
+module HsBindgen.Frontend.Pass.Parse.Builtin (
+    CursorSource(..)
+  , getCursorSource
+  , checkIsBuiltin
+  ) where
+
+import Foreign.C (CUInt)
+
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types
+import Clang.LowLevel.Core
+
+import HsBindgen.Frontend.RootHeader qualified as RootHeader
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+-- | Where a cursor is defined
+data CursorSource =
+    -- | Built into Clang, such as @__INT_MAX__@
+    SourceBuiltin
+    -- | A declaration; for a @-D@ option, at its presumed line and column
+  | SourceDecl (SingleLoc C.DeclPath)
+
+getCursorSource :: MonadIO m => CXCursor -> m CursorSource
+getCursorSource curr = getExpansion curr >>= \case
+    ExpansionBuiltin         -> pure SourceBuiltin
+    ExpansionCommandLine loc -> pure $ SourceDecl loc
+    ExpansionFile loc        -> SourceDecl <$> traverse declPath loc
+  where
+    declPath :: MonadIO m => CXFile -> m C.DeclPath
+    declPath file = do
+      name <- SourcePath <$> clang_getFileName file
+      if RootHeader.isRootHeaderPath name
+        then pure C.InRootHeader
+        else C.InHeader <$> HighLevel.clang_getRealPath file
+
+-- | Check for built-in definitions
+--
+-- Agrees with 'getCursorSource' returning 'SourceBuiltin', and exists only for
+-- speed: unlike 'getCursorSource', it does not resolve the location of an
+-- ordinary declaration, which the type parser, visiting every type reference,
+-- would discard.
+checkIsBuiltin :: MonadIO m => CXCursor -> m (Maybe Text)
+checkIsBuiltin curr = getExpansion curr >>= \case
+    ExpansionBuiltin -> Just <$> clang_getCursorSpelling curr
+    _otherwise       -> return Nothing
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+-- | Presumed file name of a @-D@ option, chosen by Clang
+commandLineName :: SourcePath
+commandLineName = SourcePath "<command line>"
+
+-- | Expansion location of a cursor
+--
+--Internal! (May contain a pointer 'CXFile' that is freed when the translation
+--unit goes).
+data Expansion =
+    -- | In Clang's predefines buffer, as a built-in
+    ExpansionBuiltin
+    -- | In Clang's predefines buffer, from a @-D@ option
+  | ExpansionCommandLine (SingleLoc C.DeclPath)
+    -- | In a file; careful; contains a pointer ('CXFile') that becomes invalid
+    -- when the translation unit goes
+  | ExpansionFile (SingleLoc CXFile)
+
+getExpansion :: MonadIO m => CXCursor -> m Expansion
+getExpansion curr = do
+    start <- clang_getCursorLocation curr
+    (file, line, col, offset) <- clang_getExpansionLocation start
+    if not (isNullPtr file)
+      then return $ ExpansionFile $ mkLoc file line col offset
+      else do
+        -- Built-ins and @-D@ options both live in the predefines buffer, which
+        -- has no file; only the presumed file name tells them apart.
+        (path, pLine, pCol) <- clang_getPresumedLocation start
+        return $
+          if SourcePath path == commandLineName
+            then ExpansionCommandLine $ mkLoc C.OnCommandLine pLine pCol offset
+            else ExpansionBuiltin
+  where
+    mkLoc :: path -> CUInt -> CUInt -> CUInt -> SingleLoc path
+    mkLoc path line col offset = SingleLoc{
+          singleLocPath   = path
+        , singleLocLine   = fromIntegral line
+        , singleLocColumn = fromIntegral col
+        , singleLocOffset = fromIntegral offset
+        }
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Context.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Context.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Context.hs
@@ -0,0 +1,91 @@
+module HsBindgen.Frontend.Pass.Parse.Context (
+    -- * Declaration and parse contexts
+    RequiredForScoping(..)
+  , DeclCtx(..)
+  , ParseCtx -- opaque
+  , mkCtx
+  , pushCtx
+
+    -- * Errors
+  , ExceptionInCtx(..)
+  , addCtxHandler
+  ) where
+
+import Control.Exception (Exception (..), SomeException)
+import Data.List.NonEmpty ((<|))
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Typeable (Typeable)
+import GHC.Records (HasField (..))
+
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+-- | We always need to parse declarations required for scoping as they may
+--   affect other declarations
+data RequiredForScoping =
+    RequiredForScoping
+  | NotRequiredForScoping
+  deriving stock (Show, Eq, Ord)
+
+data DeclCtx = DeclCtx {
+     kind    :: C.NameKind
+   , scoping :: RequiredForScoping
+   }
+  deriving stock (Show, Eq, Ord)
+
+-- | The parse context stores information about the inner-most declaration
+--   (i.e., the one we are parsing right now), and the outer-most declaration
+--   (i.e., the top-level declaration).
+data ParseCtx = ParseCtx { _ctxs  :: NonEmpty DeclCtx }
+  deriving stock (Show, Eq, Ord)
+
+mkCtx :: DeclCtx -> ParseCtx
+mkCtx ctx = ParseCtx{
+      _ctxs  = NonEmpty.singleton ctx
+    }
+
+pushCtx :: DeclCtx -> ParseCtx -> ParseCtx
+pushCtx ctx e = ParseCtx{
+      _ctxs = ctx <| e._ctxs
+    }
+
+instance HasField "inner" ParseCtx DeclCtx where
+  getField = NonEmpty.head . (._ctxs)
+
+instance HasField "outer" ParseCtx DeclCtx where
+  getField  = NonEmpty.last . (._ctxs)
+
+{-------------------------------------------------------------------------------
+  Errors
+
+  Dealing with errors while parsing is tricky:
+
+  * The Clang API does not make it very easy to associate an error with a source
+    location, so it's hard to produce a useful error message.
+
+  * Parsing always happens whilst processing some enclosing declaration. When we
+    encounter something unsupported (or unexpected), we'll want to register a
+    parse failure and avoid generating bindings for that declaration, but we do
+    not have sufficient context to do so.
+
+  For both of these reasons we simply throw an exception, and then /catch/
+  that exception in 'foldDec'. This allows us to address both of these issues:
+  a declaration has a clear source location, so we can generate a helpful error
+  message, and we can skip the declaration we're currently processing.
+-------------------------------------------------------------------------------}
+
+data ExceptionInCtx e = ExceptionInCtx {
+      exception :: e
+    , ctx       :: ParseCtx
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+instance (Show e, Typeable e) => Exception (ExceptionInCtx e)
+
+addCtxHandler ::
+     forall e a. (Exception e)
+  => Proxy e -> ParseCtx -> SomeException -> IO a
+addCtxHandler _p c e
+  | Just e' <- (fromException @e e) =
+      throwIO (ExceptionInCtx e' c)
+  | otherwise = throwIO e
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Decl.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl.hs
@@ -0,0 +1,1214 @@
+-- | Fold declarations
+module HsBindgen.Frontend.Pass.Parse.Decl (topLevelDecl) where
+
+import Control.Exception (Exception (..), SomeException)
+import Control.Monad ((>=>))
+import Data.Either (partitionEithers)
+import Data.List qualified as List
+import Data.Text qualified as Text
+import Foreign.C (CInt)
+
+import Clang.Enum.Simple
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types
+import Clang.LowLevel.Core
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis.IncludeGraph qualified as IncludeGraph
+import HsBindgen.Frontend.Pass.Parse.Builtin
+import HsBindgen.Frontend.Pass.Parse.Context
+import HsBindgen.Frontend.Pass.Parse.Decl.Field
+import HsBindgen.Frontend.Pass.Parse.Decl.Macro
+import HsBindgen.Frontend.Pass.Parse.Decl.Members
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.Parse.Monad.Decl
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Frontend.Pass.Parse.Type
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.C qualified as C
+import HsBindgen.Macro.Error (MacroParseError)
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Syntax (splitMacro)
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+-- | Top-level declaration
+--
+-- We only attach an exception handler for top-level declarations: if something
+-- goes wrong with a nested declaration, we want to skip the entire outer
+-- declaration.
+topLevelDecl ::
+     Macro.Lang l
+  -> Fold ParseDecl (CXSourceLocation, [ParseResult l Parse])
+topLevelDecl macroLang =
+    foldWithHandler handleParseExceptions (parseDeclTopLevel macroLang)
+  where
+    handleParseExceptions ::
+         CXCursor
+      -> SomeException
+      -> ParseDecl (HandlerResult (Maybe (CXSourceLocation, [ParseResult l Parse])))
+    handleParseExceptions curr err
+      | Just e <- fromException @(ExceptionInCtx DelayedParseMsg) err = do
+          loc <- clang_getCursorLocation curr
+          HandlerResult . Just . (loc,) <$> parseFailNoInfo e.ctx e.exception curr
+      | otherwise = return HandlerRethrow
+
+{-------------------------------------------------------------------------------
+  Functions for each kind of declaration
+-------------------------------------------------------------------------------}
+
+type Parser l = CXCursor -> ParseDecl (Next ParseDecl [ParseResult l Parse])
+
+-- | Parse declarations with available parse context
+parseDeclNested ::
+     Macro.Lang l
+  -> [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> Parser l
+parseDeclNested macroLang enclosing ctx =
+    parseDecl' macroLang enclosing (Just ctx)
+
+-- | Parse a top level declaration (parse context not yet available)
+parseDeclTopLevel ::
+     Macro.Lang l
+  -> CXCursor
+  -> ParseDecl (Next ParseDecl (CXSourceLocation, [ParseResult l Parse]))
+parseDeclTopLevel macroLang curr = do
+    -- By getting and attaching the location to all parse results, we
+    -- potentially get the location twice. We could store the 'CXSourceLocation'
+    -- next to all parse results and use it to retrieve the single location
+    -- stored in the 'DeclInfo'.
+    loc       <- clang_getCursorLocation curr
+    nextDecls <- parseDecl' macroLang [] Nothing curr
+    -- Note the subtle difference between `foldContinue` and
+    -- `foldContinueWith []`: the 'Functor' instance of 'Next' drops values on
+    -- `Continue Nothing`, so a parser using `foldContinue` contributes no entry
+    -- to the result list here, whereas `foldContinueWith []` contributes an
+    -- empty entry (with location attached).
+    pure $ (loc,) <$> nextDecls
+
+-- | Auxiliary function; use 'parseDeclNested' or 'parseDeclTopLevel'
+parseDecl' ::
+     (HasCallStack)
+  => Macro.Lang l
+  -> [C.EnclosingRef Parse]
+  -> Maybe ParseCtx
+  -> Parser l
+parseDecl' macroLang enclosing mCtx = withCursorKindNoCtx $ \case
+      -- Ordinary kinds that we parse
+      Right CXCursor_FunctionDecl    -> parseDeclWith enclosing (push C.NameKindOrdinary NotRequiredForScoping) (functionDecl macroLang)
+      Right CXCursor_VarDecl         -> parseDeclWith enclosing (push C.NameKindOrdinary NotRequiredForScoping) (varDecl macroLang)
+      Right CXCursor_TypedefDecl     -> parseDeclWith enclosing (push C.NameKindOrdinary RequiredForScoping)    typedefDecl
+      Right CXCursor_MacroDefinition -> parseDeclWith enclosing (push C.NameKindMacro    NotRequiredForScoping) (macroDefinition macroLang)
+
+      -- Tagged kinds that we parse
+      Right CXCursor_StructDecl -> parseDeclWith enclosing (push (C.NameKindTagged C.TagKindStruct) NotRequiredForScoping) (structDecl macroLang)
+      Right CXCursor_UnionDecl  -> parseDeclWith enclosing (push (C.NameKindTagged C.TagKindUnion)  NotRequiredForScoping) (unionDecl macroLang)
+      Right CXCursor_EnumDecl   -> parseDeclWith enclosing (push (C.NameKindTagged C.TagKindEnum)   NotRequiredForScoping) enumDecl
+
+      -- Process macro expansions independent of any selection predicates
+      Right CXCursor_MacroExpansion -> macroExpansion
+
+      -- Kinds that we skip over
+      Right CXCursor_AlignedAttr        -> \_curr -> foldContinue
+      Right CXCursor_InclusionDirective -> \_curr -> foldContinue
+      Right CXCursor_PackedAttr         -> \_curr -> foldContinue
+      Right CXCursor_UnexposedAttr      -> \_curr -> foldContinue
+      Right CXCursor_UnexposedDecl      -> \_curr -> foldContinue
+      -- @visibility@ attributes. The visibility itself the value could be
+      -- obtained using 'getCursorVisibility'.
+      Right CXCursor_VisibilityAttr     -> \_curr -> foldContinue
+      -- Windows @__declspec(dllimport)@ / @__declspec(dllexport)@ attributes.
+      -- These do not affect the generated Haskell bindings: foreign imports
+      -- are resolved by the linker regardless of the DLL annotation.
+      Right CXCursor_DLLImport          -> \_curr -> foldContinue
+      Right CXCursor_DLLExport          -> \_curr -> foldContinue
+      -- C11 @_Static_assert@ declarations (e.g. SDL's
+      -- @SDL_COMPILE_TIME_ASSERT@): compile-time checks that declare
+      -- nothing bindable.
+      Right CXCursor_StaticAssert       -> \_curr -> foldContinue
+
+      -- Report error for declarations we don't recognize
+      eKind -> case mCtx of
+        Nothing  ->
+          -- Without a 'ParseCtx', we cannot attach a possible error to the
+          -- declaration, and so we must panic.
+          unavoidablePanicUnrecognizedKind eKind
+        Just ctx ->
+          failUnrecognizedKind ctx eKind >=> foldContinueWith
+  where
+    push :: C.NameKind -> RequiredForScoping -> ParseCtx
+    push kind scoping =
+      let ctx = DeclCtx kind scoping
+      in  case mCtx of
+            Nothing     -> mkCtx   ctx
+            Just ctxOld -> pushCtx ctx ctxOld
+
+    -- We use a custom 'withCursorKind' function here, because the parse context
+    -- is not always available.
+    withCursorKindNoCtx :: (Either CInt CXCursorKind -> Parser l) -> Parser l
+    withCursorKindNoCtx k = \curr -> do
+        mKind <- fromSimpleEnum <$> clang_getCursorKind curr
+        k mKind curr
+
+    -- Unavoidably panic (!) on an unrecognized cursor kind
+    --
+    -- Only use this function if there is no way to assemble a 'HsBindgen.Frontend.Pass.Parse.Result.ParseResult'.
+    --
+    -- See 'failUnrecognizedKind'.
+    unavoidablePanicUnrecognizedKind ::
+      MonadIO m => Either CInt CXCursorKind -> CXCursor -> m b
+    unavoidablePanicUnrecognizedKind eKind curr = do
+        loc <- HighLevel.clang_getCursorLocation' curr
+        case eKind of
+          Left i ->
+            panicIO $ concat [
+                "Unrecognized CXCursorKind "
+              , show i
+              , " at "
+              , show loc
+              ]
+          Right kind -> do
+            spelling <- clang_getCursorKindSpelling (simpleEnum kind)
+            panicIO $ concat [
+                "Unknown cursor of kind "
+              , show kind
+              , " ("
+              , Text.unpack spelling
+              , ") at "
+              , show loc
+              ]
+
+-- | Parse declaration
+--
+-- NOTE: We skip all built-ins. The only built-ins that can even /have/ an
+-- associated declaration at all are macros, and those configure the compiler
+-- rather than belong to the API.
+parseDeclWith ::
+     forall l.
+     [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> ([C.EnclosingRef Parse] -> ParseCtx -> C.DeclInfo Parse -> Parser l)
+  -> Parser l
+parseDeclWith enclosing ctx parser curr = do
+    source <- getCursorSource curr
+    case source of
+      SourceBuiltin      -> foldContinue
+      SourceDecl declLoc -> withDeclInfo enclosing ctx declLoc parseExplicitDecl curr
+  where
+    parseExplicitDecl :: C.DeclInfo Parse -> Parser l
+    parseExplicitDecl info = \_curr ->
+      if | C.Unavailable <- info.availability ->
+             foldContinueWith [
+                 parseUnavailable info
+               ]
+         | otherwise ->
+             parser enclosing ctx info curr
+
+-- | Macros
+macroDefinition ::
+     forall l. HasCallStack
+  => Macro.Lang l
+  -> [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> C.DeclInfo Parse -> Parser l
+macroDefinition macroLang _enclosing ctx info = \curr -> do
+    tokens <- getMacroTokens curr
+    case getMacroName info.id of
+      Nothing -> do
+        failures <- parseFail ctx info.id info.loc ParseMacroDefinitionNoMacroName
+        foldContinueWith failures
+      Just macroName -> do
+        let split = splitMacro tokens
+        recordMacroDefinition macroName split
+        emptyMacros <- getEmptyMacros
+        foldContinueWith [mkResult emptyMacros split]
+  where
+    mkResult ::
+         EmptyMacros
+      -> Either MacroParseError (Runtime.Macro.Raw (Token SourcePath TokenSpelling))
+      -> ParseResult l Parse
+    mkResult emptyMacros split =
+        case parseMacro emptyMacros split of
+          Right parsed -> parseSucceed C.Decl{
+              info = info
+            , kind = C.DeclMacro parsed
+            , ann  = NoAnn
+            }
+          Left msg -> ParseResult{
+              id             = info.id
+            , loc            = info.loc
+            , classification = ParseResultFailure msg
+            }
+
+    -- A macro with an empty replacement list (e.g., @#define FOO@) only reaches
+    -- the macro language when the user asks for it.
+    parseMacro ::
+         EmptyMacros
+      -> Either MacroParseError (Runtime.Macro.Raw (Token SourcePath TokenSpelling))
+      -> Either DelayedParseMsg (Macro.Unresolved l)
+    parseMacro emptyMacros split = do
+        macro <- first ParseMacroErrorParse split
+        case emptyMacros of
+          DoNotParseEmptyMacros | null macro.body ->
+            Left $ ParseMacroEmpty info.id (toList macro)
+          _otherwise ->
+            first ParseMacroErrorParse $ macroLang.parse macro
+
+    getMacroTokens :: CXCursor -> ParseDecl [Token SourcePath TokenSpelling]
+    getMacroTokens curr' = do
+        unit' <- getTranslationUnit
+        HighLevel.clang_tokenize unit' =<< clang_getCursorExtent curr'
+
+    getMacroName :: C.PrelimDeclId -> Maybe Text
+    getMacroName = \case
+        C.PrelimDeclIdNamed declName -> Just declName.text
+        C.PrelimDeclIdUnnamed{}         -> Nothing
+
+-- | Parse an struct declaration
+--
+-- Visibility attributes are ignored on structs, since as far as we can tell
+-- they do not affect the Haskell bindings.
+structDecl ::
+     Macro.Lang l
+  -> [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> C.DeclInfo Parse
+  -> Parser l
+structDecl macroLang enclosing ctx info = \curr -> do
+    classification <- HighLevel.classifyDeclaration curr
+    case classification of
+      Definition -> do
+        ty        <- clang_getCursorType curr
+        sizeof    <- clang_Type_getSizeOf  ty
+        alignment <- clang_Type_getAlignOf ty
+        isAnon    <- clang_Cursor_isAnonymousRecordDecl curr
+
+        let mkStruct :: [C.Field Parse] -> C.Decl l Parse
+            mkStruct allFields = C.Decl {
+                  info = info
+                , ann  = NoAnn
+                , kind = C.DeclStruct C.Struct{
+                      sizeof    = fromIntegral sizeof
+                    , alignment = fromIntegral alignment
+                    , fields    = mapMaybe removePaddingFields regularFields
+                    , flam      = maybe C.NoFlam (`C.Flam` NoAnn) mFlam
+                    , ann       = IsAnon isAnon
+                    }
+                }
+              where
+                (regularFields, mFlam) = partitionFields allFields
+
+            enclosing' :: [C.EnclosingRef Parse]
+            enclosing' = C.EnclosingRef info.id : enclosing
+
+        -- Recursively parse all members of the struct. These members include
+        -- field declarations and nested struct/union declarations.
+        parseMembersWith ty ctx (parseDeclNested macroLang enclosing') $ \membersResult ->
+          -- The parse results of nested struct/union declarations are returned
+          -- regardless of the parse status of field declarations.
+          --
+          -- NOTE: the parse results *must* be returned here. The
+          -- 'withImplicitFields' algorithm relies on it.
+          (membersResult.declMembers ++) <$>
+            -- If we failed to parse any of the field declarations, then we will
+            -- not return a struct object, because it will have missing fields
+            -- that are therefore inaccessible in Haskell.
+            case membersResult.fieldMembers of
+              Left failMsg ->
+                parseFail ctx info.id info.loc failMsg
+              Right fields ->
+                pure [parseSucceed (mkStruct fields)]
+
+      DefinitionUnavailable ->
+        let decl :: C.Decl l Parse
+            decl = C.Decl{
+                info = info
+              , kind = C.DeclOpaque Nothing
+              , ann  = NoAnn
+              }
+        in  foldContinueWith [parseSucceed decl]
+      DefinitionElsewhere _ ->
+        foldContinue
+  where
+    -- Split off FLAM, if any
+    partitionFields ::
+         [C.Field Parse]
+      -> ([C.Field Parse], Maybe (C.RegularField Parse))
+    partitionFields = go []
+      where
+        go ::
+             [C.Field Parse]
+          -> [C.Field Parse]
+          -> ([C.Field Parse], Maybe (C.RegularField Parse))
+        go acc []     = (reverse acc, Nothing)
+        go acc (f:fs) = case f of
+            -- only a regular field can be FLAM
+            C.FieldRegular f'
+              | C.TypeIncompleteArray ty <- f'.typ ->
+                  let f'' = f' & #typ .~ ty
+                  in (reverse acc ++ fs, Just f'')
+            _otherwise ->
+              go (f:acc) fs
+
+
+-- | Parse a union declaration
+--
+-- Visibility attributes are ignored on unions, since as far as we can tell they
+-- do not affect the Haskell bindings.
+unionDecl ::
+     Macro.Lang l
+  -> [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> C.DeclInfo Parse
+  -> Parser l
+unionDecl macroLang enclosing ctx info = \curr -> do
+    classification <- HighLevel.classifyDeclaration curr
+    case classification of
+      Definition -> do
+        ty        <- clang_getCursorType curr
+        sizeof    <- clang_Type_getSizeOf  ty
+        alignment <- clang_Type_getAlignOf ty
+        isAnon    <- clang_Cursor_isAnonymousRecordDecl curr
+
+        let mkUnion :: [C.Field Parse] -> C.Decl l Parse
+            mkUnion fields = C.Decl{
+                  info = info
+                , ann  = NoAnn
+                , kind = C.DeclUnion C.Union{
+                             sizeof    = fromIntegral sizeof
+                           , alignment = fromIntegral alignment
+                           , fields    = mapMaybe removePaddingFields fields
+                           , ann       = IsAnon isAnon
+                           }
+                }
+            enclosing' :: [C.EnclosingRef Parse]
+            enclosing' = C.EnclosingRef info.id : enclosing
+
+        -- Recursively parse all members of the union. These members include
+        -- field declarations and nested struct/union declarations.
+        parseMembersWith ty ctx (parseDeclNested macroLang enclosing') $ \membersResult ->
+          -- The parse results of nested struct/union declarations are returned
+          -- regardless of the parse status of field declarations.
+          --
+          -- NOTE: the parse results *must* be returned here. The
+          -- 'withImplicitFields' algorithm relies on it.
+          (membersResult.declMembers ++) <$>
+            -- If we failed to parse any of the field declarations, then we will
+            -- not return a union object, because it will have missing fields
+            -- that are therefore inaccessible in Haskell.
+            case membersResult.fieldMembers of
+              Left failMsg ->
+                parseFail ctx info.id info.loc failMsg
+              Right fields ->
+                pure [parseSucceed (mkUnion fields)]
+
+      DefinitionUnavailable -> do
+        let decl :: C.Decl l Parse
+            decl = C.Decl{
+                info = info
+              , kind = C.DeclOpaque Nothing
+              , ann  = NoAnn
+              }
+        foldContinueWith [parseSucceed decl]
+      DefinitionElsewhere _ ->
+        foldContinue
+  where
+
+-- An unnamed bit-field is used to specify padding, using a specified
+-- padding width or zero to instruct the compiler to not pack any more
+-- fields into the current storage unit.  This predicate is used to filter
+-- out such bit-fields.
+removePaddingFields :: C.Field Parse -> Maybe (C.Field Parse)
+removePaddingFields = \case
+    C.FieldRegular field ->
+      if Text.null field.info.name.text && isJust field.width
+      then Nothing
+      else Just (C.FieldRegular field)
+    C.FieldImplicit field ->
+      -- implicit fields don't have a bit-width
+      Just (C.FieldImplicit field)
+
+typedefDecl ::
+     forall l.
+     [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> C.DeclInfo Parse
+  -> Parser l
+typedefDecl _enclosing ctx info = \curr -> do
+    typedefType <-
+      fromCXType ctx =<< clang_getTypedefDeclUnderlyingType curr
+
+    declKind <-
+      case typedefType of
+        C.TypeVoid ->
+          -- We regard
+          --
+          -- > typedef void foo
+          --
+          -- as the declaration of an opaque type.
+          return (C.DeclOpaque Nothing)
+        _otherwise -> do
+          typedefAnn <- getReparseInfo curr
+          return $ C.DeclTypedef C.Typedef{
+              typ = typedefType
+            , ann = typedefAnn
+            }
+
+    let decl :: C.Decl l Parse
+        decl = C.Decl{
+            info = info
+          , kind = declKind
+          , ann  = NoAnn
+          }
+    foldContinueWith [parseSucceed decl]
+
+macroExpansion :: Parser l
+macroExpansion = \curr -> do
+    (range, tokens) <- getTokens curr
+    case getMacroName tokens of
+      -- TODO <https://github.com/well-typed/hs-bindgen/issues/1554>
+      --
+      -- Attach failed macroName message to declaration.
+      Nothing -> traceImmediateGlobal ParseMacroExpansionNoMacroName
+      Just macroName -> recordMacroExpansionAt macroName range tokens
+    foldContinue
+  where
+    getTokens ::
+         CXCursor
+      -> ParseDecl (Range (MultiLoc RealPath), [Token SourcePath TokenSpelling])
+    getTokens curr' = do
+        unit'  <- getTranslationUnit
+        range  <- HighLevel.clang_getCursorExtent curr'
+        tokens <- HighLevel.clang_tokenize unit' =<< clang_getCursorExtent curr'
+        pure (range, tokens)
+
+    getMacroName :: [Token SourcePath TokenSpelling] -> Maybe Text
+    getMacroName []    = Nothing
+    -- The spelling of function macros includes the function parameters. For
+    -- example, when expanding
+    --
+    -- #define ID(X) (X)
+    -- void foo(int ID(z));
+    --
+    -- the pretty printed tokens at expansion location are "ID ( z )" instead of
+    -- just the macro name "ID". We believe that in `hs-bindgen` it is enough to
+    -- identify macros by their first token only, because the name of macro
+    -- functions in `hs-bindgen` also corresponds to this first token. That is,
+    -- in `hs-bindgen`,
+    --
+    -- #define ID
+    -- #define ID(X) (X)
+    --
+    -- are conflicting (macro) declarations.
+    getMacroName (x:_) =
+      let macroName = getTokenSpelling $ tokenSpelling x
+      in  if Text.null macroName; then
+            Nothing
+          else
+            Just macroName
+
+-- | Parse an enum declaration
+--
+-- Visibility attributes are ignored on enums, since as far as we can tell they
+-- do not affect the Haskell bindings.
+enumDecl ::
+     [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> C.DeclInfo Parse
+  -> Parser l
+enumDecl _enclosing ctx info = \curr -> do
+    classification <- HighLevel.classifyDeclaration curr
+    case classification of
+      Definition -> do
+        ty        <- clang_getCursorType curr
+        sizeof    <- clang_Type_getSizeOf  ty
+        alignment <- clang_Type_getAlignOf ty
+        ety       <- fromCXType ctx =<< clang_getEnumDeclIntegerType curr
+
+        -- The underlying type of a C enum is always an integer type, so
+        -- clang_getEnumDeclIntegerType only returns TypePrim (e.g. unsigned
+        -- int) or TypeTypedef wrapping one (e.g. uint8_t). The fallback to
+        -- Signed is conservative and should be unreachable in practice.
+        --
+        let enumSign :: C.PrimSign
+            enumSign = go ety
+              where
+                go (C.TypePrim pt)      = C.primTypeSign pt
+                go (C.TypeTypedef ref)  = go ref.underlying
+                go _                    = C.Signed
+
+        let parseConstant ::
+              Fold ParseDecl (Either DelayedParseMsg (C.EnumConstant Parse))
+            parseConstant = simpleFold $ \curr' -> do
+                mKind <- fromSimpleEnum <$> clang_getCursorKind curr'
+                case mKind of
+                  Right CXCursor_EnumConstantDecl ->
+                    fmap Right <$> enumConstantDecl enumSign curr'
+                  Right CXCursor_PackedAttr ->
+                    foldContinue
+                  -- @visibility@ attributes. The visibility itself the value can be
+                  -- obtained using 'getCursorVisibility'.
+                  Right CXCursor_VisibilityAttr -> foldContinue
+                  -- Windows @__declspec(dllimport)@ / @__declspec(dllexport)@.
+                  -- These don't affect the generated Haskell bindings.
+                  Right CXCursor_DLLImport -> foldContinue
+                  Right CXCursor_DLLExport -> foldContinue
+                  unexpectedKind -> foldContinueWith
+                    (Left $ ParseUnexpectedCursorKind unexpectedKind)
+
+        let mkEnum ::
+                 [Either DelayedParseMsg (C.EnumConstant Parse)]
+              -> ParseDecl [ParseResult l Parse]
+            mkEnum eConstants = case partitionEithers eConstants of
+              ([], constants) -> pure $ (:[]) $ parseSucceed $ C.Decl{
+                  info = info
+                , ann  = NoAnn
+                , kind = C.DeclEnum C.Enum{
+                             typ       = ety
+                           , sizeof    = fromIntegral sizeof
+                           , alignment = fromIntegral alignment
+                           , constants = constants
+                           , ann       = NoAnn
+                           }
+                }
+              -- If there are errors, report the first one.
+              (msg:_, _) -> parseFail ctx info.id info.loc msg
+
+        foldRecurseWith parseConstant mkEnum
+      DefinitionUnavailable -> do
+        let decl :: C.Decl l Parse
+            decl = C.Decl{
+                info = info
+              , kind = C.DeclOpaque Nothing
+              , ann  = NoAnn
+              }
+        foldContinueWith [parseSucceed decl]
+      DefinitionElsewhere _ ->
+        foldContinue
+
+enumConstantDecl ::
+     C.PrimSign
+  -> CXCursor
+  -> ParseDecl (Next ParseDecl (C.EnumConstant Parse))
+enumConstantDecl sign = \curr -> do
+    enumConstantInfo  <- getFieldInfo curr
+    enumConstantValue <- case sign of
+      C.Unsigned -> toInteger <$> clang_getEnumConstantDeclUnsignedValue curr
+      C.Signed   -> toInteger <$> clang_getEnumConstantDeclValue curr
+    foldContinueWith C.EnumConstant {
+        info  = enumConstantInfo
+      , value = enumConstantValue
+      }
+
+functionDecl ::
+     forall l.
+     Macro.Lang l
+  -> [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> C.DeclInfo Parse
+  -> Parser l
+functionDecl macroLang enclosing ctx info =
+    withCursorVisibility ctx info $ \visibility ->
+      withCursorLinkage ctx info $ \linkage ->
+        aux visibility linkage
+  where
+    aux :: Visibility -> Linkage -> Parser l
+    aux visibility linkage curr = do
+      declCls    <- HighLevel.classifyDeclaration curr
+      typ        <- fromCXType ctx =<< clang_getCursorType curr
+      guardTypeFunction curr typ >>= \case
+        Left rs -> foldContinueWith rs
+        Right (functionArgs, functionRes) -> do
+          functionAnn <- getReparseInfo curr
+          let mkDecl :: C.FunctionPurity -> C.Decl l Parse
+              mkDecl purity = C.Decl{
+                  info = info
+                , ann  = NoAnn
+                , kind = C.DeclFunction C.Function {
+                             args  = functionArgs
+                           , res   = functionRes
+                           , attrs = C.FunctionAttributes purity
+                           , ann   = functionAnn
+                           }
+                }
+
+          case declCls of
+            -- The header contains a definition elsewhere, but it is not the
+            -- declaration that the cursor is currently pointing to. Skip this
+            -- declaration.
+            DefinitionElsewhere _->
+              foldContinue
+            _ -> foldRecurseWith nestedDecl $ \nestedDecls -> do
+              let declsAndAttrs = concat nestedDecls
+                  (parseRs, attrs) = partitionEithers declsAndAttrs
+                  (fails, decls)   = partitionEithers $
+                                       map getParseResultEitherDecl parseRs
+                  purity = C.decideFunctionPurity attrs
+                  (unnamedDecls, otherDecls) = partitionUnnamedDecls decls
+
+              -- This declaration may act as a definition.
+              let isDefn = declCls == Definition
+
+              (fails ++) <$>
+                if not (null unnamedDecls) then do
+                  parseFail ctx info.id info.loc ParseUnsupportedUnnamedInSignature
+                else
+                  let nonPublicVisibility = [
+                          ParseNonPublicVisibility
+                        | visibilityCanCauseErrors visibility linkage isDefn
+                        ]
+                      potentialDuplicate = [
+                          ParsePotentialDuplicateSymbol (visibility == PublicVisibility)
+                        | isDefn && linkage == ExternalLinkage
+                        ]
+                      msgs = nonPublicVisibility ++ potentialDuplicate
+                      funDeclResult = parseSucceedWith msgs (mkDecl purity)
+                  in pure $ map parseSucceed otherDecls ++ [funDeclResult]
+
+    guardTypeFunction ::
+         CXCursor
+      -> C.Type Parse
+      -> ParseDecl (
+            Either
+              [ParseResult l Parse]
+              ([C.FunctionArg Parse], C.Type Parse)
+          )
+    guardTypeFunction curr ty =
+        case ty of
+          C.TypeFun args res -> do
+            args' <- forM (zip args [0 :: Int ..]) $ \(argCType, i) -> do
+              argCursor <- clang_Cursor_getArgument curr i
+
+              argName <- clang_getCursorDisplayName argCursor
+              let mbArgName =
+                    if Text.null argName
+                       then Nothing
+                       else Just (C.ScopedName argName)
+
+              return C.FunctionArg{
+                  name = mbArgName
+                , typ  = argCType.typ
+                , ann  = argCType.ann
+                }
+            pure $ Right (args', res)
+          C.TypeTypedef{} ->
+            Left <$>
+              (parseFail ctx info.id info.loc ParseFunctionOfTypeTypedef)
+          otherType ->
+            Left <$>
+              (parseFail ctx info.id info.loc $
+                 ParseExpectedFunctionType $ show otherType)
+
+    -- Look for (unsupported) declarations inside function parameters, and for
+    -- function attributes. Function attributes are returned separately, so that
+    -- we can pair them with the parent function.
+    nestedDecl :: Fold ParseDecl [Either (ParseResult l Parse) C.FunctionPurity]
+    nestedDecl = simpleFold $ \curr -> do
+        kind <- fromSimpleEnum <$> clang_getCursorKind curr
+        let enclosing' :: [C.EnclosingRef Parse]
+            enclosing' = C.EnclosingRef info.id : enclosing
+        case kind of
+          -- 'ParmDecl' sometimes appear in nested in the AST
+          Right CXCursor_ParmDecl ->
+            foldRecurseWith nestedDecl (return . concat)
+
+          -- Nested declarations
+          Right CXCursor_StructDecl -> fmap (fmap Left) <$> parseDeclNested macroLang enclosing' ctx curr
+          Right CXCursor_UnionDecl  -> fmap (fmap Left) <$> parseDeclNested macroLang enclosing' ctx curr
+
+          -- Harmless
+          Right CXCursor_TypeRef        -> foldContinue
+          Right CXCursor_IntegerLiteral -> foldContinue
+          Right CXCursor_UnexposedAttr  -> foldContinue
+
+          -- @const@ and @pure@ function attributes.
+          Right CXCursor_ConstAttr -> foldContinueWith $ [Right C.HaskellPureFunction]
+          Right CXCursor_PureAttr  -> foldContinueWith $ [Right C.CPureFunction]
+
+          -- @visibility@ attributes. The visibility itself the value is
+          -- obtained using 'getCursorVisibility'.
+          Right CXCursor_VisibilityAttr -> foldContinue
+
+          -- Windows @__declspec(dllimport)@ / @__declspec(dllexport)@
+          -- attributes. These do not affect the generated Haskell bindings.
+          Right CXCursor_DLLImport -> foldContinue
+          Right CXCursor_DLLExport -> foldContinue
+
+          -- Attributes we (probably?) want to ignore
+          Right CXCursor_WarnUnusedResultAttr -> foldContinue
+
+          -- Function body
+          Right CXCursor_CompoundStmt -> foldContinue
+
+          -- We are not interested in assembler labels.
+          Right CXCursor_AsmLabelAttr -> foldContinue
+
+          -- Fail on anything else. We could instead use 'foldContinue' here,
+          -- but this is safer.
+          otherKind -> do
+            failures <-
+              parseFail ctx info.id info.loc
+                (ParseUnexpectedCursorKind otherKind)
+            foldContinueWith $ map Left failures
+
+-- | Global variable declaration
+varDecl ::
+     forall l.
+     Macro.Lang l
+  -> [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> C.DeclInfo Parse
+  -> Parser l
+varDecl macroLang enclosing ctx info = do
+    withCursorVisibility ctx info $ \visibility ->
+      withCursorLinkage ctx info $ \linkage ->
+        aux visibility linkage
+  where
+    aux :: Visibility -> Linkage -> Parser l
+    aux visibility linkage curr = do
+      declCls    <- HighLevel.classifyDeclaration curr
+      typ        <- fromCXType ctx =<< clang_getCursorType curr
+      cls        <- classifyVarDecl curr
+      let mkDecl :: C.DeclKind l Parse -> C.Decl l Parse
+          mkDecl kind = C.Decl{
+              info = info
+            , kind = kind
+            , ann  = NoAnn
+            }
+
+      case declCls of
+        -- The header contains a definition elsewhere, but it is not the
+        -- declaration that the cursor is currently pointing to. Skip this
+        -- declaration.
+        DefinitionElsewhere _->
+          foldContinue
+        _ -> foldRecurseWith nestedDecl $ \nestedRs -> do
+          let
+            (fails, nestedDecls)    = partitionEithers $
+                                        map getParseResultEitherDecl $
+                                          concat nestedRs
+            (unnamedDecls, otherDecls) = partitionUnnamedDecls nestedDecls
+
+          -- This declaration may act as a definition even if it has no
+          -- initialiser.
+          isTentative <- HighLevel.classifyTentativeDefinition curr
+          let isDefn = declCls == Definition
+                     || (isTentative && declCls == DefinitionUnavailable)
+
+          (fails ++) <$>
+            let nonPublicVisibility = [
+                    ParseNonPublicVisibility
+                  | visibilityCanCauseErrors visibility linkage isDefn
+                  ]
+                potentialDuplicate = [
+                    ParsePotentialDuplicateSymbol (visibility == PublicVisibility)
+                  | isDefn && linkage == ExternalLinkage
+                  ]
+                msgs = nonPublicVisibility ++ potentialDuplicate
+             in case cls of
+                  VarGlobal IsExtern
+                    | not (null unnamedDecls) -> do
+                      parseFail ctx info.id info.loc ParseUnsupportedUnnamedInExtern
+                  VarGlobal _ -> do
+                    globalAnn <- getReparseInfo curr
+                    pure $ (map parseSucceed (unnamedDecls ++ otherDecls) ++) $
+                      singleton $ parseSucceedWith msgs $
+                        mkDecl $ C.DeclGlobal C.Global{
+                            typ = typ
+                          , ann = globalAnn
+                          }
+                  VarThreadLocal ->
+                    parseFail ctx info.id info.loc ParseUnsupportedTLS
+                  VarUnsupported storage ->
+                    parseFail ctx info.id info.loc $ ParseUnknownStorageClass storage
+    -- Look for nested declarations inside the global variable type
+    nestedDecl :: Fold ParseDecl [ParseResult l Parse]
+    nestedDecl =
+        let enclosing' = C.EnclosingRef info.id : enclosing
+        in simpleFold $ withCursorKind ctx $ \case
+          -- Reference to previously declared type can safely be skipped
+          CXCursor_TypeRef -> skip
+
+          -- Nested /new/ declarations
+          CXCursor_StructDecl -> parseDeclNested macroLang enclosing' ctx
+          CXCursor_UnionDecl  -> parseDeclNested macroLang enclosing' ctx
+          CXCursor_EnumDecl   -> parseDeclNested macroLang enclosing' ctx
+
+          -- Initializers
+          --
+          -- It's a bit annoying that we have to explicitly enumerate them, but
+          -- a catch-all may result in us ignoring nodes that we shouldn't.
+          --
+          -- The order here roughly matches the order of 'CXCursor'.
+          -- <https://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d470913f9ef0013>
+          CXCursor_IntegerLiteral      -> skip
+          CXCursor_FloatingLiteral     -> skip
+          CXCursor_ImaginaryLiteral    -> skip
+          CXCursor_StringLiteral       -> skip
+          CXCursor_ParenExpr           -> skip
+          CXCursor_UnaryOperator       -> skip
+          CXCursor_BinaryOperator      -> skip
+          CXCursor_ConditionalOperator -> skip
+          CXCursor_CStyleCastExpr      -> skip
+          CXCursor_InitListExpr        -> skip
+          CXCursor_CXXBoolLiteralExpr  -> skip -- Since C23
+
+          -- Some initializers are \"unexposed\".
+          --
+          -- Not sure exactly when clang decides to expose an expression and
+          -- when it does not, but it seems it does this when constructing
+          -- /pointers/ to values, such as
+          --
+          -- > char* x = "hi";              // CXCursor_StringLiteral?
+          -- > int*  y = (int []){2, 4, 6}; // CXCursor_CompoundLiteralExpr?
+          --
+          -- String literals /are/ exposed when declaring an array:
+          --
+          -- > char z = "hi";
+          --
+          -- The only other example I'm currently aware of is characters
+          -- ('CXCursor_CharacterLiteral').
+          CXCursor_UnexposedExpr -> skip
+          CXCursor_DeclRefExpr   -> skip
+
+          -- @visibility@ attributes, where the value is obtained using
+          -- @clang_getCursorVisibility@.
+          CXCursor_VisibilityAttr -> skip
+
+          -- Windows @__declspec(dllimport)@ / @__declspec(dllexport)@
+          -- attributes. These do not affect the generated Haskell bindings.
+          CXCursor_DLLImport -> skip
+          CXCursor_DLLExport -> skip
+
+          -- We are not interested in assembler labels.
+          CXCursor_AsmLabelAttr -> skip
+
+          -- Function types
+          CXCursor_ParmDecl -> skip
+
+          -- Fail on anything we don't recognize
+          otherKind -> \_curr -> do
+            failures <-
+              parseFail ctx info.id info.loc
+                (ParseUnexpectedCursorKind $ Right otherKind)
+            foldContinueWith failures
+
+    skip :: MonadIO m => b -> m (Next m a)
+    skip = const foldContinue
+
+{-------------------------------------------------------------------------------
+  Utility: dispatching based on the cursor kind
+-------------------------------------------------------------------------------}
+
+-- | Fail safely due to an unrecognized cursor kind
+--
+-- Assemble a parse failure
+failUnrecognizedKind ::
+     ParseCtx
+  -> Either CInt CXCursorKind
+  -> CXCursor
+  -> ParseDecl [ParseResult l Parse]
+failUnrecognizedKind ctx eKind curr =
+    let msg = ParseUnexpectedCursorKind eKind
+    in  parseFailNoInfo ctx msg curr
+
+-- | Obtain cursor kind and run continuation
+--
+-- Only run continuation if the cursor kind can be obtain, otherwise fail with a
+-- 'HsBindgen.Frontend.Pass.Parse.Msg.DelayedParseMsg'.
+withCursorKind ::
+     ParseCtx
+  -> (CXCursorKind -> Parser l)
+  -> Parser l
+withCursorKind ctx k = \curr -> do
+    mKind <- fromSimpleEnum <$> clang_getCursorKind curr
+    case mKind of
+      Right kind -> k kind curr
+      Left  i    -> failUnrecognizedKind ctx (Left i) curr >>= foldContinueWith
+
+{-------------------------------------------------------------------------------
+  Info that we collect for all declarations
+-------------------------------------------------------------------------------}
+
+-- | Parse with declaration info
+--
+-- The continuation is only called when the declaration info can be determined.
+withDeclInfo ::
+     [C.EnclosingRef Parse]
+  -> ParseCtx
+  -> SingleLoc C.DeclPath
+  -> (C.DeclInfo Parse -> Parser l)
+  -> Parser l
+withDeclInfo enclosing ctx declLoc k = \curr -> do
+    declId <- C.prelimDeclIdAtCursor curr ctx.inner.kind
+    (withOrigin ctx declId declLoc $ \origin ->
+      withAvailability ctx declId declLoc $ \availability curr' -> do
+        let info :: C.DeclInfo Parse
+            info = C.DeclInfo{
+                  loc              = declLoc
+                , id               = declId
+                  -- We initialize the source-order index to 'Nothing', and
+                  -- populate it when consolidating macros with non-macros in
+                  -- "HsBindgen.Frontend.Pass.Parse".
+                , sourceOrderIndex = Nothing
+                , origin           = origin
+                , availability     = availability
+                , comment          = ()
+                , enclosing        = enclosing
+                }
+        k info curr') curr
+
+-- | Continue with availability
+--
+-- The continuation is only called when the availability can be determined.
+withAvailability ::
+     ParseCtx
+  -> C.PrelimDeclId
+  -> SingleLoc C.DeclPath
+  -> (C.Availability -> Parser l)
+  -> Parser l
+withAvailability ctx declId declLoc k = \curr -> do
+    sAvailability  <- clang_getCursorAvailability curr
+    let mAvailability :: Maybe C.Availability
+        mAvailability = fmap toAvailability $ fromSimple $ sAvailability
+    case mAvailability of
+      Nothing -> do
+        failures <-
+          parseFail ctx declId declLoc $
+            ParseUnknownCursorAvailability sAvailability
+        foldContinueWith failures
+      Just availability -> k availability curr
+  where
+    fromSimple :: IsSimpleEnum a => SimpleEnum a -> Maybe a
+    fromSimple x = either (const Nothing) Just $ fromSimpleEnum x
+
+    toAvailability :: CXAvailabilityKind -> C.Availability
+    toAvailability = \case
+      CXAvailability_Available     -> C.Available
+      CXAvailability_Deprecated    -> C.Deprecated
+      CXAvailability_NotAvailable  -> C.Unavailable
+      CXAvailability_NotAccessible -> C.Unavailable
+
+-- | Continue with the origin of a declaration
+--
+-- The continuation is only called when the origin can be determined.
+withOrigin ::
+     ParseCtx
+  -> C.PrelimDeclId
+  -> SingleLoc C.DeclPath
+  -> (C.DeclOrigin -> Parser l)
+  -> Parser l
+withOrigin ctx declId declLoc k = case declLoc.singleLocPath of
+    C.OnCommandLine     -> k C.FromCommandLine
+    C.InRootHeader      -> k C.FromRootDirective
+    C.InHeader realPath ->
+      withHeaderInfo ctx declId declLoc realPath (k . C.FromHeader)
+
+-- | Continue with header information
+--
+-- The continuation is only called when the header information can be determined.
+withHeaderInfo ::
+     ParseCtx
+  -> C.PrelimDeclId
+  -> SingleLoc C.DeclPath
+  -> RealPath
+  -> (C.HeaderInfo -> Parser l)
+  -> Parser l
+withHeaderInfo ctx declId declLoc realPath k = \curr -> do
+  eRes <- evalGetMainHeadersAndInclude realPath
+  case eRes of
+    Left err -> do
+      failures <- parseFail ctx declId declLoc err
+      foldContinueWith failures
+    Right res ->
+      k (uncurry aux res) curr
+  where
+    aux :: NonEmpty C.HashIncludeArg -> IncludeGraph.Include -> C.HeaderInfo
+    aux mainHeaders include = C.HeaderInfo{
+        mainHeaders     = mainHeaders
+      , includeArg      = IncludeGraph.getIncludeArg      include
+      , includeMacroArg = IncludeGraph.getIncludeMacroArg include
+      }
+
+-- | The linkage of a linker symbol determines whether or not a linker symbol is
+-- visible to the linker outside the translation unit it is defined in.
+--
+-- See the section on Visibility in the manual for more details.
+data Linkage =
+    InternalLinkage
+  | NoLinkage
+  | ExternalLinkage
+  deriving stock (Show, Eq, Generic)
+
+-- | Retrieve the linkage of the entity that the cursor is currently pointing
+-- to.
+--
+-- Only call continuation if linkage can be retrieved.
+withCursorLinkage ::
+     ParseCtx
+  -> C.DeclInfo Parse
+  -> (Linkage -> Parser l)
+  -> Parser l
+withCursorLinkage ctx info k = \curr -> do
+    simpleLinkage   <- clang_getCursorLinkage curr
+    case fromSimpleLinkage simpleLinkage of
+      Left err -> parseFail ctx info.id info.loc err >>= foldContinueWith
+      Right l  -> k l curr
+  where
+    fromSimpleLinkage ::
+         SimpleEnum CXLinkageKind
+      -> Either DelayedParseMsg Linkage
+    fromSimpleLinkage simpleLinkage =
+      case fromSimpleEnum simpleLinkage of
+        Right linkage' -> case linkage' of
+          CXLinkage_Invalid ->
+            Left ParseInvalidLinkage
+          CXLinkage_NoLinkage ->
+            Right NoLinkage
+          CXLinkage_Internal ->
+            Right InternalLinkage
+          CXLinkage_UniqueExternal ->
+            Left $ ParseUnsupportedLinkage "C++ specific" linkage'
+          CXLinkage_External ->
+            Right ExternalLinkage
+        Left x -> do
+          Left $ ParseUnexpectedLinkage (Left x)
+
+-- | The visibility of a linker symbol determines whether or not a linker symbol
+-- is visible to the linker outside of the shared object that it is defined in.
+--
+-- See the section on Visibility in the manual for more details.
+data Visibility =
+    PublicVisibility
+  | NonPublicVisibility
+  deriving stock (Show, Eq, Generic)
+
+-- | Retrieve the visibility of the entity that the cursor is currently pointing
+-- to.
+--
+-- Only call continuation if cursor visibility can be retrieved.
+withCursorVisibility ::
+     ParseCtx
+  -> C.DeclInfo Parse
+  -> (Visibility -> Parser l)
+  -> Parser l
+withCursorVisibility ctx info k = \curr -> do
+    simpleVisibility  <- clang_getCursorVisibility curr
+    case fromSimpleVisibility simpleVisibility of
+      Left err -> parseFail ctx info.id info.loc err >>= foldContinueWith
+      Right v  -> k v curr
+  where
+    fromSimpleVisibility ::
+         SimpleEnum CXVisibilityKind
+      -> Either DelayedParseMsg Visibility
+    fromSimpleVisibility simpleVisibility =
+      case fromSimpleEnum simpleVisibility of
+        -- See https://clang.llvm.org/doxygen/group__CINDEX__CURSOR__MANIP.html#gaf92fafb489ab66529aceab51818994cb
+        Right vis' -> case vis' of
+          -- Despite the name, /default/ always means public.
+          CXVisibility_Default ->
+            Right PublicVisibility
+          CXVisibility_Hidden ->
+            Right NonPublicVisibility
+          -- This visibility is rarely useful in practice. For binding generation,
+          -- we treat it as non-public visibility.
+          CXVisibility_Protected ->
+            Right NonPublicVisibility
+          CXVisibility_Invalid ->
+            Left $ ParseInvalidVisibility
+        Left x ->
+          Left $ ParseUnexpectedVisibility (Left x)
+
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+-- | Partition declarations into named and unnamed
+--
+-- We are only interested in the name of the declaration /itself/; if a named
+-- declaration /contains/ unnamed declarations, that's perfectly fine.
+partitionUnnamedDecls ::
+     [C.Decl l Parse]
+  -> ([C.Decl l Parse], [C.Decl l Parse])
+partitionUnnamedDecls =
+    List.partition $ \decl -> declIdIsUnnamed decl.info.id
+  where
+    declIdIsUnnamed :: C.PrelimDeclId -> Bool
+    declIdIsUnnamed C.PrelimDeclIdUnnamed{} = True
+    declIdIsUnnamed _otherwise           = False
+
+-- | Whether a global variable has @extern@ storage class
+--
+-- This is only used locally during parsing to reject extern declarations with
+-- unnamed types; it is not propagated into the AST.
+data IsExtern = IsExtern | IsNotExtern
+  deriving stock (Show)
+
+data VarClassification =
+    -- | Global variable (mutable or const)
+    --
+    -- > extern int simpleGlobal;
+    -- > extern const int globalConstant;
+    -- > static const int staticConst = 123;
+    --
+    -- NOTE: @static@ can be useful to be able to specify the /value/ of the
+    -- constant in the header file (perhaps so that the compiler can inline it).
+    -- Without @const@, @static@ results in a mutable variable local to any C
+    -- file that includes the header, invisible to the C API. Arguably this does
+    -- not make much sense, but it does occur in real-world code (e.g. device
+    -- driver headers), so we accept it nonetheless.
+    --
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/829>
+    -- We could in principle expose the /value/ of the constant, if we know it.
+    VarGlobal IsExtern
+
+    -- | Thread local variables
+    --
+    -- We don't currently support thread-local variables.
+    -- <https://github.com/well-typed/hs-bindgen/issues/828>
+    --
+    -- This is a special case of 'VarUnsupported', for better error reporting.
+  | VarThreadLocal
+
+    -- | Unsupported storage class
+  | VarUnsupported (SimpleEnum CX_StorageClass)
+  deriving stock (Show)
+
+classifyVarDecl :: MonadIO m => CXCursor -> m VarClassification
+classifyVarDecl = \curr -> do
+    tls <- clang_getCursorTLSKind curr
+    case fromSimpleEnum tls of
+      Right CXTLS_None -> do
+        storage <- clang_Cursor_getStorageClass curr
+        case fromSimpleEnum storage of
+          Right CX_SC_Extern  -> return $ VarGlobal IsExtern
+          Right CX_SC_None    -> return $ VarGlobal IsNotExtern
+          Right CX_SC_Static  -> return $ VarGlobal IsNotExtern
+          _otherwise -> return $ VarUnsupported storage
+      _otherwise ->
+        return VarThreadLocal
+
+-- | Check if a function declaration or global variable declaration has a
+-- problematic case of non-public visibility.
+--
+-- See the section on Visibility in the manual for more details.
+visibilityCanCauseErrors ::
+     Visibility
+  -> Linkage
+  -> Bool
+     -- ^ Whether the declaration acts as a definition
+     --
+     -- Tentative definitions can also act as definitions if there are no full
+     -- definitions in scope.
+  -> Bool
+visibilityCanCauseErrors NonPublicVisibility ExternalLinkage False = True
+visibilityCanCauseErrors _ _ _ = False
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/Field.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/Field.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/Field.hs
@@ -0,0 +1,54 @@
+-- | Parse functions related to struct and union fields
+module HsBindgen.Frontend.Pass.Parse.Decl.Field (
+    regularFieldDecl
+  , getFieldInfo
+  ) where
+
+import Control.Monad.IO.Class (MonadIO)
+
+import Clang.HighLevel qualified as HighLevel
+import Clang.LowLevel.Core (CXCursor, clang_Cursor_getOffsetOfField,
+                            clang_Cursor_isBitField, clang_getCursorDisplayName,
+                            clang_getCursorType, clang_getFieldDeclBitWidth)
+
+import HsBindgen.Frontend.Pass.Parse.Context (ParseCtx)
+import HsBindgen.Frontend.Pass.Parse.Decl.Macro (getReparseInfo)
+import HsBindgen.Frontend.Pass.Parse.IsPass (Parse)
+import HsBindgen.Frontend.Pass.Parse.Monad.Decl (ParseDecl)
+import HsBindgen.Frontend.Pass.Parse.Type (fromCXType)
+import HsBindgen.IR.C qualified as C
+
+regularFieldDecl :: ParseCtx -> CXCursor -> ParseDecl (C.RegularField Parse)
+regularFieldDecl ctx = \curr -> do
+    info   <- getFieldInfo curr
+    typ    <- fromCXType ctx =<< clang_getCursorType curr
+    offset <- fromIntegral <$> clang_Cursor_getOffsetOfField curr
+    width  <- getFieldWidth curr
+    ann    <- getReparseInfo curr
+    pure C.RegularField{
+        info   = info
+      , typ    = typ
+      , offset = offset
+      , width  = width
+      , ann    = ann
+      }
+
+getFieldWidth :: MonadIO m => CXCursor -> m (Maybe Int)
+getFieldWidth = \curr -> do
+    isBitField <- clang_Cursor_isBitField curr
+    if isBitField
+      then Just . fromIntegral <$> clang_getFieldDeclBitWidth curr
+      else return Nothing
+
+-- | Get field info from a cursor
+--
+-- Comments are filled in later by the 'EnrichComments' pass.
+getFieldInfo :: MonadIO m => CXCursor -> m (C.FieldInfo Parse)
+getFieldInfo = \curr -> do
+    fieldLoc  <- fmap C.InHeader <$> HighLevel.clang_getCursorLocation' curr
+    fieldName <- C.ScopedName <$> clang_getCursorDisplayName curr
+    return C.FieldInfo {
+        loc     = fieldLoc
+      , name    = fieldName
+      , comment = ()
+      }
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/ImplicitFields.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/ImplicitFields.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/ImplicitFields.hs
@@ -0,0 +1,479 @@
+-- This module is intended to be imported qualified.
+--
+-- > import HsBindgen.Frontend.Pass.Parse.Decl.ImplicitFields as IFields
+module HsBindgen.Frontend.Pass.Parse.Decl.ImplicitFields (
+    -- * Inputs
+    Inputs
+  , inputEmpty
+  , inputField
+  , inputDecl
+    -- * Outputs
+  , Outputs (..)
+    -- * Top-level
+  , EnclosingObject(..)
+  , withImplicitFields
+  ) where
+
+import Control.Exception (try)
+import Control.Monad.Except (ExceptT (..), MonadError (throwError), liftEither,
+                             runExceptT)
+import Data.Either (partitionEithers)
+import Data.Foldable (minimumBy)
+import Data.List (sortOn)
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Text qualified as Text
+
+import Clang.LowLevel.Core (CXType, CallFailed, clang_Type_getOffsetOf)
+
+import HsBindgen.Frontend.Analysis.Deps (depsOfRegularField, depsOfStruct,
+                                         depsOfUnion)
+import HsBindgen.Frontend.Pass.Parse.IsPass (IsAnon (isAnon), Parse)
+import HsBindgen.Frontend.Pass.Parse.IsPass qualified as Origin (FieldOrigin (..))
+import HsBindgen.Frontend.Pass.Parse.Msg (ParseImplicitFieldsMsg (..))
+import HsBindgen.Imports (Bifunctor (bimap), MonadIO (..), NonEmpty, forM)
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass (PassScopedName (ScopedName))
+
+{-------------------------------------------------------------------------------
+  Inputs
+-------------------------------------------------------------------------------}
+
+-- | A list of nested struct\/union declarations and field declarations
+newtype Inputs l = Inputs {
+    nestedDecls :: [Either (C.Decl l Parse) (C.RegularField Parse)]
+  }
+  deriving newtype (Semigroup, Monoid)
+
+inputEmpty :: Inputs l
+inputEmpty = Inputs []
+
+inputField :: C.RegularField Parse -> Inputs l
+inputField x = Inputs [Right x]
+
+inputDecl :: C.Decl l Parse -> Inputs l
+inputDecl x = Inputs [Left x]
+
+{-------------------------------------------------------------------------------
+  Outputs
+-------------------------------------------------------------------------------}
+
+data Outputs =
+    -- | An exception occurred
+    OutputFail {
+        exception :: ParseImplicitFieldsMsg
+      }
+    -- | All regular and implicit fields
+  | OutputSuccess {
+        fields    :: [C.Field Parse]
+      }
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+-- | Detect implicit fields and generate entries in the C AST for them
+--
+-- PRECONDITION: the inputs must include all nested struct\/union\/field
+-- declarations that are present in the C source. If any failed to parse and are
+-- not included, then it is unsafe to use 'withImplicitFields'.
+--
+-- Unnamed bit-fields, used to specify padding, are already filtered out.
+--
+-- === Algorithm description
+--
+-- Implicit fields for nested anonymous structs and unions are not reported by
+-- @libclang@, so we detect them instead.
+--
+-- Given an enclosing object struct\/union $E$, and a nested anonymous
+-- struct\/union $A$, the goal is to compute the offset of the (hidden) implicit
+-- field of $E$ that reference $A$. The key observation is that the offset to
+-- that implicit field is equal to the offset to any of $A$'s fields (let's say
+-- $F$), subtracted by the offset to $F$ with respect to $A$.
+--
+-- Let's walk through an example to make this more concrete. We assume that
+-- @int@s are 4 bytes.
+--
+-- > struct E {
+-- >   int x;
+-- >   struct A {
+-- >     int : 3;
+-- >     int y;
+-- >   };
+-- > };
+--
+-- The offsets that are reported by @libclang@ are as follows:
+--
+-- * @offsetOf(E, x) = 0@
+-- * @offsetOf(A, y) = 4@
+-- * @offsetOf(E, y) = 12@
+--
+-- We can ask @libclang@ for the offset of $y$ with respect to $E$ because $y$
+-- is considered an indirect field of $E$. It can be accessed as if it were a
+-- true field of $E$ itself. We can not ask for the offset of $A$ with respect
+-- to $E$, unfortunately, so we have to compute it ourselves instead.
+--
+-- * @offsetOf(E, A) = offsetOf(E, y) - offsetOf(A, y) = 12 - 4 = 8@
+--
+-- The compiler implementation is not allowed to include padding before the
+-- first field of a struct\/union, but it is free to include padding between
+-- fields. For that reason, we could not have used the /size/ of individual
+-- fields to compute @offsetOf(E, A)@. In the example, $x$ has a size of $4$
+-- bytes, while the offset to $A$ is $8$ bytes because the "compiler" has
+-- inserted $4$ padding bytes between the $x$ and $A$. In practice, there will
+-- probably be no padding in this case, but there could be and we have to design
+-- the algorithm with that assumption in mind.
+--
+-- Using the computed offset, we generate a so-called implicit field and we
+-- include it as a struct\/union field in the C AST. Haskell bindings are
+-- generated for such implicit fields like for any other regular field.
+--
+-- The implicit field detection algorithm is the same for any nesting of structs
+-- or unions, in any order, even recursively.
+--
+-- The implicit field detection algorithm does rely on one condition: the
+-- anonymous nested struct or union should have at least one named field. In
+-- other words, the anonymous nested struct\/union should be "non-empty". A
+-- struct\/union with only unnamed bit-fields, used to specify padding, is also
+-- considered empty. A warning-level trace message will be emitted if these
+-- conditions are not met.
+--
+-- Anonymous nested structs/unions have no name, but they need one for our
+-- Haskell bindings, so they are named after their first field. We prefix the
+-- field name with "anon'" to highlight that the field is created for an
+-- anonymous struct/union. The tick ensures that this name can not clash with
+-- any existing C fields because ticks are not allowed in C identifiers. See
+-- issue #2064 for more information about this "anon'" prefix.
+--
+-- <https://github.com/well-typed/hs-bindgen/issues/2064>
+--
+-- Informally, the former will be transformed to the latter:
+--
+-- > struct S {
+-- >   struct {
+-- >     int x;
+-- >   };
+-- > };
+--
+-- > struct S {
+-- >   struct {
+-- >     int x;
+-- >   } anon'x;
+-- > };
+--
+withImplicitFields ::
+     forall m l. (
+       MonadIO m
+     )
+  => EnclosingObject
+  -> Inputs l
+  -> m Outputs
+withImplicitFields encObj inputs = do
+    resultsE <- runM $ mapM getImplicitField' classifications.candidates
+    case resultsE of
+      Left e -> pure OutputFail {
+          exception = e
+        }
+      Right implicitFields -> pure OutputSuccess {
+          fields =
+              fmap (.numberee)
+            $ sortOn (.number)
+            $ fmap (fmap C.FieldRegular) classifications.regularFields
+                ++ fmap (fmap C.FieldImplicit) implicitFields
+        }
+  where
+    classifications = classifyInputs inputs
+
+    getImplicitField' ::
+        Numbered (C.Decl l Parse)
+      -> M m (Numbered (C.ImplicitField Parse))
+    getImplicitField' decl =
+        Numbered decl.number <$> getImplicitField encObj decl.numberee
+
+{-------------------------------------------------------------------------------
+  Inputs classification
+-------------------------------------------------------------------------------}
+
+data Classification l = Classification {
+    -- | Parsed regular fields
+    regularFields :: [Numbered (C.RegularField Parse)]
+    -- | Candidates for implicit fields
+  , candidates    :: [Numbered (C.Decl l Parse)]
+  }
+
+-- | Declarations are numbered so that we can sort them in the order that they
+-- were parsed
+data Numbered a = Numbered {
+    number   :: Int
+  , numberee :: a
+  }
+  deriving stock (Functor, Foldable, Traversable)
+
+classifyInputs :: forall l. Inputs l -> Classification l
+classifyInputs inputs = Classification {
+      regularFields = regularFields
+    , candidates = candidates
+    }
+  where
+    -- | Number all the declarations so that we can re-sort them at the end of
+    -- the algorithm
+    membersNumbered ::
+      [Numbered (Either (C.Decl l Parse) (C.RegularField Parse))]
+    membersNumbered = zipWith Numbered [0..] inputs.nestedDecls
+    nestedDecls :: [Numbered (C.Decl l Parse)]
+    regularFields :: [Numbered (C.RegularField Parse)]
+    (nestedDecls, regularFields) = partitionEithers $ fmap numberedIn membersNumbered
+
+    -- | A struct\/union declaration requires an implicit field if the
+    -- declaration is anonymous, and if we have not already created an implicit
+    -- field for that declaration
+    candidates :: [Numbered (C.Decl l Parse)]
+    candidates = [
+          decl
+        | let decls = fmap (.numberee) nestedDecls
+              fields = fmap (.numberee) regularFields
+        , decl <- nestedDecls
+        , isAnon decl.numberee
+        , not (isReferenced decl.numberee fields decls)
+        ]
+
+numberedIn :: Numbered (Either a b) -> Either (Numbered a) (Numbered b)
+numberedIn x = bimap (Numbered x.number) (Numbered x.number) x.numberee
+
+-- | Check if a target declaration is anonymous with respect to an enclosing
+-- object.
+isAnon :: C.Decl l Parse -> Bool
+isAnon decl = case decl.kind of
+    C.DeclStruct struct -> struct.ann.isAnon
+    C.DeclUnion  union  -> union.ann.isAnon
+    _                   -> False
+
+-- | Check if a target declaration is referenced by any fields, nested structs,
+-- or nested unions.
+--
+-- Note: the nested structs and unions should include implicit fields.
+isReferenced ::
+     C.Decl l Parse
+     -- | Fields that are declared directly in the enclosing object
+  -> [C.RegularField Parse]
+     -- | Struct and union declarations (recursively) nested in the enclosing
+     -- object
+  -> [C.Decl l Parse]
+  -> Bool
+isReferenced decl fields decls =
+       decl.info.id `elem` map fst (concatMap depsOfRegularField fields)
+    || decl.info.id `elem` map fst (concatMap depsOfStructOrUnion decls)
+  where
+    depsOfStructOrUnion d = case d.kind of
+        C.DeclStruct struct -> depsOfStruct struct
+        C.DeclUnion  union  -> depsOfUnion  union
+        _ -> []
+
+{-------------------------------------------------------------------------------
+  Implicit field
+-------------------------------------------------------------------------------}
+
+-- | Generate an implicit field for an anonymous object
+getImplicitField ::
+     forall m l. (
+       MonadIO m
+     )
+     -- | The enclosing object
+  => EnclosingObject
+     -- | An anonymous object nested in the enclosing object
+  -> C.Decl l Parse
+  -> M m (C.ImplicitField Parse)
+getImplicitField encObj decl = do
+    candFields <- getCandidateFields encObj decl
+    candFieldsNE <- liftEither $ checkNonEmpty candFields
+    -- We do not assume that the fields are ordered in any way, hence we use
+    -- 'minimumBy' on the raw offset to determine which candidate field is the
+    -- first in source order. We need to know which field is first so that we
+    -- can use that field's name as the implicit field's name as well.
+    let minCandField = minimumBy (\x y -> compare x.rawOffset y.rawOffset) candFieldsNE
+    indFields <- getIndirectFields encObj decl minCandField.typRef
+    pure C.ImplicitField {
+        info = minCandField.info
+      , typRef = minCandField.typRef
+      , offset = minCandField.offset
+      , indirect = indFields
+      , ann = minCandField.ann
+      }
+  where
+    checkNonEmpty :: [a] -> Either ParseImplicitFieldsMsg (NonEmpty a)
+    checkNonEmpty xs = case NonEmpty.nonEmpty xs of
+        Nothing -> Left UnsupportedEmptyAnon
+        Just ys -> Right ys
+
+{-------------------------------------------------------------------------------
+  Candidate implicit field
+-------------------------------------------------------------------------------}
+
+getCandidateFields ::
+     forall m l. (
+       MonadIO m
+     )
+     -- | The enclosing object
+  => EnclosingObject
+     -- | An anonymous object nested in the enclosing object
+  -> C.Decl l Parse
+  -> M m [CandidateField Parse]
+getCandidateFields encObj decl = forM fields $ \field ->
+    getCandidateField encObj decl field
+  where
+    fields :: [C.Field Parse]
+    fields = case decl.kind of
+        C.DeclStruct struct -> struct.fields
+        C.DeclUnion  union  -> union.fields
+        _ -> []
+
+getCandidateField ::
+     forall m l. (
+       MonadIO m
+     )
+     -- | The enclosing object
+  => EnclosingObject
+     -- | An anonymous object nested in the enclosing object
+  -> C.Decl l Parse
+     -- | A field of the anonymous object
+  -> C.Field Parse
+  -> M m (CandidateField Parse)
+getCandidateField encObj decl field = do
+    offsetOuter <- offsetOf encObj origin
+    pure $ mkCandidateField offsetOuter
+  where
+    -- | When the field is implicit and we want to ask for its offset using its
+    -- name, then we should ask for the offset to an regular field of the
+    -- referenced anonymous object instead.
+    --
+    -- Implicit fields are generated by @hs-bindgen@ and therefore not present in
+    -- the header file. As such, when 'offsetOf' is used to ask @libclang@ what the
+    -- offset of a field is with respect to an enclosing object, then we have to be
+    -- careful with implicit field names. @libclang@ won't recognise the implicit
+    -- field names.
+    origin = C.elimField (.info.name) (.ann.field) field
+
+    mkCandidateField :: Int -> CandidateField Parse
+    mkCandidateField offset = CandidateField {
+          info = C.FieldInfo {
+                loc = decl.info.loc
+              , name = C.ScopedName ("anon'" <> field.info.name.text)
+              , comment = ()
+              }
+        , typRef = C.AnonRef decl.info.id
+          -- The offset to the implicit field is equal to the offset to any of
+          -- the nested object's fields with respect to the enclosing object,
+          -- subtracted by the offset of that same field with respect to the
+          -- nested object.
+        , offset = offset - field.offset
+        , ann = Origin.FieldOrigin origin
+        , rawOffset = offset
+        }
+
+-- | A candidate implicit field
+data CandidateField p = CandidateField {
+      info   :: C.FieldInfo p
+    , typRef :: C.AnonRef p
+    , offset :: Int
+    , ann    :: Origin.FieldOrigin
+      -- | The offset of the original field with respect to the nested object
+    , rawOffset :: Int
+    }
+
+{-------------------------------------------------------------------------------
+  Indirect fields
+-------------------------------------------------------------------------------}
+
+getIndirectFields ::
+     forall m l. (
+       MonadIO m
+     )
+     -- | The enclosing object
+  => EnclosingObject
+     -- | An anonymous object nested in the enclosing object
+  -> C.Decl l Parse
+  -> C.AnonRef Parse
+  -> M m [C.IndirectField Parse]
+getIndirectFields encObj decl anonRef =
+    forM candidateFields $ getIndirectField encObj decl anonRef
+  where
+    -- | Non-implicit fields are candidates
+    --
+    -- We do not generate indirect fields for implicit fields because that would
+    -- violate the invariant that untagged structs and unions can only be
+    -- referenced by a single field (the implicit field).
+    candidateFields :: [Either (C.RegularField Parse) (C.IndirectField Parse)]
+    candidateFields = case decl.kind of
+        C.DeclStruct struct -> concatMap isCandidateField struct.fields
+        C.DeclUnion  union  -> concatMap isCandidateField union.fields
+        _ -> []
+
+    isCandidateField :: C.Field Parse -> [Either (C.RegularField Parse) (C.IndirectField Parse)]
+    isCandidateField = \case
+      C.FieldRegular  field -> [Left field]
+      C.FieldImplicit field -> fmap Right field.indirect
+
+getIndirectField ::
+     forall m l. (
+       MonadIO m
+     )
+     -- | The enclosing object
+  => EnclosingObject
+     -- | An anonymous object nested in the enclosing object
+  -> C.Decl l Parse
+  -> C.AnonRef Parse
+     -- | A /non-implicit/ field of the anonymous object
+  -> Either (C.RegularField Parse) (C.IndirectField Parse)
+  -> M m (C.IndirectField Parse)
+getIndirectField encObj _decl anonRef field = do
+    offsetOuter <- offsetOf encObj fieldName
+    pure $ mkIndirectField offsetOuter
+  where
+    fieldName = either (.info.name) (.info.name) field
+
+    mkIndirectField :: Int ->C.IndirectField Parse
+    mkIndirectField offset = C.IndirectField {
+          info = either (.info) (.info) field
+        , typ =  either (.typ) (.typ) field
+        , offset = offset
+        , width =  either (.width) (.width) field
+        , path = either (const [anonRef]) ((anonRef:) . (.path)) field
+        , ann = either (.ann) (.ann) field
+        }
+
+{-------------------------------------------------------------------------------
+  Field offset
+-------------------------------------------------------------------------------}
+
+newtype EnclosingObject = EnclosingObject { typ :: CXType }
+  deriving stock Show
+
+-- | Get the offset of a named field with respect to an enclosing object.
+--
+-- If the named field is *not* an (indirect) field of the enclosing object, then
+-- an 'UnexpectedClangOffsetOfException' exception is returned. Otherwise, a
+-- t'FieldOffset' is returned.
+offsetOf ::
+     MonadIO m
+  => EnclosingObject
+  -> ScopedName Parse
+  -> M m Int
+offsetOf encObj name = do
+    offsetE <- liftIO $ try @CallFailed $ clang_Type_getOffsetOf encObj.typ fieldName
+    case offsetE of
+      Left e
+        -> throwError (UnexpectedClangOffsetOfException name.text (show e))
+      Right offset
+        -> pure (fromIntegral offset)
+  where
+    fieldName = Text.unpack name.text
+
+{-------------------------------------------------------------------------------
+  Monad
+-------------------------------------------------------------------------------}
+
+-- | A monad @m@ with exceptions of type 'ParseImplicitFieldsMsg'
+newtype M m a = M (ExceptT ParseImplicitFieldsMsg m a)
+  deriving newtype (Functor, Applicative, Monad, MonadIO, MonadError ParseImplicitFieldsMsg)
+
+runM :: M m a -> m (Either ParseImplicitFieldsMsg a)
+runM (M m) = runExceptT m
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/Macro.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/Macro.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/Macro.hs
@@ -0,0 +1,84 @@
+-- | Parse functions related to reparsing
+module HsBindgen.Frontend.Pass.Parse.Decl.Macro (
+    getReparseInfo
+  ) where
+
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types (MultiLoc (..), Range (..), RealPath,
+                              SingleLoc (..))
+import Clang.LowLevel.Core (CXCursor, CXFile, CXSourceRange, CXTranslationUnit,
+                            clang_getCursorExtent, clang_getExpansionLocation,
+                            clang_getLocation, clang_getRange,
+                            clang_getRangeStart)
+
+import HsBindgen.Frontend.Pass.Parse.IsPass (ReparseInfo (..), Tokens)
+import HsBindgen.Frontend.Pass.Parse.Monad.Decl (ParseDecl, getMacroExpansions,
+                                                 getMacroExpansionsAt,
+                                                 getTranslationUnit)
+import HsBindgen.Macro.Syntax (MacroInvocation (..))
+
+
+-- | Do we need to reparse a declaration because it contains macros that were
+-- expanded? If so, what are the original tokens of the declaration before
+-- macro expansion?
+--
+-- See "Reparsing: the source range of a declaration" in @dev/macros.md@.
+getReparseInfo :: CXCursor -> ParseDecl (ReparseInfo Tokens)
+getReparseInfo = \curr -> do
+    range <- getFileRange =<< HighLevel.clang_getCursorExtent curr
+    macroExpansionsMay <- getMacroExpansions range
+    case macroExpansionsMay of
+      Nothing -> pure ReparseNotNeeded
+      Just macroExpansions -> do
+        unit   <- getTranslationUnit
+        -- An expansion location always lies in a file: the bodies of @-D@
+        -- macros in the predefines buffer cannot contain declarations.
+        (file, _, _, _) <- clang_getExpansionLocation
+                             =<< clang_getRangeStart
+                             =<< clang_getCursorExtent curr
+        tokens <- HighLevel.clang_tokenize unit =<< toSourceRange unit file range
+        pure $ ReparseNeeded tokens macroExpansions
+
+-- | The range a declaration occupies in its file
+--
+-- A declaration starting with a macro, such as the field @T x;@ after
+-- @#define T int@, starts in the macro definition; the expansion location is
+-- the invocation @T@. The same holds for an end in a macro body.
+--
+-- A declaration ending in a macro argument, such as @T f PARAMS((T a))@ after
+-- @#define PARAMS(args) args@, ends in the file, inside the invocation, and the
+-- expansion location is the /start/ of the invocation; we extend the range to
+-- its end. Only then does the range contain the invocations nested in the
+-- argument.
+getFileRange :: Range (MultiLoc RealPath) -> ParseDecl (Range (SingleLoc RealPath))
+getFileRange extent = case extent.rangeEnd.multiLocFile of
+    -- 'Nothing' if the file location equals the expansion location, which holds
+    -- outside macro arguments, or if it has no real path
+    Nothing -> pure expansion
+    Just _  -> do
+      invocationsMay <- getMacroExpansionsAt expansion.rangeEnd
+      pure $ case invocationsMay of
+        Nothing          -> expansion
+        Just invocations -> expansion{
+            rangeEnd = maximum $ invocationEnd <$> invocations
+          }
+  where
+    expansion :: Range (SingleLoc RealPath)
+    expansion = multiLocExpansion <$> extent
+
+    invocationEnd :: MacroInvocation -> SingleLoc RealPath
+    invocationEnd invocation = invocation.locRange.rangeEnd.multiLocExpansion
+
+-- | Convert a range in the given file to a 'CXSourceRange'
+toSourceRange ::
+     CXTranslationUnit
+  -> CXFile
+  -> Range (SingleLoc RealPath)
+  -> ParseDecl CXSourceRange
+toSourceRange unit file range = do
+    let toLocation loc = clang_getLocation unit file
+          (fromIntegral loc.singleLocLine)
+          (fromIntegral loc.singleLocColumn)
+    start <- toLocation range.rangeStart
+    end   <- toLocation range.rangeEnd
+    clang_getRange start end
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/Members.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/Members.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Decl/Members.hs
@@ -0,0 +1,164 @@
+-- | Parse functions related to struct and union members
+module HsBindgen.Frontend.Pass.Parse.Decl.Members (
+    ParseMembersResult (..)
+  , parseMembersWith
+  ) where
+
+import Data.Either (partitionEithers)
+import Data.List.NonEmpty qualified as NE
+
+import Clang.Enum.Simple (fromSimpleEnum)
+import Clang.HighLevel.Types (Fold, FoldException (exception), Next,
+                              foldContinueWith, foldRecurseWith, foldTry)
+import Clang.LowLevel.Core (CXCursor, CXCursorKind (CXCursor_FieldDecl), CXType,
+                            clang_getCursorKind)
+
+import HsBindgen.Frontend.Pass.Parse.Context (ExceptionInCtx (exception),
+                                              ParseCtx)
+import HsBindgen.Frontend.Pass.Parse.Decl.Field (regularFieldDecl)
+import HsBindgen.Frontend.Pass.Parse.Decl.ImplicitFields qualified as IFields
+import HsBindgen.Frontend.Pass.Parse.IsPass (Parse)
+import HsBindgen.Frontend.Pass.Parse.Monad.Decl (ParseDecl)
+import HsBindgen.Frontend.Pass.Parse.Msg (DelayedParseMsg (ParseImplicitFieldFailed, ParseNestedDeclsFailed))
+import HsBindgen.Frontend.Pass.Parse.Result (ParseResult,
+                                             getParseResultEitherDecl)
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro.Type qualified as Macro
+
+-- NOTE: this is a copy of 'HsBindgen.Frontend.Pass.Parse.Decl.Parser' for
+-- internal use to prevent cyclic module dependencies
+type Parser l = CXCursor -> ParseDecl (Next ParseDecl [ParseResult l Parse])
+
+-- | The result of parsing the members of a struct\/union
+data ParseMembersResult l = ParseMembersResult {
+      -- | Nested object declarations (i.e., structs and unions)
+      declMembers  :: [ParseResult l Parse]
+      -- | Field declarations
+      --
+      -- Returns 'Left' if any nested struct\/union declarations or field
+      -- declarations failed to be parsed. Returns 'Right' otherwise.
+    , fieldMembers :: Either DelayedParseMsg [C.Field Parse]
+    }
+
+deriving stock instance (Macro.HasTypes l)
+  => Show (ParseMembersResult l)
+
+-- | Parse all members of a struct\/union
+parseMembersWith ::
+     -- | Type of the enclosing object
+     CXType
+  -> ParseCtx
+     -- | How to parse a non-field declaration (e.g., a union or struct
+     -- declaration)
+  -> (ParseCtx -> Parser l)
+     -- | How to continue with the result of parsing members
+  -> (ParseMembersResult l -> ParseDecl a)
+  -> ParseDecl (Next ParseDecl a)
+parseMembersWith ty ctx parseObject k =
+    foldRecurseWith (parseMember ctx parseObject) $ \xs -> do
+      let (foldExceptions, allDecls, fails, successes) = partitionParseMemberResults xs
+          -- Always return all nested declarations, regardless of their parse
+          -- status. The @Select@ pass wil handle deselecting declarations if
+          -- necessary.
+          declMembers = allDecls
+      if
+        -- If any nested declarations failed to parse, then we can't parse the
+        -- current declaration for fear of missing (implicit) fields.
+        | not (null fails)
+        -> k ParseMembersResult {
+                declMembers = declMembers
+              , fieldMembers = Left ParseNestedDeclsFailed
+              }
+        -- If any exceptions occurred during folding, only return the first one
+        | Just foldExceptions' <- NE.nonEmpty foldExceptions
+        -> k ParseMembersResult {
+                declMembers = declMembers
+              , fieldMembers = Left (NE.head foldExceptions').exception.exception
+              }
+        -- Local declarations inside structs\/unions that are not used by any
+        -- fields result in implicit fields. Unfortunately, @libclang@ does
+        -- not make these visible
+        -- <https://github.com/llvm/llvm-project/issues/122257>. This matters,
+        -- because we need the offsets of these implicit fields. For now we
+        -- therefore only try to detect the situation and report an error when
+        -- it happens. Hopefully this is anyway very rare.
+        --
+        -- Implicit fields might exist for fields of nested anonymous
+        -- structs\/unions that failed to parse. At this point, we have already
+        -- checked that there are no failed parses. So all nested anonymous
+        -- structs\/unions were parsed successfully, and we can properly detect
+        -- implicit fields using 'IFields.withImplicitFields'.
+        | otherwise
+        -> do -- From the regular members, derive implicit fields and include them in
+              -- the list of members
+              members <- IFields.withImplicitFields (IFields.EnclosingObject ty) successes
+              k $ case members of
+                -- Some implicit fields were not successfully detected. It is unsafe
+                -- to return an incomplete list of implicit and regular fields, so we
+                -- return a failure message instead.
+                IFields.OutputFail exc ->
+                  ParseMembersResult {
+                      declMembers = declMembers
+                    , fieldMembers = Left (ParseImplicitFieldFailed exc)
+                    }
+                IFields.OutputSuccess fields ->
+                  ParseMembersResult {
+                      declMembers = declMembers
+                    , fieldMembers = Right fields
+                    }
+
+-- | The result of parsing a single member of a struct\/union
+data ParseMemberResult l =
+    ParseMemberResultFoldException (FoldException (ExceptionInCtx DelayedParseMsg))
+  | ParseMemberResultDecls [ParseResult l Parse]
+  | ParseMemberResultField (C.RegularField Parse)
+
+partitionParseMemberResults ::
+     [ParseMemberResult l]
+  -> ( [FoldException (ExceptionInCtx DelayedParseMsg)]
+     , [ParseResult l Parse]  -- ^ All parse results
+     , [ParseResult l Parse]  -- ^ Only parse failures
+     , IFields.Inputs l -- ^ Only parse successes
+     )
+partitionParseMemberResults = mconcat . fmap f
+  where
+    f = \case
+          ParseMemberResultFoldException e ->
+                ([e], [], [], IFields.inputEmpty)
+          ParseMemberResultDecls xs ->
+            let (fails, successes) = partitionEithers $ map getParseResultEitherDecl xs
+            in  ( []
+                , xs
+                , fails
+                , mconcat $ map IFields.inputDecl successes
+                )
+          ParseMemberResultField x ->
+                ([], [], [], IFields.inputField x)
+
+-- | Parse a single member of a struct\/union
+parseMember ::
+     ParseCtx
+     -- | How to parse a non-field declaration (e.g., a union or struct
+     -- declaration)
+  -> (ParseCtx -> Parser l)
+  -> Fold ParseDecl (ParseMemberResult l)
+parseMember ctx parseObject =
+    fmap flatten $
+    foldTry $ \curr -> do
+      kind <- fromSimpleEnum <$> clang_getCursorKind curr
+      case kind of
+        Right CXCursor_FieldDecl -> do
+          field <- regularFieldDecl ctx curr
+          -- Field declarations can have struct\/union declarations as children in
+          -- the clang AST; however, those are duplicates of declarations that
+          -- appear elsewhere, so here we choose not to recurse.
+          foldContinueWith $ ParseMemberResultField field
+        _otherwise -> do
+          fmap ParseMemberResultDecls <$> parseObject ctx curr
+  where
+    flatten ::
+         Either (FoldException (ExceptionInCtx DelayedParseMsg)) (ParseMemberResult l)
+      -> ParseMemberResult l
+    flatten = \case
+        Left e -> ParseMemberResultFoldException e
+        Right x -> x
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/IsPass.hs
@@ -0,0 +1,175 @@
+module HsBindgen.Frontend.Pass.Parse.IsPass (
+    Parse
+    -- * Configuration
+  , EmptyMacros(..)
+    -- * Macros
+  , ReparseInfo(..)
+  , invokedMacros
+  , Tokens
+    -- * Fields
+  , FieldOrigin(..)
+    -- * IsAnon
+  , IsAnon(..)
+  ) where
+
+import Data.Set qualified as Set
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Syntax (MacroInvocation (name))
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type Parse :: Pass
+data Parse a
+
+type family AnnParse (ix :: Symbol) :: Star where
+  AnnParse "Function"      = ReparseInfo Tokens
+  AnnParse "Global"        = ReparseInfo Tokens
+  AnnParse "ImplicitField" = FieldOrigin
+  AnnParse "IndirectField" = ReparseInfo Tokens
+  AnnParse "RegularField"  = ReparseInfo Tokens
+  AnnParse "Struct"        = IsAnon
+  AnnParse "Typedef"       = ReparseInfo Tokens
+  AnnParse "Union"         = IsAnon
+  AnnParse _               = NoAnn
+
+instance IsPass Parse
+
+instance PassId Parse where
+  type Id Parse = C.PrelimDeclId
+
+  idNameKind     _ = C.prelimDeclIdNameKind
+  idSourceName   _ = C.prelimDeclIdSourceName
+  idLocationInfo _ = C.prelimDeclIdLocationInfo
+
+instance PassScopedName Parse
+
+instance PassTypes Parse
+
+instance PassMacro Parse where
+  type MacroBody Parse = Macro.Unresolved
+
+instance PassExtBinding Parse
+
+instance PassCommentDecl Parse
+
+instance PassAnn Parse where
+  type Ann ix Parse = AnnParse ix
+
+instance PassMsg Parse where
+  type Msg Parse = C.WithLocationInfo ImmediateParseMsg
+
+{-------------------------------------------------------------------------------
+  Configuration
+-------------------------------------------------------------------------------}
+
+-- | Parse macros with an empty replacement list?
+--
+-- Whether @hs-bindgen@ parses and translates empty macros such as
+--
+-- @#define FOO@.
+--
+-- Some macro languages such as 'HsBindgen.Macro.Raw' can handle empty macros,
+-- the default macro language 'HsBindgen.Macro.CExpr' has no expression to
+-- translate and declines empty macros.
+--
+-- Include guards are empty macros, so by default @hs-bindgen@ does not attempt
+-- to parse an empty macro at all.
+data EmptyMacros =
+    -- | Pass empty macros to the macro language
+    ParseEmptyMacros
+
+    -- | Do not attempt to parse empty macros
+  | DoNotParseEmptyMacros
+  deriving stock (Show, Eq)
+
+instance Default EmptyMacros where
+  def :: EmptyMacros
+  def = DoNotParseEmptyMacros
+
+{-------------------------------------------------------------------------------
+  Macros
+-------------------------------------------------------------------------------}
+
+data ReparseInfo tokens =
+    -- | We need to reparse this declaration (to deal with macros)
+    --
+    -- We do not use this for macro declarations _themselves_ (see
+    -- 'ParsedMacro').
+    ReparseNeeded
+      tokens
+      -- ^ Original tokens of declaration without macro expansions
+      (NonEmpty MacroInvocation)
+      -- ^ Expanded macros
+
+    -- | This declaration does not use macros, so no need to reparse
+  | ReparseNotNeeded
+  deriving stock (Show, Eq, Ord)
+
+-- | Names of expanded macros
+invokedMacros :: NonEmpty MacroInvocation -> Set Text
+invokedMacros = foldl' (\acc inv -> Set.insert inv.name acc) Set.empty
+
+type Tokens = [Token SourcePath TokenSpelling]
+
+{-------------------------------------------------------------------------------
+  Fields
+-------------------------------------------------------------------------------}
+
+-- | The field name used to compute the offset for an implicit field referencing
+-- an anonymous struct\/union.
+--
+-- We track this information because @libclang@ does not expose information
+-- about implicit fields, so we have to derive the information ourselves using a
+-- custom algorithm. See the "HsBindgen.Frontend.Pass.Parse.Decl.ImplicitFields"
+-- module for the algorithm.
+data FieldOrigin = FieldOrigin {
+    -- | The name of the first field of the anonymous struct\/union
+    --
+    -- The offset from the enclosing object to an anonymous struct\/union is
+    -- equal to the offset from the enclosing object to the first field of the
+    -- anonymous struct or union. The first field can be a regular field, or
+    -- an implicit field if there are multiple levels of nested anonymous
+    -- structs/unions. Indirect fields are ignored.
+    --
+    -- The field that we record should be one that @libclang@ recognizes. Names
+    -- for implicit fields are generated by @hs-bindgen@, so we should use an
+    -- equivalent stand-in for them:
+    --
+    -- * If the first field is a regular field, then we record its name in
+    --   'field'.
+    --
+    -- * If the first field is an implicit field, then we record in 'field' the
+    --   name of the first field of the referenced anonymous struct\/union. This
+    --   process repeats if that first field is again an implicit field.
+    --
+    -- Example:
+    --
+    -- > struct S {
+    -- >   struct { // anonymous struct T
+    -- >     struct { // anonymous struct U
+    -- >       int x; // regular field x
+    -- >     }; // implicit field referencing U with field origin x
+    -- >   }; // implicit field referencing T with field origin x
+    -- > };
+    --
+    field :: C.ScopedName
+  }
+  deriving stock (Show, Eq, Ord)
+
+{-------------------------------------------------------------------------------
+  IsAnon
+-------------------------------------------------------------------------------}
+
+-- | A struct or union is anonymous if it is untagged and if it is referenced by
+-- a single unnamed field.
+newtype IsAnon = IsAnon { isAnon :: Bool }
+  deriving stock (Show, Eq, Ord)
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Monad/Decl.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Monad/Decl.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Monad/Decl.hs
@@ -0,0 +1,282 @@
+-- | Monad for parsing declarations
+--
+-- Intended for unqualified import (unless context is unambiguous).
+--
+-- > import HsBindgen.Frontend.Pass.Parse.Monad.Decl (ParseDecl)
+-- > import HsBindgen.Frontend.Pass.Parse.Monad.Decl qualified as ParseDecl
+module HsBindgen.Frontend.Pass.Parse.Monad.Decl (
+    -- * Definition
+    ParseDecl
+  , Env (..)
+  , run
+    -- * Functionality
+    -- ** "Reader"
+  , getTranslationUnit
+  , getEmptyMacros
+  , evalGetMainHeadersAndInclude
+    -- ** "State"
+  , recordMacroDefinition
+  , getMacroDefinitions
+  , recordMacroExpansionAt
+  , getMacroExpansions
+  , getMacroExpansionsAt
+    -- ** Logging
+  , traceImmediate
+  , traceImmediateGlobal
+    -- ** Errors
+  , parseFail
+  , parseFailNoInfo
+  ) where
+
+import Data.IORef
+
+import Clang.HighLevel.Types
+import Clang.LowLevel.Core
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Eff
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis.IncludeGraph qualified as IncludeGraph
+import HsBindgen.Frontend.Pass.Parse.Builtin
+import HsBindgen.Frontend.Pass.Parse.Context
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.Parse.Monad.SourceRangeMap (LookupResult (..),
+                                                           SourceRangeMap,
+                                                           initSourceRangeMap,
+                                                           lookupAt,
+                                                           lookupRange,
+                                                           recordAt)
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Frontend.ProcessIncludes
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Error (MacroParseError)
+import HsBindgen.Macro.Syntax (MacroDefinition (..), MacroInvocation (..))
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+
+  We are careful to distinguish between the state that the computation can
+  depend on ('MacroExpansions') and the additional output that generate during
+  parsing but that cannot otherwise affect the computation ('IncludeGraph').
+-------------------------------------------------------------------------------}
+
+-- | Monad used during folding
+type ParseDecl = Eff ParseDeclMonad
+
+data ParseDeclMonad a
+
+-- | Support for 'ParseDecl' (internal type, not exported)
+data ParseSupport = ParseSupport {
+      env   :: Env              -- ^ Reader
+    , state :: IORef ParseState -- ^ State
+    }
+
+type instance Support ParseDeclMonad = ParseSupport
+
+run :: Env -> ParseDecl a -> IO a
+run env f = do
+    support <- ParseSupport env <$> newIORef initParseState
+    unwrapEff f support
+
+{-------------------------------------------------------------------------------
+  "Reader"
+-------------------------------------------------------------------------------}
+
+data Env = Env {
+      unit                     :: CXTranslationUnit
+    , getMainHeadersAndInclude :: GetMainHeadersAndInclude
+    , emptyMacros              :: EmptyMacros
+    , tracer                   :: Tracer (Msg Parse)
+    }
+
+getTranslationUnit :: ParseDecl CXTranslationUnit
+getTranslationUnit = wrapEff $ \support -> return support.env.unit
+
+getEmptyMacros :: ParseDecl EmptyMacros
+getEmptyMacros = wrapEff $ \support -> return support.env.emptyMacros
+
+evalGetMainHeadersAndInclude ::
+     RealPath
+  -> ParseDecl
+      (Either DelayedParseMsg
+        (NonEmpty C.HashIncludeArg, IncludeGraph.Include))
+evalGetMainHeadersAndInclude realPath = wrapEff $ \support ->
+    pure $
+      first (\err -> ParseNoMainHeadersException err realPath) $
+      support.env.getMainHeadersAndInclude realPath
+
+{-------------------------------------------------------------------------------
+  "State"
+-------------------------------------------------------------------------------}
+
+data ParseState = ParseState {
+      -- | Macro definitions
+      --
+      -- Once parsing is done, macro definitions are analysed for ambiguity; see
+      -- "HsBindgen.Macro.UniqueExpansion".
+      macroDefinitions :: [MacroDefinition]
+      -- | Where did Clang expand macros, and what are their names?
+      --
+      -- Declarations with expanded macros need to be reparsed.
+    , macroExpansions :: SourceRangeMap MacroInvocation
+    }
+  deriving (Generic)
+
+initParseState :: ParseState
+initParseState = ParseState{
+      macroDefinitions = []
+    , macroExpansions = initSourceRangeMap
+    }
+
+getParseState :: ParseDecl ParseState
+getParseState = wrapEff $ \support -> readIORef support.state
+
+modifyParseState :: (ParseState -> ParseState) -> ParseDecl ()
+modifyParseState f = wrapEff $ \support -> modifyIORef support.state f
+
+recordMacroDefinition ::
+     Text
+  -> Either MacroParseError (Runtime.Macro.Raw (Token SourcePath TokenSpelling))
+  -> ParseDecl ()
+recordMacroDefinition macroName macro =
+    modifyParseState $ #macroDefinitions %~ (macroDefinition:)
+  where
+    macroDefinition :: MacroDefinition
+    macroDefinition = MacroDefinition {
+          name  = macroName
+        , macro = macro
+        }
+
+getMacroDefinitions :: ParseDecl [MacroDefinition]
+getMacroDefinitions = reverse . (.macroDefinitions) <$> getParseState
+
+recordMacroExpansionAt ::
+     Text
+  -> Range (MultiLoc RealPath)
+  -> [Token SourcePath TokenSpelling]
+  -> ParseDecl ()
+recordMacroExpansionAt macroName locRange tokens =
+    modifyParseState $ #macroExpansions %~ recordAt loc macroInvocation
+  where
+    macroInvocation :: MacroInvocation
+    macroInvocation = MacroInvocation {
+          name = macroName
+        , locRange = locRange
+        , tokens = tokens
+        }
+
+    loc :: SingleLoc RealPath
+    loc = locRange.rangeStart.multiLocExpansion
+
+-- | The macro invocations starting in the given half-open range
+getMacroExpansions :: Range (SingleLoc RealPath) -> ParseDecl (Maybe (NonEmpty MacroInvocation))
+getMacroExpansions range = do
+    macroExpansions <- (.macroExpansions) <$> getParseState
+    case lookupRange range macroExpansions of
+      -- We do not support getting macro expansions for declarations spanning
+      -- multiple files.
+      LookupErrorMultipleFiles -> do
+        traceImmediateGlobal (ParseGetMacroExpansionsMultipleFiles range)
+        pure Nothing
+      LookupNotFound ->
+        pure Nothing
+      LookupFound macroInvocations ->
+        pure $ Just macroInvocations
+
+-- | The macro invocations starting at the given location
+getMacroExpansionsAt :: SingleLoc RealPath -> ParseDecl (Maybe (NonEmpty MacroInvocation))
+getMacroExpansionsAt loc = lookupAt loc . (.macroExpansions) <$> getParseState
+
+{-------------------------------------------------------------------------------
+  Logging
+-------------------------------------------------------------------------------}
+
+-- | Immediately emit a parse trace message with location information
+traceImmediate ::
+     HasCallStack
+  => C.PrelimDeclId
+  -> SingleLoc C.DeclPath
+  -> ImmediateParseMsg
+  -> ParseDecl ()
+traceImmediate declId declLoc msg = wrapEff $ \support ->
+    traceWith support.env.tracer $
+      withCallStack C.WithLocationInfo{
+        loc = C.prelimDeclIdLocationInfo declId [declLoc]
+      , msg = msg
+      }
+
+-- | Immediately emit a global parse trace message without location information
+traceImmediateGlobal :: HasCallStack => ImmediateParseMsg -> ParseDecl ()
+traceImmediateGlobal msg = wrapEff $ \support ->
+    traceWith support.env.tracer $
+      withCallStack C.WithLocationInfo{
+        loc = C.LocationUnavailable
+      , msg = msg
+      }
+
+{-------------------------------------------------------------------------------
+  Errors
+-------------------------------------------------------------------------------}
+
+-- | Record a parse failure
+--
+-- In contrast to 'parseSucceed' and 'parseDoNotAttempt', this is a monadic
+-- action: It checks for immediate parse messages that should be
+-- emitted directly.
+parseFail ::
+     ParseCtx
+  -> C.PrelimDeclId
+  -> SingleLoc C.DeclPath
+  -> DelayedParseMsg
+  -> ParseDecl [ParseResult l Parse]
+parseFail ctx declId declLoc msg = do
+    maybeEmitScopingMsg ctx.outer.scoping declId declLoc
+    pure $ (:[]) $
+      ParseResult{
+          id             = declId
+        , loc            = declLoc
+        , classification = ParseResultFailure msg
+        }
+
+-- | Record a parse failure without having the declaration information readily
+--   available
+--
+-- Retrieve the information using libclang and the provided cursor.
+parseFailNoInfo ::
+     ParseCtx
+  -> DelayedParseMsg
+  -> CXCursor
+  -> ParseDecl [ParseResult l Parse]
+parseFailNoInfo ctx msg curr = do
+    (declId, declLoc) <- getDeclInfoForTrace
+    parseFail ctx declId declLoc msg
+  where
+    -- The declaration ID and the location are not always available while
+    -- parsing, and so are not part of the declaration context. We have to
+    -- obtain them again here.
+    getDeclInfoForTrace :: ParseDecl (C.PrelimDeclId, SingleLoc C.DeclPath)
+    getDeclInfoForTrace = do
+      declId  <- C.prelimDeclIdAtCursor curr ctx.outer.kind
+      source  <- getCursorSource curr
+      case source of
+        SourceDecl declLoc -> pure (declId, declLoc)
+        -- We skip built-ins before parsing them
+        SourceBuiltin      -> panicIO "parse failure in a built-in"
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1820>
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1249>
+-- Ideally we'd only emit the trace when we /use/ the declaration that
+-- we fail to parse.
+maybeEmitScopingMsg ::
+  RequiredForScoping -> C.PrelimDeclId -> SingleLoc C.DeclPath -> ParseDecl ()
+maybeEmitScopingMsg scoping declId declLoc = case scoping of
+    RequiredForScoping ->
+      traceImmediate declId declLoc $
+        ParseOfDeclarationRequiredForScopingFailed
+    NotRequiredForScoping ->
+      pure ()
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Monad/SourceRangeMap.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Monad/SourceRangeMap.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Monad/SourceRangeMap.hs
@@ -0,0 +1,110 @@
+-- | Mapping of source location ranges in C code to @a@ values
+--
+-- Intended for unqualified import (unless context is unambiguous).
+--
+-- > import HsBindgen.Frontend.Pass.Parse.Monad.SourceRangeMap
+module HsBindgen.Frontend.Pass.Parse.Monad.SourceRangeMap (
+    SourceRangeMap
+  , initSourceRangeMap
+  , recordAt
+  , LookupResult (..)
+  , lookupRange
+  , lookupAt
+  ) where
+
+import Data.List.NonEmpty (NonEmpty)
+import Data.List.NonEmpty qualified as NE
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Map.Strict (Map)
+import Data.Map.Strict qualified as Map
+import Data.Semigroup (Semigroup (sconcat))
+
+import Clang.HighLevel.Types (Range (rangeEnd, rangeStart), RealPath,
+                              SingleLoc (singleLocColumn, singleLocLine, singleLocPath))
+
+-- | Position storing @(line, column)@ so that lookups are precise to the
+-- column: two values recorded on the same line (e.g. a struct tag and a field
+-- type, both macro expansions) are attributed to the correct extent.
+--
+-- See https://github.com/well-typed/hs-bindgen/issues/2049.
+data Pos = Pos {
+    line :: Int
+  , column :: Int
+  }
+  deriving stock (Eq, Show)
+
+-- | We provide a custom 'Ord' instance because it is important to compare lines
+--   before columns!
+instance Ord Pos where
+  left `compare` right =
+       left.line   `compare` right.line
+    <> left.column `compare` right.column
+
+toPos :: SingleLoc RealPath -> Pos
+toPos loc = Pos loc.singleLocLine loc.singleLocColumn
+
+-- | Mapping of source location ranges in C code to @a@ values
+newtype SourceRangeMap a = SRM {
+    -- | We use a stacked map so we can lookup values in source location ranges
+    -- reasonably fast.
+    unwrap :: Map RealPath (Map Pos (NonEmpty a))
+  }
+
+-- | An empty 'SourceRangeMap'
+initSourceRangeMap :: SourceRangeMap a
+initSourceRangeMap = SRM Map.empty
+
+-- | Map the given location to a value of type @a@
+recordAt :: forall a. SingleLoc RealPath -> a -> SourceRangeMap a -> SourceRangeMap a
+recordAt loc new srm = SRM (addMacro srm.unwrap)
+  where
+    pos :: Pos
+    pos = toPos loc
+
+    addMacro ::
+         Map RealPath (Map Pos (NonEmpty a))
+      -> Map RealPath (Map Pos (NonEmpty a))
+    addMacro = Map.alter addMacroAtFile loc.singleLocPath
+
+    addMacroAtFile ::
+         Maybe (Map Pos (NonEmpty a))
+      -> Maybe (Map Pos (NonEmpty a))
+    addMacroAtFile = Just . \case
+      Nothing ->
+        Map.singleton pos $ NonEmpty.singleton new
+      Just posMap ->
+        Map.alter addMacroAtPos pos posMap
+
+    addMacroAtPos :: Maybe (NonEmpty a) -> Maybe (NonEmpty a)
+    addMacroAtPos = Just . \case
+      Nothing     -> NonEmpty.singleton new
+      Just macros -> NonEmpty.cons      new macros
+
+data LookupResult a =
+    -- | Ranges that span multiple files are not supported in lookups
+    LookupErrorMultipleFiles
+  | LookupNotFound
+  | LookupFound a
+
+-- | Lookup values in the given half-open source location range
+--
+-- The end of a range is exclusive: Clang reports the end of an extent as the
+-- position just after its last token, where the next token may start.
+lookupRange :: forall a. Range (SingleLoc RealPath) -> SourceRangeMap a -> LookupResult (NonEmpty a)
+lookupRange range srm
+  | range.rangeStart.singleLocPath /= range.rangeEnd.singleLocPath
+  = LookupErrorMultipleFiles
+  | otherwise
+  = maybe LookupNotFound LookupFound aux
+  where
+    aux :: Maybe (NonEmpty a)
+    aux = do
+        posMap <- Map.lookup range.rangeStart.singleLocPath srm.unwrap
+        fmap sconcat $ NE.nonEmpty $ Map.elems $
+          Map.takeWhileAntitone (toPos range.rangeEnd >) $
+            Map.dropWhileAntitone (toPos range.rangeStart >) posMap
+
+-- | Lookup values recorded at the given source location
+lookupAt :: SingleLoc RealPath -> SourceRangeMap a -> Maybe (NonEmpty a)
+lookupAt loc srm =
+    Map.lookup (toPos loc) =<< Map.lookup loc.singleLocPath srm.unwrap
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Monad/Type.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Monad/Type.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Monad/Type.hs
@@ -0,0 +1,137 @@
+-- | Monad for parsing types
+--
+-- Intended for unqualified import (unless context is unambiguous).
+--
+-- > import HsBindgen.Frontend.Pass.Parse.Monad.Type (ParseType)
+-- > import HsBindgen.Frontend.Pass.Parse.Monad.Type qualified as ParseType
+module HsBindgen.Frontend.Pass.Parse.Monad.Type (
+    ParseType -- opaque
+  , run
+    -- * Caching API
+  , lookupCache
+  , insertCache
+  , cached
+  , cachedMaybe
+    -- * Utility: dispatching
+  , dispatch
+  , dispatchWithArg
+  , dispatchDecl
+  ) where
+
+import Control.Monad.Catch
+import Control.Monad.Error.Class
+import Control.Monad.IO.Class
+import Control.Monad.State.Strict
+import Data.Map.Strict qualified as Map
+
+import Clang.Enum.Simple
+import Clang.LowLevel.Core
+
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+
+  Parsing declarations and parsing types have different requirements, so each
+  gets its own monad.
+
+  The ParseType monad includes state for caching typedef resolution to avoid
+  redundant type parsing during typedef chain resolution. The cache maps typedef
+  names to their resolved types.
+-------------------------------------------------------------------------------}
+
+newtype ParseType a = Wrap (
+      StateT (Map C.DeclName (C.Type Parse)) IO a
+    )
+  deriving newtype (
+      Functor
+    , Applicative
+    , Monad
+    , MonadIO
+    , MonadThrow
+    , MonadCatch
+    , MonadMask
+    )
+
+unwrap :: ParseType a -> StateT (Map C.DeclName (C.Type Parse)) IO a
+unwrap (Wrap ma) = ma
+
+instance MonadError DelayedParseMsg ParseType where
+  throwError err   = Wrap $ lift $ throwIO err
+  f `catchError` h = Wrap
+                   $ StateT
+                   $ \s -> catch (runStateT (unwrap f) s)
+                                 (\e -> runStateT (unwrap (h e)) s)
+
+run :: MonadIO m => ParseType a -> m a
+run = liftIO . flip evalStateT Map.empty . unwrap
+
+{-------------------------------------------------------------------------------
+  Caching API
+-------------------------------------------------------------------------------}
+
+-- | Look up a typedef in the cache
+lookupCache :: C.DeclName -> ParseType (Maybe (C.Type Parse))
+lookupCache name = Wrap $ Map.lookup name <$> get
+
+-- | Insert a typedef into the cache
+insertCache :: C.DeclName -> C.Type Parse -> ParseType ()
+insertCache name ty = Wrap $ modify' (Map.insert name ty)
+
+-- | Run a parse action with a cache.
+--
+-- On a cache hit, ignores the parse action and returns the cached value. On a
+-- cache hit, runs the parse action, caches the result, and returns the result.
+cached :: C.DeclName -> ParseType (C.Type Parse) -> ParseType (C.Type Parse)
+cached name k = do
+    -- Check cache first
+    mCachedValue <- lookupCache name
+    case mCachedValue of
+      -- Cache hit
+      Just cachedValue -> pure cachedValue
+      -- Cache miss
+      Nothing -> do
+        newValue <- k
+        insertCache name newValue
+        pure newValue
+
+-- | Like 'cached', but only uses the cache if the name argument is 'Just'.
+cachedMaybe :: Maybe C.DeclName -> ParseType (C.Type Parse) -> ParseType (C.Type Parse)
+cachedMaybe mName k =
+    case mName of
+      Nothing -> k
+      Just name -> cached name k
+
+{-------------------------------------------------------------------------------
+  Utility: dispatching based on the cursor kind
+-------------------------------------------------------------------------------}
+
+dispatch ::
+     MonadError DelayedParseMsg m
+  => CXType -> (CXTypeKind -> m a) -> m a
+dispatch curr k = do
+    let mKind = fromSimpleEnum $ cxtKind curr
+    case mKind of
+      Right kind -> k kind
+      Left  i    -> throwError $ ParseUnexpectedTypeKind (Left i)
+
+dispatchWithArg ::
+     MonadError DelayedParseMsg m
+  => CXType
+  -> (CXTypeKind -> CXType -> m a)
+  -> m a
+dispatchWithArg x f = dispatch x $ \kind -> f kind x
+
+dispatchDecl ::
+     ( MonadIO m
+     , MonadError DelayedParseMsg m
+     )
+  => CXCursor -> (CXCursorKind -> m b) -> m b
+dispatchDecl curr k = do
+    mKind <- fromSimpleEnum <$> clang_getCursorKind curr
+    case mKind of
+      Right kind -> k kind
+      Left  i    -> throwError $ ParseUnexpectedCursorKind (Left i)
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Msg.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Msg.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Msg.hs
@@ -0,0 +1,597 @@
+-- | Parse messages
+module HsBindgen.Frontend.Pass.Parse.Msg (
+    -- * Immediate parse messages
+    ImmediateParseMsg(..)
+
+    -- * Delayed parse messages
+  , DelayedParseMsg(..)
+  , UnsupportedFloatType(..)
+  , ParseImplicitFieldsMsg(..)
+  ) where
+
+import Control.Exception (Exception (..))
+import Foreign.C (CInt)
+import Text.SimplePrettyPrint ((><))
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.Enum.Simple
+import Clang.HighLevel.Types
+import Clang.LowLevel.Core
+import Clang.Paths
+
+import HsBindgen.Errors
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro.Error
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Immediate parse messages
+-------------------------------------------------------------------------------}
+
+-- | Parse messages that we emit immediately
+--
+-- Reasons for immediate emission:
+--
+-- - The info/debug message is useful to developers
+--
+-- - The declaration we fail to parse may affect other declarations
+data ImmediateParseMsg =
+    -- | We do not support getting macro expansions for declarations spanning
+    --   multiple files.
+    ParseGetMacroExpansionsMultipleFiles (Range (SingleLoc RealPath))
+
+    -- | At a macro expansion site, we failed to get the name of the expanded
+    --   macro.
+  | ParseMacroExpansionNoMacroName
+
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/1820>
+    -- | We failed to parse a declaration that is required for scoping.
+  | ParseOfDeclarationRequiredForScopingFailed
+
+    -- | Source-order indices were populated, using
+    -- 'clang_isBeforeInTranslationUnit'
+    --
+    -- Source-order indices record the order in which declarations appear in the
+    -- C source.  Populating them requires Clang >= 20.1.
+  | ParseSourceOrderPopulated
+
+    -- | Source-order indices could not be populated
+    --
+    -- 'clang_isBeforeInTranslationUnit' is not available; this requires
+    -- Clang >= 20.1.
+  | ParseSourceOrderUnavailable
+
+    -- | We failed to analyse the macro definitions for ambiguity
+    --
+    -- Either the definition could not be split, or the name of the split
+    -- definition disagrees with the name @libclang@ reported for the cursor.
+    -- The macros are treated as ambiguous.
+    --
+    -- The payload contains the names of the failed macros.
+  | ParseMacroDefinitionAnalysisFailed (NonEmpty Text)
+
+  deriving stock (Show, Eq, Ord, Generic)
+
+instance PrettyForTrace ImmediateParseMsg where
+  prettyForTrace = \case
+      ParseGetMacroExpansionsMultipleFiles range -> PP.hsep [
+          "Could not get macro expansions"
+        , "(declaration spans multiple files):"
+        , PP.show range
+        ]
+      ParseMacroExpansionNoMacroName ->
+        "Could not obtain macro name at macro expansion location"
+      ParseOfDeclarationRequiredForScopingFailed -> PP.hsep [
+          "Parse of declaration required for scoping failed;"
+        , "the failed declaration may be required when parsing"
+        , "other declarations containing macro replacements"
+        ]
+      ParseSourceOrderPopulated -> PP.hsep [
+          "Source order of declarations populated"
+        , "(requires Clang >= 20.1)"
+        ]
+      ParseSourceOrderUnavailable -> PP.hsep [
+          "Source order of declarations unavailable:"
+        , "clang_isBeforeInTranslationUnit requires Clang >= 20.1"
+        ]
+      ParseMacroDefinitionAnalysisFailed names -> PP.hsep [
+          "Failed to analyse these macro definitions for ambiguity:"
+        , PP.string (show names)
+        ]
+
+instance IsTrace Level ImmediateParseMsg where
+  getDefaultLogLevel = \case
+      ParseGetMacroExpansionsMultipleFiles{}       -> Warning
+      ParseMacroExpansionNoMacroName{}             -> Bug
+      ParseOfDeclarationRequiredForScopingFailed{} -> Info
+      ParseSourceOrderPopulated{}                  -> Info
+      ParseSourceOrderUnavailable{}                -> Info
+      ParseMacroDefinitionAnalysisFailed{}         -> Bug
+  getSource  = const HsBindgen
+  getTraceId = \case
+    ParseMacroExpansionNoMacroName       -> "parse-immediate-macro"
+    ParseMacroDefinitionAnalysisFailed{} -> "parse-immediate-macro"
+    _otherwise                           -> "parse-immediate"
+
+{-------------------------------------------------------------------------------
+  Delayed parse messages
+-------------------------------------------------------------------------------}
+
+-- Note to developers: We order delayed parse message constructors by
+-- 1. Recursive/nested constructors come first
+-- 2. Severity; debug messages come first
+-- 3. Constructor name
+
+-- | Delayed parse messages
+--
+-- We emit these parse messages only when we attempt to select the attached
+-- declaration.
+--
+-- We distinguish between \"unsupported\", which refers to C features that one
+-- could reasonably expect to be supported eventually, and \"unexpected\", for C
+-- input we are not prepared for.
+data DelayedParseMsg =
+    -- | Recursive case; we failed to parse the target of a @typedef@ with a
+    --   delayed parse message.
+    ParseUnderlyingTypeFailed C.PrelimDeclId DelayedParseMsg
+
+    -- | We tried to parse an implicit field for a struct or union object, but
+    -- it was unsuccessful
+  | ParseImplicitFieldFailed ParseImplicitFieldsMsg
+
+    -- | We did not attempt to parse a macro with an empty replacement list
+    -- (@#define FOO@)
+    --
+    -- Reported separately from 'ParseMacroErrorParse' because every include
+    -- guard has this shape, and not attempting to parse one is not a failure.
+    -- See 'HsBindgen.Frontend.Pass.Parse.IsPass.EmptyMacros'.
+  | ParseMacroEmpty C.PrelimDeclId [Token SourcePath TokenSpelling]
+
+    -- | We could not parse the macro (macro def sites)
+  | ParseMacroErrorParse MacroParseError
+
+
+    -- | Fully defined global variables and functions with external linkage.
+    --
+    -- Such definitions can lead to duplicate symbols (linker errors) if they
+    -- are included more than once in the same program. See the manual section
+    -- on globals for details.
+    --
+    -- Duplicate symbols can also exist across multiple shared libraries as long
+    -- as these symbols have public visibility. However, in such cases the
+    -- linker will pick one according to the rules of linker symbol
+    -- interposition, rather than throw a linker error. It can be surprising for
+    -- users if the linker picks an unexpected definition for the symbol they
+    -- are referencing. So, if a symbol has non-public visibility, the risk of
+    -- such surprises is mitigated somewhat. See the "Visibility" section in the
+    -- manual for more details.
+  | ParsePotentialDuplicateSymbol
+      -- | The symbol has public visibility
+      Bool
+
+    -- | Struct/union tag first declared inside a function prototype, e.g.
+    -- @void f(struct foo* arg);@
+    --
+    -- Might indicate a missing @#include@ in the header.
+  | ParseDeclarationNotVisible C.TagKind Text
+
+    -- | A function declaration was encountered where the type of the function
+    -- is typedef reference. This is not yet supported by hs-bindgen.
+    --
+    -- For example:
+    --
+    -- > typedef int int2int(int);
+    -- > extern int2int foo;
+    --
+    -- <https://github.com/well-typed/hs-bindgen/issues/1034>
+  | ParseFunctionOfTypeTypedef
+
+  | ParseInvalidLinkage
+
+  | ParseInvalidVisibility
+
+    -- | Failed to parse a declaration because some of its nested declarations
+    -- failed to parse
+    --
+    -- For example, to successfully parse a struct (or union), all of its
+    -- nested declarations have to be parsed successfully as well. If any
+    -- nested declaration fails to parse, then we could miss seeing some
+    -- (implicit) fields, and we can't generate Haskell bindings for structs
+    -- (or unions) with an incomplete list of fields.
+  | ParseNestedDeclsFailed
+
+    -- | A function declaration or global variable declaration has a problematic
+    -- case of non-public visibility that can lead to linker errors if the
+    -- symbol is defined in a shared library.
+    --
+    -- In such cases, we emit this message. Arguably declarations like these are
+    -- a bug in the C library, given the way that header files are @#include@d
+    -- in other header and body files.
+    --
+    -- Concretely, a linker error can occur for a declared symbol if it:
+    --
+    -- 1. has non-public visibility,
+    -- 2. has external linkage, and
+    -- 3. is not a definition (and there is no definition elsewhere in the
+    --    header).
+    --
+    -- For example:
+    --
+    -- > extern void __attribute__ ((visibility ("hidden"))) f (void);
+    -- > extern int __attribute__ ((visibility ("hidden"))) i;
+  | ParseNonPublicVisibility
+
+    -- | Declaration availability can not be determined.
+    --
+    -- That is 'Clang.LowLevel.Core.clang_getCursorAvailability' does not
+    -- provide a valid 'Clang.LowLevel.Core.CXAvailabilityKind'.
+  | ParseUnknownCursorAvailability (SimpleEnum CXAvailabilityKind)
+
+    -- | Variable declaration
+  | ParseUnknownStorageClass (SimpleEnum CX_StorageClass)
+
+    -- | Unexposed type
+    --
+    -- In some cases, @libclang@ does not expose information about a type. For
+    -- example, LLVM/Clang 22 gives the @size_t@ arguments and results of
+    -- library builtins such as @malloc@ and @strlen@ the predefined sugar type
+    -- @__size_t@, which its @libclang@ does not classify (see
+    -- <https://github.com/llvm/llvm-project/issues/192268>). LLVM/Clang 23
+    -- fixes this, by reporting these as 'CXType_PredefinedSugar' instead, which
+    -- we handle.
+  | ParseUnexposedType
+
+    -- | Unsupported unnamed declaration inside @extern@
+    --
+    -- Something like
+    --
+    -- > extern struct { .. } config;
+    --
+    -- does not make sense: this declares the existence of some externally
+    -- defined global variable, but it is impossible to actually define said
+    -- global variable; an attempt such as
+    --
+    -- > #include "config.h"
+    -- > struct { .. } config = ..
+    --
+    -- will result in an error: "conflicting types for @config@".
+    --
+    -- The /header/ however by itself will not result in a @clang@ warning, so
+    -- we detect the situation and warn the user in @hs-bindgen@.
+    --
+    -- (As of C23, the situation is different for /tagged/ structs:
+    -- multiple uses of a struct with the same tag are considered
+    -- compatible as of WG14-N3037.)
+  | ParseUnsupportedUnnamedInExtern
+
+    -- | Unsupported unnamed declaration inside function signature
+    --
+    -- Consider:
+    --
+    -- > void f(struct named { int x; int y; } arg);
+    -- > void g(struct { int x; int y; } arg);
+    --
+    -- Somewhat surprisingly, @clang@ warns about the first
+    --
+    -- > warning: declaration of 'struct named' will not be visible outside of
+    -- > this function
+    --
+    -- but accepts the second (untagged struct); @gcc@ warns in both cases:
+    --
+    -- > {‘struct named’, untagged struct} declared inside parameter list will
+    -- > not be visible outside of this definition or declaration
+    --
+    -- as does the C compiler used by vscode, which in both cases says
+    --
+    -- > type definition not allowed
+    --
+    -- It's not entirely clear if C23/WG14-N3037 affects this or not; @gcc@
+    -- warns about both declarations even with @-std=c2x@.
+    --
+    -- For our purposes, only the unnamed case is really problematic (we have
+    -- no way of assigning a tag to the struct). Since it is relatively clear
+    -- that the unnamed version is anyway unusable (callers would have no way
+    -- of constructing any values), we rule them out.
+  | ParseUnsupportedUnnamedInSignature
+
+    -- | Clang built-in declaration
+  | ParseUnsupportedBuiltin Text
+
+    -- | We do not support this floating-point type
+  | ParseUnsupportedFloatType UnsupportedFloatType
+
+  | ParseUnsupportedLinkage String CXLinkageKind
+
+    -- | Thread local variables
+    --
+    -- <https://github.com/well-typed/hs-bindgen/issues/828>
+  | ParseUnsupportedTLS
+
+    -- | We do not support variadic (varargs) functions
+  | ParseUnsupportedVariadicFunction
+
+    -- | We do not support SIMD vector types (yet)
+  | ParseUnsupportedVector
+
+    -- | Unusable unnamed declaration
+    --
+    -- When an unusable declaration appears in some outer declaration (say a
+    -- function signature), we will fail to \"parse\" that outer declaration
+    -- (actually this happens as a separate post-processing step in
+    -- @FillUnnamedIds@). We record the identifier of the unnamed declaration
+    -- here (that is, it's source location); the identifier of the outer
+    -- declaration is recorded in the encloding 'HsBindgen.Frontend.Pass.Parse.Result.ParseResult'.
+  | ParseUnusableUnnamedDecl C.UnnamedId
+
+  | ParseExpectedFunctionType String
+
+    -- | A macro definition has no name, even though macros can not be unnamed
+  | ParseMacroDefinitionNoMacroName
+
+    -- | Complex types can only be defined using primitive types, e.g.
+    -- @double complex@. @struct Point complex@ is not allowed.
+  | ParseUnexpectedComplexType CXType
+
+    -- | We encountered an unexpected cursor kind
+    --
+    -- Similar comments apply as for 'ParseUnexpectedTypeKind'.
+  | ParseUnexpectedCursorKind (Either CInt CXCursorKind)
+
+  | ParseUnexpectedLinkage (Either CInt CXLinkageKind)
+
+    -- | We encountered an unexpected type kind
+    --
+    -- This is always a bug in hs-bindgen: if this kind of type is unsupported,
+    -- we should explicitly check for it and throw an appropriate exception.
+    --
+    -- If this is a @Left@ value, it means that our @libclang@ bindings are
+    -- incomplete.
+  | ParseUnexpectedTypeKind (Either CInt CXTypeKind)
+
+  | ParseUnexpectedVisibility (Either CInt CXLinkageKind)
+
+  | ParseNoMainHeadersException String RealPath
+  deriving stock (Show, Generic)
+
+-- | Floating-point types we do not support
+--
+-- @float@ and @double@ are the only floating-point types we support; all others
+-- either have a platform dependent representation or lack a Haskell FFI
+-- counterpart.
+--
+-- <https://github.com/well-typed/hs-bindgen/issues/349>
+-- <https://github.com/well-typed/hs-bindgen/issues/2232>
+data UnsupportedFloatType =
+    -- | @long double@
+    UnsupportedLongDouble
+
+    -- | @__float128@, @_Float128@
+  | UnsupportedFloat128
+
+    -- | @_Float16@
+  | UnsupportedFloat16
+
+    -- | @__fp16@ (half precision, storage only)
+  | UnsupportedHalf
+
+    -- | @__bf16@ (brain floating point)
+  | UnsupportedBFloat16
+
+    -- | @__ibm128@ (PowerPC double-double)
+  | UnsupportedIbm128
+  deriving stock (Show, Eq, Ord, Enum, Bounded, Generic)
+
+instance PrettyForTrace UnsupportedFloatType where
+  prettyForTrace = \case
+      UnsupportedLongDouble -> "long double"
+      UnsupportedFloat128   -> "__float128"
+      UnsupportedFloat16    -> "_Float16"
+      UnsupportedHalf       -> "__fp16"
+      UnsupportedBFloat16   -> "__bf16"
+      UnsupportedIbm128     -> "__ibm128"
+
+instance Exception DelayedParseMsg where
+  displayException = PP.renderCtxDoc (PP.mkContext 100) . prettyForTrace
+
+instance PrettyForTrace DelayedParseMsg where
+  prettyForTrace = \case
+      ParseUnderlyingTypeFailed name err -> PP.hcat [
+          "Parse failure of underlying type of typedef "
+        , prettyForTrace name
+        , ": "
+        , prettyForTrace err
+        ]
+      ParseImplicitFieldFailed reason -> PP.hsep [
+          "Failed to parse an implicit struct or union field"
+        , "referencing an anonymous object. Reason: "
+        , prettyForTrace reason
+        ]
+      ParseMacroEmpty name tokens -> PP.hsep [
+          "Not parsing macro with empty replacement list"
+        , prettyForTrace name >< ";"
+        , "use --parse-empty-macros to parse it:"
+        , PP.show tokens
+        ]
+      ParseMacroErrorParse err -> PP.vcat [
+          "Could not parse macro:"
+        , PP.nest 2 $
+            PP.renderedLines $ \_maxWidth -> lines err.macroParseError
+        ]
+      ParsePotentialDuplicateSymbol isPublic -> PP.hcat $ [
+            "Bindings may result in duplicate symbols; "
+          , "consider using 'static' or 'extern'"
+          ] ++
+          if isPublic
+          then [
+              "; "
+            , "or if that is not an option, consider attributing hidden "
+            , "visibility to the symbol"
+            ]
+          else []
+      ParseFunctionOfTypeTypedef ->
+        "Unsupported function declared with a typedef type"
+      ParseInvalidLinkage ->
+        "Invalid linkage (CXLinkage_Invalid)"
+      ParseInvalidVisibility ->
+        "Invalid visibility (CXVisibility_Invalid)"
+      ParseNestedDeclsFailed -> PP.hsep [
+          "Failed to parse a declaration because some of its nested declarations"
+        , "failed to parse"
+        ]
+      ParseNonPublicVisibility -> PP.hsep [
+          "Bindings may result in linker errors"
+        , "because the symbol has non-public visibility"
+        ]
+      ParseUnknownCursorAvailability simpleKind -> PP.hsep [
+          "Unknown declaration cursor availability:"
+        , PP.show simpleKind
+        ]
+      ParseUnknownStorageClass storage -> PP.hsep [
+          "Unsupported storage class"
+        , PP.show storage
+        ]
+      ParseUnexposedType ->
+        "Unexposed type"
+      ParseUnsupportedUnnamedInExtern ->
+        "Unexpected unnamed declaration in global variable"
+      ParseUnsupportedUnnamedInSignature ->
+        "Unexpected unnamed declaration in function signature"
+      ParseUnsupportedBuiltin name ->
+        "Unsupported built-in " >< PP.show name
+      ParseUnsupportedFloatType ty ->
+        "Unsupported floating-point type " >< prettyForTrace ty
+      ParseUnsupportedLinkage comment linkage -> PP.hcat [
+          "Unsupported linkage: "
+        , PP.show linkage
+        , " ("
+        , PP.string comment
+        , ")"
+        ]
+      ParseUnsupportedTLS ->
+        "Unsupported thread-local variable"
+      ParseUnsupportedVariadicFunction ->
+        "Unsupported variadic (varargs) function"
+      ParseUnsupportedVector ->
+        "Unsupported SIMD vector type"
+      ParseUnusableUnnamedDecl unnamedId -> PP.hsep [
+          "Unusable unnamed declaration "
+        , prettyForTrace unnamedId
+        ]
+      ParseDeclarationNotVisible kind name -> PP.hcat [
+            "Declaration of '"
+          , PP.text (C.tagKindPrefix kind)
+          , " "
+          , PP.text name
+          , "' will not be visible outside of this function"
+          ]
+      ParseExpectedFunctionType ty -> PP.hsep [
+          "Expected function type, but got"
+        , PP.string ty
+        ]
+      ParseMacroDefinitionNoMacroName ->
+        "A macro definition has no name, even though macros can not be unnamed"
+      ParseUnexpectedComplexType ty ->
+        unexpected $ "complex type " >< PP.show ty
+      ParseUnexpectedCursorKind x ->
+        unexpected $ "cursor kind " >< either PP.show PP.show x
+      ParseUnexpectedLinkage linkage -> PP.hcat [
+          "Unexpected linkage: "
+        , PP.show linkage
+        ]
+      ParseUnexpectedTypeKind x ->
+        unexpected $ "type kind " >< either PP.show PP.show x
+      ParseUnexpectedVisibility visibility -> PP.hcat [
+          "Unexpected visibility: "
+        , PP.show visibility
+        ]
+      ParseNoMainHeadersException why whr -> PP.hsep [
+          "Could not determine main headers:"
+        , PP.string why
+        , "at"
+        , PP.string $ getRealPath whr
+        ]
+    where
+      unexpected :: PP.CtxDoc -> PP.CtxDoc
+      unexpected msg = PP.vcat [
+            "Unexpected " >< msg
+          , PP.string pleaseReport
+          ]
+
+-- | Unsupported features are warnings
+instance IsTrace Level DelayedParseMsg where
+  getDefaultLogLevel = \case
+      ParseUnderlyingTypeFailed _ x        -> getDefaultLogLevel x
+      ParseImplicitFieldFailed    x        -> getDefaultLogLevel x
+      ParseMacroEmpty{}                    -> Info
+      ParseMacroErrorParse{}               -> Info
+      ParsePotentialDuplicateSymbol{}      -> Notice
+      ParseDeclarationNotVisible{}         -> Warning
+      ParseFunctionOfTypeTypedef{}         -> Warning
+      ParseInvalidLinkage                  -> Warning
+      ParseInvalidVisibility               -> Warning
+      ParseNestedDeclsFailed{}             -> Warning
+      ParseNonPublicVisibility{}           -> Warning
+      ParseUnknownCursorAvailability{}     -> Warning
+      ParseUnknownStorageClass{}           -> Warning
+      ParseUnexposedType                   -> Warning
+      ParseUnsupportedUnnamedInExtern{}    -> Warning
+      ParseUnsupportedUnnamedInSignature{} -> Warning
+      ParseUnsupportedBuiltin{}            -> Warning
+      ParseUnsupportedFloatType{}          -> Warning
+      ParseUnsupportedLinkage{}            -> Warning
+      ParseUnsupportedTLS{}                -> Warning
+      ParseUnsupportedVariadicFunction     -> Warning
+      ParseUnsupportedVector               -> Warning
+      ParseUnusableUnnamedDecl{}           -> Warning
+      ParseExpectedFunctionType{}          -> Bug
+      ParseMacroDefinitionNoMacroName{}    -> Bug
+      ParseUnexpectedComplexType{}         -> Bug
+      ParseUnexpectedCursorKind{}          -> Bug
+      ParseUnexpectedLinkage{}             -> Bug
+      ParseUnexpectedTypeKind{}            -> Bug
+      ParseUnexpectedVisibility{}          -> Bug
+      ParseNoMainHeadersException{}        -> Error
+  getSource  = const HsBindgen
+  getTraceId = \case
+      ParseImplicitFieldFailed x        -> "parse-" <> getTraceId x
+      ParseMacroDefinitionNoMacroName{} -> "parse-macro"
+      ParseMacroEmpty{}                 -> "parse-macro"
+      ParseMacroErrorParse{}            -> "parse-macro"
+      _ -> "parse"
+
+{-------------------------------------------------------------------------------
+  Delayed parse messages: implicit fields
+-------------------------------------------------------------------------------}
+
+data ParseImplicitFieldsMsg =
+    -- | Unsupported empty anonymous nested struct or union
+    --
+    -- Anonymous nested structs and unions need to have at least one named
+    -- member for parsing of implicit fields to succeed.
+    UnsupportedEmptyAnon
+    -- | An unexpected exception was thrown when using @clang_Type_getOffsetOf@
+    --
+    -- This is likely a bug in implicit field parsing.
+  | UnexpectedClangOffsetOfException Text String
+  deriving stock (Show, Eq, Ord, Generic)
+
+
+instance PrettyForTrace ParseImplicitFieldsMsg where
+  prettyForTrace = \case
+      UnsupportedEmptyAnon -> PP.hsep [
+          "Unsupported empty nested anonymous union or struct:"
+        , "it should have at least one named field"
+        ]
+      UnexpectedClangOffsetOfException field exc -> PP.hsep [
+          "Unexpected exception when using clang_Type_getOffsetOf"
+        , "with field name", PP.text field, ":", PP.string exc
+        ]
+
+-- | Unsupported features are warnings
+instance IsTrace Level ParseImplicitFieldsMsg where
+  getDefaultLogLevel = \case
+      UnsupportedEmptyAnon{}              -> Warning
+      UnexpectedClangOffsetOfException{}  -> Bug
+  getSource  = const HsBindgen
+  getTraceId = const "implicit-fields"
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Result.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Result.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Result.hs
@@ -0,0 +1,154 @@
+-- | Results from the parser proper
+module HsBindgen.Frontend.Pass.Parse.Result (
+    ParseResult(..)
+  , ParseClassification(..)
+  , ParseSuccess(..)
+    -- * Convenience constructors
+  , parseSucceed
+  , parseSucceedWith
+  , parseUnavailable
+    -- * Query
+  , getParseResultMaybeDecl
+  , getParseResultEitherDecl
+  ) where
+
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Parse result
+--
+-- NOTE: This does /NOT/ depend on the @Parse@ pass specifically: we transform
+-- these results in the @FillUnnamedIds@ pass.
+type ParseResult :: Star -> Pass -> Star
+data ParseResult l p = ParseResult{
+      id             :: Id p
+    , loc            :: SingleLoc C.DeclPath
+    , classification :: ParseClassification l p
+    }
+    deriving (Generic)
+
+deriving stock instance ( IsPass p
+                        , Macro.HasTypes l
+                        ) => Show (ParseResult l p)
+
+data ParseClassification l p =
+    ParseResultSuccess      (ParseSuccess l p)
+    -- | We unexpectedly did not parse a declaration because it is reported
+    -- "unavailable".
+  | ParseResultUnavailable
+  | ParseResultFailure      DelayedParseMsg
+  deriving stock (Generic)
+
+deriving stock instance ( IsPass p
+                        , Macro.HasTypes l
+                        ) => Show (ParseClassification l p)
+
+data ParseSuccess l p = ParseSuccess {
+      decl             :: C.Decl l p
+    , delayedParseMsgs :: [DelayedParseMsg]
+    }
+  deriving stock (Generic)
+
+deriving stock instance (
+    IsPass p
+  , Macro.HasTypes l
+  ) => Show (ParseSuccess l p)
+
+{-------------------------------------------------------------------------------
+  Pretty-printing
+-------------------------------------------------------------------------------}
+
+instance PrettyForTrace (ParseSuccess l p) where
+  prettyForTrace success =
+      if null success.delayedParseMsgs then
+        "Parse success"
+      else
+        PP.hang "Parse success with messages:" 2 $
+          PP.vcat $
+          map prettyForTrace success.delayedParseMsgs
+
+{-------------------------------------------------------------------------------
+  Convenience constructors
+-------------------------------------------------------------------------------}
+
+-- | Assemble a parse success
+parseSucceed :: C.Decl l p -> ParseResult l p
+parseSucceed = parseSucceedWith []
+
+-- | Assemble a parse success with delayed parse messages
+parseSucceedWith :: [DelayedParseMsg] -> C.Decl l p -> ParseResult l p
+parseSucceedWith msgs decl = ParseResult{
+     id             = decl.info.id
+   , loc            = decl.info.loc
+   , classification = ParseResultSuccess ParseSuccess{
+         decl             = decl
+       , delayedParseMsgs = msgs
+       }
+    }
+
+-- | Assemble a parse result for an unavailable declaration
+parseUnavailable :: C.DeclInfo p -> ParseResult l p
+parseUnavailable info = ParseResult{
+      id              = info.id
+    , loc             = info.loc
+    , classification = ParseResultUnavailable
+    }
+
+{-------------------------------------------------------------------------------
+  Query
+-------------------------------------------------------------------------------}
+
+getParseResultMaybeDecl :: ParseResult l p -> Maybe (C.Decl l p)
+getParseResultMaybeDecl result =
+    case result.classification of
+      ParseResultSuccess success -> Just $ success.decl
+      _other                     -> Nothing
+
+getParseResultEitherDecl :: ParseResult l p -> Either (ParseResult l p) (C.Decl l p)
+getParseResultEitherDecl result =
+    maybe (Left result) Right $ getParseResultMaybeDecl result
+
+{-------------------------------------------------------------------------------
+  CoercePass instances
+-------------------------------------------------------------------------------}
+
+instance (
+      CoercePassId p p'
+    , CoercePass (C.Decl l) p p'
+    , Ann "TranslationUnit" p ~ Ann "TranslationUnit" p'
+    ) => CoercePass (ParseResult l) p p' where
+  coercePass pr = ParseResult{
+        id             = coercePassId (Proxy @'(p, p')) pr.id
+      , loc            = pr.loc
+      , classification = coercePass pr.classification
+      }
+
+instance (
+      CoercePass (C.Decl l) p p'
+    , Ann "TranslationUnit" p ~ Ann "TranslationUnit" p'
+    ) => CoercePass (ParseClassification l) p p' where
+  coercePass = \case
+    ParseResultSuccess s   -> ParseResultSuccess (coercePass s)
+    ParseResultUnavailable -> ParseResultUnavailable
+    ParseResultFailure x   -> ParseResultFailure x
+
+instance (
+      CoercePass (C.Decl l) p p'
+    , Ann "TranslationUnit" p ~ Ann "TranslationUnit" p'
+    ) => CoercePass (ParseSuccess l) p p' where
+  coercePass ps = ParseSuccess{
+        decl = coercePass ps.decl
+      , delayedParseMsgs = ps.delayedParseMsgs
+      }
diff --git a/src-internal/HsBindgen/Frontend/Pass/Parse/Type.hs b/src-internal/HsBindgen/Frontend/Pass/Parse/Type.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Parse/Type.hs
@@ -0,0 +1,281 @@
+-- | Fold types
+module HsBindgen.Frontend.Pass.Parse.Type (fromCXType) where
+
+import Control.Monad
+import Control.Monad.Catch
+import Control.Monad.Error.Class
+import GHC.Stack
+
+import Clang.Enum.Simple
+import Clang.LowLevel.Core
+
+import HsBindgen.Frontend.Pass.Parse.Builtin
+import HsBindgen.Frontend.Pass.Parse.Context
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.Parse.Monad.Type (ParseType)
+import HsBindgen.Frontend.Pass.Parse.Monad.Type qualified as ParseType
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+fromCXType :: forall m.
+  (MonadIO m, HasCallStack)
+  => ParseCtx -> CXType -> m (C.Type Parse)
+fromCXType ctx =
+    liftIO . handle h . ParseType.run . cxtype
+  where
+    h :: SomeException -> IO a
+    h = addCtxHandler (Proxy :: Proxy DelayedParseMsg) ctx
+
+{-------------------------------------------------------------------------------
+  Dispatch
+-------------------------------------------------------------------------------}
+
+cxtype :: HasCallStack => CXType -> ParseType (C.Type Parse)
+cxtype ty = do
+    reifiedType <- ParseType.dispatchWithArg ty $ \case
+      CXType_Char_S     -> prim $ C.PrimChar (C.PrimSignImplicit $ Just C.Signed)
+      CXType_Char_U     -> prim $ C.PrimChar (C.PrimSignImplicit $ Just C.Unsigned)
+      CXType_SChar      -> prim $ C.PrimChar (C.PrimSignExplicit C.Signed)
+      CXType_UChar      -> prim $ C.PrimChar (C.PrimSignExplicit C.Unsigned)
+      CXType_Short      -> prim $ C.PrimIntegral C.PrimShort    C.Signed
+      CXType_UShort     -> prim $ C.PrimIntegral C.PrimShort    C.Unsigned
+      CXType_Int        -> prim $ C.PrimIntegral C.PrimInt      C.Signed
+      CXType_UInt       -> prim $ C.PrimIntegral C.PrimInt      C.Unsigned
+      CXType_Long       -> prim $ C.PrimIntegral C.PrimLong     C.Signed
+      CXType_ULong      -> prim $ C.PrimIntegral C.PrimLong     C.Unsigned
+      CXType_LongLong   -> prim $ C.PrimIntegral C.PrimLongLong C.Signed
+      CXType_ULongLong  -> prim $ C.PrimIntegral C.PrimLongLong C.Unsigned
+      CXType_Float      -> prim $ C.PrimFloating C.PrimFloat
+      CXType_Double     -> prim $ C.PrimFloating C.PrimDouble
+      CXType_Bool       -> prim $ C.PrimBool
+      CXType_Complex    -> complex
+      CXType_Vector     -> failure ParseUnsupportedVector
+
+      CXType_LongDouble -> unsupportedFloatType UnsupportedLongDouble
+      CXType_Float128   -> unsupportedFloatType UnsupportedFloat128
+      CXType_Float16    -> unsupportedFloatType UnsupportedFloat16
+      CXType_Half       -> unsupportedFloatType UnsupportedHalf
+      CXType_BFloat16   -> unsupportedFloatType UnsupportedBFloat16
+      CXType_Ibm128     -> unsupportedFloatType UnsupportedIbm128
+
+      CXType_Attributed      -> attributed
+      CXType_BlockPointer    -> blockPointer
+      CXType_ConstantArray   -> constantArray
+      CXType_Elaborated      -> elaborated
+      CXType_Enum            -> fromDecl
+      CXType_FunctionNoProto -> function False
+      CXType_FunctionProto   -> function True
+      CXType_IncompleteArray -> incompleteArray
+      CXType_Pointer         -> pointer
+      CXType_PredefinedSugar -> predefinedSugar
+      CXType_Record          -> fromDecl
+      CXType_Typedef         -> fromDecl
+      CXType_Void            -> const (pure C.TypeVoid)
+      CXType_Unexposed       -> failure ParseUnexposedType
+
+      kind -> failure $ ParseUnexpectedTypeKind (Right kind)
+
+    addQualifiers <- qualifiers ty
+    pure $ addQualifiers reifiedType
+  where
+    failure :: DelayedParseMsg -> CXType -> ParseType (C.Type Parse)
+    failure err _ty = throwError err
+
+    unsupportedFloatType ::
+         UnsupportedFloatType -> CXType -> ParseType (C.Type Parse)
+    unsupportedFloatType = failure . ParseUnsupportedFloatType
+
+qualifiers :: CXType -> ParseType (C.Type Parse -> C.Type Parse)
+qualifiers ty = do
+    isConst <- clang_isConstQualifiedType ty
+    pure $ if isConst
+             then C.TypeQual C.QualConst
+             else id
+
+{-------------------------------------------------------------------------------
+  Functions for each kind of type
+-------------------------------------------------------------------------------}
+
+prim :: C.PrimType -> CXType -> ParseType (C.Type Parse)
+prim ty _ = return $ C.TypePrim ty
+
+complex :: CXType -> ParseType (C.Type Parse)
+complex ty = do
+  complexType <- clang_getElementType ty
+  cty         <- cxtype complexType
+  case cty of
+    C.TypePrim p -> pure (C.TypeComplex p)
+    _            -> throwError $ ParseUnexpectedComplexType complexType
+
+elaborated :: CXType -> ParseType (C.Type Parse)
+elaborated = clang_Type_getNamedType >=> cxtype
+
+-- LLVM/Clang 23 and later use this for the @size_t@ arguments and results of
+-- library builtins such as @malloc@. We parse the underlying integer type
+-- (the canonical type) instead, as LLVM/Clang 21 and earlier report.
+predefinedSugar :: CXType -> ParseType (C.Type Parse)
+predefinedSugar = clang_getCanonicalType >=> cxtype
+
+pointer :: CXType -> ParseType (C.Type Parse)
+pointer = clang_getPointeeType >=> fmap (C.TypePointers 1) . cxtype
+
+fromDecl :: HasCallStack => CXType -> ParseType (C.Type Parse)
+fromDecl ty = do
+    decl     <- clang_getTypeDeclaration ty
+    mBuiltin <- checkIsBuiltin decl
+    case mBuiltin of
+      Just builtin ->
+        -- Built-in types don't have a corresponding declaration; if we want
+        -- to support them, we have to special-case each one. For now, we don't
+        -- support any.
+        throwError $ ParseUnsupportedBuiltin builtin
+      Nothing -> ParseType.dispatchDecl decl $ \case
+        CXCursor_EnumDecl   -> typeEnum decl
+        CXCursor_StructDecl -> checkVisibleDecl decl C.TagKindStruct
+                            >> typeRef decl C.TagKindStruct
+        CXCursor_UnionDecl  -> checkVisibleDecl decl C.TagKindUnion
+                            >> typeRef decl C.TagKindUnion
+
+        CXCursor_TypedefDecl -> typeTypedef decl
+
+        kind -> throwError $ ParseUnexpectedCursorKind (Right kind)
+
+typeRef :: MonadIO m => CXCursor -> C.TagKind -> m (C.Type Parse)
+typeRef decl kind =
+    C.TypeRef <$> C.prelimDeclIdAtCursor decl (C.NameKindTagged kind)
+
+-- | Check that a struct/union declaration is visible outside a function
+-- prototype.
+--
+-- We detect this using @clang_getCursorSemanticParent@: for a file-scope
+-- @struct foo@, the semantic parent is the translation unit. But when
+-- @struct foo@ appears only inside a function prototype (whether as a bare
+-- forward reference or an inline definition), clang parents it under the
+-- @CXCursor_FunctionDecl@.
+--
+-- Examples:
+--
+-- @
+-- struct opaque;
+-- void f(struct opaque *p);              -- OK: parent is TranslationUnit
+-- void g(struct s *p);                   -- rejected: parent is FunctionDecl
+-- void h(struct s { int x; } arg);       -- rejected: parent is FunctionDecl
+-- void k(struct { int x; char c; } arg); -- rejected: parent is FunctionDecl
+-- @
+--
+checkVisibleDecl :: CXCursor -> C.TagKind -> ParseType ()
+checkVisibleDecl decl kind = do
+    parent     <- clang_getCursorSemanticParent decl
+    parentKind <- fromSimpleEnum <$> clang_getCursorKind parent
+    when (parentKind == Right CXCursor_FunctionDecl) $ do
+      name <- clang_getCursorSpelling decl
+      throwError $ ParseDeclarationNotVisible kind name
+
+typeEnum :: HasCallStack => CXCursor -> ParseType (C.Type Parse)
+typeEnum decl = do
+    declId <- C.prelimDeclIdAtCursor decl (C.NameKindTagged C.TagKindEnum)
+    -- Enums can be untagged. In such cases, we bypass the cache and parse the
+    -- enum type directly.
+    let mDeclName = C.prelimDeclIdSourceName declId
+    ParseType.cachedMaybe mDeclName $ do
+      underlying <- handle (addUnderlyingTypeContextHandler declId)
+                      (cxtype =<< clang_getEnumDeclIntegerType decl)
+      pure $ C.TypeEnum $ C.Ref {
+            name = declId
+          , underlying = underlying
+          }
+
+typeTypedef :: HasCallStack => CXCursor -> ParseType (C.Type Parse)
+typeTypedef curr = do
+    declId <- C.prelimDeclIdAtCursor curr C.NameKindOrdinary
+    -- Typedefs can not be unnamed, but we use 'cachedMaybe' for safety
+    -- anyway
+    let mDeclName = C.prelimDeclIdSourceName declId
+    ParseType.cachedMaybe mDeclName $ do
+        underlying <- handle (addUnderlyingTypeContextHandler declId) $
+                        getUnderlyingType curr
+        pure $ C.TypeTypedef $ C.Ref {
+            name = declId
+          , underlying = underlying
+          }
+  where
+    getUnderlyingType :: CXCursor -> ParseType (C.Type Parse)
+    getUnderlyingType typedefCurr = do
+      uTy  <- clang_getTypedefDeclUnderlyingType typedefCurr
+      -- Later versions of Clang use elaborated types, earlier versions do not
+      case fromSimpleEnum (cxtKind uTy) of
+        Right CXType_Elaborated -> do
+          -- The named type @refTy@ that is referenced by the underlying type
+          -- might not have the same qualifiers as the underlying type. We add
+          -- them back in using 'qualifiers'. We did not do this in the past,
+          -- leading to bugs, see PR #1488.
+          refTy <- clang_Type_getNamedType uTy
+          addQualifiers <- qualifiers uTy
+          addQualifiers <$> cxtype refTy
+        Right{} ->
+          cxtype uTy
+        typeKind ->
+          throwError $ ParseUnexpectedTypeKind typeKind
+
+function :: Bool -> CXType -> ParseType (C.Type Parse)
+function hasProto = \ty -> do
+    isVariadic <-
+      -- Functions without a prototype (that is, without declared arguments)
+      -- are technically speaking considered variadic. However, we reinterpret
+      -- such declarations following C23, and assume they have /no/ arguments.
+      if hasProto
+        then clang_isFunctionTypeVariadic ty
+        else return False
+    if isVariadic then do
+      throwError ParseUnsupportedVariadicFunction
+    else do
+      res   <- clang_getResultType ty >>= cxtype
+      nargs <- clang_getNumArgTypes ty
+      args  <- forM [0 .. nargs - 1] $ \i ->
+                 clang_getArgType ty (fromIntegral i) >>= cxtype
+      pure $ C.TypeFun (map mkTypeFunArg args) res
+  where
+    mkTypeFunArg :: C.TypeF tag Parse -> C.TypeFunArgF tag Parse
+    mkTypeFunArg ty = C.TypeFunArgF {
+          typ = ty
+        , ann = NoAnn
+        }
+
+constantArray :: CXType -> ParseType (C.Type Parse)
+constantArray ty = do
+    n   <- fromIntegral <$> clang_getArraySize ty
+    ty' <- cxtype =<< clang_getArrayElementType ty
+    return (C.TypeConstArray n ty')
+
+incompleteArray :: CXType -> ParseType (C.Type Parse)
+incompleteArray ty = do
+    ty' <- cxtype =<< clang_getArrayElementType ty
+    return (C.TypeIncompleteArray ty')
+
+attributed :: CXType -> ParseType (C.Type Parse)
+attributed ty = cxtype =<< clang_Type_getModifiedType ty
+
+blockPointer :: CXType -> ParseType (C.Type Parse)
+blockPointer ty = do
+    fun <- function True =<< clang_getPointeeType ty
+    return (C.TypeBlock fun)
+
+{-------------------------------------------------------------------------------
+  Underlying types
+-------------------------------------------------------------------------------}
+
+addUnderlyingTypeContextHandler ::
+     C.PrelimDeclId
+  -> SomeException
+  -> ParseType a
+addUnderlyingTypeContextHandler n e
+  | Just e' <- (fromException @DelayedParseMsg e)
+  = throwM (ParseUnderlyingTypeFailed n e')
+  | otherwise  = throwM e
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse.hs
@@ -0,0 +1,159 @@
+module HsBindgen.Frontend.Pass.PrepareReparse (
+    prepareReparse
+  ) where
+
+import Prelude hiding (lex, print)
+
+import Crypto.Hash.SHA256 (hash)
+import Data.ByteString.Base16 qualified as B16
+import Data.ByteString.Char8 qualified as B
+import Data.List qualified as List
+import Data.Map.Lazy (Map)
+import Data.Map.Lazy qualified as Map
+import System.FilePath ((<.>), (</>))
+import System.IO.Temp (withSystemTempDirectory)
+import Text.Parsec (ParseError)
+
+import Clang.Discover (ClangExe)
+
+import HsBindgen.Clang (ClangSetup)
+import HsBindgen.Frontend.Pass.PrepareReparse.AST (Decl, Include (Include),
+                                                   PostHeader (targets),
+                                                   PreHeader, Tag,
+                                                   Target (Target))
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass (PrepareReparse)
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg (PrepareReparseMsg (..))
+import HsBindgen.Frontend.Pass.PrepareReparse.Lexer (Token, lex)
+import HsBindgen.Frontend.Pass.PrepareReparse.Parser (parse)
+import HsBindgen.Frontend.Pass.PrepareReparse.Preprocessor (preprocess)
+import HsBindgen.Frontend.Pass.PrepareReparse.Printer (print)
+import HsBindgen.Frontend.Pass.PrepareReparse.Simplifier (simplify)
+import HsBindgen.Frontend.Pass.PrepareReparse.Tracer (traceImmediate)
+import HsBindgen.Frontend.Pass.PrepareReparse.Update (UpdateMode (..), update)
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass (TypecheckMacros)
+import HsBindgen.Frontend.RootHeader (RootHeader)
+import HsBindgen.Frontend.RootHeader qualified as RootHeader
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Util.Tracer (Tracer)
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+prepareReparse ::
+     forall l.
+     Tracer (Msg PrepareReparse)
+  -> Maybe ClangExe
+  -> ClangSetup
+  -> RootHeader
+  -> C.TranslationUnit l TypecheckMacros
+  -> IO (C.TranslationUnit l PrepareReparse)
+prepareReparse tr clangExeMay setup root unit = do
+    case clangExeMay of
+      -- When we can't find the @clang@ executable, return the fallback value.
+      Nothing -> do
+        traceImmediate tr PrepareReparseClangExeNotFound
+        returnFallback
+      Just clangExe -> do
+        withSystemTempDirectory "hs-bindgen_prepare-reparse" $ \dir -> do
+          -- The root header contents are written to a temporary root header
+          -- file
+          let rootHeaderContents = RootHeader.content root
+              rootHeaderHash = hashString rootHeaderContents
+              rootHeaderName = rootHeaderHash <.> "h"
+              rootHeaderPath = dir </> rootHeaderName
+          traceImmediate tr $ PrepareReparseWriteTempHeader rootHeaderPath rootHeaderContents
+          writeFile rootHeaderPath rootHeaderContents
+          -- Reparse targets are written to a temporary header as well
+          let headerSimplified = runSimplifier rootHeaderName unit
+              headerPrinted = runPrinter headerSimplified ""
+              headerHash = hashString headerPrinted
+              headerPath = dir </> headerHash <.> "h"
+          traceImmediate tr $ PrepareReparseWriteTempHeader headerPath headerPrinted
+          writeFile headerPath headerPrinted
+          -- Preprocess the temporary headers
+          res <- preprocess tr clangExe setup headerPath
+          case res of
+            -- When the preprocessor failed to run, return the fallback value.
+            Left _e -> do
+              traceImmediate tr PrepareReparsePreprocessorFailed
+              returnFallback
+            Right preprocessedContents -> do
+              case cut headerPath preprocessedContents of
+                -- When we can't single out the interesting lines of code from
+                -- the preprocessor output, return the fallback value.
+                Nothing -> do
+                  traceImmediate tr PrepareReparseInterpretPreprocessorOutputFailed
+                  returnFallback
+                Just cutContents -> do
+                  traceImmediate tr $ PrepareReparseTempHeaderCutContents cutContents
+                  case runLexer cutContents >>= runParser of
+                    -- When we can't parse the preprocessor output, return the
+                    -- fallback value.
+                    Left e -> do
+                      traceImmediate tr $ PrepareReparseParsePreprocessorOutputFailed e
+                      returnFallback
+                    Right postHeader ->
+                      pure $ runUpdater postHeader unit
+  where
+    -- | Default to flattening tokens without expanding macro invocations.
+    returnFallback :: IO (C.TranslationUnit l PrepareReparse)
+    returnFallback = pure $ update UpdateOnlyFlatten unit
+
+{-------------------------------------------------------------------------------
+  Cut
+-------------------------------------------------------------------------------}
+
+cut :: FilePath -> String -> Maybe String
+cut headerPath headerContents = go (lines headerContents)
+  where
+    target' = "# 2 " <> show headerPath <> " 2"
+
+    go []     = Nothing
+    go (x:xs)
+      | target' `List.isInfixOf` x
+      = Just $ unlines $ filter (not . ("#" `List.isPrefixOf`)) xs
+      | otherwise
+      = go xs
+
+{-------------------------------------------------------------------------------
+  Internal phases
+-------------------------------------------------------------------------------}
+
+runSimplifier :: FilePath -> C.TranslationUnit l TypecheckMacros -> PreHeader
+runSimplifier rootHeaderPath unit = simplify () unit $ Include rootHeaderPath
+
+runPrinter :: PreHeader -> ShowS
+runPrinter = print
+
+runLexer :: String -> Either ParseError [Token]
+runLexer = lex
+
+runParser :: [Token] -> Either ParseError PostHeader
+runParser = parse
+
+runUpdater ::
+     PostHeader
+  -> C.TranslationUnit l TypecheckMacros
+  -> C.TranslationUnit l PrepareReparse
+runUpdater header unit = update mode unit
+  where
+    mode = UpdatePreprocessAndFlatten preprocessedMap
+    preprocessedMap :: Map Tag Decl
+    preprocessedMap = Map.fromList [
+          (tag, decl)
+        | Target tag decl <- header.targets
+        ]
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+-- | Construct a hash
+--
+-- It is not so important that the hash is stable or very good. The main intent
+-- is to generate a name for a temporary file that is fairly likely to be
+-- unique.
+hashString :: String -> String
+hashString = B.unpack . B.take 16 . B16.encode . hash . B.pack
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/AST.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/AST.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/AST.hs
@@ -0,0 +1,149 @@
+-- | A simplified intermediate AST for a header file containing only
+-- declarations that are intended to be run through the reparser
+--
+-- This module is intended to be imported unqualified. It is also intended to
+-- only be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse"
+-- module hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.AST
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.AST (
+    -- * Before preprocessing
+    PreHeader (..)
+  , Include (..)
+  , Undef (..)
+  , MacroName (..)
+    -- * After preprocessing
+  , PostHeader (..)
+    -- * Common
+  , Target (..)
+  , Decl (..)
+  , Tag (..)
+  , TagType (..)
+  , TagName (..)
+  ) where
+
+import Prelude hiding (print)
+
+{-------------------------------------------------------------------------------
+  Before preprocessing
+-------------------------------------------------------------------------------}
+
+-- | A header file for reparse targets before macro prepocessing
+--
+-- The goal of the @PrepareReparse@ pass is to expand macro invocations in
+-- reparse targets that would make the reparser fail. In general, all macro
+-- definitions that were not parsed as types have to be expanded. To achieve
+-- this expanding of only select macro definitions, we include the original
+-- header file, we undefine all macro definitions that were parsed as types, and
+-- then we include all reparse targets. This 'PreHeader' can then be printed to
+-- a file, and that file can preprocessed using the @clang@ executable.
+--
+-- Example:
+--
+-- > PreHeader {
+-- >    include = Include "foo/bar/baz.h"
+-- >  , undefs = [ Undef (MacroName "A") ]
+-- >  , targets = [
+-- >        Target (Tag Function (TagName "myFunction")) (Decl "void myFunction (A x);")
+-- >      , Target (Tag Field (TagName "MyStruct.myStructField")) (Decl "B myStructField;")
+-- >      ]
+-- >  }
+--
+-- In the above example, @A@ was parsed as a type, and @B@ was not.
+data PreHeader = PreHeader {
+    include :: Include
+  , undefs :: [Undef]
+  , targets :: [Target]
+  }
+
+-- | An include directive
+newtype Include = Include FilePath
+  deriving stock (Show, Eq)
+
+-- | A macro undefinition
+data Undef = Undef MacroName
+  deriving stock (Show, Eq)
+
+-- | A macro name
+newtype MacroName = MacroName String
+  deriving stock (Show, Eq)
+
+{-------------------------------------------------------------------------------
+  After preprocessing
+-------------------------------------------------------------------------------}
+
+-- | A header file for reparse targets after macro prepocessing
+--
+-- After running the @clang@ executable on a printed 'PreHeader' (and cutting
+-- out all code from the included original header file), we are left with a file
+-- that contains all reparse targets but with all the relevant macro invocations
+-- expanded. These textual reparse targets can then be parsed as a 'PostHeader'.
+--
+-- Example:
+--
+-- > PostHeader {
+-- >    targets = [
+-- >        Target (Tag Function (TagName "myFunction")) (Decl "void myFunction (A x);")
+-- >      , Target (Tag Field (TagName "MyStruct.myStructField")) (Decl "void myStructField;")
+-- >      ]
+-- >  }
+--
+-- In the above example, @A@ was parsed as a type, and @B@ was not so it was
+-- expanded.
+data PostHeader = PostHeader {
+    targets :: [Target]
+  }
+
+{-------------------------------------------------------------------------------
+  Common
+-------------------------------------------------------------------------------}
+
+-- | A /reparse/ target is a declaration that should be run through the reparser
+data Target = Target Tag Decl
+  deriving stock (Show, Eq)
+
+-- | The raw text of a declaration
+newtype Decl = Decl String
+  deriving stock (Show, Eq)
+
+-- | A tag records the origins of a reparser target: the kind of declaration,
+-- and a unique name for the declaration
+--
+-- Tags are used in the printer to signal the start and end of a reparse target,
+-- which makes it easier to parse the printer output later. Moreover, the tag
+-- name is used to assign unique tag names to fields, because field names are
+-- not unique in general.
+--
+-- Examples:
+--
+-- > Tag Function (TagName "myFunction")
+-- > Tag Field (TagName "MyStruct.myStructField")
+--
+data Tag = Tag TagType TagName
+  deriving stock (Show, Eq, Ord)
+
+-- | Reparse targets can be declarations of these kinds:
+data TagType =
+    -- | A struct or union field
+    Field
+  | Function
+  | Typedef
+    -- | A global variable
+  | Variable
+  deriving stock (Show, Eq, Ord, Enum, Bounded)
+
+-- | A unique name for a reparse target
+--
+-- This is generally just the name of the declaration itself, but for fields we
+-- pair the name of the field with the name of the enclosing struct or union.
+-- Field names are not unique in /general/. They are only unique within a single
+-- struct or union.
+--
+-- Examples:
+--
+-- > TagName "myFunction"
+-- > TagName "MyStruct.myStructField"
+--
+newtype TagName = TagName String
+  deriving stock (Show, Eq, Ord)
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Flatten.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Flatten.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Flatten.hs
@@ -0,0 +1,61 @@
+-- | Flattening @libclang@ tokens
+--
+-- This module is intended to be imported unqualified. It is also intended to
+-- only be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse"
+-- module hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.Flatten
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.Flatten (
+    flattenDefault
+  , flattenFunction
+  ) where
+
+import Clang.Enum.Simple (fromSimpleEnum)
+import Clang.HighLevel.Types (Token (tokenCursorKind, tokenKind), TokenSpelling)
+import Clang.LowLevel.Core (CXCursorKind (CXCursor_CompoundStmt),
+                            CXTokenKind (CXToken_Comment))
+import Clang.Paths (SourcePath)
+
+import HsBindgen.Clang.Tokens qualified as Clang
+import HsBindgen.Frontend.Pass.PrepareReparse.Printer.Util qualified as P
+
+{-------------------------------------------------------------------------------
+  Flattening
+-------------------------------------------------------------------------------}
+
+-- | Flatten tokens and add a semicolon at the end, while skipping over tokens
+-- that are comments.
+flattenDefault :: [Token SourcePath TokenSpelling] -> String
+flattenDefault tokens = prettyTokens tokens ""
+
+-- | Flatten tokens and add a semicolon at the end, while skipping over tokens
+-- that are comments or part of a function body.
+flattenFunction :: [Token SourcePath TokenSpelling] -> String
+flattenFunction tokens = prettyTokens (skipFunctionBody tokens) ""
+
+{-------------------------------------------------------------------------------
+  Tokens
+-------------------------------------------------------------------------------}
+
+-- | Pretty-print tokens and add a semicolon at the end
+prettyTokens :: [Token SourcePath TokenSpelling] -> ShowS
+prettyTokens ts = Clang.prettyTokens (skipComments ts) . P.semicolon
+
+-- | Skip tokens that are comments
+skipComments :: [Token SourcePath TokenSpelling] -> [Token SourcePath TokenSpelling]
+skipComments ts = filter p ts
+  where
+    p :: Token SourcePath TokenSpelling -> Bool
+    p t = case fromSimpleEnum t.tokenKind of
+        Right CXToken_Comment -> False
+        _ -> True
+
+-- | Skip tokens that form a function body
+skipFunctionBody :: [Token SourcePath TokenSpelling] -> [Token SourcePath TokenSpelling]
+skipFunctionBody = go
+  where
+    go [] = []
+    go (t:ts) = case fromSimpleEnum t.tokenCursorKind of
+        Right CXCursor_CompoundStmt -> []
+        _ -> t : go ts
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/IsPass.hs
@@ -0,0 +1,87 @@
+-- | Definitions for the @PrepareReparse@ pass
+--
+-- This module is intended to be imported unqualified.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.IsPass
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.IsPass (
+    PrepareReparse
+    -- * Tokens
+  , FlatTokens (..)
+  ) where
+
+import Clang.HighLevel.Types (MultiLoc, SourcePath)
+
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg (PrepareReparseMsg)
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type PrepareReparse :: Pass
+data PrepareReparse a
+
+type family AnnPrepareReparse (ix :: Symbol) :: Star where
+  AnnPrepareReparse "Function"      = ReparseInfo FlatTokens
+  AnnPrepareReparse "Global"        = ReparseInfo FlatTokens
+  AnnPrepareReparse "IndirectField" = ReparseInfo FlatTokens
+  AnnPrepareReparse "RegularField"  = ReparseInfo FlatTokens
+  AnnPrepareReparse "Typedef"       = ReparseInfo FlatTokens
+  AnnPrepareReparse _               = NoAnn
+
+instance IsPass PrepareReparse
+
+instance PassId PrepareReparse
+
+instance PassScopedName PrepareReparse
+
+instance PassTypes PrepareReparse
+
+instance PassMacro PrepareReparse where
+  type MacroId   PrepareReparse = Id PrepareReparse
+  type MacroBody PrepareReparse = TypecheckedMacro PrepareReparse
+
+  macroIdId _ = id
+
+instance PassExtBinding PrepareReparse
+
+instance PassCommentDecl PrepareReparse where
+  type CommentDecl PrepareReparse = Maybe (C.Comment PrepareReparse)
+
+instance PassAnn PrepareReparse where
+  type Ann ix PrepareReparse = AnnPrepareReparse ix
+
+instance PassMsg PrepareReparse where
+  type Msg PrepareReparse = PrepareReparseMsg
+
+{-------------------------------------------------------------------------------
+  Tokens
+-------------------------------------------------------------------------------}
+
+-- | @libclang@ tokens flattened into a single string
+data FlatTokens = FlatTokens {
+      -- | Location of the first token before flattening
+      locStart :: MultiLoc SourcePath
+      -- | Tokens flattened into a single string
+    , flatten  :: String
+    }
+  deriving stock (Show, Eq)
+
+{-------------------------------------------------------------------------------
+  CoercePass: TypecheckMacros → PrepareReparse
+-------------------------------------------------------------------------------}
+
+instance CoercePassId                  TypecheckMacros PrepareReparse
+instance CoercePassMacroId             TypecheckMacros PrepareReparse
+instance CoercePassTypes               TypecheckMacros PrepareReparse
+instance CoercePassAnn "TypeFunArg"    TypecheckMacros PrepareReparse
+
+instance CoercePassCommentDecl TypecheckMacros PrepareReparse where
+  coercePassCommentDecl _ = fmap coercePass
+
+instance CoercePassMacroUnderlying TypecheckMacros PrepareReparse
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/IsPass/Msg.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/IsPass/Msg.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/IsPass/Msg.hs
@@ -0,0 +1,194 @@
+-- | Trace messages for the @PrepareReparse@ pass
+--
+-- This module is intended to be imported unqualified.
+module HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg (
+    -- * Msg
+    PrepareReparseMsg (..)
+    -- * DelayedMsg
+  , DelayedPrepareReparseMsg (..)
+  ) where
+
+import Data.List.NonEmpty (NonEmpty)
+import Data.Text (Text)
+import GHC.Generics (Generic)
+import System.Exit (ExitCode)
+import Text.Parsec.Error qualified as Parsec
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.HighLevel.Types (MultiLoc (multiLocExpansion), SourcePath)
+
+import HsBindgen.Util.Tracer (IsTrace (..), Level (Bug, Debug, Info, Warning),
+                              PrettyForTrace (..), Source (HsBindgen))
+
+{-------------------------------------------------------------------------------
+  Msg
+-------------------------------------------------------------------------------}
+
+data PrepareReparseMsg =
+    -- * Warning
+
+    -- | We need the @clang@ executable to preprocess select macro invocations,
+    -- but we could not find it. Is it missing from the PATH environment
+    -- variable?
+    --
+    -- The generated Haskell bindings might not fully support macro types as a
+    -- result.
+    PrepareReparseClangExeNotFound
+
+
+    -- * Debug
+
+    -- | We wrote a temporary header to a temporary file path
+  | PrepareReparseWriteTempHeader
+      -- | Header path
+      FilePath
+      -- | Header contents
+      String
+    -- | Printed preprocessor command
+  | PrepareReparsePreprocessorCommand String
+    -- | Exit code resulting from running the @clang@ executable for preprocessing
+  | PrepareReparsePreprocessorExitCode ExitCode
+    -- | @stdout@ output resulting from running the @clang@ executable for
+    -- preprocessing
+  | PrepareReparsePreprocessorStdout String
+    -- | @stderr@ output resulting from running the @clang@ executable for
+    -- preprocessing
+  | PrepareReparsePreprocessorStderr String
+    -- | Header contents with only the reparse targets cut out
+  | PrepareReparseTempHeaderCutContents String
+
+    -- * Bug
+
+    -- | We tried to run the @clang@ executable to preprocess select macro
+    -- invocations, but it failed to run.
+    --
+    -- The generated Haskell bindings might not fully support macro types as a
+    -- result.
+  | PrepareReparsePreprocessorFailed
+    -- | We tried to single out the interesting lines of code from the
+    -- preprocessor output, but we failed.
+    --
+    -- This can happen only if we fail to find a specific line directive that
+    -- would point out where the interesting lines of code start. This is likely
+    -- a bug in @hs-bindgen@.
+  | PrepareReparseInterpretPreprocessorOutputFailed
+    -- | We failed to parse the preprocessor output
+    --
+    -- This is likely a bug in @hs-bindgen@.
+  | PrepareReparseParsePreprocessorOutputFailed Parsec.ParseError
+  deriving stock Show
+
+instance PrettyForTrace PrepareReparseMsg where
+  prettyForTrace = \case
+      -- * Warning
+
+      PrepareReparseClangExeNotFound -> PP.vsep [
+          PP.hsep [
+              "We could not find @clang@ executable, but we need it to preprocess"
+            , "select macro invocations. Is it missing from the PATH environment"
+            , "variable?"
+            ]
+        , PP.hsep [
+              "The generated Haskell bindings might not fully support macro types as a"
+            , "result."
+            ]
+        ]
+
+      -- * Debug
+
+      PrepareReparseWriteTempHeader path contents -> PP.hsep [
+          "Creating a temporary header file at"
+        , PP.string path
+        , "with contents:"
+        ] PP.$$ PP.string contents
+      PrepareReparsePreprocessorCommand cmd -> PP.hsep [
+          "Running the clang preprocessor with invocation:"
+        , PP.string cmd
+        ]
+      PrepareReparsePreprocessorExitCode ec -> PP.hsep [
+          "The clang preprocessor exited with exit code:"
+        , PP.string (show ec)
+        ]
+      PrepareReparsePreprocessorStdout stdout -> PP.vcat [
+          PP.string "Clang preprocessor stdout:"
+        , PP.string $ if null stdout then "empty" else stdout
+        ]
+      PrepareReparsePreprocessorStderr stderr -> PP.vcat [
+          PP.string "Clang preprocessor stderr:"
+        , PP.string $ if null stderr then "empty" else show stderr
+        ]
+      PrepareReparseTempHeaderCutContents cutContents -> PP.vcat [
+          "Header contents with only the targets cut out:"
+        , PP.string cutContents
+        ]
+
+      -- * Bug
+
+      PrepareReparsePreprocessorFailed -> PP.hsep [
+          "We tried to run the clang executable to preprocess select macro"
+        , "invocations, but it failed to run."
+        ]
+      PrepareReparseInterpretPreprocessorOutputFailed -> PP.hsep [
+          "We failed to single out the interesting lines of code from the"
+        , "preprocessor output."
+        ]
+      PrepareReparseParsePreprocessorOutputFailed e -> PP.hsep [
+          "We failed to parse the preprocessor output:"
+        , PP.string (show e)
+        ]
+
+instance IsTrace Level PrepareReparseMsg where
+  getDefaultLogLevel = \case
+      -- * Warning
+      PrepareReparseClangExeNotFound{} -> Warning
+      -- * Debug
+      PrepareReparseWriteTempHeader{} -> Debug
+      PrepareReparsePreprocessorCommand{} -> Debug
+      PrepareReparsePreprocessorExitCode{} -> Debug
+      PrepareReparsePreprocessorStdout{} -> Debug
+      PrepareReparsePreprocessorStderr{} -> Debug
+      PrepareReparseTempHeaderCutContents{} -> Debug
+      -- * Bug
+      PrepareReparsePreprocessorFailed{} -> Bug
+      PrepareReparseInterpretPreprocessorOutputFailed{} -> Bug
+      PrepareReparseParsePreprocessorOutputFailed{} -> Bug
+  getSource          = const HsBindgen
+  getTraceId         = const "prepare-reparse"
+
+{-------------------------------------------------------------------------------
+  DelayedMsg
+-------------------------------------------------------------------------------}
+
+data DelayedPrepareReparseMsg =
+    -- | Can not expand macro invocations in the given declaration because we
+    -- can not do so unambiguously. This may cause reparsing to fail.
+    PrepareReparseExpansionNotUnique (MultiLoc SourcePath) String
+    -- | Failed to parse the structure of some macro invocations
+  | PrepareReparseMacroInvocationParseFailures (NonEmpty Text)
+    -- | There was no preprocessor output for this declaration
+  | PrepareReparseNoPreprocessorOutput
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace DelayedPrepareReparseMsg where
+  prettyForTrace = \case
+    PrepareReparseExpansionNotUnique loc tokens -> PP.hsep [
+        "Can not expand macro invocations unambiguously,"
+      , "which may cause reparsing to fail. At"
+      , PP.show loc.multiLocExpansion
+      , ":"
+      , PP.show tokens
+      ]
+    PrepareReparseMacroInvocationParseFailures failures -> PP.hsep [
+        "Failed to parse the structure of these macro invocations: "
+      , PP.string (show failures)
+      ]
+    PrepareReparseNoPreprocessorOutput ->
+      "There was no preprocessor output for this declaration"
+
+instance IsTrace Level DelayedPrepareReparseMsg where
+  getDefaultLogLevel = \case
+      PrepareReparseExpansionNotUnique{} -> Info
+      PrepareReparseMacroInvocationParseFailures{} -> Bug
+      PrepareReparseNoPreprocessorOutput{} -> Bug
+  getSource          = const HsBindgen
+  getTraceId         = const "prepare-reparse"
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Lexer.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Lexer.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Lexer.hs
@@ -0,0 +1,54 @@
+-- | Lexers for 'PostHeader'
+--
+-- This module is intended to be imported unqualified. It is also intended to
+-- only be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse"
+-- module hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.Lexer
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.Lexer (
+    lex
+  , Token (..)
+  ) where
+
+import Prelude hiding (lex)
+
+import Control.Applicative (asum)
+import Data.Char (isSpace)
+import Text.Parsec qualified as P
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+lex :: String -> Either P.ParseError [Token]
+lex = run tokenize
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+type Lexer = P.Parsec String ()
+
+run :: Lexer a -> String -> Either P.ParseError a
+run t = P.runParser (t <* P.eof) () "virtual.h"
+
+{-------------------------------------------------------------------------------
+  Tokenizer
+-------------------------------------------------------------------------------}
+
+data Token =
+    BlockCommentOpen
+  | BlockCommentClose
+  | Text String
+  deriving stock (Show, Eq)
+
+tokenize :: Lexer [Token]
+tokenize = P.spaces *> P.many tokenizeOne <* P.spaces
+
+tokenizeOne :: Lexer Token
+tokenizeOne = asum [
+      P.try (BlockCommentOpen <$ P.string "/*" <* P.spaces)
+    , P.try (BlockCommentClose <$ P.string "*/" <* P.spaces)
+    , Text <$> P.many1 (P.satisfy (not . isSpace)) <* P.spaces
+    ]
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Parser.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Parser.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Parser.hs
@@ -0,0 +1,114 @@
+-- | Parsers for 'PostHeader'
+--
+-- This module is intended to be imported unqualified. It is also intended to
+-- only be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse"
+-- module hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.Parser
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.Parser (
+    parse
+  , Parse
+  ) where
+
+
+import Control.Applicative (asum)
+import Data.List qualified as List
+import Text.Parsec qualified as P
+
+import HsBindgen.Frontend.Pass.PrepareReparse.AST (Decl (..),
+                                                   PostHeader (PostHeader),
+                                                   Tag (..), TagName (..),
+                                                   TagType (..), Target (..))
+import HsBindgen.Frontend.Pass.PrepareReparse.Lexer (Token (..))
+import HsBindgen.Imports (void)
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+parse :: Parse a => [Token] -> Either P.ParseError a
+parse = run parseIt
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+type Parser = P.Parsec [Token] ()
+
+run :: Parser a -> [Token] -> Either P.ParseError a
+run p = P.runParser (p <* P.eof) () "virtual.h"
+
+{-------------------------------------------------------------------------------
+  Class
+-------------------------------------------------------------------------------}
+
+class Parse a where
+  parseIt :: Parser a
+
+{-------------------------------------------------------------------------------
+  Instances:
+-------------------------------------------------------------------------------}
+
+instance Parse PostHeader where
+  parseIt = PostHeader <$> parseIt
+
+instance Parse [Target] where
+  parseIt = P.many parseIt
+
+instance Parse Target where
+  parseIt = Target <$> parseIt <*> parseIt <* parseIt @Tag
+
+instance Parse Decl where
+  parseIt = Decl . conc <$> P.many anyText
+    where
+      conc ts = concat $ List.intersperse " " ts
+
+instance Parse Tag where
+  parseIt = blockComment $
+      Tag <$> parseIt <*> parseIt
+
+instance Parse TagType where
+  parseIt = asum [
+        P.try $ Field <$ text "field"
+      , Function <$ text "function"
+      , Typedef <$ text "typedef"
+      , Variable <$ text "variable"
+      ]
+
+instance Parse TagName where
+  parseIt = TagName <$> anyText
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+blockComment :: Parser a -> Parser a
+blockComment = P.between blockCommentOpen blockCommentClose
+
+blockCommentOpen :: Parser ()
+blockCommentOpen = void $ satisfy (==BlockCommentOpen)
+
+blockCommentClose :: Parser ()
+blockCommentClose = void $ satisfy (==BlockCommentClose)
+
+text :: String -> Parser String
+text s1 = myToken $ \case
+    Text s2 | s1 == s2 -> Just s1
+    _                  -> Nothing
+
+anyText :: Parser String
+anyText = myToken $ \case
+    Text s -> Just s
+    _ -> Nothing
+
+satisfy :: (Token -> Bool) -> Parser Token
+satisfy p = myToken $ \x ->
+    if p x then Just x else Nothing
+
+myToken :: (Token -> Maybe a) -> Parser a
+myToken f = P.tokenPrim showTok nextPos testTok
+   where
+     showTok x  = show x
+     nextPos pos _x _ = P.incSourceColumn pos 1
+     testTok x  = f x
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Preprocessor.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Preprocessor.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Preprocessor.hs
@@ -0,0 +1,50 @@
+-- | Run the @clang@ executable's preprocessor
+--
+-- This module is intended to be imported unqualified. It is also intended to
+-- only be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse"
+-- module hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.Preprocessor
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.Preprocessor (
+    preprocess
+  ) where
+
+import GHC.IO.Exception (ExitCode (ExitFailure, ExitSuccess))
+import System.Process (readProcessWithExitCode, showCommandForUser)
+
+import Clang.Args (ClangArgs (unClangArgs))
+import Clang.Discover (ClangExe)
+
+import HsBindgen.Clang (ClangSetup (args))
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass (PrepareReparse)
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg (PrepareReparseMsg (..))
+import HsBindgen.Frontend.Pass.PrepareReparse.Tracer (traceImmediate)
+import HsBindgen.Imports (Exception)
+import HsBindgen.IR.Pass (PassMsg (Msg))
+import HsBindgen.Util.Tracer (Tracer)
+
+preprocess ::
+     Tracer (Msg PrepareReparse)
+  -> ClangExe
+  -> ClangSetup
+  -> FilePath
+  -> IO (Either PreprocessorError String)
+preprocess tr clangExe setup headerPath = do
+    traceImmediate tr $ PrepareReparsePreprocessorCommand (showCommandForUser clangExe args)
+    (ex, stdout, stderr) <- runClangExecutable clangExe args ""
+    traceImmediate tr $ PrepareReparsePreprocessorExitCode ex
+    traceImmediate tr $ PrepareReparsePreprocessorStdout stdout
+    traceImmediate tr $ PrepareReparsePreprocessorStderr stderr
+    case ex of
+      ExitSuccess -> pure $ Right stdout
+      ExitFailure n -> pure $ Left (PreprocessorError n stderr)
+  where
+    args = setup.args.unClangArgs ++ ["-E", "-C",  headerPath]
+
+data PreprocessorError = PreprocessorError Int String
+  deriving stock Show
+  deriving anyclass Exception
+
+runClangExecutable :: FilePath -> [String] -> String -> IO (ExitCode, String, String)
+runClangExecutable = readProcessWithExitCode
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Printer.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Printer.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Printer.hs
@@ -0,0 +1,104 @@
+-- | Printers for 'PreHeader'
+--
+-- This module is intended to be imported unqualified. It is also intended to only
+-- be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse" module
+-- hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.Printer
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.Printer (
+    print
+  , Print
+  ) where
+
+import Prelude hiding (print)
+
+import HsBindgen.Frontend.Pass.PrepareReparse.AST (Decl (..), Include (..),
+                                                   MacroName (..),
+                                                   PreHeader (include, targets, undefs),
+                                                   Tag (..), TagName (..),
+                                                   TagType (..), Target (..),
+                                                   Undef (..))
+import HsBindgen.Frontend.Pass.PrepareReparse.Printer.Util qualified as P
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+print :: Print a => a -> ShowS
+print = printIt
+
+{-------------------------------------------------------------------------------
+  Class
+-------------------------------------------------------------------------------}
+
+class Print a where
+  printIt :: a -> ShowS
+
+{-------------------------------------------------------------------------------
+  Instances
+-------------------------------------------------------------------------------}
+
+instance Print PreHeader where
+  printIt header = P.compose [
+        printIt header.include
+      , printIt header.undefs
+      , printIt header.targets
+      ]
+
+instance Print Include where
+  printIt (Include path) = P.compose [
+        P.include
+      , P.space
+      , showChar '"'
+      , showString path
+      , showChar '"'
+      , P.newline
+      ]
+
+instance Print [Undef] where
+  printIt xs = P.compose [
+        printIt x . P.newline
+      | x <- xs
+      ]
+
+instance Print Undef where
+  printIt (Undef name) =
+      P.undef . P.space . printIt name . P.newline
+
+instance Print MacroName where
+  printIt (MacroName s) = P.string s
+
+instance Print [Target] where
+  printIt xs = P.compose [
+        printIt x . P.newline
+      | x <- xs
+      ]
+
+instance Print Target where
+  printIt (Target tag decl) =
+    printIt tag . P.space . printIt decl . P.space . printIt tag
+
+instance Print Decl where
+  printIt (Decl code) = showString code
+
+instance Print Tag where
+  printIt (Tag typ name) = P.compose [
+        showString "/*"
+      , P.space
+      , printIt typ
+      , P.space
+      , printIt name
+      , P.space
+      , showString "*/"
+      ]
+
+instance Print TagType where
+  printIt = \case
+      Field -> P.string "field"
+      Function -> P.string "function"
+      Typedef -> P.string "typedef"
+      Variable -> P.string "variable"
+
+instance Print TagName where
+  printIt (TagName s) = P.string s
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Printer/Util.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Printer/Util.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Printer/Util.hs
@@ -0,0 +1,81 @@
+-- | Utilities for pretty-printing
+--
+-- This module is intended to be imported qualified. It is also intended to only
+-- be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse" module
+-- hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.Printer.Util qualified as P
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.Printer.Util (
+    -- * Combinators
+    compose
+  , string
+    -- * Whitespace
+  , space
+  , newline
+    -- * Interpunction
+  , semicolon
+  , dot
+    -- * C directives
+  , undef
+  , include
+    -- * C names
+  , name
+  , fieldName
+  ) where
+
+import Data.Text qualified as Text
+import GHC.Show (showSpace)
+
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass (TypecheckMacros)
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Combinators
+-------------------------------------------------------------------------------}
+
+compose :: [ShowS] -> ShowS
+compose xs = foldr (.) id xs
+
+string :: String -> ShowS
+string = showString
+
+{-------------------------------------------------------------------------------
+  Whitespace
+-------------------------------------------------------------------------------}
+
+space :: ShowS
+space = showSpace
+
+newline :: ShowS
+newline = showChar '\n'
+
+{-------------------------------------------------------------------------------
+  Interpunction
+-------------------------------------------------------------------------------}
+
+semicolon :: ShowS
+semicolon = showChar ';'
+
+dot :: ShowS
+dot = showChar '.'
+
+{-------------------------------------------------------------------------------
+  C directives
+-------------------------------------------------------------------------------}
+
+undef :: ShowS
+undef = showString "#undef"
+
+include :: ShowS
+include = showString "#include"
+
+{-------------------------------------------------------------------------------
+  C names
+-------------------------------------------------------------------------------}
+
+name :: C.DeclInfo TypecheckMacros -> ShowS
+name info = showString (Text.unpack info.id.name.text)
+
+fieldName :: C.FieldInfo TypecheckMacros -> ShowS
+fieldName info = showString (Text.unpack info.name.text)
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Simplifier.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Simplifier.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Simplifier.hs
@@ -0,0 +1,183 @@
+-- | Simplifiers for 'PreHeader'
+--
+-- This module is intended to be imported unqualified. It is also intended to only
+-- be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse" module
+-- hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.Simplifier
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.Simplifier (
+    simplify
+  , Simplify
+    -- * Tags
+  , fieldTag
+  , functionTag
+  , typedefTag
+  , variableTag
+  ) where
+
+import Prelude hiding (print)
+
+import Data.Either
+import Data.Kind
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.PrepareReparse.AST
+import HsBindgen.Frontend.Pass.PrepareReparse.Flatten
+import HsBindgen.Frontend.Pass.PrepareReparse.Printer.Util qualified as P
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro.Flip
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+simplify :: Simplify a => Ctx a -> a TypecheckMacros -> Simple a
+simplify = simplifyIt
+
+{-------------------------------------------------------------------------------
+  Class
+-------------------------------------------------------------------------------}
+
+class Simplify a where
+  type Ctx a :: Type
+  type Ctx a = C.DeclInfo TypecheckMacros
+  type Simple a :: Type
+  type Simple a = [Either Undef Target]
+  simplifyIt :: Ctx a -> a TypecheckMacros -> Simple a
+
+{-------------------------------------------------------------------------------
+  Instances
+-------------------------------------------------------------------------------}
+
+instance Simplify (C.TranslationUnit l) where
+  type Ctx    (C.TranslationUnit l) = ()
+  type Simple (C.TranslationUnit l) = (Include -> PreHeader)
+  simplifyIt _ (unit) = \include -> PreHeader {
+        include = include
+      , undefs  = undefs
+      , targets = targets
+      }
+    where
+      (undefs, targets) =
+        partitionEithers $ concatMap recurse unit.decls
+      recurse = simplifyIt ()
+
+instance Simplify (C.Decl l) where
+  type Ctx (C.Decl l) = ()
+  simplifyIt _ decl = case decl.kind of
+      C.DeclStruct struct          -> recurse struct
+      C.DeclUnion union            -> recurse union
+      C.DeclTypedef typedef        -> recurse typedef
+      C.DeclEnum enum              -> recurse enum
+      C.DeclUntaggedEnumConstant c -> recurse c
+      C.DeclOpaque{}               -> nothing
+      C.DeclMacro macro            -> recurse $ Flip macro
+      C.DeclFunction function      -> recurse function
+      C.DeclGlobal global          -> recurse global
+    where
+      recurse :: forall a.
+           (Simplify a, Ctx a ~ C.DeclInfo TypecheckMacros)
+        => a TypecheckMacros
+        -> Simple a
+      recurse = simplifyIt decl.info
+
+instance Simplify C.Struct where
+  simplifyIt info struct =
+      concatMap (simplifyIt info) struct.fields ++
+      foldMap (simplifyIt info) (C.flamStructField struct.flam)
+
+instance Simplify C.Union where
+  simplifyIt info union = concatMap (simplifyIt info) union.fields
+
+instance Simplify C.Field where
+  simplifyIt info = C.elimField (simplifyIt info) (simplifyIt info)
+
+instance Simplify C.RegularField where
+  simplifyIt info field = case field.ann of
+        ReparseNotNeeded -> nothing
+        ReparseNeeded tokens _macroInvs -> singleTarget $
+          Target (fieldTag info field.info) (defaultDecl tokens)
+
+instance Simplify C.ImplicitField where
+  simplifyIt info field = concatMap (simplifyIt info) field.indirect
+
+instance Simplify C.IndirectField where
+  simplifyIt info field = case field.ann of
+        ReparseNotNeeded -> nothing
+        ReparseNeeded tokens _macroInvs -> singleTarget $
+          Target (fieldTag info field.info) (defaultDecl tokens)
+
+instance Simplify C.Typedef where
+  simplifyIt info typedef = case typedef.ann of
+      ReparseNotNeeded -> nothing
+      ReparseNeeded tokens _macroInvs -> singleTarget $
+        Target (typedefTag info) (defaultDecl tokens)
+
+instance Simplify C.Enum where
+  simplifyIt _ _ = nothing
+
+instance Simplify C.UntaggedEnumConstant where
+  simplifyIt _ _ = nothing
+
+instance Simplify (Flip TypecheckedMacro l) where
+  simplifyIt info (Flip m) = case m of
+    MacroType{}  -> singleUndef $ Undef (MacroName (P.name info ""))
+    MacroValue{} -> nothing
+
+instance Simplify C.Function where
+  simplifyIt info function = case function.ann of
+      ReparseNotNeeded -> nothing
+      ReparseNeeded tokens _macroInvs -> singleTarget $
+        Target (functionTag info) (functionDecl tokens)
+
+instance Simplify C.Global where
+  simplifyIt info global = case global.ann of
+      ReparseNotNeeded -> nothing
+      ReparseNeeded tokens _macroInvs -> singleTarget $
+        Target (variableTag info) (defaultDecl tokens)
+
+{-------------------------------------------------------------------------------
+  Lift into Simple
+-------------------------------------------------------------------------------}
+
+nothing :: [Either Undef Target]
+nothing = []
+
+singleTarget :: Target -> [Either Undef Target]
+singleTarget t = [Right t]
+
+singleUndef :: Undef -> [Either Undef Target]
+singleUndef u = [Left u]
+
+{-------------------------------------------------------------------------------
+  Decls
+-------------------------------------------------------------------------------}
+
+defaultDecl :: [Token SourcePath TokenSpelling] -> Decl
+defaultDecl tokens = Decl $ flattenDefault tokens
+
+functionDecl :: [Token SourcePath TokenSpelling] -> Decl
+functionDecl tokens = Decl $ flattenFunction tokens
+
+{-------------------------------------------------------------------------------
+  Tags
+-------------------------------------------------------------------------------}
+
+fieldTag :: C.DeclInfo TypecheckMacros -> C.FieldInfo TypecheckMacros -> Tag
+fieldTag info fieldInfo = Tag Field (TagName name)
+  where
+    name = P.name info  . P.dot . P.fieldName fieldInfo $ ""
+
+functionTag :: C.DeclInfo TypecheckMacros -> Tag
+functionTag info = Tag Function (TagName (P.name info ""))
+
+typedefTag :: C.DeclInfo TypecheckMacros -> Tag
+typedefTag info = Tag Typedef (TagName (P.name info ""))
+
+variableTag :: C.DeclInfo TypecheckMacros -> Tag
+variableTag info = Tag Variable (TagName (P.name info ""))
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Tracer.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Tracer.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Tracer.hs
@@ -0,0 +1,18 @@
+-- | Tracing
+--
+-- This module is intended to be imported unqualified. It is also intended to
+-- only be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse"
+-- module hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.Tracer
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.Tracer (
+    traceImmediate
+  ) where
+
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass (PrepareReparse)
+import HsBindgen.IR.Pass (PassMsg (Msg))
+import HsBindgen.Util.Tracer (Tracer, traceWith, withCallStack)
+
+traceImmediate :: Tracer (Msg PrepareReparse) -> Msg PrepareReparse -> IO ()
+traceImmediate tracer msg = traceWith tracer $ withCallStack msg
diff --git a/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Update.hs b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Update.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/PrepareReparse/Update.hs
@@ -0,0 +1,313 @@
+-- | Updater for 'ReparseInfo' after preprocessing
+--
+-- This module is intended to be imported unqualified. It is also intended to
+-- only be imported from within the "HsBindgen.Frontend.Pass.PrepareReparse"
+-- module hierarchy.
+--
+-- > import HsBindgen.Frontend.Pass.PrepareReparse.Update
+--
+module HsBindgen.Frontend.Pass.PrepareReparse.Update (
+    UpdateMode (..)
+  , update
+  ) where
+
+import Prelude hiding (lex, print)
+
+import Control.Monad (forM_)
+import Control.Monad.Reader (MonadReader (ask), ReaderT (..))
+import Control.Monad.State (MonadState, State, modify, runState)
+import Data.Kind
+import Data.List.NonEmpty (NonEmpty)
+import Data.List.NonEmpty qualified as NE
+import Data.Map.Lazy qualified as Map
+
+import Clang.HighLevel.Types qualified as Clang
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis.DeclIndex
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.PrepareReparse.AST
+import HsBindgen.Frontend.Pass.PrepareReparse.Flatten
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg
+import HsBindgen.Frontend.Pass.PrepareReparse.Simplifier
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports (Map, mapMaybe)
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Flip
+import HsBindgen.Macro.Syntax (MacroInvocation)
+import HsBindgen.Macro.UniqueExpansion
+import HsBindgen.Macro.UniqueExpansion.Types (Ambiguity, Name)
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+data UpdateMode =
+    UpdateOnlyFlatten
+  | UpdatePreprocessAndFlatten (Map Tag Decl)
+
+update ::
+     forall l.
+     UpdateMode
+  -> C.TranslationUnit l TypecheckMacros
+  -> C.TranslationUnit l PrepareReparse
+update mode unit = unit'
+  where
+    (unitUpdated, delayedMsgs) = runM env $ updateIt () unit
+
+    unit' = unitUpdated {
+          C.meta = meta'
+        }
+    meta' = unitUpdated.meta {
+          declIndex = declIndex'
+        }
+
+    declIndex' ::  DeclIndex l
+    declIndex' =
+      -- We use @foldr@ here to establish the original order of messages
+      foldr
+        DeclIndex.registerDelayedPrepareReparseMsg
+        unit.meta.declIndex
+        delayedMsgs
+
+    env :: Env
+    env = Env{
+        updateMode  = mode
+      , ambiguityOf = (`DeclIndex.lookupAmbiguity` unit.meta.declIndex)
+      }
+
+{-------------------------------------------------------------------------------
+  Update: class
+-------------------------------------------------------------------------------}
+
+class Update a where
+  type Ctx a :: Type
+  type Ctx a = C.DeclInfo TypecheckMacros
+  updateIt :: Ctx a -> a TypecheckMacros -> M (a PrepareReparse)
+
+{-------------------------------------------------------------------------------
+  Update: monad
+-------------------------------------------------------------------------------}
+
+runM :: Env -> M a -> (a, [(C.DeclId, DelayedPrepareReparseMsg)])
+runM m (M k) = fmap (.messages) $ runState (runReaderT k m) (St [])
+
+newtype M a = M (ReaderT Env (State St) a)
+  deriving newtype (Functor, Applicative, Monad)
+
+deriving newtype instance MonadReader Env M
+deriving newtype instance MonadState St M
+
+data Env = Env {
+    updateMode  :: UpdateMode
+  , ambiguityOf :: Name -> Ambiguity
+  }
+
+newtype St = St {
+    messages :: [(C.DeclId, DelayedPrepareReparseMsg)]
+  }
+
+{-------------------------------------------------------------------------------
+  Update: instances
+-------------------------------------------------------------------------------}
+
+instance Update (C.TranslationUnit l) where
+  type Ctx (C.TranslationUnit l) = ()
+  updateIt _ unit = do
+      decls' <- mapM (updateIt ()) unit.decls
+      pure C.TranslationUnit{
+          decls        = decls'
+        , includeGraph = unit.includeGraph
+        , meta         = unit.meta
+        }
+
+instance Update (C.Decl l) where
+  type Ctx (C.Decl l) = ()
+  updateIt _ decl = do
+      kind' <- (updateIt decl.info) decl.kind
+      pure C.Decl {
+          info = coercePass decl.info
+        , kind = kind'
+        , ann  = decl.ann
+        }
+
+instance Update (C.DeclKind l) where
+  updateIt info declKind = case declKind of
+      C.DeclStruct struct          -> C.DeclStruct               <$> recurse struct
+      C.DeclUnion union            -> C.DeclUnion                <$> recurse union
+      C.DeclTypedef typedef        -> C.DeclTypedef              <$> recurse typedef
+      C.DeclEnum enum              -> C.DeclEnum                 <$> recurse enum
+      C.DeclUntaggedEnumConstant c -> C.DeclUntaggedEnumConstant <$> recurse c
+      C.DeclOpaque mSize           -> pure (C.DeclOpaque mSize)
+      C.DeclMacro macro            -> C.DeclMacro                <$> (flipM recurse) macro
+      C.DeclFunction function      -> C.DeclFunction             <$> recurse function
+      C.DeclGlobal global          -> C.DeclGlobal               <$> recurse global
+    where
+      recurse :: forall a.
+           (Update a, Ctx a ~ C.DeclInfo TypecheckMacros)
+        => a TypecheckMacros
+        -> M (a PrepareReparse)
+      recurse = updateIt info
+
+instance Update C.Struct where
+  updateIt info struct = do
+      fields' <- mapM (updateIt info) struct.fields
+      flam' <- C.traverseFlamField (updateIt info) struct.flam
+      pure C.Struct {
+          sizeof    = struct.sizeof
+        , alignment = struct.alignment
+        , fields    = fields'
+        , flam      = flam'
+        , ann       = struct.ann
+        }
+
+
+instance Update C.Union where
+  updateIt info union = do
+      fields' <- mapM (updateIt info) union.fields
+      pure C.Union {
+          sizeof    = union.sizeof
+        , alignment = union.alignment
+        , fields    = fields'
+        , ann       = union.ann
+        }
+
+instance Update C.Field where
+  updateIt info = C.mapMField (updateIt info) (updateIt info)
+
+instance Update C.RegularField where
+  updateIt info field = do
+      ann' <- updateReparseInfo info (fieldTag info field.info) field.ann
+      pure C.RegularField {
+          info   = coercePass field.info
+        , typ    = coercePass field.typ
+        , offset = field.offset
+        , width  = field.width
+        , ann    = ann'
+        }
+
+instance Update C.ImplicitField where
+  updateIt info field = do
+      indirect' <- mapM (updateIt info) field.indirect
+      pure C.ImplicitField {
+          info     = coercePass field.info
+        , typRef   = coercePass field.typRef
+        , offset   = field.offset
+        , indirect = indirect'
+        , ann      = field.ann
+        }
+
+instance Update C.IndirectField where
+  updateIt info field = do
+      ann' <- updateReparseInfo info (fieldTag info field.info) field.ann
+      pure C.IndirectField {
+          info   = coercePass field.info
+        , typ    = coercePass field.typ
+        , offset = field.offset
+        , width  = field.width
+        , path   = fmap coercePass field.path
+        , ann    = ann'
+        }
+
+instance Update C.Typedef where
+  updateIt info typedef = do
+      ann' <- updateReparseInfo info (typedefTag info) typedef.ann
+      pure C.Typedef {
+          typ = coercePass typedef.typ
+        , ann = ann'
+        }
+
+instance Update C.Enum where
+  updateIt _ enum = pure $ coercePass enum
+
+instance Update C.UntaggedEnumConstant where
+  updateIt _ constant = pure $ coercePass constant
+
+instance Update (Flip TypecheckedMacro l) where
+  updateIt _info (Flip macro) = pure $ Flip $ coercePassParam macro
+
+instance Update C.Function where
+  updateIt info function = do
+      ann' <- updateReparseInfo info (functionTag info) function.ann
+      pure C.Function {
+          args = map coercePass function.args
+        , res = coercePass function.res
+        , attrs = function.attrs
+        , ann = ann'
+        }
+
+instance Update C.Global where
+  updateIt info global = do
+      ann' <- updateReparseInfo info (variableTag info) global.ann
+      pure C.Global {
+          typ = coercePass global.typ
+        , ann = ann'
+        }
+
+updateReparseInfo ::
+     C.DeclInfo TypecheckMacros
+  -> Tag
+  -> ReparseInfo Tokens
+  -> M (ReparseInfo FlatTokens)
+updateReparseInfo info tag@(Tag typ _) reparseInfo = do
+    case reparseInfo of
+      ReparseNotNeeded -> pure ReparseNotNeeded
+      ReparseNeeded tokens macroInvs -> goReparseNeeded tokens macroInvs
+  where
+    goReparseNeeded :: Tokens -> NonEmpty MacroInvocation -> M (ReparseInfo FlatTokens)
+    goReparseNeeded tokens macroInvs = do
+        env <- ask
+        case env.updateMode of
+          UpdateOnlyFlatten -> pure fallback
+          UpdatePreprocessAndFlatten preprocessedMap -> do
+            forM_ failuresMay $ \failures ->
+              addMessage info.id (PrepareReparseMacroInvocationParseFailures failures)
+            if all (isExpansionUnique env.ambiguityOf) parseResults then do
+              case Map.lookup tag preprocessedMap of
+                Nothing -> do
+                  addMessage info.id PrepareReparseNoPreprocessorOutput
+                  pure fallback
+                Just (Decl preppedTokens) ->
+                  pure $ ReparseNeeded (mkFlatTokens preppedTokens) macroInvs
+            else do
+              addMessage info.id $
+                PrepareReparseExpansionNotUnique fallbackTokens.locStart fallbackTokens.flatten
+              pure fallback
+      where
+        fallback :: ReparseInfo FlatTokens
+        fallback = mkReparseNeeded fallbackTokens
+
+        fallbackTokens :: FlatTokens
+        fallbackTokens = mkFlatTokens $ case typ of
+            Function -> flattenFunction tokens
+            _        -> flattenDefault tokens
+
+        mkReparseNeeded :: FlatTokens -> ReparseInfo FlatTokens
+        mkReparseNeeded flatTokens = ReparseNeeded flatTokens macroInvs
+
+        mkFlatTokens :: String -> FlatTokens
+        mkFlatTokens flatten = FlatTokens {
+              flatten = flatten
+            , locStart = getLocation tokens
+            }
+
+        parseResults = fmap parseInvocation macroInvs
+        failuresMay = NE.nonEmpty $ mapMaybe isFailure $ NE.toList parseResults
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+getLocation :: [Clang.Token Clang.SourcePath a] -> Clang.MultiLoc Clang.SourcePath
+getLocation []    = panicPure "Unexpected empty list of tokens"
+getLocation (t:_) = Clang.rangeStart $ Clang.tokenExtent t
+
+addMessage :: C.DeclId -> DelayedPrepareReparseMsg -> M ()
+addMessage did msg = modify $ \st -> st {
+      messages = (did, msg) : st.messages
+    }
diff --git a/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions.hs b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions.hs
@@ -0,0 +1,519 @@
+module HsBindgen.Frontend.Pass.ReparseMacroExpansions (
+    reparseMacroExpansions
+  ) where
+
+import Control.Monad.Reader (MonadReader (..), Reader, runReader)
+import Control.Monad.State (MonadState, StateT, modify, runStateT)
+import Data.Foldable qualified as Foldable
+import Data.Map qualified as Map
+import Data.Set qualified as Set
+
+import Clang.CStandard (ClangCStandard)
+
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Analysis.DeclUseGraph (DeclUseGraph)
+import HsBindgen.Frontend.Analysis.DeclUseGraph qualified as DeclUseGraph
+import HsBindgen.Frontend.Analysis.UseDeclGraph qualified as UseDeclGraph
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.LanguageC qualified as LanC
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.ForgetAnn (ForgetAnn (forgetAnn))
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass (ReparseMacroExpansions)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.Msg
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC (LanC)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.Zip
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+-- | Reparse declarations that have macro expansions in their type positions,
+-- using the known-types environment from 'typecheckMacros'.
+reparseMacroExpansions ::
+     forall l.
+     ClangCStandard
+  -> Map LanC.CName (C.Type PrepareReparse)
+     -- ^ Known non-macro names and their types (see 'ReparseEnv')
+  -> Set LanC.CName
+     -- ^ Known macro names (see 'ReparseEnv')
+  -> C.TranslationUnit l PrepareReparse
+  -> C.TranslationUnit l ReparseMacroExpansions
+reparseMacroExpansions cStd knownNonMacroTypes knownMacros unit =
+    let (reparsedDecls, reparseState) =
+          runM
+            cStd
+            (Map.map coercePass knownNonMacroTypes)
+            knownMacros
+            (mapM reparseDecl unit.decls)
+    in  C.TranslationUnit{
+            decls        = reparsedDecls
+          , includeGraph = unit.includeGraph
+          , meta         = updateMeta reparseState.reparseWarnings reparsedDecls unit.meta
+          }
+
+updateMeta ::
+     forall l.
+     [(C.DeclId, DelayedReparseMacroExpansionsMsg)]
+  -> [C.Decl l ReparseMacroExpansions]
+  -> DeclMeta l
+  -> DeclMeta l
+updateMeta msgs decls meta = DeclMeta{
+      declIndex    = updatedDeclIndex
+    , useDeclGraph = UseDeclGraph.fromDeclUseGraph updatedDeclUseGraph
+    , declUseGraph = updatedDeclUseGraph
+    }
+  where
+    updatedDeclIndex :: DeclIndex l
+    updatedDeclIndex =
+      -- We use @foldr@ here to establish the original order of reparse
+      -- warnings.
+      foldr
+        DeclIndex.registerDelayedReparseMacroExpansionsMsg
+        meta.declIndex
+        [ (declId, msg)
+        | (declId, msg) <- msgs
+        ]
+
+    updatedDeclUseGraph :: DeclUseGraph
+    updatedDeclUseGraph =
+      Foldable.foldl'
+        (flip updateDeps)
+        meta.declUseGraph
+        decls
+
+-- | Dependencies before reparse may point to underlying types. These have to be
+-- replaced with their actual dependencies after reparse+zip.
+--
+-- For example,
+--
+-- @
+-- // c_header.h
+-- typedef int A;
+-- #define B A
+-- void foo(B x);
+-- @
+--
+-- Before reparse, @foo@ directly depends on @A@. After reparse+zip, we know
+-- that @foo@ depends on @B@. We have to cut the dependency to @A@ and
+-- replace it with the dependency to @B@.
+updateDeps ::
+     C.Decl l ReparseMacroExpansions
+  -> DeclUseGraph
+  -> DeclUseGraph
+updateDeps decl graph =
+    DeclUseGraph.insertDepsOfDecl decl $
+      DeclUseGraph.deleteDeps (Set.singleton decl.info.id) graph
+
+{-------------------------------------------------------------------------------
+  Reparse declarations with macro expansions
+-------------------------------------------------------------------------------}
+
+reparseDecl ::
+     C.Decl l PrepareReparse
+  -> M (C.Decl l ReparseMacroExpansions)
+reparseDecl decl = case decl.kind of
+    C.DeclMacro macro                    -> processMacro                info' macro
+    C.DeclTypedef typedef                -> processTypedef              info' typedef
+    C.DeclStruct struct                  -> processStruct               info' struct
+    C.DeclUnion union                    -> processUnion                info' union
+    C.DeclEnum enum                      -> processEnum                 info' enum
+    C.DeclUntaggedEnumConstant enumConst -> processUntaggedEnumConstant info' enumConst
+    C.DeclOpaque mSize                   -> processOpaque               info' (C.DeclOpaque mSize)
+    C.DeclFunction fun                   -> processFunction             info' fun
+    C.DeclGlobal global                  -> processGlobal               info' global
+  where
+    info' :: C.DeclInfo ReparseMacroExpansions
+    info' = coercePass decl.info
+
+{-------------------------------------------------------------------------------
+  Function for each kind of declaration
+-------------------------------------------------------------------------------}
+
+-- | Macros have already been type-checked; just coerce the pass annotation.
+processMacro ::
+     C.DeclInfo ReparseMacroExpansions
+  -> TypecheckedMacro PrepareReparse l
+  -> M (C.Decl l ReparseMacroExpansions)
+processMacro info macro =
+    pure C.Decl{
+        info = info
+      , ann  = NoAnn
+      , kind = C.DeclMacro (coercePassParam macro)
+      }
+
+processStruct ::
+     C.DeclInfo ReparseMacroExpansions
+  -> C.Struct PrepareReparse
+  -> M (C.Decl l ReparseMacroExpansions)
+processStruct info struct = do
+    mkDecl
+      <$> mapM (processField info.id) struct.fields
+      <*> C.traverseFlamField (processRegularField info.id) struct.flam
+  where
+    mkDecl ::
+         [C.Field ReparseMacroExpansions]
+      -> C.Flam ReparseMacroExpansions
+      -> C.Decl l ReparseMacroExpansions
+    mkDecl fields flam = C.Decl{
+          info = info
+        , ann  = NoAnn
+        , kind = C.DeclStruct C.Struct{
+              fields    = fields
+            , flam      = flam
+            , sizeof    = struct.sizeof
+            , alignment = struct.alignment
+            , ann       = struct.ann
+            }
+        }
+
+processUnion ::
+     C.DeclInfo ReparseMacroExpansions
+  -> C.Union PrepareReparse
+  -> M (C.Decl l ReparseMacroExpansions)
+processUnion info union = do
+    combineFields <$> mapM (processField info.id) union.fields
+  where
+    combineFields ::
+         [C.Field ReparseMacroExpansions]
+      -> C.Decl l ReparseMacroExpansions
+    combineFields fields = C.Decl{
+          info = info
+        , ann  = NoAnn
+        , kind = C.DeclUnion C.Union{
+              fields    = fields
+            , sizeof    = union.sizeof
+            , alignment = union.alignment
+            , ann       = union.ann
+            }
+        }
+
+-- | Reconstruct a 'C.FieldInfo' after reparsing.
+--
+-- When @mName@ is 'Nothing', the original name is preserved; when it is
+-- 'Just', the reparsed name replaces it.
+mkFieldInfo ::
+     C.FieldInfo PrepareReparse
+  -> Maybe Text
+  -> C.FieldInfo LanC
+mkFieldInfo info mName = C.FieldInfo{
+      name    = maybe info.name C.ScopedName mName
+    , comment = fmap coercePass info.comment
+    , loc     = info.loc
+    }
+
+processField ::
+     C.DeclId
+  -> C.Field PrepareReparse
+  -> M (C.Field ReparseMacroExpansions)
+processField declId = \case
+    C.FieldRegular  field -> C.FieldRegular  <$> processRegularField declId field
+    C.FieldImplicit field -> C.FieldImplicit <$> processImplicitField declId field
+
+processRegularField ::
+     C.DeclId
+  -> C.RegularField PrepareReparse
+  -> M (C.RegularField ReparseMacroExpansions)
+processRegularField declId field =
+    reparseWith declId LanC.reparseField field.ann withoutReparse withReparse
+  where
+    withoutReparse :: C.RegularField PrepareReparse
+    withoutReparse = field
+
+    withReparse :: (C.Type LanC, Text) -> M (C.RegularField LanC)
+    withReparse (ty, name) = pure C.RegularField{
+          info   = mkFieldInfo field.info (Just name)
+        , typ    = ty
+        , offset = field.offset
+        , width  = field.width
+        , ann    = NoAnn
+        }
+
+processImplicitField ::
+     C.DeclId
+  -> C.ImplicitField PrepareReparse
+  -> M (C.ImplicitField ReparseMacroExpansions)
+processImplicitField declId field = do
+    indirect' <- mapM (processIndirectField declId) field.indirect
+    pure C.ImplicitField {
+        info     = coercePass field.info
+      , typRef   = coercePass field.typRef
+      , offset   = field.offset
+      , indirect = indirect'
+      , ann      = field.ann
+      }
+
+processIndirectField ::
+     C.DeclId
+  -> C.IndirectField PrepareReparse
+  -> M (C.IndirectField ReparseMacroExpansions)
+processIndirectField declId field =
+    reparseWith declId LanC.reparseField field.ann withoutReparse withReparse
+  where
+    withoutReparse :: C.IndirectField PrepareReparse
+    withoutReparse = field
+
+    withReparse :: (C.Type LanC, Text) -> M (C.IndirectField LanC)
+    withReparse (ty, name) = pure C.IndirectField{
+          info   = mkFieldInfo field.info (Just name)
+        , typ    = ty
+        , offset = field.offset
+        , width  = field.width
+        , path   = fmap coercePass field.path
+        , ann    = NoAnn
+        }
+
+processOpaque ::
+     C.DeclInfo ReparseMacroExpansions
+  -> C.DeclKind l ReparseMacroExpansions
+  -> M (C.Decl l ReparseMacroExpansions)
+processOpaque info kind =
+    pure C.Decl{
+        info = info
+      , kind = kind
+      , ann  = NoAnn
+      }
+
+processEnum ::
+     C.DeclInfo ReparseMacroExpansions
+  -> C.Enum PrepareReparse
+  -> M (C.Decl l ReparseMacroExpansions)
+processEnum info enum =
+    mkDecl <$> mapM processEnumConstant enum.constants
+  where
+    mkDecl ::
+         [C.EnumConstant ReparseMacroExpansions]
+      -> C.Decl l ReparseMacroExpansions
+    mkDecl enumerators = C.Decl{
+          info = info
+        , ann  = NoAnn
+        , kind = C.DeclEnum C.Enum{
+              typ       = coercePass enum.typ
+            , constants = enumerators
+            , sizeof    = enum.sizeof
+            , alignment = enum.alignment
+            , ann       = NoAnn
+            }
+        }
+
+processUntaggedEnumConstant ::
+     C.DeclInfo ReparseMacroExpansions
+  -> C.UntaggedEnumConstant PrepareReparse
+  -> M (C.Decl l ReparseMacroExpansions)
+processUntaggedEnumConstant info enumConst =
+    mkDecl <$> processEnumConstant enumConst.constant
+  where
+    mkDecl ::
+         C.EnumConstant ReparseMacroExpansions
+      -> C.Decl l ReparseMacroExpansions
+    mkDecl constant = C.Decl{
+          info = info
+        , ann  = NoAnn
+        , kind = C.DeclUntaggedEnumConstant C.UntaggedEnumConstant{
+              typ      = enumConst.typ
+            , constant = constant
+            }
+        }
+
+processEnumConstant ::
+     C.EnumConstant PrepareReparse
+  -> M (C.EnumConstant ReparseMacroExpansions)
+processEnumConstant constant =
+    pure C.EnumConstant{
+        value = constant.value
+      , info  = C.FieldInfo{
+            comment = fmap coercePass constant.info.comment
+          , name    = constant.info.name
+          , loc     = constant.info.loc
+          }
+      }
+
+processTypedef ::
+     C.DeclInfo ReparseMacroExpansions
+  -> C.Typedef PrepareReparse
+  -> M (C.Decl l ReparseMacroExpansions)
+processTypedef info typedef = do
+    typedef' <- reparseWith info.id LanC.reparseTypedef typedef.ann withoutReparse withReparse
+    pure C.Decl{
+        info = info
+      , ann  = NoAnn
+      , kind = C.DeclTypedef typedef'
+      }
+  where
+    withoutReparse :: C.Typedef PrepareReparse
+    withoutReparse = typedef
+
+    withReparse ::
+         C.Type LanC
+      -> M (C.Typedef LanC)
+    withReparse typ' = pure C.Typedef{
+          typ = typ'
+        , ann = NoAnn
+        }
+
+processFunction ::
+     C.DeclInfo ReparseMacroExpansions
+  -> C.Function PrepareReparse
+  -> M (C.Decl l ReparseMacroExpansions)
+processFunction info function = do
+    function' <- reparseWith info.id LanC.reparseFunDecl function.ann withoutReparse withReparse
+    pure C.Decl {
+        info = info
+      , ann = NoAnn
+      , kind = C.DeclFunction function'
+      }
+  where
+    withoutReparse :: C.Function PrepareReparse
+    withoutReparse = function
+
+    withReparse ::
+         (([(Maybe Text, C.Type LanC)] , C.Type LanC) , Text)
+      -> M (C.Function LanC)
+    withReparse ((tys, ty), _name) = pure C.Function{
+          args  = map (uncurry mkFunctionArg) tys
+        , res   = ty
+        , attrs = function.attrs
+        , ann   = NoAnn
+        }
+
+    mkFunctionArg :: Maybe Text -> C.Type LanC -> C.FunctionArg LanC
+    mkFunctionArg mname typ = C.FunctionArg{
+          name = C.ScopedName <$> mname
+        , typ  = typ
+        , ann  = NoAnn
+        }
+
+-- | Globals (externs or constants)
+processGlobal ::
+     C.DeclInfo ReparseMacroExpansions
+  -> C.Global PrepareReparse
+  -> M (C.Decl l ReparseMacroExpansions)
+processGlobal info global = do
+    global' <- reparseWith info.id LanC.reparseGlobal global.ann withoutReparse withReparse
+    pure C.Decl {
+        info = info
+      , ann = NoAnn
+      , kind = C.DeclGlobal global'
+      }
+  where
+    withoutReparse :: C.Global PrepareReparse
+    withoutReparse = global
+
+    withReparse :: C.Type LanC -> M (C.Global LanC)
+    withReparse ty = pure C.Global{
+          typ = ty
+        , ann = NoAnn
+        }
+
+{-------------------------------------------------------------------------------
+  Internal: monad used for reparsing
+-------------------------------------------------------------------------------}
+
+newtype M a = WrapM { _unwrapM :: StateT ReparseState (Reader ReparseEnv) a }
+  deriving newtype (
+      Functor
+    , Applicative
+    , Monad
+    , MonadReader ReparseEnv
+    , MonadState ReparseState
+    )
+
+-- | Environment used when reparsing declarations with macro expansions.
+data ReparseEnv = ReparseEnv {
+      -- | Known non-macro names and their types (i.e., @typedef@s, @struct@s,
+      --   @union@s and @enum@s).
+      knownTypes :: Map LanC.CName (C.Type LanC)
+      -- | Known macro names; kept separate so we can restrict the reparse
+      --   environment to macros actually /expanded/.
+    , knownMacros :: Set LanC.CName
+    }
+
+data ReparseState = ReparseState {
+      -- | Delayed parse messages collected during reparse
+      --
+      -- Stored in reverse order.
+      reparseWarnings :: [(C.DeclId, DelayedReparseMacroExpansionsMsg)]
+    }
+  deriving stock (Generic)
+
+runM ::
+     ClangCStandard
+  -> Map LanC.CName (C.Type LanC)
+  -> Set LanC.CName
+  -> M a
+  -> (a, ReparseState)
+runM cStd knownTypes knownMacros (WrapM ma) = runReader (runStateT ma s) e
+  where
+    e :: ReparseEnv
+    e = ReparseEnv {
+        -- Add the bespoke types as a fallback (note, 'Map.union' is
+        -- left-biased).
+        knownTypes  = knownTypes `Map.union` LanC.bespokeTypes cStd
+      , knownMacros = knownMacros
+      }
+
+    s :: ReparseState
+    s = ReparseState{
+        reparseWarnings  = []
+      }
+
+{-------------------------------------------------------------------------------
+  Reparsing declarations with macro expansions
+-------------------------------------------------------------------------------}
+
+-- | Run reparser if needed; use fallback on failure or if not needed.
+--
+-- On reparsing failure, records @(declId, ReparseMacroExpansionsLanC e)@ in
+-- 'ReparseState.reparseWarnings' and uses the fallback value.
+--
+-- On reparsing success and zip failure, records @(declId,
+-- ReparseMacroExpansionsZip e)@ in 'ReparseState.reparseWarnings' and uses the
+-- fallback value.
+--
+reparseWith ::
+     forall a r. (ZipReparsed r, ForgetAnn r)
+  => C.DeclId
+  -> LanC.Parser a
+  -> ReparseInfo FlatTokens
+  -> r PrepareReparse
+  -> (a -> M (r LanC))
+  -> M (r ReparseMacroExpansions)
+reparseWith declId parser reparseInfo fallback onSuccess = case reparseInfo of
+    ReparseNotNeeded ->
+      pure fallback'
+    ReparseNeeded tokens macroInvs -> do
+      env <- ask
+      let
+          usedMacros :: Set Text
+          usedMacros = invokedMacros macroInvs
+          usedKnownMacros :: Set LanC.CName
+          usedKnownMacros = Set.intersection env.knownMacros usedMacros
+          usedUnknownMacros :: Set LanC.CName
+          usedUnknownMacros = Set.difference usedMacros env.knownMacros
+      forM_ usedUnknownMacros $ \u ->
+          modify $ #reparseWarnings %~
+            ((declId, ReparseMacroExpansionUnknownType u) :)
+
+      let reparseEnv :: LanC.ReparseEnv
+          reparseEnv = LanC.ReparseEnv env.knownTypes usedKnownMacros
+      case parser reparseEnv tokens of
+        Right a -> do
+            b <- onSuccess a
+            case zipEither fallback b of
+              Left es -> do
+                forM_ es $ \e ->
+                  modify $ #reparseWarnings %~ ((declId, e) :)
+                pure fallback'
+              Right c -> pure c
+        Left  e -> do
+          modify $ #reparseWarnings %~ ((declId, ReparseMacroExpansionsLanC e) :)
+          pure fallback'
+  where
+    fallback' :: r ReparseMacroExpansions
+    fallback' = forgetAnn fallback
diff --git a/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/ForgetAnn.hs b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/ForgetAnn.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/ForgetAnn.hs
@@ -0,0 +1,78 @@
+-- | Forget 'Ann'otations and coerce the remainder
+module HsBindgen.Frontend.Pass.ReparseMacroExpansions.ForgetAnn (
+    ForgetAnn (forgetAnn)
+  , coerceNonMacroType
+  ) where
+
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass (ReparseMacroExpansions)
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+
+{-------------------------------------------------------------------------------
+  Class
+-------------------------------------------------------------------------------}
+
+type In  = PrepareReparse
+
+-- | Forget 'Ann'otations and coerce the remainder
+--
+-- When a declaration is not reparsed (because it does not contain any macro
+-- expanions), we simply want to coerce the declaration to the next pass
+-- parameter. Before we can coerce, we also have to forget 'Ann'otations.
+class ForgetAnn a where
+  forgetAnn :: a In -> a ReparseMacroExpansions
+
+{-------------------------------------------------------------------------------
+  Instances
+-------------------------------------------------------------------------------}
+
+instance ForgetAnn C.RegularField where
+  forgetAnn field = C.RegularField{
+          typ    = coercePass field.typ
+        , ann    = NoAnn
+        , offset = field.offset
+        , width  = field.width
+        , info   = coercePass field.info
+        }
+
+instance ForgetAnn C.IndirectField where
+  forgetAnn field = C.IndirectField{
+          typ    = coercePass field.typ
+        , ann    = NoAnn
+        , offset = field.offset
+        , width  = field.width
+        , path   = fmap coercePass field.path
+        , info   = coercePass field.info
+        }
+
+instance ForgetAnn C.Typedef where
+  forgetAnn typedef = C.Typedef{
+          typ = coercePass typedef.typ
+        , ann = NoAnn
+        }
+
+instance ForgetAnn C.Function where
+  forgetAnn fun = C.Function{
+          args  = fmap coercePass fun.args
+        , res   = coercePass fun.res
+        , attrs = fun.attrs
+        , ann   = NoAnn
+        }
+
+instance ForgetAnn C.Global where
+  forgetAnn global = C.Global {
+        typ = coercePass global.typ
+      , ann = NoAnn
+      }
+
+{-------------------------------------------------------------------------------
+  Coerce
+-------------------------------------------------------------------------------}
+
+-- | Coerce a 'C.Type' from 'PrepareReparse' to 'ReparseMacroExpansions' (no
+-- 'TypeMacro' present).
+coerceNonMacroType ::
+     C.Type PrepareReparse
+  -> C.Type ReparseMacroExpansions
+coerceNonMacroType = coercePass
diff --git a/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/IsPass.hs
@@ -0,0 +1,77 @@
+module HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass (
+    ReparseMacroExpansions
+  ) where
+
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass (PrepareReparse)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC (LanC)
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type ReparseMacroExpansions :: Pass
+data ReparseMacroExpansions a
+
+-- We do not need the @ReparseInfo@ anymore, so we drop it from the annotations.
+type family AnnReparseMacroExpansions (ix :: Symbol) :: Star where
+  AnnReparseMacroExpansions _                 = NoAnn
+
+instance IsPass ReparseMacroExpansions
+
+instance PassId ReparseMacroExpansions
+
+instance PassTypes ReparseMacroExpansions
+
+instance PassScopedName ReparseMacroExpansions
+
+instance PassMacro ReparseMacroExpansions where
+  type MacroId         ReparseMacroExpansions = Id ReparseMacroExpansions
+  type MacroBody       ReparseMacroExpansions = TypecheckedMacro ReparseMacroExpansions
+  type MacroUnderlying ReparseMacroExpansions = C.Type ReparseMacroExpansions
+
+  macroIdId _ = id
+
+instance PassExtBinding ReparseMacroExpansions
+
+instance PassCommentDecl ReparseMacroExpansions where
+  type CommentDecl ReparseMacroExpansions = Maybe (C.Comment ReparseMacroExpansions)
+
+instance PassAnn ReparseMacroExpansions where
+  type Ann ix ReparseMacroExpansions = AnnReparseMacroExpansions ix
+
+instance PassMsg ReparseMacroExpansions
+
+{-------------------------------------------------------------------------------
+  CoercePass: PrepareReparse → ReparseMacroExpansions
+-------------------------------------------------------------------------------}
+
+instance CoercePassId                  PrepareReparse ReparseMacroExpansions
+instance CoercePassMacroId             PrepareReparse ReparseMacroExpansions
+instance CoercePassTypes               PrepareReparse ReparseMacroExpansions
+instance CoercePassAnn "TypeFunArg"    PrepareReparse ReparseMacroExpansions
+
+instance CoercePassCommentDecl PrepareReparse ReparseMacroExpansions where
+  coercePassCommentDecl _ = fmap coercePass
+
+instance CoercePassMacroBody PrepareReparse ReparseMacroExpansions where
+  coercePassMacroBody _ = coercePassParam
+
+instance CoercePassMacroUnderlying PrepareReparse  ReparseMacroExpansions where
+  coercePassMacroUnderlying _ = absurd
+
+{-------------------------------------------------------------------------------
+  CoercePass: LanC → ReparseMacroExpansions
+-------------------------------------------------------------------------------}
+
+instance CoercePassId               LanC ReparseMacroExpansions
+instance CoercePassMacroId          LanC ReparseMacroExpansions
+instance CoercePassAnn "TypeFunArg" LanC ReparseMacroExpansions
+instance CoercePassCommentDecl      LanC ReparseMacroExpansions where
+  coercePassCommentDecl _ = fmap coercePass
+
+instance CoercePassMacroBody LanC ReparseMacroExpansions where
+  coercePassMacroBody _ = coercePassParam
diff --git a/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/IsPass/Msg.hs b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/IsPass/Msg.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/IsPass/Msg.hs
@@ -0,0 +1,56 @@
+-- | Trace messages for the @ReparseMacroExpansions@ pass
+--
+-- This module is intended to be imported unqualified.
+module HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.Msg (
+    -- * DelayedMsg
+    DelayedReparseMacroExpansionsMsg (..)
+  ) where
+
+import Data.Text (Text)
+import GHC.Generics (Generic)
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Frontend.LanguageC.Error qualified as LanC
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.Zip.Error
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  DelayedMsg
+-------------------------------------------------------------------------------}
+
+data DelayedReparseMacroExpansionsMsg =
+    -- | We could not reparse a fragment of C (to recover macro use sites)
+    ReparseMacroExpansionsLanC LanC.Error
+
+    -- | We could not zip the C AST before reparsing with the C AST after
+    -- reparsing
+  | ReparseMacroExpansionsZip ZipError
+
+    -- | While reparsing a declaration with a macro expansion, we do not know
+    --   the type of an expanded macro.
+  | ReparseMacroExpansionUnknownType Text
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace DelayedReparseMacroExpansionsMsg where
+  prettyForTrace = \case
+      ReparseMacroExpansionsLanC x -> PP.hsep [
+          "Failed to parse tokens using language-c:"
+        , prettyForTrace x
+        ]
+      ReparseMacroExpansionsZip err -> PP.hsep [
+          "Failed to zip the C AST before reparsing with"
+        , "the C AST after reparsing:"
+        , prettyForTrace err
+        ]
+      ReparseMacroExpansionUnknownType x -> PP.hsep [
+          "Unknown type of expanded macro"
+        , PP.text x
+        ]
+
+instance IsTrace Level DelayedReparseMacroExpansionsMsg where
+  getDefaultLogLevel = \case
+      ReparseMacroExpansionsLanC x       -> getDefaultLogLevel x
+      ReparseMacroExpansionsZip x        -> getDefaultLogLevel x
+      ReparseMacroExpansionUnknownType{} -> Info
+  getSource          = const HsBindgen
+  getTraceId         = const "reparse-macro-expansions"
diff --git a/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/LanC.hs b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/LanC.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/LanC.hs
@@ -0,0 +1,60 @@
+module HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC (
+    LanC
+  ) where
+
+import Data.Void (absurd)
+
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type LanC :: Pass
+data LanC a
+
+
+instance IsPass LanC
+
+instance PassId LanC
+
+instance PassTypes LanC
+
+instance PassScopedName LanC
+
+instance PassMacro LanC where
+  type MacroId         LanC = Id LanC
+  type MacroBody       LanC = TypecheckedMacro LanC
+  type MacroUnderlying LanC = ()
+
+  macroIdId _ = id
+
+instance PassExtBinding LanC
+
+instance PassCommentDecl LanC where
+  type CommentDecl LanC = Maybe (C.Comment LanC)
+
+instance PassAnn LanC where
+  type Ann ix LanC = NoAnn
+
+instance PassMsg LanC
+
+{-------------------------------------------------------------------------------
+  CoercePass: PrepareReparse → LanC
+-------------------------------------------------------------------------------}
+
+instance CoercePassId               PrepareReparse LanC
+instance CoercePassTypes            PrepareReparse LanC
+instance CoercePassMacroId          PrepareReparse LanC
+instance CoercePassAnn "TypeFunArg" PrepareReparse LanC
+instance CoercePassCommentDecl      PrepareReparse LanC where
+  coercePassCommentDecl _ = fmap coercePass
+
+instance CoercePassMacroBody PrepareReparse LanC where
+  coercePassMacroBody _ = coercePassParam
+
+instance CoercePassMacroUnderlying PrepareReparse  LanC where
+  coercePassMacroUnderlying _ = absurd
diff --git a/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/Zip.hs b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/Zip.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/Zip.hs
@@ -0,0 +1,374 @@
+-- | Zip the C ASTs before and after reparsing
+module HsBindgen.Frontend.Pass.ReparseMacroExpansions.Zip (
+    ZipResult (..)
+  , ZipReparsed
+  , zipEither
+  ) where
+
+import Control.Monad qualified as M
+
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.ForgetAnn (coerceNonMacroType)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass (ReparseMacroExpansions)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.Msg
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC (LanC)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.Zip.Error
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.C qualified as C
+
+type In  = PrepareReparse
+type Out = LanC
+
+{-------------------------------------------------------------------------------
+  Monadic result type
+-------------------------------------------------------------------------------}
+
+data ZipResult a =
+    ZipSuccess a
+  | ZipFailure [ZipError]
+  deriving stock Functor
+
+instance Applicative ZipResult where
+  pure = ZipSuccess
+  ZipSuccess f <*> m  = fmap f m
+  ZipFailure e <*> _m = ZipFailure e
+
+instance Monad ZipResult where
+  ZipSuccess x >>= k = k x
+  ZipFailure e >>= _ = ZipFailure e
+
+success :: a -> ZipResult a
+success = ZipSuccess
+
+failure :: [ZipError] -> ZipResult a
+failure = ZipFailure
+
+checkEq :: (Show a, Eq a) => a -> a -> ZipResult a
+checkEq lhs rhs
+  | lhs == rhs = success rhs
+  | otherwise  = failure $ zipErrorNotEqual lhs rhs
+
+checkEqCoerce ::
+     forall a. (
+         Eq (a ReparseMacroExpansions)
+       , Show (a ReparseMacroExpansions)
+       , CoercePass a Out ReparseMacroExpansions
+       , CoercePass a In ReparseMacroExpansions
+       )
+  => a In
+  -> a Out
+  -> ZipResult (a ReparseMacroExpansions)
+checkEqCoerce lhs rhs =
+    if lhsA == rhsA then
+      success rhsA
+    else
+      failure $ zipErrorNotEqual lhsA rhsA
+  where
+    lhsA, rhsA :: a ReparseMacroExpansions
+    lhsA = coercePass lhs
+    rhsA = coercePass rhs
+
+{-------------------------------------------------------------------------------
+  Class
+-------------------------------------------------------------------------------}
+
+-- | Zip the C ASTs before and after reparsing
+--
+-- The reparser parses raw @libclang@ tokens and replaces parts of the C AST
+-- with the parse results. To ensure correct Haskell bindings, this replacement
+-- must adhere to certain rules. For example, if we have a global variable of
+-- type @int@ before reparsing, then it is fine if the reparser replaces that
+-- @int@ with some syntactical sugar (e.g., a @typedef@) representing an @int@.
+-- However, it is not okay to replace that @int@ by a reference to a @struct@,
+-- for example.
+--
+-- The 'zip' function operates recursively on sub-trees of C ASTs. It takes a
+-- tree from before reparsing, \( t_{pre} \), and a tree from after reparsing,
+-- \( t_{post} \), and produces a zipped tree, \( t_{zipped} \). Firstly, the
+-- 'zip' function checks that \( t_{pre} \) has undergone a small set of
+-- allowed modifications with respect to \( t_{post} \). Moreover, 'zip'
+-- combines information from both trees to produce a new \( t_{zipped} \),
+-- which is sometimes necessary because the reparser has access to limited
+-- information that is readily available in \( t_{pre} \).
+--
+-- For the most part, the process of 'zip' is simple:
+--
+-- * It checks that the root nodes of \( t_{pre} \) and \( t_{post} \) are of
+--   the same type (for example, a 'C.TypeFun').
+-- * If the root nodes are of the same type, then recursively zip sub-trees.
+-- * If that was successful, produce a new \( t_{zipped} \) from the recursively
+--   zipped sub-trees with the same type of root node as before.
+-- * If any previous step fails, we return an error.
+--
+-- There are also more interesting cases (that only apply to C types):
+--
+-- * Before reparsing, there are no references to macro types, but after
+--   reparsing there may be. As such, if \( t_{pre} \) is a C type, and \( t_{post} \)
+--   is a reference to a macro type, then we consider the trees to be
+--   zipped. However, the reparser does not know what the underlying type of
+--   the macro reference is, but we know that the underlying type is precisely
+--   the C type that was replaced. So, 'zip' produces a \( t_{zipped} \) that
+--   is the macro reference from \( t_{post} \) with \( t_{pre} \) as the
+--   underlying type.
+--
+-- * Before reparsing, all @char@ C types have a /known/ implicit sign. The
+--   reparser is not smart enough to do the same, and only produces /unknown/
+--   implicit signs. In such cases, \( t_{pre} \) and \( t_{post} \) are
+--   considered to be zipped, but we produce \( t_{pre} \) as \( t_{zipped} \),
+--   so that the implicit sign is also known from this point onward.
+--
+-- NOTE: This zip algorithm assumes that the reparser only produces
+-- \( t_{post} \) that differ from \( t_{pre} \) exactly at single nodes in our
+-- tree representation of the C AST. This assumption is warrented: the reparser
+-- only replaces nodes in our tree representation of C types with macro
+-- reference sugar, which behave just like @typedef@s. If the reparser were
+-- changed in the future to produce \( t_{post} \) that are more generally
+-- allowed to differ from \( t_{pre} \), then this algorithm might not work
+-- anymore.
+--
+-- NOTE: the description of PR #1979 describes historically why we implemented
+-- the 'zip' function, which mainly had to do with supporting underlying types
+-- for macro references.
+--
+-- <https://github.com/well-typed/hs-bindgen/pull/1979>
+--
+class ZipReparsed a where
+  zipReparsed :: a In -> a Out -> ZipResult (a ReparseMacroExpansions)
+
+zipEither ::
+     ZipReparsed a
+  => a In
+  -> a Out
+  -> Either [DelayedReparseMacroExpansionsMsg] (a ReparseMacroExpansions)
+zipEither pre post =
+    case zipReparsed pre post of
+      ZipFailure es -> Left $ fmap ReparseMacroExpansionsZip es
+      ZipSuccess z -> Right z
+
+{-------------------------------------------------------------------------------
+  Instances
+-------------------------------------------------------------------------------}
+
+instance ZipReparsed C.RegularField where
+  zipReparsed fieldPre field = do
+      info'   <- checkEqCoerce fieldPre.info   field.info
+      typ'    <- zipType      fieldPre.typ    field.typ
+      offset' <- checkEq      fieldPre.offset field.offset
+      width'  <- checkEq      fieldPre.width  field.width
+      success C.RegularField{
+          info   = info'
+        , typ    = typ'
+        , offset = offset'
+        , width  = width'
+        , ann    = NoAnn
+        }
+
+instance ZipReparsed C.IndirectField where
+  zipReparsed fieldPre field = do
+      info'   <- checkEqCoerce      fieldPre.info   field.info
+      typ'    <- zipType            fieldPre.typ    field.typ
+      offset' <- checkEq            fieldPre.offset field.offset
+      width'  <- checkEq            fieldPre.width  field.width
+      path'   <- zipList zipAnonRef fieldPre.path field.path
+      success C.IndirectField{
+          info   = info'
+        , typ    = typ'
+        , offset = offset'
+        , width  = width'
+        , path   = path'
+        , ann    = NoAnn
+        }
+    where
+      zipAnonRef :: C.AnonRef In -> C.AnonRef Out -> ZipResult (C.AnonRef ReparseMacroExpansions)
+      zipAnonRef anonRef1 anonRef2 = case (anonRef1, anonRef2) of
+          (C.AnonRef id1, C.AnonRef id2) -> C.AnonRef <$> checkEq id1 id2
+
+instance ZipReparsed C.Typedef where
+  zipReparsed typedefPre typedef = do
+      typ' <- zipType typedefPre.typ typedef.typ
+      success C.Typedef{
+          typ = typ'
+        , ann = NoAnn
+        }
+
+instance ZipReparsed C.Function where
+  zipReparsed funPre fun = do
+      args'  <- zipList zipFunctionArg funPre.args fun.args
+      res'   <- zipType                funPre.res   fun.res
+      attrs' <- checkEq                funPre.attrs fun.attrs
+      success C.Function{
+          args  = args'
+        , res   = res'
+        , attrs = attrs'
+        , ann   = NoAnn
+        }
+    where
+      zipFunctionArg ::
+           C.FunctionArg In
+        -> C.FunctionArg Out
+        -> ZipResult (C.FunctionArg ReparseMacroExpansions)
+      zipFunctionArg arg1 arg2 = do
+            name' <- checkEq arg1.name arg2.name
+            typ'  <- zipType arg1.typ  arg2.typ
+            ann'  <- checkEq arg1.ann  arg2.ann
+            success C.FunctionArg {
+                name = name'
+              , typ  = typ'
+              , ann  = ann'
+              }
+
+instance ZipReparsed C.Global where
+  zipReparsed globalPre global = do
+      typ' <- zipType globalPre.typ global.typ
+      success C.Global {
+          typ = typ'
+        , ann = NoAnn
+        }
+
+{-------------------------------------------------------------------------------
+  Zip types
+-------------------------------------------------------------------------------}
+
+zipType :: C.Type In -> C.Type Out -> ZipResult (C.Type ReparseMacroExpansions)
+zipType t1 t2 = case (t1, t2) of
+      -- Interesting case: an arbitrary type is replaced by a macro reference
+      (_, C.TypeMacro ref2) -> do
+        case (ref2.name.name.text, t1) of
+          -- Special case: @#define bool _Bool@ from stdbool.h is normalised so
+          -- that @bool@ renders identically to @_Bool@ regardless of
+          -- @language-c@ version.
+          ("bool", C.TypePrim C.PrimBool) ->
+            success $ coerceNonMacroType t1
+          _otherwise ->
+            success $ C.TypeMacro C.MacroRef {
+                name       = ref2.name
+              , underlying = coerceNonMacroType t1
+              }
+
+      -- boring recursive cases
+      (C.TypePrim pt1, C.TypePrim pt2) ->
+        C.TypePrim <$> zipPrimType pt1 pt2
+      (C.TypeComplex pt1, C.TypeComplex pt2) ->
+        C.TypeComplex <$> zipPrimType pt1 pt2
+      (C.TypeRef id1, C.TypeRef id2) ->
+        C.TypeRef <$> checkEq id1 id2
+      (C.TypeEnum e1, C.TypeEnum e2) ->
+        C.TypeEnum <$> zipRef e1 e2
+      (C.TypeTypedef td1, C.TypeTypedef td2) ->
+        C.TypeTypedef <$> zipRef td1 td2
+      (C.TypePointers n1 t1', C.TypePointers n2 t2') ->
+        C.TypePointers <$> checkEq n1 n2 <*> zipType t1' t2'
+      (C.TypeConstArray n1 et1, C.TypeConstArray n2 et2) ->
+        C.TypeConstArray <$> checkEq n1 n2 <*> zipType et1 et2
+      (C.TypeIncompleteArray et1, C.TypeIncompleteArray et2) ->
+        C.TypeIncompleteArray <$> zipType et1 et2
+      (C.TypeFun args1 res1, C.TypeFun args2 res2) ->
+        C.TypeFun
+          <$> zipList zipTypeFunArg args1 args2
+          <*> zipType res1 res2
+      (C.TypeVoid, C.TypeVoid) ->
+        success C.TypeVoid
+      (C.TypeBlock t1', C.TypeBlock t2') ->
+        C.TypeBlock <$> zipType t1' t2'
+      (C.TypeQual q1 t1', C.TypeQual q2 t2') ->
+        C.TypeQual <$> zipTypeQual q1 q2 <*> zipType t1' t2'
+
+      -- fail in any other case
+      (_, _) -> failure $ zipErrorNotZipped t1 t2
+    where
+      -- Impossible case: macro references do not exist in the C AST before
+      -- reparsing. Caught by the type checker.
+      _coveredAllCasesIn :: C.Type In -> ()
+      _coveredAllCasesIn = \case
+        C.TypePrim{} -> ()
+        C.TypeComplex{} -> ()
+        C.TypeRef{} -> ()
+        C.TypeEnum{} -> ()
+        C.TypeTypedef{} -> ()
+        C.TypePointers{} -> ()
+        C.TypeConstArray{} -> ()
+        C.TypeIncompleteArray{} -> ()
+        C.TypeFun{} -> ()
+        C.TypeVoid{} -> ()
+        C.TypeBlock{} -> ()
+        C.TypeQual{} -> ()
+
+      _coveredAllCasesOut :: C.Type Out -> ()
+      _coveredAllCasesOut = \case
+        C.TypePrim{} -> ()
+        C.TypeComplex{} -> ()
+        C.TypeRef{} -> ()
+        C.TypeEnum{} -> ()
+        C.TypeMacro{} -> ()
+        C.TypeTypedef{} -> ()
+        C.TypePointers{} -> ()
+        C.TypeConstArray{} -> ()
+        C.TypeIncompleteArray{} -> ()
+        C.TypeFun{} -> ()
+        C.TypeVoid{} -> ()
+        C.TypeBlock{} -> ()
+        C.TypeQual{} -> ()
+
+zipTypeQual :: C.TypeQual -> C.TypeQual -> ZipResult C.TypeQual
+zipTypeQual C.QualConst C.QualConst = success C.QualConst
+
+zipPrimType :: C.PrimType -> C.PrimType -> ZipResult C.PrimType
+zipPrimType t1 t2 = case (t1, t2) of
+    (C.PrimChar csign1, C.PrimChar csign2) ->
+        C.PrimChar <$> zipPrimSignChar csign1 csign2
+    _ -> checkEq t1 t2
+  where
+    _coveredAllCases :: C.PrimType -> ()
+    _coveredAllCases = \case
+      C.PrimChar{}     -> ()
+      C.PrimIntegral{} -> ()
+      C.PrimFloating{} -> ()
+      C.PrimBool{}     -> ()
+
+zipPrimSignChar ::
+     C.PrimSignChar
+  -> C.PrimSignChar
+  -> ZipResult C.PrimSignChar
+zipPrimSignChar csign1 csign2 = case (csign1, csign2) of
+    -- interesting case: the reparser does not know the sign of a character
+    -- when it is implicit, but @libclang@ does know this
+    (C.PrimSignImplicit (Just psign1), C.PrimSignImplicit Nothing) ->
+      success $ C.PrimSignImplicit (Just psign1)
+    _ -> checkEq csign1 csign2
+  where
+    _coveredAllCases :: C.PrimSignChar -> ()
+    _coveredAllCases = \case
+        C.PrimSignExplicit{} -> ()
+        C.PrimSignImplicit{} -> ()
+
+zipTypeFunArg ::
+     C.TypeFunArg In
+  -> C.TypeFunArg Out
+  -> ZipResult (C.TypeFunArg ReparseMacroExpansions)
+zipTypeFunArg arg1 arg2 =
+    C.TypeFunArgF
+      <$> zipType arg1.typ arg2.typ
+      <*> checkEq arg1.ann arg2.ann
+
+zipRef ::
+     C.Ref (Id In) In
+  -> C.Ref (Id Out) Out
+  -> ZipResult (C.EnumRef ReparseMacroExpansions)
+zipRef ref1 ref2 =
+    C.Ref
+      <$> checkEq ref1.name ref2.name
+      <*> zipType ref1.underlying ref2.underlying
+
+{-------------------------------------------------------------------------------
+  Zip lists
+-------------------------------------------------------------------------------}
+
+-- | Like 'M.zipWithM', but fails if the two arguments lists are of non-equal
+-- length
+zipList :: (Show a, Show b) => (a -> b -> ZipResult c) -> [a] -> [b] -> ZipResult [c]
+zipList zipOne xs ys
+  | length xs /= length ys
+  = failure $ zipErrorNotZipped xs ys
+  | otherwise
+  = M.zipWithM zipOne xs ys
diff --git a/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/Zip/Error.hs b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/Zip/Error.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ReparseMacroExpansions/Zip/Error.hs
@@ -0,0 +1,89 @@
+-- | Errors arising while zipping C ASTs before and after reparsing
+--
+-- Defined in its own module to avoid cyclic module dependencies.
+module HsBindgen.Frontend.Pass.ReparseMacroExpansions.Zip.Error (
+    ZipError(..)
+  , zipErrorNotZipped
+  , zipErrorNotEqual
+  ) where
+
+import Data.Text (Text)
+import Data.Text qualified as Text
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Type
+-------------------------------------------------------------------------------}
+
+-- | Errors arising while zipping C ASTs before and after reparsing
+data ZipError =
+    -- | Expected two sub-trees to be zipped, but they were not
+    ZipSubTreesNotZipped
+    -- | Expected two sub-trees to be equal, but they were not
+  | ZipSubTreesNotEqual
+    -- | Printed LHS sub-tree
+  | ZipSubTreeLHS Text
+    -- | Printed RHS sub-tree
+  | ZipSubTreeRHS Text
+  deriving stock (Show, Eq)
+
+-- | Smart constructor for 'ZipSubTreesNotZipped'
+zipErrorNotZipped :: (Show a, Show b) => a -> b -> [ZipError]
+zipErrorNotZipped lhs rhs = withDebugTraces lhs rhs ZipSubTreesNotZipped
+
+-- | Smart constructor for 'ZipSubTreesNotEqual'
+zipErrorNotEqual :: (Show a, Show b) => a -> b -> [ZipError]
+zipErrorNotEqual lhs rhs = withDebugTraces lhs rhs ZipSubTreesNotEqual
+
+-- | Add debug trace messages that print the LHS and RHS sub-trees at the point
+-- where zipping failed
+withDebugTraces :: (Show a, Show b) => a -> b -> ZipError -> [ZipError]
+withDebugTraces lhs rhs err = concat [
+      [ err ]
+    , [ ZipSubTreeLHS $ Text.pack $ show lhs
+      , ZipSubTreeRHS $ Text.pack $ show rhs
+      ]
+    ]
+
+{-------------------------------------------------------------------------------
+  Tracing
+-------------------------------------------------------------------------------}
+
+instance PrettyForTrace ZipError where
+  prettyForTrace = \case
+    ZipSubTreesNotZipped -> PP.hsep [
+          "Expected two sub-trees in the C ASTs before and after reparsing to be"
+        , "zipped, but they were not."
+        ]
+    ZipSubTreesNotEqual -> PP.hsep [
+          "Expected two sub-trees in the C ASTs before and after reparsing to be"
+        , "equal, but they were not."
+        ]
+    ZipSubTreeLHS lhs -> "Sub-tree before reparsing:" PP.<+> PP.text lhs
+    ZipSubTreeRHS rhs -> "Sub-tree after reparsing:" PP.<+> PP.text rhs
+
+instance IsTrace Level ZipError where
+  getDefaultLogLevel = \case
+      -- If zipping fails, then there might be a bug in the reparser
+      --
+      -- TODO <https://github.com/well-typed/hs-bindgen/issues/2122>
+      -- However, 'ZipSubTreesNotZipped' is emitted by the test suite. The
+      -- reason is that some Clang builtins arrive with erased @typedef@ nodes.
+      -- For example:
+      --
+      --     fread(void *restrict, size_t, size_t, FILE *restrict)
+      --
+      -- arrives as
+      --
+      --     * cursor type: "unsigned long (void *, unsigned long, unsigned long, FILE *)"
+      ZipSubTreesNotZipped{} -> Info
+      -- 'ZipSubTreesNotEqual' is not emitted by the test suite and already a
+      -- 'Bug' message.
+      ZipSubTreesNotEqual{}  -> Bug
+      -- Sub-trees are useful for debugging
+      ZipSubTreeLHS{}        -> Debug
+      ZipSubTreeRHS{}        -> Debug
+  getSource = const HsBindgen
+  getTraceId = const "zip"
diff --git a/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs.hs b/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs.hs
@@ -0,0 +1,801 @@
+module HsBindgen.Frontend.Pass.ResolveBindingSpecs (
+    resolveBindingSpecs
+  ) where
+
+import Control.Monad ((<=<))
+import Control.Monad.Reader (MonadReader, ReaderT, runReaderT)
+import Control.Monad.Reader qualified as Reader
+import Control.Monad.State (MonadState, State, runState)
+import Control.Monad.State qualified as State
+import Control.Monad.Trans.Class (lift)
+import Control.Monad.Trans.Maybe (MaybeT (..))
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+
+import Clang.HighLevel.Types
+
+import HsBindgen.BindingSpec (MergedBindingSpecs, PrescriptiveBindingSpec)
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex)
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Analysis.DeclUseGraph (DeclUseGraph)
+import HsBindgen.Frontend.Analysis.DeclUseGraph qualified as DeclUseGraph
+import HsBindgen.Frontend.Analysis.IncludeGraph (IncludeGraph)
+import HsBindgen.Frontend.Analysis.IncludeGraph qualified as IncludeGraph
+import HsBindgen.Frontend.Analysis.UseDeclGraph qualified as UseDeclGraph
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass (ReparseMacroExpansions)
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Flip
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.Util.Monad (mapMaybeM)
+import HsBindgen.Util.Tracer (withCallStack)
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+type PreviousPass = ReparseMacroExpansions
+
+resolveBindingSpecs ::
+     forall l. HasCallStack
+  => Hs.ModuleName
+  -> MergedBindingSpecs
+  -> PrescriptiveBindingSpec
+  -> C.TranslationUnit l PreviousPass
+  -> (C.TranslationUnit l ResolveBindingSpecs, [AnnMsg ResolveBindingSpecs])
+resolveBindingSpecs hsModuleName extSpecs pSpec unit =
+    let pSpecModule = BindingSpec.moduleName pSpec
+        (pSpecErrs, pSpec')
+          | pSpecModule == hsModuleName = ([], pSpec)
+          | otherwise =
+              ( [withCallStack (ResolveBindingSpecsModuleMismatch hsModuleName pSpecModule)]
+              , BindingSpec.empty hsModuleName
+              )
+        (decls, state) =
+          runM
+            extSpecs
+            pSpec'
+            unit.includeGraph
+            unit.meta.declIndex
+            (resolveDecls unit.decls)
+        declUseGraph =
+            DeclUseGraph.deleteRevDeps (Map.keysSet state.extTypes)
+          . DeclUseGraph.deleteDeps state.opqTypes
+          $ unit.meta.declUseGraph
+        notUsedErrs = map (withCallStack . ResolveBindingSpecsTypeNotUsed) $ Map.keys state.noPTypes
+    in  ( reconstruct decls declUseGraph state
+        , pSpecErrs ++ reverse state.traces ++ notUsedErrs
+        )
+  where
+    reconstruct ::
+         [C.Decl l ResolveBindingSpecs]
+      -> DeclUseGraph
+      -> MState
+      -> C.TranslationUnit l ResolveBindingSpecs
+    reconstruct decls' declUseGraph state =
+      let externals :: [(C.DeclId, C.DeclLocs)]
+          externals = map (second (.locs)) $ Map.toList state.extTypes
+
+          index' :: DeclIndex l
+          index' =
+                DeclIndex.registerExternalDeclarations externals
+              . DeclIndex.registerOmittedDeclarations state.omitTypes
+              $ unit.meta.declIndex
+
+          unitMeta' :: DeclMeta l
+          unitMeta' = DeclMeta {
+                declIndex    = index'
+              , useDeclGraph = UseDeclGraph.fromDeclUseGraph declUseGraph
+              , declUseGraph = declUseGraph
+              }
+
+      in C.TranslationUnit{
+             decls        = decls'
+           , includeGraph = unit.includeGraph
+           , meta         = unitMeta'
+           }
+
+{-------------------------------------------------------------------------------
+  Internal: monad
+-------------------------------------------------------------------------------}
+
+newtype M l a = WrapM (ReaderT (MEnv l) (State MState) a)
+  deriving newtype (
+      Applicative
+    , Functor
+    , Monad
+    , MonadReader (MEnv l)
+    , MonadState MState
+    )
+
+runM ::
+     MergedBindingSpecs
+  -> PrescriptiveBindingSpec
+  -> IncludeGraph
+  -> DeclIndex l
+  -> M l a
+  -> (a, MState)
+runM extSpecs pSpec includeGraph declIndex (WrapM m) =
+    let env    = MEnv extSpecs pSpec includeGraph declIndex
+        state0 = initMState pSpec
+    in  runState (runReaderT m env) state0
+
+{-------------------------------------------------------------------------------
+  Internal: monad reader
+-------------------------------------------------------------------------------}
+
+data MEnv l = MEnv {
+      extSpecs     :: MergedBindingSpecs
+    , pSpec        :: PrescriptiveBindingSpec
+    , includeGraph :: IncludeGraph
+    , declIndex    :: DeclIndex l
+    }
+
+deriving stock instance Macro.HasTypes l => Show (MEnv l)
+
+{-------------------------------------------------------------------------------
+  Internal: monad state
+-------------------------------------------------------------------------------}
+
+data MState = MState {
+      traces    :: [AnnMsg ResolveBindingSpecs] -- ^ reverse order
+    , extTypes  :: Map C.DeclId (ExtBinding ResolveBindingSpecs)
+    , noPTypes  :: Map C.DeclId [Set RealPath]
+    , omitTypes :: Map C.DeclId (SingleLoc C.DeclPath)
+    , opqTypes  :: Set C.DeclId -- ^ opaqued types
+    }
+  deriving (Show, Generic)
+
+initMState :: PrescriptiveBindingSpec -> MState
+initMState pSpec = MState {
+      traces    = []
+    , extTypes  = Map.empty
+    , noPTypes  = BindingSpec.getCTypes pSpec
+    , omitTypes = Map.empty
+    , opqTypes  = Set.empty
+    }
+
+insertTrace :: AnnMsg ResolveBindingSpecs -> MState -> MState
+insertTrace msg = #traces %~ (msg :)
+
+insertExtType :: C.DeclId -> ExtBinding ResolveBindingSpecs -> MState -> MState
+insertExtType cDeclId typ = #extTypes %~ Map.insert cDeclId typ
+
+insertOpaquedType :: C.DeclId -> MState -> MState
+insertOpaquedType cDeclId = #opqTypes %~ Set.insert cDeclId
+
+deleteNoPType :: C.DeclId -> RealPath -> MState -> MState
+deleteNoPType cDeclId path = #noPTypes %~ Map.update (aux []) cDeclId
+  where
+    aux :: [Set RealPath] -> [Set RealPath] -> Maybe [Set RealPath]
+    aux acc = \case
+      s : ss
+        | Set.member path s ->
+            case ss ++ acc of
+              []  -> Nothing
+              ss' -> Just ss'
+        | otherwise -> aux (s : acc) ss
+      [] -> Just acc
+
+insertOmittedType :: C.DeclId -> SingleLoc C.DeclPath -> MState -> MState
+insertOmittedType cDeclId sloc = #omitTypes %~ Map.insert cDeclId sloc
+
+{-------------------------------------------------------------------------------
+  Internal: implementation
+-------------------------------------------------------------------------------}
+
+-- Resolve declarations, in two passes
+resolveDecls ::
+     HasCallStack
+  => [C.Decl l PreviousPass]
+  -> M l [C.Decl l ResolveBindingSpecs]
+resolveDecls = mapM (uncurry resolveDeep) <=< mapMaybeM resolveTop
+
+-- Pass one: top-level
+--
+-- If a declaration has an external binding, then the declaration is dropped and
+-- the external binding is recorded.
+--
+-- If a declaration is omitted, then the declaration is dropped and the omission
+-- is recorded.
+--
+-- Otherwise, the declaration is kept and is associated with a type
+-- specification when applicable.
+resolveTop ::
+     HasCallStack
+  => C.Decl l PreviousPass
+  -> M l
+       ( Maybe
+           ( C.Decl l PreviousPass
+           , (Maybe BindingSpec.CTypeSpec, Maybe BindingSpec.HsTypeSpec)
+           )
+       )
+resolveTop decl = case singleLocPath decl.info.loc of
+    C.InHeader realPath -> resolveTopInHeader realPath decl
+    -- Not in any header, so no binding specification refers to it
+    C.InRootHeader      -> return $ Just (decl, (Nothing, Nothing))
+    C.OnCommandLine     -> return $ Just (decl, (Nothing, Nothing))
+
+resolveTopInHeader ::
+     HasCallStack
+  => RealPath
+  -> C.Decl l PreviousPass
+  -> M l
+       ( Maybe
+           ( C.Decl l PreviousPass
+           , (Maybe BindingSpec.CTypeSpec, Maybe BindingSpec.HsTypeSpec)
+           )
+       )
+resolveTopInHeader realPath decl = Reader.ask >>= \env -> do
+    let declPaths  = IncludeGraph.reaches env.includeGraph realPath
+        mMsg       = Just $ withCallStack $ ResolveBindingSpecsOmittedType decl.info.id
+    isExt <- isJust <$>
+      resolveExtBinding
+        decl.info.id
+        (C.DeclLoc decl.info.loc)
+        declPaths mMsg
+    if isExt
+      then do
+        State.modify' $ insertTrace (withCallStack $ ResolveBindingSpecsExtDecl decl.info.id)
+        return Nothing
+      else case BindingSpec.lookupCTypeSpec decl.info.id declPaths env.pSpec of
+        Just (_hsModuleName, BindingSpec.Require cTypeSpec) -> do
+          State.modify' $
+              insertTrace (withCallStack $ ResolveBindingSpecsPreRequire decl.info.id)
+            . deleteNoPType decl.info.id realPath
+          let mHsTypeSpec = do
+                hsIdentifier <- cTypeSpec.hsName
+                BindingSpec.lookupHsTypeSpec hsIdentifier env.pSpec
+          applyPrescriptive decl cTypeSpec mHsTypeSpec
+        Just (_hsModuleName, BindingSpec.Omit) -> do
+          State.modify' $
+              insertTrace (withCallStack $ ResolveBindingSpecsPreOmit decl.info.id)
+            . deleteNoPType decl.info.id realPath
+            . insertOmittedType decl.info.id decl.info.loc
+          return Nothing
+        Nothing -> return $ Just (decl, (Nothing, Nothing))
+
+-- | Apply prescriptive binding specifications
+--
+-- A prescriptive binding specification can change a declaration or even drop
+-- it.
+--
+-- Type specifications that do not match declarations may themselves be mutated.
+applyPrescriptive :: forall l.
+     HasCallStack
+  => C.Decl l PreviousPass
+  -> BindingSpec.CTypeSpec
+  -> Maybe BindingSpec.HsTypeSpec
+  -> M l
+       ( Maybe
+           ( C.Decl l PreviousPass
+           , (Maybe BindingSpec.CTypeSpec, Maybe BindingSpec.HsTypeSpec)
+           )
+       )
+applyPrescriptive decl cTypeSpec mHsTypeSpec = runMaybeT $ do
+    mCTypeSpec'           <- applyCTypeSpec
+    (decl', mHsTypeSpec') <- applyHsTypeSpec
+    return (decl', (mCTypeSpec', mHsTypeSpec'))
+  where
+    applyCTypeSpec :: MaybeT (M l) (Maybe BindingSpec.CTypeSpec)
+    applyCTypeSpec = do
+      case (decl.kind, cTypeSpec.enum) of
+        (C.DeclEnum{}, _)       -> return ()
+        (_,            Nothing) -> return ()
+        (_,            Just{})  -> lift . State.modify' $
+          insertTrace
+            (withCallStack $ ResolveBindingSpecsEnumTypeMismatch decl.info.id)
+      return (Just cTypeSpec)
+
+    applyHsTypeSpec ::
+      MaybeT (M l) (C.Decl l PreviousPass, Maybe BindingSpec.HsTypeSpec)
+    applyHsTypeSpec = case mHsTypeSpec of
+      Nothing         -> return (decl, Nothing)
+      Just hsTypeSpec -> do
+        -- TODO <https://github.com/well-typed/hs-bindgen/issues/1447>
+        -- We should validate instances only set for supported kinds
+        -- (instances themselves are to be resolved in a separate pass)
+        (decl', hsRep') <- case hsTypeSpec.hsRep of
+          Nothing    -> return (decl, Nothing)
+          Just hsRep -> case hsRep of
+            BindingSpec.HsTypeRepRecord    recordRep  -> auxRecord recordRep
+            BindingSpec.HsTypeRepNewtype   newtypeRep -> auxNewtype newtypeRep
+            BindingSpec.HsTypeRepEmptyData            -> auxEmptyData
+            BindingSpec.HsTypeRepTypeAlias            -> auxTypeAlias
+        return (decl', Just hsTypeSpec{ BindingSpec.hsRep = hsRep' })
+
+    auxRecord ::
+         BindingSpec.HsRecordRep
+      -> MaybeT (M l) (C.Decl l PreviousPass, Maybe BindingSpec.HsTypeRep)
+    auxRecord recordRep =
+      -- TODO <https://github.com/well-typed/hs-bindgen/issues/1447>
+      -- We should validate the record type and number of fields.
+      return (decl, Just (BindingSpec.HsTypeRepRecord recordRep))
+
+    auxNewtype ::
+         BindingSpec.HsNewtypeRep
+      -> MaybeT (M l) (C.Decl l PreviousPass, Maybe BindingSpec.HsTypeRep)
+    auxNewtype newtypeRep =
+      -- TODO <https://github.com/well-typed/hs-bindgen/issues/1447>
+      -- We should validate enum, typedef, or macro type
+      return (decl, Just (BindingSpec.HsTypeRepNewtype newtypeRep))
+
+    auxEmptyData ::
+      MaybeT (M l) (C.Decl l PreviousPass, Maybe BindingSpec.HsTypeRep)
+    auxEmptyData = do
+      declIndex <- lift $ Reader.asks (.declIndex)
+      -- A complete C type keeps its size and alignment, so that a 'StaticSize'
+      -- instance can be generated for the empty data type.  Structs, unions, and
+      -- enums carry the layout directly; a typedef is followed to its underlying
+      -- type.  Types that are genuinely opaque in C, primitives and pointers
+      -- (whose size is not available at this pass), and macro types keep
+      -- 'Nothing'.
+      let (isValid, mSize) = case decl.kind of
+            C.DeclStruct s    -> (True, Just (C.OpaqueSize s.sizeof s.alignment))
+            C.DeclUnion  u    -> (True, Just (C.OpaqueSize u.sizeof u.alignment))
+            C.DeclEnum   e    -> (True, Just (C.OpaqueSize e.sizeof e.alignment))
+            C.DeclTypedef td  -> (True, underlyingOpaqueSize declIndex td.typ)
+            C.DeclOpaque m    -> (True, m)
+            C.DeclMacro macro -> case macro of
+              MacroType{}  -> (True,  Nothing)
+              MacroValue{} -> (False, Nothing)
+            _otherwise        -> (False, Nothing)
+      if isValid
+        then do
+          lift . State.modify' $
+              insertTrace (withCallStack $ ResolveBindingSpecsPreEmptyData decl.info.id)
+            . insertOpaquedType decl.info.id
+          -- Cannot use record update because 'C.kind' is ambiguous
+          let decl' = C.Decl{
+                  C.info = decl.info
+                , C.kind = C.DeclOpaque mSize
+                , C.ann  = decl.ann
+                }
+          return (decl', Just BindingSpec.HsTypeRepEmptyData)
+        else do
+          lift . State.modify' $
+            insertTrace (withCallStack $ ResolveBindingSpecsPreEmptyDataInvalid decl.info.id)
+          return (decl, Nothing)
+
+    auxTypeAlias ::
+      MaybeT (M l) (C.Decl l PreviousPass, Maybe BindingSpec.HsTypeRep)
+    auxTypeAlias =
+      -- TODO <https://github.com/well-typed/hs-bindgen/issues/1447>
+      -- We should validate types.
+      -- Return different decl?
+      return (decl, Just BindingSpec.HsTypeRepTypeAlias)
+
+-- | Size and alignment of an @emptydata@ type's underlying C type, when it can
+-- be determined at this pass.
+--
+-- 'C.getCanonicalType' resolves typedef and macro-type references and strips
+-- qualifiers, so a typedef to a struct or union surfaces as a 'C.TypeRef' to its
+-- declaration, whose layout we recover via the declaration index.  Primitives,
+-- pointers, and enums canonicalise to a type with no such reference and yield
+-- 'Nothing', since their sizes are not available in this frontend pass.
+underlyingOpaqueSize ::
+     DeclIndex l
+  -> C.Type PreviousPass
+  -> Maybe C.OpaqueSize
+underlyingOpaqueSize declIndex ty =
+    case C.getCanonicalType ty of
+      C.TypeRef declId -> do
+        decl <- DeclIndex.lookup declId declIndex
+        case decl.kind of
+          C.DeclStruct s -> pure (C.OpaqueSize s.sizeof s.alignment)
+          C.DeclUnion  u -> pure (C.OpaqueSize u.sizeof u.alignment)
+          _otherwise     -> Nothing
+      _otherwise       -> Nothing
+
+-- Pass two: deep
+--
+-- Types within the declaration are resolved, and it is reconstructed for the
+-- current pass.
+resolveDeep ::
+     C.Decl l PreviousPass
+  -> (Maybe BindingSpec.CTypeSpec, Maybe BindingSpec.HsTypeSpec)
+  -> M l (C.Decl l ResolveBindingSpecs)
+resolveDeep decl (cSpec, hsSpec) = do
+    declKind' <- resolve decl.info.id decl.kind
+    return C.Decl {
+        info = coercePass decl.info
+      , kind = declKind'
+      , ann  = PrescriptiveDeclSpec{cSpec = cSpec, hsSpec = hsSpec}
+      }
+
+{-------------------------------------------------------------------------------
+  Instances
+-------------------------------------------------------------------------------}
+
+-- | Resolve references to external declarations
+--
+-- This is part of the second pass ('resolveDeep').
+--
+-- We do not need to handle references to omitted declarations here since
+-- declarations depending on unavailable declarations will be removed in the
+-- @Select@ pass.
+class Resolve a l where
+  resolve ::
+       HasCallStack
+    => C.DeclId -- context declaration
+    -> a PreviousPass
+    -> M l (a ResolveBindingSpecs)
+
+resolveFlip ::
+     Resolve (Flip f n) l
+  => C.DeclId
+  -> f PreviousPass n
+  -> M l (f ResolveBindingSpecs n)
+resolveFlip declId = flipM (resolve declId)
+
+instance Resolve (C.DeclKind l) l where
+  resolve ctx = \case
+      C.DeclStruct struct                  -> C.DeclStruct   <$> resolve ctx struct
+      C.DeclUnion union                    -> C.DeclUnion    <$> resolve ctx union
+      C.DeclTypedef typedef                -> C.DeclTypedef  <$> resolve ctx typedef
+      C.DeclEnum enum                      -> C.DeclEnum     <$> resolve ctx enum
+      C.DeclUntaggedEnumConstant enumConst -> pure $ C.DeclUntaggedEnumConstant (coercePass enumConst)
+      C.DeclOpaque mSize                   -> return (C.DeclOpaque mSize)
+      C.DeclMacro macro                    -> C.DeclMacro    <$> resolveFlip ctx macro
+      C.DeclFunction fun                   -> C.DeclFunction <$> resolve ctx fun
+      C.DeclGlobal ty                      -> C.DeclGlobal   <$> resolve ctx ty
+
+instance Resolve C.Struct l where
+  resolve ctx struct =
+      reconstruct
+        <$> mapM (resolve ctx) struct.fields
+        <*> C.traverseFlamField (resolve ctx) struct.flam
+    where
+      reconstruct ::
+           [C.Field ResolveBindingSpecs]
+        -> C.Flam ResolveBindingSpecs
+        -> C.Struct ResolveBindingSpecs
+      reconstruct structFields' structFlam' = C.Struct {
+            fields    = structFields'
+          , flam      = structFlam'
+          , sizeof    = struct.sizeof
+          , alignment = struct.alignment
+          , ann       = struct.ann
+          }
+
+instance Resolve C.Union l where
+  resolve ctx union =
+      reconstruct <$> mapM (resolve ctx) union.fields
+    where
+      reconstruct ::
+           [C.Field ResolveBindingSpecs]
+        -> C.Union ResolveBindingSpecs
+      reconstruct unionFields' = C.Union {
+          fields    = unionFields'
+        , sizeof    = union.sizeof
+        , alignment = union.alignment
+        , ann       = union.ann
+        }
+
+instance Resolve C.Field l where
+  resolve ctx = \case
+      C.FieldRegular  field -> C.FieldRegular  <$> resolve ctx field
+      C.FieldImplicit field -> C.FieldImplicit <$> resolve ctx field
+
+instance Resolve C.RegularField l where
+  resolve ctx field =
+      reconstruct <$> resolve ctx field.typ
+    where
+      reconstruct ::
+           C.Type ResolveBindingSpecs
+        -> C.RegularField ResolveBindingSpecs
+      reconstruct typ' = C.RegularField {
+          typ    = typ'
+        , info   = coercePass field.info
+        , offset = field.offset
+        , width  = field.width
+        , ann    = field.ann
+        }
+
+instance Resolve C.ImplicitField l where
+  resolve ctx field = do
+      typRef' <- resolve ctx field.typRef
+      indirect' <- mapM (resolveIndirectField ctx) field.indirect
+      pure $ reconstruct typRef' $ catMaybes indirect'
+    where
+      reconstruct ::
+           C.AnonRef ResolveBindingSpecs
+        -> [C.IndirectField ResolveBindingSpecs]
+        -> C.ImplicitField ResolveBindingSpecs
+      reconstruct typRef' indirect' = C.ImplicitField {
+          typRef   = typRef'
+        , info     = coercePass field.info
+        , offset   = field.offset
+        , indirect = indirect'
+        , ann      = field.ann
+        }
+
+instance Resolve C.AnonRef l where
+  resolve ctx (C.AnonRef ref) = do
+      mResolved <- resolveUseSite ctx ref
+      let underlying' = C.TypeRef ref
+      case mResolved of
+        Just r  -> return $ C.AnonExtBinding $ C.Ref r underlying'
+        Nothing -> return $ C.AnonRef ref
+
+resolveIndirectField ::
+     HasCallStack
+  => C.DeclId
+  -> C.IndirectField PreviousPass
+  -> M l (Maybe (C.IndirectField ResolveBindingSpecs))
+resolveIndirectField ctx field = do
+    path' <- mapM (resolve ctx) field.path
+    -- We can only generate bindings for indirect fields if we know how to get
+    -- there via nested uses of 'HasField.getField'. We can't do this if the
+    -- indirect field goes via an anonymous struct/union that is specified by an
+    -- external binding spec. In such cases, the binding spec does not include
+    -- enough information to generate bindings, so we drop the indirect field.
+    --
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/2152>:
+    -- theoretically we could generate bindings for indirect fields that cross
+    -- binding spec boundaries
+    if any crossesBoundary path' then do
+      State.modify' $
+        insertTrace (withCallStack $ ResolveBindingSpecsIndirectFieldDropped ctx field.info.name)
+      pure Nothing
+    else
+      Just <$> (reconstruct <$> resolve ctx field.typ <*> pure path')
+  where
+    crossesBoundary = \case
+        C.AnonRef{} -> False
+        C.AnonExtBinding{} -> True
+
+    reconstruct ::
+          C.Type ResolveBindingSpecs
+      -> [C.AnonRef ResolveBindingSpecs]
+      -> C.IndirectField ResolveBindingSpecs
+    reconstruct typ' path' = C.IndirectField {
+        typ    = typ'
+      , info   = coercePass field.info
+      , offset = field.offset
+      , width  = field.width
+      , path   = path'
+      , ann    = field.ann
+      }
+
+instance Resolve C.Enum l where
+  resolve ctx enum =
+      reconstruct <$> resolve ctx enum.typ
+    where
+      reconstruct :: C.Type ResolveBindingSpecs -> C.Enum ResolveBindingSpecs
+      reconstruct enumType' = C.Enum {
+          typ       = enumType'
+        , constants = map coercePass enum.constants
+        , sizeof    = enum.sizeof
+        , alignment = enum.alignment
+        , ann       = enum.ann
+        }
+
+instance Resolve C.Typedef l where
+  resolve ctx typedef =
+      reconstruct <$> resolve ctx typedef.typ
+    where
+      reconstruct :: C.Type ResolveBindingSpecs -> C.Typedef ResolveBindingSpecs
+      reconstruct typedefType' = C.Typedef {
+            typ = typedefType'
+          , ann = typedef.ann
+          }
+
+instance Resolve C.Function l where
+  resolve ctx function =
+    reconstruct
+      <$> mapM (resolve ctx) function.args
+      <*> resolve ctx function.res
+    where
+      reconstruct ::
+           [C.FunctionArg ResolveBindingSpecs]
+        -> C.Type ResolveBindingSpecs
+        -> C.Function ResolveBindingSpecs
+      reconstruct functionArgs' functionRes' = C.Function {
+          args  = functionArgs'
+        , res   = functionRes'
+        , attrs = function.attrs
+        , ann   = function.ann
+        }
+
+instance Resolve C.Global l where
+  resolve ctx global =
+      reconstruct <$> resolve ctx global.typ
+    where
+      reconstruct :: C.Type ResolveBindingSpecs -> C.Global ResolveBindingSpecs
+      reconstruct globalType' = C.Global{
+            typ = globalType'
+          , ann = global.ann
+          }
+
+instance Resolve C.FunctionArg l where
+  resolve ctx functionArg =
+    reconstruct
+      <$> resolve ctx functionArg.typ
+    where
+      reconstruct ::
+           C.Type ResolveBindingSpecs
+        -> C.FunctionArg ResolveBindingSpecs
+      reconstruct typ' = C.FunctionArg{
+            name = functionArg.name
+          , typ  = typ'
+          , ann  = functionArg.ann
+          }
+
+instance Resolve (Flip TypecheckedMacro l) l where
+  resolve ctx (Flip m) = Flip <$> case m of
+    MacroType  typ -> MacroType  <$> resolve ctx typ
+    MacroValue val -> MacroValue <$> pure (coercePass val)
+
+instance Resolve (TypecheckedMacroType l) l where
+  resolve ctx = \case
+      (TypecheckedMacroType body deps ann) -> do
+        body' <- traverse resolveVar body
+        pure TypecheckedMacroType{
+            body = body'
+          , deps = deps
+          , ann  = ann
+          }
+    where
+      -- TODO <https://github.com/well-typed/hs-bindgen/issues/1969>
+      --
+      -- Usage of 'MacroTypeBodyVar' hints at possible drawbacks of our design
+      -- of 'C.DeclId'. Maybe we can directly refer to external bindings from
+      -- 'C.DeclId'?
+      resolveVar ::
+           MacroTypeBodyVar PreviousPass
+        -> M l (MacroTypeBodyVar ResolveBindingSpecs)
+      resolveVar (MacroTypeExtBinding   x) = absurd x
+      resolveVar (MacroTypeBodyVar declId) = do
+          mExt <- resolveUseSite ctx declId
+          pure $ case mExt of
+            Just ext -> MacroTypeExtBinding ext
+            Nothing  -> MacroTypeBodyVar declId
+
+instance Resolve C.Type l where
+  resolve ctx = \case
+      C.TypeRef uid -> do
+        mResolved <- resolveUseSite ctx uid
+        let ref' = C.TypeRef uid
+        case mResolved of
+          Just r  -> return $ C.TypeExtBinding $ C.Ref r ref'
+          Nothing -> return ref'
+      C.TypeEnum ref -> do
+        mResolved <- resolveUseSite ctx ref.name
+        underlying' <- resolve ctx ref.underlying
+        let ref' = C.TypeEnum (C.Ref ref.name underlying')
+        case mResolved of
+          Just r  -> return $ C.TypeExtBinding $ C.Ref r ref'
+          Nothing -> return ref'
+      C.TypeMacro ref -> do
+        mResolved <- resolveUseSite ctx ref.name
+        underlying' <- resolve ctx ref.underlying
+        let ref' = C.TypeMacro (C.MacroRef ref.name underlying')
+        case mResolved of
+          Just r  -> return $ C.TypeExtBinding $ C.Ref r ref'
+          Nothing -> return ref'
+      C.TypeTypedef ref -> do
+        mResolved <- resolveUseSite ctx ref.name
+        underlying' <- resolve ctx ref.underlying
+        let ref' = C.TypeTypedef (C.Ref ref.name underlying')
+        case mResolved of
+          Just r  -> return $ C.TypeExtBinding $ C.Ref r ref'
+          Nothing -> return ref'
+
+      -- Recursive cases
+      C.TypePointers n t      -> C.TypePointers n <$> resolve ctx t
+      C.TypeFun args res      ->
+        C.TypeFun <$> mapM (resolve ctx) args <*> resolve ctx res
+      C.TypeConstArray n t    -> C.TypeConstArray n <$> resolve ctx t
+      C.TypeIncompleteArray t -> C.TypeIncompleteArray <$> resolve ctx t
+      C.TypeBlock t           -> C.TypeBlock <$> resolve ctx t
+      C.TypeQual qual t       -> C.TypeQual qual <$> resolve ctx t
+
+      -- Simple cases
+      C.TypePrim t         -> return (C.TypePrim t)
+      C.TypeVoid           -> return (C.TypeVoid)
+      C.TypeComplex t      -> return (C.TypeComplex t)
+
+instance Resolve C.TypeFunArg l where
+  resolve ctx arg = do
+      typ' <- resolve ctx arg.typ
+      pure C.TypeFunArgF {
+          typ = typ'
+        , ann = arg.ann
+        }
+
+resolveUseSite ::
+     HasCallStack
+  => C.DeclId
+     -- ^ The declaration in which we resolve the use site; used for trace
+     -- messages only
+  -> C.DeclId
+     -- ^ Use site itself
+  -> M l (Maybe BindingSpec.ResolvedExtBinding)
+resolveUseSite ctx cDeclId = Reader.ask >>= \env -> State.get >>= \state ->
+    case Map.lookup cDeclId state.extTypes of
+      -- 1. Search cache: We expect all usable declarations with external
+      -- bindings to be in the cache.
+      Just ty -> do
+        State.modify' $ insertTrace (withCallStack $ ResolveBindingSpecsExtType ctx cDeclId)
+        pure (Just ty)
+      -- 2. No cache hit: The declaration is either usable and has no external
+      -- binding, or it is unusable.
+      Nothing ->
+        case DeclIndex.lookupEntry cDeclId env.declIndex of
+          Nothing ->
+            panicPure $
+              "resolveUseSite: declaration ID "
+              <> show cDeclId
+              <> " not in declaration index"
+          -- Interesting case, an unusable declaration may have an external
+          -- binding specification.
+          Just (DeclIndex.UnusableEntry x) -> do
+              let locs :: C.DeclLocs
+                  locs = DeclIndex.unusableToLoc x
+                  declPaths =
+                    foldMap
+                      (IncludeGraph.reaches env.includeGraph)
+                      (mapMaybe (C.declPathRealPath . singleLocPath) $
+                        C.declLocsToList locs)
+              mTy <- resolveExtBinding cDeclId locs declPaths Nothing
+              case mTy of
+                Just ty -> do
+                  State.modify' $
+                      insertTrace (withCallStack $ ResolveBindingSpecsExtType ctx cDeclId)
+                    . insertExtType cDeclId ty
+                  pure (Just ty)
+                Nothing -> pure Nothing
+          -- Cannot have an external binding specification.
+          Just DeclIndex.UsableEntry{} ->
+            pure Nothing
+
+{-------------------------------------------------------------------------------
+  Internal: auxiliary functions
+-------------------------------------------------------------------------------}
+
+-- | Lookup qualified name in the 'HsBindgen.BindingSpec.Private.V1.ResolvedBindingSpec'
+resolveExtBinding ::
+     HasCallStack
+  => C.DeclId
+  -> C.DeclLocs
+  -> Set RealPath
+     -- | Message to emit for omitted types.
+  -> Maybe (AnnMsg ResolveBindingSpecs)
+  -> M l (Maybe BindingSpec.ResolvedExtBinding)
+resolveExtBinding cDeclId locs declPaths mMsg = do
+    env <- Reader.ask
+    case BindingSpec.lookupMergedBindingSpecs cDeclId declPaths env.extSpecs of
+      Just (hsModuleName, BindingSpec.Require cTypeSpec, mHsTypeSpec) ->
+        case (cTypeSpec.hsName, mHsTypeSpec) of
+          (Just hsName, Just hsTypeSpec) -> do
+            let resolved = BindingSpec.ResolvedExtBinding {
+                    cName  = cDeclId
+                  , locs   = locs
+                  , hsName = Hs.ExtRef hsModuleName hsName
+                  , cSpec  = cTypeSpec
+                  , hsSpec = hsTypeSpec
+                  }
+            State.modify' $ insertExtType cDeclId resolved
+            return (Just resolved)
+          (Nothing, _) -> do
+            State.modify' $
+              insertTrace (withCallStack $ ResolveBindingSpecsExtHsRefNoIdentifier cDeclId)
+            return Nothing
+          (_, Nothing) -> do
+            State.modify' $
+              insertTrace (withCallStack $ ResolveBindingSpecsNoHsTypeSpec cDeclId)
+            return Nothing
+      Just (_hsModuleName, BindingSpec.Omit, _mHsTypeSpec) -> do
+        forM_ mMsg $ \msg -> State.modify' $ insertTrace msg
+        return Nothing
+      Nothing ->
+        return Nothing
diff --git a/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/ResolveBindingSpecs/IsPass.hs
@@ -0,0 +1,181 @@
+module HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass (
+    ResolveBindingSpecs
+  , PrescriptiveDeclSpec(..)
+  , ResolveBindingSpecsMsg(..)
+  ) where
+
+import Text.SimplePrettyPrint ((<+>))
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Resolve binding specifications
+--
+-- For every C name, we resolve:
+--
+-- * External binding specification, which is used to specify existing bindings
+--   that should be used, external from the module being generated.  Matching
+--   types are replaced with external references, and matching declarations are
+--   removed from the AST.
+-- * Prescriptive binding specification, which is used to configure how bindings
+--   are generated.  This information is added to the AST as annotations.
+type ResolveBindingSpecs :: Pass
+data ResolveBindingSpecs a
+
+type family AnnResolveBindingSpecs ix where
+  AnnResolveBindingSpecs "Decl" = PrescriptiveDeclSpec
+  AnnResolveBindingSpecs _      = NoAnn
+
+instance IsPass ResolveBindingSpecs
+
+instance PassId ResolveBindingSpecs
+
+instance PassScopedName ResolveBindingSpecs
+
+instance PassTypes ResolveBindingSpecs
+
+instance PassMacro ResolveBindingSpecs where
+  type MacroId         ResolveBindingSpecs = Id ResolveBindingSpecs
+  type MacroBody       ResolveBindingSpecs = TypecheckedMacro ResolveBindingSpecs
+  type MacroUnderlying ResolveBindingSpecs = C.Type ResolveBindingSpecs
+
+  macroIdId _ = id
+
+instance PassExtBinding ResolveBindingSpecs where
+  type ExtBinding ResolveBindingSpecs = BindingSpec.ResolvedExtBinding
+
+  extBindingId _ = (.cName)
+
+instance PassCommentDecl ResolveBindingSpecs where
+  type CommentDecl ResolveBindingSpecs = Maybe (C.Comment ResolveBindingSpecs)
+
+instance PassAnn ResolveBindingSpecs where
+  type Ann ix ResolveBindingSpecs = AnnResolveBindingSpecs ix
+
+instance PassMsg ResolveBindingSpecs where
+  type Msg ResolveBindingSpecs = ResolveBindingSpecsMsg
+
+-- | Prescriptive binding specification for declaration
+--
+-- Although we have interpreted /part/ of this binding specification during
+-- name mangling, we leave the /full/ binding specification in the AST, because
+-- we need it when we /generate/ the output binding specification.
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1770>
+-- If we have binding specs for different kinds of things (types, functions, ..)
+-- we may want to have different types for those kinds of specs, and then
+-- associate the appropriate type with specific 'HsBindgen.Frontend.AST.Decl.DeclKind's (rather than this
+-- "catch all" type with the top-level 'HsBindgen.Frontend.AST.Decl.Decl').
+data PrescriptiveDeclSpec = PrescriptiveDeclSpec {
+      cSpec  :: Maybe BindingSpec.CTypeSpec
+    , hsSpec :: Maybe BindingSpec.HsTypeSpec
+    }
+  deriving stock (Show, Eq, Generic)
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+data ResolveBindingSpecsMsg =
+    ResolveBindingSpecsModuleMismatch       Hs.ModuleName Hs.ModuleName
+  | ResolveBindingSpecsEnumTypeMismatch     C.DeclId
+  | ResolveBindingSpecsExtHsRefNoIdentifier C.DeclId
+  | ResolveBindingSpecsNoHsTypeSpec         C.DeclId
+  | ResolveBindingSpecsOmittedType          C.DeclId
+  | ResolveBindingSpecsTypeNotUsed          C.DeclId
+  | ResolveBindingSpecsExtDecl              C.DeclId
+  | ResolveBindingSpecsExtType              C.DeclId C.DeclId
+  | ResolveBindingSpecsPreRequire           C.DeclId
+  | ResolveBindingSpecsPreOmit              C.DeclId
+  | ResolveBindingSpecsPreEmptyData         C.DeclId
+  | ResolveBindingSpecsPreEmptyDataInvalid  C.DeclId
+  | ResolveBindingSpecsIndirectFieldDropped C.DeclId C.ScopedName
+  deriving stock (Show)
+
+instance PrettyForTrace ResolveBindingSpecsMsg where
+  prettyForTrace = \case
+      ResolveBindingSpecsModuleMismatch hsModuleName pSpecHsModuleName ->
+        "Prescriptive binding specification for module"
+          <+> prettyForTrace pSpecHsModuleName
+          <+> "cannot be used to generate"
+          <+> prettyForTrace hsModuleName
+      ResolveBindingSpecsEnumTypeMismatch cDeclId ->
+        "C enum specification for non-enum type:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsExtHsRefNoIdentifier cDeclId ->
+        "Haskell identifier not specified in binding specification:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsNoHsTypeSpec cDeclId ->
+        "Haskell type spec not specified in binding specification:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsOmittedType cDeclId ->
+        "Type omitted by binding specification used:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsTypeNotUsed cDeclId ->
+        "Binding specification for type not used:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsExtDecl cDeclId ->
+        "Declaration with external binding dropped:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsExtType ctx cDeclId ->
+        "Within declaration"
+          <+> prettyForTrace ctx
+          <+> "type replaced with external binding:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsPreRequire cDeclId ->
+        "Prescriptive binding specification found:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsPreOmit cDeclId ->
+        "Declaration omitted by prescriptive binding specification:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsPreEmptyData cDeclId ->
+        "Declaration opaqued by prescriptive binding specification:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsPreEmptyDataInvalid cDeclId ->
+        "Declaration opaqued by prescriptive binding specification invalid for kind:"
+          <+> prettyForTrace cDeclId
+      ResolveBindingSpecsIndirectFieldDropped cDeclId cFieldName ->
+        "Within declaration"
+          <+> prettyForTrace cDeclId
+          <+> "dropped an indirect field that points into a dropped declaration"
+          <+> ":"
+          <+> prettyForTrace cFieldName
+
+instance IsTrace Level ResolveBindingSpecsMsg where
+  getDefaultLogLevel = \case
+    ResolveBindingSpecsModuleMismatch{}       -> Warning
+    ResolveBindingSpecsEnumTypeMismatch{}     -> Warning
+    ResolveBindingSpecsExtHsRefNoIdentifier{} -> Warning
+    ResolveBindingSpecsNoHsTypeSpec{}         -> Warning
+    ResolveBindingSpecsOmittedType{}          -> Info
+    ResolveBindingSpecsTypeNotUsed{}          -> Warning
+    ResolveBindingSpecsExtDecl{}              -> Info
+    ResolveBindingSpecsExtType{}              -> Info
+    ResolveBindingSpecsPreRequire{}           -> Info
+    ResolveBindingSpecsPreOmit{}              -> Info
+    ResolveBindingSpecsPreEmptyData{}         -> Info
+    ResolveBindingSpecsPreEmptyDataInvalid{}  -> Warning
+    ResolveBindingSpecsIndirectFieldDropped{} -> Warning
+  getSource          = const HsBindgen
+  getTraceId         = const "resolve-binding-specs"
+
+{-------------------------------------------------------------------------------
+  CoercePass
+-------------------------------------------------------------------------------}
+
+instance CoercePassId               ReparseMacroExpansions ResolveBindingSpecs
+instance CoercePassMacroId          ReparseMacroExpansions ResolveBindingSpecs
+instance CoercePassAnn "TypeFunArg" ReparseMacroExpansions ResolveBindingSpecs
+
+instance CoercePassCommentDecl ReparseMacroExpansions ResolveBindingSpecs where
+  coercePassCommentDecl _ = fmap coercePass
diff --git a/src-internal/HsBindgen/Frontend/Pass/Select.hs b/src-internal/HsBindgen/Frontend/Pass/Select.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Select.hs
@@ -0,0 +1,717 @@
+module HsBindgen.Frontend.Pass.Select (
+    selectDecls
+  ) where
+
+import Data.Foldable qualified as Foldable
+import Data.List qualified as List
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Map.Strict qualified as Map
+import Data.Maybe (listToMaybe, maybeToList)
+import Data.Set ((\\))
+import Data.Set qualified as Set
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Errors (panicPure)
+import HsBindgen.Frontend.Analysis.DeclIndex (DeclIndex, Entry (..),
+                                              Success (..), UnusableEntry (..),
+                                              UnusableReason (..),
+                                              UsableEntry (..))
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Analysis.DeclUseGraph (DeclUseGraph)
+import HsBindgen.Frontend.Analysis.DeclUseGraph qualified as DeclUseGraph
+import HsBindgen.Frontend.Analysis.IncludeGraph (IncludeGraph)
+import HsBindgen.Frontend.Analysis.IncludeGraph qualified as IncludeGraph
+import HsBindgen.Frontend.Analysis.UseDeclGraph (UseDeclGraph)
+import HsBindgen.Frontend.Analysis.UseDeclGraph qualified as UseDeclGraph
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Translation
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Data types
+-------------------------------------------------------------------------------}
+
+-- Declaration itself.
+type Decl l = C.Decl l Select
+
+-- | Internal data type! This data type
+-- 'HsBindgen.Frontend.Pass.Select.Unselectable' refers to declarations that are
+-- not selectable _from the perspective of `hs-bindgen`_; and, in particular,
+-- not from the perspective of the user (they can change the select predicate).
+--
+-- Also, (and in contrast to 'UsableEntry'/'UnusableEntry'), selectability _is
+-- concerned with transitivity_. All transitive dependencies of a selectable
+-- declaration must also be selectable.
+data Unselectable =
+    -- | We (i.e., `hs-bindgen`) can not select a declaration selected because
+    --   it or one of its dependencies is unusable.
+    Unselectable UnusableEntry
+    -- | We (i.e., `hs-bindgen`) can not select a declaration because one of its
+    --   dependencies has not been selected by the user.
+  | UnselectableDependencyNotSelected
+  deriving stock (Show)
+
+-- | We have to treat with two notions of usability here:
+--
+-- 1. A declaration can be usable because it is in the list of declarations
+--    attached to the translation unit.
+--
+-- 2. A declaration is available if the declaration itself and all of its
+--    transitive dependencies are available.
+--
+-- @TransitiveSelectability@ deals with the second type.
+--
+-- (We avoid the term available, because it is overloaded with Clang's
+-- CXAvailabilityKind).
+data TransitiveSelectability =
+    TransitivelySelectable
+    -- | For each transitive dependency, we try to give the root cause of
+    -- unavailability.
+    --
+    -- We should use a "non-empty" map here.
+  | TransitivelyUnselectable (Map C.DeclId Unselectable)
+  deriving stock (Show)
+
+{-------------------------------------------------------------------------------
+  Select
+-------------------------------------------------------------------------------}
+
+selectDecls ::
+     forall l. HasCallStack
+  => IsMainHeader
+  -> IsInMainHeaderDir
+  -> SelectConfig
+  -> C.TranslationUnit l TranslateTypes
+  -> (C.TranslationUnit l Select, [AnnMsg Select])
+selectDecls isMainHeader isInMainHeaderDir config unit =
+    let -- Directly match the selection predicate on the 'DeclIndex', obtaining
+        -- information about succeeded _and failed_ selection roots.
+        selectionRootsIndex :: DeclIndex l
+        selectionRootsIndex = selectDeclIndex unit.meta.declUseGraph match index
+
+        -- Identifiers of selection roots. Some of them may be unavailable
+        -- (i.e., not in the 'succeeded' map, and hence, not in the list of
+        -- declarations attached to the translation unit).
+        rootIds :: Set C.DeclId
+        rootIds = DeclIndex.keysSet selectionRootsIndex
+
+        -- Identifiers of transitive dependencies including selection roots.
+        rootAndTransDepIds :: Set C.DeclId
+        rootAndTransDepIds = UseDeclGraph.getTransitiveDeps useDeclGraph rootIds
+
+        -- Identifiers of transitive dependencies excluding selection roots.
+        strictTransDepIds :: Set C.DeclId
+        strictTransDepIds = rootAndTransDepIds \\ rootIds
+
+        -- Identifiers of all selected declarations.
+        selectedIds :: Set C.DeclId
+        -- Identifiers of (additional) transitive dependencies selected due to
+        -- program slicing. This is the only point where we differentiate
+        -- between selection with or without program slicing.
+        additionalSelectedTransDepIds :: Set C.DeclId
+        (selectedIds, additionalSelectedTransDepIds) = case config.programSlicing of
+          DisableProgramSlicing -> (rootIds        , Set.empty)
+          EnableProgramSlicing  -> (rootAndTransDepIds, strictTransDepIds)
+
+        additionalSelectedTransDepsIndex :: DeclIndex l
+        additionalSelectedTransDepsIndex = DeclIndex.restrictKeys index additionalSelectedTransDepIds
+
+        notSelectedIndex :: DeclIndex l
+        notSelectedIndex = DeclIndex.withoutKeys index selectedIds
+
+        getTransitiveSelectability :: C.DeclId -> TransitiveSelectability
+        getTransitiveSelectability x
+          | Map.null unusabilityReasons = TransitivelySelectable
+          | otherwise                   = TransitivelyUnselectable unusabilityReasons
+          where
+            transDeps :: Set C.DeclId
+            transDeps =
+              UseDeclGraph.getStrictTransitiveDeps
+                useDeclGraph
+                (Set.singleton x)
+
+            unusables :: Map C.DeclId Unselectable
+            unusables =
+              Unselectable <$> DeclIndex.getUnusables index transDeps
+
+            nonselected :: Map C.DeclId Unselectable
+            nonselected  =
+              Map.fromSet (const UnselectableDependencyNotSelected) $
+                transDeps \\ selectedIds
+
+            unusabilityReasons :: Map C.DeclId Unselectable
+            unusabilityReasons =
+              Map.unionWith
+                getMostNaturalUnselectable
+                unusables
+                nonselected
+
+            -- Get the reason that is most useful to the user about why a
+            -- declaration is unselectable.
+            getMostNaturalUnselectable ::
+              Unselectable -> Unselectable -> Unselectable
+            getMostNaturalUnselectable l r =
+              case (l,r) of
+                (UnselectableDependencyNotSelected, Unselectable u) ->
+                  case u of
+                    UnusableReason _ UnusableUnavailable -> r
+                    UnusableReason _ UnusableOmitted     -> r
+                    _otherReason                         -> l
+                (Unselectable u, UnselectableDependencyNotSelected) ->
+                  case u of
+                    UnusableReason _ UnusableUnavailable -> l
+                    UnusableReason _ UnusableOmitted{}   -> l
+                    _otherReason                         -> r
+                (_, _) -> l
+
+        selectDecl :: Decl l -> Maybe (Decl l)
+        selectDecl =
+          selectDeclWith
+            selectedIds
+            getTransitiveSelectability
+
+        unitDecls :: [Decl l]
+        unitDecls = map coercePass unit.decls
+
+        selectedUnitDecls  :: [Decl l]
+        selectedUnitDecls = mapMaybe selectDecl unitDecls
+
+        selectMsgs :: [AnnMsg Select]
+        selectMsgs =
+          getSelectMsgs
+            rootIds
+            additionalSelectedTransDepIds
+            getTransitiveSelectability
+            index
+
+        unitSelect :: C.TranslationUnit l Select
+        unitSelect = C.TranslationUnit {
+                decls        = selectedUnitDecls
+              , includeGraph = unit.includeGraph
+              , meta         = unit.meta
+              }
+
+        -- If there were no predicate matches we issue a warning to the user.
+        noDeclarationsMatchedMsg :: [AnnMsg Select]
+        noDeclarationsMatchedMsg = [
+            withCallStack C.WithLocationInfo{
+                loc = C.LocationUnavailable
+              , msg = SelectNoDeclarationsMatched
+              }
+          | Set.null rootIds
+          ]
+
+        selectionRootMsgs :: [AnnMsg Select]
+        selectionRootMsgs = getDelayedMsgsSelectionRoots selectionRootsIndex
+
+        -- Number of selected macros that hs-bindgen dropped.
+        droppedMacroCount :: Int
+        droppedMacroCount =
+          length $ filter (\m -> isDroppedMacro m.traceMsg.msg) selectionRootMsgs
+
+        -- Single summary of dropped macros.
+        macrosDroppedSummaryMsg :: [AnnMsg Select]
+        macrosDroppedSummaryMsg = [
+            withCallStack C.WithLocationInfo{
+                loc = C.LocationUnavailable
+              , msg = SelectMacrosDropped droppedMacroCount
+              }
+          | droppedMacroCount > 0
+          ]
+
+        msgs :: [AnnMsg Select]
+        msgs =
+          concat [
+              selectMsgs
+            , selectionRootMsgs
+            , getDelayedMsgsAdditionalSelectedTransDeps additionalSelectedTransDepsIndex
+            , getBugMsgsNotSelected notSelectedIndex
+            , noDeclarationsMatchedMsg
+            ]
+
+    in  ( unitSelect
+        , sortSelectMsgs unit.includeGraph msgs ++ macrosDroppedSummaryMsg
+        )
+  where
+    index :: DeclIndex l
+    index = unit.meta.declIndex
+
+    useDeclGraph :: UseDeclGraph
+    useDeclGraph = unit.meta.useDeclGraph
+
+    match :: Match
+    match name loc availability =
+      matchSelect
+        isMainHeader
+        isInMainHeaderDir
+        (singleLocPath loc)
+        name
+        availability
+        config.selectionPredicate
+
+{-------------------------------------------------------------------------------
+  Filter list of declarations
+-------------------------------------------------------------------------------}
+
+selectDeclWith ::
+  -- | Selected declaration IDs.
+     Set C.DeclId
+  -> (C.DeclId -> TransitiveSelectability)
+  -> Decl l
+  -> Maybe (Decl l)
+selectDeclWith
+  selectedIds
+  getTransitiveSelectability
+  decl =
+    case (isSelected, transitiveSelectability) of
+      (True, TransitivelySelectable) -> Just decl
+      _otherwise                     -> Nothing
+  where
+    declId :: C.DeclId
+    declId = decl.info.id.cName
+
+    isSelected :: Bool
+    isSelected = Set.member declId selectedIds
+
+    transitiveSelectability :: TransitiveSelectability
+    transitiveSelectability = getTransitiveSelectability declId
+
+{-------------------------------------------------------------------------------
+  Select traces
+-------------------------------------------------------------------------------}
+
+getSelectMsgs ::
+     forall l. HasCallStack
+  => Set C.DeclId
+  -- ^ Selection roots.
+  -> Set C.DeclId
+  -- ^ Additionally selected transitive dependencies (non-empty when program
+  --   slicing is enabled).
+  ->(C.DeclId -> TransitiveSelectability)
+  -> DeclIndex l
+  -> [AnnMsg Select]
+getSelectMsgs
+  rootIds
+  additionalSelectedTransDepIds
+  getTransitiveSelectability
+  declIndex
+  = concatMap (uncurry aux) $ DeclIndex.toList declIndex
+  where
+    aux ::
+         HasCallStack
+      => C.DeclId
+      -> Entry l
+      -> [AnnMsg Select]
+    aux =
+      getSelectMsgsDeclId
+        getTransitiveSelectability
+        declIndex
+        rootIds
+        additionalSelectedTransDepIds
+
+getSelectMsgsDeclId ::
+    HasCallStack
+  => (C.DeclId -> TransitiveSelectability)
+  -> DeclIndex l
+  -- | Selection roots.
+  -> Set C.DeclId
+  -- | Additionally selected transitive dependencies (non-empty when program
+  --   slicing is enabled).
+  -> Set C.DeclId
+  -> C.DeclId
+  -> Entry l
+  -> [AnnMsg Select]
+getSelectMsgsDeclId
+  getTransitiveSelectability
+  declIndex
+  rootIds
+  additionalSelectedTransDepIds
+  declId
+  entry
+  = case ( isSelectedRoot
+         , isAdditionalSelectedTransDep
+         , transitiveSelectability ) of
+      -- Declaration is a selection root.
+      (True, False, TransitivelySelectable) ->
+        getMsgsFor SelectionRoot
+      (True, False, TransitivelyUnselectable rs) ->
+        maybeToList $ getUnavailMsg SelectionRoot rs
+      -- Declaration is an additionally selected transitive dependency.
+      (False, True, TransitivelySelectable) ->
+        getMsgsFor TransitiveDependency
+      (False, True, TransitivelyUnselectable rs) ->
+        maybeToList $ getUnavailMsg TransitiveDependency rs
+      -- Declaration is not selected.
+      (False, False, _) ->
+        [withLoc $ SelectStatusInfo NotSelected]
+      -- Declaration is a selection root and a transitive dependency. This
+      -- should be impossible and we consider it a bug.
+      (True, True, _) ->
+        panicPure $
+          "Declaration is selection root and transitive dependency: "
+          ++ show (withLoc declId)
+  where
+    -- We check three conditions:
+    isSelectedRoot = Set.member declId rootIds
+    -- These are also always strict transitive dependencies.
+    isAdditionalSelectedTransDep =
+      Set.member declId additionalSelectedTransDepIds
+    transitiveSelectability = getTransitiveSelectability declId
+
+    getMsgsFor :: HasCallStack => SelectReason -> [AnnMsg Select]
+    getMsgsFor selectReason = concat [
+          [ withLoc $ SelectStatusInfo (Selected selectReason) ]
+        , [ withLoc $ SelectDeprecated selectReason | isDeprecated ]
+        ]
+
+    withLoc :: HasCallStack => a -> WithCallStack (C.WithLocationInfo a)
+    withLoc x = withCallStack C.WithLocationInfo{
+                  loc = C.declIdLocationInfo declId $
+                          C.declLocsToList $
+                            DeclIndex.entryToLoc entry
+                , msg = x
+                }
+
+    getUnavailMsg ::
+         HasCallStack
+      => SelectReason
+      -> Map C.DeclId Unselectable
+      -> Maybe (AnnMsg Select)
+    getUnavailMsg selectReason unavailReasons =
+        if null msgs then
+          Nothing
+        else
+          Just $ withLoc $ TransitiveDependenciesMissing selectReason msgs
+      where
+        msgs = [
+               case r of
+                 Unselectable u ->
+                   TransitiveDependencyUnusable i u
+                 UnselectableDependencyNotSelected ->
+                   TransitiveDependencyNotSelected i locs
+             | (i, r) <- Map.toList unavailReasons
+             , let locs = case DeclIndex.lookupLoc i declIndex of
+                     Nothing -> []
+                     Just xs -> C.declLocsToList xs
+             ]
+
+    isDeprecated :: Bool
+    isDeprecated = DeclIndex.entryToAvailability entry == C.Deprecated
+
+{-------------------------------------------------------------------------------
+  Delayed traces
+-------------------------------------------------------------------------------}
+
+mkSuccessMessages ::
+     HasCallStack
+  => C.DeclId
+  -> Success l ConstructTranslationUnit
+  -> [AnnMsg Select]
+mkSuccessMessages declId success = concat [
+      fmap (mkAnnMsg . SelectDelayedParseMsg)
+        delayedParseMsgs
+    , fmap (mkAnnMsg . SelectDelayedPrepareReparseMsg)
+        delayedPrepareReparseMsgs
+    , fmap (mkAnnMsg . SelectDelayedReparseMacroExpansionsMsg)
+        delayedReparseMacroExpansionsMsgs
+    , fmap (mkAnnMsg . SelectDelayedTranslateTypesMsg)
+        delayedTranslateTypesMsgs
+    ]
+  where
+    DeclIndex.Success _
+      delayedParseMsgs
+      delayedPrepareReparseMsgs
+      delayedReparseMacroExpansionsMsgs
+      delayedTranslateTypesMsgs = success
+
+    mkAnnMsg :: HasCallStack => SelectMsg -> AnnMsg Select
+    mkAnnMsg msg = withCallStack C.WithLocationInfo{
+          loc = C.declIdLocationInfo declId [success.decl.info.loc]
+        , msg = msg
+        }
+
+getDelayedMsgsSelectionRoots :: HasCallStack => DeclIndex l -> [AnnMsg Select]
+getDelayedMsgsSelectionRoots = concatMap (uncurry aux) . DeclIndex.toList
+  where
+    aux ::
+         HasCallStack
+      => C.DeclId
+      -> Entry l
+      -> [AnnMsg Select]
+    aux declId = \case
+      UsableEntry e -> case e of
+        UsableSuccess success ->
+          mkSuccessMessages declId success
+        UsableExternal{} -> []
+        -- Parse messages are unavailable for squashed entries. We are OK with
+        -- this; instead we have issued a notice that the @typedef@ was squashed.
+        UsableSquashed x ->
+          List.singleton $ withCallStack C.WithLocationInfo{
+                loc = C.declIdLocationInfo declId [x.typedefLoc]
+              , msg = SelectMangleNamesSquashed x
+              }
+      UnusableEntry e -> case e of
+        UnusableReason loc s ->
+            List.singleton $ withCallStack C.WithLocationInfo{
+                  loc = C.declIdLocationInfo declId [loc]
+                , msg = SelectUnusable s
+                }
+        UnusableConflict c ->
+          List.singleton $ withCallStack C.WithLocationInfo{
+              loc = C.declIdLocationInfo declId $
+                NonEmpty.toList $ C.conflictToList c
+            , msg = SelectConflict
+            }
+
+getDelayedMsgsAdditionalSelectedTransDeps ::
+     HasCallStack
+  => DeclIndex l
+  -> [AnnMsg Select]
+getDelayedMsgsAdditionalSelectedTransDeps = concatMap (uncurry aux) . DeclIndex.toList
+  where
+    aux ::
+         HasCallStack
+      => C.DeclId
+      -> Entry l
+      -> [AnnMsg Select]
+    aux declId = \case
+      UsableEntry e -> case e of
+        UsableSuccess success ->
+          mkSuccessMessages declId success
+        UsableExternal{} -> []
+        -- Parse messages are unavailable for squashed entries. We are OK with
+        -- this; instead we have issued a notice that the @typedef@ was squashed.
+        UsableSquashed x ->
+          [ withCallStack C.WithLocationInfo{
+                loc = C.declIdLocationInfo declId [x.typedefLoc]
+              , msg = SelectMangleNamesSquashed x
+              }
+          ]
+      -- Messages for unusable transitive dependencies are already attached to
+      -- the traces of the reverse transitive dependencies.
+      UnusableEntry _ -> []
+
+-- NOTE: We emit delayed BUG-level parse messages even for declarations that are
+-- not selected. We do not have a test for this; please ensure delayed BUG-level
+-- parse messages are emitted for all declarations also in the future.
+getBugMsgsNotSelected :: HasCallStack => DeclIndex l -> [AnnMsg Select]
+getBugMsgsNotSelected = concatMap (uncurry aux) . DeclIndex.toList
+  where
+    aux ::
+         HasCallStack
+      => C.DeclId
+      -> Entry l
+      -> [AnnMsg Select]
+    aux declId = \case
+      UsableEntry e -> case e of
+        UsableSuccess success ->
+          let isBugLevel x = getDefaultLogLevel x == Bug
+          in  filter isBugLevel $ mkSuccessMessages declId success
+        UsableExternal{} -> []
+        UsableSquashed{} -> []
+      UnusableEntry e -> case e of
+        UnusableReason loc reason ->
+          if isBug reason then
+              List.singleton $ withCallStack C.WithLocationInfo{
+                  loc = C.declIdLocationInfo declId [loc]
+                , msg = SelectUnusable reason
+                }
+          else
+            []
+        UnusableConflict{} -> []
+
+    isBug :: UnusableReason -> Bool
+    isBug = \case
+      UnusableUnavailable                -> False
+      UnusableOmitted                    -> False
+      UnusableParseFailure           err -> getDefaultLogLevel err == Bug
+      UnusableMangleNamesFailure     err -> getDefaultLogLevel err == Bug
+      UnusableMacroTypecheckFailure  err -> getDefaultLogLevel err == Bug
+      UnusableMacroResolutionFailure err -> getDefaultLogLevel err == Bug
+
+-- | Does this selection-root message represent a macro that hs-bindgen dropped?
+--
+isDroppedMacro :: SelectMsg -> Bool
+isDroppedMacro = \case
+    SelectUnusable reason -> case reason of
+      UnusableMacroTypecheckFailure  _ -> True
+      UnusableMacroResolutionFailure _ -> True
+      -- A parse failure counts as a dropped macro iff it is a macro parse
+      -- failure.
+      UnusableParseFailure p           -> isMacroParseFailure p
+      UnusableUnavailable              -> False
+      UnusableOmitted                  -> False
+      UnusableMangleNamesFailure _     -> False
+    _otherwise                         -> False
+  where
+    isMacroParseFailure :: DelayedParseMsg -> Bool
+    isMacroParseFailure = \case
+      ParseMacroDefinitionNoMacroName{} -> True
+      ParseMacroEmpty{}                 -> False
+      ParseMacroErrorParse{}            -> True
+      _otherwise                        -> False
+
+{-------------------------------------------------------------------------------
+  Sort traces
+-------------------------------------------------------------------------------}
+
+-- | Location a trace message is sorted by
+--
+-- Only conflicting declarations carry more than one location; we sort by the
+-- first.
+msgLoc :: AnnMsg Select -> Maybe (SingleLoc C.DeclPath)
+msgLoc msg = listToMaybe $ C.locationInfoLocs msg.traceMsg.loc
+
+-- | Sort key of a trace message
+--
+-- The constructor order /is/ the specification: messages not attached to a
+-- declaration sort to the back. Do not reorder.
+data MsgSortKey =
+    MsgAt {
+        msgSource :: IncludeGraph.IncludeOrderIx
+      , msgLine   :: Int
+      , msgColumn :: Int
+      }
+  | MsgNoLocation
+  deriving stock (Eq, Ord)
+
+msgSortKey :: IncludeGraph.IncludeOrder -> AnnMsg Select -> MsgSortKey
+msgSortKey order msg = case msgLoc msg of
+    Nothing  -> MsgNoLocation
+    Just loc -> MsgAt {
+        msgSource = IncludeGraph.lookupIncludeOrder order (singleLocPath loc)
+      , msgLine   = singleLocLine   loc
+      , msgColumn = singleLocColumn loc
+      }
+
+sortSelectMsgs :: IncludeGraph -> [AnnMsg Select] -> [AnnMsg Select]
+sortSelectMsgs includeGraph msgs =
+    bugMsgs ++ List.sortOn (msgSortKey order) msgs
+  where
+    -- Compute the include order once.
+    order :: IncludeGraph.IncludeOrder
+    order = IncludeGraph.toIncludeOrder includeGraph
+
+    -- We do not know where to sort a message whose source is not in the include
+    -- graph, but a mis-sorted message is no reason to abort: report the bug and
+    -- sort the message to the back.
+    bugMsgs :: [AnnMsg Select]
+    bugMsgs = [
+        withCallStack C.WithLocationInfo{
+            loc = C.LocationUnavailable
+          , msg = SelectSourceNotInIncludeGraph path
+          }
+      | path <- Set.toList unknownPaths
+      ]
+
+    unknownPaths :: Set RealPath
+    unknownPaths = Set.fromList [
+        path
+      | msg <- msgs
+      , Just loc <- [msgLoc msg]
+      , C.InHeader path <- [singleLocPath loc]
+      , IncludeGraph.lookupIncludeOrder order (C.InHeader path)
+          == IncludeGraph.NotInIncludeGraph
+      ]
+
+{-------------------------------------------------------------------------------
+  Apply the selection predicate
+-------------------------------------------------------------------------------}
+
+-- Match function to find selection roots.
+type Match = C.DeclName -> SingleLoc C.DeclPath -> C.Availability -> Bool
+
+-- | Limit the declaration index to those entries that match the select
+--   predicate. Do not include anything external nor omitted.
+selectDeclIndex :: DeclUseGraph -> Match -> DeclIndex l -> DeclIndex l
+selectDeclIndex declUseGraph predicate declIndex =
+    DeclIndex.filter matchEntry declIndex
+  where
+    matchEntry :: C.DeclId -> Entry l -> Bool
+    matchEntry declId entry =
+        case entryInfo entry of
+          Nothing ->
+            -- External or omittted declarations have already been removed from
+            -- the list of declarations
+            False
+          Just (locs, availability) ->
+            if declId.isUnnamed
+              then matchUnnamed declId
+              else Foldable.any
+                     (\loc -> predicate declId.name loc availability)
+                     (C.declLocsToList locs)
+
+    matchDeclId :: C.DeclId -> Bool
+    matchDeclId declId =
+        case DeclIndex.lookupEntry declId declIndex of
+          Just entry -> matchEntry declId entry
+          Nothing    -> panicPure $ "Unknown declaration ID: " ++ show declId
+
+    -- Extract info from 'Entry' needed to match against the selection predicate
+    --
+    -- Returns 'Nothing' for external or omitted declarations.
+    -- Returns 'Just _' for squashed declarations. Those can still be selected.
+    -- Returns multiple locations only for conflicts.
+    entryInfo :: Entry l -> Maybe (C.DeclLocs, C.Availability)
+    entryInfo entry = case entry of
+        UsableEntry UsableExternal{} ->
+          Nothing
+        UnusableEntry (UnusableReason _loc UnusableOmitted{}) ->
+          Nothing
+        _otherwise ->
+          Just (DeclIndex.entryToLoc entry, DeclIndex.entryToAvailability entry)
+
+    -- We match unnamed declarations based on their use sites.
+    --
+    -- Looking at the use sites means we treat unnamed declarations in a very
+    -- similar way to auxiliary declarations. It's however worth spelling out
+    -- why this is possible. There are two main classes of unnamed
+    -- declarations. The first is unnamed declarations inside of typedefs:
+    --
+    -- > typedef struct { .. } foo;
+    --
+    -- Selecting the typedef but not the struct makes no sense; selecting the
+    -- struct but not the typedef does, but is already captured by support for
+    -- squashing typedefs.
+    --
+    -- The second class is unnamed declarations inside structs or unions:
+    --
+    -- > struct outer {
+    -- >    struct { .. } field1, field2;
+    -- >    struct { .. } field3;
+    -- > }
+    -- >
+    --
+    -- Like for typedefs, it doesn't really make sense to select the outer
+    -- struct but not the inner struct. It could /in principle/ make sense to
+    -- select the inner but not the outer, but it seems a pretty rare use case,
+    -- and not a big deal if the outer struct will "come along" even if only the
+    -- inner struct is needed.
+    matchUnnamed :: C.DeclId -> Bool
+    matchUnnamed unnamed =
+       case DeclUseGraph.getUseSites declUseGraph unnamed of
+         (declId, _) :_ ->
+           -- The only way that unnamed declarations can have multiple use
+           -- sites is when multiple fields are defined together:
+           --
+           -- > struct foo {
+           -- >   struct { .. } x, y, z;
+           -- > }
+           --
+           -- From the perspective of selection, any of these will do.
+           matchDeclId declId
+         [] ->
+           -- An unnamed declaration can have no use sites if those
+           -- dependencies were removed from the graph because the parent
+           -- declaration is opaqued using a prescriptive binding specification.
+           False
diff --git a/src-internal/HsBindgen/Frontend/Pass/Select/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/Select/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/Select/IsPass.hs
@@ -0,0 +1,343 @@
+module HsBindgen.Frontend.Pass.Select.IsPass (
+    Select
+    -- * Configuration
+  , ProgramSlicing(..)
+  , SelectConfig(..)
+    -- * Trace messages
+  , SelectReason(..)
+  , SelectStatus(..)
+  , TransitiveDependencyMissing(..)
+  , SelectMsg(..)
+  ) where
+
+import Data.Default (Default (def))
+import Text.SimplePrettyPrint (CtxDoc, (<+>), (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.HighLevel.Types
+import Clang.Paths
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Frontend.Analysis.DeclIndex (Squashed (..), UnusableEntry,
+                                              UnusableReason (..))
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.Pass.AdjustTypes.IsPass
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg (DelayedPrepareReparseMsg)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.Msg (DelayedReparseMacroExpansionsMsg)
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes.IsPass.Msg (DelayedTranslateTypesMsg)
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Pass.Types (CoercePassAnonRef (coercePassAnonRef))
+import HsBindgen.IR.Translation
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type Select :: Pass
+data Select a
+
+type family AnnSelect ix where
+  AnnSelect "Decl"                 = PrescriptiveDeclSpec
+  AnnSelect "Enum"                 = NewtypeNames
+  AnnSelect "Flam"                 = FlamNames
+  AnnSelect "IndirectField"        = IndirectFieldNames Select
+  AnnSelect "Struct"               = StructNames
+  AnnSelect "Typedef"              = TypedefNames
+  AnnSelect "TypecheckedMacroType" = NewtypeNames
+  AnnSelect "TypeFunArg"           = AdjustedFrom Select
+  AnnSelect "Union"                = NewtypeNames
+  AnnSelect _                      = NoAnn
+
+instance IsPass Select
+
+instance PassId Select where
+  type Id Select = DeclIdPair
+
+  idNameKind     _ namePair = namePair.cName.name.kind
+  idSourceName   _ namePair = C.declIdSourceName namePair.cName
+  idLocationInfo _ namePair = C.declIdLocationInfo namePair.cName
+
+instance PassScopedName Select where
+  type ScopedName Select = ScopedNamePair
+
+instance PassTypes Select where
+  type Types Select   = TranslatedTypes Select
+  type AnonRef Select = TranslatedAnonRef Select
+
+  cType _ translatedTypes = translatedTypes.c
+  anonRefTypes _ = translatedAnonRefType
+
+instance PassMacro Select where
+  type MacroId Select = Id Select
+  type MacroBody       Select = TypecheckedMacro Select
+  type MacroUnderlying Select = C.Type Select
+
+  macroIdId _ = id
+
+instance PassExtBinding Select where
+  type ExtBinding Select = BindingSpec.ResolvedExtBinding
+
+  extBindingId _ extBinding = extDeclIdPair extBinding
+
+instance PassCommentDecl Select where
+  type CommentDecl Select = Maybe (C.Comment Select)
+
+instance PassAnn Select where
+  type Ann ix Select = AnnSelect ix
+
+instance PassMsg Select where
+  type Msg Select = C.WithLocationInfo SelectMsg
+
+{-------------------------------------------------------------------------------
+  Configuration
+-------------------------------------------------------------------------------}
+
+-- | Select transitive dependencies?
+data ProgramSlicing =
+    -- | Select declarations using the selection predicate /and/ their transitive
+    -- dependencies.
+    EnableProgramSlicing
+  | DisableProgramSlicing
+  deriving stock (Show, Eq)
+
+instance Default ProgramSlicing where
+  def :: ProgramSlicing
+  def = DisableProgramSlicing
+
+data SelectConfig = SelectConfig {
+      programSlicing     :: ProgramSlicing
+    , selectionPredicate :: Boolean SelectionPredicate
+    }
+  deriving stock (Show, Eq)
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+data SelectReason =
+    -- | The user actively selects the declarations.
+    SelectionRoot
+    -- | The user has activated program slicing, and the declaration is a
+    -- transitive dependency of a selection root.
+  | TransitiveDependency
+  deriving stock (Show, Eq)
+
+instance PrettyForTrace SelectReason where
+  prettyForTrace = \case
+    SelectionRoot        -> "direct selection predicate match"
+    TransitiveDependency -> "transitive dependency"
+
+data SelectStatus =
+    NotSelected
+  | Selected SelectReason
+  deriving stock (Show)
+
+data TransitiveDependencyMissing =
+    -- | Transitive dependency is 'UnusableEntry'.
+    TransitiveDependencyUnusable C.DeclId UnusableEntry
+    -- | Transitive dependency is not selected.
+  | TransitiveDependencyNotSelected C.DeclId [SingleLoc C.DeclPath]
+  deriving stock (Show)
+
+instance PrettyForTrace TransitiveDependencyMissing where
+  prettyForTrace = \case
+      TransitiveDependencyUnusable i u ->
+        let intro = "Transitive dependency unusable:"
+        in  PP.hang intro 2 $ prettyForTrace $ C.WithLocationInfo{
+                loc = C.declIdLocationInfo i $
+                  C.declLocsToList $ DeclIndex.unusableToLoc u
+              , msg = u
+              }
+      TransitiveDependencyNotSelected i ls ->
+        let intro = "Transitive dependency not selected:"
+        in  PP.hang intro 2 $ PP.vcat [
+                prettyForTrace $ C.declIdLocationInfo i ls
+              , "Adjust the selection predicate or enable program slicing"
+              ]
+
+-- | Select trace messages
+data SelectMsg =
+    -- | Information about selection status; issued for all available
+    -- declarations.
+    SelectStatusInfo SelectStatus
+    -- | The user has selected a declaration that is available but has missing
+    -- transitive dependencies.
+  | TransitiveDependenciesMissing SelectReason [TransitiveDependencyMissing]
+    -- | The user has selected a deprecated declaration. Maybe they want to
+    -- de-select the deprecated declaration?
+  | SelectDeprecated SelectReason
+    -- | Delayed parse message.
+  | SelectDelayedParseMsg DelayedParseMsg
+    -- | A directly or transitively selected declaration is unusable.
+  | SelectUnusable UnusableReason
+  | SelectConflict
+  | SelectMangleNamesSquashed Squashed
+    -- | Delayed @PrepareReparse@ message
+  | SelectDelayedPrepareReparseMsg DelayedPrepareReparseMsg
+    -- | Delayed @ReparseMacroExpansions@ message
+  | SelectDelayedReparseMacroExpansionsMsg DelayedReparseMacroExpansionsMsg
+    -- | Delayed @TranslateTypes@ message
+  | SelectDelayedTranslateTypesMsg DelayedTranslateTypesMsg
+    -- | Inform the user that no declarations matched the selection predicate.
+  | SelectNoDeclarationsMatched
+    -- | Summary of the number of selected macros that hs-bindgen failed to
+    -- translate.
+  | SelectMacrosDropped Int
+    -- | The source of a trace message is not part of the include graph, so we
+    -- do not know where to sort it.
+  | SelectSourceNotInIncludeGraph RealPath
+  deriving stock (Show)
+
+instance PrettyForTrace SelectMsg where
+  prettyForTrace = \case
+      SelectStatusInfo NotSelected ->
+        "Not selected"
+      SelectStatusInfo (Selected r) ->
+        "Selected (" >< prettyForTrace r >< ")"
+      TransitiveDependenciesMissing s xs ->
+        couldNotSelectWithReason s $
+          PP.vcat $ map prettyForTrace xs
+      SelectDeprecated r ->
+        withSelectReason r "Selected a deprecated declaration"
+      SelectDelayedParseMsg x ->
+        during x $ prettyForTrace x
+      SelectUnusable reason -> case reason of
+        UnusableUnavailable ->
+          couldNotSelect $ PP.hang "Parse not attempted: " 2
+            "Declaration is 'unavailable' on this platform"
+        UnusableOmitted ->
+          couldNotSelect $
+            "Declaration omitted by prescriptive binding specifications"
+        UnusableParseFailure x ->
+          couldNotSelect $ prettyForTrace x
+        UnusableMangleNamesFailure x ->
+          couldNotSelect $ prettyForTrace x
+        UnusableMacroTypecheckFailure x ->
+          couldNotSelect $ prettyForTrace x
+        UnusableMacroResolutionFailure x ->
+          couldNotSelect $ prettyForTrace x
+      SelectConflict ->
+        couldNotSelect "Conflicting declarations"
+      SelectMangleNamesSquashed x -> PP.hsep [
+          "Squashed typedef to"
+        , prettyForTrace x.targetNameC
+        ]
+      SelectDelayedPrepareReparseMsg x ->
+        during x $ prettyForTrace x
+      SelectDelayedReparseMacroExpansionsMsg x ->
+        during x $ prettyForTrace x
+      SelectDelayedTranslateTypesMsg x ->
+        during x $ prettyForTrace x
+      SelectNoDeclarationsMatched ->
+        "No declarations matched the selection predicate"
+      SelectMacrosDropped n ->
+        PP.string $
+          show n
+            <> (if n == 1 then " macro failed to translate; "
+                          else " macros failed to translate; ")
+            <> "use --log-enable-macro-warnings for details"
+      SelectSourceNotInIncludeGraph path -> PP.hsep [
+          "Source not in include graph:"
+        , PP.string $ getRealPath path
+        ]
+    where
+      during :: IsTrace l e => e -> CtxDoc -> CtxDoc
+      during x = PP.hang (PP.string ("During " <> (getTraceId x).id <> ":")) 2
+
+      couldNotSelectStr :: CtxDoc
+      couldNotSelectStr = "Could not select declaration"
+
+      couldNotSelect :: CtxDoc -> CtxDoc
+      couldNotSelect x = PP.hang (couldNotSelectStr >< ":") 2 x
+
+      withSelectReason :: SelectReason -> CtxDoc -> CtxDoc
+      withSelectReason r x = x <+> "(" >< prettyForTrace r >< ")"
+
+      couldNotSelectWithReason :: SelectReason -> CtxDoc -> CtxDoc
+      couldNotSelectWithReason r x =
+        let intro = withSelectReason r couldNotSelectStr >< ":"
+        in  PP.hang intro 2 x
+
+instance IsTrace Level SelectMsg where
+  getDefaultLogLevel = \case
+    SelectStatusInfo{}                       -> Info
+    TransitiveDependenciesMissing{}          -> Warning
+    SelectDeprecated{}                       -> Notice
+    SelectDelayedParseMsg x                  -> getDefaultLogLevel x
+    SelectUnusable r -> case r of
+      UnusableUnavailable              -> Warning
+      UnusableOmitted                  -> Info
+      UnusableParseFailure x           -> getDefaultLogLevel x
+      UnusableMangleNamesFailure x     -> getDefaultLogLevel x
+      UnusableMacroTypecheckFailure x  -> getDefaultLogLevel x
+      UnusableMacroResolutionFailure x -> getDefaultLogLevel x
+    SelectConflict{}                         -> Warning
+    SelectMangleNamesSquashed{}              -> Notice
+    SelectDelayedPrepareReparseMsg x         -> getDefaultLogLevel x
+    SelectDelayedReparseMacroExpansionsMsg x -> getDefaultLogLevel x
+    SelectDelayedTranslateTypesMsg x         -> getDefaultLogLevel x
+    SelectNoDeclarationsMatched              -> Warning
+    SelectMacrosDropped{}                    -> Notice
+    SelectSourceNotInIncludeGraph{}          -> Bug
+  getSource  = const HsBindgen
+  getTraceId = \case
+    SelectStatusInfo{}                       -> "select"
+    TransitiveDependenciesMissing{}          -> "select"
+    SelectDeprecated{}                       -> "select"
+    SelectDelayedParseMsg x                  -> "select-" <> getTraceId x
+    SelectUnusable r -> case r of
+      UnusableUnavailable              -> "select-parse"
+      UnusableOmitted                  -> "select-omitted"
+      UnusableParseFailure           x -> "select-" <> getTraceId x
+      UnusableMangleNamesFailure     x -> "select-" <> getTraceId x
+      UnusableMacroTypecheckFailure  x -> "select-" <> getTraceId x
+      UnusableMacroResolutionFailure x -> "select-" <> getTraceId x
+    SelectConflict{}                         -> "select"
+    SelectMangleNamesSquashed{}              -> "select-mangle-names-squashed"
+    SelectDelayedPrepareReparseMsg x         -> "select-" <> getTraceId x
+    SelectDelayedReparseMacroExpansionsMsg x -> "select-" <> getTraceId x
+    SelectDelayedTranslateTypesMsg x         -> "select-" <> getTraceId x
+    SelectNoDeclarationsMatched              -> "select"
+    SelectMacrosDropped{}                    -> "select-dropped-macros"
+    SelectSourceNotInIncludeGraph{}          -> "select-source-not-in-include-graph"
+
+{-------------------------------------------------------------------------------
+  CoercePass
+-------------------------------------------------------------------------------}
+
+instance CoercePassAnonRef TranslateTypes Select where
+  coercePassAnonRef _ = coercePass
+
+instance CoercePassId      TranslateTypes Select
+
+instance CoercePassTypes TranslateTypes Select where
+  coercePassTypes _ = coercePass
+
+instance CoercePassMacroId TranslateTypes Select
+
+instance CoercePassMacroUnderlying TranslateTypes Select where
+  coercePassMacroUnderlying _ = coercePass
+
+instance CoercePassMacroBody TranslateTypes Select where
+  coercePassMacroBody _ = coercePassParam
+
+instance CoercePassAnn "IndirectField" TranslateTypes Select where
+  coercePassAnn _ = \case
+      IndirectFieldNames name -> IndirectFieldNames name
+
+instance CoercePassAnn "TypeFunArg" TranslateTypes Select where
+  coercePassAnn _ = \case
+      AdjustedFromArray ty    -> AdjustedFromArray (coercePass ty)
+      AdjustedFromFunction ty -> AdjustedFromFunction (coercePass ty)
+      NotAdjusted             -> NotAdjusted
+
+instance CoercePassCommentDecl TranslateTypes Select where
+  coercePassCommentDecl _ = fmap coercePass
diff --git a/src-internal/HsBindgen/Frontend/Pass/SimplifyAST.hs b/src-internal/HsBindgen/Frontend/Pass/SimplifyAST.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/SimplifyAST.hs
@@ -0,0 +1,104 @@
+{-# LANGUAGE NamedFieldPuns #-}
+
+module HsBindgen.Frontend.Pass.SimplifyAST (
+    simplifyAST
+  ) where
+
+import Data.Map.Strict qualified as Map
+import GHC.Stack (HasCallStack)
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis.UnnamedIdUsage (UnnamedIdUsageAnalysis (..))
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Frontend.Pass.SimplifyAST.IsPass (SimplifyAST,
+                                                   SimplifyASTMsg (..))
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.C qualified as C
+import HsBindgen.Util.Tracer (withCallStack)
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+-- | Simplify AST by converting untagged enums (with no use sites) to pattern synonyms
+--
+-- Untagged enums with no use sites (e.g., @enum { FOO, BAR }@) are converted into
+-- separate pattern synonym declarations (e.g., @pattern fOO :: CUInt@, @pattern bAR :: CUInt@).
+-- Untagged enums that ARE used in type signatures are kept as-is.
+simplifyAST ::
+     HasCallStack
+  => UnnamedIdUsageAnalysis
+  -> [ParseResult l Parse]
+  -> ([ParseResult l SimplifyAST], [AnnMsg SimplifyAST])
+simplifyAST usage parseResults = (results, msgs)
+  where
+    processedResults = map processResult parseResults
+    results = concatMap fst processedResults
+    msgs = concatMap snd processedResults
+
+    processResult ::
+         HasCallStack
+      => ParseResult l Parse
+      -> ([ParseResult l SimplifyAST], [AnnMsg SimplifyAST])
+    processResult result =
+      case result.classification of
+        ParseResultSuccess success ->
+          case success.decl of
+            -- Found untagged enum: check if it has use sites
+            C.Decl{info, kind = C.DeclEnum enum}
+              | C.PrelimDeclIdUnnamed unnamedId <- info.id
+              , Map.notMember unnamedId usage.map ->
+                ( [ result {
+                     id = newId
+                   , classification = ParseResultSuccess success {
+                       decl = C.Decl{
+                              info = newInfo
+                            , kind = C.DeclUntaggedEnumConstant C.UntaggedEnumConstant{
+                                     typ      = extractPrimType enum.typ
+                                   , constant = coercePass constant
+                                   }
+                            , ann = NoAnn
+                            }
+                                          }
+                   }
+                 | constant <- enum.constants
+                 , let C.ScopedName nameText = constant.info.name
+                       newId = C.PrelimDeclIdNamed (C.DeclName nameText C.NameKindOrdinary)
+                       newInfo :: C.DeclInfo SimplifyAST
+                       newInfo = (coercePass info :: C.DeclInfo SimplifyAST)
+                                   { C.id = newId }
+                 ]
+                , [withCallStack (SimplifyASTUntaggedEnum unnamedId)]
+                )
+            decl -> ( [ParseResult {
+                      id = result.id
+                    , loc = result.loc
+                    , classification = ParseResultSuccess success {
+                        decl = C.Decl{
+                          info = coercePass decl.info
+                        , kind = coercePass decl.kind
+                        , ann = NoAnn
+                        }
+                      }
+                    }]
+                 , []
+                 )
+        ParseResultUnavailable ->
+          ([ParseResult result.id result.loc ParseResultUnavailable], [])
+        ParseResultFailure failure ->
+          ([ParseResult result.id result.loc (ParseResultFailure failure)], [])
+
+{-------------------------------------------------------------------------------
+  Extract PrimType from Type
+-------------------------------------------------------------------------------}
+
+-- | Extract PrimType from a C.Type
+-- Untagged enum types are always primitive types (e.g., unsigned int, int, etc.)
+extractPrimType :: C.Type Parse -> C.PrimType
+extractPrimType (C.TypePrim pt) = pt
+extractPrimType ty = panicPure $ concat [
+    "Expected TypePrim but got "
+  , show ty
+  ]
diff --git a/src-internal/HsBindgen/Frontend/Pass/SimplifyAST/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/SimplifyAST/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/SimplifyAST/IsPass.hs
@@ -0,0 +1,98 @@
+module HsBindgen.Frontend.Pass.SimplifyAST.IsPass (
+    SimplifyAST
+    -- * Trace messages
+  , SimplifyASTMsg(..)
+  ) where
+
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Pass.Types (CoercePassAnonRef)
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type SimplifyAST :: Pass
+data SimplifyAST a
+
+-- Preserve annotations from @Parse@ pass
+type family AnnSimplifyAST (ix :: Symbol) where
+  AnnSimplifyAST "Function"      = ReparseInfo Tokens
+  AnnSimplifyAST "Global"        = ReparseInfo Tokens
+  AnnSimplifyAST "ImplicitField" = FieldOrigin
+  AnnSimplifyAST "IndirectField" = ReparseInfo Tokens
+  AnnSimplifyAST "RegularField"  = ReparseInfo Tokens
+  AnnSimplifyAST "Struct"        = IsAnon
+  AnnSimplifyAST "Typedef"       = ReparseInfo Tokens
+  AnnSimplifyAST "Union"         = IsAnon
+  AnnSimplifyAST _               = NoAnn
+
+instance IsPass SimplifyAST
+
+instance PassId SimplifyAST where
+  type Id SimplifyAST = C.PrelimDeclId
+
+  idNameKind     _ = C.prelimDeclIdNameKind
+  idSourceName   _ = C.prelimDeclIdSourceName
+  idLocationInfo _ = C.prelimDeclIdLocationInfo
+
+instance PassScopedName SimplifyAST
+
+instance PassTypes SimplifyAST
+
+instance PassMacro SimplifyAST where
+  type MacroBody SimplifyAST = Macro.Unresolved
+
+instance PassExtBinding SimplifyAST
+
+instance PassCommentDecl SimplifyAST
+
+instance PassAnn SimplifyAST where
+  type Ann ix SimplifyAST = AnnSimplifyAST ix
+
+instance PassMsg SimplifyAST where
+  type Msg SimplifyAST = SimplifyASTMsg
+
+{-------------------------------------------------------------------------------
+  CoercePass: Parse
+-------------------------------------------------------------------------------}
+
+instance CoercePassAnonRef             Parse SimplifyAST
+instance CoercePassId                  Parse SimplifyAST
+instance CoercePassMacroBody           Parse SimplifyAST
+instance CoercePassMacroId             Parse SimplifyAST
+instance CoercePassMacroUnderlying     Parse SimplifyAST
+instance CoercePassTypes               Parse SimplifyAST
+instance CoercePassAnn "Global"        Parse SimplifyAST
+instance CoercePassAnn "IndirectField" Parse SimplifyAST
+instance CoercePassAnn "TypeFunArg"    Parse SimplifyAST
+instance CoercePassCommentDecl         Parse SimplifyAST
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+data SimplifyASTMsg =
+    SimplifyASTUntaggedEnum C.UnnamedId
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace SimplifyASTMsg where
+  prettyForTrace = \case
+      SimplifyASTUntaggedEnum unnamedId -> PP.hsep [
+          "Transformed untagged enum: "
+        , prettyForTrace unnamedId
+        , "into constant patterns."
+        ]
+
+instance IsTrace Level SimplifyASTMsg where
+  getDefaultLogLevel = \case
+      SimplifyASTUntaggedEnum{} -> Info
+
+  getSource  = const HsBindgen
+  getTraceId = const "simplify-ast"
diff --git a/src-internal/HsBindgen/Frontend/Pass/TranslateTypes.hs b/src-internal/HsBindgen/Frontend/Pass/TranslateTypes.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/TranslateTypes.hs
@@ -0,0 +1,248 @@
+module HsBindgen.Frontend.Pass.TranslateTypes (
+    translateTypes
+  ) where
+
+import Control.Monad.Reader (MonadReader, ReaderT (..), withReaderT)
+import Control.Monad.State (MonadState, State, modify, runState)
+
+import HsBindgen.Frontend.Analysis.DeclIndex
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.Pass.AdjustTypes.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes.IsPass.Msg
+import HsBindgen.Frontend.Pass.TranslateTypes.Translation qualified as Translation
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Translation
+
+{-------------------------------------------------------------------------------
+  Top-level
+-------------------------------------------------------------------------------}
+
+translateTypes ::
+     forall l.
+     C.TranslationUnit l AdjustTypes
+  -> ( C.TranslationUnit l TranslateTypes
+     , [AnnMsg TranslateTypes]
+     )
+translateTypes unit = (unit', msgs)
+  where
+    msgs = []
+
+    unit' = C.TranslationUnit{
+          decls        = decls'
+        , includeGraph = unit.includeGraph
+        , meta         = meta'
+        }
+
+    meta' = unit.meta {
+          declIndex = declIndex'
+        }
+
+    declIndex' :: DeclIndex l
+    declIndex' =
+        -- We use @foldr@ here to establish the original order of messages
+        foldr
+          DeclIndex.registerDelayedTranslateTypesMsg
+          unit.meta.declIndex
+          delayedMsgs
+
+    (decls', delayedMsgs) = runM NoEnv $ mapM processDecl unit.decls
+
+{-------------------------------------------------------------------------------
+  Decls
+-------------------------------------------------------------------------------}
+
+processDecl :: C.Decl l AdjustTypes -> M NoEnv (C.Decl l TranslateTypes)
+processDecl decl = do
+    kind' <- withEnv (const (DeclEnv decl.info)) $ processDeclKind decl.kind
+    pure C.Decl{
+        info = coercePass decl.info
+      , kind = kind'
+      , ann  = decl.ann
+      }
+
+processDeclKind :: C.DeclKind l AdjustTypes -> M DeclEnv (C.DeclKind l TranslateTypes)
+processDeclKind = \case
+    C.DeclStruct               struct   -> C.DeclStruct               <$> processStruct           struct
+    C.DeclUnion                union    -> C.DeclUnion                <$> processUnion            union
+    C.DeclTypedef              typedef  -> C.DeclTypedef              <$> processTypedef          typedef
+    C.DeclEnum                 enum     -> C.DeclEnum                 <$> processEnum             enum
+    C.DeclUntaggedEnumConstant cnst     -> C.DeclUntaggedEnumConstant <$> processUntaggedEnumConstant cnst
+    C.DeclOpaque               mSize    -> pure $ C.DeclOpaque mSize
+    C.DeclMacro                macro    -> C.DeclMacro                <$> processMacro            macro
+    C.DeclFunction             function -> C.DeclFunction             <$> processFunction         function
+    C.DeclGlobal               global   -> C.DeclGlobal               <$> processGlobal           global
+
+processStruct :: C.Struct AdjustTypes -> M DeclEnv (C.Struct TranslateTypes)
+processStruct struct = do
+    fields' <- mapM processField struct.fields
+    flam' <- C.traverseFlamField processRegularField struct.flam
+    pure C.Struct{
+        sizeof    = struct.sizeof
+      , alignment = struct.alignment
+      , fields    = fields'
+      , flam      = flam'
+      , ann       = struct.ann
+      }
+
+processUnion :: C.Union AdjustTypes -> M DeclEnv (C.Union TranslateTypes)
+processUnion union = do
+    fields' <- mapM processField union.fields
+    pure C.Union{
+        sizeof    = union.sizeof
+      , alignment = union.alignment
+      , fields    = fields'
+      , ann       = union.ann
+      }
+
+processField :: C.Field AdjustTypes -> M DeclEnv (C.Field TranslateTypes)
+processField = \case
+    C.FieldRegular  field -> C.FieldRegular  <$> processRegularField field
+    C.FieldImplicit field -> C.FieldImplicit <$> processImplicitField field
+
+processRegularField :: C.RegularField AdjustTypes -> M DeclEnv (C.RegularField TranslateTypes)
+processRegularField field = pure C.RegularField{
+      info   = coercePass field.info
+    , typ    = processType Translation.Top field.typ
+    , offset = field.offset
+    , width  = field.width
+    , ann    = field.ann
+    }
+
+processImplicitField :: C.ImplicitField AdjustTypes -> M DeclEnv (C.ImplicitField TranslateTypes)
+processImplicitField field = do
+    indirect' <- mapM processIndirectField field.indirect
+    pure C.ImplicitField{
+        info     = coercePass field.info
+      , typRef   = processAnonRef Translation.Top field.typRef
+      , offset   = field.offset
+      , indirect = indirect'
+      , ann      = field.ann
+      }
+
+processIndirectField :: C.IndirectField AdjustTypes -> M DeclEnv (C.IndirectField TranslateTypes)
+processIndirectField field = pure C.IndirectField{
+      info   = coercePass field.info
+    , typ    = processType Translation.Top field.typ
+    , offset = field.offset
+    , width  = field.width
+    , path   = map (processAnonRef Translation.Top) field.path
+    , ann    = coercePassAnn (Proxy @'("IndirectField", AdjustTypes, TranslateTypes)) field.ann
+    }
+
+processTypedef :: C.Typedef AdjustTypes -> M DeclEnv (C.Typedef TranslateTypes)
+processTypedef typedef = pure C.Typedef{
+      typ = processType Translation.Top typedef.typ
+    , ann = typedef.ann
+    }
+
+processEnum :: C.Enum AdjustTypes -> M DeclEnv (C.Enum TranslateTypes)
+processEnum enum = pure C.Enum{
+      typ       = processType Translation.Top enum.typ
+    , sizeof    = enum.sizeof
+    , alignment = enum.alignment
+    , constants = map coercePass enum.constants
+    , ann       = enum.ann
+    }
+
+processUntaggedEnumConstant ::
+     C.UntaggedEnumConstant AdjustTypes
+  -> M DeclEnv (C.UntaggedEnumConstant TranslateTypes)
+processUntaggedEnumConstant = pure . coercePass
+
+processMacro :: MacroBody AdjustTypes l -> M DeclEnv (MacroBody TranslateTypes l)
+processMacro mac = pure $ case mac of
+    MacroType  typ -> MacroType  $ coercePass typ
+    MacroValue val -> MacroValue $ coercePass val
+
+processFunction :: C.Function AdjustTypes -> M DeclEnv (C.Function TranslateTypes)
+processFunction fun = do
+    args' <- mapM processFunctionArg fun.args
+    pure C.Function{
+        args  = args'
+      , res   = processType Translation.FunRes fun.res
+      , attrs = fun.attrs
+      , ann   = fun.ann
+      }
+
+processFunctionArg :: C.FunctionArg AdjustTypes -> M DeclEnv (C.FunctionArg TranslateTypes)
+processFunctionArg arg =
+    pure C.FunctionArg{
+        name = arg.name
+      , typ  = TranslatedTypes{
+            c  = coercePass arg.typ
+          , hs = Translation.inContext Translation.FunArg arg
+          }
+      , ann  =
+          coercePassAnn
+            (Proxy @'("TypeFunArg", AdjustTypes, TranslateTypes))
+            arg.ann
+      }
+
+processGlobal :: C.Global AdjustTypes -> M DeclEnv (C.Global TranslateTypes)
+processGlobal global = pure C.Global{
+      typ = processType Translation.Top global.typ
+    , ann = global.ann
+    }
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+processType ::
+     Translation.TypeContext
+  -> C.Type AdjustTypes
+  -> TranslatedTypes TranslateTypes
+processType ctx typ = TranslatedTypes{
+      c  = coercePass typ
+    , hs = Translation.inContext ctx typ
+    }
+
+processAnonRef ::
+     Translation.TypeContext
+  -> C.AnonRef AdjustTypes
+  -> TranslatedAnonRef TranslateTypes
+processAnonRef ctx typ = TranslatedAnonRef{
+      c = coercePass typ
+    , hs = Translation.inContext ctx (C.anonRefType typ)
+    }
+
+{-------------------------------------------------------------------------------
+  Monad
+-------------------------------------------------------------------------------}
+
+-- | Run the monad
+--
+-- Delayed trace messages are returned in reverse order that they were recorded
+runM :: env -> M env a -> (a, [(C.DeclId, DelayedTranslateTypesMsg)])
+runM m (M k) = fmap (.messages) $ runState (runReaderT k m) (St [])
+
+newtype M env a = M (ReaderT env (State St) a)
+  deriving newtype (Functor, Applicative, Monad)
+
+deriving newtype instance MonadReader env (M env)
+deriving newtype instance MonadState St (M env)
+
+withEnv :: (env1 -> env2) -> M env2 a -> M env1 a
+withEnv f (M k) = M (withReaderT f k)
+
+data NoEnv = NoEnv
+
+data DeclEnv = DeclEnv {
+    _info :: C.DeclInfo AdjustTypes
+  }
+
+newtype St = St {
+    -- | Delayed trace messages in reverse order that they were recorded
+    messages :: [(C.DeclId, DelayedTranslateTypesMsg)]
+  }
+
+_addMessage :: C.DeclId -> DelayedTranslateTypesMsg -> M env ()
+_addMessage did msg = modify $ \st -> st {
+      messages = (did, msg) : st.messages
+    }
diff --git a/src-internal/HsBindgen/Frontend/Pass/TranslateTypes/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/TranslateTypes/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/TranslateTypes/IsPass.hs
@@ -0,0 +1,99 @@
+module HsBindgen.Frontend.Pass.TranslateTypes.IsPass (
+    -- * Definition
+    TranslateTypes
+  ) where
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Frontend.Pass.AdjustTypes.IsPass
+import HsBindgen.Frontend.Pass.MangleNames.IsPass
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes.IsPass.Msg (TranslateTypesMsg)
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Translation
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type TranslateTypes :: Pass
+data TranslateTypes a
+
+type family AnnTranslateTypes ix where
+  AnnTranslateTypes "Decl"                 = PrescriptiveDeclSpec
+  AnnTranslateTypes "Enum"                 = NewtypeNames
+  AnnTranslateTypes "IndirectField"        = IndirectFieldNames TranslateTypes
+  AnnTranslateTypes "Flam"                 = FlamNames
+  AnnTranslateTypes "Struct"               = StructNames
+  AnnTranslateTypes "Typedef"              = TypedefNames
+  AnnTranslateTypes "TypecheckedMacroType" = NewtypeNames
+  AnnTranslateTypes "TypeFunArg"           = AdjustedFrom TranslateTypes
+  AnnTranslateTypes "Union"                = NewtypeNames
+  AnnTranslateTypes _                      = NoAnn
+
+instance IsPass TranslateTypes
+
+instance PassId TranslateTypes where
+  type Id TranslateTypes = DeclIdPair
+
+  idNameKind     _ namePair = namePair.cName.name.kind
+  idSourceName   _ namePair = C.declIdSourceName namePair.cName
+  idLocationInfo _ namePair = C.declIdLocationInfo namePair.cName
+
+instance PassScopedName TranslateTypes where
+  type ScopedName TranslateTypes = ScopedNamePair
+
+instance PassTypes TranslateTypes where
+  type Types TranslateTypes = TranslatedTypes TranslateTypes
+  type AnonRef TranslateTypes = TranslatedAnonRef TranslateTypes
+
+  cType _ translatedTypes = translatedTypes.c
+  anonRefTypes _ = translatedAnonRefType
+
+instance PassMacro TranslateTypes where
+  type MacroId         TranslateTypes = Id TranslateTypes
+  type MacroBody       TranslateTypes = TypecheckedMacro TranslateTypes
+  type MacroUnderlying TranslateTypes = C.Type TranslateTypes
+
+  macroIdId _ = id
+
+instance PassExtBinding TranslateTypes where
+  type ExtBinding TranslateTypes = BindingSpec.ResolvedExtBinding
+
+  extBindingId _ extBinding = extDeclIdPair extBinding
+
+instance PassCommentDecl TranslateTypes where
+  type CommentDecl TranslateTypes = Maybe (C.Comment TranslateTypes)
+
+instance PassAnn TranslateTypes where
+  type Ann ix TranslateTypes = AnnTranslateTypes ix
+
+instance PassMsg TranslateTypes where
+  type Msg TranslateTypes = TranslateTypesMsg
+
+{-------------------------------------------------------------------------------
+  CoercePass
+-------------------------------------------------------------------------------}
+
+instance CoercePassId      AdjustTypes TranslateTypes
+instance CoercePassMacroId AdjustTypes TranslateTypes
+
+instance CoercePassMacroUnderlying AdjustTypes TranslateTypes where
+  coercePassMacroUnderlying _ = coercePass
+
+instance CoercePassMacroBody AdjustTypes TranslateTypes where
+  coercePassMacroBody _ = coercePassParam
+
+instance CoercePassAnn "IndirectField" AdjustTypes TranslateTypes where
+  coercePassAnn _ = \case
+      IndirectFieldNames name -> IndirectFieldNames name
+
+instance CoercePassAnn "TypeFunArg" AdjustTypes TranslateTypes where
+  coercePassAnn _ = \case
+    AdjustedFromArray    ty -> AdjustedFromArray    (coercePass ty)
+    AdjustedFromFunction ty -> AdjustedFromFunction (coercePass ty)
+    NotAdjusted             -> NotAdjusted
+
+instance CoercePassCommentDecl AdjustTypes TranslateTypes where
+  coercePassCommentDecl _ = fmap coercePass
diff --git a/src-internal/HsBindgen/Frontend/Pass/TranslateTypes/IsPass/Msg.hs b/src-internal/HsBindgen/Frontend/Pass/TranslateTypes/IsPass/Msg.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/TranslateTypes/IsPass/Msg.hs
@@ -0,0 +1,43 @@
+-- | Trace messages for the @TranslateTypes@ pass
+--
+-- This module is intended to be imported unqualified.
+module HsBindgen.Frontend.Pass.TranslateTypes.IsPass.Msg (
+    -- * Msg
+    TranslateTypesMsg
+    -- * DelayedMsg
+  , DelayedTranslateTypesMsg
+  ) where
+
+import GHC.Generics (Generic)
+
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Msg
+-------------------------------------------------------------------------------}
+
+data TranslateTypesMsg
+  deriving stock Show
+
+instance PrettyForTrace TranslateTypesMsg where
+  prettyForTrace = \case
+
+instance IsTrace Level TranslateTypesMsg where
+  getDefaultLogLevel = \case
+  getSource          = const HsBindgen
+  getTraceId         = const "translate-types"
+
+{-------------------------------------------------------------------------------
+  DelayedMsg
+-------------------------------------------------------------------------------}
+
+data DelayedTranslateTypesMsg
+  deriving stock (Show, Generic)
+
+instance PrettyForTrace DelayedTranslateTypesMsg where
+  prettyForTrace = \case
+
+instance IsTrace Level DelayedTranslateTypesMsg where
+  getDefaultLogLevel = \case
+  getSource          = const HsBindgen
+  getTraceId         = const "translate-types"
diff --git a/src-internal/HsBindgen/Frontend/Pass/TranslateTypes/Translation.hs b/src-internal/HsBindgen/Frontend/Pass/TranslateTypes/Translation.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/TranslateTypes/Translation.hs
@@ -0,0 +1,166 @@
+-- | Translate types (use sites)
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Frontend.Pass.TranslateTypes.Translation qualified as Translation
+module HsBindgen.Frontend.Pass.TranslateTypes.Translation (
+    -- * Contextual translation
+    TypeContext(..)
+  , IsPassCompat
+  , InContext(..)
+    -- ** Helper functions
+  , topLevel
+  ) where
+
+import Data.Proxy (Proxy (..))
+import GHC.Stack
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Errors
+import HsBindgen.Frontend.Pass.AdjustTypes.IsPass
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Translation
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Contextual translation
+-------------------------------------------------------------------------------}
+
+data TypeContext =
+    Top     -- ^ Anything else
+  | FunArg  -- ^ Function argument
+  | FunRes  -- ^ Function result
+  | PtrArg  -- ^ Pointer argument
+  deriving stock (Show)
+
+-- | Constraints for compatible passes for C type translation
+--
+-- Effectively, type translation is supports
+-- 'HsBindgen.Frontend.Pass.TranslateTypes.IsPass.TranslateTypes' and later.
+type IsPassCompat p = (
+    IsPass p
+  , Ann "TypeFunArg" p ~ AdjustedFrom p
+  , ExtBinding p ~ BindingSpec.ResolvedExtBinding
+  , Id p ~ DeclIdPair
+  , MacroId p ~ Id p
+  , MacroUnderlying p ~ C.Type p
+  )
+
+class InContext a where
+  inContext :: HasCallStack => TypeContext -> a -> Hs.Type
+
+instance IsPassCompat p => InContext (C.Type p) where
+  inContext = typeInContext
+
+instance IsPassCompat p => InContext (C.TypeFunArg p) where
+  inContext ctx arg = funArg ctx arg.typ arg.ann
+
+instance IsPassCompat p => InContext (C.FunctionArg p) where
+  inContext ctx arg = funArg ctx (cType (Proxy @p) arg.typ) arg.ann
+
+{-------------------------------------------------------------------------------
+  Helper functions
+-------------------------------------------------------------------------------}
+
+topLevel :: (HasCallStack, IsPassCompat p) => C.Type p -> Hs.Type
+topLevel = inContext Top
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+typeInContext ::
+     (HasCallStack, IsPassCompat p)
+  => TypeContext
+  -> C.Type p
+  -> Hs.Type
+typeInContext ctx = \case
+    C.TypePrim p ->
+      Hs.PrimType (translateCPrimType p)
+    C.TypeComplex p ->
+      Hs.ComplexType (translateCPrimType p)
+    C.TypeRef ref ->
+      Hs.TypRef
+        (Hs.assertNs (Proxy @Hs.NsTypeConstr) ref.hsName)
+        Nothing
+    C.TypeEnum ref ->
+      Hs.TypRef
+        (Hs.assertNs (Proxy @Hs.NsTypeConstr) ref.name.hsName)
+        (Just $ typeInContext ctx ref.underlying)
+    C.TypeMacro ref ->
+      Hs.TypRef
+        (Hs.assertNs (Proxy @Hs.NsTypeConstr) ref.name.hsName)
+        (Just $ typeInContext ctx ref.underlying)
+    C.TypeTypedef ref ->
+      Hs.TypRef
+        (Hs.assertNs (Proxy @Hs.NsTypeConstr) ref.name.hsName)
+        (Just $ typeInContext ctx ref.underlying)
+    C.TypePointers n ty
+      -- Use a 'FunPtr' if the type is a function type.  We inspect the
+      -- /canonical/ type because we want to see through typedefs and type
+      -- qualifiers like @const@.
+      | C.isCanonicalTypeFunction ty ->
+          foldr
+            ($)
+            (Hs.FunPtr $ typeInContext PtrArg ty)
+            (replicate (n - 1) Hs.Ptr)
+      | C.isErasedTypeConstQualified ty ->
+          foldr
+            ($)
+            (Hs.PtrConst $ typeInContext PtrArg ty)
+            (replicate (n - 1) Hs.Ptr)
+      | otherwise ->
+          foldr
+            ($)
+            (typeInContext PtrArg ty)
+            (replicate n Hs.Ptr)
+    C.TypeConstArray n ty ->
+      Hs.ConstArray n (typeInContext Top ty)
+    C.TypeIncompleteArray ty ->
+      Hs.IncompleteArray (typeInContext Top ty)
+    C.TypeFun args res ->
+      foldr
+        (\arg acc -> Hs.Fun (inContext FunArg arg) acc)
+        (Hs.IO $ typeInContext FunRes res)
+        args
+    C.TypeVoid ->
+      Hs.PrimType (void ctx)
+    C.TypeBlock ty ->
+      Hs.Block $ typeInContext Top ty
+    C.TypeQual C.QualConst ty ->
+      typeInContext ctx ty
+    C.TypeExtBinding ref ->
+      let ext = ref.name
+      in  Hs.ExtBinding
+            ext.hsName
+            ext.cSpec
+            ext.hsSpec
+            (typeInContext ctx ref.underlying)
+
+-- | Translate a function argument
+funArg ::
+     (HasCallStack, IsPassCompat p)
+  => TypeContext
+  -> C.Type p
+  -> AdjustedFrom p
+  -> Hs.Type
+funArg ctx ty = \case
+    AdjustedFromArray origTy
+      | C.isErasedTypeConstQualified origTy ->
+          Hs.PtrConstArrayElem (typeInContext Top origTy)
+      | otherwise ->
+          Hs.PtrArrayElem (typeInContext Top origTy)
+    AdjustedFromFunction _origTy -> typeInContext ctx ty
+    NotAdjusted -> typeInContext ctx ty
+
+-- | Translate @void@
+--
+-- This only makes sense in non-top-level contexts.  (We take special care in
+-- macro type parsing to rule out top-level @void@.)
+void :: HasCallStack => TypeContext -> Hs.PrimType
+void = \case
+    FunRes -> Hs.PrimUnit
+    PtrArg -> Hs.PrimVoid
+    c      -> panicPure ("Unexpected type void in context " ++ show c)
diff --git a/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros.hs b/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros.hs
@@ -0,0 +1,72 @@
+module HsBindgen.Frontend.Pass.TypecheckMacros (
+    typecheckMacros
+  ) where
+
+import Data.Foldable qualified as Foldable
+import Data.Map qualified as Map
+
+import HsBindgen.Frontend.Analysis.DeclIndex qualified as DeclIndex
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Frontend.LanguageC qualified as LanC
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.KnownTypes
+import HsBindgen.Frontend.Pass.TypecheckMacros.Typecheck
+import HsBindgen.Frontend.TranslationUnit qualified as C
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+
+type In  = ConstructTranslationUnit
+type Out = TypecheckMacros
+
+-- | We perform two traversals:
+--
+-- Traversal 1: collect known types
+--
+-- Traversal 2: typecheck macros
+--
+-- Return the updated translation unit together with the 'LanC.ReparseEnv' that
+-- 'reparseMacroExpansions' uses to reparse declarations.
+--
+-- Register macro typecheck failures in @DeclMeta@.
+typecheckMacros ::
+     Macro.HasTypes l
+  => Macro.Lang l
+  -> C.TranslationUnit l In
+  -> ( C.TranslationUnit l Out
+     , Map LanC.CName (C.Type TypecheckMacros)
+     , Set LanC.CName
+     )
+typecheckMacros macroLang unit =
+    let knownTypes =
+          collectKnownTypes unit.decls
+        (typecheckedDecls, knownMacroTypes, failedMacros) =
+          typecheckDecls macroLang unit.decls
+    in  ( reconstructAfterTypecheck unit failedMacros typecheckedDecls
+        , Map.fromList [
+              (n, v)
+            | (declId, v) <- Map.toList knownTypes
+            , Just n <- [C.renderNamedDeclId declId]
+            ]
+        , knownMacroTypes
+        )
+
+reconstructAfterTypecheck ::
+     C.TranslationUnit l In
+  -> [FailedMacro]
+  -> [C.Decl l Out]
+  -> C.TranslationUnit l Out
+reconstructAfterTypecheck unit failedMacros decls =
+    C.TranslationUnit{
+        decls        = decls
+      , includeGraph = unit.includeGraph
+      , meta         = unit.meta{
+            declIndex =
+              Foldable.foldl'
+                DeclIndex.registerMacroTypecheckFailure
+                unit.meta.declIndex
+                failedMacros
+          }
+      }
diff --git a/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros/IsPass.hs b/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros/IsPass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros/IsPass.hs
@@ -0,0 +1,159 @@
+module HsBindgen.Frontend.Pass.TypecheckMacros.IsPass (
+    TypecheckMacros
+    -- * Checked macros
+  , TypecheckedMacro(..)
+  , TypecheckedMacroType(..)
+  , TypecheckedMacroValue(..)
+  , MacroTypeBodyVar(..)
+  ) where
+
+import HsBindgen.Frontend.Analysis (Dependency)
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.Parse.IsPass (ReparseInfo, Tokens)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Pass.Types (CoercePassAnonRef)
+import HsBindgen.Macro.Type qualified as Macro
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type TypecheckMacros :: Pass
+data TypecheckMacros a
+
+-- | Macros have been typechecked ('MacroBody' is 'TypecheckedMacro TypecheckMacros').
+-- Other declarations still carry their 'ReparseInfo' annotations from
+-- 'ConstructTranslationUnit'; these are consumed in the following
+-- 'ReparseMacroExpansions' pass.
+type family AnnTypecheckMacros (ix :: Symbol) :: Star where
+  AnnTypecheckMacros "IndirectField" = ReparseInfo Tokens
+  AnnTypecheckMacros "Function"      = ReparseInfo Tokens
+  AnnTypecheckMacros "Global"        = ReparseInfo Tokens
+  AnnTypecheckMacros "RegularField"  = ReparseInfo Tokens
+  AnnTypecheckMacros "Typedef"       = ReparseInfo Tokens
+  AnnTypecheckMacros _               = NoAnn
+
+instance IsPass TypecheckMacros
+
+instance PassId TypecheckMacros
+
+instance PassScopedName TypecheckMacros
+
+instance PassTypes TypecheckMacros
+
+instance PassMacro TypecheckMacros where
+  type MacroId   TypecheckMacros = Id TypecheckMacros
+  type MacroBody TypecheckMacros = TypecheckedMacro TypecheckMacros
+
+  macroIdId _ = id
+
+instance PassExtBinding TypecheckMacros
+
+instance PassCommentDecl TypecheckMacros where
+  type CommentDecl TypecheckMacros = Maybe (C.Comment TypecheckMacros)
+
+instance PassAnn TypecheckMacros where
+  type Ann ix TypecheckMacros = AnnTypecheckMacros ix
+
+instance PassMsg TypecheckMacros
+
+{-------------------------------------------------------------------------------
+  Checked macros
+-------------------------------------------------------------------------------}
+
+-- 'TypecheckedMacro' is used as 'MacroBody p l', so the order of type
+-- parameters is fixed.
+data TypecheckedMacro p l =
+    MacroType  (TypecheckedMacroType  l p)
+  | MacroValue (TypecheckedMacroValue l p)
+
+-- | Checked type macro
+data TypecheckedMacroType l p = Macro.HasTypes l => TypecheckedMacroType{
+      body :: Macro.TypecheckedType l (MacroTypeBodyVar p)
+    , deps :: [(C.DeclId, Dependency)]
+    , ann  :: Ann "TypecheckedMacroType" p
+    }
+
+data TypecheckedMacroValue l p = Macro.HasTypes l => TypecheckedMacroValue {
+      body :: Macro.TypecheckedValue l (Id p)
+    , deps :: [(C.DeclId, Dependency)]
+    }
+
+deriving stock instance IsPass p => Show (TypecheckedMacro      p l)
+deriving stock instance IsPass p => Show (TypecheckedMacroType  l p)
+deriving stock instance IsPass p => Show (TypecheckedMacroValue l p)
+
+deriving stock instance IsPass p => Eq (TypecheckedMacro      p l)
+deriving stock instance IsPass p => Eq (TypecheckedMacroType  l p)
+deriving stock instance IsPass p => Eq (TypecheckedMacroValue l p)
+
+-- | We have to be specific, when a macro type refers to an external binding.
+data MacroTypeBodyVar p =
+    MacroTypeExtBinding (ExtBinding p)
+  | MacroTypeBodyVar    (Id p)
+
+deriving stock instance IsPass p => Eq   (MacroTypeBodyVar p)
+deriving stock instance IsPass p => Ord  (MacroTypeBodyVar p)
+deriving stock instance IsPass p => Show (MacroTypeBodyVar p)
+
+{-------------------------------------------------------------------------------
+  CoercePass for TypecheckedMacro (parametric; applies to any passes p, p')
+-------------------------------------------------------------------------------}
+
+instance (
+      CoercePassId p p'
+    , ExtBinding p ~ ExtBinding p'
+    , Ann "TypecheckedMacroType" p ~ Ann "TypecheckedMacroType" p'
+    ) => CoercePassParam TypecheckedMacro p p' where
+  coercePassParam = \case
+    MacroType  typ -> MacroType  (coercePass typ)
+    MacroValue val -> MacroValue (coercePass val)
+
+instance (
+      CoercePassId p p'
+    , ExtBinding p ~ ExtBinding p'
+    ) => CoercePass MacroTypeBodyVar p p' where
+  coercePass = \case
+    MacroTypeExtBinding x -> MacroTypeExtBinding x
+    MacroTypeBodyVar    x -> MacroTypeBodyVar (coercePassId (Proxy @'(p, p')) x)
+
+instance (
+      CoercePassId p p'
+    , ExtBinding p ~ ExtBinding p'
+    , Ann "TypecheckedMacroType" p ~ Ann "TypecheckedMacroType" p'
+    ) => CoercePass (TypecheckedMacroType l) p p' where
+  coercePass (TypecheckedMacroType body deps ann) =
+    TypecheckedMacroType{
+        body = fmap coercePass body
+      , deps = deps
+      , ann  = ann
+      }
+
+instance CoercePassId p p' => CoercePass (TypecheckedMacroValue l) p p' where
+  coercePass (TypecheckedMacroValue body deps) =
+    TypecheckedMacroValue{
+        body = fmap (coercePassId (Proxy @'(p, p'))) body
+      , deps = deps
+      }
+
+{-------------------------------------------------------------------------------
+  CoercePass: ConstructTranslationUnit → TypecheckMacros
+-------------------------------------------------------------------------------}
+
+instance CoercePassAnonRef          ConstructTranslationUnit TypecheckMacros
+instance CoercePassId               ConstructTranslationUnit TypecheckMacros
+instance CoercePassTypes            ConstructTranslationUnit TypecheckMacros
+instance CoercePassMacroId          ConstructTranslationUnit TypecheckMacros where
+    coercePassMacroId _ = absurd
+instance CoercePassMacroUnderlying  ConstructTranslationUnit TypecheckMacros
+
+instance CoercePassAnn "Function"      ConstructTranslationUnit TypecheckMacros
+instance CoercePassAnn "Global"        ConstructTranslationUnit TypecheckMacros
+instance CoercePassAnn "IndirectField" ConstructTranslationUnit TypecheckMacros
+instance CoercePassAnn "RegularField"  ConstructTranslationUnit TypecheckMacros
+instance CoercePassAnn "TypeFunArg"    ConstructTranslationUnit TypecheckMacros
+instance CoercePassAnn "Typedef"       ConstructTranslationUnit TypecheckMacros
+instance CoercePassCommentDecl         ConstructTranslationUnit TypecheckMacros where
+  coercePassCommentDecl _ = fmap coercePass
diff --git a/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros/KnownTypes.hs b/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros/KnownTypes.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros/KnownTypes.hs
@@ -0,0 +1,58 @@
+module HsBindgen.Frontend.Pass.TypecheckMacros.KnownTypes (
+    collectKnownTypes
+  ) where
+
+import Data.Map qualified as Map
+
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+
+type In    = ConstructTranslationUnit
+type Out   = TypecheckMacros
+type CType = C.Type Out
+
+-- | Collect typedef and tagged-type mappings from all non-macro declarations in
+-- the translation unit.
+collectKnownTypes :: [C.Decl l In] -> Map C.DeclId CType
+collectKnownTypes decls = Map.fromList $ mapMaybe getKnownType decls
+
+getKnownType :: C.Decl l In -> Maybe (C.DeclId, CType)
+getKnownType decl = case decl.kind of
+    -- We do not know the types of macros, yet.
+    C.DeclMacro{}                -> Nothing
+    C.DeclTypedef typedef        -> Just $ (declId, getKnownTypedef typedef)
+    C.DeclStruct{}               -> Just $ (declId,  knownStructOrUnion)
+    C.DeclUnion{}                -> Just $ (declId,  knownStructOrUnion)
+    C.DeclEnum enum              -> Just $ (declId,  getKnownEnum enum)
+    C.DeclUntaggedEnumConstant{} -> Nothing
+    -- Include opaque tagged types: they can be referenced by macros (e.g. as a
+    -- pointer type). The only opaque type-like declarations carrying an
+    -- ordinary name are @typedef void foo@, which is not a valid standalone
+    -- type, so macros using them will fail anyway.
+    C.DeclOpaque{}               -> getKnownTaggedTypeOpaque
+    C.DeclFunction{}             -> Nothing
+    C.DeclGlobal{}               -> Nothing
+  where
+    info :: C.DeclInfo In
+    info = decl.info
+
+    getKnownTaggedTypeOpaque :: Maybe (C.DeclId, CType)
+    getKnownTaggedTypeOpaque =
+      case info.id.name.kind of
+        C.NameKindTagged _ -> Just (declId, knownStructOrUnion)
+        _                  -> Nothing
+
+    declId :: C.DeclId
+    declId = info.id
+
+    getKnownTypedef :: C.Typedef In -> CType
+    getKnownTypedef typedef = C.TypeTypedef $ C.Ref info.id $ coercePass typedef.typ
+
+    knownStructOrUnion :: CType
+    knownStructOrUnion = C.TypeRef info.id
+
+    getKnownEnum :: C.Enum In -> CType
+    getKnownEnum enum = C.TypeEnum $ C.Ref info.id $ coercePass enum.typ
diff --git a/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros/Typecheck.hs b/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros/Typecheck.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Pass/TypecheckMacros/Typecheck.hs
@@ -0,0 +1,137 @@
+module HsBindgen.Frontend.Pass.TypecheckMacros.Typecheck (
+    FailedMacro
+  , typecheckDecls
+  ) where
+
+import Data.Either
+import Data.Map qualified as Map
+import Data.Set qualified as Set
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis
+import HsBindgen.Frontend.Pass.ConstructTranslationUnit.IsPass
+import HsBindgen.Frontend.Pass.TypecheckMacros.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Error
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+
+type In    = ConstructTranslationUnit
+type Out   = TypecheckMacros
+
+type FailedMacro = (C.DeclInfo Out, MacroTypecheckError)
+
+{-------------------------------------------------------------------------------
+  Typecheck macros
+-------------------------------------------------------------------------------}
+
+-- | Typecheck all macro declarations, threading non-macro declarations through
+-- unchanged.
+--
+-- Returns the typechecked declarations, the set of names of type-like macros
+-- (used by the reparse environment), and the macros that failed to typecheck.
+typecheckDecls ::
+     forall l. Macro.HasTypes l
+  => Macro.Lang l
+  -> [C.Decl l In]
+  -> ([C.Decl l Out], Set Text, [FailedMacro])
+typecheckDecls macroLang decls =
+    (successes, getKnownMacroTypes successes, failures)
+  where
+    tcResults :: Map Text (Macro.TypecheckResult l)
+    tcResults = macroLang.typecheck (mapMaybe getResolvedMacro decls)
+
+    failures  :: [FailedMacro]
+    successes :: [C.Decl l Out]
+    (failures, successes) = partitionEithers (map (toOutcome tcResults) decls)
+
+getResolvedMacro :: C.Decl l In -> Maybe (Macro.Resolved l)
+getResolvedMacro decl = case decl.kind of
+    C.DeclMacro macro -> Just macro
+    _otherwise        -> Nothing
+
+{-------------------------------------------------------------------------------
+  Process a single declaration
+-------------------------------------------------------------------------------}
+
+-- | The outcome of processing a single declaration: a macro that failed to
+-- typecheck (dropped from the output), or a declaration to keep (a non-macro,
+-- or a successfully typechecked macro).
+type Outcome l = Either FailedMacro (C.Decl l Out)
+
+-- | Coerce a non-macro declaration to the output pass, or assemble a macro from
+-- its typecheck result.
+toOutcome ::
+     forall l. Macro.HasTypes l
+  => Map Text (Macro.TypecheckResult l)
+  -> C.Decl l In
+  -> Outcome l
+toOutcome tcResults decl = case decl.kind of
+    C.DeclMacro                x -> assembleMacro tcResults info' decl.ann x
+    C.DeclTypedef              x -> nonMacro $ C.DeclTypedef              $ coercePass x
+    C.DeclStruct               x -> nonMacro $ C.DeclStruct               $ coercePass x
+    C.DeclUnion                x -> nonMacro $ C.DeclUnion                $ coercePass x
+    C.DeclEnum                 x -> nonMacro $ C.DeclEnum                 $ coercePass x
+    C.DeclUntaggedEnumConstant x -> nonMacro $ C.DeclUntaggedEnumConstant $ coercePass x
+    C.DeclOpaque               x -> nonMacro $ C.DeclOpaque                 x
+    C.DeclFunction             x -> nonMacro $ C.DeclFunction             $ coercePass x
+    C.DeclGlobal               x -> nonMacro $ C.DeclGlobal               $ coercePass x
+  where
+    info' :: C.DeclInfo Out
+    info' = coercePass decl.info
+
+    nonMacro :: C.DeclKind l Out -> Outcome l
+    nonMacro kind' = Right $ C.Decl info' kind' decl.ann
+
+-- | Assemble a macro declaration from its (pre-computed) batch typecheck result,
+-- reporting failure if typechecking did not succeed.
+assembleMacro ::
+     Macro.HasTypes l
+  => Map Text (Macro.TypecheckResult l)
+  -> C.DeclInfo Out
+  -> Ann "Decl" Out
+  -> Macro.Resolved l
+  -> Outcome l
+assembleMacro tcResults info ann resolved =
+    case Map.lookup info.id.name.text tcResults of
+      Nothing ->
+        panicPure $
+          "assembleMacro: typechecked macro unavailable: "
+            <> show info.id.name.text
+      Just tcRes -> case fromTcResult resolved.deps tcRes of
+        Left  err  -> Left (info, err)
+        Right body -> Right (C.Decl info (C.DeclMacro body) ann)
+
+-- | Build the typechecked macro body from its typecheck result and (previously
+-- resolved) dependencies.
+fromTcResult ::
+     Macro.HasTypes l
+  => [(C.DeclId, Dependency)]
+  -> Macro.TypecheckResult l
+  -> Either MacroTypecheckError (TypecheckedMacro TypecheckMacros l)
+fromTcResult deps = \case
+    Macro.TypecheckType x ->
+      Right $ MacroType $ TypecheckedMacroType (fmap MacroTypeBodyVar x) deps NoAnn
+    Macro.TypecheckValue x ->
+      Right $ MacroValue $ TypecheckedMacroValue x deps
+    Macro.TypecheckError err ->
+      Left err
+
+{-------------------------------------------------------------------------------
+  Known macro types
+-------------------------------------------------------------------------------}
+
+-- | Names of the type-like macros among the given declarations.
+--
+-- The reparse environment uses these names to recognise macro-defined type
+-- names. Special case: @#define bool _Bool@ from stdbool.h is normalised so
+-- that @bool@ renders identically to @_Bool@ regardless of @language-c@
+-- version.
+getKnownMacroTypes :: [C.Decl l Out] -> Set Text
+getKnownMacroTypes decls = Set.fromList
+    [ decl.info.id.name.text
+    | decl <- decls
+    , C.DeclMacro (MacroType _) <- [decl.kind]
+    ]
diff --git a/src-internal/HsBindgen/Frontend/Predicate.hs b/src-internal/HsBindgen/Frontend/Predicate.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/Predicate.hs
@@ -0,0 +1,270 @@
+-- | Select definitions from the C header
+module HsBindgen.Frontend.Predicate (
+    -- * Booleans
+    Boolean (..)
+  , mergeBooleans
+  , eval
+    -- * Predicates
+  , HeaderPathPredicate (..)
+  , DeclPredicate (..)
+  , SelectionPredicate (..)
+  , Regex -- opaque
+  , matchTest
+    -- * Execution (internal API)
+  , IsMainHeader
+  , mkIsMainHeader
+  , IsInMainHeaderDir
+  , mkIsInMainHeaderDir
+  , matchSelect
+  ) where
+
+import Data.Function
+import Data.List qualified as List
+import Data.Set qualified as Set
+import System.FilePath qualified as FilePath
+import Text.Regex.PCRE qualified as PCRE
+import Text.Regex.PCRE.Text ()
+
+import Clang.Paths
+
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Boolean logic combining predicates that determine which declarations should
+-- be kept
+data Boolean a =
+    -- | Match any declaration
+    BTrue
+
+    -- | Match no declaration
+  | BFalse
+
+    -- | Logical conjunction
+  | BAnd (Boolean a) (Boolean a)
+
+    -- | Logical disjunction
+  | BOr (Boolean a) (Boolean a)
+
+    -- | Logical negation
+  | BNot (Boolean a)
+
+    -- | Concrete predicates
+  | BIf a
+  deriving stock (Show, Eq, Generic)
+
+instance Default a => Default (Boolean a) where
+  def = BIf def
+
+-- | Predicates matched against header paths
+data HeaderPathPredicate =
+    -- | Only include declarations in main headers (not included headers)
+    FromMainHeaders
+
+    -- | Only include declarations in headers in main header directories,
+    -- including subdirectories
+  | FromMainHeaderDirs
+
+    -- | Include declarations in any header
+    --
+    -- Unlike 'BTrue', this excludes declarations without a header, such as
+    -- macros defined by root directives or @-D@ options.
+  | FromAllHeaders
+
+    -- | Match header path against regex
+  | HeaderPathMatches Regex
+  deriving stock (Show, Eq, Generic)
+
+-- | Predicates matched against declarations themselves
+data DeclPredicate =
+    -- | Match declaration name against regex
+    DeclNameMatches Regex
+    -- | Match deprecated declarations taking current target platform into
+    -- account; see 'HsBindgen.Frontend.AST.Decl.Availability'
+  | DeclDeprecated
+  deriving stock (Show, Eq, Generic)
+
+-- | Predicates for the @Select@ pass
+--
+-- Selection predicates match against header file paths or the declarations
+-- themselves.
+--
+-- The selection predicate dictates which declarations `hs-bindgen` generates
+-- bindings for. For details, please see the @hs-bindgen@ manual section on
+-- predicates and program slicing.
+data SelectionPredicate =
+    SelectHeader HeaderPathPredicate
+  | SelectDecl   DeclPredicate
+  deriving stock (Show, Eq, Generic)
+
+instance Default SelectionPredicate where
+  def = SelectHeader FromMainHeaders
+
+{-------------------------------------------------------------------------------
+  Execution
+
+  NOTE: This is internal API (users construct filters, but don't use them).
+-------------------------------------------------------------------------------}
+
+-- | Check if a declaration is from one of the main headers
+--
+-- Dealing with main headers is somewhat subtle.  See
+-- "HsBindgen.Frontend.ProcessIncludes" for discussion.
+type IsMainHeader = RealPath -> Bool
+
+-- | Construct an 'IsMainHeader' function for the given main header paths
+mkIsMainHeader ::
+     Set RealPath -- ^ Main header paths
+  -> IsMainHeader
+mkIsMainHeader paths path = path `Set.member` paths
+
+-- | Check if a declaration is in a main header directory, including
+-- subdirectories
+type IsInMainHeaderDir = RealPath -> Bool
+
+-- | Construct an 'IsInMainHeaderDir' function for the given main header paths
+mkIsInMainHeaderDir ::
+     Set RealPath -- ^ Main header paths
+  -> IsInMainHeaderDir
+mkIsInMainHeaderDir paths path =
+    let dir = FilePath.splitDirectories . FilePath.takeDirectory $
+          getRealPath path
+    in  any (`List.isPrefixOf` dir) mainDirs
+  where
+    mainDirs :: [[FilePath]]
+    mainDirs = map FilePath.splitDirectories . Set.toList $
+      Set.map (FilePath.takeDirectory . getRealPath) paths
+
+-- | Match 'SelectionPredicate' predicates
+--
+-- A declaration without a header (a root directive or a @-D@ option) matches
+-- no 'HeaderPathPredicate'.
+matchSelect ::
+     IsMainHeader
+  -> IsInMainHeaderDir
+  -> C.DeclPath
+  -> C.DeclName
+  -> C.Availability
+  -> Boolean SelectionPredicate
+  -> Bool
+matchSelect isMainHeader isInMainHeaderDir path cDeclName availability = eval $ \case
+    SelectHeader p -> case path of
+      C.InHeader realPath -> matchHeaderPath isMainHeader isInMainHeaderDir realPath p
+      C.InRootHeader      -> False
+      C.OnCommandLine     -> False
+    SelectDecl   p -> matchDecl cDeclName availability p
+
+{-------------------------------------------------------------------------------
+  Merging
+-------------------------------------------------------------------------------}
+
+-- | Merge lists of negative and positive Booleans
+--
+-- Combine the negative Booleans using AND, and the positive Booleans using OR.
+mergeBooleans :: forall a. Eq a => [Boolean a] -> [Boolean a] -> Boolean a
+mergeBooleans negatives positives =
+    reduce $ BAnd neg pos
+  where
+    mergeNeg, mergePos :: Boolean a -> Boolean a -> Boolean a
+    mergeNeg p q = reduce $ BAnd (reduce $ BNot $ reduce p) q
+    mergePos p q = reduce $ BOr (reduce p) q
+
+    neg, pos :: Boolean a
+    neg = foldr mergeNeg BTrue  negatives
+    pos = foldr mergePos BFalse positives
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: execution
+-------------------------------------------------------------------------------}
+
+-- | Boolean logic reduction
+--
+-- * This is /not/ recursive: we call this at every step in 'eval'
+-- * This needs to match the semantics of 'eval' precisely.
+reduce :: Eq a => Boolean a -> Boolean a
+reduce = \case
+    BNot (BNot p) -> p
+    BNot BTrue    -> BFalse
+    BNot BFalse   -> BTrue
+    --
+    BAnd BTrue q -> q
+    BAnd p BTrue -> p
+    BAnd p q | p == BFalse || q == BFalse -> BFalse
+    --
+    BOr BFalse q -> q
+    BOr p BFalse -> p
+    BOr p q | p == BTrue || q == BTrue -> BTrue
+    --
+    p -> p
+
+-- | Evaluate a 'Boolean'
+--
+-- * This needs to match the semantics of 'reduce' precisely.  It should be OK
+--   as long as /obvious/ boolean interpretations are used.
+eval :: forall a.
+     Eq a
+  => (a -> Bool)  -- ^ Evaluation function for concrete Booleans
+  -> Boolean a
+  -> Bool
+eval f = go
+  where
+    go :: Boolean a -> Bool
+    go p = case reduce p of
+      BTrue        -> True
+      BFalse       -> False
+      BAnd   p1 p2 -> go p1 && go p2
+      BOr    p1 p2 -> go p1 || go p2
+      BNot   p1    -> not (go p1)
+      BIf    p1    -> f p1
+
+-- | Match 'HeaderPathPredicate' predicates
+matchHeaderPath ::
+     IsMainHeader
+  -> IsInMainHeaderDir
+  -> RealPath
+  -> HeaderPathPredicate
+  -> Bool
+matchHeaderPath isMainHeader isInMainHeaderDir realPath = \case
+    FromMainHeaders      -> isMainHeader realPath
+    FromMainHeaderDirs   -> isInMainHeaderDir realPath
+    FromAllHeaders       -> True
+    HeaderPathMatches re -> matchTest re (getRealPathText realPath)
+
+-- | Match 'DeclPredicate' predicates
+matchDecl :: C.DeclName -> C.Availability -> DeclPredicate -> Bool
+matchDecl cDeclName availability = \case
+    DeclNameMatches re -> matchTest re $ C.renderDeclName cDeclName
+    DeclDeprecated     -> isDeprecated
+  where
+    isDeprecated = case availability of
+      C.Deprecated -> True
+      _            -> False
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: regexs
+-------------------------------------------------------------------------------}
+
+-- | Perl-compatible regular expression
+data Regex = Regex{
+      string   :: String
+    , compiled :: PCRE.Regex
+    }
+
+instance Eq Regex where
+  (==) = (==) `on` (.string)
+
+-- | Validity of the 'Show' instance depends on the 'IsString' instance
+instance Show Regex where
+  show regex = show regex.string
+
+instance IsString Regex where
+  fromString string = Regex{
+        string   = string
+      , compiled = PCRE.makeRegex string
+      }
+
+matchTest :: Regex -> Text -> Bool
+matchTest regex = PCRE.matchTest regex.compiled
diff --git a/src-internal/HsBindgen/Frontend/PrettyC.hs b/src-internal/HsBindgen/Frontend/PrettyC.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/PrettyC.hs
@@ -0,0 +1,260 @@
+-- | A small subset of C which we can pretty-print.
+--
+-- Used for generating C wrappers in userland-capi approach.
+-- It's cleaner to generate AST than glueing string-of-code together.
+module HsBindgen.Frontend.PrettyC (
+    FunDefn (..),
+    Args,
+    withArgs,
+    argsToIdx,
+    -- * AST
+    Statement (..),
+    CompoundStatement (..),
+    CSList (..),
+    Declaration (..),
+    Declarator (..),
+    Initializer (..),
+    LVal (..),
+    Expr (..),
+    -- * Pretty-printing
+    prettyFunDefn,
+) where
+
+import Prelude hiding (lines, unlines)
+
+import Control.Monad.State.Strict (State, evalState, get, put)
+import DeBruijn (Env (..), Idx, lookupEnv, sizeEnv, sizeToInt, tabulateEnv)
+
+import HsBindgen.Frontend.Pass.Final
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+type Name = String
+
+data FunDefn where
+    FunDefn :: Name -> C.Type Final -> C.FunctionPurity -> Args ctx -> CompoundStatement ctx -> FunDefn
+
+deriving instance Show FunDefn
+
+type Args ctx = Env ctx (C.Type Final)
+
+-- Env, and thus Args, are SnocList.
+-- when converting from ordinary list, we need to reverse first.
+withArgs :: [a] -> (forall ctx. Env ctx a -> r) -> r
+withArgs tys = withArgs' (reverse tys)
+
+withArgs' :: [a] -> (forall ctx. Env ctx a -> r) -> r
+withArgs' []       k = k EmptyEnv
+withArgs' (x : xs) k = withArgs' xs $ \args -> k (args :> x)
+
+argsToIdx :: Env ctx a -> Env ctx (Idx ctx)
+argsToIdx args = tabulateEnv (sizeEnv args) id
+
+{-------------------------------------------------------------------------------
+  AST
+-------------------------------------------------------------------------------}
+
+-- | Statement
+--
+-- <https://en.cppreference.com/w/c/language/statements.html>
+data Statement ctx where
+    CompoundStatement :: CompoundStatement ctx -> Statement ctx
+    -- | Expression statement
+    --
+    -- <https://en.cppreference.com/w/c/language/statements.html#Expression_statements>
+    ExpressionStatement :: Expr ctx -> Statement ctx
+  deriving Show
+
+-- | Compound statement
+--
+-- <https://en.cppreference.com/w/c/language/statements.html#Compound_statements>
+data CompoundStatement ctx where
+    CSList :: CSList ctx -> CompoundStatement ctx
+  deriving Show
+
+-- | Compound statement (continued)
+--
+-- <https://en.cppreference.com/w/c/language/statements.html#Compound_statements>
+data CSList ctx where
+    CSNil :: CSList ctx
+    CSStatement :: Statement ctx -> CSList ctx -> CSList ctx
+    CSDeclaration :: Declaration ctx ctx' -> CSList ctx' -> CSList ctx
+
+deriving stock instance Show (CSList ctx)
+
+-- | @declaration@
+--
+-- <https://en.cppreference.com/w/c/language/declarations.html>
+data Declaration ctx ctx' where
+    -- | A declaration: no initializer
+    Declaration :: C.Type Final -> Declarator ctx ctx' -> Declaration ctx ctx'
+    -- | A definition: a declaration with an initializer
+    Definition :: C.Type Final -> Declarator ctx ctx' -> Initializer ctx -> Declaration ctx ctx'
+
+deriving stock instance Show (Declaration ctx ctx')
+
+-- | @declarator@
+--
+-- <https://en.cppreference.com/w/c/language/declarations.html#Declarators>
+data Declarator ctx ctx' where
+    -- | An identifier
+    Identifier :: Declarator ctx (S ctx)
+
+deriving stock instance Show (Declarator ctx ctx')
+
+-- | @initializer@
+--
+-- <https://en.cppreference.com/w/c/language/initialization.html>
+data Initializer ctx where
+    -- | @expression@
+    InitializerExpr :: Expr ctx -> Initializer ctx
+
+deriving stock instance Show (Initializer ctx)
+
+data LVal ctx
+    = LVar (Idx ctx)
+    | LDeRef (LVal ctx)
+  deriving Show
+
+data Expr ctx
+    = Call Name [Expr ctx]
+    | Var (Idx ctx)
+      -- | A named variable can be used to refer to variables that are free with
+      -- respect to the enclosing 'HsBindgen.Frontend.AST.Decl.Decl'\/'HsBindgen.PrettyC.FunDefn'.
+      --
+      -- If a variable is bound by the function definition, use 'Var' instead.
+      --
+      -- For example, any global variable is a free variable with respect to a
+      -- function definition:
+      --
+      -- > int i = 0;
+      -- > void i_plus (int j) { i += j; }
+      --
+      -- With respect to the function definition, @i@ is a free variable, @j@ is
+      -- a bound variable. A 'HsBindgen.PrettyC.FunDefn' describing @i_plus@ should use 'NamedVar'
+      -- for @i@, and 'Var' for @j@.
+    | NamedVar Name
+    | DeRef (Expr ctx)
+      -- | The @&@ C-operator.
+    | Address (Expr ctx)
+    | Return (Expr ctx)
+    | Assign (LVal ctx) (Expr ctx)
+  deriving Show
+
+{-------------------------------------------------------------------------------
+  Pretty-printing
+-------------------------------------------------------------------------------}
+
+prettyFunDefn :: FunDefn -> ShowS
+prettyFunDefn (FunDefn n ty attrs args stmts) = prettyFunDefn' n ty attrs args stmts
+
+prettyFunDefn' ::
+     forall ctx.
+     Name
+  -> C.Type Final
+  -> C.FunctionPurity
+  -> Args ctx
+  -> CompoundStatement ctx
+  -> ShowS
+prettyFunDefn' fun res pur args stmts =
+      C.showsFunctionType (showString fun) pur args' res
+    . showString "\n"
+    . unlines (prettyCompoundStatement stmts env)
+  where
+    args0 :: State Int (Env ctx ((ShowS, C.Type Final), ShowS))
+    args0 = forM args $ \ty -> do
+        i <- get
+        put $! i + 1
+        let n = showString "arg" . shows i
+        return ((n, ty), n)
+
+    args1 = evalState args0 1
+    args' = toList (fst <$> args1)
+    env   = snd <$> args1
+
+prettyStatement :: Statement ctx -> Env ctx ShowS -> [Line]
+prettyStatement (CompoundStatement stmts) env = prettyCompoundStatement stmts env
+prettyStatement (ExpressionStatement expr) env = [Line $ prettyExpr env expr . showChar ';']
+
+prettyCompoundStatement :: CompoundStatement ctx -> Env ctx ShowS -> [Line]
+prettyCompoundStatement (CSList stmts) env = concat
+    [ [Line $ showChar '{']
+    , tabs (prettyCSList stmts env)
+    , [Line $ showChar '}']
+    ]
+
+prettyCSList :: CSList ctx -> Env ctx ShowS -> [Line]
+prettyCSList CSNil _env = []
+prettyCSList (CSStatement stmt stmts) env = concat
+    [ prettyStatement stmt env
+    , prettyCSList stmts env
+    ]
+prettyCSList (CSDeclaration decl stmts) env =
+    let (s, env') = prettyDeclaration decl env
+    in  s : prettyCSList stmts env'
+
+prettyDeclaration ::Declaration ctx ctx' ->  Env ctx ShowS -> (Line, Env ctx' ShowS)
+prettyDeclaration (Declaration t d) env =
+    let (name, env') = prettyDeclarator d env
+    in  ( Line $ C.showsVariableType name t . showChar ';'
+        , env'
+        )
+prettyDeclaration (Definition t d e) env =
+    let (name, env') = prettyDeclarator d env
+    in  ( Line $ C.showsVariableType name t . showString " = " . prettyInitializer e env . showChar ';'
+        , env'
+        )
+
+prettyDeclarator ::
+     forall ctx ctx'.
+     Declarator ctx ctx'
+  -> Env ctx ShowS
+  -> (ShowS, Env ctx' ShowS)
+prettyDeclarator Identifier env = (name, env')
+  where
+    env' = env :> name
+    name = showChar 'x' . shows (sizeToInt (sizeEnv env) + 1)
+
+prettyInitializer :: Initializer ctx -> Env ctx ShowS -> ShowS
+prettyInitializer (InitializerExpr e) env = prettyExpr env e
+
+prettyLVal :: Env ctx ShowS -> LVal ctx -> ShowS
+prettyLVal env (LVar x)   = lookupEnv x env
+prettyLVal env (LDeRef x) = showChar '*' . prettyLVal env x
+
+prettyExpr :: Env ctx ShowS -> Expr ctx -> ShowS
+prettyExpr env  (Var s)      = lookupEnv s env
+prettyExpr _env (NamedVar n) = showString n
+prettyExpr env  (DeRef e)    = showChar '*' . prettyExpr env e
+prettyExpr env  (Address e)  = showChar '&' . prettyExpr env e
+prettyExpr env  (Call f xs)  = showParen True (showString f) . showParen True (foldMapSepShowS (showString ", ") (prettyExpr env) xs)
+prettyExpr env  (Return e)   = showString "return " . prettyExpr env e
+prettyExpr env  (Assign x e) = prettyLVal env x . showString " = " . prettyExpr env e
+
+{-------------------------------------------------------------------------------
+  Foldable
+-------------------------------------------------------------------------------}
+
+foldMapShowS :: (a -> ShowS) -> [a] -> ShowS
+foldMapShowS f = foldr (\a b -> f a . b) id
+
+foldMapSepShowS :: ShowS -> (a -> ShowS) -> [a] -> ShowS
+foldMapSepShowS _sep _f []     = id
+foldMapSepShowS  sep  f (x:xs) = foldr1 (\a b -> a . sep . b) (fmap f (x :| xs))
+
+{-------------------------------------------------------------------------------
+  Lines
+-------------------------------------------------------------------------------}
+
+-- | A single line of text (to be pretty-printed)
+newtype Line = Line ShowS
+
+unlines :: [Line] -> ShowS
+unlines = foldMapShowS $ \(Line s) ->
+    s . showChar '\n'
+
+tabs :: [Line] -> [Line]
+tabs xs = fmap tab xs
+
+tab :: Line -> Line
+tab (Line s) = Line (showString "  " . s)
diff --git a/src-internal/HsBindgen/Frontend/ProcessIncludes.hs b/src-internal/HsBindgen/Frontend/ProcessIncludes.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/ProcessIncludes.hs
@@ -0,0 +1,312 @@
+module HsBindgen.Frontend.ProcessIncludes (
+    GetMainHeadersAndInclude
+  , processIncludes
+  , GetMainHeaders
+  , toGetMainHeaders
+    -- * Auxiliary
+  , getIncludeTo
+  ) where
+
+import Control.Applicative (asum)
+import Data.Digraph qualified as Digraph
+import Data.List qualified as List
+import Data.List.Compat (unsnoc)
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Map.Strict qualified as Map
+import Data.Text qualified as Text
+import System.FilePath.Posix qualified as Posix
+
+import Clang.Enum.Simple
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types
+import Clang.LowLevel.Core
+import Clang.Paths
+
+import HsBindgen.Errors
+import HsBindgen.Frontend.Analysis.IncludeGraph (Include, IncludeGraph,
+                                                 Node (..))
+import HsBindgen.Frontend.Analysis.IncludeGraph qualified as IncludeGraph
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Process includes.
+
+  == Context
+
+  When the user invokes @hs-bindgen@, they provide us with one or more headers
+  to process; we refer to these as the "main headers". In order to process
+  these, we construct a new "root header" (see "HsBindgen.Frontend.RootHeader"),
+  which has one @#include@ per user-specified main header. For example, the root
+  header might look like
+
+  > #include <a.h>
+  > #include <b.h>
+
+  These paths must be interpreted with respect to the @C_INCLUDE_PATH@, the @-I@
+  command line options, etc.; we use 'C.HashIncludeArg' for this concept.
+
+  == Selecting declarations
+
+  When we see a declaration in the @clang@ AST, we might need to check if this
+  declaration is from one of these main headers (as opposed to a header
+  /included by/ one of the main headers). Unfortunately, @clang@ does not
+  give us a 'C.HashIncludeArg' for the declaration, but rather a 'SourcePath'.
+  The exact nature of this 'SourcePath' is a @clang@ internal detail, but it
+  might for example be @/the/full/path/to/b.h@.
+
+  In this example, we then /know/ that the set of main headers is @<a.h>@ and
+  @<b.h>@, and we need to check if the 'SourcePath' @/the/full/path/to/b.h@
+  happens to correspond to one of these main headers. Simply comparing the
+  @basename@ is insufficient: it's entirely possible that for example both @b.h@
+  and @internal/b.h@ exist in the library (or indeed, this particular @b.h@
+  might be from a different library altogether).
+
+  Therefore we need a /mapping/ from 'C.HashIncludeArg' to 'SourcePath', at
+  least for the includes in the root header. The only reliable way that we found
+  to get this mapping is by looking at how @clang@ resolves these headers as it
+  parses the root header (there is an API specifically for resolving header
+  paths, but it does subtly different things than the @clang@ parser does).
+
+  Unfortunately, this means that we need to process all includes /prior/ to
+  processing the rest of the AST, because we are not guaranteed to see the
+  include of @b.h@ from the root header prior to processing it: this will
+  /usually/ be the case, but not if @<a.h>@ /itself/ also includes @<b.h>@.
+
+  == Setting the current main header
+
+  When we see a function declaration, we must associate that function
+  declaration with one of the main headers (so that we can generate the correct
+  @#include@ when producing code for that function). It's not entirely obvious
+  if we should use a 'C.HashIncludeArg' or a 'SourcePath' for this purpose;
+  we currently choose the former, so that we can generate the somewhat cleaner
+  lookling
+
+  > foreign import capi "b.h foo" ..
+
+  rather than
+
+  > foreign import capi "/full/path/to/b.h foo" ..
+
+  Arguably, the lattter is more correct, but the former is perhaps a little more
+  portable (although @hs-bindgen@ is in general not intended to produce portable
+  code anyway).
+
+  When we see an @#include@ in the root header, we obtain a 'RealPath' for
+  the included file (its canonical on-disk path, via 'getIncludeTo'). To
+  determine which 'C.HashIncludeArg' the directive corresponds to, we use the
+  directive's /location/ as an index into the root header rather than matching
+  on the resolved path.
+
+  (Multiple 'C.HashIncludeArg's in the root header could in principle resolve
+  to the /same/ path, so a reverse map would be ambiguous.)
+-------------------------------------------------------------------------------}
+
+-- | Function to get the main headers that (transitively) include a source path,
+-- as well as the @#include@ argument used to include the source path
+type GetMainHeadersAndInclude =
+   RealPath -> Either String (NonEmpty C.HashIncludeArg, Include)
+
+-- | Process includes
+--
+-- We do this as separate pass over the clang AST; this should be relatively
+-- cheap, as we can reuse the same 'CXTranslationUnit'.
+processIncludes ::
+     CXTranslationUnit
+  -> IO ( IncludeGraph
+        , IsMainHeader
+        , IsInMainHeaderDir
+        , GetMainHeadersAndInclude
+        , [RealPath]
+          -- ^ Canonical paths of the main headers (from the root header).
+        )
+processIncludes unit = do
+    root     <- clang_getTranslationUnitCursor unit
+    includes <- HighLevel.clang_visitChildren root $ simpleFold $ \curr -> do
+                  mKind <- fromSimpleEnum <$> clang_getCursorKind curr
+                  case mKind of
+                    Right CXCursor_InclusionDirective -> do
+                      include <- processInclude unit curr
+                      foldContinueWith include
+                    _otherwise ->
+                      foldContinue
+
+    let includeGraph :: IncludeGraph
+        includeGraph = IncludeGraph.fromList $
+          map (\incDir -> (incDir.from, incDir.include, incDir.to)) includes
+
+        mainPathPairs :: [(RealPath, C.HashIncludeArg)]
+        mainPathPairs = [
+            (incDir.to, IncludeGraph.getIncludeArg incDir.include)
+          | incDir <- includes
+          , incDir.from == RootNode
+          ]
+
+        mainPathMap :: Map RealPath C.HashIncludeArg
+        mainPathMap = Map.fromList mainPathPairs
+
+        mainPaths :: Set RealPath
+        mainPaths = Map.keysSet mainPathMap
+
+        isMainHeader :: IsMainHeader
+        isMainHeader = mkIsMainHeader mainPaths
+
+        isInMainHeaderDir :: IsInMainHeaderDir
+        isInMainHeaderDir = mkIsInMainHeaderDir mainPaths
+
+        getMainHeadersAndInclude :: GetMainHeadersAndInclude
+        getMainHeadersAndInclude path =
+          let error' msg = Left $
+                "getMainHeadersAndInclude failed for " ++ show path ++ ": "
+                  ++ msg
+          in  case IncludeGraph.getIncludes includeGraph path of
+                Digraph.FindEdgesFound startIncludes termIncludes -> Right $
+                  ( IncludeGraph.getIncludeArg <$> termIncludes
+                  , NonEmpty.head startIncludes
+                  )
+                Digraph.FindEdgesNone    -> error' "none"
+                Digraph.FindEdgesInvalid -> error' "invalid"
+
+    return (
+        includeGraph
+      , isMainHeader
+      , isInMainHeaderDir
+      , getMainHeadersAndInclude
+      , map fst mainPathPairs
+      )
+
+-- | Function to get the main headers that (transitively) include a path
+type GetMainHeaders = RealPath -> Either String (NonEmpty C.HashIncludeArg)
+
+toGetMainHeaders :: GetMainHeadersAndInclude -> GetMainHeaders
+toGetMainHeaders f = fmap fst . f
+
+{-------------------------------------------------------------------------------
+  Process inclusion directives
+-------------------------------------------------------------------------------}
+
+-- | Include directive
+--
+-- Suppose we have file @a.h@ containing
+--
+-- > #include "b.h"
+--
+-- Then
+--
+-- * 'from'    will be @HeaderNode /full/path/to/a.h@ ('RootNode' when the
+--   directive is in the root header)
+-- * 'include' will be @#include "b.h"@ (the path exactly as written in source)
+-- * 'to'      will be @/full/path/to/b.h@ (a 'RealPath' type, the canonical
+--   on-disk path, since @#include@ targets are always real files). Using the
+--   canonical path also prevents the include graph from having redundant
+--   vertices when the same physical file is reached via different paths.
+--
+-- Both paths depend on how @libclang@ resolves headers, which is affected by
+-- @-I@ command line arguments, environment variables such as
+-- @C_INCLUDE_PATH@, etc.
+data IncDir = IncDir {
+      from    :: Node
+    , include :: Include
+    , to      :: RealPath
+    }
+
+processInclude :: CXTranslationUnit -> CXCursor -> IO IncDir
+processInclude unit curr = do
+    -- The root header has no 'RealPath', so check for it before asking for one
+    incDirInRoot  <-
+      clang_Location_isFromMainFile =<< clang_getCursorLocation curr
+    incDirFrom    <- if incDirInRoot
+                       then return RootNode
+                       else HeaderNode . singleLocPath <$>
+                              HighLevel.clang_getCursorLocation' curr
+    incDirTo      <- getIncludeTo curr
+    incDirInclude <- getInclude unit curr incDirTo
+    return IncDir{
+        from    = incDirFrom
+      , include = incDirInclude
+      , to      = incDirTo
+      }
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+getIncludeTo :: (MonadIO m, HasCallStack) => CXCursor -> m RealPath
+getIncludeTo curr = do
+    file <- clang_getIncludedFile curr
+    HighLevel.clang_getRealPath file
+
+getInclude :: CXTranslationUnit -> CXCursor -> RealPath -> IO Include
+getInclude unit curr path = do
+    tokens <- HighLevel.clang_tokenize unit =<< clang_getCursorExtent curr
+    let err = "Unable to parse #include: " ++ show tokens
+    maybe (panicIO err) return $ parseInclude path tokens
+
+parseInclude :: RealPath -> [Token SourcePath TokenSpelling] -> Maybe Include
+parseInclude path = \case
+    t0 : t1 : ts2 -> do
+      guard $ isPunctuation t0 && t0 `hasSpelling` "#"
+      guard $ isIdentifier t1
+      let isIncludeNext = t1 `hasSpelling` "include_next"
+      unless isIncludeNext $ guard (t1 `hasSpelling` "include")
+      asum [
+          parseQuoteIncludeArg   isIncludeNext ts2
+        , parseBracketIncludeArg isIncludeNext ts2
+        , parseMacroIncludeArg   isIncludeNext ts2
+        ]
+    _otherwise -> Nothing
+  where
+    isIdentifier, isLiteral, isPunctuation :: Token p a -> Bool
+    isIdentifier  = (== Right CXToken_Identifier)  . fromSimpleEnum . tokenKind
+    isLiteral     = (== Right CXToken_Literal)     . fromSimpleEnum . tokenKind
+    isPunctuation = (== Right CXToken_Punctuation) . fromSimpleEnum . tokenKind
+
+    hasSpelling :: Token p TokenSpelling -> Text -> Bool
+    hasSpelling = (==) . (getTokenSpelling . tokenSpelling)
+
+    parseQuoteIncludeArg :: Bool -> [Token p TokenSpelling] -> Maybe Include
+    parseQuoteIncludeArg isIncludeNext = \case
+      -- Quote include arguments are parsed as literals
+      [t] -> do
+        guard $ isLiteral t
+        let s = Text.unpack $ getTokenSpelling (tokenSpelling t)
+        (cL, s1) <- List.uncons s
+        guard $ cL == '"'
+        (s', cR) <- unsnoc s1
+        guard $ cR == '"'
+        let (_, arg) = C.hashIncludeArg s'
+        return $
+          if isIncludeNext
+            then IncludeGraph.QuoteIncludeNext arg
+            else IncludeGraph.QuoteInclude     arg
+      _otheriwse -> Nothing
+
+    parseBracketIncludeArg :: Bool -> [Token p TokenSpelling] -> Maybe Include
+    parseBracketIncludeArg isIncludeNext = \case
+      -- Bracket include arguments are parsed using punctuation
+      t2 : ts3 -> do
+        guard $ isPunctuation t2 && t2 `hasSpelling` "<"
+        (ts, tR) <- unsnoc ts3
+        guard $ isPunctuation tR && tR `hasSpelling` ">"
+        -- ts may contain many token kinds, not just identifier/punctuation
+        let (_, arg) = C.hashIncludeArg $
+              concatMap (Text.unpack . getTokenSpelling . tokenSpelling) ts
+        return $
+          if isIncludeNext
+            then IncludeGraph.BracketIncludeNext arg
+            else IncludeGraph.BracketInclude     arg
+      [] -> Nothing
+
+    parseMacroIncludeArg :: Bool -> [Token p TokenSpelling] -> Maybe Include
+    parseMacroIncludeArg isIncludeNext = \case
+      -- Macro include should have at least one argument
+      [] -> Nothing
+      ts -> do
+        let (_, arg) = C.hashIncludeArg $
+              Posix.takeFileName (getRealPath path)
+            macroArg = mconcat $ map (getTokenSpelling . tokenSpelling) ts
+        return $
+          if isIncludeNext
+            then IncludeGraph.MacroIncludeNext arg macroArg
+            else IncludeGraph.MacroInclude     arg macroArg
diff --git a/src-internal/HsBindgen/Frontend/RootHeader.hs b/src-internal/HsBindgen/Frontend/RootHeader.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/RootHeader.hs
@@ -0,0 +1,102 @@
+-- | Root header (header that includes all headers to be processed)
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Frontend.RootHeader (RootHeader)
+-- > import HsBindgen.Frontend.RootHeader qualified as RootHeader
+module HsBindgen.Frontend.RootHeader (
+    -- * RootHeader
+    RootHeader -- opaque
+  , fromRootDirectives
+    -- ** Generation
+  , name
+  , content
+    -- ** Query
+  , isRootHeaderPath
+  , isInRootHeader
+    -- ** Trace message
+  , RootHeaderMsg(..)
+  ) where
+
+import Prelude hiding (lookup)
+
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.HighLevel.Types (MultiLoc (multiLocExpansion),
+                              SingleLoc (singleLocPath))
+import Clang.Paths
+
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  RootHeader
+-------------------------------------------------------------------------------}
+
+-- | Abstract representation of the root header
+--
+-- This is /precisely/ the list of root directives as specified by the user.
+newtype RootHeader = RootHeader [C.RootDirective C.HashIncludeArg]
+
+-- | Construct a t'RootHeader', returning trace messages
+fromRootDirectives ::
+     [C.RootDirective C.HashIncludeArg]
+  -> ([RootHeaderMsg], RootHeader)
+fromRootDirectives directives = (msgs, RootHeader directives)
+  where
+    -- Without a header there is nothing to generate bindings for. This is the
+    -- single check: every way of using @hs-bindgen@ builds the root header here.
+    msgs :: [RootHeaderMsg]
+    msgs = [RootHeaderNoHashInclude | null (C.hashIncludeArgsOf directives)]
+
+{-------------------------------------------------------------------------------
+  Generation
+-------------------------------------------------------------------------------}
+
+-- | Root header @UnsavedFile@ name
+name :: SourcePath
+name = C.rootHeaderName
+
+-- | Root header content
+--
+-- The content contains one directive per line, in order, with no extra lines.
+-- The very same rendering is prepended to the generated CAPI wrapper source and
+-- to the generated C test source, so that all C stages agree.
+content :: RootHeader -> String
+content (RootHeader directives) = C.renderRootDirectives directives
+
+{-------------------------------------------------------------------------------
+  Query
+-------------------------------------------------------------------------------}
+
+-- | Check if the specified path is the root header
+--
+-- Takes a 'SourcePath' because it is used with Clang diagnostics, which
+-- report locations as 'SourcePath' (not 'RealPath').
+isRootHeaderPath :: SourcePath -> Bool
+isRootHeaderPath = (== name)
+
+-- | Check if the given location is in the root header
+isInRootHeader :: MultiLoc SourcePath -> Bool
+isInRootHeader = isRootHeaderPath . singleLocPath . multiLocExpansion
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+-- | Root header trace message
+data RootHeaderMsg =
+    RootHeaderNoHashInclude
+  deriving stock (Show)
+
+instance PrettyForTrace RootHeaderMsg where
+  prettyForTrace = \case
+    RootHeaderNoHashInclude ->
+      PP.string "no #include root directive: nothing to generate bindings for"
+
+instance IsTrace Level RootHeaderMsg where
+  -- A warning, not an error: hs-bindgen runs to completion, and no declarations
+  -- is the correct result for a root header with no @#include@.
+  getDefaultLogLevel = const Warning
+  getSource          = const HsBindgen
+  getTraceId         = const "root-header"
diff --git a/src-internal/HsBindgen/Frontend/TranslationUnit.hs b/src-internal/HsBindgen/Frontend/TranslationUnit.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Frontend/TranslationUnit.hs
@@ -0,0 +1,72 @@
+-- Intended for qualified import
+--
+-- @
+-- import HsBindgen.Frontend.TranslationUnit qualified as C
+-- @
+module HsBindgen.Frontend.TranslationUnit (
+    TranslationUnit(..)
+  ) where
+
+import HsBindgen.Frontend.Analysis.IncludeGraph (IncludeGraph)
+import HsBindgen.Frontend.DeclMeta
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Macro.Type qualified as Macro
+
+-- | Information we collect from a C translation unit.
+--
+-- The macro language parameter @l@ describes how C macros are parsed,
+-- typechecked, and translated (see "HsBindgen.Macro.Type" and
+-- "HsBindgen.Macro.Interface").
+--
+-- The pass parameter @p@ describes how the data types evolve along passes in
+-- the frontend in a "trees that grow" (TTG) style.
+data TranslationUnit l p = TranslationUnit{
+      -- | Declarations in the unit
+      --
+      -- Declarations from all headers that we have processed. Passes may remove
+      -- some declarations. For example,
+      --
+      -- * The 'HsBindgen.Frontend.Pass.Parse.IsPass.Parse' pass filters out declarations not matching the selection
+      --   predicate (without program slicing).
+      --
+      -- * If program slicing is enabled, the @Select@ pass filters selected
+      --   declarations and their transitive dependencies.
+      --
+      -- * The 'HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass.ResolveBindingSpecs' pass removes declarations for which we have
+      --   existing external bindings, as well as declarations omitted by a
+      --   prescriptive binding specification.
+      decls :: [C.Decl l p]
+
+      -- | Include graph
+      --
+      -- This is used to declare TH dependencies.
+      --
+      -- It can also be useful for users to see this graph, as it may provide
+      -- insight into the binding generation process. For example, suppose we
+      -- have a large library (say Gtk), with a few main entry points (for which
+      -- we should generate separate Haskell modules) and a core of "common"
+      -- definitions; it may be quite useful to look at the include graph to
+      -- figure out what this set of "core" headers is.
+    , includeGraph :: IncludeGraph
+
+      -- | Pass-specific annotation
+    , meta :: DeclMeta l
+    }
+  deriving stock (Generic)
+
+deriving stock instance ( IsPass p
+                        , Macro.HasTypes l
+                        ) => Show (TranslationUnit l p)
+
+instance (
+      CoercePass (C.Decl l) p p'
+    , Ann "TranslationUnit" p ~ Ann "TranslationUnit" p'
+    ) => CoercePass (TranslationUnit l) p p' where
+  coercePass unit = TranslationUnit{
+        decls        = map coercePass unit.decls
+      , includeGraph = unit.includeGraph
+      , meta         = unit.meta
+      }
+
diff --git a/src-internal/HsBindgen/Guasi.hs b/src-internal/HsBindgen/Guasi.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Guasi.hs
@@ -0,0 +1,164 @@
+{-# LANGUAGE CPP #-}
+
+module HsBindgen.Guasi (
+    Guasi (..)
+  , putLocalDocM
+  , putLocalDocTermName
+  , putLocalDocTermNameM
+    -- * State
+  , GuasiState(..)
+  , emptyGuasiState
+  ) where
+
+import Data.Set qualified as Set
+import Data.Text qualified as Text
+import Language.Haskell.TH qualified as TH
+import Language.Haskell.TH.Syntax qualified as TH
+import Text.SimplePrettyPrint (pretty)
+
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.HsModule.Pretty.Comment (CommentKind (..))
+import HsBindgen.Backend.UniqueSymbol
+import HsBindgen.Config (FieldNamingStrategy (..))
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+
+-- | An intermediate class between 'TH.Quote' and 'TH.Quasi'
+-- which doesn't provide reification functionality of 'TH.Quasi',
+-- but has a bit more than 'TH.Quote'.
+class TH.Quote g => Guasi g where
+    getGuasi :: g GuasiState
+    putGuasi :: GuasiState -> g ()
+    modifyGuasi :: (GuasiState -> GuasiState) -> g ()
+    modifyGuasi f = getGuasi >>= putGuasi . f
+
+    addCSource :: String -> g ()
+    addDependentFile :: FilePath -> g ()
+
+    extsEnabled :: g [TH.Extension]
+
+    -- | Look up a name in the type namespace of the environment.
+    --
+    -- Returns 'Nothing' if the name is not in scope.
+    lookupTypeName :: String -> g (Maybe TH.Name)
+
+    reportError :: String -> g ()
+
+    -- | Attach a documentation to a declaration with provided name /in the
+    --   current module/.
+    --
+    -- Ideally we'd use @withDecDoc@ instead, but this gets confused by existing
+    -- functions in scope <https://gitlab.haskell.org/ghc/ghc/-/issues/26817>.
+    putLocalDoc :: forall ns. Hs.SingNamespace ns => Hs.Name ns -> HsDoc.Comment -> g ()
+    -- | Attach a documentation to a field of a parent declaration /in the
+    --   current module/.
+    --
+    -- We handle documentation for fields in a special way because with
+    -- duplicate record fields, Template Haskell gets confused, reporting
+    -- "ambiguous occurrence" errors.
+    putLocalFieldDoc ::
+      FieldNamingStrategy -> Hs.Name Hs.NsConstr -> Hs.Name Hs.NsVar -> HsDoc.Comment -> g ()
+
+putLocalDocM ::
+     forall ns g. (Hs.SingNamespace ns, Guasi g)
+  => Hs.Name ns
+  -> Maybe HsDoc.Comment
+  -> g ()
+putLocalDocM nm = traverse_ (putLocalDoc nm)
+
+-- | Like 'putLocalDoc' but for 'Hs.TermName', which may be either an exported
+-- 'Hs.Name Hs.NsVar' or an internal unique symbol.
+putLocalDocTermName ::
+     Guasi g
+  => Hs.TermName
+  -> HsDoc.Comment
+  -> g ()
+putLocalDocTermName nm comment = putLocalDoc (toVarName nm) comment
+  where
+    toVarName :: Hs.TermName -> Hs.Name Hs.NsVar
+    toVarName (Hs.ExportedName n) = n
+    -- The 'Hs.UnsafeName' conversion is safe here: 'Hs.UniqueSymbol' names are
+    -- generated by @hs-bindgen@ and are always valid Haskell identifiers.
+    toVarName (Hs.InternalName s) = Hs.UnsafeName (Text.pack s.unique)
+
+putLocalDocTermNameM ::
+     Guasi g
+  => Hs.TermName
+  -> Maybe HsDoc.Comment
+  -> g ()
+putLocalDocTermNameM nm = traverse_ (putLocalDocTermName nm)
+
+data GuasiState = GuasiState {
+      missingModules :: Set Hs.ModuleName
+    }
+    deriving (Eq, Show, Generic)
+
+emptyGuasiState :: GuasiState
+emptyGuasiState = GuasiState { missingModules = Set.empty }
+
+instance Guasi TH.Q where
+    getGuasi = fromMaybe emptyGuasiState <$> TH.getQ
+    putGuasi = TH.putQ
+
+    addCSource = TH.addForeignSource TH.LangC
+    addDependentFile = TH.addDependentFile
+
+    extsEnabled = TH.extsEnabled
+
+    lookupTypeName = TH.lookupTypeName
+
+    reportError = TH.reportError
+
+    putLocalDoc :: forall ns. Hs.SingNamespace ns => Hs.Name ns -> HsDoc.Comment -> TH.Q ()
+    putLocalDoc nm comment = do
+        loc <- TH.location
+        let pkg = TH.PkgName $ TH.loc_package loc
+            mdl = TH.ModName $ TH.loc_module loc
+            globalName :: TH.Name
+            globalName = TH.Name
+              (TH.OccName (Hs.nameToStr nm))
+              (TH.NameG thNs pkg mdl)
+        -- NOTE: Finalizers run in LIFO order, which contributes to Haddock
+        -- showing TH-generated declarations in reverse. If this finalizer usage
+        -- is ever removed, revisit the reversal workaround in TH.Internal.
+        TH.addModFinalizer $
+          TH.putDoc (TH.DeclDoc globalName) (show $ pretty $ THComment comment)
+      where
+        thNs :: TH.NameSpace
+        thNs = case Hs.namespaceOf (Hs.singNamespace @ns) of
+                 Hs.NsVar        -> TH.VarName
+                 Hs.NsConstr     -> TH.DataName
+                 Hs.NsTypeConstr -> TH.TcClsName
+
+#if __GLASGOW_HASKELL__ >=908
+    -- Here we have to go out of the way. We need to rigurously disambiguate
+    -- field names when attaching documentation to fields without prefixes
+    -- (`--omit-field-prefixes`). However, we can only do so with
+    -- `template-haskell >= 2.21`, shipping with GHC 9.8.
+    putLocalFieldDoc _fns parent field comment = do
+        loc <- TH.location
+        let pkg = TH.PkgName $ TH.loc_package loc
+            mdl = TH.ModName $ TH.loc_module loc
+            globalName :: TH.Name
+            globalName = TH.Name
+              (TH.OccName fieldStr)
+              (TH.NameG thNs pkg mdl)
+        -- NOTE: See comment in 'putLocalDoc' about finalizer ordering.
+        TH.addModFinalizer $
+          TH.putDoc (TH.DeclDoc globalName) (show $ pretty $ THComment comment)
+      where
+        fieldStr, parentStr :: String
+        fieldStr  = Hs.nameToStr field
+        parentStr = Hs.nameToStr parent
+
+        thNs :: TH.NameSpace
+        thNs = TH.FldName parentStr
+#else
+    -- For older versions of GHC, we only provide field documentation when
+    -- fields are prefixed and have unique names.
+    putLocalFieldDoc fns _parent field comment =
+        case fns of
+          OmitFieldPrefixes -> pure ()
+          AddFieldPrefixes  -> putLocalDoc field comment
+#endif
diff --git a/src-internal/HsBindgen/IR/C.hs b/src-internal/HsBindgen/IR/C.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C.hs
@@ -0,0 +1,32 @@
+-- | C AST
+--
+-- From outside the @HsBindgen.IR@ hierarchy, this module should always be used,
+-- /not/ submodules.  Submodules need to be used within the @HsBindgen.IR@
+-- hierarchy to avoid import cycles.
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.IR.C qualified as C
+module HsBindgen.IR.C (
+    module HsBindgen.IR.C.Conflict
+  , module HsBindgen.IR.C.Decl
+  , module HsBindgen.IR.C.DeclPath
+  , module HsBindgen.IR.C.HashDefine
+  , module HsBindgen.IR.C.HashIncludeArg
+  , module HsBindgen.IR.C.LocationInfo
+  , module HsBindgen.IR.C.Naming
+  , module HsBindgen.IR.C.PrettyPrinter
+  , module HsBindgen.IR.C.RootDirective
+  , module HsBindgen.IR.C.Type
+  ) where
+
+import HsBindgen.IR.C.Conflict
+import HsBindgen.IR.C.Decl
+import HsBindgen.IR.C.DeclPath
+import HsBindgen.IR.C.HashDefine
+import HsBindgen.IR.C.HashIncludeArg
+import HsBindgen.IR.C.LocationInfo
+import HsBindgen.IR.C.Naming
+import HsBindgen.IR.C.PrettyPrinter
+import HsBindgen.IR.C.RootDirective
+import HsBindgen.IR.C.Type
diff --git a/src-internal/HsBindgen/IR/C/Conflict.hs b/src-internal/HsBindgen/IR/C/Conflict.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/Conflict.hs
@@ -0,0 +1,103 @@
+-- | Conflicting C declarations
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.Conflict qualified as C
+module HsBindgen.IR.C.Conflict (
+    Conflict
+    -- * Construction
+  , conflictBetween
+  , conflictInsert
+  , conflictFromList
+    -- * Query
+  , conflictToList
+  , conflictGetMinimumLoc
+  ) where
+
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Set qualified as Set
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Imports
+import HsBindgen.IR.C.DeclPath qualified as C
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Multiple declarations for the same identifier
+--
+-- Two declarations are in conflict, if we cannot disambiguate between them in
+-- C.
+--
+-- Conflicts can arise:
+--
+-- - macro vs macro (macros can be redefined)
+--
+-- - macro vs ordinary
+--
+-- - Clang-generated collision between a named tagged declaration and an
+--   named untagged declaration
+--
+--   For example,
+--
+--   @
+--   struct foo { ... };
+--   typedef struct { ... } foo;
+--   @
+--
+-- Invariant: the 'Set' must have cardinality of 2 or larger.
+data Conflict = Conflict {
+      locs :: Set (SingleLoc C.DeclPath)
+    }
+  deriving stock (Eq, Ord, Show)
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+conflictBetween :: SingleLoc C.DeclPath -> SingleLoc C.DeclPath -> Conflict
+conflictBetween l1 l2 = Conflict $ Set.fromList [l1, l2]
+
+conflictInsert :: Conflict -> SingleLoc C.DeclPath -> Conflict
+conflictInsert (Conflict xs) x = Conflict $ Set.insert x xs
+
+-- | Precondition: The length of the list must be 2 or longer.
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1577>
+conflictFromList :: [SingleLoc C.DeclPath] -> Conflict
+conflictFromList ls = Conflict $ Set.fromList ls
+
+{-------------------------------------------------------------------------------
+  Query
+-------------------------------------------------------------------------------}
+
+conflictToList :: Conflict -> NonEmpty (SingleLoc C.DeclPath)
+ -- 'NonEmpty.fromList' safe due to invariant.
+conflictToList conflict = NonEmpty.fromList $ Set.toList conflict.locs
+
+-- | Attempts to get the “minimum” location.
+--
+-- This is only meaningful if the locations share the same source path.
+-- Comparisons across source paths happen in lexicographical order.
+conflictGetMinimumLoc :: Conflict -> SingleLoc C.DeclPath
+ -- 'minimum' safe due to invariant.
+conflictGetMinimumLoc conflict = minimum conflict.locs
+
+{-------------------------------------------------------------------------------
+  Tracing
+-------------------------------------------------------------------------------}
+
+instance PrettyForTrace Conflict where
+  prettyForTrace conflict =
+      PP.hangs' ("Conflicting declarations") 2 [
+          PP.vcat [PP.string $ "- " ++ show l | l <- Set.toList conflict.locs]
+        , "No binding generated."
+        ]
diff --git a/src-internal/HsBindgen/IR/C/Decl.hs b/src-internal/HsBindgen/IR/C/Decl.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/Decl.hs
@@ -0,0 +1,846 @@
+-- | C declarations
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.Decl qualified as C
+module HsBindgen.IR.C.Decl (
+    -- * Declarations
+    Decl(..)
+  , Availability(..)
+  , EnclosingRef(..)
+  , DeclInfo(..)
+  , DeclOrigin(..)
+  , HeaderInfo(..)
+  , FieldInfo(..)
+  , DeclKind(..)
+  , OpaqueSize(..)
+  , Struct(..)
+  , Flam(..)
+  , flamStructField
+  , traverseFlamField
+  , mapFlamField
+  , Union(..)
+
+  , Typedef(..)
+  , Enum(..)
+  , EnumConstant(..)
+  , UntaggedEnumConstant(..)
+  , Function(..)
+  , FunctionArg(..)
+  , typeOfFunction
+  , typeOfFunctionArg
+  , FunctionAttributes(..)
+  , FunctionPurity(..)
+  , decideFunctionPurity
+  , Global(..)
+    -- ** Fields
+  , Field(..)
+  , mapField
+  , mapMField
+  , elimField
+  , RegularField(..)
+  , ImplicitField(..)
+  , IndirectField(..)
+    -- ** Comments
+  , Comment(..)
+  , CommentRef(..)
+  ) where
+
+import Prelude hiding (Enum)
+import Prelude qualified as P
+
+import GHC.Records (HasField (getField))
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Imports
+import HsBindgen.IR.C.DeclPath qualified as C
+import HsBindgen.IR.C.HashIncludeArg qualified as C
+import HsBindgen.IR.C.Naming qualified as C
+import HsBindgen.IR.C.Type qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.IR.Pass.Types (CoercePassAnonRef (coercePassAnonRef))
+import HsBindgen.Language.C (PrimType)
+import HsBindgen.Macro.Type qualified as Macro
+
+import Doxygen.Parser.Types qualified as Doxy
+
+{-------------------------------------------------------------------------------
+  Declarations
+
+  NOTE: Struct and union fields, as well as enum constants, have their /own/
+  'SingleLoc' (in addition to the 'SingleLoc' of the enclosing declaration).
+-------------------------------------------------------------------------------}
+
+data Decl l (p :: Pass) = Decl {
+      info :: DeclInfo p
+    , kind :: DeclKind l p
+    , ann  :: Ann "Decl" p
+    }
+  deriving stock (Generic)
+
+-- | Availability of declarations.
+--
+-- See 'Clang.LowLevel.Core.CXAvailabilityKind'.
+data Availability =
+    -- | Available and recommended for use
+    Available
+    -- | Available but deprecated; may result in compilation error
+  | Deprecated
+    -- | Unavailable or unaccessible; results in compilation error
+  | Unavailable
+  deriving stock (Bounded, Eq, Generic, Ord, P.Enum, Show)
+
+-- | Reference to enclosing declaration
+data EnclosingRef p =
+    EnclosingRef (Id p)
+  | UnusableEnclosingRef C.DeclId
+
+deriving stock instance (Eq   (Id p)) => Eq   (EnclosingRef p)
+deriving stock instance (Ord  (Id p)) => Ord  (EnclosingRef p)
+deriving stock instance (Show (Id p)) => Show (EnclosingRef p)
+
+data DeclInfo (p :: Pass) = DeclInfo{
+      loc           :: SingleLoc C.DeclPath
+    , id            :: Id p
+    -- | Source order index
+    --
+    -- The position of this declaration in /source order/ (roughly, how
+    -- declarations appear in the C source; see the ordering definitions in
+    -- "HsBindgen.Frontend.Pass.Parse"), starting at 0. Declarations with a
+    -- lower index come before those with a higher index. Populated only with
+    -- Clang version 20.1 or newer; 'Nothing' otherwise.
+    , sourceOrderIndex :: Maybe Natural
+    , origin        :: DeclOrigin
+    , availability  :: Availability
+    , comment       :: CommentDecl p
+      -- ^ Doxygen comment for this declaration
+      --
+      -- Pre-'HsBindgen.Frontend.Pass.EnrichComments.IsPass.EnrichComments'
+      -- passes have @CommentDecl p = ()@: the type system guarantees comments
+      -- cannot exist. Post-@EnrichComments@ passes have
+      -- @CommentDecl p = Maybe (Comment p)@.
+    , enclosing :: [EnclosingRef p]
+      -- ^ List of enclosing declarations, if this declaration is nested.
+      --
+      -- Set during parsing for declarations nested inside another declaration
+      -- (e.g., tagged, untagged, or anonymous structs\/unions inside an enclosing
+      -- struct\/union). Empty for top-level declarations.
+      --
+      -- Used by 'EnrichComments' to build doxygen-qualified names and look up
+      -- enclosing field comments in the doxygen state.
+    }
+  deriving stock (Generic)
+
+-- | Where a declaration comes from
+data DeclOrigin =
+    -- | A header, possibly included transitively by a main header
+    FromHeader HeaderInfo
+
+    -- | A @#define@ root directive (see "HsBindgen.Frontend.RootHeader")
+  | FromRootDirective
+
+    -- | A @-D@ Clang option
+  | FromCommandLine
+  deriving stock (Show, Eq, Generic)
+
+data HeaderInfo = HeaderInfo{
+      -- | User-specified headers that provide the declaration
+      --
+      -- Note that the declaration may not be in this header directly, but in
+      -- one of its (transitive) includes.
+      mainHeaders :: NonEmpty C.HashIncludeArg
+
+      -- | @#include@ argument used to include the file where the declaration is
+      -- actually declared
+    , includeArg :: C.HashIncludeArg
+
+      -- | Raw macro used as a @#include@ argument, when applicable
+      --
+      -- For example, @#include FOO@ would record the macro text @FOO@ here.
+    , includeMacroArg :: Maybe Text
+    }
+  deriving stock (Show, Eq, Generic)
+
+data FieldInfo (p :: Pass) = FieldInfo {
+      loc     :: SingleLoc C.DeclPath
+    , name    :: ScopedName p
+    , comment :: CommentDecl p
+    }
+  deriving stock (Generic)
+
+data DeclKind l p =
+    DeclStruct (Struct p)
+  | DeclUnion (Union p)
+  | DeclTypedef (Typedef p)
+  | DeclEnum (Enum p)
+    -- | Untagged Enum Constant
+    --
+    -- Represents individual constants from an untagged enum (e.g., @enum { FOO, BAR }@)
+    -- as separate pattern synonym declarations.
+  | DeclUntaggedEnumConstant (UntaggedEnumConstant p)
+    -- | Opaque type
+    --
+    -- When parsing, a C @struct@, @union@, or @enum@ may be opaque.  Users may
+    -- specify any kind of type to be opaque using a prescriptive binding
+    -- specification, however, including @typedef@ types.
+    --
+    -- The size and alignment are retained when known (i.e. when a /complete/ C
+    -- type is given the @emptydata@ representation), and 'Nothing' when the type
+    -- is genuinely opaque in C (e.g. a forward declaration).
+  | DeclOpaque (Maybe OpaqueSize)
+  | DeclMacro (MacroBody p l)
+  | DeclFunction (Function p)
+    -- | A global variable, whether it be declared @extern@, @static@ or neither.
+  | DeclGlobal (Global p)
+
+-- | Size and alignment of an opaque type, when known
+--
+-- A complete C type given the @emptydata@ representation retains its size and
+-- alignment here, which is what enables generating a @StaticSize@ instance for
+-- the otherwise field-less Haskell type.
+data OpaqueSize = OpaqueSize {
+      sizeof    :: Int
+    , alignment :: Int
+    }
+  deriving stock (Show, Eq, Generic)
+
+data Struct (p :: Pass) = Struct {
+      sizeof    :: Int
+    , alignment :: Int
+    , fields    :: [Field p]
+    , flam      :: Flam p
+    , ann       :: Ann "Struct" p
+    }
+  deriving stock (Generic)
+
+-- | The flexible array member (FLAM) of a struct, if any
+--
+-- A C struct may end in a flexible array member, e.g.
+--
+-- > struct foo { size_t len; char data[]; };
+--
+-- When a FLAM is present we generate an auxiliary type for the struct, and the
+-- 'Flam' constructor bundles the element-type field together with the auxiliary
+-- type-constructor name that code generation requires. That name is only
+-- available once the name mangler has run (it is 'NoAnn' at earlier passes), so
+-- carrying it /inside/ the constructor ties name creation to the FLAM itself:
+-- the backend can never disagree with the name mangler over whether a name was
+-- minted (see <https://github.com/well-typed/hs-bindgen/issues/1925>).
+data Flam (p :: Pass) =
+    NoFlam
+  | Flam (RegularField p) (Ann "Flam" p)
+  deriving stock (Generic)
+
+-- | The element-type field of a FLAM, if present
+flamStructField :: Flam p -> Maybe (RegularField p)
+flamStructField = \case
+    NoFlam   -> Nothing
+    Flam f _ -> Just f
+
+-- | Traverse the element-type field of a FLAM, preserving its annotation
+traverseFlamField ::
+     (Applicative f, Ann "Flam" p ~ Ann "Flam" p')
+  => (RegularField p -> f (RegularField p'))
+  -> Flam p
+  -> f (Flam p')
+traverseFlamField f = \case
+    NoFlam       -> pure NoFlam
+    Flam fld ann -> (\fld' -> Flam fld' ann) <$> f fld
+
+-- | Map over the element-type field of a FLAM, preserving its annotation
+mapFlamField ::
+     (Ann "Flam" p ~ Ann "Flam" p')
+  => (RegularField p -> RegularField p')
+  -> Flam p
+  -> Flam p'
+mapFlamField f = \case
+    NoFlam       -> NoFlam
+    Flam fld ann -> Flam (f fld) ann
+
+data Union (p :: Pass) = Union {
+      sizeof    :: Int
+    , alignment :: Int
+    , fields    :: [Field p]
+    , ann       :: Ann "Union" p
+    }
+  deriving stock (Generic)
+
+data Typedef (p :: Pass) = Typedef {
+      typ :: Types p
+    , ann :: Ann "Typedef" p
+    }
+  deriving stock (Generic)
+
+data Enum (p :: Pass) = Enum {
+      typ       :: Types p
+    , sizeof    :: Int
+    , alignment :: Int
+    , constants :: [EnumConstant p]
+    , ann       :: Ann "Enum" p
+    }
+  deriving stock (Generic)
+
+data EnumConstant (p :: Pass) = EnumConstant {
+      info  :: FieldInfo p
+    , value :: Integer
+    }
+  deriving stock (Generic)
+
+-- | Untagged Enum Constant
+--
+-- This represents an untagged enum constant (e.g., from @enum { FOO, BAR }@)
+-- that will be rendered as a pattern synonym in Haskell (e.g., @pattern fOO :: CUInt@)
+data UntaggedEnumConstant (p :: Pass) = UntaggedEnumConstant {
+      typ       :: PrimType
+    , constant  :: EnumConstant p
+    }
+  deriving stock (Generic)
+
+data Function (p :: Pass) = Function {
+      args  :: [FunctionArg p]
+    , res   :: Types p
+    , attrs :: FunctionAttributes
+    , ann   :: Ann "Function" p
+    }
+  deriving stock (Generic)
+
+-- | Function argument
+--
+-- Separate types are used to represent function arguments in declarations and
+-- function arguments in types ('HsBindgen.IR.C.Type.TypeFunArg').
+--
+-- * An argument in a declaration may have a name, while type arguments do not
+--   have names.
+-- * We translate declaration arguments to Haskell, while recursively
+--   translating type arguments is not necessary.
+--
+-- Both of these types use the @TypeFunArg@ annotation, however.
+data FunctionArg (p :: Pass) = FunctionArg {
+      name :: Maybe (ScopedName p)
+    , typ  :: Types p
+    , ann  :: Ann "TypeFunArg" p
+    }
+    deriving stock (Generic)
+
+-- | Get the type of a function declaration
+typeOfFunction :: forall p. PassTypes p => Function p -> C.Type p
+typeOfFunction fun =
+    C.TypeFun (map typeOfFunctionArg fun.args) (cType (Proxy @p) fun.res)
+
+-- | Get the type of a function argument
+typeOfFunctionArg :: forall p. PassTypes p => FunctionArg p -> C.TypeFunArg p
+typeOfFunctionArg functionArg =
+    C.TypeFunArgF{
+        typ = cType (Proxy @p) functionArg.typ
+      , ann = functionArg.ann
+      }
+
+-- | Function attributes specify properties for C functions
+--
+-- Function attributes may help the C compiler. In addition, @hs-bindgen@ can in
+-- some cases modify the bindings it generates based on these function
+-- attributes.
+--
+-- This type is an interpretation of the syntactic function attributes that are
+-- put on C functions. For example, a C function can have multiple @pure@
+-- and\/or @const@ attributes, but we interpret these attributes together as a
+-- 'FunctionPurity', see 'decideFunctionPurity'.
+data FunctionAttributes = FunctionAttributes {
+      purity :: FunctionPurity
+    }
+  deriving stock (Eq, Generic, Ord, Show)
+
+-- | The diagnosed purity of a C function determines whether to include 'IO' in
+-- its foreign import.
+data FunctionPurity =
+    -- | C functions that are impure in the Haskell sense of the word.
+    --
+    -- C functions without a @const@ or @pure@ function attribute are
+    -- Haskell-impure. They do not guarantee to return the same output for the
+    -- same inputs. Foreign imports of such Haskell-impure functions can /not/
+    -- omit the 'IO' in their return type.
+    ImpureFunction
+    -- | C functions that are pure in the Haskell sense of the word.
+    --
+    -- C functions with a @const@ function attribute are Haskell-pure. They
+    -- always return the same output for the same inputs. Foreign imports of
+    -- such Haskell-pure C functions can omit the 'IO' in their return type.
+    --
+    -- > int square (int) __attribute__ ((const));
+    --
+    -- As far as the @hs-bindgen@ authors are aware, @clang@\/@gcc@ do /not
+    -- always/ diagnose whether C functions with a @const@ attribute satisfy all
+    -- the requirements imposed by the attribute. If a C function has a @const@
+    -- attribute when it should not, then it is arguably a bug in the C library
+    -- and not in @hs-bindgen@.
+    --
+    -- If C functions have both @const@ and @pure@ attributes, then we always
+    -- pick @const@ over @pure@, because @const@ is the stronger attribute of
+    -- the two.
+    --
+    -- <https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute>
+  | HaskellPureFunction
+    -- | C functions that are pure in the C sense of the word.
+    --
+    -- C functions with a @pure@ function attribute are C-pure. C-pure is
+    -- different from Haskell-pure, in that C-pure functions only return the
+    -- same output for the same input as long as the /the state of the program
+    -- observable by the C function did not change/. In the @hash@ example
+    -- below, the observable state includes the contents of the input array
+    -- itself. Such C-pure functions may read from pointers, and since the
+    -- contents of pointers can change between invocations of the function,
+    -- foreign imports of such C-pure C functions can /not/ omit the 'IO' in
+    -- their return type.
+    --
+    -- > int hash (char *) __attribute__ ((pure));
+    --
+    -- Note that uses of a C-pure function can sometimes be safely encapsulated
+    -- with @unsafePerformIO@ to obtain a Haskell-pure function. For example:
+    --
+    -- > unsafePerformIO $ withCString "abc" hash
+    --
+    -- As far as the @hs-bindgen@ authors are aware, @clang@\/@gcc@ do /not
+    -- always/ diagnose whether C functions with a @pure@ attribute satisfy all
+    -- the requirements imposed by the attribute. If a C function has a @pure@
+    -- attribute when it should not, then it is arguably a bug in the C library
+    -- and not in @hs-bindgen@.
+    --
+    -- If C functions have both @const@ and @pure@ attributes, then we always
+    -- pick @const@ over @pure@, because @const@ is the stronger attribute of
+    -- the two.
+    --
+    -- <https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute>
+  | CPureFunction
+  deriving stock (Eq, Generic, Ord, Show)
+
+decideFunctionPurity :: [FunctionPurity] -> FunctionPurity
+decideFunctionPurity = foldr prefer ImpureFunction
+  where
+    prefer HaskellPureFunction _                   = HaskellPureFunction
+    prefer _                   HaskellPureFunction = HaskellPureFunction
+    prefer CPureFunction       _                   = CPureFunction
+    prefer _                   CPureFunction       = CPureFunction
+    prefer _                   _                   = ImpureFunction
+
+    -- In case we add new constructors, this case expression throsw a compiler
+    -- error, which should hopefully indicate to the reader that
+    -- 'decideFunctionPurity' has to be updated.
+    _coveredAllCases' = \case
+      ImpureFunction -> ()
+      HaskellPureFunction -> ()
+      CPureFunction -> ()
+
+data Global (p :: Pass) = Global {
+      typ :: Types p
+    , ann :: Ann "Global" p
+    }
+  deriving stock (Generic)
+
+{-------------------------------------------------------------------------------
+  Fields
+-------------------------------------------------------------------------------}
+
+data Field p =
+    FieldRegular  (RegularField p)
+  | FieldImplicit (ImplicitField p)
+  deriving stock (Generic)
+
+instance HasField "info" (Field p) (FieldInfo p) where
+  getField = elimField (.info) (.info)
+
+instance (ty ~ Types p, PassTypes p) => HasField "typ" (Field p) ty where
+  getField = elimField (.typ) (.typ)
+
+instance HasField "offset" (Field p) Int where
+  getField = elimField (.offset) (.offset)
+
+instance HasField "width" (Field p) (Maybe Int) where
+  getField = elimField (.width) (.width)
+
+mapField ::
+     (RegularField p -> RegularField p')
+  -> (ImplicitField p -> ImplicitField p')
+  -> Field p
+  -> Field p'
+mapField f g = \case
+    FieldRegular  field -> FieldRegular  $ f field
+    FieldImplicit field -> FieldImplicit $ g field
+
+mapMField ::
+     Monad m
+  => (RegularField p -> m (RegularField p'))
+  -> (ImplicitField p -> m (ImplicitField p'))
+  -> Field p
+  -> m (Field p')
+mapMField f g = \case
+    FieldRegular  field -> FieldRegular  <$> f field
+    FieldImplicit field -> FieldImplicit <$> g field
+
+elimField :: (RegularField p -> a) -> (ImplicitField p -> a) -> Field p -> a
+elimField f g = \case
+    FieldRegular  field -> f field
+    FieldImplicit field -> g field
+
+data RegularField p = RegularField {
+      info   :: FieldInfo p
+    , typ    :: Types p
+      -- | Offset in bits
+    , offset :: Int
+    , width  :: Maybe Int
+    , ann    :: Ann "RegularField" p
+    }
+    deriving stock (Generic)
+
+data ImplicitField p = ImplicitField {
+      info     :: FieldInfo p
+      -- | Implicit fields can only refer to anonymous structs or unions
+    , typRef   :: AnonRef p
+      -- | Offset in bits
+    , offset   :: Int
+      -- | Indirect fields that go via this implicit field
+      --
+      -- Indirect fields only exist via implicit fields. This is enforced
+      -- statically by making indirect fields a sub-tree of an implicit field.
+    , indirect :: [IndirectField p]
+    , ann      :: Ann "ImplicitField" p
+    }
+    deriving stock (Generic)
+
+-- | Implicit fields can only refer to anonymous structs or unions. Use the
+-- @typRef@ field to access the reference directly.
+instance (ty ~ Types p, PassTypes p) => HasField "typ" (ImplicitField p) ty where
+  getField x = anonRefTypes (Proxy @p) x.typRef
+
+-- | Implicit fields can only refer to anonymous structs or unions, so they have
+-- no bit width.
+instance HasField "width" (ImplicitField p) (Maybe Int) where
+  getField _x = Nothing
+
+-- | An indirect field is a member of a nested anonymous struct\/union that can
+-- be accessed /as if/ it were a member of the enclosing struct\/union
+data IndirectField p = IndirectField {
+      info   :: FieldInfo p
+    , typ    :: Types p
+      -- | Offset in bits
+    , offset :: Int
+    , width  :: Maybe Int
+      -- | The path of recursively nested anonymous structs\/unions that
+      -- eventually leads to the origin of the indirect field
+      --
+      -- We use this information to query whether an indirect field crosses an
+      -- external binding spec abstraction boundary. See the
+      -- @ResolveBindingSpecs@ pass for more information.
+      --
+      -- NOTE: technically we could make this @[Id p]@ if we disallow external
+      -- references
+    , path   :: [AnonRef p]
+    , ann    :: Ann "IndirectField" p
+    }
+    deriving stock (Generic)
+
+{-------------------------------------------------------------------------------
+  Comments
+-------------------------------------------------------------------------------}
+
+newtype Comment p = Comment{
+      doxygen :: Doxy.Comment (CommentRef p)
+    }
+  deriving stock (Generic)
+
+-- | Cross-reference in a Doxygen comment
+--
+-- The 'Doxy.RefKind' from the Doxygen XML @kindref@ attribute narrows the
+-- search in 'HsBindgen.Frontend.Pass.MangleNames.IsPass.MangleNames': compounds
+-- (struct\/union) are looked up in the type constructor namespace, members
+-- (function\/typedef\/macro) in the variable and type constructor namespaces.
+data CommentRef p = CommentRef Text (Maybe (Id p)) (Maybe Doxy.RefKind)
+
+{-------------------------------------------------------------------------------
+  Eq and Show instances
+-------------------------------------------------------------------------------}
+
+deriving stock instance IsPass p => Eq (Comment              p)
+deriving stock instance IsPass p => Eq (CommentRef           p)
+deriving stock instance IsPass p => Eq (DeclInfo             p)
+deriving stock instance IsPass p => Eq (Enum                 p)
+deriving stock instance IsPass p => Eq (EnumConstant         p)
+deriving stock instance IsPass p => Eq (Field                p)
+deriving stock instance IsPass p => Eq (FieldInfo            p)
+deriving stock instance IsPass p => Eq (Flam                 p)
+deriving stock instance IsPass p => Eq (Function             p)
+deriving stock instance IsPass p => Eq (FunctionArg          p)
+deriving stock instance IsPass p => Eq (Global               p)
+deriving stock instance IsPass p => Eq (ImplicitField        p)
+deriving stock instance IsPass p => Eq (IndirectField        p)
+deriving stock instance IsPass p => Eq (RegularField         p)
+deriving stock instance IsPass p => Eq (Struct               p)
+deriving stock instance IsPass p => Eq (Typedef              p)
+deriving stock instance IsPass p => Eq (Union                p)
+deriving stock instance IsPass p => Eq (UntaggedEnumConstant p)
+
+deriving stock instance IsPass p => Show (Comment              p)
+deriving stock instance IsPass p => Show (CommentRef           p)
+deriving stock instance IsPass p => Show (DeclInfo             p)
+deriving stock instance IsPass p => Show (Enum                 p)
+deriving stock instance IsPass p => Show (EnumConstant         p)
+deriving stock instance IsPass p => Show (Field                p)
+deriving stock instance IsPass p => Show (FieldInfo            p)
+deriving stock instance IsPass p => Show (Flam                 p)
+deriving stock instance IsPass p => Show (Function             p)
+deriving stock instance IsPass p => Show (FunctionArg          p)
+deriving stock instance IsPass p => Show (Global               p)
+deriving stock instance IsPass p => Show (ImplicitField        p)
+deriving stock instance IsPass p => Show (IndirectField        p)
+deriving stock instance IsPass p => Show (RegularField         p)
+deriving stock instance IsPass p => Show (Struct               p)
+deriving stock instance IsPass p => Show (Typedef              p)
+deriving stock instance IsPass p => Show (Union                p)
+deriving stock instance IsPass p => Show (UntaggedEnumConstant p)
+
+deriving stock instance (Macro.HasTypes l, IsPass p) => Eq (DeclKind l p)
+
+deriving stock instance (Macro.HasTypes l, IsPass p) => Show (Decl     l p)
+deriving stock instance (Macro.HasTypes l, IsPass p) => Show (DeclKind l p)
+
+{-------------------------------------------------------------------------------
+  CoercePass instances
+-------------------------------------------------------------------------------}
+
+instance (
+      CoercePass DeclInfo p p'
+    , CoercePass (DeclKind l) p p'
+    , Ann "Decl" p ~ Ann "Decl" p'
+    ) => CoercePass (Decl l) p p' where
+  coercePass decl = Decl{
+        info = coercePass decl.info
+      , kind = coercePass decl.kind
+      , ann  = decl.ann
+      }
+
+instance (CoercePassId p p') => CoercePass EnclosingRef p p' where
+    coercePass = \case
+      EnclosingRef x ->
+        EnclosingRef (coercePassId (Proxy @'(p, p')) x)
+      UnusableEnclosingRef x ->
+        UnusableEnclosingRef x
+
+instance (
+      CoercePassId p p'
+    , CoercePassCommentDecl p p'
+    ) => CoercePass DeclInfo p p' where
+  coercePass info = DeclInfo{
+        loc              = info.loc
+      , id               = coercePassId (Proxy @'(p, p')) info.id
+      , sourceOrderIndex = info.sourceOrderIndex
+      , origin           = info.origin
+      , availability     = info.availability
+      , comment          = coercePassCommentDecl (Proxy @'(p, p')) info.comment
+      , enclosing        = map coercePass info.enclosing
+      }
+
+instance (
+      CoercePassCommentDecl p p'
+    , ScopedName p ~ ScopedName p'
+    ) => CoercePass FieldInfo p p' where
+  coercePass info = FieldInfo{
+        comment = coercePassCommentDecl (Proxy @'(p, p')) info.comment
+      , name    = info.name
+      , loc     = info.loc
+      }
+
+instance (
+       CoercePass Struct   p p'
+     , CoercePass Enum     p p'
+     , CoercePass Union    p p'
+     , CoercePass Typedef  p p'
+     , CoercePass Function p p'
+     , CoercePass Global   p p'
+     , CoercePass UntaggedEnumConstant p p'
+     , CoercePassMacroBody p p'
+     ) => CoercePass (DeclKind l) p p' where
+  coercePass = \case
+      DeclStruct               x -> DeclStruct               $ coercePass x
+      DeclUnion                x -> DeclUnion                $ coercePass x
+      DeclTypedef              x -> DeclTypedef              $ coercePass x
+      DeclEnum                 x -> DeclEnum                 $ coercePass x
+      DeclUntaggedEnumConstant x -> DeclUntaggedEnumConstant $ coercePass x
+      DeclFunction             x -> DeclFunction             $ coercePass x
+      DeclGlobal               x -> DeclGlobal               $ coercePass x
+      DeclMacro                x -> DeclMacro                $ coercePassMacroBody (Proxy @'(p, p')) x
+      DeclOpaque           mSize -> DeclOpaque mSize
+
+instance (
+      CoercePass Flam p p'
+    , CoercePass Field p p'
+    , Ann "Struct" p ~ Ann "Struct" p'
+    ) => CoercePass Struct p p' where
+  coercePass struct = Struct{
+        fields    = coercePass <$> struct.fields
+      , flam      = coercePass struct.flam
+      , sizeof    = struct.sizeof
+      , alignment = struct.alignment
+      , ann       = struct.ann
+      }
+
+instance (
+      CoercePass RegularField p p'
+    , Ann "Flam" p ~ Ann "Flam" p'
+    ) => CoercePass Flam p p' where
+  coercePass = \case
+    NoFlam       -> NoFlam
+    Flam fld ann -> Flam (coercePass fld) ann
+
+instance (
+      CoercePass Field p p'
+    , Ann "Union" p ~ Ann "Union" p'
+    ) => CoercePass Union p p' where
+  coercePass union = Union{
+        fields    = coercePass <$> union.fields
+      , sizeof    = union.sizeof
+      , alignment = union.alignment
+      , ann       = union.ann
+      }
+
+instance (
+      CoercePass RegularField p p'
+    , CoercePass ImplicitField p p'
+    ) => CoercePass Field p p' where
+  coercePass = \case
+      FieldRegular field -> FieldRegular (coercePass field)
+      FieldImplicit field -> FieldImplicit (coercePass field)
+
+instance (
+      CoercePass FieldInfo p p'
+    , CoercePassTypes p p'
+    , Ann "RegularField" p ~ Ann "RegularField" p'
+    ) => CoercePass RegularField p p' where
+  coercePass field = RegularField {
+        info = coercePass field.info
+      , typ = coercePassTypes (Proxy @'(p, p')) field.typ
+      , offset = field.offset
+      , width = field.width
+      , ann = field.ann
+      }
+
+instance (
+      CoercePass FieldInfo p p'
+    , CoercePassAnonRef p p'
+    , CoercePass IndirectField p p'
+    , Ann "ImplicitField" p ~ Ann "ImplicitField" p'
+    ) => CoercePass ImplicitField p p' where
+  coercePass field = ImplicitField {
+        info = coercePass field.info
+      , typRef = coercePassAnonRef (Proxy @'(p, p')) field.typRef
+      , offset = field.offset
+      , indirect = fmap coercePass field.indirect
+      , ann = field.ann
+      }
+
+instance (
+      CoercePass FieldInfo p p'
+    , CoercePassTypes p p'
+    , CoercePassAnonRef p p'
+    , CoercePassAnn "IndirectField" p p'
+    ) => CoercePass IndirectField p p' where
+  coercePass field = IndirectField {
+        info = coercePass field.info
+      , typ = coercePassTypes (Proxy @'(p, p')) field.typ
+      , offset = field.offset
+      , width = field.width
+      , path = fmap (coercePassAnonRef (Proxy @'(p, p'))) field.path
+      , ann = coercePassAnn (Proxy @'("IndirectField", p, p')) field.ann
+      }
+
+instance (
+      CoercePassTypes p p'
+    , Ann "Typedef" p ~ Ann "Typedef" p'
+    ) => CoercePass Typedef p p' where
+  coercePass typedef = Typedef{
+        typ = coercePassTypes (Proxy @'(p, p')) typedef.typ
+      , ann = typedef.ann
+      }
+
+instance (
+       CoercePassTypes p p'
+     , CoercePass EnumConstant p p'
+     , Ann "Enum" p ~ Ann "Enum" p'
+     ) => CoercePass Enum p p' where
+  coercePass enum = Enum{
+        typ       = coercePassTypes (Proxy @'(p, p')) enum.typ
+      , constants = coercePass <$> enum.constants
+      , sizeof    = enum.sizeof
+      , alignment = enum.alignment
+      , ann       = enum.ann
+      }
+
+instance (
+      CoercePassCommentDecl p p'
+    , ScopedName p ~ ScopedName p'
+    ) => CoercePass EnumConstant p p' where
+  coercePass constant = EnumConstant{
+        info  = coercePass constant.info
+      , value = constant.value
+      }
+
+instance (
+       CoercePass EnumConstant p p'
+     , Ann "PatternSynonym" p ~ Ann "PatternSynonym" p'
+     ) => CoercePass UntaggedEnumConstant p p' where
+  coercePass (UntaggedEnumConstant typ' constant') = UntaggedEnumConstant{
+        typ      = typ'
+      , constant = coercePass constant'
+      }
+
+instance (
+      CoercePassTypes p p'
+    , CoercePassAnn "TypeFunArg" p p'
+    , ScopedName p ~ ScopedName p'
+    , Ann "Function" p ~ Ann "Function" p'
+    ) => CoercePass Function p p' where
+  coercePass function = Function{
+        args  = map coercePass function.args
+      , res   = coercePassTypes (Proxy @'(p, p')) function.res
+      , attrs = function.attrs
+      , ann   = function.ann
+      }
+
+instance (
+      CoercePassTypes p p'
+    , CoercePassAnn "TypeFunArg" p p'
+    , ScopedName p ~ ScopedName p'
+    ) => CoercePass FunctionArg p p' where
+  coercePass functionArg = FunctionArg{
+        name = functionArg.name
+      , typ  = coercePassTypes (Proxy @'(p, p')) functionArg.typ
+      , ann  = coercePassAnn (Proxy @'("TypeFunArg", p, p')) functionArg.ann
+      }
+
+instance (
+      CoercePassTypes p p'
+    , Ann "Global" p ~ Ann "Global" p'
+    ) => CoercePass Global p p' where
+  coercePass global = Global{
+        typ = coercePassTypes (Proxy @'(p, p')) global.typ
+      , ann = global.ann
+      }
+
+instance (
+      CoercePass Doxy.Comment (CommentRef p) (CommentRef p')
+    ) => CoercePass Comment p p' where
+  coercePass (Comment c) = Comment (coercePass c)
+
+instance (
+      CoercePassId p p'
+    ) => CoercePass Doxy.Comment (CommentRef p) (CommentRef p') where
+  coercePass comment = fmap coercePass comment
+
+instance (
+      CoercePassId p p'
+    ) => CoercePass CommentRef p p' where
+  coercePass (CommentRef c hs k) =
+      CommentRef c (coercePassId (Proxy @'(p, p')) <$> hs) k
diff --git a/src-internal/HsBindgen/IR/C/DeclPath.hs b/src-internal/HsBindgen/IR/C/DeclPath.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/DeclPath.hs
@@ -0,0 +1,68 @@
+-- | Paths of declaration locations
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.DeclPath qualified as C
+module HsBindgen.IR.C.DeclPath (
+    DeclPath(..)
+  , declPathRealPath
+  , rootHeaderName
+  ) where
+
+import Clang.HighLevel (ShowFile (..))
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types
+import Clang.Paths
+
+import HsBindgen.Imports
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Where a declaration is located
+--
+-- Only headers are files on disk. The root header is an unsaved file, and Clang
+-- writes each @-D@ option as a @#define@ into its predefines buffer, which has
+-- no file at all; neither has a 'RealPath'.
+--
+-- The constructor order follows the order in which Clang processes the
+-- sources.
+data DeclPath =
+    -- | A @-D@ Clang option
+    OnCommandLine
+    -- | The root header (see "HsBindgen.Frontend.RootHeader")
+  | InRootHeader
+    -- | A header
+  | InHeader RealPath
+  deriving stock (Eq, Ord, Generic)
+
+instance Show DeclPath where
+  show = renderDeclPath
+
+instance Show (SingleLoc DeclPath) where
+  show = show . HighLevel.prettySingleLoc renderDeclPath ShowFile
+
+declPathRealPath :: DeclPath -> Maybe RealPath
+declPathRealPath = \case
+    OnCommandLine -> Nothing
+    InRootHeader  -> Nothing
+    InHeader path -> Just path
+
+{-------------------------------------------------------------------------------
+  Names
+-------------------------------------------------------------------------------}
+
+-- | Name of the root header @UnsavedFile@
+rootHeaderName :: SourcePath
+rootHeaderName = SourcePath "hs-bindgen-root.h"
+
+renderDeclPath :: DeclPath -> String
+renderDeclPath = \case
+    OnCommandLine -> "<command line>"
+    InRootHeader  -> "<root header>"
+    InHeader path -> getRealPath path
diff --git a/src-internal/HsBindgen/IR/C/HashDefine.hs b/src-internal/HsBindgen/IR/C/HashDefine.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/HashDefine.hs
@@ -0,0 +1,63 @@
+-- | @#define@ directive
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.HashDefine qualified as C
+module HsBindgen.IR.C.HashDefine (
+    -- * HashDefine
+    HashDefine(..)
+  , hashDefineToDirective
+  ) where
+
+import HsBindgen.Imports
+
+{-------------------------------------------------------------------------------
+  HashDefine
+-------------------------------------------------------------------------------}
+
+-- | A @#define@ directive
+--
+-- This is @#define@ syntax, /not/ C compiler @-D@ syntax; the translation
+-- between the two is not the identity:
+--
+-- * The @=@ of @-DFOO=BAR@ is not @#define@ syntax. @#define FOO=BAR@ is valid
+--   C, but defines a macro @FOO@ whose replacement list is @= BAR@. * @-DFOO@
+--   is not @#define FOO@. Clang and GCC define a bare @-D@ macro as @1@, so
+--   @-DFOO@ and @-DFOO=@ define /different/ macros. Both are @#ifdef@-true, but
+--   @#if FOO@ is true for the former and an error for the latter.
+--
+-- The correspondence is therefore:
+--
+-- +--------------------+--------------------------------+--------------------+
+-- | @-D@ argument      | t'HashDefine'                  | emitted directive  |
+-- +====================+================================+====================+
+-- | @-D FOO@           | @name = "FOO", value = "1"@    | @#define FOO 1@    |
+-- +--------------------+--------------------------------+--------------------+
+-- | @-D FOO=BAR@       | @name = "FOO", value = "BAR"@  | @#define FOO BAR@  |
+-- +--------------------+--------------------------------+--------------------+
+-- | @-D FOO=@          | @name = "FOO", value = ""@     | @#define FOO@      |
+-- +--------------------+--------------------------------+--------------------+
+-- | @-D \'FOO(x)=x\'@  | @name = "FOO(x)", value = "x"@ | @#define FOO(x) x@ |
+-- +--------------------+--------------------------------+--------------------+
+--
+-- Neither field is parsed or validated: a malformed definition is reported by
+-- Clang as a diagnostic in the root header, the same treatment an unresolvable
+-- @#include@ gets.
+data HashDefine = HashDefine {
+      -- | Macro name; may be function-like, e.g. @FOO(x)@
+      name :: String
+
+      -- | Replacement list; @""@ for @#define FOO@
+    , value :: String
+    }
+  deriving stock (Show, Eq, Generic)
+
+-- | Render a t'HashDefine' as a @#define@ directive (no trailing newline)
+hashDefineToDirective :: HashDefine -> String
+hashDefineToDirective hashDefine
+  | null hashDefine.value = "#define " ++ hashDefine.name
+  | otherwise             = "#define " ++ hashDefine.name ++ " " ++ hashDefine.value
diff --git a/src-internal/HsBindgen/IR/C/HashIncludeArg.hs b/src-internal/HsBindgen/IR/C/HashIncludeArg.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/HashIncludeArg.hs
@@ -0,0 +1,97 @@
+-- | @#include@ argument
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.HashIncludeArg qualified as C
+module HsBindgen.IR.C.HashIncludeArg (
+    -- * HashIncludeArg
+    HashIncludeArg(..)
+  , hashIncludeArg
+  , UncheckedHashIncludeArg
+  , hashIncludeArgWithTrace
+    -- ** Trace message
+  , HashIncludeArgMsg(..)
+  ) where
+
+import System.FilePath qualified as FilePath
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  HashIncludeArg
+-------------------------------------------------------------------------------}
+
+-- | @#include@ argument
+--
+-- We only support bracket includes, using @#include <PATH>@ syntax.  This type
+-- represents the @PATH@ to a header.
+--
+-- A @#include@ argument is generally relative to a directory in the C include
+-- search path.  We issue a 'Notice' if an absolute path is used, because it is
+-- almost always a mistake.
+--
+-- A @#include@ argument is C syntax.  Forward slashes (@/@) are used to
+-- separate directories, even on Windows.  Backslashes are interpreted as
+-- characters in a directory or filename, not directory separators.  We issue a
+-- 'Notice' if a backslash is used, because it is almost always a mistake.
+newtype HashIncludeArg = HashIncludeArg { path :: FilePath }
+  deriving stock (Show)
+  deriving newtype (Eq, IsString, Ord)
+
+-- | Construct a t'HashIncludeArg', returning trace messages
+hashIncludeArg :: FilePath -> ([HashIncludeArgMsg], HashIncludeArg)
+hashIncludeArg fp = (hashIncludeArgMsgs fp, HashIncludeArg fp)
+
+-- | Unchecked @#include@ argument
+--
+-- We need to emit trace messages monadically, so we do not check values within
+-- the pure parser.
+type UncheckedHashIncludeArg = FilePath
+
+-- | Construct a t'HashIncludeArg', emitting trace messages
+hashIncludeArgWithTrace ::
+     Tracer HashIncludeArgMsg
+  -> UncheckedHashIncludeArg
+  -> IO HashIncludeArg
+hashIncludeArgWithTrace tracer fp = do
+    let (msgs, arg) = hashIncludeArg fp
+    mapM_ (traceWith tracer . withCallStack) msgs
+    return arg
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+-- | @#include@ argument trace message
+data HashIncludeArgMsg =
+    HashIncludeArgBackslash   FilePath
+  | HashIncludeArgNotRelative FilePath
+  deriving stock (Show)
+
+instance PrettyForTrace HashIncludeArgMsg where
+  prettyForTrace = \case
+    HashIncludeArgBackslash arg ->
+      PP.string $ "#include argument contains a backslash: " ++ arg
+    HashIncludeArgNotRelative arg ->
+      PP.string $ "#include argument not relative: " ++ arg
+
+instance IsTrace Level HashIncludeArgMsg where
+  getDefaultLogLevel = const Notice
+  getSource          = const HsBindgen
+  getTraceId         = const "hash-include-arg"
+
+hashIncludeArgMsgs :: FilePath -> [HashIncludeArgMsg]
+hashIncludeArgMsgs fp = catMaybes [
+      if '\\' `elem` fp
+        then Just (HashIncludeArgBackslash fp)
+        else Nothing
+    , if FilePath.isRelative fp
+        then Nothing
+        else Just (HashIncludeArgNotRelative fp)
+    ]
diff --git a/src-internal/HsBindgen/IR/C/LocationInfo.hs b/src-internal/HsBindgen/IR/C/LocationInfo.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/LocationInfo.hs
@@ -0,0 +1,171 @@
+-- | Trace messages with location information
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.LocationInfo qualified as C
+module HsBindgen.IR.C.LocationInfo (
+    WithLocationInfo(..)
+    -- * Location info
+  , LocationInfo(..)
+    -- ** Construction
+  , prelimDeclIdLocationInfo
+  , declIdLocationInfo
+    -- ** Query
+  , locationInfoName
+  , locationInfoLocs
+    -- * Declaration locations
+  , DeclLocs(..)
+  , declLocsMin
+  , declLocsToList
+  ) where
+
+import Data.List.NonEmpty qualified as NonEmpty
+import Text.SimplePrettyPrint (CtxDoc, (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.HighLevel.Types
+
+import HsBindgen.IR.C.Conflict qualified as C
+import HsBindgen.IR.C.DeclPath qualified as C
+import HsBindgen.IR.C.Naming qualified as C
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Trace message with location information
+data WithLocationInfo a = WithLocationInfo{
+      loc :: LocationInfo
+    , msg :: a
+    }
+  deriving stock (Eq, Ord, Show, Functor)
+
+instance IsTrace lvl a => IsTrace lvl (WithLocationInfo a) where
+  getDefaultLogLevel x = getDefaultLogLevel x.msg
+  getSource          x = getSource          x.msg
+  getTraceId         x = getTraceId         x.msg
+
+instance PrettyForTrace a => PrettyForTrace (WithLocationInfo a) where
+  prettyForTrace x =
+      case x.loc of
+        LocationUnavailable ->
+          prettyForTrace x.msg
+        _otherwise ->
+          PP.hang (prettyForTrace x.loc >< ":") 2 $
+            prettyForTrace x.msg
+
+{-------------------------------------------------------------------------------
+  Location info
+-------------------------------------------------------------------------------}
+
+data LocationInfo =
+    -- | Message about a named declaration in the C source
+    --
+    -- Usually we expect the list of locations to be a singleton: the location
+    -- of the declaration.
+    LocationDeclNamed C.DeclName [SingleLoc C.DeclPath]
+
+    -- | Message about an unnamed declaration
+    --
+    -- We record the /assigned/ name, /if/ it is available.
+    --
+    -- Usually we expect the list of locations to be a singleton: the location
+    -- of the declaration.
+  | LocationDeclUnnamed (Maybe C.DeclName) [SingleLoc C.DeclPath]
+
+    -- | No location information
+  | LocationUnavailable
+  deriving stock (Eq, Ord, Show)
+
+instance PrettyForTrace LocationInfo where
+  prettyForTrace = \case
+      LocationDeclNamed name locs -> PP.hsep [
+          prettyForTrace name
+        , "at"
+        , prettyLocs locs
+        ]
+      LocationDeclUnnamed (Just name) locs -> PP.hsep [
+          "unnamed declaration"
+        , prettyForTrace name
+        , "at"
+        , prettyLocs locs
+        ]
+      LocationDeclUnnamed Nothing locs -> PP.hsep [
+          "unnamed declaration at"
+        , prettyLocs locs
+        ]
+      LocationUnavailable ->
+        "location unavailable"
+    where
+      prettyLocs :: Show a => [a] -> CtxDoc
+      prettyLocs = \case
+        []    -> "(source location unavailable)"
+        [loc] -> PP.show loc
+        locs  -> PP.hlist "(" ")" (map PP.show locs)
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+prelimDeclIdLocationInfo :: C.PrelimDeclId -> [SingleLoc C.DeclPath] -> LocationInfo
+prelimDeclIdLocationInfo prelimDeclId knownLocs =
+    case prelimDeclId of
+      C.PrelimDeclIdNamed name        -> LocationDeclNamed name knownLocs
+      C.PrelimDeclIdUnnamed unnamedId -> LocationDeclUnnamed Nothing [C.InHeader <$> unnamedId.loc]
+
+declIdLocationInfo :: C.DeclId -> [SingleLoc C.DeclPath] -> LocationInfo
+declIdLocationInfo declId knownLocs =
+    if not declId.isUnnamed
+      then LocationDeclNamed declId.name knownLocs
+      else LocationDeclUnnamed (Just declId.name) knownLocs
+
+{-------------------------------------------------------------------------------
+  Query
+-------------------------------------------------------------------------------}
+
+locationInfoName :: LocationInfo -> Maybe C.DeclName
+locationInfoName = \case
+    LocationDeclNamed name _    -> Just name
+    LocationDeclUnnamed mName _ -> mName
+    LocationUnavailable         -> Nothing
+
+locationInfoLocs :: LocationInfo -> [SingleLoc C.DeclPath]
+locationInfoLocs = \case
+    LocationDeclNamed _ locs   -> locs
+    LocationDeclUnnamed _ locs -> locs
+    LocationUnavailable        -> []
+
+{-------------------------------------------------------------------------------
+  Declaration locations
+-------------------------------------------------------------------------------}
+
+-- | Source location(s) of a declaration.
+--
+-- Most declarations have a single source location; only conflicting
+-- declarations carry more than one.
+data DeclLocs =
+    -- | The declaration has a single source location.
+    DeclLoc (SingleLoc C.DeclPath)
+    -- | Conflicting declarations, each with its own source location.
+  | DeclLocsConflict C.Conflict
+  deriving stock (Eq, Ord, Show)
+
+-- | Attempts to get the “minimum” location.
+--
+-- This is only meaningful if the locations share the same source path.
+-- Comparisons across source paths happen in lexicographical order.
+declLocsMin :: DeclLocs -> SingleLoc C.DeclPath
+declLocsMin = \case
+  DeclLoc x                 -> x
+  DeclLocsConflict conflict -> C.conflictGetMinimumLoc conflict
+
+-- | All source locations, discarding the single vs conflict distinction.
+declLocsToList :: DeclLocs -> [SingleLoc C.DeclPath]
+declLocsToList = \case
+    DeclLoc          loc      -> [loc]
+    DeclLocsConflict conflict -> NonEmpty.toList $ C.conflictToList conflict
diff --git a/src-internal/HsBindgen/IR/C/Naming.hs b/src-internal/HsBindgen/IR/C/Naming.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/Naming.hs
@@ -0,0 +1,396 @@
+-- | C naming and declaration identifiers
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.Naming qualified as C
+module HsBindgen.IR.C.Naming (
+    -- * C names
+    -- ** Tag kind
+    TagKind(..)
+  , tagKindPrefix
+    -- ** Name kind
+  , NameKind(..)
+  , checkIsTagged
+    -- ** Declaration names
+  , DeclName(..)
+  , renderDeclName
+  , renderDeclNameC
+  , parseDeclName
+    -- ** Scoped names
+  , ScopedName(..)
+  , parseScopedName
+
+    -- * PrelimDeclId
+  , UnnamedId(..)
+  , PrelimDeclId(..)
+  , prelimDeclIdSourceName
+  , prelimDeclIdNameKind
+  , prelimDeclIdAtCursor
+
+    -- * DeclId
+  , DeclId(..)
+  , declIdSourceName
+  , renderNamedDeclId
+  , renderDeclId
+  , parseDeclId
+  ) where
+
+import Data.Text qualified as Text
+import Foreign.C.Types (CUInt)
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.HighLevel (ShowFile (..))
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types
+import Clang.LowLevel.Core
+import Clang.Paths (getRealPath)
+
+import HsBindgen.Errors
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  C names
+
+  This is not standard C because we distinguish a separate macro namespace.
+-------------------------------------------------------------------------------}
+
+-- | C tag kind for elaborated types (@struct@, @union@, @enum@).
+data TagKind = TagKindStruct | TagKindUnion | TagKindEnum
+  deriving stock (Eq, Generic, Ord, Show)
+
+instance PrettyForTrace TagKind where
+  prettyForTrace = PP.show
+
+tagKindPrefix :: TagKind -> Text
+tagKindPrefix = \case
+    TagKindStruct -> "struct"
+    TagKindUnion  -> "union"
+    TagKindEnum   -> "enum"
+
+--------------------------------------------------------------------------------
+
+-- | C name kind
+--
+-- This type distinguishes ordinary names, tagged names, and macro names.  It is
+-- needed when the kind is not determined by a context.
+data NameKind =
+    -- | Ordinary kind
+    --
+    -- An ordinary name is written without a prefix.
+    NameKindOrdinary
+
+    -- | Tagged kind
+    --
+    -- A tagged name is written with a prefix that specifies the tag kind.
+  | NameKindTagged TagKind
+
+    -- | Macro kind
+    --
+    -- We distinguish a macro name with a @macro@ prefix.  Example: @macro foo@
+  | NameKindMacro
+  deriving stock (Eq, Generic, Ord, Show)
+
+instance Bounded NameKind where
+  minBound = NameKindOrdinary
+  maxBound = NameKindMacro
+
+instance Enum NameKind where
+  toEnum = \case
+    0 -> NameKindOrdinary
+    1 -> NameKindTagged TagKindStruct
+    2 -> NameKindTagged TagKindUnion
+    3 -> NameKindTagged TagKindEnum
+    4 -> NameKindMacro
+    _ -> panicPure "invalid NameKind toEnum"
+
+  fromEnum = \case
+    NameKindOrdinary             -> 0
+    NameKindTagged TagKindStruct -> 1
+    NameKindTagged TagKindUnion  -> 2
+    NameKindTagged TagKindEnum   -> 3
+    NameKindMacro                -> 4
+
+instance PrettyForTrace NameKind where
+  prettyForTrace = PP.show
+
+checkIsTagged :: NameKind -> Maybe TagKind
+checkIsTagged = \case
+    NameKindOrdinary       -> Nothing
+    NameKindTagged tagKind -> Just tagKind
+    NameKindMacro          -> Nothing
+
+--------------------------------------------------------------------------------
+
+-- | C declaration name, qualified by the 'NameKind'
+data DeclName = DeclName {
+      text :: Text
+    , kind :: NameKind
+    }
+  deriving stock (Eq, Generic, Ord, Show)
+
+instance IsString DeclName where
+  fromString str =
+      case parseDeclName (Text.pack str) of
+        Just name -> name
+        Nothing   -> panicPure $ "invalid DeclName: " ++ show str
+
+instance PrettyForTrace DeclName where
+  prettyForTrace = PP.singleQuotes . PP.text . renderDeclName
+
+-- | User-facing syntax for t'DeclName'
+renderDeclName :: DeclName -> Text
+renderDeclName declName = case declName.kind of
+    NameKindOrdinary       -> declName.text
+    NameKindTagged tagKind -> tagKindPrefix tagKind <> " " <> declName.text
+    NameKindMacro          -> "macro " <> declName.text
+
+-- | C source syntax for t'DeclName'
+renderDeclNameC :: DeclName -> Text
+renderDeclNameC declName = case declName.kind of
+    NameKindOrdinary       -> declName.text
+    NameKindTagged tagKind -> tagKindPrefix tagKind <> " " <> declName.text
+    NameKindMacro          -> declName.text
+
+-- | Parse a t'DeclName' from 'Text'
+parseDeclName :: Text -> Maybe DeclName
+parseDeclName t = case Text.words t of
+    [n]           -> Just $ DeclName n NameKindOrdinary
+    ["struct", n] -> Just $ DeclName n (NameKindTagged TagKindStruct)
+    ["union",  n] -> Just $ DeclName n (NameKindTagged TagKindUnion)
+    ["enum",   n] -> Just $ DeclName n (NameKindTagged TagKindEnum)
+    ["macro",  n] -> Just $ DeclName n NameKindMacro
+    _otherwise    -> Nothing
+
+--------------------------------------------------------------------------------
+
+-- | C scoped name
+--
+-- This is the parsed representation of a C name within a scope.  It is used for
+-- field names and function parameter names.
+data ScopedName = ScopedName {
+      text :: Text
+    }
+  deriving stock (Eq, Generic, Ord, Show)
+
+instance IsString ScopedName where
+  fromString str =
+      case parseScopedName (Text.pack str) of
+        Just name -> name
+        Nothing   -> panicPure $ "invalid DeclName: " ++ show str
+
+instance PrettyForTrace ScopedName where
+  prettyForTrace = PP.singleQuotes . PP.text . (.text)
+
+-- | Parse a t'ScopedName' from 'Text'
+parseScopedName :: Text -> Maybe ScopedName
+parseScopedName t = case Text.words t of
+    [n]        -> Just $ ScopedName n
+    _otherwise -> Nothing
+
+{-------------------------------------------------------------------------------
+  PrelimDeclId
+-------------------------------------------------------------------------------}
+
+-- | Unnamed declaration identifier
+--
+-- A single macro expansion can produce multiple unnamed declarations, and
+-- libclang reports the /same/ expansion location for all of them (the macro
+-- call site). Without further information they would share an 'UnnamedId'.
+-- Example:
+--
+-- > #define TwoUntaggedStructs \
+-- >     struct { int a; } x; \
+-- >     struct { int b; } y;
+-- >
+-- > TwoUntaggedStructs   // both 'struct {}'s share the expansion location
+--
+-- To make sure that each unnamed ID is unique, we include a 'hash' of the
+-- cursor pointing to the associated unnamed declaration. With 'hash' in hand,
+-- we can also properly compare unnamed IDs via 'Eq' and 'Ord'. There is a
+-- possilibity that hashes collide accidentally, but the probability of this
+-- happening is very small.
+--
+-- For human convenience, we also include the /spelling/ location of a
+-- declaration in the unnamed ID. The spelling location points back to where
+-- each token was originally written. For macro-expanded code, this an offset
+-- inside the macro body rather than the call site. The two structs above have
+-- distinct spelling locations (one per @struct@ token in the macro).
+--
+-- NOTE: The spelling location is only populated correctly on @llvm >= 19.1.0@;
+-- on older toolchains, the spelling location is the same as the expansion
+-- location.
+data UnnamedId = UnnamedId {
+      -- | Macro expansion site, or the source location for non-macro decls.
+      -- Used for tracing and Haddock comments.
+      loc      :: SingleLoc RealPath
+      -- | Spelling location: where the tokens were written in the source
+      -- (inside the macro definition, for macro-expanded decls).
+    , spelling :: SingleLoc RealPath
+    , kind     :: NameKind
+      -- | Hash of the cursor pointing to the associated unnamed declaration
+      --
+      -- The hash uniquely keys each unnamed declaration.
+    , hash     :: CUInt
+    }
+  deriving stock (Eq, Generic, Ord, Show)
+
+instance PrettyForTrace UnnamedId where
+  prettyForTrace unnamedId = PP.singleQuotes $ PP.hsep $ [
+      "unnamed"
+    , case unnamedId.kind of
+        NameKindTagged tagKind ->
+          PP.text (tagKindPrefix tagKind)
+        NameKindOrdinary ->
+          PP.empty
+        NameKindMacro ->
+          "macro"
+    , "at"
+    , PP.string $ HighLevel.prettySingleLoc getRealPath ShowFile unnamedId.loc
+    ] ++ [
+      PP.string $
+           "<Spelling="
+        ++ HighLevel.prettySingleLoc getRealPath ShowFile unnamedId.spelling
+        ++ ">"
+    | unnamedId.spelling /= unnamedId.loc
+    ] ++ [
+      PP.string $ "<Hash=" ++ show unnamedId.hash ++ ">"
+    ]
+
+--------------------------------------------------------------------------------
+
+-- | Preliminary declaration identifier
+--
+-- Not all declarations in a C header have names; to be able to nonetheless
+-- refer to these declarations we use the source location.  We replace these by
+-- proper names in the
+-- "HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass.FillUnnamedIds" pass.
+data PrelimDeclId =
+    -- | Named declaration
+    PrelimDeclIdNamed DeclName
+
+    -- | Unnamed declaration
+    --
+    -- This can only happen for tagged types: structs, unions and enums
+  | PrelimDeclIdUnnamed UnnamedId
+  deriving stock (Eq, Ord, Show)
+
+instance PrettyForTrace PrelimDeclId where
+  prettyForTrace = \case
+    PrelimDeclIdNamed name        -> prettyForTrace name
+    PrelimDeclIdUnnamed unnamedId -> prettyForTrace unnamedId
+
+prelimDeclIdSourceName :: PrelimDeclId -> Maybe DeclName
+prelimDeclIdSourceName = \case
+    PrelimDeclIdNamed  name         -> Just name
+    PrelimDeclIdUnnamed  _unnamedId -> Nothing
+
+prelimDeclIdNameKind :: PrelimDeclId -> NameKind
+prelimDeclIdNameKind = \case
+    PrelimDeclIdNamed name        -> name.kind
+    PrelimDeclIdUnnamed unnamedId -> unnamedId.kind
+
+prelimDeclIdAtCursor :: forall m.
+     MonadIO m
+  => CXCursor
+  -> NameKind
+  -> m PrelimDeclId
+prelimDeclIdAtCursor curr kind = do
+    text <- clang_getCursorSpelling curr
+    if | Text.null text ->
+           -- clang-15 and older use an empty string for unnamed declarations
+           markAsUnnamed
+       | Text.elem ' ' text ->
+           -- clang-16 and newer assign names such as
+           --
+           -- > struct (unnamed at ....)
+           --
+           -- /except/ in one case: when we have an untagged struct inside a
+           -- typedef, such as
+           --
+           -- > typedef struct { .. } foo;
+           --
+           -- newer versions of clang will assign the tag @foo@ to the struct.
+           -- This means that in this case we will misclassify the struct as
+           -- tagged (and this will then also depend on the clang
+           -- version: for older versions we /will/ classify it as untagged).
+           -- We smooth over this difference in the
+           -- "HsBindgen.Frontend.Pass.FillUnnamedIds" pass (see
+           -- "HsBindgen.Frontend.Pass.FillUnnamedIds.ChooseNames").
+           markAsUnnamed
+       | otherwise ->
+           return $ PrelimDeclIdNamed DeclName{text = text, kind = kind}
+  where
+    markAsUnnamed :: m PrelimDeclId
+    markAsUnnamed = do
+      cxLoc    <- clang_getCursorLocation curr
+      loc      <- HighLevel.clang_getExpansionLocation cxLoc
+      spelling <- HighLevel.clang_getSpellingLocation  cxLoc
+      hash     <- clang_hashCursor curr
+      return $
+        PrelimDeclIdUnnamed UnnamedId{loc = loc, spelling = spelling, kind = kind, hash = hash}
+
+{-------------------------------------------------------------------------------
+  DeclId
+-------------------------------------------------------------------------------}
+
+-- | Identifier for a declaration that appears in the C source
+--
+-- This is the main ID used throughout @hs-bindgen@ for declarations.
+data DeclId = DeclId {
+      -- | Name of the declaration
+      --
+      -- For named declarations, this is /always/ the name as it
+      -- appears in the C source; @hs-bindgen@ assigns names to declarations in
+      -- the generated /Haskell/ code, and, in particular, does not rename the C
+      -- declarations.
+      --
+      -- For unnamed declarations, this is the name as it is assigned by the
+      -- @FillUnnamedIds@ pass, which is also how we then refer to this
+      -- declaration in binding specs. The user-facing syntax for untagged
+      -- declarations uses an \@-sign in the name; that is not present in the
+      -- Haskell value.
+      name :: DeclName
+
+      -- | Is this declaration unnamed?
+      --
+      -- We do /NOT/ record the original unnamed ID here, because that is a source
+      -- location, which is impossible to construct in many places (for example,
+      -- when parsing @struct \@foo@ in binding specs).
+    , isUnnamed :: Bool
+    }
+  deriving stock (Eq, Ord, Show)
+
+instance PrettyForTrace DeclId where
+  prettyForTrace = PP.singleQuotes . PP.text . renderDeclId
+
+declIdSourceName :: DeclId -> Maybe DeclName
+declIdSourceName declId = do
+    guard $ not declId.isUnnamed
+    return declId.name
+
+renderNamedDeclId :: DeclId -> Maybe Text
+renderNamedDeclId declId
+    | declId.isUnnamed = Nothing
+    | otherwise        = Just $ renderDeclName declId.name
+
+-- | User-facing syntax for t'DeclId'
+renderDeclId :: DeclId -> Text
+renderDeclId declId
+    | declId.isUnnamed = renderDeclName $ mapDeclNameText ("@" <>) declId.name
+    | otherwise        = renderDeclName declId.name
+  where
+    mapDeclNameText :: (Text -> Text) -> DeclName -> DeclName
+    mapDeclNameText f name = DeclName{text = f name.text, kind = name.kind}
+
+-- | Parse user-facing syntax for t'DeclId'
+parseDeclId :: Text -> Maybe DeclId
+parseDeclId t = do
+    declName <- parseDeclName t
+    return $ case Text.uncons declName.text of
+      Just ('@', n) -> DeclId{name = DeclName n declName.kind, isUnnamed = True}
+      _otherwise    -> DeclId{name = declName, isUnnamed = False}
diff --git a/src-internal/HsBindgen/IR/C/PrettyPrinter.hs b/src-internal/HsBindgen/IR/C/PrettyPrinter.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/PrettyPrinter.hs
@@ -0,0 +1,268 @@
+-- | Pretty-print valid C code
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.PrettyPrinter qualified as C
+module HsBindgen.IR.C.PrettyPrinter (
+    -- * Pretty-printers
+    showsFunctionType
+  , showsVariableType
+  , showsType
+  , showsFunctionPurity
+  ) where
+
+import Data.Text qualified as Text
+
+import HsBindgen.Errors
+import HsBindgen.Imports
+import HsBindgen.IR.C.Decl qualified as C
+import HsBindgen.IR.C.Naming qualified as C
+import HsBindgen.IR.C.Type qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Pretty-printers
+-------------------------------------------------------------------------------}
+
+-- | Formats functions with attributes on their own line, parameters on separate
+-- lines with additional indentation.
+--
+showsFunctionType :: forall p.
+     (IsPass p, HasCallStack)
+  => ShowS               -- ^ function name
+  -> C.FunctionPurity    -- ^ function purity
+  -> [(ShowS, C.Type p)] -- ^ arguments, names and types
+  -> C.Type p            -- ^ return type
+  -> ShowS
+showsFunctionType n pur args res  =
+      showsFunctionPurity pur
+    . showAttributeNewline pur
+    . showsType functionDeclarator res
+  where
+    functionDeclarator ::
+         CTypePrecedence
+      -> ShowS
+    functionDeclarator d = showParen (d > arrayPrec) $
+        n . showChar ' ' . showParen True signatureArgs
+
+    signatureArgs :: ShowS
+    signatureArgs = case args of
+        [] -> showString "void"
+        p:ps ->
+              showChar '\n'
+            . foldr1 sep (fmap showT (p :| ps))
+            . showChar '\n'
+      where
+        sep a b = a . showString ",\n" . b
+
+        showT :: (ShowS, C.Type p) -> ShowS
+        showT (i, p) =
+              showString "  "  -- extra 2 spaces for parameters
+            . showsVariableType i p
+
+showsVariableType ::
+     (IsPass p, HasCallStack)
+  => ShowS -- ^ variable name
+  -> C.Type p
+  -> ShowS
+showsVariableType n ty = showsType variableDeclarator ty
+  where
+    -- Just the identifier
+    variableDeclarator _ = n
+
+-- | Show type in C syntax.
+-- Used to generate userland-capi C-code.
+--
+-- NOTE: it is not unlikely that this function places parentheses incorrectly in
+-- edge cases.
+--
+-- <https://en.cppreference.com/w/c/language/declarations.html>
+--
+-- === Examples
+--
+-- >>> import HsBindgen.Frontend.AST.Decl (Type (..))
+-- >>> import HsBindgen.Language.C qualified as C
+-- >>> import HsBindgen.Frontend.AST.Decl (FunctionPurity (..))
+--
+-- A variable @a@ of type boolean:
+--
+-- >>> showsVariableType (showString "a") (TypePrim C.PrimBool) ""
+-- "_Bool a"
+--
+-- A variable @b@ of type incomplete-array-of-integer:
+--
+-- >>> :{
+--  showsVariableType
+--    (showString "b")
+--    (TypeIncompleteArray (TypePrim (C.PrimIntegral C.PrimInt C.Signed)))
+--    ""
+-- :}
+-- "signed int b[]"
+--
+-- A variable @c@ of type pointer-to-3-length-array-of-integer:
+--
+-- >>> :{
+--  showsVariableType
+--    (showString "c")
+--    (TypePointer (TypeConstArray 3 (TypePrim (C.PrimIntegral C.PrimInt C.Signed))))
+--    ""
+-- :}
+-- "signed int (*c)[3]"
+--
+-- A variable @d@ of type 3-length-array-of-pointer-to-integer:
+--
+-- >>> :{
+--  showsVariableType
+--    (showString "d")
+--    (TypeConstArray 3 (TypePointer (TypePrim (C.PrimIntegral C.PrimInt C.Signed))))
+--    ""
+-- :}
+-- "signed int *d[3]"
+--
+-- A function @foo@ of return type pointer-to-integer:
+--
+-- >>> :{
+--  showsFunctionType
+--    (showString "foo")
+--    ImpureFunction
+--    []
+--    (TypePointer (TypePrim (C.PrimIntegral C.PrimInt C.Signed)))
+--    ""
+-- :}
+-- "signed int *foo (void)"
+--
+-- A function @bar@ of return type pointer-to-2x3-size-array-of-integer:
+--
+-- >>> :{
+--  showsFunctionType
+--    (showString "bar")
+--    ImpureFunction
+--    [(showString "arg1", TypePrim (C.PrimIntegral C.PrimInt C.Signed))]
+--    (TypePointer (TypeConstArray 2 (TypeConstArray 3 (TypePrim (C.PrimIntegral C.PrimInt C.Signed)))))
+--    ""
+-- :}
+-- "signed int (*bar (signed int arg1))[2][3]"
+showsType :: forall p.
+     (IsPass p, HasCallStack)
+  => (CTypePrecedence -> ShowS)  -- ^ variable name, or function name + arguments
+  -> C.Type p
+  -> ShowS
+showsType x (C.TypePrim p)            = C.showsPrimType p . showChar ' ' . x 0
+showsType x (C.TypeRef ref)           = showsId (Proxy @p) ref . showChar ' ' . x 0
+showsType x (C.TypeEnum ref)          = showsId (Proxy @p) ref.name . showChar ' ' . x 0
+showsType x (C.TypeMacro ref)         = showsId (Proxy @p) (macroIdId (Proxy @p) ref.name) . showChar ' ' . x 0
+showsType x (C.TypeTypedef ref)       = showsId (Proxy @p) ref.name . showChar ' ' . x 0
+showsType x (C.TypePointers n t)      = showsType (\d -> showParen (d > arrayPrec)
+                                      $ foldr (.) id (replicate n (showString "*"))
+                                      . x (pointerPrec + 1)) t
+showsType x (C.TypeConstArray n t)    = showsType (\_d -> x (arrayPrec + 1) . showChar '[' . shows n . showChar ']') t
+showsType x (C.TypeIncompleteArray t) = showsType (\_d -> x (arrayPrec + 1) . showString "[]") t
+showsType x (C.TypeFun args res)      =
+    -- Note: we pass 'ImpureFunction' to 'showsFunctionType' so that no function
+    -- attributes are included in the printed string. Function attributes should
+    -- not appear inside types, rather only as part of top-level function
+    -- declarations.
+    showsFunctionType (showParen True (x 0)) C.ImpureFunction (zipWith named [1..] args) res
+  where
+    named :: Int -> C.TypeFunArg p -> (ShowS, C.Type p)
+    named i arg = (showString "arg" . shows i, arg.typ)
+showsType x C.TypeVoid                 = showString "void " . x 0
+showsType x (C.TypeExtBinding ref)     = showsId (Proxy @p) (extBindingId (Proxy @p) ref.name) . showChar ' ' . x 0
+showsType x (C.TypeBlock t)            = showsType (\_d -> showString "^" . x 0) t
+-- Type qualifiers like @const@ can appear before, and _after_ the type they
+-- refer to. For example,
+--
+-- > const int x;
+-- > int const x;
+--
+-- > const int f();
+-- > int const f();
+--
+-- More involved: A function with a return type being a "constant pointer to
+-- constant integer".
+--
+-- > const int * const f();
+-- > int const * const f();
+--
+-- That is, for pointers, the @const@ qualifier is always written as a suffix!
+-- For example, both of the following declarations declare a pointer to a
+-- constant integer:
+--
+-- > int const * f();
+-- > int const* f();
+--
+-- Did you know that stacked @const@ qualifiers are merged by the C parser:
+--
+-- > const int const * f(); // Parsed as "const int *".
+-- > int const const * f(); // Parsed as "const int *".
+--
+-- It is somewhat difficult to correctly print the @const@ qualifier before
+-- primitive types but after pointers. Hence, we consistently print @const@
+-- _after_ the type. For example, we print return type "constant pointer to
+-- constant int" as follows:
+--
+-- > int const * const f();
+showsType x (C.TypeQual C.QualConst t) = showsType (\d -> showString "const " . x  d) t
+showsType x (C.TypeComplex p) = C.showsPrimType p . showChar ' ' . showString "_Complex " . x 0
+
+-- | The precedence of various constructs in C declarations.
+type CTypePrecedence = Int
+
+-- NOTE: picked somewhat arbitrarily to be larger than 'pointerPrec'
+arrayPrec :: CTypePrecedence
+arrayPrec = 10
+
+-- NOTE: picked somewhat arbitrarily to be smaller than 'arrayPrec'
+pointerPrec :: CTypePrecedence
+pointerPrec = 5
+
+-- | Show function purity in C syntax.
+--
+-- Function purity translates to a @const@ or @pure@ function attribute.
+--
+--
+-- >>> import HsBindgen.Frontend.AST.Decl (FunctionPurity(..))
+--
+-- >>> showsFunctionPurity ImpureFunction ""
+-- ""
+--
+-- >>> showsFunctionPurity HaskellPureFunction ""
+-- "__attribute__ ((const))"
+--
+-- >>> showsFunctionPurity CPureFunction ""
+-- "__attribute__ ((pure))"
+showsFunctionPurity :: C.FunctionPurity -> ShowS
+showsFunctionPurity pur = case pur of
+    C.ImpureFunction -> id
+    C.HaskellPureFunction -> withShowsAttribute "const"
+    C.CPureFunction -> withShowsAttribute "pure"
+  where
+    withShowsAttribute s =
+        showString "__attribute__ (("
+      . showString s
+      . showString "))"
+
+-- | Print a newline after a function attribute, but only if there is an
+-- attribute.
+showAttributeNewline :: C.FunctionPurity -> ShowS
+showAttributeNewline pur = case pur of
+    C.ImpureFunction -> id
+    C.HaskellPureFunction -> showChar '\n'
+    C.CPureFunction -> showChar '\n'
+
+showsId :: IsPass p => Proxy p -> Id p -> ShowS
+showsId p declId =
+    case idSourceName p declId of
+      Just name -> showsDeclName name
+      Nothing   -> panicPure $ "Cannot refer to unnamed decl " ++ show declId
+
+showsDeclName :: C.DeclName -> ShowS
+showsDeclName = showsText . C.renderDeclNameC
+
+showsText :: Text -> ShowS
+showsText = showString . Text.unpack
diff --git a/src-internal/HsBindgen/IR/C/RootDirective.hs b/src-internal/HsBindgen/IR/C/RootDirective.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/RootDirective.hs
@@ -0,0 +1,64 @@
+-- | Root header directives
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.RootDirective qualified as C
+module HsBindgen.IR.C.RootDirective (
+    -- * RootDirective
+    RootDirective(..)
+  , UncheckedRootDirective
+  , hashIncludeArgsOf
+    -- * Rendering
+  , renderRootDirectives
+  ) where
+
+import HsBindgen.Imports
+import HsBindgen.IR.C.HashDefine (HashDefine, hashDefineToDirective)
+import HsBindgen.IR.C.HashIncludeArg (HashIncludeArg (..),
+                                      UncheckedHashIncludeArg)
+
+{-------------------------------------------------------------------------------
+  RootDirective
+-------------------------------------------------------------------------------}
+
+-- | A directive of the root header
+--
+-- The user states @#include@s and @#define@s as a single ordered list, because
+-- the order matters: a @#define@ only affects the headers included after it.
+--
+-- The parameter is the @#include@ argument, which has an unchecked (as given by
+-- the user) and a checked form; @#define@s need no checking.
+data RootDirective arg =
+    DirectiveHashInclude arg
+  | DirectiveHashDefine  HashDefine
+  deriving stock (Show, Eq, Generic, Functor, Foldable, Traversable)
+
+-- | Root directive with an unchecked @#include@ argument
+type UncheckedRootDirective = RootDirective UncheckedHashIncludeArg
+
+-- | The @#include@ arguments, in order, discarding the @#define@s
+--
+-- For consumers that genuinely only care about the headers.
+hashIncludeArgsOf :: [RootDirective arg] -> [arg]
+hashIncludeArgsOf = concatMap toList
+
+{-------------------------------------------------------------------------------
+  Rendering
+-------------------------------------------------------------------------------}
+
+-- | Render root directives, one per line, in order
+--
+-- This is the single source of truth for the C source seen by /all/ C stages:
+-- the root header parsed by @libclang@, the generated CAPI wrapper source
+-- compiled by GHC, and the generated C test source.
+renderRootDirectives :: [RootDirective HashIncludeArg] -> String
+renderRootDirectives = unlines . map render
+  where
+    render :: RootDirective HashIncludeArg -> String
+    render = \case
+      DirectiveHashInclude arg -> "#include <" ++ arg.path ++ ">"
+      DirectiveHashDefine  d   -> hashDefineToDirective d
diff --git a/src-internal/HsBindgen/IR/C/Type.hs b/src-internal/HsBindgen/IR/C/Type.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/C/Type.hs
@@ -0,0 +1,915 @@
+-- | C types (use sites)
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.C" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.C" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.C.Type qualified as C
+module HsBindgen.IR.C.Type (
+    -- * Definition
+    Type
+  , TypeF(
+       TypePrim
+     , TypeComplex
+     , TypeRef
+     , TypeEnum
+     , TypeMacro
+     , TypeTypedef
+     , TypePointers
+     , TypeConstArray
+     , TypeIncompleteArray
+     , TypeFun
+     , TypeVoid
+     , TypeBlock
+     , TypeQual
+     , TypeExtBinding
+     )
+  , TypeFunArg
+  , TypeFunArgF(..)
+
+    -- ** Qualifiers
+  , TypeQual(..)
+
+    -- ** References
+  , Ref(..)
+  , EnumRef
+  , MacroRef(..)
+  , TypedefRef
+  , ExtBindingRef
+  , AnonRef (..)
+  , anonRefType
+
+    -- * Normal forms
+  , Normalize(..)
+  , getCanonicalType
+
+    -- * Queries
+  , depsOfType
+  , depsOfTypeFunArg
+  , hasUnsupportedType
+  , getAllFunTypeIndirections
+  , getAllFunTypes
+  , getFirstFunTypeIndirection
+
+    -- * Classification
+  , isVoid
+  , isCanonicalTypeComplex
+  , isCanonicalTypeFunction
+  , isCanonicalTypeStruct
+  , isCanonicalTypeUnion
+  , isCanonicalTypeArray
+  , isErasedTypeConstQualified
+
+    -- * CoercePass
+  , CoercePassExtBindingRef(..)
+  ) where
+
+import Data.Foldable qualified as Foldable
+import Data.Set qualified as Set
+
+import HsBindgen.Errors (panicPure)
+import HsBindgen.Frontend.Analysis
+import HsBindgen.Imports
+import HsBindgen.IR.C.Naming qualified as C
+import HsBindgen.IR.Pass.Ann
+import HsBindgen.IR.Pass.Definition
+import HsBindgen.IR.Pass.ExtBinding
+import HsBindgen.IR.Pass.Id
+import HsBindgen.IR.Pass.Macro
+import HsBindgen.Language.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+type Type = FullType
+
+-- | C type (use site)
+data TypeF (tag :: TypeTag) (p :: Pass) =
+    -- | Primitive type
+    TypePrim C.PrimType
+
+    -- | Complex type (such as @float complex@)
+  | TypeComplex C.PrimType
+
+    -- | Reference to named type other than an @enum@, macro type or @typedef@
+  | TypeRef (Id p)
+
+    -- | Reference to an @enum@
+    --
+    -- NOTE: strictness annotations help GHC infer redundant pattern matches
+  | TypeEnum !(TypeEnumRefF tag p)
+
+    -- | Reference to a macro type
+    --
+    -- NOTE: strictness annotations help GHC infer redundant pattern matches
+  | TypeMacro !(TypeMacroRefF tag p)
+
+    -- | Reference to a @typedef@
+    --
+    -- NOTE: strictness annotations help GHC infer redundant pattern matches
+  | TypeTypedef !(TypedefRefF tag p)
+
+    -- | Pointer
+    --
+    -- This is /one/ layer of indirection.  See also 'TypePointers'.
+  | TypeUnsafePointer (TypeF tag p)
+
+    -- | Array of constant size
+  | TypeConstArray Natural (TypeF tag p)
+
+    -- | Array of unknown size
+    --
+    -- Arrays normally have a known size, but not always:
+    --
+    -- * Arrays of unknown size are allowed as function arguments; such arrays
+    --   are interpreted as pointers.
+    -- * Arrays of unknown size may be declared for externs; this is considered
+    --   an incomplete type.
+    -- * Structs may contain an array of undefined size as their last field,
+    --   known as a "flexible array member" (FLAM).
+    --
+    -- We treat the FLAM case separately.
+    --
+    -- See <https://en.cppreference.com/w/c/language/array#Arrays_of_unknown_size>
+  | TypeIncompleteArray (TypeF tag p)
+
+    -- | Functions
+  | TypeFun [TypeFunArgF tag p] (TypeF tag p)
+
+    -- | Void
+    --
+    -- NOTE: @void@ has different meanings in C, depending on context.
+  | TypeVoid
+
+    -- | Blocks
+    --
+    -- Blocks are a clang-specific C extension.
+    --
+    -- See <https://clang.llvm.org/docs/BlockLanguageSpec.html>
+  | TypeBlock (TypeF tag p)
+
+    -- | Qualified type (such as @const@)
+    --
+    -- NOTE: strictness annotations help GHC infer redundant pattern matches
+  | TypeQual !(TypeQualifierF tag p) (TypeF tag p)
+
+    -- | Type with an external binding
+    --
+    -- NOTE: strictness annotations help GHC infer redundant pattern matches
+  | TypeExtBinding !(TypeExtBindingRefF tag p)
+  deriving stock Generic
+
+deriving stock instance ValidTypeTag tag p => Eq   (TypeF tag p)
+deriving stock instance ValidTypeTag tag p => Ord  (TypeF tag p)
+deriving stock instance ValidTypeTag tag p => Show (TypeF tag p)
+
+type TypeFunArg = TypeFunArgF Full
+
+-- | C types in function argument positions
+--
+-- Separate types are used to represent function arguments in declarations
+-- ('HsBindgen.IR.C.Decl.FunctionArg') and function arguments in types.
+--
+-- * An argument in a declaration may have a name, while type arguments do not
+--   have names.
+-- * We translate declaration arguments to Haskell, while recursively
+--   translating type arguments is not necessary.
+--
+-- Both of these types use the @TypeFunArg@ annotation, however.
+data TypeFunArgF (tag :: TypeTag) (p :: Pass) = TypeFunArgF {
+    typ :: TypeF tag p
+  , ann :: Ann "TypeFunArg" p
+  }
+  deriving stock (Generic)
+
+deriving stock instance ValidTypeTag tag p => Eq   (TypeFunArgF tag p)
+deriving stock instance ValidTypeTag tag p => Show (TypeFunArgF tag p)
+deriving stock instance ValidTypeTag tag p => Ord  (TypeFunArgF tag p)
+
+-- | Map 'TypeF's from one tag to another
+mapTypeF :: forall tag tag' p.
+     -- | What to do when encountering a typedef reference.
+     (TypedefRefF tag p -> TypeF tag' p)
+     -- | What to do when encountering a type qualifier.
+  -> (TypeQualifierF tag p -> TypeF tag p -> TypeF tag' p)
+     -- | What to do when encountering an external binding reference.
+  -> (TypeExtBindingRefF tag p -> TypeF tag' p)
+     -- | What to do when encountering a macro type reference.
+  -> (TypeMacroRefF tag p -> TypeF tag' p)
+  -- | What to do when encountering an enum reference.
+  -> (TypeEnumRefF tag p -> TypeF tag' p)
+  -> TypeF tag  p
+  -> TypeF tag' p
+mapTypeF fTypedefRef fQual fExtBindingRef fMacroRef fEnumRef = go
+  where
+    go :: TypeF tag p -> TypeF tag' p
+    go ty = case ty of
+      TypePrim pt           -> TypePrim pt
+      TypeComplex pt        -> TypeComplex pt
+      TypeRef declId        -> TypeRef declId
+      TypeEnum ref          -> fEnumRef ref
+      TypeMacro ref         -> fMacroRef ref
+      TypeTypedef ref       -> fTypedefRef ref
+      TypePointers n t      -> TypePointers n $ go t
+      TypeConstArray n t    -> TypeConstArray n $ go t
+      TypeIncompleteArray t -> TypeIncompleteArray (go t)
+      TypeFun args res      -> TypeFun (fmap goTypeFunArg args) (go res)
+      TypeVoid              -> TypeVoid
+      TypeBlock t           -> TypeBlock (go t)
+      TypeQual q t          -> fQual q t
+      TypeExtBinding ref    -> fExtBindingRef ref
+
+    goTypeFunArg :: TypeFunArgF tag p -> TypeFunArgF tag' p
+    goTypeFunArg arg = TypeFunArgF {
+          typ = go arg.typ
+        , ann = arg.ann
+        }
+
+{-------------------------------------------------------------------------------
+  Qualifiers
+-------------------------------------------------------------------------------}
+
+data TypeQual =
+    QualConst
+  deriving stock (Eq, Generic, Ord, Show)
+
+{-------------------------------------------------------------------------------
+  References
+-------------------------------------------------------------------------------}
+
+-- | A reference (by name) to another type, annotated with an underlying type
+--
+-- Reference types include:
+--
+-- * struct reference
+-- * union reference
+-- * enum reference
+-- * typedef reference
+-- * macro typedef reference
+-- * external binding reference
+--
+-- See 'TypedefRef' and 'ExtBindingRef' for examples.
+data Ref a (p :: Pass) = Ref {
+    -- | The reference type: a name
+    --
+    -- NOTE: strictness annotations help GHC infer redundant pattern matches
+    name :: !a
+    -- | The underlying type.
+    --
+    -- NOTE: the underlying type can arbitrarily reference other types,
+    -- including references that we have not parsed, mangled, modified, resolved
+    -- (binding specs), etc.  Use the underlying type with care!
+  , underlying :: Type p
+  }
+  deriving stock (Eq, Generic, Ord, Show)
+
+-- | @enum@ reference
+--
+-- > enum E : u_int { e };
+-- > extern enum E x;
+--
+-- The type of the global variable @x@ is roughly:
+--
+-- > Ref { ref = "E", underlying = TypePrim u_int }
+type EnumRef p = Ref (Id p) p
+
+-- | A reference to a macro use site.
+--
+-- Structurally similar to 'Ref' but the 'underlying' field is driven by the
+-- 'MacroUnderlying' associated type family, so it can be a placeholder (@()@)
+-- during the
+-- 'HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.ReparseMacroExpansions'
+-- pass and the real @'Type' p@ after the pass is finished.
+--
+-- For example, if we have this C code:
+--
+-- > #define T int
+-- > extern T x;
+--
+-- The type of the global variable @x@ is roughly:
+--
+-- > MacroRef { name = macroIdOfT, underlying = TypePrim int }
+data MacroRef p = MacroRef {
+    name       :: !(MacroId p)
+  , underlying :: !(MacroUnderlying p)
+  }
+  deriving stock (Generic)
+
+deriving stock instance
+     (Eq (MacroId p), Eq (MacroUnderlying p))
+  => Eq (MacroRef p)
+deriving stock instance
+     (Ord (MacroId p), Ord (MacroUnderlying p))
+  => Ord (MacroRef p)
+deriving stock instance
+     (Show (MacroId p), Show (MacroUnderlying p))
+  => Show (MacroRef p)
+
+-- | @typedef@ reference
+--
+-- For example, if we have this C code:
+--
+-- > typedef int T;
+-- > extern T x;
+--
+-- The type of the global variable @x@ is roughly:
+--
+-- > Ref { name = "T", underlying = TypePrim int }
+type TypedefRef p = Ref (Id p) p
+
+-- | External binding reference
+--
+-- For example, if we have this C code:
+--
+-- > struct S {};
+-- > extern S x;
+--
+-- The type of the global variable @x@ is roughly:
+--
+-- > Ref { name = ResolvedBinding "S", underlying = TypeRef ("S", StructKind) }
+type ExtBindingRef p = Ref (ExtBinding p) p
+
+-- | A reference to an anonymous struct or union
+data AnonRef p =
+    AnonRef (Id p)
+    -- NOTE: strictness annotations help GHC infer redundant pattern matches
+  | AnonExtBinding !(ExtBindingRef p)
+
+anonRefType :: AnonRef p -> Type p
+anonRefType = \case
+    AnonRef ref -> TypeRef ref
+    AnonExtBinding ext -> TypeExtBinding ext
+
+deriving instance (Eq (Id p), Eq (ExtBindingRef p)) => Eq (AnonRef p)
+deriving instance (Show (Id p), Show (ExtBindingRef p)) => Show (AnonRef p)
+
+{-------------------------------------------------------------------------------
+  Normal forms
+
+  Trees That Grow, but used as Trees That Shrink. Setting these type families to
+  'Void' makes it impossible to construct or match on some of the constructors
+  in the 'TypeF' datatype.
+-------------------------------------------------------------------------------}
+
+data TypeTag =
+    -- | Full C type, includes all C type constructs
+    Full
+    -- | No @typedef@s, external binding specification references, macro-defined
+    -- types, or @enum@s
+  | Erased
+    -- | All sugar (typedefs and qualifiers like @const@) removed
+  | Canonical
+
+type FullType      = TypeF Full
+type ErasedType    = TypeF Erased
+type CanonicalType = TypeF Canonical
+
+-- | Normal forms of types
+class ( PassAnn        p
+      , PassExtBinding p
+      , PassId         p
+      , PassMacro      p
+
+      , Show (TypeEnumRefF tag p)
+      , Eq   (TypeEnumRefF tag p)
+      , Ord  (TypeEnumRefF tag p)
+
+      , Show (TypeMacroRefF tag p)
+      , Eq   (TypeMacroRefF tag p)
+      , Ord  (TypeMacroRefF tag p)
+
+      , Show (TypedefRefF tag p)
+      , Eq   (TypedefRefF tag p)
+      , Ord  (TypedefRefF tag p)
+
+      , Show (TypeQualifierF tag p)
+      , Eq   (TypeQualifierF tag p)
+      , Ord  (TypeQualifierF tag p)
+
+      , Show (TypeExtBindingRefF tag p)
+      , Eq   (TypeExtBindingRefF tag p)
+      , Ord  (TypeExtBindingRefF tag p)
+      ) => ValidTypeTag (tag :: TypeTag) (p :: Pass) where
+  type family TypeEnumRefF       tag p :: Star
+  type family TypeMacroRefF      tag p :: Star
+  type family TypedefRefF        tag p :: Star
+  type family TypeQualifierF     tag p :: Star
+  type family TypeExtBindingRefF tag p :: Star
+
+instance (
+      PassAnn        p
+    , PassExtBinding p
+    , PassId         p
+    , PassMacro      p
+    ) => ValidTypeTag Full p where
+  type instance TypeEnumRefF       Full p = EnumRef p
+  type instance TypeMacroRefF      Full p = MacroRef p
+  type instance TypedefRefF        Full p = TypedefRef p
+  type instance TypeQualifierF     Full p = TypeQual
+  type instance TypeExtBindingRefF Full p = ExtBindingRef p
+
+instance (
+      PassAnn        p
+    , PassExtBinding p
+    , PassId         p
+    , PassMacro      p
+    ) => ValidTypeTag Erased p where
+  type instance TypeEnumRefF       Erased p = Void
+  type instance TypeMacroRefF      Erased p = Void
+  type instance TypedefRefF        Erased p = Void
+  type instance TypeQualifierF     Erased p = TypeQual
+  type instance TypeExtBindingRefF Erased p = Void
+
+instance (
+      PassAnn        p
+    , PassExtBinding p
+    , PassId         p
+    , PassMacro      p
+    ) => ValidTypeTag Canonical p where
+  type instance TypeEnumRefF       Canonical p = Void
+  type instance TypeMacroRefF      Canonical p = Void
+  type instance TypedefRefF        Canonical p = Void
+  type instance TypeQualifierF     Canonical p = Void
+  type instance TypeExtBindingRefF Canonical p = Void
+
+{-------------------------------------------------------------------------------
+  Pattern synonyms for safe pointer handling
+-------------------------------------------------------------------------------}
+
+-- | Bidirectional pattern synonym for N layers of pointer indirection
+--
+-- This pattern can be used both for matching and construction.
+--
+-- Examples (matching):
+--   * @TypePointers 1 inner@ matches @TypeUnsafePointer inner@
+--   * @TypePointers 2 inner@ matches @TypeUnsafePointer (TypeUnsafePointer inner)@
+--   * @TypePointers 3 inner@ matches @TypeUnsafePointer (TypeUnsafePointer (TypeUnsafePointer inner))@
+--
+-- Examples (construction):
+--   * @TypePointers 1 someType@ creates @TypeUnsafePointer someType@
+--   * @TypePointers 2 someType@ creates @TypeUnsafePointer (TypeUnsafePointer someType)@
+--
+-- The inner type can be anything (TypeFun, TypeRef, TypePrim, etc.).
+pattern TypePointers :: Int -> TypeF tag p -> TypeF tag p
+pattern TypePointers n inner <- (stripPointersF -> Just (n, inner))
+  where
+    TypePointers n inner = buildPointersF n inner
+
+-- | Helper for 'TypePointers' pattern synonym (matching direction)
+--
+-- Strips all pointer layers and returns the count and inner type.  Returns
+-- 'Nothing' if there are no pointer layers.
+stripPointersF :: TypeF tag p -> Maybe (Int, TypeF tag p)
+stripPointersF = go 0
+  where
+    go :: Int -> TypeF tag p -> Maybe (Int, TypeF tag p)
+    go !n (TypeUnsafePointer inner) = go (n + 1) inner
+    go !n inner
+      | n > 0     = Just (n, inner)
+      | otherwise = Nothing
+
+-- | Helper for 'TypePointers' pattern synonym (construction direction)
+--
+-- Builds N layers of pointers around an inner type.
+buildPointersF :: Int -> TypeF tag p -> TypeF tag p
+buildPointersF n inner
+  | n <= 0    = inner
+  | otherwise = TypeUnsafePointer (buildPointersF (n - 1) inner)
+
+-- | COMPLETE pragma to ensure exhaustiveness checking works
+--
+-- This tells GHC that pattern matching on these patterns (instead of the raw
+-- @TypeUnsafePointer@) is complete and exhaustive.
+{-# COMPLETE
+       TypePrim
+     , TypeComplex
+     , TypeRef
+     , TypeEnum
+     , TypeMacro
+     , TypeTypedef
+     , TypePointers
+     , TypeConstArray
+     , TypeIncompleteArray
+     , TypeFun
+     , TypeVoid
+     , TypeBlock
+     , TypeQual
+     , TypeExtBinding
+  #-}
+
+_completePragmaCoversAllCases :: TypeF tag p -> ()
+_completePragmaCoversAllCases = \case
+    TypePrim{}            -> ()
+    TypeComplex{}         -> ()
+    TypeRef{}             -> ()
+    TypeEnum{}            -> ()
+    TypeMacro{}           -> ()
+    TypeTypedef{}         -> ()
+    TypeUnsafePointer{}   -> ()
+    TypeConstArray{}      -> ()
+    TypeIncompleteArray{} -> ()
+    TypeFun{}             -> ()
+    TypeVoid{}            -> ()
+    TypeBlock{}           -> ()
+    TypeQual{}            -> ()
+    TypeExtBinding{}      -> ()
+
+{-------------------------------------------------------------------------------
+  Computing normal forms
+-------------------------------------------------------------------------------}
+
+-- | Normal-form computation.
+--
+-- Normalization recurses into 'MacroRef.underlying', which only makes sense if
+-- 'MacroUnderlying p ~ Type p'. During the
+-- 'HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.ReparseMacroExpansions'
+-- pass, the 'MacroUnderlying' is temporarily set to @()@.
+class Normalize tag tag' where
+  normalize :: (
+      MacroUnderlying p ~ Type p
+    ) => TypeF tag p -> TypeF tag' p
+
+instance Normalize tag tag where
+  normalize = id
+
+-- | Erase @typedef@s
+--
+-- The algorithm to erase @typedef@s is simple.  Replace any references to
+-- @typedef@s we find by the definitions of these @typedef@s.  The @typedef@
+-- definitions that we inline this way can contain references to other
+-- @typedef@s, but they can not construct infinitely long types, so this
+-- algorithm will terminate sooner or later.  In practice, @typedef@ \"chains\"
+-- are probably not that long, so we do not expect this algorithm to have
+-- problematic performance.
+instance Normalize Full Erased where
+  normalize :: forall p.
+       MacroUnderlying p ~ Type p
+    => TypeF Full p
+    -> TypeF Erased p
+  normalize = mapTypeF fTypedefRef fQual fExtBindingRef fMacroRef fEnumRef
+    where
+      fTypedefRef :: TypedefRef p -> TypeF Erased p
+      fTypedefRef ref = normalize ref.underlying
+
+      fQual :: TypeQual -> TypeF Full p -> TypeF Erased p
+      fQual qual typ = TypeQual qual $ normalize typ
+
+      fExtBindingRef :: ExtBindingRef p -> TypeF Erased p
+      fExtBindingRef ref = normalize ref.underlying
+
+      fMacroRef :: MacroRef p -> TypeF Erased p
+      fMacroRef ref = normalize ref.underlying
+
+      fEnumRef :: EnumRef p -> TypeF Erased p
+      fEnumRef ref = normalize ref.underlying
+
+instance Normalize Erased Canonical where
+  normalize = mapTypeF absurd fQual absurd absurd absurd
+    where
+      fQual ::
+           MacroUnderlying p ~ Type p
+        => TypeQual
+        -> TypeF Erased p
+        -> TypeF Canonical p
+      fQual _qual typ = normalize typ
+
+instance Normalize Full Canonical where
+  normalize = getCanonicalType . getErasedType
+
+getCanonicalType ::
+     (Normalize tag Canonical, MacroUnderlying p ~ Type p)
+  => TypeF tag p
+  -> CanonicalType p
+getCanonicalType = normalize
+
+getErasedType ::
+     (Normalize tag Erased, MacroUnderlying p ~ Type p)
+  => TypeF tag p
+  -> ErasedType p
+getErasedType = normalize
+
+{-------------------------------------------------------------------------------
+  Queries
+-------------------------------------------------------------------------------}
+
+-- | The declarations this type depends on (direct dependencies only)
+--
+-- We also report what the dependent needs to know about each dependency (full
+-- shape vs. name only).
+depsOfType :: forall p.
+     PassMacro p
+  => Type p
+  -> [(Id p, Dependency)]
+depsOfType = \case
+    -- Primitive types
+    TypePrim _    -> []
+    TypeComplex _ -> []
+    TypeVoid      -> []
+
+    -- Interesting cases
+    TypeRef ref         -> [(ref                           , NeedsShape)]
+    TypeEnum ref        -> [(ref.name                      , NeedsShape)]
+    TypeMacro ref       -> [(macroIdId (Proxy @p) ref.name , NeedsShape)]
+    TypeTypedef ref     -> [(ref.name                      , NeedsShape)]
+    TypeUnsafePointer t -> second (const NeedsNameOnly) <$> depsOfType t
+
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/1467>
+    -- We could in /principle/ use extBindingId here to implement this case
+    -- properly. However, one of the use cases of 'depsOfType' is in a check
+    -- whether a type is defined in the current module; 'extBindingId' currently
+    -- omits the module, so this could result in potentially incorrect
+    -- conclusions (if there happens to be a /another/ type of the same name).
+    -- TypeExtBinding extBinding -> [(NeedsShape, extBindingId (Proxy @p) extBinding)]
+    TypeExtBinding _extBinding -> []
+
+    -- Recurse
+    TypeConstArray _    t -> depsOfType t
+    TypeIncompleteArray t -> depsOfType t
+    TypeBlock           t -> depsOfType t
+    TypeQual _          t -> depsOfType t
+    TypeFun args res      -> concatMap depsOfTypeFunArg args <> depsOfType res
+
+depsOfTypeFunArg ::
+     PassMacro p
+  => TypeFunArgF Full p
+  -> [(Id p, Dependency)]
+depsOfTypeFunArg arg = depsOfType arg.typ
+
+-- | Checks if a type is unsupported by Haskell's FFI
+hasUnsupportedType :: forall tag p.
+     (Normalize tag Canonical, PassId p, MacroUnderlying p ~ Type p)
+  => TypeF tag p
+  -> Bool
+hasUnsupportedType = aux . getCanonicalType
+  where
+    aux :: CanonicalType p -> Bool
+    aux (TypeRef declId)      = auxRef (idNameKind (Proxy @p) declId)
+    aux TypeComplex{}         = True
+    aux TypeConstArray{}      = True
+    aux TypeIncompleteArray{} = True
+    aux TypePrim{}            = False
+    aux TypePointers{}        = False
+    aux TypeFun{}             = False
+    aux TypeVoid              = False
+    aux TypeBlock{}           = False
+
+    -- 'Normalize Full Erased' erases @typedef@s, @enum@s, and type macros.
+    auxRef :: C.NameKind -> Bool
+    auxRef = \case
+      C.NameKindOrdinary               -> panicPure "Unexpected NameKindOrdinary"
+      C.NameKindTagged C.TagKindStruct -> True
+      C.NameKindTagged C.TagKindUnion  -> True
+      C.NameKindTagged C.TagKindEnum   -> panicPure "Unexpected TagKindEnum"
+      C.NameKindMacro                  -> panicPure "Unexpected NameKindMacro"
+
+-- | Recursively accumulate all function types
+getAllFunTypes ::
+     forall p. (PassMacro p, PassId p, PassExtBinding p, PassAnn p)
+  => Type p
+  -> Set ([TypeFunArg p], Type p)
+getAllFunTypes =
+      Set.map (\(_, args, res) -> (args, res))
+    . getFunTypes
+
+-- | Recursively accumulate all function type indirections
+getAllFunTypeIndirections ::
+     forall p. (PassMacro p, PassId p, PassExtBinding p, PassAnn p)
+  => Type p
+  -> Set ([TypeFunArg p], Type p)
+getAllFunTypeIndirections =
+      Set.map (\(_, args, res) -> (args, res))
+    . Set.filter (\(numIndirections, _, _) -> numIndirections > 0)
+    . getFunTypes
+
+-- | Internal function: accumulate function types recursively together with the
+-- number of indirections to get to those function types.
+getFunTypes ::
+     forall p. (PassMacro p, PassId p, PassExtBinding p, PassAnn p)
+  => Type p
+  -> Set (Int, [TypeFunArg p], Type p)
+getFunTypes = go 0 Set.empty
+  where
+    go ::
+         Int
+      -> Set (Int, [TypeFunArg p], Type p)
+      -> Type p
+      -> Set (Int, [TypeFunArg p], Type p)
+    go numIndirections acc = \case
+      -- interesting case
+      TypeFun args res ->
+          let acc' = Set.insert (numIndirections, args, res) acc
+          in  Foldable.foldl' (go (numIndirections + 1)) acc' (fmap (.typ) args ++ [res])
+
+      -- recursive cases
+      TypePointers n t       -> go (numIndirections + n) acc t
+      TypeConstArray _n t    -> go (numIndirections + 1) acc t
+      TypeIncompleteArray  t -> go (numIndirections + 1) acc t
+      TypeBlock t            -> go (numIndirections + 1) acc t
+      TypeQual _q t          -> go (numIndirections + 1) acc t
+
+      -- primitive cases
+      TypePrim{} -> acc
+      TypeComplex{} -> acc
+      TypeVoid{} -> acc
+
+      -- sugar cases
+      TypeRef{} -> acc
+      TypeEnum{} -> acc
+      TypeMacro{} -> acc
+      TypeTypedef{} -> acc
+      TypeExtBinding{} -> acc
+
+-- | Get the first function type indirection
+getFirstFunTypeIndirection ::
+     forall p.
+     Type p
+  -> Maybe ( [TypeFunArg p]
+           , Type p
+           , Type p -> Type p -- ^ zipper: how to reconstruct the original type
+           )
+getFirstFunTypeIndirection = go 0 id
+  where
+    go ::
+         Int
+      -> (Type p -> Type p)
+      -> Type p
+      -> Maybe ( [TypeFunArg p]
+               , Type p
+               , Type p -> Type p
+               )
+    go numIndirections reconstruct = \case
+      -- interesting case
+      TypeFun args res
+        | numIndirections <= 0 -> Nothing
+        | otherwise ->  Just (args, res, reconstruct)
+
+      -- recursive cases
+      TypePointers n t        -> go (numIndirections + n) (reconstruct . TypePointers n) t
+      TypeConstArray n t      -> go (numIndirections + 1) (reconstruct . TypeConstArray n) t
+      TypeIncompleteArray  t  -> go (numIndirections + 1) (reconstruct . TypeIncompleteArray) t
+      TypeBlock t             -> go (numIndirections + 1) (reconstruct . TypeBlock) t
+      TypeQual q t            -> go (numIndirections + 1) (reconstruct . TypeQual q) t
+
+      -- primitive cases
+      TypePrim{} -> Nothing
+      TypeComplex{} -> Nothing
+      TypeVoid{} -> Nothing
+
+      -- sugar cases
+      TypeRef{} -> Nothing
+      TypeEnum{} -> Nothing
+      TypeMacro{} -> Nothing
+      TypeTypedef{} -> Nothing
+      TypeExtBinding{} -> Nothing
+
+{-------------------------------------------------------------------------------
+  Classification: simple classifiers
+-------------------------------------------------------------------------------}
+
+isVoid :: Type p -> Bool
+isVoid TypeVoid = True
+isVoid _        = False
+
+-- | Is the canonical type a complex type?
+isCanonicalTypeComplex ::
+     (Normalize tag Canonical, MacroUnderlying p ~ Type p)
+  => TypeF tag p
+  -> Bool
+isCanonicalTypeComplex ty =
+    case getCanonicalType ty of
+      TypeComplex{} -> True
+      _otherwise    -> False
+
+-- | Is the canonical type a function type?
+isCanonicalTypeFunction ::
+     (Normalize tag Canonical, MacroUnderlying p ~ Type p)
+  => TypeF tag p
+  -> Bool
+isCanonicalTypeFunction ty =
+    case getCanonicalType ty of
+      TypeFun{} -> True
+      _         -> False
+
+-- | Is the canonical type a struct type?
+isCanonicalTypeStruct :: forall tag p.
+     (Normalize tag Canonical, PassId p, MacroUnderlying p ~ Type p)
+  => TypeF tag p -> Bool
+isCanonicalTypeStruct ty =
+    case getCanonicalType ty of
+      TypeRef ref ->
+        idNameKind (Proxy @p) ref == C.NameKindTagged C.TagKindStruct
+      _otherwise  -> False
+
+-- | Is the canonical type a union type?
+isCanonicalTypeUnion :: forall tag p.
+     (Normalize tag Canonical, PassId p, MacroUnderlying p ~ Type p)
+  => TypeF tag p -> Bool
+isCanonicalTypeUnion ty =
+    case getCanonicalType ty of
+      TypeRef ref ->
+        idNameKind (Proxy @p) ref == C.NameKindTagged C.TagKindUnion
+      _otherwise  -> False
+
+-- | Is the canonical type an array type?
+isCanonicalTypeArray ::
+     (Normalize tag Canonical, MacroUnderlying p ~ Type p)
+  => TypeF tag p
+  -> Bool
+isCanonicalTypeArray ty =
+    case getCanonicalType ty of
+      TypeConstArray{}   -> True
+      TypeIncompleteArray{} -> True
+      _                     -> False
+
+-- | Is the erased type @const@-qualified?
+isErasedTypeConstQualified ::
+     (Normalize tag Erased, MacroUnderlying p ~ Type p)
+  => TypeF tag p
+  -> Bool
+isErasedTypeConstQualified ty =
+    case getErasedType ty of
+      -- Types can be directly @const@-qualified,
+      TypeQual QualConst _ -> True
+
+      -- but arrays are also @const@-qualified if their element type is. Note
+      -- that elements of arrays can themselves be arrays, hence we recurse into
+      -- the array element type.
+      TypeConstArray _    ty' -> isErasedTypeConstQualified ty'
+      TypeIncompleteArray ty' -> isErasedTypeConstQualified ty'
+
+      -- And otherwise, the type is not considered to be @const@-qualified.
+      _ -> False
+
+{-------------------------------------------------------------------------------
+  CoercePass
+-------------------------------------------------------------------------------}
+
+-- NOTE: types do not contain 'ScopedName's, so unlike most other 'CoercePass'
+-- instances this one carries no @ScopedName p ~ ScopedName p'@ constraint. This
+-- lets us reindex types across passes that change 'ScopedName' (e.g.
+-- 'HsBindgen.Frontend.Pass.MangleNames.IsPass.CreateNames').
+instance (
+      CoercePassId p p'
+    , CoercePassMacroId p p'
+    , CoercePassMacroUnderlying p p'
+    , CoercePassAnn "TypeFunArg" p p'
+    , ExtBinding p ~ ExtBinding p'
+    ) => CoercePass Type p p' where
+  coercePass = \case
+      TypePrim prim           -> TypePrim prim
+      TypeRef uid             -> TypeRef (goId uid)
+      TypeEnum ref            -> TypeEnum (Ref (goId ref.name) (coercePass ref.underlying))
+      TypeMacro ref           -> TypeMacro (MacroRef (goMacroId ref.name) (goMacroUnderlying ref.underlying))
+      TypeTypedef ref         -> TypeTypedef (Ref (goId ref.name) (coercePass ref.underlying))
+      TypePointers n typ      -> TypePointers n (coercePass typ)
+      TypeFun args res        -> TypeFun (map coercePass args) (coercePass res)
+      TypeVoid                -> TypeVoid
+      TypeConstArray n typ    -> TypeConstArray n (coercePass typ)
+      TypeIncompleteArray typ -> TypeIncompleteArray (coercePass typ)
+      TypeExtBinding ref      -> TypeExtBinding (coercePassExtBindingRef ref)
+      TypeBlock typ           -> TypeBlock (coercePass typ)
+      TypeQual qual typ       -> TypeQual qual (coercePass typ)
+      TypeComplex prim        -> TypeComplex prim
+    where
+      goId :: Id p -> Id p'
+      goId = coercePassId (Proxy @'(p, p'))
+
+      goMacroId :: MacroId p -> MacroId p'
+      goMacroId = coercePassMacroId (Proxy @'(p, p'))
+
+      goMacroUnderlying :: MacroUnderlying p -> MacroUnderlying p'
+      goMacroUnderlying = coercePassMacroUnderlying (Proxy @'(p, p'))
+
+instance (
+      CoercePassId p p'
+    , CoercePassExtBindingRef p p'
+    ) => CoercePass AnonRef p p' where
+  coercePass = \case
+      AnonRef ref -> AnonRef $ coercePassId (Proxy @'(p, p')) ref
+      AnonExtBinding ext -> AnonExtBinding $ coercePassExtBindingRef ext
+
+class CoercePassExtBindingRef p p' where
+  coercePassExtBindingRef :: ExtBindingRef p -> ExtBindingRef p'
+
+instance (
+      CoercePass Type p p'
+    , ExtBinding p ~ ExtBinding p'
+    ) => CoercePassExtBindingRef p p' where
+  coercePassExtBindingRef ref = Ref ref.name (coercePass ref.underlying)
+
+-- NOTE: see the 'CoercePass Type' instance for why there is no
+-- @ScopedName p ~ ScopedName p'@ constraint here.
+instance (
+      CoercePassId p p'
+    , CoercePassMacroId p p'
+    , CoercePassMacroUnderlying p p'
+    , CoercePassAnn "TypeFunArg" p p'
+    , ExtBinding p ~ ExtBinding p'
+    ) => CoercePass TypeFunArg p p' where
+  coercePass arg = TypeFunArgF {
+        typ = coercePass arg.typ
+      , ann = coercePassAnn (Proxy @'("TypeFunArg", p, p')) arg.ann
+      }
diff --git a/src-internal/HsBindgen/IR/Hs.hs b/src-internal/HsBindgen/IR/Hs.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Hs.hs
@@ -0,0 +1,14 @@
+-- | Hs AST
+--
+-- From outside the @HsBindgen.IR@ hierarchy, this module should always be used,
+-- /not/ submodules.  Submodules may be used within the @HsBindgen.IR@ hierarchy
+-- to avoid import cycles.
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.IR.Hs qualified as Hs
+module HsBindgen.IR.Hs (
+    module HsBindgen.IR.Hs.Type
+  ) where
+
+import HsBindgen.IR.Hs.Type
diff --git a/src-internal/HsBindgen/IR/Hs/Type.hs b/src-internal/HsBindgen/IR/Hs/Type.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Hs/Type.hs
@@ -0,0 +1,156 @@
+-- | Haskell types
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Hs" should be used.
+--
+-- Within @HsBindgen.IR@, all modules aside from "HsBindgen.IR.Hs" should import
+-- this module qualified for consistency.
+--
+-- > import HsBindgen.IR.Hs.Type qualified as Hs
+module HsBindgen.IR.Hs.Type (
+    PrimType(..)
+  , Type (..)
+    -- * FFI types
+  , FFIFunType(..)
+  , unconsArg
+  , FFIResType(..)
+  , FFIType(..)
+  , ffiExtRef
+  ) where
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+data PrimType =
+      -- * Others
+      PrimVoid
+    | PrimUnit
+
+      -- * Data.Int
+    | PrimInt
+
+      -- * Foreign.C.Types
+    | PrimCChar
+    | PrimCSChar
+    | PrimCUChar
+    | PrimCShort
+    | PrimCUShort
+    | PrimCInt
+    | PrimCUInt
+    | PrimCLong
+    | PrimCULong
+    | PrimCLLong
+    | PrimCULLong
+    | PrimCBool
+    | PrimCFloat
+    | PrimCDouble
+  deriving stock (Eq, Generic, Ord, Show)
+
+data Type =
+    PrimType PrimType
+  | TypRef (Hs.Name Hs.NsTypeConstr)
+      -- | Underlying type (for non-union and non-struct references)
+      (Maybe Type)
+  | ConstArray Natural Type
+  | IncompleteArray Type
+  | PtrArrayElem Type
+  | PtrConstArrayElem Type
+  | Ptr Type
+  | FunPtr Type
+  | PtrConst Type
+  | IO Type
+  | Fun Type Type
+  | ExtBinding Hs.ExtRef BindingSpec.CTypeSpec BindingSpec.HsTypeSpec
+      -- | Underlying type
+      Type
+  | ByteArray
+  | SizedByteArray Natural Natural
+  | Block Type
+  | ComplexType PrimType
+  | StrLit String
+  | WithFlam Type Type
+  | EquivStorable Type
+    -- | 'HsBindgen.Runtime.Struct.IsStructViaReadRaw'
+  | IsStructViaReadRaw Type
+  deriving stock (Generic, Show, Eq)
+
+{-------------------------------------------------------------------------------
+  FFI types
+-------------------------------------------------------------------------------}
+
+-- | A function type using FFI types in argument and result positions
+data FFIFunType = FFIFunType {
+    args :: [FFIType]
+  , res  :: FFIResType
+  }
+  deriving stock (Generic, Show, Eq)
+
+unconsArg :: FFIFunType -> Either (FFIType, FFIFunType) FFIResType
+unconsArg ty = case ty.args of
+    [] -> Right ty.res
+    (arg:args) -> Left (arg, FFIFunType { args = args, res = ty.res })
+
+-- | A function result type using FFI types
+data FFIResType =
+    FFIResUnit
+  | FFIResIOUnit
+  | FFIResIO FFIType
+  | FFIRes FFIType
+  deriving stock (Generic, Show, Eq)
+
+data FFIType =
+    FFIExternal Hs.ExtRef
+
+    -- * Pointers
+  | FFIPtrVoid
+  | FFIFunPtrVoid
+
+    -- * Primitive
+  | FFIPrimCChar
+  | FFIPrimCSChar
+  | FFIPrimCUChar
+  | FFIPrimCShort
+  | FFIPrimCUShort
+  | FFIPrimCInt
+  | FFIPrimCUInt
+  | FFIPrimCLong
+  | FFIPrimCULong
+  | FFIPrimCLLong
+  | FFIPrimCULLong
+  | FFIPrimCBool
+  | FFIPrimCFloat
+  | FFIPrimCDouble
+  deriving stock (Generic, Show, Eq)
+
+-- | Convert an 'FFIType' to an external reference.
+--
+-- NOTE: this is very similar logic to
+-- 'HsBindgen.Backend.SHs.Translation.translateFFIType'. We could try to unify
+-- this in the future.
+ffiExtRef :: FFIType -> Hs.ExtRef
+ffiExtRef = \case
+    FFIExternal r  -> r
+    FFIPtrVoid     -> mkExtRef "HsBindgen.Runtime.Support" "PtrVoid"
+    FFIFunPtrVoid  -> mkExtRef "HsBindgen.Runtime.Support" "FunPtrVoid"
+    FFIPrimCChar   -> mkExtRef "HsBindgen.Runtime.Support" "CChar"
+    FFIPrimCSChar  -> mkExtRef "HsBindgen.Runtime.Support" "CSChar"
+    FFIPrimCUChar  -> mkExtRef "HsBindgen.Runtime.Support" "CUChar"
+    FFIPrimCShort  -> mkExtRef "HsBindgen.Runtime.Support" "CShort"
+    FFIPrimCUShort -> mkExtRef "HsBindgen.Runtime.Support" "CUShort"
+    FFIPrimCInt    -> mkExtRef "HsBindgen.Runtime.Support" "CInt"
+    FFIPrimCUInt   -> mkExtRef "HsBindgen.Runtime.Support" "CUInt"
+    FFIPrimCLong   -> mkExtRef "HsBindgen.Runtime.Support" "CLong"
+    FFIPrimCULong  -> mkExtRef "HsBindgen.Runtime.Support" "CULong"
+    FFIPrimCLLong  -> mkExtRef "HsBindgen.Runtime.Support" "CLLong"
+    FFIPrimCULLong -> mkExtRef "HsBindgen.Runtime.Support" "CULLong"
+    FFIPrimCBool   -> mkExtRef "HsBindgen.Runtime.Support" "CBool"
+    FFIPrimCFloat  -> mkExtRef "HsBindgen.Runtime.Support" "CFloat"
+    FFIPrimCDouble -> mkExtRef "HsBindgen.Runtime.Support" "CDouble"
+  where
+    mkExtRef :: Hs.ModuleName -> Text -> Hs.ExtRef
+    mkExtRef moduleName typeName = Hs.ExtRef moduleName (Hs.UnsafeName typeName)
diff --git a/src-internal/HsBindgen/IR/Pass.hs b/src-internal/HsBindgen/IR/Pass.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass.hs
@@ -0,0 +1,69 @@
+-- | Pass
+--
+-- The IR varies per pass.
+--
+-- From outside the @HsBindgen.IR@ hierarchy, this module should always be used,
+-- /not/ submodules.  Submodules need to be used within the @HsBindgen.IR@
+-- hierarchy to avoid import cycles.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass
+module HsBindgen.IR.Pass (
+    -- * Definition
+    Pass
+    -- * Associated type families
+  , IsPass
+  , PassId(..)
+  , PassScopedName(..)
+  , PassTypes(..)
+  , PassMacro(..)
+  , PassExtBinding(..)
+  , PassCommentDecl(..)
+  , PassAnn(..)
+  , PassMsg(..)
+  , AnnMsg
+    -- * Coercion
+  , CoercePass(..)
+  , CoercePassParam(..)
+  , CoercePassId(..)
+  , CoercePassTypes(..)
+  , CoercePassMacroId(..)
+  , CoercePassMacroBody(..)
+  , CoercePassMacroUnderlying(..)
+  , CoercePassCommentDecl(..)
+  , CoercePassAnn(..)
+    -- * Defaults
+  , NoAnn(..)
+  , NoMsg
+  ) where
+
+import HsBindgen.IR.Pass.Ann
+import HsBindgen.IR.Pass.CommentDecl
+import HsBindgen.IR.Pass.Definition
+import HsBindgen.IR.Pass.ExtBinding
+import HsBindgen.IR.Pass.Id
+import HsBindgen.IR.Pass.Macro
+import HsBindgen.IR.Pass.Msg
+import HsBindgen.IR.Pass.ScopedName
+import HsBindgen.IR.Pass.Types
+
+{-------------------------------------------------------------------------------
+  Associated type families
+-------------------------------------------------------------------------------}
+
+-- | Class alias for all pass classes
+--
+-- An instance is /not/ declared in this module.  Each pass should explicilty
+-- declare the instance, so that an error is shown at that location if any
+-- @Pass*@ instances are missing.
+class (
+      PassAnn         p
+    , PassCommentDecl p
+    , PassId          p
+    , PassExtBinding  p
+    , PassMacro       p
+    , PassMsg         p
+    , PassScopedName  p
+    , PassTypes       p
+    ) => IsPass (p :: Pass)
diff --git a/src-internal/HsBindgen/IR/Pass/Ann.hs b/src-internal/HsBindgen/IR/Pass/Ann.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass/Ann.hs
@@ -0,0 +1,84 @@
+-- | Generic TTG-style annotations
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Pass" should be used.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass.Ann
+module HsBindgen.IR.Pass.Ann (
+    -- * Associated type families
+    PassAnn(..)
+    -- * Coercion
+  , CoercePassAnn(..)
+    -- * Defaults
+  , NoAnn(..)
+  ) where
+
+import HsBindgen.Imports
+import HsBindgen.IR.Pass.Definition
+
+{-------------------------------------------------------------------------------
+  Associated type families
+-------------------------------------------------------------------------------}
+
+class (
+      -- For @Eq DeclKind@ in @DeclIndex@ construction
+      Eq   (Ann "Enum"                 p)
+    , Eq   (Ann "Flam"                 p)
+    , Eq   (Ann "Function"             p)
+    , Eq   (Ann "Global"               p)
+    , Eq   (Ann "ImplicitField"        p)
+    , Eq   (Ann "IndirectField"        p)
+    , Eq   (Ann "RegularField"         p)
+    , Eq   (Ann "Struct"               p)
+    , Eq   (Ann "TypecheckedMacroType" p)
+    , Eq   (Ann "Typedef"              p)
+    , Eq   (Ann "Union"                p)
+
+      -- For de-duplicating types
+    , Eq   (Ann "TypeFunArg"           p)
+    , Ord  (Ann "TypeFunArg"           p)
+
+      -- For debugging
+    , Show (Ann "Decl"                 p)
+    , Show (Ann "Enum"                 p)
+    , Show (Ann "Flam"                 p)
+    , Show (Ann "Function"             p)
+    , Show (Ann "Global"               p)
+    , Show (Ann "ImplicitField"        p)
+    , Show (Ann "IndirectField"        p)
+    , Show (Ann "RegularField"         p)
+    , Show (Ann "Struct"               p)
+    , Show (Ann "TranslationUnit"      p)
+    , Show (Ann "TypeFunArg"           p)
+    , Show (Ann "TypecheckedMacroType" p)
+    , Show (Ann "Typedef"              p)
+    , Show (Ann "Union"                p)
+    ) => PassAnn (p :: Pass) where
+
+  -- | Generic TTG-style annotation
+  --
+  -- For single-constructor datatypes, the index can simply be the name of the
+  -- datatype.  For multi-constructor datatypes, it should be @Type.Constr@ (or
+  -- simply @Constr@ if that is unambiguous).
+  type Ann (ix :: Symbol) p :: Star
+
+{-------------------------------------------------------------------------------
+  Coercion
+-------------------------------------------------------------------------------}
+
+class CoercePassAnn ix p p' where
+  coercePassAnn :: Proxy '(ix, p, p') -> Ann ix p -> Ann ix p'
+
+  default coercePassAnn ::
+       (Ann ix p ~ Ann ix p')
+    => Proxy '(ix, p, p') -> Ann ix p -> Ann ix p'
+  coercePassAnn _ = id
+
+{-------------------------------------------------------------------------------
+  Defaults
+-------------------------------------------------------------------------------}
+
+data NoAnn = NoAnn
+  deriving stock (Eq, Ord, Show)
diff --git a/src-internal/HsBindgen/IR/Pass/CommentDecl.hs b/src-internal/HsBindgen/IR/Pass/CommentDecl.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass/CommentDecl.hs
@@ -0,0 +1,48 @@
+-- | Declaration comments
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Pass" should be used.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass.CommentDecl
+module HsBindgen.IR.Pass.CommentDecl (
+    -- * Associated type families
+    PassCommentDecl(..)
+    -- * Coercion
+  , CoercePassCommentDecl(..)
+  ) where
+
+import HsBindgen.Imports
+import HsBindgen.IR.Pass.Definition
+
+{-------------------------------------------------------------------------------
+  Associated type families
+-------------------------------------------------------------------------------}
+
+-- | Declaration comments vary across passes
+class (
+      Eq   (CommentDecl p)
+    , Show (CommentDecl p)  -- For debugging
+    ) => PassCommentDecl (p :: Pass) where
+
+  -- | Type of comments attached to declarations
+  --
+  -- 1. Before 'HsBindgen.Frontend.Pass.EnrichComments.IsPass.EnrichComments',
+  --   this is '()', to statically encode that comments cannot exist yet.
+  -- 2. After 'HsBindgen.Frontend.Pass.EnrichComments.IsPass.EnrichComments',
+  --   this is @'Maybe' ('HsBindgen.IR.C.Decl.Comment' p)@.
+  type CommentDecl p :: Star
+  type CommentDecl p = ()
+
+{-------------------------------------------------------------------------------
+  Coercion
+-------------------------------------------------------------------------------}
+
+class CoercePassCommentDecl (p :: Pass) (p' :: Pass) where
+  coercePassCommentDecl :: Proxy '(p, p') -> CommentDecl p -> CommentDecl p'
+
+  default coercePassCommentDecl ::
+       (CommentDecl p ~ CommentDecl p')
+    => Proxy '(p, p') -> CommentDecl p -> CommentDecl p'
+  coercePassCommentDecl _ = id
diff --git a/src-internal/HsBindgen/IR/Pass/Definition.hs b/src-internal/HsBindgen/IR/Pass/Definition.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass/Definition.hs
@@ -0,0 +1,45 @@
+-- | Pass definition
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Pass" should be used.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass.Definition
+module HsBindgen.IR.Pass.Definition (
+    -- * Definition
+    Pass
+    -- * Coercion
+  , CoercePass(..)
+  , CoercePassParam(..)
+  ) where
+
+import HsBindgen.Imports
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+-- | Kind of passes
+--
+-- Example:
+--
+-- > type Parsed :: Pass
+-- > data Parsed a
+--
+-- This is an open kind, primarily to avoid 'HsBindgen.IR.Pass.IsPass'
+-- orphans.
+type Pass = PassSimulatedOpenKind -> Star
+
+-- | Internal type used only to simulate an open kind. Not exported.
+data PassSimulatedOpenKind
+
+{-------------------------------------------------------------------------------
+  Coercion
+-------------------------------------------------------------------------------}
+
+class CoercePass a p p' where
+  coercePass :: a p -> a p'
+
+class CoercePassParam a p p' where
+  coercePassParam :: a p l -> a p' l
diff --git a/src-internal/HsBindgen/IR/Pass/ExtBinding.hs b/src-internal/HsBindgen/IR/Pass/ExtBinding.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass/ExtBinding.hs
@@ -0,0 +1,42 @@
+-- | External binding annotations
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Pass" should be used.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass.ExtBinding
+module HsBindgen.IR.Pass.ExtBinding (
+    -- * Associated type families
+    PassExtBinding(..)
+  ) where
+
+import HsBindgen.Imports
+import HsBindgen.IR.Pass.Definition
+import HsBindgen.IR.Pass.Id
+
+{-------------------------------------------------------------------------------
+  Associated type families
+-------------------------------------------------------------------------------}
+
+-- | External binding annotations vary across passes
+class (
+      Eq   (ExtBinding p)  -- For @Eq DeclKind@ in @DeclIndex@ construction
+    , Ord  (ExtBinding p)  -- For de-duplicating types
+    , Show (ExtBinding p)  -- For debugging
+    ) => PassExtBinding (p :: Pass) where
+
+  -- | External binding specification
+  --
+  -- 1. Before
+  --   'HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass.ResolveBindingSpecs',
+  --   this is 'Void'.
+  -- 2. After
+  --   'HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass.ResolveBindingSpecs',
+  --   this is 'ResolvedExtBinding'.
+  type ExtBinding p :: Star
+  type ExtBinding p = Void
+
+  extBindingId :: Proxy p -> ExtBinding p -> Id p
+  default extBindingId :: ExtBinding p ~ Void => Proxy p -> ExtBinding p -> Id p
+  extBindingId _ = absurd
diff --git a/src-internal/HsBindgen/IR/Pass/Id.hs b/src-internal/HsBindgen/IR/Pass/Id.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass/Id.hs
@@ -0,0 +1,74 @@
+-- | Declaration identifiers
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Pass" should be used.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass.Id
+module HsBindgen.IR.Pass.Id (
+    -- * Associated type families
+    PassId(..)
+    -- * Coercion
+  , CoercePassId(..)
+  ) where
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Imports
+import HsBindgen.IR.C.DeclPath qualified as C
+import HsBindgen.IR.C.LocationInfo qualified as C
+import HsBindgen.IR.C.Naming qualified as C
+import HsBindgen.IR.Pass.Definition
+
+{-------------------------------------------------------------------------------
+  Associated type families
+-------------------------------------------------------------------------------}
+
+-- | Declaration identifiers vary across passes
+class (
+      Ord  (Id p)  -- For using as map key
+    , Show (Id p)  -- For debugging
+    ) => PassId (p :: Pass) where
+
+  -- | Declaration identifier
+  --
+  -- 1. After 'HsBindgen.Frontend.Pass.Parse.IsPass.Parse', this is
+  --   'PrelimDeclId'.  Unnamed declarations are assigned an ID based on
+  --   source location.  For everything else, we use the C name.
+  -- 2. After 'HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass.FillUnnamedIds', this
+  --   is 'C.DeclId'.  /Everything/ has a name, because we have assigned names
+  --   to unnamed declarations.
+  -- 3. After 'HsBindgen.Frontend.Pass.MangleNames.IsPass.MangleNames', this is
+  --   'DeclIdPair'.
+  type Id p :: Star
+  type Id p = C.DeclId
+
+  -- | Name kind of the C name
+  idNameKind :: Proxy p -> Id p -> C.NameKind
+  default idNameKind :: Id p ~ C.DeclId => Proxy p -> Id p -> C.NameKind
+  idNameKind _ = (.name.kind)
+
+  -- | Name of the declaration as it appears in the C source, if any
+  idSourceName :: Proxy p -> Id p -> Maybe C.DeclName
+  default idSourceName :: Id p ~ C.DeclId => Proxy p -> Id p -> Maybe C.DeclName
+  idSourceName _ = C.declIdSourceName
+
+  -- | Location information
+  idLocationInfo :: Proxy p -> Id p -> [SingleLoc C.DeclPath] -> C.LocationInfo
+  default idLocationInfo ::
+       Id p ~ C.DeclId
+    => Proxy p -> Id p -> [SingleLoc C.DeclPath] -> C.LocationInfo
+  idLocationInfo _ = C.declIdLocationInfo
+
+{-------------------------------------------------------------------------------
+  Coercion
+-------------------------------------------------------------------------------}
+
+class CoercePassId (p :: Pass) (p' :: Pass) where
+  coercePassId :: Proxy '(p, p') -> Id p -> Id p'
+
+  default coercePassId ::
+       (Id p ~ Id p')
+    => Proxy '(p, p') -> Id p -> Id p'
+  coercePassId _ = id
diff --git a/src-internal/HsBindgen/IR/Pass/Macro.hs b/src-internal/HsBindgen/IR/Pass/Macro.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass/Macro.hs
@@ -0,0 +1,108 @@
+-- | Macros
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Pass" should be used.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass.Macro
+module HsBindgen.IR.Pass.Macro (
+    -- * Associated type families
+    PassMacro(..)
+    -- * Coercion
+  , CoercePassMacroId(..)
+  , CoercePassMacroBody(..)
+  , CoercePassMacroUnderlying(..)
+  ) where
+
+import HsBindgen.Imports
+import HsBindgen.IR.Pass.Definition
+import HsBindgen.IR.Pass.Id
+import HsBindgen.Macro.Type qualified as Macro
+
+{-------------------------------------------------------------------------------
+  Associated type families
+-------------------------------------------------------------------------------}
+
+-- | Macros vary across passes
+class (
+      Eq   (MacroId         p)  -- For @Eq DeclKind@ in @DeclIndex@ construction
+    , Eq   (MacroUnderlying p)  -- For @Eq DeclKind@ in @DeclIndex@ construction
+    , Ord  (MacroId         p)  -- For using as map key
+    , Ord  (MacroUnderlying p)  -- For using as map key
+    , Show (MacroId         p)  -- For debugging
+    , Show (MacroUnderlying p)  -- For debugging
+    , forall l. Macro.HasTypes l => ValidMacroBody p l
+    ) => PassMacro (p :: Pass) where
+
+  -- | Declaration identifier for macro types
+  --
+  -- 1. Before 'HsBindgen.Frontend.Pass.TypecheckMacros.IsPass.TypecheckMacros',
+  --   this is 'Void', as macro types do not exist yet.
+  -- 2. After 'HsBindgen.Frontend.Pass.TypecheckMacros.IsPass.TypecheckMacros',
+  --   this is @'Id' p@.
+  type MacroId p :: Star
+  type MacroId p = Void
+
+  -- | Macro body
+  --
+  -- Typechecking macros is non-trivial, and requires knowledge of other types
+  -- and macros in scope.  We therefore only parse (and not typecheck) macros
+  -- while parsing the LLVM/Clang AST.
+  -- 'HsBindgen.Frontend.Pass.TypecheckMacros.IsPass.TypecheckMacros' then does
+  -- the actual typechecking, instantiating this to
+  -- 'HsBindgen.Frontend.Pass.TypecheckMacros.IsPass.TypecheckedMacro'.
+  type MacroBody p :: Star -> Star
+
+  -- | Underlying type stored in a macro reference
+  --
+  -- 1. Before 'HsBindgen.Frontend.Pass.TypecheckMacros.IsPass.TypecheckMacros',
+  --   this is 'Void', as macro types do not exist yet.
+  -- 2. During
+  --   'HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.ReparseMacroExpansions',
+  --   the reparser produces 'HsBindgen.IR.C.Type.MacroRef' values with a
+  --   placeholder underlying, recording \"a macro is referenced here,
+  --   underlying not yet known\". This unknown underlying type is filled in
+  --   later in the pass using the pre-reparse tree.
+  -- 3. After
+  --   'HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.ReparseMacroExpansions',
+  --   the underlying type will be @'HsBindgen.IR.C.Type.Type' p@.
+  type MacroUnderlying p :: Star
+  type MacroUnderlying p = Void
+
+  macroIdId :: Proxy p -> MacroId p -> Id p
+  default macroIdId :: MacroId p ~ Void => Proxy p -> MacroId p -> Id p
+  macroIdId _ = absurd
+
+-- | Class alias; limitation of quantified constraints
+class    (Eq (MacroBody p l), Show (MacroBody p l)) => ValidMacroBody p l
+instance (Eq (MacroBody p l), Show (MacroBody p l)) => ValidMacroBody p l
+
+{-------------------------------------------------------------------------------
+  Coercion
+-------------------------------------------------------------------------------}
+
+class CoercePassMacroId (p :: Pass) (p' :: Pass) where
+  coercePassMacroId :: Proxy '(p, p') -> MacroId p -> MacroId p'
+
+  default coercePassMacroId ::
+       (MacroId p ~ MacroId p')
+    => Proxy '(p, p') -> MacroId p -> MacroId p'
+  coercePassMacroId _ = id
+
+class CoercePassMacroBody (p :: Pass) (p' :: Pass) where
+  coercePassMacroBody :: Proxy '(p, p') -> MacroBody p l -> MacroBody p' l
+
+  default coercePassMacroBody ::
+       (MacroBody p ~ MacroBody p' )
+    => Proxy '(p, p') -> MacroBody p l -> MacroBody p' l
+  coercePassMacroBody _ = id
+
+class CoercePassMacroUnderlying (p :: Pass) (p' :: Pass) where
+  coercePassMacroUnderlying ::
+    Proxy '(p, p') -> MacroUnderlying p -> MacroUnderlying p'
+
+  default coercePassMacroUnderlying ::
+       (MacroUnderlying p ~ MacroUnderlying p')
+    => Proxy '(p, p') -> MacroUnderlying p -> MacroUnderlying p'
+  coercePassMacroUnderlying _ = id
diff --git a/src-internal/HsBindgen/IR/Pass/Msg.hs b/src-internal/HsBindgen/IR/Pass/Msg.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass/Msg.hs
@@ -0,0 +1,49 @@
+-- | Trace messages
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Pass" should be used.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass.Msg
+module HsBindgen.IR.Pass.Msg (
+    -- * Associated type families
+    PassMsg(..)
+  , AnnMsg
+    -- * Defaults
+  , NoMsg
+  ) where
+
+import HsBindgen.Imports
+import HsBindgen.IR.Pass.Definition
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Associated type families
+-------------------------------------------------------------------------------}
+
+-- | Trace messages vary across passes
+class PassMsg (p :: Pass) where
+
+  -- | Trace messages possibly emitted by a pass
+  type Msg p :: Star
+  type Msg p = NoMsg Level
+
+-- | Trace messages with call-stack annotations
+type AnnMsg :: Pass -> Star
+type AnnMsg p = WithCallStack (Msg p)
+
+{-------------------------------------------------------------------------------
+  Defaults
+-------------------------------------------------------------------------------}
+
+data NoMsg lvl
+  deriving stock (Eq, Ord, Show)
+
+instance IsTrace lvl (NoMsg lvl) where
+  getDefaultLogLevel msg = case msg of {}
+  getSource          msg = case msg of {}
+  getTraceId         msg = case msg of {}
+
+instance PrettyForTrace (NoMsg lvl) where
+  prettyForTrace msg = case msg of {}
diff --git a/src-internal/HsBindgen/IR/Pass/ScopedName.hs b/src-internal/HsBindgen/IR/Pass/ScopedName.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass/ScopedName.hs
@@ -0,0 +1,39 @@
+-- | Scoped names
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Pass" should be used.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass.ScopedName
+module HsBindgen.IR.Pass.ScopedName (
+    -- * Associated type families
+    PassScopedName(..)
+  ) where
+
+import HsBindgen.Imports
+import HsBindgen.IR.C.Naming qualified as C
+import HsBindgen.IR.Pass.Definition
+
+{-------------------------------------------------------------------------------
+  Associated type families
+-------------------------------------------------------------------------------}
+
+-- | Scoped names vary across passes
+class (
+      Eq   (ScopedName p)  -- For @Eq DeclKind@ in @DeclIndex@ construction
+    , Ord  (ScopedName p)  -- For using as map key
+    , Show (ScopedName p)  -- For debugging
+    ) => PassScopedName (p :: Pass) where
+
+  -- | Scoped name
+  --
+  -- This represents a name within a local scope, such as the name of a struct
+  -- fields, a function argument, etc.
+  --
+  -- 1. After 'HsBindgen.Frontend.Pass.Parse.IsPass.Parse', this is
+  --   'C.ScopedName'.
+  -- 2. After 'HsBindgen.Frontend.Pass.MangleNames.IsPass.MangleNames', this is
+  --   'C.ScopedNamePair'.
+  type ScopedName p :: Star
+  type ScopedName p = C.ScopedName
diff --git a/src-internal/HsBindgen/IR/Pass/Types.hs b/src-internal/HsBindgen/IR/Pass/Types.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Pass/Types.hs
@@ -0,0 +1,76 @@
+-- | Types (use sites)
+--
+-- This module should only be used within the @HsBindgen.IR@ hierarchy.  From
+-- outside the @HsBindgen.IR@ hierarchy, "HsBindgen.IR.Pass" should be used.
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Pass.Types
+module HsBindgen.IR.Pass.Types (
+    -- * Associated type families
+    PassTypes(..)
+    -- * Coercion
+  , CoercePassTypes(..)
+  , CoercePassAnonRef(..)
+  ) where
+
+import HsBindgen.Imports
+import HsBindgen.IR.C.Type qualified as C
+import HsBindgen.IR.Pass.Definition
+
+{-------------------------------------------------------------------------------
+  Associated type families
+-------------------------------------------------------------------------------}
+
+-- | Types (use sites) vary across passes
+class (
+      Eq   (AnonRef p)
+    , Eq   (Types p)
+
+    -- For debugging
+    , Show (AnonRef p)
+    , Show (Types p)
+    ) => PassTypes (p :: Pass) where
+
+  -- | Types (use sites)
+  --
+  -- 1. After 'HsBindgen.Frontend.Pass.Parse.IsPass.Parse', this is
+  --    @'C.Type' p@.
+  type Types p :: Star
+  type Types p = C.Type p
+
+  type AnonRef p :: Star
+  type AnonRef p = C.AnonRef p
+
+  -- | C type
+  cType :: Proxy p -> Types p -> C.Type p
+  default cType :: Types p ~ C.Type p => Proxy p -> Types p -> C.Type p
+  cType _ = id
+
+  anonRefTypes :: Proxy p -> AnonRef p -> Types p
+  default anonRefTypes ::
+       (AnonRef p ~ C.AnonRef p, Types p ~ C.Type p)
+    => Proxy p
+    -> AnonRef p
+    -> Types p
+  anonRefTypes _ = C.anonRefType
+
+{-------------------------------------------------------------------------------
+  Coercion
+-------------------------------------------------------------------------------}
+
+class CoercePassTypes (p :: Pass) (p' :: Pass) where
+  coercePassTypes :: Proxy '(p, p') -> Types p -> Types p'
+
+  default coercePassTypes ::
+       (CoercePass C.Type p p', Types p ~ C.Type p, Types p' ~ C.Type p')
+    => Proxy '(p, p') -> Types p -> Types p'
+  coercePassTypes _ = coercePass
+
+class CoercePassAnonRef (p :: Pass) (p' :: Pass) where
+  coercePassAnonRef :: Proxy '(p, p') -> AnonRef p -> AnonRef p'
+
+  default coercePassAnonRef ::
+       (CoercePass C.AnonRef p p', AnonRef p ~ C.AnonRef p, AnonRef p' ~ C.AnonRef p')
+    => Proxy '(p, p') -> AnonRef p -> AnonRef p'
+  coercePassAnonRef _ = coercePass
diff --git a/src-internal/HsBindgen/IR/Translation.hs b/src-internal/HsBindgen/IR/Translation.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/IR/Translation.hs
@@ -0,0 +1,124 @@
+-- | Translation IR
+--
+-- Intended for unqualified import.
+--
+-- > import HsBindgen.IR.Translation
+module HsBindgen.IR.Translation (
+    -- * DeclIdPair
+    DeclIdPair(..)
+  , extDeclIdPair
+    -- * ScopedNamePair
+  , ScopedNamePair(..)
+    -- * Types
+  , TranslatedTypes(..)
+  , TranslatedAnonRef(..)
+  , translatedAnonRefType
+  , translateCPrimType
+  ) where
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.IR.Pass
+import HsBindgen.Language.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  DeclIdPair
+-------------------------------------------------------------------------------}
+
+-- | A t'C.DeclId' paired with a Haskell name
+data DeclIdPair = DeclIdPair {
+      cName  :: C.DeclId
+    , hsName :: Hs.SomeName
+    }
+  deriving stock (Eq, Ord, Show)
+
+-- | Get the 'DeclIdPair' for a 'ResolvedExtBinding'
+extDeclIdPair :: BindingSpec.ResolvedExtBinding -> DeclIdPair
+extDeclIdPair ext = DeclIdPair{
+      cName  = ext.cName
+    , hsName = Hs.demoteNs ext.hsName.name
+    }
+
+{-------------------------------------------------------------------------------
+  ScopedNamePair
+-------------------------------------------------------------------------------}
+
+-- | A t'C.ScopedName' paired with a Haskell name
+data ScopedNamePair = ScopedNamePair {
+      cName  :: C.ScopedName
+      -- TODO <https://github.com/well-typed/hs-bindgen/issues/1927>
+      -- ScopedNamePair only ever refers to type constructors and variable
+      -- names.
+    , hsName :: Hs.SomeName
+    }
+  deriving stock (Eq, Generic, Ord, Show)
+
+{-------------------------------------------------------------------------------
+  Types
+-------------------------------------------------------------------------------}
+
+-- | A t'C.Type' associated with possible Haskell type translations
+data TranslatedTypes (p :: Pass) = TranslatedTypes {
+      c  :: C.Type p
+    , hs :: Hs.Type
+    }
+  deriving stock (Eq, Generic, Show)
+
+instance (
+      CoercePass C.Type p p'
+    ) => CoercePass TranslatedTypes p p' where
+  coercePass translatedTypes = TranslatedTypes{
+      c  = coercePass translatedTypes.c
+    , hs = translatedTypes.hs
+    }
+
+-- | A t'C.AnonRef' associated with possible Haskell type translations
+data TranslatedAnonRef (p :: Pass) = TranslatedAnonRef {
+      c :: C.AnonRef p
+    , hs :: Hs.Type
+    }
+  deriving stock (Eq, Generic, Show)
+
+instance (
+      CoercePass C.AnonRef p p'
+    ) => CoercePass TranslatedAnonRef p p' where
+  coercePass translatedAnonRef = TranslatedAnonRef {
+      c = coercePass translatedAnonRef.c
+    , hs = translatedAnonRef.hs
+    }
+
+translatedAnonRefType :: TranslatedAnonRef p -> TranslatedTypes p
+translatedAnonRefType translatedAnonRef = TranslatedTypes {
+      c = C.anonRefType translatedAnonRef.c
+    , hs = translatedAnonRef.hs
+    }
+
+-- | Translate a primitive type
+translateCPrimType :: C.PrimType -> Hs.PrimType
+translateCPrimType = \case
+    C.PrimBool         -> Hs.PrimCBool
+    C.PrimIntegral i s -> integralType i s
+    C.PrimFloating f   -> floatingType f
+    C.PrimChar sign    -> charType sign
+  where
+    integralType :: C.PrimIntType -> C.PrimSign -> Hs.PrimType
+    integralType C.PrimInt      C.Signed   = Hs.PrimCInt
+    integralType C.PrimInt      C.Unsigned = Hs.PrimCUInt
+    integralType C.PrimShort    C.Signed   = Hs.PrimCShort
+    integralType C.PrimShort    C.Unsigned = Hs.PrimCUShort
+    integralType C.PrimLong     C.Signed   = Hs.PrimCLong
+    integralType C.PrimLong     C.Unsigned = Hs.PrimCULong
+    integralType C.PrimLongLong C.Signed   = Hs.PrimCLLong
+    integralType C.PrimLongLong C.Unsigned = Hs.PrimCULLong
+
+    floatingType :: C.PrimFloatType -> Hs.PrimType
+    floatingType C.PrimFloat  = Hs.PrimCFloat
+    floatingType C.PrimDouble = Hs.PrimCDouble
+
+    charType :: C.PrimSignChar -> Hs.PrimType
+    charType (C.PrimSignImplicit _inferred)  = Hs.PrimCChar
+    charType (C.PrimSignExplicit C.Signed)   = Hs.PrimCSChar
+    charType (C.PrimSignExplicit C.Unsigned) = Hs.PrimCUChar
diff --git a/src-internal/HsBindgen/Imports.hs b/src-internal/HsBindgen/Imports.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Imports.hs
@@ -0,0 +1,49 @@
+{-# OPTIONS_GHC -Wno-orphans #-}
+-- | Common imports
+module HsBindgen.Imports (
+    module X,
+    Star,
+    singleton,
+) where
+
+import Control.Applicative as X (liftA2)
+import Control.Exception as X (Exception, bracket, throwIO)
+import Control.Monad as X (ap, forM, forM_, guard, unless, void, when)
+import Control.Monad.Identity as X (Identity (..))
+import Control.Monad.IO.Class as X (MonadIO (liftIO))
+import Control.Monad.IO.Unlift as X (MonadUnliftIO (withRunInIO))
+import Data.Array.Byte as X
+import Data.Bifunctor as X (Bifunctor (bimap, first, second))
+import Data.Coerce as X (coerce)
+import Data.Default as X (Default (def))
+import Data.Foldable as X (Foldable (foldl', toList), traverse_)
+import Data.Function as X ((&))
+import Data.IntMap.Strict as X (IntMap)
+import Data.IntSet as X (IntSet)
+import Data.Kind qualified
+import Data.List.NonEmpty as X (NonEmpty (..))
+import Data.Map.Strict as X (Map)
+import Data.Maybe as X (catMaybes, fromMaybe, isJust, isNothing, mapMaybe)
+import Data.Nat as X (Nat (S, Z))
+import Data.Proxy as X (Proxy (..))
+import Data.Set as X (Set)
+import Data.Some as X (Some (..))
+import Data.String as X (IsString (fromString))
+import Data.Text as X (Text)
+import Data.Vec.Lazy as X (Vec (..))
+import Data.Void as X (Void, absurd)
+import Debug.Trace as X (traceM, traceShow, traceShowId)
+import GHC.Generics as X (Generic)
+import GHC.Stack as X (HasCallStack, callStack)
+import GHC.TypeLits as X (Symbol)
+import Numeric.Natural as X (Natural)
+import Optics.Core as X (over, set, view, (%), (%~), (.~), (^.))
+
+-- | @Type@ is very clashy name: there's TH.Type, we may want to use Type for
+-- representation of C types, etc.
+--
+-- Let's use Star to refer to Haskell's kind.
+type Star = Data.Kind.Type
+
+singleton :: a -> [a]
+singleton x = [x]
diff --git a/src-internal/HsBindgen/Instances.hs b/src-internal/HsBindgen/Instances.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Instances.hs
@@ -0,0 +1,306 @@
+-- | Instance resolution types
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Instances qualified as Inst
+module HsBindgen.Instances (
+    -- * Core types
+    TypeClass(..)
+  , Dependency(..)
+  , Strategy(..)
+  , Constraint(..)
+  , Instance(..)
+    -- * Supported instances
+  , SupportedInstances(..)
+  , SupportedStrategies(..)
+  ) where
+
+import Data.Map.Strict qualified as Map
+import Data.Ord qualified as Ord
+import Data.Set qualified as Set
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Util.Tracer (PrettyForTrace (prettyForTrace))
+
+{-------------------------------------------------------------------------------
+  Core types
+-------------------------------------------------------------------------------}
+
+-- | Type class
+data TypeClass =
+    Bitfield
+  | Bits
+  | Bounded
+  | CEnum
+  | Enum
+  | Eq
+  | FiniteBits
+  | Flam_Offset
+  | Floating
+  | Fractional
+  | FromFunPtr
+  | Generic
+  | HasCBitfield  -- Indicates instances for all bit fields
+  | HasCField     -- Indicates instances for all non-bit fields
+  | HasFFIType
+    -- | 'GHC.Records.HasField'
+    --
+    -- Indicates instances for all fields (except for union fields in some
+    -- cases, see TODO below).
+     --
+    -- TODO <https://github.com/well-typed/hs-bindgen/issues/1447#issuecomment-4809540458>:
+    -- a union field can only be given a @HasField@ instance if the field's type
+    -- has a @Storable@ instance. @HasField@ instances for some but not all
+    -- union fields can currently not be represented in the 'TypeClass'
+    -- datatype.
+  | HasField
+    -- | 'GHC.Records.Compat.HasField' instance
+    --
+    -- Indicates instances for all fields.
+  | HasFieldCompat
+    -- | 'GHC.Records.HasField' for the pointer manipulation API
+    --
+    -- Indicates instances for all fields.
+  | HasFieldPtr
+  | Integral
+  | IsArray
+  | IsStruct
+  | IsUnion
+  | Ix
+  | Num
+  | Ord
+  | Prim
+  | Read
+  | ReadRaw
+  | Real
+  | RealFloat
+  | RealFrac
+  | SequentialCEnum
+  | Show
+  | StaticSize
+  | Storable
+  | ToFunPtr
+  | WriteRaw
+  deriving stock (Bounded, Enum, Eq, Generic, Read, Show)
+
+-- Order lexicographically, even if somebody adds a constructor out of place
+instance Ord TypeClass where
+  compare = Ord.comparing show
+
+instance PrettyForTrace TypeClass where
+  prettyForTrace = PP.show
+
+--------------------------------------------------------------------------------
+
+-- | Relationship between an instance and dependencies of a type
+data Dependency =
+    -- | An instance depends on instances of dependencies
+    Dependent
+  | -- | An instance does not depend on instances of dependencies
+    Independent
+  deriving stock (Eq, Generic, Show)
+
+--------------------------------------------------------------------------------
+
+-- | Strategy used to generate/derive an instance
+data Strategy =
+    -- | @hs-bindgen@ decides how to generate/derive an instance
+    HsBindgen
+  | -- | Derive an instance using the @newtype@ strategy
+    Newtype
+  | -- | Derive an instance using the @stock@ strategy
+    Stock
+  deriving stock (Bounded, Enum, Eq, Generic, Ord, Show)
+
+instance PrettyForTrace Strategy where
+  prettyForTrace = PP.show
+
+--------------------------------------------------------------------------------
+
+-- | Constraint of an instance
+data Constraint = Constraint {
+      clss :: TypeClass
+    , ref  :: Hs.ExtRef
+    }
+  deriving stock (Eq, Generic, Ord, Show)
+
+--------------------------------------------------------------------------------
+
+-- | Resolved instance
+data Instance = Instance {
+      clss        :: TypeClass
+    , strategy    :: Strategy
+    , constraints :: [Constraint]
+    }
+  deriving stock (Eq, Generic, Ord, Show)
+
+{-------------------------------------------------------------------------------
+  Supported instances
+-------------------------------------------------------------------------------}
+
+-- | Supported instances
+--
+-- This type tracks the instances that may be generated/derived in generated
+-- bindings.  The 'Default' instance of this type specifies the instances and
+-- strategies that are supported by this version of @hs-bindgen@.
+--
+-- If we decide to allow users to configure this, to change which instances are
+-- generated/derived by default, then we should probably provide an API that
+-- ensures that a subset of the supported API is configured.
+--
+-- Per-type configuration, overriding these defaults, is done using prescriptive
+-- binding specifications.
+data SupportedInstances = SupportedInstances {
+      -- | Supported instances for @struct@ types
+      struct    :: Map TypeClass SupportedStrategies
+    , -- | Supported instances for @union@ types
+      union     :: Map TypeClass SupportedStrategies
+    , -- | Supported instances for @enum@ types
+      enum      :: Map TypeClass SupportedStrategies
+    , -- | Supported instances for @typedef@ types
+      typedef   :: Map TypeClass SupportedStrategies
+    , -- | Supported instances for types with Haskell @emptydata@ representation
+      emptydata :: Map TypeClass SupportedStrategies
+    }
+  deriving stock (Show)
+
+-- | Supported strategies for a specific instance
+data SupportedStrategies = SupportedStrategies {
+      -- | Relationship between the instance and dependencies of the type
+      dependency :: Dependency
+
+    , -- | Supported strategies to generate/derive the instance
+      --
+      -- This set must not be empty.
+      strategies :: Set Strategy
+
+    , -- | Default strategy to generate/derive the instance
+      --
+      -- A 'Just' value indicates that the instance may be generated/derived by
+      -- default, with the specified strategy.  A 'Nothing' value indicates that
+      -- the instance may /not/ be generated/derived by default.
+      --
+      -- If specified, the strategy must be a member of 'strategies'.
+      defStrategy :: Maybe Strategy
+    }
+  deriving stock (Show)
+
+instance Default SupportedInstances where
+  def =
+    SupportedInstances{
+        struct = Map.fromList [
+            mkDef Eq             Dependent   Stock     []
+          , mkDef Flam_Offset    Independent HsBindgen []
+          , mkDef Generic        Independent Stock     []
+          , mkDef HasCBitfield   Independent HsBindgen []
+          , mkDef HasCField      Independent HsBindgen []
+          , mkDef HasField       Independent HsBindgen []
+          , mkDef HasFieldCompat Independent HsBindgen []
+          , mkDef HasFieldPtr    Independent HsBindgen []
+          , mkDef IsStruct       Dependent   HsBindgen []
+          , mkOpt Ord            Dependent             [Stock]
+          , mkDef ReadRaw        Dependent   HsBindgen []
+          , mkDef Show           Dependent   Stock     []
+          , mkDef StaticSize     Dependent   HsBindgen []
+          , mkDef Storable       Dependent   HsBindgen []
+          , mkDef WriteRaw       Dependent   HsBindgen []
+          ]
+      , union = Map.fromList [
+            mkDef Generic        Independent Stock     []
+          , mkDef HasCBitfield   Independent HsBindgen []
+          , mkDef HasCField      Independent HsBindgen []
+          , mkDef HasField       Independent HsBindgen []
+          , mkDef HasFieldCompat Independent HsBindgen []
+          , mkDef HasFieldPtr    Independent HsBindgen []
+          , mkDef IsUnion        Dependent   Newtype   []
+          , mkDef ReadRaw        Independent HsBindgen []
+          , mkDef StaticSize     Independent HsBindgen []
+          , mkDef Storable       Independent HsBindgen []
+          , mkDef WriteRaw       Independent HsBindgen []
+          ]
+      , enum = Map.fromList [
+            mkOpt Bounded         Independent           [HsBindgen, Newtype]
+          , mkDef CEnum           Independent HsBindgen []
+          , mkOpt Enum            Independent           [HsBindgen, Newtype]
+          , mkDef Eq              Dependent   Stock     []
+          , mkDef Generic         Independent Stock     []
+          , mkDef HasCField       Independent HsBindgen []
+          , mkDef HasFFIType      Dependent   Newtype   []
+          , mkDef HasField        Independent HsBindgen []
+          , mkDef HasFieldCompat  Independent HsBindgen []
+          , mkDef HasFieldPtr     Independent HsBindgen []
+          , mkDef Ord             Dependent   Stock     []
+          , mkDef Prim            Independent HsBindgen []
+          , mkDef Read            Independent HsBindgen [Newtype, Stock]
+          , mkDef ReadRaw         Independent HsBindgen []
+          , mkDef SequentialCEnum Independent HsBindgen []
+          , mkDef Show            Independent HsBindgen [Newtype, Stock]
+          , mkDef StaticSize      Independent HsBindgen []
+          , mkDef Storable        Independent HsBindgen []
+          , mkDef WriteRaw        Independent HsBindgen []
+          ]
+      , typedef = Map.fromList [
+            mkDef Bitfield        Dependent   Newtype   []
+          , mkDef Bits            Dependent   Newtype   []
+          , mkDef Bounded         Dependent   Newtype   []
+          , mkDef Enum            Dependent   Newtype   []
+          , mkDef Eq              Dependent   Stock     []
+          , mkDef FiniteBits      Dependent   Newtype   []
+          , mkDef Floating        Dependent   Newtype   []
+          , mkDef Fractional      Dependent   Newtype   []
+          , mkDef FromFunPtr      Independent HsBindgen []
+          , mkDef Generic         Independent Stock     []
+          , mkDef HasCField       Independent HsBindgen []
+          , mkDef HasFFIType      Dependent   Newtype   []
+          , mkDef HasField        Independent HsBindgen []
+          , mkDef HasFieldCompat  Independent HsBindgen []
+          , mkDef HasFieldPtr     Independent HsBindgen []
+          , mkDef Integral        Dependent   Newtype   []
+            -- TODO: instance resolution for 'IsArray' is currently
+            -- special-cased because for 'IsArray' instances we don't have to
+            -- check all dependencies. See issue #1739.
+          , mkDef IsArray         Dependent   Newtype   []
+          , mkDef Ix              Dependent   Newtype   []
+          , mkDef Num             Dependent   Newtype   []
+          , mkDef Ord             Dependent   Stock     []
+          , mkDef Prim            Dependent   Newtype   []
+          , mkDef Read            Dependent   Stock     [Newtype]
+          , mkDef ReadRaw         Dependent   Newtype   []
+          , mkDef Real            Dependent   Newtype   []
+          , mkDef RealFloat       Dependent   Newtype   []
+          , mkDef RealFrac        Dependent   Newtype   []
+          , mkDef Show            Dependent   Stock     [Newtype]
+          , mkDef StaticSize      Dependent   Newtype   []
+          , mkDef Storable        Dependent   Newtype   []
+          , mkDef ToFunPtr        Independent HsBindgen []
+          , mkDef WriteRaw        Dependent   Newtype   []
+          ]
+      , emptydata = Map.fromList [
+            mkDef StaticSize      Independent HsBindgen []
+          ]
+      }
+    where
+      mkDef ::
+           TypeClass
+        -> Dependency
+        -> Strategy
+        -> [Strategy]
+        -> (TypeClass, SupportedStrategies)
+      mkDef cls dep strat strats = (cls,) $ SupportedStrategies{
+          dependency  = dep
+        , strategies  = Set.fromList $ strat : strats
+        , defStrategy = Just strat
+        }
+
+      mkOpt ::
+           TypeClass
+        -> Dependency
+        -> [Strategy]
+        -> (TypeClass, SupportedStrategies)
+      mkOpt cls dep strats = (cls,) $ SupportedStrategies{
+          dependency  = dep
+        , strategies  = Set.fromList strats
+        , defStrategy = Nothing
+        }
diff --git a/src-internal/HsBindgen/Language/C.hs b/src-internal/HsBindgen/Language/C.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Language/C.hs
@@ -0,0 +1,134 @@
+-- | Standard C language types
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Language.C qualified as C
+module HsBindgen.Language.C (
+    -- * C primitive types
+    PrimType(..)
+  , PrimIntType(..)
+  , PrimFloatType(..)
+  , PrimSign(..)
+  , PrimSignChar(..)
+    -- ** Sign
+  , primTypeSign
+    -- ** Pretty-printing
+  , showsPrimType
+  ) where
+
+import HsBindgen.Imports
+
+{-------------------------------------------------------------------------------
+  Primitive types
+-------------------------------------------------------------------------------}
+
+data PrimType =
+    -- | @[signed | unsigned] char@
+    PrimChar PrimSignChar
+
+    -- | An integral type, such as @int@ or @unsigned long int@.
+  | PrimIntegral PrimIntType PrimSign
+
+    -- | A floating-point type, such as @float@ or @long double@.
+  | PrimFloating PrimFloatType
+
+    -- | @_Bool@
+  | PrimBool
+  deriving stock (Show, Eq, Ord, Generic)
+
+-- | An integral type, such as @int@ or @unsigned long int@.
+data PrimIntType
+    -- | @[signed | unsigned] short [int]@
+  = PrimShort
+
+    -- | @[signed | unsigned] int@
+  | PrimInt
+
+    -- | @[signed | unsigned] long [int]@
+  | PrimLong
+
+    -- | @[signed | unsigned] long long [int]@
+  | PrimLongLong
+  deriving stock (Show, Eq, Ord, Enum, Bounded, Generic)
+
+-- | Primitive floating point types
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/349>
+-- We don't currently support @long double@.
+data PrimFloatType
+    -- | @float@
+  = PrimFloat
+
+    -- | @double@
+  | PrimDouble
+  deriving stock (Show, Eq, Ord, Enum, Bounded, Generic)
+
+-- | Sign of a primitive type
+data PrimSign = Signed | Unsigned
+  deriving stock (Show, Eq, Ord, Enum, Bounded, Generic)
+
+-- | Sign for @char@
+--
+-- The C standard distinguishes between /three/ kinds of @char@: @char@, @signed
+-- char@ and @unsigned char@. Unlike the other integer types, the interpretation
+-- of @char@ as either @signed char@ or @unsigned char@ is implementation
+-- defined (see also <https://eel.is/c++draft/basic#fundamental>).
+--
+-- Our general approach in @hs-bindgen@ is to generate machine code but with a
+-- machine independent API. For example, we might know that @int@ is 32 bits on
+-- a particular platform, and use this information to define 'Foreign.Storable.sizeOf' in
+-- 'Foreign.Storable.Storable' instances, but still use 'Foreign.C.Types.CInt' in the type definition (rather
+-- than 'Data.Word.Word32'). For this reason, /if/ the sign was compiler inferred, we
+-- record this as a special case, so that we can generate 'Foreign.C.Types.CChar' instead of
+-- 'Foreign.C.Types.CUChar' or 'Foreign.C.Types.CSChar'.
+data PrimSignChar =
+    -- | User explicitly specified sign
+    PrimSignExplicit PrimSign
+
+    -- | Sign was left implicit
+    --
+    -- In most cases we know the compiler-determined sign, but currently not in
+    -- all cases. That's probably fixable but it's not trivial; at present we
+    -- don't need the information and so we can leave this as a 'Maybe'.
+  | PrimSignImplicit (Maybe PrimSign)
+  deriving stock (Show, Eq, Ord, Generic)
+
+{-------------------------------------------------------------------------------
+  Pretty-printing
+-------------------------------------------------------------------------------}
+
+showsPrimType :: PrimType -> ShowS
+showsPrimType (PrimChar (PrimSignImplicit _)) = showString "char"
+showsPrimType (PrimChar (PrimSignExplicit s)) = showsPrimSign s . showString " char"
+showsPrimType (PrimIntegral i s) = showsPrimSign s . showChar ' ' . showsPrimIntType i
+showsPrimType (PrimFloating f) = showsPrimFloatType f
+showsPrimType PrimBool = showString "_Bool"
+
+showsPrimIntType :: PrimIntType -> ShowS
+showsPrimIntType PrimShort = showString "short"
+showsPrimIntType PrimInt = showString "int"
+showsPrimIntType PrimLong = showString "long"
+showsPrimIntType PrimLongLong = showString "long long"
+
+showsPrimFloatType :: PrimFloatType -> ShowS
+showsPrimFloatType PrimFloat = showString "float"
+showsPrimFloatType PrimDouble = showString "double"
+
+showsPrimSign :: PrimSign -> ShowS
+showsPrimSign Signed = showString "signed"
+showsPrimSign Unsigned = showString "unsigned"
+
+{-------------------------------------------------------------------------------
+  Sign
+-------------------------------------------------------------------------------}
+
+-- | Determine the sign of a primitive type
+--
+primTypeSign :: PrimType -> PrimSign
+primTypeSign = \case
+  PrimChar (PrimSignExplicit sign)        -> sign
+  PrimChar (PrimSignImplicit (Just sign)) -> sign
+  PrimChar (PrimSignImplicit Nothing)     -> Signed
+  PrimIntegral _ sign                     -> sign
+  PrimFloating _                          -> Signed
+  PrimBool                                -> Unsigned
diff --git a/src-internal/HsBindgen/Language/Haskell.hs b/src-internal/HsBindgen/Language/Haskell.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Language/Haskell.hs
@@ -0,0 +1,210 @@
+-- | General Haskell language types
+--
+-- Intended for qualified import.
+--
+-- > import HsBindgen.Language.Haskell qualified as Hs
+module HsBindgen.Language.Haskell (
+    -- * Module names
+    ModuleName(..)
+  , moduleNameFromString
+  , moduleNameToString
+  , moduleNamePath
+    -- * Module imports
+  , Import(..)
+    -- * References
+  , ExtRef(..)
+  , Ref(..)
+    -- * Namespaces
+  , Namespace(..)
+  , SNamespace(..)
+  , namespaceOf
+  , SingNamespace(..)
+    -- * Namespaced names
+  , Name(..)
+  , nameToStr
+  , SomeName(..)
+  , demoteNs
+  , assertNs
+  ) where
+
+import Data.Foldable qualified as Foldable
+import Data.Text qualified as Text
+import System.FilePath
+import Text.SimplePrettyPrint ((><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Errors
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Module names
+-------------------------------------------------------------------------------}
+
+-- | Haskell module name
+--
+-- Example: @HsBindgen.Runtime.LibC@
+newtype ModuleName = ModuleName { text :: Text }
+  deriving stock (Generic)
+  -- 'Show' instance valid due to 'IsString' instance
+  deriving newtype (Eq, IsString, Ord, Show)
+
+moduleNameFromString :: String -> ModuleName
+moduleNameFromString = ModuleName . Text.pack
+
+moduleNameToString :: ModuleName -> String
+moduleNameToString moduleName = Text.unpack moduleName.text
+
+moduleNamePath :: ModuleName -> FilePath
+moduleNamePath moduleName = withoutExt <.> "hs"
+  where
+    withoutExt :: FilePath
+    withoutExt =
+        Foldable.foldl' (</>) "" $
+          map Text.unpack (Text.splitOn "." moduleName.text)
+
+instance PrettyForTrace ModuleName where
+  prettyForTrace moduleName = PP.text moduleName.text
+
+{-------------------------------------------------------------------------------
+  Module imports
+-------------------------------------------------------------------------------}
+
+-- | A qualified or unqualified import of a module
+data Import =
+    -- | Unqualified import, listing the names in use
+    UnqualifiedImport ModuleName
+    -- | Qualified import possibly with an alias
+  | QualifiedImport   ModuleName (Maybe String)
+  deriving (Eq, Ord, Show)
+
+{-------------------------------------------------------------------------------
+  References
+-------------------------------------------------------------------------------}
+
+-- | External reference
+data ExtRef = ExtRef {
+      moduleName :: ModuleName
+      -- TODO https://github.com/well-typed/hs-bindgen/issues/423
+      --
+      -- At the moment, we only handle external references to types types. Later
+      -- we may support external references to variables (e.g., in macros).
+    , name       :: Name NsTypeConstr
+    }
+  deriving stock (Eq, Generic, Ord, Show)
+
+-- | Reference
+data Ref =
+    -- | Reference to a name in the local scope
+    RefLocal SomeName
+
+  | -- | Reference to a type in a different module
+    RefExt ExtRef
+  deriving stock (Eq, Show)
+
+{-------------------------------------------------------------------------------
+  Namespaces
+-------------------------------------------------------------------------------}
+
+-- | Namespace
+--
+-- See section 1.4, "Namespaces" of the Haskell report
+-- <https://www.haskell.org/onlinereport/haskell2010/haskellch1.html#x6-130001.4>
+data Namespace =
+    NsTypeConstr
+  | NsConstr
+  | NsVar
+  deriving (Eq, Ord, Show)
+
+instance PrettyForTrace Namespace where
+  prettyForTrace = \case
+    NsTypeConstr -> "type constructor"
+    NsConstr     -> "data constructor"
+    NsVar        -> "variable"
+
+-- | Namespace singleton
+data SNamespace :: Namespace -> Star where
+  SNsTypeConstr :: SNamespace 'NsTypeConstr
+  SNsConstr     :: SNamespace 'NsConstr
+  SNsVar        :: SNamespace 'NsVar
+
+deriving stock instance Show (SNamespace ns)
+
+-- | Get the namespace of a namespace singleton
+namespaceOf :: SNamespace ns -> Namespace
+namespaceOf = \case
+    SNsTypeConstr -> NsTypeConstr
+    SNsConstr     -> NsConstr
+    SNsVar        -> NsVar
+
+-- | Namespace singleton class
+class SingNamespace ns where
+  singNamespace :: SNamespace ns
+
+instance SingNamespace 'NsTypeConstr where singNamespace = SNsTypeConstr
+instance SingNamespace 'NsConstr     where singNamespace = SNsConstr
+instance SingNamespace 'NsVar        where singNamespace = SNsVar
+
+{-------------------------------------------------------------------------------
+  Namespaced names
+-------------------------------------------------------------------------------}
+
+-- | Haskell name created by "HsBindgen.Config.MangleCandidate" with correctness
+-- guarantees.
+--
+-- Also stores information about the Haskell namespace on the type level.
+-- Useful locally, to ensure correctness on the type level.
+--
+-- The constructor is "unsafe", because only the name mangler can ensure that
+-- namespace-specific naming rules are honored.
+newtype Name (ns :: Namespace) = UnsafeName {
+      text :: Text
+    }
+    deriving stock   (Show, Eq, Ord, Generic)
+
+nameToStr :: Name ns -> String
+nameToStr n = Text.unpack n.text
+
+instance SingNamespace ns => PrettyForTrace (Name ns) where
+  prettyForTrace x = prettyForTrace $ UnsafeSomeName ns x.text
+    where
+      ns :: Namespace
+      ns = namespaceOf (singNamespace @ns)
+
+-- | Haskell names with information about the Haskell namespace on the value
+--   level. Useful when handling names more globally such as in the list of
+--   declarations.
+--
+-- The constructor is "unsafe", because only the name mangler can ensure that
+-- namespace-specific naming rules are honored.
+data SomeName = UnsafeSomeName {
+      ns   :: Namespace
+    , text :: Text
+    }
+  deriving stock (Show, Eq, Ord, Generic)
+
+instance PrettyForTrace SomeName where
+  prettyForTrace x = PP.hsep [
+      "'" >< PP.text x.text >< "'"
+    , "(" >< prettyForTrace x.ns >< ")"
+    ]
+
+-- | Remove the type-level namespace information, and store it on the value
+--   level.
+demoteNs :: forall ns. SingNamespace ns => Name ns -> SomeName
+demoteNs name = UnsafeSomeName (namespaceOf $ singNamespace @ns) name.text
+
+-- | Get Haskell name for some name in the expected namespace
+--
+-- Panics if the stored namespace does not match the expected one.
+assertNs ::
+     forall ns. (HasCallStack, SingNamespace ns)
+  => Proxy ns -> SomeName -> Name ns
+assertNs _ nm
+    | nm.ns == expected = UnsafeName nm.text
+    | otherwise = panicPure $
+        "assertNs: namespace mismatch; expected "
+          <> show expected <> " but got " <> show nm.ns
+  where
+    expected :: Namespace
+    expected = namespaceOf (singNamespace @ns)
diff --git a/src-internal/HsBindgen/Macro/Empty.hs b/src-internal/HsBindgen/Macro/Empty.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Empty.hs
@@ -0,0 +1,42 @@
+-- | The 'Empty' macro language does not recognize any macro.
+--
+-- Then, @hs-bindgen@ does not reparse anything, and uses the macro expansions
+-- provided by Clang.
+--
+-- Intended for unqualified import.
+module HsBindgen.Macro.Empty (
+    Empty -- opaque
+  , empty -- opaque
+  ) where
+
+import Data.Map qualified as Map
+
+import HsBindgen.Macro.Error
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+
+data Empty
+
+data VoidMacro a
+  deriving stock (Functor, Foldable, Traversable, Show, Eq)
+
+absurdMacro :: VoidMacro a -> b
+absurdMacro m = case m of {}
+
+instance Macro.HasTypes Empty where
+  type Parsed           Empty = VoidMacro
+  type TypecheckedType  Empty = VoidMacro
+  type TypecheckedValue Empty = VoidMacro
+
+empty :: Macro.Lang Empty
+empty = Macro.Lang
+  { parse          = \_ -> Left MacroParseError {
+                       macroParseError = "Empty does not parse any macros"
+                     }
+  , resolve        = \_ -> absurdMacro . (.unwrap)
+  , typecheck      = \case
+                       []    -> Map.empty
+                       (x:_) -> absurdMacro x.macro
+  , translateType  = absurdMacro
+  , translateValue = \_ -> absurdMacro
+  }
diff --git a/src-internal/HsBindgen/Macro/Error.hs b/src-internal/HsBindgen/Macro/Error.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Error.hs
@@ -0,0 +1,55 @@
+module HsBindgen.Macro.Error (
+    MacroParseError(..)
+  , MacroResolutionError(..)
+  , MacroTypecheckError(..)
+  ) where
+
+import GHC.Generics
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Util.Tracer
+
+-- | A macro parse error.
+data MacroParseError = MacroParseError {
+      -- | Human-readable description of the failure.
+      macroParseError       :: String
+    }
+  deriving stock (Eq, Show, Generic)
+
+newtype MacroResolutionError = MacroResolutionError {
+      macroResolutionError :: String
+    }
+  deriving stock (Eq, Show, Generic)
+
+instance PrettyForTrace MacroResolutionError where
+  prettyForTrace (MacroResolutionError msg) =
+    PP.hang "Could not resolve variables in macro:" 2 (PP.string msg)
+
+instance IsTrace Level MacroResolutionError where
+  -- See https://github.com/well-typed/hs-bindgen/issues/2147.
+  --
+  -- Macro resolution failures can be noisy. Users who want to see them, can
+  -- change log-level or increase log-level using
+  -- 'HsBindgen.TraceMsg.EnableMacroWarnings'.
+  getDefaultLogLevel = const Info
+  getSource          = const HsBindgen
+  getTraceId         = const "macro-resolution"
+
+-- | An opaque typecheck error from the macro-language backend.
+newtype MacroTypecheckError = MacroTypecheckError {
+      macroTypecheckError :: String
+    }
+  deriving stock (Eq, Show, Generic)
+
+instance PrettyForTrace MacroTypecheckError where
+  prettyForTrace = \case
+      MacroTypecheckError err -> PP.hsep [
+          "Failed to typecheck macro:"
+        , PP.string err
+        ]
+
+instance IsTrace Level MacroTypecheckError where
+  getDefaultLogLevel = \case
+    MacroTypecheckError{} -> Info
+  getSource          = const HsBindgen
+  getTraceId         = const "macro-typecheck"
diff --git a/src-internal/HsBindgen/Macro/Flip.hs b/src-internal/HsBindgen/Macro/Flip.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Flip.hs
@@ -0,0 +1,19 @@
+-- | 'Flip' is useful when working with 'HsBindgen.Macro.Type.HasTypes'
+module HsBindgen.Macro.Flip (
+    Flip(..)
+  , flipF
+  , flipM
+  ) where
+
+newtype Flip f a l = Flip { unflip :: f l a }
+  deriving stock (Eq, Show)
+
+flipF :: (Flip f n a -> Flip f n b) -> f a n -> f b n
+flipF f x =
+  let (Flip x') = f (Flip x)
+  in  x'
+
+flipM :: Monad m => (Flip f n a -> m (Flip f n b)) -> f a n -> m (f b n)
+flipM f x = do
+  (Flip x') <- f (Flip x)
+  pure x'
diff --git a/src-internal/HsBindgen/Macro/Interface.hs b/src-internal/HsBindgen/Macro/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Interface.hs
@@ -0,0 +1,120 @@
+-- | Pluggable macro-language interface
+--
+-- This module defines the macro language 'Lang' record type, providing the
+-- macro-language implementation (parsing, name resolution, typechecking,
+-- translation). Values of the macro language 'Lang' can be provided by separate
+-- packages. The default value uses @c-expr-dsl@, and is defined in the
+-- user-facing @hs-bindgen@ library as 'HsBindgen.Macro.cExpr'.
+--
+-- Intended for qualified import.
+--
+-- @
+-- import HsBindgen.Macro.Interface qualified as Macro
+-- @
+module HsBindgen.Macro.Interface (
+    -- * Record
+    Lang(..)
+    -- * Name resolution
+  , Unresolved(..)
+  , Resolved(..)
+    -- * Typecheck result
+  , TypecheckResult(..)
+  ) where
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.SHs.AST.Expr
+import HsBindgen.Frontend.Analysis
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Error
+import HsBindgen.Macro.Type
+
+{-------------------------------------------------------------------------------
+  Record
+-------------------------------------------------------------------------------}
+
+-- | A macro language: provides parsing, name resolution, typechecking and
+-- translation of C macros.
+--
+-- The C standard (and any other configuration) is fixed when the macro 'Lang'
+-- is constructed; the interface itself is configuration-free.
+--
+-- Note how the macro language resembles the stages of compilers: parse,
+-- resolve, typecheck, translate.
+data Lang (l :: Star) = Lang {
+    -- | Parse a single macro.
+    parse ::
+         Runtime.Macro.Raw (Token SourcePath TokenSpelling)
+      -> Either MacroParseError (Unresolved l)
+
+  , resolve ::
+         Set C.DeclId
+         -- ^ Set of declaration IDs in scope.
+      -> Unresolved l
+      -> Either MacroResolutionError (Resolved l)
+
+    -- | Batch-typecheck a sequence of macros.
+    --
+    -- The resulting map must have keys for all resolved macros.
+  , typecheck ::
+         [Resolved l]
+      -> Map Text (TypecheckResult l)
+
+    -- | Translate a checked type-like macro to an 'HsType'.
+    --
+    -- The caller supplies a function to translate variables to 'HsType'.
+  , translateType ::
+         TypecheckedType l Hs.Type
+      -> Hs.Type
+
+    -- | Translate a checked value-macro to a 'Binding'.
+  , translateValue ::
+         Hs.Name Hs.NsVar
+         -- ^ Exported binding name
+      -> TypecheckedValue l Hs.TermName
+      -> Maybe HsDoc.Comment
+      -> Binding
+  }
+
+{-------------------------------------------------------------------------------
+  Name resolution
+-------------------------------------------------------------------------------}
+
+newtype Unresolved l = Unresolved { unwrap :: Parsed l () }
+
+deriving stock instance (HasTypes l) => Eq   (Unresolved l)
+deriving stock instance (HasTypes l) => Show (Unresolved l)
+
+data Resolved l = Resolved {
+    -- | The macro, with references resolved to 'C.DeclId's.
+    macro :: Parsed l C.DeclId
+    -- | Dependencies of the macro, paired with what the dependent needs to know
+    -- about each dependency (full shape vs. name only).
+  , deps  :: [(C.DeclId, Dependency)]
+  }
+  deriving stock (Generic)
+
+deriving stock instance (HasTypes l) => Eq   (Resolved l)
+deriving stock instance (HasTypes l) => Show (Resolved l)
+
+{-------------------------------------------------------------------------------
+  Typecheck result
+-------------------------------------------------------------------------------}
+
+-- | Result of typechecking a single macro.
+--
+-- @l@ is the macro-language tag.
+data TypecheckResult l
+  = TypecheckType  (TypecheckedType l C.DeclId)
+  | TypecheckValue (TypecheckedValue l C.DeclId)
+  | TypecheckError MacroTypecheckError
+
+deriving stock instance HasTypes l => Show (TypecheckResult l)
+deriving stock instance HasTypes l => Eq   (TypecheckResult l)
diff --git a/src-internal/HsBindgen/Macro/Parse.hs b/src-internal/HsBindgen/Macro/Parse.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Parse.hs
@@ -0,0 +1,161 @@
+-- | @parsec@ infrastructure for parsing streams of @libclang@ tokens.
+--
+-- Intended for unqualified import.
+module HsBindgen.Macro.Parse (
+    -- * Parser type
+    Parser
+  , runParser
+    -- * Dealing with individual tokens
+  , token
+  , identifierOrKeyword
+  , isIdentifierOrKeyword
+  , spelling
+    -- * Punctuation
+  , punctuation
+  , parens
+  , comma
+  ) where
+
+import Control.Monad (guard)
+import Data.Bifunctor (Bifunctor (first))
+import Data.Text (Text)
+import Data.Text qualified as Text
+import GHC.Stack (HasCallStack)
+import Text.Parsec (ParseError, Parsec, SourcePos)
+import Text.Parsec qualified as Parsec
+import Text.Parsec.Pos (newPos)
+
+import Clang.Enum.Simple (fromSimpleEnum)
+import Clang.HighLevel.Types (MultiLoc (multiLocExpansion), Range (rangeStart),
+                              SingleLoc (singleLocColumn, singleLocLine, singleLocPath),
+                              Token (tokenExtent, tokenKind, tokenSpelling),
+                              TokenSpelling (getTokenSpelling))
+import Clang.LowLevel.Core (CXTokenKind (CXToken_Identifier, CXToken_Keyword, CXToken_Punctuation))
+import Clang.Paths (SourcePath, getSourcePath)
+
+import HsBindgen.Errors
+import HsBindgen.Macro.Error (MacroParseError (..))
+
+{-------------------------------------------------------------------------------
+  Parser type
+-------------------------------------------------------------------------------}
+
+type Parser = Parsec [Token SourcePath TokenSpelling] ()
+
+-- | Run a parser on a stream of tokens
+--
+-- The token stream may be empty: a macro body can be empty (@#define FOO@), and
+-- the source path is only used to label parse errors.
+runParser ::
+     HasCallStack
+  => Parser a
+  -> [Token SourcePath TokenSpelling]
+  -> Either MacroParseError a
+runParser p tokens =
+    first unrecognized $ Parsec.runParser p () sourcePath tokens
+  where
+    sourcePath :: FilePath
+    sourcePath =
+        case tokens of
+          []  -> panicPure "runParser: empty list"
+          t:_ -> getSourcePath $ singleLocPath start
+            where
+              start :: SingleLoc SourcePath
+              start = rangeStart $ multiLocExpansion <$> tokenExtent t
+
+    unrecognized :: ParseError -> MacroParseError
+    unrecognized err = MacroParseError{
+          macroParseError = show err
+        }
+
+{-------------------------------------------------------------------------------
+  Dealing with individual tokens
+-------------------------------------------------------------------------------}
+
+token :: (Token SourcePath TokenSpelling -> Maybe a) -> Parser a
+token = Parsec.token tokenPretty tokenSourcePos
+  where
+    tokenPretty :: Token SourcePath TokenSpelling -> String
+    tokenPretty tok = concat [
+          show $ Text.unpack tok.tokenSpelling.getTokenSpelling
+        , " ("
+        , show tok.tokenKind
+        ,  ")"
+        ]
+
+    tokenSourcePos :: Token SourcePath a -> SourcePos
+    tokenSourcePos t =
+        newPos
+          (getSourcePath $ singleLocPath start)
+          (singleLocLine start)
+          (singleLocColumn start)
+      where
+        start :: SingleLoc SourcePath
+        start = rangeStart $ multiLocExpansion <$> tokenExtent t
+
+tokenOfKind :: CXTokenKind -> (Text -> Maybe a) -> Parser a
+tokenOfKind kind f = token $ \t ->
+    if isOfKind kind t
+      then f $ getTokenSpelling (tokenSpelling t)
+      else Nothing
+
+tokenOfKind' :: CXTokenKind -> (Text -> Bool) -> Parser ()
+tokenOfKind' kind cmp = tokenOfKind kind (\actual -> guard $ cmp actual)
+
+isOfKind :: CXTokenKind -> Token SourcePath TokenSpelling -> Bool
+isOfKind kind t = fromSimpleEnum (tokenKind t) == Right kind
+
+-- | Is this token a name?
+--
+-- See 'identifierOrKeyword' for why we check for both token kinds, identifier
+-- and keyword.
+isIdentifierOrKeyword :: Token SourcePath TokenSpelling -> Bool
+isIdentifierOrKeyword t =
+    isOfKind CXToken_Identifier t || isOfKind CXToken_Keyword t
+
+-- | The spelling of a token
+spelling :: Token SourcePath TokenSpelling -> Text
+spelling = getTokenSpelling . tokenSpelling
+
+-- | Parse an identifier or a keyword
+--
+-- Preprocessor tokens do not handle keywords in any special way. Hence,
+-- wherever the preprocessor expects an identifier, a keyword will do. Which
+-- spellings @libclang@ reports as keywords is decided by the translation
+-- unit's language options, so @bool@ is a keyword under C23 and an identifier
+-- under C17; that distinction must not reach the macro grammar.
+identifierOrKeyword :: Parser (Token SourcePath TokenSpelling)
+identifierOrKeyword = token $ \t -> t <$ guard (isIdentifierOrKeyword t)
+
+{-------------------------------------------------------------------------------
+  Punctuation
+-------------------------------------------------------------------------------}
+
+punctuation :: Text -> Parser ()
+punctuation expected = tokenOfKind' CXToken_Punctuation $
+    \actual -> Text.unpack expected == removeMultilines (Text.unpack actual)
+
+parens :: Parser a -> Parser a
+parens p = punctuation "(" *> p <* punctuation ")"
+
+comma :: Parser ()
+comma = punctuation ","
+
+-- | Remove multiline characters from the string
+--
+-- Multiline characters are a pair of characters of the form "\\\n". These
+-- characters are sometimes included in (punctuation) tokens. We should remove
+-- multiline characters before comparing against a target string. For example,
+-- we want @punctuation "("@ to match with a token that has spelling "\\\n(".
+--
+-- >>> removeMultilines "a\\\ngbe\\\n"
+-- "agbe"
+--
+removeMultilines :: String -> String
+removeMultilines = \case
+    []     -> []
+    (c:cs) -> go c cs
+  where
+    go prev []        = [prev]
+    go '\\' ('\n':cs) = removeMultilines cs
+    go prev (c   :cs) = prev : go c cs
diff --git a/src-internal/HsBindgen/Macro/Raw.hs b/src-internal/HsBindgen/Macro/Raw.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Raw.hs
@@ -0,0 +1,15 @@
+-- | The 'Raw' macro language.
+--
+-- Every macro is a value-like macro.
+--
+-- Translate all macros to their token spellings, as a
+-- 'HsBindgen.Runtime.Macro.Raw'.
+--
+-- Intended for unqualified import.
+module HsBindgen.Macro.Raw (
+    Raw -- opaque
+  , raw -- opaque
+  ) where
+
+import HsBindgen.Macro.Raw.Lang
+import HsBindgen.Macro.Raw.Parse
diff --git a/src-internal/HsBindgen/Macro/Raw/Lang.hs b/src-internal/HsBindgen/Macro/Raw/Lang.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Raw/Lang.hs
@@ -0,0 +1,91 @@
+module HsBindgen.Macro.Raw.Lang (
+    raw -- opaque
+  ) where
+
+import Data.Map qualified as Map
+import Data.Text qualified as Text
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.SHs.AST.Expr
+import HsBindgen.Backend.SHs.AST.Expr qualified as SHs
+import HsBindgen.Backend.SHs.AST.Type qualified as SHs
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Raw.Parse
+
+resolveRaw :: Macro.Unresolved Raw -> Macro.Resolved Raw
+resolveRaw m = Macro.Resolved{
+      macro = coerceMacro m.unwrap
+    , deps = []
+    }
+
+typecheckRaw :: [Macro.Resolved Raw] -> Map Text (Macro.TypecheckResult Raw)
+typecheckRaw xs =
+    Map.fromList [
+        (parsedMacro.unwrap.name, Macro.TypecheckValue parsedMacro)
+      | resolvedMacro <- xs
+      , let parsedMacro = resolvedMacro.macro
+      ]
+
+translateRaw ::
+     Hs.Name Hs.NsVar
+  -> ParsedMacro a
+  -> Maybe HsDoc.Comment
+  -> Binding
+translateRaw name parsedMacro mDoc = Binding{
+      name       = Hs.ExportedName name
+    , parameters = []
+    , result     = Result rawMacroT Nothing
+    , body       = rawMacroE
+    , pragmas    = []
+    , comment    = mDoc
+    }
+  where
+    macro :: Runtime.Macro.Raw Text
+    macro = parsedMacro.unwrap
+
+    -- @Macro.Raw Text@
+    rawMacroT :: SHs.ClosedType
+    rawMacroT =
+        SHs.TApp
+          (SHs.TGlobal $ bindgenGlobalType Macro_Raw_type)
+          (SHs.TGlobal $ bindgenGlobalType String_type)
+
+    rawMacroE :: SHs.ClosedExpr
+    rawMacroE = case macro.params of
+        Runtime.Macro.NoParams ->
+          applyTo Macro_objectLike [nameE, bodyE]
+        Runtime.Macro.Params names Runtime.Macro.NotVariadic ->
+          applyTo Macro_functionLike [nameE, stringsE names, bodyE]
+        Runtime.Macro.Params names Runtime.Macro.Ellipsis ->
+          applyTo Macro_variadicFunctionLike [nameE, stringsE names, bodyE]
+        Runtime.Macro.Params names (Runtime.Macro.NamedEllipsis ellipsisName) ->
+          applyTo Macro_namedVariadicFunctionLike
+            [nameE, stringsE names, stringE ellipsisName, bodyE]
+
+    nameE, bodyE :: SHs.ClosedExpr
+    nameE = stringE macro.name
+    bodyE = stringsE macro.body
+
+    stringE :: Text -> SHs.ClosedExpr
+    stringE = SHs.EString . Text.unpack
+
+    stringsE :: [Text] -> SHs.ClosedExpr
+    stringsE = SHs.EList . map stringE
+
+    applyTo :: BindgenGlobalTerm -> [SHs.ClosedExpr] -> SHs.ClosedExpr
+    applyTo f = foldl' SHs.EApp (SHs.EGlobal $ bindgenGlobalTerm f)
+
+raw :: Macro.Lang Raw
+raw = Macro.Lang{
+    parse          = parseRaw
+  , resolve        = \_ -> Right . resolveRaw
+  , typecheck      = typecheckRaw
+  , translateType  = absurdVoidMacro
+  , translateValue = translateRaw
+  }
diff --git a/src-internal/HsBindgen/Macro/Raw/Parse.hs b/src-internal/HsBindgen/Macro/Raw/Parse.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Raw/Parse.hs
@@ -0,0 +1,49 @@
+module HsBindgen.Macro.Raw.Parse (
+    Raw -- opaque
+  , VoidMacro
+  , absurdVoidMacro
+  , ParsedMacro(..)
+  , coerceMacro
+  , parseRaw
+  ) where
+
+import Data.Text (Text)
+
+import Clang.HighLevel.Types
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Macro.Error
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Parse
+import HsBindgen.Macro.Type qualified as Macro
+
+data Raw
+
+data VoidMacro a
+  deriving stock (Functor, Foldable, Traversable, Show, Eq)
+
+absurdVoidMacro :: VoidMacro a -> b
+absurdVoidMacro m = case m of {}
+
+-- | A macro definition, untyped
+--
+-- 'Macro.Parsed' is indexed by the /annotation/. For 'Runtime.Macro.Raw', the
+-- annotation is a phantom: there is nothing in a raw macro to resolve.
+newtype ParsedMacro ann = ParsedMacro {
+      unwrap :: Runtime.Macro.Raw Text
+    }
+  deriving stock (Functor, Foldable, Traversable, Show, Eq)
+
+coerceMacro :: ParsedMacro a -> ParsedMacro b
+coerceMacro = ParsedMacro . (.unwrap)
+
+instance Macro.HasTypes Raw where
+  type Parsed           Raw = ParsedMacro
+  type TypecheckedType  Raw = VoidMacro
+  type TypecheckedValue Raw = ParsedMacro
+
+parseRaw ::
+     Runtime.Macro.Raw (Token SourcePath TokenSpelling)
+  -> Either MacroParseError (Macro.Unresolved Raw)
+parseRaw = Right . Macro.Unresolved . ParsedMacro . fmap spelling
diff --git a/src-internal/HsBindgen/Macro/Syntax.hs b/src-internal/HsBindgen/Macro/Syntax.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Syntax.hs
@@ -0,0 +1,169 @@
+-- | Macro definitions and invocations, as reported by @libclang@.
+module HsBindgen.Macro.Syntax (
+    MacroDefinition (..)
+  , MacroInvocation (..)
+    -- * Splitting macro definitions
+  , splitMacro
+  ) where
+
+import Control.Monad (unless)
+import Data.Text (Text)
+import GHC.Stack (HasCallStack)
+import Text.Parsec qualified as Parsec
+
+import Clang.HighLevel.Types (MultiLoc (multiLocExpansion),
+                              Range (rangeEnd, rangeStart), RealPath,
+                              SingleLoc (singleLocColumn, singleLocLine, singleLocPath),
+                              SourcePath, Token (tokenExtent), TokenSpelling)
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Macro.Error (MacroParseError)
+import HsBindgen.Macro.Parse
+
+data MacroDefinition = MacroDefinition {
+    name  :: Text
+    -- | The definition, split into name, parameters and body
+    --
+    -- The split is language-independent and happens once, while parsing; see
+    -- 'splitMacro'.
+  , macro :: Either MacroParseError (Runtime.Macro.Raw (Token SourcePath TokenSpelling))
+  }
+
+data MacroInvocation = MacroInvocation {
+    name     :: Text
+  , locRange :: Range (MultiLoc RealPath)
+  , tokens   :: [Token SourcePath TokenSpelling]
+  }
+  deriving stock (Show, Eq, Ord)
+
+{-------------------------------------------------------------------------------
+  Splitting macro definitions
+-------------------------------------------------------------------------------}
+
+-- | Split a macro definition into its name, parameters and body
+--
+-- This is the /one/ language-independent macro parser in `hs-bindgen`: every
+-- macro definition passes through it before the used macro language parses the
+-- macro body. Here, we do not parse the body.
+--
+-- The tokens are the tokens of the definition /excluding/ the @#define@ itself,
+-- as reported by @libclang@ for a @CXCursor_MacroDefinition@ cursor. For
+--
+-- > #define ADD(x, y) x + y
+--
+-- the result is @Raw "ADD" (Params ["x", "y"] False) ["x", "+", "y"]@.
+splitMacro ::
+     HasCallStack
+  => [Token SourcePath TokenSpelling]
+  -> Either MacroParseError (Runtime.Macro.Raw (Token SourcePath TokenSpelling))
+splitMacro = runParser (macroDefinition <* Parsec.eof)
+
+macroDefinition :: Parser (Runtime.Macro.Raw (Token SourcePath TokenSpelling))
+macroDefinition = do
+    name       <- identifierOrKeyword
+    isFunction <- isFunctionLike (tokenExtent name)
+    params     <- if isFunction then formalParams else pure Runtime.Macro.NoParams
+    body       <- Parsec.many Parsec.anyToken
+    pure Runtime.Macro.Raw {
+        Runtime.Macro.name   = name
+      , Runtime.Macro.params = params
+      , Runtime.Macro.body   = body
+      }
+
+-- | Is the macro definition function-like?
+--
+-- A macro definition is function-like if its name is followed immediately by a
+-- @(@, without any whitespace in between; see 'lparen'. Otherwise it is
+-- object-like.
+--
+-- @isFunctionLike@ does not consume input.
+isFunctionLike ::
+     -- | Source location of the macro definition's name
+     Range (MultiLoc SourcePath)
+  -> Parser Bool
+isFunctionLike nameRange =
+    Parsec.lookAhead $
+      Parsec.option False (True <$ Parsec.try (lparen nameRange))
+
+-- | Parse the parameter list of a function-like macro
+--
+-- The accepted forms follow the C grammar (C23 6.10.1), plus the GNU named
+-- variadic extension:
+--
+-- > F()        Params []     NotVariadic
+-- > F(x, y)    Params [x, y] NotVariadic
+-- > F(...)     Params []     Ellipsis
+-- > F(x, ...)  Params [x]    Ellipsis
+-- > F(x...)    Params []     (NamedEllipsis x)       -- GNU
+-- > F(x, y...) Params [x]    (NamedEllipsis y)       -- GNU
+--
+-- An @...@ that is not preceded by a comma binds to the name before it (GNU form).
+--
+-- A trailing comma (@F(x,)@) is /rejected/ (similar to @clang@).
+--
+-- We do not implement additional logic to reject repeated parameter names
+-- (@F(x, x)@), and /accepted/ them, although C23 6.10.1p6 forbids them.
+-- @clang@ rejects such a definition, so no cursor for it ever reaches us.
+--
+-- A parameter name may be a keyword, just as the macro /name/ may be (see
+-- 'identifierOrKeyword'). The preprocessor sees pp-tokens, which know no
+-- keywords, so @clang@ accepts @#define F(bool) bool@ even in C23, where
+-- @bool@ is one.
+formalParams :: Parser (Runtime.Macro.Params (Token SourcePath TokenSpelling))
+formalParams = parens $ do
+    names <- Parsec.option [] namedParams
+    Parsec.choice [
+        -- A comma that is not followed by @...@ is a trailing comma; it
+        -- consumes input and so fails the whole parameter list rather than
+        -- backtracking into the alternatives below.
+        Runtime.Macro.Params names Runtime.Macro.Ellipsis <$ (comma *> ellipsis)
+      , namedEllipsis names <$ ellipsis
+      , pure $ Runtime.Macro.Params names Runtime.Macro.NotVariadic
+      ]
+  where
+    -- One or more comma-separated names. The separator is wrapped in 'try' so
+    -- that the comma of @F(x, ...)@ is left for the variadic suffix.
+    namedParams :: Parser [Token SourcePath TokenSpelling]
+    namedParams =
+            (:)
+        <$> identifierOrKeyword
+        <*> Parsec.many (Parsec.try (comma *> identifierOrKeyword))
+
+    -- @F(...)@ has no name for the ellipsis to bind to.
+    namedEllipsis ::
+         [Token SourcePath TokenSpelling]
+      -> Runtime.Macro.Params (Token SourcePath TokenSpelling)
+    namedEllipsis names = case reverse names of
+        []   -> Runtime.Macro.Params [] Runtime.Macro.Ellipsis
+        n:ns -> Runtime.Macro.Params (reverse ns) (Runtime.Macro.NamedEllipsis n)
+
+    ellipsis :: Parser ()
+    ellipsis = punctuation "..."
+
+-- | Parse a @(@ not immediately preceded by white space
+--
+-- @lparen@ consumes input when it fails. Combine with @try@ if this is
+-- undesirable.
+--
+-- NOTE: @lparen@ is defined in the C reference.
+--
+-- We used to not check whitespace, which was the source of a bug. See issue
+-- #1903: <https://github.com/well-typed/hs-bindgen/issues/1903>
+lparen :: Range (MultiLoc SourcePath) -> Parser ()
+lparen prevRange = do
+    tok <- Parsec.lookAhead Parsec.anyToken
+    punctuation "("
+    unless (adjacentTo prevRange tok) $
+      Parsec.unexpected "whitespace before lparen"
+
+-- | Does the token start exactly where the given range ends?
+adjacentTo :: Range (MultiLoc SourcePath) -> Token SourcePath TokenSpelling -> Bool
+adjacentTo prevRange tok =
+       prev.singleLocPath   == current.singleLocPath
+    && prev.singleLocLine   == current.singleLocLine
+    && prev.singleLocColumn == current.singleLocColumn
+  where
+    prev, current :: SingleLoc SourcePath
+    prev    = prevRange.rangeEnd.multiLocExpansion
+    current = tok.tokenExtent.rangeStart.multiLocExpansion
diff --git a/src-internal/HsBindgen/Macro/Type.hs b/src-internal/HsBindgen/Macro/Type.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/Type.hs
@@ -0,0 +1,85 @@
+-- | Pluggable macro-language types
+--
+-- This module defines the macro 'HasTypes' typeclass, defining types for
+-- parsing and typechecking macros. Instances of 'HasTypes' can be provided by
+-- separate packages. The default instance uses @c-expr-dsl@, and is defined in
+-- the user-facing @hs-bindgen@ library.
+--
+-- Intended for qualified import.
+--
+-- @
+-- import HsBindgen.Macro.Type qualified as Macro
+-- @
+module HsBindgen.Macro.Type (
+    -- * Typeclass
+    HasTypes(..)
+  ) where
+
+import HsBindgen.Imports
+
+{-------------------------------------------------------------------------------
+  Typeclass
+-------------------------------------------------------------------------------}
+
+-- | Types for parsing and typechecking macros
+--
+-- Initially, we store the 'ParsedMacro' in the AST. The 'ParsedMacro'
+-- is parameterized by an annotation:
+--
+-- 1. After parse, the annotation is @()@ (see 'Macro.Unresolved').
+--
+-- 2. After name resolution, the annotation is the 'C.DeclId' (see
+--    'Macro.Resolved').
+--
+-- After we typecheck the macros, we store the 'TypecheckedMacroType' or
+-- 'TypecheckedMacroValue' in the AST. These are parameterized by a variable:
+--
+-- 1. After typechecking that variable is instantiated to 'DeclId' (which is the
+--    annotation of the 'ParsedMacro' prior to typechecking).
+--
+-- 2. After name mangling, the variable becomes a 'C.DeclIdPair'.
+class (
+    forall ann. (Show ann, Eq ann) => ValidParsed l ann
+  , Functor     (TypecheckedType  l)
+  , Foldable    (TypecheckedType  l)
+  , Traversable (TypecheckedType  l)
+  , forall var. (Show var, Eq var) => ValidTypecheckedType l var
+  , Functor     (TypecheckedValue l)
+  , Foldable    (TypecheckedValue l)
+  , Traversable (TypecheckedValue l)
+  , forall var. (Show var, Eq var) => ValidTypecheckedValue l var
+  ) => HasTypes (l :: Star) where
+
+  -- | Parsed (not yet typechecked) macro. Parameterized by the
+  --   annotation type.
+  type Parsed l :: Star -> Star
+
+  -- | Typechecked type macro. Parameterized by the variable type.
+  type TypecheckedType  l :: Star -> Star
+
+  -- | Typechecked value macro. Parameterized by the variable type.
+  type TypecheckedValue l :: Star -> Star
+
+class ( Show (Parsed l ann)
+      , Eq   (Parsed l ann)
+      ) => ValidParsed l ann
+
+instance ( Show (Parsed l ann)
+         , Eq   (Parsed l ann)
+         ) => ValidParsed l ann
+
+class ( Show (TypecheckedType l var)
+      , Eq   (TypecheckedType l var)
+      ) => ValidTypecheckedType l var
+
+instance ( Show (TypecheckedType l var)
+         , Eq   (TypecheckedType l var)
+         ) => ValidTypecheckedType l var
+
+class ( Show (TypecheckedValue l var)
+      , Eq   (TypecheckedValue l var)
+      ) => ValidTypecheckedValue l var
+
+instance ( Show (TypecheckedValue l var)
+         , Eq   (TypecheckedValue l var)
+         ) => ValidTypecheckedValue l var
diff --git a/src-internal/HsBindgen/Macro/UniqueExpansion.hs b/src-internal/HsBindgen/Macro/UniqueExpansion.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/UniqueExpansion.hs
@@ -0,0 +1,293 @@
+-- |
+--
+-- Intended for unqualified import.
+module HsBindgen.Macro.UniqueExpansion (
+    -- * Parse
+    ParseResult (..)
+  , Error (..)
+  , isFailure
+  , liftDefinition
+  , liftInvocation
+  , parseDefinition
+  , parseInvocation
+    -- * Analysis
+  , Analysis
+  , analyseMacroDefinitions
+  , redefinition
+  , ambiguity
+  , ambiguous
+    -- * Unique expansion
+  , isExpansionUnique
+  ) where
+
+import Control.Monad.Except (MonadError (throwError))
+import Data.Digraph (Digraph)
+import Data.Digraph qualified as Digraph
+import Data.Either (partitionEithers, rights)
+import Data.Foldable qualified as Foldable
+import Data.Map.Strict (Map)
+import Data.Map.Strict qualified as Map
+import Data.Set (Set)
+import Data.Set qualified as Set
+import Data.Text (Text)
+import Text.Parsec (eof)
+
+import Clang.HighLevel.Types (SourcePath, Token, TokenSpelling)
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Macro.Error (MacroParseError)
+import HsBindgen.Macro.Parse (isIdentifierOrKeyword, runParser, spelling)
+import HsBindgen.Macro.Syntax (MacroDefinition (macro, name),
+                               MacroInvocation (name, tokens))
+import HsBindgen.Macro.UniqueExpansion.Parse qualified as P
+import HsBindgen.Macro.UniqueExpansion.Types
+
+{-------------------------------------------------------------------------------
+  Parse
+-------------------------------------------------------------------------------}
+
+data ParseResult a = ParseResult {
+    macroName :: Name
+  , result    :: Either Error a
+  }
+
+isFailure :: ParseResult a -> Maybe Text
+isFailure pres =
+    either (const (Just pres.macroName.unwrap)) (const Nothing) pres.result
+
+liftDefinition :: Definition -> ParseResult Definition
+liftDefinition def = ParseResult def.name (Right def)
+
+liftInvocation :: Invocation -> ParseResult Invocation
+liftInvocation inv = ParseResult inv.name (Right inv)
+
+data Error =
+    ParseError MacroParseError
+  | NameMismatch Text Text
+  deriving stock (Eq, Show)
+
+-- | Project the split macro definition onto its spelling and the names it
+-- depends on
+--
+-- The split itself already happened during parsing; see
+-- 'HsBindgen.Macro.Syntax.splitMacro'.
+--
+-- We keep checking the name against the one @libclang@ reported for the cursor:
+-- the split does not subsume that comparison.
+parseDefinition :: MacroDefinition -> ParseResult Definition
+parseDefinition def =
+    ParseResult (Name def.name) $
+    case def.macro of
+      Left e -> throwError $ ParseError e
+      Right m
+        | def.name == def'.name.unwrap
+        -> pure def'
+        | otherwise
+        -> throwError $ NameMismatch def.name def'.name.unwrap
+        where
+          def' = definition m
+
+-- | Reduce a macro definition to its spelling and the names it depends on
+--
+-- The dependencies cannot be recovered from the spelling: which tokens are
+-- names depends on each token's kind.
+--
+-- Everything in the body that is not a name is dropped, as is every name that
+-- is a parameter of this macro. A keyword that is not a local parameter is a
+-- normal name: @#define B bool@ refers to @bool@ whether or not the C standard
+-- in force makes @bool@ a keyword, and a reference we fail to harvest is an
+-- ambiguity we fail to see.
+--
+-- @__VA_ARGS__@ and @__VA_OPT__@ are reserved identifiers only in variadic
+-- macro definitions. We treat them as parameters there, to emphasise that their
+-- expansion relies on the parameters. In the GNU named-variadic form the name
+-- that stands for the trailing arguments is a parameter like any other.
+definition :: Runtime.Macro.Raw (Token SourcePath TokenSpelling) -> Definition
+definition m = Definition{
+      name    = toName m.name
+    , deps    = Set.fromList
+        [ n
+        | t <- m.body
+        , isIdentifierOrKeyword t
+        , let n = toName t
+        , not (isParam n)
+        ]
+    , spelled = fmap spelling m
+    }
+  where
+    toName :: Token SourcePath TokenSpelling -> Name
+    toName = Name . spelling
+
+    isParam :: Name -> Bool
+    isParam n = case m.params of
+        Runtime.Macro.NoParams              -> False
+        Runtime.Macro.Params names variadic ->
+          n `elem` map toName names || isVariadicParam n variadic
+
+    isVariadicParam :: Name -> Runtime.Macro.Variadic (Token SourcePath TokenSpelling) -> Bool
+    isVariadicParam n = \case
+        Runtime.Macro.NotVariadic                -> False
+        Runtime.Macro.NamedEllipsis ellipsisName -> n == toName ellipsisName
+        Runtime.Macro.Ellipsis                   ->
+          n `elem` ["__VA_ARGS__", "__VA_OPT__"]
+
+parseInvocation :: MacroInvocation -> ParseResult Invocation
+parseInvocation inv =
+    ParseResult (Name inv.name) $
+    case runParser (P.parseInvocation <* eof) inv.tokens of
+      Left e -> throwError $ ParseError e
+      Right inv'
+        | inv.name == inv'.name.unwrap
+        -> pure inv'
+        | otherwise
+        -> throwError $ NameMismatch inv.name inv'.name.unwrap
+
+{-------------------------------------------------------------------------------
+  Analysis
+-------------------------------------------------------------------------------}
+
+-- | Result of the ambiguity analysis of all macro definitions
+--
+-- A macro is /ambiguous/ iff its expansion depends on where it is invoked. The
+-- analysis starts from the /seed/: the macros that are ambiguous on their own,
+-- because their definitions are not all identical (see 'Redefinition'), or
+-- because one of them could not be split (which should never happen and is a
+-- bug, reported to the user), so that we cannot see what it depends on. Every
+-- macro that (transitively) depends on a macro in the seed is ambiguous too,
+-- since the tokens of a replacement list are rescanned at the invocation site.
+-- For example,
+--
+-- @
+-- #define A Foo
+-- #define B A
+-- #define A Bar
+-- #define B A
+-- @
+--
+-- The two definitions of @B@ are identical, but an invocation of @B@ expands to
+-- @Foo@ above line 3 and to @Bar@ below it. @A@ is in the seed; @B@ is not, but
+-- inherits @A@'s ambiguity. @B@ is ambiguous even without its second
+-- definition.
+--
+-- Ambiguity decides whether an invocation may be pre-expanded (see
+-- 'isExpansionUnique') and whether a macro that is defined more than once is a
+-- conflict (see 'redefinition'). In the example, both @A@ and @B@ conflict: the
+-- definitions of @B@ are identical, but no single binding for @B@ is right for
+-- all its invocations.
+--
+-- The exact check would expand both definitions recursively and compare the
+-- results. We cannot drive the Clang preprocessor for that, so we approximate:
+-- a macro is unambiguous only if none of its dependencies is ambiguous.
+--
+-- The approximation also ignores where definitions are: a macro whose only
+-- definition follows an invocation, or that is @#undef@ined after it, counts as
+-- unambiguous, although the invocation expands differently at the end of the
+-- translation unit. The resulting mismatches are caught later: the reparsed
+-- declaration is checked against Clang's AST (see
+-- "HsBindgen.Frontend.Pass.ReparseMacroExpansions.Zip"), and a name that is
+-- both a macro and another declaration is a conflict.
+--
+-- A replacement list consisting of literals only needs no special treatment:
+-- it depends on nothing, so it is ambiguous only if it is in the seed.
+newtype Analysis = Analysis {
+      ambiguous :: Set Name
+    }
+
+analyseMacroDefinitions :: [ParseResult Definition] -> Analysis
+analyseMacroDefinitions defs = Analysis{
+      ambiguous = seed <> Digraph.reaches seed graph
+    }
+  where
+    byName :: Map Name [Either Error Definition]
+    byName = Map.fromListWith (++) [ (d.macroName, [d.result]) | d <- defs ]
+
+    seed :: Set Name
+    seed = Map.keysSet $ Map.filter (not . identical) byName
+
+    graph :: DependentsGraph
+    graph = mkDependentsGraph $ rights $ map (.result) defs
+
+-- | Are all definitions of a macro identical?
+--
+-- We compare the split definitions: name, parameter list and replacement list,
+-- token by token by spelling. The split matters: @#define F(x) x@ and
+-- @#define F (x) x@ have the same token spellings, but only the first is
+-- function-like.
+--
+-- We ignore white space within the replacement list, which C does not (C23
+-- 6.10.5p1): @1-1@ and @1 - 1@ differ, and stringification can observe the
+-- difference. Clang only warns about such a redefinition; we treat it as
+-- benign.
+identical :: [Either Error Definition] -> Bool
+identical results = case partitionEithers results of
+    ([], d : ds) -> all (\d' -> d'.spelled == d.spelled) ds
+    _otherwise   -> False
+
+-- | Is the redefinition of a macro benign?
+--
+-- Only meaningful for macros that are defined more than once.
+redefinition :: Analysis -> Name -> Redefinition
+redefinition analysis name = case ambiguity analysis name of
+    Ambiguous   -> NotBenign
+    Unambiguous -> Benign
+
+ambiguity :: Analysis -> Name -> Ambiguity
+ambiguity analysis name
+    | name `Set.member` analysis.ambiguous = Ambiguous
+    | otherwise                            = Unambiguous
+
+-- | The names of all ambiguous macros
+ambiguous :: Analysis -> Set Name
+ambiguous analysis = analysis.ambiguous
+
+{-------------------------------------------------------------------------------
+  Unique expansion
+-------------------------------------------------------------------------------}
+
+-- | Check whether a macro invocation has a unique expansion
+--
+-- A macro invocation has a /unique/ expansion if it can be moved to any
+-- location further down the source file without changing the expansion result.
+-- We deem an expansion unique iff the invoked macro and all names in the
+-- arguments are unambiguous; see 'Analysis' for how that approximates the
+-- definition. Names that are not macros are unambiguous.
+isExpansionUnique :: (Name -> Ambiguity) -> ParseResult Invocation -> Bool
+isExpansionUnique ambiguityOf pInv =
+    case pInv.result of
+      Left _    -> False
+      Right inv -> all ((== Unambiguous) . ambiguityOf) (inv.name : inv.args)
+
+{-------------------------------------------------------------------------------
+  Dependents graph
+-------------------------------------------------------------------------------}
+
+-- | Partial map of macro names to names of /dependent/ macros
+--
+-- Each macro name @A@ is mapped to a set of names of macros that depend on @A@;
+-- see 'definition'.
+--
+-- For example, for these macro definitions:
+--
+-- > #define A B C D
+-- > #define F(B) A B C D
+--
+-- The mapping would be:
+--
+-- > A -> [   F]
+-- > B -> [A   ]
+-- > C -> [A, F]
+-- > D -> [A, F]
+--
+-- NOTE: this type is similar to the 'UseDeclGraph', but it includes *all* macro
+-- definitions, not just the ones that we parsed successfully.
+type DependentsGraph = Digraph () Name
+
+mkDependentsGraph :: [Definition] -> DependentsGraph
+mkDependentsGraph defs = Foldable.foldl' addDefinition Digraph.empty defs
+
+addDefinition :: DependentsGraph -> Definition -> DependentsGraph
+addDefinition g0 d = Foldable.foldl' f g0 d.deps
+  where
+    f :: DependentsGraph -> Name -> DependentsGraph
+    f g dep = Digraph.insertEdge dep () d.name g
diff --git a/src-internal/HsBindgen/Macro/UniqueExpansion/Parse.hs b/src-internal/HsBindgen/Macro/UniqueExpansion/Parse.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/UniqueExpansion/Parse.hs
@@ -0,0 +1,59 @@
+-- |
+--
+-- Intended for unqualified import.
+module HsBindgen.Macro.UniqueExpansion.Parse (
+    parseInvocation
+  ) where
+
+import Text.Parsec (anyToken, choice, manyTill, try)
+
+import Clang.HighLevel.Types (SourcePath, Token, TokenSpelling)
+
+import HsBindgen.Macro.Parse (Parser, identifierOrKeyword, punctuation,
+                              spelling)
+import HsBindgen.Macro.UniqueExpansion.Types (Invocation (..), Name (Name))
+
+{-------------------------------------------------------------------------------
+  Invocation
+-------------------------------------------------------------------------------}
+
+parseInvocation :: Parser Invocation
+parseInvocation = do
+    macroName <- toName <$> identifierOrKeyword
+    let
+        functionLike :: Parser Invocation
+        functionLike = do
+          args <- parseArgs
+          pure $ Invocation { name = macroName, args = args }
+
+        objectLike :: Parser Invocation
+        objectLike = do
+          pure $ Invocation { name = macroName, args = [] }
+    choice [try functionLike, objectLike]
+
+{-------------------------------------------------------------------------------
+  Arguments
+-------------------------------------------------------------------------------}
+
+-- | Collect the names an argument list mentions
+parseArgs :: Parser [Name]
+parseArgs = fmap concat $ do
+    punctuation "("
+    manyTill
+      (choice [
+          -- try to parse a name; a keyword counts as a name
+          try ((:[]) . toName <$> try identifierOrKeyword)
+          -- try to parse recursively inside nested matching parentheses
+        , try parseArgs
+          -- otherwise skip the next token
+        , [] <$ anyToken
+        ]
+      )
+      (try (punctuation ")"))
+
+{-------------------------------------------------------------------------------
+  Identifiers
+-------------------------------------------------------------------------------}
+
+toName :: Token SourcePath TokenSpelling -> Name
+toName = Name . spelling
diff --git a/src-internal/HsBindgen/Macro/UniqueExpansion/Types.hs b/src-internal/HsBindgen/Macro/UniqueExpansion/Types.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Macro/UniqueExpansion/Types.hs
@@ -0,0 +1,64 @@
+-- |
+--
+-- Intended for unqualified import.
+module HsBindgen.Macro.UniqueExpansion.Types (
+    Definition (..)
+  , Invocation (..)
+  , Name (..)
+  , Redefinition (..)
+  , Ambiguity (..)
+  ) where
+
+import Data.Set (Set)
+import Data.String (IsString)
+import Data.Text (Text)
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+-- | A macro definition, reduced to what the ambiguity analysis needs
+data Definition = Definition {
+      name    :: Name
+      -- | The names the definition depends on
+      --
+      -- The macro's own parameters are not dependencies, and have already been
+      -- removed here.
+    , deps    :: Set Name
+      -- | The definition, with each token reduced to its spelling
+      --
+      -- Two definitions are identical iff their spellings are equal. This
+      -- includes the parameter names, as in C (C23 6.10.5p2); 'deps' alone
+      -- cannot decide identity, since it drops everything but the free names.
+    , spelled :: Runtime.Macro.Raw Text
+    }
+  deriving stock (Show, Eq)
+
+data Invocation = Invocation {
+      name   :: Name
+      -- | All names used in the argument list
+      --
+      -- The number of names here does /not/ have any relationship with the
+      -- number of parameters for the macro definition that is being invoked. It
+      -- is simply a collection of all names referenced anywehere in the
+      -- invocation's argument list.
+    , args   :: [Name]
+    }
+  deriving stock (Show, Eq)
+
+newtype Name = Name {
+      unwrap :: Text
+    }
+  deriving newtype (Show, Eq, Ord)
+  deriving newtype IsString
+
+-- | May a macro that is defined more than once be treated as defined once?
+data Redefinition =
+    -- | The macro is unambiguous
+    Benign
+    -- | The macro is ambiguous: its definitions differ, one of them could not
+    -- be split, or it depends on an ambiguous macro
+  | NotBenign
+  deriving stock (Show, Eq)
+
+-- | Does the expansion of a macro depend on where it is invoked?
+data Ambiguity = Unambiguous | Ambiguous
+  deriving stock (Show, Eq)
diff --git a/src-internal/HsBindgen/NameHint.hs b/src-internal/HsBindgen/NameHint.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/NameHint.hs
@@ -0,0 +1,15 @@
+module HsBindgen.NameHint (
+    NameHint(..)
+  , toNameHint
+  ) where
+
+import HsBindgen.Language.Haskell qualified as Hs
+
+-- | Hint used to render bound variables
+--
+-- Invariant: the name hint must be valid Haskell for its intended context.
+newtype NameHint = NameHint String
+deriving newtype instance Show NameHint
+
+toNameHint :: Hs.Name 'Hs.NsVar -> NameHint
+toNameHint = NameHint . Hs.nameToStr
diff --git a/src-internal/HsBindgen/Orphans.hs b/src-internal/HsBindgen/Orphans.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Orphans.hs
@@ -0,0 +1,17 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+module HsBindgen.Orphans () where
+
+import Data.GADT.Compare (GEq (geq))
+import Data.Type.Equality ((:~:) (Refl))
+import DeBruijn (Idx, idxToInt)
+import Unsafe.Coerce (unsafeCoerce)
+
+{-------------------------------------------------------------------------------
+  DeBruijn
+-------------------------------------------------------------------------------}
+
+instance GEq Idx where
+  geq i j
+    | idxToInt i == idxToInt j = Just $ unsafeCoerce Refl
+    | otherwise                = Nothing
diff --git a/src-internal/HsBindgen/Resolve.hs b/src-internal/HsBindgen/Resolve.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Resolve.hs
@@ -0,0 +1,148 @@
+module HsBindgen.Resolve (
+    -- * Trace messages
+    ResolveHeaderMsg(..)
+    -- * API
+  , resolveHeaders
+  ) where
+
+import Control.Monad ((<=<))
+import Control.Monad.Trans.Maybe (MaybeT (..), runMaybeT)
+import Data.Either (partitionEithers)
+import Data.List.Compat ((!?))
+import Data.Map.Strict qualified as Map
+import Data.Set qualified as Set
+import Data.Text qualified as Text
+import Text.SimplePrettyPrint (hang, hsep, string)
+
+import Clang.Args
+import Clang.Enum.Simple
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types (Fold, foldContinue, foldContinueWith, simpleFold)
+import Clang.LowLevel.Core
+import Clang.Paths
+
+import HsBindgen.Clang
+import HsBindgen.Errors (panicIO)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Trace messages
+-------------------------------------------------------------------------------}
+
+data ResolveHeaderMsg =
+    ResolveHeaderClang ClangMsg
+  | ResolveHeaderFound C.HashIncludeArg RealPath
+  | ResolveHeaderNotFound C.HashIncludeArg
+
+    -- | Header not attempted to be resolved, /perhaps/ due to an error while
+    -- parsing previous headers
+    --
+    -- NOTE: We have not been able to construct an example that causes this to
+    -- happen, but we can at least detect if it happens.
+  | ResolveHeaderNotAttempted C.HashIncludeArg
+  deriving stock (Show)
+
+instance PrettyForTrace ResolveHeaderMsg where
+  prettyForTrace = \case
+    ResolveHeaderClang msg -> hang
+      "During header resolution:" 2 (prettyForTrace msg)
+    ResolveHeaderFound header path -> hsep [
+        "Header"
+      , string header.path
+      , "resolved to"
+      , string $ getRealPath path
+      ]
+    ResolveHeaderNotFound header -> hsep [
+        "Header"
+      , string header.path
+      , "could not be resolved (header not found)"
+      ]
+    ResolveHeaderNotAttempted header -> hsep [
+        "Header"
+      , string header.path
+      , "not attempted to be resolved"
+      ]
+
+instance IsTrace Level ResolveHeaderMsg where
+  getDefaultLogLevel = \case
+    ResolveHeaderClang x        -> getDefaultLogLevel x
+    ResolveHeaderFound{}        -> Info
+    ResolveHeaderNotFound{}     -> Error
+    ResolveHeaderNotAttempted{} -> Error
+  getSource = \case
+    ResolveHeaderClang x        -> getSource x
+    ResolveHeaderFound{}        -> HsBindgen
+    ResolveHeaderNotFound{}     -> HsBindgen
+    ResolveHeaderNotAttempted{} -> HsBindgen
+  getTraceId = const "resolve-header"
+
+{-------------------------------------------------------------------------------
+  API
+-------------------------------------------------------------------------------}
+
+-- | Resolve any number of headers
+resolveHeaders ::
+     Tracer ResolveHeaderMsg
+  -> ClangArgs
+  -> Set C.HashIncludeArg
+  -> IO (Map C.HashIncludeArg RealPath)
+resolveHeaders tracer args headers =
+      fmap (fromMaybe Map.empty)
+    . withClang' (contramap ResolveHeaderClang tracer) clangSetup
+    $ \unit -> do
+        root <- clang_getTranslationUnitCursor unit
+        (notFounds, successes) <-
+          bimap Set.fromList Map.fromList . partitionEithers
+            <$> HighLevel.clang_visitChildren root visit
+        forM_ headerList $ \header -> traceWith tracer $ withCallStack $
+          case Map.lookup header successes of
+            Just path -> ResolveHeaderFound header path
+            Nothing
+              | Set.member header notFounds -> ResolveHeaderNotFound header
+              | otherwise -> ResolveHeaderNotAttempted header
+        return $ Just successes
+  where
+    headerList :: [C.HashIncludeArg]
+    headerList = Set.toAscList headers
+
+    rootHeaderName :: FilePath
+    rootHeaderName = "hs-bindgen-resolve.h"
+
+    rootHeaderPath :: SourcePath
+    rootHeaderPath = SourcePath $ Text.pack rootHeaderName
+
+    rootHeaderContent :: String
+    rootHeaderContent = unlines [
+        "#include <" ++ header.path ++ ">"
+      | header <- headerList
+      ]
+
+    clangSetup :: ClangSetup
+    clangSetup = defaultClangSetup args $
+      ClangInputMemory rootHeaderName rootHeaderContent
+
+    -- We use the low-level location API here because this fold visits every
+    -- cursor, including those in the root header (a virtual in-memory file).
+    -- We only need the file name and line number to identify root-header
+    -- @#include@ directives, so building a full 'SingleLoc' via
+    -- 'clang_getCursorLocation'' would be unnecessary work.
+    visit :: Fold IO (Either C.HashIncludeArg (C.HashIncludeArg, RealPath))
+    visit = simpleFold $ \curr ->
+      maybe foldContinue foldContinueWith <=< runMaybeT $ do
+        (file, line, _col, _off) <-
+          clang_getExpansionLocation =<< clang_getCursorLocation curr
+        path <- clang_getFileName file
+        guard $ SourcePath path == rootHeaderPath
+        -- Only process inclusion directives
+        guard . (== Right CXCursor_InclusionDirective) . fromSimpleEnum
+          =<< clang_getCursorKind curr
+        -- Process inclusion directive
+        header <- maybe (panicIO "Unknown include") return $
+          headerList !? (fromIntegral line - 1)
+        includedFile <- clang_getIncludedFile curr
+        mRealPath <- liftIO $ HighLevel.clang_tryGetRealPath includedFile
+        return $ case mRealPath of
+          Nothing -> Left header
+          Just rp -> Right (header, rp)
diff --git a/src-internal/HsBindgen/TH/Internal.hs b/src-internal/HsBindgen/TH/Internal.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/TH/Internal.hs
@@ -0,0 +1,342 @@
+module HsBindgen.TH.Internal (
+    -- * Template Haskell API
+    Config
+  , IncludeDir(..)
+  , withHsBindgenMacroLang
+  , hashInclude
+  , hashDefine
+  , BindgenM
+
+   -- * Internal artefacts
+  , getExtensions
+  , getThDecls
+  ) where
+
+import Control.Monad.State (State, execState)
+import Control.Monad.State.Class (MonadState, modify)
+import Data.Foldable qualified as Foldable
+import Data.List qualified as List
+import Data.Set qualified as Set
+import Language.Haskell.TH qualified as TH
+import Language.Haskell.TH.Syntax (getPackageRoot)
+import System.FilePath (isAbsolute, (</>))
+
+import Clang.CStandard
+import Clang.Paths
+
+import HsBindgen
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Extensions
+import HsBindgen.Backend.Hs.CallConv
+import HsBindgen.Backend.SHs.AST qualified as SHs
+import HsBindgen.Backend.TH.Translation
+import HsBindgen.Config
+import HsBindgen.Config.Internal
+import HsBindgen.Errors
+import HsBindgen.Guasi
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Template Haskell API
+-------------------------------------------------------------------------------}
+
+-- | Configuration with C include directories
+--
+-- C include directories can be provided relative to the package root (see the
+-- 'IncludeDir' data constructor 'PkgDir').
+type Config = Config_ IncludeDir
+
+-- | C include directory added to the C include search path
+data IncludeDir =
+    -- | Include directory at absolute path
+    --
+    -- A relative path is warned about: it is resolved against the working
+    -- directory of the compiler invocation, not the package root.
+    AbsDir FilePath
+
+    -- | Include directory relative to package root
+    --
+    -- An absolute path is an error: it would discard the package root.
+  | PkgDir FilePath
+  deriving stock (Eq, Show, Generic)
+
+toFilePath :: FilePath -> IncludeDir -> FilePath
+toFilePath root (PkgDir x) = root </> x
+toFilePath _    (AbsDir x) = x
+
+-- | Misuse of an 'IncludeDir' constructor
+data IncludeDirMisuse =
+    -- | 'AbsDir' with a relative path
+    RelativeAbsDir FilePath
+
+    -- | 'PkgDir' with an absolute path
+  | AbsolutePkgDir FilePath
+  deriving stock (Eq, Show)
+
+checkIncludeDir :: IncludeDir -> Maybe IncludeDirMisuse
+checkIncludeDir = \case
+    AbsDir path | not (isAbsolute path) -> Just $ RelativeAbsDir path
+    PkgDir path | isAbsolute path       -> Just $ AbsolutePkgDir path
+    _otherwise                          -> Nothing
+
+-- | An absolute 'PkgDir' path discards the package root, so it is never what
+-- the user meant; a relative 'AbsDir' path does work, but only by accident.
+isFatal :: IncludeDirMisuse -> Bool
+isFatal RelativeAbsDir{}  = False
+isFatal AbsolutePkgDir{}  = True
+
+prettyIncludeDirMisuse :: IncludeDirMisuse -> String
+prettyIncludeDirMisuse = \case
+    RelativeAbsDir path -> unwords [
+        "Relative path in 'AbsDir " ++ show path ++ "':"
+      , "it is resolved relative to the working directory of the compiler"
+      , "invocation, which is not necessarily the package root."
+      , "Use an absolute path, or 'PkgDir' for a path relative to the"
+      , "package root."
+      ]
+    AbsolutePkgDir path -> unwords [
+        "Absolute path in 'PkgDir " ++ show path ++ "':"
+      , "the package root is discarded, so the path is not relative to it."
+      , "Use 'AbsDir' for an absolute path."
+      ]
+
+-- | Warn about, or reject, misuses of 'IncludeDir' constructors
+--
+-- NOTE: We report through Template Haskell instead of the tracer: the tracers
+-- are only created in 'hsBindgenMacroLang', which needs the configuration we
+-- are checking here. Consequently, the warning cannot be silenced via
+-- 'ConfigTH'. The same applies to 'checkLanguageExtensions'.
+checkIncludeDirs :: [IncludeDir] -> TH.Q ()
+checkIncludeDirs includeDirs = do
+    mapM_ (TH.reportWarning . prettyIncludeDirMisuse) warnings
+    unless (null errors) $
+      failQ $ List.intercalate "\n" $ map prettyIncludeDirMisuse errors
+  where
+    errors, warnings :: [IncludeDirMisuse]
+    (errors, warnings) =
+      List.partition isFatal $ mapMaybe checkIncludeDir includeDirs
+
+-- | Generate bindings for given C headers at compile-time using a custom
+-- macro language.
+--
+-- Use together with 'hashInclude', which acts in the 'TH.BindgenM' monad.
+--
+-- For example,
+--
+-- > withHsBindgenMacroLang myMacroLang def def $ do
+-- >   hashDefine "FOO_FEATURE" "1"
+-- >   hashInclude "foo.h"
+-- >   hashInclude "bar.h"
+withHsBindgenMacroLang ::
+     forall l. Macro.HasTypes l
+  => (ClangCStandard -> IO (Macro.Lang l))
+     --  ^ The callback returning the macro 'Macro.Lang' to use.
+  -> Config
+  -> ConfigTH
+  -> BindgenM ()
+  -> TH.Q [TH.Dec]
+withHsBindgenMacroLang mkMacroLang config configTH hashIncludes = do
+    packageRoot <- getPackageRoot
+
+    bindgenConfig <- toBindgenConfigTH config packageRoot configTH.categoryChoice
+
+    let tracerConfigUnsafe :: TracerConfig Level TraceMsg
+        tracerConfigUnsafe =
+          tracerConfigDefTH
+            & #verbosity      .~ configTH.verbosity
+            & #customLogLevel .~ getCustomLogLevel configTH.customLogLevels
+
+    let tracerConfigSafe :: TracerConfig SafeLevel SafeTraceMsg
+        tracerConfigSafe =
+          tracerConfigDefTH
+            & #verbosity .~ configTH.verbosity
+
+        -- Traverse root directives.
+        bindgenState :: BindgenState
+        bindgenState = execBindgenM hashIncludes (BindgenState [])
+
+        -- Restore original order of the directives.
+        uncheckedRootDirectives :: [C.UncheckedRootDirective]
+        uncheckedRootDirectives = reverse bindgenState.rootDirectives
+
+        artefact ::
+          Artefact l
+            ( [RealPath]
+            , ( [C.RootDirective C.HashIncludeArg]
+              , ([CWrapper], [SHs.SDecl])
+              )
+            )
+        artefact = (,)
+          <$> getDependencies
+          <*> ((,) <$> RootDirectives <*> (Foldable.fold <$> FinalDecls))
+
+    (deps, (rootDirectives, decls)) <- liftIO $ do
+        hsBindgenMacroLang
+          mkMacroLang
+          tracerConfigUnsafe
+          tracerConfigSafe
+          bindgenConfig
+          uncheckedRootDirectives
+          artefact
+
+    let fns  = bindgenConfig.frontend.fieldNamingStrategy
+        exts = uncurry (getExtensions fns) decls
+    checkLanguageExtensions exts
+    -- Reverse SDecl order to counteract GHC reversing TH type/class
+    -- declarations during dependency analysis, which causes Haddock to show
+    -- declarations in reverse order.
+    uncurry (getThDecls fns deps rootDirectives) (second reverse decls)
+
+-- | @#include@ (i.e., generate bindings for) a C header
+--
+-- For example, the Haskell code,
+--
+-- > hashInclude "a.h"
+--
+-- corresponds to the following C code using angular brackets,
+--
+-- > #include <a.h>
+--
+-- See 'withHsBindgen'.
+hashInclude :: FilePath -> BindgenM ()
+hashInclude arg = do
+    -- Prepend the directive to the list (the order will be reversed)
+    modify $ #rootDirectives %~ (C.DirectiveHashInclude arg:)
+
+-- | @#define@ a macro, in effect for all subsequent 'hashInclude's
+--
+-- > hashDefine "FOO" "1"    -- #define FOO 1
+-- > hashDefine "FOO" ""     -- #define FOO      (empty replacement list)
+-- > hashDefine "FOO(x)" "x" -- #define FOO(x) x
+--
+-- The directive applies to /all/ C stages: it is emitted both into the header
+-- @libclang@ parses and into the generated C wrapper source GHC compiles.
+--
+-- Neither argument is validated; see t'C.HashDefine'.
+--
+-- This is @#define@ syntax, /not/ C ompiler @-D@ syntax. For example, @-D FOO@
+-- corresponds to @--hash-define FOO 1@, translating to @#define FOO 1@.
+hashDefine ::
+     String -- ^ Macro name; may be function-like, e.g. @FOO(x)@
+  -> String -- ^ Replacement list; @""@ for @#define FOO@
+  -> BindgenM ()
+hashDefine name value = do
+    -- Prepend the directive to the list (the order will be reversed)
+    modify $ #rootDirectives %~ (C.DirectiveHashDefine (C.HashDefine name value):)
+
+{-------------------------------------------------------------------------------
+  Internal artefacts
+-------------------------------------------------------------------------------}
+
+-- | Get required extensions
+getExtensions :: FieldNamingStrategy -> [CWrapper] -> [SHs.SDecl] -> Set TH.Extension
+getExtensions fieldNaming wrappers decls =
+    userlandCapiExt <> foldMap (requiredExtensions fieldNaming) decls
+  where
+    userlandCapiExt = case wrappers of
+      []  -> Set.empty
+      _xs -> Set.singleton TH.TemplateHaskell
+
+-- | Get Template Haskell declarations
+--
+-- Internal!
+--
+-- Non-IO part of 'withHsBindgen'.
+getThDecls
+    :: Guasi q
+    => FieldNamingStrategy
+    -> [RealPath]
+    -> [C.RootDirective C.HashIncludeArg]
+    -> [CWrapper]
+    -> [SHs.SDecl]
+    -> q [TH.Dec]
+getThDecls fns deps rootDirectives wrappers decls = do
+    -- Record dependencies, including transitively included headers.
+    mapM_ (addDependentFile . getRealPath) deps
+
+    -- Add userland-CAPI wrappers source code.
+    unless (null wrapperSrc) $ addCSource wrapperSrc
+
+    -- Generate TH declarations.
+    xs <- fmap concat $ traverse (mkDecl fns) decls
+
+    -- Report warnings/errors.
+    reportMissingModules
+
+    pure xs
+  where
+    wrapperSrc :: String
+    wrapperSrc = getCWrappersSource rootDirectives wrappers
+
+    reportMissingModules :: Guasi q => q ()
+    reportMissingModules = do
+      missingModules <- (.missingModules) <$> getGuasi
+      unless (Set.null missingModules) $ do
+        reportError $ concat $
+          "External types not in scope. Add the following import(s):\n"
+          : map getImportStatement (Set.elems missingModules)
+
+    getImportStatement :: Hs.ModuleName -> String
+    getImportStatement m =
+      "    import " <> Hs.moduleNameToString m <> " qualified"
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+-- | The default tracer configuration in Q uses 'outputConfigTH'
+tracerConfigDefTH :: TracerConfig l a
+tracerConfigDefTH = def{outputConfig = outputConfigTH}
+
+-- | State monad used by 'HsBindgen.withBindgen'
+newtype BindgenM a = BindgenM { unwrap :: State BindgenState a }
+  deriving newtype (Functor, Applicative, Monad, MonadState BindgenState)
+
+execBindgenM :: BindgenM a -> BindgenState -> BindgenState
+execBindgenM = execState . (.unwrap)
+
+-- | State manipulated by 'hashInclude' and 'hashDefine'
+--
+-- Internal!
+data BindgenState = BindgenState {
+      rootDirectives :: [C.UncheckedRootDirective]
+    }
+  deriving stock (Generic)
+
+-- NOTE: We could also check which enabled extension may interfere with the
+-- generated code (e.g. Strict/Data).
+--
+-- NOTE: We report through Template Haskell instead of the tracer; see
+-- 'checkIncludeDirs'.
+checkLanguageExtensions :: Set TH.Extension -> TH.Q ()
+checkLanguageExtensions requiredExts = do
+    enabledExts <- Set.fromList <$> extsEnabled
+    let missingExts  = requiredExts `Set.difference` enabledExts
+
+    unless (null missingExts) $ do
+      failQ $ unlines $
+        "Missing language extension(s): " :
+          (map (("    - " ++) . show) (toList missingExts))
+
+toBindgenConfigTH :: Config -> FilePath -> ByCategory Choice -> TH.Q BindgenConfig
+toBindgenConfigTH config packageRoot choice = do
+    checkIncludeDirs $ Foldable.toList config
+    uniqueId <- getUniqueId
+    hsModuleName <- fromString . TH.loc_module <$> TH.location
+    let bindgenConfig :: BindgenConfig
+        bindgenConfig =
+          toBindgenConfig
+            (toFilePath packageRoot <$> config)
+            uniqueId
+            hsModuleName
+            choice
+    pure bindgenConfig
+  where
+    getUniqueId :: TH.Q UniqueId
+    getUniqueId = UniqueId . TH.loc_package <$> TH.location
diff --git a/src-internal/HsBindgen/Test.hs b/src-internal/HsBindgen/Test.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Test.hs
@@ -0,0 +1,108 @@
+module HsBindgen.Test (
+    genTests
+  ) where
+
+import Data.Char qualified as Char
+import Data.List qualified as List
+import System.Directory qualified as Dir
+import System.FilePath qualified as FilePath
+
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Config
+import HsBindgen.Config.Prelims
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Test.C (genTestsC)
+import HsBindgen.Test.Hs (genTestsHs)
+import HsBindgen.Test.Readme (genTestsReadme)
+
+{-------------------------------------------------------------------------------
+  Generation
+-------------------------------------------------------------------------------}
+
+-- | Generate test suite
+genTests ::
+     [C.RootDirective C.HashIncludeArg]
+  -> ByCategory_ [Hs.Decl l]
+  -> BaseModuleName -- ^ Generated Haskell module name
+  -> FilePath       -- ^ Test suite directory path
+  -> IO ()
+genTests rootDirectives decls baseModule testSuitePath = do
+    -- fails when testSuitePath already exists
+    mapM_ Dir.createDirectory $
+      testSuitePath : cbitsPath : srcPath : modulePaths
+    genTestsReadme
+      readmePath
+      baseModule
+      testSuitePath
+      cTestHeaderPath
+      cTestSourcePath
+    genTestsC
+      cTestHeaderPath
+      cTestSourcePath
+      rootDirectives
+      decls
+    genTestsHs
+      hsTestPath
+      hsSpecPath
+      hsMainPath
+      baseModule
+      cTestHeaderPath
+      decls
+  where
+    readmePath, cbitsPath, srcPath :: FilePath
+    readmePath = FilePath.combine testSuitePath "README.md"
+    cbitsPath  = FilePath.combine testSuitePath "cbits"
+    srcPath    = FilePath.combine testSuitePath "src"
+
+    cTestHeaderPath, cTestSourcePath :: FilePath
+    (cTestHeaderPath, cTestSourcePath) =
+      bimap (FilePath.combine cbitsPath) (FilePath.combine cbitsPath) $
+        getModuleCFilenames moduleName
+
+    modulePath, hsTestPath, hsSpecPath, hsMainPath :: FilePath
+    modulePaths :: [FilePath]
+    (modulePath, modulePaths) = getModuleDirectories srcPath moduleName
+    hsTestPath                = FilePath.combine modulePath "Test.hs"
+    hsSpecPath                = FilePath.combine srcPath "Spec.hs"
+    hsMainPath                = FilePath.combine srcPath "Main.hs"
+
+    moduleName :: String
+    moduleName = baseModuleNameToString baseModule
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+getModuleCFilenames ::
+     String               -- ^ Module name (example: @Acme.Foo@)
+  -> (FilePath, FilePath) -- ^ Header and source filenames
+getModuleCFilenames moduleName =
+    let basename = "test_" ++ List.map aux moduleName
+    in  (FilePath.addExtension basename "h", FilePath.addExtension basename "c")
+  where
+    aux :: Char -> Char
+    aux c
+      | Char.isAlphaNum c = Char.toLower c
+      | otherwise         = '_'
+
+getModuleDirectories ::
+     FilePath                -- ^ Parent directory
+  -> String                  -- ^ Module name (example: @Acme.Foo@)
+  -> (FilePath, [FilePath])  -- ^ Module directory and directories to create
+getModuleDirectories parentDir = aux [] . List.break (== '.')
+  where
+    aux :: [FilePath] -> (String, String) -> (FilePath, [FilePath])
+    aux [] = \case
+      (part, []) ->
+        let path' = FilePath.combine parentDir part
+        in  (path', [path'])
+      (part, _dot : s) ->
+        aux [FilePath.combine parentDir part] $ List.break (== '.') s
+    aux acc@(path:_paths) = \case
+      (part, []) ->
+        let path' = FilePath.combine path part
+        in  (path', reverse (path' : acc))
+      (part, _dot : s) ->
+        aux (FilePath.combine path part : acc) $ List.break (== '.') s
diff --git a/src-internal/HsBindgen/Test/C.hs b/src-internal/HsBindgen/Test/C.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Test/C.hs
@@ -0,0 +1,331 @@
+module HsBindgen.Test.C (
+    genTestsC
+  ) where
+
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Errors
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  Generation
+-------------------------------------------------------------------------------}
+
+-- | Generate C test header and source files
+genTestsC ::
+     FilePath                -- ^ C test header file path
+  -> FilePath                -- ^ C test source file path
+  -> [C.RootDirective C.HashIncludeArg]
+                             -- ^ Root directives (rendered verbatim)
+  -> ByCategory_ [Hs.Decl l] -- ^ Declarations
+  -> IO ()
+genTestsC = throwPure_TODO 22 "generate test suite"
+
+{-
+genTestsC cTestHeaderPath cTestSourcePath lineLength cHeaderPath decls = do
+    writeFile cTestHeaderPath $ renderPretty ctx CTestHeader{..}
+    writeFile cTestSourcePath $ renderPretty ctx CTestSource{..}
+  where
+    ctx :: Context
+    ctx = mkContext lineLength
+
+    cTestHeaderFilename, cHeaderFilename :: FilePath
+    cTestHeaderFilename = FilePath.takeFileName cTestHeaderPath
+    cHeaderFilename = Posix.takeFileName $ getHashIncludeArg cHeaderPath
+
+    cFunPrefix :: CFunPrefix
+    cFunPrefix = getCFunPrefix cTestHeaderFilename
+
+    cTestHeaderIncludeGuard :: IncludeGuard
+    cTestHeaderIncludeGuard = getIncludeGuard cTestHeaderFilename
+
+    cTestHeaderUsrIncludes, cTestHeaderSysIncludes :: [IncludeFile]
+    cTestHeaderUsrIncludes = [cHeaderFilename]
+    cTestHeaderSysIncludes = ["stdbool.h", "stddef.h"]
+
+    cTestHeaderDecls :: [CTestDecl]
+    cTestHeaderDecls = concatMap (getTestHeaderDecls cFunPrefix) decls
+
+    cTestSourceUsrIncludes, cTestSourceSysIncludes :: [IncludeFile]
+    cTestSourceUsrIncludes = List.sort
+      ["hs_bindgen_test_runtime.h" , cHeaderFilename , cTestHeaderFilename]
+    cTestSourceSysIncludes = ["stdalign.h", "stdbool.h", "stddef.h"]
+
+    cTestSourceDefns :: [CTestDefn]
+    cTestSourceDefns = concatMap (getTestSourceDefns cFunPrefix) decls
+
+getTestHeaderDecls :: CFunPrefix -> Hs.Decl -> [CTestDecl]
+getTestHeaderDecls cFunPrefix = \case
+    Hs.DeclDefineInstance instanceDecl -> case instanceDecl of
+      Hs.InstanceStorable Hs.Struct{..} _storableInstance ->
+        case getStructCTypeSpelling structOrigin of
+          Just cts ->
+            [ CTestSizeofDecl   cFunPrefix structName
+            , CTestAlignofDecl  cFunPrefix structName
+            , CTestGenseqhsDecl cFunPrefix structName cts
+            , CTestGenseqcDecl  cFunPrefix structName cts
+            , CTestPerturbDecl  cFunPrefix structName cts
+            ]
+          Nothing -> []
+      _otherwise -> []
+    _otherwise -> []
+
+getTestSourceDefns :: CFunPrefix -> Hs.Decl -> [CTestDefn]
+getTestSourceDefns cFunPrefix = \case
+    Hs.DeclDefineInstance instanceDecl -> case instanceDecl of
+      Hs.InstanceStorable Hs.Struct{..} _storableInstance ->
+        case getStructCTypeSpelling structOrigin of
+          Just cts ->
+            let fieldPs = getFieldP <$> structFields
+            in  [ CTestSizeofDefn   cFunPrefix structName cts
+                , CTestAlignofDefn  cFunPrefix structName cts
+                , CTestGenseqhsDefn cFunPrefix structName cts fieldPs
+                , CTestGenseqcDefn  cFunPrefix structName cts fieldPs
+                , CTestPerturbDefn  cFunPrefix structName cts fieldPs
+                ]
+          Nothing -> []
+      _otherwise -> []
+    _otherwise -> []
+
+getStructCTypeSpelling :: Hs.StructOrigin -> Maybe CTypeSpelling
+getStructCTypeSpelling = \case
+    Hs.StructOriginStruct C.Struct{..} -> case structDeclPath of
+      C.DeclPathAnon ctxt ->
+        case ctxt of
+          C.DeclPathCtxtTypedef typedefName ->
+            Just $ T.unpack (C.getName typedefName)
+          _otherwise ->
+            Nothing
+      C.DeclPathName cName ->
+          Just $ "struct " ++ T.unpack (C.getName cName)
+    Hs.StructOriginEnum{} -> Nothing
+
+getFieldP :: Hs.Field -> FieldP
+getFieldP Hs.Field{..} = (cName, hsTypeName)
+  where
+    cName :: C.Name
+    cName = case fieldOrigin of
+      Hs.FieldOriginNone -> panicPure "unexpected FieldOriginNone in struct"
+      Hs.FieldOriginStructField cStructField -> C.fieldName cStructField
+
+    hsTypeName :: HsTypeName
+    hsTypeName = case fieldType of
+      Hs.HsPrimType hsPrimType -> case hsPrimType of
+        HsT.HsPrimCChar    -> "CChar"
+        HsT.HsPrimCSChar   -> "CSChar"
+        HsT.HsPrimCUChar   -> "CUChar"
+        HsT.HsPrimCInt     -> "CInt"
+        HsT.HsPrimCUInt    -> "CUInt"
+        HsT.HsPrimCShort   -> "CShort"
+        HsT.HsPrimCUShort  -> "CUShort"
+        HsT.HsPrimCLong    -> "CLong"
+        HsT.HsPrimCULong   -> "CULong"
+        HsT.HsPrimCLLong   -> "CLLong"
+        HsT.HsPrimCULLong  -> "CULLong"
+        HsT.HsPrimCBool    -> "CBool"
+        HsT.HsPrimCFloat   -> "CFloat"
+        HsT.HsPrimCDouble  -> "CDouble"
+        HsT.HsPrimCPtrDiff -> "CPtrdiff"
+        HsT.HsPrimCSize    -> "CSize"
+        x -> throwPure_TODO 447 $ "not supported: " ++ show (typeOf x)
+      x -> throwPure_TODO 447 $ "not supported: " ++ show (typeOf x)
+
+{-------------------------------------------------------------------------------
+  AST
+-------------------------------------------------------------------------------}
+
+type CTypeSpelling = String
+type FieldP        = (C.Name, HsTypeName)
+type HsTypeName    = String
+type IncludeFile   = String
+type IncludeGuard  = String
+
+data CTestHeader = CTestHeader {
+      cTestHeaderIncludeGuard :: IncludeGuard
+    , cTestHeaderUsrIncludes  :: [IncludeFile]
+    , cTestHeaderSysIncludes  :: [IncludeFile]
+    , cTestHeaderDecls        :: [CTestDecl]
+    }
+
+data CTestDecl =
+      CTestSizeofDecl   CFunPrefix (HsName NsTypeConstr)
+    | CTestAlignofDecl  CFunPrefix (HsName NsTypeConstr)
+    | CTestGenseqhsDecl CFunPrefix (HsName NsTypeConstr) CTypeSpelling
+    | CTestGenseqcDecl  CFunPrefix (HsName NsTypeConstr) CTypeSpelling
+    | CTestPerturbDecl  CFunPrefix (HsName NsTypeConstr) CTypeSpelling
+
+data CTestSource = CTestSource {
+      cTestSourceUsrIncludes :: [IncludeFile]
+    , cTestSourceSysIncludes :: [IncludeFile]
+    , cTestSourceDefns       :: [CTestDefn]
+    }
+
+data CTestDefn =
+      CTestSizeofDefn   CFunPrefix (HsName NsTypeConstr) CTypeSpelling
+    | CTestAlignofDefn  CFunPrefix (HsName NsTypeConstr) CTypeSpelling
+    | CTestGenseqhsDefn CFunPrefix (HsName NsTypeConstr) CTypeSpelling [FieldP]
+    | CTestGenseqcDefn  CFunPrefix (HsName NsTypeConstr) CTypeSpelling [FieldP]
+    | CTestPerturbDefn  CFunPrefix (HsName NsTypeConstr) CTypeSpelling [FieldP]
+
+{-------------------------------------------------------------------------------
+  Pretty printing
+-------------------------------------------------------------------------------}
+
+instance Pretty CTestHeader where
+  pretty CTestHeader{..} = vsep $
+      vcat
+        [ "#ifndef" <+> string cTestHeaderIncludeGuard
+        , "#define" <+> string cTestHeaderIncludeGuard
+        ]
+    : vcat ["#include \"" >< string inc >< "\"" | inc <- cTestHeaderUsrIncludes]
+    : vcat ["#include <" >< string inc >< ">" | inc <- cTestHeaderSysIncludes]
+    : map pretty cTestHeaderDecls
+    ++ ["#endif //" <+> string cTestHeaderIncludeGuard]
+
+instance Pretty CTestDecl where
+  pretty = \case
+    CTestSizeofDecl pfx name ->
+      prettyFun
+        (hcat ["size_t ", string pfx, "_sizeof_", prettyHsName name])
+        ["void"]
+        ";"
+    CTestAlignofDecl pfx name ->
+      prettyFun
+        (hcat ["size_t ", string pfx, "_alignof_", prettyHsName name])
+        ["void"]
+        ";"
+    CTestGenseqhsDecl pfx name cts ->
+      prettyFun
+        (hcat ["bool ", string pfx, "_genseqhs_", prettyHsName name])
+        [string cts <+> "const *const"]
+        ";"
+    CTestGenseqcDecl pfx name cts ->
+      prettyFun
+        (hcat ["void ", string pfx, "_genseqc_", prettyHsName name])
+        [string cts <+> "*const"]
+        ";"
+    CTestPerturbDecl pfx name cts ->
+      prettyFun
+        (hcat ["void ", string pfx, "_perturb_", prettyHsName name])
+        [ "long"
+        , string cts <+> "const *const"
+        , string cts <+> "*const"
+        ]
+        ";"
+
+instance Pretty CTestSource where
+  pretty CTestSource{..} = vsep $
+      vcat ["#include \"" >< string inc >< "\"" | inc <- cTestSourceUsrIncludes]
+    : vcat ["#include <" >< string inc >< ">" | inc <- cTestSourceSysIncludes]
+    : map pretty cTestSourceDefns
+
+instance Pretty CTestDefn where
+  pretty = \case
+    CTestSizeofDefn pfx name cts -> vcat
+      [ prettyFun
+          (hcat ["size_t ", string pfx, "_sizeof_", prettyHsName name])
+          ["void"]
+          " {"
+      , nest 2 $ hcat ["return sizeof(", string cts, ");"]
+      , "}"
+      ]
+    CTestAlignofDefn pfx name cts -> vcat
+      [ prettyFun
+          (hcat ["size_t ", string pfx, "_alignof_", prettyHsName name])
+          ["void"]
+          " {"
+      , nest 2 $ hcat ["return alignof(", string cts, ");"]
+      , "}"
+      ]
+    CTestGenseqhsDefn pfx name cts fieldPairs ->
+      let numFieldPairs = length fieldPairs
+      in  vcat
+            [ prettyFun
+                (hcat ["bool ", string pfx, "_genseqhs_", prettyHsName name])
+                [string cts <+> "const *const source"]
+                " {"
+            , nest 2 $ "return" <+> fsep
+                [ hcat
+                    [ "source->"
+                    , prettyCName cField
+                    , " == hsbg_genseq_"
+                    , string hsFieldType
+                    , "("
+                    , showToCtxDoc idx
+                    , ")"
+                    , if idx == numFieldPairs
+                        then ";"
+                        else " &&"
+                    ]
+                | (idx, (cField, hsFieldType)) <- zip [1..] fieldPairs
+                ]
+            , "}"
+            ]
+    CTestGenseqcDefn pfx name cts fieldPairs -> vcat $
+        prettyFun
+          (hcat ["void ", string pfx, "_genseqc_", prettyHsName name])
+          [string cts <+> "*const target"]
+          " {"
+      : [ nest 2 $ hcat
+            [ "target->"
+            , prettyCName cField
+            , " = hsbg_genseq_"
+            , string hsFieldType
+            , "("
+            , showToCtxDoc @Int idx
+            , ");"
+            ]
+        | (idx, (cField, hsFieldType)) <- zip [1..] fieldPairs
+        ]
+      ++ ["}"]
+    CTestPerturbDefn pfx name cts fieldPairs -> vcat $
+        prettyFun
+          (hcat ["void ", string pfx, "_perturb_", prettyHsName name])
+          [ "long size"
+          , string cts <+> "const *const source"
+          , string cts <+> "*const target"
+          ]
+          " {"
+      : [ nest 2 $ hcat
+            [ "target->"
+            , prettyCName cField
+            , " = hsbg_perturb_"
+            , string hsFieldType
+            , "(size, source->"
+            , prettyCName cField
+            , ");"
+            ]
+        | (cField, hsFieldType) <- fieldPairs
+        ]
+      ++ ["}"]
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+getIncludeGuard ::
+     FilePath  -- ^ C test header filename
+  -> String
+getIncludeGuard = List.map aux
+  where
+    aux :: Char -> Char
+    aux c
+      | Char.isAlphaNum c = Char.toUpper c
+      | otherwise         = '_'
+
+prettyCName :: C.Name -> CtxDoc
+prettyCName = string . T.unpack . C.getName
+
+prettyFun ::
+     CtxDoc    -- ^ Part before opening paren
+  -> [CtxDoc]  -- ^ Parameters/arguments
+  -> CtxDoc    -- ^ Part after closing paren
+  -> CtxDoc
+prettyFun lDoc args rDoc = lDoc >< "(" >< fsep
+    [ if idx < numArgs then arg >< "," else arg >< ")" >< rDoc
+    | (idx, arg) <- zip [1..] args
+    ]
+  where
+    numArgs :: Int
+    numArgs = length args
+-}
diff --git a/src-internal/HsBindgen/Test/Hs.hs b/src-internal/HsBindgen/Test/Hs.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Test/Hs.hs
@@ -0,0 +1,511 @@
+module HsBindgen.Test.Hs (
+    genTestsHs
+  ) where
+
+import HsBindgen.Backend.Category
+import HsBindgen.Backend.Hs.AST qualified as Hs
+import HsBindgen.Config
+import HsBindgen.Errors
+
+{-------------------------------------------------------------------------------
+  Generation
+-------------------------------------------------------------------------------}
+
+-- | Generate Haskell test modules
+genTestsHs ::
+     FilePath              -- ^ Test module path
+  -> FilePath              -- ^ Spec module path
+  -> FilePath              -- ^ Main module path
+  -> BaseModuleName        -- ^ Generated Haskell module name
+  -> FilePath              -- ^ C test header file path
+  -> ByCategory_ [Hs.Decl l] -- ^ Declarations
+  -> IO ()
+genTestsHs = throwPure_TODO 22 "generate test suite"
+
+{-
+genTestsHs
+  hsTestPath
+  hsSpecPath
+  hsMainPath
+  moduleName
+  cTestHeaderPath
+  lineLength
+  decls = do
+    writeFile hsTestPath $ renderPretty ctx HsTestModule{..}
+    writeFile hsSpecPath $ renderPretty ctx (HsSpecModule hsTestModuleName)
+    writeFile hsMainPath $ renderPretty ctx HsMainModule
+  where
+    ctx :: Context
+    ctx = mkContext lineLength
+
+    cTestHeaderFilename :: FilePath
+    cTestHeaderFilename = FilePath.takeFileName cTestHeaderPath
+
+    cFunPrefix :: CFunPrefix
+    cFunPrefix = getCFunPrefix cTestHeaderFilename
+
+    hsTestModulePragmas :: [Pragma]
+    hsTestModulePragmas =
+      [ "LANGUAGE CApiFFI"
+      , "LANGUAGE RecordWildCards"
+      , "LANGUAGE TypeApplications"
+      , "OPTIONS_GHC -Wno-orphans"
+      ]
+
+    hsTestModuleName :: ModuleName
+    hsTestModuleName = moduleName ++ ".Test"
+
+    hsTestModuleImports :: [Import]
+    hsTestModuleImports = List.sort
+      -- source below ordered by abbreviation
+      [ ("Foreign",                             "F")
+      , ("Foreign.C",                           "FC")
+      , ("HsBindgen.TestRuntime.GenSeq",        "GenSeq")
+      , ("HsBindgen.TestRuntime.Perturb",       "Perturb")
+      , ("Data.Proxy",                          "Proxy")
+      , ("Test.QuickCheck",                     "QC")
+      , ("HsBindgen.TestRuntime.RepZero",       "RepZero")
+      , ("HsBindgen.TestRuntime.SameSemantics", "SameSemantics")
+      , ("HsBindgen.TestRuntime.Storable",      "Storable")
+      , ("Test.Tasty",                          "Tasty")
+      , ("Test.Tasty.HUnit",                    "THU")
+      , ("Test.Tasty.QuickCheck",               "TQC")
+      , (moduleName,                            "X")
+      ]
+
+    hsTestModuleFfiFunctions :: [FfiFunction]
+    hsTestModuleFfiFunctions =
+      concatMap (getFfiFunctions cTestHeaderFilename cFunPrefix) decls
+
+    hsTestModuleOrphanInstances :: [OrphanInstance]
+    hsTestModuleOrphanInstances = concatMap getOrphanInstances decls
+
+    hsTestModuleTypeTests :: [TypeTest]
+    hsTestModuleTypeTests = concatMap getTypeTests decls
+
+    hsTestModuleTestsFun :: TestsFun
+    hsTestModuleTestsFun =
+      TestsFun moduleName $ concatMap getTestsFunNames decls
+
+getFfiFunctions :: IncludeFile -> CFunPrefix -> Hs.Decl -> [FfiFunction]
+getFfiFunctions includeFile cFunPrefix = \case
+    Hs.DeclDefineInstance instanceDecl -> case instanceDecl of
+      Hs.InstanceStorable Hs.Struct{..} _storableInstance ->
+        [ FfiSizeof   includeFile cFunPrefix structName
+        , FfiAlignof  includeFile cFunPrefix structName
+        , FfiGenSeqHs includeFile cFunPrefix structName
+        , FfiGenSeqC  includeFile cFunPrefix structName
+        , FfiPerturb  includeFile cFunPrefix structName
+        ]
+      _otherwise -> []
+    _otherwise -> []
+
+getOrphanInstances :: Hs.Decl -> [OrphanInstance]
+getOrphanInstances = \case
+    Hs.DeclDefineInstance instanceDecl -> case instanceDecl of
+      Hs.InstanceStorable Hs.Struct{..} _storableInstance ->
+        let fieldNames = Hs.fieldName <$> structFields
+        in  [ ArbitraryInstance     structName structConstr fieldNames
+            , GenSeqInstance        structName structConstr fieldNames
+            , PerturbInstance       structName structConstr fieldNames
+            , SameSemanticsInstance structName              fieldNames
+            ]
+      _otherwise -> []
+    _otherwise -> []
+
+getTypeTests :: Hs.Decl -> [TypeTest]
+getTypeTests = \case
+    Hs.DeclDefineInstance instanceDecl -> case instanceDecl of
+      Hs.InstanceStorable Hs.Struct{..} _storableInstance ->
+        [TypeTest structName]
+      _otherwise -> []
+    _otherwise -> []
+
+getTestsFunNames :: Hs.Decl -> [HsName NsTypeConstr]
+getTestsFunNames = \case
+    Hs.DeclDefineInstance instanceDecl -> case instanceDecl of
+      Hs.InstanceStorable Hs.Struct{..} _storableInstance -> [structName]
+      _otherwise -> []
+    _otherwise -> []
+
+{-------------------------------------------------------------------------------
+  AST
+-------------------------------------------------------------------------------}
+
+type Import      = (ModuleName, ImportAbbr)
+type ImportAbbr  = String
+type IncludeFile = String
+type ModuleName  = String
+type Pragma      = String
+
+data HsTestModule = HsTestModule {
+      hsTestModulePragmas         :: [Pragma]
+    , hsTestModuleName            :: ModuleName
+    , hsTestModuleImports         :: [Import]
+    , hsTestModuleFfiFunctions    :: [FfiFunction]
+    , hsTestModuleOrphanInstances :: [OrphanInstance]
+    , hsTestModuleTypeTests       :: [TypeTest]
+    , hsTestModuleTestsFun        :: TestsFun
+    }
+
+data FfiFunction =
+    FfiSizeof   IncludeFile CFunPrefix (HsName NsTypeConstr)
+  | FfiAlignof  IncludeFile CFunPrefix (HsName NsTypeConstr)
+  | FfiGenSeqHs IncludeFile CFunPrefix (HsName NsTypeConstr)
+  | FfiGenSeqC  IncludeFile CFunPrefix (HsName NsTypeConstr)
+  | FfiPerturb  IncludeFile CFunPrefix (HsName NsTypeConstr)
+
+data OrphanInstance =
+    ArbitraryInstance     (HsName NsTypeConstr) (HsName NsConstr) [HsName NsVar]
+  | GenSeqInstance        (HsName NsTypeConstr) (HsName NsConstr) [HsName NsVar]
+  | PerturbInstance       (HsName NsTypeConstr) (HsName NsConstr) [HsName NsVar]
+  | SameSemanticsInstance (HsName NsTypeConstr)                   [HsName NsVar]
+
+newtype TypeTest = TypeTest (HsName NsTypeConstr)
+
+data TestsFun = TestsFun ModuleName [HsName NsTypeConstr]
+
+newtype HsSpecModule = HsSpecModule ModuleName
+
+data HsMainModule = HsMainModule
+
+{-------------------------------------------------------------------------------
+  Pretty printing
+-------------------------------------------------------------------------------}
+
+instance Pretty HsTestModule where
+  pretty HsTestModule{..} = vsep $
+      vcat
+        [ hsep ["{-#", string pragma, "#-}"]
+        | pragma <- hsTestModulePragmas
+        ]
+    : hcat ["module ", string hsTestModuleName, " (tests) where"]
+    : vcat
+        [ hsep ["import qualified", string moduleName, "as", string importAbbr]
+        | (moduleName, importAbbr) <- hsTestModuleImports
+        ]
+    : prettySection "FFI"
+    : map pretty hsTestModuleFfiFunctions
+    ++ prettySection "Instances"
+    : map pretty hsTestModuleOrphanInstances
+    ++ prettySection "Tests"
+    : map pretty hsTestModuleTypeTests
+    ++ [pretty hsTestModuleTestsFun]
+
+instance Pretty FfiFunction where
+  pretty = \case
+    FfiSizeof   inc pfx name -> prettyFfiSizeof   inc pfx name
+    FfiAlignof  inc pfx name -> prettyFfiAlignof  inc pfx name
+    FfiGenSeqHs inc pfx name -> prettyFfiGenSeqHs inc pfx name
+    FfiGenSeqC  inc pfx name -> prettyFfiGenSeqC  inc pfx name
+    FfiPerturb  inc pfx name -> prettyFfiPerturb  inc pfx name
+
+prettyFfiSizeof :: IncludeFile -> CFunPrefix -> HsName NsTypeConstr -> CtxDoc
+prettyFfiSizeof inc pfx name =
+    hang
+      ( hcat
+          [ "foreign import capi unsafe \"", string inc, " "
+          , string pfx, "_sizeof_", prettyHsName name, "\""
+          ]
+      )
+      2
+      (hcat ["sizeof", prettyHsName name, " :: IO FC.CSize"])
+
+prettyFfiAlignof :: IncludeFile -> CFunPrefix -> HsName NsTypeConstr -> CtxDoc
+prettyFfiAlignof inc pfx name =
+    hang
+      ( hcat
+          [ "foreign import capi unsafe \"", string inc, " "
+          , string pfx, "_alignof_", prettyHsName name, "\""
+          ]
+      )
+      2
+      (hcat ["alignof", prettyHsName name, " :: IO FC.CSize"])
+
+prettyFfiGenSeqHs :: IncludeFile -> CFunPrefix -> HsName NsTypeConstr -> CtxDoc
+prettyFfiGenSeqHs inc pfx' name' = vsep
+    [ hang
+        ( hcat ["genSeqHs", name, " :: X.", name, " -> IO Bool"]
+            $$ hcat ["genSeqHs", name, " x = F.alloca $ \\ptr -> do"]
+        )
+        4
+        ( "F.poke ptr x"
+            $$ hcat ["(/= 0) <$> ", pfx, "_genseqhs_", name, " ptr"]
+        )
+    , hang
+        ( hcat
+            [ "foreign import capi unsafe \"", string inc, " "
+            , pfx, "_genseqhs_", name, "\""
+            ]
+        )
+        2
+        ( hcat
+            [pfx, "_genseqhs_", name, " :: F.Ptr X.", name, " -> IO FC.CBool"]
+        )
+    ]
+  where
+    pfx, name :: CtxDoc
+    pfx  = string pfx'
+    name = prettyHsName name'
+
+prettyFfiGenSeqC :: IncludeFile -> CFunPrefix -> HsName NsTypeConstr -> CtxDoc
+prettyFfiGenSeqC inc pfx' name' = vsep
+    [ hang
+        ( hcat ["genSeqC", name, " :: IO X.", name]
+            $$ hcat ["genSeqC", name, " x = F.alloca $ \\ptr -> do"]
+        )
+        4
+        ( hcat [pfx, "_genseqc_", name, " ptr"]
+            $$ "F.peek ptr"
+        )
+    , hang
+        ( hcat
+            [ "foreign import capi unsafe \"", string inc, " "
+            , pfx, "_genseqc_", name, "\""
+            ]
+        )
+        2
+        (hcat [pfx, "_genseqc_", name, " :: F.Ptr X.", name, " -> IO ()"])
+    ]
+  where
+    pfx, name :: CtxDoc
+    pfx  = string pfx'
+    name = prettyHsName name'
+
+prettyFfiPerturb :: IncludeFile -> CFunPrefix -> HsName NsTypeConstr -> CtxDoc
+prettyFfiPerturb inc pfx' name' = vsep
+    [ hang
+        ( hcat ["perturb", name, " :: FC.CLong -> X.", name, " -> IO X.", name]
+            $$ hcat ["perturb", name, " size source ="]
+        )
+        4
+        ( hang "F.alloca $ \\sourcePtr ->" 2
+            . hang "F.alloca $ \\targetPtr -> do" 2
+            $ vcat
+                [ "F.poke sourcePtr source"
+                , hcat [pfx, "_perturb_", name, " size sourcePtr targetPtr"]
+                , "F.peek targetPtr"
+                ]
+        )
+    , hang
+        ( hcat
+            [ "foreign import capi unsafe \"", string inc, " "
+            , pfx, "_perturb_", name, "\""
+            ]
+        )
+        2
+        ( hcat
+            [ pfx, "_perturb_", name, " :: FC.CLong -> F.Ptr X.", name
+            , " -> F.Ptr X.", name, " -> IO ()"
+            ]
+        )
+    ]
+  where
+    pfx, name :: CtxDoc
+    pfx  = string pfx'
+    name = prettyHsName name'
+
+instance Pretty OrphanInstance where
+  pretty = \case
+    ArbitraryInstance typeName cnstName fieldNames ->
+      prettyArbitraryInstance typeName cnstName fieldNames
+    GenSeqInstance typeName cnstName fieldNames ->
+      prettyGenSeqInstance typeName cnstName fieldNames
+    PerturbInstance typeName cnstName fieldNames ->
+      prettyPerturbInstance typeName cnstName fieldNames
+    SameSemanticsInstance typeName fieldNames ->
+      prettySameSemanticsInstance typeName fieldNames
+
+prettyArbitraryInstance ::
+     HsName NsTypeConstr
+  -> HsName NsConstr
+  -> [HsName NsVar]
+  -> CtxDoc
+prettyArbitraryInstance typeName' cnstName' fieldNames' =
+    hangs
+      (hcat ["instance QC.Arbitrary X.", typeName, " where"])
+      2
+      [ hang "arbitrary = do" 2 . vcat $
+          [fieldName <+> "<- QC.arbitrary" | fieldName <- fieldNames]
+            ++ [hcat ["pure X.", cnstName, "{..}"]]
+      , hang (hcat ["shrink X.", cnstName, "{..} ="]) 2 $
+          vlist '[' ']' shrinkList
+      ]
+  where
+    typeName, cnstName :: CtxDoc
+    typeName = prettyHsName typeName'
+    cnstName = prettyHsName cnstName'
+
+    fieldNames :: [CtxDoc]
+    fieldNames = prettyHsName <$> fieldNames'
+
+    shrinkList :: [CtxDoc]
+    shrinkList =
+      [ hsep $
+            hcat ["X.", cnstName]
+          : [ if n `Bits.testBit` i then fieldName else "RepZero.repZero"
+            | (i, fieldName) <- zip [0..] fieldNames
+            ]
+      | n <- reverse @Word [0 .. 2 ^ length fieldNames - 2]
+      ]
+
+prettyGenSeqInstance ::
+     HsName NsTypeConstr
+  -> HsName NsConstr
+  -> [HsName NsVar]
+  -> CtxDoc
+prettyGenSeqInstance typeName' cnstName' fieldNames' =
+    hang
+      (hcat ["instance GenSeq.GenSeq X.", typeName, " where"])
+      2
+      ( hang "genSeq n =" 2 . vcat $
+             [ if i == 0
+                 then hcat ["let ", fieldName, " = GenSeq.genSeq n"]
+                 else nest 4 $ hcat
+                        [ fieldName, " = GenSeq.genSeq (n + "
+                        , showToCtxDoc @Word i, ")"
+                        ]
+             | (i, fieldName) <- zip [0..] fieldNames
+             ]
+          ++ [hcat ["in  X.", cnstName, "{..}"]]
+      )
+  where
+    typeName, cnstName :: CtxDoc
+    typeName = prettyHsName typeName'
+    cnstName = prettyHsName cnstName'
+
+    fieldNames :: [CtxDoc]
+    fieldNames = prettyHsName <$> fieldNames'
+
+prettyPerturbInstance ::
+     HsName NsTypeConstr
+  -> HsName NsConstr
+  -> [HsName NsVar]
+  -> CtxDoc
+prettyPerturbInstance typeName' cnstName' fieldNames' =
+    hang
+      (hcat ["instance Perturb.Perturb X.", typeName, " where"])
+      2
+      ( hang
+          (hcat ["perturb size X.", cnstName, "{..} = X.", cnstName])
+          2
+          ( vlist '{' '}'
+              [ hcat [fieldName, " = Perturb.perturb size ", fieldName]
+              | fieldName <- fieldNames
+              ]
+          )
+      )
+  where
+    typeName, cnstName :: CtxDoc
+    typeName = prettyHsName typeName'
+    cnstName = prettyHsName cnstName'
+
+    fieldNames :: [CtxDoc]
+    fieldNames = prettyHsName <$> fieldNames'
+
+prettySameSemanticsInstance ::
+     HsName NsTypeConstr
+  -> [HsName NsVar]
+  -> CtxDoc
+prettySameSemanticsInstance typeName' fieldNames' =
+    hang
+      (hcat ["instance SameSemantics.SameSemantics X.", typeName, " where"])
+      2
+      ( hang "sameSemantics l r = and" 2 $ vlist '[' ']'
+          [ hcat ["SameSemantics.sameSemanticsOn X.", fieldName, " l r"]
+          | fieldName <- fieldNames
+          ]
+      )
+  where
+    typeName :: CtxDoc
+    typeName = prettyHsName typeName'
+
+    fieldNames :: [CtxDoc]
+    fieldNames = prettyHsName <$> fieldNames'
+
+instance Pretty TypeTest where
+  pretty (TypeTest name) = prettyTypeTest name
+
+prettyTypeTest :: HsName NsTypeConstr -> CtxDoc
+prettyTypeTest name' =
+    hang
+      ( hcat ["test", name, " :: Tasty.TestTree"]
+          $$ hcat ["test", name, " = Tasty.testGroup \"", name, "\""]
+      )
+      2
+      ( vlist '[' ']'
+          [ hang "THU.testCase Storable.nameHsSizeOfXEqCSizeOfX $" 2 $
+              hcat
+                [ "Storable.assertHsSizeOfXEqCSizeOfX @X.", name
+                , " Proxy.Proxy sizeof", name
+                ]
+          , hang "THU.testCase Storable.nameHsAlignOfXEqCAlignOfX $" 2 $
+              hcat
+                [ "Storable.assertHsAlignOfXEqCAlignOfX @X.", name
+                , " Proxy.Proxy alignof", name
+                ]
+          , hang "THU.testProperty Storable.namePokePeekXSameSemanticsX $" 2 $
+              hcat ["Storable.prop_PokePeekXSameSemanticsX @X.", name]
+          , hang "THU.testCase GenSeq.nameHsGenSeq1CEq $" 2 $
+              hcat ["GenSeq.assertHsGenSeq1CEq genSeqHs", name]
+          , hang "THU.testCase GenSeq.nameHsGenSeq1SameSemanticsCGenSeq1 $" 2 $
+              hcat ["GenSeq.assertHsGenSeq1SameSemanticsCGenSeq1 genSeqC", name]
+          , hang "TQC.testProperty Perturb.nameHsPerturbNXSameSemanticsCPerturbNX $" 2 $
+              hcat
+                [ "Perturb.prop_HsPerturbNXSameSemanticsCPerturbNX perturb"
+                , name
+                ]
+          ]
+      )
+  where
+    name :: CtxDoc
+    name = prettyHsName name'
+
+instance Pretty TestsFun where
+  pretty (TestsFun moduleName typeNames) = prettyTestsFun moduleName typeNames
+
+prettyTestsFun :: ModuleName -> [HsName NsTypeConstr] -> CtxDoc
+prettyTestsFun moduleName typeNames =
+    hang
+      ( "tests :: Tasty.TestTree"
+          $$ hcat ["tests = Tasty.testGroup \"", string moduleName, "\""]
+      )
+      4
+      ( vlist '[' ']'
+          [ "test" >< prettyHsName typeName
+          | typeName <- typeNames
+          ]
+      )
+
+instance Pretty HsSpecModule where
+  pretty (HsSpecModule moduleName) = vsep
+    [ "module Spec (tests) where"
+    , "import Test.Tasty (TestTree, testGroup)"
+    , "import qualified" <+> string moduleName
+    , vcat
+        [ "tests :: TestTree"
+        , "tests = testGroup \"test-hs-bindgen\""
+        , nest 4 $ vlist '[' ']' [string moduleName >< ".tests"]
+        ]
+    ]
+
+instance Pretty HsMainModule where
+  pretty HsMainModule = vsep
+    [ "module Main (main) where"
+    , "import Test.Tasty (defaultMain)"
+    , "import qualified Spec"
+    , vcat
+        [ "main :: IO ()"
+        , "main = defaultMain Spec.tests"
+        ]
+    ]
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+prettySection :: String -> CtxDoc
+prettySection label = renderedLines $ \w ->
+    let rule = List.replicate (w - 1) '-'
+    in  ['{' : rule, "  " ++ label, rule ++ "}"]
+-}
diff --git a/src-internal/HsBindgen/Test/Internal.hs b/src-internal/HsBindgen/Test/Internal.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Test/Internal.hs
@@ -0,0 +1,25 @@
+module HsBindgen.Test.Internal (
+    -- * C function prefix
+    CFunPrefix
+  , getCFunPrefix
+  ) where
+
+import Data.Char qualified as Char
+import Data.List qualified as List
+import System.FilePath qualified as FilePath
+
+{-------------------------------------------------------------------------------
+  C function prefix
+-------------------------------------------------------------------------------}
+
+type CFunPrefix = String
+
+getCFunPrefix ::
+     FilePath  -- ^ C test header filename
+  -> CFunPrefix
+getCFunPrefix = List.map aux . FilePath.dropExtension
+  where
+    aux :: Char -> Char
+    aux c
+      | Char.isAlphaNum c = Char.toLower c
+      | otherwise         = '_'
diff --git a/src-internal/HsBindgen/Test/Readme.hs b/src-internal/HsBindgen/Test/Readme.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Test/Readme.hs
@@ -0,0 +1,63 @@
+module HsBindgen.Test.Readme (
+    genTestsReadme
+  ) where
+
+import System.FilePath qualified as FilePath
+
+import HsBindgen.Config.Prelims
+
+{-------------------------------------------------------------------------------
+  Generation
+-------------------------------------------------------------------------------}
+
+genTestsReadme ::
+     FilePath       -- ^ README path
+  -> BaseModuleName -- ^ Module name (example: @Acme.Foo@)
+  -> FilePath       -- ^ Test suite directory path
+  -> FilePath       -- ^ C header path
+  -> FilePath       -- ^ C source path
+  -> IO ()
+genTestsReadme readmePath baseModule testSuitePath cHeaderPath cSourcePath =
+    writeFile readmePath $ unlines
+      [ "# " ++ moduleNameStr ++ " hs-bindgen Test Suite"
+      , ""
+      , "The content under this directory is automatically generated by [hs-bindgen][]."
+      , ""
+      , "[hs-bindgen]: <https://github.com/well-typed/hs-bindgen>"
+      , ""
+      , "## Example Cabal Configuration"
+      , ""
+      , "Be sure to add your project to the dependencies."
+      , ""
+      , "```"
+      , "test-suite " ++ testSuite
+      , "  type: exitcode-stdio-1.0"
+      , "  hs-source-dirs: " ++ testSuite ++ "/src"
+      , "  main-is: Main.hs"
+      , "  other-modules:"
+      , "      " ++ moduleNameStr ++ ".Test"
+      , "      Main"
+      , "      Spec"
+      , "  include-dirs:"
+      , "      " ++ testSuite ++ "/cbits"
+      , "  install-includes:"
+      , "      " ++ FilePath.takeFileName cHeaderPath
+      , "  c-sources:"
+      , "      " ++ testSuite ++ "/cbits/" ++ FilePath.takeFileName cSourcePath
+      , "  build-depends:"
+      , "      base"
+      , "    , hs-bindgen-test-runtime"
+      , "    , QuickCheck"
+      , "    , tasty"
+      , "    , tasty-hunit"
+      , "    , tasty-quickcheck"
+      , "  default-language: Haskell2010"
+      , "  ghc-options: -Wall"
+      , "```"
+      ]
+  where
+    testSuite :: String
+    testSuite = FilePath.takeFileName testSuitePath
+
+    moduleNameStr :: String
+    moduleNameStr = baseModuleNameToString baseModule
diff --git a/src-internal/HsBindgen/TraceMsg.hs b/src-internal/HsBindgen/TraceMsg.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/TraceMsg.hs
@@ -0,0 +1,154 @@
+-- | Top-level sum-type that captures all trace messages we might emit
+--
+-- Intended for unqualified import.
+module HsBindgen.TraceMsg (
+    TraceMsg(..)
+    -- * Messages from individual passes
+  , BindingSpecMsg(..)
+  , BootMsg(..)
+  , ClangMsg(..)
+  , Diagnostic(..)
+  , FrontendMsg(..)
+  , C.HashIncludeArgMsg(..)
+  , MangleNamesMsg(..)
+  , ImmediateFillUnnamedIdsMsg (..)
+  , ImmediateParseMsg(..)
+  , DelayedParseMsg(..)
+  , UnsupportedFloatType(..)
+  , ResolveBindingSpecsMsg(..)
+  , ResolveHeaderMsg(..)
+  , SelectMsg(..)
+  -- * Log level customization
+  , CustomLogLevelSetting (..)
+  , getCustomLogLevel
+  ) where
+
+import Data.List qualified as List
+
+import Clang.HighLevel.Types (Diagnostic (..))
+
+import HsBindgen.BindingSpec (BindingSpecMsg (..))
+import HsBindgen.Boot
+import HsBindgen.Clang (ClangMsg (..))
+import HsBindgen.Frontend (FrontendMsg (..))
+import HsBindgen.Frontend.Pass.FillUnnamedIds.IsPass (ImmediateFillUnnamedIdsMsg (..))
+import HsBindgen.Frontend.Pass.MangleNames.IsPass (MangleNamesMsg (..))
+import HsBindgen.Frontend.Pass.Parse.Msg (DelayedParseMsg (..),
+                                          ImmediateParseMsg (..),
+                                          UnsupportedFloatType (..))
+import HsBindgen.Frontend.Pass.ResolveBindingSpecs.IsPass (ResolveBindingSpecsMsg (..))
+import HsBindgen.Frontend.Pass.Select.IsPass (SelectMsg (..))
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Resolve (ResolveHeaderMsg (..))
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  HsBindgen boot/frontend traces
+-------------------------------------------------------------------------------}
+
+-- | Traces supported by @hs-bindgen@.
+--
+-- Lazy on purpose to avoid evaluation when traces are not reported.
+--
+-- Does not include backend messages because, unlike 'TraceMsg', backend
+-- messages cannot include 'Error's, or 'Warning's.
+data TraceMsg =
+    TraceBoot          BootMsg
+  | TraceFrontend      FrontendMsg
+  | TraceResolveHeader ResolveHeaderMsg
+  deriving stock    (Show, Generic)
+  deriving anyclass (PrettyForTrace, IsTrace Level)
+
+{-------------------------------------------------------------------------------
+  Log level customization
+-------------------------------------------------------------------------------}
+
+-- | List of predefined log level customization settings.
+data CustomLogLevelSetting =
+    -- * Generic setters
+    MakeTrace Level TraceId
+
+    -- * Generic modifiers
+    -- | Modify traces with log level 'Warning' to be fatal 'Error's.
+  | MakeWarningsErrors
+
+    -- | Modify traces with log level Bug' to be fatal 'Error's.
+  | MakeBugsErrors
+
+    -- * Specific setters
+    -- | Set the log level of macro-related parsing traces to 'Warning'.
+    --
+    -- Reparse and typechecking errors may indicate that something went
+    -- wrong, or they may be caused by macro syntax that we do not yet
+    -- support.
+    --
+    -- By default, traces emitted while parsing macros have log level 'Info'.
+    -- because there are many unsupported macros in standard library
+    -- implementations. Using this custom log level setting, users make them
+    -- 'Warning' instead.
+  | EnableMacroWarnings
+
+    -- | Set the log level of squashed-typedef traces (trace id
+    -- @select-mangle-names-squashed@) to 'Info'.
+    --
+    -- By default, the 'Select' pass reports squashed typedefs at log level
+    -- 'Notice', which is visible at the default verbosity. Headers that
+    -- chain many typedefs can produce a lot of these messages; this setting
+    -- demotes them to 'Info' so they are hidden at default verbosity but
+    -- still visible with @-v3@.
+  | MakeMangleNamesSquashedInfo
+  deriving stock (Eq, Show, Ord)
+
+-- | Get a custom log level function from a set of available settings.
+--
+-- NOTE: The order of custom log level settings is important because different
+-- custom log level settings may affect the same trace. For example, assume a
+-- trace @Trace@ has default log level 'Info', and two custom log level settings
+-- @SetTraceWarning@ and @SetTraceError@ set the default log level of @T@ to
+-- 'Warning' and 'Error', respectively. Then, if we apply @SetTraceWarning@
+-- before @SetTraceError@, the the final log level of @T@ will be 'Error'.
+getCustomLogLevel :: [CustomLogLevelSetting] -> CustomLogLevel Level TraceMsg
+getCustomLogLevel = mconcat . map fromSetting
+
+-- Internal.
+fromSetting ::
+     CustomLogLevelSetting
+  -> CustomLogLevel Level TraceMsg
+fromSetting = \case
+    -- Generic setters.
+    MakeTrace level traceId     -> makeTrace level traceId
+    -- Generic modifiers.
+    MakeWarningsErrors          -> makeLevelErrors Warning
+    -- Generic modifiers.
+    MakeBugsErrors              -> makeLevelErrors Bug
+    -- Specific setters.
+    EnableMacroWarnings         -> enableMacroWarnings
+    -- Trace id defined at
+    -- 'HsBindgen.Frontend.Pass.Select.IsPass.SelectMangleNamesSquashed'.
+    MakeMangleNamesSquashedInfo -> makeTrace Info "select-mangle-names-squashed"
+  where
+    makeTrace :: Level -> TraceId -> CustomLogLevel Level TraceMsg
+    makeTrace desiredLevel traceId = CustomLogLevel $ \trace actualLevel ->
+      if getTraceId trace == traceId
+      then desiredLevel
+      else actualLevel
+
+    enableMacroWarnings :: CustomLogLevel Level TraceMsg
+    enableMacroWarnings = CustomLogLevel $ \case
+        -- Numerous locations may emit macro-related trace messages (e.g.,
+        -- 'Parse', 'TypecheckMacros', 'ReparseMacroExpansions', or 'Select'
+        -- passes), so we fall back to string search.
+        t | "macro" `List.isInfixOf` (getTraceId t).id
+          -> const Warning
+        -- Macro parsing requires declarations required for scoping.
+        TraceFrontend (FrontendParse C.WithLocationInfo{msg = ParseOfDeclarationRequiredForScopingFailed{}})
+          -> const Warning
+        _otherTrace
+          -> id
+
+    makeLevelErrors :: Level -> CustomLogLevel Level TraceMsg
+    makeLevelErrors lvlError = CustomLogLevel $ \_ lvl ->
+      if lvl >= lvlError
+      then Error
+      else lvl
diff --git a/src-internal/HsBindgen/Util/Monad.hs b/src-internal/HsBindgen/Util/Monad.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Util/Monad.hs
@@ -0,0 +1,13 @@
+module HsBindgen.Util.Monad (
+    mapMaybeM
+  ) where
+
+--------------------------------------------------------------------------------
+
+mapMaybeM :: forall a b m. Monad m => (a -> m (Maybe b)) -> [a] -> m [b]
+mapMaybeM f = foldr aux (pure [])
+  where
+    aux :: a -> m [b] -> m [b]
+    aux x doRest = f x >>= \case
+      Just y  -> (y :) <$> doRest
+      Nothing -> doRest
diff --git a/src-internal/HsBindgen/Util/Process.hs b/src-internal/HsBindgen/Util/Process.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Util/Process.hs
@@ -0,0 +1,63 @@
+module HsBindgen.Util.Process (
+    -- * Read actions
+    cmdSpecReadAction
+  , cmdSpecPrettyForTrace
+  , checkOutput
+  , parseSingleLine
+  , parseNonEmpty
+  ) where
+
+import System.IO.Error (tryIOError)
+import System.Process qualified as Proc
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Util.Tracer
+
+{-------------------------------------------------------------------------------
+  Read actions
+-------------------------------------------------------------------------------}
+
+-- | Interpret a 'Proc.CmdSpec' as a read action
+cmdSpecReadAction :: Proc.CmdSpec -> IO String
+cmdSpecReadAction = \case
+    Proc.ShellCommand cmd    -> Proc.readCreateProcess (Proc.shell cmd) ""
+    Proc.RawCommand exe args -> Proc.readProcess exe args ""
+
+-- | Render a 'Proc.CmdSpec' for tracing
+cmdSpecPrettyForTrace :: Proc.CmdSpec -> PP.CtxDoc
+cmdSpecPrettyForTrace = PP.string . \case
+    Proc.ShellCommand cmd    -> cmd
+    Proc.RawCommand exe args -> unwords (exe : args)
+
+-- | Run a read action and check the output
+checkOutput ::
+     Tracer msg
+  -> (String  -> msg)      -- ^ Unexpected output constructor
+  -> (IOError -> msg)      -- ^ Error constructor
+  -> (String  -> Maybe a)  -- ^ Output parser
+  -> IO String             -- ^ Read action
+  -> IO (Maybe a)
+checkOutput tracer mkUnexpected mkError parse action =
+    tryIOError action >>= \case
+      Right s -> case parse s of
+        x@Just{} -> return x
+        Nothing  -> Nothing <$ traceWith tracer (withCallStack $ mkUnexpected (abbr s))
+      Left  e -> Nothing <$ traceWith tracer (withCallStack $ mkError e)
+  where
+    -- Abbreviate arbitrarily long strings in trace messages
+    abbr :: String -> String
+    abbr s = case splitAt 60 s of
+      (_, []) -> s
+      (s', _) -> s' ++ " ..."
+
+-- | Parse a single line of output
+parseSingleLine :: String -> Maybe String
+parseSingleLine s = case lines s of
+    [s'] -> Just s'
+    _    -> Nothing
+
+-- | Parse non-empty output
+parseNonEmpty :: String -> Maybe String
+parseNonEmpty = \case
+    "" -> Nothing
+    s  -> Just s
diff --git a/src-internal/HsBindgen/Util/Rational.hs b/src-internal/HsBindgen/Util/Rational.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Util/Rational.hs
@@ -0,0 +1,15 @@
+module HsBindgen.Util.Rational (
+    canBeRepresentedAsRational
+  ) where
+
+{-# SPECIALISE canBeRepresentedAsRational :: Float  -> Bool #-}
+{-# SPECIALISE canBeRepresentedAsRational :: Double -> Bool #-}
+
+-- | Can this floating-point value be represented (losslessly) as a 'Rational'?
+canBeRepresentedAsRational :: RealFloat a => a -> Bool
+canBeRepresentedAsRational f = not $ or
+  [ isNaN f
+  , isInfinite f
+  , isNegativeZero f
+  , isDenormalized f -- not strictly necessary, but let's be conservative
+  ]
diff --git a/src-internal/HsBindgen/Util/Tracer.hs b/src-internal/HsBindgen/Util/Tracer.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/HsBindgen/Util/Tracer.hs
@@ -0,0 +1,695 @@
+-- | Logging
+--
+-- Intended for unqualified import.
+module HsBindgen.Util.Tracer (
+    -- * Tracer definition and main API
+    Tracer -- opaque
+  , traceWith
+  , WithCallStack(..)
+  , withCallStack
+  , simpleTracer
+  , nullTracer
+    -- * Data types and typeclasses useful for tracing
+  , PrettyForTrace (..)
+  , Level (..)
+  , SafeLevel (..)
+  , Source (..)
+  , TraceId (..)
+  , IsTrace (..)
+  , Verbosity (..)
+  , IsUserRequested (..)
+  , userRequestedIf
+    -- * Tracer configuration
+  , ShowCallStack (..)
+  , AnsiColor (..)
+  , Report
+  , OutputConfig (..)
+  , OutputHandle (..)
+  , OutputCustom (..)
+  , outputConfigTH
+  , CustomLogLevel (..)
+  , applyCustomLogLevel
+  , TracerConfig (..)
+    -- * Tracers
+  , withTracer
+  , TracerState(..)
+  , checkTracerState
+  , AnErrorHappened(..)
+    -- * Safe tracers
+  , withTracerSafe
+  , SafeTrace(..)
+    -- * Re-exports
+  , Contravariant(..)
+    -- * Test infrastructure
+  , withTracerUnsafe
+  ) where
+
+import Control.Tracer (Contravariant (..))
+import Control.Tracer qualified as ContraTracer
+import Data.Bool (bool)
+import Data.IORef (IORef, modifyIORef', newIORef, readIORef)
+import Data.Kind (Type)
+import GHC.Generics as GHC
+import GHC.Stack (CallStack, prettyCallStack)
+import System.Console.ANSI (Color (..), ColorIntensity (Vivid),
+                            ConsoleIntensity (BoldIntensity),
+                            ConsoleLayer (Foreground),
+                            SGR (SetColor, SetConsoleIntensity),
+                            hSupportsANSIColor, setSGRCode)
+import System.IO (Handle, hPutStr, stderr)
+import Text.SimplePrettyPrint (Context, CtxDoc)
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Errors
+import HsBindgen.Imports
+
+{-------------------------------------------------------------------------------
+  Definition and main API
+
+  The definition of 'Tracer' is opaque.
+-------------------------------------------------------------------------------}
+
+newtype Tracer e = Wrap (ContraTracer.Tracer IO (WithCallStack e))
+
+unwrap :: Tracer e -> ContraTracer.Tracer IO (WithCallStack e)
+unwrap (Wrap tracer) = tracer
+
+-- | We pair every trace message with a callstack for easier debugging
+data WithCallStack e = WithCallStack {
+      callStack :: CallStack
+    , traceMsg  :: e
+    }
+  deriving stock (Show, Functor)
+
+instance PrettyForTrace e => PrettyForTrace (WithCallStack e) where
+  prettyForTrace = prettyForTrace . (.traceMsg)
+
+instance IsTrace l e => IsTrace l (WithCallStack e) where
+  getDefaultLogLevel = getDefaultLogLevel . (.traceMsg)
+  getSource          = getSource          . (.traceMsg)
+  getTraceId         = getTraceId         . (.traceMsg)
+
+instance Contravariant Tracer where
+  contramap f = Wrap . contramap (fmap f) . unwrap
+
+traceWith :: MonadIO m => Tracer a -> WithCallStack a -> m ()
+traceWith tracer =
+      liftIO
+    . ContraTracer.traceWith (unwrap tracer)
+
+-- | Capture current callstack and pair with a value
+--
+-- Useful when collecting trace messages in pure code for later emission
+-- via 'traceWith'.
+withCallStack :: HasCallStack => a -> WithCallStack a
+withCallStack = WithCallStack callStack
+
+-- | Simple tracer that 'ContraTracer.emit's every message
+simpleTracer :: (e -> IO ()) -> Tracer e
+simpleTracer f = simpleWithCallStack (f . (.traceMsg))
+
+-- | Generalization of 'simpleWithCallStack'
+--
+-- This is internal API.
+simpleWithCallStack :: (WithCallStack e -> IO ()) -> Tracer e
+simpleWithCallStack =
+      Wrap
+    . ContraTracer.Tracer
+    . ContraTracer.emit
+
+-- | See 'ContraTracer.squelchUnless'
+squelchUnless :: (e -> Bool) -> Tracer e -> Tracer e
+squelchUnless p =
+      Wrap
+    . ContraTracer.squelchUnless (p . (.traceMsg))
+    . unwrap
+
+nullTracer :: Tracer e
+nullTracer = Wrap ContraTracer.nullTracer
+
+{-------------------------------------------------------------------------------
+  Data types and type classes useful for tracing
+-------------------------------------------------------------------------------}
+
+-- | Convert values to textual representations used in traces.
+class PrettyForTrace e where
+  prettyForTrace :: e -> CtxDoc
+  default prettyForTrace :: (Generic e, GPrettyForTrace (Rep e)) => e -> CtxDoc
+  prettyForTrace = gPrettyForTrace'
+
+class GPrettyForTrace (r :: Type -> Type) where
+  gPrettyForTrace :: r x -> CtxDoc
+
+instance GPrettyForTrace r => GPrettyForTrace (M1 tag meta r) where
+  gPrettyForTrace (M1 x) = gPrettyForTrace x
+
+instance (GPrettyForTrace r1, GPrettyForTrace r2) => GPrettyForTrace (r1 :+: r2) where
+  gPrettyForTrace (L1 x) = gPrettyForTrace x
+  gPrettyForTrace (R1 x) = gPrettyForTrace x
+
+instance PrettyForTrace e => GPrettyForTrace (K1 tag e) where
+  gPrettyForTrace (K1 x) = prettyForTrace x
+
+gPrettyForTrace' :: (GHC.Generic e, GPrettyForTrace (GHC.Rep e)) => e -> CtxDoc
+gPrettyForTrace' = gPrettyForTrace .  GHC.from
+
+-- | Log or verbosity level.
+--
+-- Careful, the derived 'Ord' instance is used when determining if a trace
+-- should be emitted, or not.
+data Level =
+    -- | Useful only for debugging hs-bindgen itself
+    Debug
+
+    -- | Regular progress, perhaps useful for debugging hs-bindgen config
+    --
+    -- E.g.: "Why why @foo@ not selected?"
+  | Info
+
+    -- | Normal but significant condition the user should be aware of
+    --
+    -- E.g.: "binding global variable may result in duplicate symbols"
+  | Notice
+
+    -- | We may produce incomplete bindings
+  | Warning
+
+    -- | We encountered something unexpected but may produce incomplete bindings
+  | Bug
+
+    -- | We are unable to produce /any/ bindings at all
+  | Error
+  deriving stock (Show, Eq, Ord, Bounded, Enum, Generic)
+
+instance Default Level where
+  def = Notice
+
+alignLevel :: Level -> String
+alignLevel = \case
+  Debug   -> "Debug  "
+  Info    -> "Info   "
+  Notice  -> "Notice "
+  Warning -> "Warning"
+  Bug     -> "Bug    "
+  Error   -> "Error  "
+
+getColorForLevel :: Level -> Color
+getColorForLevel = \case
+  Debug   -> White
+  Info    -> Green
+  Notice  -> Yellow
+  Warning -> Yellow
+  Bug     -> Red
+  Error   -> Red
+
+-- | Safe log or verbosity level to be used by the backend.
+--
+-- We intentionally limit 'SafeLevel' to debug and info messages. Notices,
+-- warnings and errors should be handled in the frontend.
+--
+-- Traces with safe log levels can not abort the program.
+data SafeLevel = SafeDebug | SafeInfo | SafeNotice
+  deriving stock (Show, Eq, Ord, Bounded)
+
+fromSafeLevel :: SafeLevel -> Level
+fromSafeLevel = \case
+  SafeDebug  -> Debug
+  SafeInfo   -> Info
+  SafeNotice -> Notice
+
+toSafeLevel :: Level -> Maybe SafeLevel
+toSafeLevel = \case
+  Debug  -> Just SafeDebug
+  Info   -> Just SafeInfo
+  Notice -> Just SafeNotice
+  _      -> Nothing
+
+-- | Possible sources of traces. The 'Source' is shown by default in traces, and
+-- so should be useful to users of @hs-bindgen@. At the moment, we only
+-- distinguish between 'Libclang' and 'HsBindgen'.
+data Source = Libclang | HsBindgen
+  deriving stock (Show, Eq)
+
+alignSource :: Source -> String
+alignSource = \case
+  Libclang  -> "Libclang "
+  HsBindgen -> "HsBindgen"
+
+newtype TraceId = TraceId { id :: String }
+  deriving stock (Show, Eq, Ord)
+  deriving (IsString, Semigroup, Monoid) via String
+
+class PrettyForTrace e => IsTrace l e | e -> l where
+  -- | Get default (or suggested) log level of a trace.
+  getDefaultLogLevel :: e -> l
+  default getDefaultLogLevel :: (Generic e, GIsTrace l (Rep e)) => e -> l
+  getDefaultLogLevel = gGetDefaultLogLevel'
+  -- | Get source or context of trace.
+  getSource :: e -> Source
+  default getSource :: (Generic e, GIsTrace l (Rep e)) => e -> Source
+  getSource = gGetSource'
+  -- | The trace identifier does not necessarily have to be unique. For example,
+  -- an non-unique identifier may be used to collect multiple traces in a single
+  -- category.
+  --
+  -- The trace identifier usually starts with a letter and contains only letters
+  -- and dashes (e.g., @my-trace-id@). A good default is the constructor name in
+  -- kebab-case, leaving out potential "-trace" or "-msg" suffixes.
+  getTraceId :: e -> TraceId
+  default getTraceId :: (Generic e, GIsTrace l (Rep e)) => e -> TraceId
+  getTraceId = gGetTraceId'
+
+class GIsTrace l (r :: Type -> Type) | r -> l where
+  gGetDefaultLogLevel :: r x -> l
+  gGetSource          :: r x -> Source
+  gGetTraceId         :: r x -> TraceId
+
+instance GIsTrace l r => GIsTrace l (M1 tag meta r) where
+  gGetDefaultLogLevel (M1 x) = gGetDefaultLogLevel x
+  gGetSource          (M1 x) = gGetSource          x
+  gGetTraceId         (M1 x) = gGetTraceId         x
+
+instance (GIsTrace l r1, GIsTrace l r2) => GIsTrace l (r1 :+: r2) where
+  gGetDefaultLogLevel (L1 x) = gGetDefaultLogLevel x
+  gGetDefaultLogLevel (R1 x) = gGetDefaultLogLevel x
+  gGetSource          (L1 x) = gGetSource          x
+  gGetSource          (R1 x) = gGetSource          x
+  gGetTraceId         (L1 x) = gGetTraceId         x
+  gGetTraceId         (R1 x) = gGetTraceId         x
+
+instance IsTrace l a => GIsTrace l (K1 tag a) where
+  gGetDefaultLogLevel (K1 x) = getDefaultLogLevel x
+  gGetSource          (K1 x) = getSource          x
+  gGetTraceId         (K1 x) = getTraceId         x
+
+gGetDefaultLogLevel' :: (GHC.Generic e, GIsTrace l (GHC.Rep e)) => e -> l
+gGetDefaultLogLevel' = gGetDefaultLogLevel . GHC.from
+
+gGetSource' :: (GHC.Generic e, GIsTrace l (GHC.Rep e)) => e -> Source
+gGetSource' = gGetSource . GHC.from
+
+gGetTraceId' :: (GHC.Generic e, GIsTrace l (GHC.Rep e)) => e -> TraceId
+gGetTraceId' = gGetTraceId . GHC.from
+
+newtype Verbosity = Verbosity { level :: Level }
+  deriving stock (Show, Eq)
+  deriving Default via Level
+
+-- | User requested status
+--
+-- The log level of some trace messages depend on if the user explicitly
+-- requested something or not.
+data IsUserRequested = UserRequested | NotUserRequested
+  deriving stock (Show, Eq)
+
+userRequestedIf :: Bool -> IsUserRequested
+userRequestedIf = bool NotUserRequested UserRequested
+
+{-------------------------------------------------------------------------------
+  Tracer configuration
+-------------------------------------------------------------------------------}
+
+data AnsiColor = EnableAnsiColor | DisableAnsiColor
+  deriving stock (Show, Eq)
+
+data ShowCallStack = EnableCallStack | DisableCallStack
+  deriving stock (Show, Eq)
+
+-- | We provide both, the trace itself and the formatted message. For example, a
+-- report function may want to store the trace only, and ignore the formatted
+-- message.
+--
+-- Further, a report function may need to know about the log level. For example,
+-- with Template Haskell, errors and warnings are treated differently compared
+-- to debug and info messages. NOTE: Traces do have default log levels, but we
+-- need the custom log level. This is sub-optimal. We could use newtype wrappers
+-- to directly change the log level, and not provide the custom log level
+-- separately here.
+--
+-- The report function has access to the typed trace @a@, and the formatted
+-- trace. The formatted trace also possibly contains the call stack, or other
+-- information.
+type Report e = Level -> e -> String -> IO ()
+
+data OutputConfig e =
+    OutputConfigHandle OutputHandle
+  | OutputConfigCustom (OutputCustom e)
+
+data OutputHandle = OutputHandle{
+      handle :: Handle
+
+      -- | ANSI color support
+      --
+      -- 'Nothing': Automatically determine ANSI color support by examining the
+      -- 'Handle'; see 'getAnsiColor'.
+    , ansiColor :: Maybe AnsiColor
+    }
+
+data OutputCustom e = OutputCustom{
+      report    :: Report e
+    , ansiColor :: AnsiColor
+    }
+
+instance Contravariant OutputConfig where
+  contramap f = \case
+      OutputConfigHandle handle -> OutputConfigHandle handle
+      OutputConfigCustom custom -> OutputConfigCustom (contramap f custom)
+
+instance Contravariant OutputCustom where
+  contramap f outputCustom = outputCustom{
+        report = \level -> outputCustom.report level . f
+      }
+
+-- | The default tracer configuration
+--
+-- - writes to 'stderr', and
+-- - uses ANSI colors, if available.
+instance Default (OutputConfig e) where
+  def = OutputConfigHandle def
+
+instance Default OutputHandle where
+  def = OutputHandle{
+        handle    = stderr
+      , ansiColor = Nothing
+      }
+
+-- | Output configuration suitable for compile-time code generation with
+-- Template Haskell.
+--
+-- Report all traces to @stderr@, without ANSI colours (GHC output is usually
+-- captured by the build tool).
+--
+-- NOTE: We cannot use GHC's own diagnostics (@reportWarning@/@reportError@),
+-- because the pipeline runs in @IO@, not in @Q@; @runQ@ would then pick
+-- @instance Quasi IO@, which labels /every/ message a Template Haskell error.
+outputConfigTH :: OutputConfig e
+outputConfigTH = OutputConfigHandle OutputHandle{
+      handle    = stderr
+    , ansiColor = Just DisableAnsiColor
+    }
+
+-- | Sometimes, we want to change log levels. For example, we want to suppress
+-- specific traces in tests.
+--
+-- The custom log level function takes a trace and returns a function
+-- customizing the log level.
+newtype CustomLogLevel l e = CustomLogLevel (e -> l -> l)
+
+applyCustomLogLevel :: CustomLogLevel l e -> e -> l -> l
+applyCustomLogLevel (CustomLogLevel f) = f
+
+-- | First apply the left custom log level, then the right one.
+instance Semigroup (CustomLogLevel l e) where
+  (CustomLogLevel left) <> (CustomLogLevel right) =
+    CustomLogLevel $ \trc -> right trc . left trc
+
+instance Monoid (CustomLogLevel l e) where
+  mempty = CustomLogLevel $ const id
+
+instance Contravariant (CustomLogLevel l) where
+  contramap f (CustomLogLevel g) = CustomLogLevel $ g . f
+
+-- | Configuration of tracer.
+data TracerConfig l e = TracerConfig{
+      verbosity      :: Verbosity
+    , outputConfig   :: OutputConfig e
+    , customLogLevel :: CustomLogLevel l e
+    , showCallStack  :: ShowCallStack
+    }
+  deriving (Generic)
+
+instance Contravariant (TracerConfig l) where
+  contramap f config = config {
+        outputConfig   = contramap f config.outputConfig
+      , customLogLevel = contramap f config.customLogLevel
+      }
+
+instance Default (TracerConfig l e) where
+  def = TracerConfig{
+        verbosity      = def
+      , outputConfig   = def
+      , customLogLevel = mempty
+      , showCallStack  = DisableCallStack
+      }
+
+{-------------------------------------------------------------------------------
+  Tracers
+-------------------------------------------------------------------------------}
+
+-- | Run an action with a tracer.
+--
+-- The default tracer configuration
+--
+-- - writes to @stdout@, and
+-- - uses ANSI colors, if available.
+--
+-- Return 'Nothing' if an 'Error' trace was emitted.
+withTracer :: forall m e a. (MonadIO m , IsTrace Level e)
+  => TracerConfig Level e
+  -> (Tracer e -> m a)
+  -> m (Either AnErrorHappened a)
+withTracer tracerConf action = withTracerUnsafe tracerConf action'
+  where
+    action' :: Tracer e -> IORef TracerState -> m (Either AnErrorHappened a)
+    action' tracer ref = do
+      r <- action tracer
+      s <- liftIO $ readIORef ref
+      case s of
+        TracerState Error -> pure $ Left AnErrorHappened
+        _                 -> pure $ Right r
+
+-- | Internal. The tracer stores the maximum log level of emitted traces and all
+-- emitted error traces.
+data TracerState = TracerState {
+      tracerMaxLevel :: Level
+    }
+
+defTracerState :: TracerState
+defTracerState = TracerState Debug
+
+-- | Run an action with a tracer.
+--
+-- The caller is responsible for checking for errors in the tracer state.
+--
+-- Used in tests.
+withTracerUnsafe :: forall m e a. (MonadIO m, IsTrace Level e)
+  => TracerConfig Level e
+  -> (Tracer e -> IORef TracerState -> m a)
+  -> m a
+withTracerUnsafe config action = do
+  (report, ansiColor) <- getOutputConfig
+  fmap fst $ withIORef defTracerState $ \ref ->
+    action (mkTracer
+              config.customLogLevel
+              ref
+              config.verbosity
+              ansiColor
+              config.showCallStack
+              report)
+           ref
+  where
+    getOutputConfig :: m (Report e, AnsiColor)
+    getOutputConfig = case config.outputConfig of
+        OutputConfigHandle outputHandle -> do
+          ansiColor <- case outputHandle.ansiColor of
+            Nothing -> getAnsiColor outputHandle.handle
+            Just x  -> pure x
+          let report _lvl _trace = liftIO . hPutStr outputHandle.handle
+          pure (report, ansiColor)
+        OutputConfigCustom outputCustom ->
+          pure (outputCustom.report, outputCustom.ansiColor)
+
+{-------------------------------------------------------------------------------
+  Trace error
+-------------------------------------------------------------------------------}
+
+-- | Evidence that an error has happened.
+--
+-- We do not store/report the actual errors, because we have emitted them
+-- previously.
+data AnErrorHappened = AnErrorHappened
+    deriving stock (Show)
+
+instance PrettyForTrace AnErrorHappened where
+  prettyForTrace AnErrorHappened = "An error happened (see above)"
+
+{-------------------------------------------------------------------------------
+  Safe tracer
+-------------------------------------------------------------------------------}
+
+-- | Run an action with a safe tracer using a custom output configuration.
+--
+-- Always returns a result (if the action does not panic).
+--
+-- See 'SafeLevel'.
+withTracerSafe :: forall m e a. (MonadIO m, IsTrace SafeLevel e)
+  => TracerConfig SafeLevel e
+  -> (Tracer e -> m a)
+  -> m a
+withTracerSafe config action =
+    withTracerUnsafe tracerConf' (\t _ -> action' t)
+  where
+    action' :: Tracer (SafeTrace e) -> m a
+    action' = action . contramap SafeTrace
+
+    toCustomLogLevelUnsafe :: CustomLogLevel SafeLevel c -> CustomLogLevel Level c
+    toCustomLogLevelUnsafe (CustomLogLevel f) = CustomLogLevel $ \trc lvl ->
+      -- NOTE: Only customize safe levels, and do not change unsafe levels.
+      -- However, the latter case should never happen!
+      case toSafeLevel lvl of
+        Just safeLvl -> fromSafeLevel $ f trc safeLvl
+        Nothing      -> lvl
+
+    customLogLevel :: CustomLogLevel Level (SafeTrace e)
+    customLogLevel =
+      toCustomLogLevelUnsafe $
+        contramap (.trace) config.customLogLevel
+
+    tracerConf' :: TracerConfig Level (SafeTrace e)
+    tracerConf' = config {
+        outputConfig   = contramap (.trace) config.outputConfig
+      , customLogLevel = customLogLevel
+      }
+
+newtype SafeTrace e = SafeTrace { trace :: e }
+  deriving (Show, Eq, Generic)
+
+instance PrettyForTrace e => PrettyForTrace (SafeTrace e) where
+  prettyForTrace = prettyForTrace . (.trace)
+
+instance IsTrace SafeLevel e => IsTrace Level (SafeTrace e) where
+  getDefaultLogLevel = fromSafeLevel . getDefaultLogLevel . (.trace)
+  getSource          = getSource                          . (.trace)
+  getTraceId         = getTraceId                         . (.trace)
+
+{-------------------------------------------------------------------------------
+  Internal helpers
+-------------------------------------------------------------------------------}
+
+-- | Create a tracer emitting traces to a provided function @report@.
+--
+-- The traces provide additional information about
+-- - the log level, and
+-- - the source.
+mkTracer :: forall e. (IsTrace Level e)
+  => CustomLogLevel Level e
+  -> IORef TracerState
+  -> Verbosity
+  -> AnsiColor
+  -> ShowCallStack
+  -> Report e
+  -> Tracer e
+mkTracer
+  customLogLevel
+  tracerStateRef
+  verbosity
+  ansiColor
+  showCallStack
+  report =
+    squelchUnless isLogLevelHighEnough $ simpleWithCallStack $ traceAction
+  where
+    isLogLevelHighEnough :: e -> Bool
+    isLogLevelHighEnough trace = getLogLevel trace >= verbosity.level
+
+    traceAction :: WithCallStack e -> IO ()
+    traceAction msg = do
+      liftIO $ modifyIORef' tracerStateRef $ updateTracerState level
+      msgTrace <- formatTrace ansiColor level msg.traceMsg
+      let msgStack = prettyCallStack msg.callStack
+          components = msgTrace : [ msgStack | showCallStack == EnableCallStack ]
+      report level msg.traceMsg $ unlines components
+      where
+        level :: Level
+        level = getLogLevel msg.traceMsg
+
+    updateTracerState :: Level -> TracerState -> TracerState
+    updateTracerState level (TracerState maxLevel) =
+      TracerState $ max level maxLevel
+
+    getLogLevel :: e -> Level
+    getLogLevel x = applyCustomLogLevel customLogLevel x (getDefaultLogLevel x)
+
+-- | Render a string in bold and a specified color.
+--
+-- Careful, the applied ANSI code suffix also resets all other activated formatting.
+withColor :: AnsiColor -> Level -> String -> String
+withColor DisableAnsiColor _     = id
+withColor EnableAnsiColor    level = withColor' (getColorForLevel level)
+  where
+    withColor' :: Color -> String -> String
+    withColor' color x = setColor <> x <> resetColor
+      where
+        setColor :: String
+        setColor = setSGRCode [
+            SetColor Foreground Vivid color
+          , SetConsoleIntensity BoldIntensity
+          ]
+        resetColor :: String
+        resetColor = setSGRCode []
+
+-- | Check a TracerState IORef for errors.
+--
+-- This is useful for checking for errors after forcing lazy computations that
+-- trace to a tracer whose state is captured in the IORef.
+checkTracerState :: MonadIO m => IORef TracerState -> m (Maybe AnErrorHappened)
+checkTracerState ref = do
+  tracerState <- liftIO $ readIORef ref
+  pure $ case tracerState of
+    TracerState Error -> Just AnErrorHappened
+    _                 -> Nothing
+
+withIORef :: MonadIO m => b -> (IORef b -> m a) -> m (a, b)
+withIORef initialValue action = do
+  ref <- liftIO $ newIORef initialValue
+  actionResult <- action ref
+  refResult <- liftIO $ readIORef ref
+  pure (actionResult, refResult)
+
+getAnsiColor :: MonadIO m => Handle -> m AnsiColor
+getAnsiColor handle = do
+    supportsAnsiColor <- liftIO $ hSupportsANSIColor handle
+    pure $ if supportsAnsiColor then EnableAnsiColor else DisableAnsiColor
+
+-- Format a trace message.
+type Format m e = AnsiColor -> Level -> e -> m String
+
+-- Log format:
+-- [LEVEL] [SOURCE] Message.
+--   Indent subsequent lines.
+--   OPTION CALL STACK.
+formatTrace :: (MonadIO m, IsTrace Level e) => Format m e
+formatTrace ansiColor level trace =
+    pure $
+      formatLine $
+        appendBugNote $
+          PP.renderCtxDoc context $
+            prettyForTrace trace
+  where
+    context :: Context
+    context = PP.mkContext 120
+
+    source :: Source
+    source = getSource trace
+
+    traceId :: TraceId
+    traceId = getTraceId trace
+
+    prependLevel :: String -> String
+    prependLevel x =
+      withColor ansiColor level ("[" <> alignLevel level <> "]") <> " " <> x
+
+    prependSource :: String -> String
+    prependSource x =
+      withColor ansiColor level ("[" <> alignSource source <> "]") <> " " <> x
+
+    prependTraceId :: String -> String
+    prependTraceId x =
+      withColor ansiColor level ("[" <> traceId.id <> "]") <> " " <> x
+
+    formatLine :: String -> String
+    formatLine = prependLevel . prependSource . prependTraceId
+
+    appendBugNote :: String -> String
+    appendBugNote x = case level of
+      Bug       -> x ++ "\n" ++ pleaseReport
+      _otherLvl -> x
diff --git a/src-internal/Text/SimplePrettyPrint.hs b/src-internal/Text/SimplePrettyPrint.hs
new file mode 100644
--- /dev/null
+++ b/src-internal/Text/SimplePrettyPrint.hs
@@ -0,0 +1,385 @@
+{-# LANGUAGE CPP #-}
+
+-- | Simple pretty-printing library
+--
+-- This library wraps the @pretty@ library.  Instead of using 'PP.Doc' directly,
+-- type t'CtxDoc' threads a t'Context'.  Keeping track of the current indentation
+-- and maximum line length enables the implementation of 'renderedLines', which
+-- can be used to format documentation comments for the current indentation.
+-- Keeping track of a unique name index enables rendering of unique names with
+-- 'withFreshName'.
+--
+-- Some of the API functions provided by this library differ in behavior from
+-- @pretty@ API functions of similar/same names.  In particular, @($+$)@
+-- vertically joins documents with blank lines, while '($$)' vertically joins
+-- documents without blank lines, behaving like the @pretty@ '(PP.$+$)'
+-- function.  The list equivalents of these functions are similarly different.
+--
+-- The underlying @pretty@ library gives very little control over indentation.
+-- If we would like to have better indentation, we should either switch to a
+-- different underlying library or write our own.
+--
+-- Intended for qualified import
+--
+-- > import Text.SimplePrettyPrint (Pretty(..), CtxDoc)
+-- > import Text.SimplePrettyPrint qualified as PP
+--
+-- There are also operators that can be imported, though you may prefer to use
+-- 'hsep' or 'hcat' instead of '(><)', 'vsep' or 'vcat' instead of '($$)', etc.
+
+-- > import Text.SimplePrettyPrint ((><), (<+>), ($$), ($+$))
+module Text.SimplePrettyPrint (
+    CtxDoc -- opaque
+    -- * t'CtxDoc' features
+  , withFreshName
+  , ifFits
+    -- * Rendering
+  , runCtxDoc
+  , renderCtxDoc
+    -- ** Context
+  , Context -- opaque
+  , mkContext
+  , defaultContext
+  , debugContext
+    -- * Pretty class
+  , Pretty(..)
+  , renderPretty
+    -- * Construction
+    -- ** Primitives
+  , empty
+  , char
+  , string
+  , show
+  , text
+  , renderedLines
+    -- ** Horizontal and vertical composition
+  , (><)
+  , hcat
+  , (<+>)
+  , hsep
+  , ($$)
+  , vcat
+  , ($+$)
+  , vsep
+  , cat
+  , fcat
+  , sep
+  , fsep
+    -- ** Bracketing
+  , parens
+  , parensWhen
+  , vparensWhen
+  , brackets
+  , singleQuotes
+    -- ** Lists
+  , hlist
+  , vlist
+    -- ** Indentation
+  , nest
+  , hang
+  , hangs
+  , hangs'
+  ) where
+
+import Prelude hiding (show)
+import Prelude qualified
+
+import Data.List qualified as List
+import Data.String (IsString (fromString))
+import Data.Text qualified as Text
+import Text.PrettyPrint.HughesPJ qualified as PP
+
+#if MIN_VERSION_base(4,19,0)
+import GHC.TypeError (ErrorMessage (..), Unsatisfiable)
+#endif
+
+{-------------------------------------------------------------------------------
+  Context
+-------------------------------------------------------------------------------}
+
+-- | Pretty-printing context
+data Context = Context {
+      -- | Current indentation (number of spaces)
+      indentation :: !Int
+      -- | Maximum number of columns per line, when possible
+    , maxLineCols :: !Int
+      -- | Unique name index
+    , uniqueNameIdx :: !Int
+    }
+
+-- | Construct an initial t'Context' with the specified line length
+mkContext :: Int -> Context
+mkContext maxLineCols = Context {
+      indentation   = 0
+    , maxLineCols   = maxLineCols
+    , uniqueNameIdx = 0
+    }
+
+-- | Default pretty-printing context
+defaultContext :: Context
+defaultContext = mkContext 80
+
+-- | Add to the indentation in a t'Context'
+indentContext :: Int -> Context -> Context
+indentContext n ctx = ctx{indentation = ctx.indentation + n}
+
+-- | Get the next unique name index (and the updated context)
+getUniqueNameIdx :: Context -> (Int, Context)
+getUniqueNameIdx ctx =
+    let i = ctx.uniqueNameIdx
+    in  (i, ctx{uniqueNameIdx = i + 1})
+
+{-------------------------------------------------------------------------------
+  CtxDoc
+-------------------------------------------------------------------------------}
+
+-- | Contextualized document
+newtype CtxDoc = CtxDoc (Context -> PP.Doc)
+
+-- | Create a document with the specified string
+instance IsString CtxDoc where
+  fromString = string
+
+-- | Not valid Haskell syntax, may be used for debugging purposes
+instance Show CtxDoc where
+  show = renderCtxDoc defaultContext
+
+-- | Run a t'CtxDoc' with the specified context
+runCtxDoc :: Context -> CtxDoc -> PP.Doc
+runCtxDoc ctx (CtxDoc f) = f ctx
+
+-- | Create a unique name with the specified hint
+withFreshName :: String -> (CtxDoc -> CtxDoc) -> CtxDoc
+withFreshName nameHint k = CtxDoc $ \ctx ->
+    let (i, ctx') = getUniqueNameIdx ctx
+    in  runCtxDoc ctx' . k $ CtxDoc (\_ -> PP.text (nameHint ++ Prelude.show i))
+
+-- | Render a t'CtxDoc'
+renderCtxDoc :: Context -> CtxDoc -> String
+renderCtxDoc ctx = PP.renderStyle style . runCtxDoc ctx
+  where
+    style :: PP.Style
+    style = PP.style {PP.lineLength = ctx.maxLineCols}
+
+{-------------------------------------------------------------------------------
+  Pretty
+-------------------------------------------------------------------------------}
+
+-- | Types that can be pretty-printed
+class Pretty a where
+  -- | Create a document for the specified value with @0@ precedence
+  pretty :: a -> CtxDoc
+  pretty = prettyPrec 0
+
+  -- | Create a document for the specified value with the specified precedence
+  prettyPrec :: Int -> a -> CtxDoc
+  prettyPrec _prec = pretty
+
+  {-# MINIMAL pretty | prettyPrec #-}
+
+#if MIN_VERSION_base(4,19,0)
+instance Unsatisfiable (Text "Don't pretty Strings, use fromString") => Pretty [a]
+#endif
+
+-- | Render a 'Pretty' value
+renderPretty :: Pretty a => Context -> a -> String
+renderPretty ctx = renderCtxDoc ctx . pretty
+
+{-------------------------------------------------------------------------------
+  API
+-------------------------------------------------------------------------------}
+
+-- | The empty document
+empty :: CtxDoc
+empty = CtxDoc $ const PP.empty
+
+-- | Create a document with the specified character
+char :: Char -> CtxDoc
+char = CtxDoc . const . PP.char
+
+-- | Create a document with the specified string
+string :: String -> CtxDoc
+string = CtxDoc . const . PP.text
+
+-- | Create a document with the result of 'show'
+show :: Show a => a -> CtxDoc
+show = string . Prelude.show
+
+-- | Create a document with the specified 'Text'
+text :: Text.Text -> CtxDoc
+text = string . Text.unpack
+
+-- | Horizontally join two documents
+--
+-- Note that 'Semigroup' '(<>)' is /not/ used because it is right-associative.
+infixl 6 ><
+(><) :: CtxDoc -> CtxDoc -> CtxDoc
+dL >< dR = CtxDoc $ \ctx ->
+    runCtxDoc ctx dL PP.<> runCtxDoc ctx dR
+
+-- | Horizontally join documents
+hcat :: [CtxDoc] -> CtxDoc
+hcat ds = CtxDoc $ \ctx ->
+    PP.hcat $ map (runCtxDoc ctx) ds
+
+-- | Horizontally join two documents, separating by space
+infixl 6 <+>
+(<+>) :: CtxDoc -> CtxDoc -> CtxDoc
+dL <+> dR = CtxDoc $ \ctx ->
+    runCtxDoc ctx dL PP.<+> runCtxDoc ctx dR
+
+-- | Horizontally join documents, separating by space
+hsep :: [CtxDoc] -> CtxDoc
+hsep ds = CtxDoc $ \ctx ->
+    PP.hsep $ map (runCtxDoc ctx) ds
+
+-- | Vertically join two documents
+infixl 5 $$
+($$) :: CtxDoc -> CtxDoc -> CtxDoc
+dL $$ dR = CtxDoc $ \ctx ->
+    runCtxDoc ctx dL PP.$+$ runCtxDoc ctx dR
+
+-- | Vertically join documents
+vcat :: [CtxDoc] -> CtxDoc
+vcat = \case
+    [] -> empty
+    ds -> CtxDoc $ \ctx -> foldl1 aux $ map (runCtxDoc ctx) ds
+  where
+    -- If there are empty spaces, aka newlines we won't create extra
+    -- unneeded whitespaces
+    aux :: PP.Doc -> PP.Doc -> PP.Doc
+    aux dL dR
+        | dL == "" && dR == "" = PP.nest (-100) dL PP.$+$ PP.nest (-100) dR
+        | dL == ""             = PP.nest (-100) dL PP.$+$ dR
+        | dR == ""             = dL PP.$+$ PP.nest (-100) dR
+        | otherwise            = dL PP.$+$ dR
+
+-- | Vertically join two documents, separating by a blank line
+infixl 5 $+$
+($+$) :: CtxDoc -> CtxDoc -> CtxDoc
+dL $+$ dR = CtxDoc $ \ctx ->
+    runCtxDoc ctx dL PP.$+$ PP.nest (-100) "" PP.$+$ runCtxDoc ctx dR
+
+-- | Vertically join documents, separating by blank lines
+--
+-- If there the context is nested the new line won't create unneded empty
+-- spaces.
+vsep :: [CtxDoc] -> CtxDoc
+vsep = \case
+    [] -> empty
+    ds -> CtxDoc $ \ctx -> foldl1 aux $ map (runCtxDoc ctx) ds
+  where
+    aux :: PP.Doc -> PP.Doc -> PP.Doc
+    aux dL dR
+        | PP.isEmpty dL = dR
+        | PP.isEmpty dR = dL
+        | otherwise     = dL PP.$+$ PP.nest (-100) "" PP.$+$ dR
+
+-- | Horizontally /or/ vertically join documents, depending on if there is
+-- room on the line
+cat :: [CtxDoc] -> CtxDoc
+cat ds = CtxDoc $ \ctx -> PP.cat $ map (runCtxDoc ctx) ds
+
+-- | Horizontally /or/ vertically join documents, depending on if there is
+-- room on the line, \"paragraph fill\" version
+fcat :: [CtxDoc] -> CtxDoc
+fcat ds = CtxDoc $ \ctx -> PP.fcat $ map (runCtxDoc ctx) ds
+
+-- | Horizontally /or/ vertically join documents, depending on if there is
+-- room on the line, horizontally separating by space
+sep :: [CtxDoc] -> CtxDoc
+sep ds = CtxDoc $ \ctx -> PP.sep $ map (runCtxDoc ctx) ds
+
+-- | Horizontally /or/ vertically join documents, depending on if there is
+-- room on the line, horizontally separating by space, \"paragraph fill\"
+-- version
+fsep :: [CtxDoc] -> CtxDoc
+fsep ds = CtxDoc $ \ctx -> PP.fsep $ map (runCtxDoc ctx) ds
+
+-- | Parenthesize a document horizontally
+parens :: CtxDoc -> CtxDoc
+parens d = hcat [char '(', d, char ')']
+
+-- | Surround a document with left and right bracket horizontally
+brackets :: CtxDoc -> CtxDoc
+brackets d = hcat [char '[', d, char ']']
+
+-- | Surround a document with single quotes horizontally
+singleQuotes :: CtxDoc -> CtxDoc
+singleQuotes d = hcat [char '\'', d, char '\'']
+
+-- | Parenthesize a document horizontally when true
+parensWhen :: Bool -> CtxDoc -> CtxDoc
+parensWhen = \case
+    False -> id
+    True  -> parens
+
+-- | Format a list horizontally
+hlist :: String -> String -> [CtxDoc] -> CtxDoc
+hlist cL cR ds =
+    hcat $ string cL : (List.intersperse (string ", ") ds) ++ [string cR]
+
+-- | Parenthesize a document vertically
+vparens :: CtxDoc -> CtxDoc
+vparens d = nest 2 (char '(' <+> d) $$ char ')'
+
+-- | Parenthesize a document vertically when true
+vparensWhen :: Bool -> CtxDoc -> CtxDoc
+vparensWhen = \case
+    False -> id
+    True  -> vparens
+
+-- | Format a list vertically (one item per line)
+vlist :: String -> String -> [CtxDoc] -> CtxDoc
+vlist cL cR = \case
+    [] -> string cL >< string cR
+    (d:ds') -> vcat
+      $ (string cL <+> d)
+      : [char ',' <+> d' | d' <- ds']
+      ++ [string cR]
+
+-- | Nest/indent a document by the specified number of spaces
+nest :: Int -> CtxDoc -> CtxDoc
+nest n d = CtxDoc $ \ctx ->
+    PP.nest n $ runCtxDoc (indentContext n ctx) d
+
+-- | Hang a document below another with the specified indentation
+hang :: CtxDoc -> Int -> CtxDoc -> CtxDoc
+hang dA n dB = dA $$ nest n dB
+
+-- | Hang multiple documents below another with the specified indentation,
+-- separated by blank lines
+hangs :: CtxDoc -> Int -> [CtxDoc] -> CtxDoc
+hangs dA n dBs = dA $$ vsep (nest n <$> dBs)
+
+-- | Hang multiple documents below another with the specified indentation,
+-- do __not__ seprate by blank lines
+hangs' :: CtxDoc -> Int -> [CtxDoc] -> CtxDoc
+hangs' dA n dBs = dA $$ vcat (nest n <$> dBs)
+
+-- | Select a t'CtxDoc' depending on if a rendered t'CtxDoc' fits within the
+-- maximum line length
+ifFits :: CtxDoc -> CtxDoc -> CtxDoc -> CtxDoc
+ifFits condD thenD elseD = CtxDoc $ \ctx ->
+    if length (renderCtxDoc ctx condD) <= ctx.maxLineCols
+      then runCtxDoc ctx thenD
+      else runCtxDoc ctx elseD
+
+-- | Create a document with rendered lines
+--
+-- The function is passed the maximum width of each line, computed as the
+-- maximum line length minus the current indentation.  It must return a list
+-- of lines, using an empty string to represent a blank line.  None of the
+-- strings may contain newline characters.
+--
+-- The lines are /automatically/ indented according to the current indentation.
+renderedLines :: (Int -> [String]) -> CtxDoc
+renderedLines f = CtxDoc $ \ctx ->
+    case f (max 0 (ctx.maxLineCols - ctx.indentation)) of
+      [] -> PP.empty
+      ss -> foldl1 (PP.$+$) $ map PP.text ss
+
+-- | Create a document with context information, for debugging
+debugContext :: CtxDoc
+debugContext = CtxDoc $ \ctx -> PP.parens $
+    PP.hsep ["Context", PP.int ctx.indentation, PP.int ctx.maxLineCols]
diff --git a/src/HsBindgen/Internal/Macro/CExpr.hs b/src/HsBindgen/Internal/Macro/CExpr.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/Internal/Macro/CExpr.hs
@@ -0,0 +1,35 @@
+{-# OPTIONS_HADDOCK hide #-}
+
+-- | The macro instance of @hs-bindgen@ is based on @c-expr-dsl@.
+--
+-- Intended for unqualified import.
+module HsBindgen.Internal.Macro.CExpr (
+    -- * Type
+    CExpr -- opaque
+    -- * Macro language
+  , cExpr -- opaque
+  ) where
+
+import Clang.CStandard
+
+import HsBindgen.Internal.Macro.CExpr.Parse
+import HsBindgen.Internal.Macro.CExpr.Resolution
+import HsBindgen.Internal.Macro.CExpr.Translation.Type
+import HsBindgen.Internal.Macro.CExpr.Translation.Value
+import HsBindgen.Internal.Macro.CExpr.Type
+import HsBindgen.Internal.Macro.CExpr.Typecheck
+import HsBindgen.Macro.Interface qualified as Macro
+
+-- | Default macro language implementation backed by @c-expr-dsl@.
+--
+-- The C standard is fixed at construction time; the resulting macro
+-- 'Macro.Lang' is configuration-free.
+cExpr :: ClangCStandard -> Macro.Lang CExpr
+cExpr cStd = Macro.Lang
+  { parse               = parseMacro cStd
+  , resolve             = resolveMacro
+  , typecheck           = typecheckMacros
+  , translateType       = translateMacroType
+  , translateValue      = translateMacroValue
+  }
+
diff --git a/src/HsBindgen/Internal/Macro/CExpr/Global.hs b/src/HsBindgen/Internal/Macro/CExpr/Global.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/Internal/Macro/CExpr/Global.hs
@@ -0,0 +1,133 @@
+{-# LANGUAGE TemplateHaskellQuotes #-}
+module HsBindgen.Internal.Macro.CExpr.Global (
+    cExprGlobalType
+  , CExprGlobalType(..)
+  , cExprGlobalTerm
+  , CExprGlobalTerm(..)
+  ) where
+
+import Language.Haskell.TH qualified as TH
+
+import C.Expr.HostPlatform qualified
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Level
+import HsBindgen.Language.Haskell qualified as Hs
+
+{-------------------------------------------------------------------------------
+  Globals specific to C expressions
+-------------------------------------------------------------------------------}
+
+-- We avoid full Template Haskell name resolution, because we want to depend on
+-- the intermediate runtime modules.
+cExprToHsImport :: Hs.Import
+cExprToHsImport = Hs.QualifiedImport "C.Expr.HostPlatform" Nothing
+
+data CExprGlobalType =
+    Not_class
+  | Logical_class
+  | RelEq_class
+  | RelOrd_class
+  | Plus_class
+  | Plus_resTyCon
+  | Minus_class
+  | Minus_resTyCon
+  | Add_class
+  | Add_resTyCon
+  | Sub_class
+  | Sub_resTyCon
+  | Mult_class
+  | Mult_resTyCon
+  | Div_class
+  | Div_resTyCon
+  | Rem_class
+  | Rem_resTyCon
+  | Complement_class
+  | Complement_resTyCon
+  | Bitwise_class
+  | Bitwise_resTyCon
+  | Shift_class
+  | Shift_resTyCon
+
+data CExprGlobalTerm =
+    Not_not
+  | Logical_and
+  | Logical_or
+  | RelEq_eq
+  | RelEq_uneq
+  | RelOrd_lt
+  | RelOrd_le
+  | RelOrd_gt
+  | RelOrd_ge
+  | Plus_plus
+  | Minus_negate
+  | Add_add
+  | Sub_minus
+  | Mult_mult
+  | Div_div
+  | Rem_rem
+  | Complement_complement
+  | Bitwise_and
+  | Bitwise_or
+  | Bitwise_xor
+  | Shift_shiftL
+  | Shift_shiftR
+
+cExprGlobalType :: CExprGlobalType -> Global LvlType
+cExprGlobalType = aux . \case
+    Not_class           -> (GTyp, ''C.Expr.HostPlatform.Not)
+    Logical_class       -> (GTyp, ''C.Expr.HostPlatform.Logical)
+    RelEq_class         -> (GTyp, ''C.Expr.HostPlatform.RelEq)
+    RelOrd_class        -> (GTyp, ''C.Expr.HostPlatform.RelOrd)
+    Plus_class          -> (GTyp, ''C.Expr.HostPlatform.Plus)
+    Plus_resTyCon       -> (GTyp, ''C.Expr.HostPlatform.PlusRes)
+    Minus_class         -> (GTyp, ''C.Expr.HostPlatform.Minus)
+    Minus_resTyCon      -> (GTyp, ''C.Expr.HostPlatform.MinusRes)
+    Add_class           -> (GTyp, ''C.Expr.HostPlatform.Add)
+    Add_resTyCon        -> (GTyp, ''C.Expr.HostPlatform.AddRes)
+    Sub_class           -> (GTyp, ''C.Expr.HostPlatform.Sub)
+    Sub_resTyCon        -> (GTyp, ''C.Expr.HostPlatform.SubRes)
+    Mult_class          -> (GTyp, ''C.Expr.HostPlatform.Mult)
+    Mult_resTyCon       -> (GTyp, ''C.Expr.HostPlatform.MultRes)
+    Div_class           -> (GTyp, ''C.Expr.HostPlatform.Div)
+    Div_resTyCon        -> (GTyp, ''C.Expr.HostPlatform.DivRes)
+    Rem_class           -> (GTyp, ''C.Expr.HostPlatform.Rem)
+    Rem_resTyCon        -> (GTyp, ''C.Expr.HostPlatform.RemRes)
+    Complement_class    -> (GTyp, ''C.Expr.HostPlatform.Complement)
+    Complement_resTyCon -> (GTyp, ''C.Expr.HostPlatform.ComplementRes)
+    Bitwise_class       -> (GTyp, ''C.Expr.HostPlatform.Bitwise)
+    Bitwise_resTyCon    -> (GTyp, ''C.Expr.HostPlatform.BitsRes)
+    Shift_class         -> (GTyp, ''C.Expr.HostPlatform.Shift)
+    Shift_resTyCon      -> (GTyp, ''C.Expr.HostPlatform.ShiftRes)
+  where
+    aux :: (GlobalCat LvlType, TH.Name) -> Global LvlType
+    aux (c, n) = CustomGlobal n c cExprToHsImport
+
+cExprGlobalTerm :: CExprGlobalTerm -> Global LvlTerm
+cExprGlobalTerm = aux . \case
+    Not_not               -> (GVar,  'C.Expr.HostPlatform.not)
+    Logical_and           -> (GVar, '(C.Expr.HostPlatform.&&))
+    Logical_or            -> (GVar, '(C.Expr.HostPlatform.||))
+    RelEq_eq              -> (GVar, '(C.Expr.HostPlatform.==))
+    RelEq_uneq            -> (GVar, '(C.Expr.HostPlatform.!=))
+    RelOrd_lt             -> (GVar, '(C.Expr.HostPlatform.<))
+    RelOrd_le             -> (GVar, '(C.Expr.HostPlatform.<=))
+    RelOrd_gt             -> (GVar, '(C.Expr.HostPlatform.>))
+    RelOrd_ge             -> (GVar, '(C.Expr.HostPlatform.>=))
+    Plus_plus             -> (GVar,  'C.Expr.HostPlatform.plus)
+    Minus_negate          -> (GVar,  'C.Expr.HostPlatform.negate)
+    Add_add               -> (GVar, '(C.Expr.HostPlatform.+))
+    Sub_minus             -> (GVar, '(C.Expr.HostPlatform.-))
+    Mult_mult             -> (GVar, '(C.Expr.HostPlatform.*))
+    Div_div               -> (GVar, '(C.Expr.HostPlatform./))
+    Rem_rem               -> (GVar, '(C.Expr.HostPlatform.%))
+    Complement_complement -> (GVar, '(C.Expr.HostPlatform..~))
+    Bitwise_and           -> (GVar, '(C.Expr.HostPlatform..&.))
+    Bitwise_or            -> (GVar, '(C.Expr.HostPlatform..|.))
+    Bitwise_xor           -> (GVar, '(C.Expr.HostPlatform..^.))
+    Shift_shiftL          -> (GVar, '(C.Expr.HostPlatform.<<))
+    Shift_shiftR          -> (GVar, '(C.Expr.HostPlatform.>>))
+  where
+    aux :: (GlobalCat LvlTerm, TH.Name) -> Global LvlTerm
+    aux (c, n) =
+      CustomGlobal n c cExprToHsImport
diff --git a/src/HsBindgen/Internal/Macro/CExpr/Parse.hs b/src/HsBindgen/Internal/Macro/CExpr/Parse.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/Internal/Macro/CExpr/Parse.hs
@@ -0,0 +1,66 @@
+module HsBindgen.Internal.Macro.CExpr.Parse (
+    parseMacro
+  ) where
+
+import Data.Vec.Lazy qualified as Vec
+
+import C.Expr.Parse qualified as CExpr
+import C.Expr.Syntax qualified as CExpr
+
+import Clang.CStandard
+import Clang.HighLevel.Types
+import Clang.Paths
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Internal.Macro.CExpr.Type
+import HsBindgen.Macro.Error
+import HsBindgen.Macro.Interface qualified as Macro
+
+-- | Parse the body of a macro definition as a C expression
+--
+-- The definition has already been split by
+-- 'HsBindgen.Macro.Syntax.splitMacro'; we assemble the 'CExpr.Macro' from the
+-- split and the parsed body.
+parseMacro ::
+     ClangCStandard
+  -> Runtime.Macro.Raw (Token SourcePath TokenSpelling)
+  -> Either MacroParseError (Macro.Unresolved CExpr)
+parseMacro cStd macro =
+    case macro.params of
+      Runtime.Macro.NoParams                               -> parseBody []
+      Runtime.Macro.Params params Runtime.Macro.NotVariadic     -> parseBody params
+      Runtime.Macro.Params _      Runtime.Macro.Ellipsis        -> Left unsupportedVariadic
+      Runtime.Macro.Params _      Runtime.Macro.NamedEllipsis{} -> Left unsupportedVariadic
+  where
+    sourcePath :: FilePath
+    sourcePath =
+          getSourcePath $ singleLocPath start
+            where
+              start :: SingleLoc SourcePath
+              start = rangeStart $ multiLocExpansion <$> tokenExtent macro.name
+
+    parseBody ::
+         [Token SourcePath TokenSpelling]
+      -> Either MacroParseError (Macro.Unresolved CExpr)
+    parseBody params =
+        Vec.reifyList (map identifier params) $ \macroParams ->
+          case CExpr.runParser sourcePath (CExpr.parseMacroBody cStd macroParams) macro.body of
+            Right body -> Right . Macro.Unresolved $ CExpr.Macro{
+                macroLoc    = macro.name.tokenExtent.rangeStart
+              , macroName   = identifier macro.name
+              , macroParams = macroParams
+              , macroExpr   = body
+              }
+            Left err -> Left $ MacroParseError err.parseError
+
+    identifier :: Token SourcePath TokenSpelling -> CExpr.Identifier
+    identifier = CExpr.Identifier . getTokenSpelling . tokenSpelling
+
+    -- 'CExpr.Macro' does not support a variadic parameter list; without this
+    -- check @__VA_ARGS__@, or the GNU name standing for it, would silently
+    -- parse as a free variable.
+    unsupportedVariadic :: MacroParseError
+    unsupportedVariadic = MacroParseError {
+        macroParseError = "variadic macros are not supported"
+      }
diff --git a/src/HsBindgen/Internal/Macro/CExpr/Resolution.hs b/src/HsBindgen/Internal/Macro/CExpr/Resolution.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/Internal/Macro/CExpr/Resolution.hs
@@ -0,0 +1,124 @@
+module HsBindgen.Internal.Macro.CExpr.Resolution (
+    resolveMacro
+  ) where
+
+import Data.Set qualified as Set
+
+import C.Expr.Syntax qualified as CExpr
+
+import HsBindgen.Frontend.Analysis
+import HsBindgen.Imports
+import HsBindgen.Internal.Macro.CExpr.Type
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro.Error
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Type qualified as Macro
+
+resolveMacro ::
+     Set C.DeclId
+  -> Macro.Unresolved CExpr
+  -> Either MacroResolutionError (Macro.Resolved CExpr)
+resolveMacro declIds (Macro.Unresolved macro) = do
+    resolvedMacro <- CExpr.annotateMacro resolve macro
+    pure Macro.Resolved{
+        macro = resolvedMacro
+      , deps  = getDependencies resolvedMacro
+      }
+  where
+    resolve :: CExpr.Name -> () -> Either MacroResolutionError C.DeclId
+    resolve name _ = case name of
+      CExpr.NameOrdinary nm ->
+        resolveBare nm.getIdentifier
+      CExpr.NameTagged nm tag ->
+        resolveTagged nm.getIdentifier (convertTagKind tag)
+
+    -- | Resolves a bare name found in a parsed macro body
+    --
+    -- Result:
+    --
+    -- - @'Just' 'CNameKind'@: This bare name refers to another declaration that is in
+    --   the 'DeclIndex'. For example, a macro, or a @typedef@.
+    --
+    -- - @'Nothing'@: This bare name is not in the set of known declarations. It
+    --   may simply be non-existent, or refer to a built-in type or a system
+    --   @typedef@ not present in the 'DeclIndex'. In this case, we /do not
+    --   generate/ a dependency.
+    resolveBare :: Text -> Either MacroResolutionError C.DeclId
+    resolveBare nm = case (isMacro, isTypedef) of
+        -- TODO <https://github.com/well-typed/hs-bindgen/issues/2097>
+        --
+        -- This is separate from user-selection or resolution of conflicts in
+        -- the Select pass [issue-1553], but instead we'd need to know which
+        -- definition C chooses to resolve to.
+        --
+        -- Crucially, this depends on the order of declarations (i.e., sequence
+        -- order); and we currently do not have this order available. Once our
+        -- lower limit on LLVM is 20.1, we can ensure sequence order and resolve
+        -- to the name as C does.
+        --
+        -- [issue-1553] https://github.com/well-typed/hs-bindgen/issues/1553
+        (True,  True)  -> Left $
+          MacroResolutionError $
+            "conflict detected: " <> show nm <> " is both a type and a macro"
+        (True,  False) -> Right macroId
+        (False, True)  -> Right typedefId
+        (False, False) -> Left $
+          MacroResolutionError $
+            "bare identifier " <> show nm <> " not found"
+      where
+        macroId, typedefId :: C.DeclId
+        macroId   = C.DeclId (C.DeclName nm C.NameKindMacro)    False
+        typedefId = C.DeclId (C.DeclName nm C.NameKindOrdinary) False
+        isMacro   = macroId   `Set.member` declIds
+        isTypedef = typedefId `Set.member` declIds
+
+    resolveTagged :: Text -> C.TagKind -> Either MacroResolutionError C.DeclId
+    resolveTagged nm tag
+      | taggedId `Set.member` declIds = Right taggedId
+      | otherwise =
+        Left $
+          MacroResolutionError $
+            "tagged identifier "
+            <> show (C.tagKindPrefix tag)
+            <> " "
+            <> show nm
+            <> " not found"
+      where
+        taggedId :: C.DeclId
+        taggedId = C.DeclId (C.DeclName nm $ C.NameKindTagged tag) False
+
+getDependencies :: Macro.Parsed CExpr C.DeclId -> [(C.DeclId, Dependency)]
+getDependencies resolvedMacro =
+    case resolvedMacro of
+      CExpr.Macro _ _ _ expr -> goExpr NeedsShape expr
+  where
+    goExpr ::
+         Dependency
+      -> CExpr.Expr ctx (CExpr.Ps C.DeclId)
+      -> [(C.DeclId, Dependency)]
+    goExpr depTy = \case
+      CExpr.Term term              -> goTerm depTy term
+      -- Pointer: switch the dependency to 'NeedsNameOnly'.
+      CExpr.TyApp CExpr.Pointer xs -> concatMap (goExpr NeedsNameOnly) xs
+      CExpr.TyApp CExpr.Const   xs -> concatMap (goExpr depTy)   xs
+      CExpr.VaApp _ _ xs           -> concatMap (goExpr depTy)   xs
+
+    goTerm ::
+         Dependency
+      -> CExpr.Term ctx (CExpr.Ps C.DeclId)
+      -> [(C.DeclId, Dependency)]
+    goTerm depTy = \case
+      CExpr.Literal{}    -> []
+      CExpr.LocalParam{} -> []
+      CExpr.Var (CExpr.XVarPs declId) _nm args ->
+        (declId, depTy) : concatMap (goExpr depTy) args
+
+{-------------------------------------------------------------------------------
+  Internal helpers
+-------------------------------------------------------------------------------}
+
+convertTagKind :: CExpr.TagKind -> C.TagKind
+convertTagKind = \case
+  CExpr.TagStruct -> C.TagKindStruct
+  CExpr.TagUnion  -> C.TagKindUnion
+  CExpr.TagEnum   -> C.TagKindEnum
diff --git a/src/HsBindgen/Internal/Macro/CExpr/Translation/Type.hs b/src/HsBindgen/Internal/Macro/CExpr/Translation/Type.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/Internal/Macro/CExpr/Translation/Type.hs
@@ -0,0 +1,62 @@
+module HsBindgen.Internal.Macro.CExpr.Translation.Type (
+    translateMacroType
+  ) where
+
+import C.Expr.Syntax qualified as CExpr
+import C.Expr.Typecheck
+import C.Expr.Typecheck.Interface.Type qualified as T
+
+import HsBindgen.Internal.Macro.CExpr.Type
+import HsBindgen.IR.Hs qualified as Hs
+import HsBindgen.IR.Translation
+import HsBindgen.Language.C qualified as C
+import HsBindgen.Macro.Type qualified as Macro
+
+translateMacroType ::
+     Macro.TypecheckedType CExpr Hs.Type
+  -> Hs.Type
+translateMacroType tcExpr = go tcExpr.macroTypeBody
+  where
+    go :: T.Expr Hs.Type -> Hs.Type
+    go = \case
+      T.TypeLit lit     -> Hs.PrimType (convertLiteral lit)
+      T.Var v           -> v
+      T.App T.Pointer t -> ptrOf t
+      T.App T.Const   t -> go t
+
+    ptrOf :: T.Expr Hs.Type -> Hs.Type
+    ptrOf (T.App T.Const t) = Hs.PtrConst (go t)
+    ptrOf t                 = Hs.Ptr (go t)
+
+    convertLiteral :: CExpr.TypeLit -> Hs.PrimType
+    convertLiteral = \case
+      CExpr.TypeInt  sign size -> translateCPrimType $ C.PrimIntegral (convertIntSize size) (convertSign sign)
+      CExpr.TypeChar sign      -> translateCPrimType $ C.PrimChar (convertCharSign sign)
+      CExpr.TypeFloat size     -> translateCPrimType $ C.PrimFloating (convertFloatSize size)
+      CExpr.TypeBool           -> translateCPrimType C.PrimBool
+      CExpr.TypeVoid           -> Hs.PrimVoid
+
+    convertSign :: Maybe CExpr.Sign -> C.PrimSign
+    convertSign = \case
+      Nothing             -> C.Signed
+      Just CExpr.Signed   -> C.Signed
+      Just CExpr.Unsigned -> C.Unsigned
+
+    convertCharSign :: Maybe CExpr.Sign -> C.PrimSignChar
+    convertCharSign = \case
+      Nothing             -> C.PrimSignImplicit Nothing
+      Just CExpr.Signed   -> C.PrimSignExplicit C.Signed
+      Just CExpr.Unsigned -> C.PrimSignExplicit C.Unsigned
+
+    convertIntSize :: Maybe CExpr.IntSize -> C.PrimIntType
+    convertIntSize = \case
+      Nothing                 -> C.PrimInt
+      Just CExpr.SizeShort    -> C.PrimShort
+      Just CExpr.SizeInt      -> C.PrimInt
+      Just CExpr.SizeLong     -> C.PrimLong
+      Just CExpr.SizeLongLong -> C.PrimLongLong
+
+    convertFloatSize :: CExpr.FloatSize -> C.PrimFloatType
+    convertFloatSize = \case
+      CExpr.SizeFloat  -> C.PrimFloat
+      CExpr.SizeDouble -> C.PrimDouble
diff --git a/src/HsBindgen/Internal/Macro/CExpr/Translation/Value.hs b/src/HsBindgen/Internal/Macro/CExpr/Translation/Value.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/Internal/Macro/CExpr/Translation/Value.hs
@@ -0,0 +1,312 @@
+module HsBindgen.Internal.Macro.CExpr.Translation.Value (
+    translateMacroValue
+  ) where
+
+import Data.Text qualified as Text
+import Data.Type.Nat qualified as Nat
+import Data.Vec.Lazy qualified as Vec
+import DeBruijn (EmptyCtx, Idx (..), Size (..), rzeroAdd)
+
+import C.Type qualified as Runtime
+
+import C.Expr.Syntax qualified as CExpr
+import C.Expr.Typecheck
+import C.Expr.Typecheck qualified as CExpr
+import C.Expr.Typecheck.Interface.Value qualified as V
+import C.Expr.Typecheck.Type qualified as CExpr
+
+import HsBindgen.Backend.Global
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.Hs.Name qualified as Hs
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Config.MangleCandidate
+import HsBindgen.Errors
+import HsBindgen.Imports
+import HsBindgen.Internal.Macro.CExpr.Global
+import HsBindgen.Internal.Macro.CExpr.Type
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.Macro.Type qualified as Macro
+import HsBindgen.NameHint
+
+translateMacroValue ::
+     Hs.Name Hs.NsVar
+  -> Macro.TypecheckedValue CExpr Hs.TermName
+  -> Maybe HsDoc.Comment
+  -> Binding
+translateMacroValue name expr comment =
+    Binding
+      { name       = Hs.ExportedName name
+      , parameters = []
+      , result     = Result (translateType (fmap snd expr.macroValueType)) Nothing
+      , body       = translateBody expr
+      , pragmas    = []
+      , comment    = comment
+      }
+
+{-------------------------------------------------------------------------------
+  Translate macro value: type
+-------------------------------------------------------------------------------}
+
+translateType :: CExpr.Quant (CExpr.Type CExpr.Ty) -> ClosedType
+translateType qty@(CExpr.Quant @n _) =
+    case CExpr.mkQuantTyBody qty of
+      CExpr.QuantTyBody{quantTyQuant = cts, quantTyBody = ty} ->
+        topLevelForall (snd <$> CExpr.tyVarNames @n) cts ty
+
+topLevelForall ::
+     Vec n Text
+  -> [CExpr.Type CExpr.Ct]
+  -> CExpr.Type CExpr.Ty
+  -> ClosedType
+topLevelForall args cts body =
+    TForall
+      ((\t -> NameHint (Text.unpack t)) <$> args)
+      (rzeroAdd (vecSize args))
+      (map (typeCt lookupIdx) cts)
+      (typeTy lookupIdx body)
+  where
+    qtvs    = addIndices args
+    lookupIdx name =
+      foldr (\(t, i) acc -> if t == name then i else acc)
+            (panicPure $
+              "translateMacroValue: unbound type variable: "
+              <> Text.unpack name)
+            qtvs
+
+typeCt :: (Text -> Idx n) -> CExpr.Type CExpr.Ct -> SType n
+typeCt env = \case
+    CExpr.TyConAppTy cls as ->
+      tAppN (tyCon cls) (typeTy env <$> as)
+    CExpr.NomEqPred a b ->
+      tAppN TEq [typeTy env a, typeTy env b]
+
+typeTy :: forall n. (Text -> Idx n) -> CExpr.Type CExpr.Ty -> SType n
+typeTy env = go
+  where
+    go :: CExpr.Type CExpr.Ty -> SType n
+    go CExpr.String =
+        tBindgenGlobal ByteString_type
+    go (CExpr.TyVarTy tv) =
+        TBound (env (CExpr.tyVarName tv))
+    go (CExpr.FunTy as r) =
+        foldr (TFun . go) (go r) as
+    go (CExpr.TyConAppTy tc as) =
+        case simpleTyConApp tc as of
+          Just ty -> tBindgenGlobal ty
+          Nothing -> tAppN (tyCon tc) (go <$> as)
+
+simpleTyConApp ::
+     CExpr.TyCon n CExpr.Ty
+  -> Vec n (CExpr.Type CExpr.Ty)
+  -> Maybe BindgenGlobalType
+simpleTyConApp (CExpr.GenerativeTyCon (CExpr.DataTyCon tc)) (arg ::: VNil) =
+    case (tc, arg) of
+      ( CExpr.IntLikeTyCon
+        , CExpr.TyConAppTy
+            (CExpr.GenerativeTyCon (CExpr.DataTyCon (CExpr.PrimIntInfoTyCon t)))
+            VNil
+        ) -> Just $ dslIntegral t
+      ( CExpr.FloatLikeTyCon
+        , CExpr.TyConAppTy
+            (CExpr.GenerativeTyCon (CExpr.DataTyCon (CExpr.PrimFloatInfoTyCon t)))
+            VNil
+        ) -> Just $ runtimeFloating t
+      _ -> Nothing
+simpleTyConApp _ _ =
+    Nothing
+
+tyCon :: CExpr.TyCon args res -> SType ctx
+tyCon (CExpr.GenerativeTyCon (CExpr.DataTyCon tc))  = dataTyCon   tc
+tyCon (CExpr.GenerativeTyCon (CExpr.ClassTyCon tc)) = TGlobal $ cExprGlobalType $ classTyCon  tc
+tyCon (CExpr.FamilyTyCon tc)                        = TGlobal $ cExprGlobalType $ familyTyCon tc
+
+dataTyCon :: CExpr.DataTyCon n -> SType ctx
+dataTyCon = \case
+    CExpr.TupleTyCon (Nat.SS' (Nat.SS' n)) -> TBoxedTup $ Plus2 $ Nat.snatToNatural n
+    CExpr.VoidTyCon                        -> tBindgenGlobal Void_type
+    CExpr.PrimIntInfoTyCon tc              -> tBindgenGlobal $ dslIntegral tc
+    CExpr.PrimFloatInfoTyCon tc            -> tBindgenGlobal $ runtimeFloating tc
+    CExpr.PtrTyCon                         -> tBindgenGlobal Foreign_Ptr_type
+    CExpr.CharLitTyCon                     -> tBindgenGlobal CChar_type
+    CExpr.IntLikeTyCon   -> panicPure "translateMacroValue: should have been handled by simpleTyConApp: IntLikeTyCon"
+    CExpr.FloatLikeTyCon -> panicPure "translateMacroValue: should have been handled by simpleTyConApp: FloatLikeTyCon"
+    CExpr.MacroTypeTyCon -> panicPure "translateMacroValue: unexpected type (kind): type"
+
+classTyCon :: CExpr.ClassTyCon args -> CExprGlobalType
+classTyCon = \case
+    CExpr.NotTyCon        -> Not_class
+    CExpr.LogicalTyCon    -> Logical_class
+    CExpr.RelEqTyCon      -> RelEq_class
+    CExpr.RelOrdTyCon     -> RelOrd_class
+    CExpr.PlusTyCon       -> Plus_class
+    CExpr.MinusTyCon      -> Minus_class
+    CExpr.AddTyCon        -> Add_class
+    CExpr.SubTyCon        -> Sub_class
+    CExpr.MultTyCon       -> Mult_class
+    CExpr.DivTyCon        -> Div_class
+    CExpr.RemTyCon        -> Rem_class
+    CExpr.ComplementTyCon -> Complement_class
+    CExpr.BitwiseTyCon    -> Bitwise_class
+    CExpr.ShiftTyCon      -> Shift_class
+
+familyTyCon :: CExpr.FamilyTyCon args -> CExprGlobalType
+familyTyCon = \case
+    CExpr.PlusResTyCon       -> Plus_resTyCon
+    CExpr.MinusResTyCon      -> Minus_resTyCon
+    CExpr.AddResTyCon        -> Add_resTyCon
+    CExpr.SubResTyCon        -> Sub_resTyCon
+    CExpr.MultResTyCon       -> Mult_resTyCon
+    CExpr.DivResTyCon        -> Div_resTyCon
+    CExpr.RemResTyCon        -> Rem_resTyCon
+    CExpr.ComplementResTyCon -> Complement_resTyCon
+    CExpr.BitsResTyCon       -> Bitwise_resTyCon
+    CExpr.ShiftResTyCon      -> Shift_resTyCon
+
+dslIntegral :: CExpr.IntegralType -> BindgenGlobalType
+dslIntegral = \case
+    CExpr.CIntegralType primIntTy -> runtimeIntegral primIntTy
+    CExpr.HsIntType               -> Int_type
+
+runtimeIntegral :: Runtime.IntegralType -> BindgenGlobalType
+runtimeIntegral = \case
+    Runtime.Bool       -> CBool_type
+    Runtime.CharLike c -> runtimeCharLike c
+    Runtime.IntLike i  -> runtimeIntLike i
+
+runtimeCharLike :: Runtime.CharLikeType -> BindgenGlobalType
+runtimeCharLike = \case
+    Runtime.Char  -> CChar_type
+    Runtime.SChar -> CSChar_type
+    Runtime.UChar -> CUChar_type
+
+runtimeIntLike :: Runtime.IntLikeType -> BindgenGlobalType
+runtimeIntLike = \case
+    Runtime.Short    Runtime.Signed   -> CShort_type
+    Runtime.Short    Runtime.Unsigned -> CUShort_type
+    Runtime.Int      Runtime.Signed   -> CInt_type
+    Runtime.Int      Runtime.Unsigned -> CUInt_type
+    Runtime.Long     Runtime.Signed   -> CLong_type
+    Runtime.Long     Runtime.Unsigned -> CULong_type
+    Runtime.LongLong Runtime.Signed   -> CLLong_type
+    Runtime.LongLong Runtime.Unsigned -> CULLong_type
+    Runtime.PtrDiff                   -> CPtrdiff_type
+
+runtimeFloating :: Runtime.FloatingType -> BindgenGlobalType
+runtimeFloating = \case
+    Runtime.FloatType  -> CFloat_type
+    Runtime.DoubleType -> CDouble_type
+
+{-------------------------------------------------------------------------------
+  Translate macro value: body
+-------------------------------------------------------------------------------}
+
+translateBody ::
+     CExpr.TypecheckedMacroValueExpr Hs.TermName
+  -> ClosedExpr
+translateBody (CExpr.TypecheckedMacroValueExpr params body _) =
+    lambdaN (Vec.reverse (identifierToHint <$> params)) (mexpr body)
+
+identifierToHint :: CExpr.Identifier -> NameHint
+identifierToHint nm =
+    toHint $ mangleCandidateDefaultFallback fallback nm.getIdentifier
+  where
+    fallback :: Hs.Name Hs.NsVar
+    fallback = Hs.UnsafeName "x"
+
+    toHint :: Hs.Name Hs.NsVar -> NameHint
+    toHint x = NameHint $ Text.unpack x.text
+
+mexpr :: forall ctx. V.Expr ctx Hs.TermName -> SExpr ctx
+mexpr = goExpr
+  where
+    goExpr :: V.Expr ctx Hs.TermName -> SExpr ctx
+    goExpr = \case
+      V.Literal lit       -> goLiteral lit
+      V.LocalParam i      -> EBound i
+      V.Var termName args -> eAppN (EFree termName) (map goExpr args)
+      V.App fun xs        -> eAppN (mfun fun) (Vec.toList (fmap goExpr xs))
+
+    goLiteral :: CExpr.ValueLit -> SExpr ctx
+    goLiteral = \case
+      CExpr.ValueInt    x -> integerLiteral  x
+      CExpr.ValueFloat  x -> floatingLiteral x
+      CExpr.ValueChar   x -> charLiteral     x
+      CExpr.ValueString x -> stringLiteral   x
+
+mfun :: CExpr.VaFun arity -> SExpr ctx
+mfun = \case
+    CExpr.MUnaryPlus  -> cExpr Plus_plus
+    CExpr.MUnaryMinus -> cExpr Minus_negate
+    CExpr.MLogicalNot -> cExpr Not_not
+    CExpr.MBitwiseNot -> cExpr Complement_complement
+    CExpr.MMult       -> cExpr Mult_mult
+    CExpr.MDiv        -> cExpr Div_div
+    CExpr.MRem        -> cExpr Rem_rem
+    CExpr.MAdd        -> cExpr Add_add
+    CExpr.MSub        -> cExpr Sub_minus
+    CExpr.MShiftLeft  -> cExpr Shift_shiftL
+    CExpr.MShiftRight -> cExpr Shift_shiftR
+    CExpr.MRelLT      -> cExpr RelOrd_lt
+    CExpr.MRelLE      -> cExpr RelOrd_le
+    CExpr.MRelGT      -> cExpr RelOrd_gt
+    CExpr.MRelGE      -> cExpr RelOrd_ge
+    CExpr.MRelEQ      -> cExpr RelEq_eq
+    CExpr.MRelNE      -> cExpr RelEq_uneq
+    CExpr.MBitwiseAnd -> cExpr Bitwise_and
+    CExpr.MBitwiseXor -> cExpr Bitwise_xor
+    CExpr.MBitwiseOr  -> cExpr Bitwise_or
+    CExpr.MLogicalAnd -> cExpr Logical_and
+    CExpr.MLogicalOr  -> cExpr Logical_or
+    CExpr.MTuple @n   -> EBoxedTup $ Plus2 $ Nat.reflectToNum @n Proxy
+  where
+    cExpr = EGlobal . cExprGlobalTerm
+
+integerLiteral :: CExpr.IntegerLiteral -> SExpr ctx
+integerLiteral lit =
+    EIntegral (CExpr.integerLiteralValue lit) $
+      Just $ tBindgenGlobal $
+        runtimeIntegral $ Runtime.IntLike (CExpr.integerLiteralType lit)
+
+charLiteral :: CExpr.CharLiteral -> SExpr ctx
+charLiteral lit = ECChar (CExpr.charLiteralValue lit)
+
+stringLiteral :: CExpr.StringLiteral -> SExpr ctx
+stringLiteral lit = ECString (CExpr.stringLiteralValue lit)
+
+floatingLiteral :: CExpr.FloatingLiteral -> SExpr ctx
+floatingLiteral lit =
+    case CExpr.floatingLiteralType lit of
+      Runtime.FloatType  ->
+        EFloat
+          (CExpr.floatingLiteralFloatValue  lit)
+          (tBindgenGlobal CFloat_type)
+      Runtime.DoubleType ->
+        EDouble
+          (CExpr.floatingLiteralDoubleValue lit)
+          (tBindgenGlobal CDouble_type)
+
+{-------------------------------------------------------------------------------
+  Auxiliary: AST construction
+-------------------------------------------------------------------------------}
+
+eAppN :: Foldable f => SExpr ctx -> f (SExpr ctx) -> SExpr ctx
+eAppN = foldl' EApp
+
+lambdaN :: Vec ctx NameHint -> SExpr ctx -> SExpr EmptyCtx
+lambdaN VNil       expr = expr
+lambdaN (n ::: ns) expr = lambdaN ns $ ELam n expr
+
+tAppN :: Foldable f => SType ctx -> f (SType ctx) -> SType ctx
+tAppN = foldl' TApp
+
+{-------------------------------------------------------------------------------
+  Auxiliary: de Bruijn
+-------------------------------------------------------------------------------}
+
+vecSize :: Vec n a -> Size n
+vecSize VNil       = SZ
+vecSize (_ ::: xs) = SS (vecSize xs)
+
+addIndices :: Vec n a -> Vec n (a, Idx n)
+addIndices VNil       = VNil
+addIndices (x ::: xs) = (x, IZ) ::: fmap (second IS) (addIndices xs)
diff --git a/src/HsBindgen/Internal/Macro/CExpr/Type.hs b/src/HsBindgen/Internal/Macro/CExpr/Type.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/Internal/Macro/CExpr/Type.hs
@@ -0,0 +1,19 @@
+-- | Macro types specific to @c-expr-dsl@.
+--
+-- Intended for unqualified import.
+module HsBindgen.Internal.Macro.CExpr.Type (
+    CExpr
+  ) where
+
+import C.Expr.Syntax qualified as CExpr
+import C.Expr.Typecheck qualified as CExpr
+
+import HsBindgen.Macro.Type qualified as Macro
+
+-- | Tag for the default C macro language, backed by @c-expr-dsl@.
+data CExpr
+
+instance Macro.HasTypes CExpr where
+  type Parsed CExpr           = CExpr.Macro
+  type TypecheckedType CExpr  = CExpr.TypecheckedMacroTypeExpr
+  type TypecheckedValue CExpr = CExpr.TypecheckedMacroValueExpr
diff --git a/src/HsBindgen/Internal/Macro/CExpr/Typecheck.hs b/src/HsBindgen/Internal/Macro/CExpr/Typecheck.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/Internal/Macro/CExpr/Typecheck.hs
@@ -0,0 +1,40 @@
+module HsBindgen.Internal.Macro.CExpr.Typecheck (
+    typecheckMacros
+  ) where
+
+import Data.Map qualified as Map
+import Data.Text qualified as Text
+
+import C.Expr.Syntax qualified as CExpr
+import C.Expr.Typecheck qualified as CExpr
+import C.Expr.Typecheck.Type qualified as CExpr
+
+import HsBindgen.Imports
+import HsBindgen.Internal.Macro.CExpr.Type
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro.Error
+import HsBindgen.Macro.Interface qualified as Macro
+
+typeOfAnn :: C.DeclId -> Maybe CExpr.QuantTy
+typeOfAnn declId = case declId.name.kind of
+    C.NameKindOrdinary -> Just CExpr.simpleType
+    _otherwise         -> Nothing
+
+typecheckMacros ::
+     [Macro.Resolved CExpr]
+  -> Map Text (Macro.TypecheckResult CExpr)
+typecheckMacros bodies =
+    Map.mapKeysMonotonic (.getIdentifier) $ fmap convertResult $
+      CExpr.tcMacros typeOfAnn (map (.macro) bodies)
+  where
+    convertResult ::
+         CExpr.MacroTcResult C.DeclId
+      -> Macro.TypecheckResult CExpr
+    convertResult = \case
+      CExpr.MacroTcTypeExpr x ->
+        Macro.TypecheckType  x
+      CExpr.MacroTcValueExpr x ->
+        Macro.TypecheckValue x
+      CExpr.MacroTcError err ->
+        Macro.TypecheckError $
+            MacroTypecheckError (Text.unpack (CExpr.pprMacroTcError err))
diff --git a/src/HsBindgen/Macro.hs b/src/HsBindgen/Macro.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/Macro.hs
@@ -0,0 +1,31 @@
+-- | The macro instance of @hs-bindgen@ is based on @c-expr-dsl@.
+--
+-- The macro language is not yet stable, and so all macro language definitions
+-- are exported as opaque.
+--
+-- Intended for qualified import.
+--
+-- @
+-- import HsBindgen.Macro (CExpr)
+-- import HsBindgen.Macro qualified as Macro
+-- @
+module HsBindgen.Macro (
+    -- * Macro language interface
+    Macro.HasTypes -- opaque
+  , Macro.Lang     -- opaque
+    -- * Integration with @c-expr@
+  , CExpr -- opaque
+  , cExpr -- opaque
+    -- * Empty macro language
+  , Empty -- opaque
+  , empty -- opaque
+    -- * Raw macro language
+  , Raw -- opaque
+  , raw -- opaque
+  ) where
+
+import HsBindgen.Internal.Macro.CExpr
+import HsBindgen.Macro.Empty
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Raw
+import HsBindgen.Macro.Type qualified as Macro
diff --git a/src/HsBindgen/TH.hs b/src/HsBindgen/TH.hs
new file mode 100644
--- /dev/null
+++ b/src/HsBindgen/TH.hs
@@ -0,0 +1,98 @@
+-- | Main entry point for using @hs-bindgen@ in Template-Haskell mode.
+--
+-- Intended for unqualified import.
+
+-- NOTE: Client code should /NOT/ have to import from @clang@.
+
+module HsBindgen.TH (
+    withHsBindgen
+  , TH.withHsBindgenMacroLang
+  , TH.hashInclude
+  , TH.hashDefine
+  , TH.BindgenM -- opaque, used in type signatures
+
+    -- * Configuration
+  , TH.Config
+  , Config.Config_(..)
+  , Config.ConfigTH(..)
+
+    -- ** Clang arguments
+  , ClangArgs.ClangArgsConfig(..)
+  , ClangArgs.BuiltinIncDirConfig(..)
+  , TH.IncludeDir(..)
+
+    -- ** Binding specifications
+  , BindingSpec.BindingSpecConfig(..)
+  , BindingSpec.EnableStdlibBindingSpec(..)
+  , BindingSpec.BindingSpecCompatibility(..)
+
+    -- ** Predicates and program slicing
+  , Predicate.Boolean(..)
+  , Predicate.HeaderPathPredicate(..)
+  , Predicate.Regex
+
+    -- *** Selection predicates and program slicing
+  , Predicate.SelectionPredicate(..)
+  , Predicate.DeclPredicate(..)
+  , Select.ProgramSlicing(..)
+
+    -- ** Fields
+  , Config.FieldNamingStrategy(..)
+
+    -- ** Macros
+  , Parse.EmptyMacros(..)
+
+    -- ** Binding categories
+  , Category.ByCategory(..)
+  , Category.Choice(..)
+  , Category.RenameTerm(..)
+  , Category.useSafeCategory
+  , Category.useUnsafeCategory
+  , Category.useFunPtrCategory
+
+    -- ** Tracer
+  , Tracer.Verbosity(..)
+  , TraceMsg.CustomLogLevelSetting(..)
+  , Tracer.Level(..)
+  , Tracer.TraceId(..)
+
+    -- * Re-exports
+  , Default.Default(..)
+
+    -- * Deriving
+    --
+    -- Ensure constructors are in scope when using @deriving via@.
+  , DerivingViaSupport.EquivStorable(..)
+  , DerivingViaSupport.SizedByteArray(..)
+  , DerivingViaSupport.IsStructViaReadRaw(..)
+  ) where
+
+import Data.Default qualified as Default
+import Language.Haskell.TH qualified as TH
+
+import HsBindgen.Runtime.Marshal qualified as DerivingViaSupport
+import HsBindgen.Runtime.Struct qualified as DerivingViaSupport
+import HsBindgen.Runtime.Support.SizedByteArray qualified as DerivingViaSupport
+
+import HsBindgen.Backend.Category qualified as Category
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Config qualified as Config
+import HsBindgen.Config.ClangArgs qualified as ClangArgs
+import HsBindgen.Frontend.Pass.Parse.IsPass qualified as Parse
+import HsBindgen.Frontend.Pass.Select.IsPass qualified as Select
+import HsBindgen.Frontend.Predicate qualified as Predicate
+import HsBindgen.Macro qualified as Macro
+import HsBindgen.TH.Internal qualified as TH
+import HsBindgen.TraceMsg as TraceMsg
+import HsBindgen.Util.Tracer as Tracer
+
+-- | Generate bindings for given C headers at compile-time using the default C
+-- macro language.
+--
+-- Use 'TH.withHsBindgenMacroLang' to supply a different macro-language backend.
+withHsBindgen ::
+     TH.Config
+  -> Config.ConfigTH
+  -> TH.BindgenM ()
+  -> TH.Q [TH.Dec]
+withHsBindgen = TH.withHsBindgenMacroLang (pure . Macro.cExpr)
diff --git a/test-artefacts/fixtures/arrays/array/Example.hs b/test-artefacts/fixtures/arrays/array/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/array/Example.hs
@@ -0,0 +1,330 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Triplet(..)
+    , Example.List(..)
+    , Example.Matrix(..)
+    , Example.Tripletlist(..)
+    , Example.Example(..)
+    , Example.Sudoku(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @triplet@
+
+    __defined at:__ @arrays\/array.h 41:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype Triplet = Triplet
+  { unwrapTriplet :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapTriplet" Triplet ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Triplet {unwrapTriplet = y1}, BG.getField @"unwrapTriplet" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapTriplet" (BG.Ptr Triplet) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTriplet")
+
+instance HasCField.HasCField Triplet "unwrapTriplet" where
+
+  type CFieldType Triplet "unwrapTriplet" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @list@
+
+    __defined at:__ @arrays\/array.h 43:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype List = List
+  { unwrapList :: IA.IncompleteArray BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapList" List ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         List {unwrapList = y1}, BG.getField @"unwrapList" x0)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.HasField "unwrapList" (BG.Ptr List) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapList")
+
+instance HasCField.HasCField List "unwrapList" where
+
+  type CFieldType List "unwrapList" =
+    IA.IncompleteArray BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @matrix@
+
+    __defined at:__ @arrays\/array.h 45:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype Matrix = Matrix
+  { unwrapMatrix :: CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapMatrix" Matrix ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Matrix {unwrapMatrix = y1}, BG.getField @"unwrapMatrix" x0)
+
+instance ( ty ~ CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)
+         ) => BG.HasField "unwrapMatrix" (BG.Ptr Matrix) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMatrix")
+
+instance HasCField.HasCField Matrix "unwrapMatrix" where
+
+  type CFieldType Matrix "unwrapMatrix" =
+    CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @tripletlist@
+
+    __defined at:__ @arrays\/array.h 47:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype Tripletlist = Tripletlist
+  { unwrapTripletlist :: IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapTripletlist" Tripletlist ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Tripletlist {unwrapTripletlist = y1}
+      , BG.getField @"unwrapTripletlist" x0
+      )
+
+instance ( ty ~ IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)
+         ) => BG.HasField "unwrapTripletlist" (BG.Ptr Tripletlist) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTripletlist")
+
+instance HasCField.HasCField Tripletlist "unwrapTripletlist" where
+
+  type CFieldType Tripletlist "unwrapTripletlist" =
+    IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct Example@
+
+    __defined at:__ @arrays\/array.h 49:8@
+
+    __exported by:__ @arrays\/array.h@
+-}
+data Example = Example
+  { example_triple :: CA.ConstantArray 3 BG.CInt
+    {- ^ __C declaration:__ @triple@
+
+         __defined at:__ @arrays\/array.h 50:9@
+
+         __exported by:__ @arrays\/array.h@
+    -}
+  , example_sudoku :: CA.ConstantArray 3 (CA.ConstantArray 3 BG.CInt)
+    {- ^ __C declaration:__ @sudoku@
+
+         __defined at:__ @arrays\/array.h 51:9@
+
+         __exported by:__ @arrays\/array.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Example where
+
+  staticSizeOf = \_ -> (48 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Example where
+
+  readRaw =
+    \ptr0 ->
+          pure Example
+      <*> HasCField.readRaw (BG.Proxy @"example_triple") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_sudoku") ptr0
+
+instance Marshal.WriteRaw Example where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Example example_triple2 example_sudoku3 ->
+               HasCField.writeRaw (BG.Proxy @"example_triple") ptr0 example_triple2
+            >> HasCField.writeRaw (BG.Proxy @"example_sudoku") ptr0 example_sudoku3
+
+deriving via Marshal.EquivStorable Example instance BG.Storable Example
+
+deriving via Struct.IsStructViaReadRaw Example instance Struct.IsStruct Example
+
+{-| __C declaration:__ @triple@
+
+    __defined at:__ @arrays\/array.h 50:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "example_triple" Example ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example {example_triple = y1, example_sudoku = BG.getField @"example_sudoku" x0}
+      , BG.getField @"example_triple" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "example_triple" (BG.Ptr Example) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_triple")
+
+instance HasCField.HasCField Example "example_triple" where
+
+  type CFieldType Example "example_triple" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @sudoku@
+
+    __defined at:__ @arrays\/array.h 51:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+instance ( ty ~ CA.ConstantArray 3 (CA.ConstantArray 3 BG.CInt)
+         ) => BG.CompatHasField.HasField "example_sudoku" Example ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example {example_sudoku = y1, example_triple = BG.getField @"example_triple" x0}
+      , BG.getField @"example_sudoku" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 3 (CA.ConstantArray 3 BG.CInt)
+         ) => BG.HasField "example_sudoku" (BG.Ptr Example) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_sudoku")
+
+instance HasCField.HasCField Example "example_sudoku" where
+
+  type CFieldType Example "example_sudoku" =
+    CA.ConstantArray 3 (CA.ConstantArray 3 BG.CInt)
+
+  offset# = \_ -> \_ -> 12
+
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @sudoku@
+
+    __defined at:__ @arrays\/array.h 55:17@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype Sudoku = Sudoku
+  { unwrapSudoku :: CA.ConstantArray 3 Triplet
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 Triplet
+         ) => BG.CompatHasField.HasField "unwrapSudoku" Sudoku ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Sudoku {unwrapSudoku = y1}, BG.getField @"unwrapSudoku" x0)
+
+instance ( ty ~ CA.ConstantArray 3 Triplet
+         ) => BG.HasField "unwrapSudoku" (BG.Ptr Sudoku) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSudoku")
+
+instance HasCField.HasCField Sudoku "unwrapSudoku" where
+
+  type CFieldType Sudoku "unwrapSudoku" =
+    CA.ConstantArray 3 Triplet
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/arrays/array/Example/FunPtr.hs b/test-artefacts/fixtures/arrays/array/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/array/Example/FunPtr.hs
@@ -0,0 +1,852 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun_1
+    , Example.FunPtr.fun_2
+    , Example.FunPtr.fun_3
+    , Example.FunPtr.fun_4
+    , Example.FunPtr.fun_5
+    , Example.FunPtr.fun_6
+    , Example.FunPtr.fun_7
+    , Example.FunPtr.fun_8
+    , Example.FunPtr.isSolved
+    , Example.FunPtr.fun_1_const
+    , Example.FunPtr.fun_2_const
+    , Example.FunPtr.fun_3_const
+    , Example.FunPtr.fun_4_const
+    , Example.FunPtr.fun_5_const
+    , Example.FunPtr.fun_6_const
+    , Example.FunPtr.fun_7_const
+    , Example.FunPtr.fun_8_const
+    , Example.FunPtr.isSolved_const
+    , Example.FunPtr.fun_9
+    , Example.FunPtr.fun_10
+    , Example.FunPtr.fun_11
+    , Example.FunPtr.fun_12
+    , Example.FunPtr.fun_13
+    , Example.FunPtr.fun_14
+    , Example.FunPtr.fun_15
+    , Example.FunPtr.fun_16
+    , Example.FunPtr.solve
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/array.h>"
+  , "/* test_arraysarray_Example_get_fun_1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_5c9712c1e2ca2187 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  return &fun_1;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_215c9a69aea5166e (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fun_2;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_d45ffb769078021d (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fun_3;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_4 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_16f300d083285e38 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fun_4;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_5 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_05ddc0274405d6f5 (void)) ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return &fun_5;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_6 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_bc6a8e5360af8799 (void)) ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return &fun_6;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_7 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_b633a17af8e60afd (void)) ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return &fun_7;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_8 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_0801bc85e75e7232 (void)) ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return &fun_8;"
+  , "}"
+  , "/* test_arraysarray_Example_get_isSolved */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_f525d0058f613e21 (void)) ("
+  , "  triplet *arg1"
+  , ")"
+  , "{"
+  , "  return &isSolved;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_1_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_0fdde9c360622daf (void)) ("
+  , "  signed int arg1,"
+  , "  signed int *arg2,"
+  , "  signed int const *arg3"
+  , ")"
+  , "{"
+  , "  return &fun_1_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_2_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_8182488430e66fdc (void)) ("
+  , "  signed int *arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return &fun_2_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_3_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2303f5a2f855a6e5 (void)) ("
+  , "  signed int *arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return &fun_3_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_4_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_4570b26d96819cd9 (void)) ("
+  , "  signed int *arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return &fun_4_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_5_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_65a5e31cfb885928 (void)) ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return &fun_5_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_6_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_107e8456ef4df268 (void)) ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return &fun_6_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_7_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_249a199499d81ca8 (void)) ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return &fun_7_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_8_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_92bc0bfe006ce53c (void)) ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return &fun_8_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_isSolved_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_935428cb3e78f9a5 (void)) ("
+  , "  triplet *arg1,"
+  , "  triplet const *arg2"
+  , ")"
+  , "{"
+  , "  return &isSolved_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_9 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_c9bec6ab325b063c (void)) (void))[3]"
+  , "{"
+  , "  return &fun_9;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_10 */"
+  , "__attribute__ ((const))"
+  , "triplet *(*hs_bindgen_49f85263b6310047 (void)) (void)"
+  , "{"
+  , "  return &fun_10;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_11 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_68bdd4a6e02a046b (void)) (void))[]"
+  , "{"
+  , "  return &fun_11;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_12 */"
+  , "__attribute__ ((const))"
+  , "list *(*hs_bindgen_0521f5208260a928 (void)) (void)"
+  , "{"
+  , "  return &fun_12;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_13 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_9d0f2421c940811c (void)) (void))[4][3]"
+  , "{"
+  , "  return &fun_13;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_14 */"
+  , "__attribute__ ((const))"
+  , "matrix *(*hs_bindgen_50eeeb460ce92a1d (void)) (void)"
+  , "{"
+  , "  return &fun_14;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_15 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_afb15d11d3db71eb (void)) (void))[][3]"
+  , "{"
+  , "  return &fun_15;"
+  , "}"
+  , "/* test_arraysarray_Example_get_fun_16 */"
+  , "__attribute__ ((const))"
+  , "tripletlist *(*hs_bindgen_f41fbdca0717f85b (void)) (void)"
+  , "{"
+  , "  return &fun_16;"
+  , "}"
+  , "/* test_arraysarray_Example_get_solve */"
+  , "__attribute__ ((const))"
+  , "sudoku *(*hs_bindgen_b219669884cf1eb6 (void)) (void)"
+  , "{"
+  , "  return &solve;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysarray_Example_get_fun_1@
+foreign import ccall unsafe "hs_bindgen_5c9712c1e2ca2187" hs_bindgen_5c9712c1e2ca2187_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_1@
+hs_bindgen_5c9712c1e2ca2187 :: IO (BG.FunPtr (BG.CInt -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> IO BG.CInt))
+hs_bindgen_5c9712c1e2ca2187 =
+  fmap BG.fromFFIType hs_bindgen_5c9712c1e2ca2187_base
+
+{-# NOINLINE fun_1 #-}
+{-| Array of known size.
+
+    __C declaration:__ @fun_1@
+
+    __defined at:__ @arrays\/array.h 118:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1 :: BG.FunPtr (BG.CInt -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> IO BG.CInt)
+fun_1 =
+  BG.unsafePerformIO hs_bindgen_5c9712c1e2ca2187
+
+-- __unique:__ @test_arraysarray_Example_get_fun_2@
+foreign import ccall unsafe "hs_bindgen_215c9a69aea5166e" hs_bindgen_215c9a69aea5166e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_2@
+hs_bindgen_215c9a69aea5166e :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Triplet) -> IO BG.CInt))
+hs_bindgen_215c9a69aea5166e =
+  fmap BG.fromFFIType hs_bindgen_215c9a69aea5166e_base
+
+{-# NOINLINE fun_2 #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2@
+
+    __defined at:__ @arrays\/array.h 121:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2 :: BG.FunPtr (BG.Ptr (IsA.Elem Triplet) -> IO BG.CInt)
+fun_2 =
+  BG.unsafePerformIO hs_bindgen_215c9a69aea5166e
+
+-- __unique:__ @test_arraysarray_Example_get_fun_3@
+foreign import ccall unsafe "hs_bindgen_d45ffb769078021d" hs_bindgen_d45ffb769078021d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_3@
+hs_bindgen_d45ffb769078021d :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO BG.CInt))
+hs_bindgen_d45ffb769078021d =
+  fmap BG.fromFFIType hs_bindgen_d45ffb769078021d_base
+
+{-# NOINLINE fun_3 #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3@
+
+    __defined at:__ @arrays\/array.h 124:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO BG.CInt)
+fun_3 =
+  BG.unsafePerformIO hs_bindgen_d45ffb769078021d
+
+-- __unique:__ @test_arraysarray_Example_get_fun_4@
+foreign import ccall unsafe "hs_bindgen_16f300d083285e38" hs_bindgen_16f300d083285e38_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_4@
+hs_bindgen_16f300d083285e38 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem List) -> IO BG.CInt))
+hs_bindgen_16f300d083285e38 =
+  fmap BG.fromFFIType hs_bindgen_16f300d083285e38_base
+
+{-# NOINLINE fun_4 #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4@
+
+    __defined at:__ @arrays\/array.h 127:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4 :: BG.FunPtr (BG.Ptr (IsA.Elem List) -> IO BG.CInt)
+fun_4 =
+  BG.unsafePerformIO hs_bindgen_16f300d083285e38
+
+-- __unique:__ @test_arraysarray_Example_get_fun_5@
+foreign import ccall unsafe "hs_bindgen_05ddc0274405d6f5" hs_bindgen_05ddc0274405d6f5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_5@
+hs_bindgen_05ddc0274405d6f5 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt))) -> IO BG.CInt))
+hs_bindgen_05ddc0274405d6f5 =
+  fmap BG.fromFFIType hs_bindgen_05ddc0274405d6f5_base
+
+{-# NOINLINE fun_5 #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5@
+
+    __defined at:__ @arrays\/array.h 130:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5 :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt))) -> IO BG.CInt)
+fun_5 =
+  BG.unsafePerformIO hs_bindgen_05ddc0274405d6f5
+
+-- __unique:__ @test_arraysarray_Example_get_fun_6@
+foreign import ccall unsafe "hs_bindgen_bc6a8e5360af8799" hs_bindgen_bc6a8e5360af8799_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_6@
+hs_bindgen_bc6a8e5360af8799 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Matrix) -> IO BG.CInt))
+hs_bindgen_bc6a8e5360af8799 =
+  fmap BG.fromFFIType hs_bindgen_bc6a8e5360af8799_base
+
+{-# NOINLINE fun_6 #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6@
+
+    __defined at:__ @arrays\/array.h 133:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6 :: BG.FunPtr (BG.Ptr (IsA.Elem Matrix) -> IO BG.CInt)
+fun_6 =
+  BG.unsafePerformIO hs_bindgen_bc6a8e5360af8799
+
+-- __unique:__ @test_arraysarray_Example_get_fun_7@
+foreign import ccall unsafe "hs_bindgen_b633a17af8e60afd" hs_bindgen_b633a17af8e60afd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_7@
+hs_bindgen_b633a17af8e60afd :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt))) -> IO BG.CInt))
+hs_bindgen_b633a17af8e60afd =
+  fmap BG.fromFFIType hs_bindgen_b633a17af8e60afd_base
+
+{-# NOINLINE fun_7 #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7@
+
+    __defined at:__ @arrays\/array.h 136:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt))) -> IO BG.CInt)
+fun_7 =
+  BG.unsafePerformIO hs_bindgen_b633a17af8e60afd
+
+-- __unique:__ @test_arraysarray_Example_get_fun_8@
+foreign import ccall unsafe "hs_bindgen_0801bc85e75e7232" hs_bindgen_0801bc85e75e7232_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_8@
+hs_bindgen_0801bc85e75e7232 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Tripletlist) -> IO BG.CInt))
+hs_bindgen_0801bc85e75e7232 =
+  fmap BG.fromFFIType hs_bindgen_0801bc85e75e7232_base
+
+{-# NOINLINE fun_8 #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8@
+
+    __defined at:__ @arrays\/array.h 139:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8 :: BG.FunPtr (BG.Ptr (IsA.Elem Tripletlist) -> IO BG.CInt)
+fun_8 =
+  BG.unsafePerformIO hs_bindgen_0801bc85e75e7232
+
+-- __unique:__ @test_arraysarray_Example_get_isSolved@
+foreign import ccall unsafe "hs_bindgen_f525d0058f613e21" hs_bindgen_f525d0058f613e21_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_isSolved@
+hs_bindgen_f525d0058f613e21 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Sudoku) -> IO BG.CInt))
+hs_bindgen_f525d0058f613e21 =
+  fmap BG.fromFFIType hs_bindgen_f525d0058f613e21_base
+
+{-# NOINLINE isSolved #-}
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved@
+
+    __defined at:__ @arrays\/array.h 142:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved :: BG.FunPtr (BG.Ptr (IsA.Elem Sudoku) -> IO BG.CInt)
+isSolved =
+  BG.unsafePerformIO hs_bindgen_f525d0058f613e21
+
+-- __unique:__ @test_arraysarray_Example_get_fun_1_const@
+foreign import ccall unsafe "hs_bindgen_0fdde9c360622daf" hs_bindgen_0fdde9c360622daf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_1_const@
+hs_bindgen_0fdde9c360622daf :: IO (BG.FunPtr (BG.CInt -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> IO BG.CInt))
+hs_bindgen_0fdde9c360622daf =
+  fmap BG.fromFFIType hs_bindgen_0fdde9c360622daf_base
+
+{-# NOINLINE fun_1_const #-}
+{-| Array of known size.
+
+    __C declaration:__ @fun_1_const@
+
+    __defined at:__ @arrays\/array.h 149:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_const :: BG.FunPtr (BG.CInt -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> IO BG.CInt)
+fun_1_const =
+  BG.unsafePerformIO hs_bindgen_0fdde9c360622daf
+
+-- __unique:__ @test_arraysarray_Example_get_fun_2_const@
+foreign import ccall unsafe "hs_bindgen_8182488430e66fdc" hs_bindgen_8182488430e66fdc_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_2_const@
+hs_bindgen_8182488430e66fdc :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Triplet) -> PtrConst.PtrConst (IsA.Elem Triplet) -> IO BG.CInt))
+hs_bindgen_8182488430e66fdc =
+  fmap BG.fromFFIType hs_bindgen_8182488430e66fdc_base
+
+{-# NOINLINE fun_2_const #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2_const@
+
+    __defined at:__ @arrays\/array.h 152:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_const :: BG.FunPtr (BG.Ptr (IsA.Elem Triplet) -> PtrConst.PtrConst (IsA.Elem Triplet) -> IO BG.CInt)
+fun_2_const =
+  BG.unsafePerformIO hs_bindgen_8182488430e66fdc
+
+-- __unique:__ @test_arraysarray_Example_get_fun_3_const@
+foreign import ccall unsafe "hs_bindgen_2303f5a2f855a6e5" hs_bindgen_2303f5a2f855a6e5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_3_const@
+hs_bindgen_2303f5a2f855a6e5 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO BG.CInt))
+hs_bindgen_2303f5a2f855a6e5 =
+  fmap BG.fromFFIType hs_bindgen_2303f5a2f855a6e5_base
+
+{-# NOINLINE fun_3_const #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3_const@
+
+    __defined at:__ @arrays\/array.h 155:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_const :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO BG.CInt)
+fun_3_const =
+  BG.unsafePerformIO hs_bindgen_2303f5a2f855a6e5
+
+-- __unique:__ @test_arraysarray_Example_get_fun_4_const@
+foreign import ccall unsafe "hs_bindgen_4570b26d96819cd9" hs_bindgen_4570b26d96819cd9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_4_const@
+hs_bindgen_4570b26d96819cd9 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem List) -> PtrConst.PtrConst (IsA.Elem List) -> IO BG.CInt))
+hs_bindgen_4570b26d96819cd9 =
+  fmap BG.fromFFIType hs_bindgen_4570b26d96819cd9_base
+
+{-# NOINLINE fun_4_const #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4_const@
+
+    __defined at:__ @arrays\/array.h 158:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_const :: BG.FunPtr (BG.Ptr (IsA.Elem List) -> PtrConst.PtrConst (IsA.Elem List) -> IO BG.CInt)
+fun_4_const =
+  BG.unsafePerformIO hs_bindgen_4570b26d96819cd9
+
+-- __unique:__ @test_arraysarray_Example_get_fun_5_const@
+foreign import ccall unsafe "hs_bindgen_65a5e31cfb885928" hs_bindgen_65a5e31cfb885928_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_5_const@
+hs_bindgen_65a5e31cfb885928 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt))) -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt))) -> IO BG.CInt))
+hs_bindgen_65a5e31cfb885928 =
+  fmap BG.fromFFIType hs_bindgen_65a5e31cfb885928_base
+
+{-# NOINLINE fun_5_const #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5_const@
+
+    __defined at:__ @arrays\/array.h 161:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_const :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt))) -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt))) -> IO BG.CInt)
+fun_5_const =
+  BG.unsafePerformIO hs_bindgen_65a5e31cfb885928
+
+-- __unique:__ @test_arraysarray_Example_get_fun_6_const@
+foreign import ccall unsafe "hs_bindgen_107e8456ef4df268" hs_bindgen_107e8456ef4df268_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_6_const@
+hs_bindgen_107e8456ef4df268 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Matrix) -> PtrConst.PtrConst (IsA.Elem Matrix) -> IO BG.CInt))
+hs_bindgen_107e8456ef4df268 =
+  fmap BG.fromFFIType hs_bindgen_107e8456ef4df268_base
+
+{-# NOINLINE fun_6_const #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6_const@
+
+    __defined at:__ @arrays\/array.h 164:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_const :: BG.FunPtr (BG.Ptr (IsA.Elem Matrix) -> PtrConst.PtrConst (IsA.Elem Matrix) -> IO BG.CInt)
+fun_6_const =
+  BG.unsafePerformIO hs_bindgen_107e8456ef4df268
+
+-- __unique:__ @test_arraysarray_Example_get_fun_7_const@
+foreign import ccall unsafe "hs_bindgen_249a199499d81ca8" hs_bindgen_249a199499d81ca8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_7_const@
+hs_bindgen_249a199499d81ca8 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt))) -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt))) -> IO BG.CInt))
+hs_bindgen_249a199499d81ca8 =
+  fmap BG.fromFFIType hs_bindgen_249a199499d81ca8_base
+
+{-# NOINLINE fun_7_const #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7_const@
+
+    __defined at:__ @arrays\/array.h 167:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_const :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt))) -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt))) -> IO BG.CInt)
+fun_7_const =
+  BG.unsafePerformIO hs_bindgen_249a199499d81ca8
+
+-- __unique:__ @test_arraysarray_Example_get_fun_8_const@
+foreign import ccall unsafe "hs_bindgen_92bc0bfe006ce53c" hs_bindgen_92bc0bfe006ce53c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_8_const@
+hs_bindgen_92bc0bfe006ce53c :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Tripletlist) -> PtrConst.PtrConst (IsA.Elem Tripletlist) -> IO BG.CInt))
+hs_bindgen_92bc0bfe006ce53c =
+  fmap BG.fromFFIType hs_bindgen_92bc0bfe006ce53c_base
+
+{-# NOINLINE fun_8_const #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8_const@
+
+    __defined at:__ @arrays\/array.h 170:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_const :: BG.FunPtr (BG.Ptr (IsA.Elem Tripletlist) -> PtrConst.PtrConst (IsA.Elem Tripletlist) -> IO BG.CInt)
+fun_8_const =
+  BG.unsafePerformIO hs_bindgen_92bc0bfe006ce53c
+
+-- __unique:__ @test_arraysarray_Example_get_isSolved_const@
+foreign import ccall unsafe "hs_bindgen_935428cb3e78f9a5" hs_bindgen_935428cb3e78f9a5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_isSolved_const@
+hs_bindgen_935428cb3e78f9a5 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Sudoku) -> PtrConst.PtrConst (IsA.Elem Sudoku) -> IO BG.CInt))
+hs_bindgen_935428cb3e78f9a5 =
+  fmap BG.fromFFIType hs_bindgen_935428cb3e78f9a5_base
+
+{-# NOINLINE isSolved_const #-}
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved_const@
+
+    __defined at:__ @arrays\/array.h 173:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_const :: BG.FunPtr (BG.Ptr (IsA.Elem Sudoku) -> PtrConst.PtrConst (IsA.Elem Sudoku) -> IO BG.CInt)
+isSolved_const =
+  BG.unsafePerformIO hs_bindgen_935428cb3e78f9a5
+
+-- __unique:__ @test_arraysarray_Example_get_fun_9@
+foreign import ccall unsafe "hs_bindgen_c9bec6ab325b063c" hs_bindgen_c9bec6ab325b063c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_9@
+hs_bindgen_c9bec6ab325b063c :: IO (BG.FunPtr (IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))))
+hs_bindgen_c9bec6ab325b063c =
+  fmap BG.fromFFIType hs_bindgen_c9bec6ab325b063c_base
+
+{-# NOINLINE fun_9 #-}
+{-| Array of known size.
+
+    __C declaration:__ @fun_9@
+
+    __defined at:__ @arrays\/array.h 185:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_9 :: BG.FunPtr (IO (BG.Ptr (CA.ConstantArray 3 BG.CInt)))
+fun_9 =
+  BG.unsafePerformIO hs_bindgen_c9bec6ab325b063c
+
+-- __unique:__ @test_arraysarray_Example_get_fun_10@
+foreign import ccall unsafe "hs_bindgen_49f85263b6310047" hs_bindgen_49f85263b6310047_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_10@
+hs_bindgen_49f85263b6310047 :: IO (BG.FunPtr (IO (BG.Ptr Triplet)))
+hs_bindgen_49f85263b6310047 =
+  fmap BG.fromFFIType hs_bindgen_49f85263b6310047_base
+
+{-# NOINLINE fun_10 #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_10@
+
+    __defined at:__ @arrays\/array.h 188:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_10 :: BG.FunPtr (IO (BG.Ptr Triplet))
+fun_10 =
+  BG.unsafePerformIO hs_bindgen_49f85263b6310047
+
+-- __unique:__ @test_arraysarray_Example_get_fun_11@
+foreign import ccall unsafe "hs_bindgen_68bdd4a6e02a046b" hs_bindgen_68bdd4a6e02a046b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_11@
+hs_bindgen_68bdd4a6e02a046b :: IO (BG.FunPtr (IO (BG.Ptr (IA.IncompleteArray BG.CInt))))
+hs_bindgen_68bdd4a6e02a046b =
+  fmap BG.fromFFIType hs_bindgen_68bdd4a6e02a046b_base
+
+{-# NOINLINE fun_11 #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_11@
+
+    __defined at:__ @arrays\/array.h 191:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_11 :: BG.FunPtr (IO (BG.Ptr (IA.IncompleteArray BG.CInt)))
+fun_11 =
+  BG.unsafePerformIO hs_bindgen_68bdd4a6e02a046b
+
+-- __unique:__ @test_arraysarray_Example_get_fun_12@
+foreign import ccall unsafe "hs_bindgen_0521f5208260a928" hs_bindgen_0521f5208260a928_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_12@
+hs_bindgen_0521f5208260a928 :: IO (BG.FunPtr (IO (BG.Ptr List)))
+hs_bindgen_0521f5208260a928 =
+  fmap BG.fromFFIType hs_bindgen_0521f5208260a928_base
+
+{-# NOINLINE fun_12 #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_12@
+
+    __defined at:__ @arrays\/array.h 194:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_12 :: BG.FunPtr (IO (BG.Ptr List))
+fun_12 =
+  BG.unsafePerformIO hs_bindgen_0521f5208260a928
+
+-- __unique:__ @test_arraysarray_Example_get_fun_13@
+foreign import ccall unsafe "hs_bindgen_9d0f2421c940811c" hs_bindgen_9d0f2421c940811c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_13@
+hs_bindgen_9d0f2421c940811c :: IO (BG.FunPtr (IO (BG.Ptr (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_9d0f2421c940811c =
+  fmap BG.fromFFIType hs_bindgen_9d0f2421c940811c_base
+
+{-# NOINLINE fun_13 #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_13@
+
+    __defined at:__ @arrays\/array.h 197:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_13 :: BG.FunPtr (IO (BG.Ptr (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt))))
+fun_13 =
+  BG.unsafePerformIO hs_bindgen_9d0f2421c940811c
+
+-- __unique:__ @test_arraysarray_Example_get_fun_14@
+foreign import ccall unsafe "hs_bindgen_50eeeb460ce92a1d" hs_bindgen_50eeeb460ce92a1d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_14@
+hs_bindgen_50eeeb460ce92a1d :: IO (BG.FunPtr (IO (BG.Ptr Matrix)))
+hs_bindgen_50eeeb460ce92a1d =
+  fmap BG.fromFFIType hs_bindgen_50eeeb460ce92a1d_base
+
+{-# NOINLINE fun_14 #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_14@
+
+    __defined at:__ @arrays\/array.h 200:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_14 :: BG.FunPtr (IO (BG.Ptr Matrix))
+fun_14 =
+  BG.unsafePerformIO hs_bindgen_50eeeb460ce92a1d
+
+-- __unique:__ @test_arraysarray_Example_get_fun_15@
+foreign import ccall unsafe "hs_bindgen_afb15d11d3db71eb" hs_bindgen_afb15d11d3db71eb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_15@
+hs_bindgen_afb15d11d3db71eb :: IO (BG.FunPtr (IO (BG.Ptr (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_afb15d11d3db71eb =
+  fmap BG.fromFFIType hs_bindgen_afb15d11d3db71eb_base
+
+{-# NOINLINE fun_15 #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_15@
+
+    __defined at:__ @arrays\/array.h 203:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_15 :: BG.FunPtr (IO (BG.Ptr (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt))))
+fun_15 =
+  BG.unsafePerformIO hs_bindgen_afb15d11d3db71eb
+
+-- __unique:__ @test_arraysarray_Example_get_fun_16@
+foreign import ccall unsafe "hs_bindgen_f41fbdca0717f85b" hs_bindgen_f41fbdca0717f85b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_fun_16@
+hs_bindgen_f41fbdca0717f85b :: IO (BG.FunPtr (IO (BG.Ptr Tripletlist)))
+hs_bindgen_f41fbdca0717f85b =
+  fmap BG.fromFFIType hs_bindgen_f41fbdca0717f85b_base
+
+{-# NOINLINE fun_16 #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_16@
+
+    __defined at:__ @arrays\/array.h 206:14@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_16 :: BG.FunPtr (IO (BG.Ptr Tripletlist))
+fun_16 =
+  BG.unsafePerformIO hs_bindgen_f41fbdca0717f85b
+
+-- __unique:__ @test_arraysarray_Example_get_solve@
+foreign import ccall unsafe "hs_bindgen_b219669884cf1eb6" hs_bindgen_b219669884cf1eb6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_solve@
+hs_bindgen_b219669884cf1eb6 :: IO (BG.FunPtr (IO (BG.Ptr Sudoku)))
+hs_bindgen_b219669884cf1eb6 =
+  fmap BG.fromFFIType hs_bindgen_b219669884cf1eb6_base
+
+{-# NOINLINE solve #-}
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @solve@
+
+    __defined at:__ @arrays\/array.h 209:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+solve :: BG.FunPtr (IO (BG.Ptr Sudoku))
+solve =
+  BG.unsafePerformIO hs_bindgen_b219669884cf1eb6
diff --git a/test-artefacts/fixtures/arrays/array/Example/Global.hs b/test-artefacts/fixtures/arrays/array/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/array/Example/Global.hs
@@ -0,0 +1,765 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.arr0
+    , Example.Global.arr1
+    , Example.Global.arr2
+    , Example.Global.arr3
+    , Example.Global.arr4
+    , Example.Global.arr5
+    , Example.Global.arr6
+    , Example.Global.arr7
+    , Example.Global.arr8
+    , Example.Global.arr_1
+    , Example.Global.arr_2
+    , Example.Global.arr_3
+    , Example.Global.arr_4
+    , Example.Global.arr_5
+    , Example.Global.arr_6
+    , Example.Global.arr_7
+    , Example.Global.arr_8
+    , Example.Global.arr_1_const
+    , Example.Global.arr_2_const
+    , Example.Global.arr_3_const
+    , Example.Global.arr_4_const
+    , Example.Global.arr_5_const
+    , Example.Global.arr_6_const
+    , Example.Global.arr_7_const
+    , Example.Global.arr_8_const
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/array.h>"
+  , "/* test_arraysarray_Example_get_arr0 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_21338ece6a009179 (void))[3]"
+  , "{"
+  , "  return &arr0;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_a058c9f90a6e675c (void))[3]"
+  , "{"
+  , "  return &arr1;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_c57aab7f71d2cb0b (void))[3]"
+  , "{"
+  , "  return &arr2;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_e2b7478ee9c12746 (void))[3]"
+  , "{"
+  , "  return &arr3;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr4 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_5d33e8cdfb8c9242 (void))[3]"
+  , "{"
+  , "  return &arr4;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr5 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ef557ae1941f9959 (void))[3]"
+  , "{"
+  , "  return &arr5;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr6 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_5f4d28170d6fa0d1 (void))[1]"
+  , "{"
+  , "  return &arr6;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr7 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_3b952c95c3eb17f2 (void))[]"
+  , "{"
+  , "  return &arr7;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr8 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_fe12bb34a92772f4 (void))[3]"
+  , "{"
+  , "  return &arr8;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2d21b7cb9ac33ea8 (void))[3]"
+  , "{"
+  , "  return &arr_1;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_2 */"
+  , "__attribute__ ((const))"
+  , "triplet *hs_bindgen_df706ce2499e5073 (void)"
+  , "{"
+  , "  return &arr_2;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_26bcbe886b94adfb (void))[]"
+  , "{"
+  , "  return &arr_3;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_4 */"
+  , "__attribute__ ((const))"
+  , "list *hs_bindgen_e4cef264a5cc1887 (void)"
+  , "{"
+  , "  return &arr_4;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_5 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_a733c5b896a8ae4e (void))[4][3]"
+  , "{"
+  , "  return &arr_5;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_6 */"
+  , "__attribute__ ((const))"
+  , "matrix *hs_bindgen_525a326f0badae7c (void)"
+  , "{"
+  , "  return &arr_6;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_7 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_b5e93d2d90ffc861 (void))[][3]"
+  , "{"
+  , "  return &arr_7;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_8 */"
+  , "__attribute__ ((const))"
+  , "tripletlist *hs_bindgen_eb98aff4ee1d31d0 (void)"
+  , "{"
+  , "  return &arr_8;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_1_const */"
+  , "__attribute__ ((const))"
+  , "signed int const (*hs_bindgen_25089a5dd72254bc (void))[3]"
+  , "{"
+  , "  return &arr_1_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_2_const */"
+  , "__attribute__ ((const))"
+  , "triplet const *hs_bindgen_a55a5562a096ae11 (void)"
+  , "{"
+  , "  return &arr_2_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_3_const */"
+  , "__attribute__ ((const))"
+  , "signed int const (*hs_bindgen_fad31baeec544a6d (void))[]"
+  , "{"
+  , "  return &arr_3_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_4_const */"
+  , "__attribute__ ((const))"
+  , "list const *hs_bindgen_890c46fc872e1d7d (void)"
+  , "{"
+  , "  return &arr_4_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_5_const */"
+  , "__attribute__ ((const))"
+  , "signed int const (*hs_bindgen_088c9ea4e73d1cfe (void))[4][3]"
+  , "{"
+  , "  return &arr_5_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_6_const */"
+  , "__attribute__ ((const))"
+  , "matrix const *hs_bindgen_bf69f287b3bf9fa4 (void)"
+  , "{"
+  , "  return &arr_6_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_7_const */"
+  , "__attribute__ ((const))"
+  , "signed int const (*hs_bindgen_2ca44942791eacc4 (void))[][3]"
+  , "{"
+  , "  return &arr_7_const;"
+  , "}"
+  , "/* test_arraysarray_Example_get_arr_8_const */"
+  , "__attribute__ ((const))"
+  , "tripletlist const *hs_bindgen_3e95fdf3b641c349 (void)"
+  , "{"
+  , "  return &arr_8_const;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysarray_Example_get_arr0@
+foreign import ccall unsafe "hs_bindgen_21338ece6a009179" hs_bindgen_21338ece6a009179_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr0@
+hs_bindgen_21338ece6a009179 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_21338ece6a009179 =
+  fmap BG.fromFFIType hs_bindgen_21338ece6a009179_base
+
+{-# NOINLINE arr0 #-}
+{-| Global, complete, not initialised.
+
+    __C declaration:__ @arr0@
+
+    __defined at:__ @arrays\/array.h 11:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr0 :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr0 = BG.unsafePerformIO hs_bindgen_21338ece6a009179
+
+-- __unique:__ @test_arraysarray_Example_get_arr1@
+foreign import ccall unsafe "hs_bindgen_a058c9f90a6e675c" hs_bindgen_a058c9f90a6e675c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr1@
+hs_bindgen_a058c9f90a6e675c :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_a058c9f90a6e675c =
+  fmap BG.fromFFIType hs_bindgen_a058c9f90a6e675c_base
+
+{-# NOINLINE arr1 #-}
+{-| Global, complete, initialised.
+
+    __C declaration:__ @arr1@
+
+    __defined at:__ @arrays\/array.h 14:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr1 :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr1 = BG.unsafePerformIO hs_bindgen_a058c9f90a6e675c
+
+-- __unique:__ @test_arraysarray_Example_get_arr2@
+foreign import ccall unsafe "hs_bindgen_c57aab7f71d2cb0b" hs_bindgen_c57aab7f71d2cb0b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr2@
+hs_bindgen_c57aab7f71d2cb0b :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_c57aab7f71d2cb0b =
+  fmap BG.fromFFIType hs_bindgen_c57aab7f71d2cb0b_base
+
+{-# NOINLINE arr2 #-}
+{-| Global, extern, complete, not initialised.
+
+    __C declaration:__ @arr2@
+
+    __defined at:__ @arrays\/array.h 17:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr2 :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr2 = BG.unsafePerformIO hs_bindgen_c57aab7f71d2cb0b
+
+-- __unique:__ @test_arraysarray_Example_get_arr3@
+foreign import ccall unsafe "hs_bindgen_e2b7478ee9c12746" hs_bindgen_e2b7478ee9c12746_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr3@
+hs_bindgen_e2b7478ee9c12746 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_e2b7478ee9c12746 =
+  fmap BG.fromFFIType hs_bindgen_e2b7478ee9c12746_base
+
+{-# NOINLINE arr3 #-}
+{-| Global, extern, complete, initialised.
+
+    __C declaration:__ @arr3@
+
+    __defined at:__ @arrays\/array.h 20:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr3 :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr3 = BG.unsafePerformIO hs_bindgen_e2b7478ee9c12746
+
+-- __unique:__ @test_arraysarray_Example_get_arr4@
+foreign import ccall unsafe "hs_bindgen_5d33e8cdfb8c9242" hs_bindgen_5d33e8cdfb8c9242_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr4@
+hs_bindgen_5d33e8cdfb8c9242 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_5d33e8cdfb8c9242 =
+  fmap BG.fromFFIType hs_bindgen_5d33e8cdfb8c9242_base
+
+{-# NOINLINE arr4 #-}
+{-| Global, static, complete, not initialised.
+
+    __C declaration:__ @arr4@
+
+    __defined at:__ @arrays\/array.h 23:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr4 :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr4 = BG.unsafePerformIO hs_bindgen_5d33e8cdfb8c9242
+
+-- __unique:__ @test_arraysarray_Example_get_arr5@
+foreign import ccall unsafe "hs_bindgen_ef557ae1941f9959" hs_bindgen_ef557ae1941f9959_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr5@
+hs_bindgen_ef557ae1941f9959 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_ef557ae1941f9959 =
+  fmap BG.fromFFIType hs_bindgen_ef557ae1941f9959_base
+
+{-# NOINLINE arr5 #-}
+{-| Global, static, complete, initialised.
+
+    __C declaration:__ @arr5@
+
+    __defined at:__ @arrays\/array.h 26:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr5 :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr5 = BG.unsafePerformIO hs_bindgen_ef557ae1941f9959
+
+-- __unique:__ @test_arraysarray_Example_get_arr6@
+foreign import ccall unsafe "hs_bindgen_5f4d28170d6fa0d1" hs_bindgen_5f4d28170d6fa0d1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr6@
+hs_bindgen_5f4d28170d6fa0d1 :: IO (BG.Ptr (CA.ConstantArray 1 BG.CInt))
+hs_bindgen_5f4d28170d6fa0d1 =
+  fmap BG.fromFFIType hs_bindgen_5f4d28170d6fa0d1_base
+
+{-# NOINLINE arr6 #-}
+{-| Global, incomplete.
+
+    __C declaration:__ @arr6@
+
+    __defined at:__ @arrays\/array.h 29:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr6 :: BG.Ptr (CA.ConstantArray 1 BG.CInt)
+arr6 = BG.unsafePerformIO hs_bindgen_5f4d28170d6fa0d1
+
+-- __unique:__ @test_arraysarray_Example_get_arr7@
+foreign import ccall unsafe "hs_bindgen_3b952c95c3eb17f2" hs_bindgen_3b952c95c3eb17f2_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr7@
+hs_bindgen_3b952c95c3eb17f2 :: IO (BG.Ptr (IA.IncompleteArray BG.CInt))
+hs_bindgen_3b952c95c3eb17f2 =
+  fmap BG.fromFFIType hs_bindgen_3b952c95c3eb17f2_base
+
+{-# NOINLINE arr7 #-}
+{-| Global, extern, incomplete.
+
+    __C declaration:__ @arr7@
+
+    __defined at:__ @arrays\/array.h 32:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr7 :: BG.Ptr (IA.IncompleteArray BG.CInt)
+arr7 = BG.unsafePerformIO hs_bindgen_3b952c95c3eb17f2
+
+-- __unique:__ @test_arraysarray_Example_get_arr8@
+foreign import ccall unsafe "hs_bindgen_fe12bb34a92772f4" hs_bindgen_fe12bb34a92772f4_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr8@
+hs_bindgen_fe12bb34a92772f4 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_fe12bb34a92772f4 =
+  fmap BG.fromFFIType hs_bindgen_fe12bb34a92772f4_base
+
+{-# NOINLINE arr8 #-}
+{-| Global, static, incomplete.
+
+    __C declaration:__ @arr8@
+
+    __defined at:__ @arrays\/array.h 35:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr8 :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr8 = BG.unsafePerformIO hs_bindgen_fe12bb34a92772f4
+
+-- __unique:__ @test_arraysarray_Example_get_arr_1@
+foreign import ccall unsafe "hs_bindgen_2d21b7cb9ac33ea8" hs_bindgen_2d21b7cb9ac33ea8_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_1@
+hs_bindgen_2d21b7cb9ac33ea8 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_2d21b7cb9ac33ea8 =
+  fmap BG.fromFFIType hs_bindgen_2d21b7cb9ac33ea8_base
+
+{-# NOINLINE arr_1 #-}
+{-| Array of known size.
+
+    __C declaration:__ @arr_1@
+
+    __defined at:__ @arrays\/array.h 62:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_1 :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr_1 =
+  BG.unsafePerformIO hs_bindgen_2d21b7cb9ac33ea8
+
+-- __unique:__ @test_arraysarray_Example_get_arr_2@
+foreign import ccall unsafe "hs_bindgen_df706ce2499e5073" hs_bindgen_df706ce2499e5073_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_2@
+hs_bindgen_df706ce2499e5073 :: IO (BG.Ptr Triplet)
+hs_bindgen_df706ce2499e5073 =
+  fmap BG.fromFFIType hs_bindgen_df706ce2499e5073_base
+
+{-# NOINLINE arr_2 #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @arr_2@
+
+    __defined at:__ @arrays\/array.h 65:16@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_2 :: BG.Ptr Triplet
+arr_2 =
+  BG.unsafePerformIO hs_bindgen_df706ce2499e5073
+
+-- __unique:__ @test_arraysarray_Example_get_arr_3@
+foreign import ccall unsafe "hs_bindgen_26bcbe886b94adfb" hs_bindgen_26bcbe886b94adfb_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_3@
+hs_bindgen_26bcbe886b94adfb :: IO (BG.Ptr (IA.IncompleteArray BG.CInt))
+hs_bindgen_26bcbe886b94adfb =
+  fmap BG.fromFFIType hs_bindgen_26bcbe886b94adfb_base
+
+{-# NOINLINE arr_3 #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @arr_3@
+
+    __defined at:__ @arrays\/array.h 68:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_3 :: BG.Ptr (IA.IncompleteArray BG.CInt)
+arr_3 =
+  BG.unsafePerformIO hs_bindgen_26bcbe886b94adfb
+
+-- __unique:__ @test_arraysarray_Example_get_arr_4@
+foreign import ccall unsafe "hs_bindgen_e4cef264a5cc1887" hs_bindgen_e4cef264a5cc1887_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_4@
+hs_bindgen_e4cef264a5cc1887 :: IO (BG.Ptr List)
+hs_bindgen_e4cef264a5cc1887 =
+  fmap BG.fromFFIType hs_bindgen_e4cef264a5cc1887_base
+
+{-# NOINLINE arr_4 #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @arr_4@
+
+    __defined at:__ @arrays\/array.h 71:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_4 :: BG.Ptr List
+arr_4 =
+  BG.unsafePerformIO hs_bindgen_e4cef264a5cc1887
+
+-- __unique:__ @test_arraysarray_Example_get_arr_5@
+foreign import ccall unsafe "hs_bindgen_a733c5b896a8ae4e" hs_bindgen_a733c5b896a8ae4e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_5@
+hs_bindgen_a733c5b896a8ae4e :: IO (BG.Ptr (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_a733c5b896a8ae4e =
+  fmap BG.fromFFIType hs_bindgen_a733c5b896a8ae4e_base
+
+{-# NOINLINE arr_5 #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @arr_5@
+
+    __defined at:__ @arrays\/array.h 74:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_5 :: BG.Ptr (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt))
+arr_5 =
+  BG.unsafePerformIO hs_bindgen_a733c5b896a8ae4e
+
+-- __unique:__ @test_arraysarray_Example_get_arr_6@
+foreign import ccall unsafe "hs_bindgen_525a326f0badae7c" hs_bindgen_525a326f0badae7c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_6@
+hs_bindgen_525a326f0badae7c :: IO (BG.Ptr Matrix)
+hs_bindgen_525a326f0badae7c =
+  fmap BG.fromFFIType hs_bindgen_525a326f0badae7c_base
+
+{-# NOINLINE arr_6 #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @arr_6@
+
+    __defined at:__ @arrays\/array.h 77:15@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_6 :: BG.Ptr Matrix
+arr_6 =
+  BG.unsafePerformIO hs_bindgen_525a326f0badae7c
+
+-- __unique:__ @test_arraysarray_Example_get_arr_7@
+foreign import ccall unsafe "hs_bindgen_b5e93d2d90ffc861" hs_bindgen_b5e93d2d90ffc861_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_7@
+hs_bindgen_b5e93d2d90ffc861 :: IO (BG.Ptr (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_b5e93d2d90ffc861 =
+  fmap BG.fromFFIType hs_bindgen_b5e93d2d90ffc861_base
+
+{-# NOINLINE arr_7 #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @arr_7@
+
+    __defined at:__ @arrays\/array.h 80:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_7 :: BG.Ptr (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt))
+arr_7 =
+  BG.unsafePerformIO hs_bindgen_b5e93d2d90ffc861
+
+-- __unique:__ @test_arraysarray_Example_get_arr_8@
+foreign import ccall unsafe "hs_bindgen_eb98aff4ee1d31d0" hs_bindgen_eb98aff4ee1d31d0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_8@
+hs_bindgen_eb98aff4ee1d31d0 :: IO (BG.Ptr Tripletlist)
+hs_bindgen_eb98aff4ee1d31d0 =
+  fmap BG.fromFFIType hs_bindgen_eb98aff4ee1d31d0_base
+
+{-# NOINLINE arr_8 #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @arr_8@
+
+    __defined at:__ @arrays\/array.h 83:20@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_8 :: BG.Ptr Tripletlist
+arr_8 =
+  BG.unsafePerformIO hs_bindgen_eb98aff4ee1d31d0
+
+-- __unique:__ @test_arraysarray_Example_get_arr_1_const@
+foreign import ccall unsafe "hs_bindgen_25089a5dd72254bc" hs_bindgen_25089a5dd72254bc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_1_const@
+hs_bindgen_25089a5dd72254bc :: IO (PtrConst.PtrConst (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_25089a5dd72254bc =
+  fmap BG.fromFFIType hs_bindgen_25089a5dd72254bc_base
+
+{-# NOINLINE hs_bindgen_a182a929fe06593d #-}
+{-| Array of known size.
+
+    __C declaration:__ @arr_1_const@
+
+    __defined at:__ @arrays\/array.h 90:18@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_1_const@
+-}
+hs_bindgen_a182a929fe06593d :: PtrConst.PtrConst (CA.ConstantArray 3 BG.CInt)
+hs_bindgen_a182a929fe06593d =
+  BG.unsafePerformIO hs_bindgen_25089a5dd72254bc
+
+{-# NOINLINE arr_1_const #-}
+arr_1_const :: CA.ConstantArray 3 BG.CInt
+arr_1_const =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_a182a929fe06593d)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_2_const@
+foreign import ccall unsafe "hs_bindgen_a55a5562a096ae11" hs_bindgen_a55a5562a096ae11_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_2_const@
+hs_bindgen_a55a5562a096ae11 :: IO (PtrConst.PtrConst Triplet)
+hs_bindgen_a55a5562a096ae11 =
+  fmap BG.fromFFIType hs_bindgen_a55a5562a096ae11_base
+
+{-# NOINLINE hs_bindgen_40c72338f5e41246 #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @arr_2_const@
+
+    __defined at:__ @arrays\/array.h 93:22@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_2_const@
+-}
+hs_bindgen_40c72338f5e41246 :: PtrConst.PtrConst Triplet
+hs_bindgen_40c72338f5e41246 =
+  BG.unsafePerformIO hs_bindgen_a55a5562a096ae11
+
+{-# NOINLINE arr_2_const #-}
+arr_2_const :: Triplet
+arr_2_const =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_40c72338f5e41246)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_3_const@
+foreign import ccall unsafe "hs_bindgen_fad31baeec544a6d" hs_bindgen_fad31baeec544a6d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_3_const@
+hs_bindgen_fad31baeec544a6d :: IO (PtrConst.PtrConst (IA.IncompleteArray BG.CInt))
+hs_bindgen_fad31baeec544a6d =
+  fmap BG.fromFFIType hs_bindgen_fad31baeec544a6d_base
+
+{-# NOINLINE arr_3_const #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @arr_3_const@
+
+    __defined at:__ @arrays\/array.h 96:18@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_3_const :: PtrConst.PtrConst (IA.IncompleteArray BG.CInt)
+arr_3_const =
+  BG.unsafePerformIO hs_bindgen_fad31baeec544a6d
+
+-- __unique:__ @test_arraysarray_Example_get_arr_4_const@
+foreign import ccall unsafe "hs_bindgen_890c46fc872e1d7d" hs_bindgen_890c46fc872e1d7d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_4_const@
+hs_bindgen_890c46fc872e1d7d :: IO (PtrConst.PtrConst List)
+hs_bindgen_890c46fc872e1d7d =
+  fmap BG.fromFFIType hs_bindgen_890c46fc872e1d7d_base
+
+{-# NOINLINE arr_4_const #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @arr_4_const@
+
+    __defined at:__ @arrays\/array.h 99:19@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_4_const :: PtrConst.PtrConst List
+arr_4_const =
+  BG.unsafePerformIO hs_bindgen_890c46fc872e1d7d
+
+-- __unique:__ @test_arraysarray_Example_get_arr_5_const@
+foreign import ccall unsafe "hs_bindgen_088c9ea4e73d1cfe" hs_bindgen_088c9ea4e73d1cfe_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_5_const@
+hs_bindgen_088c9ea4e73d1cfe :: IO (PtrConst.PtrConst (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_088c9ea4e73d1cfe =
+  fmap BG.fromFFIType hs_bindgen_088c9ea4e73d1cfe_base
+
+{-# NOINLINE hs_bindgen_be82907b3025ae62 #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @arr_5_const@
+
+    __defined at:__ @arrays\/array.h 102:18@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_5_const@
+-}
+hs_bindgen_be82907b3025ae62 :: PtrConst.PtrConst (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_be82907b3025ae62 =
+  BG.unsafePerformIO hs_bindgen_088c9ea4e73d1cfe
+
+{-# NOINLINE arr_5_const #-}
+arr_5_const :: CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)
+arr_5_const =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_be82907b3025ae62)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_6_const@
+foreign import ccall unsafe "hs_bindgen_bf69f287b3bf9fa4" hs_bindgen_bf69f287b3bf9fa4_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_6_const@
+hs_bindgen_bf69f287b3bf9fa4 :: IO (PtrConst.PtrConst Matrix)
+hs_bindgen_bf69f287b3bf9fa4 =
+  fmap BG.fromFFIType hs_bindgen_bf69f287b3bf9fa4_base
+
+{-# NOINLINE hs_bindgen_50556ee70fdb04aa #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @arr_6_const@
+
+    __defined at:__ @arrays\/array.h 105:21@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_6_const@
+-}
+hs_bindgen_50556ee70fdb04aa :: PtrConst.PtrConst Matrix
+hs_bindgen_50556ee70fdb04aa =
+  BG.unsafePerformIO hs_bindgen_bf69f287b3bf9fa4
+
+{-# NOINLINE arr_6_const #-}
+arr_6_const :: Matrix
+arr_6_const =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_50556ee70fdb04aa)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_7_const@
+foreign import ccall unsafe "hs_bindgen_2ca44942791eacc4" hs_bindgen_2ca44942791eacc4_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_7_const@
+hs_bindgen_2ca44942791eacc4 :: IO (PtrConst.PtrConst (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_2ca44942791eacc4 =
+  fmap BG.fromFFIType hs_bindgen_2ca44942791eacc4_base
+
+{-# NOINLINE arr_7_const #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @arr_7_const@
+
+    __defined at:__ @arrays\/array.h 108:18@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_7_const :: PtrConst.PtrConst (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt))
+arr_7_const =
+  BG.unsafePerformIO hs_bindgen_2ca44942791eacc4
+
+-- __unique:__ @test_arraysarray_Example_get_arr_8_const@
+foreign import ccall unsafe "hs_bindgen_3e95fdf3b641c349" hs_bindgen_3e95fdf3b641c349_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_get_arr_8_const@
+hs_bindgen_3e95fdf3b641c349 :: IO (PtrConst.PtrConst Tripletlist)
+hs_bindgen_3e95fdf3b641c349 =
+  fmap BG.fromFFIType hs_bindgen_3e95fdf3b641c349_base
+
+{-# NOINLINE arr_8_const #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @arr_8_const@
+
+    __defined at:__ @arrays\/array.h 111:26@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_8_const :: PtrConst.PtrConst Tripletlist
+arr_8_const =
+  BG.unsafePerformIO hs_bindgen_3e95fdf3b641c349
diff --git a/test-artefacts/fixtures/arrays/array/Example/Safe.hs b/test-artefacts/fixtures/arrays/array/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/array/Example/Safe.hs
@@ -0,0 +1,925 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun_1
+    , Example.Safe.fun_2
+    , Example.Safe.fun_3
+    , Example.Safe.fun_4
+    , Example.Safe.fun_5
+    , Example.Safe.fun_6
+    , Example.Safe.fun_7
+    , Example.Safe.fun_8
+    , Example.Safe.isSolved
+    , Example.Safe.fun_1_const
+    , Example.Safe.fun_2_const
+    , Example.Safe.fun_3_const
+    , Example.Safe.fun_4_const
+    , Example.Safe.fun_5_const
+    , Example.Safe.fun_6_const
+    , Example.Safe.fun_7_const
+    , Example.Safe.fun_8_const
+    , Example.Safe.isSolved_const
+    , Example.Safe.fun_9
+    , Example.Safe.fun_10
+    , Example.Safe.fun_11
+    , Example.Safe.fun_12
+    , Example.Safe.fun_13
+    , Example.Safe.fun_14
+    , Example.Safe.fun_15
+    , Example.Safe.fun_16
+    , Example.Safe.solve
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/array.h>"
+  , "signed int hs_bindgen_a836491d63ff3a2c ("
+  , "  signed int arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  return (fun_1)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_c69f41e5ccc441ab ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return (fun_2)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_30065ddbffdd7502 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return (fun_3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_6e8db8abcb5fe22a ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return (fun_4)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b2f48c31265a3f47 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_5)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_343fe8ca0dbb7eb1 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_6)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d98a58d39b578fd6 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_7)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4db12be6f46d98f5 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_8)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_825f9aeca071df21 ("
+  , "  triplet *arg1"
+  , ")"
+  , "{"
+  , "  return (isSolved)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_a2bf6bc667c9e769 ("
+  , "  signed int arg1,"
+  , "  signed int *arg2,"
+  , "  signed int const *arg3"
+  , ")"
+  , "{"
+  , "  return (fun_1_const)(arg1, arg2, arg3);"
+  , "}"
+  , "signed int hs_bindgen_ec5a6dd15a457a1d ("
+  , "  signed int *arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return (fun_2_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_84df1030280611db ("
+  , "  signed int *arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return (fun_3_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_e9dc927aa39d14d3 ("
+  , "  signed int *arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return (fun_4_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_cd0bfb26f385dfaa ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_5_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_1054ce6b48ed0f13 ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_6_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_496902d7c6466098 ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_7_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_eb65cb5074167c48 ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_8_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_9bb064e9eddf07f7 ("
+  , "  triplet *arg1,"
+  , "  triplet const *arg2"
+  , ")"
+  , "{"
+  , "  return (isSolved_const)(arg1, arg2);"
+  , "}"
+  , "signed int (*hs_bindgen_0fa0a3e47fa9d95a (void))[3]"
+  , "{"
+  , "  return (fun_9)();"
+  , "}"
+  , "triplet *hs_bindgen_e9d3d35727502125 (void)"
+  , "{"
+  , "  return (fun_10)();"
+  , "}"
+  , "signed int (*hs_bindgen_7f7cea54b33bf176 (void))[]"
+  , "{"
+  , "  return (fun_11)();"
+  , "}"
+  , "list *hs_bindgen_3124a96b00bbc082 (void)"
+  , "{"
+  , "  return (fun_12)();"
+  , "}"
+  , "signed int (*hs_bindgen_2fdd1bf9ee687f9b (void))[4][3]"
+  , "{"
+  , "  return (fun_13)();"
+  , "}"
+  , "matrix *hs_bindgen_12a242894a3d45cb (void)"
+  , "{"
+  , "  return (fun_14)();"
+  , "}"
+  , "signed int (*hs_bindgen_d8e176eb5efefa2c (void))[][3]"
+  , "{"
+  , "  return (fun_15)();"
+  , "}"
+  , "tripletlist *hs_bindgen_dcf234ca786626c7 (void)"
+  , "{"
+  , "  return (fun_16)();"
+  , "}"
+  , "sudoku *hs_bindgen_f80a5b6a2770c658 (void)"
+  , "{"
+  , "  return (solve)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1@
+foreign import ccall safe "hs_bindgen_a836491d63ff3a2c" hs_bindgen_a836491d63ff3a2c_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1@
+hs_bindgen_a836491d63ff3a2c ::
+     BG.CInt
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_a836491d63ff3a2c =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a836491d63ff3a2c_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Array of known size.
+
+    __C declaration:__ @fun_1@
+
+    __defined at:__ @arrays\/array.h 118:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @xs@
+  -> IO BG.CInt
+fun_1 = hs_bindgen_a836491d63ff3a2c
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2@
+foreign import ccall safe "hs_bindgen_c69f41e5ccc441ab" hs_bindgen_c69f41e5ccc441ab_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2@
+hs_bindgen_c69f41e5ccc441ab ::
+     BG.Ptr (IsA.Elem Triplet)
+  -> IO BG.CInt
+hs_bindgen_c69f41e5ccc441ab =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c69f41e5ccc441ab_base (BG.toFFIType x0))
+
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2@
+
+    __defined at:__ @arrays\/array.h 121:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2 ::
+     BG.Ptr (IsA.Elem Triplet)
+     -- ^ __C declaration:__ @xs@
+  -> IO BG.CInt
+fun_2 = hs_bindgen_c69f41e5ccc441ab
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3@
+foreign import ccall safe "hs_bindgen_30065ddbffdd7502" hs_bindgen_30065ddbffdd7502_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3@
+hs_bindgen_30065ddbffdd7502 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_30065ddbffdd7502 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_30065ddbffdd7502_base (BG.toFFIType x0))
+
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3@
+
+    __defined at:__ @arrays\/array.h 124:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @xs@
+  -> IO BG.CInt
+fun_3 = hs_bindgen_30065ddbffdd7502
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4@
+foreign import ccall safe "hs_bindgen_6e8db8abcb5fe22a" hs_bindgen_6e8db8abcb5fe22a_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4@
+hs_bindgen_6e8db8abcb5fe22a ::
+     BG.Ptr (IsA.Elem List)
+  -> IO BG.CInt
+hs_bindgen_6e8db8abcb5fe22a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6e8db8abcb5fe22a_base (BG.toFFIType x0))
+
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4@
+
+    __defined at:__ @arrays\/array.h 127:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4 ::
+     BG.Ptr (IsA.Elem List)
+     -- ^ __C declaration:__ @xs@
+  -> IO BG.CInt
+fun_4 = hs_bindgen_6e8db8abcb5fe22a
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5@
+foreign import ccall safe "hs_bindgen_b2f48c31265a3f47" hs_bindgen_b2f48c31265a3f47_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5@
+hs_bindgen_b2f48c31265a3f47 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_b2f48c31265a3f47 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b2f48c31265a3f47_base (BG.toFFIType x0))
+
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5@
+
+    __defined at:__ @arrays\/array.h 130:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+fun_5 = hs_bindgen_b2f48c31265a3f47
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6@
+foreign import ccall safe "hs_bindgen_343fe8ca0dbb7eb1" hs_bindgen_343fe8ca0dbb7eb1_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6@
+hs_bindgen_343fe8ca0dbb7eb1 ::
+     BG.Ptr (IsA.Elem Matrix)
+  -> IO BG.CInt
+hs_bindgen_343fe8ca0dbb7eb1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_343fe8ca0dbb7eb1_base (BG.toFFIType x0))
+
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6@
+
+    __defined at:__ @arrays\/array.h 133:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6 ::
+     BG.Ptr (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+fun_6 = hs_bindgen_343fe8ca0dbb7eb1
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7@
+foreign import ccall safe "hs_bindgen_d98a58d39b578fd6" hs_bindgen_d98a58d39b578fd6_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7@
+hs_bindgen_d98a58d39b578fd6 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_d98a58d39b578fd6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d98a58d39b578fd6_base (BG.toFFIType x0))
+
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7@
+
+    __defined at:__ @arrays\/array.h 136:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+fun_7 = hs_bindgen_d98a58d39b578fd6
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8@
+foreign import ccall safe "hs_bindgen_4db12be6f46d98f5" hs_bindgen_4db12be6f46d98f5_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8@
+hs_bindgen_4db12be6f46d98f5 ::
+     BG.Ptr (IsA.Elem Tripletlist)
+  -> IO BG.CInt
+hs_bindgen_4db12be6f46d98f5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4db12be6f46d98f5_base (BG.toFFIType x0))
+
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8@
+
+    __defined at:__ @arrays\/array.h 139:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8 ::
+     BG.Ptr (IsA.Elem Tripletlist)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+fun_8 = hs_bindgen_4db12be6f46d98f5
+
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved@
+foreign import ccall safe "hs_bindgen_825f9aeca071df21" hs_bindgen_825f9aeca071df21_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved@
+hs_bindgen_825f9aeca071df21 ::
+     BG.Ptr (IsA.Elem Sudoku)
+  -> IO BG.CInt
+hs_bindgen_825f9aeca071df21 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_825f9aeca071df21_base (BG.toFFIType x0))
+
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved@
+
+    __defined at:__ @arrays\/array.h 142:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved ::
+     BG.Ptr (IsA.Elem Sudoku)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+isSolved = hs_bindgen_825f9aeca071df21
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1_const@
+foreign import ccall safe "hs_bindgen_a2bf6bc667c9e769" hs_bindgen_a2bf6bc667c9e769_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1_const@
+hs_bindgen_a2bf6bc667c9e769 ::
+     BG.CInt
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_a2bf6bc667c9e769 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a2bf6bc667c9e769_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Array of known size.
+
+    __C declaration:__ @fun_1_const@
+
+    __defined at:__ @arrays\/array.h 149:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_const ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @xs@
+  -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @ys@
+  -> IO BG.CInt
+fun_1_const = hs_bindgen_a2bf6bc667c9e769
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2_const@
+foreign import ccall safe "hs_bindgen_ec5a6dd15a457a1d" hs_bindgen_ec5a6dd15a457a1d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2_const@
+hs_bindgen_ec5a6dd15a457a1d ::
+     BG.Ptr (IsA.Elem Triplet)
+  -> PtrConst.PtrConst (IsA.Elem Triplet)
+  -> IO BG.CInt
+hs_bindgen_ec5a6dd15a457a1d =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ec5a6dd15a457a1d_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2_const@
+
+    __defined at:__ @arrays\/array.h 152:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_const ::
+     BG.Ptr (IsA.Elem Triplet)
+     -- ^ __C declaration:__ @xs@
+  -> PtrConst.PtrConst (IsA.Elem Triplet)
+     -- ^ __C declaration:__ @ys@
+  -> IO BG.CInt
+fun_2_const = hs_bindgen_ec5a6dd15a457a1d
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3_const@
+foreign import ccall safe "hs_bindgen_84df1030280611db" hs_bindgen_84df1030280611db_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3_const@
+hs_bindgen_84df1030280611db ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_84df1030280611db =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_84df1030280611db_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3_const@
+
+    __defined at:__ @arrays\/array.h 155:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_const ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @xs@
+  -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @ys@
+  -> IO BG.CInt
+fun_3_const = hs_bindgen_84df1030280611db
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4_const@
+foreign import ccall safe "hs_bindgen_e9dc927aa39d14d3" hs_bindgen_e9dc927aa39d14d3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4_const@
+hs_bindgen_e9dc927aa39d14d3 ::
+     BG.Ptr (IsA.Elem List)
+  -> PtrConst.PtrConst (IsA.Elem List)
+  -> IO BG.CInt
+hs_bindgen_e9dc927aa39d14d3 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_e9dc927aa39d14d3_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4_const@
+
+    __defined at:__ @arrays\/array.h 158:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_const ::
+     BG.Ptr (IsA.Elem List)
+     -- ^ __C declaration:__ @xs@
+  -> PtrConst.PtrConst (IsA.Elem List)
+     -- ^ __C declaration:__ @ys@
+  -> IO BG.CInt
+fun_4_const = hs_bindgen_e9dc927aa39d14d3
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5_const@
+foreign import ccall safe "hs_bindgen_cd0bfb26f385dfaa" hs_bindgen_cd0bfb26f385dfaa_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5_const@
+hs_bindgen_cd0bfb26f385dfaa ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+  -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_cd0bfb26f385dfaa =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_cd0bfb26f385dfaa_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5_const@
+
+    __defined at:__ @arrays\/array.h 161:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_const ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+fun_5_const = hs_bindgen_cd0bfb26f385dfaa
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6_const@
+foreign import ccall safe "hs_bindgen_1054ce6b48ed0f13" hs_bindgen_1054ce6b48ed0f13_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6_const@
+hs_bindgen_1054ce6b48ed0f13 ::
+     BG.Ptr (IsA.Elem Matrix)
+  -> PtrConst.PtrConst (IsA.Elem Matrix)
+  -> IO BG.CInt
+hs_bindgen_1054ce6b48ed0f13 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_1054ce6b48ed0f13_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6_const@
+
+    __defined at:__ @arrays\/array.h 164:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_const ::
+     BG.Ptr (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+fun_6_const = hs_bindgen_1054ce6b48ed0f13
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7_const@
+foreign import ccall safe "hs_bindgen_496902d7c6466098" hs_bindgen_496902d7c6466098_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7_const@
+hs_bindgen_496902d7c6466098 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+  -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_496902d7c6466098 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_496902d7c6466098_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7_const@
+
+    __defined at:__ @arrays\/array.h 167:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_const ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+fun_7_const = hs_bindgen_496902d7c6466098
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8_const@
+foreign import ccall safe "hs_bindgen_eb65cb5074167c48" hs_bindgen_eb65cb5074167c48_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8_const@
+hs_bindgen_eb65cb5074167c48 ::
+     BG.Ptr (IsA.Elem Tripletlist)
+  -> PtrConst.PtrConst (IsA.Elem Tripletlist)
+  -> IO BG.CInt
+hs_bindgen_eb65cb5074167c48 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_eb65cb5074167c48_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8_const@
+
+    __defined at:__ @arrays\/array.h 170:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_const ::
+     BG.Ptr (IsA.Elem Tripletlist)
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem Tripletlist)
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+fun_8_const = hs_bindgen_eb65cb5074167c48
+
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved_const@
+foreign import ccall safe "hs_bindgen_9bb064e9eddf07f7" hs_bindgen_9bb064e9eddf07f7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved_const@
+hs_bindgen_9bb064e9eddf07f7 ::
+     BG.Ptr (IsA.Elem Sudoku)
+  -> PtrConst.PtrConst (IsA.Elem Sudoku)
+  -> IO BG.CInt
+hs_bindgen_9bb064e9eddf07f7 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_9bb064e9eddf07f7_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved_const@
+
+    __defined at:__ @arrays\/array.h 173:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_const ::
+     BG.Ptr (IsA.Elem Sudoku)
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem Sudoku)
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+isSolved_const = hs_bindgen_9bb064e9eddf07f7
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_9@
+foreign import ccall safe "hs_bindgen_0fa0a3e47fa9d95a" hs_bindgen_0fa0a3e47fa9d95a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_9@
+hs_bindgen_0fa0a3e47fa9d95a :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_0fa0a3e47fa9d95a =
+  fmap BG.fromFFIType hs_bindgen_0fa0a3e47fa9d95a_base
+
+{-| Array of known size.
+
+    __C declaration:__ @fun_9@
+
+    __defined at:__ @arrays\/array.h 185:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_9 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+fun_9 = hs_bindgen_0fa0a3e47fa9d95a
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_10@
+foreign import ccall safe "hs_bindgen_e9d3d35727502125" hs_bindgen_e9d3d35727502125_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_10@
+hs_bindgen_e9d3d35727502125 :: IO (BG.Ptr Triplet)
+hs_bindgen_e9d3d35727502125 =
+  fmap BG.fromFFIType hs_bindgen_e9d3d35727502125_base
+
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_10@
+
+    __defined at:__ @arrays\/array.h 188:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_10 :: IO (BG.Ptr Triplet)
+fun_10 = hs_bindgen_e9d3d35727502125
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_11@
+foreign import ccall safe "hs_bindgen_7f7cea54b33bf176" hs_bindgen_7f7cea54b33bf176_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_11@
+hs_bindgen_7f7cea54b33bf176 :: IO (BG.Ptr (IA.IncompleteArray BG.CInt))
+hs_bindgen_7f7cea54b33bf176 =
+  fmap BG.fromFFIType hs_bindgen_7f7cea54b33bf176_base
+
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_11@
+
+    __defined at:__ @arrays\/array.h 191:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_11 :: IO (BG.Ptr (IA.IncompleteArray BG.CInt))
+fun_11 = hs_bindgen_7f7cea54b33bf176
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_12@
+foreign import ccall safe "hs_bindgen_3124a96b00bbc082" hs_bindgen_3124a96b00bbc082_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_12@
+hs_bindgen_3124a96b00bbc082 :: IO (BG.Ptr List)
+hs_bindgen_3124a96b00bbc082 =
+  fmap BG.fromFFIType hs_bindgen_3124a96b00bbc082_base
+
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_12@
+
+    __defined at:__ @arrays\/array.h 194:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_12 :: IO (BG.Ptr List)
+fun_12 = hs_bindgen_3124a96b00bbc082
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_13@
+foreign import ccall safe "hs_bindgen_2fdd1bf9ee687f9b" hs_bindgen_2fdd1bf9ee687f9b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_13@
+hs_bindgen_2fdd1bf9ee687f9b :: IO (BG.Ptr (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_2fdd1bf9ee687f9b =
+  fmap BG.fromFFIType hs_bindgen_2fdd1bf9ee687f9b_base
+
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_13@
+
+    __defined at:__ @arrays\/array.h 197:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_13 :: IO (BG.Ptr (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+fun_13 = hs_bindgen_2fdd1bf9ee687f9b
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_14@
+foreign import ccall safe "hs_bindgen_12a242894a3d45cb" hs_bindgen_12a242894a3d45cb_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_14@
+hs_bindgen_12a242894a3d45cb :: IO (BG.Ptr Matrix)
+hs_bindgen_12a242894a3d45cb =
+  fmap BG.fromFFIType hs_bindgen_12a242894a3d45cb_base
+
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_14@
+
+    __defined at:__ @arrays\/array.h 200:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_14 :: IO (BG.Ptr Matrix)
+fun_14 = hs_bindgen_12a242894a3d45cb
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_15@
+foreign import ccall safe "hs_bindgen_d8e176eb5efefa2c" hs_bindgen_d8e176eb5efefa2c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_15@
+hs_bindgen_d8e176eb5efefa2c :: IO (BG.Ptr (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_d8e176eb5efefa2c =
+  fmap BG.fromFFIType hs_bindgen_d8e176eb5efefa2c_base
+
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_15@
+
+    __defined at:__ @arrays\/array.h 203:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_15 :: IO (BG.Ptr (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+fun_15 = hs_bindgen_d8e176eb5efefa2c
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_16@
+foreign import ccall safe "hs_bindgen_dcf234ca786626c7" hs_bindgen_dcf234ca786626c7_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Safe_fun_16@
+hs_bindgen_dcf234ca786626c7 :: IO (BG.Ptr Tripletlist)
+hs_bindgen_dcf234ca786626c7 =
+  fmap BG.fromFFIType hs_bindgen_dcf234ca786626c7_base
+
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_16@
+
+    __defined at:__ @arrays\/array.h 206:14@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_16 :: IO (BG.Ptr Tripletlist)
+fun_16 = hs_bindgen_dcf234ca786626c7
+
+-- __unique:__ @test_arraysarray_Example_Safe_solve@
+foreign import ccall safe "hs_bindgen_f80a5b6a2770c658" hs_bindgen_f80a5b6a2770c658_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Safe_solve@
+hs_bindgen_f80a5b6a2770c658 :: IO (BG.Ptr Sudoku)
+hs_bindgen_f80a5b6a2770c658 =
+  fmap BG.fromFFIType hs_bindgen_f80a5b6a2770c658_base
+
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @solve@
+
+    __defined at:__ @arrays\/array.h 209:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+solve :: IO (BG.Ptr Sudoku)
+solve = hs_bindgen_f80a5b6a2770c658
diff --git a/test-artefacts/fixtures/arrays/array/Example/Unsafe.hs b/test-artefacts/fixtures/arrays/array/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/array/Example/Unsafe.hs
@@ -0,0 +1,925 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun_1
+    , Example.Unsafe.fun_2
+    , Example.Unsafe.fun_3
+    , Example.Unsafe.fun_4
+    , Example.Unsafe.fun_5
+    , Example.Unsafe.fun_6
+    , Example.Unsafe.fun_7
+    , Example.Unsafe.fun_8
+    , Example.Unsafe.isSolved
+    , Example.Unsafe.fun_1_const
+    , Example.Unsafe.fun_2_const
+    , Example.Unsafe.fun_3_const
+    , Example.Unsafe.fun_4_const
+    , Example.Unsafe.fun_5_const
+    , Example.Unsafe.fun_6_const
+    , Example.Unsafe.fun_7_const
+    , Example.Unsafe.fun_8_const
+    , Example.Unsafe.isSolved_const
+    , Example.Unsafe.fun_9
+    , Example.Unsafe.fun_10
+    , Example.Unsafe.fun_11
+    , Example.Unsafe.fun_12
+    , Example.Unsafe.fun_13
+    , Example.Unsafe.fun_14
+    , Example.Unsafe.fun_15
+    , Example.Unsafe.fun_16
+    , Example.Unsafe.solve
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/array.h>"
+  , "signed int hs_bindgen_6d07a0b03f884547 ("
+  , "  signed int arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  return (fun_1)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_04318f98a3ab8d08 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return (fun_2)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_2a7c5fa1040fa8db ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return (fun_3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_810acc5cf8729d0e ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return (fun_4)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_83b71f7defb3b27a ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_5)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_62b76af3dc65da3f ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_6)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_100aa7fb87a5ea74 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_7)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_cd6646babeacd609 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_8)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_560f1de9a83c3a6a ("
+  , "  triplet *arg1"
+  , ")"
+  , "{"
+  , "  return (isSolved)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_ef3b85ae74bc06cf ("
+  , "  signed int arg1,"
+  , "  signed int *arg2,"
+  , "  signed int const *arg3"
+  , ")"
+  , "{"
+  , "  return (fun_1_const)(arg1, arg2, arg3);"
+  , "}"
+  , "signed int hs_bindgen_1c913685e5e76952 ("
+  , "  signed int *arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return (fun_2_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_eb8daf22bd5c6f00 ("
+  , "  signed int *arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return (fun_3_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_0b73e4c7695a3b2f ("
+  , "  signed int *arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return (fun_4_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_374feb8086895fe3 ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_5_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_2d1320b468c36708 ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_6_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_f67f5fe5bfb57aa1 ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_7_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_2c9356851d76320e ("
+  , "  signed int (*arg1)[3],"
+  , "  signed int const (*arg2)[3]"
+  , ")"
+  , "{"
+  , "  return (fun_8_const)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_39b08b64fed0c5b8 ("
+  , "  triplet *arg1,"
+  , "  triplet const *arg2"
+  , ")"
+  , "{"
+  , "  return (isSolved_const)(arg1, arg2);"
+  , "}"
+  , "signed int (*hs_bindgen_ab431ebc0519545a (void))[3]"
+  , "{"
+  , "  return (fun_9)();"
+  , "}"
+  , "triplet *hs_bindgen_c9ff623e6f48d3bc (void)"
+  , "{"
+  , "  return (fun_10)();"
+  , "}"
+  , "signed int (*hs_bindgen_e714f0b7c764ba17 (void))[]"
+  , "{"
+  , "  return (fun_11)();"
+  , "}"
+  , "list *hs_bindgen_cc23741700ba18f7 (void)"
+  , "{"
+  , "  return (fun_12)();"
+  , "}"
+  , "signed int (*hs_bindgen_eb3a1364003829ac (void))[4][3]"
+  , "{"
+  , "  return (fun_13)();"
+  , "}"
+  , "matrix *hs_bindgen_0f49ffbe2c13ab46 (void)"
+  , "{"
+  , "  return (fun_14)();"
+  , "}"
+  , "signed int (*hs_bindgen_59de769fbba4ed72 (void))[][3]"
+  , "{"
+  , "  return (fun_15)();"
+  , "}"
+  , "tripletlist *hs_bindgen_1d6ecccfa4ee16ff (void)"
+  , "{"
+  , "  return (fun_16)();"
+  , "}"
+  , "sudoku *hs_bindgen_6165085eab7d2806 (void)"
+  , "{"
+  , "  return (solve)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1@
+foreign import ccall unsafe "hs_bindgen_6d07a0b03f884547" hs_bindgen_6d07a0b03f884547_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1@
+hs_bindgen_6d07a0b03f884547 ::
+     BG.CInt
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_6d07a0b03f884547 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6d07a0b03f884547_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Array of known size.
+
+    __C declaration:__ @fun_1@
+
+    __defined at:__ @arrays\/array.h 118:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @xs@
+  -> IO BG.CInt
+fun_1 = hs_bindgen_6d07a0b03f884547
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2@
+foreign import ccall unsafe "hs_bindgen_04318f98a3ab8d08" hs_bindgen_04318f98a3ab8d08_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2@
+hs_bindgen_04318f98a3ab8d08 ::
+     BG.Ptr (IsA.Elem Triplet)
+  -> IO BG.CInt
+hs_bindgen_04318f98a3ab8d08 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_04318f98a3ab8d08_base (BG.toFFIType x0))
+
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2@
+
+    __defined at:__ @arrays\/array.h 121:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2 ::
+     BG.Ptr (IsA.Elem Triplet)
+     -- ^ __C declaration:__ @xs@
+  -> IO BG.CInt
+fun_2 = hs_bindgen_04318f98a3ab8d08
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3@
+foreign import ccall unsafe "hs_bindgen_2a7c5fa1040fa8db" hs_bindgen_2a7c5fa1040fa8db_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3@
+hs_bindgen_2a7c5fa1040fa8db ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_2a7c5fa1040fa8db =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2a7c5fa1040fa8db_base (BG.toFFIType x0))
+
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3@
+
+    __defined at:__ @arrays\/array.h 124:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @xs@
+  -> IO BG.CInt
+fun_3 = hs_bindgen_2a7c5fa1040fa8db
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4@
+foreign import ccall unsafe "hs_bindgen_810acc5cf8729d0e" hs_bindgen_810acc5cf8729d0e_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4@
+hs_bindgen_810acc5cf8729d0e ::
+     BG.Ptr (IsA.Elem List)
+  -> IO BG.CInt
+hs_bindgen_810acc5cf8729d0e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_810acc5cf8729d0e_base (BG.toFFIType x0))
+
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4@
+
+    __defined at:__ @arrays\/array.h 127:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4 ::
+     BG.Ptr (IsA.Elem List)
+     -- ^ __C declaration:__ @xs@
+  -> IO BG.CInt
+fun_4 = hs_bindgen_810acc5cf8729d0e
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5@
+foreign import ccall unsafe "hs_bindgen_83b71f7defb3b27a" hs_bindgen_83b71f7defb3b27a_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5@
+hs_bindgen_83b71f7defb3b27a ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_83b71f7defb3b27a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_83b71f7defb3b27a_base (BG.toFFIType x0))
+
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5@
+
+    __defined at:__ @arrays\/array.h 130:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+fun_5 = hs_bindgen_83b71f7defb3b27a
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6@
+foreign import ccall unsafe "hs_bindgen_62b76af3dc65da3f" hs_bindgen_62b76af3dc65da3f_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6@
+hs_bindgen_62b76af3dc65da3f ::
+     BG.Ptr (IsA.Elem Matrix)
+  -> IO BG.CInt
+hs_bindgen_62b76af3dc65da3f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_62b76af3dc65da3f_base (BG.toFFIType x0))
+
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6@
+
+    __defined at:__ @arrays\/array.h 133:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6 ::
+     BG.Ptr (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+fun_6 = hs_bindgen_62b76af3dc65da3f
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7@
+foreign import ccall unsafe "hs_bindgen_100aa7fb87a5ea74" hs_bindgen_100aa7fb87a5ea74_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7@
+hs_bindgen_100aa7fb87a5ea74 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_100aa7fb87a5ea74 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_100aa7fb87a5ea74_base (BG.toFFIType x0))
+
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7@
+
+    __defined at:__ @arrays\/array.h 136:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+fun_7 = hs_bindgen_100aa7fb87a5ea74
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8@
+foreign import ccall unsafe "hs_bindgen_cd6646babeacd609" hs_bindgen_cd6646babeacd609_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8@
+hs_bindgen_cd6646babeacd609 ::
+     BG.Ptr (IsA.Elem Tripletlist)
+  -> IO BG.CInt
+hs_bindgen_cd6646babeacd609 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cd6646babeacd609_base (BG.toFFIType x0))
+
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8@
+
+    __defined at:__ @arrays\/array.h 139:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8 ::
+     BG.Ptr (IsA.Elem Tripletlist)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+fun_8 = hs_bindgen_cd6646babeacd609
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved@
+foreign import ccall unsafe "hs_bindgen_560f1de9a83c3a6a" hs_bindgen_560f1de9a83c3a6a_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved@
+hs_bindgen_560f1de9a83c3a6a ::
+     BG.Ptr (IsA.Elem Sudoku)
+  -> IO BG.CInt
+hs_bindgen_560f1de9a83c3a6a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_560f1de9a83c3a6a_base (BG.toFFIType x0))
+
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved@
+
+    __defined at:__ @arrays\/array.h 142:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved ::
+     BG.Ptr (IsA.Elem Sudoku)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+isSolved = hs_bindgen_560f1de9a83c3a6a
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1_const@
+foreign import ccall unsafe "hs_bindgen_ef3b85ae74bc06cf" hs_bindgen_ef3b85ae74bc06cf_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1_const@
+hs_bindgen_ef3b85ae74bc06cf ::
+     BG.CInt
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_ef3b85ae74bc06cf =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_ef3b85ae74bc06cf_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Array of known size.
+
+    __C declaration:__ @fun_1_const@
+
+    __defined at:__ @arrays\/array.h 149:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_const ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @xs@
+  -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @ys@
+  -> IO BG.CInt
+fun_1_const = hs_bindgen_ef3b85ae74bc06cf
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2_const@
+foreign import ccall unsafe "hs_bindgen_1c913685e5e76952" hs_bindgen_1c913685e5e76952_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2_const@
+hs_bindgen_1c913685e5e76952 ::
+     BG.Ptr (IsA.Elem Triplet)
+  -> PtrConst.PtrConst (IsA.Elem Triplet)
+  -> IO BG.CInt
+hs_bindgen_1c913685e5e76952 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_1c913685e5e76952_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2_const@
+
+    __defined at:__ @arrays\/array.h 152:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_const ::
+     BG.Ptr (IsA.Elem Triplet)
+     -- ^ __C declaration:__ @xs@
+  -> PtrConst.PtrConst (IsA.Elem Triplet)
+     -- ^ __C declaration:__ @ys@
+  -> IO BG.CInt
+fun_2_const = hs_bindgen_1c913685e5e76952
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3_const@
+foreign import ccall unsafe "hs_bindgen_eb8daf22bd5c6f00" hs_bindgen_eb8daf22bd5c6f00_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3_const@
+hs_bindgen_eb8daf22bd5c6f00 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_eb8daf22bd5c6f00 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_eb8daf22bd5c6f00_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3_const@
+
+    __defined at:__ @arrays\/array.h 155:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_const ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @xs@
+  -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @ys@
+  -> IO BG.CInt
+fun_3_const = hs_bindgen_eb8daf22bd5c6f00
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4_const@
+foreign import ccall unsafe "hs_bindgen_0b73e4c7695a3b2f" hs_bindgen_0b73e4c7695a3b2f_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4_const@
+hs_bindgen_0b73e4c7695a3b2f ::
+     BG.Ptr (IsA.Elem List)
+  -> PtrConst.PtrConst (IsA.Elem List)
+  -> IO BG.CInt
+hs_bindgen_0b73e4c7695a3b2f =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0b73e4c7695a3b2f_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4_const@
+
+    __defined at:__ @arrays\/array.h 158:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_const ::
+     BG.Ptr (IsA.Elem List)
+     -- ^ __C declaration:__ @xs@
+  -> PtrConst.PtrConst (IsA.Elem List)
+     -- ^ __C declaration:__ @ys@
+  -> IO BG.CInt
+fun_4_const = hs_bindgen_0b73e4c7695a3b2f
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5_const@
+foreign import ccall unsafe "hs_bindgen_374feb8086895fe3" hs_bindgen_374feb8086895fe3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5_const@
+hs_bindgen_374feb8086895fe3 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+  -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_374feb8086895fe3 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_374feb8086895fe3_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5_const@
+
+    __defined at:__ @arrays\/array.h 161:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_const ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+fun_5_const = hs_bindgen_374feb8086895fe3
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6_const@
+foreign import ccall unsafe "hs_bindgen_2d1320b468c36708" hs_bindgen_2d1320b468c36708_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6_const@
+hs_bindgen_2d1320b468c36708 ::
+     BG.Ptr (IsA.Elem Matrix)
+  -> PtrConst.PtrConst (IsA.Elem Matrix)
+  -> IO BG.CInt
+hs_bindgen_2d1320b468c36708 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_2d1320b468c36708_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6_const@
+
+    __defined at:__ @arrays\/array.h 164:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_const ::
+     BG.Ptr (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+fun_6_const = hs_bindgen_2d1320b468c36708
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7_const@
+foreign import ccall unsafe "hs_bindgen_f67f5fe5bfb57aa1" hs_bindgen_f67f5fe5bfb57aa1_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7_const@
+hs_bindgen_f67f5fe5bfb57aa1 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+  -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_f67f5fe5bfb57aa1 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_f67f5fe5bfb57aa1_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7_const@
+
+    __defined at:__ @arrays\/array.h 167:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_const ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+fun_7_const = hs_bindgen_f67f5fe5bfb57aa1
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8_const@
+foreign import ccall unsafe "hs_bindgen_2c9356851d76320e" hs_bindgen_2c9356851d76320e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8_const@
+hs_bindgen_2c9356851d76320e ::
+     BG.Ptr (IsA.Elem Tripletlist)
+  -> PtrConst.PtrConst (IsA.Elem Tripletlist)
+  -> IO BG.CInt
+hs_bindgen_2c9356851d76320e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_2c9356851d76320e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8_const@
+
+    __defined at:__ @arrays\/array.h 170:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_const ::
+     BG.Ptr (IsA.Elem Tripletlist)
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem Tripletlist)
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+fun_8_const = hs_bindgen_2c9356851d76320e
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved_const@
+foreign import ccall unsafe "hs_bindgen_39b08b64fed0c5b8" hs_bindgen_39b08b64fed0c5b8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved_const@
+hs_bindgen_39b08b64fed0c5b8 ::
+     BG.Ptr (IsA.Elem Sudoku)
+  -> PtrConst.PtrConst (IsA.Elem Sudoku)
+  -> IO BG.CInt
+hs_bindgen_39b08b64fed0c5b8 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_39b08b64fed0c5b8_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved_const@
+
+    __defined at:__ @arrays\/array.h 173:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_const ::
+     BG.Ptr (IsA.Elem Sudoku)
+     -- ^ __C declaration:__ @xss@
+  -> PtrConst.PtrConst (IsA.Elem Sudoku)
+     -- ^ __C declaration:__ @yss@
+  -> IO BG.CInt
+isSolved_const = hs_bindgen_39b08b64fed0c5b8
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_9@
+foreign import ccall unsafe "hs_bindgen_ab431ebc0519545a" hs_bindgen_ab431ebc0519545a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_9@
+hs_bindgen_ab431ebc0519545a :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_ab431ebc0519545a =
+  fmap BG.fromFFIType hs_bindgen_ab431ebc0519545a_base
+
+{-| Array of known size.
+
+    __C declaration:__ @fun_9@
+
+    __defined at:__ @arrays\/array.h 185:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_9 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+fun_9 = hs_bindgen_ab431ebc0519545a
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_10@
+foreign import ccall unsafe "hs_bindgen_c9ff623e6f48d3bc" hs_bindgen_c9ff623e6f48d3bc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_10@
+hs_bindgen_c9ff623e6f48d3bc :: IO (BG.Ptr Triplet)
+hs_bindgen_c9ff623e6f48d3bc =
+  fmap BG.fromFFIType hs_bindgen_c9ff623e6f48d3bc_base
+
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_10@
+
+    __defined at:__ @arrays\/array.h 188:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_10 :: IO (BG.Ptr Triplet)
+fun_10 = hs_bindgen_c9ff623e6f48d3bc
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_11@
+foreign import ccall unsafe "hs_bindgen_e714f0b7c764ba17" hs_bindgen_e714f0b7c764ba17_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_11@
+hs_bindgen_e714f0b7c764ba17 :: IO (BG.Ptr (IA.IncompleteArray BG.CInt))
+hs_bindgen_e714f0b7c764ba17 =
+  fmap BG.fromFFIType hs_bindgen_e714f0b7c764ba17_base
+
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_11@
+
+    __defined at:__ @arrays\/array.h 191:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_11 :: IO (BG.Ptr (IA.IncompleteArray BG.CInt))
+fun_11 = hs_bindgen_e714f0b7c764ba17
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_12@
+foreign import ccall unsafe "hs_bindgen_cc23741700ba18f7" hs_bindgen_cc23741700ba18f7_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_12@
+hs_bindgen_cc23741700ba18f7 :: IO (BG.Ptr List)
+hs_bindgen_cc23741700ba18f7 =
+  fmap BG.fromFFIType hs_bindgen_cc23741700ba18f7_base
+
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_12@
+
+    __defined at:__ @arrays\/array.h 194:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_12 :: IO (BG.Ptr List)
+fun_12 = hs_bindgen_cc23741700ba18f7
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_13@
+foreign import ccall unsafe "hs_bindgen_eb3a1364003829ac" hs_bindgen_eb3a1364003829ac_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_13@
+hs_bindgen_eb3a1364003829ac :: IO (BG.Ptr (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_eb3a1364003829ac =
+  fmap BG.fromFFIType hs_bindgen_eb3a1364003829ac_base
+
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_13@
+
+    __defined at:__ @arrays\/array.h 197:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_13 :: IO (BG.Ptr (CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)))
+fun_13 = hs_bindgen_eb3a1364003829ac
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_14@
+foreign import ccall unsafe "hs_bindgen_0f49ffbe2c13ab46" hs_bindgen_0f49ffbe2c13ab46_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_14@
+hs_bindgen_0f49ffbe2c13ab46 :: IO (BG.Ptr Matrix)
+hs_bindgen_0f49ffbe2c13ab46 =
+  fmap BG.fromFFIType hs_bindgen_0f49ffbe2c13ab46_base
+
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_14@
+
+    __defined at:__ @arrays\/array.h 200:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_14 :: IO (BG.Ptr Matrix)
+fun_14 = hs_bindgen_0f49ffbe2c13ab46
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_15@
+foreign import ccall unsafe "hs_bindgen_59de769fbba4ed72" hs_bindgen_59de769fbba4ed72_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_15@
+hs_bindgen_59de769fbba4ed72 :: IO (BG.Ptr (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_59de769fbba4ed72 =
+  fmap BG.fromFFIType hs_bindgen_59de769fbba4ed72_base
+
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_15@
+
+    __defined at:__ @arrays\/array.h 203:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_15 :: IO (BG.Ptr (IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)))
+fun_15 = hs_bindgen_59de769fbba4ed72
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_16@
+foreign import ccall unsafe "hs_bindgen_1d6ecccfa4ee16ff" hs_bindgen_1d6ecccfa4ee16ff_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_16@
+hs_bindgen_1d6ecccfa4ee16ff :: IO (BG.Ptr Tripletlist)
+hs_bindgen_1d6ecccfa4ee16ff =
+  fmap BG.fromFFIType hs_bindgen_1d6ecccfa4ee16ff_base
+
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_16@
+
+    __defined at:__ @arrays\/array.h 206:14@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_16 :: IO (BG.Ptr Tripletlist)
+fun_16 = hs_bindgen_1d6ecccfa4ee16ff
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_solve@
+foreign import ccall unsafe "hs_bindgen_6165085eab7d2806" hs_bindgen_6165085eab7d2806_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_arraysarray_Example_Unsafe_solve@
+hs_bindgen_6165085eab7d2806 :: IO (BG.Ptr Sudoku)
+hs_bindgen_6165085eab7d2806 =
+  fmap BG.fromFFIType hs_bindgen_6165085eab7d2806_base
+
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @solve@
+
+    __defined at:__ @arrays\/array.h 209:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+solve :: IO (BG.Ptr Sudoku)
+solve = hs_bindgen_6165085eab7d2806
diff --git a/test-artefacts/fixtures/arrays/array/bindingspec.yaml b/test-artefacts/fixtures/arrays/array/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/array/bindingspec.yaml
@@ -0,0 +1,131 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: arrays/array.h
+  cname: triplet
+  hsname: Triplet
+- headers: arrays/array.h
+  cname: list
+  hsname: List
+- headers: arrays/array.h
+  cname: matrix
+  hsname: Matrix
+- headers: arrays/array.h
+  cname: tripletlist
+  hsname: Tripletlist
+- headers: arrays/array.h
+  cname: struct Example
+  hsname: Example
+- headers: arrays/array.h
+  cname: sudoku
+  hsname: Sudoku
+hstypes:
+- hsname: Example
+  representation:
+    record:
+      constructor: Example
+      fields:
+      - example_triple
+      - example_sudoku
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: List
+  representation:
+    newtype:
+      constructor: List
+      fields:
+      - unwrapList
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: Matrix
+  representation:
+    newtype:
+      constructor: Matrix
+      fields:
+      - unwrapMatrix
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Sudoku
+  representation:
+    newtype:
+      constructor: Sudoku
+      fields:
+      - unwrapSudoku
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Triplet
+  representation:
+    newtype:
+      constructor: Triplet
+      fields:
+      - unwrapTriplet
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Tripletlist
+  representation:
+    newtype:
+      constructor: Tripletlist
+      fields:
+      - unwrapTripletlist
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
diff --git a/test-artefacts/fixtures/arrays/array/th.txt b/test-artefacts/fixtures/arrays/array/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/array/th.txt
@@ -0,0 +1,3753 @@
+-- addDependentFile test-artefacts/headers/golden/arrays/array.h
+-- #include <arrays/array.h>
+-- signed int hs_bindgen_a836491d63ff3a2c (
+--   signed int arg1,
+--   signed int *arg2
+-- )
+-- {
+--   return (fun_1)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_c69f41e5ccc441ab (
+--   signed int *arg1
+-- )
+-- {
+--   return (fun_2)(arg1);
+-- }
+-- signed int hs_bindgen_30065ddbffdd7502 (
+--   signed int *arg1
+-- )
+-- {
+--   return (fun_3)(arg1);
+-- }
+-- signed int hs_bindgen_6e8db8abcb5fe22a (
+--   signed int *arg1
+-- )
+-- {
+--   return (fun_4)(arg1);
+-- }
+-- signed int hs_bindgen_b2f48c31265a3f47 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (fun_5)(arg1);
+-- }
+-- signed int hs_bindgen_343fe8ca0dbb7eb1 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (fun_6)(arg1);
+-- }
+-- signed int hs_bindgen_d98a58d39b578fd6 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (fun_7)(arg1);
+-- }
+-- signed int hs_bindgen_4db12be6f46d98f5 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (fun_8)(arg1);
+-- }
+-- signed int hs_bindgen_825f9aeca071df21 (
+--   triplet *arg1
+-- )
+-- {
+--   return (isSolved)(arg1);
+-- }
+-- signed int hs_bindgen_a2bf6bc667c9e769 (
+--   signed int arg1,
+--   signed int *arg2,
+--   signed int const *arg3
+-- )
+-- {
+--   return (fun_1_const)(arg1, arg2, arg3);
+-- }
+-- signed int hs_bindgen_ec5a6dd15a457a1d (
+--   signed int *arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return (fun_2_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_84df1030280611db (
+--   signed int *arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return (fun_3_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_e9dc927aa39d14d3 (
+--   signed int *arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return (fun_4_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_cd0bfb26f385dfaa (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return (fun_5_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_1054ce6b48ed0f13 (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return (fun_6_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_496902d7c6466098 (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return (fun_7_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_eb65cb5074167c48 (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return (fun_8_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_9bb064e9eddf07f7 (
+--   triplet *arg1,
+--   triplet const *arg2
+-- )
+-- {
+--   return (isSolved_const)(arg1, arg2);
+-- }
+-- signed int (*hs_bindgen_0fa0a3e47fa9d95a (void))[3]
+-- {
+--   return (fun_9)();
+-- }
+-- triplet *hs_bindgen_e9d3d35727502125 (void)
+-- {
+--   return (fun_10)();
+-- }
+-- signed int (*hs_bindgen_7f7cea54b33bf176 (void))[]
+-- {
+--   return (fun_11)();
+-- }
+-- list *hs_bindgen_3124a96b00bbc082 (void)
+-- {
+--   return (fun_12)();
+-- }
+-- signed int (*hs_bindgen_2fdd1bf9ee687f9b (void))[4][3]
+-- {
+--   return (fun_13)();
+-- }
+-- matrix *hs_bindgen_12a242894a3d45cb (void)
+-- {
+--   return (fun_14)();
+-- }
+-- signed int (*hs_bindgen_d8e176eb5efefa2c (void))[][3]
+-- {
+--   return (fun_15)();
+-- }
+-- tripletlist *hs_bindgen_dcf234ca786626c7 (void)
+-- {
+--   return (fun_16)();
+-- }
+-- sudoku *hs_bindgen_f80a5b6a2770c658 (void)
+-- {
+--   return (solve)();
+-- }
+-- signed int hs_bindgen_6d07a0b03f884547 (
+--   signed int arg1,
+--   signed int *arg2
+-- )
+-- {
+--   return (fun_1)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_04318f98a3ab8d08 (
+--   signed int *arg1
+-- )
+-- {
+--   return (fun_2)(arg1);
+-- }
+-- signed int hs_bindgen_2a7c5fa1040fa8db (
+--   signed int *arg1
+-- )
+-- {
+--   return (fun_3)(arg1);
+-- }
+-- signed int hs_bindgen_810acc5cf8729d0e (
+--   signed int *arg1
+-- )
+-- {
+--   return (fun_4)(arg1);
+-- }
+-- signed int hs_bindgen_83b71f7defb3b27a (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (fun_5)(arg1);
+-- }
+-- signed int hs_bindgen_62b76af3dc65da3f (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (fun_6)(arg1);
+-- }
+-- signed int hs_bindgen_100aa7fb87a5ea74 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (fun_7)(arg1);
+-- }
+-- signed int hs_bindgen_cd6646babeacd609 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (fun_8)(arg1);
+-- }
+-- signed int hs_bindgen_560f1de9a83c3a6a (
+--   triplet *arg1
+-- )
+-- {
+--   return (isSolved)(arg1);
+-- }
+-- signed int hs_bindgen_ef3b85ae74bc06cf (
+--   signed int arg1,
+--   signed int *arg2,
+--   signed int const *arg3
+-- )
+-- {
+--   return (fun_1_const)(arg1, arg2, arg3);
+-- }
+-- signed int hs_bindgen_1c913685e5e76952 (
+--   signed int *arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return (fun_2_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_eb8daf22bd5c6f00 (
+--   signed int *arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return (fun_3_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_0b73e4c7695a3b2f (
+--   signed int *arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return (fun_4_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_374feb8086895fe3 (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return (fun_5_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_2d1320b468c36708 (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return (fun_6_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_f67f5fe5bfb57aa1 (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return (fun_7_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_2c9356851d76320e (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return (fun_8_const)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_39b08b64fed0c5b8 (
+--   triplet *arg1,
+--   triplet const *arg2
+-- )
+-- {
+--   return (isSolved_const)(arg1, arg2);
+-- }
+-- signed int (*hs_bindgen_ab431ebc0519545a (void))[3]
+-- {
+--   return (fun_9)();
+-- }
+-- triplet *hs_bindgen_c9ff623e6f48d3bc (void)
+-- {
+--   return (fun_10)();
+-- }
+-- signed int (*hs_bindgen_e714f0b7c764ba17 (void))[]
+-- {
+--   return (fun_11)();
+-- }
+-- list *hs_bindgen_cc23741700ba18f7 (void)
+-- {
+--   return (fun_12)();
+-- }
+-- signed int (*hs_bindgen_eb3a1364003829ac (void))[4][3]
+-- {
+--   return (fun_13)();
+-- }
+-- matrix *hs_bindgen_0f49ffbe2c13ab46 (void)
+-- {
+--   return (fun_14)();
+-- }
+-- signed int (*hs_bindgen_59de769fbba4ed72 (void))[][3]
+-- {
+--   return (fun_15)();
+-- }
+-- tripletlist *hs_bindgen_1d6ecccfa4ee16ff (void)
+-- {
+--   return (fun_16)();
+-- }
+-- sudoku *hs_bindgen_6165085eab7d2806 (void)
+-- {
+--   return (solve)();
+-- }
+-- /* test_arraysarray_Example_get_fun_1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_5c9712c1e2ca2187 (void)) (
+--   signed int arg1,
+--   signed int *arg2
+-- )
+-- {
+--   return &fun_1;
+-- }
+-- /* test_arraysarray_Example_get_fun_2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_215c9a69aea5166e (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fun_2;
+-- }
+-- /* test_arraysarray_Example_get_fun_3 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_d45ffb769078021d (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fun_3;
+-- }
+-- /* test_arraysarray_Example_get_fun_4 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_16f300d083285e38 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fun_4;
+-- }
+-- /* test_arraysarray_Example_get_fun_5 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_05ddc0274405d6f5 (void)) (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return &fun_5;
+-- }
+-- /* test_arraysarray_Example_get_fun_6 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_bc6a8e5360af8799 (void)) (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return &fun_6;
+-- }
+-- /* test_arraysarray_Example_get_fun_7 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_b633a17af8e60afd (void)) (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return &fun_7;
+-- }
+-- /* test_arraysarray_Example_get_fun_8 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_0801bc85e75e7232 (void)) (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return &fun_8;
+-- }
+-- /* test_arraysarray_Example_get_isSolved */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_f525d0058f613e21 (void)) (
+--   triplet *arg1
+-- )
+-- {
+--   return &isSolved;
+-- }
+-- /* test_arraysarray_Example_get_fun_1_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_0fdde9c360622daf (void)) (
+--   signed int arg1,
+--   signed int *arg2,
+--   signed int const *arg3
+-- )
+-- {
+--   return &fun_1_const;
+-- }
+-- /* test_arraysarray_Example_get_fun_2_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_8182488430e66fdc (void)) (
+--   signed int *arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return &fun_2_const;
+-- }
+-- /* test_arraysarray_Example_get_fun_3_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2303f5a2f855a6e5 (void)) (
+--   signed int *arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return &fun_3_const;
+-- }
+-- /* test_arraysarray_Example_get_fun_4_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_4570b26d96819cd9 (void)) (
+--   signed int *arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return &fun_4_const;
+-- }
+-- /* test_arraysarray_Example_get_fun_5_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_65a5e31cfb885928 (void)) (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return &fun_5_const;
+-- }
+-- /* test_arraysarray_Example_get_fun_6_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_107e8456ef4df268 (void)) (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return &fun_6_const;
+-- }
+-- /* test_arraysarray_Example_get_fun_7_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_249a199499d81ca8 (void)) (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return &fun_7_const;
+-- }
+-- /* test_arraysarray_Example_get_fun_8_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_92bc0bfe006ce53c (void)) (
+--   signed int (*arg1)[3],
+--   signed int const (*arg2)[3]
+-- )
+-- {
+--   return &fun_8_const;
+-- }
+-- /* test_arraysarray_Example_get_isSolved_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_935428cb3e78f9a5 (void)) (
+--   triplet *arg1,
+--   triplet const *arg2
+-- )
+-- {
+--   return &isSolved_const;
+-- }
+-- /* test_arraysarray_Example_get_fun_9 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_c9bec6ab325b063c (void)) (void))[3]
+-- {
+--   return &fun_9;
+-- }
+-- /* test_arraysarray_Example_get_fun_10 */
+-- __attribute__ ((const))
+-- triplet *(*hs_bindgen_49f85263b6310047 (void)) (void)
+-- {
+--   return &fun_10;
+-- }
+-- /* test_arraysarray_Example_get_fun_11 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_68bdd4a6e02a046b (void)) (void))[]
+-- {
+--   return &fun_11;
+-- }
+-- /* test_arraysarray_Example_get_fun_12 */
+-- __attribute__ ((const))
+-- list *(*hs_bindgen_0521f5208260a928 (void)) (void)
+-- {
+--   return &fun_12;
+-- }
+-- /* test_arraysarray_Example_get_fun_13 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_9d0f2421c940811c (void)) (void))[4][3]
+-- {
+--   return &fun_13;
+-- }
+-- /* test_arraysarray_Example_get_fun_14 */
+-- __attribute__ ((const))
+-- matrix *(*hs_bindgen_50eeeb460ce92a1d (void)) (void)
+-- {
+--   return &fun_14;
+-- }
+-- /* test_arraysarray_Example_get_fun_15 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_afb15d11d3db71eb (void)) (void))[][3]
+-- {
+--   return &fun_15;
+-- }
+-- /* test_arraysarray_Example_get_fun_16 */
+-- __attribute__ ((const))
+-- tripletlist *(*hs_bindgen_f41fbdca0717f85b (void)) (void)
+-- {
+--   return &fun_16;
+-- }
+-- /* test_arraysarray_Example_get_solve */
+-- __attribute__ ((const))
+-- sudoku *(*hs_bindgen_b219669884cf1eb6 (void)) (void)
+-- {
+--   return &solve;
+-- }
+-- /* test_arraysarray_Example_get_arr0 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_21338ece6a009179 (void))[3]
+-- {
+--   return &arr0;
+-- }
+-- /* test_arraysarray_Example_get_arr1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_a058c9f90a6e675c (void))[3]
+-- {
+--   return &arr1;
+-- }
+-- /* test_arraysarray_Example_get_arr2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_c57aab7f71d2cb0b (void))[3]
+-- {
+--   return &arr2;
+-- }
+-- /* test_arraysarray_Example_get_arr3 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_e2b7478ee9c12746 (void))[3]
+-- {
+--   return &arr3;
+-- }
+-- /* test_arraysarray_Example_get_arr4 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_5d33e8cdfb8c9242 (void))[3]
+-- {
+--   return &arr4;
+-- }
+-- /* test_arraysarray_Example_get_arr5 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ef557ae1941f9959 (void))[3]
+-- {
+--   return &arr5;
+-- }
+-- /* test_arraysarray_Example_get_arr6 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_5f4d28170d6fa0d1 (void))[1]
+-- {
+--   return &arr6;
+-- }
+-- /* test_arraysarray_Example_get_arr7 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_3b952c95c3eb17f2 (void))[]
+-- {
+--   return &arr7;
+-- }
+-- /* test_arraysarray_Example_get_arr8 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_fe12bb34a92772f4 (void))[3]
+-- {
+--   return &arr8;
+-- }
+-- /* test_arraysarray_Example_get_arr_1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2d21b7cb9ac33ea8 (void))[3]
+-- {
+--   return &arr_1;
+-- }
+-- /* test_arraysarray_Example_get_arr_2 */
+-- __attribute__ ((const))
+-- triplet *hs_bindgen_df706ce2499e5073 (void)
+-- {
+--   return &arr_2;
+-- }
+-- /* test_arraysarray_Example_get_arr_3 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_26bcbe886b94adfb (void))[]
+-- {
+--   return &arr_3;
+-- }
+-- /* test_arraysarray_Example_get_arr_4 */
+-- __attribute__ ((const))
+-- list *hs_bindgen_e4cef264a5cc1887 (void)
+-- {
+--   return &arr_4;
+-- }
+-- /* test_arraysarray_Example_get_arr_5 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_a733c5b896a8ae4e (void))[4][3]
+-- {
+--   return &arr_5;
+-- }
+-- /* test_arraysarray_Example_get_arr_6 */
+-- __attribute__ ((const))
+-- matrix *hs_bindgen_525a326f0badae7c (void)
+-- {
+--   return &arr_6;
+-- }
+-- /* test_arraysarray_Example_get_arr_7 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_b5e93d2d90ffc861 (void))[][3]
+-- {
+--   return &arr_7;
+-- }
+-- /* test_arraysarray_Example_get_arr_8 */
+-- __attribute__ ((const))
+-- tripletlist *hs_bindgen_eb98aff4ee1d31d0 (void)
+-- {
+--   return &arr_8;
+-- }
+-- /* test_arraysarray_Example_get_arr_1_const */
+-- __attribute__ ((const))
+-- signed int const (*hs_bindgen_25089a5dd72254bc (void))[3]
+-- {
+--   return &arr_1_const;
+-- }
+-- /* test_arraysarray_Example_get_arr_2_const */
+-- __attribute__ ((const))
+-- triplet const *hs_bindgen_a55a5562a096ae11 (void)
+-- {
+--   return &arr_2_const;
+-- }
+-- /* test_arraysarray_Example_get_arr_3_const */
+-- __attribute__ ((const))
+-- signed int const (*hs_bindgen_fad31baeec544a6d (void))[]
+-- {
+--   return &arr_3_const;
+-- }
+-- /* test_arraysarray_Example_get_arr_4_const */
+-- __attribute__ ((const))
+-- list const *hs_bindgen_890c46fc872e1d7d (void)
+-- {
+--   return &arr_4_const;
+-- }
+-- /* test_arraysarray_Example_get_arr_5_const */
+-- __attribute__ ((const))
+-- signed int const (*hs_bindgen_088c9ea4e73d1cfe (void))[4][3]
+-- {
+--   return &arr_5_const;
+-- }
+-- /* test_arraysarray_Example_get_arr_6_const */
+-- __attribute__ ((const))
+-- matrix const *hs_bindgen_bf69f287b3bf9fa4 (void)
+-- {
+--   return &arr_6_const;
+-- }
+-- /* test_arraysarray_Example_get_arr_7_const */
+-- __attribute__ ((const))
+-- signed int const (*hs_bindgen_2ca44942791eacc4 (void))[][3]
+-- {
+--   return &arr_7_const;
+-- }
+-- /* test_arraysarray_Example_get_arr_8_const */
+-- __attribute__ ((const))
+-- tripletlist const *hs_bindgen_3e95fdf3b641c349 (void)
+-- {
+--   return &arr_8_const;
+-- }
+{-| __C declaration:__ @triplet@
+
+    __defined at:__ @arrays\/array.h 41:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype Triplet
+    = Triplet {unwrapTriplet :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapTriplet" Triplet ty
+    where hasField = \x_0 -> (\y_1 -> Triplet{unwrapTriplet = y_1},
+                              getField @"unwrapTriplet" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapTriplet" (Ptr Triplet) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTriplet")
+instance HasCField Triplet "unwrapTriplet"
+    where type CFieldType Triplet "unwrapTriplet" = ConstantArray 3
+                                                                  CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @list@
+
+    __defined at:__ @arrays\/array.h 43:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype List
+    = List {unwrapList :: (IncompleteArray CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapList" List ty
+    where hasField = \x_0 -> (\y_1 -> List{unwrapList = y_1},
+                              getField @"unwrapList" x_0)
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapList" (Ptr List) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapList")
+instance HasCField List "unwrapList"
+    where type CFieldType List "unwrapList" = IncompleteArray CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @matrix@
+
+    __defined at:__ @arrays\/array.h 45:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype Matrix
+    = Matrix {unwrapMatrix :: (ConstantArray 4 (ConstantArray 3 CInt))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 4 (ConstantArray 3 CInt)) =>
+         HasField "unwrapMatrix" Matrix ty
+    where hasField = \x_0 -> (\y_1 -> Matrix{unwrapMatrix = y_1},
+                              getField @"unwrapMatrix" x_0)
+instance (~) ty (ConstantArray 4 (ConstantArray 3 CInt)) =>
+         HasField "unwrapMatrix" (Ptr Matrix) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMatrix")
+instance HasCField Matrix "unwrapMatrix"
+    where type CFieldType Matrix "unwrapMatrix" = ConstantArray 4
+                                                                (ConstantArray 3 CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @tripletlist@
+
+    __defined at:__ @arrays\/array.h 47:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype Tripletlist
+    = Tripletlist {unwrapTripletlist :: (IncompleteArray (ConstantArray 3
+                                                                        CInt))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray (ConstantArray 3 CInt)) =>
+         HasField "unwrapTripletlist" Tripletlist ty
+    where hasField = \x_0 -> (\y_1 -> Tripletlist{unwrapTripletlist = y_1},
+                              getField @"unwrapTripletlist" x_0)
+instance (~) ty (IncompleteArray (ConstantArray 3 CInt)) =>
+         HasField "unwrapTripletlist" (Ptr Tripletlist) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTripletlist")
+instance HasCField Tripletlist "unwrapTripletlist"
+    where type CFieldType Tripletlist
+                          "unwrapTripletlist" = IncompleteArray (ConstantArray 3 CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct Example@
+
+    __defined at:__ @arrays\/array.h 49:8@
+
+    __exported by:__ @arrays\/array.h@
+-}
+data Example
+    = Example {example_triple :: (ConstantArray 3 CInt)
+               {- ^ __C declaration:__ @triple@
+
+                    __defined at:__ @arrays\/array.h 50:9@
+
+                    __exported by:__ @arrays\/array.h@
+               -},
+               example_sudoku :: (ConstantArray 3 (ConstantArray 3 CInt))
+               {- ^ __C declaration:__ @sudoku@
+
+                    __defined at:__ @arrays\/array.h 51:9@
+
+                    __exported by:__ @arrays\/array.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Example
+    where staticSizeOf = \_ -> 48 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Example
+    where readRaw = \ptr_0 -> (pure Example <*> readRaw (Proxy @"example_triple") ptr_0) <*> readRaw (Proxy @"example_sudoku") ptr_0
+instance WriteRaw Example
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Example example_triple_2
+                                               example_sudoku_3 -> writeRaw (Proxy @"example_triple") ptr_0 example_triple_2 >> writeRaw (Proxy @"example_sudoku") ptr_0 example_sudoku_3
+deriving via (EquivStorable Example) instance Storable Example
+deriving via (IsStructViaReadRaw Example) instance IsStruct Example
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "example_triple" Example ty
+    where hasField = \x_0 -> (\y_1 -> Example{example_triple = y_1,
+                                              example_sudoku = getField @"example_sudoku" x_0},
+                              getField @"example_triple" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "example_triple" (Ptr Example) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_triple")
+instance HasCField Example "example_triple"
+    where type CFieldType Example "example_triple" = ConstantArray 3
+                                                                   CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (ConstantArray 3 (ConstantArray 3 CInt)) =>
+         HasField "example_sudoku" Example ty
+    where hasField = \x_0 -> (\y_1 -> Example{example_sudoku = y_1,
+                                              example_triple = getField @"example_triple" x_0},
+                              getField @"example_sudoku" x_0)
+instance (~) ty (ConstantArray 3 (ConstantArray 3 CInt)) =>
+         HasField "example_sudoku" (Ptr Example) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_sudoku")
+instance HasCField Example "example_sudoku"
+    where type CFieldType Example "example_sudoku" = ConstantArray 3
+                                                                   (ConstantArray 3 CInt)
+          offset# = \_ -> \_ -> 12
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @sudoku@
+
+    __defined at:__ @arrays\/array.h 55:17@
+
+    __exported by:__ @arrays\/array.h@
+-}
+newtype Sudoku
+    = Sudoku {unwrapSudoku :: (ConstantArray 3 Triplet)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 Triplet) =>
+         HasField "unwrapSudoku" Sudoku ty
+    where hasField = \x_0 -> (\y_1 -> Sudoku{unwrapSudoku = y_1},
+                              getField @"unwrapSudoku" x_0)
+instance (~) ty (ConstantArray 3 Triplet) =>
+         HasField "unwrapSudoku" (Ptr Sudoku) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSudoku")
+instance HasCField Sudoku "unwrapSudoku"
+    where type CFieldType Sudoku "unwrapSudoku" = ConstantArray 3
+                                                                Triplet
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1@
+foreign import ccall safe "hs_bindgen_a836491d63ff3a2c" hs_bindgen_a836491d63ff3a2c_base ::
+    CInt
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1@
+hs_bindgen_a836491d63ff3a2c :: CInt ->
+                               Ptr (Elem (ConstantArray 3 CInt)) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1@
+hs_bindgen_a836491d63ff3a2c = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_a836491d63ff3a2c_base (toFFIType x_0) (toFFIType x_1))
+{-| Array of known size.
+
+    __C declaration:__ @fun_1@
+
+    __defined at:__ @arrays\/array.h 118:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_safe :: CInt -> Ptr (Elem (ConstantArray 3 CInt)) -> IO CInt
+{-| Array of known size.
+
+    __C declaration:__ @fun_1@
+
+    __defined at:__ @arrays\/array.h 118:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_safe = hs_bindgen_a836491d63ff3a2c
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2@
+foreign import ccall safe "hs_bindgen_c69f41e5ccc441ab" hs_bindgen_c69f41e5ccc441ab_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2@
+hs_bindgen_c69f41e5ccc441ab :: Ptr (Elem Triplet) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2@
+hs_bindgen_c69f41e5ccc441ab = \x_0 -> fmap fromFFIType (hs_bindgen_c69f41e5ccc441ab_base (toFFIType x_0))
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2@
+
+    __defined at:__ @arrays\/array.h 121:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_safe :: Ptr (Elem Triplet) -> IO CInt
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2@
+
+    __defined at:__ @arrays\/array.h 121:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_safe = hs_bindgen_c69f41e5ccc441ab
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3@
+foreign import ccall safe "hs_bindgen_30065ddbffdd7502" hs_bindgen_30065ddbffdd7502_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3@
+hs_bindgen_30065ddbffdd7502 :: Ptr (Elem (IncompleteArray CInt)) ->
+                               IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3@
+hs_bindgen_30065ddbffdd7502 = \x_0 -> fmap fromFFIType (hs_bindgen_30065ddbffdd7502_base (toFFIType x_0))
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3@
+
+    __defined at:__ @arrays\/array.h 124:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_safe :: Ptr (Elem (IncompleteArray CInt)) -> IO CInt
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3@
+
+    __defined at:__ @arrays\/array.h 124:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_safe = hs_bindgen_30065ddbffdd7502
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4@
+foreign import ccall safe "hs_bindgen_6e8db8abcb5fe22a" hs_bindgen_6e8db8abcb5fe22a_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4@
+hs_bindgen_6e8db8abcb5fe22a :: Ptr (Elem List) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4@
+hs_bindgen_6e8db8abcb5fe22a = \x_0 -> fmap fromFFIType (hs_bindgen_6e8db8abcb5fe22a_base (toFFIType x_0))
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4@
+
+    __defined at:__ @arrays\/array.h 127:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_safe :: Ptr (Elem List) -> IO CInt
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4@
+
+    __defined at:__ @arrays\/array.h 127:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_safe = hs_bindgen_6e8db8abcb5fe22a
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5@
+foreign import ccall safe "hs_bindgen_b2f48c31265a3f47" hs_bindgen_b2f48c31265a3f47_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5@
+hs_bindgen_b2f48c31265a3f47 :: Ptr (Elem (ConstantArray 4
+                                                        (ConstantArray 3 CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5@
+hs_bindgen_b2f48c31265a3f47 = \x_0 -> fmap fromFFIType (hs_bindgen_b2f48c31265a3f47_base (toFFIType x_0))
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5@
+
+    __defined at:__ @arrays\/array.h 130:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_safe :: Ptr (Elem (ConstantArray 4
+                                       (ConstantArray 3 CInt))) ->
+              IO CInt
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5@
+
+    __defined at:__ @arrays\/array.h 130:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_safe = hs_bindgen_b2f48c31265a3f47
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6@
+foreign import ccall safe "hs_bindgen_343fe8ca0dbb7eb1" hs_bindgen_343fe8ca0dbb7eb1_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6@
+hs_bindgen_343fe8ca0dbb7eb1 :: Ptr (Elem Matrix) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6@
+hs_bindgen_343fe8ca0dbb7eb1 = \x_0 -> fmap fromFFIType (hs_bindgen_343fe8ca0dbb7eb1_base (toFFIType x_0))
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6@
+
+    __defined at:__ @arrays\/array.h 133:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_safe :: Ptr (Elem Matrix) -> IO CInt
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6@
+
+    __defined at:__ @arrays\/array.h 133:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_safe = hs_bindgen_343fe8ca0dbb7eb1
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7@
+foreign import ccall safe "hs_bindgen_d98a58d39b578fd6" hs_bindgen_d98a58d39b578fd6_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7@
+hs_bindgen_d98a58d39b578fd6 :: Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                                         CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7@
+hs_bindgen_d98a58d39b578fd6 = \x_0 -> fmap fromFFIType (hs_bindgen_d98a58d39b578fd6_base (toFFIType x_0))
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7@
+
+    __defined at:__ @arrays\/array.h 136:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_safe :: Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                        CInt))) ->
+              IO CInt
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7@
+
+    __defined at:__ @arrays\/array.h 136:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_safe = hs_bindgen_d98a58d39b578fd6
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8@
+foreign import ccall safe "hs_bindgen_4db12be6f46d98f5" hs_bindgen_4db12be6f46d98f5_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8@
+hs_bindgen_4db12be6f46d98f5 :: Ptr (Elem Tripletlist) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8@
+hs_bindgen_4db12be6f46d98f5 = \x_0 -> fmap fromFFIType (hs_bindgen_4db12be6f46d98f5_base (toFFIType x_0))
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8@
+
+    __defined at:__ @arrays\/array.h 139:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_safe :: Ptr (Elem Tripletlist) -> IO CInt
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8@
+
+    __defined at:__ @arrays\/array.h 139:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_safe = hs_bindgen_4db12be6f46d98f5
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved@
+foreign import ccall safe "hs_bindgen_825f9aeca071df21" hs_bindgen_825f9aeca071df21_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved@
+hs_bindgen_825f9aeca071df21 :: Ptr (Elem Sudoku) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved@
+hs_bindgen_825f9aeca071df21 = \x_0 -> fmap fromFFIType (hs_bindgen_825f9aeca071df21_base (toFFIType x_0))
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved@
+
+    __defined at:__ @arrays\/array.h 142:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_safe :: Ptr (Elem Sudoku) -> IO CInt
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved@
+
+    __defined at:__ @arrays\/array.h 142:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_safe = hs_bindgen_825f9aeca071df21
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1_const@
+foreign import ccall safe "hs_bindgen_a2bf6bc667c9e769" hs_bindgen_a2bf6bc667c9e769_base ::
+    CInt
+ -> Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1_const@
+hs_bindgen_a2bf6bc667c9e769 :: CInt ->
+                               Ptr (Elem (ConstantArray 3 CInt)) ->
+                               PtrConst (Elem (ConstantArray 3 CInt)) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_1_const@
+hs_bindgen_a2bf6bc667c9e769 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_a2bf6bc667c9e769_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Array of known size.
+
+    __C declaration:__ @fun_1_const@
+
+    __defined at:__ @arrays\/array.h 149:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_const_safe :: CInt ->
+                    Ptr (Elem (ConstantArray 3 CInt)) ->
+                    PtrConst (Elem (ConstantArray 3 CInt)) -> IO CInt
+{-| Array of known size.
+
+    __C declaration:__ @fun_1_const@
+
+    __defined at:__ @arrays\/array.h 149:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_const_safe = hs_bindgen_a2bf6bc667c9e769
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2_const@
+foreign import ccall safe "hs_bindgen_ec5a6dd15a457a1d" hs_bindgen_ec5a6dd15a457a1d_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2_const@
+hs_bindgen_ec5a6dd15a457a1d :: Ptr (Elem Triplet) ->
+                               PtrConst (Elem Triplet) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_2_const@
+hs_bindgen_ec5a6dd15a457a1d = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_ec5a6dd15a457a1d_base (toFFIType x_0) (toFFIType x_1))
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2_const@
+
+    __defined at:__ @arrays\/array.h 152:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_const_safe :: Ptr (Elem Triplet) ->
+                    PtrConst (Elem Triplet) -> IO CInt
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2_const@
+
+    __defined at:__ @arrays\/array.h 152:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_const_safe = hs_bindgen_ec5a6dd15a457a1d
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3_const@
+foreign import ccall safe "hs_bindgen_84df1030280611db" hs_bindgen_84df1030280611db_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3_const@
+hs_bindgen_84df1030280611db :: Ptr (Elem (IncompleteArray CInt)) ->
+                               PtrConst (Elem (IncompleteArray CInt)) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_3_const@
+hs_bindgen_84df1030280611db = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_84df1030280611db_base (toFFIType x_0) (toFFIType x_1))
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3_const@
+
+    __defined at:__ @arrays\/array.h 155:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_const_safe :: Ptr (Elem (IncompleteArray CInt)) ->
+                    PtrConst (Elem (IncompleteArray CInt)) -> IO CInt
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3_const@
+
+    __defined at:__ @arrays\/array.h 155:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_const_safe = hs_bindgen_84df1030280611db
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4_const@
+foreign import ccall safe "hs_bindgen_e9dc927aa39d14d3" hs_bindgen_e9dc927aa39d14d3_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4_const@
+hs_bindgen_e9dc927aa39d14d3 :: Ptr (Elem List) ->
+                               PtrConst (Elem List) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_4_const@
+hs_bindgen_e9dc927aa39d14d3 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_e9dc927aa39d14d3_base (toFFIType x_0) (toFFIType x_1))
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4_const@
+
+    __defined at:__ @arrays\/array.h 158:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_const_safe :: Ptr (Elem List) ->
+                    PtrConst (Elem List) -> IO CInt
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4_const@
+
+    __defined at:__ @arrays\/array.h 158:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_const_safe = hs_bindgen_e9dc927aa39d14d3
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5_const@
+foreign import ccall safe "hs_bindgen_cd0bfb26f385dfaa" hs_bindgen_cd0bfb26f385dfaa_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5_const@
+hs_bindgen_cd0bfb26f385dfaa :: Ptr (Elem (ConstantArray 4
+                                                        (ConstantArray 3 CInt))) ->
+                               PtrConst (Elem (ConstantArray 4 (ConstantArray 3 CInt))) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_5_const@
+hs_bindgen_cd0bfb26f385dfaa = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_cd0bfb26f385dfaa_base (toFFIType x_0) (toFFIType x_1))
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5_const@
+
+    __defined at:__ @arrays\/array.h 161:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_const_safe :: Ptr (Elem (ConstantArray 4
+                                             (ConstantArray 3 CInt))) ->
+                    PtrConst (Elem (ConstantArray 4 (ConstantArray 3 CInt))) -> IO CInt
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5_const@
+
+    __defined at:__ @arrays\/array.h 161:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_const_safe = hs_bindgen_cd0bfb26f385dfaa
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6_const@
+foreign import ccall safe "hs_bindgen_1054ce6b48ed0f13" hs_bindgen_1054ce6b48ed0f13_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6_const@
+hs_bindgen_1054ce6b48ed0f13 :: Ptr (Elem Matrix) ->
+                               PtrConst (Elem Matrix) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_6_const@
+hs_bindgen_1054ce6b48ed0f13 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_1054ce6b48ed0f13_base (toFFIType x_0) (toFFIType x_1))
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6_const@
+
+    __defined at:__ @arrays\/array.h 164:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_const_safe :: Ptr (Elem Matrix) ->
+                    PtrConst (Elem Matrix) -> IO CInt
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6_const@
+
+    __defined at:__ @arrays\/array.h 164:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_const_safe = hs_bindgen_1054ce6b48ed0f13
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7_const@
+foreign import ccall safe "hs_bindgen_496902d7c6466098" hs_bindgen_496902d7c6466098_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7_const@
+hs_bindgen_496902d7c6466098 :: Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                                         CInt))) ->
+                               PtrConst (Elem (IncompleteArray (ConstantArray 3 CInt))) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_7_const@
+hs_bindgen_496902d7c6466098 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_496902d7c6466098_base (toFFIType x_0) (toFFIType x_1))
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7_const@
+
+    __defined at:__ @arrays\/array.h 167:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_const_safe :: Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                              CInt))) ->
+                    PtrConst (Elem (IncompleteArray (ConstantArray 3 CInt))) -> IO CInt
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7_const@
+
+    __defined at:__ @arrays\/array.h 167:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_const_safe = hs_bindgen_496902d7c6466098
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8_const@
+foreign import ccall safe "hs_bindgen_eb65cb5074167c48" hs_bindgen_eb65cb5074167c48_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8_const@
+hs_bindgen_eb65cb5074167c48 :: Ptr (Elem Tripletlist) ->
+                               PtrConst (Elem Tripletlist) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_fun_8_const@
+hs_bindgen_eb65cb5074167c48 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_eb65cb5074167c48_base (toFFIType x_0) (toFFIType x_1))
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8_const@
+
+    __defined at:__ @arrays\/array.h 170:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_const_safe :: Ptr (Elem Tripletlist) ->
+                    PtrConst (Elem Tripletlist) -> IO CInt
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8_const@
+
+    __defined at:__ @arrays\/array.h 170:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_const_safe = hs_bindgen_eb65cb5074167c48
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved_const@
+foreign import ccall safe "hs_bindgen_9bb064e9eddf07f7" hs_bindgen_9bb064e9eddf07f7_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved_const@
+hs_bindgen_9bb064e9eddf07f7 :: Ptr (Elem Sudoku) ->
+                               PtrConst (Elem Sudoku) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Safe_isSolved_const@
+hs_bindgen_9bb064e9eddf07f7 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_9bb064e9eddf07f7_base (toFFIType x_0) (toFFIType x_1))
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved_const@
+
+    __defined at:__ @arrays\/array.h 173:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_const_safe :: Ptr (Elem Sudoku) ->
+                       PtrConst (Elem Sudoku) -> IO CInt
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved_const@
+
+    __defined at:__ @arrays\/array.h 173:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_const_safe = hs_bindgen_9bb064e9eddf07f7
+-- __unique:__ @test_arraysarray_Example_Safe_fun_9@
+foreign import ccall safe "hs_bindgen_0fa0a3e47fa9d95a" hs_bindgen_0fa0a3e47fa9d95a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_9@
+hs_bindgen_0fa0a3e47fa9d95a :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_Safe_fun_9@
+hs_bindgen_0fa0a3e47fa9d95a = fmap fromFFIType hs_bindgen_0fa0a3e47fa9d95a_base
+{-| Array of known size.
+
+    __C declaration:__ @fun_9@
+
+    __defined at:__ @arrays\/array.h 185:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_9_safe :: IO (Ptr (ConstantArray 3 CInt))
+{-| Array of known size.
+
+    __C declaration:__ @fun_9@
+
+    __defined at:__ @arrays\/array.h 185:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_9_safe = hs_bindgen_0fa0a3e47fa9d95a
+-- __unique:__ @test_arraysarray_Example_Safe_fun_10@
+foreign import ccall safe "hs_bindgen_e9d3d35727502125" hs_bindgen_e9d3d35727502125_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_10@
+hs_bindgen_e9d3d35727502125 :: IO (Ptr Triplet)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_10@
+hs_bindgen_e9d3d35727502125 = fmap fromFFIType hs_bindgen_e9d3d35727502125_base
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_10@
+
+    __defined at:__ @arrays\/array.h 188:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_10_safe :: IO (Ptr Triplet)
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_10@
+
+    __defined at:__ @arrays\/array.h 188:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_10_safe = hs_bindgen_e9d3d35727502125
+-- __unique:__ @test_arraysarray_Example_Safe_fun_11@
+foreign import ccall safe "hs_bindgen_7f7cea54b33bf176" hs_bindgen_7f7cea54b33bf176_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_11@
+hs_bindgen_7f7cea54b33bf176 :: IO (Ptr (IncompleteArray CInt))
+-- __unique:__ @test_arraysarray_Example_Safe_fun_11@
+hs_bindgen_7f7cea54b33bf176 = fmap fromFFIType hs_bindgen_7f7cea54b33bf176_base
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_11@
+
+    __defined at:__ @arrays\/array.h 191:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_11_safe :: IO (Ptr (IncompleteArray CInt))
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_11@
+
+    __defined at:__ @arrays\/array.h 191:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_11_safe = hs_bindgen_7f7cea54b33bf176
+-- __unique:__ @test_arraysarray_Example_Safe_fun_12@
+foreign import ccall safe "hs_bindgen_3124a96b00bbc082" hs_bindgen_3124a96b00bbc082_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_12@
+hs_bindgen_3124a96b00bbc082 :: IO (Ptr List)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_12@
+hs_bindgen_3124a96b00bbc082 = fmap fromFFIType hs_bindgen_3124a96b00bbc082_base
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_12@
+
+    __defined at:__ @arrays\/array.h 194:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_12_safe :: IO (Ptr List)
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_12@
+
+    __defined at:__ @arrays\/array.h 194:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_12_safe = hs_bindgen_3124a96b00bbc082
+-- __unique:__ @test_arraysarray_Example_Safe_fun_13@
+foreign import ccall safe "hs_bindgen_2fdd1bf9ee687f9b" hs_bindgen_2fdd1bf9ee687f9b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_13@
+hs_bindgen_2fdd1bf9ee687f9b :: IO (Ptr (ConstantArray 4
+                                                      (ConstantArray 3 CInt)))
+-- __unique:__ @test_arraysarray_Example_Safe_fun_13@
+hs_bindgen_2fdd1bf9ee687f9b = fmap fromFFIType hs_bindgen_2fdd1bf9ee687f9b_base
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_13@
+
+    __defined at:__ @arrays\/array.h 197:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_13_safe :: IO (Ptr (ConstantArray 4 (ConstantArray 3 CInt)))
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_13@
+
+    __defined at:__ @arrays\/array.h 197:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_13_safe = hs_bindgen_2fdd1bf9ee687f9b
+-- __unique:__ @test_arraysarray_Example_Safe_fun_14@
+foreign import ccall safe "hs_bindgen_12a242894a3d45cb" hs_bindgen_12a242894a3d45cb_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_14@
+hs_bindgen_12a242894a3d45cb :: IO (Ptr Matrix)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_14@
+hs_bindgen_12a242894a3d45cb = fmap fromFFIType hs_bindgen_12a242894a3d45cb_base
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_14@
+
+    __defined at:__ @arrays\/array.h 200:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_14_safe :: IO (Ptr Matrix)
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_14@
+
+    __defined at:__ @arrays\/array.h 200:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_14_safe = hs_bindgen_12a242894a3d45cb
+-- __unique:__ @test_arraysarray_Example_Safe_fun_15@
+foreign import ccall safe "hs_bindgen_d8e176eb5efefa2c" hs_bindgen_d8e176eb5efefa2c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_15@
+hs_bindgen_d8e176eb5efefa2c :: IO (Ptr (IncompleteArray (ConstantArray 3
+                                                                       CInt)))
+-- __unique:__ @test_arraysarray_Example_Safe_fun_15@
+hs_bindgen_d8e176eb5efefa2c = fmap fromFFIType hs_bindgen_d8e176eb5efefa2c_base
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_15@
+
+    __defined at:__ @arrays\/array.h 203:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_15_safe :: IO (Ptr (IncompleteArray (ConstantArray 3 CInt)))
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_15@
+
+    __defined at:__ @arrays\/array.h 203:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_15_safe = hs_bindgen_d8e176eb5efefa2c
+-- __unique:__ @test_arraysarray_Example_Safe_fun_16@
+foreign import ccall safe "hs_bindgen_dcf234ca786626c7" hs_bindgen_dcf234ca786626c7_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_16@
+hs_bindgen_dcf234ca786626c7 :: IO (Ptr Tripletlist)
+-- __unique:__ @test_arraysarray_Example_Safe_fun_16@
+hs_bindgen_dcf234ca786626c7 = fmap fromFFIType hs_bindgen_dcf234ca786626c7_base
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_16@
+
+    __defined at:__ @arrays\/array.h 206:14@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_16_safe :: IO (Ptr Tripletlist)
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_16@
+
+    __defined at:__ @arrays\/array.h 206:14@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_16_safe = hs_bindgen_dcf234ca786626c7
+-- __unique:__ @test_arraysarray_Example_Safe_solve@
+foreign import ccall safe "hs_bindgen_f80a5b6a2770c658" hs_bindgen_f80a5b6a2770c658_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Safe_solve@
+hs_bindgen_f80a5b6a2770c658 :: IO (Ptr Sudoku)
+-- __unique:__ @test_arraysarray_Example_Safe_solve@
+hs_bindgen_f80a5b6a2770c658 = fmap fromFFIType hs_bindgen_f80a5b6a2770c658_base
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @solve@
+
+    __defined at:__ @arrays\/array.h 209:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+solve_safe :: IO (Ptr Sudoku)
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @solve@
+
+    __defined at:__ @arrays\/array.h 209:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+solve_safe = hs_bindgen_f80a5b6a2770c658
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1@
+foreign import ccall unsafe "hs_bindgen_6d07a0b03f884547" hs_bindgen_6d07a0b03f884547_base ::
+    CInt
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1@
+hs_bindgen_6d07a0b03f884547 :: CInt ->
+                               Ptr (Elem (ConstantArray 3 CInt)) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1@
+hs_bindgen_6d07a0b03f884547 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_6d07a0b03f884547_base (toFFIType x_0) (toFFIType x_1))
+{-| Array of known size.
+
+    __C declaration:__ @fun_1@
+
+    __defined at:__ @arrays\/array.h 118:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_unsafe :: CInt ->
+                Ptr (Elem (ConstantArray 3 CInt)) -> IO CInt
+{-| Array of known size.
+
+    __C declaration:__ @fun_1@
+
+    __defined at:__ @arrays\/array.h 118:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_unsafe = hs_bindgen_6d07a0b03f884547
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2@
+foreign import ccall unsafe "hs_bindgen_04318f98a3ab8d08" hs_bindgen_04318f98a3ab8d08_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2@
+hs_bindgen_04318f98a3ab8d08 :: Ptr (Elem Triplet) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2@
+hs_bindgen_04318f98a3ab8d08 = \x_0 -> fmap fromFFIType (hs_bindgen_04318f98a3ab8d08_base (toFFIType x_0))
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2@
+
+    __defined at:__ @arrays\/array.h 121:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_unsafe :: Ptr (Elem Triplet) -> IO CInt
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2@
+
+    __defined at:__ @arrays\/array.h 121:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_unsafe = hs_bindgen_04318f98a3ab8d08
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3@
+foreign import ccall unsafe "hs_bindgen_2a7c5fa1040fa8db" hs_bindgen_2a7c5fa1040fa8db_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3@
+hs_bindgen_2a7c5fa1040fa8db :: Ptr (Elem (IncompleteArray CInt)) ->
+                               IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3@
+hs_bindgen_2a7c5fa1040fa8db = \x_0 -> fmap fromFFIType (hs_bindgen_2a7c5fa1040fa8db_base (toFFIType x_0))
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3@
+
+    __defined at:__ @arrays\/array.h 124:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_unsafe :: Ptr (Elem (IncompleteArray CInt)) -> IO CInt
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3@
+
+    __defined at:__ @arrays\/array.h 124:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_unsafe = hs_bindgen_2a7c5fa1040fa8db
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4@
+foreign import ccall unsafe "hs_bindgen_810acc5cf8729d0e" hs_bindgen_810acc5cf8729d0e_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4@
+hs_bindgen_810acc5cf8729d0e :: Ptr (Elem List) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4@
+hs_bindgen_810acc5cf8729d0e = \x_0 -> fmap fromFFIType (hs_bindgen_810acc5cf8729d0e_base (toFFIType x_0))
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4@
+
+    __defined at:__ @arrays\/array.h 127:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_unsafe :: Ptr (Elem List) -> IO CInt
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4@
+
+    __defined at:__ @arrays\/array.h 127:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_unsafe = hs_bindgen_810acc5cf8729d0e
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5@
+foreign import ccall unsafe "hs_bindgen_83b71f7defb3b27a" hs_bindgen_83b71f7defb3b27a_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5@
+hs_bindgen_83b71f7defb3b27a :: Ptr (Elem (ConstantArray 4
+                                                        (ConstantArray 3 CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5@
+hs_bindgen_83b71f7defb3b27a = \x_0 -> fmap fromFFIType (hs_bindgen_83b71f7defb3b27a_base (toFFIType x_0))
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5@
+
+    __defined at:__ @arrays\/array.h 130:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_unsafe :: Ptr (Elem (ConstantArray 4
+                                         (ConstantArray 3 CInt))) ->
+                IO CInt
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5@
+
+    __defined at:__ @arrays\/array.h 130:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_unsafe = hs_bindgen_83b71f7defb3b27a
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6@
+foreign import ccall unsafe "hs_bindgen_62b76af3dc65da3f" hs_bindgen_62b76af3dc65da3f_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6@
+hs_bindgen_62b76af3dc65da3f :: Ptr (Elem Matrix) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6@
+hs_bindgen_62b76af3dc65da3f = \x_0 -> fmap fromFFIType (hs_bindgen_62b76af3dc65da3f_base (toFFIType x_0))
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6@
+
+    __defined at:__ @arrays\/array.h 133:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_unsafe :: Ptr (Elem Matrix) -> IO CInt
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6@
+
+    __defined at:__ @arrays\/array.h 133:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_unsafe = hs_bindgen_62b76af3dc65da3f
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7@
+foreign import ccall unsafe "hs_bindgen_100aa7fb87a5ea74" hs_bindgen_100aa7fb87a5ea74_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7@
+hs_bindgen_100aa7fb87a5ea74 :: Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                                         CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7@
+hs_bindgen_100aa7fb87a5ea74 = \x_0 -> fmap fromFFIType (hs_bindgen_100aa7fb87a5ea74_base (toFFIType x_0))
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7@
+
+    __defined at:__ @arrays\/array.h 136:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_unsafe :: Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                          CInt))) ->
+                IO CInt
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7@
+
+    __defined at:__ @arrays\/array.h 136:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_unsafe = hs_bindgen_100aa7fb87a5ea74
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8@
+foreign import ccall unsafe "hs_bindgen_cd6646babeacd609" hs_bindgen_cd6646babeacd609_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8@
+hs_bindgen_cd6646babeacd609 :: Ptr (Elem Tripletlist) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8@
+hs_bindgen_cd6646babeacd609 = \x_0 -> fmap fromFFIType (hs_bindgen_cd6646babeacd609_base (toFFIType x_0))
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8@
+
+    __defined at:__ @arrays\/array.h 139:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_unsafe :: Ptr (Elem Tripletlist) -> IO CInt
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8@
+
+    __defined at:__ @arrays\/array.h 139:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_unsafe = hs_bindgen_cd6646babeacd609
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved@
+foreign import ccall unsafe "hs_bindgen_560f1de9a83c3a6a" hs_bindgen_560f1de9a83c3a6a_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved@
+hs_bindgen_560f1de9a83c3a6a :: Ptr (Elem Sudoku) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved@
+hs_bindgen_560f1de9a83c3a6a = \x_0 -> fmap fromFFIType (hs_bindgen_560f1de9a83c3a6a_base (toFFIType x_0))
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved@
+
+    __defined at:__ @arrays\/array.h 142:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_unsafe :: Ptr (Elem Sudoku) -> IO CInt
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved@
+
+    __defined at:__ @arrays\/array.h 142:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_unsafe = hs_bindgen_560f1de9a83c3a6a
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1_const@
+foreign import ccall unsafe "hs_bindgen_ef3b85ae74bc06cf" hs_bindgen_ef3b85ae74bc06cf_base ::
+    CInt
+ -> Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1_const@
+hs_bindgen_ef3b85ae74bc06cf :: CInt ->
+                               Ptr (Elem (ConstantArray 3 CInt)) ->
+                               PtrConst (Elem (ConstantArray 3 CInt)) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_1_const@
+hs_bindgen_ef3b85ae74bc06cf = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_ef3b85ae74bc06cf_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Array of known size.
+
+    __C declaration:__ @fun_1_const@
+
+    __defined at:__ @arrays\/array.h 149:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_const_unsafe :: CInt ->
+                      Ptr (Elem (ConstantArray 3 CInt)) ->
+                      PtrConst (Elem (ConstantArray 3 CInt)) -> IO CInt
+{-| Array of known size.
+
+    __C declaration:__ @fun_1_const@
+
+    __defined at:__ @arrays\/array.h 149:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_const_unsafe = hs_bindgen_ef3b85ae74bc06cf
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2_const@
+foreign import ccall unsafe "hs_bindgen_1c913685e5e76952" hs_bindgen_1c913685e5e76952_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2_const@
+hs_bindgen_1c913685e5e76952 :: Ptr (Elem Triplet) ->
+                               PtrConst (Elem Triplet) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_2_const@
+hs_bindgen_1c913685e5e76952 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_1c913685e5e76952_base (toFFIType x_0) (toFFIType x_1))
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2_const@
+
+    __defined at:__ @arrays\/array.h 152:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_const_unsafe :: Ptr (Elem Triplet) ->
+                      PtrConst (Elem Triplet) -> IO CInt
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2_const@
+
+    __defined at:__ @arrays\/array.h 152:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_const_unsafe = hs_bindgen_1c913685e5e76952
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3_const@
+foreign import ccall unsafe "hs_bindgen_eb8daf22bd5c6f00" hs_bindgen_eb8daf22bd5c6f00_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3_const@
+hs_bindgen_eb8daf22bd5c6f00 :: Ptr (Elem (IncompleteArray CInt)) ->
+                               PtrConst (Elem (IncompleteArray CInt)) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_3_const@
+hs_bindgen_eb8daf22bd5c6f00 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_eb8daf22bd5c6f00_base (toFFIType x_0) (toFFIType x_1))
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3_const@
+
+    __defined at:__ @arrays\/array.h 155:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_const_unsafe :: Ptr (Elem (IncompleteArray CInt)) ->
+                      PtrConst (Elem (IncompleteArray CInt)) -> IO CInt
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3_const@
+
+    __defined at:__ @arrays\/array.h 155:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_const_unsafe = hs_bindgen_eb8daf22bd5c6f00
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4_const@
+foreign import ccall unsafe "hs_bindgen_0b73e4c7695a3b2f" hs_bindgen_0b73e4c7695a3b2f_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4_const@
+hs_bindgen_0b73e4c7695a3b2f :: Ptr (Elem List) ->
+                               PtrConst (Elem List) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_4_const@
+hs_bindgen_0b73e4c7695a3b2f = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_0b73e4c7695a3b2f_base (toFFIType x_0) (toFFIType x_1))
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4_const@
+
+    __defined at:__ @arrays\/array.h 158:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_const_unsafe :: Ptr (Elem List) ->
+                      PtrConst (Elem List) -> IO CInt
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4_const@
+
+    __defined at:__ @arrays\/array.h 158:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_const_unsafe = hs_bindgen_0b73e4c7695a3b2f
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5_const@
+foreign import ccall unsafe "hs_bindgen_374feb8086895fe3" hs_bindgen_374feb8086895fe3_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5_const@
+hs_bindgen_374feb8086895fe3 :: Ptr (Elem (ConstantArray 4
+                                                        (ConstantArray 3 CInt))) ->
+                               PtrConst (Elem (ConstantArray 4 (ConstantArray 3 CInt))) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_5_const@
+hs_bindgen_374feb8086895fe3 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_374feb8086895fe3_base (toFFIType x_0) (toFFIType x_1))
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5_const@
+
+    __defined at:__ @arrays\/array.h 161:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_const_unsafe :: Ptr (Elem (ConstantArray 4
+                                               (ConstantArray 3 CInt))) ->
+                      PtrConst (Elem (ConstantArray 4 (ConstantArray 3 CInt))) -> IO CInt
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5_const@
+
+    __defined at:__ @arrays\/array.h 161:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_const_unsafe = hs_bindgen_374feb8086895fe3
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6_const@
+foreign import ccall unsafe "hs_bindgen_2d1320b468c36708" hs_bindgen_2d1320b468c36708_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6_const@
+hs_bindgen_2d1320b468c36708 :: Ptr (Elem Matrix) ->
+                               PtrConst (Elem Matrix) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_6_const@
+hs_bindgen_2d1320b468c36708 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_2d1320b468c36708_base (toFFIType x_0) (toFFIType x_1))
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6_const@
+
+    __defined at:__ @arrays\/array.h 164:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_const_unsafe :: Ptr (Elem Matrix) ->
+                      PtrConst (Elem Matrix) -> IO CInt
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6_const@
+
+    __defined at:__ @arrays\/array.h 164:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_const_unsafe = hs_bindgen_2d1320b468c36708
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7_const@
+foreign import ccall unsafe "hs_bindgen_f67f5fe5bfb57aa1" hs_bindgen_f67f5fe5bfb57aa1_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7_const@
+hs_bindgen_f67f5fe5bfb57aa1 :: Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                                         CInt))) ->
+                               PtrConst (Elem (IncompleteArray (ConstantArray 3 CInt))) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_7_const@
+hs_bindgen_f67f5fe5bfb57aa1 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_f67f5fe5bfb57aa1_base (toFFIType x_0) (toFFIType x_1))
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7_const@
+
+    __defined at:__ @arrays\/array.h 167:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_const_unsafe :: Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                                CInt))) ->
+                      PtrConst (Elem (IncompleteArray (ConstantArray 3 CInt))) -> IO CInt
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7_const@
+
+    __defined at:__ @arrays\/array.h 167:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_const_unsafe = hs_bindgen_f67f5fe5bfb57aa1
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8_const@
+foreign import ccall unsafe "hs_bindgen_2c9356851d76320e" hs_bindgen_2c9356851d76320e_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8_const@
+hs_bindgen_2c9356851d76320e :: Ptr (Elem Tripletlist) ->
+                               PtrConst (Elem Tripletlist) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_8_const@
+hs_bindgen_2c9356851d76320e = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_2c9356851d76320e_base (toFFIType x_0) (toFFIType x_1))
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8_const@
+
+    __defined at:__ @arrays\/array.h 170:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_const_unsafe :: Ptr (Elem Tripletlist) ->
+                      PtrConst (Elem Tripletlist) -> IO CInt
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8_const@
+
+    __defined at:__ @arrays\/array.h 170:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_const_unsafe = hs_bindgen_2c9356851d76320e
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved_const@
+foreign import ccall unsafe "hs_bindgen_39b08b64fed0c5b8" hs_bindgen_39b08b64fed0c5b8_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved_const@
+hs_bindgen_39b08b64fed0c5b8 :: Ptr (Elem Sudoku) ->
+                               PtrConst (Elem Sudoku) -> IO CInt
+-- __unique:__ @test_arraysarray_Example_Unsafe_isSolved_const@
+hs_bindgen_39b08b64fed0c5b8 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_39b08b64fed0c5b8_base (toFFIType x_0) (toFFIType x_1))
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved_const@
+
+    __defined at:__ @arrays\/array.h 173:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_const_unsafe :: Ptr (Elem Sudoku) ->
+                         PtrConst (Elem Sudoku) -> IO CInt
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved_const@
+
+    __defined at:__ @arrays\/array.h 173:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_const_unsafe = hs_bindgen_39b08b64fed0c5b8
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_9@
+foreign import ccall unsafe "hs_bindgen_ab431ebc0519545a" hs_bindgen_ab431ebc0519545a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_9@
+hs_bindgen_ab431ebc0519545a :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_9@
+hs_bindgen_ab431ebc0519545a = fmap fromFFIType hs_bindgen_ab431ebc0519545a_base
+{-| Array of known size.
+
+    __C declaration:__ @fun_9@
+
+    __defined at:__ @arrays\/array.h 185:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_9_unsafe :: IO (Ptr (ConstantArray 3 CInt))
+{-| Array of known size.
+
+    __C declaration:__ @fun_9@
+
+    __defined at:__ @arrays\/array.h 185:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_9_unsafe = hs_bindgen_ab431ebc0519545a
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_10@
+foreign import ccall unsafe "hs_bindgen_c9ff623e6f48d3bc" hs_bindgen_c9ff623e6f48d3bc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_10@
+hs_bindgen_c9ff623e6f48d3bc :: IO (Ptr Triplet)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_10@
+hs_bindgen_c9ff623e6f48d3bc = fmap fromFFIType hs_bindgen_c9ff623e6f48d3bc_base
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_10@
+
+    __defined at:__ @arrays\/array.h 188:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_10_unsafe :: IO (Ptr Triplet)
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_10@
+
+    __defined at:__ @arrays\/array.h 188:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_10_unsafe = hs_bindgen_c9ff623e6f48d3bc
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_11@
+foreign import ccall unsafe "hs_bindgen_e714f0b7c764ba17" hs_bindgen_e714f0b7c764ba17_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_11@
+hs_bindgen_e714f0b7c764ba17 :: IO (Ptr (IncompleteArray CInt))
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_11@
+hs_bindgen_e714f0b7c764ba17 = fmap fromFFIType hs_bindgen_e714f0b7c764ba17_base
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_11@
+
+    __defined at:__ @arrays\/array.h 191:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_11_unsafe :: IO (Ptr (IncompleteArray CInt))
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_11@
+
+    __defined at:__ @arrays\/array.h 191:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_11_unsafe = hs_bindgen_e714f0b7c764ba17
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_12@
+foreign import ccall unsafe "hs_bindgen_cc23741700ba18f7" hs_bindgen_cc23741700ba18f7_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_12@
+hs_bindgen_cc23741700ba18f7 :: IO (Ptr List)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_12@
+hs_bindgen_cc23741700ba18f7 = fmap fromFFIType hs_bindgen_cc23741700ba18f7_base
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_12@
+
+    __defined at:__ @arrays\/array.h 194:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_12_unsafe :: IO (Ptr List)
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_12@
+
+    __defined at:__ @arrays\/array.h 194:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_12_unsafe = hs_bindgen_cc23741700ba18f7
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_13@
+foreign import ccall unsafe "hs_bindgen_eb3a1364003829ac" hs_bindgen_eb3a1364003829ac_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_13@
+hs_bindgen_eb3a1364003829ac :: IO (Ptr (ConstantArray 4
+                                                      (ConstantArray 3 CInt)))
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_13@
+hs_bindgen_eb3a1364003829ac = fmap fromFFIType hs_bindgen_eb3a1364003829ac_base
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_13@
+
+    __defined at:__ @arrays\/array.h 197:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_13_unsafe :: IO (Ptr (ConstantArray 4 (ConstantArray 3 CInt)))
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_13@
+
+    __defined at:__ @arrays\/array.h 197:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_13_unsafe = hs_bindgen_eb3a1364003829ac
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_14@
+foreign import ccall unsafe "hs_bindgen_0f49ffbe2c13ab46" hs_bindgen_0f49ffbe2c13ab46_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_14@
+hs_bindgen_0f49ffbe2c13ab46 :: IO (Ptr Matrix)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_14@
+hs_bindgen_0f49ffbe2c13ab46 = fmap fromFFIType hs_bindgen_0f49ffbe2c13ab46_base
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_14@
+
+    __defined at:__ @arrays\/array.h 200:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_14_unsafe :: IO (Ptr Matrix)
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_14@
+
+    __defined at:__ @arrays\/array.h 200:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_14_unsafe = hs_bindgen_0f49ffbe2c13ab46
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_15@
+foreign import ccall unsafe "hs_bindgen_59de769fbba4ed72" hs_bindgen_59de769fbba4ed72_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_15@
+hs_bindgen_59de769fbba4ed72 :: IO (Ptr (IncompleteArray (ConstantArray 3
+                                                                       CInt)))
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_15@
+hs_bindgen_59de769fbba4ed72 = fmap fromFFIType hs_bindgen_59de769fbba4ed72_base
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_15@
+
+    __defined at:__ @arrays\/array.h 203:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_15_unsafe :: IO (Ptr (IncompleteArray (ConstantArray 3 CInt)))
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_15@
+
+    __defined at:__ @arrays\/array.h 203:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_15_unsafe = hs_bindgen_59de769fbba4ed72
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_16@
+foreign import ccall unsafe "hs_bindgen_1d6ecccfa4ee16ff" hs_bindgen_1d6ecccfa4ee16ff_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_16@
+hs_bindgen_1d6ecccfa4ee16ff :: IO (Ptr Tripletlist)
+-- __unique:__ @test_arraysarray_Example_Unsafe_fun_16@
+hs_bindgen_1d6ecccfa4ee16ff = fmap fromFFIType hs_bindgen_1d6ecccfa4ee16ff_base
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_16@
+
+    __defined at:__ @arrays\/array.h 206:14@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_16_unsafe :: IO (Ptr Tripletlist)
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_16@
+
+    __defined at:__ @arrays\/array.h 206:14@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_16_unsafe = hs_bindgen_1d6ecccfa4ee16ff
+-- __unique:__ @test_arraysarray_Example_Unsafe_solve@
+foreign import ccall unsafe "hs_bindgen_6165085eab7d2806" hs_bindgen_6165085eab7d2806_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_Unsafe_solve@
+hs_bindgen_6165085eab7d2806 :: IO (Ptr Sudoku)
+-- __unique:__ @test_arraysarray_Example_Unsafe_solve@
+hs_bindgen_6165085eab7d2806 = fmap fromFFIType hs_bindgen_6165085eab7d2806_base
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @solve@
+
+    __defined at:__ @arrays\/array.h 209:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+solve_unsafe :: IO (Ptr Sudoku)
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @solve@
+
+    __defined at:__ @arrays\/array.h 209:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+solve_unsafe = hs_bindgen_6165085eab7d2806
+-- __unique:__ @test_arraysarray_Example_get_fun_1@
+foreign import ccall unsafe "hs_bindgen_5c9712c1e2ca2187" hs_bindgen_5c9712c1e2ca2187_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_1@
+hs_bindgen_5c9712c1e2ca2187 :: IO (FunPtr (CInt ->
+                                           Ptr (Elem (ConstantArray 3 CInt)) -> IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_1@
+hs_bindgen_5c9712c1e2ca2187 = fmap fromFFIType hs_bindgen_5c9712c1e2ca2187_base
+{-# NOINLINE fun_1_funptr #-}
+{-| Array of known size.
+
+    __C declaration:__ @fun_1@
+
+    __defined at:__ @arrays\/array.h 118:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_funptr :: FunPtr (CInt ->
+                        Ptr (Elem (ConstantArray 3 CInt)) -> IO CInt)
+{-| Array of known size.
+
+    __C declaration:__ @fun_1@
+
+    __defined at:__ @arrays\/array.h 118:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_funptr = unsafePerformIO hs_bindgen_5c9712c1e2ca2187
+-- __unique:__ @test_arraysarray_Example_get_fun_2@
+foreign import ccall unsafe "hs_bindgen_215c9a69aea5166e" hs_bindgen_215c9a69aea5166e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_2@
+hs_bindgen_215c9a69aea5166e :: IO (FunPtr (Ptr (Elem Triplet) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_2@
+hs_bindgen_215c9a69aea5166e = fmap fromFFIType hs_bindgen_215c9a69aea5166e_base
+{-# NOINLINE fun_2_funptr #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2@
+
+    __defined at:__ @arrays\/array.h 121:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_funptr :: FunPtr (Ptr (Elem Triplet) -> IO CInt)
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2@
+
+    __defined at:__ @arrays\/array.h 121:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_funptr = unsafePerformIO hs_bindgen_215c9a69aea5166e
+-- __unique:__ @test_arraysarray_Example_get_fun_3@
+foreign import ccall unsafe "hs_bindgen_d45ffb769078021d" hs_bindgen_d45ffb769078021d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_3@
+hs_bindgen_d45ffb769078021d :: IO (FunPtr (Ptr (Elem (IncompleteArray CInt)) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_3@
+hs_bindgen_d45ffb769078021d = fmap fromFFIType hs_bindgen_d45ffb769078021d_base
+{-# NOINLINE fun_3_funptr #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3@
+
+    __defined at:__ @arrays\/array.h 124:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_funptr :: FunPtr (Ptr (Elem (IncompleteArray CInt)) ->
+                        IO CInt)
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3@
+
+    __defined at:__ @arrays\/array.h 124:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_funptr = unsafePerformIO hs_bindgen_d45ffb769078021d
+-- __unique:__ @test_arraysarray_Example_get_fun_4@
+foreign import ccall unsafe "hs_bindgen_16f300d083285e38" hs_bindgen_16f300d083285e38_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_4@
+hs_bindgen_16f300d083285e38 :: IO (FunPtr (Ptr (Elem List) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_4@
+hs_bindgen_16f300d083285e38 = fmap fromFFIType hs_bindgen_16f300d083285e38_base
+{-# NOINLINE fun_4_funptr #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4@
+
+    __defined at:__ @arrays\/array.h 127:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_funptr :: FunPtr (Ptr (Elem List) -> IO CInt)
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4@
+
+    __defined at:__ @arrays\/array.h 127:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_funptr = unsafePerformIO hs_bindgen_16f300d083285e38
+-- __unique:__ @test_arraysarray_Example_get_fun_5@
+foreign import ccall unsafe "hs_bindgen_05ddc0274405d6f5" hs_bindgen_05ddc0274405d6f5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_5@
+hs_bindgen_05ddc0274405d6f5 :: IO (FunPtr (Ptr (Elem (ConstantArray 4
+                                                                    (ConstantArray 3 CInt))) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_5@
+hs_bindgen_05ddc0274405d6f5 = fmap fromFFIType hs_bindgen_05ddc0274405d6f5_base
+{-# NOINLINE fun_5_funptr #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5@
+
+    __defined at:__ @arrays\/array.h 130:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_funptr :: FunPtr (Ptr (Elem (ConstantArray 4
+                                                 (ConstantArray 3 CInt))) ->
+                        IO CInt)
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5@
+
+    __defined at:__ @arrays\/array.h 130:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_funptr = unsafePerformIO hs_bindgen_05ddc0274405d6f5
+-- __unique:__ @test_arraysarray_Example_get_fun_6@
+foreign import ccall unsafe "hs_bindgen_bc6a8e5360af8799" hs_bindgen_bc6a8e5360af8799_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_6@
+hs_bindgen_bc6a8e5360af8799 :: IO (FunPtr (Ptr (Elem Matrix) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_6@
+hs_bindgen_bc6a8e5360af8799 = fmap fromFFIType hs_bindgen_bc6a8e5360af8799_base
+{-# NOINLINE fun_6_funptr #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6@
+
+    __defined at:__ @arrays\/array.h 133:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_funptr :: FunPtr (Ptr (Elem Matrix) -> IO CInt)
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6@
+
+    __defined at:__ @arrays\/array.h 133:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_funptr = unsafePerformIO hs_bindgen_bc6a8e5360af8799
+-- __unique:__ @test_arraysarray_Example_get_fun_7@
+foreign import ccall unsafe "hs_bindgen_b633a17af8e60afd" hs_bindgen_b633a17af8e60afd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_7@
+hs_bindgen_b633a17af8e60afd :: IO (FunPtr (Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                                                     CInt))) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_7@
+hs_bindgen_b633a17af8e60afd = fmap fromFFIType hs_bindgen_b633a17af8e60afd_base
+{-# NOINLINE fun_7_funptr #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7@
+
+    __defined at:__ @arrays\/array.h 136:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_funptr :: FunPtr (Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                                  CInt))) ->
+                        IO CInt)
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7@
+
+    __defined at:__ @arrays\/array.h 136:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_funptr = unsafePerformIO hs_bindgen_b633a17af8e60afd
+-- __unique:__ @test_arraysarray_Example_get_fun_8@
+foreign import ccall unsafe "hs_bindgen_0801bc85e75e7232" hs_bindgen_0801bc85e75e7232_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_8@
+hs_bindgen_0801bc85e75e7232 :: IO (FunPtr (Ptr (Elem Tripletlist) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_8@
+hs_bindgen_0801bc85e75e7232 = fmap fromFFIType hs_bindgen_0801bc85e75e7232_base
+{-# NOINLINE fun_8_funptr #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8@
+
+    __defined at:__ @arrays\/array.h 139:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_funptr :: FunPtr (Ptr (Elem Tripletlist) -> IO CInt)
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8@
+
+    __defined at:__ @arrays\/array.h 139:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_funptr = unsafePerformIO hs_bindgen_0801bc85e75e7232
+-- __unique:__ @test_arraysarray_Example_get_isSolved@
+foreign import ccall unsafe "hs_bindgen_f525d0058f613e21" hs_bindgen_f525d0058f613e21_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_isSolved@
+hs_bindgen_f525d0058f613e21 :: IO (FunPtr (Ptr (Elem Sudoku) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_isSolved@
+hs_bindgen_f525d0058f613e21 = fmap fromFFIType hs_bindgen_f525d0058f613e21_base
+{-# NOINLINE isSolved_funptr #-}
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved@
+
+    __defined at:__ @arrays\/array.h 142:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_funptr :: FunPtr (Ptr (Elem Sudoku) -> IO CInt)
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved@
+
+    __defined at:__ @arrays\/array.h 142:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_funptr = unsafePerformIO hs_bindgen_f525d0058f613e21
+-- __unique:__ @test_arraysarray_Example_get_fun_1_const@
+foreign import ccall unsafe "hs_bindgen_0fdde9c360622daf" hs_bindgen_0fdde9c360622daf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_1_const@
+hs_bindgen_0fdde9c360622daf :: IO (FunPtr (CInt ->
+                                           Ptr (Elem (ConstantArray 3 CInt)) ->
+                                           PtrConst (Elem (ConstantArray 3 CInt)) -> IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_1_const@
+hs_bindgen_0fdde9c360622daf = fmap fromFFIType hs_bindgen_0fdde9c360622daf_base
+{-# NOINLINE fun_1_const_funptr #-}
+{-| Array of known size.
+
+    __C declaration:__ @fun_1_const@
+
+    __defined at:__ @arrays\/array.h 149:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_const_funptr :: FunPtr (CInt ->
+                              Ptr (Elem (ConstantArray 3 CInt)) ->
+                              PtrConst (Elem (ConstantArray 3 CInt)) -> IO CInt)
+{-| Array of known size.
+
+    __C declaration:__ @fun_1_const@
+
+    __defined at:__ @arrays\/array.h 149:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_1_const_funptr = unsafePerformIO hs_bindgen_0fdde9c360622daf
+-- __unique:__ @test_arraysarray_Example_get_fun_2_const@
+foreign import ccall unsafe "hs_bindgen_8182488430e66fdc" hs_bindgen_8182488430e66fdc_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_2_const@
+hs_bindgen_8182488430e66fdc :: IO (FunPtr (Ptr (Elem Triplet) ->
+                                           PtrConst (Elem Triplet) -> IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_2_const@
+hs_bindgen_8182488430e66fdc = fmap fromFFIType hs_bindgen_8182488430e66fdc_base
+{-# NOINLINE fun_2_const_funptr #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2_const@
+
+    __defined at:__ @arrays\/array.h 152:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_const_funptr :: FunPtr (Ptr (Elem Triplet) ->
+                              PtrConst (Elem Triplet) -> IO CInt)
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_2_const@
+
+    __defined at:__ @arrays\/array.h 152:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_2_const_funptr = unsafePerformIO hs_bindgen_8182488430e66fdc
+-- __unique:__ @test_arraysarray_Example_get_fun_3_const@
+foreign import ccall unsafe "hs_bindgen_2303f5a2f855a6e5" hs_bindgen_2303f5a2f855a6e5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_3_const@
+hs_bindgen_2303f5a2f855a6e5 :: IO (FunPtr (Ptr (Elem (IncompleteArray CInt)) ->
+                                           PtrConst (Elem (IncompleteArray CInt)) -> IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_3_const@
+hs_bindgen_2303f5a2f855a6e5 = fmap fromFFIType hs_bindgen_2303f5a2f855a6e5_base
+{-# NOINLINE fun_3_const_funptr #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3_const@
+
+    __defined at:__ @arrays\/array.h 155:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_const_funptr :: FunPtr (Ptr (Elem (IncompleteArray CInt)) ->
+                              PtrConst (Elem (IncompleteArray CInt)) -> IO CInt)
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_3_const@
+
+    __defined at:__ @arrays\/array.h 155:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_3_const_funptr = unsafePerformIO hs_bindgen_2303f5a2f855a6e5
+-- __unique:__ @test_arraysarray_Example_get_fun_4_const@
+foreign import ccall unsafe "hs_bindgen_4570b26d96819cd9" hs_bindgen_4570b26d96819cd9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_4_const@
+hs_bindgen_4570b26d96819cd9 :: IO (FunPtr (Ptr (Elem List) ->
+                                           PtrConst (Elem List) -> IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_4_const@
+hs_bindgen_4570b26d96819cd9 = fmap fromFFIType hs_bindgen_4570b26d96819cd9_base
+{-# NOINLINE fun_4_const_funptr #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4_const@
+
+    __defined at:__ @arrays\/array.h 158:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_const_funptr :: FunPtr (Ptr (Elem List) ->
+                              PtrConst (Elem List) -> IO CInt)
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_4_const@
+
+    __defined at:__ @arrays\/array.h 158:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_4_const_funptr = unsafePerformIO hs_bindgen_4570b26d96819cd9
+-- __unique:__ @test_arraysarray_Example_get_fun_5_const@
+foreign import ccall unsafe "hs_bindgen_65a5e31cfb885928" hs_bindgen_65a5e31cfb885928_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_5_const@
+hs_bindgen_65a5e31cfb885928 :: IO (FunPtr (Ptr (Elem (ConstantArray 4
+                                                                    (ConstantArray 3 CInt))) ->
+                                           PtrConst (Elem (ConstantArray 4
+                                                                         (ConstantArray 3 CInt))) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_5_const@
+hs_bindgen_65a5e31cfb885928 = fmap fromFFIType hs_bindgen_65a5e31cfb885928_base
+{-# NOINLINE fun_5_const_funptr #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5_const@
+
+    __defined at:__ @arrays\/array.h 161:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_const_funptr :: FunPtr (Ptr (Elem (ConstantArray 4
+                                                       (ConstantArray 3 CInt))) ->
+                              PtrConst (Elem (ConstantArray 4 (ConstantArray 3 CInt))) ->
+                              IO CInt)
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_5_const@
+
+    __defined at:__ @arrays\/array.h 161:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_5_const_funptr = unsafePerformIO hs_bindgen_65a5e31cfb885928
+-- __unique:__ @test_arraysarray_Example_get_fun_6_const@
+foreign import ccall unsafe "hs_bindgen_107e8456ef4df268" hs_bindgen_107e8456ef4df268_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_6_const@
+hs_bindgen_107e8456ef4df268 :: IO (FunPtr (Ptr (Elem Matrix) ->
+                                           PtrConst (Elem Matrix) -> IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_6_const@
+hs_bindgen_107e8456ef4df268 = fmap fromFFIType hs_bindgen_107e8456ef4df268_base
+{-# NOINLINE fun_6_const_funptr #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6_const@
+
+    __defined at:__ @arrays\/array.h 164:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_const_funptr :: FunPtr (Ptr (Elem Matrix) ->
+                              PtrConst (Elem Matrix) -> IO CInt)
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_6_const@
+
+    __defined at:__ @arrays\/array.h 164:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_6_const_funptr = unsafePerformIO hs_bindgen_107e8456ef4df268
+-- __unique:__ @test_arraysarray_Example_get_fun_7_const@
+foreign import ccall unsafe "hs_bindgen_249a199499d81ca8" hs_bindgen_249a199499d81ca8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_7_const@
+hs_bindgen_249a199499d81ca8 :: IO (FunPtr (Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                                                     CInt))) ->
+                                           PtrConst (Elem (IncompleteArray (ConstantArray 3
+                                                                                          CInt))) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_7_const@
+hs_bindgen_249a199499d81ca8 = fmap fromFFIType hs_bindgen_249a199499d81ca8_base
+{-# NOINLINE fun_7_const_funptr #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7_const@
+
+    __defined at:__ @arrays\/array.h 167:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_const_funptr :: FunPtr (Ptr (Elem (IncompleteArray (ConstantArray 3
+                                                                        CInt))) ->
+                              PtrConst (Elem (IncompleteArray (ConstantArray 3 CInt))) ->
+                              IO CInt)
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_7_const@
+
+    __defined at:__ @arrays\/array.h 167:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_7_const_funptr = unsafePerformIO hs_bindgen_249a199499d81ca8
+-- __unique:__ @test_arraysarray_Example_get_fun_8_const@
+foreign import ccall unsafe "hs_bindgen_92bc0bfe006ce53c" hs_bindgen_92bc0bfe006ce53c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_8_const@
+hs_bindgen_92bc0bfe006ce53c :: IO (FunPtr (Ptr (Elem Tripletlist) ->
+                                           PtrConst (Elem Tripletlist) -> IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_fun_8_const@
+hs_bindgen_92bc0bfe006ce53c = fmap fromFFIType hs_bindgen_92bc0bfe006ce53c_base
+{-# NOINLINE fun_8_const_funptr #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8_const@
+
+    __defined at:__ @arrays\/array.h 170:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_const_funptr :: FunPtr (Ptr (Elem Tripletlist) ->
+                              PtrConst (Elem Tripletlist) -> IO CInt)
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_8_const@
+
+    __defined at:__ @arrays\/array.h 170:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_8_const_funptr = unsafePerformIO hs_bindgen_92bc0bfe006ce53c
+-- __unique:__ @test_arraysarray_Example_get_isSolved_const@
+foreign import ccall unsafe "hs_bindgen_935428cb3e78f9a5" hs_bindgen_935428cb3e78f9a5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_isSolved_const@
+hs_bindgen_935428cb3e78f9a5 :: IO (FunPtr (Ptr (Elem Sudoku) ->
+                                           PtrConst (Elem Sudoku) -> IO CInt))
+-- __unique:__ @test_arraysarray_Example_get_isSolved_const@
+hs_bindgen_935428cb3e78f9a5 = fmap fromFFIType hs_bindgen_935428cb3e78f9a5_base
+{-# NOINLINE isSolved_const_funptr #-}
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved_const@
+
+    __defined at:__ @arrays\/array.h 173:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_const_funptr :: FunPtr (Ptr (Elem Sudoku) ->
+                                 PtrConst (Elem Sudoku) -> IO CInt)
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @isSolved_const@
+
+    __defined at:__ @arrays\/array.h 173:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+isSolved_const_funptr = unsafePerformIO hs_bindgen_935428cb3e78f9a5
+-- __unique:__ @test_arraysarray_Example_get_fun_9@
+foreign import ccall unsafe "hs_bindgen_c9bec6ab325b063c" hs_bindgen_c9bec6ab325b063c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_9@
+hs_bindgen_c9bec6ab325b063c :: IO (FunPtr (IO (Ptr (ConstantArray 3
+                                                                  CInt))))
+-- __unique:__ @test_arraysarray_Example_get_fun_9@
+hs_bindgen_c9bec6ab325b063c = fmap fromFFIType hs_bindgen_c9bec6ab325b063c_base
+{-# NOINLINE fun_9_funptr #-}
+{-| Array of known size.
+
+    __C declaration:__ @fun_9@
+
+    __defined at:__ @arrays\/array.h 185:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_9_funptr :: FunPtr (IO (Ptr (ConstantArray 3 CInt)))
+{-| Array of known size.
+
+    __C declaration:__ @fun_9@
+
+    __defined at:__ @arrays\/array.h 185:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_9_funptr = unsafePerformIO hs_bindgen_c9bec6ab325b063c
+-- __unique:__ @test_arraysarray_Example_get_fun_10@
+foreign import ccall unsafe "hs_bindgen_49f85263b6310047" hs_bindgen_49f85263b6310047_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_10@
+hs_bindgen_49f85263b6310047 :: IO (FunPtr (IO (Ptr Triplet)))
+-- __unique:__ @test_arraysarray_Example_get_fun_10@
+hs_bindgen_49f85263b6310047 = fmap fromFFIType hs_bindgen_49f85263b6310047_base
+{-# NOINLINE fun_10_funptr #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_10@
+
+    __defined at:__ @arrays\/array.h 188:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_10_funptr :: FunPtr (IO (Ptr Triplet))
+{-| Array of known size, typedef.
+
+    __C declaration:__ @fun_10@
+
+    __defined at:__ @arrays\/array.h 188:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_10_funptr = unsafePerformIO hs_bindgen_49f85263b6310047
+-- __unique:__ @test_arraysarray_Example_get_fun_11@
+foreign import ccall unsafe "hs_bindgen_68bdd4a6e02a046b" hs_bindgen_68bdd4a6e02a046b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_11@
+hs_bindgen_68bdd4a6e02a046b :: IO (FunPtr (IO (Ptr (IncompleteArray CInt))))
+-- __unique:__ @test_arraysarray_Example_get_fun_11@
+hs_bindgen_68bdd4a6e02a046b = fmap fromFFIType hs_bindgen_68bdd4a6e02a046b_base
+{-# NOINLINE fun_11_funptr #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_11@
+
+    __defined at:__ @arrays\/array.h 191:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_11_funptr :: FunPtr (IO (Ptr (IncompleteArray CInt)))
+{-| Array of unknown size.
+
+    __C declaration:__ @fun_11@
+
+    __defined at:__ @arrays\/array.h 191:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_11_funptr = unsafePerformIO hs_bindgen_68bdd4a6e02a046b
+-- __unique:__ @test_arraysarray_Example_get_fun_12@
+foreign import ccall unsafe "hs_bindgen_0521f5208260a928" hs_bindgen_0521f5208260a928_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_12@
+hs_bindgen_0521f5208260a928 :: IO (FunPtr (IO (Ptr List)))
+-- __unique:__ @test_arraysarray_Example_get_fun_12@
+hs_bindgen_0521f5208260a928 = fmap fromFFIType hs_bindgen_0521f5208260a928_base
+{-# NOINLINE fun_12_funptr #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_12@
+
+    __defined at:__ @arrays\/array.h 194:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_12_funptr :: FunPtr (IO (Ptr List))
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @fun_12@
+
+    __defined at:__ @arrays\/array.h 194:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_12_funptr = unsafePerformIO hs_bindgen_0521f5208260a928
+-- __unique:__ @test_arraysarray_Example_get_fun_13@
+foreign import ccall unsafe "hs_bindgen_9d0f2421c940811c" hs_bindgen_9d0f2421c940811c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_13@
+hs_bindgen_9d0f2421c940811c :: IO (FunPtr (IO (Ptr (ConstantArray 4
+                                                                  (ConstantArray 3 CInt)))))
+-- __unique:__ @test_arraysarray_Example_get_fun_13@
+hs_bindgen_9d0f2421c940811c = fmap fromFFIType hs_bindgen_9d0f2421c940811c_base
+{-# NOINLINE fun_13_funptr #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_13@
+
+    __defined at:__ @arrays\/array.h 197:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_13_funptr :: FunPtr (IO (Ptr (ConstantArray 4
+                                                (ConstantArray 3 CInt))))
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @fun_13@
+
+    __defined at:__ @arrays\/array.h 197:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_13_funptr = unsafePerformIO hs_bindgen_9d0f2421c940811c
+-- __unique:__ @test_arraysarray_Example_get_fun_14@
+foreign import ccall unsafe "hs_bindgen_50eeeb460ce92a1d" hs_bindgen_50eeeb460ce92a1d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_14@
+hs_bindgen_50eeeb460ce92a1d :: IO (FunPtr (IO (Ptr Matrix)))
+-- __unique:__ @test_arraysarray_Example_get_fun_14@
+hs_bindgen_50eeeb460ce92a1d = fmap fromFFIType hs_bindgen_50eeeb460ce92a1d_base
+{-# NOINLINE fun_14_funptr #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_14@
+
+    __defined at:__ @arrays\/array.h 200:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_14_funptr :: FunPtr (IO (Ptr Matrix))
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @fun_14@
+
+    __defined at:__ @arrays\/array.h 200:9@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_14_funptr = unsafePerformIO hs_bindgen_50eeeb460ce92a1d
+-- __unique:__ @test_arraysarray_Example_get_fun_15@
+foreign import ccall unsafe "hs_bindgen_afb15d11d3db71eb" hs_bindgen_afb15d11d3db71eb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_15@
+hs_bindgen_afb15d11d3db71eb :: IO (FunPtr (IO (Ptr (IncompleteArray (ConstantArray 3
+                                                                                   CInt)))))
+-- __unique:__ @test_arraysarray_Example_get_fun_15@
+hs_bindgen_afb15d11d3db71eb = fmap fromFFIType hs_bindgen_afb15d11d3db71eb_base
+{-# NOINLINE fun_15_funptr #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_15@
+
+    __defined at:__ @arrays\/array.h 203:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_15_funptr :: FunPtr (IO (Ptr (IncompleteArray (ConstantArray 3
+                                                                 CInt))))
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @fun_15@
+
+    __defined at:__ @arrays\/array.h 203:7@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_15_funptr = unsafePerformIO hs_bindgen_afb15d11d3db71eb
+-- __unique:__ @test_arraysarray_Example_get_fun_16@
+foreign import ccall unsafe "hs_bindgen_f41fbdca0717f85b" hs_bindgen_f41fbdca0717f85b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_fun_16@
+hs_bindgen_f41fbdca0717f85b :: IO (FunPtr (IO (Ptr Tripletlist)))
+-- __unique:__ @test_arraysarray_Example_get_fun_16@
+hs_bindgen_f41fbdca0717f85b = fmap fromFFIType hs_bindgen_f41fbdca0717f85b_base
+{-# NOINLINE fun_16_funptr #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_16@
+
+    __defined at:__ @arrays\/array.h 206:14@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_16_funptr :: FunPtr (IO (Ptr Tripletlist))
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @fun_16@
+
+    __defined at:__ @arrays\/array.h 206:14@
+
+    __exported by:__ @arrays\/array.h@
+-}
+fun_16_funptr = unsafePerformIO hs_bindgen_f41fbdca0717f85b
+-- __unique:__ @test_arraysarray_Example_get_solve@
+foreign import ccall unsafe "hs_bindgen_b219669884cf1eb6" hs_bindgen_b219669884cf1eb6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysarray_Example_get_solve@
+hs_bindgen_b219669884cf1eb6 :: IO (FunPtr (IO (Ptr Sudoku)))
+-- __unique:__ @test_arraysarray_Example_get_solve@
+hs_bindgen_b219669884cf1eb6 = fmap fromFFIType hs_bindgen_b219669884cf1eb6_base
+{-# NOINLINE solve_funptr #-}
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @solve@
+
+    __defined at:__ @arrays\/array.h 209:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+solve_funptr :: FunPtr (IO (Ptr Sudoku))
+{-| Typedef-in-typedef.
+
+    __C declaration:__ @solve@
+
+    __defined at:__ @arrays\/array.h 209:10@
+
+    __exported by:__ @arrays\/array.h@
+-}
+solve_funptr = unsafePerformIO hs_bindgen_b219669884cf1eb6
+-- __unique:__ @test_arraysarray_Example_get_arr0@
+foreign import ccall unsafe "hs_bindgen_21338ece6a009179" hs_bindgen_21338ece6a009179_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr0@
+hs_bindgen_21338ece6a009179 :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr0@
+hs_bindgen_21338ece6a009179 = fmap fromFFIType hs_bindgen_21338ece6a009179_base
+{-# NOINLINE arr0 #-}
+{-| Global, complete, not initialised.
+
+    __C declaration:__ @arr0@
+
+    __defined at:__ @arrays\/array.h 11:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr0 :: Ptr (ConstantArray 3 CInt)
+{-| Global, complete, not initialised.
+
+    __C declaration:__ @arr0@
+
+    __defined at:__ @arrays\/array.h 11:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr0 = unsafePerformIO hs_bindgen_21338ece6a009179
+-- __unique:__ @test_arraysarray_Example_get_arr1@
+foreign import ccall unsafe "hs_bindgen_a058c9f90a6e675c" hs_bindgen_a058c9f90a6e675c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr1@
+hs_bindgen_a058c9f90a6e675c :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr1@
+hs_bindgen_a058c9f90a6e675c = fmap fromFFIType hs_bindgen_a058c9f90a6e675c_base
+{-# NOINLINE arr1 #-}
+{-| Global, complete, initialised.
+
+    __C declaration:__ @arr1@
+
+    __defined at:__ @arrays\/array.h 14:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr1 :: Ptr (ConstantArray 3 CInt)
+{-| Global, complete, initialised.
+
+    __C declaration:__ @arr1@
+
+    __defined at:__ @arrays\/array.h 14:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr1 = unsafePerformIO hs_bindgen_a058c9f90a6e675c
+-- __unique:__ @test_arraysarray_Example_get_arr2@
+foreign import ccall unsafe "hs_bindgen_c57aab7f71d2cb0b" hs_bindgen_c57aab7f71d2cb0b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr2@
+hs_bindgen_c57aab7f71d2cb0b :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr2@
+hs_bindgen_c57aab7f71d2cb0b = fmap fromFFIType hs_bindgen_c57aab7f71d2cb0b_base
+{-# NOINLINE arr2 #-}
+{-| Global, extern, complete, not initialised.
+
+    __C declaration:__ @arr2@
+
+    __defined at:__ @arrays\/array.h 17:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr2 :: Ptr (ConstantArray 3 CInt)
+{-| Global, extern, complete, not initialised.
+
+    __C declaration:__ @arr2@
+
+    __defined at:__ @arrays\/array.h 17:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr2 = unsafePerformIO hs_bindgen_c57aab7f71d2cb0b
+-- __unique:__ @test_arraysarray_Example_get_arr3@
+foreign import ccall unsafe "hs_bindgen_e2b7478ee9c12746" hs_bindgen_e2b7478ee9c12746_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr3@
+hs_bindgen_e2b7478ee9c12746 :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr3@
+hs_bindgen_e2b7478ee9c12746 = fmap fromFFIType hs_bindgen_e2b7478ee9c12746_base
+{-# NOINLINE arr3 #-}
+{-| Global, extern, complete, initialised.
+
+    __C declaration:__ @arr3@
+
+    __defined at:__ @arrays\/array.h 20:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr3 :: Ptr (ConstantArray 3 CInt)
+{-| Global, extern, complete, initialised.
+
+    __C declaration:__ @arr3@
+
+    __defined at:__ @arrays\/array.h 20:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr3 = unsafePerformIO hs_bindgen_e2b7478ee9c12746
+-- __unique:__ @test_arraysarray_Example_get_arr4@
+foreign import ccall unsafe "hs_bindgen_5d33e8cdfb8c9242" hs_bindgen_5d33e8cdfb8c9242_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr4@
+hs_bindgen_5d33e8cdfb8c9242 :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr4@
+hs_bindgen_5d33e8cdfb8c9242 = fmap fromFFIType hs_bindgen_5d33e8cdfb8c9242_base
+{-# NOINLINE arr4 #-}
+{-| Global, static, complete, not initialised.
+
+    __C declaration:__ @arr4@
+
+    __defined at:__ @arrays\/array.h 23:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr4 :: Ptr (ConstantArray 3 CInt)
+{-| Global, static, complete, not initialised.
+
+    __C declaration:__ @arr4@
+
+    __defined at:__ @arrays\/array.h 23:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr4 = unsafePerformIO hs_bindgen_5d33e8cdfb8c9242
+-- __unique:__ @test_arraysarray_Example_get_arr5@
+foreign import ccall unsafe "hs_bindgen_ef557ae1941f9959" hs_bindgen_ef557ae1941f9959_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr5@
+hs_bindgen_ef557ae1941f9959 :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr5@
+hs_bindgen_ef557ae1941f9959 = fmap fromFFIType hs_bindgen_ef557ae1941f9959_base
+{-# NOINLINE arr5 #-}
+{-| Global, static, complete, initialised.
+
+    __C declaration:__ @arr5@
+
+    __defined at:__ @arrays\/array.h 26:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr5 :: Ptr (ConstantArray 3 CInt)
+{-| Global, static, complete, initialised.
+
+    __C declaration:__ @arr5@
+
+    __defined at:__ @arrays\/array.h 26:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr5 = unsafePerformIO hs_bindgen_ef557ae1941f9959
+-- __unique:__ @test_arraysarray_Example_get_arr6@
+foreign import ccall unsafe "hs_bindgen_5f4d28170d6fa0d1" hs_bindgen_5f4d28170d6fa0d1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr6@
+hs_bindgen_5f4d28170d6fa0d1 :: IO (Ptr (ConstantArray 1 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr6@
+hs_bindgen_5f4d28170d6fa0d1 = fmap fromFFIType hs_bindgen_5f4d28170d6fa0d1_base
+{-# NOINLINE arr6 #-}
+{-| Global, incomplete.
+
+    __C declaration:__ @arr6@
+
+    __defined at:__ @arrays\/array.h 29:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr6 :: Ptr (ConstantArray 1 CInt)
+{-| Global, incomplete.
+
+    __C declaration:__ @arr6@
+
+    __defined at:__ @arrays\/array.h 29:5@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr6 = unsafePerformIO hs_bindgen_5f4d28170d6fa0d1
+-- __unique:__ @test_arraysarray_Example_get_arr7@
+foreign import ccall unsafe "hs_bindgen_3b952c95c3eb17f2" hs_bindgen_3b952c95c3eb17f2_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr7@
+hs_bindgen_3b952c95c3eb17f2 :: IO (Ptr (IncompleteArray CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr7@
+hs_bindgen_3b952c95c3eb17f2 = fmap fromFFIType hs_bindgen_3b952c95c3eb17f2_base
+{-# NOINLINE arr7 #-}
+{-| Global, extern, incomplete.
+
+    __C declaration:__ @arr7@
+
+    __defined at:__ @arrays\/array.h 32:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr7 :: Ptr (IncompleteArray CInt)
+{-| Global, extern, incomplete.
+
+    __C declaration:__ @arr7@
+
+    __defined at:__ @arrays\/array.h 32:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr7 = unsafePerformIO hs_bindgen_3b952c95c3eb17f2
+-- __unique:__ @test_arraysarray_Example_get_arr8@
+foreign import ccall unsafe "hs_bindgen_fe12bb34a92772f4" hs_bindgen_fe12bb34a92772f4_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr8@
+hs_bindgen_fe12bb34a92772f4 :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr8@
+hs_bindgen_fe12bb34a92772f4 = fmap fromFFIType hs_bindgen_fe12bb34a92772f4_base
+{-# NOINLINE arr8 #-}
+{-| Global, static, incomplete.
+
+    __C declaration:__ @arr8@
+
+    __defined at:__ @arrays\/array.h 35:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr8 :: Ptr (ConstantArray 3 CInt)
+{-| Global, static, incomplete.
+
+    __C declaration:__ @arr8@
+
+    __defined at:__ @arrays\/array.h 35:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr8 = unsafePerformIO hs_bindgen_fe12bb34a92772f4
+-- __unique:__ @test_arraysarray_Example_get_arr_1@
+foreign import ccall unsafe "hs_bindgen_2d21b7cb9ac33ea8" hs_bindgen_2d21b7cb9ac33ea8_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_1@
+hs_bindgen_2d21b7cb9ac33ea8 :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr_1@
+hs_bindgen_2d21b7cb9ac33ea8 = fmap fromFFIType hs_bindgen_2d21b7cb9ac33ea8_base
+{-# NOINLINE arr_1 #-}
+{-| Array of known size.
+
+    __C declaration:__ @arr_1@
+
+    __defined at:__ @arrays\/array.h 62:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_1 :: Ptr (ConstantArray 3 CInt)
+{-| Array of known size.
+
+    __C declaration:__ @arr_1@
+
+    __defined at:__ @arrays\/array.h 62:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_1 = unsafePerformIO hs_bindgen_2d21b7cb9ac33ea8
+-- __unique:__ @test_arraysarray_Example_get_arr_2@
+foreign import ccall unsafe "hs_bindgen_df706ce2499e5073" hs_bindgen_df706ce2499e5073_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_2@
+hs_bindgen_df706ce2499e5073 :: IO (Ptr Triplet)
+-- __unique:__ @test_arraysarray_Example_get_arr_2@
+hs_bindgen_df706ce2499e5073 = fmap fromFFIType hs_bindgen_df706ce2499e5073_base
+{-# NOINLINE arr_2 #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @arr_2@
+
+    __defined at:__ @arrays\/array.h 65:16@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_2 :: Ptr Triplet
+{-| Array of known size, typedef.
+
+    __C declaration:__ @arr_2@
+
+    __defined at:__ @arrays\/array.h 65:16@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_2 = unsafePerformIO hs_bindgen_df706ce2499e5073
+-- __unique:__ @test_arraysarray_Example_get_arr_3@
+foreign import ccall unsafe "hs_bindgen_26bcbe886b94adfb" hs_bindgen_26bcbe886b94adfb_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_3@
+hs_bindgen_26bcbe886b94adfb :: IO (Ptr (IncompleteArray CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr_3@
+hs_bindgen_26bcbe886b94adfb = fmap fromFFIType hs_bindgen_26bcbe886b94adfb_base
+{-# NOINLINE arr_3 #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @arr_3@
+
+    __defined at:__ @arrays\/array.h 68:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_3 :: Ptr (IncompleteArray CInt)
+{-| Array of unknown size.
+
+    __C declaration:__ @arr_3@
+
+    __defined at:__ @arrays\/array.h 68:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_3 = unsafePerformIO hs_bindgen_26bcbe886b94adfb
+-- __unique:__ @test_arraysarray_Example_get_arr_4@
+foreign import ccall unsafe "hs_bindgen_e4cef264a5cc1887" hs_bindgen_e4cef264a5cc1887_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_4@
+hs_bindgen_e4cef264a5cc1887 :: IO (Ptr List)
+-- __unique:__ @test_arraysarray_Example_get_arr_4@
+hs_bindgen_e4cef264a5cc1887 = fmap fromFFIType hs_bindgen_e4cef264a5cc1887_base
+{-# NOINLINE arr_4 #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @arr_4@
+
+    __defined at:__ @arrays\/array.h 71:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_4 :: Ptr List
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @arr_4@
+
+    __defined at:__ @arrays\/array.h 71:13@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_4 = unsafePerformIO hs_bindgen_e4cef264a5cc1887
+-- __unique:__ @test_arraysarray_Example_get_arr_5@
+foreign import ccall unsafe "hs_bindgen_a733c5b896a8ae4e" hs_bindgen_a733c5b896a8ae4e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_5@
+hs_bindgen_a733c5b896a8ae4e :: IO (Ptr (ConstantArray 4
+                                                      (ConstantArray 3 CInt)))
+-- __unique:__ @test_arraysarray_Example_get_arr_5@
+hs_bindgen_a733c5b896a8ae4e = fmap fromFFIType hs_bindgen_a733c5b896a8ae4e_base
+{-# NOINLINE arr_5 #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @arr_5@
+
+    __defined at:__ @arrays\/array.h 74:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_5 :: Ptr (ConstantArray 4 (ConstantArray 3 CInt))
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @arr_5@
+
+    __defined at:__ @arrays\/array.h 74:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_5 = unsafePerformIO hs_bindgen_a733c5b896a8ae4e
+-- __unique:__ @test_arraysarray_Example_get_arr_6@
+foreign import ccall unsafe "hs_bindgen_525a326f0badae7c" hs_bindgen_525a326f0badae7c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_6@
+hs_bindgen_525a326f0badae7c :: IO (Ptr Matrix)
+-- __unique:__ @test_arraysarray_Example_get_arr_6@
+hs_bindgen_525a326f0badae7c = fmap fromFFIType hs_bindgen_525a326f0badae7c_base
+{-# NOINLINE arr_6 #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @arr_6@
+
+    __defined at:__ @arrays\/array.h 77:15@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_6 :: Ptr Matrix
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @arr_6@
+
+    __defined at:__ @arrays\/array.h 77:15@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_6 = unsafePerformIO hs_bindgen_525a326f0badae7c
+-- __unique:__ @test_arraysarray_Example_get_arr_7@
+foreign import ccall unsafe "hs_bindgen_b5e93d2d90ffc861" hs_bindgen_b5e93d2d90ffc861_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_7@
+hs_bindgen_b5e93d2d90ffc861 :: IO (Ptr (IncompleteArray (ConstantArray 3
+                                                                       CInt)))
+-- __unique:__ @test_arraysarray_Example_get_arr_7@
+hs_bindgen_b5e93d2d90ffc861 = fmap fromFFIType hs_bindgen_b5e93d2d90ffc861_base
+{-# NOINLINE arr_7 #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @arr_7@
+
+    __defined at:__ @arrays\/array.h 80:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_7 :: Ptr (IncompleteArray (ConstantArray 3 CInt))
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @arr_7@
+
+    __defined at:__ @arrays\/array.h 80:12@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_7 = unsafePerformIO hs_bindgen_b5e93d2d90ffc861
+-- __unique:__ @test_arraysarray_Example_get_arr_8@
+foreign import ccall unsafe "hs_bindgen_eb98aff4ee1d31d0" hs_bindgen_eb98aff4ee1d31d0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_8@
+hs_bindgen_eb98aff4ee1d31d0 :: IO (Ptr Tripletlist)
+-- __unique:__ @test_arraysarray_Example_get_arr_8@
+hs_bindgen_eb98aff4ee1d31d0 = fmap fromFFIType hs_bindgen_eb98aff4ee1d31d0_base
+{-# NOINLINE arr_8 #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @arr_8@
+
+    __defined at:__ @arrays\/array.h 83:20@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_8 :: Ptr Tripletlist
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @arr_8@
+
+    __defined at:__ @arrays\/array.h 83:20@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_8 = unsafePerformIO hs_bindgen_eb98aff4ee1d31d0
+-- __unique:__ @test_arraysarray_Example_get_arr_1_const@
+foreign import ccall unsafe "hs_bindgen_25089a5dd72254bc" hs_bindgen_25089a5dd72254bc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_1_const@
+hs_bindgen_25089a5dd72254bc :: IO (PtrConst (ConstantArray 3 CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr_1_const@
+hs_bindgen_25089a5dd72254bc = fmap fromFFIType hs_bindgen_25089a5dd72254bc_base
+{-# NOINLINE hs_bindgen_a182a929fe06593d #-}
+{-| Array of known size.
+
+    __C declaration:__ @arr_1_const@
+
+    __defined at:__ @arrays\/array.h 90:18@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_1_const@
+-}
+hs_bindgen_a182a929fe06593d :: PtrConst (ConstantArray 3 CInt)
+{-| Array of known size.
+
+    __C declaration:__ @arr_1_const@
+
+    __defined at:__ @arrays\/array.h 90:18@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_1_const@
+-}
+hs_bindgen_a182a929fe06593d = unsafePerformIO hs_bindgen_25089a5dd72254bc
+{-# NOINLINE arr_1_const #-}
+arr_1_const :: ConstantArray 3 CInt
+arr_1_const = unsafePerformIO (peek hs_bindgen_a182a929fe06593d)
+-- __unique:__ @test_arraysarray_Example_get_arr_2_const@
+foreign import ccall unsafe "hs_bindgen_a55a5562a096ae11" hs_bindgen_a55a5562a096ae11_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_2_const@
+hs_bindgen_a55a5562a096ae11 :: IO (PtrConst Triplet)
+-- __unique:__ @test_arraysarray_Example_get_arr_2_const@
+hs_bindgen_a55a5562a096ae11 = fmap fromFFIType hs_bindgen_a55a5562a096ae11_base
+{-# NOINLINE hs_bindgen_40c72338f5e41246 #-}
+{-| Array of known size, typedef.
+
+    __C declaration:__ @arr_2_const@
+
+    __defined at:__ @arrays\/array.h 93:22@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_2_const@
+-}
+hs_bindgen_40c72338f5e41246 :: PtrConst Triplet
+{-| Array of known size, typedef.
+
+    __C declaration:__ @arr_2_const@
+
+    __defined at:__ @arrays\/array.h 93:22@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_2_const@
+-}
+hs_bindgen_40c72338f5e41246 = unsafePerformIO hs_bindgen_a55a5562a096ae11
+{-# NOINLINE arr_2_const #-}
+arr_2_const :: Triplet
+arr_2_const = unsafePerformIO (peek hs_bindgen_40c72338f5e41246)
+-- __unique:__ @test_arraysarray_Example_get_arr_3_const@
+foreign import ccall unsafe "hs_bindgen_fad31baeec544a6d" hs_bindgen_fad31baeec544a6d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_3_const@
+hs_bindgen_fad31baeec544a6d :: IO (PtrConst (IncompleteArray CInt))
+-- __unique:__ @test_arraysarray_Example_get_arr_3_const@
+hs_bindgen_fad31baeec544a6d = fmap fromFFIType hs_bindgen_fad31baeec544a6d_base
+{-# NOINLINE arr_3_const #-}
+{-| Array of unknown size.
+
+    __C declaration:__ @arr_3_const@
+
+    __defined at:__ @arrays\/array.h 96:18@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_3_const :: PtrConst (IncompleteArray CInt)
+{-| Array of unknown size.
+
+    __C declaration:__ @arr_3_const@
+
+    __defined at:__ @arrays\/array.h 96:18@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_3_const = unsafePerformIO hs_bindgen_fad31baeec544a6d
+-- __unique:__ @test_arraysarray_Example_get_arr_4_const@
+foreign import ccall unsafe "hs_bindgen_890c46fc872e1d7d" hs_bindgen_890c46fc872e1d7d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_4_const@
+hs_bindgen_890c46fc872e1d7d :: IO (PtrConst List)
+-- __unique:__ @test_arraysarray_Example_get_arr_4_const@
+hs_bindgen_890c46fc872e1d7d = fmap fromFFIType hs_bindgen_890c46fc872e1d7d_base
+{-# NOINLINE arr_4_const #-}
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @arr_4_const@
+
+    __defined at:__ @arrays\/array.h 99:19@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_4_const :: PtrConst List
+{-| Array of unknown size, typedef.
+
+    __C declaration:__ @arr_4_const@
+
+    __defined at:__ @arrays\/array.h 99:19@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_4_const = unsafePerformIO hs_bindgen_890c46fc872e1d7d
+-- __unique:__ @test_arraysarray_Example_get_arr_5_const@
+foreign import ccall unsafe "hs_bindgen_088c9ea4e73d1cfe" hs_bindgen_088c9ea4e73d1cfe_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_5_const@
+hs_bindgen_088c9ea4e73d1cfe :: IO (PtrConst (ConstantArray 4
+                                                           (ConstantArray 3 CInt)))
+-- __unique:__ @test_arraysarray_Example_get_arr_5_const@
+hs_bindgen_088c9ea4e73d1cfe = fmap fromFFIType hs_bindgen_088c9ea4e73d1cfe_base
+{-# NOINLINE hs_bindgen_be82907b3025ae62 #-}
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @arr_5_const@
+
+    __defined at:__ @arrays\/array.h 102:18@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_5_const@
+-}
+hs_bindgen_be82907b3025ae62 :: PtrConst (ConstantArray 4
+                                                       (ConstantArray 3 CInt))
+{-| Multi-dimensional array of known size.
+
+    __C declaration:__ @arr_5_const@
+
+    __defined at:__ @arrays\/array.h 102:18@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_5_const@
+-}
+hs_bindgen_be82907b3025ae62 = unsafePerformIO hs_bindgen_088c9ea4e73d1cfe
+{-# NOINLINE arr_5_const #-}
+arr_5_const :: ConstantArray 4 (ConstantArray 3 CInt)
+arr_5_const = unsafePerformIO (peek hs_bindgen_be82907b3025ae62)
+-- __unique:__ @test_arraysarray_Example_get_arr_6_const@
+foreign import ccall unsafe "hs_bindgen_bf69f287b3bf9fa4" hs_bindgen_bf69f287b3bf9fa4_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_6_const@
+hs_bindgen_bf69f287b3bf9fa4 :: IO (PtrConst Matrix)
+-- __unique:__ @test_arraysarray_Example_get_arr_6_const@
+hs_bindgen_bf69f287b3bf9fa4 = fmap fromFFIType hs_bindgen_bf69f287b3bf9fa4_base
+{-# NOINLINE hs_bindgen_50556ee70fdb04aa #-}
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @arr_6_const@
+
+    __defined at:__ @arrays\/array.h 105:21@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_6_const@
+-}
+hs_bindgen_50556ee70fdb04aa :: PtrConst Matrix
+{-| Multi-dimensional array of known size, typedef.
+
+    __C declaration:__ @arr_6_const@
+
+    __defined at:__ @arrays\/array.h 105:21@
+
+    __exported by:__ @arrays\/array.h@
+
+    __unique:__ @test_arraysarray_Example_arr_6_const@
+-}
+hs_bindgen_50556ee70fdb04aa = unsafePerformIO hs_bindgen_bf69f287b3bf9fa4
+{-# NOINLINE arr_6_const #-}
+arr_6_const :: Matrix
+arr_6_const = unsafePerformIO (peek hs_bindgen_50556ee70fdb04aa)
+-- __unique:__ @test_arraysarray_Example_get_arr_7_const@
+foreign import ccall unsafe "hs_bindgen_2ca44942791eacc4" hs_bindgen_2ca44942791eacc4_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_7_const@
+hs_bindgen_2ca44942791eacc4 :: IO (PtrConst (IncompleteArray (ConstantArray 3
+                                                                            CInt)))
+-- __unique:__ @test_arraysarray_Example_get_arr_7_const@
+hs_bindgen_2ca44942791eacc4 = fmap fromFFIType hs_bindgen_2ca44942791eacc4_base
+{-# NOINLINE arr_7_const #-}
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @arr_7_const@
+
+    __defined at:__ @arrays\/array.h 108:18@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_7_const :: PtrConst (IncompleteArray (ConstantArray 3 CInt))
+{-| Multi-dimensional array of unknown size.
+
+    __C declaration:__ @arr_7_const@
+
+    __defined at:__ @arrays\/array.h 108:18@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_7_const = unsafePerformIO hs_bindgen_2ca44942791eacc4
+-- __unique:__ @test_arraysarray_Example_get_arr_8_const@
+foreign import ccall unsafe "hs_bindgen_3e95fdf3b641c349" hs_bindgen_3e95fdf3b641c349_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_arraysarray_Example_get_arr_8_const@
+hs_bindgen_3e95fdf3b641c349 :: IO (PtrConst Tripletlist)
+-- __unique:__ @test_arraysarray_Example_get_arr_8_const@
+hs_bindgen_3e95fdf3b641c349 = fmap fromFFIType hs_bindgen_3e95fdf3b641c349_base
+{-# NOINLINE arr_8_const #-}
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @arr_8_const@
+
+    __defined at:__ @arrays\/array.h 111:26@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_8_const :: PtrConst Tripletlist
+{-| Multi-dimensional array of unknown size, typedef.
+
+    __C declaration:__ @arr_8_const@
+
+    __defined at:__ @arrays\/array.h 111:26@
+
+    __exported by:__ @arrays\/array.h@
+-}
+arr_8_const = unsafePerformIO hs_bindgen_3e95fdf3b641c349
diff --git a/test-artefacts/fixtures/arrays/const_qualifier/Example.hs b/test-artefacts/fixtures/arrays/const_qualifier/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/const_qualifier/Example.hs
@@ -0,0 +1,242 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    , Example.T(..)
+    , Example.U(..)
+    , Example.V(..)
+    , Example.W(..)
+    , Example.X(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Eq, Show, type (~))
+
+{-| __C declaration:__ @S@
+
+    __defined at:__ @arrays\/const_qualifier.h 7:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype S = S
+  { unwrapS :: IA.IncompleteArray BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapS" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S {unwrapS = y1}, BG.getField @"unwrapS" x0)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.HasField "unwrapS" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapS")
+
+instance HasCField.HasCField S "unwrapS" where
+
+  type CFieldType S "unwrapS" =
+    IA.IncompleteArray BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @arrays\/const_qualifier.h 8:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype T = T
+  { unwrapT :: IA.IncompleteArray BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" =
+    IA.IncompleteArray BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @U@
+
+    __defined at:__ @arrays\/const_qualifier.h 18:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype U = U
+  { unwrapU :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapU" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> U {unwrapU = y1}, BG.getField @"unwrapU" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapU" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapU")
+
+instance HasCField.HasCField U "unwrapU" where
+
+  type CFieldType U "unwrapU" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @V@
+
+    __defined at:__ @arrays\/const_qualifier.h 19:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype V = V
+  { unwrapV :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapV" V ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> V {unwrapV = y1}, BG.getField @"unwrapV" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapV" (BG.Ptr V) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapV")
+
+instance HasCField.HasCField V "unwrapV" where
+
+  type CFieldType V "unwrapV" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @W@
+
+    __defined at:__ @arrays\/const_qualifier.h 29:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype W = W
+  { unwrapW :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapW" W ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> W {unwrapW = y1}, BG.getField @"unwrapW" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapW" (BG.Ptr W) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapW")
+
+instance HasCField.HasCField W "unwrapW" where
+
+  type CFieldType W "unwrapW" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @X@
+
+    __defined at:__ @arrays\/const_qualifier.h 30:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype X = X
+  { unwrapX :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapX" X ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> X {unwrapX = y1}, BG.getField @"unwrapX" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapX" (BG.Ptr X) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapX")
+
+instance HasCField.HasCField X "unwrapX" where
+
+  type CFieldType X "unwrapX" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/arrays/const_qualifier/Example/FunPtr.hs b/test-artefacts/fixtures/arrays/const_qualifier/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/const_qualifier/Example/FunPtr.hs
@@ -0,0 +1,358 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.bar
+    , Example.FunPtr.barA
+    , Example.FunPtr.barB
+    , Example.FunPtr.barC
+    , Example.FunPtr.baz
+    , Example.FunPtr.bazA
+    , Example.FunPtr.bazB
+    , Example.FunPtr.bazC
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/const_qualifier.h>"
+  , "/* test_arraysconst_qualifier_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_08ac8ef9de29103e (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_54fbf41deabb186a (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_639b20c53a422f2a (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fef335c60d51fed2 (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_20a55b314c10f7b0 (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_barA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d75c925bc91f45d8 (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &barA;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_barB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_aecd16e35ff42812 (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &barB;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_barC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7b514bc063bee42a (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &barC;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_baz */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_4839eb9bacfd303d (void)) ("
+  , "  signed int const (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return &baz;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_bazA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0ada0d6bbdb28946 (void)) ("
+  , "  W *arg1"
+  , ")"
+  , "{"
+  , "  return &bazA;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_bazB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d035691c9268d21a (void)) ("
+  , "  W const *arg1"
+  , ")"
+  , "{"
+  , "  return &bazB;"
+  , "}"
+  , "/* test_arraysconst_qualifier_Example_get_bazC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fc2dfbe62c6dc8b1 (void)) ("
+  , "  X const *arg1"
+  , ")"
+  , "{"
+  , "  return &bazC;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_08ac8ef9de29103e" hs_bindgen_08ac8ef9de29103e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_foo@
+hs_bindgen_08ac8ef9de29103e :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ()))
+hs_bindgen_08ac8ef9de29103e =
+  fmap BG.fromFFIType hs_bindgen_08ac8ef9de29103e_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/const_qualifier.h 5:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+foo :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_08ac8ef9de29103e
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_54fbf41deabb186a" hs_bindgen_54fbf41deabb186a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooA@
+hs_bindgen_54fbf41deabb186a :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem S) -> IO ()))
+hs_bindgen_54fbf41deabb186a =
+  fmap BG.fromFFIType hs_bindgen_54fbf41deabb186a_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @arrays\/const_qualifier.h 10:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooA :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem S) -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_54fbf41deabb186a
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_639b20c53a422f2a" hs_bindgen_639b20c53a422f2a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooB@
+hs_bindgen_639b20c53a422f2a :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem S) -> IO ()))
+hs_bindgen_639b20c53a422f2a =
+  fmap BG.fromFFIType hs_bindgen_639b20c53a422f2a_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @arrays\/const_qualifier.h 11:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooB :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem S) -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_639b20c53a422f2a
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_fef335c60d51fed2" hs_bindgen_fef335c60d51fed2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooC@
+hs_bindgen_fef335c60d51fed2 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem T) -> IO ()))
+hs_bindgen_fef335c60d51fed2 =
+  fmap BG.fromFFIType hs_bindgen_fef335c60d51fed2_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @arrays\/const_qualifier.h 12:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooC :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem T) -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_fef335c60d51fed2
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_20a55b314c10f7b0" hs_bindgen_20a55b314c10f7b0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bar@
+hs_bindgen_20a55b314c10f7b0 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> IO ()))
+hs_bindgen_20a55b314c10f7b0 =
+  fmap BG.fromFFIType hs_bindgen_20a55b314c10f7b0_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/const_qualifier.h 16:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bar :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_20a55b314c10f7b0
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barA@
+foreign import ccall unsafe "hs_bindgen_d75c925bc91f45d8" hs_bindgen_d75c925bc91f45d8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barA@
+hs_bindgen_d75c925bc91f45d8 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem U) -> IO ()))
+hs_bindgen_d75c925bc91f45d8 =
+  fmap BG.fromFFIType hs_bindgen_d75c925bc91f45d8_base
+
+{-# NOINLINE barA #-}
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @arrays\/const_qualifier.h 21:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barA :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem U) -> IO ())
+barA = BG.unsafePerformIO hs_bindgen_d75c925bc91f45d8
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barB@
+foreign import ccall unsafe "hs_bindgen_aecd16e35ff42812" hs_bindgen_aecd16e35ff42812_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barB@
+hs_bindgen_aecd16e35ff42812 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem U) -> IO ()))
+hs_bindgen_aecd16e35ff42812 =
+  fmap BG.fromFFIType hs_bindgen_aecd16e35ff42812_base
+
+{-# NOINLINE barB #-}
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @arrays\/const_qualifier.h 22:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barB :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem U) -> IO ())
+barB = BG.unsafePerformIO hs_bindgen_aecd16e35ff42812
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barC@
+foreign import ccall unsafe "hs_bindgen_7b514bc063bee42a" hs_bindgen_7b514bc063bee42a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barC@
+hs_bindgen_7b514bc063bee42a :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem V) -> IO ()))
+hs_bindgen_7b514bc063bee42a =
+  fmap BG.fromFFIType hs_bindgen_7b514bc063bee42a_base
+
+{-# NOINLINE barC #-}
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @arrays\/const_qualifier.h 23:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barC :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem V) -> IO ())
+barC = BG.unsafePerformIO hs_bindgen_7b514bc063bee42a
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_4839eb9bacfd303d" hs_bindgen_4839eb9bacfd303d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_baz@
+hs_bindgen_4839eb9bacfd303d :: IO (BG.FunPtr (PtrConst.PtrConst (CA.ConstantArray 3 BG.CInt) -> IO ()))
+hs_bindgen_4839eb9bacfd303d =
+  fmap BG.fromFFIType hs_bindgen_4839eb9bacfd303d_base
+
+{-# NOINLINE baz #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/const_qualifier.h 27:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+baz :: BG.FunPtr (PtrConst.PtrConst (CA.ConstantArray 3 BG.CInt) -> IO ())
+baz = BG.unsafePerformIO hs_bindgen_4839eb9bacfd303d
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazA@
+foreign import ccall unsafe "hs_bindgen_0ada0d6bbdb28946" hs_bindgen_0ada0d6bbdb28946_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazA@
+hs_bindgen_0ada0d6bbdb28946 :: IO (BG.FunPtr (PtrConst.PtrConst W -> IO ()))
+hs_bindgen_0ada0d6bbdb28946 =
+  fmap BG.fromFFIType hs_bindgen_0ada0d6bbdb28946_base
+
+{-# NOINLINE bazA #-}
+{-| __C declaration:__ @bazA@
+
+    __defined at:__ @arrays\/const_qualifier.h 32:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazA :: BG.FunPtr (PtrConst.PtrConst W -> IO ())
+bazA = BG.unsafePerformIO hs_bindgen_0ada0d6bbdb28946
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazB@
+foreign import ccall unsafe "hs_bindgen_d035691c9268d21a" hs_bindgen_d035691c9268d21a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazB@
+hs_bindgen_d035691c9268d21a :: IO (BG.FunPtr (PtrConst.PtrConst W -> IO ()))
+hs_bindgen_d035691c9268d21a =
+  fmap BG.fromFFIType hs_bindgen_d035691c9268d21a_base
+
+{-# NOINLINE bazB #-}
+{-| __C declaration:__ @bazB@
+
+    __defined at:__ @arrays\/const_qualifier.h 33:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazB :: BG.FunPtr (PtrConst.PtrConst W -> IO ())
+bazB = BG.unsafePerformIO hs_bindgen_d035691c9268d21a
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazC@
+foreign import ccall unsafe "hs_bindgen_fc2dfbe62c6dc8b1" hs_bindgen_fc2dfbe62c6dc8b1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazC@
+hs_bindgen_fc2dfbe62c6dc8b1 :: IO (BG.FunPtr (PtrConst.PtrConst X -> IO ()))
+hs_bindgen_fc2dfbe62c6dc8b1 =
+  fmap BG.fromFFIType hs_bindgen_fc2dfbe62c6dc8b1_base
+
+{-# NOINLINE bazC #-}
+{-| __C declaration:__ @bazC@
+
+    __defined at:__ @arrays\/const_qualifier.h 34:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazC :: BG.FunPtr (PtrConst.PtrConst X -> IO ())
+bazC = BG.unsafePerformIO hs_bindgen_fc2dfbe62c6dc8b1
diff --git a/test-artefacts/fixtures/arrays/const_qualifier/Example/Safe.hs b/test-artefacts/fixtures/arrays/const_qualifier/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/const_qualifier/Example/Safe.hs
@@ -0,0 +1,406 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.bar
+    , Example.Safe.barA
+    , Example.Safe.barB
+    , Example.Safe.barC
+    , Example.Safe.baz
+    , Example.Safe.bazA
+    , Example.Safe.bazB
+    , Example.Safe.bazC
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/const_qualifier.h>"
+  , "void hs_bindgen_41e3579627406714 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_ef925a32def7d5e9 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_4237cee8985eb7fc ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_dc3d2325cbc25f6e ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_0820d6c6e877663d ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_bb3ba1c8635c0008 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (barA)(arg1);"
+  , "}"
+  , "void hs_bindgen_63794b19284a8cd9 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (barB)(arg1);"
+  , "}"
+  , "void hs_bindgen_e936f5907d7bdf9b ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (barC)(arg1);"
+  , "}"
+  , "void hs_bindgen_e4f32da8a7d205db ("
+  , "  signed int const (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  (baz)(arg1);"
+  , "}"
+  , "void hs_bindgen_abced453716ffe1c ("
+  , "  W *arg1"
+  , ")"
+  , "{"
+  , "  (bazA)(arg1);"
+  , "}"
+  , "void hs_bindgen_4602d92b6dafcfa7 ("
+  , "  W const *arg1"
+  , ")"
+  , "{"
+  , "  (bazB)(arg1);"
+  , "}"
+  , "void hs_bindgen_b49b704068741c9c ("
+  , "  X const *arg1"
+  , ")"
+  , "{"
+  , "  (bazC)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_41e3579627406714" hs_bindgen_41e3579627406714_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_foo@
+hs_bindgen_41e3579627406714 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_41e3579627406714 =
+  \x0 ->
+    hs_bindgen_41e3579627406714_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/const_qualifier.h 5:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+foo ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_41e3579627406714
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_ef925a32def7d5e9" hs_bindgen_ef925a32def7d5e9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooA@
+hs_bindgen_ef925a32def7d5e9 ::
+     PtrConst.PtrConst (IsA.Elem S)
+  -> IO ()
+hs_bindgen_ef925a32def7d5e9 =
+  \x0 ->
+    hs_bindgen_ef925a32def7d5e9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @arrays\/const_qualifier.h 10:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooA ::
+     PtrConst.PtrConst (IsA.Elem S)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_ef925a32def7d5e9
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_4237cee8985eb7fc" hs_bindgen_4237cee8985eb7fc_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooB@
+hs_bindgen_4237cee8985eb7fc ::
+     PtrConst.PtrConst (IsA.Elem S)
+  -> IO ()
+hs_bindgen_4237cee8985eb7fc =
+  \x0 ->
+    hs_bindgen_4237cee8985eb7fc_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @arrays\/const_qualifier.h 11:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooB ::
+     PtrConst.PtrConst (IsA.Elem S)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_4237cee8985eb7fc
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_dc3d2325cbc25f6e" hs_bindgen_dc3d2325cbc25f6e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooC@
+hs_bindgen_dc3d2325cbc25f6e ::
+     PtrConst.PtrConst (IsA.Elem T)
+  -> IO ()
+hs_bindgen_dc3d2325cbc25f6e =
+  \x0 ->
+    hs_bindgen_dc3d2325cbc25f6e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @arrays\/const_qualifier.h 12:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooC ::
+     PtrConst.PtrConst (IsA.Elem T)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_dc3d2325cbc25f6e
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_0820d6c6e877663d" hs_bindgen_0820d6c6e877663d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bar@
+hs_bindgen_0820d6c6e877663d ::
+     PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> IO ()
+hs_bindgen_0820d6c6e877663d =
+  \x0 ->
+    hs_bindgen_0820d6c6e877663d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/const_qualifier.h 16:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bar ::
+     PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_0820d6c6e877663d
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barA@
+foreign import ccall safe "hs_bindgen_bb3ba1c8635c0008" hs_bindgen_bb3ba1c8635c0008_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barA@
+hs_bindgen_bb3ba1c8635c0008 ::
+     PtrConst.PtrConst (IsA.Elem U)
+  -> IO ()
+hs_bindgen_bb3ba1c8635c0008 =
+  \x0 ->
+    hs_bindgen_bb3ba1c8635c0008_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @arrays\/const_qualifier.h 21:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barA ::
+     PtrConst.PtrConst (IsA.Elem U)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barA = hs_bindgen_bb3ba1c8635c0008
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barB@
+foreign import ccall safe "hs_bindgen_63794b19284a8cd9" hs_bindgen_63794b19284a8cd9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barB@
+hs_bindgen_63794b19284a8cd9 ::
+     PtrConst.PtrConst (IsA.Elem U)
+  -> IO ()
+hs_bindgen_63794b19284a8cd9 =
+  \x0 ->
+    hs_bindgen_63794b19284a8cd9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @arrays\/const_qualifier.h 22:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barB ::
+     PtrConst.PtrConst (IsA.Elem U)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barB = hs_bindgen_63794b19284a8cd9
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barC@
+foreign import ccall safe "hs_bindgen_e936f5907d7bdf9b" hs_bindgen_e936f5907d7bdf9b_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barC@
+hs_bindgen_e936f5907d7bdf9b ::
+     PtrConst.PtrConst (IsA.Elem V)
+  -> IO ()
+hs_bindgen_e936f5907d7bdf9b =
+  \x0 ->
+    hs_bindgen_e936f5907d7bdf9b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @arrays\/const_qualifier.h 23:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barC ::
+     PtrConst.PtrConst (IsA.Elem V)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barC = hs_bindgen_e936f5907d7bdf9b
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_e4f32da8a7d205db" hs_bindgen_e4f32da8a7d205db_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_baz@
+hs_bindgen_e4f32da8a7d205db ::
+     PtrConst.PtrConst (CA.ConstantArray 3 BG.CInt)
+  -> IO ()
+hs_bindgen_e4f32da8a7d205db =
+  \x0 ->
+    hs_bindgen_e4f32da8a7d205db_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/const_qualifier.h 27:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+baz ::
+     PtrConst.PtrConst (CA.ConstantArray 3 BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+baz = hs_bindgen_e4f32da8a7d205db
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazA@
+foreign import ccall safe "hs_bindgen_abced453716ffe1c" hs_bindgen_abced453716ffe1c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazA@
+hs_bindgen_abced453716ffe1c ::
+     PtrConst.PtrConst W
+  -> IO ()
+hs_bindgen_abced453716ffe1c =
+  \x0 ->
+    hs_bindgen_abced453716ffe1c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bazA@
+
+    __defined at:__ @arrays\/const_qualifier.h 32:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazA ::
+     PtrConst.PtrConst W
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bazA = hs_bindgen_abced453716ffe1c
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazB@
+foreign import ccall safe "hs_bindgen_4602d92b6dafcfa7" hs_bindgen_4602d92b6dafcfa7_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazB@
+hs_bindgen_4602d92b6dafcfa7 ::
+     PtrConst.PtrConst W
+  -> IO ()
+hs_bindgen_4602d92b6dafcfa7 =
+  \x0 ->
+    hs_bindgen_4602d92b6dafcfa7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bazB@
+
+    __defined at:__ @arrays\/const_qualifier.h 33:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazB ::
+     PtrConst.PtrConst W
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bazB = hs_bindgen_4602d92b6dafcfa7
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazC@
+foreign import ccall safe "hs_bindgen_b49b704068741c9c" hs_bindgen_b49b704068741c9c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazC@
+hs_bindgen_b49b704068741c9c ::
+     PtrConst.PtrConst X
+  -> IO ()
+hs_bindgen_b49b704068741c9c =
+  \x0 ->
+    hs_bindgen_b49b704068741c9c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bazC@
+
+    __defined at:__ @arrays\/const_qualifier.h 34:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazC ::
+     PtrConst.PtrConst X
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bazC = hs_bindgen_b49b704068741c9c
diff --git a/test-artefacts/fixtures/arrays/const_qualifier/Example/Unsafe.hs b/test-artefacts/fixtures/arrays/const_qualifier/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/const_qualifier/Example/Unsafe.hs
@@ -0,0 +1,406 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.bar
+    , Example.Unsafe.barA
+    , Example.Unsafe.barB
+    , Example.Unsafe.barC
+    , Example.Unsafe.baz
+    , Example.Unsafe.bazA
+    , Example.Unsafe.bazB
+    , Example.Unsafe.bazC
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/const_qualifier.h>"
+  , "void hs_bindgen_7eb8358d30ebb28b ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_2fc1970fe11a3461 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_58689a7e4b1d44f6 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_f88b417ee6e28c0c ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_78493aa01e9cc5da ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_bee2c20f290d25d6 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (barA)(arg1);"
+  , "}"
+  , "void hs_bindgen_71f805899a96d9f1 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (barB)(arg1);"
+  , "}"
+  , "void hs_bindgen_89af56a24c359834 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (barC)(arg1);"
+  , "}"
+  , "void hs_bindgen_71d7d347923cf6e5 ("
+  , "  signed int const (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  (baz)(arg1);"
+  , "}"
+  , "void hs_bindgen_25cc50be574bcc6c ("
+  , "  W *arg1"
+  , ")"
+  , "{"
+  , "  (bazA)(arg1);"
+  , "}"
+  , "void hs_bindgen_3fd3913cc13f61be ("
+  , "  W const *arg1"
+  , ")"
+  , "{"
+  , "  (bazB)(arg1);"
+  , "}"
+  , "void hs_bindgen_a91ac27216749da9 ("
+  , "  X const *arg1"
+  , ")"
+  , "{"
+  , "  (bazC)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_7eb8358d30ebb28b" hs_bindgen_7eb8358d30ebb28b_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_foo@
+hs_bindgen_7eb8358d30ebb28b ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_7eb8358d30ebb28b =
+  \x0 ->
+    hs_bindgen_7eb8358d30ebb28b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/const_qualifier.h 5:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+foo ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_7eb8358d30ebb28b
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_2fc1970fe11a3461" hs_bindgen_2fc1970fe11a3461_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooA@
+hs_bindgen_2fc1970fe11a3461 ::
+     PtrConst.PtrConst (IsA.Elem S)
+  -> IO ()
+hs_bindgen_2fc1970fe11a3461 =
+  \x0 ->
+    hs_bindgen_2fc1970fe11a3461_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @arrays\/const_qualifier.h 10:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooA ::
+     PtrConst.PtrConst (IsA.Elem S)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_2fc1970fe11a3461
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_58689a7e4b1d44f6" hs_bindgen_58689a7e4b1d44f6_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooB@
+hs_bindgen_58689a7e4b1d44f6 ::
+     PtrConst.PtrConst (IsA.Elem S)
+  -> IO ()
+hs_bindgen_58689a7e4b1d44f6 =
+  \x0 ->
+    hs_bindgen_58689a7e4b1d44f6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @arrays\/const_qualifier.h 11:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooB ::
+     PtrConst.PtrConst (IsA.Elem S)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_58689a7e4b1d44f6
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_f88b417ee6e28c0c" hs_bindgen_f88b417ee6e28c0c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooC@
+hs_bindgen_f88b417ee6e28c0c ::
+     PtrConst.PtrConst (IsA.Elem T)
+  -> IO ()
+hs_bindgen_f88b417ee6e28c0c =
+  \x0 ->
+    hs_bindgen_f88b417ee6e28c0c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @arrays\/const_qualifier.h 12:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooC ::
+     PtrConst.PtrConst (IsA.Elem T)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_f88b417ee6e28c0c
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_78493aa01e9cc5da" hs_bindgen_78493aa01e9cc5da_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bar@
+hs_bindgen_78493aa01e9cc5da ::
+     PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> IO ()
+hs_bindgen_78493aa01e9cc5da =
+  \x0 ->
+    hs_bindgen_78493aa01e9cc5da_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/const_qualifier.h 16:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bar ::
+     PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_78493aa01e9cc5da
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barA@
+foreign import ccall unsafe "hs_bindgen_bee2c20f290d25d6" hs_bindgen_bee2c20f290d25d6_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barA@
+hs_bindgen_bee2c20f290d25d6 ::
+     PtrConst.PtrConst (IsA.Elem U)
+  -> IO ()
+hs_bindgen_bee2c20f290d25d6 =
+  \x0 ->
+    hs_bindgen_bee2c20f290d25d6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @arrays\/const_qualifier.h 21:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barA ::
+     PtrConst.PtrConst (IsA.Elem U)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barA = hs_bindgen_bee2c20f290d25d6
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barB@
+foreign import ccall unsafe "hs_bindgen_71f805899a96d9f1" hs_bindgen_71f805899a96d9f1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barB@
+hs_bindgen_71f805899a96d9f1 ::
+     PtrConst.PtrConst (IsA.Elem U)
+  -> IO ()
+hs_bindgen_71f805899a96d9f1 =
+  \x0 ->
+    hs_bindgen_71f805899a96d9f1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @arrays\/const_qualifier.h 22:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barB ::
+     PtrConst.PtrConst (IsA.Elem U)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barB = hs_bindgen_71f805899a96d9f1
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barC@
+foreign import ccall unsafe "hs_bindgen_89af56a24c359834" hs_bindgen_89af56a24c359834_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barC@
+hs_bindgen_89af56a24c359834 ::
+     PtrConst.PtrConst (IsA.Elem V)
+  -> IO ()
+hs_bindgen_89af56a24c359834 =
+  \x0 ->
+    hs_bindgen_89af56a24c359834_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @arrays\/const_qualifier.h 23:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barC ::
+     PtrConst.PtrConst (IsA.Elem V)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barC = hs_bindgen_89af56a24c359834
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_71d7d347923cf6e5" hs_bindgen_71d7d347923cf6e5_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_baz@
+hs_bindgen_71d7d347923cf6e5 ::
+     PtrConst.PtrConst (CA.ConstantArray 3 BG.CInt)
+  -> IO ()
+hs_bindgen_71d7d347923cf6e5 =
+  \x0 ->
+    hs_bindgen_71d7d347923cf6e5_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/const_qualifier.h 27:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+baz ::
+     PtrConst.PtrConst (CA.ConstantArray 3 BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+baz = hs_bindgen_71d7d347923cf6e5
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazA@
+foreign import ccall unsafe "hs_bindgen_25cc50be574bcc6c" hs_bindgen_25cc50be574bcc6c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazA@
+hs_bindgen_25cc50be574bcc6c ::
+     PtrConst.PtrConst W
+  -> IO ()
+hs_bindgen_25cc50be574bcc6c =
+  \x0 ->
+    hs_bindgen_25cc50be574bcc6c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bazA@
+
+    __defined at:__ @arrays\/const_qualifier.h 32:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazA ::
+     PtrConst.PtrConst W
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bazA = hs_bindgen_25cc50be574bcc6c
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazB@
+foreign import ccall unsafe "hs_bindgen_3fd3913cc13f61be" hs_bindgen_3fd3913cc13f61be_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazB@
+hs_bindgen_3fd3913cc13f61be ::
+     PtrConst.PtrConst W
+  -> IO ()
+hs_bindgen_3fd3913cc13f61be =
+  \x0 ->
+    hs_bindgen_3fd3913cc13f61be_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bazB@
+
+    __defined at:__ @arrays\/const_qualifier.h 33:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazB ::
+     PtrConst.PtrConst W
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bazB = hs_bindgen_3fd3913cc13f61be
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazC@
+foreign import ccall unsafe "hs_bindgen_a91ac27216749da9" hs_bindgen_a91ac27216749da9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazC@
+hs_bindgen_a91ac27216749da9 ::
+     PtrConst.PtrConst X
+  -> IO ()
+hs_bindgen_a91ac27216749da9 =
+  \x0 ->
+    hs_bindgen_a91ac27216749da9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bazC@
+
+    __defined at:__ @arrays\/const_qualifier.h 34:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazC ::
+     PtrConst.PtrConst X
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bazC = hs_bindgen_a91ac27216749da9
diff --git a/test-artefacts/fixtures/arrays/const_qualifier/bindingspec.yaml b/test-artefacts/fixtures/arrays/const_qualifier/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/const_qualifier/bindingspec.yaml
@@ -0,0 +1,130 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: arrays/const_qualifier.h
+  cname: S
+  hsname: S
+- headers: arrays/const_qualifier.h
+  cname: T
+  hsname: T
+- headers: arrays/const_qualifier.h
+  cname: U
+  hsname: U
+- headers: arrays/const_qualifier.h
+  cname: V
+  hsname: V
+- headers: arrays/const_qualifier.h
+  cname: W
+  hsname: W
+- headers: arrays/const_qualifier.h
+  cname: X
+  hsname: X
+hstypes:
+- hsname: S
+  representation:
+    newtype:
+      constructor: S
+      fields:
+      - unwrapS
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: V
+  representation:
+    newtype:
+      constructor: V
+      fields:
+      - unwrapV
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: W
+  representation:
+    newtype:
+      constructor: W
+      fields:
+      - unwrapW
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: X
+  representation:
+    newtype:
+      constructor: X
+      fields:
+      - unwrapX
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/arrays/const_qualifier/th.txt b/test-artefacts/fixtures/arrays/const_qualifier/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/const_qualifier/th.txt
@@ -0,0 +1,1169 @@
+-- addDependentFile test-artefacts/headers/golden/arrays/const_qualifier.h
+-- #include <arrays/const_qualifier.h>
+-- void hs_bindgen_41e3579627406714 (
+--   signed int const *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_ef925a32def7d5e9 (
+--   signed int const *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_4237cee8985eb7fc (
+--   signed int const *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_dc3d2325cbc25f6e (
+--   signed int const *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_0820d6c6e877663d (
+--   signed int const *arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_bb3ba1c8635c0008 (
+--   signed int const *arg1
+-- )
+-- {
+--   (barA)(arg1);
+-- }
+-- void hs_bindgen_63794b19284a8cd9 (
+--   signed int const *arg1
+-- )
+-- {
+--   (barB)(arg1);
+-- }
+-- void hs_bindgen_e936f5907d7bdf9b (
+--   signed int const *arg1
+-- )
+-- {
+--   (barC)(arg1);
+-- }
+-- void hs_bindgen_e4f32da8a7d205db (
+--   signed int const (*arg1)[3]
+-- )
+-- {
+--   (baz)(arg1);
+-- }
+-- void hs_bindgen_abced453716ffe1c (
+--   W *arg1
+-- )
+-- {
+--   (bazA)(arg1);
+-- }
+-- void hs_bindgen_4602d92b6dafcfa7 (
+--   W const *arg1
+-- )
+-- {
+--   (bazB)(arg1);
+-- }
+-- void hs_bindgen_b49b704068741c9c (
+--   X const *arg1
+-- )
+-- {
+--   (bazC)(arg1);
+-- }
+-- void hs_bindgen_7eb8358d30ebb28b (
+--   signed int const *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_2fc1970fe11a3461 (
+--   signed int const *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_58689a7e4b1d44f6 (
+--   signed int const *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_f88b417ee6e28c0c (
+--   signed int const *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_78493aa01e9cc5da (
+--   signed int const *arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_bee2c20f290d25d6 (
+--   signed int const *arg1
+-- )
+-- {
+--   (barA)(arg1);
+-- }
+-- void hs_bindgen_71f805899a96d9f1 (
+--   signed int const *arg1
+-- )
+-- {
+--   (barB)(arg1);
+-- }
+-- void hs_bindgen_89af56a24c359834 (
+--   signed int const *arg1
+-- )
+-- {
+--   (barC)(arg1);
+-- }
+-- void hs_bindgen_71d7d347923cf6e5 (
+--   signed int const (*arg1)[3]
+-- )
+-- {
+--   (baz)(arg1);
+-- }
+-- void hs_bindgen_25cc50be574bcc6c (
+--   W *arg1
+-- )
+-- {
+--   (bazA)(arg1);
+-- }
+-- void hs_bindgen_3fd3913cc13f61be (
+--   W const *arg1
+-- )
+-- {
+--   (bazB)(arg1);
+-- }
+-- void hs_bindgen_a91ac27216749da9 (
+--   X const *arg1
+-- )
+-- {
+--   (bazC)(arg1);
+-- }
+-- /* test_arraysconst_qualifier_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_08ac8ef9de29103e (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_54fbf41deabb186a (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_639b20c53a422f2a (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fef335c60d51fed2 (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_20a55b314c10f7b0 (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_barA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d75c925bc91f45d8 (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &barA;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_barB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_aecd16e35ff42812 (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &barB;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_barC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7b514bc063bee42a (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &barC;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_baz */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_4839eb9bacfd303d (void)) (
+--   signed int const (*arg1)[3]
+-- )
+-- {
+--   return &baz;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_bazA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0ada0d6bbdb28946 (void)) (
+--   W *arg1
+-- )
+-- {
+--   return &bazA;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_bazB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d035691c9268d21a (void)) (
+--   W const *arg1
+-- )
+-- {
+--   return &bazB;
+-- }
+-- /* test_arraysconst_qualifier_Example_get_bazC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fc2dfbe62c6dc8b1 (void)) (
+--   X const *arg1
+-- )
+-- {
+--   return &bazC;
+-- }
+{-| __C declaration:__ @S@
+
+    __defined at:__ @arrays\/const_qualifier.h 7:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype S
+    = S {unwrapS :: (IncompleteArray CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray CInt) => HasField "unwrapS" S ty
+    where hasField = \x_0 -> (\y_1 -> S{unwrapS = y_1},
+                              getField @"unwrapS" x_0)
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapS" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapS")
+instance HasCField S "unwrapS"
+    where type CFieldType S "unwrapS" = IncompleteArray CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T@
+
+    __defined at:__ @arrays\/const_qualifier.h 8:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype T
+    = T {unwrapT :: (IncompleteArray CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray CInt) => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = IncompleteArray CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @U@
+
+    __defined at:__ @arrays\/const_qualifier.h 18:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype U
+    = U {unwrapU :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) => HasField "unwrapU" U ty
+    where hasField = \x_0 -> (\y_1 -> U{unwrapU = y_1},
+                              getField @"unwrapU" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapU" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapU")
+instance HasCField U "unwrapU"
+    where type CFieldType U "unwrapU" = ConstantArray 3 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @V@
+
+    __defined at:__ @arrays\/const_qualifier.h 19:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype V
+    = V {unwrapV :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) => HasField "unwrapV" V ty
+    where hasField = \x_0 -> (\y_1 -> V{unwrapV = y_1},
+                              getField @"unwrapV" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapV" (Ptr V) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapV")
+instance HasCField V "unwrapV"
+    where type CFieldType V "unwrapV" = ConstantArray 3 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @W@
+
+    __defined at:__ @arrays\/const_qualifier.h 29:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype W
+    = W {unwrapW :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) => HasField "unwrapW" W ty
+    where hasField = \x_0 -> (\y_1 -> W{unwrapW = y_1},
+                              getField @"unwrapW" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapW" (Ptr W) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapW")
+instance HasCField W "unwrapW"
+    where type CFieldType W "unwrapW" = ConstantArray 3 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @X@
+
+    __defined at:__ @arrays\/const_qualifier.h 30:19@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+newtype X
+    = X {unwrapX :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) => HasField "unwrapX" X ty
+    where hasField = \x_0 -> (\y_1 -> X{unwrapX = y_1},
+                              getField @"unwrapX" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapX" (Ptr X) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapX")
+instance HasCField X "unwrapX"
+    where type CFieldType X "unwrapX" = ConstantArray 3 CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_41e3579627406714" hs_bindgen_41e3579627406714_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_foo@
+hs_bindgen_41e3579627406714 :: PtrConst (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_foo@
+hs_bindgen_41e3579627406714 = \x_0 -> hs_bindgen_41e3579627406714_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/const_qualifier.h 5:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+foo_safe :: PtrConst (Elem (IncompleteArray CInt)) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/const_qualifier.h 5:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+foo_safe = hs_bindgen_41e3579627406714
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_ef925a32def7d5e9" hs_bindgen_ef925a32def7d5e9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooA@
+hs_bindgen_ef925a32def7d5e9 :: PtrConst (Elem S) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooA@
+hs_bindgen_ef925a32def7d5e9 = \x_0 -> hs_bindgen_ef925a32def7d5e9_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @arrays\/const_qualifier.h 10:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooA_safe :: PtrConst (Elem S) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @arrays\/const_qualifier.h 10:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooA_safe = hs_bindgen_ef925a32def7d5e9
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_4237cee8985eb7fc" hs_bindgen_4237cee8985eb7fc_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooB@
+hs_bindgen_4237cee8985eb7fc :: PtrConst (Elem S) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooB@
+hs_bindgen_4237cee8985eb7fc = \x_0 -> hs_bindgen_4237cee8985eb7fc_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @arrays\/const_qualifier.h 11:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooB_safe :: PtrConst (Elem S) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @arrays\/const_qualifier.h 11:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooB_safe = hs_bindgen_4237cee8985eb7fc
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_dc3d2325cbc25f6e" hs_bindgen_dc3d2325cbc25f6e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooC@
+hs_bindgen_dc3d2325cbc25f6e :: PtrConst (Elem T) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_fooC@
+hs_bindgen_dc3d2325cbc25f6e = \x_0 -> hs_bindgen_dc3d2325cbc25f6e_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @arrays\/const_qualifier.h 12:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooC_safe :: PtrConst (Elem T) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @arrays\/const_qualifier.h 12:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooC_safe = hs_bindgen_dc3d2325cbc25f6e
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_0820d6c6e877663d" hs_bindgen_0820d6c6e877663d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bar@
+hs_bindgen_0820d6c6e877663d :: PtrConst (Elem (ConstantArray 3
+                                                             CInt)) ->
+                               IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bar@
+hs_bindgen_0820d6c6e877663d = \x_0 -> hs_bindgen_0820d6c6e877663d_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/const_qualifier.h 16:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bar_safe :: PtrConst (Elem (ConstantArray 3 CInt)) -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/const_qualifier.h 16:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bar_safe = hs_bindgen_0820d6c6e877663d
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barA@
+foreign import ccall safe "hs_bindgen_bb3ba1c8635c0008" hs_bindgen_bb3ba1c8635c0008_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barA@
+hs_bindgen_bb3ba1c8635c0008 :: PtrConst (Elem U) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barA@
+hs_bindgen_bb3ba1c8635c0008 = \x_0 -> hs_bindgen_bb3ba1c8635c0008_base (toFFIType x_0)
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @arrays\/const_qualifier.h 21:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barA_safe :: PtrConst (Elem U) -> IO ()
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @arrays\/const_qualifier.h 21:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barA_safe = hs_bindgen_bb3ba1c8635c0008
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barB@
+foreign import ccall safe "hs_bindgen_63794b19284a8cd9" hs_bindgen_63794b19284a8cd9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barB@
+hs_bindgen_63794b19284a8cd9 :: PtrConst (Elem U) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barB@
+hs_bindgen_63794b19284a8cd9 = \x_0 -> hs_bindgen_63794b19284a8cd9_base (toFFIType x_0)
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @arrays\/const_qualifier.h 22:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barB_safe :: PtrConst (Elem U) -> IO ()
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @arrays\/const_qualifier.h 22:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barB_safe = hs_bindgen_63794b19284a8cd9
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barC@
+foreign import ccall safe "hs_bindgen_e936f5907d7bdf9b" hs_bindgen_e936f5907d7bdf9b_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barC@
+hs_bindgen_e936f5907d7bdf9b :: PtrConst (Elem V) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_barC@
+hs_bindgen_e936f5907d7bdf9b = \x_0 -> hs_bindgen_e936f5907d7bdf9b_base (toFFIType x_0)
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @arrays\/const_qualifier.h 23:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barC_safe :: PtrConst (Elem V) -> IO ()
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @arrays\/const_qualifier.h 23:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barC_safe = hs_bindgen_e936f5907d7bdf9b
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_e4f32da8a7d205db" hs_bindgen_e4f32da8a7d205db_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_baz@
+hs_bindgen_e4f32da8a7d205db :: PtrConst (ConstantArray 3 CInt) ->
+                               IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_baz@
+hs_bindgen_e4f32da8a7d205db = \x_0 -> hs_bindgen_e4f32da8a7d205db_base (toFFIType x_0)
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/const_qualifier.h 27:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+baz_safe :: PtrConst (ConstantArray 3 CInt) -> IO ()
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/const_qualifier.h 27:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+baz_safe = hs_bindgen_e4f32da8a7d205db
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazA@
+foreign import ccall safe "hs_bindgen_abced453716ffe1c" hs_bindgen_abced453716ffe1c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazA@
+hs_bindgen_abced453716ffe1c :: PtrConst W -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazA@
+hs_bindgen_abced453716ffe1c = \x_0 -> hs_bindgen_abced453716ffe1c_base (toFFIType x_0)
+{-| __C declaration:__ @bazA@
+
+    __defined at:__ @arrays\/const_qualifier.h 32:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazA_safe :: PtrConst W -> IO ()
+{-| __C declaration:__ @bazA@
+
+    __defined at:__ @arrays\/const_qualifier.h 32:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazA_safe = hs_bindgen_abced453716ffe1c
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazB@
+foreign import ccall safe "hs_bindgen_4602d92b6dafcfa7" hs_bindgen_4602d92b6dafcfa7_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazB@
+hs_bindgen_4602d92b6dafcfa7 :: PtrConst W -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazB@
+hs_bindgen_4602d92b6dafcfa7 = \x_0 -> hs_bindgen_4602d92b6dafcfa7_base (toFFIType x_0)
+{-| __C declaration:__ @bazB@
+
+    __defined at:__ @arrays\/const_qualifier.h 33:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazB_safe :: PtrConst W -> IO ()
+{-| __C declaration:__ @bazB@
+
+    __defined at:__ @arrays\/const_qualifier.h 33:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazB_safe = hs_bindgen_4602d92b6dafcfa7
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazC@
+foreign import ccall safe "hs_bindgen_b49b704068741c9c" hs_bindgen_b49b704068741c9c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazC@
+hs_bindgen_b49b704068741c9c :: PtrConst X -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Safe_bazC@
+hs_bindgen_b49b704068741c9c = \x_0 -> hs_bindgen_b49b704068741c9c_base (toFFIType x_0)
+{-| __C declaration:__ @bazC@
+
+    __defined at:__ @arrays\/const_qualifier.h 34:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazC_safe :: PtrConst X -> IO ()
+{-| __C declaration:__ @bazC@
+
+    __defined at:__ @arrays\/const_qualifier.h 34:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazC_safe = hs_bindgen_b49b704068741c9c
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_7eb8358d30ebb28b" hs_bindgen_7eb8358d30ebb28b_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_foo@
+hs_bindgen_7eb8358d30ebb28b :: PtrConst (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_foo@
+hs_bindgen_7eb8358d30ebb28b = \x_0 -> hs_bindgen_7eb8358d30ebb28b_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/const_qualifier.h 5:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+foo_unsafe :: PtrConst (Elem (IncompleteArray CInt)) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/const_qualifier.h 5:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+foo_unsafe = hs_bindgen_7eb8358d30ebb28b
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_2fc1970fe11a3461" hs_bindgen_2fc1970fe11a3461_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooA@
+hs_bindgen_2fc1970fe11a3461 :: PtrConst (Elem S) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooA@
+hs_bindgen_2fc1970fe11a3461 = \x_0 -> hs_bindgen_2fc1970fe11a3461_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @arrays\/const_qualifier.h 10:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooA_unsafe :: PtrConst (Elem S) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @arrays\/const_qualifier.h 10:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooA_unsafe = hs_bindgen_2fc1970fe11a3461
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_58689a7e4b1d44f6" hs_bindgen_58689a7e4b1d44f6_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooB@
+hs_bindgen_58689a7e4b1d44f6 :: PtrConst (Elem S) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooB@
+hs_bindgen_58689a7e4b1d44f6 = \x_0 -> hs_bindgen_58689a7e4b1d44f6_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @arrays\/const_qualifier.h 11:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooB_unsafe :: PtrConst (Elem S) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @arrays\/const_qualifier.h 11:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooB_unsafe = hs_bindgen_58689a7e4b1d44f6
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_f88b417ee6e28c0c" hs_bindgen_f88b417ee6e28c0c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooC@
+hs_bindgen_f88b417ee6e28c0c :: PtrConst (Elem T) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_fooC@
+hs_bindgen_f88b417ee6e28c0c = \x_0 -> hs_bindgen_f88b417ee6e28c0c_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @arrays\/const_qualifier.h 12:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooC_unsafe :: PtrConst (Elem T) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @arrays\/const_qualifier.h 12:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooC_unsafe = hs_bindgen_f88b417ee6e28c0c
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_78493aa01e9cc5da" hs_bindgen_78493aa01e9cc5da_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bar@
+hs_bindgen_78493aa01e9cc5da :: PtrConst (Elem (ConstantArray 3
+                                                             CInt)) ->
+                               IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bar@
+hs_bindgen_78493aa01e9cc5da = \x_0 -> hs_bindgen_78493aa01e9cc5da_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/const_qualifier.h 16:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bar_unsafe :: PtrConst (Elem (ConstantArray 3 CInt)) -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/const_qualifier.h 16:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bar_unsafe = hs_bindgen_78493aa01e9cc5da
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barA@
+foreign import ccall unsafe "hs_bindgen_bee2c20f290d25d6" hs_bindgen_bee2c20f290d25d6_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barA@
+hs_bindgen_bee2c20f290d25d6 :: PtrConst (Elem U) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barA@
+hs_bindgen_bee2c20f290d25d6 = \x_0 -> hs_bindgen_bee2c20f290d25d6_base (toFFIType x_0)
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @arrays\/const_qualifier.h 21:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barA_unsafe :: PtrConst (Elem U) -> IO ()
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @arrays\/const_qualifier.h 21:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barA_unsafe = hs_bindgen_bee2c20f290d25d6
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barB@
+foreign import ccall unsafe "hs_bindgen_71f805899a96d9f1" hs_bindgen_71f805899a96d9f1_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barB@
+hs_bindgen_71f805899a96d9f1 :: PtrConst (Elem U) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barB@
+hs_bindgen_71f805899a96d9f1 = \x_0 -> hs_bindgen_71f805899a96d9f1_base (toFFIType x_0)
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @arrays\/const_qualifier.h 22:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barB_unsafe :: PtrConst (Elem U) -> IO ()
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @arrays\/const_qualifier.h 22:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barB_unsafe = hs_bindgen_71f805899a96d9f1
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barC@
+foreign import ccall unsafe "hs_bindgen_89af56a24c359834" hs_bindgen_89af56a24c359834_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barC@
+hs_bindgen_89af56a24c359834 :: PtrConst (Elem V) -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_barC@
+hs_bindgen_89af56a24c359834 = \x_0 -> hs_bindgen_89af56a24c359834_base (toFFIType x_0)
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @arrays\/const_qualifier.h 23:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barC_unsafe :: PtrConst (Elem V) -> IO ()
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @arrays\/const_qualifier.h 23:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barC_unsafe = hs_bindgen_89af56a24c359834
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_71d7d347923cf6e5" hs_bindgen_71d7d347923cf6e5_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_baz@
+hs_bindgen_71d7d347923cf6e5 :: PtrConst (ConstantArray 3 CInt) ->
+                               IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_baz@
+hs_bindgen_71d7d347923cf6e5 = \x_0 -> hs_bindgen_71d7d347923cf6e5_base (toFFIType x_0)
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/const_qualifier.h 27:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+baz_unsafe :: PtrConst (ConstantArray 3 CInt) -> IO ()
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/const_qualifier.h 27:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+baz_unsafe = hs_bindgen_71d7d347923cf6e5
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazA@
+foreign import ccall unsafe "hs_bindgen_25cc50be574bcc6c" hs_bindgen_25cc50be574bcc6c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazA@
+hs_bindgen_25cc50be574bcc6c :: PtrConst W -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazA@
+hs_bindgen_25cc50be574bcc6c = \x_0 -> hs_bindgen_25cc50be574bcc6c_base (toFFIType x_0)
+{-| __C declaration:__ @bazA@
+
+    __defined at:__ @arrays\/const_qualifier.h 32:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazA_unsafe :: PtrConst W -> IO ()
+{-| __C declaration:__ @bazA@
+
+    __defined at:__ @arrays\/const_qualifier.h 32:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazA_unsafe = hs_bindgen_25cc50be574bcc6c
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazB@
+foreign import ccall unsafe "hs_bindgen_3fd3913cc13f61be" hs_bindgen_3fd3913cc13f61be_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazB@
+hs_bindgen_3fd3913cc13f61be :: PtrConst W -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazB@
+hs_bindgen_3fd3913cc13f61be = \x_0 -> hs_bindgen_3fd3913cc13f61be_base (toFFIType x_0)
+{-| __C declaration:__ @bazB@
+
+    __defined at:__ @arrays\/const_qualifier.h 33:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazB_unsafe :: PtrConst W -> IO ()
+{-| __C declaration:__ @bazB@
+
+    __defined at:__ @arrays\/const_qualifier.h 33:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazB_unsafe = hs_bindgen_3fd3913cc13f61be
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazC@
+foreign import ccall unsafe "hs_bindgen_a91ac27216749da9" hs_bindgen_a91ac27216749da9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazC@
+hs_bindgen_a91ac27216749da9 :: PtrConst X -> IO ()
+-- __unique:__ @test_arraysconst_qualifier_Example_Unsafe_bazC@
+hs_bindgen_a91ac27216749da9 = \x_0 -> hs_bindgen_a91ac27216749da9_base (toFFIType x_0)
+{-| __C declaration:__ @bazC@
+
+    __defined at:__ @arrays\/const_qualifier.h 34:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazC_unsafe :: PtrConst X -> IO ()
+{-| __C declaration:__ @bazC@
+
+    __defined at:__ @arrays\/const_qualifier.h 34:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazC_unsafe = hs_bindgen_a91ac27216749da9
+-- __unique:__ @test_arraysconst_qualifier_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_08ac8ef9de29103e" hs_bindgen_08ac8ef9de29103e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_foo@
+hs_bindgen_08ac8ef9de29103e :: IO (FunPtr (PtrConst (Elem (IncompleteArray CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_foo@
+hs_bindgen_08ac8ef9de29103e = fmap fromFFIType hs_bindgen_08ac8ef9de29103e_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/const_qualifier.h 5:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+foo_funptr :: FunPtr (PtrConst (Elem (IncompleteArray CInt)) ->
+                      IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/const_qualifier.h 5:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_08ac8ef9de29103e
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_54fbf41deabb186a" hs_bindgen_54fbf41deabb186a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooA@
+hs_bindgen_54fbf41deabb186a :: IO (FunPtr (PtrConst (Elem S) ->
+                                           IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooA@
+hs_bindgen_54fbf41deabb186a = fmap fromFFIType hs_bindgen_54fbf41deabb186a_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @arrays\/const_qualifier.h 10:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooA_funptr :: FunPtr (PtrConst (Elem S) -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @arrays\/const_qualifier.h 10:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_54fbf41deabb186a
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_639b20c53a422f2a" hs_bindgen_639b20c53a422f2a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooB@
+hs_bindgen_639b20c53a422f2a :: IO (FunPtr (PtrConst (Elem S) ->
+                                           IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooB@
+hs_bindgen_639b20c53a422f2a = fmap fromFFIType hs_bindgen_639b20c53a422f2a_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @arrays\/const_qualifier.h 11:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooB_funptr :: FunPtr (PtrConst (Elem S) -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @arrays\/const_qualifier.h 11:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_639b20c53a422f2a
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_fef335c60d51fed2" hs_bindgen_fef335c60d51fed2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooC@
+hs_bindgen_fef335c60d51fed2 :: IO (FunPtr (PtrConst (Elem T) ->
+                                           IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_fooC@
+hs_bindgen_fef335c60d51fed2 = fmap fromFFIType hs_bindgen_fef335c60d51fed2_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @arrays\/const_qualifier.h 12:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooC_funptr :: FunPtr (PtrConst (Elem T) -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @arrays\/const_qualifier.h 12:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_fef335c60d51fed2
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_20a55b314c10f7b0" hs_bindgen_20a55b314c10f7b0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bar@
+hs_bindgen_20a55b314c10f7b0 :: IO (FunPtr (PtrConst (Elem (ConstantArray 3
+                                                                         CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bar@
+hs_bindgen_20a55b314c10f7b0 = fmap fromFFIType hs_bindgen_20a55b314c10f7b0_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/const_qualifier.h 16:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bar_funptr :: FunPtr (PtrConst (Elem (ConstantArray 3 CInt)) ->
+                      IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/const_qualifier.h 16:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_20a55b314c10f7b0
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barA@
+foreign import ccall unsafe "hs_bindgen_d75c925bc91f45d8" hs_bindgen_d75c925bc91f45d8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barA@
+hs_bindgen_d75c925bc91f45d8 :: IO (FunPtr (PtrConst (Elem U) ->
+                                           IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barA@
+hs_bindgen_d75c925bc91f45d8 = fmap fromFFIType hs_bindgen_d75c925bc91f45d8_base
+{-# NOINLINE barA_funptr #-}
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @arrays\/const_qualifier.h 21:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barA_funptr :: FunPtr (PtrConst (Elem U) -> IO ())
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @arrays\/const_qualifier.h 21:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barA_funptr = unsafePerformIO hs_bindgen_d75c925bc91f45d8
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barB@
+foreign import ccall unsafe "hs_bindgen_aecd16e35ff42812" hs_bindgen_aecd16e35ff42812_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barB@
+hs_bindgen_aecd16e35ff42812 :: IO (FunPtr (PtrConst (Elem U) ->
+                                           IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barB@
+hs_bindgen_aecd16e35ff42812 = fmap fromFFIType hs_bindgen_aecd16e35ff42812_base
+{-# NOINLINE barB_funptr #-}
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @arrays\/const_qualifier.h 22:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barB_funptr :: FunPtr (PtrConst (Elem U) -> IO ())
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @arrays\/const_qualifier.h 22:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barB_funptr = unsafePerformIO hs_bindgen_aecd16e35ff42812
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barC@
+foreign import ccall unsafe "hs_bindgen_7b514bc063bee42a" hs_bindgen_7b514bc063bee42a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barC@
+hs_bindgen_7b514bc063bee42a :: IO (FunPtr (PtrConst (Elem V) ->
+                                           IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_barC@
+hs_bindgen_7b514bc063bee42a = fmap fromFFIType hs_bindgen_7b514bc063bee42a_base
+{-# NOINLINE barC_funptr #-}
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @arrays\/const_qualifier.h 23:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barC_funptr :: FunPtr (PtrConst (Elem V) -> IO ())
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @arrays\/const_qualifier.h 23:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+barC_funptr = unsafePerformIO hs_bindgen_7b514bc063bee42a
+-- __unique:__ @test_arraysconst_qualifier_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_4839eb9bacfd303d" hs_bindgen_4839eb9bacfd303d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_baz@
+hs_bindgen_4839eb9bacfd303d :: IO (FunPtr (PtrConst (ConstantArray 3
+                                                                   CInt) ->
+                                           IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_baz@
+hs_bindgen_4839eb9bacfd303d = fmap fromFFIType hs_bindgen_4839eb9bacfd303d_base
+{-# NOINLINE baz_funptr #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/const_qualifier.h 27:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+baz_funptr :: FunPtr (PtrConst (ConstantArray 3 CInt) -> IO ())
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/const_qualifier.h 27:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+baz_funptr = unsafePerformIO hs_bindgen_4839eb9bacfd303d
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazA@
+foreign import ccall unsafe "hs_bindgen_0ada0d6bbdb28946" hs_bindgen_0ada0d6bbdb28946_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazA@
+hs_bindgen_0ada0d6bbdb28946 :: IO (FunPtr (PtrConst W -> IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazA@
+hs_bindgen_0ada0d6bbdb28946 = fmap fromFFIType hs_bindgen_0ada0d6bbdb28946_base
+{-# NOINLINE bazA_funptr #-}
+{-| __C declaration:__ @bazA@
+
+    __defined at:__ @arrays\/const_qualifier.h 32:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazA_funptr :: FunPtr (PtrConst W -> IO ())
+{-| __C declaration:__ @bazA@
+
+    __defined at:__ @arrays\/const_qualifier.h 32:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazA_funptr = unsafePerformIO hs_bindgen_0ada0d6bbdb28946
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazB@
+foreign import ccall unsafe "hs_bindgen_d035691c9268d21a" hs_bindgen_d035691c9268d21a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazB@
+hs_bindgen_d035691c9268d21a :: IO (FunPtr (PtrConst W -> IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazB@
+hs_bindgen_d035691c9268d21a = fmap fromFFIType hs_bindgen_d035691c9268d21a_base
+{-# NOINLINE bazB_funptr #-}
+{-| __C declaration:__ @bazB@
+
+    __defined at:__ @arrays\/const_qualifier.h 33:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazB_funptr :: FunPtr (PtrConst W -> IO ())
+{-| __C declaration:__ @bazB@
+
+    __defined at:__ @arrays\/const_qualifier.h 33:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazB_funptr = unsafePerformIO hs_bindgen_d035691c9268d21a
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazC@
+foreign import ccall unsafe "hs_bindgen_fc2dfbe62c6dc8b1" hs_bindgen_fc2dfbe62c6dc8b1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazC@
+hs_bindgen_fc2dfbe62c6dc8b1 :: IO (FunPtr (PtrConst X -> IO ()))
+-- __unique:__ @test_arraysconst_qualifier_Example_get_bazC@
+hs_bindgen_fc2dfbe62c6dc8b1 = fmap fromFFIType hs_bindgen_fc2dfbe62c6dc8b1_base
+{-# NOINLINE bazC_funptr #-}
+{-| __C declaration:__ @bazC@
+
+    __defined at:__ @arrays\/const_qualifier.h 34:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazC_funptr :: FunPtr (PtrConst X -> IO ())
+{-| __C declaration:__ @bazC@
+
+    __defined at:__ @arrays\/const_qualifier.h 34:6@
+
+    __exported by:__ @arrays\/const_qualifier.h@
+-}
+bazC_funptr = unsafePerformIO hs_bindgen_fc2dfbe62c6dc8b1
diff --git a/test-artefacts/fixtures/arrays/multi_dim/Example.hs b/test-artefacts/fixtures/arrays/multi_dim/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/multi_dim/Example.hs
@@ -0,0 +1,100 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Matrix(..)
+    , Example.Triplets(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Eq, Show, type (~))
+
+{-| __C declaration:__ @matrix@
+
+    __defined at:__ @arrays\/multi_dim.h 12:13@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+newtype Matrix = Matrix
+  { unwrapMatrix :: CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapMatrix" Matrix ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Matrix {unwrapMatrix = y1}, BG.getField @"unwrapMatrix" x0)
+
+instance ( ty ~ CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)
+         ) => BG.HasField "unwrapMatrix" (BG.Ptr Matrix) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMatrix")
+
+instance HasCField.HasCField Matrix "unwrapMatrix" where
+
+  type CFieldType Matrix "unwrapMatrix" =
+    CA.ConstantArray 4 (CA.ConstantArray 3 BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @triplets@
+
+    __defined at:__ @arrays\/multi_dim.h 17:13@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+newtype Triplets = Triplets
+  { unwrapTriplets :: IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapTriplets" Triplets ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Triplets {unwrapTriplets = y1}, BG.getField @"unwrapTriplets" x0)
+
+instance ( ty ~ IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)
+         ) => BG.HasField "unwrapTriplets" (BG.Ptr Triplets) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTriplets")
+
+instance HasCField.HasCField Triplets "unwrapTriplets" where
+
+  type CFieldType Triplets "unwrapTriplets" =
+    IA.IncompleteArray (CA.ConstantArray 3 BG.CInt)
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/arrays/multi_dim/Example/FunPtr.hs b/test-artefacts/fixtures/arrays/multi_dim/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/multi_dim/Example/FunPtr.hs
@@ -0,0 +1,250 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.foo_const
+    , Example.FunPtr.bar
+    , Example.FunPtr.bar_const
+    , Example.FunPtr.baz
+    , Example.FunPtr.baz_const
+    , Example.FunPtr.quuz
+    , Example.FunPtr.quuz_const
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/multi_dim.h>"
+  , "/* test_arraysmulti_dim_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_02d97ecc46bbc8e0 (void)) ("
+  , "  signed int (*arg1)[4]"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_arraysmulti_dim_Example_get_foo_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_8baaa4bee7bf2bf7 (void)) ("
+  , "  signed int const (*arg1)[4]"
+  , ")"
+  , "{"
+  , "  return &foo_const;"
+  , "}"
+  , "/* test_arraysmulti_dim_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_27d306f03bbe4aeb (void)) ("
+  , "  signed int (*arg1)[2]"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_arraysmulti_dim_Example_get_bar_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_dedcf308a5d44f1d (void)) ("
+  , "  signed int const (*arg1)[2]"
+  , ")"
+  , "{"
+  , "  return &bar_const;"
+  , "}"
+  , "/* test_arraysmulti_dim_Example_get_baz */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_f8c450c8715a6834 (void)) ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return &baz;"
+  , "}"
+  , "/* test_arraysmulti_dim_Example_get_baz_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_520d9475875f88b2 (void)) ("
+  , "  signed int const (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return &baz_const;"
+  , "}"
+  , "/* test_arraysmulti_dim_Example_get_quuz */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_cb1714c714867d37 (void)) ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return &quuz;"
+  , "}"
+  , "/* test_arraysmulti_dim_Example_get_quuz_const */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_b4e5ee141d4c7703 (void)) ("
+  , "  signed int const (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return &quuz_const;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_02d97ecc46bbc8e0" hs_bindgen_02d97ecc46bbc8e0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo@
+hs_bindgen_02d97ecc46bbc8e0 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt))) -> IO BG.CInt))
+hs_bindgen_02d97ecc46bbc8e0 =
+  fmap BG.fromFFIType hs_bindgen_02d97ecc46bbc8e0_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/multi_dim.h 4:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt))) -> IO BG.CInt)
+foo = BG.unsafePerformIO hs_bindgen_02d97ecc46bbc8e0
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo_const@
+foreign import ccall unsafe "hs_bindgen_8baaa4bee7bf2bf7" hs_bindgen_8baaa4bee7bf2bf7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo_const@
+hs_bindgen_8baaa4bee7bf2bf7 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt))) -> IO BG.CInt))
+hs_bindgen_8baaa4bee7bf2bf7 =
+  fmap BG.fromFFIType hs_bindgen_8baaa4bee7bf2bf7_base
+
+{-# NOINLINE foo_const #-}
+{-| __C declaration:__ @foo_const@
+
+    __defined at:__ @arrays\/multi_dim.h 5:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_const :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt))) -> IO BG.CInt)
+foo_const =
+  BG.unsafePerformIO hs_bindgen_8baaa4bee7bf2bf7
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_27d306f03bbe4aeb" hs_bindgen_27d306f03bbe4aeb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar@
+hs_bindgen_27d306f03bbe4aeb :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt))) -> IO BG.CInt))
+hs_bindgen_27d306f03bbe4aeb =
+  fmap BG.fromFFIType hs_bindgen_27d306f03bbe4aeb_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/multi_dim.h 8:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt))) -> IO BG.CInt)
+bar = BG.unsafePerformIO hs_bindgen_27d306f03bbe4aeb
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar_const@
+foreign import ccall unsafe "hs_bindgen_dedcf308a5d44f1d" hs_bindgen_dedcf308a5d44f1d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar_const@
+hs_bindgen_dedcf308a5d44f1d :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt))) -> IO BG.CInt))
+hs_bindgen_dedcf308a5d44f1d =
+  fmap BG.fromFFIType hs_bindgen_dedcf308a5d44f1d_base
+
+{-# NOINLINE bar_const #-}
+{-| __C declaration:__ @bar_const@
+
+    __defined at:__ @arrays\/multi_dim.h 9:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_const :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt))) -> IO BG.CInt)
+bar_const =
+  BG.unsafePerformIO hs_bindgen_dedcf308a5d44f1d
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_f8c450c8715a6834" hs_bindgen_f8c450c8715a6834_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz@
+hs_bindgen_f8c450c8715a6834 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Matrix) -> IO BG.CInt))
+hs_bindgen_f8c450c8715a6834 =
+  fmap BG.fromFFIType hs_bindgen_f8c450c8715a6834_base
+
+{-# NOINLINE baz #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/multi_dim.h 13:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz :: BG.FunPtr (BG.Ptr (IsA.Elem Matrix) -> IO BG.CInt)
+baz = BG.unsafePerformIO hs_bindgen_f8c450c8715a6834
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz_const@
+foreign import ccall unsafe "hs_bindgen_520d9475875f88b2" hs_bindgen_520d9475875f88b2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz_const@
+hs_bindgen_520d9475875f88b2 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem Matrix) -> IO BG.CInt))
+hs_bindgen_520d9475875f88b2 =
+  fmap BG.fromFFIType hs_bindgen_520d9475875f88b2_base
+
+{-# NOINLINE baz_const #-}
+{-| __C declaration:__ @baz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 14:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_const :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem Matrix) -> IO BG.CInt)
+baz_const =
+  BG.unsafePerformIO hs_bindgen_520d9475875f88b2
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz@
+foreign import ccall unsafe "hs_bindgen_cb1714c714867d37" hs_bindgen_cb1714c714867d37_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz@
+hs_bindgen_cb1714c714867d37 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem Triplets) -> IO BG.CInt))
+hs_bindgen_cb1714c714867d37 =
+  fmap BG.fromFFIType hs_bindgen_cb1714c714867d37_base
+
+{-# NOINLINE quuz #-}
+{-| __C declaration:__ @quuz@
+
+    __defined at:__ @arrays\/multi_dim.h 18:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz :: BG.FunPtr (BG.Ptr (IsA.Elem Triplets) -> IO BG.CInt)
+quuz = BG.unsafePerformIO hs_bindgen_cb1714c714867d37
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz_const@
+foreign import ccall unsafe "hs_bindgen_b4e5ee141d4c7703" hs_bindgen_b4e5ee141d4c7703_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz_const@
+hs_bindgen_b4e5ee141d4c7703 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem Triplets) -> IO BG.CInt))
+hs_bindgen_b4e5ee141d4c7703 =
+  fmap BG.fromFFIType hs_bindgen_b4e5ee141d4c7703_base
+
+{-# NOINLINE quuz_const #-}
+{-| __C declaration:__ @quuz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 19:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_const :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem Triplets) -> IO BG.CInt)
+quuz_const =
+  BG.unsafePerformIO hs_bindgen_b4e5ee141d4c7703
diff --git a/test-artefacts/fixtures/arrays/multi_dim/Example/Safe.hs b/test-artefacts/fixtures/arrays/multi_dim/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/multi_dim/Example/Safe.hs
@@ -0,0 +1,278 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.foo_const
+    , Example.Safe.bar
+    , Example.Safe.bar_const
+    , Example.Safe.baz
+    , Example.Safe.baz_const
+    , Example.Safe.quuz
+    , Example.Safe.quuz_const
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/multi_dim.h>"
+  , "signed int hs_bindgen_57b00b79dd5b838e ("
+  , "  signed int (*arg1)[4]"
+  , ")"
+  , "{"
+  , "  return (foo)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b75122693c32e26c ("
+  , "  signed int const (*arg1)[4]"
+  , ")"
+  , "{"
+  , "  return (foo_const)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_595b7d50222e502a ("
+  , "  signed int (*arg1)[2]"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_1e0c14a0ed027681 ("
+  , "  signed int const (*arg1)[2]"
+  , ")"
+  , "{"
+  , "  return (bar_const)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_39849d83dadd53d9 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (baz)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0c873d371c129e78 ("
+  , "  signed int const (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (baz_const)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_a364da5adecafb37 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (quuz)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e39fa59aeb1fef3d ("
+  , "  signed int const (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (quuz_const)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_57b00b79dd5b838e" hs_bindgen_57b00b79dd5b838e_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo@
+hs_bindgen_57b00b79dd5b838e ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_57b00b79dd5b838e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_57b00b79dd5b838e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/multi_dim.h 4:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+foo = hs_bindgen_57b00b79dd5b838e
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo_const@
+foreign import ccall safe "hs_bindgen_b75122693c32e26c" hs_bindgen_b75122693c32e26c_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo_const@
+hs_bindgen_b75122693c32e26c ::
+     PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_b75122693c32e26c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b75122693c32e26c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo_const@
+
+    __defined at:__ @arrays\/multi_dim.h 5:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_const ::
+     PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+foo_const = hs_bindgen_b75122693c32e26c
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_595b7d50222e502a" hs_bindgen_595b7d50222e502a_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar@
+hs_bindgen_595b7d50222e502a ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_595b7d50222e502a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_595b7d50222e502a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/multi_dim.h 8:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+bar = hs_bindgen_595b7d50222e502a
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar_const@
+foreign import ccall safe "hs_bindgen_1e0c14a0ed027681" hs_bindgen_1e0c14a0ed027681_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar_const@
+hs_bindgen_1e0c14a0ed027681 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_1e0c14a0ed027681 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1e0c14a0ed027681_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar_const@
+
+    __defined at:__ @arrays\/multi_dim.h 9:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_const ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+bar_const = hs_bindgen_1e0c14a0ed027681
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_39849d83dadd53d9" hs_bindgen_39849d83dadd53d9_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz@
+hs_bindgen_39849d83dadd53d9 ::
+     BG.Ptr (IsA.Elem Matrix)
+  -> IO BG.CInt
+hs_bindgen_39849d83dadd53d9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_39849d83dadd53d9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/multi_dim.h 13:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz ::
+     BG.Ptr (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+baz = hs_bindgen_39849d83dadd53d9
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz_const@
+foreign import ccall safe "hs_bindgen_0c873d371c129e78" hs_bindgen_0c873d371c129e78_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz_const@
+hs_bindgen_0c873d371c129e78 ::
+     PtrConst.PtrConst (IsA.Elem Matrix)
+  -> IO BG.CInt
+hs_bindgen_0c873d371c129e78 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0c873d371c129e78_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 14:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_const ::
+     PtrConst.PtrConst (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+baz_const = hs_bindgen_0c873d371c129e78
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz@
+foreign import ccall safe "hs_bindgen_a364da5adecafb37" hs_bindgen_a364da5adecafb37_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz@
+hs_bindgen_a364da5adecafb37 ::
+     BG.Ptr (IsA.Elem Triplets)
+  -> IO BG.CInt
+hs_bindgen_a364da5adecafb37 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a364da5adecafb37_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @quuz@
+
+    __defined at:__ @arrays\/multi_dim.h 18:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz ::
+     BG.Ptr (IsA.Elem Triplets)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+quuz = hs_bindgen_a364da5adecafb37
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz_const@
+foreign import ccall safe "hs_bindgen_e39fa59aeb1fef3d" hs_bindgen_e39fa59aeb1fef3d_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz_const@
+hs_bindgen_e39fa59aeb1fef3d ::
+     PtrConst.PtrConst (IsA.Elem Triplets)
+  -> IO BG.CInt
+hs_bindgen_e39fa59aeb1fef3d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e39fa59aeb1fef3d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @quuz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 19:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_const ::
+     PtrConst.PtrConst (IsA.Elem Triplets)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+quuz_const = hs_bindgen_e39fa59aeb1fef3d
diff --git a/test-artefacts/fixtures/arrays/multi_dim/Example/Unsafe.hs b/test-artefacts/fixtures/arrays/multi_dim/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/multi_dim/Example/Unsafe.hs
@@ -0,0 +1,278 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.foo_const
+    , Example.Unsafe.bar
+    , Example.Unsafe.bar_const
+    , Example.Unsafe.baz
+    , Example.Unsafe.baz_const
+    , Example.Unsafe.quuz
+    , Example.Unsafe.quuz_const
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <arrays/multi_dim.h>"
+  , "signed int hs_bindgen_3389520bc7419af4 ("
+  , "  signed int (*arg1)[4]"
+  , ")"
+  , "{"
+  , "  return (foo)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_73e2db5ad5d807f7 ("
+  , "  signed int const (*arg1)[4]"
+  , ")"
+  , "{"
+  , "  return (foo_const)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_a28b81f0afc23eed ("
+  , "  signed int (*arg1)[2]"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_58337c492b64ae2c ("
+  , "  signed int const (*arg1)[2]"
+  , ")"
+  , "{"
+  , "  return (bar_const)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_48876e6767cb5923 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (baz)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_13ce150055e8aa41 ("
+  , "  signed int const (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (baz_const)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_da5c432144bd5546 ("
+  , "  signed int (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (quuz)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_70be94a6fb59f547 ("
+  , "  signed int const (*arg1)[3]"
+  , ")"
+  , "{"
+  , "  return (quuz_const)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_3389520bc7419af4" hs_bindgen_3389520bc7419af4_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo@
+hs_bindgen_3389520bc7419af4 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_3389520bc7419af4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3389520bc7419af4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/multi_dim.h 4:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+foo = hs_bindgen_3389520bc7419af4
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo_const@
+foreign import ccall unsafe "hs_bindgen_73e2db5ad5d807f7" hs_bindgen_73e2db5ad5d807f7_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo_const@
+hs_bindgen_73e2db5ad5d807f7 ::
+     PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_73e2db5ad5d807f7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_73e2db5ad5d807f7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo_const@
+
+    __defined at:__ @arrays\/multi_dim.h 5:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_const ::
+     PtrConst.PtrConst (IsA.Elem (CA.ConstantArray 3 (CA.ConstantArray 4 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+foo_const = hs_bindgen_73e2db5ad5d807f7
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_a28b81f0afc23eed" hs_bindgen_a28b81f0afc23eed_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar@
+hs_bindgen_a28b81f0afc23eed ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_a28b81f0afc23eed =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a28b81f0afc23eed_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/multi_dim.h 8:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+bar = hs_bindgen_a28b81f0afc23eed
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar_const@
+foreign import ccall unsafe "hs_bindgen_58337c492b64ae2c" hs_bindgen_58337c492b64ae2c_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar_const@
+hs_bindgen_58337c492b64ae2c ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_58337c492b64ae2c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_58337c492b64ae2c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar_const@
+
+    __defined at:__ @arrays\/multi_dim.h 9:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_const ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (CA.ConstantArray 2 BG.CInt)))
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+bar_const = hs_bindgen_58337c492b64ae2c
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_48876e6767cb5923" hs_bindgen_48876e6767cb5923_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz@
+hs_bindgen_48876e6767cb5923 ::
+     BG.Ptr (IsA.Elem Matrix)
+  -> IO BG.CInt
+hs_bindgen_48876e6767cb5923 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_48876e6767cb5923_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/multi_dim.h 13:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz ::
+     BG.Ptr (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+baz = hs_bindgen_48876e6767cb5923
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz_const@
+foreign import ccall unsafe "hs_bindgen_13ce150055e8aa41" hs_bindgen_13ce150055e8aa41_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz_const@
+hs_bindgen_13ce150055e8aa41 ::
+     PtrConst.PtrConst (IsA.Elem Matrix)
+  -> IO BG.CInt
+hs_bindgen_13ce150055e8aa41 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_13ce150055e8aa41_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 14:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_const ::
+     PtrConst.PtrConst (IsA.Elem Matrix)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+baz_const = hs_bindgen_13ce150055e8aa41
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz@
+foreign import ccall unsafe "hs_bindgen_da5c432144bd5546" hs_bindgen_da5c432144bd5546_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz@
+hs_bindgen_da5c432144bd5546 ::
+     BG.Ptr (IsA.Elem Triplets)
+  -> IO BG.CInt
+hs_bindgen_da5c432144bd5546 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_da5c432144bd5546_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @quuz@
+
+    __defined at:__ @arrays\/multi_dim.h 18:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz ::
+     BG.Ptr (IsA.Elem Triplets)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+quuz = hs_bindgen_da5c432144bd5546
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz_const@
+foreign import ccall unsafe "hs_bindgen_70be94a6fb59f547" hs_bindgen_70be94a6fb59f547_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz_const@
+hs_bindgen_70be94a6fb59f547 ::
+     PtrConst.PtrConst (IsA.Elem Triplets)
+  -> IO BG.CInt
+hs_bindgen_70be94a6fb59f547 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_70be94a6fb59f547_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @quuz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 19:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_const ::
+     PtrConst.PtrConst (IsA.Elem Triplets)
+     -- ^ __C declaration:__ @xss@
+  -> IO BG.CInt
+quuz_const = hs_bindgen_70be94a6fb59f547
diff --git a/test-artefacts/fixtures/arrays/multi_dim/bindingspec.yaml b/test-artefacts/fixtures/arrays/multi_dim/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/multi_dim/bindingspec.yaml
@@ -0,0 +1,46 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: arrays/multi_dim.h
+  cname: matrix
+  hsname: Matrix
+- headers: arrays/multi_dim.h
+  cname: triplets
+  hsname: Triplets
+hstypes:
+- hsname: Matrix
+  representation:
+    newtype:
+      constructor: Matrix
+      fields:
+      - unwrapMatrix
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Triplets
+  representation:
+    newtype:
+      constructor: Triplets
+      fields:
+      - unwrapTriplets
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
diff --git a/test-artefacts/fixtures/arrays/multi_dim/th.txt b/test-artefacts/fixtures/arrays/multi_dim/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/arrays/multi_dim/th.txt
@@ -0,0 +1,783 @@
+-- addDependentFile test-artefacts/headers/golden/arrays/multi_dim.h
+-- #include <arrays/multi_dim.h>
+-- signed int hs_bindgen_57b00b79dd5b838e (
+--   signed int (*arg1)[4]
+-- )
+-- {
+--   return (foo)(arg1);
+-- }
+-- signed int hs_bindgen_b75122693c32e26c (
+--   signed int const (*arg1)[4]
+-- )
+-- {
+--   return (foo_const)(arg1);
+-- }
+-- signed int hs_bindgen_595b7d50222e502a (
+--   signed int (*arg1)[2]
+-- )
+-- {
+--   return (bar)(arg1);
+-- }
+-- signed int hs_bindgen_1e0c14a0ed027681 (
+--   signed int const (*arg1)[2]
+-- )
+-- {
+--   return (bar_const)(arg1);
+-- }
+-- signed int hs_bindgen_39849d83dadd53d9 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (baz)(arg1);
+-- }
+-- signed int hs_bindgen_0c873d371c129e78 (
+--   signed int const (*arg1)[3]
+-- )
+-- {
+--   return (baz_const)(arg1);
+-- }
+-- signed int hs_bindgen_a364da5adecafb37 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (quuz)(arg1);
+-- }
+-- signed int hs_bindgen_e39fa59aeb1fef3d (
+--   signed int const (*arg1)[3]
+-- )
+-- {
+--   return (quuz_const)(arg1);
+-- }
+-- signed int hs_bindgen_3389520bc7419af4 (
+--   signed int (*arg1)[4]
+-- )
+-- {
+--   return (foo)(arg1);
+-- }
+-- signed int hs_bindgen_73e2db5ad5d807f7 (
+--   signed int const (*arg1)[4]
+-- )
+-- {
+--   return (foo_const)(arg1);
+-- }
+-- signed int hs_bindgen_a28b81f0afc23eed (
+--   signed int (*arg1)[2]
+-- )
+-- {
+--   return (bar)(arg1);
+-- }
+-- signed int hs_bindgen_58337c492b64ae2c (
+--   signed int const (*arg1)[2]
+-- )
+-- {
+--   return (bar_const)(arg1);
+-- }
+-- signed int hs_bindgen_48876e6767cb5923 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (baz)(arg1);
+-- }
+-- signed int hs_bindgen_13ce150055e8aa41 (
+--   signed int const (*arg1)[3]
+-- )
+-- {
+--   return (baz_const)(arg1);
+-- }
+-- signed int hs_bindgen_da5c432144bd5546 (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return (quuz)(arg1);
+-- }
+-- signed int hs_bindgen_70be94a6fb59f547 (
+--   signed int const (*arg1)[3]
+-- )
+-- {
+--   return (quuz_const)(arg1);
+-- }
+-- /* test_arraysmulti_dim_Example_get_foo */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_02d97ecc46bbc8e0 (void)) (
+--   signed int (*arg1)[4]
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_arraysmulti_dim_Example_get_foo_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_8baaa4bee7bf2bf7 (void)) (
+--   signed int const (*arg1)[4]
+-- )
+-- {
+--   return &foo_const;
+-- }
+-- /* test_arraysmulti_dim_Example_get_bar */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_27d306f03bbe4aeb (void)) (
+--   signed int (*arg1)[2]
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_arraysmulti_dim_Example_get_bar_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_dedcf308a5d44f1d (void)) (
+--   signed int const (*arg1)[2]
+-- )
+-- {
+--   return &bar_const;
+-- }
+-- /* test_arraysmulti_dim_Example_get_baz */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_f8c450c8715a6834 (void)) (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return &baz;
+-- }
+-- /* test_arraysmulti_dim_Example_get_baz_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_520d9475875f88b2 (void)) (
+--   signed int const (*arg1)[3]
+-- )
+-- {
+--   return &baz_const;
+-- }
+-- /* test_arraysmulti_dim_Example_get_quuz */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_cb1714c714867d37 (void)) (
+--   signed int (*arg1)[3]
+-- )
+-- {
+--   return &quuz;
+-- }
+-- /* test_arraysmulti_dim_Example_get_quuz_const */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_b4e5ee141d4c7703 (void)) (
+--   signed int const (*arg1)[3]
+-- )
+-- {
+--   return &quuz_const;
+-- }
+{-| __C declaration:__ @matrix@
+
+    __defined at:__ @arrays\/multi_dim.h 12:13@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+newtype Matrix
+    = Matrix {unwrapMatrix :: (ConstantArray 4 (ConstantArray 3 CInt))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 4 (ConstantArray 3 CInt)) =>
+         HasField "unwrapMatrix" Matrix ty
+    where hasField = \x_0 -> (\y_1 -> Matrix{unwrapMatrix = y_1},
+                              getField @"unwrapMatrix" x_0)
+instance (~) ty (ConstantArray 4 (ConstantArray 3 CInt)) =>
+         HasField "unwrapMatrix" (Ptr Matrix) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMatrix")
+instance HasCField Matrix "unwrapMatrix"
+    where type CFieldType Matrix "unwrapMatrix" = ConstantArray 4
+                                                                (ConstantArray 3 CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @triplets@
+
+    __defined at:__ @arrays\/multi_dim.h 17:13@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+newtype Triplets
+    = Triplets {unwrapTriplets :: (IncompleteArray (ConstantArray 3
+                                                                  CInt))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray (ConstantArray 3 CInt)) =>
+         HasField "unwrapTriplets" Triplets ty
+    where hasField = \x_0 -> (\y_1 -> Triplets{unwrapTriplets = y_1},
+                              getField @"unwrapTriplets" x_0)
+instance (~) ty (IncompleteArray (ConstantArray 3 CInt)) =>
+         HasField "unwrapTriplets" (Ptr Triplets) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTriplets")
+instance HasCField Triplets "unwrapTriplets"
+    where type CFieldType Triplets
+                          "unwrapTriplets" = IncompleteArray (ConstantArray 3 CInt)
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_57b00b79dd5b838e" hs_bindgen_57b00b79dd5b838e_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo@
+hs_bindgen_57b00b79dd5b838e :: Ptr (Elem (ConstantArray 3
+                                                        (ConstantArray 4 CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo@
+hs_bindgen_57b00b79dd5b838e = \x_0 -> fmap fromFFIType (hs_bindgen_57b00b79dd5b838e_base (toFFIType x_0))
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/multi_dim.h 4:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_safe :: Ptr (Elem (ConstantArray 3 (ConstantArray 4 CInt))) ->
+            IO CInt
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/multi_dim.h 4:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_safe = hs_bindgen_57b00b79dd5b838e
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo_const@
+foreign import ccall safe "hs_bindgen_b75122693c32e26c" hs_bindgen_b75122693c32e26c_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo_const@
+hs_bindgen_b75122693c32e26c :: PtrConst (Elem (ConstantArray 3
+                                                             (ConstantArray 4 CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_foo_const@
+hs_bindgen_b75122693c32e26c = \x_0 -> fmap fromFFIType (hs_bindgen_b75122693c32e26c_base (toFFIType x_0))
+{-| __C declaration:__ @foo_const@
+
+    __defined at:__ @arrays\/multi_dim.h 5:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_const_safe :: PtrConst (Elem (ConstantArray 3
+                                                (ConstantArray 4 CInt))) ->
+                  IO CInt
+{-| __C declaration:__ @foo_const@
+
+    __defined at:__ @arrays\/multi_dim.h 5:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_const_safe = hs_bindgen_b75122693c32e26c
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_595b7d50222e502a" hs_bindgen_595b7d50222e502a_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar@
+hs_bindgen_595b7d50222e502a :: Ptr (Elem (IncompleteArray (ConstantArray 2
+                                                                         CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar@
+hs_bindgen_595b7d50222e502a = \x_0 -> fmap fromFFIType (hs_bindgen_595b7d50222e502a_base (toFFIType x_0))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/multi_dim.h 8:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_safe :: Ptr (Elem (IncompleteArray (ConstantArray 2 CInt))) ->
+            IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/multi_dim.h 8:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_safe = hs_bindgen_595b7d50222e502a
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar_const@
+foreign import ccall safe "hs_bindgen_1e0c14a0ed027681" hs_bindgen_1e0c14a0ed027681_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar_const@
+hs_bindgen_1e0c14a0ed027681 :: PtrConst (Elem (IncompleteArray (ConstantArray 2
+                                                                              CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_bar_const@
+hs_bindgen_1e0c14a0ed027681 = \x_0 -> fmap fromFFIType (hs_bindgen_1e0c14a0ed027681_base (toFFIType x_0))
+{-| __C declaration:__ @bar_const@
+
+    __defined at:__ @arrays\/multi_dim.h 9:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_const_safe :: PtrConst (Elem (IncompleteArray (ConstantArray 2
+                                                                 CInt))) ->
+                  IO CInt
+{-| __C declaration:__ @bar_const@
+
+    __defined at:__ @arrays\/multi_dim.h 9:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_const_safe = hs_bindgen_1e0c14a0ed027681
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_39849d83dadd53d9" hs_bindgen_39849d83dadd53d9_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz@
+hs_bindgen_39849d83dadd53d9 :: Ptr (Elem Matrix) -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz@
+hs_bindgen_39849d83dadd53d9 = \x_0 -> fmap fromFFIType (hs_bindgen_39849d83dadd53d9_base (toFFIType x_0))
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/multi_dim.h 13:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_safe :: Ptr (Elem Matrix) -> IO CInt
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/multi_dim.h 13:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_safe = hs_bindgen_39849d83dadd53d9
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz_const@
+foreign import ccall safe "hs_bindgen_0c873d371c129e78" hs_bindgen_0c873d371c129e78_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz_const@
+hs_bindgen_0c873d371c129e78 :: PtrConst (Elem Matrix) -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_baz_const@
+hs_bindgen_0c873d371c129e78 = \x_0 -> fmap fromFFIType (hs_bindgen_0c873d371c129e78_base (toFFIType x_0))
+{-| __C declaration:__ @baz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 14:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_const_safe :: PtrConst (Elem Matrix) -> IO CInt
+{-| __C declaration:__ @baz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 14:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_const_safe = hs_bindgen_0c873d371c129e78
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz@
+foreign import ccall safe "hs_bindgen_a364da5adecafb37" hs_bindgen_a364da5adecafb37_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz@
+hs_bindgen_a364da5adecafb37 :: Ptr (Elem Triplets) -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz@
+hs_bindgen_a364da5adecafb37 = \x_0 -> fmap fromFFIType (hs_bindgen_a364da5adecafb37_base (toFFIType x_0))
+{-| __C declaration:__ @quuz@
+
+    __defined at:__ @arrays\/multi_dim.h 18:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_safe :: Ptr (Elem Triplets) -> IO CInt
+{-| __C declaration:__ @quuz@
+
+    __defined at:__ @arrays\/multi_dim.h 18:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_safe = hs_bindgen_a364da5adecafb37
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz_const@
+foreign import ccall safe "hs_bindgen_e39fa59aeb1fef3d" hs_bindgen_e39fa59aeb1fef3d_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz_const@
+hs_bindgen_e39fa59aeb1fef3d :: PtrConst (Elem Triplets) -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Safe_quuz_const@
+hs_bindgen_e39fa59aeb1fef3d = \x_0 -> fmap fromFFIType (hs_bindgen_e39fa59aeb1fef3d_base (toFFIType x_0))
+{-| __C declaration:__ @quuz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 19:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_const_safe :: PtrConst (Elem Triplets) -> IO CInt
+{-| __C declaration:__ @quuz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 19:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_const_safe = hs_bindgen_e39fa59aeb1fef3d
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_3389520bc7419af4" hs_bindgen_3389520bc7419af4_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo@
+hs_bindgen_3389520bc7419af4 :: Ptr (Elem (ConstantArray 3
+                                                        (ConstantArray 4 CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo@
+hs_bindgen_3389520bc7419af4 = \x_0 -> fmap fromFFIType (hs_bindgen_3389520bc7419af4_base (toFFIType x_0))
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/multi_dim.h 4:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_unsafe :: Ptr (Elem (ConstantArray 3
+                                       (ConstantArray 4 CInt))) ->
+              IO CInt
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/multi_dim.h 4:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_unsafe = hs_bindgen_3389520bc7419af4
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo_const@
+foreign import ccall unsafe "hs_bindgen_73e2db5ad5d807f7" hs_bindgen_73e2db5ad5d807f7_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo_const@
+hs_bindgen_73e2db5ad5d807f7 :: PtrConst (Elem (ConstantArray 3
+                                                             (ConstantArray 4 CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_foo_const@
+hs_bindgen_73e2db5ad5d807f7 = \x_0 -> fmap fromFFIType (hs_bindgen_73e2db5ad5d807f7_base (toFFIType x_0))
+{-| __C declaration:__ @foo_const@
+
+    __defined at:__ @arrays\/multi_dim.h 5:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_const_unsafe :: PtrConst (Elem (ConstantArray 3
+                                                  (ConstantArray 4 CInt))) ->
+                    IO CInt
+{-| __C declaration:__ @foo_const@
+
+    __defined at:__ @arrays\/multi_dim.h 5:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_const_unsafe = hs_bindgen_73e2db5ad5d807f7
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_a28b81f0afc23eed" hs_bindgen_a28b81f0afc23eed_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar@
+hs_bindgen_a28b81f0afc23eed :: Ptr (Elem (IncompleteArray (ConstantArray 2
+                                                                         CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar@
+hs_bindgen_a28b81f0afc23eed = \x_0 -> fmap fromFFIType (hs_bindgen_a28b81f0afc23eed_base (toFFIType x_0))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/multi_dim.h 8:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_unsafe :: Ptr (Elem (IncompleteArray (ConstantArray 2
+                                                        CInt))) ->
+              IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/multi_dim.h 8:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_unsafe = hs_bindgen_a28b81f0afc23eed
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar_const@
+foreign import ccall unsafe "hs_bindgen_58337c492b64ae2c" hs_bindgen_58337c492b64ae2c_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar_const@
+hs_bindgen_58337c492b64ae2c :: PtrConst (Elem (IncompleteArray (ConstantArray 2
+                                                                              CInt))) ->
+                               IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_bar_const@
+hs_bindgen_58337c492b64ae2c = \x_0 -> fmap fromFFIType (hs_bindgen_58337c492b64ae2c_base (toFFIType x_0))
+{-| __C declaration:__ @bar_const@
+
+    __defined at:__ @arrays\/multi_dim.h 9:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_const_unsafe :: PtrConst (Elem (IncompleteArray (ConstantArray 2
+                                                                   CInt))) ->
+                    IO CInt
+{-| __C declaration:__ @bar_const@
+
+    __defined at:__ @arrays\/multi_dim.h 9:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_const_unsafe = hs_bindgen_58337c492b64ae2c
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_48876e6767cb5923" hs_bindgen_48876e6767cb5923_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz@
+hs_bindgen_48876e6767cb5923 :: Ptr (Elem Matrix) -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz@
+hs_bindgen_48876e6767cb5923 = \x_0 -> fmap fromFFIType (hs_bindgen_48876e6767cb5923_base (toFFIType x_0))
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/multi_dim.h 13:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_unsafe :: Ptr (Elem Matrix) -> IO CInt
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/multi_dim.h 13:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_unsafe = hs_bindgen_48876e6767cb5923
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz_const@
+foreign import ccall unsafe "hs_bindgen_13ce150055e8aa41" hs_bindgen_13ce150055e8aa41_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz_const@
+hs_bindgen_13ce150055e8aa41 :: PtrConst (Elem Matrix) -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_baz_const@
+hs_bindgen_13ce150055e8aa41 = \x_0 -> fmap fromFFIType (hs_bindgen_13ce150055e8aa41_base (toFFIType x_0))
+{-| __C declaration:__ @baz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 14:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_const_unsafe :: PtrConst (Elem Matrix) -> IO CInt
+{-| __C declaration:__ @baz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 14:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_const_unsafe = hs_bindgen_13ce150055e8aa41
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz@
+foreign import ccall unsafe "hs_bindgen_da5c432144bd5546" hs_bindgen_da5c432144bd5546_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz@
+hs_bindgen_da5c432144bd5546 :: Ptr (Elem Triplets) -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz@
+hs_bindgen_da5c432144bd5546 = \x_0 -> fmap fromFFIType (hs_bindgen_da5c432144bd5546_base (toFFIType x_0))
+{-| __C declaration:__ @quuz@
+
+    __defined at:__ @arrays\/multi_dim.h 18:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_unsafe :: Ptr (Elem Triplets) -> IO CInt
+{-| __C declaration:__ @quuz@
+
+    __defined at:__ @arrays\/multi_dim.h 18:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_unsafe = hs_bindgen_da5c432144bd5546
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz_const@
+foreign import ccall unsafe "hs_bindgen_70be94a6fb59f547" hs_bindgen_70be94a6fb59f547_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz_const@
+hs_bindgen_70be94a6fb59f547 :: PtrConst (Elem Triplets) -> IO CInt
+-- __unique:__ @test_arraysmulti_dim_Example_Unsafe_quuz_const@
+hs_bindgen_70be94a6fb59f547 = \x_0 -> fmap fromFFIType (hs_bindgen_70be94a6fb59f547_base (toFFIType x_0))
+{-| __C declaration:__ @quuz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 19:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_const_unsafe :: PtrConst (Elem Triplets) -> IO CInt
+{-| __C declaration:__ @quuz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 19:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_const_unsafe = hs_bindgen_70be94a6fb59f547
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_02d97ecc46bbc8e0" hs_bindgen_02d97ecc46bbc8e0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo@
+hs_bindgen_02d97ecc46bbc8e0 :: IO (FunPtr (Ptr (Elem (ConstantArray 3
+                                                                    (ConstantArray 4 CInt))) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo@
+hs_bindgen_02d97ecc46bbc8e0 = fmap fromFFIType hs_bindgen_02d97ecc46bbc8e0_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/multi_dim.h 4:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_funptr :: FunPtr (Ptr (Elem (ConstantArray 3
+                                               (ConstantArray 4 CInt))) ->
+                      IO CInt)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @arrays\/multi_dim.h 4:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_02d97ecc46bbc8e0
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo_const@
+foreign import ccall unsafe "hs_bindgen_8baaa4bee7bf2bf7" hs_bindgen_8baaa4bee7bf2bf7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo_const@
+hs_bindgen_8baaa4bee7bf2bf7 :: IO (FunPtr (PtrConst (Elem (ConstantArray 3
+                                                                         (ConstantArray 4 CInt))) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysmulti_dim_Example_get_foo_const@
+hs_bindgen_8baaa4bee7bf2bf7 = fmap fromFFIType hs_bindgen_8baaa4bee7bf2bf7_base
+{-# NOINLINE foo_const_funptr #-}
+{-| __C declaration:__ @foo_const@
+
+    __defined at:__ @arrays\/multi_dim.h 5:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_const_funptr :: FunPtr (PtrConst (Elem (ConstantArray 3
+                                                          (ConstantArray 4 CInt))) ->
+                            IO CInt)
+{-| __C declaration:__ @foo_const@
+
+    __defined at:__ @arrays\/multi_dim.h 5:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+foo_const_funptr = unsafePerformIO hs_bindgen_8baaa4bee7bf2bf7
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_27d306f03bbe4aeb" hs_bindgen_27d306f03bbe4aeb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar@
+hs_bindgen_27d306f03bbe4aeb :: IO (FunPtr (Ptr (Elem (IncompleteArray (ConstantArray 2
+                                                                                     CInt))) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar@
+hs_bindgen_27d306f03bbe4aeb = fmap fromFFIType hs_bindgen_27d306f03bbe4aeb_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/multi_dim.h 8:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_funptr :: FunPtr (Ptr (Elem (IncompleteArray (ConstantArray 2
+                                                                CInt))) ->
+                      IO CInt)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @arrays\/multi_dim.h 8:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_27d306f03bbe4aeb
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar_const@
+foreign import ccall unsafe "hs_bindgen_dedcf308a5d44f1d" hs_bindgen_dedcf308a5d44f1d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar_const@
+hs_bindgen_dedcf308a5d44f1d :: IO (FunPtr (PtrConst (Elem (IncompleteArray (ConstantArray 2
+                                                                                          CInt))) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysmulti_dim_Example_get_bar_const@
+hs_bindgen_dedcf308a5d44f1d = fmap fromFFIType hs_bindgen_dedcf308a5d44f1d_base
+{-# NOINLINE bar_const_funptr #-}
+{-| __C declaration:__ @bar_const@
+
+    __defined at:__ @arrays\/multi_dim.h 9:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_const_funptr :: FunPtr (PtrConst (Elem (IncompleteArray (ConstantArray 2
+                                                                           CInt))) ->
+                            IO CInt)
+{-| __C declaration:__ @bar_const@
+
+    __defined at:__ @arrays\/multi_dim.h 9:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+bar_const_funptr = unsafePerformIO hs_bindgen_dedcf308a5d44f1d
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_f8c450c8715a6834" hs_bindgen_f8c450c8715a6834_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz@
+hs_bindgen_f8c450c8715a6834 :: IO (FunPtr (Ptr (Elem Matrix) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz@
+hs_bindgen_f8c450c8715a6834 = fmap fromFFIType hs_bindgen_f8c450c8715a6834_base
+{-# NOINLINE baz_funptr #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/multi_dim.h 13:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_funptr :: FunPtr (Ptr (Elem Matrix) -> IO CInt)
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @arrays\/multi_dim.h 13:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_funptr = unsafePerformIO hs_bindgen_f8c450c8715a6834
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz_const@
+foreign import ccall unsafe "hs_bindgen_520d9475875f88b2" hs_bindgen_520d9475875f88b2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz_const@
+hs_bindgen_520d9475875f88b2 :: IO (FunPtr (PtrConst (Elem Matrix) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysmulti_dim_Example_get_baz_const@
+hs_bindgen_520d9475875f88b2 = fmap fromFFIType hs_bindgen_520d9475875f88b2_base
+{-# NOINLINE baz_const_funptr #-}
+{-| __C declaration:__ @baz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 14:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_const_funptr :: FunPtr (PtrConst (Elem Matrix) -> IO CInt)
+{-| __C declaration:__ @baz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 14:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+baz_const_funptr = unsafePerformIO hs_bindgen_520d9475875f88b2
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz@
+foreign import ccall unsafe "hs_bindgen_cb1714c714867d37" hs_bindgen_cb1714c714867d37_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz@
+hs_bindgen_cb1714c714867d37 :: IO (FunPtr (Ptr (Elem Triplets) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz@
+hs_bindgen_cb1714c714867d37 = fmap fromFFIType hs_bindgen_cb1714c714867d37_base
+{-# NOINLINE quuz_funptr #-}
+{-| __C declaration:__ @quuz@
+
+    __defined at:__ @arrays\/multi_dim.h 18:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_funptr :: FunPtr (Ptr (Elem Triplets) -> IO CInt)
+{-| __C declaration:__ @quuz@
+
+    __defined at:__ @arrays\/multi_dim.h 18:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_funptr = unsafePerformIO hs_bindgen_cb1714c714867d37
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz_const@
+foreign import ccall unsafe "hs_bindgen_b4e5ee141d4c7703" hs_bindgen_b4e5ee141d4c7703_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz_const@
+hs_bindgen_b4e5ee141d4c7703 :: IO (FunPtr (PtrConst (Elem Triplets) ->
+                                           IO CInt))
+-- __unique:__ @test_arraysmulti_dim_Example_get_quuz_const@
+hs_bindgen_b4e5ee141d4c7703 = fmap fromFFIType hs_bindgen_b4e5ee141d4c7703_base
+{-# NOINLINE quuz_const_funptr #-}
+{-| __C declaration:__ @quuz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 19:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_const_funptr :: FunPtr (PtrConst (Elem Triplets) -> IO CInt)
+{-| __C declaration:__ @quuz_const@
+
+    __defined at:__ @arrays\/multi_dim.h 19:5@
+
+    __exported by:__ @arrays\/multi_dim.h@
+-}
+quuz_const_funptr = unsafePerformIO hs_bindgen_b4e5ee141d4c7703
diff --git a/test-artefacts/fixtures/attributes/asm/Example/FunPtr.hs b/test-artefacts/fixtures/attributes/asm/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/asm/Example/FunPtr.hs
@@ -0,0 +1,46 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.asm_labeled_function
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <attributes/asm.h>"
+  , "/* test_attributesasm_Example_get_asm_labeled_function */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_4f7c4fceed28f171 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &asm_labeled_function;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_function@
+foreign import ccall unsafe "hs_bindgen_4f7c4fceed28f171" hs_bindgen_4f7c4fceed28f171_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_function@
+hs_bindgen_4f7c4fceed28f171 :: IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO BG.CInt))
+hs_bindgen_4f7c4fceed28f171 =
+  fmap BG.fromFFIType hs_bindgen_4f7c4fceed28f171_base
+
+{-# NOINLINE asm_labeled_function #-}
+{-| __C declaration:__ @asm_labeled_function@
+
+    __defined at:__ @attributes\/asm.h 4:5@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_function :: BG.FunPtr (BG.CInt -> BG.CInt -> IO BG.CInt)
+asm_labeled_function =
+  BG.unsafePerformIO hs_bindgen_4f7c4fceed28f171
diff --git a/test-artefacts/fixtures/attributes/asm/Example/Global.hs b/test-artefacts/fixtures/attributes/asm/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/asm/Example/Global.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.asm_labeled_variable
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <attributes/asm.h>"
+  , "/* test_attributesasm_Example_get_asm_labeled_variable */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_e637e98af1313f88 (void)"
+  , "{"
+  , "  return &asm_labeled_variable;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_variable@
+foreign import ccall unsafe "hs_bindgen_e637e98af1313f88" hs_bindgen_e637e98af1313f88_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_variable@
+hs_bindgen_e637e98af1313f88 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_e637e98af1313f88 =
+  fmap BG.fromFFIType hs_bindgen_e637e98af1313f88_base
+
+{-# NOINLINE asm_labeled_variable #-}
+{-| __C declaration:__ @asm_labeled_variable@
+
+    __defined at:__ @attributes\/asm.h 2:12@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_variable :: BG.Ptr BG.CInt
+asm_labeled_variable =
+  BG.unsafePerformIO hs_bindgen_e637e98af1313f88
diff --git a/test-artefacts/fixtures/attributes/asm/Example/Safe.hs b/test-artefacts/fixtures/attributes/asm/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/asm/Example/Safe.hs
@@ -0,0 +1,54 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.asm_labeled_function
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <attributes/asm.h>"
+  , "signed int hs_bindgen_369133049bfc1e73 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (asm_labeled_function)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_attributesasm_Example_Safe_asm_labeled_function@
+foreign import ccall safe "hs_bindgen_369133049bfc1e73" hs_bindgen_369133049bfc1e73_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_attributesasm_Example_Safe_asm_labeled_function@
+hs_bindgen_369133049bfc1e73 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_369133049bfc1e73 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_369133049bfc1e73_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @asm_labeled_function@
+
+    __defined at:__ @attributes\/asm.h 4:5@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_function ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CInt
+asm_labeled_function = hs_bindgen_369133049bfc1e73
diff --git a/test-artefacts/fixtures/attributes/asm/Example/Unsafe.hs b/test-artefacts/fixtures/attributes/asm/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/asm/Example/Unsafe.hs
@@ -0,0 +1,54 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.asm_labeled_function
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <attributes/asm.h>"
+  , "signed int hs_bindgen_3ad6c287a2386382 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (asm_labeled_function)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
+foreign import ccall unsafe "hs_bindgen_3ad6c287a2386382" hs_bindgen_3ad6c287a2386382_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
+hs_bindgen_3ad6c287a2386382 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_3ad6c287a2386382 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_3ad6c287a2386382_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @asm_labeled_function@
+
+    __defined at:__ @attributes\/asm.h 4:5@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_function ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CInt
+asm_labeled_function = hs_bindgen_3ad6c287a2386382
diff --git a/test-artefacts/fixtures/attributes/asm/bindingspec.yaml b/test-artefacts/fixtures/attributes/asm/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/asm/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/attributes/asm/th.txt b/test-artefacts/fixtures/attributes/asm/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/asm/th.txt
@@ -0,0 +1,122 @@
+-- addDependentFile test-artefacts/headers/golden/attributes/asm.h
+-- #include <attributes/asm.h>
+-- signed int hs_bindgen_369133049bfc1e73 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (asm_labeled_function)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_3ad6c287a2386382 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (asm_labeled_function)(arg1, arg2);
+-- }
+-- /* test_attributesasm_Example_get_asm_labeled_function */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_4f7c4fceed28f171 (void)) (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &asm_labeled_function;
+-- }
+-- /* test_attributesasm_Example_get_asm_labeled_variable */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_e637e98af1313f88 (void)
+-- {
+--   return &asm_labeled_variable;
+-- }
+-- __unique:__ @test_attributesasm_Example_Safe_asm_labeled_function@
+foreign import ccall safe "hs_bindgen_369133049bfc1e73" hs_bindgen_369133049bfc1e73_base ::
+    CInt
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_attributesasm_Example_Safe_asm_labeled_function@
+hs_bindgen_369133049bfc1e73 :: CInt -> CInt -> IO CInt
+-- __unique:__ @test_attributesasm_Example_Safe_asm_labeled_function@
+hs_bindgen_369133049bfc1e73 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_369133049bfc1e73_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @asm_labeled_function@
+
+    __defined at:__ @attributes\/asm.h 4:5@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_function_safe :: CInt -> CInt -> IO CInt
+{-| __C declaration:__ @asm_labeled_function@
+
+    __defined at:__ @attributes\/asm.h 4:5@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_function_safe = hs_bindgen_369133049bfc1e73
+-- __unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
+foreign import ccall unsafe "hs_bindgen_3ad6c287a2386382" hs_bindgen_3ad6c287a2386382_base ::
+    CInt
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
+hs_bindgen_3ad6c287a2386382 :: CInt -> CInt -> IO CInt
+-- __unique:__ @test_attributesasm_Example_Unsafe_asm_labeled_function@
+hs_bindgen_3ad6c287a2386382 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_3ad6c287a2386382_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @asm_labeled_function@
+
+    __defined at:__ @attributes\/asm.h 4:5@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_function_unsafe :: CInt -> CInt -> IO CInt
+{-| __C declaration:__ @asm_labeled_function@
+
+    __defined at:__ @attributes\/asm.h 4:5@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_function_unsafe = hs_bindgen_3ad6c287a2386382
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_function@
+foreign import ccall unsafe "hs_bindgen_4f7c4fceed28f171" hs_bindgen_4f7c4fceed28f171_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_function@
+hs_bindgen_4f7c4fceed28f171 :: IO (FunPtr (CInt ->
+                                           CInt -> IO CInt))
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_function@
+hs_bindgen_4f7c4fceed28f171 = fmap fromFFIType hs_bindgen_4f7c4fceed28f171_base
+{-# NOINLINE asm_labeled_function_funptr #-}
+{-| __C declaration:__ @asm_labeled_function@
+
+    __defined at:__ @attributes\/asm.h 4:5@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_function_funptr :: FunPtr (CInt -> CInt -> IO CInt)
+{-| __C declaration:__ @asm_labeled_function@
+
+    __defined at:__ @attributes\/asm.h 4:5@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_function_funptr = unsafePerformIO hs_bindgen_4f7c4fceed28f171
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_variable@
+foreign import ccall unsafe "hs_bindgen_e637e98af1313f88" hs_bindgen_e637e98af1313f88_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_variable@
+hs_bindgen_e637e98af1313f88 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesasm_Example_get_asm_labeled_variable@
+hs_bindgen_e637e98af1313f88 = fmap fromFFIType hs_bindgen_e637e98af1313f88_base
+{-# NOINLINE asm_labeled_variable #-}
+{-| __C declaration:__ @asm_labeled_variable@
+
+    __defined at:__ @attributes\/asm.h 2:12@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_variable :: Ptr CInt
+{-| __C declaration:__ @asm_labeled_variable@
+
+    __defined at:__ @attributes\/asm.h 2:12@
+
+    __exported by:__ @attributes\/asm.h@
+-}
+asm_labeled_variable = unsafePerformIO hs_bindgen_e637e98af1313f88
diff --git a/test-artefacts/fixtures/attributes/attributes/Example.hs b/test-artefacts/fixtures/attributes/attributes/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/attributes/Example.hs
@@ -0,0 +1,587 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo(..)
+    , Example.Bar(..)
+    , Example.Baz(..)
+    , Example.Qux(..)
+    , Example.FILE(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, IO, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @attributes\/attributes.h 10:36@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data Foo = Foo
+  { foo_c :: BG.CChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @attributes\/attributes.h 11:10@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  , foo_i :: BG.CInt
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @attributes\/attributes.h 12:10@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo where
+
+  staticSizeOf = \_ -> (5 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Foo where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo
+      <*> HasCField.readRaw (BG.Proxy @"foo_c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"foo_i") ptr0
+
+instance Marshal.WriteRaw Foo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo foo_c2 foo_i3 ->
+               HasCField.writeRaw (BG.Proxy @"foo_c") ptr0 foo_c2
+            >> HasCField.writeRaw (BG.Proxy @"foo_i") ptr0 foo_i3
+
+deriving via Marshal.EquivStorable Foo instance BG.Storable Foo
+
+deriving via Struct.IsStructViaReadRaw Foo instance Struct.IsStruct Foo
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @attributes\/attributes.h 11:10@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "foo_c" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_c = y1, foo_i = BG.getField @"foo_i" x0}
+      , BG.getField @"foo_c" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "foo_c" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_c")
+
+instance HasCField.HasCField Foo "foo_c" where
+
+  type CFieldType Foo "foo_c" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @attributes\/attributes.h 12:10@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_i" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_i = y1, foo_c = BG.getField @"foo_c" x0}
+      , BG.getField @"foo_i" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "foo_i" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_i")
+
+instance HasCField.HasCField Foo "foo_i" where
+
+  type CFieldType Foo "foo_i" = BG.CInt
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @attributes\/attributes.h 16:15@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data Bar = Bar
+  { bar_c :: BG.CChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @attributes\/attributes.h 17:10@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  , bar_i :: BG.CInt
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @attributes\/attributes.h 18:10@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar where
+
+  staticSizeOf = \_ -> (5 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar
+      <*> HasCField.readRaw (BG.Proxy @"bar_c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bar_i") ptr0
+
+instance Marshal.WriteRaw Bar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar bar_c2 bar_i3 ->
+               HasCField.writeRaw (BG.Proxy @"bar_c") ptr0 bar_c2
+            >> HasCField.writeRaw (BG.Proxy @"bar_i") ptr0 bar_i3
+
+deriving via Marshal.EquivStorable Bar instance BG.Storable Bar
+
+deriving via Struct.IsStructViaReadRaw Bar instance Struct.IsStruct Bar
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @attributes\/attributes.h 17:10@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "bar_c" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_c = y1, bar_i = BG.getField @"bar_i" x0}
+      , BG.getField @"bar_c" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "bar_c" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_c")
+
+instance HasCField.HasCField Bar "bar_c" where
+
+  type CFieldType Bar "bar_c" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @attributes\/attributes.h 18:10@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "bar_i" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_i = y1, bar_c = BG.getField @"bar_c" x0}
+      , BG.getField @"bar_i" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "bar_i" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_i")
+
+instance HasCField.HasCField Bar "bar_i" where
+
+  type CFieldType Bar "bar_i" = BG.CInt
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @struct baz@
+
+    __defined at:__ @attributes\/attributes.h 22:9@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data Baz = Baz
+  { baz_c :: BG.CChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @attributes\/attributes.h 23:10@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  , baz_i :: BG.CInt
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @attributes\/attributes.h 24:10@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Baz where
+
+  staticSizeOf = \_ -> (5 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Baz where
+
+  readRaw =
+    \ptr0 ->
+          pure Baz
+      <*> HasCField.readRaw (BG.Proxy @"baz_c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"baz_i") ptr0
+
+instance Marshal.WriteRaw Baz where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Baz baz_c2 baz_i3 ->
+               HasCField.writeRaw (BG.Proxy @"baz_c") ptr0 baz_c2
+            >> HasCField.writeRaw (BG.Proxy @"baz_i") ptr0 baz_i3
+
+deriving via Marshal.EquivStorable Baz instance BG.Storable Baz
+
+deriving via Struct.IsStructViaReadRaw Baz instance Struct.IsStruct Baz
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @attributes\/attributes.h 23:10@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "baz_c" Baz ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Baz {baz_c = y1, baz_i = BG.getField @"baz_i" x0}
+      , BG.getField @"baz_c" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "baz_c" (BG.Ptr Baz) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"baz_c")
+
+instance HasCField.HasCField Baz "baz_c" where
+
+  type CFieldType Baz "baz_c" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @attributes\/attributes.h 24:10@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "baz_i" Baz ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Baz {baz_i = y1, baz_c = BG.getField @"baz_c" x0}
+      , BG.getField @"baz_i" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "baz_i" (BG.Ptr Baz) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"baz_i")
+
+instance HasCField.HasCField Baz "baz_i" where
+
+  type CFieldType Baz "baz_i" = BG.CInt
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @struct qux@
+
+    __defined at:__ @attributes\/attributes.h 28:9@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data Qux = Qux
+  { qux_c :: BG.CChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @attributes\/attributes.h 29:10@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  , qux_i :: BG.CInt
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @attributes\/attributes.h 30:10@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Qux where
+
+  staticSizeOf = \_ -> (5 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Qux where
+
+  readRaw =
+    \ptr0 ->
+          pure Qux
+      <*> HasCField.readRaw (BG.Proxy @"qux_c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"qux_i") ptr0
+
+instance Marshal.WriteRaw Qux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Qux qux_c2 qux_i3 ->
+               HasCField.writeRaw (BG.Proxy @"qux_c") ptr0 qux_c2
+            >> HasCField.writeRaw (BG.Proxy @"qux_i") ptr0 qux_i3
+
+deriving via Marshal.EquivStorable Qux instance BG.Storable Qux
+
+deriving via Struct.IsStructViaReadRaw Qux instance Struct.IsStruct Qux
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @attributes\/attributes.h 29:10@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "qux_c" Qux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Qux {qux_c = y1, qux_i = BG.getField @"qux_i" x0}
+      , BG.getField @"qux_c" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "qux_c" (BG.Ptr Qux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"qux_c")
+
+instance HasCField.HasCField Qux "qux_c" where
+
+  type CFieldType Qux "qux_c" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @attributes\/attributes.h 30:10@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "qux_i" Qux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Qux {qux_i = y1, qux_c = BG.getField @"qux_c" x0}
+      , BG.getField @"qux_i" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "qux_i" (BG.Ptr Qux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"qux_i")
+
+instance HasCField.HasCField Qux "qux_i" where
+
+  type CFieldType Qux "qux_i" = BG.CInt
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @struct __sFILE@
+
+    __defined at:__ @attributes\/attributes.h 34:16@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data FILE = FILE
+  { fILE__r :: BG.CInt
+    {- ^ __C declaration:__ @_r@
+
+         __defined at:__ @attributes\/attributes.h 35:9@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  , fILE__w :: BG.CInt
+    {- ^ __C declaration:__ @_w@
+
+         __defined at:__ @attributes\/attributes.h 36:9@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  , fILE__close :: BG.FunPtr (BG.Ptr BG.Void -> IO BG.CInt)
+    {- ^ __C declaration:__ @_close@
+
+         __defined at:__ @attributes\/attributes.h 37:22@
+
+         __exported by:__ @attributes\/attributes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize FILE where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw FILE where
+
+  readRaw =
+    \ptr0 ->
+          pure FILE
+      <*> HasCField.readRaw (BG.Proxy @"fILE__r") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"fILE__w") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"fILE__close") ptr0
+
+instance Marshal.WriteRaw FILE where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          FILE fILE__r2 fILE__w3 fILE__close4 ->
+               HasCField.writeRaw (BG.Proxy @"fILE__r") ptr0 fILE__r2
+            >> HasCField.writeRaw (BG.Proxy @"fILE__w") ptr0 fILE__w3
+            >> HasCField.writeRaw (BG.Proxy @"fILE__close") ptr0 fILE__close4
+
+deriving via Marshal.EquivStorable FILE instance BG.Storable FILE
+
+deriving via Struct.IsStructViaReadRaw FILE instance Struct.IsStruct FILE
+
+{-| __C declaration:__ @_r@
+
+    __defined at:__ @attributes\/attributes.h 35:9@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "fILE__r" FILE ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FILE { fILE__r = y1
+               , fILE__w = BG.getField @"fILE__w" x0
+               , fILE__close = BG.getField @"fILE__close" x0
+               }
+      , BG.getField @"fILE__r" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "fILE__r" (BG.Ptr FILE) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"fILE__r")
+
+instance HasCField.HasCField FILE "fILE__r" where
+
+  type CFieldType FILE "fILE__r" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @_w@
+
+    __defined at:__ @attributes\/attributes.h 36:9@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "fILE__w" FILE ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FILE { fILE__w = y1
+               , fILE__r = BG.getField @"fILE__r" x0
+               , fILE__close = BG.getField @"fILE__close" x0
+               }
+      , BG.getField @"fILE__w" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "fILE__w" (BG.Ptr FILE) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"fILE__w")
+
+instance HasCField.HasCField FILE "fILE__w" where
+
+  type CFieldType FILE "fILE__w" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @_close@
+
+    __defined at:__ @attributes\/attributes.h 37:22@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "fILE__close" FILE ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FILE { fILE__close = y1
+               , fILE__r = BG.getField @"fILE__r" x0
+               , fILE__w = BG.getField @"fILE__w" x0
+               }
+      , BG.getField @"fILE__close" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO BG.CInt)
+         ) => BG.HasField "fILE__close" (BG.Ptr FILE) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"fILE__close")
+
+instance HasCField.HasCField FILE "fILE__close" where
+
+  type CFieldType FILE "fILE__close" =
+    BG.FunPtr (BG.Ptr BG.Void -> IO BG.CInt)
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/attributes/attributes/bindingspec.yaml b/test-artefacts/fixtures/attributes/attributes/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/attributes/bindingspec.yaml
@@ -0,0 +1,131 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: attributes/attributes.h
+  cname: struct foo
+  hsname: Foo
+- headers: attributes/attributes.h
+  cname: struct bar
+  hsname: Bar
+- headers: attributes/attributes.h
+  cname: struct baz
+  hsname: Baz
+- headers: attributes/attributes.h
+  cname: baz
+  hsname: Baz
+- headers: attributes/attributes.h
+  cname: struct qux
+  hsname: Qux
+- headers: attributes/attributes.h
+  cname: qux
+  hsname: Qux
+- headers: attributes/attributes.h
+  cname: struct __sFILE
+  hsname: FILE
+- headers: attributes/attributes.h
+  cname: FILE
+  hsname: FILE
+hstypes:
+- hsname: Bar
+  representation:
+    record:
+      constructor: Bar
+      fields:
+      - bar_c
+      - bar_i
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Baz
+  representation:
+    record:
+      constructor: Baz
+      fields:
+      - baz_c
+      - baz_i
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: FILE
+  representation:
+    record:
+      constructor: FILE
+      fields:
+      - fILE__r
+      - fILE__w
+      - fILE__close
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    record:
+      constructor: Foo
+      fields:
+      - foo_c
+      - foo_i
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Qux
+  representation:
+    record:
+      constructor: Qux
+      fields:
+      - qux_c
+      - qux_i
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/attributes/attributes/th.txt b/test-artefacts/fixtures/attributes/attributes/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/attributes/th.txt
@@ -0,0 +1,279 @@
+-- addDependentFile test-artefacts/headers/golden/attributes/attributes.h
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @attributes\/attributes.h 10:36@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data Foo
+    = Foo {foo_c :: CChar
+           {- ^ __C declaration:__ @c@
+
+                __defined at:__ @attributes\/attributes.h 11:10@
+
+                __exported by:__ @attributes\/attributes.h@
+           -},
+           foo_i :: CInt
+           {- ^ __C declaration:__ @i@
+
+                __defined at:__ @attributes\/attributes.h 12:10@
+
+                __exported by:__ @attributes\/attributes.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo
+    where staticSizeOf = \_ -> 5 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Foo
+    where readRaw = \ptr_0 -> (pure Foo <*> readRaw (Proxy @"foo_c") ptr_0) <*> readRaw (Proxy @"foo_i") ptr_0
+instance WriteRaw Foo
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo foo_c_2
+                                           foo_i_3 -> writeRaw (Proxy @"foo_c") ptr_0 foo_c_2 >> writeRaw (Proxy @"foo_i") ptr_0 foo_i_3
+deriving via (EquivStorable Foo) instance Storable Foo
+deriving via (IsStructViaReadRaw Foo) instance IsStruct Foo
+instance (~) ty CChar => HasField "foo_c" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_c = y_1,
+                                          foo_i = getField @"foo_i" x_0},
+                              getField @"foo_c" x_0)
+instance (~) ty CChar => HasField "foo_c" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_c")
+instance HasCField Foo "foo_c"
+    where type CFieldType Foo "foo_c" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "foo_i" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_i = y_1,
+                                          foo_c = getField @"foo_c" x_0},
+                              getField @"foo_i" x_0)
+instance (~) ty CInt => HasField "foo_i" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_i")
+instance HasCField Foo "foo_i"
+    where type CFieldType Foo "foo_i" = CInt
+          offset# = \_ -> \_ -> 1
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @attributes\/attributes.h 16:15@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data Bar
+    = Bar {bar_c :: CChar
+           {- ^ __C declaration:__ @c@
+
+                __defined at:__ @attributes\/attributes.h 17:10@
+
+                __exported by:__ @attributes\/attributes.h@
+           -},
+           bar_i :: CInt
+           {- ^ __C declaration:__ @i@
+
+                __defined at:__ @attributes\/attributes.h 18:10@
+
+                __exported by:__ @attributes\/attributes.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar
+    where staticSizeOf = \_ -> 5 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar
+    where readRaw = \ptr_0 -> (pure Bar <*> readRaw (Proxy @"bar_c") ptr_0) <*> readRaw (Proxy @"bar_i") ptr_0
+instance WriteRaw Bar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar bar_c_2
+                                           bar_i_3 -> writeRaw (Proxy @"bar_c") ptr_0 bar_c_2 >> writeRaw (Proxy @"bar_i") ptr_0 bar_i_3
+deriving via (EquivStorable Bar) instance Storable Bar
+deriving via (IsStructViaReadRaw Bar) instance IsStruct Bar
+instance (~) ty CChar => HasField "bar_c" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_c = y_1,
+                                          bar_i = getField @"bar_i" x_0},
+                              getField @"bar_c" x_0)
+instance (~) ty CChar => HasField "bar_c" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_c")
+instance HasCField Bar "bar_c"
+    where type CFieldType Bar "bar_c" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "bar_i" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_i = y_1,
+                                          bar_c = getField @"bar_c" x_0},
+                              getField @"bar_i" x_0)
+instance (~) ty CInt => HasField "bar_i" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_i")
+instance HasCField Bar "bar_i"
+    where type CFieldType Bar "bar_i" = CInt
+          offset# = \_ -> \_ -> 1
+{-| __C declaration:__ @struct baz@
+
+    __defined at:__ @attributes\/attributes.h 22:9@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data Baz
+    = Baz {baz_c :: CChar
+           {- ^ __C declaration:__ @c@
+
+                __defined at:__ @attributes\/attributes.h 23:10@
+
+                __exported by:__ @attributes\/attributes.h@
+           -},
+           baz_i :: CInt
+           {- ^ __C declaration:__ @i@
+
+                __defined at:__ @attributes\/attributes.h 24:10@
+
+                __exported by:__ @attributes\/attributes.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Baz
+    where staticSizeOf = \_ -> 5 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Baz
+    where readRaw = \ptr_0 -> (pure Baz <*> readRaw (Proxy @"baz_c") ptr_0) <*> readRaw (Proxy @"baz_i") ptr_0
+instance WriteRaw Baz
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Baz baz_c_2
+                                           baz_i_3 -> writeRaw (Proxy @"baz_c") ptr_0 baz_c_2 >> writeRaw (Proxy @"baz_i") ptr_0 baz_i_3
+deriving via (EquivStorable Baz) instance Storable Baz
+deriving via (IsStructViaReadRaw Baz) instance IsStruct Baz
+instance (~) ty CChar => HasField "baz_c" Baz ty
+    where hasField = \x_0 -> (\y_1 -> Baz{baz_c = y_1,
+                                          baz_i = getField @"baz_i" x_0},
+                              getField @"baz_c" x_0)
+instance (~) ty CChar => HasField "baz_c" (Ptr Baz) (Ptr ty)
+    where getField = fromPtr (Proxy @"baz_c")
+instance HasCField Baz "baz_c"
+    where type CFieldType Baz "baz_c" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "baz_i" Baz ty
+    where hasField = \x_0 -> (\y_1 -> Baz{baz_i = y_1,
+                                          baz_c = getField @"baz_c" x_0},
+                              getField @"baz_i" x_0)
+instance (~) ty CInt => HasField "baz_i" (Ptr Baz) (Ptr ty)
+    where getField = fromPtr (Proxy @"baz_i")
+instance HasCField Baz "baz_i"
+    where type CFieldType Baz "baz_i" = CInt
+          offset# = \_ -> \_ -> 1
+{-| __C declaration:__ @struct qux@
+
+    __defined at:__ @attributes\/attributes.h 28:9@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data Qux
+    = Qux {qux_c :: CChar
+           {- ^ __C declaration:__ @c@
+
+                __defined at:__ @attributes\/attributes.h 29:10@
+
+                __exported by:__ @attributes\/attributes.h@
+           -},
+           qux_i :: CInt
+           {- ^ __C declaration:__ @i@
+
+                __defined at:__ @attributes\/attributes.h 30:10@
+
+                __exported by:__ @attributes\/attributes.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Qux
+    where staticSizeOf = \_ -> 5 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Qux
+    where readRaw = \ptr_0 -> (pure Qux <*> readRaw (Proxy @"qux_c") ptr_0) <*> readRaw (Proxy @"qux_i") ptr_0
+instance WriteRaw Qux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Qux qux_c_2
+                                           qux_i_3 -> writeRaw (Proxy @"qux_c") ptr_0 qux_c_2 >> writeRaw (Proxy @"qux_i") ptr_0 qux_i_3
+deriving via (EquivStorable Qux) instance Storable Qux
+deriving via (IsStructViaReadRaw Qux) instance IsStruct Qux
+instance (~) ty CChar => HasField "qux_c" Qux ty
+    where hasField = \x_0 -> (\y_1 -> Qux{qux_c = y_1,
+                                          qux_i = getField @"qux_i" x_0},
+                              getField @"qux_c" x_0)
+instance (~) ty CChar => HasField "qux_c" (Ptr Qux) (Ptr ty)
+    where getField = fromPtr (Proxy @"qux_c")
+instance HasCField Qux "qux_c"
+    where type CFieldType Qux "qux_c" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "qux_i" Qux ty
+    where hasField = \x_0 -> (\y_1 -> Qux{qux_i = y_1,
+                                          qux_c = getField @"qux_c" x_0},
+                              getField @"qux_i" x_0)
+instance (~) ty CInt => HasField "qux_i" (Ptr Qux) (Ptr ty)
+    where getField = fromPtr (Proxy @"qux_i")
+instance HasCField Qux "qux_i"
+    where type CFieldType Qux "qux_i" = CInt
+          offset# = \_ -> \_ -> 1
+{-| __C declaration:__ @struct __sFILE@
+
+    __defined at:__ @attributes\/attributes.h 34:16@
+
+    __exported by:__ @attributes\/attributes.h@
+-}
+data FILE
+    = FILE {fILE__r :: CInt
+            {- ^ __C declaration:__ @_r@
+
+                 __defined at:__ @attributes\/attributes.h 35:9@
+
+                 __exported by:__ @attributes\/attributes.h@
+            -},
+            fILE__w :: CInt
+            {- ^ __C declaration:__ @_w@
+
+                 __defined at:__ @attributes\/attributes.h 36:9@
+
+                 __exported by:__ @attributes\/attributes.h@
+            -},
+            fILE__close :: (FunPtr (Ptr Void -> IO CInt))
+            {- ^ __C declaration:__ @_close@
+
+                 __defined at:__ @attributes\/attributes.h 37:22@
+
+                 __exported by:__ @attributes\/attributes.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize FILE
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw FILE
+    where readRaw = \ptr_0 -> ((pure FILE <*> readRaw (Proxy @"fILE__r") ptr_0) <*> readRaw (Proxy @"fILE__w") ptr_0) <*> readRaw (Proxy @"fILE__close") ptr_0
+instance WriteRaw FILE
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       FILE fILE__r_2
+                                            fILE__w_3
+                                            fILE__close_4 -> writeRaw (Proxy @"fILE__r") ptr_0 fILE__r_2 >> (writeRaw (Proxy @"fILE__w") ptr_0 fILE__w_3 >> writeRaw (Proxy @"fILE__close") ptr_0 fILE__close_4)
+deriving via (EquivStorable FILE) instance Storable FILE
+deriving via (IsStructViaReadRaw FILE) instance IsStruct FILE
+instance (~) ty CInt => HasField "fILE__r" FILE ty
+    where hasField = \x_0 -> (\y_1 -> FILE{fILE__r = y_1,
+                                           fILE__w = getField @"fILE__w" x_0,
+                                           fILE__close = getField @"fILE__close" x_0},
+                              getField @"fILE__r" x_0)
+instance (~) ty CInt => HasField "fILE__r" (Ptr FILE) (Ptr ty)
+    where getField = fromPtr (Proxy @"fILE__r")
+instance HasCField FILE "fILE__r"
+    where type CFieldType FILE "fILE__r" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "fILE__w" FILE ty
+    where hasField = \x_0 -> (\y_1 -> FILE{fILE__w = y_1,
+                                           fILE__r = getField @"fILE__r" x_0,
+                                           fILE__close = getField @"fILE__close" x_0},
+                              getField @"fILE__w" x_0)
+instance (~) ty CInt => HasField "fILE__w" (Ptr FILE) (Ptr ty)
+    where getField = fromPtr (Proxy @"fILE__w")
+instance HasCField FILE "fILE__w"
+    where type CFieldType FILE "fILE__w" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty (FunPtr (Ptr Void -> IO CInt)) =>
+         HasField "fILE__close" FILE ty
+    where hasField = \x_0 -> (\y_1 -> FILE{fILE__close = y_1,
+                                           fILE__r = getField @"fILE__r" x_0,
+                                           fILE__w = getField @"fILE__w" x_0},
+                              getField @"fILE__close" x_0)
+instance (~) ty (FunPtr (Ptr Void -> IO CInt)) =>
+         HasField "fILE__close" (Ptr FILE) (Ptr ty)
+    where getField = fromPtr (Proxy @"fILE__close")
+instance HasCField FILE "fILE__close"
+    where type CFieldType FILE "fILE__close" = FunPtr (Ptr Void ->
+                                                       IO CInt)
+          offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/attributes/deprecated/bindingspec.yaml b/test-artefacts/fixtures/attributes/deprecated/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/deprecated/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/attributes/deprecated/th.txt b/test-artefacts/fixtures/attributes/deprecated/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/deprecated/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/attributes/deprecated.h
diff --git a/test-artefacts/fixtures/attributes/type_attributes/Example.hs b/test-artefacts/fixtures/attributes/type_attributes/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/type_attributes/Example.hs
@@ -0,0 +1,694 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    , Example.More_aligned_int(..)
+    , Example.S2(..)
+    , Example.My_unpacked_struct(..)
+    , Example.My_packed_struct(..)
+    , Example.Wait_status_ptr_t(..)
+    , Example.Wait
+    , Example.T1(..)
+    , Example.Short_a(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @attributes\/type_attributes.h 8:8@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data S = S
+  { s_f :: CA.ConstantArray 3 BG.CShort
+    {- ^ __C declaration:__ @f@
+
+         __defined at:__ @attributes\/type_attributes.h 8:18@
+
+         __exported by:__ @attributes\/type_attributes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_f") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_f2 ->
+            HasCField.writeRaw (BG.Proxy @"s_f") ptr0 s_f2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @attributes\/type_attributes.h 8:18@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ CA.ConstantArray 3 BG.CShort
+         ) => BG.CompatHasField.HasField "s_f" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_f = y1}, BG.getField @"s_f" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CShort
+         ) => BG.HasField "s_f" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_f")
+
+instance HasCField.HasCField S "s_f" where
+
+  type CFieldType S "s_f" =
+    CA.ConstantArray 3 BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @more_aligned_int@
+
+    __defined at:__ @attributes\/type_attributes.h 9:13@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+newtype More_aligned_int = More_aligned_int
+  { unwrapMore_aligned_int :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMore_aligned_int" More_aligned_int ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          More_aligned_int {unwrapMore_aligned_int = y1}
+      , BG.getField @"unwrapMore_aligned_int" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMore_aligned_int" (BG.Ptr More_aligned_int) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMore_aligned_int")
+
+instance HasCField.HasCField More_aligned_int "unwrapMore_aligned_int" where
+
+  type CFieldType More_aligned_int "unwrapMore_aligned_int" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @attributes\/type_attributes.h 11:8@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data S2 = S2
+  { s2_f :: CA.ConstantArray 3 BG.CShort
+    {- ^ __C declaration:__ @f@
+
+         __defined at:__ @attributes\/type_attributes.h 11:19@
+
+         __exported by:__ @attributes\/type_attributes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2 where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (16 :: Int)
+
+instance Marshal.ReadRaw S2 where
+
+  readRaw =
+    \ptr0 ->
+          pure S2
+      <*> HasCField.readRaw (BG.Proxy @"s2_f") ptr0
+
+instance Marshal.WriteRaw S2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2 s2_f2 ->
+            HasCField.writeRaw (BG.Proxy @"s2_f") ptr0 s2_f2
+
+deriving via Marshal.EquivStorable S2 instance BG.Storable S2
+
+deriving via Struct.IsStructViaReadRaw S2 instance Struct.IsStruct S2
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @attributes\/type_attributes.h 11:19@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ CA.ConstantArray 3 BG.CShort
+         ) => BG.CompatHasField.HasField "s2_f" S2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S2 {s2_f = y1}, BG.getField @"s2_f" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CShort
+         ) => BG.HasField "s2_f" (BG.Ptr S2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_f")
+
+instance HasCField.HasCField S2 "s2_f" where
+
+  type CFieldType S2 "s2_f" =
+    CA.ConstantArray 3 BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct my_unpacked_struct@
+
+    __defined at:__ @attributes\/type_attributes.h 13:8@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data My_unpacked_struct = My_unpacked_struct
+  { my_unpacked_struct_c :: BG.CChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @attributes\/type_attributes.h 15:8@
+
+         __exported by:__ @attributes\/type_attributes.h@
+    -}
+  , my_unpacked_struct_i :: BG.CInt
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @attributes\/type_attributes.h 16:7@
+
+         __exported by:__ @attributes\/type_attributes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize My_unpacked_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw My_unpacked_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure My_unpacked_struct
+      <*> HasCField.readRaw (BG.Proxy @"my_unpacked_struct_c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"my_unpacked_struct_i") ptr0
+
+instance Marshal.WriteRaw My_unpacked_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          My_unpacked_struct my_unpacked_struct_c2 my_unpacked_struct_i3 ->
+               HasCField.writeRaw (BG.Proxy @"my_unpacked_struct_c") ptr0 my_unpacked_struct_c2
+            >> HasCField.writeRaw (BG.Proxy @"my_unpacked_struct_i") ptr0 my_unpacked_struct_i3
+
+deriving via Marshal.EquivStorable My_unpacked_struct instance BG.Storable My_unpacked_struct
+
+deriving via Struct.IsStructViaReadRaw My_unpacked_struct instance Struct.IsStruct My_unpacked_struct
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @attributes\/type_attributes.h 15:8@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "my_unpacked_struct_c" My_unpacked_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          My_unpacked_struct { my_unpacked_struct_c = y1
+                             , my_unpacked_struct_i = BG.getField @"my_unpacked_struct_i" x0
+                             }
+      , BG.getField @"my_unpacked_struct_c" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "my_unpacked_struct_c" (BG.Ptr My_unpacked_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"my_unpacked_struct_c")
+
+instance HasCField.HasCField My_unpacked_struct "my_unpacked_struct_c" where
+
+  type CFieldType My_unpacked_struct "my_unpacked_struct_c" =
+    BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @attributes\/type_attributes.h 16:7@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "my_unpacked_struct_i" My_unpacked_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          My_unpacked_struct { my_unpacked_struct_i = y1
+                             , my_unpacked_struct_c = BG.getField @"my_unpacked_struct_c" x0
+                             }
+      , BG.getField @"my_unpacked_struct_i" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "my_unpacked_struct_i" (BG.Ptr My_unpacked_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"my_unpacked_struct_i")
+
+instance HasCField.HasCField My_unpacked_struct "my_unpacked_struct_i" where
+
+  type CFieldType My_unpacked_struct "my_unpacked_struct_i" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct my_packed_struct@
+
+    __defined at:__ @attributes\/type_attributes.h 19:37@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data My_packed_struct = My_packed_struct
+  { my_packed_struct_c :: BG.CChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @attributes\/type_attributes.h 21:9@
+
+         __exported by:__ @attributes\/type_attributes.h@
+    -}
+  , my_packed_struct_i :: BG.CInt
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @attributes\/type_attributes.h 22:9@
+
+         __exported by:__ @attributes\/type_attributes.h@
+    -}
+  , my_packed_struct_s :: My_unpacked_struct
+    {- ^ __C declaration:__ @s@
+
+         __defined at:__ @attributes\/type_attributes.h 23:30@
+
+         __exported by:__ @attributes\/type_attributes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize My_packed_struct where
+
+  staticSizeOf = \_ -> (13 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw My_packed_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure My_packed_struct
+      <*> HasCField.readRaw (BG.Proxy @"my_packed_struct_c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"my_packed_struct_i") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"my_packed_struct_s") ptr0
+
+instance Marshal.WriteRaw My_packed_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          My_packed_struct my_packed_struct_c2 my_packed_struct_i3 my_packed_struct_s4 ->
+               HasCField.writeRaw (BG.Proxy @"my_packed_struct_c") ptr0 my_packed_struct_c2
+            >> HasCField.writeRaw (BG.Proxy @"my_packed_struct_i") ptr0 my_packed_struct_i3
+            >> HasCField.writeRaw (BG.Proxy @"my_packed_struct_s") ptr0 my_packed_struct_s4
+
+deriving via Marshal.EquivStorable My_packed_struct instance BG.Storable My_packed_struct
+
+deriving via Struct.IsStructViaReadRaw My_packed_struct instance Struct.IsStruct My_packed_struct
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @attributes\/type_attributes.h 21:9@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "my_packed_struct_c" My_packed_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          My_packed_struct { my_packed_struct_c = y1
+                           , my_packed_struct_i = BG.getField @"my_packed_struct_i" x0
+                           , my_packed_struct_s = BG.getField @"my_packed_struct_s" x0
+                           }
+      , BG.getField @"my_packed_struct_c" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "my_packed_struct_c" (BG.Ptr My_packed_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"my_packed_struct_c")
+
+instance HasCField.HasCField My_packed_struct "my_packed_struct_c" where
+
+  type CFieldType My_packed_struct "my_packed_struct_c" =
+    BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @attributes\/type_attributes.h 22:9@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "my_packed_struct_i" My_packed_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          My_packed_struct { my_packed_struct_i = y1
+                           , my_packed_struct_c = BG.getField @"my_packed_struct_c" x0
+                           , my_packed_struct_s = BG.getField @"my_packed_struct_s" x0
+                           }
+      , BG.getField @"my_packed_struct_i" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "my_packed_struct_i" (BG.Ptr My_packed_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"my_packed_struct_i")
+
+instance HasCField.HasCField My_packed_struct "my_packed_struct_i" where
+
+  type CFieldType My_packed_struct "my_packed_struct_i" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @s@
+
+    __defined at:__ @attributes\/type_attributes.h 23:30@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ My_unpacked_struct
+         ) => BG.CompatHasField.HasField "my_packed_struct_s" My_packed_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          My_packed_struct { my_packed_struct_s = y1
+                           , my_packed_struct_c = BG.getField @"my_packed_struct_c" x0
+                           , my_packed_struct_i = BG.getField @"my_packed_struct_i" x0
+                           }
+      , BG.getField @"my_packed_struct_s" x0
+      )
+
+instance ( ty ~ My_unpacked_struct
+         ) => BG.HasField "my_packed_struct_s" (BG.Ptr My_packed_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"my_packed_struct_s")
+
+instance HasCField.HasCField My_packed_struct "my_packed_struct_s" where
+
+  type CFieldType My_packed_struct "my_packed_struct_s" =
+    My_unpacked_struct
+
+  offset# = \_ -> \_ -> 5
+
+{-| __C declaration:__ @union wait_status_ptr_t@
+
+    __defined at:__ @attributes\/type_attributes.h 26:9@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+newtype Wait_status_ptr_t = Wait_status_ptr_t
+  { unwrapWait_status_ptr_t :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize Wait_status_ptr_t
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw Wait_status_ptr_t
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw Wait_status_ptr_t
+
+deriving via Marshal.EquivStorable Wait_status_ptr_t instance BG.Storable Wait_status_ptr_t
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion Wait_status_ptr_t
+
+{-| __C declaration:__ @__ip@
+
+    __defined at:__ @attributes\/type_attributes.h 28:8@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "wait_status_ptr_t___ip" Wait_status_ptr_t ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @__ip@
+
+    __defined at:__ @attributes\/type_attributes.h 28:8@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "wait_status_ptr_t___ip" Wait_status_ptr_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"wait_status_ptr_t___ip" x0)
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "wait_status_ptr_t___ip" (BG.Ptr Wait_status_ptr_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"wait_status_ptr_t___ip")
+
+instance HasCField.HasCField Wait_status_ptr_t "wait_status_ptr_t___ip" where
+
+  type CFieldType Wait_status_ptr_t "wait_status_ptr_t___ip" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @__up@
+
+    __defined at:__ @attributes\/type_attributes.h 29:15@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ BG.Ptr Wait
+         ) => BG.HasField "wait_status_ptr_t___up" Wait_status_ptr_t ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @__up@
+
+    __defined at:__ @attributes\/type_attributes.h 29:15@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+instance ( ty ~ BG.Ptr Wait
+         ) => BG.CompatHasField.HasField "wait_status_ptr_t___up" Wait_status_ptr_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"wait_status_ptr_t___up" x0)
+
+instance ( ty ~ BG.Ptr Wait
+         ) => BG.HasField "wait_status_ptr_t___up" (BG.Ptr Wait_status_ptr_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"wait_status_ptr_t___up")
+
+instance HasCField.HasCField Wait_status_ptr_t "wait_status_ptr_t___up" where
+
+  type CFieldType Wait_status_ptr_t "wait_status_ptr_t___up" =
+    BG.Ptr Wait
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union wait@
+
+    __defined at:__ @attributes\/type_attributes.h 29:9@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data Wait
+
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @attributes\/type_attributes.h 32:13@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT1" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T1 {unwrapT1 = y1}, BG.getField @"unwrapT1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT1" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT1")
+
+instance HasCField.HasCField T1 "unwrapT1" where
+
+  type CFieldType T1 "unwrapT1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @short_a@
+
+    __defined at:__ @attributes\/type_attributes.h 34:46@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+newtype Short_a = Short_a
+  { unwrapShort_a :: BG.CShort
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "unwrapShort_a" Short_a ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Short_a {unwrapShort_a = y1}, BG.getField @"unwrapShort_a" x0)
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "unwrapShort_a" (BG.Ptr Short_a) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapShort_a")
+
+instance HasCField.HasCField Short_a "unwrapShort_a" where
+
+  type CFieldType Short_a "unwrapShort_a" = BG.CShort
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/attributes/type_attributes/bindingspec.yaml b/test-artefacts/fixtures/attributes/type_attributes/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/type_attributes/bindingspec.yaml
@@ -0,0 +1,236 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: attributes/type_attributes.h
+  cname: struct S
+  hsname: S
+- headers: attributes/type_attributes.h
+  cname: more_aligned_int
+  hsname: More_aligned_int
+- headers: attributes/type_attributes.h
+  cname: struct S2
+  hsname: S2
+- headers: attributes/type_attributes.h
+  cname: struct my_unpacked_struct
+  hsname: My_unpacked_struct
+- headers: attributes/type_attributes.h
+  cname: struct my_packed_struct
+  hsname: My_packed_struct
+- headers: attributes/type_attributes.h
+  cname: union wait_status_ptr_t
+  hsname: Wait_status_ptr_t
+- headers: attributes/type_attributes.h
+  cname: union wait
+  hsname: Wait
+- headers: attributes/type_attributes.h
+  cname: wait_status_ptr_t
+  hsname: Wait_status_ptr_t
+- headers: attributes/type_attributes.h
+  cname: T1
+  hsname: T1
+- headers: attributes/type_attributes.h
+  cname: short_a
+  hsname: Short_a
+hstypes:
+- hsname: More_aligned_int
+  representation:
+    newtype:
+      constructor: More_aligned_int
+      fields:
+      - unwrapMore_aligned_int
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: My_packed_struct
+  representation:
+    record:
+      constructor: My_packed_struct
+      fields:
+      - my_packed_struct_c
+      - my_packed_struct_i
+      - my_packed_struct_s
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: My_unpacked_struct
+  representation:
+    record:
+      constructor: My_unpacked_struct
+      fields:
+      - my_unpacked_struct_c
+      - my_unpacked_struct_i
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_f
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2
+  representation:
+    record:
+      constructor: S2
+      fields:
+      - s2_f
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Short_a
+  representation:
+    newtype:
+      constructor: Short_a
+      fields:
+      - unwrapShort_a
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CShort
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Wait
+  representation: emptydata
+- hsname: Wait_status_ptr_t
+  representation:
+    newtype:
+      constructor: Wait_status_ptr_t
+      fields:
+      - unwrapWait_status_ptr_t
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/attributes/type_attributes/th.txt b/test-artefacts/fixtures/attributes/type_attributes/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/type_attributes/th.txt
@@ -0,0 +1,357 @@
+-- addDependentFile test-artefacts/headers/golden/attributes/type_attributes.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @attributes\/type_attributes.h 8:8@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data S
+    = S {s_f :: (ConstantArray 3 CShort)
+         {- ^ __C declaration:__ @f@
+
+              __defined at:__ @attributes\/type_attributes.h 8:18@
+
+              __exported by:__ @attributes\/type_attributes.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_f") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_f_2 -> writeRaw (Proxy @"s_f") ptr_0 s_f_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty (ConstantArray 3 CShort) => HasField "s_f" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_f = y_1},
+                              getField @"s_f" x_0)
+instance (~) ty (ConstantArray 3 CShort) =>
+         HasField "s_f" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_f")
+instance HasCField S "s_f"
+    where type CFieldType S "s_f" = ConstantArray 3 CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @more_aligned_int@
+
+    __defined at:__ @attributes\/type_attributes.h 9:13@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+newtype More_aligned_int
+    = More_aligned_int {unwrapMore_aligned_int :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapMore_aligned_int" More_aligned_int ty
+    where hasField = \x_0 -> (\y_1 -> More_aligned_int{unwrapMore_aligned_int = y_1},
+                              getField @"unwrapMore_aligned_int" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapMore_aligned_int" (Ptr More_aligned_int) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMore_aligned_int")
+instance HasCField More_aligned_int "unwrapMore_aligned_int"
+    where type CFieldType More_aligned_int
+                          "unwrapMore_aligned_int" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @attributes\/type_attributes.h 11:8@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data S2
+    = S2 {s2_f :: (ConstantArray 3 CShort)
+          {- ^ __C declaration:__ @f@
+
+               __defined at:__ @attributes\/type_attributes.h 11:19@
+
+               __exported by:__ @attributes\/type_attributes.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 16 :: Int
+instance ReadRaw S2
+    where readRaw = \ptr_0 -> pure S2 <*> readRaw (Proxy @"s2_f") ptr_0
+instance WriteRaw S2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2 s2_f_2 -> writeRaw (Proxy @"s2_f") ptr_0 s2_f_2
+deriving via (EquivStorable S2) instance Storable S2
+deriving via (IsStructViaReadRaw S2) instance IsStruct S2
+instance (~) ty (ConstantArray 3 CShort) => HasField "s2_f" S2 ty
+    where hasField = \x_0 -> (\y_1 -> S2{s2_f = y_1},
+                              getField @"s2_f" x_0)
+instance (~) ty (ConstantArray 3 CShort) =>
+         HasField "s2_f" (Ptr S2) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_f")
+instance HasCField S2 "s2_f"
+    where type CFieldType S2 "s2_f" = ConstantArray 3 CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct my_unpacked_struct@
+
+    __defined at:__ @attributes\/type_attributes.h 13:8@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data My_unpacked_struct
+    = My_unpacked_struct {my_unpacked_struct_c :: CChar
+                          {- ^ __C declaration:__ @c@
+
+                               __defined at:__ @attributes\/type_attributes.h 15:8@
+
+                               __exported by:__ @attributes\/type_attributes.h@
+                          -},
+                          my_unpacked_struct_i :: CInt
+                          {- ^ __C declaration:__ @i@
+
+                               __defined at:__ @attributes\/type_attributes.h 16:7@
+
+                               __exported by:__ @attributes\/type_attributes.h@
+                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize My_unpacked_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw My_unpacked_struct
+    where readRaw = \ptr_0 -> (pure My_unpacked_struct <*> readRaw (Proxy @"my_unpacked_struct_c") ptr_0) <*> readRaw (Proxy @"my_unpacked_struct_i") ptr_0
+instance WriteRaw My_unpacked_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       My_unpacked_struct my_unpacked_struct_c_2
+                                                          my_unpacked_struct_i_3 -> writeRaw (Proxy @"my_unpacked_struct_c") ptr_0 my_unpacked_struct_c_2 >> writeRaw (Proxy @"my_unpacked_struct_i") ptr_0 my_unpacked_struct_i_3
+deriving via (EquivStorable My_unpacked_struct) instance Storable My_unpacked_struct
+deriving via (IsStructViaReadRaw My_unpacked_struct) instance IsStruct My_unpacked_struct
+instance (~) ty CChar =>
+         HasField "my_unpacked_struct_c" My_unpacked_struct ty
+    where hasField = \x_0 -> (\y_1 -> My_unpacked_struct{my_unpacked_struct_c = y_1,
+                                                         my_unpacked_struct_i = getField @"my_unpacked_struct_i" x_0},
+                              getField @"my_unpacked_struct_c" x_0)
+instance (~) ty CChar =>
+         HasField "my_unpacked_struct_c" (Ptr My_unpacked_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"my_unpacked_struct_c")
+instance HasCField My_unpacked_struct "my_unpacked_struct_c"
+    where type CFieldType My_unpacked_struct
+                          "my_unpacked_struct_c" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "my_unpacked_struct_i" My_unpacked_struct ty
+    where hasField = \x_0 -> (\y_1 -> My_unpacked_struct{my_unpacked_struct_i = y_1,
+                                                         my_unpacked_struct_c = getField @"my_unpacked_struct_c" x_0},
+                              getField @"my_unpacked_struct_i" x_0)
+instance (~) ty CInt =>
+         HasField "my_unpacked_struct_i" (Ptr My_unpacked_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"my_unpacked_struct_i")
+instance HasCField My_unpacked_struct "my_unpacked_struct_i"
+    where type CFieldType My_unpacked_struct
+                          "my_unpacked_struct_i" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct my_packed_struct@
+
+    __defined at:__ @attributes\/type_attributes.h 19:37@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data My_packed_struct
+    = My_packed_struct {my_packed_struct_c :: CChar
+                        {- ^ __C declaration:__ @c@
+
+                             __defined at:__ @attributes\/type_attributes.h 21:9@
+
+                             __exported by:__ @attributes\/type_attributes.h@
+                        -},
+                        my_packed_struct_i :: CInt
+                        {- ^ __C declaration:__ @i@
+
+                             __defined at:__ @attributes\/type_attributes.h 22:9@
+
+                             __exported by:__ @attributes\/type_attributes.h@
+                        -},
+                        my_packed_struct_s :: My_unpacked_struct
+                        {- ^ __C declaration:__ @s@
+
+                             __defined at:__ @attributes\/type_attributes.h 23:30@
+
+                             __exported by:__ @attributes\/type_attributes.h@
+                        -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize My_packed_struct
+    where staticSizeOf = \_ -> 13 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw My_packed_struct
+    where readRaw = \ptr_0 -> ((pure My_packed_struct <*> readRaw (Proxy @"my_packed_struct_c") ptr_0) <*> readRaw (Proxy @"my_packed_struct_i") ptr_0) <*> readRaw (Proxy @"my_packed_struct_s") ptr_0
+instance WriteRaw My_packed_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       My_packed_struct my_packed_struct_c_2
+                                                        my_packed_struct_i_3
+                                                        my_packed_struct_s_4 -> writeRaw (Proxy @"my_packed_struct_c") ptr_0 my_packed_struct_c_2 >> (writeRaw (Proxy @"my_packed_struct_i") ptr_0 my_packed_struct_i_3 >> writeRaw (Proxy @"my_packed_struct_s") ptr_0 my_packed_struct_s_4)
+deriving via (EquivStorable My_packed_struct) instance Storable My_packed_struct
+deriving via (IsStructViaReadRaw My_packed_struct) instance IsStruct My_packed_struct
+instance (~) ty CChar =>
+         HasField "my_packed_struct_c" My_packed_struct ty
+    where hasField = \x_0 -> (\y_1 -> My_packed_struct{my_packed_struct_c = y_1,
+                                                       my_packed_struct_i = getField @"my_packed_struct_i" x_0,
+                                                       my_packed_struct_s = getField @"my_packed_struct_s" x_0},
+                              getField @"my_packed_struct_c" x_0)
+instance (~) ty CChar =>
+         HasField "my_packed_struct_c" (Ptr My_packed_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"my_packed_struct_c")
+instance HasCField My_packed_struct "my_packed_struct_c"
+    where type CFieldType My_packed_struct "my_packed_struct_c" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "my_packed_struct_i" My_packed_struct ty
+    where hasField = \x_0 -> (\y_1 -> My_packed_struct{my_packed_struct_i = y_1,
+                                                       my_packed_struct_c = getField @"my_packed_struct_c" x_0,
+                                                       my_packed_struct_s = getField @"my_packed_struct_s" x_0},
+                              getField @"my_packed_struct_i" x_0)
+instance (~) ty CInt =>
+         HasField "my_packed_struct_i" (Ptr My_packed_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"my_packed_struct_i")
+instance HasCField My_packed_struct "my_packed_struct_i"
+    where type CFieldType My_packed_struct "my_packed_struct_i" = CInt
+          offset# = \_ -> \_ -> 1
+instance (~) ty My_unpacked_struct =>
+         HasField "my_packed_struct_s" My_packed_struct ty
+    where hasField = \x_0 -> (\y_1 -> My_packed_struct{my_packed_struct_s = y_1,
+                                                       my_packed_struct_c = getField @"my_packed_struct_c" x_0,
+                                                       my_packed_struct_i = getField @"my_packed_struct_i" x_0},
+                              getField @"my_packed_struct_s" x_0)
+instance (~) ty My_unpacked_struct =>
+         HasField "my_packed_struct_s" (Ptr My_packed_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"my_packed_struct_s")
+instance HasCField My_packed_struct "my_packed_struct_s"
+    where type CFieldType My_packed_struct
+                          "my_packed_struct_s" = My_unpacked_struct
+          offset# = \_ -> \_ -> 5
+{-| __C declaration:__ @union wait_status_ptr_t@
+
+    __defined at:__ @attributes\/type_attributes.h 26:9@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+newtype Wait_status_ptr_t
+    = Wait_status_ptr_t {unwrapWait_status_ptr_t :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8
+                             8) instance StaticSize Wait_status_ptr_t
+deriving via (SizedByteArray 8
+                             8) instance ReadRaw Wait_status_ptr_t
+deriving via (SizedByteArray 8
+                             8) instance WriteRaw Wait_status_ptr_t
+deriving via (EquivStorable Wait_status_ptr_t) instance Storable Wait_status_ptr_t
+deriving via (SizedByteArray 8
+                             8) instance IsUnion Wait_status_ptr_t
+instance (~) ty (Ptr CInt) =>
+         HasField "wait_status_ptr_t___ip" Wait_status_ptr_t ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr CInt) =>
+         HasField "wait_status_ptr_t___ip" Wait_status_ptr_t ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"wait_status_ptr_t___ip" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "wait_status_ptr_t___ip" (Ptr Wait_status_ptr_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"wait_status_ptr_t___ip")
+instance HasCField Wait_status_ptr_t "wait_status_ptr_t___ip"
+    where type CFieldType Wait_status_ptr_t
+                          "wait_status_ptr_t___ip" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Wait) =>
+         HasField "wait_status_ptr_t___up" Wait_status_ptr_t ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr Wait) =>
+         HasField "wait_status_ptr_t___up" Wait_status_ptr_t ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"wait_status_ptr_t___up" x_0)
+instance (~) ty (Ptr Wait) =>
+         HasField "wait_status_ptr_t___up" (Ptr Wait_status_ptr_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"wait_status_ptr_t___up")
+instance HasCField Wait_status_ptr_t "wait_status_ptr_t___up"
+    where type CFieldType Wait_status_ptr_t
+                          "wait_status_ptr_t___up" = Ptr Wait
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union wait@
+
+    __defined at:__ @attributes\/type_attributes.h 29:9@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+data Wait
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @attributes\/type_attributes.h 32:13@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+newtype T1
+    = T1 {unwrapT1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT1" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{unwrapT1 = y_1},
+                              getField @"unwrapT1" x_0)
+instance (~) ty CInt => HasField "unwrapT1" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT1")
+instance HasCField T1 "unwrapT1"
+    where type CFieldType T1 "unwrapT1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @short_a@
+
+    __defined at:__ @attributes\/type_attributes.h 34:46@
+
+    __exported by:__ @attributes\/type_attributes.h@
+-}
+newtype Short_a
+    = Short_a {unwrapShort_a :: CShort}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CShort => HasField "unwrapShort_a" Short_a ty
+    where hasField = \x_0 -> (\y_1 -> Short_a{unwrapShort_a = y_1},
+                              getField @"unwrapShort_a" x_0)
+instance (~) ty CShort =>
+         HasField "unwrapShort_a" (Ptr Short_a) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapShort_a")
+instance HasCField Short_a "unwrapShort_a"
+    where type CFieldType Short_a "unwrapShort_a" = CShort
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/attributes/visibility/edge-cases/nested_types/Example.hs b/test-artefacts/fixtures/attributes/visibility/edge-cases/nested_types/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/edge-cases/nested_types/Example.hs
@@ -0,0 +1,146 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.U(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Int, pure, type (~))
+
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @attributes\/visibility\/edge-cases\/nested_types.h 3:49@
+
+    __exported by:__ @attributes\/visibility\/edge-cases\/nested_types.h@
+-}
+newtype U = U
+  { unwrapU :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U
+
+deriving via Marshal.EquivStorable U instance BG.Storable U
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/edge-cases\/nested_types.h 4:9@
+
+    __exported by:__ @attributes\/visibility\/edge-cases\/nested_types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u_x" U ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/edge-cases\/nested_types.h 4:9@
+
+    __exported by:__ @attributes\/visibility\/edge-cases\/nested_types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u_x" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u_x" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u_x")
+
+instance HasCField.HasCField U "u_x" where
+
+  type CFieldType U "u_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @attributes\/visibility\/edge-cases\/nested_types.h 2:49@
+
+    __exported by:__ @attributes\/visibility\/edge-cases\/nested_types.h@
+-}
+data S = S
+  { s_y :: U
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @attributes\/visibility\/edge-cases\/nested_types.h 5:5@
+
+         __exported by:__ @attributes\/visibility\/edge-cases\/nested_types.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_y") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_y2 ->
+            HasCField.writeRaw (BG.Proxy @"s_y") ptr0 s_y2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @attributes\/visibility\/edge-cases\/nested_types.h 5:5@
+
+    __exported by:__ @attributes\/visibility\/edge-cases\/nested_types.h@
+-}
+instance (ty ~ U) => BG.CompatHasField.HasField "s_y" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_y = y1}, BG.getField @"s_y" x0)
+
+instance (ty ~ U) => BG.HasField "s_y" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_y")
+
+instance HasCField.HasCField S "s_y" where
+
+  type CFieldType S "s_y" = U
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/attributes/visibility/edge-cases/nested_types/bindingspec.yaml b/test-artefacts/fixtures/attributes/visibility/edge-cases/nested_types/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/edge-cases/nested_types/bindingspec.yaml
@@ -0,0 +1,46 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: attributes/visibility/edge-cases/nested_types.h
+  cname: struct S
+  hsname: S
+- headers: attributes/visibility/edge-cases/nested_types.h
+  cname: union U
+  hsname: U
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_y
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/attributes/visibility/edge-cases/nested_types/th.txt b/test-artefacts/fixtures/attributes/visibility/edge-cases/nested_types/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/edge-cases/nested_types/th.txt
@@ -0,0 +1,56 @@
+-- addDependentFile test-artefacts/headers/golden/attributes/visibility/edge-cases/nested_types.h
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @attributes\/visibility\/edge-cases\/nested_types.h 3:49@
+
+    __exported by:__ @attributes\/visibility\/edge-cases\/nested_types.h@
+-}
+newtype U = U {unwrapU :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U
+deriving via (SizedByteArray 4 4) instance ReadRaw U
+deriving via (SizedByteArray 4 4) instance WriteRaw U
+deriving via (EquivStorable U) instance Storable U
+deriving via (SizedByteArray 4 4) instance IsUnion U
+instance (~) ty CInt => HasField "u_x" U ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u_x" U ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u_x" x_0)
+instance (~) ty CInt => HasField "u_x" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"u_x")
+instance HasCField U "u_x"
+    where type CFieldType U "u_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @attributes\/visibility\/edge-cases\/nested_types.h 2:49@
+
+    __exported by:__ @attributes\/visibility\/edge-cases\/nested_types.h@
+-}
+data S
+    = S {s_y :: U
+         {- ^ __C declaration:__ @y@
+
+              __defined at:__ @attributes\/visibility\/edge-cases\/nested_types.h 5:5@
+
+              __exported by:__ @attributes\/visibility\/edge-cases\/nested_types.h@
+         -}}
+    deriving stock Generic
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_y") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_y_2 -> writeRaw (Proxy @"s_y") ptr_0 s_y_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty U => HasField "s_y" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_y = y_1},
+                              getField @"s_y" x_0)
+instance (~) ty U => HasField "s_y" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y")
+instance HasCField S "s_y"
+    where type CFieldType S "s_y" = U
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/attributes/visibility/functions/Example/FunPtr.hs b/test-artefacts/fixtures/attributes/visibility/functions/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/functions/Example/FunPtr.hs
@@ -0,0 +1,796 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f0
+    , Example.FunPtr.f1
+    , Example.FunPtr.f2
+    , Example.FunPtr.f3
+    , Example.FunPtr.f4
+    , Example.FunPtr.f5
+    , Example.FunPtr.f6
+    , Example.FunPtr.f7
+    , Example.FunPtr.f8
+    , Example.FunPtr.f9
+    , Example.FunPtr.f10
+    , Example.FunPtr.f11
+    , Example.FunPtr.f12
+    , Example.FunPtr.f13
+    , Example.FunPtr.f14
+    , Example.FunPtr.f15
+    , Example.FunPtr.f16
+    , Example.FunPtr.f17
+    , Example.FunPtr.f18
+    , Example.FunPtr.f19
+    , Example.FunPtr.f20
+    , Example.FunPtr.f21
+    , Example.FunPtr.f22
+    , Example.FunPtr.f23
+    , Example.FunPtr.f24
+    , Example.FunPtr.f25
+    , Example.FunPtr.f26
+    , Example.FunPtr.f27
+    , Example.FunPtr.f28
+    , Example.FunPtr.f29
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <attributes/visibility/functions.h>"
+  , "/* test_attributesvisibilityfunction_Example_get_f0 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b669c12e6c979397 (void)) (void)"
+  , "{"
+  , "  return &f0;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d3717f29814cc38e (void)) (void)"
+  , "{"
+  , "  return &f1;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9951e77d56815b80 (void)) (void)"
+  , "{"
+  , "  return &f2;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_735be5e937ab9ad0 (void)) (void)"
+  , "{"
+  , "  return &f3;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2e181350411c95e9 (void)) (void)"
+  , "{"
+  , "  return &f4;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_514428a6d0d70211 (void)) (void)"
+  , "{"
+  , "  return &f5;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f6 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9b7f8e653b947b35 (void)) (void)"
+  , "{"
+  , "  return &f6;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f7 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_53b66f2ee9d5bea3 (void)) (void)"
+  , "{"
+  , "  return &f7;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f8 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_90ce84ff3a158d95 (void)) (void)"
+  , "{"
+  , "  return &f8;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f9 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_bd91fda2207a62eb (void)) (void)"
+  , "{"
+  , "  return &f9;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f10 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f216131cd3bd6919 (void)) (void)"
+  , "{"
+  , "  return &f10;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f11 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d40c26619dcfad79 (void)) (void)"
+  , "{"
+  , "  return &f11;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f12 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d507bba11a647ae8 (void)) (void)"
+  , "{"
+  , "  return &f12;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f13 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a90968b5f0eb111f (void)) (void)"
+  , "{"
+  , "  return &f13;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f14 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f584fb1da48609e4 (void)) (void)"
+  , "{"
+  , "  return &f14;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f15 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1c5f8cf4562364d0 (void)) (void)"
+  , "{"
+  , "  return &f15;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f16 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6af855fd845ff731 (void)) (void)"
+  , "{"
+  , "  return &f16;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f17 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c5aa3698b4ac9578 (void)) (void)"
+  , "{"
+  , "  return &f17;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f18 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_83b20ec12cdacad3 (void)) (void)"
+  , "{"
+  , "  return &f18;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f19 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9530c7f467585e16 (void)) (void)"
+  , "{"
+  , "  return &f19;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f20 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6b7091b3c8333945 (void)) (void)"
+  , "{"
+  , "  return &f20;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f21 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_58ed5b745dd5583b (void)) (void)"
+  , "{"
+  , "  return &f21;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f22 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2fc8f17386d9d13f (void)) (void)"
+  , "{"
+  , "  return &f22;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f23 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_155c186bf2426f9c (void)) (void)"
+  , "{"
+  , "  return &f23;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f24 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1c6a122ab1d7cef0 (void)) (void)"
+  , "{"
+  , "  return &f24;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f25 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_80ef1e1dba11ffdd (void)) (void)"
+  , "{"
+  , "  return &f25;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f26 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f7b63b778f9532da (void)) (void)"
+  , "{"
+  , "  return &f26;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f27 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_01ece11a3077bfd9 (void)) (void)"
+  , "{"
+  , "  return &f27;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f28 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0bc3e07b1934c20b (void)) (void)"
+  , "{"
+  , "  return &f28;"
+  , "}"
+  , "/* test_attributesvisibilityfunction_Example_get_f29 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f3734109e7f7d5ee (void)) (void)"
+  , "{"
+  , "  return &f29;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f0@
+foreign import ccall unsafe "hs_bindgen_b669c12e6c979397" hs_bindgen_b669c12e6c979397_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f0@
+hs_bindgen_b669c12e6c979397 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_b669c12e6c979397 =
+  fmap BG.fromFFIType hs_bindgen_b669c12e6c979397_base
+
+{-# NOINLINE f0 #-}
+{-| __C declaration:__ @f0@
+
+    __defined at:__ @attributes\/visibility\/functions.h 14:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f0 :: BG.FunPtr (IO ())
+f0 = BG.unsafePerformIO hs_bindgen_b669c12e6c979397
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_d3717f29814cc38e" hs_bindgen_d3717f29814cc38e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f1@
+hs_bindgen_d3717f29814cc38e :: IO (BG.FunPtr (IO ()))
+hs_bindgen_d3717f29814cc38e =
+  fmap BG.fromFFIType hs_bindgen_d3717f29814cc38e_base
+
+{-# NOINLINE f1 #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @attributes\/visibility\/functions.h 15:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f1 :: BG.FunPtr (IO ())
+f1 = BG.unsafePerformIO hs_bindgen_d3717f29814cc38e
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_9951e77d56815b80" hs_bindgen_9951e77d56815b80_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f2@
+hs_bindgen_9951e77d56815b80 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_9951e77d56815b80 =
+  fmap BG.fromFFIType hs_bindgen_9951e77d56815b80_base
+
+{-# NOINLINE f2 #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @attributes\/visibility\/functions.h 16:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f2 :: BG.FunPtr (IO ())
+f2 = BG.unsafePerformIO hs_bindgen_9951e77d56815b80
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_735be5e937ab9ad0" hs_bindgen_735be5e937ab9ad0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f3@
+hs_bindgen_735be5e937ab9ad0 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_735be5e937ab9ad0 =
+  fmap BG.fromFFIType hs_bindgen_735be5e937ab9ad0_base
+
+{-# NOINLINE f3 #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @attributes\/visibility\/functions.h 17:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f3 :: BG.FunPtr (IO ())
+f3 = BG.unsafePerformIO hs_bindgen_735be5e937ab9ad0
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f4@
+foreign import ccall unsafe "hs_bindgen_2e181350411c95e9" hs_bindgen_2e181350411c95e9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f4@
+hs_bindgen_2e181350411c95e9 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_2e181350411c95e9 =
+  fmap BG.fromFFIType hs_bindgen_2e181350411c95e9_base
+
+{-# NOINLINE f4 #-}
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @attributes\/visibility\/functions.h 18:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f4 :: BG.FunPtr (IO ())
+f4 = BG.unsafePerformIO hs_bindgen_2e181350411c95e9
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f5@
+foreign import ccall unsafe "hs_bindgen_514428a6d0d70211" hs_bindgen_514428a6d0d70211_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f5@
+hs_bindgen_514428a6d0d70211 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_514428a6d0d70211 =
+  fmap BG.fromFFIType hs_bindgen_514428a6d0d70211_base
+
+{-# NOINLINE f5 #-}
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @attributes\/visibility\/functions.h 21:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f5 :: BG.FunPtr (IO ())
+f5 = BG.unsafePerformIO hs_bindgen_514428a6d0d70211
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f6@
+foreign import ccall unsafe "hs_bindgen_9b7f8e653b947b35" hs_bindgen_9b7f8e653b947b35_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f6@
+hs_bindgen_9b7f8e653b947b35 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_9b7f8e653b947b35 =
+  fmap BG.fromFFIType hs_bindgen_9b7f8e653b947b35_base
+
+{-# NOINLINE f6 #-}
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @attributes\/visibility\/functions.h 22:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f6 :: BG.FunPtr (IO ())
+f6 = BG.unsafePerformIO hs_bindgen_9b7f8e653b947b35
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f7@
+foreign import ccall unsafe "hs_bindgen_53b66f2ee9d5bea3" hs_bindgen_53b66f2ee9d5bea3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f7@
+hs_bindgen_53b66f2ee9d5bea3 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_53b66f2ee9d5bea3 =
+  fmap BG.fromFFIType hs_bindgen_53b66f2ee9d5bea3_base
+
+{-# NOINLINE f7 #-}
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @attributes\/visibility\/functions.h 23:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f7 :: BG.FunPtr (IO ())
+f7 = BG.unsafePerformIO hs_bindgen_53b66f2ee9d5bea3
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f8@
+foreign import ccall unsafe "hs_bindgen_90ce84ff3a158d95" hs_bindgen_90ce84ff3a158d95_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f8@
+hs_bindgen_90ce84ff3a158d95 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_90ce84ff3a158d95 =
+  fmap BG.fromFFIType hs_bindgen_90ce84ff3a158d95_base
+
+{-# NOINLINE f8 #-}
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @attributes\/visibility\/functions.h 24:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f8 :: BG.FunPtr (IO ())
+f8 = BG.unsafePerformIO hs_bindgen_90ce84ff3a158d95
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f9@
+foreign import ccall unsafe "hs_bindgen_bd91fda2207a62eb" hs_bindgen_bd91fda2207a62eb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f9@
+hs_bindgen_bd91fda2207a62eb :: IO (BG.FunPtr (IO ()))
+hs_bindgen_bd91fda2207a62eb =
+  fmap BG.fromFFIType hs_bindgen_bd91fda2207a62eb_base
+
+{-# NOINLINE f9 #-}
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @attributes\/visibility\/functions.h 25:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f9 :: BG.FunPtr (IO ())
+f9 = BG.unsafePerformIO hs_bindgen_bd91fda2207a62eb
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f10@
+foreign import ccall unsafe "hs_bindgen_f216131cd3bd6919" hs_bindgen_f216131cd3bd6919_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f10@
+hs_bindgen_f216131cd3bd6919 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_f216131cd3bd6919 =
+  fmap BG.fromFFIType hs_bindgen_f216131cd3bd6919_base
+
+{-# NOINLINE f10 #-}
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @attributes\/visibility\/functions.h 28:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f10 :: BG.FunPtr (IO ())
+f10 = BG.unsafePerformIO hs_bindgen_f216131cd3bd6919
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f11@
+foreign import ccall unsafe "hs_bindgen_d40c26619dcfad79" hs_bindgen_d40c26619dcfad79_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f11@
+hs_bindgen_d40c26619dcfad79 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_d40c26619dcfad79 =
+  fmap BG.fromFFIType hs_bindgen_d40c26619dcfad79_base
+
+{-# NOINLINE f11 #-}
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @attributes\/visibility\/functions.h 29:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f11 :: BG.FunPtr (IO ())
+f11 = BG.unsafePerformIO hs_bindgen_d40c26619dcfad79
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f12@
+foreign import ccall unsafe "hs_bindgen_d507bba11a647ae8" hs_bindgen_d507bba11a647ae8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f12@
+hs_bindgen_d507bba11a647ae8 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_d507bba11a647ae8 =
+  fmap BG.fromFFIType hs_bindgen_d507bba11a647ae8_base
+
+{-# NOINLINE f12 #-}
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @attributes\/visibility\/functions.h 30:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f12 :: BG.FunPtr (IO ())
+f12 = BG.unsafePerformIO hs_bindgen_d507bba11a647ae8
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f13@
+foreign import ccall unsafe "hs_bindgen_a90968b5f0eb111f" hs_bindgen_a90968b5f0eb111f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f13@
+hs_bindgen_a90968b5f0eb111f :: IO (BG.FunPtr (IO ()))
+hs_bindgen_a90968b5f0eb111f =
+  fmap BG.fromFFIType hs_bindgen_a90968b5f0eb111f_base
+
+{-# NOINLINE f13 #-}
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @attributes\/visibility\/functions.h 31:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f13 :: BG.FunPtr (IO ())
+f13 = BG.unsafePerformIO hs_bindgen_a90968b5f0eb111f
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f14@
+foreign import ccall unsafe "hs_bindgen_f584fb1da48609e4" hs_bindgen_f584fb1da48609e4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f14@
+hs_bindgen_f584fb1da48609e4 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_f584fb1da48609e4 =
+  fmap BG.fromFFIType hs_bindgen_f584fb1da48609e4_base
+
+{-# NOINLINE f14 #-}
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @attributes\/visibility\/functions.h 32:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f14 :: BG.FunPtr (IO ())
+f14 = BG.unsafePerformIO hs_bindgen_f584fb1da48609e4
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f15@
+foreign import ccall unsafe "hs_bindgen_1c5f8cf4562364d0" hs_bindgen_1c5f8cf4562364d0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f15@
+hs_bindgen_1c5f8cf4562364d0 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_1c5f8cf4562364d0 =
+  fmap BG.fromFFIType hs_bindgen_1c5f8cf4562364d0_base
+
+{-# NOINLINE f15 #-}
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @attributes\/visibility\/functions.h 35:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f15 :: BG.FunPtr (IO ())
+f15 = BG.unsafePerformIO hs_bindgen_1c5f8cf4562364d0
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f16@
+foreign import ccall unsafe "hs_bindgen_6af855fd845ff731" hs_bindgen_6af855fd845ff731_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f16@
+hs_bindgen_6af855fd845ff731 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_6af855fd845ff731 =
+  fmap BG.fromFFIType hs_bindgen_6af855fd845ff731_base
+
+{-# NOINLINE f16 #-}
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @attributes\/visibility\/functions.h 36:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f16 :: BG.FunPtr (IO ())
+f16 = BG.unsafePerformIO hs_bindgen_6af855fd845ff731
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f17@
+foreign import ccall unsafe "hs_bindgen_c5aa3698b4ac9578" hs_bindgen_c5aa3698b4ac9578_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f17@
+hs_bindgen_c5aa3698b4ac9578 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_c5aa3698b4ac9578 =
+  fmap BG.fromFFIType hs_bindgen_c5aa3698b4ac9578_base
+
+{-# NOINLINE f17 #-}
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @attributes\/visibility\/functions.h 37:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f17 :: BG.FunPtr (IO ())
+f17 = BG.unsafePerformIO hs_bindgen_c5aa3698b4ac9578
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f18@
+foreign import ccall unsafe "hs_bindgen_83b20ec12cdacad3" hs_bindgen_83b20ec12cdacad3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f18@
+hs_bindgen_83b20ec12cdacad3 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_83b20ec12cdacad3 =
+  fmap BG.fromFFIType hs_bindgen_83b20ec12cdacad3_base
+
+{-# NOINLINE f18 #-}
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @attributes\/visibility\/functions.h 38:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f18 :: BG.FunPtr (IO ())
+f18 = BG.unsafePerformIO hs_bindgen_83b20ec12cdacad3
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f19@
+foreign import ccall unsafe "hs_bindgen_9530c7f467585e16" hs_bindgen_9530c7f467585e16_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f19@
+hs_bindgen_9530c7f467585e16 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_9530c7f467585e16 =
+  fmap BG.fromFFIType hs_bindgen_9530c7f467585e16_base
+
+{-# NOINLINE f19 #-}
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @attributes\/visibility\/functions.h 39:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f19 :: BG.FunPtr (IO ())
+f19 = BG.unsafePerformIO hs_bindgen_9530c7f467585e16
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f20@
+foreign import ccall unsafe "hs_bindgen_6b7091b3c8333945" hs_bindgen_6b7091b3c8333945_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f20@
+hs_bindgen_6b7091b3c8333945 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_6b7091b3c8333945 =
+  fmap BG.fromFFIType hs_bindgen_6b7091b3c8333945_base
+
+{-# NOINLINE f20 #-}
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @attributes\/visibility\/functions.h 42:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f20 :: BG.FunPtr (IO ())
+f20 = BG.unsafePerformIO hs_bindgen_6b7091b3c8333945
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f21@
+foreign import ccall unsafe "hs_bindgen_58ed5b745dd5583b" hs_bindgen_58ed5b745dd5583b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f21@
+hs_bindgen_58ed5b745dd5583b :: IO (BG.FunPtr (IO ()))
+hs_bindgen_58ed5b745dd5583b =
+  fmap BG.fromFFIType hs_bindgen_58ed5b745dd5583b_base
+
+{-# NOINLINE f21 #-}
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @attributes\/visibility\/functions.h 43:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f21 :: BG.FunPtr (IO ())
+f21 = BG.unsafePerformIO hs_bindgen_58ed5b745dd5583b
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f22@
+foreign import ccall unsafe "hs_bindgen_2fc8f17386d9d13f" hs_bindgen_2fc8f17386d9d13f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f22@
+hs_bindgen_2fc8f17386d9d13f :: IO (BG.FunPtr (IO ()))
+hs_bindgen_2fc8f17386d9d13f =
+  fmap BG.fromFFIType hs_bindgen_2fc8f17386d9d13f_base
+
+{-# NOINLINE f22 #-}
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @attributes\/visibility\/functions.h 44:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f22 :: BG.FunPtr (IO ())
+f22 = BG.unsafePerformIO hs_bindgen_2fc8f17386d9d13f
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f23@
+foreign import ccall unsafe "hs_bindgen_155c186bf2426f9c" hs_bindgen_155c186bf2426f9c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f23@
+hs_bindgen_155c186bf2426f9c :: IO (BG.FunPtr (IO ()))
+hs_bindgen_155c186bf2426f9c =
+  fmap BG.fromFFIType hs_bindgen_155c186bf2426f9c_base
+
+{-# NOINLINE f23 #-}
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @attributes\/visibility\/functions.h 45:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f23 :: BG.FunPtr (IO ())
+f23 = BG.unsafePerformIO hs_bindgen_155c186bf2426f9c
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f24@
+foreign import ccall unsafe "hs_bindgen_1c6a122ab1d7cef0" hs_bindgen_1c6a122ab1d7cef0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f24@
+hs_bindgen_1c6a122ab1d7cef0 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_1c6a122ab1d7cef0 =
+  fmap BG.fromFFIType hs_bindgen_1c6a122ab1d7cef0_base
+
+{-# NOINLINE f24 #-}
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @attributes\/visibility\/functions.h 46:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f24 :: BG.FunPtr (IO ())
+f24 = BG.unsafePerformIO hs_bindgen_1c6a122ab1d7cef0
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f25@
+foreign import ccall unsafe "hs_bindgen_80ef1e1dba11ffdd" hs_bindgen_80ef1e1dba11ffdd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f25@
+hs_bindgen_80ef1e1dba11ffdd :: IO (BG.FunPtr (IO ()))
+hs_bindgen_80ef1e1dba11ffdd =
+  fmap BG.fromFFIType hs_bindgen_80ef1e1dba11ffdd_base
+
+{-# NOINLINE f25 #-}
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @attributes\/visibility\/functions.h 49:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f25 :: BG.FunPtr (IO ())
+f25 = BG.unsafePerformIO hs_bindgen_80ef1e1dba11ffdd
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f26@
+foreign import ccall unsafe "hs_bindgen_f7b63b778f9532da" hs_bindgen_f7b63b778f9532da_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f26@
+hs_bindgen_f7b63b778f9532da :: IO (BG.FunPtr (IO ()))
+hs_bindgen_f7b63b778f9532da =
+  fmap BG.fromFFIType hs_bindgen_f7b63b778f9532da_base
+
+{-# NOINLINE f26 #-}
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @attributes\/visibility\/functions.h 50:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f26 :: BG.FunPtr (IO ())
+f26 = BG.unsafePerformIO hs_bindgen_f7b63b778f9532da
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f27@
+foreign import ccall unsafe "hs_bindgen_01ece11a3077bfd9" hs_bindgen_01ece11a3077bfd9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f27@
+hs_bindgen_01ece11a3077bfd9 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_01ece11a3077bfd9 =
+  fmap BG.fromFFIType hs_bindgen_01ece11a3077bfd9_base
+
+{-# NOINLINE f27 #-}
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @attributes\/visibility\/functions.h 51:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f27 :: BG.FunPtr (IO ())
+f27 = BG.unsafePerformIO hs_bindgen_01ece11a3077bfd9
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f28@
+foreign import ccall unsafe "hs_bindgen_0bc3e07b1934c20b" hs_bindgen_0bc3e07b1934c20b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f28@
+hs_bindgen_0bc3e07b1934c20b :: IO (BG.FunPtr (IO ()))
+hs_bindgen_0bc3e07b1934c20b =
+  fmap BG.fromFFIType hs_bindgen_0bc3e07b1934c20b_base
+
+{-# NOINLINE f28 #-}
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @attributes\/visibility\/functions.h 52:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f28 :: BG.FunPtr (IO ())
+f28 = BG.unsafePerformIO hs_bindgen_0bc3e07b1934c20b
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f29@
+foreign import ccall unsafe "hs_bindgen_f3734109e7f7d5ee" hs_bindgen_f3734109e7f7d5ee_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f29@
+hs_bindgen_f3734109e7f7d5ee :: IO (BG.FunPtr (IO ()))
+hs_bindgen_f3734109e7f7d5ee =
+  fmap BG.fromFFIType hs_bindgen_f3734109e7f7d5ee_base
+
+{-# NOINLINE f29 #-}
+{-| __C declaration:__ @f29@
+
+    __defined at:__ @attributes\/visibility\/functions.h 53:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f29 :: BG.FunPtr (IO ())
+f29 = BG.unsafePerformIO hs_bindgen_f3734109e7f7d5ee
diff --git a/test-artefacts/fixtures/attributes/visibility/functions/Example/Safe.hs b/test-artefacts/fixtures/attributes/visibility/functions/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/functions/Example/Safe.hs
@@ -0,0 +1,705 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f0
+    , Example.Safe.f1
+    , Example.Safe.f2
+    , Example.Safe.f3
+    , Example.Safe.f4
+    , Example.Safe.f5
+    , Example.Safe.f6
+    , Example.Safe.f7
+    , Example.Safe.f8
+    , Example.Safe.f9
+    , Example.Safe.f10
+    , Example.Safe.f11
+    , Example.Safe.f12
+    , Example.Safe.f13
+    , Example.Safe.f14
+    , Example.Safe.f15
+    , Example.Safe.f16
+    , Example.Safe.f17
+    , Example.Safe.f18
+    , Example.Safe.f19
+    , Example.Safe.f20
+    , Example.Safe.f21
+    , Example.Safe.f22
+    , Example.Safe.f23
+    , Example.Safe.f24
+    , Example.Safe.f25
+    , Example.Safe.f26
+    , Example.Safe.f27
+    , Example.Safe.f28
+    , Example.Safe.f29
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <attributes/visibility/functions.h>"
+  , "void hs_bindgen_3f27c62fb190454a (void)"
+  , "{"
+  , "  (f0)();"
+  , "}"
+  , "void hs_bindgen_1baf9aba48bb8585 (void)"
+  , "{"
+  , "  (f1)();"
+  , "}"
+  , "void hs_bindgen_9de994ef69391f75 (void)"
+  , "{"
+  , "  (f2)();"
+  , "}"
+  , "void hs_bindgen_e7b6b3fe1e458b05 (void)"
+  , "{"
+  , "  (f3)();"
+  , "}"
+  , "void hs_bindgen_55f6714f782d28a7 (void)"
+  , "{"
+  , "  (f4)();"
+  , "}"
+  , "void hs_bindgen_08ec707e7bc17377 (void)"
+  , "{"
+  , "  (f5)();"
+  , "}"
+  , "void hs_bindgen_610d965a82ee5d22 (void)"
+  , "{"
+  , "  (f6)();"
+  , "}"
+  , "void hs_bindgen_5f54d7b893c2f695 (void)"
+  , "{"
+  , "  (f7)();"
+  , "}"
+  , "void hs_bindgen_219c458bfad16b17 (void)"
+  , "{"
+  , "  (f8)();"
+  , "}"
+  , "void hs_bindgen_5d3fb29d7697a006 (void)"
+  , "{"
+  , "  (f9)();"
+  , "}"
+  , "void hs_bindgen_5064aed792451d33 (void)"
+  , "{"
+  , "  (f10)();"
+  , "}"
+  , "void hs_bindgen_25e0cdea1045ed28 (void)"
+  , "{"
+  , "  (f11)();"
+  , "}"
+  , "void hs_bindgen_729b9541b191c0a9 (void)"
+  , "{"
+  , "  (f12)();"
+  , "}"
+  , "void hs_bindgen_570476629e39b1ad (void)"
+  , "{"
+  , "  (f13)();"
+  , "}"
+  , "void hs_bindgen_094d4428896cec1a (void)"
+  , "{"
+  , "  (f14)();"
+  , "}"
+  , "void hs_bindgen_a15c67349afb7d1b (void)"
+  , "{"
+  , "  (f15)();"
+  , "}"
+  , "void hs_bindgen_024506459e135eeb (void)"
+  , "{"
+  , "  (f16)();"
+  , "}"
+  , "void hs_bindgen_8297e7356e9a3699 (void)"
+  , "{"
+  , "  (f17)();"
+  , "}"
+  , "void hs_bindgen_8c9d69b89b46c409 (void)"
+  , "{"
+  , "  (f18)();"
+  , "}"
+  , "void hs_bindgen_411e20c811bb4f75 (void)"
+  , "{"
+  , "  (f19)();"
+  , "}"
+  , "void hs_bindgen_57573c31920ee01d (void)"
+  , "{"
+  , "  (f20)();"
+  , "}"
+  , "void hs_bindgen_0f3e02be6a27086a (void)"
+  , "{"
+  , "  (f21)();"
+  , "}"
+  , "void hs_bindgen_03810317ee329129 (void)"
+  , "{"
+  , "  (f22)();"
+  , "}"
+  , "void hs_bindgen_e2fd13d795062844 (void)"
+  , "{"
+  , "  (f23)();"
+  , "}"
+  , "void hs_bindgen_87272e2adfb6015b (void)"
+  , "{"
+  , "  (f24)();"
+  , "}"
+  , "void hs_bindgen_b573824e77968985 (void)"
+  , "{"
+  , "  (f25)();"
+  , "}"
+  , "void hs_bindgen_9b5ba03996903917 (void)"
+  , "{"
+  , "  (f26)();"
+  , "}"
+  , "void hs_bindgen_4d6e2dac36287b1e (void)"
+  , "{"
+  , "  (f27)();"
+  , "}"
+  , "void hs_bindgen_d8e66fca82e1889d (void)"
+  , "{"
+  , "  (f28)();"
+  , "}"
+  , "void hs_bindgen_600c38ba2dfb8c71 (void)"
+  , "{"
+  , "  (f29)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f0@
+foreign import ccall safe "hs_bindgen_3f27c62fb190454a" hs_bindgen_3f27c62fb190454a_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f0@
+hs_bindgen_3f27c62fb190454a :: IO ()
+hs_bindgen_3f27c62fb190454a =
+  hs_bindgen_3f27c62fb190454a_base
+
+{-| __C declaration:__ @f0@
+
+    __defined at:__ @attributes\/visibility\/functions.h 14:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f0 :: IO ()
+f0 = hs_bindgen_3f27c62fb190454a
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_1baf9aba48bb8585" hs_bindgen_1baf9aba48bb8585_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f1@
+hs_bindgen_1baf9aba48bb8585 :: IO ()
+hs_bindgen_1baf9aba48bb8585 =
+  hs_bindgen_1baf9aba48bb8585_base
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @attributes\/visibility\/functions.h 15:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f1 :: IO ()
+f1 = hs_bindgen_1baf9aba48bb8585
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_9de994ef69391f75" hs_bindgen_9de994ef69391f75_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f2@
+hs_bindgen_9de994ef69391f75 :: IO ()
+hs_bindgen_9de994ef69391f75 =
+  hs_bindgen_9de994ef69391f75_base
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @attributes\/visibility\/functions.h 16:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f2 :: IO ()
+f2 = hs_bindgen_9de994ef69391f75
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_e7b6b3fe1e458b05" hs_bindgen_e7b6b3fe1e458b05_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f3@
+hs_bindgen_e7b6b3fe1e458b05 :: IO ()
+hs_bindgen_e7b6b3fe1e458b05 =
+  hs_bindgen_e7b6b3fe1e458b05_base
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @attributes\/visibility\/functions.h 17:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f3 :: IO ()
+f3 = hs_bindgen_e7b6b3fe1e458b05
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f4@
+foreign import ccall safe "hs_bindgen_55f6714f782d28a7" hs_bindgen_55f6714f782d28a7_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f4@
+hs_bindgen_55f6714f782d28a7 :: IO ()
+hs_bindgen_55f6714f782d28a7 =
+  hs_bindgen_55f6714f782d28a7_base
+
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @attributes\/visibility\/functions.h 18:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f4 :: IO ()
+f4 = hs_bindgen_55f6714f782d28a7
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f5@
+foreign import ccall safe "hs_bindgen_08ec707e7bc17377" hs_bindgen_08ec707e7bc17377_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f5@
+hs_bindgen_08ec707e7bc17377 :: IO ()
+hs_bindgen_08ec707e7bc17377 =
+  hs_bindgen_08ec707e7bc17377_base
+
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @attributes\/visibility\/functions.h 21:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f5 :: IO ()
+f5 = hs_bindgen_08ec707e7bc17377
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f6@
+foreign import ccall safe "hs_bindgen_610d965a82ee5d22" hs_bindgen_610d965a82ee5d22_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f6@
+hs_bindgen_610d965a82ee5d22 :: IO ()
+hs_bindgen_610d965a82ee5d22 =
+  hs_bindgen_610d965a82ee5d22_base
+
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @attributes\/visibility\/functions.h 22:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f6 :: IO ()
+f6 = hs_bindgen_610d965a82ee5d22
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f7@
+foreign import ccall safe "hs_bindgen_5f54d7b893c2f695" hs_bindgen_5f54d7b893c2f695_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f7@
+hs_bindgen_5f54d7b893c2f695 :: IO ()
+hs_bindgen_5f54d7b893c2f695 =
+  hs_bindgen_5f54d7b893c2f695_base
+
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @attributes\/visibility\/functions.h 23:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f7 :: IO ()
+f7 = hs_bindgen_5f54d7b893c2f695
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f8@
+foreign import ccall safe "hs_bindgen_219c458bfad16b17" hs_bindgen_219c458bfad16b17_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f8@
+hs_bindgen_219c458bfad16b17 :: IO ()
+hs_bindgen_219c458bfad16b17 =
+  hs_bindgen_219c458bfad16b17_base
+
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @attributes\/visibility\/functions.h 24:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f8 :: IO ()
+f8 = hs_bindgen_219c458bfad16b17
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f9@
+foreign import ccall safe "hs_bindgen_5d3fb29d7697a006" hs_bindgen_5d3fb29d7697a006_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f9@
+hs_bindgen_5d3fb29d7697a006 :: IO ()
+hs_bindgen_5d3fb29d7697a006 =
+  hs_bindgen_5d3fb29d7697a006_base
+
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @attributes\/visibility\/functions.h 25:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f9 :: IO ()
+f9 = hs_bindgen_5d3fb29d7697a006
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f10@
+foreign import ccall safe "hs_bindgen_5064aed792451d33" hs_bindgen_5064aed792451d33_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f10@
+hs_bindgen_5064aed792451d33 :: IO ()
+hs_bindgen_5064aed792451d33 =
+  hs_bindgen_5064aed792451d33_base
+
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @attributes\/visibility\/functions.h 28:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f10 :: IO ()
+f10 = hs_bindgen_5064aed792451d33
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f11@
+foreign import ccall safe "hs_bindgen_25e0cdea1045ed28" hs_bindgen_25e0cdea1045ed28_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f11@
+hs_bindgen_25e0cdea1045ed28 :: IO ()
+hs_bindgen_25e0cdea1045ed28 =
+  hs_bindgen_25e0cdea1045ed28_base
+
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @attributes\/visibility\/functions.h 29:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f11 :: IO ()
+f11 = hs_bindgen_25e0cdea1045ed28
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f12@
+foreign import ccall safe "hs_bindgen_729b9541b191c0a9" hs_bindgen_729b9541b191c0a9_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f12@
+hs_bindgen_729b9541b191c0a9 :: IO ()
+hs_bindgen_729b9541b191c0a9 =
+  hs_bindgen_729b9541b191c0a9_base
+
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @attributes\/visibility\/functions.h 30:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f12 :: IO ()
+f12 = hs_bindgen_729b9541b191c0a9
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f13@
+foreign import ccall safe "hs_bindgen_570476629e39b1ad" hs_bindgen_570476629e39b1ad_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f13@
+hs_bindgen_570476629e39b1ad :: IO ()
+hs_bindgen_570476629e39b1ad =
+  hs_bindgen_570476629e39b1ad_base
+
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @attributes\/visibility\/functions.h 31:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f13 :: IO ()
+f13 = hs_bindgen_570476629e39b1ad
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f14@
+foreign import ccall safe "hs_bindgen_094d4428896cec1a" hs_bindgen_094d4428896cec1a_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f14@
+hs_bindgen_094d4428896cec1a :: IO ()
+hs_bindgen_094d4428896cec1a =
+  hs_bindgen_094d4428896cec1a_base
+
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @attributes\/visibility\/functions.h 32:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f14 :: IO ()
+f14 = hs_bindgen_094d4428896cec1a
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f15@
+foreign import ccall safe "hs_bindgen_a15c67349afb7d1b" hs_bindgen_a15c67349afb7d1b_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f15@
+hs_bindgen_a15c67349afb7d1b :: IO ()
+hs_bindgen_a15c67349afb7d1b =
+  hs_bindgen_a15c67349afb7d1b_base
+
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @attributes\/visibility\/functions.h 35:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f15 :: IO ()
+f15 = hs_bindgen_a15c67349afb7d1b
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f16@
+foreign import ccall safe "hs_bindgen_024506459e135eeb" hs_bindgen_024506459e135eeb_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f16@
+hs_bindgen_024506459e135eeb :: IO ()
+hs_bindgen_024506459e135eeb =
+  hs_bindgen_024506459e135eeb_base
+
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @attributes\/visibility\/functions.h 36:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f16 :: IO ()
+f16 = hs_bindgen_024506459e135eeb
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f17@
+foreign import ccall safe "hs_bindgen_8297e7356e9a3699" hs_bindgen_8297e7356e9a3699_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f17@
+hs_bindgen_8297e7356e9a3699 :: IO ()
+hs_bindgen_8297e7356e9a3699 =
+  hs_bindgen_8297e7356e9a3699_base
+
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @attributes\/visibility\/functions.h 37:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f17 :: IO ()
+f17 = hs_bindgen_8297e7356e9a3699
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f18@
+foreign import ccall safe "hs_bindgen_8c9d69b89b46c409" hs_bindgen_8c9d69b89b46c409_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f18@
+hs_bindgen_8c9d69b89b46c409 :: IO ()
+hs_bindgen_8c9d69b89b46c409 =
+  hs_bindgen_8c9d69b89b46c409_base
+
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @attributes\/visibility\/functions.h 38:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f18 :: IO ()
+f18 = hs_bindgen_8c9d69b89b46c409
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f19@
+foreign import ccall safe "hs_bindgen_411e20c811bb4f75" hs_bindgen_411e20c811bb4f75_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f19@
+hs_bindgen_411e20c811bb4f75 :: IO ()
+hs_bindgen_411e20c811bb4f75 =
+  hs_bindgen_411e20c811bb4f75_base
+
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @attributes\/visibility\/functions.h 39:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f19 :: IO ()
+f19 = hs_bindgen_411e20c811bb4f75
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f20@
+foreign import ccall safe "hs_bindgen_57573c31920ee01d" hs_bindgen_57573c31920ee01d_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f20@
+hs_bindgen_57573c31920ee01d :: IO ()
+hs_bindgen_57573c31920ee01d =
+  hs_bindgen_57573c31920ee01d_base
+
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @attributes\/visibility\/functions.h 42:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f20 :: IO ()
+f20 = hs_bindgen_57573c31920ee01d
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f21@
+foreign import ccall safe "hs_bindgen_0f3e02be6a27086a" hs_bindgen_0f3e02be6a27086a_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f21@
+hs_bindgen_0f3e02be6a27086a :: IO ()
+hs_bindgen_0f3e02be6a27086a =
+  hs_bindgen_0f3e02be6a27086a_base
+
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @attributes\/visibility\/functions.h 43:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f21 :: IO ()
+f21 = hs_bindgen_0f3e02be6a27086a
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f22@
+foreign import ccall safe "hs_bindgen_03810317ee329129" hs_bindgen_03810317ee329129_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f22@
+hs_bindgen_03810317ee329129 :: IO ()
+hs_bindgen_03810317ee329129 =
+  hs_bindgen_03810317ee329129_base
+
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @attributes\/visibility\/functions.h 44:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f22 :: IO ()
+f22 = hs_bindgen_03810317ee329129
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f23@
+foreign import ccall safe "hs_bindgen_e2fd13d795062844" hs_bindgen_e2fd13d795062844_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f23@
+hs_bindgen_e2fd13d795062844 :: IO ()
+hs_bindgen_e2fd13d795062844 =
+  hs_bindgen_e2fd13d795062844_base
+
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @attributes\/visibility\/functions.h 45:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f23 :: IO ()
+f23 = hs_bindgen_e2fd13d795062844
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f24@
+foreign import ccall safe "hs_bindgen_87272e2adfb6015b" hs_bindgen_87272e2adfb6015b_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f24@
+hs_bindgen_87272e2adfb6015b :: IO ()
+hs_bindgen_87272e2adfb6015b =
+  hs_bindgen_87272e2adfb6015b_base
+
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @attributes\/visibility\/functions.h 46:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f24 :: IO ()
+f24 = hs_bindgen_87272e2adfb6015b
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f25@
+foreign import ccall safe "hs_bindgen_b573824e77968985" hs_bindgen_b573824e77968985_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f25@
+hs_bindgen_b573824e77968985 :: IO ()
+hs_bindgen_b573824e77968985 =
+  hs_bindgen_b573824e77968985_base
+
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @attributes\/visibility\/functions.h 49:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f25 :: IO ()
+f25 = hs_bindgen_b573824e77968985
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f26@
+foreign import ccall safe "hs_bindgen_9b5ba03996903917" hs_bindgen_9b5ba03996903917_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f26@
+hs_bindgen_9b5ba03996903917 :: IO ()
+hs_bindgen_9b5ba03996903917 =
+  hs_bindgen_9b5ba03996903917_base
+
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @attributes\/visibility\/functions.h 50:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f26 :: IO ()
+f26 = hs_bindgen_9b5ba03996903917
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f27@
+foreign import ccall safe "hs_bindgen_4d6e2dac36287b1e" hs_bindgen_4d6e2dac36287b1e_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f27@
+hs_bindgen_4d6e2dac36287b1e :: IO ()
+hs_bindgen_4d6e2dac36287b1e =
+  hs_bindgen_4d6e2dac36287b1e_base
+
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @attributes\/visibility\/functions.h 51:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f27 :: IO ()
+f27 = hs_bindgen_4d6e2dac36287b1e
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f28@
+foreign import ccall safe "hs_bindgen_d8e66fca82e1889d" hs_bindgen_d8e66fca82e1889d_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f28@
+hs_bindgen_d8e66fca82e1889d :: IO ()
+hs_bindgen_d8e66fca82e1889d =
+  hs_bindgen_d8e66fca82e1889d_base
+
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @attributes\/visibility\/functions.h 52:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f28 :: IO ()
+f28 = hs_bindgen_d8e66fca82e1889d
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f29@
+foreign import ccall safe "hs_bindgen_600c38ba2dfb8c71" hs_bindgen_600c38ba2dfb8c71_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f29@
+hs_bindgen_600c38ba2dfb8c71 :: IO ()
+hs_bindgen_600c38ba2dfb8c71 =
+  hs_bindgen_600c38ba2dfb8c71_base
+
+{-| __C declaration:__ @f29@
+
+    __defined at:__ @attributes\/visibility\/functions.h 53:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f29 :: IO ()
+f29 = hs_bindgen_600c38ba2dfb8c71
diff --git a/test-artefacts/fixtures/attributes/visibility/functions/Example/Unsafe.hs b/test-artefacts/fixtures/attributes/visibility/functions/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/functions/Example/Unsafe.hs
@@ -0,0 +1,705 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f0
+    , Example.Unsafe.f1
+    , Example.Unsafe.f2
+    , Example.Unsafe.f3
+    , Example.Unsafe.f4
+    , Example.Unsafe.f5
+    , Example.Unsafe.f6
+    , Example.Unsafe.f7
+    , Example.Unsafe.f8
+    , Example.Unsafe.f9
+    , Example.Unsafe.f10
+    , Example.Unsafe.f11
+    , Example.Unsafe.f12
+    , Example.Unsafe.f13
+    , Example.Unsafe.f14
+    , Example.Unsafe.f15
+    , Example.Unsafe.f16
+    , Example.Unsafe.f17
+    , Example.Unsafe.f18
+    , Example.Unsafe.f19
+    , Example.Unsafe.f20
+    , Example.Unsafe.f21
+    , Example.Unsafe.f22
+    , Example.Unsafe.f23
+    , Example.Unsafe.f24
+    , Example.Unsafe.f25
+    , Example.Unsafe.f26
+    , Example.Unsafe.f27
+    , Example.Unsafe.f28
+    , Example.Unsafe.f29
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <attributes/visibility/functions.h>"
+  , "void hs_bindgen_effdd993df42b356 (void)"
+  , "{"
+  , "  (f0)();"
+  , "}"
+  , "void hs_bindgen_8197d65e56e329f3 (void)"
+  , "{"
+  , "  (f1)();"
+  , "}"
+  , "void hs_bindgen_d39f970af8a8a222 (void)"
+  , "{"
+  , "  (f2)();"
+  , "}"
+  , "void hs_bindgen_be64763ec1549ecf (void)"
+  , "{"
+  , "  (f3)();"
+  , "}"
+  , "void hs_bindgen_79aec631efd41b2a (void)"
+  , "{"
+  , "  (f4)();"
+  , "}"
+  , "void hs_bindgen_def05384051a5dd9 (void)"
+  , "{"
+  , "  (f5)();"
+  , "}"
+  , "void hs_bindgen_92d1f9974393a261 (void)"
+  , "{"
+  , "  (f6)();"
+  , "}"
+  , "void hs_bindgen_90f3068e094c2abd (void)"
+  , "{"
+  , "  (f7)();"
+  , "}"
+  , "void hs_bindgen_6d1cfd91b3d13e55 (void)"
+  , "{"
+  , "  (f8)();"
+  , "}"
+  , "void hs_bindgen_d35fb9045bcdab71 (void)"
+  , "{"
+  , "  (f9)();"
+  , "}"
+  , "void hs_bindgen_40c723b61f2bee28 (void)"
+  , "{"
+  , "  (f10)();"
+  , "}"
+  , "void hs_bindgen_53a546d2dc84168b (void)"
+  , "{"
+  , "  (f11)();"
+  , "}"
+  , "void hs_bindgen_47e1da4038b5a9b4 (void)"
+  , "{"
+  , "  (f12)();"
+  , "}"
+  , "void hs_bindgen_3b90be410cc76ded (void)"
+  , "{"
+  , "  (f13)();"
+  , "}"
+  , "void hs_bindgen_d7d157b17d6f4d9e (void)"
+  , "{"
+  , "  (f14)();"
+  , "}"
+  , "void hs_bindgen_32a0e71bc346c633 (void)"
+  , "{"
+  , "  (f15)();"
+  , "}"
+  , "void hs_bindgen_084799171b269718 (void)"
+  , "{"
+  , "  (f16)();"
+  , "}"
+  , "void hs_bindgen_9399b438ad7d1540 (void)"
+  , "{"
+  , "  (f17)();"
+  , "}"
+  , "void hs_bindgen_b0cfd100fa7549bb (void)"
+  , "{"
+  , "  (f18)();"
+  , "}"
+  , "void hs_bindgen_00c6e9c82555231a (void)"
+  , "{"
+  , "  (f19)();"
+  , "}"
+  , "void hs_bindgen_6630b37e4a8fd258 (void)"
+  , "{"
+  , "  (f20)();"
+  , "}"
+  , "void hs_bindgen_1e5e762b3fc32381 (void)"
+  , "{"
+  , "  (f21)();"
+  , "}"
+  , "void hs_bindgen_7a55ac9a1d761c51 (void)"
+  , "{"
+  , "  (f22)();"
+  , "}"
+  , "void hs_bindgen_6941e6411b943f0b (void)"
+  , "{"
+  , "  (f23)();"
+  , "}"
+  , "void hs_bindgen_654278bb511c1626 (void)"
+  , "{"
+  , "  (f24)();"
+  , "}"
+  , "void hs_bindgen_5222f10cec613983 (void)"
+  , "{"
+  , "  (f25)();"
+  , "}"
+  , "void hs_bindgen_aa77927916c2e213 (void)"
+  , "{"
+  , "  (f26)();"
+  , "}"
+  , "void hs_bindgen_102db79a88a6b692 (void)"
+  , "{"
+  , "  (f27)();"
+  , "}"
+  , "void hs_bindgen_d475a551dd32819d (void)"
+  , "{"
+  , "  (f28)();"
+  , "}"
+  , "void hs_bindgen_afb63d27b0dea11b (void)"
+  , "{"
+  , "  (f29)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f0@
+foreign import ccall unsafe "hs_bindgen_effdd993df42b356" hs_bindgen_effdd993df42b356_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f0@
+hs_bindgen_effdd993df42b356 :: IO ()
+hs_bindgen_effdd993df42b356 =
+  hs_bindgen_effdd993df42b356_base
+
+{-| __C declaration:__ @f0@
+
+    __defined at:__ @attributes\/visibility\/functions.h 14:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f0 :: IO ()
+f0 = hs_bindgen_effdd993df42b356
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_8197d65e56e329f3" hs_bindgen_8197d65e56e329f3_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f1@
+hs_bindgen_8197d65e56e329f3 :: IO ()
+hs_bindgen_8197d65e56e329f3 =
+  hs_bindgen_8197d65e56e329f3_base
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @attributes\/visibility\/functions.h 15:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f1 :: IO ()
+f1 = hs_bindgen_8197d65e56e329f3
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_d39f970af8a8a222" hs_bindgen_d39f970af8a8a222_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f2@
+hs_bindgen_d39f970af8a8a222 :: IO ()
+hs_bindgen_d39f970af8a8a222 =
+  hs_bindgen_d39f970af8a8a222_base
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @attributes\/visibility\/functions.h 16:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f2 :: IO ()
+f2 = hs_bindgen_d39f970af8a8a222
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_be64763ec1549ecf" hs_bindgen_be64763ec1549ecf_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f3@
+hs_bindgen_be64763ec1549ecf :: IO ()
+hs_bindgen_be64763ec1549ecf =
+  hs_bindgen_be64763ec1549ecf_base
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @attributes\/visibility\/functions.h 17:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f3 :: IO ()
+f3 = hs_bindgen_be64763ec1549ecf
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f4@
+foreign import ccall unsafe "hs_bindgen_79aec631efd41b2a" hs_bindgen_79aec631efd41b2a_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f4@
+hs_bindgen_79aec631efd41b2a :: IO ()
+hs_bindgen_79aec631efd41b2a =
+  hs_bindgen_79aec631efd41b2a_base
+
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @attributes\/visibility\/functions.h 18:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f4 :: IO ()
+f4 = hs_bindgen_79aec631efd41b2a
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f5@
+foreign import ccall unsafe "hs_bindgen_def05384051a5dd9" hs_bindgen_def05384051a5dd9_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f5@
+hs_bindgen_def05384051a5dd9 :: IO ()
+hs_bindgen_def05384051a5dd9 =
+  hs_bindgen_def05384051a5dd9_base
+
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @attributes\/visibility\/functions.h 21:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f5 :: IO ()
+f5 = hs_bindgen_def05384051a5dd9
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f6@
+foreign import ccall unsafe "hs_bindgen_92d1f9974393a261" hs_bindgen_92d1f9974393a261_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f6@
+hs_bindgen_92d1f9974393a261 :: IO ()
+hs_bindgen_92d1f9974393a261 =
+  hs_bindgen_92d1f9974393a261_base
+
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @attributes\/visibility\/functions.h 22:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f6 :: IO ()
+f6 = hs_bindgen_92d1f9974393a261
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f7@
+foreign import ccall unsafe "hs_bindgen_90f3068e094c2abd" hs_bindgen_90f3068e094c2abd_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f7@
+hs_bindgen_90f3068e094c2abd :: IO ()
+hs_bindgen_90f3068e094c2abd =
+  hs_bindgen_90f3068e094c2abd_base
+
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @attributes\/visibility\/functions.h 23:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f7 :: IO ()
+f7 = hs_bindgen_90f3068e094c2abd
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f8@
+foreign import ccall unsafe "hs_bindgen_6d1cfd91b3d13e55" hs_bindgen_6d1cfd91b3d13e55_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f8@
+hs_bindgen_6d1cfd91b3d13e55 :: IO ()
+hs_bindgen_6d1cfd91b3d13e55 =
+  hs_bindgen_6d1cfd91b3d13e55_base
+
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @attributes\/visibility\/functions.h 24:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f8 :: IO ()
+f8 = hs_bindgen_6d1cfd91b3d13e55
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f9@
+foreign import ccall unsafe "hs_bindgen_d35fb9045bcdab71" hs_bindgen_d35fb9045bcdab71_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f9@
+hs_bindgen_d35fb9045bcdab71 :: IO ()
+hs_bindgen_d35fb9045bcdab71 =
+  hs_bindgen_d35fb9045bcdab71_base
+
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @attributes\/visibility\/functions.h 25:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f9 :: IO ()
+f9 = hs_bindgen_d35fb9045bcdab71
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f10@
+foreign import ccall unsafe "hs_bindgen_40c723b61f2bee28" hs_bindgen_40c723b61f2bee28_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f10@
+hs_bindgen_40c723b61f2bee28 :: IO ()
+hs_bindgen_40c723b61f2bee28 =
+  hs_bindgen_40c723b61f2bee28_base
+
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @attributes\/visibility\/functions.h 28:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f10 :: IO ()
+f10 = hs_bindgen_40c723b61f2bee28
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f11@
+foreign import ccall unsafe "hs_bindgen_53a546d2dc84168b" hs_bindgen_53a546d2dc84168b_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f11@
+hs_bindgen_53a546d2dc84168b :: IO ()
+hs_bindgen_53a546d2dc84168b =
+  hs_bindgen_53a546d2dc84168b_base
+
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @attributes\/visibility\/functions.h 29:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f11 :: IO ()
+f11 = hs_bindgen_53a546d2dc84168b
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f12@
+foreign import ccall unsafe "hs_bindgen_47e1da4038b5a9b4" hs_bindgen_47e1da4038b5a9b4_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f12@
+hs_bindgen_47e1da4038b5a9b4 :: IO ()
+hs_bindgen_47e1da4038b5a9b4 =
+  hs_bindgen_47e1da4038b5a9b4_base
+
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @attributes\/visibility\/functions.h 30:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f12 :: IO ()
+f12 = hs_bindgen_47e1da4038b5a9b4
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f13@
+foreign import ccall unsafe "hs_bindgen_3b90be410cc76ded" hs_bindgen_3b90be410cc76ded_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f13@
+hs_bindgen_3b90be410cc76ded :: IO ()
+hs_bindgen_3b90be410cc76ded =
+  hs_bindgen_3b90be410cc76ded_base
+
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @attributes\/visibility\/functions.h 31:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f13 :: IO ()
+f13 = hs_bindgen_3b90be410cc76ded
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f14@
+foreign import ccall unsafe "hs_bindgen_d7d157b17d6f4d9e" hs_bindgen_d7d157b17d6f4d9e_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f14@
+hs_bindgen_d7d157b17d6f4d9e :: IO ()
+hs_bindgen_d7d157b17d6f4d9e =
+  hs_bindgen_d7d157b17d6f4d9e_base
+
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @attributes\/visibility\/functions.h 32:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f14 :: IO ()
+f14 = hs_bindgen_d7d157b17d6f4d9e
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f15@
+foreign import ccall unsafe "hs_bindgen_32a0e71bc346c633" hs_bindgen_32a0e71bc346c633_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f15@
+hs_bindgen_32a0e71bc346c633 :: IO ()
+hs_bindgen_32a0e71bc346c633 =
+  hs_bindgen_32a0e71bc346c633_base
+
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @attributes\/visibility\/functions.h 35:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f15 :: IO ()
+f15 = hs_bindgen_32a0e71bc346c633
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f16@
+foreign import ccall unsafe "hs_bindgen_084799171b269718" hs_bindgen_084799171b269718_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f16@
+hs_bindgen_084799171b269718 :: IO ()
+hs_bindgen_084799171b269718 =
+  hs_bindgen_084799171b269718_base
+
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @attributes\/visibility\/functions.h 36:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f16 :: IO ()
+f16 = hs_bindgen_084799171b269718
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f17@
+foreign import ccall unsafe "hs_bindgen_9399b438ad7d1540" hs_bindgen_9399b438ad7d1540_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f17@
+hs_bindgen_9399b438ad7d1540 :: IO ()
+hs_bindgen_9399b438ad7d1540 =
+  hs_bindgen_9399b438ad7d1540_base
+
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @attributes\/visibility\/functions.h 37:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f17 :: IO ()
+f17 = hs_bindgen_9399b438ad7d1540
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f18@
+foreign import ccall unsafe "hs_bindgen_b0cfd100fa7549bb" hs_bindgen_b0cfd100fa7549bb_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f18@
+hs_bindgen_b0cfd100fa7549bb :: IO ()
+hs_bindgen_b0cfd100fa7549bb =
+  hs_bindgen_b0cfd100fa7549bb_base
+
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @attributes\/visibility\/functions.h 38:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f18 :: IO ()
+f18 = hs_bindgen_b0cfd100fa7549bb
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f19@
+foreign import ccall unsafe "hs_bindgen_00c6e9c82555231a" hs_bindgen_00c6e9c82555231a_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f19@
+hs_bindgen_00c6e9c82555231a :: IO ()
+hs_bindgen_00c6e9c82555231a =
+  hs_bindgen_00c6e9c82555231a_base
+
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @attributes\/visibility\/functions.h 39:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f19 :: IO ()
+f19 = hs_bindgen_00c6e9c82555231a
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f20@
+foreign import ccall unsafe "hs_bindgen_6630b37e4a8fd258" hs_bindgen_6630b37e4a8fd258_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f20@
+hs_bindgen_6630b37e4a8fd258 :: IO ()
+hs_bindgen_6630b37e4a8fd258 =
+  hs_bindgen_6630b37e4a8fd258_base
+
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @attributes\/visibility\/functions.h 42:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f20 :: IO ()
+f20 = hs_bindgen_6630b37e4a8fd258
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f21@
+foreign import ccall unsafe "hs_bindgen_1e5e762b3fc32381" hs_bindgen_1e5e762b3fc32381_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f21@
+hs_bindgen_1e5e762b3fc32381 :: IO ()
+hs_bindgen_1e5e762b3fc32381 =
+  hs_bindgen_1e5e762b3fc32381_base
+
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @attributes\/visibility\/functions.h 43:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f21 :: IO ()
+f21 = hs_bindgen_1e5e762b3fc32381
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f22@
+foreign import ccall unsafe "hs_bindgen_7a55ac9a1d761c51" hs_bindgen_7a55ac9a1d761c51_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f22@
+hs_bindgen_7a55ac9a1d761c51 :: IO ()
+hs_bindgen_7a55ac9a1d761c51 =
+  hs_bindgen_7a55ac9a1d761c51_base
+
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @attributes\/visibility\/functions.h 44:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f22 :: IO ()
+f22 = hs_bindgen_7a55ac9a1d761c51
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f23@
+foreign import ccall unsafe "hs_bindgen_6941e6411b943f0b" hs_bindgen_6941e6411b943f0b_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f23@
+hs_bindgen_6941e6411b943f0b :: IO ()
+hs_bindgen_6941e6411b943f0b =
+  hs_bindgen_6941e6411b943f0b_base
+
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @attributes\/visibility\/functions.h 45:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f23 :: IO ()
+f23 = hs_bindgen_6941e6411b943f0b
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f24@
+foreign import ccall unsafe "hs_bindgen_654278bb511c1626" hs_bindgen_654278bb511c1626_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f24@
+hs_bindgen_654278bb511c1626 :: IO ()
+hs_bindgen_654278bb511c1626 =
+  hs_bindgen_654278bb511c1626_base
+
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @attributes\/visibility\/functions.h 46:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f24 :: IO ()
+f24 = hs_bindgen_654278bb511c1626
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f25@
+foreign import ccall unsafe "hs_bindgen_5222f10cec613983" hs_bindgen_5222f10cec613983_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f25@
+hs_bindgen_5222f10cec613983 :: IO ()
+hs_bindgen_5222f10cec613983 =
+  hs_bindgen_5222f10cec613983_base
+
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @attributes\/visibility\/functions.h 49:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f25 :: IO ()
+f25 = hs_bindgen_5222f10cec613983
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f26@
+foreign import ccall unsafe "hs_bindgen_aa77927916c2e213" hs_bindgen_aa77927916c2e213_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f26@
+hs_bindgen_aa77927916c2e213 :: IO ()
+hs_bindgen_aa77927916c2e213 =
+  hs_bindgen_aa77927916c2e213_base
+
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @attributes\/visibility\/functions.h 50:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f26 :: IO ()
+f26 = hs_bindgen_aa77927916c2e213
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f27@
+foreign import ccall unsafe "hs_bindgen_102db79a88a6b692" hs_bindgen_102db79a88a6b692_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f27@
+hs_bindgen_102db79a88a6b692 :: IO ()
+hs_bindgen_102db79a88a6b692 =
+  hs_bindgen_102db79a88a6b692_base
+
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @attributes\/visibility\/functions.h 51:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f27 :: IO ()
+f27 = hs_bindgen_102db79a88a6b692
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f28@
+foreign import ccall unsafe "hs_bindgen_d475a551dd32819d" hs_bindgen_d475a551dd32819d_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f28@
+hs_bindgen_d475a551dd32819d :: IO ()
+hs_bindgen_d475a551dd32819d =
+  hs_bindgen_d475a551dd32819d_base
+
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @attributes\/visibility\/functions.h 52:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f28 :: IO ()
+f28 = hs_bindgen_d475a551dd32819d
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f29@
+foreign import ccall unsafe "hs_bindgen_afb63d27b0dea11b" hs_bindgen_afb63d27b0dea11b_base ::
+     IO ()
+
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f29@
+hs_bindgen_afb63d27b0dea11b :: IO ()
+hs_bindgen_afb63d27b0dea11b =
+  hs_bindgen_afb63d27b0dea11b_base
+
+{-| __C declaration:__ @f29@
+
+    __defined at:__ @attributes\/visibility\/functions.h 53:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f29 :: IO ()
+f29 = hs_bindgen_afb63d27b0dea11b
diff --git a/test-artefacts/fixtures/attributes/visibility/functions/bindingspec.yaml b/test-artefacts/fixtures/attributes/visibility/functions/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/functions/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/attributes/visibility/functions/th.txt b/test-artefacts/fixtures/attributes/visibility/functions/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/functions/th.txt
@@ -0,0 +1,2342 @@
+-- addDependentFile test-artefacts/headers/golden/attributes/visibility/functions.h
+-- #include <attributes/visibility/functions.h>
+-- void hs_bindgen_3f27c62fb190454a (void)
+-- {
+--   (f0)();
+-- }
+-- void hs_bindgen_1baf9aba48bb8585 (void)
+-- {
+--   (f1)();
+-- }
+-- void hs_bindgen_9de994ef69391f75 (void)
+-- {
+--   (f2)();
+-- }
+-- void hs_bindgen_e7b6b3fe1e458b05 (void)
+-- {
+--   (f3)();
+-- }
+-- void hs_bindgen_55f6714f782d28a7 (void)
+-- {
+--   (f4)();
+-- }
+-- void hs_bindgen_08ec707e7bc17377 (void)
+-- {
+--   (f5)();
+-- }
+-- void hs_bindgen_610d965a82ee5d22 (void)
+-- {
+--   (f6)();
+-- }
+-- void hs_bindgen_5f54d7b893c2f695 (void)
+-- {
+--   (f7)();
+-- }
+-- void hs_bindgen_219c458bfad16b17 (void)
+-- {
+--   (f8)();
+-- }
+-- void hs_bindgen_5d3fb29d7697a006 (void)
+-- {
+--   (f9)();
+-- }
+-- void hs_bindgen_5064aed792451d33 (void)
+-- {
+--   (f10)();
+-- }
+-- void hs_bindgen_25e0cdea1045ed28 (void)
+-- {
+--   (f11)();
+-- }
+-- void hs_bindgen_729b9541b191c0a9 (void)
+-- {
+--   (f12)();
+-- }
+-- void hs_bindgen_570476629e39b1ad (void)
+-- {
+--   (f13)();
+-- }
+-- void hs_bindgen_094d4428896cec1a (void)
+-- {
+--   (f14)();
+-- }
+-- void hs_bindgen_a15c67349afb7d1b (void)
+-- {
+--   (f15)();
+-- }
+-- void hs_bindgen_024506459e135eeb (void)
+-- {
+--   (f16)();
+-- }
+-- void hs_bindgen_8297e7356e9a3699 (void)
+-- {
+--   (f17)();
+-- }
+-- void hs_bindgen_8c9d69b89b46c409 (void)
+-- {
+--   (f18)();
+-- }
+-- void hs_bindgen_411e20c811bb4f75 (void)
+-- {
+--   (f19)();
+-- }
+-- void hs_bindgen_57573c31920ee01d (void)
+-- {
+--   (f20)();
+-- }
+-- void hs_bindgen_0f3e02be6a27086a (void)
+-- {
+--   (f21)();
+-- }
+-- void hs_bindgen_03810317ee329129 (void)
+-- {
+--   (f22)();
+-- }
+-- void hs_bindgen_e2fd13d795062844 (void)
+-- {
+--   (f23)();
+-- }
+-- void hs_bindgen_87272e2adfb6015b (void)
+-- {
+--   (f24)();
+-- }
+-- void hs_bindgen_b573824e77968985 (void)
+-- {
+--   (f25)();
+-- }
+-- void hs_bindgen_9b5ba03996903917 (void)
+-- {
+--   (f26)();
+-- }
+-- void hs_bindgen_4d6e2dac36287b1e (void)
+-- {
+--   (f27)();
+-- }
+-- void hs_bindgen_d8e66fca82e1889d (void)
+-- {
+--   (f28)();
+-- }
+-- void hs_bindgen_600c38ba2dfb8c71 (void)
+-- {
+--   (f29)();
+-- }
+-- void hs_bindgen_effdd993df42b356 (void)
+-- {
+--   (f0)();
+-- }
+-- void hs_bindgen_8197d65e56e329f3 (void)
+-- {
+--   (f1)();
+-- }
+-- void hs_bindgen_d39f970af8a8a222 (void)
+-- {
+--   (f2)();
+-- }
+-- void hs_bindgen_be64763ec1549ecf (void)
+-- {
+--   (f3)();
+-- }
+-- void hs_bindgen_79aec631efd41b2a (void)
+-- {
+--   (f4)();
+-- }
+-- void hs_bindgen_def05384051a5dd9 (void)
+-- {
+--   (f5)();
+-- }
+-- void hs_bindgen_92d1f9974393a261 (void)
+-- {
+--   (f6)();
+-- }
+-- void hs_bindgen_90f3068e094c2abd (void)
+-- {
+--   (f7)();
+-- }
+-- void hs_bindgen_6d1cfd91b3d13e55 (void)
+-- {
+--   (f8)();
+-- }
+-- void hs_bindgen_d35fb9045bcdab71 (void)
+-- {
+--   (f9)();
+-- }
+-- void hs_bindgen_40c723b61f2bee28 (void)
+-- {
+--   (f10)();
+-- }
+-- void hs_bindgen_53a546d2dc84168b (void)
+-- {
+--   (f11)();
+-- }
+-- void hs_bindgen_47e1da4038b5a9b4 (void)
+-- {
+--   (f12)();
+-- }
+-- void hs_bindgen_3b90be410cc76ded (void)
+-- {
+--   (f13)();
+-- }
+-- void hs_bindgen_d7d157b17d6f4d9e (void)
+-- {
+--   (f14)();
+-- }
+-- void hs_bindgen_32a0e71bc346c633 (void)
+-- {
+--   (f15)();
+-- }
+-- void hs_bindgen_084799171b269718 (void)
+-- {
+--   (f16)();
+-- }
+-- void hs_bindgen_9399b438ad7d1540 (void)
+-- {
+--   (f17)();
+-- }
+-- void hs_bindgen_b0cfd100fa7549bb (void)
+-- {
+--   (f18)();
+-- }
+-- void hs_bindgen_00c6e9c82555231a (void)
+-- {
+--   (f19)();
+-- }
+-- void hs_bindgen_6630b37e4a8fd258 (void)
+-- {
+--   (f20)();
+-- }
+-- void hs_bindgen_1e5e762b3fc32381 (void)
+-- {
+--   (f21)();
+-- }
+-- void hs_bindgen_7a55ac9a1d761c51 (void)
+-- {
+--   (f22)();
+-- }
+-- void hs_bindgen_6941e6411b943f0b (void)
+-- {
+--   (f23)();
+-- }
+-- void hs_bindgen_654278bb511c1626 (void)
+-- {
+--   (f24)();
+-- }
+-- void hs_bindgen_5222f10cec613983 (void)
+-- {
+--   (f25)();
+-- }
+-- void hs_bindgen_aa77927916c2e213 (void)
+-- {
+--   (f26)();
+-- }
+-- void hs_bindgen_102db79a88a6b692 (void)
+-- {
+--   (f27)();
+-- }
+-- void hs_bindgen_d475a551dd32819d (void)
+-- {
+--   (f28)();
+-- }
+-- void hs_bindgen_afb63d27b0dea11b (void)
+-- {
+--   (f29)();
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f0 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b669c12e6c979397 (void)) (void)
+-- {
+--   return &f0;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d3717f29814cc38e (void)) (void)
+-- {
+--   return &f1;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9951e77d56815b80 (void)) (void)
+-- {
+--   return &f2;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_735be5e937ab9ad0 (void)) (void)
+-- {
+--   return &f3;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2e181350411c95e9 (void)) (void)
+-- {
+--   return &f4;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_514428a6d0d70211 (void)) (void)
+-- {
+--   return &f5;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f6 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9b7f8e653b947b35 (void)) (void)
+-- {
+--   return &f6;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f7 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_53b66f2ee9d5bea3 (void)) (void)
+-- {
+--   return &f7;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f8 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_90ce84ff3a158d95 (void)) (void)
+-- {
+--   return &f8;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f9 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_bd91fda2207a62eb (void)) (void)
+-- {
+--   return &f9;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f10 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f216131cd3bd6919 (void)) (void)
+-- {
+--   return &f10;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f11 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d40c26619dcfad79 (void)) (void)
+-- {
+--   return &f11;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f12 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d507bba11a647ae8 (void)) (void)
+-- {
+--   return &f12;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f13 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a90968b5f0eb111f (void)) (void)
+-- {
+--   return &f13;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f14 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f584fb1da48609e4 (void)) (void)
+-- {
+--   return &f14;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f15 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1c5f8cf4562364d0 (void)) (void)
+-- {
+--   return &f15;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f16 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6af855fd845ff731 (void)) (void)
+-- {
+--   return &f16;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f17 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c5aa3698b4ac9578 (void)) (void)
+-- {
+--   return &f17;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f18 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_83b20ec12cdacad3 (void)) (void)
+-- {
+--   return &f18;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f19 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9530c7f467585e16 (void)) (void)
+-- {
+--   return &f19;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f20 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6b7091b3c8333945 (void)) (void)
+-- {
+--   return &f20;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f21 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_58ed5b745dd5583b (void)) (void)
+-- {
+--   return &f21;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f22 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2fc8f17386d9d13f (void)) (void)
+-- {
+--   return &f22;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f23 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_155c186bf2426f9c (void)) (void)
+-- {
+--   return &f23;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f24 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1c6a122ab1d7cef0 (void)) (void)
+-- {
+--   return &f24;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f25 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_80ef1e1dba11ffdd (void)) (void)
+-- {
+--   return &f25;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f26 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f7b63b778f9532da (void)) (void)
+-- {
+--   return &f26;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f27 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_01ece11a3077bfd9 (void)) (void)
+-- {
+--   return &f27;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f28 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0bc3e07b1934c20b (void)) (void)
+-- {
+--   return &f28;
+-- }
+-- /* test_attributesvisibilityfunction_Example_get_f29 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f3734109e7f7d5ee (void)) (void)
+-- {
+--   return &f29;
+-- }
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f0@
+foreign import ccall safe "hs_bindgen_3f27c62fb190454a" hs_bindgen_3f27c62fb190454a_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f0@
+hs_bindgen_3f27c62fb190454a :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f0@
+hs_bindgen_3f27c62fb190454a = hs_bindgen_3f27c62fb190454a_base
+{-| __C declaration:__ @f0@
+
+    __defined at:__ @attributes\/visibility\/functions.h 14:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f0_safe :: IO ()
+{-| __C declaration:__ @f0@
+
+    __defined at:__ @attributes\/visibility\/functions.h 14:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f0_safe = hs_bindgen_3f27c62fb190454a
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_1baf9aba48bb8585" hs_bindgen_1baf9aba48bb8585_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f1@
+hs_bindgen_1baf9aba48bb8585 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f1@
+hs_bindgen_1baf9aba48bb8585 = hs_bindgen_1baf9aba48bb8585_base
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @attributes\/visibility\/functions.h 15:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f1_safe :: IO ()
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @attributes\/visibility\/functions.h 15:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f1_safe = hs_bindgen_1baf9aba48bb8585
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_9de994ef69391f75" hs_bindgen_9de994ef69391f75_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f2@
+hs_bindgen_9de994ef69391f75 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f2@
+hs_bindgen_9de994ef69391f75 = hs_bindgen_9de994ef69391f75_base
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @attributes\/visibility\/functions.h 16:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f2_safe :: IO ()
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @attributes\/visibility\/functions.h 16:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f2_safe = hs_bindgen_9de994ef69391f75
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_e7b6b3fe1e458b05" hs_bindgen_e7b6b3fe1e458b05_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f3@
+hs_bindgen_e7b6b3fe1e458b05 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f3@
+hs_bindgen_e7b6b3fe1e458b05 = hs_bindgen_e7b6b3fe1e458b05_base
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @attributes\/visibility\/functions.h 17:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f3_safe :: IO ()
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @attributes\/visibility\/functions.h 17:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f3_safe = hs_bindgen_e7b6b3fe1e458b05
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f4@
+foreign import ccall safe "hs_bindgen_55f6714f782d28a7" hs_bindgen_55f6714f782d28a7_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f4@
+hs_bindgen_55f6714f782d28a7 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f4@
+hs_bindgen_55f6714f782d28a7 = hs_bindgen_55f6714f782d28a7_base
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @attributes\/visibility\/functions.h 18:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f4_safe :: IO ()
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @attributes\/visibility\/functions.h 18:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f4_safe = hs_bindgen_55f6714f782d28a7
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f5@
+foreign import ccall safe "hs_bindgen_08ec707e7bc17377" hs_bindgen_08ec707e7bc17377_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f5@
+hs_bindgen_08ec707e7bc17377 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f5@
+hs_bindgen_08ec707e7bc17377 = hs_bindgen_08ec707e7bc17377_base
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @attributes\/visibility\/functions.h 21:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f5_safe :: IO ()
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @attributes\/visibility\/functions.h 21:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f5_safe = hs_bindgen_08ec707e7bc17377
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f6@
+foreign import ccall safe "hs_bindgen_610d965a82ee5d22" hs_bindgen_610d965a82ee5d22_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f6@
+hs_bindgen_610d965a82ee5d22 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f6@
+hs_bindgen_610d965a82ee5d22 = hs_bindgen_610d965a82ee5d22_base
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @attributes\/visibility\/functions.h 22:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f6_safe :: IO ()
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @attributes\/visibility\/functions.h 22:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f6_safe = hs_bindgen_610d965a82ee5d22
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f7@
+foreign import ccall safe "hs_bindgen_5f54d7b893c2f695" hs_bindgen_5f54d7b893c2f695_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f7@
+hs_bindgen_5f54d7b893c2f695 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f7@
+hs_bindgen_5f54d7b893c2f695 = hs_bindgen_5f54d7b893c2f695_base
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @attributes\/visibility\/functions.h 23:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f7_safe :: IO ()
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @attributes\/visibility\/functions.h 23:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f7_safe = hs_bindgen_5f54d7b893c2f695
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f8@
+foreign import ccall safe "hs_bindgen_219c458bfad16b17" hs_bindgen_219c458bfad16b17_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f8@
+hs_bindgen_219c458bfad16b17 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f8@
+hs_bindgen_219c458bfad16b17 = hs_bindgen_219c458bfad16b17_base
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @attributes\/visibility\/functions.h 24:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f8_safe :: IO ()
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @attributes\/visibility\/functions.h 24:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f8_safe = hs_bindgen_219c458bfad16b17
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f9@
+foreign import ccall safe "hs_bindgen_5d3fb29d7697a006" hs_bindgen_5d3fb29d7697a006_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f9@
+hs_bindgen_5d3fb29d7697a006 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f9@
+hs_bindgen_5d3fb29d7697a006 = hs_bindgen_5d3fb29d7697a006_base
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @attributes\/visibility\/functions.h 25:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f9_safe :: IO ()
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @attributes\/visibility\/functions.h 25:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f9_safe = hs_bindgen_5d3fb29d7697a006
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f10@
+foreign import ccall safe "hs_bindgen_5064aed792451d33" hs_bindgen_5064aed792451d33_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f10@
+hs_bindgen_5064aed792451d33 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f10@
+hs_bindgen_5064aed792451d33 = hs_bindgen_5064aed792451d33_base
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @attributes\/visibility\/functions.h 28:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f10_safe :: IO ()
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @attributes\/visibility\/functions.h 28:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f10_safe = hs_bindgen_5064aed792451d33
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f11@
+foreign import ccall safe "hs_bindgen_25e0cdea1045ed28" hs_bindgen_25e0cdea1045ed28_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f11@
+hs_bindgen_25e0cdea1045ed28 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f11@
+hs_bindgen_25e0cdea1045ed28 = hs_bindgen_25e0cdea1045ed28_base
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @attributes\/visibility\/functions.h 29:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f11_safe :: IO ()
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @attributes\/visibility\/functions.h 29:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f11_safe = hs_bindgen_25e0cdea1045ed28
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f12@
+foreign import ccall safe "hs_bindgen_729b9541b191c0a9" hs_bindgen_729b9541b191c0a9_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f12@
+hs_bindgen_729b9541b191c0a9 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f12@
+hs_bindgen_729b9541b191c0a9 = hs_bindgen_729b9541b191c0a9_base
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @attributes\/visibility\/functions.h 30:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f12_safe :: IO ()
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @attributes\/visibility\/functions.h 30:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f12_safe = hs_bindgen_729b9541b191c0a9
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f13@
+foreign import ccall safe "hs_bindgen_570476629e39b1ad" hs_bindgen_570476629e39b1ad_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f13@
+hs_bindgen_570476629e39b1ad :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f13@
+hs_bindgen_570476629e39b1ad = hs_bindgen_570476629e39b1ad_base
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @attributes\/visibility\/functions.h 31:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f13_safe :: IO ()
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @attributes\/visibility\/functions.h 31:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f13_safe = hs_bindgen_570476629e39b1ad
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f14@
+foreign import ccall safe "hs_bindgen_094d4428896cec1a" hs_bindgen_094d4428896cec1a_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f14@
+hs_bindgen_094d4428896cec1a :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f14@
+hs_bindgen_094d4428896cec1a = hs_bindgen_094d4428896cec1a_base
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @attributes\/visibility\/functions.h 32:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f14_safe :: IO ()
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @attributes\/visibility\/functions.h 32:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f14_safe = hs_bindgen_094d4428896cec1a
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f15@
+foreign import ccall safe "hs_bindgen_a15c67349afb7d1b" hs_bindgen_a15c67349afb7d1b_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f15@
+hs_bindgen_a15c67349afb7d1b :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f15@
+hs_bindgen_a15c67349afb7d1b = hs_bindgen_a15c67349afb7d1b_base
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @attributes\/visibility\/functions.h 35:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f15_safe :: IO ()
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @attributes\/visibility\/functions.h 35:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f15_safe = hs_bindgen_a15c67349afb7d1b
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f16@
+foreign import ccall safe "hs_bindgen_024506459e135eeb" hs_bindgen_024506459e135eeb_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f16@
+hs_bindgen_024506459e135eeb :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f16@
+hs_bindgen_024506459e135eeb = hs_bindgen_024506459e135eeb_base
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @attributes\/visibility\/functions.h 36:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f16_safe :: IO ()
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @attributes\/visibility\/functions.h 36:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f16_safe = hs_bindgen_024506459e135eeb
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f17@
+foreign import ccall safe "hs_bindgen_8297e7356e9a3699" hs_bindgen_8297e7356e9a3699_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f17@
+hs_bindgen_8297e7356e9a3699 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f17@
+hs_bindgen_8297e7356e9a3699 = hs_bindgen_8297e7356e9a3699_base
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @attributes\/visibility\/functions.h 37:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f17_safe :: IO ()
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @attributes\/visibility\/functions.h 37:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f17_safe = hs_bindgen_8297e7356e9a3699
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f18@
+foreign import ccall safe "hs_bindgen_8c9d69b89b46c409" hs_bindgen_8c9d69b89b46c409_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f18@
+hs_bindgen_8c9d69b89b46c409 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f18@
+hs_bindgen_8c9d69b89b46c409 = hs_bindgen_8c9d69b89b46c409_base
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @attributes\/visibility\/functions.h 38:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f18_safe :: IO ()
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @attributes\/visibility\/functions.h 38:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f18_safe = hs_bindgen_8c9d69b89b46c409
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f19@
+foreign import ccall safe "hs_bindgen_411e20c811bb4f75" hs_bindgen_411e20c811bb4f75_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f19@
+hs_bindgen_411e20c811bb4f75 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f19@
+hs_bindgen_411e20c811bb4f75 = hs_bindgen_411e20c811bb4f75_base
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @attributes\/visibility\/functions.h 39:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f19_safe :: IO ()
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @attributes\/visibility\/functions.h 39:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f19_safe = hs_bindgen_411e20c811bb4f75
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f20@
+foreign import ccall safe "hs_bindgen_57573c31920ee01d" hs_bindgen_57573c31920ee01d_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f20@
+hs_bindgen_57573c31920ee01d :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f20@
+hs_bindgen_57573c31920ee01d = hs_bindgen_57573c31920ee01d_base
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @attributes\/visibility\/functions.h 42:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f20_safe :: IO ()
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @attributes\/visibility\/functions.h 42:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f20_safe = hs_bindgen_57573c31920ee01d
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f21@
+foreign import ccall safe "hs_bindgen_0f3e02be6a27086a" hs_bindgen_0f3e02be6a27086a_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f21@
+hs_bindgen_0f3e02be6a27086a :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f21@
+hs_bindgen_0f3e02be6a27086a = hs_bindgen_0f3e02be6a27086a_base
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @attributes\/visibility\/functions.h 43:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f21_safe :: IO ()
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @attributes\/visibility\/functions.h 43:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f21_safe = hs_bindgen_0f3e02be6a27086a
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f22@
+foreign import ccall safe "hs_bindgen_03810317ee329129" hs_bindgen_03810317ee329129_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f22@
+hs_bindgen_03810317ee329129 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f22@
+hs_bindgen_03810317ee329129 = hs_bindgen_03810317ee329129_base
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @attributes\/visibility\/functions.h 44:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f22_safe :: IO ()
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @attributes\/visibility\/functions.h 44:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f22_safe = hs_bindgen_03810317ee329129
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f23@
+foreign import ccall safe "hs_bindgen_e2fd13d795062844" hs_bindgen_e2fd13d795062844_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f23@
+hs_bindgen_e2fd13d795062844 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f23@
+hs_bindgen_e2fd13d795062844 = hs_bindgen_e2fd13d795062844_base
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @attributes\/visibility\/functions.h 45:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f23_safe :: IO ()
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @attributes\/visibility\/functions.h 45:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f23_safe = hs_bindgen_e2fd13d795062844
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f24@
+foreign import ccall safe "hs_bindgen_87272e2adfb6015b" hs_bindgen_87272e2adfb6015b_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f24@
+hs_bindgen_87272e2adfb6015b :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f24@
+hs_bindgen_87272e2adfb6015b = hs_bindgen_87272e2adfb6015b_base
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @attributes\/visibility\/functions.h 46:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f24_safe :: IO ()
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @attributes\/visibility\/functions.h 46:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f24_safe = hs_bindgen_87272e2adfb6015b
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f25@
+foreign import ccall safe "hs_bindgen_b573824e77968985" hs_bindgen_b573824e77968985_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f25@
+hs_bindgen_b573824e77968985 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f25@
+hs_bindgen_b573824e77968985 = hs_bindgen_b573824e77968985_base
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @attributes\/visibility\/functions.h 49:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f25_safe :: IO ()
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @attributes\/visibility\/functions.h 49:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f25_safe = hs_bindgen_b573824e77968985
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f26@
+foreign import ccall safe "hs_bindgen_9b5ba03996903917" hs_bindgen_9b5ba03996903917_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f26@
+hs_bindgen_9b5ba03996903917 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f26@
+hs_bindgen_9b5ba03996903917 = hs_bindgen_9b5ba03996903917_base
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @attributes\/visibility\/functions.h 50:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f26_safe :: IO ()
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @attributes\/visibility\/functions.h 50:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f26_safe = hs_bindgen_9b5ba03996903917
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f27@
+foreign import ccall safe "hs_bindgen_4d6e2dac36287b1e" hs_bindgen_4d6e2dac36287b1e_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f27@
+hs_bindgen_4d6e2dac36287b1e :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f27@
+hs_bindgen_4d6e2dac36287b1e = hs_bindgen_4d6e2dac36287b1e_base
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @attributes\/visibility\/functions.h 51:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f27_safe :: IO ()
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @attributes\/visibility\/functions.h 51:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f27_safe = hs_bindgen_4d6e2dac36287b1e
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f28@
+foreign import ccall safe "hs_bindgen_d8e66fca82e1889d" hs_bindgen_d8e66fca82e1889d_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f28@
+hs_bindgen_d8e66fca82e1889d :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f28@
+hs_bindgen_d8e66fca82e1889d = hs_bindgen_d8e66fca82e1889d_base
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @attributes\/visibility\/functions.h 52:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f28_safe :: IO ()
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @attributes\/visibility\/functions.h 52:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f28_safe = hs_bindgen_d8e66fca82e1889d
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f29@
+foreign import ccall safe "hs_bindgen_600c38ba2dfb8c71" hs_bindgen_600c38ba2dfb8c71_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f29@
+hs_bindgen_600c38ba2dfb8c71 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Safe_f29@
+hs_bindgen_600c38ba2dfb8c71 = hs_bindgen_600c38ba2dfb8c71_base
+{-| __C declaration:__ @f29@
+
+    __defined at:__ @attributes\/visibility\/functions.h 53:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f29_safe :: IO ()
+{-| __C declaration:__ @f29@
+
+    __defined at:__ @attributes\/visibility\/functions.h 53:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f29_safe = hs_bindgen_600c38ba2dfb8c71
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f0@
+foreign import ccall unsafe "hs_bindgen_effdd993df42b356" hs_bindgen_effdd993df42b356_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f0@
+hs_bindgen_effdd993df42b356 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f0@
+hs_bindgen_effdd993df42b356 = hs_bindgen_effdd993df42b356_base
+{-| __C declaration:__ @f0@
+
+    __defined at:__ @attributes\/visibility\/functions.h 14:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f0_unsafe :: IO ()
+{-| __C declaration:__ @f0@
+
+    __defined at:__ @attributes\/visibility\/functions.h 14:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f0_unsafe = hs_bindgen_effdd993df42b356
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_8197d65e56e329f3" hs_bindgen_8197d65e56e329f3_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f1@
+hs_bindgen_8197d65e56e329f3 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f1@
+hs_bindgen_8197d65e56e329f3 = hs_bindgen_8197d65e56e329f3_base
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @attributes\/visibility\/functions.h 15:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f1_unsafe :: IO ()
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @attributes\/visibility\/functions.h 15:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f1_unsafe = hs_bindgen_8197d65e56e329f3
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_d39f970af8a8a222" hs_bindgen_d39f970af8a8a222_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f2@
+hs_bindgen_d39f970af8a8a222 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f2@
+hs_bindgen_d39f970af8a8a222 = hs_bindgen_d39f970af8a8a222_base
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @attributes\/visibility\/functions.h 16:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f2_unsafe :: IO ()
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @attributes\/visibility\/functions.h 16:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f2_unsafe = hs_bindgen_d39f970af8a8a222
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_be64763ec1549ecf" hs_bindgen_be64763ec1549ecf_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f3@
+hs_bindgen_be64763ec1549ecf :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f3@
+hs_bindgen_be64763ec1549ecf = hs_bindgen_be64763ec1549ecf_base
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @attributes\/visibility\/functions.h 17:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f3_unsafe :: IO ()
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @attributes\/visibility\/functions.h 17:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f3_unsafe = hs_bindgen_be64763ec1549ecf
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f4@
+foreign import ccall unsafe "hs_bindgen_79aec631efd41b2a" hs_bindgen_79aec631efd41b2a_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f4@
+hs_bindgen_79aec631efd41b2a :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f4@
+hs_bindgen_79aec631efd41b2a = hs_bindgen_79aec631efd41b2a_base
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @attributes\/visibility\/functions.h 18:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f4_unsafe :: IO ()
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @attributes\/visibility\/functions.h 18:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f4_unsafe = hs_bindgen_79aec631efd41b2a
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f5@
+foreign import ccall unsafe "hs_bindgen_def05384051a5dd9" hs_bindgen_def05384051a5dd9_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f5@
+hs_bindgen_def05384051a5dd9 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f5@
+hs_bindgen_def05384051a5dd9 = hs_bindgen_def05384051a5dd9_base
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @attributes\/visibility\/functions.h 21:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f5_unsafe :: IO ()
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @attributes\/visibility\/functions.h 21:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f5_unsafe = hs_bindgen_def05384051a5dd9
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f6@
+foreign import ccall unsafe "hs_bindgen_92d1f9974393a261" hs_bindgen_92d1f9974393a261_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f6@
+hs_bindgen_92d1f9974393a261 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f6@
+hs_bindgen_92d1f9974393a261 = hs_bindgen_92d1f9974393a261_base
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @attributes\/visibility\/functions.h 22:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f6_unsafe :: IO ()
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @attributes\/visibility\/functions.h 22:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f6_unsafe = hs_bindgen_92d1f9974393a261
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f7@
+foreign import ccall unsafe "hs_bindgen_90f3068e094c2abd" hs_bindgen_90f3068e094c2abd_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f7@
+hs_bindgen_90f3068e094c2abd :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f7@
+hs_bindgen_90f3068e094c2abd = hs_bindgen_90f3068e094c2abd_base
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @attributes\/visibility\/functions.h 23:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f7_unsafe :: IO ()
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @attributes\/visibility\/functions.h 23:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f7_unsafe = hs_bindgen_90f3068e094c2abd
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f8@
+foreign import ccall unsafe "hs_bindgen_6d1cfd91b3d13e55" hs_bindgen_6d1cfd91b3d13e55_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f8@
+hs_bindgen_6d1cfd91b3d13e55 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f8@
+hs_bindgen_6d1cfd91b3d13e55 = hs_bindgen_6d1cfd91b3d13e55_base
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @attributes\/visibility\/functions.h 24:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f8_unsafe :: IO ()
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @attributes\/visibility\/functions.h 24:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f8_unsafe = hs_bindgen_6d1cfd91b3d13e55
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f9@
+foreign import ccall unsafe "hs_bindgen_d35fb9045bcdab71" hs_bindgen_d35fb9045bcdab71_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f9@
+hs_bindgen_d35fb9045bcdab71 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f9@
+hs_bindgen_d35fb9045bcdab71 = hs_bindgen_d35fb9045bcdab71_base
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @attributes\/visibility\/functions.h 25:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f9_unsafe :: IO ()
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @attributes\/visibility\/functions.h 25:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f9_unsafe = hs_bindgen_d35fb9045bcdab71
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f10@
+foreign import ccall unsafe "hs_bindgen_40c723b61f2bee28" hs_bindgen_40c723b61f2bee28_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f10@
+hs_bindgen_40c723b61f2bee28 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f10@
+hs_bindgen_40c723b61f2bee28 = hs_bindgen_40c723b61f2bee28_base
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @attributes\/visibility\/functions.h 28:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f10_unsafe :: IO ()
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @attributes\/visibility\/functions.h 28:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f10_unsafe = hs_bindgen_40c723b61f2bee28
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f11@
+foreign import ccall unsafe "hs_bindgen_53a546d2dc84168b" hs_bindgen_53a546d2dc84168b_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f11@
+hs_bindgen_53a546d2dc84168b :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f11@
+hs_bindgen_53a546d2dc84168b = hs_bindgen_53a546d2dc84168b_base
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @attributes\/visibility\/functions.h 29:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f11_unsafe :: IO ()
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @attributes\/visibility\/functions.h 29:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f11_unsafe = hs_bindgen_53a546d2dc84168b
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f12@
+foreign import ccall unsafe "hs_bindgen_47e1da4038b5a9b4" hs_bindgen_47e1da4038b5a9b4_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f12@
+hs_bindgen_47e1da4038b5a9b4 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f12@
+hs_bindgen_47e1da4038b5a9b4 = hs_bindgen_47e1da4038b5a9b4_base
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @attributes\/visibility\/functions.h 30:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f12_unsafe :: IO ()
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @attributes\/visibility\/functions.h 30:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f12_unsafe = hs_bindgen_47e1da4038b5a9b4
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f13@
+foreign import ccall unsafe "hs_bindgen_3b90be410cc76ded" hs_bindgen_3b90be410cc76ded_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f13@
+hs_bindgen_3b90be410cc76ded :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f13@
+hs_bindgen_3b90be410cc76ded = hs_bindgen_3b90be410cc76ded_base
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @attributes\/visibility\/functions.h 31:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f13_unsafe :: IO ()
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @attributes\/visibility\/functions.h 31:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f13_unsafe = hs_bindgen_3b90be410cc76ded
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f14@
+foreign import ccall unsafe "hs_bindgen_d7d157b17d6f4d9e" hs_bindgen_d7d157b17d6f4d9e_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f14@
+hs_bindgen_d7d157b17d6f4d9e :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f14@
+hs_bindgen_d7d157b17d6f4d9e = hs_bindgen_d7d157b17d6f4d9e_base
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @attributes\/visibility\/functions.h 32:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f14_unsafe :: IO ()
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @attributes\/visibility\/functions.h 32:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f14_unsafe = hs_bindgen_d7d157b17d6f4d9e
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f15@
+foreign import ccall unsafe "hs_bindgen_32a0e71bc346c633" hs_bindgen_32a0e71bc346c633_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f15@
+hs_bindgen_32a0e71bc346c633 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f15@
+hs_bindgen_32a0e71bc346c633 = hs_bindgen_32a0e71bc346c633_base
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @attributes\/visibility\/functions.h 35:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f15_unsafe :: IO ()
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @attributes\/visibility\/functions.h 35:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f15_unsafe = hs_bindgen_32a0e71bc346c633
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f16@
+foreign import ccall unsafe "hs_bindgen_084799171b269718" hs_bindgen_084799171b269718_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f16@
+hs_bindgen_084799171b269718 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f16@
+hs_bindgen_084799171b269718 = hs_bindgen_084799171b269718_base
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @attributes\/visibility\/functions.h 36:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f16_unsafe :: IO ()
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @attributes\/visibility\/functions.h 36:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f16_unsafe = hs_bindgen_084799171b269718
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f17@
+foreign import ccall unsafe "hs_bindgen_9399b438ad7d1540" hs_bindgen_9399b438ad7d1540_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f17@
+hs_bindgen_9399b438ad7d1540 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f17@
+hs_bindgen_9399b438ad7d1540 = hs_bindgen_9399b438ad7d1540_base
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @attributes\/visibility\/functions.h 37:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f17_unsafe :: IO ()
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @attributes\/visibility\/functions.h 37:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f17_unsafe = hs_bindgen_9399b438ad7d1540
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f18@
+foreign import ccall unsafe "hs_bindgen_b0cfd100fa7549bb" hs_bindgen_b0cfd100fa7549bb_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f18@
+hs_bindgen_b0cfd100fa7549bb :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f18@
+hs_bindgen_b0cfd100fa7549bb = hs_bindgen_b0cfd100fa7549bb_base
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @attributes\/visibility\/functions.h 38:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f18_unsafe :: IO ()
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @attributes\/visibility\/functions.h 38:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f18_unsafe = hs_bindgen_b0cfd100fa7549bb
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f19@
+foreign import ccall unsafe "hs_bindgen_00c6e9c82555231a" hs_bindgen_00c6e9c82555231a_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f19@
+hs_bindgen_00c6e9c82555231a :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f19@
+hs_bindgen_00c6e9c82555231a = hs_bindgen_00c6e9c82555231a_base
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @attributes\/visibility\/functions.h 39:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f19_unsafe :: IO ()
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @attributes\/visibility\/functions.h 39:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f19_unsafe = hs_bindgen_00c6e9c82555231a
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f20@
+foreign import ccall unsafe "hs_bindgen_6630b37e4a8fd258" hs_bindgen_6630b37e4a8fd258_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f20@
+hs_bindgen_6630b37e4a8fd258 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f20@
+hs_bindgen_6630b37e4a8fd258 = hs_bindgen_6630b37e4a8fd258_base
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @attributes\/visibility\/functions.h 42:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f20_unsafe :: IO ()
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @attributes\/visibility\/functions.h 42:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f20_unsafe = hs_bindgen_6630b37e4a8fd258
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f21@
+foreign import ccall unsafe "hs_bindgen_1e5e762b3fc32381" hs_bindgen_1e5e762b3fc32381_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f21@
+hs_bindgen_1e5e762b3fc32381 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f21@
+hs_bindgen_1e5e762b3fc32381 = hs_bindgen_1e5e762b3fc32381_base
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @attributes\/visibility\/functions.h 43:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f21_unsafe :: IO ()
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @attributes\/visibility\/functions.h 43:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f21_unsafe = hs_bindgen_1e5e762b3fc32381
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f22@
+foreign import ccall unsafe "hs_bindgen_7a55ac9a1d761c51" hs_bindgen_7a55ac9a1d761c51_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f22@
+hs_bindgen_7a55ac9a1d761c51 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f22@
+hs_bindgen_7a55ac9a1d761c51 = hs_bindgen_7a55ac9a1d761c51_base
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @attributes\/visibility\/functions.h 44:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f22_unsafe :: IO ()
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @attributes\/visibility\/functions.h 44:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f22_unsafe = hs_bindgen_7a55ac9a1d761c51
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f23@
+foreign import ccall unsafe "hs_bindgen_6941e6411b943f0b" hs_bindgen_6941e6411b943f0b_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f23@
+hs_bindgen_6941e6411b943f0b :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f23@
+hs_bindgen_6941e6411b943f0b = hs_bindgen_6941e6411b943f0b_base
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @attributes\/visibility\/functions.h 45:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f23_unsafe :: IO ()
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @attributes\/visibility\/functions.h 45:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f23_unsafe = hs_bindgen_6941e6411b943f0b
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f24@
+foreign import ccall unsafe "hs_bindgen_654278bb511c1626" hs_bindgen_654278bb511c1626_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f24@
+hs_bindgen_654278bb511c1626 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f24@
+hs_bindgen_654278bb511c1626 = hs_bindgen_654278bb511c1626_base
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @attributes\/visibility\/functions.h 46:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f24_unsafe :: IO ()
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @attributes\/visibility\/functions.h 46:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f24_unsafe = hs_bindgen_654278bb511c1626
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f25@
+foreign import ccall unsafe "hs_bindgen_5222f10cec613983" hs_bindgen_5222f10cec613983_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f25@
+hs_bindgen_5222f10cec613983 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f25@
+hs_bindgen_5222f10cec613983 = hs_bindgen_5222f10cec613983_base
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @attributes\/visibility\/functions.h 49:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f25_unsafe :: IO ()
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @attributes\/visibility\/functions.h 49:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f25_unsafe = hs_bindgen_5222f10cec613983
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f26@
+foreign import ccall unsafe "hs_bindgen_aa77927916c2e213" hs_bindgen_aa77927916c2e213_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f26@
+hs_bindgen_aa77927916c2e213 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f26@
+hs_bindgen_aa77927916c2e213 = hs_bindgen_aa77927916c2e213_base
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @attributes\/visibility\/functions.h 50:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f26_unsafe :: IO ()
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @attributes\/visibility\/functions.h 50:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f26_unsafe = hs_bindgen_aa77927916c2e213
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f27@
+foreign import ccall unsafe "hs_bindgen_102db79a88a6b692" hs_bindgen_102db79a88a6b692_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f27@
+hs_bindgen_102db79a88a6b692 :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f27@
+hs_bindgen_102db79a88a6b692 = hs_bindgen_102db79a88a6b692_base
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @attributes\/visibility\/functions.h 51:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f27_unsafe :: IO ()
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @attributes\/visibility\/functions.h 51:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f27_unsafe = hs_bindgen_102db79a88a6b692
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f28@
+foreign import ccall unsafe "hs_bindgen_d475a551dd32819d" hs_bindgen_d475a551dd32819d_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f28@
+hs_bindgen_d475a551dd32819d :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f28@
+hs_bindgen_d475a551dd32819d = hs_bindgen_d475a551dd32819d_base
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @attributes\/visibility\/functions.h 52:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f28_unsafe :: IO ()
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @attributes\/visibility\/functions.h 52:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f28_unsafe = hs_bindgen_d475a551dd32819d
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f29@
+foreign import ccall unsafe "hs_bindgen_afb63d27b0dea11b" hs_bindgen_afb63d27b0dea11b_base ::
+    IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f29@
+hs_bindgen_afb63d27b0dea11b :: IO ()
+-- __unique:__ @test_attributesvisibilityfunction_Example_Unsafe_f29@
+hs_bindgen_afb63d27b0dea11b = hs_bindgen_afb63d27b0dea11b_base
+{-| __C declaration:__ @f29@
+
+    __defined at:__ @attributes\/visibility\/functions.h 53:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f29_unsafe :: IO ()
+{-| __C declaration:__ @f29@
+
+    __defined at:__ @attributes\/visibility\/functions.h 53:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f29_unsafe = hs_bindgen_afb63d27b0dea11b
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f0@
+foreign import ccall unsafe "hs_bindgen_b669c12e6c979397" hs_bindgen_b669c12e6c979397_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f0@
+hs_bindgen_b669c12e6c979397 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f0@
+hs_bindgen_b669c12e6c979397 = fmap fromFFIType hs_bindgen_b669c12e6c979397_base
+{-# NOINLINE f0_funptr #-}
+{-| __C declaration:__ @f0@
+
+    __defined at:__ @attributes\/visibility\/functions.h 14:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f0_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f0@
+
+    __defined at:__ @attributes\/visibility\/functions.h 14:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f0_funptr = unsafePerformIO hs_bindgen_b669c12e6c979397
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_d3717f29814cc38e" hs_bindgen_d3717f29814cc38e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f1@
+hs_bindgen_d3717f29814cc38e :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f1@
+hs_bindgen_d3717f29814cc38e = fmap fromFFIType hs_bindgen_d3717f29814cc38e_base
+{-# NOINLINE f1_funptr #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @attributes\/visibility\/functions.h 15:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f1_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @attributes\/visibility\/functions.h 15:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f1_funptr = unsafePerformIO hs_bindgen_d3717f29814cc38e
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_9951e77d56815b80" hs_bindgen_9951e77d56815b80_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f2@
+hs_bindgen_9951e77d56815b80 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f2@
+hs_bindgen_9951e77d56815b80 = fmap fromFFIType hs_bindgen_9951e77d56815b80_base
+{-# NOINLINE f2_funptr #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @attributes\/visibility\/functions.h 16:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f2_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @attributes\/visibility\/functions.h 16:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f2_funptr = unsafePerformIO hs_bindgen_9951e77d56815b80
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_735be5e937ab9ad0" hs_bindgen_735be5e937ab9ad0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f3@
+hs_bindgen_735be5e937ab9ad0 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f3@
+hs_bindgen_735be5e937ab9ad0 = fmap fromFFIType hs_bindgen_735be5e937ab9ad0_base
+{-# NOINLINE f3_funptr #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @attributes\/visibility\/functions.h 17:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f3_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @attributes\/visibility\/functions.h 17:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f3_funptr = unsafePerformIO hs_bindgen_735be5e937ab9ad0
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f4@
+foreign import ccall unsafe "hs_bindgen_2e181350411c95e9" hs_bindgen_2e181350411c95e9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f4@
+hs_bindgen_2e181350411c95e9 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f4@
+hs_bindgen_2e181350411c95e9 = fmap fromFFIType hs_bindgen_2e181350411c95e9_base
+{-# NOINLINE f4_funptr #-}
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @attributes\/visibility\/functions.h 18:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f4_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @attributes\/visibility\/functions.h 18:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f4_funptr = unsafePerformIO hs_bindgen_2e181350411c95e9
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f5@
+foreign import ccall unsafe "hs_bindgen_514428a6d0d70211" hs_bindgen_514428a6d0d70211_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f5@
+hs_bindgen_514428a6d0d70211 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f5@
+hs_bindgen_514428a6d0d70211 = fmap fromFFIType hs_bindgen_514428a6d0d70211_base
+{-# NOINLINE f5_funptr #-}
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @attributes\/visibility\/functions.h 21:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f5_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @attributes\/visibility\/functions.h 21:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f5_funptr = unsafePerformIO hs_bindgen_514428a6d0d70211
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f6@
+foreign import ccall unsafe "hs_bindgen_9b7f8e653b947b35" hs_bindgen_9b7f8e653b947b35_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f6@
+hs_bindgen_9b7f8e653b947b35 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f6@
+hs_bindgen_9b7f8e653b947b35 = fmap fromFFIType hs_bindgen_9b7f8e653b947b35_base
+{-# NOINLINE f6_funptr #-}
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @attributes\/visibility\/functions.h 22:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f6_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @attributes\/visibility\/functions.h 22:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f6_funptr = unsafePerformIO hs_bindgen_9b7f8e653b947b35
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f7@
+foreign import ccall unsafe "hs_bindgen_53b66f2ee9d5bea3" hs_bindgen_53b66f2ee9d5bea3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f7@
+hs_bindgen_53b66f2ee9d5bea3 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f7@
+hs_bindgen_53b66f2ee9d5bea3 = fmap fromFFIType hs_bindgen_53b66f2ee9d5bea3_base
+{-# NOINLINE f7_funptr #-}
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @attributes\/visibility\/functions.h 23:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f7_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @attributes\/visibility\/functions.h 23:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f7_funptr = unsafePerformIO hs_bindgen_53b66f2ee9d5bea3
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f8@
+foreign import ccall unsafe "hs_bindgen_90ce84ff3a158d95" hs_bindgen_90ce84ff3a158d95_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f8@
+hs_bindgen_90ce84ff3a158d95 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f8@
+hs_bindgen_90ce84ff3a158d95 = fmap fromFFIType hs_bindgen_90ce84ff3a158d95_base
+{-# NOINLINE f8_funptr #-}
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @attributes\/visibility\/functions.h 24:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f8_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @attributes\/visibility\/functions.h 24:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f8_funptr = unsafePerformIO hs_bindgen_90ce84ff3a158d95
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f9@
+foreign import ccall unsafe "hs_bindgen_bd91fda2207a62eb" hs_bindgen_bd91fda2207a62eb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f9@
+hs_bindgen_bd91fda2207a62eb :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f9@
+hs_bindgen_bd91fda2207a62eb = fmap fromFFIType hs_bindgen_bd91fda2207a62eb_base
+{-# NOINLINE f9_funptr #-}
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @attributes\/visibility\/functions.h 25:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f9_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @attributes\/visibility\/functions.h 25:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f9_funptr = unsafePerformIO hs_bindgen_bd91fda2207a62eb
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f10@
+foreign import ccall unsafe "hs_bindgen_f216131cd3bd6919" hs_bindgen_f216131cd3bd6919_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f10@
+hs_bindgen_f216131cd3bd6919 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f10@
+hs_bindgen_f216131cd3bd6919 = fmap fromFFIType hs_bindgen_f216131cd3bd6919_base
+{-# NOINLINE f10_funptr #-}
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @attributes\/visibility\/functions.h 28:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f10_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @attributes\/visibility\/functions.h 28:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f10_funptr = unsafePerformIO hs_bindgen_f216131cd3bd6919
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f11@
+foreign import ccall unsafe "hs_bindgen_d40c26619dcfad79" hs_bindgen_d40c26619dcfad79_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f11@
+hs_bindgen_d40c26619dcfad79 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f11@
+hs_bindgen_d40c26619dcfad79 = fmap fromFFIType hs_bindgen_d40c26619dcfad79_base
+{-# NOINLINE f11_funptr #-}
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @attributes\/visibility\/functions.h 29:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f11_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @attributes\/visibility\/functions.h 29:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f11_funptr = unsafePerformIO hs_bindgen_d40c26619dcfad79
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f12@
+foreign import ccall unsafe "hs_bindgen_d507bba11a647ae8" hs_bindgen_d507bba11a647ae8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f12@
+hs_bindgen_d507bba11a647ae8 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f12@
+hs_bindgen_d507bba11a647ae8 = fmap fromFFIType hs_bindgen_d507bba11a647ae8_base
+{-# NOINLINE f12_funptr #-}
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @attributes\/visibility\/functions.h 30:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f12_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @attributes\/visibility\/functions.h 30:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f12_funptr = unsafePerformIO hs_bindgen_d507bba11a647ae8
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f13@
+foreign import ccall unsafe "hs_bindgen_a90968b5f0eb111f" hs_bindgen_a90968b5f0eb111f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f13@
+hs_bindgen_a90968b5f0eb111f :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f13@
+hs_bindgen_a90968b5f0eb111f = fmap fromFFIType hs_bindgen_a90968b5f0eb111f_base
+{-# NOINLINE f13_funptr #-}
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @attributes\/visibility\/functions.h 31:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f13_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @attributes\/visibility\/functions.h 31:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f13_funptr = unsafePerformIO hs_bindgen_a90968b5f0eb111f
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f14@
+foreign import ccall unsafe "hs_bindgen_f584fb1da48609e4" hs_bindgen_f584fb1da48609e4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f14@
+hs_bindgen_f584fb1da48609e4 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f14@
+hs_bindgen_f584fb1da48609e4 = fmap fromFFIType hs_bindgen_f584fb1da48609e4_base
+{-# NOINLINE f14_funptr #-}
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @attributes\/visibility\/functions.h 32:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f14_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @attributes\/visibility\/functions.h 32:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f14_funptr = unsafePerformIO hs_bindgen_f584fb1da48609e4
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f15@
+foreign import ccall unsafe "hs_bindgen_1c5f8cf4562364d0" hs_bindgen_1c5f8cf4562364d0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f15@
+hs_bindgen_1c5f8cf4562364d0 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f15@
+hs_bindgen_1c5f8cf4562364d0 = fmap fromFFIType hs_bindgen_1c5f8cf4562364d0_base
+{-# NOINLINE f15_funptr #-}
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @attributes\/visibility\/functions.h 35:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f15_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @attributes\/visibility\/functions.h 35:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f15_funptr = unsafePerformIO hs_bindgen_1c5f8cf4562364d0
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f16@
+foreign import ccall unsafe "hs_bindgen_6af855fd845ff731" hs_bindgen_6af855fd845ff731_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f16@
+hs_bindgen_6af855fd845ff731 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f16@
+hs_bindgen_6af855fd845ff731 = fmap fromFFIType hs_bindgen_6af855fd845ff731_base
+{-# NOINLINE f16_funptr #-}
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @attributes\/visibility\/functions.h 36:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f16_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @attributes\/visibility\/functions.h 36:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f16_funptr = unsafePerformIO hs_bindgen_6af855fd845ff731
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f17@
+foreign import ccall unsafe "hs_bindgen_c5aa3698b4ac9578" hs_bindgen_c5aa3698b4ac9578_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f17@
+hs_bindgen_c5aa3698b4ac9578 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f17@
+hs_bindgen_c5aa3698b4ac9578 = fmap fromFFIType hs_bindgen_c5aa3698b4ac9578_base
+{-# NOINLINE f17_funptr #-}
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @attributes\/visibility\/functions.h 37:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f17_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @attributes\/visibility\/functions.h 37:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f17_funptr = unsafePerformIO hs_bindgen_c5aa3698b4ac9578
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f18@
+foreign import ccall unsafe "hs_bindgen_83b20ec12cdacad3" hs_bindgen_83b20ec12cdacad3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f18@
+hs_bindgen_83b20ec12cdacad3 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f18@
+hs_bindgen_83b20ec12cdacad3 = fmap fromFFIType hs_bindgen_83b20ec12cdacad3_base
+{-# NOINLINE f18_funptr #-}
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @attributes\/visibility\/functions.h 38:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f18_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @attributes\/visibility\/functions.h 38:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f18_funptr = unsafePerformIO hs_bindgen_83b20ec12cdacad3
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f19@
+foreign import ccall unsafe "hs_bindgen_9530c7f467585e16" hs_bindgen_9530c7f467585e16_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f19@
+hs_bindgen_9530c7f467585e16 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f19@
+hs_bindgen_9530c7f467585e16 = fmap fromFFIType hs_bindgen_9530c7f467585e16_base
+{-# NOINLINE f19_funptr #-}
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @attributes\/visibility\/functions.h 39:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f19_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @attributes\/visibility\/functions.h 39:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f19_funptr = unsafePerformIO hs_bindgen_9530c7f467585e16
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f20@
+foreign import ccall unsafe "hs_bindgen_6b7091b3c8333945" hs_bindgen_6b7091b3c8333945_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f20@
+hs_bindgen_6b7091b3c8333945 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f20@
+hs_bindgen_6b7091b3c8333945 = fmap fromFFIType hs_bindgen_6b7091b3c8333945_base
+{-# NOINLINE f20_funptr #-}
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @attributes\/visibility\/functions.h 42:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f20_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @attributes\/visibility\/functions.h 42:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f20_funptr = unsafePerformIO hs_bindgen_6b7091b3c8333945
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f21@
+foreign import ccall unsafe "hs_bindgen_58ed5b745dd5583b" hs_bindgen_58ed5b745dd5583b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f21@
+hs_bindgen_58ed5b745dd5583b :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f21@
+hs_bindgen_58ed5b745dd5583b = fmap fromFFIType hs_bindgen_58ed5b745dd5583b_base
+{-# NOINLINE f21_funptr #-}
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @attributes\/visibility\/functions.h 43:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f21_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @attributes\/visibility\/functions.h 43:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f21_funptr = unsafePerformIO hs_bindgen_58ed5b745dd5583b
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f22@
+foreign import ccall unsafe "hs_bindgen_2fc8f17386d9d13f" hs_bindgen_2fc8f17386d9d13f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f22@
+hs_bindgen_2fc8f17386d9d13f :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f22@
+hs_bindgen_2fc8f17386d9d13f = fmap fromFFIType hs_bindgen_2fc8f17386d9d13f_base
+{-# NOINLINE f22_funptr #-}
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @attributes\/visibility\/functions.h 44:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f22_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @attributes\/visibility\/functions.h 44:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f22_funptr = unsafePerformIO hs_bindgen_2fc8f17386d9d13f
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f23@
+foreign import ccall unsafe "hs_bindgen_155c186bf2426f9c" hs_bindgen_155c186bf2426f9c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f23@
+hs_bindgen_155c186bf2426f9c :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f23@
+hs_bindgen_155c186bf2426f9c = fmap fromFFIType hs_bindgen_155c186bf2426f9c_base
+{-# NOINLINE f23_funptr #-}
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @attributes\/visibility\/functions.h 45:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f23_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @attributes\/visibility\/functions.h 45:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f23_funptr = unsafePerformIO hs_bindgen_155c186bf2426f9c
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f24@
+foreign import ccall unsafe "hs_bindgen_1c6a122ab1d7cef0" hs_bindgen_1c6a122ab1d7cef0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f24@
+hs_bindgen_1c6a122ab1d7cef0 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f24@
+hs_bindgen_1c6a122ab1d7cef0 = fmap fromFFIType hs_bindgen_1c6a122ab1d7cef0_base
+{-# NOINLINE f24_funptr #-}
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @attributes\/visibility\/functions.h 46:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f24_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @attributes\/visibility\/functions.h 46:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f24_funptr = unsafePerformIO hs_bindgen_1c6a122ab1d7cef0
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f25@
+foreign import ccall unsafe "hs_bindgen_80ef1e1dba11ffdd" hs_bindgen_80ef1e1dba11ffdd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f25@
+hs_bindgen_80ef1e1dba11ffdd :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f25@
+hs_bindgen_80ef1e1dba11ffdd = fmap fromFFIType hs_bindgen_80ef1e1dba11ffdd_base
+{-# NOINLINE f25_funptr #-}
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @attributes\/visibility\/functions.h 49:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f25_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @attributes\/visibility\/functions.h 49:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f25_funptr = unsafePerformIO hs_bindgen_80ef1e1dba11ffdd
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f26@
+foreign import ccall unsafe "hs_bindgen_f7b63b778f9532da" hs_bindgen_f7b63b778f9532da_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f26@
+hs_bindgen_f7b63b778f9532da :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f26@
+hs_bindgen_f7b63b778f9532da = fmap fromFFIType hs_bindgen_f7b63b778f9532da_base
+{-# NOINLINE f26_funptr #-}
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @attributes\/visibility\/functions.h 50:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f26_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @attributes\/visibility\/functions.h 50:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f26_funptr = unsafePerformIO hs_bindgen_f7b63b778f9532da
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f27@
+foreign import ccall unsafe "hs_bindgen_01ece11a3077bfd9" hs_bindgen_01ece11a3077bfd9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f27@
+hs_bindgen_01ece11a3077bfd9 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f27@
+hs_bindgen_01ece11a3077bfd9 = fmap fromFFIType hs_bindgen_01ece11a3077bfd9_base
+{-# NOINLINE f27_funptr #-}
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @attributes\/visibility\/functions.h 51:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f27_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @attributes\/visibility\/functions.h 51:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f27_funptr = unsafePerformIO hs_bindgen_01ece11a3077bfd9
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f28@
+foreign import ccall unsafe "hs_bindgen_0bc3e07b1934c20b" hs_bindgen_0bc3e07b1934c20b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f28@
+hs_bindgen_0bc3e07b1934c20b :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f28@
+hs_bindgen_0bc3e07b1934c20b = fmap fromFFIType hs_bindgen_0bc3e07b1934c20b_base
+{-# NOINLINE f28_funptr #-}
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @attributes\/visibility\/functions.h 52:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f28_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @attributes\/visibility\/functions.h 52:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f28_funptr = unsafePerformIO hs_bindgen_0bc3e07b1934c20b
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f29@
+foreign import ccall unsafe "hs_bindgen_f3734109e7f7d5ee" hs_bindgen_f3734109e7f7d5ee_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f29@
+hs_bindgen_f3734109e7f7d5ee :: IO (FunPtr (IO ()))
+-- __unique:__ @test_attributesvisibilityfunction_Example_get_f29@
+hs_bindgen_f3734109e7f7d5ee = fmap fromFFIType hs_bindgen_f3734109e7f7d5ee_base
+{-# NOINLINE f29_funptr #-}
+{-| __C declaration:__ @f29@
+
+    __defined at:__ @attributes\/visibility\/functions.h 53:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f29_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f29@
+
+    __defined at:__ @attributes\/visibility\/functions.h 53:56@
+
+    __exported by:__ @attributes\/visibility\/functions.h@
+-}
+f29_funptr = unsafePerformIO hs_bindgen_f3734109e7f7d5ee
diff --git a/test-artefacts/fixtures/attributes/visibility/types/Example.hs b/test-artefacts/fixtures/attributes/visibility/types/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/types/Example.hs
@@ -0,0 +1,3566 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S0
+    , Example.S1
+    , Example.S2
+    , Example.S3
+    , Example.S4
+    , Example.S5(..)
+    , Example.S6(..)
+    , Example.S7(..)
+    , Example.S8(..)
+    , Example.S9(..)
+    , Example.S10(..)
+    , Example.S11(..)
+    , Example.S12(..)
+    , Example.S13(..)
+    , Example.S14(..)
+    , Example.S15(..)
+    , Example.S16(..)
+    , Example.S17(..)
+    , Example.S18(..)
+    , Example.S19(..)
+    , Example.U0
+    , Example.U1
+    , Example.U2
+    , Example.U3
+    , Example.U4
+    , Example.U5(..)
+    , Example.U6(..)
+    , Example.U7(..)
+    , Example.U8(..)
+    , Example.U9(..)
+    , Example.U10(..)
+    , Example.U11(..)
+    , Example.U12(..)
+    , Example.U13(..)
+    , Example.U14(..)
+    , Example.U15(..)
+    , Example.U16(..)
+    , Example.U17(..)
+    , Example.U18(..)
+    , Example.U19(..)
+    , Example.E0
+    , Example.E1
+    , Example.E2
+    , Example.E3
+    , Example.E4
+    , Example.E5(..)
+    , pattern Example.X5
+    , Example.E6(..)
+    , pattern Example.X6
+    , Example.E7(..)
+    , pattern Example.X7
+    , Example.E8(..)
+    , pattern Example.X8
+    , Example.E9(..)
+    , pattern Example.X9
+    , Example.E10(..)
+    , pattern Example.X10
+    , Example.E11(..)
+    , pattern Example.X11
+    , Example.E12(..)
+    , pattern Example.X12
+    , Example.E13(..)
+    , pattern Example.X13
+    , Example.E14(..)
+    , pattern Example.X14
+    , Example.E15(..)
+    , pattern Example.X15
+    , Example.E16(..)
+    , pattern Example.X16
+    , Example.E17(..)
+    , pattern Example.X17
+    , Example.E18(..)
+    , pattern Example.X18
+    , Example.E19(..)
+    , pattern Example.X19
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S0@
+
+    __defined at:__ @attributes\/visibility\/types.h 13:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S0
+
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @attributes\/visibility\/types.h 14:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S1
+
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @attributes\/visibility\/types.h 15:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S2
+
+{-| __C declaration:__ @struct S3@
+
+    __defined at:__ @attributes\/visibility\/types.h 16:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S3
+
+{-| __C declaration:__ @struct S4@
+
+    __defined at:__ @attributes\/visibility\/types.h 17:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S4
+
+{-| __C declaration:__ @struct S5@
+
+    __defined at:__ @attributes\/visibility\/types.h 20:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S5 = S5
+  { s5_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 20:60@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S5 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S5 where
+
+  readRaw =
+    \ptr0 ->
+          pure S5
+      <*> HasCField.readRaw (BG.Proxy @"s5_x") ptr0
+
+instance Marshal.WriteRaw S5 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S5 s5_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s5_x") ptr0 s5_x2
+
+deriving via Marshal.EquivStorable S5 instance BG.Storable S5
+
+deriving via Struct.IsStructViaReadRaw S5 instance Struct.IsStruct S5
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 20:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s5_x" S5 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S5 {s5_x = y1}, BG.getField @"s5_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s5_x" (BG.Ptr S5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s5_x")
+
+instance HasCField.HasCField S5 "s5_x" where
+
+  type CFieldType S5 "s5_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S6@
+
+    __defined at:__ @attributes\/visibility\/types.h 21:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S6 = S6
+  { s6_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 21:60@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S6 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S6 where
+
+  readRaw =
+    \ptr0 ->
+          pure S6
+      <*> HasCField.readRaw (BG.Proxy @"s6_x") ptr0
+
+instance Marshal.WriteRaw S6 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S6 s6_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s6_x") ptr0 s6_x2
+
+deriving via Marshal.EquivStorable S6 instance BG.Storable S6
+
+deriving via Struct.IsStructViaReadRaw S6 instance Struct.IsStruct S6
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 21:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s6_x" S6 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S6 {s6_x = y1}, BG.getField @"s6_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s6_x" (BG.Ptr S6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s6_x")
+
+instance HasCField.HasCField S6 "s6_x" where
+
+  type CFieldType S6 "s6_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S7@
+
+    __defined at:__ @attributes\/visibility\/types.h 22:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S7 = S7
+  { s7_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 22:60@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S7 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S7 where
+
+  readRaw =
+    \ptr0 ->
+          pure S7
+      <*> HasCField.readRaw (BG.Proxy @"s7_x") ptr0
+
+instance Marshal.WriteRaw S7 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S7 s7_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s7_x") ptr0 s7_x2
+
+deriving via Marshal.EquivStorable S7 instance BG.Storable S7
+
+deriving via Struct.IsStructViaReadRaw S7 instance Struct.IsStruct S7
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 22:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s7_x" S7 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S7 {s7_x = y1}, BG.getField @"s7_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s7_x" (BG.Ptr S7) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s7_x")
+
+instance HasCField.HasCField S7 "s7_x" where
+
+  type CFieldType S7 "s7_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S8@
+
+    __defined at:__ @attributes\/visibility\/types.h 23:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S8 = S8
+  { s8_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 23:60@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S8 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S8 where
+
+  readRaw =
+    \ptr0 ->
+          pure S8
+      <*> HasCField.readRaw (BG.Proxy @"s8_x") ptr0
+
+instance Marshal.WriteRaw S8 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S8 s8_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s8_x") ptr0 s8_x2
+
+deriving via Marshal.EquivStorable S8 instance BG.Storable S8
+
+deriving via Struct.IsStructViaReadRaw S8 instance Struct.IsStruct S8
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 23:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s8_x" S8 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S8 {s8_x = y1}, BG.getField @"s8_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s8_x" (BG.Ptr S8) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s8_x")
+
+instance HasCField.HasCField S8 "s8_x" where
+
+  type CFieldType S8 "s8_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S9@
+
+    __defined at:__ @attributes\/visibility\/types.h 24:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S9 = S9
+  { s9_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 24:60@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S9 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S9 where
+
+  readRaw =
+    \ptr0 ->
+          pure S9
+      <*> HasCField.readRaw (BG.Proxy @"s9_x") ptr0
+
+instance Marshal.WriteRaw S9 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S9 s9_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s9_x") ptr0 s9_x2
+
+deriving via Marshal.EquivStorable S9 instance BG.Storable S9
+
+deriving via Struct.IsStructViaReadRaw S9 instance Struct.IsStruct S9
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 24:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s9_x" S9 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S9 {s9_x = y1}, BG.getField @"s9_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s9_x" (BG.Ptr S9) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s9_x")
+
+instance HasCField.HasCField S9 "s9_x" where
+
+  type CFieldType S9 "s9_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S10@
+
+    __defined at:__ @attributes\/visibility\/types.h 33:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S10 = S10
+  { s10_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 33:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S10 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S10 where
+
+  readRaw =
+    \ptr0 ->
+          pure S10
+      <*> HasCField.readRaw (BG.Proxy @"s10_x") ptr0
+
+instance Marshal.WriteRaw S10 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S10 s10_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s10_x") ptr0 s10_x2
+
+deriving via Marshal.EquivStorable S10 instance BG.Storable S10
+
+deriving via Struct.IsStructViaReadRaw S10 instance Struct.IsStruct S10
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 33:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s10_x" S10 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S10 {s10_x = y1}, BG.getField @"s10_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s10_x" (BG.Ptr S10) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s10_x")
+
+instance HasCField.HasCField S10 "s10_x" where
+
+  type CFieldType S10 "s10_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S11@
+
+    __defined at:__ @attributes\/visibility\/types.h 34:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S11 = S11
+  { s11_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 34:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S11 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S11 where
+
+  readRaw =
+    \ptr0 ->
+          pure S11
+      <*> HasCField.readRaw (BG.Proxy @"s11_x") ptr0
+
+instance Marshal.WriteRaw S11 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S11 s11_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s11_x") ptr0 s11_x2
+
+deriving via Marshal.EquivStorable S11 instance BG.Storable S11
+
+deriving via Struct.IsStructViaReadRaw S11 instance Struct.IsStruct S11
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 34:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s11_x" S11 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S11 {s11_x = y1}, BG.getField @"s11_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s11_x" (BG.Ptr S11) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s11_x")
+
+instance HasCField.HasCField S11 "s11_x" where
+
+  type CFieldType S11 "s11_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S12@
+
+    __defined at:__ @attributes\/visibility\/types.h 35:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S12 = S12
+  { s12_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 35:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S12 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S12 where
+
+  readRaw =
+    \ptr0 ->
+          pure S12
+      <*> HasCField.readRaw (BG.Proxy @"s12_x") ptr0
+
+instance Marshal.WriteRaw S12 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S12 s12_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s12_x") ptr0 s12_x2
+
+deriving via Marshal.EquivStorable S12 instance BG.Storable S12
+
+deriving via Struct.IsStructViaReadRaw S12 instance Struct.IsStruct S12
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 35:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s12_x" S12 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S12 {s12_x = y1}, BG.getField @"s12_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s12_x" (BG.Ptr S12) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s12_x")
+
+instance HasCField.HasCField S12 "s12_x" where
+
+  type CFieldType S12 "s12_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S13@
+
+    __defined at:__ @attributes\/visibility\/types.h 36:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S13 = S13
+  { s13_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 36:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S13 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S13 where
+
+  readRaw =
+    \ptr0 ->
+          pure S13
+      <*> HasCField.readRaw (BG.Proxy @"s13_x") ptr0
+
+instance Marshal.WriteRaw S13 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S13 s13_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s13_x") ptr0 s13_x2
+
+deriving via Marshal.EquivStorable S13 instance BG.Storable S13
+
+deriving via Struct.IsStructViaReadRaw S13 instance Struct.IsStruct S13
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 36:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s13_x" S13 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S13 {s13_x = y1}, BG.getField @"s13_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s13_x" (BG.Ptr S13) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s13_x")
+
+instance HasCField.HasCField S13 "s13_x" where
+
+  type CFieldType S13 "s13_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S14@
+
+    __defined at:__ @attributes\/visibility\/types.h 37:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S14 = S14
+  { s14_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 37:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S14 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S14 where
+
+  readRaw =
+    \ptr0 ->
+          pure S14
+      <*> HasCField.readRaw (BG.Proxy @"s14_x") ptr0
+
+instance Marshal.WriteRaw S14 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S14 s14_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s14_x") ptr0 s14_x2
+
+deriving via Marshal.EquivStorable S14 instance BG.Storable S14
+
+deriving via Struct.IsStructViaReadRaw S14 instance Struct.IsStruct S14
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 37:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s14_x" S14 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S14 {s14_x = y1}, BG.getField @"s14_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s14_x" (BG.Ptr S14) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s14_x")
+
+instance HasCField.HasCField S14 "s14_x" where
+
+  type CFieldType S14 "s14_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S15@
+
+    __defined at:__ @attributes\/visibility\/types.h 46:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S15 = S15
+  { s15_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 46:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S15 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S15 where
+
+  readRaw =
+    \ptr0 ->
+          pure S15
+      <*> HasCField.readRaw (BG.Proxy @"s15_x") ptr0
+
+instance Marshal.WriteRaw S15 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S15 s15_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s15_x") ptr0 s15_x2
+
+deriving via Marshal.EquivStorable S15 instance BG.Storable S15
+
+deriving via Struct.IsStructViaReadRaw S15 instance Struct.IsStruct S15
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 46:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s15_x" S15 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S15 {s15_x = y1}, BG.getField @"s15_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s15_x" (BG.Ptr S15) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s15_x")
+
+instance HasCField.HasCField S15 "s15_x" where
+
+  type CFieldType S15 "s15_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S16@
+
+    __defined at:__ @attributes\/visibility\/types.h 47:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S16 = S16
+  { s16_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 47:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S16 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S16 where
+
+  readRaw =
+    \ptr0 ->
+          pure S16
+      <*> HasCField.readRaw (BG.Proxy @"s16_x") ptr0
+
+instance Marshal.WriteRaw S16 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S16 s16_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s16_x") ptr0 s16_x2
+
+deriving via Marshal.EquivStorable S16 instance BG.Storable S16
+
+deriving via Struct.IsStructViaReadRaw S16 instance Struct.IsStruct S16
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 47:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s16_x" S16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S16 {s16_x = y1}, BG.getField @"s16_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s16_x" (BG.Ptr S16) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s16_x")
+
+instance HasCField.HasCField S16 "s16_x" where
+
+  type CFieldType S16 "s16_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S17@
+
+    __defined at:__ @attributes\/visibility\/types.h 48:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S17 = S17
+  { s17_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 48:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S17 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S17 where
+
+  readRaw =
+    \ptr0 ->
+          pure S17
+      <*> HasCField.readRaw (BG.Proxy @"s17_x") ptr0
+
+instance Marshal.WriteRaw S17 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S17 s17_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s17_x") ptr0 s17_x2
+
+deriving via Marshal.EquivStorable S17 instance BG.Storable S17
+
+deriving via Struct.IsStructViaReadRaw S17 instance Struct.IsStruct S17
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 48:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s17_x" S17 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S17 {s17_x = y1}, BG.getField @"s17_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s17_x" (BG.Ptr S17) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s17_x")
+
+instance HasCField.HasCField S17 "s17_x" where
+
+  type CFieldType S17 "s17_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S18@
+
+    __defined at:__ @attributes\/visibility\/types.h 49:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S18 = S18
+  { s18_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 49:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S18 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S18 where
+
+  readRaw =
+    \ptr0 ->
+          pure S18
+      <*> HasCField.readRaw (BG.Proxy @"s18_x") ptr0
+
+instance Marshal.WriteRaw S18 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S18 s18_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s18_x") ptr0 s18_x2
+
+deriving via Marshal.EquivStorable S18 instance BG.Storable S18
+
+deriving via Struct.IsStructViaReadRaw S18 instance Struct.IsStruct S18
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 49:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s18_x" S18 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S18 {s18_x = y1}, BG.getField @"s18_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s18_x" (BG.Ptr S18) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s18_x")
+
+instance HasCField.HasCField S18 "s18_x" where
+
+  type CFieldType S18 "s18_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S19@
+
+    __defined at:__ @attributes\/visibility\/types.h 50:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S19 = S19
+  { s19_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @attributes\/visibility\/types.h 50:61@
+
+         __exported by:__ @attributes\/visibility\/types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S19 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S19 where
+
+  readRaw =
+    \ptr0 ->
+          pure S19
+      <*> HasCField.readRaw (BG.Proxy @"s19_x") ptr0
+
+instance Marshal.WriteRaw S19 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S19 s19_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s19_x") ptr0 s19_x2
+
+deriving via Marshal.EquivStorable S19 instance BG.Storable S19
+
+deriving via Struct.IsStructViaReadRaw S19 instance Struct.IsStruct S19
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 50:61@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s19_x" S19 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S19 {s19_x = y1}, BG.getField @"s19_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s19_x" (BG.Ptr S19) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s19_x")
+
+instance HasCField.HasCField S19 "s19_x" where
+
+  type CFieldType S19 "s19_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U0@
+
+    __defined at:__ @attributes\/visibility\/types.h 53:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U0
+
+{-| __C declaration:__ @union U1@
+
+    __defined at:__ @attributes\/visibility\/types.h 54:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U1
+
+{-| __C declaration:__ @union U2@
+
+    __defined at:__ @attributes\/visibility\/types.h 55:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U2
+
+{-| __C declaration:__ @union U3@
+
+    __defined at:__ @attributes\/visibility\/types.h 56:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U3
+
+{-| __C declaration:__ @union U4@
+
+    __defined at:__ @attributes\/visibility\/types.h 57:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U4
+
+{-| __C declaration:__ @union U5@
+
+    __defined at:__ @attributes\/visibility\/types.h 60:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U5 = U5
+  { unwrapU5 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U5
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U5
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U5
+
+deriving via Marshal.EquivStorable U5 instance BG.Storable U5
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U5
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 60:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u5_x" U5 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 60:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u5_x" U5 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u5_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u5_x" (BG.Ptr U5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u5_x")
+
+instance HasCField.HasCField U5 "u5_x" where
+
+  type CFieldType U5 "u5_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U6@
+
+    __defined at:__ @attributes\/visibility\/types.h 61:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U6 = U6
+  { unwrapU6 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U6
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U6
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U6
+
+deriving via Marshal.EquivStorable U6 instance BG.Storable U6
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U6
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 61:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u6_x" U6 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 61:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u6_x" U6 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u6_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u6_x" (BG.Ptr U6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u6_x")
+
+instance HasCField.HasCField U6 "u6_x" where
+
+  type CFieldType U6 "u6_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U7@
+
+    __defined at:__ @attributes\/visibility\/types.h 62:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U7 = U7
+  { unwrapU7 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U7
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U7
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U7
+
+deriving via Marshal.EquivStorable U7 instance BG.Storable U7
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U7
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 62:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u7_x" U7 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 62:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u7_x" U7 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u7_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u7_x" (BG.Ptr U7) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u7_x")
+
+instance HasCField.HasCField U7 "u7_x" where
+
+  type CFieldType U7 "u7_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U8@
+
+    __defined at:__ @attributes\/visibility\/types.h 63:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U8 = U8
+  { unwrapU8 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U8
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U8
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U8
+
+deriving via Marshal.EquivStorable U8 instance BG.Storable U8
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U8
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 63:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u8_x" U8 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 63:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u8_x" U8 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u8_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u8_x" (BG.Ptr U8) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u8_x")
+
+instance HasCField.HasCField U8 "u8_x" where
+
+  type CFieldType U8 "u8_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U9@
+
+    __defined at:__ @attributes\/visibility\/types.h 64:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U9 = U9
+  { unwrapU9 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U9
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U9
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U9
+
+deriving via Marshal.EquivStorable U9 instance BG.Storable U9
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U9
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 64:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u9_x" U9 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 64:59@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u9_x" U9 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u9_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u9_x" (BG.Ptr U9) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u9_x")
+
+instance HasCField.HasCField U9 "u9_x" where
+
+  type CFieldType U9 "u9_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U10@
+
+    __defined at:__ @attributes\/visibility\/types.h 73:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U10 = U10
+  { unwrapU10 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U10
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U10
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U10
+
+deriving via Marshal.EquivStorable U10 instance BG.Storable U10
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U10
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 73:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u10_x" U10 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 73:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u10_x" U10 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u10_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u10_x" (BG.Ptr U10) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u10_x")
+
+instance HasCField.HasCField U10 "u10_x" where
+
+  type CFieldType U10 "u10_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U11@
+
+    __defined at:__ @attributes\/visibility\/types.h 74:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U11 = U11
+  { unwrapU11 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U11
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U11
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U11
+
+deriving via Marshal.EquivStorable U11 instance BG.Storable U11
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U11
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 74:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u11_x" U11 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 74:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u11_x" U11 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u11_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u11_x" (BG.Ptr U11) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u11_x")
+
+instance HasCField.HasCField U11 "u11_x" where
+
+  type CFieldType U11 "u11_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U12@
+
+    __defined at:__ @attributes\/visibility\/types.h 75:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U12 = U12
+  { unwrapU12 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U12
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U12
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U12
+
+deriving via Marshal.EquivStorable U12 instance BG.Storable U12
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U12
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 75:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u12_x" U12 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 75:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u12_x" U12 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u12_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u12_x" (BG.Ptr U12) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u12_x")
+
+instance HasCField.HasCField U12 "u12_x" where
+
+  type CFieldType U12 "u12_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U13@
+
+    __defined at:__ @attributes\/visibility\/types.h 76:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U13 = U13
+  { unwrapU13 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U13
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U13
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U13
+
+deriving via Marshal.EquivStorable U13 instance BG.Storable U13
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U13
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 76:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u13_x" U13 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 76:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u13_x" U13 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u13_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u13_x" (BG.Ptr U13) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u13_x")
+
+instance HasCField.HasCField U13 "u13_x" where
+
+  type CFieldType U13 "u13_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U14@
+
+    __defined at:__ @attributes\/visibility\/types.h 77:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U14 = U14
+  { unwrapU14 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U14
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U14
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U14
+
+deriving via Marshal.EquivStorable U14 instance BG.Storable U14
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U14
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 77:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u14_x" U14 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 77:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u14_x" U14 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u14_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u14_x" (BG.Ptr U14) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u14_x")
+
+instance HasCField.HasCField U14 "u14_x" where
+
+  type CFieldType U14 "u14_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U15@
+
+    __defined at:__ @attributes\/visibility\/types.h 86:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U15 = U15
+  { unwrapU15 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U15
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U15
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U15
+
+deriving via Marshal.EquivStorable U15 instance BG.Storable U15
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U15
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 86:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u15_x" U15 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 86:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u15_x" U15 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u15_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u15_x" (BG.Ptr U15) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u15_x")
+
+instance HasCField.HasCField U15 "u15_x" where
+
+  type CFieldType U15 "u15_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U16@
+
+    __defined at:__ @attributes\/visibility\/types.h 87:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U16 = U16
+  { unwrapU16 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U16
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U16
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U16
+
+deriving via Marshal.EquivStorable U16 instance BG.Storable U16
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U16
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 87:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u16_x" U16 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 87:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u16_x" U16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u16_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u16_x" (BG.Ptr U16) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u16_x")
+
+instance HasCField.HasCField U16 "u16_x" where
+
+  type CFieldType U16 "u16_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U17@
+
+    __defined at:__ @attributes\/visibility\/types.h 88:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U17 = U17
+  { unwrapU17 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U17
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U17
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U17
+
+deriving via Marshal.EquivStorable U17 instance BG.Storable U17
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U17
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 88:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u17_x" U17 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 88:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u17_x" U17 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u17_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u17_x" (BG.Ptr U17) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u17_x")
+
+instance HasCField.HasCField U17 "u17_x" where
+
+  type CFieldType U17 "u17_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U18@
+
+    __defined at:__ @attributes\/visibility\/types.h 89:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U18 = U18
+  { unwrapU18 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U18
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U18
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U18
+
+deriving via Marshal.EquivStorable U18 instance BG.Storable U18
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U18
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 89:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u18_x" U18 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 89:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u18_x" U18 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u18_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u18_x" (BG.Ptr U18) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u18_x")
+
+instance HasCField.HasCField U18 "u18_x" where
+
+  type CFieldType U18 "u18_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U19@
+
+    __defined at:__ @attributes\/visibility\/types.h 90:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U19 = U19
+  { unwrapU19 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize U19
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw U19
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw U19
+
+deriving via Marshal.EquivStorable U19 instance BG.Storable U19
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion U19
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 90:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "u19_x" U19 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @attributes\/visibility\/types.h 90:60@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "u19_x" U19 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u19_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "u19_x" (BG.Ptr U19) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u19_x")
+
+instance HasCField.HasCField U19 "u19_x" where
+
+  type CFieldType U19 "u19_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @enum E0@
+
+    __defined at:__ @attributes\/visibility\/types.h 93:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E0
+
+{-| __C declaration:__ @enum E1@
+
+    __defined at:__ @attributes\/visibility\/types.h 94:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E1
+
+{-| __C declaration:__ @enum E2@
+
+    __defined at:__ @attributes\/visibility\/types.h 95:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E2
+
+{-| __C declaration:__ @enum E3@
+
+    __defined at:__ @attributes\/visibility\/types.h 96:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E3
+
+{-| __C declaration:__ @enum E4@
+
+    __defined at:__ @attributes\/visibility\/types.h 97:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E4
+
+{-| __C declaration:__ @enum E5@
+
+    __defined at:__ @attributes\/visibility\/types.h 100:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E5 = E5
+  { unwrapE5 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E5 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E5 where
+
+  readRaw =
+    \ptr0 ->
+          pure E5
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E5 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E5 unwrapE52 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE52
+
+deriving via Marshal.EquivStorable E5 instance BG.Storable E5
+
+deriving via BG.CUInt instance BG.Prim E5
+
+instance CEnum.CEnum E5 where
+
+  type CEnumZ E5 = BG.CUInt
+
+  toCEnum = E5
+
+  fromCEnum = BG.getField @"unwrapE5"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X5")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E5"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E5"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E5 where
+
+  minDeclaredValue = X5
+
+  maxDeclaredValue = X5
+
+instance Show E5 where
+
+  showsPrec = CEnum.shows
+
+instance Read E5 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE5" E5 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E5 {unwrapE5 = y1}, BG.getField @"unwrapE5" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrapE5" (BG.Ptr E5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE5")
+
+instance HasCField.HasCField E5 "unwrapE5" where
+
+  type CFieldType E5 "unwrapE5" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x5@
+
+    __defined at:__ @attributes\/visibility\/types.h 100:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X5 :: E5
+pattern X5 = E5 0
+
+{-| __C declaration:__ @enum E6@
+
+    __defined at:__ @attributes\/visibility\/types.h 101:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E6 = E6
+  { unwrapE6 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E6 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E6 where
+
+  readRaw =
+    \ptr0 ->
+          pure E6
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E6 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E6 unwrapE62 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE62
+
+deriving via Marshal.EquivStorable E6 instance BG.Storable E6
+
+deriving via BG.CUInt instance BG.Prim E6
+
+instance CEnum.CEnum E6 where
+
+  type CEnumZ E6 = BG.CUInt
+
+  toCEnum = E6
+
+  fromCEnum = BG.getField @"unwrapE6"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X6")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E6"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E6"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E6 where
+
+  minDeclaredValue = X6
+
+  maxDeclaredValue = X6
+
+instance Show E6 where
+
+  showsPrec = CEnum.shows
+
+instance Read E6 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE6" E6 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E6 {unwrapE6 = y1}, BG.getField @"unwrapE6" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrapE6" (BG.Ptr E6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE6")
+
+instance HasCField.HasCField E6 "unwrapE6" where
+
+  type CFieldType E6 "unwrapE6" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x6@
+
+    __defined at:__ @attributes\/visibility\/types.h 101:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X6 :: E6
+pattern X6 = E6 0
+
+{-| __C declaration:__ @enum E7@
+
+    __defined at:__ @attributes\/visibility\/types.h 102:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E7 = E7
+  { unwrapE7 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E7 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E7 where
+
+  readRaw =
+    \ptr0 ->
+          pure E7
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E7 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E7 unwrapE72 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE72
+
+deriving via Marshal.EquivStorable E7 instance BG.Storable E7
+
+deriving via BG.CUInt instance BG.Prim E7
+
+instance CEnum.CEnum E7 where
+
+  type CEnumZ E7 = BG.CUInt
+
+  toCEnum = E7
+
+  fromCEnum = BG.getField @"unwrapE7"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X7")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E7"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E7"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E7 where
+
+  minDeclaredValue = X7
+
+  maxDeclaredValue = X7
+
+instance Show E7 where
+
+  showsPrec = CEnum.shows
+
+instance Read E7 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE7" E7 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E7 {unwrapE7 = y1}, BG.getField @"unwrapE7" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrapE7" (BG.Ptr E7) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE7")
+
+instance HasCField.HasCField E7 "unwrapE7" where
+
+  type CFieldType E7 "unwrapE7" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x7@
+
+    __defined at:__ @attributes\/visibility\/types.h 102:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X7 :: E7
+pattern X7 = E7 0
+
+{-| __C declaration:__ @enum E8@
+
+    __defined at:__ @attributes\/visibility\/types.h 103:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E8 = E8
+  { unwrapE8 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E8 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E8 where
+
+  readRaw =
+    \ptr0 ->
+          pure E8
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E8 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E8 unwrapE82 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE82
+
+deriving via Marshal.EquivStorable E8 instance BG.Storable E8
+
+deriving via BG.CUInt instance BG.Prim E8
+
+instance CEnum.CEnum E8 where
+
+  type CEnumZ E8 = BG.CUInt
+
+  toCEnum = E8
+
+  fromCEnum = BG.getField @"unwrapE8"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X8")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E8"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E8"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E8 where
+
+  minDeclaredValue = X8
+
+  maxDeclaredValue = X8
+
+instance Show E8 where
+
+  showsPrec = CEnum.shows
+
+instance Read E8 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE8" E8 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E8 {unwrapE8 = y1}, BG.getField @"unwrapE8" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrapE8" (BG.Ptr E8) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE8")
+
+instance HasCField.HasCField E8 "unwrapE8" where
+
+  type CFieldType E8 "unwrapE8" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x8@
+
+    __defined at:__ @attributes\/visibility\/types.h 103:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X8 :: E8
+pattern X8 = E8 0
+
+{-| __C declaration:__ @enum E9@
+
+    __defined at:__ @attributes\/visibility\/types.h 104:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E9 = E9
+  { unwrapE9 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E9 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E9 where
+
+  readRaw =
+    \ptr0 ->
+          pure E9
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E9 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E9 unwrapE92 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE92
+
+deriving via Marshal.EquivStorable E9 instance BG.Storable E9
+
+deriving via BG.CUInt instance BG.Prim E9
+
+instance CEnum.CEnum E9 where
+
+  type CEnumZ E9 = BG.CUInt
+
+  toCEnum = E9
+
+  fromCEnum = BG.getField @"unwrapE9"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X9")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E9"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E9"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E9 where
+
+  minDeclaredValue = X9
+
+  maxDeclaredValue = X9
+
+instance Show E9 where
+
+  showsPrec = CEnum.shows
+
+instance Read E9 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE9" E9 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E9 {unwrapE9 = y1}, BG.getField @"unwrapE9" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrapE9" (BG.Ptr E9) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE9")
+
+instance HasCField.HasCField E9 "unwrapE9" where
+
+  type CFieldType E9 "unwrapE9" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x9@
+
+    __defined at:__ @attributes\/visibility\/types.h 104:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X9 :: E9
+pattern X9 = E9 0
+
+{-| __C declaration:__ @enum E10@
+
+    __defined at:__ @attributes\/visibility\/types.h 113:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E10 = E10
+  { unwrapE10 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E10 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E10 where
+
+  readRaw =
+    \ptr0 ->
+          pure E10
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E10 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E10 unwrapE102 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE102
+
+deriving via Marshal.EquivStorable E10 instance BG.Storable E10
+
+deriving via BG.CUInt instance BG.Prim E10
+
+instance CEnum.CEnum E10 where
+
+  type CEnumZ E10 = BG.CUInt
+
+  toCEnum = E10
+
+  fromCEnum = BG.getField @"unwrapE10"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X10")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E10"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E10"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E10 where
+
+  minDeclaredValue = X10
+
+  maxDeclaredValue = X10
+
+instance Show E10 where
+
+  showsPrec = CEnum.shows
+
+instance Read E10 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE10" E10 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E10 {unwrapE10 = y1}, BG.getField @"unwrapE10" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE10" (BG.Ptr E10) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE10")
+
+instance HasCField.HasCField E10 "unwrapE10" where
+
+  type CFieldType E10 "unwrapE10" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x10@
+
+    __defined at:__ @attributes\/visibility\/types.h 113:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X10 :: E10
+pattern X10 = E10 0
+
+{-| __C declaration:__ @enum E11@
+
+    __defined at:__ @attributes\/visibility\/types.h 114:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E11 = E11
+  { unwrapE11 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E11 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E11 where
+
+  readRaw =
+    \ptr0 ->
+          pure E11
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E11 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E11 unwrapE112 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE112
+
+deriving via Marshal.EquivStorable E11 instance BG.Storable E11
+
+deriving via BG.CUInt instance BG.Prim E11
+
+instance CEnum.CEnum E11 where
+
+  type CEnumZ E11 = BG.CUInt
+
+  toCEnum = E11
+
+  fromCEnum = BG.getField @"unwrapE11"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X11")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E11"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E11"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E11 where
+
+  minDeclaredValue = X11
+
+  maxDeclaredValue = X11
+
+instance Show E11 where
+
+  showsPrec = CEnum.shows
+
+instance Read E11 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE11" E11 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E11 {unwrapE11 = y1}, BG.getField @"unwrapE11" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE11" (BG.Ptr E11) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE11")
+
+instance HasCField.HasCField E11 "unwrapE11" where
+
+  type CFieldType E11 "unwrapE11" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x11@
+
+    __defined at:__ @attributes\/visibility\/types.h 114:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X11 :: E11
+pattern X11 = E11 0
+
+{-| __C declaration:__ @enum E12@
+
+    __defined at:__ @attributes\/visibility\/types.h 115:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E12 = E12
+  { unwrapE12 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E12 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E12 where
+
+  readRaw =
+    \ptr0 ->
+          pure E12
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E12 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E12 unwrapE122 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE122
+
+deriving via Marshal.EquivStorable E12 instance BG.Storable E12
+
+deriving via BG.CUInt instance BG.Prim E12
+
+instance CEnum.CEnum E12 where
+
+  type CEnumZ E12 = BG.CUInt
+
+  toCEnum = E12
+
+  fromCEnum = BG.getField @"unwrapE12"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X12")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E12"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E12"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E12 where
+
+  minDeclaredValue = X12
+
+  maxDeclaredValue = X12
+
+instance Show E12 where
+
+  showsPrec = CEnum.shows
+
+instance Read E12 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE12" E12 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E12 {unwrapE12 = y1}, BG.getField @"unwrapE12" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE12" (BG.Ptr E12) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE12")
+
+instance HasCField.HasCField E12 "unwrapE12" where
+
+  type CFieldType E12 "unwrapE12" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x12@
+
+    __defined at:__ @attributes\/visibility\/types.h 115:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X12 :: E12
+pattern X12 = E12 0
+
+{-| __C declaration:__ @enum E13@
+
+    __defined at:__ @attributes\/visibility\/types.h 116:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E13 = E13
+  { unwrapE13 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E13 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E13 where
+
+  readRaw =
+    \ptr0 ->
+          pure E13
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E13 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E13 unwrapE132 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE132
+
+deriving via Marshal.EquivStorable E13 instance BG.Storable E13
+
+deriving via BG.CUInt instance BG.Prim E13
+
+instance CEnum.CEnum E13 where
+
+  type CEnumZ E13 = BG.CUInt
+
+  toCEnum = E13
+
+  fromCEnum = BG.getField @"unwrapE13"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X13")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E13"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E13"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E13 where
+
+  minDeclaredValue = X13
+
+  maxDeclaredValue = X13
+
+instance Show E13 where
+
+  showsPrec = CEnum.shows
+
+instance Read E13 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE13" E13 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E13 {unwrapE13 = y1}, BG.getField @"unwrapE13" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE13" (BG.Ptr E13) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE13")
+
+instance HasCField.HasCField E13 "unwrapE13" where
+
+  type CFieldType E13 "unwrapE13" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x13@
+
+    __defined at:__ @attributes\/visibility\/types.h 116:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X13 :: E13
+pattern X13 = E13 0
+
+{-| __C declaration:__ @enum E14@
+
+    __defined at:__ @attributes\/visibility\/types.h 117:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E14 = E14
+  { unwrapE14 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E14 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E14 where
+
+  readRaw =
+    \ptr0 ->
+          pure E14
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E14 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E14 unwrapE142 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE142
+
+deriving via Marshal.EquivStorable E14 instance BG.Storable E14
+
+deriving via BG.CUInt instance BG.Prim E14
+
+instance CEnum.CEnum E14 where
+
+  type CEnumZ E14 = BG.CUInt
+
+  toCEnum = E14
+
+  fromCEnum = BG.getField @"unwrapE14"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X14")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E14"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E14"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E14 where
+
+  minDeclaredValue = X14
+
+  maxDeclaredValue = X14
+
+instance Show E14 where
+
+  showsPrec = CEnum.shows
+
+instance Read E14 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE14" E14 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E14 {unwrapE14 = y1}, BG.getField @"unwrapE14" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE14" (BG.Ptr E14) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE14")
+
+instance HasCField.HasCField E14 "unwrapE14" where
+
+  type CFieldType E14 "unwrapE14" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x14@
+
+    __defined at:__ @attributes\/visibility\/types.h 117:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X14 :: E14
+pattern X14 = E14 0
+
+{-| __C declaration:__ @enum E15@
+
+    __defined at:__ @attributes\/visibility\/types.h 126:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E15 = E15
+  { unwrapE15 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E15 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E15 where
+
+  readRaw =
+    \ptr0 ->
+          pure E15
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E15 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E15 unwrapE152 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE152
+
+deriving via Marshal.EquivStorable E15 instance BG.Storable E15
+
+deriving via BG.CUInt instance BG.Prim E15
+
+instance CEnum.CEnum E15 where
+
+  type CEnumZ E15 = BG.CUInt
+
+  toCEnum = E15
+
+  fromCEnum = BG.getField @"unwrapE15"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X15")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E15"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E15"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E15 where
+
+  minDeclaredValue = X15
+
+  maxDeclaredValue = X15
+
+instance Show E15 where
+
+  showsPrec = CEnum.shows
+
+instance Read E15 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE15" E15 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E15 {unwrapE15 = y1}, BG.getField @"unwrapE15" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE15" (BG.Ptr E15) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE15")
+
+instance HasCField.HasCField E15 "unwrapE15" where
+
+  type CFieldType E15 "unwrapE15" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x15@
+
+    __defined at:__ @attributes\/visibility\/types.h 126:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X15 :: E15
+pattern X15 = E15 0
+
+{-| __C declaration:__ @enum E16@
+
+    __defined at:__ @attributes\/visibility\/types.h 127:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E16 = E16
+  { unwrapE16 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E16 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E16 where
+
+  readRaw =
+    \ptr0 ->
+          pure E16
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E16 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E16 unwrapE162 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE162
+
+deriving via Marshal.EquivStorable E16 instance BG.Storable E16
+
+deriving via BG.CUInt instance BG.Prim E16
+
+instance CEnum.CEnum E16 where
+
+  type CEnumZ E16 = BG.CUInt
+
+  toCEnum = E16
+
+  fromCEnum = BG.getField @"unwrapE16"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X16")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E16"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E16"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E16 where
+
+  minDeclaredValue = X16
+
+  maxDeclaredValue = X16
+
+instance Show E16 where
+
+  showsPrec = CEnum.shows
+
+instance Read E16 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE16" E16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E16 {unwrapE16 = y1}, BG.getField @"unwrapE16" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE16" (BG.Ptr E16) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE16")
+
+instance HasCField.HasCField E16 "unwrapE16" where
+
+  type CFieldType E16 "unwrapE16" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x16@
+
+    __defined at:__ @attributes\/visibility\/types.h 127:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X16 :: E16
+pattern X16 = E16 0
+
+{-| __C declaration:__ @enum E17@
+
+    __defined at:__ @attributes\/visibility\/types.h 128:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E17 = E17
+  { unwrapE17 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E17 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E17 where
+
+  readRaw =
+    \ptr0 ->
+          pure E17
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E17 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E17 unwrapE172 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE172
+
+deriving via Marshal.EquivStorable E17 instance BG.Storable E17
+
+deriving via BG.CUInt instance BG.Prim E17
+
+instance CEnum.CEnum E17 where
+
+  type CEnumZ E17 = BG.CUInt
+
+  toCEnum = E17
+
+  fromCEnum = BG.getField @"unwrapE17"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X17")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E17"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E17"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E17 where
+
+  minDeclaredValue = X17
+
+  maxDeclaredValue = X17
+
+instance Show E17 where
+
+  showsPrec = CEnum.shows
+
+instance Read E17 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE17" E17 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E17 {unwrapE17 = y1}, BG.getField @"unwrapE17" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE17" (BG.Ptr E17) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE17")
+
+instance HasCField.HasCField E17 "unwrapE17" where
+
+  type CFieldType E17 "unwrapE17" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x17@
+
+    __defined at:__ @attributes\/visibility\/types.h 128:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X17 :: E17
+pattern X17 = E17 0
+
+{-| __C declaration:__ @enum E18@
+
+    __defined at:__ @attributes\/visibility\/types.h 129:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E18 = E18
+  { unwrapE18 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E18 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E18 where
+
+  readRaw =
+    \ptr0 ->
+          pure E18
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E18 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E18 unwrapE182 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE182
+
+deriving via Marshal.EquivStorable E18 instance BG.Storable E18
+
+deriving via BG.CUInt instance BG.Prim E18
+
+instance CEnum.CEnum E18 where
+
+  type CEnumZ E18 = BG.CUInt
+
+  toCEnum = E18
+
+  fromCEnum = BG.getField @"unwrapE18"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X18")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E18"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E18"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E18 where
+
+  minDeclaredValue = X18
+
+  maxDeclaredValue = X18
+
+instance Show E18 where
+
+  showsPrec = CEnum.shows
+
+instance Read E18 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE18" E18 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E18 {unwrapE18 = y1}, BG.getField @"unwrapE18" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE18" (BG.Ptr E18) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE18")
+
+instance HasCField.HasCField E18 "unwrapE18" where
+
+  type CFieldType E18 "unwrapE18" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x18@
+
+    __defined at:__ @attributes\/visibility\/types.h 129:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X18 :: E18
+pattern X18 = E18 0
+
+{-| __C declaration:__ @enum E19@
+
+    __defined at:__ @attributes\/visibility\/types.h 130:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E19 = E19
+  { unwrapE19 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E19 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E19 where
+
+  readRaw =
+    \ptr0 ->
+          pure E19
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E19 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E19 unwrapE192 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE192
+
+deriving via Marshal.EquivStorable E19 instance BG.Storable E19
+
+deriving via BG.CUInt instance BG.Prim E19
+
+instance CEnum.CEnum E19 where
+
+  type CEnumZ E19 = BG.CUInt
+
+  toCEnum = E19
+
+  fromCEnum = BG.getField @"unwrapE19"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X19")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E19"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E19"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E19 where
+
+  minDeclaredValue = X19
+
+  maxDeclaredValue = X19
+
+instance Show E19 where
+
+  showsPrec = CEnum.shows
+
+instance Read E19 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE19" E19 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         E19 {unwrapE19 = y1}, BG.getField @"unwrapE19" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapE19" (BG.Ptr E19) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE19")
+
+instance HasCField.HasCField E19 "unwrapE19" where
+
+  type CFieldType E19 "unwrapE19" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x19@
+
+    __defined at:__ @attributes\/visibility\/types.h 130:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X19 :: E19
+pattern X19 = E19 0
diff --git a/test-artefacts/fixtures/attributes/visibility/types/bindingspec.yaml b/test-artefacts/fixtures/attributes/visibility/types/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/types/bindingspec.yaml
@@ -0,0 +1,1176 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: attributes/visibility/types.h
+  cname: struct S0
+  hsname: S0
+- headers: attributes/visibility/types.h
+  cname: struct S1
+  hsname: S1
+- headers: attributes/visibility/types.h
+  cname: struct S2
+  hsname: S2
+- headers: attributes/visibility/types.h
+  cname: struct S3
+  hsname: S3
+- headers: attributes/visibility/types.h
+  cname: struct S4
+  hsname: S4
+- headers: attributes/visibility/types.h
+  cname: struct S5
+  hsname: S5
+- headers: attributes/visibility/types.h
+  cname: struct S6
+  hsname: S6
+- headers: attributes/visibility/types.h
+  cname: struct S7
+  hsname: S7
+- headers: attributes/visibility/types.h
+  cname: struct S8
+  hsname: S8
+- headers: attributes/visibility/types.h
+  cname: struct S9
+  hsname: S9
+- headers: attributes/visibility/types.h
+  cname: struct S10
+  hsname: S10
+- headers: attributes/visibility/types.h
+  cname: struct S11
+  hsname: S11
+- headers: attributes/visibility/types.h
+  cname: struct S12
+  hsname: S12
+- headers: attributes/visibility/types.h
+  cname: struct S13
+  hsname: S13
+- headers: attributes/visibility/types.h
+  cname: struct S14
+  hsname: S14
+- headers: attributes/visibility/types.h
+  cname: struct S15
+  hsname: S15
+- headers: attributes/visibility/types.h
+  cname: struct S16
+  hsname: S16
+- headers: attributes/visibility/types.h
+  cname: struct S17
+  hsname: S17
+- headers: attributes/visibility/types.h
+  cname: struct S18
+  hsname: S18
+- headers: attributes/visibility/types.h
+  cname: struct S19
+  hsname: S19
+- headers: attributes/visibility/types.h
+  cname: union U0
+  hsname: U0
+- headers: attributes/visibility/types.h
+  cname: union U1
+  hsname: U1
+- headers: attributes/visibility/types.h
+  cname: union U2
+  hsname: U2
+- headers: attributes/visibility/types.h
+  cname: union U3
+  hsname: U3
+- headers: attributes/visibility/types.h
+  cname: union U4
+  hsname: U4
+- headers: attributes/visibility/types.h
+  cname: union U5
+  hsname: U5
+- headers: attributes/visibility/types.h
+  cname: union U6
+  hsname: U6
+- headers: attributes/visibility/types.h
+  cname: union U7
+  hsname: U7
+- headers: attributes/visibility/types.h
+  cname: union U8
+  hsname: U8
+- headers: attributes/visibility/types.h
+  cname: union U9
+  hsname: U9
+- headers: attributes/visibility/types.h
+  cname: union U10
+  hsname: U10
+- headers: attributes/visibility/types.h
+  cname: union U11
+  hsname: U11
+- headers: attributes/visibility/types.h
+  cname: union U12
+  hsname: U12
+- headers: attributes/visibility/types.h
+  cname: union U13
+  hsname: U13
+- headers: attributes/visibility/types.h
+  cname: union U14
+  hsname: U14
+- headers: attributes/visibility/types.h
+  cname: union U15
+  hsname: U15
+- headers: attributes/visibility/types.h
+  cname: union U16
+  hsname: U16
+- headers: attributes/visibility/types.h
+  cname: union U17
+  hsname: U17
+- headers: attributes/visibility/types.h
+  cname: union U18
+  hsname: U18
+- headers: attributes/visibility/types.h
+  cname: union U19
+  hsname: U19
+- headers: attributes/visibility/types.h
+  cname: enum E0
+  hsname: E0
+- headers: attributes/visibility/types.h
+  cname: enum E1
+  hsname: E1
+- headers: attributes/visibility/types.h
+  cname: enum E2
+  hsname: E2
+- headers: attributes/visibility/types.h
+  cname: enum E3
+  hsname: E3
+- headers: attributes/visibility/types.h
+  cname: enum E4
+  hsname: E4
+- headers: attributes/visibility/types.h
+  cname: enum E5
+  hsname: E5
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E6
+  hsname: E6
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E7
+  hsname: E7
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E8
+  hsname: E8
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E9
+  hsname: E9
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E10
+  hsname: E10
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E11
+  hsname: E11
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E12
+  hsname: E12
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E13
+  hsname: E13
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E14
+  hsname: E14
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E15
+  hsname: E15
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E16
+  hsname: E16
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E17
+  hsname: E17
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E18
+  hsname: E18
+  enum: open
+- headers: attributes/visibility/types.h
+  cname: enum E19
+  hsname: E19
+  enum: open
+hstypes:
+- hsname: E0
+  representation: emptydata
+- hsname: E1
+  representation: emptydata
+- hsname: E10
+  representation:
+    newtype:
+      constructor: E10
+      fields:
+      - unwrapE10
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E11
+  representation:
+    newtype:
+      constructor: E11
+      fields:
+      - unwrapE11
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E12
+  representation:
+    newtype:
+      constructor: E12
+      fields:
+      - unwrapE12
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E13
+  representation:
+    newtype:
+      constructor: E13
+      fields:
+      - unwrapE13
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E14
+  representation:
+    newtype:
+      constructor: E14
+      fields:
+      - unwrapE14
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E15
+  representation:
+    newtype:
+      constructor: E15
+      fields:
+      - unwrapE15
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E16
+  representation:
+    newtype:
+      constructor: E16
+      fields:
+      - unwrapE16
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E17
+  representation:
+    newtype:
+      constructor: E17
+      fields:
+      - unwrapE17
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E18
+  representation:
+    newtype:
+      constructor: E18
+      fields:
+      - unwrapE18
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E19
+  representation:
+    newtype:
+      constructor: E19
+      fields:
+      - unwrapE19
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E2
+  representation: emptydata
+- hsname: E3
+  representation: emptydata
+- hsname: E4
+  representation: emptydata
+- hsname: E5
+  representation:
+    newtype:
+      constructor: E5
+      fields:
+      - unwrapE5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E6
+  representation:
+    newtype:
+      constructor: E6
+      fields:
+      - unwrapE6
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E7
+  representation:
+    newtype:
+      constructor: E7
+      fields:
+      - unwrapE7
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E8
+  representation:
+    newtype:
+      constructor: E8
+      fields:
+      - unwrapE8
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E9
+  representation:
+    newtype:
+      constructor: E9
+      fields:
+      - unwrapE9
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S0
+  representation: emptydata
+- hsname: S1
+  representation: emptydata
+- hsname: S10
+  representation:
+    record:
+      constructor: S10
+      fields:
+      - s10_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S11
+  representation:
+    record:
+      constructor: S11
+      fields:
+      - s11_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S12
+  representation:
+    record:
+      constructor: S12
+      fields:
+      - s12_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S13
+  representation:
+    record:
+      constructor: S13
+      fields:
+      - s13_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S14
+  representation:
+    record:
+      constructor: S14
+      fields:
+      - s14_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S15
+  representation:
+    record:
+      constructor: S15
+      fields:
+      - s15_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S16
+  representation:
+    record:
+      constructor: S16
+      fields:
+      - s16_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S17
+  representation:
+    record:
+      constructor: S17
+      fields:
+      - s17_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S18
+  representation:
+    record:
+      constructor: S18
+      fields:
+      - s18_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S19
+  representation:
+    record:
+      constructor: S19
+      fields:
+      - s19_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2
+  representation: emptydata
+- hsname: S3
+  representation: emptydata
+- hsname: S4
+  representation: emptydata
+- hsname: S5
+  representation:
+    record:
+      constructor: S5
+      fields:
+      - s5_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S6
+  representation:
+    record:
+      constructor: S6
+      fields:
+      - s6_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7
+  representation:
+    record:
+      constructor: S7
+      fields:
+      - s7_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S8
+  representation:
+    record:
+      constructor: S8
+      fields:
+      - s8_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S9
+  representation:
+    record:
+      constructor: S9
+      fields:
+      - s9_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U0
+  representation: emptydata
+- hsname: U1
+  representation: emptydata
+- hsname: U10
+  representation:
+    newtype:
+      constructor: U10
+      fields:
+      - unwrapU10
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U11
+  representation:
+    newtype:
+      constructor: U11
+      fields:
+      - unwrapU11
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U12
+  representation:
+    newtype:
+      constructor: U12
+      fields:
+      - unwrapU12
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U13
+  representation:
+    newtype:
+      constructor: U13
+      fields:
+      - unwrapU13
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U14
+  representation:
+    newtype:
+      constructor: U14
+      fields:
+      - unwrapU14
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U15
+  representation:
+    newtype:
+      constructor: U15
+      fields:
+      - unwrapU15
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U16
+  representation:
+    newtype:
+      constructor: U16
+      fields:
+      - unwrapU16
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U17
+  representation:
+    newtype:
+      constructor: U17
+      fields:
+      - unwrapU17
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U18
+  representation:
+    newtype:
+      constructor: U18
+      fields:
+      - unwrapU18
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U19
+  representation:
+    newtype:
+      constructor: U19
+      fields:
+      - unwrapU19
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U2
+  representation: emptydata
+- hsname: U3
+  representation: emptydata
+- hsname: U4
+  representation: emptydata
+- hsname: U5
+  representation:
+    newtype:
+      constructor: U5
+      fields:
+      - unwrapU5
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U6
+  representation:
+    newtype:
+      constructor: U6
+      fields:
+      - unwrapU6
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U7
+  representation:
+    newtype:
+      constructor: U7
+      fields:
+      - unwrapU7
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U8
+  representation:
+    newtype:
+      constructor: U8
+      fields:
+      - unwrapU8
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U9
+  representation:
+    newtype:
+      constructor: U9
+      fields:
+      - unwrapU9
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/attributes/visibility/types/th.txt b/test-artefacts/fixtures/attributes/visibility/types/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/types/th.txt
@@ -0,0 +1,1751 @@
+-- addDependentFile test-artefacts/headers/golden/attributes/visibility/types.h
+{-| __C declaration:__ @struct S0@
+
+    __defined at:__ @attributes\/visibility\/types.h 13:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S0
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @attributes\/visibility\/types.h 14:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S1
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @attributes\/visibility\/types.h 15:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S2
+{-| __C declaration:__ @struct S3@
+
+    __defined at:__ @attributes\/visibility\/types.h 16:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S3
+{-| __C declaration:__ @struct S4@
+
+    __defined at:__ @attributes\/visibility\/types.h 17:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S4
+{-| __C declaration:__ @struct S5@
+
+    __defined at:__ @attributes\/visibility\/types.h 20:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S5
+    = S5 {s5_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @attributes\/visibility\/types.h 20:60@
+
+               __exported by:__ @attributes\/visibility\/types.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S5
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S5
+    where readRaw = \ptr_0 -> pure S5 <*> readRaw (Proxy @"s5_x") ptr_0
+instance WriteRaw S5
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S5 s5_x_2 -> writeRaw (Proxy @"s5_x") ptr_0 s5_x_2
+deriving via (EquivStorable S5) instance Storable S5
+deriving via (IsStructViaReadRaw S5) instance IsStruct S5
+instance (~) ty CInt => HasField "s5_x" S5 ty
+    where hasField = \x_0 -> (\y_1 -> S5{s5_x = y_1},
+                              getField @"s5_x" x_0)
+instance (~) ty CInt => HasField "s5_x" (Ptr S5) (Ptr ty)
+    where getField = fromPtr (Proxy @"s5_x")
+instance HasCField S5 "s5_x"
+    where type CFieldType S5 "s5_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S6@
+
+    __defined at:__ @attributes\/visibility\/types.h 21:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S6
+    = S6 {s6_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @attributes\/visibility\/types.h 21:60@
+
+               __exported by:__ @attributes\/visibility\/types.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S6
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S6
+    where readRaw = \ptr_0 -> pure S6 <*> readRaw (Proxy @"s6_x") ptr_0
+instance WriteRaw S6
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S6 s6_x_2 -> writeRaw (Proxy @"s6_x") ptr_0 s6_x_2
+deriving via (EquivStorable S6) instance Storable S6
+deriving via (IsStructViaReadRaw S6) instance IsStruct S6
+instance (~) ty CInt => HasField "s6_x" S6 ty
+    where hasField = \x_0 -> (\y_1 -> S6{s6_x = y_1},
+                              getField @"s6_x" x_0)
+instance (~) ty CInt => HasField "s6_x" (Ptr S6) (Ptr ty)
+    where getField = fromPtr (Proxy @"s6_x")
+instance HasCField S6 "s6_x"
+    where type CFieldType S6 "s6_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S7@
+
+    __defined at:__ @attributes\/visibility\/types.h 22:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S7
+    = S7 {s7_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @attributes\/visibility\/types.h 22:60@
+
+               __exported by:__ @attributes\/visibility\/types.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S7
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S7
+    where readRaw = \ptr_0 -> pure S7 <*> readRaw (Proxy @"s7_x") ptr_0
+instance WriteRaw S7
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S7 s7_x_2 -> writeRaw (Proxy @"s7_x") ptr_0 s7_x_2
+deriving via (EquivStorable S7) instance Storable S7
+deriving via (IsStructViaReadRaw S7) instance IsStruct S7
+instance (~) ty CInt => HasField "s7_x" S7 ty
+    where hasField = \x_0 -> (\y_1 -> S7{s7_x = y_1},
+                              getField @"s7_x" x_0)
+instance (~) ty CInt => HasField "s7_x" (Ptr S7) (Ptr ty)
+    where getField = fromPtr (Proxy @"s7_x")
+instance HasCField S7 "s7_x"
+    where type CFieldType S7 "s7_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S8@
+
+    __defined at:__ @attributes\/visibility\/types.h 23:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S8
+    = S8 {s8_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @attributes\/visibility\/types.h 23:60@
+
+               __exported by:__ @attributes\/visibility\/types.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S8
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S8
+    where readRaw = \ptr_0 -> pure S8 <*> readRaw (Proxy @"s8_x") ptr_0
+instance WriteRaw S8
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S8 s8_x_2 -> writeRaw (Proxy @"s8_x") ptr_0 s8_x_2
+deriving via (EquivStorable S8) instance Storable S8
+deriving via (IsStructViaReadRaw S8) instance IsStruct S8
+instance (~) ty CInt => HasField "s8_x" S8 ty
+    where hasField = \x_0 -> (\y_1 -> S8{s8_x = y_1},
+                              getField @"s8_x" x_0)
+instance (~) ty CInt => HasField "s8_x" (Ptr S8) (Ptr ty)
+    where getField = fromPtr (Proxy @"s8_x")
+instance HasCField S8 "s8_x"
+    where type CFieldType S8 "s8_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S9@
+
+    __defined at:__ @attributes\/visibility\/types.h 24:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S9
+    = S9 {s9_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @attributes\/visibility\/types.h 24:60@
+
+               __exported by:__ @attributes\/visibility\/types.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S9
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S9
+    where readRaw = \ptr_0 -> pure S9 <*> readRaw (Proxy @"s9_x") ptr_0
+instance WriteRaw S9
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S9 s9_x_2 -> writeRaw (Proxy @"s9_x") ptr_0 s9_x_2
+deriving via (EquivStorable S9) instance Storable S9
+deriving via (IsStructViaReadRaw S9) instance IsStruct S9
+instance (~) ty CInt => HasField "s9_x" S9 ty
+    where hasField = \x_0 -> (\y_1 -> S9{s9_x = y_1},
+                              getField @"s9_x" x_0)
+instance (~) ty CInt => HasField "s9_x" (Ptr S9) (Ptr ty)
+    where getField = fromPtr (Proxy @"s9_x")
+instance HasCField S9 "s9_x"
+    where type CFieldType S9 "s9_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S10@
+
+    __defined at:__ @attributes\/visibility\/types.h 33:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S10
+    = S10 {s10_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 33:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S10
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S10
+    where readRaw = \ptr_0 -> pure S10 <*> readRaw (Proxy @"s10_x") ptr_0
+instance WriteRaw S10
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S10 s10_x_2 -> writeRaw (Proxy @"s10_x") ptr_0 s10_x_2
+deriving via (EquivStorable S10) instance Storable S10
+deriving via (IsStructViaReadRaw S10) instance IsStruct S10
+instance (~) ty CInt => HasField "s10_x" S10 ty
+    where hasField = \x_0 -> (\y_1 -> S10{s10_x = y_1},
+                              getField @"s10_x" x_0)
+instance (~) ty CInt => HasField "s10_x" (Ptr S10) (Ptr ty)
+    where getField = fromPtr (Proxy @"s10_x")
+instance HasCField S10 "s10_x"
+    where type CFieldType S10 "s10_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S11@
+
+    __defined at:__ @attributes\/visibility\/types.h 34:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S11
+    = S11 {s11_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 34:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S11
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S11
+    where readRaw = \ptr_0 -> pure S11 <*> readRaw (Proxy @"s11_x") ptr_0
+instance WriteRaw S11
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S11 s11_x_2 -> writeRaw (Proxy @"s11_x") ptr_0 s11_x_2
+deriving via (EquivStorable S11) instance Storable S11
+deriving via (IsStructViaReadRaw S11) instance IsStruct S11
+instance (~) ty CInt => HasField "s11_x" S11 ty
+    where hasField = \x_0 -> (\y_1 -> S11{s11_x = y_1},
+                              getField @"s11_x" x_0)
+instance (~) ty CInt => HasField "s11_x" (Ptr S11) (Ptr ty)
+    where getField = fromPtr (Proxy @"s11_x")
+instance HasCField S11 "s11_x"
+    where type CFieldType S11 "s11_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S12@
+
+    __defined at:__ @attributes\/visibility\/types.h 35:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S12
+    = S12 {s12_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 35:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S12
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S12
+    where readRaw = \ptr_0 -> pure S12 <*> readRaw (Proxy @"s12_x") ptr_0
+instance WriteRaw S12
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S12 s12_x_2 -> writeRaw (Proxy @"s12_x") ptr_0 s12_x_2
+deriving via (EquivStorable S12) instance Storable S12
+deriving via (IsStructViaReadRaw S12) instance IsStruct S12
+instance (~) ty CInt => HasField "s12_x" S12 ty
+    where hasField = \x_0 -> (\y_1 -> S12{s12_x = y_1},
+                              getField @"s12_x" x_0)
+instance (~) ty CInt => HasField "s12_x" (Ptr S12) (Ptr ty)
+    where getField = fromPtr (Proxy @"s12_x")
+instance HasCField S12 "s12_x"
+    where type CFieldType S12 "s12_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S13@
+
+    __defined at:__ @attributes\/visibility\/types.h 36:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S13
+    = S13 {s13_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 36:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S13
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S13
+    where readRaw = \ptr_0 -> pure S13 <*> readRaw (Proxy @"s13_x") ptr_0
+instance WriteRaw S13
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S13 s13_x_2 -> writeRaw (Proxy @"s13_x") ptr_0 s13_x_2
+deriving via (EquivStorable S13) instance Storable S13
+deriving via (IsStructViaReadRaw S13) instance IsStruct S13
+instance (~) ty CInt => HasField "s13_x" S13 ty
+    where hasField = \x_0 -> (\y_1 -> S13{s13_x = y_1},
+                              getField @"s13_x" x_0)
+instance (~) ty CInt => HasField "s13_x" (Ptr S13) (Ptr ty)
+    where getField = fromPtr (Proxy @"s13_x")
+instance HasCField S13 "s13_x"
+    where type CFieldType S13 "s13_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S14@
+
+    __defined at:__ @attributes\/visibility\/types.h 37:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S14
+    = S14 {s14_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 37:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S14
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S14
+    where readRaw = \ptr_0 -> pure S14 <*> readRaw (Proxy @"s14_x") ptr_0
+instance WriteRaw S14
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S14 s14_x_2 -> writeRaw (Proxy @"s14_x") ptr_0 s14_x_2
+deriving via (EquivStorable S14) instance Storable S14
+deriving via (IsStructViaReadRaw S14) instance IsStruct S14
+instance (~) ty CInt => HasField "s14_x" S14 ty
+    where hasField = \x_0 -> (\y_1 -> S14{s14_x = y_1},
+                              getField @"s14_x" x_0)
+instance (~) ty CInt => HasField "s14_x" (Ptr S14) (Ptr ty)
+    where getField = fromPtr (Proxy @"s14_x")
+instance HasCField S14 "s14_x"
+    where type CFieldType S14 "s14_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S15@
+
+    __defined at:__ @attributes\/visibility\/types.h 46:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S15
+    = S15 {s15_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 46:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S15
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S15
+    where readRaw = \ptr_0 -> pure S15 <*> readRaw (Proxy @"s15_x") ptr_0
+instance WriteRaw S15
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S15 s15_x_2 -> writeRaw (Proxy @"s15_x") ptr_0 s15_x_2
+deriving via (EquivStorable S15) instance Storable S15
+deriving via (IsStructViaReadRaw S15) instance IsStruct S15
+instance (~) ty CInt => HasField "s15_x" S15 ty
+    where hasField = \x_0 -> (\y_1 -> S15{s15_x = y_1},
+                              getField @"s15_x" x_0)
+instance (~) ty CInt => HasField "s15_x" (Ptr S15) (Ptr ty)
+    where getField = fromPtr (Proxy @"s15_x")
+instance HasCField S15 "s15_x"
+    where type CFieldType S15 "s15_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S16@
+
+    __defined at:__ @attributes\/visibility\/types.h 47:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S16
+    = S16 {s16_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 47:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S16
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S16
+    where readRaw = \ptr_0 -> pure S16 <*> readRaw (Proxy @"s16_x") ptr_0
+instance WriteRaw S16
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S16 s16_x_2 -> writeRaw (Proxy @"s16_x") ptr_0 s16_x_2
+deriving via (EquivStorable S16) instance Storable S16
+deriving via (IsStructViaReadRaw S16) instance IsStruct S16
+instance (~) ty CInt => HasField "s16_x" S16 ty
+    where hasField = \x_0 -> (\y_1 -> S16{s16_x = y_1},
+                              getField @"s16_x" x_0)
+instance (~) ty CInt => HasField "s16_x" (Ptr S16) (Ptr ty)
+    where getField = fromPtr (Proxy @"s16_x")
+instance HasCField S16 "s16_x"
+    where type CFieldType S16 "s16_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S17@
+
+    __defined at:__ @attributes\/visibility\/types.h 48:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S17
+    = S17 {s17_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 48:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S17
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S17
+    where readRaw = \ptr_0 -> pure S17 <*> readRaw (Proxy @"s17_x") ptr_0
+instance WriteRaw S17
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S17 s17_x_2 -> writeRaw (Proxy @"s17_x") ptr_0 s17_x_2
+deriving via (EquivStorable S17) instance Storable S17
+deriving via (IsStructViaReadRaw S17) instance IsStruct S17
+instance (~) ty CInt => HasField "s17_x" S17 ty
+    where hasField = \x_0 -> (\y_1 -> S17{s17_x = y_1},
+                              getField @"s17_x" x_0)
+instance (~) ty CInt => HasField "s17_x" (Ptr S17) (Ptr ty)
+    where getField = fromPtr (Proxy @"s17_x")
+instance HasCField S17 "s17_x"
+    where type CFieldType S17 "s17_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S18@
+
+    __defined at:__ @attributes\/visibility\/types.h 49:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S18
+    = S18 {s18_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 49:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S18
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S18
+    where readRaw = \ptr_0 -> pure S18 <*> readRaw (Proxy @"s18_x") ptr_0
+instance WriteRaw S18
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S18 s18_x_2 -> writeRaw (Proxy @"s18_x") ptr_0 s18_x_2
+deriving via (EquivStorable S18) instance Storable S18
+deriving via (IsStructViaReadRaw S18) instance IsStruct S18
+instance (~) ty CInt => HasField "s18_x" S18 ty
+    where hasField = \x_0 -> (\y_1 -> S18{s18_x = y_1},
+                              getField @"s18_x" x_0)
+instance (~) ty CInt => HasField "s18_x" (Ptr S18) (Ptr ty)
+    where getField = fromPtr (Proxy @"s18_x")
+instance HasCField S18 "s18_x"
+    where type CFieldType S18 "s18_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S19@
+
+    __defined at:__ @attributes\/visibility\/types.h 50:51@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data S19
+    = S19 {s19_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @attributes\/visibility\/types.h 50:61@
+
+                __exported by:__ @attributes\/visibility\/types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S19
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S19
+    where readRaw = \ptr_0 -> pure S19 <*> readRaw (Proxy @"s19_x") ptr_0
+instance WriteRaw S19
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S19 s19_x_2 -> writeRaw (Proxy @"s19_x") ptr_0 s19_x_2
+deriving via (EquivStorable S19) instance Storable S19
+deriving via (IsStructViaReadRaw S19) instance IsStruct S19
+instance (~) ty CInt => HasField "s19_x" S19 ty
+    where hasField = \x_0 -> (\y_1 -> S19{s19_x = y_1},
+                              getField @"s19_x" x_0)
+instance (~) ty CInt => HasField "s19_x" (Ptr S19) (Ptr ty)
+    where getField = fromPtr (Proxy @"s19_x")
+instance HasCField S19 "s19_x"
+    where type CFieldType S19 "s19_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U0@
+
+    __defined at:__ @attributes\/visibility\/types.h 53:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U0
+{-| __C declaration:__ @union U1@
+
+    __defined at:__ @attributes\/visibility\/types.h 54:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U1
+{-| __C declaration:__ @union U2@
+
+    __defined at:__ @attributes\/visibility\/types.h 55:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U2
+{-| __C declaration:__ @union U3@
+
+    __defined at:__ @attributes\/visibility\/types.h 56:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U3
+{-| __C declaration:__ @union U4@
+
+    __defined at:__ @attributes\/visibility\/types.h 57:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data U4
+{-| __C declaration:__ @union U5@
+
+    __defined at:__ @attributes\/visibility\/types.h 60:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U5 = U5 {unwrapU5 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U5
+deriving via (SizedByteArray 4 4) instance ReadRaw U5
+deriving via (SizedByteArray 4 4) instance WriteRaw U5
+deriving via (EquivStorable U5) instance Storable U5
+deriving via (SizedByteArray 4 4) instance IsUnion U5
+instance (~) ty CInt => HasField "u5_x" U5 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u5_x" U5 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u5_x" x_0)
+instance (~) ty CInt => HasField "u5_x" (Ptr U5) (Ptr ty)
+    where getField = fromPtr (Proxy @"u5_x")
+instance HasCField U5 "u5_x"
+    where type CFieldType U5 "u5_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U6@
+
+    __defined at:__ @attributes\/visibility\/types.h 61:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U6 = U6 {unwrapU6 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U6
+deriving via (SizedByteArray 4 4) instance ReadRaw U6
+deriving via (SizedByteArray 4 4) instance WriteRaw U6
+deriving via (EquivStorable U6) instance Storable U6
+deriving via (SizedByteArray 4 4) instance IsUnion U6
+instance (~) ty CInt => HasField "u6_x" U6 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u6_x" U6 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u6_x" x_0)
+instance (~) ty CInt => HasField "u6_x" (Ptr U6) (Ptr ty)
+    where getField = fromPtr (Proxy @"u6_x")
+instance HasCField U6 "u6_x"
+    where type CFieldType U6 "u6_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U7@
+
+    __defined at:__ @attributes\/visibility\/types.h 62:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U7 = U7 {unwrapU7 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U7
+deriving via (SizedByteArray 4 4) instance ReadRaw U7
+deriving via (SizedByteArray 4 4) instance WriteRaw U7
+deriving via (EquivStorable U7) instance Storable U7
+deriving via (SizedByteArray 4 4) instance IsUnion U7
+instance (~) ty CInt => HasField "u7_x" U7 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u7_x" U7 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u7_x" x_0)
+instance (~) ty CInt => HasField "u7_x" (Ptr U7) (Ptr ty)
+    where getField = fromPtr (Proxy @"u7_x")
+instance HasCField U7 "u7_x"
+    where type CFieldType U7 "u7_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U8@
+
+    __defined at:__ @attributes\/visibility\/types.h 63:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U8 = U8 {unwrapU8 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U8
+deriving via (SizedByteArray 4 4) instance ReadRaw U8
+deriving via (SizedByteArray 4 4) instance WriteRaw U8
+deriving via (EquivStorable U8) instance Storable U8
+deriving via (SizedByteArray 4 4) instance IsUnion U8
+instance (~) ty CInt => HasField "u8_x" U8 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u8_x" U8 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u8_x" x_0)
+instance (~) ty CInt => HasField "u8_x" (Ptr U8) (Ptr ty)
+    where getField = fromPtr (Proxy @"u8_x")
+instance HasCField U8 "u8_x"
+    where type CFieldType U8 "u8_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U9@
+
+    __defined at:__ @attributes\/visibility\/types.h 64:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U9 = U9 {unwrapU9 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U9
+deriving via (SizedByteArray 4 4) instance ReadRaw U9
+deriving via (SizedByteArray 4 4) instance WriteRaw U9
+deriving via (EquivStorable U9) instance Storable U9
+deriving via (SizedByteArray 4 4) instance IsUnion U9
+instance (~) ty CInt => HasField "u9_x" U9 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u9_x" U9 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u9_x" x_0)
+instance (~) ty CInt => HasField "u9_x" (Ptr U9) (Ptr ty)
+    where getField = fromPtr (Proxy @"u9_x")
+instance HasCField U9 "u9_x"
+    where type CFieldType U9 "u9_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U10@
+
+    __defined at:__ @attributes\/visibility\/types.h 73:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U10 = U10 {unwrapU10 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U10
+deriving via (SizedByteArray 4 4) instance ReadRaw U10
+deriving via (SizedByteArray 4 4) instance WriteRaw U10
+deriving via (EquivStorable U10) instance Storable U10
+deriving via (SizedByteArray 4 4) instance IsUnion U10
+instance (~) ty CInt => HasField "u10_x" U10 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u10_x" U10 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u10_x" x_0)
+instance (~) ty CInt => HasField "u10_x" (Ptr U10) (Ptr ty)
+    where getField = fromPtr (Proxy @"u10_x")
+instance HasCField U10 "u10_x"
+    where type CFieldType U10 "u10_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U11@
+
+    __defined at:__ @attributes\/visibility\/types.h 74:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U11 = U11 {unwrapU11 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U11
+deriving via (SizedByteArray 4 4) instance ReadRaw U11
+deriving via (SizedByteArray 4 4) instance WriteRaw U11
+deriving via (EquivStorable U11) instance Storable U11
+deriving via (SizedByteArray 4 4) instance IsUnion U11
+instance (~) ty CInt => HasField "u11_x" U11 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u11_x" U11 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u11_x" x_0)
+instance (~) ty CInt => HasField "u11_x" (Ptr U11) (Ptr ty)
+    where getField = fromPtr (Proxy @"u11_x")
+instance HasCField U11 "u11_x"
+    where type CFieldType U11 "u11_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U12@
+
+    __defined at:__ @attributes\/visibility\/types.h 75:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U12 = U12 {unwrapU12 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U12
+deriving via (SizedByteArray 4 4) instance ReadRaw U12
+deriving via (SizedByteArray 4 4) instance WriteRaw U12
+deriving via (EquivStorable U12) instance Storable U12
+deriving via (SizedByteArray 4 4) instance IsUnion U12
+instance (~) ty CInt => HasField "u12_x" U12 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u12_x" U12 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u12_x" x_0)
+instance (~) ty CInt => HasField "u12_x" (Ptr U12) (Ptr ty)
+    where getField = fromPtr (Proxy @"u12_x")
+instance HasCField U12 "u12_x"
+    where type CFieldType U12 "u12_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U13@
+
+    __defined at:__ @attributes\/visibility\/types.h 76:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U13 = U13 {unwrapU13 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U13
+deriving via (SizedByteArray 4 4) instance ReadRaw U13
+deriving via (SizedByteArray 4 4) instance WriteRaw U13
+deriving via (EquivStorable U13) instance Storable U13
+deriving via (SizedByteArray 4 4) instance IsUnion U13
+instance (~) ty CInt => HasField "u13_x" U13 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u13_x" U13 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u13_x" x_0)
+instance (~) ty CInt => HasField "u13_x" (Ptr U13) (Ptr ty)
+    where getField = fromPtr (Proxy @"u13_x")
+instance HasCField U13 "u13_x"
+    where type CFieldType U13 "u13_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U14@
+
+    __defined at:__ @attributes\/visibility\/types.h 77:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U14 = U14 {unwrapU14 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U14
+deriving via (SizedByteArray 4 4) instance ReadRaw U14
+deriving via (SizedByteArray 4 4) instance WriteRaw U14
+deriving via (EquivStorable U14) instance Storable U14
+deriving via (SizedByteArray 4 4) instance IsUnion U14
+instance (~) ty CInt => HasField "u14_x" U14 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u14_x" U14 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u14_x" x_0)
+instance (~) ty CInt => HasField "u14_x" (Ptr U14) (Ptr ty)
+    where getField = fromPtr (Proxy @"u14_x")
+instance HasCField U14 "u14_x"
+    where type CFieldType U14 "u14_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U15@
+
+    __defined at:__ @attributes\/visibility\/types.h 86:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U15 = U15 {unwrapU15 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U15
+deriving via (SizedByteArray 4 4) instance ReadRaw U15
+deriving via (SizedByteArray 4 4) instance WriteRaw U15
+deriving via (EquivStorable U15) instance Storable U15
+deriving via (SizedByteArray 4 4) instance IsUnion U15
+instance (~) ty CInt => HasField "u15_x" U15 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u15_x" U15 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u15_x" x_0)
+instance (~) ty CInt => HasField "u15_x" (Ptr U15) (Ptr ty)
+    where getField = fromPtr (Proxy @"u15_x")
+instance HasCField U15 "u15_x"
+    where type CFieldType U15 "u15_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U16@
+
+    __defined at:__ @attributes\/visibility\/types.h 87:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U16 = U16 {unwrapU16 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U16
+deriving via (SizedByteArray 4 4) instance ReadRaw U16
+deriving via (SizedByteArray 4 4) instance WriteRaw U16
+deriving via (EquivStorable U16) instance Storable U16
+deriving via (SizedByteArray 4 4) instance IsUnion U16
+instance (~) ty CInt => HasField "u16_x" U16 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u16_x" U16 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u16_x" x_0)
+instance (~) ty CInt => HasField "u16_x" (Ptr U16) (Ptr ty)
+    where getField = fromPtr (Proxy @"u16_x")
+instance HasCField U16 "u16_x"
+    where type CFieldType U16 "u16_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U17@
+
+    __defined at:__ @attributes\/visibility\/types.h 88:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U17 = U17 {unwrapU17 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U17
+deriving via (SizedByteArray 4 4) instance ReadRaw U17
+deriving via (SizedByteArray 4 4) instance WriteRaw U17
+deriving via (EquivStorable U17) instance Storable U17
+deriving via (SizedByteArray 4 4) instance IsUnion U17
+instance (~) ty CInt => HasField "u17_x" U17 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u17_x" U17 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u17_x" x_0)
+instance (~) ty CInt => HasField "u17_x" (Ptr U17) (Ptr ty)
+    where getField = fromPtr (Proxy @"u17_x")
+instance HasCField U17 "u17_x"
+    where type CFieldType U17 "u17_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U18@
+
+    __defined at:__ @attributes\/visibility\/types.h 89:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U18 = U18 {unwrapU18 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U18
+deriving via (SizedByteArray 4 4) instance ReadRaw U18
+deriving via (SizedByteArray 4 4) instance WriteRaw U18
+deriving via (EquivStorable U18) instance Storable U18
+deriving via (SizedByteArray 4 4) instance IsUnion U18
+instance (~) ty CInt => HasField "u18_x" U18 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u18_x" U18 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u18_x" x_0)
+instance (~) ty CInt => HasField "u18_x" (Ptr U18) (Ptr ty)
+    where getField = fromPtr (Proxy @"u18_x")
+instance HasCField U18 "u18_x"
+    where type CFieldType U18 "u18_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U19@
+
+    __defined at:__ @attributes\/visibility\/types.h 90:50@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype U19 = U19 {unwrapU19 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize U19
+deriving via (SizedByteArray 4 4) instance ReadRaw U19
+deriving via (SizedByteArray 4 4) instance WriteRaw U19
+deriving via (EquivStorable U19) instance Storable U19
+deriving via (SizedByteArray 4 4) instance IsUnion U19
+instance (~) ty CInt => HasField "u19_x" U19 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "u19_x" U19 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u19_x" x_0)
+instance (~) ty CInt => HasField "u19_x" (Ptr U19) (Ptr ty)
+    where getField = fromPtr (Proxy @"u19_x")
+instance HasCField U19 "u19_x"
+    where type CFieldType U19 "u19_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @enum E0@
+
+    __defined at:__ @attributes\/visibility\/types.h 93:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E0
+{-| __C declaration:__ @enum E1@
+
+    __defined at:__ @attributes\/visibility\/types.h 94:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E1
+{-| __C declaration:__ @enum E2@
+
+    __defined at:__ @attributes\/visibility\/types.h 95:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E2
+{-| __C declaration:__ @enum E3@
+
+    __defined at:__ @attributes\/visibility\/types.h 96:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E3
+{-| __C declaration:__ @enum E4@
+
+    __defined at:__ @attributes\/visibility\/types.h 97:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+data E4
+{-| __C declaration:__ @enum E5@
+
+    __defined at:__ @attributes\/visibility\/types.h 100:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E5
+    = E5 {unwrapE5 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E5
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E5
+    where readRaw = \ptr_0 -> pure E5 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E5
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E5 unwrapE5_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE5_2
+deriving via (EquivStorable E5) instance Storable E5
+deriving via CUInt instance Prim E5
+instance CEnum E5
+    where type CEnumZ E5 = CUInt
+          toCEnum = E5
+          fromCEnum = getField @"unwrapE5"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "X5")]
+          showsUndeclared = showsWrappedUndeclared "E5"
+          readPrecUndeclared = readPrecWrappedUndeclared "E5"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E5
+    where minDeclaredValue = X5
+          maxDeclaredValue = X5
+instance Show E5
+    where showsPrec = shows
+instance Read E5
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE5" E5 ty
+    where hasField = \x_0 -> (\y_1 -> E5{unwrapE5 = y_1},
+                              getField @"unwrapE5" x_0)
+instance (~) ty CUInt => HasField "unwrapE5" (Ptr E5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE5")
+instance HasCField E5 "unwrapE5"
+    where type CFieldType E5 "unwrapE5" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x5@
+
+    __defined at:__ @attributes\/visibility\/types.h 100:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X5 :: E5
+pattern X5 = E5 0
+{-| __C declaration:__ @enum E6@
+
+    __defined at:__ @attributes\/visibility\/types.h 101:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E6
+    = E6 {unwrapE6 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E6
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E6
+    where readRaw = \ptr_0 -> pure E6 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E6
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E6 unwrapE6_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE6_2
+deriving via (EquivStorable E6) instance Storable E6
+deriving via CUInt instance Prim E6
+instance CEnum E6
+    where type CEnumZ E6 = CUInt
+          toCEnum = E6
+          fromCEnum = getField @"unwrapE6"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "X6")]
+          showsUndeclared = showsWrappedUndeclared "E6"
+          readPrecUndeclared = readPrecWrappedUndeclared "E6"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E6
+    where minDeclaredValue = X6
+          maxDeclaredValue = X6
+instance Show E6
+    where showsPrec = shows
+instance Read E6
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE6" E6 ty
+    where hasField = \x_0 -> (\y_1 -> E6{unwrapE6 = y_1},
+                              getField @"unwrapE6" x_0)
+instance (~) ty CUInt => HasField "unwrapE6" (Ptr E6) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE6")
+instance HasCField E6 "unwrapE6"
+    where type CFieldType E6 "unwrapE6" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x6@
+
+    __defined at:__ @attributes\/visibility\/types.h 101:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X6 :: E6
+pattern X6 = E6 0
+{-| __C declaration:__ @enum E7@
+
+    __defined at:__ @attributes\/visibility\/types.h 102:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E7
+    = E7 {unwrapE7 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E7
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E7
+    where readRaw = \ptr_0 -> pure E7 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E7
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E7 unwrapE7_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE7_2
+deriving via (EquivStorable E7) instance Storable E7
+deriving via CUInt instance Prim E7
+instance CEnum E7
+    where type CEnumZ E7 = CUInt
+          toCEnum = E7
+          fromCEnum = getField @"unwrapE7"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "X7")]
+          showsUndeclared = showsWrappedUndeclared "E7"
+          readPrecUndeclared = readPrecWrappedUndeclared "E7"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E7
+    where minDeclaredValue = X7
+          maxDeclaredValue = X7
+instance Show E7
+    where showsPrec = shows
+instance Read E7
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE7" E7 ty
+    where hasField = \x_0 -> (\y_1 -> E7{unwrapE7 = y_1},
+                              getField @"unwrapE7" x_0)
+instance (~) ty CUInt => HasField "unwrapE7" (Ptr E7) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE7")
+instance HasCField E7 "unwrapE7"
+    where type CFieldType E7 "unwrapE7" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x7@
+
+    __defined at:__ @attributes\/visibility\/types.h 102:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X7 :: E7
+pattern X7 = E7 0
+{-| __C declaration:__ @enum E8@
+
+    __defined at:__ @attributes\/visibility\/types.h 103:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E8
+    = E8 {unwrapE8 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E8
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E8
+    where readRaw = \ptr_0 -> pure E8 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E8
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E8 unwrapE8_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE8_2
+deriving via (EquivStorable E8) instance Storable E8
+deriving via CUInt instance Prim E8
+instance CEnum E8
+    where type CEnumZ E8 = CUInt
+          toCEnum = E8
+          fromCEnum = getField @"unwrapE8"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "X8")]
+          showsUndeclared = showsWrappedUndeclared "E8"
+          readPrecUndeclared = readPrecWrappedUndeclared "E8"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E8
+    where minDeclaredValue = X8
+          maxDeclaredValue = X8
+instance Show E8
+    where showsPrec = shows
+instance Read E8
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE8" E8 ty
+    where hasField = \x_0 -> (\y_1 -> E8{unwrapE8 = y_1},
+                              getField @"unwrapE8" x_0)
+instance (~) ty CUInt => HasField "unwrapE8" (Ptr E8) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE8")
+instance HasCField E8 "unwrapE8"
+    where type CFieldType E8 "unwrapE8" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x8@
+
+    __defined at:__ @attributes\/visibility\/types.h 103:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X8 :: E8
+pattern X8 = E8 0
+{-| __C declaration:__ @enum E9@
+
+    __defined at:__ @attributes\/visibility\/types.h 104:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E9
+    = E9 {unwrapE9 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E9
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E9
+    where readRaw = \ptr_0 -> pure E9 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E9
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E9 unwrapE9_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE9_2
+deriving via (EquivStorable E9) instance Storable E9
+deriving via CUInt instance Prim E9
+instance CEnum E9
+    where type CEnumZ E9 = CUInt
+          toCEnum = E9
+          fromCEnum = getField @"unwrapE9"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "X9")]
+          showsUndeclared = showsWrappedUndeclared "E9"
+          readPrecUndeclared = readPrecWrappedUndeclared "E9"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E9
+    where minDeclaredValue = X9
+          maxDeclaredValue = X9
+instance Show E9
+    where showsPrec = shows
+instance Read E9
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE9" E9 ty
+    where hasField = \x_0 -> (\y_1 -> E9{unwrapE9 = y_1},
+                              getField @"unwrapE9" x_0)
+instance (~) ty CUInt => HasField "unwrapE9" (Ptr E9) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE9")
+instance HasCField E9 "unwrapE9"
+    where type CFieldType E9 "unwrapE9" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x9@
+
+    __defined at:__ @attributes\/visibility\/types.h 104:54@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X9 :: E9
+pattern X9 = E9 0
+{-| __C declaration:__ @enum E10@
+
+    __defined at:__ @attributes\/visibility\/types.h 113:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E10
+    = E10 {unwrapE10 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E10
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E10
+    where readRaw = \ptr_0 -> pure E10 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E10
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E10 unwrapE10_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE10_2
+deriving via (EquivStorable E10) instance Storable E10
+deriving via CUInt instance Prim E10
+instance CEnum E10
+    where type CEnumZ E10 = CUInt
+          toCEnum = E10
+          fromCEnum = getField @"unwrapE10"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X10")]
+          showsUndeclared = showsWrappedUndeclared "E10"
+          readPrecUndeclared = readPrecWrappedUndeclared "E10"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E10
+    where minDeclaredValue = X10
+          maxDeclaredValue = X10
+instance Show E10
+    where showsPrec = shows
+instance Read E10
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE10" E10 ty
+    where hasField = \x_0 -> (\y_1 -> E10{unwrapE10 = y_1},
+                              getField @"unwrapE10" x_0)
+instance (~) ty CUInt => HasField "unwrapE10" (Ptr E10) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE10")
+instance HasCField E10 "unwrapE10"
+    where type CFieldType E10 "unwrapE10" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x10@
+
+    __defined at:__ @attributes\/visibility\/types.h 113:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X10 :: E10
+pattern X10 = E10 0
+{-| __C declaration:__ @enum E11@
+
+    __defined at:__ @attributes\/visibility\/types.h 114:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E11
+    = E11 {unwrapE11 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E11
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E11
+    where readRaw = \ptr_0 -> pure E11 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E11
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E11 unwrapE11_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE11_2
+deriving via (EquivStorable E11) instance Storable E11
+deriving via CUInt instance Prim E11
+instance CEnum E11
+    where type CEnumZ E11 = CUInt
+          toCEnum = E11
+          fromCEnum = getField @"unwrapE11"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X11")]
+          showsUndeclared = showsWrappedUndeclared "E11"
+          readPrecUndeclared = readPrecWrappedUndeclared "E11"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E11
+    where minDeclaredValue = X11
+          maxDeclaredValue = X11
+instance Show E11
+    where showsPrec = shows
+instance Read E11
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE11" E11 ty
+    where hasField = \x_0 -> (\y_1 -> E11{unwrapE11 = y_1},
+                              getField @"unwrapE11" x_0)
+instance (~) ty CUInt => HasField "unwrapE11" (Ptr E11) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE11")
+instance HasCField E11 "unwrapE11"
+    where type CFieldType E11 "unwrapE11" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x11@
+
+    __defined at:__ @attributes\/visibility\/types.h 114:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X11 :: E11
+pattern X11 = E11 0
+{-| __C declaration:__ @enum E12@
+
+    __defined at:__ @attributes\/visibility\/types.h 115:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E12
+    = E12 {unwrapE12 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E12
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E12
+    where readRaw = \ptr_0 -> pure E12 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E12
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E12 unwrapE12_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE12_2
+deriving via (EquivStorable E12) instance Storable E12
+deriving via CUInt instance Prim E12
+instance CEnum E12
+    where type CEnumZ E12 = CUInt
+          toCEnum = E12
+          fromCEnum = getField @"unwrapE12"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X12")]
+          showsUndeclared = showsWrappedUndeclared "E12"
+          readPrecUndeclared = readPrecWrappedUndeclared "E12"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E12
+    where minDeclaredValue = X12
+          maxDeclaredValue = X12
+instance Show E12
+    where showsPrec = shows
+instance Read E12
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE12" E12 ty
+    where hasField = \x_0 -> (\y_1 -> E12{unwrapE12 = y_1},
+                              getField @"unwrapE12" x_0)
+instance (~) ty CUInt => HasField "unwrapE12" (Ptr E12) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE12")
+instance HasCField E12 "unwrapE12"
+    where type CFieldType E12 "unwrapE12" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x12@
+
+    __defined at:__ @attributes\/visibility\/types.h 115:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X12 :: E12
+pattern X12 = E12 0
+{-| __C declaration:__ @enum E13@
+
+    __defined at:__ @attributes\/visibility\/types.h 116:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E13
+    = E13 {unwrapE13 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E13
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E13
+    where readRaw = \ptr_0 -> pure E13 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E13
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E13 unwrapE13_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE13_2
+deriving via (EquivStorable E13) instance Storable E13
+deriving via CUInt instance Prim E13
+instance CEnum E13
+    where type CEnumZ E13 = CUInt
+          toCEnum = E13
+          fromCEnum = getField @"unwrapE13"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X13")]
+          showsUndeclared = showsWrappedUndeclared "E13"
+          readPrecUndeclared = readPrecWrappedUndeclared "E13"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E13
+    where minDeclaredValue = X13
+          maxDeclaredValue = X13
+instance Show E13
+    where showsPrec = shows
+instance Read E13
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE13" E13 ty
+    where hasField = \x_0 -> (\y_1 -> E13{unwrapE13 = y_1},
+                              getField @"unwrapE13" x_0)
+instance (~) ty CUInt => HasField "unwrapE13" (Ptr E13) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE13")
+instance HasCField E13 "unwrapE13"
+    where type CFieldType E13 "unwrapE13" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x13@
+
+    __defined at:__ @attributes\/visibility\/types.h 116:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X13 :: E13
+pattern X13 = E13 0
+{-| __C declaration:__ @enum E14@
+
+    __defined at:__ @attributes\/visibility\/types.h 117:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E14
+    = E14 {unwrapE14 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E14
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E14
+    where readRaw = \ptr_0 -> pure E14 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E14
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E14 unwrapE14_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE14_2
+deriving via (EquivStorable E14) instance Storable E14
+deriving via CUInt instance Prim E14
+instance CEnum E14
+    where type CEnumZ E14 = CUInt
+          toCEnum = E14
+          fromCEnum = getField @"unwrapE14"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X14")]
+          showsUndeclared = showsWrappedUndeclared "E14"
+          readPrecUndeclared = readPrecWrappedUndeclared "E14"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E14
+    where minDeclaredValue = X14
+          maxDeclaredValue = X14
+instance Show E14
+    where showsPrec = shows
+instance Read E14
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE14" E14 ty
+    where hasField = \x_0 -> (\y_1 -> E14{unwrapE14 = y_1},
+                              getField @"unwrapE14" x_0)
+instance (~) ty CUInt => HasField "unwrapE14" (Ptr E14) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE14")
+instance HasCField E14 "unwrapE14"
+    where type CFieldType E14 "unwrapE14" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x14@
+
+    __defined at:__ @attributes\/visibility\/types.h 117:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X14 :: E14
+pattern X14 = E14 0
+{-| __C declaration:__ @enum E15@
+
+    __defined at:__ @attributes\/visibility\/types.h 126:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E15
+    = E15 {unwrapE15 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E15
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E15
+    where readRaw = \ptr_0 -> pure E15 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E15
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E15 unwrapE15_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE15_2
+deriving via (EquivStorable E15) instance Storable E15
+deriving via CUInt instance Prim E15
+instance CEnum E15
+    where type CEnumZ E15 = CUInt
+          toCEnum = E15
+          fromCEnum = getField @"unwrapE15"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X15")]
+          showsUndeclared = showsWrappedUndeclared "E15"
+          readPrecUndeclared = readPrecWrappedUndeclared "E15"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E15
+    where minDeclaredValue = X15
+          maxDeclaredValue = X15
+instance Show E15
+    where showsPrec = shows
+instance Read E15
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE15" E15 ty
+    where hasField = \x_0 -> (\y_1 -> E15{unwrapE15 = y_1},
+                              getField @"unwrapE15" x_0)
+instance (~) ty CUInt => HasField "unwrapE15" (Ptr E15) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE15")
+instance HasCField E15 "unwrapE15"
+    where type CFieldType E15 "unwrapE15" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x15@
+
+    __defined at:__ @attributes\/visibility\/types.h 126:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X15 :: E15
+pattern X15 = E15 0
+{-| __C declaration:__ @enum E16@
+
+    __defined at:__ @attributes\/visibility\/types.h 127:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E16
+    = E16 {unwrapE16 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E16
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E16
+    where readRaw = \ptr_0 -> pure E16 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E16
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E16 unwrapE16_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE16_2
+deriving via (EquivStorable E16) instance Storable E16
+deriving via CUInt instance Prim E16
+instance CEnum E16
+    where type CEnumZ E16 = CUInt
+          toCEnum = E16
+          fromCEnum = getField @"unwrapE16"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X16")]
+          showsUndeclared = showsWrappedUndeclared "E16"
+          readPrecUndeclared = readPrecWrappedUndeclared "E16"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E16
+    where minDeclaredValue = X16
+          maxDeclaredValue = X16
+instance Show E16
+    where showsPrec = shows
+instance Read E16
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE16" E16 ty
+    where hasField = \x_0 -> (\y_1 -> E16{unwrapE16 = y_1},
+                              getField @"unwrapE16" x_0)
+instance (~) ty CUInt => HasField "unwrapE16" (Ptr E16) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE16")
+instance HasCField E16 "unwrapE16"
+    where type CFieldType E16 "unwrapE16" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x16@
+
+    __defined at:__ @attributes\/visibility\/types.h 127:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X16 :: E16
+pattern X16 = E16 0
+{-| __C declaration:__ @enum E17@
+
+    __defined at:__ @attributes\/visibility\/types.h 128:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E17
+    = E17 {unwrapE17 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E17
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E17
+    where readRaw = \ptr_0 -> pure E17 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E17
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E17 unwrapE17_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE17_2
+deriving via (EquivStorable E17) instance Storable E17
+deriving via CUInt instance Prim E17
+instance CEnum E17
+    where type CEnumZ E17 = CUInt
+          toCEnum = E17
+          fromCEnum = getField @"unwrapE17"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X17")]
+          showsUndeclared = showsWrappedUndeclared "E17"
+          readPrecUndeclared = readPrecWrappedUndeclared "E17"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E17
+    where minDeclaredValue = X17
+          maxDeclaredValue = X17
+instance Show E17
+    where showsPrec = shows
+instance Read E17
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE17" E17 ty
+    where hasField = \x_0 -> (\y_1 -> E17{unwrapE17 = y_1},
+                              getField @"unwrapE17" x_0)
+instance (~) ty CUInt => HasField "unwrapE17" (Ptr E17) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE17")
+instance HasCField E17 "unwrapE17"
+    where type CFieldType E17 "unwrapE17" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x17@
+
+    __defined at:__ @attributes\/visibility\/types.h 128:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X17 :: E17
+pattern X17 = E17 0
+{-| __C declaration:__ @enum E18@
+
+    __defined at:__ @attributes\/visibility\/types.h 129:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E18
+    = E18 {unwrapE18 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E18
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E18
+    where readRaw = \ptr_0 -> pure E18 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E18
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E18 unwrapE18_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE18_2
+deriving via (EquivStorable E18) instance Storable E18
+deriving via CUInt instance Prim E18
+instance CEnum E18
+    where type CEnumZ E18 = CUInt
+          toCEnum = E18
+          fromCEnum = getField @"unwrapE18"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X18")]
+          showsUndeclared = showsWrappedUndeclared "E18"
+          readPrecUndeclared = readPrecWrappedUndeclared "E18"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E18
+    where minDeclaredValue = X18
+          maxDeclaredValue = X18
+instance Show E18
+    where showsPrec = shows
+instance Read E18
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE18" E18 ty
+    where hasField = \x_0 -> (\y_1 -> E18{unwrapE18 = y_1},
+                              getField @"unwrapE18" x_0)
+instance (~) ty CUInt => HasField "unwrapE18" (Ptr E18) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE18")
+instance HasCField E18 "unwrapE18"
+    where type CFieldType E18 "unwrapE18" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x18@
+
+    __defined at:__ @attributes\/visibility\/types.h 129:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X18 :: E18
+pattern X18 = E18 0
+{-| __C declaration:__ @enum E19@
+
+    __defined at:__ @attributes\/visibility\/types.h 130:49@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+newtype E19
+    = E19 {unwrapE19 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E19
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E19
+    where readRaw = \ptr_0 -> pure E19 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E19
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E19 unwrapE19_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE19_2
+deriving via (EquivStorable E19) instance Storable E19
+deriving via CUInt instance Prim E19
+instance CEnum E19
+    where type CEnumZ E19 = CUInt
+          toCEnum = E19
+          fromCEnum = getField @"unwrapE19"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "X19")]
+          showsUndeclared = showsWrappedUndeclared "E19"
+          readPrecUndeclared = readPrecWrappedUndeclared "E19"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E19
+    where minDeclaredValue = X19
+          maxDeclaredValue = X19
+instance Show E19
+    where showsPrec = shows
+instance Read E19
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE19" E19 ty
+    where hasField = \x_0 -> (\y_1 -> E19{unwrapE19 = y_1},
+                              getField @"unwrapE19" x_0)
+instance (~) ty CUInt => HasField "unwrapE19" (Ptr E19) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE19")
+instance HasCField E19 "unwrapE19"
+    where type CFieldType E19 "unwrapE19" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x19@
+
+    __defined at:__ @attributes\/visibility\/types.h 130:55@
+
+    __exported by:__ @attributes\/visibility\/types.h@
+-}
+pattern X19 :: E19
+pattern X19 = E19 0
diff --git a/test-artefacts/fixtures/attributes/visibility/variables/Example/Global.hs b/test-artefacts/fixtures/attributes/visibility/variables/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/variables/Example/Global.hs
@@ -0,0 +1,796 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.i0
+    , Example.Global.i1
+    , Example.Global.i2
+    , Example.Global.i3
+    , Example.Global.i4
+    , Example.Global.i5
+    , Example.Global.i6
+    , Example.Global.i7
+    , Example.Global.i8
+    , Example.Global.i9
+    , Example.Global.i10
+    , Example.Global.i11
+    , Example.Global.i12
+    , Example.Global.i13
+    , Example.Global.i14
+    , Example.Global.i15
+    , Example.Global.i16
+    , Example.Global.i17
+    , Example.Global.i18
+    , Example.Global.i19
+    , Example.Global.i20
+    , Example.Global.i21
+    , Example.Global.i22
+    , Example.Global.i23
+    , Example.Global.i24
+    , Example.Global.i25
+    , Example.Global.i26
+    , Example.Global.i27
+    , Example.Global.i28
+    , Example.Global.i29
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <attributes/visibility/variables.h>"
+  , "/* test_attributesvisibilityvariable_Example_get_i0 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_39a034063990df12 (void)"
+  , "{"
+  , "  return &i0;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i1 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_083fddca08b7aced (void)"
+  , "{"
+  , "  return &i1;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i2 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_a76894155b8a6ec7 (void)"
+  , "{"
+  , "  return &i2;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i3 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_ec3a25d8132ea504 (void)"
+  , "{"
+  , "  return &i3;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i4 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_45d491ce87ed46d0 (void)"
+  , "{"
+  , "  return &i4;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i5 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_fe19c8a8ebc1d947 (void)"
+  , "{"
+  , "  return &i5;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i6 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_c1a332634f600e94 (void)"
+  , "{"
+  , "  return &i6;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i7 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_c9bd5e0c60ff8f87 (void)"
+  , "{"
+  , "  return &i7;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i8 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_94e7124f7562b1d3 (void)"
+  , "{"
+  , "  return &i8;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i9 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_ec473304783162de (void)"
+  , "{"
+  , "  return &i9;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i10 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_8756e67db8a0a542 (void)"
+  , "{"
+  , "  return &i10;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i11 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_0106cc7a5825bf8b (void)"
+  , "{"
+  , "  return &i11;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i12 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_296af89863107edf (void)"
+  , "{"
+  , "  return &i12;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i13 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_ddfe303b28effdbb (void)"
+  , "{"
+  , "  return &i13;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i14 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_b3911569cdb1adcc (void)"
+  , "{"
+  , "  return &i14;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i15 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_94b1cd9806ce5bcc (void)"
+  , "{"
+  , "  return &i15;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i16 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_e667df4994fab2af (void)"
+  , "{"
+  , "  return &i16;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i17 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_656c7420378b3f41 (void)"
+  , "{"
+  , "  return &i17;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i18 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_d60425923e1c6414 (void)"
+  , "{"
+  , "  return &i18;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i19 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_cb11e511be0cfc50 (void)"
+  , "{"
+  , "  return &i19;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i20 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_8720bde7cc30b171 (void)"
+  , "{"
+  , "  return &i20;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i21 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_b71914b49e6bc6d8 (void)"
+  , "{"
+  , "  return &i21;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i22 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_22b6f19b3356e742 (void)"
+  , "{"
+  , "  return &i22;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i23 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_4432bdff99ca3ab2 (void)"
+  , "{"
+  , "  return &i23;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i24 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_80552dd326e314dd (void)"
+  , "{"
+  , "  return &i24;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i25 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_e782a3b4c5c62b6d (void)"
+  , "{"
+  , "  return &i25;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i26 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_9888ce2162201152 (void)"
+  , "{"
+  , "  return &i26;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i27 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_985cecf4c0c11aee (void)"
+  , "{"
+  , "  return &i27;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i28 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_b02407ada9cb4466 (void)"
+  , "{"
+  , "  return &i28;"
+  , "}"
+  , "/* test_attributesvisibilityvariable_Example_get_i29 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_dc2295e107352a77 (void)"
+  , "{"
+  , "  return &i29;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i0@
+foreign import ccall unsafe "hs_bindgen_39a034063990df12" hs_bindgen_39a034063990df12_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i0@
+hs_bindgen_39a034063990df12 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_39a034063990df12 =
+  fmap BG.fromFFIType hs_bindgen_39a034063990df12_base
+
+{-# NOINLINE i0 #-}
+{-| __C declaration:__ @i0@
+
+    __defined at:__ @attributes\/visibility\/variables.h 14:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i0 :: BG.Ptr BG.CInt
+i0 = BG.unsafePerformIO hs_bindgen_39a034063990df12
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i1@
+foreign import ccall unsafe "hs_bindgen_083fddca08b7aced" hs_bindgen_083fddca08b7aced_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i1@
+hs_bindgen_083fddca08b7aced :: IO (BG.Ptr BG.CInt)
+hs_bindgen_083fddca08b7aced =
+  fmap BG.fromFFIType hs_bindgen_083fddca08b7aced_base
+
+{-# NOINLINE i1 #-}
+{-| __C declaration:__ @i1@
+
+    __defined at:__ @attributes\/visibility\/variables.h 15:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i1 :: BG.Ptr BG.CInt
+i1 = BG.unsafePerformIO hs_bindgen_083fddca08b7aced
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i2@
+foreign import ccall unsafe "hs_bindgen_a76894155b8a6ec7" hs_bindgen_a76894155b8a6ec7_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i2@
+hs_bindgen_a76894155b8a6ec7 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_a76894155b8a6ec7 =
+  fmap BG.fromFFIType hs_bindgen_a76894155b8a6ec7_base
+
+{-# NOINLINE i2 #-}
+{-| __C declaration:__ @i2@
+
+    __defined at:__ @attributes\/visibility\/variables.h 16:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i2 :: BG.Ptr BG.CInt
+i2 = BG.unsafePerformIO hs_bindgen_a76894155b8a6ec7
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i3@
+foreign import ccall unsafe "hs_bindgen_ec3a25d8132ea504" hs_bindgen_ec3a25d8132ea504_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i3@
+hs_bindgen_ec3a25d8132ea504 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_ec3a25d8132ea504 =
+  fmap BG.fromFFIType hs_bindgen_ec3a25d8132ea504_base
+
+{-# NOINLINE i3 #-}
+{-| __C declaration:__ @i3@
+
+    __defined at:__ @attributes\/visibility\/variables.h 17:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i3 :: BG.Ptr BG.CInt
+i3 = BG.unsafePerformIO hs_bindgen_ec3a25d8132ea504
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i4@
+foreign import ccall unsafe "hs_bindgen_45d491ce87ed46d0" hs_bindgen_45d491ce87ed46d0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i4@
+hs_bindgen_45d491ce87ed46d0 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_45d491ce87ed46d0 =
+  fmap BG.fromFFIType hs_bindgen_45d491ce87ed46d0_base
+
+{-# NOINLINE i4 #-}
+{-| __C declaration:__ @i4@
+
+    __defined at:__ @attributes\/visibility\/variables.h 18:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i4 :: BG.Ptr BG.CInt
+i4 = BG.unsafePerformIO hs_bindgen_45d491ce87ed46d0
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i5@
+foreign import ccall unsafe "hs_bindgen_fe19c8a8ebc1d947" hs_bindgen_fe19c8a8ebc1d947_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i5@
+hs_bindgen_fe19c8a8ebc1d947 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_fe19c8a8ebc1d947 =
+  fmap BG.fromFFIType hs_bindgen_fe19c8a8ebc1d947_base
+
+{-# NOINLINE i5 #-}
+{-| __C declaration:__ @i5@
+
+    __defined at:__ @attributes\/visibility\/variables.h 21:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i5 :: BG.Ptr BG.CInt
+i5 = BG.unsafePerformIO hs_bindgen_fe19c8a8ebc1d947
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i6@
+foreign import ccall unsafe "hs_bindgen_c1a332634f600e94" hs_bindgen_c1a332634f600e94_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i6@
+hs_bindgen_c1a332634f600e94 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_c1a332634f600e94 =
+  fmap BG.fromFFIType hs_bindgen_c1a332634f600e94_base
+
+{-# NOINLINE i6 #-}
+{-| __C declaration:__ @i6@
+
+    __defined at:__ @attributes\/visibility\/variables.h 22:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i6 :: BG.Ptr BG.CInt
+i6 = BG.unsafePerformIO hs_bindgen_c1a332634f600e94
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i7@
+foreign import ccall unsafe "hs_bindgen_c9bd5e0c60ff8f87" hs_bindgen_c9bd5e0c60ff8f87_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i7@
+hs_bindgen_c9bd5e0c60ff8f87 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_c9bd5e0c60ff8f87 =
+  fmap BG.fromFFIType hs_bindgen_c9bd5e0c60ff8f87_base
+
+{-# NOINLINE i7 #-}
+{-| __C declaration:__ @i7@
+
+    __defined at:__ @attributes\/visibility\/variables.h 23:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i7 :: BG.Ptr BG.CInt
+i7 = BG.unsafePerformIO hs_bindgen_c9bd5e0c60ff8f87
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i8@
+foreign import ccall unsafe "hs_bindgen_94e7124f7562b1d3" hs_bindgen_94e7124f7562b1d3_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i8@
+hs_bindgen_94e7124f7562b1d3 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_94e7124f7562b1d3 =
+  fmap BG.fromFFIType hs_bindgen_94e7124f7562b1d3_base
+
+{-# NOINLINE i8 #-}
+{-| __C declaration:__ @i8@
+
+    __defined at:__ @attributes\/visibility\/variables.h 24:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i8 :: BG.Ptr BG.CInt
+i8 = BG.unsafePerformIO hs_bindgen_94e7124f7562b1d3
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i9@
+foreign import ccall unsafe "hs_bindgen_ec473304783162de" hs_bindgen_ec473304783162de_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i9@
+hs_bindgen_ec473304783162de :: IO (BG.Ptr BG.CInt)
+hs_bindgen_ec473304783162de =
+  fmap BG.fromFFIType hs_bindgen_ec473304783162de_base
+
+{-# NOINLINE i9 #-}
+{-| __C declaration:__ @i9@
+
+    __defined at:__ @attributes\/visibility\/variables.h 25:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i9 :: BG.Ptr BG.CInt
+i9 = BG.unsafePerformIO hs_bindgen_ec473304783162de
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i10@
+foreign import ccall unsafe "hs_bindgen_8756e67db8a0a542" hs_bindgen_8756e67db8a0a542_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i10@
+hs_bindgen_8756e67db8a0a542 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_8756e67db8a0a542 =
+  fmap BG.fromFFIType hs_bindgen_8756e67db8a0a542_base
+
+{-# NOINLINE i10 #-}
+{-| __C declaration:__ @i10@
+
+    __defined at:__ @attributes\/visibility\/variables.h 28:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i10 :: BG.Ptr BG.CInt
+i10 = BG.unsafePerformIO hs_bindgen_8756e67db8a0a542
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i11@
+foreign import ccall unsafe "hs_bindgen_0106cc7a5825bf8b" hs_bindgen_0106cc7a5825bf8b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i11@
+hs_bindgen_0106cc7a5825bf8b :: IO (BG.Ptr BG.CInt)
+hs_bindgen_0106cc7a5825bf8b =
+  fmap BG.fromFFIType hs_bindgen_0106cc7a5825bf8b_base
+
+{-# NOINLINE i11 #-}
+{-| __C declaration:__ @i11@
+
+    __defined at:__ @attributes\/visibility\/variables.h 29:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i11 :: BG.Ptr BG.CInt
+i11 = BG.unsafePerformIO hs_bindgen_0106cc7a5825bf8b
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i12@
+foreign import ccall unsafe "hs_bindgen_296af89863107edf" hs_bindgen_296af89863107edf_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i12@
+hs_bindgen_296af89863107edf :: IO (BG.Ptr BG.CInt)
+hs_bindgen_296af89863107edf =
+  fmap BG.fromFFIType hs_bindgen_296af89863107edf_base
+
+{-# NOINLINE i12 #-}
+{-| __C declaration:__ @i12@
+
+    __defined at:__ @attributes\/visibility\/variables.h 30:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i12 :: BG.Ptr BG.CInt
+i12 = BG.unsafePerformIO hs_bindgen_296af89863107edf
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i13@
+foreign import ccall unsafe "hs_bindgen_ddfe303b28effdbb" hs_bindgen_ddfe303b28effdbb_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i13@
+hs_bindgen_ddfe303b28effdbb :: IO (BG.Ptr BG.CInt)
+hs_bindgen_ddfe303b28effdbb =
+  fmap BG.fromFFIType hs_bindgen_ddfe303b28effdbb_base
+
+{-# NOINLINE i13 #-}
+{-| __C declaration:__ @i13@
+
+    __defined at:__ @attributes\/visibility\/variables.h 31:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i13 :: BG.Ptr BG.CInt
+i13 = BG.unsafePerformIO hs_bindgen_ddfe303b28effdbb
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i14@
+foreign import ccall unsafe "hs_bindgen_b3911569cdb1adcc" hs_bindgen_b3911569cdb1adcc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i14@
+hs_bindgen_b3911569cdb1adcc :: IO (BG.Ptr BG.CInt)
+hs_bindgen_b3911569cdb1adcc =
+  fmap BG.fromFFIType hs_bindgen_b3911569cdb1adcc_base
+
+{-# NOINLINE i14 #-}
+{-| __C declaration:__ @i14@
+
+    __defined at:__ @attributes\/visibility\/variables.h 32:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i14 :: BG.Ptr BG.CInt
+i14 = BG.unsafePerformIO hs_bindgen_b3911569cdb1adcc
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i15@
+foreign import ccall unsafe "hs_bindgen_94b1cd9806ce5bcc" hs_bindgen_94b1cd9806ce5bcc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i15@
+hs_bindgen_94b1cd9806ce5bcc :: IO (BG.Ptr BG.CInt)
+hs_bindgen_94b1cd9806ce5bcc =
+  fmap BG.fromFFIType hs_bindgen_94b1cd9806ce5bcc_base
+
+{-# NOINLINE i15 #-}
+{-| __C declaration:__ @i15@
+
+    __defined at:__ @attributes\/visibility\/variables.h 35:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i15 :: BG.Ptr BG.CInt
+i15 = BG.unsafePerformIO hs_bindgen_94b1cd9806ce5bcc
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i16@
+foreign import ccall unsafe "hs_bindgen_e667df4994fab2af" hs_bindgen_e667df4994fab2af_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i16@
+hs_bindgen_e667df4994fab2af :: IO (BG.Ptr BG.CInt)
+hs_bindgen_e667df4994fab2af =
+  fmap BG.fromFFIType hs_bindgen_e667df4994fab2af_base
+
+{-# NOINLINE i16 #-}
+{-| __C declaration:__ @i16@
+
+    __defined at:__ @attributes\/visibility\/variables.h 36:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i16 :: BG.Ptr BG.CInt
+i16 = BG.unsafePerformIO hs_bindgen_e667df4994fab2af
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i17@
+foreign import ccall unsafe "hs_bindgen_656c7420378b3f41" hs_bindgen_656c7420378b3f41_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i17@
+hs_bindgen_656c7420378b3f41 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_656c7420378b3f41 =
+  fmap BG.fromFFIType hs_bindgen_656c7420378b3f41_base
+
+{-# NOINLINE i17 #-}
+{-| __C declaration:__ @i17@
+
+    __defined at:__ @attributes\/visibility\/variables.h 37:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i17 :: BG.Ptr BG.CInt
+i17 = BG.unsafePerformIO hs_bindgen_656c7420378b3f41
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i18@
+foreign import ccall unsafe "hs_bindgen_d60425923e1c6414" hs_bindgen_d60425923e1c6414_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i18@
+hs_bindgen_d60425923e1c6414 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_d60425923e1c6414 =
+  fmap BG.fromFFIType hs_bindgen_d60425923e1c6414_base
+
+{-# NOINLINE i18 #-}
+{-| __C declaration:__ @i18@
+
+    __defined at:__ @attributes\/visibility\/variables.h 38:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i18 :: BG.Ptr BG.CInt
+i18 = BG.unsafePerformIO hs_bindgen_d60425923e1c6414
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i19@
+foreign import ccall unsafe "hs_bindgen_cb11e511be0cfc50" hs_bindgen_cb11e511be0cfc50_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i19@
+hs_bindgen_cb11e511be0cfc50 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_cb11e511be0cfc50 =
+  fmap BG.fromFFIType hs_bindgen_cb11e511be0cfc50_base
+
+{-# NOINLINE i19 #-}
+{-| __C declaration:__ @i19@
+
+    __defined at:__ @attributes\/visibility\/variables.h 39:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i19 :: BG.Ptr BG.CInt
+i19 = BG.unsafePerformIO hs_bindgen_cb11e511be0cfc50
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i20@
+foreign import ccall unsafe "hs_bindgen_8720bde7cc30b171" hs_bindgen_8720bde7cc30b171_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i20@
+hs_bindgen_8720bde7cc30b171 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_8720bde7cc30b171 =
+  fmap BG.fromFFIType hs_bindgen_8720bde7cc30b171_base
+
+{-# NOINLINE i20 #-}
+{-| __C declaration:__ @i20@
+
+    __defined at:__ @attributes\/visibility\/variables.h 42:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i20 :: BG.Ptr BG.CInt
+i20 = BG.unsafePerformIO hs_bindgen_8720bde7cc30b171
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i21@
+foreign import ccall unsafe "hs_bindgen_b71914b49e6bc6d8" hs_bindgen_b71914b49e6bc6d8_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i21@
+hs_bindgen_b71914b49e6bc6d8 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_b71914b49e6bc6d8 =
+  fmap BG.fromFFIType hs_bindgen_b71914b49e6bc6d8_base
+
+{-# NOINLINE i21 #-}
+{-| __C declaration:__ @i21@
+
+    __defined at:__ @attributes\/visibility\/variables.h 43:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i21 :: BG.Ptr BG.CInt
+i21 = BG.unsafePerformIO hs_bindgen_b71914b49e6bc6d8
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i22@
+foreign import ccall unsafe "hs_bindgen_22b6f19b3356e742" hs_bindgen_22b6f19b3356e742_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i22@
+hs_bindgen_22b6f19b3356e742 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_22b6f19b3356e742 =
+  fmap BG.fromFFIType hs_bindgen_22b6f19b3356e742_base
+
+{-# NOINLINE i22 #-}
+{-| __C declaration:__ @i22@
+
+    __defined at:__ @attributes\/visibility\/variables.h 44:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i22 :: BG.Ptr BG.CInt
+i22 = BG.unsafePerformIO hs_bindgen_22b6f19b3356e742
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i23@
+foreign import ccall unsafe "hs_bindgen_4432bdff99ca3ab2" hs_bindgen_4432bdff99ca3ab2_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i23@
+hs_bindgen_4432bdff99ca3ab2 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_4432bdff99ca3ab2 =
+  fmap BG.fromFFIType hs_bindgen_4432bdff99ca3ab2_base
+
+{-# NOINLINE i23 #-}
+{-| __C declaration:__ @i23@
+
+    __defined at:__ @attributes\/visibility\/variables.h 45:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i23 :: BG.Ptr BG.CInt
+i23 = BG.unsafePerformIO hs_bindgen_4432bdff99ca3ab2
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i24@
+foreign import ccall unsafe "hs_bindgen_80552dd326e314dd" hs_bindgen_80552dd326e314dd_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i24@
+hs_bindgen_80552dd326e314dd :: IO (BG.Ptr BG.CInt)
+hs_bindgen_80552dd326e314dd =
+  fmap BG.fromFFIType hs_bindgen_80552dd326e314dd_base
+
+{-# NOINLINE i24 #-}
+{-| __C declaration:__ @i24@
+
+    __defined at:__ @attributes\/visibility\/variables.h 46:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i24 :: BG.Ptr BG.CInt
+i24 = BG.unsafePerformIO hs_bindgen_80552dd326e314dd
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i25@
+foreign import ccall unsafe "hs_bindgen_e782a3b4c5c62b6d" hs_bindgen_e782a3b4c5c62b6d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i25@
+hs_bindgen_e782a3b4c5c62b6d :: IO (BG.Ptr BG.CInt)
+hs_bindgen_e782a3b4c5c62b6d =
+  fmap BG.fromFFIType hs_bindgen_e782a3b4c5c62b6d_base
+
+{-# NOINLINE i25 #-}
+{-| __C declaration:__ @i25@
+
+    __defined at:__ @attributes\/visibility\/variables.h 49:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i25 :: BG.Ptr BG.CInt
+i25 = BG.unsafePerformIO hs_bindgen_e782a3b4c5c62b6d
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i26@
+foreign import ccall unsafe "hs_bindgen_9888ce2162201152" hs_bindgen_9888ce2162201152_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i26@
+hs_bindgen_9888ce2162201152 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_9888ce2162201152 =
+  fmap BG.fromFFIType hs_bindgen_9888ce2162201152_base
+
+{-# NOINLINE i26 #-}
+{-| __C declaration:__ @i26@
+
+    __defined at:__ @attributes\/visibility\/variables.h 50:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i26 :: BG.Ptr BG.CInt
+i26 = BG.unsafePerformIO hs_bindgen_9888ce2162201152
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i27@
+foreign import ccall unsafe "hs_bindgen_985cecf4c0c11aee" hs_bindgen_985cecf4c0c11aee_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i27@
+hs_bindgen_985cecf4c0c11aee :: IO (BG.Ptr BG.CInt)
+hs_bindgen_985cecf4c0c11aee =
+  fmap BG.fromFFIType hs_bindgen_985cecf4c0c11aee_base
+
+{-# NOINLINE i27 #-}
+{-| __C declaration:__ @i27@
+
+    __defined at:__ @attributes\/visibility\/variables.h 51:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i27 :: BG.Ptr BG.CInt
+i27 = BG.unsafePerformIO hs_bindgen_985cecf4c0c11aee
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i28@
+foreign import ccall unsafe "hs_bindgen_b02407ada9cb4466" hs_bindgen_b02407ada9cb4466_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i28@
+hs_bindgen_b02407ada9cb4466 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_b02407ada9cb4466 =
+  fmap BG.fromFFIType hs_bindgen_b02407ada9cb4466_base
+
+{-# NOINLINE i28 #-}
+{-| __C declaration:__ @i28@
+
+    __defined at:__ @attributes\/visibility\/variables.h 52:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i28 :: BG.Ptr BG.CInt
+i28 = BG.unsafePerformIO hs_bindgen_b02407ada9cb4466
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i29@
+foreign import ccall unsafe "hs_bindgen_dc2295e107352a77" hs_bindgen_dc2295e107352a77_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i29@
+hs_bindgen_dc2295e107352a77 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_dc2295e107352a77 =
+  fmap BG.fromFFIType hs_bindgen_dc2295e107352a77_base
+
+{-# NOINLINE i29 #-}
+{-| __C declaration:__ @i29@
+
+    __defined at:__ @attributes\/visibility\/variables.h 53:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i29 :: BG.Ptr BG.CInt
+i29 = BG.unsafePerformIO hs_bindgen_dc2295e107352a77
diff --git a/test-artefacts/fixtures/attributes/visibility/variables/bindingspec.yaml b/test-artefacts/fixtures/attributes/visibility/variables/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/variables/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/attributes/visibility/variables/th.txt b/test-artefacts/fixtures/attributes/visibility/variables/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/attributes/visibility/variables/th.txt
@@ -0,0 +1,842 @@
+-- addDependentFile test-artefacts/headers/golden/attributes/visibility/variables.h
+-- #include <attributes/visibility/variables.h>
+-- /* test_attributesvisibilityvariable_Example_get_i0 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_39a034063990df12 (void)
+-- {
+--   return &i0;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i1 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_083fddca08b7aced (void)
+-- {
+--   return &i1;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i2 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_a76894155b8a6ec7 (void)
+-- {
+--   return &i2;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i3 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_ec3a25d8132ea504 (void)
+-- {
+--   return &i3;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i4 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_45d491ce87ed46d0 (void)
+-- {
+--   return &i4;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i5 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_fe19c8a8ebc1d947 (void)
+-- {
+--   return &i5;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i6 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_c1a332634f600e94 (void)
+-- {
+--   return &i6;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i7 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_c9bd5e0c60ff8f87 (void)
+-- {
+--   return &i7;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i8 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_94e7124f7562b1d3 (void)
+-- {
+--   return &i8;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i9 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_ec473304783162de (void)
+-- {
+--   return &i9;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i10 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_8756e67db8a0a542 (void)
+-- {
+--   return &i10;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i11 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_0106cc7a5825bf8b (void)
+-- {
+--   return &i11;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i12 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_296af89863107edf (void)
+-- {
+--   return &i12;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i13 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_ddfe303b28effdbb (void)
+-- {
+--   return &i13;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i14 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_b3911569cdb1adcc (void)
+-- {
+--   return &i14;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i15 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_94b1cd9806ce5bcc (void)
+-- {
+--   return &i15;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i16 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_e667df4994fab2af (void)
+-- {
+--   return &i16;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i17 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_656c7420378b3f41 (void)
+-- {
+--   return &i17;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i18 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_d60425923e1c6414 (void)
+-- {
+--   return &i18;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i19 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_cb11e511be0cfc50 (void)
+-- {
+--   return &i19;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i20 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_8720bde7cc30b171 (void)
+-- {
+--   return &i20;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i21 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_b71914b49e6bc6d8 (void)
+-- {
+--   return &i21;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i22 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_22b6f19b3356e742 (void)
+-- {
+--   return &i22;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i23 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_4432bdff99ca3ab2 (void)
+-- {
+--   return &i23;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i24 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_80552dd326e314dd (void)
+-- {
+--   return &i24;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i25 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_e782a3b4c5c62b6d (void)
+-- {
+--   return &i25;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i26 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_9888ce2162201152 (void)
+-- {
+--   return &i26;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i27 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_985cecf4c0c11aee (void)
+-- {
+--   return &i27;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i28 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_b02407ada9cb4466 (void)
+-- {
+--   return &i28;
+-- }
+-- /* test_attributesvisibilityvariable_Example_get_i29 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_dc2295e107352a77 (void)
+-- {
+--   return &i29;
+-- }
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i0@
+foreign import ccall unsafe "hs_bindgen_39a034063990df12" hs_bindgen_39a034063990df12_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i0@
+hs_bindgen_39a034063990df12 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i0@
+hs_bindgen_39a034063990df12 = fmap fromFFIType hs_bindgen_39a034063990df12_base
+{-# NOINLINE i0 #-}
+{-| __C declaration:__ @i0@
+
+    __defined at:__ @attributes\/visibility\/variables.h 14:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i0 :: Ptr CInt
+{-| __C declaration:__ @i0@
+
+    __defined at:__ @attributes\/visibility\/variables.h 14:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i0 = unsafePerformIO hs_bindgen_39a034063990df12
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i1@
+foreign import ccall unsafe "hs_bindgen_083fddca08b7aced" hs_bindgen_083fddca08b7aced_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i1@
+hs_bindgen_083fddca08b7aced :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i1@
+hs_bindgen_083fddca08b7aced = fmap fromFFIType hs_bindgen_083fddca08b7aced_base
+{-# NOINLINE i1 #-}
+{-| __C declaration:__ @i1@
+
+    __defined at:__ @attributes\/visibility\/variables.h 15:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i1 :: Ptr CInt
+{-| __C declaration:__ @i1@
+
+    __defined at:__ @attributes\/visibility\/variables.h 15:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i1 = unsafePerformIO hs_bindgen_083fddca08b7aced
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i2@
+foreign import ccall unsafe "hs_bindgen_a76894155b8a6ec7" hs_bindgen_a76894155b8a6ec7_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i2@
+hs_bindgen_a76894155b8a6ec7 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i2@
+hs_bindgen_a76894155b8a6ec7 = fmap fromFFIType hs_bindgen_a76894155b8a6ec7_base
+{-# NOINLINE i2 #-}
+{-| __C declaration:__ @i2@
+
+    __defined at:__ @attributes\/visibility\/variables.h 16:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i2 :: Ptr CInt
+{-| __C declaration:__ @i2@
+
+    __defined at:__ @attributes\/visibility\/variables.h 16:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i2 = unsafePerformIO hs_bindgen_a76894155b8a6ec7
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i3@
+foreign import ccall unsafe "hs_bindgen_ec3a25d8132ea504" hs_bindgen_ec3a25d8132ea504_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i3@
+hs_bindgen_ec3a25d8132ea504 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i3@
+hs_bindgen_ec3a25d8132ea504 = fmap fromFFIType hs_bindgen_ec3a25d8132ea504_base
+{-# NOINLINE i3 #-}
+{-| __C declaration:__ @i3@
+
+    __defined at:__ @attributes\/visibility\/variables.h 17:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i3 :: Ptr CInt
+{-| __C declaration:__ @i3@
+
+    __defined at:__ @attributes\/visibility\/variables.h 17:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i3 = unsafePerformIO hs_bindgen_ec3a25d8132ea504
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i4@
+foreign import ccall unsafe "hs_bindgen_45d491ce87ed46d0" hs_bindgen_45d491ce87ed46d0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i4@
+hs_bindgen_45d491ce87ed46d0 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i4@
+hs_bindgen_45d491ce87ed46d0 = fmap fromFFIType hs_bindgen_45d491ce87ed46d0_base
+{-# NOINLINE i4 #-}
+{-| __C declaration:__ @i4@
+
+    __defined at:__ @attributes\/visibility\/variables.h 18:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i4 :: Ptr CInt
+{-| __C declaration:__ @i4@
+
+    __defined at:__ @attributes\/visibility\/variables.h 18:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i4 = unsafePerformIO hs_bindgen_45d491ce87ed46d0
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i5@
+foreign import ccall unsafe "hs_bindgen_fe19c8a8ebc1d947" hs_bindgen_fe19c8a8ebc1d947_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i5@
+hs_bindgen_fe19c8a8ebc1d947 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i5@
+hs_bindgen_fe19c8a8ebc1d947 = fmap fromFFIType hs_bindgen_fe19c8a8ebc1d947_base
+{-# NOINLINE i5 #-}
+{-| __C declaration:__ @i5@
+
+    __defined at:__ @attributes\/visibility\/variables.h 21:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i5 :: Ptr CInt
+{-| __C declaration:__ @i5@
+
+    __defined at:__ @attributes\/visibility\/variables.h 21:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i5 = unsafePerformIO hs_bindgen_fe19c8a8ebc1d947
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i6@
+foreign import ccall unsafe "hs_bindgen_c1a332634f600e94" hs_bindgen_c1a332634f600e94_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i6@
+hs_bindgen_c1a332634f600e94 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i6@
+hs_bindgen_c1a332634f600e94 = fmap fromFFIType hs_bindgen_c1a332634f600e94_base
+{-# NOINLINE i6 #-}
+{-| __C declaration:__ @i6@
+
+    __defined at:__ @attributes\/visibility\/variables.h 22:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i6 :: Ptr CInt
+{-| __C declaration:__ @i6@
+
+    __defined at:__ @attributes\/visibility\/variables.h 22:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i6 = unsafePerformIO hs_bindgen_c1a332634f600e94
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i7@
+foreign import ccall unsafe "hs_bindgen_c9bd5e0c60ff8f87" hs_bindgen_c9bd5e0c60ff8f87_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i7@
+hs_bindgen_c9bd5e0c60ff8f87 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i7@
+hs_bindgen_c9bd5e0c60ff8f87 = fmap fromFFIType hs_bindgen_c9bd5e0c60ff8f87_base
+{-# NOINLINE i7 #-}
+{-| __C declaration:__ @i7@
+
+    __defined at:__ @attributes\/visibility\/variables.h 23:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i7 :: Ptr CInt
+{-| __C declaration:__ @i7@
+
+    __defined at:__ @attributes\/visibility\/variables.h 23:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i7 = unsafePerformIO hs_bindgen_c9bd5e0c60ff8f87
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i8@
+foreign import ccall unsafe "hs_bindgen_94e7124f7562b1d3" hs_bindgen_94e7124f7562b1d3_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i8@
+hs_bindgen_94e7124f7562b1d3 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i8@
+hs_bindgen_94e7124f7562b1d3 = fmap fromFFIType hs_bindgen_94e7124f7562b1d3_base
+{-# NOINLINE i8 #-}
+{-| __C declaration:__ @i8@
+
+    __defined at:__ @attributes\/visibility\/variables.h 24:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i8 :: Ptr CInt
+{-| __C declaration:__ @i8@
+
+    __defined at:__ @attributes\/visibility\/variables.h 24:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i8 = unsafePerformIO hs_bindgen_94e7124f7562b1d3
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i9@
+foreign import ccall unsafe "hs_bindgen_ec473304783162de" hs_bindgen_ec473304783162de_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i9@
+hs_bindgen_ec473304783162de :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i9@
+hs_bindgen_ec473304783162de = fmap fromFFIType hs_bindgen_ec473304783162de_base
+{-# NOINLINE i9 #-}
+{-| __C declaration:__ @i9@
+
+    __defined at:__ @attributes\/visibility\/variables.h 25:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i9 :: Ptr CInt
+{-| __C declaration:__ @i9@
+
+    __defined at:__ @attributes\/visibility\/variables.h 25:48@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i9 = unsafePerformIO hs_bindgen_ec473304783162de
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i10@
+foreign import ccall unsafe "hs_bindgen_8756e67db8a0a542" hs_bindgen_8756e67db8a0a542_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i10@
+hs_bindgen_8756e67db8a0a542 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i10@
+hs_bindgen_8756e67db8a0a542 = fmap fromFFIType hs_bindgen_8756e67db8a0a542_base
+{-# NOINLINE i10 #-}
+{-| __C declaration:__ @i10@
+
+    __defined at:__ @attributes\/visibility\/variables.h 28:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i10 :: Ptr CInt
+{-| __C declaration:__ @i10@
+
+    __defined at:__ @attributes\/visibility\/variables.h 28:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i10 = unsafePerformIO hs_bindgen_8756e67db8a0a542
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i11@
+foreign import ccall unsafe "hs_bindgen_0106cc7a5825bf8b" hs_bindgen_0106cc7a5825bf8b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i11@
+hs_bindgen_0106cc7a5825bf8b :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i11@
+hs_bindgen_0106cc7a5825bf8b = fmap fromFFIType hs_bindgen_0106cc7a5825bf8b_base
+{-# NOINLINE i11 #-}
+{-| __C declaration:__ @i11@
+
+    __defined at:__ @attributes\/visibility\/variables.h 29:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i11 :: Ptr CInt
+{-| __C declaration:__ @i11@
+
+    __defined at:__ @attributes\/visibility\/variables.h 29:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i11 = unsafePerformIO hs_bindgen_0106cc7a5825bf8b
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i12@
+foreign import ccall unsafe "hs_bindgen_296af89863107edf" hs_bindgen_296af89863107edf_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i12@
+hs_bindgen_296af89863107edf :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i12@
+hs_bindgen_296af89863107edf = fmap fromFFIType hs_bindgen_296af89863107edf_base
+{-# NOINLINE i12 #-}
+{-| __C declaration:__ @i12@
+
+    __defined at:__ @attributes\/visibility\/variables.h 30:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i12 :: Ptr CInt
+{-| __C declaration:__ @i12@
+
+    __defined at:__ @attributes\/visibility\/variables.h 30:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i12 = unsafePerformIO hs_bindgen_296af89863107edf
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i13@
+foreign import ccall unsafe "hs_bindgen_ddfe303b28effdbb" hs_bindgen_ddfe303b28effdbb_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i13@
+hs_bindgen_ddfe303b28effdbb :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i13@
+hs_bindgen_ddfe303b28effdbb = fmap fromFFIType hs_bindgen_ddfe303b28effdbb_base
+{-# NOINLINE i13 #-}
+{-| __C declaration:__ @i13@
+
+    __defined at:__ @attributes\/visibility\/variables.h 31:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i13 :: Ptr CInt
+{-| __C declaration:__ @i13@
+
+    __defined at:__ @attributes\/visibility\/variables.h 31:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i13 = unsafePerformIO hs_bindgen_ddfe303b28effdbb
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i14@
+foreign import ccall unsafe "hs_bindgen_b3911569cdb1adcc" hs_bindgen_b3911569cdb1adcc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i14@
+hs_bindgen_b3911569cdb1adcc :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i14@
+hs_bindgen_b3911569cdb1adcc = fmap fromFFIType hs_bindgen_b3911569cdb1adcc_base
+{-# NOINLINE i14 #-}
+{-| __C declaration:__ @i14@
+
+    __defined at:__ @attributes\/visibility\/variables.h 32:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i14 :: Ptr CInt
+{-| __C declaration:__ @i14@
+
+    __defined at:__ @attributes\/visibility\/variables.h 32:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i14 = unsafePerformIO hs_bindgen_b3911569cdb1adcc
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i15@
+foreign import ccall unsafe "hs_bindgen_94b1cd9806ce5bcc" hs_bindgen_94b1cd9806ce5bcc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i15@
+hs_bindgen_94b1cd9806ce5bcc :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i15@
+hs_bindgen_94b1cd9806ce5bcc = fmap fromFFIType hs_bindgen_94b1cd9806ce5bcc_base
+{-# NOINLINE i15 #-}
+{-| __C declaration:__ @i15@
+
+    __defined at:__ @attributes\/visibility\/variables.h 35:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i15 :: Ptr CInt
+{-| __C declaration:__ @i15@
+
+    __defined at:__ @attributes\/visibility\/variables.h 35:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i15 = unsafePerformIO hs_bindgen_94b1cd9806ce5bcc
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i16@
+foreign import ccall unsafe "hs_bindgen_e667df4994fab2af" hs_bindgen_e667df4994fab2af_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i16@
+hs_bindgen_e667df4994fab2af :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i16@
+hs_bindgen_e667df4994fab2af = fmap fromFFIType hs_bindgen_e667df4994fab2af_base
+{-# NOINLINE i16 #-}
+{-| __C declaration:__ @i16@
+
+    __defined at:__ @attributes\/visibility\/variables.h 36:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i16 :: Ptr CInt
+{-| __C declaration:__ @i16@
+
+    __defined at:__ @attributes\/visibility\/variables.h 36:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i16 = unsafePerformIO hs_bindgen_e667df4994fab2af
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i17@
+foreign import ccall unsafe "hs_bindgen_656c7420378b3f41" hs_bindgen_656c7420378b3f41_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i17@
+hs_bindgen_656c7420378b3f41 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i17@
+hs_bindgen_656c7420378b3f41 = fmap fromFFIType hs_bindgen_656c7420378b3f41_base
+{-# NOINLINE i17 #-}
+{-| __C declaration:__ @i17@
+
+    __defined at:__ @attributes\/visibility\/variables.h 37:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i17 :: Ptr CInt
+{-| __C declaration:__ @i17@
+
+    __defined at:__ @attributes\/visibility\/variables.h 37:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i17 = unsafePerformIO hs_bindgen_656c7420378b3f41
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i18@
+foreign import ccall unsafe "hs_bindgen_d60425923e1c6414" hs_bindgen_d60425923e1c6414_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i18@
+hs_bindgen_d60425923e1c6414 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i18@
+hs_bindgen_d60425923e1c6414 = fmap fromFFIType hs_bindgen_d60425923e1c6414_base
+{-# NOINLINE i18 #-}
+{-| __C declaration:__ @i18@
+
+    __defined at:__ @attributes\/visibility\/variables.h 38:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i18 :: Ptr CInt
+{-| __C declaration:__ @i18@
+
+    __defined at:__ @attributes\/visibility\/variables.h 38:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i18 = unsafePerformIO hs_bindgen_d60425923e1c6414
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i19@
+foreign import ccall unsafe "hs_bindgen_cb11e511be0cfc50" hs_bindgen_cb11e511be0cfc50_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i19@
+hs_bindgen_cb11e511be0cfc50 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i19@
+hs_bindgen_cb11e511be0cfc50 = fmap fromFFIType hs_bindgen_cb11e511be0cfc50_base
+{-# NOINLINE i19 #-}
+{-| __C declaration:__ @i19@
+
+    __defined at:__ @attributes\/visibility\/variables.h 39:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i19 :: Ptr CInt
+{-| __C declaration:__ @i19@
+
+    __defined at:__ @attributes\/visibility\/variables.h 39:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i19 = unsafePerformIO hs_bindgen_cb11e511be0cfc50
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i20@
+foreign import ccall unsafe "hs_bindgen_8720bde7cc30b171" hs_bindgen_8720bde7cc30b171_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i20@
+hs_bindgen_8720bde7cc30b171 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i20@
+hs_bindgen_8720bde7cc30b171 = fmap fromFFIType hs_bindgen_8720bde7cc30b171_base
+{-# NOINLINE i20 #-}
+{-| __C declaration:__ @i20@
+
+    __defined at:__ @attributes\/visibility\/variables.h 42:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i20 :: Ptr CInt
+{-| __C declaration:__ @i20@
+
+    __defined at:__ @attributes\/visibility\/variables.h 42:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i20 = unsafePerformIO hs_bindgen_8720bde7cc30b171
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i21@
+foreign import ccall unsafe "hs_bindgen_b71914b49e6bc6d8" hs_bindgen_b71914b49e6bc6d8_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i21@
+hs_bindgen_b71914b49e6bc6d8 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i21@
+hs_bindgen_b71914b49e6bc6d8 = fmap fromFFIType hs_bindgen_b71914b49e6bc6d8_base
+{-# NOINLINE i21 #-}
+{-| __C declaration:__ @i21@
+
+    __defined at:__ @attributes\/visibility\/variables.h 43:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i21 :: Ptr CInt
+{-| __C declaration:__ @i21@
+
+    __defined at:__ @attributes\/visibility\/variables.h 43:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i21 = unsafePerformIO hs_bindgen_b71914b49e6bc6d8
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i22@
+foreign import ccall unsafe "hs_bindgen_22b6f19b3356e742" hs_bindgen_22b6f19b3356e742_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i22@
+hs_bindgen_22b6f19b3356e742 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i22@
+hs_bindgen_22b6f19b3356e742 = fmap fromFFIType hs_bindgen_22b6f19b3356e742_base
+{-# NOINLINE i22 #-}
+{-| __C declaration:__ @i22@
+
+    __defined at:__ @attributes\/visibility\/variables.h 44:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i22 :: Ptr CInt
+{-| __C declaration:__ @i22@
+
+    __defined at:__ @attributes\/visibility\/variables.h 44:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i22 = unsafePerformIO hs_bindgen_22b6f19b3356e742
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i23@
+foreign import ccall unsafe "hs_bindgen_4432bdff99ca3ab2" hs_bindgen_4432bdff99ca3ab2_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i23@
+hs_bindgen_4432bdff99ca3ab2 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i23@
+hs_bindgen_4432bdff99ca3ab2 = fmap fromFFIType hs_bindgen_4432bdff99ca3ab2_base
+{-# NOINLINE i23 #-}
+{-| __C declaration:__ @i23@
+
+    __defined at:__ @attributes\/visibility\/variables.h 45:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i23 :: Ptr CInt
+{-| __C declaration:__ @i23@
+
+    __defined at:__ @attributes\/visibility\/variables.h 45:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i23 = unsafePerformIO hs_bindgen_4432bdff99ca3ab2
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i24@
+foreign import ccall unsafe "hs_bindgen_80552dd326e314dd" hs_bindgen_80552dd326e314dd_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i24@
+hs_bindgen_80552dd326e314dd :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i24@
+hs_bindgen_80552dd326e314dd = fmap fromFFIType hs_bindgen_80552dd326e314dd_base
+{-# NOINLINE i24 #-}
+{-| __C declaration:__ @i24@
+
+    __defined at:__ @attributes\/visibility\/variables.h 46:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i24 :: Ptr CInt
+{-| __C declaration:__ @i24@
+
+    __defined at:__ @attributes\/visibility\/variables.h 46:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i24 = unsafePerformIO hs_bindgen_80552dd326e314dd
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i25@
+foreign import ccall unsafe "hs_bindgen_e782a3b4c5c62b6d" hs_bindgen_e782a3b4c5c62b6d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i25@
+hs_bindgen_e782a3b4c5c62b6d :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i25@
+hs_bindgen_e782a3b4c5c62b6d = fmap fromFFIType hs_bindgen_e782a3b4c5c62b6d_base
+{-# NOINLINE i25 #-}
+{-| __C declaration:__ @i25@
+
+    __defined at:__ @attributes\/visibility\/variables.h 49:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i25 :: Ptr CInt
+{-| __C declaration:__ @i25@
+
+    __defined at:__ @attributes\/visibility\/variables.h 49:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i25 = unsafePerformIO hs_bindgen_e782a3b4c5c62b6d
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i26@
+foreign import ccall unsafe "hs_bindgen_9888ce2162201152" hs_bindgen_9888ce2162201152_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i26@
+hs_bindgen_9888ce2162201152 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i26@
+hs_bindgen_9888ce2162201152 = fmap fromFFIType hs_bindgen_9888ce2162201152_base
+{-# NOINLINE i26 #-}
+{-| __C declaration:__ @i26@
+
+    __defined at:__ @attributes\/visibility\/variables.h 50:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i26 :: Ptr CInt
+{-| __C declaration:__ @i26@
+
+    __defined at:__ @attributes\/visibility\/variables.h 50:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i26 = unsafePerformIO hs_bindgen_9888ce2162201152
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i27@
+foreign import ccall unsafe "hs_bindgen_985cecf4c0c11aee" hs_bindgen_985cecf4c0c11aee_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i27@
+hs_bindgen_985cecf4c0c11aee :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i27@
+hs_bindgen_985cecf4c0c11aee = fmap fromFFIType hs_bindgen_985cecf4c0c11aee_base
+{-# NOINLINE i27 #-}
+{-| __C declaration:__ @i27@
+
+    __defined at:__ @attributes\/visibility\/variables.h 51:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i27 :: Ptr CInt
+{-| __C declaration:__ @i27@
+
+    __defined at:__ @attributes\/visibility\/variables.h 51:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i27 = unsafePerformIO hs_bindgen_985cecf4c0c11aee
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i28@
+foreign import ccall unsafe "hs_bindgen_b02407ada9cb4466" hs_bindgen_b02407ada9cb4466_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i28@
+hs_bindgen_b02407ada9cb4466 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i28@
+hs_bindgen_b02407ada9cb4466 = fmap fromFFIType hs_bindgen_b02407ada9cb4466_base
+{-# NOINLINE i28 #-}
+{-| __C declaration:__ @i28@
+
+    __defined at:__ @attributes\/visibility\/variables.h 52:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i28 :: Ptr CInt
+{-| __C declaration:__ @i28@
+
+    __defined at:__ @attributes\/visibility\/variables.h 52:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i28 = unsafePerformIO hs_bindgen_b02407ada9cb4466
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i29@
+foreign import ccall unsafe "hs_bindgen_dc2295e107352a77" hs_bindgen_dc2295e107352a77_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i29@
+hs_bindgen_dc2295e107352a77 :: IO (Ptr CInt)
+-- __unique:__ @test_attributesvisibilityvariable_Example_get_i29@
+hs_bindgen_dc2295e107352a77 = fmap fromFFIType hs_bindgen_dc2295e107352a77_base
+{-# NOINLINE i29 #-}
+{-| __C declaration:__ @i29@
+
+    __defined at:__ @attributes\/visibility\/variables.h 53:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i29 :: Ptr CInt
+{-| __C declaration:__ @i29@
+
+    __defined at:__ @attributes\/visibility\/variables.h 53:55@
+
+    __exported by:__ @attributes\/visibility\/variables.h@
+-}
+i29 = unsafePerformIO hs_bindgen_dc2295e107352a77
diff --git a/test-artefacts/fixtures/binding-specs/enum/closed/Example.hs b/test-artefacts/fixtures/binding-specs/enum/closed/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/enum/closed/Example.hs
@@ -0,0 +1,456 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo(..)
+    , pattern Example.Bar
+    , pattern Example.Baz
+    , Example.ElementaryParticleType(..)
+    , pattern Example.Quark_up
+    , pattern Example.Quark_down
+    , pattern Example.Quark_charm
+    , pattern Example.Quark_strange
+    , pattern Example.Quark_top
+    , pattern Example.Quark_bottom
+    , pattern Example.Lepton_electron
+    , pattern Example.Lepton_electron_neutrino
+    , pattern Example.Lepton_muon
+    , pattern Example.Lepton_muon_neutrino
+    , pattern Example.Lepton_tau
+    , pattern Example.Lepton_tau_neutrino
+    , pattern Example.Boson_gluon
+    , pattern Example.Boson_photon
+    , pattern Example.Boson_z
+    , pattern Example.Boson_w
+    , pattern Example.Boson_higgs
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum foo@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 2:6@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+newtype Foo = Foo
+  { unwrapFoo :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Foo where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Foo where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Foo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo unwrapFoo2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapFoo2
+
+deriving via Marshal.EquivStorable Foo instance BG.Storable Foo
+
+deriving via BG.CUInt instance BG.Prim Foo
+
+instance CEnum.CEnum Foo where
+
+  type CEnumZ Foo = BG.CUInt
+
+  toCEnum = Foo
+
+  fromCEnum = BG.getField @"unwrapFoo"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "Bar"), (1, BG.singleton "Baz")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "Foo"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Foo"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Foo where
+
+  minDeclaredValue = Bar
+
+  maxDeclaredValue = Baz
+
+instance Show Foo where
+
+  showsPrec = CEnum.shows
+
+instance Read Foo where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapFoo" Foo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo {unwrapFoo = y1}, BG.getField @"unwrapFoo" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapFoo" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFoo")
+
+instance HasCField.HasCField Foo "unwrapFoo" where
+
+  type CFieldType Foo "unwrapFoo" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 3:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Bar :: Foo
+pattern Bar = Foo 0
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 4:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Baz :: Foo
+pattern Baz = Foo 1
+
+{-# COMPLETE Bar, Baz #-}
+
+{-| __C declaration:__ @enum elementary_particle_type@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 8:6@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+newtype ElementaryParticleType = ElementaryParticleType
+  { unwrapElementaryParticleType :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize ElementaryParticleType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw ElementaryParticleType where
+
+  readRaw =
+    \ptr0 ->
+          pure ElementaryParticleType
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw ElementaryParticleType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ElementaryParticleType unwrapElementaryParticleType2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapElementaryParticleType2
+
+deriving via Marshal.EquivStorable ElementaryParticleType instance BG.Storable ElementaryParticleType
+
+deriving via BG.CUInt instance BG.Prim ElementaryParticleType
+
+instance CEnum.CEnum ElementaryParticleType where
+
+  type CEnumZ ElementaryParticleType = BG.CUInt
+
+  toCEnum = ElementaryParticleType
+
+  fromCEnum =
+    BG.getField @"unwrapElementaryParticleType"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "Quark_up")
+                                   , (1, BG.singleton "Quark_down")
+                                   , (2, BG.singleton "Quark_charm")
+                                   , (3, BG.singleton "Quark_strange")
+                                   , (4, BG.singleton "Quark_top")
+                                   , (5, BG.singleton "Quark_bottom")
+                                   , (6, BG.singleton "Lepton_electron")
+                                   , (7, BG.singleton "Lepton_electron_neutrino")
+                                   , (8, BG.singleton "Lepton_muon")
+                                   , (9, BG.singleton "Lepton_muon_neutrino")
+                                   , (10, BG.singleton "Lepton_tau")
+                                   , (11, BG.singleton "Lepton_tau_neutrino")
+                                   , (12, BG.singleton "Boson_gluon")
+                                   , (13, BG.singleton "Boson_photon")
+                                   , (14, BG.singleton "Boson_z")
+                                   , (15, BG.singleton "Boson_w")
+                                   , (16, BG.singleton "Boson_higgs")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "ElementaryParticleType"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "ElementaryParticleType"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum ElementaryParticleType where
+
+  minDeclaredValue = Quark_up
+
+  maxDeclaredValue = Boson_higgs
+
+instance Show ElementaryParticleType where
+
+  showsPrec = CEnum.shows
+
+instance Read ElementaryParticleType where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapElementaryParticleType" ElementaryParticleType ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ElementaryParticleType {unwrapElementaryParticleType = y1}
+      , BG.getField @"unwrapElementaryParticleType" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapElementaryParticleType" (BG.Ptr ElementaryParticleType) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapElementaryParticleType")
+
+instance HasCField.HasCField ElementaryParticleType "unwrapElementaryParticleType" where
+
+  type CFieldType ElementaryParticleType "unwrapElementaryParticleType" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @quark_up@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 9:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_up :: ElementaryParticleType
+pattern Quark_up = ElementaryParticleType 0
+
+{-| __C declaration:__ @quark_down@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 10:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_down :: ElementaryParticleType
+pattern Quark_down = ElementaryParticleType 1
+
+{-| __C declaration:__ @quark_charm@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 11:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_charm :: ElementaryParticleType
+pattern Quark_charm = ElementaryParticleType 2
+
+{-| __C declaration:__ @quark_strange@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 12:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_strange :: ElementaryParticleType
+pattern Quark_strange = ElementaryParticleType 3
+
+{-| __C declaration:__ @quark_top@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 13:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_top :: ElementaryParticleType
+pattern Quark_top = ElementaryParticleType 4
+
+{-| __C declaration:__ @quark_bottom@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 14:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_bottom :: ElementaryParticleType
+pattern Quark_bottom = ElementaryParticleType 5
+
+{-| __C declaration:__ @lepton_electron@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 15:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_electron :: ElementaryParticleType
+pattern Lepton_electron = ElementaryParticleType 6
+
+{-| __C declaration:__ @lepton_electron_neutrino@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 16:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_electron_neutrino :: ElementaryParticleType
+pattern Lepton_electron_neutrino = ElementaryParticleType 7
+
+{-| __C declaration:__ @lepton_muon@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 17:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_muon :: ElementaryParticleType
+pattern Lepton_muon = ElementaryParticleType 8
+
+{-| __C declaration:__ @lepton_muon_neutrino@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 18:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_muon_neutrino :: ElementaryParticleType
+pattern Lepton_muon_neutrino = ElementaryParticleType 9
+
+{-| __C declaration:__ @lepton_tau@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 19:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_tau :: ElementaryParticleType
+pattern Lepton_tau = ElementaryParticleType 10
+
+{-| __C declaration:__ @lepton_tau_neutrino@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 20:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_tau_neutrino :: ElementaryParticleType
+pattern Lepton_tau_neutrino = ElementaryParticleType 11
+
+{-| __C declaration:__ @boson_gluon@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 21:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_gluon :: ElementaryParticleType
+pattern Boson_gluon = ElementaryParticleType 12
+
+{-| __C declaration:__ @boson_photon@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 22:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_photon :: ElementaryParticleType
+pattern Boson_photon = ElementaryParticleType 13
+
+{-| __C declaration:__ @boson_z@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 23:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_z :: ElementaryParticleType
+pattern Boson_z = ElementaryParticleType 14
+
+{-| __C declaration:__ @boson_w@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 24:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_w :: ElementaryParticleType
+pattern Boson_w = ElementaryParticleType 15
+
+{-| __C declaration:__ @boson_higgs@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 25:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_higgs :: ElementaryParticleType
+pattern Boson_higgs = ElementaryParticleType 16
+
+{-# COMPLETE
+      Quark_up
+    , Quark_down
+    , Quark_charm
+    , Quark_strange
+    , Quark_top
+    , Quark_bottom
+    , Lepton_electron
+    , Lepton_electron_neutrino
+    , Lepton_muon
+    , Lepton_muon_neutrino
+    , Lepton_tau
+    , Lepton_tau_neutrino
+    , Boson_gluon
+    , Boson_photon
+    , Boson_z
+    , Boson_w
+    , Boson_higgs
+  #-}
diff --git a/test-artefacts/fixtures/binding-specs/enum/closed/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/enum/closed/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/enum/closed/bindingspec.yaml
@@ -0,0 +1,68 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/enum/closed.h
+  cname: enum foo
+  hsname: Foo
+  enum: closed
+- headers: binding-specs/enum/closed.h
+  cname: enum elementary_particle_type
+  hsname: ElementaryParticleType
+  enum: closed
+hstypes:
+- hsname: ElementaryParticleType
+  representation:
+    newtype:
+      constructor: ElementaryParticleType
+      fields:
+      - unwrapElementaryParticleType
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    newtype:
+      constructor: Foo
+      fields:
+      - unwrapFoo
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/enum/closed/th.txt b/test-artefacts/fixtures/binding-specs/enum/closed/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/enum/closed/th.txt
@@ -0,0 +1,275 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/enum/closed.h
+{-| __C declaration:__ @enum foo@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 2:6@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+newtype Foo
+    = Foo {unwrapFoo :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Foo
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Foo
+    where readRaw = \ptr_0 -> pure Foo <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Foo
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo unwrapFoo_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapFoo_2
+deriving via (EquivStorable Foo) instance Storable Foo
+deriving via CUInt instance Prim Foo
+instance CEnum Foo
+    where type CEnumZ Foo = CUInt
+          toCEnum = Foo
+          fromCEnum = getField @"unwrapFoo"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "Bar"),
+                                                         (1, singleton "Baz")]
+          showsUndeclared = showsWrappedUndeclared "Foo"
+          readPrecUndeclared = readPrecWrappedUndeclared "Foo"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Foo
+    where minDeclaredValue = Bar
+          maxDeclaredValue = Baz
+instance Show Foo
+    where showsPrec = shows
+instance Read Foo
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapFoo" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{unwrapFoo = y_1},
+                              getField @"unwrapFoo" x_0)
+instance (~) ty CUInt => HasField "unwrapFoo" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo")
+instance HasCField Foo "unwrapFoo"
+    where type CFieldType Foo "unwrapFoo" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 3:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Bar :: Foo
+pattern Bar = Foo 0
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 4:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Baz :: Foo
+pattern Baz = Foo 1
+{-# COMPLETE Bar, Baz #-}
+{-| __C declaration:__ @enum elementary_particle_type@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 8:6@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+newtype ElementaryParticleType
+    = ElementaryParticleType {unwrapElementaryParticleType :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize ElementaryParticleType
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw ElementaryParticleType
+    where readRaw = \ptr_0 -> pure ElementaryParticleType <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw ElementaryParticleType
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       ElementaryParticleType unwrapElementaryParticleType_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapElementaryParticleType_2
+deriving via (EquivStorable ElementaryParticleType) instance Storable ElementaryParticleType
+deriving via CUInt instance Prim ElementaryParticleType
+instance CEnum ElementaryParticleType
+    where type CEnumZ ElementaryParticleType = CUInt
+          toCEnum = ElementaryParticleType
+          fromCEnum = getField @"unwrapElementaryParticleType"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "Quark_up"),
+                                                         (1, singleton "Quark_down"),
+                                                         (2, singleton "Quark_charm"),
+                                                         (3, singleton "Quark_strange"),
+                                                         (4, singleton "Quark_top"),
+                                                         (5, singleton "Quark_bottom"),
+                                                         (6, singleton "Lepton_electron"),
+                                                         (7, singleton "Lepton_electron_neutrino"),
+                                                         (8, singleton "Lepton_muon"),
+                                                         (9, singleton "Lepton_muon_neutrino"),
+                                                         (10, singleton "Lepton_tau"),
+                                                         (11, singleton "Lepton_tau_neutrino"),
+                                                         (12, singleton "Boson_gluon"),
+                                                         (13, singleton "Boson_photon"),
+                                                         (14, singleton "Boson_z"),
+                                                         (15, singleton "Boson_w"),
+                                                         (16, singleton "Boson_higgs")]
+          showsUndeclared = showsWrappedUndeclared "ElementaryParticleType"
+          readPrecUndeclared = readPrecWrappedUndeclared "ElementaryParticleType"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum ElementaryParticleType
+    where minDeclaredValue = Quark_up
+          maxDeclaredValue = Boson_higgs
+instance Show ElementaryParticleType
+    where showsPrec = shows
+instance Read ElementaryParticleType
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt =>
+         HasField "unwrapElementaryParticleType" ElementaryParticleType ty
+    where hasField = \x_0 -> (\y_1 -> ElementaryParticleType{unwrapElementaryParticleType = y_1},
+                              getField @"unwrapElementaryParticleType" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapElementaryParticleType"
+                  (Ptr ElementaryParticleType)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapElementaryParticleType")
+instance HasCField ElementaryParticleType
+                   "unwrapElementaryParticleType"
+    where type CFieldType ElementaryParticleType
+                          "unwrapElementaryParticleType" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @quark_up@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 9:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_up :: ElementaryParticleType
+pattern Quark_up = ElementaryParticleType 0
+{-| __C declaration:__ @quark_down@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 10:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_down :: ElementaryParticleType
+pattern Quark_down = ElementaryParticleType 1
+{-| __C declaration:__ @quark_charm@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 11:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_charm :: ElementaryParticleType
+pattern Quark_charm = ElementaryParticleType 2
+{-| __C declaration:__ @quark_strange@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 12:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_strange :: ElementaryParticleType
+pattern Quark_strange = ElementaryParticleType 3
+{-| __C declaration:__ @quark_top@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 13:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_top :: ElementaryParticleType
+pattern Quark_top = ElementaryParticleType 4
+{-| __C declaration:__ @quark_bottom@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 14:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Quark_bottom :: ElementaryParticleType
+pattern Quark_bottom = ElementaryParticleType 5
+{-| __C declaration:__ @lepton_electron@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 15:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_electron :: ElementaryParticleType
+pattern Lepton_electron = ElementaryParticleType 6
+{-| __C declaration:__ @lepton_electron_neutrino@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 16:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_electron_neutrino :: ElementaryParticleType
+pattern Lepton_electron_neutrino = ElementaryParticleType 7
+{-| __C declaration:__ @lepton_muon@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 17:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_muon :: ElementaryParticleType
+pattern Lepton_muon = ElementaryParticleType 8
+{-| __C declaration:__ @lepton_muon_neutrino@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 18:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_muon_neutrino :: ElementaryParticleType
+pattern Lepton_muon_neutrino = ElementaryParticleType 9
+{-| __C declaration:__ @lepton_tau@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 19:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_tau :: ElementaryParticleType
+pattern Lepton_tau = ElementaryParticleType 10
+{-| __C declaration:__ @lepton_tau_neutrino@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 20:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Lepton_tau_neutrino :: ElementaryParticleType
+pattern Lepton_tau_neutrino = ElementaryParticleType 11
+{-| __C declaration:__ @boson_gluon@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 21:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_gluon :: ElementaryParticleType
+pattern Boson_gluon = ElementaryParticleType 12
+{-| __C declaration:__ @boson_photon@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 22:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_photon :: ElementaryParticleType
+pattern Boson_photon = ElementaryParticleType 13
+{-| __C declaration:__ @boson_z@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 23:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_z :: ElementaryParticleType
+pattern Boson_z = ElementaryParticleType 14
+{-| __C declaration:__ @boson_w@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 24:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_w :: ElementaryParticleType
+pattern Boson_w = ElementaryParticleType 15
+{-| __C declaration:__ @boson_higgs@
+
+    __defined at:__ @binding-specs\/enum\/closed.h 25:3@
+
+    __exported by:__ @binding-specs\/enum\/closed.h@
+-}
+pattern Boson_higgs :: ElementaryParticleType
+pattern Boson_higgs = ElementaryParticleType 16
+{-# COMPLETE Quark_up, Quark_down, Quark_charm, Quark_strange,
+             Quark_top, Quark_bottom, Lepton_electron, Lepton_electron_neutrino,
+             Lepton_muon, Lepton_muon_neutrino, Lepton_tau, Lepton_tau_neutrino,
+             Boson_gluon, Boson_photon, Boson_z, Boson_w, Boson_higgs #-}
diff --git a/test-artefacts/fixtures/binding-specs/enum/mismatch/Example.hs b/test-artefacts/fixtures/binding-specs/enum/mismatch/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/enum/mismatch/Example.hs
@@ -0,0 +1,128 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Pt(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct pt@
+
+    __defined at:__ @binding-specs\/enum\/mismatch.h 1:8@
+
+    __exported by:__ @binding-specs\/enum\/mismatch.h@
+-}
+data Pt = Pt
+  { pt_x :: BG.CDouble
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @binding-specs\/enum\/mismatch.h 1:20@
+
+         __exported by:__ @binding-specs\/enum\/mismatch.h@
+    -}
+  , pt_y :: BG.CDouble
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @binding-specs\/enum\/mismatch.h 1:23@
+
+         __exported by:__ @binding-specs\/enum\/mismatch.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Pt where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Pt where
+
+  readRaw =
+    \ptr0 ->
+          pure Pt
+      <*> HasCField.readRaw (BG.Proxy @"pt_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"pt_y") ptr0
+
+instance Marshal.WriteRaw Pt where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Pt pt_x2 pt_y3 ->
+               HasCField.writeRaw (BG.Proxy @"pt_x") ptr0 pt_x2
+            >> HasCField.writeRaw (BG.Proxy @"pt_y") ptr0 pt_y3
+
+deriving via Marshal.EquivStorable Pt instance BG.Storable Pt
+
+deriving via Struct.IsStructViaReadRaw Pt instance Struct.IsStruct Pt
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/enum\/mismatch.h 1:20@
+
+    __exported by:__ @binding-specs\/enum\/mismatch.h@
+-}
+instance (ty ~ BG.CDouble) => BG.CompatHasField.HasField "pt_x" Pt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Pt {pt_x = y1, pt_y = BG.getField @"pt_y" x0}
+      , BG.getField @"pt_x" x0
+      )
+
+instance (ty ~ BG.CDouble) => BG.HasField "pt_x" (BG.Ptr Pt) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"pt_x")
+
+instance HasCField.HasCField Pt "pt_x" where
+
+  type CFieldType Pt "pt_x" = BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @binding-specs\/enum\/mismatch.h 1:23@
+
+    __exported by:__ @binding-specs\/enum\/mismatch.h@
+-}
+instance (ty ~ BG.CDouble) => BG.CompatHasField.HasField "pt_y" Pt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Pt {pt_y = y1, pt_x = BG.getField @"pt_x" x0}
+      , BG.getField @"pt_y" x0
+      )
+
+instance (ty ~ BG.CDouble) => BG.HasField "pt_y" (BG.Ptr Pt) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"pt_y")
+
+instance HasCField.HasCField Pt "pt_y" where
+
+  type CFieldType Pt "pt_y" = BG.CDouble
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/binding-specs/enum/mismatch/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/enum/mismatch/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/enum/mismatch/bindingspec.yaml
@@ -0,0 +1,29 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/enum/mismatch.h
+  cname: struct pt
+  hsname: Pt
+hstypes:
+- hsname: Pt
+  representation:
+    record:
+      constructor: Pt
+      fields:
+      - pt_x
+      - pt_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/enum/mismatch/th.txt b/test-artefacts/fixtures/binding-specs/enum/mismatch/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/enum/mismatch/th.txt
@@ -0,0 +1,52 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/enum/mismatch.h
+{-| __C declaration:__ @struct pt@
+
+    __defined at:__ @binding-specs\/enum\/mismatch.h 1:8@
+
+    __exported by:__ @binding-specs\/enum\/mismatch.h@
+-}
+data Pt
+    = Pt {pt_x :: CDouble
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @binding-specs\/enum\/mismatch.h 1:20@
+
+               __exported by:__ @binding-specs\/enum\/mismatch.h@
+          -},
+          pt_y :: CDouble
+          {- ^ __C declaration:__ @y@
+
+               __defined at:__ @binding-specs\/enum\/mismatch.h 1:23@
+
+               __exported by:__ @binding-specs\/enum\/mismatch.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Pt
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Pt
+    where readRaw = \ptr_0 -> (pure Pt <*> readRaw (Proxy @"pt_x") ptr_0) <*> readRaw (Proxy @"pt_y") ptr_0
+instance WriteRaw Pt
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Pt pt_x_2
+                                          pt_y_3 -> writeRaw (Proxy @"pt_x") ptr_0 pt_x_2 >> writeRaw (Proxy @"pt_y") ptr_0 pt_y_3
+deriving via (EquivStorable Pt) instance Storable Pt
+deriving via (IsStructViaReadRaw Pt) instance IsStruct Pt
+instance (~) ty CDouble => HasField "pt_x" Pt ty
+    where hasField = \x_0 -> (\y_1 -> Pt{pt_x = y_1,
+                                         pt_y = getField @"pt_y" x_0},
+                              getField @"pt_x" x_0)
+instance (~) ty CDouble => HasField "pt_x" (Ptr Pt) (Ptr ty)
+    where getField = fromPtr (Proxy @"pt_x")
+instance HasCField Pt "pt_x"
+    where type CFieldType Pt "pt_x" = CDouble
+          offset# = \_ -> \_ -> 0
+instance (~) ty CDouble => HasField "pt_y" Pt ty
+    where hasField = \x_0 -> (\y_1 -> Pt{pt_y = y_1,
+                                         pt_x = getField @"pt_x" x_0},
+                              getField @"pt_y" x_0)
+instance (~) ty CDouble => HasField "pt_y" (Ptr Pt) (Ptr ty)
+    where getField = fromPtr (Proxy @"pt_y")
+instance HasCField Pt "pt_y"
+    where type CFieldType Pt "pt_y" = CDouble
+          offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/binding-specs/enum/open/Example.hs b/test-artefacts/fixtures/binding-specs/enum/open/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/enum/open/Example.hs
@@ -0,0 +1,144 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo(..)
+    , pattern Example.Bar
+    , pattern Example.Baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum foo@
+
+    __defined at:__ @binding-specs\/enum\/open.h 1:6@
+
+    __exported by:__ @binding-specs\/enum\/open.h@
+-}
+newtype Foo = Foo
+  { unwrapFoo :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Foo where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Foo where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Foo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo unwrapFoo2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapFoo2
+
+deriving via Marshal.EquivStorable Foo instance BG.Storable Foo
+
+deriving via BG.CUInt instance BG.Prim Foo
+
+instance CEnum.CEnum Foo where
+
+  type CEnumZ Foo = BG.CUInt
+
+  toCEnum = Foo
+
+  fromCEnum = BG.getField @"unwrapFoo"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "Bar"), (1, BG.singleton "Baz")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "Foo"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Foo"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Foo where
+
+  minDeclaredValue = Bar
+
+  maxDeclaredValue = Baz
+
+instance Show Foo where
+
+  showsPrec = CEnum.shows
+
+instance Read Foo where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapFoo" Foo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo {unwrapFoo = y1}, BG.getField @"unwrapFoo" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapFoo" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFoo")
+
+instance HasCField.HasCField Foo "unwrapFoo" where
+
+  type CFieldType Foo "unwrapFoo" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/enum\/open.h 2:3@
+
+    __exported by:__ @binding-specs\/enum\/open.h@
+-}
+pattern Bar :: Foo
+pattern Bar = Foo 0
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @binding-specs\/enum\/open.h 3:3@
+
+    __exported by:__ @binding-specs\/enum\/open.h@
+-}
+pattern Baz :: Foo
+pattern Baz = Foo 1
diff --git a/test-artefacts/fixtures/binding-specs/enum/open/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/enum/open/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/enum/open/bindingspec.yaml
@@ -0,0 +1,37 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/enum/open.h
+  cname: enum foo
+  hsname: Foo
+  enum: open
+hstypes:
+- hsname: Foo
+  representation:
+    newtype:
+      constructor: Foo
+      fields:
+      - unwrapFoo
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/enum/open/th.txt b/test-artefacts/fixtures/binding-specs/enum/open/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/enum/open/th.txt
@@ -0,0 +1,65 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/enum/open.h
+{-| __C declaration:__ @enum foo@
+
+    __defined at:__ @binding-specs\/enum\/open.h 1:6@
+
+    __exported by:__ @binding-specs\/enum\/open.h@
+-}
+newtype Foo
+    = Foo {unwrapFoo :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Foo
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Foo
+    where readRaw = \ptr_0 -> pure Foo <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Foo
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo unwrapFoo_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapFoo_2
+deriving via (EquivStorable Foo) instance Storable Foo
+deriving via CUInt instance Prim Foo
+instance CEnum Foo
+    where type CEnumZ Foo = CUInt
+          toCEnum = Foo
+          fromCEnum = getField @"unwrapFoo"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "Bar"),
+                                                         (1, singleton "Baz")]
+          showsUndeclared = showsWrappedUndeclared "Foo"
+          readPrecUndeclared = readPrecWrappedUndeclared "Foo"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Foo
+    where minDeclaredValue = Bar
+          maxDeclaredValue = Baz
+instance Show Foo
+    where showsPrec = shows
+instance Read Foo
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapFoo" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{unwrapFoo = y_1},
+                              getField @"unwrapFoo" x_0)
+instance (~) ty CUInt => HasField "unwrapFoo" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo")
+instance HasCField Foo "unwrapFoo"
+    where type CFieldType Foo "unwrapFoo" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/enum\/open.h 2:3@
+
+    __exported by:__ @binding-specs\/enum\/open.h@
+-}
+pattern Bar :: Foo
+pattern Bar = Foo 0
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @binding-specs\/enum\/open.h 3:3@
+
+    __exported by:__ @binding-specs\/enum\/open.h@
+-}
+pattern Baz :: Foo
+pattern Baz = Foo 1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example.hs
@@ -0,0 +1,145 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyArray(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (Eq, Show, type (~))
+
+{-| __C declaration:__ @MyArray@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 5:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+newtype MyArray = MyArray
+  { unwrapMyArray :: IA.IncompleteArray BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyArray" MyArray ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyArray {unwrapMyArray = y1}, BG.getField @"unwrapMyArray" x0)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.HasField "unwrapMyArray" (BG.Ptr MyArray) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyArray")
+
+instance HasCField.HasCField MyArray "unwrapMyArray" where
+
+  type CFieldType MyArray "unwrapMyArray" =
+    IA.IncompleteArray BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+newtype A = A
+  { unwrapA :: MyArray
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance (ty ~ MyArray) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ MyArray) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyArray
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example/FunPtr.hs
@@ -0,0 +1,187 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/array.h>"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fc9d87cbca4127e4 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0dbc306c53c94679 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_db0d885ae35d447f (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_82d6fdd972810bf4 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_398c495511ffe384 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b74f6af23eb996c3 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_fc9d87cbca4127e4" hs_bindgen_fc9d87cbca4127e4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+hs_bindgen_fc9d87cbca4127e4 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem MyArray) -> IO ()))
+hs_bindgen_fc9d87cbca4127e4 =
+  fmap BG.fromFFIType hs_bindgen_fc9d87cbca4127e4_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+foo :: BG.FunPtr (BG.Ptr (IsA.Elem MyArray) -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_fc9d87cbca4127e4
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_0dbc306c53c94679" hs_bindgen_0dbc306c53c94679_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+hs_bindgen_0dbc306c53c94679 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem A) -> IO ()))
+hs_bindgen_0dbc306c53c94679 =
+  fmap BG.fromFFIType hs_bindgen_0dbc306c53c94679_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooA :: BG.FunPtr (BG.Ptr (IsA.Elem A) -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_0dbc306c53c94679
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_db0d885ae35d447f" hs_bindgen_db0d885ae35d447f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+hs_bindgen_db0d885ae35d447f :: IO (BG.FunPtr (BG.Ptr (IsA.Elem B) -> IO ()))
+hs_bindgen_db0d885ae35d447f =
+  fmap BG.fromFFIType hs_bindgen_db0d885ae35d447f_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooB :: BG.FunPtr (BG.Ptr (IsA.Elem B) -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_db0d885ae35d447f
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_82d6fdd972810bf4" hs_bindgen_82d6fdd972810bf4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+hs_bindgen_82d6fdd972810bf4 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem M.C) -> IO ()))
+hs_bindgen_82d6fdd972810bf4 =
+  fmap BG.fromFFIType hs_bindgen_82d6fdd972810bf4_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooC :: BG.FunPtr (BG.Ptr (IsA.Elem M.C) -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_82d6fdd972810bf4
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_398c495511ffe384" hs_bindgen_398c495511ffe384_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+hs_bindgen_398c495511ffe384 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem M.D) -> IO ()))
+hs_bindgen_398c495511ffe384 =
+  fmap BG.fromFFIType hs_bindgen_398c495511ffe384_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooD :: BG.FunPtr (BG.Ptr (IsA.Elem M.D) -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_398c495511ffe384
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_b74f6af23eb996c3" hs_bindgen_b74f6af23eb996c3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+hs_bindgen_b74f6af23eb996c3 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem E) -> IO ()))
+hs_bindgen_b74f6af23eb996c3 =
+  fmap BG.fromFFIType hs_bindgen_b74f6af23eb996c3_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooE :: BG.FunPtr (BG.Ptr (IsA.Elem E) -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_b74f6af23eb996c3
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example/Safe.hs
@@ -0,0 +1,211 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/array.h>"
+  , "void hs_bindgen_2a6ef3a515232132 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_4449a68917cbc499 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_05766199d1b077bb ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_adeb3a183d6676ee ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_e9321a5f27f4381e ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_257d56ad8cb31970 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_2a6ef3a515232132" hs_bindgen_2a6ef3a515232132_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+hs_bindgen_2a6ef3a515232132 ::
+     BG.Ptr (IsA.Elem MyArray)
+  -> IO ()
+hs_bindgen_2a6ef3a515232132 =
+  \x0 ->
+    hs_bindgen_2a6ef3a515232132_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem MyArray)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_2a6ef3a515232132
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_4449a68917cbc499" hs_bindgen_4449a68917cbc499_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+hs_bindgen_4449a68917cbc499 ::
+     BG.Ptr (IsA.Elem A)
+  -> IO ()
+hs_bindgen_4449a68917cbc499 =
+  \x0 ->
+    hs_bindgen_4449a68917cbc499_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooA ::
+     BG.Ptr (IsA.Elem A)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_4449a68917cbc499
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_05766199d1b077bb" hs_bindgen_05766199d1b077bb_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+hs_bindgen_05766199d1b077bb ::
+     BG.Ptr (IsA.Elem B)
+  -> IO ()
+hs_bindgen_05766199d1b077bb =
+  \x0 ->
+    hs_bindgen_05766199d1b077bb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooB ::
+     BG.Ptr (IsA.Elem B)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_05766199d1b077bb
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_adeb3a183d6676ee" hs_bindgen_adeb3a183d6676ee_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+hs_bindgen_adeb3a183d6676ee ::
+     BG.Ptr (IsA.Elem M.C)
+  -> IO ()
+hs_bindgen_adeb3a183d6676ee =
+  \x0 ->
+    hs_bindgen_adeb3a183d6676ee_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooC ::
+     BG.Ptr (IsA.Elem M.C)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_adeb3a183d6676ee
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_e9321a5f27f4381e" hs_bindgen_e9321a5f27f4381e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+hs_bindgen_e9321a5f27f4381e ::
+     BG.Ptr (IsA.Elem M.D)
+  -> IO ()
+hs_bindgen_e9321a5f27f4381e =
+  \x0 ->
+    hs_bindgen_e9321a5f27f4381e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooD ::
+     BG.Ptr (IsA.Elem M.D)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_e9321a5f27f4381e
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_257d56ad8cb31970" hs_bindgen_257d56ad8cb31970_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+hs_bindgen_257d56ad8cb31970 ::
+     BG.Ptr (IsA.Elem E)
+  -> IO ()
+hs_bindgen_257d56ad8cb31970 =
+  \x0 ->
+    hs_bindgen_257d56ad8cb31970_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooE ::
+     BG.Ptr (IsA.Elem E)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_257d56ad8cb31970
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/Example/Unsafe.hs
@@ -0,0 +1,211 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/array.h>"
+  , "void hs_bindgen_969f916bf9590709 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_fb89f30695d9a112 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_6882cd6e82766148 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_97086d4192532ee4 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_ca769b1357fca61c ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_eea5d25f5323ea60 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_969f916bf9590709" hs_bindgen_969f916bf9590709_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+hs_bindgen_969f916bf9590709 ::
+     BG.Ptr (IsA.Elem MyArray)
+  -> IO ()
+hs_bindgen_969f916bf9590709 =
+  \x0 ->
+    hs_bindgen_969f916bf9590709_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem MyArray)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_969f916bf9590709
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_fb89f30695d9a112" hs_bindgen_fb89f30695d9a112_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+hs_bindgen_fb89f30695d9a112 ::
+     BG.Ptr (IsA.Elem A)
+  -> IO ()
+hs_bindgen_fb89f30695d9a112 =
+  \x0 ->
+    hs_bindgen_fb89f30695d9a112_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooA ::
+     BG.Ptr (IsA.Elem A)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_fb89f30695d9a112
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_6882cd6e82766148" hs_bindgen_6882cd6e82766148_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+hs_bindgen_6882cd6e82766148 ::
+     BG.Ptr (IsA.Elem B)
+  -> IO ()
+hs_bindgen_6882cd6e82766148 =
+  \x0 ->
+    hs_bindgen_6882cd6e82766148_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooB ::
+     BG.Ptr (IsA.Elem B)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_6882cd6e82766148
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_97086d4192532ee4" hs_bindgen_97086d4192532ee4_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+hs_bindgen_97086d4192532ee4 ::
+     BG.Ptr (IsA.Elem M.C)
+  -> IO ()
+hs_bindgen_97086d4192532ee4 =
+  \x0 ->
+    hs_bindgen_97086d4192532ee4_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooC ::
+     BG.Ptr (IsA.Elem M.C)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_97086d4192532ee4
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_ca769b1357fca61c" hs_bindgen_ca769b1357fca61c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+hs_bindgen_ca769b1357fca61c ::
+     BG.Ptr (IsA.Elem M.D)
+  -> IO ()
+hs_bindgen_ca769b1357fca61c =
+  \x0 ->
+    hs_bindgen_ca769b1357fca61c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooD ::
+     BG.Ptr (IsA.Elem M.D)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_ca769b1357fca61c
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_eea5d25f5323ea60" hs_bindgen_eea5d25f5323ea60_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+hs_bindgen_eea5d25f5323ea60 ::
+     BG.Ptr (IsA.Elem E)
+  -> IO ()
+hs_bindgen_eea5d25f5323ea60 =
+  \x0 ->
+    hs_bindgen_eea5d25f5323ea60_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooE ::
+     BG.Ptr (IsA.Elem E)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_eea5d25f5323ea60
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/bindingspec.yaml
@@ -0,0 +1,75 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/macro/array.h
+  cname: MyArray
+  hsname: MyArray
+- headers: binding-specs/fun_arg/macro/array.h
+  cname: macro A
+  hsname: A
+- headers: binding-specs/fun_arg/macro/array.h
+  cname: macro B
+  hsname: B
+- headers: binding-specs/fun_arg/macro/array.h
+  cname: macro E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyArray
+  representation:
+    newtype:
+      constructor: MyArray
+      fields:
+      - unwrapMyArray
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array/th.txt
@@ -0,0 +1,593 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/macro/array.h
+-- #include <binding-specs/fun_arg/macro/array.h>
+-- void hs_bindgen_2a6ef3a515232132 (
+--   signed int *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_4449a68917cbc499 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_05766199d1b077bb (
+--   signed int *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_adeb3a183d6676ee (
+--   signed int *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_e9321a5f27f4381e (
+--   signed int *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_257d56ad8cb31970 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_969f916bf9590709 (
+--   signed int *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_fb89f30695d9a112 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_6882cd6e82766148 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_97086d4192532ee4 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_ca769b1357fca61c (
+--   signed int *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_eea5d25f5323ea60 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fc9d87cbca4127e4 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0dbc306c53c94679 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_db0d885ae35d447f (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_82d6fdd972810bf4 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_398c495511ffe384 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b74f6af23eb996c3 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @MyArray@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 5:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+newtype MyArray
+    = MyArray {unwrapMyArray :: (IncompleteArray CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapMyArray" MyArray ty
+    where hasField = \x_0 -> (\y_1 -> MyArray{unwrapMyArray = y_1},
+                              getField @"unwrapMyArray" x_0)
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapMyArray" (Ptr MyArray) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyArray")
+instance HasCField MyArray "unwrapMyArray"
+    where type CFieldType MyArray
+                          "unwrapMyArray" = IncompleteArray CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+newtype A
+    = A {unwrapA :: MyArray}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty MyArray => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyArray => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyArray
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_2a6ef3a515232132" hs_bindgen_2a6ef3a515232132_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+hs_bindgen_2a6ef3a515232132 :: Ptr (Elem MyArray) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+hs_bindgen_2a6ef3a515232132 = \x_0 -> hs_bindgen_2a6ef3a515232132_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+foo_safe :: Ptr (Elem MyArray) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+foo_safe = hs_bindgen_2a6ef3a515232132
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_4449a68917cbc499" hs_bindgen_4449a68917cbc499_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+hs_bindgen_4449a68917cbc499 :: Ptr (Elem A) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+hs_bindgen_4449a68917cbc499 = \x_0 -> hs_bindgen_4449a68917cbc499_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooA_safe :: Ptr (Elem A) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooA_safe = hs_bindgen_4449a68917cbc499
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_05766199d1b077bb" hs_bindgen_05766199d1b077bb_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+hs_bindgen_05766199d1b077bb :: Ptr (Elem B) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+hs_bindgen_05766199d1b077bb = \x_0 -> hs_bindgen_05766199d1b077bb_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooB_safe :: Ptr (Elem B) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooB_safe = hs_bindgen_05766199d1b077bb
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_adeb3a183d6676ee" hs_bindgen_adeb3a183d6676ee_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+hs_bindgen_adeb3a183d6676ee :: Ptr (Elem M.C) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+hs_bindgen_adeb3a183d6676ee = \x_0 -> hs_bindgen_adeb3a183d6676ee_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooC_safe :: Ptr (Elem M.C) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooC_safe = hs_bindgen_adeb3a183d6676ee
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_e9321a5f27f4381e" hs_bindgen_e9321a5f27f4381e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+hs_bindgen_e9321a5f27f4381e :: Ptr (Elem M.D) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+hs_bindgen_e9321a5f27f4381e = \x_0 -> hs_bindgen_e9321a5f27f4381e_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooD_safe :: Ptr (Elem M.D) -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooD_safe = hs_bindgen_e9321a5f27f4381e
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_257d56ad8cb31970" hs_bindgen_257d56ad8cb31970_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+hs_bindgen_257d56ad8cb31970 :: Ptr (Elem E) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+hs_bindgen_257d56ad8cb31970 = \x_0 -> hs_bindgen_257d56ad8cb31970_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooE_safe :: Ptr (Elem E) -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooE_safe = hs_bindgen_257d56ad8cb31970
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_969f916bf9590709" hs_bindgen_969f916bf9590709_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+hs_bindgen_969f916bf9590709 :: Ptr (Elem MyArray) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+hs_bindgen_969f916bf9590709 = \x_0 -> hs_bindgen_969f916bf9590709_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+foo_unsafe :: Ptr (Elem MyArray) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+foo_unsafe = hs_bindgen_969f916bf9590709
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_fb89f30695d9a112" hs_bindgen_fb89f30695d9a112_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+hs_bindgen_fb89f30695d9a112 :: Ptr (Elem A) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+hs_bindgen_fb89f30695d9a112 = \x_0 -> hs_bindgen_fb89f30695d9a112_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooA_unsafe :: Ptr (Elem A) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooA_unsafe = hs_bindgen_fb89f30695d9a112
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_6882cd6e82766148" hs_bindgen_6882cd6e82766148_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+hs_bindgen_6882cd6e82766148 :: Ptr (Elem B) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+hs_bindgen_6882cd6e82766148 = \x_0 -> hs_bindgen_6882cd6e82766148_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooB_unsafe :: Ptr (Elem B) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooB_unsafe = hs_bindgen_6882cd6e82766148
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_97086d4192532ee4" hs_bindgen_97086d4192532ee4_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+hs_bindgen_97086d4192532ee4 :: Ptr (Elem M.C) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+hs_bindgen_97086d4192532ee4 = \x_0 -> hs_bindgen_97086d4192532ee4_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooC_unsafe :: Ptr (Elem M.C) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooC_unsafe = hs_bindgen_97086d4192532ee4
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_ca769b1357fca61c" hs_bindgen_ca769b1357fca61c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+hs_bindgen_ca769b1357fca61c :: Ptr (Elem M.D) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+hs_bindgen_ca769b1357fca61c = \x_0 -> hs_bindgen_ca769b1357fca61c_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooD_unsafe :: Ptr (Elem M.D) -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooD_unsafe = hs_bindgen_ca769b1357fca61c
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_eea5d25f5323ea60" hs_bindgen_eea5d25f5323ea60_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+hs_bindgen_eea5d25f5323ea60 :: Ptr (Elem E) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+hs_bindgen_eea5d25f5323ea60 = \x_0 -> hs_bindgen_eea5d25f5323ea60_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooE_unsafe :: Ptr (Elem E) -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooE_unsafe = hs_bindgen_eea5d25f5323ea60
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_fc9d87cbca4127e4" hs_bindgen_fc9d87cbca4127e4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+hs_bindgen_fc9d87cbca4127e4 :: IO (FunPtr (Ptr (Elem MyArray) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+hs_bindgen_fc9d87cbca4127e4 = fmap fromFFIType hs_bindgen_fc9d87cbca4127e4_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+foo_funptr :: FunPtr (Ptr (Elem MyArray) -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_fc9d87cbca4127e4
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_0dbc306c53c94679" hs_bindgen_0dbc306c53c94679_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+hs_bindgen_0dbc306c53c94679 :: IO (FunPtr (Ptr (Elem A) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+hs_bindgen_0dbc306c53c94679 = fmap fromFFIType hs_bindgen_0dbc306c53c94679_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooA_funptr :: FunPtr (Ptr (Elem A) -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_0dbc306c53c94679
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_db0d885ae35d447f" hs_bindgen_db0d885ae35d447f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+hs_bindgen_db0d885ae35d447f :: IO (FunPtr (Ptr (Elem B) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+hs_bindgen_db0d885ae35d447f = fmap fromFFIType hs_bindgen_db0d885ae35d447f_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooB_funptr :: FunPtr (Ptr (Elem B) -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_db0d885ae35d447f
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_82d6fdd972810bf4" hs_bindgen_82d6fdd972810bf4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+hs_bindgen_82d6fdd972810bf4 :: IO (FunPtr (Ptr (Elem M.C) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+hs_bindgen_82d6fdd972810bf4 = fmap fromFFIType hs_bindgen_82d6fdd972810bf4_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooC_funptr :: FunPtr (Ptr (Elem M.C) -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_82d6fdd972810bf4
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_398c495511ffe384" hs_bindgen_398c495511ffe384_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+hs_bindgen_398c495511ffe384 :: IO (FunPtr (Ptr (Elem M.D) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+hs_bindgen_398c495511ffe384 = fmap fromFFIType hs_bindgen_398c495511ffe384_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooD_funptr :: FunPtr (Ptr (Elem M.D) -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_398c495511ffe384
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_b74f6af23eb996c3" hs_bindgen_b74f6af23eb996c3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+hs_bindgen_b74f6af23eb996c3 :: IO (FunPtr (Ptr (Elem E) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+hs_bindgen_b74f6af23eb996c3 = fmap fromFFIType hs_bindgen_b74f6af23eb996c3_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooE_funptr :: FunPtr (Ptr (Elem E) -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_b74f6af23eb996c3
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example.hs
@@ -0,0 +1,164 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyArray(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (Eq, Show, type (~))
+
+{-| __C declaration:__ @MyArray@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 5:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+newtype MyArray = MyArray
+  { unwrapMyArray :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyArray" MyArray ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyArray {unwrapMyArray = y1}, BG.getField @"unwrapMyArray" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapMyArray" (BG.Ptr MyArray) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyArray")
+
+instance HasCField.HasCField MyArray "unwrapMyArray" where
+
+  type CFieldType MyArray "unwrapMyArray" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+newtype A = A
+  { unwrapA :: MyArray
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ MyArray) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ MyArray) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyArray
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example/FunPtr.hs
@@ -0,0 +1,187 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/array_known_size.h>"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fc9d87cbca4127e4 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0dbc306c53c94679 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_db0d885ae35d447f (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_82d6fdd972810bf4 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_398c495511ffe384 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroar_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b74f6af23eb996c3 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_fc9d87cbca4127e4" hs_bindgen_fc9d87cbca4127e4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+hs_bindgen_fc9d87cbca4127e4 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem MyArray) -> IO ()))
+hs_bindgen_fc9d87cbca4127e4 =
+  fmap BG.fromFFIType hs_bindgen_fc9d87cbca4127e4_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+foo :: BG.FunPtr (BG.Ptr (IsA.Elem MyArray) -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_fc9d87cbca4127e4
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_0dbc306c53c94679" hs_bindgen_0dbc306c53c94679_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+hs_bindgen_0dbc306c53c94679 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem A) -> IO ()))
+hs_bindgen_0dbc306c53c94679 =
+  fmap BG.fromFFIType hs_bindgen_0dbc306c53c94679_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooA :: BG.FunPtr (BG.Ptr (IsA.Elem A) -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_0dbc306c53c94679
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_db0d885ae35d447f" hs_bindgen_db0d885ae35d447f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+hs_bindgen_db0d885ae35d447f :: IO (BG.FunPtr (BG.Ptr (IsA.Elem B) -> IO ()))
+hs_bindgen_db0d885ae35d447f =
+  fmap BG.fromFFIType hs_bindgen_db0d885ae35d447f_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooB :: BG.FunPtr (BG.Ptr (IsA.Elem B) -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_db0d885ae35d447f
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_82d6fdd972810bf4" hs_bindgen_82d6fdd972810bf4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+hs_bindgen_82d6fdd972810bf4 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem M.C) -> IO ()))
+hs_bindgen_82d6fdd972810bf4 =
+  fmap BG.fromFFIType hs_bindgen_82d6fdd972810bf4_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooC :: BG.FunPtr (BG.Ptr (IsA.Elem M.C) -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_82d6fdd972810bf4
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_398c495511ffe384" hs_bindgen_398c495511ffe384_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+hs_bindgen_398c495511ffe384 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem M.D) -> IO ()))
+hs_bindgen_398c495511ffe384 =
+  fmap BG.fromFFIType hs_bindgen_398c495511ffe384_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooD :: BG.FunPtr (BG.Ptr (IsA.Elem M.D) -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_398c495511ffe384
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_b74f6af23eb996c3" hs_bindgen_b74f6af23eb996c3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+hs_bindgen_b74f6af23eb996c3 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem E) -> IO ()))
+hs_bindgen_b74f6af23eb996c3 =
+  fmap BG.fromFFIType hs_bindgen_b74f6af23eb996c3_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooE :: BG.FunPtr (BG.Ptr (IsA.Elem E) -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_b74f6af23eb996c3
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example/Safe.hs
@@ -0,0 +1,211 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/array_known_size.h>"
+  , "void hs_bindgen_2a6ef3a515232132 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_4449a68917cbc499 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_05766199d1b077bb ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_adeb3a183d6676ee ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_e9321a5f27f4381e ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_257d56ad8cb31970 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_2a6ef3a515232132" hs_bindgen_2a6ef3a515232132_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+hs_bindgen_2a6ef3a515232132 ::
+     BG.Ptr (IsA.Elem MyArray)
+  -> IO ()
+hs_bindgen_2a6ef3a515232132 =
+  \x0 ->
+    hs_bindgen_2a6ef3a515232132_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem MyArray)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_2a6ef3a515232132
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_4449a68917cbc499" hs_bindgen_4449a68917cbc499_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+hs_bindgen_4449a68917cbc499 ::
+     BG.Ptr (IsA.Elem A)
+  -> IO ()
+hs_bindgen_4449a68917cbc499 =
+  \x0 ->
+    hs_bindgen_4449a68917cbc499_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooA ::
+     BG.Ptr (IsA.Elem A)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_4449a68917cbc499
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_05766199d1b077bb" hs_bindgen_05766199d1b077bb_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+hs_bindgen_05766199d1b077bb ::
+     BG.Ptr (IsA.Elem B)
+  -> IO ()
+hs_bindgen_05766199d1b077bb =
+  \x0 ->
+    hs_bindgen_05766199d1b077bb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooB ::
+     BG.Ptr (IsA.Elem B)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_05766199d1b077bb
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_adeb3a183d6676ee" hs_bindgen_adeb3a183d6676ee_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+hs_bindgen_adeb3a183d6676ee ::
+     BG.Ptr (IsA.Elem M.C)
+  -> IO ()
+hs_bindgen_adeb3a183d6676ee =
+  \x0 ->
+    hs_bindgen_adeb3a183d6676ee_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooC ::
+     BG.Ptr (IsA.Elem M.C)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_adeb3a183d6676ee
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_e9321a5f27f4381e" hs_bindgen_e9321a5f27f4381e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+hs_bindgen_e9321a5f27f4381e ::
+     BG.Ptr (IsA.Elem M.D)
+  -> IO ()
+hs_bindgen_e9321a5f27f4381e =
+  \x0 ->
+    hs_bindgen_e9321a5f27f4381e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooD ::
+     BG.Ptr (IsA.Elem M.D)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_e9321a5f27f4381e
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_257d56ad8cb31970" hs_bindgen_257d56ad8cb31970_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+hs_bindgen_257d56ad8cb31970 ::
+     BG.Ptr (IsA.Elem E)
+  -> IO ()
+hs_bindgen_257d56ad8cb31970 =
+  \x0 ->
+    hs_bindgen_257d56ad8cb31970_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooE ::
+     BG.Ptr (IsA.Elem E)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_257d56ad8cb31970
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/Example/Unsafe.hs
@@ -0,0 +1,211 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/array_known_size.h>"
+  , "void hs_bindgen_969f916bf9590709 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_fb89f30695d9a112 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_6882cd6e82766148 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_97086d4192532ee4 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_ca769b1357fca61c ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_eea5d25f5323ea60 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_969f916bf9590709" hs_bindgen_969f916bf9590709_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+hs_bindgen_969f916bf9590709 ::
+     BG.Ptr (IsA.Elem MyArray)
+  -> IO ()
+hs_bindgen_969f916bf9590709 =
+  \x0 ->
+    hs_bindgen_969f916bf9590709_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem MyArray)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_969f916bf9590709
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_fb89f30695d9a112" hs_bindgen_fb89f30695d9a112_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+hs_bindgen_fb89f30695d9a112 ::
+     BG.Ptr (IsA.Elem A)
+  -> IO ()
+hs_bindgen_fb89f30695d9a112 =
+  \x0 ->
+    hs_bindgen_fb89f30695d9a112_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooA ::
+     BG.Ptr (IsA.Elem A)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_fb89f30695d9a112
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_6882cd6e82766148" hs_bindgen_6882cd6e82766148_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+hs_bindgen_6882cd6e82766148 ::
+     BG.Ptr (IsA.Elem B)
+  -> IO ()
+hs_bindgen_6882cd6e82766148 =
+  \x0 ->
+    hs_bindgen_6882cd6e82766148_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooB ::
+     BG.Ptr (IsA.Elem B)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_6882cd6e82766148
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_97086d4192532ee4" hs_bindgen_97086d4192532ee4_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+hs_bindgen_97086d4192532ee4 ::
+     BG.Ptr (IsA.Elem M.C)
+  -> IO ()
+hs_bindgen_97086d4192532ee4 =
+  \x0 ->
+    hs_bindgen_97086d4192532ee4_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooC ::
+     BG.Ptr (IsA.Elem M.C)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_97086d4192532ee4
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_ca769b1357fca61c" hs_bindgen_ca769b1357fca61c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+hs_bindgen_ca769b1357fca61c ::
+     BG.Ptr (IsA.Elem M.D)
+  -> IO ()
+hs_bindgen_ca769b1357fca61c =
+  \x0 ->
+    hs_bindgen_ca769b1357fca61c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooD ::
+     BG.Ptr (IsA.Elem M.D)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_ca769b1357fca61c
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_eea5d25f5323ea60" hs_bindgen_eea5d25f5323ea60_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+hs_bindgen_eea5d25f5323ea60 ::
+     BG.Ptr (IsA.Elem E)
+  -> IO ()
+hs_bindgen_eea5d25f5323ea60 =
+  \x0 ->
+    hs_bindgen_eea5d25f5323ea60_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooE ::
+     BG.Ptr (IsA.Elem E)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_eea5d25f5323ea60
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/bindingspec.yaml
@@ -0,0 +1,87 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/macro/array_known_size.h
+  cname: MyArray
+  hsname: MyArray
+- headers: binding-specs/fun_arg/macro/array_known_size.h
+  cname: macro A
+  hsname: A
+- headers: binding-specs/fun_arg/macro/array_known_size.h
+  cname: macro B
+  hsname: B
+- headers: binding-specs/fun_arg/macro/array_known_size.h
+  cname: macro E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyArray
+  representation:
+    newtype:
+      constructor: MyArray
+      fields:
+      - unwrapMyArray
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/array_known_size/th.txt
@@ -0,0 +1,593 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/macro/array_known_size.h
+-- #include <binding-specs/fun_arg/macro/array_known_size.h>
+-- void hs_bindgen_2a6ef3a515232132 (
+--   signed int *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_4449a68917cbc499 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_05766199d1b077bb (
+--   signed int *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_adeb3a183d6676ee (
+--   signed int *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_e9321a5f27f4381e (
+--   signed int *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_257d56ad8cb31970 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_969f916bf9590709 (
+--   signed int *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_fb89f30695d9a112 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_6882cd6e82766148 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_97086d4192532ee4 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_ca769b1357fca61c (
+--   signed int *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_eea5d25f5323ea60 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fc9d87cbca4127e4 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0dbc306c53c94679 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_db0d885ae35d447f (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_82d6fdd972810bf4 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_398c495511ffe384 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argmacroar_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b74f6af23eb996c3 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @MyArray@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 5:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+newtype MyArray
+    = MyArray {unwrapMyArray :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapMyArray" MyArray ty
+    where hasField = \x_0 -> (\y_1 -> MyArray{unwrapMyArray = y_1},
+                              getField @"unwrapMyArray" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapMyArray" (Ptr MyArray) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyArray")
+instance HasCField MyArray "unwrapMyArray"
+    where type CFieldType MyArray "unwrapMyArray" = ConstantArray 3
+                                                                  CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+newtype A
+    = A {unwrapA :: MyArray}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty MyArray => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyArray => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyArray
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_2a6ef3a515232132" hs_bindgen_2a6ef3a515232132_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+hs_bindgen_2a6ef3a515232132 :: Ptr (Elem MyArray) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_foo@
+hs_bindgen_2a6ef3a515232132 = \x_0 -> hs_bindgen_2a6ef3a515232132_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+foo_safe :: Ptr (Elem MyArray) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+foo_safe = hs_bindgen_2a6ef3a515232132
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_4449a68917cbc499" hs_bindgen_4449a68917cbc499_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+hs_bindgen_4449a68917cbc499 :: Ptr (Elem A) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooA@
+hs_bindgen_4449a68917cbc499 = \x_0 -> hs_bindgen_4449a68917cbc499_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooA_safe :: Ptr (Elem A) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooA_safe = hs_bindgen_4449a68917cbc499
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_05766199d1b077bb" hs_bindgen_05766199d1b077bb_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+hs_bindgen_05766199d1b077bb :: Ptr (Elem B) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooB@
+hs_bindgen_05766199d1b077bb = \x_0 -> hs_bindgen_05766199d1b077bb_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooB_safe :: Ptr (Elem B) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooB_safe = hs_bindgen_05766199d1b077bb
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_adeb3a183d6676ee" hs_bindgen_adeb3a183d6676ee_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+hs_bindgen_adeb3a183d6676ee :: Ptr (Elem M.C) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooC@
+hs_bindgen_adeb3a183d6676ee = \x_0 -> hs_bindgen_adeb3a183d6676ee_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooC_safe :: Ptr (Elem M.C) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooC_safe = hs_bindgen_adeb3a183d6676ee
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_e9321a5f27f4381e" hs_bindgen_e9321a5f27f4381e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+hs_bindgen_e9321a5f27f4381e :: Ptr (Elem M.D) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooD@
+hs_bindgen_e9321a5f27f4381e = \x_0 -> hs_bindgen_e9321a5f27f4381e_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooD_safe :: Ptr (Elem M.D) -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooD_safe = hs_bindgen_e9321a5f27f4381e
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_257d56ad8cb31970" hs_bindgen_257d56ad8cb31970_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+hs_bindgen_257d56ad8cb31970 :: Ptr (Elem E) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Safe_fooE@
+hs_bindgen_257d56ad8cb31970 = \x_0 -> hs_bindgen_257d56ad8cb31970_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooE_safe :: Ptr (Elem E) -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooE_safe = hs_bindgen_257d56ad8cb31970
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_969f916bf9590709" hs_bindgen_969f916bf9590709_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+hs_bindgen_969f916bf9590709 :: Ptr (Elem MyArray) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_foo@
+hs_bindgen_969f916bf9590709 = \x_0 -> hs_bindgen_969f916bf9590709_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+foo_unsafe :: Ptr (Elem MyArray) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+foo_unsafe = hs_bindgen_969f916bf9590709
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_fb89f30695d9a112" hs_bindgen_fb89f30695d9a112_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+hs_bindgen_fb89f30695d9a112 :: Ptr (Elem A) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooA@
+hs_bindgen_fb89f30695d9a112 = \x_0 -> hs_bindgen_fb89f30695d9a112_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooA_unsafe :: Ptr (Elem A) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooA_unsafe = hs_bindgen_fb89f30695d9a112
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_6882cd6e82766148" hs_bindgen_6882cd6e82766148_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+hs_bindgen_6882cd6e82766148 :: Ptr (Elem B) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooB@
+hs_bindgen_6882cd6e82766148 = \x_0 -> hs_bindgen_6882cd6e82766148_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooB_unsafe :: Ptr (Elem B) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooB_unsafe = hs_bindgen_6882cd6e82766148
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_97086d4192532ee4" hs_bindgen_97086d4192532ee4_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+hs_bindgen_97086d4192532ee4 :: Ptr (Elem M.C) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooC@
+hs_bindgen_97086d4192532ee4 = \x_0 -> hs_bindgen_97086d4192532ee4_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooC_unsafe :: Ptr (Elem M.C) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooC_unsafe = hs_bindgen_97086d4192532ee4
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_ca769b1357fca61c" hs_bindgen_ca769b1357fca61c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+hs_bindgen_ca769b1357fca61c :: Ptr (Elem M.D) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooD@
+hs_bindgen_ca769b1357fca61c = \x_0 -> hs_bindgen_ca769b1357fca61c_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooD_unsafe :: Ptr (Elem M.D) -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooD_unsafe = hs_bindgen_ca769b1357fca61c
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_eea5d25f5323ea60" hs_bindgen_eea5d25f5323ea60_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+hs_bindgen_eea5d25f5323ea60 :: Ptr (Elem E) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_Unsafe_fooE@
+hs_bindgen_eea5d25f5323ea60 = \x_0 -> hs_bindgen_eea5d25f5323ea60_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooE_unsafe :: Ptr (Elem E) -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooE_unsafe = hs_bindgen_eea5d25f5323ea60
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_fc9d87cbca4127e4" hs_bindgen_fc9d87cbca4127e4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+hs_bindgen_fc9d87cbca4127e4 :: IO (FunPtr (Ptr (Elem MyArray) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_foo@
+hs_bindgen_fc9d87cbca4127e4 = fmap fromFFIType hs_bindgen_fc9d87cbca4127e4_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+foo_funptr :: FunPtr (Ptr (Elem MyArray) -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_fc9d87cbca4127e4
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_0dbc306c53c94679" hs_bindgen_0dbc306c53c94679_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+hs_bindgen_0dbc306c53c94679 :: IO (FunPtr (Ptr (Elem A) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooA@
+hs_bindgen_0dbc306c53c94679 = fmap fromFFIType hs_bindgen_0dbc306c53c94679_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooA_funptr :: FunPtr (Ptr (Elem A) -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_0dbc306c53c94679
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_db0d885ae35d447f" hs_bindgen_db0d885ae35d447f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+hs_bindgen_db0d885ae35d447f :: IO (FunPtr (Ptr (Elem B) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooB@
+hs_bindgen_db0d885ae35d447f = fmap fromFFIType hs_bindgen_db0d885ae35d447f_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooB_funptr :: FunPtr (Ptr (Elem B) -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_db0d885ae35d447f
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_82d6fdd972810bf4" hs_bindgen_82d6fdd972810bf4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+hs_bindgen_82d6fdd972810bf4 :: IO (FunPtr (Ptr (Elem M.C) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooC@
+hs_bindgen_82d6fdd972810bf4 = fmap fromFFIType hs_bindgen_82d6fdd972810bf4_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooC_funptr :: FunPtr (Ptr (Elem M.C) -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_82d6fdd972810bf4
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_398c495511ffe384" hs_bindgen_398c495511ffe384_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+hs_bindgen_398c495511ffe384 :: IO (FunPtr (Ptr (Elem M.D) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooD@
+hs_bindgen_398c495511ffe384 = fmap fromFFIType hs_bindgen_398c495511ffe384_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooD_funptr :: FunPtr (Ptr (Elem M.D) -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_398c495511ffe384
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_b74f6af23eb996c3" hs_bindgen_b74f6af23eb996c3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+hs_bindgen_b74f6af23eb996c3 :: IO (FunPtr (Ptr (Elem E) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroar_Example_get_fooE@
+hs_bindgen_b74f6af23eb996c3 = fmap fromFFIType hs_bindgen_b74f6af23eb996c3_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooE_funptr :: FunPtr (Ptr (Elem E) -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/array_known_size.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/array_known_size.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_b74f6af23eb996c3
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example.hs
@@ -0,0 +1,238 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyEnum(..)
+    , pattern Example.X
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum MyEnum@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+newtype MyEnum = MyEnum
+  { unwrapMyEnum :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize MyEnum where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw MyEnum where
+
+  readRaw =
+    \ptr0 ->
+          pure MyEnum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw MyEnum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MyEnum unwrapMyEnum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapMyEnum2
+
+deriving via Marshal.EquivStorable MyEnum instance BG.Storable MyEnum
+
+deriving via BG.CUInt instance BG.Prim MyEnum
+
+instance CEnum.CEnum MyEnum where
+
+  type CEnumZ MyEnum = BG.CUInt
+
+  toCEnum = MyEnum
+
+  fromCEnum = BG.getField @"unwrapMyEnum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "MyEnum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "MyEnum"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum MyEnum where
+
+  minDeclaredValue = X
+
+  maxDeclaredValue = X
+
+instance Show MyEnum where
+
+  showsPrec = CEnum.shows
+
+instance Read MyEnum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapMyEnum" MyEnum ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyEnum {unwrapMyEnum = y1}, BG.getField @"unwrapMyEnum" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapMyEnum" (BG.Ptr MyEnum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyEnum")
+
+instance HasCField.HasCField MyEnum "unwrapMyEnum" where
+
+  type CFieldType MyEnum "unwrapMyEnum" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 5:14@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+pattern X :: MyEnum
+pattern X = MyEnum 0
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+newtype A = A
+  { unwrapA :: MyEnum
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ MyEnum) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ MyEnum) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyEnum
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example/FunPtr.hs
@@ -0,0 +1,186 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/enum.h>"
+  , "/* test_bindingspecsfun_argmacroen_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_098964a440956602 (void)) ("
+  , "  enum MyEnum arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroen_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_86b685b9d27ce50e (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroen_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9383ae52414c2c19 (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroen_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e677debf9f8f8884 (void)) ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroen_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7d8aecf79b372251 (void)) ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroen_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_24fe84901d848b4c (void)) ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_098964a440956602" hs_bindgen_098964a440956602_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_foo@
+hs_bindgen_098964a440956602 :: IO (BG.FunPtr (MyEnum -> IO ()))
+hs_bindgen_098964a440956602 =
+  fmap BG.fromFFIType hs_bindgen_098964a440956602_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+foo :: BG.FunPtr (MyEnum -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_098964a440956602
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_86b685b9d27ce50e" hs_bindgen_86b685b9d27ce50e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooA@
+hs_bindgen_86b685b9d27ce50e :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_86b685b9d27ce50e =
+  fmap BG.fromFFIType hs_bindgen_86b685b9d27ce50e_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooA :: BG.FunPtr (A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_86b685b9d27ce50e
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_9383ae52414c2c19" hs_bindgen_9383ae52414c2c19_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooB@
+hs_bindgen_9383ae52414c2c19 :: IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_9383ae52414c2c19 =
+  fmap BG.fromFFIType hs_bindgen_9383ae52414c2c19_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooB :: BG.FunPtr (B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_9383ae52414c2c19
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_e677debf9f8f8884" hs_bindgen_e677debf9f8f8884_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooC@
+hs_bindgen_e677debf9f8f8884 :: IO (BG.FunPtr (M.C -> IO ()))
+hs_bindgen_e677debf9f8f8884 =
+  fmap BG.fromFFIType hs_bindgen_e677debf9f8f8884_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooC :: BG.FunPtr (M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_e677debf9f8f8884
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_7d8aecf79b372251" hs_bindgen_7d8aecf79b372251_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooD@
+hs_bindgen_7d8aecf79b372251 :: IO (BG.FunPtr (M.D -> IO ()))
+hs_bindgen_7d8aecf79b372251 =
+  fmap BG.fromFFIType hs_bindgen_7d8aecf79b372251_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooD :: BG.FunPtr (M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_7d8aecf79b372251
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_24fe84901d848b4c" hs_bindgen_24fe84901d848b4c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooE@
+hs_bindgen_24fe84901d848b4c :: IO (BG.FunPtr (E -> IO ()))
+hs_bindgen_24fe84901d848b4c =
+  fmap BG.fromFFIType hs_bindgen_24fe84901d848b4c_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooE :: BG.FunPtr (E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_24fe84901d848b4c
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example/Safe.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/enum.h>"
+  , "void hs_bindgen_d49a011eb7da5969 ("
+  , "  enum MyEnum arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_32c6f6f9bb440690 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_16e7856908d06f71 ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_2ebd95eb71d88a64 ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_deddaf3108b305bb ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_9ed085d5f2e5837e ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_d49a011eb7da5969" hs_bindgen_d49a011eb7da5969_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_foo@
+hs_bindgen_d49a011eb7da5969 ::
+     MyEnum
+  -> IO ()
+hs_bindgen_d49a011eb7da5969 =
+  \x0 ->
+    hs_bindgen_d49a011eb7da5969_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+foo ::
+     MyEnum
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_d49a011eb7da5969
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_32c6f6f9bb440690" hs_bindgen_32c6f6f9bb440690_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooA@
+hs_bindgen_32c6f6f9bb440690 ::
+     A
+  -> IO ()
+hs_bindgen_32c6f6f9bb440690 =
+  \x0 ->
+    hs_bindgen_32c6f6f9bb440690_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_32c6f6f9bb440690
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_16e7856908d06f71" hs_bindgen_16e7856908d06f71_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooB@
+hs_bindgen_16e7856908d06f71 ::
+     B
+  -> IO ()
+hs_bindgen_16e7856908d06f71 =
+  \x0 ->
+    hs_bindgen_16e7856908d06f71_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_16e7856908d06f71
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_2ebd95eb71d88a64" hs_bindgen_2ebd95eb71d88a64_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooC@
+hs_bindgen_2ebd95eb71d88a64 ::
+     M.C
+  -> IO ()
+hs_bindgen_2ebd95eb71d88a64 =
+  \x0 ->
+    hs_bindgen_2ebd95eb71d88a64_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_2ebd95eb71d88a64
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_deddaf3108b305bb" hs_bindgen_deddaf3108b305bb_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooD@
+hs_bindgen_deddaf3108b305bb ::
+     M.D
+  -> IO ()
+hs_bindgen_deddaf3108b305bb =
+  \x0 ->
+    hs_bindgen_deddaf3108b305bb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_deddaf3108b305bb
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_9ed085d5f2e5837e" hs_bindgen_9ed085d5f2e5837e_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooE@
+hs_bindgen_9ed085d5f2e5837e ::
+     E
+  -> IO ()
+hs_bindgen_9ed085d5f2e5837e =
+  \x0 ->
+    hs_bindgen_9ed085d5f2e5837e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_9ed085d5f2e5837e
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/Example/Unsafe.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/enum.h>"
+  , "void hs_bindgen_0e6b98e93cad73ef ("
+  , "  enum MyEnum arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_1c6de1b89014dc52 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_a8e579f3b5035c03 ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_00ad8122da6609fc ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_2be41098f80a9019 ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_07241b4b6cbf2991 ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_0e6b98e93cad73ef" hs_bindgen_0e6b98e93cad73ef_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_foo@
+hs_bindgen_0e6b98e93cad73ef ::
+     MyEnum
+  -> IO ()
+hs_bindgen_0e6b98e93cad73ef =
+  \x0 ->
+    hs_bindgen_0e6b98e93cad73ef_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+foo ::
+     MyEnum
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_0e6b98e93cad73ef
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_1c6de1b89014dc52" hs_bindgen_1c6de1b89014dc52_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooA@
+hs_bindgen_1c6de1b89014dc52 ::
+     A
+  -> IO ()
+hs_bindgen_1c6de1b89014dc52 =
+  \x0 ->
+    hs_bindgen_1c6de1b89014dc52_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_1c6de1b89014dc52
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a8e579f3b5035c03" hs_bindgen_a8e579f3b5035c03_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooB@
+hs_bindgen_a8e579f3b5035c03 ::
+     B
+  -> IO ()
+hs_bindgen_a8e579f3b5035c03 =
+  \x0 ->
+    hs_bindgen_a8e579f3b5035c03_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_a8e579f3b5035c03
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_00ad8122da6609fc" hs_bindgen_00ad8122da6609fc_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooC@
+hs_bindgen_00ad8122da6609fc ::
+     M.C
+  -> IO ()
+hs_bindgen_00ad8122da6609fc =
+  \x0 ->
+    hs_bindgen_00ad8122da6609fc_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_00ad8122da6609fc
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_2be41098f80a9019" hs_bindgen_2be41098f80a9019_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooD@
+hs_bindgen_2be41098f80a9019 ::
+     M.D
+  -> IO ()
+hs_bindgen_2be41098f80a9019 =
+  \x0 ->
+    hs_bindgen_2be41098f80a9019_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_2be41098f80a9019
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_07241b4b6cbf2991" hs_bindgen_07241b4b6cbf2991_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooE@
+hs_bindgen_07241b4b6cbf2991 ::
+     E
+  -> IO ()
+hs_bindgen_07241b4b6cbf2991 =
+  \x0 ->
+    hs_bindgen_07241b4b6cbf2991_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_07241b4b6cbf2991
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/bindingspec.yaml
@@ -0,0 +1,102 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/macro/enum.h
+  cname: enum MyEnum
+  hsname: MyEnum
+  enum: open
+- headers: binding-specs/fun_arg/macro/enum.h
+  cname: macro A
+  hsname: A
+- headers: binding-specs/fun_arg/macro/enum.h
+  cname: macro B
+  hsname: B
+- headers: binding-specs/fun_arg/macro/enum.h
+  cname: macro E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyEnum
+  representation:
+    newtype:
+      constructor: MyEnum
+      fields:
+      - unwrapMyEnum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/enum/th.txt
@@ -0,0 +1,634 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/macro/enum.h
+-- #include <binding-specs/fun_arg/macro/enum.h>
+-- void hs_bindgen_d49a011eb7da5969 (
+--   enum MyEnum arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_32c6f6f9bb440690 (
+--   A arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_16e7856908d06f71 (
+--   B arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_2ebd95eb71d88a64 (
+--   C arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_deddaf3108b305bb (
+--   D arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_9ed085d5f2e5837e (
+--   E arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_0e6b98e93cad73ef (
+--   enum MyEnum arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_1c6de1b89014dc52 (
+--   A arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_a8e579f3b5035c03 (
+--   B arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_00ad8122da6609fc (
+--   C arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_2be41098f80a9019 (
+--   D arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_07241b4b6cbf2991 (
+--   E arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argmacroen_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_098964a440956602 (void)) (
+--   enum MyEnum arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argmacroen_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_86b685b9d27ce50e (void)) (
+--   A arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argmacroen_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9383ae52414c2c19 (void)) (
+--   B arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argmacroen_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e677debf9f8f8884 (void)) (
+--   C arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argmacroen_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7d8aecf79b372251 (void)) (
+--   D arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argmacroen_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_24fe84901d848b4c (void)) (
+--   E arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @enum MyEnum@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+newtype MyEnum
+    = MyEnum {unwrapMyEnum :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize MyEnum
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw MyEnum
+    where readRaw = \ptr_0 -> pure MyEnum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw MyEnum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MyEnum unwrapMyEnum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapMyEnum_2
+deriving via (EquivStorable MyEnum) instance Storable MyEnum
+deriving via CUInt instance Prim MyEnum
+instance CEnum MyEnum
+    where type CEnumZ MyEnum = CUInt
+          toCEnum = MyEnum
+          fromCEnum = getField @"unwrapMyEnum"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "X")]
+          showsUndeclared = showsWrappedUndeclared "MyEnum"
+          readPrecUndeclared = readPrecWrappedUndeclared "MyEnum"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum MyEnum
+    where minDeclaredValue = X
+          maxDeclaredValue = X
+instance Show MyEnum
+    where showsPrec = shows
+instance Read MyEnum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapMyEnum" MyEnum ty
+    where hasField = \x_0 -> (\y_1 -> MyEnum{unwrapMyEnum = y_1},
+                              getField @"unwrapMyEnum" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapMyEnum" (Ptr MyEnum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyEnum")
+instance HasCField MyEnum "unwrapMyEnum"
+    where type CFieldType MyEnum "unwrapMyEnum" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 5:14@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+pattern X :: MyEnum
+pattern X = MyEnum 0
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+newtype A
+    = A {unwrapA :: MyEnum}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty MyEnum => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyEnum => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyEnum
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_d49a011eb7da5969" hs_bindgen_d49a011eb7da5969_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_foo@
+hs_bindgen_d49a011eb7da5969 :: MyEnum -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_foo@
+hs_bindgen_d49a011eb7da5969 = \x_0 -> hs_bindgen_d49a011eb7da5969_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+foo_safe :: MyEnum -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+foo_safe = hs_bindgen_d49a011eb7da5969
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_32c6f6f9bb440690" hs_bindgen_32c6f6f9bb440690_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooA@
+hs_bindgen_32c6f6f9bb440690 :: A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooA@
+hs_bindgen_32c6f6f9bb440690 = \x_0 -> hs_bindgen_32c6f6f9bb440690_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooA_safe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooA_safe = hs_bindgen_32c6f6f9bb440690
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_16e7856908d06f71" hs_bindgen_16e7856908d06f71_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooB@
+hs_bindgen_16e7856908d06f71 :: B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooB@
+hs_bindgen_16e7856908d06f71 = \x_0 -> hs_bindgen_16e7856908d06f71_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooB_safe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooB_safe = hs_bindgen_16e7856908d06f71
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_2ebd95eb71d88a64" hs_bindgen_2ebd95eb71d88a64_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooC@
+hs_bindgen_2ebd95eb71d88a64 :: M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooC@
+hs_bindgen_2ebd95eb71d88a64 = \x_0 -> hs_bindgen_2ebd95eb71d88a64_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooC_safe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooC_safe = hs_bindgen_2ebd95eb71d88a64
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_deddaf3108b305bb" hs_bindgen_deddaf3108b305bb_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooD@
+hs_bindgen_deddaf3108b305bb :: M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooD@
+hs_bindgen_deddaf3108b305bb = \x_0 -> hs_bindgen_deddaf3108b305bb_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooD_safe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooD_safe = hs_bindgen_deddaf3108b305bb
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_9ed085d5f2e5837e" hs_bindgen_9ed085d5f2e5837e_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooE@
+hs_bindgen_9ed085d5f2e5837e :: E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Safe_fooE@
+hs_bindgen_9ed085d5f2e5837e = \x_0 -> hs_bindgen_9ed085d5f2e5837e_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooE_safe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooE_safe = hs_bindgen_9ed085d5f2e5837e
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_0e6b98e93cad73ef" hs_bindgen_0e6b98e93cad73ef_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_foo@
+hs_bindgen_0e6b98e93cad73ef :: MyEnum -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_foo@
+hs_bindgen_0e6b98e93cad73ef = \x_0 -> hs_bindgen_0e6b98e93cad73ef_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+foo_unsafe :: MyEnum -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+foo_unsafe = hs_bindgen_0e6b98e93cad73ef
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_1c6de1b89014dc52" hs_bindgen_1c6de1b89014dc52_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooA@
+hs_bindgen_1c6de1b89014dc52 :: A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooA@
+hs_bindgen_1c6de1b89014dc52 = \x_0 -> hs_bindgen_1c6de1b89014dc52_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooA_unsafe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooA_unsafe = hs_bindgen_1c6de1b89014dc52
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a8e579f3b5035c03" hs_bindgen_a8e579f3b5035c03_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooB@
+hs_bindgen_a8e579f3b5035c03 :: B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooB@
+hs_bindgen_a8e579f3b5035c03 = \x_0 -> hs_bindgen_a8e579f3b5035c03_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooB_unsafe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooB_unsafe = hs_bindgen_a8e579f3b5035c03
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_00ad8122da6609fc" hs_bindgen_00ad8122da6609fc_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooC@
+hs_bindgen_00ad8122da6609fc :: M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooC@
+hs_bindgen_00ad8122da6609fc = \x_0 -> hs_bindgen_00ad8122da6609fc_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooC_unsafe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooC_unsafe = hs_bindgen_00ad8122da6609fc
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_2be41098f80a9019" hs_bindgen_2be41098f80a9019_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooD@
+hs_bindgen_2be41098f80a9019 :: M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooD@
+hs_bindgen_2be41098f80a9019 = \x_0 -> hs_bindgen_2be41098f80a9019_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooD_unsafe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooD_unsafe = hs_bindgen_2be41098f80a9019
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_07241b4b6cbf2991" hs_bindgen_07241b4b6cbf2991_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooE@
+hs_bindgen_07241b4b6cbf2991 :: E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_Unsafe_fooE@
+hs_bindgen_07241b4b6cbf2991 = \x_0 -> hs_bindgen_07241b4b6cbf2991_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooE_unsafe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooE_unsafe = hs_bindgen_07241b4b6cbf2991
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_098964a440956602" hs_bindgen_098964a440956602_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_foo@
+hs_bindgen_098964a440956602 :: IO (FunPtr (MyEnum -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_foo@
+hs_bindgen_098964a440956602 = fmap fromFFIType hs_bindgen_098964a440956602_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+foo_funptr :: FunPtr (MyEnum -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_098964a440956602
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_86b685b9d27ce50e" hs_bindgen_86b685b9d27ce50e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooA@
+hs_bindgen_86b685b9d27ce50e :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooA@
+hs_bindgen_86b685b9d27ce50e = fmap fromFFIType hs_bindgen_86b685b9d27ce50e_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooA_funptr :: FunPtr (A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_86b685b9d27ce50e
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_9383ae52414c2c19" hs_bindgen_9383ae52414c2c19_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooB@
+hs_bindgen_9383ae52414c2c19 :: IO (FunPtr (B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooB@
+hs_bindgen_9383ae52414c2c19 = fmap fromFFIType hs_bindgen_9383ae52414c2c19_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooB_funptr :: FunPtr (B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_9383ae52414c2c19
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_e677debf9f8f8884" hs_bindgen_e677debf9f8f8884_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooC@
+hs_bindgen_e677debf9f8f8884 :: IO (FunPtr (M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooC@
+hs_bindgen_e677debf9f8f8884 = fmap fromFFIType hs_bindgen_e677debf9f8f8884_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooC_funptr :: FunPtr (M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_e677debf9f8f8884
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_7d8aecf79b372251" hs_bindgen_7d8aecf79b372251_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooD@
+hs_bindgen_7d8aecf79b372251 :: IO (FunPtr (M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooD@
+hs_bindgen_7d8aecf79b372251 = fmap fromFFIType hs_bindgen_7d8aecf79b372251_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooD_funptr :: FunPtr (M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_7d8aecf79b372251
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_24fe84901d848b4c" hs_bindgen_24fe84901d848b4c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooE@
+hs_bindgen_24fe84901d848b4c :: IO (FunPtr (E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroen_Example_get_fooE@
+hs_bindgen_24fe84901d848b4c = fmap fromFFIType hs_bindgen_24fe84901d848b4c_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooE_funptr :: FunPtr (E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/enum.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/enum.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_24fe84901d848b4c
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example.hs
@@ -0,0 +1,177 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyFunction(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (IO, fmap, type (~))
+
+{-| __C declaration:__ @MyFunction@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 5:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+newtype MyFunction = MyFunction
+  { unwrapMyFunction :: BG.CInt -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toMyFunction@
+foreign import ccall safe "wrapper" hs_bindgen_4e8a459829b269e0_base ::
+     (BG.CInt -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+
+-- __unique:__ @toMyFunction@
+hs_bindgen_4e8a459829b269e0 ::
+     MyFunction
+  -> IO (BG.FunPtr MyFunction)
+hs_bindgen_4e8a459829b269e0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_4e8a459829b269e0_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrapMyFunction" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromMyFunction@
+foreign import ccall safe "dynamic" hs_bindgen_bb71f7e730356103_base ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> BG.CInt -> IO BG.CInt
+
+-- __unique:__ @fromMyFunction@
+hs_bindgen_bb71f7e730356103 ::
+     BG.FunPtr MyFunction
+  -> MyFunction
+hs_bindgen_bb71f7e730356103 =
+  \funPtr0 ->
+    MyFunction (\x1 ->
+                  fmap BG.fromFFIType (hs_bindgen_bb71f7e730356103_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr MyFunction where
+
+  toFunPtr = hs_bindgen_4e8a459829b269e0
+
+instance BG.FromFunPtr MyFunction where
+
+  fromFunPtr = hs_bindgen_bb71f7e730356103
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapMyFunction" MyFunction ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> MyFunction {unwrapMyFunction = y1}
+      , BG.getField @"unwrapMyFunction" x0
+      )
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "unwrapMyFunction" (BG.Ptr MyFunction) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyFunction")
+
+instance HasCField.HasCField MyFunction "unwrapMyFunction" where
+
+  type CFieldType MyFunction "unwrapMyFunction" =
+    BG.CInt -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+newtype A = A
+  { unwrapA :: MyFunction
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ MyFunction) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ MyFunction) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyFunction
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example/FunPtr.hs
@@ -0,0 +1,356 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    , Example.FunPtr.bar
+    , Example.FunPtr.barA
+    , Example.FunPtr.barB
+    , Example.FunPtr.barC
+    , Example.FunPtr.barD
+    , Example.FunPtr.barE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/function.h>"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e113ab1229902001 (void)) ("
+  , "  MyFunction *arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_5e83648377d8afc6 (void)) ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d6d79c737e65f7e7 (void)) ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_566c44a793d222a9 (void)) ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9214c66c2650a721 (void)) ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_08a6ea4ce7e2c244 (void)) ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_15c0f27a0b5f01ca (void)) ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_barA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1e518c0403f5c339 (void)) ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  return &barA;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_barB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6a1e56bd4a228268 (void)) ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  return &barB;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_barC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_4edd36805e7f06a0 (void)) ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  return &barC;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_barD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1f340970ba2d8ec0 (void)) ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  return &barD;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_barE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e1dd905a06024a69 (void)) ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  return &barE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_e113ab1229902001" hs_bindgen_e113ab1229902001_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+hs_bindgen_e113ab1229902001 :: IO (BG.FunPtr (BG.FunPtr MyFunction -> IO ()))
+hs_bindgen_e113ab1229902001 =
+  fmap BG.fromFFIType hs_bindgen_e113ab1229902001_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+foo :: BG.FunPtr (BG.FunPtr MyFunction -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_e113ab1229902001
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_5e83648377d8afc6" hs_bindgen_5e83648377d8afc6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+hs_bindgen_5e83648377d8afc6 :: IO (BG.FunPtr (BG.FunPtr A -> IO ()))
+hs_bindgen_5e83648377d8afc6 =
+  fmap BG.fromFFIType hs_bindgen_5e83648377d8afc6_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooA :: BG.FunPtr (BG.FunPtr A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_5e83648377d8afc6
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_d6d79c737e65f7e7" hs_bindgen_d6d79c737e65f7e7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+hs_bindgen_d6d79c737e65f7e7 :: IO (BG.FunPtr (BG.FunPtr B -> IO ()))
+hs_bindgen_d6d79c737e65f7e7 =
+  fmap BG.fromFFIType hs_bindgen_d6d79c737e65f7e7_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooB :: BG.FunPtr (BG.FunPtr B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_d6d79c737e65f7e7
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_566c44a793d222a9" hs_bindgen_566c44a793d222a9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+hs_bindgen_566c44a793d222a9 :: IO (BG.FunPtr (BG.FunPtr M.C -> IO ()))
+hs_bindgen_566c44a793d222a9 =
+  fmap BG.fromFFIType hs_bindgen_566c44a793d222a9_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooC :: BG.FunPtr (BG.FunPtr M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_566c44a793d222a9
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_9214c66c2650a721" hs_bindgen_9214c66c2650a721_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+hs_bindgen_9214c66c2650a721 :: IO (BG.FunPtr (BG.FunPtr M.D -> IO ()))
+hs_bindgen_9214c66c2650a721 =
+  fmap BG.fromFFIType hs_bindgen_9214c66c2650a721_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooD :: BG.FunPtr (BG.FunPtr M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_9214c66c2650a721
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_08a6ea4ce7e2c244" hs_bindgen_08a6ea4ce7e2c244_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+hs_bindgen_08a6ea4ce7e2c244 :: IO (BG.FunPtr (BG.FunPtr E -> IO ()))
+hs_bindgen_08a6ea4ce7e2c244 =
+  fmap BG.fromFFIType hs_bindgen_08a6ea4ce7e2c244_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooE :: BG.FunPtr (BG.FunPtr E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_08a6ea4ce7e2c244
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_15c0f27a0b5f01ca" hs_bindgen_15c0f27a0b5f01ca_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_bar@
+hs_bindgen_15c0f27a0b5f01ca :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ()))
+hs_bindgen_15c0f27a0b5f01ca =
+  fmap BG.fromFFIType hs_bindgen_15c0f27a0b5f01ca_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 40:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+bar :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_15c0f27a0b5f01ca
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barA@
+foreign import ccall unsafe "hs_bindgen_1e518c0403f5c339" hs_bindgen_1e518c0403f5c339_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barA@
+hs_bindgen_1e518c0403f5c339 :: IO (BG.FunPtr (BG.FunPtr A -> IO ()))
+hs_bindgen_1e518c0403f5c339 =
+  fmap BG.fromFFIType hs_bindgen_1e518c0403f5c339_base
+
+{-# NOINLINE barA #-}
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 42:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barA :: BG.FunPtr (BG.FunPtr A -> IO ())
+barA = BG.unsafePerformIO hs_bindgen_1e518c0403f5c339
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barB@
+foreign import ccall unsafe "hs_bindgen_6a1e56bd4a228268" hs_bindgen_6a1e56bd4a228268_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barB@
+hs_bindgen_6a1e56bd4a228268 :: IO (BG.FunPtr (BG.FunPtr B -> IO ()))
+hs_bindgen_6a1e56bd4a228268 =
+  fmap BG.fromFFIType hs_bindgen_6a1e56bd4a228268_base
+
+{-# NOINLINE barB #-}
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 43:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barB :: BG.FunPtr (BG.FunPtr B -> IO ())
+barB = BG.unsafePerformIO hs_bindgen_6a1e56bd4a228268
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barC@
+foreign import ccall unsafe "hs_bindgen_4edd36805e7f06a0" hs_bindgen_4edd36805e7f06a0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barC@
+hs_bindgen_4edd36805e7f06a0 :: IO (BG.FunPtr (BG.FunPtr M.C -> IO ()))
+hs_bindgen_4edd36805e7f06a0 =
+  fmap BG.fromFFIType hs_bindgen_4edd36805e7f06a0_base
+
+{-# NOINLINE barC #-}
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 45:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barC :: BG.FunPtr (BG.FunPtr M.C -> IO ())
+barC = BG.unsafePerformIO hs_bindgen_4edd36805e7f06a0
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barD@
+foreign import ccall unsafe "hs_bindgen_1f340970ba2d8ec0" hs_bindgen_1f340970ba2d8ec0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barD@
+hs_bindgen_1f340970ba2d8ec0 :: IO (BG.FunPtr (BG.FunPtr M.D -> IO ()))
+hs_bindgen_1f340970ba2d8ec0 =
+  fmap BG.fromFFIType hs_bindgen_1f340970ba2d8ec0_base
+
+{-# NOINLINE barD #-}
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 46:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barD :: BG.FunPtr (BG.FunPtr M.D -> IO ())
+barD = BG.unsafePerformIO hs_bindgen_1f340970ba2d8ec0
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barE@
+foreign import ccall unsafe "hs_bindgen_e1dd905a06024a69" hs_bindgen_e1dd905a06024a69_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barE@
+hs_bindgen_e1dd905a06024a69 :: IO (BG.FunPtr (BG.FunPtr E -> IO ()))
+hs_bindgen_e1dd905a06024a69 =
+  fmap BG.fromFFIType hs_bindgen_e1dd905a06024a69_base
+
+{-# NOINLINE barE #-}
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 47:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barE :: BG.FunPtr (BG.FunPtr E -> IO ())
+barE = BG.unsafePerformIO hs_bindgen_e1dd905a06024a69
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example/Safe.hs
@@ -0,0 +1,404 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    , Example.Safe.bar
+    , Example.Safe.barA
+    , Example.Safe.barB
+    , Example.Safe.barC
+    , Example.Safe.barD
+    , Example.Safe.barE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/function.h>"
+  , "void hs_bindgen_40e15e86e5db36ce ("
+  , "  MyFunction *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_e13a57fd1d27f6e6 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_fd490df5087893ae ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_c552a862db9ba6eb ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_b08ba864cf83a382 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_ca717b3afd1e43f5 ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  , "void hs_bindgen_a708e95f35bff290 ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_2991dd76f4337b78 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (barA)(arg1);"
+  , "}"
+  , "void hs_bindgen_104de3f97206bd1d ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (barB)(arg1);"
+  , "}"
+  , "void hs_bindgen_963bcd9e5467fd8f ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (barC)(arg1);"
+  , "}"
+  , "void hs_bindgen_57f4aab65f2a1232 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (barD)(arg1);"
+  , "}"
+  , "void hs_bindgen_6479d953f4c6848f ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (barE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_40e15e86e5db36ce" hs_bindgen_40e15e86e5db36ce_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+hs_bindgen_40e15e86e5db36ce ::
+     BG.FunPtr MyFunction
+  -> IO ()
+hs_bindgen_40e15e86e5db36ce =
+  \x0 ->
+    hs_bindgen_40e15e86e5db36ce_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+foo ::
+     BG.FunPtr MyFunction
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_40e15e86e5db36ce
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_e13a57fd1d27f6e6" hs_bindgen_e13a57fd1d27f6e6_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+hs_bindgen_e13a57fd1d27f6e6 ::
+     BG.FunPtr A
+  -> IO ()
+hs_bindgen_e13a57fd1d27f6e6 =
+  \x0 ->
+    hs_bindgen_e13a57fd1d27f6e6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooA ::
+     BG.FunPtr A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_e13a57fd1d27f6e6
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_fd490df5087893ae" hs_bindgen_fd490df5087893ae_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+hs_bindgen_fd490df5087893ae ::
+     BG.FunPtr B
+  -> IO ()
+hs_bindgen_fd490df5087893ae =
+  \x0 ->
+    hs_bindgen_fd490df5087893ae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooB ::
+     BG.FunPtr B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_fd490df5087893ae
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_c552a862db9ba6eb" hs_bindgen_c552a862db9ba6eb_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+hs_bindgen_c552a862db9ba6eb ::
+     BG.FunPtr M.C
+  -> IO ()
+hs_bindgen_c552a862db9ba6eb =
+  \x0 ->
+    hs_bindgen_c552a862db9ba6eb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooC ::
+     BG.FunPtr M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_c552a862db9ba6eb
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_b08ba864cf83a382" hs_bindgen_b08ba864cf83a382_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+hs_bindgen_b08ba864cf83a382 ::
+     BG.FunPtr M.D
+  -> IO ()
+hs_bindgen_b08ba864cf83a382 =
+  \x0 ->
+    hs_bindgen_b08ba864cf83a382_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooD ::
+     BG.FunPtr M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_b08ba864cf83a382
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_ca717b3afd1e43f5" hs_bindgen_ca717b3afd1e43f5_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+hs_bindgen_ca717b3afd1e43f5 ::
+     BG.FunPtr E
+  -> IO ()
+hs_bindgen_ca717b3afd1e43f5 =
+  \x0 ->
+    hs_bindgen_ca717b3afd1e43f5_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooE ::
+     BG.FunPtr E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_ca717b3afd1e43f5
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_a708e95f35bff290" hs_bindgen_a708e95f35bff290_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_bar@
+hs_bindgen_a708e95f35bff290 ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_a708e95f35bff290 =
+  \x0 ->
+    hs_bindgen_a708e95f35bff290_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 40:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+bar ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_a708e95f35bff290
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barA@
+foreign import ccall safe "hs_bindgen_2991dd76f4337b78" hs_bindgen_2991dd76f4337b78_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barA@
+hs_bindgen_2991dd76f4337b78 ::
+     BG.FunPtr A
+  -> IO ()
+hs_bindgen_2991dd76f4337b78 =
+  \x0 ->
+    hs_bindgen_2991dd76f4337b78_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 42:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barA ::
+     BG.FunPtr A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barA = hs_bindgen_2991dd76f4337b78
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barB@
+foreign import ccall safe "hs_bindgen_104de3f97206bd1d" hs_bindgen_104de3f97206bd1d_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barB@
+hs_bindgen_104de3f97206bd1d ::
+     BG.FunPtr B
+  -> IO ()
+hs_bindgen_104de3f97206bd1d =
+  \x0 ->
+    hs_bindgen_104de3f97206bd1d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 43:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barB ::
+     BG.FunPtr B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barB = hs_bindgen_104de3f97206bd1d
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barC@
+foreign import ccall safe "hs_bindgen_963bcd9e5467fd8f" hs_bindgen_963bcd9e5467fd8f_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barC@
+hs_bindgen_963bcd9e5467fd8f ::
+     BG.FunPtr M.C
+  -> IO ()
+hs_bindgen_963bcd9e5467fd8f =
+  \x0 ->
+    hs_bindgen_963bcd9e5467fd8f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 45:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barC ::
+     BG.FunPtr M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barC = hs_bindgen_963bcd9e5467fd8f
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barD@
+foreign import ccall safe "hs_bindgen_57f4aab65f2a1232" hs_bindgen_57f4aab65f2a1232_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barD@
+hs_bindgen_57f4aab65f2a1232 ::
+     BG.FunPtr M.D
+  -> IO ()
+hs_bindgen_57f4aab65f2a1232 =
+  \x0 ->
+    hs_bindgen_57f4aab65f2a1232_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 46:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barD ::
+     BG.FunPtr M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barD = hs_bindgen_57f4aab65f2a1232
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barE@
+foreign import ccall safe "hs_bindgen_6479d953f4c6848f" hs_bindgen_6479d953f4c6848f_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barE@
+hs_bindgen_6479d953f4c6848f ::
+     BG.FunPtr E
+  -> IO ()
+hs_bindgen_6479d953f4c6848f =
+  \x0 ->
+    hs_bindgen_6479d953f4c6848f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 47:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barE ::
+     BG.FunPtr E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barE = hs_bindgen_6479d953f4c6848f
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/Example/Unsafe.hs
@@ -0,0 +1,404 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    , Example.Unsafe.bar
+    , Example.Unsafe.barA
+    , Example.Unsafe.barB
+    , Example.Unsafe.barC
+    , Example.Unsafe.barD
+    , Example.Unsafe.barE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/function.h>"
+  , "void hs_bindgen_fbc2ec26cd297034 ("
+  , "  MyFunction *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_cf67e2fc00fd28d8 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_269a46f9680e33ed ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_f9bc9d37a12171dd ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_ca21c7e4aaa33a81 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_e71a09bea0aef335 ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  , "void hs_bindgen_0fdddb4fac9b77d1 ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_bd59a5d308c55504 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (barA)(arg1);"
+  , "}"
+  , "void hs_bindgen_b016bfc7a4cc0734 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (barB)(arg1);"
+  , "}"
+  , "void hs_bindgen_5e40e29a3ba3186e ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (barC)(arg1);"
+  , "}"
+  , "void hs_bindgen_cb058763607fee19 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (barD)(arg1);"
+  , "}"
+  , "void hs_bindgen_2f3d5b8e2b6dd66f ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (barE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_fbc2ec26cd297034" hs_bindgen_fbc2ec26cd297034_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+hs_bindgen_fbc2ec26cd297034 ::
+     BG.FunPtr MyFunction
+  -> IO ()
+hs_bindgen_fbc2ec26cd297034 =
+  \x0 ->
+    hs_bindgen_fbc2ec26cd297034_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+foo ::
+     BG.FunPtr MyFunction
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_fbc2ec26cd297034
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_cf67e2fc00fd28d8" hs_bindgen_cf67e2fc00fd28d8_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+hs_bindgen_cf67e2fc00fd28d8 ::
+     BG.FunPtr A
+  -> IO ()
+hs_bindgen_cf67e2fc00fd28d8 =
+  \x0 ->
+    hs_bindgen_cf67e2fc00fd28d8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooA ::
+     BG.FunPtr A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_cf67e2fc00fd28d8
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_269a46f9680e33ed" hs_bindgen_269a46f9680e33ed_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+hs_bindgen_269a46f9680e33ed ::
+     BG.FunPtr B
+  -> IO ()
+hs_bindgen_269a46f9680e33ed =
+  \x0 ->
+    hs_bindgen_269a46f9680e33ed_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooB ::
+     BG.FunPtr B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_269a46f9680e33ed
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_f9bc9d37a12171dd" hs_bindgen_f9bc9d37a12171dd_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+hs_bindgen_f9bc9d37a12171dd ::
+     BG.FunPtr M.C
+  -> IO ()
+hs_bindgen_f9bc9d37a12171dd =
+  \x0 ->
+    hs_bindgen_f9bc9d37a12171dd_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooC ::
+     BG.FunPtr M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_f9bc9d37a12171dd
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_ca21c7e4aaa33a81" hs_bindgen_ca21c7e4aaa33a81_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+hs_bindgen_ca21c7e4aaa33a81 ::
+     BG.FunPtr M.D
+  -> IO ()
+hs_bindgen_ca21c7e4aaa33a81 =
+  \x0 ->
+    hs_bindgen_ca21c7e4aaa33a81_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooD ::
+     BG.FunPtr M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_ca21c7e4aaa33a81
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_e71a09bea0aef335" hs_bindgen_e71a09bea0aef335_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+hs_bindgen_e71a09bea0aef335 ::
+     BG.FunPtr E
+  -> IO ()
+hs_bindgen_e71a09bea0aef335 =
+  \x0 ->
+    hs_bindgen_e71a09bea0aef335_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooE ::
+     BG.FunPtr E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_e71a09bea0aef335
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_0fdddb4fac9b77d1" hs_bindgen_0fdddb4fac9b77d1_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_bar@
+hs_bindgen_0fdddb4fac9b77d1 ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_0fdddb4fac9b77d1 =
+  \x0 ->
+    hs_bindgen_0fdddb4fac9b77d1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 40:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+bar ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_0fdddb4fac9b77d1
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barA@
+foreign import ccall unsafe "hs_bindgen_bd59a5d308c55504" hs_bindgen_bd59a5d308c55504_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barA@
+hs_bindgen_bd59a5d308c55504 ::
+     BG.FunPtr A
+  -> IO ()
+hs_bindgen_bd59a5d308c55504 =
+  \x0 ->
+    hs_bindgen_bd59a5d308c55504_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 42:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barA ::
+     BG.FunPtr A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barA = hs_bindgen_bd59a5d308c55504
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barB@
+foreign import ccall unsafe "hs_bindgen_b016bfc7a4cc0734" hs_bindgen_b016bfc7a4cc0734_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barB@
+hs_bindgen_b016bfc7a4cc0734 ::
+     BG.FunPtr B
+  -> IO ()
+hs_bindgen_b016bfc7a4cc0734 =
+  \x0 ->
+    hs_bindgen_b016bfc7a4cc0734_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 43:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barB ::
+     BG.FunPtr B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barB = hs_bindgen_b016bfc7a4cc0734
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barC@
+foreign import ccall unsafe "hs_bindgen_5e40e29a3ba3186e" hs_bindgen_5e40e29a3ba3186e_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barC@
+hs_bindgen_5e40e29a3ba3186e ::
+     BG.FunPtr M.C
+  -> IO ()
+hs_bindgen_5e40e29a3ba3186e =
+  \x0 ->
+    hs_bindgen_5e40e29a3ba3186e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 45:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barC ::
+     BG.FunPtr M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barC = hs_bindgen_5e40e29a3ba3186e
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barD@
+foreign import ccall unsafe "hs_bindgen_cb058763607fee19" hs_bindgen_cb058763607fee19_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barD@
+hs_bindgen_cb058763607fee19 ::
+     BG.FunPtr M.D
+  -> IO ()
+hs_bindgen_cb058763607fee19 =
+  \x0 ->
+    hs_bindgen_cb058763607fee19_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 46:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barD ::
+     BG.FunPtr M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barD = hs_bindgen_cb058763607fee19
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barE@
+foreign import ccall unsafe "hs_bindgen_2f3d5b8e2b6dd66f" hs_bindgen_2f3d5b8e2b6dd66f_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barE@
+hs_bindgen_2f3d5b8e2b6dd66f ::
+     BG.FunPtr E
+  -> IO ()
+hs_bindgen_2f3d5b8e2b6dd66f =
+  \x0 ->
+    hs_bindgen_2f3d5b8e2b6dd66f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 47:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barE ::
+     BG.FunPtr E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barE = hs_bindgen_2f3d5b8e2b6dd66f
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/bindingspec.yaml
@@ -0,0 +1,68 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/macro/function.h
+  cname: MyFunction
+  hsname: MyFunction
+- headers: binding-specs/fun_arg/macro/function.h
+  cname: macro A
+  hsname: A
+- headers: binding-specs/fun_arg/macro/function.h
+  cname: macro B
+  hsname: B
+- headers: binding-specs/fun_arg/macro/function.h
+  cname: macro E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyFunction
+  representation:
+    newtype:
+      constructor: MyFunction
+      fields:
+      - unwrapMyFunction
+  instances:
+  - FromFunPtr
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ToFunPtr
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function/th.txt
@@ -0,0 +1,1129 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/macro/function.h
+-- #include <binding-specs/fun_arg/macro/function.h>
+-- void hs_bindgen_40e15e86e5db36ce (
+--   MyFunction *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_e13a57fd1d27f6e6 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_fd490df5087893ae (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_c552a862db9ba6eb (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_b08ba864cf83a382 (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_ca717b3afd1e43f5 (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_a708e95f35bff290 (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_2991dd76f4337b78 (
+--   A *arg1
+-- )
+-- {
+--   (barA)(arg1);
+-- }
+-- void hs_bindgen_104de3f97206bd1d (
+--   B *arg1
+-- )
+-- {
+--   (barB)(arg1);
+-- }
+-- void hs_bindgen_963bcd9e5467fd8f (
+--   C *arg1
+-- )
+-- {
+--   (barC)(arg1);
+-- }
+-- void hs_bindgen_57f4aab65f2a1232 (
+--   D *arg1
+-- )
+-- {
+--   (barD)(arg1);
+-- }
+-- void hs_bindgen_6479d953f4c6848f (
+--   E *arg1
+-- )
+-- {
+--   (barE)(arg1);
+-- }
+-- void hs_bindgen_fbc2ec26cd297034 (
+--   MyFunction *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_cf67e2fc00fd28d8 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_269a46f9680e33ed (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_f9bc9d37a12171dd (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_ca21c7e4aaa33a81 (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_e71a09bea0aef335 (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_0fdddb4fac9b77d1 (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_bd59a5d308c55504 (
+--   A *arg1
+-- )
+-- {
+--   (barA)(arg1);
+-- }
+-- void hs_bindgen_b016bfc7a4cc0734 (
+--   B *arg1
+-- )
+-- {
+--   (barB)(arg1);
+-- }
+-- void hs_bindgen_5e40e29a3ba3186e (
+--   C *arg1
+-- )
+-- {
+--   (barC)(arg1);
+-- }
+-- void hs_bindgen_cb058763607fee19 (
+--   D *arg1
+-- )
+-- {
+--   (barD)(arg1);
+-- }
+-- void hs_bindgen_2f3d5b8e2b6dd66f (
+--   E *arg1
+-- )
+-- {
+--   (barE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e113ab1229902001 (void)) (
+--   MyFunction *arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_5e83648377d8afc6 (void)) (
+--   A *arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d6d79c737e65f7e7 (void)) (
+--   B *arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_566c44a793d222a9 (void)) (
+--   C *arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9214c66c2650a721 (void)) (
+--   D *arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_08a6ea4ce7e2c244 (void)) (
+--   E *arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_15c0f27a0b5f01ca (void)) (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_barA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1e518c0403f5c339 (void)) (
+--   A *arg1
+-- )
+-- {
+--   return &barA;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_barB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6a1e56bd4a228268 (void)) (
+--   B *arg1
+-- )
+-- {
+--   return &barB;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_barC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_4edd36805e7f06a0 (void)) (
+--   C *arg1
+-- )
+-- {
+--   return &barC;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_barD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1f340970ba2d8ec0 (void)) (
+--   D *arg1
+-- )
+-- {
+--   return &barD;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_barE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e1dd905a06024a69 (void)) (
+--   E *arg1
+-- )
+-- {
+--   return &barE;
+-- }
+{-| __C declaration:__ @MyFunction@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 5:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+newtype MyFunction
+    = MyFunction {unwrapMyFunction :: (CInt -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toMyFunction@
+foreign import ccall safe "wrapper" hs_bindgen_4e8a459829b269e0_base ::
+    CInt -> IO CInt
+ -> IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @toMyFunction@
+hs_bindgen_4e8a459829b269e0 :: MyFunction -> IO (FunPtr MyFunction)
+-- __unique:__ @toMyFunction@
+hs_bindgen_4e8a459829b269e0 = \fun_0 -> fmap castFunPtr (hs_bindgen_4e8a459829b269e0_base (\x_1 -> fmap toFFIType (getField @"unwrapMyFunction" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromMyFunction@
+foreign import ccall safe "dynamic" hs_bindgen_bb71f7e730356103_base ::
+    FunPtr (CInt -> IO CInt)
+ -> CInt
+ -> IO CInt
+-- __unique:__ @fromMyFunction@
+hs_bindgen_bb71f7e730356103 :: FunPtr MyFunction -> MyFunction
+-- __unique:__ @fromMyFunction@
+hs_bindgen_bb71f7e730356103 = \funPtr_0 -> MyFunction (\x_1 -> fmap fromFFIType (hs_bindgen_bb71f7e730356103_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr MyFunction
+    where toFunPtr = hs_bindgen_4e8a459829b269e0
+instance FromFunPtr MyFunction
+    where fromFunPtr = hs_bindgen_bb71f7e730356103
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapMyFunction" MyFunction ty
+    where hasField = \x_0 -> (\y_1 -> MyFunction{unwrapMyFunction = y_1},
+                              getField @"unwrapMyFunction" x_0)
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapMyFunction" (Ptr MyFunction) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyFunction")
+instance HasCField MyFunction "unwrapMyFunction"
+    where type CFieldType MyFunction "unwrapMyFunction" = CInt ->
+                                                          IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+newtype A = A {unwrapA :: MyFunction} deriving stock Generic
+instance (~) ty MyFunction => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyFunction => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyFunction
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+newtype B = B {unwrapB :: A} deriving stock Generic
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_40e15e86e5db36ce" hs_bindgen_40e15e86e5db36ce_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+hs_bindgen_40e15e86e5db36ce :: FunPtr MyFunction -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+hs_bindgen_40e15e86e5db36ce = \x_0 -> hs_bindgen_40e15e86e5db36ce_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+foo_safe :: FunPtr MyFunction -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+foo_safe = hs_bindgen_40e15e86e5db36ce
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_e13a57fd1d27f6e6" hs_bindgen_e13a57fd1d27f6e6_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+hs_bindgen_e13a57fd1d27f6e6 :: FunPtr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+hs_bindgen_e13a57fd1d27f6e6 = \x_0 -> hs_bindgen_e13a57fd1d27f6e6_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooA_safe :: FunPtr A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooA_safe = hs_bindgen_e13a57fd1d27f6e6
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_fd490df5087893ae" hs_bindgen_fd490df5087893ae_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+hs_bindgen_fd490df5087893ae :: FunPtr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+hs_bindgen_fd490df5087893ae = \x_0 -> hs_bindgen_fd490df5087893ae_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooB_safe :: FunPtr B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooB_safe = hs_bindgen_fd490df5087893ae
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_c552a862db9ba6eb" hs_bindgen_c552a862db9ba6eb_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+hs_bindgen_c552a862db9ba6eb :: FunPtr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+hs_bindgen_c552a862db9ba6eb = \x_0 -> hs_bindgen_c552a862db9ba6eb_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooC_safe :: FunPtr M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooC_safe = hs_bindgen_c552a862db9ba6eb
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_b08ba864cf83a382" hs_bindgen_b08ba864cf83a382_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+hs_bindgen_b08ba864cf83a382 :: FunPtr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+hs_bindgen_b08ba864cf83a382 = \x_0 -> hs_bindgen_b08ba864cf83a382_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooD_safe :: FunPtr M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooD_safe = hs_bindgen_b08ba864cf83a382
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_ca717b3afd1e43f5" hs_bindgen_ca717b3afd1e43f5_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+hs_bindgen_ca717b3afd1e43f5 :: FunPtr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+hs_bindgen_ca717b3afd1e43f5 = \x_0 -> hs_bindgen_ca717b3afd1e43f5_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooE_safe :: FunPtr E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooE_safe = hs_bindgen_ca717b3afd1e43f5
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_a708e95f35bff290" hs_bindgen_a708e95f35bff290_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_bar@
+hs_bindgen_a708e95f35bff290 :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_bar@
+hs_bindgen_a708e95f35bff290 = \x_0 -> hs_bindgen_a708e95f35bff290_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 40:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+bar_safe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 40:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+bar_safe = hs_bindgen_a708e95f35bff290
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barA@
+foreign import ccall safe "hs_bindgen_2991dd76f4337b78" hs_bindgen_2991dd76f4337b78_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barA@
+hs_bindgen_2991dd76f4337b78 :: FunPtr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barA@
+hs_bindgen_2991dd76f4337b78 = \x_0 -> hs_bindgen_2991dd76f4337b78_base (toFFIType x_0)
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 42:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barA_safe :: FunPtr A -> IO ()
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 42:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barA_safe = hs_bindgen_2991dd76f4337b78
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barB@
+foreign import ccall safe "hs_bindgen_104de3f97206bd1d" hs_bindgen_104de3f97206bd1d_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barB@
+hs_bindgen_104de3f97206bd1d :: FunPtr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barB@
+hs_bindgen_104de3f97206bd1d = \x_0 -> hs_bindgen_104de3f97206bd1d_base (toFFIType x_0)
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 43:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barB_safe :: FunPtr B -> IO ()
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 43:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barB_safe = hs_bindgen_104de3f97206bd1d
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barC@
+foreign import ccall safe "hs_bindgen_963bcd9e5467fd8f" hs_bindgen_963bcd9e5467fd8f_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barC@
+hs_bindgen_963bcd9e5467fd8f :: FunPtr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barC@
+hs_bindgen_963bcd9e5467fd8f = \x_0 -> hs_bindgen_963bcd9e5467fd8f_base (toFFIType x_0)
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 45:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barC_safe :: FunPtr M.C -> IO ()
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 45:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barC_safe = hs_bindgen_963bcd9e5467fd8f
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barD@
+foreign import ccall safe "hs_bindgen_57f4aab65f2a1232" hs_bindgen_57f4aab65f2a1232_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barD@
+hs_bindgen_57f4aab65f2a1232 :: FunPtr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barD@
+hs_bindgen_57f4aab65f2a1232 = \x_0 -> hs_bindgen_57f4aab65f2a1232_base (toFFIType x_0)
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 46:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barD_safe :: FunPtr M.D -> IO ()
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 46:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barD_safe = hs_bindgen_57f4aab65f2a1232
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barE@
+foreign import ccall safe "hs_bindgen_6479d953f4c6848f" hs_bindgen_6479d953f4c6848f_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barE@
+hs_bindgen_6479d953f4c6848f :: FunPtr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_barE@
+hs_bindgen_6479d953f4c6848f = \x_0 -> hs_bindgen_6479d953f4c6848f_base (toFFIType x_0)
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 47:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barE_safe :: FunPtr E -> IO ()
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 47:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barE_safe = hs_bindgen_6479d953f4c6848f
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_fbc2ec26cd297034" hs_bindgen_fbc2ec26cd297034_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+hs_bindgen_fbc2ec26cd297034 :: FunPtr MyFunction -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+hs_bindgen_fbc2ec26cd297034 = \x_0 -> hs_bindgen_fbc2ec26cd297034_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+foo_unsafe :: FunPtr MyFunction -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+foo_unsafe = hs_bindgen_fbc2ec26cd297034
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_cf67e2fc00fd28d8" hs_bindgen_cf67e2fc00fd28d8_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+hs_bindgen_cf67e2fc00fd28d8 :: FunPtr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+hs_bindgen_cf67e2fc00fd28d8 = \x_0 -> hs_bindgen_cf67e2fc00fd28d8_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooA_unsafe :: FunPtr A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooA_unsafe = hs_bindgen_cf67e2fc00fd28d8
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_269a46f9680e33ed" hs_bindgen_269a46f9680e33ed_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+hs_bindgen_269a46f9680e33ed :: FunPtr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+hs_bindgen_269a46f9680e33ed = \x_0 -> hs_bindgen_269a46f9680e33ed_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooB_unsafe :: FunPtr B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooB_unsafe = hs_bindgen_269a46f9680e33ed
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_f9bc9d37a12171dd" hs_bindgen_f9bc9d37a12171dd_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+hs_bindgen_f9bc9d37a12171dd :: FunPtr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+hs_bindgen_f9bc9d37a12171dd = \x_0 -> hs_bindgen_f9bc9d37a12171dd_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooC_unsafe :: FunPtr M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooC_unsafe = hs_bindgen_f9bc9d37a12171dd
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_ca21c7e4aaa33a81" hs_bindgen_ca21c7e4aaa33a81_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+hs_bindgen_ca21c7e4aaa33a81 :: FunPtr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+hs_bindgen_ca21c7e4aaa33a81 = \x_0 -> hs_bindgen_ca21c7e4aaa33a81_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooD_unsafe :: FunPtr M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooD_unsafe = hs_bindgen_ca21c7e4aaa33a81
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_e71a09bea0aef335" hs_bindgen_e71a09bea0aef335_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+hs_bindgen_e71a09bea0aef335 :: FunPtr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+hs_bindgen_e71a09bea0aef335 = \x_0 -> hs_bindgen_e71a09bea0aef335_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooE_unsafe :: FunPtr E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooE_unsafe = hs_bindgen_e71a09bea0aef335
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_0fdddb4fac9b77d1" hs_bindgen_0fdddb4fac9b77d1_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_bar@
+hs_bindgen_0fdddb4fac9b77d1 :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_bar@
+hs_bindgen_0fdddb4fac9b77d1 = \x_0 -> hs_bindgen_0fdddb4fac9b77d1_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 40:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+bar_unsafe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 40:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+bar_unsafe = hs_bindgen_0fdddb4fac9b77d1
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barA@
+foreign import ccall unsafe "hs_bindgen_bd59a5d308c55504" hs_bindgen_bd59a5d308c55504_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barA@
+hs_bindgen_bd59a5d308c55504 :: FunPtr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barA@
+hs_bindgen_bd59a5d308c55504 = \x_0 -> hs_bindgen_bd59a5d308c55504_base (toFFIType x_0)
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 42:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barA_unsafe :: FunPtr A -> IO ()
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 42:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barA_unsafe = hs_bindgen_bd59a5d308c55504
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barB@
+foreign import ccall unsafe "hs_bindgen_b016bfc7a4cc0734" hs_bindgen_b016bfc7a4cc0734_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barB@
+hs_bindgen_b016bfc7a4cc0734 :: FunPtr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barB@
+hs_bindgen_b016bfc7a4cc0734 = \x_0 -> hs_bindgen_b016bfc7a4cc0734_base (toFFIType x_0)
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 43:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barB_unsafe :: FunPtr B -> IO ()
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 43:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barB_unsafe = hs_bindgen_b016bfc7a4cc0734
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barC@
+foreign import ccall unsafe "hs_bindgen_5e40e29a3ba3186e" hs_bindgen_5e40e29a3ba3186e_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barC@
+hs_bindgen_5e40e29a3ba3186e :: FunPtr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barC@
+hs_bindgen_5e40e29a3ba3186e = \x_0 -> hs_bindgen_5e40e29a3ba3186e_base (toFFIType x_0)
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 45:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barC_unsafe :: FunPtr M.C -> IO ()
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 45:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barC_unsafe = hs_bindgen_5e40e29a3ba3186e
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barD@
+foreign import ccall unsafe "hs_bindgen_cb058763607fee19" hs_bindgen_cb058763607fee19_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barD@
+hs_bindgen_cb058763607fee19 :: FunPtr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barD@
+hs_bindgen_cb058763607fee19 = \x_0 -> hs_bindgen_cb058763607fee19_base (toFFIType x_0)
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 46:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barD_unsafe :: FunPtr M.D -> IO ()
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 46:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barD_unsafe = hs_bindgen_cb058763607fee19
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barE@
+foreign import ccall unsafe "hs_bindgen_2f3d5b8e2b6dd66f" hs_bindgen_2f3d5b8e2b6dd66f_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barE@
+hs_bindgen_2f3d5b8e2b6dd66f :: FunPtr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_barE@
+hs_bindgen_2f3d5b8e2b6dd66f = \x_0 -> hs_bindgen_2f3d5b8e2b6dd66f_base (toFFIType x_0)
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 47:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barE_unsafe :: FunPtr E -> IO ()
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 47:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barE_unsafe = hs_bindgen_2f3d5b8e2b6dd66f
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_e113ab1229902001" hs_bindgen_e113ab1229902001_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+hs_bindgen_e113ab1229902001 :: IO (FunPtr (FunPtr MyFunction ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+hs_bindgen_e113ab1229902001 = fmap fromFFIType hs_bindgen_e113ab1229902001_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+foo_funptr :: FunPtr (FunPtr MyFunction -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_e113ab1229902001
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_5e83648377d8afc6" hs_bindgen_5e83648377d8afc6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+hs_bindgen_5e83648377d8afc6 :: IO (FunPtr (FunPtr A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+hs_bindgen_5e83648377d8afc6 = fmap fromFFIType hs_bindgen_5e83648377d8afc6_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooA_funptr :: FunPtr (FunPtr A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_5e83648377d8afc6
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_d6d79c737e65f7e7" hs_bindgen_d6d79c737e65f7e7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+hs_bindgen_d6d79c737e65f7e7 :: IO (FunPtr (FunPtr B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+hs_bindgen_d6d79c737e65f7e7 = fmap fromFFIType hs_bindgen_d6d79c737e65f7e7_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooB_funptr :: FunPtr (FunPtr B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_d6d79c737e65f7e7
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_566c44a793d222a9" hs_bindgen_566c44a793d222a9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+hs_bindgen_566c44a793d222a9 :: IO (FunPtr (FunPtr M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+hs_bindgen_566c44a793d222a9 = fmap fromFFIType hs_bindgen_566c44a793d222a9_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooC_funptr :: FunPtr (FunPtr M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_566c44a793d222a9
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_9214c66c2650a721" hs_bindgen_9214c66c2650a721_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+hs_bindgen_9214c66c2650a721 :: IO (FunPtr (FunPtr M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+hs_bindgen_9214c66c2650a721 = fmap fromFFIType hs_bindgen_9214c66c2650a721_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooD_funptr :: FunPtr (FunPtr M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_9214c66c2650a721
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_08a6ea4ce7e2c244" hs_bindgen_08a6ea4ce7e2c244_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+hs_bindgen_08a6ea4ce7e2c244 :: IO (FunPtr (FunPtr E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+hs_bindgen_08a6ea4ce7e2c244 = fmap fromFFIType hs_bindgen_08a6ea4ce7e2c244_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooE_funptr :: FunPtr (FunPtr E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_08a6ea4ce7e2c244
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_15c0f27a0b5f01ca" hs_bindgen_15c0f27a0b5f01ca_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_bar@
+hs_bindgen_15c0f27a0b5f01ca :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO CInt) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_bar@
+hs_bindgen_15c0f27a0b5f01ca = fmap fromFFIType hs_bindgen_15c0f27a0b5f01ca_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 40:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+bar_funptr :: FunPtr (FunPtr (CInt -> IO CInt) -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 40:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_15c0f27a0b5f01ca
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barA@
+foreign import ccall unsafe "hs_bindgen_1e518c0403f5c339" hs_bindgen_1e518c0403f5c339_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barA@
+hs_bindgen_1e518c0403f5c339 :: IO (FunPtr (FunPtr A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barA@
+hs_bindgen_1e518c0403f5c339 = fmap fromFFIType hs_bindgen_1e518c0403f5c339_base
+{-# NOINLINE barA_funptr #-}
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 42:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barA_funptr :: FunPtr (FunPtr A -> IO ())
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 42:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barA_funptr = unsafePerformIO hs_bindgen_1e518c0403f5c339
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barB@
+foreign import ccall unsafe "hs_bindgen_6a1e56bd4a228268" hs_bindgen_6a1e56bd4a228268_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barB@
+hs_bindgen_6a1e56bd4a228268 :: IO (FunPtr (FunPtr B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barB@
+hs_bindgen_6a1e56bd4a228268 = fmap fromFFIType hs_bindgen_6a1e56bd4a228268_base
+{-# NOINLINE barB_funptr #-}
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 43:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barB_funptr :: FunPtr (FunPtr B -> IO ())
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 43:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barB_funptr = unsafePerformIO hs_bindgen_6a1e56bd4a228268
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barC@
+foreign import ccall unsafe "hs_bindgen_4edd36805e7f06a0" hs_bindgen_4edd36805e7f06a0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barC@
+hs_bindgen_4edd36805e7f06a0 :: IO (FunPtr (FunPtr M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barC@
+hs_bindgen_4edd36805e7f06a0 = fmap fromFFIType hs_bindgen_4edd36805e7f06a0_base
+{-# NOINLINE barC_funptr #-}
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 45:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barC_funptr :: FunPtr (FunPtr M.C -> IO ())
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 45:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barC_funptr = unsafePerformIO hs_bindgen_4edd36805e7f06a0
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barD@
+foreign import ccall unsafe "hs_bindgen_1f340970ba2d8ec0" hs_bindgen_1f340970ba2d8ec0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barD@
+hs_bindgen_1f340970ba2d8ec0 :: IO (FunPtr (FunPtr M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barD@
+hs_bindgen_1f340970ba2d8ec0 = fmap fromFFIType hs_bindgen_1f340970ba2d8ec0_base
+{-# NOINLINE barD_funptr #-}
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 46:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barD_funptr :: FunPtr (FunPtr M.D -> IO ())
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 46:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barD_funptr = unsafePerformIO hs_bindgen_1f340970ba2d8ec0
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barE@
+foreign import ccall unsafe "hs_bindgen_e1dd905a06024a69" hs_bindgen_e1dd905a06024a69_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barE@
+hs_bindgen_e1dd905a06024a69 :: IO (FunPtr (FunPtr E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_barE@
+hs_bindgen_e1dd905a06024a69 = fmap fromFFIType hs_bindgen_e1dd905a06024a69_base
+{-# NOINLINE barE_funptr #-}
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 47:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barE_funptr :: FunPtr (FunPtr E -> IO ())
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function.h 47:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function.h@
+-}
+barE_funptr = unsafePerformIO hs_bindgen_e1dd905a06024a69
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example.hs
@@ -0,0 +1,240 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyFunctionPointer_Aux(..)
+    , Example.MyFunctionPointer(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (Eq, IO, Ord, Show, fmap, type (~))
+
+{-| Auxiliary type used by 'MyFunctionPointer'
+
+    __C declaration:__ @MyFunctionPointer@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 5:15@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype MyFunctionPointer_Aux = MyFunctionPointer_Aux
+  { unwrapMyFunctionPointer_Aux :: BG.CInt -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toMyFunctionPointer_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_47dfd04698dd2e6f_base ::
+     (BG.CInt -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+
+-- __unique:__ @toMyFunctionPointer_Aux@
+hs_bindgen_47dfd04698dd2e6f ::
+     MyFunctionPointer_Aux
+  -> IO (BG.FunPtr MyFunctionPointer_Aux)
+hs_bindgen_47dfd04698dd2e6f =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_47dfd04698dd2e6f_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrapMyFunctionPointer_Aux" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromMyFunctionPointer_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_5738272f94a589e2_base ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> BG.CInt -> IO BG.CInt
+
+-- __unique:__ @fromMyFunctionPointer_Aux@
+hs_bindgen_5738272f94a589e2 ::
+     BG.FunPtr MyFunctionPointer_Aux
+  -> MyFunctionPointer_Aux
+hs_bindgen_5738272f94a589e2 =
+  \funPtr0 ->
+    MyFunctionPointer_Aux (\x1 ->
+                             fmap BG.fromFFIType (hs_bindgen_5738272f94a589e2_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr MyFunctionPointer_Aux where
+
+  toFunPtr = hs_bindgen_47dfd04698dd2e6f
+
+instance BG.FromFunPtr MyFunctionPointer_Aux where
+
+  fromFunPtr = hs_bindgen_5738272f94a589e2
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapMyFunctionPointer_Aux" MyFunctionPointer_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MyFunctionPointer_Aux {unwrapMyFunctionPointer_Aux = y1}
+      , BG.getField @"unwrapMyFunctionPointer_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "unwrapMyFunctionPointer_Aux" (BG.Ptr MyFunctionPointer_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyFunctionPointer_Aux")
+
+instance HasCField.HasCField MyFunctionPointer_Aux "unwrapMyFunctionPointer_Aux" where
+
+  type CFieldType MyFunctionPointer_Aux "unwrapMyFunctionPointer_Aux" =
+    BG.CInt -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @MyFunctionPointer@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 5:15@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype MyFunctionPointer = MyFunctionPointer
+  { unwrapMyFunctionPointer :: BG.FunPtr MyFunctionPointer_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr MyFunctionPointer_Aux
+         ) => BG.CompatHasField.HasField "unwrapMyFunctionPointer" MyFunctionPointer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MyFunctionPointer {unwrapMyFunctionPointer = y1}
+      , BG.getField @"unwrapMyFunctionPointer" x0
+      )
+
+instance ( ty ~ BG.FunPtr MyFunctionPointer_Aux
+         ) => BG.HasField "unwrapMyFunctionPointer" (BG.Ptr MyFunctionPointer) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyFunctionPointer")
+
+instance HasCField.HasCField MyFunctionPointer "unwrapMyFunctionPointer" where
+
+  type CFieldType MyFunctionPointer "unwrapMyFunctionPointer" =
+    BG.FunPtr MyFunctionPointer_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype A = A
+  { unwrapA :: MyFunctionPointer
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ MyFunctionPointer
+         ) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance ( ty ~ MyFunctionPointer
+         ) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyFunctionPointer
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example/FunPtr.hs
@@ -0,0 +1,186 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/function_pointer.h>"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e113ab1229902001 (void)) ("
+  , "  MyFunctionPointer arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_5e83648377d8afc6 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d6d79c737e65f7e7 (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_566c44a793d222a9 (void)) ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9214c66c2650a721 (void)) ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrofu_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_08a6ea4ce7e2c244 (void)) ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_e113ab1229902001" hs_bindgen_e113ab1229902001_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+hs_bindgen_e113ab1229902001 :: IO (BG.FunPtr (MyFunctionPointer -> IO ()))
+hs_bindgen_e113ab1229902001 =
+  fmap BG.fromFFIType hs_bindgen_e113ab1229902001_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+foo :: BG.FunPtr (MyFunctionPointer -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_e113ab1229902001
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_5e83648377d8afc6" hs_bindgen_5e83648377d8afc6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+hs_bindgen_5e83648377d8afc6 :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_5e83648377d8afc6 =
+  fmap BG.fromFFIType hs_bindgen_5e83648377d8afc6_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooA :: BG.FunPtr (A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_5e83648377d8afc6
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_d6d79c737e65f7e7" hs_bindgen_d6d79c737e65f7e7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+hs_bindgen_d6d79c737e65f7e7 :: IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_d6d79c737e65f7e7 =
+  fmap BG.fromFFIType hs_bindgen_d6d79c737e65f7e7_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooB :: BG.FunPtr (B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_d6d79c737e65f7e7
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_566c44a793d222a9" hs_bindgen_566c44a793d222a9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+hs_bindgen_566c44a793d222a9 :: IO (BG.FunPtr (M.C -> IO ()))
+hs_bindgen_566c44a793d222a9 =
+  fmap BG.fromFFIType hs_bindgen_566c44a793d222a9_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooC :: BG.FunPtr (M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_566c44a793d222a9
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_9214c66c2650a721" hs_bindgen_9214c66c2650a721_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+hs_bindgen_9214c66c2650a721 :: IO (BG.FunPtr (M.D -> IO ()))
+hs_bindgen_9214c66c2650a721 =
+  fmap BG.fromFFIType hs_bindgen_9214c66c2650a721_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooD :: BG.FunPtr (M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_9214c66c2650a721
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_08a6ea4ce7e2c244" hs_bindgen_08a6ea4ce7e2c244_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+hs_bindgen_08a6ea4ce7e2c244 :: IO (BG.FunPtr (E -> IO ()))
+hs_bindgen_08a6ea4ce7e2c244 =
+  fmap BG.fromFFIType hs_bindgen_08a6ea4ce7e2c244_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooE :: BG.FunPtr (E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_08a6ea4ce7e2c244
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example/Safe.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/function_pointer.h>"
+  , "void hs_bindgen_40e15e86e5db36ce ("
+  , "  MyFunctionPointer arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_e13a57fd1d27f6e6 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_fd490df5087893ae ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_c552a862db9ba6eb ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_b08ba864cf83a382 ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_ca717b3afd1e43f5 ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_40e15e86e5db36ce" hs_bindgen_40e15e86e5db36ce_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+hs_bindgen_40e15e86e5db36ce ::
+     MyFunctionPointer
+  -> IO ()
+hs_bindgen_40e15e86e5db36ce =
+  \x0 ->
+    hs_bindgen_40e15e86e5db36ce_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+foo ::
+     MyFunctionPointer
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_40e15e86e5db36ce
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_e13a57fd1d27f6e6" hs_bindgen_e13a57fd1d27f6e6_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+hs_bindgen_e13a57fd1d27f6e6 ::
+     A
+  -> IO ()
+hs_bindgen_e13a57fd1d27f6e6 =
+  \x0 ->
+    hs_bindgen_e13a57fd1d27f6e6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_e13a57fd1d27f6e6
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_fd490df5087893ae" hs_bindgen_fd490df5087893ae_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+hs_bindgen_fd490df5087893ae ::
+     B
+  -> IO ()
+hs_bindgen_fd490df5087893ae =
+  \x0 ->
+    hs_bindgen_fd490df5087893ae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_fd490df5087893ae
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_c552a862db9ba6eb" hs_bindgen_c552a862db9ba6eb_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+hs_bindgen_c552a862db9ba6eb ::
+     M.C
+  -> IO ()
+hs_bindgen_c552a862db9ba6eb =
+  \x0 ->
+    hs_bindgen_c552a862db9ba6eb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_c552a862db9ba6eb
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_b08ba864cf83a382" hs_bindgen_b08ba864cf83a382_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+hs_bindgen_b08ba864cf83a382 ::
+     M.D
+  -> IO ()
+hs_bindgen_b08ba864cf83a382 =
+  \x0 ->
+    hs_bindgen_b08ba864cf83a382_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_b08ba864cf83a382
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_ca717b3afd1e43f5" hs_bindgen_ca717b3afd1e43f5_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+hs_bindgen_ca717b3afd1e43f5 ::
+     E
+  -> IO ()
+hs_bindgen_ca717b3afd1e43f5 =
+  \x0 ->
+    hs_bindgen_ca717b3afd1e43f5_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_ca717b3afd1e43f5
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/Example/Unsafe.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/function_pointer.h>"
+  , "void hs_bindgen_fbc2ec26cd297034 ("
+  , "  MyFunctionPointer arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_cf67e2fc00fd28d8 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_269a46f9680e33ed ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_f9bc9d37a12171dd ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_ca21c7e4aaa33a81 ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_e71a09bea0aef335 ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_fbc2ec26cd297034" hs_bindgen_fbc2ec26cd297034_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+hs_bindgen_fbc2ec26cd297034 ::
+     MyFunctionPointer
+  -> IO ()
+hs_bindgen_fbc2ec26cd297034 =
+  \x0 ->
+    hs_bindgen_fbc2ec26cd297034_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+foo ::
+     MyFunctionPointer
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_fbc2ec26cd297034
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_cf67e2fc00fd28d8" hs_bindgen_cf67e2fc00fd28d8_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+hs_bindgen_cf67e2fc00fd28d8 ::
+     A
+  -> IO ()
+hs_bindgen_cf67e2fc00fd28d8 =
+  \x0 ->
+    hs_bindgen_cf67e2fc00fd28d8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_cf67e2fc00fd28d8
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_269a46f9680e33ed" hs_bindgen_269a46f9680e33ed_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+hs_bindgen_269a46f9680e33ed ::
+     B
+  -> IO ()
+hs_bindgen_269a46f9680e33ed =
+  \x0 ->
+    hs_bindgen_269a46f9680e33ed_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_269a46f9680e33ed
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_f9bc9d37a12171dd" hs_bindgen_f9bc9d37a12171dd_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+hs_bindgen_f9bc9d37a12171dd ::
+     M.C
+  -> IO ()
+hs_bindgen_f9bc9d37a12171dd =
+  \x0 ->
+    hs_bindgen_f9bc9d37a12171dd_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_f9bc9d37a12171dd
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_ca21c7e4aaa33a81" hs_bindgen_ca21c7e4aaa33a81_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+hs_bindgen_ca21c7e4aaa33a81 ::
+     M.D
+  -> IO ()
+hs_bindgen_ca21c7e4aaa33a81 =
+  \x0 ->
+    hs_bindgen_ca21c7e4aaa33a81_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_ca21c7e4aaa33a81
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_e71a09bea0aef335" hs_bindgen_e71a09bea0aef335_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+hs_bindgen_e71a09bea0aef335 ::
+     E
+  -> IO ()
+hs_bindgen_e71a09bea0aef335 =
+  \x0 ->
+    hs_bindgen_e71a09bea0aef335_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_e71a09bea0aef335
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/bindingspec.yaml
@@ -0,0 +1,93 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/macro/function_pointer.h
+  cname: MyFunctionPointer
+  hsname: MyFunctionPointer
+- headers: binding-specs/fun_arg/macro/function_pointer.h
+  cname: macro A
+  hsname: A
+- headers: binding-specs/fun_arg/macro/function_pointer.h
+  cname: macro B
+  hsname: B
+- headers: binding-specs/fun_arg/macro/function_pointer.h
+  cname: macro E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyFunctionPointer
+  representation:
+    newtype:
+      constructor: MyFunctionPointer
+      fields:
+      - unwrapMyFunctionPointer
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/function_pointer/th.txt
@@ -0,0 +1,653 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/macro/function_pointer.h
+-- #include <binding-specs/fun_arg/macro/function_pointer.h>
+-- void hs_bindgen_40e15e86e5db36ce (
+--   MyFunctionPointer arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_e13a57fd1d27f6e6 (
+--   A arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_fd490df5087893ae (
+--   B arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_c552a862db9ba6eb (
+--   C arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_b08ba864cf83a382 (
+--   D arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_ca717b3afd1e43f5 (
+--   E arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_fbc2ec26cd297034 (
+--   MyFunctionPointer arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_cf67e2fc00fd28d8 (
+--   A arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_269a46f9680e33ed (
+--   B arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_f9bc9d37a12171dd (
+--   C arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_ca21c7e4aaa33a81 (
+--   D arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_e71a09bea0aef335 (
+--   E arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e113ab1229902001 (void)) (
+--   MyFunctionPointer arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_5e83648377d8afc6 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d6d79c737e65f7e7 (void)) (
+--   B arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_566c44a793d222a9 (void)) (
+--   C arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9214c66c2650a721 (void)) (
+--   D arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argmacrofu_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_08a6ea4ce7e2c244 (void)) (
+--   E arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| Auxiliary type used by 'MyFunctionPointer'
+
+    __C declaration:__ @MyFunctionPointer@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 5:15@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype MyFunctionPointer_Aux
+    = MyFunctionPointer_Aux {unwrapMyFunctionPointer_Aux :: (CInt ->
+                                                             IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toMyFunctionPointer_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_47dfd04698dd2e6f_base ::
+    CInt -> IO CInt
+ -> IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @toMyFunctionPointer_Aux@
+hs_bindgen_47dfd04698dd2e6f :: MyFunctionPointer_Aux ->
+                               IO (FunPtr MyFunctionPointer_Aux)
+-- __unique:__ @toMyFunctionPointer_Aux@
+hs_bindgen_47dfd04698dd2e6f = \fun_0 -> fmap castFunPtr (hs_bindgen_47dfd04698dd2e6f_base (\x_1 -> fmap toFFIType (getField @"unwrapMyFunctionPointer_Aux" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromMyFunctionPointer_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_5738272f94a589e2_base ::
+    FunPtr (CInt -> IO CInt)
+ -> CInt
+ -> IO CInt
+-- __unique:__ @fromMyFunctionPointer_Aux@
+hs_bindgen_5738272f94a589e2 :: FunPtr MyFunctionPointer_Aux ->
+                               MyFunctionPointer_Aux
+-- __unique:__ @fromMyFunctionPointer_Aux@
+hs_bindgen_5738272f94a589e2 = \funPtr_0 -> MyFunctionPointer_Aux (\x_1 -> fmap fromFFIType (hs_bindgen_5738272f94a589e2_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr MyFunctionPointer_Aux
+    where toFunPtr = hs_bindgen_47dfd04698dd2e6f
+instance FromFunPtr MyFunctionPointer_Aux
+    where fromFunPtr = hs_bindgen_5738272f94a589e2
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapMyFunctionPointer_Aux" MyFunctionPointer_Aux ty
+    where hasField = \x_0 -> (\y_1 -> MyFunctionPointer_Aux{unwrapMyFunctionPointer_Aux = y_1},
+                              getField @"unwrapMyFunctionPointer_Aux" x_0)
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapMyFunctionPointer_Aux"
+                  (Ptr MyFunctionPointer_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyFunctionPointer_Aux")
+instance HasCField MyFunctionPointer_Aux
+                   "unwrapMyFunctionPointer_Aux"
+    where type CFieldType MyFunctionPointer_Aux
+                          "unwrapMyFunctionPointer_Aux" = CInt -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @MyFunctionPointer@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 5:15@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype MyFunctionPointer
+    = MyFunctionPointer {unwrapMyFunctionPointer :: (FunPtr MyFunctionPointer_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr MyFunctionPointer_Aux) =>
+         HasField "unwrapMyFunctionPointer" MyFunctionPointer ty
+    where hasField = \x_0 -> (\y_1 -> MyFunctionPointer{unwrapMyFunctionPointer = y_1},
+                              getField @"unwrapMyFunctionPointer" x_0)
+instance (~) ty (FunPtr MyFunctionPointer_Aux) =>
+         HasField "unwrapMyFunctionPointer" (Ptr MyFunctionPointer) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyFunctionPointer")
+instance HasCField MyFunctionPointer "unwrapMyFunctionPointer"
+    where type CFieldType MyFunctionPointer
+                          "unwrapMyFunctionPointer" = FunPtr MyFunctionPointer_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype A
+    = A {unwrapA :: MyFunctionPointer}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty MyFunctionPointer => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyFunctionPointer =>
+         HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyFunctionPointer
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_40e15e86e5db36ce" hs_bindgen_40e15e86e5db36ce_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+hs_bindgen_40e15e86e5db36ce :: MyFunctionPointer -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_foo@
+hs_bindgen_40e15e86e5db36ce = \x_0 -> hs_bindgen_40e15e86e5db36ce_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+foo_safe :: MyFunctionPointer -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+foo_safe = hs_bindgen_40e15e86e5db36ce
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_e13a57fd1d27f6e6" hs_bindgen_e13a57fd1d27f6e6_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+hs_bindgen_e13a57fd1d27f6e6 :: A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooA@
+hs_bindgen_e13a57fd1d27f6e6 = \x_0 -> hs_bindgen_e13a57fd1d27f6e6_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooA_safe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooA_safe = hs_bindgen_e13a57fd1d27f6e6
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_fd490df5087893ae" hs_bindgen_fd490df5087893ae_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+hs_bindgen_fd490df5087893ae :: B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooB@
+hs_bindgen_fd490df5087893ae = \x_0 -> hs_bindgen_fd490df5087893ae_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooB_safe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooB_safe = hs_bindgen_fd490df5087893ae
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_c552a862db9ba6eb" hs_bindgen_c552a862db9ba6eb_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+hs_bindgen_c552a862db9ba6eb :: M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooC@
+hs_bindgen_c552a862db9ba6eb = \x_0 -> hs_bindgen_c552a862db9ba6eb_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooC_safe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooC_safe = hs_bindgen_c552a862db9ba6eb
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_b08ba864cf83a382" hs_bindgen_b08ba864cf83a382_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+hs_bindgen_b08ba864cf83a382 :: M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooD@
+hs_bindgen_b08ba864cf83a382 = \x_0 -> hs_bindgen_b08ba864cf83a382_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooD_safe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooD_safe = hs_bindgen_b08ba864cf83a382
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_ca717b3afd1e43f5" hs_bindgen_ca717b3afd1e43f5_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+hs_bindgen_ca717b3afd1e43f5 :: E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Safe_fooE@
+hs_bindgen_ca717b3afd1e43f5 = \x_0 -> hs_bindgen_ca717b3afd1e43f5_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooE_safe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooE_safe = hs_bindgen_ca717b3afd1e43f5
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_fbc2ec26cd297034" hs_bindgen_fbc2ec26cd297034_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+hs_bindgen_fbc2ec26cd297034 :: MyFunctionPointer -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_foo@
+hs_bindgen_fbc2ec26cd297034 = \x_0 -> hs_bindgen_fbc2ec26cd297034_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+foo_unsafe :: MyFunctionPointer -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+foo_unsafe = hs_bindgen_fbc2ec26cd297034
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_cf67e2fc00fd28d8" hs_bindgen_cf67e2fc00fd28d8_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+hs_bindgen_cf67e2fc00fd28d8 :: A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooA@
+hs_bindgen_cf67e2fc00fd28d8 = \x_0 -> hs_bindgen_cf67e2fc00fd28d8_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooA_unsafe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooA_unsafe = hs_bindgen_cf67e2fc00fd28d8
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_269a46f9680e33ed" hs_bindgen_269a46f9680e33ed_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+hs_bindgen_269a46f9680e33ed :: B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooB@
+hs_bindgen_269a46f9680e33ed = \x_0 -> hs_bindgen_269a46f9680e33ed_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooB_unsafe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooB_unsafe = hs_bindgen_269a46f9680e33ed
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_f9bc9d37a12171dd" hs_bindgen_f9bc9d37a12171dd_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+hs_bindgen_f9bc9d37a12171dd :: M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooC@
+hs_bindgen_f9bc9d37a12171dd = \x_0 -> hs_bindgen_f9bc9d37a12171dd_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooC_unsafe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooC_unsafe = hs_bindgen_f9bc9d37a12171dd
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_ca21c7e4aaa33a81" hs_bindgen_ca21c7e4aaa33a81_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+hs_bindgen_ca21c7e4aaa33a81 :: M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooD@
+hs_bindgen_ca21c7e4aaa33a81 = \x_0 -> hs_bindgen_ca21c7e4aaa33a81_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooD_unsafe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooD_unsafe = hs_bindgen_ca21c7e4aaa33a81
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_e71a09bea0aef335" hs_bindgen_e71a09bea0aef335_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+hs_bindgen_e71a09bea0aef335 :: E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_Unsafe_fooE@
+hs_bindgen_e71a09bea0aef335 = \x_0 -> hs_bindgen_e71a09bea0aef335_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooE_unsafe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooE_unsafe = hs_bindgen_e71a09bea0aef335
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_e113ab1229902001" hs_bindgen_e113ab1229902001_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+hs_bindgen_e113ab1229902001 :: IO (FunPtr (MyFunctionPointer ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_foo@
+hs_bindgen_e113ab1229902001 = fmap fromFFIType hs_bindgen_e113ab1229902001_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+foo_funptr :: FunPtr (MyFunctionPointer -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_e113ab1229902001
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_5e83648377d8afc6" hs_bindgen_5e83648377d8afc6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+hs_bindgen_5e83648377d8afc6 :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooA@
+hs_bindgen_5e83648377d8afc6 = fmap fromFFIType hs_bindgen_5e83648377d8afc6_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooA_funptr :: FunPtr (A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_5e83648377d8afc6
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_d6d79c737e65f7e7" hs_bindgen_d6d79c737e65f7e7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+hs_bindgen_d6d79c737e65f7e7 :: IO (FunPtr (B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooB@
+hs_bindgen_d6d79c737e65f7e7 = fmap fromFFIType hs_bindgen_d6d79c737e65f7e7_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooB_funptr :: FunPtr (B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_d6d79c737e65f7e7
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_566c44a793d222a9" hs_bindgen_566c44a793d222a9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+hs_bindgen_566c44a793d222a9 :: IO (FunPtr (M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooC@
+hs_bindgen_566c44a793d222a9 = fmap fromFFIType hs_bindgen_566c44a793d222a9_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooC_funptr :: FunPtr (M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_566c44a793d222a9
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_9214c66c2650a721" hs_bindgen_9214c66c2650a721_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+hs_bindgen_9214c66c2650a721 :: IO (FunPtr (M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooD@
+hs_bindgen_9214c66c2650a721 = fmap fromFFIType hs_bindgen_9214c66c2650a721_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooD_funptr :: FunPtr (M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_9214c66c2650a721
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_08a6ea4ce7e2c244" hs_bindgen_08a6ea4ce7e2c244_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+hs_bindgen_08a6ea4ce7e2c244 :: IO (FunPtr (E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrofu_Example_get_fooE@
+hs_bindgen_08a6ea4ce7e2c244 = fmap fromFFIType hs_bindgen_08a6ea4ce7e2c244_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooE_funptr :: FunPtr (E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/function_pointer.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/function_pointer.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_08a6ea4ce7e2c244
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example.hs
@@ -0,0 +1,192 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyStruct(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct MyStruct@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 5:8@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+data MyStruct = MyStruct
+  { myStruct_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 6:7@
+
+         __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize MyStruct where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw MyStruct where
+
+  readRaw =
+    \ptr0 ->
+          pure MyStruct
+      <*> HasCField.readRaw (BG.Proxy @"myStruct_x") ptr0
+
+instance Marshal.WriteRaw MyStruct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MyStruct myStruct_x2 ->
+            HasCField.writeRaw (BG.Proxy @"myStruct_x") ptr0 myStruct_x2
+
+deriving via Marshal.EquivStorable MyStruct instance BG.Storable MyStruct
+
+deriving via Struct.IsStructViaReadRaw MyStruct instance Struct.IsStruct MyStruct
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 6:7@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "myStruct_x" MyStruct ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyStruct {myStruct_x = y1}, BG.getField @"myStruct_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "myStruct_x" (BG.Ptr MyStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"myStruct_x")
+
+instance HasCField.HasCField MyStruct "myStruct_x" where
+
+  type CFieldType MyStruct "myStruct_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 11:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+newtype A = A
+  { unwrapA :: MyStruct
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ MyStruct) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ MyStruct) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 12:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 35:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example/FunPtr.hs
@@ -0,0 +1,186 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/struct.h>"
+  , "/* test_bindingspecsfun_argmacrost_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ccfc23165c7fd4a9 (void)) ("
+  , "  struct MyStruct arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrost_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ab74a4a30349b6b2 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrost_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_19855bed49223360 (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrost_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_11912ef040cef859 (void)) ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrost_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_45e77aca55d2f794 (void)) ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacrost_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d8f4dbc2ffc05918 (void)) ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_ccfc23165c7fd4a9" hs_bindgen_ccfc23165c7fd4a9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_foo@
+hs_bindgen_ccfc23165c7fd4a9 :: IO (BG.FunPtr (MyStruct -> IO ()))
+hs_bindgen_ccfc23165c7fd4a9 =
+  fmap BG.fromFFIType hs_bindgen_ccfc23165c7fd4a9_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 8:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+foo :: BG.FunPtr (MyStruct -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_ccfc23165c7fd4a9
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_ab74a4a30349b6b2" hs_bindgen_ab74a4a30349b6b2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooA@
+hs_bindgen_ab74a4a30349b6b2 :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_ab74a4a30349b6b2 =
+  fmap BG.fromFFIType hs_bindgen_ab74a4a30349b6b2_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 14:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooA :: BG.FunPtr (A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_ab74a4a30349b6b2
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_19855bed49223360" hs_bindgen_19855bed49223360_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooB@
+hs_bindgen_19855bed49223360 :: IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_19855bed49223360 =
+  fmap BG.fromFFIType hs_bindgen_19855bed49223360_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 15:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooB :: BG.FunPtr (B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_19855bed49223360
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_11912ef040cef859" hs_bindgen_11912ef040cef859_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooC@
+hs_bindgen_11912ef040cef859 :: IO (BG.FunPtr (M.C -> IO ()))
+hs_bindgen_11912ef040cef859 =
+  fmap BG.fromFFIType hs_bindgen_11912ef040cef859_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 37:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooC :: BG.FunPtr (M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_11912ef040cef859
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_45e77aca55d2f794" hs_bindgen_45e77aca55d2f794_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooD@
+hs_bindgen_45e77aca55d2f794 :: IO (BG.FunPtr (M.D -> IO ()))
+hs_bindgen_45e77aca55d2f794 =
+  fmap BG.fromFFIType hs_bindgen_45e77aca55d2f794_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 38:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooD :: BG.FunPtr (M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_45e77aca55d2f794
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_d8f4dbc2ffc05918" hs_bindgen_d8f4dbc2ffc05918_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooE@
+hs_bindgen_d8f4dbc2ffc05918 :: IO (BG.FunPtr (E -> IO ()))
+hs_bindgen_d8f4dbc2ffc05918 =
+  fmap BG.fromFFIType hs_bindgen_d8f4dbc2ffc05918_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 39:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooE :: BG.FunPtr (E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_d8f4dbc2ffc05918
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example/Safe.hs
@@ -0,0 +1,222 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/struct.h>"
+  , "void hs_bindgen_f2a9c7d0ba1aaa3b ("
+  , "  struct MyStruct *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(*arg1);"
+  , "}"
+  , "void hs_bindgen_d7efef1db7e6b005 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(*arg1);"
+  , "}"
+  , "void hs_bindgen_e49c2e985e471c99 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(*arg1);"
+  , "}"
+  , "void hs_bindgen_584b4871ddfb93d1 ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(*arg1);"
+  , "}"
+  , "void hs_bindgen_6ff72b6fa11fd038 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(*arg1);"
+  , "}"
+  , "void hs_bindgen_9c23f536b3698c65 ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_f2a9c7d0ba1aaa3b" hs_bindgen_f2a9c7d0ba1aaa3b_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_foo@
+hs_bindgen_f2a9c7d0ba1aaa3b ::
+     BG.Ptr MyStruct
+  -> IO ()
+hs_bindgen_f2a9c7d0ba1aaa3b =
+  \x0 ->
+    hs_bindgen_f2a9c7d0ba1aaa3b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 8:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+foo ::
+     MyStruct
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_f2a9c7d0ba1aaa3b x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_d7efef1db7e6b005" hs_bindgen_d7efef1db7e6b005_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooA@
+hs_bindgen_d7efef1db7e6b005 ::
+     BG.Ptr A
+  -> IO ()
+hs_bindgen_d7efef1db7e6b005 =
+  \x0 ->
+    hs_bindgen_d7efef1db7e6b005_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 14:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_d7efef1db7e6b005 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_e49c2e985e471c99" hs_bindgen_e49c2e985e471c99_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooB@
+hs_bindgen_e49c2e985e471c99 ::
+     BG.Ptr B
+  -> IO ()
+hs_bindgen_e49c2e985e471c99 =
+  \x0 ->
+    hs_bindgen_e49c2e985e471c99_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 15:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_e49c2e985e471c99 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_584b4871ddfb93d1" hs_bindgen_584b4871ddfb93d1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooC@
+hs_bindgen_584b4871ddfb93d1 ::
+     BG.Ptr M.C
+  -> IO ()
+hs_bindgen_584b4871ddfb93d1 =
+  \x0 ->
+    hs_bindgen_584b4871ddfb93d1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 37:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_584b4871ddfb93d1 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_6ff72b6fa11fd038" hs_bindgen_6ff72b6fa11fd038_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooD@
+hs_bindgen_6ff72b6fa11fd038 ::
+     BG.Ptr M.D
+  -> IO ()
+hs_bindgen_6ff72b6fa11fd038 =
+  \x0 ->
+    hs_bindgen_6ff72b6fa11fd038_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 38:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_6ff72b6fa11fd038 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_9c23f536b3698c65" hs_bindgen_9c23f536b3698c65_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooE@
+hs_bindgen_9c23f536b3698c65 ::
+     BG.Ptr E
+  -> IO ()
+hs_bindgen_9c23f536b3698c65 =
+  \x0 ->
+    hs_bindgen_9c23f536b3698c65_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 39:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_9c23f536b3698c65 x1)
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/Example/Unsafe.hs
@@ -0,0 +1,222 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/struct.h>"
+  , "void hs_bindgen_9dbeca9fa307eee9 ("
+  , "  struct MyStruct *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(*arg1);"
+  , "}"
+  , "void hs_bindgen_fb94ee6f22de1d89 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(*arg1);"
+  , "}"
+  , "void hs_bindgen_f8f83a7090687b7e ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(*arg1);"
+  , "}"
+  , "void hs_bindgen_f1d253a32d18ddb1 ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(*arg1);"
+  , "}"
+  , "void hs_bindgen_2ee0831a468707cf ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(*arg1);"
+  , "}"
+  , "void hs_bindgen_21fc30db2a015ba1 ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_9dbeca9fa307eee9" hs_bindgen_9dbeca9fa307eee9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_foo@
+hs_bindgen_9dbeca9fa307eee9 ::
+     BG.Ptr MyStruct
+  -> IO ()
+hs_bindgen_9dbeca9fa307eee9 =
+  \x0 ->
+    hs_bindgen_9dbeca9fa307eee9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 8:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+foo ::
+     MyStruct
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_9dbeca9fa307eee9 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_fb94ee6f22de1d89" hs_bindgen_fb94ee6f22de1d89_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooA@
+hs_bindgen_fb94ee6f22de1d89 ::
+     BG.Ptr A
+  -> IO ()
+hs_bindgen_fb94ee6f22de1d89 =
+  \x0 ->
+    hs_bindgen_fb94ee6f22de1d89_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 14:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_fb94ee6f22de1d89 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_f8f83a7090687b7e" hs_bindgen_f8f83a7090687b7e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooB@
+hs_bindgen_f8f83a7090687b7e ::
+     BG.Ptr B
+  -> IO ()
+hs_bindgen_f8f83a7090687b7e =
+  \x0 ->
+    hs_bindgen_f8f83a7090687b7e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 15:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_f8f83a7090687b7e x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_f1d253a32d18ddb1" hs_bindgen_f1d253a32d18ddb1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooC@
+hs_bindgen_f1d253a32d18ddb1 ::
+     BG.Ptr M.C
+  -> IO ()
+hs_bindgen_f1d253a32d18ddb1 =
+  \x0 ->
+    hs_bindgen_f1d253a32d18ddb1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 37:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_f1d253a32d18ddb1 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_2ee0831a468707cf" hs_bindgen_2ee0831a468707cf_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooD@
+hs_bindgen_2ee0831a468707cf ::
+     BG.Ptr M.D
+  -> IO ()
+hs_bindgen_2ee0831a468707cf =
+  \x0 ->
+    hs_bindgen_2ee0831a468707cf_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 38:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_2ee0831a468707cf x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_21fc30db2a015ba1" hs_bindgen_21fc30db2a015ba1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooE@
+hs_bindgen_21fc30db2a015ba1 ::
+     BG.Ptr E
+  -> IO ()
+hs_bindgen_21fc30db2a015ba1 =
+  \x0 ->
+    hs_bindgen_21fc30db2a015ba1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 39:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_21fc30db2a015ba1 x1)
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/bindingspec.yaml
@@ -0,0 +1,85 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/macro/struct.h
+  cname: struct MyStruct
+  hsname: MyStruct
+- headers: binding-specs/fun_arg/macro/struct.h
+  cname: macro A
+  hsname: A
+- headers: binding-specs/fun_arg/macro/struct.h
+  cname: macro B
+  hsname: B
+- headers: binding-specs/fun_arg/macro/struct.h
+  cname: macro E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyStruct
+  representation:
+    record:
+      constructor: MyStruct
+      fields:
+      - myStruct_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/struct/th.txt
@@ -0,0 +1,603 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/macro/struct.h
+-- #include <binding-specs/fun_arg/macro/struct.h>
+-- void hs_bindgen_f2a9c7d0ba1aaa3b (
+--   struct MyStruct *arg1
+-- )
+-- {
+--   (foo)(*arg1);
+-- }
+-- void hs_bindgen_d7efef1db7e6b005 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(*arg1);
+-- }
+-- void hs_bindgen_e49c2e985e471c99 (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(*arg1);
+-- }
+-- void hs_bindgen_584b4871ddfb93d1 (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(*arg1);
+-- }
+-- void hs_bindgen_6ff72b6fa11fd038 (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(*arg1);
+-- }
+-- void hs_bindgen_9c23f536b3698c65 (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(*arg1);
+-- }
+-- void hs_bindgen_9dbeca9fa307eee9 (
+--   struct MyStruct *arg1
+-- )
+-- {
+--   (foo)(*arg1);
+-- }
+-- void hs_bindgen_fb94ee6f22de1d89 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(*arg1);
+-- }
+-- void hs_bindgen_f8f83a7090687b7e (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(*arg1);
+-- }
+-- void hs_bindgen_f1d253a32d18ddb1 (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(*arg1);
+-- }
+-- void hs_bindgen_2ee0831a468707cf (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(*arg1);
+-- }
+-- void hs_bindgen_21fc30db2a015ba1 (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(*arg1);
+-- }
+-- /* test_bindingspecsfun_argmacrost_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ccfc23165c7fd4a9 (void)) (
+--   struct MyStruct arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argmacrost_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ab74a4a30349b6b2 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argmacrost_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_19855bed49223360 (void)) (
+--   B arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argmacrost_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_11912ef040cef859 (void)) (
+--   C arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argmacrost_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_45e77aca55d2f794 (void)) (
+--   D arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argmacrost_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d8f4dbc2ffc05918 (void)) (
+--   E arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @struct MyStruct@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 5:8@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+data MyStruct
+    = MyStruct {myStruct_x :: CInt
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 6:7@
+
+                     __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize MyStruct
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw MyStruct
+    where readRaw = \ptr_0 -> pure MyStruct <*> readRaw (Proxy @"myStruct_x") ptr_0
+instance WriteRaw MyStruct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MyStruct myStruct_x_2 -> writeRaw (Proxy @"myStruct_x") ptr_0 myStruct_x_2
+deriving via (EquivStorable MyStruct) instance Storable MyStruct
+deriving via (IsStructViaReadRaw MyStruct) instance IsStruct MyStruct
+instance (~) ty CInt => HasField "myStruct_x" MyStruct ty
+    where hasField = \x_0 -> (\y_1 -> MyStruct{myStruct_x = y_1},
+                              getField @"myStruct_x" x_0)
+instance (~) ty CInt =>
+         HasField "myStruct_x" (Ptr MyStruct) (Ptr ty)
+    where getField = fromPtr (Proxy @"myStruct_x")
+instance HasCField MyStruct "myStruct_x"
+    where type CFieldType MyStruct "myStruct_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 11:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+newtype A
+    = A {unwrapA :: MyStruct}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty MyStruct => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyStruct => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyStruct
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 12:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 35:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_f2a9c7d0ba1aaa3b" hs_bindgen_f2a9c7d0ba1aaa3b_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_foo@
+hs_bindgen_f2a9c7d0ba1aaa3b :: Ptr MyStruct -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_foo@
+hs_bindgen_f2a9c7d0ba1aaa3b = \x_0 -> hs_bindgen_f2a9c7d0ba1aaa3b_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 8:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+foo_safe :: MyStruct -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 8:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+foo_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_f2a9c7d0ba1aaa3b x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_d7efef1db7e6b005" hs_bindgen_d7efef1db7e6b005_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooA@
+hs_bindgen_d7efef1db7e6b005 :: Ptr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooA@
+hs_bindgen_d7efef1db7e6b005 = \x_0 -> hs_bindgen_d7efef1db7e6b005_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 14:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooA_safe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 14:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooA_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_d7efef1db7e6b005 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_e49c2e985e471c99" hs_bindgen_e49c2e985e471c99_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooB@
+hs_bindgen_e49c2e985e471c99 :: Ptr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooB@
+hs_bindgen_e49c2e985e471c99 = \x_0 -> hs_bindgen_e49c2e985e471c99_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 15:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooB_safe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 15:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooB_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_e49c2e985e471c99 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_584b4871ddfb93d1" hs_bindgen_584b4871ddfb93d1_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooC@
+hs_bindgen_584b4871ddfb93d1 :: Ptr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooC@
+hs_bindgen_584b4871ddfb93d1 = \x_0 -> hs_bindgen_584b4871ddfb93d1_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 37:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooC_safe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 37:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooC_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_584b4871ddfb93d1 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_6ff72b6fa11fd038" hs_bindgen_6ff72b6fa11fd038_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooD@
+hs_bindgen_6ff72b6fa11fd038 :: Ptr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooD@
+hs_bindgen_6ff72b6fa11fd038 = \x_0 -> hs_bindgen_6ff72b6fa11fd038_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 38:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooD_safe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 38:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooD_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_6ff72b6fa11fd038 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_9c23f536b3698c65" hs_bindgen_9c23f536b3698c65_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooE@
+hs_bindgen_9c23f536b3698c65 :: Ptr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Safe_fooE@
+hs_bindgen_9c23f536b3698c65 = \x_0 -> hs_bindgen_9c23f536b3698c65_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 39:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooE_safe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 39:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooE_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_9c23f536b3698c65 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_9dbeca9fa307eee9" hs_bindgen_9dbeca9fa307eee9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_foo@
+hs_bindgen_9dbeca9fa307eee9 :: Ptr MyStruct -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_foo@
+hs_bindgen_9dbeca9fa307eee9 = \x_0 -> hs_bindgen_9dbeca9fa307eee9_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 8:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+foo_unsafe :: MyStruct -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 8:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+foo_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_9dbeca9fa307eee9 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_fb94ee6f22de1d89" hs_bindgen_fb94ee6f22de1d89_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooA@
+hs_bindgen_fb94ee6f22de1d89 :: Ptr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooA@
+hs_bindgen_fb94ee6f22de1d89 = \x_0 -> hs_bindgen_fb94ee6f22de1d89_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 14:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooA_unsafe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 14:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooA_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_fb94ee6f22de1d89 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_f8f83a7090687b7e" hs_bindgen_f8f83a7090687b7e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooB@
+hs_bindgen_f8f83a7090687b7e :: Ptr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooB@
+hs_bindgen_f8f83a7090687b7e = \x_0 -> hs_bindgen_f8f83a7090687b7e_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 15:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooB_unsafe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 15:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooB_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_f8f83a7090687b7e x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_f1d253a32d18ddb1" hs_bindgen_f1d253a32d18ddb1_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooC@
+hs_bindgen_f1d253a32d18ddb1 :: Ptr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooC@
+hs_bindgen_f1d253a32d18ddb1 = \x_0 -> hs_bindgen_f1d253a32d18ddb1_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 37:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooC_unsafe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 37:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooC_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_f1d253a32d18ddb1 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_2ee0831a468707cf" hs_bindgen_2ee0831a468707cf_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooD@
+hs_bindgen_2ee0831a468707cf :: Ptr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooD@
+hs_bindgen_2ee0831a468707cf = \x_0 -> hs_bindgen_2ee0831a468707cf_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 38:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooD_unsafe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 38:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooD_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_2ee0831a468707cf x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_21fc30db2a015ba1" hs_bindgen_21fc30db2a015ba1_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooE@
+hs_bindgen_21fc30db2a015ba1 :: Ptr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_Unsafe_fooE@
+hs_bindgen_21fc30db2a015ba1 = \x_0 -> hs_bindgen_21fc30db2a015ba1_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 39:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooE_unsafe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 39:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooE_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_21fc30db2a015ba1 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_ccfc23165c7fd4a9" hs_bindgen_ccfc23165c7fd4a9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_foo@
+hs_bindgen_ccfc23165c7fd4a9 :: IO (FunPtr (MyStruct -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_foo@
+hs_bindgen_ccfc23165c7fd4a9 = fmap fromFFIType hs_bindgen_ccfc23165c7fd4a9_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 8:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+foo_funptr :: FunPtr (MyStruct -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 8:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_ccfc23165c7fd4a9
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_ab74a4a30349b6b2" hs_bindgen_ab74a4a30349b6b2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooA@
+hs_bindgen_ab74a4a30349b6b2 :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooA@
+hs_bindgen_ab74a4a30349b6b2 = fmap fromFFIType hs_bindgen_ab74a4a30349b6b2_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 14:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooA_funptr :: FunPtr (A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 14:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_ab74a4a30349b6b2
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_19855bed49223360" hs_bindgen_19855bed49223360_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooB@
+hs_bindgen_19855bed49223360 :: IO (FunPtr (B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooB@
+hs_bindgen_19855bed49223360 = fmap fromFFIType hs_bindgen_19855bed49223360_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 15:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooB_funptr :: FunPtr (B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 15:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_19855bed49223360
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_11912ef040cef859" hs_bindgen_11912ef040cef859_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooC@
+hs_bindgen_11912ef040cef859 :: IO (FunPtr (M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooC@
+hs_bindgen_11912ef040cef859 = fmap fromFFIType hs_bindgen_11912ef040cef859_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 37:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooC_funptr :: FunPtr (M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 37:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_11912ef040cef859
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_45e77aca55d2f794" hs_bindgen_45e77aca55d2f794_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooD@
+hs_bindgen_45e77aca55d2f794 :: IO (FunPtr (M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooD@
+hs_bindgen_45e77aca55d2f794 = fmap fromFFIType hs_bindgen_45e77aca55d2f794_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 38:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooD_funptr :: FunPtr (M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 38:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_45e77aca55d2f794
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_d8f4dbc2ffc05918" hs_bindgen_d8f4dbc2ffc05918_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooE@
+hs_bindgen_d8f4dbc2ffc05918 :: IO (FunPtr (E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacrost_Example_get_fooE@
+hs_bindgen_d8f4dbc2ffc05918 = fmap fromFFIType hs_bindgen_d8f4dbc2ffc05918_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 39:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooE_funptr :: FunPtr (E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/struct.h 39:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/struct.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_d8f4dbc2ffc05918
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example.hs
@@ -0,0 +1,180 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyUnion(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import qualified M
+import Prelude (type (~))
+
+{-| __C declaration:__ @union MyUnion@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 5:7@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+newtype MyUnion = MyUnion
+  { unwrapMyUnion :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize MyUnion
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw MyUnion
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw MyUnion
+
+deriving via Marshal.EquivStorable MyUnion instance BG.Storable MyUnion
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion MyUnion
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 5:21@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "myUnion_x" MyUnion ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 5:21@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "myUnion_x" MyUnion ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"myUnion_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "myUnion_x" (BG.Ptr MyUnion) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"myUnion_x")
+
+instance HasCField.HasCField MyUnion "myUnion_x" where
+
+  type CFieldType MyUnion "myUnion_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+newtype A = A
+  { unwrapA :: MyUnion
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ MyUnion) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ MyUnion) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyUnion
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example/FunPtr.hs
@@ -0,0 +1,186 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/union.h>"
+  , "/* test_bindingspecsfun_argmacroun_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cda902505d180c3d (void)) ("
+  , "  union MyUnion arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroun_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d2d25b201a07a90e (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroun_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_4f49b9aa9b0c125d (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroun_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_669f2d7e801db0d0 (void)) ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroun_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6504f8cec55c35ff (void)) ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argmacroun_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ae8e5c504bcf0849 (void)) ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_cda902505d180c3d" hs_bindgen_cda902505d180c3d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_foo@
+hs_bindgen_cda902505d180c3d :: IO (BG.FunPtr (MyUnion -> IO ()))
+hs_bindgen_cda902505d180c3d =
+  fmap BG.fromFFIType hs_bindgen_cda902505d180c3d_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+foo :: BG.FunPtr (MyUnion -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_cda902505d180c3d
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_d2d25b201a07a90e" hs_bindgen_d2d25b201a07a90e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooA@
+hs_bindgen_d2d25b201a07a90e :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_d2d25b201a07a90e =
+  fmap BG.fromFFIType hs_bindgen_d2d25b201a07a90e_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooA :: BG.FunPtr (A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_d2d25b201a07a90e
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_4f49b9aa9b0c125d" hs_bindgen_4f49b9aa9b0c125d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooB@
+hs_bindgen_4f49b9aa9b0c125d :: IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_4f49b9aa9b0c125d =
+  fmap BG.fromFFIType hs_bindgen_4f49b9aa9b0c125d_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooB :: BG.FunPtr (B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_4f49b9aa9b0c125d
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_669f2d7e801db0d0" hs_bindgen_669f2d7e801db0d0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooC@
+hs_bindgen_669f2d7e801db0d0 :: IO (BG.FunPtr (M.C -> IO ()))
+hs_bindgen_669f2d7e801db0d0 =
+  fmap BG.fromFFIType hs_bindgen_669f2d7e801db0d0_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooC :: BG.FunPtr (M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_669f2d7e801db0d0
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_6504f8cec55c35ff" hs_bindgen_6504f8cec55c35ff_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooD@
+hs_bindgen_6504f8cec55c35ff :: IO (BG.FunPtr (M.D -> IO ()))
+hs_bindgen_6504f8cec55c35ff =
+  fmap BG.fromFFIType hs_bindgen_6504f8cec55c35ff_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooD :: BG.FunPtr (M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_6504f8cec55c35ff
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_ae8e5c504bcf0849" hs_bindgen_ae8e5c504bcf0849_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooE@
+hs_bindgen_ae8e5c504bcf0849 :: IO (BG.FunPtr (E -> IO ()))
+hs_bindgen_ae8e5c504bcf0849 =
+  fmap BG.fromFFIType hs_bindgen_ae8e5c504bcf0849_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooE :: BG.FunPtr (E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_ae8e5c504bcf0849
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example/Safe.hs
@@ -0,0 +1,222 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/union.h>"
+  , "void hs_bindgen_5da9ad143faecbca ("
+  , "  union MyUnion *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(*arg1);"
+  , "}"
+  , "void hs_bindgen_f70ba8b74da026b3 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(*arg1);"
+  , "}"
+  , "void hs_bindgen_89e946b10b5189a6 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(*arg1);"
+  , "}"
+  , "void hs_bindgen_c82bf4a34bf547de ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(*arg1);"
+  , "}"
+  , "void hs_bindgen_25033ba8f1b4731d ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(*arg1);"
+  , "}"
+  , "void hs_bindgen_0cf5debdefedd88c ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_5da9ad143faecbca" hs_bindgen_5da9ad143faecbca_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_foo@
+hs_bindgen_5da9ad143faecbca ::
+     BG.Ptr MyUnion
+  -> IO ()
+hs_bindgen_5da9ad143faecbca =
+  \x0 ->
+    hs_bindgen_5da9ad143faecbca_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+foo ::
+     MyUnion
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_5da9ad143faecbca x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_f70ba8b74da026b3" hs_bindgen_f70ba8b74da026b3_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooA@
+hs_bindgen_f70ba8b74da026b3 ::
+     BG.Ptr A
+  -> IO ()
+hs_bindgen_f70ba8b74da026b3 =
+  \x0 ->
+    hs_bindgen_f70ba8b74da026b3_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_f70ba8b74da026b3 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_89e946b10b5189a6" hs_bindgen_89e946b10b5189a6_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooB@
+hs_bindgen_89e946b10b5189a6 ::
+     BG.Ptr B
+  -> IO ()
+hs_bindgen_89e946b10b5189a6 =
+  \x0 ->
+    hs_bindgen_89e946b10b5189a6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_89e946b10b5189a6 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_c82bf4a34bf547de" hs_bindgen_c82bf4a34bf547de_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooC@
+hs_bindgen_c82bf4a34bf547de ::
+     BG.Ptr M.C
+  -> IO ()
+hs_bindgen_c82bf4a34bf547de =
+  \x0 ->
+    hs_bindgen_c82bf4a34bf547de_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_c82bf4a34bf547de x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_25033ba8f1b4731d" hs_bindgen_25033ba8f1b4731d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooD@
+hs_bindgen_25033ba8f1b4731d ::
+     BG.Ptr M.D
+  -> IO ()
+hs_bindgen_25033ba8f1b4731d =
+  \x0 ->
+    hs_bindgen_25033ba8f1b4731d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_25033ba8f1b4731d x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_0cf5debdefedd88c" hs_bindgen_0cf5debdefedd88c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooE@
+hs_bindgen_0cf5debdefedd88c ::
+     BG.Ptr E
+  -> IO ()
+hs_bindgen_0cf5debdefedd88c =
+  \x0 ->
+    hs_bindgen_0cf5debdefedd88c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_0cf5debdefedd88c x1)
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/Example/Unsafe.hs
@@ -0,0 +1,222 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/macro/union.h>"
+  , "void hs_bindgen_f784f3292d76f05c ("
+  , "  union MyUnion *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(*arg1);"
+  , "}"
+  , "void hs_bindgen_317131bf91a541b2 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(*arg1);"
+  , "}"
+  , "void hs_bindgen_d2ce062db2e5b039 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(*arg1);"
+  , "}"
+  , "void hs_bindgen_6984f6c3dda0005c ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(*arg1);"
+  , "}"
+  , "void hs_bindgen_5431738e4ccf9ce9 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(*arg1);"
+  , "}"
+  , "void hs_bindgen_1032f2cabeb8faaa ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_f784f3292d76f05c" hs_bindgen_f784f3292d76f05c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_foo@
+hs_bindgen_f784f3292d76f05c ::
+     BG.Ptr MyUnion
+  -> IO ()
+hs_bindgen_f784f3292d76f05c =
+  \x0 ->
+    hs_bindgen_f784f3292d76f05c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+foo ::
+     MyUnion
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_f784f3292d76f05c x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_317131bf91a541b2" hs_bindgen_317131bf91a541b2_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooA@
+hs_bindgen_317131bf91a541b2 ::
+     BG.Ptr A
+  -> IO ()
+hs_bindgen_317131bf91a541b2 =
+  \x0 ->
+    hs_bindgen_317131bf91a541b2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_317131bf91a541b2 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_d2ce062db2e5b039" hs_bindgen_d2ce062db2e5b039_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooB@
+hs_bindgen_d2ce062db2e5b039 ::
+     BG.Ptr B
+  -> IO ()
+hs_bindgen_d2ce062db2e5b039 =
+  \x0 ->
+    hs_bindgen_d2ce062db2e5b039_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_d2ce062db2e5b039 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_6984f6c3dda0005c" hs_bindgen_6984f6c3dda0005c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooC@
+hs_bindgen_6984f6c3dda0005c ::
+     BG.Ptr M.C
+  -> IO ()
+hs_bindgen_6984f6c3dda0005c =
+  \x0 ->
+    hs_bindgen_6984f6c3dda0005c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_6984f6c3dda0005c x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_5431738e4ccf9ce9" hs_bindgen_5431738e4ccf9ce9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooD@
+hs_bindgen_5431738e4ccf9ce9 ::
+     BG.Ptr M.D
+  -> IO ()
+hs_bindgen_5431738e4ccf9ce9 =
+  \x0 ->
+    hs_bindgen_5431738e4ccf9ce9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_5431738e4ccf9ce9 x1)
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_1032f2cabeb8faaa" hs_bindgen_1032f2cabeb8faaa_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooE@
+hs_bindgen_1032f2cabeb8faaa ::
+     BG.Ptr E
+  -> IO ()
+hs_bindgen_1032f2cabeb8faaa =
+  \x0 ->
+    hs_bindgen_1032f2cabeb8faaa_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_1032f2cabeb8faaa x1)
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/bindingspec.yaml
@@ -0,0 +1,79 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/macro/union.h
+  cname: union MyUnion
+  hsname: MyUnion
+- headers: binding-specs/fun_arg/macro/union.h
+  cname: macro A
+  hsname: A
+- headers: binding-specs/fun_arg/macro/union.h
+  cname: macro B
+  hsname: B
+- headers: binding-specs/fun_arg/macro/union.h
+  cname: macro E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyUnion
+  representation:
+    newtype:
+      constructor: MyUnion
+      fields:
+      - unwrapMyUnion
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/macro/union/th.txt
@@ -0,0 +1,593 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/macro/union.h
+-- #include <binding-specs/fun_arg/macro/union.h>
+-- void hs_bindgen_5da9ad143faecbca (
+--   union MyUnion *arg1
+-- )
+-- {
+--   (foo)(*arg1);
+-- }
+-- void hs_bindgen_f70ba8b74da026b3 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(*arg1);
+-- }
+-- void hs_bindgen_89e946b10b5189a6 (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(*arg1);
+-- }
+-- void hs_bindgen_c82bf4a34bf547de (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(*arg1);
+-- }
+-- void hs_bindgen_25033ba8f1b4731d (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(*arg1);
+-- }
+-- void hs_bindgen_0cf5debdefedd88c (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(*arg1);
+-- }
+-- void hs_bindgen_f784f3292d76f05c (
+--   union MyUnion *arg1
+-- )
+-- {
+--   (foo)(*arg1);
+-- }
+-- void hs_bindgen_317131bf91a541b2 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(*arg1);
+-- }
+-- void hs_bindgen_d2ce062db2e5b039 (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(*arg1);
+-- }
+-- void hs_bindgen_6984f6c3dda0005c (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(*arg1);
+-- }
+-- void hs_bindgen_5431738e4ccf9ce9 (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(*arg1);
+-- }
+-- void hs_bindgen_1032f2cabeb8faaa (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(*arg1);
+-- }
+-- /* test_bindingspecsfun_argmacroun_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cda902505d180c3d (void)) (
+--   union MyUnion arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argmacroun_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d2d25b201a07a90e (void)) (
+--   A arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argmacroun_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_4f49b9aa9b0c125d (void)) (
+--   B arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argmacroun_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_669f2d7e801db0d0 (void)) (
+--   C arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argmacroun_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6504f8cec55c35ff (void)) (
+--   D arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argmacroun_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ae8e5c504bcf0849 (void)) (
+--   E arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @union MyUnion@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 5:7@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+newtype MyUnion
+    = MyUnion {unwrapMyUnion :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize MyUnion
+deriving via (SizedByteArray 4 4) instance ReadRaw MyUnion
+deriving via (SizedByteArray 4 4) instance WriteRaw MyUnion
+deriving via (EquivStorable MyUnion) instance Storable MyUnion
+deriving via (SizedByteArray 4 4) instance IsUnion MyUnion
+instance (~) ty CInt => HasField "myUnion_x" MyUnion ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "myUnion_x" MyUnion ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"myUnion_x" x_0)
+instance (~) ty CInt => HasField "myUnion_x" (Ptr MyUnion) (Ptr ty)
+    where getField = fromPtr (Proxy @"myUnion_x")
+instance HasCField MyUnion "myUnion_x"
+    where type CFieldType MyUnion "myUnion_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 9:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+newtype A
+    = A {unwrapA :: MyUnion}
+    deriving stock Generic
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty MyUnion => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyUnion => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyUnion
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 10:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock Generic
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 31:9@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_5da9ad143faecbca" hs_bindgen_5da9ad143faecbca_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_foo@
+hs_bindgen_5da9ad143faecbca :: Ptr MyUnion -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_foo@
+hs_bindgen_5da9ad143faecbca = \x_0 -> hs_bindgen_5da9ad143faecbca_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+foo_safe :: MyUnion -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+foo_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_5da9ad143faecbca x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_f70ba8b74da026b3" hs_bindgen_f70ba8b74da026b3_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooA@
+hs_bindgen_f70ba8b74da026b3 :: Ptr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooA@
+hs_bindgen_f70ba8b74da026b3 = \x_0 -> hs_bindgen_f70ba8b74da026b3_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooA_safe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooA_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_f70ba8b74da026b3 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_89e946b10b5189a6" hs_bindgen_89e946b10b5189a6_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooB@
+hs_bindgen_89e946b10b5189a6 :: Ptr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooB@
+hs_bindgen_89e946b10b5189a6 = \x_0 -> hs_bindgen_89e946b10b5189a6_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooB_safe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooB_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_89e946b10b5189a6 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_c82bf4a34bf547de" hs_bindgen_c82bf4a34bf547de_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooC@
+hs_bindgen_c82bf4a34bf547de :: Ptr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooC@
+hs_bindgen_c82bf4a34bf547de = \x_0 -> hs_bindgen_c82bf4a34bf547de_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooC_safe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooC_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_c82bf4a34bf547de x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_25033ba8f1b4731d" hs_bindgen_25033ba8f1b4731d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooD@
+hs_bindgen_25033ba8f1b4731d :: Ptr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooD@
+hs_bindgen_25033ba8f1b4731d = \x_0 -> hs_bindgen_25033ba8f1b4731d_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooD_safe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooD_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_25033ba8f1b4731d x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_0cf5debdefedd88c" hs_bindgen_0cf5debdefedd88c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooE@
+hs_bindgen_0cf5debdefedd88c :: Ptr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Safe_fooE@
+hs_bindgen_0cf5debdefedd88c = \x_0 -> hs_bindgen_0cf5debdefedd88c_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooE_safe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooE_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_0cf5debdefedd88c x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_f784f3292d76f05c" hs_bindgen_f784f3292d76f05c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_foo@
+hs_bindgen_f784f3292d76f05c :: Ptr MyUnion -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_foo@
+hs_bindgen_f784f3292d76f05c = \x_0 -> hs_bindgen_f784f3292d76f05c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+foo_unsafe :: MyUnion -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+foo_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_f784f3292d76f05c x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_317131bf91a541b2" hs_bindgen_317131bf91a541b2_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooA@
+hs_bindgen_317131bf91a541b2 :: Ptr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooA@
+hs_bindgen_317131bf91a541b2 = \x_0 -> hs_bindgen_317131bf91a541b2_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooA_unsafe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooA_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_317131bf91a541b2 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_d2ce062db2e5b039" hs_bindgen_d2ce062db2e5b039_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooB@
+hs_bindgen_d2ce062db2e5b039 :: Ptr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooB@
+hs_bindgen_d2ce062db2e5b039 = \x_0 -> hs_bindgen_d2ce062db2e5b039_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooB_unsafe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooB_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_d2ce062db2e5b039 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_6984f6c3dda0005c" hs_bindgen_6984f6c3dda0005c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooC@
+hs_bindgen_6984f6c3dda0005c :: Ptr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooC@
+hs_bindgen_6984f6c3dda0005c = \x_0 -> hs_bindgen_6984f6c3dda0005c_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooC_unsafe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooC_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_6984f6c3dda0005c x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_5431738e4ccf9ce9" hs_bindgen_5431738e4ccf9ce9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooD@
+hs_bindgen_5431738e4ccf9ce9 :: Ptr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooD@
+hs_bindgen_5431738e4ccf9ce9 = \x_0 -> hs_bindgen_5431738e4ccf9ce9_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooD_unsafe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooD_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_5431738e4ccf9ce9 x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_1032f2cabeb8faaa" hs_bindgen_1032f2cabeb8faaa_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooE@
+hs_bindgen_1032f2cabeb8faaa :: Ptr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_Unsafe_fooE@
+hs_bindgen_1032f2cabeb8faaa = \x_0 -> hs_bindgen_1032f2cabeb8faaa_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooE_unsafe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooE_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_1032f2cabeb8faaa x_1)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_cda902505d180c3d" hs_bindgen_cda902505d180c3d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_foo@
+hs_bindgen_cda902505d180c3d :: IO (FunPtr (MyUnion -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_foo@
+hs_bindgen_cda902505d180c3d = fmap fromFFIType hs_bindgen_cda902505d180c3d_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+foo_funptr :: FunPtr (MyUnion -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 6:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_cda902505d180c3d
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_d2d25b201a07a90e" hs_bindgen_d2d25b201a07a90e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooA@
+hs_bindgen_d2d25b201a07a90e :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooA@
+hs_bindgen_d2d25b201a07a90e = fmap fromFFIType hs_bindgen_d2d25b201a07a90e_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooA_funptr :: FunPtr (A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 12:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_d2d25b201a07a90e
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_4f49b9aa9b0c125d" hs_bindgen_4f49b9aa9b0c125d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooB@
+hs_bindgen_4f49b9aa9b0c125d :: IO (FunPtr (B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooB@
+hs_bindgen_4f49b9aa9b0c125d = fmap fromFFIType hs_bindgen_4f49b9aa9b0c125d_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooB_funptr :: FunPtr (B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 13:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_4f49b9aa9b0c125d
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_669f2d7e801db0d0" hs_bindgen_669f2d7e801db0d0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooC@
+hs_bindgen_669f2d7e801db0d0 :: IO (FunPtr (M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooC@
+hs_bindgen_669f2d7e801db0d0 = fmap fromFFIType hs_bindgen_669f2d7e801db0d0_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooC_funptr :: FunPtr (M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_669f2d7e801db0d0
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_6504f8cec55c35ff" hs_bindgen_6504f8cec55c35ff_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooD@
+hs_bindgen_6504f8cec55c35ff :: IO (FunPtr (M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooD@
+hs_bindgen_6504f8cec55c35ff = fmap fromFFIType hs_bindgen_6504f8cec55c35ff_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooD_funptr :: FunPtr (M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_6504f8cec55c35ff
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_ae8e5c504bcf0849" hs_bindgen_ae8e5c504bcf0849_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooE@
+hs_bindgen_ae8e5c504bcf0849 :: IO (FunPtr (E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argmacroun_Example_get_fooE@
+hs_bindgen_ae8e5c504bcf0849 = fmap fromFFIType hs_bindgen_ae8e5c504bcf0849_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooE_funptr :: FunPtr (E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/macro\/union.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/macro\/union.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_ae8e5c504bcf0849
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example.hs
@@ -0,0 +1,114 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (Eq, Show, type (~))
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 6:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+newtype A = A
+  { unwrapA :: IA.IncompleteArray BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" =
+    IA.IncompleteArray BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 7:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 19:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example/FunPtr.hs
@@ -0,0 +1,188 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/array.h>"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2020929269c10652 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3fbd7681308a7575 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_118f9a485493ca2d (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dbe89d4787aae78a (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf5702eef5ab2ac4 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dc10cdc4b07670d1 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ()))
+hs_bindgen_2020929269c10652 =
+  fmap BG.fromFFIType hs_bindgen_2020929269c10652_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+foo :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_2020929269c10652
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem A) -> IO ()))
+hs_bindgen_3fbd7681308a7575 =
+  fmap BG.fromFFIType hs_bindgen_3fbd7681308a7575_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooA :: BG.FunPtr (BG.Ptr (IsA.Elem A) -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_3fbd7681308a7575
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (BG.FunPtr (BG.Ptr (IsA.Elem B) -> IO ()))
+hs_bindgen_118f9a485493ca2d =
+  fmap BG.fromFFIType hs_bindgen_118f9a485493ca2d_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooB :: BG.FunPtr (BG.Ptr (IsA.Elem B) -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_118f9a485493ca2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (BG.FunPtr (BG.Ptr (IsA.Elem M.C) -> IO ()))
+hs_bindgen_dbe89d4787aae78a =
+  fmap BG.fromFFIType hs_bindgen_dbe89d4787aae78a_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooC :: BG.FunPtr (BG.Ptr (IsA.Elem M.C) -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_dbe89d4787aae78a
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem M.D) -> IO ()))
+hs_bindgen_cf5702eef5ab2ac4 =
+  fmap BG.fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooD :: BG.FunPtr (BG.Ptr (IsA.Elem M.D) -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem E) -> IO ()))
+hs_bindgen_dc10cdc4b07670d1 =
+  fmap BG.fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooE :: BG.FunPtr (BG.Ptr (IsA.Elem E) -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example/Safe.hs
@@ -0,0 +1,212 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/array.h>"
+  , "void hs_bindgen_99bb90e6d7637d2c ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_392e3092a2681c13 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_6011faf8531be4fa ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_40a50b8e6ac3b09d ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_32b4f35bf27a4bf8 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_6e59183c0a861d01 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_99bb90e6d7637d2c =
+  \x0 ->
+    hs_bindgen_99bb90e6d7637d2c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_99bb90e6d7637d2c
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 ::
+     BG.Ptr (IsA.Elem A)
+  -> IO ()
+hs_bindgen_392e3092a2681c13 =
+  \x0 ->
+    hs_bindgen_392e3092a2681c13_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooA ::
+     BG.Ptr (IsA.Elem A)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_392e3092a2681c13
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa ::
+     BG.Ptr (IsA.Elem B)
+  -> IO ()
+hs_bindgen_6011faf8531be4fa =
+  \x0 ->
+    hs_bindgen_6011faf8531be4fa_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooB ::
+     BG.Ptr (IsA.Elem B)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_6011faf8531be4fa
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d ::
+     BG.Ptr (IsA.Elem M.C)
+  -> IO ()
+hs_bindgen_40a50b8e6ac3b09d =
+  \x0 ->
+    hs_bindgen_40a50b8e6ac3b09d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooC ::
+     BG.Ptr (IsA.Elem M.C)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_40a50b8e6ac3b09d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 ::
+     BG.Ptr (IsA.Elem M.D)
+  -> IO ()
+hs_bindgen_32b4f35bf27a4bf8 =
+  \x0 ->
+    hs_bindgen_32b4f35bf27a4bf8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooD ::
+     BG.Ptr (IsA.Elem M.D)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_32b4f35bf27a4bf8
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 ::
+     BG.Ptr (IsA.Elem E)
+  -> IO ()
+hs_bindgen_6e59183c0a861d01 =
+  \x0 ->
+    hs_bindgen_6e59183c0a861d01_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooE ::
+     BG.Ptr (IsA.Elem E)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_6e59183c0a861d01
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/Example/Unsafe.hs
@@ -0,0 +1,212 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/array.h>"
+  , "void hs_bindgen_51195acecf6b880e ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_eb4a794c10ca94f9 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_a11eb4471a953b64 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_1dea92b3f3346311 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_dba6d56e1a316e2d ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_23b6f403a534aeae ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_51195acecf6b880e =
+  \x0 ->
+    hs_bindgen_51195acecf6b880e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_51195acecf6b880e
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 ::
+     BG.Ptr (IsA.Elem A)
+  -> IO ()
+hs_bindgen_eb4a794c10ca94f9 =
+  \x0 ->
+    hs_bindgen_eb4a794c10ca94f9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooA ::
+     BG.Ptr (IsA.Elem A)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_eb4a794c10ca94f9
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 ::
+     BG.Ptr (IsA.Elem B)
+  -> IO ()
+hs_bindgen_a11eb4471a953b64 =
+  \x0 ->
+    hs_bindgen_a11eb4471a953b64_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooB ::
+     BG.Ptr (IsA.Elem B)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_a11eb4471a953b64
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 ::
+     BG.Ptr (IsA.Elem M.C)
+  -> IO ()
+hs_bindgen_1dea92b3f3346311 =
+  \x0 ->
+    hs_bindgen_1dea92b3f3346311_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooC ::
+     BG.Ptr (IsA.Elem M.C)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_1dea92b3f3346311
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d ::
+     BG.Ptr (IsA.Elem M.D)
+  -> IO ()
+hs_bindgen_dba6d56e1a316e2d =
+  \x0 ->
+    hs_bindgen_dba6d56e1a316e2d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooD ::
+     BG.Ptr (IsA.Elem M.D)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_dba6d56e1a316e2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae ::
+     BG.Ptr (IsA.Elem E)
+  -> IO ()
+hs_bindgen_23b6f403a534aeae =
+  \x0 ->
+    hs_bindgen_23b6f403a534aeae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooE ::
+     BG.Ptr (IsA.Elem E)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_23b6f403a534aeae
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/bindingspec.yaml
@@ -0,0 +1,57 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/typedef/array.h
+  cname: A
+  hsname: A
+- headers: binding-specs/fun_arg/typedef/array.h
+  cname: B
+  hsname: B
+- headers: binding-specs/fun_arg/typedef/array.h
+  cname: E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array/th.txt
@@ -0,0 +1,575 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array.h
+-- #include <binding-specs/fun_arg/typedef/array.h>
+-- void hs_bindgen_99bb90e6d7637d2c (
+--   signed int *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_392e3092a2681c13 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_6011faf8531be4fa (
+--   signed int *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_40a50b8e6ac3b09d (
+--   signed int *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_32b4f35bf27a4bf8 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_6e59183c0a861d01 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_51195acecf6b880e (
+--   signed int *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_eb4a794c10ca94f9 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_a11eb4471a953b64 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_1dea92b3f3346311 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_dba6d56e1a316e2d (
+--   signed int *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_23b6f403a534aeae (
+--   signed int *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2020929269c10652 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3fbd7681308a7575 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_118f9a485493ca2d (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dbe89d4787aae78a (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf5702eef5ab2ac4 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dc10cdc4b07670d1 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 6:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+newtype A
+    = A {unwrapA :: (IncompleteArray CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray CInt) => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = IncompleteArray CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 7:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 19:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c :: Ptr (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c = \x_0 -> hs_bindgen_99bb90e6d7637d2c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+foo_safe :: Ptr (Elem (IncompleteArray CInt)) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+foo_safe = hs_bindgen_99bb90e6d7637d2c
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 :: Ptr (Elem A) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 = \x_0 -> hs_bindgen_392e3092a2681c13_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooA_safe :: Ptr (Elem A) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooA_safe = hs_bindgen_392e3092a2681c13
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa :: Ptr (Elem B) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa = \x_0 -> hs_bindgen_6011faf8531be4fa_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooB_safe :: Ptr (Elem B) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooB_safe = hs_bindgen_6011faf8531be4fa
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d :: Ptr (Elem M.C) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d = \x_0 -> hs_bindgen_40a50b8e6ac3b09d_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooC_safe :: Ptr (Elem M.C) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooC_safe = hs_bindgen_40a50b8e6ac3b09d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 :: Ptr (Elem M.D) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 = \x_0 -> hs_bindgen_32b4f35bf27a4bf8_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooD_safe :: Ptr (Elem M.D) -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooD_safe = hs_bindgen_32b4f35bf27a4bf8
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 :: Ptr (Elem E) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 = \x_0 -> hs_bindgen_6e59183c0a861d01_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooE_safe :: Ptr (Elem E) -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooE_safe = hs_bindgen_6e59183c0a861d01
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e :: Ptr (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e = \x_0 -> hs_bindgen_51195acecf6b880e_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+foo_unsafe :: Ptr (Elem (IncompleteArray CInt)) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+foo_unsafe = hs_bindgen_51195acecf6b880e
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 :: Ptr (Elem A) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 = \x_0 -> hs_bindgen_eb4a794c10ca94f9_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooA_unsafe :: Ptr (Elem A) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooA_unsafe = hs_bindgen_eb4a794c10ca94f9
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 :: Ptr (Elem B) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 = \x_0 -> hs_bindgen_a11eb4471a953b64_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooB_unsafe :: Ptr (Elem B) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooB_unsafe = hs_bindgen_a11eb4471a953b64
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 :: Ptr (Elem M.C) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 = \x_0 -> hs_bindgen_1dea92b3f3346311_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooC_unsafe :: Ptr (Elem M.C) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooC_unsafe = hs_bindgen_1dea92b3f3346311
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d :: Ptr (Elem M.D) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d = \x_0 -> hs_bindgen_dba6d56e1a316e2d_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooD_unsafe :: Ptr (Elem M.D) -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooD_unsafe = hs_bindgen_dba6d56e1a316e2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae :: Ptr (Elem E) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae = \x_0 -> hs_bindgen_23b6f403a534aeae_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooE_unsafe :: Ptr (Elem E) -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooE_unsafe = hs_bindgen_23b6f403a534aeae
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (FunPtr (Ptr (Elem (IncompleteArray CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 = fmap fromFFIType hs_bindgen_2020929269c10652_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+foo_funptr :: FunPtr (Ptr (Elem (IncompleteArray CInt)) -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_2020929269c10652
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (FunPtr (Ptr (Elem A) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 = fmap fromFFIType hs_bindgen_3fbd7681308a7575_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooA_funptr :: FunPtr (Ptr (Elem A) -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_3fbd7681308a7575
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (FunPtr (Ptr (Elem B) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d = fmap fromFFIType hs_bindgen_118f9a485493ca2d_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooB_funptr :: FunPtr (Ptr (Elem B) -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_118f9a485493ca2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (FunPtr (Ptr (Elem M.C) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a = fmap fromFFIType hs_bindgen_dbe89d4787aae78a_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooC_funptr :: FunPtr (Ptr (Elem M.C) -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_dbe89d4787aae78a
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (FunPtr (Ptr (Elem M.D) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 = fmap fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooD_funptr :: FunPtr (Ptr (Elem M.D) -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (FunPtr (Ptr (Elem E) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 = fmap fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooE_funptr :: FunPtr (Ptr (Elem E) -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example.hs
@@ -0,0 +1,127 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (Eq, Show, type (~))
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 6:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+newtype A = A
+  { unwrapA :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 7:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 19:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example/FunPtr.hs
@@ -0,0 +1,189 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/array_known_size.h>"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2020929269c10652 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3fbd7681308a7575 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_118f9a485493ca2d (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dbe89d4787aae78a (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf5702eef5ab2ac4 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dc10cdc4b07670d1 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> IO ()))
+hs_bindgen_2020929269c10652 =
+  fmap BG.fromFFIType hs_bindgen_2020929269c10652_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+foo :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt)) -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_2020929269c10652
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem A) -> IO ()))
+hs_bindgen_3fbd7681308a7575 =
+  fmap BG.fromFFIType hs_bindgen_3fbd7681308a7575_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooA :: BG.FunPtr (BG.Ptr (IsA.Elem A) -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_3fbd7681308a7575
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (BG.FunPtr (BG.Ptr (IsA.Elem B) -> IO ()))
+hs_bindgen_118f9a485493ca2d =
+  fmap BG.fromFFIType hs_bindgen_118f9a485493ca2d_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooB :: BG.FunPtr (BG.Ptr (IsA.Elem B) -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_118f9a485493ca2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (BG.FunPtr (BG.Ptr (IsA.Elem M.C) -> IO ()))
+hs_bindgen_dbe89d4787aae78a =
+  fmap BG.fromFFIType hs_bindgen_dbe89d4787aae78a_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooC :: BG.FunPtr (BG.Ptr (IsA.Elem M.C) -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_dbe89d4787aae78a
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem M.D) -> IO ()))
+hs_bindgen_cf5702eef5ab2ac4 =
+  fmap BG.fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooD :: BG.FunPtr (BG.Ptr (IsA.Elem M.D) -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem E) -> IO ()))
+hs_bindgen_dc10cdc4b07670d1 =
+  fmap BG.fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooE :: BG.FunPtr (BG.Ptr (IsA.Elem E) -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example/Safe.hs
@@ -0,0 +1,213 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/array_known_size.h>"
+  , "void hs_bindgen_99bb90e6d7637d2c ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_392e3092a2681c13 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_6011faf8531be4fa ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_40a50b8e6ac3b09d ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_32b4f35bf27a4bf8 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_6e59183c0a861d01 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> IO ()
+hs_bindgen_99bb90e6d7637d2c =
+  \x0 ->
+    hs_bindgen_99bb90e6d7637d2c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_99bb90e6d7637d2c
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 ::
+     BG.Ptr (IsA.Elem A)
+  -> IO ()
+hs_bindgen_392e3092a2681c13 =
+  \x0 ->
+    hs_bindgen_392e3092a2681c13_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooA ::
+     BG.Ptr (IsA.Elem A)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_392e3092a2681c13
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa ::
+     BG.Ptr (IsA.Elem B)
+  -> IO ()
+hs_bindgen_6011faf8531be4fa =
+  \x0 ->
+    hs_bindgen_6011faf8531be4fa_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooB ::
+     BG.Ptr (IsA.Elem B)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_6011faf8531be4fa
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d ::
+     BG.Ptr (IsA.Elem M.C)
+  -> IO ()
+hs_bindgen_40a50b8e6ac3b09d =
+  \x0 ->
+    hs_bindgen_40a50b8e6ac3b09d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooC ::
+     BG.Ptr (IsA.Elem M.C)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_40a50b8e6ac3b09d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 ::
+     BG.Ptr (IsA.Elem M.D)
+  -> IO ()
+hs_bindgen_32b4f35bf27a4bf8 =
+  \x0 ->
+    hs_bindgen_32b4f35bf27a4bf8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooD ::
+     BG.Ptr (IsA.Elem M.D)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_32b4f35bf27a4bf8
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 ::
+     BG.Ptr (IsA.Elem E)
+  -> IO ()
+hs_bindgen_6e59183c0a861d01 =
+  \x0 ->
+    hs_bindgen_6e59183c0a861d01_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooE ::
+     BG.Ptr (IsA.Elem E)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_6e59183c0a861d01
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/Example/Unsafe.hs
@@ -0,0 +1,213 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/array_known_size.h>"
+  , "void hs_bindgen_51195acecf6b880e ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_eb4a794c10ca94f9 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_a11eb4471a953b64 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_1dea92b3f3346311 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_dba6d56e1a316e2d ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_23b6f403a534aeae ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+  -> IO ()
+hs_bindgen_51195acecf6b880e =
+  \x0 ->
+    hs_bindgen_51195acecf6b880e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+foo ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 3 BG.CInt))
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_51195acecf6b880e
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 ::
+     BG.Ptr (IsA.Elem A)
+  -> IO ()
+hs_bindgen_eb4a794c10ca94f9 =
+  \x0 ->
+    hs_bindgen_eb4a794c10ca94f9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooA ::
+     BG.Ptr (IsA.Elem A)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_eb4a794c10ca94f9
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 ::
+     BG.Ptr (IsA.Elem B)
+  -> IO ()
+hs_bindgen_a11eb4471a953b64 =
+  \x0 ->
+    hs_bindgen_a11eb4471a953b64_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooB ::
+     BG.Ptr (IsA.Elem B)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_a11eb4471a953b64
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 ::
+     BG.Ptr (IsA.Elem M.C)
+  -> IO ()
+hs_bindgen_1dea92b3f3346311 =
+  \x0 ->
+    hs_bindgen_1dea92b3f3346311_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooC ::
+     BG.Ptr (IsA.Elem M.C)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_1dea92b3f3346311
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d ::
+     BG.Ptr (IsA.Elem M.D)
+  -> IO ()
+hs_bindgen_dba6d56e1a316e2d =
+  \x0 ->
+    hs_bindgen_dba6d56e1a316e2d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooD ::
+     BG.Ptr (IsA.Elem M.D)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_dba6d56e1a316e2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae ::
+     BG.Ptr (IsA.Elem E)
+  -> IO ()
+hs_bindgen_23b6f403a534aeae =
+  \x0 ->
+    hs_bindgen_23b6f403a534aeae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooE ::
+     BG.Ptr (IsA.Elem E)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_23b6f403a534aeae
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/bindingspec.yaml
@@ -0,0 +1,65 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/typedef/array_known_size.h
+  cname: A
+  hsname: A
+- headers: binding-specs/fun_arg/typedef/array_known_size.h
+  cname: B
+  hsname: B
+- headers: binding-specs/fun_arg/typedef/array_known_size.h
+  cname: E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/array_known_size/th.txt
@@ -0,0 +1,576 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array_known_size.h
+-- #include <binding-specs/fun_arg/typedef/array_known_size.h>
+-- void hs_bindgen_99bb90e6d7637d2c (
+--   signed int *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_392e3092a2681c13 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_6011faf8531be4fa (
+--   signed int *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_40a50b8e6ac3b09d (
+--   signed int *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_32b4f35bf27a4bf8 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_6e59183c0a861d01 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_51195acecf6b880e (
+--   signed int *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_eb4a794c10ca94f9 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_a11eb4471a953b64 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_1dea92b3f3346311 (
+--   signed int *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_dba6d56e1a316e2d (
+--   signed int *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_23b6f403a534aeae (
+--   signed int *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2020929269c10652 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3fbd7681308a7575 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_118f9a485493ca2d (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dbe89d4787aae78a (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf5702eef5ab2ac4 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dc10cdc4b07670d1 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 6:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+newtype A
+    = A {unwrapA :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = ConstantArray 3 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 7:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 19:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c :: Ptr (Elem (ConstantArray 3 CInt)) ->
+                               IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c = \x_0 -> hs_bindgen_99bb90e6d7637d2c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+foo_safe :: Ptr (Elem (ConstantArray 3 CInt)) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+foo_safe = hs_bindgen_99bb90e6d7637d2c
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 :: Ptr (Elem A) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 = \x_0 -> hs_bindgen_392e3092a2681c13_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooA_safe :: Ptr (Elem A) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooA_safe = hs_bindgen_392e3092a2681c13
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa :: Ptr (Elem B) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa = \x_0 -> hs_bindgen_6011faf8531be4fa_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooB_safe :: Ptr (Elem B) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooB_safe = hs_bindgen_6011faf8531be4fa
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d :: Ptr (Elem M.C) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d = \x_0 -> hs_bindgen_40a50b8e6ac3b09d_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooC_safe :: Ptr (Elem M.C) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooC_safe = hs_bindgen_40a50b8e6ac3b09d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 :: Ptr (Elem M.D) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 = \x_0 -> hs_bindgen_32b4f35bf27a4bf8_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooD_safe :: Ptr (Elem M.D) -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooD_safe = hs_bindgen_32b4f35bf27a4bf8
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 :: Ptr (Elem E) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 = \x_0 -> hs_bindgen_6e59183c0a861d01_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooE_safe :: Ptr (Elem E) -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooE_safe = hs_bindgen_6e59183c0a861d01
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e :: Ptr (Elem (ConstantArray 3 CInt)) ->
+                               IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e = \x_0 -> hs_bindgen_51195acecf6b880e_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+foo_unsafe :: Ptr (Elem (ConstantArray 3 CInt)) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+foo_unsafe = hs_bindgen_51195acecf6b880e
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 :: Ptr (Elem A) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 = \x_0 -> hs_bindgen_eb4a794c10ca94f9_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooA_unsafe :: Ptr (Elem A) -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooA_unsafe = hs_bindgen_eb4a794c10ca94f9
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 :: Ptr (Elem B) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 = \x_0 -> hs_bindgen_a11eb4471a953b64_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooB_unsafe :: Ptr (Elem B) -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooB_unsafe = hs_bindgen_a11eb4471a953b64
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 :: Ptr (Elem M.C) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 = \x_0 -> hs_bindgen_1dea92b3f3346311_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooC_unsafe :: Ptr (Elem M.C) -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooC_unsafe = hs_bindgen_1dea92b3f3346311
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d :: Ptr (Elem M.D) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d = \x_0 -> hs_bindgen_dba6d56e1a316e2d_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooD_unsafe :: Ptr (Elem M.D) -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooD_unsafe = hs_bindgen_dba6d56e1a316e2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae :: Ptr (Elem E) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae = \x_0 -> hs_bindgen_23b6f403a534aeae_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooE_unsafe :: Ptr (Elem E) -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooE_unsafe = hs_bindgen_23b6f403a534aeae
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (FunPtr (Ptr (Elem (ConstantArray 3
+                                                                    CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 = fmap fromFFIType hs_bindgen_2020929269c10652_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+foo_funptr :: FunPtr (Ptr (Elem (ConstantArray 3 CInt)) -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_2020929269c10652
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (FunPtr (Ptr (Elem A) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 = fmap fromFFIType hs_bindgen_3fbd7681308a7575_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooA_funptr :: FunPtr (Ptr (Elem A) -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_3fbd7681308a7575
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (FunPtr (Ptr (Elem B) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d = fmap fromFFIType hs_bindgen_118f9a485493ca2d_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooB_funptr :: FunPtr (Ptr (Elem B) -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_118f9a485493ca2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (FunPtr (Ptr (Elem M.C) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a = fmap fromFFIType hs_bindgen_dbe89d4787aae78a_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooC_funptr :: FunPtr (Ptr (Elem M.C) -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_dbe89d4787aae78a
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (FunPtr (Ptr (Elem M.D) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 = fmap fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooD_funptr :: FunPtr (Ptr (Elem M.D) -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (FunPtr (Ptr (Elem E) -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 = fmap fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooE_funptr :: FunPtr (Ptr (Elem E) -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/array_known_size.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example.hs
@@ -0,0 +1,239 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyEnum(..)
+    , pattern Example.X
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum MyEnum@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+newtype MyEnum = MyEnum
+  { unwrapMyEnum :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize MyEnum where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw MyEnum where
+
+  readRaw =
+    \ptr0 ->
+          pure MyEnum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw MyEnum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MyEnum unwrapMyEnum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapMyEnum2
+
+deriving via Marshal.EquivStorable MyEnum instance BG.Storable MyEnum
+
+deriving via BG.CUInt instance BG.Prim MyEnum
+
+instance CEnum.CEnum MyEnum where
+
+  type CEnumZ MyEnum = BG.CUInt
+
+  toCEnum = MyEnum
+
+  fromCEnum = BG.getField @"unwrapMyEnum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "X")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "MyEnum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "MyEnum"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum MyEnum where
+
+  minDeclaredValue = X
+
+  maxDeclaredValue = X
+
+instance Show MyEnum where
+
+  showsPrec = CEnum.shows
+
+instance Read MyEnum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapMyEnum" MyEnum ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyEnum {unwrapMyEnum = y1}, BG.getField @"unwrapMyEnum" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapMyEnum" (BG.Ptr MyEnum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyEnum")
+
+instance HasCField.HasCField MyEnum "unwrapMyEnum" where
+
+  type CFieldType MyEnum "unwrapMyEnum" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 4:14@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+pattern X :: MyEnum
+pattern X = MyEnum 0
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 7:21@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+newtype A = A
+  { unwrapA :: MyEnum
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ MyEnum) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ MyEnum) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyEnum
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 8:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 21:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+  deriving newtype (BG.HasFFIType)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example/FunPtr.hs
@@ -0,0 +1,186 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/enum.h>"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2020929269c10652 (void)) ("
+  , "  enum MyEnum arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3fbd7681308a7575 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_118f9a485493ca2d (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dbe89d4787aae78a (void)) ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf5702eef5ab2ac4 (void)) ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dc10cdc4b07670d1 (void)) ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (BG.FunPtr (MyEnum -> IO ()))
+hs_bindgen_2020929269c10652 =
+  fmap BG.fromFFIType hs_bindgen_2020929269c10652_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+foo :: BG.FunPtr (MyEnum -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_2020929269c10652
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_3fbd7681308a7575 =
+  fmap BG.fromFFIType hs_bindgen_3fbd7681308a7575_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooA :: BG.FunPtr (A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_3fbd7681308a7575
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_118f9a485493ca2d =
+  fmap BG.fromFFIType hs_bindgen_118f9a485493ca2d_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooB :: BG.FunPtr (B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_118f9a485493ca2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (BG.FunPtr (M.C -> IO ()))
+hs_bindgen_dbe89d4787aae78a =
+  fmap BG.fromFFIType hs_bindgen_dbe89d4787aae78a_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooC :: BG.FunPtr (M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_dbe89d4787aae78a
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (BG.FunPtr (M.D -> IO ()))
+hs_bindgen_cf5702eef5ab2ac4 =
+  fmap BG.fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooD :: BG.FunPtr (M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (BG.FunPtr (E -> IO ()))
+hs_bindgen_dc10cdc4b07670d1 =
+  fmap BG.fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooE :: BG.FunPtr (E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example/Safe.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/enum.h>"
+  , "void hs_bindgen_99bb90e6d7637d2c ("
+  , "  enum MyEnum arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_392e3092a2681c13 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_6011faf8531be4fa ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_40a50b8e6ac3b09d ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_32b4f35bf27a4bf8 ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_6e59183c0a861d01 ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c ::
+     MyEnum
+  -> IO ()
+hs_bindgen_99bb90e6d7637d2c =
+  \x0 ->
+    hs_bindgen_99bb90e6d7637d2c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+foo ::
+     MyEnum
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_99bb90e6d7637d2c
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 ::
+     A
+  -> IO ()
+hs_bindgen_392e3092a2681c13 =
+  \x0 ->
+    hs_bindgen_392e3092a2681c13_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_392e3092a2681c13
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa ::
+     B
+  -> IO ()
+hs_bindgen_6011faf8531be4fa =
+  \x0 ->
+    hs_bindgen_6011faf8531be4fa_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_6011faf8531be4fa
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d ::
+     M.C
+  -> IO ()
+hs_bindgen_40a50b8e6ac3b09d =
+  \x0 ->
+    hs_bindgen_40a50b8e6ac3b09d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_40a50b8e6ac3b09d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 ::
+     M.D
+  -> IO ()
+hs_bindgen_32b4f35bf27a4bf8 =
+  \x0 ->
+    hs_bindgen_32b4f35bf27a4bf8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_32b4f35bf27a4bf8
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 ::
+     E
+  -> IO ()
+hs_bindgen_6e59183c0a861d01 =
+  \x0 ->
+    hs_bindgen_6e59183c0a861d01_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_6e59183c0a861d01
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/Example/Unsafe.hs
@@ -0,0 +1,210 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/enum.h>"
+  , "void hs_bindgen_51195acecf6b880e ("
+  , "  enum MyEnum arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_eb4a794c10ca94f9 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_a11eb4471a953b64 ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_1dea92b3f3346311 ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_dba6d56e1a316e2d ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_23b6f403a534aeae ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e ::
+     MyEnum
+  -> IO ()
+hs_bindgen_51195acecf6b880e =
+  \x0 ->
+    hs_bindgen_51195acecf6b880e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+foo ::
+     MyEnum
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_51195acecf6b880e
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 ::
+     A
+  -> IO ()
+hs_bindgen_eb4a794c10ca94f9 =
+  \x0 ->
+    hs_bindgen_eb4a794c10ca94f9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_eb4a794c10ca94f9
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 ::
+     B
+  -> IO ()
+hs_bindgen_a11eb4471a953b64 =
+  \x0 ->
+    hs_bindgen_a11eb4471a953b64_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_a11eb4471a953b64
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 ::
+     M.C
+  -> IO ()
+hs_bindgen_1dea92b3f3346311 =
+  \x0 ->
+    hs_bindgen_1dea92b3f3346311_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_1dea92b3f3346311
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d ::
+     M.D
+  -> IO ()
+hs_bindgen_dba6d56e1a316e2d =
+  \x0 ->
+    hs_bindgen_dba6d56e1a316e2d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_dba6d56e1a316e2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+     BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae ::
+     E
+  -> IO ()
+hs_bindgen_23b6f403a534aeae =
+  \x0 ->
+    hs_bindgen_23b6f403a534aeae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_23b6f403a534aeae
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/bindingspec.yaml
@@ -0,0 +1,112 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/typedef/enum.h
+  cname: enum MyEnum
+  hsname: MyEnum
+  enum: open
+- headers: binding-specs/fun_arg/typedef/enum.h
+  cname: A
+  hsname: A
+- headers: binding-specs/fun_arg/typedef/enum.h
+  cname: B
+  hsname: B
+- headers: binding-specs/fun_arg/typedef/enum.h
+  cname: E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyEnum
+  representation:
+    newtype:
+      constructor: MyEnum
+      fields:
+      - unwrapMyEnum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/enum/th.txt
@@ -0,0 +1,637 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/typedef/enum.h
+-- #include <binding-specs/fun_arg/typedef/enum.h>
+-- void hs_bindgen_99bb90e6d7637d2c (
+--   enum MyEnum arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_392e3092a2681c13 (
+--   A arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_6011faf8531be4fa (
+--   B arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_40a50b8e6ac3b09d (
+--   C arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_32b4f35bf27a4bf8 (
+--   D arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_6e59183c0a861d01 (
+--   E arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_51195acecf6b880e (
+--   enum MyEnum arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_eb4a794c10ca94f9 (
+--   A arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_a11eb4471a953b64 (
+--   B arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_1dea92b3f3346311 (
+--   C arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_dba6d56e1a316e2d (
+--   D arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_23b6f403a534aeae (
+--   E arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2020929269c10652 (void)) (
+--   enum MyEnum arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3fbd7681308a7575 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_118f9a485493ca2d (void)) (
+--   B arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dbe89d4787aae78a (void)) (
+--   C arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf5702eef5ab2ac4 (void)) (
+--   D arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dc10cdc4b07670d1 (void)) (
+--   E arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @enum MyEnum@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+newtype MyEnum
+    = MyEnum {unwrapMyEnum :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize MyEnum
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw MyEnum
+    where readRaw = \ptr_0 -> pure MyEnum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw MyEnum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MyEnum unwrapMyEnum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapMyEnum_2
+deriving via (EquivStorable MyEnum) instance Storable MyEnum
+deriving via CUInt instance Prim MyEnum
+instance CEnum MyEnum
+    where type CEnumZ MyEnum = CUInt
+          toCEnum = MyEnum
+          fromCEnum = getField @"unwrapMyEnum"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "X")]
+          showsUndeclared = showsWrappedUndeclared "MyEnum"
+          readPrecUndeclared = readPrecWrappedUndeclared "MyEnum"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum MyEnum
+    where minDeclaredValue = X
+          maxDeclaredValue = X
+instance Show MyEnum
+    where showsPrec = shows
+instance Read MyEnum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapMyEnum" MyEnum ty
+    where hasField = \x_0 -> (\y_1 -> MyEnum{unwrapMyEnum = y_1},
+                              getField @"unwrapMyEnum" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapMyEnum" (Ptr MyEnum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyEnum")
+instance HasCField MyEnum "unwrapMyEnum"
+    where type CFieldType MyEnum "unwrapMyEnum" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 4:14@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+pattern X :: MyEnum
+pattern X = MyEnum 0
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 7:21@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+newtype A
+    = A {unwrapA :: MyEnum}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty MyEnum => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyEnum => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyEnum
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 8:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 21:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+newtype E
+    = E {unwrapE :: M.C}
+    deriving stock Generic
+    deriving newtype HasFFIType
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c :: MyEnum -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c = \x_0 -> hs_bindgen_99bb90e6d7637d2c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+foo_safe :: MyEnum -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+foo_safe = hs_bindgen_99bb90e6d7637d2c
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 :: A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 = \x_0 -> hs_bindgen_392e3092a2681c13_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooA_safe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooA_safe = hs_bindgen_392e3092a2681c13
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa :: B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa = \x_0 -> hs_bindgen_6011faf8531be4fa_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooB_safe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooB_safe = hs_bindgen_6011faf8531be4fa
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d :: M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d = \x_0 -> hs_bindgen_40a50b8e6ac3b09d_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooC_safe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooC_safe = hs_bindgen_40a50b8e6ac3b09d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 :: M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 = \x_0 -> hs_bindgen_32b4f35bf27a4bf8_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooD_safe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooD_safe = hs_bindgen_32b4f35bf27a4bf8
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 :: E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 = \x_0 -> hs_bindgen_6e59183c0a861d01_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooE_safe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooE_safe = hs_bindgen_6e59183c0a861d01
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e :: MyEnum -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e = \x_0 -> hs_bindgen_51195acecf6b880e_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+foo_unsafe :: MyEnum -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+foo_unsafe = hs_bindgen_51195acecf6b880e
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 :: A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 = \x_0 -> hs_bindgen_eb4a794c10ca94f9_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooA_unsafe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooA_unsafe = hs_bindgen_eb4a794c10ca94f9
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 :: B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 = \x_0 -> hs_bindgen_a11eb4471a953b64_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooB_unsafe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooB_unsafe = hs_bindgen_a11eb4471a953b64
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 :: M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 = \x_0 -> hs_bindgen_1dea92b3f3346311_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooC_unsafe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooC_unsafe = hs_bindgen_1dea92b3f3346311
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d :: M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d = \x_0 -> hs_bindgen_dba6d56e1a316e2d_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooD_unsafe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooD_unsafe = hs_bindgen_dba6d56e1a316e2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+    CUInt
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae :: E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae = \x_0 -> hs_bindgen_23b6f403a534aeae_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooE_unsafe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooE_unsafe = hs_bindgen_23b6f403a534aeae
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (FunPtr (MyEnum -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 = fmap fromFFIType hs_bindgen_2020929269c10652_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+foo_funptr :: FunPtr (MyEnum -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_2020929269c10652
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 = fmap fromFFIType hs_bindgen_3fbd7681308a7575_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooA_funptr :: FunPtr (A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_3fbd7681308a7575
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (FunPtr (B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d = fmap fromFFIType hs_bindgen_118f9a485493ca2d_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooB_funptr :: FunPtr (B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_118f9a485493ca2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (FunPtr (M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a = fmap fromFFIType hs_bindgen_dbe89d4787aae78a_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooC_funptr :: FunPtr (M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_dbe89d4787aae78a
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (FunPtr (M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 = fmap fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooD_funptr :: FunPtr (M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (FunPtr (E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 = fmap fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooE_funptr :: FunPtr (E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/enum.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/enum.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example.hs
@@ -0,0 +1,145 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (IO, fmap, type (~))
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 6:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+newtype A = A
+  { unwrapA :: BG.CInt -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toA@
+foreign import ccall safe "wrapper" hs_bindgen_0c7d4776a632d026_base ::
+     (BG.CInt -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+
+-- __unique:__ @toA@
+hs_bindgen_0c7d4776a632d026 ::
+     A
+  -> IO (BG.FunPtr A)
+hs_bindgen_0c7d4776a632d026 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_0c7d4776a632d026_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrapA" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromA@
+foreign import ccall safe "dynamic" hs_bindgen_0cf9a6d50f563441_base ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> BG.CInt -> IO BG.CInt
+
+-- __unique:__ @fromA@
+hs_bindgen_0cf9a6d50f563441 ::
+     BG.FunPtr A
+  -> A
+hs_bindgen_0cf9a6d50f563441 =
+  \funPtr0 ->
+    A (\x1 ->
+         fmap BG.fromFFIType (hs_bindgen_0cf9a6d50f563441_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr A where
+
+  toFunPtr = hs_bindgen_0c7d4776a632d026
+
+instance BG.FromFunPtr A where
+
+  fromFunPtr = hs_bindgen_0cf9a6d50f563441
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.CInt -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 7:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 19:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example/FunPtr.hs
@@ -0,0 +1,358 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    , Example.FunPtr.bar
+    , Example.FunPtr.barA
+    , Example.FunPtr.barB
+    , Example.FunPtr.barC
+    , Example.FunPtr.barD
+    , Example.FunPtr.barE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/function.h>"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2020929269c10652 (void)) ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3fbd7681308a7575 (void)) ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_118f9a485493ca2d (void)) ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dbe89d4787aae78a (void)) ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf5702eef5ab2ac4 (void)) ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dc10cdc4b07670d1 (void)) ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d07fcdceb06f5a2c (void)) ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_barA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_807763d49e9b12a2 (void)) ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  return &barA;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_barB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_978114a8cf46bc2b (void)) ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  return &barB;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_barC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8db1266f28c7b15e (void)) ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  return &barC;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_barD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_643d72e5cfddafd7 (void)) ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  return &barD;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_barE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_659e6f20e0c4f384 (void)) ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  return &barE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ()))
+hs_bindgen_2020929269c10652 =
+  fmap BG.fromFFIType hs_bindgen_2020929269c10652_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+foo :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_2020929269c10652
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (BG.FunPtr (BG.FunPtr A -> IO ()))
+hs_bindgen_3fbd7681308a7575 =
+  fmap BG.fromFFIType hs_bindgen_3fbd7681308a7575_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooA :: BG.FunPtr (BG.FunPtr A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_3fbd7681308a7575
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (BG.FunPtr (BG.FunPtr B -> IO ()))
+hs_bindgen_118f9a485493ca2d =
+  fmap BG.fromFFIType hs_bindgen_118f9a485493ca2d_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooB :: BG.FunPtr (BG.FunPtr B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_118f9a485493ca2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (BG.FunPtr (BG.FunPtr M.C -> IO ()))
+hs_bindgen_dbe89d4787aae78a =
+  fmap BG.fromFFIType hs_bindgen_dbe89d4787aae78a_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooC :: BG.FunPtr (BG.FunPtr M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_dbe89d4787aae78a
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (BG.FunPtr (BG.FunPtr M.D -> IO ()))
+hs_bindgen_cf5702eef5ab2ac4 =
+  fmap BG.fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooD :: BG.FunPtr (BG.FunPtr M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (BG.FunPtr (BG.FunPtr E -> IO ()))
+hs_bindgen_dc10cdc4b07670d1 =
+  fmap BG.fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooE :: BG.FunPtr (BG.FunPtr E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_dc10cdc4b07670d1
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_d07fcdceb06f5a2c" hs_bindgen_d07fcdceb06f5a2c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_bar@
+hs_bindgen_d07fcdceb06f5a2c :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ()))
+hs_bindgen_d07fcdceb06f5a2c =
+  fmap BG.fromFFIType hs_bindgen_d07fcdceb06f5a2c_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 28:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+bar :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_d07fcdceb06f5a2c
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barA@
+foreign import ccall unsafe "hs_bindgen_807763d49e9b12a2" hs_bindgen_807763d49e9b12a2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barA@
+hs_bindgen_807763d49e9b12a2 :: IO (BG.FunPtr (BG.FunPtr A -> IO ()))
+hs_bindgen_807763d49e9b12a2 =
+  fmap BG.fromFFIType hs_bindgen_807763d49e9b12a2_base
+
+{-# NOINLINE barA #-}
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 30:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barA :: BG.FunPtr (BG.FunPtr A -> IO ())
+barA = BG.unsafePerformIO hs_bindgen_807763d49e9b12a2
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barB@
+foreign import ccall unsafe "hs_bindgen_978114a8cf46bc2b" hs_bindgen_978114a8cf46bc2b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barB@
+hs_bindgen_978114a8cf46bc2b :: IO (BG.FunPtr (BG.FunPtr B -> IO ()))
+hs_bindgen_978114a8cf46bc2b =
+  fmap BG.fromFFIType hs_bindgen_978114a8cf46bc2b_base
+
+{-# NOINLINE barB #-}
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 31:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barB :: BG.FunPtr (BG.FunPtr B -> IO ())
+barB = BG.unsafePerformIO hs_bindgen_978114a8cf46bc2b
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barC@
+foreign import ccall unsafe "hs_bindgen_8db1266f28c7b15e" hs_bindgen_8db1266f28c7b15e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barC@
+hs_bindgen_8db1266f28c7b15e :: IO (BG.FunPtr (BG.FunPtr M.C -> IO ()))
+hs_bindgen_8db1266f28c7b15e =
+  fmap BG.fromFFIType hs_bindgen_8db1266f28c7b15e_base
+
+{-# NOINLINE barC #-}
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barC :: BG.FunPtr (BG.FunPtr M.C -> IO ())
+barC = BG.unsafePerformIO hs_bindgen_8db1266f28c7b15e
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barD@
+foreign import ccall unsafe "hs_bindgen_643d72e5cfddafd7" hs_bindgen_643d72e5cfddafd7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barD@
+hs_bindgen_643d72e5cfddafd7 :: IO (BG.FunPtr (BG.FunPtr M.D -> IO ()))
+hs_bindgen_643d72e5cfddafd7 =
+  fmap BG.fromFFIType hs_bindgen_643d72e5cfddafd7_base
+
+{-# NOINLINE barD #-}
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barD :: BG.FunPtr (BG.FunPtr M.D -> IO ())
+barD = BG.unsafePerformIO hs_bindgen_643d72e5cfddafd7
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barE@
+foreign import ccall unsafe "hs_bindgen_659e6f20e0c4f384" hs_bindgen_659e6f20e0c4f384_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barE@
+hs_bindgen_659e6f20e0c4f384 :: IO (BG.FunPtr (BG.FunPtr E -> IO ()))
+hs_bindgen_659e6f20e0c4f384 =
+  fmap BG.fromFFIType hs_bindgen_659e6f20e0c4f384_base
+
+{-# NOINLINE barE #-}
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barE :: BG.FunPtr (BG.FunPtr E -> IO ())
+barE = BG.unsafePerformIO hs_bindgen_659e6f20e0c4f384
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example/Safe.hs
@@ -0,0 +1,406 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    , Example.Safe.bar
+    , Example.Safe.barA
+    , Example.Safe.barB
+    , Example.Safe.barC
+    , Example.Safe.barD
+    , Example.Safe.barE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/function.h>"
+  , "void hs_bindgen_99bb90e6d7637d2c ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_392e3092a2681c13 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_6011faf8531be4fa ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_40a50b8e6ac3b09d ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_32b4f35bf27a4bf8 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_6e59183c0a861d01 ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  , "void hs_bindgen_b80066b7dbab19ae ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_3e2a7974766f255b ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (barA)(arg1);"
+  , "}"
+  , "void hs_bindgen_2e70e27c91ce1929 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (barB)(arg1);"
+  , "}"
+  , "void hs_bindgen_4014a425c2b8c6e7 ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (barC)(arg1);"
+  , "}"
+  , "void hs_bindgen_c0263fea7e0285b6 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (barD)(arg1);"
+  , "}"
+  , "void hs_bindgen_431be79cc08aeb21 ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (barE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_99bb90e6d7637d2c =
+  \x0 ->
+    hs_bindgen_99bb90e6d7637d2c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+foo ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_99bb90e6d7637d2c
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 ::
+     BG.FunPtr A
+  -> IO ()
+hs_bindgen_392e3092a2681c13 =
+  \x0 ->
+    hs_bindgen_392e3092a2681c13_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooA ::
+     BG.FunPtr A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_392e3092a2681c13
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa ::
+     BG.FunPtr B
+  -> IO ()
+hs_bindgen_6011faf8531be4fa =
+  \x0 ->
+    hs_bindgen_6011faf8531be4fa_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooB ::
+     BG.FunPtr B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_6011faf8531be4fa
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d ::
+     BG.FunPtr M.C
+  -> IO ()
+hs_bindgen_40a50b8e6ac3b09d =
+  \x0 ->
+    hs_bindgen_40a50b8e6ac3b09d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooC ::
+     BG.FunPtr M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_40a50b8e6ac3b09d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 ::
+     BG.FunPtr M.D
+  -> IO ()
+hs_bindgen_32b4f35bf27a4bf8 =
+  \x0 ->
+    hs_bindgen_32b4f35bf27a4bf8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooD ::
+     BG.FunPtr M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_32b4f35bf27a4bf8
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 ::
+     BG.FunPtr E
+  -> IO ()
+hs_bindgen_6e59183c0a861d01 =
+  \x0 ->
+    hs_bindgen_6e59183c0a861d01_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooE ::
+     BG.FunPtr E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_6e59183c0a861d01
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_b80066b7dbab19ae" hs_bindgen_b80066b7dbab19ae_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_bar@
+hs_bindgen_b80066b7dbab19ae ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_b80066b7dbab19ae =
+  \x0 ->
+    hs_bindgen_b80066b7dbab19ae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 28:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+bar ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_b80066b7dbab19ae
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barA@
+foreign import ccall safe "hs_bindgen_3e2a7974766f255b" hs_bindgen_3e2a7974766f255b_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barA@
+hs_bindgen_3e2a7974766f255b ::
+     BG.FunPtr A
+  -> IO ()
+hs_bindgen_3e2a7974766f255b =
+  \x0 ->
+    hs_bindgen_3e2a7974766f255b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 30:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barA ::
+     BG.FunPtr A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barA = hs_bindgen_3e2a7974766f255b
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barB@
+foreign import ccall safe "hs_bindgen_2e70e27c91ce1929" hs_bindgen_2e70e27c91ce1929_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barB@
+hs_bindgen_2e70e27c91ce1929 ::
+     BG.FunPtr B
+  -> IO ()
+hs_bindgen_2e70e27c91ce1929 =
+  \x0 ->
+    hs_bindgen_2e70e27c91ce1929_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 31:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barB ::
+     BG.FunPtr B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barB = hs_bindgen_2e70e27c91ce1929
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barC@
+foreign import ccall safe "hs_bindgen_4014a425c2b8c6e7" hs_bindgen_4014a425c2b8c6e7_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barC@
+hs_bindgen_4014a425c2b8c6e7 ::
+     BG.FunPtr M.C
+  -> IO ()
+hs_bindgen_4014a425c2b8c6e7 =
+  \x0 ->
+    hs_bindgen_4014a425c2b8c6e7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barC ::
+     BG.FunPtr M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barC = hs_bindgen_4014a425c2b8c6e7
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barD@
+foreign import ccall safe "hs_bindgen_c0263fea7e0285b6" hs_bindgen_c0263fea7e0285b6_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barD@
+hs_bindgen_c0263fea7e0285b6 ::
+     BG.FunPtr M.D
+  -> IO ()
+hs_bindgen_c0263fea7e0285b6 =
+  \x0 ->
+    hs_bindgen_c0263fea7e0285b6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barD ::
+     BG.FunPtr M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barD = hs_bindgen_c0263fea7e0285b6
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barE@
+foreign import ccall safe "hs_bindgen_431be79cc08aeb21" hs_bindgen_431be79cc08aeb21_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barE@
+hs_bindgen_431be79cc08aeb21 ::
+     BG.FunPtr E
+  -> IO ()
+hs_bindgen_431be79cc08aeb21 =
+  \x0 ->
+    hs_bindgen_431be79cc08aeb21_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barE ::
+     BG.FunPtr E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barE = hs_bindgen_431be79cc08aeb21
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/Example/Unsafe.hs
@@ -0,0 +1,406 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    , Example.Unsafe.bar
+    , Example.Unsafe.barA
+    , Example.Unsafe.barB
+    , Example.Unsafe.barC
+    , Example.Unsafe.barD
+    , Example.Unsafe.barE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/function.h>"
+  , "void hs_bindgen_51195acecf6b880e ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_eb4a794c10ca94f9 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_a11eb4471a953b64 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_1dea92b3f3346311 ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_dba6d56e1a316e2d ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_23b6f403a534aeae ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  , "void hs_bindgen_44994e62548d5196 ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_012af7936cfc5b63 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (barA)(arg1);"
+  , "}"
+  , "void hs_bindgen_67ecffff9d788c07 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (barB)(arg1);"
+  , "}"
+  , "void hs_bindgen_e8b5ec0471fff356 ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (barC)(arg1);"
+  , "}"
+  , "void hs_bindgen_98ea214fd1feaaca ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (barD)(arg1);"
+  , "}"
+  , "void hs_bindgen_f145043f481aed3c ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (barE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_51195acecf6b880e =
+  \x0 ->
+    hs_bindgen_51195acecf6b880e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+foo ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_51195acecf6b880e
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 ::
+     BG.FunPtr A
+  -> IO ()
+hs_bindgen_eb4a794c10ca94f9 =
+  \x0 ->
+    hs_bindgen_eb4a794c10ca94f9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooA ::
+     BG.FunPtr A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_eb4a794c10ca94f9
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 ::
+     BG.FunPtr B
+  -> IO ()
+hs_bindgen_a11eb4471a953b64 =
+  \x0 ->
+    hs_bindgen_a11eb4471a953b64_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooB ::
+     BG.FunPtr B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_a11eb4471a953b64
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 ::
+     BG.FunPtr M.C
+  -> IO ()
+hs_bindgen_1dea92b3f3346311 =
+  \x0 ->
+    hs_bindgen_1dea92b3f3346311_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooC ::
+     BG.FunPtr M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_1dea92b3f3346311
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d ::
+     BG.FunPtr M.D
+  -> IO ()
+hs_bindgen_dba6d56e1a316e2d =
+  \x0 ->
+    hs_bindgen_dba6d56e1a316e2d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooD ::
+     BG.FunPtr M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_dba6d56e1a316e2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae ::
+     BG.FunPtr E
+  -> IO ()
+hs_bindgen_23b6f403a534aeae =
+  \x0 ->
+    hs_bindgen_23b6f403a534aeae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooE ::
+     BG.FunPtr E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_23b6f403a534aeae
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_44994e62548d5196" hs_bindgen_44994e62548d5196_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_bar@
+hs_bindgen_44994e62548d5196 ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_44994e62548d5196 =
+  \x0 ->
+    hs_bindgen_44994e62548d5196_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 28:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+bar ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_44994e62548d5196
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barA@
+foreign import ccall unsafe "hs_bindgen_012af7936cfc5b63" hs_bindgen_012af7936cfc5b63_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barA@
+hs_bindgen_012af7936cfc5b63 ::
+     BG.FunPtr A
+  -> IO ()
+hs_bindgen_012af7936cfc5b63 =
+  \x0 ->
+    hs_bindgen_012af7936cfc5b63_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 30:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barA ::
+     BG.FunPtr A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barA = hs_bindgen_012af7936cfc5b63
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barB@
+foreign import ccall unsafe "hs_bindgen_67ecffff9d788c07" hs_bindgen_67ecffff9d788c07_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barB@
+hs_bindgen_67ecffff9d788c07 ::
+     BG.FunPtr B
+  -> IO ()
+hs_bindgen_67ecffff9d788c07 =
+  \x0 ->
+    hs_bindgen_67ecffff9d788c07_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 31:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barB ::
+     BG.FunPtr B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barB = hs_bindgen_67ecffff9d788c07
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barC@
+foreign import ccall unsafe "hs_bindgen_e8b5ec0471fff356" hs_bindgen_e8b5ec0471fff356_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barC@
+hs_bindgen_e8b5ec0471fff356 ::
+     BG.FunPtr M.C
+  -> IO ()
+hs_bindgen_e8b5ec0471fff356 =
+  \x0 ->
+    hs_bindgen_e8b5ec0471fff356_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barC ::
+     BG.FunPtr M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barC = hs_bindgen_e8b5ec0471fff356
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barD@
+foreign import ccall unsafe "hs_bindgen_98ea214fd1feaaca" hs_bindgen_98ea214fd1feaaca_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barD@
+hs_bindgen_98ea214fd1feaaca ::
+     BG.FunPtr M.D
+  -> IO ()
+hs_bindgen_98ea214fd1feaaca =
+  \x0 ->
+    hs_bindgen_98ea214fd1feaaca_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barD ::
+     BG.FunPtr M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barD = hs_bindgen_98ea214fd1feaaca
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barE@
+foreign import ccall unsafe "hs_bindgen_f145043f481aed3c" hs_bindgen_f145043f481aed3c_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barE@
+hs_bindgen_f145043f481aed3c ::
+     BG.FunPtr E
+  -> IO ()
+hs_bindgen_f145043f481aed3c =
+  \x0 ->
+    hs_bindgen_f145043f481aed3c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barE ::
+     BG.FunPtr E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+barE = hs_bindgen_f145043f481aed3c
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/bindingspec.yaml
@@ -0,0 +1,53 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/typedef/function.h
+  cname: A
+  hsname: A
+- headers: binding-specs/fun_arg/typedef/function.h
+  cname: B
+  hsname: B
+- headers: binding-specs/fun_arg/typedef/function.h
+  cname: E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - FromFunPtr
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ToFunPtr
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function/th.txt
@@ -0,0 +1,1117 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function.h
+-- #include <binding-specs/fun_arg/typedef/function.h>
+-- void hs_bindgen_99bb90e6d7637d2c (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_392e3092a2681c13 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_6011faf8531be4fa (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_40a50b8e6ac3b09d (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_32b4f35bf27a4bf8 (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_6e59183c0a861d01 (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_b80066b7dbab19ae (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_3e2a7974766f255b (
+--   A *arg1
+-- )
+-- {
+--   (barA)(arg1);
+-- }
+-- void hs_bindgen_2e70e27c91ce1929 (
+--   B *arg1
+-- )
+-- {
+--   (barB)(arg1);
+-- }
+-- void hs_bindgen_4014a425c2b8c6e7 (
+--   C *arg1
+-- )
+-- {
+--   (barC)(arg1);
+-- }
+-- void hs_bindgen_c0263fea7e0285b6 (
+--   D *arg1
+-- )
+-- {
+--   (barD)(arg1);
+-- }
+-- void hs_bindgen_431be79cc08aeb21 (
+--   E *arg1
+-- )
+-- {
+--   (barE)(arg1);
+-- }
+-- void hs_bindgen_51195acecf6b880e (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_eb4a794c10ca94f9 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_a11eb4471a953b64 (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_1dea92b3f3346311 (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_dba6d56e1a316e2d (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_23b6f403a534aeae (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_44994e62548d5196 (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_012af7936cfc5b63 (
+--   A *arg1
+-- )
+-- {
+--   (barA)(arg1);
+-- }
+-- void hs_bindgen_67ecffff9d788c07 (
+--   B *arg1
+-- )
+-- {
+--   (barB)(arg1);
+-- }
+-- void hs_bindgen_e8b5ec0471fff356 (
+--   C *arg1
+-- )
+-- {
+--   (barC)(arg1);
+-- }
+-- void hs_bindgen_98ea214fd1feaaca (
+--   D *arg1
+-- )
+-- {
+--   (barD)(arg1);
+-- }
+-- void hs_bindgen_f145043f481aed3c (
+--   E *arg1
+-- )
+-- {
+--   (barE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2020929269c10652 (void)) (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3fbd7681308a7575 (void)) (
+--   A *arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_118f9a485493ca2d (void)) (
+--   B *arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dbe89d4787aae78a (void)) (
+--   C *arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf5702eef5ab2ac4 (void)) (
+--   D *arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dc10cdc4b07670d1 (void)) (
+--   E *arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d07fcdceb06f5a2c (void)) (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_barA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_807763d49e9b12a2 (void)) (
+--   A *arg1
+-- )
+-- {
+--   return &barA;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_barB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_978114a8cf46bc2b (void)) (
+--   B *arg1
+-- )
+-- {
+--   return &barB;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_barC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8db1266f28c7b15e (void)) (
+--   C *arg1
+-- )
+-- {
+--   return &barC;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_barD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_643d72e5cfddafd7 (void)) (
+--   D *arg1
+-- )
+-- {
+--   return &barD;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_barE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_659e6f20e0c4f384 (void)) (
+--   E *arg1
+-- )
+-- {
+--   return &barE;
+-- }
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 6:13@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+newtype A = A {unwrapA :: (CInt -> IO CInt)} deriving stock Generic
+-- __unique:__ @toA@
+foreign import ccall safe "wrapper" hs_bindgen_0c7d4776a632d026_base ::
+    CInt -> IO CInt
+ -> IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @toA@
+hs_bindgen_0c7d4776a632d026 :: A -> IO (FunPtr A)
+-- __unique:__ @toA@
+hs_bindgen_0c7d4776a632d026 = \fun_0 -> fmap castFunPtr (hs_bindgen_0c7d4776a632d026_base (\x_1 -> fmap toFFIType (getField @"unwrapA" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromA@
+foreign import ccall safe "dynamic" hs_bindgen_0cf9a6d50f563441_base ::
+    FunPtr (CInt -> IO CInt)
+ -> CInt
+ -> IO CInt
+-- __unique:__ @fromA@
+hs_bindgen_0cf9a6d50f563441 :: FunPtr A -> A
+-- __unique:__ @fromA@
+hs_bindgen_0cf9a6d50f563441 = \funPtr_0 -> A (\x_1 -> fmap fromFFIType (hs_bindgen_0cf9a6d50f563441_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr A
+    where toFunPtr = hs_bindgen_0c7d4776a632d026
+instance FromFunPtr A
+    where fromFunPtr = hs_bindgen_0cf9a6d50f563441
+instance (~) ty (CInt -> IO CInt) => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = CInt -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 7:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+newtype B = B {unwrapB :: A} deriving stock Generic
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 19:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c = \x_0 -> hs_bindgen_99bb90e6d7637d2c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+foo_safe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+foo_safe = hs_bindgen_99bb90e6d7637d2c
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 :: FunPtr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 = \x_0 -> hs_bindgen_392e3092a2681c13_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooA_safe :: FunPtr A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooA_safe = hs_bindgen_392e3092a2681c13
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa :: FunPtr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa = \x_0 -> hs_bindgen_6011faf8531be4fa_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooB_safe :: FunPtr B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooB_safe = hs_bindgen_6011faf8531be4fa
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d :: FunPtr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d = \x_0 -> hs_bindgen_40a50b8e6ac3b09d_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooC_safe :: FunPtr M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooC_safe = hs_bindgen_40a50b8e6ac3b09d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 :: FunPtr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 = \x_0 -> hs_bindgen_32b4f35bf27a4bf8_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooD_safe :: FunPtr M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooD_safe = hs_bindgen_32b4f35bf27a4bf8
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 :: FunPtr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 = \x_0 -> hs_bindgen_6e59183c0a861d01_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooE_safe :: FunPtr E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooE_safe = hs_bindgen_6e59183c0a861d01
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_b80066b7dbab19ae" hs_bindgen_b80066b7dbab19ae_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_bar@
+hs_bindgen_b80066b7dbab19ae :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_bar@
+hs_bindgen_b80066b7dbab19ae = \x_0 -> hs_bindgen_b80066b7dbab19ae_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 28:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+bar_safe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 28:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+bar_safe = hs_bindgen_b80066b7dbab19ae
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barA@
+foreign import ccall safe "hs_bindgen_3e2a7974766f255b" hs_bindgen_3e2a7974766f255b_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barA@
+hs_bindgen_3e2a7974766f255b :: FunPtr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barA@
+hs_bindgen_3e2a7974766f255b = \x_0 -> hs_bindgen_3e2a7974766f255b_base (toFFIType x_0)
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 30:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barA_safe :: FunPtr A -> IO ()
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 30:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barA_safe = hs_bindgen_3e2a7974766f255b
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barB@
+foreign import ccall safe "hs_bindgen_2e70e27c91ce1929" hs_bindgen_2e70e27c91ce1929_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barB@
+hs_bindgen_2e70e27c91ce1929 :: FunPtr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barB@
+hs_bindgen_2e70e27c91ce1929 = \x_0 -> hs_bindgen_2e70e27c91ce1929_base (toFFIType x_0)
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 31:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barB_safe :: FunPtr B -> IO ()
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 31:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barB_safe = hs_bindgen_2e70e27c91ce1929
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barC@
+foreign import ccall safe "hs_bindgen_4014a425c2b8c6e7" hs_bindgen_4014a425c2b8c6e7_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barC@
+hs_bindgen_4014a425c2b8c6e7 :: FunPtr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barC@
+hs_bindgen_4014a425c2b8c6e7 = \x_0 -> hs_bindgen_4014a425c2b8c6e7_base (toFFIType x_0)
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barC_safe :: FunPtr M.C -> IO ()
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barC_safe = hs_bindgen_4014a425c2b8c6e7
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barD@
+foreign import ccall safe "hs_bindgen_c0263fea7e0285b6" hs_bindgen_c0263fea7e0285b6_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barD@
+hs_bindgen_c0263fea7e0285b6 :: FunPtr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barD@
+hs_bindgen_c0263fea7e0285b6 = \x_0 -> hs_bindgen_c0263fea7e0285b6_base (toFFIType x_0)
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barD_safe :: FunPtr M.D -> IO ()
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barD_safe = hs_bindgen_c0263fea7e0285b6
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barE@
+foreign import ccall safe "hs_bindgen_431be79cc08aeb21" hs_bindgen_431be79cc08aeb21_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barE@
+hs_bindgen_431be79cc08aeb21 :: FunPtr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_barE@
+hs_bindgen_431be79cc08aeb21 = \x_0 -> hs_bindgen_431be79cc08aeb21_base (toFFIType x_0)
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barE_safe :: FunPtr E -> IO ()
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barE_safe = hs_bindgen_431be79cc08aeb21
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e = \x_0 -> hs_bindgen_51195acecf6b880e_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+foo_unsafe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+foo_unsafe = hs_bindgen_51195acecf6b880e
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 :: FunPtr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 = \x_0 -> hs_bindgen_eb4a794c10ca94f9_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooA_unsafe :: FunPtr A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooA_unsafe = hs_bindgen_eb4a794c10ca94f9
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 :: FunPtr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 = \x_0 -> hs_bindgen_a11eb4471a953b64_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooB_unsafe :: FunPtr B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooB_unsafe = hs_bindgen_a11eb4471a953b64
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 :: FunPtr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 = \x_0 -> hs_bindgen_1dea92b3f3346311_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooC_unsafe :: FunPtr M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooC_unsafe = hs_bindgen_1dea92b3f3346311
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d :: FunPtr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d = \x_0 -> hs_bindgen_dba6d56e1a316e2d_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooD_unsafe :: FunPtr M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooD_unsafe = hs_bindgen_dba6d56e1a316e2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae :: FunPtr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae = \x_0 -> hs_bindgen_23b6f403a534aeae_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooE_unsafe :: FunPtr E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooE_unsafe = hs_bindgen_23b6f403a534aeae
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_44994e62548d5196" hs_bindgen_44994e62548d5196_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_bar@
+hs_bindgen_44994e62548d5196 :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_bar@
+hs_bindgen_44994e62548d5196 = \x_0 -> hs_bindgen_44994e62548d5196_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 28:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+bar_unsafe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 28:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+bar_unsafe = hs_bindgen_44994e62548d5196
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barA@
+foreign import ccall unsafe "hs_bindgen_012af7936cfc5b63" hs_bindgen_012af7936cfc5b63_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barA@
+hs_bindgen_012af7936cfc5b63 :: FunPtr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barA@
+hs_bindgen_012af7936cfc5b63 = \x_0 -> hs_bindgen_012af7936cfc5b63_base (toFFIType x_0)
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 30:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barA_unsafe :: FunPtr A -> IO ()
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 30:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barA_unsafe = hs_bindgen_012af7936cfc5b63
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barB@
+foreign import ccall unsafe "hs_bindgen_67ecffff9d788c07" hs_bindgen_67ecffff9d788c07_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barB@
+hs_bindgen_67ecffff9d788c07 :: FunPtr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barB@
+hs_bindgen_67ecffff9d788c07 = \x_0 -> hs_bindgen_67ecffff9d788c07_base (toFFIType x_0)
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 31:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barB_unsafe :: FunPtr B -> IO ()
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 31:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barB_unsafe = hs_bindgen_67ecffff9d788c07
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barC@
+foreign import ccall unsafe "hs_bindgen_e8b5ec0471fff356" hs_bindgen_e8b5ec0471fff356_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barC@
+hs_bindgen_e8b5ec0471fff356 :: FunPtr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barC@
+hs_bindgen_e8b5ec0471fff356 = \x_0 -> hs_bindgen_e8b5ec0471fff356_base (toFFIType x_0)
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barC_unsafe :: FunPtr M.C -> IO ()
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barC_unsafe = hs_bindgen_e8b5ec0471fff356
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barD@
+foreign import ccall unsafe "hs_bindgen_98ea214fd1feaaca" hs_bindgen_98ea214fd1feaaca_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barD@
+hs_bindgen_98ea214fd1feaaca :: FunPtr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barD@
+hs_bindgen_98ea214fd1feaaca = \x_0 -> hs_bindgen_98ea214fd1feaaca_base (toFFIType x_0)
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barD_unsafe :: FunPtr M.D -> IO ()
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barD_unsafe = hs_bindgen_98ea214fd1feaaca
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barE@
+foreign import ccall unsafe "hs_bindgen_f145043f481aed3c" hs_bindgen_f145043f481aed3c_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barE@
+hs_bindgen_f145043f481aed3c :: FunPtr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_barE@
+hs_bindgen_f145043f481aed3c = \x_0 -> hs_bindgen_f145043f481aed3c_base (toFFIType x_0)
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barE_unsafe :: FunPtr E -> IO ()
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barE_unsafe = hs_bindgen_f145043f481aed3c
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO CInt) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 = fmap fromFFIType hs_bindgen_2020929269c10652_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+foo_funptr :: FunPtr (FunPtr (CInt -> IO CInt) -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_2020929269c10652
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (FunPtr (FunPtr A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 = fmap fromFFIType hs_bindgen_3fbd7681308a7575_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooA_funptr :: FunPtr (FunPtr A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_3fbd7681308a7575
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (FunPtr (FunPtr B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d = fmap fromFFIType hs_bindgen_118f9a485493ca2d_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooB_funptr :: FunPtr (FunPtr B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_118f9a485493ca2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (FunPtr (FunPtr M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a = fmap fromFFIType hs_bindgen_dbe89d4787aae78a_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooC_funptr :: FunPtr (FunPtr M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_dbe89d4787aae78a
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (FunPtr (FunPtr M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 = fmap fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooD_funptr :: FunPtr (FunPtr M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (FunPtr (FunPtr E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 = fmap fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooE_funptr :: FunPtr (FunPtr E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_dc10cdc4b07670d1
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_d07fcdceb06f5a2c" hs_bindgen_d07fcdceb06f5a2c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_bar@
+hs_bindgen_d07fcdceb06f5a2c :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO CInt) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_bar@
+hs_bindgen_d07fcdceb06f5a2c = fmap fromFFIType hs_bindgen_d07fcdceb06f5a2c_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 28:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+bar_funptr :: FunPtr (FunPtr (CInt -> IO CInt) -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 28:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_d07fcdceb06f5a2c
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barA@
+foreign import ccall unsafe "hs_bindgen_807763d49e9b12a2" hs_bindgen_807763d49e9b12a2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barA@
+hs_bindgen_807763d49e9b12a2 :: IO (FunPtr (FunPtr A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barA@
+hs_bindgen_807763d49e9b12a2 = fmap fromFFIType hs_bindgen_807763d49e9b12a2_base
+{-# NOINLINE barA_funptr #-}
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 30:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barA_funptr :: FunPtr (FunPtr A -> IO ())
+{-| __C declaration:__ @barA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 30:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barA_funptr = unsafePerformIO hs_bindgen_807763d49e9b12a2
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barB@
+foreign import ccall unsafe "hs_bindgen_978114a8cf46bc2b" hs_bindgen_978114a8cf46bc2b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barB@
+hs_bindgen_978114a8cf46bc2b :: IO (FunPtr (FunPtr B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barB@
+hs_bindgen_978114a8cf46bc2b = fmap fromFFIType hs_bindgen_978114a8cf46bc2b_base
+{-# NOINLINE barB_funptr #-}
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 31:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barB_funptr :: FunPtr (FunPtr B -> IO ())
+{-| __C declaration:__ @barB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 31:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barB_funptr = unsafePerformIO hs_bindgen_978114a8cf46bc2b
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barC@
+foreign import ccall unsafe "hs_bindgen_8db1266f28c7b15e" hs_bindgen_8db1266f28c7b15e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barC@
+hs_bindgen_8db1266f28c7b15e :: IO (FunPtr (FunPtr M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barC@
+hs_bindgen_8db1266f28c7b15e = fmap fromFFIType hs_bindgen_8db1266f28c7b15e_base
+{-# NOINLINE barC_funptr #-}
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barC_funptr :: FunPtr (FunPtr M.C -> IO ())
+{-| __C declaration:__ @barC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 33:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barC_funptr = unsafePerformIO hs_bindgen_8db1266f28c7b15e
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barD@
+foreign import ccall unsafe "hs_bindgen_643d72e5cfddafd7" hs_bindgen_643d72e5cfddafd7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barD@
+hs_bindgen_643d72e5cfddafd7 :: IO (FunPtr (FunPtr M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barD@
+hs_bindgen_643d72e5cfddafd7 = fmap fromFFIType hs_bindgen_643d72e5cfddafd7_base
+{-# NOINLINE barD_funptr #-}
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barD_funptr :: FunPtr (FunPtr M.D -> IO ())
+{-| __C declaration:__ @barD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 34:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barD_funptr = unsafePerformIO hs_bindgen_643d72e5cfddafd7
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barE@
+foreign import ccall unsafe "hs_bindgen_659e6f20e0c4f384" hs_bindgen_659e6f20e0c4f384_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barE@
+hs_bindgen_659e6f20e0c4f384 :: IO (FunPtr (FunPtr E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_barE@
+hs_bindgen_659e6f20e0c4f384 = fmap fromFFIType hs_bindgen_659e6f20e0c4f384_base
+{-# NOINLINE barE_funptr #-}
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barE_funptr :: FunPtr (FunPtr E -> IO ())
+{-| __C declaration:__ @barE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function.h 35:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function.h@
+-}
+barE_funptr = unsafePerformIO hs_bindgen_659e6f20e0c4f384
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example.hs
@@ -0,0 +1,197 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A_Aux(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (Eq, IO, Ord, Show, fmap, type (~))
+
+{-| Auxiliary type used by 'A'
+
+    __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 6:15@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+newtype A_Aux = A_Aux
+  { unwrapA_Aux :: BG.CInt -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toA_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1cabb32c661d9a0e_base ::
+     (BG.CInt -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+
+-- __unique:__ @toA_Aux@
+hs_bindgen_1cabb32c661d9a0e ::
+     A_Aux
+  -> IO (BG.FunPtr A_Aux)
+hs_bindgen_1cabb32c661d9a0e =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1cabb32c661d9a0e_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrapA_Aux" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromA_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_cdb12400c6863f15_base ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> BG.CInt -> IO BG.CInt
+
+-- __unique:__ @fromA_Aux@
+hs_bindgen_cdb12400c6863f15 ::
+     BG.FunPtr A_Aux
+  -> A_Aux
+hs_bindgen_cdb12400c6863f15 =
+  \funPtr0 ->
+    A_Aux (\x1 ->
+             fmap BG.fromFFIType (hs_bindgen_cdb12400c6863f15_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr A_Aux where
+
+  toFunPtr = hs_bindgen_1cabb32c661d9a0e
+
+instance BG.FromFunPtr A_Aux where
+
+  fromFunPtr = hs_bindgen_cdb12400c6863f15
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapA_Aux" A_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         A_Aux {unwrapA_Aux = y1}, BG.getField @"unwrapA_Aux" x0)
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "unwrapA_Aux" (BG.Ptr A_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapA_Aux")
+
+instance HasCField.HasCField A_Aux "unwrapA_Aux" where
+
+  type CFieldType A_Aux "unwrapA_Aux" =
+    BG.CInt -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 6:15@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+newtype A = A
+  { unwrapA :: BG.FunPtr A_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr A_Aux
+         ) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance ( ty ~ BG.FunPtr A_Aux
+         ) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.FunPtr A_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 7:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 19:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+  deriving newtype (BG.HasFFIType)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example/FunPtr.hs
@@ -0,0 +1,188 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/function_pointer.h>"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2020929269c10652 (void)) ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3fbd7681308a7575 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_118f9a485493ca2d (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dbe89d4787aae78a (void)) ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf5702eef5ab2ac4 (void)) ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dc10cdc4b07670d1 (void)) ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ()))
+hs_bindgen_2020929269c10652 =
+  fmap BG.fromFFIType hs_bindgen_2020929269c10652_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+foo :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_2020929269c10652
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_3fbd7681308a7575 =
+  fmap BG.fromFFIType hs_bindgen_3fbd7681308a7575_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooA :: BG.FunPtr (A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_3fbd7681308a7575
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_118f9a485493ca2d =
+  fmap BG.fromFFIType hs_bindgen_118f9a485493ca2d_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooB :: BG.FunPtr (B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_118f9a485493ca2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (BG.FunPtr (M.C -> IO ()))
+hs_bindgen_dbe89d4787aae78a =
+  fmap BG.fromFFIType hs_bindgen_dbe89d4787aae78a_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooC :: BG.FunPtr (M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_dbe89d4787aae78a
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (BG.FunPtr (M.D -> IO ()))
+hs_bindgen_cf5702eef5ab2ac4 =
+  fmap BG.fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooD :: BG.FunPtr (M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (BG.FunPtr (E -> IO ()))
+hs_bindgen_dc10cdc4b07670d1 =
+  fmap BG.fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooE :: BG.FunPtr (E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example/Safe.hs
@@ -0,0 +1,212 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/function_pointer.h>"
+  , "void hs_bindgen_99bb90e6d7637d2c ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_392e3092a2681c13 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_6011faf8531be4fa ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_40a50b8e6ac3b09d ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_32b4f35bf27a4bf8 ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_6e59183c0a861d01 ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_99bb90e6d7637d2c =
+  \x0 ->
+    hs_bindgen_99bb90e6d7637d2c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+foo ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_99bb90e6d7637d2c
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 ::
+     A
+  -> IO ()
+hs_bindgen_392e3092a2681c13 =
+  \x0 ->
+    hs_bindgen_392e3092a2681c13_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_392e3092a2681c13
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa ::
+     B
+  -> IO ()
+hs_bindgen_6011faf8531be4fa =
+  \x0 ->
+    hs_bindgen_6011faf8531be4fa_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_6011faf8531be4fa
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d ::
+     M.C
+  -> IO ()
+hs_bindgen_40a50b8e6ac3b09d =
+  \x0 ->
+    hs_bindgen_40a50b8e6ac3b09d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_40a50b8e6ac3b09d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 ::
+     M.D
+  -> IO ()
+hs_bindgen_32b4f35bf27a4bf8 =
+  \x0 ->
+    hs_bindgen_32b4f35bf27a4bf8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_32b4f35bf27a4bf8
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 ::
+     E
+  -> IO ()
+hs_bindgen_6e59183c0a861d01 =
+  \x0 ->
+    hs_bindgen_6e59183c0a861d01_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_6e59183c0a861d01
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/Example/Unsafe.hs
@@ -0,0 +1,212 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/function_pointer.h>"
+  , "void hs_bindgen_51195acecf6b880e ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_eb4a794c10ca94f9 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(arg1);"
+  , "}"
+  , "void hs_bindgen_a11eb4471a953b64 ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(arg1);"
+  , "}"
+  , "void hs_bindgen_1dea92b3f3346311 ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(arg1);"
+  , "}"
+  , "void hs_bindgen_dba6d56e1a316e2d ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(arg1);"
+  , "}"
+  , "void hs_bindgen_23b6f403a534aeae ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_51195acecf6b880e =
+  \x0 ->
+    hs_bindgen_51195acecf6b880e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+foo ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_51195acecf6b880e
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 ::
+     A
+  -> IO ()
+hs_bindgen_eb4a794c10ca94f9 =
+  \x0 ->
+    hs_bindgen_eb4a794c10ca94f9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA = hs_bindgen_eb4a794c10ca94f9
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 ::
+     B
+  -> IO ()
+hs_bindgen_a11eb4471a953b64 =
+  \x0 ->
+    hs_bindgen_a11eb4471a953b64_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB = hs_bindgen_a11eb4471a953b64
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 ::
+     M.C
+  -> IO ()
+hs_bindgen_1dea92b3f3346311 =
+  \x0 ->
+    hs_bindgen_1dea92b3f3346311_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC = hs_bindgen_1dea92b3f3346311
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d ::
+     M.D
+  -> IO ()
+hs_bindgen_dba6d56e1a316e2d =
+  \x0 ->
+    hs_bindgen_dba6d56e1a316e2d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD = hs_bindgen_dba6d56e1a316e2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae ::
+     E
+  -> IO ()
+hs_bindgen_23b6f403a534aeae =
+  \x0 ->
+    hs_bindgen_23b6f403a534aeae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE = hs_bindgen_23b6f403a534aeae
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/bindingspec.yaml
@@ -0,0 +1,77 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/typedef/function_pointer.h
+  cname: A
+  hsname: A
+- headers: binding-specs/fun_arg/typedef/function_pointer.h
+  cname: B
+  hsname: B
+- headers: binding-specs/fun_arg/typedef/function_pointer.h
+  cname: E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/function_pointer/th.txt
@@ -0,0 +1,631 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function_pointer.h
+-- #include <binding-specs/fun_arg/typedef/function_pointer.h>
+-- void hs_bindgen_99bb90e6d7637d2c (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_392e3092a2681c13 (
+--   A arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_6011faf8531be4fa (
+--   B arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_40a50b8e6ac3b09d (
+--   C arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_32b4f35bf27a4bf8 (
+--   D arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_6e59183c0a861d01 (
+--   E arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- void hs_bindgen_51195acecf6b880e (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_eb4a794c10ca94f9 (
+--   A arg1
+-- )
+-- {
+--   (fooA)(arg1);
+-- }
+-- void hs_bindgen_a11eb4471a953b64 (
+--   B arg1
+-- )
+-- {
+--   (fooB)(arg1);
+-- }
+-- void hs_bindgen_1dea92b3f3346311 (
+--   C arg1
+-- )
+-- {
+--   (fooC)(arg1);
+-- }
+-- void hs_bindgen_dba6d56e1a316e2d (
+--   D arg1
+-- )
+-- {
+--   (fooD)(arg1);
+-- }
+-- void hs_bindgen_23b6f403a534aeae (
+--   E arg1
+-- )
+-- {
+--   (fooE)(arg1);
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2020929269c10652 (void)) (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3fbd7681308a7575 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_118f9a485493ca2d (void)) (
+--   B arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dbe89d4787aae78a (void)) (
+--   C arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf5702eef5ab2ac4 (void)) (
+--   D arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dc10cdc4b07670d1 (void)) (
+--   E arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| Auxiliary type used by 'A'
+
+    __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 6:15@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+newtype A_Aux
+    = A_Aux {unwrapA_Aux :: (CInt -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toA_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1cabb32c661d9a0e_base ::
+    CInt -> IO CInt
+ -> IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @toA_Aux@
+hs_bindgen_1cabb32c661d9a0e :: A_Aux -> IO (FunPtr A_Aux)
+-- __unique:__ @toA_Aux@
+hs_bindgen_1cabb32c661d9a0e = \fun_0 -> fmap castFunPtr (hs_bindgen_1cabb32c661d9a0e_base (\x_1 -> fmap toFFIType (getField @"unwrapA_Aux" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromA_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_cdb12400c6863f15_base ::
+    FunPtr (CInt -> IO CInt)
+ -> CInt
+ -> IO CInt
+-- __unique:__ @fromA_Aux@
+hs_bindgen_cdb12400c6863f15 :: FunPtr A_Aux -> A_Aux
+-- __unique:__ @fromA_Aux@
+hs_bindgen_cdb12400c6863f15 = \funPtr_0 -> A_Aux (\x_1 -> fmap fromFFIType (hs_bindgen_cdb12400c6863f15_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr A_Aux
+    where toFunPtr = hs_bindgen_1cabb32c661d9a0e
+instance FromFunPtr A_Aux
+    where fromFunPtr = hs_bindgen_cdb12400c6863f15
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapA_Aux" A_Aux ty
+    where hasField = \x_0 -> (\y_1 -> A_Aux{unwrapA_Aux = y_1},
+                              getField @"unwrapA_Aux" x_0)
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapA_Aux" (Ptr A_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA_Aux")
+instance HasCField A_Aux "unwrapA_Aux"
+    where type CFieldType A_Aux "unwrapA_Aux" = CInt -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 6:15@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+newtype A
+    = A {unwrapA :: (FunPtr A_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr A_Aux) => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty (FunPtr A_Aux) =>
+         HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = FunPtr A_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 7:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 19:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+newtype E
+    = E {unwrapE :: M.C}
+    deriving stock Generic
+    deriving newtype HasFFIType
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c = \x_0 -> hs_bindgen_99bb90e6d7637d2c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+foo_safe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+foo_safe = hs_bindgen_99bb90e6d7637d2c
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 :: A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 = \x_0 -> hs_bindgen_392e3092a2681c13_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooA_safe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooA_safe = hs_bindgen_392e3092a2681c13
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa :: B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa = \x_0 -> hs_bindgen_6011faf8531be4fa_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooB_safe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooB_safe = hs_bindgen_6011faf8531be4fa
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d :: M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d = \x_0 -> hs_bindgen_40a50b8e6ac3b09d_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooC_safe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooC_safe = hs_bindgen_40a50b8e6ac3b09d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 :: M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 = \x_0 -> hs_bindgen_32b4f35bf27a4bf8_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooD_safe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooD_safe = hs_bindgen_32b4f35bf27a4bf8
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 :: E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 = \x_0 -> hs_bindgen_6e59183c0a861d01_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooE_safe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooE_safe = hs_bindgen_6e59183c0a861d01
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e = \x_0 -> hs_bindgen_51195acecf6b880e_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+foo_unsafe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+foo_unsafe = hs_bindgen_51195acecf6b880e
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 :: A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 = \x_0 -> hs_bindgen_eb4a794c10ca94f9_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooA_unsafe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooA_unsafe = hs_bindgen_eb4a794c10ca94f9
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 :: B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 = \x_0 -> hs_bindgen_a11eb4471a953b64_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooB_unsafe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooB_unsafe = hs_bindgen_a11eb4471a953b64
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 :: M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 = \x_0 -> hs_bindgen_1dea92b3f3346311_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooC_unsafe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooC_unsafe = hs_bindgen_1dea92b3f3346311
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d :: M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d = \x_0 -> hs_bindgen_dba6d56e1a316e2d_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooD_unsafe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooD_unsafe = hs_bindgen_dba6d56e1a316e2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae :: E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae = \x_0 -> hs_bindgen_23b6f403a534aeae_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooE_unsafe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooE_unsafe = hs_bindgen_23b6f403a534aeae
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO CInt) ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 = fmap fromFFIType hs_bindgen_2020929269c10652_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+foo_funptr :: FunPtr (FunPtr (CInt -> IO CInt) -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 4:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_2020929269c10652
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 = fmap fromFFIType hs_bindgen_3fbd7681308a7575_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooA_funptr :: FunPtr (A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 9:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_3fbd7681308a7575
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (FunPtr (B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d = fmap fromFFIType hs_bindgen_118f9a485493ca2d_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooB_funptr :: FunPtr (B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_118f9a485493ca2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (FunPtr (M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a = fmap fromFFIType hs_bindgen_dbe89d4787aae78a_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooC_funptr :: FunPtr (M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 21:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_dbe89d4787aae78a
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (FunPtr (M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 = fmap fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooD_funptr :: FunPtr (M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 22:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (FunPtr (E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 = fmap fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooE_funptr :: FunPtr (E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/function_pointer.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example.hs
@@ -0,0 +1,192 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyStruct(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct MyStruct@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 4:8@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+data MyStruct = MyStruct
+  { myStruct_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 4:23@
+
+         __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize MyStruct where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw MyStruct where
+
+  readRaw =
+    \ptr0 ->
+          pure MyStruct
+      <*> HasCField.readRaw (BG.Proxy @"myStruct_x") ptr0
+
+instance Marshal.WriteRaw MyStruct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MyStruct myStruct_x2 ->
+            HasCField.writeRaw (BG.Proxy @"myStruct_x") ptr0 myStruct_x2
+
+deriving via Marshal.EquivStorable MyStruct instance BG.Storable MyStruct
+
+deriving via Struct.IsStructViaReadRaw MyStruct instance Struct.IsStruct MyStruct
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 4:23@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "myStruct_x" MyStruct ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyStruct {myStruct_x = y1}, BG.getField @"myStruct_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "myStruct_x" (BG.Ptr MyStruct) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"myStruct_x")
+
+instance HasCField.HasCField MyStruct "myStruct_x" where
+
+  type CFieldType MyStruct "myStruct_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 7:25@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+newtype A = A
+  { unwrapA :: MyStruct
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ MyStruct) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ MyStruct) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyStruct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 8:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 21:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example/FunPtr.hs
@@ -0,0 +1,186 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/struct.h>"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2020929269c10652 (void)) ("
+  , "  struct MyStruct arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3fbd7681308a7575 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_118f9a485493ca2d (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dbe89d4787aae78a (void)) ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf5702eef5ab2ac4 (void)) ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dc10cdc4b07670d1 (void)) ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (BG.FunPtr (MyStruct -> IO ()))
+hs_bindgen_2020929269c10652 =
+  fmap BG.fromFFIType hs_bindgen_2020929269c10652_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+foo :: BG.FunPtr (MyStruct -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_2020929269c10652
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_3fbd7681308a7575 =
+  fmap BG.fromFFIType hs_bindgen_3fbd7681308a7575_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooA :: BG.FunPtr (A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_3fbd7681308a7575
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_118f9a485493ca2d =
+  fmap BG.fromFFIType hs_bindgen_118f9a485493ca2d_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooB :: BG.FunPtr (B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_118f9a485493ca2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (BG.FunPtr (M.C -> IO ()))
+hs_bindgen_dbe89d4787aae78a =
+  fmap BG.fromFFIType hs_bindgen_dbe89d4787aae78a_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooC :: BG.FunPtr (M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_dbe89d4787aae78a
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (BG.FunPtr (M.D -> IO ()))
+hs_bindgen_cf5702eef5ab2ac4 =
+  fmap BG.fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooD :: BG.FunPtr (M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (BG.FunPtr (E -> IO ()))
+hs_bindgen_dc10cdc4b07670d1 =
+  fmap BG.fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooE :: BG.FunPtr (E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example/Safe.hs
@@ -0,0 +1,222 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/struct.h>"
+  , "void hs_bindgen_99bb90e6d7637d2c ("
+  , "  struct MyStruct *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(*arg1);"
+  , "}"
+  , "void hs_bindgen_392e3092a2681c13 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(*arg1);"
+  , "}"
+  , "void hs_bindgen_6011faf8531be4fa ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(*arg1);"
+  , "}"
+  , "void hs_bindgen_40a50b8e6ac3b09d ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(*arg1);"
+  , "}"
+  , "void hs_bindgen_32b4f35bf27a4bf8 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(*arg1);"
+  , "}"
+  , "void hs_bindgen_6e59183c0a861d01 ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c ::
+     BG.Ptr MyStruct
+  -> IO ()
+hs_bindgen_99bb90e6d7637d2c =
+  \x0 ->
+    hs_bindgen_99bb90e6d7637d2c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+foo ::
+     MyStruct
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_99bb90e6d7637d2c x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 ::
+     BG.Ptr A
+  -> IO ()
+hs_bindgen_392e3092a2681c13 =
+  \x0 ->
+    hs_bindgen_392e3092a2681c13_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_392e3092a2681c13 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa ::
+     BG.Ptr B
+  -> IO ()
+hs_bindgen_6011faf8531be4fa =
+  \x0 ->
+    hs_bindgen_6011faf8531be4fa_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_6011faf8531be4fa x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d ::
+     BG.Ptr M.C
+  -> IO ()
+hs_bindgen_40a50b8e6ac3b09d =
+  \x0 ->
+    hs_bindgen_40a50b8e6ac3b09d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_40a50b8e6ac3b09d x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 ::
+     BG.Ptr M.D
+  -> IO ()
+hs_bindgen_32b4f35bf27a4bf8 =
+  \x0 ->
+    hs_bindgen_32b4f35bf27a4bf8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_32b4f35bf27a4bf8 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 ::
+     BG.Ptr E
+  -> IO ()
+hs_bindgen_6e59183c0a861d01 =
+  \x0 ->
+    hs_bindgen_6e59183c0a861d01_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_6e59183c0a861d01 x1)
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/Example/Unsafe.hs
@@ -0,0 +1,222 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/struct.h>"
+  , "void hs_bindgen_51195acecf6b880e ("
+  , "  struct MyStruct *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(*arg1);"
+  , "}"
+  , "void hs_bindgen_eb4a794c10ca94f9 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(*arg1);"
+  , "}"
+  , "void hs_bindgen_a11eb4471a953b64 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(*arg1);"
+  , "}"
+  , "void hs_bindgen_1dea92b3f3346311 ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(*arg1);"
+  , "}"
+  , "void hs_bindgen_dba6d56e1a316e2d ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(*arg1);"
+  , "}"
+  , "void hs_bindgen_23b6f403a534aeae ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e ::
+     BG.Ptr MyStruct
+  -> IO ()
+hs_bindgen_51195acecf6b880e =
+  \x0 ->
+    hs_bindgen_51195acecf6b880e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+foo ::
+     MyStruct
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_51195acecf6b880e x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 ::
+     BG.Ptr A
+  -> IO ()
+hs_bindgen_eb4a794c10ca94f9 =
+  \x0 ->
+    hs_bindgen_eb4a794c10ca94f9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_eb4a794c10ca94f9 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 ::
+     BG.Ptr B
+  -> IO ()
+hs_bindgen_a11eb4471a953b64 =
+  \x0 ->
+    hs_bindgen_a11eb4471a953b64_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_a11eb4471a953b64 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 ::
+     BG.Ptr M.C
+  -> IO ()
+hs_bindgen_1dea92b3f3346311 =
+  \x0 ->
+    hs_bindgen_1dea92b3f3346311_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_1dea92b3f3346311 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d ::
+     BG.Ptr M.D
+  -> IO ()
+hs_bindgen_dba6d56e1a316e2d =
+  \x0 ->
+    hs_bindgen_dba6d56e1a316e2d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_dba6d56e1a316e2d x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae ::
+     BG.Ptr E
+  -> IO ()
+hs_bindgen_23b6f403a534aeae =
+  \x0 ->
+    hs_bindgen_23b6f403a534aeae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_23b6f403a534aeae x1)
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/bindingspec.yaml
@@ -0,0 +1,85 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/typedef/struct.h
+  cname: struct MyStruct
+  hsname: MyStruct
+- headers: binding-specs/fun_arg/typedef/struct.h
+  cname: A
+  hsname: A
+- headers: binding-specs/fun_arg/typedef/struct.h
+  cname: B
+  hsname: B
+- headers: binding-specs/fun_arg/typedef/struct.h
+  cname: E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyStruct
+  representation:
+    record:
+      constructor: MyStruct
+      fields:
+      - myStruct_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/struct/th.txt
@@ -0,0 +1,603 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/typedef/struct.h
+-- #include <binding-specs/fun_arg/typedef/struct.h>
+-- void hs_bindgen_99bb90e6d7637d2c (
+--   struct MyStruct *arg1
+-- )
+-- {
+--   (foo)(*arg1);
+-- }
+-- void hs_bindgen_392e3092a2681c13 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(*arg1);
+-- }
+-- void hs_bindgen_6011faf8531be4fa (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(*arg1);
+-- }
+-- void hs_bindgen_40a50b8e6ac3b09d (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(*arg1);
+-- }
+-- void hs_bindgen_32b4f35bf27a4bf8 (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(*arg1);
+-- }
+-- void hs_bindgen_6e59183c0a861d01 (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(*arg1);
+-- }
+-- void hs_bindgen_51195acecf6b880e (
+--   struct MyStruct *arg1
+-- )
+-- {
+--   (foo)(*arg1);
+-- }
+-- void hs_bindgen_eb4a794c10ca94f9 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(*arg1);
+-- }
+-- void hs_bindgen_a11eb4471a953b64 (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(*arg1);
+-- }
+-- void hs_bindgen_1dea92b3f3346311 (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(*arg1);
+-- }
+-- void hs_bindgen_dba6d56e1a316e2d (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(*arg1);
+-- }
+-- void hs_bindgen_23b6f403a534aeae (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(*arg1);
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2020929269c10652 (void)) (
+--   struct MyStruct arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3fbd7681308a7575 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_118f9a485493ca2d (void)) (
+--   B arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dbe89d4787aae78a (void)) (
+--   C arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf5702eef5ab2ac4 (void)) (
+--   D arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dc10cdc4b07670d1 (void)) (
+--   E arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @struct MyStruct@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 4:8@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+data MyStruct
+    = MyStruct {myStruct_x :: CInt
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 4:23@
+
+                     __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize MyStruct
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw MyStruct
+    where readRaw = \ptr_0 -> pure MyStruct <*> readRaw (Proxy @"myStruct_x") ptr_0
+instance WriteRaw MyStruct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MyStruct myStruct_x_2 -> writeRaw (Proxy @"myStruct_x") ptr_0 myStruct_x_2
+deriving via (EquivStorable MyStruct) instance Storable MyStruct
+deriving via (IsStructViaReadRaw MyStruct) instance IsStruct MyStruct
+instance (~) ty CInt => HasField "myStruct_x" MyStruct ty
+    where hasField = \x_0 -> (\y_1 -> MyStruct{myStruct_x = y_1},
+                              getField @"myStruct_x" x_0)
+instance (~) ty CInt =>
+         HasField "myStruct_x" (Ptr MyStruct) (Ptr ty)
+    where getField = fromPtr (Proxy @"myStruct_x")
+instance HasCField MyStruct "myStruct_x"
+    where type CFieldType MyStruct "myStruct_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 7:25@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+newtype A
+    = A {unwrapA :: MyStruct}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty MyStruct => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyStruct => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyStruct
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 8:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 21:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c :: Ptr MyStruct -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c = \x_0 -> hs_bindgen_99bb90e6d7637d2c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+foo_safe :: MyStruct -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+foo_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_99bb90e6d7637d2c x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 :: Ptr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 = \x_0 -> hs_bindgen_392e3092a2681c13_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooA_safe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooA_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_392e3092a2681c13 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa :: Ptr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa = \x_0 -> hs_bindgen_6011faf8531be4fa_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooB_safe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooB_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_6011faf8531be4fa x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d :: Ptr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d = \x_0 -> hs_bindgen_40a50b8e6ac3b09d_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooC_safe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooC_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_40a50b8e6ac3b09d x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 :: Ptr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 = \x_0 -> hs_bindgen_32b4f35bf27a4bf8_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooD_safe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooD_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_32b4f35bf27a4bf8 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 :: Ptr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 = \x_0 -> hs_bindgen_6e59183c0a861d01_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooE_safe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooE_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_6e59183c0a861d01 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e :: Ptr MyStruct -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e = \x_0 -> hs_bindgen_51195acecf6b880e_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+foo_unsafe :: MyStruct -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+foo_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_51195acecf6b880e x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 :: Ptr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 = \x_0 -> hs_bindgen_eb4a794c10ca94f9_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooA_unsafe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooA_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_eb4a794c10ca94f9 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 :: Ptr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 = \x_0 -> hs_bindgen_a11eb4471a953b64_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooB_unsafe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooB_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_a11eb4471a953b64 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 :: Ptr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 = \x_0 -> hs_bindgen_1dea92b3f3346311_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooC_unsafe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooC_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_1dea92b3f3346311 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d :: Ptr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d = \x_0 -> hs_bindgen_dba6d56e1a316e2d_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooD_unsafe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooD_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_dba6d56e1a316e2d x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae :: Ptr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae = \x_0 -> hs_bindgen_23b6f403a534aeae_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooE_unsafe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooE_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_23b6f403a534aeae x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (FunPtr (MyStruct -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 = fmap fromFFIType hs_bindgen_2020929269c10652_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+foo_funptr :: FunPtr (MyStruct -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_2020929269c10652
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 = fmap fromFFIType hs_bindgen_3fbd7681308a7575_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooA_funptr :: FunPtr (A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_3fbd7681308a7575
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (FunPtr (B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d = fmap fromFFIType hs_bindgen_118f9a485493ca2d_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooB_funptr :: FunPtr (B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_118f9a485493ca2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (FunPtr (M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a = fmap fromFFIType hs_bindgen_dbe89d4787aae78a_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooC_funptr :: FunPtr (M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_dbe89d4787aae78a
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (FunPtr (M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 = fmap fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooD_funptr :: FunPtr (M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (FunPtr (E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 = fmap fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooE_funptr :: FunPtr (E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/struct.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/struct.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example.hs
@@ -0,0 +1,180 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyUnion(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.E(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import qualified M
+import Prelude (type (~))
+
+{-| __C declaration:__ @union MyUnion@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 4:7@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+newtype MyUnion = MyUnion
+  { unwrapMyUnion :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize MyUnion
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw MyUnion
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw MyUnion
+
+deriving via Marshal.EquivStorable MyUnion instance BG.Storable MyUnion
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion MyUnion
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 4:21@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "myUnion_x" MyUnion ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 4:21@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "myUnion_x" MyUnion ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"myUnion_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "myUnion_x" (BG.Ptr MyUnion) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"myUnion_x")
+
+instance HasCField.HasCField MyUnion "myUnion_x" where
+
+  type CFieldType MyUnion "myUnion_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 7:23@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+newtype A = A
+  { unwrapA :: MyUnion
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ MyUnion) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ MyUnion) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = MyUnion
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 8:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+newtype B = B
+  { unwrapB :: A
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 21:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+newtype E = E
+  { unwrapE :: M.C
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.C) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ M.C) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = M.C
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example/FunPtr.hs
@@ -0,0 +1,186 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.fooA
+    , Example.FunPtr.fooB
+    , Example.FunPtr.fooC
+    , Example.FunPtr.fooD
+    , Example.FunPtr.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/union.h>"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2020929269c10652 (void)) ("
+  , "  union MyUnion arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooA */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3fbd7681308a7575 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &fooA;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooB */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_118f9a485493ca2d (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &fooB;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooC */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dbe89d4787aae78a (void)) ("
+  , "  C arg1"
+  , ")"
+  , "{"
+  , "  return &fooC;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooD */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf5702eef5ab2ac4 (void)) ("
+  , "  D arg1"
+  , ")"
+  , "{"
+  , "  return &fooD;"
+  , "}"
+  , "/* test_bindingspecsfun_argtypedef_Example_get_fooE */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dc10cdc4b07670d1 (void)) ("
+  , "  E arg1"
+  , ")"
+  , "{"
+  , "  return &fooE;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (BG.FunPtr (MyUnion -> IO ()))
+hs_bindgen_2020929269c10652 =
+  fmap BG.fromFFIType hs_bindgen_2020929269c10652_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+foo :: BG.FunPtr (MyUnion -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_2020929269c10652
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_3fbd7681308a7575 =
+  fmap BG.fromFFIType hs_bindgen_3fbd7681308a7575_base
+
+{-# NOINLINE fooA #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooA :: BG.FunPtr (A -> IO ())
+fooA = BG.unsafePerformIO hs_bindgen_3fbd7681308a7575
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_118f9a485493ca2d =
+  fmap BG.fromFFIType hs_bindgen_118f9a485493ca2d_base
+
+{-# NOINLINE fooB #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooB :: BG.FunPtr (B -> IO ())
+fooB = BG.unsafePerformIO hs_bindgen_118f9a485493ca2d
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (BG.FunPtr (M.C -> IO ()))
+hs_bindgen_dbe89d4787aae78a =
+  fmap BG.fromFFIType hs_bindgen_dbe89d4787aae78a_base
+
+{-# NOINLINE fooC #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooC :: BG.FunPtr (M.C -> IO ())
+fooC = BG.unsafePerformIO hs_bindgen_dbe89d4787aae78a
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (BG.FunPtr (M.D -> IO ()))
+hs_bindgen_cf5702eef5ab2ac4 =
+  fmap BG.fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+
+{-# NOINLINE fooD #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooD :: BG.FunPtr (M.D -> IO ())
+fooD = BG.unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (BG.FunPtr (E -> IO ()))
+hs_bindgen_dc10cdc4b07670d1 =
+  fmap BG.fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+
+{-# NOINLINE fooE #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooE :: BG.FunPtr (E -> IO ())
+fooE = BG.unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example/Safe.hs
@@ -0,0 +1,222 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.fooA
+    , Example.Safe.fooB
+    , Example.Safe.fooC
+    , Example.Safe.fooD
+    , Example.Safe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/union.h>"
+  , "void hs_bindgen_99bb90e6d7637d2c ("
+  , "  union MyUnion *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(*arg1);"
+  , "}"
+  , "void hs_bindgen_392e3092a2681c13 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(*arg1);"
+  , "}"
+  , "void hs_bindgen_6011faf8531be4fa ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(*arg1);"
+  , "}"
+  , "void hs_bindgen_40a50b8e6ac3b09d ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(*arg1);"
+  , "}"
+  , "void hs_bindgen_32b4f35bf27a4bf8 ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(*arg1);"
+  , "}"
+  , "void hs_bindgen_6e59183c0a861d01 ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c ::
+     BG.Ptr MyUnion
+  -> IO ()
+hs_bindgen_99bb90e6d7637d2c =
+  \x0 ->
+    hs_bindgen_99bb90e6d7637d2c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+foo ::
+     MyUnion
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_99bb90e6d7637d2c x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 ::
+     BG.Ptr A
+  -> IO ()
+hs_bindgen_392e3092a2681c13 =
+  \x0 ->
+    hs_bindgen_392e3092a2681c13_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_392e3092a2681c13 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa ::
+     BG.Ptr B
+  -> IO ()
+hs_bindgen_6011faf8531be4fa =
+  \x0 ->
+    hs_bindgen_6011faf8531be4fa_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_6011faf8531be4fa x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d ::
+     BG.Ptr M.C
+  -> IO ()
+hs_bindgen_40a50b8e6ac3b09d =
+  \x0 ->
+    hs_bindgen_40a50b8e6ac3b09d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_40a50b8e6ac3b09d x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 ::
+     BG.Ptr M.D
+  -> IO ()
+hs_bindgen_32b4f35bf27a4bf8 =
+  \x0 ->
+    hs_bindgen_32b4f35bf27a4bf8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_32b4f35bf27a4bf8 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 ::
+     BG.Ptr E
+  -> IO ()
+hs_bindgen_6e59183c0a861d01 =
+  \x0 ->
+    hs_bindgen_6e59183c0a861d01_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_6e59183c0a861d01 x1)
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/Example/Unsafe.hs
@@ -0,0 +1,222 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.fooA
+    , Example.Unsafe.fooB
+    , Example.Unsafe.fooC
+    , Example.Unsafe.fooD
+    , Example.Unsafe.fooE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/fun_arg/typedef/union.h>"
+  , "void hs_bindgen_51195acecf6b880e ("
+  , "  union MyUnion *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(*arg1);"
+  , "}"
+  , "void hs_bindgen_eb4a794c10ca94f9 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (fooA)(*arg1);"
+  , "}"
+  , "void hs_bindgen_a11eb4471a953b64 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (fooB)(*arg1);"
+  , "}"
+  , "void hs_bindgen_1dea92b3f3346311 ("
+  , "  C *arg1"
+  , ")"
+  , "{"
+  , "  (fooC)(*arg1);"
+  , "}"
+  , "void hs_bindgen_dba6d56e1a316e2d ("
+  , "  D *arg1"
+  , ")"
+  , "{"
+  , "  (fooD)(*arg1);"
+  , "}"
+  , "void hs_bindgen_23b6f403a534aeae ("
+  , "  E *arg1"
+  , ")"
+  , "{"
+  , "  (fooE)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e ::
+     BG.Ptr MyUnion
+  -> IO ()
+hs_bindgen_51195acecf6b880e =
+  \x0 ->
+    hs_bindgen_51195acecf6b880e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+foo ::
+     MyUnion
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_51195acecf6b880e x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 ::
+     BG.Ptr A
+  -> IO ()
+hs_bindgen_eb4a794c10ca94f9 =
+  \x0 ->
+    hs_bindgen_eb4a794c10ca94f9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooA ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooA =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_eb4a794c10ca94f9 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 ::
+     BG.Ptr B
+  -> IO ()
+hs_bindgen_a11eb4471a953b64 =
+  \x0 ->
+    hs_bindgen_a11eb4471a953b64_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooB ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooB =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_a11eb4471a953b64 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 ::
+     BG.Ptr M.C
+  -> IO ()
+hs_bindgen_1dea92b3f3346311 =
+  \x0 ->
+    hs_bindgen_1dea92b3f3346311_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooC ::
+     M.C
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooC =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_1dea92b3f3346311 x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d ::
+     BG.Ptr M.D
+  -> IO ()
+hs_bindgen_dba6d56e1a316e2d =
+  \x0 ->
+    hs_bindgen_dba6d56e1a316e2d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooD ::
+     M.D
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooD =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_dba6d56e1a316e2d x1)
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae ::
+     BG.Ptr E
+  -> IO ()
+hs_bindgen_23b6f403a534aeae =
+  \x0 ->
+    hs_bindgen_23b6f403a534aeae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooE ::
+     E
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+fooE =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_23b6f403a534aeae x1)
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/bindingspec.yaml
@@ -0,0 +1,79 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/fun_arg/typedef/union.h
+  cname: union MyUnion
+  hsname: MyUnion
+- headers: binding-specs/fun_arg/typedef/union.h
+  cname: A
+  hsname: A
+- headers: binding-specs/fun_arg/typedef/union.h
+  cname: B
+  hsname: B
+- headers: binding-specs/fun_arg/typedef/union.h
+  cname: E
+  hsname: E
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: MyUnion
+  representation:
+    newtype:
+      constructor: MyUnion
+      fields:
+      - unwrapMyUnion
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/th.txt b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/fun_arg/typedef/union/th.txt
@@ -0,0 +1,593 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/fun_arg/typedef/union.h
+-- #include <binding-specs/fun_arg/typedef/union.h>
+-- void hs_bindgen_99bb90e6d7637d2c (
+--   union MyUnion *arg1
+-- )
+-- {
+--   (foo)(*arg1);
+-- }
+-- void hs_bindgen_392e3092a2681c13 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(*arg1);
+-- }
+-- void hs_bindgen_6011faf8531be4fa (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(*arg1);
+-- }
+-- void hs_bindgen_40a50b8e6ac3b09d (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(*arg1);
+-- }
+-- void hs_bindgen_32b4f35bf27a4bf8 (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(*arg1);
+-- }
+-- void hs_bindgen_6e59183c0a861d01 (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(*arg1);
+-- }
+-- void hs_bindgen_51195acecf6b880e (
+--   union MyUnion *arg1
+-- )
+-- {
+--   (foo)(*arg1);
+-- }
+-- void hs_bindgen_eb4a794c10ca94f9 (
+--   A *arg1
+-- )
+-- {
+--   (fooA)(*arg1);
+-- }
+-- void hs_bindgen_a11eb4471a953b64 (
+--   B *arg1
+-- )
+-- {
+--   (fooB)(*arg1);
+-- }
+-- void hs_bindgen_1dea92b3f3346311 (
+--   C *arg1
+-- )
+-- {
+--   (fooC)(*arg1);
+-- }
+-- void hs_bindgen_dba6d56e1a316e2d (
+--   D *arg1
+-- )
+-- {
+--   (fooD)(*arg1);
+-- }
+-- void hs_bindgen_23b6f403a534aeae (
+--   E *arg1
+-- )
+-- {
+--   (fooE)(*arg1);
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2020929269c10652 (void)) (
+--   union MyUnion arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooA */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3fbd7681308a7575 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &fooA;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooB */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_118f9a485493ca2d (void)) (
+--   B arg1
+-- )
+-- {
+--   return &fooB;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooC */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dbe89d4787aae78a (void)) (
+--   C arg1
+-- )
+-- {
+--   return &fooC;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooD */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf5702eef5ab2ac4 (void)) (
+--   D arg1
+-- )
+-- {
+--   return &fooD;
+-- }
+-- /* test_bindingspecsfun_argtypedef_Example_get_fooE */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dc10cdc4b07670d1 (void)) (
+--   E arg1
+-- )
+-- {
+--   return &fooE;
+-- }
+{-| __C declaration:__ @union MyUnion@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 4:7@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+newtype MyUnion
+    = MyUnion {unwrapMyUnion :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize MyUnion
+deriving via (SizedByteArray 4 4) instance ReadRaw MyUnion
+deriving via (SizedByteArray 4 4) instance WriteRaw MyUnion
+deriving via (EquivStorable MyUnion) instance Storable MyUnion
+deriving via (SizedByteArray 4 4) instance IsUnion MyUnion
+instance (~) ty CInt => HasField "myUnion_x" MyUnion ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "myUnion_x" MyUnion ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"myUnion_x" x_0)
+instance (~) ty CInt => HasField "myUnion_x" (Ptr MyUnion) (Ptr ty)
+    where getField = fromPtr (Proxy @"myUnion_x")
+instance HasCField MyUnion "myUnion_x"
+    where type CFieldType MyUnion "myUnion_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @A@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 7:23@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+newtype A
+    = A {unwrapA :: MyUnion}
+    deriving stock Generic
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty MyUnion => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty MyUnion => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = MyUnion
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @B@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 8:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+newtype B
+    = B {unwrapB :: A}
+    deriving stock Generic
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @E@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 21:11@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+newtype E = E {unwrapE :: M.C} deriving stock Generic
+instance (~) ty M.C => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty M.C => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = M.C
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_99bb90e6d7637d2c" hs_bindgen_99bb90e6d7637d2c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c :: Ptr MyUnion -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_foo@
+hs_bindgen_99bb90e6d7637d2c = \x_0 -> hs_bindgen_99bb90e6d7637d2c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+foo_safe :: MyUnion -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+foo_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_99bb90e6d7637d2c x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+foreign import ccall safe "hs_bindgen_392e3092a2681c13" hs_bindgen_392e3092a2681c13_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 :: Ptr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooA@
+hs_bindgen_392e3092a2681c13 = \x_0 -> hs_bindgen_392e3092a2681c13_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooA_safe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooA_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_392e3092a2681c13 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+foreign import ccall safe "hs_bindgen_6011faf8531be4fa" hs_bindgen_6011faf8531be4fa_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa :: Ptr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooB@
+hs_bindgen_6011faf8531be4fa = \x_0 -> hs_bindgen_6011faf8531be4fa_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooB_safe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooB_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_6011faf8531be4fa x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+foreign import ccall safe "hs_bindgen_40a50b8e6ac3b09d" hs_bindgen_40a50b8e6ac3b09d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d :: Ptr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooC@
+hs_bindgen_40a50b8e6ac3b09d = \x_0 -> hs_bindgen_40a50b8e6ac3b09d_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooC_safe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooC_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_40a50b8e6ac3b09d x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+foreign import ccall safe "hs_bindgen_32b4f35bf27a4bf8" hs_bindgen_32b4f35bf27a4bf8_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 :: Ptr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooD@
+hs_bindgen_32b4f35bf27a4bf8 = \x_0 -> hs_bindgen_32b4f35bf27a4bf8_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooD_safe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooD_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_32b4f35bf27a4bf8 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+foreign import ccall safe "hs_bindgen_6e59183c0a861d01" hs_bindgen_6e59183c0a861d01_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 :: Ptr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Safe_fooE@
+hs_bindgen_6e59183c0a861d01 = \x_0 -> hs_bindgen_6e59183c0a861d01_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooE_safe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooE_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_6e59183c0a861d01 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_51195acecf6b880e" hs_bindgen_51195acecf6b880e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e :: Ptr MyUnion -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_foo@
+hs_bindgen_51195acecf6b880e = \x_0 -> hs_bindgen_51195acecf6b880e_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+foo_unsafe :: MyUnion -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+foo_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_51195acecf6b880e x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+foreign import ccall unsafe "hs_bindgen_eb4a794c10ca94f9" hs_bindgen_eb4a794c10ca94f9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 :: Ptr A -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooA@
+hs_bindgen_eb4a794c10ca94f9 = \x_0 -> hs_bindgen_eb4a794c10ca94f9_base (toFFIType x_0)
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooA_unsafe :: A -> IO ()
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooA_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_eb4a794c10ca94f9 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+foreign import ccall unsafe "hs_bindgen_a11eb4471a953b64" hs_bindgen_a11eb4471a953b64_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 :: Ptr B -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooB@
+hs_bindgen_a11eb4471a953b64 = \x_0 -> hs_bindgen_a11eb4471a953b64_base (toFFIType x_0)
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooB_unsafe :: B -> IO ()
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooB_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_a11eb4471a953b64 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+foreign import ccall unsafe "hs_bindgen_1dea92b3f3346311" hs_bindgen_1dea92b3f3346311_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 :: Ptr M.C -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooC@
+hs_bindgen_1dea92b3f3346311 = \x_0 -> hs_bindgen_1dea92b3f3346311_base (toFFIType x_0)
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooC_unsafe :: M.C -> IO ()
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooC_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_1dea92b3f3346311 x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+foreign import ccall unsafe "hs_bindgen_dba6d56e1a316e2d" hs_bindgen_dba6d56e1a316e2d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d :: Ptr M.D -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooD@
+hs_bindgen_dba6d56e1a316e2d = \x_0 -> hs_bindgen_dba6d56e1a316e2d_base (toFFIType x_0)
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooD_unsafe :: M.D -> IO ()
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooD_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_dba6d56e1a316e2d x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+foreign import ccall unsafe "hs_bindgen_23b6f403a534aeae" hs_bindgen_23b6f403a534aeae_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae :: Ptr E -> IO ()
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_Unsafe_fooE@
+hs_bindgen_23b6f403a534aeae = \x_0 -> hs_bindgen_23b6f403a534aeae_base (toFFIType x_0)
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooE_unsafe :: E -> IO ()
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooE_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_23b6f403a534aeae x_1)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_2020929269c10652" hs_bindgen_2020929269c10652_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 :: IO (FunPtr (MyUnion -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_foo@
+hs_bindgen_2020929269c10652 = fmap fromFFIType hs_bindgen_2020929269c10652_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+foo_funptr :: FunPtr (MyUnion -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 5:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_2020929269c10652
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+foreign import ccall unsafe "hs_bindgen_3fbd7681308a7575" hs_bindgen_3fbd7681308a7575_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooA@
+hs_bindgen_3fbd7681308a7575 = fmap fromFFIType hs_bindgen_3fbd7681308a7575_base
+{-# NOINLINE fooA_funptr #-}
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooA_funptr :: FunPtr (A -> IO ())
+{-| __C declaration:__ @fooA@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 10:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooA_funptr = unsafePerformIO hs_bindgen_3fbd7681308a7575
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+foreign import ccall unsafe "hs_bindgen_118f9a485493ca2d" hs_bindgen_118f9a485493ca2d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d :: IO (FunPtr (B -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooB@
+hs_bindgen_118f9a485493ca2d = fmap fromFFIType hs_bindgen_118f9a485493ca2d_base
+{-# NOINLINE fooB_funptr #-}
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooB_funptr :: FunPtr (B -> IO ())
+{-| __C declaration:__ @fooB@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 11:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooB_funptr = unsafePerformIO hs_bindgen_118f9a485493ca2d
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+foreign import ccall unsafe "hs_bindgen_dbe89d4787aae78a" hs_bindgen_dbe89d4787aae78a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a :: IO (FunPtr (M.C -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooC@
+hs_bindgen_dbe89d4787aae78a = fmap fromFFIType hs_bindgen_dbe89d4787aae78a_base
+{-# NOINLINE fooC_funptr #-}
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooC_funptr :: FunPtr (M.C -> IO ())
+{-| __C declaration:__ @fooC@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 23:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooC_funptr = unsafePerformIO hs_bindgen_dbe89d4787aae78a
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+foreign import ccall unsafe "hs_bindgen_cf5702eef5ab2ac4" hs_bindgen_cf5702eef5ab2ac4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 :: IO (FunPtr (M.D -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooD@
+hs_bindgen_cf5702eef5ab2ac4 = fmap fromFFIType hs_bindgen_cf5702eef5ab2ac4_base
+{-# NOINLINE fooD_funptr #-}
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooD_funptr :: FunPtr (M.D -> IO ())
+{-| __C declaration:__ @fooD@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 24:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooD_funptr = unsafePerformIO hs_bindgen_cf5702eef5ab2ac4
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+foreign import ccall unsafe "hs_bindgen_dc10cdc4b07670d1" hs_bindgen_dc10cdc4b07670d1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 :: IO (FunPtr (E -> IO ()))
+-- __unique:__ @test_bindingspecsfun_argtypedef_Example_get_fooE@
+hs_bindgen_dc10cdc4b07670d1 = fmap fromFFIType hs_bindgen_dc10cdc4b07670d1_base
+{-# NOINLINE fooE_funptr #-}
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooE_funptr :: FunPtr (E -> IO ())
+{-| __C declaration:__ @fooE@
+
+    __defined at:__ @binding-specs\/fun_arg\/typedef\/union.h 25:6@
+
+    __exported by:__ @binding-specs\/fun_arg\/typedef\/union.h@
+-}
+fooE_funptr = unsafePerformIO hs_bindgen_dc10cdc4b07670d1
diff --git a/test-artefacts/fixtures/binding-specs/name/squash_both/Example.hs b/test-artefacts/fixtures/binding-specs/name/squash_both/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/squash_both/Example.hs
@@ -0,0 +1,128 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Hoge(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @binding-specs\/name\/squash_both.h 1:16@
+
+    __exported by:__ @binding-specs\/name\/squash_both.h@
+-}
+data Hoge = Hoge
+  { hoge_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @binding-specs\/name\/squash_both.h 1:26@
+
+         __exported by:__ @binding-specs\/name\/squash_both.h@
+    -}
+  , hoge_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @binding-specs\/name\/squash_both.h 1:29@
+
+         __exported by:__ @binding-specs\/name\/squash_both.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Hoge where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Hoge where
+
+  readRaw =
+    \ptr0 ->
+          pure Hoge
+      <*> HasCField.readRaw (BG.Proxy @"hoge_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"hoge_y") ptr0
+
+instance Marshal.WriteRaw Hoge where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Hoge hoge_x2 hoge_y3 ->
+               HasCField.writeRaw (BG.Proxy @"hoge_x") ptr0 hoge_x2
+            >> HasCField.writeRaw (BG.Proxy @"hoge_y") ptr0 hoge_y3
+
+deriving via Marshal.EquivStorable Hoge instance BG.Storable Hoge
+
+deriving via Struct.IsStructViaReadRaw Hoge instance Struct.IsStruct Hoge
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/name\/squash_both.h 1:26@
+
+    __exported by:__ @binding-specs\/name\/squash_both.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "hoge_x" Hoge ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Hoge {hoge_x = y1, hoge_y = BG.getField @"hoge_y" x0}
+      , BG.getField @"hoge_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "hoge_x" (BG.Ptr Hoge) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"hoge_x")
+
+instance HasCField.HasCField Hoge "hoge_x" where
+
+  type CFieldType Hoge "hoge_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @binding-specs\/name\/squash_both.h 1:29@
+
+    __exported by:__ @binding-specs\/name\/squash_both.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "hoge_y" Hoge ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Hoge {hoge_y = y1, hoge_x = BG.getField @"hoge_x" x0}
+      , BG.getField @"hoge_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "hoge_y" (BG.Ptr Hoge) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"hoge_y")
+
+instance HasCField.HasCField Hoge "hoge_y" where
+
+  type CFieldType Hoge "hoge_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/binding-specs/name/squash_both/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/name/squash_both/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/squash_both/bindingspec.yaml
@@ -0,0 +1,32 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/name/squash_both.h
+  cname: struct foo
+  hsname: Hoge
+- headers: binding-specs/name/squash_both.h
+  cname: bar
+  hsname: Hoge
+hstypes:
+- hsname: Hoge
+  representation:
+    record:
+      constructor: Hoge
+      fields:
+      - hoge_x
+      - hoge_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/name/squash_both/th.txt b/test-artefacts/fixtures/binding-specs/name/squash_both/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/squash_both/th.txt
@@ -0,0 +1,52 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/name/squash_both.h
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @binding-specs\/name\/squash_both.h 1:16@
+
+    __exported by:__ @binding-specs\/name\/squash_both.h@
+-}
+data Hoge
+    = Hoge {hoge_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @binding-specs\/name\/squash_both.h 1:26@
+
+                 __exported by:__ @binding-specs\/name\/squash_both.h@
+            -},
+            hoge_y :: CInt
+            {- ^ __C declaration:__ @y@
+
+                 __defined at:__ @binding-specs\/name\/squash_both.h 1:29@
+
+                 __exported by:__ @binding-specs\/name\/squash_both.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Hoge
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Hoge
+    where readRaw = \ptr_0 -> (pure Hoge <*> readRaw (Proxy @"hoge_x") ptr_0) <*> readRaw (Proxy @"hoge_y") ptr_0
+instance WriteRaw Hoge
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Hoge hoge_x_2
+                                            hoge_y_3 -> writeRaw (Proxy @"hoge_x") ptr_0 hoge_x_2 >> writeRaw (Proxy @"hoge_y") ptr_0 hoge_y_3
+deriving via (EquivStorable Hoge) instance Storable Hoge
+deriving via (IsStructViaReadRaw Hoge) instance IsStruct Hoge
+instance (~) ty CInt => HasField "hoge_x" Hoge ty
+    where hasField = \x_0 -> (\y_1 -> Hoge{hoge_x = y_1,
+                                           hoge_y = getField @"hoge_y" x_0},
+                              getField @"hoge_x" x_0)
+instance (~) ty CInt => HasField "hoge_x" (Ptr Hoge) (Ptr ty)
+    where getField = fromPtr (Proxy @"hoge_x")
+instance HasCField Hoge "hoge_x"
+    where type CFieldType Hoge "hoge_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "hoge_y" Hoge ty
+    where hasField = \x_0 -> (\y_1 -> Hoge{hoge_y = y_1,
+                                           hoge_x = getField @"hoge_x" x_0},
+                              getField @"hoge_y" x_0)
+instance (~) ty CInt => HasField "hoge_y" (Ptr Hoge) (Ptr ty)
+    where getField = fromPtr (Proxy @"hoge_y")
+instance HasCField Hoge "hoge_y"
+    where type CFieldType Hoge "hoge_y" = CInt
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/binding-specs/name/squash_struct/Example.hs b/test-artefacts/fixtures/binding-specs/name/squash_struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/squash_struct/Example.hs
@@ -0,0 +1,128 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Hoge(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @binding-specs\/name\/squash_struct.h 1:16@
+
+    __exported by:__ @binding-specs\/name\/squash_struct.h@
+-}
+data Hoge = Hoge
+  { hoge_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @binding-specs\/name\/squash_struct.h 1:26@
+
+         __exported by:__ @binding-specs\/name\/squash_struct.h@
+    -}
+  , hoge_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @binding-specs\/name\/squash_struct.h 1:29@
+
+         __exported by:__ @binding-specs\/name\/squash_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Hoge where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Hoge where
+
+  readRaw =
+    \ptr0 ->
+          pure Hoge
+      <*> HasCField.readRaw (BG.Proxy @"hoge_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"hoge_y") ptr0
+
+instance Marshal.WriteRaw Hoge where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Hoge hoge_x2 hoge_y3 ->
+               HasCField.writeRaw (BG.Proxy @"hoge_x") ptr0 hoge_x2
+            >> HasCField.writeRaw (BG.Proxy @"hoge_y") ptr0 hoge_y3
+
+deriving via Marshal.EquivStorable Hoge instance BG.Storable Hoge
+
+deriving via Struct.IsStructViaReadRaw Hoge instance Struct.IsStruct Hoge
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/name\/squash_struct.h 1:26@
+
+    __exported by:__ @binding-specs\/name\/squash_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "hoge_x" Hoge ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Hoge {hoge_x = y1, hoge_y = BG.getField @"hoge_y" x0}
+      , BG.getField @"hoge_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "hoge_x" (BG.Ptr Hoge) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"hoge_x")
+
+instance HasCField.HasCField Hoge "hoge_x" where
+
+  type CFieldType Hoge "hoge_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @binding-specs\/name\/squash_struct.h 1:29@
+
+    __exported by:__ @binding-specs\/name\/squash_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "hoge_y" Hoge ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Hoge {hoge_y = y1, hoge_x = BG.getField @"hoge_x" x0}
+      , BG.getField @"hoge_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "hoge_y" (BG.Ptr Hoge) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"hoge_y")
+
+instance HasCField.HasCField Hoge "hoge_y" where
+
+  type CFieldType Hoge "hoge_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/binding-specs/name/squash_struct/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/name/squash_struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/squash_struct/bindingspec.yaml
@@ -0,0 +1,32 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/name/squash_struct.h
+  cname: struct foo
+  hsname: Hoge
+- headers: binding-specs/name/squash_struct.h
+  cname: bar
+  hsname: Hoge
+hstypes:
+- hsname: Hoge
+  representation:
+    record:
+      constructor: Hoge
+      fields:
+      - hoge_x
+      - hoge_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/name/squash_struct/th.txt b/test-artefacts/fixtures/binding-specs/name/squash_struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/squash_struct/th.txt
@@ -0,0 +1,52 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/name/squash_struct.h
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @binding-specs\/name\/squash_struct.h 1:16@
+
+    __exported by:__ @binding-specs\/name\/squash_struct.h@
+-}
+data Hoge
+    = Hoge {hoge_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @binding-specs\/name\/squash_struct.h 1:26@
+
+                 __exported by:__ @binding-specs\/name\/squash_struct.h@
+            -},
+            hoge_y :: CInt
+            {- ^ __C declaration:__ @y@
+
+                 __defined at:__ @binding-specs\/name\/squash_struct.h 1:29@
+
+                 __exported by:__ @binding-specs\/name\/squash_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Hoge
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Hoge
+    where readRaw = \ptr_0 -> (pure Hoge <*> readRaw (Proxy @"hoge_x") ptr_0) <*> readRaw (Proxy @"hoge_y") ptr_0
+instance WriteRaw Hoge
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Hoge hoge_x_2
+                                            hoge_y_3 -> writeRaw (Proxy @"hoge_x") ptr_0 hoge_x_2 >> writeRaw (Proxy @"hoge_y") ptr_0 hoge_y_3
+deriving via (EquivStorable Hoge) instance Storable Hoge
+deriving via (IsStructViaReadRaw Hoge) instance IsStruct Hoge
+instance (~) ty CInt => HasField "hoge_x" Hoge ty
+    where hasField = \x_0 -> (\y_1 -> Hoge{hoge_x = y_1,
+                                           hoge_y = getField @"hoge_y" x_0},
+                              getField @"hoge_x" x_0)
+instance (~) ty CInt => HasField "hoge_x" (Ptr Hoge) (Ptr ty)
+    where getField = fromPtr (Proxy @"hoge_x")
+instance HasCField Hoge "hoge_x"
+    where type CFieldType Hoge "hoge_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "hoge_y" Hoge ty
+    where hasField = \x_0 -> (\y_1 -> Hoge{hoge_y = y_1,
+                                           hoge_x = getField @"hoge_x" x_0},
+                              getField @"hoge_y" x_0)
+instance (~) ty CInt => HasField "hoge_y" (Ptr Hoge) (Ptr ty)
+    where getField = fromPtr (Proxy @"hoge_y")
+instance HasCField Hoge "hoge_y"
+    where type CFieldType Hoge "hoge_y" = CInt
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/binding-specs/name/squash_typedef/Example.hs b/test-artefacts/fixtures/binding-specs/name/squash_typedef/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/squash_typedef/Example.hs
@@ -0,0 +1,128 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Piyo(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @binding-specs\/name\/squash_typedef.h 1:16@
+
+    __exported by:__ @binding-specs\/name\/squash_typedef.h@
+-}
+data Piyo = Piyo
+  { piyo_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @binding-specs\/name\/squash_typedef.h 1:26@
+
+         __exported by:__ @binding-specs\/name\/squash_typedef.h@
+    -}
+  , piyo_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @binding-specs\/name\/squash_typedef.h 1:29@
+
+         __exported by:__ @binding-specs\/name\/squash_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Piyo where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Piyo where
+
+  readRaw =
+    \ptr0 ->
+          pure Piyo
+      <*> HasCField.readRaw (BG.Proxy @"piyo_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"piyo_y") ptr0
+
+instance Marshal.WriteRaw Piyo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Piyo piyo_x2 piyo_y3 ->
+               HasCField.writeRaw (BG.Proxy @"piyo_x") ptr0 piyo_x2
+            >> HasCField.writeRaw (BG.Proxy @"piyo_y") ptr0 piyo_y3
+
+deriving via Marshal.EquivStorable Piyo instance BG.Storable Piyo
+
+deriving via Struct.IsStructViaReadRaw Piyo instance Struct.IsStruct Piyo
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @binding-specs\/name\/squash_typedef.h 1:26@
+
+    __exported by:__ @binding-specs\/name\/squash_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "piyo_x" Piyo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Piyo {piyo_x = y1, piyo_y = BG.getField @"piyo_y" x0}
+      , BG.getField @"piyo_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "piyo_x" (BG.Ptr Piyo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"piyo_x")
+
+instance HasCField.HasCField Piyo "piyo_x" where
+
+  type CFieldType Piyo "piyo_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @binding-specs\/name\/squash_typedef.h 1:29@
+
+    __exported by:__ @binding-specs\/name\/squash_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "piyo_y" Piyo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Piyo {piyo_y = y1, piyo_x = BG.getField @"piyo_x" x0}
+      , BG.getField @"piyo_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "piyo_y" (BG.Ptr Piyo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"piyo_y")
+
+instance HasCField.HasCField Piyo "piyo_y" where
+
+  type CFieldType Piyo "piyo_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/binding-specs/name/squash_typedef/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/name/squash_typedef/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/squash_typedef/bindingspec.yaml
@@ -0,0 +1,32 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/name/squash_typedef.h
+  cname: struct foo
+  hsname: Piyo
+- headers: binding-specs/name/squash_typedef.h
+  cname: bar
+  hsname: Piyo
+hstypes:
+- hsname: Piyo
+  representation:
+    record:
+      constructor: Piyo
+      fields:
+      - piyo_x
+      - piyo_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/name/squash_typedef/th.txt b/test-artefacts/fixtures/binding-specs/name/squash_typedef/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/squash_typedef/th.txt
@@ -0,0 +1,52 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/name/squash_typedef.h
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @binding-specs\/name\/squash_typedef.h 1:16@
+
+    __exported by:__ @binding-specs\/name\/squash_typedef.h@
+-}
+data Piyo
+    = Piyo {piyo_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @binding-specs\/name\/squash_typedef.h 1:26@
+
+                 __exported by:__ @binding-specs\/name\/squash_typedef.h@
+            -},
+            piyo_y :: CInt
+            {- ^ __C declaration:__ @y@
+
+                 __defined at:__ @binding-specs\/name\/squash_typedef.h 1:29@
+
+                 __exported by:__ @binding-specs\/name\/squash_typedef.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Piyo
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Piyo
+    where readRaw = \ptr_0 -> (pure Piyo <*> readRaw (Proxy @"piyo_x") ptr_0) <*> readRaw (Proxy @"piyo_y") ptr_0
+instance WriteRaw Piyo
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Piyo piyo_x_2
+                                            piyo_y_3 -> writeRaw (Proxy @"piyo_x") ptr_0 piyo_x_2 >> writeRaw (Proxy @"piyo_y") ptr_0 piyo_y_3
+deriving via (EquivStorable Piyo) instance Storable Piyo
+deriving via (IsStructViaReadRaw Piyo) instance IsStruct Piyo
+instance (~) ty CInt => HasField "piyo_x" Piyo ty
+    where hasField = \x_0 -> (\y_1 -> Piyo{piyo_x = y_1,
+                                           piyo_y = getField @"piyo_y" x_0},
+                              getField @"piyo_x" x_0)
+instance (~) ty CInt => HasField "piyo_x" (Ptr Piyo) (Ptr ty)
+    where getField = fromPtr (Proxy @"piyo_x")
+instance HasCField Piyo "piyo_x"
+    where type CFieldType Piyo "piyo_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "piyo_y" Piyo ty
+    where hasField = \x_0 -> (\y_1 -> Piyo{piyo_y = y_1,
+                                           piyo_x = getField @"piyo_x" x_0},
+                              getField @"piyo_y" x_0)
+instance (~) ty CInt => HasField "piyo_y" (Ptr Piyo) (Ptr ty)
+    where getField = fromPtr (Proxy @"piyo_y")
+instance HasCField Piyo "piyo_y"
+    where type CFieldType Piyo "piyo_y" = CInt
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/binding-specs/name/type/Example.hs b/test-artefacts/fixtures/binding-specs/name/type/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/type/Example.hs
@@ -0,0 +1,73 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MySym(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @sym@
+
+    __defined at:__ @binding-specs\/name\/type.h 1:14@
+
+    __exported by:__ @binding-specs\/name\/type.h@
+-}
+newtype MySym = MySym
+  { unwrapMySym :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "unwrapMySym" MySym ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MySym {unwrapMySym = y1}, BG.getField @"unwrapMySym" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "unwrapMySym" (BG.Ptr MySym) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMySym")
+
+instance HasCField.HasCField MySym "unwrapMySym" where
+
+  type CFieldType MySym "unwrapMySym" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/name/type/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/name/type/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/type/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/name/type.h
+  cname: sym
+  hsname: MySym
+hstypes:
+- hsname: MySym
+  representation:
+    newtype:
+      constructor: MySym
+      fields:
+      - unwrapMySym
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/name/type/th.txt b/test-artefacts/fixtures/binding-specs/name/type/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/name/type/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/name/type.h
+{-| __C declaration:__ @sym@
+
+    __defined at:__ @binding-specs\/name\/type.h 1:14@
+
+    __exported by:__ @binding-specs\/name\/type.h@
+-}
+newtype MySym
+    = MySym {unwrapMySym :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapMySym" MySym ty
+    where hasField = \x_0 -> (\y_1 -> MySym{unwrapMySym = y_1},
+                              getField @"unwrapMySym" x_0)
+instance (~) ty CChar =>
+         HasField "unwrapMySym" (Ptr MySym) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMySym")
+instance HasCField MySym "unwrapMySym"
+    where type CFieldType MySym "unwrapMySym" = CChar
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/omit_type/Example.hs b/test-artefacts/fixtures/binding-specs/omit_type/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/omit_type/Example.hs
@@ -0,0 +1,71 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Sym(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @sym@
+
+    __defined at:__ @binding-specs\/omit_type.h 1:14@
+
+    __exported by:__ @binding-specs\/omit_type.h@
+-}
+newtype Sym = Sym
+  { unwrapSym :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "unwrapSym" Sym ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Sym {unwrapSym = y1}, BG.getField @"unwrapSym" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "unwrapSym" (BG.Ptr Sym) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapSym")
+
+instance HasCField.HasCField Sym "unwrapSym" where
+
+  type CFieldType Sym "unwrapSym" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/omit_type/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/omit_type/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/omit_type/bindingspec.yaml
@@ -0,0 +1,46 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/omit_type.h
+  cname: sym
+  hsname: Sym
+- omit:
+    headers: binding-specs/omit_type.h
+    cname: struct pt
+hstypes:
+- hsname: Sym
+  representation:
+    newtype:
+      constructor: Sym
+      fields:
+      - unwrapSym
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/omit_type/th.txt b/test-artefacts/fixtures/binding-specs/omit_type/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/omit_type/th.txt
@@ -0,0 +1,33 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/omit_type.h
+{-| __C declaration:__ @sym@
+
+    __defined at:__ @binding-specs\/omit_type.h 1:14@
+
+    __exported by:__ @binding-specs\/omit_type.h@
+-}
+newtype Sym
+    = Sym {unwrapSym :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapSym" Sym ty
+    where hasField = \x_0 -> (\y_1 -> Sym{unwrapSym = y_1},
+                              getField @"unwrapSym" x_0)
+instance (~) ty CChar => HasField "unwrapSym" (Ptr Sym) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSym")
+instance HasCField Sym "unwrapSym"
+    where type CFieldType Sym "unwrapSym" = CChar
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example.hs b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example.hs
@@ -0,0 +1,56 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Widget_legacy_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (type (~))
+
+{-| __C declaration:__ @widget_legacy_t@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 19:25@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+newtype Widget_legacy_t = Widget_legacy_t
+  { unwrapWidget_legacy_t :: M.WidgetT
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ M.WidgetT
+         ) => BG.CompatHasField.HasField "unwrapWidget_legacy_t" Widget_legacy_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Widget_legacy_t {unwrapWidget_legacy_t = y1}
+      , BG.getField @"unwrapWidget_legacy_t" x0
+      )
+
+instance ( ty ~ M.WidgetT
+         ) => BG.HasField "unwrapWidget_legacy_t" (BG.Ptr Widget_legacy_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapWidget_legacy_t")
+
+instance HasCField.HasCField Widget_legacy_t "unwrapWidget_legacy_t" where
+
+  type CFieldType Widget_legacy_t "unwrapWidget_legacy_t" =
+    M.WidgetT
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example/FunPtr.hs
@@ -0,0 +1,46 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.use_widget
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/relative_include/sub/consumer.h>"
+  , "/* test_bindingspecsrelative_include_Example_get_use_widget */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_33ccb2801b32fc12 (void)) ("
+  , "  widget_legacy_t *arg1"
+  , ")"
+  , "{"
+  , "  return &use_widget;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsrelative_include_Example_get_use_widget@
+foreign import ccall unsafe "hs_bindgen_33ccb2801b32fc12" hs_bindgen_33ccb2801b32fc12_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsrelative_include_Example_get_use_widget@
+hs_bindgen_33ccb2801b32fc12 :: IO (BG.FunPtr (BG.Ptr Widget_legacy_t -> IO ()))
+hs_bindgen_33ccb2801b32fc12 =
+  fmap BG.fromFFIType hs_bindgen_33ccb2801b32fc12_base
+
+{-# NOINLINE use_widget #-}
+{-| __C declaration:__ @use_widget@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 21:6@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+use_widget :: BG.FunPtr (BG.Ptr Widget_legacy_t -> IO ())
+use_widget =
+  BG.unsafePerformIO hs_bindgen_33ccb2801b32fc12
diff --git a/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example/Safe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.use_widget
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/relative_include/sub/consumer.h>"
+  , "void hs_bindgen_13e66cb2f49fb393 ("
+  , "  widget_legacy_t *arg1"
+  , ")"
+  , "{"
+  , "  (use_widget)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsrelative_include_Example_Safe_use_widget@
+foreign import ccall safe "hs_bindgen_13e66cb2f49fb393" hs_bindgen_13e66cb2f49fb393_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsrelative_include_Example_Safe_use_widget@
+hs_bindgen_13e66cb2f49fb393 ::
+     BG.Ptr Widget_legacy_t
+  -> IO ()
+hs_bindgen_13e66cb2f49fb393 =
+  \x0 ->
+    hs_bindgen_13e66cb2f49fb393_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @use_widget@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 21:6@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+use_widget ::
+     BG.Ptr Widget_legacy_t
+     -- ^ __C declaration:__ @w@
+  -> IO ()
+use_widget = hs_bindgen_13e66cb2f49fb393
diff --git a/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/Example/Unsafe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.use_widget
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/relative_include/sub/consumer.h>"
+  , "void hs_bindgen_206a5cae524a3fcb ("
+  , "  widget_legacy_t *arg1"
+  , ")"
+  , "{"
+  , "  (use_widget)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsrelative_include_Example_Unsafe_use_widget@
+foreign import ccall unsafe "hs_bindgen_206a5cae524a3fcb" hs_bindgen_206a5cae524a3fcb_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecsrelative_include_Example_Unsafe_use_widget@
+hs_bindgen_206a5cae524a3fcb ::
+     BG.Ptr Widget_legacy_t
+  -> IO ()
+hs_bindgen_206a5cae524a3fcb =
+  \x0 ->
+    hs_bindgen_206a5cae524a3fcb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @use_widget@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 21:6@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+use_widget ::
+     BG.Ptr Widget_legacy_t
+     -- ^ __C declaration:__ @w@
+  -> IO ()
+use_widget = hs_bindgen_206a5cae524a3fcb
diff --git a/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/bindingspec.yaml
@@ -0,0 +1,21 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/relative_include/sub/consumer.h
+  cname: widget_legacy_t
+  hsname: Widget_legacy_t
+hstypes:
+- hsname: Widget_legacy_t
+  representation:
+    newtype:
+      constructor: Widget_legacy_t
+      fields:
+      - unwrapWidget_legacy_t
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
diff --git a/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/th.txt b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/relative_include/sub/consumer/th.txt
@@ -0,0 +1,110 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/relative_include/core.h
+-- addDependentFile test-artefacts/headers/golden/binding-specs/relative_include/sub/consumer.h
+-- #include <binding-specs/relative_include/sub/consumer.h>
+-- void hs_bindgen_13e66cb2f49fb393 (
+--   widget_legacy_t *arg1
+-- )
+-- {
+--   (use_widget)(arg1);
+-- }
+-- void hs_bindgen_206a5cae524a3fcb (
+--   widget_legacy_t *arg1
+-- )
+-- {
+--   (use_widget)(arg1);
+-- }
+-- /* test_bindingspecsrelative_include_Example_get_use_widget */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_33ccb2801b32fc12 (void)) (
+--   widget_legacy_t *arg1
+-- )
+-- {
+--   return &use_widget;
+-- }
+{-| __C declaration:__ @widget_legacy_t@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 19:25@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+newtype Widget_legacy_t
+    = Widget_legacy_t {unwrapWidget_legacy_t :: M.WidgetT}
+    deriving stock Generic
+instance (~) ty M.WidgetT =>
+         HasField "unwrapWidget_legacy_t" Widget_legacy_t ty
+    where hasField = \x_0 -> (\y_1 -> Widget_legacy_t{unwrapWidget_legacy_t = y_1},
+                              getField @"unwrapWidget_legacy_t" x_0)
+instance (~) ty M.WidgetT =>
+         HasField "unwrapWidget_legacy_t" (Ptr Widget_legacy_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapWidget_legacy_t")
+instance HasCField Widget_legacy_t "unwrapWidget_legacy_t"
+    where type CFieldType Widget_legacy_t
+                          "unwrapWidget_legacy_t" = M.WidgetT
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_bindingspecsrelative_include_Example_Safe_use_widget@
+foreign import ccall safe "hs_bindgen_13e66cb2f49fb393" hs_bindgen_13e66cb2f49fb393_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsrelative_include_Example_Safe_use_widget@
+hs_bindgen_13e66cb2f49fb393 :: Ptr Widget_legacy_t -> IO ()
+-- __unique:__ @test_bindingspecsrelative_include_Example_Safe_use_widget@
+hs_bindgen_13e66cb2f49fb393 = \x_0 -> hs_bindgen_13e66cb2f49fb393_base (toFFIType x_0)
+{-| __C declaration:__ @use_widget@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 21:6@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+use_widget_safe :: Ptr Widget_legacy_t -> IO ()
+{-| __C declaration:__ @use_widget@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 21:6@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+use_widget_safe = hs_bindgen_13e66cb2f49fb393
+-- __unique:__ @test_bindingspecsrelative_include_Example_Unsafe_use_widget@
+foreign import ccall unsafe "hs_bindgen_206a5cae524a3fcb" hs_bindgen_206a5cae524a3fcb_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecsrelative_include_Example_Unsafe_use_widget@
+hs_bindgen_206a5cae524a3fcb :: Ptr Widget_legacy_t -> IO ()
+-- __unique:__ @test_bindingspecsrelative_include_Example_Unsafe_use_widget@
+hs_bindgen_206a5cae524a3fcb = \x_0 -> hs_bindgen_206a5cae524a3fcb_base (toFFIType x_0)
+{-| __C declaration:__ @use_widget@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 21:6@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+use_widget_unsafe :: Ptr Widget_legacy_t -> IO ()
+{-| __C declaration:__ @use_widget@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 21:6@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+use_widget_unsafe = hs_bindgen_206a5cae524a3fcb
+-- __unique:__ @test_bindingspecsrelative_include_Example_get_use_widget@
+foreign import ccall unsafe "hs_bindgen_33ccb2801b32fc12" hs_bindgen_33ccb2801b32fc12_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsrelative_include_Example_get_use_widget@
+hs_bindgen_33ccb2801b32fc12 :: IO (FunPtr (Ptr Widget_legacy_t ->
+                                           IO ()))
+-- __unique:__ @test_bindingspecsrelative_include_Example_get_use_widget@
+hs_bindgen_33ccb2801b32fc12 = fmap fromFFIType hs_bindgen_33ccb2801b32fc12_base
+{-# NOINLINE use_widget_funptr #-}
+{-| __C declaration:__ @use_widget@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 21:6@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+use_widget_funptr :: FunPtr (Ptr Widget_legacy_t -> IO ())
+{-| __C declaration:__ @use_widget@
+
+    __defined at:__ @binding-specs\/relative_include\/sub\/consumer.h 21:6@
+
+    __exported by:__ @binding-specs\/relative_include\/sub\/consumer.h@
+-}
+use_widget_funptr = unsafePerformIO hs_bindgen_33ccb2801b32fc12
diff --git a/test-artefacts/fixtures/binding-specs/rep/emptydata/staticsize/Example.hs b/test-artefacts/fixtures/binding-specs/rep/emptydata/staticsize/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/rep/emptydata/staticsize/Example.hs
@@ -0,0 +1,126 @@
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.Point2d
+    , Example.Value
+    , Example.Color
+    , Example.TdStruct
+    , Example.TdChain
+    , Example.TdUnion
+    , Example.Counter
+    , Example.OpaqueFwd
+    , Example.MacroPtr
+    )
+  where
+
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import Prelude (Int)
+
+{-| __C declaration:__ @struct point2d@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 9:8@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data Point2d
+
+instance Marshal.StaticSize Point2d where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+{-| __C declaration:__ @union value@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 11:7@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data Value
+
+instance Marshal.StaticSize Value where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| __C declaration:__ @enum color@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 13:6@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data Color
+
+instance Marshal.StaticSize Color where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+{-| __C declaration:__ @td_struct@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 17:21@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data TdStruct
+
+instance Marshal.StaticSize TdStruct where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| __C declaration:__ @td_chain@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 18:21@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data TdChain
+
+instance Marshal.StaticSize TdChain where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| __C declaration:__ @td_union@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 19:21@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data TdUnion
+
+instance Marshal.StaticSize TdUnion where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+{-| __C declaration:__ @counter@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 23:13@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data Counter
+
+{-| __C declaration:__ @struct opaque_fwd@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 25:8@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data OpaqueFwd
+
+{-| __C declaration:__ @macro macro_ptr@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 27:9@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data MacroPtr
diff --git a/test-artefacts/fixtures/binding-specs/rep/emptydata/staticsize/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/rep/emptydata/staticsize/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/rep/emptydata/staticsize/bindingspec.yaml
@@ -0,0 +1,63 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: struct point2d
+  hsname: Point2d
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: union value
+  hsname: Value
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: enum color
+  hsname: Color
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: td_struct
+  hsname: TdStruct
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: td_chain
+  hsname: TdChain
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: td_union
+  hsname: TdUnion
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: counter
+  hsname: Counter
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: struct opaque_fwd
+  hsname: OpaqueFwd
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: macro macro_ptr
+  hsname: MacroPtr
+hstypes:
+- hsname: Color
+  representation: emptydata
+  instances:
+  - StaticSize
+- hsname: Counter
+  representation: emptydata
+- hsname: MacroPtr
+  representation: emptydata
+- hsname: OpaqueFwd
+  representation: emptydata
+- hsname: Point2d
+  representation: emptydata
+  instances:
+  - StaticSize
+- hsname: TdChain
+  representation: emptydata
+  instances:
+  - StaticSize
+- hsname: TdStruct
+  representation: emptydata
+  instances:
+  - StaticSize
+- hsname: TdUnion
+  representation: emptydata
+  instances:
+  - StaticSize
+- hsname: Value
+  representation: emptydata
+  instances:
+  - StaticSize
diff --git a/test-artefacts/fixtures/binding-specs/rep/emptydata/staticsize/th.txt b/test-artefacts/fixtures/binding-specs/rep/emptydata/staticsize/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/rep/emptydata/staticsize/th.txt
@@ -0,0 +1,84 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/rep/emptydata/pt.h
+-- addDependentFile test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize_deps.h
+-- addDependentFile test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize.h
+{-| __C declaration:__ @struct point2d@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 9:8@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data Point2d
+instance StaticSize Point2d
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+{-| __C declaration:__ @union value@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 11:7@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data Value
+instance StaticSize Value
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+{-| __C declaration:__ @enum color@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 13:6@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data Color
+instance StaticSize Color
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+{-| __C declaration:__ @td_struct@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 17:21@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data TdStruct
+instance StaticSize TdStruct
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+{-| __C declaration:__ @td_chain@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 18:21@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data TdChain
+instance StaticSize TdChain
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+{-| __C declaration:__ @td_union@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 19:21@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data TdUnion
+instance StaticSize TdUnion
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+{-| __C declaration:__ @counter@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 23:13@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data Counter
+{-| __C declaration:__ @struct opaque_fwd@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 25:8@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data OpaqueFwd
+{-| __C declaration:__ @macro macro_ptr@
+
+    __defined at:__ @binding-specs\/rep\/emptydata\/staticsize.h 27:9@
+
+    __exported by:__ @binding-specs\/rep\/emptydata\/staticsize.h@
+-}
+data MacroPtr
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/bool/Example.hs b/test-artefacts/fixtures/binding-specs/stdlib/bool/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/bool/Example.hs
@@ -0,0 +1,75 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Stdlib_CBool(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @stdlib_CBool@
+
+    __defined at:__ @binding-specs\/stdlib\/bool.h 1:14@
+
+    __exported by:__ @binding-specs\/stdlib\/bool.h@
+-}
+newtype Stdlib_CBool = Stdlib_CBool
+  { unwrapStdlib_CBool :: BG.CBool
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CBool" Stdlib_CBool ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CBool {unwrapStdlib_CBool = y1}
+      , BG.getField @"unwrapStdlib_CBool" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "unwrapStdlib_CBool" (BG.Ptr Stdlib_CBool) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CBool")
+
+instance HasCField.HasCField Stdlib_CBool "unwrapStdlib_CBool" where
+
+  type CFieldType Stdlib_CBool "unwrapStdlib_CBool" =
+    BG.CBool
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/bool/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/stdlib/bool/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/bool/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/stdlib/bool.h
+  cname: stdlib_CBool
+  hsname: Stdlib_CBool
+hstypes:
+- hsname: Stdlib_CBool
+  representation:
+    newtype:
+      constructor: Stdlib_CBool
+      fields:
+      - unwrapStdlib_CBool
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CBool
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/bool/th.txt b/test-artefacts/fixtures/binding-specs/stdlib/bool/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/bool/th.txt
@@ -0,0 +1,35 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/stdlib/bool.h
+{-| __C declaration:__ @stdlib_CBool@
+
+    __defined at:__ @binding-specs\/stdlib\/bool.h 1:14@
+
+    __exported by:__ @binding-specs\/stdlib\/bool.h@
+-}
+newtype Stdlib_CBool
+    = Stdlib_CBool {unwrapStdlib_CBool :: CBool}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CBool =>
+         HasField "unwrapStdlib_CBool" Stdlib_CBool ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CBool{unwrapStdlib_CBool = y_1},
+                              getField @"unwrapStdlib_CBool" x_0)
+instance (~) ty CBool =>
+         HasField "unwrapStdlib_CBool" (Ptr Stdlib_CBool) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CBool")
+instance HasCField Stdlib_CBool "unwrapStdlib_CBool"
+    where type CFieldType Stdlib_CBool "unwrapStdlib_CBool" = CBool
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c11-parse-all/Example.hs b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c11-parse-all/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c11-parse-all/Example.hs
@@ -0,0 +1,1460 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Stdlib_CBool(..)
+    , Example.Stdlib_Int8(..)
+    , Example.Stdlib_Int16(..)
+    , Example.Stdlib_Int32(..)
+    , Example.Stdlib_Int64(..)
+    , Example.Stdlib_Word8(..)
+    , Example.Stdlib_Word16(..)
+    , Example.Stdlib_Word32(..)
+    , Example.Stdlib_Word64(..)
+    , Example.Stdlib_CIntMax(..)
+    , Example.Stdlib_CUIntMax(..)
+    , Example.Stdlib_CIntPtr(..)
+    , Example.Stdlib_CUIntPtr(..)
+    , Example.Stdlib_CFenvT(..)
+    , Example.Stdlib_CFexceptT(..)
+    , Example.Stdlib_CSize(..)
+    , Example.Stdlib_CPtrdiff(..)
+    , Example.Stdlib_CJmpBuf(..)
+    , Example.Stdlib_CWchar(..)
+    , Example.Stdlib_CWintT(..)
+    , Example.Stdlib_CMbstateT(..)
+    , Example.Stdlib_CWctransT(..)
+    , Example.Stdlib_CWctypeT(..)
+    , Example.Stdlib_CChar16T(..)
+    , Example.Stdlib_CChar32T(..)
+    , Example.Stdlib_CTime(..)
+    , Example.Stdlib_CClock(..)
+    , Example.Stdlib_CTm(..)
+    , Example.Stdlib_CFile(..)
+    , Example.Stdlib_CFpos(..)
+    , Example.Stdlib_CSigAtomic(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @stdlib_CBool@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 18:14@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CBool = Stdlib_CBool
+  { unwrapStdlib_CBool :: BG.CBool
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CBool" Stdlib_CBool ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CBool {unwrapStdlib_CBool = y1}
+      , BG.getField @"unwrapStdlib_CBool" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "unwrapStdlib_CBool" (BG.Ptr Stdlib_CBool) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CBool")
+
+instance HasCField.HasCField Stdlib_CBool "unwrapStdlib_CBool" where
+
+  type CFieldType Stdlib_CBool "unwrapStdlib_CBool" =
+    BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Int8@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 21:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int8 = Stdlib_Int8
+  { unwrapStdlib_Int8 :: HsBindgen.Runtime.LibC.Int8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Int8" Stdlib_Int8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Int8 {unwrapStdlib_Int8 = y1}
+      , BG.getField @"unwrapStdlib_Int8" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "unwrapStdlib_Int8" (BG.Ptr Stdlib_Int8) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Int8")
+
+instance HasCField.HasCField Stdlib_Int8 "unwrapStdlib_Int8" where
+
+  type CFieldType Stdlib_Int8 "unwrapStdlib_Int8" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Int16@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 22:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int16 = Stdlib_Int16
+  { unwrapStdlib_Int16 :: HsBindgen.Runtime.LibC.Int16
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int16
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Int16" Stdlib_Int16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Int16 {unwrapStdlib_Int16 = y1}
+      , BG.getField @"unwrapStdlib_Int16" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int16
+         ) => BG.HasField "unwrapStdlib_Int16" (BG.Ptr Stdlib_Int16) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Int16")
+
+instance HasCField.HasCField Stdlib_Int16 "unwrapStdlib_Int16" where
+
+  type CFieldType Stdlib_Int16 "unwrapStdlib_Int16" =
+    HsBindgen.Runtime.LibC.Int16
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Int32@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 23:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int32 = Stdlib_Int32
+  { unwrapStdlib_Int32 :: HsBindgen.Runtime.LibC.Int32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Int32" Stdlib_Int32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Int32 {unwrapStdlib_Int32 = y1}
+      , BG.getField @"unwrapStdlib_Int32" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "unwrapStdlib_Int32" (BG.Ptr Stdlib_Int32) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Int32")
+
+instance HasCField.HasCField Stdlib_Int32 "unwrapStdlib_Int32" where
+
+  type CFieldType Stdlib_Int32 "unwrapStdlib_Int32" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Int64@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 24:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int64 = Stdlib_Int64
+  { unwrapStdlib_Int64 :: HsBindgen.Runtime.LibC.Int64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Int64" Stdlib_Int64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Int64 {unwrapStdlib_Int64 = y1}
+      , BG.getField @"unwrapStdlib_Int64" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "unwrapStdlib_Int64" (BG.Ptr Stdlib_Int64) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Int64")
+
+instance HasCField.HasCField Stdlib_Int64 "unwrapStdlib_Int64" where
+
+  type CFieldType Stdlib_Int64 "unwrapStdlib_Int64" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Word8@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 25:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word8 = Stdlib_Word8
+  { unwrapStdlib_Word8 :: HsBindgen.Runtime.LibC.Word8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Word8" Stdlib_Word8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Word8 {unwrapStdlib_Word8 = y1}
+      , BG.getField @"unwrapStdlib_Word8" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "unwrapStdlib_Word8" (BG.Ptr Stdlib_Word8) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Word8")
+
+instance HasCField.HasCField Stdlib_Word8 "unwrapStdlib_Word8" where
+
+  type CFieldType Stdlib_Word8 "unwrapStdlib_Word8" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Word16@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 26:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word16 = Stdlib_Word16
+  { unwrapStdlib_Word16 :: HsBindgen.Runtime.LibC.Word16
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Word16" Stdlib_Word16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Word16 {unwrapStdlib_Word16 = y1}
+      , BG.getField @"unwrapStdlib_Word16" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.HasField "unwrapStdlib_Word16" (BG.Ptr Stdlib_Word16) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Word16")
+
+instance HasCField.HasCField Stdlib_Word16 "unwrapStdlib_Word16" where
+
+  type CFieldType Stdlib_Word16 "unwrapStdlib_Word16" =
+    HsBindgen.Runtime.LibC.Word16
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Word32@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 27:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word32 = Stdlib_Word32
+  { unwrapStdlib_Word32 :: HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Word32" Stdlib_Word32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Word32 {unwrapStdlib_Word32 = y1}
+      , BG.getField @"unwrapStdlib_Word32" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "unwrapStdlib_Word32" (BG.Ptr Stdlib_Word32) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Word32")
+
+instance HasCField.HasCField Stdlib_Word32 "unwrapStdlib_Word32" where
+
+  type CFieldType Stdlib_Word32 "unwrapStdlib_Word32" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Word64@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 28:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word64 = Stdlib_Word64
+  { unwrapStdlib_Word64 :: HsBindgen.Runtime.LibC.Word64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Word64" Stdlib_Word64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Word64 {unwrapStdlib_Word64 = y1}
+      , BG.getField @"unwrapStdlib_Word64" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "unwrapStdlib_Word64" (BG.Ptr Stdlib_Word64) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Word64")
+
+instance HasCField.HasCField Stdlib_Word64 "unwrapStdlib_Word64" where
+
+  type CFieldType Stdlib_Word64 "unwrapStdlib_Word64" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CIntMax@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 29:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CIntMax = Stdlib_CIntMax
+  { unwrapStdlib_CIntMax :: HsBindgen.Runtime.LibC.CIntMax
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CIntMax
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CIntMax" Stdlib_CIntMax ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CIntMax {unwrapStdlib_CIntMax = y1}
+      , BG.getField @"unwrapStdlib_CIntMax" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CIntMax
+         ) => BG.HasField "unwrapStdlib_CIntMax" (BG.Ptr Stdlib_CIntMax) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CIntMax")
+
+instance HasCField.HasCField Stdlib_CIntMax "unwrapStdlib_CIntMax" where
+
+  type CFieldType Stdlib_CIntMax "unwrapStdlib_CIntMax" =
+    HsBindgen.Runtime.LibC.CIntMax
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CUIntMax@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 30:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CUIntMax = Stdlib_CUIntMax
+  { unwrapStdlib_CUIntMax :: HsBindgen.Runtime.LibC.CUIntMax
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CUIntMax
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CUIntMax" Stdlib_CUIntMax ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CUIntMax {unwrapStdlib_CUIntMax = y1}
+      , BG.getField @"unwrapStdlib_CUIntMax" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CUIntMax
+         ) => BG.HasField "unwrapStdlib_CUIntMax" (BG.Ptr Stdlib_CUIntMax) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CUIntMax")
+
+instance HasCField.HasCField Stdlib_CUIntMax "unwrapStdlib_CUIntMax" where
+
+  type CFieldType Stdlib_CUIntMax "unwrapStdlib_CUIntMax" =
+    HsBindgen.Runtime.LibC.CUIntMax
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CIntPtr@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 31:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CIntPtr = Stdlib_CIntPtr
+  { unwrapStdlib_CIntPtr :: HsBindgen.Runtime.LibC.CIntPtr
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CIntPtr
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CIntPtr" Stdlib_CIntPtr ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CIntPtr {unwrapStdlib_CIntPtr = y1}
+      , BG.getField @"unwrapStdlib_CIntPtr" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CIntPtr
+         ) => BG.HasField "unwrapStdlib_CIntPtr" (BG.Ptr Stdlib_CIntPtr) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CIntPtr")
+
+instance HasCField.HasCField Stdlib_CIntPtr "unwrapStdlib_CIntPtr" where
+
+  type CFieldType Stdlib_CIntPtr "unwrapStdlib_CIntPtr" =
+    HsBindgen.Runtime.LibC.CIntPtr
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CUIntPtr@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 32:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CUIntPtr = Stdlib_CUIntPtr
+  { unwrapStdlib_CUIntPtr :: HsBindgen.Runtime.LibC.CUIntPtr
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CUIntPtr
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CUIntPtr" Stdlib_CUIntPtr ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CUIntPtr {unwrapStdlib_CUIntPtr = y1}
+      , BG.getField @"unwrapStdlib_CUIntPtr" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CUIntPtr
+         ) => BG.HasField "unwrapStdlib_CUIntPtr" (BG.Ptr Stdlib_CUIntPtr) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CUIntPtr")
+
+instance HasCField.HasCField Stdlib_CUIntPtr "unwrapStdlib_CUIntPtr" where
+
+  type CFieldType Stdlib_CUIntPtr "unwrapStdlib_CUIntPtr" =
+    HsBindgen.Runtime.LibC.CUIntPtr
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CFenvT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 35:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFenvT = Stdlib_CFenvT
+  { unwrapStdlib_CFenvT :: HsBindgen.Runtime.LibC.CFenvT
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFenvT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CFenvT" Stdlib_CFenvT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CFenvT {unwrapStdlib_CFenvT = y1}
+      , BG.getField @"unwrapStdlib_CFenvT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFenvT
+         ) => BG.HasField "unwrapStdlib_CFenvT" (BG.Ptr Stdlib_CFenvT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CFenvT")
+
+instance HasCField.HasCField Stdlib_CFenvT "unwrapStdlib_CFenvT" where
+
+  type CFieldType Stdlib_CFenvT "unwrapStdlib_CFenvT" =
+    HsBindgen.Runtime.LibC.CFenvT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CFexceptT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 36:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFexceptT = Stdlib_CFexceptT
+  { unwrapStdlib_CFexceptT :: HsBindgen.Runtime.LibC.CFexceptT
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFexceptT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CFexceptT" Stdlib_CFexceptT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Stdlib_CFexceptT {unwrapStdlib_CFexceptT = y1}
+      , BG.getField @"unwrapStdlib_CFexceptT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFexceptT
+         ) => BG.HasField "unwrapStdlib_CFexceptT" (BG.Ptr Stdlib_CFexceptT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CFexceptT")
+
+instance HasCField.HasCField Stdlib_CFexceptT "unwrapStdlib_CFexceptT" where
+
+  type CFieldType Stdlib_CFexceptT "unwrapStdlib_CFexceptT" =
+    HsBindgen.Runtime.LibC.CFexceptT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CSize@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 39:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CSize = Stdlib_CSize
+  { unwrapStdlib_CSize :: HsBindgen.Runtime.LibC.CSize
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CSize" Stdlib_CSize ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CSize {unwrapStdlib_CSize = y1}
+      , BG.getField @"unwrapStdlib_CSize" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.HasField "unwrapStdlib_CSize" (BG.Ptr Stdlib_CSize) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CSize")
+
+instance HasCField.HasCField Stdlib_CSize "unwrapStdlib_CSize" where
+
+  type CFieldType Stdlib_CSize "unwrapStdlib_CSize" =
+    HsBindgen.Runtime.LibC.CSize
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CPtrdiff@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 40:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CPtrdiff = Stdlib_CPtrdiff
+  { unwrapStdlib_CPtrdiff :: HsBindgen.Runtime.LibC.CPtrdiff
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CPtrdiff
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CPtrdiff" Stdlib_CPtrdiff ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CPtrdiff {unwrapStdlib_CPtrdiff = y1}
+      , BG.getField @"unwrapStdlib_CPtrdiff" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CPtrdiff
+         ) => BG.HasField "unwrapStdlib_CPtrdiff" (BG.Ptr Stdlib_CPtrdiff) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CPtrdiff")
+
+instance HasCField.HasCField Stdlib_CPtrdiff "unwrapStdlib_CPtrdiff" where
+
+  type CFieldType Stdlib_CPtrdiff "unwrapStdlib_CPtrdiff" =
+    HsBindgen.Runtime.LibC.CPtrdiff
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CJmpBuf@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 43:17@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CJmpBuf = Stdlib_CJmpBuf
+  { unwrapStdlib_CJmpBuf :: HsBindgen.Runtime.LibC.CJmpBuf
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CJmpBuf
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CJmpBuf" Stdlib_CJmpBuf ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CJmpBuf {unwrapStdlib_CJmpBuf = y1}
+      , BG.getField @"unwrapStdlib_CJmpBuf" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CJmpBuf
+         ) => BG.HasField "unwrapStdlib_CJmpBuf" (BG.Ptr Stdlib_CJmpBuf) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CJmpBuf")
+
+instance HasCField.HasCField Stdlib_CJmpBuf "unwrapStdlib_CJmpBuf" where
+
+  type CFieldType Stdlib_CJmpBuf "unwrapStdlib_CJmpBuf" =
+    HsBindgen.Runtime.LibC.CJmpBuf
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CWchar@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 46:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWchar = Stdlib_CWchar
+  { unwrapStdlib_CWchar :: HsBindgen.Runtime.LibC.CWchar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWchar
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CWchar" Stdlib_CWchar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CWchar {unwrapStdlib_CWchar = y1}
+      , BG.getField @"unwrapStdlib_CWchar" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWchar
+         ) => BG.HasField "unwrapStdlib_CWchar" (BG.Ptr Stdlib_CWchar) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CWchar")
+
+instance HasCField.HasCField Stdlib_CWchar "unwrapStdlib_CWchar" where
+
+  type CFieldType Stdlib_CWchar "unwrapStdlib_CWchar" =
+    HsBindgen.Runtime.LibC.CWchar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CWintT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 47:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWintT = Stdlib_CWintT
+  { unwrapStdlib_CWintT :: HsBindgen.Runtime.LibC.CWintT
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWintT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CWintT" Stdlib_CWintT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CWintT {unwrapStdlib_CWintT = y1}
+      , BG.getField @"unwrapStdlib_CWintT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWintT
+         ) => BG.HasField "unwrapStdlib_CWintT" (BG.Ptr Stdlib_CWintT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CWintT")
+
+instance HasCField.HasCField Stdlib_CWintT "unwrapStdlib_CWintT" where
+
+  type CFieldType Stdlib_CWintT "unwrapStdlib_CWintT" =
+    HsBindgen.Runtime.LibC.CWintT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CMbstateT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 48:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CMbstateT = Stdlib_CMbstateT
+  { unwrapStdlib_CMbstateT :: HsBindgen.Runtime.LibC.CMbstateT
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CMbstateT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CMbstateT" Stdlib_CMbstateT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Stdlib_CMbstateT {unwrapStdlib_CMbstateT = y1}
+      , BG.getField @"unwrapStdlib_CMbstateT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CMbstateT
+         ) => BG.HasField "unwrapStdlib_CMbstateT" (BG.Ptr Stdlib_CMbstateT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CMbstateT")
+
+instance HasCField.HasCField Stdlib_CMbstateT "unwrapStdlib_CMbstateT" where
+
+  type CFieldType Stdlib_CMbstateT "unwrapStdlib_CMbstateT" =
+    HsBindgen.Runtime.LibC.CMbstateT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CWctransT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 49:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWctransT = Stdlib_CWctransT
+  { unwrapStdlib_CWctransT :: HsBindgen.Runtime.LibC.CWctransT
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWctransT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CWctransT" Stdlib_CWctransT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Stdlib_CWctransT {unwrapStdlib_CWctransT = y1}
+      , BG.getField @"unwrapStdlib_CWctransT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWctransT
+         ) => BG.HasField "unwrapStdlib_CWctransT" (BG.Ptr Stdlib_CWctransT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CWctransT")
+
+instance HasCField.HasCField Stdlib_CWctransT "unwrapStdlib_CWctransT" where
+
+  type CFieldType Stdlib_CWctransT "unwrapStdlib_CWctransT" =
+    HsBindgen.Runtime.LibC.CWctransT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CWctypeT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 50:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWctypeT = Stdlib_CWctypeT
+  { unwrapStdlib_CWctypeT :: HsBindgen.Runtime.LibC.CWctypeT
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWctypeT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CWctypeT" Stdlib_CWctypeT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CWctypeT {unwrapStdlib_CWctypeT = y1}
+      , BG.getField @"unwrapStdlib_CWctypeT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWctypeT
+         ) => BG.HasField "unwrapStdlib_CWctypeT" (BG.Ptr Stdlib_CWctypeT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CWctypeT")
+
+instance HasCField.HasCField Stdlib_CWctypeT "unwrapStdlib_CWctypeT" where
+
+  type CFieldType Stdlib_CWctypeT "unwrapStdlib_CWctypeT" =
+    HsBindgen.Runtime.LibC.CWctypeT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CChar16T@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 51:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CChar16T = Stdlib_CChar16T
+  { unwrapStdlib_CChar16T :: HsBindgen.Runtime.LibC.CChar16T
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CChar16T
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CChar16T" Stdlib_CChar16T ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CChar16T {unwrapStdlib_CChar16T = y1}
+      , BG.getField @"unwrapStdlib_CChar16T" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CChar16T
+         ) => BG.HasField "unwrapStdlib_CChar16T" (BG.Ptr Stdlib_CChar16T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CChar16T")
+
+instance HasCField.HasCField Stdlib_CChar16T "unwrapStdlib_CChar16T" where
+
+  type CFieldType Stdlib_CChar16T "unwrapStdlib_CChar16T" =
+    HsBindgen.Runtime.LibC.CChar16T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CChar32T@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 52:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CChar32T = Stdlib_CChar32T
+  { unwrapStdlib_CChar32T :: HsBindgen.Runtime.LibC.CChar32T
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CChar32T
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CChar32T" Stdlib_CChar32T ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CChar32T {unwrapStdlib_CChar32T = y1}
+      , BG.getField @"unwrapStdlib_CChar32T" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CChar32T
+         ) => BG.HasField "unwrapStdlib_CChar32T" (BG.Ptr Stdlib_CChar32T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CChar32T")
+
+instance HasCField.HasCField Stdlib_CChar32T "unwrapStdlib_CChar32T" where
+
+  type CFieldType Stdlib_CChar32T "unwrapStdlib_CChar32T" =
+    HsBindgen.Runtime.LibC.CChar32T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CTime@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 55:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CTime = Stdlib_CTime
+  { unwrapStdlib_CTime :: HsBindgen.Runtime.LibC.CTime
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , BG.HasFFIType
+    , Num
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CTime
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CTime" Stdlib_CTime ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CTime {unwrapStdlib_CTime = y1}
+      , BG.getField @"unwrapStdlib_CTime" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CTime
+         ) => BG.HasField "unwrapStdlib_CTime" (BG.Ptr Stdlib_CTime) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CTime")
+
+instance HasCField.HasCField Stdlib_CTime "unwrapStdlib_CTime" where
+
+  type CFieldType Stdlib_CTime "unwrapStdlib_CTime" =
+    HsBindgen.Runtime.LibC.CTime
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CClock@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 56:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CClock = Stdlib_CClock
+  { unwrapStdlib_CClock :: HsBindgen.Runtime.LibC.CClock
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , BG.HasFFIType
+    , Num
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CClock
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CClock" Stdlib_CClock ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CClock {unwrapStdlib_CClock = y1}
+      , BG.getField @"unwrapStdlib_CClock" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CClock
+         ) => BG.HasField "unwrapStdlib_CClock" (BG.Ptr Stdlib_CClock) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CClock")
+
+instance HasCField.HasCField Stdlib_CClock "unwrapStdlib_CClock" where
+
+  type CFieldType Stdlib_CClock "unwrapStdlib_CClock" =
+    HsBindgen.Runtime.LibC.CClock
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CTm@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 57:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CTm = Stdlib_CTm
+  { unwrapStdlib_CTm :: HsBindgen.Runtime.LibC.CTm
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (Marshal.ReadRaw, Marshal.StaticSize)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CTm
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CTm" Stdlib_CTm ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CTm {unwrapStdlib_CTm = y1}
+      , BG.getField @"unwrapStdlib_CTm" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CTm
+         ) => BG.HasField "unwrapStdlib_CTm" (BG.Ptr Stdlib_CTm) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CTm")
+
+instance HasCField.HasCField Stdlib_CTm "unwrapStdlib_CTm" where
+
+  type CFieldType Stdlib_CTm "unwrapStdlib_CTm" =
+    HsBindgen.Runtime.LibC.CTm
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CFile@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 60:16@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFile = Stdlib_CFile
+  { unwrapStdlib_CFile :: HsBindgen.Runtime.LibC.CFile
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFile
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CFile" Stdlib_CFile ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CFile {unwrapStdlib_CFile = y1}
+      , BG.getField @"unwrapStdlib_CFile" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFile
+         ) => BG.HasField "unwrapStdlib_CFile" (BG.Ptr Stdlib_CFile) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CFile")
+
+instance HasCField.HasCField Stdlib_CFile "unwrapStdlib_CFile" where
+
+  type CFieldType Stdlib_CFile "unwrapStdlib_CFile" =
+    HsBindgen.Runtime.LibC.CFile
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CFpos@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 61:16@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFpos = Stdlib_CFpos
+  { unwrapStdlib_CFpos :: HsBindgen.Runtime.LibC.CFpos
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFpos
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CFpos" Stdlib_CFpos ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CFpos {unwrapStdlib_CFpos = y1}
+      , BG.getField @"unwrapStdlib_CFpos" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFpos
+         ) => BG.HasField "unwrapStdlib_CFpos" (BG.Ptr Stdlib_CFpos) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CFpos")
+
+instance HasCField.HasCField Stdlib_CFpos "unwrapStdlib_CFpos" where
+
+  type CFieldType Stdlib_CFpos "unwrapStdlib_CFpos" =
+    HsBindgen.Runtime.LibC.CFpos
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CSigAtomic@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 64:22@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CSigAtomic = Stdlib_CSigAtomic
+  { unwrapStdlib_CSigAtomic :: HsBindgen.Runtime.LibC.CSigAtomic
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSigAtomic
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CSigAtomic" Stdlib_CSigAtomic ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Stdlib_CSigAtomic {unwrapStdlib_CSigAtomic = y1}
+      , BG.getField @"unwrapStdlib_CSigAtomic" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSigAtomic
+         ) => BG.HasField "unwrapStdlib_CSigAtomic" (BG.Ptr Stdlib_CSigAtomic) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CSigAtomic")
+
+instance HasCField.HasCField Stdlib_CSigAtomic "unwrapStdlib_CSigAtomic" where
+
+  type CFieldType Stdlib_CSigAtomic "unwrapStdlib_CSigAtomic" =
+    HsBindgen.Runtime.LibC.CSigAtomic
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c11-parse-all/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c11-parse-all/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c11-parse-all/bindingspec.yaml
@@ -0,0 +1,970 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CBool
+  hsname: Stdlib_CBool
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Int8
+  hsname: Stdlib_Int8
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Int16
+  hsname: Stdlib_Int16
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Int32
+  hsname: Stdlib_Int32
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Int64
+  hsname: Stdlib_Int64
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Word8
+  hsname: Stdlib_Word8
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Word16
+  hsname: Stdlib_Word16
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Word32
+  hsname: Stdlib_Word32
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Word64
+  hsname: Stdlib_Word64
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CIntMax
+  hsname: Stdlib_CIntMax
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CUIntMax
+  hsname: Stdlib_CUIntMax
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CIntPtr
+  hsname: Stdlib_CIntPtr
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CUIntPtr
+  hsname: Stdlib_CUIntPtr
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CFenvT
+  hsname: Stdlib_CFenvT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CFexceptT
+  hsname: Stdlib_CFexceptT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CSize
+  hsname: Stdlib_CSize
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CPtrdiff
+  hsname: Stdlib_CPtrdiff
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CJmpBuf
+  hsname: Stdlib_CJmpBuf
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CWchar
+  hsname: Stdlib_CWchar
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CWintT
+  hsname: Stdlib_CWintT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CMbstateT
+  hsname: Stdlib_CMbstateT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CWctransT
+  hsname: Stdlib_CWctransT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CWctypeT
+  hsname: Stdlib_CWctypeT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CChar16T
+  hsname: Stdlib_CChar16T
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CChar32T
+  hsname: Stdlib_CChar32T
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CTime
+  hsname: Stdlib_CTime
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CClock
+  hsname: Stdlib_CClock
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CTm
+  hsname: Stdlib_CTm
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CFile
+  hsname: Stdlib_CFile
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CFpos
+  hsname: Stdlib_CFpos
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CSigAtomic
+  hsname: Stdlib_CSigAtomic
+hstypes:
+- hsname: Stdlib_CBool
+  representation:
+    newtype:
+      constructor: Stdlib_CBool
+      fields:
+      - unwrapStdlib_CBool
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CBool
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CChar16T
+  representation:
+    newtype:
+      constructor: Stdlib_CChar16T
+      fields:
+      - unwrapStdlib_CChar16T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CChar16T
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CChar32T
+  representation:
+    newtype:
+      constructor: Stdlib_CChar32T
+      fields:
+      - unwrapStdlib_CChar32T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CChar32T
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CClock
+  representation:
+    newtype:
+      constructor: Stdlib_CClock
+      fields:
+      - unwrapStdlib_CClock
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CClock
+  instances:
+  - Enum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CFenvT
+  representation:
+    newtype:
+      constructor: Stdlib_CFenvT
+      fields:
+      - unwrapStdlib_CFenvT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CFexceptT
+  representation:
+    newtype:
+      constructor: Stdlib_CFexceptT
+      fields:
+      - unwrapStdlib_CFexceptT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUShort
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CFile
+  representation:
+    newtype:
+      constructor: Stdlib_CFile
+      fields:
+      - unwrapStdlib_CFile
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CFpos
+  representation:
+    newtype:
+      constructor: Stdlib_CFpos
+      fields:
+      - unwrapStdlib_CFpos
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CIntMax
+  representation:
+    newtype:
+      constructor: Stdlib_CIntMax
+      fields:
+      - unwrapStdlib_CIntMax
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CIntMax
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CIntPtr
+  representation:
+    newtype:
+      constructor: Stdlib_CIntPtr
+      fields:
+      - unwrapStdlib_CIntPtr
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CIntPtr
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CJmpBuf
+  representation:
+    newtype:
+      constructor: Stdlib_CJmpBuf
+      fields:
+      - unwrapStdlib_CJmpBuf
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CMbstateT
+  representation:
+    newtype:
+      constructor: Stdlib_CMbstateT
+      fields:
+      - unwrapStdlib_CMbstateT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CPtrdiff
+  representation:
+    newtype:
+      constructor: Stdlib_CPtrdiff
+      fields:
+      - unwrapStdlib_CPtrdiff
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CPtrdiff
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CSigAtomic
+  representation:
+    newtype:
+      constructor: Stdlib_CSigAtomic
+      fields:
+      - unwrapStdlib_CSigAtomic
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CSigAtomic
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CSize
+  representation:
+    newtype:
+      constructor: Stdlib_CSize
+      fields:
+      - unwrapStdlib_CSize
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CSize
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CTime
+  representation:
+    newtype:
+      constructor: Stdlib_CTime
+      fields:
+      - unwrapStdlib_CTime
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CTime
+  instances:
+  - Enum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CTm
+  representation:
+    newtype:
+      constructor: Stdlib_CTm
+      fields:
+      - unwrapStdlib_CTm
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+- hsname: Stdlib_CUIntMax
+  representation:
+    newtype:
+      constructor: Stdlib_CUIntMax
+      fields:
+      - unwrapStdlib_CUIntMax
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CUIntMax
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CUIntPtr
+  representation:
+    newtype:
+      constructor: Stdlib_CUIntPtr
+      fields:
+      - unwrapStdlib_CUIntPtr
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CUIntPtr
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CWchar
+  representation:
+    newtype:
+      constructor: Stdlib_CWchar
+      fields:
+      - unwrapStdlib_CWchar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CWchar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CWctransT
+  representation:
+    newtype:
+      constructor: Stdlib_CWctransT
+      fields:
+      - unwrapStdlib_CWctransT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CWctransT
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Prim
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CWctypeT
+  representation:
+    newtype:
+      constructor: Stdlib_CWctypeT
+      fields:
+      - unwrapStdlib_CWctypeT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CWctypeT
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Prim
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CWintT
+  representation:
+    newtype:
+      constructor: Stdlib_CWintT
+      fields:
+      - unwrapStdlib_CWintT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CWintT
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Int16
+  representation:
+    newtype:
+      constructor: Stdlib_Int16
+      fields:
+      - unwrapStdlib_Int16
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int16
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Int32
+  representation:
+    newtype:
+      constructor: Stdlib_Int32
+      fields:
+      - unwrapStdlib_Int32
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Int64
+  representation:
+    newtype:
+      constructor: Stdlib_Int64
+      fields:
+      - unwrapStdlib_Int64
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Int8
+  representation:
+    newtype:
+      constructor: Stdlib_Int8
+      fields:
+      - unwrapStdlib_Int8
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Word16
+  representation:
+    newtype:
+      constructor: Stdlib_Word16
+      fields:
+      - unwrapStdlib_Word16
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word16
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Word32
+  representation:
+    newtype:
+      constructor: Stdlib_Word32
+      fields:
+      - unwrapStdlib_Word32
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Word64
+  representation:
+    newtype:
+      constructor: Stdlib_Word64
+      fields:
+      - unwrapStdlib_Word64
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Word8
+  representation:
+    newtype:
+      constructor: Stdlib_Word8
+      fields:
+      - unwrapStdlib_Word8
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c11-parse-all/th.txt b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c11-parse-all/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c11-parse-all/th.txt
@@ -0,0 +1,966 @@
+-- addDependentFile musl-include/x86_64/bits/fenv.h
+-- addDependentFile musl-include/x86_64/fenv.h
+-- addDependentFile musl-include/x86_64/features.h
+-- addDependentFile musl-include/x86_64/bits/setjmp.h
+-- addDependentFile musl-include/x86_64/setjmp.h
+-- addDependentFile musl-include/x86_64/bits/signal.h
+-- addDependentFile musl-include/x86_64/signal.h
+-- addDependentFile musl-include/x86_64/stdbool.h
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile musl-include/x86_64/stdio.h
+-- addDependentFile musl-include/x86_64/time.h
+-- addDependentFile musl-include/x86_64/uchar.h
+-- addDependentFile musl-include/x86_64/wchar.h
+-- addDependentFile musl-include/x86_64/wctype.h
+-- addDependentFile test-artefacts/headers/golden/binding-specs/stdlib/instances.h
+{-| __C declaration:__ @stdlib_CBool@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 18:14@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CBool
+    = Stdlib_CBool {unwrapStdlib_CBool :: CBool}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CBool =>
+         HasField "unwrapStdlib_CBool" Stdlib_CBool ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CBool{unwrapStdlib_CBool = y_1},
+                              getField @"unwrapStdlib_CBool" x_0)
+instance (~) ty CBool =>
+         HasField "unwrapStdlib_CBool" (Ptr Stdlib_CBool) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CBool")
+instance HasCField Stdlib_CBool "unwrapStdlib_CBool"
+    where type CFieldType Stdlib_CBool "unwrapStdlib_CBool" = CBool
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Int8@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 21:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int8
+    = Stdlib_Int8 {unwrapStdlib_Int8 :: HsBindgen.Runtime.LibC.Int8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapStdlib_Int8" Stdlib_Int8 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Int8{unwrapStdlib_Int8 = y_1},
+                              getField @"unwrapStdlib_Int8" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapStdlib_Int8" (Ptr Stdlib_Int8) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Int8")
+instance HasCField Stdlib_Int8 "unwrapStdlib_Int8"
+    where type CFieldType Stdlib_Int8
+                          "unwrapStdlib_Int8" = HsBindgen.Runtime.LibC.Int8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Int16@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 22:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int16
+    = Stdlib_Int16 {unwrapStdlib_Int16 :: HsBindgen.Runtime.LibC.Int16}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int16 =>
+         HasField "unwrapStdlib_Int16" Stdlib_Int16 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Int16{unwrapStdlib_Int16 = y_1},
+                              getField @"unwrapStdlib_Int16" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int16 =>
+         HasField "unwrapStdlib_Int16" (Ptr Stdlib_Int16) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Int16")
+instance HasCField Stdlib_Int16 "unwrapStdlib_Int16"
+    where type CFieldType Stdlib_Int16
+                          "unwrapStdlib_Int16" = HsBindgen.Runtime.LibC.Int16
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Int32@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 23:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int32
+    = Stdlib_Int32 {unwrapStdlib_Int32 :: HsBindgen.Runtime.LibC.Int32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapStdlib_Int32" Stdlib_Int32 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Int32{unwrapStdlib_Int32 = y_1},
+                              getField @"unwrapStdlib_Int32" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapStdlib_Int32" (Ptr Stdlib_Int32) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Int32")
+instance HasCField Stdlib_Int32 "unwrapStdlib_Int32"
+    where type CFieldType Stdlib_Int32
+                          "unwrapStdlib_Int32" = HsBindgen.Runtime.LibC.Int32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Int64@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 24:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int64
+    = Stdlib_Int64 {unwrapStdlib_Int64 :: HsBindgen.Runtime.LibC.Int64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapStdlib_Int64" Stdlib_Int64 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Int64{unwrapStdlib_Int64 = y_1},
+                              getField @"unwrapStdlib_Int64" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapStdlib_Int64" (Ptr Stdlib_Int64) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Int64")
+instance HasCField Stdlib_Int64 "unwrapStdlib_Int64"
+    where type CFieldType Stdlib_Int64
+                          "unwrapStdlib_Int64" = HsBindgen.Runtime.LibC.Int64
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Word8@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 25:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word8
+    = Stdlib_Word8 {unwrapStdlib_Word8 :: HsBindgen.Runtime.LibC.Word8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapStdlib_Word8" Stdlib_Word8 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Word8{unwrapStdlib_Word8 = y_1},
+                              getField @"unwrapStdlib_Word8" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapStdlib_Word8" (Ptr Stdlib_Word8) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Word8")
+instance HasCField Stdlib_Word8 "unwrapStdlib_Word8"
+    where type CFieldType Stdlib_Word8
+                          "unwrapStdlib_Word8" = HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Word16@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 26:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word16
+    = Stdlib_Word16 {unwrapStdlib_Word16 :: HsBindgen.Runtime.LibC.Word16}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "unwrapStdlib_Word16" Stdlib_Word16 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Word16{unwrapStdlib_Word16 = y_1},
+                              getField @"unwrapStdlib_Word16" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "unwrapStdlib_Word16" (Ptr Stdlib_Word16) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Word16")
+instance HasCField Stdlib_Word16 "unwrapStdlib_Word16"
+    where type CFieldType Stdlib_Word16
+                          "unwrapStdlib_Word16" = HsBindgen.Runtime.LibC.Word16
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Word32@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 27:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word32
+    = Stdlib_Word32 {unwrapStdlib_Word32 :: HsBindgen.Runtime.LibC.Word32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapStdlib_Word32" Stdlib_Word32 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Word32{unwrapStdlib_Word32 = y_1},
+                              getField @"unwrapStdlib_Word32" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapStdlib_Word32" (Ptr Stdlib_Word32) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Word32")
+instance HasCField Stdlib_Word32 "unwrapStdlib_Word32"
+    where type CFieldType Stdlib_Word32
+                          "unwrapStdlib_Word32" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Word64@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 28:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word64
+    = Stdlib_Word64 {unwrapStdlib_Word64 :: HsBindgen.Runtime.LibC.Word64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapStdlib_Word64" Stdlib_Word64 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Word64{unwrapStdlib_Word64 = y_1},
+                              getField @"unwrapStdlib_Word64" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapStdlib_Word64" (Ptr Stdlib_Word64) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Word64")
+instance HasCField Stdlib_Word64 "unwrapStdlib_Word64"
+    where type CFieldType Stdlib_Word64
+                          "unwrapStdlib_Word64" = HsBindgen.Runtime.LibC.Word64
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CIntMax@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 29:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CIntMax
+    = Stdlib_CIntMax {unwrapStdlib_CIntMax :: HsBindgen.Runtime.LibC.CIntMax}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CIntMax =>
+         HasField "unwrapStdlib_CIntMax" Stdlib_CIntMax ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CIntMax{unwrapStdlib_CIntMax = y_1},
+                              getField @"unwrapStdlib_CIntMax" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CIntMax =>
+         HasField "unwrapStdlib_CIntMax" (Ptr Stdlib_CIntMax) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CIntMax")
+instance HasCField Stdlib_CIntMax "unwrapStdlib_CIntMax"
+    where type CFieldType Stdlib_CIntMax
+                          "unwrapStdlib_CIntMax" = HsBindgen.Runtime.LibC.CIntMax
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CUIntMax@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 30:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CUIntMax
+    = Stdlib_CUIntMax {unwrapStdlib_CUIntMax :: HsBindgen.Runtime.LibC.CUIntMax}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CUIntMax =>
+         HasField "unwrapStdlib_CUIntMax" Stdlib_CUIntMax ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CUIntMax{unwrapStdlib_CUIntMax = y_1},
+                              getField @"unwrapStdlib_CUIntMax" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CUIntMax =>
+         HasField "unwrapStdlib_CUIntMax" (Ptr Stdlib_CUIntMax) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CUIntMax")
+instance HasCField Stdlib_CUIntMax "unwrapStdlib_CUIntMax"
+    where type CFieldType Stdlib_CUIntMax
+                          "unwrapStdlib_CUIntMax" = HsBindgen.Runtime.LibC.CUIntMax
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CIntPtr@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 31:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CIntPtr
+    = Stdlib_CIntPtr {unwrapStdlib_CIntPtr :: HsBindgen.Runtime.LibC.CIntPtr}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CIntPtr =>
+         HasField "unwrapStdlib_CIntPtr" Stdlib_CIntPtr ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CIntPtr{unwrapStdlib_CIntPtr = y_1},
+                              getField @"unwrapStdlib_CIntPtr" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CIntPtr =>
+         HasField "unwrapStdlib_CIntPtr" (Ptr Stdlib_CIntPtr) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CIntPtr")
+instance HasCField Stdlib_CIntPtr "unwrapStdlib_CIntPtr"
+    where type CFieldType Stdlib_CIntPtr
+                          "unwrapStdlib_CIntPtr" = HsBindgen.Runtime.LibC.CIntPtr
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CUIntPtr@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 32:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CUIntPtr
+    = Stdlib_CUIntPtr {unwrapStdlib_CUIntPtr :: HsBindgen.Runtime.LibC.CUIntPtr}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CUIntPtr =>
+         HasField "unwrapStdlib_CUIntPtr" Stdlib_CUIntPtr ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CUIntPtr{unwrapStdlib_CUIntPtr = y_1},
+                              getField @"unwrapStdlib_CUIntPtr" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CUIntPtr =>
+         HasField "unwrapStdlib_CUIntPtr" (Ptr Stdlib_CUIntPtr) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CUIntPtr")
+instance HasCField Stdlib_CUIntPtr "unwrapStdlib_CUIntPtr"
+    where type CFieldType Stdlib_CUIntPtr
+                          "unwrapStdlib_CUIntPtr" = HsBindgen.Runtime.LibC.CUIntPtr
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CFenvT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 35:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFenvT
+    = Stdlib_CFenvT {unwrapStdlib_CFenvT :: HsBindgen.Runtime.LibC.CFenvT}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CFenvT =>
+         HasField "unwrapStdlib_CFenvT" Stdlib_CFenvT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CFenvT{unwrapStdlib_CFenvT = y_1},
+                              getField @"unwrapStdlib_CFenvT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CFenvT =>
+         HasField "unwrapStdlib_CFenvT" (Ptr Stdlib_CFenvT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CFenvT")
+instance HasCField Stdlib_CFenvT "unwrapStdlib_CFenvT"
+    where type CFieldType Stdlib_CFenvT
+                          "unwrapStdlib_CFenvT" = HsBindgen.Runtime.LibC.CFenvT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CFexceptT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 36:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFexceptT
+    = Stdlib_CFexceptT {unwrapStdlib_CFexceptT :: HsBindgen.Runtime.LibC.CFexceptT}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CFexceptT =>
+         HasField "unwrapStdlib_CFexceptT" Stdlib_CFexceptT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CFexceptT{unwrapStdlib_CFexceptT = y_1},
+                              getField @"unwrapStdlib_CFexceptT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CFexceptT =>
+         HasField "unwrapStdlib_CFexceptT" (Ptr Stdlib_CFexceptT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CFexceptT")
+instance HasCField Stdlib_CFexceptT "unwrapStdlib_CFexceptT"
+    where type CFieldType Stdlib_CFexceptT
+                          "unwrapStdlib_CFexceptT" = HsBindgen.Runtime.LibC.CFexceptT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CSize@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 39:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CSize
+    = Stdlib_CSize {unwrapStdlib_CSize :: HsBindgen.Runtime.LibC.CSize}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "unwrapStdlib_CSize" Stdlib_CSize ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CSize{unwrapStdlib_CSize = y_1},
+                              getField @"unwrapStdlib_CSize" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "unwrapStdlib_CSize" (Ptr Stdlib_CSize) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CSize")
+instance HasCField Stdlib_CSize "unwrapStdlib_CSize"
+    where type CFieldType Stdlib_CSize
+                          "unwrapStdlib_CSize" = HsBindgen.Runtime.LibC.CSize
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CPtrdiff@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 40:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CPtrdiff
+    = Stdlib_CPtrdiff {unwrapStdlib_CPtrdiff :: HsBindgen.Runtime.LibC.CPtrdiff}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CPtrdiff =>
+         HasField "unwrapStdlib_CPtrdiff" Stdlib_CPtrdiff ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CPtrdiff{unwrapStdlib_CPtrdiff = y_1},
+                              getField @"unwrapStdlib_CPtrdiff" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CPtrdiff =>
+         HasField "unwrapStdlib_CPtrdiff" (Ptr Stdlib_CPtrdiff) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CPtrdiff")
+instance HasCField Stdlib_CPtrdiff "unwrapStdlib_CPtrdiff"
+    where type CFieldType Stdlib_CPtrdiff
+                          "unwrapStdlib_CPtrdiff" = HsBindgen.Runtime.LibC.CPtrdiff
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CJmpBuf@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 43:17@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CJmpBuf
+    = Stdlib_CJmpBuf {unwrapStdlib_CJmpBuf :: HsBindgen.Runtime.LibC.CJmpBuf}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CJmpBuf =>
+         HasField "unwrapStdlib_CJmpBuf" Stdlib_CJmpBuf ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CJmpBuf{unwrapStdlib_CJmpBuf = y_1},
+                              getField @"unwrapStdlib_CJmpBuf" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CJmpBuf =>
+         HasField "unwrapStdlib_CJmpBuf" (Ptr Stdlib_CJmpBuf) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CJmpBuf")
+instance HasCField Stdlib_CJmpBuf "unwrapStdlib_CJmpBuf"
+    where type CFieldType Stdlib_CJmpBuf
+                          "unwrapStdlib_CJmpBuf" = HsBindgen.Runtime.LibC.CJmpBuf
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CWchar@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 46:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWchar
+    = Stdlib_CWchar {unwrapStdlib_CWchar :: HsBindgen.Runtime.LibC.CWchar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CWchar =>
+         HasField "unwrapStdlib_CWchar" Stdlib_CWchar ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CWchar{unwrapStdlib_CWchar = y_1},
+                              getField @"unwrapStdlib_CWchar" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CWchar =>
+         HasField "unwrapStdlib_CWchar" (Ptr Stdlib_CWchar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CWchar")
+instance HasCField Stdlib_CWchar "unwrapStdlib_CWchar"
+    where type CFieldType Stdlib_CWchar
+                          "unwrapStdlib_CWchar" = HsBindgen.Runtime.LibC.CWchar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CWintT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 47:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWintT
+    = Stdlib_CWintT {unwrapStdlib_CWintT :: HsBindgen.Runtime.LibC.CWintT}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CWintT =>
+         HasField "unwrapStdlib_CWintT" Stdlib_CWintT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CWintT{unwrapStdlib_CWintT = y_1},
+                              getField @"unwrapStdlib_CWintT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CWintT =>
+         HasField "unwrapStdlib_CWintT" (Ptr Stdlib_CWintT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CWintT")
+instance HasCField Stdlib_CWintT "unwrapStdlib_CWintT"
+    where type CFieldType Stdlib_CWintT
+                          "unwrapStdlib_CWintT" = HsBindgen.Runtime.LibC.CWintT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CMbstateT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 48:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CMbstateT
+    = Stdlib_CMbstateT {unwrapStdlib_CMbstateT :: HsBindgen.Runtime.LibC.CMbstateT}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CMbstateT =>
+         HasField "unwrapStdlib_CMbstateT" Stdlib_CMbstateT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CMbstateT{unwrapStdlib_CMbstateT = y_1},
+                              getField @"unwrapStdlib_CMbstateT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CMbstateT =>
+         HasField "unwrapStdlib_CMbstateT" (Ptr Stdlib_CMbstateT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CMbstateT")
+instance HasCField Stdlib_CMbstateT "unwrapStdlib_CMbstateT"
+    where type CFieldType Stdlib_CMbstateT
+                          "unwrapStdlib_CMbstateT" = HsBindgen.Runtime.LibC.CMbstateT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CWctransT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 49:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWctransT
+    = Stdlib_CWctransT {unwrapStdlib_CWctransT :: HsBindgen.Runtime.LibC.CWctransT}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CWctransT =>
+         HasField "unwrapStdlib_CWctransT" Stdlib_CWctransT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CWctransT{unwrapStdlib_CWctransT = y_1},
+                              getField @"unwrapStdlib_CWctransT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CWctransT =>
+         HasField "unwrapStdlib_CWctransT" (Ptr Stdlib_CWctransT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CWctransT")
+instance HasCField Stdlib_CWctransT "unwrapStdlib_CWctransT"
+    where type CFieldType Stdlib_CWctransT
+                          "unwrapStdlib_CWctransT" = HsBindgen.Runtime.LibC.CWctransT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CWctypeT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 50:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWctypeT
+    = Stdlib_CWctypeT {unwrapStdlib_CWctypeT :: HsBindgen.Runtime.LibC.CWctypeT}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CWctypeT =>
+         HasField "unwrapStdlib_CWctypeT" Stdlib_CWctypeT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CWctypeT{unwrapStdlib_CWctypeT = y_1},
+                              getField @"unwrapStdlib_CWctypeT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CWctypeT =>
+         HasField "unwrapStdlib_CWctypeT" (Ptr Stdlib_CWctypeT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CWctypeT")
+instance HasCField Stdlib_CWctypeT "unwrapStdlib_CWctypeT"
+    where type CFieldType Stdlib_CWctypeT
+                          "unwrapStdlib_CWctypeT" = HsBindgen.Runtime.LibC.CWctypeT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CChar16T@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 51:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CChar16T
+    = Stdlib_CChar16T {unwrapStdlib_CChar16T :: HsBindgen.Runtime.LibC.CChar16T}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CChar16T =>
+         HasField "unwrapStdlib_CChar16T" Stdlib_CChar16T ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CChar16T{unwrapStdlib_CChar16T = y_1},
+                              getField @"unwrapStdlib_CChar16T" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CChar16T =>
+         HasField "unwrapStdlib_CChar16T" (Ptr Stdlib_CChar16T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CChar16T")
+instance HasCField Stdlib_CChar16T "unwrapStdlib_CChar16T"
+    where type CFieldType Stdlib_CChar16T
+                          "unwrapStdlib_CChar16T" = HsBindgen.Runtime.LibC.CChar16T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CChar32T@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 52:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CChar32T
+    = Stdlib_CChar32T {unwrapStdlib_CChar32T :: HsBindgen.Runtime.LibC.CChar32T}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CChar32T =>
+         HasField "unwrapStdlib_CChar32T" Stdlib_CChar32T ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CChar32T{unwrapStdlib_CChar32T = y_1},
+                              getField @"unwrapStdlib_CChar32T" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CChar32T =>
+         HasField "unwrapStdlib_CChar32T" (Ptr Stdlib_CChar32T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CChar32T")
+instance HasCField Stdlib_CChar32T "unwrapStdlib_CChar32T"
+    where type CFieldType Stdlib_CChar32T
+                          "unwrapStdlib_CChar32T" = HsBindgen.Runtime.LibC.CChar32T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CTime@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 55:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CTime
+    = Stdlib_CTime {unwrapStdlib_CTime :: HsBindgen.Runtime.LibC.CTime}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      HasFFIType,
+                      Num,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CTime =>
+         HasField "unwrapStdlib_CTime" Stdlib_CTime ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CTime{unwrapStdlib_CTime = y_1},
+                              getField @"unwrapStdlib_CTime" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CTime =>
+         HasField "unwrapStdlib_CTime" (Ptr Stdlib_CTime) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CTime")
+instance HasCField Stdlib_CTime "unwrapStdlib_CTime"
+    where type CFieldType Stdlib_CTime
+                          "unwrapStdlib_CTime" = HsBindgen.Runtime.LibC.CTime
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CClock@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 56:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CClock
+    = Stdlib_CClock {unwrapStdlib_CClock :: HsBindgen.Runtime.LibC.CClock}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      HasFFIType,
+                      Num,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CClock =>
+         HasField "unwrapStdlib_CClock" Stdlib_CClock ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CClock{unwrapStdlib_CClock = y_1},
+                              getField @"unwrapStdlib_CClock" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CClock =>
+         HasField "unwrapStdlib_CClock" (Ptr Stdlib_CClock) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CClock")
+instance HasCField Stdlib_CClock "unwrapStdlib_CClock"
+    where type CFieldType Stdlib_CClock
+                          "unwrapStdlib_CClock" = HsBindgen.Runtime.LibC.CClock
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CTm@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 57:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CTm
+    = Stdlib_CTm {unwrapStdlib_CTm :: HsBindgen.Runtime.LibC.CTm}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize)
+instance (~) ty HsBindgen.Runtime.LibC.CTm =>
+         HasField "unwrapStdlib_CTm" Stdlib_CTm ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CTm{unwrapStdlib_CTm = y_1},
+                              getField @"unwrapStdlib_CTm" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CTm =>
+         HasField "unwrapStdlib_CTm" (Ptr Stdlib_CTm) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CTm")
+instance HasCField Stdlib_CTm "unwrapStdlib_CTm"
+    where type CFieldType Stdlib_CTm
+                          "unwrapStdlib_CTm" = HsBindgen.Runtime.LibC.CTm
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CFile@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 60:16@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFile
+    = Stdlib_CFile {unwrapStdlib_CFile :: HsBindgen.Runtime.LibC.CFile}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CFile =>
+         HasField "unwrapStdlib_CFile" Stdlib_CFile ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CFile{unwrapStdlib_CFile = y_1},
+                              getField @"unwrapStdlib_CFile" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CFile =>
+         HasField "unwrapStdlib_CFile" (Ptr Stdlib_CFile) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CFile")
+instance HasCField Stdlib_CFile "unwrapStdlib_CFile"
+    where type CFieldType Stdlib_CFile
+                          "unwrapStdlib_CFile" = HsBindgen.Runtime.LibC.CFile
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CFpos@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 61:16@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFpos
+    = Stdlib_CFpos {unwrapStdlib_CFpos :: HsBindgen.Runtime.LibC.CFpos}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CFpos =>
+         HasField "unwrapStdlib_CFpos" Stdlib_CFpos ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CFpos{unwrapStdlib_CFpos = y_1},
+                              getField @"unwrapStdlib_CFpos" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CFpos =>
+         HasField "unwrapStdlib_CFpos" (Ptr Stdlib_CFpos) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CFpos")
+instance HasCField Stdlib_CFpos "unwrapStdlib_CFpos"
+    where type CFieldType Stdlib_CFpos
+                          "unwrapStdlib_CFpos" = HsBindgen.Runtime.LibC.CFpos
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CSigAtomic@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 64:22@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CSigAtomic
+    = Stdlib_CSigAtomic {unwrapStdlib_CSigAtomic :: HsBindgen.Runtime.LibC.CSigAtomic}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CSigAtomic =>
+         HasField "unwrapStdlib_CSigAtomic" Stdlib_CSigAtomic ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CSigAtomic{unwrapStdlib_CSigAtomic = y_1},
+                              getField @"unwrapStdlib_CSigAtomic" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSigAtomic =>
+         HasField "unwrapStdlib_CSigAtomic" (Ptr Stdlib_CSigAtomic) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CSigAtomic")
+instance HasCField Stdlib_CSigAtomic "unwrapStdlib_CSigAtomic"
+    where type CFieldType Stdlib_CSigAtomic
+                          "unwrapStdlib_CSigAtomic" = HsBindgen.Runtime.LibC.CSigAtomic
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c23-parse-all/Example.hs b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c23-parse-all/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c23-parse-all/Example.hs
@@ -0,0 +1,1460 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Stdlib_CBool(..)
+    , Example.Stdlib_Int8(..)
+    , Example.Stdlib_Int16(..)
+    , Example.Stdlib_Int32(..)
+    , Example.Stdlib_Int64(..)
+    , Example.Stdlib_Word8(..)
+    , Example.Stdlib_Word16(..)
+    , Example.Stdlib_Word32(..)
+    , Example.Stdlib_Word64(..)
+    , Example.Stdlib_CIntMax(..)
+    , Example.Stdlib_CUIntMax(..)
+    , Example.Stdlib_CIntPtr(..)
+    , Example.Stdlib_CUIntPtr(..)
+    , Example.Stdlib_CFenvT(..)
+    , Example.Stdlib_CFexceptT(..)
+    , Example.Stdlib_CSize(..)
+    , Example.Stdlib_CPtrdiff(..)
+    , Example.Stdlib_CJmpBuf(..)
+    , Example.Stdlib_CWchar(..)
+    , Example.Stdlib_CWintT(..)
+    , Example.Stdlib_CMbstateT(..)
+    , Example.Stdlib_CWctransT(..)
+    , Example.Stdlib_CWctypeT(..)
+    , Example.Stdlib_CChar16T(..)
+    , Example.Stdlib_CChar32T(..)
+    , Example.Stdlib_CTime(..)
+    , Example.Stdlib_CClock(..)
+    , Example.Stdlib_CTm(..)
+    , Example.Stdlib_CFile(..)
+    , Example.Stdlib_CFpos(..)
+    , Example.Stdlib_CSigAtomic(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @stdlib_CBool@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 18:14@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CBool = Stdlib_CBool
+  { unwrapStdlib_CBool :: BG.CBool
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CBool" Stdlib_CBool ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CBool {unwrapStdlib_CBool = y1}
+      , BG.getField @"unwrapStdlib_CBool" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "unwrapStdlib_CBool" (BG.Ptr Stdlib_CBool) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CBool")
+
+instance HasCField.HasCField Stdlib_CBool "unwrapStdlib_CBool" where
+
+  type CFieldType Stdlib_CBool "unwrapStdlib_CBool" =
+    BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Int8@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 21:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int8 = Stdlib_Int8
+  { unwrapStdlib_Int8 :: HsBindgen.Runtime.LibC.Int8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Int8" Stdlib_Int8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Int8 {unwrapStdlib_Int8 = y1}
+      , BG.getField @"unwrapStdlib_Int8" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "unwrapStdlib_Int8" (BG.Ptr Stdlib_Int8) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Int8")
+
+instance HasCField.HasCField Stdlib_Int8 "unwrapStdlib_Int8" where
+
+  type CFieldType Stdlib_Int8 "unwrapStdlib_Int8" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Int16@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 22:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int16 = Stdlib_Int16
+  { unwrapStdlib_Int16 :: HsBindgen.Runtime.LibC.Int16
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int16
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Int16" Stdlib_Int16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Int16 {unwrapStdlib_Int16 = y1}
+      , BG.getField @"unwrapStdlib_Int16" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int16
+         ) => BG.HasField "unwrapStdlib_Int16" (BG.Ptr Stdlib_Int16) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Int16")
+
+instance HasCField.HasCField Stdlib_Int16 "unwrapStdlib_Int16" where
+
+  type CFieldType Stdlib_Int16 "unwrapStdlib_Int16" =
+    HsBindgen.Runtime.LibC.Int16
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Int32@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 23:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int32 = Stdlib_Int32
+  { unwrapStdlib_Int32 :: HsBindgen.Runtime.LibC.Int32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Int32" Stdlib_Int32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Int32 {unwrapStdlib_Int32 = y1}
+      , BG.getField @"unwrapStdlib_Int32" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "unwrapStdlib_Int32" (BG.Ptr Stdlib_Int32) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Int32")
+
+instance HasCField.HasCField Stdlib_Int32 "unwrapStdlib_Int32" where
+
+  type CFieldType Stdlib_Int32 "unwrapStdlib_Int32" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Int64@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 24:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int64 = Stdlib_Int64
+  { unwrapStdlib_Int64 :: HsBindgen.Runtime.LibC.Int64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Int64" Stdlib_Int64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Int64 {unwrapStdlib_Int64 = y1}
+      , BG.getField @"unwrapStdlib_Int64" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "unwrapStdlib_Int64" (BG.Ptr Stdlib_Int64) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Int64")
+
+instance HasCField.HasCField Stdlib_Int64 "unwrapStdlib_Int64" where
+
+  type CFieldType Stdlib_Int64 "unwrapStdlib_Int64" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Word8@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 25:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word8 = Stdlib_Word8
+  { unwrapStdlib_Word8 :: HsBindgen.Runtime.LibC.Word8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Word8" Stdlib_Word8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Word8 {unwrapStdlib_Word8 = y1}
+      , BG.getField @"unwrapStdlib_Word8" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "unwrapStdlib_Word8" (BG.Ptr Stdlib_Word8) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Word8")
+
+instance HasCField.HasCField Stdlib_Word8 "unwrapStdlib_Word8" where
+
+  type CFieldType Stdlib_Word8 "unwrapStdlib_Word8" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Word16@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 26:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word16 = Stdlib_Word16
+  { unwrapStdlib_Word16 :: HsBindgen.Runtime.LibC.Word16
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Word16" Stdlib_Word16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Word16 {unwrapStdlib_Word16 = y1}
+      , BG.getField @"unwrapStdlib_Word16" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.HasField "unwrapStdlib_Word16" (BG.Ptr Stdlib_Word16) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Word16")
+
+instance HasCField.HasCField Stdlib_Word16 "unwrapStdlib_Word16" where
+
+  type CFieldType Stdlib_Word16 "unwrapStdlib_Word16" =
+    HsBindgen.Runtime.LibC.Word16
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Word32@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 27:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word32 = Stdlib_Word32
+  { unwrapStdlib_Word32 :: HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Word32" Stdlib_Word32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Word32 {unwrapStdlib_Word32 = y1}
+      , BG.getField @"unwrapStdlib_Word32" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "unwrapStdlib_Word32" (BG.Ptr Stdlib_Word32) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Word32")
+
+instance HasCField.HasCField Stdlib_Word32 "unwrapStdlib_Word32" where
+
+  type CFieldType Stdlib_Word32 "unwrapStdlib_Word32" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_Word64@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 28:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word64 = Stdlib_Word64
+  { unwrapStdlib_Word64 :: HsBindgen.Runtime.LibC.Word64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "unwrapStdlib_Word64" Stdlib_Word64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_Word64 {unwrapStdlib_Word64 = y1}
+      , BG.getField @"unwrapStdlib_Word64" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "unwrapStdlib_Word64" (BG.Ptr Stdlib_Word64) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_Word64")
+
+instance HasCField.HasCField Stdlib_Word64 "unwrapStdlib_Word64" where
+
+  type CFieldType Stdlib_Word64 "unwrapStdlib_Word64" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CIntMax@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 29:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CIntMax = Stdlib_CIntMax
+  { unwrapStdlib_CIntMax :: HsBindgen.Runtime.LibC.CIntMax
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CIntMax
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CIntMax" Stdlib_CIntMax ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CIntMax {unwrapStdlib_CIntMax = y1}
+      , BG.getField @"unwrapStdlib_CIntMax" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CIntMax
+         ) => BG.HasField "unwrapStdlib_CIntMax" (BG.Ptr Stdlib_CIntMax) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CIntMax")
+
+instance HasCField.HasCField Stdlib_CIntMax "unwrapStdlib_CIntMax" where
+
+  type CFieldType Stdlib_CIntMax "unwrapStdlib_CIntMax" =
+    HsBindgen.Runtime.LibC.CIntMax
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CUIntMax@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 30:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CUIntMax = Stdlib_CUIntMax
+  { unwrapStdlib_CUIntMax :: HsBindgen.Runtime.LibC.CUIntMax
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CUIntMax
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CUIntMax" Stdlib_CUIntMax ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CUIntMax {unwrapStdlib_CUIntMax = y1}
+      , BG.getField @"unwrapStdlib_CUIntMax" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CUIntMax
+         ) => BG.HasField "unwrapStdlib_CUIntMax" (BG.Ptr Stdlib_CUIntMax) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CUIntMax")
+
+instance HasCField.HasCField Stdlib_CUIntMax "unwrapStdlib_CUIntMax" where
+
+  type CFieldType Stdlib_CUIntMax "unwrapStdlib_CUIntMax" =
+    HsBindgen.Runtime.LibC.CUIntMax
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CIntPtr@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 31:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CIntPtr = Stdlib_CIntPtr
+  { unwrapStdlib_CIntPtr :: HsBindgen.Runtime.LibC.CIntPtr
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CIntPtr
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CIntPtr" Stdlib_CIntPtr ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CIntPtr {unwrapStdlib_CIntPtr = y1}
+      , BG.getField @"unwrapStdlib_CIntPtr" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CIntPtr
+         ) => BG.HasField "unwrapStdlib_CIntPtr" (BG.Ptr Stdlib_CIntPtr) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CIntPtr")
+
+instance HasCField.HasCField Stdlib_CIntPtr "unwrapStdlib_CIntPtr" where
+
+  type CFieldType Stdlib_CIntPtr "unwrapStdlib_CIntPtr" =
+    HsBindgen.Runtime.LibC.CIntPtr
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CUIntPtr@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 32:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CUIntPtr = Stdlib_CUIntPtr
+  { unwrapStdlib_CUIntPtr :: HsBindgen.Runtime.LibC.CUIntPtr
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CUIntPtr
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CUIntPtr" Stdlib_CUIntPtr ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CUIntPtr {unwrapStdlib_CUIntPtr = y1}
+      , BG.getField @"unwrapStdlib_CUIntPtr" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CUIntPtr
+         ) => BG.HasField "unwrapStdlib_CUIntPtr" (BG.Ptr Stdlib_CUIntPtr) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CUIntPtr")
+
+instance HasCField.HasCField Stdlib_CUIntPtr "unwrapStdlib_CUIntPtr" where
+
+  type CFieldType Stdlib_CUIntPtr "unwrapStdlib_CUIntPtr" =
+    HsBindgen.Runtime.LibC.CUIntPtr
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CFenvT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 35:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFenvT = Stdlib_CFenvT
+  { unwrapStdlib_CFenvT :: HsBindgen.Runtime.LibC.CFenvT
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFenvT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CFenvT" Stdlib_CFenvT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CFenvT {unwrapStdlib_CFenvT = y1}
+      , BG.getField @"unwrapStdlib_CFenvT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFenvT
+         ) => BG.HasField "unwrapStdlib_CFenvT" (BG.Ptr Stdlib_CFenvT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CFenvT")
+
+instance HasCField.HasCField Stdlib_CFenvT "unwrapStdlib_CFenvT" where
+
+  type CFieldType Stdlib_CFenvT "unwrapStdlib_CFenvT" =
+    HsBindgen.Runtime.LibC.CFenvT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CFexceptT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 36:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFexceptT = Stdlib_CFexceptT
+  { unwrapStdlib_CFexceptT :: HsBindgen.Runtime.LibC.CFexceptT
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFexceptT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CFexceptT" Stdlib_CFexceptT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Stdlib_CFexceptT {unwrapStdlib_CFexceptT = y1}
+      , BG.getField @"unwrapStdlib_CFexceptT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFexceptT
+         ) => BG.HasField "unwrapStdlib_CFexceptT" (BG.Ptr Stdlib_CFexceptT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CFexceptT")
+
+instance HasCField.HasCField Stdlib_CFexceptT "unwrapStdlib_CFexceptT" where
+
+  type CFieldType Stdlib_CFexceptT "unwrapStdlib_CFexceptT" =
+    HsBindgen.Runtime.LibC.CFexceptT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CSize@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 39:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CSize = Stdlib_CSize
+  { unwrapStdlib_CSize :: HsBindgen.Runtime.LibC.CSize
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CSize" Stdlib_CSize ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CSize {unwrapStdlib_CSize = y1}
+      , BG.getField @"unwrapStdlib_CSize" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.HasField "unwrapStdlib_CSize" (BG.Ptr Stdlib_CSize) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CSize")
+
+instance HasCField.HasCField Stdlib_CSize "unwrapStdlib_CSize" where
+
+  type CFieldType Stdlib_CSize "unwrapStdlib_CSize" =
+    HsBindgen.Runtime.LibC.CSize
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CPtrdiff@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 40:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CPtrdiff = Stdlib_CPtrdiff
+  { unwrapStdlib_CPtrdiff :: HsBindgen.Runtime.LibC.CPtrdiff
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CPtrdiff
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CPtrdiff" Stdlib_CPtrdiff ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CPtrdiff {unwrapStdlib_CPtrdiff = y1}
+      , BG.getField @"unwrapStdlib_CPtrdiff" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CPtrdiff
+         ) => BG.HasField "unwrapStdlib_CPtrdiff" (BG.Ptr Stdlib_CPtrdiff) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CPtrdiff")
+
+instance HasCField.HasCField Stdlib_CPtrdiff "unwrapStdlib_CPtrdiff" where
+
+  type CFieldType Stdlib_CPtrdiff "unwrapStdlib_CPtrdiff" =
+    HsBindgen.Runtime.LibC.CPtrdiff
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CJmpBuf@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 43:17@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CJmpBuf = Stdlib_CJmpBuf
+  { unwrapStdlib_CJmpBuf :: HsBindgen.Runtime.LibC.CJmpBuf
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CJmpBuf
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CJmpBuf" Stdlib_CJmpBuf ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CJmpBuf {unwrapStdlib_CJmpBuf = y1}
+      , BG.getField @"unwrapStdlib_CJmpBuf" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CJmpBuf
+         ) => BG.HasField "unwrapStdlib_CJmpBuf" (BG.Ptr Stdlib_CJmpBuf) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CJmpBuf")
+
+instance HasCField.HasCField Stdlib_CJmpBuf "unwrapStdlib_CJmpBuf" where
+
+  type CFieldType Stdlib_CJmpBuf "unwrapStdlib_CJmpBuf" =
+    HsBindgen.Runtime.LibC.CJmpBuf
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CWchar@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 46:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWchar = Stdlib_CWchar
+  { unwrapStdlib_CWchar :: HsBindgen.Runtime.LibC.CWchar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWchar
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CWchar" Stdlib_CWchar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CWchar {unwrapStdlib_CWchar = y1}
+      , BG.getField @"unwrapStdlib_CWchar" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWchar
+         ) => BG.HasField "unwrapStdlib_CWchar" (BG.Ptr Stdlib_CWchar) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CWchar")
+
+instance HasCField.HasCField Stdlib_CWchar "unwrapStdlib_CWchar" where
+
+  type CFieldType Stdlib_CWchar "unwrapStdlib_CWchar" =
+    HsBindgen.Runtime.LibC.CWchar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CWintT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 47:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWintT = Stdlib_CWintT
+  { unwrapStdlib_CWintT :: HsBindgen.Runtime.LibC.CWintT
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWintT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CWintT" Stdlib_CWintT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CWintT {unwrapStdlib_CWintT = y1}
+      , BG.getField @"unwrapStdlib_CWintT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWintT
+         ) => BG.HasField "unwrapStdlib_CWintT" (BG.Ptr Stdlib_CWintT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CWintT")
+
+instance HasCField.HasCField Stdlib_CWintT "unwrapStdlib_CWintT" where
+
+  type CFieldType Stdlib_CWintT "unwrapStdlib_CWintT" =
+    HsBindgen.Runtime.LibC.CWintT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CMbstateT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 48:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CMbstateT = Stdlib_CMbstateT
+  { unwrapStdlib_CMbstateT :: HsBindgen.Runtime.LibC.CMbstateT
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CMbstateT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CMbstateT" Stdlib_CMbstateT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Stdlib_CMbstateT {unwrapStdlib_CMbstateT = y1}
+      , BG.getField @"unwrapStdlib_CMbstateT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CMbstateT
+         ) => BG.HasField "unwrapStdlib_CMbstateT" (BG.Ptr Stdlib_CMbstateT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CMbstateT")
+
+instance HasCField.HasCField Stdlib_CMbstateT "unwrapStdlib_CMbstateT" where
+
+  type CFieldType Stdlib_CMbstateT "unwrapStdlib_CMbstateT" =
+    HsBindgen.Runtime.LibC.CMbstateT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CWctransT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 49:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWctransT = Stdlib_CWctransT
+  { unwrapStdlib_CWctransT :: HsBindgen.Runtime.LibC.CWctransT
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWctransT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CWctransT" Stdlib_CWctransT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Stdlib_CWctransT {unwrapStdlib_CWctransT = y1}
+      , BG.getField @"unwrapStdlib_CWctransT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWctransT
+         ) => BG.HasField "unwrapStdlib_CWctransT" (BG.Ptr Stdlib_CWctransT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CWctransT")
+
+instance HasCField.HasCField Stdlib_CWctransT "unwrapStdlib_CWctransT" where
+
+  type CFieldType Stdlib_CWctransT "unwrapStdlib_CWctransT" =
+    HsBindgen.Runtime.LibC.CWctransT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CWctypeT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 50:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWctypeT = Stdlib_CWctypeT
+  { unwrapStdlib_CWctypeT :: HsBindgen.Runtime.LibC.CWctypeT
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWctypeT
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CWctypeT" Stdlib_CWctypeT ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CWctypeT {unwrapStdlib_CWctypeT = y1}
+      , BG.getField @"unwrapStdlib_CWctypeT" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CWctypeT
+         ) => BG.HasField "unwrapStdlib_CWctypeT" (BG.Ptr Stdlib_CWctypeT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CWctypeT")
+
+instance HasCField.HasCField Stdlib_CWctypeT "unwrapStdlib_CWctypeT" where
+
+  type CFieldType Stdlib_CWctypeT "unwrapStdlib_CWctypeT" =
+    HsBindgen.Runtime.LibC.CWctypeT
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CChar16T@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 51:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CChar16T = Stdlib_CChar16T
+  { unwrapStdlib_CChar16T :: HsBindgen.Runtime.LibC.CChar16T
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CChar16T
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CChar16T" Stdlib_CChar16T ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CChar16T {unwrapStdlib_CChar16T = y1}
+      , BG.getField @"unwrapStdlib_CChar16T" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CChar16T
+         ) => BG.HasField "unwrapStdlib_CChar16T" (BG.Ptr Stdlib_CChar16T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CChar16T")
+
+instance HasCField.HasCField Stdlib_CChar16T "unwrapStdlib_CChar16T" where
+
+  type CFieldType Stdlib_CChar16T "unwrapStdlib_CChar16T" =
+    HsBindgen.Runtime.LibC.CChar16T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CChar32T@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 52:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CChar32T = Stdlib_CChar32T
+  { unwrapStdlib_CChar32T :: HsBindgen.Runtime.LibC.CChar32T
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CChar32T
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CChar32T" Stdlib_CChar32T ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CChar32T {unwrapStdlib_CChar32T = y1}
+      , BG.getField @"unwrapStdlib_CChar32T" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CChar32T
+         ) => BG.HasField "unwrapStdlib_CChar32T" (BG.Ptr Stdlib_CChar32T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CChar32T")
+
+instance HasCField.HasCField Stdlib_CChar32T "unwrapStdlib_CChar32T" where
+
+  type CFieldType Stdlib_CChar32T "unwrapStdlib_CChar32T" =
+    HsBindgen.Runtime.LibC.CChar32T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CTime@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 55:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CTime = Stdlib_CTime
+  { unwrapStdlib_CTime :: HsBindgen.Runtime.LibC.CTime
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , BG.HasFFIType
+    , Num
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CTime
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CTime" Stdlib_CTime ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CTime {unwrapStdlib_CTime = y1}
+      , BG.getField @"unwrapStdlib_CTime" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CTime
+         ) => BG.HasField "unwrapStdlib_CTime" (BG.Ptr Stdlib_CTime) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CTime")
+
+instance HasCField.HasCField Stdlib_CTime "unwrapStdlib_CTime" where
+
+  type CFieldType Stdlib_CTime "unwrapStdlib_CTime" =
+    HsBindgen.Runtime.LibC.CTime
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CClock@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 56:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CClock = Stdlib_CClock
+  { unwrapStdlib_CClock :: HsBindgen.Runtime.LibC.CClock
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , BG.HasFFIType
+    , Num
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CClock
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CClock" Stdlib_CClock ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CClock {unwrapStdlib_CClock = y1}
+      , BG.getField @"unwrapStdlib_CClock" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CClock
+         ) => BG.HasField "unwrapStdlib_CClock" (BG.Ptr Stdlib_CClock) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CClock")
+
+instance HasCField.HasCField Stdlib_CClock "unwrapStdlib_CClock" where
+
+  type CFieldType Stdlib_CClock "unwrapStdlib_CClock" =
+    HsBindgen.Runtime.LibC.CClock
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CTm@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 57:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CTm = Stdlib_CTm
+  { unwrapStdlib_CTm :: HsBindgen.Runtime.LibC.CTm
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (Marshal.ReadRaw, Marshal.StaticSize)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CTm
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CTm" Stdlib_CTm ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CTm {unwrapStdlib_CTm = y1}
+      , BG.getField @"unwrapStdlib_CTm" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CTm
+         ) => BG.HasField "unwrapStdlib_CTm" (BG.Ptr Stdlib_CTm) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CTm")
+
+instance HasCField.HasCField Stdlib_CTm "unwrapStdlib_CTm" where
+
+  type CFieldType Stdlib_CTm "unwrapStdlib_CTm" =
+    HsBindgen.Runtime.LibC.CTm
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CFile@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 60:16@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFile = Stdlib_CFile
+  { unwrapStdlib_CFile :: HsBindgen.Runtime.LibC.CFile
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFile
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CFile" Stdlib_CFile ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CFile {unwrapStdlib_CFile = y1}
+      , BG.getField @"unwrapStdlib_CFile" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFile
+         ) => BG.HasField "unwrapStdlib_CFile" (BG.Ptr Stdlib_CFile) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CFile")
+
+instance HasCField.HasCField Stdlib_CFile "unwrapStdlib_CFile" where
+
+  type CFieldType Stdlib_CFile "unwrapStdlib_CFile" =
+    HsBindgen.Runtime.LibC.CFile
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CFpos@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 61:16@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFpos = Stdlib_CFpos
+  { unwrapStdlib_CFpos :: HsBindgen.Runtime.LibC.CFpos
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFpos
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CFpos" Stdlib_CFpos ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Stdlib_CFpos {unwrapStdlib_CFpos = y1}
+      , BG.getField @"unwrapStdlib_CFpos" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CFpos
+         ) => BG.HasField "unwrapStdlib_CFpos" (BG.Ptr Stdlib_CFpos) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CFpos")
+
+instance HasCField.HasCField Stdlib_CFpos "unwrapStdlib_CFpos" where
+
+  type CFieldType Stdlib_CFpos "unwrapStdlib_CFpos" =
+    HsBindgen.Runtime.LibC.CFpos
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @stdlib_CSigAtomic@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 64:22@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CSigAtomic = Stdlib_CSigAtomic
+  { unwrapStdlib_CSigAtomic :: HsBindgen.Runtime.LibC.CSigAtomic
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSigAtomic
+         ) => BG.CompatHasField.HasField "unwrapStdlib_CSigAtomic" Stdlib_CSigAtomic ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Stdlib_CSigAtomic {unwrapStdlib_CSigAtomic = y1}
+      , BG.getField @"unwrapStdlib_CSigAtomic" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSigAtomic
+         ) => BG.HasField "unwrapStdlib_CSigAtomic" (BG.Ptr Stdlib_CSigAtomic) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStdlib_CSigAtomic")
+
+instance HasCField.HasCField Stdlib_CSigAtomic "unwrapStdlib_CSigAtomic" where
+
+  type CFieldType Stdlib_CSigAtomic "unwrapStdlib_CSigAtomic" =
+    HsBindgen.Runtime.LibC.CSigAtomic
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c23-parse-all/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c23-parse-all/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c23-parse-all/bindingspec.yaml
@@ -0,0 +1,970 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CBool
+  hsname: Stdlib_CBool
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Int8
+  hsname: Stdlib_Int8
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Int16
+  hsname: Stdlib_Int16
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Int32
+  hsname: Stdlib_Int32
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Int64
+  hsname: Stdlib_Int64
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Word8
+  hsname: Stdlib_Word8
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Word16
+  hsname: Stdlib_Word16
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Word32
+  hsname: Stdlib_Word32
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_Word64
+  hsname: Stdlib_Word64
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CIntMax
+  hsname: Stdlib_CIntMax
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CUIntMax
+  hsname: Stdlib_CUIntMax
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CIntPtr
+  hsname: Stdlib_CIntPtr
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CUIntPtr
+  hsname: Stdlib_CUIntPtr
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CFenvT
+  hsname: Stdlib_CFenvT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CFexceptT
+  hsname: Stdlib_CFexceptT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CSize
+  hsname: Stdlib_CSize
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CPtrdiff
+  hsname: Stdlib_CPtrdiff
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CJmpBuf
+  hsname: Stdlib_CJmpBuf
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CWchar
+  hsname: Stdlib_CWchar
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CWintT
+  hsname: Stdlib_CWintT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CMbstateT
+  hsname: Stdlib_CMbstateT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CWctransT
+  hsname: Stdlib_CWctransT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CWctypeT
+  hsname: Stdlib_CWctypeT
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CChar16T
+  hsname: Stdlib_CChar16T
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CChar32T
+  hsname: Stdlib_CChar32T
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CTime
+  hsname: Stdlib_CTime
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CClock
+  hsname: Stdlib_CClock
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CTm
+  hsname: Stdlib_CTm
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CFile
+  hsname: Stdlib_CFile
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CFpos
+  hsname: Stdlib_CFpos
+- headers: binding-specs/stdlib/instances.h
+  cname: stdlib_CSigAtomic
+  hsname: Stdlib_CSigAtomic
+hstypes:
+- hsname: Stdlib_CBool
+  representation:
+    newtype:
+      constructor: Stdlib_CBool
+      fields:
+      - unwrapStdlib_CBool
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CBool
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CChar16T
+  representation:
+    newtype:
+      constructor: Stdlib_CChar16T
+      fields:
+      - unwrapStdlib_CChar16T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CChar16T
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CChar32T
+  representation:
+    newtype:
+      constructor: Stdlib_CChar32T
+      fields:
+      - unwrapStdlib_CChar32T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CChar32T
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CClock
+  representation:
+    newtype:
+      constructor: Stdlib_CClock
+      fields:
+      - unwrapStdlib_CClock
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CClock
+  instances:
+  - Enum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CFenvT
+  representation:
+    newtype:
+      constructor: Stdlib_CFenvT
+      fields:
+      - unwrapStdlib_CFenvT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CFexceptT
+  representation:
+    newtype:
+      constructor: Stdlib_CFexceptT
+      fields:
+      - unwrapStdlib_CFexceptT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUShort
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CFile
+  representation:
+    newtype:
+      constructor: Stdlib_CFile
+      fields:
+      - unwrapStdlib_CFile
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CFpos
+  representation:
+    newtype:
+      constructor: Stdlib_CFpos
+      fields:
+      - unwrapStdlib_CFpos
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CIntMax
+  representation:
+    newtype:
+      constructor: Stdlib_CIntMax
+      fields:
+      - unwrapStdlib_CIntMax
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CIntMax
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CIntPtr
+  representation:
+    newtype:
+      constructor: Stdlib_CIntPtr
+      fields:
+      - unwrapStdlib_CIntPtr
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CIntPtr
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CJmpBuf
+  representation:
+    newtype:
+      constructor: Stdlib_CJmpBuf
+      fields:
+      - unwrapStdlib_CJmpBuf
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CMbstateT
+  representation:
+    newtype:
+      constructor: Stdlib_CMbstateT
+      fields:
+      - unwrapStdlib_CMbstateT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Stdlib_CPtrdiff
+  representation:
+    newtype:
+      constructor: Stdlib_CPtrdiff
+      fields:
+      - unwrapStdlib_CPtrdiff
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CPtrdiff
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CSigAtomic
+  representation:
+    newtype:
+      constructor: Stdlib_CSigAtomic
+      fields:
+      - unwrapStdlib_CSigAtomic
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CSigAtomic
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CSize
+  representation:
+    newtype:
+      constructor: Stdlib_CSize
+      fields:
+      - unwrapStdlib_CSize
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CSize
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CTime
+  representation:
+    newtype:
+      constructor: Stdlib_CTime
+      fields:
+      - unwrapStdlib_CTime
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CTime
+  instances:
+  - Enum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CTm
+  representation:
+    newtype:
+      constructor: Stdlib_CTm
+      fields:
+      - unwrapStdlib_CTm
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+- hsname: Stdlib_CUIntMax
+  representation:
+    newtype:
+      constructor: Stdlib_CUIntMax
+      fields:
+      - unwrapStdlib_CUIntMax
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CUIntMax
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CUIntPtr
+  representation:
+    newtype:
+      constructor: Stdlib_CUIntPtr
+      fields:
+      - unwrapStdlib_CUIntPtr
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CUIntPtr
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CWchar
+  representation:
+    newtype:
+      constructor: Stdlib_CWchar
+      fields:
+      - unwrapStdlib_CWchar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CWchar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CWctransT
+  representation:
+    newtype:
+      constructor: Stdlib_CWctransT
+      fields:
+      - unwrapStdlib_CWctransT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CWctransT
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Prim
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CWctypeT
+  representation:
+    newtype:
+      constructor: Stdlib_CWctypeT
+      fields:
+      - unwrapStdlib_CWctypeT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CWctypeT
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Prim
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_CWintT
+  representation:
+    newtype:
+      constructor: Stdlib_CWintT
+      fields:
+      - unwrapStdlib_CWintT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CWintT
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Int16
+  representation:
+    newtype:
+      constructor: Stdlib_Int16
+      fields:
+      - unwrapStdlib_Int16
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int16
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Int32
+  representation:
+    newtype:
+      constructor: Stdlib_Int32
+      fields:
+      - unwrapStdlib_Int32
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Int64
+  representation:
+    newtype:
+      constructor: Stdlib_Int64
+      fields:
+      - unwrapStdlib_Int64
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Int8
+  representation:
+    newtype:
+      constructor: Stdlib_Int8
+      fields:
+      - unwrapStdlib_Int8
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Word16
+  representation:
+    newtype:
+      constructor: Stdlib_Word16
+      fields:
+      - unwrapStdlib_Word16
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word16
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Word32
+  representation:
+    newtype:
+      constructor: Stdlib_Word32
+      fields:
+      - unwrapStdlib_Word32
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Word64
+  representation:
+    newtype:
+      constructor: Stdlib_Word64
+      fields:
+      - unwrapStdlib_Word64
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Stdlib_Word8
+  representation:
+    newtype:
+      constructor: Stdlib_Word8
+      fields:
+      - unwrapStdlib_Word8
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c23-parse-all/th.txt b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c23-parse-all/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/instances.1.c23-parse-all/th.txt
@@ -0,0 +1,966 @@
+-- addDependentFile musl-include/x86_64/bits/fenv.h
+-- addDependentFile musl-include/x86_64/fenv.h
+-- addDependentFile musl-include/x86_64/features.h
+-- addDependentFile musl-include/x86_64/bits/setjmp.h
+-- addDependentFile musl-include/x86_64/setjmp.h
+-- addDependentFile musl-include/x86_64/bits/signal.h
+-- addDependentFile musl-include/x86_64/signal.h
+-- addDependentFile musl-include/x86_64/stdbool.h
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile musl-include/x86_64/stdio.h
+-- addDependentFile musl-include/x86_64/time.h
+-- addDependentFile musl-include/x86_64/uchar.h
+-- addDependentFile musl-include/x86_64/wchar.h
+-- addDependentFile musl-include/x86_64/wctype.h
+-- addDependentFile test-artefacts/headers/golden/binding-specs/stdlib/instances.h
+{-| __C declaration:__ @stdlib_CBool@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 18:14@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CBool
+    = Stdlib_CBool {unwrapStdlib_CBool :: CBool}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CBool =>
+         HasField "unwrapStdlib_CBool" Stdlib_CBool ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CBool{unwrapStdlib_CBool = y_1},
+                              getField @"unwrapStdlib_CBool" x_0)
+instance (~) ty CBool =>
+         HasField "unwrapStdlib_CBool" (Ptr Stdlib_CBool) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CBool")
+instance HasCField Stdlib_CBool "unwrapStdlib_CBool"
+    where type CFieldType Stdlib_CBool "unwrapStdlib_CBool" = CBool
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Int8@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 21:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int8
+    = Stdlib_Int8 {unwrapStdlib_Int8 :: HsBindgen.Runtime.LibC.Int8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapStdlib_Int8" Stdlib_Int8 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Int8{unwrapStdlib_Int8 = y_1},
+                              getField @"unwrapStdlib_Int8" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapStdlib_Int8" (Ptr Stdlib_Int8) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Int8")
+instance HasCField Stdlib_Int8 "unwrapStdlib_Int8"
+    where type CFieldType Stdlib_Int8
+                          "unwrapStdlib_Int8" = HsBindgen.Runtime.LibC.Int8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Int16@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 22:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int16
+    = Stdlib_Int16 {unwrapStdlib_Int16 :: HsBindgen.Runtime.LibC.Int16}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int16 =>
+         HasField "unwrapStdlib_Int16" Stdlib_Int16 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Int16{unwrapStdlib_Int16 = y_1},
+                              getField @"unwrapStdlib_Int16" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int16 =>
+         HasField "unwrapStdlib_Int16" (Ptr Stdlib_Int16) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Int16")
+instance HasCField Stdlib_Int16 "unwrapStdlib_Int16"
+    where type CFieldType Stdlib_Int16
+                          "unwrapStdlib_Int16" = HsBindgen.Runtime.LibC.Int16
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Int32@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 23:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int32
+    = Stdlib_Int32 {unwrapStdlib_Int32 :: HsBindgen.Runtime.LibC.Int32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapStdlib_Int32" Stdlib_Int32 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Int32{unwrapStdlib_Int32 = y_1},
+                              getField @"unwrapStdlib_Int32" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapStdlib_Int32" (Ptr Stdlib_Int32) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Int32")
+instance HasCField Stdlib_Int32 "unwrapStdlib_Int32"
+    where type CFieldType Stdlib_Int32
+                          "unwrapStdlib_Int32" = HsBindgen.Runtime.LibC.Int32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Int64@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 24:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Int64
+    = Stdlib_Int64 {unwrapStdlib_Int64 :: HsBindgen.Runtime.LibC.Int64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapStdlib_Int64" Stdlib_Int64 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Int64{unwrapStdlib_Int64 = y_1},
+                              getField @"unwrapStdlib_Int64" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapStdlib_Int64" (Ptr Stdlib_Int64) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Int64")
+instance HasCField Stdlib_Int64 "unwrapStdlib_Int64"
+    where type CFieldType Stdlib_Int64
+                          "unwrapStdlib_Int64" = HsBindgen.Runtime.LibC.Int64
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Word8@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 25:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word8
+    = Stdlib_Word8 {unwrapStdlib_Word8 :: HsBindgen.Runtime.LibC.Word8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapStdlib_Word8" Stdlib_Word8 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Word8{unwrapStdlib_Word8 = y_1},
+                              getField @"unwrapStdlib_Word8" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapStdlib_Word8" (Ptr Stdlib_Word8) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Word8")
+instance HasCField Stdlib_Word8 "unwrapStdlib_Word8"
+    where type CFieldType Stdlib_Word8
+                          "unwrapStdlib_Word8" = HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Word16@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 26:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word16
+    = Stdlib_Word16 {unwrapStdlib_Word16 :: HsBindgen.Runtime.LibC.Word16}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "unwrapStdlib_Word16" Stdlib_Word16 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Word16{unwrapStdlib_Word16 = y_1},
+                              getField @"unwrapStdlib_Word16" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "unwrapStdlib_Word16" (Ptr Stdlib_Word16) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Word16")
+instance HasCField Stdlib_Word16 "unwrapStdlib_Word16"
+    where type CFieldType Stdlib_Word16
+                          "unwrapStdlib_Word16" = HsBindgen.Runtime.LibC.Word16
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Word32@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 27:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word32
+    = Stdlib_Word32 {unwrapStdlib_Word32 :: HsBindgen.Runtime.LibC.Word32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapStdlib_Word32" Stdlib_Word32 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Word32{unwrapStdlib_Word32 = y_1},
+                              getField @"unwrapStdlib_Word32" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapStdlib_Word32" (Ptr Stdlib_Word32) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Word32")
+instance HasCField Stdlib_Word32 "unwrapStdlib_Word32"
+    where type CFieldType Stdlib_Word32
+                          "unwrapStdlib_Word32" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_Word64@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 28:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_Word64
+    = Stdlib_Word64 {unwrapStdlib_Word64 :: HsBindgen.Runtime.LibC.Word64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapStdlib_Word64" Stdlib_Word64 ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_Word64{unwrapStdlib_Word64 = y_1},
+                              getField @"unwrapStdlib_Word64" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapStdlib_Word64" (Ptr Stdlib_Word64) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_Word64")
+instance HasCField Stdlib_Word64 "unwrapStdlib_Word64"
+    where type CFieldType Stdlib_Word64
+                          "unwrapStdlib_Word64" = HsBindgen.Runtime.LibC.Word64
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CIntMax@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 29:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CIntMax
+    = Stdlib_CIntMax {unwrapStdlib_CIntMax :: HsBindgen.Runtime.LibC.CIntMax}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CIntMax =>
+         HasField "unwrapStdlib_CIntMax" Stdlib_CIntMax ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CIntMax{unwrapStdlib_CIntMax = y_1},
+                              getField @"unwrapStdlib_CIntMax" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CIntMax =>
+         HasField "unwrapStdlib_CIntMax" (Ptr Stdlib_CIntMax) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CIntMax")
+instance HasCField Stdlib_CIntMax "unwrapStdlib_CIntMax"
+    where type CFieldType Stdlib_CIntMax
+                          "unwrapStdlib_CIntMax" = HsBindgen.Runtime.LibC.CIntMax
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CUIntMax@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 30:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CUIntMax
+    = Stdlib_CUIntMax {unwrapStdlib_CUIntMax :: HsBindgen.Runtime.LibC.CUIntMax}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CUIntMax =>
+         HasField "unwrapStdlib_CUIntMax" Stdlib_CUIntMax ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CUIntMax{unwrapStdlib_CUIntMax = y_1},
+                              getField @"unwrapStdlib_CUIntMax" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CUIntMax =>
+         HasField "unwrapStdlib_CUIntMax" (Ptr Stdlib_CUIntMax) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CUIntMax")
+instance HasCField Stdlib_CUIntMax "unwrapStdlib_CUIntMax"
+    where type CFieldType Stdlib_CUIntMax
+                          "unwrapStdlib_CUIntMax" = HsBindgen.Runtime.LibC.CUIntMax
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CIntPtr@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 31:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CIntPtr
+    = Stdlib_CIntPtr {unwrapStdlib_CIntPtr :: HsBindgen.Runtime.LibC.CIntPtr}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CIntPtr =>
+         HasField "unwrapStdlib_CIntPtr" Stdlib_CIntPtr ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CIntPtr{unwrapStdlib_CIntPtr = y_1},
+                              getField @"unwrapStdlib_CIntPtr" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CIntPtr =>
+         HasField "unwrapStdlib_CIntPtr" (Ptr Stdlib_CIntPtr) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CIntPtr")
+instance HasCField Stdlib_CIntPtr "unwrapStdlib_CIntPtr"
+    where type CFieldType Stdlib_CIntPtr
+                          "unwrapStdlib_CIntPtr" = HsBindgen.Runtime.LibC.CIntPtr
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CUIntPtr@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 32:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CUIntPtr
+    = Stdlib_CUIntPtr {unwrapStdlib_CUIntPtr :: HsBindgen.Runtime.LibC.CUIntPtr}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CUIntPtr =>
+         HasField "unwrapStdlib_CUIntPtr" Stdlib_CUIntPtr ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CUIntPtr{unwrapStdlib_CUIntPtr = y_1},
+                              getField @"unwrapStdlib_CUIntPtr" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CUIntPtr =>
+         HasField "unwrapStdlib_CUIntPtr" (Ptr Stdlib_CUIntPtr) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CUIntPtr")
+instance HasCField Stdlib_CUIntPtr "unwrapStdlib_CUIntPtr"
+    where type CFieldType Stdlib_CUIntPtr
+                          "unwrapStdlib_CUIntPtr" = HsBindgen.Runtime.LibC.CUIntPtr
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CFenvT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 35:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFenvT
+    = Stdlib_CFenvT {unwrapStdlib_CFenvT :: HsBindgen.Runtime.LibC.CFenvT}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CFenvT =>
+         HasField "unwrapStdlib_CFenvT" Stdlib_CFenvT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CFenvT{unwrapStdlib_CFenvT = y_1},
+                              getField @"unwrapStdlib_CFenvT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CFenvT =>
+         HasField "unwrapStdlib_CFenvT" (Ptr Stdlib_CFenvT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CFenvT")
+instance HasCField Stdlib_CFenvT "unwrapStdlib_CFenvT"
+    where type CFieldType Stdlib_CFenvT
+                          "unwrapStdlib_CFenvT" = HsBindgen.Runtime.LibC.CFenvT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CFexceptT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 36:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFexceptT
+    = Stdlib_CFexceptT {unwrapStdlib_CFexceptT :: HsBindgen.Runtime.LibC.CFexceptT}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CFexceptT =>
+         HasField "unwrapStdlib_CFexceptT" Stdlib_CFexceptT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CFexceptT{unwrapStdlib_CFexceptT = y_1},
+                              getField @"unwrapStdlib_CFexceptT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CFexceptT =>
+         HasField "unwrapStdlib_CFexceptT" (Ptr Stdlib_CFexceptT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CFexceptT")
+instance HasCField Stdlib_CFexceptT "unwrapStdlib_CFexceptT"
+    where type CFieldType Stdlib_CFexceptT
+                          "unwrapStdlib_CFexceptT" = HsBindgen.Runtime.LibC.CFexceptT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CSize@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 39:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CSize
+    = Stdlib_CSize {unwrapStdlib_CSize :: HsBindgen.Runtime.LibC.CSize}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "unwrapStdlib_CSize" Stdlib_CSize ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CSize{unwrapStdlib_CSize = y_1},
+                              getField @"unwrapStdlib_CSize" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "unwrapStdlib_CSize" (Ptr Stdlib_CSize) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CSize")
+instance HasCField Stdlib_CSize "unwrapStdlib_CSize"
+    where type CFieldType Stdlib_CSize
+                          "unwrapStdlib_CSize" = HsBindgen.Runtime.LibC.CSize
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CPtrdiff@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 40:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CPtrdiff
+    = Stdlib_CPtrdiff {unwrapStdlib_CPtrdiff :: HsBindgen.Runtime.LibC.CPtrdiff}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CPtrdiff =>
+         HasField "unwrapStdlib_CPtrdiff" Stdlib_CPtrdiff ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CPtrdiff{unwrapStdlib_CPtrdiff = y_1},
+                              getField @"unwrapStdlib_CPtrdiff" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CPtrdiff =>
+         HasField "unwrapStdlib_CPtrdiff" (Ptr Stdlib_CPtrdiff) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CPtrdiff")
+instance HasCField Stdlib_CPtrdiff "unwrapStdlib_CPtrdiff"
+    where type CFieldType Stdlib_CPtrdiff
+                          "unwrapStdlib_CPtrdiff" = HsBindgen.Runtime.LibC.CPtrdiff
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CJmpBuf@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 43:17@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CJmpBuf
+    = Stdlib_CJmpBuf {unwrapStdlib_CJmpBuf :: HsBindgen.Runtime.LibC.CJmpBuf}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CJmpBuf =>
+         HasField "unwrapStdlib_CJmpBuf" Stdlib_CJmpBuf ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CJmpBuf{unwrapStdlib_CJmpBuf = y_1},
+                              getField @"unwrapStdlib_CJmpBuf" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CJmpBuf =>
+         HasField "unwrapStdlib_CJmpBuf" (Ptr Stdlib_CJmpBuf) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CJmpBuf")
+instance HasCField Stdlib_CJmpBuf "unwrapStdlib_CJmpBuf"
+    where type CFieldType Stdlib_CJmpBuf
+                          "unwrapStdlib_CJmpBuf" = HsBindgen.Runtime.LibC.CJmpBuf
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CWchar@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 46:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWchar
+    = Stdlib_CWchar {unwrapStdlib_CWchar :: HsBindgen.Runtime.LibC.CWchar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CWchar =>
+         HasField "unwrapStdlib_CWchar" Stdlib_CWchar ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CWchar{unwrapStdlib_CWchar = y_1},
+                              getField @"unwrapStdlib_CWchar" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CWchar =>
+         HasField "unwrapStdlib_CWchar" (Ptr Stdlib_CWchar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CWchar")
+instance HasCField Stdlib_CWchar "unwrapStdlib_CWchar"
+    where type CFieldType Stdlib_CWchar
+                          "unwrapStdlib_CWchar" = HsBindgen.Runtime.LibC.CWchar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CWintT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 47:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWintT
+    = Stdlib_CWintT {unwrapStdlib_CWintT :: HsBindgen.Runtime.LibC.CWintT}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CWintT =>
+         HasField "unwrapStdlib_CWintT" Stdlib_CWintT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CWintT{unwrapStdlib_CWintT = y_1},
+                              getField @"unwrapStdlib_CWintT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CWintT =>
+         HasField "unwrapStdlib_CWintT" (Ptr Stdlib_CWintT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CWintT")
+instance HasCField Stdlib_CWintT "unwrapStdlib_CWintT"
+    where type CFieldType Stdlib_CWintT
+                          "unwrapStdlib_CWintT" = HsBindgen.Runtime.LibC.CWintT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CMbstateT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 48:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CMbstateT
+    = Stdlib_CMbstateT {unwrapStdlib_CMbstateT :: HsBindgen.Runtime.LibC.CMbstateT}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CMbstateT =>
+         HasField "unwrapStdlib_CMbstateT" Stdlib_CMbstateT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CMbstateT{unwrapStdlib_CMbstateT = y_1},
+                              getField @"unwrapStdlib_CMbstateT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CMbstateT =>
+         HasField "unwrapStdlib_CMbstateT" (Ptr Stdlib_CMbstateT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CMbstateT")
+instance HasCField Stdlib_CMbstateT "unwrapStdlib_CMbstateT"
+    where type CFieldType Stdlib_CMbstateT
+                          "unwrapStdlib_CMbstateT" = HsBindgen.Runtime.LibC.CMbstateT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CWctransT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 49:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWctransT
+    = Stdlib_CWctransT {unwrapStdlib_CWctransT :: HsBindgen.Runtime.LibC.CWctransT}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CWctransT =>
+         HasField "unwrapStdlib_CWctransT" Stdlib_CWctransT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CWctransT{unwrapStdlib_CWctransT = y_1},
+                              getField @"unwrapStdlib_CWctransT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CWctransT =>
+         HasField "unwrapStdlib_CWctransT" (Ptr Stdlib_CWctransT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CWctransT")
+instance HasCField Stdlib_CWctransT "unwrapStdlib_CWctransT"
+    where type CFieldType Stdlib_CWctransT
+                          "unwrapStdlib_CWctransT" = HsBindgen.Runtime.LibC.CWctransT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CWctypeT@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 50:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CWctypeT
+    = Stdlib_CWctypeT {unwrapStdlib_CWctypeT :: HsBindgen.Runtime.LibC.CWctypeT}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CWctypeT =>
+         HasField "unwrapStdlib_CWctypeT" Stdlib_CWctypeT ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CWctypeT{unwrapStdlib_CWctypeT = y_1},
+                              getField @"unwrapStdlib_CWctypeT" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CWctypeT =>
+         HasField "unwrapStdlib_CWctypeT" (Ptr Stdlib_CWctypeT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CWctypeT")
+instance HasCField Stdlib_CWctypeT "unwrapStdlib_CWctypeT"
+    where type CFieldType Stdlib_CWctypeT
+                          "unwrapStdlib_CWctypeT" = HsBindgen.Runtime.LibC.CWctypeT
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CChar16T@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 51:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CChar16T
+    = Stdlib_CChar16T {unwrapStdlib_CChar16T :: HsBindgen.Runtime.LibC.CChar16T}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CChar16T =>
+         HasField "unwrapStdlib_CChar16T" Stdlib_CChar16T ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CChar16T{unwrapStdlib_CChar16T = y_1},
+                              getField @"unwrapStdlib_CChar16T" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CChar16T =>
+         HasField "unwrapStdlib_CChar16T" (Ptr Stdlib_CChar16T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CChar16T")
+instance HasCField Stdlib_CChar16T "unwrapStdlib_CChar16T"
+    where type CFieldType Stdlib_CChar16T
+                          "unwrapStdlib_CChar16T" = HsBindgen.Runtime.LibC.CChar16T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CChar32T@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 52:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CChar32T
+    = Stdlib_CChar32T {unwrapStdlib_CChar32T :: HsBindgen.Runtime.LibC.CChar32T}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CChar32T =>
+         HasField "unwrapStdlib_CChar32T" Stdlib_CChar32T ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CChar32T{unwrapStdlib_CChar32T = y_1},
+                              getField @"unwrapStdlib_CChar32T" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CChar32T =>
+         HasField "unwrapStdlib_CChar32T" (Ptr Stdlib_CChar32T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CChar32T")
+instance HasCField Stdlib_CChar32T "unwrapStdlib_CChar32T"
+    where type CFieldType Stdlib_CChar32T
+                          "unwrapStdlib_CChar32T" = HsBindgen.Runtime.LibC.CChar32T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CTime@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 55:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CTime
+    = Stdlib_CTime {unwrapStdlib_CTime :: HsBindgen.Runtime.LibC.CTime}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      HasFFIType,
+                      Num,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CTime =>
+         HasField "unwrapStdlib_CTime" Stdlib_CTime ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CTime{unwrapStdlib_CTime = y_1},
+                              getField @"unwrapStdlib_CTime" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CTime =>
+         HasField "unwrapStdlib_CTime" (Ptr Stdlib_CTime) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CTime")
+instance HasCField Stdlib_CTime "unwrapStdlib_CTime"
+    where type CFieldType Stdlib_CTime
+                          "unwrapStdlib_CTime" = HsBindgen.Runtime.LibC.CTime
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CClock@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 56:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CClock
+    = Stdlib_CClock {unwrapStdlib_CClock :: HsBindgen.Runtime.LibC.CClock}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      HasFFIType,
+                      Num,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CClock =>
+         HasField "unwrapStdlib_CClock" Stdlib_CClock ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CClock{unwrapStdlib_CClock = y_1},
+                              getField @"unwrapStdlib_CClock" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CClock =>
+         HasField "unwrapStdlib_CClock" (Ptr Stdlib_CClock) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CClock")
+instance HasCField Stdlib_CClock "unwrapStdlib_CClock"
+    where type CFieldType Stdlib_CClock
+                          "unwrapStdlib_CClock" = HsBindgen.Runtime.LibC.CClock
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CTm@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 57:19@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CTm
+    = Stdlib_CTm {unwrapStdlib_CTm :: HsBindgen.Runtime.LibC.CTm}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize)
+instance (~) ty HsBindgen.Runtime.LibC.CTm =>
+         HasField "unwrapStdlib_CTm" Stdlib_CTm ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CTm{unwrapStdlib_CTm = y_1},
+                              getField @"unwrapStdlib_CTm" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CTm =>
+         HasField "unwrapStdlib_CTm" (Ptr Stdlib_CTm) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CTm")
+instance HasCField Stdlib_CTm "unwrapStdlib_CTm"
+    where type CFieldType Stdlib_CTm
+                          "unwrapStdlib_CTm" = HsBindgen.Runtime.LibC.CTm
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CFile@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 60:16@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFile
+    = Stdlib_CFile {unwrapStdlib_CFile :: HsBindgen.Runtime.LibC.CFile}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CFile =>
+         HasField "unwrapStdlib_CFile" Stdlib_CFile ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CFile{unwrapStdlib_CFile = y_1},
+                              getField @"unwrapStdlib_CFile" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CFile =>
+         HasField "unwrapStdlib_CFile" (Ptr Stdlib_CFile) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CFile")
+instance HasCField Stdlib_CFile "unwrapStdlib_CFile"
+    where type CFieldType Stdlib_CFile
+                          "unwrapStdlib_CFile" = HsBindgen.Runtime.LibC.CFile
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CFpos@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 61:16@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CFpos
+    = Stdlib_CFpos {unwrapStdlib_CFpos :: HsBindgen.Runtime.LibC.CFpos}
+    deriving stock Generic
+instance (~) ty HsBindgen.Runtime.LibC.CFpos =>
+         HasField "unwrapStdlib_CFpos" Stdlib_CFpos ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CFpos{unwrapStdlib_CFpos = y_1},
+                              getField @"unwrapStdlib_CFpos" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CFpos =>
+         HasField "unwrapStdlib_CFpos" (Ptr Stdlib_CFpos) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CFpos")
+instance HasCField Stdlib_CFpos "unwrapStdlib_CFpos"
+    where type CFieldType Stdlib_CFpos
+                          "unwrapStdlib_CFpos" = HsBindgen.Runtime.LibC.CFpos
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @stdlib_CSigAtomic@
+
+    __defined at:__ @binding-specs\/stdlib\/instances.h 64:22@
+
+    __exported by:__ @binding-specs\/stdlib\/instances.h@
+-}
+newtype Stdlib_CSigAtomic
+    = Stdlib_CSigAtomic {unwrapStdlib_CSigAtomic :: HsBindgen.Runtime.LibC.CSigAtomic}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CSigAtomic =>
+         HasField "unwrapStdlib_CSigAtomic" Stdlib_CSigAtomic ty
+    where hasField = \x_0 -> (\y_1 -> Stdlib_CSigAtomic{unwrapStdlib_CSigAtomic = y_1},
+                              getField @"unwrapStdlib_CSigAtomic" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSigAtomic =>
+         HasField "unwrapStdlib_CSigAtomic" (Ptr Stdlib_CSigAtomic) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStdlib_CSigAtomic")
+instance HasCField Stdlib_CSigAtomic "unwrapStdlib_CSigAtomic"
+    where type CFieldType Stdlib_CSigAtomic
+                          "unwrapStdlib_CSigAtomic" = HsBindgen.Runtime.LibC.CSigAtomic
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/FunPtr.hs
@@ -0,0 +1,800 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.bool_fun
+    , Example.FunPtr.int8_t_fun
+    , Example.FunPtr.int16_t_fun
+    , Example.FunPtr.int32_t_fun
+    , Example.FunPtr.int64_t_fun
+    , Example.FunPtr.uint8_t_fun
+    , Example.FunPtr.uint16_t_fun
+    , Example.FunPtr.uint32_t_fun
+    , Example.FunPtr.uint64_t_fun
+    , Example.FunPtr.intmax_t_fun
+    , Example.FunPtr.uintmax_t_fun
+    , Example.FunPtr.intptr_t_fun
+    , Example.FunPtr.uintptr_t_fun
+    , Example.FunPtr.fenv_t_fun
+    , Example.FunPtr.fexcept_t_fun
+    , Example.FunPtr.size_t_fun
+    , Example.FunPtr.ptrdiff_t_fun
+    , Example.FunPtr.wchar_t_fun
+    , Example.FunPtr.wint_t_fun
+    , Example.FunPtr.mbstate_t_fun
+    , Example.FunPtr.wctrans_t_fun
+    , Example.FunPtr.wctype_t_fun
+    , Example.FunPtr.char16_t_fun
+    , Example.FunPtr.char32_t_fun
+    , Example.FunPtr.time_t_fun
+    , Example.FunPtr.clock_t_fun
+    , Example.FunPtr.fILE_fun
+    , Example.FunPtr.fpos_t_fun
+    , Example.FunPtr.sig_atomic_t_fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/stdlib/return_values.h>"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_bool_fun */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_4d50a5da1d788aef (void)) (void)"
+  , "{"
+  , "  return &bool_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_int8_t_fun */"
+  , "__attribute__ ((const))"
+  , "int8_t (*hs_bindgen_afc12424e14cd900 (void)) (void)"
+  , "{"
+  , "  return &int8_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_int16_t_fun */"
+  , "__attribute__ ((const))"
+  , "int16_t (*hs_bindgen_bb1fdb972582362b (void)) (void)"
+  , "{"
+  , "  return &int16_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_int32_t_fun */"
+  , "__attribute__ ((const))"
+  , "int32_t (*hs_bindgen_3ddcee1ca6e45ed1 (void)) (void)"
+  , "{"
+  , "  return &int32_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_int64_t_fun */"
+  , "__attribute__ ((const))"
+  , "int64_t (*hs_bindgen_87f02bc29c3faac0 (void)) (void)"
+  , "{"
+  , "  return &int64_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_uint8_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint8_t (*hs_bindgen_e41f6841cb24d084 (void)) (void)"
+  , "{"
+  , "  return &uint8_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_uint16_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint16_t (*hs_bindgen_a99c4081312f9a64 (void)) (void)"
+  , "{"
+  , "  return &uint16_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_uint32_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint32_t (*hs_bindgen_d7c52be7143a7a68 (void)) (void)"
+  , "{"
+  , "  return &uint32_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_uint64_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint64_t (*hs_bindgen_ce7fc806ab2fc8e0 (void)) (void)"
+  , "{"
+  , "  return &uint64_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_intmax_t_fun */"
+  , "__attribute__ ((const))"
+  , "intmax_t (*hs_bindgen_5b1986d8b6b49f7e (void)) (void)"
+  , "{"
+  , "  return &intmax_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_uintmax_t_fun */"
+  , "__attribute__ ((const))"
+  , "uintmax_t (*hs_bindgen_022ea568c1d290f4 (void)) (void)"
+  , "{"
+  , "  return &uintmax_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_intptr_t_fun */"
+  , "__attribute__ ((const))"
+  , "intptr_t (*hs_bindgen_35eda59e93c8db9a (void)) (void)"
+  , "{"
+  , "  return &intptr_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_uintptr_t_fun */"
+  , "__attribute__ ((const))"
+  , "uintptr_t (*hs_bindgen_a45e879780c141ec (void)) (void)"
+  , "{"
+  , "  return &uintptr_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_fenv_t_fun */"
+  , "__attribute__ ((const))"
+  , "fenv_t *(*hs_bindgen_266815b1305c1241 (void)) (void)"
+  , "{"
+  , "  return &fenv_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_fexcept_t_fun */"
+  , "__attribute__ ((const))"
+  , "fexcept_t *(*hs_bindgen_d0eee798617140b8 (void)) (void)"
+  , "{"
+  , "  return &fexcept_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_size_t_fun */"
+  , "__attribute__ ((const))"
+  , "size_t (*hs_bindgen_0120eaefb471d45e (void)) (void)"
+  , "{"
+  , "  return &size_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_ptrdiff_t_fun */"
+  , "__attribute__ ((const))"
+  , "ptrdiff_t (*hs_bindgen_aa0444e3b2fda3de (void)) (void)"
+  , "{"
+  , "  return &ptrdiff_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_wchar_t_fun */"
+  , "__attribute__ ((const))"
+  , "wchar_t (*hs_bindgen_c3e6697f6a14bc13 (void)) (void)"
+  , "{"
+  , "  return &wchar_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_wint_t_fun */"
+  , "__attribute__ ((const))"
+  , "wint_t (*hs_bindgen_f3077dc66d53977f (void)) (void)"
+  , "{"
+  , "  return &wint_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_mbstate_t_fun */"
+  , "__attribute__ ((const))"
+  , "mbstate_t *(*hs_bindgen_b863e606ff088408 (void)) (void)"
+  , "{"
+  , "  return &mbstate_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_wctrans_t_fun */"
+  , "__attribute__ ((const))"
+  , "wctrans_t (*hs_bindgen_a9599637dbc12608 (void)) (void)"
+  , "{"
+  , "  return &wctrans_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_wctype_t_fun */"
+  , "__attribute__ ((const))"
+  , "wctype_t (*hs_bindgen_207a54450593099a (void)) (void)"
+  , "{"
+  , "  return &wctype_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_char16_t_fun */"
+  , "__attribute__ ((const))"
+  , "char16_t (*hs_bindgen_28a6e39f56489ba2 (void)) (void)"
+  , "{"
+  , "  return &char16_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_char32_t_fun */"
+  , "__attribute__ ((const))"
+  , "char32_t (*hs_bindgen_f918c5a2d6c16885 (void)) (void)"
+  , "{"
+  , "  return &char32_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_time_t_fun */"
+  , "__attribute__ ((const))"
+  , "time_t (*hs_bindgen_f29cfe7708be784f (void)) (void)"
+  , "{"
+  , "  return &time_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_clock_t_fun */"
+  , "__attribute__ ((const))"
+  , "clock_t (*hs_bindgen_509d092c2afe1ddc (void)) (void)"
+  , "{"
+  , "  return &clock_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_FILE_fun */"
+  , "__attribute__ ((const))"
+  , "FILE *(*hs_bindgen_8f5880570a38b5dd (void)) (void)"
+  , "{"
+  , "  return &FILE_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_fpos_t_fun */"
+  , "__attribute__ ((const))"
+  , "fpos_t *(*hs_bindgen_8b563cc85422e790 (void)) (void)"
+  , "{"
+  , "  return &fpos_t_fun;"
+  , "}"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_sig_atomic_t_fun */"
+  , "__attribute__ ((const))"
+  , "sig_atomic_t (*hs_bindgen_9fcd36cfaa3ea373 (void)) (void)"
+  , "{"
+  , "  return &sig_atomic_t_fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_bool_fun@
+foreign import ccall unsafe "hs_bindgen_4d50a5da1d788aef" hs_bindgen_4d50a5da1d788aef_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_bool_fun@
+hs_bindgen_4d50a5da1d788aef :: IO (BG.FunPtr (IO BG.CBool))
+hs_bindgen_4d50a5da1d788aef =
+  fmap BG.fromFFIType hs_bindgen_4d50a5da1d788aef_base
+
+{-# NOINLINE bool_fun #-}
+{-| __C declaration:__ @bool_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 20:6@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+bool_fun :: BG.FunPtr (IO BG.CBool)
+bool_fun =
+  BG.unsafePerformIO hs_bindgen_4d50a5da1d788aef
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int8_t_fun@
+foreign import ccall unsafe "hs_bindgen_afc12424e14cd900" hs_bindgen_afc12424e14cd900_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int8_t_fun@
+hs_bindgen_afc12424e14cd900 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.Int8))
+hs_bindgen_afc12424e14cd900 =
+  fmap BG.fromFFIType hs_bindgen_afc12424e14cd900_base
+
+{-# NOINLINE int8_t_fun #-}
+{-| __C declaration:__ @int8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 23:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int8_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.Int8)
+int8_t_fun =
+  BG.unsafePerformIO hs_bindgen_afc12424e14cd900
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int16_t_fun@
+foreign import ccall unsafe "hs_bindgen_bb1fdb972582362b" hs_bindgen_bb1fdb972582362b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int16_t_fun@
+hs_bindgen_bb1fdb972582362b :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.Int16))
+hs_bindgen_bb1fdb972582362b =
+  fmap BG.fromFFIType hs_bindgen_bb1fdb972582362b_base
+
+{-# NOINLINE int16_t_fun #-}
+{-| __C declaration:__ @int16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 24:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int16_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.Int16)
+int16_t_fun =
+  BG.unsafePerformIO hs_bindgen_bb1fdb972582362b
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int32_t_fun@
+foreign import ccall unsafe "hs_bindgen_3ddcee1ca6e45ed1" hs_bindgen_3ddcee1ca6e45ed1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int32_t_fun@
+hs_bindgen_3ddcee1ca6e45ed1 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.Int32))
+hs_bindgen_3ddcee1ca6e45ed1 =
+  fmap BG.fromFFIType hs_bindgen_3ddcee1ca6e45ed1_base
+
+{-# NOINLINE int32_t_fun #-}
+{-| __C declaration:__ @int32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 25:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int32_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.Int32)
+int32_t_fun =
+  BG.unsafePerformIO hs_bindgen_3ddcee1ca6e45ed1
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int64_t_fun@
+foreign import ccall unsafe "hs_bindgen_87f02bc29c3faac0" hs_bindgen_87f02bc29c3faac0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int64_t_fun@
+hs_bindgen_87f02bc29c3faac0 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.Int64))
+hs_bindgen_87f02bc29c3faac0 =
+  fmap BG.fromFFIType hs_bindgen_87f02bc29c3faac0_base
+
+{-# NOINLINE int64_t_fun #-}
+{-| __C declaration:__ @int64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 26:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int64_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.Int64)
+int64_t_fun =
+  BG.unsafePerformIO hs_bindgen_87f02bc29c3faac0
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint8_t_fun@
+foreign import ccall unsafe "hs_bindgen_e41f6841cb24d084" hs_bindgen_e41f6841cb24d084_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint8_t_fun@
+hs_bindgen_e41f6841cb24d084 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.Word8))
+hs_bindgen_e41f6841cb24d084 =
+  fmap BG.fromFFIType hs_bindgen_e41f6841cb24d084_base
+
+{-# NOINLINE uint8_t_fun #-}
+{-| __C declaration:__ @uint8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 27:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint8_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.Word8)
+uint8_t_fun =
+  BG.unsafePerformIO hs_bindgen_e41f6841cb24d084
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint16_t_fun@
+foreign import ccall unsafe "hs_bindgen_a99c4081312f9a64" hs_bindgen_a99c4081312f9a64_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint16_t_fun@
+hs_bindgen_a99c4081312f9a64 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.Word16))
+hs_bindgen_a99c4081312f9a64 =
+  fmap BG.fromFFIType hs_bindgen_a99c4081312f9a64_base
+
+{-# NOINLINE uint16_t_fun #-}
+{-| __C declaration:__ @uint16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 28:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint16_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.Word16)
+uint16_t_fun =
+  BG.unsafePerformIO hs_bindgen_a99c4081312f9a64
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint32_t_fun@
+foreign import ccall unsafe "hs_bindgen_d7c52be7143a7a68" hs_bindgen_d7c52be7143a7a68_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint32_t_fun@
+hs_bindgen_d7c52be7143a7a68 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.Word32))
+hs_bindgen_d7c52be7143a7a68 =
+  fmap BG.fromFFIType hs_bindgen_d7c52be7143a7a68_base
+
+{-# NOINLINE uint32_t_fun #-}
+{-| __C declaration:__ @uint32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 29:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint32_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.Word32)
+uint32_t_fun =
+  BG.unsafePerformIO hs_bindgen_d7c52be7143a7a68
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint64_t_fun@
+foreign import ccall unsafe "hs_bindgen_ce7fc806ab2fc8e0" hs_bindgen_ce7fc806ab2fc8e0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint64_t_fun@
+hs_bindgen_ce7fc806ab2fc8e0 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.Word64))
+hs_bindgen_ce7fc806ab2fc8e0 =
+  fmap BG.fromFFIType hs_bindgen_ce7fc806ab2fc8e0_base
+
+{-# NOINLINE uint64_t_fun #-}
+{-| __C declaration:__ @uint64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 30:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint64_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.Word64)
+uint64_t_fun =
+  BG.unsafePerformIO hs_bindgen_ce7fc806ab2fc8e0
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intmax_t_fun@
+foreign import ccall unsafe "hs_bindgen_5b1986d8b6b49f7e" hs_bindgen_5b1986d8b6b49f7e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intmax_t_fun@
+hs_bindgen_5b1986d8b6b49f7e :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CIntMax))
+hs_bindgen_5b1986d8b6b49f7e =
+  fmap BG.fromFFIType hs_bindgen_5b1986d8b6b49f7e_base
+
+{-# NOINLINE intmax_t_fun #-}
+{-| __C declaration:__ @intmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 31:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intmax_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CIntMax)
+intmax_t_fun =
+  BG.unsafePerformIO hs_bindgen_5b1986d8b6b49f7e
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintmax_t_fun@
+foreign import ccall unsafe "hs_bindgen_022ea568c1d290f4" hs_bindgen_022ea568c1d290f4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintmax_t_fun@
+hs_bindgen_022ea568c1d290f4 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CUIntMax))
+hs_bindgen_022ea568c1d290f4 =
+  fmap BG.fromFFIType hs_bindgen_022ea568c1d290f4_base
+
+{-# NOINLINE uintmax_t_fun #-}
+{-| __C declaration:__ @uintmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 32:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintmax_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CUIntMax)
+uintmax_t_fun =
+  BG.unsafePerformIO hs_bindgen_022ea568c1d290f4
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intptr_t_fun@
+foreign import ccall unsafe "hs_bindgen_35eda59e93c8db9a" hs_bindgen_35eda59e93c8db9a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intptr_t_fun@
+hs_bindgen_35eda59e93c8db9a :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CIntPtr))
+hs_bindgen_35eda59e93c8db9a =
+  fmap BG.fromFFIType hs_bindgen_35eda59e93c8db9a_base
+
+{-# NOINLINE intptr_t_fun #-}
+{-| __C declaration:__ @intptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 33:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intptr_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CIntPtr)
+intptr_t_fun =
+  BG.unsafePerformIO hs_bindgen_35eda59e93c8db9a
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintptr_t_fun@
+foreign import ccall unsafe "hs_bindgen_a45e879780c141ec" hs_bindgen_a45e879780c141ec_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintptr_t_fun@
+hs_bindgen_a45e879780c141ec :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CUIntPtr))
+hs_bindgen_a45e879780c141ec =
+  fmap BG.fromFFIType hs_bindgen_a45e879780c141ec_base
+
+{-# NOINLINE uintptr_t_fun #-}
+{-| __C declaration:__ @uintptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 34:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintptr_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CUIntPtr)
+uintptr_t_fun =
+  BG.unsafePerformIO hs_bindgen_a45e879780c141ec
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fenv_t_fun@
+foreign import ccall unsafe "hs_bindgen_266815b1305c1241" hs_bindgen_266815b1305c1241_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fenv_t_fun@
+hs_bindgen_266815b1305c1241 :: IO (BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CFenvT)))
+hs_bindgen_266815b1305c1241 =
+  fmap BG.fromFFIType hs_bindgen_266815b1305c1241_base
+
+{-# NOINLINE fenv_t_fun #-}
+{-| __C declaration:__ @fenv_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 37:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fenv_t_fun :: BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CFenvT))
+fenv_t_fun =
+  BG.unsafePerformIO hs_bindgen_266815b1305c1241
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fexcept_t_fun@
+foreign import ccall unsafe "hs_bindgen_d0eee798617140b8" hs_bindgen_d0eee798617140b8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fexcept_t_fun@
+hs_bindgen_d0eee798617140b8 :: IO (BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CFexceptT)))
+hs_bindgen_d0eee798617140b8 =
+  fmap BG.fromFFIType hs_bindgen_d0eee798617140b8_base
+
+{-# NOINLINE fexcept_t_fun #-}
+{-| __C declaration:__ @fexcept_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 38:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fexcept_t_fun :: BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CFexceptT))
+fexcept_t_fun =
+  BG.unsafePerformIO hs_bindgen_d0eee798617140b8
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_size_t_fun@
+foreign import ccall unsafe "hs_bindgen_0120eaefb471d45e" hs_bindgen_0120eaefb471d45e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_size_t_fun@
+hs_bindgen_0120eaefb471d45e :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CSize))
+hs_bindgen_0120eaefb471d45e =
+  fmap BG.fromFFIType hs_bindgen_0120eaefb471d45e_base
+
+{-# NOINLINE size_t_fun #-}
+{-| __C declaration:__ @size_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 41:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+size_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CSize)
+size_t_fun =
+  BG.unsafePerformIO hs_bindgen_0120eaefb471d45e
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_ptrdiff_t_fun@
+foreign import ccall unsafe "hs_bindgen_aa0444e3b2fda3de" hs_bindgen_aa0444e3b2fda3de_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_ptrdiff_t_fun@
+hs_bindgen_aa0444e3b2fda3de :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CPtrdiff))
+hs_bindgen_aa0444e3b2fda3de =
+  fmap BG.fromFFIType hs_bindgen_aa0444e3b2fda3de_base
+
+{-# NOINLINE ptrdiff_t_fun #-}
+{-| __C declaration:__ @ptrdiff_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 42:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+ptrdiff_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CPtrdiff)
+ptrdiff_t_fun =
+  BG.unsafePerformIO hs_bindgen_aa0444e3b2fda3de
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wchar_t_fun@
+foreign import ccall unsafe "hs_bindgen_c3e6697f6a14bc13" hs_bindgen_c3e6697f6a14bc13_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wchar_t_fun@
+hs_bindgen_c3e6697f6a14bc13 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CWchar))
+hs_bindgen_c3e6697f6a14bc13 =
+  fmap BG.fromFFIType hs_bindgen_c3e6697f6a14bc13_base
+
+{-# NOINLINE wchar_t_fun #-}
+{-| __C declaration:__ @wchar_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 49:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wchar_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CWchar)
+wchar_t_fun =
+  BG.unsafePerformIO hs_bindgen_c3e6697f6a14bc13
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wint_t_fun@
+foreign import ccall unsafe "hs_bindgen_f3077dc66d53977f" hs_bindgen_f3077dc66d53977f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wint_t_fun@
+hs_bindgen_f3077dc66d53977f :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CWintT))
+hs_bindgen_f3077dc66d53977f =
+  fmap BG.fromFFIType hs_bindgen_f3077dc66d53977f_base
+
+{-# NOINLINE wint_t_fun #-}
+{-| __C declaration:__ @wint_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 50:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wint_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CWintT)
+wint_t_fun =
+  BG.unsafePerformIO hs_bindgen_f3077dc66d53977f
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_mbstate_t_fun@
+foreign import ccall unsafe "hs_bindgen_b863e606ff088408" hs_bindgen_b863e606ff088408_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_mbstate_t_fun@
+hs_bindgen_b863e606ff088408 :: IO (BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CMbstateT)))
+hs_bindgen_b863e606ff088408 =
+  fmap BG.fromFFIType hs_bindgen_b863e606ff088408_base
+
+{-# NOINLINE mbstate_t_fun #-}
+{-| __C declaration:__ @mbstate_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 51:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+mbstate_t_fun :: BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CMbstateT))
+mbstate_t_fun =
+  BG.unsafePerformIO hs_bindgen_b863e606ff088408
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctrans_t_fun@
+foreign import ccall unsafe "hs_bindgen_a9599637dbc12608" hs_bindgen_a9599637dbc12608_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctrans_t_fun@
+hs_bindgen_a9599637dbc12608 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CWctransT))
+hs_bindgen_a9599637dbc12608 =
+  fmap BG.fromFFIType hs_bindgen_a9599637dbc12608_base
+
+{-# NOINLINE wctrans_t_fun #-}
+{-| __C declaration:__ @wctrans_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 52:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctrans_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CWctransT)
+wctrans_t_fun =
+  BG.unsafePerformIO hs_bindgen_a9599637dbc12608
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctype_t_fun@
+foreign import ccall unsafe "hs_bindgen_207a54450593099a" hs_bindgen_207a54450593099a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctype_t_fun@
+hs_bindgen_207a54450593099a :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CWctypeT))
+hs_bindgen_207a54450593099a =
+  fmap BG.fromFFIType hs_bindgen_207a54450593099a_base
+
+{-# NOINLINE wctype_t_fun #-}
+{-| __C declaration:__ @wctype_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 53:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctype_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CWctypeT)
+wctype_t_fun =
+  BG.unsafePerformIO hs_bindgen_207a54450593099a
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char16_t_fun@
+foreign import ccall unsafe "hs_bindgen_28a6e39f56489ba2" hs_bindgen_28a6e39f56489ba2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char16_t_fun@
+hs_bindgen_28a6e39f56489ba2 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CChar16T))
+hs_bindgen_28a6e39f56489ba2 =
+  fmap BG.fromFFIType hs_bindgen_28a6e39f56489ba2_base
+
+{-# NOINLINE char16_t_fun #-}
+{-| __C declaration:__ @char16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 54:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char16_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CChar16T)
+char16_t_fun =
+  BG.unsafePerformIO hs_bindgen_28a6e39f56489ba2
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char32_t_fun@
+foreign import ccall unsafe "hs_bindgen_f918c5a2d6c16885" hs_bindgen_f918c5a2d6c16885_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char32_t_fun@
+hs_bindgen_f918c5a2d6c16885 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CChar32T))
+hs_bindgen_f918c5a2d6c16885 =
+  fmap BG.fromFFIType hs_bindgen_f918c5a2d6c16885_base
+
+{-# NOINLINE char32_t_fun #-}
+{-| __C declaration:__ @char32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 55:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char32_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CChar32T)
+char32_t_fun =
+  BG.unsafePerformIO hs_bindgen_f918c5a2d6c16885
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_time_t_fun@
+foreign import ccall unsafe "hs_bindgen_f29cfe7708be784f" hs_bindgen_f29cfe7708be784f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_time_t_fun@
+hs_bindgen_f29cfe7708be784f :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CTime))
+hs_bindgen_f29cfe7708be784f =
+  fmap BG.fromFFIType hs_bindgen_f29cfe7708be784f_base
+
+{-# NOINLINE time_t_fun #-}
+{-| __C declaration:__ @time_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 58:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+time_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CTime)
+time_t_fun =
+  BG.unsafePerformIO hs_bindgen_f29cfe7708be784f
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_clock_t_fun@
+foreign import ccall unsafe "hs_bindgen_509d092c2afe1ddc" hs_bindgen_509d092c2afe1ddc_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_clock_t_fun@
+hs_bindgen_509d092c2afe1ddc :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CClock))
+hs_bindgen_509d092c2afe1ddc =
+  fmap BG.fromFFIType hs_bindgen_509d092c2afe1ddc_base
+
+{-# NOINLINE clock_t_fun #-}
+{-| __C declaration:__ @clock_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 59:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+clock_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CClock)
+clock_t_fun =
+  BG.unsafePerformIO hs_bindgen_509d092c2afe1ddc
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_FILE_fun@
+foreign import ccall unsafe "hs_bindgen_8f5880570a38b5dd" hs_bindgen_8f5880570a38b5dd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_FILE_fun@
+hs_bindgen_8f5880570a38b5dd :: IO (BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CFile)))
+hs_bindgen_8f5880570a38b5dd =
+  fmap BG.fromFFIType hs_bindgen_8f5880570a38b5dd_base
+
+{-# NOINLINE fILE_fun #-}
+{-| __C declaration:__ @FILE_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 64:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fILE_fun :: BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CFile))
+fILE_fun =
+  BG.unsafePerformIO hs_bindgen_8f5880570a38b5dd
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fpos_t_fun@
+foreign import ccall unsafe "hs_bindgen_8b563cc85422e790" hs_bindgen_8b563cc85422e790_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fpos_t_fun@
+hs_bindgen_8b563cc85422e790 :: IO (BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CFpos)))
+hs_bindgen_8b563cc85422e790 =
+  fmap BG.fromFFIType hs_bindgen_8b563cc85422e790_base
+
+{-# NOINLINE fpos_t_fun #-}
+{-| __C declaration:__ @fpos_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 65:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fpos_t_fun :: BG.FunPtr (IO (BG.Ptr HsBindgen.Runtime.LibC.CFpos))
+fpos_t_fun =
+  BG.unsafePerformIO hs_bindgen_8b563cc85422e790
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_sig_atomic_t_fun@
+foreign import ccall unsafe "hs_bindgen_9fcd36cfaa3ea373" hs_bindgen_9fcd36cfaa3ea373_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_sig_atomic_t_fun@
+hs_bindgen_9fcd36cfaa3ea373 :: IO (BG.FunPtr (IO HsBindgen.Runtime.LibC.CSigAtomic))
+hs_bindgen_9fcd36cfaa3ea373 =
+  fmap BG.fromFFIType hs_bindgen_9fcd36cfaa3ea373_base
+
+{-# NOINLINE sig_atomic_t_fun #-}
+{-| __C declaration:__ @sig_atomic_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 68:14@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+sig_atomic_t_fun :: BG.FunPtr (IO HsBindgen.Runtime.LibC.CSigAtomic)
+sig_atomic_t_fun =
+  BG.unsafePerformIO hs_bindgen_9fcd36cfaa3ea373
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/Global.hs b/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/Global.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.jmp_buf_val
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/stdlib/return_values.h>"
+  , "/* test_bindingspecsstdlibreturn_va_Example_get_jmp_buf_val */"
+  , "__attribute__ ((const))"
+  , "jmp_buf *hs_bindgen_68c2b692efbc4734 (void)"
+  , "{"
+  , "  return &jmp_buf_val;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_jmp_buf_val@
+foreign import ccall unsafe "hs_bindgen_68c2b692efbc4734" hs_bindgen_68c2b692efbc4734_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_jmp_buf_val@
+hs_bindgen_68c2b692efbc4734 :: IO (BG.Ptr HsBindgen.Runtime.LibC.CJmpBuf)
+hs_bindgen_68c2b692efbc4734 =
+  fmap BG.fromFFIType hs_bindgen_68c2b692efbc4734_base
+
+{-# NOINLINE jmp_buf_val #-}
+{-| __C declaration:__ @jmp_buf_val@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 46:16@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+jmp_buf_val :: BG.Ptr HsBindgen.Runtime.LibC.CJmpBuf
+jmp_buf_val =
+  BG.unsafePerformIO hs_bindgen_68c2b692efbc4734
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/Safe.hs
@@ -0,0 +1,684 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.bool_fun
+    , Example.Safe.int8_t_fun
+    , Example.Safe.int16_t_fun
+    , Example.Safe.int32_t_fun
+    , Example.Safe.int64_t_fun
+    , Example.Safe.uint8_t_fun
+    , Example.Safe.uint16_t_fun
+    , Example.Safe.uint32_t_fun
+    , Example.Safe.uint64_t_fun
+    , Example.Safe.intmax_t_fun
+    , Example.Safe.uintmax_t_fun
+    , Example.Safe.intptr_t_fun
+    , Example.Safe.uintptr_t_fun
+    , Example.Safe.fenv_t_fun
+    , Example.Safe.fexcept_t_fun
+    , Example.Safe.size_t_fun
+    , Example.Safe.ptrdiff_t_fun
+    , Example.Safe.wchar_t_fun
+    , Example.Safe.wint_t_fun
+    , Example.Safe.mbstate_t_fun
+    , Example.Safe.wctrans_t_fun
+    , Example.Safe.wctype_t_fun
+    , Example.Safe.char16_t_fun
+    , Example.Safe.char32_t_fun
+    , Example.Safe.time_t_fun
+    , Example.Safe.clock_t_fun
+    , Example.Safe.fILE_fun
+    , Example.Safe.fpos_t_fun
+    , Example.Safe.sig_atomic_t_fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/stdlib/return_values.h>"
+  , "_Bool hs_bindgen_4cd199ba56c14547 (void)"
+  , "{"
+  , "  return (bool_fun)();"
+  , "}"
+  , "int8_t hs_bindgen_73c8e1f452482878 (void)"
+  , "{"
+  , "  return (int8_t_fun)();"
+  , "}"
+  , "int16_t hs_bindgen_da3259b2446eb9bf (void)"
+  , "{"
+  , "  return (int16_t_fun)();"
+  , "}"
+  , "int32_t hs_bindgen_7dd577f0c34f0ff7 (void)"
+  , "{"
+  , "  return (int32_t_fun)();"
+  , "}"
+  , "int64_t hs_bindgen_7a2709fa911a350e (void)"
+  , "{"
+  , "  return (int64_t_fun)();"
+  , "}"
+  , "uint8_t hs_bindgen_1b2e687eaa715924 (void)"
+  , "{"
+  , "  return (uint8_t_fun)();"
+  , "}"
+  , "uint16_t hs_bindgen_6da73658633b176e (void)"
+  , "{"
+  , "  return (uint16_t_fun)();"
+  , "}"
+  , "uint32_t hs_bindgen_c6cd0ee414c746de (void)"
+  , "{"
+  , "  return (uint32_t_fun)();"
+  , "}"
+  , "uint64_t hs_bindgen_cbb9017c67ce7652 (void)"
+  , "{"
+  , "  return (uint64_t_fun)();"
+  , "}"
+  , "intmax_t hs_bindgen_844bf55e16de43a0 (void)"
+  , "{"
+  , "  return (intmax_t_fun)();"
+  , "}"
+  , "uintmax_t hs_bindgen_56900c9a548480d5 (void)"
+  , "{"
+  , "  return (uintmax_t_fun)();"
+  , "}"
+  , "intptr_t hs_bindgen_d656827fe2704de3 (void)"
+  , "{"
+  , "  return (intptr_t_fun)();"
+  , "}"
+  , "uintptr_t hs_bindgen_401c738c79c5e4ef (void)"
+  , "{"
+  , "  return (uintptr_t_fun)();"
+  , "}"
+  , "fenv_t *hs_bindgen_eb417aeaae001cd4 (void)"
+  , "{"
+  , "  return (fenv_t_fun)();"
+  , "}"
+  , "fexcept_t *hs_bindgen_42f9ee7a2fa5ed3b (void)"
+  , "{"
+  , "  return (fexcept_t_fun)();"
+  , "}"
+  , "size_t hs_bindgen_66f735fc270b795a (void)"
+  , "{"
+  , "  return (size_t_fun)();"
+  , "}"
+  , "ptrdiff_t hs_bindgen_2f5574764965bb49 (void)"
+  , "{"
+  , "  return (ptrdiff_t_fun)();"
+  , "}"
+  , "wchar_t hs_bindgen_57ff329a6c1ab247 (void)"
+  , "{"
+  , "  return (wchar_t_fun)();"
+  , "}"
+  , "wint_t hs_bindgen_fef1399636729a64 (void)"
+  , "{"
+  , "  return (wint_t_fun)();"
+  , "}"
+  , "mbstate_t *hs_bindgen_ec1c0b9428114ec6 (void)"
+  , "{"
+  , "  return (mbstate_t_fun)();"
+  , "}"
+  , "wctrans_t hs_bindgen_2d9b204c006f0667 (void)"
+  , "{"
+  , "  return (wctrans_t_fun)();"
+  , "}"
+  , "wctype_t hs_bindgen_977cddf620e22ba0 (void)"
+  , "{"
+  , "  return (wctype_t_fun)();"
+  , "}"
+  , "char16_t hs_bindgen_4780a15ae4e392fd (void)"
+  , "{"
+  , "  return (char16_t_fun)();"
+  , "}"
+  , "char32_t hs_bindgen_d258f4d9903b4e39 (void)"
+  , "{"
+  , "  return (char32_t_fun)();"
+  , "}"
+  , "time_t hs_bindgen_82c178bd7c4d08b0 (void)"
+  , "{"
+  , "  return (time_t_fun)();"
+  , "}"
+  , "clock_t hs_bindgen_b472ecf9ffec8045 (void)"
+  , "{"
+  , "  return (clock_t_fun)();"
+  , "}"
+  , "FILE *hs_bindgen_0caa7d72a7701f1f (void)"
+  , "{"
+  , "  return (FILE_fun)();"
+  , "}"
+  , "fpos_t *hs_bindgen_47b37de28902f506 (void)"
+  , "{"
+  , "  return (fpos_t_fun)();"
+  , "}"
+  , "sig_atomic_t hs_bindgen_222eab426c700a03 (void)"
+  , "{"
+  , "  return (sig_atomic_t_fun)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_bool_fun@
+foreign import ccall safe "hs_bindgen_4cd199ba56c14547" hs_bindgen_4cd199ba56c14547_base ::
+     IO BG.CBool
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_bool_fun@
+hs_bindgen_4cd199ba56c14547 :: IO BG.CBool
+hs_bindgen_4cd199ba56c14547 =
+  fmap BG.fromFFIType hs_bindgen_4cd199ba56c14547_base
+
+{-| __C declaration:__ @bool_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 20:6@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+bool_fun :: IO BG.CBool
+bool_fun = hs_bindgen_4cd199ba56c14547
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int8_t_fun@
+foreign import ccall safe "hs_bindgen_73c8e1f452482878" hs_bindgen_73c8e1f452482878_base ::
+     IO HsBindgen.Runtime.LibC.Int8
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int8_t_fun@
+hs_bindgen_73c8e1f452482878 :: IO HsBindgen.Runtime.LibC.Int8
+hs_bindgen_73c8e1f452482878 =
+  fmap BG.fromFFIType hs_bindgen_73c8e1f452482878_base
+
+{-| __C declaration:__ @int8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 23:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int8_t_fun :: IO HsBindgen.Runtime.LibC.Int8
+int8_t_fun = hs_bindgen_73c8e1f452482878
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int16_t_fun@
+foreign import ccall safe "hs_bindgen_da3259b2446eb9bf" hs_bindgen_da3259b2446eb9bf_base ::
+     IO HsBindgen.Runtime.LibC.Int16
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int16_t_fun@
+hs_bindgen_da3259b2446eb9bf :: IO HsBindgen.Runtime.LibC.Int16
+hs_bindgen_da3259b2446eb9bf =
+  fmap BG.fromFFIType hs_bindgen_da3259b2446eb9bf_base
+
+{-| __C declaration:__ @int16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 24:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int16_t_fun :: IO HsBindgen.Runtime.LibC.Int16
+int16_t_fun = hs_bindgen_da3259b2446eb9bf
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int32_t_fun@
+foreign import ccall safe "hs_bindgen_7dd577f0c34f0ff7" hs_bindgen_7dd577f0c34f0ff7_base ::
+     IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int32_t_fun@
+hs_bindgen_7dd577f0c34f0ff7 :: IO HsBindgen.Runtime.LibC.Int32
+hs_bindgen_7dd577f0c34f0ff7 =
+  fmap BG.fromFFIType hs_bindgen_7dd577f0c34f0ff7_base
+
+{-| __C declaration:__ @int32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 25:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int32_t_fun :: IO HsBindgen.Runtime.LibC.Int32
+int32_t_fun = hs_bindgen_7dd577f0c34f0ff7
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int64_t_fun@
+foreign import ccall safe "hs_bindgen_7a2709fa911a350e" hs_bindgen_7a2709fa911a350e_base ::
+     IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int64_t_fun@
+hs_bindgen_7a2709fa911a350e :: IO HsBindgen.Runtime.LibC.Int64
+hs_bindgen_7a2709fa911a350e =
+  fmap BG.fromFFIType hs_bindgen_7a2709fa911a350e_base
+
+{-| __C declaration:__ @int64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 26:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int64_t_fun :: IO HsBindgen.Runtime.LibC.Int64
+int64_t_fun = hs_bindgen_7a2709fa911a350e
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint8_t_fun@
+foreign import ccall safe "hs_bindgen_1b2e687eaa715924" hs_bindgen_1b2e687eaa715924_base ::
+     IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint8_t_fun@
+hs_bindgen_1b2e687eaa715924 :: IO HsBindgen.Runtime.LibC.Word8
+hs_bindgen_1b2e687eaa715924 =
+  fmap BG.fromFFIType hs_bindgen_1b2e687eaa715924_base
+
+{-| __C declaration:__ @uint8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 27:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint8_t_fun :: IO HsBindgen.Runtime.LibC.Word8
+uint8_t_fun = hs_bindgen_1b2e687eaa715924
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint16_t_fun@
+foreign import ccall safe "hs_bindgen_6da73658633b176e" hs_bindgen_6da73658633b176e_base ::
+     IO HsBindgen.Runtime.LibC.Word16
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint16_t_fun@
+hs_bindgen_6da73658633b176e :: IO HsBindgen.Runtime.LibC.Word16
+hs_bindgen_6da73658633b176e =
+  fmap BG.fromFFIType hs_bindgen_6da73658633b176e_base
+
+{-| __C declaration:__ @uint16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 28:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint16_t_fun :: IO HsBindgen.Runtime.LibC.Word16
+uint16_t_fun = hs_bindgen_6da73658633b176e
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint32_t_fun@
+foreign import ccall safe "hs_bindgen_c6cd0ee414c746de" hs_bindgen_c6cd0ee414c746de_base ::
+     IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint32_t_fun@
+hs_bindgen_c6cd0ee414c746de :: IO HsBindgen.Runtime.LibC.Word32
+hs_bindgen_c6cd0ee414c746de =
+  fmap BG.fromFFIType hs_bindgen_c6cd0ee414c746de_base
+
+{-| __C declaration:__ @uint32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 29:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint32_t_fun :: IO HsBindgen.Runtime.LibC.Word32
+uint32_t_fun = hs_bindgen_c6cd0ee414c746de
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint64_t_fun@
+foreign import ccall safe "hs_bindgen_cbb9017c67ce7652" hs_bindgen_cbb9017c67ce7652_base ::
+     IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint64_t_fun@
+hs_bindgen_cbb9017c67ce7652 :: IO HsBindgen.Runtime.LibC.Word64
+hs_bindgen_cbb9017c67ce7652 =
+  fmap BG.fromFFIType hs_bindgen_cbb9017c67ce7652_base
+
+{-| __C declaration:__ @uint64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 30:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint64_t_fun :: IO HsBindgen.Runtime.LibC.Word64
+uint64_t_fun = hs_bindgen_cbb9017c67ce7652
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intmax_t_fun@
+foreign import ccall safe "hs_bindgen_844bf55e16de43a0" hs_bindgen_844bf55e16de43a0_base ::
+     IO HsBindgen.Runtime.LibC.CIntMax
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intmax_t_fun@
+hs_bindgen_844bf55e16de43a0 :: IO HsBindgen.Runtime.LibC.CIntMax
+hs_bindgen_844bf55e16de43a0 =
+  fmap BG.fromFFIType hs_bindgen_844bf55e16de43a0_base
+
+{-| __C declaration:__ @intmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 31:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intmax_t_fun :: IO HsBindgen.Runtime.LibC.CIntMax
+intmax_t_fun = hs_bindgen_844bf55e16de43a0
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintmax_t_fun@
+foreign import ccall safe "hs_bindgen_56900c9a548480d5" hs_bindgen_56900c9a548480d5_base ::
+     IO HsBindgen.Runtime.LibC.CUIntMax
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintmax_t_fun@
+hs_bindgen_56900c9a548480d5 :: IO HsBindgen.Runtime.LibC.CUIntMax
+hs_bindgen_56900c9a548480d5 =
+  fmap BG.fromFFIType hs_bindgen_56900c9a548480d5_base
+
+{-| __C declaration:__ @uintmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 32:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintmax_t_fun :: IO HsBindgen.Runtime.LibC.CUIntMax
+uintmax_t_fun = hs_bindgen_56900c9a548480d5
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intptr_t_fun@
+foreign import ccall safe "hs_bindgen_d656827fe2704de3" hs_bindgen_d656827fe2704de3_base ::
+     IO HsBindgen.Runtime.LibC.CIntPtr
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intptr_t_fun@
+hs_bindgen_d656827fe2704de3 :: IO HsBindgen.Runtime.LibC.CIntPtr
+hs_bindgen_d656827fe2704de3 =
+  fmap BG.fromFFIType hs_bindgen_d656827fe2704de3_base
+
+{-| __C declaration:__ @intptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 33:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intptr_t_fun :: IO HsBindgen.Runtime.LibC.CIntPtr
+intptr_t_fun = hs_bindgen_d656827fe2704de3
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintptr_t_fun@
+foreign import ccall safe "hs_bindgen_401c738c79c5e4ef" hs_bindgen_401c738c79c5e4ef_base ::
+     IO HsBindgen.Runtime.LibC.CUIntPtr
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintptr_t_fun@
+hs_bindgen_401c738c79c5e4ef :: IO HsBindgen.Runtime.LibC.CUIntPtr
+hs_bindgen_401c738c79c5e4ef =
+  fmap BG.fromFFIType hs_bindgen_401c738c79c5e4ef_base
+
+{-| __C declaration:__ @uintptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 34:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintptr_t_fun :: IO HsBindgen.Runtime.LibC.CUIntPtr
+uintptr_t_fun = hs_bindgen_401c738c79c5e4ef
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fenv_t_fun@
+foreign import ccall safe "hs_bindgen_eb417aeaae001cd4" hs_bindgen_eb417aeaae001cd4_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fenv_t_fun@
+hs_bindgen_eb417aeaae001cd4 :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFenvT)
+hs_bindgen_eb417aeaae001cd4 =
+  fmap BG.fromFFIType hs_bindgen_eb417aeaae001cd4_base
+
+{-| __C declaration:__ @fenv_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 37:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fenv_t_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFenvT)
+fenv_t_fun = hs_bindgen_eb417aeaae001cd4
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fexcept_t_fun@
+foreign import ccall safe "hs_bindgen_42f9ee7a2fa5ed3b" hs_bindgen_42f9ee7a2fa5ed3b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fexcept_t_fun@
+hs_bindgen_42f9ee7a2fa5ed3b :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFexceptT)
+hs_bindgen_42f9ee7a2fa5ed3b =
+  fmap BG.fromFFIType hs_bindgen_42f9ee7a2fa5ed3b_base
+
+{-| __C declaration:__ @fexcept_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 38:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fexcept_t_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFexceptT)
+fexcept_t_fun = hs_bindgen_42f9ee7a2fa5ed3b
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_size_t_fun@
+foreign import ccall safe "hs_bindgen_66f735fc270b795a" hs_bindgen_66f735fc270b795a_base ::
+     IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_size_t_fun@
+hs_bindgen_66f735fc270b795a :: IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_66f735fc270b795a =
+  fmap BG.fromFFIType hs_bindgen_66f735fc270b795a_base
+
+{-| __C declaration:__ @size_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 41:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+size_t_fun :: IO HsBindgen.Runtime.LibC.CSize
+size_t_fun = hs_bindgen_66f735fc270b795a
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_ptrdiff_t_fun@
+foreign import ccall safe "hs_bindgen_2f5574764965bb49" hs_bindgen_2f5574764965bb49_base ::
+     IO HsBindgen.Runtime.LibC.CPtrdiff
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_ptrdiff_t_fun@
+hs_bindgen_2f5574764965bb49 :: IO HsBindgen.Runtime.LibC.CPtrdiff
+hs_bindgen_2f5574764965bb49 =
+  fmap BG.fromFFIType hs_bindgen_2f5574764965bb49_base
+
+{-| __C declaration:__ @ptrdiff_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 42:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+ptrdiff_t_fun :: IO HsBindgen.Runtime.LibC.CPtrdiff
+ptrdiff_t_fun = hs_bindgen_2f5574764965bb49
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wchar_t_fun@
+foreign import ccall safe "hs_bindgen_57ff329a6c1ab247" hs_bindgen_57ff329a6c1ab247_base ::
+     IO HsBindgen.Runtime.LibC.CWchar
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wchar_t_fun@
+hs_bindgen_57ff329a6c1ab247 :: IO HsBindgen.Runtime.LibC.CWchar
+hs_bindgen_57ff329a6c1ab247 =
+  fmap BG.fromFFIType hs_bindgen_57ff329a6c1ab247_base
+
+{-| __C declaration:__ @wchar_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 49:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wchar_t_fun :: IO HsBindgen.Runtime.LibC.CWchar
+wchar_t_fun = hs_bindgen_57ff329a6c1ab247
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wint_t_fun@
+foreign import ccall safe "hs_bindgen_fef1399636729a64" hs_bindgen_fef1399636729a64_base ::
+     IO HsBindgen.Runtime.LibC.CWintT
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wint_t_fun@
+hs_bindgen_fef1399636729a64 :: IO HsBindgen.Runtime.LibC.CWintT
+hs_bindgen_fef1399636729a64 =
+  fmap BG.fromFFIType hs_bindgen_fef1399636729a64_base
+
+{-| __C declaration:__ @wint_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 50:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wint_t_fun :: IO HsBindgen.Runtime.LibC.CWintT
+wint_t_fun = hs_bindgen_fef1399636729a64
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_mbstate_t_fun@
+foreign import ccall safe "hs_bindgen_ec1c0b9428114ec6" hs_bindgen_ec1c0b9428114ec6_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_mbstate_t_fun@
+hs_bindgen_ec1c0b9428114ec6 :: IO (BG.Ptr HsBindgen.Runtime.LibC.CMbstateT)
+hs_bindgen_ec1c0b9428114ec6 =
+  fmap BG.fromFFIType hs_bindgen_ec1c0b9428114ec6_base
+
+{-| __C declaration:__ @mbstate_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 51:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+mbstate_t_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CMbstateT)
+mbstate_t_fun = hs_bindgen_ec1c0b9428114ec6
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctrans_t_fun@
+foreign import ccall safe "hs_bindgen_2d9b204c006f0667" hs_bindgen_2d9b204c006f0667_base ::
+     IO HsBindgen.Runtime.LibC.CWctransT
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctrans_t_fun@
+hs_bindgen_2d9b204c006f0667 :: IO HsBindgen.Runtime.LibC.CWctransT
+hs_bindgen_2d9b204c006f0667 =
+  fmap BG.fromFFIType hs_bindgen_2d9b204c006f0667_base
+
+{-| __C declaration:__ @wctrans_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 52:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctrans_t_fun :: IO HsBindgen.Runtime.LibC.CWctransT
+wctrans_t_fun = hs_bindgen_2d9b204c006f0667
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctype_t_fun@
+foreign import ccall safe "hs_bindgen_977cddf620e22ba0" hs_bindgen_977cddf620e22ba0_base ::
+     IO HsBindgen.Runtime.LibC.CWctypeT
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctype_t_fun@
+hs_bindgen_977cddf620e22ba0 :: IO HsBindgen.Runtime.LibC.CWctypeT
+hs_bindgen_977cddf620e22ba0 =
+  fmap BG.fromFFIType hs_bindgen_977cddf620e22ba0_base
+
+{-| __C declaration:__ @wctype_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 53:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctype_t_fun :: IO HsBindgen.Runtime.LibC.CWctypeT
+wctype_t_fun = hs_bindgen_977cddf620e22ba0
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char16_t_fun@
+foreign import ccall safe "hs_bindgen_4780a15ae4e392fd" hs_bindgen_4780a15ae4e392fd_base ::
+     IO HsBindgen.Runtime.LibC.CChar16T
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char16_t_fun@
+hs_bindgen_4780a15ae4e392fd :: IO HsBindgen.Runtime.LibC.CChar16T
+hs_bindgen_4780a15ae4e392fd =
+  fmap BG.fromFFIType hs_bindgen_4780a15ae4e392fd_base
+
+{-| __C declaration:__ @char16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 54:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char16_t_fun :: IO HsBindgen.Runtime.LibC.CChar16T
+char16_t_fun = hs_bindgen_4780a15ae4e392fd
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char32_t_fun@
+foreign import ccall safe "hs_bindgen_d258f4d9903b4e39" hs_bindgen_d258f4d9903b4e39_base ::
+     IO HsBindgen.Runtime.LibC.CChar32T
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char32_t_fun@
+hs_bindgen_d258f4d9903b4e39 :: IO HsBindgen.Runtime.LibC.CChar32T
+hs_bindgen_d258f4d9903b4e39 =
+  fmap BG.fromFFIType hs_bindgen_d258f4d9903b4e39_base
+
+{-| __C declaration:__ @char32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 55:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char32_t_fun :: IO HsBindgen.Runtime.LibC.CChar32T
+char32_t_fun = hs_bindgen_d258f4d9903b4e39
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_time_t_fun@
+foreign import ccall safe "hs_bindgen_82c178bd7c4d08b0" hs_bindgen_82c178bd7c4d08b0_base ::
+     IO HsBindgen.Runtime.LibC.CTime
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_time_t_fun@
+hs_bindgen_82c178bd7c4d08b0 :: IO HsBindgen.Runtime.LibC.CTime
+hs_bindgen_82c178bd7c4d08b0 =
+  fmap BG.fromFFIType hs_bindgen_82c178bd7c4d08b0_base
+
+{-| __C declaration:__ @time_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 58:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+time_t_fun :: IO HsBindgen.Runtime.LibC.CTime
+time_t_fun = hs_bindgen_82c178bd7c4d08b0
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_clock_t_fun@
+foreign import ccall safe "hs_bindgen_b472ecf9ffec8045" hs_bindgen_b472ecf9ffec8045_base ::
+     IO HsBindgen.Runtime.LibC.CClock
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_clock_t_fun@
+hs_bindgen_b472ecf9ffec8045 :: IO HsBindgen.Runtime.LibC.CClock
+hs_bindgen_b472ecf9ffec8045 =
+  fmap BG.fromFFIType hs_bindgen_b472ecf9ffec8045_base
+
+{-| __C declaration:__ @clock_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 59:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+clock_t_fun :: IO HsBindgen.Runtime.LibC.CClock
+clock_t_fun = hs_bindgen_b472ecf9ffec8045
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_FILE_fun@
+foreign import ccall safe "hs_bindgen_0caa7d72a7701f1f" hs_bindgen_0caa7d72a7701f1f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_FILE_fun@
+hs_bindgen_0caa7d72a7701f1f :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFile)
+hs_bindgen_0caa7d72a7701f1f =
+  fmap BG.fromFFIType hs_bindgen_0caa7d72a7701f1f_base
+
+{-| __C declaration:__ @FILE_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 64:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fILE_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFile)
+fILE_fun = hs_bindgen_0caa7d72a7701f1f
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fpos_t_fun@
+foreign import ccall safe "hs_bindgen_47b37de28902f506" hs_bindgen_47b37de28902f506_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fpos_t_fun@
+hs_bindgen_47b37de28902f506 :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFpos)
+hs_bindgen_47b37de28902f506 =
+  fmap BG.fromFFIType hs_bindgen_47b37de28902f506_base
+
+{-| __C declaration:__ @fpos_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 65:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fpos_t_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFpos)
+fpos_t_fun = hs_bindgen_47b37de28902f506
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_sig_atomic_t_fun@
+foreign import ccall safe "hs_bindgen_222eab426c700a03" hs_bindgen_222eab426c700a03_base ::
+     IO HsBindgen.Runtime.LibC.CSigAtomic
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_sig_atomic_t_fun@
+hs_bindgen_222eab426c700a03 :: IO HsBindgen.Runtime.LibC.CSigAtomic
+hs_bindgen_222eab426c700a03 =
+  fmap BG.fromFFIType hs_bindgen_222eab426c700a03_base
+
+{-| __C declaration:__ @sig_atomic_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 68:14@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+sig_atomic_t_fun :: IO HsBindgen.Runtime.LibC.CSigAtomic
+sig_atomic_t_fun = hs_bindgen_222eab426c700a03
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/return_values/Example/Unsafe.hs
@@ -0,0 +1,684 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.bool_fun
+    , Example.Unsafe.int8_t_fun
+    , Example.Unsafe.int16_t_fun
+    , Example.Unsafe.int32_t_fun
+    , Example.Unsafe.int64_t_fun
+    , Example.Unsafe.uint8_t_fun
+    , Example.Unsafe.uint16_t_fun
+    , Example.Unsafe.uint32_t_fun
+    , Example.Unsafe.uint64_t_fun
+    , Example.Unsafe.intmax_t_fun
+    , Example.Unsafe.uintmax_t_fun
+    , Example.Unsafe.intptr_t_fun
+    , Example.Unsafe.uintptr_t_fun
+    , Example.Unsafe.fenv_t_fun
+    , Example.Unsafe.fexcept_t_fun
+    , Example.Unsafe.size_t_fun
+    , Example.Unsafe.ptrdiff_t_fun
+    , Example.Unsafe.wchar_t_fun
+    , Example.Unsafe.wint_t_fun
+    , Example.Unsafe.mbstate_t_fun
+    , Example.Unsafe.wctrans_t_fun
+    , Example.Unsafe.wctype_t_fun
+    , Example.Unsafe.char16_t_fun
+    , Example.Unsafe.char32_t_fun
+    , Example.Unsafe.time_t_fun
+    , Example.Unsafe.clock_t_fun
+    , Example.Unsafe.fILE_fun
+    , Example.Unsafe.fpos_t_fun
+    , Example.Unsafe.sig_atomic_t_fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/stdlib/return_values.h>"
+  , "_Bool hs_bindgen_6b68851ce9c1f36f (void)"
+  , "{"
+  , "  return (bool_fun)();"
+  , "}"
+  , "int8_t hs_bindgen_a408da1bfa030a51 (void)"
+  , "{"
+  , "  return (int8_t_fun)();"
+  , "}"
+  , "int16_t hs_bindgen_6785058f9844b9b5 (void)"
+  , "{"
+  , "  return (int16_t_fun)();"
+  , "}"
+  , "int32_t hs_bindgen_191a7b2b445fb350 (void)"
+  , "{"
+  , "  return (int32_t_fun)();"
+  , "}"
+  , "int64_t hs_bindgen_0a523ac71d31b35c (void)"
+  , "{"
+  , "  return (int64_t_fun)();"
+  , "}"
+  , "uint8_t hs_bindgen_f4245406bfdade75 (void)"
+  , "{"
+  , "  return (uint8_t_fun)();"
+  , "}"
+  , "uint16_t hs_bindgen_f7a0d726d7268b30 (void)"
+  , "{"
+  , "  return (uint16_t_fun)();"
+  , "}"
+  , "uint32_t hs_bindgen_432f65d5f6e3c062 (void)"
+  , "{"
+  , "  return (uint32_t_fun)();"
+  , "}"
+  , "uint64_t hs_bindgen_af91a28f07360676 (void)"
+  , "{"
+  , "  return (uint64_t_fun)();"
+  , "}"
+  , "intmax_t hs_bindgen_34ebd7f9b1c9877f (void)"
+  , "{"
+  , "  return (intmax_t_fun)();"
+  , "}"
+  , "uintmax_t hs_bindgen_f147b22f36663ba2 (void)"
+  , "{"
+  , "  return (uintmax_t_fun)();"
+  , "}"
+  , "intptr_t hs_bindgen_42bfd915930be089 (void)"
+  , "{"
+  , "  return (intptr_t_fun)();"
+  , "}"
+  , "uintptr_t hs_bindgen_3d4e032e4f99ccdf (void)"
+  , "{"
+  , "  return (uintptr_t_fun)();"
+  , "}"
+  , "fenv_t *hs_bindgen_d12ec6bea98f91aa (void)"
+  , "{"
+  , "  return (fenv_t_fun)();"
+  , "}"
+  , "fexcept_t *hs_bindgen_bfb6abdc4397c064 (void)"
+  , "{"
+  , "  return (fexcept_t_fun)();"
+  , "}"
+  , "size_t hs_bindgen_3030e3c8a5de2e7e (void)"
+  , "{"
+  , "  return (size_t_fun)();"
+  , "}"
+  , "ptrdiff_t hs_bindgen_7033a7ddfdfe770f (void)"
+  , "{"
+  , "  return (ptrdiff_t_fun)();"
+  , "}"
+  , "wchar_t hs_bindgen_ebae7f4d5db1ecd0 (void)"
+  , "{"
+  , "  return (wchar_t_fun)();"
+  , "}"
+  , "wint_t hs_bindgen_623e42289a1c3dc3 (void)"
+  , "{"
+  , "  return (wint_t_fun)();"
+  , "}"
+  , "mbstate_t *hs_bindgen_bc84314eca8f2a7c (void)"
+  , "{"
+  , "  return (mbstate_t_fun)();"
+  , "}"
+  , "wctrans_t hs_bindgen_5524c9adc3841732 (void)"
+  , "{"
+  , "  return (wctrans_t_fun)();"
+  , "}"
+  , "wctype_t hs_bindgen_72885cbcc8213893 (void)"
+  , "{"
+  , "  return (wctype_t_fun)();"
+  , "}"
+  , "char16_t hs_bindgen_4284e8eb72d43965 (void)"
+  , "{"
+  , "  return (char16_t_fun)();"
+  , "}"
+  , "char32_t hs_bindgen_74e1167907c5de0e (void)"
+  , "{"
+  , "  return (char32_t_fun)();"
+  , "}"
+  , "time_t hs_bindgen_a0c949d46b12627a (void)"
+  , "{"
+  , "  return (time_t_fun)();"
+  , "}"
+  , "clock_t hs_bindgen_ac7afd479db138db (void)"
+  , "{"
+  , "  return (clock_t_fun)();"
+  , "}"
+  , "FILE *hs_bindgen_51b6e01d56713f95 (void)"
+  , "{"
+  , "  return (FILE_fun)();"
+  , "}"
+  , "fpos_t *hs_bindgen_e9ed5e9a298e9a7e (void)"
+  , "{"
+  , "  return (fpos_t_fun)();"
+  , "}"
+  , "sig_atomic_t hs_bindgen_1aecb4fb9faabcf5 (void)"
+  , "{"
+  , "  return (sig_atomic_t_fun)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_bool_fun@
+foreign import ccall unsafe "hs_bindgen_6b68851ce9c1f36f" hs_bindgen_6b68851ce9c1f36f_base ::
+     IO BG.CBool
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_bool_fun@
+hs_bindgen_6b68851ce9c1f36f :: IO BG.CBool
+hs_bindgen_6b68851ce9c1f36f =
+  fmap BG.fromFFIType hs_bindgen_6b68851ce9c1f36f_base
+
+{-| __C declaration:__ @bool_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 20:6@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+bool_fun :: IO BG.CBool
+bool_fun = hs_bindgen_6b68851ce9c1f36f
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int8_t_fun@
+foreign import ccall unsafe "hs_bindgen_a408da1bfa030a51" hs_bindgen_a408da1bfa030a51_base ::
+     IO HsBindgen.Runtime.LibC.Int8
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int8_t_fun@
+hs_bindgen_a408da1bfa030a51 :: IO HsBindgen.Runtime.LibC.Int8
+hs_bindgen_a408da1bfa030a51 =
+  fmap BG.fromFFIType hs_bindgen_a408da1bfa030a51_base
+
+{-| __C declaration:__ @int8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 23:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int8_t_fun :: IO HsBindgen.Runtime.LibC.Int8
+int8_t_fun = hs_bindgen_a408da1bfa030a51
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int16_t_fun@
+foreign import ccall unsafe "hs_bindgen_6785058f9844b9b5" hs_bindgen_6785058f9844b9b5_base ::
+     IO HsBindgen.Runtime.LibC.Int16
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int16_t_fun@
+hs_bindgen_6785058f9844b9b5 :: IO HsBindgen.Runtime.LibC.Int16
+hs_bindgen_6785058f9844b9b5 =
+  fmap BG.fromFFIType hs_bindgen_6785058f9844b9b5_base
+
+{-| __C declaration:__ @int16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 24:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int16_t_fun :: IO HsBindgen.Runtime.LibC.Int16
+int16_t_fun = hs_bindgen_6785058f9844b9b5
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int32_t_fun@
+foreign import ccall unsafe "hs_bindgen_191a7b2b445fb350" hs_bindgen_191a7b2b445fb350_base ::
+     IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int32_t_fun@
+hs_bindgen_191a7b2b445fb350 :: IO HsBindgen.Runtime.LibC.Int32
+hs_bindgen_191a7b2b445fb350 =
+  fmap BG.fromFFIType hs_bindgen_191a7b2b445fb350_base
+
+{-| __C declaration:__ @int32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 25:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int32_t_fun :: IO HsBindgen.Runtime.LibC.Int32
+int32_t_fun = hs_bindgen_191a7b2b445fb350
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int64_t_fun@
+foreign import ccall unsafe "hs_bindgen_0a523ac71d31b35c" hs_bindgen_0a523ac71d31b35c_base ::
+     IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int64_t_fun@
+hs_bindgen_0a523ac71d31b35c :: IO HsBindgen.Runtime.LibC.Int64
+hs_bindgen_0a523ac71d31b35c =
+  fmap BG.fromFFIType hs_bindgen_0a523ac71d31b35c_base
+
+{-| __C declaration:__ @int64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 26:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int64_t_fun :: IO HsBindgen.Runtime.LibC.Int64
+int64_t_fun = hs_bindgen_0a523ac71d31b35c
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint8_t_fun@
+foreign import ccall unsafe "hs_bindgen_f4245406bfdade75" hs_bindgen_f4245406bfdade75_base ::
+     IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint8_t_fun@
+hs_bindgen_f4245406bfdade75 :: IO HsBindgen.Runtime.LibC.Word8
+hs_bindgen_f4245406bfdade75 =
+  fmap BG.fromFFIType hs_bindgen_f4245406bfdade75_base
+
+{-| __C declaration:__ @uint8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 27:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint8_t_fun :: IO HsBindgen.Runtime.LibC.Word8
+uint8_t_fun = hs_bindgen_f4245406bfdade75
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint16_t_fun@
+foreign import ccall unsafe "hs_bindgen_f7a0d726d7268b30" hs_bindgen_f7a0d726d7268b30_base ::
+     IO HsBindgen.Runtime.LibC.Word16
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint16_t_fun@
+hs_bindgen_f7a0d726d7268b30 :: IO HsBindgen.Runtime.LibC.Word16
+hs_bindgen_f7a0d726d7268b30 =
+  fmap BG.fromFFIType hs_bindgen_f7a0d726d7268b30_base
+
+{-| __C declaration:__ @uint16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 28:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint16_t_fun :: IO HsBindgen.Runtime.LibC.Word16
+uint16_t_fun = hs_bindgen_f7a0d726d7268b30
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint32_t_fun@
+foreign import ccall unsafe "hs_bindgen_432f65d5f6e3c062" hs_bindgen_432f65d5f6e3c062_base ::
+     IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint32_t_fun@
+hs_bindgen_432f65d5f6e3c062 :: IO HsBindgen.Runtime.LibC.Word32
+hs_bindgen_432f65d5f6e3c062 =
+  fmap BG.fromFFIType hs_bindgen_432f65d5f6e3c062_base
+
+{-| __C declaration:__ @uint32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 29:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint32_t_fun :: IO HsBindgen.Runtime.LibC.Word32
+uint32_t_fun = hs_bindgen_432f65d5f6e3c062
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint64_t_fun@
+foreign import ccall unsafe "hs_bindgen_af91a28f07360676" hs_bindgen_af91a28f07360676_base ::
+     IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint64_t_fun@
+hs_bindgen_af91a28f07360676 :: IO HsBindgen.Runtime.LibC.Word64
+hs_bindgen_af91a28f07360676 =
+  fmap BG.fromFFIType hs_bindgen_af91a28f07360676_base
+
+{-| __C declaration:__ @uint64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 30:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint64_t_fun :: IO HsBindgen.Runtime.LibC.Word64
+uint64_t_fun = hs_bindgen_af91a28f07360676
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intmax_t_fun@
+foreign import ccall unsafe "hs_bindgen_34ebd7f9b1c9877f" hs_bindgen_34ebd7f9b1c9877f_base ::
+     IO HsBindgen.Runtime.LibC.CIntMax
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intmax_t_fun@
+hs_bindgen_34ebd7f9b1c9877f :: IO HsBindgen.Runtime.LibC.CIntMax
+hs_bindgen_34ebd7f9b1c9877f =
+  fmap BG.fromFFIType hs_bindgen_34ebd7f9b1c9877f_base
+
+{-| __C declaration:__ @intmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 31:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intmax_t_fun :: IO HsBindgen.Runtime.LibC.CIntMax
+intmax_t_fun = hs_bindgen_34ebd7f9b1c9877f
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintmax_t_fun@
+foreign import ccall unsafe "hs_bindgen_f147b22f36663ba2" hs_bindgen_f147b22f36663ba2_base ::
+     IO HsBindgen.Runtime.LibC.CUIntMax
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintmax_t_fun@
+hs_bindgen_f147b22f36663ba2 :: IO HsBindgen.Runtime.LibC.CUIntMax
+hs_bindgen_f147b22f36663ba2 =
+  fmap BG.fromFFIType hs_bindgen_f147b22f36663ba2_base
+
+{-| __C declaration:__ @uintmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 32:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintmax_t_fun :: IO HsBindgen.Runtime.LibC.CUIntMax
+uintmax_t_fun = hs_bindgen_f147b22f36663ba2
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intptr_t_fun@
+foreign import ccall unsafe "hs_bindgen_42bfd915930be089" hs_bindgen_42bfd915930be089_base ::
+     IO HsBindgen.Runtime.LibC.CIntPtr
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intptr_t_fun@
+hs_bindgen_42bfd915930be089 :: IO HsBindgen.Runtime.LibC.CIntPtr
+hs_bindgen_42bfd915930be089 =
+  fmap BG.fromFFIType hs_bindgen_42bfd915930be089_base
+
+{-| __C declaration:__ @intptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 33:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intptr_t_fun :: IO HsBindgen.Runtime.LibC.CIntPtr
+intptr_t_fun = hs_bindgen_42bfd915930be089
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintptr_t_fun@
+foreign import ccall unsafe "hs_bindgen_3d4e032e4f99ccdf" hs_bindgen_3d4e032e4f99ccdf_base ::
+     IO HsBindgen.Runtime.LibC.CUIntPtr
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintptr_t_fun@
+hs_bindgen_3d4e032e4f99ccdf :: IO HsBindgen.Runtime.LibC.CUIntPtr
+hs_bindgen_3d4e032e4f99ccdf =
+  fmap BG.fromFFIType hs_bindgen_3d4e032e4f99ccdf_base
+
+{-| __C declaration:__ @uintptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 34:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintptr_t_fun :: IO HsBindgen.Runtime.LibC.CUIntPtr
+uintptr_t_fun = hs_bindgen_3d4e032e4f99ccdf
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fenv_t_fun@
+foreign import ccall unsafe "hs_bindgen_d12ec6bea98f91aa" hs_bindgen_d12ec6bea98f91aa_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fenv_t_fun@
+hs_bindgen_d12ec6bea98f91aa :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFenvT)
+hs_bindgen_d12ec6bea98f91aa =
+  fmap BG.fromFFIType hs_bindgen_d12ec6bea98f91aa_base
+
+{-| __C declaration:__ @fenv_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 37:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fenv_t_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFenvT)
+fenv_t_fun = hs_bindgen_d12ec6bea98f91aa
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fexcept_t_fun@
+foreign import ccall unsafe "hs_bindgen_bfb6abdc4397c064" hs_bindgen_bfb6abdc4397c064_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fexcept_t_fun@
+hs_bindgen_bfb6abdc4397c064 :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFexceptT)
+hs_bindgen_bfb6abdc4397c064 =
+  fmap BG.fromFFIType hs_bindgen_bfb6abdc4397c064_base
+
+{-| __C declaration:__ @fexcept_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 38:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fexcept_t_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFexceptT)
+fexcept_t_fun = hs_bindgen_bfb6abdc4397c064
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_size_t_fun@
+foreign import ccall unsafe "hs_bindgen_3030e3c8a5de2e7e" hs_bindgen_3030e3c8a5de2e7e_base ::
+     IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_size_t_fun@
+hs_bindgen_3030e3c8a5de2e7e :: IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_3030e3c8a5de2e7e =
+  fmap BG.fromFFIType hs_bindgen_3030e3c8a5de2e7e_base
+
+{-| __C declaration:__ @size_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 41:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+size_t_fun :: IO HsBindgen.Runtime.LibC.CSize
+size_t_fun = hs_bindgen_3030e3c8a5de2e7e
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_ptrdiff_t_fun@
+foreign import ccall unsafe "hs_bindgen_7033a7ddfdfe770f" hs_bindgen_7033a7ddfdfe770f_base ::
+     IO HsBindgen.Runtime.LibC.CPtrdiff
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_ptrdiff_t_fun@
+hs_bindgen_7033a7ddfdfe770f :: IO HsBindgen.Runtime.LibC.CPtrdiff
+hs_bindgen_7033a7ddfdfe770f =
+  fmap BG.fromFFIType hs_bindgen_7033a7ddfdfe770f_base
+
+{-| __C declaration:__ @ptrdiff_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 42:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+ptrdiff_t_fun :: IO HsBindgen.Runtime.LibC.CPtrdiff
+ptrdiff_t_fun = hs_bindgen_7033a7ddfdfe770f
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wchar_t_fun@
+foreign import ccall unsafe "hs_bindgen_ebae7f4d5db1ecd0" hs_bindgen_ebae7f4d5db1ecd0_base ::
+     IO HsBindgen.Runtime.LibC.CWchar
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wchar_t_fun@
+hs_bindgen_ebae7f4d5db1ecd0 :: IO HsBindgen.Runtime.LibC.CWchar
+hs_bindgen_ebae7f4d5db1ecd0 =
+  fmap BG.fromFFIType hs_bindgen_ebae7f4d5db1ecd0_base
+
+{-| __C declaration:__ @wchar_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 49:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wchar_t_fun :: IO HsBindgen.Runtime.LibC.CWchar
+wchar_t_fun = hs_bindgen_ebae7f4d5db1ecd0
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wint_t_fun@
+foreign import ccall unsafe "hs_bindgen_623e42289a1c3dc3" hs_bindgen_623e42289a1c3dc3_base ::
+     IO HsBindgen.Runtime.LibC.CWintT
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wint_t_fun@
+hs_bindgen_623e42289a1c3dc3 :: IO HsBindgen.Runtime.LibC.CWintT
+hs_bindgen_623e42289a1c3dc3 =
+  fmap BG.fromFFIType hs_bindgen_623e42289a1c3dc3_base
+
+{-| __C declaration:__ @wint_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 50:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wint_t_fun :: IO HsBindgen.Runtime.LibC.CWintT
+wint_t_fun = hs_bindgen_623e42289a1c3dc3
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_mbstate_t_fun@
+foreign import ccall unsafe "hs_bindgen_bc84314eca8f2a7c" hs_bindgen_bc84314eca8f2a7c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_mbstate_t_fun@
+hs_bindgen_bc84314eca8f2a7c :: IO (BG.Ptr HsBindgen.Runtime.LibC.CMbstateT)
+hs_bindgen_bc84314eca8f2a7c =
+  fmap BG.fromFFIType hs_bindgen_bc84314eca8f2a7c_base
+
+{-| __C declaration:__ @mbstate_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 51:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+mbstate_t_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CMbstateT)
+mbstate_t_fun = hs_bindgen_bc84314eca8f2a7c
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctrans_t_fun@
+foreign import ccall unsafe "hs_bindgen_5524c9adc3841732" hs_bindgen_5524c9adc3841732_base ::
+     IO HsBindgen.Runtime.LibC.CWctransT
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctrans_t_fun@
+hs_bindgen_5524c9adc3841732 :: IO HsBindgen.Runtime.LibC.CWctransT
+hs_bindgen_5524c9adc3841732 =
+  fmap BG.fromFFIType hs_bindgen_5524c9adc3841732_base
+
+{-| __C declaration:__ @wctrans_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 52:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctrans_t_fun :: IO HsBindgen.Runtime.LibC.CWctransT
+wctrans_t_fun = hs_bindgen_5524c9adc3841732
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctype_t_fun@
+foreign import ccall unsafe "hs_bindgen_72885cbcc8213893" hs_bindgen_72885cbcc8213893_base ::
+     IO HsBindgen.Runtime.LibC.CWctypeT
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctype_t_fun@
+hs_bindgen_72885cbcc8213893 :: IO HsBindgen.Runtime.LibC.CWctypeT
+hs_bindgen_72885cbcc8213893 =
+  fmap BG.fromFFIType hs_bindgen_72885cbcc8213893_base
+
+{-| __C declaration:__ @wctype_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 53:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctype_t_fun :: IO HsBindgen.Runtime.LibC.CWctypeT
+wctype_t_fun = hs_bindgen_72885cbcc8213893
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char16_t_fun@
+foreign import ccall unsafe "hs_bindgen_4284e8eb72d43965" hs_bindgen_4284e8eb72d43965_base ::
+     IO HsBindgen.Runtime.LibC.CChar16T
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char16_t_fun@
+hs_bindgen_4284e8eb72d43965 :: IO HsBindgen.Runtime.LibC.CChar16T
+hs_bindgen_4284e8eb72d43965 =
+  fmap BG.fromFFIType hs_bindgen_4284e8eb72d43965_base
+
+{-| __C declaration:__ @char16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 54:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char16_t_fun :: IO HsBindgen.Runtime.LibC.CChar16T
+char16_t_fun = hs_bindgen_4284e8eb72d43965
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char32_t_fun@
+foreign import ccall unsafe "hs_bindgen_74e1167907c5de0e" hs_bindgen_74e1167907c5de0e_base ::
+     IO HsBindgen.Runtime.LibC.CChar32T
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char32_t_fun@
+hs_bindgen_74e1167907c5de0e :: IO HsBindgen.Runtime.LibC.CChar32T
+hs_bindgen_74e1167907c5de0e =
+  fmap BG.fromFFIType hs_bindgen_74e1167907c5de0e_base
+
+{-| __C declaration:__ @char32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 55:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char32_t_fun :: IO HsBindgen.Runtime.LibC.CChar32T
+char32_t_fun = hs_bindgen_74e1167907c5de0e
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_time_t_fun@
+foreign import ccall unsafe "hs_bindgen_a0c949d46b12627a" hs_bindgen_a0c949d46b12627a_base ::
+     IO HsBindgen.Runtime.LibC.CTime
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_time_t_fun@
+hs_bindgen_a0c949d46b12627a :: IO HsBindgen.Runtime.LibC.CTime
+hs_bindgen_a0c949d46b12627a =
+  fmap BG.fromFFIType hs_bindgen_a0c949d46b12627a_base
+
+{-| __C declaration:__ @time_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 58:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+time_t_fun :: IO HsBindgen.Runtime.LibC.CTime
+time_t_fun = hs_bindgen_a0c949d46b12627a
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_clock_t_fun@
+foreign import ccall unsafe "hs_bindgen_ac7afd479db138db" hs_bindgen_ac7afd479db138db_base ::
+     IO HsBindgen.Runtime.LibC.CClock
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_clock_t_fun@
+hs_bindgen_ac7afd479db138db :: IO HsBindgen.Runtime.LibC.CClock
+hs_bindgen_ac7afd479db138db =
+  fmap BG.fromFFIType hs_bindgen_ac7afd479db138db_base
+
+{-| __C declaration:__ @clock_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 59:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+clock_t_fun :: IO HsBindgen.Runtime.LibC.CClock
+clock_t_fun = hs_bindgen_ac7afd479db138db
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_FILE_fun@
+foreign import ccall unsafe "hs_bindgen_51b6e01d56713f95" hs_bindgen_51b6e01d56713f95_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_FILE_fun@
+hs_bindgen_51b6e01d56713f95 :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFile)
+hs_bindgen_51b6e01d56713f95 =
+  fmap BG.fromFFIType hs_bindgen_51b6e01d56713f95_base
+
+{-| __C declaration:__ @FILE_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 64:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fILE_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFile)
+fILE_fun = hs_bindgen_51b6e01d56713f95
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fpos_t_fun@
+foreign import ccall unsafe "hs_bindgen_e9ed5e9a298e9a7e" hs_bindgen_e9ed5e9a298e9a7e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fpos_t_fun@
+hs_bindgen_e9ed5e9a298e9a7e :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFpos)
+hs_bindgen_e9ed5e9a298e9a7e =
+  fmap BG.fromFFIType hs_bindgen_e9ed5e9a298e9a7e_base
+
+{-| __C declaration:__ @fpos_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 65:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fpos_t_fun :: IO (BG.Ptr HsBindgen.Runtime.LibC.CFpos)
+fpos_t_fun = hs_bindgen_e9ed5e9a298e9a7e
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_sig_atomic_t_fun@
+foreign import ccall unsafe "hs_bindgen_1aecb4fb9faabcf5" hs_bindgen_1aecb4fb9faabcf5_base ::
+     IO HsBindgen.Runtime.LibC.CSigAtomic
+
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_sig_atomic_t_fun@
+hs_bindgen_1aecb4fb9faabcf5 :: IO HsBindgen.Runtime.LibC.CSigAtomic
+hs_bindgen_1aecb4fb9faabcf5 =
+  fmap BG.fromFFIType hs_bindgen_1aecb4fb9faabcf5_base
+
+{-| __C declaration:__ @sig_atomic_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 68:14@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+sig_atomic_t_fun :: IO HsBindgen.Runtime.LibC.CSigAtomic
+sig_atomic_t_fun = hs_bindgen_1aecb4fb9faabcf5
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/return_values/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/stdlib/return_values/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/return_values/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/binding-specs/stdlib/return_values/th.txt b/test-artefacts/fixtures/binding-specs/stdlib/return_values/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/stdlib/return_values/th.txt
@@ -0,0 +1,2309 @@
+-- addDependentFile musl-include/x86_64/bits/fenv.h
+-- addDependentFile musl-include/x86_64/fenv.h
+-- addDependentFile musl-include/x86_64/features.h
+-- addDependentFile musl-include/x86_64/bits/setjmp.h
+-- addDependentFile musl-include/x86_64/setjmp.h
+-- addDependentFile musl-include/x86_64/bits/signal.h
+-- addDependentFile musl-include/x86_64/signal.h
+-- addDependentFile musl-include/x86_64/stdbool.h
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile musl-include/x86_64/stdio.h
+-- addDependentFile musl-include/x86_64/time.h
+-- addDependentFile musl-include/x86_64/uchar.h
+-- addDependentFile musl-include/x86_64/wchar.h
+-- addDependentFile musl-include/x86_64/wctype.h
+-- addDependentFile test-artefacts/headers/golden/binding-specs/stdlib/return_values.h
+-- #include <binding-specs/stdlib/return_values.h>
+-- _Bool hs_bindgen_4cd199ba56c14547 (void)
+-- {
+--   return (bool_fun)();
+-- }
+-- int8_t hs_bindgen_73c8e1f452482878 (void)
+-- {
+--   return (int8_t_fun)();
+-- }
+-- int16_t hs_bindgen_da3259b2446eb9bf (void)
+-- {
+--   return (int16_t_fun)();
+-- }
+-- int32_t hs_bindgen_7dd577f0c34f0ff7 (void)
+-- {
+--   return (int32_t_fun)();
+-- }
+-- int64_t hs_bindgen_7a2709fa911a350e (void)
+-- {
+--   return (int64_t_fun)();
+-- }
+-- uint8_t hs_bindgen_1b2e687eaa715924 (void)
+-- {
+--   return (uint8_t_fun)();
+-- }
+-- uint16_t hs_bindgen_6da73658633b176e (void)
+-- {
+--   return (uint16_t_fun)();
+-- }
+-- uint32_t hs_bindgen_c6cd0ee414c746de (void)
+-- {
+--   return (uint32_t_fun)();
+-- }
+-- uint64_t hs_bindgen_cbb9017c67ce7652 (void)
+-- {
+--   return (uint64_t_fun)();
+-- }
+-- intmax_t hs_bindgen_844bf55e16de43a0 (void)
+-- {
+--   return (intmax_t_fun)();
+-- }
+-- uintmax_t hs_bindgen_56900c9a548480d5 (void)
+-- {
+--   return (uintmax_t_fun)();
+-- }
+-- intptr_t hs_bindgen_d656827fe2704de3 (void)
+-- {
+--   return (intptr_t_fun)();
+-- }
+-- uintptr_t hs_bindgen_401c738c79c5e4ef (void)
+-- {
+--   return (uintptr_t_fun)();
+-- }
+-- fenv_t *hs_bindgen_eb417aeaae001cd4 (void)
+-- {
+--   return (fenv_t_fun)();
+-- }
+-- fexcept_t *hs_bindgen_42f9ee7a2fa5ed3b (void)
+-- {
+--   return (fexcept_t_fun)();
+-- }
+-- size_t hs_bindgen_66f735fc270b795a (void)
+-- {
+--   return (size_t_fun)();
+-- }
+-- ptrdiff_t hs_bindgen_2f5574764965bb49 (void)
+-- {
+--   return (ptrdiff_t_fun)();
+-- }
+-- wchar_t hs_bindgen_57ff329a6c1ab247 (void)
+-- {
+--   return (wchar_t_fun)();
+-- }
+-- wint_t hs_bindgen_fef1399636729a64 (void)
+-- {
+--   return (wint_t_fun)();
+-- }
+-- mbstate_t *hs_bindgen_ec1c0b9428114ec6 (void)
+-- {
+--   return (mbstate_t_fun)();
+-- }
+-- wctrans_t hs_bindgen_2d9b204c006f0667 (void)
+-- {
+--   return (wctrans_t_fun)();
+-- }
+-- wctype_t hs_bindgen_977cddf620e22ba0 (void)
+-- {
+--   return (wctype_t_fun)();
+-- }
+-- char16_t hs_bindgen_4780a15ae4e392fd (void)
+-- {
+--   return (char16_t_fun)();
+-- }
+-- char32_t hs_bindgen_d258f4d9903b4e39 (void)
+-- {
+--   return (char32_t_fun)();
+-- }
+-- time_t hs_bindgen_82c178bd7c4d08b0 (void)
+-- {
+--   return (time_t_fun)();
+-- }
+-- clock_t hs_bindgen_b472ecf9ffec8045 (void)
+-- {
+--   return (clock_t_fun)();
+-- }
+-- FILE *hs_bindgen_0caa7d72a7701f1f (void)
+-- {
+--   return (FILE_fun)();
+-- }
+-- fpos_t *hs_bindgen_47b37de28902f506 (void)
+-- {
+--   return (fpos_t_fun)();
+-- }
+-- sig_atomic_t hs_bindgen_222eab426c700a03 (void)
+-- {
+--   return (sig_atomic_t_fun)();
+-- }
+-- _Bool hs_bindgen_6b68851ce9c1f36f (void)
+-- {
+--   return (bool_fun)();
+-- }
+-- int8_t hs_bindgen_a408da1bfa030a51 (void)
+-- {
+--   return (int8_t_fun)();
+-- }
+-- int16_t hs_bindgen_6785058f9844b9b5 (void)
+-- {
+--   return (int16_t_fun)();
+-- }
+-- int32_t hs_bindgen_191a7b2b445fb350 (void)
+-- {
+--   return (int32_t_fun)();
+-- }
+-- int64_t hs_bindgen_0a523ac71d31b35c (void)
+-- {
+--   return (int64_t_fun)();
+-- }
+-- uint8_t hs_bindgen_f4245406bfdade75 (void)
+-- {
+--   return (uint8_t_fun)();
+-- }
+-- uint16_t hs_bindgen_f7a0d726d7268b30 (void)
+-- {
+--   return (uint16_t_fun)();
+-- }
+-- uint32_t hs_bindgen_432f65d5f6e3c062 (void)
+-- {
+--   return (uint32_t_fun)();
+-- }
+-- uint64_t hs_bindgen_af91a28f07360676 (void)
+-- {
+--   return (uint64_t_fun)();
+-- }
+-- intmax_t hs_bindgen_34ebd7f9b1c9877f (void)
+-- {
+--   return (intmax_t_fun)();
+-- }
+-- uintmax_t hs_bindgen_f147b22f36663ba2 (void)
+-- {
+--   return (uintmax_t_fun)();
+-- }
+-- intptr_t hs_bindgen_42bfd915930be089 (void)
+-- {
+--   return (intptr_t_fun)();
+-- }
+-- uintptr_t hs_bindgen_3d4e032e4f99ccdf (void)
+-- {
+--   return (uintptr_t_fun)();
+-- }
+-- fenv_t *hs_bindgen_d12ec6bea98f91aa (void)
+-- {
+--   return (fenv_t_fun)();
+-- }
+-- fexcept_t *hs_bindgen_bfb6abdc4397c064 (void)
+-- {
+--   return (fexcept_t_fun)();
+-- }
+-- size_t hs_bindgen_3030e3c8a5de2e7e (void)
+-- {
+--   return (size_t_fun)();
+-- }
+-- ptrdiff_t hs_bindgen_7033a7ddfdfe770f (void)
+-- {
+--   return (ptrdiff_t_fun)();
+-- }
+-- wchar_t hs_bindgen_ebae7f4d5db1ecd0 (void)
+-- {
+--   return (wchar_t_fun)();
+-- }
+-- wint_t hs_bindgen_623e42289a1c3dc3 (void)
+-- {
+--   return (wint_t_fun)();
+-- }
+-- mbstate_t *hs_bindgen_bc84314eca8f2a7c (void)
+-- {
+--   return (mbstate_t_fun)();
+-- }
+-- wctrans_t hs_bindgen_5524c9adc3841732 (void)
+-- {
+--   return (wctrans_t_fun)();
+-- }
+-- wctype_t hs_bindgen_72885cbcc8213893 (void)
+-- {
+--   return (wctype_t_fun)();
+-- }
+-- char16_t hs_bindgen_4284e8eb72d43965 (void)
+-- {
+--   return (char16_t_fun)();
+-- }
+-- char32_t hs_bindgen_74e1167907c5de0e (void)
+-- {
+--   return (char32_t_fun)();
+-- }
+-- time_t hs_bindgen_a0c949d46b12627a (void)
+-- {
+--   return (time_t_fun)();
+-- }
+-- clock_t hs_bindgen_ac7afd479db138db (void)
+-- {
+--   return (clock_t_fun)();
+-- }
+-- FILE *hs_bindgen_51b6e01d56713f95 (void)
+-- {
+--   return (FILE_fun)();
+-- }
+-- fpos_t *hs_bindgen_e9ed5e9a298e9a7e (void)
+-- {
+--   return (fpos_t_fun)();
+-- }
+-- sig_atomic_t hs_bindgen_1aecb4fb9faabcf5 (void)
+-- {
+--   return (sig_atomic_t_fun)();
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_bool_fun */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_4d50a5da1d788aef (void)) (void)
+-- {
+--   return &bool_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_int8_t_fun */
+-- __attribute__ ((const))
+-- int8_t (*hs_bindgen_afc12424e14cd900 (void)) (void)
+-- {
+--   return &int8_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_int16_t_fun */
+-- __attribute__ ((const))
+-- int16_t (*hs_bindgen_bb1fdb972582362b (void)) (void)
+-- {
+--   return &int16_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_int32_t_fun */
+-- __attribute__ ((const))
+-- int32_t (*hs_bindgen_3ddcee1ca6e45ed1 (void)) (void)
+-- {
+--   return &int32_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_int64_t_fun */
+-- __attribute__ ((const))
+-- int64_t (*hs_bindgen_87f02bc29c3faac0 (void)) (void)
+-- {
+--   return &int64_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_uint8_t_fun */
+-- __attribute__ ((const))
+-- uint8_t (*hs_bindgen_e41f6841cb24d084 (void)) (void)
+-- {
+--   return &uint8_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_uint16_t_fun */
+-- __attribute__ ((const))
+-- uint16_t (*hs_bindgen_a99c4081312f9a64 (void)) (void)
+-- {
+--   return &uint16_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_uint32_t_fun */
+-- __attribute__ ((const))
+-- uint32_t (*hs_bindgen_d7c52be7143a7a68 (void)) (void)
+-- {
+--   return &uint32_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_uint64_t_fun */
+-- __attribute__ ((const))
+-- uint64_t (*hs_bindgen_ce7fc806ab2fc8e0 (void)) (void)
+-- {
+--   return &uint64_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_intmax_t_fun */
+-- __attribute__ ((const))
+-- intmax_t (*hs_bindgen_5b1986d8b6b49f7e (void)) (void)
+-- {
+--   return &intmax_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_uintmax_t_fun */
+-- __attribute__ ((const))
+-- uintmax_t (*hs_bindgen_022ea568c1d290f4 (void)) (void)
+-- {
+--   return &uintmax_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_intptr_t_fun */
+-- __attribute__ ((const))
+-- intptr_t (*hs_bindgen_35eda59e93c8db9a (void)) (void)
+-- {
+--   return &intptr_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_uintptr_t_fun */
+-- __attribute__ ((const))
+-- uintptr_t (*hs_bindgen_a45e879780c141ec (void)) (void)
+-- {
+--   return &uintptr_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_fenv_t_fun */
+-- __attribute__ ((const))
+-- fenv_t *(*hs_bindgen_266815b1305c1241 (void)) (void)
+-- {
+--   return &fenv_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_fexcept_t_fun */
+-- __attribute__ ((const))
+-- fexcept_t *(*hs_bindgen_d0eee798617140b8 (void)) (void)
+-- {
+--   return &fexcept_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_size_t_fun */
+-- __attribute__ ((const))
+-- size_t (*hs_bindgen_0120eaefb471d45e (void)) (void)
+-- {
+--   return &size_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_ptrdiff_t_fun */
+-- __attribute__ ((const))
+-- ptrdiff_t (*hs_bindgen_aa0444e3b2fda3de (void)) (void)
+-- {
+--   return &ptrdiff_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_wchar_t_fun */
+-- __attribute__ ((const))
+-- wchar_t (*hs_bindgen_c3e6697f6a14bc13 (void)) (void)
+-- {
+--   return &wchar_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_wint_t_fun */
+-- __attribute__ ((const))
+-- wint_t (*hs_bindgen_f3077dc66d53977f (void)) (void)
+-- {
+--   return &wint_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_mbstate_t_fun */
+-- __attribute__ ((const))
+-- mbstate_t *(*hs_bindgen_b863e606ff088408 (void)) (void)
+-- {
+--   return &mbstate_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_wctrans_t_fun */
+-- __attribute__ ((const))
+-- wctrans_t (*hs_bindgen_a9599637dbc12608 (void)) (void)
+-- {
+--   return &wctrans_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_wctype_t_fun */
+-- __attribute__ ((const))
+-- wctype_t (*hs_bindgen_207a54450593099a (void)) (void)
+-- {
+--   return &wctype_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_char16_t_fun */
+-- __attribute__ ((const))
+-- char16_t (*hs_bindgen_28a6e39f56489ba2 (void)) (void)
+-- {
+--   return &char16_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_char32_t_fun */
+-- __attribute__ ((const))
+-- char32_t (*hs_bindgen_f918c5a2d6c16885 (void)) (void)
+-- {
+--   return &char32_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_time_t_fun */
+-- __attribute__ ((const))
+-- time_t (*hs_bindgen_f29cfe7708be784f (void)) (void)
+-- {
+--   return &time_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_clock_t_fun */
+-- __attribute__ ((const))
+-- clock_t (*hs_bindgen_509d092c2afe1ddc (void)) (void)
+-- {
+--   return &clock_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_FILE_fun */
+-- __attribute__ ((const))
+-- FILE *(*hs_bindgen_8f5880570a38b5dd (void)) (void)
+-- {
+--   return &FILE_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_fpos_t_fun */
+-- __attribute__ ((const))
+-- fpos_t *(*hs_bindgen_8b563cc85422e790 (void)) (void)
+-- {
+--   return &fpos_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_sig_atomic_t_fun */
+-- __attribute__ ((const))
+-- sig_atomic_t (*hs_bindgen_9fcd36cfaa3ea373 (void)) (void)
+-- {
+--   return &sig_atomic_t_fun;
+-- }
+-- /* test_bindingspecsstdlibreturn_va_Example_get_jmp_buf_val */
+-- __attribute__ ((const))
+-- jmp_buf *hs_bindgen_68c2b692efbc4734 (void)
+-- {
+--   return &jmp_buf_val;
+-- }
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_bool_fun@
+foreign import ccall safe "hs_bindgen_4cd199ba56c14547" hs_bindgen_4cd199ba56c14547_base ::
+    IO CBool
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_bool_fun@
+hs_bindgen_4cd199ba56c14547 :: IO CBool
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_bool_fun@
+hs_bindgen_4cd199ba56c14547 = fmap fromFFIType hs_bindgen_4cd199ba56c14547_base
+{-| __C declaration:__ @bool_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 20:6@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+bool_fun_safe :: IO CBool
+{-| __C declaration:__ @bool_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 20:6@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+bool_fun_safe = hs_bindgen_4cd199ba56c14547
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int8_t_fun@
+foreign import ccall safe "hs_bindgen_73c8e1f452482878" hs_bindgen_73c8e1f452482878_base ::
+    IO HsBindgen.Runtime.LibC.Int8
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int8_t_fun@
+hs_bindgen_73c8e1f452482878 :: IO HsBindgen.Runtime.LibC.Int8
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int8_t_fun@
+hs_bindgen_73c8e1f452482878 = fmap fromFFIType hs_bindgen_73c8e1f452482878_base
+{-| __C declaration:__ @int8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 23:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int8_t_fun_safe :: IO HsBindgen.Runtime.LibC.Int8
+{-| __C declaration:__ @int8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 23:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int8_t_fun_safe = hs_bindgen_73c8e1f452482878
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int16_t_fun@
+foreign import ccall safe "hs_bindgen_da3259b2446eb9bf" hs_bindgen_da3259b2446eb9bf_base ::
+    IO HsBindgen.Runtime.LibC.Int16
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int16_t_fun@
+hs_bindgen_da3259b2446eb9bf :: IO HsBindgen.Runtime.LibC.Int16
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int16_t_fun@
+hs_bindgen_da3259b2446eb9bf = fmap fromFFIType hs_bindgen_da3259b2446eb9bf_base
+{-| __C declaration:__ @int16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 24:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int16_t_fun_safe :: IO HsBindgen.Runtime.LibC.Int16
+{-| __C declaration:__ @int16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 24:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int16_t_fun_safe = hs_bindgen_da3259b2446eb9bf
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int32_t_fun@
+foreign import ccall safe "hs_bindgen_7dd577f0c34f0ff7" hs_bindgen_7dd577f0c34f0ff7_base ::
+    IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int32_t_fun@
+hs_bindgen_7dd577f0c34f0ff7 :: IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int32_t_fun@
+hs_bindgen_7dd577f0c34f0ff7 = fmap fromFFIType hs_bindgen_7dd577f0c34f0ff7_base
+{-| __C declaration:__ @int32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 25:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int32_t_fun_safe :: IO HsBindgen.Runtime.LibC.Int32
+{-| __C declaration:__ @int32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 25:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int32_t_fun_safe = hs_bindgen_7dd577f0c34f0ff7
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int64_t_fun@
+foreign import ccall safe "hs_bindgen_7a2709fa911a350e" hs_bindgen_7a2709fa911a350e_base ::
+    IO HsBindgen.Runtime.LibC.Int64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int64_t_fun@
+hs_bindgen_7a2709fa911a350e :: IO HsBindgen.Runtime.LibC.Int64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_int64_t_fun@
+hs_bindgen_7a2709fa911a350e = fmap fromFFIType hs_bindgen_7a2709fa911a350e_base
+{-| __C declaration:__ @int64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 26:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int64_t_fun_safe :: IO HsBindgen.Runtime.LibC.Int64
+{-| __C declaration:__ @int64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 26:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int64_t_fun_safe = hs_bindgen_7a2709fa911a350e
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint8_t_fun@
+foreign import ccall safe "hs_bindgen_1b2e687eaa715924" hs_bindgen_1b2e687eaa715924_base ::
+    IO HsBindgen.Runtime.LibC.Word8
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint8_t_fun@
+hs_bindgen_1b2e687eaa715924 :: IO HsBindgen.Runtime.LibC.Word8
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint8_t_fun@
+hs_bindgen_1b2e687eaa715924 = fmap fromFFIType hs_bindgen_1b2e687eaa715924_base
+{-| __C declaration:__ @uint8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 27:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint8_t_fun_safe :: IO HsBindgen.Runtime.LibC.Word8
+{-| __C declaration:__ @uint8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 27:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint8_t_fun_safe = hs_bindgen_1b2e687eaa715924
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint16_t_fun@
+foreign import ccall safe "hs_bindgen_6da73658633b176e" hs_bindgen_6da73658633b176e_base ::
+    IO HsBindgen.Runtime.LibC.Word16
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint16_t_fun@
+hs_bindgen_6da73658633b176e :: IO HsBindgen.Runtime.LibC.Word16
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint16_t_fun@
+hs_bindgen_6da73658633b176e = fmap fromFFIType hs_bindgen_6da73658633b176e_base
+{-| __C declaration:__ @uint16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 28:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint16_t_fun_safe :: IO HsBindgen.Runtime.LibC.Word16
+{-| __C declaration:__ @uint16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 28:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint16_t_fun_safe = hs_bindgen_6da73658633b176e
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint32_t_fun@
+foreign import ccall safe "hs_bindgen_c6cd0ee414c746de" hs_bindgen_c6cd0ee414c746de_base ::
+    IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint32_t_fun@
+hs_bindgen_c6cd0ee414c746de :: IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint32_t_fun@
+hs_bindgen_c6cd0ee414c746de = fmap fromFFIType hs_bindgen_c6cd0ee414c746de_base
+{-| __C declaration:__ @uint32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 29:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint32_t_fun_safe :: IO HsBindgen.Runtime.LibC.Word32
+{-| __C declaration:__ @uint32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 29:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint32_t_fun_safe = hs_bindgen_c6cd0ee414c746de
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint64_t_fun@
+foreign import ccall safe "hs_bindgen_cbb9017c67ce7652" hs_bindgen_cbb9017c67ce7652_base ::
+    IO HsBindgen.Runtime.LibC.Word64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint64_t_fun@
+hs_bindgen_cbb9017c67ce7652 :: IO HsBindgen.Runtime.LibC.Word64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uint64_t_fun@
+hs_bindgen_cbb9017c67ce7652 = fmap fromFFIType hs_bindgen_cbb9017c67ce7652_base
+{-| __C declaration:__ @uint64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 30:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint64_t_fun_safe :: IO HsBindgen.Runtime.LibC.Word64
+{-| __C declaration:__ @uint64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 30:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint64_t_fun_safe = hs_bindgen_cbb9017c67ce7652
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intmax_t_fun@
+foreign import ccall safe "hs_bindgen_844bf55e16de43a0" hs_bindgen_844bf55e16de43a0_base ::
+    IO HsBindgen.Runtime.LibC.CIntMax
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intmax_t_fun@
+hs_bindgen_844bf55e16de43a0 :: IO HsBindgen.Runtime.LibC.CIntMax
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intmax_t_fun@
+hs_bindgen_844bf55e16de43a0 = fmap fromFFIType hs_bindgen_844bf55e16de43a0_base
+{-| __C declaration:__ @intmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 31:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intmax_t_fun_safe :: IO HsBindgen.Runtime.LibC.CIntMax
+{-| __C declaration:__ @intmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 31:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intmax_t_fun_safe = hs_bindgen_844bf55e16de43a0
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintmax_t_fun@
+foreign import ccall safe "hs_bindgen_56900c9a548480d5" hs_bindgen_56900c9a548480d5_base ::
+    IO HsBindgen.Runtime.LibC.CUIntMax
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintmax_t_fun@
+hs_bindgen_56900c9a548480d5 :: IO HsBindgen.Runtime.LibC.CUIntMax
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintmax_t_fun@
+hs_bindgen_56900c9a548480d5 = fmap fromFFIType hs_bindgen_56900c9a548480d5_base
+{-| __C declaration:__ @uintmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 32:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintmax_t_fun_safe :: IO HsBindgen.Runtime.LibC.CUIntMax
+{-| __C declaration:__ @uintmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 32:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintmax_t_fun_safe = hs_bindgen_56900c9a548480d5
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intptr_t_fun@
+foreign import ccall safe "hs_bindgen_d656827fe2704de3" hs_bindgen_d656827fe2704de3_base ::
+    IO HsBindgen.Runtime.LibC.CIntPtr
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intptr_t_fun@
+hs_bindgen_d656827fe2704de3 :: IO HsBindgen.Runtime.LibC.CIntPtr
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_intptr_t_fun@
+hs_bindgen_d656827fe2704de3 = fmap fromFFIType hs_bindgen_d656827fe2704de3_base
+{-| __C declaration:__ @intptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 33:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intptr_t_fun_safe :: IO HsBindgen.Runtime.LibC.CIntPtr
+{-| __C declaration:__ @intptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 33:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intptr_t_fun_safe = hs_bindgen_d656827fe2704de3
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintptr_t_fun@
+foreign import ccall safe "hs_bindgen_401c738c79c5e4ef" hs_bindgen_401c738c79c5e4ef_base ::
+    IO HsBindgen.Runtime.LibC.CUIntPtr
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintptr_t_fun@
+hs_bindgen_401c738c79c5e4ef :: IO HsBindgen.Runtime.LibC.CUIntPtr
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_uintptr_t_fun@
+hs_bindgen_401c738c79c5e4ef = fmap fromFFIType hs_bindgen_401c738c79c5e4ef_base
+{-| __C declaration:__ @uintptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 34:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintptr_t_fun_safe :: IO HsBindgen.Runtime.LibC.CUIntPtr
+{-| __C declaration:__ @uintptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 34:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintptr_t_fun_safe = hs_bindgen_401c738c79c5e4ef
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fenv_t_fun@
+foreign import ccall safe "hs_bindgen_eb417aeaae001cd4" hs_bindgen_eb417aeaae001cd4_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fenv_t_fun@
+hs_bindgen_eb417aeaae001cd4 :: IO (Ptr HsBindgen.Runtime.LibC.CFenvT)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fenv_t_fun@
+hs_bindgen_eb417aeaae001cd4 = fmap fromFFIType hs_bindgen_eb417aeaae001cd4_base
+{-| __C declaration:__ @fenv_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 37:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fenv_t_fun_safe :: IO (Ptr HsBindgen.Runtime.LibC.CFenvT)
+{-| __C declaration:__ @fenv_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 37:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fenv_t_fun_safe = hs_bindgen_eb417aeaae001cd4
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fexcept_t_fun@
+foreign import ccall safe "hs_bindgen_42f9ee7a2fa5ed3b" hs_bindgen_42f9ee7a2fa5ed3b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fexcept_t_fun@
+hs_bindgen_42f9ee7a2fa5ed3b :: IO (Ptr HsBindgen.Runtime.LibC.CFexceptT)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fexcept_t_fun@
+hs_bindgen_42f9ee7a2fa5ed3b = fmap fromFFIType hs_bindgen_42f9ee7a2fa5ed3b_base
+{-| __C declaration:__ @fexcept_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 38:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fexcept_t_fun_safe :: IO (Ptr HsBindgen.Runtime.LibC.CFexceptT)
+{-| __C declaration:__ @fexcept_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 38:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fexcept_t_fun_safe = hs_bindgen_42f9ee7a2fa5ed3b
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_size_t_fun@
+foreign import ccall safe "hs_bindgen_66f735fc270b795a" hs_bindgen_66f735fc270b795a_base ::
+    IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_size_t_fun@
+hs_bindgen_66f735fc270b795a :: IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_size_t_fun@
+hs_bindgen_66f735fc270b795a = fmap fromFFIType hs_bindgen_66f735fc270b795a_base
+{-| __C declaration:__ @size_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 41:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+size_t_fun_safe :: IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @size_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 41:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+size_t_fun_safe = hs_bindgen_66f735fc270b795a
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_ptrdiff_t_fun@
+foreign import ccall safe "hs_bindgen_2f5574764965bb49" hs_bindgen_2f5574764965bb49_base ::
+    IO HsBindgen.Runtime.LibC.CPtrdiff
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_ptrdiff_t_fun@
+hs_bindgen_2f5574764965bb49 :: IO HsBindgen.Runtime.LibC.CPtrdiff
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_ptrdiff_t_fun@
+hs_bindgen_2f5574764965bb49 = fmap fromFFIType hs_bindgen_2f5574764965bb49_base
+{-| __C declaration:__ @ptrdiff_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 42:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+ptrdiff_t_fun_safe :: IO HsBindgen.Runtime.LibC.CPtrdiff
+{-| __C declaration:__ @ptrdiff_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 42:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+ptrdiff_t_fun_safe = hs_bindgen_2f5574764965bb49
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wchar_t_fun@
+foreign import ccall safe "hs_bindgen_57ff329a6c1ab247" hs_bindgen_57ff329a6c1ab247_base ::
+    IO HsBindgen.Runtime.LibC.CWchar
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wchar_t_fun@
+hs_bindgen_57ff329a6c1ab247 :: IO HsBindgen.Runtime.LibC.CWchar
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wchar_t_fun@
+hs_bindgen_57ff329a6c1ab247 = fmap fromFFIType hs_bindgen_57ff329a6c1ab247_base
+{-| __C declaration:__ @wchar_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 49:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wchar_t_fun_safe :: IO HsBindgen.Runtime.LibC.CWchar
+{-| __C declaration:__ @wchar_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 49:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wchar_t_fun_safe = hs_bindgen_57ff329a6c1ab247
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wint_t_fun@
+foreign import ccall safe "hs_bindgen_fef1399636729a64" hs_bindgen_fef1399636729a64_base ::
+    IO HsBindgen.Runtime.LibC.CWintT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wint_t_fun@
+hs_bindgen_fef1399636729a64 :: IO HsBindgen.Runtime.LibC.CWintT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wint_t_fun@
+hs_bindgen_fef1399636729a64 = fmap fromFFIType hs_bindgen_fef1399636729a64_base
+{-| __C declaration:__ @wint_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 50:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wint_t_fun_safe :: IO HsBindgen.Runtime.LibC.CWintT
+{-| __C declaration:__ @wint_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 50:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wint_t_fun_safe = hs_bindgen_fef1399636729a64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_mbstate_t_fun@
+foreign import ccall safe "hs_bindgen_ec1c0b9428114ec6" hs_bindgen_ec1c0b9428114ec6_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_mbstate_t_fun@
+hs_bindgen_ec1c0b9428114ec6 :: IO (Ptr HsBindgen.Runtime.LibC.CMbstateT)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_mbstate_t_fun@
+hs_bindgen_ec1c0b9428114ec6 = fmap fromFFIType hs_bindgen_ec1c0b9428114ec6_base
+{-| __C declaration:__ @mbstate_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 51:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+mbstate_t_fun_safe :: IO (Ptr HsBindgen.Runtime.LibC.CMbstateT)
+{-| __C declaration:__ @mbstate_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 51:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+mbstate_t_fun_safe = hs_bindgen_ec1c0b9428114ec6
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctrans_t_fun@
+foreign import ccall safe "hs_bindgen_2d9b204c006f0667" hs_bindgen_2d9b204c006f0667_base ::
+    IO HsBindgen.Runtime.LibC.CWctransT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctrans_t_fun@
+hs_bindgen_2d9b204c006f0667 :: IO HsBindgen.Runtime.LibC.CWctransT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctrans_t_fun@
+hs_bindgen_2d9b204c006f0667 = fmap fromFFIType hs_bindgen_2d9b204c006f0667_base
+{-| __C declaration:__ @wctrans_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 52:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctrans_t_fun_safe :: IO HsBindgen.Runtime.LibC.CWctransT
+{-| __C declaration:__ @wctrans_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 52:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctrans_t_fun_safe = hs_bindgen_2d9b204c006f0667
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctype_t_fun@
+foreign import ccall safe "hs_bindgen_977cddf620e22ba0" hs_bindgen_977cddf620e22ba0_base ::
+    IO HsBindgen.Runtime.LibC.CWctypeT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctype_t_fun@
+hs_bindgen_977cddf620e22ba0 :: IO HsBindgen.Runtime.LibC.CWctypeT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_wctype_t_fun@
+hs_bindgen_977cddf620e22ba0 = fmap fromFFIType hs_bindgen_977cddf620e22ba0_base
+{-| __C declaration:__ @wctype_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 53:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctype_t_fun_safe :: IO HsBindgen.Runtime.LibC.CWctypeT
+{-| __C declaration:__ @wctype_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 53:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctype_t_fun_safe = hs_bindgen_977cddf620e22ba0
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char16_t_fun@
+foreign import ccall safe "hs_bindgen_4780a15ae4e392fd" hs_bindgen_4780a15ae4e392fd_base ::
+    IO HsBindgen.Runtime.LibC.CChar16T
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char16_t_fun@
+hs_bindgen_4780a15ae4e392fd :: IO HsBindgen.Runtime.LibC.CChar16T
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char16_t_fun@
+hs_bindgen_4780a15ae4e392fd = fmap fromFFIType hs_bindgen_4780a15ae4e392fd_base
+{-| __C declaration:__ @char16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 54:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char16_t_fun_safe :: IO HsBindgen.Runtime.LibC.CChar16T
+{-| __C declaration:__ @char16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 54:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char16_t_fun_safe = hs_bindgen_4780a15ae4e392fd
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char32_t_fun@
+foreign import ccall safe "hs_bindgen_d258f4d9903b4e39" hs_bindgen_d258f4d9903b4e39_base ::
+    IO HsBindgen.Runtime.LibC.CChar32T
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char32_t_fun@
+hs_bindgen_d258f4d9903b4e39 :: IO HsBindgen.Runtime.LibC.CChar32T
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_char32_t_fun@
+hs_bindgen_d258f4d9903b4e39 = fmap fromFFIType hs_bindgen_d258f4d9903b4e39_base
+{-| __C declaration:__ @char32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 55:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char32_t_fun_safe :: IO HsBindgen.Runtime.LibC.CChar32T
+{-| __C declaration:__ @char32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 55:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char32_t_fun_safe = hs_bindgen_d258f4d9903b4e39
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_time_t_fun@
+foreign import ccall safe "hs_bindgen_82c178bd7c4d08b0" hs_bindgen_82c178bd7c4d08b0_base ::
+    IO HsBindgen.Runtime.LibC.CTime
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_time_t_fun@
+hs_bindgen_82c178bd7c4d08b0 :: IO HsBindgen.Runtime.LibC.CTime
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_time_t_fun@
+hs_bindgen_82c178bd7c4d08b0 = fmap fromFFIType hs_bindgen_82c178bd7c4d08b0_base
+{-| __C declaration:__ @time_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 58:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+time_t_fun_safe :: IO HsBindgen.Runtime.LibC.CTime
+{-| __C declaration:__ @time_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 58:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+time_t_fun_safe = hs_bindgen_82c178bd7c4d08b0
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_clock_t_fun@
+foreign import ccall safe "hs_bindgen_b472ecf9ffec8045" hs_bindgen_b472ecf9ffec8045_base ::
+    IO HsBindgen.Runtime.LibC.CClock
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_clock_t_fun@
+hs_bindgen_b472ecf9ffec8045 :: IO HsBindgen.Runtime.LibC.CClock
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_clock_t_fun@
+hs_bindgen_b472ecf9ffec8045 = fmap fromFFIType hs_bindgen_b472ecf9ffec8045_base
+{-| __C declaration:__ @clock_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 59:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+clock_t_fun_safe :: IO HsBindgen.Runtime.LibC.CClock
+{-| __C declaration:__ @clock_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 59:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+clock_t_fun_safe = hs_bindgen_b472ecf9ffec8045
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_FILE_fun@
+foreign import ccall safe "hs_bindgen_0caa7d72a7701f1f" hs_bindgen_0caa7d72a7701f1f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_FILE_fun@
+hs_bindgen_0caa7d72a7701f1f :: IO (Ptr HsBindgen.Runtime.LibC.CFile)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_FILE_fun@
+hs_bindgen_0caa7d72a7701f1f = fmap fromFFIType hs_bindgen_0caa7d72a7701f1f_base
+{-| __C declaration:__ @FILE_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 64:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fILE_fun_safe :: IO (Ptr HsBindgen.Runtime.LibC.CFile)
+{-| __C declaration:__ @FILE_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 64:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fILE_fun_safe = hs_bindgen_0caa7d72a7701f1f
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fpos_t_fun@
+foreign import ccall safe "hs_bindgen_47b37de28902f506" hs_bindgen_47b37de28902f506_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fpos_t_fun@
+hs_bindgen_47b37de28902f506 :: IO (Ptr HsBindgen.Runtime.LibC.CFpos)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_fpos_t_fun@
+hs_bindgen_47b37de28902f506 = fmap fromFFIType hs_bindgen_47b37de28902f506_base
+{-| __C declaration:__ @fpos_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 65:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fpos_t_fun_safe :: IO (Ptr HsBindgen.Runtime.LibC.CFpos)
+{-| __C declaration:__ @fpos_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 65:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fpos_t_fun_safe = hs_bindgen_47b37de28902f506
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_sig_atomic_t_fun@
+foreign import ccall safe "hs_bindgen_222eab426c700a03" hs_bindgen_222eab426c700a03_base ::
+    IO HsBindgen.Runtime.LibC.CSigAtomic
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_sig_atomic_t_fun@
+hs_bindgen_222eab426c700a03 :: IO HsBindgen.Runtime.LibC.CSigAtomic
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Safe_sig_atomic_t_fun@
+hs_bindgen_222eab426c700a03 = fmap fromFFIType hs_bindgen_222eab426c700a03_base
+{-| __C declaration:__ @sig_atomic_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 68:14@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+sig_atomic_t_fun_safe :: IO HsBindgen.Runtime.LibC.CSigAtomic
+{-| __C declaration:__ @sig_atomic_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 68:14@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+sig_atomic_t_fun_safe = hs_bindgen_222eab426c700a03
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_bool_fun@
+foreign import ccall unsafe "hs_bindgen_6b68851ce9c1f36f" hs_bindgen_6b68851ce9c1f36f_base ::
+    IO CBool
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_bool_fun@
+hs_bindgen_6b68851ce9c1f36f :: IO CBool
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_bool_fun@
+hs_bindgen_6b68851ce9c1f36f = fmap fromFFIType hs_bindgen_6b68851ce9c1f36f_base
+{-| __C declaration:__ @bool_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 20:6@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+bool_fun_unsafe :: IO CBool
+{-| __C declaration:__ @bool_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 20:6@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+bool_fun_unsafe = hs_bindgen_6b68851ce9c1f36f
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int8_t_fun@
+foreign import ccall unsafe "hs_bindgen_a408da1bfa030a51" hs_bindgen_a408da1bfa030a51_base ::
+    IO HsBindgen.Runtime.LibC.Int8
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int8_t_fun@
+hs_bindgen_a408da1bfa030a51 :: IO HsBindgen.Runtime.LibC.Int8
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int8_t_fun@
+hs_bindgen_a408da1bfa030a51 = fmap fromFFIType hs_bindgen_a408da1bfa030a51_base
+{-| __C declaration:__ @int8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 23:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int8_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.Int8
+{-| __C declaration:__ @int8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 23:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int8_t_fun_unsafe = hs_bindgen_a408da1bfa030a51
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int16_t_fun@
+foreign import ccall unsafe "hs_bindgen_6785058f9844b9b5" hs_bindgen_6785058f9844b9b5_base ::
+    IO HsBindgen.Runtime.LibC.Int16
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int16_t_fun@
+hs_bindgen_6785058f9844b9b5 :: IO HsBindgen.Runtime.LibC.Int16
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int16_t_fun@
+hs_bindgen_6785058f9844b9b5 = fmap fromFFIType hs_bindgen_6785058f9844b9b5_base
+{-| __C declaration:__ @int16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 24:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int16_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.Int16
+{-| __C declaration:__ @int16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 24:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int16_t_fun_unsafe = hs_bindgen_6785058f9844b9b5
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int32_t_fun@
+foreign import ccall unsafe "hs_bindgen_191a7b2b445fb350" hs_bindgen_191a7b2b445fb350_base ::
+    IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int32_t_fun@
+hs_bindgen_191a7b2b445fb350 :: IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int32_t_fun@
+hs_bindgen_191a7b2b445fb350 = fmap fromFFIType hs_bindgen_191a7b2b445fb350_base
+{-| __C declaration:__ @int32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 25:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int32_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.Int32
+{-| __C declaration:__ @int32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 25:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int32_t_fun_unsafe = hs_bindgen_191a7b2b445fb350
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int64_t_fun@
+foreign import ccall unsafe "hs_bindgen_0a523ac71d31b35c" hs_bindgen_0a523ac71d31b35c_base ::
+    IO HsBindgen.Runtime.LibC.Int64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int64_t_fun@
+hs_bindgen_0a523ac71d31b35c :: IO HsBindgen.Runtime.LibC.Int64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_int64_t_fun@
+hs_bindgen_0a523ac71d31b35c = fmap fromFFIType hs_bindgen_0a523ac71d31b35c_base
+{-| __C declaration:__ @int64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 26:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int64_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.Int64
+{-| __C declaration:__ @int64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 26:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int64_t_fun_unsafe = hs_bindgen_0a523ac71d31b35c
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint8_t_fun@
+foreign import ccall unsafe "hs_bindgen_f4245406bfdade75" hs_bindgen_f4245406bfdade75_base ::
+    IO HsBindgen.Runtime.LibC.Word8
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint8_t_fun@
+hs_bindgen_f4245406bfdade75 :: IO HsBindgen.Runtime.LibC.Word8
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint8_t_fun@
+hs_bindgen_f4245406bfdade75 = fmap fromFFIType hs_bindgen_f4245406bfdade75_base
+{-| __C declaration:__ @uint8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 27:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint8_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.Word8
+{-| __C declaration:__ @uint8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 27:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint8_t_fun_unsafe = hs_bindgen_f4245406bfdade75
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint16_t_fun@
+foreign import ccall unsafe "hs_bindgen_f7a0d726d7268b30" hs_bindgen_f7a0d726d7268b30_base ::
+    IO HsBindgen.Runtime.LibC.Word16
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint16_t_fun@
+hs_bindgen_f7a0d726d7268b30 :: IO HsBindgen.Runtime.LibC.Word16
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint16_t_fun@
+hs_bindgen_f7a0d726d7268b30 = fmap fromFFIType hs_bindgen_f7a0d726d7268b30_base
+{-| __C declaration:__ @uint16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 28:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint16_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.Word16
+{-| __C declaration:__ @uint16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 28:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint16_t_fun_unsafe = hs_bindgen_f7a0d726d7268b30
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint32_t_fun@
+foreign import ccall unsafe "hs_bindgen_432f65d5f6e3c062" hs_bindgen_432f65d5f6e3c062_base ::
+    IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint32_t_fun@
+hs_bindgen_432f65d5f6e3c062 :: IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint32_t_fun@
+hs_bindgen_432f65d5f6e3c062 = fmap fromFFIType hs_bindgen_432f65d5f6e3c062_base
+{-| __C declaration:__ @uint32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 29:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint32_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.Word32
+{-| __C declaration:__ @uint32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 29:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint32_t_fun_unsafe = hs_bindgen_432f65d5f6e3c062
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint64_t_fun@
+foreign import ccall unsafe "hs_bindgen_af91a28f07360676" hs_bindgen_af91a28f07360676_base ::
+    IO HsBindgen.Runtime.LibC.Word64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint64_t_fun@
+hs_bindgen_af91a28f07360676 :: IO HsBindgen.Runtime.LibC.Word64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uint64_t_fun@
+hs_bindgen_af91a28f07360676 = fmap fromFFIType hs_bindgen_af91a28f07360676_base
+{-| __C declaration:__ @uint64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 30:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint64_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.Word64
+{-| __C declaration:__ @uint64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 30:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint64_t_fun_unsafe = hs_bindgen_af91a28f07360676
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intmax_t_fun@
+foreign import ccall unsafe "hs_bindgen_34ebd7f9b1c9877f" hs_bindgen_34ebd7f9b1c9877f_base ::
+    IO HsBindgen.Runtime.LibC.CIntMax
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intmax_t_fun@
+hs_bindgen_34ebd7f9b1c9877f :: IO HsBindgen.Runtime.LibC.CIntMax
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intmax_t_fun@
+hs_bindgen_34ebd7f9b1c9877f = fmap fromFFIType hs_bindgen_34ebd7f9b1c9877f_base
+{-| __C declaration:__ @intmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 31:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intmax_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CIntMax
+{-| __C declaration:__ @intmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 31:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intmax_t_fun_unsafe = hs_bindgen_34ebd7f9b1c9877f
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintmax_t_fun@
+foreign import ccall unsafe "hs_bindgen_f147b22f36663ba2" hs_bindgen_f147b22f36663ba2_base ::
+    IO HsBindgen.Runtime.LibC.CUIntMax
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintmax_t_fun@
+hs_bindgen_f147b22f36663ba2 :: IO HsBindgen.Runtime.LibC.CUIntMax
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintmax_t_fun@
+hs_bindgen_f147b22f36663ba2 = fmap fromFFIType hs_bindgen_f147b22f36663ba2_base
+{-| __C declaration:__ @uintmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 32:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintmax_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CUIntMax
+{-| __C declaration:__ @uintmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 32:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintmax_t_fun_unsafe = hs_bindgen_f147b22f36663ba2
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intptr_t_fun@
+foreign import ccall unsafe "hs_bindgen_42bfd915930be089" hs_bindgen_42bfd915930be089_base ::
+    IO HsBindgen.Runtime.LibC.CIntPtr
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intptr_t_fun@
+hs_bindgen_42bfd915930be089 :: IO HsBindgen.Runtime.LibC.CIntPtr
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_intptr_t_fun@
+hs_bindgen_42bfd915930be089 = fmap fromFFIType hs_bindgen_42bfd915930be089_base
+{-| __C declaration:__ @intptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 33:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intptr_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CIntPtr
+{-| __C declaration:__ @intptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 33:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intptr_t_fun_unsafe = hs_bindgen_42bfd915930be089
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintptr_t_fun@
+foreign import ccall unsafe "hs_bindgen_3d4e032e4f99ccdf" hs_bindgen_3d4e032e4f99ccdf_base ::
+    IO HsBindgen.Runtime.LibC.CUIntPtr
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintptr_t_fun@
+hs_bindgen_3d4e032e4f99ccdf :: IO HsBindgen.Runtime.LibC.CUIntPtr
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_uintptr_t_fun@
+hs_bindgen_3d4e032e4f99ccdf = fmap fromFFIType hs_bindgen_3d4e032e4f99ccdf_base
+{-| __C declaration:__ @uintptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 34:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintptr_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CUIntPtr
+{-| __C declaration:__ @uintptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 34:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintptr_t_fun_unsafe = hs_bindgen_3d4e032e4f99ccdf
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fenv_t_fun@
+foreign import ccall unsafe "hs_bindgen_d12ec6bea98f91aa" hs_bindgen_d12ec6bea98f91aa_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fenv_t_fun@
+hs_bindgen_d12ec6bea98f91aa :: IO (Ptr HsBindgen.Runtime.LibC.CFenvT)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fenv_t_fun@
+hs_bindgen_d12ec6bea98f91aa = fmap fromFFIType hs_bindgen_d12ec6bea98f91aa_base
+{-| __C declaration:__ @fenv_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 37:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fenv_t_fun_unsafe :: IO (Ptr HsBindgen.Runtime.LibC.CFenvT)
+{-| __C declaration:__ @fenv_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 37:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fenv_t_fun_unsafe = hs_bindgen_d12ec6bea98f91aa
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fexcept_t_fun@
+foreign import ccall unsafe "hs_bindgen_bfb6abdc4397c064" hs_bindgen_bfb6abdc4397c064_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fexcept_t_fun@
+hs_bindgen_bfb6abdc4397c064 :: IO (Ptr HsBindgen.Runtime.LibC.CFexceptT)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fexcept_t_fun@
+hs_bindgen_bfb6abdc4397c064 = fmap fromFFIType hs_bindgen_bfb6abdc4397c064_base
+{-| __C declaration:__ @fexcept_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 38:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fexcept_t_fun_unsafe :: IO (Ptr HsBindgen.Runtime.LibC.CFexceptT)
+{-| __C declaration:__ @fexcept_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 38:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fexcept_t_fun_unsafe = hs_bindgen_bfb6abdc4397c064
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_size_t_fun@
+foreign import ccall unsafe "hs_bindgen_3030e3c8a5de2e7e" hs_bindgen_3030e3c8a5de2e7e_base ::
+    IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_size_t_fun@
+hs_bindgen_3030e3c8a5de2e7e :: IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_size_t_fun@
+hs_bindgen_3030e3c8a5de2e7e = fmap fromFFIType hs_bindgen_3030e3c8a5de2e7e_base
+{-| __C declaration:__ @size_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 41:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+size_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @size_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 41:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+size_t_fun_unsafe = hs_bindgen_3030e3c8a5de2e7e
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_ptrdiff_t_fun@
+foreign import ccall unsafe "hs_bindgen_7033a7ddfdfe770f" hs_bindgen_7033a7ddfdfe770f_base ::
+    IO HsBindgen.Runtime.LibC.CPtrdiff
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_ptrdiff_t_fun@
+hs_bindgen_7033a7ddfdfe770f :: IO HsBindgen.Runtime.LibC.CPtrdiff
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_ptrdiff_t_fun@
+hs_bindgen_7033a7ddfdfe770f = fmap fromFFIType hs_bindgen_7033a7ddfdfe770f_base
+{-| __C declaration:__ @ptrdiff_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 42:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+ptrdiff_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CPtrdiff
+{-| __C declaration:__ @ptrdiff_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 42:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+ptrdiff_t_fun_unsafe = hs_bindgen_7033a7ddfdfe770f
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wchar_t_fun@
+foreign import ccall unsafe "hs_bindgen_ebae7f4d5db1ecd0" hs_bindgen_ebae7f4d5db1ecd0_base ::
+    IO HsBindgen.Runtime.LibC.CWchar
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wchar_t_fun@
+hs_bindgen_ebae7f4d5db1ecd0 :: IO HsBindgen.Runtime.LibC.CWchar
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wchar_t_fun@
+hs_bindgen_ebae7f4d5db1ecd0 = fmap fromFFIType hs_bindgen_ebae7f4d5db1ecd0_base
+{-| __C declaration:__ @wchar_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 49:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wchar_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CWchar
+{-| __C declaration:__ @wchar_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 49:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wchar_t_fun_unsafe = hs_bindgen_ebae7f4d5db1ecd0
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wint_t_fun@
+foreign import ccall unsafe "hs_bindgen_623e42289a1c3dc3" hs_bindgen_623e42289a1c3dc3_base ::
+    IO HsBindgen.Runtime.LibC.CWintT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wint_t_fun@
+hs_bindgen_623e42289a1c3dc3 :: IO HsBindgen.Runtime.LibC.CWintT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wint_t_fun@
+hs_bindgen_623e42289a1c3dc3 = fmap fromFFIType hs_bindgen_623e42289a1c3dc3_base
+{-| __C declaration:__ @wint_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 50:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wint_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CWintT
+{-| __C declaration:__ @wint_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 50:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wint_t_fun_unsafe = hs_bindgen_623e42289a1c3dc3
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_mbstate_t_fun@
+foreign import ccall unsafe "hs_bindgen_bc84314eca8f2a7c" hs_bindgen_bc84314eca8f2a7c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_mbstate_t_fun@
+hs_bindgen_bc84314eca8f2a7c :: IO (Ptr HsBindgen.Runtime.LibC.CMbstateT)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_mbstate_t_fun@
+hs_bindgen_bc84314eca8f2a7c = fmap fromFFIType hs_bindgen_bc84314eca8f2a7c_base
+{-| __C declaration:__ @mbstate_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 51:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+mbstate_t_fun_unsafe :: IO (Ptr HsBindgen.Runtime.LibC.CMbstateT)
+{-| __C declaration:__ @mbstate_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 51:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+mbstate_t_fun_unsafe = hs_bindgen_bc84314eca8f2a7c
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctrans_t_fun@
+foreign import ccall unsafe "hs_bindgen_5524c9adc3841732" hs_bindgen_5524c9adc3841732_base ::
+    IO HsBindgen.Runtime.LibC.CWctransT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctrans_t_fun@
+hs_bindgen_5524c9adc3841732 :: IO HsBindgen.Runtime.LibC.CWctransT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctrans_t_fun@
+hs_bindgen_5524c9adc3841732 = fmap fromFFIType hs_bindgen_5524c9adc3841732_base
+{-| __C declaration:__ @wctrans_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 52:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctrans_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CWctransT
+{-| __C declaration:__ @wctrans_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 52:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctrans_t_fun_unsafe = hs_bindgen_5524c9adc3841732
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctype_t_fun@
+foreign import ccall unsafe "hs_bindgen_72885cbcc8213893" hs_bindgen_72885cbcc8213893_base ::
+    IO HsBindgen.Runtime.LibC.CWctypeT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctype_t_fun@
+hs_bindgen_72885cbcc8213893 :: IO HsBindgen.Runtime.LibC.CWctypeT
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_wctype_t_fun@
+hs_bindgen_72885cbcc8213893 = fmap fromFFIType hs_bindgen_72885cbcc8213893_base
+{-| __C declaration:__ @wctype_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 53:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctype_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CWctypeT
+{-| __C declaration:__ @wctype_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 53:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctype_t_fun_unsafe = hs_bindgen_72885cbcc8213893
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char16_t_fun@
+foreign import ccall unsafe "hs_bindgen_4284e8eb72d43965" hs_bindgen_4284e8eb72d43965_base ::
+    IO HsBindgen.Runtime.LibC.CChar16T
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char16_t_fun@
+hs_bindgen_4284e8eb72d43965 :: IO HsBindgen.Runtime.LibC.CChar16T
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char16_t_fun@
+hs_bindgen_4284e8eb72d43965 = fmap fromFFIType hs_bindgen_4284e8eb72d43965_base
+{-| __C declaration:__ @char16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 54:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char16_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CChar16T
+{-| __C declaration:__ @char16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 54:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char16_t_fun_unsafe = hs_bindgen_4284e8eb72d43965
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char32_t_fun@
+foreign import ccall unsafe "hs_bindgen_74e1167907c5de0e" hs_bindgen_74e1167907c5de0e_base ::
+    IO HsBindgen.Runtime.LibC.CChar32T
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char32_t_fun@
+hs_bindgen_74e1167907c5de0e :: IO HsBindgen.Runtime.LibC.CChar32T
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_char32_t_fun@
+hs_bindgen_74e1167907c5de0e = fmap fromFFIType hs_bindgen_74e1167907c5de0e_base
+{-| __C declaration:__ @char32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 55:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char32_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CChar32T
+{-| __C declaration:__ @char32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 55:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char32_t_fun_unsafe = hs_bindgen_74e1167907c5de0e
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_time_t_fun@
+foreign import ccall unsafe "hs_bindgen_a0c949d46b12627a" hs_bindgen_a0c949d46b12627a_base ::
+    IO HsBindgen.Runtime.LibC.CTime
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_time_t_fun@
+hs_bindgen_a0c949d46b12627a :: IO HsBindgen.Runtime.LibC.CTime
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_time_t_fun@
+hs_bindgen_a0c949d46b12627a = fmap fromFFIType hs_bindgen_a0c949d46b12627a_base
+{-| __C declaration:__ @time_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 58:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+time_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CTime
+{-| __C declaration:__ @time_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 58:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+time_t_fun_unsafe = hs_bindgen_a0c949d46b12627a
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_clock_t_fun@
+foreign import ccall unsafe "hs_bindgen_ac7afd479db138db" hs_bindgen_ac7afd479db138db_base ::
+    IO HsBindgen.Runtime.LibC.CClock
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_clock_t_fun@
+hs_bindgen_ac7afd479db138db :: IO HsBindgen.Runtime.LibC.CClock
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_clock_t_fun@
+hs_bindgen_ac7afd479db138db = fmap fromFFIType hs_bindgen_ac7afd479db138db_base
+{-| __C declaration:__ @clock_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 59:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+clock_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CClock
+{-| __C declaration:__ @clock_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 59:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+clock_t_fun_unsafe = hs_bindgen_ac7afd479db138db
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_FILE_fun@
+foreign import ccall unsafe "hs_bindgen_51b6e01d56713f95" hs_bindgen_51b6e01d56713f95_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_FILE_fun@
+hs_bindgen_51b6e01d56713f95 :: IO (Ptr HsBindgen.Runtime.LibC.CFile)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_FILE_fun@
+hs_bindgen_51b6e01d56713f95 = fmap fromFFIType hs_bindgen_51b6e01d56713f95_base
+{-| __C declaration:__ @FILE_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 64:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fILE_fun_unsafe :: IO (Ptr HsBindgen.Runtime.LibC.CFile)
+{-| __C declaration:__ @FILE_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 64:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fILE_fun_unsafe = hs_bindgen_51b6e01d56713f95
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fpos_t_fun@
+foreign import ccall unsafe "hs_bindgen_e9ed5e9a298e9a7e" hs_bindgen_e9ed5e9a298e9a7e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fpos_t_fun@
+hs_bindgen_e9ed5e9a298e9a7e :: IO (Ptr HsBindgen.Runtime.LibC.CFpos)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_fpos_t_fun@
+hs_bindgen_e9ed5e9a298e9a7e = fmap fromFFIType hs_bindgen_e9ed5e9a298e9a7e_base
+{-| __C declaration:__ @fpos_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 65:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fpos_t_fun_unsafe :: IO (Ptr HsBindgen.Runtime.LibC.CFpos)
+{-| __C declaration:__ @fpos_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 65:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fpos_t_fun_unsafe = hs_bindgen_e9ed5e9a298e9a7e
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_sig_atomic_t_fun@
+foreign import ccall unsafe "hs_bindgen_1aecb4fb9faabcf5" hs_bindgen_1aecb4fb9faabcf5_base ::
+    IO HsBindgen.Runtime.LibC.CSigAtomic
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_sig_atomic_t_fun@
+hs_bindgen_1aecb4fb9faabcf5 :: IO HsBindgen.Runtime.LibC.CSigAtomic
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_Unsafe_sig_atomic_t_fun@
+hs_bindgen_1aecb4fb9faabcf5 = fmap fromFFIType hs_bindgen_1aecb4fb9faabcf5_base
+{-| __C declaration:__ @sig_atomic_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 68:14@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+sig_atomic_t_fun_unsafe :: IO HsBindgen.Runtime.LibC.CSigAtomic
+{-| __C declaration:__ @sig_atomic_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 68:14@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+sig_atomic_t_fun_unsafe = hs_bindgen_1aecb4fb9faabcf5
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_bool_fun@
+foreign import ccall unsafe "hs_bindgen_4d50a5da1d788aef" hs_bindgen_4d50a5da1d788aef_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_bool_fun@
+hs_bindgen_4d50a5da1d788aef :: IO (FunPtr (IO CBool))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_bool_fun@
+hs_bindgen_4d50a5da1d788aef = fmap fromFFIType hs_bindgen_4d50a5da1d788aef_base
+{-# NOINLINE bool_fun_funptr #-}
+{-| __C declaration:__ @bool_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 20:6@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+bool_fun_funptr :: FunPtr (IO CBool)
+{-| __C declaration:__ @bool_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 20:6@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+bool_fun_funptr = unsafePerformIO hs_bindgen_4d50a5da1d788aef
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int8_t_fun@
+foreign import ccall unsafe "hs_bindgen_afc12424e14cd900" hs_bindgen_afc12424e14cd900_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int8_t_fun@
+hs_bindgen_afc12424e14cd900 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.Int8))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int8_t_fun@
+hs_bindgen_afc12424e14cd900 = fmap fromFFIType hs_bindgen_afc12424e14cd900_base
+{-# NOINLINE int8_t_fun_funptr #-}
+{-| __C declaration:__ @int8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 23:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int8_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.Int8)
+{-| __C declaration:__ @int8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 23:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int8_t_fun_funptr = unsafePerformIO hs_bindgen_afc12424e14cd900
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int16_t_fun@
+foreign import ccall unsafe "hs_bindgen_bb1fdb972582362b" hs_bindgen_bb1fdb972582362b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int16_t_fun@
+hs_bindgen_bb1fdb972582362b :: IO (FunPtr (IO HsBindgen.Runtime.LibC.Int16))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int16_t_fun@
+hs_bindgen_bb1fdb972582362b = fmap fromFFIType hs_bindgen_bb1fdb972582362b_base
+{-# NOINLINE int16_t_fun_funptr #-}
+{-| __C declaration:__ @int16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 24:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int16_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.Int16)
+{-| __C declaration:__ @int16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 24:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int16_t_fun_funptr = unsafePerformIO hs_bindgen_bb1fdb972582362b
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int32_t_fun@
+foreign import ccall unsafe "hs_bindgen_3ddcee1ca6e45ed1" hs_bindgen_3ddcee1ca6e45ed1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int32_t_fun@
+hs_bindgen_3ddcee1ca6e45ed1 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.Int32))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int32_t_fun@
+hs_bindgen_3ddcee1ca6e45ed1 = fmap fromFFIType hs_bindgen_3ddcee1ca6e45ed1_base
+{-# NOINLINE int32_t_fun_funptr #-}
+{-| __C declaration:__ @int32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 25:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int32_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.Int32)
+{-| __C declaration:__ @int32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 25:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int32_t_fun_funptr = unsafePerformIO hs_bindgen_3ddcee1ca6e45ed1
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int64_t_fun@
+foreign import ccall unsafe "hs_bindgen_87f02bc29c3faac0" hs_bindgen_87f02bc29c3faac0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int64_t_fun@
+hs_bindgen_87f02bc29c3faac0 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.Int64))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_int64_t_fun@
+hs_bindgen_87f02bc29c3faac0 = fmap fromFFIType hs_bindgen_87f02bc29c3faac0_base
+{-# NOINLINE int64_t_fun_funptr #-}
+{-| __C declaration:__ @int64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 26:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int64_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.Int64)
+{-| __C declaration:__ @int64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 26:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+int64_t_fun_funptr = unsafePerformIO hs_bindgen_87f02bc29c3faac0
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint8_t_fun@
+foreign import ccall unsafe "hs_bindgen_e41f6841cb24d084" hs_bindgen_e41f6841cb24d084_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint8_t_fun@
+hs_bindgen_e41f6841cb24d084 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.Word8))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint8_t_fun@
+hs_bindgen_e41f6841cb24d084 = fmap fromFFIType hs_bindgen_e41f6841cb24d084_base
+{-# NOINLINE uint8_t_fun_funptr #-}
+{-| __C declaration:__ @uint8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 27:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint8_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.Word8)
+{-| __C declaration:__ @uint8_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 27:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint8_t_fun_funptr = unsafePerformIO hs_bindgen_e41f6841cb24d084
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint16_t_fun@
+foreign import ccall unsafe "hs_bindgen_a99c4081312f9a64" hs_bindgen_a99c4081312f9a64_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint16_t_fun@
+hs_bindgen_a99c4081312f9a64 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.Word16))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint16_t_fun@
+hs_bindgen_a99c4081312f9a64 = fmap fromFFIType hs_bindgen_a99c4081312f9a64_base
+{-# NOINLINE uint16_t_fun_funptr #-}
+{-| __C declaration:__ @uint16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 28:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint16_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.Word16)
+{-| __C declaration:__ @uint16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 28:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint16_t_fun_funptr = unsafePerformIO hs_bindgen_a99c4081312f9a64
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint32_t_fun@
+foreign import ccall unsafe "hs_bindgen_d7c52be7143a7a68" hs_bindgen_d7c52be7143a7a68_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint32_t_fun@
+hs_bindgen_d7c52be7143a7a68 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.Word32))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint32_t_fun@
+hs_bindgen_d7c52be7143a7a68 = fmap fromFFIType hs_bindgen_d7c52be7143a7a68_base
+{-# NOINLINE uint32_t_fun_funptr #-}
+{-| __C declaration:__ @uint32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 29:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint32_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.Word32)
+{-| __C declaration:__ @uint32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 29:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint32_t_fun_funptr = unsafePerformIO hs_bindgen_d7c52be7143a7a68
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint64_t_fun@
+foreign import ccall unsafe "hs_bindgen_ce7fc806ab2fc8e0" hs_bindgen_ce7fc806ab2fc8e0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint64_t_fun@
+hs_bindgen_ce7fc806ab2fc8e0 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.Word64))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uint64_t_fun@
+hs_bindgen_ce7fc806ab2fc8e0 = fmap fromFFIType hs_bindgen_ce7fc806ab2fc8e0_base
+{-# NOINLINE uint64_t_fun_funptr #-}
+{-| __C declaration:__ @uint64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 30:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint64_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.Word64)
+{-| __C declaration:__ @uint64_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 30:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uint64_t_fun_funptr = unsafePerformIO hs_bindgen_ce7fc806ab2fc8e0
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intmax_t_fun@
+foreign import ccall unsafe "hs_bindgen_5b1986d8b6b49f7e" hs_bindgen_5b1986d8b6b49f7e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intmax_t_fun@
+hs_bindgen_5b1986d8b6b49f7e :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CIntMax))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intmax_t_fun@
+hs_bindgen_5b1986d8b6b49f7e = fmap fromFFIType hs_bindgen_5b1986d8b6b49f7e_base
+{-# NOINLINE intmax_t_fun_funptr #-}
+{-| __C declaration:__ @intmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 31:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intmax_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CIntMax)
+{-| __C declaration:__ @intmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 31:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intmax_t_fun_funptr = unsafePerformIO hs_bindgen_5b1986d8b6b49f7e
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintmax_t_fun@
+foreign import ccall unsafe "hs_bindgen_022ea568c1d290f4" hs_bindgen_022ea568c1d290f4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintmax_t_fun@
+hs_bindgen_022ea568c1d290f4 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CUIntMax))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintmax_t_fun@
+hs_bindgen_022ea568c1d290f4 = fmap fromFFIType hs_bindgen_022ea568c1d290f4_base
+{-# NOINLINE uintmax_t_fun_funptr #-}
+{-| __C declaration:__ @uintmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 32:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintmax_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CUIntMax)
+{-| __C declaration:__ @uintmax_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 32:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintmax_t_fun_funptr = unsafePerformIO hs_bindgen_022ea568c1d290f4
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intptr_t_fun@
+foreign import ccall unsafe "hs_bindgen_35eda59e93c8db9a" hs_bindgen_35eda59e93c8db9a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intptr_t_fun@
+hs_bindgen_35eda59e93c8db9a :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CIntPtr))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_intptr_t_fun@
+hs_bindgen_35eda59e93c8db9a = fmap fromFFIType hs_bindgen_35eda59e93c8db9a_base
+{-# NOINLINE intptr_t_fun_funptr #-}
+{-| __C declaration:__ @intptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 33:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intptr_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CIntPtr)
+{-| __C declaration:__ @intptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 33:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+intptr_t_fun_funptr = unsafePerformIO hs_bindgen_35eda59e93c8db9a
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintptr_t_fun@
+foreign import ccall unsafe "hs_bindgen_a45e879780c141ec" hs_bindgen_a45e879780c141ec_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintptr_t_fun@
+hs_bindgen_a45e879780c141ec :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CUIntPtr))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_uintptr_t_fun@
+hs_bindgen_a45e879780c141ec = fmap fromFFIType hs_bindgen_a45e879780c141ec_base
+{-# NOINLINE uintptr_t_fun_funptr #-}
+{-| __C declaration:__ @uintptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 34:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintptr_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CUIntPtr)
+{-| __C declaration:__ @uintptr_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 34:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+uintptr_t_fun_funptr = unsafePerformIO hs_bindgen_a45e879780c141ec
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fenv_t_fun@
+foreign import ccall unsafe "hs_bindgen_266815b1305c1241" hs_bindgen_266815b1305c1241_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fenv_t_fun@
+hs_bindgen_266815b1305c1241 :: IO (FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CFenvT)))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fenv_t_fun@
+hs_bindgen_266815b1305c1241 = fmap fromFFIType hs_bindgen_266815b1305c1241_base
+{-# NOINLINE fenv_t_fun_funptr #-}
+{-| __C declaration:__ @fenv_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 37:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fenv_t_fun_funptr :: FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CFenvT))
+{-| __C declaration:__ @fenv_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 37:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fenv_t_fun_funptr = unsafePerformIO hs_bindgen_266815b1305c1241
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fexcept_t_fun@
+foreign import ccall unsafe "hs_bindgen_d0eee798617140b8" hs_bindgen_d0eee798617140b8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fexcept_t_fun@
+hs_bindgen_d0eee798617140b8 :: IO (FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CFexceptT)))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fexcept_t_fun@
+hs_bindgen_d0eee798617140b8 = fmap fromFFIType hs_bindgen_d0eee798617140b8_base
+{-# NOINLINE fexcept_t_fun_funptr #-}
+{-| __C declaration:__ @fexcept_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 38:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fexcept_t_fun_funptr :: FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CFexceptT))
+{-| __C declaration:__ @fexcept_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 38:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fexcept_t_fun_funptr = unsafePerformIO hs_bindgen_d0eee798617140b8
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_size_t_fun@
+foreign import ccall unsafe "hs_bindgen_0120eaefb471d45e" hs_bindgen_0120eaefb471d45e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_size_t_fun@
+hs_bindgen_0120eaefb471d45e :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CSize))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_size_t_fun@
+hs_bindgen_0120eaefb471d45e = fmap fromFFIType hs_bindgen_0120eaefb471d45e_base
+{-# NOINLINE size_t_fun_funptr #-}
+{-| __C declaration:__ @size_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 41:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+size_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CSize)
+{-| __C declaration:__ @size_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 41:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+size_t_fun_funptr = unsafePerformIO hs_bindgen_0120eaefb471d45e
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_ptrdiff_t_fun@
+foreign import ccall unsafe "hs_bindgen_aa0444e3b2fda3de" hs_bindgen_aa0444e3b2fda3de_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_ptrdiff_t_fun@
+hs_bindgen_aa0444e3b2fda3de :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CPtrdiff))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_ptrdiff_t_fun@
+hs_bindgen_aa0444e3b2fda3de = fmap fromFFIType hs_bindgen_aa0444e3b2fda3de_base
+{-# NOINLINE ptrdiff_t_fun_funptr #-}
+{-| __C declaration:__ @ptrdiff_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 42:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+ptrdiff_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CPtrdiff)
+{-| __C declaration:__ @ptrdiff_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 42:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+ptrdiff_t_fun_funptr = unsafePerformIO hs_bindgen_aa0444e3b2fda3de
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wchar_t_fun@
+foreign import ccall unsafe "hs_bindgen_c3e6697f6a14bc13" hs_bindgen_c3e6697f6a14bc13_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wchar_t_fun@
+hs_bindgen_c3e6697f6a14bc13 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CWchar))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wchar_t_fun@
+hs_bindgen_c3e6697f6a14bc13 = fmap fromFFIType hs_bindgen_c3e6697f6a14bc13_base
+{-# NOINLINE wchar_t_fun_funptr #-}
+{-| __C declaration:__ @wchar_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 49:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wchar_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CWchar)
+{-| __C declaration:__ @wchar_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 49:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wchar_t_fun_funptr = unsafePerformIO hs_bindgen_c3e6697f6a14bc13
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wint_t_fun@
+foreign import ccall unsafe "hs_bindgen_f3077dc66d53977f" hs_bindgen_f3077dc66d53977f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wint_t_fun@
+hs_bindgen_f3077dc66d53977f :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CWintT))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wint_t_fun@
+hs_bindgen_f3077dc66d53977f = fmap fromFFIType hs_bindgen_f3077dc66d53977f_base
+{-# NOINLINE wint_t_fun_funptr #-}
+{-| __C declaration:__ @wint_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 50:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wint_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CWintT)
+{-| __C declaration:__ @wint_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 50:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wint_t_fun_funptr = unsafePerformIO hs_bindgen_f3077dc66d53977f
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_mbstate_t_fun@
+foreign import ccall unsafe "hs_bindgen_b863e606ff088408" hs_bindgen_b863e606ff088408_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_mbstate_t_fun@
+hs_bindgen_b863e606ff088408 :: IO (FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CMbstateT)))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_mbstate_t_fun@
+hs_bindgen_b863e606ff088408 = fmap fromFFIType hs_bindgen_b863e606ff088408_base
+{-# NOINLINE mbstate_t_fun_funptr #-}
+{-| __C declaration:__ @mbstate_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 51:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+mbstate_t_fun_funptr :: FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CMbstateT))
+{-| __C declaration:__ @mbstate_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 51:12@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+mbstate_t_fun_funptr = unsafePerformIO hs_bindgen_b863e606ff088408
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctrans_t_fun@
+foreign import ccall unsafe "hs_bindgen_a9599637dbc12608" hs_bindgen_a9599637dbc12608_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctrans_t_fun@
+hs_bindgen_a9599637dbc12608 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CWctransT))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctrans_t_fun@
+hs_bindgen_a9599637dbc12608 = fmap fromFFIType hs_bindgen_a9599637dbc12608_base
+{-# NOINLINE wctrans_t_fun_funptr #-}
+{-| __C declaration:__ @wctrans_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 52:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctrans_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CWctransT)
+{-| __C declaration:__ @wctrans_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 52:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctrans_t_fun_funptr = unsafePerformIO hs_bindgen_a9599637dbc12608
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctype_t_fun@
+foreign import ccall unsafe "hs_bindgen_207a54450593099a" hs_bindgen_207a54450593099a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctype_t_fun@
+hs_bindgen_207a54450593099a :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CWctypeT))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_wctype_t_fun@
+hs_bindgen_207a54450593099a = fmap fromFFIType hs_bindgen_207a54450593099a_base
+{-# NOINLINE wctype_t_fun_funptr #-}
+{-| __C declaration:__ @wctype_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 53:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctype_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CWctypeT)
+{-| __C declaration:__ @wctype_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 53:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+wctype_t_fun_funptr = unsafePerformIO hs_bindgen_207a54450593099a
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char16_t_fun@
+foreign import ccall unsafe "hs_bindgen_28a6e39f56489ba2" hs_bindgen_28a6e39f56489ba2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char16_t_fun@
+hs_bindgen_28a6e39f56489ba2 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CChar16T))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char16_t_fun@
+hs_bindgen_28a6e39f56489ba2 = fmap fromFFIType hs_bindgen_28a6e39f56489ba2_base
+{-# NOINLINE char16_t_fun_funptr #-}
+{-| __C declaration:__ @char16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 54:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char16_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CChar16T)
+{-| __C declaration:__ @char16_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 54:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char16_t_fun_funptr = unsafePerformIO hs_bindgen_28a6e39f56489ba2
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char32_t_fun@
+foreign import ccall unsafe "hs_bindgen_f918c5a2d6c16885" hs_bindgen_f918c5a2d6c16885_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char32_t_fun@
+hs_bindgen_f918c5a2d6c16885 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CChar32T))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_char32_t_fun@
+hs_bindgen_f918c5a2d6c16885 = fmap fromFFIType hs_bindgen_f918c5a2d6c16885_base
+{-# NOINLINE char32_t_fun_funptr #-}
+{-| __C declaration:__ @char32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 55:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char32_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CChar32T)
+{-| __C declaration:__ @char32_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 55:11@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+char32_t_fun_funptr = unsafePerformIO hs_bindgen_f918c5a2d6c16885
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_time_t_fun@
+foreign import ccall unsafe "hs_bindgen_f29cfe7708be784f" hs_bindgen_f29cfe7708be784f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_time_t_fun@
+hs_bindgen_f29cfe7708be784f :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CTime))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_time_t_fun@
+hs_bindgen_f29cfe7708be784f = fmap fromFFIType hs_bindgen_f29cfe7708be784f_base
+{-# NOINLINE time_t_fun_funptr #-}
+{-| __C declaration:__ @time_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 58:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+time_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CTime)
+{-| __C declaration:__ @time_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 58:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+time_t_fun_funptr = unsafePerformIO hs_bindgen_f29cfe7708be784f
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_clock_t_fun@
+foreign import ccall unsafe "hs_bindgen_509d092c2afe1ddc" hs_bindgen_509d092c2afe1ddc_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_clock_t_fun@
+hs_bindgen_509d092c2afe1ddc :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CClock))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_clock_t_fun@
+hs_bindgen_509d092c2afe1ddc = fmap fromFFIType hs_bindgen_509d092c2afe1ddc_base
+{-# NOINLINE clock_t_fun_funptr #-}
+{-| __C declaration:__ @clock_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 59:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+clock_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CClock)
+{-| __C declaration:__ @clock_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 59:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+clock_t_fun_funptr = unsafePerformIO hs_bindgen_509d092c2afe1ddc
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_FILE_fun@
+foreign import ccall unsafe "hs_bindgen_8f5880570a38b5dd" hs_bindgen_8f5880570a38b5dd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_FILE_fun@
+hs_bindgen_8f5880570a38b5dd :: IO (FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CFile)))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_FILE_fun@
+hs_bindgen_8f5880570a38b5dd = fmap fromFFIType hs_bindgen_8f5880570a38b5dd_base
+{-# NOINLINE fILE_fun_funptr #-}
+{-| __C declaration:__ @FILE_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 64:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fILE_fun_funptr :: FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CFile))
+{-| __C declaration:__ @FILE_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 64:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fILE_fun_funptr = unsafePerformIO hs_bindgen_8f5880570a38b5dd
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fpos_t_fun@
+foreign import ccall unsafe "hs_bindgen_8b563cc85422e790" hs_bindgen_8b563cc85422e790_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fpos_t_fun@
+hs_bindgen_8b563cc85422e790 :: IO (FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CFpos)))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_fpos_t_fun@
+hs_bindgen_8b563cc85422e790 = fmap fromFFIType hs_bindgen_8b563cc85422e790_base
+{-# NOINLINE fpos_t_fun_funptr #-}
+{-| __C declaration:__ @fpos_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 65:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fpos_t_fun_funptr :: FunPtr (IO (Ptr HsBindgen.Runtime.LibC.CFpos))
+{-| __C declaration:__ @fpos_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 65:9@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+fpos_t_fun_funptr = unsafePerformIO hs_bindgen_8b563cc85422e790
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_sig_atomic_t_fun@
+foreign import ccall unsafe "hs_bindgen_9fcd36cfaa3ea373" hs_bindgen_9fcd36cfaa3ea373_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_sig_atomic_t_fun@
+hs_bindgen_9fcd36cfaa3ea373 :: IO (FunPtr (IO HsBindgen.Runtime.LibC.CSigAtomic))
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_sig_atomic_t_fun@
+hs_bindgen_9fcd36cfaa3ea373 = fmap fromFFIType hs_bindgen_9fcd36cfaa3ea373_base
+{-# NOINLINE sig_atomic_t_fun_funptr #-}
+{-| __C declaration:__ @sig_atomic_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 68:14@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+sig_atomic_t_fun_funptr :: FunPtr (IO HsBindgen.Runtime.LibC.CSigAtomic)
+{-| __C declaration:__ @sig_atomic_t_fun@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 68:14@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+sig_atomic_t_fun_funptr = unsafePerformIO hs_bindgen_9fcd36cfaa3ea373
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_jmp_buf_val@
+foreign import ccall unsafe "hs_bindgen_68c2b692efbc4734" hs_bindgen_68c2b692efbc4734_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_jmp_buf_val@
+hs_bindgen_68c2b692efbc4734 :: IO (Ptr HsBindgen.Runtime.LibC.CJmpBuf)
+-- __unique:__ @test_bindingspecsstdlibreturn_va_Example_get_jmp_buf_val@
+hs_bindgen_68c2b692efbc4734 = fmap fromFFIType hs_bindgen_68c2b692efbc4734_base
+{-# NOINLINE jmp_buf_val #-}
+{-| __C declaration:__ @jmp_buf_val@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 46:16@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+jmp_buf_val :: Ptr HsBindgen.Runtime.LibC.CJmpBuf
+{-| __C declaration:__ @jmp_buf_val@
+
+    __defined at:__ @binding-specs\/stdlib\/return_values.h 46:16@
+
+    __exported by:__ @binding-specs\/stdlib\/return_values.h@
+-}
+jmp_buf_val = unsafePerformIO hs_bindgen_68c2b692efbc4734
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/trans_dep/macro_trans_dep_missing.h>"
+  , "/* test_bindingspecstrans_depmacro__Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a003101b3eb21238 (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a003101b3eb21238" hs_bindgen_a003101b3eb21238_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_get_foo@
+hs_bindgen_a003101b3eb21238 :: IO (BG.FunPtr (M.B -> IO ()))
+hs_bindgen_a003101b3eb21238 =
+  fmap BG.fromFFIType hs_bindgen_a003101b3eb21238_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h 7:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h@
+-}
+foo :: BG.FunPtr (M.B -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_a003101b3eb21238
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/Example/Safe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/trans_dep/macro_trans_dep_missing.h>"
+  , "void hs_bindgen_361ca1eaf8f4495c ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_361ca1eaf8f4495c" hs_bindgen_361ca1eaf8f4495c_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Safe_foo@
+hs_bindgen_361ca1eaf8f4495c ::
+     M.B
+  -> IO ()
+hs_bindgen_361ca1eaf8f4495c =
+  \x0 ->
+    hs_bindgen_361ca1eaf8f4495c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h 7:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h@
+-}
+foo ::
+     M.B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_361ca1eaf8f4495c
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/Example/Unsafe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/trans_dep/macro_trans_dep_missing.h>"
+  , "void hs_bindgen_83453c8683cd3ff7 ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_83453c8683cd3ff7" hs_bindgen_83453c8683cd3ff7_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Unsafe_foo@
+hs_bindgen_83453c8683cd3ff7 ::
+     M.B
+  -> IO ()
+hs_bindgen_83453c8683cd3ff7 =
+  \x0 ->
+    hs_bindgen_83453c8683cd3ff7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h 7:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h@
+-}
+foo ::
+     M.B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_83453c8683cd3ff7
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/th.txt b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/macro_trans_dep_missing/th.txt
@@ -0,0 +1,88 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/trans_dep/macro_trans_dep_missing.h
+-- #include <binding-specs/trans_dep/macro_trans_dep_missing.h>
+-- void hs_bindgen_361ca1eaf8f4495c (
+--   B arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_83453c8683cd3ff7 (
+--   B arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- /* test_bindingspecstrans_depmacro__Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a003101b3eb21238 (void)) (
+--   B arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_361ca1eaf8f4495c" hs_bindgen_361ca1eaf8f4495c_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Safe_foo@
+hs_bindgen_361ca1eaf8f4495c :: M.B -> IO ()
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Safe_foo@
+hs_bindgen_361ca1eaf8f4495c = \x_0 -> hs_bindgen_361ca1eaf8f4495c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h 7:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h@
+-}
+foo_safe :: M.B -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h 7:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h@
+-}
+foo_safe = hs_bindgen_361ca1eaf8f4495c
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_83453c8683cd3ff7" hs_bindgen_83453c8683cd3ff7_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Unsafe_foo@
+hs_bindgen_83453c8683cd3ff7 :: M.B -> IO ()
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_Unsafe_foo@
+hs_bindgen_83453c8683cd3ff7 = \x_0 -> hs_bindgen_83453c8683cd3ff7_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h 7:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h@
+-}
+foo_unsafe :: M.B -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h 7:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h@
+-}
+foo_unsafe = hs_bindgen_83453c8683cd3ff7
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a003101b3eb21238" hs_bindgen_a003101b3eb21238_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_get_foo@
+hs_bindgen_a003101b3eb21238 :: IO (FunPtr (M.B -> IO ()))
+-- __unique:__ @test_bindingspecstrans_depmacro__Example_get_foo@
+hs_bindgen_a003101b3eb21238 = fmap fromFFIType hs_bindgen_a003101b3eb21238_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h 7:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h@
+-}
+foo_funptr :: FunPtr (M.B -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h 7:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/macro_trans_dep_missing.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_a003101b3eb21238
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/Example/FunPtr.hs b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/trans_dep/typedef_trans_dep_missing.h>"
+  , "/* test_bindingspecstrans_deptypede_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e5f763922a0a17ca (void)) ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_e5f763922a0a17ca" hs_bindgen_e5f763922a0a17ca_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_get_foo@
+hs_bindgen_e5f763922a0a17ca :: IO (BG.FunPtr (BG.Ptr M.B -> IO ()))
+hs_bindgen_e5f763922a0a17ca =
+  fmap BG.fromFFIType hs_bindgen_e5f763922a0a17ca_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h 9:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h@
+-}
+foo :: BG.FunPtr (BG.Ptr M.B -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_e5f763922a0a17ca
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/Example/Safe.hs b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/Example/Safe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/trans_dep/typedef_trans_dep_missing.h>"
+  , "void hs_bindgen_6687afc6aaabd927 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_6687afc6aaabd927" hs_bindgen_6687afc6aaabd927_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Safe_foo@
+hs_bindgen_6687afc6aaabd927 ::
+     BG.Ptr M.B
+  -> IO ()
+hs_bindgen_6687afc6aaabd927 =
+  \x0 ->
+    hs_bindgen_6687afc6aaabd927_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h 9:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h@
+-}
+foo ::
+     BG.Ptr M.B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_6687afc6aaabd927
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/Example/Unsafe.hs b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/Example/Unsafe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <binding-specs/trans_dep/typedef_trans_dep_missing.h>"
+  , "void hs_bindgen_38d7300ed18eb652 ("
+  , "  B *arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_38d7300ed18eb652" hs_bindgen_38d7300ed18eb652_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Unsafe_foo@
+hs_bindgen_38d7300ed18eb652 ::
+     BG.Ptr M.B
+  -> IO ()
+hs_bindgen_38d7300ed18eb652 =
+  \x0 ->
+    hs_bindgen_38d7300ed18eb652_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h 9:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h@
+-}
+foo ::
+     BG.Ptr M.B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_38d7300ed18eb652
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/bindingspec.yaml b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/th.txt b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/binding-specs/trans_dep/typedef_trans_dep_missing/th.txt
@@ -0,0 +1,88 @@
+-- addDependentFile test-artefacts/headers/golden/binding-specs/trans_dep/typedef_trans_dep_missing.h
+-- #include <binding-specs/trans_dep/typedef_trans_dep_missing.h>
+-- void hs_bindgen_6687afc6aaabd927 (
+--   B *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_38d7300ed18eb652 (
+--   B *arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- /* test_bindingspecstrans_deptypede_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e5f763922a0a17ca (void)) (
+--   B *arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_6687afc6aaabd927" hs_bindgen_6687afc6aaabd927_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Safe_foo@
+hs_bindgen_6687afc6aaabd927 :: Ptr M.B -> IO ()
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Safe_foo@
+hs_bindgen_6687afc6aaabd927 = \x_0 -> hs_bindgen_6687afc6aaabd927_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h 9:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h@
+-}
+foo_safe :: Ptr M.B -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h 9:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h@
+-}
+foo_safe = hs_bindgen_6687afc6aaabd927
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_38d7300ed18eb652" hs_bindgen_38d7300ed18eb652_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Unsafe_foo@
+hs_bindgen_38d7300ed18eb652 :: Ptr M.B -> IO ()
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_Unsafe_foo@
+hs_bindgen_38d7300ed18eb652 = \x_0 -> hs_bindgen_38d7300ed18eb652_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h 9:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h@
+-}
+foo_unsafe :: Ptr M.B -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h 9:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h@
+-}
+foo_unsafe = hs_bindgen_38d7300ed18eb652
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_e5f763922a0a17ca" hs_bindgen_e5f763922a0a17ca_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_get_foo@
+hs_bindgen_e5f763922a0a17ca :: IO (FunPtr (Ptr M.B -> IO ()))
+-- __unique:__ @test_bindingspecstrans_deptypede_Example_get_foo@
+hs_bindgen_e5f763922a0a17ca = fmap fromFFIType hs_bindgen_e5f763922a0a17ca_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h 9:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h@
+-}
+foo_funptr :: FunPtr (Ptr M.B -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h 9:6@
+
+    __exported by:__ @binding-specs\/trans_dep\/typedef_trans_dep_missing.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_e5f763922a0a17ca
diff --git a/test-artefacts/fixtures/comprehensive/c2hsc/Example.hs b/test-artefacts/fixtures/comprehensive/c2hsc/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/c2hsc/Example.hs
@@ -0,0 +1,6583 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.An_pchar(..)
+    , Example.MyCoolStruct(..)
+    , Example.Foo_Aux(..)
+    , Example.Foo(..)
+    , Example.Foo_t(..)
+    , Example.Foo_10
+    , Example.Bar_10(..)
+    , pattern Example.BAR
+    , Example.St(..)
+    , Example.E(..)
+    , pattern Example.CONST
+    , Example.U(..)
+    , Example.MyTypeImpl
+    , Example.MyType(..)
+    , Example.MyStructType(..)
+    , Example.MyStructEmptyType
+    , Example.Ordinary_float_struct(..)
+    , Example.Ordinary_double_struct(..)
+    , Example.Ordinary_signed_char_struct(..)
+    , Example.Explicit_signed_char_struct(..)
+    , Example.Unsigned_char_struct(..)
+    , Example.Ordinary_signed_short_struct(..)
+    , Example.Explicit_signed_short_struct(..)
+    , Example.Unsigned_short_struct(..)
+    , Example.Ordinary_signed_int_struct(..)
+    , Example.Explicit_signed_int_struct(..)
+    , Example.Unsigned_int_struct(..)
+    , Example.Ordinary_signed_long_struct(..)
+    , Example.Explicit_signed_long_struct(..)
+    , Example.Unsigned_long_struct(..)
+    , Example.Ordinary_signed_long_long_struct(..)
+    , Example.Explicit_signed_long_long_struct(..)
+    , Example.Unsigned_long_long_struct(..)
+    , Example.Ordinary_void_pointer_struct(..)
+    , Example.Ordinary_float_pointer_struct(..)
+    , Example.Ordinary_double_pointer_struct(..)
+    , Example.Ordinary_signed_char_pointer_struct(..)
+    , Example.Explicit_signed_char_pointer_struct(..)
+    , Example.Unsigned_char_pointer_struct(..)
+    , Example.Ordinary_signed_short_pointer_struct(..)
+    , Example.Explicit_signed_short_pointer_struct(..)
+    , Example.Unsigned_short_pointer_struct(..)
+    , Example.Ordinary_signed_int_pointer_struct(..)
+    , Example.Explicit_signed_int_pointer_struct(..)
+    , Example.Unsigned_int_pointer_struct(..)
+    , Example.Ordinary_signed_long_pointer_struct(..)
+    , Example.Explicit_signed_long_pointer_struct(..)
+    , Example.Unsigned_long_pointer_struct(..)
+    , Example.Ordinary_signed_long_long_pointer_struct(..)
+    , Example.Explicit_signed_long_long_pointer_struct(..)
+    , Example.Unsigned_long_long_pointer_struct(..)
+    , Example.Ordinary_float_array_struct(..)
+    , Example.Ordinary_double_array_struct(..)
+    , Example.Ordinary_signed_char_array_struct(..)
+    , Example.Explicit_signed_char_array_struct(..)
+    , Example.Unsigned_char_array_struct(..)
+    , Example.Ordinary_signed_short_array_struct(..)
+    , Example.Explicit_signed_short_array_struct(..)
+    , Example.Unsigned_short_array_struct(..)
+    , Example.Ordinary_signed_int_array_struct(..)
+    , Example.Explicit_signed_int_array_struct(..)
+    , Example.Unsigned_int_array_struct(..)
+    , Example.Ordinary_signed_long_array_struct(..)
+    , Example.Explicit_signed_long_array_struct(..)
+    , Example.Unsigned_long_array_struct(..)
+    , Example.Ordinary_signed_long_long_array_struct(..)
+    , Example.Explicit_signed_long_long_array_struct(..)
+    , Example.Unsigned_long_long_array_struct(..)
+    , Example.Ordinary_void_pointer_array_struct(..)
+    , Example.Ordinary_float_pointer_array_struct(..)
+    , Example.Ordinary_double_pointer_array_struct(..)
+    , Example.Ordinary_signed_char_pointer_array_struct(..)
+    , Example.Explicit_signed_char_pointer_array_struct(..)
+    , Example.Unsigned_char_pointer_array_struct(..)
+    , Example.Ordinary_signed_short_pointer_array_struct(..)
+    , Example.Explicit_signed_short_pointer_array_struct(..)
+    , Example.Unsigned_short_pointer_array_struct(..)
+    , Example.Ordinary_signed_int_pointer_array_struct(..)
+    , Example.Explicit_signed_int_pointer_array_struct(..)
+    , Example.Unsigned_int_pointer_array_struct(..)
+    , Example.Ordinary_signed_long_pointer_array_struct(..)
+    , Example.Explicit_signed_long_pointer_array_struct(..)
+    , Example.Unsigned_long_pointer_array_struct(..)
+    , Example.Ordinary_signed_long_long_pointer_array_struct(..)
+    , Example.Explicit_signed_long_long_pointer_array_struct(..)
+    , Example.Unsigned_long_long_pointer_array_struct(..)
+    , Example.An_int(..)
+    , Example.Cal_table_table(..)
+    , Example.Cal_table(..)
+    , Example.Elf32_External_Dyn_d_un(..)
+    , Example.Elf32_External_Dyn(..)
+    , Example.Bug_24(..)
+    , Example.Bug_24_2(..)
+    , Example.MyArray_27(..)
+    , Example.MyStruct_27(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, fmap, pure, type (~))
+
+{-| Issues
+
+    __C declaration:__ @an_pchar@
+
+    __defined at:__ @comprehensive\/c2hsc.h 12:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype An_pchar = An_pchar
+  { unwrap :: PtrConst.PtrConst BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.CompatHasField.HasField "unwrap" An_pchar ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         An_pchar {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ PtrConst.PtrConst BG.CChar
+         ) => BG.HasField "unwrap" (BG.Ptr An_pchar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField An_pchar "unwrap" where
+
+  type CFieldType An_pchar "unwrap" =
+    PtrConst.PtrConst BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct MyCoolStruct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 15:9@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyCoolStruct = MyCoolStruct
+  { listOfNames :: CA.ConstantArray 8 (CA.ConstantArray 255 BG.CChar)
+    {- ^ __C declaration:__ @listOfNames@
+
+         __defined at:__ @comprehensive\/c2hsc.h 16:10@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize MyCoolStruct where
+
+  staticSizeOf = \_ -> (2040 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw MyCoolStruct where
+
+  readRaw =
+    \ptr0 ->
+          pure MyCoolStruct
+      <*> HasCField.readRaw (BG.Proxy @"listOfNames") ptr0
+
+instance Marshal.WriteRaw MyCoolStruct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MyCoolStruct listOfNames2 ->
+            HasCField.writeRaw (BG.Proxy @"listOfNames") ptr0 listOfNames2
+
+deriving via Marshal.EquivStorable MyCoolStruct instance BG.Storable MyCoolStruct
+
+deriving via Struct.IsStructViaReadRaw MyCoolStruct instance Struct.IsStruct MyCoolStruct
+
+{-| __C declaration:__ @listOfNames@
+
+    __defined at:__ @comprehensive\/c2hsc.h 16:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 8 (CA.ConstantArray 255 BG.CChar)
+         ) => BG.CompatHasField.HasField "listOfNames" MyCoolStruct ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyCoolStruct {listOfNames = y1}, BG.getField @"listOfNames" x0)
+
+instance ( ty ~ CA.ConstantArray 8 (CA.ConstantArray 255 BG.CChar)
+         ) => BG.HasField "listOfNames" (BG.Ptr MyCoolStruct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"listOfNames")
+
+instance HasCField.HasCField MyCoolStruct "listOfNames" where
+
+  type CFieldType MyCoolStruct "listOfNames" =
+    CA.ConstantArray 8 (CA.ConstantArray 255 BG.CChar)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Foo'
+
+    __C declaration:__ @foo@
+
+    __defined at:__ @comprehensive\/c2hsc.h 20:15@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Foo_Aux = Foo_Aux
+  { unwrap :: BG.CInt -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFoo_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b5a7b5e83ffee6b4_base ::
+     (BG.CInt -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+
+-- __unique:__ @toFoo_Aux@
+hs_bindgen_b5a7b5e83ffee6b4 ::
+     Foo_Aux
+  -> IO (BG.FunPtr Foo_Aux)
+hs_bindgen_b5a7b5e83ffee6b4 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b5a7b5e83ffee6b4_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrap" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromFoo_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_223d08172bb37c01_base ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> BG.CInt -> IO BG.CInt
+
+-- __unique:__ @fromFoo_Aux@
+hs_bindgen_223d08172bb37c01 ::
+     BG.FunPtr Foo_Aux
+  -> Foo_Aux
+hs_bindgen_223d08172bb37c01 =
+  \funPtr0 ->
+    Foo_Aux (\x1 ->
+               fmap BG.fromFFIType (hs_bindgen_223d08172bb37c01_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr Foo_Aux where
+
+  toFunPtr = hs_bindgen_b5a7b5e83ffee6b4
+
+instance BG.FromFunPtr Foo_Aux where
+
+  fromFunPtr = hs_bindgen_223d08172bb37c01
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrap" Foo_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo_Aux {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "unwrap" (BG.Ptr Foo_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Foo_Aux "unwrap" where
+
+  type CFieldType Foo_Aux "unwrap" =
+    BG.CInt -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @comprehensive\/c2hsc.h 20:15@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Foo = Foo
+  { unwrap :: BG.FunPtr Foo_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Foo_Aux
+         ) => BG.CompatHasField.HasField "unwrap" Foo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> Foo {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.FunPtr Foo_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Foo "unwrap" where
+
+  type CFieldType Foo "unwrap" = BG.FunPtr Foo_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct foo_t@
+
+    __defined at:__ @comprehensive\/c2hsc.h 31:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Foo_t = Foo_t
+  { foo_member :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+    {- ^ __C declaration:__ @foo_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 32:11@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo_t where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Foo_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo_t
+      <*> HasCField.readRaw (BG.Proxy @"foo_member") ptr0
+
+instance Marshal.WriteRaw Foo_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo_t foo_member2 ->
+            HasCField.writeRaw (BG.Proxy @"foo_member") ptr0 foo_member2
+
+deriving via Marshal.EquivStorable Foo_t instance BG.Storable Foo_t
+
+deriving via Struct.IsStructViaReadRaw Foo_t instance Struct.IsStruct Foo_t
+
+{-| __C declaration:__ @foo_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 32:11@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "foo_member" Foo_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo_t {foo_member = y1}, BG.getField @"foo_member" x0)
+
+instance ( ty ~ BG.FunPtr (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "foo_member" (BG.Ptr Foo_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_member")
+
+instance HasCField.HasCField Foo_t "foo_member" where
+
+  type CFieldType Foo_t "foo_member" =
+    BG.FunPtr (BG.CInt -> IO BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct Foo_10_@
+
+    __defined at:__ @comprehensive\/c2hsc.h 44:16@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Foo_10
+
+{-| __C declaration:__ @enum Bar_10_@
+
+    __defined at:__ @comprehensive\/c2hsc.h 45:14@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Bar_10 = Bar_10
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Bar_10 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bar_10 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_10
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Bar_10 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_10 unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable Bar_10 instance BG.Storable Bar_10
+
+deriving via BG.CUInt instance BG.Prim Bar_10
+
+instance CEnum.CEnum Bar_10 where
+
+  type CEnumZ Bar_10 = BG.CUInt
+
+  toCEnum = Bar_10
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "BAR")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Bar_10"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Bar_10"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Bar_10 where
+
+  minDeclaredValue = BAR
+
+  maxDeclaredValue = BAR
+
+instance Show Bar_10 where
+
+  showsPrec = CEnum.shows
+
+instance Read Bar_10 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrap" Bar_10 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bar_10 {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr Bar_10) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Bar_10 "unwrap" where
+
+  type CFieldType Bar_10 "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @BAR@
+
+    __defined at:__ @comprehensive\/c2hsc.h 45:24@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+pattern BAR :: Bar_10
+pattern BAR = Bar_10 0
+
+{-| __C declaration:__ @struct st@
+
+    __defined at:__ @comprehensive\/c2hsc.h 48:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data St = St
+  { i :: BG.CInt
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @comprehensive\/c2hsc.h 49:7@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize St where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw St where
+
+  readRaw =
+    \ptr0 ->
+          pure St
+      <*> HasCField.readRaw (BG.Proxy @"i") ptr0
+
+instance Marshal.WriteRaw St where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          St i2 -> HasCField.writeRaw (BG.Proxy @"i") ptr0 i2
+
+deriving via Marshal.EquivStorable St instance BG.Storable St
+
+deriving via Struct.IsStructViaReadRaw St instance Struct.IsStruct St
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @comprehensive\/c2hsc.h 49:7@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "i" St ty where
+
+  hasField =
+    \x0 -> (\y1 -> St {i = y1}, BG.getField @"i" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "i" (BG.Ptr St) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"i")
+
+instance HasCField.HasCField St "i" where
+
+  type CFieldType St "i" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @enum e@
+
+    __defined at:__ @comprehensive\/c2hsc.h 52:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype E = E
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E where
+
+  readRaw =
+    \ptr0 ->
+          pure E
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable E instance BG.Storable E
+
+deriving via BG.CUInt instance BG.Prim E
+
+instance CEnum.CEnum E where
+
+  type CEnumZ E = BG.CUInt
+
+  toCEnum = E
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "CONST")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E where
+
+  minDeclaredValue = CONST
+
+  maxDeclaredValue = CONST
+
+instance Show E where
+
+  showsPrec = CEnum.shows
+
+instance Read E where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrap" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrap" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField E "unwrap" where
+
+  type CFieldType E "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @CONST@
+
+    __defined at:__ @comprehensive\/c2hsc.h 53:3@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+pattern CONST :: E
+pattern CONST = E 0
+
+{-| __C declaration:__ @union u@
+
+    __defined at:__ @comprehensive\/c2hsc.h 56:7@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype U = U
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 1 1 instance Marshal.StaticSize U
+
+deriving via BG.SizedByteArray 1 1 instance Marshal.ReadRaw U
+
+deriving via BG.SizedByteArray 1 1 instance Marshal.WriteRaw U
+
+deriving via Marshal.EquivStorable U instance BG.Storable U
+
+deriving via BG.SizedByteArray 1 1 instance Union.IsUnion U
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @comprehensive\/c2hsc.h 57:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "c" U ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @comprehensive\/c2hsc.h 57:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "c" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"c" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "c" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"c")
+
+instance HasCField.HasCField U "c" where
+
+  type CFieldType U "c" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct MyTypeImpl@
+
+    __defined at:__ @comprehensive\/c2hsc.h 61:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyTypeImpl
+
+{-| __C declaration:__ @MyType@
+
+    __defined at:__ @comprehensive\/c2hsc.h 62:28@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype MyType = MyType
+  { unwrap :: BG.Ptr MyTypeImpl
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr MyTypeImpl
+         ) => BG.CompatHasField.HasField "unwrap" MyType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyType {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr MyTypeImpl
+         ) => BG.HasField "unwrap" (BG.Ptr MyType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField MyType "unwrap" where
+
+  type CFieldType MyType "unwrap" = BG.Ptr MyTypeImpl
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct MyStruct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 64:16@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyStructType = MyStructType
+  { x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @comprehensive\/c2hsc.h 65:7@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize MyStructType where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw MyStructType where
+
+  readRaw =
+    \ptr0 ->
+          pure MyStructType
+      <*> HasCField.readRaw (BG.Proxy @"x") ptr0
+
+instance Marshal.WriteRaw MyStructType where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MyStructType x2 ->
+            HasCField.writeRaw (BG.Proxy @"x") ptr0 x2
+
+deriving via Marshal.EquivStorable MyStructType instance BG.Storable MyStructType
+
+deriving via Struct.IsStructViaReadRaw MyStructType instance Struct.IsStruct MyStructType
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @comprehensive\/c2hsc.h 65:7@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" MyStructType ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> MyStructType {x = y1}, BG.getField @"x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr MyStructType) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField MyStructType "x" where
+
+  type CFieldType MyStructType "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct MyStructEmpty@
+
+    __defined at:__ @comprehensive\/c2hsc.h 68:16@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyStructEmptyType
+
+{-| Structs: primitive types
+
+    __C declaration:__ @struct ordinary_float_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 204:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_float_struct = Ordinary_float_struct
+  { ordinary_float_member :: BG.CFloat
+    {- ^ __C declaration:__ @ordinary_float_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 204:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_float_struct where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Ordinary_float_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_float_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_float_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_float_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_float_struct ordinary_float_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_float_member") ptr0 ordinary_float_member2
+
+deriving via Marshal.EquivStorable Ordinary_float_struct instance BG.Storable Ordinary_float_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_float_struct instance Struct.IsStruct Ordinary_float_struct
+
+{-| __C declaration:__ @ordinary_float_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 204:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CFloat
+         ) => BG.CompatHasField.HasField "ordinary_float_member" Ordinary_float_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_float_struct {ordinary_float_member = y1}
+      , BG.getField @"ordinary_float_member" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "ordinary_float_member" (BG.Ptr Ordinary_float_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_float_member")
+
+instance HasCField.HasCField Ordinary_float_struct "ordinary_float_member" where
+
+  type CFieldType Ordinary_float_struct "ordinary_float_member" =
+    BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_double_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 205:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_double_struct = Ordinary_double_struct
+  { ordinary_double_member :: BG.CDouble
+    {- ^ __C declaration:__ @ordinary_double_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 205:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_double_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_double_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_double_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_double_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_double_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_double_struct ordinary_double_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_double_member") ptr0 ordinary_double_member2
+
+deriving via Marshal.EquivStorable Ordinary_double_struct instance BG.Storable Ordinary_double_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_double_struct instance Struct.IsStruct Ordinary_double_struct
+
+{-| __C declaration:__ @ordinary_double_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 205:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "ordinary_double_member" Ordinary_double_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_double_struct {ordinary_double_member = y1}
+      , BG.getField @"ordinary_double_member" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "ordinary_double_member" (BG.Ptr Ordinary_double_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_double_member")
+
+instance HasCField.HasCField Ordinary_double_struct "ordinary_double_member" where
+
+  type CFieldType Ordinary_double_struct "ordinary_double_member" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_char_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 208:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_char_struct = Ordinary_signed_char_struct
+  { ordinary_signed_char_member :: BG.CChar
+    {- ^ __C declaration:__ @ordinary_signed_char_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 208:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_char_struct where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_char_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_char_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_char_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_char_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_char_struct ordinary_signed_char_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_char_member") ptr0 ordinary_signed_char_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_char_struct instance BG.Storable Ordinary_signed_char_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_char_struct instance Struct.IsStruct Ordinary_signed_char_struct
+
+{-| __C declaration:__ @ordinary_signed_char_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 208:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "ordinary_signed_char_member" Ordinary_signed_char_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_char_struct {ordinary_signed_char_member = y1}
+      , BG.getField @"ordinary_signed_char_member" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "ordinary_signed_char_member" (BG.Ptr Ordinary_signed_char_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_char_member")
+
+instance HasCField.HasCField Ordinary_signed_char_struct "ordinary_signed_char_member" where
+
+  type CFieldType Ordinary_signed_char_struct "ordinary_signed_char_member" =
+    BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_char_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 209:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_char_struct = Explicit_signed_char_struct
+  { explicit_signed_char_member :: BG.CSChar
+    {- ^ __C declaration:__ @explicit_signed_char_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 209:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_char_struct where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_char_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_char_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_char_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_char_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_char_struct explicit_signed_char_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_char_member") ptr0 explicit_signed_char_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_char_struct instance BG.Storable Explicit_signed_char_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_char_struct instance Struct.IsStruct Explicit_signed_char_struct
+
+{-| __C declaration:__ @explicit_signed_char_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 209:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "explicit_signed_char_member" Explicit_signed_char_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_char_struct {explicit_signed_char_member = y1}
+      , BG.getField @"explicit_signed_char_member" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "explicit_signed_char_member" (BG.Ptr Explicit_signed_char_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_char_member")
+
+instance HasCField.HasCField Explicit_signed_char_struct "explicit_signed_char_member" where
+
+  type CFieldType Explicit_signed_char_struct "explicit_signed_char_member" =
+    BG.CSChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_char_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 210:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_char_struct = Unsigned_char_struct
+  { unsigned_char_member :: BG.CUChar
+    {- ^ __C declaration:__ @unsigned_char_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 210:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_char_struct where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Unsigned_char_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_char_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_char_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_char_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_char_struct unsigned_char_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_char_member") ptr0 unsigned_char_member2
+
+deriving via Marshal.EquivStorable Unsigned_char_struct instance BG.Storable Unsigned_char_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_char_struct instance Struct.IsStruct Unsigned_char_struct
+
+{-| __C declaration:__ @unsigned_char_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 210:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CUChar
+         ) => BG.CompatHasField.HasField "unsigned_char_member" Unsigned_char_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_char_struct {unsigned_char_member = y1}
+      , BG.getField @"unsigned_char_member" x0
+      )
+
+instance ( ty ~ BG.CUChar
+         ) => BG.HasField "unsigned_char_member" (BG.Ptr Unsigned_char_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_char_member")
+
+instance HasCField.HasCField Unsigned_char_struct "unsigned_char_member" where
+
+  type CFieldType Unsigned_char_struct "unsigned_char_member" =
+    BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_short_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 212:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_short_struct = Ordinary_signed_short_struct
+  { ordinary_signed_short_member :: BG.CShort
+    {- ^ __C declaration:__ @ordinary_signed_short_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 212:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_short_struct where
+
+  staticSizeOf = \_ -> (2 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_short_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_short_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_short_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_short_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_short_struct ordinary_signed_short_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_short_member") ptr0 ordinary_signed_short_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_short_struct instance BG.Storable Ordinary_signed_short_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_short_struct instance Struct.IsStruct Ordinary_signed_short_struct
+
+{-| __C declaration:__ @ordinary_signed_short_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 212:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "ordinary_signed_short_member" Ordinary_signed_short_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_short_struct {ordinary_signed_short_member = y1}
+      , BG.getField @"ordinary_signed_short_member" x0
+      )
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "ordinary_signed_short_member" (BG.Ptr Ordinary_signed_short_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_short_member")
+
+instance HasCField.HasCField Ordinary_signed_short_struct "ordinary_signed_short_member" where
+
+  type CFieldType Ordinary_signed_short_struct "ordinary_signed_short_member" =
+    BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_short_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 213:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_short_struct = Explicit_signed_short_struct
+  { explicit_signed_short_member :: BG.CShort
+    {- ^ __C declaration:__ @explicit_signed_short_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 213:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_short_struct where
+
+  staticSizeOf = \_ -> (2 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_short_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_short_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_short_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_short_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_short_struct explicit_signed_short_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_short_member") ptr0 explicit_signed_short_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_short_struct instance BG.Storable Explicit_signed_short_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_short_struct instance Struct.IsStruct Explicit_signed_short_struct
+
+{-| __C declaration:__ @explicit_signed_short_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 213:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "explicit_signed_short_member" Explicit_signed_short_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_short_struct {explicit_signed_short_member = y1}
+      , BG.getField @"explicit_signed_short_member" x0
+      )
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "explicit_signed_short_member" (BG.Ptr Explicit_signed_short_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_short_member")
+
+instance HasCField.HasCField Explicit_signed_short_struct "explicit_signed_short_member" where
+
+  type CFieldType Explicit_signed_short_struct "explicit_signed_short_member" =
+    BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_short_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 214:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_short_struct = Unsigned_short_struct
+  { unsigned_short_member :: BG.CUShort
+    {- ^ __C declaration:__ @unsigned_short_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 214:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_short_struct where
+
+  staticSizeOf = \_ -> (2 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Unsigned_short_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_short_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_short_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_short_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_short_struct unsigned_short_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_short_member") ptr0 unsigned_short_member2
+
+deriving via Marshal.EquivStorable Unsigned_short_struct instance BG.Storable Unsigned_short_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_short_struct instance Struct.IsStruct Unsigned_short_struct
+
+{-| __C declaration:__ @unsigned_short_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 214:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CUShort
+         ) => BG.CompatHasField.HasField "unsigned_short_member" Unsigned_short_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_short_struct {unsigned_short_member = y1}
+      , BG.getField @"unsigned_short_member" x0
+      )
+
+instance ( ty ~ BG.CUShort
+         ) => BG.HasField "unsigned_short_member" (BG.Ptr Unsigned_short_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_short_member")
+
+instance HasCField.HasCField Unsigned_short_struct "unsigned_short_member" where
+
+  type CFieldType Unsigned_short_struct "unsigned_short_member" =
+    BG.CUShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_int_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 216:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_int_struct = Ordinary_signed_int_struct
+  { ordinary_signed_int_member :: BG.CInt
+    {- ^ __C declaration:__ @ordinary_signed_int_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 216:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_int_struct where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_int_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_int_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_int_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_int_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_int_struct ordinary_signed_int_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_int_member") ptr0 ordinary_signed_int_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_int_struct instance BG.Storable Ordinary_signed_int_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_int_struct instance Struct.IsStruct Ordinary_signed_int_struct
+
+{-| __C declaration:__ @ordinary_signed_int_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 216:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "ordinary_signed_int_member" Ordinary_signed_int_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_int_struct {ordinary_signed_int_member = y1}
+      , BG.getField @"ordinary_signed_int_member" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "ordinary_signed_int_member" (BG.Ptr Ordinary_signed_int_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_int_member")
+
+instance HasCField.HasCField Ordinary_signed_int_struct "ordinary_signed_int_member" where
+
+  type CFieldType Ordinary_signed_int_struct "ordinary_signed_int_member" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_int_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 217:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_int_struct = Explicit_signed_int_struct
+  { explicit_signed_int_member :: BG.CInt
+    {- ^ __C declaration:__ @explicit_signed_int_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 217:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_int_struct where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_int_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_int_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_int_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_int_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_int_struct explicit_signed_int_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_int_member") ptr0 explicit_signed_int_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_int_struct instance BG.Storable Explicit_signed_int_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_int_struct instance Struct.IsStruct Explicit_signed_int_struct
+
+{-| __C declaration:__ @explicit_signed_int_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 217:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "explicit_signed_int_member" Explicit_signed_int_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_int_struct {explicit_signed_int_member = y1}
+      , BG.getField @"explicit_signed_int_member" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "explicit_signed_int_member" (BG.Ptr Explicit_signed_int_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_int_member")
+
+instance HasCField.HasCField Explicit_signed_int_struct "explicit_signed_int_member" where
+
+  type CFieldType Explicit_signed_int_struct "explicit_signed_int_member" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_int_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 218:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_int_struct = Unsigned_int_struct
+  { unsigned_int_member :: BG.CUInt
+    {- ^ __C declaration:__ @unsigned_int_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 218:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_int_struct where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Unsigned_int_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_int_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_int_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_int_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_int_struct unsigned_int_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_int_member") ptr0 unsigned_int_member2
+
+deriving via Marshal.EquivStorable Unsigned_int_struct instance BG.Storable Unsigned_int_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_int_struct instance Struct.IsStruct Unsigned_int_struct
+
+{-| __C declaration:__ @unsigned_int_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 218:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unsigned_int_member" Unsigned_int_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_int_struct {unsigned_int_member = y1}
+      , BG.getField @"unsigned_int_member" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unsigned_int_member" (BG.Ptr Unsigned_int_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_int_member")
+
+instance HasCField.HasCField Unsigned_int_struct "unsigned_int_member" where
+
+  type CFieldType Unsigned_int_struct "unsigned_int_member" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 220:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_struct = Ordinary_signed_long_struct
+  { ordinary_signed_long_member :: BG.CLong
+    {- ^ __C declaration:__ @ordinary_signed_long_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 220:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_long_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_long_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_long_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_long_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_long_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_long_struct ordinary_signed_long_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_long_member") ptr0 ordinary_signed_long_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_long_struct instance BG.Storable Ordinary_signed_long_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_long_struct instance Struct.IsStruct Ordinary_signed_long_struct
+
+{-| __C declaration:__ @ordinary_signed_long_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 220:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "ordinary_signed_long_member" Ordinary_signed_long_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_long_struct {ordinary_signed_long_member = y1}
+      , BG.getField @"ordinary_signed_long_member" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "ordinary_signed_long_member" (BG.Ptr Ordinary_signed_long_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_long_member")
+
+instance HasCField.HasCField Ordinary_signed_long_struct "ordinary_signed_long_member" where
+
+  type CFieldType Ordinary_signed_long_struct "ordinary_signed_long_member" =
+    BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 221:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_struct = Explicit_signed_long_struct
+  { explicit_signed_long_member :: BG.CLong
+    {- ^ __C declaration:__ @explicit_signed_long_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 221:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_long_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_long_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_long_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_long_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_long_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_long_struct explicit_signed_long_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_long_member") ptr0 explicit_signed_long_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_long_struct instance BG.Storable Explicit_signed_long_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_long_struct instance Struct.IsStruct Explicit_signed_long_struct
+
+{-| __C declaration:__ @explicit_signed_long_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 221:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "explicit_signed_long_member" Explicit_signed_long_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_long_struct {explicit_signed_long_member = y1}
+      , BG.getField @"explicit_signed_long_member" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "explicit_signed_long_member" (BG.Ptr Explicit_signed_long_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_long_member")
+
+instance HasCField.HasCField Explicit_signed_long_struct "explicit_signed_long_member" where
+
+  type CFieldType Explicit_signed_long_struct "explicit_signed_long_member" =
+    BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 222:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_struct = Unsigned_long_struct
+  { unsigned_long_member :: BG.CULong
+    {- ^ __C declaration:__ @unsigned_long_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 222:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_long_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_long_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_long_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_long_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_long_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_long_struct unsigned_long_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_long_member") ptr0 unsigned_long_member2
+
+deriving via Marshal.EquivStorable Unsigned_long_struct instance BG.Storable Unsigned_long_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_long_struct instance Struct.IsStruct Unsigned_long_struct
+
+{-| __C declaration:__ @unsigned_long_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 222:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CULong
+         ) => BG.CompatHasField.HasField "unsigned_long_member" Unsigned_long_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_long_struct {unsigned_long_member = y1}
+      , BG.getField @"unsigned_long_member" x0
+      )
+
+instance ( ty ~ BG.CULong
+         ) => BG.HasField "unsigned_long_member" (BG.Ptr Unsigned_long_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_long_member")
+
+instance HasCField.HasCField Unsigned_long_struct "unsigned_long_member" where
+
+  type CFieldType Unsigned_long_struct "unsigned_long_member" =
+    BG.CULong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_long_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 224:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_long_struct = Ordinary_signed_long_long_struct
+  { ordinary_signed_long_long_member :: BG.CLLong
+    {- ^ __C declaration:__ @ordinary_signed_long_long_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 224:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_long_long_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_long_long_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_long_long_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_long_long_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_long_long_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_long_long_struct ordinary_signed_long_long_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_long_long_member") ptr0 ordinary_signed_long_long_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_long_long_struct instance BG.Storable Ordinary_signed_long_long_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_long_long_struct instance Struct.IsStruct Ordinary_signed_long_long_struct
+
+{-| __C declaration:__ @ordinary_signed_long_long_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 224:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "ordinary_signed_long_long_member" Ordinary_signed_long_long_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_long_long_struct {ordinary_signed_long_long_member = y1}
+      , BG.getField @"ordinary_signed_long_long_member" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "ordinary_signed_long_long_member" (BG.Ptr Ordinary_signed_long_long_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_long_long_member")
+
+instance HasCField.HasCField Ordinary_signed_long_long_struct "ordinary_signed_long_long_member" where
+
+  type CFieldType Ordinary_signed_long_long_struct "ordinary_signed_long_long_member" =
+    BG.CLLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_long_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 225:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_long_struct = Explicit_signed_long_long_struct
+  { explicit_signed_long_long_member :: BG.CLLong
+    {- ^ __C declaration:__ @explicit_signed_long_long_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 225:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_long_long_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_long_long_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_long_long_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_long_long_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_long_long_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_long_long_struct explicit_signed_long_long_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_long_long_member") ptr0 explicit_signed_long_long_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_long_long_struct instance BG.Storable Explicit_signed_long_long_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_long_long_struct instance Struct.IsStruct Explicit_signed_long_long_struct
+
+{-| __C declaration:__ @explicit_signed_long_long_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 225:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "explicit_signed_long_long_member" Explicit_signed_long_long_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_long_long_struct {explicit_signed_long_long_member = y1}
+      , BG.getField @"explicit_signed_long_long_member" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "explicit_signed_long_long_member" (BG.Ptr Explicit_signed_long_long_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_long_long_member")
+
+instance HasCField.HasCField Explicit_signed_long_long_struct "explicit_signed_long_long_member" where
+
+  type CFieldType Explicit_signed_long_long_struct "explicit_signed_long_long_member" =
+    BG.CLLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_long_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 226:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_long_struct = Unsigned_long_long_struct
+  { unsigned_long_long_member :: BG.CULLong
+    {- ^ __C declaration:__ @unsigned_long_long_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 226:62@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_long_long_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_long_long_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_long_long_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_long_long_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_long_long_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_long_long_struct unsigned_long_long_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_long_long_member") ptr0 unsigned_long_long_member2
+
+deriving via Marshal.EquivStorable Unsigned_long_long_struct instance BG.Storable Unsigned_long_long_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_long_long_struct instance Struct.IsStruct Unsigned_long_long_struct
+
+{-| __C declaration:__ @unsigned_long_long_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 226:62@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CULLong
+         ) => BG.CompatHasField.HasField "unsigned_long_long_member" Unsigned_long_long_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_long_long_struct {unsigned_long_long_member = y1}
+      , BG.getField @"unsigned_long_long_member" x0
+      )
+
+instance ( ty ~ BG.CULLong
+         ) => BG.HasField "unsigned_long_long_member" (BG.Ptr Unsigned_long_long_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_long_long_member")
+
+instance HasCField.HasCField Unsigned_long_long_struct "unsigned_long_long_member" where
+
+  type CFieldType Unsigned_long_long_struct "unsigned_long_long_member" =
+    BG.CULLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| Structs: pointers
+
+    NOTE: @'Ordinary_signed_char_pointer_struct'@ is commented out in the original test suite, unclear why (no reason is given).
+
+    __C declaration:__ @struct ordinary_void_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 235:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_void_pointer_struct = Ordinary_void_pointer_struct
+  { ordinary_void_pointer_member :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @ordinary_void_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 235:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_void_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_void_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_void_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_void_pointer_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_void_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_void_pointer_struct ordinary_void_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_void_pointer_member") ptr0 ordinary_void_pointer_member2
+
+deriving via Marshal.EquivStorable Ordinary_void_pointer_struct instance BG.Storable Ordinary_void_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_void_pointer_struct instance Struct.IsStruct Ordinary_void_pointer_struct
+
+{-| __C declaration:__ @ordinary_void_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 235:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "ordinary_void_pointer_member" Ordinary_void_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_void_pointer_struct {ordinary_void_pointer_member = y1}
+      , BG.getField @"ordinary_void_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "ordinary_void_pointer_member" (BG.Ptr Ordinary_void_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_void_pointer_member")
+
+instance HasCField.HasCField Ordinary_void_pointer_struct "ordinary_void_pointer_member" where
+
+  type CFieldType Ordinary_void_pointer_struct "ordinary_void_pointer_member" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_float_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 237:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_float_pointer_struct = Ordinary_float_pointer_struct
+  { ordinary_float_pointer_member :: BG.Ptr BG.CFloat
+    {- ^ __C declaration:__ @ordinary_float_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 237:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_float_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_float_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_float_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_float_pointer_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_float_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_float_pointer_struct ordinary_float_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_float_pointer_member") ptr0 ordinary_float_pointer_member2
+
+deriving via Marshal.EquivStorable Ordinary_float_pointer_struct instance BG.Storable Ordinary_float_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_float_pointer_struct instance Struct.IsStruct Ordinary_float_pointer_struct
+
+{-| __C declaration:__ @ordinary_float_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 237:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CFloat
+         ) => BG.CompatHasField.HasField "ordinary_float_pointer_member" Ordinary_float_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_float_pointer_struct {ordinary_float_pointer_member = y1}
+      , BG.getField @"ordinary_float_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CFloat
+         ) => BG.HasField "ordinary_float_pointer_member" (BG.Ptr Ordinary_float_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_float_pointer_member")
+
+instance HasCField.HasCField Ordinary_float_pointer_struct "ordinary_float_pointer_member" where
+
+  type CFieldType Ordinary_float_pointer_struct "ordinary_float_pointer_member" =
+    BG.Ptr BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_double_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 238:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_double_pointer_struct = Ordinary_double_pointer_struct
+  { ordinary_double_pointer_member :: BG.Ptr BG.CDouble
+    {- ^ __C declaration:__ @ordinary_double_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 238:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_double_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_double_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_double_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_double_pointer_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_double_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_double_pointer_struct ordinary_double_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_double_pointer_member") ptr0 ordinary_double_pointer_member2
+
+deriving via Marshal.EquivStorable Ordinary_double_pointer_struct instance BG.Storable Ordinary_double_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_double_pointer_struct instance Struct.IsStruct Ordinary_double_pointer_struct
+
+{-| __C declaration:__ @ordinary_double_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 238:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CDouble
+         ) => BG.CompatHasField.HasField "ordinary_double_pointer_member" Ordinary_double_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_double_pointer_struct {ordinary_double_pointer_member = y1}
+      , BG.getField @"ordinary_double_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CDouble
+         ) => BG.HasField "ordinary_double_pointer_member" (BG.Ptr Ordinary_double_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_double_pointer_member")
+
+instance HasCField.HasCField Ordinary_double_pointer_struct "ordinary_double_pointer_member" where
+
+  type CFieldType Ordinary_double_pointer_struct "ordinary_double_pointer_member" =
+    BG.Ptr BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_char_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 241:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_char_pointer_struct = Ordinary_signed_char_pointer_struct
+  { ordinary_signed_char_pointer_member :: BG.Ptr BG.CChar
+    {- ^ __C declaration:__ @ordinary_signed_char_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 241:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_char_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_char_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_char_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_char_pointer_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_char_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_char_pointer_struct ordinary_signed_char_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_char_pointer_member") ptr0 ordinary_signed_char_pointer_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_char_pointer_struct instance BG.Storable Ordinary_signed_char_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_char_pointer_struct instance Struct.IsStruct Ordinary_signed_char_pointer_struct
+
+{-| __C declaration:__ @ordinary_signed_char_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 241:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.CompatHasField.HasField "ordinary_signed_char_pointer_member" Ordinary_signed_char_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_char_pointer_struct {ordinary_signed_char_pointer_member = y1}
+      , BG.getField @"ordinary_signed_char_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.HasField "ordinary_signed_char_pointer_member" (BG.Ptr Ordinary_signed_char_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_char_pointer_member")
+
+instance HasCField.HasCField Ordinary_signed_char_pointer_struct "ordinary_signed_char_pointer_member" where
+
+  type CFieldType Ordinary_signed_char_pointer_struct "ordinary_signed_char_pointer_member" =
+    BG.Ptr BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_char_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 242:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_char_pointer_struct = Explicit_signed_char_pointer_struct
+  { explicit_signed_char_pointer_member :: BG.Ptr BG.CSChar
+    {- ^ __C declaration:__ @explicit_signed_char_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 242:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_char_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_char_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_char_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_char_pointer_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_char_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_char_pointer_struct explicit_signed_char_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_char_pointer_member") ptr0 explicit_signed_char_pointer_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_char_pointer_struct instance BG.Storable Explicit_signed_char_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_char_pointer_struct instance Struct.IsStruct Explicit_signed_char_pointer_struct
+
+{-| __C declaration:__ @explicit_signed_char_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 242:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CSChar
+         ) => BG.CompatHasField.HasField "explicit_signed_char_pointer_member" Explicit_signed_char_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_char_pointer_struct {explicit_signed_char_pointer_member = y1}
+      , BG.getField @"explicit_signed_char_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CSChar
+         ) => BG.HasField "explicit_signed_char_pointer_member" (BG.Ptr Explicit_signed_char_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_char_pointer_member")
+
+instance HasCField.HasCField Explicit_signed_char_pointer_struct "explicit_signed_char_pointer_member" where
+
+  type CFieldType Explicit_signed_char_pointer_struct "explicit_signed_char_pointer_member" =
+    BG.Ptr BG.CSChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_char_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 243:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_char_pointer_struct = Unsigned_char_pointer_struct
+  { unsigned_char_pointer_member :: BG.Ptr BG.CUChar
+    {- ^ __C declaration:__ @unsigned_char_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 243:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_char_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_char_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_char_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_char_pointer_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_char_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_char_pointer_struct unsigned_char_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_char_pointer_member") ptr0 unsigned_char_pointer_member2
+
+deriving via Marshal.EquivStorable Unsigned_char_pointer_struct instance BG.Storable Unsigned_char_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_char_pointer_struct instance Struct.IsStruct Unsigned_char_pointer_struct
+
+{-| __C declaration:__ @unsigned_char_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 243:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CUChar
+         ) => BG.CompatHasField.HasField "unsigned_char_pointer_member" Unsigned_char_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_char_pointer_struct {unsigned_char_pointer_member = y1}
+      , BG.getField @"unsigned_char_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CUChar
+         ) => BG.HasField "unsigned_char_pointer_member" (BG.Ptr Unsigned_char_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_char_pointer_member")
+
+instance HasCField.HasCField Unsigned_char_pointer_struct "unsigned_char_pointer_member" where
+
+  type CFieldType Unsigned_char_pointer_struct "unsigned_char_pointer_member" =
+    BG.Ptr BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_short_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 245:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_short_pointer_struct = Ordinary_signed_short_pointer_struct
+  { ordinary_signed_short_pointer_member :: BG.Ptr BG.CShort
+    {- ^ __C declaration:__ @ordinary_signed_short_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 245:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_short_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_short_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_short_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_short_pointer_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_short_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_short_pointer_struct ordinary_signed_short_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_short_pointer_member") ptr0 ordinary_signed_short_pointer_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_short_pointer_struct instance BG.Storable Ordinary_signed_short_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_short_pointer_struct instance Struct.IsStruct Ordinary_signed_short_pointer_struct
+
+{-| __C declaration:__ @ordinary_signed_short_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 245:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CShort
+         ) => BG.CompatHasField.HasField "ordinary_signed_short_pointer_member" Ordinary_signed_short_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_short_pointer_struct {ordinary_signed_short_pointer_member = y1}
+      , BG.getField @"ordinary_signed_short_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CShort
+         ) => BG.HasField "ordinary_signed_short_pointer_member" (BG.Ptr Ordinary_signed_short_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_short_pointer_member")
+
+instance HasCField.HasCField Ordinary_signed_short_pointer_struct "ordinary_signed_short_pointer_member" where
+
+  type CFieldType Ordinary_signed_short_pointer_struct "ordinary_signed_short_pointer_member" =
+    BG.Ptr BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_short_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 246:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_short_pointer_struct = Explicit_signed_short_pointer_struct
+  { explicit_signed_short_pointer_member :: BG.Ptr BG.CShort
+    {- ^ __C declaration:__ @explicit_signed_short_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 246:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_short_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_short_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_short_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_short_pointer_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_short_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_short_pointer_struct explicit_signed_short_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_short_pointer_member") ptr0 explicit_signed_short_pointer_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_short_pointer_struct instance BG.Storable Explicit_signed_short_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_short_pointer_struct instance Struct.IsStruct Explicit_signed_short_pointer_struct
+
+{-| __C declaration:__ @explicit_signed_short_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 246:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CShort
+         ) => BG.CompatHasField.HasField "explicit_signed_short_pointer_member" Explicit_signed_short_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_short_pointer_struct {explicit_signed_short_pointer_member = y1}
+      , BG.getField @"explicit_signed_short_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CShort
+         ) => BG.HasField "explicit_signed_short_pointer_member" (BG.Ptr Explicit_signed_short_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_short_pointer_member")
+
+instance HasCField.HasCField Explicit_signed_short_pointer_struct "explicit_signed_short_pointer_member" where
+
+  type CFieldType Explicit_signed_short_pointer_struct "explicit_signed_short_pointer_member" =
+    BG.Ptr BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_short_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 247:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_short_pointer_struct = Unsigned_short_pointer_struct
+  { unsigned_short_pointer_member :: BG.Ptr BG.CUShort
+    {- ^ __C declaration:__ @unsigned_short_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 247:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_short_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_short_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_short_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_short_pointer_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_short_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_short_pointer_struct unsigned_short_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_short_pointer_member") ptr0 unsigned_short_pointer_member2
+
+deriving via Marshal.EquivStorable Unsigned_short_pointer_struct instance BG.Storable Unsigned_short_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_short_pointer_struct instance Struct.IsStruct Unsigned_short_pointer_struct
+
+{-| __C declaration:__ @unsigned_short_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 247:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CUShort
+         ) => BG.CompatHasField.HasField "unsigned_short_pointer_member" Unsigned_short_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_short_pointer_struct {unsigned_short_pointer_member = y1}
+      , BG.getField @"unsigned_short_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CUShort
+         ) => BG.HasField "unsigned_short_pointer_member" (BG.Ptr Unsigned_short_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_short_pointer_member")
+
+instance HasCField.HasCField Unsigned_short_pointer_struct "unsigned_short_pointer_member" where
+
+  type CFieldType Unsigned_short_pointer_struct "unsigned_short_pointer_member" =
+    BG.Ptr BG.CUShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_int_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 249:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_int_pointer_struct = Ordinary_signed_int_pointer_struct
+  { ordinary_signed_int_pointer_member :: BG.Ptr BG.CInt
+    {- ^ __C declaration:__ @ordinary_signed_int_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 249:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_int_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_int_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_int_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_int_pointer_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_int_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_int_pointer_struct ordinary_signed_int_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_int_pointer_member") ptr0 ordinary_signed_int_pointer_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_int_pointer_struct instance BG.Storable Ordinary_signed_int_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_int_pointer_struct instance Struct.IsStruct Ordinary_signed_int_pointer_struct
+
+{-| __C declaration:__ @ordinary_signed_int_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 249:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "ordinary_signed_int_pointer_member" Ordinary_signed_int_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_int_pointer_struct {ordinary_signed_int_pointer_member = y1}
+      , BG.getField @"ordinary_signed_int_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "ordinary_signed_int_pointer_member" (BG.Ptr Ordinary_signed_int_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_int_pointer_member")
+
+instance HasCField.HasCField Ordinary_signed_int_pointer_struct "ordinary_signed_int_pointer_member" where
+
+  type CFieldType Ordinary_signed_int_pointer_struct "ordinary_signed_int_pointer_member" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_int_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 250:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_int_pointer_struct = Explicit_signed_int_pointer_struct
+  { explicit_signed_int_pointer_member :: BG.Ptr BG.CInt
+    {- ^ __C declaration:__ @explicit_signed_int_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 250:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_int_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_int_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_int_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_int_pointer_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_int_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_int_pointer_struct explicit_signed_int_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_int_pointer_member") ptr0 explicit_signed_int_pointer_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_int_pointer_struct instance BG.Storable Explicit_signed_int_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_int_pointer_struct instance Struct.IsStruct Explicit_signed_int_pointer_struct
+
+{-| __C declaration:__ @explicit_signed_int_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 250:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "explicit_signed_int_pointer_member" Explicit_signed_int_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_int_pointer_struct {explicit_signed_int_pointer_member = y1}
+      , BG.getField @"explicit_signed_int_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "explicit_signed_int_pointer_member" (BG.Ptr Explicit_signed_int_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_int_pointer_member")
+
+instance HasCField.HasCField Explicit_signed_int_pointer_struct "explicit_signed_int_pointer_member" where
+
+  type CFieldType Explicit_signed_int_pointer_struct "explicit_signed_int_pointer_member" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_int_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 251:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_int_pointer_struct = Unsigned_int_pointer_struct
+  { unsigned_int_pointer_member :: BG.Ptr BG.CUInt
+    {- ^ __C declaration:__ @unsigned_int_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 251:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_int_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_int_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_int_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_int_pointer_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_int_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_int_pointer_struct unsigned_int_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_int_pointer_member") ptr0 unsigned_int_pointer_member2
+
+deriving via Marshal.EquivStorable Unsigned_int_pointer_struct instance BG.Storable Unsigned_int_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_int_pointer_struct instance Struct.IsStruct Unsigned_int_pointer_struct
+
+{-| __C declaration:__ @unsigned_int_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 251:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CUInt
+         ) => BG.CompatHasField.HasField "unsigned_int_pointer_member" Unsigned_int_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_int_pointer_struct {unsigned_int_pointer_member = y1}
+      , BG.getField @"unsigned_int_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CUInt
+         ) => BG.HasField "unsigned_int_pointer_member" (BG.Ptr Unsigned_int_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_int_pointer_member")
+
+instance HasCField.HasCField Unsigned_int_pointer_struct "unsigned_int_pointer_member" where
+
+  type CFieldType Unsigned_int_pointer_struct "unsigned_int_pointer_member" =
+    BG.Ptr BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 253:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_pointer_struct = Ordinary_signed_long_pointer_struct
+  { ordinary_signed_long_pointer_member :: BG.Ptr BG.CLong
+    {- ^ __C declaration:__ @ordinary_signed_long_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 253:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_long_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_long_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_long_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_long_pointer_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_long_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_long_pointer_struct ordinary_signed_long_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_long_pointer_member") ptr0 ordinary_signed_long_pointer_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_long_pointer_struct instance BG.Storable Ordinary_signed_long_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_long_pointer_struct instance Struct.IsStruct Ordinary_signed_long_pointer_struct
+
+{-| __C declaration:__ @ordinary_signed_long_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 253:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CLong
+         ) => BG.CompatHasField.HasField "ordinary_signed_long_pointer_member" Ordinary_signed_long_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_long_pointer_struct {ordinary_signed_long_pointer_member = y1}
+      , BG.getField @"ordinary_signed_long_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CLong
+         ) => BG.HasField "ordinary_signed_long_pointer_member" (BG.Ptr Ordinary_signed_long_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_long_pointer_member")
+
+instance HasCField.HasCField Ordinary_signed_long_pointer_struct "ordinary_signed_long_pointer_member" where
+
+  type CFieldType Ordinary_signed_long_pointer_struct "ordinary_signed_long_pointer_member" =
+    BG.Ptr BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 254:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_pointer_struct = Explicit_signed_long_pointer_struct
+  { explicit_signed_long_pointer_member :: BG.Ptr BG.CLong
+    {- ^ __C declaration:__ @explicit_signed_long_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 254:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_long_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_long_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_long_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_long_pointer_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_long_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_long_pointer_struct explicit_signed_long_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_long_pointer_member") ptr0 explicit_signed_long_pointer_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_long_pointer_struct instance BG.Storable Explicit_signed_long_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_long_pointer_struct instance Struct.IsStruct Explicit_signed_long_pointer_struct
+
+{-| __C declaration:__ @explicit_signed_long_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 254:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CLong
+         ) => BG.CompatHasField.HasField "explicit_signed_long_pointer_member" Explicit_signed_long_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_long_pointer_struct {explicit_signed_long_pointer_member = y1}
+      , BG.getField @"explicit_signed_long_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CLong
+         ) => BG.HasField "explicit_signed_long_pointer_member" (BG.Ptr Explicit_signed_long_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_long_pointer_member")
+
+instance HasCField.HasCField Explicit_signed_long_pointer_struct "explicit_signed_long_pointer_member" where
+
+  type CFieldType Explicit_signed_long_pointer_struct "explicit_signed_long_pointer_member" =
+    BG.Ptr BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 255:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_pointer_struct = Unsigned_long_pointer_struct
+  { unsigned_long_pointer_member :: BG.Ptr BG.CULong
+    {- ^ __C declaration:__ @unsigned_long_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 255:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_long_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_long_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_long_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_long_pointer_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_long_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_long_pointer_struct unsigned_long_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_long_pointer_member") ptr0 unsigned_long_pointer_member2
+
+deriving via Marshal.EquivStorable Unsigned_long_pointer_struct instance BG.Storable Unsigned_long_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_long_pointer_struct instance Struct.IsStruct Unsigned_long_pointer_struct
+
+{-| __C declaration:__ @unsigned_long_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 255:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CULong
+         ) => BG.CompatHasField.HasField "unsigned_long_pointer_member" Unsigned_long_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_long_pointer_struct {unsigned_long_pointer_member = y1}
+      , BG.getField @"unsigned_long_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CULong
+         ) => BG.HasField "unsigned_long_pointer_member" (BG.Ptr Unsigned_long_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_long_pointer_member")
+
+instance HasCField.HasCField Unsigned_long_pointer_struct "unsigned_long_pointer_member" where
+
+  type CFieldType Unsigned_long_pointer_struct "unsigned_long_pointer_member" =
+    BG.Ptr BG.CULong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_long_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 257:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_long_pointer_struct = Ordinary_signed_long_long_pointer_struct
+  { ordinary_signed_long_long_pointer_member :: BG.Ptr BG.CLLong
+    {- ^ __C declaration:__ @ordinary_signed_long_long_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 257:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_long_long_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_long_long_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_long_long_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_long_long_pointer_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_long_long_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_long_long_pointer_struct
+            ordinary_signed_long_long_pointer_member2 ->
+              HasCField.writeRaw (BG.Proxy @"ordinary_signed_long_long_pointer_member") ptr0 ordinary_signed_long_long_pointer_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_long_long_pointer_struct instance BG.Storable Ordinary_signed_long_long_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_long_long_pointer_struct instance Struct.IsStruct Ordinary_signed_long_long_pointer_struct
+
+{-| __C declaration:__ @ordinary_signed_long_long_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 257:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CLLong
+         ) => BG.CompatHasField.HasField "ordinary_signed_long_long_pointer_member" Ordinary_signed_long_long_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_long_long_pointer_struct {ordinary_signed_long_long_pointer_member = y1}
+      , BG.getField @"ordinary_signed_long_long_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CLLong
+         ) => BG.HasField "ordinary_signed_long_long_pointer_member" (BG.Ptr Ordinary_signed_long_long_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_long_long_pointer_member")
+
+instance HasCField.HasCField Ordinary_signed_long_long_pointer_struct "ordinary_signed_long_long_pointer_member" where
+
+  type CFieldType Ordinary_signed_long_long_pointer_struct "ordinary_signed_long_long_pointer_member" =
+    BG.Ptr BG.CLLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_long_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 258:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_long_pointer_struct = Explicit_signed_long_long_pointer_struct
+  { explicit_signed_long_long_pointer_member :: BG.Ptr BG.CLLong
+    {- ^ __C declaration:__ @explicit_signed_long_long_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 258:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_long_long_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_long_long_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_long_long_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_long_long_pointer_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_long_long_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_long_long_pointer_struct
+            explicit_signed_long_long_pointer_member2 ->
+              HasCField.writeRaw (BG.Proxy @"explicit_signed_long_long_pointer_member") ptr0 explicit_signed_long_long_pointer_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_long_long_pointer_struct instance BG.Storable Explicit_signed_long_long_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_long_long_pointer_struct instance Struct.IsStruct Explicit_signed_long_long_pointer_struct
+
+{-| __C declaration:__ @explicit_signed_long_long_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 258:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CLLong
+         ) => BG.CompatHasField.HasField "explicit_signed_long_long_pointer_member" Explicit_signed_long_long_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_long_long_pointer_struct {explicit_signed_long_long_pointer_member = y1}
+      , BG.getField @"explicit_signed_long_long_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CLLong
+         ) => BG.HasField "explicit_signed_long_long_pointer_member" (BG.Ptr Explicit_signed_long_long_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_long_long_pointer_member")
+
+instance HasCField.HasCField Explicit_signed_long_long_pointer_struct "explicit_signed_long_long_pointer_member" where
+
+  type CFieldType Explicit_signed_long_long_pointer_struct "explicit_signed_long_long_pointer_member" =
+    BG.Ptr BG.CLLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_long_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 259:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_long_pointer_struct = Unsigned_long_long_pointer_struct
+  { unsigned_long_long_pointer_member :: BG.Ptr BG.CULLong
+    {- ^ __C declaration:__ @unsigned_long_long_pointer_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 259:71@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_long_long_pointer_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_long_long_pointer_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_long_long_pointer_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_long_long_pointer_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_long_long_pointer_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_long_long_pointer_struct unsigned_long_long_pointer_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_long_long_pointer_member") ptr0 unsigned_long_long_pointer_member2
+
+deriving via Marshal.EquivStorable Unsigned_long_long_pointer_struct instance BG.Storable Unsigned_long_long_pointer_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_long_long_pointer_struct instance Struct.IsStruct Unsigned_long_long_pointer_struct
+
+{-| __C declaration:__ @unsigned_long_long_pointer_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 259:71@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.Ptr BG.CULLong
+         ) => BG.CompatHasField.HasField "unsigned_long_long_pointer_member" Unsigned_long_long_pointer_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_long_long_pointer_struct {unsigned_long_long_pointer_member = y1}
+      , BG.getField @"unsigned_long_long_pointer_member" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CULLong
+         ) => BG.HasField "unsigned_long_long_pointer_member" (BG.Ptr Unsigned_long_long_pointer_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_long_long_pointer_member")
+
+instance HasCField.HasCField Unsigned_long_long_pointer_struct "unsigned_long_long_pointer_member" where
+
+  type CFieldType Unsigned_long_long_pointer_struct "unsigned_long_long_pointer_member" =
+    BG.Ptr BG.CULLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| Structs: arrays
+
+    __C declaration:__ @struct ordinary_float_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 265:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_float_array_struct = Ordinary_float_array_struct
+  { ordinary_float_array_member :: CA.ConstantArray 10 BG.CFloat
+    {- ^ __C declaration:__ @ordinary_float_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 265:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_float_array_struct where
+
+  staticSizeOf = \_ -> (40 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Ordinary_float_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_float_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_float_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_float_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_float_array_struct ordinary_float_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_float_array_member") ptr0 ordinary_float_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_float_array_struct instance BG.Storable Ordinary_float_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_float_array_struct instance Struct.IsStruct Ordinary_float_array_struct
+
+{-| __C declaration:__ @ordinary_float_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 265:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CFloat
+         ) => BG.CompatHasField.HasField "ordinary_float_array_member" Ordinary_float_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_float_array_struct {ordinary_float_array_member = y1}
+      , BG.getField @"ordinary_float_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CFloat
+         ) => BG.HasField "ordinary_float_array_member" (BG.Ptr Ordinary_float_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_float_array_member")
+
+instance HasCField.HasCField Ordinary_float_array_struct "ordinary_float_array_member" where
+
+  type CFieldType Ordinary_float_array_struct "ordinary_float_array_member" =
+    CA.ConstantArray 10 BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_double_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 266:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_double_array_struct = Ordinary_double_array_struct
+  { ordinary_double_array_member :: CA.ConstantArray 10 BG.CDouble
+    {- ^ __C declaration:__ @ordinary_double_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 266:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_double_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_double_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_double_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_double_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_double_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_double_array_struct ordinary_double_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_double_array_member") ptr0 ordinary_double_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_double_array_struct instance BG.Storable Ordinary_double_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_double_array_struct instance Struct.IsStruct Ordinary_double_array_struct
+
+{-| __C declaration:__ @ordinary_double_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 266:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CDouble
+         ) => BG.CompatHasField.HasField "ordinary_double_array_member" Ordinary_double_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_double_array_struct {ordinary_double_array_member = y1}
+      , BG.getField @"ordinary_double_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CDouble
+         ) => BG.HasField "ordinary_double_array_member" (BG.Ptr Ordinary_double_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_double_array_member")
+
+instance HasCField.HasCField Ordinary_double_array_struct "ordinary_double_array_member" where
+
+  type CFieldType Ordinary_double_array_struct "ordinary_double_array_member" =
+    CA.ConstantArray 10 BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_char_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 269:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_char_array_struct = Ordinary_signed_char_array_struct
+  { ordinary_signed_char_array_member :: CA.ConstantArray 10 BG.CChar
+    {- ^ __C declaration:__ @ordinary_signed_char_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 269:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_char_array_struct where
+
+  staticSizeOf = \_ -> (10 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_char_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_char_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_char_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_char_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_char_array_struct ordinary_signed_char_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_char_array_member") ptr0 ordinary_signed_char_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_char_array_struct instance BG.Storable Ordinary_signed_char_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_char_array_struct instance Struct.IsStruct Ordinary_signed_char_array_struct
+
+{-| __C declaration:__ @ordinary_signed_char_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 269:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CChar
+         ) => BG.CompatHasField.HasField "ordinary_signed_char_array_member" Ordinary_signed_char_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_char_array_struct {ordinary_signed_char_array_member = y1}
+      , BG.getField @"ordinary_signed_char_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CChar
+         ) => BG.HasField "ordinary_signed_char_array_member" (BG.Ptr Ordinary_signed_char_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_char_array_member")
+
+instance HasCField.HasCField Ordinary_signed_char_array_struct "ordinary_signed_char_array_member" where
+
+  type CFieldType Ordinary_signed_char_array_struct "ordinary_signed_char_array_member" =
+    CA.ConstantArray 10 BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_char_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 270:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_char_array_struct = Explicit_signed_char_array_struct
+  { explicit_signed_char_array_member :: CA.ConstantArray 10 BG.CSChar
+    {- ^ __C declaration:__ @explicit_signed_char_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 270:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_char_array_struct where
+
+  staticSizeOf = \_ -> (10 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_char_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_char_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_char_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_char_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_char_array_struct explicit_signed_char_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_char_array_member") ptr0 explicit_signed_char_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_char_array_struct instance BG.Storable Explicit_signed_char_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_char_array_struct instance Struct.IsStruct Explicit_signed_char_array_struct
+
+{-| __C declaration:__ @explicit_signed_char_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 270:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CSChar
+         ) => BG.CompatHasField.HasField "explicit_signed_char_array_member" Explicit_signed_char_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_char_array_struct {explicit_signed_char_array_member = y1}
+      , BG.getField @"explicit_signed_char_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CSChar
+         ) => BG.HasField "explicit_signed_char_array_member" (BG.Ptr Explicit_signed_char_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_char_array_member")
+
+instance HasCField.HasCField Explicit_signed_char_array_struct "explicit_signed_char_array_member" where
+
+  type CFieldType Explicit_signed_char_array_struct "explicit_signed_char_array_member" =
+    CA.ConstantArray 10 BG.CSChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_char_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 271:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_char_array_struct = Unsigned_char_array_struct
+  { unsigned_char_array_member :: CA.ConstantArray 10 BG.CUChar
+    {- ^ __C declaration:__ @unsigned_char_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 271:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_char_array_struct where
+
+  staticSizeOf = \_ -> (10 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Unsigned_char_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_char_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_char_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_char_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_char_array_struct unsigned_char_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_char_array_member") ptr0 unsigned_char_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_char_array_struct instance BG.Storable Unsigned_char_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_char_array_struct instance Struct.IsStruct Unsigned_char_array_struct
+
+{-| __C declaration:__ @unsigned_char_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 271:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CUChar
+         ) => BG.CompatHasField.HasField "unsigned_char_array_member" Unsigned_char_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_char_array_struct {unsigned_char_array_member = y1}
+      , BG.getField @"unsigned_char_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CUChar
+         ) => BG.HasField "unsigned_char_array_member" (BG.Ptr Unsigned_char_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_char_array_member")
+
+instance HasCField.HasCField Unsigned_char_array_struct "unsigned_char_array_member" where
+
+  type CFieldType Unsigned_char_array_struct "unsigned_char_array_member" =
+    CA.ConstantArray 10 BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_short_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 273:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_short_array_struct = Ordinary_signed_short_array_struct
+  { ordinary_signed_short_array_member :: CA.ConstantArray 10 BG.CShort
+    {- ^ __C declaration:__ @ordinary_signed_short_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 273:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_short_array_struct where
+
+  staticSizeOf = \_ -> (20 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_short_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_short_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_short_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_short_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_short_array_struct ordinary_signed_short_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_short_array_member") ptr0 ordinary_signed_short_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_short_array_struct instance BG.Storable Ordinary_signed_short_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_short_array_struct instance Struct.IsStruct Ordinary_signed_short_array_struct
+
+{-| __C declaration:__ @ordinary_signed_short_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 273:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CShort
+         ) => BG.CompatHasField.HasField "ordinary_signed_short_array_member" Ordinary_signed_short_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_short_array_struct {ordinary_signed_short_array_member = y1}
+      , BG.getField @"ordinary_signed_short_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CShort
+         ) => BG.HasField "ordinary_signed_short_array_member" (BG.Ptr Ordinary_signed_short_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_short_array_member")
+
+instance HasCField.HasCField Ordinary_signed_short_array_struct "ordinary_signed_short_array_member" where
+
+  type CFieldType Ordinary_signed_short_array_struct "ordinary_signed_short_array_member" =
+    CA.ConstantArray 10 BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_short_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 274:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_short_array_struct = Explicit_signed_short_array_struct
+  { explicit_signed_short_array_member :: CA.ConstantArray 10 BG.CShort
+    {- ^ __C declaration:__ @explicit_signed_short_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 274:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_short_array_struct where
+
+  staticSizeOf = \_ -> (20 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_short_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_short_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_short_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_short_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_short_array_struct explicit_signed_short_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_short_array_member") ptr0 explicit_signed_short_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_short_array_struct instance BG.Storable Explicit_signed_short_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_short_array_struct instance Struct.IsStruct Explicit_signed_short_array_struct
+
+{-| __C declaration:__ @explicit_signed_short_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 274:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CShort
+         ) => BG.CompatHasField.HasField "explicit_signed_short_array_member" Explicit_signed_short_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_short_array_struct {explicit_signed_short_array_member = y1}
+      , BG.getField @"explicit_signed_short_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CShort
+         ) => BG.HasField "explicit_signed_short_array_member" (BG.Ptr Explicit_signed_short_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_short_array_member")
+
+instance HasCField.HasCField Explicit_signed_short_array_struct "explicit_signed_short_array_member" where
+
+  type CFieldType Explicit_signed_short_array_struct "explicit_signed_short_array_member" =
+    CA.ConstantArray 10 BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_short_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 275:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_short_array_struct = Unsigned_short_array_struct
+  { unsigned_short_array_member :: CA.ConstantArray 10 BG.CUShort
+    {- ^ __C declaration:__ @unsigned_short_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 275:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_short_array_struct where
+
+  staticSizeOf = \_ -> (20 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Unsigned_short_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_short_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_short_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_short_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_short_array_struct unsigned_short_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_short_array_member") ptr0 unsigned_short_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_short_array_struct instance BG.Storable Unsigned_short_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_short_array_struct instance Struct.IsStruct Unsigned_short_array_struct
+
+{-| __C declaration:__ @unsigned_short_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 275:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CUShort
+         ) => BG.CompatHasField.HasField "unsigned_short_array_member" Unsigned_short_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_short_array_struct {unsigned_short_array_member = y1}
+      , BG.getField @"unsigned_short_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CUShort
+         ) => BG.HasField "unsigned_short_array_member" (BG.Ptr Unsigned_short_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_short_array_member")
+
+instance HasCField.HasCField Unsigned_short_array_struct "unsigned_short_array_member" where
+
+  type CFieldType Unsigned_short_array_struct "unsigned_short_array_member" =
+    CA.ConstantArray 10 BG.CUShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_int_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 277:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_int_array_struct = Ordinary_signed_int_array_struct
+  { ordinary_signed_int_array_member :: CA.ConstantArray 10 BG.CInt
+    {- ^ __C declaration:__ @ordinary_signed_int_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 277:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_int_array_struct where
+
+  staticSizeOf = \_ -> (40 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_int_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_int_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_int_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_int_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_int_array_struct ordinary_signed_int_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_int_array_member") ptr0 ordinary_signed_int_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_int_array_struct instance BG.Storable Ordinary_signed_int_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_int_array_struct instance Struct.IsStruct Ordinary_signed_int_array_struct
+
+{-| __C declaration:__ @ordinary_signed_int_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 277:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CInt
+         ) => BG.CompatHasField.HasField "ordinary_signed_int_array_member" Ordinary_signed_int_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_int_array_struct {ordinary_signed_int_array_member = y1}
+      , BG.getField @"ordinary_signed_int_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CInt
+         ) => BG.HasField "ordinary_signed_int_array_member" (BG.Ptr Ordinary_signed_int_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_int_array_member")
+
+instance HasCField.HasCField Ordinary_signed_int_array_struct "ordinary_signed_int_array_member" where
+
+  type CFieldType Ordinary_signed_int_array_struct "ordinary_signed_int_array_member" =
+    CA.ConstantArray 10 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_int_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 278:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_int_array_struct = Explicit_signed_int_array_struct
+  { explicit_signed_int_array_member :: CA.ConstantArray 10 BG.CInt
+    {- ^ __C declaration:__ @explicit_signed_int_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 278:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_int_array_struct where
+
+  staticSizeOf = \_ -> (40 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_int_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_int_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_int_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_int_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_int_array_struct explicit_signed_int_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_int_array_member") ptr0 explicit_signed_int_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_int_array_struct instance BG.Storable Explicit_signed_int_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_int_array_struct instance Struct.IsStruct Explicit_signed_int_array_struct
+
+{-| __C declaration:__ @explicit_signed_int_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 278:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CInt
+         ) => BG.CompatHasField.HasField "explicit_signed_int_array_member" Explicit_signed_int_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_int_array_struct {explicit_signed_int_array_member = y1}
+      , BG.getField @"explicit_signed_int_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CInt
+         ) => BG.HasField "explicit_signed_int_array_member" (BG.Ptr Explicit_signed_int_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_int_array_member")
+
+instance HasCField.HasCField Explicit_signed_int_array_struct "explicit_signed_int_array_member" where
+
+  type CFieldType Explicit_signed_int_array_struct "explicit_signed_int_array_member" =
+    CA.ConstantArray 10 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_int_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 279:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_int_array_struct = Unsigned_int_array_struct
+  { unsigned_int_array_member :: CA.ConstantArray 10 BG.CUInt
+    {- ^ __C declaration:__ @unsigned_int_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 279:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_int_array_struct where
+
+  staticSizeOf = \_ -> (40 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Unsigned_int_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_int_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_int_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_int_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_int_array_struct unsigned_int_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_int_array_member") ptr0 unsigned_int_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_int_array_struct instance BG.Storable Unsigned_int_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_int_array_struct instance Struct.IsStruct Unsigned_int_array_struct
+
+{-| __C declaration:__ @unsigned_int_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 279:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CUInt
+         ) => BG.CompatHasField.HasField "unsigned_int_array_member" Unsigned_int_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_int_array_struct {unsigned_int_array_member = y1}
+      , BG.getField @"unsigned_int_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CUInt
+         ) => BG.HasField "unsigned_int_array_member" (BG.Ptr Unsigned_int_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_int_array_member")
+
+instance HasCField.HasCField Unsigned_int_array_struct "unsigned_int_array_member" where
+
+  type CFieldType Unsigned_int_array_struct "unsigned_int_array_member" =
+    CA.ConstantArray 10 BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 281:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_array_struct = Ordinary_signed_long_array_struct
+  { ordinary_signed_long_array_member :: CA.ConstantArray 10 BG.CLong
+    {- ^ __C declaration:__ @ordinary_signed_long_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 281:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_long_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_long_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_long_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_long_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_long_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_long_array_struct ordinary_signed_long_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_signed_long_array_member") ptr0 ordinary_signed_long_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_long_array_struct instance BG.Storable Ordinary_signed_long_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_long_array_struct instance Struct.IsStruct Ordinary_signed_long_array_struct
+
+{-| __C declaration:__ @ordinary_signed_long_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 281:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CLong
+         ) => BG.CompatHasField.HasField "ordinary_signed_long_array_member" Ordinary_signed_long_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_long_array_struct {ordinary_signed_long_array_member = y1}
+      , BG.getField @"ordinary_signed_long_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CLong
+         ) => BG.HasField "ordinary_signed_long_array_member" (BG.Ptr Ordinary_signed_long_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_long_array_member")
+
+instance HasCField.HasCField Ordinary_signed_long_array_struct "ordinary_signed_long_array_member" where
+
+  type CFieldType Ordinary_signed_long_array_struct "ordinary_signed_long_array_member" =
+    CA.ConstantArray 10 BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 282:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_array_struct = Explicit_signed_long_array_struct
+  { explicit_signed_long_array_member :: CA.ConstantArray 10 BG.CLong
+    {- ^ __C declaration:__ @explicit_signed_long_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 282:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_long_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_long_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_long_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_long_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_long_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_long_array_struct explicit_signed_long_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"explicit_signed_long_array_member") ptr0 explicit_signed_long_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_long_array_struct instance BG.Storable Explicit_signed_long_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_long_array_struct instance Struct.IsStruct Explicit_signed_long_array_struct
+
+{-| __C declaration:__ @explicit_signed_long_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 282:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CLong
+         ) => BG.CompatHasField.HasField "explicit_signed_long_array_member" Explicit_signed_long_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_long_array_struct {explicit_signed_long_array_member = y1}
+      , BG.getField @"explicit_signed_long_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CLong
+         ) => BG.HasField "explicit_signed_long_array_member" (BG.Ptr Explicit_signed_long_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_long_array_member")
+
+instance HasCField.HasCField Explicit_signed_long_array_struct "explicit_signed_long_array_member" where
+
+  type CFieldType Explicit_signed_long_array_struct "explicit_signed_long_array_member" =
+    CA.ConstantArray 10 BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 283:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_array_struct = Unsigned_long_array_struct
+  { unsigned_long_array_member :: CA.ConstantArray 10 BG.CULong
+    {- ^ __C declaration:__ @unsigned_long_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 283:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_long_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_long_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_long_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_long_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_long_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_long_array_struct unsigned_long_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_long_array_member") ptr0 unsigned_long_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_long_array_struct instance BG.Storable Unsigned_long_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_long_array_struct instance Struct.IsStruct Unsigned_long_array_struct
+
+{-| __C declaration:__ @unsigned_long_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 283:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CULong
+         ) => BG.CompatHasField.HasField "unsigned_long_array_member" Unsigned_long_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_long_array_struct {unsigned_long_array_member = y1}
+      , BG.getField @"unsigned_long_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CULong
+         ) => BG.HasField "unsigned_long_array_member" (BG.Ptr Unsigned_long_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_long_array_member")
+
+instance HasCField.HasCField Unsigned_long_array_struct "unsigned_long_array_member" where
+
+  type CFieldType Unsigned_long_array_struct "unsigned_long_array_member" =
+    CA.ConstantArray 10 BG.CULong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_long_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 285:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_long_array_struct = Ordinary_signed_long_long_array_struct
+  { ordinary_signed_long_long_array_member :: CA.ConstantArray 10 BG.CLLong
+    {- ^ __C declaration:__ @ordinary_signed_long_long_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 285:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_long_long_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_long_long_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_long_long_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_long_long_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_long_long_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_long_long_array_struct
+            ordinary_signed_long_long_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"ordinary_signed_long_long_array_member") ptr0 ordinary_signed_long_long_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_long_long_array_struct instance BG.Storable Ordinary_signed_long_long_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_long_long_array_struct instance Struct.IsStruct Ordinary_signed_long_long_array_struct
+
+{-| __C declaration:__ @ordinary_signed_long_long_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 285:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CLLong
+         ) => BG.CompatHasField.HasField "ordinary_signed_long_long_array_member" Ordinary_signed_long_long_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_long_long_array_struct {ordinary_signed_long_long_array_member = y1}
+      , BG.getField @"ordinary_signed_long_long_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CLLong
+         ) => BG.HasField "ordinary_signed_long_long_array_member" (BG.Ptr Ordinary_signed_long_long_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_long_long_array_member")
+
+instance HasCField.HasCField Ordinary_signed_long_long_array_struct "ordinary_signed_long_long_array_member" where
+
+  type CFieldType Ordinary_signed_long_long_array_struct "ordinary_signed_long_long_array_member" =
+    CA.ConstantArray 10 BG.CLLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_long_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 286:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_long_array_struct = Explicit_signed_long_long_array_struct
+  { explicit_signed_long_long_array_member :: CA.ConstantArray 10 BG.CLLong
+    {- ^ __C declaration:__ @explicit_signed_long_long_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 286:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_long_long_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_long_long_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_long_long_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_long_long_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_long_long_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_long_long_array_struct
+            explicit_signed_long_long_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"explicit_signed_long_long_array_member") ptr0 explicit_signed_long_long_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_long_long_array_struct instance BG.Storable Explicit_signed_long_long_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_long_long_array_struct instance Struct.IsStruct Explicit_signed_long_long_array_struct
+
+{-| __C declaration:__ @explicit_signed_long_long_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 286:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CLLong
+         ) => BG.CompatHasField.HasField "explicit_signed_long_long_array_member" Explicit_signed_long_long_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_long_long_array_struct {explicit_signed_long_long_array_member = y1}
+      , BG.getField @"explicit_signed_long_long_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CLLong
+         ) => BG.HasField "explicit_signed_long_long_array_member" (BG.Ptr Explicit_signed_long_long_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_long_long_array_member")
+
+instance HasCField.HasCField Explicit_signed_long_long_array_struct "explicit_signed_long_long_array_member" where
+
+  type CFieldType Explicit_signed_long_long_array_struct "explicit_signed_long_long_array_member" =
+    CA.ConstantArray 10 BG.CLLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_long_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 287:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_long_array_struct = Unsigned_long_long_array_struct
+  { unsigned_long_long_array_member :: CA.ConstantArray 10 BG.CULLong
+    {- ^ __C declaration:__ @unsigned_long_long_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 287:68@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_long_long_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_long_long_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_long_long_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_long_long_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_long_long_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_long_long_array_struct unsigned_long_long_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_long_long_array_member") ptr0 unsigned_long_long_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_long_long_array_struct instance BG.Storable Unsigned_long_long_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_long_long_array_struct instance Struct.IsStruct Unsigned_long_long_array_struct
+
+{-| __C declaration:__ @unsigned_long_long_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 287:68@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 BG.CULLong
+         ) => BG.CompatHasField.HasField "unsigned_long_long_array_member" Unsigned_long_long_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_long_long_array_struct {unsigned_long_long_array_member = y1}
+      , BG.getField @"unsigned_long_long_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 BG.CULLong
+         ) => BG.HasField "unsigned_long_long_array_member" (BG.Ptr Unsigned_long_long_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_long_long_array_member")
+
+instance HasCField.HasCField Unsigned_long_long_array_struct "unsigned_long_long_array_member" where
+
+  type CFieldType Unsigned_long_long_array_struct "unsigned_long_long_array_member" =
+    CA.ConstantArray 10 BG.CULLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| Structs: arrays of pointers
+
+    NOTE: Here too @'Ordinary_signed_char_pointer_array_struct'@ was commented out in the original test suite, with no reason given.
+
+    __C declaration:__ @struct ordinary_void_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 296:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_void_pointer_array_struct = Ordinary_void_pointer_array_struct
+  { ordinary_void_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.Void)
+    {- ^ __C declaration:__ @ordinary_void_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 296:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_void_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_void_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_void_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_void_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_void_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_void_pointer_array_struct ordinary_void_pointer_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_void_pointer_array_member") ptr0 ordinary_void_pointer_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_void_pointer_array_struct instance BG.Storable Ordinary_void_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_void_pointer_array_struct instance Struct.IsStruct Ordinary_void_pointer_array_struct
+
+{-| __C declaration:__ @ordinary_void_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 296:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.Void)
+         ) => BG.CompatHasField.HasField "ordinary_void_pointer_array_member" Ordinary_void_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_void_pointer_array_struct {ordinary_void_pointer_array_member = y1}
+      , BG.getField @"ordinary_void_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.Void)
+         ) => BG.HasField "ordinary_void_pointer_array_member" (BG.Ptr Ordinary_void_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_void_pointer_array_member")
+
+instance HasCField.HasCField Ordinary_void_pointer_array_struct "ordinary_void_pointer_array_member" where
+
+  type CFieldType Ordinary_void_pointer_array_struct "ordinary_void_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.Void)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_float_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 298:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_float_pointer_array_struct = Ordinary_float_pointer_array_struct
+  { ordinary_float_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CFloat)
+    {- ^ __C declaration:__ @ordinary_float_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 298:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_float_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_float_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_float_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_float_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_float_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_float_pointer_array_struct ordinary_float_pointer_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_float_pointer_array_member") ptr0 ordinary_float_pointer_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_float_pointer_array_struct instance BG.Storable Ordinary_float_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_float_pointer_array_struct instance Struct.IsStruct Ordinary_float_pointer_array_struct
+
+{-| __C declaration:__ @ordinary_float_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 298:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CFloat)
+         ) => BG.CompatHasField.HasField "ordinary_float_pointer_array_member" Ordinary_float_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_float_pointer_array_struct {ordinary_float_pointer_array_member = y1}
+      , BG.getField @"ordinary_float_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CFloat)
+         ) => BG.HasField "ordinary_float_pointer_array_member" (BG.Ptr Ordinary_float_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_float_pointer_array_member")
+
+instance HasCField.HasCField Ordinary_float_pointer_array_struct "ordinary_float_pointer_array_member" where
+
+  type CFieldType Ordinary_float_pointer_array_struct "ordinary_float_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CFloat)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_double_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 299:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_double_pointer_array_struct = Ordinary_double_pointer_array_struct
+  { ordinary_double_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CDouble)
+    {- ^ __C declaration:__ @ordinary_double_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 299:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_double_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_double_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_double_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_double_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_double_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_double_pointer_array_struct ordinary_double_pointer_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"ordinary_double_pointer_array_member") ptr0 ordinary_double_pointer_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_double_pointer_array_struct instance BG.Storable Ordinary_double_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_double_pointer_array_struct instance Struct.IsStruct Ordinary_double_pointer_array_struct
+
+{-| __C declaration:__ @ordinary_double_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 299:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CDouble)
+         ) => BG.CompatHasField.HasField "ordinary_double_pointer_array_member" Ordinary_double_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_double_pointer_array_struct {ordinary_double_pointer_array_member = y1}
+      , BG.getField @"ordinary_double_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CDouble)
+         ) => BG.HasField "ordinary_double_pointer_array_member" (BG.Ptr Ordinary_double_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_double_pointer_array_member")
+
+instance HasCField.HasCField Ordinary_double_pointer_array_struct "ordinary_double_pointer_array_member" where
+
+  type CFieldType Ordinary_double_pointer_array_struct "ordinary_double_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CDouble)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_char_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 302:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_char_pointer_array_struct = Ordinary_signed_char_pointer_array_struct
+  { ordinary_signed_char_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CChar)
+    {- ^ __C declaration:__ @ordinary_signed_char_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 302:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_char_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_char_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_char_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_char_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_char_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_char_pointer_array_struct
+            ordinary_signed_char_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"ordinary_signed_char_pointer_array_member") ptr0 ordinary_signed_char_pointer_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_char_pointer_array_struct instance BG.Storable Ordinary_signed_char_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_char_pointer_array_struct instance Struct.IsStruct Ordinary_signed_char_pointer_array_struct
+
+{-| __C declaration:__ @ordinary_signed_char_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 302:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CChar)
+         ) => BG.CompatHasField.HasField "ordinary_signed_char_pointer_array_member" Ordinary_signed_char_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_char_pointer_array_struct {ordinary_signed_char_pointer_array_member = y1}
+      , BG.getField @"ordinary_signed_char_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CChar)
+         ) => BG.HasField "ordinary_signed_char_pointer_array_member" (BG.Ptr Ordinary_signed_char_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_char_pointer_array_member")
+
+instance HasCField.HasCField Ordinary_signed_char_pointer_array_struct "ordinary_signed_char_pointer_array_member" where
+
+  type CFieldType Ordinary_signed_char_pointer_array_struct "ordinary_signed_char_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CChar)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_char_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 303:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_char_pointer_array_struct = Explicit_signed_char_pointer_array_struct
+  { explicit_signed_char_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CSChar)
+    {- ^ __C declaration:__ @explicit_signed_char_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 303:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_char_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_char_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_char_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_char_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_char_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_char_pointer_array_struct
+            explicit_signed_char_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"explicit_signed_char_pointer_array_member") ptr0 explicit_signed_char_pointer_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_char_pointer_array_struct instance BG.Storable Explicit_signed_char_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_char_pointer_array_struct instance Struct.IsStruct Explicit_signed_char_pointer_array_struct
+
+{-| __C declaration:__ @explicit_signed_char_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 303:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CSChar)
+         ) => BG.CompatHasField.HasField "explicit_signed_char_pointer_array_member" Explicit_signed_char_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_char_pointer_array_struct {explicit_signed_char_pointer_array_member = y1}
+      , BG.getField @"explicit_signed_char_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CSChar)
+         ) => BG.HasField "explicit_signed_char_pointer_array_member" (BG.Ptr Explicit_signed_char_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_char_pointer_array_member")
+
+instance HasCField.HasCField Explicit_signed_char_pointer_array_struct "explicit_signed_char_pointer_array_member" where
+
+  type CFieldType Explicit_signed_char_pointer_array_struct "explicit_signed_char_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CSChar)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_char_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 304:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_char_pointer_array_struct = Unsigned_char_pointer_array_struct
+  { unsigned_char_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CUChar)
+    {- ^ __C declaration:__ @unsigned_char_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 304:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_char_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_char_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_char_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_char_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_char_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_char_pointer_array_struct unsigned_char_pointer_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_char_pointer_array_member") ptr0 unsigned_char_pointer_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_char_pointer_array_struct instance BG.Storable Unsigned_char_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_char_pointer_array_struct instance Struct.IsStruct Unsigned_char_pointer_array_struct
+
+{-| __C declaration:__ @unsigned_char_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 304:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CUChar)
+         ) => BG.CompatHasField.HasField "unsigned_char_pointer_array_member" Unsigned_char_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_char_pointer_array_struct {unsigned_char_pointer_array_member = y1}
+      , BG.getField @"unsigned_char_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CUChar)
+         ) => BG.HasField "unsigned_char_pointer_array_member" (BG.Ptr Unsigned_char_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_char_pointer_array_member")
+
+instance HasCField.HasCField Unsigned_char_pointer_array_struct "unsigned_char_pointer_array_member" where
+
+  type CFieldType Unsigned_char_pointer_array_struct "unsigned_char_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CUChar)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_short_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 306:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_short_pointer_array_struct = Ordinary_signed_short_pointer_array_struct
+  { ordinary_signed_short_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CShort)
+    {- ^ __C declaration:__ @ordinary_signed_short_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 306:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_short_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_short_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_short_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_short_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_short_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_short_pointer_array_struct
+            ordinary_signed_short_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"ordinary_signed_short_pointer_array_member") ptr0 ordinary_signed_short_pointer_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_short_pointer_array_struct instance BG.Storable Ordinary_signed_short_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_short_pointer_array_struct instance Struct.IsStruct Ordinary_signed_short_pointer_array_struct
+
+{-| __C declaration:__ @ordinary_signed_short_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 306:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CShort)
+         ) => BG.CompatHasField.HasField "ordinary_signed_short_pointer_array_member" Ordinary_signed_short_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_short_pointer_array_struct {ordinary_signed_short_pointer_array_member = y1}
+      , BG.getField @"ordinary_signed_short_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CShort)
+         ) => BG.HasField "ordinary_signed_short_pointer_array_member" (BG.Ptr Ordinary_signed_short_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_short_pointer_array_member")
+
+instance HasCField.HasCField Ordinary_signed_short_pointer_array_struct "ordinary_signed_short_pointer_array_member" where
+
+  type CFieldType Ordinary_signed_short_pointer_array_struct "ordinary_signed_short_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CShort)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_short_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 307:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_short_pointer_array_struct = Explicit_signed_short_pointer_array_struct
+  { explicit_signed_short_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CShort)
+    {- ^ __C declaration:__ @explicit_signed_short_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 307:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_short_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_short_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_short_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_short_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_short_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_short_pointer_array_struct
+            explicit_signed_short_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"explicit_signed_short_pointer_array_member") ptr0 explicit_signed_short_pointer_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_short_pointer_array_struct instance BG.Storable Explicit_signed_short_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_short_pointer_array_struct instance Struct.IsStruct Explicit_signed_short_pointer_array_struct
+
+{-| __C declaration:__ @explicit_signed_short_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 307:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CShort)
+         ) => BG.CompatHasField.HasField "explicit_signed_short_pointer_array_member" Explicit_signed_short_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_short_pointer_array_struct {explicit_signed_short_pointer_array_member = y1}
+      , BG.getField @"explicit_signed_short_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CShort)
+         ) => BG.HasField "explicit_signed_short_pointer_array_member" (BG.Ptr Explicit_signed_short_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_short_pointer_array_member")
+
+instance HasCField.HasCField Explicit_signed_short_pointer_array_struct "explicit_signed_short_pointer_array_member" where
+
+  type CFieldType Explicit_signed_short_pointer_array_struct "explicit_signed_short_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CShort)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_short_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 308:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_short_pointer_array_struct = Unsigned_short_pointer_array_struct
+  { unsigned_short_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CUShort)
+    {- ^ __C declaration:__ @unsigned_short_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 308:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_short_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_short_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_short_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_short_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_short_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_short_pointer_array_struct unsigned_short_pointer_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_short_pointer_array_member") ptr0 unsigned_short_pointer_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_short_pointer_array_struct instance BG.Storable Unsigned_short_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_short_pointer_array_struct instance Struct.IsStruct Unsigned_short_pointer_array_struct
+
+{-| __C declaration:__ @unsigned_short_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 308:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CUShort)
+         ) => BG.CompatHasField.HasField "unsigned_short_pointer_array_member" Unsigned_short_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_short_pointer_array_struct {unsigned_short_pointer_array_member = y1}
+      , BG.getField @"unsigned_short_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CUShort)
+         ) => BG.HasField "unsigned_short_pointer_array_member" (BG.Ptr Unsigned_short_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_short_pointer_array_member")
+
+instance HasCField.HasCField Unsigned_short_pointer_array_struct "unsigned_short_pointer_array_member" where
+
+  type CFieldType Unsigned_short_pointer_array_struct "unsigned_short_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CUShort)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_int_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 310:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_int_pointer_array_struct = Ordinary_signed_int_pointer_array_struct
+  { ordinary_signed_int_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CInt)
+    {- ^ __C declaration:__ @ordinary_signed_int_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 310:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_int_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_int_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_int_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_int_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_int_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_int_pointer_array_struct
+            ordinary_signed_int_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"ordinary_signed_int_pointer_array_member") ptr0 ordinary_signed_int_pointer_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_int_pointer_array_struct instance BG.Storable Ordinary_signed_int_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_int_pointer_array_struct instance Struct.IsStruct Ordinary_signed_int_pointer_array_struct
+
+{-| __C declaration:__ @ordinary_signed_int_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 310:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "ordinary_signed_int_pointer_array_member" Ordinary_signed_int_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_int_pointer_array_struct {ordinary_signed_int_pointer_array_member = y1}
+      , BG.getField @"ordinary_signed_int_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CInt)
+         ) => BG.HasField "ordinary_signed_int_pointer_array_member" (BG.Ptr Ordinary_signed_int_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_int_pointer_array_member")
+
+instance HasCField.HasCField Ordinary_signed_int_pointer_array_struct "ordinary_signed_int_pointer_array_member" where
+
+  type CFieldType Ordinary_signed_int_pointer_array_struct "ordinary_signed_int_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_int_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 311:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_int_pointer_array_struct = Explicit_signed_int_pointer_array_struct
+  { explicit_signed_int_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CInt)
+    {- ^ __C declaration:__ @explicit_signed_int_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 311:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_int_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_int_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_int_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_int_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_int_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_int_pointer_array_struct
+            explicit_signed_int_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"explicit_signed_int_pointer_array_member") ptr0 explicit_signed_int_pointer_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_int_pointer_array_struct instance BG.Storable Explicit_signed_int_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_int_pointer_array_struct instance Struct.IsStruct Explicit_signed_int_pointer_array_struct
+
+{-| __C declaration:__ @explicit_signed_int_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 311:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "explicit_signed_int_pointer_array_member" Explicit_signed_int_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_int_pointer_array_struct {explicit_signed_int_pointer_array_member = y1}
+      , BG.getField @"explicit_signed_int_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CInt)
+         ) => BG.HasField "explicit_signed_int_pointer_array_member" (BG.Ptr Explicit_signed_int_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_int_pointer_array_member")
+
+instance HasCField.HasCField Explicit_signed_int_pointer_array_struct "explicit_signed_int_pointer_array_member" where
+
+  type CFieldType Explicit_signed_int_pointer_array_struct "explicit_signed_int_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_int_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 312:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_int_pointer_array_struct = Unsigned_int_pointer_array_struct
+  { unsigned_int_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CUInt)
+    {- ^ __C declaration:__ @unsigned_int_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 312:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_int_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_int_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_int_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_int_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_int_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_int_pointer_array_struct unsigned_int_pointer_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_int_pointer_array_member") ptr0 unsigned_int_pointer_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_int_pointer_array_struct instance BG.Storable Unsigned_int_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_int_pointer_array_struct instance Struct.IsStruct Unsigned_int_pointer_array_struct
+
+{-| __C declaration:__ @unsigned_int_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 312:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CUInt)
+         ) => BG.CompatHasField.HasField "unsigned_int_pointer_array_member" Unsigned_int_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_int_pointer_array_struct {unsigned_int_pointer_array_member = y1}
+      , BG.getField @"unsigned_int_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CUInt)
+         ) => BG.HasField "unsigned_int_pointer_array_member" (BG.Ptr Unsigned_int_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_int_pointer_array_member")
+
+instance HasCField.HasCField Unsigned_int_pointer_array_struct "unsigned_int_pointer_array_member" where
+
+  type CFieldType Unsigned_int_pointer_array_struct "unsigned_int_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CUInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 314:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_pointer_array_struct = Ordinary_signed_long_pointer_array_struct
+  { ordinary_signed_long_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CLong)
+    {- ^ __C declaration:__ @ordinary_signed_long_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 314:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_long_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_long_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_long_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_long_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_long_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_long_pointer_array_struct
+            ordinary_signed_long_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"ordinary_signed_long_pointer_array_member") ptr0 ordinary_signed_long_pointer_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_long_pointer_array_struct instance BG.Storable Ordinary_signed_long_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_long_pointer_array_struct instance Struct.IsStruct Ordinary_signed_long_pointer_array_struct
+
+{-| __C declaration:__ @ordinary_signed_long_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 314:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CLong)
+         ) => BG.CompatHasField.HasField "ordinary_signed_long_pointer_array_member" Ordinary_signed_long_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_long_pointer_array_struct {ordinary_signed_long_pointer_array_member = y1}
+      , BG.getField @"ordinary_signed_long_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CLong)
+         ) => BG.HasField "ordinary_signed_long_pointer_array_member" (BG.Ptr Ordinary_signed_long_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_long_pointer_array_member")
+
+instance HasCField.HasCField Ordinary_signed_long_pointer_array_struct "ordinary_signed_long_pointer_array_member" where
+
+  type CFieldType Ordinary_signed_long_pointer_array_struct "ordinary_signed_long_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CLong)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 315:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_pointer_array_struct = Explicit_signed_long_pointer_array_struct
+  { explicit_signed_long_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CLong)
+    {- ^ __C declaration:__ @explicit_signed_long_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 315:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_long_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_long_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_long_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_long_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_long_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_long_pointer_array_struct
+            explicit_signed_long_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"explicit_signed_long_pointer_array_member") ptr0 explicit_signed_long_pointer_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_long_pointer_array_struct instance BG.Storable Explicit_signed_long_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_long_pointer_array_struct instance Struct.IsStruct Explicit_signed_long_pointer_array_struct
+
+{-| __C declaration:__ @explicit_signed_long_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 315:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CLong)
+         ) => BG.CompatHasField.HasField "explicit_signed_long_pointer_array_member" Explicit_signed_long_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_long_pointer_array_struct {explicit_signed_long_pointer_array_member = y1}
+      , BG.getField @"explicit_signed_long_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CLong)
+         ) => BG.HasField "explicit_signed_long_pointer_array_member" (BG.Ptr Explicit_signed_long_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_long_pointer_array_member")
+
+instance HasCField.HasCField Explicit_signed_long_pointer_array_struct "explicit_signed_long_pointer_array_member" where
+
+  type CFieldType Explicit_signed_long_pointer_array_struct "explicit_signed_long_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CLong)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 316:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_pointer_array_struct = Unsigned_long_pointer_array_struct
+  { unsigned_long_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CULong)
+    {- ^ __C declaration:__ @unsigned_long_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 316:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_long_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_long_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_long_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_long_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_long_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_long_pointer_array_struct unsigned_long_pointer_array_member2 ->
+            HasCField.writeRaw (BG.Proxy @"unsigned_long_pointer_array_member") ptr0 unsigned_long_pointer_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_long_pointer_array_struct instance BG.Storable Unsigned_long_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_long_pointer_array_struct instance Struct.IsStruct Unsigned_long_pointer_array_struct
+
+{-| __C declaration:__ @unsigned_long_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 316:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CULong)
+         ) => BG.CompatHasField.HasField "unsigned_long_pointer_array_member" Unsigned_long_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_long_pointer_array_struct {unsigned_long_pointer_array_member = y1}
+      , BG.getField @"unsigned_long_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CULong)
+         ) => BG.HasField "unsigned_long_pointer_array_member" (BG.Ptr Unsigned_long_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_long_pointer_array_member")
+
+instance HasCField.HasCField Unsigned_long_pointer_array_struct "unsigned_long_pointer_array_member" where
+
+  type CFieldType Unsigned_long_pointer_array_struct "unsigned_long_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CULong)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ordinary_signed_long_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 318:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_long_pointer_array_struct = Ordinary_signed_long_long_pointer_array_struct
+  { ordinary_signed_long_long_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CLLong)
+    {- ^ __C declaration:__ @ordinary_signed_long_long_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 318:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ordinary_signed_long_long_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ordinary_signed_long_long_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordinary_signed_long_long_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"ordinary_signed_long_long_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Ordinary_signed_long_long_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordinary_signed_long_long_pointer_array_struct
+            ordinary_signed_long_long_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"ordinary_signed_long_long_pointer_array_member") ptr0 ordinary_signed_long_long_pointer_array_member2
+
+deriving via Marshal.EquivStorable Ordinary_signed_long_long_pointer_array_struct instance BG.Storable Ordinary_signed_long_long_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Ordinary_signed_long_long_pointer_array_struct instance Struct.IsStruct Ordinary_signed_long_long_pointer_array_struct
+
+{-| __C declaration:__ @ordinary_signed_long_long_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 318:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CLLong)
+         ) => BG.CompatHasField.HasField "ordinary_signed_long_long_pointer_array_member" Ordinary_signed_long_long_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ordinary_signed_long_long_pointer_array_struct {ordinary_signed_long_long_pointer_array_member = y1}
+      , BG.getField @"ordinary_signed_long_long_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CLLong)
+         ) => BG.HasField "ordinary_signed_long_long_pointer_array_member" (BG.Ptr Ordinary_signed_long_long_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ordinary_signed_long_long_pointer_array_member")
+
+instance HasCField.HasCField Ordinary_signed_long_long_pointer_array_struct "ordinary_signed_long_long_pointer_array_member" where
+
+  type CFieldType Ordinary_signed_long_long_pointer_array_struct "ordinary_signed_long_long_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CLLong)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct explicit_signed_long_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 319:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_long_pointer_array_struct = Explicit_signed_long_long_pointer_array_struct
+  { explicit_signed_long_long_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CLLong)
+    {- ^ __C declaration:__ @explicit_signed_long_long_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 319:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Explicit_signed_long_long_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Explicit_signed_long_long_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Explicit_signed_long_long_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"explicit_signed_long_long_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Explicit_signed_long_long_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Explicit_signed_long_long_pointer_array_struct
+            explicit_signed_long_long_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"explicit_signed_long_long_pointer_array_member") ptr0 explicit_signed_long_long_pointer_array_member2
+
+deriving via Marshal.EquivStorable Explicit_signed_long_long_pointer_array_struct instance BG.Storable Explicit_signed_long_long_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Explicit_signed_long_long_pointer_array_struct instance Struct.IsStruct Explicit_signed_long_long_pointer_array_struct
+
+{-| __C declaration:__ @explicit_signed_long_long_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 319:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CLLong)
+         ) => BG.CompatHasField.HasField "explicit_signed_long_long_pointer_array_member" Explicit_signed_long_long_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Explicit_signed_long_long_pointer_array_struct {explicit_signed_long_long_pointer_array_member = y1}
+      , BG.getField @"explicit_signed_long_long_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CLLong)
+         ) => BG.HasField "explicit_signed_long_long_pointer_array_member" (BG.Ptr Explicit_signed_long_long_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"explicit_signed_long_long_pointer_array_member")
+
+instance HasCField.HasCField Explicit_signed_long_long_pointer_array_struct "explicit_signed_long_long_pointer_array_member" where
+
+  type CFieldType Explicit_signed_long_long_pointer_array_struct "explicit_signed_long_long_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CLLong)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct unsigned_long_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 320:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_long_pointer_array_struct = Unsigned_long_long_pointer_array_struct
+  { unsigned_long_long_pointer_array_member :: CA.ConstantArray 10 (BG.Ptr BG.CULLong)
+    {- ^ __C declaration:__ @unsigned_long_long_pointer_array_member@
+
+         __defined at:__ @comprehensive\/c2hsc.h 320:77@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unsigned_long_long_pointer_array_struct where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Unsigned_long_long_pointer_array_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Unsigned_long_long_pointer_array_struct
+      <*> HasCField.readRaw (BG.Proxy @"unsigned_long_long_pointer_array_member") ptr0
+
+instance Marshal.WriteRaw Unsigned_long_long_pointer_array_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unsigned_long_long_pointer_array_struct
+            unsigned_long_long_pointer_array_member2 ->
+              HasCField.writeRaw (BG.Proxy @"unsigned_long_long_pointer_array_member") ptr0 unsigned_long_long_pointer_array_member2
+
+deriving via Marshal.EquivStorable Unsigned_long_long_pointer_array_struct instance BG.Storable Unsigned_long_long_pointer_array_struct
+
+deriving via Struct.IsStructViaReadRaw Unsigned_long_long_pointer_array_struct instance Struct.IsStruct Unsigned_long_long_pointer_array_struct
+
+{-| __C declaration:__ @unsigned_long_long_pointer_array_member@
+
+    __defined at:__ @comprehensive\/c2hsc.h 320:77@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CULLong)
+         ) => BG.CompatHasField.HasField "unsigned_long_long_pointer_array_member" Unsigned_long_long_pointer_array_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unsigned_long_long_pointer_array_struct {unsigned_long_long_pointer_array_member = y1}
+      , BG.getField @"unsigned_long_long_pointer_array_member" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 10 (BG.Ptr BG.CULLong)
+         ) => BG.HasField "unsigned_long_long_pointer_array_member" (BG.Ptr Unsigned_long_long_pointer_array_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unsigned_long_long_pointer_array_member")
+
+instance HasCField.HasCField Unsigned_long_long_pointer_array_struct "unsigned_long_long_pointer_array_member" where
+
+  type CFieldType Unsigned_long_long_pointer_array_struct "unsigned_long_long_pointer_array_member" =
+    CA.ConstantArray 10 (BG.Ptr BG.CULLong)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Sanity checks
+
+    NOTE: The @smoke.h@ test is moved to a separate header.
+
+    __C declaration:__ @an_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 329:13@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype An_int = An_int
+  { unwrap :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrap" An_int ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         An_int {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrap" (BG.Ptr An_int) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField An_int "unwrap" where
+
+  type CFieldType An_int "unwrap" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@cal_table_table@
+
+    __defined at:__ @comprehensive\/c2hsc.h 341:5@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Cal_table_table = Cal_table_table
+  { raw :: BG.CInt
+    {- ^ __C declaration:__ @raw@
+
+         __defined at:__ @comprehensive\/c2hsc.h 342:13@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  , val :: BG.CInt
+    {- ^ __C declaration:__ @val@
+
+         __defined at:__ @comprehensive\/c2hsc.h 342:22@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Cal_table_table where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Cal_table_table where
+
+  readRaw =
+    \ptr0 ->
+          pure Cal_table_table
+      <*> HasCField.readRaw (BG.Proxy @"raw") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"val") ptr0
+
+instance Marshal.WriteRaw Cal_table_table where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Cal_table_table raw2 val3 ->
+               HasCField.writeRaw (BG.Proxy @"raw") ptr0 raw2
+            >> HasCField.writeRaw (BG.Proxy @"val") ptr0 val3
+
+deriving via Marshal.EquivStorable Cal_table_table instance BG.Storable Cal_table_table
+
+deriving via Struct.IsStructViaReadRaw Cal_table_table instance Struct.IsStruct Cal_table_table
+
+{-| __C declaration:__ @raw@
+
+    __defined at:__ @comprehensive\/c2hsc.h 342:13@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "raw" Cal_table_table ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Cal_table_table {raw = y1, val = BG.getField @"val" x0}
+      , BG.getField @"raw" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "raw" (BG.Ptr Cal_table_table) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"raw")
+
+instance HasCField.HasCField Cal_table_table "raw" where
+
+  type CFieldType Cal_table_table "raw" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @val@
+
+    __defined at:__ @comprehensive\/c2hsc.h 342:22@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "val" Cal_table_table ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Cal_table_table {val = y1, raw = BG.getField @"raw" x0}
+      , BG.getField @"val" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "val" (BG.Ptr Cal_table_table) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"val")
+
+instance HasCField.HasCField Cal_table_table "val" where
+
+  type CFieldType Cal_table_table "val" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| Issues without test cases in the original test suite
+
+    These are examples from open issues on the c2hsc repository, that don't (yet) have corresponding test cases in the c2hsc test suite.
+
+    __C declaration:__ @struct cal_table@
+
+    __defined at:__ @comprehensive\/c2hsc.h 339:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Cal_table = Cal_table
+  { size :: BG.CInt
+    {- ^ __C declaration:__ @size@
+
+         __defined at:__ @comprehensive\/c2hsc.h 340:9@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  , table :: CA.ConstantArray 32 Cal_table_table
+    {- ^ __C declaration:__ @table@
+
+         __defined at:__ @comprehensive\/c2hsc.h 343:7@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Cal_table where
+
+  staticSizeOf = \_ -> (260 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Cal_table where
+
+  readRaw =
+    \ptr0 ->
+          pure Cal_table
+      <*> HasCField.readRaw (BG.Proxy @"size") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"table") ptr0
+
+instance Marshal.WriteRaw Cal_table where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Cal_table size2 table3 ->
+               HasCField.writeRaw (BG.Proxy @"size") ptr0 size2
+            >> HasCField.writeRaw (BG.Proxy @"table") ptr0 table3
+
+deriving via Marshal.EquivStorable Cal_table instance BG.Storable Cal_table
+
+deriving via Struct.IsStructViaReadRaw Cal_table instance Struct.IsStruct Cal_table
+
+{-| __C declaration:__ @size@
+
+    __defined at:__ @comprehensive\/c2hsc.h 340:9@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "size" Cal_table ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Cal_table {size = y1, table = BG.getField @"table" x0}
+      , BG.getField @"size" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "size" (BG.Ptr Cal_table) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"size")
+
+instance HasCField.HasCField Cal_table "size" where
+
+  type CFieldType Cal_table "size" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @table@
+
+    __defined at:__ @comprehensive\/c2hsc.h 343:7@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 32 Cal_table_table
+         ) => BG.CompatHasField.HasField "table" Cal_table ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Cal_table {table = y1, size = BG.getField @"size" x0}
+      , BG.getField @"table" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 32 Cal_table_table
+         ) => BG.HasField "table" (BG.Ptr Cal_table) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"table")
+
+instance HasCField.HasCField Cal_table "table" where
+
+  type CFieldType Cal_table "table" =
+    CA.ConstantArray 32 Cal_table_table
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union \@Elf32_External_Dyn_d_un@
+
+    __defined at:__ @comprehensive\/c2hsc.h 349:3@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Elf32_External_Dyn_d_un = Elf32_External_Dyn_d_un
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 1 instance Marshal.StaticSize Elf32_External_Dyn_d_un
+
+deriving via BG.SizedByteArray 4 1 instance Marshal.ReadRaw Elf32_External_Dyn_d_un
+
+deriving via BG.SizedByteArray 4 1 instance Marshal.WriteRaw Elf32_External_Dyn_d_un
+
+deriving via Marshal.EquivStorable Elf32_External_Dyn_d_un instance BG.Storable Elf32_External_Dyn_d_un
+
+deriving via BG.SizedByteArray 4 1 instance Union.IsUnion Elf32_External_Dyn_d_un
+
+{-| __C declaration:__ @d_val@
+
+    __defined at:__ @comprehensive\/c2hsc.h 350:19@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 BG.CUChar
+         ) => BG.HasField "d_val" Elf32_External_Dyn_d_un ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @d_val@
+
+    __defined at:__ @comprehensive\/c2hsc.h 350:19@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 BG.CUChar
+         ) => BG.CompatHasField.HasField "d_val" Elf32_External_Dyn_d_un ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"d_val" x0)
+
+instance ( ty ~ CA.ConstantArray 4 BG.CUChar
+         ) => BG.HasField "d_val" (BG.Ptr Elf32_External_Dyn_d_un) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"d_val")
+
+instance HasCField.HasCField Elf32_External_Dyn_d_un "d_val" where
+
+  type CFieldType Elf32_External_Dyn_d_un "d_val" =
+    CA.ConstantArray 4 BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @d_ptr@
+
+    __defined at:__ @comprehensive\/c2hsc.h 351:19@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 BG.CUChar
+         ) => BG.HasField "d_ptr" Elf32_External_Dyn_d_un ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @d_ptr@
+
+    __defined at:__ @comprehensive\/c2hsc.h 351:19@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 BG.CUChar
+         ) => BG.CompatHasField.HasField "d_ptr" Elf32_External_Dyn_d_un ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"d_ptr" x0)
+
+instance ( ty ~ CA.ConstantArray 4 BG.CUChar
+         ) => BG.HasField "d_ptr" (BG.Ptr Elf32_External_Dyn_d_un) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"d_ptr")
+
+instance HasCField.HasCField Elf32_External_Dyn_d_un "d_ptr" where
+
+  type CFieldType Elf32_External_Dyn_d_un "d_ptr" =
+    CA.ConstantArray 4 BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct Elf32_External_Dyn@
+
+    __defined at:__ @comprehensive\/c2hsc.h 347:9@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Elf32_External_Dyn = Elf32_External_Dyn
+  { d_tag :: CA.ConstantArray 4 BG.CUChar
+    {- ^ __C declaration:__ @d_tag@
+
+         __defined at:__ @comprehensive\/c2hsc.h 348:17@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  , d_un :: Elf32_External_Dyn_d_un
+    {- ^ __C declaration:__ @d_un@
+
+         __defined at:__ @comprehensive\/c2hsc.h 352:5@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize Elf32_External_Dyn where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Elf32_External_Dyn where
+
+  readRaw =
+    \ptr0 ->
+          pure Elf32_External_Dyn
+      <*> HasCField.readRaw (BG.Proxy @"d_tag") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"d_un") ptr0
+
+instance Marshal.WriteRaw Elf32_External_Dyn where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Elf32_External_Dyn d_tag2 d_un3 ->
+               HasCField.writeRaw (BG.Proxy @"d_tag") ptr0 d_tag2
+            >> HasCField.writeRaw (BG.Proxy @"d_un") ptr0 d_un3
+
+deriving via Marshal.EquivStorable Elf32_External_Dyn instance BG.Storable Elf32_External_Dyn
+
+deriving via Struct.IsStructViaReadRaw Elf32_External_Dyn instance Struct.IsStruct Elf32_External_Dyn
+
+{-| __C declaration:__ @d_tag@
+
+    __defined at:__ @comprehensive\/c2hsc.h 348:17@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 BG.CUChar
+         ) => BG.CompatHasField.HasField "d_tag" Elf32_External_Dyn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Elf32_External_Dyn {d_tag = y1, d_un = BG.getField @"d_un" x0}
+      , BG.getField @"d_tag" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 4 BG.CUChar
+         ) => BG.HasField "d_tag" (BG.Ptr Elf32_External_Dyn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"d_tag")
+
+instance HasCField.HasCField Elf32_External_Dyn "d_tag" where
+
+  type CFieldType Elf32_External_Dyn "d_tag" =
+    CA.ConstantArray 4 BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @d_un@
+
+    __defined at:__ @comprehensive\/c2hsc.h 352:5@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ Elf32_External_Dyn_d_un
+         ) => BG.CompatHasField.HasField "d_un" Elf32_External_Dyn ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Elf32_External_Dyn {d_un = y1, d_tag = BG.getField @"d_tag" x0}
+      , BG.getField @"d_un" x0
+      )
+
+instance ( ty ~ Elf32_External_Dyn_d_un
+         ) => BG.HasField "d_un" (BG.Ptr Elf32_External_Dyn) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"d_un")
+
+instance HasCField.HasCField Elf32_External_Dyn "d_un" where
+
+  type CFieldType Elf32_External_Dyn "d_un" =
+    Elf32_External_Dyn_d_un
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @bug_24@
+
+    __defined at:__ @comprehensive\/c2hsc.h 358:15@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Bug_24 = Bug_24
+  { unwrap :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrap" Bug_24 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bug_24 {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrap" (BG.Ptr Bug_24) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Bug_24 "unwrap" where
+
+  type CFieldType Bug_24 "unwrap" = BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bug_24_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 359:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Bug_24_2 = Bug_24_2
+  { unwrap :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrap" Bug_24_2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bug_24_2 {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrap" (BG.Ptr Bug_24_2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Bug_24_2 "unwrap" where
+
+  type CFieldType Bug_24_2 "unwrap" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @MyArray_27@
+
+    __defined at:__ @comprehensive\/c2hsc.h 364:13@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype MyArray_27 = MyArray_27
+  { unwrap :: CA.ConstantArray 20 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 20 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrap" MyArray_27 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyArray_27 {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ CA.ConstantArray 20 BG.CInt
+         ) => BG.HasField "unwrap" (BG.Ptr MyArray_27) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField MyArray_27 "unwrap" where
+
+  type CFieldType MyArray_27 "unwrap" =
+    CA.ConstantArray 20 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct MyStruct_27@
+
+    __defined at:__ @comprehensive\/c2hsc.h 365:9@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyStruct_27 = MyStruct_27
+  { x :: MyArray_27
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @comprehensive\/c2hsc.h 366:14@
+
+         __exported by:__ @comprehensive\/c2hsc.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize MyStruct_27 where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw MyStruct_27 where
+
+  readRaw =
+    \ptr0 ->
+          pure MyStruct_27
+      <*> HasCField.readRaw (BG.Proxy @"x") ptr0
+
+instance Marshal.WriteRaw MyStruct_27 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MyStruct_27 x2 ->
+            HasCField.writeRaw (BG.Proxy @"x") ptr0 x2
+
+deriving via Marshal.EquivStorable MyStruct_27 instance BG.Storable MyStruct_27
+
+deriving via Struct.IsStructViaReadRaw MyStruct_27 instance Struct.IsStruct MyStruct_27
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @comprehensive\/c2hsc.h 366:14@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+instance ( ty ~ MyArray_27
+         ) => BG.CompatHasField.HasField "x" MyStruct_27 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> MyStruct_27 {x = y1}, BG.getField @"x" x0)
+
+instance ( ty ~ MyArray_27
+         ) => BG.HasField "x" (BG.Ptr MyStruct_27) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField MyStruct_27 "x" where
+
+  type CFieldType MyStruct_27 "x" = MyArray_27
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/comprehensive/c2hsc/Example/FunPtr.hs b/test-artefacts/fixtures/comprehensive/c2hsc/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/c2hsc/Example/FunPtr.hs
@@ -0,0 +1,135 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo_function
+    , Example.FunPtr.foo_33_1
+    , Example.FunPtr.foo_33_2
+    , Example.FunPtr.foo_33_3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <comprehensive/c2hsc.h>"
+  , "/* test_comprehensivec2hsc_Example_get_foo_function */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_37f32218c55b498b (void)) ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo_function;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_foo_33_1 */"
+  , "__attribute__ ((const))"
+  , "unsigned int (*hs_bindgen_482f80da2191c5d6 (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &foo_33_1;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_foo_33_2 */"
+  , "__attribute__ ((const))"
+  , "unsigned int (*hs_bindgen_c50591bcbfea3260 (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &foo_33_2;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_foo_33_3 */"
+  , "__attribute__ ((const))"
+  , "signed long long (*hs_bindgen_26b60496f499680a (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &foo_33_3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_function@
+foreign import ccall unsafe "hs_bindgen_37f32218c55b498b" hs_bindgen_37f32218c55b498b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_function@
+hs_bindgen_37f32218c55b498b :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ()))
+hs_bindgen_37f32218c55b498b =
+  fmap BG.fromFFIType hs_bindgen_37f32218c55b498b_base
+
+{-# NOINLINE foo_function #-}
+{-| __C declaration:__ @foo_function@
+
+    __defined at:__ @comprehensive\/c2hsc.h 38:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_function :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO ())
+foo_function =
+  BG.unsafePerformIO hs_bindgen_37f32218c55b498b
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_1@
+foreign import ccall unsafe "hs_bindgen_482f80da2191c5d6" hs_bindgen_482f80da2191c5d6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_1@
+hs_bindgen_482f80da2191c5d6 :: IO (BG.FunPtr (BG.CUInt -> IO BG.CUInt))
+hs_bindgen_482f80da2191c5d6 =
+  fmap BG.fromFFIType hs_bindgen_482f80da2191c5d6_base
+
+{-# NOINLINE foo_33_1 #-}
+{-| __C declaration:__ @foo_33_1@
+
+    __defined at:__ @comprehensive\/c2hsc.h 73:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_1 :: BG.FunPtr (BG.CUInt -> IO BG.CUInt)
+foo_33_1 =
+  BG.unsafePerformIO hs_bindgen_482f80da2191c5d6
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_2@
+foreign import ccall unsafe "hs_bindgen_c50591bcbfea3260" hs_bindgen_c50591bcbfea3260_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_2@
+hs_bindgen_c50591bcbfea3260 :: IO (BG.FunPtr (BG.CUInt -> IO BG.CUInt))
+hs_bindgen_c50591bcbfea3260 =
+  fmap BG.fromFFIType hs_bindgen_c50591bcbfea3260_base
+
+{-# NOINLINE foo_33_2 #-}
+{-| __C declaration:__ @foo_33_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 74:51@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_2 :: BG.FunPtr (BG.CUInt -> IO BG.CUInt)
+foo_33_2 =
+  BG.unsafePerformIO hs_bindgen_c50591bcbfea3260
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_3@
+foreign import ccall unsafe "hs_bindgen_26b60496f499680a" hs_bindgen_26b60496f499680a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_3@
+hs_bindgen_26b60496f499680a :: IO (BG.FunPtr (BG.CLLong -> IO BG.CLLong))
+hs_bindgen_26b60496f499680a =
+  fmap BG.fromFFIType hs_bindgen_26b60496f499680a_base
+
+{-# NOINLINE foo_33_3 #-}
+{-| __C declaration:__ @foo_33_3@
+
+    __defined at:__ @comprehensive\/c2hsc.h 75:52@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_3 :: BG.FunPtr (BG.CLLong -> IO BG.CLLong)
+foo_33_3 =
+  BG.unsafePerformIO hs_bindgen_26b60496f499680a
diff --git a/test-artefacts/fixtures/comprehensive/c2hsc/Example/Global.hs b/test-artefacts/fixtures/comprehensive/c2hsc/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/c2hsc/Example/Global.hs
@@ -0,0 +1,1949 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.my_array
+    , Example.Global.ordinary_float
+    , Example.Global.ordinary_double
+    , Example.Global.ordinary_char
+    , Example.Global.signed_char
+    , Example.Global.unsigned_char
+    , Example.Global.ordinary_signed_short
+    , Example.Global.explicit_signed_short
+    , Example.Global.unsigned_short
+    , Example.Global.ordinary_signed_int
+    , Example.Global.explicit_signed_int
+    , Example.Global.unsigned_int
+    , Example.Global.ordinary_signed_long
+    , Example.Global.explicit_signed_long
+    , Example.Global.unsigned_long
+    , Example.Global.ordinary_signed_long_long
+    , Example.Global.explicit_signed_long_long
+    , Example.Global.unsigned_long_long
+    , Example.Global.ordinary_void_pointer
+    , Example.Global.ordinary_float_pointer
+    , Example.Global.ordinary_double_pointer
+    , Example.Global.ordinary_char_pointer
+    , Example.Global.signed_char_pointer
+    , Example.Global.unsigned_char_pointer
+    , Example.Global.ordinary_signed_short_pointer
+    , Example.Global.explicit_signed_short_pointer
+    , Example.Global.unsigned_short_pointer
+    , Example.Global.ordinary_signed_int_pointer
+    , Example.Global.explicit_signed_int_pointer
+    , Example.Global.unsigned_int_pointer
+    , Example.Global.ordinary_signed_long_pointer
+    , Example.Global.explicit_signed_long_pointer
+    , Example.Global.unsigned_long_pointer
+    , Example.Global.ordinary_signed_long_long_pointer
+    , Example.Global.explicit_signed_long_long_pointer
+    , Example.Global.unsigned_long_long_pointer
+    , Example.Global.ordinary_float_array
+    , Example.Global.ordinary_double_array
+    , Example.Global.ordinary_signed_char_array
+    , Example.Global.explicit_signed_char_array
+    , Example.Global.unsigned_char_array
+    , Example.Global.ordinary_signed_short_array
+    , Example.Global.explicit_signed_short_array
+    , Example.Global.unsigned_short_array
+    , Example.Global.ordinary_signed_int_array
+    , Example.Global.explicit_signed_int_array
+    , Example.Global.unsigned_int_array
+    , Example.Global.ordinary_signed_long_array
+    , Example.Global.explicit_signed_long_array
+    , Example.Global.unsigned_long_array
+    , Example.Global.ordinary_signed_long_long_array
+    , Example.Global.explicit_signed_long_long_array
+    , Example.Global.unsigned_long_long_array
+    , Example.Global.ordinary_void_pointer_array
+    , Example.Global.ordinary_float_pointer_array
+    , Example.Global.ordinary_double_pointer_array
+    , Example.Global.ordinary_signed_char_pointer_array
+    , Example.Global.explicit_signed_char_pointer_array
+    , Example.Global.unsigned_char_pointer_array
+    , Example.Global.ordinary_signed_short_pointer_array
+    , Example.Global.explicit_signed_short_pointer_array
+    , Example.Global.unsigned_short_pointer_array
+    , Example.Global.ordinary_signed_int_pointer_array
+    , Example.Global.explicit_signed_int_pointer_array
+    , Example.Global.unsigned_int_pointer_array
+    , Example.Global.ordinary_signed_long_pointer_array
+    , Example.Global.explicit_signed_long_pointer_array
+    , Example.Global.unsigned_long_pointer_array
+    , Example.Global.ordinary_signed_long_long_pointer_array
+    , Example.Global.explicit_signed_long_long_pointer_array
+    , Example.Global.unsigned_long_long_pointer_array
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <comprehensive/c2hsc.h>"
+  , "/* test_comprehensivec2hsc_Example_get_my_array */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_b2862a117942ba8c (void))[]) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &my_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_float */"
+  , "__attribute__ ((const))"
+  , "float *hs_bindgen_fbe24203b7174cce (void)"
+  , "{"
+  , "  return &ordinary_float;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_double */"
+  , "__attribute__ ((const))"
+  , "double *hs_bindgen_c996ca409147b439 (void)"
+  , "{"
+  , "  return &ordinary_double;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_char */"
+  , "__attribute__ ((const))"
+  , "char *hs_bindgen_b5c47cbce17ba18f (void)"
+  , "{"
+  , "  return &ordinary_char;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_signed_char */"
+  , "__attribute__ ((const))"
+  , "signed char *hs_bindgen_74214b0c0c8011ef (void)"
+  , "{"
+  , "  return &signed_char;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_char */"
+  , "__attribute__ ((const))"
+  , "unsigned char *hs_bindgen_074079404a90186b (void)"
+  , "{"
+  , "  return &unsigned_char;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_short */"
+  , "__attribute__ ((const))"
+  , "signed short *hs_bindgen_e432ab522350f84b (void)"
+  , "{"
+  , "  return &ordinary_signed_short;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_short */"
+  , "__attribute__ ((const))"
+  , "signed short *hs_bindgen_17fa3df7c6690161 (void)"
+  , "{"
+  , "  return &explicit_signed_short;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_short */"
+  , "__attribute__ ((const))"
+  , "unsigned short *hs_bindgen_20f280e98d58aacc (void)"
+  , "{"
+  , "  return &unsigned_short;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_int */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_78b4f07c60ef3ef7 (void)"
+  , "{"
+  , "  return &ordinary_signed_int;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_int */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_41643d3737e9213c (void)"
+  , "{"
+  , "  return &explicit_signed_int;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_int */"
+  , "__attribute__ ((const))"
+  , "unsigned int *hs_bindgen_6e686e175c956cb8 (void)"
+  , "{"
+  , "  return &unsigned_int;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_long */"
+  , "__attribute__ ((const))"
+  , "signed long *hs_bindgen_6a41c38f7fbb41d9 (void)"
+  , "{"
+  , "  return &ordinary_signed_long;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_long */"
+  , "__attribute__ ((const))"
+  , "signed long *hs_bindgen_a3b5191325da8230 (void)"
+  , "{"
+  , "  return &explicit_signed_long;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_long */"
+  , "__attribute__ ((const))"
+  , "unsigned long *hs_bindgen_df563b6d35ec4e8f (void)"
+  , "{"
+  , "  return &unsigned_long;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_long_long */"
+  , "__attribute__ ((const))"
+  , "signed long long *hs_bindgen_59c6159f8798505a (void)"
+  , "{"
+  , "  return &ordinary_signed_long_long;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_long_long */"
+  , "__attribute__ ((const))"
+  , "signed long long *hs_bindgen_bfd63280c68460d2 (void)"
+  , "{"
+  , "  return &explicit_signed_long_long;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_long_long */"
+  , "__attribute__ ((const))"
+  , "unsigned long long *hs_bindgen_8654be9a041c2116 (void)"
+  , "{"
+  , "  return &unsigned_long_long;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_void_pointer */"
+  , "__attribute__ ((const))"
+  , "void **hs_bindgen_d6cafaa0834895a2 (void)"
+  , "{"
+  , "  return &ordinary_void_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_float_pointer */"
+  , "__attribute__ ((const))"
+  , "float **hs_bindgen_35ef3ffa1a5167f7 (void)"
+  , "{"
+  , "  return &ordinary_float_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_double_pointer */"
+  , "__attribute__ ((const))"
+  , "double **hs_bindgen_5e831159f7556399 (void)"
+  , "{"
+  , "  return &ordinary_double_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_char_pointer */"
+  , "__attribute__ ((const))"
+  , "char **hs_bindgen_08236e44cabe67f4 (void)"
+  , "{"
+  , "  return &ordinary_char_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_signed_char_pointer */"
+  , "__attribute__ ((const))"
+  , "signed char **hs_bindgen_66d08eddc2fecb35 (void)"
+  , "{"
+  , "  return &signed_char_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_char_pointer */"
+  , "__attribute__ ((const))"
+  , "unsigned char **hs_bindgen_5c76c506cb4fd78e (void)"
+  , "{"
+  , "  return &unsigned_char_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer */"
+  , "__attribute__ ((const))"
+  , "signed short **hs_bindgen_cd114d033253fe37 (void)"
+  , "{"
+  , "  return &ordinary_signed_short_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer */"
+  , "__attribute__ ((const))"
+  , "signed short **hs_bindgen_49ffa4c56ce34e2f (void)"
+  , "{"
+  , "  return &explicit_signed_short_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_short_pointer */"
+  , "__attribute__ ((const))"
+  , "unsigned short **hs_bindgen_fb80ad6945c7151d (void)"
+  , "{"
+  , "  return &unsigned_short_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer */"
+  , "__attribute__ ((const))"
+  , "signed int **hs_bindgen_dfef04ad64871bf8 (void)"
+  , "{"
+  , "  return &ordinary_signed_int_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer */"
+  , "__attribute__ ((const))"
+  , "signed int **hs_bindgen_515d5232453c4285 (void)"
+  , "{"
+  , "  return &explicit_signed_int_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_int_pointer */"
+  , "__attribute__ ((const))"
+  , "unsigned int **hs_bindgen_9f2724dae8d3b3fa (void)"
+  , "{"
+  , "  return &unsigned_int_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer */"
+  , "__attribute__ ((const))"
+  , "signed long **hs_bindgen_a6b4a786a6644424 (void)"
+  , "{"
+  , "  return &ordinary_signed_long_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer */"
+  , "__attribute__ ((const))"
+  , "signed long **hs_bindgen_4df40729ac557753 (void)"
+  , "{"
+  , "  return &explicit_signed_long_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_long_pointer */"
+  , "__attribute__ ((const))"
+  , "unsigned long **hs_bindgen_30379268a6bf43b0 (void)"
+  , "{"
+  , "  return &unsigned_long_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer */"
+  , "__attribute__ ((const))"
+  , "signed long long **hs_bindgen_63dedd7015d9ed47 (void)"
+  , "{"
+  , "  return &ordinary_signed_long_long_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer */"
+  , "__attribute__ ((const))"
+  , "signed long long **hs_bindgen_9f47ed329f79e647 (void)"
+  , "{"
+  , "  return &explicit_signed_long_long_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer */"
+  , "__attribute__ ((const))"
+  , "unsigned long long **hs_bindgen_7d2dd0a78dde4b41 (void)"
+  , "{"
+  , "  return &unsigned_long_long_pointer;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_float_array */"
+  , "__attribute__ ((const))"
+  , "float (*hs_bindgen_dbf314f660deda12 (void))[10]"
+  , "{"
+  , "  return &ordinary_float_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_double_array */"
+  , "__attribute__ ((const))"
+  , "double (*hs_bindgen_d554c83416b4ffaa (void))[10]"
+  , "{"
+  , "  return &ordinary_double_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_char_array */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_9a57c94ff3fad985 (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_char_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_char_array */"
+  , "__attribute__ ((const))"
+  , "signed char (*hs_bindgen_335217e9e2c8fe6a (void))[10]"
+  , "{"
+  , "  return &explicit_signed_char_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_char_array */"
+  , "__attribute__ ((const))"
+  , "unsigned char (*hs_bindgen_1e72daddbfe2b7ac (void))[10]"
+  , "{"
+  , "  return &unsigned_char_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_short_array */"
+  , "__attribute__ ((const))"
+  , "signed short (*hs_bindgen_109462175baa2bdf (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_short_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_short_array */"
+  , "__attribute__ ((const))"
+  , "signed short (*hs_bindgen_50f788c18928793d (void))[10]"
+  , "{"
+  , "  return &explicit_signed_short_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_short_array */"
+  , "__attribute__ ((const))"
+  , "unsigned short (*hs_bindgen_d5ccc3314ab2eb42 (void))[10]"
+  , "{"
+  , "  return &unsigned_short_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_int_array */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_f7824c4ee10b0b90 (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_int_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_int_array */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_448c7a47209c8b7a (void))[10]"
+  , "{"
+  , "  return &explicit_signed_int_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_int_array */"
+  , "__attribute__ ((const))"
+  , "unsigned int (*hs_bindgen_66499a8ae9382b9e (void))[10]"
+  , "{"
+  , "  return &unsigned_int_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_long_array */"
+  , "__attribute__ ((const))"
+  , "signed long (*hs_bindgen_896d3ba25d886356 (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_long_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_long_array */"
+  , "__attribute__ ((const))"
+  , "signed long (*hs_bindgen_c4ec5e2d6cf5b5ed (void))[10]"
+  , "{"
+  , "  return &explicit_signed_long_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_long_array */"
+  , "__attribute__ ((const))"
+  , "unsigned long (*hs_bindgen_e3fb79df55414b09 (void))[10]"
+  , "{"
+  , "  return &unsigned_long_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_array */"
+  , "__attribute__ ((const))"
+  , "signed long long (*hs_bindgen_02c15bdcdfc54945 (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_long_long_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_long_long_array */"
+  , "__attribute__ ((const))"
+  , "signed long long (*hs_bindgen_4c934e5832898551 (void))[10]"
+  , "{"
+  , "  return &explicit_signed_long_long_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_long_long_array */"
+  , "__attribute__ ((const))"
+  , "unsigned long long (*hs_bindgen_af47cf5cc0016405 (void))[10]"
+  , "{"
+  , "  return &unsigned_long_long_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_void_pointer_array */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_b0da135021f97e27 (void))[10]"
+  , "{"
+  , "  return &ordinary_void_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_float_pointer_array */"
+  , "__attribute__ ((const))"
+  , "float *(*hs_bindgen_41ce3a49f177f5a8 (void))[10]"
+  , "{"
+  , "  return &ordinary_float_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_double_pointer_array */"
+  , "__attribute__ ((const))"
+  , "double *(*hs_bindgen_cfe3890477df51c8 (void))[10]"
+  , "{"
+  , "  return &ordinary_double_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_char_pointer_array */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_e92be5e29785f22b (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_char_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_char_pointer_array */"
+  , "__attribute__ ((const))"
+  , "signed char *(*hs_bindgen_c8caf99249e8ad58 (void))[10]"
+  , "{"
+  , "  return &explicit_signed_char_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_char_pointer_array */"
+  , "__attribute__ ((const))"
+  , "unsigned char *(*hs_bindgen_7028963176c7a21d (void))[10]"
+  , "{"
+  , "  return &unsigned_char_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer_array */"
+  , "__attribute__ ((const))"
+  , "signed short *(*hs_bindgen_1866849231d566a0 (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_short_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer_array */"
+  , "__attribute__ ((const))"
+  , "signed short *(*hs_bindgen_68ed6d444e1b6011 (void))[10]"
+  , "{"
+  , "  return &explicit_signed_short_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_short_pointer_array */"
+  , "__attribute__ ((const))"
+  , "unsigned short *(*hs_bindgen_7c0ca48c3269649a (void))[10]"
+  , "{"
+  , "  return &unsigned_short_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer_array */"
+  , "__attribute__ ((const))"
+  , "signed int *(*hs_bindgen_58e6503e8ccbeb70 (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_int_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer_array */"
+  , "__attribute__ ((const))"
+  , "signed int *(*hs_bindgen_21b8395de873bc0a (void))[10]"
+  , "{"
+  , "  return &explicit_signed_int_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_int_pointer_array */"
+  , "__attribute__ ((const))"
+  , "unsigned int *(*hs_bindgen_667d31d5b7b5106e (void))[10]"
+  , "{"
+  , "  return &unsigned_int_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer_array */"
+  , "__attribute__ ((const))"
+  , "signed long *(*hs_bindgen_eb34bb7d213dcd3d (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_long_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer_array */"
+  , "__attribute__ ((const))"
+  , "signed long *(*hs_bindgen_3386ff9d0e54545d (void))[10]"
+  , "{"
+  , "  return &explicit_signed_long_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_long_pointer_array */"
+  , "__attribute__ ((const))"
+  , "unsigned long *(*hs_bindgen_510be86496a28c91 (void))[10]"
+  , "{"
+  , "  return &unsigned_long_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer_array */"
+  , "__attribute__ ((const))"
+  , "signed long long *(*hs_bindgen_25f60aa140d341a7 (void))[10]"
+  , "{"
+  , "  return &ordinary_signed_long_long_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer_array */"
+  , "__attribute__ ((const))"
+  , "signed long long *(*hs_bindgen_aced8afe33f53905 (void))[10]"
+  , "{"
+  , "  return &explicit_signed_long_long_pointer_array;"
+  , "}"
+  , "/* test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer_array */"
+  , "__attribute__ ((const))"
+  , "unsigned long long *(*hs_bindgen_9534a7c84390edc4 (void))[10]"
+  , "{"
+  , "  return &unsigned_long_long_pointer_array;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_my_array@
+foreign import ccall unsafe "hs_bindgen_b2862a117942ba8c" hs_bindgen_b2862a117942ba8c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_my_array@
+hs_bindgen_b2862a117942ba8c :: IO (BG.Ptr (IA.IncompleteArray (BG.FunPtr (BG.CInt -> IO BG.CInt))))
+hs_bindgen_b2862a117942ba8c =
+  fmap BG.fromFFIType hs_bindgen_b2862a117942ba8c_base
+
+{-# NOINLINE my_array #-}
+{-| __C declaration:__ @my_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 26:14@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+my_array :: BG.Ptr (IA.IncompleteArray (BG.FunPtr (BG.CInt -> IO BG.CInt)))
+my_array =
+  BG.unsafePerformIO hs_bindgen_b2862a117942ba8c
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float@
+foreign import ccall unsafe "hs_bindgen_fbe24203b7174cce" hs_bindgen_fbe24203b7174cce_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float@
+hs_bindgen_fbe24203b7174cce :: IO (BG.Ptr BG.CFloat)
+hs_bindgen_fbe24203b7174cce =
+  fmap BG.fromFFIType hs_bindgen_fbe24203b7174cce_base
+
+{-# NOINLINE ordinary_float #-}
+{-| Primitive types
+
+    NOTE: Here and elsewhere the original test suite has some references to @long double@ , some commented out, and some confusingly not, with an expectation of a translation to @CDouble@ ; the latter I think is a bug in the original test suite. Here we leave all of these test cases in; we emit an "unsupported" message for these and omit the declaration in the generated bindings.
+
+    __C declaration:__ @ordinary_float@
+
+    __defined at:__ @comprehensive\/c2hsc.h 88:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float :: BG.Ptr BG.CFloat
+ordinary_float =
+  BG.unsafePerformIO hs_bindgen_fbe24203b7174cce
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double@
+foreign import ccall unsafe "hs_bindgen_c996ca409147b439" hs_bindgen_c996ca409147b439_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double@
+hs_bindgen_c996ca409147b439 :: IO (BG.Ptr BG.CDouble)
+hs_bindgen_c996ca409147b439 =
+  fmap BG.fromFFIType hs_bindgen_c996ca409147b439_base
+
+{-# NOINLINE ordinary_double #-}
+{-| __C declaration:__ @ordinary_double@
+
+    __defined at:__ @comprehensive\/c2hsc.h 89:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double :: BG.Ptr BG.CDouble
+ordinary_double =
+  BG.unsafePerformIO hs_bindgen_c996ca409147b439
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char@
+foreign import ccall unsafe "hs_bindgen_b5c47cbce17ba18f" hs_bindgen_b5c47cbce17ba18f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char@
+hs_bindgen_b5c47cbce17ba18f :: IO (BG.Ptr BG.CChar)
+hs_bindgen_b5c47cbce17ba18f =
+  fmap BG.fromFFIType hs_bindgen_b5c47cbce17ba18f_base
+
+{-# NOINLINE ordinary_char #-}
+{-| __C declaration:__ @ordinary_char@
+
+    __defined at:__ @comprehensive\/c2hsc.h 92:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_char :: BG.Ptr BG.CChar
+ordinary_char =
+  BG.unsafePerformIO hs_bindgen_b5c47cbce17ba18f
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char@
+foreign import ccall unsafe "hs_bindgen_74214b0c0c8011ef" hs_bindgen_74214b0c0c8011ef_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char@
+hs_bindgen_74214b0c0c8011ef :: IO (BG.Ptr BG.CSChar)
+hs_bindgen_74214b0c0c8011ef =
+  fmap BG.fromFFIType hs_bindgen_74214b0c0c8011ef_base
+
+{-# NOINLINE signed_char #-}
+{-| __C declaration:__ @signed_char@
+
+    __defined at:__ @comprehensive\/c2hsc.h 93:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+signed_char :: BG.Ptr BG.CSChar
+signed_char =
+  BG.unsafePerformIO hs_bindgen_74214b0c0c8011ef
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char@
+foreign import ccall unsafe "hs_bindgen_074079404a90186b" hs_bindgen_074079404a90186b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char@
+hs_bindgen_074079404a90186b :: IO (BG.Ptr BG.CUChar)
+hs_bindgen_074079404a90186b =
+  fmap BG.fromFFIType hs_bindgen_074079404a90186b_base
+
+{-# NOINLINE unsigned_char #-}
+{-| __C declaration:__ @unsigned_char@
+
+    __defined at:__ @comprehensive\/c2hsc.h 94:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char :: BG.Ptr BG.CUChar
+unsigned_char =
+  BG.unsafePerformIO hs_bindgen_074079404a90186b
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short@
+foreign import ccall unsafe "hs_bindgen_e432ab522350f84b" hs_bindgen_e432ab522350f84b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short@
+hs_bindgen_e432ab522350f84b :: IO (BG.Ptr BG.CShort)
+hs_bindgen_e432ab522350f84b =
+  fmap BG.fromFFIType hs_bindgen_e432ab522350f84b_base
+
+{-# NOINLINE ordinary_signed_short #-}
+{-| __C declaration:__ @ordinary_signed_short@
+
+    __defined at:__ @comprehensive\/c2hsc.h 96:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short :: BG.Ptr BG.CShort
+ordinary_signed_short =
+  BG.unsafePerformIO hs_bindgen_e432ab522350f84b
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short@
+foreign import ccall unsafe "hs_bindgen_17fa3df7c6690161" hs_bindgen_17fa3df7c6690161_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short@
+hs_bindgen_17fa3df7c6690161 :: IO (BG.Ptr BG.CShort)
+hs_bindgen_17fa3df7c6690161 =
+  fmap BG.fromFFIType hs_bindgen_17fa3df7c6690161_base
+
+{-# NOINLINE explicit_signed_short #-}
+{-| __C declaration:__ @explicit_signed_short@
+
+    __defined at:__ @comprehensive\/c2hsc.h 97:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short :: BG.Ptr BG.CShort
+explicit_signed_short =
+  BG.unsafePerformIO hs_bindgen_17fa3df7c6690161
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short@
+foreign import ccall unsafe "hs_bindgen_20f280e98d58aacc" hs_bindgen_20f280e98d58aacc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short@
+hs_bindgen_20f280e98d58aacc :: IO (BG.Ptr BG.CUShort)
+hs_bindgen_20f280e98d58aacc =
+  fmap BG.fromFFIType hs_bindgen_20f280e98d58aacc_base
+
+{-# NOINLINE unsigned_short #-}
+{-| __C declaration:__ @unsigned_short@
+
+    __defined at:__ @comprehensive\/c2hsc.h 98:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short :: BG.Ptr BG.CUShort
+unsigned_short =
+  BG.unsafePerformIO hs_bindgen_20f280e98d58aacc
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int@
+foreign import ccall unsafe "hs_bindgen_78b4f07c60ef3ef7" hs_bindgen_78b4f07c60ef3ef7_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int@
+hs_bindgen_78b4f07c60ef3ef7 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_78b4f07c60ef3ef7 =
+  fmap BG.fromFFIType hs_bindgen_78b4f07c60ef3ef7_base
+
+{-# NOINLINE ordinary_signed_int #-}
+{-| __C declaration:__ @ordinary_signed_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 100:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int :: BG.Ptr BG.CInt
+ordinary_signed_int =
+  BG.unsafePerformIO hs_bindgen_78b4f07c60ef3ef7
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int@
+foreign import ccall unsafe "hs_bindgen_41643d3737e9213c" hs_bindgen_41643d3737e9213c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int@
+hs_bindgen_41643d3737e9213c :: IO (BG.Ptr BG.CInt)
+hs_bindgen_41643d3737e9213c =
+  fmap BG.fromFFIType hs_bindgen_41643d3737e9213c_base
+
+{-# NOINLINE explicit_signed_int #-}
+{-| __C declaration:__ @explicit_signed_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 101:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int :: BG.Ptr BG.CInt
+explicit_signed_int =
+  BG.unsafePerformIO hs_bindgen_41643d3737e9213c
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int@
+foreign import ccall unsafe "hs_bindgen_6e686e175c956cb8" hs_bindgen_6e686e175c956cb8_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int@
+hs_bindgen_6e686e175c956cb8 :: IO (BG.Ptr BG.CUInt)
+hs_bindgen_6e686e175c956cb8 =
+  fmap BG.fromFFIType hs_bindgen_6e686e175c956cb8_base
+
+{-# NOINLINE unsigned_int #-}
+{-| __C declaration:__ @unsigned_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 102:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int :: BG.Ptr BG.CUInt
+unsigned_int =
+  BG.unsafePerformIO hs_bindgen_6e686e175c956cb8
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long@
+foreign import ccall unsafe "hs_bindgen_6a41c38f7fbb41d9" hs_bindgen_6a41c38f7fbb41d9_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long@
+hs_bindgen_6a41c38f7fbb41d9 :: IO (BG.Ptr BG.CLong)
+hs_bindgen_6a41c38f7fbb41d9 =
+  fmap BG.fromFFIType hs_bindgen_6a41c38f7fbb41d9_base
+
+{-# NOINLINE ordinary_signed_long #-}
+{-| __C declaration:__ @ordinary_signed_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 104:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long :: BG.Ptr BG.CLong
+ordinary_signed_long =
+  BG.unsafePerformIO hs_bindgen_6a41c38f7fbb41d9
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long@
+foreign import ccall unsafe "hs_bindgen_a3b5191325da8230" hs_bindgen_a3b5191325da8230_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long@
+hs_bindgen_a3b5191325da8230 :: IO (BG.Ptr BG.CLong)
+hs_bindgen_a3b5191325da8230 =
+  fmap BG.fromFFIType hs_bindgen_a3b5191325da8230_base
+
+{-# NOINLINE explicit_signed_long #-}
+{-| __C declaration:__ @explicit_signed_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 105:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long :: BG.Ptr BG.CLong
+explicit_signed_long =
+  BG.unsafePerformIO hs_bindgen_a3b5191325da8230
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long@
+foreign import ccall unsafe "hs_bindgen_df563b6d35ec4e8f" hs_bindgen_df563b6d35ec4e8f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long@
+hs_bindgen_df563b6d35ec4e8f :: IO (BG.Ptr BG.CULong)
+hs_bindgen_df563b6d35ec4e8f =
+  fmap BG.fromFFIType hs_bindgen_df563b6d35ec4e8f_base
+
+{-# NOINLINE unsigned_long #-}
+{-| __C declaration:__ @unsigned_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 106:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long :: BG.Ptr BG.CULong
+unsigned_long =
+  BG.unsafePerformIO hs_bindgen_df563b6d35ec4e8f
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long@
+foreign import ccall unsafe "hs_bindgen_59c6159f8798505a" hs_bindgen_59c6159f8798505a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long@
+hs_bindgen_59c6159f8798505a :: IO (BG.Ptr BG.CLLong)
+hs_bindgen_59c6159f8798505a =
+  fmap BG.fromFFIType hs_bindgen_59c6159f8798505a_base
+
+{-# NOINLINE ordinary_signed_long_long #-}
+{-| __C declaration:__ @ordinary_signed_long_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 108:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long :: BG.Ptr BG.CLLong
+ordinary_signed_long_long =
+  BG.unsafePerformIO hs_bindgen_59c6159f8798505a
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long@
+foreign import ccall unsafe "hs_bindgen_bfd63280c68460d2" hs_bindgen_bfd63280c68460d2_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long@
+hs_bindgen_bfd63280c68460d2 :: IO (BG.Ptr BG.CLLong)
+hs_bindgen_bfd63280c68460d2 =
+  fmap BG.fromFFIType hs_bindgen_bfd63280c68460d2_base
+
+{-# NOINLINE explicit_signed_long_long #-}
+{-| __C declaration:__ @explicit_signed_long_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 109:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long :: BG.Ptr BG.CLLong
+explicit_signed_long_long =
+  BG.unsafePerformIO hs_bindgen_bfd63280c68460d2
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long@
+foreign import ccall unsafe "hs_bindgen_8654be9a041c2116" hs_bindgen_8654be9a041c2116_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long@
+hs_bindgen_8654be9a041c2116 :: IO (BG.Ptr BG.CULLong)
+hs_bindgen_8654be9a041c2116 =
+  fmap BG.fromFFIType hs_bindgen_8654be9a041c2116_base
+
+{-# NOINLINE unsigned_long_long #-}
+{-| __C declaration:__ @unsigned_long_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 110:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long :: BG.Ptr BG.CULLong
+unsigned_long_long =
+  BG.unsafePerformIO hs_bindgen_8654be9a041c2116
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer@
+foreign import ccall unsafe "hs_bindgen_d6cafaa0834895a2" hs_bindgen_d6cafaa0834895a2_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer@
+hs_bindgen_d6cafaa0834895a2 :: IO (BG.Ptr (BG.Ptr BG.Void))
+hs_bindgen_d6cafaa0834895a2 =
+  fmap BG.fromFFIType hs_bindgen_d6cafaa0834895a2_base
+
+{-# NOINLINE ordinary_void_pointer #-}
+{-| Pointers: primitive types which cannot be signed
+
+    __C declaration:__ @ordinary_void_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 116:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_void_pointer :: BG.Ptr (BG.Ptr BG.Void)
+ordinary_void_pointer =
+  BG.unsafePerformIO hs_bindgen_d6cafaa0834895a2
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer@
+foreign import ccall unsafe "hs_bindgen_35ef3ffa1a5167f7" hs_bindgen_35ef3ffa1a5167f7_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer@
+hs_bindgen_35ef3ffa1a5167f7 :: IO (BG.Ptr (BG.Ptr BG.CFloat))
+hs_bindgen_35ef3ffa1a5167f7 =
+  fmap BG.fromFFIType hs_bindgen_35ef3ffa1a5167f7_base
+
+{-# NOINLINE ordinary_float_pointer #-}
+{-| __C declaration:__ @ordinary_float_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 118:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float_pointer :: BG.Ptr (BG.Ptr BG.CFloat)
+ordinary_float_pointer =
+  BG.unsafePerformIO hs_bindgen_35ef3ffa1a5167f7
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer@
+foreign import ccall unsafe "hs_bindgen_5e831159f7556399" hs_bindgen_5e831159f7556399_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer@
+hs_bindgen_5e831159f7556399 :: IO (BG.Ptr (BG.Ptr BG.CDouble))
+hs_bindgen_5e831159f7556399 =
+  fmap BG.fromFFIType hs_bindgen_5e831159f7556399_base
+
+{-# NOINLINE ordinary_double_pointer #-}
+{-| __C declaration:__ @ordinary_double_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 119:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double_pointer :: BG.Ptr (BG.Ptr BG.CDouble)
+ordinary_double_pointer =
+  BG.unsafePerformIO hs_bindgen_5e831159f7556399
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char_pointer@
+foreign import ccall unsafe "hs_bindgen_08236e44cabe67f4" hs_bindgen_08236e44cabe67f4_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char_pointer@
+hs_bindgen_08236e44cabe67f4 :: IO (BG.Ptr (BG.Ptr BG.CChar))
+hs_bindgen_08236e44cabe67f4 =
+  fmap BG.fromFFIType hs_bindgen_08236e44cabe67f4_base
+
+{-# NOINLINE ordinary_char_pointer #-}
+{-| __C declaration:__ @ordinary_char_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 122:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_char_pointer :: BG.Ptr (BG.Ptr BG.CChar)
+ordinary_char_pointer =
+  BG.unsafePerformIO hs_bindgen_08236e44cabe67f4
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char_pointer@
+foreign import ccall unsafe "hs_bindgen_66d08eddc2fecb35" hs_bindgen_66d08eddc2fecb35_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char_pointer@
+hs_bindgen_66d08eddc2fecb35 :: IO (BG.Ptr (BG.Ptr BG.CSChar))
+hs_bindgen_66d08eddc2fecb35 =
+  fmap BG.fromFFIType hs_bindgen_66d08eddc2fecb35_base
+
+{-# NOINLINE signed_char_pointer #-}
+{-| __C declaration:__ @signed_char_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 123:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+signed_char_pointer :: BG.Ptr (BG.Ptr BG.CSChar)
+signed_char_pointer =
+  BG.unsafePerformIO hs_bindgen_66d08eddc2fecb35
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer@
+foreign import ccall unsafe "hs_bindgen_5c76c506cb4fd78e" hs_bindgen_5c76c506cb4fd78e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer@
+hs_bindgen_5c76c506cb4fd78e :: IO (BG.Ptr (BG.Ptr BG.CUChar))
+hs_bindgen_5c76c506cb4fd78e =
+  fmap BG.fromFFIType hs_bindgen_5c76c506cb4fd78e_base
+
+{-# NOINLINE unsigned_char_pointer #-}
+{-| __C declaration:__ @unsigned_char_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 124:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char_pointer :: BG.Ptr (BG.Ptr BG.CUChar)
+unsigned_char_pointer =
+  BG.unsafePerformIO hs_bindgen_5c76c506cb4fd78e
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer@
+foreign import ccall unsafe "hs_bindgen_cd114d033253fe37" hs_bindgen_cd114d033253fe37_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer@
+hs_bindgen_cd114d033253fe37 :: IO (BG.Ptr (BG.Ptr BG.CShort))
+hs_bindgen_cd114d033253fe37 =
+  fmap BG.fromFFIType hs_bindgen_cd114d033253fe37_base
+
+{-# NOINLINE ordinary_signed_short_pointer #-}
+{-| __C declaration:__ @ordinary_signed_short_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 126:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short_pointer :: BG.Ptr (BG.Ptr BG.CShort)
+ordinary_signed_short_pointer =
+  BG.unsafePerformIO hs_bindgen_cd114d033253fe37
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer@
+foreign import ccall unsafe "hs_bindgen_49ffa4c56ce34e2f" hs_bindgen_49ffa4c56ce34e2f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer@
+hs_bindgen_49ffa4c56ce34e2f :: IO (BG.Ptr (BG.Ptr BG.CShort))
+hs_bindgen_49ffa4c56ce34e2f =
+  fmap BG.fromFFIType hs_bindgen_49ffa4c56ce34e2f_base
+
+{-# NOINLINE explicit_signed_short_pointer #-}
+{-| __C declaration:__ @explicit_signed_short_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 127:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short_pointer :: BG.Ptr (BG.Ptr BG.CShort)
+explicit_signed_short_pointer =
+  BG.unsafePerformIO hs_bindgen_49ffa4c56ce34e2f
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer@
+foreign import ccall unsafe "hs_bindgen_fb80ad6945c7151d" hs_bindgen_fb80ad6945c7151d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer@
+hs_bindgen_fb80ad6945c7151d :: IO (BG.Ptr (BG.Ptr BG.CUShort))
+hs_bindgen_fb80ad6945c7151d =
+  fmap BG.fromFFIType hs_bindgen_fb80ad6945c7151d_base
+
+{-# NOINLINE unsigned_short_pointer #-}
+{-| __C declaration:__ @unsigned_short_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 128:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short_pointer :: BG.Ptr (BG.Ptr BG.CUShort)
+unsigned_short_pointer =
+  BG.unsafePerformIO hs_bindgen_fb80ad6945c7151d
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer@
+foreign import ccall unsafe "hs_bindgen_dfef04ad64871bf8" hs_bindgen_dfef04ad64871bf8_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer@
+hs_bindgen_dfef04ad64871bf8 :: IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_dfef04ad64871bf8 =
+  fmap BG.fromFFIType hs_bindgen_dfef04ad64871bf8_base
+
+{-# NOINLINE ordinary_signed_int_pointer #-}
+{-| __C declaration:__ @ordinary_signed_int_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 130:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int_pointer :: BG.Ptr (BG.Ptr BG.CInt)
+ordinary_signed_int_pointer =
+  BG.unsafePerformIO hs_bindgen_dfef04ad64871bf8
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer@
+foreign import ccall unsafe "hs_bindgen_515d5232453c4285" hs_bindgen_515d5232453c4285_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer@
+hs_bindgen_515d5232453c4285 :: IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_515d5232453c4285 =
+  fmap BG.fromFFIType hs_bindgen_515d5232453c4285_base
+
+{-# NOINLINE explicit_signed_int_pointer #-}
+{-| __C declaration:__ @explicit_signed_int_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 131:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int_pointer :: BG.Ptr (BG.Ptr BG.CInt)
+explicit_signed_int_pointer =
+  BG.unsafePerformIO hs_bindgen_515d5232453c4285
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer@
+foreign import ccall unsafe "hs_bindgen_9f2724dae8d3b3fa" hs_bindgen_9f2724dae8d3b3fa_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer@
+hs_bindgen_9f2724dae8d3b3fa :: IO (BG.Ptr (BG.Ptr BG.CUInt))
+hs_bindgen_9f2724dae8d3b3fa =
+  fmap BG.fromFFIType hs_bindgen_9f2724dae8d3b3fa_base
+
+{-# NOINLINE unsigned_int_pointer #-}
+{-| __C declaration:__ @unsigned_int_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 132:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int_pointer :: BG.Ptr (BG.Ptr BG.CUInt)
+unsigned_int_pointer =
+  BG.unsafePerformIO hs_bindgen_9f2724dae8d3b3fa
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer@
+foreign import ccall unsafe "hs_bindgen_a6b4a786a6644424" hs_bindgen_a6b4a786a6644424_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer@
+hs_bindgen_a6b4a786a6644424 :: IO (BG.Ptr (BG.Ptr BG.CLong))
+hs_bindgen_a6b4a786a6644424 =
+  fmap BG.fromFFIType hs_bindgen_a6b4a786a6644424_base
+
+{-# NOINLINE ordinary_signed_long_pointer #-}
+{-| __C declaration:__ @ordinary_signed_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 134:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_pointer :: BG.Ptr (BG.Ptr BG.CLong)
+ordinary_signed_long_pointer =
+  BG.unsafePerformIO hs_bindgen_a6b4a786a6644424
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer@
+foreign import ccall unsafe "hs_bindgen_4df40729ac557753" hs_bindgen_4df40729ac557753_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer@
+hs_bindgen_4df40729ac557753 :: IO (BG.Ptr (BG.Ptr BG.CLong))
+hs_bindgen_4df40729ac557753 =
+  fmap BG.fromFFIType hs_bindgen_4df40729ac557753_base
+
+{-# NOINLINE explicit_signed_long_pointer #-}
+{-| __C declaration:__ @explicit_signed_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 135:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_pointer :: BG.Ptr (BG.Ptr BG.CLong)
+explicit_signed_long_pointer =
+  BG.unsafePerformIO hs_bindgen_4df40729ac557753
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer@
+foreign import ccall unsafe "hs_bindgen_30379268a6bf43b0" hs_bindgen_30379268a6bf43b0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer@
+hs_bindgen_30379268a6bf43b0 :: IO (BG.Ptr (BG.Ptr BG.CULong))
+hs_bindgen_30379268a6bf43b0 =
+  fmap BG.fromFFIType hs_bindgen_30379268a6bf43b0_base
+
+{-# NOINLINE unsigned_long_pointer #-}
+{-| __C declaration:__ @unsigned_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 136:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_pointer :: BG.Ptr (BG.Ptr BG.CULong)
+unsigned_long_pointer =
+  BG.unsafePerformIO hs_bindgen_30379268a6bf43b0
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer@
+foreign import ccall unsafe "hs_bindgen_63dedd7015d9ed47" hs_bindgen_63dedd7015d9ed47_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer@
+hs_bindgen_63dedd7015d9ed47 :: IO (BG.Ptr (BG.Ptr BG.CLLong))
+hs_bindgen_63dedd7015d9ed47 =
+  fmap BG.fromFFIType hs_bindgen_63dedd7015d9ed47_base
+
+{-# NOINLINE ordinary_signed_long_long_pointer #-}
+{-| __C declaration:__ @ordinary_signed_long_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 138:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long_pointer :: BG.Ptr (BG.Ptr BG.CLLong)
+ordinary_signed_long_long_pointer =
+  BG.unsafePerformIO hs_bindgen_63dedd7015d9ed47
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer@
+foreign import ccall unsafe "hs_bindgen_9f47ed329f79e647" hs_bindgen_9f47ed329f79e647_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer@
+hs_bindgen_9f47ed329f79e647 :: IO (BG.Ptr (BG.Ptr BG.CLLong))
+hs_bindgen_9f47ed329f79e647 =
+  fmap BG.fromFFIType hs_bindgen_9f47ed329f79e647_base
+
+{-# NOINLINE explicit_signed_long_long_pointer #-}
+{-| __C declaration:__ @explicit_signed_long_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 139:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long_pointer :: BG.Ptr (BG.Ptr BG.CLLong)
+explicit_signed_long_long_pointer =
+  BG.unsafePerformIO hs_bindgen_9f47ed329f79e647
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer@
+foreign import ccall unsafe "hs_bindgen_7d2dd0a78dde4b41" hs_bindgen_7d2dd0a78dde4b41_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer@
+hs_bindgen_7d2dd0a78dde4b41 :: IO (BG.Ptr (BG.Ptr BG.CULLong))
+hs_bindgen_7d2dd0a78dde4b41 =
+  fmap BG.fromFFIType hs_bindgen_7d2dd0a78dde4b41_base
+
+{-# NOINLINE unsigned_long_long_pointer #-}
+{-| __C declaration:__ @unsigned_long_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 140:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long_pointer :: BG.Ptr (BG.Ptr BG.CULLong)
+unsigned_long_long_pointer =
+  BG.unsafePerformIO hs_bindgen_7d2dd0a78dde4b41
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_array@
+foreign import ccall unsafe "hs_bindgen_dbf314f660deda12" hs_bindgen_dbf314f660deda12_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_array@
+hs_bindgen_dbf314f660deda12 :: IO (BG.Ptr (CA.ConstantArray 10 BG.CFloat))
+hs_bindgen_dbf314f660deda12 =
+  fmap BG.fromFFIType hs_bindgen_dbf314f660deda12_base
+
+{-# NOINLINE ordinary_float_array #-}
+{-| Arrays: primitive types which cannot be signed
+
+    __C declaration:__ @ordinary_float_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 146:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float_array :: BG.Ptr (CA.ConstantArray 10 BG.CFloat)
+ordinary_float_array =
+  BG.unsafePerformIO hs_bindgen_dbf314f660deda12
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_array@
+foreign import ccall unsafe "hs_bindgen_d554c83416b4ffaa" hs_bindgen_d554c83416b4ffaa_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_array@
+hs_bindgen_d554c83416b4ffaa :: IO (BG.Ptr (CA.ConstantArray 10 BG.CDouble))
+hs_bindgen_d554c83416b4ffaa =
+  fmap BG.fromFFIType hs_bindgen_d554c83416b4ffaa_base
+
+{-# NOINLINE ordinary_double_array #-}
+{-| __C declaration:__ @ordinary_double_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 147:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double_array :: BG.Ptr (CA.ConstantArray 10 BG.CDouble)
+ordinary_double_array =
+  BG.unsafePerformIO hs_bindgen_d554c83416b4ffaa
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_array@
+foreign import ccall unsafe "hs_bindgen_9a57c94ff3fad985" hs_bindgen_9a57c94ff3fad985_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_array@
+hs_bindgen_9a57c94ff3fad985 :: IO (BG.Ptr (CA.ConstantArray 10 BG.CChar))
+hs_bindgen_9a57c94ff3fad985 =
+  fmap BG.fromFFIType hs_bindgen_9a57c94ff3fad985_base
+
+{-# NOINLINE ordinary_signed_char_array #-}
+{-| __C declaration:__ @ordinary_signed_char_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 150:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_char_array :: BG.Ptr (CA.ConstantArray 10 BG.CChar)
+ordinary_signed_char_array =
+  BG.unsafePerformIO hs_bindgen_9a57c94ff3fad985
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_array@
+foreign import ccall unsafe "hs_bindgen_335217e9e2c8fe6a" hs_bindgen_335217e9e2c8fe6a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_array@
+hs_bindgen_335217e9e2c8fe6a :: IO (BG.Ptr (CA.ConstantArray 10 BG.CSChar))
+hs_bindgen_335217e9e2c8fe6a =
+  fmap BG.fromFFIType hs_bindgen_335217e9e2c8fe6a_base
+
+{-# NOINLINE explicit_signed_char_array #-}
+{-| __C declaration:__ @explicit_signed_char_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 151:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_char_array :: BG.Ptr (CA.ConstantArray 10 BG.CSChar)
+explicit_signed_char_array =
+  BG.unsafePerformIO hs_bindgen_335217e9e2c8fe6a
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_array@
+foreign import ccall unsafe "hs_bindgen_1e72daddbfe2b7ac" hs_bindgen_1e72daddbfe2b7ac_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_array@
+hs_bindgen_1e72daddbfe2b7ac :: IO (BG.Ptr (CA.ConstantArray 10 BG.CUChar))
+hs_bindgen_1e72daddbfe2b7ac =
+  fmap BG.fromFFIType hs_bindgen_1e72daddbfe2b7ac_base
+
+{-# NOINLINE unsigned_char_array #-}
+{-| __C declaration:__ @unsigned_char_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 152:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char_array :: BG.Ptr (CA.ConstantArray 10 BG.CUChar)
+unsigned_char_array =
+  BG.unsafePerformIO hs_bindgen_1e72daddbfe2b7ac
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_array@
+foreign import ccall unsafe "hs_bindgen_109462175baa2bdf" hs_bindgen_109462175baa2bdf_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_array@
+hs_bindgen_109462175baa2bdf :: IO (BG.Ptr (CA.ConstantArray 10 BG.CShort))
+hs_bindgen_109462175baa2bdf =
+  fmap BG.fromFFIType hs_bindgen_109462175baa2bdf_base
+
+{-# NOINLINE ordinary_signed_short_array #-}
+{-| __C declaration:__ @ordinary_signed_short_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 154:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short_array :: BG.Ptr (CA.ConstantArray 10 BG.CShort)
+ordinary_signed_short_array =
+  BG.unsafePerformIO hs_bindgen_109462175baa2bdf
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_array@
+foreign import ccall unsafe "hs_bindgen_50f788c18928793d" hs_bindgen_50f788c18928793d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_array@
+hs_bindgen_50f788c18928793d :: IO (BG.Ptr (CA.ConstantArray 10 BG.CShort))
+hs_bindgen_50f788c18928793d =
+  fmap BG.fromFFIType hs_bindgen_50f788c18928793d_base
+
+{-# NOINLINE explicit_signed_short_array #-}
+{-| __C declaration:__ @explicit_signed_short_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 155:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short_array :: BG.Ptr (CA.ConstantArray 10 BG.CShort)
+explicit_signed_short_array =
+  BG.unsafePerformIO hs_bindgen_50f788c18928793d
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_array@
+foreign import ccall unsafe "hs_bindgen_d5ccc3314ab2eb42" hs_bindgen_d5ccc3314ab2eb42_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_array@
+hs_bindgen_d5ccc3314ab2eb42 :: IO (BG.Ptr (CA.ConstantArray 10 BG.CUShort))
+hs_bindgen_d5ccc3314ab2eb42 =
+  fmap BG.fromFFIType hs_bindgen_d5ccc3314ab2eb42_base
+
+{-# NOINLINE unsigned_short_array #-}
+{-| __C declaration:__ @unsigned_short_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 156:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short_array :: BG.Ptr (CA.ConstantArray 10 BG.CUShort)
+unsigned_short_array =
+  BG.unsafePerformIO hs_bindgen_d5ccc3314ab2eb42
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_array@
+foreign import ccall unsafe "hs_bindgen_f7824c4ee10b0b90" hs_bindgen_f7824c4ee10b0b90_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_array@
+hs_bindgen_f7824c4ee10b0b90 :: IO (BG.Ptr (CA.ConstantArray 10 BG.CInt))
+hs_bindgen_f7824c4ee10b0b90 =
+  fmap BG.fromFFIType hs_bindgen_f7824c4ee10b0b90_base
+
+{-# NOINLINE ordinary_signed_int_array #-}
+{-| __C declaration:__ @ordinary_signed_int_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 158:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int_array :: BG.Ptr (CA.ConstantArray 10 BG.CInt)
+ordinary_signed_int_array =
+  BG.unsafePerformIO hs_bindgen_f7824c4ee10b0b90
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_array@
+foreign import ccall unsafe "hs_bindgen_448c7a47209c8b7a" hs_bindgen_448c7a47209c8b7a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_array@
+hs_bindgen_448c7a47209c8b7a :: IO (BG.Ptr (CA.ConstantArray 10 BG.CInt))
+hs_bindgen_448c7a47209c8b7a =
+  fmap BG.fromFFIType hs_bindgen_448c7a47209c8b7a_base
+
+{-# NOINLINE explicit_signed_int_array #-}
+{-| __C declaration:__ @explicit_signed_int_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 159:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int_array :: BG.Ptr (CA.ConstantArray 10 BG.CInt)
+explicit_signed_int_array =
+  BG.unsafePerformIO hs_bindgen_448c7a47209c8b7a
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_array@
+foreign import ccall unsafe "hs_bindgen_66499a8ae9382b9e" hs_bindgen_66499a8ae9382b9e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_array@
+hs_bindgen_66499a8ae9382b9e :: IO (BG.Ptr (CA.ConstantArray 10 BG.CUInt))
+hs_bindgen_66499a8ae9382b9e =
+  fmap BG.fromFFIType hs_bindgen_66499a8ae9382b9e_base
+
+{-# NOINLINE unsigned_int_array #-}
+{-| __C declaration:__ @unsigned_int_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 160:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int_array :: BG.Ptr (CA.ConstantArray 10 BG.CUInt)
+unsigned_int_array =
+  BG.unsafePerformIO hs_bindgen_66499a8ae9382b9e
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_array@
+foreign import ccall unsafe "hs_bindgen_896d3ba25d886356" hs_bindgen_896d3ba25d886356_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_array@
+hs_bindgen_896d3ba25d886356 :: IO (BG.Ptr (CA.ConstantArray 10 BG.CLong))
+hs_bindgen_896d3ba25d886356 =
+  fmap BG.fromFFIType hs_bindgen_896d3ba25d886356_base
+
+{-# NOINLINE ordinary_signed_long_array #-}
+{-| __C declaration:__ @ordinary_signed_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 162:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_array :: BG.Ptr (CA.ConstantArray 10 BG.CLong)
+ordinary_signed_long_array =
+  BG.unsafePerformIO hs_bindgen_896d3ba25d886356
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_array@
+foreign import ccall unsafe "hs_bindgen_c4ec5e2d6cf5b5ed" hs_bindgen_c4ec5e2d6cf5b5ed_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_array@
+hs_bindgen_c4ec5e2d6cf5b5ed :: IO (BG.Ptr (CA.ConstantArray 10 BG.CLong))
+hs_bindgen_c4ec5e2d6cf5b5ed =
+  fmap BG.fromFFIType hs_bindgen_c4ec5e2d6cf5b5ed_base
+
+{-# NOINLINE explicit_signed_long_array #-}
+{-| __C declaration:__ @explicit_signed_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 163:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_array :: BG.Ptr (CA.ConstantArray 10 BG.CLong)
+explicit_signed_long_array =
+  BG.unsafePerformIO hs_bindgen_c4ec5e2d6cf5b5ed
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_array@
+foreign import ccall unsafe "hs_bindgen_e3fb79df55414b09" hs_bindgen_e3fb79df55414b09_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_array@
+hs_bindgen_e3fb79df55414b09 :: IO (BG.Ptr (CA.ConstantArray 10 BG.CULong))
+hs_bindgen_e3fb79df55414b09 =
+  fmap BG.fromFFIType hs_bindgen_e3fb79df55414b09_base
+
+{-# NOINLINE unsigned_long_array #-}
+{-| __C declaration:__ @unsigned_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 164:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_array :: BG.Ptr (CA.ConstantArray 10 BG.CULong)
+unsigned_long_array =
+  BG.unsafePerformIO hs_bindgen_e3fb79df55414b09
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_array@
+foreign import ccall unsafe "hs_bindgen_02c15bdcdfc54945" hs_bindgen_02c15bdcdfc54945_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_array@
+hs_bindgen_02c15bdcdfc54945 :: IO (BG.Ptr (CA.ConstantArray 10 BG.CLLong))
+hs_bindgen_02c15bdcdfc54945 =
+  fmap BG.fromFFIType hs_bindgen_02c15bdcdfc54945_base
+
+{-# NOINLINE ordinary_signed_long_long_array #-}
+{-| __C declaration:__ @ordinary_signed_long_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 166:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long_array :: BG.Ptr (CA.ConstantArray 10 BG.CLLong)
+ordinary_signed_long_long_array =
+  BG.unsafePerformIO hs_bindgen_02c15bdcdfc54945
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_array@
+foreign import ccall unsafe "hs_bindgen_4c934e5832898551" hs_bindgen_4c934e5832898551_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_array@
+hs_bindgen_4c934e5832898551 :: IO (BG.Ptr (CA.ConstantArray 10 BG.CLLong))
+hs_bindgen_4c934e5832898551 =
+  fmap BG.fromFFIType hs_bindgen_4c934e5832898551_base
+
+{-# NOINLINE explicit_signed_long_long_array #-}
+{-| __C declaration:__ @explicit_signed_long_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 167:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long_array :: BG.Ptr (CA.ConstantArray 10 BG.CLLong)
+explicit_signed_long_long_array =
+  BG.unsafePerformIO hs_bindgen_4c934e5832898551
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_array@
+foreign import ccall unsafe "hs_bindgen_af47cf5cc0016405" hs_bindgen_af47cf5cc0016405_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_array@
+hs_bindgen_af47cf5cc0016405 :: IO (BG.Ptr (CA.ConstantArray 10 BG.CULLong))
+hs_bindgen_af47cf5cc0016405 =
+  fmap BG.fromFFIType hs_bindgen_af47cf5cc0016405_base
+
+{-# NOINLINE unsigned_long_long_array #-}
+{-| __C declaration:__ @unsigned_long_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 168:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long_array :: BG.Ptr (CA.ConstantArray 10 BG.CULLong)
+unsigned_long_long_array =
+  BG.unsafePerformIO hs_bindgen_af47cf5cc0016405
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer_array@
+foreign import ccall unsafe "hs_bindgen_b0da135021f97e27" hs_bindgen_b0da135021f97e27_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer_array@
+hs_bindgen_b0da135021f97e27 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.Void)))
+hs_bindgen_b0da135021f97e27 =
+  fmap BG.fromFFIType hs_bindgen_b0da135021f97e27_base
+
+{-# NOINLINE ordinary_void_pointer_array #-}
+{-| Arrays of pointers
+
+    __C declaration:__ @ordinary_void_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 174:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_void_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.Void))
+ordinary_void_pointer_array =
+  BG.unsafePerformIO hs_bindgen_b0da135021f97e27
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer_array@
+foreign import ccall unsafe "hs_bindgen_41ce3a49f177f5a8" hs_bindgen_41ce3a49f177f5a8_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer_array@
+hs_bindgen_41ce3a49f177f5a8 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CFloat)))
+hs_bindgen_41ce3a49f177f5a8 =
+  fmap BG.fromFFIType hs_bindgen_41ce3a49f177f5a8_base
+
+{-# NOINLINE ordinary_float_pointer_array #-}
+{-| __C declaration:__ @ordinary_float_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 176:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CFloat))
+ordinary_float_pointer_array =
+  BG.unsafePerformIO hs_bindgen_41ce3a49f177f5a8
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer_array@
+foreign import ccall unsafe "hs_bindgen_cfe3890477df51c8" hs_bindgen_cfe3890477df51c8_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer_array@
+hs_bindgen_cfe3890477df51c8 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CDouble)))
+hs_bindgen_cfe3890477df51c8 =
+  fmap BG.fromFFIType hs_bindgen_cfe3890477df51c8_base
+
+{-# NOINLINE ordinary_double_pointer_array #-}
+{-| __C declaration:__ @ordinary_double_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 177:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CDouble))
+ordinary_double_pointer_array =
+  BG.unsafePerformIO hs_bindgen_cfe3890477df51c8
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_pointer_array@
+foreign import ccall unsafe "hs_bindgen_e92be5e29785f22b" hs_bindgen_e92be5e29785f22b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_pointer_array@
+hs_bindgen_e92be5e29785f22b :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CChar)))
+hs_bindgen_e92be5e29785f22b =
+  fmap BG.fromFFIType hs_bindgen_e92be5e29785f22b_base
+
+{-# NOINLINE ordinary_signed_char_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_char_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 180:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_char_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CChar))
+ordinary_signed_char_pointer_array =
+  BG.unsafePerformIO hs_bindgen_e92be5e29785f22b
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_pointer_array@
+foreign import ccall unsafe "hs_bindgen_c8caf99249e8ad58" hs_bindgen_c8caf99249e8ad58_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_pointer_array@
+hs_bindgen_c8caf99249e8ad58 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CSChar)))
+hs_bindgen_c8caf99249e8ad58 =
+  fmap BG.fromFFIType hs_bindgen_c8caf99249e8ad58_base
+
+{-# NOINLINE explicit_signed_char_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_char_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 181:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_char_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CSChar))
+explicit_signed_char_pointer_array =
+  BG.unsafePerformIO hs_bindgen_c8caf99249e8ad58
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer_array@
+foreign import ccall unsafe "hs_bindgen_7028963176c7a21d" hs_bindgen_7028963176c7a21d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer_array@
+hs_bindgen_7028963176c7a21d :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CUChar)))
+hs_bindgen_7028963176c7a21d =
+  fmap BG.fromFFIType hs_bindgen_7028963176c7a21d_base
+
+{-# NOINLINE unsigned_char_pointer_array #-}
+{-| __C declaration:__ @unsigned_char_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 182:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CUChar))
+unsigned_char_pointer_array =
+  BG.unsafePerformIO hs_bindgen_7028963176c7a21d
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer_array@
+foreign import ccall unsafe "hs_bindgen_1866849231d566a0" hs_bindgen_1866849231d566a0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer_array@
+hs_bindgen_1866849231d566a0 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CShort)))
+hs_bindgen_1866849231d566a0 =
+  fmap BG.fromFFIType hs_bindgen_1866849231d566a0_base
+
+{-# NOINLINE ordinary_signed_short_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_short_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 184:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CShort))
+ordinary_signed_short_pointer_array =
+  BG.unsafePerformIO hs_bindgen_1866849231d566a0
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer_array@
+foreign import ccall unsafe "hs_bindgen_68ed6d444e1b6011" hs_bindgen_68ed6d444e1b6011_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer_array@
+hs_bindgen_68ed6d444e1b6011 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CShort)))
+hs_bindgen_68ed6d444e1b6011 =
+  fmap BG.fromFFIType hs_bindgen_68ed6d444e1b6011_base
+
+{-# NOINLINE explicit_signed_short_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_short_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 185:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CShort))
+explicit_signed_short_pointer_array =
+  BG.unsafePerformIO hs_bindgen_68ed6d444e1b6011
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer_array@
+foreign import ccall unsafe "hs_bindgen_7c0ca48c3269649a" hs_bindgen_7c0ca48c3269649a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer_array@
+hs_bindgen_7c0ca48c3269649a :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CUShort)))
+hs_bindgen_7c0ca48c3269649a =
+  fmap BG.fromFFIType hs_bindgen_7c0ca48c3269649a_base
+
+{-# NOINLINE unsigned_short_pointer_array #-}
+{-| __C declaration:__ @unsigned_short_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 186:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CUShort))
+unsigned_short_pointer_array =
+  BG.unsafePerformIO hs_bindgen_7c0ca48c3269649a
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer_array@
+foreign import ccall unsafe "hs_bindgen_58e6503e8ccbeb70" hs_bindgen_58e6503e8ccbeb70_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer_array@
+hs_bindgen_58e6503e8ccbeb70 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CInt)))
+hs_bindgen_58e6503e8ccbeb70 =
+  fmap BG.fromFFIType hs_bindgen_58e6503e8ccbeb70_base
+
+{-# NOINLINE ordinary_signed_int_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_int_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 188:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CInt))
+ordinary_signed_int_pointer_array =
+  BG.unsafePerformIO hs_bindgen_58e6503e8ccbeb70
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer_array@
+foreign import ccall unsafe "hs_bindgen_21b8395de873bc0a" hs_bindgen_21b8395de873bc0a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer_array@
+hs_bindgen_21b8395de873bc0a :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CInt)))
+hs_bindgen_21b8395de873bc0a =
+  fmap BG.fromFFIType hs_bindgen_21b8395de873bc0a_base
+
+{-# NOINLINE explicit_signed_int_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_int_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 189:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CInt))
+explicit_signed_int_pointer_array =
+  BG.unsafePerformIO hs_bindgen_21b8395de873bc0a
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer_array@
+foreign import ccall unsafe "hs_bindgen_667d31d5b7b5106e" hs_bindgen_667d31d5b7b5106e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer_array@
+hs_bindgen_667d31d5b7b5106e :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CUInt)))
+hs_bindgen_667d31d5b7b5106e =
+  fmap BG.fromFFIType hs_bindgen_667d31d5b7b5106e_base
+
+{-# NOINLINE unsigned_int_pointer_array #-}
+{-| __C declaration:__ @unsigned_int_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 190:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CUInt))
+unsigned_int_pointer_array =
+  BG.unsafePerformIO hs_bindgen_667d31d5b7b5106e
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_eb34bb7d213dcd3d" hs_bindgen_eb34bb7d213dcd3d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer_array@
+hs_bindgen_eb34bb7d213dcd3d :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CLong)))
+hs_bindgen_eb34bb7d213dcd3d =
+  fmap BG.fromFFIType hs_bindgen_eb34bb7d213dcd3d_base
+
+{-# NOINLINE ordinary_signed_long_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 192:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CLong))
+ordinary_signed_long_pointer_array =
+  BG.unsafePerformIO hs_bindgen_eb34bb7d213dcd3d
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_3386ff9d0e54545d" hs_bindgen_3386ff9d0e54545d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer_array@
+hs_bindgen_3386ff9d0e54545d :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CLong)))
+hs_bindgen_3386ff9d0e54545d =
+  fmap BG.fromFFIType hs_bindgen_3386ff9d0e54545d_base
+
+{-# NOINLINE explicit_signed_long_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 193:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CLong))
+explicit_signed_long_pointer_array =
+  BG.unsafePerformIO hs_bindgen_3386ff9d0e54545d
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_510be86496a28c91" hs_bindgen_510be86496a28c91_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer_array@
+hs_bindgen_510be86496a28c91 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CULong)))
+hs_bindgen_510be86496a28c91 =
+  fmap BG.fromFFIType hs_bindgen_510be86496a28c91_base
+
+{-# NOINLINE unsigned_long_pointer_array #-}
+{-| __C declaration:__ @unsigned_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 194:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CULong))
+unsigned_long_pointer_array =
+  BG.unsafePerformIO hs_bindgen_510be86496a28c91
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_25f60aa140d341a7" hs_bindgen_25f60aa140d341a7_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer_array@
+hs_bindgen_25f60aa140d341a7 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CLLong)))
+hs_bindgen_25f60aa140d341a7 =
+  fmap BG.fromFFIType hs_bindgen_25f60aa140d341a7_base
+
+{-# NOINLINE ordinary_signed_long_long_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_long_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 196:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CLLong))
+ordinary_signed_long_long_pointer_array =
+  BG.unsafePerformIO hs_bindgen_25f60aa140d341a7
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_aced8afe33f53905" hs_bindgen_aced8afe33f53905_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer_array@
+hs_bindgen_aced8afe33f53905 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CLLong)))
+hs_bindgen_aced8afe33f53905 =
+  fmap BG.fromFFIType hs_bindgen_aced8afe33f53905_base
+
+{-# NOINLINE explicit_signed_long_long_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_long_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 197:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CLLong))
+explicit_signed_long_long_pointer_array =
+  BG.unsafePerformIO hs_bindgen_aced8afe33f53905
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_9534a7c84390edc4" hs_bindgen_9534a7c84390edc4_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer_array@
+hs_bindgen_9534a7c84390edc4 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CULLong)))
+hs_bindgen_9534a7c84390edc4 =
+  fmap BG.fromFFIType hs_bindgen_9534a7c84390edc4_base
+
+{-# NOINLINE unsigned_long_long_pointer_array #-}
+{-| __C declaration:__ @unsigned_long_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 198:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long_pointer_array :: BG.Ptr (CA.ConstantArray 10 (BG.Ptr BG.CULLong))
+unsigned_long_long_pointer_array =
+  BG.unsafePerformIO hs_bindgen_9534a7c84390edc4
diff --git a/test-artefacts/fixtures/comprehensive/c2hsc/Example/Safe.hs b/test-artefacts/fixtures/comprehensive/c2hsc/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/c2hsc/Example/Safe.hs
@@ -0,0 +1,144 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo_function
+    , Example.Safe.foo_33_1
+    , Example.Safe.foo_33_2
+    , Example.Safe.foo_33_3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <comprehensive/c2hsc.h>"
+  , "void hs_bindgen_3fd2a5c6e681c44b ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (foo_function)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_7978c370c45d3898 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (foo_33_1)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_44aef5175928343d ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (foo_33_2)(arg1);"
+  , "}"
+  , "signed long long hs_bindgen_9f0b65c4b469b3d8 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (foo_33_3)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_function@
+foreign import ccall safe "hs_bindgen_3fd2a5c6e681c44b" hs_bindgen_3fd2a5c6e681c44b_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_function@
+hs_bindgen_3fd2a5c6e681c44b ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_3fd2a5c6e681c44b =
+  \x0 ->
+    hs_bindgen_3fd2a5c6e681c44b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo_function@
+
+    __defined at:__ @comprehensive\/c2hsc.h 38:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_function ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @foo@
+  -> IO ()
+foo_function = hs_bindgen_3fd2a5c6e681c44b
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_1@
+foreign import ccall safe "hs_bindgen_7978c370c45d3898" hs_bindgen_7978c370c45d3898_base ::
+     BG.CUInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_1@
+hs_bindgen_7978c370c45d3898 ::
+     BG.CUInt
+  -> IO BG.CUInt
+hs_bindgen_7978c370c45d3898 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7978c370c45d3898_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo_33_1@
+
+    __defined at:__ @comprehensive\/c2hsc.h 73:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_1 ::
+     BG.CUInt
+  -> IO BG.CUInt
+foo_33_1 = hs_bindgen_7978c370c45d3898
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_2@
+foreign import ccall safe "hs_bindgen_44aef5175928343d" hs_bindgen_44aef5175928343d_base ::
+     BG.CUInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_2@
+hs_bindgen_44aef5175928343d ::
+     BG.CUInt
+  -> IO BG.CUInt
+hs_bindgen_44aef5175928343d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_44aef5175928343d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo_33_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 74:51@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_2 ::
+     BG.CUInt
+  -> IO BG.CUInt
+foo_33_2 = hs_bindgen_44aef5175928343d
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_3@
+foreign import ccall safe "hs_bindgen_9f0b65c4b469b3d8" hs_bindgen_9f0b65c4b469b3d8_base ::
+     BG.CLLong
+  -> IO BG.CLLong
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_3@
+hs_bindgen_9f0b65c4b469b3d8 ::
+     BG.CLLong
+  -> IO BG.CLLong
+hs_bindgen_9f0b65c4b469b3d8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9f0b65c4b469b3d8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo_33_3@
+
+    __defined at:__ @comprehensive\/c2hsc.h 75:52@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_3 ::
+     BG.CLLong
+  -> IO BG.CLLong
+foo_33_3 = hs_bindgen_9f0b65c4b469b3d8
diff --git a/test-artefacts/fixtures/comprehensive/c2hsc/Example/Unsafe.hs b/test-artefacts/fixtures/comprehensive/c2hsc/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/c2hsc/Example/Unsafe.hs
@@ -0,0 +1,144 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo_function
+    , Example.Unsafe.foo_33_1
+    , Example.Unsafe.foo_33_2
+    , Example.Unsafe.foo_33_3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <comprehensive/c2hsc.h>"
+  , "void hs_bindgen_bf542a744554a894 ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (foo_function)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_11ca53f1ea9c8230 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (foo_33_1)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_2685a75b0196568e ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (foo_33_2)(arg1);"
+  , "}"
+  , "signed long long hs_bindgen_bc94ff083e65f7e0 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (foo_33_3)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_function@
+foreign import ccall unsafe "hs_bindgen_bf542a744554a894" hs_bindgen_bf542a744554a894_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_function@
+hs_bindgen_bf542a744554a894 ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO ()
+hs_bindgen_bf542a744554a894 =
+  \x0 ->
+    hs_bindgen_bf542a744554a894_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo_function@
+
+    __defined at:__ @comprehensive\/c2hsc.h 38:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_function ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @foo@
+  -> IO ()
+foo_function = hs_bindgen_bf542a744554a894
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_1@
+foreign import ccall unsafe "hs_bindgen_11ca53f1ea9c8230" hs_bindgen_11ca53f1ea9c8230_base ::
+     BG.CUInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_1@
+hs_bindgen_11ca53f1ea9c8230 ::
+     BG.CUInt
+  -> IO BG.CUInt
+hs_bindgen_11ca53f1ea9c8230 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_11ca53f1ea9c8230_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo_33_1@
+
+    __defined at:__ @comprehensive\/c2hsc.h 73:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_1 ::
+     BG.CUInt
+  -> IO BG.CUInt
+foo_33_1 = hs_bindgen_11ca53f1ea9c8230
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_2@
+foreign import ccall unsafe "hs_bindgen_2685a75b0196568e" hs_bindgen_2685a75b0196568e_base ::
+     BG.CUInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_2@
+hs_bindgen_2685a75b0196568e ::
+     BG.CUInt
+  -> IO BG.CUInt
+hs_bindgen_2685a75b0196568e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2685a75b0196568e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo_33_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 74:51@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_2 ::
+     BG.CUInt
+  -> IO BG.CUInt
+foo_33_2 = hs_bindgen_2685a75b0196568e
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_3@
+foreign import ccall unsafe "hs_bindgen_bc94ff083e65f7e0" hs_bindgen_bc94ff083e65f7e0_base ::
+     BG.CLLong
+  -> IO BG.CLLong
+
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_3@
+hs_bindgen_bc94ff083e65f7e0 ::
+     BG.CLLong
+  -> IO BG.CLLong
+hs_bindgen_bc94ff083e65f7e0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bc94ff083e65f7e0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo_33_3@
+
+    __defined at:__ @comprehensive\/c2hsc.h 75:52@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_3 ::
+     BG.CLLong
+  -> IO BG.CLLong
+foo_33_3 = hs_bindgen_bc94ff083e65f7e0
diff --git a/test-artefacts/fixtures/comprehensive/c2hsc/bindingspec.yaml b/test-artefacts/fixtures/comprehensive/c2hsc/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/c2hsc/bindingspec.yaml
@@ -0,0 +1,2050 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: comprehensive/c2hsc.h
+  cname: an_pchar
+  hsname: An_pchar
+- headers: comprehensive/c2hsc.h
+  cname: struct MyCoolStruct
+  hsname: MyCoolStruct
+- headers: comprehensive/c2hsc.h
+  cname: MyCoolStruct
+  hsname: MyCoolStruct
+- headers: comprehensive/c2hsc.h
+  cname: foo
+  hsname: Foo
+- headers: comprehensive/c2hsc.h
+  cname: struct foo_t
+  hsname: Foo_t
+- headers: comprehensive/c2hsc.h
+  cname: struct Foo_10_
+  hsname: Foo_10
+- headers: comprehensive/c2hsc.h
+  cname: Foo_10
+  hsname: Foo_10
+- headers: comprehensive/c2hsc.h
+  cname: enum Bar_10_
+  hsname: Bar_10
+  enum: open
+- headers: comprehensive/c2hsc.h
+  cname: Bar_10
+  hsname: Bar_10
+- headers: comprehensive/c2hsc.h
+  cname: struct st
+  hsname: St
+- headers: comprehensive/c2hsc.h
+  cname: enum e
+  hsname: E
+  enum: open
+- headers: comprehensive/c2hsc.h
+  cname: union u
+  hsname: U
+- headers: comprehensive/c2hsc.h
+  cname: struct MyTypeImpl
+  hsname: MyTypeImpl
+- headers: comprehensive/c2hsc.h
+  cname: MyType
+  hsname: MyType
+- headers: comprehensive/c2hsc.h
+  cname: struct MyStruct
+  hsname: MyStructType
+- headers: comprehensive/c2hsc.h
+  cname: MyStructType
+  hsname: MyStructType
+- headers: comprehensive/c2hsc.h
+  cname: struct MyStructEmpty
+  hsname: MyStructEmptyType
+- headers: comprehensive/c2hsc.h
+  cname: MyStructEmptyType
+  hsname: MyStructEmptyType
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_float_struct
+  hsname: Ordinary_float_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_double_struct
+  hsname: Ordinary_double_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_char_struct
+  hsname: Ordinary_signed_char_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_char_struct
+  hsname: Explicit_signed_char_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_char_struct
+  hsname: Unsigned_char_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_short_struct
+  hsname: Ordinary_signed_short_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_short_struct
+  hsname: Explicit_signed_short_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_short_struct
+  hsname: Unsigned_short_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_int_struct
+  hsname: Ordinary_signed_int_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_int_struct
+  hsname: Explicit_signed_int_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_int_struct
+  hsname: Unsigned_int_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_long_struct
+  hsname: Ordinary_signed_long_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_long_struct
+  hsname: Explicit_signed_long_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_long_struct
+  hsname: Unsigned_long_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_long_long_struct
+  hsname: Ordinary_signed_long_long_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_long_long_struct
+  hsname: Explicit_signed_long_long_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_long_long_struct
+  hsname: Unsigned_long_long_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_void_pointer_struct
+  hsname: Ordinary_void_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_float_pointer_struct
+  hsname: Ordinary_float_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_double_pointer_struct
+  hsname: Ordinary_double_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_char_pointer_struct
+  hsname: Ordinary_signed_char_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_char_pointer_struct
+  hsname: Explicit_signed_char_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_char_pointer_struct
+  hsname: Unsigned_char_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_short_pointer_struct
+  hsname: Ordinary_signed_short_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_short_pointer_struct
+  hsname: Explicit_signed_short_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_short_pointer_struct
+  hsname: Unsigned_short_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_int_pointer_struct
+  hsname: Ordinary_signed_int_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_int_pointer_struct
+  hsname: Explicit_signed_int_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_int_pointer_struct
+  hsname: Unsigned_int_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_long_pointer_struct
+  hsname: Ordinary_signed_long_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_long_pointer_struct
+  hsname: Explicit_signed_long_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_long_pointer_struct
+  hsname: Unsigned_long_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_long_long_pointer_struct
+  hsname: Ordinary_signed_long_long_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_long_long_pointer_struct
+  hsname: Explicit_signed_long_long_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_long_long_pointer_struct
+  hsname: Unsigned_long_long_pointer_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_float_array_struct
+  hsname: Ordinary_float_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_double_array_struct
+  hsname: Ordinary_double_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_char_array_struct
+  hsname: Ordinary_signed_char_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_char_array_struct
+  hsname: Explicit_signed_char_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_char_array_struct
+  hsname: Unsigned_char_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_short_array_struct
+  hsname: Ordinary_signed_short_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_short_array_struct
+  hsname: Explicit_signed_short_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_short_array_struct
+  hsname: Unsigned_short_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_int_array_struct
+  hsname: Ordinary_signed_int_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_int_array_struct
+  hsname: Explicit_signed_int_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_int_array_struct
+  hsname: Unsigned_int_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_long_array_struct
+  hsname: Ordinary_signed_long_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_long_array_struct
+  hsname: Explicit_signed_long_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_long_array_struct
+  hsname: Unsigned_long_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_long_long_array_struct
+  hsname: Ordinary_signed_long_long_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_long_long_array_struct
+  hsname: Explicit_signed_long_long_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_long_long_array_struct
+  hsname: Unsigned_long_long_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_void_pointer_array_struct
+  hsname: Ordinary_void_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_float_pointer_array_struct
+  hsname: Ordinary_float_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_double_pointer_array_struct
+  hsname: Ordinary_double_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_char_pointer_array_struct
+  hsname: Ordinary_signed_char_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_char_pointer_array_struct
+  hsname: Explicit_signed_char_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_char_pointer_array_struct
+  hsname: Unsigned_char_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_short_pointer_array_struct
+  hsname: Ordinary_signed_short_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_short_pointer_array_struct
+  hsname: Explicit_signed_short_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_short_pointer_array_struct
+  hsname: Unsigned_short_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_int_pointer_array_struct
+  hsname: Ordinary_signed_int_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_int_pointer_array_struct
+  hsname: Explicit_signed_int_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_int_pointer_array_struct
+  hsname: Unsigned_int_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_long_pointer_array_struct
+  hsname: Ordinary_signed_long_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_long_pointer_array_struct
+  hsname: Explicit_signed_long_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_long_pointer_array_struct
+  hsname: Unsigned_long_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct ordinary_signed_long_long_pointer_array_struct
+  hsname: Ordinary_signed_long_long_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct explicit_signed_long_long_pointer_array_struct
+  hsname: Explicit_signed_long_long_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: struct unsigned_long_long_pointer_array_struct
+  hsname: Unsigned_long_long_pointer_array_struct
+- headers: comprehensive/c2hsc.h
+  cname: an_int
+  hsname: An_int
+- headers: comprehensive/c2hsc.h
+  cname: struct cal_table
+  hsname: Cal_table
+- headers: comprehensive/c2hsc.h
+  cname: struct @cal_table_table
+  hsname: Cal_table_table
+- headers: comprehensive/c2hsc.h
+  cname: struct Elf32_External_Dyn
+  hsname: Elf32_External_Dyn
+- headers: comprehensive/c2hsc.h
+  cname: union @Elf32_External_Dyn_d_un
+  hsname: Elf32_External_Dyn_d_un
+- headers: comprehensive/c2hsc.h
+  cname: Elf32_External_Dyn
+  hsname: Elf32_External_Dyn
+- headers: comprehensive/c2hsc.h
+  cname: bug_24
+  hsname: Bug_24
+- headers: comprehensive/c2hsc.h
+  cname: bug_24_2
+  hsname: Bug_24_2
+- headers: comprehensive/c2hsc.h
+  cname: MyArray_27
+  hsname: MyArray_27
+- headers: comprehensive/c2hsc.h
+  cname: struct MyStruct_27
+  hsname: MyStruct_27
+- headers: comprehensive/c2hsc.h
+  cname: MyStruct_27
+  hsname: MyStruct_27
+hstypes:
+- hsname: An_int
+  representation:
+    newtype:
+      constructor: An_int
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: An_pchar
+  representation:
+    newtype:
+      constructor: An_pchar
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_10
+  representation:
+    newtype:
+      constructor: Bar_10
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bug_24
+  representation:
+    newtype:
+      constructor: Bug_24
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bug_24_2
+  representation:
+    newtype:
+      constructor: Bug_24_2
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Cal_table
+  representation:
+    record:
+      constructor: Cal_table
+      fields:
+      - size
+      - table
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Cal_table_table
+  representation:
+    record:
+      constructor: Cal_table_table
+      fields:
+      - raw
+      - val
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Elf32_External_Dyn
+  representation:
+    record:
+      constructor: Elf32_External_Dyn
+      fields:
+      - d_tag
+      - d_un
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Elf32_External_Dyn_d_un
+  representation:
+    newtype:
+      constructor: Elf32_External_Dyn_d_un
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_char_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_char_array_struct
+      fields:
+      - explicit_signed_char_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_char_pointer_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_char_pointer_array_struct
+      fields:
+      - explicit_signed_char_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_char_pointer_struct
+  representation:
+    record:
+      constructor: Explicit_signed_char_pointer_struct
+      fields:
+      - explicit_signed_char_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_char_struct
+  representation:
+    record:
+      constructor: Explicit_signed_char_struct
+      fields:
+      - explicit_signed_char_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_int_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_int_array_struct
+      fields:
+      - explicit_signed_int_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_int_pointer_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_int_pointer_array_struct
+      fields:
+      - explicit_signed_int_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_int_pointer_struct
+  representation:
+    record:
+      constructor: Explicit_signed_int_pointer_struct
+      fields:
+      - explicit_signed_int_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_int_struct
+  representation:
+    record:
+      constructor: Explicit_signed_int_struct
+      fields:
+      - explicit_signed_int_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_long_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_long_array_struct
+      fields:
+      - explicit_signed_long_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_long_long_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_long_long_array_struct
+      fields:
+      - explicit_signed_long_long_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_long_long_pointer_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_long_long_pointer_array_struct
+      fields:
+      - explicit_signed_long_long_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_long_long_pointer_struct
+  representation:
+    record:
+      constructor: Explicit_signed_long_long_pointer_struct
+      fields:
+      - explicit_signed_long_long_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_long_long_struct
+  representation:
+    record:
+      constructor: Explicit_signed_long_long_struct
+      fields:
+      - explicit_signed_long_long_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_long_pointer_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_long_pointer_array_struct
+      fields:
+      - explicit_signed_long_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_long_pointer_struct
+  representation:
+    record:
+      constructor: Explicit_signed_long_pointer_struct
+      fields:
+      - explicit_signed_long_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_long_struct
+  representation:
+    record:
+      constructor: Explicit_signed_long_struct
+      fields:
+      - explicit_signed_long_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_short_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_short_array_struct
+      fields:
+      - explicit_signed_short_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_short_pointer_array_struct
+  representation:
+    record:
+      constructor: Explicit_signed_short_pointer_array_struct
+      fields:
+      - explicit_signed_short_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_short_pointer_struct
+  representation:
+    record:
+      constructor: Explicit_signed_short_pointer_struct
+      fields:
+      - explicit_signed_short_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Explicit_signed_short_struct
+  representation:
+    record:
+      constructor: Explicit_signed_short_struct
+      fields:
+      - explicit_signed_short_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    newtype:
+      constructor: Foo
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_10
+  representation: emptydata
+- hsname: Foo_t
+  representation:
+    record:
+      constructor: Foo_t
+      fields:
+      - foo_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyArray_27
+  representation:
+    newtype:
+      constructor: MyArray_27
+      fields:
+      - unwrap
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyCoolStruct
+  representation:
+    record:
+      constructor: MyCoolStruct
+      fields:
+      - listOfNames
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyStructEmptyType
+  representation: emptydata
+- hsname: MyStructType
+  representation:
+    record:
+      constructor: MyStructType
+      fields:
+      - x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyStruct_27
+  representation:
+    record:
+      constructor: MyStruct_27
+      fields:
+      - x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyType
+  representation:
+    newtype:
+      constructor: MyType
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyTypeImpl
+  representation: emptydata
+- hsname: Ordinary_double_array_struct
+  representation:
+    record:
+      constructor: Ordinary_double_array_struct
+      fields:
+      - ordinary_double_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_double_pointer_array_struct
+  representation:
+    record:
+      constructor: Ordinary_double_pointer_array_struct
+      fields:
+      - ordinary_double_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_double_pointer_struct
+  representation:
+    record:
+      constructor: Ordinary_double_pointer_struct
+      fields:
+      - ordinary_double_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_double_struct
+  representation:
+    record:
+      constructor: Ordinary_double_struct
+      fields:
+      - ordinary_double_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_float_array_struct
+  representation:
+    record:
+      constructor: Ordinary_float_array_struct
+      fields:
+      - ordinary_float_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_float_pointer_array_struct
+  representation:
+    record:
+      constructor: Ordinary_float_pointer_array_struct
+      fields:
+      - ordinary_float_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_float_pointer_struct
+  representation:
+    record:
+      constructor: Ordinary_float_pointer_struct
+      fields:
+      - ordinary_float_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_float_struct
+  representation:
+    record:
+      constructor: Ordinary_float_struct
+      fields:
+      - ordinary_float_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_char_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_char_array_struct
+      fields:
+      - ordinary_signed_char_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_char_pointer_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_char_pointer_array_struct
+      fields:
+      - ordinary_signed_char_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_char_pointer_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_char_pointer_struct
+      fields:
+      - ordinary_signed_char_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_char_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_char_struct
+      fields:
+      - ordinary_signed_char_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_int_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_int_array_struct
+      fields:
+      - ordinary_signed_int_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_int_pointer_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_int_pointer_array_struct
+      fields:
+      - ordinary_signed_int_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_int_pointer_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_int_pointer_struct
+      fields:
+      - ordinary_signed_int_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_int_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_int_struct
+      fields:
+      - ordinary_signed_int_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_long_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_long_array_struct
+      fields:
+      - ordinary_signed_long_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_long_long_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_long_long_array_struct
+      fields:
+      - ordinary_signed_long_long_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_long_long_pointer_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_long_long_pointer_array_struct
+      fields:
+      - ordinary_signed_long_long_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_long_long_pointer_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_long_long_pointer_struct
+      fields:
+      - ordinary_signed_long_long_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_long_long_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_long_long_struct
+      fields:
+      - ordinary_signed_long_long_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_long_pointer_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_long_pointer_array_struct
+      fields:
+      - ordinary_signed_long_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_long_pointer_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_long_pointer_struct
+      fields:
+      - ordinary_signed_long_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_long_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_long_struct
+      fields:
+      - ordinary_signed_long_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_short_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_short_array_struct
+      fields:
+      - ordinary_signed_short_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_short_pointer_array_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_short_pointer_array_struct
+      fields:
+      - ordinary_signed_short_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_short_pointer_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_short_pointer_struct
+      fields:
+      - ordinary_signed_short_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_signed_short_struct
+  representation:
+    record:
+      constructor: Ordinary_signed_short_struct
+      fields:
+      - ordinary_signed_short_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_void_pointer_array_struct
+  representation:
+    record:
+      constructor: Ordinary_void_pointer_array_struct
+      fields:
+      - ordinary_void_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordinary_void_pointer_struct
+  representation:
+    record:
+      constructor: Ordinary_void_pointer_struct
+      fields:
+      - ordinary_void_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: St
+  representation:
+    record:
+      constructor: St
+      fields:
+      - i
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_char_array_struct
+  representation:
+    record:
+      constructor: Unsigned_char_array_struct
+      fields:
+      - unsigned_char_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_char_pointer_array_struct
+  representation:
+    record:
+      constructor: Unsigned_char_pointer_array_struct
+      fields:
+      - unsigned_char_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_char_pointer_struct
+  representation:
+    record:
+      constructor: Unsigned_char_pointer_struct
+      fields:
+      - unsigned_char_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_char_struct
+  representation:
+    record:
+      constructor: Unsigned_char_struct
+      fields:
+      - unsigned_char_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_int_array_struct
+  representation:
+    record:
+      constructor: Unsigned_int_array_struct
+      fields:
+      - unsigned_int_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_int_pointer_array_struct
+  representation:
+    record:
+      constructor: Unsigned_int_pointer_array_struct
+      fields:
+      - unsigned_int_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_int_pointer_struct
+  representation:
+    record:
+      constructor: Unsigned_int_pointer_struct
+      fields:
+      - unsigned_int_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_int_struct
+  representation:
+    record:
+      constructor: Unsigned_int_struct
+      fields:
+      - unsigned_int_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_long_array_struct
+  representation:
+    record:
+      constructor: Unsigned_long_array_struct
+      fields:
+      - unsigned_long_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_long_long_array_struct
+  representation:
+    record:
+      constructor: Unsigned_long_long_array_struct
+      fields:
+      - unsigned_long_long_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_long_long_pointer_array_struct
+  representation:
+    record:
+      constructor: Unsigned_long_long_pointer_array_struct
+      fields:
+      - unsigned_long_long_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_long_long_pointer_struct
+  representation:
+    record:
+      constructor: Unsigned_long_long_pointer_struct
+      fields:
+      - unsigned_long_long_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_long_long_struct
+  representation:
+    record:
+      constructor: Unsigned_long_long_struct
+      fields:
+      - unsigned_long_long_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_long_pointer_array_struct
+  representation:
+    record:
+      constructor: Unsigned_long_pointer_array_struct
+      fields:
+      - unsigned_long_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_long_pointer_struct
+  representation:
+    record:
+      constructor: Unsigned_long_pointer_struct
+      fields:
+      - unsigned_long_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_long_struct
+  representation:
+    record:
+      constructor: Unsigned_long_struct
+      fields:
+      - unsigned_long_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_short_array_struct
+  representation:
+    record:
+      constructor: Unsigned_short_array_struct
+      fields:
+      - unsigned_short_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_short_pointer_array_struct
+  representation:
+    record:
+      constructor: Unsigned_short_pointer_array_struct
+      fields:
+      - unsigned_short_pointer_array_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_short_pointer_struct
+  representation:
+    record:
+      constructor: Unsigned_short_pointer_struct
+      fields:
+      - unsigned_short_pointer_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unsigned_short_struct
+  representation:
+    record:
+      constructor: Unsigned_short_struct
+      fields:
+      - unsigned_short_member
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/comprehensive/c2hsc/th.txt b/test-artefacts/fixtures/comprehensive/c2hsc/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/c2hsc/th.txt
@@ -0,0 +1,6045 @@
+-- addDependentFile test-artefacts/headers/golden/comprehensive/c2hsc.h
+-- #include <comprehensive/c2hsc.h>
+-- void hs_bindgen_3fd2a5c6e681c44b (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (foo_function)(arg1);
+-- }
+-- unsigned int hs_bindgen_7978c370c45d3898 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (foo_33_1)(arg1);
+-- }
+-- unsigned int hs_bindgen_44aef5175928343d (
+--   unsigned int arg1
+-- )
+-- {
+--   return (foo_33_2)(arg1);
+-- }
+-- signed long long hs_bindgen_9f0b65c4b469b3d8 (
+--   signed long long arg1
+-- )
+-- {
+--   return (foo_33_3)(arg1);
+-- }
+-- void hs_bindgen_bf542a744554a894 (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (foo_function)(arg1);
+-- }
+-- unsigned int hs_bindgen_11ca53f1ea9c8230 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (foo_33_1)(arg1);
+-- }
+-- unsigned int hs_bindgen_2685a75b0196568e (
+--   unsigned int arg1
+-- )
+-- {
+--   return (foo_33_2)(arg1);
+-- }
+-- signed long long hs_bindgen_bc94ff083e65f7e0 (
+--   signed long long arg1
+-- )
+-- {
+--   return (foo_33_3)(arg1);
+-- }
+-- /* test_comprehensivec2hsc_Example_get_foo_function */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_37f32218c55b498b (void)) (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo_function;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_foo_33_1 */
+-- __attribute__ ((const))
+-- unsigned int (*hs_bindgen_482f80da2191c5d6 (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &foo_33_1;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_foo_33_2 */
+-- __attribute__ ((const))
+-- unsigned int (*hs_bindgen_c50591bcbfea3260 (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &foo_33_2;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_foo_33_3 */
+-- __attribute__ ((const))
+-- signed long long (*hs_bindgen_26b60496f499680a (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &foo_33_3;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_my_array */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_b2862a117942ba8c (void))[]) (
+--   signed int arg1
+-- )
+-- {
+--   return &my_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_float */
+-- __attribute__ ((const))
+-- float *hs_bindgen_fbe24203b7174cce (void)
+-- {
+--   return &ordinary_float;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_double */
+-- __attribute__ ((const))
+-- double *hs_bindgen_c996ca409147b439 (void)
+-- {
+--   return &ordinary_double;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_char */
+-- __attribute__ ((const))
+-- char *hs_bindgen_b5c47cbce17ba18f (void)
+-- {
+--   return &ordinary_char;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_signed_char */
+-- __attribute__ ((const))
+-- signed char *hs_bindgen_74214b0c0c8011ef (void)
+-- {
+--   return &signed_char;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_char */
+-- __attribute__ ((const))
+-- unsigned char *hs_bindgen_074079404a90186b (void)
+-- {
+--   return &unsigned_char;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_short */
+-- __attribute__ ((const))
+-- signed short *hs_bindgen_e432ab522350f84b (void)
+-- {
+--   return &ordinary_signed_short;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_short */
+-- __attribute__ ((const))
+-- signed short *hs_bindgen_17fa3df7c6690161 (void)
+-- {
+--   return &explicit_signed_short;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_short */
+-- __attribute__ ((const))
+-- unsigned short *hs_bindgen_20f280e98d58aacc (void)
+-- {
+--   return &unsigned_short;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_int */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_78b4f07c60ef3ef7 (void)
+-- {
+--   return &ordinary_signed_int;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_int */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_41643d3737e9213c (void)
+-- {
+--   return &explicit_signed_int;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_int */
+-- __attribute__ ((const))
+-- unsigned int *hs_bindgen_6e686e175c956cb8 (void)
+-- {
+--   return &unsigned_int;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_long */
+-- __attribute__ ((const))
+-- signed long *hs_bindgen_6a41c38f7fbb41d9 (void)
+-- {
+--   return &ordinary_signed_long;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_long */
+-- __attribute__ ((const))
+-- signed long *hs_bindgen_a3b5191325da8230 (void)
+-- {
+--   return &explicit_signed_long;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_long */
+-- __attribute__ ((const))
+-- unsigned long *hs_bindgen_df563b6d35ec4e8f (void)
+-- {
+--   return &unsigned_long;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_long_long */
+-- __attribute__ ((const))
+-- signed long long *hs_bindgen_59c6159f8798505a (void)
+-- {
+--   return &ordinary_signed_long_long;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_long_long */
+-- __attribute__ ((const))
+-- signed long long *hs_bindgen_bfd63280c68460d2 (void)
+-- {
+--   return &explicit_signed_long_long;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_long_long */
+-- __attribute__ ((const))
+-- unsigned long long *hs_bindgen_8654be9a041c2116 (void)
+-- {
+--   return &unsigned_long_long;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_void_pointer */
+-- __attribute__ ((const))
+-- void **hs_bindgen_d6cafaa0834895a2 (void)
+-- {
+--   return &ordinary_void_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_float_pointer */
+-- __attribute__ ((const))
+-- float **hs_bindgen_35ef3ffa1a5167f7 (void)
+-- {
+--   return &ordinary_float_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_double_pointer */
+-- __attribute__ ((const))
+-- double **hs_bindgen_5e831159f7556399 (void)
+-- {
+--   return &ordinary_double_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_char_pointer */
+-- __attribute__ ((const))
+-- char **hs_bindgen_08236e44cabe67f4 (void)
+-- {
+--   return &ordinary_char_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_signed_char_pointer */
+-- __attribute__ ((const))
+-- signed char **hs_bindgen_66d08eddc2fecb35 (void)
+-- {
+--   return &signed_char_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_char_pointer */
+-- __attribute__ ((const))
+-- unsigned char **hs_bindgen_5c76c506cb4fd78e (void)
+-- {
+--   return &unsigned_char_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer */
+-- __attribute__ ((const))
+-- signed short **hs_bindgen_cd114d033253fe37 (void)
+-- {
+--   return &ordinary_signed_short_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer */
+-- __attribute__ ((const))
+-- signed short **hs_bindgen_49ffa4c56ce34e2f (void)
+-- {
+--   return &explicit_signed_short_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_short_pointer */
+-- __attribute__ ((const))
+-- unsigned short **hs_bindgen_fb80ad6945c7151d (void)
+-- {
+--   return &unsigned_short_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer */
+-- __attribute__ ((const))
+-- signed int **hs_bindgen_dfef04ad64871bf8 (void)
+-- {
+--   return &ordinary_signed_int_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer */
+-- __attribute__ ((const))
+-- signed int **hs_bindgen_515d5232453c4285 (void)
+-- {
+--   return &explicit_signed_int_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_int_pointer */
+-- __attribute__ ((const))
+-- unsigned int **hs_bindgen_9f2724dae8d3b3fa (void)
+-- {
+--   return &unsigned_int_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer */
+-- __attribute__ ((const))
+-- signed long **hs_bindgen_a6b4a786a6644424 (void)
+-- {
+--   return &ordinary_signed_long_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer */
+-- __attribute__ ((const))
+-- signed long **hs_bindgen_4df40729ac557753 (void)
+-- {
+--   return &explicit_signed_long_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_long_pointer */
+-- __attribute__ ((const))
+-- unsigned long **hs_bindgen_30379268a6bf43b0 (void)
+-- {
+--   return &unsigned_long_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer */
+-- __attribute__ ((const))
+-- signed long long **hs_bindgen_63dedd7015d9ed47 (void)
+-- {
+--   return &ordinary_signed_long_long_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer */
+-- __attribute__ ((const))
+-- signed long long **hs_bindgen_9f47ed329f79e647 (void)
+-- {
+--   return &explicit_signed_long_long_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer */
+-- __attribute__ ((const))
+-- unsigned long long **hs_bindgen_7d2dd0a78dde4b41 (void)
+-- {
+--   return &unsigned_long_long_pointer;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_float_array */
+-- __attribute__ ((const))
+-- float (*hs_bindgen_dbf314f660deda12 (void))[10]
+-- {
+--   return &ordinary_float_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_double_array */
+-- __attribute__ ((const))
+-- double (*hs_bindgen_d554c83416b4ffaa (void))[10]
+-- {
+--   return &ordinary_double_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_char_array */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_9a57c94ff3fad985 (void))[10]
+-- {
+--   return &ordinary_signed_char_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_char_array */
+-- __attribute__ ((const))
+-- signed char (*hs_bindgen_335217e9e2c8fe6a (void))[10]
+-- {
+--   return &explicit_signed_char_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_char_array */
+-- __attribute__ ((const))
+-- unsigned char (*hs_bindgen_1e72daddbfe2b7ac (void))[10]
+-- {
+--   return &unsigned_char_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_short_array */
+-- __attribute__ ((const))
+-- signed short (*hs_bindgen_109462175baa2bdf (void))[10]
+-- {
+--   return &ordinary_signed_short_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_short_array */
+-- __attribute__ ((const))
+-- signed short (*hs_bindgen_50f788c18928793d (void))[10]
+-- {
+--   return &explicit_signed_short_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_short_array */
+-- __attribute__ ((const))
+-- unsigned short (*hs_bindgen_d5ccc3314ab2eb42 (void))[10]
+-- {
+--   return &unsigned_short_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_int_array */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_f7824c4ee10b0b90 (void))[10]
+-- {
+--   return &ordinary_signed_int_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_int_array */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_448c7a47209c8b7a (void))[10]
+-- {
+--   return &explicit_signed_int_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_int_array */
+-- __attribute__ ((const))
+-- unsigned int (*hs_bindgen_66499a8ae9382b9e (void))[10]
+-- {
+--   return &unsigned_int_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_long_array */
+-- __attribute__ ((const))
+-- signed long (*hs_bindgen_896d3ba25d886356 (void))[10]
+-- {
+--   return &ordinary_signed_long_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_long_array */
+-- __attribute__ ((const))
+-- signed long (*hs_bindgen_c4ec5e2d6cf5b5ed (void))[10]
+-- {
+--   return &explicit_signed_long_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_long_array */
+-- __attribute__ ((const))
+-- unsigned long (*hs_bindgen_e3fb79df55414b09 (void))[10]
+-- {
+--   return &unsigned_long_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_array */
+-- __attribute__ ((const))
+-- signed long long (*hs_bindgen_02c15bdcdfc54945 (void))[10]
+-- {
+--   return &ordinary_signed_long_long_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_long_long_array */
+-- __attribute__ ((const))
+-- signed long long (*hs_bindgen_4c934e5832898551 (void))[10]
+-- {
+--   return &explicit_signed_long_long_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_long_long_array */
+-- __attribute__ ((const))
+-- unsigned long long (*hs_bindgen_af47cf5cc0016405 (void))[10]
+-- {
+--   return &unsigned_long_long_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_void_pointer_array */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_b0da135021f97e27 (void))[10]
+-- {
+--   return &ordinary_void_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_float_pointer_array */
+-- __attribute__ ((const))
+-- float *(*hs_bindgen_41ce3a49f177f5a8 (void))[10]
+-- {
+--   return &ordinary_float_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_double_pointer_array */
+-- __attribute__ ((const))
+-- double *(*hs_bindgen_cfe3890477df51c8 (void))[10]
+-- {
+--   return &ordinary_double_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_char_pointer_array */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_e92be5e29785f22b (void))[10]
+-- {
+--   return &ordinary_signed_char_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_char_pointer_array */
+-- __attribute__ ((const))
+-- signed char *(*hs_bindgen_c8caf99249e8ad58 (void))[10]
+-- {
+--   return &explicit_signed_char_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_char_pointer_array */
+-- __attribute__ ((const))
+-- unsigned char *(*hs_bindgen_7028963176c7a21d (void))[10]
+-- {
+--   return &unsigned_char_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer_array */
+-- __attribute__ ((const))
+-- signed short *(*hs_bindgen_1866849231d566a0 (void))[10]
+-- {
+--   return &ordinary_signed_short_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer_array */
+-- __attribute__ ((const))
+-- signed short *(*hs_bindgen_68ed6d444e1b6011 (void))[10]
+-- {
+--   return &explicit_signed_short_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_short_pointer_array */
+-- __attribute__ ((const))
+-- unsigned short *(*hs_bindgen_7c0ca48c3269649a (void))[10]
+-- {
+--   return &unsigned_short_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer_array */
+-- __attribute__ ((const))
+-- signed int *(*hs_bindgen_58e6503e8ccbeb70 (void))[10]
+-- {
+--   return &ordinary_signed_int_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer_array */
+-- __attribute__ ((const))
+-- signed int *(*hs_bindgen_21b8395de873bc0a (void))[10]
+-- {
+--   return &explicit_signed_int_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_int_pointer_array */
+-- __attribute__ ((const))
+-- unsigned int *(*hs_bindgen_667d31d5b7b5106e (void))[10]
+-- {
+--   return &unsigned_int_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer_array */
+-- __attribute__ ((const))
+-- signed long *(*hs_bindgen_eb34bb7d213dcd3d (void))[10]
+-- {
+--   return &ordinary_signed_long_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer_array */
+-- __attribute__ ((const))
+-- signed long *(*hs_bindgen_3386ff9d0e54545d (void))[10]
+-- {
+--   return &explicit_signed_long_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_long_pointer_array */
+-- __attribute__ ((const))
+-- unsigned long *(*hs_bindgen_510be86496a28c91 (void))[10]
+-- {
+--   return &unsigned_long_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer_array */
+-- __attribute__ ((const))
+-- signed long long *(*hs_bindgen_25f60aa140d341a7 (void))[10]
+-- {
+--   return &ordinary_signed_long_long_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer_array */
+-- __attribute__ ((const))
+-- signed long long *(*hs_bindgen_aced8afe33f53905 (void))[10]
+-- {
+--   return &explicit_signed_long_long_pointer_array;
+-- }
+-- /* test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer_array */
+-- __attribute__ ((const))
+-- unsigned long long *(*hs_bindgen_9534a7c84390edc4 (void))[10]
+-- {
+--   return &unsigned_long_long_pointer_array;
+-- }
+{-| Issues
+
+    __C declaration:__ @an_pchar@
+
+    __defined at:__ @comprehensive\/c2hsc.h 12:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype An_pchar
+    = An_pchar {unwrap :: (PtrConst CChar)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CChar) => HasField "unwrap" An_pchar ty
+    where hasField = \x_0 -> (\y_1 -> An_pchar{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty (PtrConst CChar) =>
+         HasField "unwrap" (Ptr An_pchar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField An_pchar "unwrap"
+    where type CFieldType An_pchar "unwrap" = PtrConst CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct MyCoolStruct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 15:9@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyCoolStruct
+    = MyCoolStruct {listOfNames :: (ConstantArray 8
+                                                  (ConstantArray 255 CChar))
+                    {- ^ __C declaration:__ @listOfNames@
+
+                         __defined at:__ @comprehensive\/c2hsc.h 16:10@
+
+                         __exported by:__ @comprehensive\/c2hsc.h@
+                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize MyCoolStruct
+    where staticSizeOf = \_ -> 2040 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw MyCoolStruct
+    where readRaw = \ptr_0 -> pure MyCoolStruct <*> readRaw (Proxy @"listOfNames") ptr_0
+instance WriteRaw MyCoolStruct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MyCoolStruct listOfNames_2 -> writeRaw (Proxy @"listOfNames") ptr_0 listOfNames_2
+deriving via (EquivStorable MyCoolStruct) instance Storable MyCoolStruct
+deriving via (IsStructViaReadRaw MyCoolStruct) instance IsStruct MyCoolStruct
+instance (~) ty (ConstantArray 8 (ConstantArray 255 CChar)) =>
+         HasField "listOfNames" MyCoolStruct ty
+    where hasField = \x_0 -> (\y_1 -> MyCoolStruct{listOfNames = y_1},
+                              getField @"listOfNames" x_0)
+instance (~) ty (ConstantArray 8 (ConstantArray 255 CChar)) =>
+         HasField "listOfNames" (Ptr MyCoolStruct) (Ptr ty)
+    where getField = fromPtr (Proxy @"listOfNames")
+instance HasCField MyCoolStruct "listOfNames"
+    where type CFieldType MyCoolStruct "listOfNames" = ConstantArray 8
+                                                                     (ConstantArray 255 CChar)
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Foo'
+
+    __C declaration:__ @foo@
+
+    __defined at:__ @comprehensive\/c2hsc.h 20:15@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Foo_Aux
+    = Foo_Aux {unwrap :: (CInt -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toFoo_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b5a7b5e83ffee6b4_base ::
+    CInt -> IO CInt
+ -> IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @toFoo_Aux@
+hs_bindgen_b5a7b5e83ffee6b4 :: Foo_Aux -> IO (FunPtr Foo_Aux)
+-- __unique:__ @toFoo_Aux@
+hs_bindgen_b5a7b5e83ffee6b4 = \fun_0 -> fmap castFunPtr (hs_bindgen_b5a7b5e83ffee6b4_base (\x_1 -> fmap toFFIType (getField @"unwrap" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromFoo_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_223d08172bb37c01_base ::
+    FunPtr (CInt -> IO CInt)
+ -> CInt
+ -> IO CInt
+-- __unique:__ @fromFoo_Aux@
+hs_bindgen_223d08172bb37c01 :: FunPtr Foo_Aux -> Foo_Aux
+-- __unique:__ @fromFoo_Aux@
+hs_bindgen_223d08172bb37c01 = \funPtr_0 -> Foo_Aux (\x_1 -> fmap fromFFIType (hs_bindgen_223d08172bb37c01_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr Foo_Aux
+    where toFunPtr = hs_bindgen_b5a7b5e83ffee6b4
+instance FromFunPtr Foo_Aux
+    where fromFunPtr = hs_bindgen_223d08172bb37c01
+instance (~) ty (CInt -> IO CInt) => HasField "unwrap" Foo_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Foo_Aux{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrap" (Ptr Foo_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Foo_Aux "unwrap"
+    where type CFieldType Foo_Aux "unwrap" = CInt -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @comprehensive\/c2hsc.h 20:15@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Foo
+    = Foo {unwrap :: (FunPtr Foo_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Foo_Aux) => HasField "unwrap" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty (FunPtr Foo_Aux) =>
+         HasField "unwrap" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Foo "unwrap"
+    where type CFieldType Foo "unwrap" = FunPtr Foo_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct foo_t@
+
+    __defined at:__ @comprehensive\/c2hsc.h 31:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Foo_t
+    = Foo_t {foo_member :: (FunPtr (CInt -> IO CInt))
+             {- ^ __C declaration:__ @foo_member@
+
+                  __defined at:__ @comprehensive\/c2hsc.h 32:11@
+
+                  __exported by:__ @comprehensive\/c2hsc.h@
+             -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo_t
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Foo_t
+    where readRaw = \ptr_0 -> pure Foo_t <*> readRaw (Proxy @"foo_member") ptr_0
+instance WriteRaw Foo_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo_t foo_member_2 -> writeRaw (Proxy @"foo_member") ptr_0 foo_member_2
+deriving via (EquivStorable Foo_t) instance Storable Foo_t
+deriving via (IsStructViaReadRaw Foo_t) instance IsStruct Foo_t
+instance (~) ty (FunPtr (CInt -> IO CInt)) =>
+         HasField "foo_member" Foo_t ty
+    where hasField = \x_0 -> (\y_1 -> Foo_t{foo_member = y_1},
+                              getField @"foo_member" x_0)
+instance (~) ty (FunPtr (CInt -> IO CInt)) =>
+         HasField "foo_member" (Ptr Foo_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_member")
+instance HasCField Foo_t "foo_member"
+    where type CFieldType Foo_t "foo_member" = FunPtr (CInt -> IO CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct Foo_10_@
+
+    __defined at:__ @comprehensive\/c2hsc.h 44:16@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Foo_10
+{-| __C declaration:__ @enum Bar_10_@
+
+    __defined at:__ @comprehensive\/c2hsc.h 45:14@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Bar_10
+    = Bar_10 {unwrap :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Bar_10
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bar_10
+    where readRaw = \ptr_0 -> pure Bar_10 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Bar_10
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_10 unwrap_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrap_2
+deriving via (EquivStorable Bar_10) instance Storable Bar_10
+deriving via CUInt instance Prim Bar_10
+instance CEnum Bar_10
+    where type CEnumZ Bar_10 = CUInt
+          toCEnum = Bar_10
+          fromCEnum = getField @"unwrap"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "BAR")]
+          showsUndeclared = showsWrappedUndeclared "Bar_10"
+          readPrecUndeclared = readPrecWrappedUndeclared "Bar_10"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Bar_10
+    where minDeclaredValue = BAR
+          maxDeclaredValue = BAR
+instance Show Bar_10
+    where showsPrec = shows
+instance Read Bar_10
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrap" Bar_10 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_10{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty CUInt => HasField "unwrap" (Ptr Bar_10) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Bar_10 "unwrap"
+    where type CFieldType Bar_10 "unwrap" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @BAR@
+
+    __defined at:__ @comprehensive\/c2hsc.h 45:24@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+pattern BAR :: Bar_10
+pattern BAR = Bar_10 0
+{-| __C declaration:__ @struct st@
+
+    __defined at:__ @comprehensive\/c2hsc.h 48:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data St
+    = St {i :: CInt
+          {- ^ __C declaration:__ @i@
+
+               __defined at:__ @comprehensive\/c2hsc.h 49:7@
+
+               __exported by:__ @comprehensive\/c2hsc.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize St
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw St
+    where readRaw = \ptr_0 -> pure St <*> readRaw (Proxy @"i") ptr_0
+instance WriteRaw St
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       St i_2 -> writeRaw (Proxy @"i") ptr_0 i_2
+deriving via (EquivStorable St) instance Storable St
+deriving via (IsStructViaReadRaw St) instance IsStruct St
+instance (~) ty CInt => HasField "i" St ty
+    where hasField = \x_0 -> (\y_1 -> St{i = y_1}, getField @"i" x_0)
+instance (~) ty CInt => HasField "i" (Ptr St) (Ptr ty)
+    where getField = fromPtr (Proxy @"i")
+instance HasCField St "i"
+    where type CFieldType St "i" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @enum e@
+
+    __defined at:__ @comprehensive\/c2hsc.h 52:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype E
+    = E {unwrap :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E
+    where readRaw = \ptr_0 -> pure E <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E unwrap_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrap_2
+deriving via (EquivStorable E) instance Storable E
+deriving via CUInt instance Prim E
+instance CEnum E
+    where type CEnumZ E = CUInt
+          toCEnum = E
+          fromCEnum = getField @"unwrap"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "CONST")]
+          showsUndeclared = showsWrappedUndeclared "E"
+          readPrecUndeclared = readPrecWrappedUndeclared "E"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E
+    where minDeclaredValue = CONST
+          maxDeclaredValue = CONST
+instance Show E
+    where showsPrec = shows
+instance Read E
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrap" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty CUInt => HasField "unwrap" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField E "unwrap"
+    where type CFieldType E "unwrap" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @CONST@
+
+    __defined at:__ @comprehensive\/c2hsc.h 53:3@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+pattern CONST :: E
+pattern CONST = E 0
+{-| __C declaration:__ @union u@
+
+    __defined at:__ @comprehensive\/c2hsc.h 56:7@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype U = U {unwrap :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 1 1) instance StaticSize U
+deriving via (SizedByteArray 1 1) instance ReadRaw U
+deriving via (SizedByteArray 1 1) instance WriteRaw U
+deriving via (EquivStorable U) instance Storable U
+deriving via (SizedByteArray 1 1) instance IsUnion U
+instance (~) ty CChar => HasField "c" U ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "c" U ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"c" x_0)
+instance (~) ty CChar => HasField "c" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"c")
+instance HasCField U "c"
+    where type CFieldType U "c" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct MyTypeImpl@
+
+    __defined at:__ @comprehensive\/c2hsc.h 61:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyTypeImpl
+{-| __C declaration:__ @MyType@
+
+    __defined at:__ @comprehensive\/c2hsc.h 62:28@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype MyType
+    = MyType {unwrap :: (Ptr MyTypeImpl)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr MyTypeImpl) => HasField "unwrap" MyType ty
+    where hasField = \x_0 -> (\y_1 -> MyType{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty (Ptr MyTypeImpl) =>
+         HasField "unwrap" (Ptr MyType) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField MyType "unwrap"
+    where type CFieldType MyType "unwrap" = Ptr MyTypeImpl
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct MyStruct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 64:16@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyStructType
+    = MyStructType {x :: CInt
+                    {- ^ __C declaration:__ @x@
+
+                         __defined at:__ @comprehensive\/c2hsc.h 65:7@
+
+                         __exported by:__ @comprehensive\/c2hsc.h@
+                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize MyStructType
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw MyStructType
+    where readRaw = \ptr_0 -> pure MyStructType <*> readRaw (Proxy @"x") ptr_0
+instance WriteRaw MyStructType
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MyStructType x_2 -> writeRaw (Proxy @"x") ptr_0 x_2
+deriving via (EquivStorable MyStructType) instance Storable MyStructType
+deriving via (IsStructViaReadRaw MyStructType) instance IsStruct MyStructType
+instance (~) ty CInt => HasField "x" MyStructType ty
+    where hasField = \x_0 -> (\y_1 -> MyStructType{x = y_1},
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr MyStructType) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField MyStructType "x"
+    where type CFieldType MyStructType "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct MyStructEmpty@
+
+    __defined at:__ @comprehensive\/c2hsc.h 68:16@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyStructEmptyType
+{-| Structs: primitive types
+
+    __C declaration:__ @struct ordinary_float_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 204:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_float_struct
+    = Ordinary_float_struct {ordinary_float_member :: CFloat
+                             {- ^ __C declaration:__ @ordinary_float_member@
+
+                                  __defined at:__ @comprehensive\/c2hsc.h 204:62@
+
+                                  __exported by:__ @comprehensive\/c2hsc.h@
+                             -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_float_struct
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Ordinary_float_struct
+    where readRaw = \ptr_0 -> pure Ordinary_float_struct <*> readRaw (Proxy @"ordinary_float_member") ptr_0
+instance WriteRaw Ordinary_float_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_float_struct ordinary_float_member_2 -> writeRaw (Proxy @"ordinary_float_member") ptr_0 ordinary_float_member_2
+deriving via (EquivStorable Ordinary_float_struct) instance Storable Ordinary_float_struct
+deriving via (IsStructViaReadRaw Ordinary_float_struct) instance IsStruct Ordinary_float_struct
+instance (~) ty CFloat =>
+         HasField "ordinary_float_member" Ordinary_float_struct ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_float_struct{ordinary_float_member = y_1},
+                              getField @"ordinary_float_member" x_0)
+instance (~) ty CFloat =>
+         HasField "ordinary_float_member"
+                  (Ptr Ordinary_float_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_float_member")
+instance HasCField Ordinary_float_struct "ordinary_float_member"
+    where type CFieldType Ordinary_float_struct
+                          "ordinary_float_member" = CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_double_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 205:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_double_struct
+    = Ordinary_double_struct {ordinary_double_member :: CDouble
+                              {- ^ __C declaration:__ @ordinary_double_member@
+
+                                   __defined at:__ @comprehensive\/c2hsc.h 205:62@
+
+                                   __exported by:__ @comprehensive\/c2hsc.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_double_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_double_struct
+    where readRaw = \ptr_0 -> pure Ordinary_double_struct <*> readRaw (Proxy @"ordinary_double_member") ptr_0
+instance WriteRaw Ordinary_double_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_double_struct ordinary_double_member_2 -> writeRaw (Proxy @"ordinary_double_member") ptr_0 ordinary_double_member_2
+deriving via (EquivStorable Ordinary_double_struct) instance Storable Ordinary_double_struct
+deriving via (IsStructViaReadRaw Ordinary_double_struct) instance IsStruct Ordinary_double_struct
+instance (~) ty CDouble =>
+         HasField "ordinary_double_member" Ordinary_double_struct ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_double_struct{ordinary_double_member = y_1},
+                              getField @"ordinary_double_member" x_0)
+instance (~) ty CDouble =>
+         HasField "ordinary_double_member"
+                  (Ptr Ordinary_double_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_double_member")
+instance HasCField Ordinary_double_struct "ordinary_double_member"
+    where type CFieldType Ordinary_double_struct
+                          "ordinary_double_member" = CDouble
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_char_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 208:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_char_struct
+    = Ordinary_signed_char_struct {ordinary_signed_char_member :: CChar
+                                   {- ^ __C declaration:__ @ordinary_signed_char_member@
+
+                                        __defined at:__ @comprehensive\/c2hsc.h 208:62@
+
+                                        __exported by:__ @comprehensive\/c2hsc.h@
+                                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_char_struct
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Ordinary_signed_char_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_char_struct <*> readRaw (Proxy @"ordinary_signed_char_member") ptr_0
+instance WriteRaw Ordinary_signed_char_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_char_struct ordinary_signed_char_member_2 -> writeRaw (Proxy @"ordinary_signed_char_member") ptr_0 ordinary_signed_char_member_2
+deriving via (EquivStorable Ordinary_signed_char_struct) instance Storable Ordinary_signed_char_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_char_struct) instance IsStruct Ordinary_signed_char_struct
+instance (~) ty CChar =>
+         HasField "ordinary_signed_char_member"
+                  Ordinary_signed_char_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_char_struct{ordinary_signed_char_member = y_1},
+                              getField @"ordinary_signed_char_member" x_0)
+instance (~) ty CChar =>
+         HasField "ordinary_signed_char_member"
+                  (Ptr Ordinary_signed_char_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_char_member")
+instance HasCField Ordinary_signed_char_struct
+                   "ordinary_signed_char_member"
+    where type CFieldType Ordinary_signed_char_struct
+                          "ordinary_signed_char_member" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_char_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 209:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_char_struct
+    = Explicit_signed_char_struct {explicit_signed_char_member :: CSChar
+                                   {- ^ __C declaration:__ @explicit_signed_char_member@
+
+                                        __defined at:__ @comprehensive\/c2hsc.h 209:62@
+
+                                        __exported by:__ @comprehensive\/c2hsc.h@
+                                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_char_struct
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Explicit_signed_char_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_char_struct <*> readRaw (Proxy @"explicit_signed_char_member") ptr_0
+instance WriteRaw Explicit_signed_char_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_char_struct explicit_signed_char_member_2 -> writeRaw (Proxy @"explicit_signed_char_member") ptr_0 explicit_signed_char_member_2
+deriving via (EquivStorable Explicit_signed_char_struct) instance Storable Explicit_signed_char_struct
+deriving via (IsStructViaReadRaw Explicit_signed_char_struct) instance IsStruct Explicit_signed_char_struct
+instance (~) ty CSChar =>
+         HasField "explicit_signed_char_member"
+                  Explicit_signed_char_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_char_struct{explicit_signed_char_member = y_1},
+                              getField @"explicit_signed_char_member" x_0)
+instance (~) ty CSChar =>
+         HasField "explicit_signed_char_member"
+                  (Ptr Explicit_signed_char_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_char_member")
+instance HasCField Explicit_signed_char_struct
+                   "explicit_signed_char_member"
+    where type CFieldType Explicit_signed_char_struct
+                          "explicit_signed_char_member" = CSChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_char_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 210:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_char_struct
+    = Unsigned_char_struct {unsigned_char_member :: CUChar
+                            {- ^ __C declaration:__ @unsigned_char_member@
+
+                                 __defined at:__ @comprehensive\/c2hsc.h 210:62@
+
+                                 __exported by:__ @comprehensive\/c2hsc.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_char_struct
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Unsigned_char_struct
+    where readRaw = \ptr_0 -> pure Unsigned_char_struct <*> readRaw (Proxy @"unsigned_char_member") ptr_0
+instance WriteRaw Unsigned_char_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_char_struct unsigned_char_member_2 -> writeRaw (Proxy @"unsigned_char_member") ptr_0 unsigned_char_member_2
+deriving via (EquivStorable Unsigned_char_struct) instance Storable Unsigned_char_struct
+deriving via (IsStructViaReadRaw Unsigned_char_struct) instance IsStruct Unsigned_char_struct
+instance (~) ty CUChar =>
+         HasField "unsigned_char_member" Unsigned_char_struct ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_char_struct{unsigned_char_member = y_1},
+                              getField @"unsigned_char_member" x_0)
+instance (~) ty CUChar =>
+         HasField "unsigned_char_member" (Ptr Unsigned_char_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_char_member")
+instance HasCField Unsigned_char_struct "unsigned_char_member"
+    where type CFieldType Unsigned_char_struct
+                          "unsigned_char_member" = CUChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_short_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 212:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_short_struct
+    = Ordinary_signed_short_struct {ordinary_signed_short_member :: CShort
+                                    {- ^ __C declaration:__ @ordinary_signed_short_member@
+
+                                         __defined at:__ @comprehensive\/c2hsc.h 212:62@
+
+                                         __exported by:__ @comprehensive\/c2hsc.h@
+                                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_short_struct
+    where staticSizeOf = \_ -> 2 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Ordinary_signed_short_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_short_struct <*> readRaw (Proxy @"ordinary_signed_short_member") ptr_0
+instance WriteRaw Ordinary_signed_short_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_short_struct ordinary_signed_short_member_2 -> writeRaw (Proxy @"ordinary_signed_short_member") ptr_0 ordinary_signed_short_member_2
+deriving via (EquivStorable Ordinary_signed_short_struct) instance Storable Ordinary_signed_short_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_short_struct) instance IsStruct Ordinary_signed_short_struct
+instance (~) ty CShort =>
+         HasField "ordinary_signed_short_member"
+                  Ordinary_signed_short_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_short_struct{ordinary_signed_short_member = y_1},
+                              getField @"ordinary_signed_short_member" x_0)
+instance (~) ty CShort =>
+         HasField "ordinary_signed_short_member"
+                  (Ptr Ordinary_signed_short_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_short_member")
+instance HasCField Ordinary_signed_short_struct
+                   "ordinary_signed_short_member"
+    where type CFieldType Ordinary_signed_short_struct
+                          "ordinary_signed_short_member" = CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_short_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 213:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_short_struct
+    = Explicit_signed_short_struct {explicit_signed_short_member :: CShort
+                                    {- ^ __C declaration:__ @explicit_signed_short_member@
+
+                                         __defined at:__ @comprehensive\/c2hsc.h 213:62@
+
+                                         __exported by:__ @comprehensive\/c2hsc.h@
+                                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_short_struct
+    where staticSizeOf = \_ -> 2 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Explicit_signed_short_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_short_struct <*> readRaw (Proxy @"explicit_signed_short_member") ptr_0
+instance WriteRaw Explicit_signed_short_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_short_struct explicit_signed_short_member_2 -> writeRaw (Proxy @"explicit_signed_short_member") ptr_0 explicit_signed_short_member_2
+deriving via (EquivStorable Explicit_signed_short_struct) instance Storable Explicit_signed_short_struct
+deriving via (IsStructViaReadRaw Explicit_signed_short_struct) instance IsStruct Explicit_signed_short_struct
+instance (~) ty CShort =>
+         HasField "explicit_signed_short_member"
+                  Explicit_signed_short_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_short_struct{explicit_signed_short_member = y_1},
+                              getField @"explicit_signed_short_member" x_0)
+instance (~) ty CShort =>
+         HasField "explicit_signed_short_member"
+                  (Ptr Explicit_signed_short_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_short_member")
+instance HasCField Explicit_signed_short_struct
+                   "explicit_signed_short_member"
+    where type CFieldType Explicit_signed_short_struct
+                          "explicit_signed_short_member" = CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_short_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 214:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_short_struct
+    = Unsigned_short_struct {unsigned_short_member :: CUShort
+                             {- ^ __C declaration:__ @unsigned_short_member@
+
+                                  __defined at:__ @comprehensive\/c2hsc.h 214:62@
+
+                                  __exported by:__ @comprehensive\/c2hsc.h@
+                             -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_short_struct
+    where staticSizeOf = \_ -> 2 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Unsigned_short_struct
+    where readRaw = \ptr_0 -> pure Unsigned_short_struct <*> readRaw (Proxy @"unsigned_short_member") ptr_0
+instance WriteRaw Unsigned_short_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_short_struct unsigned_short_member_2 -> writeRaw (Proxy @"unsigned_short_member") ptr_0 unsigned_short_member_2
+deriving via (EquivStorable Unsigned_short_struct) instance Storable Unsigned_short_struct
+deriving via (IsStructViaReadRaw Unsigned_short_struct) instance IsStruct Unsigned_short_struct
+instance (~) ty CUShort =>
+         HasField "unsigned_short_member" Unsigned_short_struct ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_short_struct{unsigned_short_member = y_1},
+                              getField @"unsigned_short_member" x_0)
+instance (~) ty CUShort =>
+         HasField "unsigned_short_member"
+                  (Ptr Unsigned_short_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_short_member")
+instance HasCField Unsigned_short_struct "unsigned_short_member"
+    where type CFieldType Unsigned_short_struct
+                          "unsigned_short_member" = CUShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_int_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 216:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_int_struct
+    = Ordinary_signed_int_struct {ordinary_signed_int_member :: CInt
+                                  {- ^ __C declaration:__ @ordinary_signed_int_member@
+
+                                       __defined at:__ @comprehensive\/c2hsc.h 216:62@
+
+                                       __exported by:__ @comprehensive\/c2hsc.h@
+                                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_int_struct
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Ordinary_signed_int_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_int_struct <*> readRaw (Proxy @"ordinary_signed_int_member") ptr_0
+instance WriteRaw Ordinary_signed_int_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_int_struct ordinary_signed_int_member_2 -> writeRaw (Proxy @"ordinary_signed_int_member") ptr_0 ordinary_signed_int_member_2
+deriving via (EquivStorable Ordinary_signed_int_struct) instance Storable Ordinary_signed_int_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_int_struct) instance IsStruct Ordinary_signed_int_struct
+instance (~) ty CInt =>
+         HasField "ordinary_signed_int_member" Ordinary_signed_int_struct ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_int_struct{ordinary_signed_int_member = y_1},
+                              getField @"ordinary_signed_int_member" x_0)
+instance (~) ty CInt =>
+         HasField "ordinary_signed_int_member"
+                  (Ptr Ordinary_signed_int_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_int_member")
+instance HasCField Ordinary_signed_int_struct
+                   "ordinary_signed_int_member"
+    where type CFieldType Ordinary_signed_int_struct
+                          "ordinary_signed_int_member" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_int_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 217:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_int_struct
+    = Explicit_signed_int_struct {explicit_signed_int_member :: CInt
+                                  {- ^ __C declaration:__ @explicit_signed_int_member@
+
+                                       __defined at:__ @comprehensive\/c2hsc.h 217:62@
+
+                                       __exported by:__ @comprehensive\/c2hsc.h@
+                                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_int_struct
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Explicit_signed_int_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_int_struct <*> readRaw (Proxy @"explicit_signed_int_member") ptr_0
+instance WriteRaw Explicit_signed_int_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_int_struct explicit_signed_int_member_2 -> writeRaw (Proxy @"explicit_signed_int_member") ptr_0 explicit_signed_int_member_2
+deriving via (EquivStorable Explicit_signed_int_struct) instance Storable Explicit_signed_int_struct
+deriving via (IsStructViaReadRaw Explicit_signed_int_struct) instance IsStruct Explicit_signed_int_struct
+instance (~) ty CInt =>
+         HasField "explicit_signed_int_member" Explicit_signed_int_struct ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_int_struct{explicit_signed_int_member = y_1},
+                              getField @"explicit_signed_int_member" x_0)
+instance (~) ty CInt =>
+         HasField "explicit_signed_int_member"
+                  (Ptr Explicit_signed_int_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_int_member")
+instance HasCField Explicit_signed_int_struct
+                   "explicit_signed_int_member"
+    where type CFieldType Explicit_signed_int_struct
+                          "explicit_signed_int_member" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_int_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 218:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_int_struct
+    = Unsigned_int_struct {unsigned_int_member :: CUInt
+                           {- ^ __C declaration:__ @unsigned_int_member@
+
+                                __defined at:__ @comprehensive\/c2hsc.h 218:62@
+
+                                __exported by:__ @comprehensive\/c2hsc.h@
+                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_int_struct
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Unsigned_int_struct
+    where readRaw = \ptr_0 -> pure Unsigned_int_struct <*> readRaw (Proxy @"unsigned_int_member") ptr_0
+instance WriteRaw Unsigned_int_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_int_struct unsigned_int_member_2 -> writeRaw (Proxy @"unsigned_int_member") ptr_0 unsigned_int_member_2
+deriving via (EquivStorable Unsigned_int_struct) instance Storable Unsigned_int_struct
+deriving via (IsStructViaReadRaw Unsigned_int_struct) instance IsStruct Unsigned_int_struct
+instance (~) ty CUInt =>
+         HasField "unsigned_int_member" Unsigned_int_struct ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_int_struct{unsigned_int_member = y_1},
+                              getField @"unsigned_int_member" x_0)
+instance (~) ty CUInt =>
+         HasField "unsigned_int_member" (Ptr Unsigned_int_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_int_member")
+instance HasCField Unsigned_int_struct "unsigned_int_member"
+    where type CFieldType Unsigned_int_struct
+                          "unsigned_int_member" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 220:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_struct
+    = Ordinary_signed_long_struct {ordinary_signed_long_member :: CLong
+                                   {- ^ __C declaration:__ @ordinary_signed_long_member@
+
+                                        __defined at:__ @comprehensive\/c2hsc.h 220:62@
+
+                                        __exported by:__ @comprehensive\/c2hsc.h@
+                                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_long_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_long_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_long_struct <*> readRaw (Proxy @"ordinary_signed_long_member") ptr_0
+instance WriteRaw Ordinary_signed_long_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_long_struct ordinary_signed_long_member_2 -> writeRaw (Proxy @"ordinary_signed_long_member") ptr_0 ordinary_signed_long_member_2
+deriving via (EquivStorable Ordinary_signed_long_struct) instance Storable Ordinary_signed_long_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_long_struct) instance IsStruct Ordinary_signed_long_struct
+instance (~) ty CLong =>
+         HasField "ordinary_signed_long_member"
+                  Ordinary_signed_long_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_long_struct{ordinary_signed_long_member = y_1},
+                              getField @"ordinary_signed_long_member" x_0)
+instance (~) ty CLong =>
+         HasField "ordinary_signed_long_member"
+                  (Ptr Ordinary_signed_long_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_long_member")
+instance HasCField Ordinary_signed_long_struct
+                   "ordinary_signed_long_member"
+    where type CFieldType Ordinary_signed_long_struct
+                          "ordinary_signed_long_member" = CLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 221:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_struct
+    = Explicit_signed_long_struct {explicit_signed_long_member :: CLong
+                                   {- ^ __C declaration:__ @explicit_signed_long_member@
+
+                                        __defined at:__ @comprehensive\/c2hsc.h 221:62@
+
+                                        __exported by:__ @comprehensive\/c2hsc.h@
+                                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_long_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_long_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_long_struct <*> readRaw (Proxy @"explicit_signed_long_member") ptr_0
+instance WriteRaw Explicit_signed_long_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_long_struct explicit_signed_long_member_2 -> writeRaw (Proxy @"explicit_signed_long_member") ptr_0 explicit_signed_long_member_2
+deriving via (EquivStorable Explicit_signed_long_struct) instance Storable Explicit_signed_long_struct
+deriving via (IsStructViaReadRaw Explicit_signed_long_struct) instance IsStruct Explicit_signed_long_struct
+instance (~) ty CLong =>
+         HasField "explicit_signed_long_member"
+                  Explicit_signed_long_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_long_struct{explicit_signed_long_member = y_1},
+                              getField @"explicit_signed_long_member" x_0)
+instance (~) ty CLong =>
+         HasField "explicit_signed_long_member"
+                  (Ptr Explicit_signed_long_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_long_member")
+instance HasCField Explicit_signed_long_struct
+                   "explicit_signed_long_member"
+    where type CFieldType Explicit_signed_long_struct
+                          "explicit_signed_long_member" = CLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 222:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_struct
+    = Unsigned_long_struct {unsigned_long_member :: CULong
+                            {- ^ __C declaration:__ @unsigned_long_member@
+
+                                 __defined at:__ @comprehensive\/c2hsc.h 222:62@
+
+                                 __exported by:__ @comprehensive\/c2hsc.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_long_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_long_struct
+    where readRaw = \ptr_0 -> pure Unsigned_long_struct <*> readRaw (Proxy @"unsigned_long_member") ptr_0
+instance WriteRaw Unsigned_long_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_long_struct unsigned_long_member_2 -> writeRaw (Proxy @"unsigned_long_member") ptr_0 unsigned_long_member_2
+deriving via (EquivStorable Unsigned_long_struct) instance Storable Unsigned_long_struct
+deriving via (IsStructViaReadRaw Unsigned_long_struct) instance IsStruct Unsigned_long_struct
+instance (~) ty CULong =>
+         HasField "unsigned_long_member" Unsigned_long_struct ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_long_struct{unsigned_long_member = y_1},
+                              getField @"unsigned_long_member" x_0)
+instance (~) ty CULong =>
+         HasField "unsigned_long_member" (Ptr Unsigned_long_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_long_member")
+instance HasCField Unsigned_long_struct "unsigned_long_member"
+    where type CFieldType Unsigned_long_struct
+                          "unsigned_long_member" = CULong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_long_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 224:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_long_struct
+    = Ordinary_signed_long_long_struct {ordinary_signed_long_long_member :: CLLong
+                                        {- ^ __C declaration:__ @ordinary_signed_long_long_member@
+
+                                             __defined at:__ @comprehensive\/c2hsc.h 224:62@
+
+                                             __exported by:__ @comprehensive\/c2hsc.h@
+                                        -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_long_long_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_long_long_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_long_long_struct <*> readRaw (Proxy @"ordinary_signed_long_long_member") ptr_0
+instance WriteRaw Ordinary_signed_long_long_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_long_long_struct ordinary_signed_long_long_member_2 -> writeRaw (Proxy @"ordinary_signed_long_long_member") ptr_0 ordinary_signed_long_long_member_2
+deriving via (EquivStorable Ordinary_signed_long_long_struct) instance Storable Ordinary_signed_long_long_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_long_long_struct) instance IsStruct Ordinary_signed_long_long_struct
+instance (~) ty CLLong =>
+         HasField "ordinary_signed_long_long_member"
+                  Ordinary_signed_long_long_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_long_long_struct{ordinary_signed_long_long_member = y_1},
+                              getField @"ordinary_signed_long_long_member" x_0)
+instance (~) ty CLLong =>
+         HasField "ordinary_signed_long_long_member"
+                  (Ptr Ordinary_signed_long_long_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_long_long_member")
+instance HasCField Ordinary_signed_long_long_struct
+                   "ordinary_signed_long_long_member"
+    where type CFieldType Ordinary_signed_long_long_struct
+                          "ordinary_signed_long_long_member" = CLLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_long_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 225:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_long_struct
+    = Explicit_signed_long_long_struct {explicit_signed_long_long_member :: CLLong
+                                        {- ^ __C declaration:__ @explicit_signed_long_long_member@
+
+                                             __defined at:__ @comprehensive\/c2hsc.h 225:62@
+
+                                             __exported by:__ @comprehensive\/c2hsc.h@
+                                        -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_long_long_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_long_long_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_long_long_struct <*> readRaw (Proxy @"explicit_signed_long_long_member") ptr_0
+instance WriteRaw Explicit_signed_long_long_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_long_long_struct explicit_signed_long_long_member_2 -> writeRaw (Proxy @"explicit_signed_long_long_member") ptr_0 explicit_signed_long_long_member_2
+deriving via (EquivStorable Explicit_signed_long_long_struct) instance Storable Explicit_signed_long_long_struct
+deriving via (IsStructViaReadRaw Explicit_signed_long_long_struct) instance IsStruct Explicit_signed_long_long_struct
+instance (~) ty CLLong =>
+         HasField "explicit_signed_long_long_member"
+                  Explicit_signed_long_long_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_long_long_struct{explicit_signed_long_long_member = y_1},
+                              getField @"explicit_signed_long_long_member" x_0)
+instance (~) ty CLLong =>
+         HasField "explicit_signed_long_long_member"
+                  (Ptr Explicit_signed_long_long_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_long_long_member")
+instance HasCField Explicit_signed_long_long_struct
+                   "explicit_signed_long_long_member"
+    where type CFieldType Explicit_signed_long_long_struct
+                          "explicit_signed_long_long_member" = CLLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_long_long_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 226:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_long_struct
+    = Unsigned_long_long_struct {unsigned_long_long_member :: CULLong
+                                 {- ^ __C declaration:__ @unsigned_long_long_member@
+
+                                      __defined at:__ @comprehensive\/c2hsc.h 226:62@
+
+                                      __exported by:__ @comprehensive\/c2hsc.h@
+                                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_long_long_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_long_long_struct
+    where readRaw = \ptr_0 -> pure Unsigned_long_long_struct <*> readRaw (Proxy @"unsigned_long_long_member") ptr_0
+instance WriteRaw Unsigned_long_long_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_long_long_struct unsigned_long_long_member_2 -> writeRaw (Proxy @"unsigned_long_long_member") ptr_0 unsigned_long_long_member_2
+deriving via (EquivStorable Unsigned_long_long_struct) instance Storable Unsigned_long_long_struct
+deriving via (IsStructViaReadRaw Unsigned_long_long_struct) instance IsStruct Unsigned_long_long_struct
+instance (~) ty CULLong =>
+         HasField "unsigned_long_long_member" Unsigned_long_long_struct ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_long_long_struct{unsigned_long_long_member = y_1},
+                              getField @"unsigned_long_long_member" x_0)
+instance (~) ty CULLong =>
+         HasField "unsigned_long_long_member"
+                  (Ptr Unsigned_long_long_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_long_long_member")
+instance HasCField Unsigned_long_long_struct
+                   "unsigned_long_long_member"
+    where type CFieldType Unsigned_long_long_struct
+                          "unsigned_long_long_member" = CULLong
+          offset# = \_ -> \_ -> 0
+{-| Structs: pointers
+
+    NOTE: @'Ordinary_signed_char_pointer_struct'@ is commented out in the original test suite, unclear why (no reason is given).
+
+    __C declaration:__ @struct ordinary_void_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 235:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_void_pointer_struct
+    = Ordinary_void_pointer_struct {ordinary_void_pointer_member :: (Ptr Void)
+                                    {- ^ __C declaration:__ @ordinary_void_pointer_member@
+
+                                         __defined at:__ @comprehensive\/c2hsc.h 235:71@
+
+                                         __exported by:__ @comprehensive\/c2hsc.h@
+                                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_void_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_void_pointer_struct
+    where readRaw = \ptr_0 -> pure Ordinary_void_pointer_struct <*> readRaw (Proxy @"ordinary_void_pointer_member") ptr_0
+instance WriteRaw Ordinary_void_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_void_pointer_struct ordinary_void_pointer_member_2 -> writeRaw (Proxy @"ordinary_void_pointer_member") ptr_0 ordinary_void_pointer_member_2
+deriving via (EquivStorable Ordinary_void_pointer_struct) instance Storable Ordinary_void_pointer_struct
+deriving via (IsStructViaReadRaw Ordinary_void_pointer_struct) instance IsStruct Ordinary_void_pointer_struct
+instance (~) ty (Ptr Void) =>
+         HasField "ordinary_void_pointer_member"
+                  Ordinary_void_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_void_pointer_struct{ordinary_void_pointer_member = y_1},
+                              getField @"ordinary_void_pointer_member" x_0)
+instance (~) ty (Ptr Void) =>
+         HasField "ordinary_void_pointer_member"
+                  (Ptr Ordinary_void_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_void_pointer_member")
+instance HasCField Ordinary_void_pointer_struct
+                   "ordinary_void_pointer_member"
+    where type CFieldType Ordinary_void_pointer_struct
+                          "ordinary_void_pointer_member" = Ptr Void
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_float_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 237:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_float_pointer_struct
+    = Ordinary_float_pointer_struct {ordinary_float_pointer_member :: (Ptr CFloat)
+                                     {- ^ __C declaration:__ @ordinary_float_pointer_member@
+
+                                          __defined at:__ @comprehensive\/c2hsc.h 237:71@
+
+                                          __exported by:__ @comprehensive\/c2hsc.h@
+                                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_float_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_float_pointer_struct
+    where readRaw = \ptr_0 -> pure Ordinary_float_pointer_struct <*> readRaw (Proxy @"ordinary_float_pointer_member") ptr_0
+instance WriteRaw Ordinary_float_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_float_pointer_struct ordinary_float_pointer_member_2 -> writeRaw (Proxy @"ordinary_float_pointer_member") ptr_0 ordinary_float_pointer_member_2
+deriving via (EquivStorable Ordinary_float_pointer_struct) instance Storable Ordinary_float_pointer_struct
+deriving via (IsStructViaReadRaw Ordinary_float_pointer_struct) instance IsStruct Ordinary_float_pointer_struct
+instance (~) ty (Ptr CFloat) =>
+         HasField "ordinary_float_pointer_member"
+                  Ordinary_float_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_float_pointer_struct{ordinary_float_pointer_member = y_1},
+                              getField @"ordinary_float_pointer_member" x_0)
+instance (~) ty (Ptr CFloat) =>
+         HasField "ordinary_float_pointer_member"
+                  (Ptr Ordinary_float_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_float_pointer_member")
+instance HasCField Ordinary_float_pointer_struct
+                   "ordinary_float_pointer_member"
+    where type CFieldType Ordinary_float_pointer_struct
+                          "ordinary_float_pointer_member" = Ptr CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_double_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 238:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_double_pointer_struct
+    = Ordinary_double_pointer_struct {ordinary_double_pointer_member :: (Ptr CDouble)
+                                      {- ^ __C declaration:__ @ordinary_double_pointer_member@
+
+                                           __defined at:__ @comprehensive\/c2hsc.h 238:71@
+
+                                           __exported by:__ @comprehensive\/c2hsc.h@
+                                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_double_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_double_pointer_struct
+    where readRaw = \ptr_0 -> pure Ordinary_double_pointer_struct <*> readRaw (Proxy @"ordinary_double_pointer_member") ptr_0
+instance WriteRaw Ordinary_double_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_double_pointer_struct ordinary_double_pointer_member_2 -> writeRaw (Proxy @"ordinary_double_pointer_member") ptr_0 ordinary_double_pointer_member_2
+deriving via (EquivStorable Ordinary_double_pointer_struct) instance Storable Ordinary_double_pointer_struct
+deriving via (IsStructViaReadRaw Ordinary_double_pointer_struct) instance IsStruct Ordinary_double_pointer_struct
+instance (~) ty (Ptr CDouble) =>
+         HasField "ordinary_double_pointer_member"
+                  Ordinary_double_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_double_pointer_struct{ordinary_double_pointer_member = y_1},
+                              getField @"ordinary_double_pointer_member" x_0)
+instance (~) ty (Ptr CDouble) =>
+         HasField "ordinary_double_pointer_member"
+                  (Ptr Ordinary_double_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_double_pointer_member")
+instance HasCField Ordinary_double_pointer_struct
+                   "ordinary_double_pointer_member"
+    where type CFieldType Ordinary_double_pointer_struct
+                          "ordinary_double_pointer_member" = Ptr CDouble
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_char_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 241:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_char_pointer_struct
+    = Ordinary_signed_char_pointer_struct {ordinary_signed_char_pointer_member :: (Ptr CChar)
+                                           {- ^ __C declaration:__ @ordinary_signed_char_pointer_member@
+
+                                                __defined at:__ @comprehensive\/c2hsc.h 241:71@
+
+                                                __exported by:__ @comprehensive\/c2hsc.h@
+                                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_char_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_char_pointer_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_char_pointer_struct <*> readRaw (Proxy @"ordinary_signed_char_pointer_member") ptr_0
+instance WriteRaw Ordinary_signed_char_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_char_pointer_struct ordinary_signed_char_pointer_member_2 -> writeRaw (Proxy @"ordinary_signed_char_pointer_member") ptr_0 ordinary_signed_char_pointer_member_2
+deriving via (EquivStorable Ordinary_signed_char_pointer_struct) instance Storable Ordinary_signed_char_pointer_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_char_pointer_struct) instance IsStruct Ordinary_signed_char_pointer_struct
+instance (~) ty (Ptr CChar) =>
+         HasField "ordinary_signed_char_pointer_member"
+                  Ordinary_signed_char_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_char_pointer_struct{ordinary_signed_char_pointer_member = y_1},
+                              getField @"ordinary_signed_char_pointer_member" x_0)
+instance (~) ty (Ptr CChar) =>
+         HasField "ordinary_signed_char_pointer_member"
+                  (Ptr Ordinary_signed_char_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_char_pointer_member")
+instance HasCField Ordinary_signed_char_pointer_struct
+                   "ordinary_signed_char_pointer_member"
+    where type CFieldType Ordinary_signed_char_pointer_struct
+                          "ordinary_signed_char_pointer_member" = Ptr CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_char_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 242:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_char_pointer_struct
+    = Explicit_signed_char_pointer_struct {explicit_signed_char_pointer_member :: (Ptr CSChar)
+                                           {- ^ __C declaration:__ @explicit_signed_char_pointer_member@
+
+                                                __defined at:__ @comprehensive\/c2hsc.h 242:71@
+
+                                                __exported by:__ @comprehensive\/c2hsc.h@
+                                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_char_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_char_pointer_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_char_pointer_struct <*> readRaw (Proxy @"explicit_signed_char_pointer_member") ptr_0
+instance WriteRaw Explicit_signed_char_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_char_pointer_struct explicit_signed_char_pointer_member_2 -> writeRaw (Proxy @"explicit_signed_char_pointer_member") ptr_0 explicit_signed_char_pointer_member_2
+deriving via (EquivStorable Explicit_signed_char_pointer_struct) instance Storable Explicit_signed_char_pointer_struct
+deriving via (IsStructViaReadRaw Explicit_signed_char_pointer_struct) instance IsStruct Explicit_signed_char_pointer_struct
+instance (~) ty (Ptr CSChar) =>
+         HasField "explicit_signed_char_pointer_member"
+                  Explicit_signed_char_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_char_pointer_struct{explicit_signed_char_pointer_member = y_1},
+                              getField @"explicit_signed_char_pointer_member" x_0)
+instance (~) ty (Ptr CSChar) =>
+         HasField "explicit_signed_char_pointer_member"
+                  (Ptr Explicit_signed_char_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_char_pointer_member")
+instance HasCField Explicit_signed_char_pointer_struct
+                   "explicit_signed_char_pointer_member"
+    where type CFieldType Explicit_signed_char_pointer_struct
+                          "explicit_signed_char_pointer_member" = Ptr CSChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_char_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 243:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_char_pointer_struct
+    = Unsigned_char_pointer_struct {unsigned_char_pointer_member :: (Ptr CUChar)
+                                    {- ^ __C declaration:__ @unsigned_char_pointer_member@
+
+                                         __defined at:__ @comprehensive\/c2hsc.h 243:71@
+
+                                         __exported by:__ @comprehensive\/c2hsc.h@
+                                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_char_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_char_pointer_struct
+    where readRaw = \ptr_0 -> pure Unsigned_char_pointer_struct <*> readRaw (Proxy @"unsigned_char_pointer_member") ptr_0
+instance WriteRaw Unsigned_char_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_char_pointer_struct unsigned_char_pointer_member_2 -> writeRaw (Proxy @"unsigned_char_pointer_member") ptr_0 unsigned_char_pointer_member_2
+deriving via (EquivStorable Unsigned_char_pointer_struct) instance Storable Unsigned_char_pointer_struct
+deriving via (IsStructViaReadRaw Unsigned_char_pointer_struct) instance IsStruct Unsigned_char_pointer_struct
+instance (~) ty (Ptr CUChar) =>
+         HasField "unsigned_char_pointer_member"
+                  Unsigned_char_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_char_pointer_struct{unsigned_char_pointer_member = y_1},
+                              getField @"unsigned_char_pointer_member" x_0)
+instance (~) ty (Ptr CUChar) =>
+         HasField "unsigned_char_pointer_member"
+                  (Ptr Unsigned_char_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_char_pointer_member")
+instance HasCField Unsigned_char_pointer_struct
+                   "unsigned_char_pointer_member"
+    where type CFieldType Unsigned_char_pointer_struct
+                          "unsigned_char_pointer_member" = Ptr CUChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_short_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 245:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_short_pointer_struct
+    = Ordinary_signed_short_pointer_struct {ordinary_signed_short_pointer_member :: (Ptr CShort)
+                                            {- ^ __C declaration:__ @ordinary_signed_short_pointer_member@
+
+                                                 __defined at:__ @comprehensive\/c2hsc.h 245:71@
+
+                                                 __exported by:__ @comprehensive\/c2hsc.h@
+                                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_short_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_short_pointer_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_short_pointer_struct <*> readRaw (Proxy @"ordinary_signed_short_pointer_member") ptr_0
+instance WriteRaw Ordinary_signed_short_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_short_pointer_struct ordinary_signed_short_pointer_member_2 -> writeRaw (Proxy @"ordinary_signed_short_pointer_member") ptr_0 ordinary_signed_short_pointer_member_2
+deriving via (EquivStorable Ordinary_signed_short_pointer_struct) instance Storable Ordinary_signed_short_pointer_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_short_pointer_struct) instance IsStruct Ordinary_signed_short_pointer_struct
+instance (~) ty (Ptr CShort) =>
+         HasField "ordinary_signed_short_pointer_member"
+                  Ordinary_signed_short_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_short_pointer_struct{ordinary_signed_short_pointer_member = y_1},
+                              getField @"ordinary_signed_short_pointer_member" x_0)
+instance (~) ty (Ptr CShort) =>
+         HasField "ordinary_signed_short_pointer_member"
+                  (Ptr Ordinary_signed_short_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_short_pointer_member")
+instance HasCField Ordinary_signed_short_pointer_struct
+                   "ordinary_signed_short_pointer_member"
+    where type CFieldType Ordinary_signed_short_pointer_struct
+                          "ordinary_signed_short_pointer_member" = Ptr CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_short_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 246:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_short_pointer_struct
+    = Explicit_signed_short_pointer_struct {explicit_signed_short_pointer_member :: (Ptr CShort)
+                                            {- ^ __C declaration:__ @explicit_signed_short_pointer_member@
+
+                                                 __defined at:__ @comprehensive\/c2hsc.h 246:71@
+
+                                                 __exported by:__ @comprehensive\/c2hsc.h@
+                                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_short_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_short_pointer_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_short_pointer_struct <*> readRaw (Proxy @"explicit_signed_short_pointer_member") ptr_0
+instance WriteRaw Explicit_signed_short_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_short_pointer_struct explicit_signed_short_pointer_member_2 -> writeRaw (Proxy @"explicit_signed_short_pointer_member") ptr_0 explicit_signed_short_pointer_member_2
+deriving via (EquivStorable Explicit_signed_short_pointer_struct) instance Storable Explicit_signed_short_pointer_struct
+deriving via (IsStructViaReadRaw Explicit_signed_short_pointer_struct) instance IsStruct Explicit_signed_short_pointer_struct
+instance (~) ty (Ptr CShort) =>
+         HasField "explicit_signed_short_pointer_member"
+                  Explicit_signed_short_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_short_pointer_struct{explicit_signed_short_pointer_member = y_1},
+                              getField @"explicit_signed_short_pointer_member" x_0)
+instance (~) ty (Ptr CShort) =>
+         HasField "explicit_signed_short_pointer_member"
+                  (Ptr Explicit_signed_short_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_short_pointer_member")
+instance HasCField Explicit_signed_short_pointer_struct
+                   "explicit_signed_short_pointer_member"
+    where type CFieldType Explicit_signed_short_pointer_struct
+                          "explicit_signed_short_pointer_member" = Ptr CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_short_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 247:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_short_pointer_struct
+    = Unsigned_short_pointer_struct {unsigned_short_pointer_member :: (Ptr CUShort)
+                                     {- ^ __C declaration:__ @unsigned_short_pointer_member@
+
+                                          __defined at:__ @comprehensive\/c2hsc.h 247:71@
+
+                                          __exported by:__ @comprehensive\/c2hsc.h@
+                                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_short_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_short_pointer_struct
+    where readRaw = \ptr_0 -> pure Unsigned_short_pointer_struct <*> readRaw (Proxy @"unsigned_short_pointer_member") ptr_0
+instance WriteRaw Unsigned_short_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_short_pointer_struct unsigned_short_pointer_member_2 -> writeRaw (Proxy @"unsigned_short_pointer_member") ptr_0 unsigned_short_pointer_member_2
+deriving via (EquivStorable Unsigned_short_pointer_struct) instance Storable Unsigned_short_pointer_struct
+deriving via (IsStructViaReadRaw Unsigned_short_pointer_struct) instance IsStruct Unsigned_short_pointer_struct
+instance (~) ty (Ptr CUShort) =>
+         HasField "unsigned_short_pointer_member"
+                  Unsigned_short_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_short_pointer_struct{unsigned_short_pointer_member = y_1},
+                              getField @"unsigned_short_pointer_member" x_0)
+instance (~) ty (Ptr CUShort) =>
+         HasField "unsigned_short_pointer_member"
+                  (Ptr Unsigned_short_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_short_pointer_member")
+instance HasCField Unsigned_short_pointer_struct
+                   "unsigned_short_pointer_member"
+    where type CFieldType Unsigned_short_pointer_struct
+                          "unsigned_short_pointer_member" = Ptr CUShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_int_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 249:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_int_pointer_struct
+    = Ordinary_signed_int_pointer_struct {ordinary_signed_int_pointer_member :: (Ptr CInt)
+                                          {- ^ __C declaration:__ @ordinary_signed_int_pointer_member@
+
+                                               __defined at:__ @comprehensive\/c2hsc.h 249:71@
+
+                                               __exported by:__ @comprehensive\/c2hsc.h@
+                                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_int_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_int_pointer_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_int_pointer_struct <*> readRaw (Proxy @"ordinary_signed_int_pointer_member") ptr_0
+instance WriteRaw Ordinary_signed_int_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_int_pointer_struct ordinary_signed_int_pointer_member_2 -> writeRaw (Proxy @"ordinary_signed_int_pointer_member") ptr_0 ordinary_signed_int_pointer_member_2
+deriving via (EquivStorable Ordinary_signed_int_pointer_struct) instance Storable Ordinary_signed_int_pointer_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_int_pointer_struct) instance IsStruct Ordinary_signed_int_pointer_struct
+instance (~) ty (Ptr CInt) =>
+         HasField "ordinary_signed_int_pointer_member"
+                  Ordinary_signed_int_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_int_pointer_struct{ordinary_signed_int_pointer_member = y_1},
+                              getField @"ordinary_signed_int_pointer_member" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "ordinary_signed_int_pointer_member"
+                  (Ptr Ordinary_signed_int_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_int_pointer_member")
+instance HasCField Ordinary_signed_int_pointer_struct
+                   "ordinary_signed_int_pointer_member"
+    where type CFieldType Ordinary_signed_int_pointer_struct
+                          "ordinary_signed_int_pointer_member" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_int_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 250:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_int_pointer_struct
+    = Explicit_signed_int_pointer_struct {explicit_signed_int_pointer_member :: (Ptr CInt)
+                                          {- ^ __C declaration:__ @explicit_signed_int_pointer_member@
+
+                                               __defined at:__ @comprehensive\/c2hsc.h 250:71@
+
+                                               __exported by:__ @comprehensive\/c2hsc.h@
+                                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_int_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_int_pointer_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_int_pointer_struct <*> readRaw (Proxy @"explicit_signed_int_pointer_member") ptr_0
+instance WriteRaw Explicit_signed_int_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_int_pointer_struct explicit_signed_int_pointer_member_2 -> writeRaw (Proxy @"explicit_signed_int_pointer_member") ptr_0 explicit_signed_int_pointer_member_2
+deriving via (EquivStorable Explicit_signed_int_pointer_struct) instance Storable Explicit_signed_int_pointer_struct
+deriving via (IsStructViaReadRaw Explicit_signed_int_pointer_struct) instance IsStruct Explicit_signed_int_pointer_struct
+instance (~) ty (Ptr CInt) =>
+         HasField "explicit_signed_int_pointer_member"
+                  Explicit_signed_int_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_int_pointer_struct{explicit_signed_int_pointer_member = y_1},
+                              getField @"explicit_signed_int_pointer_member" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "explicit_signed_int_pointer_member"
+                  (Ptr Explicit_signed_int_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_int_pointer_member")
+instance HasCField Explicit_signed_int_pointer_struct
+                   "explicit_signed_int_pointer_member"
+    where type CFieldType Explicit_signed_int_pointer_struct
+                          "explicit_signed_int_pointer_member" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_int_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 251:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_int_pointer_struct
+    = Unsigned_int_pointer_struct {unsigned_int_pointer_member :: (Ptr CUInt)
+                                   {- ^ __C declaration:__ @unsigned_int_pointer_member@
+
+                                        __defined at:__ @comprehensive\/c2hsc.h 251:71@
+
+                                        __exported by:__ @comprehensive\/c2hsc.h@
+                                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_int_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_int_pointer_struct
+    where readRaw = \ptr_0 -> pure Unsigned_int_pointer_struct <*> readRaw (Proxy @"unsigned_int_pointer_member") ptr_0
+instance WriteRaw Unsigned_int_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_int_pointer_struct unsigned_int_pointer_member_2 -> writeRaw (Proxy @"unsigned_int_pointer_member") ptr_0 unsigned_int_pointer_member_2
+deriving via (EquivStorable Unsigned_int_pointer_struct) instance Storable Unsigned_int_pointer_struct
+deriving via (IsStructViaReadRaw Unsigned_int_pointer_struct) instance IsStruct Unsigned_int_pointer_struct
+instance (~) ty (Ptr CUInt) =>
+         HasField "unsigned_int_pointer_member"
+                  Unsigned_int_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_int_pointer_struct{unsigned_int_pointer_member = y_1},
+                              getField @"unsigned_int_pointer_member" x_0)
+instance (~) ty (Ptr CUInt) =>
+         HasField "unsigned_int_pointer_member"
+                  (Ptr Unsigned_int_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_int_pointer_member")
+instance HasCField Unsigned_int_pointer_struct
+                   "unsigned_int_pointer_member"
+    where type CFieldType Unsigned_int_pointer_struct
+                          "unsigned_int_pointer_member" = Ptr CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 253:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_pointer_struct
+    = Ordinary_signed_long_pointer_struct {ordinary_signed_long_pointer_member :: (Ptr CLong)
+                                           {- ^ __C declaration:__ @ordinary_signed_long_pointer_member@
+
+                                                __defined at:__ @comprehensive\/c2hsc.h 253:71@
+
+                                                __exported by:__ @comprehensive\/c2hsc.h@
+                                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_long_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_long_pointer_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_long_pointer_struct <*> readRaw (Proxy @"ordinary_signed_long_pointer_member") ptr_0
+instance WriteRaw Ordinary_signed_long_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_long_pointer_struct ordinary_signed_long_pointer_member_2 -> writeRaw (Proxy @"ordinary_signed_long_pointer_member") ptr_0 ordinary_signed_long_pointer_member_2
+deriving via (EquivStorable Ordinary_signed_long_pointer_struct) instance Storable Ordinary_signed_long_pointer_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_long_pointer_struct) instance IsStruct Ordinary_signed_long_pointer_struct
+instance (~) ty (Ptr CLong) =>
+         HasField "ordinary_signed_long_pointer_member"
+                  Ordinary_signed_long_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_long_pointer_struct{ordinary_signed_long_pointer_member = y_1},
+                              getField @"ordinary_signed_long_pointer_member" x_0)
+instance (~) ty (Ptr CLong) =>
+         HasField "ordinary_signed_long_pointer_member"
+                  (Ptr Ordinary_signed_long_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_long_pointer_member")
+instance HasCField Ordinary_signed_long_pointer_struct
+                   "ordinary_signed_long_pointer_member"
+    where type CFieldType Ordinary_signed_long_pointer_struct
+                          "ordinary_signed_long_pointer_member" = Ptr CLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 254:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_pointer_struct
+    = Explicit_signed_long_pointer_struct {explicit_signed_long_pointer_member :: (Ptr CLong)
+                                           {- ^ __C declaration:__ @explicit_signed_long_pointer_member@
+
+                                                __defined at:__ @comprehensive\/c2hsc.h 254:71@
+
+                                                __exported by:__ @comprehensive\/c2hsc.h@
+                                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_long_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_long_pointer_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_long_pointer_struct <*> readRaw (Proxy @"explicit_signed_long_pointer_member") ptr_0
+instance WriteRaw Explicit_signed_long_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_long_pointer_struct explicit_signed_long_pointer_member_2 -> writeRaw (Proxy @"explicit_signed_long_pointer_member") ptr_0 explicit_signed_long_pointer_member_2
+deriving via (EquivStorable Explicit_signed_long_pointer_struct) instance Storable Explicit_signed_long_pointer_struct
+deriving via (IsStructViaReadRaw Explicit_signed_long_pointer_struct) instance IsStruct Explicit_signed_long_pointer_struct
+instance (~) ty (Ptr CLong) =>
+         HasField "explicit_signed_long_pointer_member"
+                  Explicit_signed_long_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_long_pointer_struct{explicit_signed_long_pointer_member = y_1},
+                              getField @"explicit_signed_long_pointer_member" x_0)
+instance (~) ty (Ptr CLong) =>
+         HasField "explicit_signed_long_pointer_member"
+                  (Ptr Explicit_signed_long_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_long_pointer_member")
+instance HasCField Explicit_signed_long_pointer_struct
+                   "explicit_signed_long_pointer_member"
+    where type CFieldType Explicit_signed_long_pointer_struct
+                          "explicit_signed_long_pointer_member" = Ptr CLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 255:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_pointer_struct
+    = Unsigned_long_pointer_struct {unsigned_long_pointer_member :: (Ptr CULong)
+                                    {- ^ __C declaration:__ @unsigned_long_pointer_member@
+
+                                         __defined at:__ @comprehensive\/c2hsc.h 255:71@
+
+                                         __exported by:__ @comprehensive\/c2hsc.h@
+                                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_long_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_long_pointer_struct
+    where readRaw = \ptr_0 -> pure Unsigned_long_pointer_struct <*> readRaw (Proxy @"unsigned_long_pointer_member") ptr_0
+instance WriteRaw Unsigned_long_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_long_pointer_struct unsigned_long_pointer_member_2 -> writeRaw (Proxy @"unsigned_long_pointer_member") ptr_0 unsigned_long_pointer_member_2
+deriving via (EquivStorable Unsigned_long_pointer_struct) instance Storable Unsigned_long_pointer_struct
+deriving via (IsStructViaReadRaw Unsigned_long_pointer_struct) instance IsStruct Unsigned_long_pointer_struct
+instance (~) ty (Ptr CULong) =>
+         HasField "unsigned_long_pointer_member"
+                  Unsigned_long_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_long_pointer_struct{unsigned_long_pointer_member = y_1},
+                              getField @"unsigned_long_pointer_member" x_0)
+instance (~) ty (Ptr CULong) =>
+         HasField "unsigned_long_pointer_member"
+                  (Ptr Unsigned_long_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_long_pointer_member")
+instance HasCField Unsigned_long_pointer_struct
+                   "unsigned_long_pointer_member"
+    where type CFieldType Unsigned_long_pointer_struct
+                          "unsigned_long_pointer_member" = Ptr CULong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_long_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 257:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_long_pointer_struct
+    = Ordinary_signed_long_long_pointer_struct {ordinary_signed_long_long_pointer_member :: (Ptr CLLong)
+                                                {- ^ __C declaration:__ @ordinary_signed_long_long_pointer_member@
+
+                                                     __defined at:__ @comprehensive\/c2hsc.h 257:71@
+
+                                                     __exported by:__ @comprehensive\/c2hsc.h@
+                                                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_long_long_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_long_long_pointer_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_long_long_pointer_struct <*> readRaw (Proxy @"ordinary_signed_long_long_pointer_member") ptr_0
+instance WriteRaw Ordinary_signed_long_long_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_long_long_pointer_struct ordinary_signed_long_long_pointer_member_2 -> writeRaw (Proxy @"ordinary_signed_long_long_pointer_member") ptr_0 ordinary_signed_long_long_pointer_member_2
+deriving via (EquivStorable Ordinary_signed_long_long_pointer_struct) instance Storable Ordinary_signed_long_long_pointer_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_long_long_pointer_struct) instance IsStruct Ordinary_signed_long_long_pointer_struct
+instance (~) ty (Ptr CLLong) =>
+         HasField "ordinary_signed_long_long_pointer_member"
+                  Ordinary_signed_long_long_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_long_long_pointer_struct{ordinary_signed_long_long_pointer_member = y_1},
+                              getField @"ordinary_signed_long_long_pointer_member" x_0)
+instance (~) ty (Ptr CLLong) =>
+         HasField "ordinary_signed_long_long_pointer_member"
+                  (Ptr Ordinary_signed_long_long_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_long_long_pointer_member")
+instance HasCField Ordinary_signed_long_long_pointer_struct
+                   "ordinary_signed_long_long_pointer_member"
+    where type CFieldType Ordinary_signed_long_long_pointer_struct
+                          "ordinary_signed_long_long_pointer_member" = Ptr CLLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_long_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 258:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_long_pointer_struct
+    = Explicit_signed_long_long_pointer_struct {explicit_signed_long_long_pointer_member :: (Ptr CLLong)
+                                                {- ^ __C declaration:__ @explicit_signed_long_long_pointer_member@
+
+                                                     __defined at:__ @comprehensive\/c2hsc.h 258:71@
+
+                                                     __exported by:__ @comprehensive\/c2hsc.h@
+                                                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_long_long_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_long_long_pointer_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_long_long_pointer_struct <*> readRaw (Proxy @"explicit_signed_long_long_pointer_member") ptr_0
+instance WriteRaw Explicit_signed_long_long_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_long_long_pointer_struct explicit_signed_long_long_pointer_member_2 -> writeRaw (Proxy @"explicit_signed_long_long_pointer_member") ptr_0 explicit_signed_long_long_pointer_member_2
+deriving via (EquivStorable Explicit_signed_long_long_pointer_struct) instance Storable Explicit_signed_long_long_pointer_struct
+deriving via (IsStructViaReadRaw Explicit_signed_long_long_pointer_struct) instance IsStruct Explicit_signed_long_long_pointer_struct
+instance (~) ty (Ptr CLLong) =>
+         HasField "explicit_signed_long_long_pointer_member"
+                  Explicit_signed_long_long_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_long_long_pointer_struct{explicit_signed_long_long_pointer_member = y_1},
+                              getField @"explicit_signed_long_long_pointer_member" x_0)
+instance (~) ty (Ptr CLLong) =>
+         HasField "explicit_signed_long_long_pointer_member"
+                  (Ptr Explicit_signed_long_long_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_long_long_pointer_member")
+instance HasCField Explicit_signed_long_long_pointer_struct
+                   "explicit_signed_long_long_pointer_member"
+    where type CFieldType Explicit_signed_long_long_pointer_struct
+                          "explicit_signed_long_long_pointer_member" = Ptr CLLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_long_long_pointer_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 259:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_long_pointer_struct
+    = Unsigned_long_long_pointer_struct {unsigned_long_long_pointer_member :: (Ptr CULLong)
+                                         {- ^ __C declaration:__ @unsigned_long_long_pointer_member@
+
+                                              __defined at:__ @comprehensive\/c2hsc.h 259:71@
+
+                                              __exported by:__ @comprehensive\/c2hsc.h@
+                                         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_long_long_pointer_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_long_long_pointer_struct
+    where readRaw = \ptr_0 -> pure Unsigned_long_long_pointer_struct <*> readRaw (Proxy @"unsigned_long_long_pointer_member") ptr_0
+instance WriteRaw Unsigned_long_long_pointer_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_long_long_pointer_struct unsigned_long_long_pointer_member_2 -> writeRaw (Proxy @"unsigned_long_long_pointer_member") ptr_0 unsigned_long_long_pointer_member_2
+deriving via (EquivStorable Unsigned_long_long_pointer_struct) instance Storable Unsigned_long_long_pointer_struct
+deriving via (IsStructViaReadRaw Unsigned_long_long_pointer_struct) instance IsStruct Unsigned_long_long_pointer_struct
+instance (~) ty (Ptr CULLong) =>
+         HasField "unsigned_long_long_pointer_member"
+                  Unsigned_long_long_pointer_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_long_long_pointer_struct{unsigned_long_long_pointer_member = y_1},
+                              getField @"unsigned_long_long_pointer_member" x_0)
+instance (~) ty (Ptr CULLong) =>
+         HasField "unsigned_long_long_pointer_member"
+                  (Ptr Unsigned_long_long_pointer_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_long_long_pointer_member")
+instance HasCField Unsigned_long_long_pointer_struct
+                   "unsigned_long_long_pointer_member"
+    where type CFieldType Unsigned_long_long_pointer_struct
+                          "unsigned_long_long_pointer_member" = Ptr CULLong
+          offset# = \_ -> \_ -> 0
+{-| Structs: arrays
+
+    __C declaration:__ @struct ordinary_float_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 265:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_float_array_struct
+    = Ordinary_float_array_struct {ordinary_float_array_member :: (ConstantArray 10
+                                                                                 CFloat)
+                                   {- ^ __C declaration:__ @ordinary_float_array_member@
+
+                                        __defined at:__ @comprehensive\/c2hsc.h 265:68@
+
+                                        __exported by:__ @comprehensive\/c2hsc.h@
+                                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_float_array_struct
+    where staticSizeOf = \_ -> 40 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Ordinary_float_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_float_array_struct <*> readRaw (Proxy @"ordinary_float_array_member") ptr_0
+instance WriteRaw Ordinary_float_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_float_array_struct ordinary_float_array_member_2 -> writeRaw (Proxy @"ordinary_float_array_member") ptr_0 ordinary_float_array_member_2
+deriving via (EquivStorable Ordinary_float_array_struct) instance Storable Ordinary_float_array_struct
+deriving via (IsStructViaReadRaw Ordinary_float_array_struct) instance IsStruct Ordinary_float_array_struct
+instance (~) ty (ConstantArray 10 CFloat) =>
+         HasField "ordinary_float_array_member"
+                  Ordinary_float_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_float_array_struct{ordinary_float_array_member = y_1},
+                              getField @"ordinary_float_array_member" x_0)
+instance (~) ty (ConstantArray 10 CFloat) =>
+         HasField "ordinary_float_array_member"
+                  (Ptr Ordinary_float_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_float_array_member")
+instance HasCField Ordinary_float_array_struct
+                   "ordinary_float_array_member"
+    where type CFieldType Ordinary_float_array_struct
+                          "ordinary_float_array_member" = ConstantArray 10 CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_double_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 266:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_double_array_struct
+    = Ordinary_double_array_struct {ordinary_double_array_member :: (ConstantArray 10
+                                                                                   CDouble)
+                                    {- ^ __C declaration:__ @ordinary_double_array_member@
+
+                                         __defined at:__ @comprehensive\/c2hsc.h 266:68@
+
+                                         __exported by:__ @comprehensive\/c2hsc.h@
+                                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_double_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_double_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_double_array_struct <*> readRaw (Proxy @"ordinary_double_array_member") ptr_0
+instance WriteRaw Ordinary_double_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_double_array_struct ordinary_double_array_member_2 -> writeRaw (Proxy @"ordinary_double_array_member") ptr_0 ordinary_double_array_member_2
+deriving via (EquivStorable Ordinary_double_array_struct) instance Storable Ordinary_double_array_struct
+deriving via (IsStructViaReadRaw Ordinary_double_array_struct) instance IsStruct Ordinary_double_array_struct
+instance (~) ty (ConstantArray 10 CDouble) =>
+         HasField "ordinary_double_array_member"
+                  Ordinary_double_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_double_array_struct{ordinary_double_array_member = y_1},
+                              getField @"ordinary_double_array_member" x_0)
+instance (~) ty (ConstantArray 10 CDouble) =>
+         HasField "ordinary_double_array_member"
+                  (Ptr Ordinary_double_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_double_array_member")
+instance HasCField Ordinary_double_array_struct
+                   "ordinary_double_array_member"
+    where type CFieldType Ordinary_double_array_struct
+                          "ordinary_double_array_member" = ConstantArray 10 CDouble
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_char_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 269:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_char_array_struct
+    = Ordinary_signed_char_array_struct {ordinary_signed_char_array_member :: (ConstantArray 10
+                                                                                             CChar)
+                                         {- ^ __C declaration:__ @ordinary_signed_char_array_member@
+
+                                              __defined at:__ @comprehensive\/c2hsc.h 269:68@
+
+                                              __exported by:__ @comprehensive\/c2hsc.h@
+                                         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_char_array_struct
+    where staticSizeOf = \_ -> 10 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Ordinary_signed_char_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_char_array_struct <*> readRaw (Proxy @"ordinary_signed_char_array_member") ptr_0
+instance WriteRaw Ordinary_signed_char_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_char_array_struct ordinary_signed_char_array_member_2 -> writeRaw (Proxy @"ordinary_signed_char_array_member") ptr_0 ordinary_signed_char_array_member_2
+deriving via (EquivStorable Ordinary_signed_char_array_struct) instance Storable Ordinary_signed_char_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_char_array_struct) instance IsStruct Ordinary_signed_char_array_struct
+instance (~) ty (ConstantArray 10 CChar) =>
+         HasField "ordinary_signed_char_array_member"
+                  Ordinary_signed_char_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_char_array_struct{ordinary_signed_char_array_member = y_1},
+                              getField @"ordinary_signed_char_array_member" x_0)
+instance (~) ty (ConstantArray 10 CChar) =>
+         HasField "ordinary_signed_char_array_member"
+                  (Ptr Ordinary_signed_char_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_char_array_member")
+instance HasCField Ordinary_signed_char_array_struct
+                   "ordinary_signed_char_array_member"
+    where type CFieldType Ordinary_signed_char_array_struct
+                          "ordinary_signed_char_array_member" = ConstantArray 10 CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_char_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 270:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_char_array_struct
+    = Explicit_signed_char_array_struct {explicit_signed_char_array_member :: (ConstantArray 10
+                                                                                             CSChar)
+                                         {- ^ __C declaration:__ @explicit_signed_char_array_member@
+
+                                              __defined at:__ @comprehensive\/c2hsc.h 270:68@
+
+                                              __exported by:__ @comprehensive\/c2hsc.h@
+                                         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_char_array_struct
+    where staticSizeOf = \_ -> 10 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Explicit_signed_char_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_char_array_struct <*> readRaw (Proxy @"explicit_signed_char_array_member") ptr_0
+instance WriteRaw Explicit_signed_char_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_char_array_struct explicit_signed_char_array_member_2 -> writeRaw (Proxy @"explicit_signed_char_array_member") ptr_0 explicit_signed_char_array_member_2
+deriving via (EquivStorable Explicit_signed_char_array_struct) instance Storable Explicit_signed_char_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_char_array_struct) instance IsStruct Explicit_signed_char_array_struct
+instance (~) ty (ConstantArray 10 CSChar) =>
+         HasField "explicit_signed_char_array_member"
+                  Explicit_signed_char_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_char_array_struct{explicit_signed_char_array_member = y_1},
+                              getField @"explicit_signed_char_array_member" x_0)
+instance (~) ty (ConstantArray 10 CSChar) =>
+         HasField "explicit_signed_char_array_member"
+                  (Ptr Explicit_signed_char_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_char_array_member")
+instance HasCField Explicit_signed_char_array_struct
+                   "explicit_signed_char_array_member"
+    where type CFieldType Explicit_signed_char_array_struct
+                          "explicit_signed_char_array_member" = ConstantArray 10 CSChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_char_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 271:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_char_array_struct
+    = Unsigned_char_array_struct {unsigned_char_array_member :: (ConstantArray 10
+                                                                               CUChar)
+                                  {- ^ __C declaration:__ @unsigned_char_array_member@
+
+                                       __defined at:__ @comprehensive\/c2hsc.h 271:68@
+
+                                       __exported by:__ @comprehensive\/c2hsc.h@
+                                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_char_array_struct
+    where staticSizeOf = \_ -> 10 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Unsigned_char_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_char_array_struct <*> readRaw (Proxy @"unsigned_char_array_member") ptr_0
+instance WriteRaw Unsigned_char_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_char_array_struct unsigned_char_array_member_2 -> writeRaw (Proxy @"unsigned_char_array_member") ptr_0 unsigned_char_array_member_2
+deriving via (EquivStorable Unsigned_char_array_struct) instance Storable Unsigned_char_array_struct
+deriving via (IsStructViaReadRaw Unsigned_char_array_struct) instance IsStruct Unsigned_char_array_struct
+instance (~) ty (ConstantArray 10 CUChar) =>
+         HasField "unsigned_char_array_member" Unsigned_char_array_struct ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_char_array_struct{unsigned_char_array_member = y_1},
+                              getField @"unsigned_char_array_member" x_0)
+instance (~) ty (ConstantArray 10 CUChar) =>
+         HasField "unsigned_char_array_member"
+                  (Ptr Unsigned_char_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_char_array_member")
+instance HasCField Unsigned_char_array_struct
+                   "unsigned_char_array_member"
+    where type CFieldType Unsigned_char_array_struct
+                          "unsigned_char_array_member" = ConstantArray 10 CUChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_short_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 273:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_short_array_struct
+    = Ordinary_signed_short_array_struct {ordinary_signed_short_array_member :: (ConstantArray 10
+                                                                                               CShort)
+                                          {- ^ __C declaration:__ @ordinary_signed_short_array_member@
+
+                                               __defined at:__ @comprehensive\/c2hsc.h 273:68@
+
+                                               __exported by:__ @comprehensive\/c2hsc.h@
+                                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_short_array_struct
+    where staticSizeOf = \_ -> 20 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Ordinary_signed_short_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_short_array_struct <*> readRaw (Proxy @"ordinary_signed_short_array_member") ptr_0
+instance WriteRaw Ordinary_signed_short_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_short_array_struct ordinary_signed_short_array_member_2 -> writeRaw (Proxy @"ordinary_signed_short_array_member") ptr_0 ordinary_signed_short_array_member_2
+deriving via (EquivStorable Ordinary_signed_short_array_struct) instance Storable Ordinary_signed_short_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_short_array_struct) instance IsStruct Ordinary_signed_short_array_struct
+instance (~) ty (ConstantArray 10 CShort) =>
+         HasField "ordinary_signed_short_array_member"
+                  Ordinary_signed_short_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_short_array_struct{ordinary_signed_short_array_member = y_1},
+                              getField @"ordinary_signed_short_array_member" x_0)
+instance (~) ty (ConstantArray 10 CShort) =>
+         HasField "ordinary_signed_short_array_member"
+                  (Ptr Ordinary_signed_short_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_short_array_member")
+instance HasCField Ordinary_signed_short_array_struct
+                   "ordinary_signed_short_array_member"
+    where type CFieldType Ordinary_signed_short_array_struct
+                          "ordinary_signed_short_array_member" = ConstantArray 10 CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_short_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 274:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_short_array_struct
+    = Explicit_signed_short_array_struct {explicit_signed_short_array_member :: (ConstantArray 10
+                                                                                               CShort)
+                                          {- ^ __C declaration:__ @explicit_signed_short_array_member@
+
+                                               __defined at:__ @comprehensive\/c2hsc.h 274:68@
+
+                                               __exported by:__ @comprehensive\/c2hsc.h@
+                                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_short_array_struct
+    where staticSizeOf = \_ -> 20 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Explicit_signed_short_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_short_array_struct <*> readRaw (Proxy @"explicit_signed_short_array_member") ptr_0
+instance WriteRaw Explicit_signed_short_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_short_array_struct explicit_signed_short_array_member_2 -> writeRaw (Proxy @"explicit_signed_short_array_member") ptr_0 explicit_signed_short_array_member_2
+deriving via (EquivStorable Explicit_signed_short_array_struct) instance Storable Explicit_signed_short_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_short_array_struct) instance IsStruct Explicit_signed_short_array_struct
+instance (~) ty (ConstantArray 10 CShort) =>
+         HasField "explicit_signed_short_array_member"
+                  Explicit_signed_short_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_short_array_struct{explicit_signed_short_array_member = y_1},
+                              getField @"explicit_signed_short_array_member" x_0)
+instance (~) ty (ConstantArray 10 CShort) =>
+         HasField "explicit_signed_short_array_member"
+                  (Ptr Explicit_signed_short_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_short_array_member")
+instance HasCField Explicit_signed_short_array_struct
+                   "explicit_signed_short_array_member"
+    where type CFieldType Explicit_signed_short_array_struct
+                          "explicit_signed_short_array_member" = ConstantArray 10 CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_short_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 275:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_short_array_struct
+    = Unsigned_short_array_struct {unsigned_short_array_member :: (ConstantArray 10
+                                                                                 CUShort)
+                                   {- ^ __C declaration:__ @unsigned_short_array_member@
+
+                                        __defined at:__ @comprehensive\/c2hsc.h 275:68@
+
+                                        __exported by:__ @comprehensive\/c2hsc.h@
+                                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_short_array_struct
+    where staticSizeOf = \_ -> 20 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Unsigned_short_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_short_array_struct <*> readRaw (Proxy @"unsigned_short_array_member") ptr_0
+instance WriteRaw Unsigned_short_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_short_array_struct unsigned_short_array_member_2 -> writeRaw (Proxy @"unsigned_short_array_member") ptr_0 unsigned_short_array_member_2
+deriving via (EquivStorable Unsigned_short_array_struct) instance Storable Unsigned_short_array_struct
+deriving via (IsStructViaReadRaw Unsigned_short_array_struct) instance IsStruct Unsigned_short_array_struct
+instance (~) ty (ConstantArray 10 CUShort) =>
+         HasField "unsigned_short_array_member"
+                  Unsigned_short_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_short_array_struct{unsigned_short_array_member = y_1},
+                              getField @"unsigned_short_array_member" x_0)
+instance (~) ty (ConstantArray 10 CUShort) =>
+         HasField "unsigned_short_array_member"
+                  (Ptr Unsigned_short_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_short_array_member")
+instance HasCField Unsigned_short_array_struct
+                   "unsigned_short_array_member"
+    where type CFieldType Unsigned_short_array_struct
+                          "unsigned_short_array_member" = ConstantArray 10 CUShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_int_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 277:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_int_array_struct
+    = Ordinary_signed_int_array_struct {ordinary_signed_int_array_member :: (ConstantArray 10
+                                                                                           CInt)
+                                        {- ^ __C declaration:__ @ordinary_signed_int_array_member@
+
+                                             __defined at:__ @comprehensive\/c2hsc.h 277:68@
+
+                                             __exported by:__ @comprehensive\/c2hsc.h@
+                                        -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_int_array_struct
+    where staticSizeOf = \_ -> 40 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Ordinary_signed_int_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_int_array_struct <*> readRaw (Proxy @"ordinary_signed_int_array_member") ptr_0
+instance WriteRaw Ordinary_signed_int_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_int_array_struct ordinary_signed_int_array_member_2 -> writeRaw (Proxy @"ordinary_signed_int_array_member") ptr_0 ordinary_signed_int_array_member_2
+deriving via (EquivStorable Ordinary_signed_int_array_struct) instance Storable Ordinary_signed_int_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_int_array_struct) instance IsStruct Ordinary_signed_int_array_struct
+instance (~) ty (ConstantArray 10 CInt) =>
+         HasField "ordinary_signed_int_array_member"
+                  Ordinary_signed_int_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_int_array_struct{ordinary_signed_int_array_member = y_1},
+                              getField @"ordinary_signed_int_array_member" x_0)
+instance (~) ty (ConstantArray 10 CInt) =>
+         HasField "ordinary_signed_int_array_member"
+                  (Ptr Ordinary_signed_int_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_int_array_member")
+instance HasCField Ordinary_signed_int_array_struct
+                   "ordinary_signed_int_array_member"
+    where type CFieldType Ordinary_signed_int_array_struct
+                          "ordinary_signed_int_array_member" = ConstantArray 10 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_int_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 278:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_int_array_struct
+    = Explicit_signed_int_array_struct {explicit_signed_int_array_member :: (ConstantArray 10
+                                                                                           CInt)
+                                        {- ^ __C declaration:__ @explicit_signed_int_array_member@
+
+                                             __defined at:__ @comprehensive\/c2hsc.h 278:68@
+
+                                             __exported by:__ @comprehensive\/c2hsc.h@
+                                        -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_int_array_struct
+    where staticSizeOf = \_ -> 40 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Explicit_signed_int_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_int_array_struct <*> readRaw (Proxy @"explicit_signed_int_array_member") ptr_0
+instance WriteRaw Explicit_signed_int_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_int_array_struct explicit_signed_int_array_member_2 -> writeRaw (Proxy @"explicit_signed_int_array_member") ptr_0 explicit_signed_int_array_member_2
+deriving via (EquivStorable Explicit_signed_int_array_struct) instance Storable Explicit_signed_int_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_int_array_struct) instance IsStruct Explicit_signed_int_array_struct
+instance (~) ty (ConstantArray 10 CInt) =>
+         HasField "explicit_signed_int_array_member"
+                  Explicit_signed_int_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_int_array_struct{explicit_signed_int_array_member = y_1},
+                              getField @"explicit_signed_int_array_member" x_0)
+instance (~) ty (ConstantArray 10 CInt) =>
+         HasField "explicit_signed_int_array_member"
+                  (Ptr Explicit_signed_int_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_int_array_member")
+instance HasCField Explicit_signed_int_array_struct
+                   "explicit_signed_int_array_member"
+    where type CFieldType Explicit_signed_int_array_struct
+                          "explicit_signed_int_array_member" = ConstantArray 10 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_int_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 279:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_int_array_struct
+    = Unsigned_int_array_struct {unsigned_int_array_member :: (ConstantArray 10
+                                                                             CUInt)
+                                 {- ^ __C declaration:__ @unsigned_int_array_member@
+
+                                      __defined at:__ @comprehensive\/c2hsc.h 279:68@
+
+                                      __exported by:__ @comprehensive\/c2hsc.h@
+                                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_int_array_struct
+    where staticSizeOf = \_ -> 40 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Unsigned_int_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_int_array_struct <*> readRaw (Proxy @"unsigned_int_array_member") ptr_0
+instance WriteRaw Unsigned_int_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_int_array_struct unsigned_int_array_member_2 -> writeRaw (Proxy @"unsigned_int_array_member") ptr_0 unsigned_int_array_member_2
+deriving via (EquivStorable Unsigned_int_array_struct) instance Storable Unsigned_int_array_struct
+deriving via (IsStructViaReadRaw Unsigned_int_array_struct) instance IsStruct Unsigned_int_array_struct
+instance (~) ty (ConstantArray 10 CUInt) =>
+         HasField "unsigned_int_array_member" Unsigned_int_array_struct ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_int_array_struct{unsigned_int_array_member = y_1},
+                              getField @"unsigned_int_array_member" x_0)
+instance (~) ty (ConstantArray 10 CUInt) =>
+         HasField "unsigned_int_array_member"
+                  (Ptr Unsigned_int_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_int_array_member")
+instance HasCField Unsigned_int_array_struct
+                   "unsigned_int_array_member"
+    where type CFieldType Unsigned_int_array_struct
+                          "unsigned_int_array_member" = ConstantArray 10 CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 281:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_array_struct
+    = Ordinary_signed_long_array_struct {ordinary_signed_long_array_member :: (ConstantArray 10
+                                                                                             CLong)
+                                         {- ^ __C declaration:__ @ordinary_signed_long_array_member@
+
+                                              __defined at:__ @comprehensive\/c2hsc.h 281:68@
+
+                                              __exported by:__ @comprehensive\/c2hsc.h@
+                                         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_long_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_long_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_long_array_struct <*> readRaw (Proxy @"ordinary_signed_long_array_member") ptr_0
+instance WriteRaw Ordinary_signed_long_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_long_array_struct ordinary_signed_long_array_member_2 -> writeRaw (Proxy @"ordinary_signed_long_array_member") ptr_0 ordinary_signed_long_array_member_2
+deriving via (EquivStorable Ordinary_signed_long_array_struct) instance Storable Ordinary_signed_long_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_long_array_struct) instance IsStruct Ordinary_signed_long_array_struct
+instance (~) ty (ConstantArray 10 CLong) =>
+         HasField "ordinary_signed_long_array_member"
+                  Ordinary_signed_long_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_long_array_struct{ordinary_signed_long_array_member = y_1},
+                              getField @"ordinary_signed_long_array_member" x_0)
+instance (~) ty (ConstantArray 10 CLong) =>
+         HasField "ordinary_signed_long_array_member"
+                  (Ptr Ordinary_signed_long_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_long_array_member")
+instance HasCField Ordinary_signed_long_array_struct
+                   "ordinary_signed_long_array_member"
+    where type CFieldType Ordinary_signed_long_array_struct
+                          "ordinary_signed_long_array_member" = ConstantArray 10 CLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 282:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_array_struct
+    = Explicit_signed_long_array_struct {explicit_signed_long_array_member :: (ConstantArray 10
+                                                                                             CLong)
+                                         {- ^ __C declaration:__ @explicit_signed_long_array_member@
+
+                                              __defined at:__ @comprehensive\/c2hsc.h 282:68@
+
+                                              __exported by:__ @comprehensive\/c2hsc.h@
+                                         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_long_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_long_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_long_array_struct <*> readRaw (Proxy @"explicit_signed_long_array_member") ptr_0
+instance WriteRaw Explicit_signed_long_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_long_array_struct explicit_signed_long_array_member_2 -> writeRaw (Proxy @"explicit_signed_long_array_member") ptr_0 explicit_signed_long_array_member_2
+deriving via (EquivStorable Explicit_signed_long_array_struct) instance Storable Explicit_signed_long_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_long_array_struct) instance IsStruct Explicit_signed_long_array_struct
+instance (~) ty (ConstantArray 10 CLong) =>
+         HasField "explicit_signed_long_array_member"
+                  Explicit_signed_long_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_long_array_struct{explicit_signed_long_array_member = y_1},
+                              getField @"explicit_signed_long_array_member" x_0)
+instance (~) ty (ConstantArray 10 CLong) =>
+         HasField "explicit_signed_long_array_member"
+                  (Ptr Explicit_signed_long_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_long_array_member")
+instance HasCField Explicit_signed_long_array_struct
+                   "explicit_signed_long_array_member"
+    where type CFieldType Explicit_signed_long_array_struct
+                          "explicit_signed_long_array_member" = ConstantArray 10 CLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 283:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_array_struct
+    = Unsigned_long_array_struct {unsigned_long_array_member :: (ConstantArray 10
+                                                                               CULong)
+                                  {- ^ __C declaration:__ @unsigned_long_array_member@
+
+                                       __defined at:__ @comprehensive\/c2hsc.h 283:68@
+
+                                       __exported by:__ @comprehensive\/c2hsc.h@
+                                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_long_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_long_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_long_array_struct <*> readRaw (Proxy @"unsigned_long_array_member") ptr_0
+instance WriteRaw Unsigned_long_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_long_array_struct unsigned_long_array_member_2 -> writeRaw (Proxy @"unsigned_long_array_member") ptr_0 unsigned_long_array_member_2
+deriving via (EquivStorable Unsigned_long_array_struct) instance Storable Unsigned_long_array_struct
+deriving via (IsStructViaReadRaw Unsigned_long_array_struct) instance IsStruct Unsigned_long_array_struct
+instance (~) ty (ConstantArray 10 CULong) =>
+         HasField "unsigned_long_array_member" Unsigned_long_array_struct ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_long_array_struct{unsigned_long_array_member = y_1},
+                              getField @"unsigned_long_array_member" x_0)
+instance (~) ty (ConstantArray 10 CULong) =>
+         HasField "unsigned_long_array_member"
+                  (Ptr Unsigned_long_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_long_array_member")
+instance HasCField Unsigned_long_array_struct
+                   "unsigned_long_array_member"
+    where type CFieldType Unsigned_long_array_struct
+                          "unsigned_long_array_member" = ConstantArray 10 CULong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_long_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 285:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_long_array_struct
+    = Ordinary_signed_long_long_array_struct {ordinary_signed_long_long_array_member :: (ConstantArray 10
+                                                                                                       CLLong)
+                                              {- ^ __C declaration:__ @ordinary_signed_long_long_array_member@
+
+                                                   __defined at:__ @comprehensive\/c2hsc.h 285:68@
+
+                                                   __exported by:__ @comprehensive\/c2hsc.h@
+                                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_long_long_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_long_long_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_long_long_array_struct <*> readRaw (Proxy @"ordinary_signed_long_long_array_member") ptr_0
+instance WriteRaw Ordinary_signed_long_long_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_long_long_array_struct ordinary_signed_long_long_array_member_2 -> writeRaw (Proxy @"ordinary_signed_long_long_array_member") ptr_0 ordinary_signed_long_long_array_member_2
+deriving via (EquivStorable Ordinary_signed_long_long_array_struct) instance Storable Ordinary_signed_long_long_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_long_long_array_struct) instance IsStruct Ordinary_signed_long_long_array_struct
+instance (~) ty (ConstantArray 10 CLLong) =>
+         HasField "ordinary_signed_long_long_array_member"
+                  Ordinary_signed_long_long_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_long_long_array_struct{ordinary_signed_long_long_array_member = y_1},
+                              getField @"ordinary_signed_long_long_array_member" x_0)
+instance (~) ty (ConstantArray 10 CLLong) =>
+         HasField "ordinary_signed_long_long_array_member"
+                  (Ptr Ordinary_signed_long_long_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_long_long_array_member")
+instance HasCField Ordinary_signed_long_long_array_struct
+                   "ordinary_signed_long_long_array_member"
+    where type CFieldType Ordinary_signed_long_long_array_struct
+                          "ordinary_signed_long_long_array_member" = ConstantArray 10 CLLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_long_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 286:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_long_array_struct
+    = Explicit_signed_long_long_array_struct {explicit_signed_long_long_array_member :: (ConstantArray 10
+                                                                                                       CLLong)
+                                              {- ^ __C declaration:__ @explicit_signed_long_long_array_member@
+
+                                                   __defined at:__ @comprehensive\/c2hsc.h 286:68@
+
+                                                   __exported by:__ @comprehensive\/c2hsc.h@
+                                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_long_long_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_long_long_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_long_long_array_struct <*> readRaw (Proxy @"explicit_signed_long_long_array_member") ptr_0
+instance WriteRaw Explicit_signed_long_long_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_long_long_array_struct explicit_signed_long_long_array_member_2 -> writeRaw (Proxy @"explicit_signed_long_long_array_member") ptr_0 explicit_signed_long_long_array_member_2
+deriving via (EquivStorable Explicit_signed_long_long_array_struct) instance Storable Explicit_signed_long_long_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_long_long_array_struct) instance IsStruct Explicit_signed_long_long_array_struct
+instance (~) ty (ConstantArray 10 CLLong) =>
+         HasField "explicit_signed_long_long_array_member"
+                  Explicit_signed_long_long_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_long_long_array_struct{explicit_signed_long_long_array_member = y_1},
+                              getField @"explicit_signed_long_long_array_member" x_0)
+instance (~) ty (ConstantArray 10 CLLong) =>
+         HasField "explicit_signed_long_long_array_member"
+                  (Ptr Explicit_signed_long_long_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_long_long_array_member")
+instance HasCField Explicit_signed_long_long_array_struct
+                   "explicit_signed_long_long_array_member"
+    where type CFieldType Explicit_signed_long_long_array_struct
+                          "explicit_signed_long_long_array_member" = ConstantArray 10 CLLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_long_long_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 287:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_long_array_struct
+    = Unsigned_long_long_array_struct {unsigned_long_long_array_member :: (ConstantArray 10
+                                                                                         CULLong)
+                                       {- ^ __C declaration:__ @unsigned_long_long_array_member@
+
+                                            __defined at:__ @comprehensive\/c2hsc.h 287:68@
+
+                                            __exported by:__ @comprehensive\/c2hsc.h@
+                                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_long_long_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_long_long_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_long_long_array_struct <*> readRaw (Proxy @"unsigned_long_long_array_member") ptr_0
+instance WriteRaw Unsigned_long_long_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_long_long_array_struct unsigned_long_long_array_member_2 -> writeRaw (Proxy @"unsigned_long_long_array_member") ptr_0 unsigned_long_long_array_member_2
+deriving via (EquivStorable Unsigned_long_long_array_struct) instance Storable Unsigned_long_long_array_struct
+deriving via (IsStructViaReadRaw Unsigned_long_long_array_struct) instance IsStruct Unsigned_long_long_array_struct
+instance (~) ty (ConstantArray 10 CULLong) =>
+         HasField "unsigned_long_long_array_member"
+                  Unsigned_long_long_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_long_long_array_struct{unsigned_long_long_array_member = y_1},
+                              getField @"unsigned_long_long_array_member" x_0)
+instance (~) ty (ConstantArray 10 CULLong) =>
+         HasField "unsigned_long_long_array_member"
+                  (Ptr Unsigned_long_long_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_long_long_array_member")
+instance HasCField Unsigned_long_long_array_struct
+                   "unsigned_long_long_array_member"
+    where type CFieldType Unsigned_long_long_array_struct
+                          "unsigned_long_long_array_member" = ConstantArray 10 CULLong
+          offset# = \_ -> \_ -> 0
+{-| Structs: arrays of pointers
+
+    NOTE: Here too @'Ordinary_signed_char_pointer_array_struct'@ was commented out in the original test suite, with no reason given.
+
+    __C declaration:__ @struct ordinary_void_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 296:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_void_pointer_array_struct
+    = Ordinary_void_pointer_array_struct {ordinary_void_pointer_array_member :: (ConstantArray 10
+                                                                                               (Ptr Void))
+                                          {- ^ __C declaration:__ @ordinary_void_pointer_array_member@
+
+                                               __defined at:__ @comprehensive\/c2hsc.h 296:77@
+
+                                               __exported by:__ @comprehensive\/c2hsc.h@
+                                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_void_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_void_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_void_pointer_array_struct <*> readRaw (Proxy @"ordinary_void_pointer_array_member") ptr_0
+instance WriteRaw Ordinary_void_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_void_pointer_array_struct ordinary_void_pointer_array_member_2 -> writeRaw (Proxy @"ordinary_void_pointer_array_member") ptr_0 ordinary_void_pointer_array_member_2
+deriving via (EquivStorable Ordinary_void_pointer_array_struct) instance Storable Ordinary_void_pointer_array_struct
+deriving via (IsStructViaReadRaw Ordinary_void_pointer_array_struct) instance IsStruct Ordinary_void_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr Void)) =>
+         HasField "ordinary_void_pointer_array_member"
+                  Ordinary_void_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_void_pointer_array_struct{ordinary_void_pointer_array_member = y_1},
+                              getField @"ordinary_void_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr Void)) =>
+         HasField "ordinary_void_pointer_array_member"
+                  (Ptr Ordinary_void_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_void_pointer_array_member")
+instance HasCField Ordinary_void_pointer_array_struct
+                   "ordinary_void_pointer_array_member"
+    where type CFieldType Ordinary_void_pointer_array_struct
+                          "ordinary_void_pointer_array_member" = ConstantArray 10 (Ptr Void)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_float_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 298:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_float_pointer_array_struct
+    = Ordinary_float_pointer_array_struct {ordinary_float_pointer_array_member :: (ConstantArray 10
+                                                                                                 (Ptr CFloat))
+                                           {- ^ __C declaration:__ @ordinary_float_pointer_array_member@
+
+                                                __defined at:__ @comprehensive\/c2hsc.h 298:77@
+
+                                                __exported by:__ @comprehensive\/c2hsc.h@
+                                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_float_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_float_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_float_pointer_array_struct <*> readRaw (Proxy @"ordinary_float_pointer_array_member") ptr_0
+instance WriteRaw Ordinary_float_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_float_pointer_array_struct ordinary_float_pointer_array_member_2 -> writeRaw (Proxy @"ordinary_float_pointer_array_member") ptr_0 ordinary_float_pointer_array_member_2
+deriving via (EquivStorable Ordinary_float_pointer_array_struct) instance Storable Ordinary_float_pointer_array_struct
+deriving via (IsStructViaReadRaw Ordinary_float_pointer_array_struct) instance IsStruct Ordinary_float_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CFloat)) =>
+         HasField "ordinary_float_pointer_array_member"
+                  Ordinary_float_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_float_pointer_array_struct{ordinary_float_pointer_array_member = y_1},
+                              getField @"ordinary_float_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CFloat)) =>
+         HasField "ordinary_float_pointer_array_member"
+                  (Ptr Ordinary_float_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_float_pointer_array_member")
+instance HasCField Ordinary_float_pointer_array_struct
+                   "ordinary_float_pointer_array_member"
+    where type CFieldType Ordinary_float_pointer_array_struct
+                          "ordinary_float_pointer_array_member" = ConstantArray 10
+                                                                                (Ptr CFloat)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_double_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 299:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_double_pointer_array_struct
+    = Ordinary_double_pointer_array_struct {ordinary_double_pointer_array_member :: (ConstantArray 10
+                                                                                                   (Ptr CDouble))
+                                            {- ^ __C declaration:__ @ordinary_double_pointer_array_member@
+
+                                                 __defined at:__ @comprehensive\/c2hsc.h 299:77@
+
+                                                 __exported by:__ @comprehensive\/c2hsc.h@
+                                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_double_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_double_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_double_pointer_array_struct <*> readRaw (Proxy @"ordinary_double_pointer_array_member") ptr_0
+instance WriteRaw Ordinary_double_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_double_pointer_array_struct ordinary_double_pointer_array_member_2 -> writeRaw (Proxy @"ordinary_double_pointer_array_member") ptr_0 ordinary_double_pointer_array_member_2
+deriving via (EquivStorable Ordinary_double_pointer_array_struct) instance Storable Ordinary_double_pointer_array_struct
+deriving via (IsStructViaReadRaw Ordinary_double_pointer_array_struct) instance IsStruct Ordinary_double_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CDouble)) =>
+         HasField "ordinary_double_pointer_array_member"
+                  Ordinary_double_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_double_pointer_array_struct{ordinary_double_pointer_array_member = y_1},
+                              getField @"ordinary_double_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CDouble)) =>
+         HasField "ordinary_double_pointer_array_member"
+                  (Ptr Ordinary_double_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_double_pointer_array_member")
+instance HasCField Ordinary_double_pointer_array_struct
+                   "ordinary_double_pointer_array_member"
+    where type CFieldType Ordinary_double_pointer_array_struct
+                          "ordinary_double_pointer_array_member" = ConstantArray 10
+                                                                                 (Ptr CDouble)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_char_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 302:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_char_pointer_array_struct
+    = Ordinary_signed_char_pointer_array_struct {ordinary_signed_char_pointer_array_member :: (ConstantArray 10
+                                                                                                             (Ptr CChar))
+                                                 {- ^ __C declaration:__ @ordinary_signed_char_pointer_array_member@
+
+                                                      __defined at:__ @comprehensive\/c2hsc.h 302:77@
+
+                                                      __exported by:__ @comprehensive\/c2hsc.h@
+                                                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_char_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_char_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_char_pointer_array_struct <*> readRaw (Proxy @"ordinary_signed_char_pointer_array_member") ptr_0
+instance WriteRaw Ordinary_signed_char_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_char_pointer_array_struct ordinary_signed_char_pointer_array_member_2 -> writeRaw (Proxy @"ordinary_signed_char_pointer_array_member") ptr_0 ordinary_signed_char_pointer_array_member_2
+deriving via (EquivStorable Ordinary_signed_char_pointer_array_struct) instance Storable Ordinary_signed_char_pointer_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_char_pointer_array_struct) instance IsStruct Ordinary_signed_char_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CChar)) =>
+         HasField "ordinary_signed_char_pointer_array_member"
+                  Ordinary_signed_char_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_char_pointer_array_struct{ordinary_signed_char_pointer_array_member = y_1},
+                              getField @"ordinary_signed_char_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CChar)) =>
+         HasField "ordinary_signed_char_pointer_array_member"
+                  (Ptr Ordinary_signed_char_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_char_pointer_array_member")
+instance HasCField Ordinary_signed_char_pointer_array_struct
+                   "ordinary_signed_char_pointer_array_member"
+    where type CFieldType Ordinary_signed_char_pointer_array_struct
+                          "ordinary_signed_char_pointer_array_member" = ConstantArray 10
+                                                                                      (Ptr CChar)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_char_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 303:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_char_pointer_array_struct
+    = Explicit_signed_char_pointer_array_struct {explicit_signed_char_pointer_array_member :: (ConstantArray 10
+                                                                                                             (Ptr CSChar))
+                                                 {- ^ __C declaration:__ @explicit_signed_char_pointer_array_member@
+
+                                                      __defined at:__ @comprehensive\/c2hsc.h 303:77@
+
+                                                      __exported by:__ @comprehensive\/c2hsc.h@
+                                                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_char_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_char_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_char_pointer_array_struct <*> readRaw (Proxy @"explicit_signed_char_pointer_array_member") ptr_0
+instance WriteRaw Explicit_signed_char_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_char_pointer_array_struct explicit_signed_char_pointer_array_member_2 -> writeRaw (Proxy @"explicit_signed_char_pointer_array_member") ptr_0 explicit_signed_char_pointer_array_member_2
+deriving via (EquivStorable Explicit_signed_char_pointer_array_struct) instance Storable Explicit_signed_char_pointer_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_char_pointer_array_struct) instance IsStruct Explicit_signed_char_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CSChar)) =>
+         HasField "explicit_signed_char_pointer_array_member"
+                  Explicit_signed_char_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_char_pointer_array_struct{explicit_signed_char_pointer_array_member = y_1},
+                              getField @"explicit_signed_char_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CSChar)) =>
+         HasField "explicit_signed_char_pointer_array_member"
+                  (Ptr Explicit_signed_char_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_char_pointer_array_member")
+instance HasCField Explicit_signed_char_pointer_array_struct
+                   "explicit_signed_char_pointer_array_member"
+    where type CFieldType Explicit_signed_char_pointer_array_struct
+                          "explicit_signed_char_pointer_array_member" = ConstantArray 10
+                                                                                      (Ptr CSChar)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_char_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 304:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_char_pointer_array_struct
+    = Unsigned_char_pointer_array_struct {unsigned_char_pointer_array_member :: (ConstantArray 10
+                                                                                               (Ptr CUChar))
+                                          {- ^ __C declaration:__ @unsigned_char_pointer_array_member@
+
+                                               __defined at:__ @comprehensive\/c2hsc.h 304:77@
+
+                                               __exported by:__ @comprehensive\/c2hsc.h@
+                                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_char_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_char_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_char_pointer_array_struct <*> readRaw (Proxy @"unsigned_char_pointer_array_member") ptr_0
+instance WriteRaw Unsigned_char_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_char_pointer_array_struct unsigned_char_pointer_array_member_2 -> writeRaw (Proxy @"unsigned_char_pointer_array_member") ptr_0 unsigned_char_pointer_array_member_2
+deriving via (EquivStorable Unsigned_char_pointer_array_struct) instance Storable Unsigned_char_pointer_array_struct
+deriving via (IsStructViaReadRaw Unsigned_char_pointer_array_struct) instance IsStruct Unsigned_char_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CUChar)) =>
+         HasField "unsigned_char_pointer_array_member"
+                  Unsigned_char_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_char_pointer_array_struct{unsigned_char_pointer_array_member = y_1},
+                              getField @"unsigned_char_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CUChar)) =>
+         HasField "unsigned_char_pointer_array_member"
+                  (Ptr Unsigned_char_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_char_pointer_array_member")
+instance HasCField Unsigned_char_pointer_array_struct
+                   "unsigned_char_pointer_array_member"
+    where type CFieldType Unsigned_char_pointer_array_struct
+                          "unsigned_char_pointer_array_member" = ConstantArray 10
+                                                                               (Ptr CUChar)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_short_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 306:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_short_pointer_array_struct
+    = Ordinary_signed_short_pointer_array_struct {ordinary_signed_short_pointer_array_member :: (ConstantArray 10
+                                                                                                               (Ptr CShort))
+                                                  {- ^ __C declaration:__ @ordinary_signed_short_pointer_array_member@
+
+                                                       __defined at:__ @comprehensive\/c2hsc.h 306:77@
+
+                                                       __exported by:__ @comprehensive\/c2hsc.h@
+                                                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_short_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_short_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_short_pointer_array_struct <*> readRaw (Proxy @"ordinary_signed_short_pointer_array_member") ptr_0
+instance WriteRaw Ordinary_signed_short_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_short_pointer_array_struct ordinary_signed_short_pointer_array_member_2 -> writeRaw (Proxy @"ordinary_signed_short_pointer_array_member") ptr_0 ordinary_signed_short_pointer_array_member_2
+deriving via (EquivStorable Ordinary_signed_short_pointer_array_struct) instance Storable Ordinary_signed_short_pointer_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_short_pointer_array_struct) instance IsStruct Ordinary_signed_short_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CShort)) =>
+         HasField "ordinary_signed_short_pointer_array_member"
+                  Ordinary_signed_short_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_short_pointer_array_struct{ordinary_signed_short_pointer_array_member = y_1},
+                              getField @"ordinary_signed_short_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CShort)) =>
+         HasField "ordinary_signed_short_pointer_array_member"
+                  (Ptr Ordinary_signed_short_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_short_pointer_array_member")
+instance HasCField Ordinary_signed_short_pointer_array_struct
+                   "ordinary_signed_short_pointer_array_member"
+    where type CFieldType Ordinary_signed_short_pointer_array_struct
+                          "ordinary_signed_short_pointer_array_member" = ConstantArray 10
+                                                                                       (Ptr CShort)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_short_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 307:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_short_pointer_array_struct
+    = Explicit_signed_short_pointer_array_struct {explicit_signed_short_pointer_array_member :: (ConstantArray 10
+                                                                                                               (Ptr CShort))
+                                                  {- ^ __C declaration:__ @explicit_signed_short_pointer_array_member@
+
+                                                       __defined at:__ @comprehensive\/c2hsc.h 307:77@
+
+                                                       __exported by:__ @comprehensive\/c2hsc.h@
+                                                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_short_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_short_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_short_pointer_array_struct <*> readRaw (Proxy @"explicit_signed_short_pointer_array_member") ptr_0
+instance WriteRaw Explicit_signed_short_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_short_pointer_array_struct explicit_signed_short_pointer_array_member_2 -> writeRaw (Proxy @"explicit_signed_short_pointer_array_member") ptr_0 explicit_signed_short_pointer_array_member_2
+deriving via (EquivStorable Explicit_signed_short_pointer_array_struct) instance Storable Explicit_signed_short_pointer_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_short_pointer_array_struct) instance IsStruct Explicit_signed_short_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CShort)) =>
+         HasField "explicit_signed_short_pointer_array_member"
+                  Explicit_signed_short_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_short_pointer_array_struct{explicit_signed_short_pointer_array_member = y_1},
+                              getField @"explicit_signed_short_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CShort)) =>
+         HasField "explicit_signed_short_pointer_array_member"
+                  (Ptr Explicit_signed_short_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_short_pointer_array_member")
+instance HasCField Explicit_signed_short_pointer_array_struct
+                   "explicit_signed_short_pointer_array_member"
+    where type CFieldType Explicit_signed_short_pointer_array_struct
+                          "explicit_signed_short_pointer_array_member" = ConstantArray 10
+                                                                                       (Ptr CShort)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_short_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 308:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_short_pointer_array_struct
+    = Unsigned_short_pointer_array_struct {unsigned_short_pointer_array_member :: (ConstantArray 10
+                                                                                                 (Ptr CUShort))
+                                           {- ^ __C declaration:__ @unsigned_short_pointer_array_member@
+
+                                                __defined at:__ @comprehensive\/c2hsc.h 308:77@
+
+                                                __exported by:__ @comprehensive\/c2hsc.h@
+                                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_short_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_short_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_short_pointer_array_struct <*> readRaw (Proxy @"unsigned_short_pointer_array_member") ptr_0
+instance WriteRaw Unsigned_short_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_short_pointer_array_struct unsigned_short_pointer_array_member_2 -> writeRaw (Proxy @"unsigned_short_pointer_array_member") ptr_0 unsigned_short_pointer_array_member_2
+deriving via (EquivStorable Unsigned_short_pointer_array_struct) instance Storable Unsigned_short_pointer_array_struct
+deriving via (IsStructViaReadRaw Unsigned_short_pointer_array_struct) instance IsStruct Unsigned_short_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CUShort)) =>
+         HasField "unsigned_short_pointer_array_member"
+                  Unsigned_short_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_short_pointer_array_struct{unsigned_short_pointer_array_member = y_1},
+                              getField @"unsigned_short_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CUShort)) =>
+         HasField "unsigned_short_pointer_array_member"
+                  (Ptr Unsigned_short_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_short_pointer_array_member")
+instance HasCField Unsigned_short_pointer_array_struct
+                   "unsigned_short_pointer_array_member"
+    where type CFieldType Unsigned_short_pointer_array_struct
+                          "unsigned_short_pointer_array_member" = ConstantArray 10
+                                                                                (Ptr CUShort)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_int_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 310:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_int_pointer_array_struct
+    = Ordinary_signed_int_pointer_array_struct {ordinary_signed_int_pointer_array_member :: (ConstantArray 10
+                                                                                                           (Ptr CInt))
+                                                {- ^ __C declaration:__ @ordinary_signed_int_pointer_array_member@
+
+                                                     __defined at:__ @comprehensive\/c2hsc.h 310:77@
+
+                                                     __exported by:__ @comprehensive\/c2hsc.h@
+                                                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_int_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_int_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_int_pointer_array_struct <*> readRaw (Proxy @"ordinary_signed_int_pointer_array_member") ptr_0
+instance WriteRaw Ordinary_signed_int_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_int_pointer_array_struct ordinary_signed_int_pointer_array_member_2 -> writeRaw (Proxy @"ordinary_signed_int_pointer_array_member") ptr_0 ordinary_signed_int_pointer_array_member_2
+deriving via (EquivStorable Ordinary_signed_int_pointer_array_struct) instance Storable Ordinary_signed_int_pointer_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_int_pointer_array_struct) instance IsStruct Ordinary_signed_int_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CInt)) =>
+         HasField "ordinary_signed_int_pointer_array_member"
+                  Ordinary_signed_int_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_int_pointer_array_struct{ordinary_signed_int_pointer_array_member = y_1},
+                              getField @"ordinary_signed_int_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CInt)) =>
+         HasField "ordinary_signed_int_pointer_array_member"
+                  (Ptr Ordinary_signed_int_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_int_pointer_array_member")
+instance HasCField Ordinary_signed_int_pointer_array_struct
+                   "ordinary_signed_int_pointer_array_member"
+    where type CFieldType Ordinary_signed_int_pointer_array_struct
+                          "ordinary_signed_int_pointer_array_member" = ConstantArray 10
+                                                                                     (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_int_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 311:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_int_pointer_array_struct
+    = Explicit_signed_int_pointer_array_struct {explicit_signed_int_pointer_array_member :: (ConstantArray 10
+                                                                                                           (Ptr CInt))
+                                                {- ^ __C declaration:__ @explicit_signed_int_pointer_array_member@
+
+                                                     __defined at:__ @comprehensive\/c2hsc.h 311:77@
+
+                                                     __exported by:__ @comprehensive\/c2hsc.h@
+                                                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_int_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_int_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_int_pointer_array_struct <*> readRaw (Proxy @"explicit_signed_int_pointer_array_member") ptr_0
+instance WriteRaw Explicit_signed_int_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_int_pointer_array_struct explicit_signed_int_pointer_array_member_2 -> writeRaw (Proxy @"explicit_signed_int_pointer_array_member") ptr_0 explicit_signed_int_pointer_array_member_2
+deriving via (EquivStorable Explicit_signed_int_pointer_array_struct) instance Storable Explicit_signed_int_pointer_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_int_pointer_array_struct) instance IsStruct Explicit_signed_int_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CInt)) =>
+         HasField "explicit_signed_int_pointer_array_member"
+                  Explicit_signed_int_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_int_pointer_array_struct{explicit_signed_int_pointer_array_member = y_1},
+                              getField @"explicit_signed_int_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CInt)) =>
+         HasField "explicit_signed_int_pointer_array_member"
+                  (Ptr Explicit_signed_int_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_int_pointer_array_member")
+instance HasCField Explicit_signed_int_pointer_array_struct
+                   "explicit_signed_int_pointer_array_member"
+    where type CFieldType Explicit_signed_int_pointer_array_struct
+                          "explicit_signed_int_pointer_array_member" = ConstantArray 10
+                                                                                     (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_int_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 312:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_int_pointer_array_struct
+    = Unsigned_int_pointer_array_struct {unsigned_int_pointer_array_member :: (ConstantArray 10
+                                                                                             (Ptr CUInt))
+                                         {- ^ __C declaration:__ @unsigned_int_pointer_array_member@
+
+                                              __defined at:__ @comprehensive\/c2hsc.h 312:77@
+
+                                              __exported by:__ @comprehensive\/c2hsc.h@
+                                         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_int_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_int_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_int_pointer_array_struct <*> readRaw (Proxy @"unsigned_int_pointer_array_member") ptr_0
+instance WriteRaw Unsigned_int_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_int_pointer_array_struct unsigned_int_pointer_array_member_2 -> writeRaw (Proxy @"unsigned_int_pointer_array_member") ptr_0 unsigned_int_pointer_array_member_2
+deriving via (EquivStorable Unsigned_int_pointer_array_struct) instance Storable Unsigned_int_pointer_array_struct
+deriving via (IsStructViaReadRaw Unsigned_int_pointer_array_struct) instance IsStruct Unsigned_int_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CUInt)) =>
+         HasField "unsigned_int_pointer_array_member"
+                  Unsigned_int_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_int_pointer_array_struct{unsigned_int_pointer_array_member = y_1},
+                              getField @"unsigned_int_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CUInt)) =>
+         HasField "unsigned_int_pointer_array_member"
+                  (Ptr Unsigned_int_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_int_pointer_array_member")
+instance HasCField Unsigned_int_pointer_array_struct
+                   "unsigned_int_pointer_array_member"
+    where type CFieldType Unsigned_int_pointer_array_struct
+                          "unsigned_int_pointer_array_member" = ConstantArray 10 (Ptr CUInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 314:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_pointer_array_struct
+    = Ordinary_signed_long_pointer_array_struct {ordinary_signed_long_pointer_array_member :: (ConstantArray 10
+                                                                                                             (Ptr CLong))
+                                                 {- ^ __C declaration:__ @ordinary_signed_long_pointer_array_member@
+
+                                                      __defined at:__ @comprehensive\/c2hsc.h 314:77@
+
+                                                      __exported by:__ @comprehensive\/c2hsc.h@
+                                                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_long_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_long_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_long_pointer_array_struct <*> readRaw (Proxy @"ordinary_signed_long_pointer_array_member") ptr_0
+instance WriteRaw Ordinary_signed_long_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_long_pointer_array_struct ordinary_signed_long_pointer_array_member_2 -> writeRaw (Proxy @"ordinary_signed_long_pointer_array_member") ptr_0 ordinary_signed_long_pointer_array_member_2
+deriving via (EquivStorable Ordinary_signed_long_pointer_array_struct) instance Storable Ordinary_signed_long_pointer_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_long_pointer_array_struct) instance IsStruct Ordinary_signed_long_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CLong)) =>
+         HasField "ordinary_signed_long_pointer_array_member"
+                  Ordinary_signed_long_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_long_pointer_array_struct{ordinary_signed_long_pointer_array_member = y_1},
+                              getField @"ordinary_signed_long_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CLong)) =>
+         HasField "ordinary_signed_long_pointer_array_member"
+                  (Ptr Ordinary_signed_long_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_long_pointer_array_member")
+instance HasCField Ordinary_signed_long_pointer_array_struct
+                   "ordinary_signed_long_pointer_array_member"
+    where type CFieldType Ordinary_signed_long_pointer_array_struct
+                          "ordinary_signed_long_pointer_array_member" = ConstantArray 10
+                                                                                      (Ptr CLong)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 315:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_pointer_array_struct
+    = Explicit_signed_long_pointer_array_struct {explicit_signed_long_pointer_array_member :: (ConstantArray 10
+                                                                                                             (Ptr CLong))
+                                                 {- ^ __C declaration:__ @explicit_signed_long_pointer_array_member@
+
+                                                      __defined at:__ @comprehensive\/c2hsc.h 315:77@
+
+                                                      __exported by:__ @comprehensive\/c2hsc.h@
+                                                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_long_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_long_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_long_pointer_array_struct <*> readRaw (Proxy @"explicit_signed_long_pointer_array_member") ptr_0
+instance WriteRaw Explicit_signed_long_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_long_pointer_array_struct explicit_signed_long_pointer_array_member_2 -> writeRaw (Proxy @"explicit_signed_long_pointer_array_member") ptr_0 explicit_signed_long_pointer_array_member_2
+deriving via (EquivStorable Explicit_signed_long_pointer_array_struct) instance Storable Explicit_signed_long_pointer_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_long_pointer_array_struct) instance IsStruct Explicit_signed_long_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CLong)) =>
+         HasField "explicit_signed_long_pointer_array_member"
+                  Explicit_signed_long_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_long_pointer_array_struct{explicit_signed_long_pointer_array_member = y_1},
+                              getField @"explicit_signed_long_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CLong)) =>
+         HasField "explicit_signed_long_pointer_array_member"
+                  (Ptr Explicit_signed_long_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_long_pointer_array_member")
+instance HasCField Explicit_signed_long_pointer_array_struct
+                   "explicit_signed_long_pointer_array_member"
+    where type CFieldType Explicit_signed_long_pointer_array_struct
+                          "explicit_signed_long_pointer_array_member" = ConstantArray 10
+                                                                                      (Ptr CLong)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 316:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_pointer_array_struct
+    = Unsigned_long_pointer_array_struct {unsigned_long_pointer_array_member :: (ConstantArray 10
+                                                                                               (Ptr CULong))
+                                          {- ^ __C declaration:__ @unsigned_long_pointer_array_member@
+
+                                               __defined at:__ @comprehensive\/c2hsc.h 316:77@
+
+                                               __exported by:__ @comprehensive\/c2hsc.h@
+                                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_long_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_long_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_long_pointer_array_struct <*> readRaw (Proxy @"unsigned_long_pointer_array_member") ptr_0
+instance WriteRaw Unsigned_long_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_long_pointer_array_struct unsigned_long_pointer_array_member_2 -> writeRaw (Proxy @"unsigned_long_pointer_array_member") ptr_0 unsigned_long_pointer_array_member_2
+deriving via (EquivStorable Unsigned_long_pointer_array_struct) instance Storable Unsigned_long_pointer_array_struct
+deriving via (IsStructViaReadRaw Unsigned_long_pointer_array_struct) instance IsStruct Unsigned_long_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CULong)) =>
+         HasField "unsigned_long_pointer_array_member"
+                  Unsigned_long_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_long_pointer_array_struct{unsigned_long_pointer_array_member = y_1},
+                              getField @"unsigned_long_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CULong)) =>
+         HasField "unsigned_long_pointer_array_member"
+                  (Ptr Unsigned_long_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_long_pointer_array_member")
+instance HasCField Unsigned_long_pointer_array_struct
+                   "unsigned_long_pointer_array_member"
+    where type CFieldType Unsigned_long_pointer_array_struct
+                          "unsigned_long_pointer_array_member" = ConstantArray 10
+                                                                               (Ptr CULong)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ordinary_signed_long_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 318:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Ordinary_signed_long_long_pointer_array_struct
+    = Ordinary_signed_long_long_pointer_array_struct {ordinary_signed_long_long_pointer_array_member :: (ConstantArray 10
+                                                                                                                       (Ptr CLLong))
+                                                      {- ^ __C declaration:__ @ordinary_signed_long_long_pointer_array_member@
+
+                                                           __defined at:__ @comprehensive\/c2hsc.h 318:77@
+
+                                                           __exported by:__ @comprehensive\/c2hsc.h@
+                                                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ordinary_signed_long_long_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ordinary_signed_long_long_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Ordinary_signed_long_long_pointer_array_struct <*> readRaw (Proxy @"ordinary_signed_long_long_pointer_array_member") ptr_0
+instance WriteRaw Ordinary_signed_long_long_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordinary_signed_long_long_pointer_array_struct ordinary_signed_long_long_pointer_array_member_2 -> writeRaw (Proxy @"ordinary_signed_long_long_pointer_array_member") ptr_0 ordinary_signed_long_long_pointer_array_member_2
+deriving via (EquivStorable Ordinary_signed_long_long_pointer_array_struct) instance Storable Ordinary_signed_long_long_pointer_array_struct
+deriving via (IsStructViaReadRaw Ordinary_signed_long_long_pointer_array_struct) instance IsStruct Ordinary_signed_long_long_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CLLong)) =>
+         HasField "ordinary_signed_long_long_pointer_array_member"
+                  Ordinary_signed_long_long_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Ordinary_signed_long_long_pointer_array_struct{ordinary_signed_long_long_pointer_array_member = y_1},
+                              getField @"ordinary_signed_long_long_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CLLong)) =>
+         HasField "ordinary_signed_long_long_pointer_array_member"
+                  (Ptr Ordinary_signed_long_long_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"ordinary_signed_long_long_pointer_array_member")
+instance HasCField Ordinary_signed_long_long_pointer_array_struct
+                   "ordinary_signed_long_long_pointer_array_member"
+    where type CFieldType Ordinary_signed_long_long_pointer_array_struct
+                          "ordinary_signed_long_long_pointer_array_member" = ConstantArray 10
+                                                                                           (Ptr CLLong)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct explicit_signed_long_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 319:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Explicit_signed_long_long_pointer_array_struct
+    = Explicit_signed_long_long_pointer_array_struct {explicit_signed_long_long_pointer_array_member :: (ConstantArray 10
+                                                                                                                       (Ptr CLLong))
+                                                      {- ^ __C declaration:__ @explicit_signed_long_long_pointer_array_member@
+
+                                                           __defined at:__ @comprehensive\/c2hsc.h 319:77@
+
+                                                           __exported by:__ @comprehensive\/c2hsc.h@
+                                                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Explicit_signed_long_long_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Explicit_signed_long_long_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Explicit_signed_long_long_pointer_array_struct <*> readRaw (Proxy @"explicit_signed_long_long_pointer_array_member") ptr_0
+instance WriteRaw Explicit_signed_long_long_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Explicit_signed_long_long_pointer_array_struct explicit_signed_long_long_pointer_array_member_2 -> writeRaw (Proxy @"explicit_signed_long_long_pointer_array_member") ptr_0 explicit_signed_long_long_pointer_array_member_2
+deriving via (EquivStorable Explicit_signed_long_long_pointer_array_struct) instance Storable Explicit_signed_long_long_pointer_array_struct
+deriving via (IsStructViaReadRaw Explicit_signed_long_long_pointer_array_struct) instance IsStruct Explicit_signed_long_long_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CLLong)) =>
+         HasField "explicit_signed_long_long_pointer_array_member"
+                  Explicit_signed_long_long_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Explicit_signed_long_long_pointer_array_struct{explicit_signed_long_long_pointer_array_member = y_1},
+                              getField @"explicit_signed_long_long_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CLLong)) =>
+         HasField "explicit_signed_long_long_pointer_array_member"
+                  (Ptr Explicit_signed_long_long_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"explicit_signed_long_long_pointer_array_member")
+instance HasCField Explicit_signed_long_long_pointer_array_struct
+                   "explicit_signed_long_long_pointer_array_member"
+    where type CFieldType Explicit_signed_long_long_pointer_array_struct
+                          "explicit_signed_long_long_pointer_array_member" = ConstantArray 10
+                                                                                           (Ptr CLLong)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct unsigned_long_long_pointer_array_struct@
+
+    __defined at:__ @comprehensive\/c2hsc.h 320:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Unsigned_long_long_pointer_array_struct
+    = Unsigned_long_long_pointer_array_struct {unsigned_long_long_pointer_array_member :: (ConstantArray 10
+                                                                                                         (Ptr CULLong))
+                                               {- ^ __C declaration:__ @unsigned_long_long_pointer_array_member@
+
+                                                    __defined at:__ @comprehensive\/c2hsc.h 320:77@
+
+                                                    __exported by:__ @comprehensive\/c2hsc.h@
+                                               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unsigned_long_long_pointer_array_struct
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Unsigned_long_long_pointer_array_struct
+    where readRaw = \ptr_0 -> pure Unsigned_long_long_pointer_array_struct <*> readRaw (Proxy @"unsigned_long_long_pointer_array_member") ptr_0
+instance WriteRaw Unsigned_long_long_pointer_array_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unsigned_long_long_pointer_array_struct unsigned_long_long_pointer_array_member_2 -> writeRaw (Proxy @"unsigned_long_long_pointer_array_member") ptr_0 unsigned_long_long_pointer_array_member_2
+deriving via (EquivStorable Unsigned_long_long_pointer_array_struct) instance Storable Unsigned_long_long_pointer_array_struct
+deriving via (IsStructViaReadRaw Unsigned_long_long_pointer_array_struct) instance IsStruct Unsigned_long_long_pointer_array_struct
+instance (~) ty (ConstantArray 10 (Ptr CULLong)) =>
+         HasField "unsigned_long_long_pointer_array_member"
+                  Unsigned_long_long_pointer_array_struct
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Unsigned_long_long_pointer_array_struct{unsigned_long_long_pointer_array_member = y_1},
+                              getField @"unsigned_long_long_pointer_array_member" x_0)
+instance (~) ty (ConstantArray 10 (Ptr CULLong)) =>
+         HasField "unsigned_long_long_pointer_array_member"
+                  (Ptr Unsigned_long_long_pointer_array_struct)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unsigned_long_long_pointer_array_member")
+instance HasCField Unsigned_long_long_pointer_array_struct
+                   "unsigned_long_long_pointer_array_member"
+    where type CFieldType Unsigned_long_long_pointer_array_struct
+                          "unsigned_long_long_pointer_array_member" = ConstantArray 10
+                                                                                    (Ptr CULLong)
+          offset# = \_ -> \_ -> 0
+{-| Sanity checks
+
+    NOTE: The @smoke.h@ test is moved to a separate header.
+
+    __C declaration:__ @an_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 329:13@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype An_int
+    = An_int {unwrap :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrap" An_int ty
+    where hasField = \x_0 -> (\y_1 -> An_int{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty CInt => HasField "unwrap" (Ptr An_int) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField An_int "unwrap"
+    where type CFieldType An_int "unwrap" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@cal_table_table@
+
+    __defined at:__ @comprehensive\/c2hsc.h 341:5@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Cal_table_table
+    = Cal_table_table {raw :: CInt
+                       {- ^ __C declaration:__ @raw@
+
+                            __defined at:__ @comprehensive\/c2hsc.h 342:13@
+
+                            __exported by:__ @comprehensive\/c2hsc.h@
+                       -},
+                       val :: CInt
+                       {- ^ __C declaration:__ @val@
+
+                            __defined at:__ @comprehensive\/c2hsc.h 342:22@
+
+                            __exported by:__ @comprehensive\/c2hsc.h@
+                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Cal_table_table
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Cal_table_table
+    where readRaw = \ptr_0 -> (pure Cal_table_table <*> readRaw (Proxy @"raw") ptr_0) <*> readRaw (Proxy @"val") ptr_0
+instance WriteRaw Cal_table_table
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Cal_table_table raw_2
+                                                       val_3 -> writeRaw (Proxy @"raw") ptr_0 raw_2 >> writeRaw (Proxy @"val") ptr_0 val_3
+deriving via (EquivStorable Cal_table_table) instance Storable Cal_table_table
+deriving via (IsStructViaReadRaw Cal_table_table) instance IsStruct Cal_table_table
+instance (~) ty CInt => HasField "raw" Cal_table_table ty
+    where hasField = \x_0 -> (\y_1 -> Cal_table_table{raw = y_1,
+                                                      val = getField @"val" x_0},
+                              getField @"raw" x_0)
+instance (~) ty CInt =>
+         HasField "raw" (Ptr Cal_table_table) (Ptr ty)
+    where getField = fromPtr (Proxy @"raw")
+instance HasCField Cal_table_table "raw"
+    where type CFieldType Cal_table_table "raw" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "val" Cal_table_table ty
+    where hasField = \x_0 -> (\y_1 -> Cal_table_table{val = y_1,
+                                                      raw = getField @"raw" x_0},
+                              getField @"val" x_0)
+instance (~) ty CInt =>
+         HasField "val" (Ptr Cal_table_table) (Ptr ty)
+    where getField = fromPtr (Proxy @"val")
+instance HasCField Cal_table_table "val"
+    where type CFieldType Cal_table_table "val" = CInt
+          offset# = \_ -> \_ -> 4
+{-| Issues without test cases in the original test suite
+
+    These are examples from open issues on the c2hsc repository, that don't (yet) have corresponding test cases in the c2hsc test suite.
+
+    __C declaration:__ @struct cal_table@
+
+    __defined at:__ @comprehensive\/c2hsc.h 339:8@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Cal_table
+    = Cal_table {size :: CInt
+                 {- ^ __C declaration:__ @size@
+
+                      __defined at:__ @comprehensive\/c2hsc.h 340:9@
+
+                      __exported by:__ @comprehensive\/c2hsc.h@
+                 -},
+                 table :: (ConstantArray 32 Cal_table_table)
+                 {- ^ __C declaration:__ @table@
+
+                      __defined at:__ @comprehensive\/c2hsc.h 343:7@
+
+                      __exported by:__ @comprehensive\/c2hsc.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Cal_table
+    where staticSizeOf = \_ -> 260 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Cal_table
+    where readRaw = \ptr_0 -> (pure Cal_table <*> readRaw (Proxy @"size") ptr_0) <*> readRaw (Proxy @"table") ptr_0
+instance WriteRaw Cal_table
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Cal_table size_2
+                                                 table_3 -> writeRaw (Proxy @"size") ptr_0 size_2 >> writeRaw (Proxy @"table") ptr_0 table_3
+deriving via (EquivStorable Cal_table) instance Storable Cal_table
+deriving via (IsStructViaReadRaw Cal_table) instance IsStruct Cal_table
+instance (~) ty CInt => HasField "size" Cal_table ty
+    where hasField = \x_0 -> (\y_1 -> Cal_table{size = y_1,
+                                                table = getField @"table" x_0},
+                              getField @"size" x_0)
+instance (~) ty CInt => HasField "size" (Ptr Cal_table) (Ptr ty)
+    where getField = fromPtr (Proxy @"size")
+instance HasCField Cal_table "size"
+    where type CFieldType Cal_table "size" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (ConstantArray 32 Cal_table_table) =>
+         HasField "table" Cal_table ty
+    where hasField = \x_0 -> (\y_1 -> Cal_table{table = y_1,
+                                                size = getField @"size" x_0},
+                              getField @"table" x_0)
+instance (~) ty (ConstantArray 32 Cal_table_table) =>
+         HasField "table" (Ptr Cal_table) (Ptr ty)
+    where getField = fromPtr (Proxy @"table")
+instance HasCField Cal_table "table"
+    where type CFieldType Cal_table "table" = ConstantArray 32
+                                                            Cal_table_table
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @union \@Elf32_External_Dyn_d_un@
+
+    __defined at:__ @comprehensive\/c2hsc.h 349:3@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Elf32_External_Dyn_d_un
+    = Elf32_External_Dyn_d_un {unwrap :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             1) instance StaticSize Elf32_External_Dyn_d_un
+deriving via (SizedByteArray 4
+                             1) instance ReadRaw Elf32_External_Dyn_d_un
+deriving via (SizedByteArray 4
+                             1) instance WriteRaw Elf32_External_Dyn_d_un
+deriving via (EquivStorable Elf32_External_Dyn_d_un) instance Storable Elf32_External_Dyn_d_un
+deriving via (SizedByteArray 4
+                             1) instance IsUnion Elf32_External_Dyn_d_un
+instance (~) ty (ConstantArray 4 CUChar) =>
+         HasField "d_val" Elf32_External_Dyn_d_un ty
+    where getField = getUnionPayload
+instance (~) ty (ConstantArray 4 CUChar) =>
+         HasField "d_val" Elf32_External_Dyn_d_un ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"d_val" x_0)
+instance (~) ty (ConstantArray 4 CUChar) =>
+         HasField "d_val" (Ptr Elf32_External_Dyn_d_un) (Ptr ty)
+    where getField = fromPtr (Proxy @"d_val")
+instance HasCField Elf32_External_Dyn_d_un "d_val"
+    where type CFieldType Elf32_External_Dyn_d_un
+                          "d_val" = ConstantArray 4 CUChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty (ConstantArray 4 CUChar) =>
+         HasField "d_ptr" Elf32_External_Dyn_d_un ty
+    where getField = getUnionPayload
+instance (~) ty (ConstantArray 4 CUChar) =>
+         HasField "d_ptr" Elf32_External_Dyn_d_un ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"d_ptr" x_0)
+instance (~) ty (ConstantArray 4 CUChar) =>
+         HasField "d_ptr" (Ptr Elf32_External_Dyn_d_un) (Ptr ty)
+    where getField = fromPtr (Proxy @"d_ptr")
+instance HasCField Elf32_External_Dyn_d_un "d_ptr"
+    where type CFieldType Elf32_External_Dyn_d_un
+                          "d_ptr" = ConstantArray 4 CUChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct Elf32_External_Dyn@
+
+    __defined at:__ @comprehensive\/c2hsc.h 347:9@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data Elf32_External_Dyn
+    = Elf32_External_Dyn {d_tag :: (ConstantArray 4 CUChar)
+                          {- ^ __C declaration:__ @d_tag@
+
+                               __defined at:__ @comprehensive\/c2hsc.h 348:17@
+
+                               __exported by:__ @comprehensive\/c2hsc.h@
+                          -},
+                          d_un :: Elf32_External_Dyn_d_un
+                          {- ^ __C declaration:__ @d_un@
+
+                               __defined at:__ @comprehensive\/c2hsc.h 352:5@
+
+                               __exported by:__ @comprehensive\/c2hsc.h@
+                          -}}
+    deriving stock Generic
+instance StaticSize Elf32_External_Dyn
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Elf32_External_Dyn
+    where readRaw = \ptr_0 -> (pure Elf32_External_Dyn <*> readRaw (Proxy @"d_tag") ptr_0) <*> readRaw (Proxy @"d_un") ptr_0
+instance WriteRaw Elf32_External_Dyn
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Elf32_External_Dyn d_tag_2
+                                                          d_un_3 -> writeRaw (Proxy @"d_tag") ptr_0 d_tag_2 >> writeRaw (Proxy @"d_un") ptr_0 d_un_3
+deriving via (EquivStorable Elf32_External_Dyn) instance Storable Elf32_External_Dyn
+deriving via (IsStructViaReadRaw Elf32_External_Dyn) instance IsStruct Elf32_External_Dyn
+instance (~) ty (ConstantArray 4 CUChar) =>
+         HasField "d_tag" Elf32_External_Dyn ty
+    where hasField = \x_0 -> (\y_1 -> Elf32_External_Dyn{d_tag = y_1,
+                                                         d_un = getField @"d_un" x_0},
+                              getField @"d_tag" x_0)
+instance (~) ty (ConstantArray 4 CUChar) =>
+         HasField "d_tag" (Ptr Elf32_External_Dyn) (Ptr ty)
+    where getField = fromPtr (Proxy @"d_tag")
+instance HasCField Elf32_External_Dyn "d_tag"
+    where type CFieldType Elf32_External_Dyn "d_tag" = ConstantArray 4
+                                                                     CUChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Elf32_External_Dyn_d_un =>
+         HasField "d_un" Elf32_External_Dyn ty
+    where hasField = \x_0 -> (\y_1 -> Elf32_External_Dyn{d_un = y_1,
+                                                         d_tag = getField @"d_tag" x_0},
+                              getField @"d_un" x_0)
+instance (~) ty Elf32_External_Dyn_d_un =>
+         HasField "d_un" (Ptr Elf32_External_Dyn) (Ptr ty)
+    where getField = fromPtr (Proxy @"d_un")
+instance HasCField Elf32_External_Dyn "d_un"
+    where type CFieldType Elf32_External_Dyn
+                          "d_un" = Elf32_External_Dyn_d_un
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @bug_24@
+
+    __defined at:__ @comprehensive\/c2hsc.h 358:15@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Bug_24
+    = Bug_24 {unwrap :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) => HasField "unwrap" Bug_24 ty
+    where hasField = \x_0 -> (\y_1 -> Bug_24{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrap" (Ptr Bug_24) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Bug_24 "unwrap"
+    where type CFieldType Bug_24 "unwrap" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @bug_24_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 359:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype Bug_24_2
+    = Bug_24_2 {unwrap :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) => HasField "unwrap" Bug_24_2 ty
+    where hasField = \x_0 -> (\y_1 -> Bug_24_2{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrap" (Ptr Bug_24_2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Bug_24_2 "unwrap"
+    where type CFieldType Bug_24_2 "unwrap" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @MyArray_27@
+
+    __defined at:__ @comprehensive\/c2hsc.h 364:13@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+newtype MyArray_27
+    = MyArray_27 {unwrap :: (ConstantArray 20 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 20 CInt) =>
+         HasField "unwrap" MyArray_27 ty
+    where hasField = \x_0 -> (\y_1 -> MyArray_27{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty (ConstantArray 20 CInt) =>
+         HasField "unwrap" (Ptr MyArray_27) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField MyArray_27 "unwrap"
+    where type CFieldType MyArray_27 "unwrap" = ConstantArray 20 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct MyStruct_27@
+
+    __defined at:__ @comprehensive\/c2hsc.h 365:9@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+data MyStruct_27
+    = MyStruct_27 {x :: MyArray_27
+                   {- ^ __C declaration:__ @x@
+
+                        __defined at:__ @comprehensive\/c2hsc.h 366:14@
+
+                        __exported by:__ @comprehensive\/c2hsc.h@
+                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize MyStruct_27
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw MyStruct_27
+    where readRaw = \ptr_0 -> pure MyStruct_27 <*> readRaw (Proxy @"x") ptr_0
+instance WriteRaw MyStruct_27
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MyStruct_27 x_2 -> writeRaw (Proxy @"x") ptr_0 x_2
+deriving via (EquivStorable MyStruct_27) instance Storable MyStruct_27
+deriving via (IsStructViaReadRaw MyStruct_27) instance IsStruct MyStruct_27
+instance (~) ty MyArray_27 => HasField "x" MyStruct_27 ty
+    where hasField = \x_0 -> (\y_1 -> MyStruct_27{x = y_1},
+                              getField @"x" x_0)
+instance (~) ty MyArray_27 =>
+         HasField "x" (Ptr MyStruct_27) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField MyStruct_27 "x"
+    where type CFieldType MyStruct_27 "x" = MyArray_27
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_function@
+foreign import ccall safe "hs_bindgen_3fd2a5c6e681c44b" hs_bindgen_3fd2a5c6e681c44b_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_function@
+hs_bindgen_3fd2a5c6e681c44b :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_function@
+hs_bindgen_3fd2a5c6e681c44b = \x_0 -> hs_bindgen_3fd2a5c6e681c44b_base (toFFIType x_0)
+{-| __C declaration:__ @foo_function@
+
+    __defined at:__ @comprehensive\/c2hsc.h 38:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_function_safe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @foo_function@
+
+    __defined at:__ @comprehensive\/c2hsc.h 38:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_function_safe = hs_bindgen_3fd2a5c6e681c44b
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_1@
+foreign import ccall safe "hs_bindgen_7978c370c45d3898" hs_bindgen_7978c370c45d3898_base ::
+    CUInt
+ -> IO CUInt
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_1@
+hs_bindgen_7978c370c45d3898 :: CUInt -> IO CUInt
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_1@
+hs_bindgen_7978c370c45d3898 = \x_0 -> fmap fromFFIType (hs_bindgen_7978c370c45d3898_base (toFFIType x_0))
+{-| __C declaration:__ @foo_33_1@
+
+    __defined at:__ @comprehensive\/c2hsc.h 73:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_1_safe :: CUInt -> IO CUInt
+{-| __C declaration:__ @foo_33_1@
+
+    __defined at:__ @comprehensive\/c2hsc.h 73:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_1_safe = hs_bindgen_7978c370c45d3898
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_2@
+foreign import ccall safe "hs_bindgen_44aef5175928343d" hs_bindgen_44aef5175928343d_base ::
+    CUInt
+ -> IO CUInt
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_2@
+hs_bindgen_44aef5175928343d :: CUInt -> IO CUInt
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_2@
+hs_bindgen_44aef5175928343d = \x_0 -> fmap fromFFIType (hs_bindgen_44aef5175928343d_base (toFFIType x_0))
+{-| __C declaration:__ @foo_33_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 74:51@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_2_safe :: CUInt -> IO CUInt
+{-| __C declaration:__ @foo_33_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 74:51@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_2_safe = hs_bindgen_44aef5175928343d
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_3@
+foreign import ccall safe "hs_bindgen_9f0b65c4b469b3d8" hs_bindgen_9f0b65c4b469b3d8_base ::
+    CLLong
+ -> IO CLLong
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_3@
+hs_bindgen_9f0b65c4b469b3d8 :: CLLong -> IO CLLong
+-- __unique:__ @test_comprehensivec2hsc_Example_Safe_foo_33_3@
+hs_bindgen_9f0b65c4b469b3d8 = \x_0 -> fmap fromFFIType (hs_bindgen_9f0b65c4b469b3d8_base (toFFIType x_0))
+{-| __C declaration:__ @foo_33_3@
+
+    __defined at:__ @comprehensive\/c2hsc.h 75:52@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_3_safe :: CLLong -> IO CLLong
+{-| __C declaration:__ @foo_33_3@
+
+    __defined at:__ @comprehensive\/c2hsc.h 75:52@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_3_safe = hs_bindgen_9f0b65c4b469b3d8
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_function@
+foreign import ccall unsafe "hs_bindgen_bf542a744554a894" hs_bindgen_bf542a744554a894_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_function@
+hs_bindgen_bf542a744554a894 :: FunPtr (CInt -> IO CInt) -> IO ()
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_function@
+hs_bindgen_bf542a744554a894 = \x_0 -> hs_bindgen_bf542a744554a894_base (toFFIType x_0)
+{-| __C declaration:__ @foo_function@
+
+    __defined at:__ @comprehensive\/c2hsc.h 38:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_function_unsafe :: FunPtr (CInt -> IO CInt) -> IO ()
+{-| __C declaration:__ @foo_function@
+
+    __defined at:__ @comprehensive\/c2hsc.h 38:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_function_unsafe = hs_bindgen_bf542a744554a894
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_1@
+foreign import ccall unsafe "hs_bindgen_11ca53f1ea9c8230" hs_bindgen_11ca53f1ea9c8230_base ::
+    CUInt
+ -> IO CUInt
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_1@
+hs_bindgen_11ca53f1ea9c8230 :: CUInt -> IO CUInt
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_1@
+hs_bindgen_11ca53f1ea9c8230 = \x_0 -> fmap fromFFIType (hs_bindgen_11ca53f1ea9c8230_base (toFFIType x_0))
+{-| __C declaration:__ @foo_33_1@
+
+    __defined at:__ @comprehensive\/c2hsc.h 73:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_1_unsafe :: CUInt -> IO CUInt
+{-| __C declaration:__ @foo_33_1@
+
+    __defined at:__ @comprehensive\/c2hsc.h 73:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_1_unsafe = hs_bindgen_11ca53f1ea9c8230
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_2@
+foreign import ccall unsafe "hs_bindgen_2685a75b0196568e" hs_bindgen_2685a75b0196568e_base ::
+    CUInt
+ -> IO CUInt
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_2@
+hs_bindgen_2685a75b0196568e :: CUInt -> IO CUInt
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_2@
+hs_bindgen_2685a75b0196568e = \x_0 -> fmap fromFFIType (hs_bindgen_2685a75b0196568e_base (toFFIType x_0))
+{-| __C declaration:__ @foo_33_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 74:51@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_2_unsafe :: CUInt -> IO CUInt
+{-| __C declaration:__ @foo_33_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 74:51@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_2_unsafe = hs_bindgen_2685a75b0196568e
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_3@
+foreign import ccall unsafe "hs_bindgen_bc94ff083e65f7e0" hs_bindgen_bc94ff083e65f7e0_base ::
+    CLLong
+ -> IO CLLong
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_3@
+hs_bindgen_bc94ff083e65f7e0 :: CLLong -> IO CLLong
+-- __unique:__ @test_comprehensivec2hsc_Example_Unsafe_foo_33_3@
+hs_bindgen_bc94ff083e65f7e0 = \x_0 -> fmap fromFFIType (hs_bindgen_bc94ff083e65f7e0_base (toFFIType x_0))
+{-| __C declaration:__ @foo_33_3@
+
+    __defined at:__ @comprehensive\/c2hsc.h 75:52@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_3_unsafe :: CLLong -> IO CLLong
+{-| __C declaration:__ @foo_33_3@
+
+    __defined at:__ @comprehensive\/c2hsc.h 75:52@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_3_unsafe = hs_bindgen_bc94ff083e65f7e0
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_function@
+foreign import ccall unsafe "hs_bindgen_37f32218c55b498b" hs_bindgen_37f32218c55b498b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_function@
+hs_bindgen_37f32218c55b498b :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO CInt) ->
+                                           IO ()))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_function@
+hs_bindgen_37f32218c55b498b = fmap fromFFIType hs_bindgen_37f32218c55b498b_base
+{-# NOINLINE foo_function_funptr #-}
+{-| __C declaration:__ @foo_function@
+
+    __defined at:__ @comprehensive\/c2hsc.h 38:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_function_funptr :: FunPtr (FunPtr (CInt -> IO CInt) -> IO ())
+{-| __C declaration:__ @foo_function@
+
+    __defined at:__ @comprehensive\/c2hsc.h 38:6@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_function_funptr = unsafePerformIO hs_bindgen_37f32218c55b498b
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_1@
+foreign import ccall unsafe "hs_bindgen_482f80da2191c5d6" hs_bindgen_482f80da2191c5d6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_1@
+hs_bindgen_482f80da2191c5d6 :: IO (FunPtr (CUInt -> IO CUInt))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_1@
+hs_bindgen_482f80da2191c5d6 = fmap fromFFIType hs_bindgen_482f80da2191c5d6_base
+{-# NOINLINE foo_33_1_funptr #-}
+{-| __C declaration:__ @foo_33_1@
+
+    __defined at:__ @comprehensive\/c2hsc.h 73:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_1_funptr :: FunPtr (CUInt -> IO CUInt)
+{-| __C declaration:__ @foo_33_1@
+
+    __defined at:__ @comprehensive\/c2hsc.h 73:10@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_1_funptr = unsafePerformIO hs_bindgen_482f80da2191c5d6
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_2@
+foreign import ccall unsafe "hs_bindgen_c50591bcbfea3260" hs_bindgen_c50591bcbfea3260_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_2@
+hs_bindgen_c50591bcbfea3260 :: IO (FunPtr (CUInt -> IO CUInt))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_2@
+hs_bindgen_c50591bcbfea3260 = fmap fromFFIType hs_bindgen_c50591bcbfea3260_base
+{-# NOINLINE foo_33_2_funptr #-}
+{-| __C declaration:__ @foo_33_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 74:51@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_2_funptr :: FunPtr (CUInt -> IO CUInt)
+{-| __C declaration:__ @foo_33_2@
+
+    __defined at:__ @comprehensive\/c2hsc.h 74:51@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_2_funptr = unsafePerformIO hs_bindgen_c50591bcbfea3260
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_3@
+foreign import ccall unsafe "hs_bindgen_26b60496f499680a" hs_bindgen_26b60496f499680a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_3@
+hs_bindgen_26b60496f499680a :: IO (FunPtr (CLLong -> IO CLLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_foo_33_3@
+hs_bindgen_26b60496f499680a = fmap fromFFIType hs_bindgen_26b60496f499680a_base
+{-# NOINLINE foo_33_3_funptr #-}
+{-| __C declaration:__ @foo_33_3@
+
+    __defined at:__ @comprehensive\/c2hsc.h 75:52@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_3_funptr :: FunPtr (CLLong -> IO CLLong)
+{-| __C declaration:__ @foo_33_3@
+
+    __defined at:__ @comprehensive\/c2hsc.h 75:52@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+foo_33_3_funptr = unsafePerformIO hs_bindgen_26b60496f499680a
+-- __unique:__ @test_comprehensivec2hsc_Example_get_my_array@
+foreign import ccall unsafe "hs_bindgen_b2862a117942ba8c" hs_bindgen_b2862a117942ba8c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_my_array@
+hs_bindgen_b2862a117942ba8c :: IO (Ptr (IncompleteArray (FunPtr (CInt ->
+                                                                 IO CInt))))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_my_array@
+hs_bindgen_b2862a117942ba8c = fmap fromFFIType hs_bindgen_b2862a117942ba8c_base
+{-# NOINLINE my_array #-}
+{-| __C declaration:__ @my_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 26:14@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+my_array :: Ptr (IncompleteArray (FunPtr (CInt -> IO CInt)))
+{-| __C declaration:__ @my_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 26:14@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+my_array = unsafePerformIO hs_bindgen_b2862a117942ba8c
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float@
+foreign import ccall unsafe "hs_bindgen_fbe24203b7174cce" hs_bindgen_fbe24203b7174cce_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float@
+hs_bindgen_fbe24203b7174cce :: IO (Ptr CFloat)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float@
+hs_bindgen_fbe24203b7174cce = fmap fromFFIType hs_bindgen_fbe24203b7174cce_base
+{-# NOINLINE ordinary_float #-}
+{-| Primitive types
+
+    NOTE: Here and elsewhere the original test suite has some references to @long double@ , some commented out, and some confusingly not, with an expectation of a translation to @CDouble@ ; the latter I think is a bug in the original test suite. Here we leave all of these test cases in; we emit an "unsupported" message for these and omit the declaration in the generated bindings.
+
+    __C declaration:__ @ordinary_float@
+
+    __defined at:__ @comprehensive\/c2hsc.h 88:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float :: Ptr CFloat
+{-| Primitive types
+
+    NOTE: Here and elsewhere the original test suite has some references to @long double@ , some commented out, and some confusingly not, with an expectation of a translation to @CDouble@ ; the latter I think is a bug in the original test suite. Here we leave all of these test cases in; we emit an "unsupported" message for these and omit the declaration in the generated bindings.
+
+    __C declaration:__ @ordinary_float@
+
+    __defined at:__ @comprehensive\/c2hsc.h 88:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float = unsafePerformIO hs_bindgen_fbe24203b7174cce
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double@
+foreign import ccall unsafe "hs_bindgen_c996ca409147b439" hs_bindgen_c996ca409147b439_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double@
+hs_bindgen_c996ca409147b439 :: IO (Ptr CDouble)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double@
+hs_bindgen_c996ca409147b439 = fmap fromFFIType hs_bindgen_c996ca409147b439_base
+{-# NOINLINE ordinary_double #-}
+{-| __C declaration:__ @ordinary_double@
+
+    __defined at:__ @comprehensive\/c2hsc.h 89:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double :: Ptr CDouble
+{-| __C declaration:__ @ordinary_double@
+
+    __defined at:__ @comprehensive\/c2hsc.h 89:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double = unsafePerformIO hs_bindgen_c996ca409147b439
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char@
+foreign import ccall unsafe "hs_bindgen_b5c47cbce17ba18f" hs_bindgen_b5c47cbce17ba18f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char@
+hs_bindgen_b5c47cbce17ba18f :: IO (Ptr CChar)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char@
+hs_bindgen_b5c47cbce17ba18f = fmap fromFFIType hs_bindgen_b5c47cbce17ba18f_base
+{-# NOINLINE ordinary_char #-}
+{-| __C declaration:__ @ordinary_char@
+
+    __defined at:__ @comprehensive\/c2hsc.h 92:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_char :: Ptr CChar
+{-| __C declaration:__ @ordinary_char@
+
+    __defined at:__ @comprehensive\/c2hsc.h 92:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_char = unsafePerformIO hs_bindgen_b5c47cbce17ba18f
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char@
+foreign import ccall unsafe "hs_bindgen_74214b0c0c8011ef" hs_bindgen_74214b0c0c8011ef_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char@
+hs_bindgen_74214b0c0c8011ef :: IO (Ptr CSChar)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char@
+hs_bindgen_74214b0c0c8011ef = fmap fromFFIType hs_bindgen_74214b0c0c8011ef_base
+{-# NOINLINE signed_char #-}
+{-| __C declaration:__ @signed_char@
+
+    __defined at:__ @comprehensive\/c2hsc.h 93:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+signed_char :: Ptr CSChar
+{-| __C declaration:__ @signed_char@
+
+    __defined at:__ @comprehensive\/c2hsc.h 93:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+signed_char = unsafePerformIO hs_bindgen_74214b0c0c8011ef
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char@
+foreign import ccall unsafe "hs_bindgen_074079404a90186b" hs_bindgen_074079404a90186b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char@
+hs_bindgen_074079404a90186b :: IO (Ptr CUChar)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char@
+hs_bindgen_074079404a90186b = fmap fromFFIType hs_bindgen_074079404a90186b_base
+{-# NOINLINE unsigned_char #-}
+{-| __C declaration:__ @unsigned_char@
+
+    __defined at:__ @comprehensive\/c2hsc.h 94:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char :: Ptr CUChar
+{-| __C declaration:__ @unsigned_char@
+
+    __defined at:__ @comprehensive\/c2hsc.h 94:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char = unsafePerformIO hs_bindgen_074079404a90186b
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short@
+foreign import ccall unsafe "hs_bindgen_e432ab522350f84b" hs_bindgen_e432ab522350f84b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short@
+hs_bindgen_e432ab522350f84b :: IO (Ptr CShort)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short@
+hs_bindgen_e432ab522350f84b = fmap fromFFIType hs_bindgen_e432ab522350f84b_base
+{-# NOINLINE ordinary_signed_short #-}
+{-| __C declaration:__ @ordinary_signed_short@
+
+    __defined at:__ @comprehensive\/c2hsc.h 96:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short :: Ptr CShort
+{-| __C declaration:__ @ordinary_signed_short@
+
+    __defined at:__ @comprehensive\/c2hsc.h 96:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short = unsafePerformIO hs_bindgen_e432ab522350f84b
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short@
+foreign import ccall unsafe "hs_bindgen_17fa3df7c6690161" hs_bindgen_17fa3df7c6690161_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short@
+hs_bindgen_17fa3df7c6690161 :: IO (Ptr CShort)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short@
+hs_bindgen_17fa3df7c6690161 = fmap fromFFIType hs_bindgen_17fa3df7c6690161_base
+{-# NOINLINE explicit_signed_short #-}
+{-| __C declaration:__ @explicit_signed_short@
+
+    __defined at:__ @comprehensive\/c2hsc.h 97:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short :: Ptr CShort
+{-| __C declaration:__ @explicit_signed_short@
+
+    __defined at:__ @comprehensive\/c2hsc.h 97:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short = unsafePerformIO hs_bindgen_17fa3df7c6690161
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short@
+foreign import ccall unsafe "hs_bindgen_20f280e98d58aacc" hs_bindgen_20f280e98d58aacc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short@
+hs_bindgen_20f280e98d58aacc :: IO (Ptr CUShort)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short@
+hs_bindgen_20f280e98d58aacc = fmap fromFFIType hs_bindgen_20f280e98d58aacc_base
+{-# NOINLINE unsigned_short #-}
+{-| __C declaration:__ @unsigned_short@
+
+    __defined at:__ @comprehensive\/c2hsc.h 98:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short :: Ptr CUShort
+{-| __C declaration:__ @unsigned_short@
+
+    __defined at:__ @comprehensive\/c2hsc.h 98:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short = unsafePerformIO hs_bindgen_20f280e98d58aacc
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int@
+foreign import ccall unsafe "hs_bindgen_78b4f07c60ef3ef7" hs_bindgen_78b4f07c60ef3ef7_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int@
+hs_bindgen_78b4f07c60ef3ef7 :: IO (Ptr CInt)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int@
+hs_bindgen_78b4f07c60ef3ef7 = fmap fromFFIType hs_bindgen_78b4f07c60ef3ef7_base
+{-# NOINLINE ordinary_signed_int #-}
+{-| __C declaration:__ @ordinary_signed_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 100:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int :: Ptr CInt
+{-| __C declaration:__ @ordinary_signed_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 100:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int = unsafePerformIO hs_bindgen_78b4f07c60ef3ef7
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int@
+foreign import ccall unsafe "hs_bindgen_41643d3737e9213c" hs_bindgen_41643d3737e9213c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int@
+hs_bindgen_41643d3737e9213c :: IO (Ptr CInt)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int@
+hs_bindgen_41643d3737e9213c = fmap fromFFIType hs_bindgen_41643d3737e9213c_base
+{-# NOINLINE explicit_signed_int #-}
+{-| __C declaration:__ @explicit_signed_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 101:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int :: Ptr CInt
+{-| __C declaration:__ @explicit_signed_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 101:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int = unsafePerformIO hs_bindgen_41643d3737e9213c
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int@
+foreign import ccall unsafe "hs_bindgen_6e686e175c956cb8" hs_bindgen_6e686e175c956cb8_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int@
+hs_bindgen_6e686e175c956cb8 :: IO (Ptr CUInt)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int@
+hs_bindgen_6e686e175c956cb8 = fmap fromFFIType hs_bindgen_6e686e175c956cb8_base
+{-# NOINLINE unsigned_int #-}
+{-| __C declaration:__ @unsigned_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 102:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int :: Ptr CUInt
+{-| __C declaration:__ @unsigned_int@
+
+    __defined at:__ @comprehensive\/c2hsc.h 102:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int = unsafePerformIO hs_bindgen_6e686e175c956cb8
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long@
+foreign import ccall unsafe "hs_bindgen_6a41c38f7fbb41d9" hs_bindgen_6a41c38f7fbb41d9_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long@
+hs_bindgen_6a41c38f7fbb41d9 :: IO (Ptr CLong)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long@
+hs_bindgen_6a41c38f7fbb41d9 = fmap fromFFIType hs_bindgen_6a41c38f7fbb41d9_base
+{-# NOINLINE ordinary_signed_long #-}
+{-| __C declaration:__ @ordinary_signed_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 104:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long :: Ptr CLong
+{-| __C declaration:__ @ordinary_signed_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 104:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long = unsafePerformIO hs_bindgen_6a41c38f7fbb41d9
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long@
+foreign import ccall unsafe "hs_bindgen_a3b5191325da8230" hs_bindgen_a3b5191325da8230_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long@
+hs_bindgen_a3b5191325da8230 :: IO (Ptr CLong)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long@
+hs_bindgen_a3b5191325da8230 = fmap fromFFIType hs_bindgen_a3b5191325da8230_base
+{-# NOINLINE explicit_signed_long #-}
+{-| __C declaration:__ @explicit_signed_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 105:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long :: Ptr CLong
+{-| __C declaration:__ @explicit_signed_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 105:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long = unsafePerformIO hs_bindgen_a3b5191325da8230
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long@
+foreign import ccall unsafe "hs_bindgen_df563b6d35ec4e8f" hs_bindgen_df563b6d35ec4e8f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long@
+hs_bindgen_df563b6d35ec4e8f :: IO (Ptr CULong)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long@
+hs_bindgen_df563b6d35ec4e8f = fmap fromFFIType hs_bindgen_df563b6d35ec4e8f_base
+{-# NOINLINE unsigned_long #-}
+{-| __C declaration:__ @unsigned_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 106:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long :: Ptr CULong
+{-| __C declaration:__ @unsigned_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 106:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long = unsafePerformIO hs_bindgen_df563b6d35ec4e8f
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long@
+foreign import ccall unsafe "hs_bindgen_59c6159f8798505a" hs_bindgen_59c6159f8798505a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long@
+hs_bindgen_59c6159f8798505a :: IO (Ptr CLLong)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long@
+hs_bindgen_59c6159f8798505a = fmap fromFFIType hs_bindgen_59c6159f8798505a_base
+{-# NOINLINE ordinary_signed_long_long #-}
+{-| __C declaration:__ @ordinary_signed_long_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 108:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long :: Ptr CLLong
+{-| __C declaration:__ @ordinary_signed_long_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 108:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long = unsafePerformIO hs_bindgen_59c6159f8798505a
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long@
+foreign import ccall unsafe "hs_bindgen_bfd63280c68460d2" hs_bindgen_bfd63280c68460d2_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long@
+hs_bindgen_bfd63280c68460d2 :: IO (Ptr CLLong)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long@
+hs_bindgen_bfd63280c68460d2 = fmap fromFFIType hs_bindgen_bfd63280c68460d2_base
+{-# NOINLINE explicit_signed_long_long #-}
+{-| __C declaration:__ @explicit_signed_long_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 109:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long :: Ptr CLLong
+{-| __C declaration:__ @explicit_signed_long_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 109:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long = unsafePerformIO hs_bindgen_bfd63280c68460d2
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long@
+foreign import ccall unsafe "hs_bindgen_8654be9a041c2116" hs_bindgen_8654be9a041c2116_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long@
+hs_bindgen_8654be9a041c2116 :: IO (Ptr CULLong)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long@
+hs_bindgen_8654be9a041c2116 = fmap fromFFIType hs_bindgen_8654be9a041c2116_base
+{-# NOINLINE unsigned_long_long #-}
+{-| __C declaration:__ @unsigned_long_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 110:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long :: Ptr CULLong
+{-| __C declaration:__ @unsigned_long_long@
+
+    __defined at:__ @comprehensive\/c2hsc.h 110:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long = unsafePerformIO hs_bindgen_8654be9a041c2116
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer@
+foreign import ccall unsafe "hs_bindgen_d6cafaa0834895a2" hs_bindgen_d6cafaa0834895a2_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer@
+hs_bindgen_d6cafaa0834895a2 :: IO (Ptr (Ptr Void))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer@
+hs_bindgen_d6cafaa0834895a2 = fmap fromFFIType hs_bindgen_d6cafaa0834895a2_base
+{-# NOINLINE ordinary_void_pointer #-}
+{-| Pointers: primitive types which cannot be signed
+
+    __C declaration:__ @ordinary_void_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 116:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_void_pointer :: Ptr (Ptr Void)
+{-| Pointers: primitive types which cannot be signed
+
+    __C declaration:__ @ordinary_void_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 116:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_void_pointer = unsafePerformIO hs_bindgen_d6cafaa0834895a2
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer@
+foreign import ccall unsafe "hs_bindgen_35ef3ffa1a5167f7" hs_bindgen_35ef3ffa1a5167f7_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer@
+hs_bindgen_35ef3ffa1a5167f7 :: IO (Ptr (Ptr CFloat))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer@
+hs_bindgen_35ef3ffa1a5167f7 = fmap fromFFIType hs_bindgen_35ef3ffa1a5167f7_base
+{-# NOINLINE ordinary_float_pointer #-}
+{-| __C declaration:__ @ordinary_float_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 118:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float_pointer :: Ptr (Ptr CFloat)
+{-| __C declaration:__ @ordinary_float_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 118:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float_pointer = unsafePerformIO hs_bindgen_35ef3ffa1a5167f7
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer@
+foreign import ccall unsafe "hs_bindgen_5e831159f7556399" hs_bindgen_5e831159f7556399_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer@
+hs_bindgen_5e831159f7556399 :: IO (Ptr (Ptr CDouble))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer@
+hs_bindgen_5e831159f7556399 = fmap fromFFIType hs_bindgen_5e831159f7556399_base
+{-# NOINLINE ordinary_double_pointer #-}
+{-| __C declaration:__ @ordinary_double_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 119:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double_pointer :: Ptr (Ptr CDouble)
+{-| __C declaration:__ @ordinary_double_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 119:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double_pointer = unsafePerformIO hs_bindgen_5e831159f7556399
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char_pointer@
+foreign import ccall unsafe "hs_bindgen_08236e44cabe67f4" hs_bindgen_08236e44cabe67f4_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char_pointer@
+hs_bindgen_08236e44cabe67f4 :: IO (Ptr (Ptr CChar))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_char_pointer@
+hs_bindgen_08236e44cabe67f4 = fmap fromFFIType hs_bindgen_08236e44cabe67f4_base
+{-# NOINLINE ordinary_char_pointer #-}
+{-| __C declaration:__ @ordinary_char_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 122:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_char_pointer :: Ptr (Ptr CChar)
+{-| __C declaration:__ @ordinary_char_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 122:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_char_pointer = unsafePerformIO hs_bindgen_08236e44cabe67f4
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char_pointer@
+foreign import ccall unsafe "hs_bindgen_66d08eddc2fecb35" hs_bindgen_66d08eddc2fecb35_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char_pointer@
+hs_bindgen_66d08eddc2fecb35 :: IO (Ptr (Ptr CSChar))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_signed_char_pointer@
+hs_bindgen_66d08eddc2fecb35 = fmap fromFFIType hs_bindgen_66d08eddc2fecb35_base
+{-# NOINLINE signed_char_pointer #-}
+{-| __C declaration:__ @signed_char_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 123:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+signed_char_pointer :: Ptr (Ptr CSChar)
+{-| __C declaration:__ @signed_char_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 123:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+signed_char_pointer = unsafePerformIO hs_bindgen_66d08eddc2fecb35
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer@
+foreign import ccall unsafe "hs_bindgen_5c76c506cb4fd78e" hs_bindgen_5c76c506cb4fd78e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer@
+hs_bindgen_5c76c506cb4fd78e :: IO (Ptr (Ptr CUChar))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer@
+hs_bindgen_5c76c506cb4fd78e = fmap fromFFIType hs_bindgen_5c76c506cb4fd78e_base
+{-# NOINLINE unsigned_char_pointer #-}
+{-| __C declaration:__ @unsigned_char_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 124:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char_pointer :: Ptr (Ptr CUChar)
+{-| __C declaration:__ @unsigned_char_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 124:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char_pointer = unsafePerformIO hs_bindgen_5c76c506cb4fd78e
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer@
+foreign import ccall unsafe "hs_bindgen_cd114d033253fe37" hs_bindgen_cd114d033253fe37_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer@
+hs_bindgen_cd114d033253fe37 :: IO (Ptr (Ptr CShort))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer@
+hs_bindgen_cd114d033253fe37 = fmap fromFFIType hs_bindgen_cd114d033253fe37_base
+{-# NOINLINE ordinary_signed_short_pointer #-}
+{-| __C declaration:__ @ordinary_signed_short_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 126:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short_pointer :: Ptr (Ptr CShort)
+{-| __C declaration:__ @ordinary_signed_short_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 126:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short_pointer = unsafePerformIO hs_bindgen_cd114d033253fe37
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer@
+foreign import ccall unsafe "hs_bindgen_49ffa4c56ce34e2f" hs_bindgen_49ffa4c56ce34e2f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer@
+hs_bindgen_49ffa4c56ce34e2f :: IO (Ptr (Ptr CShort))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer@
+hs_bindgen_49ffa4c56ce34e2f = fmap fromFFIType hs_bindgen_49ffa4c56ce34e2f_base
+{-# NOINLINE explicit_signed_short_pointer #-}
+{-| __C declaration:__ @explicit_signed_short_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 127:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short_pointer :: Ptr (Ptr CShort)
+{-| __C declaration:__ @explicit_signed_short_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 127:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short_pointer = unsafePerformIO hs_bindgen_49ffa4c56ce34e2f
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer@
+foreign import ccall unsafe "hs_bindgen_fb80ad6945c7151d" hs_bindgen_fb80ad6945c7151d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer@
+hs_bindgen_fb80ad6945c7151d :: IO (Ptr (Ptr CUShort))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer@
+hs_bindgen_fb80ad6945c7151d = fmap fromFFIType hs_bindgen_fb80ad6945c7151d_base
+{-# NOINLINE unsigned_short_pointer #-}
+{-| __C declaration:__ @unsigned_short_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 128:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short_pointer :: Ptr (Ptr CUShort)
+{-| __C declaration:__ @unsigned_short_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 128:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short_pointer = unsafePerformIO hs_bindgen_fb80ad6945c7151d
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer@
+foreign import ccall unsafe "hs_bindgen_dfef04ad64871bf8" hs_bindgen_dfef04ad64871bf8_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer@
+hs_bindgen_dfef04ad64871bf8 :: IO (Ptr (Ptr CInt))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer@
+hs_bindgen_dfef04ad64871bf8 = fmap fromFFIType hs_bindgen_dfef04ad64871bf8_base
+{-# NOINLINE ordinary_signed_int_pointer #-}
+{-| __C declaration:__ @ordinary_signed_int_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 130:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int_pointer :: Ptr (Ptr CInt)
+{-| __C declaration:__ @ordinary_signed_int_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 130:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int_pointer = unsafePerformIO hs_bindgen_dfef04ad64871bf8
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer@
+foreign import ccall unsafe "hs_bindgen_515d5232453c4285" hs_bindgen_515d5232453c4285_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer@
+hs_bindgen_515d5232453c4285 :: IO (Ptr (Ptr CInt))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer@
+hs_bindgen_515d5232453c4285 = fmap fromFFIType hs_bindgen_515d5232453c4285_base
+{-# NOINLINE explicit_signed_int_pointer #-}
+{-| __C declaration:__ @explicit_signed_int_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 131:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int_pointer :: Ptr (Ptr CInt)
+{-| __C declaration:__ @explicit_signed_int_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 131:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int_pointer = unsafePerformIO hs_bindgen_515d5232453c4285
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer@
+foreign import ccall unsafe "hs_bindgen_9f2724dae8d3b3fa" hs_bindgen_9f2724dae8d3b3fa_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer@
+hs_bindgen_9f2724dae8d3b3fa :: IO (Ptr (Ptr CUInt))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer@
+hs_bindgen_9f2724dae8d3b3fa = fmap fromFFIType hs_bindgen_9f2724dae8d3b3fa_base
+{-# NOINLINE unsigned_int_pointer #-}
+{-| __C declaration:__ @unsigned_int_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 132:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int_pointer :: Ptr (Ptr CUInt)
+{-| __C declaration:__ @unsigned_int_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 132:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int_pointer = unsafePerformIO hs_bindgen_9f2724dae8d3b3fa
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer@
+foreign import ccall unsafe "hs_bindgen_a6b4a786a6644424" hs_bindgen_a6b4a786a6644424_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer@
+hs_bindgen_a6b4a786a6644424 :: IO (Ptr (Ptr CLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer@
+hs_bindgen_a6b4a786a6644424 = fmap fromFFIType hs_bindgen_a6b4a786a6644424_base
+{-# NOINLINE ordinary_signed_long_pointer #-}
+{-| __C declaration:__ @ordinary_signed_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 134:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_pointer :: Ptr (Ptr CLong)
+{-| __C declaration:__ @ordinary_signed_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 134:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_pointer = unsafePerformIO hs_bindgen_a6b4a786a6644424
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer@
+foreign import ccall unsafe "hs_bindgen_4df40729ac557753" hs_bindgen_4df40729ac557753_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer@
+hs_bindgen_4df40729ac557753 :: IO (Ptr (Ptr CLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer@
+hs_bindgen_4df40729ac557753 = fmap fromFFIType hs_bindgen_4df40729ac557753_base
+{-# NOINLINE explicit_signed_long_pointer #-}
+{-| __C declaration:__ @explicit_signed_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 135:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_pointer :: Ptr (Ptr CLong)
+{-| __C declaration:__ @explicit_signed_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 135:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_pointer = unsafePerformIO hs_bindgen_4df40729ac557753
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer@
+foreign import ccall unsafe "hs_bindgen_30379268a6bf43b0" hs_bindgen_30379268a6bf43b0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer@
+hs_bindgen_30379268a6bf43b0 :: IO (Ptr (Ptr CULong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer@
+hs_bindgen_30379268a6bf43b0 = fmap fromFFIType hs_bindgen_30379268a6bf43b0_base
+{-# NOINLINE unsigned_long_pointer #-}
+{-| __C declaration:__ @unsigned_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 136:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_pointer :: Ptr (Ptr CULong)
+{-| __C declaration:__ @unsigned_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 136:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_pointer = unsafePerformIO hs_bindgen_30379268a6bf43b0
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer@
+foreign import ccall unsafe "hs_bindgen_63dedd7015d9ed47" hs_bindgen_63dedd7015d9ed47_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer@
+hs_bindgen_63dedd7015d9ed47 :: IO (Ptr (Ptr CLLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer@
+hs_bindgen_63dedd7015d9ed47 = fmap fromFFIType hs_bindgen_63dedd7015d9ed47_base
+{-# NOINLINE ordinary_signed_long_long_pointer #-}
+{-| __C declaration:__ @ordinary_signed_long_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 138:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long_pointer :: Ptr (Ptr CLLong)
+{-| __C declaration:__ @ordinary_signed_long_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 138:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long_pointer = unsafePerformIO hs_bindgen_63dedd7015d9ed47
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer@
+foreign import ccall unsafe "hs_bindgen_9f47ed329f79e647" hs_bindgen_9f47ed329f79e647_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer@
+hs_bindgen_9f47ed329f79e647 :: IO (Ptr (Ptr CLLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer@
+hs_bindgen_9f47ed329f79e647 = fmap fromFFIType hs_bindgen_9f47ed329f79e647_base
+{-# NOINLINE explicit_signed_long_long_pointer #-}
+{-| __C declaration:__ @explicit_signed_long_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 139:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long_pointer :: Ptr (Ptr CLLong)
+{-| __C declaration:__ @explicit_signed_long_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 139:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long_pointer = unsafePerformIO hs_bindgen_9f47ed329f79e647
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer@
+foreign import ccall unsafe "hs_bindgen_7d2dd0a78dde4b41" hs_bindgen_7d2dd0a78dde4b41_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer@
+hs_bindgen_7d2dd0a78dde4b41 :: IO (Ptr (Ptr CULLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer@
+hs_bindgen_7d2dd0a78dde4b41 = fmap fromFFIType hs_bindgen_7d2dd0a78dde4b41_base
+{-# NOINLINE unsigned_long_long_pointer #-}
+{-| __C declaration:__ @unsigned_long_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 140:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long_pointer :: Ptr (Ptr CULLong)
+{-| __C declaration:__ @unsigned_long_long_pointer@
+
+    __defined at:__ @comprehensive\/c2hsc.h 140:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long_pointer = unsafePerformIO hs_bindgen_7d2dd0a78dde4b41
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_array@
+foreign import ccall unsafe "hs_bindgen_dbf314f660deda12" hs_bindgen_dbf314f660deda12_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_array@
+hs_bindgen_dbf314f660deda12 :: IO (Ptr (ConstantArray 10 CFloat))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_array@
+hs_bindgen_dbf314f660deda12 = fmap fromFFIType hs_bindgen_dbf314f660deda12_base
+{-# NOINLINE ordinary_float_array #-}
+{-| Arrays: primitive types which cannot be signed
+
+    __C declaration:__ @ordinary_float_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 146:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float_array :: Ptr (ConstantArray 10 CFloat)
+{-| Arrays: primitive types which cannot be signed
+
+    __C declaration:__ @ordinary_float_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 146:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float_array = unsafePerformIO hs_bindgen_dbf314f660deda12
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_array@
+foreign import ccall unsafe "hs_bindgen_d554c83416b4ffaa" hs_bindgen_d554c83416b4ffaa_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_array@
+hs_bindgen_d554c83416b4ffaa :: IO (Ptr (ConstantArray 10 CDouble))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_array@
+hs_bindgen_d554c83416b4ffaa = fmap fromFFIType hs_bindgen_d554c83416b4ffaa_base
+{-# NOINLINE ordinary_double_array #-}
+{-| __C declaration:__ @ordinary_double_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 147:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double_array :: Ptr (ConstantArray 10 CDouble)
+{-| __C declaration:__ @ordinary_double_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 147:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double_array = unsafePerformIO hs_bindgen_d554c83416b4ffaa
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_array@
+foreign import ccall unsafe "hs_bindgen_9a57c94ff3fad985" hs_bindgen_9a57c94ff3fad985_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_array@
+hs_bindgen_9a57c94ff3fad985 :: IO (Ptr (ConstantArray 10 CChar))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_array@
+hs_bindgen_9a57c94ff3fad985 = fmap fromFFIType hs_bindgen_9a57c94ff3fad985_base
+{-# NOINLINE ordinary_signed_char_array #-}
+{-| __C declaration:__ @ordinary_signed_char_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 150:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_char_array :: Ptr (ConstantArray 10 CChar)
+{-| __C declaration:__ @ordinary_signed_char_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 150:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_char_array = unsafePerformIO hs_bindgen_9a57c94ff3fad985
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_array@
+foreign import ccall unsafe "hs_bindgen_335217e9e2c8fe6a" hs_bindgen_335217e9e2c8fe6a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_array@
+hs_bindgen_335217e9e2c8fe6a :: IO (Ptr (ConstantArray 10 CSChar))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_array@
+hs_bindgen_335217e9e2c8fe6a = fmap fromFFIType hs_bindgen_335217e9e2c8fe6a_base
+{-# NOINLINE explicit_signed_char_array #-}
+{-| __C declaration:__ @explicit_signed_char_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 151:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_char_array :: Ptr (ConstantArray 10 CSChar)
+{-| __C declaration:__ @explicit_signed_char_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 151:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_char_array = unsafePerformIO hs_bindgen_335217e9e2c8fe6a
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_array@
+foreign import ccall unsafe "hs_bindgen_1e72daddbfe2b7ac" hs_bindgen_1e72daddbfe2b7ac_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_array@
+hs_bindgen_1e72daddbfe2b7ac :: IO (Ptr (ConstantArray 10 CUChar))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_array@
+hs_bindgen_1e72daddbfe2b7ac = fmap fromFFIType hs_bindgen_1e72daddbfe2b7ac_base
+{-# NOINLINE unsigned_char_array #-}
+{-| __C declaration:__ @unsigned_char_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 152:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char_array :: Ptr (ConstantArray 10 CUChar)
+{-| __C declaration:__ @unsigned_char_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 152:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char_array = unsafePerformIO hs_bindgen_1e72daddbfe2b7ac
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_array@
+foreign import ccall unsafe "hs_bindgen_109462175baa2bdf" hs_bindgen_109462175baa2bdf_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_array@
+hs_bindgen_109462175baa2bdf :: IO (Ptr (ConstantArray 10 CShort))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_array@
+hs_bindgen_109462175baa2bdf = fmap fromFFIType hs_bindgen_109462175baa2bdf_base
+{-# NOINLINE ordinary_signed_short_array #-}
+{-| __C declaration:__ @ordinary_signed_short_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 154:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short_array :: Ptr (ConstantArray 10 CShort)
+{-| __C declaration:__ @ordinary_signed_short_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 154:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short_array = unsafePerformIO hs_bindgen_109462175baa2bdf
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_array@
+foreign import ccall unsafe "hs_bindgen_50f788c18928793d" hs_bindgen_50f788c18928793d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_array@
+hs_bindgen_50f788c18928793d :: IO (Ptr (ConstantArray 10 CShort))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_array@
+hs_bindgen_50f788c18928793d = fmap fromFFIType hs_bindgen_50f788c18928793d_base
+{-# NOINLINE explicit_signed_short_array #-}
+{-| __C declaration:__ @explicit_signed_short_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 155:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short_array :: Ptr (ConstantArray 10 CShort)
+{-| __C declaration:__ @explicit_signed_short_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 155:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short_array = unsafePerformIO hs_bindgen_50f788c18928793d
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_array@
+foreign import ccall unsafe "hs_bindgen_d5ccc3314ab2eb42" hs_bindgen_d5ccc3314ab2eb42_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_array@
+hs_bindgen_d5ccc3314ab2eb42 :: IO (Ptr (ConstantArray 10 CUShort))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_array@
+hs_bindgen_d5ccc3314ab2eb42 = fmap fromFFIType hs_bindgen_d5ccc3314ab2eb42_base
+{-# NOINLINE unsigned_short_array #-}
+{-| __C declaration:__ @unsigned_short_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 156:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short_array :: Ptr (ConstantArray 10 CUShort)
+{-| __C declaration:__ @unsigned_short_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 156:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short_array = unsafePerformIO hs_bindgen_d5ccc3314ab2eb42
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_array@
+foreign import ccall unsafe "hs_bindgen_f7824c4ee10b0b90" hs_bindgen_f7824c4ee10b0b90_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_array@
+hs_bindgen_f7824c4ee10b0b90 :: IO (Ptr (ConstantArray 10 CInt))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_array@
+hs_bindgen_f7824c4ee10b0b90 = fmap fromFFIType hs_bindgen_f7824c4ee10b0b90_base
+{-# NOINLINE ordinary_signed_int_array #-}
+{-| __C declaration:__ @ordinary_signed_int_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 158:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int_array :: Ptr (ConstantArray 10 CInt)
+{-| __C declaration:__ @ordinary_signed_int_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 158:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int_array = unsafePerformIO hs_bindgen_f7824c4ee10b0b90
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_array@
+foreign import ccall unsafe "hs_bindgen_448c7a47209c8b7a" hs_bindgen_448c7a47209c8b7a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_array@
+hs_bindgen_448c7a47209c8b7a :: IO (Ptr (ConstantArray 10 CInt))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_array@
+hs_bindgen_448c7a47209c8b7a = fmap fromFFIType hs_bindgen_448c7a47209c8b7a_base
+{-# NOINLINE explicit_signed_int_array #-}
+{-| __C declaration:__ @explicit_signed_int_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 159:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int_array :: Ptr (ConstantArray 10 CInt)
+{-| __C declaration:__ @explicit_signed_int_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 159:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int_array = unsafePerformIO hs_bindgen_448c7a47209c8b7a
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_array@
+foreign import ccall unsafe "hs_bindgen_66499a8ae9382b9e" hs_bindgen_66499a8ae9382b9e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_array@
+hs_bindgen_66499a8ae9382b9e :: IO (Ptr (ConstantArray 10 CUInt))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_array@
+hs_bindgen_66499a8ae9382b9e = fmap fromFFIType hs_bindgen_66499a8ae9382b9e_base
+{-# NOINLINE unsigned_int_array #-}
+{-| __C declaration:__ @unsigned_int_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 160:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int_array :: Ptr (ConstantArray 10 CUInt)
+{-| __C declaration:__ @unsigned_int_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 160:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int_array = unsafePerformIO hs_bindgen_66499a8ae9382b9e
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_array@
+foreign import ccall unsafe "hs_bindgen_896d3ba25d886356" hs_bindgen_896d3ba25d886356_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_array@
+hs_bindgen_896d3ba25d886356 :: IO (Ptr (ConstantArray 10 CLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_array@
+hs_bindgen_896d3ba25d886356 = fmap fromFFIType hs_bindgen_896d3ba25d886356_base
+{-# NOINLINE ordinary_signed_long_array #-}
+{-| __C declaration:__ @ordinary_signed_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 162:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_array :: Ptr (ConstantArray 10 CLong)
+{-| __C declaration:__ @ordinary_signed_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 162:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_array = unsafePerformIO hs_bindgen_896d3ba25d886356
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_array@
+foreign import ccall unsafe "hs_bindgen_c4ec5e2d6cf5b5ed" hs_bindgen_c4ec5e2d6cf5b5ed_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_array@
+hs_bindgen_c4ec5e2d6cf5b5ed :: IO (Ptr (ConstantArray 10 CLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_array@
+hs_bindgen_c4ec5e2d6cf5b5ed = fmap fromFFIType hs_bindgen_c4ec5e2d6cf5b5ed_base
+{-# NOINLINE explicit_signed_long_array #-}
+{-| __C declaration:__ @explicit_signed_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 163:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_array :: Ptr (ConstantArray 10 CLong)
+{-| __C declaration:__ @explicit_signed_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 163:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_array = unsafePerformIO hs_bindgen_c4ec5e2d6cf5b5ed
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_array@
+foreign import ccall unsafe "hs_bindgen_e3fb79df55414b09" hs_bindgen_e3fb79df55414b09_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_array@
+hs_bindgen_e3fb79df55414b09 :: IO (Ptr (ConstantArray 10 CULong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_array@
+hs_bindgen_e3fb79df55414b09 = fmap fromFFIType hs_bindgen_e3fb79df55414b09_base
+{-# NOINLINE unsigned_long_array #-}
+{-| __C declaration:__ @unsigned_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 164:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_array :: Ptr (ConstantArray 10 CULong)
+{-| __C declaration:__ @unsigned_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 164:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_array = unsafePerformIO hs_bindgen_e3fb79df55414b09
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_array@
+foreign import ccall unsafe "hs_bindgen_02c15bdcdfc54945" hs_bindgen_02c15bdcdfc54945_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_array@
+hs_bindgen_02c15bdcdfc54945 :: IO (Ptr (ConstantArray 10 CLLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_array@
+hs_bindgen_02c15bdcdfc54945 = fmap fromFFIType hs_bindgen_02c15bdcdfc54945_base
+{-# NOINLINE ordinary_signed_long_long_array #-}
+{-| __C declaration:__ @ordinary_signed_long_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 166:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long_array :: Ptr (ConstantArray 10 CLLong)
+{-| __C declaration:__ @ordinary_signed_long_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 166:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long_array = unsafePerformIO hs_bindgen_02c15bdcdfc54945
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_array@
+foreign import ccall unsafe "hs_bindgen_4c934e5832898551" hs_bindgen_4c934e5832898551_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_array@
+hs_bindgen_4c934e5832898551 :: IO (Ptr (ConstantArray 10 CLLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_array@
+hs_bindgen_4c934e5832898551 = fmap fromFFIType hs_bindgen_4c934e5832898551_base
+{-# NOINLINE explicit_signed_long_long_array #-}
+{-| __C declaration:__ @explicit_signed_long_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 167:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long_array :: Ptr (ConstantArray 10 CLLong)
+{-| __C declaration:__ @explicit_signed_long_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 167:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long_array = unsafePerformIO hs_bindgen_4c934e5832898551
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_array@
+foreign import ccall unsafe "hs_bindgen_af47cf5cc0016405" hs_bindgen_af47cf5cc0016405_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_array@
+hs_bindgen_af47cf5cc0016405 :: IO (Ptr (ConstantArray 10 CULLong))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_array@
+hs_bindgen_af47cf5cc0016405 = fmap fromFFIType hs_bindgen_af47cf5cc0016405_base
+{-# NOINLINE unsigned_long_long_array #-}
+{-| __C declaration:__ @unsigned_long_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 168:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long_array :: Ptr (ConstantArray 10 CULLong)
+{-| __C declaration:__ @unsigned_long_long_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 168:20@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long_array = unsafePerformIO hs_bindgen_af47cf5cc0016405
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer_array@
+foreign import ccall unsafe "hs_bindgen_b0da135021f97e27" hs_bindgen_b0da135021f97e27_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer_array@
+hs_bindgen_b0da135021f97e27 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr Void)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_void_pointer_array@
+hs_bindgen_b0da135021f97e27 = fmap fromFFIType hs_bindgen_b0da135021f97e27_base
+{-# NOINLINE ordinary_void_pointer_array #-}
+{-| Arrays of pointers
+
+    __C declaration:__ @ordinary_void_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 174:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_void_pointer_array :: Ptr (ConstantArray 10 (Ptr Void))
+{-| Arrays of pointers
+
+    __C declaration:__ @ordinary_void_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 174:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_void_pointer_array = unsafePerformIO hs_bindgen_b0da135021f97e27
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer_array@
+foreign import ccall unsafe "hs_bindgen_41ce3a49f177f5a8" hs_bindgen_41ce3a49f177f5a8_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer_array@
+hs_bindgen_41ce3a49f177f5a8 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CFloat)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_float_pointer_array@
+hs_bindgen_41ce3a49f177f5a8 = fmap fromFFIType hs_bindgen_41ce3a49f177f5a8_base
+{-# NOINLINE ordinary_float_pointer_array #-}
+{-| __C declaration:__ @ordinary_float_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 176:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float_pointer_array :: Ptr (ConstantArray 10 (Ptr CFloat))
+{-| __C declaration:__ @ordinary_float_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 176:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_float_pointer_array = unsafePerformIO hs_bindgen_41ce3a49f177f5a8
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer_array@
+foreign import ccall unsafe "hs_bindgen_cfe3890477df51c8" hs_bindgen_cfe3890477df51c8_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer_array@
+hs_bindgen_cfe3890477df51c8 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CDouble)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_double_pointer_array@
+hs_bindgen_cfe3890477df51c8 = fmap fromFFIType hs_bindgen_cfe3890477df51c8_base
+{-# NOINLINE ordinary_double_pointer_array #-}
+{-| __C declaration:__ @ordinary_double_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 177:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double_pointer_array :: Ptr (ConstantArray 10
+                                                    (Ptr CDouble))
+{-| __C declaration:__ @ordinary_double_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 177:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_double_pointer_array = unsafePerformIO hs_bindgen_cfe3890477df51c8
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_pointer_array@
+foreign import ccall unsafe "hs_bindgen_e92be5e29785f22b" hs_bindgen_e92be5e29785f22b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_pointer_array@
+hs_bindgen_e92be5e29785f22b :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CChar)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_char_pointer_array@
+hs_bindgen_e92be5e29785f22b = fmap fromFFIType hs_bindgen_e92be5e29785f22b_base
+{-# NOINLINE ordinary_signed_char_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_char_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 180:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_char_pointer_array :: Ptr (ConstantArray 10
+                                                         (Ptr CChar))
+{-| __C declaration:__ @ordinary_signed_char_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 180:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_char_pointer_array = unsafePerformIO hs_bindgen_e92be5e29785f22b
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_pointer_array@
+foreign import ccall unsafe "hs_bindgen_c8caf99249e8ad58" hs_bindgen_c8caf99249e8ad58_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_pointer_array@
+hs_bindgen_c8caf99249e8ad58 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CSChar)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_char_pointer_array@
+hs_bindgen_c8caf99249e8ad58 = fmap fromFFIType hs_bindgen_c8caf99249e8ad58_base
+{-# NOINLINE explicit_signed_char_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_char_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 181:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_char_pointer_array :: Ptr (ConstantArray 10
+                                                         (Ptr CSChar))
+{-| __C declaration:__ @explicit_signed_char_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 181:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_char_pointer_array = unsafePerformIO hs_bindgen_c8caf99249e8ad58
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer_array@
+foreign import ccall unsafe "hs_bindgen_7028963176c7a21d" hs_bindgen_7028963176c7a21d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer_array@
+hs_bindgen_7028963176c7a21d :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CUChar)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_char_pointer_array@
+hs_bindgen_7028963176c7a21d = fmap fromFFIType hs_bindgen_7028963176c7a21d_base
+{-# NOINLINE unsigned_char_pointer_array #-}
+{-| __C declaration:__ @unsigned_char_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 182:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char_pointer_array :: Ptr (ConstantArray 10 (Ptr CUChar))
+{-| __C declaration:__ @unsigned_char_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 182:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_char_pointer_array = unsafePerformIO hs_bindgen_7028963176c7a21d
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer_array@
+foreign import ccall unsafe "hs_bindgen_1866849231d566a0" hs_bindgen_1866849231d566a0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer_array@
+hs_bindgen_1866849231d566a0 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CShort)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_short_pointer_array@
+hs_bindgen_1866849231d566a0 = fmap fromFFIType hs_bindgen_1866849231d566a0_base
+{-# NOINLINE ordinary_signed_short_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_short_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 184:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short_pointer_array :: Ptr (ConstantArray 10
+                                                          (Ptr CShort))
+{-| __C declaration:__ @ordinary_signed_short_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 184:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_short_pointer_array = unsafePerformIO hs_bindgen_1866849231d566a0
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer_array@
+foreign import ccall unsafe "hs_bindgen_68ed6d444e1b6011" hs_bindgen_68ed6d444e1b6011_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer_array@
+hs_bindgen_68ed6d444e1b6011 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CShort)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_short_pointer_array@
+hs_bindgen_68ed6d444e1b6011 = fmap fromFFIType hs_bindgen_68ed6d444e1b6011_base
+{-# NOINLINE explicit_signed_short_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_short_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 185:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short_pointer_array :: Ptr (ConstantArray 10
+                                                          (Ptr CShort))
+{-| __C declaration:__ @explicit_signed_short_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 185:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_short_pointer_array = unsafePerformIO hs_bindgen_68ed6d444e1b6011
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer_array@
+foreign import ccall unsafe "hs_bindgen_7c0ca48c3269649a" hs_bindgen_7c0ca48c3269649a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer_array@
+hs_bindgen_7c0ca48c3269649a :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CUShort)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_short_pointer_array@
+hs_bindgen_7c0ca48c3269649a = fmap fromFFIType hs_bindgen_7c0ca48c3269649a_base
+{-# NOINLINE unsigned_short_pointer_array #-}
+{-| __C declaration:__ @unsigned_short_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 186:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short_pointer_array :: Ptr (ConstantArray 10
+                                                   (Ptr CUShort))
+{-| __C declaration:__ @unsigned_short_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 186:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_short_pointer_array = unsafePerformIO hs_bindgen_7c0ca48c3269649a
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer_array@
+foreign import ccall unsafe "hs_bindgen_58e6503e8ccbeb70" hs_bindgen_58e6503e8ccbeb70_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer_array@
+hs_bindgen_58e6503e8ccbeb70 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CInt)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_int_pointer_array@
+hs_bindgen_58e6503e8ccbeb70 = fmap fromFFIType hs_bindgen_58e6503e8ccbeb70_base
+{-# NOINLINE ordinary_signed_int_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_int_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 188:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int_pointer_array :: Ptr (ConstantArray 10
+                                                        (Ptr CInt))
+{-| __C declaration:__ @ordinary_signed_int_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 188:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_int_pointer_array = unsafePerformIO hs_bindgen_58e6503e8ccbeb70
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer_array@
+foreign import ccall unsafe "hs_bindgen_21b8395de873bc0a" hs_bindgen_21b8395de873bc0a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer_array@
+hs_bindgen_21b8395de873bc0a :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CInt)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_int_pointer_array@
+hs_bindgen_21b8395de873bc0a = fmap fromFFIType hs_bindgen_21b8395de873bc0a_base
+{-# NOINLINE explicit_signed_int_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_int_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 189:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int_pointer_array :: Ptr (ConstantArray 10
+                                                        (Ptr CInt))
+{-| __C declaration:__ @explicit_signed_int_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 189:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_int_pointer_array = unsafePerformIO hs_bindgen_21b8395de873bc0a
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer_array@
+foreign import ccall unsafe "hs_bindgen_667d31d5b7b5106e" hs_bindgen_667d31d5b7b5106e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer_array@
+hs_bindgen_667d31d5b7b5106e :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CUInt)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_int_pointer_array@
+hs_bindgen_667d31d5b7b5106e = fmap fromFFIType hs_bindgen_667d31d5b7b5106e_base
+{-# NOINLINE unsigned_int_pointer_array #-}
+{-| __C declaration:__ @unsigned_int_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 190:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int_pointer_array :: Ptr (ConstantArray 10 (Ptr CUInt))
+{-| __C declaration:__ @unsigned_int_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 190:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_int_pointer_array = unsafePerformIO hs_bindgen_667d31d5b7b5106e
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_eb34bb7d213dcd3d" hs_bindgen_eb34bb7d213dcd3d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer_array@
+hs_bindgen_eb34bb7d213dcd3d :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CLong)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_pointer_array@
+hs_bindgen_eb34bb7d213dcd3d = fmap fromFFIType hs_bindgen_eb34bb7d213dcd3d_base
+{-# NOINLINE ordinary_signed_long_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 192:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_pointer_array :: Ptr (ConstantArray 10
+                                                         (Ptr CLong))
+{-| __C declaration:__ @ordinary_signed_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 192:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_pointer_array = unsafePerformIO hs_bindgen_eb34bb7d213dcd3d
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_3386ff9d0e54545d" hs_bindgen_3386ff9d0e54545d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer_array@
+hs_bindgen_3386ff9d0e54545d :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CLong)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_pointer_array@
+hs_bindgen_3386ff9d0e54545d = fmap fromFFIType hs_bindgen_3386ff9d0e54545d_base
+{-# NOINLINE explicit_signed_long_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 193:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_pointer_array :: Ptr (ConstantArray 10
+                                                         (Ptr CLong))
+{-| __C declaration:__ @explicit_signed_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 193:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_pointer_array = unsafePerformIO hs_bindgen_3386ff9d0e54545d
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_510be86496a28c91" hs_bindgen_510be86496a28c91_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer_array@
+hs_bindgen_510be86496a28c91 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CULong)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_pointer_array@
+hs_bindgen_510be86496a28c91 = fmap fromFFIType hs_bindgen_510be86496a28c91_base
+{-# NOINLINE unsigned_long_pointer_array #-}
+{-| __C declaration:__ @unsigned_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 194:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_pointer_array :: Ptr (ConstantArray 10 (Ptr CULong))
+{-| __C declaration:__ @unsigned_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 194:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_pointer_array = unsafePerformIO hs_bindgen_510be86496a28c91
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_25f60aa140d341a7" hs_bindgen_25f60aa140d341a7_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer_array@
+hs_bindgen_25f60aa140d341a7 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CLLong)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_ordinary_signed_long_long_pointer_array@
+hs_bindgen_25f60aa140d341a7 = fmap fromFFIType hs_bindgen_25f60aa140d341a7_base
+{-# NOINLINE ordinary_signed_long_long_pointer_array #-}
+{-| __C declaration:__ @ordinary_signed_long_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 196:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long_pointer_array :: Ptr (ConstantArray 10
+                                                              (Ptr CLLong))
+{-| __C declaration:__ @ordinary_signed_long_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 196:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+ordinary_signed_long_long_pointer_array = unsafePerformIO hs_bindgen_25f60aa140d341a7
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_aced8afe33f53905" hs_bindgen_aced8afe33f53905_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer_array@
+hs_bindgen_aced8afe33f53905 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CLLong)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_explicit_signed_long_long_pointer_array@
+hs_bindgen_aced8afe33f53905 = fmap fromFFIType hs_bindgen_aced8afe33f53905_base
+{-# NOINLINE explicit_signed_long_long_pointer_array #-}
+{-| __C declaration:__ @explicit_signed_long_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 197:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long_pointer_array :: Ptr (ConstantArray 10
+                                                              (Ptr CLLong))
+{-| __C declaration:__ @explicit_signed_long_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 197:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+explicit_signed_long_long_pointer_array = unsafePerformIO hs_bindgen_aced8afe33f53905
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer_array@
+foreign import ccall unsafe "hs_bindgen_9534a7c84390edc4" hs_bindgen_9534a7c84390edc4_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer_array@
+hs_bindgen_9534a7c84390edc4 :: IO (Ptr (ConstantArray 10
+                                                      (Ptr CULLong)))
+-- __unique:__ @test_comprehensivec2hsc_Example_get_unsigned_long_long_pointer_array@
+hs_bindgen_9534a7c84390edc4 = fmap fromFFIType hs_bindgen_9534a7c84390edc4_base
+{-# NOINLINE unsigned_long_long_pointer_array #-}
+{-| __C declaration:__ @unsigned_long_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 198:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long_pointer_array :: Ptr (ConstantArray 10
+                                                       (Ptr CULLong))
+{-| __C declaration:__ @unsigned_long_long_pointer_array@
+
+    __defined at:__ @comprehensive\/c2hsc.h 198:21@
+
+    __exported by:__ @comprehensive\/c2hsc.h@
+-}
+unsigned_long_long_pointer_array = unsafePerformIO hs_bindgen_9534a7c84390edc4
diff --git a/test-artefacts/fixtures/comprehensive/smoke/Example.hs b/test-artefacts/fixtures/comprehensive/smoke/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/smoke/Example.hs
@@ -0,0 +1,1137 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Uint(..)
+    , Example.Size_t(..)
+    , Example.Bar1_t(..)
+    , Example.Bar2_t(..)
+    , Example.Bar3_t(..)
+    , pattern Example.BAZ1
+    , Example.Baz2_t(..)
+    , pattern Example.BAZ2
+    , Example.Baz3_t(..)
+    , pattern Example.BAZ3
+    , Example.Baz4_t(..)
+    , pattern Example.BAZ4
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @uint@
+
+    __defined at:__ @comprehensive\/smoke.h 7:22@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Uint = Uint
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrap" Uint ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> Uint {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrap" (BG.Ptr Uint) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Uint "unwrap" where
+
+  type CFieldType Uint "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @size_t@
+
+    __defined at:__ @comprehensive\/smoke.h 8:23@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Size_t = Size_t
+  { unwrap :: BG.CULong
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CULong) => BG.CompatHasField.HasField "unwrap" Size_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Size_t {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CULong
+         ) => BG.HasField "unwrap" (BG.Ptr Size_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Size_t "unwrap" where
+
+  type CFieldType Size_t "unwrap" = BG.CULong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct bar1_t@
+
+    __defined at:__ @comprehensive\/smoke.h 39:8@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+data Bar1_t = Bar1_t
+  { a :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @comprehensive\/smoke.h 40:11@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @comprehensive\/smoke.h 41:11@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , c :: BG.CChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @comprehensive\/smoke.h 42:11@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , d :: BG.Ptr BG.CChar
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @comprehensive\/smoke.h 43:11@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , e :: BG.FunPtr (IO (BG.Ptr BG.CChar))
+    {- ^ __C declaration:__ @e@
+
+         __defined at:__ @comprehensive\/smoke.h 44:13@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , f :: BG.FunPtr (BG.Ptr BG.Void -> IO ())
+    {- ^ __C declaration:__ @f@
+
+         __defined at:__ @comprehensive\/smoke.h 45:13@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , g :: BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.CInt))
+    {- ^ __C declaration:__ @g@
+
+         __defined at:__ @comprehensive\/smoke.h 46:13@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , h :: BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+    {- ^ __C declaration:__ @h@
+
+         __defined at:__ @comprehensive\/smoke.h 47:13@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , i :: BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @comprehensive\/smoke.h 48:13@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , j :: CA.ConstantArray 2 BG.CChar
+    {- ^ __C declaration:__ @j@
+
+         __defined at:__ @comprehensive\/smoke.h 49:11@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  , k :: BG.Ptr Bar1_t
+    {- ^ __C declaration:__ @k@
+
+         __defined at:__ @comprehensive\/smoke.h 51:19@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar1_t where
+
+  staticSizeOf = \_ -> (80 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Bar1_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar1_t
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"d") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"e") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"f") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"g") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"h") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"i") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"j") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"k") ptr0
+
+instance Marshal.WriteRaw Bar1_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar1_t a2 b3 c4 d5 e6 f7 g8 h9 i10 j11 k12 ->
+               HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+            >> HasCField.writeRaw (BG.Proxy @"b") ptr0 b3
+            >> HasCField.writeRaw (BG.Proxy @"c") ptr0 c4
+            >> HasCField.writeRaw (BG.Proxy @"d") ptr0 d5
+            >> HasCField.writeRaw (BG.Proxy @"e") ptr0 e6
+            >> HasCField.writeRaw (BG.Proxy @"f") ptr0 f7
+            >> HasCField.writeRaw (BG.Proxy @"g") ptr0 g8
+            >> HasCField.writeRaw (BG.Proxy @"h") ptr0 h9
+            >> HasCField.writeRaw (BG.Proxy @"i") ptr0 i10
+            >> HasCField.writeRaw (BG.Proxy @"j") ptr0 j11
+            >> HasCField.writeRaw (BG.Proxy @"k") ptr0 k12
+
+deriving via Marshal.EquivStorable Bar1_t instance BG.Storable Bar1_t
+
+deriving via Struct.IsStructViaReadRaw Bar1_t instance Struct.IsStruct Bar1_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @comprehensive\/smoke.h 40:11@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance (ty ~ BG.Ptr BG.Void) => BG.CompatHasField.HasField "a" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { a = y1
+                 , b = BG.getField @"b" x0
+                 , c = BG.getField @"c" x0
+                 , d = BG.getField @"d" x0
+                 , e = BG.getField @"e" x0
+                 , f = BG.getField @"f" x0
+                 , g = BG.getField @"g" x0
+                 , h = BG.getField @"h" x0
+                 , i = BG.getField @"i" x0
+                 , j = BG.getField @"j" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"a" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "a" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField Bar1_t "a" where
+
+  type CFieldType Bar1_t "a" = BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @comprehensive\/smoke.h 41:11@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "b" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { b = y1
+                 , a = BG.getField @"a" x0
+                 , c = BG.getField @"c" x0
+                 , d = BG.getField @"d" x0
+                 , e = BG.getField @"e" x0
+                 , f = BG.getField @"f" x0
+                 , g = BG.getField @"g" x0
+                 , h = BG.getField @"h" x0
+                 , i = BG.getField @"i" x0
+                 , j = BG.getField @"j" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "b" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b")
+
+instance HasCField.HasCField Bar1_t "b" where
+
+  type CFieldType Bar1_t "b" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @comprehensive\/smoke.h 42:11@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "c" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { c = y1
+                 , a = BG.getField @"a" x0
+                 , b = BG.getField @"b" x0
+                 , d = BG.getField @"d" x0
+                 , e = BG.getField @"e" x0
+                 , f = BG.getField @"f" x0
+                 , g = BG.getField @"g" x0
+                 , h = BG.getField @"h" x0
+                 , i = BG.getField @"i" x0
+                 , j = BG.getField @"j" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"c" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "c" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"c")
+
+instance HasCField.HasCField Bar1_t "c" where
+
+  type CFieldType Bar1_t "c" = BG.CChar
+
+  offset# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @comprehensive\/smoke.h 43:11@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.CompatHasField.HasField "d" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { d = y1
+                 , a = BG.getField @"a" x0
+                 , b = BG.getField @"b" x0
+                 , c = BG.getField @"c" x0
+                 , e = BG.getField @"e" x0
+                 , f = BG.getField @"f" x0
+                 , g = BG.getField @"g" x0
+                 , h = BG.getField @"h" x0
+                 , i = BG.getField @"i" x0
+                 , j = BG.getField @"j" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"d" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.HasField "d" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"d")
+
+instance HasCField.HasCField Bar1_t "d" where
+
+  type CFieldType Bar1_t "d" = BG.Ptr BG.CChar
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @comprehensive\/smoke.h 44:13@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance ( ty ~ BG.FunPtr (IO (BG.Ptr BG.CChar))
+         ) => BG.CompatHasField.HasField "e" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { e = y1
+                 , a = BG.getField @"a" x0
+                 , b = BG.getField @"b" x0
+                 , c = BG.getField @"c" x0
+                 , d = BG.getField @"d" x0
+                 , f = BG.getField @"f" x0
+                 , g = BG.getField @"g" x0
+                 , h = BG.getField @"h" x0
+                 , i = BG.getField @"i" x0
+                 , j = BG.getField @"j" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"e" x0
+      )
+
+instance ( ty ~ BG.FunPtr (IO (BG.Ptr BG.CChar))
+         ) => BG.HasField "e" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"e")
+
+instance HasCField.HasCField Bar1_t "e" where
+
+  type CFieldType Bar1_t "e" =
+    BG.FunPtr (IO (BG.Ptr BG.CChar))
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @comprehensive\/smoke.h 45:13@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO ())
+         ) => BG.CompatHasField.HasField "f" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { f = y1
+                 , a = BG.getField @"a" x0
+                 , b = BG.getField @"b" x0
+                 , c = BG.getField @"c" x0
+                 , d = BG.getField @"d" x0
+                 , e = BG.getField @"e" x0
+                 , g = BG.getField @"g" x0
+                 , h = BG.getField @"h" x0
+                 , i = BG.getField @"i" x0
+                 , j = BG.getField @"j" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"f" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO ())
+         ) => BG.HasField "f" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"f")
+
+instance HasCField.HasCField Bar1_t "f" where
+
+  type CFieldType Bar1_t "f" =
+    BG.FunPtr (BG.Ptr BG.Void -> IO ())
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @comprehensive\/smoke.h 46:13@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.CInt))
+         ) => BG.CompatHasField.HasField "g" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { g = y1
+                 , a = BG.getField @"a" x0
+                 , b = BG.getField @"b" x0
+                 , c = BG.getField @"c" x0
+                 , d = BG.getField @"d" x0
+                 , e = BG.getField @"e" x0
+                 , f = BG.getField @"f" x0
+                 , h = BG.getField @"h" x0
+                 , i = BG.getField @"i" x0
+                 , j = BG.getField @"j" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"g" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.CInt))
+         ) => BG.HasField "g" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g")
+
+instance HasCField.HasCField Bar1_t "g" where
+
+  type CFieldType Bar1_t "g" =
+    BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.CInt))
+
+  offset# = \_ -> \_ -> 40
+
+{-| __C declaration:__ @h@
+
+    __defined at:__ @comprehensive\/smoke.h 47:13@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+         ) => BG.CompatHasField.HasField "h" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { h = y1
+                 , a = BG.getField @"a" x0
+                 , b = BG.getField @"b" x0
+                 , c = BG.getField @"c" x0
+                 , d = BG.getField @"d" x0
+                 , e = BG.getField @"e" x0
+                 , f = BG.getField @"f" x0
+                 , g = BG.getField @"g" x0
+                 , i = BG.getField @"i" x0
+                 , j = BG.getField @"j" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"h" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+         ) => BG.HasField "h" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"h")
+
+instance HasCField.HasCField Bar1_t "h" where
+
+  type CFieldType Bar1_t "h" =
+    BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+
+  offset# = \_ -> \_ -> 48
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @comprehensive\/smoke.h 48:13@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+         ) => BG.CompatHasField.HasField "i" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { i = y1
+                 , a = BG.getField @"a" x0
+                 , b = BG.getField @"b" x0
+                 , c = BG.getField @"c" x0
+                 , d = BG.getField @"d" x0
+                 , e = BG.getField @"e" x0
+                 , f = BG.getField @"f" x0
+                 , g = BG.getField @"g" x0
+                 , h = BG.getField @"h" x0
+                 , j = BG.getField @"j" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"i" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+         ) => BG.HasField "i" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"i")
+
+instance HasCField.HasCField Bar1_t "i" where
+
+  type CFieldType Bar1_t "i" =
+    BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+
+  offset# = \_ -> \_ -> 56
+
+{-| __C declaration:__ @j@
+
+    __defined at:__ @comprehensive\/smoke.h 49:11@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance ( ty ~ CA.ConstantArray 2 BG.CChar
+         ) => BG.CompatHasField.HasField "j" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { j = y1
+                 , a = BG.getField @"a" x0
+                 , b = BG.getField @"b" x0
+                 , c = BG.getField @"c" x0
+                 , d = BG.getField @"d" x0
+                 , e = BG.getField @"e" x0
+                 , f = BG.getField @"f" x0
+                 , g = BG.getField @"g" x0
+                 , h = BG.getField @"h" x0
+                 , i = BG.getField @"i" x0
+                 , k = BG.getField @"k" x0
+                 }
+      , BG.getField @"j" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 2 BG.CChar
+         ) => BG.HasField "j" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"j")
+
+instance HasCField.HasCField Bar1_t "j" where
+
+  type CFieldType Bar1_t "j" =
+    CA.ConstantArray 2 BG.CChar
+
+  offset# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @k@
+
+    __defined at:__ @comprehensive\/smoke.h 51:19@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance (ty ~ BG.Ptr Bar1_t) => BG.CompatHasField.HasField "k" Bar1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar1_t { k = y1
+                 , a = BG.getField @"a" x0
+                 , b = BG.getField @"b" x0
+                 , c = BG.getField @"c" x0
+                 , d = BG.getField @"d" x0
+                 , e = BG.getField @"e" x0
+                 , f = BG.getField @"f" x0
+                 , g = BG.getField @"g" x0
+                 , h = BG.getField @"h" x0
+                 , i = BG.getField @"i" x0
+                 , j = BG.getField @"j" x0
+                 }
+      , BG.getField @"k" x0
+      )
+
+instance ( ty ~ BG.Ptr Bar1_t
+         ) => BG.HasField "k" (BG.Ptr Bar1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"k")
+
+instance HasCField.HasCField Bar1_t "k" where
+
+  type CFieldType Bar1_t "k" = BG.Ptr Bar1_t
+
+  offset# = \_ -> \_ -> 72
+
+{-| __C declaration:__ @struct bar2_t@
+
+    __defined at:__ @comprehensive\/smoke.h 54:16@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+data Bar2_t = Bar2_t
+  { a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @comprehensive\/smoke.h 55:7@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar2_t where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bar2_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar2_t
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+
+instance Marshal.WriteRaw Bar2_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar2_t a2 ->
+            HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+
+deriving via Marshal.EquivStorable Bar2_t instance BG.Storable Bar2_t
+
+deriving via Struct.IsStructViaReadRaw Bar2_t instance Struct.IsStruct Bar2_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @comprehensive\/smoke.h 55:7@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "a" Bar2_t ty where
+
+  hasField =
+    \x0 -> (\y1 -> Bar2_t {a = y1}, BG.getField @"a" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "a" (BG.Ptr Bar2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField Bar2_t "a" where
+
+  type CFieldType Bar2_t "a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct bar3_t@
+
+    __defined at:__ @comprehensive\/smoke.h 58:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+data Bar3_t = Bar3_t
+  { a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @comprehensive\/smoke.h 59:7@
+
+         __exported by:__ @comprehensive\/smoke.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar3_t where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bar3_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar3_t
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+
+instance Marshal.WriteRaw Bar3_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar3_t a2 ->
+            HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+
+deriving via Marshal.EquivStorable Bar3_t instance BG.Storable Bar3_t
+
+deriving via Struct.IsStructViaReadRaw Bar3_t instance Struct.IsStruct Bar3_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @comprehensive\/smoke.h 59:7@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "a" Bar3_t ty where
+
+  hasField =
+    \x0 -> (\y1 -> Bar3_t {a = y1}, BG.getField @"a" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "a" (BG.Ptr Bar3_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField Bar3_t "a" where
+
+  type CFieldType Bar3_t "a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @BAZ1@
+
+    __defined at:__ @comprehensive\/smoke.h 62:1@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+pattern BAZ1 :: BG.CUInt
+pattern BAZ1 = 1
+
+{-| __C declaration:__ @enum baz2_t@
+
+    __defined at:__ @comprehensive\/smoke.h 66:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Baz2_t = Baz2_t
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Baz2_t where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Baz2_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Baz2_t
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Baz2_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Baz2_t unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable Baz2_t instance BG.Storable Baz2_t
+
+deriving via BG.CUInt instance BG.Prim Baz2_t
+
+instance CEnum.CEnum Baz2_t where
+
+  type CEnumZ Baz2_t = BG.CUInt
+
+  toCEnum = Baz2_t
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(1, BG.singleton "BAZ2")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Baz2_t"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Baz2_t"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Baz2_t where
+
+  minDeclaredValue = BAZ2
+
+  maxDeclaredValue = BAZ2
+
+instance Show Baz2_t where
+
+  showsPrec = CEnum.shows
+
+instance Read Baz2_t where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrap" Baz2_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Baz2_t {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr Baz2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Baz2_t "unwrap" where
+
+  type CFieldType Baz2_t "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @BAZ2@
+
+    __defined at:__ @comprehensive\/smoke.h 67:3@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+pattern BAZ2 :: Baz2_t
+pattern BAZ2 = Baz2_t 1
+
+{-| __C declaration:__ @enum baz3_t@
+
+    __defined at:__ @comprehensive\/smoke.h 70:6@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Baz3_t = Baz3_t
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Baz3_t where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Baz3_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Baz3_t
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Baz3_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Baz3_t unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable Baz3_t instance BG.Storable Baz3_t
+
+deriving via BG.CUInt instance BG.Prim Baz3_t
+
+instance CEnum.CEnum Baz3_t where
+
+  type CEnumZ Baz3_t = BG.CUInt
+
+  toCEnum = Baz3_t
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(1, BG.singleton "BAZ3")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Baz3_t"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Baz3_t"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Baz3_t where
+
+  minDeclaredValue = BAZ3
+
+  maxDeclaredValue = BAZ3
+
+instance Show Baz3_t where
+
+  showsPrec = CEnum.shows
+
+instance Read Baz3_t where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrap" Baz3_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Baz3_t {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr Baz3_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Baz3_t "unwrap" where
+
+  type CFieldType Baz3_t "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @BAZ3@
+
+    __defined at:__ @comprehensive\/smoke.h 71:3@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+pattern BAZ3 :: Baz3_t
+pattern BAZ3 = Baz3_t 1
+
+{-| __C declaration:__ @enum baz4_t@
+
+    __defined at:__ @comprehensive\/smoke.h 74:14@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Baz4_t = Baz4_t
+  { unwrap :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Baz4_t where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Baz4_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Baz4_t
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Baz4_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Baz4_t unwrap2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
+
+deriving via Marshal.EquivStorable Baz4_t instance BG.Storable Baz4_t
+
+deriving via BG.CUInt instance BG.Prim Baz4_t
+
+instance CEnum.CEnum Baz4_t where
+
+  type CEnumZ Baz4_t = BG.CUInt
+
+  toCEnum = Baz4_t
+
+  fromCEnum = BG.getField @"unwrap"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(1, BG.singleton "BAZ4")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Baz4_t"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Baz4_t"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Baz4_t where
+
+  minDeclaredValue = BAZ4
+
+  maxDeclaredValue = BAZ4
+
+instance Show Baz4_t where
+
+  showsPrec = CEnum.shows
+
+instance Read Baz4_t where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrap" Baz4_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Baz4_t {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrap" (BG.Ptr Baz4_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField Baz4_t "unwrap" where
+
+  type CFieldType Baz4_t "unwrap" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @BAZ4@
+
+    __defined at:__ @comprehensive\/smoke.h 75:3@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+pattern BAZ4 :: Baz4_t
+pattern BAZ4 = Baz4_t 1
diff --git a/test-artefacts/fixtures/comprehensive/smoke/Example/FunPtr.hs b/test-artefacts/fixtures/comprehensive/smoke/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/smoke/Example/FunPtr.hs
@@ -0,0 +1,871 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo1
+    , Example.FunPtr.foo2
+    , Example.FunPtr.foo3
+    , Example.FunPtr.foo4
+    , Example.FunPtr.foo5
+    , Example.FunPtr.foo6
+    , Example.FunPtr.foo7
+    , Example.FunPtr.foo8
+    , Example.FunPtr.foo9
+    , Example.FunPtr.foo10
+    , Example.FunPtr.foo11
+    , Example.FunPtr.foo12
+    , Example.FunPtr.foo13
+    , Example.FunPtr.foo14
+    , Example.FunPtr.foo15
+    , Example.FunPtr.foo16
+    , Example.FunPtr.foo17
+    , Example.FunPtr.foo18
+    , Example.FunPtr.foo19
+    , Example.FunPtr.foo20
+    , Example.FunPtr.foo21
+    , Example.FunPtr.foo22
+    , Example.FunPtr.foo23
+    , Example.FunPtr.foo24
+    , Example.FunPtr.foo25
+    , Example.FunPtr.foo26
+    , Example.FunPtr.foo27
+    , Example.FunPtr.foo28
+    , Example.FunPtr.inline_foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <comprehensive/smoke.h>"
+  , "/* test_comprehensivesmoke_Example_get_foo1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_abdd0c6dd73d0854 (void)) (void)"
+  , "{"
+  , "  return &foo1;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_95f5e8dc2a878cd6 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo2;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9970868a81b829db (void)) ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &foo3;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo4 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_c2fb72f24a5149fb (void)) (void)"
+  , "{"
+  , "  return &foo4;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo5 */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_3d952ee4c4ee378f (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo5;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo6 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_478897bd7cf090b7 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &foo6;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo7 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_2804b55bcc6495bd (void)) ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return &foo7;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo8 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_dc0ab953845109e0 (void)) ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return &foo8;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo9 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_6c6b48e80df5d80b (void)) ("
+  , "  char *(*arg1) (void)"
+  , ")"
+  , "{"
+  , "  return &foo9;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo10 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_fc0a56da1aa3e234 (void)) ("
+  , "  char *(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo10;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo11 */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_b882a6f77db6bd0e (void)) ("
+  , "  void *(*arg1) (void)"
+  , ")"
+  , "{"
+  , "  return &foo11;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo12 */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_c219c7d6d459a7e0 (void)) ("
+  , "  void *(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo12;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo13 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_caa14e75b1229a54 (void)) ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return &foo13;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo14 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_3cb093b66f7944d4 (void)) ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return &foo14;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo15 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_fe12aea8f26fdc44 (void)) ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return &foo15;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo16 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_7682897a88740d24 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo16;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo17 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_a8ad868a6dc425f9 (void)) ("
+  , "  char ***arg1"
+  , ")"
+  , "{"
+  , "  return &foo17;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo18 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_245d12e0c60b976b (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &foo18;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo19 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_81d64147225cc2ab (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &foo19;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo20 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_b9d12fbbd2c70f4f (void)) ("
+  , "  uint arg1"
+  , ")"
+  , "{"
+  , "  return &foo20;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo21 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_a3c85769041747ba (void)) ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo21;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo22 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_5fc122411b8a03ea (void)) ("
+  , "  signed int *(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo22;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo23 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_a7fcbb7f1b7f29cb (void)) ("
+  , "  signed int **(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo23;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo24 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_9c5a2b0e6d53b7c9 (void)) ("
+  , "  signed int ***(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo24;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo25 */"
+  , "__attribute__ ((const))"
+  , "signed int *(*hs_bindgen_5b576a9269d86a85 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo25;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo26 */"
+  , "__attribute__ ((const))"
+  , "signed int **(*hs_bindgen_3d968f750d7c0963 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo26;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo27 */"
+  , "__attribute__ ((const))"
+  , "signed int ***(*hs_bindgen_477d6debd15ec8cc (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo27;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_foo28 */"
+  , "__attribute__ ((const))"
+  , "signed int ***(*hs_bindgen_fe8d0bbb3e0e9949 (void)) ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return &foo28;"
+  , "}"
+  , "/* test_comprehensivesmoke_Example_get_inline_foo */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_3e48bdcc0c25203c (void)) ("
+  , "  signed int arg1,"
+  , "  signed int *arg2,"
+  , "  signed int const arg3,"
+  , "  signed int const *arg4,"
+  , "  signed int const **arg5,"
+  , "  signed int const *const *arg6,"
+  , "  size_t arg7"
+  , ")"
+  , "{"
+  , "  return &inline_foo;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo1@
+foreign import ccall unsafe "hs_bindgen_abdd0c6dd73d0854" hs_bindgen_abdd0c6dd73d0854_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo1@
+hs_bindgen_abdd0c6dd73d0854 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_abdd0c6dd73d0854 =
+  fmap BG.fromFFIType hs_bindgen_abdd0c6dd73d0854_base
+
+{-# NOINLINE foo1 #-}
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @comprehensive\/smoke.h 10:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo1 :: BG.FunPtr (IO ())
+foo1 = BG.unsafePerformIO hs_bindgen_abdd0c6dd73d0854
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo2@
+foreign import ccall unsafe "hs_bindgen_95f5e8dc2a878cd6" hs_bindgen_95f5e8dc2a878cd6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo2@
+hs_bindgen_95f5e8dc2a878cd6 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_95f5e8dc2a878cd6 =
+  fmap BG.fromFFIType hs_bindgen_95f5e8dc2a878cd6_base
+
+{-# NOINLINE foo2 #-}
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @comprehensive\/smoke.h 11:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo2 :: BG.FunPtr (BG.CInt -> IO ())
+foo2 = BG.unsafePerformIO hs_bindgen_95f5e8dc2a878cd6
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo3@
+foreign import ccall unsafe "hs_bindgen_9970868a81b829db" hs_bindgen_9970868a81b829db_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo3@
+hs_bindgen_9970868a81b829db :: IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO ()))
+hs_bindgen_9970868a81b829db =
+  fmap BG.fromFFIType hs_bindgen_9970868a81b829db_base
+
+{-# NOINLINE foo3 #-}
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @comprehensive\/smoke.h 12:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo3 :: BG.FunPtr (BG.CInt -> BG.CInt -> IO ())
+foo3 = BG.unsafePerformIO hs_bindgen_9970868a81b829db
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo4@
+foreign import ccall unsafe "hs_bindgen_c2fb72f24a5149fb" hs_bindgen_c2fb72f24a5149fb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo4@
+hs_bindgen_c2fb72f24a5149fb :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_c2fb72f24a5149fb =
+  fmap BG.fromFFIType hs_bindgen_c2fb72f24a5149fb_base
+
+{-# NOINLINE foo4 #-}
+{-| __C declaration:__ @foo4@
+
+    __defined at:__ @comprehensive\/smoke.h 13:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo4 :: BG.FunPtr (IO BG.CInt)
+foo4 = BG.unsafePerformIO hs_bindgen_c2fb72f24a5149fb
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo5@
+foreign import ccall unsafe "hs_bindgen_3d952ee4c4ee378f" hs_bindgen_3d952ee4c4ee378f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo5@
+hs_bindgen_3d952ee4c4ee378f :: IO (BG.FunPtr (BG.CInt -> IO BG.CChar))
+hs_bindgen_3d952ee4c4ee378f =
+  fmap BG.fromFFIType hs_bindgen_3d952ee4c4ee378f_base
+
+{-# NOINLINE foo5 #-}
+{-| __C declaration:__ @foo5@
+
+    __defined at:__ @comprehensive\/smoke.h 14:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo5 :: BG.FunPtr (BG.CInt -> IO BG.CChar)
+foo5 = BG.unsafePerformIO hs_bindgen_3d952ee4c4ee378f
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo6@
+foreign import ccall unsafe "hs_bindgen_478897bd7cf090b7" hs_bindgen_478897bd7cf090b7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo6@
+hs_bindgen_478897bd7cf090b7 :: IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_478897bd7cf090b7 =
+  fmap BG.fromFFIType hs_bindgen_478897bd7cf090b7_base
+
+{-# NOINLINE foo6 #-}
+{-| __C declaration:__ @foo6@
+
+    __defined at:__ @comprehensive\/smoke.h 15:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo6 :: BG.FunPtr (BG.CInt -> BG.CInt -> IO (BG.Ptr BG.CChar))
+foo6 = BG.unsafePerformIO hs_bindgen_478897bd7cf090b7
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo7@
+foreign import ccall unsafe "hs_bindgen_2804b55bcc6495bd" hs_bindgen_2804b55bcc6495bd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo7@
+hs_bindgen_2804b55bcc6495bd :: IO (BG.FunPtr (BG.Ptr BG.CChar -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_2804b55bcc6495bd =
+  fmap BG.fromFFIType hs_bindgen_2804b55bcc6495bd_base
+
+{-# NOINLINE foo7 #-}
+{-| __C declaration:__ @foo7@
+
+    __defined at:__ @comprehensive\/smoke.h 16:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo7 :: BG.FunPtr (BG.Ptr BG.CChar -> IO (BG.Ptr BG.CChar))
+foo7 = BG.unsafePerformIO hs_bindgen_2804b55bcc6495bd
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo8@
+foreign import ccall unsafe "hs_bindgen_dc0ab953845109e0" hs_bindgen_dc0ab953845109e0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo8@
+hs_bindgen_dc0ab953845109e0 :: IO (BG.FunPtr (BG.Ptr BG.CChar -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_dc0ab953845109e0 =
+  fmap BG.fromFFIType hs_bindgen_dc0ab953845109e0_base
+
+{-# NOINLINE foo8 #-}
+{-| __C declaration:__ @foo8@
+
+    __defined at:__ @comprehensive\/smoke.h 17:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo8 :: BG.FunPtr (BG.Ptr BG.CChar -> IO (BG.Ptr BG.CChar))
+foo8 = BG.unsafePerformIO hs_bindgen_dc0ab953845109e0
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo9@
+foreign import ccall unsafe "hs_bindgen_6c6b48e80df5d80b" hs_bindgen_6c6b48e80df5d80b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo9@
+hs_bindgen_6c6b48e80df5d80b :: IO (BG.FunPtr (BG.FunPtr (IO (BG.Ptr BG.CChar)) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_6c6b48e80df5d80b =
+  fmap BG.fromFFIType hs_bindgen_6c6b48e80df5d80b_base
+
+{-# NOINLINE foo9 #-}
+{-| __C declaration:__ @foo9@
+
+    __defined at:__ @comprehensive\/smoke.h 18:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo9 :: BG.FunPtr (BG.FunPtr (IO (BG.Ptr BG.CChar)) -> IO (BG.Ptr BG.CChar))
+foo9 = BG.unsafePerformIO hs_bindgen_6c6b48e80df5d80b
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo10@
+foreign import ccall unsafe "hs_bindgen_fc0a56da1aa3e234" hs_bindgen_fc0a56da1aa3e234_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo10@
+hs_bindgen_fc0a56da1aa3e234 :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CChar)) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_fc0a56da1aa3e234 =
+  fmap BG.fromFFIType hs_bindgen_fc0a56da1aa3e234_base
+
+{-# NOINLINE foo10 #-}
+{-| __C declaration:__ @foo10@
+
+    __defined at:__ @comprehensive\/smoke.h 19:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo10 :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CChar)) -> IO (BG.Ptr BG.CChar))
+foo10 =
+  BG.unsafePerformIO hs_bindgen_fc0a56da1aa3e234
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo11@
+foreign import ccall unsafe "hs_bindgen_b882a6f77db6bd0e" hs_bindgen_b882a6f77db6bd0e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo11@
+hs_bindgen_b882a6f77db6bd0e :: IO (BG.FunPtr (BG.FunPtr (IO (BG.Ptr BG.Void)) -> IO (BG.Ptr BG.Void)))
+hs_bindgen_b882a6f77db6bd0e =
+  fmap BG.fromFFIType hs_bindgen_b882a6f77db6bd0e_base
+
+{-# NOINLINE foo11 #-}
+{-| __C declaration:__ @foo11@
+
+    __defined at:__ @comprehensive\/smoke.h 20:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo11 :: BG.FunPtr (BG.FunPtr (IO (BG.Ptr BG.Void)) -> IO (BG.Ptr BG.Void))
+foo11 =
+  BG.unsafePerformIO hs_bindgen_b882a6f77db6bd0e
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo12@
+foreign import ccall unsafe "hs_bindgen_c219c7d6d459a7e0" hs_bindgen_c219c7d6d459a7e0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo12@
+hs_bindgen_c219c7d6d459a7e0 :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void)) -> IO (BG.Ptr BG.Void)))
+hs_bindgen_c219c7d6d459a7e0 =
+  fmap BG.fromFFIType hs_bindgen_c219c7d6d459a7e0_base
+
+{-# NOINLINE foo12 #-}
+{-| __C declaration:__ @foo12@
+
+    __defined at:__ @comprehensive\/smoke.h 21:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo12 :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void)) -> IO (BG.Ptr BG.Void))
+foo12 =
+  BG.unsafePerformIO hs_bindgen_c219c7d6d459a7e0
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo13@
+foreign import ccall unsafe "hs_bindgen_caa14e75b1229a54" hs_bindgen_caa14e75b1229a54_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo13@
+hs_bindgen_caa14e75b1229a54 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar)) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_caa14e75b1229a54 =
+  fmap BG.fromFFIType hs_bindgen_caa14e75b1229a54_base
+
+{-# NOINLINE foo13 #-}
+{-| __C declaration:__ @foo13@
+
+    __defined at:__ @comprehensive\/smoke.h 22:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo13 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar)) -> IO (BG.Ptr BG.CChar))
+foo13 =
+  BG.unsafePerformIO hs_bindgen_caa14e75b1229a54
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo14@
+foreign import ccall unsafe "hs_bindgen_3cb093b66f7944d4" hs_bindgen_3cb093b66f7944d4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo14@
+hs_bindgen_3cb093b66f7944d4 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar)) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_3cb093b66f7944d4 =
+  fmap BG.fromFFIType hs_bindgen_3cb093b66f7944d4_base
+
+{-# NOINLINE foo14 #-}
+{-| __C declaration:__ @foo14@
+
+    __defined at:__ @comprehensive\/smoke.h 23:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo14 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar)) -> IO (BG.Ptr BG.CChar))
+foo14 =
+  BG.unsafePerformIO hs_bindgen_3cb093b66f7944d4
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo15@
+foreign import ccall unsafe "hs_bindgen_fe12aea8f26fdc44" hs_bindgen_fe12aea8f26fdc44_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo15@
+hs_bindgen_fe12aea8f26fdc44 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CChar)) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_fe12aea8f26fdc44 =
+  fmap BG.fromFFIType hs_bindgen_fe12aea8f26fdc44_base
+
+{-# NOINLINE foo15 #-}
+{-| __C declaration:__ @foo15@
+
+    __defined at:__ @comprehensive\/smoke.h 24:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo15 :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CChar)) -> IO (BG.Ptr BG.CChar))
+foo15 =
+  BG.unsafePerformIO hs_bindgen_fe12aea8f26fdc44
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo16@
+foreign import ccall unsafe "hs_bindgen_7682897a88740d24" hs_bindgen_7682897a88740d24_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo16@
+hs_bindgen_7682897a88740d24 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_7682897a88740d24 =
+  fmap BG.fromFFIType hs_bindgen_7682897a88740d24_base
+
+{-# NOINLINE foo16 #-}
+{-| __C declaration:__ @foo16@
+
+    __defined at:__ @comprehensive\/smoke.h 25:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo16 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CChar))
+foo16 =
+  BG.unsafePerformIO hs_bindgen_7682897a88740d24
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo17@
+foreign import ccall unsafe "hs_bindgen_a8ad868a6dc425f9" hs_bindgen_a8ad868a6dc425f9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo17@
+hs_bindgen_a8ad868a6dc425f9 :: IO (BG.FunPtr (BG.Ptr (BG.Ptr (BG.Ptr BG.CChar)) -> IO BG.CInt))
+hs_bindgen_a8ad868a6dc425f9 =
+  fmap BG.fromFFIType hs_bindgen_a8ad868a6dc425f9_base
+
+{-# NOINLINE foo17 #-}
+{-| __C declaration:__ @foo17@
+
+    __defined at:__ @comprehensive\/smoke.h 26:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo17 :: BG.FunPtr (BG.Ptr (BG.Ptr (BG.Ptr BG.CChar)) -> IO BG.CInt)
+foo17 =
+  BG.unsafePerformIO hs_bindgen_a8ad868a6dc425f9
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo18@
+foreign import ccall unsafe "hs_bindgen_245d12e0c60b976b" hs_bindgen_245d12e0c60b976b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo18@
+hs_bindgen_245d12e0c60b976b :: IO (BG.FunPtr (BG.CUInt -> IO BG.CInt))
+hs_bindgen_245d12e0c60b976b =
+  fmap BG.fromFFIType hs_bindgen_245d12e0c60b976b_base
+
+{-# NOINLINE foo18 #-}
+{-| __C declaration:__ @foo18@
+
+    __defined at:__ @comprehensive\/smoke.h 27:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo18 :: BG.FunPtr (BG.CUInt -> IO BG.CInt)
+foo18 =
+  BG.unsafePerformIO hs_bindgen_245d12e0c60b976b
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo19@
+foreign import ccall unsafe "hs_bindgen_81d64147225cc2ab" hs_bindgen_81d64147225cc2ab_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo19@
+hs_bindgen_81d64147225cc2ab :: IO (BG.FunPtr (BG.CUInt -> IO BG.CInt))
+hs_bindgen_81d64147225cc2ab =
+  fmap BG.fromFFIType hs_bindgen_81d64147225cc2ab_base
+
+{-# NOINLINE foo19 #-}
+{-| __C declaration:__ @foo19@
+
+    __defined at:__ @comprehensive\/smoke.h 28:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo19 :: BG.FunPtr (BG.CUInt -> IO BG.CInt)
+foo19 =
+  BG.unsafePerformIO hs_bindgen_81d64147225cc2ab
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo20@
+foreign import ccall unsafe "hs_bindgen_b9d12fbbd2c70f4f" hs_bindgen_b9d12fbbd2c70f4f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo20@
+hs_bindgen_b9d12fbbd2c70f4f :: IO (BG.FunPtr (Uint -> IO BG.CInt))
+hs_bindgen_b9d12fbbd2c70f4f =
+  fmap BG.fromFFIType hs_bindgen_b9d12fbbd2c70f4f_base
+
+{-# NOINLINE foo20 #-}
+{-| __C declaration:__ @foo20@
+
+    __defined at:__ @comprehensive\/smoke.h 29:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo20 :: BG.FunPtr (Uint -> IO BG.CInt)
+foo20 =
+  BG.unsafePerformIO hs_bindgen_b9d12fbbd2c70f4f
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo21@
+foreign import ccall unsafe "hs_bindgen_a3c85769041747ba" hs_bindgen_a3c85769041747ba_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo21@
+hs_bindgen_a3c85769041747ba :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO BG.CInt))
+hs_bindgen_a3c85769041747ba =
+  fmap BG.fromFFIType hs_bindgen_a3c85769041747ba_base
+
+{-# NOINLINE foo21 #-}
+{-| __C declaration:__ @foo21@
+
+    __defined at:__ @comprehensive\/smoke.h 30:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo21 :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO BG.CInt)
+foo21 =
+  BG.unsafePerformIO hs_bindgen_a3c85769041747ba
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo22@
+foreign import ccall unsafe "hs_bindgen_5fc122411b8a03ea" hs_bindgen_5fc122411b8a03ea_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo22@
+hs_bindgen_5fc122411b8a03ea :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt)) -> IO BG.CInt))
+hs_bindgen_5fc122411b8a03ea =
+  fmap BG.fromFFIType hs_bindgen_5fc122411b8a03ea_base
+
+{-# NOINLINE foo22 #-}
+{-| __C declaration:__ @foo22@
+
+    __defined at:__ @comprehensive\/smoke.h 31:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo22 :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt)) -> IO BG.CInt)
+foo22 =
+  BG.unsafePerformIO hs_bindgen_5fc122411b8a03ea
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo23@
+foreign import ccall unsafe "hs_bindgen_a7fcbb7f1b7f29cb" hs_bindgen_a7fcbb7f1b7f29cb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo23@
+hs_bindgen_a7fcbb7f1b7f29cb :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt))) -> IO BG.CInt))
+hs_bindgen_a7fcbb7f1b7f29cb =
+  fmap BG.fromFFIType hs_bindgen_a7fcbb7f1b7f29cb_base
+
+{-# NOINLINE foo23 #-}
+{-| __C declaration:__ @foo23@
+
+    __defined at:__ @comprehensive\/smoke.h 32:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo23 :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt))) -> IO BG.CInt)
+foo23 =
+  BG.unsafePerformIO hs_bindgen_a7fcbb7f1b7f29cb
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo24@
+foreign import ccall unsafe "hs_bindgen_9c5a2b0e6d53b7c9" hs_bindgen_9c5a2b0e6d53b7c9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo24@
+hs_bindgen_9c5a2b0e6d53b7c9 :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))) -> IO BG.CInt))
+hs_bindgen_9c5a2b0e6d53b7c9 =
+  fmap BG.fromFFIType hs_bindgen_9c5a2b0e6d53b7c9_base
+
+{-# NOINLINE foo24 #-}
+{-| __C declaration:__ @foo24@
+
+    __defined at:__ @comprehensive\/smoke.h 33:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo24 :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))) -> IO BG.CInt)
+foo24 =
+  BG.unsafePerformIO hs_bindgen_9c5a2b0e6d53b7c9
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo25@
+foreign import ccall unsafe "hs_bindgen_5b576a9269d86a85" hs_bindgen_5b576a9269d86a85_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo25@
+hs_bindgen_5b576a9269d86a85 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_5b576a9269d86a85 =
+  fmap BG.fromFFIType hs_bindgen_5b576a9269d86a85_base
+
+{-# NOINLINE foo25 #-}
+{-| __C declaration:__ @foo25@
+
+    __defined at:__ @comprehensive\/smoke.h 34:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo25 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+foo25 =
+  BG.unsafePerformIO hs_bindgen_5b576a9269d86a85
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo26@
+foreign import ccall unsafe "hs_bindgen_3d968f750d7c0963" hs_bindgen_3d968f750d7c0963_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo26@
+hs_bindgen_3d968f750d7c0963 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt))))
+hs_bindgen_3d968f750d7c0963 =
+  fmap BG.fromFFIType hs_bindgen_3d968f750d7c0963_base
+
+{-# NOINLINE foo26 #-}
+{-| __C declaration:__ @foo26@
+
+    __defined at:__ @comprehensive\/smoke.h 35:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo26 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+foo26 =
+  BG.unsafePerformIO hs_bindgen_3d968f750d7c0963
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo27@
+foreign import ccall unsafe "hs_bindgen_477d6debd15ec8cc" hs_bindgen_477d6debd15ec8cc_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo27@
+hs_bindgen_477d6debd15ec8cc :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))))
+hs_bindgen_477d6debd15ec8cc =
+  fmap BG.fromFFIType hs_bindgen_477d6debd15ec8cc_base
+
+{-# NOINLINE foo27 #-}
+{-| __C declaration:__ @foo27@
+
+    __defined at:__ @comprehensive\/smoke.h 36:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo27 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+foo27 =
+  BG.unsafePerformIO hs_bindgen_477d6debd15ec8cc
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo28@
+foreign import ccall unsafe "hs_bindgen_fe8d0bbb3e0e9949" hs_bindgen_fe8d0bbb3e0e9949_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo28@
+hs_bindgen_fe8d0bbb3e0e9949 :: IO (BG.FunPtr (Size_t -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))))
+hs_bindgen_fe8d0bbb3e0e9949 =
+  fmap BG.fromFFIType hs_bindgen_fe8d0bbb3e0e9949_base
+
+{-# NOINLINE foo28 #-}
+{-| __C declaration:__ @foo28@
+
+    __defined at:__ @comprehensive\/smoke.h 37:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo28 :: BG.FunPtr (Size_t -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+foo28 =
+  BG.unsafePerformIO hs_bindgen_fe8d0bbb3e0e9949
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_inline_foo@
+foreign import ccall unsafe "hs_bindgen_3e48bdcc0c25203c" hs_bindgen_3e48bdcc0c25203c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_inline_foo@
+hs_bindgen_3e48bdcc0c25203c :: IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> BG.CInt -> PtrConst.PtrConst BG.CInt -> BG.Ptr (PtrConst.PtrConst BG.CInt) -> PtrConst.PtrConst (PtrConst.PtrConst BG.CInt) -> Size_t -> IO BG.CInt))
+hs_bindgen_3e48bdcc0c25203c =
+  fmap BG.fromFFIType hs_bindgen_3e48bdcc0c25203c_base
+
+{-# NOINLINE inline_foo #-}
+{-| __C declaration:__ @inline_foo@
+
+    __defined at:__ @comprehensive\/smoke.h 80:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+inline_foo :: BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> BG.CInt -> PtrConst.PtrConst BG.CInt -> BG.Ptr (PtrConst.PtrConst BG.CInt) -> PtrConst.PtrConst (PtrConst.PtrConst BG.CInt) -> Size_t -> IO BG.CInt)
+inline_foo =
+  BG.unsafePerformIO hs_bindgen_3e48bdcc0c25203c
diff --git a/test-artefacts/fixtures/comprehensive/smoke/Example/Global.hs b/test-artefacts/fixtures/comprehensive/smoke/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/smoke/Example/Global.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.global
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <comprehensive/smoke.h>"
+  , "/* test_comprehensivesmoke_Example_get_global */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_dbeef9adb3c4fba3 (void)"
+  , "{"
+  , "  return &global;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_global@
+foreign import ccall unsafe "hs_bindgen_dbeef9adb3c4fba3" hs_bindgen_dbeef9adb3c4fba3_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_get_global@
+hs_bindgen_dbeef9adb3c4fba3 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_dbeef9adb3c4fba3 =
+  fmap BG.fromFFIType hs_bindgen_dbeef9adb3c4fba3_base
+
+{-# NOINLINE global #-}
+{-| __C declaration:__ @global@
+
+    __defined at:__ @comprehensive\/smoke.h 78:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+global :: BG.Ptr BG.CInt
+global =
+  BG.unsafePerformIO hs_bindgen_dbeef9adb3c4fba3
diff --git a/test-artefacts/fixtures/comprehensive/smoke/Example/Safe.hs b/test-artefacts/fixtures/comprehensive/smoke/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/smoke/Example/Safe.hs
@@ -0,0 +1,972 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo1
+    , Example.Safe.foo2
+    , Example.Safe.foo3
+    , Example.Safe.foo4
+    , Example.Safe.foo5
+    , Example.Safe.foo6
+    , Example.Safe.foo7
+    , Example.Safe.foo8
+    , Example.Safe.foo9
+    , Example.Safe.foo10
+    , Example.Safe.foo11
+    , Example.Safe.foo12
+    , Example.Safe.foo13
+    , Example.Safe.foo14
+    , Example.Safe.foo15
+    , Example.Safe.foo16
+    , Example.Safe.foo17
+    , Example.Safe.foo18
+    , Example.Safe.foo19
+    , Example.Safe.foo20
+    , Example.Safe.foo21
+    , Example.Safe.foo22
+    , Example.Safe.foo23
+    , Example.Safe.foo24
+    , Example.Safe.foo25
+    , Example.Safe.foo26
+    , Example.Safe.foo27
+    , Example.Safe.foo28
+    , Example.Safe.inline_foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <comprehensive/smoke.h>"
+  , "void hs_bindgen_2743241662e587e2 (void)"
+  , "{"
+  , "  (foo1)();"
+  , "}"
+  , "void hs_bindgen_ca1ea7ed39cf6882 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo2)(arg1);"
+  , "}"
+  , "void hs_bindgen_f0e8a93d6c4bd770 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (foo3)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_fce3101db708d25c (void)"
+  , "{"
+  , "  return (foo4)();"
+  , "}"
+  , "char hs_bindgen_65f052a80aab9141 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo5)(arg1);"
+  , "}"
+  , "char *hs_bindgen_558967a64195919a ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (foo6)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_1b78d9ead15e9f30 ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo7)(arg1);"
+  , "}"
+  , "char *hs_bindgen_e7b32da27b5f4414 ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo8)(arg1);"
+  , "}"
+  , "char *hs_bindgen_7f4cc2802608a581 ("
+  , "  char *(*arg1) (void)"
+  , ")"
+  , "{"
+  , "  return (foo9)(arg1);"
+  , "}"
+  , "char *hs_bindgen_9e03d7bc759724b3 ("
+  , "  char *(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo10)(arg1);"
+  , "}"
+  , "void *hs_bindgen_3ec0b6324e11cfb1 ("
+  , "  void *(*arg1) (void)"
+  , ")"
+  , "{"
+  , "  return (foo11)(arg1);"
+  , "}"
+  , "void *hs_bindgen_50dfd1970330be63 ("
+  , "  void *(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo12)(arg1);"
+  , "}"
+  , "char *hs_bindgen_6bee8b08c7819690 ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo13)(arg1);"
+  , "}"
+  , "char *hs_bindgen_a670ae425db6b59c ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo14)(arg1);"
+  , "}"
+  , "char *hs_bindgen_2422a51b7a32f594 ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo15)(arg1);"
+  , "}"
+  , "char *hs_bindgen_cd49431b0bacd0ce ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo16)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_fe100bb790f40421 ("
+  , "  char ***arg1"
+  , ")"
+  , "{"
+  , "  return (foo17)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_be2fdd261963c129 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (foo18)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f13f4f1384741d66 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (foo19)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_df4b5257915de35d ("
+  , "  uint arg1"
+  , ")"
+  , "{"
+  , "  return (foo20)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d938ee9ccc99950c ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo21)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_aad643346a33f55d ("
+  , "  signed int *(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo22)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_1d8acd1d1684de0c ("
+  , "  signed int **(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo23)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f754dbb729a16951 ("
+  , "  signed int ***(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo24)(arg1);"
+  , "}"
+  , "signed int *hs_bindgen_bc943db5b2865d6c ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo25)(arg1);"
+  , "}"
+  , "signed int **hs_bindgen_51dc51cb7017f47c ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo26)(arg1);"
+  , "}"
+  , "signed int ***hs_bindgen_f53824a6d084bf14 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo27)(arg1);"
+  , "}"
+  , "signed int ***hs_bindgen_bbc45bfae582ebaa ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return (foo28)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_258ded5549e4ed29 ("
+  , "  signed int arg1,"
+  , "  signed int *arg2,"
+  , "  signed int const arg3,"
+  , "  signed int const *arg4,"
+  , "  signed int const **arg5,"
+  , "  signed int const *const *arg6,"
+  , "  size_t arg7"
+  , ")"
+  , "{"
+  , "  return (inline_foo)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo1@
+foreign import ccall safe "hs_bindgen_2743241662e587e2" hs_bindgen_2743241662e587e2_base ::
+     IO ()
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo1@
+hs_bindgen_2743241662e587e2 :: IO ()
+hs_bindgen_2743241662e587e2 =
+  hs_bindgen_2743241662e587e2_base
+
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @comprehensive\/smoke.h 10:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo1 :: IO ()
+foo1 = hs_bindgen_2743241662e587e2
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo2@
+foreign import ccall safe "hs_bindgen_ca1ea7ed39cf6882" hs_bindgen_ca1ea7ed39cf6882_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo2@
+hs_bindgen_ca1ea7ed39cf6882 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_ca1ea7ed39cf6882 =
+  \x0 ->
+    hs_bindgen_ca1ea7ed39cf6882_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @comprehensive\/smoke.h 11:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo2 ::
+     BG.CInt
+  -> IO ()
+foo2 = hs_bindgen_ca1ea7ed39cf6882
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo3@
+foreign import ccall safe "hs_bindgen_f0e8a93d6c4bd770" hs_bindgen_f0e8a93d6c4bd770_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo3@
+hs_bindgen_f0e8a93d6c4bd770 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_f0e8a93d6c4bd770 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f0e8a93d6c4bd770_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @comprehensive\/smoke.h 12:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo3 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+foo3 = hs_bindgen_f0e8a93d6c4bd770
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo4@
+foreign import ccall safe "hs_bindgen_fce3101db708d25c" hs_bindgen_fce3101db708d25c_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo4@
+hs_bindgen_fce3101db708d25c :: IO BG.CInt
+hs_bindgen_fce3101db708d25c =
+  fmap BG.fromFFIType hs_bindgen_fce3101db708d25c_base
+
+{-| __C declaration:__ @foo4@
+
+    __defined at:__ @comprehensive\/smoke.h 13:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo4 :: IO BG.CInt
+foo4 = hs_bindgen_fce3101db708d25c
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo5@
+foreign import ccall safe "hs_bindgen_65f052a80aab9141" hs_bindgen_65f052a80aab9141_base ::
+     BG.CInt
+  -> IO BG.CChar
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo5@
+hs_bindgen_65f052a80aab9141 ::
+     BG.CInt
+  -> IO BG.CChar
+hs_bindgen_65f052a80aab9141 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_65f052a80aab9141_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo5@
+
+    __defined at:__ @comprehensive\/smoke.h 14:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo5 ::
+     BG.CInt
+  -> IO BG.CChar
+foo5 = hs_bindgen_65f052a80aab9141
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo6@
+foreign import ccall safe "hs_bindgen_558967a64195919a" hs_bindgen_558967a64195919a_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo6@
+hs_bindgen_558967a64195919a ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_558967a64195919a =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_558967a64195919a_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo6@
+
+    __defined at:__ @comprehensive\/smoke.h 15:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo6 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.CChar)
+foo6 = hs_bindgen_558967a64195919a
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo7@
+foreign import ccall safe "hs_bindgen_1b78d9ead15e9f30" hs_bindgen_1b78d9ead15e9f30_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo7@
+hs_bindgen_1b78d9ead15e9f30 ::
+     BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_1b78d9ead15e9f30 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1b78d9ead15e9f30_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo7@
+
+    __defined at:__ @comprehensive\/smoke.h 16:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo7 ::
+     BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+foo7 = hs_bindgen_1b78d9ead15e9f30
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo8@
+foreign import ccall safe "hs_bindgen_e7b32da27b5f4414" hs_bindgen_e7b32da27b5f4414_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo8@
+hs_bindgen_e7b32da27b5f4414 ::
+     BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_e7b32da27b5f4414 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e7b32da27b5f4414_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo8@
+
+    __defined at:__ @comprehensive\/smoke.h 17:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo8 ::
+     BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo8 = hs_bindgen_e7b32da27b5f4414
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo9@
+foreign import ccall safe "hs_bindgen_7f4cc2802608a581" hs_bindgen_7f4cc2802608a581_base ::
+     BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo9@
+hs_bindgen_7f4cc2802608a581 ::
+     BG.FunPtr (IO (BG.Ptr BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_7f4cc2802608a581 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7f4cc2802608a581_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo9@
+
+    __defined at:__ @comprehensive\/smoke.h 18:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo9 ::
+     BG.FunPtr (IO (BG.Ptr BG.CChar))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo9 = hs_bindgen_7f4cc2802608a581
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo10@
+foreign import ccall safe "hs_bindgen_9e03d7bc759724b3" hs_bindgen_9e03d7bc759724b3_base ::
+     BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo10@
+hs_bindgen_9e03d7bc759724b3 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_9e03d7bc759724b3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9e03d7bc759724b3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo10@
+
+    __defined at:__ @comprehensive\/smoke.h 19:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo10 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CChar))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo10 = hs_bindgen_9e03d7bc759724b3
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo11@
+foreign import ccall safe "hs_bindgen_3ec0b6324e11cfb1" hs_bindgen_3ec0b6324e11cfb1_base ::
+     BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo11@
+hs_bindgen_3ec0b6324e11cfb1 ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_3ec0b6324e11cfb1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3ec0b6324e11cfb1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo11@
+
+    __defined at:__ @comprehensive\/smoke.h 20:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo11 ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.Void)
+foo11 = hs_bindgen_3ec0b6324e11cfb1
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo12@
+foreign import ccall safe "hs_bindgen_50dfd1970330be63" hs_bindgen_50dfd1970330be63_base ::
+     BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo12@
+hs_bindgen_50dfd1970330be63 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_50dfd1970330be63 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_50dfd1970330be63_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo12@
+
+    __defined at:__ @comprehensive\/smoke.h 21:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo12 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.Void)
+foo12 = hs_bindgen_50dfd1970330be63
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo13@
+foreign import ccall safe "hs_bindgen_6bee8b08c7819690" hs_bindgen_6bee8b08c7819690_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo13@
+hs_bindgen_6bee8b08c7819690 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_6bee8b08c7819690 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6bee8b08c7819690_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo13@
+
+    __defined at:__ @comprehensive\/smoke.h 22:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo13 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+foo13 = hs_bindgen_6bee8b08c7819690
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo14@
+foreign import ccall safe "hs_bindgen_a670ae425db6b59c" hs_bindgen_a670ae425db6b59c_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo14@
+hs_bindgen_a670ae425db6b59c ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_a670ae425db6b59c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a670ae425db6b59c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo14@
+
+    __defined at:__ @comprehensive\/smoke.h 23:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo14 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo14 = hs_bindgen_a670ae425db6b59c
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo15@
+foreign import ccall safe "hs_bindgen_2422a51b7a32f594" hs_bindgen_2422a51b7a32f594_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo15@
+hs_bindgen_2422a51b7a32f594 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_2422a51b7a32f594 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2422a51b7a32f594_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo15@
+
+    __defined at:__ @comprehensive\/smoke.h 24:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo15 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CChar))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo15 = hs_bindgen_2422a51b7a32f594
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo16@
+foreign import ccall safe "hs_bindgen_cd49431b0bacd0ce" hs_bindgen_cd49431b0bacd0ce_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo16@
+hs_bindgen_cd49431b0bacd0ce ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_cd49431b0bacd0ce =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cd49431b0bacd0ce_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo16@
+
+    __defined at:__ @comprehensive\/smoke.h 25:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo16 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CChar)
+foo16 = hs_bindgen_cd49431b0bacd0ce
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo17@
+foreign import ccall safe "hs_bindgen_fe100bb790f40421" hs_bindgen_fe100bb790f40421_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo17@
+hs_bindgen_fe100bb790f40421 ::
+     BG.Ptr (BG.Ptr (BG.Ptr BG.CChar))
+  -> IO BG.CInt
+hs_bindgen_fe100bb790f40421 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fe100bb790f40421_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo17@
+
+    __defined at:__ @comprehensive\/smoke.h 26:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo17 ::
+     BG.Ptr (BG.Ptr (BG.Ptr BG.CChar))
+  -> IO BG.CInt
+foo17 = hs_bindgen_fe100bb790f40421
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo18@
+foreign import ccall safe "hs_bindgen_be2fdd261963c129" hs_bindgen_be2fdd261963c129_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo18@
+hs_bindgen_be2fdd261963c129 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_be2fdd261963c129 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_be2fdd261963c129_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo18@
+
+    __defined at:__ @comprehensive\/smoke.h 27:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo18 ::
+     BG.CUInt
+  -> IO BG.CInt
+foo18 = hs_bindgen_be2fdd261963c129
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo19@
+foreign import ccall safe "hs_bindgen_f13f4f1384741d66" hs_bindgen_f13f4f1384741d66_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo19@
+hs_bindgen_f13f4f1384741d66 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_f13f4f1384741d66 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f13f4f1384741d66_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo19@
+
+    __defined at:__ @comprehensive\/smoke.h 28:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo19 ::
+     BG.CUInt
+  -> IO BG.CInt
+foo19 = hs_bindgen_f13f4f1384741d66
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo20@
+foreign import ccall safe "hs_bindgen_df4b5257915de35d" hs_bindgen_df4b5257915de35d_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo20@
+hs_bindgen_df4b5257915de35d ::
+     Uint
+  -> IO BG.CInt
+hs_bindgen_df4b5257915de35d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_df4b5257915de35d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo20@
+
+    __defined at:__ @comprehensive\/smoke.h 29:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo20 ::
+     Uint
+  -> IO BG.CInt
+foo20 = hs_bindgen_df4b5257915de35d
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo21@
+foreign import ccall safe "hs_bindgen_d938ee9ccc99950c" hs_bindgen_d938ee9ccc99950c_base ::
+     BG.FunPtr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo21@
+hs_bindgen_d938ee9ccc99950c ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO BG.CInt
+hs_bindgen_d938ee9ccc99950c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d938ee9ccc99950c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo21@
+
+    __defined at:__ @comprehensive\/smoke.h 30:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo21 ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO BG.CInt
+foo21 = hs_bindgen_d938ee9ccc99950c
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo22@
+foreign import ccall safe "hs_bindgen_aad643346a33f55d" hs_bindgen_aad643346a33f55d_base ::
+     BG.FunPtr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo22@
+hs_bindgen_aad643346a33f55d ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_aad643346a33f55d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_aad643346a33f55d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo22@
+
+    __defined at:__ @comprehensive\/smoke.h 31:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo22 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+  -> IO BG.CInt
+foo22 = hs_bindgen_aad643346a33f55d
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo23@
+foreign import ccall safe "hs_bindgen_1d8acd1d1684de0c" hs_bindgen_1d8acd1d1684de0c_base ::
+     BG.FunPtr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo23@
+hs_bindgen_1d8acd1d1684de0c ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_1d8acd1d1684de0c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1d8acd1d1684de0c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo23@
+
+    __defined at:__ @comprehensive\/smoke.h 32:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo23 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+  -> IO BG.CInt
+foo23 = hs_bindgen_1d8acd1d1684de0c
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo24@
+foreign import ccall safe "hs_bindgen_f754dbb729a16951" hs_bindgen_f754dbb729a16951_base ::
+     BG.FunPtr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo24@
+hs_bindgen_f754dbb729a16951 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+  -> IO BG.CInt
+hs_bindgen_f754dbb729a16951 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f754dbb729a16951_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo24@
+
+    __defined at:__ @comprehensive\/smoke.h 33:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo24 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+  -> IO BG.CInt
+foo24 = hs_bindgen_f754dbb729a16951
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo25@
+foreign import ccall safe "hs_bindgen_bc943db5b2865d6c" hs_bindgen_bc943db5b2865d6c_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo25@
+hs_bindgen_bc943db5b2865d6c ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_bc943db5b2865d6c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bc943db5b2865d6c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo25@
+
+    __defined at:__ @comprehensive\/smoke.h 34:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo25 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+foo25 = hs_bindgen_bc943db5b2865d6c
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo26@
+foreign import ccall safe "hs_bindgen_51dc51cb7017f47c" hs_bindgen_51dc51cb7017f47c_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo26@
+hs_bindgen_51dc51cb7017f47c ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_51dc51cb7017f47c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_51dc51cb7017f47c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo26@
+
+    __defined at:__ @comprehensive\/smoke.h 35:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo26 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+foo26 = hs_bindgen_51dc51cb7017f47c
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo27@
+foreign import ccall safe "hs_bindgen_f53824a6d084bf14" hs_bindgen_f53824a6d084bf14_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo27@
+hs_bindgen_f53824a6d084bf14 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+hs_bindgen_f53824a6d084bf14 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f53824a6d084bf14_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo27@
+
+    __defined at:__ @comprehensive\/smoke.h 36:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo27 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+foo27 = hs_bindgen_f53824a6d084bf14
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo28@
+foreign import ccall safe "hs_bindgen_bbc45bfae582ebaa" hs_bindgen_bbc45bfae582ebaa_base ::
+     BG.CULong
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo28@
+hs_bindgen_bbc45bfae582ebaa ::
+     Size_t
+  -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+hs_bindgen_bbc45bfae582ebaa =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bbc45bfae582ebaa_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo28@
+
+    __defined at:__ @comprehensive\/smoke.h 37:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo28 ::
+     Size_t
+  -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+foo28 = hs_bindgen_bbc45bfae582ebaa
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_inline_foo@
+foreign import ccall safe "hs_bindgen_258ded5549e4ed29" hs_bindgen_258ded5549e4ed29_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_inline_foo@
+hs_bindgen_258ded5549e4ed29 ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> BG.Ptr (PtrConst.PtrConst BG.CInt)
+  -> PtrConst.PtrConst (PtrConst.PtrConst BG.CInt)
+  -> Size_t
+  -> IO BG.CInt
+hs_bindgen_258ded5549e4ed29 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_258ded5549e4ed29_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @inline_foo@
+
+    __defined at:__ @comprehensive\/smoke.h 80:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+inline_foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @b@
+  -> BG.CInt
+     -- ^ __C declaration:__ @c@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @d@
+  -> BG.Ptr (PtrConst.PtrConst BG.CInt)
+     -- ^ __C declaration:__ @e@
+  -> PtrConst.PtrConst (PtrConst.PtrConst BG.CInt)
+     -- ^ __C declaration:__ @f@
+  -> Size_t
+     -- ^ __C declaration:__ @g@
+  -> IO BG.CInt
+inline_foo = hs_bindgen_258ded5549e4ed29
diff --git a/test-artefacts/fixtures/comprehensive/smoke/Example/Unsafe.hs b/test-artefacts/fixtures/comprehensive/smoke/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/smoke/Example/Unsafe.hs
@@ -0,0 +1,972 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo1
+    , Example.Unsafe.foo2
+    , Example.Unsafe.foo3
+    , Example.Unsafe.foo4
+    , Example.Unsafe.foo5
+    , Example.Unsafe.foo6
+    , Example.Unsafe.foo7
+    , Example.Unsafe.foo8
+    , Example.Unsafe.foo9
+    , Example.Unsafe.foo10
+    , Example.Unsafe.foo11
+    , Example.Unsafe.foo12
+    , Example.Unsafe.foo13
+    , Example.Unsafe.foo14
+    , Example.Unsafe.foo15
+    , Example.Unsafe.foo16
+    , Example.Unsafe.foo17
+    , Example.Unsafe.foo18
+    , Example.Unsafe.foo19
+    , Example.Unsafe.foo20
+    , Example.Unsafe.foo21
+    , Example.Unsafe.foo22
+    , Example.Unsafe.foo23
+    , Example.Unsafe.foo24
+    , Example.Unsafe.foo25
+    , Example.Unsafe.foo26
+    , Example.Unsafe.foo27
+    , Example.Unsafe.foo28
+    , Example.Unsafe.inline_foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <comprehensive/smoke.h>"
+  , "void hs_bindgen_c3403d27760c03de (void)"
+  , "{"
+  , "  (foo1)();"
+  , "}"
+  , "void hs_bindgen_4be46c6638f43029 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo2)(arg1);"
+  , "}"
+  , "void hs_bindgen_e8661399efa3c25e ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (foo3)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_f7977cfca2b865a1 (void)"
+  , "{"
+  , "  return (foo4)();"
+  , "}"
+  , "char hs_bindgen_bedb91b426f6e8db ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo5)(arg1);"
+  , "}"
+  , "char *hs_bindgen_2b7a0c438c9bf357 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (foo6)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_463e49e39aad627b ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo7)(arg1);"
+  , "}"
+  , "char *hs_bindgen_70751b3802485c4e ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo8)(arg1);"
+  , "}"
+  , "char *hs_bindgen_7cda1a20c5ed8c7a ("
+  , "  char *(*arg1) (void)"
+  , ")"
+  , "{"
+  , "  return (foo9)(arg1);"
+  , "}"
+  , "char *hs_bindgen_25ddc364c2fbc486 ("
+  , "  char *(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo10)(arg1);"
+  , "}"
+  , "void *hs_bindgen_59d6c7b752cf0d2c ("
+  , "  void *(*arg1) (void)"
+  , ")"
+  , "{"
+  , "  return (foo11)(arg1);"
+  , "}"
+  , "void *hs_bindgen_6f61d879de93f509 ("
+  , "  void *(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo12)(arg1);"
+  , "}"
+  , "char *hs_bindgen_325eccfd4464f38f ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo13)(arg1);"
+  , "}"
+  , "char *hs_bindgen_e6168413cff5674e ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo14)(arg1);"
+  , "}"
+  , "char *hs_bindgen_0ea84b195eb56e51 ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (foo15)(arg1);"
+  , "}"
+  , "char *hs_bindgen_46c499f7b2f29dbb ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo16)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_7d34cd671fa1d8c9 ("
+  , "  char ***arg1"
+  , ")"
+  , "{"
+  , "  return (foo17)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_68092727aed54767 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (foo18)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_16ecb628ad8bc943 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (foo19)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_137b6b359edafeb7 ("
+  , "  uint arg1"
+  , ")"
+  , "{"
+  , "  return (foo20)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_30ddc0dce4dbba94 ("
+  , "  signed int (*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo21)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_27c8fe28c4787aef ("
+  , "  signed int *(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo22)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b88d57f2bfe36cf8 ("
+  , "  signed int **(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo23)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_257c8c4361081ed9 ("
+  , "  signed int ***(*arg1) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo24)(arg1);"
+  , "}"
+  , "signed int *hs_bindgen_401c9920eb162e99 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo25)(arg1);"
+  , "}"
+  , "signed int **hs_bindgen_bf36517f6f9412b1 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo26)(arg1);"
+  , "}"
+  , "signed int ***hs_bindgen_6727bd704a28f329 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (foo27)(arg1);"
+  , "}"
+  , "signed int ***hs_bindgen_c5bd28320c79f368 ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return (foo28)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4b6dbdd1ba04d213 ("
+  , "  signed int arg1,"
+  , "  signed int *arg2,"
+  , "  signed int const arg3,"
+  , "  signed int const *arg4,"
+  , "  signed int const **arg5,"
+  , "  signed int const *const *arg6,"
+  , "  size_t arg7"
+  , ")"
+  , "{"
+  , "  return (inline_foo)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo1@
+foreign import ccall unsafe "hs_bindgen_c3403d27760c03de" hs_bindgen_c3403d27760c03de_base ::
+     IO ()
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo1@
+hs_bindgen_c3403d27760c03de :: IO ()
+hs_bindgen_c3403d27760c03de =
+  hs_bindgen_c3403d27760c03de_base
+
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @comprehensive\/smoke.h 10:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo1 :: IO ()
+foo1 = hs_bindgen_c3403d27760c03de
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo2@
+foreign import ccall unsafe "hs_bindgen_4be46c6638f43029" hs_bindgen_4be46c6638f43029_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo2@
+hs_bindgen_4be46c6638f43029 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_4be46c6638f43029 =
+  \x0 ->
+    hs_bindgen_4be46c6638f43029_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @comprehensive\/smoke.h 11:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo2 ::
+     BG.CInt
+  -> IO ()
+foo2 = hs_bindgen_4be46c6638f43029
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo3@
+foreign import ccall unsafe "hs_bindgen_e8661399efa3c25e" hs_bindgen_e8661399efa3c25e_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo3@
+hs_bindgen_e8661399efa3c25e ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_e8661399efa3c25e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e8661399efa3c25e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @comprehensive\/smoke.h 12:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo3 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+foo3 = hs_bindgen_e8661399efa3c25e
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo4@
+foreign import ccall unsafe "hs_bindgen_f7977cfca2b865a1" hs_bindgen_f7977cfca2b865a1_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo4@
+hs_bindgen_f7977cfca2b865a1 :: IO BG.CInt
+hs_bindgen_f7977cfca2b865a1 =
+  fmap BG.fromFFIType hs_bindgen_f7977cfca2b865a1_base
+
+{-| __C declaration:__ @foo4@
+
+    __defined at:__ @comprehensive\/smoke.h 13:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo4 :: IO BG.CInt
+foo4 = hs_bindgen_f7977cfca2b865a1
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo5@
+foreign import ccall unsafe "hs_bindgen_bedb91b426f6e8db" hs_bindgen_bedb91b426f6e8db_base ::
+     BG.CInt
+  -> IO BG.CChar
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo5@
+hs_bindgen_bedb91b426f6e8db ::
+     BG.CInt
+  -> IO BG.CChar
+hs_bindgen_bedb91b426f6e8db =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bedb91b426f6e8db_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo5@
+
+    __defined at:__ @comprehensive\/smoke.h 14:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo5 ::
+     BG.CInt
+  -> IO BG.CChar
+foo5 = hs_bindgen_bedb91b426f6e8db
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo6@
+foreign import ccall unsafe "hs_bindgen_2b7a0c438c9bf357" hs_bindgen_2b7a0c438c9bf357_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo6@
+hs_bindgen_2b7a0c438c9bf357 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_2b7a0c438c9bf357 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_2b7a0c438c9bf357_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo6@
+
+    __defined at:__ @comprehensive\/smoke.h 15:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo6 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.CChar)
+foo6 = hs_bindgen_2b7a0c438c9bf357
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo7@
+foreign import ccall unsafe "hs_bindgen_463e49e39aad627b" hs_bindgen_463e49e39aad627b_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo7@
+hs_bindgen_463e49e39aad627b ::
+     BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_463e49e39aad627b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_463e49e39aad627b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo7@
+
+    __defined at:__ @comprehensive\/smoke.h 16:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo7 ::
+     BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+foo7 = hs_bindgen_463e49e39aad627b
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo8@
+foreign import ccall unsafe "hs_bindgen_70751b3802485c4e" hs_bindgen_70751b3802485c4e_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo8@
+hs_bindgen_70751b3802485c4e ::
+     BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_70751b3802485c4e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_70751b3802485c4e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo8@
+
+    __defined at:__ @comprehensive\/smoke.h 17:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo8 ::
+     BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo8 = hs_bindgen_70751b3802485c4e
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo9@
+foreign import ccall unsafe "hs_bindgen_7cda1a20c5ed8c7a" hs_bindgen_7cda1a20c5ed8c7a_base ::
+     BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo9@
+hs_bindgen_7cda1a20c5ed8c7a ::
+     BG.FunPtr (IO (BG.Ptr BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_7cda1a20c5ed8c7a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7cda1a20c5ed8c7a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo9@
+
+    __defined at:__ @comprehensive\/smoke.h 18:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo9 ::
+     BG.FunPtr (IO (BG.Ptr BG.CChar))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo9 = hs_bindgen_7cda1a20c5ed8c7a
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo10@
+foreign import ccall unsafe "hs_bindgen_25ddc364c2fbc486" hs_bindgen_25ddc364c2fbc486_base ::
+     BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo10@
+hs_bindgen_25ddc364c2fbc486 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_25ddc364c2fbc486 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_25ddc364c2fbc486_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo10@
+
+    __defined at:__ @comprehensive\/smoke.h 19:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo10 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CChar))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo10 = hs_bindgen_25ddc364c2fbc486
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo11@
+foreign import ccall unsafe "hs_bindgen_59d6c7b752cf0d2c" hs_bindgen_59d6c7b752cf0d2c_base ::
+     BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo11@
+hs_bindgen_59d6c7b752cf0d2c ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_59d6c7b752cf0d2c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_59d6c7b752cf0d2c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo11@
+
+    __defined at:__ @comprehensive\/smoke.h 20:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo11 ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.Void)
+foo11 = hs_bindgen_59d6c7b752cf0d2c
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo12@
+foreign import ccall unsafe "hs_bindgen_6f61d879de93f509" hs_bindgen_6f61d879de93f509_base ::
+     BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo12@
+hs_bindgen_6f61d879de93f509 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_6f61d879de93f509 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6f61d879de93f509_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo12@
+
+    __defined at:__ @comprehensive\/smoke.h 21:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo12 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.Void)
+foo12 = hs_bindgen_6f61d879de93f509
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo13@
+foreign import ccall unsafe "hs_bindgen_325eccfd4464f38f" hs_bindgen_325eccfd4464f38f_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo13@
+hs_bindgen_325eccfd4464f38f ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_325eccfd4464f38f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_325eccfd4464f38f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo13@
+
+    __defined at:__ @comprehensive\/smoke.h 22:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo13 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+foo13 = hs_bindgen_325eccfd4464f38f
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo14@
+foreign import ccall unsafe "hs_bindgen_e6168413cff5674e" hs_bindgen_e6168413cff5674e_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo14@
+hs_bindgen_e6168413cff5674e ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_e6168413cff5674e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e6168413cff5674e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo14@
+
+    __defined at:__ @comprehensive\/smoke.h 23:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo14 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CChar))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo14 = hs_bindgen_e6168413cff5674e
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo15@
+foreign import ccall unsafe "hs_bindgen_0ea84b195eb56e51" hs_bindgen_0ea84b195eb56e51_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo15@
+hs_bindgen_0ea84b195eb56e51 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CChar))
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_0ea84b195eb56e51 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0ea84b195eb56e51_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo15@
+
+    __defined at:__ @comprehensive\/smoke.h 24:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo15 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CChar))
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Ptr BG.CChar)
+foo15 = hs_bindgen_0ea84b195eb56e51
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo16@
+foreign import ccall unsafe "hs_bindgen_46c499f7b2f29dbb" hs_bindgen_46c499f7b2f29dbb_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo16@
+hs_bindgen_46c499f7b2f29dbb ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_46c499f7b2f29dbb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_46c499f7b2f29dbb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo16@
+
+    __defined at:__ @comprehensive\/smoke.h 25:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo16 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CChar)
+foo16 = hs_bindgen_46c499f7b2f29dbb
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo17@
+foreign import ccall unsafe "hs_bindgen_7d34cd671fa1d8c9" hs_bindgen_7d34cd671fa1d8c9_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo17@
+hs_bindgen_7d34cd671fa1d8c9 ::
+     BG.Ptr (BG.Ptr (BG.Ptr BG.CChar))
+  -> IO BG.CInt
+hs_bindgen_7d34cd671fa1d8c9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7d34cd671fa1d8c9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo17@
+
+    __defined at:__ @comprehensive\/smoke.h 26:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo17 ::
+     BG.Ptr (BG.Ptr (BG.Ptr BG.CChar))
+  -> IO BG.CInt
+foo17 = hs_bindgen_7d34cd671fa1d8c9
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo18@
+foreign import ccall unsafe "hs_bindgen_68092727aed54767" hs_bindgen_68092727aed54767_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo18@
+hs_bindgen_68092727aed54767 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_68092727aed54767 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_68092727aed54767_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo18@
+
+    __defined at:__ @comprehensive\/smoke.h 27:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo18 ::
+     BG.CUInt
+  -> IO BG.CInt
+foo18 = hs_bindgen_68092727aed54767
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo19@
+foreign import ccall unsafe "hs_bindgen_16ecb628ad8bc943" hs_bindgen_16ecb628ad8bc943_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo19@
+hs_bindgen_16ecb628ad8bc943 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_16ecb628ad8bc943 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_16ecb628ad8bc943_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo19@
+
+    __defined at:__ @comprehensive\/smoke.h 28:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo19 ::
+     BG.CUInt
+  -> IO BG.CInt
+foo19 = hs_bindgen_16ecb628ad8bc943
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo20@
+foreign import ccall unsafe "hs_bindgen_137b6b359edafeb7" hs_bindgen_137b6b359edafeb7_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo20@
+hs_bindgen_137b6b359edafeb7 ::
+     Uint
+  -> IO BG.CInt
+hs_bindgen_137b6b359edafeb7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_137b6b359edafeb7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo20@
+
+    __defined at:__ @comprehensive\/smoke.h 29:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo20 ::
+     Uint
+  -> IO BG.CInt
+foo20 = hs_bindgen_137b6b359edafeb7
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo21@
+foreign import ccall unsafe "hs_bindgen_30ddc0dce4dbba94" hs_bindgen_30ddc0dce4dbba94_base ::
+     BG.FunPtr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo21@
+hs_bindgen_30ddc0dce4dbba94 ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO BG.CInt
+hs_bindgen_30ddc0dce4dbba94 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_30ddc0dce4dbba94_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo21@
+
+    __defined at:__ @comprehensive\/smoke.h 30:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo21 ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO BG.CInt
+foo21 = hs_bindgen_30ddc0dce4dbba94
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo22@
+foreign import ccall unsafe "hs_bindgen_27c8fe28c4787aef" hs_bindgen_27c8fe28c4787aef_base ::
+     BG.FunPtr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo22@
+hs_bindgen_27c8fe28c4787aef ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+  -> IO BG.CInt
+hs_bindgen_27c8fe28c4787aef =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_27c8fe28c4787aef_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo22@
+
+    __defined at:__ @comprehensive\/smoke.h 31:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo22 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+  -> IO BG.CInt
+foo22 = hs_bindgen_27c8fe28c4787aef
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo23@
+foreign import ccall unsafe "hs_bindgen_b88d57f2bfe36cf8" hs_bindgen_b88d57f2bfe36cf8_base ::
+     BG.FunPtr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo23@
+hs_bindgen_b88d57f2bfe36cf8 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+  -> IO BG.CInt
+hs_bindgen_b88d57f2bfe36cf8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b88d57f2bfe36cf8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo23@
+
+    __defined at:__ @comprehensive\/smoke.h 32:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo23 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+  -> IO BG.CInt
+foo23 = hs_bindgen_b88d57f2bfe36cf8
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo24@
+foreign import ccall unsafe "hs_bindgen_257c8c4361081ed9" hs_bindgen_257c8c4361081ed9_base ::
+     BG.FunPtr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo24@
+hs_bindgen_257c8c4361081ed9 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+  -> IO BG.CInt
+hs_bindgen_257c8c4361081ed9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_257c8c4361081ed9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo24@
+
+    __defined at:__ @comprehensive\/smoke.h 33:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo24 ::
+     BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))))
+  -> IO BG.CInt
+foo24 = hs_bindgen_257c8c4361081ed9
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo25@
+foreign import ccall unsafe "hs_bindgen_401c9920eb162e99" hs_bindgen_401c9920eb162e99_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo25@
+hs_bindgen_401c9920eb162e99 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_401c9920eb162e99 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_401c9920eb162e99_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo25@
+
+    __defined at:__ @comprehensive\/smoke.h 34:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo25 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+foo25 = hs_bindgen_401c9920eb162e99
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo26@
+foreign import ccall unsafe "hs_bindgen_bf36517f6f9412b1" hs_bindgen_bf36517f6f9412b1_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo26@
+hs_bindgen_bf36517f6f9412b1 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_bf36517f6f9412b1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bf36517f6f9412b1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo26@
+
+    __defined at:__ @comprehensive\/smoke.h 35:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo26 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+foo26 = hs_bindgen_bf36517f6f9412b1
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo27@
+foreign import ccall unsafe "hs_bindgen_6727bd704a28f329" hs_bindgen_6727bd704a28f329_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo27@
+hs_bindgen_6727bd704a28f329 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+hs_bindgen_6727bd704a28f329 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6727bd704a28f329_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo27@
+
+    __defined at:__ @comprehensive\/smoke.h 36:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo27 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+foo27 = hs_bindgen_6727bd704a28f329
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo28@
+foreign import ccall unsafe "hs_bindgen_c5bd28320c79f368" hs_bindgen_c5bd28320c79f368_base ::
+     BG.CULong
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo28@
+hs_bindgen_c5bd28320c79f368 ::
+     Size_t
+  -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+hs_bindgen_c5bd28320c79f368 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c5bd28320c79f368_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo28@
+
+    __defined at:__ @comprehensive\/smoke.h 37:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo28 ::
+     Size_t
+  -> IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+foo28 = hs_bindgen_c5bd28320c79f368
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_inline_foo@
+foreign import ccall unsafe "hs_bindgen_4b6dbdd1ba04d213" hs_bindgen_4b6dbdd1ba04d213_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_inline_foo@
+hs_bindgen_4b6dbdd1ba04d213 ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> BG.Ptr (PtrConst.PtrConst BG.CInt)
+  -> PtrConst.PtrConst (PtrConst.PtrConst BG.CInt)
+  -> Size_t
+  -> IO BG.CInt
+hs_bindgen_4b6dbdd1ba04d213 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            \x5 ->
+              \x6 ->
+                fmap BG.fromFFIType (hs_bindgen_4b6dbdd1ba04d213_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4) (BG.toFFIType x5) (BG.toFFIType x6))
+
+{-| __C declaration:__ @inline_foo@
+
+    __defined at:__ @comprehensive\/smoke.h 80:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+inline_foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @b@
+  -> BG.CInt
+     -- ^ __C declaration:__ @c@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @d@
+  -> BG.Ptr (PtrConst.PtrConst BG.CInt)
+     -- ^ __C declaration:__ @e@
+  -> PtrConst.PtrConst (PtrConst.PtrConst BG.CInt)
+     -- ^ __C declaration:__ @f@
+  -> Size_t
+     -- ^ __C declaration:__ @g@
+  -> IO BG.CInt
+inline_foo = hs_bindgen_4b6dbdd1ba04d213
diff --git a/test-artefacts/fixtures/comprehensive/smoke/bindingspec.yaml b/test-artefacts/fixtures/comprehensive/smoke/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/smoke/bindingspec.yaml
@@ -0,0 +1,261 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: comprehensive/smoke.h
+  cname: uint
+  hsname: Uint
+- headers: comprehensive/smoke.h
+  cname: size_t
+  hsname: Size_t
+- headers: comprehensive/smoke.h
+  cname: struct bar1_t
+  hsname: Bar1_t
+- headers: comprehensive/smoke.h
+  cname: struct bar2_t
+  hsname: Bar2_t
+- headers: comprehensive/smoke.h
+  cname: bar2_t
+  hsname: Bar2_t
+- headers: comprehensive/smoke.h
+  cname: struct bar3_t
+  hsname: Bar3_t
+- headers: comprehensive/smoke.h
+  cname: bar3_t
+  hsname: Bar3_t
+- headers: comprehensive/smoke.h
+  cname: enum baz2_t
+  hsname: Baz2_t
+  enum: open
+- headers: comprehensive/smoke.h
+  cname: baz2_t
+  hsname: Baz2_t
+- headers: comprehensive/smoke.h
+  cname: enum baz3_t
+  hsname: Baz3_t
+  enum: open
+- headers: comprehensive/smoke.h
+  cname: enum baz4_t
+  hsname: Baz4_t
+  enum: open
+- headers: comprehensive/smoke.h
+  cname: baz4_t
+  hsname: Baz4_t
+hstypes:
+- hsname: Bar1_t
+  representation:
+    record:
+      constructor: Bar1_t
+      fields:
+      - a
+      - b
+      - c
+      - d
+      - e
+      - f
+      - g
+      - h
+      - i
+      - j
+      - k
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar2_t
+  representation:
+    record:
+      constructor: Bar2_t
+      fields:
+      - a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar3_t
+  representation:
+    record:
+      constructor: Bar3_t
+      fields:
+      - a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Baz2_t
+  representation:
+    newtype:
+      constructor: Baz2_t
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Baz3_t
+  representation:
+    newtype:
+      constructor: Baz3_t
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Baz4_t
+  representation:
+    newtype:
+      constructor: Baz4_t
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Size_t
+  representation:
+    newtype:
+      constructor: Size_t
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CULong
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint
+  representation:
+    newtype:
+      constructor: Uint
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/comprehensive/smoke/th.txt b/test-artefacts/fixtures/comprehensive/smoke/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/comprehensive/smoke/th.txt
@@ -0,0 +1,3296 @@
+-- addDependentFile test-artefacts/headers/golden/comprehensive/smoke.h
+-- #include <comprehensive/smoke.h>
+-- void hs_bindgen_2743241662e587e2 (void)
+-- {
+--   (foo1)();
+-- }
+-- void hs_bindgen_ca1ea7ed39cf6882 (
+--   signed int arg1
+-- )
+-- {
+--   (foo2)(arg1);
+-- }
+-- void hs_bindgen_f0e8a93d6c4bd770 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (foo3)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_fce3101db708d25c (void)
+-- {
+--   return (foo4)();
+-- }
+-- char hs_bindgen_65f052a80aab9141 (
+--   signed int arg1
+-- )
+-- {
+--   return (foo5)(arg1);
+-- }
+-- char *hs_bindgen_558967a64195919a (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (foo6)(arg1, arg2);
+-- }
+-- char *hs_bindgen_1b78d9ead15e9f30 (
+--   char *arg1
+-- )
+-- {
+--   return (foo7)(arg1);
+-- }
+-- char *hs_bindgen_e7b32da27b5f4414 (
+--   char *arg1
+-- )
+-- {
+--   return (foo8)(arg1);
+-- }
+-- char *hs_bindgen_7f4cc2802608a581 (
+--   char *(*arg1) (void)
+-- )
+-- {
+--   return (foo9)(arg1);
+-- }
+-- char *hs_bindgen_9e03d7bc759724b3 (
+--   char *(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo10)(arg1);
+-- }
+-- void *hs_bindgen_3ec0b6324e11cfb1 (
+--   void *(*arg1) (void)
+-- )
+-- {
+--   return (foo11)(arg1);
+-- }
+-- void *hs_bindgen_50dfd1970330be63 (
+--   void *(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo12)(arg1);
+-- }
+-- char *hs_bindgen_6bee8b08c7819690 (
+--   char *arg1
+-- )
+-- {
+--   return (foo13)(arg1);
+-- }
+-- char *hs_bindgen_a670ae425db6b59c (
+--   char *arg1
+-- )
+-- {
+--   return (foo14)(arg1);
+-- }
+-- char *hs_bindgen_2422a51b7a32f594 (
+--   char *arg1
+-- )
+-- {
+--   return (foo15)(arg1);
+-- }
+-- char *hs_bindgen_cd49431b0bacd0ce (
+--   signed int arg1
+-- )
+-- {
+--   return (foo16)(arg1);
+-- }
+-- signed int hs_bindgen_fe100bb790f40421 (
+--   char ***arg1
+-- )
+-- {
+--   return (foo17)(arg1);
+-- }
+-- signed int hs_bindgen_be2fdd261963c129 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (foo18)(arg1);
+-- }
+-- signed int hs_bindgen_f13f4f1384741d66 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (foo19)(arg1);
+-- }
+-- signed int hs_bindgen_df4b5257915de35d (
+--   uint arg1
+-- )
+-- {
+--   return (foo20)(arg1);
+-- }
+-- signed int hs_bindgen_d938ee9ccc99950c (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo21)(arg1);
+-- }
+-- signed int hs_bindgen_aad643346a33f55d (
+--   signed int *(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo22)(arg1);
+-- }
+-- signed int hs_bindgen_1d8acd1d1684de0c (
+--   signed int **(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo23)(arg1);
+-- }
+-- signed int hs_bindgen_f754dbb729a16951 (
+--   signed int ***(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo24)(arg1);
+-- }
+-- signed int *hs_bindgen_bc943db5b2865d6c (
+--   signed int arg1
+-- )
+-- {
+--   return (foo25)(arg1);
+-- }
+-- signed int **hs_bindgen_51dc51cb7017f47c (
+--   signed int arg1
+-- )
+-- {
+--   return (foo26)(arg1);
+-- }
+-- signed int ***hs_bindgen_f53824a6d084bf14 (
+--   signed int arg1
+-- )
+-- {
+--   return (foo27)(arg1);
+-- }
+-- signed int ***hs_bindgen_bbc45bfae582ebaa (
+--   size_t arg1
+-- )
+-- {
+--   return (foo28)(arg1);
+-- }
+-- signed int hs_bindgen_258ded5549e4ed29 (
+--   signed int arg1,
+--   signed int *arg2,
+--   signed int const arg3,
+--   signed int const *arg4,
+--   signed int const **arg5,
+--   signed int const *const *arg6,
+--   size_t arg7
+-- )
+-- {
+--   return (inline_foo)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+-- }
+-- void hs_bindgen_c3403d27760c03de (void)
+-- {
+--   (foo1)();
+-- }
+-- void hs_bindgen_4be46c6638f43029 (
+--   signed int arg1
+-- )
+-- {
+--   (foo2)(arg1);
+-- }
+-- void hs_bindgen_e8661399efa3c25e (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (foo3)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_f7977cfca2b865a1 (void)
+-- {
+--   return (foo4)();
+-- }
+-- char hs_bindgen_bedb91b426f6e8db (
+--   signed int arg1
+-- )
+-- {
+--   return (foo5)(arg1);
+-- }
+-- char *hs_bindgen_2b7a0c438c9bf357 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (foo6)(arg1, arg2);
+-- }
+-- char *hs_bindgen_463e49e39aad627b (
+--   char *arg1
+-- )
+-- {
+--   return (foo7)(arg1);
+-- }
+-- char *hs_bindgen_70751b3802485c4e (
+--   char *arg1
+-- )
+-- {
+--   return (foo8)(arg1);
+-- }
+-- char *hs_bindgen_7cda1a20c5ed8c7a (
+--   char *(*arg1) (void)
+-- )
+-- {
+--   return (foo9)(arg1);
+-- }
+-- char *hs_bindgen_25ddc364c2fbc486 (
+--   char *(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo10)(arg1);
+-- }
+-- void *hs_bindgen_59d6c7b752cf0d2c (
+--   void *(*arg1) (void)
+-- )
+-- {
+--   return (foo11)(arg1);
+-- }
+-- void *hs_bindgen_6f61d879de93f509 (
+--   void *(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo12)(arg1);
+-- }
+-- char *hs_bindgen_325eccfd4464f38f (
+--   char *arg1
+-- )
+-- {
+--   return (foo13)(arg1);
+-- }
+-- char *hs_bindgen_e6168413cff5674e (
+--   char *arg1
+-- )
+-- {
+--   return (foo14)(arg1);
+-- }
+-- char *hs_bindgen_0ea84b195eb56e51 (
+--   char *arg1
+-- )
+-- {
+--   return (foo15)(arg1);
+-- }
+-- char *hs_bindgen_46c499f7b2f29dbb (
+--   signed int arg1
+-- )
+-- {
+--   return (foo16)(arg1);
+-- }
+-- signed int hs_bindgen_7d34cd671fa1d8c9 (
+--   char ***arg1
+-- )
+-- {
+--   return (foo17)(arg1);
+-- }
+-- signed int hs_bindgen_68092727aed54767 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (foo18)(arg1);
+-- }
+-- signed int hs_bindgen_16ecb628ad8bc943 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (foo19)(arg1);
+-- }
+-- signed int hs_bindgen_137b6b359edafeb7 (
+--   uint arg1
+-- )
+-- {
+--   return (foo20)(arg1);
+-- }
+-- signed int hs_bindgen_30ddc0dce4dbba94 (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo21)(arg1);
+-- }
+-- signed int hs_bindgen_27c8fe28c4787aef (
+--   signed int *(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo22)(arg1);
+-- }
+-- signed int hs_bindgen_b88d57f2bfe36cf8 (
+--   signed int **(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo23)(arg1);
+-- }
+-- signed int hs_bindgen_257c8c4361081ed9 (
+--   signed int ***(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo24)(arg1);
+-- }
+-- signed int *hs_bindgen_401c9920eb162e99 (
+--   signed int arg1
+-- )
+-- {
+--   return (foo25)(arg1);
+-- }
+-- signed int **hs_bindgen_bf36517f6f9412b1 (
+--   signed int arg1
+-- )
+-- {
+--   return (foo26)(arg1);
+-- }
+-- signed int ***hs_bindgen_6727bd704a28f329 (
+--   signed int arg1
+-- )
+-- {
+--   return (foo27)(arg1);
+-- }
+-- signed int ***hs_bindgen_c5bd28320c79f368 (
+--   size_t arg1
+-- )
+-- {
+--   return (foo28)(arg1);
+-- }
+-- signed int hs_bindgen_4b6dbdd1ba04d213 (
+--   signed int arg1,
+--   signed int *arg2,
+--   signed int const arg3,
+--   signed int const *arg4,
+--   signed int const **arg5,
+--   signed int const *const *arg6,
+--   size_t arg7
+-- )
+-- {
+--   return (inline_foo)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_abdd0c6dd73d0854 (void)) (void)
+-- {
+--   return &foo1;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_95f5e8dc2a878cd6 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo2;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9970868a81b829db (void)) (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &foo3;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo4 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_c2fb72f24a5149fb (void)) (void)
+-- {
+--   return &foo4;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo5 */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_3d952ee4c4ee378f (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo5;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo6 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_478897bd7cf090b7 (void)) (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &foo6;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo7 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_2804b55bcc6495bd (void)) (
+--   char *arg1
+-- )
+-- {
+--   return &foo7;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo8 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_dc0ab953845109e0 (void)) (
+--   char *arg1
+-- )
+-- {
+--   return &foo8;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo9 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_6c6b48e80df5d80b (void)) (
+--   char *(*arg1) (void)
+-- )
+-- {
+--   return &foo9;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo10 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_fc0a56da1aa3e234 (void)) (
+--   char *(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo10;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo11 */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_b882a6f77db6bd0e (void)) (
+--   void *(*arg1) (void)
+-- )
+-- {
+--   return &foo11;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo12 */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_c219c7d6d459a7e0 (void)) (
+--   void *(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo12;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo13 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_caa14e75b1229a54 (void)) (
+--   char *arg1
+-- )
+-- {
+--   return &foo13;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo14 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_3cb093b66f7944d4 (void)) (
+--   char *arg1
+-- )
+-- {
+--   return &foo14;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo15 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_fe12aea8f26fdc44 (void)) (
+--   char *arg1
+-- )
+-- {
+--   return &foo15;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo16 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_7682897a88740d24 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo16;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo17 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_a8ad868a6dc425f9 (void)) (
+--   char ***arg1
+-- )
+-- {
+--   return &foo17;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo18 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_245d12e0c60b976b (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &foo18;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo19 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_81d64147225cc2ab (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &foo19;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo20 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_b9d12fbbd2c70f4f (void)) (
+--   uint arg1
+-- )
+-- {
+--   return &foo20;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo21 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_a3c85769041747ba (void)) (
+--   signed int (*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo21;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo22 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_5fc122411b8a03ea (void)) (
+--   signed int *(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo22;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo23 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_a7fcbb7f1b7f29cb (void)) (
+--   signed int **(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo23;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo24 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_9c5a2b0e6d53b7c9 (void)) (
+--   signed int ***(*arg1) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo24;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo25 */
+-- __attribute__ ((const))
+-- signed int *(*hs_bindgen_5b576a9269d86a85 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo25;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo26 */
+-- __attribute__ ((const))
+-- signed int **(*hs_bindgen_3d968f750d7c0963 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo26;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo27 */
+-- __attribute__ ((const))
+-- signed int ***(*hs_bindgen_477d6debd15ec8cc (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo27;
+-- }
+-- /* test_comprehensivesmoke_Example_get_foo28 */
+-- __attribute__ ((const))
+-- signed int ***(*hs_bindgen_fe8d0bbb3e0e9949 (void)) (
+--   size_t arg1
+-- )
+-- {
+--   return &foo28;
+-- }
+-- /* test_comprehensivesmoke_Example_get_inline_foo */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_3e48bdcc0c25203c (void)) (
+--   signed int arg1,
+--   signed int *arg2,
+--   signed int const arg3,
+--   signed int const *arg4,
+--   signed int const **arg5,
+--   signed int const *const *arg6,
+--   size_t arg7
+-- )
+-- {
+--   return &inline_foo;
+-- }
+-- /* test_comprehensivesmoke_Example_get_global */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_dbeef9adb3c4fba3 (void)
+-- {
+--   return &global;
+-- }
+{-| __C declaration:__ @uint@
+
+    __defined at:__ @comprehensive\/smoke.h 7:22@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Uint
+    = Uint {unwrap :: CUInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUInt => HasField "unwrap" Uint ty
+    where hasField = \x_0 -> (\y_1 -> Uint{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty CUInt => HasField "unwrap" (Ptr Uint) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Uint "unwrap"
+    where type CFieldType Uint "unwrap" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @size_t@
+
+    __defined at:__ @comprehensive\/smoke.h 8:23@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Size_t
+    = Size_t {unwrap :: CULong}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CULong => HasField "unwrap" Size_t ty
+    where hasField = \x_0 -> (\y_1 -> Size_t{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty CULong => HasField "unwrap" (Ptr Size_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Size_t "unwrap"
+    where type CFieldType Size_t "unwrap" = CULong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct bar1_t@
+
+    __defined at:__ @comprehensive\/smoke.h 39:8@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+data Bar1_t
+    = Bar1_t {a :: (Ptr Void)
+              {- ^ __C declaration:__ @a@
+
+                   __defined at:__ @comprehensive\/smoke.h 40:11@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              b :: CInt
+              {- ^ __C declaration:__ @b@
+
+                   __defined at:__ @comprehensive\/smoke.h 41:11@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              c :: CChar
+              {- ^ __C declaration:__ @c@
+
+                   __defined at:__ @comprehensive\/smoke.h 42:11@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              d :: (Ptr CChar)
+              {- ^ __C declaration:__ @d@
+
+                   __defined at:__ @comprehensive\/smoke.h 43:11@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              e :: (FunPtr (IO (Ptr CChar)))
+              {- ^ __C declaration:__ @e@
+
+                   __defined at:__ @comprehensive\/smoke.h 44:13@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              f :: (FunPtr (Ptr Void -> IO ()))
+              {- ^ __C declaration:__ @f@
+
+                   __defined at:__ @comprehensive\/smoke.h 45:13@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              g :: (FunPtr (Ptr Void -> IO (Ptr CInt)))
+              {- ^ __C declaration:__ @g@
+
+                   __defined at:__ @comprehensive\/smoke.h 46:13@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              h :: (FunPtr (Ptr Void -> IO (Ptr (Ptr CInt))))
+              {- ^ __C declaration:__ @h@
+
+                   __defined at:__ @comprehensive\/smoke.h 47:13@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              i :: (FunPtr (Ptr Void -> IO (Ptr (Ptr (Ptr CInt)))))
+              {- ^ __C declaration:__ @i@
+
+                   __defined at:__ @comprehensive\/smoke.h 48:13@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              j :: (ConstantArray 2 CChar)
+              {- ^ __C declaration:__ @j@
+
+                   __defined at:__ @comprehensive\/smoke.h 49:11@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -},
+              k :: (Ptr Bar1_t)
+              {- ^ __C declaration:__ @k@
+
+                   __defined at:__ @comprehensive\/smoke.h 51:19@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar1_t
+    where staticSizeOf = \_ -> 80 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Bar1_t
+    where readRaw = \ptr_0 -> ((((((((((pure Bar1_t <*> readRaw (Proxy @"a") ptr_0) <*> readRaw (Proxy @"b") ptr_0) <*> readRaw (Proxy @"c") ptr_0) <*> readRaw (Proxy @"d") ptr_0) <*> readRaw (Proxy @"e") ptr_0) <*> readRaw (Proxy @"f") ptr_0) <*> readRaw (Proxy @"g") ptr_0) <*> readRaw (Proxy @"h") ptr_0) <*> readRaw (Proxy @"i") ptr_0) <*> readRaw (Proxy @"j") ptr_0) <*> readRaw (Proxy @"k") ptr_0
+instance WriteRaw Bar1_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar1_t a_2
+                                              b_3
+                                              c_4
+                                              d_5
+                                              e_6
+                                              f_7
+                                              g_8
+                                              h_9
+                                              i_10
+                                              j_11
+                                              k_12 -> writeRaw (Proxy @"a") ptr_0 a_2 >> (writeRaw (Proxy @"b") ptr_0 b_3 >> (writeRaw (Proxy @"c") ptr_0 c_4 >> (writeRaw (Proxy @"d") ptr_0 d_5 >> (writeRaw (Proxy @"e") ptr_0 e_6 >> (writeRaw (Proxy @"f") ptr_0 f_7 >> (writeRaw (Proxy @"g") ptr_0 g_8 >> (writeRaw (Proxy @"h") ptr_0 h_9 >> (writeRaw (Proxy @"i") ptr_0 i_10 >> (writeRaw (Proxy @"j") ptr_0 j_11 >> writeRaw (Proxy @"k") ptr_0 k_12)))))))))
+deriving via (EquivStorable Bar1_t) instance Storable Bar1_t
+deriving via (IsStructViaReadRaw Bar1_t) instance IsStruct Bar1_t
+instance (~) ty (Ptr Void) => HasField "a" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{a = y_1,
+                                             b = getField @"b" x_0,
+                                             c = getField @"c" x_0,
+                                             d = getField @"d" x_0,
+                                             e = getField @"e" x_0,
+                                             f = getField @"f" x_0,
+                                             g = getField @"g" x_0,
+                                             h = getField @"h" x_0,
+                                             i = getField @"i" x_0,
+                                             j = getField @"j" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"a" x_0)
+instance (~) ty (Ptr Void) => HasField "a" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField Bar1_t "a"
+    where type CFieldType Bar1_t "a" = Ptr Void
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "b" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{b = y_1,
+                                             a = getField @"a" x_0,
+                                             c = getField @"c" x_0,
+                                             d = getField @"d" x_0,
+                                             e = getField @"e" x_0,
+                                             f = getField @"f" x_0,
+                                             g = getField @"g" x_0,
+                                             h = getField @"h" x_0,
+                                             i = getField @"i" x_0,
+                                             j = getField @"j" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"b" x_0)
+instance (~) ty CInt => HasField "b" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"b")
+instance HasCField Bar1_t "b"
+    where type CFieldType Bar1_t "b" = CInt
+          offset# = \_ -> \_ -> 8
+instance (~) ty CChar => HasField "c" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{c = y_1,
+                                             a = getField @"a" x_0,
+                                             b = getField @"b" x_0,
+                                             d = getField @"d" x_0,
+                                             e = getField @"e" x_0,
+                                             f = getField @"f" x_0,
+                                             g = getField @"g" x_0,
+                                             h = getField @"h" x_0,
+                                             i = getField @"i" x_0,
+                                             j = getField @"j" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"c" x_0)
+instance (~) ty CChar => HasField "c" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"c")
+instance HasCField Bar1_t "c"
+    where type CFieldType Bar1_t "c" = CChar
+          offset# = \_ -> \_ -> 12
+instance (~) ty (Ptr CChar) => HasField "d" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{d = y_1,
+                                             a = getField @"a" x_0,
+                                             b = getField @"b" x_0,
+                                             c = getField @"c" x_0,
+                                             e = getField @"e" x_0,
+                                             f = getField @"f" x_0,
+                                             g = getField @"g" x_0,
+                                             h = getField @"h" x_0,
+                                             i = getField @"i" x_0,
+                                             j = getField @"j" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"d" x_0)
+instance (~) ty (Ptr CChar) => HasField "d" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"d")
+instance HasCField Bar1_t "d"
+    where type CFieldType Bar1_t "d" = Ptr CChar
+          offset# = \_ -> \_ -> 16
+instance (~) ty (FunPtr (IO (Ptr CChar))) => HasField "e" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{e = y_1,
+                                             a = getField @"a" x_0,
+                                             b = getField @"b" x_0,
+                                             c = getField @"c" x_0,
+                                             d = getField @"d" x_0,
+                                             f = getField @"f" x_0,
+                                             g = getField @"g" x_0,
+                                             h = getField @"h" x_0,
+                                             i = getField @"i" x_0,
+                                             j = getField @"j" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"e" x_0)
+instance (~) ty (FunPtr (IO (Ptr CChar))) =>
+         HasField "e" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"e")
+instance HasCField Bar1_t "e"
+    where type CFieldType Bar1_t "e" = FunPtr (IO (Ptr CChar))
+          offset# = \_ -> \_ -> 24
+instance (~) ty (FunPtr (Ptr Void -> IO ())) =>
+         HasField "f" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{f = y_1,
+                                             a = getField @"a" x_0,
+                                             b = getField @"b" x_0,
+                                             c = getField @"c" x_0,
+                                             d = getField @"d" x_0,
+                                             e = getField @"e" x_0,
+                                             g = getField @"g" x_0,
+                                             h = getField @"h" x_0,
+                                             i = getField @"i" x_0,
+                                             j = getField @"j" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"f" x_0)
+instance (~) ty (FunPtr (Ptr Void -> IO ())) =>
+         HasField "f" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"f")
+instance HasCField Bar1_t "f"
+    where type CFieldType Bar1_t "f" = FunPtr (Ptr Void -> IO ())
+          offset# = \_ -> \_ -> 32
+instance (~) ty (FunPtr (Ptr Void -> IO (Ptr CInt))) =>
+         HasField "g" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{g = y_1,
+                                             a = getField @"a" x_0,
+                                             b = getField @"b" x_0,
+                                             c = getField @"c" x_0,
+                                             d = getField @"d" x_0,
+                                             e = getField @"e" x_0,
+                                             f = getField @"f" x_0,
+                                             h = getField @"h" x_0,
+                                             i = getField @"i" x_0,
+                                             j = getField @"j" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"g" x_0)
+instance (~) ty (FunPtr (Ptr Void -> IO (Ptr CInt))) =>
+         HasField "g" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"g")
+instance HasCField Bar1_t "g"
+    where type CFieldType Bar1_t "g" = FunPtr (Ptr Void ->
+                                               IO (Ptr CInt))
+          offset# = \_ -> \_ -> 40
+instance (~) ty (FunPtr (Ptr Void -> IO (Ptr (Ptr CInt)))) =>
+         HasField "h" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{h = y_1,
+                                             a = getField @"a" x_0,
+                                             b = getField @"b" x_0,
+                                             c = getField @"c" x_0,
+                                             d = getField @"d" x_0,
+                                             e = getField @"e" x_0,
+                                             f = getField @"f" x_0,
+                                             g = getField @"g" x_0,
+                                             i = getField @"i" x_0,
+                                             j = getField @"j" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"h" x_0)
+instance (~) ty (FunPtr (Ptr Void -> IO (Ptr (Ptr CInt)))) =>
+         HasField "h" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"h")
+instance HasCField Bar1_t "h"
+    where type CFieldType Bar1_t "h" = FunPtr (Ptr Void ->
+                                               IO (Ptr (Ptr CInt)))
+          offset# = \_ -> \_ -> 48
+instance (~) ty (FunPtr (Ptr Void -> IO (Ptr (Ptr (Ptr CInt))))) =>
+         HasField "i" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{i = y_1,
+                                             a = getField @"a" x_0,
+                                             b = getField @"b" x_0,
+                                             c = getField @"c" x_0,
+                                             d = getField @"d" x_0,
+                                             e = getField @"e" x_0,
+                                             f = getField @"f" x_0,
+                                             g = getField @"g" x_0,
+                                             h = getField @"h" x_0,
+                                             j = getField @"j" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"i" x_0)
+instance (~) ty (FunPtr (Ptr Void -> IO (Ptr (Ptr (Ptr CInt))))) =>
+         HasField "i" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"i")
+instance HasCField Bar1_t "i"
+    where type CFieldType Bar1_t "i" = FunPtr (Ptr Void ->
+                                               IO (Ptr (Ptr (Ptr CInt))))
+          offset# = \_ -> \_ -> 56
+instance (~) ty (ConstantArray 2 CChar) => HasField "j" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{j = y_1,
+                                             a = getField @"a" x_0,
+                                             b = getField @"b" x_0,
+                                             c = getField @"c" x_0,
+                                             d = getField @"d" x_0,
+                                             e = getField @"e" x_0,
+                                             f = getField @"f" x_0,
+                                             g = getField @"g" x_0,
+                                             h = getField @"h" x_0,
+                                             i = getField @"i" x_0,
+                                             k = getField @"k" x_0},
+                              getField @"j" x_0)
+instance (~) ty (ConstantArray 2 CChar) =>
+         HasField "j" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"j")
+instance HasCField Bar1_t "j"
+    where type CFieldType Bar1_t "j" = ConstantArray 2 CChar
+          offset# = \_ -> \_ -> 64
+instance (~) ty (Ptr Bar1_t) => HasField "k" Bar1_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar1_t{k = y_1,
+                                             a = getField @"a" x_0,
+                                             b = getField @"b" x_0,
+                                             c = getField @"c" x_0,
+                                             d = getField @"d" x_0,
+                                             e = getField @"e" x_0,
+                                             f = getField @"f" x_0,
+                                             g = getField @"g" x_0,
+                                             h = getField @"h" x_0,
+                                             i = getField @"i" x_0,
+                                             j = getField @"j" x_0},
+                              getField @"k" x_0)
+instance (~) ty (Ptr Bar1_t) => HasField "k" (Ptr Bar1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"k")
+instance HasCField Bar1_t "k"
+    where type CFieldType Bar1_t "k" = Ptr Bar1_t
+          offset# = \_ -> \_ -> 72
+{-| __C declaration:__ @struct bar2_t@
+
+    __defined at:__ @comprehensive\/smoke.h 54:16@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+data Bar2_t
+    = Bar2_t {a :: CInt
+              {- ^ __C declaration:__ @a@
+
+                   __defined at:__ @comprehensive\/smoke.h 55:7@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar2_t
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bar2_t
+    where readRaw = \ptr_0 -> pure Bar2_t <*> readRaw (Proxy @"a") ptr_0
+instance WriteRaw Bar2_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar2_t a_2 -> writeRaw (Proxy @"a") ptr_0 a_2
+deriving via (EquivStorable Bar2_t) instance Storable Bar2_t
+deriving via (IsStructViaReadRaw Bar2_t) instance IsStruct Bar2_t
+instance (~) ty CInt => HasField "a" Bar2_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar2_t{a = y_1},
+                              getField @"a" x_0)
+instance (~) ty CInt => HasField "a" (Ptr Bar2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField Bar2_t "a"
+    where type CFieldType Bar2_t "a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct bar3_t@
+
+    __defined at:__ @comprehensive\/smoke.h 58:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+data Bar3_t
+    = Bar3_t {a :: CInt
+              {- ^ __C declaration:__ @a@
+
+                   __defined at:__ @comprehensive\/smoke.h 59:7@
+
+                   __exported by:__ @comprehensive\/smoke.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar3_t
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bar3_t
+    where readRaw = \ptr_0 -> pure Bar3_t <*> readRaw (Proxy @"a") ptr_0
+instance WriteRaw Bar3_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar3_t a_2 -> writeRaw (Proxy @"a") ptr_0 a_2
+deriving via (EquivStorable Bar3_t) instance Storable Bar3_t
+deriving via (IsStructViaReadRaw Bar3_t) instance IsStruct Bar3_t
+instance (~) ty CInt => HasField "a" Bar3_t ty
+    where hasField = \x_0 -> (\y_1 -> Bar3_t{a = y_1},
+                              getField @"a" x_0)
+instance (~) ty CInt => HasField "a" (Ptr Bar3_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField Bar3_t "a"
+    where type CFieldType Bar3_t "a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @BAZ1@
+
+    __defined at:__ @comprehensive\/smoke.h 62:1@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+pattern BAZ1 :: CUInt
+pattern BAZ1 = 1
+{-| __C declaration:__ @enum baz2_t@
+
+    __defined at:__ @comprehensive\/smoke.h 66:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Baz2_t
+    = Baz2_t {unwrap :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Baz2_t
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Baz2_t
+    where readRaw = \ptr_0 -> pure Baz2_t <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Baz2_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Baz2_t unwrap_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrap_2
+deriving via (EquivStorable Baz2_t) instance Storable Baz2_t
+deriving via CUInt instance Prim Baz2_t
+instance CEnum Baz2_t
+    where type CEnumZ Baz2_t = CUInt
+          toCEnum = Baz2_t
+          fromCEnum = getField @"unwrap"
+          declaredValues = \_ -> declaredValuesFromList [(1,
+                                                          singleton "BAZ2")]
+          showsUndeclared = showsWrappedUndeclared "Baz2_t"
+          readPrecUndeclared = readPrecWrappedUndeclared "Baz2_t"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Baz2_t
+    where minDeclaredValue = BAZ2
+          maxDeclaredValue = BAZ2
+instance Show Baz2_t
+    where showsPrec = shows
+instance Read Baz2_t
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrap" Baz2_t ty
+    where hasField = \x_0 -> (\y_1 -> Baz2_t{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty CUInt => HasField "unwrap" (Ptr Baz2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Baz2_t "unwrap"
+    where type CFieldType Baz2_t "unwrap" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @BAZ2@
+
+    __defined at:__ @comprehensive\/smoke.h 67:3@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+pattern BAZ2 :: Baz2_t
+pattern BAZ2 = Baz2_t 1
+{-| __C declaration:__ @enum baz3_t@
+
+    __defined at:__ @comprehensive\/smoke.h 70:6@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Baz3_t
+    = Baz3_t {unwrap :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Baz3_t
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Baz3_t
+    where readRaw = \ptr_0 -> pure Baz3_t <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Baz3_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Baz3_t unwrap_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrap_2
+deriving via (EquivStorable Baz3_t) instance Storable Baz3_t
+deriving via CUInt instance Prim Baz3_t
+instance CEnum Baz3_t
+    where type CEnumZ Baz3_t = CUInt
+          toCEnum = Baz3_t
+          fromCEnum = getField @"unwrap"
+          declaredValues = \_ -> declaredValuesFromList [(1,
+                                                          singleton "BAZ3")]
+          showsUndeclared = showsWrappedUndeclared "Baz3_t"
+          readPrecUndeclared = readPrecWrappedUndeclared "Baz3_t"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Baz3_t
+    where minDeclaredValue = BAZ3
+          maxDeclaredValue = BAZ3
+instance Show Baz3_t
+    where showsPrec = shows
+instance Read Baz3_t
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrap" Baz3_t ty
+    where hasField = \x_0 -> (\y_1 -> Baz3_t{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty CUInt => HasField "unwrap" (Ptr Baz3_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Baz3_t "unwrap"
+    where type CFieldType Baz3_t "unwrap" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @BAZ3@
+
+    __defined at:__ @comprehensive\/smoke.h 71:3@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+pattern BAZ3 :: Baz3_t
+pattern BAZ3 = Baz3_t 1
+{-| __C declaration:__ @enum baz4_t@
+
+    __defined at:__ @comprehensive\/smoke.h 74:14@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+newtype Baz4_t
+    = Baz4_t {unwrap :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Baz4_t
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Baz4_t
+    where readRaw = \ptr_0 -> pure Baz4_t <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Baz4_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Baz4_t unwrap_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrap_2
+deriving via (EquivStorable Baz4_t) instance Storable Baz4_t
+deriving via CUInt instance Prim Baz4_t
+instance CEnum Baz4_t
+    where type CEnumZ Baz4_t = CUInt
+          toCEnum = Baz4_t
+          fromCEnum = getField @"unwrap"
+          declaredValues = \_ -> declaredValuesFromList [(1,
+                                                          singleton "BAZ4")]
+          showsUndeclared = showsWrappedUndeclared "Baz4_t"
+          readPrecUndeclared = readPrecWrappedUndeclared "Baz4_t"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Baz4_t
+    where minDeclaredValue = BAZ4
+          maxDeclaredValue = BAZ4
+instance Show Baz4_t
+    where showsPrec = shows
+instance Read Baz4_t
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrap" Baz4_t ty
+    where hasField = \x_0 -> (\y_1 -> Baz4_t{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty CUInt => HasField "unwrap" (Ptr Baz4_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField Baz4_t "unwrap"
+    where type CFieldType Baz4_t "unwrap" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @BAZ4@
+
+    __defined at:__ @comprehensive\/smoke.h 75:3@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+pattern BAZ4 :: Baz4_t
+pattern BAZ4 = Baz4_t 1
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo1@
+foreign import ccall safe "hs_bindgen_2743241662e587e2" hs_bindgen_2743241662e587e2_base ::
+    IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo1@
+hs_bindgen_2743241662e587e2 :: IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo1@
+hs_bindgen_2743241662e587e2 = hs_bindgen_2743241662e587e2_base
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @comprehensive\/smoke.h 10:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo1_safe :: IO ()
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @comprehensive\/smoke.h 10:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo1_safe = hs_bindgen_2743241662e587e2
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo2@
+foreign import ccall safe "hs_bindgen_ca1ea7ed39cf6882" hs_bindgen_ca1ea7ed39cf6882_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo2@
+hs_bindgen_ca1ea7ed39cf6882 :: CInt -> IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo2@
+hs_bindgen_ca1ea7ed39cf6882 = \x_0 -> hs_bindgen_ca1ea7ed39cf6882_base (toFFIType x_0)
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @comprehensive\/smoke.h 11:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo2_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @comprehensive\/smoke.h 11:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo2_safe = hs_bindgen_ca1ea7ed39cf6882
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo3@
+foreign import ccall safe "hs_bindgen_f0e8a93d6c4bd770" hs_bindgen_f0e8a93d6c4bd770_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo3@
+hs_bindgen_f0e8a93d6c4bd770 :: CInt -> CInt -> IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo3@
+hs_bindgen_f0e8a93d6c4bd770 = \x_0 -> \x_1 -> hs_bindgen_f0e8a93d6c4bd770_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @comprehensive\/smoke.h 12:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo3_safe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @comprehensive\/smoke.h 12:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo3_safe = hs_bindgen_f0e8a93d6c4bd770
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo4@
+foreign import ccall safe "hs_bindgen_fce3101db708d25c" hs_bindgen_fce3101db708d25c_base ::
+    IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo4@
+hs_bindgen_fce3101db708d25c :: IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo4@
+hs_bindgen_fce3101db708d25c = fmap fromFFIType hs_bindgen_fce3101db708d25c_base
+{-| __C declaration:__ @foo4@
+
+    __defined at:__ @comprehensive\/smoke.h 13:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo4_safe :: IO CInt
+{-| __C declaration:__ @foo4@
+
+    __defined at:__ @comprehensive\/smoke.h 13:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo4_safe = hs_bindgen_fce3101db708d25c
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo5@
+foreign import ccall safe "hs_bindgen_65f052a80aab9141" hs_bindgen_65f052a80aab9141_base ::
+    CInt
+ -> IO CChar
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo5@
+hs_bindgen_65f052a80aab9141 :: CInt -> IO CChar
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo5@
+hs_bindgen_65f052a80aab9141 = \x_0 -> fmap fromFFIType (hs_bindgen_65f052a80aab9141_base (toFFIType x_0))
+{-| __C declaration:__ @foo5@
+
+    __defined at:__ @comprehensive\/smoke.h 14:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo5_safe :: CInt -> IO CChar
+{-| __C declaration:__ @foo5@
+
+    __defined at:__ @comprehensive\/smoke.h 14:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo5_safe = hs_bindgen_65f052a80aab9141
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo6@
+foreign import ccall safe "hs_bindgen_558967a64195919a" hs_bindgen_558967a64195919a_base ::
+    CInt
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo6@
+hs_bindgen_558967a64195919a :: CInt -> CInt -> IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo6@
+hs_bindgen_558967a64195919a = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_558967a64195919a_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo6@
+
+    __defined at:__ @comprehensive\/smoke.h 15:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo6_safe :: CInt -> CInt -> IO (Ptr CChar)
+{-| __C declaration:__ @foo6@
+
+    __defined at:__ @comprehensive\/smoke.h 15:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo6_safe = hs_bindgen_558967a64195919a
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo7@
+foreign import ccall safe "hs_bindgen_1b78d9ead15e9f30" hs_bindgen_1b78d9ead15e9f30_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo7@
+hs_bindgen_1b78d9ead15e9f30 :: Ptr CChar -> IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo7@
+hs_bindgen_1b78d9ead15e9f30 = \x_0 -> fmap fromFFIType (hs_bindgen_1b78d9ead15e9f30_base (toFFIType x_0))
+{-| __C declaration:__ @foo7@
+
+    __defined at:__ @comprehensive\/smoke.h 16:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo7_safe :: Ptr CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @foo7@
+
+    __defined at:__ @comprehensive\/smoke.h 16:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo7_safe = hs_bindgen_1b78d9ead15e9f30
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo8@
+foreign import ccall safe "hs_bindgen_e7b32da27b5f4414" hs_bindgen_e7b32da27b5f4414_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo8@
+hs_bindgen_e7b32da27b5f4414 :: Ptr CChar -> IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo8@
+hs_bindgen_e7b32da27b5f4414 = \x_0 -> fmap fromFFIType (hs_bindgen_e7b32da27b5f4414_base (toFFIType x_0))
+{-| __C declaration:__ @foo8@
+
+    __defined at:__ @comprehensive\/smoke.h 17:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo8_safe :: Ptr CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @foo8@
+
+    __defined at:__ @comprehensive\/smoke.h 17:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo8_safe = hs_bindgen_e7b32da27b5f4414
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo9@
+foreign import ccall safe "hs_bindgen_7f4cc2802608a581" hs_bindgen_7f4cc2802608a581_base ::
+    FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo9@
+hs_bindgen_7f4cc2802608a581 :: FunPtr (IO (Ptr CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo9@
+hs_bindgen_7f4cc2802608a581 = \x_0 -> fmap fromFFIType (hs_bindgen_7f4cc2802608a581_base (toFFIType x_0))
+{-| __C declaration:__ @foo9@
+
+    __defined at:__ @comprehensive\/smoke.h 18:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo9_safe :: FunPtr (IO (Ptr CChar)) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo9@
+
+    __defined at:__ @comprehensive\/smoke.h 18:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo9_safe = hs_bindgen_7f4cc2802608a581
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo10@
+foreign import ccall safe "hs_bindgen_9e03d7bc759724b3" hs_bindgen_9e03d7bc759724b3_base ::
+    FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo10@
+hs_bindgen_9e03d7bc759724b3 :: FunPtr (CInt -> IO (Ptr CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo10@
+hs_bindgen_9e03d7bc759724b3 = \x_0 -> fmap fromFFIType (hs_bindgen_9e03d7bc759724b3_base (toFFIType x_0))
+{-| __C declaration:__ @foo10@
+
+    __defined at:__ @comprehensive\/smoke.h 19:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo10_safe :: FunPtr (CInt -> IO (Ptr CChar)) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo10@
+
+    __defined at:__ @comprehensive\/smoke.h 19:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo10_safe = hs_bindgen_9e03d7bc759724b3
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo11@
+foreign import ccall safe "hs_bindgen_3ec0b6324e11cfb1" hs_bindgen_3ec0b6324e11cfb1_base ::
+    FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo11@
+hs_bindgen_3ec0b6324e11cfb1 :: FunPtr (IO (Ptr Void)) ->
+                               IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo11@
+hs_bindgen_3ec0b6324e11cfb1 = \x_0 -> fmap fromFFIType (hs_bindgen_3ec0b6324e11cfb1_base (toFFIType x_0))
+{-| __C declaration:__ @foo11@
+
+    __defined at:__ @comprehensive\/smoke.h 20:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo11_safe :: FunPtr (IO (Ptr Void)) -> IO (Ptr Void)
+{-| __C declaration:__ @foo11@
+
+    __defined at:__ @comprehensive\/smoke.h 20:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo11_safe = hs_bindgen_3ec0b6324e11cfb1
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo12@
+foreign import ccall safe "hs_bindgen_50dfd1970330be63" hs_bindgen_50dfd1970330be63_base ::
+    FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo12@
+hs_bindgen_50dfd1970330be63 :: FunPtr (CInt -> IO (Ptr Void)) ->
+                               IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo12@
+hs_bindgen_50dfd1970330be63 = \x_0 -> fmap fromFFIType (hs_bindgen_50dfd1970330be63_base (toFFIType x_0))
+{-| __C declaration:__ @foo12@
+
+    __defined at:__ @comprehensive\/smoke.h 21:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo12_safe :: FunPtr (CInt -> IO (Ptr Void)) -> IO (Ptr Void)
+{-| __C declaration:__ @foo12@
+
+    __defined at:__ @comprehensive\/smoke.h 21:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo12_safe = hs_bindgen_50dfd1970330be63
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo13@
+foreign import ccall safe "hs_bindgen_6bee8b08c7819690" hs_bindgen_6bee8b08c7819690_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo13@
+hs_bindgen_6bee8b08c7819690 :: Ptr (Elem (IncompleteArray CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo13@
+hs_bindgen_6bee8b08c7819690 = \x_0 -> fmap fromFFIType (hs_bindgen_6bee8b08c7819690_base (toFFIType x_0))
+{-| __C declaration:__ @foo13@
+
+    __defined at:__ @comprehensive\/smoke.h 22:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo13_safe :: Ptr (Elem (IncompleteArray CChar)) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo13@
+
+    __defined at:__ @comprehensive\/smoke.h 22:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo13_safe = hs_bindgen_6bee8b08c7819690
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo14@
+foreign import ccall safe "hs_bindgen_a670ae425db6b59c" hs_bindgen_a670ae425db6b59c_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo14@
+hs_bindgen_a670ae425db6b59c :: Ptr (Elem (IncompleteArray CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo14@
+hs_bindgen_a670ae425db6b59c = \x_0 -> fmap fromFFIType (hs_bindgen_a670ae425db6b59c_base (toFFIType x_0))
+{-| __C declaration:__ @foo14@
+
+    __defined at:__ @comprehensive\/smoke.h 23:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo14_safe :: Ptr (Elem (IncompleteArray CChar)) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo14@
+
+    __defined at:__ @comprehensive\/smoke.h 23:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo14_safe = hs_bindgen_a670ae425db6b59c
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo15@
+foreign import ccall safe "hs_bindgen_2422a51b7a32f594" hs_bindgen_2422a51b7a32f594_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo15@
+hs_bindgen_2422a51b7a32f594 :: Ptr (Elem (ConstantArray 5
+                                                        CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo15@
+hs_bindgen_2422a51b7a32f594 = \x_0 -> fmap fromFFIType (hs_bindgen_2422a51b7a32f594_base (toFFIType x_0))
+{-| __C declaration:__ @foo15@
+
+    __defined at:__ @comprehensive\/smoke.h 24:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo15_safe :: Ptr (Elem (ConstantArray 5 CChar)) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo15@
+
+    __defined at:__ @comprehensive\/smoke.h 24:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo15_safe = hs_bindgen_2422a51b7a32f594
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo16@
+foreign import ccall safe "hs_bindgen_cd49431b0bacd0ce" hs_bindgen_cd49431b0bacd0ce_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo16@
+hs_bindgen_cd49431b0bacd0ce :: CInt -> IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo16@
+hs_bindgen_cd49431b0bacd0ce = \x_0 -> fmap fromFFIType (hs_bindgen_cd49431b0bacd0ce_base (toFFIType x_0))
+{-| __C declaration:__ @foo16@
+
+    __defined at:__ @comprehensive\/smoke.h 25:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo16_safe :: CInt -> IO (Ptr CChar)
+{-| __C declaration:__ @foo16@
+
+    __defined at:__ @comprehensive\/smoke.h 25:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo16_safe = hs_bindgen_cd49431b0bacd0ce
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo17@
+foreign import ccall safe "hs_bindgen_fe100bb790f40421" hs_bindgen_fe100bb790f40421_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo17@
+hs_bindgen_fe100bb790f40421 :: Ptr (Ptr (Ptr CChar)) -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo17@
+hs_bindgen_fe100bb790f40421 = \x_0 -> fmap fromFFIType (hs_bindgen_fe100bb790f40421_base (toFFIType x_0))
+{-| __C declaration:__ @foo17@
+
+    __defined at:__ @comprehensive\/smoke.h 26:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo17_safe :: Ptr (Ptr (Ptr CChar)) -> IO CInt
+{-| __C declaration:__ @foo17@
+
+    __defined at:__ @comprehensive\/smoke.h 26:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo17_safe = hs_bindgen_fe100bb790f40421
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo18@
+foreign import ccall safe "hs_bindgen_be2fdd261963c129" hs_bindgen_be2fdd261963c129_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo18@
+hs_bindgen_be2fdd261963c129 :: CUInt -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo18@
+hs_bindgen_be2fdd261963c129 = \x_0 -> fmap fromFFIType (hs_bindgen_be2fdd261963c129_base (toFFIType x_0))
+{-| __C declaration:__ @foo18@
+
+    __defined at:__ @comprehensive\/smoke.h 27:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo18_safe :: CUInt -> IO CInt
+{-| __C declaration:__ @foo18@
+
+    __defined at:__ @comprehensive\/smoke.h 27:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo18_safe = hs_bindgen_be2fdd261963c129
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo19@
+foreign import ccall safe "hs_bindgen_f13f4f1384741d66" hs_bindgen_f13f4f1384741d66_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo19@
+hs_bindgen_f13f4f1384741d66 :: CUInt -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo19@
+hs_bindgen_f13f4f1384741d66 = \x_0 -> fmap fromFFIType (hs_bindgen_f13f4f1384741d66_base (toFFIType x_0))
+{-| __C declaration:__ @foo19@
+
+    __defined at:__ @comprehensive\/smoke.h 28:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo19_safe :: CUInt -> IO CInt
+{-| __C declaration:__ @foo19@
+
+    __defined at:__ @comprehensive\/smoke.h 28:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo19_safe = hs_bindgen_f13f4f1384741d66
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo20@
+foreign import ccall safe "hs_bindgen_df4b5257915de35d" hs_bindgen_df4b5257915de35d_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo20@
+hs_bindgen_df4b5257915de35d :: Uint -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo20@
+hs_bindgen_df4b5257915de35d = \x_0 -> fmap fromFFIType (hs_bindgen_df4b5257915de35d_base (toFFIType x_0))
+{-| __C declaration:__ @foo20@
+
+    __defined at:__ @comprehensive\/smoke.h 29:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo20_safe :: Uint -> IO CInt
+{-| __C declaration:__ @foo20@
+
+    __defined at:__ @comprehensive\/smoke.h 29:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo20_safe = hs_bindgen_df4b5257915de35d
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo21@
+foreign import ccall safe "hs_bindgen_d938ee9ccc99950c" hs_bindgen_d938ee9ccc99950c_base ::
+    FunPtr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo21@
+hs_bindgen_d938ee9ccc99950c :: FunPtr (CInt -> IO CInt) -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo21@
+hs_bindgen_d938ee9ccc99950c = \x_0 -> fmap fromFFIType (hs_bindgen_d938ee9ccc99950c_base (toFFIType x_0))
+{-| __C declaration:__ @foo21@
+
+    __defined at:__ @comprehensive\/smoke.h 30:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo21_safe :: FunPtr (CInt -> IO CInt) -> IO CInt
+{-| __C declaration:__ @foo21@
+
+    __defined at:__ @comprehensive\/smoke.h 30:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo21_safe = hs_bindgen_d938ee9ccc99950c
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo22@
+foreign import ccall safe "hs_bindgen_aad643346a33f55d" hs_bindgen_aad643346a33f55d_base ::
+    FunPtr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo22@
+hs_bindgen_aad643346a33f55d :: FunPtr (CInt -> IO (Ptr CInt)) ->
+                               IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo22@
+hs_bindgen_aad643346a33f55d = \x_0 -> fmap fromFFIType (hs_bindgen_aad643346a33f55d_base (toFFIType x_0))
+{-| __C declaration:__ @foo22@
+
+    __defined at:__ @comprehensive\/smoke.h 31:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo22_safe :: FunPtr (CInt -> IO (Ptr CInt)) -> IO CInt
+{-| __C declaration:__ @foo22@
+
+    __defined at:__ @comprehensive\/smoke.h 31:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo22_safe = hs_bindgen_aad643346a33f55d
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo23@
+foreign import ccall safe "hs_bindgen_1d8acd1d1684de0c" hs_bindgen_1d8acd1d1684de0c_base ::
+    FunPtr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo23@
+hs_bindgen_1d8acd1d1684de0c :: FunPtr (CInt ->
+                                       IO (Ptr (Ptr CInt))) ->
+                               IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo23@
+hs_bindgen_1d8acd1d1684de0c = \x_0 -> fmap fromFFIType (hs_bindgen_1d8acd1d1684de0c_base (toFFIType x_0))
+{-| __C declaration:__ @foo23@
+
+    __defined at:__ @comprehensive\/smoke.h 32:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo23_safe :: FunPtr (CInt -> IO (Ptr (Ptr CInt))) -> IO CInt
+{-| __C declaration:__ @foo23@
+
+    __defined at:__ @comprehensive\/smoke.h 32:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo23_safe = hs_bindgen_1d8acd1d1684de0c
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo24@
+foreign import ccall safe "hs_bindgen_f754dbb729a16951" hs_bindgen_f754dbb729a16951_base ::
+    FunPtr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo24@
+hs_bindgen_f754dbb729a16951 :: FunPtr (CInt ->
+                                       IO (Ptr (Ptr (Ptr CInt)))) ->
+                               IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo24@
+hs_bindgen_f754dbb729a16951 = \x_0 -> fmap fromFFIType (hs_bindgen_f754dbb729a16951_base (toFFIType x_0))
+{-| __C declaration:__ @foo24@
+
+    __defined at:__ @comprehensive\/smoke.h 33:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo24_safe :: FunPtr (CInt -> IO (Ptr (Ptr (Ptr CInt)))) -> IO CInt
+{-| __C declaration:__ @foo24@
+
+    __defined at:__ @comprehensive\/smoke.h 33:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo24_safe = hs_bindgen_f754dbb729a16951
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo25@
+foreign import ccall safe "hs_bindgen_bc943db5b2865d6c" hs_bindgen_bc943db5b2865d6c_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo25@
+hs_bindgen_bc943db5b2865d6c :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo25@
+hs_bindgen_bc943db5b2865d6c = \x_0 -> fmap fromFFIType (hs_bindgen_bc943db5b2865d6c_base (toFFIType x_0))
+{-| __C declaration:__ @foo25@
+
+    __defined at:__ @comprehensive\/smoke.h 34:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo25_safe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @foo25@
+
+    __defined at:__ @comprehensive\/smoke.h 34:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo25_safe = hs_bindgen_bc943db5b2865d6c
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo26@
+foreign import ccall safe "hs_bindgen_51dc51cb7017f47c" hs_bindgen_51dc51cb7017f47c_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo26@
+hs_bindgen_51dc51cb7017f47c :: CInt -> IO (Ptr (Ptr CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo26@
+hs_bindgen_51dc51cb7017f47c = \x_0 -> fmap fromFFIType (hs_bindgen_51dc51cb7017f47c_base (toFFIType x_0))
+{-| __C declaration:__ @foo26@
+
+    __defined at:__ @comprehensive\/smoke.h 35:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo26_safe :: CInt -> IO (Ptr (Ptr CInt))
+{-| __C declaration:__ @foo26@
+
+    __defined at:__ @comprehensive\/smoke.h 35:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo26_safe = hs_bindgen_51dc51cb7017f47c
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo27@
+foreign import ccall safe "hs_bindgen_f53824a6d084bf14" hs_bindgen_f53824a6d084bf14_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo27@
+hs_bindgen_f53824a6d084bf14 :: CInt -> IO (Ptr (Ptr (Ptr CInt)))
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo27@
+hs_bindgen_f53824a6d084bf14 = \x_0 -> fmap fromFFIType (hs_bindgen_f53824a6d084bf14_base (toFFIType x_0))
+{-| __C declaration:__ @foo27@
+
+    __defined at:__ @comprehensive\/smoke.h 36:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo27_safe :: CInt -> IO (Ptr (Ptr (Ptr CInt)))
+{-| __C declaration:__ @foo27@
+
+    __defined at:__ @comprehensive\/smoke.h 36:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo27_safe = hs_bindgen_f53824a6d084bf14
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo28@
+foreign import ccall safe "hs_bindgen_bbc45bfae582ebaa" hs_bindgen_bbc45bfae582ebaa_base ::
+    CULong
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo28@
+hs_bindgen_bbc45bfae582ebaa :: Size_t -> IO (Ptr (Ptr (Ptr CInt)))
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_foo28@
+hs_bindgen_bbc45bfae582ebaa = \x_0 -> fmap fromFFIType (hs_bindgen_bbc45bfae582ebaa_base (toFFIType x_0))
+{-| __C declaration:__ @foo28@
+
+    __defined at:__ @comprehensive\/smoke.h 37:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo28_safe :: Size_t -> IO (Ptr (Ptr (Ptr CInt)))
+{-| __C declaration:__ @foo28@
+
+    __defined at:__ @comprehensive\/smoke.h 37:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo28_safe = hs_bindgen_bbc45bfae582ebaa
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_inline_foo@
+foreign import ccall safe "hs_bindgen_258ded5549e4ed29" hs_bindgen_258ded5549e4ed29_base ::
+    CInt
+ -> Ptr Void
+ -> CInt
+ -> Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> CULong
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_inline_foo@
+hs_bindgen_258ded5549e4ed29 :: CInt ->
+                               Ptr CInt ->
+                               CInt ->
+                               PtrConst CInt ->
+                               Ptr (PtrConst CInt) ->
+                               PtrConst (PtrConst CInt) -> Size_t -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Safe_inline_foo@
+hs_bindgen_258ded5549e4ed29 = \x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> \x_5 -> \x_6 -> fmap fromFFIType (hs_bindgen_258ded5549e4ed29_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3) (toFFIType x_4) (toFFIType x_5) (toFFIType x_6))
+{-| __C declaration:__ @inline_foo@
+
+    __defined at:__ @comprehensive\/smoke.h 80:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+inline_foo_safe :: CInt ->
+                   Ptr CInt ->
+                   CInt ->
+                   PtrConst CInt ->
+                   Ptr (PtrConst CInt) ->
+                   PtrConst (PtrConst CInt) -> Size_t -> IO CInt
+{-| __C declaration:__ @inline_foo@
+
+    __defined at:__ @comprehensive\/smoke.h 80:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+inline_foo_safe = hs_bindgen_258ded5549e4ed29
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo1@
+foreign import ccall unsafe "hs_bindgen_c3403d27760c03de" hs_bindgen_c3403d27760c03de_base ::
+    IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo1@
+hs_bindgen_c3403d27760c03de :: IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo1@
+hs_bindgen_c3403d27760c03de = hs_bindgen_c3403d27760c03de_base
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @comprehensive\/smoke.h 10:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo1_unsafe :: IO ()
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @comprehensive\/smoke.h 10:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo1_unsafe = hs_bindgen_c3403d27760c03de
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo2@
+foreign import ccall unsafe "hs_bindgen_4be46c6638f43029" hs_bindgen_4be46c6638f43029_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo2@
+hs_bindgen_4be46c6638f43029 :: CInt -> IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo2@
+hs_bindgen_4be46c6638f43029 = \x_0 -> hs_bindgen_4be46c6638f43029_base (toFFIType x_0)
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @comprehensive\/smoke.h 11:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo2_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @comprehensive\/smoke.h 11:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo2_unsafe = hs_bindgen_4be46c6638f43029
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo3@
+foreign import ccall unsafe "hs_bindgen_e8661399efa3c25e" hs_bindgen_e8661399efa3c25e_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo3@
+hs_bindgen_e8661399efa3c25e :: CInt -> CInt -> IO ()
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo3@
+hs_bindgen_e8661399efa3c25e = \x_0 -> \x_1 -> hs_bindgen_e8661399efa3c25e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @comprehensive\/smoke.h 12:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo3_unsafe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @comprehensive\/smoke.h 12:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo3_unsafe = hs_bindgen_e8661399efa3c25e
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo4@
+foreign import ccall unsafe "hs_bindgen_f7977cfca2b865a1" hs_bindgen_f7977cfca2b865a1_base ::
+    IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo4@
+hs_bindgen_f7977cfca2b865a1 :: IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo4@
+hs_bindgen_f7977cfca2b865a1 = fmap fromFFIType hs_bindgen_f7977cfca2b865a1_base
+{-| __C declaration:__ @foo4@
+
+    __defined at:__ @comprehensive\/smoke.h 13:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo4_unsafe :: IO CInt
+{-| __C declaration:__ @foo4@
+
+    __defined at:__ @comprehensive\/smoke.h 13:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo4_unsafe = hs_bindgen_f7977cfca2b865a1
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo5@
+foreign import ccall unsafe "hs_bindgen_bedb91b426f6e8db" hs_bindgen_bedb91b426f6e8db_base ::
+    CInt
+ -> IO CChar
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo5@
+hs_bindgen_bedb91b426f6e8db :: CInt -> IO CChar
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo5@
+hs_bindgen_bedb91b426f6e8db = \x_0 -> fmap fromFFIType (hs_bindgen_bedb91b426f6e8db_base (toFFIType x_0))
+{-| __C declaration:__ @foo5@
+
+    __defined at:__ @comprehensive\/smoke.h 14:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo5_unsafe :: CInt -> IO CChar
+{-| __C declaration:__ @foo5@
+
+    __defined at:__ @comprehensive\/smoke.h 14:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo5_unsafe = hs_bindgen_bedb91b426f6e8db
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo6@
+foreign import ccall unsafe "hs_bindgen_2b7a0c438c9bf357" hs_bindgen_2b7a0c438c9bf357_base ::
+    CInt
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo6@
+hs_bindgen_2b7a0c438c9bf357 :: CInt -> CInt -> IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo6@
+hs_bindgen_2b7a0c438c9bf357 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_2b7a0c438c9bf357_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo6@
+
+    __defined at:__ @comprehensive\/smoke.h 15:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo6_unsafe :: CInt -> CInt -> IO (Ptr CChar)
+{-| __C declaration:__ @foo6@
+
+    __defined at:__ @comprehensive\/smoke.h 15:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo6_unsafe = hs_bindgen_2b7a0c438c9bf357
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo7@
+foreign import ccall unsafe "hs_bindgen_463e49e39aad627b" hs_bindgen_463e49e39aad627b_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo7@
+hs_bindgen_463e49e39aad627b :: Ptr CChar -> IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo7@
+hs_bindgen_463e49e39aad627b = \x_0 -> fmap fromFFIType (hs_bindgen_463e49e39aad627b_base (toFFIType x_0))
+{-| __C declaration:__ @foo7@
+
+    __defined at:__ @comprehensive\/smoke.h 16:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo7_unsafe :: Ptr CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @foo7@
+
+    __defined at:__ @comprehensive\/smoke.h 16:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo7_unsafe = hs_bindgen_463e49e39aad627b
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo8@
+foreign import ccall unsafe "hs_bindgen_70751b3802485c4e" hs_bindgen_70751b3802485c4e_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo8@
+hs_bindgen_70751b3802485c4e :: Ptr CChar -> IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo8@
+hs_bindgen_70751b3802485c4e = \x_0 -> fmap fromFFIType (hs_bindgen_70751b3802485c4e_base (toFFIType x_0))
+{-| __C declaration:__ @foo8@
+
+    __defined at:__ @comprehensive\/smoke.h 17:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo8_unsafe :: Ptr CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @foo8@
+
+    __defined at:__ @comprehensive\/smoke.h 17:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo8_unsafe = hs_bindgen_70751b3802485c4e
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo9@
+foreign import ccall unsafe "hs_bindgen_7cda1a20c5ed8c7a" hs_bindgen_7cda1a20c5ed8c7a_base ::
+    FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo9@
+hs_bindgen_7cda1a20c5ed8c7a :: FunPtr (IO (Ptr CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo9@
+hs_bindgen_7cda1a20c5ed8c7a = \x_0 -> fmap fromFFIType (hs_bindgen_7cda1a20c5ed8c7a_base (toFFIType x_0))
+{-| __C declaration:__ @foo9@
+
+    __defined at:__ @comprehensive\/smoke.h 18:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo9_unsafe :: FunPtr (IO (Ptr CChar)) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo9@
+
+    __defined at:__ @comprehensive\/smoke.h 18:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo9_unsafe = hs_bindgen_7cda1a20c5ed8c7a
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo10@
+foreign import ccall unsafe "hs_bindgen_25ddc364c2fbc486" hs_bindgen_25ddc364c2fbc486_base ::
+    FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo10@
+hs_bindgen_25ddc364c2fbc486 :: FunPtr (CInt -> IO (Ptr CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo10@
+hs_bindgen_25ddc364c2fbc486 = \x_0 -> fmap fromFFIType (hs_bindgen_25ddc364c2fbc486_base (toFFIType x_0))
+{-| __C declaration:__ @foo10@
+
+    __defined at:__ @comprehensive\/smoke.h 19:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo10_unsafe :: FunPtr (CInt -> IO (Ptr CChar)) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo10@
+
+    __defined at:__ @comprehensive\/smoke.h 19:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo10_unsafe = hs_bindgen_25ddc364c2fbc486
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo11@
+foreign import ccall unsafe "hs_bindgen_59d6c7b752cf0d2c" hs_bindgen_59d6c7b752cf0d2c_base ::
+    FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo11@
+hs_bindgen_59d6c7b752cf0d2c :: FunPtr (IO (Ptr Void)) ->
+                               IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo11@
+hs_bindgen_59d6c7b752cf0d2c = \x_0 -> fmap fromFFIType (hs_bindgen_59d6c7b752cf0d2c_base (toFFIType x_0))
+{-| __C declaration:__ @foo11@
+
+    __defined at:__ @comprehensive\/smoke.h 20:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo11_unsafe :: FunPtr (IO (Ptr Void)) -> IO (Ptr Void)
+{-| __C declaration:__ @foo11@
+
+    __defined at:__ @comprehensive\/smoke.h 20:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo11_unsafe = hs_bindgen_59d6c7b752cf0d2c
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo12@
+foreign import ccall unsafe "hs_bindgen_6f61d879de93f509" hs_bindgen_6f61d879de93f509_base ::
+    FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo12@
+hs_bindgen_6f61d879de93f509 :: FunPtr (CInt -> IO (Ptr Void)) ->
+                               IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo12@
+hs_bindgen_6f61d879de93f509 = \x_0 -> fmap fromFFIType (hs_bindgen_6f61d879de93f509_base (toFFIType x_0))
+{-| __C declaration:__ @foo12@
+
+    __defined at:__ @comprehensive\/smoke.h 21:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo12_unsafe :: FunPtr (CInt -> IO (Ptr Void)) -> IO (Ptr Void)
+{-| __C declaration:__ @foo12@
+
+    __defined at:__ @comprehensive\/smoke.h 21:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo12_unsafe = hs_bindgen_6f61d879de93f509
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo13@
+foreign import ccall unsafe "hs_bindgen_325eccfd4464f38f" hs_bindgen_325eccfd4464f38f_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo13@
+hs_bindgen_325eccfd4464f38f :: Ptr (Elem (IncompleteArray CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo13@
+hs_bindgen_325eccfd4464f38f = \x_0 -> fmap fromFFIType (hs_bindgen_325eccfd4464f38f_base (toFFIType x_0))
+{-| __C declaration:__ @foo13@
+
+    __defined at:__ @comprehensive\/smoke.h 22:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo13_unsafe :: Ptr (Elem (IncompleteArray CChar)) ->
+                IO (Ptr CChar)
+{-| __C declaration:__ @foo13@
+
+    __defined at:__ @comprehensive\/smoke.h 22:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo13_unsafe = hs_bindgen_325eccfd4464f38f
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo14@
+foreign import ccall unsafe "hs_bindgen_e6168413cff5674e" hs_bindgen_e6168413cff5674e_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo14@
+hs_bindgen_e6168413cff5674e :: Ptr (Elem (IncompleteArray CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo14@
+hs_bindgen_e6168413cff5674e = \x_0 -> fmap fromFFIType (hs_bindgen_e6168413cff5674e_base (toFFIType x_0))
+{-| __C declaration:__ @foo14@
+
+    __defined at:__ @comprehensive\/smoke.h 23:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo14_unsafe :: Ptr (Elem (IncompleteArray CChar)) ->
+                IO (Ptr CChar)
+{-| __C declaration:__ @foo14@
+
+    __defined at:__ @comprehensive\/smoke.h 23:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo14_unsafe = hs_bindgen_e6168413cff5674e
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo15@
+foreign import ccall unsafe "hs_bindgen_0ea84b195eb56e51" hs_bindgen_0ea84b195eb56e51_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo15@
+hs_bindgen_0ea84b195eb56e51 :: Ptr (Elem (ConstantArray 5
+                                                        CChar)) ->
+                               IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo15@
+hs_bindgen_0ea84b195eb56e51 = \x_0 -> fmap fromFFIType (hs_bindgen_0ea84b195eb56e51_base (toFFIType x_0))
+{-| __C declaration:__ @foo15@
+
+    __defined at:__ @comprehensive\/smoke.h 24:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo15_unsafe :: Ptr (Elem (ConstantArray 5 CChar)) ->
+                IO (Ptr CChar)
+{-| __C declaration:__ @foo15@
+
+    __defined at:__ @comprehensive\/smoke.h 24:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo15_unsafe = hs_bindgen_0ea84b195eb56e51
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo16@
+foreign import ccall unsafe "hs_bindgen_46c499f7b2f29dbb" hs_bindgen_46c499f7b2f29dbb_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo16@
+hs_bindgen_46c499f7b2f29dbb :: CInt -> IO (Ptr CChar)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo16@
+hs_bindgen_46c499f7b2f29dbb = \x_0 -> fmap fromFFIType (hs_bindgen_46c499f7b2f29dbb_base (toFFIType x_0))
+{-| __C declaration:__ @foo16@
+
+    __defined at:__ @comprehensive\/smoke.h 25:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo16_unsafe :: CInt -> IO (Ptr CChar)
+{-| __C declaration:__ @foo16@
+
+    __defined at:__ @comprehensive\/smoke.h 25:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo16_unsafe = hs_bindgen_46c499f7b2f29dbb
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo17@
+foreign import ccall unsafe "hs_bindgen_7d34cd671fa1d8c9" hs_bindgen_7d34cd671fa1d8c9_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo17@
+hs_bindgen_7d34cd671fa1d8c9 :: Ptr (Ptr (Ptr CChar)) -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo17@
+hs_bindgen_7d34cd671fa1d8c9 = \x_0 -> fmap fromFFIType (hs_bindgen_7d34cd671fa1d8c9_base (toFFIType x_0))
+{-| __C declaration:__ @foo17@
+
+    __defined at:__ @comprehensive\/smoke.h 26:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo17_unsafe :: Ptr (Ptr (Ptr CChar)) -> IO CInt
+{-| __C declaration:__ @foo17@
+
+    __defined at:__ @comprehensive\/smoke.h 26:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo17_unsafe = hs_bindgen_7d34cd671fa1d8c9
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo18@
+foreign import ccall unsafe "hs_bindgen_68092727aed54767" hs_bindgen_68092727aed54767_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo18@
+hs_bindgen_68092727aed54767 :: CUInt -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo18@
+hs_bindgen_68092727aed54767 = \x_0 -> fmap fromFFIType (hs_bindgen_68092727aed54767_base (toFFIType x_0))
+{-| __C declaration:__ @foo18@
+
+    __defined at:__ @comprehensive\/smoke.h 27:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo18_unsafe :: CUInt -> IO CInt
+{-| __C declaration:__ @foo18@
+
+    __defined at:__ @comprehensive\/smoke.h 27:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo18_unsafe = hs_bindgen_68092727aed54767
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo19@
+foreign import ccall unsafe "hs_bindgen_16ecb628ad8bc943" hs_bindgen_16ecb628ad8bc943_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo19@
+hs_bindgen_16ecb628ad8bc943 :: CUInt -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo19@
+hs_bindgen_16ecb628ad8bc943 = \x_0 -> fmap fromFFIType (hs_bindgen_16ecb628ad8bc943_base (toFFIType x_0))
+{-| __C declaration:__ @foo19@
+
+    __defined at:__ @comprehensive\/smoke.h 28:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo19_unsafe :: CUInt -> IO CInt
+{-| __C declaration:__ @foo19@
+
+    __defined at:__ @comprehensive\/smoke.h 28:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo19_unsafe = hs_bindgen_16ecb628ad8bc943
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo20@
+foreign import ccall unsafe "hs_bindgen_137b6b359edafeb7" hs_bindgen_137b6b359edafeb7_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo20@
+hs_bindgen_137b6b359edafeb7 :: Uint -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo20@
+hs_bindgen_137b6b359edafeb7 = \x_0 -> fmap fromFFIType (hs_bindgen_137b6b359edafeb7_base (toFFIType x_0))
+{-| __C declaration:__ @foo20@
+
+    __defined at:__ @comprehensive\/smoke.h 29:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo20_unsafe :: Uint -> IO CInt
+{-| __C declaration:__ @foo20@
+
+    __defined at:__ @comprehensive\/smoke.h 29:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo20_unsafe = hs_bindgen_137b6b359edafeb7
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo21@
+foreign import ccall unsafe "hs_bindgen_30ddc0dce4dbba94" hs_bindgen_30ddc0dce4dbba94_base ::
+    FunPtr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo21@
+hs_bindgen_30ddc0dce4dbba94 :: FunPtr (CInt -> IO CInt) -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo21@
+hs_bindgen_30ddc0dce4dbba94 = \x_0 -> fmap fromFFIType (hs_bindgen_30ddc0dce4dbba94_base (toFFIType x_0))
+{-| __C declaration:__ @foo21@
+
+    __defined at:__ @comprehensive\/smoke.h 30:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo21_unsafe :: FunPtr (CInt -> IO CInt) -> IO CInt
+{-| __C declaration:__ @foo21@
+
+    __defined at:__ @comprehensive\/smoke.h 30:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo21_unsafe = hs_bindgen_30ddc0dce4dbba94
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo22@
+foreign import ccall unsafe "hs_bindgen_27c8fe28c4787aef" hs_bindgen_27c8fe28c4787aef_base ::
+    FunPtr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo22@
+hs_bindgen_27c8fe28c4787aef :: FunPtr (CInt -> IO (Ptr CInt)) ->
+                               IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo22@
+hs_bindgen_27c8fe28c4787aef = \x_0 -> fmap fromFFIType (hs_bindgen_27c8fe28c4787aef_base (toFFIType x_0))
+{-| __C declaration:__ @foo22@
+
+    __defined at:__ @comprehensive\/smoke.h 31:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo22_unsafe :: FunPtr (CInt -> IO (Ptr CInt)) -> IO CInt
+{-| __C declaration:__ @foo22@
+
+    __defined at:__ @comprehensive\/smoke.h 31:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo22_unsafe = hs_bindgen_27c8fe28c4787aef
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo23@
+foreign import ccall unsafe "hs_bindgen_b88d57f2bfe36cf8" hs_bindgen_b88d57f2bfe36cf8_base ::
+    FunPtr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo23@
+hs_bindgen_b88d57f2bfe36cf8 :: FunPtr (CInt ->
+                                       IO (Ptr (Ptr CInt))) ->
+                               IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo23@
+hs_bindgen_b88d57f2bfe36cf8 = \x_0 -> fmap fromFFIType (hs_bindgen_b88d57f2bfe36cf8_base (toFFIType x_0))
+{-| __C declaration:__ @foo23@
+
+    __defined at:__ @comprehensive\/smoke.h 32:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo23_unsafe :: FunPtr (CInt -> IO (Ptr (Ptr CInt))) -> IO CInt
+{-| __C declaration:__ @foo23@
+
+    __defined at:__ @comprehensive\/smoke.h 32:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo23_unsafe = hs_bindgen_b88d57f2bfe36cf8
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo24@
+foreign import ccall unsafe "hs_bindgen_257c8c4361081ed9" hs_bindgen_257c8c4361081ed9_base ::
+    FunPtr Void
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo24@
+hs_bindgen_257c8c4361081ed9 :: FunPtr (CInt ->
+                                       IO (Ptr (Ptr (Ptr CInt)))) ->
+                               IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo24@
+hs_bindgen_257c8c4361081ed9 = \x_0 -> fmap fromFFIType (hs_bindgen_257c8c4361081ed9_base (toFFIType x_0))
+{-| __C declaration:__ @foo24@
+
+    __defined at:__ @comprehensive\/smoke.h 33:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo24_unsafe :: FunPtr (CInt -> IO (Ptr (Ptr (Ptr CInt)))) ->
+                IO CInt
+{-| __C declaration:__ @foo24@
+
+    __defined at:__ @comprehensive\/smoke.h 33:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo24_unsafe = hs_bindgen_257c8c4361081ed9
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo25@
+foreign import ccall unsafe "hs_bindgen_401c9920eb162e99" hs_bindgen_401c9920eb162e99_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo25@
+hs_bindgen_401c9920eb162e99 :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo25@
+hs_bindgen_401c9920eb162e99 = \x_0 -> fmap fromFFIType (hs_bindgen_401c9920eb162e99_base (toFFIType x_0))
+{-| __C declaration:__ @foo25@
+
+    __defined at:__ @comprehensive\/smoke.h 34:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo25_unsafe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @foo25@
+
+    __defined at:__ @comprehensive\/smoke.h 34:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo25_unsafe = hs_bindgen_401c9920eb162e99
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo26@
+foreign import ccall unsafe "hs_bindgen_bf36517f6f9412b1" hs_bindgen_bf36517f6f9412b1_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo26@
+hs_bindgen_bf36517f6f9412b1 :: CInt -> IO (Ptr (Ptr CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo26@
+hs_bindgen_bf36517f6f9412b1 = \x_0 -> fmap fromFFIType (hs_bindgen_bf36517f6f9412b1_base (toFFIType x_0))
+{-| __C declaration:__ @foo26@
+
+    __defined at:__ @comprehensive\/smoke.h 35:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo26_unsafe :: CInt -> IO (Ptr (Ptr CInt))
+{-| __C declaration:__ @foo26@
+
+    __defined at:__ @comprehensive\/smoke.h 35:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo26_unsafe = hs_bindgen_bf36517f6f9412b1
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo27@
+foreign import ccall unsafe "hs_bindgen_6727bd704a28f329" hs_bindgen_6727bd704a28f329_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo27@
+hs_bindgen_6727bd704a28f329 :: CInt -> IO (Ptr (Ptr (Ptr CInt)))
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo27@
+hs_bindgen_6727bd704a28f329 = \x_0 -> fmap fromFFIType (hs_bindgen_6727bd704a28f329_base (toFFIType x_0))
+{-| __C declaration:__ @foo27@
+
+    __defined at:__ @comprehensive\/smoke.h 36:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo27_unsafe :: CInt -> IO (Ptr (Ptr (Ptr CInt)))
+{-| __C declaration:__ @foo27@
+
+    __defined at:__ @comprehensive\/smoke.h 36:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo27_unsafe = hs_bindgen_6727bd704a28f329
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo28@
+foreign import ccall unsafe "hs_bindgen_c5bd28320c79f368" hs_bindgen_c5bd28320c79f368_base ::
+    CULong
+ -> IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo28@
+hs_bindgen_c5bd28320c79f368 :: Size_t -> IO (Ptr (Ptr (Ptr CInt)))
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_foo28@
+hs_bindgen_c5bd28320c79f368 = \x_0 -> fmap fromFFIType (hs_bindgen_c5bd28320c79f368_base (toFFIType x_0))
+{-| __C declaration:__ @foo28@
+
+    __defined at:__ @comprehensive\/smoke.h 37:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo28_unsafe :: Size_t -> IO (Ptr (Ptr (Ptr CInt)))
+{-| __C declaration:__ @foo28@
+
+    __defined at:__ @comprehensive\/smoke.h 37:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo28_unsafe = hs_bindgen_c5bd28320c79f368
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_inline_foo@
+foreign import ccall unsafe "hs_bindgen_4b6dbdd1ba04d213" hs_bindgen_4b6dbdd1ba04d213_base ::
+    CInt
+ -> Ptr Void
+ -> CInt
+ -> Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> CULong
+ -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_inline_foo@
+hs_bindgen_4b6dbdd1ba04d213 :: CInt ->
+                               Ptr CInt ->
+                               CInt ->
+                               PtrConst CInt ->
+                               Ptr (PtrConst CInt) ->
+                               PtrConst (PtrConst CInt) -> Size_t -> IO CInt
+-- __unique:__ @test_comprehensivesmoke_Example_Unsafe_inline_foo@
+hs_bindgen_4b6dbdd1ba04d213 = \x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> \x_5 -> \x_6 -> fmap fromFFIType (hs_bindgen_4b6dbdd1ba04d213_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3) (toFFIType x_4) (toFFIType x_5) (toFFIType x_6))
+{-| __C declaration:__ @inline_foo@
+
+    __defined at:__ @comprehensive\/smoke.h 80:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+inline_foo_unsafe :: CInt ->
+                     Ptr CInt ->
+                     CInt ->
+                     PtrConst CInt ->
+                     Ptr (PtrConst CInt) ->
+                     PtrConst (PtrConst CInt) -> Size_t -> IO CInt
+{-| __C declaration:__ @inline_foo@
+
+    __defined at:__ @comprehensive\/smoke.h 80:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+inline_foo_unsafe = hs_bindgen_4b6dbdd1ba04d213
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo1@
+foreign import ccall unsafe "hs_bindgen_abdd0c6dd73d0854" hs_bindgen_abdd0c6dd73d0854_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo1@
+hs_bindgen_abdd0c6dd73d0854 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo1@
+hs_bindgen_abdd0c6dd73d0854 = fmap fromFFIType hs_bindgen_abdd0c6dd73d0854_base
+{-# NOINLINE foo1_funptr #-}
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @comprehensive\/smoke.h 10:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo1_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @comprehensive\/smoke.h 10:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo1_funptr = unsafePerformIO hs_bindgen_abdd0c6dd73d0854
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo2@
+foreign import ccall unsafe "hs_bindgen_95f5e8dc2a878cd6" hs_bindgen_95f5e8dc2a878cd6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo2@
+hs_bindgen_95f5e8dc2a878cd6 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo2@
+hs_bindgen_95f5e8dc2a878cd6 = fmap fromFFIType hs_bindgen_95f5e8dc2a878cd6_base
+{-# NOINLINE foo2_funptr #-}
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @comprehensive\/smoke.h 11:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo2_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @comprehensive\/smoke.h 11:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo2_funptr = unsafePerformIO hs_bindgen_95f5e8dc2a878cd6
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo3@
+foreign import ccall unsafe "hs_bindgen_9970868a81b829db" hs_bindgen_9970868a81b829db_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo3@
+hs_bindgen_9970868a81b829db :: IO (FunPtr (CInt -> CInt -> IO ()))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo3@
+hs_bindgen_9970868a81b829db = fmap fromFFIType hs_bindgen_9970868a81b829db_base
+{-# NOINLINE foo3_funptr #-}
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @comprehensive\/smoke.h 12:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo3_funptr :: FunPtr (CInt -> CInt -> IO ())
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @comprehensive\/smoke.h 12:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo3_funptr = unsafePerformIO hs_bindgen_9970868a81b829db
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo4@
+foreign import ccall unsafe "hs_bindgen_c2fb72f24a5149fb" hs_bindgen_c2fb72f24a5149fb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo4@
+hs_bindgen_c2fb72f24a5149fb :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo4@
+hs_bindgen_c2fb72f24a5149fb = fmap fromFFIType hs_bindgen_c2fb72f24a5149fb_base
+{-# NOINLINE foo4_funptr #-}
+{-| __C declaration:__ @foo4@
+
+    __defined at:__ @comprehensive\/smoke.h 13:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo4_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @foo4@
+
+    __defined at:__ @comprehensive\/smoke.h 13:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo4_funptr = unsafePerformIO hs_bindgen_c2fb72f24a5149fb
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo5@
+foreign import ccall unsafe "hs_bindgen_3d952ee4c4ee378f" hs_bindgen_3d952ee4c4ee378f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo5@
+hs_bindgen_3d952ee4c4ee378f :: IO (FunPtr (CInt -> IO CChar))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo5@
+hs_bindgen_3d952ee4c4ee378f = fmap fromFFIType hs_bindgen_3d952ee4c4ee378f_base
+{-# NOINLINE foo5_funptr #-}
+{-| __C declaration:__ @foo5@
+
+    __defined at:__ @comprehensive\/smoke.h 14:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo5_funptr :: FunPtr (CInt -> IO CChar)
+{-| __C declaration:__ @foo5@
+
+    __defined at:__ @comprehensive\/smoke.h 14:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo5_funptr = unsafePerformIO hs_bindgen_3d952ee4c4ee378f
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo6@
+foreign import ccall unsafe "hs_bindgen_478897bd7cf090b7" hs_bindgen_478897bd7cf090b7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo6@
+hs_bindgen_478897bd7cf090b7 :: IO (FunPtr (CInt ->
+                                           CInt -> IO (Ptr CChar)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo6@
+hs_bindgen_478897bd7cf090b7 = fmap fromFFIType hs_bindgen_478897bd7cf090b7_base
+{-# NOINLINE foo6_funptr #-}
+{-| __C declaration:__ @foo6@
+
+    __defined at:__ @comprehensive\/smoke.h 15:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo6_funptr :: FunPtr (CInt -> CInt -> IO (Ptr CChar))
+{-| __C declaration:__ @foo6@
+
+    __defined at:__ @comprehensive\/smoke.h 15:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo6_funptr = unsafePerformIO hs_bindgen_478897bd7cf090b7
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo7@
+foreign import ccall unsafe "hs_bindgen_2804b55bcc6495bd" hs_bindgen_2804b55bcc6495bd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo7@
+hs_bindgen_2804b55bcc6495bd :: IO (FunPtr (Ptr CChar ->
+                                           IO (Ptr CChar)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo7@
+hs_bindgen_2804b55bcc6495bd = fmap fromFFIType hs_bindgen_2804b55bcc6495bd_base
+{-# NOINLINE foo7_funptr #-}
+{-| __C declaration:__ @foo7@
+
+    __defined at:__ @comprehensive\/smoke.h 16:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo7_funptr :: FunPtr (Ptr CChar -> IO (Ptr CChar))
+{-| __C declaration:__ @foo7@
+
+    __defined at:__ @comprehensive\/smoke.h 16:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo7_funptr = unsafePerformIO hs_bindgen_2804b55bcc6495bd
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo8@
+foreign import ccall unsafe "hs_bindgen_dc0ab953845109e0" hs_bindgen_dc0ab953845109e0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo8@
+hs_bindgen_dc0ab953845109e0 :: IO (FunPtr (Ptr CChar ->
+                                           IO (Ptr CChar)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo8@
+hs_bindgen_dc0ab953845109e0 = fmap fromFFIType hs_bindgen_dc0ab953845109e0_base
+{-# NOINLINE foo8_funptr #-}
+{-| __C declaration:__ @foo8@
+
+    __defined at:__ @comprehensive\/smoke.h 17:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo8_funptr :: FunPtr (Ptr CChar -> IO (Ptr CChar))
+{-| __C declaration:__ @foo8@
+
+    __defined at:__ @comprehensive\/smoke.h 17:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo8_funptr = unsafePerformIO hs_bindgen_dc0ab953845109e0
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo9@
+foreign import ccall unsafe "hs_bindgen_6c6b48e80df5d80b" hs_bindgen_6c6b48e80df5d80b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo9@
+hs_bindgen_6c6b48e80df5d80b :: IO (FunPtr (FunPtr (IO (Ptr CChar)) ->
+                                           IO (Ptr CChar)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo9@
+hs_bindgen_6c6b48e80df5d80b = fmap fromFFIType hs_bindgen_6c6b48e80df5d80b_base
+{-# NOINLINE foo9_funptr #-}
+{-| __C declaration:__ @foo9@
+
+    __defined at:__ @comprehensive\/smoke.h 18:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo9_funptr :: FunPtr (FunPtr (IO (Ptr CChar)) -> IO (Ptr CChar))
+{-| __C declaration:__ @foo9@
+
+    __defined at:__ @comprehensive\/smoke.h 18:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo9_funptr = unsafePerformIO hs_bindgen_6c6b48e80df5d80b
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo10@
+foreign import ccall unsafe "hs_bindgen_fc0a56da1aa3e234" hs_bindgen_fc0a56da1aa3e234_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo10@
+hs_bindgen_fc0a56da1aa3e234 :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO (Ptr CChar)) ->
+                                           IO (Ptr CChar)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo10@
+hs_bindgen_fc0a56da1aa3e234 = fmap fromFFIType hs_bindgen_fc0a56da1aa3e234_base
+{-# NOINLINE foo10_funptr #-}
+{-| __C declaration:__ @foo10@
+
+    __defined at:__ @comprehensive\/smoke.h 19:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo10_funptr :: FunPtr (FunPtr (CInt -> IO (Ptr CChar)) ->
+                        IO (Ptr CChar))
+{-| __C declaration:__ @foo10@
+
+    __defined at:__ @comprehensive\/smoke.h 19:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo10_funptr = unsafePerformIO hs_bindgen_fc0a56da1aa3e234
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo11@
+foreign import ccall unsafe "hs_bindgen_b882a6f77db6bd0e" hs_bindgen_b882a6f77db6bd0e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo11@
+hs_bindgen_b882a6f77db6bd0e :: IO (FunPtr (FunPtr (IO (Ptr Void)) ->
+                                           IO (Ptr Void)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo11@
+hs_bindgen_b882a6f77db6bd0e = fmap fromFFIType hs_bindgen_b882a6f77db6bd0e_base
+{-# NOINLINE foo11_funptr #-}
+{-| __C declaration:__ @foo11@
+
+    __defined at:__ @comprehensive\/smoke.h 20:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo11_funptr :: FunPtr (FunPtr (IO (Ptr Void)) -> IO (Ptr Void))
+{-| __C declaration:__ @foo11@
+
+    __defined at:__ @comprehensive\/smoke.h 20:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo11_funptr = unsafePerformIO hs_bindgen_b882a6f77db6bd0e
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo12@
+foreign import ccall unsafe "hs_bindgen_c219c7d6d459a7e0" hs_bindgen_c219c7d6d459a7e0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo12@
+hs_bindgen_c219c7d6d459a7e0 :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO (Ptr Void)) ->
+                                           IO (Ptr Void)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo12@
+hs_bindgen_c219c7d6d459a7e0 = fmap fromFFIType hs_bindgen_c219c7d6d459a7e0_base
+{-# NOINLINE foo12_funptr #-}
+{-| __C declaration:__ @foo12@
+
+    __defined at:__ @comprehensive\/smoke.h 21:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo12_funptr :: FunPtr (FunPtr (CInt -> IO (Ptr Void)) ->
+                        IO (Ptr Void))
+{-| __C declaration:__ @foo12@
+
+    __defined at:__ @comprehensive\/smoke.h 21:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo12_funptr = unsafePerformIO hs_bindgen_c219c7d6d459a7e0
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo13@
+foreign import ccall unsafe "hs_bindgen_caa14e75b1229a54" hs_bindgen_caa14e75b1229a54_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo13@
+hs_bindgen_caa14e75b1229a54 :: IO (FunPtr (Ptr (Elem (IncompleteArray CChar)) ->
+                                           IO (Ptr CChar)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo13@
+hs_bindgen_caa14e75b1229a54 = fmap fromFFIType hs_bindgen_caa14e75b1229a54_base
+{-# NOINLINE foo13_funptr #-}
+{-| __C declaration:__ @foo13@
+
+    __defined at:__ @comprehensive\/smoke.h 22:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo13_funptr :: FunPtr (Ptr (Elem (IncompleteArray CChar)) ->
+                        IO (Ptr CChar))
+{-| __C declaration:__ @foo13@
+
+    __defined at:__ @comprehensive\/smoke.h 22:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo13_funptr = unsafePerformIO hs_bindgen_caa14e75b1229a54
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo14@
+foreign import ccall unsafe "hs_bindgen_3cb093b66f7944d4" hs_bindgen_3cb093b66f7944d4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo14@
+hs_bindgen_3cb093b66f7944d4 :: IO (FunPtr (Ptr (Elem (IncompleteArray CChar)) ->
+                                           IO (Ptr CChar)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo14@
+hs_bindgen_3cb093b66f7944d4 = fmap fromFFIType hs_bindgen_3cb093b66f7944d4_base
+{-# NOINLINE foo14_funptr #-}
+{-| __C declaration:__ @foo14@
+
+    __defined at:__ @comprehensive\/smoke.h 23:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo14_funptr :: FunPtr (Ptr (Elem (IncompleteArray CChar)) ->
+                        IO (Ptr CChar))
+{-| __C declaration:__ @foo14@
+
+    __defined at:__ @comprehensive\/smoke.h 23:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo14_funptr = unsafePerformIO hs_bindgen_3cb093b66f7944d4
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo15@
+foreign import ccall unsafe "hs_bindgen_fe12aea8f26fdc44" hs_bindgen_fe12aea8f26fdc44_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo15@
+hs_bindgen_fe12aea8f26fdc44 :: IO (FunPtr (Ptr (Elem (ConstantArray 5
+                                                                    CChar)) ->
+                                           IO (Ptr CChar)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo15@
+hs_bindgen_fe12aea8f26fdc44 = fmap fromFFIType hs_bindgen_fe12aea8f26fdc44_base
+{-# NOINLINE foo15_funptr #-}
+{-| __C declaration:__ @foo15@
+
+    __defined at:__ @comprehensive\/smoke.h 24:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo15_funptr :: FunPtr (Ptr (Elem (ConstantArray 5 CChar)) ->
+                        IO (Ptr CChar))
+{-| __C declaration:__ @foo15@
+
+    __defined at:__ @comprehensive\/smoke.h 24:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo15_funptr = unsafePerformIO hs_bindgen_fe12aea8f26fdc44
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo16@
+foreign import ccall unsafe "hs_bindgen_7682897a88740d24" hs_bindgen_7682897a88740d24_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo16@
+hs_bindgen_7682897a88740d24 :: IO (FunPtr (CInt -> IO (Ptr CChar)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo16@
+hs_bindgen_7682897a88740d24 = fmap fromFFIType hs_bindgen_7682897a88740d24_base
+{-# NOINLINE foo16_funptr #-}
+{-| __C declaration:__ @foo16@
+
+    __defined at:__ @comprehensive\/smoke.h 25:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo16_funptr :: FunPtr (CInt -> IO (Ptr CChar))
+{-| __C declaration:__ @foo16@
+
+    __defined at:__ @comprehensive\/smoke.h 25:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo16_funptr = unsafePerformIO hs_bindgen_7682897a88740d24
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo17@
+foreign import ccall unsafe "hs_bindgen_a8ad868a6dc425f9" hs_bindgen_a8ad868a6dc425f9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo17@
+hs_bindgen_a8ad868a6dc425f9 :: IO (FunPtr (Ptr (Ptr (Ptr CChar)) ->
+                                           IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo17@
+hs_bindgen_a8ad868a6dc425f9 = fmap fromFFIType hs_bindgen_a8ad868a6dc425f9_base
+{-# NOINLINE foo17_funptr #-}
+{-| __C declaration:__ @foo17@
+
+    __defined at:__ @comprehensive\/smoke.h 26:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo17_funptr :: FunPtr (Ptr (Ptr (Ptr CChar)) -> IO CInt)
+{-| __C declaration:__ @foo17@
+
+    __defined at:__ @comprehensive\/smoke.h 26:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo17_funptr = unsafePerformIO hs_bindgen_a8ad868a6dc425f9
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo18@
+foreign import ccall unsafe "hs_bindgen_245d12e0c60b976b" hs_bindgen_245d12e0c60b976b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo18@
+hs_bindgen_245d12e0c60b976b :: IO (FunPtr (CUInt -> IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo18@
+hs_bindgen_245d12e0c60b976b = fmap fromFFIType hs_bindgen_245d12e0c60b976b_base
+{-# NOINLINE foo18_funptr #-}
+{-| __C declaration:__ @foo18@
+
+    __defined at:__ @comprehensive\/smoke.h 27:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo18_funptr :: FunPtr (CUInt -> IO CInt)
+{-| __C declaration:__ @foo18@
+
+    __defined at:__ @comprehensive\/smoke.h 27:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo18_funptr = unsafePerformIO hs_bindgen_245d12e0c60b976b
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo19@
+foreign import ccall unsafe "hs_bindgen_81d64147225cc2ab" hs_bindgen_81d64147225cc2ab_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo19@
+hs_bindgen_81d64147225cc2ab :: IO (FunPtr (CUInt -> IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo19@
+hs_bindgen_81d64147225cc2ab = fmap fromFFIType hs_bindgen_81d64147225cc2ab_base
+{-# NOINLINE foo19_funptr #-}
+{-| __C declaration:__ @foo19@
+
+    __defined at:__ @comprehensive\/smoke.h 28:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo19_funptr :: FunPtr (CUInt -> IO CInt)
+{-| __C declaration:__ @foo19@
+
+    __defined at:__ @comprehensive\/smoke.h 28:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo19_funptr = unsafePerformIO hs_bindgen_81d64147225cc2ab
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo20@
+foreign import ccall unsafe "hs_bindgen_b9d12fbbd2c70f4f" hs_bindgen_b9d12fbbd2c70f4f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo20@
+hs_bindgen_b9d12fbbd2c70f4f :: IO (FunPtr (Uint -> IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo20@
+hs_bindgen_b9d12fbbd2c70f4f = fmap fromFFIType hs_bindgen_b9d12fbbd2c70f4f_base
+{-# NOINLINE foo20_funptr #-}
+{-| __C declaration:__ @foo20@
+
+    __defined at:__ @comprehensive\/smoke.h 29:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo20_funptr :: FunPtr (Uint -> IO CInt)
+{-| __C declaration:__ @foo20@
+
+    __defined at:__ @comprehensive\/smoke.h 29:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo20_funptr = unsafePerformIO hs_bindgen_b9d12fbbd2c70f4f
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo21@
+foreign import ccall unsafe "hs_bindgen_a3c85769041747ba" hs_bindgen_a3c85769041747ba_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo21@
+hs_bindgen_a3c85769041747ba :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO CInt) ->
+                                           IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo21@
+hs_bindgen_a3c85769041747ba = fmap fromFFIType hs_bindgen_a3c85769041747ba_base
+{-# NOINLINE foo21_funptr #-}
+{-| __C declaration:__ @foo21@
+
+    __defined at:__ @comprehensive\/smoke.h 30:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo21_funptr :: FunPtr (FunPtr (CInt -> IO CInt) -> IO CInt)
+{-| __C declaration:__ @foo21@
+
+    __defined at:__ @comprehensive\/smoke.h 30:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo21_funptr = unsafePerformIO hs_bindgen_a3c85769041747ba
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo22@
+foreign import ccall unsafe "hs_bindgen_5fc122411b8a03ea" hs_bindgen_5fc122411b8a03ea_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo22@
+hs_bindgen_5fc122411b8a03ea :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO (Ptr CInt)) ->
+                                           IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo22@
+hs_bindgen_5fc122411b8a03ea = fmap fromFFIType hs_bindgen_5fc122411b8a03ea_base
+{-# NOINLINE foo22_funptr #-}
+{-| __C declaration:__ @foo22@
+
+    __defined at:__ @comprehensive\/smoke.h 31:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo22_funptr :: FunPtr (FunPtr (CInt -> IO (Ptr CInt)) -> IO CInt)
+{-| __C declaration:__ @foo22@
+
+    __defined at:__ @comprehensive\/smoke.h 31:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo22_funptr = unsafePerformIO hs_bindgen_5fc122411b8a03ea
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo23@
+foreign import ccall unsafe "hs_bindgen_a7fcbb7f1b7f29cb" hs_bindgen_a7fcbb7f1b7f29cb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo23@
+hs_bindgen_a7fcbb7f1b7f29cb :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO (Ptr (Ptr CInt))) ->
+                                           IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo23@
+hs_bindgen_a7fcbb7f1b7f29cb = fmap fromFFIType hs_bindgen_a7fcbb7f1b7f29cb_base
+{-# NOINLINE foo23_funptr #-}
+{-| __C declaration:__ @foo23@
+
+    __defined at:__ @comprehensive\/smoke.h 32:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo23_funptr :: FunPtr (FunPtr (CInt -> IO (Ptr (Ptr CInt))) ->
+                        IO CInt)
+{-| __C declaration:__ @foo23@
+
+    __defined at:__ @comprehensive\/smoke.h 32:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo23_funptr = unsafePerformIO hs_bindgen_a7fcbb7f1b7f29cb
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo24@
+foreign import ccall unsafe "hs_bindgen_9c5a2b0e6d53b7c9" hs_bindgen_9c5a2b0e6d53b7c9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo24@
+hs_bindgen_9c5a2b0e6d53b7c9 :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO (Ptr (Ptr (Ptr CInt)))) ->
+                                           IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo24@
+hs_bindgen_9c5a2b0e6d53b7c9 = fmap fromFFIType hs_bindgen_9c5a2b0e6d53b7c9_base
+{-# NOINLINE foo24_funptr #-}
+{-| __C declaration:__ @foo24@
+
+    __defined at:__ @comprehensive\/smoke.h 33:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo24_funptr :: FunPtr (FunPtr (CInt ->
+                                IO (Ptr (Ptr (Ptr CInt)))) ->
+                        IO CInt)
+{-| __C declaration:__ @foo24@
+
+    __defined at:__ @comprehensive\/smoke.h 33:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo24_funptr = unsafePerformIO hs_bindgen_9c5a2b0e6d53b7c9
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo25@
+foreign import ccall unsafe "hs_bindgen_5b576a9269d86a85" hs_bindgen_5b576a9269d86a85_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo25@
+hs_bindgen_5b576a9269d86a85 :: IO (FunPtr (CInt -> IO (Ptr CInt)))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo25@
+hs_bindgen_5b576a9269d86a85 = fmap fromFFIType hs_bindgen_5b576a9269d86a85_base
+{-# NOINLINE foo25_funptr #-}
+{-| __C declaration:__ @foo25@
+
+    __defined at:__ @comprehensive\/smoke.h 34:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo25_funptr :: FunPtr (CInt -> IO (Ptr CInt))
+{-| __C declaration:__ @foo25@
+
+    __defined at:__ @comprehensive\/smoke.h 34:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo25_funptr = unsafePerformIO hs_bindgen_5b576a9269d86a85
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo26@
+foreign import ccall unsafe "hs_bindgen_3d968f750d7c0963" hs_bindgen_3d968f750d7c0963_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo26@
+hs_bindgen_3d968f750d7c0963 :: IO (FunPtr (CInt ->
+                                           IO (Ptr (Ptr CInt))))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo26@
+hs_bindgen_3d968f750d7c0963 = fmap fromFFIType hs_bindgen_3d968f750d7c0963_base
+{-# NOINLINE foo26_funptr #-}
+{-| __C declaration:__ @foo26@
+
+    __defined at:__ @comprehensive\/smoke.h 35:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo26_funptr :: FunPtr (CInt -> IO (Ptr (Ptr CInt)))
+{-| __C declaration:__ @foo26@
+
+    __defined at:__ @comprehensive\/smoke.h 35:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo26_funptr = unsafePerformIO hs_bindgen_3d968f750d7c0963
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo27@
+foreign import ccall unsafe "hs_bindgen_477d6debd15ec8cc" hs_bindgen_477d6debd15ec8cc_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo27@
+hs_bindgen_477d6debd15ec8cc :: IO (FunPtr (CInt ->
+                                           IO (Ptr (Ptr (Ptr CInt)))))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo27@
+hs_bindgen_477d6debd15ec8cc = fmap fromFFIType hs_bindgen_477d6debd15ec8cc_base
+{-# NOINLINE foo27_funptr #-}
+{-| __C declaration:__ @foo27@
+
+    __defined at:__ @comprehensive\/smoke.h 36:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo27_funptr :: FunPtr (CInt -> IO (Ptr (Ptr (Ptr CInt))))
+{-| __C declaration:__ @foo27@
+
+    __defined at:__ @comprehensive\/smoke.h 36:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo27_funptr = unsafePerformIO hs_bindgen_477d6debd15ec8cc
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo28@
+foreign import ccall unsafe "hs_bindgen_fe8d0bbb3e0e9949" hs_bindgen_fe8d0bbb3e0e9949_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo28@
+hs_bindgen_fe8d0bbb3e0e9949 :: IO (FunPtr (Size_t ->
+                                           IO (Ptr (Ptr (Ptr CInt)))))
+-- __unique:__ @test_comprehensivesmoke_Example_get_foo28@
+hs_bindgen_fe8d0bbb3e0e9949 = fmap fromFFIType hs_bindgen_fe8d0bbb3e0e9949_base
+{-# NOINLINE foo28_funptr #-}
+{-| __C declaration:__ @foo28@
+
+    __defined at:__ @comprehensive\/smoke.h 37:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo28_funptr :: FunPtr (Size_t -> IO (Ptr (Ptr (Ptr CInt))))
+{-| __C declaration:__ @foo28@
+
+    __defined at:__ @comprehensive\/smoke.h 37:9@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+foo28_funptr = unsafePerformIO hs_bindgen_fe8d0bbb3e0e9949
+-- __unique:__ @test_comprehensivesmoke_Example_get_inline_foo@
+foreign import ccall unsafe "hs_bindgen_3e48bdcc0c25203c" hs_bindgen_3e48bdcc0c25203c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_inline_foo@
+hs_bindgen_3e48bdcc0c25203c :: IO (FunPtr (CInt ->
+                                           Ptr CInt ->
+                                           CInt ->
+                                           PtrConst CInt ->
+                                           Ptr (PtrConst CInt) ->
+                                           PtrConst (PtrConst CInt) -> Size_t -> IO CInt))
+-- __unique:__ @test_comprehensivesmoke_Example_get_inline_foo@
+hs_bindgen_3e48bdcc0c25203c = fmap fromFFIType hs_bindgen_3e48bdcc0c25203c_base
+{-# NOINLINE inline_foo_funptr #-}
+{-| __C declaration:__ @inline_foo@
+
+    __defined at:__ @comprehensive\/smoke.h 80:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+inline_foo_funptr :: FunPtr (CInt ->
+                             Ptr CInt ->
+                             CInt ->
+                             PtrConst CInt ->
+                             Ptr (PtrConst CInt) ->
+                             PtrConst (PtrConst CInt) -> Size_t -> IO CInt)
+{-| __C declaration:__ @inline_foo@
+
+    __defined at:__ @comprehensive\/smoke.h 80:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+inline_foo_funptr = unsafePerformIO hs_bindgen_3e48bdcc0c25203c
+-- __unique:__ @test_comprehensivesmoke_Example_get_global@
+foreign import ccall unsafe "hs_bindgen_dbeef9adb3c4fba3" hs_bindgen_dbeef9adb3c4fba3_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_comprehensivesmoke_Example_get_global@
+hs_bindgen_dbeef9adb3c4fba3 :: IO (Ptr CInt)
+-- __unique:__ @test_comprehensivesmoke_Example_get_global@
+hs_bindgen_dbeef9adb3c4fba3 = fmap fromFFIType hs_bindgen_dbeef9adb3c4fba3_base
+{-# NOINLINE global #-}
+{-| __C declaration:__ @global@
+
+    __defined at:__ @comprehensive\/smoke.h 78:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+global :: Ptr CInt
+{-| __C declaration:__ @global@
+
+    __defined at:__ @comprehensive\/smoke.h 78:12@
+
+    __exported by:__ @comprehensive\/smoke.h@
+-}
+global = unsafePerformIO hs_bindgen_dbeef9adb3c4fba3
diff --git a/test-artefacts/fixtures/declarations/declaration_unselected_b/bindingspec.yaml b/test-artefacts/fixtures/declarations/declaration_unselected_b/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/declaration_unselected_b/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/declarations/declaration_unselected_b/th.txt b/test-artefacts/fixtures/declarations/declaration_unselected_b/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/declaration_unselected_b/th.txt
@@ -0,0 +1,2 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/declaration_unselected_a.h
+-- addDependentFile test-artefacts/headers/golden/declarations/declaration_unselected_b.h
diff --git a/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example.hs b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example.hs
@@ -0,0 +1,73 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 5:9@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+newtype A = A
+  { unwrapA :: HsBindgen.Runtime.LibC.CSize
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" =
+    HsBindgen.Runtime.LibC.CSize
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example/FunPtr.hs b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/declarations_required_for_scoping.h>"
+  , "/* test_declarationsdeclarations_requ_Example_get_f */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0d4da37880af2263 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &f;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsdeclarations_requ_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_0d4da37880af2263" hs_bindgen_0d4da37880af2263_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_declarationsdeclarations_requ_Example_get_f@
+hs_bindgen_0d4da37880af2263 :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_0d4da37880af2263 =
+  fmap BG.fromFFIType hs_bindgen_0d4da37880af2263_base
+
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 7:6@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+f :: BG.FunPtr (A -> IO ())
+f = BG.unsafePerformIO hs_bindgen_0d4da37880af2263
diff --git a/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example/Safe.hs b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example/Safe.hs
@@ -0,0 +1,50 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/declarations_required_for_scoping.h>"
+  , "void hs_bindgen_0d1c75136a36e326 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (f)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_0d1c75136a36e326" hs_bindgen_0d1c75136a36e326_base ::
+     HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Safe_f@
+hs_bindgen_0d1c75136a36e326 ::
+     A
+  -> IO ()
+hs_bindgen_0d1c75136a36e326 =
+  \x0 ->
+    hs_bindgen_0d1c75136a36e326_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 7:6@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+f ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+f = hs_bindgen_0d1c75136a36e326
diff --git a/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example/Unsafe.hs b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/Example/Unsafe.hs
@@ -0,0 +1,50 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/declarations_required_for_scoping.h>"
+  , "void hs_bindgen_93ed1628a0edf6b0 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (f)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_93ed1628a0edf6b0" hs_bindgen_93ed1628a0edf6b0_base ::
+     HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Unsafe_f@
+hs_bindgen_93ed1628a0edf6b0 ::
+     A
+  -> IO ()
+hs_bindgen_93ed1628a0edf6b0 =
+  \x0 ->
+    hs_bindgen_93ed1628a0edf6b0_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 7:6@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+f ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+f = hs_bindgen_93ed1628a0edf6b0
diff --git a/test-artefacts/fixtures/declarations/declarations_required_for_scoping/bindingspec.yaml b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: declarations/declarations_required_for_scoping.h
+  cname: macro A
+  hsname: A
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CSize
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/declarations/declarations_required_for_scoping/th.txt b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/declarations_required_for_scoping/th.txt
@@ -0,0 +1,124 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile test-artefacts/headers/golden/declarations/declarations_required_for_scoping.h
+-- #include <declarations/declarations_required_for_scoping.h>
+-- void hs_bindgen_0d1c75136a36e326 (
+--   A arg1
+-- )
+-- {
+--   (f)(arg1);
+-- }
+-- void hs_bindgen_93ed1628a0edf6b0 (
+--   A arg1
+-- )
+-- {
+--   (f)(arg1);
+-- }
+-- /* test_declarationsdeclarations_requ_Example_get_f */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0d4da37880af2263 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &f;
+-- }
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 5:9@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+newtype A
+    = A {unwrapA :: HsBindgen.Runtime.LibC.CSize}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = HsBindgen.Runtime.LibC.CSize
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_0d1c75136a36e326" hs_bindgen_0d1c75136a36e326_base ::
+    HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Safe_f@
+hs_bindgen_0d1c75136a36e326 :: A -> IO ()
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Safe_f@
+hs_bindgen_0d1c75136a36e326 = \x_0 -> hs_bindgen_0d1c75136a36e326_base (toFFIType x_0)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 7:6@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+f_safe :: A -> IO ()
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 7:6@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+f_safe = hs_bindgen_0d1c75136a36e326
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_93ed1628a0edf6b0" hs_bindgen_93ed1628a0edf6b0_base ::
+    HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Unsafe_f@
+hs_bindgen_93ed1628a0edf6b0 :: A -> IO ()
+-- __unique:__ @test_declarationsdeclarations_requ_Example_Unsafe_f@
+hs_bindgen_93ed1628a0edf6b0 = \x_0 -> hs_bindgen_93ed1628a0edf6b0_base (toFFIType x_0)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 7:6@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+f_unsafe :: A -> IO ()
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 7:6@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+f_unsafe = hs_bindgen_93ed1628a0edf6b0
+-- __unique:__ @test_declarationsdeclarations_requ_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_0d4da37880af2263" hs_bindgen_0d4da37880af2263_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_declarationsdeclarations_requ_Example_get_f@
+hs_bindgen_0d4da37880af2263 :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_declarationsdeclarations_requ_Example_get_f@
+hs_bindgen_0d4da37880af2263 = fmap fromFFIType hs_bindgen_0d4da37880af2263_base
+{-# NOINLINE f_funptr #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 7:6@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+f_funptr :: FunPtr (A -> IO ())
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/declarations_required_for_scoping.h 7:6@
+
+    __exported by:__ @declarations\/declarations_required_for_scoping.h@
+-}
+f_funptr = unsafePerformIO hs_bindgen_0d4da37880af2263
diff --git a/test-artefacts/fixtures/declarations/definitions/Example.hs b/test-artefacts/fixtures/declarations/definitions/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/definitions/Example.hs
@@ -0,0 +1,179 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.X(..)
+    , Example.Y(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct X@
+
+    __defined at:__ @declarations\/definitions.h 23:8@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+data X = X
+  { x_n :: BG.CInt
+    {- ^ __C declaration:__ @n@
+
+         __defined at:__ @declarations\/definitions.h 23:16@
+
+         __exported by:__ @declarations\/definitions.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize X where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw X where
+
+  readRaw =
+    \ptr0 ->
+          pure X
+      <*> HasCField.readRaw (BG.Proxy @"x_n") ptr0
+
+instance Marshal.WriteRaw X where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          X x_n2 ->
+            HasCField.writeRaw (BG.Proxy @"x_n") ptr0 x_n2
+
+deriving via Marshal.EquivStorable X instance BG.Storable X
+
+deriving via Struct.IsStructViaReadRaw X instance Struct.IsStruct X
+
+{-| __C declaration:__ @n@
+
+    __defined at:__ @declarations\/definitions.h 23:16@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x_n" X ty where
+
+  hasField =
+    \x0 -> (\y1 -> X {x_n = y1}, BG.getField @"x_n" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "x_n" (BG.Ptr X) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x_n")
+
+instance HasCField.HasCField X "x_n" where
+
+  type CFieldType X "x_n" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union Y@
+
+    __defined at:__ @declarations\/definitions.h 26:7@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+newtype Y = Y
+  { unwrapY :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Y
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Y
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Y
+
+deriving via Marshal.EquivStorable Y instance BG.Storable Y
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Y
+
+{-| __C declaration:__ @m@
+
+    __defined at:__ @declarations\/definitions.h 26:15@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "y_m" Y ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @m@
+
+    __defined at:__ @declarations\/definitions.h 26:15@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "y_m" Y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"y_m" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "y_m" (BG.Ptr Y) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"y_m")
+
+instance HasCField.HasCField Y "y_m" where
+
+  type CFieldType Y "y_m" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @o@
+
+    __defined at:__ @declarations\/definitions.h 26:22@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "y_o" Y ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @o@
+
+    __defined at:__ @declarations\/definitions.h 26:22@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "y_o" Y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"y_o" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "y_o" (BG.Ptr Y) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"y_o")
+
+instance HasCField.HasCField Y "y_o" where
+
+  type CFieldType Y "y_o" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/declarations/definitions/Example/FunPtr.hs b/test-artefacts/fixtures/declarations/definitions/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/definitions/Example/FunPtr.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/definitions.h>"
+  , "/* test_declarationsdefinitions_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_8bb82cd68ce8efe4 (void)) ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsdefinitions_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_8bb82cd68ce8efe4" hs_bindgen_8bb82cd68ce8efe4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_declarationsdefinitions_Example_get_foo@
+hs_bindgen_8bb82cd68ce8efe4 :: IO (BG.FunPtr (BG.CDouble -> IO BG.CInt))
+hs_bindgen_8bb82cd68ce8efe4 =
+  fmap BG.fromFFIType hs_bindgen_8bb82cd68ce8efe4_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/definitions.h 13:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+foo :: BG.FunPtr (BG.CDouble -> IO BG.CInt)
+foo = BG.unsafePerformIO hs_bindgen_8bb82cd68ce8efe4
diff --git a/test-artefacts/fixtures/declarations/definitions/Example/Global.hs b/test-artefacts/fixtures/declarations/definitions/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/definitions/Example/Global.hs
@@ -0,0 +1,42 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.n
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/definitions.h>"
+  , "/* test_declarationsdefinitions_Example_get_n */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_417f0d4479c97357 (void)"
+  , "{"
+  , "  return &n;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsdefinitions_Example_get_n@
+foreign import ccall unsafe "hs_bindgen_417f0d4479c97357" hs_bindgen_417f0d4479c97357_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_declarationsdefinitions_Example_get_n@
+hs_bindgen_417f0d4479c97357 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_417f0d4479c97357 =
+  fmap BG.fromFFIType hs_bindgen_417f0d4479c97357_base
+
+{-# NOINLINE n #-}
+{-| __C declaration:__ @n@
+
+    __defined at:__ @declarations\/definitions.h 18:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+n :: BG.Ptr BG.CInt
+n = BG.unsafePerformIO hs_bindgen_417f0d4479c97357
diff --git a/test-artefacts/fixtures/declarations/definitions/Example/Safe.hs b/test-artefacts/fixtures/declarations/definitions/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/definitions/Example/Safe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/definitions.h>"
+  , "signed int hs_bindgen_9cdc88a6d09442d6 ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9cdc88a6d09442d6" hs_bindgen_9cdc88a6d09442d6_base ::
+     BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@
+hs_bindgen_9cdc88a6d09442d6 ::
+     BG.CDouble
+  -> IO BG.CInt
+hs_bindgen_9cdc88a6d09442d6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9cdc88a6d09442d6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/definitions.h 13:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+foo ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+foo = hs_bindgen_9cdc88a6d09442d6
diff --git a/test-artefacts/fixtures/declarations/definitions/Example/Unsafe.hs b/test-artefacts/fixtures/declarations/definitions/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/definitions/Example/Unsafe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/definitions.h>"
+  , "signed int hs_bindgen_07fd5b433f381094 ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_07fd5b433f381094" hs_bindgen_07fd5b433f381094_base ::
+     BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@
+hs_bindgen_07fd5b433f381094 ::
+     BG.CDouble
+  -> IO BG.CInt
+hs_bindgen_07fd5b433f381094 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_07fd5b433f381094_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/definitions.h 13:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+foo ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+foo = hs_bindgen_07fd5b433f381094
diff --git a/test-artefacts/fixtures/declarations/definitions/bindingspec.yaml b/test-artefacts/fixtures/declarations/definitions/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/definitions/bindingspec.yaml
@@ -0,0 +1,48 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: declarations/definitions.h
+  cname: struct X
+  hsname: X
+- headers: declarations/definitions.h
+  cname: union Y
+  hsname: 'Y'
+hstypes:
+- hsname: X
+  representation:
+    record:
+      constructor: X
+      fields:
+      - x_n
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: 'Y'
+  representation:
+    newtype:
+      constructor: 'Y'
+      fields:
+      - unwrapY
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/declarations/definitions/th.txt b/test-artefacts/fixtures/declarations/definitions/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/definitions/th.txt
@@ -0,0 +1,181 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/definitions.h
+-- #include <declarations/definitions.h>
+-- signed int hs_bindgen_9cdc88a6d09442d6 (
+--   double arg1
+-- )
+-- {
+--   return (foo)(arg1);
+-- }
+-- signed int hs_bindgen_07fd5b433f381094 (
+--   double arg1
+-- )
+-- {
+--   return (foo)(arg1);
+-- }
+-- /* test_declarationsdefinitions_Example_get_foo */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_8bb82cd68ce8efe4 (void)) (
+--   double arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_declarationsdefinitions_Example_get_n */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_417f0d4479c97357 (void)
+-- {
+--   return &n;
+-- }
+{-| __C declaration:__ @struct X@
+
+    __defined at:__ @declarations\/definitions.h 23:8@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+data X
+    = X {x_n :: CInt
+         {- ^ __C declaration:__ @n@
+
+              __defined at:__ @declarations\/definitions.h 23:16@
+
+              __exported by:__ @declarations\/definitions.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize X
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw X
+    where readRaw = \ptr_0 -> pure X <*> readRaw (Proxy @"x_n") ptr_0
+instance WriteRaw X
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       X x_n_2 -> writeRaw (Proxy @"x_n") ptr_0 x_n_2
+deriving via (EquivStorable X) instance Storable X
+deriving via (IsStructViaReadRaw X) instance IsStruct X
+instance (~) ty CInt => HasField "x_n" X ty
+    where hasField = \x_0 -> (\y_1 -> X{x_n = y_1},
+                              getField @"x_n" x_0)
+instance (~) ty CInt => HasField "x_n" (Ptr X) (Ptr ty)
+    where getField = fromPtr (Proxy @"x_n")
+instance HasCField X "x_n"
+    where type CFieldType X "x_n" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union Y@
+
+    __defined at:__ @declarations\/definitions.h 26:7@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+newtype Y = Y {unwrapY :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Y
+deriving via (SizedByteArray 4 4) instance ReadRaw Y
+deriving via (SizedByteArray 4 4) instance WriteRaw Y
+deriving via (EquivStorable Y) instance Storable Y
+deriving via (SizedByteArray 4 4) instance IsUnion Y
+instance (~) ty CInt => HasField "y_m" Y ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "y_m" Y ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"y_m" x_0)
+instance (~) ty CInt => HasField "y_m" (Ptr Y) (Ptr ty)
+    where getField = fromPtr (Proxy @"y_m")
+instance HasCField Y "y_m"
+    where type CFieldType Y "y_m" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "y_o" Y ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "y_o" Y ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"y_o" x_0)
+instance (~) ty CInt => HasField "y_o" (Ptr Y) (Ptr ty)
+    where getField = fromPtr (Proxy @"y_o")
+instance HasCField Y "y_o"
+    where type CFieldType Y "y_o" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9cdc88a6d09442d6" hs_bindgen_9cdc88a6d09442d6_base ::
+    CDouble
+ -> IO CInt
+-- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@
+hs_bindgen_9cdc88a6d09442d6 :: CDouble -> IO CInt
+-- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@
+hs_bindgen_9cdc88a6d09442d6 = \x_0 -> fmap fromFFIType (hs_bindgen_9cdc88a6d09442d6_base (toFFIType x_0))
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/definitions.h 13:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+foo_safe :: CDouble -> IO CInt
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/definitions.h 13:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+foo_safe = hs_bindgen_9cdc88a6d09442d6
+-- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_07fd5b433f381094" hs_bindgen_07fd5b433f381094_base ::
+    CDouble
+ -> IO CInt
+-- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@
+hs_bindgen_07fd5b433f381094 :: CDouble -> IO CInt
+-- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@
+hs_bindgen_07fd5b433f381094 = \x_0 -> fmap fromFFIType (hs_bindgen_07fd5b433f381094_base (toFFIType x_0))
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/definitions.h 13:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+foo_unsafe :: CDouble -> IO CInt
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/definitions.h 13:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+foo_unsafe = hs_bindgen_07fd5b433f381094
+-- __unique:__ @test_declarationsdefinitions_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_8bb82cd68ce8efe4" hs_bindgen_8bb82cd68ce8efe4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_declarationsdefinitions_Example_get_foo@
+hs_bindgen_8bb82cd68ce8efe4 :: IO (FunPtr (CDouble -> IO CInt))
+-- __unique:__ @test_declarationsdefinitions_Example_get_foo@
+hs_bindgen_8bb82cd68ce8efe4 = fmap fromFFIType hs_bindgen_8bb82cd68ce8efe4_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/definitions.h 13:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+foo_funptr :: FunPtr (CDouble -> IO CInt)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/definitions.h 13:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_8bb82cd68ce8efe4
+-- __unique:__ @test_declarationsdefinitions_Example_get_n@
+foreign import ccall unsafe "hs_bindgen_417f0d4479c97357" hs_bindgen_417f0d4479c97357_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_declarationsdefinitions_Example_get_n@
+hs_bindgen_417f0d4479c97357 :: IO (Ptr CInt)
+-- __unique:__ @test_declarationsdefinitions_Example_get_n@
+hs_bindgen_417f0d4479c97357 = fmap fromFFIType hs_bindgen_417f0d4479c97357_base
+{-# NOINLINE n #-}
+{-| __C declaration:__ @n@
+
+    __defined at:__ @declarations\/definitions.h 18:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+n :: Ptr CInt
+{-| __C declaration:__ @n@
+
+    __defined at:__ @declarations\/definitions.h 18:5@
+
+    __exported by:__ @declarations\/definitions.h@
+-}
+n = unsafePerformIO hs_bindgen_417f0d4479c97357
diff --git a/test-artefacts/fixtures/declarations/duplicate_field_name_omit/bindingspec.yaml b/test-artefacts/fixtures/declarations/duplicate_field_name_omit/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/duplicate_field_name_omit/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/declarations/duplicate_field_name_omit/th.txt b/test-artefacts/fixtures/declarations/duplicate_field_name_omit/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/duplicate_field_name_omit/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/duplicate_field_name_omit.h
diff --git a/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example.hs b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example.hs
@@ -0,0 +1,157 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    , Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 22:8@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+data S = S
+  { foo :: BG.CInt
+    {- ^ __C declaration:__ @foo@
+
+         __defined at:__ @declarations\/field_name_reuse_omit.h 22:16@
+
+         __exported by:__ @declarations\/field_name_reuse_omit.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"foo") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S foo2 ->
+            HasCField.writeRaw (BG.Proxy @"foo") ptr0 foo2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 22:16@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {foo = y1}, BG.getField @"foo" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "foo" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo")
+
+instance HasCField.HasCField S "foo" where
+
+  type CFieldType S "foo" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct T@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 27:8@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+data T = T
+  { bar :: BG.CInt
+    {- ^ __C declaration:__ @bar@
+
+         __defined at:__ @declarations\/field_name_reuse_omit.h 27:16@
+
+         __exported by:__ @declarations\/field_name_reuse_omit.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> HasCField.readRaw (BG.Proxy @"bar") ptr0
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T bar2 ->
+            HasCField.writeRaw (BG.Proxy @"bar") ptr0 bar2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via Struct.IsStructViaReadRaw T instance Struct.IsStruct T
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 27:16@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "bar" T ty where
+
+  hasField =
+    \x0 -> (\y1 -> T {bar = y1}, BG.getField @"bar" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "bar" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar")
+
+instance HasCField.HasCField T "bar" where
+
+  type CFieldType T "bar" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/FunPtr.hs b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/FunPtr.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/field_name_reuse_omit.h>"
+  , "/* test_declarationsfield_name_reuse__Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2b628f8ea7c448cd (void)) (void)"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_2b628f8ea7c448cd" hs_bindgen_2b628f8ea7c448cd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_bar@
+hs_bindgen_2b628f8ea7c448cd :: IO (BG.FunPtr (IO ()))
+hs_bindgen_2b628f8ea7c448cd =
+  fmap BG.fromFFIType hs_bindgen_2b628f8ea7c448cd_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 28:6@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+bar :: BG.FunPtr (IO ())
+bar = BG.unsafePerformIO hs_bindgen_2b628f8ea7c448cd
diff --git a/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/Global.hs b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/Global.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/field_name_reuse_omit.h>"
+  , "/* test_declarationsfield_name_reuse__Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_8612ede7c1c9d541 (void)"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_8612ede7c1c9d541" hs_bindgen_8612ede7c1c9d541_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_foo@
+hs_bindgen_8612ede7c1c9d541 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_8612ede7c1c9d541 =
+  fmap BG.fromFFIType hs_bindgen_8612ede7c1c9d541_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 23:12@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+foo :: BG.Ptr BG.CInt
+foo = BG.unsafePerformIO hs_bindgen_8612ede7c1c9d541
diff --git a/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/Safe.hs b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/Safe.hs
@@ -0,0 +1,39 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/field_name_reuse_omit.h>"
+  , "void hs_bindgen_1a3fb33e9aadacd9 (void)"
+  , "{"
+  , "  (bar)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_1a3fb33e9aadacd9" hs_bindgen_1a3fb33e9aadacd9_base ::
+     IO ()
+
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Safe_bar@
+hs_bindgen_1a3fb33e9aadacd9 :: IO ()
+hs_bindgen_1a3fb33e9aadacd9 =
+  hs_bindgen_1a3fb33e9aadacd9_base
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 28:6@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+bar :: IO ()
+bar = hs_bindgen_1a3fb33e9aadacd9
diff --git a/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/Unsafe.hs b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/field_name_reuse_omit/Example/Unsafe.hs
@@ -0,0 +1,39 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/field_name_reuse_omit.h>"
+  , "void hs_bindgen_b64ebb06c53fc1b3 (void)"
+  , "{"
+  , "  (bar)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_b64ebb06c53fc1b3" hs_bindgen_b64ebb06c53fc1b3_base ::
+     IO ()
+
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Unsafe_bar@
+hs_bindgen_b64ebb06c53fc1b3 :: IO ()
+hs_bindgen_b64ebb06c53fc1b3 =
+  hs_bindgen_b64ebb06c53fc1b3_base
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 28:6@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+bar :: IO ()
+bar = hs_bindgen_b64ebb06c53fc1b3
diff --git a/test-artefacts/fixtures/declarations/field_name_reuse_omit/bindingspec.yaml b/test-artefacts/fixtures/declarations/field_name_reuse_omit/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/field_name_reuse_omit/bindingspec.yaml
@@ -0,0 +1,50 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: declarations/field_name_reuse_omit.h
+  cname: struct S
+  hsname: S
+- headers: declarations/field_name_reuse_omit.h
+  cname: struct T
+  hsname: T
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - foo
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    record:
+      constructor: T
+      fields:
+      - bar
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/declarations/field_name_reuse_omit/th.txt b/test-artefacts/fixtures/declarations/field_name_reuse_omit/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/field_name_reuse_omit/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/field_name_reuse_omit.h
+-- #include <declarations/field_name_reuse_omit.h>
+-- void hs_bindgen_1a3fb33e9aadacd9 (void)
+-- {
+--   (bar)();
+-- }
+-- void hs_bindgen_b64ebb06c53fc1b3 (void)
+-- {
+--   (bar)();
+-- }
+-- /* test_declarationsfield_name_reuse__Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2b628f8ea7c448cd (void)) (void)
+-- {
+--   return &bar;
+-- }
+-- /* test_declarationsfield_name_reuse__Example_get_foo */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_8612ede7c1c9d541 (void)
+-- {
+--   return &foo;
+-- }
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 22:8@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+data S
+    = S {foo :: CInt
+         {- ^ __C declaration:__ @foo@
+
+              __defined at:__ @declarations\/field_name_reuse_omit.h 22:16@
+
+              __exported by:__ @declarations\/field_name_reuse_omit.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"foo") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S foo_2 -> writeRaw (Proxy @"foo") ptr_0 foo_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "foo" S ty
+    where hasField = \x_0 -> (\y_1 -> S{foo = y_1},
+                              getField @"foo" x_0)
+instance (~) ty CInt => HasField "foo" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo")
+instance HasCField S "foo"
+    where type CFieldType S "foo" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct T@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 27:8@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+data T
+    = T {bar :: CInt
+         {- ^ __C declaration:__ @bar@
+
+              __defined at:__ @declarations\/field_name_reuse_omit.h 27:16@
+
+              __exported by:__ @declarations\/field_name_reuse_omit.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRaw (Proxy @"bar") ptr_0
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T bar_2 -> writeRaw (Proxy @"bar") ptr_0 bar_2
+deriving via (EquivStorable T) instance Storable T
+deriving via (IsStructViaReadRaw T) instance IsStruct T
+instance (~) ty CInt => HasField "bar" T ty
+    where hasField = \x_0 -> (\y_1 -> T{bar = y_1},
+                              getField @"bar" x_0)
+instance (~) ty CInt => HasField "bar" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar")
+instance HasCField T "bar"
+    where type CFieldType T "bar" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_1a3fb33e9aadacd9" hs_bindgen_1a3fb33e9aadacd9_base ::
+    IO ()
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Safe_bar@
+hs_bindgen_1a3fb33e9aadacd9 :: IO ()
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Safe_bar@
+hs_bindgen_1a3fb33e9aadacd9 = hs_bindgen_1a3fb33e9aadacd9_base
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 28:6@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+bar_safe :: IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 28:6@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+bar_safe = hs_bindgen_1a3fb33e9aadacd9
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_b64ebb06c53fc1b3" hs_bindgen_b64ebb06c53fc1b3_base ::
+    IO ()
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Unsafe_bar@
+hs_bindgen_b64ebb06c53fc1b3 :: IO ()
+-- __unique:__ @test_declarationsfield_name_reuse__Example_Unsafe_bar@
+hs_bindgen_b64ebb06c53fc1b3 = hs_bindgen_b64ebb06c53fc1b3_base
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 28:6@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+bar_unsafe :: IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 28:6@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+bar_unsafe = hs_bindgen_b64ebb06c53fc1b3
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_2b628f8ea7c448cd" hs_bindgen_2b628f8ea7c448cd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_bar@
+hs_bindgen_2b628f8ea7c448cd :: IO (FunPtr (IO ()))
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_bar@
+hs_bindgen_2b628f8ea7c448cd = fmap fromFFIType hs_bindgen_2b628f8ea7c448cd_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 28:6@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+bar_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 28:6@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_2b628f8ea7c448cd
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_8612ede7c1c9d541" hs_bindgen_8612ede7c1c9d541_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_foo@
+hs_bindgen_8612ede7c1c9d541 :: IO (Ptr CInt)
+-- __unique:__ @test_declarationsfield_name_reuse__Example_get_foo@
+hs_bindgen_8612ede7c1c9d541 = fmap fromFFIType hs_bindgen_8612ede7c1c9d541_base
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 23:12@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+foo :: Ptr CInt
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @declarations\/field_name_reuse_omit.h 23:12@
+
+    __exported by:__ @declarations\/field_name_reuse_omit.h@
+-}
+foo = unsafePerformIO hs_bindgen_8612ede7c1c9d541
diff --git a/test-artefacts/fixtures/declarations/forward_declaration/Example.hs b/test-artefacts/fixtures/declarations/forward_declaration/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/forward_declaration/Example.hs
@@ -0,0 +1,157 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S1_t(..)
+    , Example.S2(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @declarations\/forward_declaration.h 3:8@
+
+    __exported by:__ @declarations\/forward_declaration.h@
+-}
+data S1_t = S1_t
+  { s1_t_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @declarations\/forward_declaration.h 4:7@
+
+         __exported by:__ @declarations\/forward_declaration.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S1_t where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S1_t where
+
+  readRaw =
+    \ptr0 ->
+          pure S1_t
+      <*> HasCField.readRaw (BG.Proxy @"s1_t_a") ptr0
+
+instance Marshal.WriteRaw S1_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S1_t s1_t_a2 ->
+            HasCField.writeRaw (BG.Proxy @"s1_t_a") ptr0 s1_t_a2
+
+deriving via Marshal.EquivStorable S1_t instance BG.Storable S1_t
+
+deriving via Struct.IsStructViaReadRaw S1_t instance Struct.IsStruct S1_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @declarations\/forward_declaration.h 4:7@
+
+    __exported by:__ @declarations\/forward_declaration.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s1_t_a" S1_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S1_t {s1_t_a = y1}, BG.getField @"s1_t_a" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s1_t_a" (BG.Ptr S1_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_t_a")
+
+instance HasCField.HasCField S1_t "s1_t_a" where
+
+  type CFieldType S1_t "s1_t_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @declarations\/forward_declaration.h 9:8@
+
+    __exported by:__ @declarations\/forward_declaration.h@
+-}
+data S2 = S2
+  { s2_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @declarations\/forward_declaration.h 10:7@
+
+         __exported by:__ @declarations\/forward_declaration.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S2 where
+
+  readRaw =
+    \ptr0 ->
+          pure S2
+      <*> HasCField.readRaw (BG.Proxy @"s2_a") ptr0
+
+instance Marshal.WriteRaw S2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2 s2_a2 ->
+            HasCField.writeRaw (BG.Proxy @"s2_a") ptr0 s2_a2
+
+deriving via Marshal.EquivStorable S2 instance BG.Storable S2
+
+deriving via Struct.IsStructViaReadRaw S2 instance Struct.IsStruct S2
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @declarations\/forward_declaration.h 10:7@
+
+    __exported by:__ @declarations\/forward_declaration.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s2_a" S2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S2 {s2_a = y1}, BG.getField @"s2_a" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s2_a" (BG.Ptr S2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_a")
+
+instance HasCField.HasCField S2 "s2_a" where
+
+  type CFieldType S2 "s2_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/declarations/forward_declaration/bindingspec.yaml b/test-artefacts/fixtures/declarations/forward_declaration/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/forward_declaration/bindingspec.yaml
@@ -0,0 +1,53 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: declarations/forward_declaration.h
+  cname: S1_t
+  hsname: S1_t
+- headers: declarations/forward_declaration.h
+  cname: struct S1
+  hsname: S1_t
+- headers: declarations/forward_declaration.h
+  cname: struct S2
+  hsname: S2
+hstypes:
+- hsname: S1_t
+  representation:
+    record:
+      constructor: S1_t
+      fields:
+      - s1_t_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2
+  representation:
+    record:
+      constructor: S2
+      fields:
+      - s2_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/declarations/forward_declaration/th.txt b/test-artefacts/fixtures/declarations/forward_declaration/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/forward_declaration/th.txt
@@ -0,0 +1,67 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/forward_declaration.h
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @declarations\/forward_declaration.h 3:8@
+
+    __exported by:__ @declarations\/forward_declaration.h@
+-}
+data S1_t
+    = S1_t {s1_t_a :: CInt
+            {- ^ __C declaration:__ @a@
+
+                 __defined at:__ @declarations\/forward_declaration.h 4:7@
+
+                 __exported by:__ @declarations\/forward_declaration.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S1_t
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S1_t
+    where readRaw = \ptr_0 -> pure S1_t <*> readRaw (Proxy @"s1_t_a") ptr_0
+instance WriteRaw S1_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S1_t s1_t_a_2 -> writeRaw (Proxy @"s1_t_a") ptr_0 s1_t_a_2
+deriving via (EquivStorable S1_t) instance Storable S1_t
+deriving via (IsStructViaReadRaw S1_t) instance IsStruct S1_t
+instance (~) ty CInt => HasField "s1_t_a" S1_t ty
+    where hasField = \x_0 -> (\y_1 -> S1_t{s1_t_a = y_1},
+                              getField @"s1_t_a" x_0)
+instance (~) ty CInt => HasField "s1_t_a" (Ptr S1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_t_a")
+instance HasCField S1_t "s1_t_a"
+    where type CFieldType S1_t "s1_t_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @declarations\/forward_declaration.h 9:8@
+
+    __exported by:__ @declarations\/forward_declaration.h@
+-}
+data S2
+    = S2 {s2_a :: CInt
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @declarations\/forward_declaration.h 10:7@
+
+               __exported by:__ @declarations\/forward_declaration.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S2
+    where readRaw = \ptr_0 -> pure S2 <*> readRaw (Proxy @"s2_a") ptr_0
+instance WriteRaw S2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2 s2_a_2 -> writeRaw (Proxy @"s2_a") ptr_0 s2_a_2
+deriving via (EquivStorable S2) instance Storable S2
+deriving via (IsStructViaReadRaw S2) instance IsStruct S2
+instance (~) ty CInt => HasField "s2_a" S2 ty
+    where hasField = \x_0 -> (\y_1 -> S2{s2_a = y_1},
+                              getField @"s2_a" x_0)
+instance (~) ty CInt => HasField "s2_a" (Ptr S2) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_a")
+instance HasCField S2 "s2_a"
+    where type CFieldType S2 "s2_a" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/declarations/name_collision/bindingspec.yaml b/test-artefacts/fixtures/declarations/name_collision/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/name_collision/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/declarations/name_collision/th.txt b/test-artefacts/fixtures/declarations/name_collision/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/name_collision/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/name_collision.h
diff --git a/test-artefacts/fixtures/declarations/name_collision_aux/bindingspec.yaml b/test-artefacts/fixtures/declarations/name_collision_aux/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/name_collision_aux/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/declarations/name_collision_aux/th.txt b/test-artefacts/fixtures/declarations/name_collision_aux/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/name_collision_aux/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/name_collision_aux.h
diff --git a/test-artefacts/fixtures/declarations/opaque_declaration/Example.hs b/test-artefacts/fixtures/declarations/opaque_declaration/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/opaque_declaration/Example.hs
@@ -0,0 +1,191 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo
+    , Example.Bar(..)
+    , Example.Baz(..)
+    , Example.Quu
+    , Example.Opaque_union
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @declarations\/opaque_declaration.h 1:8@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Foo
+
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @declarations\/opaque_declaration.h 4:8@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Bar = Bar
+  { bar_ptrA :: BG.Ptr Foo
+    {- ^ __C declaration:__ @ptrA@
+
+         __defined at:__ @declarations\/opaque_declaration.h 5:17@
+
+         __exported by:__ @declarations\/opaque_declaration.h@
+    -}
+  , bar_ptrB :: BG.Ptr Bar
+    {- ^ __C declaration:__ @ptrB@
+
+         __defined at:__ @declarations\/opaque_declaration.h 6:17@
+
+         __exported by:__ @declarations\/opaque_declaration.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Bar where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar
+      <*> HasCField.readRaw (BG.Proxy @"bar_ptrA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bar_ptrB") ptr0
+
+instance Marshal.WriteRaw Bar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar bar_ptrA2 bar_ptrB3 ->
+               HasCField.writeRaw (BG.Proxy @"bar_ptrA") ptr0 bar_ptrA2
+            >> HasCField.writeRaw (BG.Proxy @"bar_ptrB") ptr0 bar_ptrB3
+
+deriving via Marshal.EquivStorable Bar instance BG.Storable Bar
+
+deriving via Struct.IsStructViaReadRaw Bar instance Struct.IsStruct Bar
+
+{-| __C declaration:__ @ptrA@
+
+    __defined at:__ @declarations\/opaque_declaration.h 5:17@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+instance (ty ~ BG.Ptr Foo) => BG.CompatHasField.HasField "bar_ptrA" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_ptrA = y1, bar_ptrB = BG.getField @"bar_ptrB" x0}
+      , BG.getField @"bar_ptrA" x0
+      )
+
+instance ( ty ~ BG.Ptr Foo
+         ) => BG.HasField "bar_ptrA" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_ptrA")
+
+instance HasCField.HasCField Bar "bar_ptrA" where
+
+  type CFieldType Bar "bar_ptrA" = BG.Ptr Foo
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @ptrB@
+
+    __defined at:__ @declarations\/opaque_declaration.h 6:17@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+instance (ty ~ BG.Ptr Bar) => BG.CompatHasField.HasField "bar_ptrB" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_ptrB = y1, bar_ptrA = BG.getField @"bar_ptrA" x0}
+      , BG.getField @"bar_ptrB" x0
+      )
+
+instance ( ty ~ BG.Ptr Bar
+         ) => BG.HasField "bar_ptrB" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_ptrB")
+
+instance HasCField.HasCField Bar "bar_ptrB" where
+
+  type CFieldType Bar "bar_ptrB" = BG.Ptr Bar
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct baz@
+
+    __defined at:__ @declarations\/opaque_declaration.h 9:8@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Baz = Baz
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Baz where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Baz where
+
+  readRaw = \ptr0 -> pure Baz
+
+instance Marshal.WriteRaw Baz where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Baz -> pure ()
+
+deriving via Marshal.EquivStorable Baz instance BG.Storable Baz
+
+deriving via Struct.IsStructViaReadRaw Baz instance Struct.IsStruct Baz
+
+{-| __C declaration:__ @enum quu@
+
+    __defined at:__ @declarations\/opaque_declaration.h 11:6@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Quu
+
+{-| __C declaration:__ @union opaque_union@
+
+    __defined at:__ @declarations\/opaque_declaration.h 13:7@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Opaque_union
diff --git a/test-artefacts/fixtures/declarations/opaque_declaration/bindingspec.yaml b/test-artefacts/fixtures/declarations/opaque_declaration/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/opaque_declaration/bindingspec.yaml
@@ -0,0 +1,61 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: declarations/opaque_declaration.h
+  cname: struct foo
+  hsname: Foo
+- headers: declarations/opaque_declaration.h
+  cname: struct bar
+  hsname: Bar
+- headers: declarations/opaque_declaration.h
+  cname: struct baz
+  hsname: Baz
+- headers: declarations/opaque_declaration.h
+  cname: enum quu
+  hsname: Quu
+- headers: declarations/opaque_declaration.h
+  cname: union opaque_union
+  hsname: Opaque_union
+hstypes:
+- hsname: Bar
+  representation:
+    record:
+      constructor: Bar
+      fields:
+      - bar_ptrA
+      - bar_ptrB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Baz
+  representation:
+    record:
+      constructor: Baz
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation: emptydata
+- hsname: Opaque_union
+  representation: emptydata
+- hsname: Quu
+  representation: emptydata
diff --git a/test-artefacts/fixtures/declarations/opaque_declaration/th.txt b/test-artefacts/fixtures/declarations/opaque_declaration/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/opaque_declaration/th.txt
@@ -0,0 +1,90 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/opaque_declaration.h
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @declarations\/opaque_declaration.h 1:8@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Foo
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @declarations\/opaque_declaration.h 4:8@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Bar
+    = Bar {bar_ptrA :: (Ptr Foo)
+           {- ^ __C declaration:__ @ptrA@
+
+                __defined at:__ @declarations\/opaque_declaration.h 5:17@
+
+                __exported by:__ @declarations\/opaque_declaration.h@
+           -},
+           bar_ptrB :: (Ptr Bar)
+           {- ^ __C declaration:__ @ptrB@
+
+                __defined at:__ @declarations\/opaque_declaration.h 6:17@
+
+                __exported by:__ @declarations\/opaque_declaration.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Bar
+    where readRaw = \ptr_0 -> (pure Bar <*> readRaw (Proxy @"bar_ptrA") ptr_0) <*> readRaw (Proxy @"bar_ptrB") ptr_0
+instance WriteRaw Bar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar bar_ptrA_2
+                                           bar_ptrB_3 -> writeRaw (Proxy @"bar_ptrA") ptr_0 bar_ptrA_2 >> writeRaw (Proxy @"bar_ptrB") ptr_0 bar_ptrB_3
+deriving via (EquivStorable Bar) instance Storable Bar
+deriving via (IsStructViaReadRaw Bar) instance IsStruct Bar
+instance (~) ty (Ptr Foo) => HasField "bar_ptrA" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_ptrA = y_1,
+                                          bar_ptrB = getField @"bar_ptrB" x_0},
+                              getField @"bar_ptrA" x_0)
+instance (~) ty (Ptr Foo) => HasField "bar_ptrA" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_ptrA")
+instance HasCField Bar "bar_ptrA"
+    where type CFieldType Bar "bar_ptrA" = Ptr Foo
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Bar) => HasField "bar_ptrB" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_ptrB = y_1,
+                                          bar_ptrA = getField @"bar_ptrA" x_0},
+                              getField @"bar_ptrB" x_0)
+instance (~) ty (Ptr Bar) => HasField "bar_ptrB" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_ptrB")
+instance HasCField Bar "bar_ptrB"
+    where type CFieldType Bar "bar_ptrB" = Ptr Bar
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct baz@
+
+    __defined at:__ @declarations\/opaque_declaration.h 9:8@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Baz = Baz {} deriving stock (Eq, Generic, Show)
+instance StaticSize Baz
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Baz
+    where readRaw = \ptr_0 -> pure Baz
+instance WriteRaw Baz
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Baz -> pure ()
+deriving via (EquivStorable Baz) instance Storable Baz
+deriving via (IsStructViaReadRaw Baz) instance IsStruct Baz
+{-| __C declaration:__ @enum quu@
+
+    __defined at:__ @declarations\/opaque_declaration.h 11:6@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Quu
+{-| __C declaration:__ @union opaque_union@
+
+    __defined at:__ @declarations\/opaque_declaration.h 13:7@
+
+    __exported by:__ @declarations\/opaque_declaration.h@
+-}
+data Opaque_union
diff --git a/test-artefacts/fixtures/declarations/redeclaration/Example.hs b/test-artefacts/fixtures/declarations/redeclaration/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/redeclaration/Example.hs
@@ -0,0 +1,230 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Int_t(..)
+    , Example.X(..)
+    , Example.Y(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @int_t@
+
+    __defined at:__ @declarations\/redeclaration.h 20:13@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+newtype Int_t = Int_t
+  { unwrapInt_t :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapInt_t" Int_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Int_t {unwrapInt_t = y1}, BG.getField @"unwrapInt_t" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapInt_t" (BG.Ptr Int_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt_t")
+
+instance HasCField.HasCField Int_t "unwrapInt_t" where
+
+  type CFieldType Int_t "unwrapInt_t" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct X@
+
+    __defined at:__ @declarations\/redeclaration.h 26:8@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+data X = X
+  { x_n :: BG.CInt
+    {- ^ __C declaration:__ @n@
+
+         __defined at:__ @declarations\/redeclaration.h 26:16@
+
+         __exported by:__ @declarations\/redeclaration.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize X where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw X where
+
+  readRaw =
+    \ptr0 ->
+          pure X
+      <*> HasCField.readRaw (BG.Proxy @"x_n") ptr0
+
+instance Marshal.WriteRaw X where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          X x_n2 ->
+            HasCField.writeRaw (BG.Proxy @"x_n") ptr0 x_n2
+
+deriving via Marshal.EquivStorable X instance BG.Storable X
+
+deriving via Struct.IsStructViaReadRaw X instance Struct.IsStruct X
+
+{-| __C declaration:__ @n@
+
+    __defined at:__ @declarations\/redeclaration.h 26:16@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x_n" X ty where
+
+  hasField =
+    \x0 -> (\y1 -> X {x_n = y1}, BG.getField @"x_n" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "x_n" (BG.Ptr X) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x_n")
+
+instance HasCField.HasCField X "x_n" where
+
+  type CFieldType X "x_n" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union Y@
+
+    __defined at:__ @declarations\/redeclaration.h 30:7@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+newtype Y = Y
+  { unwrapY :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Y
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Y
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Y
+
+deriving via Marshal.EquivStorable Y instance BG.Storable Y
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Y
+
+{-| __C declaration:__ @m@
+
+    __defined at:__ @declarations\/redeclaration.h 30:15@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "y_m" Y ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @m@
+
+    __defined at:__ @declarations\/redeclaration.h 30:15@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "y_m" Y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"y_m" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "y_m" (BG.Ptr Y) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"y_m")
+
+instance HasCField.HasCField Y "y_m" where
+
+  type CFieldType Y "y_m" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @o@
+
+    __defined at:__ @declarations\/redeclaration.h 30:22@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "y_o" Y ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @o@
+
+    __defined at:__ @declarations\/redeclaration.h 30:22@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "y_o" Y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"y_o" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "y_o" (BG.Ptr Y) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"y_o")
+
+instance HasCField.HasCField Y "y_o" where
+
+  type CFieldType Y "y_o" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/declarations/redeclaration/Example/Global.hs b/test-artefacts/fixtures/declarations/redeclaration/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/redeclaration/Example/Global.hs
@@ -0,0 +1,68 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.x
+    , Example.Global.n
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/redeclaration.h>"
+  , "/* test_declarationsredeclaration_Example_get_x */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_6f47e5cbb92690b9 (void)"
+  , "{"
+  , "  return &x;"
+  , "}"
+  , "/* test_declarationsredeclaration_Example_get_n */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_8afd78f6e3766c89 (void)"
+  , "{"
+  , "  return &n;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsredeclaration_Example_get_x@
+foreign import ccall unsafe "hs_bindgen_6f47e5cbb92690b9" hs_bindgen_6f47e5cbb92690b9_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_declarationsredeclaration_Example_get_x@
+hs_bindgen_6f47e5cbb92690b9 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_6f47e5cbb92690b9 =
+  fmap BG.fromFFIType hs_bindgen_6f47e5cbb92690b9_base
+
+{-# NOINLINE x #-}
+{-| __C declaration:__ @x@
+
+    __defined at:__ @declarations\/redeclaration.h 11:5@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+x :: BG.Ptr BG.CInt
+x = BG.unsafePerformIO hs_bindgen_6f47e5cbb92690b9
+
+-- __unique:__ @test_declarationsredeclaration_Example_get_n@
+foreign import ccall unsafe "hs_bindgen_8afd78f6e3766c89" hs_bindgen_8afd78f6e3766c89_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_declarationsredeclaration_Example_get_n@
+hs_bindgen_8afd78f6e3766c89 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_8afd78f6e3766c89 =
+  fmap BG.fromFFIType hs_bindgen_8afd78f6e3766c89_base
+
+{-# NOINLINE n #-}
+{-| __C declaration:__ @n@
+
+    __defined at:__ @declarations\/redeclaration.h 15:12@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+n :: BG.Ptr BG.CInt
+n = BG.unsafePerformIO hs_bindgen_8afd78f6e3766c89
diff --git a/test-artefacts/fixtures/declarations/redeclaration/bindingspec.yaml b/test-artefacts/fixtures/declarations/redeclaration/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/redeclaration/bindingspec.yaml
@@ -0,0 +1,85 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: declarations/redeclaration.h
+  cname: int_t
+  hsname: Int_t
+- headers: declarations/redeclaration.h
+  cname: struct X
+  hsname: X
+- headers: declarations/redeclaration.h
+  cname: union Y
+  hsname: 'Y'
+hstypes:
+- hsname: Int_t
+  representation:
+    newtype:
+      constructor: Int_t
+      fields:
+      - unwrapInt_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: X
+  representation:
+    record:
+      constructor: X
+      fields:
+      - x_n
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: 'Y'
+  representation:
+    newtype:
+      constructor: 'Y'
+      fields:
+      - unwrapY
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/declarations/redeclaration/th.txt b/test-artefacts/fixtures/declarations/redeclaration/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/redeclaration/th.txt
@@ -0,0 +1,155 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/redeclaration.h
+-- #include <declarations/redeclaration.h>
+-- /* test_declarationsredeclaration_Example_get_x */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_6f47e5cbb92690b9 (void)
+-- {
+--   return &x;
+-- }
+-- /* test_declarationsredeclaration_Example_get_n */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_8afd78f6e3766c89 (void)
+-- {
+--   return &n;
+-- }
+{-| __C declaration:__ @int_t@
+
+    __defined at:__ @declarations\/redeclaration.h 20:13@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+newtype Int_t
+    = Int_t {unwrapInt_t :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapInt_t" Int_t ty
+    where hasField = \x_0 -> (\y_1 -> Int_t{unwrapInt_t = y_1},
+                              getField @"unwrapInt_t" x_0)
+instance (~) ty CInt => HasField "unwrapInt_t" (Ptr Int_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt_t")
+instance HasCField Int_t "unwrapInt_t"
+    where type CFieldType Int_t "unwrapInt_t" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct X@
+
+    __defined at:__ @declarations\/redeclaration.h 26:8@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+data X
+    = X {x_n :: CInt
+         {- ^ __C declaration:__ @n@
+
+              __defined at:__ @declarations\/redeclaration.h 26:16@
+
+              __exported by:__ @declarations\/redeclaration.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize X
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw X
+    where readRaw = \ptr_0 -> pure X <*> readRaw (Proxy @"x_n") ptr_0
+instance WriteRaw X
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       X x_n_2 -> writeRaw (Proxy @"x_n") ptr_0 x_n_2
+deriving via (EquivStorable X) instance Storable X
+deriving via (IsStructViaReadRaw X) instance IsStruct X
+instance (~) ty CInt => HasField "x_n" X ty
+    where hasField = \x_0 -> (\y_1 -> X{x_n = y_1},
+                              getField @"x_n" x_0)
+instance (~) ty CInt => HasField "x_n" (Ptr X) (Ptr ty)
+    where getField = fromPtr (Proxy @"x_n")
+instance HasCField X "x_n"
+    where type CFieldType X "x_n" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union Y@
+
+    __defined at:__ @declarations\/redeclaration.h 30:7@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+newtype Y = Y {unwrapY :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Y
+deriving via (SizedByteArray 4 4) instance ReadRaw Y
+deriving via (SizedByteArray 4 4) instance WriteRaw Y
+deriving via (EquivStorable Y) instance Storable Y
+deriving via (SizedByteArray 4 4) instance IsUnion Y
+instance (~) ty CInt => HasField "y_m" Y ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "y_m" Y ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"y_m" x_0)
+instance (~) ty CInt => HasField "y_m" (Ptr Y) (Ptr ty)
+    where getField = fromPtr (Proxy @"y_m")
+instance HasCField Y "y_m"
+    where type CFieldType Y "y_m" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "y_o" Y ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "y_o" Y ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"y_o" x_0)
+instance (~) ty CInt => HasField "y_o" (Ptr Y) (Ptr ty)
+    where getField = fromPtr (Proxy @"y_o")
+instance HasCField Y "y_o"
+    where type CFieldType Y "y_o" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_declarationsredeclaration_Example_get_x@
+foreign import ccall unsafe "hs_bindgen_6f47e5cbb92690b9" hs_bindgen_6f47e5cbb92690b9_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_declarationsredeclaration_Example_get_x@
+hs_bindgen_6f47e5cbb92690b9 :: IO (Ptr CInt)
+-- __unique:__ @test_declarationsredeclaration_Example_get_x@
+hs_bindgen_6f47e5cbb92690b9 = fmap fromFFIType hs_bindgen_6f47e5cbb92690b9_base
+{-# NOINLINE x #-}
+{-| __C declaration:__ @x@
+
+    __defined at:__ @declarations\/redeclaration.h 11:5@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+x :: Ptr CInt
+{-| __C declaration:__ @x@
+
+    __defined at:__ @declarations\/redeclaration.h 11:5@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+x = unsafePerformIO hs_bindgen_6f47e5cbb92690b9
+-- __unique:__ @test_declarationsredeclaration_Example_get_n@
+foreign import ccall unsafe "hs_bindgen_8afd78f6e3766c89" hs_bindgen_8afd78f6e3766c89_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_declarationsredeclaration_Example_get_n@
+hs_bindgen_8afd78f6e3766c89 :: IO (Ptr CInt)
+-- __unique:__ @test_declarationsredeclaration_Example_get_n@
+hs_bindgen_8afd78f6e3766c89 = fmap fromFFIType hs_bindgen_8afd78f6e3766c89_base
+{-# NOINLINE n #-}
+{-| __C declaration:__ @n@
+
+    __defined at:__ @declarations\/redeclaration.h 15:12@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+n :: Ptr CInt
+{-| __C declaration:__ @n@
+
+    __defined at:__ @declarations\/redeclaration.h 15:12@
+
+    __exported by:__ @declarations\/redeclaration.h@
+-}
+n = unsafePerformIO hs_bindgen_8afd78f6e3766c89
diff --git a/test-artefacts/fixtures/declarations/redeclaration_main_header/Example/FunPtr.hs b/test-artefacts/fixtures/declarations/redeclaration_main_header/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/redeclaration_main_header/Example/FunPtr.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/redeclaration_main_header.h>"
+  , "/* test_declarationsredeclaration_mai_Example_get_f */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ee8e2a043c1d908e (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsredeclaration_mai_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_ee8e2a043c1d908e" hs_bindgen_ee8e2a043c1d908e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_declarationsredeclaration_mai_Example_get_f@
+hs_bindgen_ee8e2a043c1d908e :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_ee8e2a043c1d908e =
+  fmap BG.fromFFIType hs_bindgen_ee8e2a043c1d908e_base
+
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/redeclaration_main_header.h 5:5@
+
+    __exported by:__ @declarations\/redeclaration_main_header.h@
+-}
+f :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+f = BG.unsafePerformIO hs_bindgen_ee8e2a043c1d908e
diff --git a/test-artefacts/fixtures/declarations/redeclaration_main_header/Example/Safe.hs b/test-artefacts/fixtures/declarations/redeclaration_main_header/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/redeclaration_main_header/Example/Safe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/redeclaration_main_header.h>"
+  , "signed int hs_bindgen_8fd6b7730e61d30c ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_8fd6b7730e61d30c" hs_bindgen_8fd6b7730e61d30c_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Safe_f@
+hs_bindgen_8fd6b7730e61d30c ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_8fd6b7730e61d30c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8fd6b7730e61d30c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/redeclaration_main_header.h 5:5@
+
+    __exported by:__ @declarations\/redeclaration_main_header.h@
+-}
+f ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f = hs_bindgen_8fd6b7730e61d30c
diff --git a/test-artefacts/fixtures/declarations/redeclaration_main_header/Example/Unsafe.hs b/test-artefacts/fixtures/declarations/redeclaration_main_header/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/redeclaration_main_header/Example/Unsafe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/redeclaration_main_header.h>"
+  , "signed int hs_bindgen_78fcd91e79ff5b5f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_78fcd91e79ff5b5f" hs_bindgen_78fcd91e79ff5b5f_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Unsafe_f@
+hs_bindgen_78fcd91e79ff5b5f ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_78fcd91e79ff5b5f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_78fcd91e79ff5b5f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/redeclaration_main_header.h 5:5@
+
+    __exported by:__ @declarations\/redeclaration_main_header.h@
+-}
+f ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f = hs_bindgen_78fcd91e79ff5b5f
diff --git a/test-artefacts/fixtures/declarations/redeclaration_main_header/bindingspec.yaml b/test-artefacts/fixtures/declarations/redeclaration_main_header/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/redeclaration_main_header/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/declarations/redeclaration_main_header/th.txt b/test-artefacts/fixtures/declarations/redeclaration_main_header/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/redeclaration_main_header/th.txt
@@ -0,0 +1,89 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/redeclaration_main_header_inner.h
+-- addDependentFile test-artefacts/headers/golden/declarations/redeclaration_main_header.h
+-- #include <declarations/redeclaration_main_header.h>
+-- signed int hs_bindgen_8fd6b7730e61d30c (
+--   signed int arg1
+-- )
+-- {
+--   return (f)(arg1);
+-- }
+-- signed int hs_bindgen_78fcd91e79ff5b5f (
+--   signed int arg1
+-- )
+-- {
+--   return (f)(arg1);
+-- }
+-- /* test_declarationsredeclaration_mai_Example_get_f */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ee8e2a043c1d908e (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f;
+-- }
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_8fd6b7730e61d30c" hs_bindgen_8fd6b7730e61d30c_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Safe_f@
+hs_bindgen_8fd6b7730e61d30c :: CInt -> IO CInt
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Safe_f@
+hs_bindgen_8fd6b7730e61d30c = \x_0 -> fmap fromFFIType (hs_bindgen_8fd6b7730e61d30c_base (toFFIType x_0))
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/redeclaration_main_header.h 5:5@
+
+    __exported by:__ @declarations\/redeclaration_main_header.h@
+-}
+f_safe :: CInt -> IO CInt
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/redeclaration_main_header.h 5:5@
+
+    __exported by:__ @declarations\/redeclaration_main_header.h@
+-}
+f_safe = hs_bindgen_8fd6b7730e61d30c
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_78fcd91e79ff5b5f" hs_bindgen_78fcd91e79ff5b5f_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Unsafe_f@
+hs_bindgen_78fcd91e79ff5b5f :: CInt -> IO CInt
+-- __unique:__ @test_declarationsredeclaration_mai_Example_Unsafe_f@
+hs_bindgen_78fcd91e79ff5b5f = \x_0 -> fmap fromFFIType (hs_bindgen_78fcd91e79ff5b5f_base (toFFIType x_0))
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/redeclaration_main_header.h 5:5@
+
+    __exported by:__ @declarations\/redeclaration_main_header.h@
+-}
+f_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/redeclaration_main_header.h 5:5@
+
+    __exported by:__ @declarations\/redeclaration_main_header.h@
+-}
+f_unsafe = hs_bindgen_78fcd91e79ff5b5f
+-- __unique:__ @test_declarationsredeclaration_mai_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_ee8e2a043c1d908e" hs_bindgen_ee8e2a043c1d908e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_declarationsredeclaration_mai_Example_get_f@
+hs_bindgen_ee8e2a043c1d908e :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_declarationsredeclaration_mai_Example_get_f@
+hs_bindgen_ee8e2a043c1d908e = fmap fromFFIType hs_bindgen_ee8e2a043c1d908e_base
+{-# NOINLINE f_funptr #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/redeclaration_main_header.h 5:5@
+
+    __exported by:__ @declarations\/redeclaration_main_header.h@
+-}
+f_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @declarations\/redeclaration_main_header.h 5:5@
+
+    __exported by:__ @declarations\/redeclaration_main_header.h@
+-}
+f_funptr = unsafePerformIO hs_bindgen_ee8e2a043c1d908e
diff --git a/test-artefacts/fixtures/declarations/select_scoping/Example.hs b/test-artefacts/fixtures/declarations/select_scoping/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/select_scoping/Example.hs
@@ -0,0 +1,76 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.ParsedAndSelected1(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @ParsedAndSelected1@
+
+    __defined at:__ @declarations\/select_scoping.h 6:13@
+
+    __exported by:__ @declarations\/select_scoping.h@
+-}
+newtype ParsedAndSelected1 = ParsedAndSelected1
+  { unwrapParsedAndSelected1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapParsedAndSelected1" ParsedAndSelected1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ParsedAndSelected1 {unwrapParsedAndSelected1 = y1}
+      , BG.getField @"unwrapParsedAndSelected1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapParsedAndSelected1" (BG.Ptr ParsedAndSelected1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapParsedAndSelected1")
+
+instance HasCField.HasCField ParsedAndSelected1 "unwrapParsedAndSelected1" where
+
+  type CFieldType ParsedAndSelected1 "unwrapParsedAndSelected1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/declarations/select_scoping/bindingspec.yaml b/test-artefacts/fixtures/declarations/select_scoping/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/select_scoping/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: declarations/select_scoping.h
+  cname: ParsedAndSelected1
+  hsname: ParsedAndSelected1
+hstypes:
+- hsname: ParsedAndSelected1
+  representation:
+    newtype:
+      constructor: ParsedAndSelected1
+      fields:
+      - unwrapParsedAndSelected1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/declarations/select_scoping/th.txt b/test-artefacts/fixtures/declarations/select_scoping/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/select_scoping/th.txt
@@ -0,0 +1,39 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/select_scoping_header.h
+-- addDependentFile test-artefacts/headers/golden/declarations/select_scoping.h
+{-| __C declaration:__ @ParsedAndSelected1@
+
+    __defined at:__ @declarations\/select_scoping.h 6:13@
+
+    __exported by:__ @declarations\/select_scoping.h@
+-}
+newtype ParsedAndSelected1
+    = ParsedAndSelected1 {unwrapParsedAndSelected1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapParsedAndSelected1" ParsedAndSelected1 ty
+    where hasField = \x_0 -> (\y_1 -> ParsedAndSelected1{unwrapParsedAndSelected1 = y_1},
+                              getField @"unwrapParsedAndSelected1" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapParsedAndSelected1"
+                  (Ptr ParsedAndSelected1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapParsedAndSelected1")
+instance HasCField ParsedAndSelected1 "unwrapParsedAndSelected1"
+    where type CFieldType ParsedAndSelected1
+                          "unwrapParsedAndSelected1" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/declarations/tentative_definitions/Example/Global.hs b/test-artefacts/fixtures/declarations/tentative_definitions/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/tentative_definitions/Example/Global.hs
@@ -0,0 +1,94 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.i1
+    , Example.Global.i2
+    , Example.Global.i3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <declarations/tentative_definitions.h>"
+  , "/* test_declarationstentative_definit_Example_get_i1 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_3a9fc2bb34e15eb6 (void)"
+  , "{"
+  , "  return &i1;"
+  , "}"
+  , "/* test_declarationstentative_definit_Example_get_i2 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_831c291120790ea6 (void)"
+  , "{"
+  , "  return &i2;"
+  , "}"
+  , "/* test_declarationstentative_definit_Example_get_i3 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_6c7d3ba4369a4d65 (void)"
+  , "{"
+  , "  return &i3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_declarationstentative_definit_Example_get_i1@
+foreign import ccall unsafe "hs_bindgen_3a9fc2bb34e15eb6" hs_bindgen_3a9fc2bb34e15eb6_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_declarationstentative_definit_Example_get_i1@
+hs_bindgen_3a9fc2bb34e15eb6 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_3a9fc2bb34e15eb6 =
+  fmap BG.fromFFIType hs_bindgen_3a9fc2bb34e15eb6_base
+
+{-# NOINLINE i1 #-}
+{-| __C declaration:__ @i1@
+
+    __defined at:__ @declarations\/tentative_definitions.h 17:5@
+
+    __exported by:__ @declarations\/tentative_definitions.h@
+-}
+i1 :: BG.Ptr BG.CInt
+i1 = BG.unsafePerformIO hs_bindgen_3a9fc2bb34e15eb6
+
+-- __unique:__ @test_declarationstentative_definit_Example_get_i2@
+foreign import ccall unsafe "hs_bindgen_831c291120790ea6" hs_bindgen_831c291120790ea6_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_declarationstentative_definit_Example_get_i2@
+hs_bindgen_831c291120790ea6 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_831c291120790ea6 =
+  fmap BG.fromFFIType hs_bindgen_831c291120790ea6_base
+
+{-# NOINLINE i2 #-}
+{-| __C declaration:__ @i2@
+
+    __defined at:__ @declarations\/tentative_definitions.h 21:12@
+
+    __exported by:__ @declarations\/tentative_definitions.h@
+-}
+i2 :: BG.Ptr BG.CInt
+i2 = BG.unsafePerformIO hs_bindgen_831c291120790ea6
+
+-- __unique:__ @test_declarationstentative_definit_Example_get_i3@
+foreign import ccall unsafe "hs_bindgen_6c7d3ba4369a4d65" hs_bindgen_6c7d3ba4369a4d65_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_declarationstentative_definit_Example_get_i3@
+hs_bindgen_6c7d3ba4369a4d65 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_6c7d3ba4369a4d65 =
+  fmap BG.fromFFIType hs_bindgen_6c7d3ba4369a4d65_base
+
+{-# NOINLINE i3 #-}
+{-| __C declaration:__ @i3@
+
+    __defined at:__ @declarations\/tentative_definitions.h 30:5@
+
+    __exported by:__ @declarations\/tentative_definitions.h@
+-}
+i3 :: BG.Ptr BG.CInt
+i3 = BG.unsafePerformIO hs_bindgen_6c7d3ba4369a4d65
diff --git a/test-artefacts/fixtures/declarations/tentative_definitions/bindingspec.yaml b/test-artefacts/fixtures/declarations/tentative_definitions/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/tentative_definitions/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/declarations/tentative_definitions/th.txt b/test-artefacts/fixtures/declarations/tentative_definitions/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/declarations/tentative_definitions/th.txt
@@ -0,0 +1,86 @@
+-- addDependentFile test-artefacts/headers/golden/declarations/tentative_definitions.h
+-- #include <declarations/tentative_definitions.h>
+-- /* test_declarationstentative_definit_Example_get_i1 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_3a9fc2bb34e15eb6 (void)
+-- {
+--   return &i1;
+-- }
+-- /* test_declarationstentative_definit_Example_get_i2 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_831c291120790ea6 (void)
+-- {
+--   return &i2;
+-- }
+-- /* test_declarationstentative_definit_Example_get_i3 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_6c7d3ba4369a4d65 (void)
+-- {
+--   return &i3;
+-- }
+-- __unique:__ @test_declarationstentative_definit_Example_get_i1@
+foreign import ccall unsafe "hs_bindgen_3a9fc2bb34e15eb6" hs_bindgen_3a9fc2bb34e15eb6_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_declarationstentative_definit_Example_get_i1@
+hs_bindgen_3a9fc2bb34e15eb6 :: IO (Ptr CInt)
+-- __unique:__ @test_declarationstentative_definit_Example_get_i1@
+hs_bindgen_3a9fc2bb34e15eb6 = fmap fromFFIType hs_bindgen_3a9fc2bb34e15eb6_base
+{-# NOINLINE i1 #-}
+{-| __C declaration:__ @i1@
+
+    __defined at:__ @declarations\/tentative_definitions.h 17:5@
+
+    __exported by:__ @declarations\/tentative_definitions.h@
+-}
+i1 :: Ptr CInt
+{-| __C declaration:__ @i1@
+
+    __defined at:__ @declarations\/tentative_definitions.h 17:5@
+
+    __exported by:__ @declarations\/tentative_definitions.h@
+-}
+i1 = unsafePerformIO hs_bindgen_3a9fc2bb34e15eb6
+-- __unique:__ @test_declarationstentative_definit_Example_get_i2@
+foreign import ccall unsafe "hs_bindgen_831c291120790ea6" hs_bindgen_831c291120790ea6_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_declarationstentative_definit_Example_get_i2@
+hs_bindgen_831c291120790ea6 :: IO (Ptr CInt)
+-- __unique:__ @test_declarationstentative_definit_Example_get_i2@
+hs_bindgen_831c291120790ea6 = fmap fromFFIType hs_bindgen_831c291120790ea6_base
+{-# NOINLINE i2 #-}
+{-| __C declaration:__ @i2@
+
+    __defined at:__ @declarations\/tentative_definitions.h 21:12@
+
+    __exported by:__ @declarations\/tentative_definitions.h@
+-}
+i2 :: Ptr CInt
+{-| __C declaration:__ @i2@
+
+    __defined at:__ @declarations\/tentative_definitions.h 21:12@
+
+    __exported by:__ @declarations\/tentative_definitions.h@
+-}
+i2 = unsafePerformIO hs_bindgen_831c291120790ea6
+-- __unique:__ @test_declarationstentative_definit_Example_get_i3@
+foreign import ccall unsafe "hs_bindgen_6c7d3ba4369a4d65" hs_bindgen_6c7d3ba4369a4d65_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_declarationstentative_definit_Example_get_i3@
+hs_bindgen_6c7d3ba4369a4d65 :: IO (Ptr CInt)
+-- __unique:__ @test_declarationstentative_definit_Example_get_i3@
+hs_bindgen_6c7d3ba4369a4d65 = fmap fromFFIType hs_bindgen_6c7d3ba4369a4d65_base
+{-# NOINLINE i3 #-}
+{-| __C declaration:__ @i3@
+
+    __defined at:__ @declarations\/tentative_definitions.h 30:5@
+
+    __exported by:__ @declarations\/tentative_definitions.h@
+-}
+i3 :: Ptr CInt
+{-| __C declaration:__ @i3@
+
+    __defined at:__ @declarations\/tentative_definitions.h 30:5@
+
+    __exported by:__ @declarations\/tentative_definitions.h@
+-}
+i3 = unsafePerformIO hs_bindgen_6c7d3ba4369a4d65
diff --git a/test-artefacts/fixtures/documentation/data_kind_pragma/Example.hs b/test-artefacts/fixtures/documentation/data_kind_pragma/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/data_kind_pragma/Example.hs
@@ -0,0 +1,65 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Triplet(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Eq, Show, type (~))
+
+{-| __C declaration:__ @triplet@
+
+    __defined at:__ @documentation\/data_kind_pragma.h 3:13@
+
+    __exported by:__ @documentation\/data_kind_pragma.h@
+-}
+newtype Triplet = Triplet
+  { unwrapTriplet :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapTriplet" Triplet ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Triplet {unwrapTriplet = y1}, BG.getField @"unwrapTriplet" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapTriplet" (BG.Ptr Triplet) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTriplet")
+
+instance HasCField.HasCField Triplet "unwrapTriplet" where
+
+  type CFieldType Triplet "unwrapTriplet" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/documentation/data_kind_pragma/bindingspec.yaml b/test-artefacts/fixtures/documentation/data_kind_pragma/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/data_kind_pragma/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: documentation/data_kind_pragma.h
+  cname: triplet
+  hsname: Triplet
+hstypes:
+- hsname: Triplet
+  representation:
+    newtype:
+      constructor: Triplet
+      fields:
+      - unwrapTriplet
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/documentation/data_kind_pragma/th.txt b/test-artefacts/fixtures/documentation/data_kind_pragma/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/data_kind_pragma/th.txt
@@ -0,0 +1,22 @@
+-- addDependentFile test-artefacts/headers/golden/documentation/data_kind_pragma.h
+{-| __C declaration:__ @triplet@
+
+    __defined at:__ @documentation\/data_kind_pragma.h 3:13@
+
+    __exported by:__ @documentation\/data_kind_pragma.h@
+-}
+newtype Triplet
+    = Triplet {unwrapTriplet :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapTriplet" Triplet ty
+    where hasField = \x_0 -> (\y_1 -> Triplet{unwrapTriplet = y_1},
+                              getField @"unwrapTriplet" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapTriplet" (Ptr Triplet) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTriplet")
+instance HasCField Triplet "unwrapTriplet"
+    where type CFieldType Triplet "unwrapTriplet" = ConstantArray 3
+                                                                  CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/documentation/doxygen_docs/Example.hs b/test-artefacts/fixtures/documentation/doxygen_docs/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/doxygen_docs/Example.hs
@@ -0,0 +1,3219 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Opaque_struct
+    , Example.Opaque_union
+    , Example.Api_version_t(..)
+      -- * Core Data Types
+    , Example.mAX_NAME_LENGTH
+    , Example.Size_type(..)
+    , Example.Color_enum(..)
+    , pattern Example.COLOR_RED
+    , pattern Example.COLOR_GREEN
+    , pattern Example.COLOR_BLUE
+      -- * Function Definitions
+    , Example.Event_callback_t_Aux(..)
+    , Example.Event_callback_t(..)
+    , Example.Config_t(..)
+    , Example.Status_code_t(..)
+    , pattern Example.STATUS_OK
+    , pattern Example.STATUS_INVALID_PARAM
+    , pattern Example.STATUS_NO_MEMORY
+    , pattern Example.STATUS_TIMEOUT
+    , pattern Example.STATUS_ERROR
+    , Example.Data_union_t_as_parts(..)
+    , Example.Data_union_t(..)
+    , Example.Bitfield_t(..)
+    , Example.Processor_fn_t_Aux(..)
+    , Example.Processor_fn_t(..)
+    , Example.Filename_t(..)
+    , Example.Flexible_array_Aux(..)
+    , Example.Flexible_array
+      -- * Extra Doxygen Coverage
+    , Example.Dyn_array_t(..)
+    , Example.Multi_untagged_t_pos(..)
+    , Example.Multi_untagged_t_dim(..)
+    , Example.Multi_untagged_t(..)
+    , Example.Named_inner(..)
+    , Example.Named_outer(..)
+    , Example.Deep_mid_untagged_field(..)
+    , Example.Deep_mid(..)
+    , Example.Deep_outer(..)
+    , Example.Unnamed_field_t_anon'ua(..)
+    , Example.Unnamed_field_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.BitfieldPtr as BitfieldPtr
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.FLAM as FLAM
+import qualified HsBindgen.Runtime.HasCBitfield as HasCBitfield
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, fmap, pure, type (~))
+
+{-| Maximum length for name strings.
+
+    __C declaration:__ @macro MAX_NAME_LENGTH@
+
+    __defined at:__ @documentation\/doxygen_docs.h 39:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+mAX_NAME_LENGTH :: BG.CInt
+mAX_NAME_LENGTH = (64 :: BG.CInt)
+
+{-| Size type for this library.
+
+    This is the comment __title__
+
+    __C declaration:__ @size_type@
+
+    __defined at:__ @documentation\/doxygen_docs.h 56:16@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Size_type = Size_type
+  { unwrapSize_type :: HsBindgen.Runtime.LibC.CSize
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.CompatHasField.HasField "unwrapSize_type" Size_type ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Size_type {unwrapSize_type = y1}, BG.getField @"unwrapSize_type" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.HasField "unwrapSize_type" (BG.Ptr Size_type) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSize_type")
+
+instance HasCField.HasCField Size_type "unwrapSize_type" where
+
+  type CFieldType Size_type "unwrapSize_type" =
+    HsBindgen.Runtime.LibC.CSize
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct opaque_struct@
+
+    __defined at:__ @documentation\/doxygen_docs.h 76:8@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Opaque_struct
+
+{-| __C declaration:__ @union opaque_union@
+
+    __defined at:__ @documentation\/doxygen_docs.h 81:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Opaque_union
+
+{-| Color enumeration without typedef.
+
+    __C declaration:__ @enum color_enum@
+
+    __defined at:__ @documentation\/doxygen_docs.h 87:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Color_enum = Color_enum
+  { unwrapColor_enum :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Color_enum where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Color_enum where
+
+  readRaw =
+    \ptr0 ->
+          pure Color_enum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Color_enum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Color_enum unwrapColor_enum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapColor_enum2
+
+deriving via Marshal.EquivStorable Color_enum instance BG.Storable Color_enum
+
+deriving via BG.CUInt instance BG.Prim Color_enum
+
+instance CEnum.CEnum Color_enum where
+
+  type CEnumZ Color_enum = BG.CUInt
+
+  toCEnum = Color_enum
+
+  fromCEnum = BG.getField @"unwrapColor_enum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "COLOR_RED")
+                                   , (1, BG.singleton "COLOR_GREEN")
+                                   , (2, BG.singleton "COLOR_BLUE")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Color_enum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Color_enum"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Color_enum where
+
+  minDeclaredValue = COLOR_RED
+
+  maxDeclaredValue = COLOR_BLUE
+
+instance Show Color_enum where
+
+  showsPrec = CEnum.shows
+
+instance Read Color_enum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapColor_enum" Color_enum ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Color_enum {unwrapColor_enum = y1}
+      , BG.getField @"unwrapColor_enum" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapColor_enum" (BG.Ptr Color_enum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapColor_enum")
+
+instance HasCField.HasCField Color_enum "unwrapColor_enum" where
+
+  type CFieldType Color_enum "unwrapColor_enum" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Red color
+
+    __C declaration:__ @COLOR_RED@
+
+    __defined at:__ @documentation\/doxygen_docs.h 88:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern COLOR_RED :: Color_enum
+pattern COLOR_RED = Color_enum 0
+
+{-| Green color
+
+    __C declaration:__ @COLOR_GREEN@
+
+    __defined at:__ @documentation\/doxygen_docs.h 89:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern COLOR_GREEN :: Color_enum
+pattern COLOR_GREEN = Color_enum 1
+
+{-| Blue color
+
+    __C declaration:__ @COLOR_BLUE@
+
+    __defined at:__ @documentation\/doxygen_docs.h 90:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern COLOR_BLUE :: Color_enum
+pattern COLOR_BLUE = Color_enum 2
+
+{-| Auxiliary type used by 'Event_callback_t'
+
+    __C declaration:__ @event_callback_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 231:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Event_callback_t_Aux = Event_callback_t_Aux
+  { unwrapEvent_callback_t_Aux :: BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toEvent_callback_t_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_111918b0aee2a7fb_base ::
+     (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt))
+
+-- __unique:__ @toEvent_callback_t_Aux@
+hs_bindgen_111918b0aee2a7fb ::
+     Event_callback_t_Aux
+  -> IO (BG.FunPtr Event_callback_t_Aux)
+hs_bindgen_111918b0aee2a7fb =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_111918b0aee2a7fb_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapEvent_callback_t_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromEvent_callback_t_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_9e9d478c2d75628c_base ::
+     BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt
+
+-- __unique:__ @fromEvent_callback_t_Aux@
+hs_bindgen_9e9d478c2d75628c ::
+     BG.FunPtr Event_callback_t_Aux
+  -> Event_callback_t_Aux
+hs_bindgen_9e9d478c2d75628c =
+  \funPtr0 ->
+    Event_callback_t_Aux (\x1 ->
+                            \x2 ->
+                              fmap BG.fromFFIType (hs_bindgen_9e9d478c2d75628c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Event_callback_t_Aux where
+
+  toFunPtr = hs_bindgen_111918b0aee2a7fb
+
+instance BG.FromFunPtr Event_callback_t_Aux where
+
+  fromFunPtr = hs_bindgen_9e9d478c2d75628c
+
+instance ( ty ~ (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapEvent_callback_t_Aux" Event_callback_t_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Event_callback_t_Aux {unwrapEvent_callback_t_Aux = y1}
+      , BG.getField @"unwrapEvent_callback_t_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt)
+         ) => BG.HasField "unwrapEvent_callback_t_Aux" (BG.Ptr Event_callback_t_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapEvent_callback_t_Aux")
+
+instance HasCField.HasCField Event_callback_t_Aux "unwrapEvent_callback_t_Aux" where
+
+  type CFieldType Event_callback_t_Aux "unwrapEvent_callback_t_Aux" =
+    BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Callback function type.
+
+    [__@event_type@__]: Type of event
+
+    [__@user_data@__]: User-provided data
+
+    __Returns:__ Handling result
+
+    __C declaration:__ @event_callback_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 231:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Event_callback_t = Event_callback_t
+  { unwrapEvent_callback_t :: BG.FunPtr Event_callback_t_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Event_callback_t_Aux
+         ) => BG.CompatHasField.HasField "unwrapEvent_callback_t" Event_callback_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Event_callback_t {unwrapEvent_callback_t = y1}
+      , BG.getField @"unwrapEvent_callback_t" x0
+      )
+
+instance ( ty ~ BG.FunPtr Event_callback_t_Aux
+         ) => BG.HasField "unwrapEvent_callback_t" (BG.Ptr Event_callback_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapEvent_callback_t")
+
+instance HasCField.HasCField Event_callback_t "unwrapEvent_callback_t" where
+
+  type CFieldType Event_callback_t "unwrapEvent_callback_t" =
+    BG.FunPtr Event_callback_t_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Structure with documented fields.
+
+    This structure demonstrates field documentation.
+
+    __C declaration:__ @struct config_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 238:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Config_t = Config_t
+  { config_t_id :: HsBindgen.Runtime.LibC.Word32
+    {- ^ Unique identifier.
+
+         __C declaration:__ @id@
+
+         __defined at:__ @documentation\/doxygen_docs.h 240:14@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , config_t_name :: CA.ConstantArray 64 BG.CChar
+    {- ^ Human-readable name.
+
+         __C declaration:__ @name@
+
+         __defined at:__ @documentation\/doxygen_docs.h 243:10@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , config_t_flags :: HsBindgen.Runtime.LibC.Word32
+    {- ^ Configuration flags.
+
+         __C declaration:__ @flags@
+
+         __defined at:__ @documentation\/doxygen_docs.h 246:14@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , config_t_callback :: Event_callback_t
+    {- ^ Optional callback function.
+
+         See also: 'Event_callback_t'
+
+         __C declaration:__ @callback@
+
+         __defined at:__ @documentation\/doxygen_docs.h 253:22@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , config_t_user_data :: BG.Ptr BG.Void
+    {- ^ User data for callback.
+
+         __C declaration:__ @user_data@
+
+         __defined at:__ @documentation\/doxygen_docs.h 256:11@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Config_t where
+
+  staticSizeOf = \_ -> (88 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Config_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Config_t
+      <*> HasCField.readRaw (BG.Proxy @"config_t_id") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"config_t_name") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"config_t_flags") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"config_t_callback") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"config_t_user_data") ptr0
+
+instance Marshal.WriteRaw Config_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Config_t
+            config_t_id2
+            config_t_name3
+            config_t_flags4
+            config_t_callback5
+            config_t_user_data6 ->
+                 HasCField.writeRaw (BG.Proxy @"config_t_id") ptr0 config_t_id2
+              >> HasCField.writeRaw (BG.Proxy @"config_t_name") ptr0 config_t_name3
+              >> HasCField.writeRaw (BG.Proxy @"config_t_flags") ptr0 config_t_flags4
+              >> HasCField.writeRaw (BG.Proxy @"config_t_callback") ptr0 config_t_callback5
+              >> HasCField.writeRaw (BG.Proxy @"config_t_user_data") ptr0 config_t_user_data6
+
+deriving via Marshal.EquivStorable Config_t instance BG.Storable Config_t
+
+deriving via Struct.IsStructViaReadRaw Config_t instance Struct.IsStruct Config_t
+
+{-| Unique identifier.
+
+    __C declaration:__ @id@
+
+    __defined at:__ @documentation\/doxygen_docs.h 240:14@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "config_t_id" Config_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Config_t { config_t_id = y1
+                   , config_t_name = BG.getField @"config_t_name" x0
+                   , config_t_flags = BG.getField @"config_t_flags" x0
+                   , config_t_callback = BG.getField @"config_t_callback" x0
+                   , config_t_user_data = BG.getField @"config_t_user_data" x0
+                   }
+      , BG.getField @"config_t_id" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "config_t_id" (BG.Ptr Config_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"config_t_id")
+
+instance HasCField.HasCField Config_t "config_t_id" where
+
+  type CFieldType Config_t "config_t_id" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| Human-readable name.
+
+    __C declaration:__ @name@
+
+    __defined at:__ @documentation\/doxygen_docs.h 243:10@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ CA.ConstantArray 64 BG.CChar
+         ) => BG.CompatHasField.HasField "config_t_name" Config_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Config_t { config_t_name = y1
+                   , config_t_id = BG.getField @"config_t_id" x0
+                   , config_t_flags = BG.getField @"config_t_flags" x0
+                   , config_t_callback = BG.getField @"config_t_callback" x0
+                   , config_t_user_data = BG.getField @"config_t_user_data" x0
+                   }
+      , BG.getField @"config_t_name" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 64 BG.CChar
+         ) => BG.HasField "config_t_name" (BG.Ptr Config_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"config_t_name")
+
+instance HasCField.HasCField Config_t "config_t_name" where
+
+  type CFieldType Config_t "config_t_name" =
+    CA.ConstantArray 64 BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| Configuration flags.
+
+    __C declaration:__ @flags@
+
+    __defined at:__ @documentation\/doxygen_docs.h 246:14@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "config_t_flags" Config_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Config_t { config_t_flags = y1
+                   , config_t_id = BG.getField @"config_t_id" x0
+                   , config_t_name = BG.getField @"config_t_name" x0
+                   , config_t_callback = BG.getField @"config_t_callback" x0
+                   , config_t_user_data = BG.getField @"config_t_user_data" x0
+                   }
+      , BG.getField @"config_t_flags" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "config_t_flags" (BG.Ptr Config_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"config_t_flags")
+
+instance HasCField.HasCField Config_t "config_t_flags" where
+
+  type CFieldType Config_t "config_t_flags" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 68
+
+{-| Optional callback function.
+
+    See also: 'Event_callback_t'
+
+    __C declaration:__ @callback@
+
+    __defined at:__ @documentation\/doxygen_docs.h 253:22@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ Event_callback_t
+         ) => BG.CompatHasField.HasField "config_t_callback" Config_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Config_t { config_t_callback = y1
+                   , config_t_id = BG.getField @"config_t_id" x0
+                   , config_t_name = BG.getField @"config_t_name" x0
+                   , config_t_flags = BG.getField @"config_t_flags" x0
+                   , config_t_user_data = BG.getField @"config_t_user_data" x0
+                   }
+      , BG.getField @"config_t_callback" x0
+      )
+
+instance ( ty ~ Event_callback_t
+         ) => BG.HasField "config_t_callback" (BG.Ptr Config_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"config_t_callback")
+
+instance HasCField.HasCField Config_t "config_t_callback" where
+
+  type CFieldType Config_t "config_t_callback" =
+    Event_callback_t
+
+  offset# = \_ -> \_ -> 72
+
+{-| User data for callback.
+
+    __C declaration:__ @user_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 256:11@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "config_t_user_data" Config_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Config_t { config_t_user_data = y1
+                   , config_t_id = BG.getField @"config_t_id" x0
+                   , config_t_name = BG.getField @"config_t_name" x0
+                   , config_t_flags = BG.getField @"config_t_flags" x0
+                   , config_t_callback = BG.getField @"config_t_callback" x0
+                   }
+      , BG.getField @"config_t_user_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "config_t_user_data" (BG.Ptr Config_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"config_t_user_data")
+
+instance HasCField.HasCField Config_t "config_t_user_data" where
+
+  type CFieldType Config_t "config_t_user_data" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 80
+
+{-| Enumeration with documented values.
+
+    This enum shows different status codes.
+
+    __C declaration:__ @enum status_code_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 264:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Status_code_t = Status_code_t
+  { unwrapStatus_code_t :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Status_code_t where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Status_code_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Status_code_t
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Status_code_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Status_code_t unwrapStatus_code_t2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapStatus_code_t2
+
+deriving via Marshal.EquivStorable Status_code_t instance BG.Storable Status_code_t
+
+deriving via BG.CInt instance BG.Prim Status_code_t
+
+instance CEnum.CEnum Status_code_t where
+
+  type CEnumZ Status_code_t = BG.CInt
+
+  toCEnum = Status_code_t
+
+  fromCEnum = BG.getField @"unwrapStatus_code_t"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (-99, BG.singleton "STATUS_ERROR")
+                                   , (-3, BG.singleton "STATUS_TIMEOUT")
+                                   , (-2, BG.singleton "STATUS_NO_MEMORY")
+                                   , (-1, BG.singleton "STATUS_INVALID_PARAM")
+                                   , (0, BG.singleton "STATUS_OK")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Status_code_t"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Status_code_t"
+
+instance Show Status_code_t where
+
+  showsPrec = CEnum.shows
+
+instance Read Status_code_t where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapStatus_code_t" Status_code_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Status_code_t {unwrapStatus_code_t = y1}
+      , BG.getField @"unwrapStatus_code_t" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapStatus_code_t" (BG.Ptr Status_code_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStatus_code_t")
+
+instance HasCField.HasCField Status_code_t "unwrapStatus_code_t" where
+
+  type CFieldType Status_code_t "unwrapStatus_code_t" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Operation successful.
+
+    __C declaration:__ @STATUS_OK@
+
+    __defined at:__ @documentation\/doxygen_docs.h 266:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_OK :: Status_code_t
+pattern STATUS_OK = Status_code_t 0
+
+{-| Invalid parameter provided.
+
+    __C declaration:__ @STATUS_INVALID_PARAM@
+
+    __defined at:__ @documentation\/doxygen_docs.h 269:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_INVALID_PARAM :: Status_code_t
+pattern STATUS_INVALID_PARAM = Status_code_t (-1)
+
+{-| Memory allocation failed.
+
+    __C declaration:__ @STATUS_NO_MEMORY@
+
+    __defined at:__ @documentation\/doxygen_docs.h 272:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_NO_MEMORY :: Status_code_t
+pattern STATUS_NO_MEMORY = Status_code_t (-2)
+
+{-| Operation timed out.
+
+    __C declaration:__ @STATUS_TIMEOUT@
+
+    __defined at:__ @documentation\/doxygen_docs.h 275:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_TIMEOUT :: Status_code_t
+pattern STATUS_TIMEOUT = Status_code_t (-3)
+
+{-| Generic error.
+
+    __C declaration:__ @STATUS_ERROR@
+
+    __defined at:__ @documentation\/doxygen_docs.h 278:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_ERROR :: Status_code_t
+pattern STATUS_ERROR = Status_code_t (-99)
+
+{-| __C declaration:__ @struct \@data_union_t_as_parts@
+
+    __defined at:__ @documentation\/doxygen_docs.h 296:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Data_union_t_as_parts = Data_union_t_as_parts
+  { data_union_t_as_parts_low :: HsBindgen.Runtime.LibC.Word16
+    {- ^ Low 16 bits.
+
+         __C declaration:__ @low@
+
+         __defined at:__ @documentation\/doxygen_docs.h 297:18@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , data_union_t_as_parts_high :: HsBindgen.Runtime.LibC.Word16
+    {- ^ High 16 bits.
+
+         __C declaration:__ @high@
+
+         __defined at:__ @documentation\/doxygen_docs.h 298:18@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Data_union_t_as_parts where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Data_union_t_as_parts where
+
+  readRaw =
+    \ptr0 ->
+          pure Data_union_t_as_parts
+      <*> HasCField.readRaw (BG.Proxy @"data_union_t_as_parts_low") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"data_union_t_as_parts_high") ptr0
+
+instance Marshal.WriteRaw Data_union_t_as_parts where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Data_union_t_as_parts data_union_t_as_parts_low2 data_union_t_as_parts_high3 ->
+               HasCField.writeRaw (BG.Proxy @"data_union_t_as_parts_low") ptr0 data_union_t_as_parts_low2
+            >> HasCField.writeRaw (BG.Proxy @"data_union_t_as_parts_high") ptr0 data_union_t_as_parts_high3
+
+deriving via Marshal.EquivStorable Data_union_t_as_parts instance BG.Storable Data_union_t_as_parts
+
+deriving via Struct.IsStructViaReadRaw Data_union_t_as_parts instance Struct.IsStruct Data_union_t_as_parts
+
+{-| Low 16 bits.
+
+    __C declaration:__ @low@
+
+    __defined at:__ @documentation\/doxygen_docs.h 297:18@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.CompatHasField.HasField "data_union_t_as_parts_low" Data_union_t_as_parts ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Data_union_t_as_parts { data_union_t_as_parts_low = y1
+                                , data_union_t_as_parts_high = BG.getField @"data_union_t_as_parts_high" x0
+                                }
+      , BG.getField @"data_union_t_as_parts_low" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.HasField "data_union_t_as_parts_low" (BG.Ptr Data_union_t_as_parts) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"data_union_t_as_parts_low")
+
+instance HasCField.HasCField Data_union_t_as_parts "data_union_t_as_parts_low" where
+
+  type CFieldType Data_union_t_as_parts "data_union_t_as_parts_low" =
+    HsBindgen.Runtime.LibC.Word16
+
+  offset# = \_ -> \_ -> 0
+
+{-| High 16 bits.
+
+    __C declaration:__ @high@
+
+    __defined at:__ @documentation\/doxygen_docs.h 298:18@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.CompatHasField.HasField "data_union_t_as_parts_high" Data_union_t_as_parts ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Data_union_t_as_parts { data_union_t_as_parts_high = y1
+                                , data_union_t_as_parts_low = BG.getField @"data_union_t_as_parts_low" x0
+                                }
+      , BG.getField @"data_union_t_as_parts_high" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.HasField "data_union_t_as_parts_high" (BG.Ptr Data_union_t_as_parts) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"data_union_t_as_parts_high")
+
+instance HasCField.HasCField Data_union_t_as_parts "data_union_t_as_parts_high" where
+
+  type CFieldType Data_union_t_as_parts "data_union_t_as_parts_high" =
+    HsBindgen.Runtime.LibC.Word16
+
+  offset# = \_ -> \_ -> 2
+
+{-| Union with documented fields.
+
+    This union demonstrates different data representations.
+
+    __C declaration:__ @union data_union_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 287:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Data_union_t = Data_union_t
+  { unwrapData_union_t :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Data_union_t
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Data_union_t
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Data_union_t
+
+deriving via Marshal.EquivStorable Data_union_t instance BG.Storable Data_union_t
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Data_union_t
+
+{-| Integer representation.
+
+    __C declaration:__ @as_int@
+
+    __defined at:__ @documentation\/doxygen_docs.h 288:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "data_union_t_as_int" Data_union_t ty where
+
+  getField = BG.getUnionPayload
+
+{-| Integer representation.
+
+    __C declaration:__ @as_int@
+
+    __defined at:__ @documentation\/doxygen_docs.h 288:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "data_union_t_as_int" Data_union_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"data_union_t_as_int" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "data_union_t_as_int" (BG.Ptr Data_union_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"data_union_t_as_int")
+
+instance HasCField.HasCField Data_union_t "data_union_t_as_int" where
+
+  type CFieldType Data_union_t "data_union_t_as_int" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| Float representation.
+
+    __C declaration:__ @as_float@
+
+    __defined at:__ @documentation\/doxygen_docs.h 289:11@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "data_union_t_as_float" Data_union_t ty where
+
+  getField = BG.getUnionPayload
+
+{-| Float representation.
+
+    __C declaration:__ @as_float@
+
+    __defined at:__ @documentation\/doxygen_docs.h 289:11@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CFloat
+         ) => BG.CompatHasField.HasField "data_union_t_as_float" Data_union_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"data_union_t_as_float" x0)
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "data_union_t_as_float" (BG.Ptr Data_union_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"data_union_t_as_float")
+
+instance HasCField.HasCField Data_union_t "data_union_t_as_float" where
+
+  type CFieldType Data_union_t "data_union_t_as_float" =
+    BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| Byte array representation.
+
+    __C declaration:__ @as_bytes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 290:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "data_union_t_as_bytes" Data_union_t ty where
+
+  getField = BG.getUnionPayload
+
+{-| Byte array representation.
+
+    __C declaration:__ @as_bytes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 290:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "data_union_t_as_bytes" Data_union_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"data_union_t_as_bytes" x0)
+
+instance ( ty ~ CA.ConstantArray 4 HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "data_union_t_as_bytes" (BG.Ptr Data_union_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"data_union_t_as_bytes")
+
+instance HasCField.HasCField Data_union_t "data_union_t_as_bytes" where
+
+  type CFieldType Data_union_t "data_union_t_as_bytes" =
+    CA.ConstantArray 4 HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| Structured representation.
+
+    Allows access to high and low parts separately As Parts Struct
+
+    __C declaration:__ @as_parts@
+
+    __defined at:__ @documentation\/doxygen_docs.h 299:30@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ Data_union_t_as_parts
+         ) => BG.HasField "data_union_t_as_parts" Data_union_t ty where
+
+  getField = BG.getUnionPayload
+
+{-| Structured representation.
+
+    Allows access to high and low parts separately As Parts Struct
+
+    __C declaration:__ @as_parts@
+
+    __defined at:__ @documentation\/doxygen_docs.h 299:30@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ Data_union_t_as_parts
+         ) => BG.CompatHasField.HasField "data_union_t_as_parts" Data_union_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"data_union_t_as_parts" x0)
+
+instance ( ty ~ Data_union_t_as_parts
+         ) => BG.HasField "data_union_t_as_parts" (BG.Ptr Data_union_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"data_union_t_as_parts")
+
+instance HasCField.HasCField Data_union_t "data_union_t_as_parts" where
+
+  type CFieldType Data_union_t "data_union_t_as_parts" =
+    Data_union_t_as_parts
+
+  offset# = \_ -> \_ -> 0
+
+{-| Bit field structure.
+
+    Demonstrates bit field documentation.
+
+    __C declaration:__ @struct bitfield_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 308:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Bitfield_t = Bitfield_t
+  { bitfield_t_flag1 :: BG.CUInt
+    {- ^ First flag (1 bit).
+
+         __C declaration:__ @flag1@
+
+         __defined at:__ @documentation\/doxygen_docs.h 309:14@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , bitfield_t_flag2 :: BG.CUInt
+    {- ^ Second flag (1 bit).
+
+         __C declaration:__ @flag2@
+
+         __defined at:__ @documentation\/doxygen_docs.h 310:14@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , bitfield_t_counter :: BG.CUInt
+    {- ^ Counter value (6 bits).
+
+         __C declaration:__ @counter@
+
+         __defined at:__ @documentation\/doxygen_docs.h 311:14@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , bitfield_t_reserved :: BG.CUInt
+    {- ^ Reserved bits (24 bits).
+
+         __C declaration:__ @reserved@
+
+         __defined at:__ @documentation\/doxygen_docs.h 312:14@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bitfield_t where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bitfield_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Bitfield_t
+      <*> HasCBitfield.peek (BG.Proxy @"bitfield_t_flag1") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bitfield_t_flag2") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bitfield_t_counter") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bitfield_t_reserved") ptr0
+
+instance Marshal.WriteRaw Bitfield_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bitfield_t
+            bitfield_t_flag12
+            bitfield_t_flag23
+            bitfield_t_counter4
+            bitfield_t_reserved5 ->
+                 HasCBitfield.poke (BG.Proxy @"bitfield_t_flag1") ptr0 bitfield_t_flag12
+              >> HasCBitfield.poke (BG.Proxy @"bitfield_t_flag2") ptr0 bitfield_t_flag23
+              >> HasCBitfield.poke (BG.Proxy @"bitfield_t_counter") ptr0 bitfield_t_counter4
+              >> HasCBitfield.poke (BG.Proxy @"bitfield_t_reserved") ptr0 bitfield_t_reserved5
+
+deriving via Marshal.EquivStorable Bitfield_t instance BG.Storable Bitfield_t
+
+deriving via Struct.IsStructViaReadRaw Bitfield_t instance Struct.IsStruct Bitfield_t
+
+{-| First flag (1 bit).
+
+    __C declaration:__ @flag1@
+
+    __defined at:__ @documentation\/doxygen_docs.h 309:14@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "bitfield_t_flag1" Bitfield_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bitfield_t { bitfield_t_flag1 = y1
+                     , bitfield_t_flag2 = BG.getField @"bitfield_t_flag2" x0
+                     , bitfield_t_counter = BG.getField @"bitfield_t_counter" x0
+                     , bitfield_t_reserved = BG.getField @"bitfield_t_reserved" x0
+                     }
+      , BG.getField @"bitfield_t_flag1" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "bitfield_t_flag1" (BG.Ptr Bitfield_t) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bitfield_t_flag1")
+
+instance HasCBitfield.HasCBitfield Bitfield_t "bitfield_t_flag1" where
+
+  type CBitfieldType Bitfield_t "bitfield_t_flag1" =
+    BG.CUInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 1
+
+{-| Second flag (1 bit).
+
+    __C declaration:__ @flag2@
+
+    __defined at:__ @documentation\/doxygen_docs.h 310:14@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "bitfield_t_flag2" Bitfield_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bitfield_t { bitfield_t_flag2 = y1
+                     , bitfield_t_flag1 = BG.getField @"bitfield_t_flag1" x0
+                     , bitfield_t_counter = BG.getField @"bitfield_t_counter" x0
+                     , bitfield_t_reserved = BG.getField @"bitfield_t_reserved" x0
+                     }
+      , BG.getField @"bitfield_t_flag2" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "bitfield_t_flag2" (BG.Ptr Bitfield_t) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bitfield_t_flag2")
+
+instance HasCBitfield.HasCBitfield Bitfield_t "bitfield_t_flag2" where
+
+  type CBitfieldType Bitfield_t "bitfield_t_flag2" =
+    BG.CUInt
+
+  bitfieldOffset# = \_ -> \_ -> 1
+
+  bitfieldWidth# = \_ -> \_ -> 1
+
+{-| Counter value (6 bits).
+
+    __C declaration:__ @counter@
+
+    __defined at:__ @documentation\/doxygen_docs.h 311:14@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "bitfield_t_counter" Bitfield_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bitfield_t { bitfield_t_counter = y1
+                     , bitfield_t_flag1 = BG.getField @"bitfield_t_flag1" x0
+                     , bitfield_t_flag2 = BG.getField @"bitfield_t_flag2" x0
+                     , bitfield_t_reserved = BG.getField @"bitfield_t_reserved" x0
+                     }
+      , BG.getField @"bitfield_t_counter" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "bitfield_t_counter" (BG.Ptr Bitfield_t) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bitfield_t_counter")
+
+instance HasCBitfield.HasCBitfield Bitfield_t "bitfield_t_counter" where
+
+  type CBitfieldType Bitfield_t "bitfield_t_counter" =
+    BG.CUInt
+
+  bitfieldOffset# = \_ -> \_ -> 2
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| Reserved bits (24 bits).
+
+    __C declaration:__ @reserved@
+
+    __defined at:__ @documentation\/doxygen_docs.h 312:14@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "bitfield_t_reserved" Bitfield_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bitfield_t { bitfield_t_reserved = y1
+                     , bitfield_t_flag1 = BG.getField @"bitfield_t_flag1" x0
+                     , bitfield_t_flag2 = BG.getField @"bitfield_t_flag2" x0
+                     , bitfield_t_counter = BG.getField @"bitfield_t_counter" x0
+                     }
+      , BG.getField @"bitfield_t_reserved" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "bitfield_t_reserved" (BG.Ptr Bitfield_t) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bitfield_t_reserved")
+
+instance HasCBitfield.HasCBitfield Bitfield_t "bitfield_t_reserved" where
+
+  type CBitfieldType Bitfield_t "bitfield_t_reserved" =
+    BG.CUInt
+
+  bitfieldOffset# = \_ -> \_ -> 8
+
+  bitfieldWidth# = \_ -> \_ -> 24
+
+{-| Auxiliary type used by 'Processor_fn_t'
+
+    __C declaration:__ @processor_fn_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 323:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Processor_fn_t_Aux = Processor_fn_t_Aux
+  { unwrapProcessor_fn_t_Aux :: BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toProcessor_fn_t_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d4e16471c82d5df0_base ::
+     (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt))
+
+-- __unique:__ @toProcessor_fn_t_Aux@
+hs_bindgen_d4e16471c82d5df0 ::
+     Processor_fn_t_Aux
+  -> IO (BG.FunPtr Processor_fn_t_Aux)
+hs_bindgen_d4e16471c82d5df0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_d4e16471c82d5df0_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapProcessor_fn_t_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromProcessor_fn_t_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_0d4b3d0461629423_base ::
+     BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt)
+  -> BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt
+
+-- __unique:__ @fromProcessor_fn_t_Aux@
+hs_bindgen_0d4b3d0461629423 ::
+     BG.FunPtr Processor_fn_t_Aux
+  -> Processor_fn_t_Aux
+hs_bindgen_0d4b3d0461629423 =
+  \funPtr0 ->
+    Processor_fn_t_Aux (\x1 ->
+                          \x2 ->
+                            fmap BG.fromFFIType (hs_bindgen_0d4b3d0461629423_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Processor_fn_t_Aux where
+
+  toFunPtr = hs_bindgen_d4e16471c82d5df0
+
+instance BG.FromFunPtr Processor_fn_t_Aux where
+
+  fromFunPtr = hs_bindgen_0d4b3d0461629423
+
+instance ( ty ~ (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapProcessor_fn_t_Aux" Processor_fn_t_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Processor_fn_t_Aux {unwrapProcessor_fn_t_Aux = y1}
+      , BG.getField @"unwrapProcessor_fn_t_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt)
+         ) => BG.HasField "unwrapProcessor_fn_t_Aux" (BG.Ptr Processor_fn_t_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapProcessor_fn_t_Aux")
+
+instance HasCField.HasCField Processor_fn_t_Aux "unwrapProcessor_fn_t_Aux" where
+
+  type CFieldType Processor_fn_t_Aux "unwrapProcessor_fn_t_Aux" =
+    BG.CInt -> BG.Ptr BG.Void -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Function pointer typedef.
+
+    [__@input@__]: Input value
+
+    [__@context@__]: Context pointer
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @processor_fn_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 323:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Processor_fn_t = Processor_fn_t
+  { unwrapProcessor_fn_t :: BG.FunPtr Processor_fn_t_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Processor_fn_t_Aux
+         ) => BG.CompatHasField.HasField "unwrapProcessor_fn_t" Processor_fn_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Processor_fn_t {unwrapProcessor_fn_t = y1}
+      , BG.getField @"unwrapProcessor_fn_t" x0
+      )
+
+instance ( ty ~ BG.FunPtr Processor_fn_t_Aux
+         ) => BG.HasField "unwrapProcessor_fn_t" (BG.Ptr Processor_fn_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapProcessor_fn_t")
+
+instance HasCField.HasCField Processor_fn_t "unwrapProcessor_fn_t" where
+
+  type CFieldType Processor_fn_t "unwrapProcessor_fn_t" =
+    BG.FunPtr Processor_fn_t_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Array typedef with size.
+
+    __C declaration:__ @filename_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 329:14@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Filename_t = Filename_t
+  { unwrapFilename_t :: CA.ConstantArray 256 BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 256 BG.CChar
+         ) => BG.CompatHasField.HasField "unwrapFilename_t" Filename_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Filename_t {unwrapFilename_t = y1}
+      , BG.getField @"unwrapFilename_t" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 256 BG.CChar
+         ) => BG.HasField "unwrapFilename_t" (BG.Ptr Filename_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFilename_t")
+
+instance HasCField.HasCField Filename_t "unwrapFilename_t" where
+
+  type CFieldType Filename_t "unwrapFilename_t" =
+    CA.ConstantArray 256 BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| Structure with flexible array member.
+
+    Used for variable-length data buffers.
+
+    __C declaration:__ @struct flexible_array@
+
+    __defined at:__ @documentation\/doxygen_docs.h 365:8@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Flexible_array_Aux = Flexible_array
+  { flexible_array_count :: HsBindgen.Runtime.LibC.CSize
+    {- ^ Number of elements.
+
+         __C declaration:__ @count@
+
+         __defined at:__ @documentation\/doxygen_docs.h 366:12@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Flexible_array_Aux where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Flexible_array_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure Flexible_array
+      <*> HasCField.readRaw (BG.Proxy @"flexible_array_count") ptr0
+
+instance Marshal.WriteRaw Flexible_array_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Flexible_array flexible_array_count2 ->
+            HasCField.writeRaw (BG.Proxy @"flexible_array_count") ptr0 flexible_array_count2
+
+deriving via Marshal.EquivStorable Flexible_array_Aux instance BG.Storable Flexible_array_Aux
+
+deriving via Struct.IsStructViaReadRaw Flexible_array_Aux instance Struct.IsStruct Flexible_array_Aux
+
+{-| Number of elements.
+
+    __C declaration:__ @count@
+
+    __defined at:__ @documentation\/doxygen_docs.h 366:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.CompatHasField.HasField "flexible_array_count" Flexible_array_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Flexible_array {flexible_array_count = y1}
+      , BG.getField @"flexible_array_count" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.HasField "flexible_array_count" (BG.Ptr Flexible_array_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"flexible_array_count")
+
+instance HasCField.HasCField Flexible_array_Aux "flexible_array_count" where
+
+  type CFieldType Flexible_array_Aux "flexible_array_count" =
+    HsBindgen.Runtime.LibC.CSize
+
+  offset# = \_ -> \_ -> 0
+
+instance FLAM.Offset BG.CInt Flexible_array_Aux where
+
+  offset = \_proxy0 -> 8
+
+{-| Structure with flexible array member.
+
+    Used for variable-length data buffers.
+
+    __C declaration:__ @struct flexible_array@
+
+    __defined at:__ @documentation\/doxygen_docs.h 365:8@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+type Flexible_array =
+  FLAM.WithFlam BG.CInt Flexible_array_Aux
+
+{-| Struct with invariant.
+
+    __Invariant:__ capacity >= size at all times
+
+    __C declaration:__ @struct dyn_array_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 523:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Dyn_array_t = Dyn_array_t
+  { dyn_array_t_data :: BG.Ptr BG.CInt
+    {- ^ Pointer to data.
+
+         __C declaration:__ @data@
+
+         __defined at:__ @documentation\/doxygen_docs.h 524:10@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , dyn_array_t_size :: HsBindgen.Runtime.LibC.CSize
+    {- ^ Current number of elements.
+
+         __C declaration:__ @size@
+
+         __defined at:__ @documentation\/doxygen_docs.h 525:12@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , dyn_array_t_capacity :: HsBindgen.Runtime.LibC.CSize
+    {- ^ Allocated capacity.
+
+         __C declaration:__ @capacity@
+
+         __defined at:__ @documentation\/doxygen_docs.h 526:12@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Dyn_array_t where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Dyn_array_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Dyn_array_t
+      <*> HasCField.readRaw (BG.Proxy @"dyn_array_t_data") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dyn_array_t_size") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dyn_array_t_capacity") ptr0
+
+instance Marshal.WriteRaw Dyn_array_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Dyn_array_t dyn_array_t_data2 dyn_array_t_size3 dyn_array_t_capacity4 ->
+               HasCField.writeRaw (BG.Proxy @"dyn_array_t_data") ptr0 dyn_array_t_data2
+            >> HasCField.writeRaw (BG.Proxy @"dyn_array_t_size") ptr0 dyn_array_t_size3
+            >> HasCField.writeRaw (BG.Proxy @"dyn_array_t_capacity") ptr0 dyn_array_t_capacity4
+
+deriving via Marshal.EquivStorable Dyn_array_t instance BG.Storable Dyn_array_t
+
+deriving via Struct.IsStructViaReadRaw Dyn_array_t instance Struct.IsStruct Dyn_array_t
+
+{-| Pointer to data.
+
+    __C declaration:__ @data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 524:10@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "dyn_array_t_data" Dyn_array_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dyn_array_t { dyn_array_t_data = y1
+                      , dyn_array_t_size = BG.getField @"dyn_array_t_size" x0
+                      , dyn_array_t_capacity = BG.getField @"dyn_array_t_capacity" x0
+                      }
+      , BG.getField @"dyn_array_t_data" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "dyn_array_t_data" (BG.Ptr Dyn_array_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dyn_array_t_data")
+
+instance HasCField.HasCField Dyn_array_t "dyn_array_t_data" where
+
+  type CFieldType Dyn_array_t "dyn_array_t_data" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Current number of elements.
+
+    __C declaration:__ @size@
+
+    __defined at:__ @documentation\/doxygen_docs.h 525:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.CompatHasField.HasField "dyn_array_t_size" Dyn_array_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dyn_array_t { dyn_array_t_size = y1
+                      , dyn_array_t_data = BG.getField @"dyn_array_t_data" x0
+                      , dyn_array_t_capacity = BG.getField @"dyn_array_t_capacity" x0
+                      }
+      , BG.getField @"dyn_array_t_size" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.HasField "dyn_array_t_size" (BG.Ptr Dyn_array_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dyn_array_t_size")
+
+instance HasCField.HasCField Dyn_array_t "dyn_array_t_size" where
+
+  type CFieldType Dyn_array_t "dyn_array_t_size" =
+    HsBindgen.Runtime.LibC.CSize
+
+  offset# = \_ -> \_ -> 8
+
+{-| Allocated capacity.
+
+    __C declaration:__ @capacity@
+
+    __defined at:__ @documentation\/doxygen_docs.h 526:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.CompatHasField.HasField "dyn_array_t_capacity" Dyn_array_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dyn_array_t { dyn_array_t_capacity = y1
+                      , dyn_array_t_data = BG.getField @"dyn_array_t_data" x0
+                      , dyn_array_t_size = BG.getField @"dyn_array_t_size" x0
+                      }
+      , BG.getField @"dyn_array_t_capacity" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.HasField "dyn_array_t_capacity" (BG.Ptr Dyn_array_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dyn_array_t_capacity")
+
+instance HasCField.HasCField Dyn_array_t "dyn_array_t_capacity" where
+
+  type CFieldType Dyn_array_t "dyn_array_t_capacity" =
+    HsBindgen.Runtime.LibC.CSize
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @struct \@multi_untagged_t_pos@
+
+    __defined at:__ @documentation\/doxygen_docs.h 586:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Multi_untagged_t_pos = Multi_untagged_t_pos
+  { multi_untagged_t_pos_x :: BG.CFloat
+    {- ^ X coordinate.
+
+         __C declaration:__ @x@
+
+         __defined at:__ @documentation\/doxygen_docs.h 587:15@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , multi_untagged_t_pos_y :: BG.CFloat
+    {- ^ Y coordinate.
+
+         __C declaration:__ @y@
+
+         __defined at:__ @documentation\/doxygen_docs.h 588:15@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Multi_untagged_t_pos where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Multi_untagged_t_pos where
+
+  readRaw =
+    \ptr0 ->
+          pure Multi_untagged_t_pos
+      <*> HasCField.readRaw (BG.Proxy @"multi_untagged_t_pos_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"multi_untagged_t_pos_y") ptr0
+
+instance Marshal.WriteRaw Multi_untagged_t_pos where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Multi_untagged_t_pos multi_untagged_t_pos_x2 multi_untagged_t_pos_y3 ->
+               HasCField.writeRaw (BG.Proxy @"multi_untagged_t_pos_x") ptr0 multi_untagged_t_pos_x2
+            >> HasCField.writeRaw (BG.Proxy @"multi_untagged_t_pos_y") ptr0 multi_untagged_t_pos_y3
+
+deriving via Marshal.EquivStorable Multi_untagged_t_pos instance BG.Storable Multi_untagged_t_pos
+
+deriving via Struct.IsStructViaReadRaw Multi_untagged_t_pos instance Struct.IsStruct Multi_untagged_t_pos
+
+{-| X coordinate.
+
+    __C declaration:__ @x@
+
+    __defined at:__ @documentation\/doxygen_docs.h 587:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CFloat
+         ) => BG.CompatHasField.HasField "multi_untagged_t_pos_x" Multi_untagged_t_pos ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Multi_untagged_t_pos { multi_untagged_t_pos_x = y1
+                               , multi_untagged_t_pos_y = BG.getField @"multi_untagged_t_pos_y" x0
+                               }
+      , BG.getField @"multi_untagged_t_pos_x" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "multi_untagged_t_pos_x" (BG.Ptr Multi_untagged_t_pos) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"multi_untagged_t_pos_x")
+
+instance HasCField.HasCField Multi_untagged_t_pos "multi_untagged_t_pos_x" where
+
+  type CFieldType Multi_untagged_t_pos "multi_untagged_t_pos_x" =
+    BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| Y coordinate.
+
+    __C declaration:__ @y@
+
+    __defined at:__ @documentation\/doxygen_docs.h 588:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CFloat
+         ) => BG.CompatHasField.HasField "multi_untagged_t_pos_y" Multi_untagged_t_pos ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Multi_untagged_t_pos { multi_untagged_t_pos_y = y1
+                               , multi_untagged_t_pos_x = BG.getField @"multi_untagged_t_pos_x" x0
+                               }
+      , BG.getField @"multi_untagged_t_pos_y" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "multi_untagged_t_pos_y" (BG.Ptr Multi_untagged_t_pos) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"multi_untagged_t_pos_y")
+
+instance HasCField.HasCField Multi_untagged_t_pos "multi_untagged_t_pos_y" where
+
+  type CFieldType Multi_untagged_t_pos "multi_untagged_t_pos_y" =
+    BG.CFloat
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@multi_untagged_t_dim@
+
+    __defined at:__ @documentation\/doxygen_docs.h 594:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Multi_untagged_t_dim = Multi_untagged_t_dim
+  { multi_untagged_t_dim_w :: BG.CFloat
+    {- ^ Width.
+
+         __C declaration:__ @w@
+
+         __defined at:__ @documentation\/doxygen_docs.h 595:15@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , multi_untagged_t_dim_h :: BG.CFloat
+    {- ^ Height.
+
+         __C declaration:__ @h@
+
+         __defined at:__ @documentation\/doxygen_docs.h 596:15@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Multi_untagged_t_dim where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Multi_untagged_t_dim where
+
+  readRaw =
+    \ptr0 ->
+          pure Multi_untagged_t_dim
+      <*> HasCField.readRaw (BG.Proxy @"multi_untagged_t_dim_w") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"multi_untagged_t_dim_h") ptr0
+
+instance Marshal.WriteRaw Multi_untagged_t_dim where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Multi_untagged_t_dim multi_untagged_t_dim_w2 multi_untagged_t_dim_h3 ->
+               HasCField.writeRaw (BG.Proxy @"multi_untagged_t_dim_w") ptr0 multi_untagged_t_dim_w2
+            >> HasCField.writeRaw (BG.Proxy @"multi_untagged_t_dim_h") ptr0 multi_untagged_t_dim_h3
+
+deriving via Marshal.EquivStorable Multi_untagged_t_dim instance BG.Storable Multi_untagged_t_dim
+
+deriving via Struct.IsStructViaReadRaw Multi_untagged_t_dim instance Struct.IsStruct Multi_untagged_t_dim
+
+{-| Width.
+
+    __C declaration:__ @w@
+
+    __defined at:__ @documentation\/doxygen_docs.h 595:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CFloat
+         ) => BG.CompatHasField.HasField "multi_untagged_t_dim_w" Multi_untagged_t_dim ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Multi_untagged_t_dim { multi_untagged_t_dim_w = y1
+                               , multi_untagged_t_dim_h = BG.getField @"multi_untagged_t_dim_h" x0
+                               }
+      , BG.getField @"multi_untagged_t_dim_w" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "multi_untagged_t_dim_w" (BG.Ptr Multi_untagged_t_dim) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"multi_untagged_t_dim_w")
+
+instance HasCField.HasCField Multi_untagged_t_dim "multi_untagged_t_dim_w" where
+
+  type CFieldType Multi_untagged_t_dim "multi_untagged_t_dim_w" =
+    BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| Height.
+
+    __C declaration:__ @h@
+
+    __defined at:__ @documentation\/doxygen_docs.h 596:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CFloat
+         ) => BG.CompatHasField.HasField "multi_untagged_t_dim_h" Multi_untagged_t_dim ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Multi_untagged_t_dim { multi_untagged_t_dim_h = y1
+                               , multi_untagged_t_dim_w = BG.getField @"multi_untagged_t_dim_w" x0
+                               }
+      , BG.getField @"multi_untagged_t_dim_h" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "multi_untagged_t_dim_h" (BG.Ptr Multi_untagged_t_dim) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"multi_untagged_t_dim_h")
+
+instance HasCField.HasCField Multi_untagged_t_dim "multi_untagged_t_dim_h" where
+
+  type CFieldType Multi_untagged_t_dim "multi_untagged_t_dim_h" =
+    BG.CFloat
+
+  offset# = \_ -> \_ -> 4
+
+{-| Struct with multiple untagged inner structs.
+
+    Tests that doxygen comment enrichment correctly associates field comments with untagged inner structs at multiple nesting levels.
+
+    __C declaration:__ @struct multi_untagged_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 582:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Multi_untagged_t = Multi_untagged_t
+  { multi_untagged_t_pos :: Multi_untagged_t_pos
+    {- ^ Position in 2D space.
+
+         Position fields
+
+         __C declaration:__ @pos@
+
+         __defined at:__ @documentation\/doxygen_docs.h 589:30@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , multi_untagged_t_dim :: Multi_untagged_t_dim
+    {- ^ Dimensions.
+
+         Dimension fields
+
+         __C declaration:__ @dim@
+
+         __defined at:__ @documentation\/doxygen_docs.h 597:31@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Multi_untagged_t where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Multi_untagged_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Multi_untagged_t
+      <*> HasCField.readRaw (BG.Proxy @"multi_untagged_t_pos") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"multi_untagged_t_dim") ptr0
+
+instance Marshal.WriteRaw Multi_untagged_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Multi_untagged_t multi_untagged_t_pos2 multi_untagged_t_dim3 ->
+               HasCField.writeRaw (BG.Proxy @"multi_untagged_t_pos") ptr0 multi_untagged_t_pos2
+            >> HasCField.writeRaw (BG.Proxy @"multi_untagged_t_dim") ptr0 multi_untagged_t_dim3
+
+deriving via Marshal.EquivStorable Multi_untagged_t instance BG.Storable Multi_untagged_t
+
+deriving via Struct.IsStructViaReadRaw Multi_untagged_t instance Struct.IsStruct Multi_untagged_t
+
+{-| Position in 2D space.
+
+    Position fields
+
+    __C declaration:__ @pos@
+
+    __defined at:__ @documentation\/doxygen_docs.h 589:30@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ Multi_untagged_t_pos
+         ) => BG.CompatHasField.HasField "multi_untagged_t_pos" Multi_untagged_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Multi_untagged_t { multi_untagged_t_pos = y1
+                           , multi_untagged_t_dim = BG.getField @"multi_untagged_t_dim" x0
+                           }
+      , BG.getField @"multi_untagged_t_pos" x0
+      )
+
+instance ( ty ~ Multi_untagged_t_pos
+         ) => BG.HasField "multi_untagged_t_pos" (BG.Ptr Multi_untagged_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"multi_untagged_t_pos")
+
+instance HasCField.HasCField Multi_untagged_t "multi_untagged_t_pos" where
+
+  type CFieldType Multi_untagged_t "multi_untagged_t_pos" =
+    Multi_untagged_t_pos
+
+  offset# = \_ -> \_ -> 0
+
+{-| Dimensions.
+
+    Dimension fields
+
+    __C declaration:__ @dim@
+
+    __defined at:__ @documentation\/doxygen_docs.h 597:31@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ Multi_untagged_t_dim
+         ) => BG.CompatHasField.HasField "multi_untagged_t_dim" Multi_untagged_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Multi_untagged_t { multi_untagged_t_dim = y1
+                           , multi_untagged_t_pos = BG.getField @"multi_untagged_t_pos" x0
+                           }
+      , BG.getField @"multi_untagged_t_dim" x0
+      )
+
+instance ( ty ~ Multi_untagged_t_dim
+         ) => BG.HasField "multi_untagged_t_dim" (BG.Ptr Multi_untagged_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"multi_untagged_t_dim")
+
+instance HasCField.HasCField Multi_untagged_t "multi_untagged_t_dim" where
+
+  type CFieldType Multi_untagged_t "multi_untagged_t_dim" =
+    Multi_untagged_t_dim
+
+  offset# = \_ -> \_ -> 8
+
+{-| Named inner struct
+
+    __C declaration:__ @struct named_inner@
+
+    __defined at:__ @documentation\/doxygen_docs.h 608:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Named_inner = Named_inner
+  { named_inner_nx :: BG.CInt
+    {- ^ Inner field nx
+
+         __C declaration:__ @nx@
+
+         __defined at:__ @documentation\/doxygen_docs.h 610:13@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , named_inner_ny :: BG.CInt
+    {- ^ Inner field ny
+
+         __C declaration:__ @ny@
+
+         __defined at:__ @documentation\/doxygen_docs.h 612:13@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Named_inner where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Named_inner where
+
+  readRaw =
+    \ptr0 ->
+          pure Named_inner
+      <*> HasCField.readRaw (BG.Proxy @"named_inner_nx") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"named_inner_ny") ptr0
+
+instance Marshal.WriteRaw Named_inner where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Named_inner named_inner_nx2 named_inner_ny3 ->
+               HasCField.writeRaw (BG.Proxy @"named_inner_nx") ptr0 named_inner_nx2
+            >> HasCField.writeRaw (BG.Proxy @"named_inner_ny") ptr0 named_inner_ny3
+
+deriving via Marshal.EquivStorable Named_inner instance BG.Storable Named_inner
+
+deriving via Struct.IsStructViaReadRaw Named_inner instance Struct.IsStruct Named_inner
+
+{-| Inner field nx
+
+    __C declaration:__ @nx@
+
+    __defined at:__ @documentation\/doxygen_docs.h 610:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "named_inner_nx" Named_inner ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Named_inner {named_inner_nx = y1, named_inner_ny = BG.getField @"named_inner_ny" x0}
+      , BG.getField @"named_inner_nx" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "named_inner_nx" (BG.Ptr Named_inner) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"named_inner_nx")
+
+instance HasCField.HasCField Named_inner "named_inner_nx" where
+
+  type CFieldType Named_inner "named_inner_nx" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Inner field ny
+
+    __C declaration:__ @ny@
+
+    __defined at:__ @documentation\/doxygen_docs.h 612:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "named_inner_ny" Named_inner ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Named_inner {named_inner_ny = y1, named_inner_nx = BG.getField @"named_inner_nx" x0}
+      , BG.getField @"named_inner_ny" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "named_inner_ny" (BG.Ptr Named_inner) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"named_inner_ny")
+
+instance HasCField.HasCField Named_inner "named_inner_ny" where
+
+  type CFieldType Named_inner "named_inner_ny" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| Struct with a named inner struct.
+
+    Tests that doxygen comment enrichment uses the qualified name "named_outer::named_inner" for lookups.
+
+    __C declaration:__ @struct named_outer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 606:8@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Named_outer = Named_outer
+  { named_outer_inner_field :: Named_inner
+    {- ^ __C declaration:__ @inner_field@
+
+         __defined at:__ @documentation\/doxygen_docs.h 613:7@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , named_outer_nz :: BG.CInt
+    {- ^ Outer field nz
+
+         __C declaration:__ @nz@
+
+         __defined at:__ @documentation\/doxygen_docs.h 615:9@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Named_outer where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Named_outer where
+
+  readRaw =
+    \ptr0 ->
+          pure Named_outer
+      <*> HasCField.readRaw (BG.Proxy @"named_outer_inner_field") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"named_outer_nz") ptr0
+
+instance Marshal.WriteRaw Named_outer where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Named_outer named_outer_inner_field2 named_outer_nz3 ->
+               HasCField.writeRaw (BG.Proxy @"named_outer_inner_field") ptr0 named_outer_inner_field2
+            >> HasCField.writeRaw (BG.Proxy @"named_outer_nz") ptr0 named_outer_nz3
+
+deriving via Marshal.EquivStorable Named_outer instance BG.Storable Named_outer
+
+deriving via Struct.IsStructViaReadRaw Named_outer instance Struct.IsStruct Named_outer
+
+{-| __C declaration:__ @inner_field@
+
+    __defined at:__ @documentation\/doxygen_docs.h 613:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ Named_inner
+         ) => BG.CompatHasField.HasField "named_outer_inner_field" Named_outer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Named_outer { named_outer_inner_field = y1
+                      , named_outer_nz = BG.getField @"named_outer_nz" x0
+                      }
+      , BG.getField @"named_outer_inner_field" x0
+      )
+
+instance ( ty ~ Named_inner
+         ) => BG.HasField "named_outer_inner_field" (BG.Ptr Named_outer) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"named_outer_inner_field")
+
+instance HasCField.HasCField Named_outer "named_outer_inner_field" where
+
+  type CFieldType Named_outer "named_outer_inner_field" =
+    Named_inner
+
+  offset# = \_ -> \_ -> 0
+
+{-| Outer field nz
+
+    __C declaration:__ @nz@
+
+    __defined at:__ @documentation\/doxygen_docs.h 615:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "named_outer_nz" Named_outer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Named_outer { named_outer_nz = y1
+                      , named_outer_inner_field = BG.getField @"named_outer_inner_field" x0
+                      }
+      , BG.getField @"named_outer_nz" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "named_outer_nz" (BG.Ptr Named_outer) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"named_outer_nz")
+
+instance HasCField.HasCField Named_outer "named_outer_nz" where
+
+  type CFieldType Named_outer "named_outer_nz" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct \@deep_mid_untagged_field@
+
+    __defined at:__ @documentation\/doxygen_docs.h 629:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Deep_mid_untagged_field = Deep_mid_untagged_field
+  { deep_mid_untagged_field_deep_a :: BG.CInt
+    {- ^ Deep field
+
+         __C declaration:__ @deep_a@
+
+         __defined at:__ @documentation\/doxygen_docs.h 631:17@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Deep_mid_untagged_field where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Deep_mid_untagged_field where
+
+  readRaw =
+    \ptr0 ->
+          pure Deep_mid_untagged_field
+      <*> HasCField.readRaw (BG.Proxy @"deep_mid_untagged_field_deep_a") ptr0
+
+instance Marshal.WriteRaw Deep_mid_untagged_field where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Deep_mid_untagged_field deep_mid_untagged_field_deep_a2 ->
+            HasCField.writeRaw (BG.Proxy @"deep_mid_untagged_field_deep_a") ptr0 deep_mid_untagged_field_deep_a2
+
+deriving via Marshal.EquivStorable Deep_mid_untagged_field instance BG.Storable Deep_mid_untagged_field
+
+deriving via Struct.IsStructViaReadRaw Deep_mid_untagged_field instance Struct.IsStruct Deep_mid_untagged_field
+
+{-| Deep field
+
+    __C declaration:__ @deep_a@
+
+    __defined at:__ @documentation\/doxygen_docs.h 631:17@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "deep_mid_untagged_field_deep_a" Deep_mid_untagged_field ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Deep_mid_untagged_field {deep_mid_untagged_field_deep_a = y1}
+      , BG.getField @"deep_mid_untagged_field_deep_a" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "deep_mid_untagged_field_deep_a" (BG.Ptr Deep_mid_untagged_field) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deep_mid_untagged_field_deep_a")
+
+instance HasCField.HasCField Deep_mid_untagged_field "deep_mid_untagged_field_deep_a" where
+
+  type CFieldType Deep_mid_untagged_field "deep_mid_untagged_field_deep_a" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| The named mid-level struct
+
+    __C declaration:__ @struct deep_mid@
+
+    __defined at:__ @documentation\/doxygen_docs.h 625:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Deep_mid = Deep_mid
+  { deep_mid_m :: BG.CInt
+    {- ^ Mid-level field
+
+         __C declaration:__ @m@
+
+         __defined at:__ @documentation\/doxygen_docs.h 627:13@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , deep_mid_untagged_field :: Deep_mid_untagged_field
+    {- ^ Untagged struct inside named mid
+
+         __C declaration:__ @untagged_field@
+
+         __defined at:__ @documentation\/doxygen_docs.h 632:11@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Deep_mid where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Deep_mid where
+
+  readRaw =
+    \ptr0 ->
+          pure Deep_mid
+      <*> HasCField.readRaw (BG.Proxy @"deep_mid_m") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"deep_mid_untagged_field") ptr0
+
+instance Marshal.WriteRaw Deep_mid where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Deep_mid deep_mid_m2 deep_mid_untagged_field3 ->
+               HasCField.writeRaw (BG.Proxy @"deep_mid_m") ptr0 deep_mid_m2
+            >> HasCField.writeRaw (BG.Proxy @"deep_mid_untagged_field") ptr0 deep_mid_untagged_field3
+
+deriving via Marshal.EquivStorable Deep_mid instance BG.Storable Deep_mid
+
+deriving via Struct.IsStructViaReadRaw Deep_mid instance Struct.IsStruct Deep_mid
+
+{-| Mid-level field
+
+    __C declaration:__ @m@
+
+    __defined at:__ @documentation\/doxygen_docs.h 627:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "deep_mid_m" Deep_mid ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Deep_mid { deep_mid_m = y1
+                   , deep_mid_untagged_field = BG.getField @"deep_mid_untagged_field" x0
+                   }
+      , BG.getField @"deep_mid_m" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "deep_mid_m" (BG.Ptr Deep_mid) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"deep_mid_m")
+
+instance HasCField.HasCField Deep_mid "deep_mid_m" where
+
+  type CFieldType Deep_mid "deep_mid_m" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Untagged struct inside named mid
+
+    __C declaration:__ @untagged_field@
+
+    __defined at:__ @documentation\/doxygen_docs.h 632:11@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ Deep_mid_untagged_field
+         ) => BG.CompatHasField.HasField "deep_mid_untagged_field" Deep_mid ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Deep_mid {deep_mid_untagged_field = y1, deep_mid_m = BG.getField @"deep_mid_m" x0}
+      , BG.getField @"deep_mid_untagged_field" x0
+      )
+
+instance ( ty ~ Deep_mid_untagged_field
+         ) => BG.HasField "deep_mid_untagged_field" (BG.Ptr Deep_mid) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deep_mid_untagged_field")
+
+instance HasCField.HasCField Deep_mid "deep_mid_untagged_field" where
+
+  type CFieldType Deep_mid "deep_mid_untagged_field" =
+    Deep_mid_untagged_field
+
+  offset# = \_ -> \_ -> 4
+
+{-| Deeply nested mix of tagged and untagged structs.
+
+    Tests the full genealogy walk through mixed tagged/untagged nesting.
+
+    __C declaration:__ @struct deep_outer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 623:8@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Deep_outer = Deep_outer
+  { deep_outer_mid_field :: Deep_mid
+    {- ^ __C declaration:__ @mid_field@
+
+         __defined at:__ @documentation\/doxygen_docs.h 633:7@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , deep_outer_o :: BG.CInt
+    {- ^ Outer-only field
+
+         __C declaration:__ @o@
+
+         __defined at:__ @documentation\/doxygen_docs.h 635:9@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Deep_outer where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Deep_outer where
+
+  readRaw =
+    \ptr0 ->
+          pure Deep_outer
+      <*> HasCField.readRaw (BG.Proxy @"deep_outer_mid_field") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"deep_outer_o") ptr0
+
+instance Marshal.WriteRaw Deep_outer where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Deep_outer deep_outer_mid_field2 deep_outer_o3 ->
+               HasCField.writeRaw (BG.Proxy @"deep_outer_mid_field") ptr0 deep_outer_mid_field2
+            >> HasCField.writeRaw (BG.Proxy @"deep_outer_o") ptr0 deep_outer_o3
+
+deriving via Marshal.EquivStorable Deep_outer instance BG.Storable Deep_outer
+
+deriving via Struct.IsStructViaReadRaw Deep_outer instance Struct.IsStruct Deep_outer
+
+{-| __C declaration:__ @mid_field@
+
+    __defined at:__ @documentation\/doxygen_docs.h 633:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ Deep_mid
+         ) => BG.CompatHasField.HasField "deep_outer_mid_field" Deep_outer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Deep_outer {deep_outer_mid_field = y1, deep_outer_o = BG.getField @"deep_outer_o" x0}
+      , BG.getField @"deep_outer_mid_field" x0
+      )
+
+instance ( ty ~ Deep_mid
+         ) => BG.HasField "deep_outer_mid_field" (BG.Ptr Deep_outer) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deep_outer_mid_field")
+
+instance HasCField.HasCField Deep_outer "deep_outer_mid_field" where
+
+  type CFieldType Deep_outer "deep_outer_mid_field" =
+    Deep_mid
+
+  offset# = \_ -> \_ -> 0
+
+{-| Outer-only field
+
+    __C declaration:__ @o@
+
+    __defined at:__ @documentation\/doxygen_docs.h 635:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "deep_outer_o" Deep_outer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Deep_outer { deep_outer_o = y1
+                     , deep_outer_mid_field = BG.getField @"deep_outer_mid_field" x0
+                     }
+      , BG.getField @"deep_outer_o" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "deep_outer_o" (BG.Ptr Deep_outer) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"deep_outer_o")
+
+instance HasCField.HasCField Deep_outer "deep_outer_o" where
+
+  type CFieldType Deep_outer "deep_outer_o" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct \@unnamed_field_t_anon\'ua@
+
+    __defined at:__ @documentation\/doxygen_docs.h 647:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Unnamed_field_t_anon'ua = Unnamed_field_t_anon'ua
+  { unnamed_field_t_anon'ua_ua :: BG.CInt
+    {- ^ Unnamed inner a
+
+         __C declaration:__ @ua@
+
+         __defined at:__ @documentation\/doxygen_docs.h 649:13@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , unnamed_field_t_anon'ua_ub :: BG.CInt
+    {- ^ Unnamed inner b
+
+         __C declaration:__ @ub@
+
+         __defined at:__ @documentation\/doxygen_docs.h 651:13@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unnamed_field_t_anon'ua where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Unnamed_field_t_anon'ua where
+
+  readRaw =
+    \ptr0 ->
+          pure Unnamed_field_t_anon'ua
+      <*> HasCField.readRaw (BG.Proxy @"unnamed_field_t_anon'ua_ua") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"unnamed_field_t_anon'ua_ub") ptr0
+
+instance Marshal.WriteRaw Unnamed_field_t_anon'ua where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unnamed_field_t_anon'ua
+            unnamed_field_t_anon'ua_ua2
+            unnamed_field_t_anon'ua_ub3 ->
+                 HasCField.writeRaw (BG.Proxy @"unnamed_field_t_anon'ua_ua") ptr0 unnamed_field_t_anon'ua_ua2
+              >> HasCField.writeRaw (BG.Proxy @"unnamed_field_t_anon'ua_ub") ptr0 unnamed_field_t_anon'ua_ub3
+
+deriving via Marshal.EquivStorable Unnamed_field_t_anon'ua instance BG.Storable Unnamed_field_t_anon'ua
+
+deriving via Struct.IsStructViaReadRaw Unnamed_field_t_anon'ua instance Struct.IsStruct Unnamed_field_t_anon'ua
+
+{-| Unnamed inner a
+
+    __C declaration:__ @ua@
+
+    __defined at:__ @documentation\/doxygen_docs.h 649:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unnamed_field_t_anon'ua_ua" Unnamed_field_t_anon'ua ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unnamed_field_t_anon'ua { unnamed_field_t_anon'ua_ua = y1
+                                  , unnamed_field_t_anon'ua_ub = BG.getField @"unnamed_field_t_anon'ua_ub" x0
+                                  }
+      , BG.getField @"unnamed_field_t_anon'ua_ua" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unnamed_field_t_anon'ua_ua" (BG.Ptr Unnamed_field_t_anon'ua) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unnamed_field_t_anon'ua_ua")
+
+instance HasCField.HasCField Unnamed_field_t_anon'ua "unnamed_field_t_anon'ua_ua" where
+
+  type CFieldType Unnamed_field_t_anon'ua "unnamed_field_t_anon'ua_ua" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Unnamed inner b
+
+    __C declaration:__ @ub@
+
+    __defined at:__ @documentation\/doxygen_docs.h 651:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unnamed_field_t_anon'ua_ub" Unnamed_field_t_anon'ua ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unnamed_field_t_anon'ua { unnamed_field_t_anon'ua_ub = y1
+                                  , unnamed_field_t_anon'ua_ua = BG.getField @"unnamed_field_t_anon'ua_ua" x0
+                                  }
+      , BG.getField @"unnamed_field_t_anon'ua_ub" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unnamed_field_t_anon'ua_ub" (BG.Ptr Unnamed_field_t_anon'ua) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unnamed_field_t_anon'ua_ub")
+
+instance HasCField.HasCField Unnamed_field_t_anon'ua "unnamed_field_t_anon'ua_ub" where
+
+  type CFieldType Unnamed_field_t_anon'ua "unnamed_field_t_anon'ua_ub" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| Struct with anonymous struct.
+
+    Tests the case where the inner struct is anonymous: no struct tag and no field name. The inner fields are flattened directly into the parent.
+
+    __C declaration:__ @struct unnamed_field_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 644:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Unnamed_field_t = Unnamed_field_t
+  { unnamed_field_t_before :: BG.CInt
+    {- ^ Before field
+
+         __C declaration:__ @before@
+
+         __defined at:__ @documentation\/doxygen_docs.h 646:9@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , unnamed_field_t_anon'ua :: Unnamed_field_t_anon'ua
+    {- ^ __C declaration:__ @anon\'ua@
+
+         __defined at:__ @documentation\/doxygen_docs.h 647:5@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  , unnamed_field_t_after :: BG.CInt
+    {- ^ After field
+
+         __C declaration:__ @after@
+
+         __defined at:__ @documentation\/doxygen_docs.h 654:9@
+
+         __exported by:__ @documentation\/doxygen_docs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Unnamed_field_t where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Unnamed_field_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Unnamed_field_t
+      <*> HasCField.readRaw (BG.Proxy @"unnamed_field_t_before") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"unnamed_field_t_anon'ua") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"unnamed_field_t_after") ptr0
+
+instance Marshal.WriteRaw Unnamed_field_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Unnamed_field_t
+            unnamed_field_t_before2
+            unnamed_field_t_anon'ua3
+            unnamed_field_t_after4 ->
+                 HasCField.writeRaw (BG.Proxy @"unnamed_field_t_before") ptr0 unnamed_field_t_before2
+              >> HasCField.writeRaw (BG.Proxy @"unnamed_field_t_anon'ua") ptr0 unnamed_field_t_anon'ua3
+              >> HasCField.writeRaw (BG.Proxy @"unnamed_field_t_after") ptr0 unnamed_field_t_after4
+
+deriving via Marshal.EquivStorable Unnamed_field_t instance BG.Storable Unnamed_field_t
+
+deriving via Struct.IsStructViaReadRaw Unnamed_field_t instance Struct.IsStruct Unnamed_field_t
+
+{-| Before field
+
+    __C declaration:__ @before@
+
+    __defined at:__ @documentation\/doxygen_docs.h 646:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unnamed_field_t_before" Unnamed_field_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unnamed_field_t { unnamed_field_t_before = y1
+                          , unnamed_field_t_anon'ua = BG.getField @"unnamed_field_t_anon'ua" x0
+                          , unnamed_field_t_after = BG.getField @"unnamed_field_t_after" x0
+                          }
+      , BG.getField @"unnamed_field_t_before" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unnamed_field_t_before" (BG.Ptr Unnamed_field_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unnamed_field_t_before")
+
+instance HasCField.HasCField Unnamed_field_t "unnamed_field_t_before" where
+
+  type CFieldType Unnamed_field_t "unnamed_field_t_before" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'ua@
+
+    __defined at:__ @documentation\/doxygen_docs.h 647:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ Unnamed_field_t_anon'ua
+         ) => BG.CompatHasField.HasField "unnamed_field_t_anon'ua" Unnamed_field_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unnamed_field_t { unnamed_field_t_anon'ua = y1
+                          , unnamed_field_t_before = BG.getField @"unnamed_field_t_before" x0
+                          , unnamed_field_t_after = BG.getField @"unnamed_field_t_after" x0
+                          }
+      , BG.getField @"unnamed_field_t_anon'ua" x0
+      )
+
+instance ( ty ~ Unnamed_field_t_anon'ua
+         ) => BG.HasField "unnamed_field_t_anon'ua" (BG.Ptr Unnamed_field_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unnamed_field_t_anon'ua")
+
+instance HasCField.HasCField Unnamed_field_t "unnamed_field_t_anon'ua" where
+
+  type CFieldType Unnamed_field_t "unnamed_field_t_anon'ua" =
+    Unnamed_field_t_anon'ua
+
+  offset# = \_ -> \_ -> 4
+
+{-| Unnamed inner a
+
+    __C declaration:__ @ua@
+
+    __defined at:__ @documentation\/doxygen_docs.h 649:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unnamed_field_t_ua" Unnamed_field_t ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"unnamed_field_t_anon'ua_ua" (BG.getField @"unnamed_field_t_anon'ua" x0)
+
+{-| Unnamed inner a
+
+    __C declaration:__ @ua@
+
+    __defined at:__ @documentation\/doxygen_docs.h 649:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unnamed_field_t_ua" Unnamed_field_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"unnamed_field_t_anon'ua" x0 (\z2 ->
+                                                                         BG.CompatHasField.setField @"unnamed_field_t_anon'ua_ua" z2 y1)
+      , BG.getField @"unnamed_field_t_ua" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unnamed_field_t_ua" (BG.Ptr Unnamed_field_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unnamed_field_t_ua")
+
+instance HasCField.HasCField Unnamed_field_t "unnamed_field_t_ua" where
+
+  type CFieldType Unnamed_field_t "unnamed_field_t_ua" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| Unnamed inner b
+
+    __C declaration:__ @ub@
+
+    __defined at:__ @documentation\/doxygen_docs.h 651:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unnamed_field_t_ub" Unnamed_field_t ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"unnamed_field_t_anon'ua_ub" (BG.getField @"unnamed_field_t_anon'ua" x0)
+
+{-| Unnamed inner b
+
+    __C declaration:__ @ub@
+
+    __defined at:__ @documentation\/doxygen_docs.h 651:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unnamed_field_t_ub" Unnamed_field_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"unnamed_field_t_anon'ua" x0 (\z2 ->
+                                                                         BG.CompatHasField.setField @"unnamed_field_t_anon'ua_ub" z2 y1)
+      , BG.getField @"unnamed_field_t_ub" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unnamed_field_t_ub" (BG.Ptr Unnamed_field_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unnamed_field_t_ub")
+
+instance HasCField.HasCField Unnamed_field_t "unnamed_field_t_ub" where
+
+  type CFieldType Unnamed_field_t "unnamed_field_t_ub" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| After field
+
+    __C declaration:__ @after@
+
+    __defined at:__ @documentation\/doxygen_docs.h 654:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unnamed_field_t_after" Unnamed_field_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Unnamed_field_t { unnamed_field_t_after = y1
+                          , unnamed_field_t_before = BG.getField @"unnamed_field_t_before" x0
+                          , unnamed_field_t_anon'ua = BG.getField @"unnamed_field_t_anon'ua" x0
+                          }
+      , BG.getField @"unnamed_field_t_after" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unnamed_field_t_after" (BG.Ptr Unnamed_field_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unnamed_field_t_after")
+
+instance HasCField.HasCField Unnamed_field_t "unnamed_field_t_after" where
+
+  type CFieldType Unnamed_field_t "unnamed_field_t_after" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 12
+
+{-| API version number (not in any group).
+
+    __C declaration:__ @api_version_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 662:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Api_version_t = Api_version_t
+  { unwrapApi_version_t :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapApi_version_t" Api_version_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Api_version_t {unwrapApi_version_t = y1}
+      , BG.getField @"unwrapApi_version_t" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapApi_version_t" (BG.Ptr Api_version_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapApi_version_t")
+
+instance HasCField.HasCField Api_version_t "unwrapApi_version_t" where
+
+  type CFieldType Api_version_t "unwrapApi_version_t" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/documentation/doxygen_docs/Example/FunPtr.hs b/test-artefacts/fixtures/documentation/doxygen_docs/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/doxygen_docs/Example/FunPtr.hs
@@ -0,0 +1,1049 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( -- * Function Definitions
+      Example.FunPtr.process_data
+    , Example.FunPtr.process_file
+    , Example.FunPtr.calculate_value
+    , Example.FunPtr.html_example
+    , Example.FunPtr.list_example
+    , Example.FunPtr.dangerous_function
+    , Example.FunPtr.detailed_return_codes
+    , Example.FunPtr.old_function
+    , Example.FunPtr.versioned_function
+    , Example.FunPtr.process_buffer
+    , Example.FunPtr.my_memcpy
+    , Example.FunPtr.double_value
+      -- ** I/O Helpers
+    , Example.FunPtr.read_chunk
+    , Example.FunPtr.write_chunk
+      -- * Advanced Features
+    , Example.FunPtr.complex_function
+    , Example.FunPtr.hash
+    , Example.FunPtr.square
+      -- * Extra Doxygen Coverage
+    , Example.FunPtr.auto_brief_func
+    , Example.FunPtr.multi_paragraph_details
+    , Example.FunPtr.todo_remark_attention
+    , Example.FunPtr.html_entities_func
+    , Example.FunPtr.nested_inline_format
+    , Example.FunPtr.tagged_code_example
+    , Example.FunPtr.backslash_syntax
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <documentation/doxygen_docs.h>"
+  , "/* test_documentationdoxygen_docs_Example_get_process_data */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_4a5cd66a4f26f8d5 (void)) ("
+  , "  uint8_t const *arg1,"
+  , "  uint8_t *arg2,"
+  , "  size_t *arg3"
+  , ")"
+  , "{"
+  , "  return &process_data;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_process_file */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_c8a059c65f18fea9 (void)) ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return &process_file;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_calculate_value */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_5ab7e06724867ab3 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &calculate_value;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_html_example */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_3f74fb834b0cd46b (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &html_example;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_list_example */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_2175b3c627db39cf (void)) ("
+  , "  char const **arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &list_example;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_dangerous_function */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_b7a4debd18827a19 (void)) ("
+  , "  void *arg1"
+  , ")"
+  , "{"
+  , "  return &dangerous_function;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_detailed_return_codes */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_9700b22f82eedafe (void)) ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return &detailed_return_codes;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_old_function */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_49e0d34a627c6c19 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &old_function;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_versioned_function */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_180cd7537e40ce99 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &versioned_function;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_process_buffer */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_f4ccc6d90e8d3ebd (void)) ("
+  , "  char *arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &process_buffer;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_my_memcpy */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_6a74d376c901b531 (void)) ("
+  , "  void *arg1,"
+  , "  void const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return &my_memcpy;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_double_value */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_156a92f3c5176105 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &double_value;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_read_chunk */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_373de63fa8345f66 (void)) ("
+  , "  signed int arg1,"
+  , "  void *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return &read_chunk;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_write_chunk */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_78a029fc9807a27f (void)) ("
+  , "  signed int arg1,"
+  , "  void const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return &write_chunk;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_complex_function */"
+  , "__attribute__ ((const))"
+  , "status_code_t (*hs_bindgen_dfa39b6be50cb2ca (void)) ("
+  , "  config_t *arg1,"
+  , "  uint8_t const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return &complex_function;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_hash */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_8ad88b79fd71f9d4 (void)) ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return &hash;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_square */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_7ede0f7ec1b30650 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &square;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_auto_brief_func */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_11a28326d5a28a43 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &auto_brief_func;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_multi_paragraph_details */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_05c7a7832fb84e2e (void)) ("
+  , "  char *arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &multi_paragraph_details;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_todo_remark_attention */"
+  , "__attribute__ ((const))"
+  , "signed int *(*hs_bindgen_092b9697f2154ac5 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &todo_remark_attention;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_html_entities_func */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2e8b5e895e58fc3d (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &html_entities_func;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_nested_inline_format */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_db292926f05c7b36 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &nested_inline_format;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_tagged_code_example */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_492a4fd860afb02a (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &tagged_code_example;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_backslash_syntax */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_9ef09ad63fac68e2 (void)) ("
+  , "  char const *arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return &backslash_syntax;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_data@
+foreign import ccall unsafe "hs_bindgen_4a5cd66a4f26f8d5" hs_bindgen_4a5cd66a4f26f8d5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_data@
+hs_bindgen_4a5cd66a4f26f8d5 :: IO (BG.FunPtr (PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8 -> BG.Ptr HsBindgen.Runtime.LibC.Word8 -> BG.Ptr HsBindgen.Runtime.LibC.CSize -> IO BG.CInt))
+hs_bindgen_4a5cd66a4f26f8d5 =
+  fmap BG.fromFFIType hs_bindgen_4a5cd66a4f26f8d5_base
+
+{-# NOINLINE process_data #-}
+{-| Function with detailed parameter documentation.
+
+    This function shows different parameter directions and types.
+
+    [__@input_data@ /(input)/__]: Input data buffer
+
+    [__@output_data@ /(output)/__]: Output data buffer
+
+    [__@size@ /(input,output)/__]: Size of data, updated on return
+
+    __Returns:__ Status code (0 = success, -1 = error)
+
+    __C declaration:__ @process_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 111:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_data :: BG.FunPtr (PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8 -> BG.Ptr HsBindgen.Runtime.LibC.Word8 -> BG.Ptr HsBindgen.Runtime.LibC.CSize -> IO BG.CInt)
+process_data =
+  BG.unsafePerformIO hs_bindgen_4a5cd66a4f26f8d5
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_file@
+foreign import ccall unsafe "hs_bindgen_c8a059c65f18fea9" hs_bindgen_c8a059c65f18fea9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_file@
+hs_bindgen_c8a059c65f18fea9 :: IO (BG.FunPtr (PtrConst.PtrConst BG.CChar -> IO BG.CBool))
+hs_bindgen_c8a059c65f18fea9 =
+  fmap BG.fromFFIType hs_bindgen_c8a059c65f18fea9_base
+
+{-# NOINLINE process_file #-}
+{-| Function with inline commands and formatting.
+
+    This function uses @inline@ @code@ formatting and __bold__ text. It also demonstrates /emphasized/ text.
+
+    [__@filename@__]: The @char*@ filename to process
+
+    __Returns:__ @true@ if successful, @false@ otherwise
+
+    __C declaration:__ @process_file@
+
+    __defined at:__ @documentation\/doxygen_docs.h 122:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_file :: BG.FunPtr (PtrConst.PtrConst BG.CChar -> IO BG.CBool)
+process_file =
+  BG.unsafePerformIO hs_bindgen_c8a059c65f18fea9
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_calculate_value@
+foreign import ccall unsafe "hs_bindgen_5ab7e06724867ab3" hs_bindgen_5ab7e06724867ab3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_calculate_value@
+hs_bindgen_5ab7e06724867ab3 :: IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO BG.CInt))
+hs_bindgen_5ab7e06724867ab3 =
+  fmap BG.fromFFIType hs_bindgen_5ab7e06724867ab3_base
+
+{-# NOINLINE calculate_value #-}
+{-| Function with verbatim code blocks.
+
+    Example usage:
+
+    @
+    int result = calculate_value(10, 20);
+    printf("Result: %d\n", result);
+    @
+
+    [__@base@__]: Base value
+
+    [__@multiplier@__]: Multiplier value
+
+    __Returns:__ Calculated result
+
+    __C declaration:__ @calculate_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 137:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+calculate_value :: BG.FunPtr (BG.CInt -> BG.CInt -> IO BG.CInt)
+calculate_value =
+  BG.unsafePerformIO hs_bindgen_5ab7e06724867ab3
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_example@
+foreign import ccall unsafe "hs_bindgen_3f74fb834b0cd46b" hs_bindgen_3f74fb834b0cd46b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_example@
+hs_bindgen_3f74fb834b0cd46b :: IO (BG.FunPtr (BG.CInt -> IO BG.CBool))
+hs_bindgen_3f74fb834b0cd46b =
+  fmap BG.fromFFIType hs_bindgen_3f74fb834b0cd46b_base
+
+{-# NOINLINE html_example #-}
+{-| Function with HTML formatting.
+
+    This function demonstrates __HTML bold__ and /italic/ text. It also shows @HTML code@ formatting.
+
+    Input
+
+    Output
+
+    0
+
+    false
+
+    1
+
+    true
+
+    [__@value@__]: Input value
+
+    __Returns:__ Boolean result
+
+    __C declaration:__ @html_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 154:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_example :: BG.FunPtr (BG.CInt -> IO BG.CBool)
+html_example =
+  BG.unsafePerformIO hs_bindgen_3f74fb834b0cd46b
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_list_example@
+foreign import ccall unsafe "hs_bindgen_2175b3c627db39cf" hs_bindgen_2175b3c627db39cf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_list_example@
+hs_bindgen_2175b3c627db39cf :: IO (BG.FunPtr (BG.Ptr (PtrConst.PtrConst BG.CChar) -> HsBindgen.Runtime.LibC.CSize -> IO BG.CBool))
+hs_bindgen_2175b3c627db39cf =
+  fmap BG.fromFFIType hs_bindgen_2175b3c627db39cf_base
+
+{-# NOINLINE list_example #-}
+{-| Function with lists and special formatting.
+
+    This function demonstrates:
+
+    * Bullet point lists
+      * Nested list item 1
+      * Nested list item 2
+
+    * Multiple items
+
+    * Nested formatting
+
+    Numbered list:
+
+    1. First @item@ 1. item
+
+    2. Second __item__
+
+    3. Third item
+
+    Other numbered list:
+
+    1. A
+
+    2. B
+
+    3. C
+
+    [__@items@__]: Array of items
+
+    [__@count@__]: Number of items
+
+    __Returns:__ Success status
+
+    __C declaration:__ @list_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 180:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+list_example :: BG.FunPtr (BG.Ptr (PtrConst.PtrConst BG.CChar) -> HsBindgen.Runtime.LibC.CSize -> IO BG.CBool)
+list_example =
+  BG.unsafePerformIO hs_bindgen_2175b3c627db39cf
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_dangerous_function@
+foreign import ccall unsafe "hs_bindgen_b7a4debd18827a19" hs_bindgen_b7a4debd18827a19_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_dangerous_function@
+hs_bindgen_b7a4debd18827a19 :: IO (BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)))
+hs_bindgen_b7a4debd18827a19 =
+  fmap BG.fromFFIType hs_bindgen_b7a4debd18827a19_base
+
+{-# NOINLINE dangerous_function #-}
+{-| Function with warnings and notes.
+
+    __WARNING:__ This function may cause side effects
+
+    __Note:__ Use with caution in multithreaded environments
+
+    __See:__ related_function() for similar functionality
+
+    [__@ptr@__]: Pointer to data
+
+    __Returns:__ Modified pointer
+
+    __C declaration:__ @dangerous_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 192:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+dangerous_function :: BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+dangerous_function =
+  BG.unsafePerformIO hs_bindgen_b7a4debd18827a19
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_detailed_return_codes@
+foreign import ccall unsafe "hs_bindgen_9700b22f82eedafe" hs_bindgen_9700b22f82eedafe_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_detailed_return_codes@
+hs_bindgen_9700b22f82eedafe :: IO (BG.FunPtr (PtrConst.PtrConst BG.CChar -> IO BG.CInt))
+hs_bindgen_9700b22f82eedafe =
+  fmap BG.fromFFIType hs_bindgen_9700b22f82eedafe_base
+
+{-# NOINLINE detailed_return_codes #-}
+{-| Function with return value details.
+
+    [__@input@__]: Input string
+
+    [__@0@__]: Success
+
+    [__@-1@__]: Invalid input
+
+    [__@-2@__]: Memory allocation failed
+
+    [__@-3@__]: Processing error
+
+    __C declaration:__ @detailed_return_codes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 203:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+detailed_return_codes :: BG.FunPtr (PtrConst.PtrConst BG.CChar -> IO BG.CInt)
+detailed_return_codes =
+  BG.unsafePerformIO hs_bindgen_9700b22f82eedafe
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_old_function@
+foreign import ccall unsafe "hs_bindgen_49e0d34a627c6c19" hs_bindgen_49e0d34a627c6c19_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_old_function@
+hs_bindgen_49e0d34a627c6c19 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_49e0d34a627c6c19 =
+  fmap BG.fromFFIType hs_bindgen_49e0d34a627c6c19_base
+
+{-# NOINLINE old_function #-}
+{-| Function with deprecated annotation.
+
+    __Deprecated:__ Use new_function() instead
+
+    [__@old_param@__]: Legacy parameter
+
+    __Returns:__ Legacy result
+
+    __C declaration:__ @old_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 212:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+old_function :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+old_function =
+  BG.unsafePerformIO hs_bindgen_49e0d34a627c6c19
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_versioned_function@
+foreign import ccall unsafe "hs_bindgen_180cd7537e40ce99" hs_bindgen_180cd7537e40ce99_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_versioned_function@
+hs_bindgen_180cd7537e40ce99 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_180cd7537e40ce99 =
+  fmap BG.fromFFIType hs_bindgen_180cd7537e40ce99_base
+
+{-# NOINLINE versioned_function #-}
+{-| Function with version information.
+
+    @since 1.0
+
+    __Version:__ 1.2
+
+    [__@data@__]: Input data
+
+    __Returns:__ Processed data
+
+    __C declaration:__ @versioned_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 222:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+versioned_function :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+versioned_function =
+  BG.unsafePerformIO hs_bindgen_180cd7537e40ce99
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_buffer@
+foreign import ccall unsafe "hs_bindgen_f4ccc6d90e8d3ebd" hs_bindgen_f4ccc6d90e8d3ebd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_buffer@
+hs_bindgen_f4ccc6d90e8d3ebd :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 64 BG.CChar)) -> HsBindgen.Runtime.LibC.CSize -> IO BG.CInt))
+hs_bindgen_f4ccc6d90e8d3ebd =
+  fmap BG.fromFFIType hs_bindgen_f4ccc6d90e8d3ebd_base
+
+{-# NOINLINE process_buffer #-}
+{-| Static array parameter.
+
+    [__@buffer@__]: Buffer with minimum size
+
+    [__@size@__]: Actual buffer size
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @process_buffer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 338:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_buffer :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 64 BG.CChar)) -> HsBindgen.Runtime.LibC.CSize -> IO BG.CInt)
+process_buffer =
+  BG.unsafePerformIO hs_bindgen_f4ccc6d90e8d3ebd
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_my_memcpy@
+foreign import ccall unsafe "hs_bindgen_6a74d376c901b531" hs_bindgen_6a74d376c901b531_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_my_memcpy@
+hs_bindgen_6a74d376c901b531 :: IO (BG.FunPtr (BG.Ptr BG.Void -> PtrConst.PtrConst BG.Void -> HsBindgen.Runtime.LibC.CSize -> IO (BG.Ptr BG.Void)))
+hs_bindgen_6a74d376c901b531 =
+  fmap BG.fromFFIType hs_bindgen_6a74d376c901b531_base
+
+{-# NOINLINE my_memcpy #-}
+{-| Function with restrict pointers.
+
+    [__@dest@__]: Destination buffer (restrict)
+
+    [__@src@__]: Source buffer (restrict)
+
+    [__@n@__]: Number of bytes
+
+    __Returns:__ Destination pointer
+
+    __C declaration:__ @my_memcpy@
+
+    __defined at:__ @documentation\/doxygen_docs.h 348:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+my_memcpy :: BG.FunPtr (BG.Ptr BG.Void -> PtrConst.PtrConst BG.Void -> HsBindgen.Runtime.LibC.CSize -> IO (BG.Ptr BG.Void))
+my_memcpy =
+  BG.unsafePerformIO hs_bindgen_6a74d376c901b531
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_double_value@
+foreign import ccall unsafe "hs_bindgen_156a92f3c5176105" hs_bindgen_156a92f3c5176105_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_double_value@
+hs_bindgen_156a92f3c5176105 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_156a92f3c5176105 =
+  fmap BG.fromFFIType hs_bindgen_156a92f3c5176105_base
+
+{-# NOINLINE double_value #-}
+{-| Inline function.
+
+    [__@x@__]: Input value
+
+    __Returns:__ Doubled value
+
+    __C declaration:__ @double_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 356:19@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+double_value :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+double_value =
+  BG.unsafePerformIO hs_bindgen_156a92f3c5176105
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_read_chunk@
+foreign import ccall unsafe "hs_bindgen_373de63fa8345f66" hs_bindgen_373de63fa8345f66_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_read_chunk@
+hs_bindgen_373de63fa8345f66 :: IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.CSize -> IO BG.CInt))
+hs_bindgen_373de63fa8345f66 =
+  fmap BG.fromFFIType hs_bindgen_373de63fa8345f66_base
+
+{-# NOINLINE read_chunk #-}
+{-| Read a chunk of bytes into the provided buffer.
+
+    Demonstrates a section nested inside @functions@ .
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Output buffer
+
+    [__@count@__]: Number of bytes to read
+
+    __Returns:__ Number of bytes read
+
+    __C declaration:__ @read_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 387:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+read_chunk :: BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.CSize -> IO BG.CInt)
+read_chunk =
+  BG.unsafePerformIO hs_bindgen_373de63fa8345f66
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_write_chunk@
+foreign import ccall unsafe "hs_bindgen_78a029fc9807a27f" hs_bindgen_78a029fc9807a27f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_write_chunk@
+hs_bindgen_78a029fc9807a27f :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.Void -> HsBindgen.Runtime.LibC.CSize -> IO BG.CInt))
+hs_bindgen_78a029fc9807a27f =
+  fmap BG.fromFFIType hs_bindgen_78a029fc9807a27f_base
+
+{-# NOINLINE write_chunk #-}
+{-| Write a chunk of bytes from the provided buffer.
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Input buffer
+
+    [__@count@__]: Number of bytes to write
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @write_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 397:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+write_chunk :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.Void -> HsBindgen.Runtime.LibC.CSize -> IO BG.CInt)
+write_chunk =
+  BG.unsafePerformIO hs_bindgen_78a029fc9807a27f
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_complex_function@
+foreign import ccall unsafe "hs_bindgen_dfa39b6be50cb2ca" hs_bindgen_dfa39b6be50cb2ca_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_complex_function@
+hs_bindgen_dfa39b6be50cb2ca :: IO (BG.FunPtr (BG.Ptr Config_t -> PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8 -> HsBindgen.Runtime.LibC.CSize -> IO Status_code_t))
+hs_bindgen_dfa39b6be50cb2ca =
+  fmap BG.fromFFIType hs_bindgen_dfa39b6be50cb2ca_base
+
+{-# NOINLINE complex_function #-}
+{-| Function with complex documentation.
+
+    This function demonstrates multiple documentation features:
+
+    __Description:__
+
+    Performs complex data processing with multiple steps.
+
+    __Algorithm:__
+
+    1. Validate input parameters
+
+    2. Allocate temporary buffers
+
+    3. Process data in chunks
+
+    4. Clean up resources
+
+    __Algorithm2:__
+
+    * Validate input parameters
+
+    * Allocate temporary buffers
+
+    * Process data in chunks
+
+    * Clean up resources
+
+    __Example:__
+
+    @
+    config_t cfg = {
+        .id = 1,
+        .name = "test",
+        .flags = 0,
+        .callback = my_callback,
+        .user_data = NULL
+    };
+
+    status_code_t result = complex_function(&cfg, data, size);
+    if (result != STATUS_OK) {
+        handle_error(result);
+    }
+    @
+
+    [__@config@__]: Configuration structure (see 'Config_t' )
+
+    [__@data@__]: Input data buffer
+
+    [__@size@__]: Size of input data
+
+    __Returns:__ Status code indicating success or failure
+
+    __Precondition:__ config must not be NULL
+
+    __Precondition:__ data must not be NULL if size > 0
+
+    __Postcondition:__ Output data is written to config->user_data
+
+    __WARNING:__ May return NULL if memory allocation fails
+
+    __WARNING:__ Sets errno to EINVAL if parameters are invalid
+
+    __C declaration:__ @complex_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 459:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+complex_function :: BG.FunPtr (BG.Ptr Config_t -> PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8 -> HsBindgen.Runtime.LibC.CSize -> IO Status_code_t)
+complex_function =
+  BG.unsafePerformIO hs_bindgen_dfa39b6be50cb2ca
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_hash@
+foreign import ccall unsafe "hs_bindgen_8ad88b79fd71f9d4" hs_bindgen_8ad88b79fd71f9d4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_hash@
+hs_bindgen_8ad88b79fd71f9d4 :: IO (BG.FunPtr (BG.Ptr BG.CChar -> IO BG.CInt))
+hs_bindgen_8ad88b79fd71f9d4 =
+  fmap BG.fromFFIType hs_bindgen_8ad88b79fd71f9d4_base
+
+{-# NOINLINE hash #-}
+{-| __C declaration:__ @hash@
+
+    __defined at:__ @documentation\/doxygen_docs.h 463:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+hash :: BG.FunPtr (BG.Ptr BG.CChar -> IO BG.CInt)
+hash = BG.unsafePerformIO hs_bindgen_8ad88b79fd71f9d4
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_square@
+foreign import ccall unsafe "hs_bindgen_7ede0f7ec1b30650" hs_bindgen_7ede0f7ec1b30650_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_square@
+hs_bindgen_7ede0f7ec1b30650 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_7ede0f7ec1b30650 =
+  fmap BG.fromFFIType hs_bindgen_7ede0f7ec1b30650_base
+
+{-# NOINLINE square #-}
+{-| __C declaration:__ @square@
+
+    __defined at:__ @documentation\/doxygen_docs.h 465:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+square :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+square =
+  BG.unsafePerformIO hs_bindgen_7ede0f7ec1b30650
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_auto_brief_func@
+foreign import ccall unsafe "hs_bindgen_11a28326d5a28a43" hs_bindgen_11a28326d5a28a43_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_auto_brief_func@
+hs_bindgen_11a28326d5a28a43 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_11a28326d5a28a43 =
+  fmap BG.fromFFIType hs_bindgen_11a28326d5a28a43_base
+
+{-# NOINLINE auto_brief_func #-}
+{-| Auto-brief function without explicit @brief tag.
+
+    This tests that the first sentence is used as the brief description when no explicit @brief is present.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The negated value
+
+    __C declaration:__ @auto_brief_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 486:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+auto_brief_func :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+auto_brief_func =
+  BG.unsafePerformIO hs_bindgen_11a28326d5a28a43
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_multi_paragraph_details@
+foreign import ccall unsafe "hs_bindgen_05c7a7832fb84e2e" hs_bindgen_05c7a7832fb84e2e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_multi_paragraph_details@
+hs_bindgen_05c7a7832fb84e2e :: IO (BG.FunPtr (BG.Ptr BG.CChar -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_05c7a7832fb84e2e =
+  fmap BG.fromFFIType hs_bindgen_05c7a7832fb84e2e_base
+
+{-# NOINLINE multi_paragraph_details #-}
+{-| Multi-paragraph details.
+
+    First paragraph of the detailed description. This explains the basic purpose of the function.
+
+    Second paragraph with more context. This includes information about the algorithm and its complexity, which is O(n) in the input size.
+
+    Third paragraph with usage notes. Callers should ensure that the buffer is large enough before calling this function.
+
+    [__@buf@__]: Output buffer
+
+    [__@len@__]: Buffer length
+
+    __C declaration:__ @multi_paragraph_details@
+
+    __defined at:__ @documentation\/doxygen_docs.h 503:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+multi_paragraph_details :: BG.FunPtr (BG.Ptr BG.CChar -> HsBindgen.Runtime.LibC.CSize -> IO ())
+multi_paragraph_details =
+  BG.unsafePerformIO hs_bindgen_05c7a7832fb84e2e
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_todo_remark_attention@
+foreign import ccall unsafe "hs_bindgen_092b9697f2154ac5" hs_bindgen_092b9697f2154ac5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_todo_remark_attention@
+hs_bindgen_092b9697f2154ac5 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_092b9697f2154ac5 =
+  fmap BG.fromFFIType hs_bindgen_092b9697f2154ac5_base
+
+{-# NOINLINE todo_remark_attention #-}
+{-| Function with @todo and @remark.
+
+    __Todo:__ Optimize this function for large inputs
+
+    Add support for negative values
+
+    __Remark:__ This function is thread-safe
+
+    __ATTENTION:__ The caller must free the returned pointer
+
+    [__@n@__]: Input count
+
+    __Returns:__ Allocated array
+
+    __C declaration:__ @todo_remark_attention@
+
+    __defined at:__ @documentation\/doxygen_docs.h 516:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+todo_remark_attention :: BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+todo_remark_attention =
+  BG.unsafePerformIO hs_bindgen_092b9697f2154ac5
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_entities_func@
+foreign import ccall unsafe "hs_bindgen_2e8b5e895e58fc3d" hs_bindgen_2e8b5e895e58fc3d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_entities_func@
+hs_bindgen_2e8b5e895e58fc3d :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_2e8b5e895e58fc3d =
+  fmap BG.fromFFIType hs_bindgen_2e8b5e895e58fc3d_base
+
+{-# NOINLINE html_entities_func #-}
+{-| HTML entities: & means AND, <tag> is a tag.
+
+    Handles values < 0 and values > 100 differently. Copyright 2025.
+
+    [__@x@__]: Input (> 0 required)
+
+    __Returns:__ Result code
+
+    __C declaration:__ @html_entities_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 538:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_entities_func :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+html_entities_func =
+  BG.unsafePerformIO hs_bindgen_2e8b5e895e58fc3d
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_nested_inline_format@
+foreign import ccall unsafe "hs_bindgen_db292926f05c7b36" hs_bindgen_db292926f05c7b36_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_nested_inline_format@
+hs_bindgen_db292926f05c7b36 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_db292926f05c7b36 =
+  fmap BG.fromFFIType hs_bindgen_db292926f05c7b36_base
+
+{-# NOINLINE nested_inline_format #-}
+{-| Nested inline: __bold__ , @code@ , __@bold_code@ ,__ /__emph_bold__ ./
+
+    [__@x@__]: Input value
+
+    __C declaration:__ @nested_inline_format@
+
+    __defined at:__ @documentation\/doxygen_docs.h 545:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+nested_inline_format :: BG.FunPtr (BG.CInt -> IO ())
+nested_inline_format =
+  BG.unsafePerformIO hs_bindgen_db292926f05c7b36
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_tagged_code_example@
+foreign import ccall unsafe "hs_bindgen_492a4fd860afb02a" hs_bindgen_492a4fd860afb02a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_tagged_code_example@
+hs_bindgen_492a4fd860afb02a :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_492a4fd860afb02a =
+  fmap BG.fromFFIType hs_bindgen_492a4fd860afb02a_base
+
+{-# NOINLINE tagged_code_example #-}
+{-| Language-tagged code block.
+
+    Example usage:
+
+    @
+    int result = tagged_code_example(42);
+    printf("Result: %d\n", result);
+    @
+
+    [__@x@__]: Input value
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @tagged_code_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 559:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+tagged_code_example :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+tagged_code_example =
+  BG.unsafePerformIO hs_bindgen_492a4fd860afb02a
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_backslash_syntax@
+foreign import ccall unsafe "hs_bindgen_9ef09ad63fac68e2" hs_bindgen_9ef09ad63fac68e2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_backslash_syntax@
+hs_bindgen_9ef09ad63fac68e2 :: IO (BG.FunPtr (PtrConst.PtrConst BG.CChar -> BG.Ptr BG.CChar -> IO BG.CInt))
+hs_bindgen_9ef09ad63fac68e2 =
+  fmap BG.fromFFIType hs_bindgen_9ef09ad63fac68e2_base
+
+{-# NOINLINE backslash_syntax #-}
+{-| Function documented with backslash syntax.
+
+    This function uses backslash commands instead of @ commands to verify both syntaxes are handled equivalently.
+
+    [__@input@__]: The input string
+
+    [__@output@__]: The output buffer
+
+    __Returns:__ Number of bytes written
+
+    __See:__ 'auto_brief_func'
+
+    @since 2.0
+
+    __C declaration:__ @backslash_syntax@
+
+    __defined at:__ @documentation\/doxygen_docs.h 574:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+backslash_syntax :: BG.FunPtr (PtrConst.PtrConst BG.CChar -> BG.Ptr BG.CChar -> IO BG.CInt)
+backslash_syntax =
+  BG.unsafePerformIO hs_bindgen_9ef09ad63fac68e2
diff --git a/test-artefacts/fixtures/documentation/doxygen_docs/Example/Global.hs b/test-artefacts/fixtures/documentation/doxygen_docs/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/doxygen_docs/Example/Global.hs
@@ -0,0 +1,78 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( -- * Core Data Types
+      Example.Global.global_counter
+    , Example.Global.version_string
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <documentation/doxygen_docs.h>"
+  , "/* test_documentationdoxygen_docs_Example_get_global_counter */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_f9dede86496f59c9 (void)"
+  , "{"
+  , "  return &global_counter;"
+  , "}"
+  , "/* test_documentationdoxygen_docs_Example_get_version_string */"
+  , "__attribute__ ((const))"
+  , "char const **hs_bindgen_a294be08386c9257 (void)"
+  , "{"
+  , "  return &version_string;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_global_counter@
+foreign import ccall unsafe "hs_bindgen_f9dede86496f59c9" hs_bindgen_f9dede86496f59c9_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_global_counter@
+hs_bindgen_f9dede86496f59c9 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_f9dede86496f59c9 =
+  fmap BG.fromFFIType hs_bindgen_f9dede86496f59c9_base
+
+{-# NOINLINE global_counter #-}
+{-| Global counter variable.
+
+    This variable tracks the number of operations performed.
+
+    __C declaration:__ @global_counter@
+
+    __defined at:__ @documentation\/doxygen_docs.h 63:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+global_counter :: BG.Ptr BG.CInt
+global_counter =
+  BG.unsafePerformIO hs_bindgen_f9dede86496f59c9
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_version_string@
+foreign import ccall unsafe "hs_bindgen_a294be08386c9257" hs_bindgen_a294be08386c9257_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_version_string@
+hs_bindgen_a294be08386c9257 :: IO (BG.Ptr (PtrConst.PtrConst BG.CChar))
+hs_bindgen_a294be08386c9257 =
+  fmap BG.fromFFIType hs_bindgen_a294be08386c9257_base
+
+{-# NOINLINE version_string #-}
+{-| Version string constant.
+
+    __C declaration:__ @version_string@
+
+    __defined at:__ @documentation\/doxygen_docs.h 69:20@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+version_string :: BG.Ptr (PtrConst.PtrConst BG.CChar)
+version_string =
+  BG.unsafePerformIO hs_bindgen_a294be08386c9257
diff --git a/test-artefacts/fixtures/documentation/doxygen_docs/Example/Safe.hs b/test-artefacts/fixtures/documentation/doxygen_docs/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/doxygen_docs/Example/Safe.hs
@@ -0,0 +1,1390 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( -- * Function Definitions
+      Example.Safe.process_data
+    , Example.Safe.process_file
+    , Example.Safe.calculate_value
+    , Example.Safe.html_example
+    , Example.Safe.list_example
+    , Example.Safe.dangerous_function
+    , Example.Safe.detailed_return_codes
+    , Example.Safe.old_function
+    , Example.Safe.versioned_function
+    , Example.Safe.process_buffer
+    , Example.Safe.my_memcpy
+    , Example.Safe.double_value
+      -- ** I/O Helpers
+    , Example.Safe.read_chunk
+    , Example.Safe.write_chunk
+      -- * Advanced Features
+    , Example.Safe.complex_function
+    , Example.Safe.hash
+    , Example.Safe.square
+      -- * Extra Doxygen Coverage
+    , Example.Safe.auto_brief_func
+    , Example.Safe.multi_paragraph_details
+    , Example.Safe.todo_remark_attention
+    , Example.Safe.html_entities_func
+    , Example.Safe.nested_inline_format
+    , Example.Safe.tagged_code_example
+    , Example.Safe.backslash_syntax
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <documentation/doxygen_docs.h>"
+  , "signed int hs_bindgen_7eada9f65d982412 ("
+  , "  uint8_t const *arg1,"
+  , "  uint8_t *arg2,"
+  , "  size_t *arg3"
+  , ")"
+  , "{"
+  , "  return (process_data)(arg1, arg2, arg3);"
+  , "}"
+  , "_Bool hs_bindgen_fb85499c501da1a7 ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (process_file)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_a73fc7b108035c5c ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (calculate_value)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_9b7f6745401b4652 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (html_example)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_825411dc114e599b ("
+  , "  char const **arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (list_example)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_17264dcff7e9b698 ("
+  , "  void *arg1"
+  , ")"
+  , "{"
+  , "  return (dangerous_function)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_c8ca619ec2e70d8d ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (detailed_return_codes)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_25e1070e2ce10048 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (old_function)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_a9eeeb09808e71cc ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (versioned_function)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0c0057f1700372a7 ("
+  , "  char *arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (process_buffer)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_294db77671f95524 ("
+  , "  void *arg1,"
+  , "  void const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (my_memcpy)(arg1, arg2, arg3);"
+  , "}"
+  , "signed int hs_bindgen_f5bc63a9952c2618 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (double_value)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_3545f99d29c4fc53 ("
+  , "  signed int arg1,"
+  , "  void *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (read_chunk)(arg1, arg2, arg3);"
+  , "}"
+  , "signed int hs_bindgen_839c1d19dfe95042 ("
+  , "  signed int arg1,"
+  , "  void const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (write_chunk)(arg1, arg2, arg3);"
+  , "}"
+  , "status_code_t hs_bindgen_c4e7e99dba20204d ("
+  , "  config_t *arg1,"
+  , "  uint8_t const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (complex_function)(arg1, arg2, arg3);"
+  , "}"
+  , "signed int hs_bindgen_935f2aead358d9ef ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (hash)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_39fef54c23d4e1ee ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_29749932a4449f10 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (auto_brief_func)(arg1);"
+  , "}"
+  , "void hs_bindgen_03f0269c9296b8c0 ("
+  , "  char *arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  (multi_paragraph_details)(arg1, arg2);"
+  , "}"
+  , "signed int *hs_bindgen_0446a821eb966f46 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (todo_remark_attention)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_25a9ea376bb793e9 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (html_entities_func)(arg1);"
+  , "}"
+  , "void hs_bindgen_6f311771e5e063e6 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (nested_inline_format)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_34473a588f1157e4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (tagged_code_example)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_471f4a3c2db31252 ("
+  , "  char const *arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (backslash_syntax)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_data@
+foreign import ccall safe "hs_bindgen_7eada9f65d982412" hs_bindgen_7eada9f65d982412_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_data@
+hs_bindgen_7eada9f65d982412 ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+hs_bindgen_7eada9f65d982412 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_7eada9f65d982412_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Function with detailed parameter documentation.
+
+    This function shows different parameter directions and types.
+
+    [__@input_data@ /(input)/__]: Input data buffer
+
+    [__@output_data@ /(output)/__]: Output data buffer
+
+    [__@size@ /(input,output)/__]: Size of data, updated on return
+
+    __Returns:__ Status code (0 = success, -1 = error)
+
+    __C declaration:__ @process_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 111:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_data ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@input_data@ /(input)/__]: Input data buffer
+
+          __C declaration:__ @input_data@
+     -}
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@output_data@ /(output)/__]: Output data buffer
+
+          __C declaration:__ @output_data@
+     -}
+  -> BG.Ptr HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@size@ /(input,output)/__]: Size of data, updated on return
+
+          __C declaration:__ @size@
+     -}
+  -> IO BG.CInt
+process_data = hs_bindgen_7eada9f65d982412
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_file@
+foreign import ccall safe "hs_bindgen_fb85499c501da1a7" hs_bindgen_fb85499c501da1a7_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_file@
+hs_bindgen_fb85499c501da1a7 ::
+     PtrConst.PtrConst BG.CChar
+  -> IO BG.CBool
+hs_bindgen_fb85499c501da1a7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fb85499c501da1a7_base (BG.toFFIType x0))
+
+{-| Function with inline commands and formatting.
+
+    This function uses @inline@ @code@ formatting and __bold__ text. It also demonstrates /emphasized/ text.
+
+    [__@filename@__]: The @char*@ filename to process
+
+    __Returns:__ @true@ if successful, @false@ otherwise
+
+    __C declaration:__ @process_file@
+
+    __defined at:__ @documentation\/doxygen_docs.h 122:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_file ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@filename@__]: The @char*@ filename to process
+
+          __C declaration:__ @filename@
+     -}
+  -> IO BG.CBool
+process_file = hs_bindgen_fb85499c501da1a7
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_calculate_value@
+foreign import ccall safe "hs_bindgen_a73fc7b108035c5c" hs_bindgen_a73fc7b108035c5c_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_calculate_value@
+hs_bindgen_a73fc7b108035c5c ::
+     BG.CInt
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_a73fc7b108035c5c =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a73fc7b108035c5c_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Function with verbatim code blocks.
+
+    Example usage:
+
+    @
+    int result = calculate_value(10, 20);
+    printf("Result: %d\n", result);
+    @
+
+    [__@base@__]: Base value
+
+    [__@multiplier@__]: Multiplier value
+
+    __Returns:__ Calculated result
+
+    __C declaration:__ @calculate_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 137:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+calculate_value ::
+     BG.CInt
+     {- ^
+
+          [__@base@__]: Base value
+
+          __C declaration:__ @base@
+     -}
+  -> BG.CInt
+     {- ^
+
+          [__@multiplier@__]: Multiplier value
+
+          __C declaration:__ @multiplier@
+     -}
+  -> IO BG.CInt
+calculate_value = hs_bindgen_a73fc7b108035c5c
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_example@
+foreign import ccall safe "hs_bindgen_9b7f6745401b4652" hs_bindgen_9b7f6745401b4652_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_example@
+hs_bindgen_9b7f6745401b4652 ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_9b7f6745401b4652 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9b7f6745401b4652_base (BG.toFFIType x0))
+
+{-| Function with HTML formatting.
+
+    This function demonstrates __HTML bold__ and /italic/ text. It also shows @HTML code@ formatting.
+
+    Input
+
+    Output
+
+    0
+
+    false
+
+    1
+
+    true
+
+    [__@value@__]: Input value
+
+    __Returns:__ Boolean result
+
+    __C declaration:__ @html_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 154:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_example ::
+     BG.CInt
+     {- ^
+
+          [__@value@__]: Input value
+
+          __C declaration:__ @value@
+     -}
+  -> IO BG.CBool
+html_example = hs_bindgen_9b7f6745401b4652
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_list_example@
+foreign import ccall safe "hs_bindgen_825411dc114e599b" hs_bindgen_825411dc114e599b_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CBool
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_list_example@
+hs_bindgen_825411dc114e599b ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CBool
+hs_bindgen_825411dc114e599b =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_825411dc114e599b_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Function with lists and special formatting.
+
+    This function demonstrates:
+
+    * Bullet point lists
+      * Nested list item 1
+      * Nested list item 2
+
+    * Multiple items
+
+    * Nested formatting
+
+    Numbered list:
+
+    1. First @item@ 1. item
+
+    2. Second __item__
+
+    3. Third item
+
+    Other numbered list:
+
+    1. A
+
+    2. B
+
+    3. C
+
+    [__@items@__]: Array of items
+
+    [__@count@__]: Number of items
+
+    __Returns:__ Success status
+
+    __C declaration:__ @list_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 180:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+list_example ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+     {- ^
+
+          [__@items@__]: Array of items
+
+          __C declaration:__ @items@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@count@__]: Number of items
+
+          __C declaration:__ @count@
+     -}
+  -> IO BG.CBool
+list_example = hs_bindgen_825411dc114e599b
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_dangerous_function@
+foreign import ccall safe "hs_bindgen_17264dcff7e9b698" hs_bindgen_17264dcff7e9b698_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_dangerous_function@
+hs_bindgen_17264dcff7e9b698 ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_17264dcff7e9b698 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_17264dcff7e9b698_base (BG.toFFIType x0))
+
+{-| Function with warnings and notes.
+
+    __WARNING:__ This function may cause side effects
+
+    __Note:__ Use with caution in multithreaded environments
+
+    __See:__ related_function() for similar functionality
+
+    [__@ptr@__]: Pointer to data
+
+    __Returns:__ Modified pointer
+
+    __C declaration:__ @dangerous_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 192:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+dangerous_function ::
+     BG.Ptr BG.Void
+     {- ^
+
+          [__@ptr@__]: Pointer to data
+
+          __C declaration:__ @ptr@
+     -}
+  -> IO (BG.Ptr BG.Void)
+dangerous_function = hs_bindgen_17264dcff7e9b698
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_detailed_return_codes@
+foreign import ccall safe "hs_bindgen_c8ca619ec2e70d8d" hs_bindgen_c8ca619ec2e70d8d_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_detailed_return_codes@
+hs_bindgen_c8ca619ec2e70d8d ::
+     PtrConst.PtrConst BG.CChar
+  -> IO BG.CInt
+hs_bindgen_c8ca619ec2e70d8d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c8ca619ec2e70d8d_base (BG.toFFIType x0))
+
+{-| Function with return value details.
+
+    [__@input@__]: Input string
+
+    [__@0@__]: Success
+
+    [__@-1@__]: Invalid input
+
+    [__@-2@__]: Memory allocation failed
+
+    [__@-3@__]: Processing error
+
+    __C declaration:__ @detailed_return_codes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 203:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+detailed_return_codes ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@input@__]: Input string
+
+          __C declaration:__ @input@
+     -}
+  -> IO BG.CInt
+detailed_return_codes = hs_bindgen_c8ca619ec2e70d8d
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_old_function@
+foreign import ccall safe "hs_bindgen_25e1070e2ce10048" hs_bindgen_25e1070e2ce10048_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_old_function@
+hs_bindgen_25e1070e2ce10048 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_25e1070e2ce10048 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_25e1070e2ce10048_base (BG.toFFIType x0))
+
+{-| Function with deprecated annotation.
+
+    __Deprecated:__ Use new_function() instead
+
+    [__@old_param@__]: Legacy parameter
+
+    __Returns:__ Legacy result
+
+    __C declaration:__ @old_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 212:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+old_function ::
+     BG.CInt
+     {- ^
+
+          [__@old_param@__]: Legacy parameter
+
+          __C declaration:__ @old_param@
+     -}
+  -> IO BG.CInt
+old_function = hs_bindgen_25e1070e2ce10048
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_versioned_function@
+foreign import ccall safe "hs_bindgen_a9eeeb09808e71cc" hs_bindgen_a9eeeb09808e71cc_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_versioned_function@
+hs_bindgen_a9eeeb09808e71cc ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_a9eeeb09808e71cc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a9eeeb09808e71cc_base (BG.toFFIType x0))
+
+{-| Function with version information.
+
+    @since 1.0
+
+    __Version:__ 1.2
+
+    [__@data@__]: Input data
+
+    __Returns:__ Processed data
+
+    __C declaration:__ @versioned_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 222:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+versioned_function ::
+     BG.CInt
+     {- ^
+
+          [__@data@__]: Input data
+
+          __C declaration:__ @data@
+     -}
+  -> IO BG.CInt
+versioned_function = hs_bindgen_a9eeeb09808e71cc
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_buffer@
+foreign import ccall safe "hs_bindgen_0c0057f1700372a7" hs_bindgen_0c0057f1700372a7_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_buffer@
+hs_bindgen_0c0057f1700372a7 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 64 BG.CChar))
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+hs_bindgen_0c0057f1700372a7 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0c0057f1700372a7_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Static array parameter.
+
+    [__@buffer@__]: Buffer with minimum size
+
+    [__@size@__]: Actual buffer size
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @process_buffer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 338:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_buffer ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 64 BG.CChar))
+     {- ^
+
+          [__@buffer@__]: Buffer with minimum size
+
+          __C declaration:__ @buffer@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@size@__]: Actual buffer size
+
+          __C declaration:__ @size@
+     -}
+  -> IO BG.CInt
+process_buffer = hs_bindgen_0c0057f1700372a7
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_my_memcpy@
+foreign import ccall safe "hs_bindgen_294db77671f95524" hs_bindgen_294db77671f95524_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_my_memcpy@
+hs_bindgen_294db77671f95524 ::
+     BG.Ptr BG.Void
+  -> PtrConst.PtrConst BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_294db77671f95524 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_294db77671f95524_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Function with restrict pointers.
+
+    [__@dest@__]: Destination buffer (restrict)
+
+    [__@src@__]: Source buffer (restrict)
+
+    [__@n@__]: Number of bytes
+
+    __Returns:__ Destination pointer
+
+    __C declaration:__ @my_memcpy@
+
+    __defined at:__ @documentation\/doxygen_docs.h 348:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+my_memcpy ::
+     BG.Ptr BG.Void
+     {- ^
+
+          [__@dest@__]: Destination buffer (restrict)
+
+          __C declaration:__ @dest@
+     -}
+  -> PtrConst.PtrConst BG.Void
+     {- ^
+
+          [__@src@__]: Source buffer (restrict)
+
+          __C declaration:__ @src@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@n@__]: Number of bytes
+
+          __C declaration:__ @n@
+     -}
+  -> IO (BG.Ptr BG.Void)
+my_memcpy = hs_bindgen_294db77671f95524
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_double_value@
+foreign import ccall safe "hs_bindgen_f5bc63a9952c2618" hs_bindgen_f5bc63a9952c2618_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_double_value@
+hs_bindgen_f5bc63a9952c2618 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_f5bc63a9952c2618 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f5bc63a9952c2618_base (BG.toFFIType x0))
+
+{-| Inline function.
+
+    [__@x@__]: Input value
+
+    __Returns:__ Doubled value
+
+    __C declaration:__ @double_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 356:19@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+double_value ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: Input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+double_value = hs_bindgen_f5bc63a9952c2618
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_read_chunk@
+foreign import ccall safe "hs_bindgen_3545f99d29c4fc53" hs_bindgen_3545f99d29c4fc53_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_read_chunk@
+hs_bindgen_3545f99d29c4fc53 ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+hs_bindgen_3545f99d29c4fc53 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3545f99d29c4fc53_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Read a chunk of bytes into the provided buffer.
+
+    Demonstrates a section nested inside @functions@ .
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Output buffer
+
+    [__@count@__]: Number of bytes to read
+
+    __Returns:__ Number of bytes read
+
+    __C declaration:__ @read_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 387:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+read_chunk ::
+     BG.CInt
+     {- ^
+
+          [__@fd@__]: File descriptor
+
+          __C declaration:__ @fd@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@buf@__]: Output buffer
+
+          __C declaration:__ @buf@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@count@__]: Number of bytes to read
+
+          __C declaration:__ @count@
+     -}
+  -> IO BG.CInt
+read_chunk = hs_bindgen_3545f99d29c4fc53
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_write_chunk@
+foreign import ccall safe "hs_bindgen_839c1d19dfe95042" hs_bindgen_839c1d19dfe95042_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_write_chunk@
+hs_bindgen_839c1d19dfe95042 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+hs_bindgen_839c1d19dfe95042 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_839c1d19dfe95042_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Write a chunk of bytes from the provided buffer.
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Input buffer
+
+    [__@count@__]: Number of bytes to write
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @write_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 397:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+write_chunk ::
+     BG.CInt
+     {- ^
+
+          [__@fd@__]: File descriptor
+
+          __C declaration:__ @fd@
+     -}
+  -> PtrConst.PtrConst BG.Void
+     {- ^
+
+          [__@buf@__]: Input buffer
+
+          __C declaration:__ @buf@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@count@__]: Number of bytes to write
+
+          __C declaration:__ @count@
+     -}
+  -> IO BG.CInt
+write_chunk = hs_bindgen_839c1d19dfe95042
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_complex_function@
+foreign import ccall safe "hs_bindgen_c4e7e99dba20204d" hs_bindgen_c4e7e99dba20204d_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_complex_function@
+hs_bindgen_c4e7e99dba20204d ::
+     BG.Ptr Config_t
+  -> PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO Status_code_t
+hs_bindgen_c4e7e99dba20204d =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_c4e7e99dba20204d_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Function with complex documentation.
+
+    This function demonstrates multiple documentation features:
+
+    __Description:__
+
+    Performs complex data processing with multiple steps.
+
+    __Algorithm:__
+
+    1. Validate input parameters
+
+    2. Allocate temporary buffers
+
+    3. Process data in chunks
+
+    4. Clean up resources
+
+    __Algorithm2:__
+
+    * Validate input parameters
+
+    * Allocate temporary buffers
+
+    * Process data in chunks
+
+    * Clean up resources
+
+    __Example:__
+
+    @
+    config_t cfg = {
+        .id = 1,
+        .name = "test",
+        .flags = 0,
+        .callback = my_callback,
+        .user_data = NULL
+    };
+
+    status_code_t result = complex_function(&cfg, data, size);
+    if (result != STATUS_OK) {
+        handle_error(result);
+    }
+    @
+
+    [__@config@__]: Configuration structure (see 'Config_t' )
+
+    [__@data@__]: Input data buffer
+
+    [__@size@__]: Size of input data
+
+    __Returns:__ Status code indicating success or failure
+
+    __Precondition:__ config must not be NULL
+
+    __Precondition:__ data must not be NULL if size > 0
+
+    __Postcondition:__ Output data is written to config->user_data
+
+    __WARNING:__ May return NULL if memory allocation fails
+
+    __WARNING:__ Sets errno to EINVAL if parameters are invalid
+
+    __C declaration:__ @complex_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 459:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+complex_function ::
+     BG.Ptr Config_t
+     {- ^
+
+          [__@config@__]: Configuration structure (see 'Config_t' )
+
+          __C declaration:__ @config@
+     -}
+  -> PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@data@__]: Input data buffer
+
+          __C declaration:__ @data@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@size@__]: Size of input data
+
+          __C declaration:__ @size@
+     -}
+  -> IO Status_code_t
+complex_function = hs_bindgen_c4e7e99dba20204d
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_hash@
+foreign import ccall safe "hs_bindgen_935f2aead358d9ef" hs_bindgen_935f2aead358d9ef_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_hash@
+hs_bindgen_935f2aead358d9ef ::
+     BG.Ptr BG.CChar
+  -> IO BG.CInt
+hs_bindgen_935f2aead358d9ef =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_935f2aead358d9ef_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @documentation\/doxygen_docs.h 463:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+hash ::
+     BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @s@
+  -> IO BG.CInt
+hash = hs_bindgen_935f2aead358d9ef
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_square@
+foreign import ccall safe "hs_bindgen_39fef54c23d4e1ee" hs_bindgen_39fef54c23d4e1ee_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_square@
+hs_bindgen_39fef54c23d4e1ee ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_39fef54c23d4e1ee =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_39fef54c23d4e1ee_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @documentation\/doxygen_docs.h 465:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+square ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+square = hs_bindgen_39fef54c23d4e1ee
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_auto_brief_func@
+foreign import ccall safe "hs_bindgen_29749932a4449f10" hs_bindgen_29749932a4449f10_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_auto_brief_func@
+hs_bindgen_29749932a4449f10 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_29749932a4449f10 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_29749932a4449f10_base (BG.toFFIType x0))
+
+{-| Auto-brief function without explicit @brief tag.
+
+    This tests that the first sentence is used as the brief description when no explicit @brief is present.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The negated value
+
+    __C declaration:__ @auto_brief_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 486:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+auto_brief_func ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: The input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+auto_brief_func = hs_bindgen_29749932a4449f10
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_multi_paragraph_details@
+foreign import ccall safe "hs_bindgen_03f0269c9296b8c0" hs_bindgen_03f0269c9296b8c0_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_multi_paragraph_details@
+hs_bindgen_03f0269c9296b8c0 ::
+     BG.Ptr BG.CChar
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_03f0269c9296b8c0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_03f0269c9296b8c0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Multi-paragraph details.
+
+    First paragraph of the detailed description. This explains the basic purpose of the function.
+
+    Second paragraph with more context. This includes information about the algorithm and its complexity, which is O(n) in the input size.
+
+    Third paragraph with usage notes. Callers should ensure that the buffer is large enough before calling this function.
+
+    [__@buf@__]: Output buffer
+
+    [__@len@__]: Buffer length
+
+    __C declaration:__ @multi_paragraph_details@
+
+    __defined at:__ @documentation\/doxygen_docs.h 503:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+multi_paragraph_details ::
+     BG.Ptr BG.CChar
+     {- ^
+
+          [__@buf@__]: Output buffer
+
+          __C declaration:__ @buf@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@len@__]: Buffer length
+
+          __C declaration:__ @len@
+     -}
+  -> IO ()
+multi_paragraph_details = hs_bindgen_03f0269c9296b8c0
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_todo_remark_attention@
+foreign import ccall safe "hs_bindgen_0446a821eb966f46" hs_bindgen_0446a821eb966f46_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_todo_remark_attention@
+hs_bindgen_0446a821eb966f46 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_0446a821eb966f46 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0446a821eb966f46_base (BG.toFFIType x0))
+
+{-| Function with @todo and @remark.
+
+    __Todo:__ Optimize this function for large inputs
+
+    Add support for negative values
+
+    __Remark:__ This function is thread-safe
+
+    __ATTENTION:__ The caller must free the returned pointer
+
+    [__@n@__]: Input count
+
+    __Returns:__ Allocated array
+
+    __C declaration:__ @todo_remark_attention@
+
+    __defined at:__ @documentation\/doxygen_docs.h 516:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+todo_remark_attention ::
+     BG.CInt
+     {- ^
+
+          [__@n@__]: Input count
+
+          __C declaration:__ @n@
+     -}
+  -> IO (BG.Ptr BG.CInt)
+todo_remark_attention = hs_bindgen_0446a821eb966f46
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_entities_func@
+foreign import ccall safe "hs_bindgen_25a9ea376bb793e9" hs_bindgen_25a9ea376bb793e9_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_entities_func@
+hs_bindgen_25a9ea376bb793e9 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_25a9ea376bb793e9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_25a9ea376bb793e9_base (BG.toFFIType x0))
+
+{-| HTML entities: & means AND, <tag> is a tag.
+
+    Handles values < 0 and values > 100 differently. Copyright 2025.
+
+    [__@x@__]: Input (> 0 required)
+
+    __Returns:__ Result code
+
+    __C declaration:__ @html_entities_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 538:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_entities_func ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: Input (> 0 required)
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+html_entities_func = hs_bindgen_25a9ea376bb793e9
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_nested_inline_format@
+foreign import ccall safe "hs_bindgen_6f311771e5e063e6" hs_bindgen_6f311771e5e063e6_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_nested_inline_format@
+hs_bindgen_6f311771e5e063e6 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_6f311771e5e063e6 =
+  \x0 ->
+    hs_bindgen_6f311771e5e063e6_base (BG.toFFIType x0)
+
+{-| Nested inline: __bold__ , @code@ , __@bold_code@ ,__ /__emph_bold__ ./
+
+    [__@x@__]: Input value
+
+    __C declaration:__ @nested_inline_format@
+
+    __defined at:__ @documentation\/doxygen_docs.h 545:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+nested_inline_format ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: Input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO ()
+nested_inline_format = hs_bindgen_6f311771e5e063e6
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_tagged_code_example@
+foreign import ccall safe "hs_bindgen_34473a588f1157e4" hs_bindgen_34473a588f1157e4_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_tagged_code_example@
+hs_bindgen_34473a588f1157e4 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_34473a588f1157e4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_34473a588f1157e4_base (BG.toFFIType x0))
+
+{-| Language-tagged code block.
+
+    Example usage:
+
+    @
+    int result = tagged_code_example(42);
+    printf("Result: %d\n", result);
+    @
+
+    [__@x@__]: Input value
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @tagged_code_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 559:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+tagged_code_example ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: Input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+tagged_code_example = hs_bindgen_34473a588f1157e4
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_backslash_syntax@
+foreign import ccall safe "hs_bindgen_471f4a3c2db31252" hs_bindgen_471f4a3c2db31252_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_backslash_syntax@
+hs_bindgen_471f4a3c2db31252 ::
+     PtrConst.PtrConst BG.CChar
+  -> BG.Ptr BG.CChar
+  -> IO BG.CInt
+hs_bindgen_471f4a3c2db31252 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_471f4a3c2db31252_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Function documented with backslash syntax.
+
+    This function uses backslash commands instead of @ commands to verify both syntaxes are handled equivalently.
+
+    [__@input@__]: The input string
+
+    [__@output@__]: The output buffer
+
+    __Returns:__ Number of bytes written
+
+    __See:__ 'auto_brief_func'
+
+    @since 2.0
+
+    __C declaration:__ @backslash_syntax@
+
+    __defined at:__ @documentation\/doxygen_docs.h 574:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+backslash_syntax ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@input@__]: The input string
+
+          __C declaration:__ @input@
+     -}
+  -> BG.Ptr BG.CChar
+     {- ^
+
+          [__@output@__]: The output buffer
+
+          __C declaration:__ @output@
+     -}
+  -> IO BG.CInt
+backslash_syntax = hs_bindgen_471f4a3c2db31252
diff --git a/test-artefacts/fixtures/documentation/doxygen_docs/Example/Unsafe.hs b/test-artefacts/fixtures/documentation/doxygen_docs/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/doxygen_docs/Example/Unsafe.hs
@@ -0,0 +1,1390 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( -- * Function Definitions
+      Example.Unsafe.process_data
+    , Example.Unsafe.process_file
+    , Example.Unsafe.calculate_value
+    , Example.Unsafe.html_example
+    , Example.Unsafe.list_example
+    , Example.Unsafe.dangerous_function
+    , Example.Unsafe.detailed_return_codes
+    , Example.Unsafe.old_function
+    , Example.Unsafe.versioned_function
+    , Example.Unsafe.process_buffer
+    , Example.Unsafe.my_memcpy
+    , Example.Unsafe.double_value
+      -- ** I/O Helpers
+    , Example.Unsafe.read_chunk
+    , Example.Unsafe.write_chunk
+      -- * Advanced Features
+    , Example.Unsafe.complex_function
+    , Example.Unsafe.hash
+    , Example.Unsafe.square
+      -- * Extra Doxygen Coverage
+    , Example.Unsafe.auto_brief_func
+    , Example.Unsafe.multi_paragraph_details
+    , Example.Unsafe.todo_remark_attention
+    , Example.Unsafe.html_entities_func
+    , Example.Unsafe.nested_inline_format
+    , Example.Unsafe.tagged_code_example
+    , Example.Unsafe.backslash_syntax
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <documentation/doxygen_docs.h>"
+  , "signed int hs_bindgen_e6085a910ba41ecb ("
+  , "  uint8_t const *arg1,"
+  , "  uint8_t *arg2,"
+  , "  size_t *arg3"
+  , ")"
+  , "{"
+  , "  return (process_data)(arg1, arg2, arg3);"
+  , "}"
+  , "_Bool hs_bindgen_c27e893aea0b0a77 ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (process_file)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_bc1b0e25a72f4ec0 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (calculate_value)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_09abc3cb74562964 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (html_example)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_47cba1a95d265f84 ("
+  , "  char const **arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (list_example)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_e065fc013e4eccd6 ("
+  , "  void *arg1"
+  , ")"
+  , "{"
+  , "  return (dangerous_function)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_bc4f7e24b2ad4ace ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (detailed_return_codes)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_8deec146389ae8b3 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (old_function)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_da2dcc1473935665 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (versioned_function)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_97c1191917e6eece ("
+  , "  char *arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (process_buffer)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_58253bb560dc3eb3 ("
+  , "  void *arg1,"
+  , "  void const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (my_memcpy)(arg1, arg2, arg3);"
+  , "}"
+  , "signed int hs_bindgen_44dd19b16ee38e5b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (double_value)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_a7d2e6fe1e9b3164 ("
+  , "  signed int arg1,"
+  , "  void *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (read_chunk)(arg1, arg2, arg3);"
+  , "}"
+  , "signed int hs_bindgen_59f0c5ef262c5f3b ("
+  , "  signed int arg1,"
+  , "  void const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (write_chunk)(arg1, arg2, arg3);"
+  , "}"
+  , "status_code_t hs_bindgen_fd6fce7c8d8b2f79 ("
+  , "  config_t *arg1,"
+  , "  uint8_t const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (complex_function)(arg1, arg2, arg3);"
+  , "}"
+  , "signed int hs_bindgen_dd36c8b317ccfcc4 ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (hash)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_6875e30a7fe8d30a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_3094fd32a3eedd49 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (auto_brief_func)(arg1);"
+  , "}"
+  , "void hs_bindgen_73270d34a2bf31b5 ("
+  , "  char *arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  (multi_paragraph_details)(arg1, arg2);"
+  , "}"
+  , "signed int *hs_bindgen_836de64a94d7bf03 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (todo_remark_attention)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_aa0467b9d3b1a48d ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (html_entities_func)(arg1);"
+  , "}"
+  , "void hs_bindgen_b654d8047edfed77 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (nested_inline_format)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_aeb274aded3470e5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (tagged_code_example)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_907720dffab9442a ("
+  , "  char const *arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (backslash_syntax)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_data@
+foreign import ccall unsafe "hs_bindgen_e6085a910ba41ecb" hs_bindgen_e6085a910ba41ecb_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_data@
+hs_bindgen_e6085a910ba41ecb ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+  -> BG.Ptr HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+hs_bindgen_e6085a910ba41ecb =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_e6085a910ba41ecb_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Function with detailed parameter documentation.
+
+    This function shows different parameter directions and types.
+
+    [__@input_data@ /(input)/__]: Input data buffer
+
+    [__@output_data@ /(output)/__]: Output data buffer
+
+    [__@size@ /(input,output)/__]: Size of data, updated on return
+
+    __Returns:__ Status code (0 = success, -1 = error)
+
+    __C declaration:__ @process_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 111:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_data ::
+     PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@input_data@ /(input)/__]: Input data buffer
+
+          __C declaration:__ @input_data@
+     -}
+  -> BG.Ptr HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@output_data@ /(output)/__]: Output data buffer
+
+          __C declaration:__ @output_data@
+     -}
+  -> BG.Ptr HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@size@ /(input,output)/__]: Size of data, updated on return
+
+          __C declaration:__ @size@
+     -}
+  -> IO BG.CInt
+process_data = hs_bindgen_e6085a910ba41ecb
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_file@
+foreign import ccall unsafe "hs_bindgen_c27e893aea0b0a77" hs_bindgen_c27e893aea0b0a77_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_file@
+hs_bindgen_c27e893aea0b0a77 ::
+     PtrConst.PtrConst BG.CChar
+  -> IO BG.CBool
+hs_bindgen_c27e893aea0b0a77 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c27e893aea0b0a77_base (BG.toFFIType x0))
+
+{-| Function with inline commands and formatting.
+
+    This function uses @inline@ @code@ formatting and __bold__ text. It also demonstrates /emphasized/ text.
+
+    [__@filename@__]: The @char*@ filename to process
+
+    __Returns:__ @true@ if successful, @false@ otherwise
+
+    __C declaration:__ @process_file@
+
+    __defined at:__ @documentation\/doxygen_docs.h 122:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_file ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@filename@__]: The @char*@ filename to process
+
+          __C declaration:__ @filename@
+     -}
+  -> IO BG.CBool
+process_file = hs_bindgen_c27e893aea0b0a77
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_calculate_value@
+foreign import ccall unsafe "hs_bindgen_bc1b0e25a72f4ec0" hs_bindgen_bc1b0e25a72f4ec0_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_calculate_value@
+hs_bindgen_bc1b0e25a72f4ec0 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_bc1b0e25a72f4ec0 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_bc1b0e25a72f4ec0_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Function with verbatim code blocks.
+
+    Example usage:
+
+    @
+    int result = calculate_value(10, 20);
+    printf("Result: %d\n", result);
+    @
+
+    [__@base@__]: Base value
+
+    [__@multiplier@__]: Multiplier value
+
+    __Returns:__ Calculated result
+
+    __C declaration:__ @calculate_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 137:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+calculate_value ::
+     BG.CInt
+     {- ^
+
+          [__@base@__]: Base value
+
+          __C declaration:__ @base@
+     -}
+  -> BG.CInt
+     {- ^
+
+          [__@multiplier@__]: Multiplier value
+
+          __C declaration:__ @multiplier@
+     -}
+  -> IO BG.CInt
+calculate_value = hs_bindgen_bc1b0e25a72f4ec0
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_example@
+foreign import ccall unsafe "hs_bindgen_09abc3cb74562964" hs_bindgen_09abc3cb74562964_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_example@
+hs_bindgen_09abc3cb74562964 ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_09abc3cb74562964 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_09abc3cb74562964_base (BG.toFFIType x0))
+
+{-| Function with HTML formatting.
+
+    This function demonstrates __HTML bold__ and /italic/ text. It also shows @HTML code@ formatting.
+
+    Input
+
+    Output
+
+    0
+
+    false
+
+    1
+
+    true
+
+    [__@value@__]: Input value
+
+    __Returns:__ Boolean result
+
+    __C declaration:__ @html_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 154:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_example ::
+     BG.CInt
+     {- ^
+
+          [__@value@__]: Input value
+
+          __C declaration:__ @value@
+     -}
+  -> IO BG.CBool
+html_example = hs_bindgen_09abc3cb74562964
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_list_example@
+foreign import ccall unsafe "hs_bindgen_47cba1a95d265f84" hs_bindgen_47cba1a95d265f84_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CBool
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_list_example@
+hs_bindgen_47cba1a95d265f84 ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CBool
+hs_bindgen_47cba1a95d265f84 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_47cba1a95d265f84_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Function with lists and special formatting.
+
+    This function demonstrates:
+
+    * Bullet point lists
+      * Nested list item 1
+      * Nested list item 2
+
+    * Multiple items
+
+    * Nested formatting
+
+    Numbered list:
+
+    1. First @item@ 1. item
+
+    2. Second __item__
+
+    3. Third item
+
+    Other numbered list:
+
+    1. A
+
+    2. B
+
+    3. C
+
+    [__@items@__]: Array of items
+
+    [__@count@__]: Number of items
+
+    __Returns:__ Success status
+
+    __C declaration:__ @list_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 180:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+list_example ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+     {- ^
+
+          [__@items@__]: Array of items
+
+          __C declaration:__ @items@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@count@__]: Number of items
+
+          __C declaration:__ @count@
+     -}
+  -> IO BG.CBool
+list_example = hs_bindgen_47cba1a95d265f84
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_dangerous_function@
+foreign import ccall unsafe "hs_bindgen_e065fc013e4eccd6" hs_bindgen_e065fc013e4eccd6_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_dangerous_function@
+hs_bindgen_e065fc013e4eccd6 ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_e065fc013e4eccd6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e065fc013e4eccd6_base (BG.toFFIType x0))
+
+{-| Function with warnings and notes.
+
+    __WARNING:__ This function may cause side effects
+
+    __Note:__ Use with caution in multithreaded environments
+
+    __See:__ related_function() for similar functionality
+
+    [__@ptr@__]: Pointer to data
+
+    __Returns:__ Modified pointer
+
+    __C declaration:__ @dangerous_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 192:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+dangerous_function ::
+     BG.Ptr BG.Void
+     {- ^
+
+          [__@ptr@__]: Pointer to data
+
+          __C declaration:__ @ptr@
+     -}
+  -> IO (BG.Ptr BG.Void)
+dangerous_function = hs_bindgen_e065fc013e4eccd6
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_detailed_return_codes@
+foreign import ccall unsafe "hs_bindgen_bc4f7e24b2ad4ace" hs_bindgen_bc4f7e24b2ad4ace_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_detailed_return_codes@
+hs_bindgen_bc4f7e24b2ad4ace ::
+     PtrConst.PtrConst BG.CChar
+  -> IO BG.CInt
+hs_bindgen_bc4f7e24b2ad4ace =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bc4f7e24b2ad4ace_base (BG.toFFIType x0))
+
+{-| Function with return value details.
+
+    [__@input@__]: Input string
+
+    [__@0@__]: Success
+
+    [__@-1@__]: Invalid input
+
+    [__@-2@__]: Memory allocation failed
+
+    [__@-3@__]: Processing error
+
+    __C declaration:__ @detailed_return_codes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 203:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+detailed_return_codes ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@input@__]: Input string
+
+          __C declaration:__ @input@
+     -}
+  -> IO BG.CInt
+detailed_return_codes = hs_bindgen_bc4f7e24b2ad4ace
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_old_function@
+foreign import ccall unsafe "hs_bindgen_8deec146389ae8b3" hs_bindgen_8deec146389ae8b3_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_old_function@
+hs_bindgen_8deec146389ae8b3 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_8deec146389ae8b3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8deec146389ae8b3_base (BG.toFFIType x0))
+
+{-| Function with deprecated annotation.
+
+    __Deprecated:__ Use new_function() instead
+
+    [__@old_param@__]: Legacy parameter
+
+    __Returns:__ Legacy result
+
+    __C declaration:__ @old_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 212:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+old_function ::
+     BG.CInt
+     {- ^
+
+          [__@old_param@__]: Legacy parameter
+
+          __C declaration:__ @old_param@
+     -}
+  -> IO BG.CInt
+old_function = hs_bindgen_8deec146389ae8b3
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_versioned_function@
+foreign import ccall unsafe "hs_bindgen_da2dcc1473935665" hs_bindgen_da2dcc1473935665_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_versioned_function@
+hs_bindgen_da2dcc1473935665 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_da2dcc1473935665 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_da2dcc1473935665_base (BG.toFFIType x0))
+
+{-| Function with version information.
+
+    @since 1.0
+
+    __Version:__ 1.2
+
+    [__@data@__]: Input data
+
+    __Returns:__ Processed data
+
+    __C declaration:__ @versioned_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 222:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+versioned_function ::
+     BG.CInt
+     {- ^
+
+          [__@data@__]: Input data
+
+          __C declaration:__ @data@
+     -}
+  -> IO BG.CInt
+versioned_function = hs_bindgen_da2dcc1473935665
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_buffer@
+foreign import ccall unsafe "hs_bindgen_97c1191917e6eece" hs_bindgen_97c1191917e6eece_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_buffer@
+hs_bindgen_97c1191917e6eece ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 64 BG.CChar))
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+hs_bindgen_97c1191917e6eece =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_97c1191917e6eece_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Static array parameter.
+
+    [__@buffer@__]: Buffer with minimum size
+
+    [__@size@__]: Actual buffer size
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @process_buffer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 338:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_buffer ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 64 BG.CChar))
+     {- ^
+
+          [__@buffer@__]: Buffer with minimum size
+
+          __C declaration:__ @buffer@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@size@__]: Actual buffer size
+
+          __C declaration:__ @size@
+     -}
+  -> IO BG.CInt
+process_buffer = hs_bindgen_97c1191917e6eece
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_my_memcpy@
+foreign import ccall unsafe "hs_bindgen_58253bb560dc3eb3" hs_bindgen_58253bb560dc3eb3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_my_memcpy@
+hs_bindgen_58253bb560dc3eb3 ::
+     BG.Ptr BG.Void
+  -> PtrConst.PtrConst BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_58253bb560dc3eb3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_58253bb560dc3eb3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Function with restrict pointers.
+
+    [__@dest@__]: Destination buffer (restrict)
+
+    [__@src@__]: Source buffer (restrict)
+
+    [__@n@__]: Number of bytes
+
+    __Returns:__ Destination pointer
+
+    __C declaration:__ @my_memcpy@
+
+    __defined at:__ @documentation\/doxygen_docs.h 348:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+my_memcpy ::
+     BG.Ptr BG.Void
+     {- ^
+
+          [__@dest@__]: Destination buffer (restrict)
+
+          __C declaration:__ @dest@
+     -}
+  -> PtrConst.PtrConst BG.Void
+     {- ^
+
+          [__@src@__]: Source buffer (restrict)
+
+          __C declaration:__ @src@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@n@__]: Number of bytes
+
+          __C declaration:__ @n@
+     -}
+  -> IO (BG.Ptr BG.Void)
+my_memcpy = hs_bindgen_58253bb560dc3eb3
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_double_value@
+foreign import ccall unsafe "hs_bindgen_44dd19b16ee38e5b" hs_bindgen_44dd19b16ee38e5b_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_double_value@
+hs_bindgen_44dd19b16ee38e5b ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_44dd19b16ee38e5b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_44dd19b16ee38e5b_base (BG.toFFIType x0))
+
+{-| Inline function.
+
+    [__@x@__]: Input value
+
+    __Returns:__ Doubled value
+
+    __C declaration:__ @double_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 356:19@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+double_value ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: Input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+double_value = hs_bindgen_44dd19b16ee38e5b
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_read_chunk@
+foreign import ccall unsafe "hs_bindgen_a7d2e6fe1e9b3164" hs_bindgen_a7d2e6fe1e9b3164_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_read_chunk@
+hs_bindgen_a7d2e6fe1e9b3164 ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+hs_bindgen_a7d2e6fe1e9b3164 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_a7d2e6fe1e9b3164_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Read a chunk of bytes into the provided buffer.
+
+    Demonstrates a section nested inside @functions@ .
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Output buffer
+
+    [__@count@__]: Number of bytes to read
+
+    __Returns:__ Number of bytes read
+
+    __C declaration:__ @read_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 387:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+read_chunk ::
+     BG.CInt
+     {- ^
+
+          [__@fd@__]: File descriptor
+
+          __C declaration:__ @fd@
+     -}
+  -> BG.Ptr BG.Void
+     {- ^
+
+          [__@buf@__]: Output buffer
+
+          __C declaration:__ @buf@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@count@__]: Number of bytes to read
+
+          __C declaration:__ @count@
+     -}
+  -> IO BG.CInt
+read_chunk = hs_bindgen_a7d2e6fe1e9b3164
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_write_chunk@
+foreign import ccall unsafe "hs_bindgen_59f0c5ef262c5f3b" hs_bindgen_59f0c5ef262c5f3b_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_write_chunk@
+hs_bindgen_59f0c5ef262c5f3b ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+hs_bindgen_59f0c5ef262c5f3b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_59f0c5ef262c5f3b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Write a chunk of bytes from the provided buffer.
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Input buffer
+
+    [__@count@__]: Number of bytes to write
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @write_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 397:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+write_chunk ::
+     BG.CInt
+     {- ^
+
+          [__@fd@__]: File descriptor
+
+          __C declaration:__ @fd@
+     -}
+  -> PtrConst.PtrConst BG.Void
+     {- ^
+
+          [__@buf@__]: Input buffer
+
+          __C declaration:__ @buf@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@count@__]: Number of bytes to write
+
+          __C declaration:__ @count@
+     -}
+  -> IO BG.CInt
+write_chunk = hs_bindgen_59f0c5ef262c5f3b
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_complex_function@
+foreign import ccall unsafe "hs_bindgen_fd6fce7c8d8b2f79" hs_bindgen_fd6fce7c8d8b2f79_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_complex_function@
+hs_bindgen_fd6fce7c8d8b2f79 ::
+     BG.Ptr Config_t
+  -> PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO Status_code_t
+hs_bindgen_fd6fce7c8d8b2f79 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_fd6fce7c8d8b2f79_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| Function with complex documentation.
+
+    This function demonstrates multiple documentation features:
+
+    __Description:__
+
+    Performs complex data processing with multiple steps.
+
+    __Algorithm:__
+
+    1. Validate input parameters
+
+    2. Allocate temporary buffers
+
+    3. Process data in chunks
+
+    4. Clean up resources
+
+    __Algorithm2:__
+
+    * Validate input parameters
+
+    * Allocate temporary buffers
+
+    * Process data in chunks
+
+    * Clean up resources
+
+    __Example:__
+
+    @
+    config_t cfg = {
+        .id = 1,
+        .name = "test",
+        .flags = 0,
+        .callback = my_callback,
+        .user_data = NULL
+    };
+
+    status_code_t result = complex_function(&cfg, data, size);
+    if (result != STATUS_OK) {
+        handle_error(result);
+    }
+    @
+
+    [__@config@__]: Configuration structure (see 'Config_t' )
+
+    [__@data@__]: Input data buffer
+
+    [__@size@__]: Size of input data
+
+    __Returns:__ Status code indicating success or failure
+
+    __Precondition:__ config must not be NULL
+
+    __Precondition:__ data must not be NULL if size > 0
+
+    __Postcondition:__ Output data is written to config->user_data
+
+    __WARNING:__ May return NULL if memory allocation fails
+
+    __WARNING:__ Sets errno to EINVAL if parameters are invalid
+
+    __C declaration:__ @complex_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 459:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+complex_function ::
+     BG.Ptr Config_t
+     {- ^
+
+          [__@config@__]: Configuration structure (see 'Config_t' )
+
+          __C declaration:__ @config@
+     -}
+  -> PtrConst.PtrConst HsBindgen.Runtime.LibC.Word8
+     {- ^
+
+          [__@data@__]: Input data buffer
+
+          __C declaration:__ @data@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@size@__]: Size of input data
+
+          __C declaration:__ @size@
+     -}
+  -> IO Status_code_t
+complex_function = hs_bindgen_fd6fce7c8d8b2f79
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_hash@
+foreign import ccall unsafe "hs_bindgen_dd36c8b317ccfcc4" hs_bindgen_dd36c8b317ccfcc4_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_hash@
+hs_bindgen_dd36c8b317ccfcc4 ::
+     BG.Ptr BG.CChar
+  -> IO BG.CInt
+hs_bindgen_dd36c8b317ccfcc4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_dd36c8b317ccfcc4_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @documentation\/doxygen_docs.h 463:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+hash ::
+     BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @s@
+  -> IO BG.CInt
+hash = hs_bindgen_dd36c8b317ccfcc4
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_square@
+foreign import ccall unsafe "hs_bindgen_6875e30a7fe8d30a" hs_bindgen_6875e30a7fe8d30a_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_square@
+hs_bindgen_6875e30a7fe8d30a ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_6875e30a7fe8d30a =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_6875e30a7fe8d30a_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @documentation\/doxygen_docs.h 465:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+square ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+square = hs_bindgen_6875e30a7fe8d30a
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_auto_brief_func@
+foreign import ccall unsafe "hs_bindgen_3094fd32a3eedd49" hs_bindgen_3094fd32a3eedd49_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_auto_brief_func@
+hs_bindgen_3094fd32a3eedd49 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_3094fd32a3eedd49 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3094fd32a3eedd49_base (BG.toFFIType x0))
+
+{-| Auto-brief function without explicit @brief tag.
+
+    This tests that the first sentence is used as the brief description when no explicit @brief is present.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The negated value
+
+    __C declaration:__ @auto_brief_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 486:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+auto_brief_func ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: The input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+auto_brief_func = hs_bindgen_3094fd32a3eedd49
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_multi_paragraph_details@
+foreign import ccall unsafe "hs_bindgen_73270d34a2bf31b5" hs_bindgen_73270d34a2bf31b5_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_multi_paragraph_details@
+hs_bindgen_73270d34a2bf31b5 ::
+     BG.Ptr BG.CChar
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_73270d34a2bf31b5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_73270d34a2bf31b5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Multi-paragraph details.
+
+    First paragraph of the detailed description. This explains the basic purpose of the function.
+
+    Second paragraph with more context. This includes information about the algorithm and its complexity, which is O(n) in the input size.
+
+    Third paragraph with usage notes. Callers should ensure that the buffer is large enough before calling this function.
+
+    [__@buf@__]: Output buffer
+
+    [__@len@__]: Buffer length
+
+    __C declaration:__ @multi_paragraph_details@
+
+    __defined at:__ @documentation\/doxygen_docs.h 503:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+multi_paragraph_details ::
+     BG.Ptr BG.CChar
+     {- ^
+
+          [__@buf@__]: Output buffer
+
+          __C declaration:__ @buf@
+     -}
+  -> HsBindgen.Runtime.LibC.CSize
+     {- ^
+
+          [__@len@__]: Buffer length
+
+          __C declaration:__ @len@
+     -}
+  -> IO ()
+multi_paragraph_details = hs_bindgen_73270d34a2bf31b5
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_todo_remark_attention@
+foreign import ccall unsafe "hs_bindgen_836de64a94d7bf03" hs_bindgen_836de64a94d7bf03_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_todo_remark_attention@
+hs_bindgen_836de64a94d7bf03 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_836de64a94d7bf03 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_836de64a94d7bf03_base (BG.toFFIType x0))
+
+{-| Function with @todo and @remark.
+
+    __Todo:__ Optimize this function for large inputs
+
+    Add support for negative values
+
+    __Remark:__ This function is thread-safe
+
+    __ATTENTION:__ The caller must free the returned pointer
+
+    [__@n@__]: Input count
+
+    __Returns:__ Allocated array
+
+    __C declaration:__ @todo_remark_attention@
+
+    __defined at:__ @documentation\/doxygen_docs.h 516:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+todo_remark_attention ::
+     BG.CInt
+     {- ^
+
+          [__@n@__]: Input count
+
+          __C declaration:__ @n@
+     -}
+  -> IO (BG.Ptr BG.CInt)
+todo_remark_attention = hs_bindgen_836de64a94d7bf03
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_entities_func@
+foreign import ccall unsafe "hs_bindgen_aa0467b9d3b1a48d" hs_bindgen_aa0467b9d3b1a48d_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_entities_func@
+hs_bindgen_aa0467b9d3b1a48d ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_aa0467b9d3b1a48d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_aa0467b9d3b1a48d_base (BG.toFFIType x0))
+
+{-| HTML entities: & means AND, <tag> is a tag.
+
+    Handles values < 0 and values > 100 differently. Copyright 2025.
+
+    [__@x@__]: Input (> 0 required)
+
+    __Returns:__ Result code
+
+    __C declaration:__ @html_entities_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 538:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_entities_func ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: Input (> 0 required)
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+html_entities_func = hs_bindgen_aa0467b9d3b1a48d
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_nested_inline_format@
+foreign import ccall unsafe "hs_bindgen_b654d8047edfed77" hs_bindgen_b654d8047edfed77_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_nested_inline_format@
+hs_bindgen_b654d8047edfed77 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_b654d8047edfed77 =
+  \x0 ->
+    hs_bindgen_b654d8047edfed77_base (BG.toFFIType x0)
+
+{-| Nested inline: __bold__ , @code@ , __@bold_code@ ,__ /__emph_bold__ ./
+
+    [__@x@__]: Input value
+
+    __C declaration:__ @nested_inline_format@
+
+    __defined at:__ @documentation\/doxygen_docs.h 545:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+nested_inline_format ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: Input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO ()
+nested_inline_format = hs_bindgen_b654d8047edfed77
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_tagged_code_example@
+foreign import ccall unsafe "hs_bindgen_aeb274aded3470e5" hs_bindgen_aeb274aded3470e5_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_tagged_code_example@
+hs_bindgen_aeb274aded3470e5 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_aeb274aded3470e5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_aeb274aded3470e5_base (BG.toFFIType x0))
+
+{-| Language-tagged code block.
+
+    Example usage:
+
+    @
+    int result = tagged_code_example(42);
+    printf("Result: %d\n", result);
+    @
+
+    [__@x@__]: Input value
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @tagged_code_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 559:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+tagged_code_example ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: Input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+tagged_code_example = hs_bindgen_aeb274aded3470e5
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_backslash_syntax@
+foreign import ccall unsafe "hs_bindgen_907720dffab9442a" hs_bindgen_907720dffab9442a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_backslash_syntax@
+hs_bindgen_907720dffab9442a ::
+     PtrConst.PtrConst BG.CChar
+  -> BG.Ptr BG.CChar
+  -> IO BG.CInt
+hs_bindgen_907720dffab9442a =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_907720dffab9442a_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| Function documented with backslash syntax.
+
+    This function uses backslash commands instead of @ commands to verify both syntaxes are handled equivalently.
+
+    [__@input@__]: The input string
+
+    [__@output@__]: The output buffer
+
+    __Returns:__ Number of bytes written
+
+    __See:__ 'auto_brief_func'
+
+    @since 2.0
+
+    __C declaration:__ @backslash_syntax@
+
+    __defined at:__ @documentation\/doxygen_docs.h 574:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+backslash_syntax ::
+     PtrConst.PtrConst BG.CChar
+     {- ^
+
+          [__@input@__]: The input string
+
+          __C declaration:__ @input@
+     -}
+  -> BG.Ptr BG.CChar
+     {- ^
+
+          [__@output@__]: The output buffer
+
+          __C declaration:__ @output@
+     -}
+  -> IO BG.CInt
+backslash_syntax = hs_bindgen_907720dffab9442a
diff --git a/test-artefacts/fixtures/documentation/doxygen_docs/bindingspec.yaml b/test-artefacts/fixtures/documentation/doxygen_docs/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/doxygen_docs/bindingspec.yaml
@@ -0,0 +1,622 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: documentation/doxygen_docs.h
+  cname: size_type
+  hsname: Size_type
+- headers: documentation/doxygen_docs.h
+  cname: struct opaque_struct
+  hsname: Opaque_struct
+- headers: documentation/doxygen_docs.h
+  cname: union opaque_union
+  hsname: Opaque_union
+- headers: documentation/doxygen_docs.h
+  cname: enum color_enum
+  hsname: Color_enum
+  enum: open
+- headers: documentation/doxygen_docs.h
+  cname: event_callback_t
+  hsname: Event_callback_t
+- headers: documentation/doxygen_docs.h
+  cname: struct config_t
+  hsname: Config_t
+- headers: documentation/doxygen_docs.h
+  cname: config_t
+  hsname: Config_t
+- headers: documentation/doxygen_docs.h
+  cname: enum status_code_t
+  hsname: Status_code_t
+  enum: open
+- headers: documentation/doxygen_docs.h
+  cname: status_code_t
+  hsname: Status_code_t
+- headers: documentation/doxygen_docs.h
+  cname: union data_union_t
+  hsname: Data_union_t
+- headers: documentation/doxygen_docs.h
+  cname: struct @data_union_t_as_parts
+  hsname: Data_union_t_as_parts
+- headers: documentation/doxygen_docs.h
+  cname: data_union_t
+  hsname: Data_union_t
+- headers: documentation/doxygen_docs.h
+  cname: struct bitfield_t
+  hsname: Bitfield_t
+- headers: documentation/doxygen_docs.h
+  cname: bitfield_t
+  hsname: Bitfield_t
+- headers: documentation/doxygen_docs.h
+  cname: processor_fn_t
+  hsname: Processor_fn_t
+- headers: documentation/doxygen_docs.h
+  cname: filename_t
+  hsname: Filename_t
+- headers: documentation/doxygen_docs.h
+  cname: struct flexible_array
+  hsname: Flexible_array_Aux
+- headers: documentation/doxygen_docs.h
+  cname: struct flexible_array
+  hsname: Flexible_array
+- headers: documentation/doxygen_docs.h
+  cname: struct dyn_array_t
+  hsname: Dyn_array_t
+- headers: documentation/doxygen_docs.h
+  cname: dyn_array_t
+  hsname: Dyn_array_t
+- headers: documentation/doxygen_docs.h
+  cname: struct multi_untagged_t
+  hsname: Multi_untagged_t
+- headers: documentation/doxygen_docs.h
+  cname: struct @multi_untagged_t_pos
+  hsname: Multi_untagged_t_pos
+- headers: documentation/doxygen_docs.h
+  cname: struct @multi_untagged_t_dim
+  hsname: Multi_untagged_t_dim
+- headers: documentation/doxygen_docs.h
+  cname: multi_untagged_t
+  hsname: Multi_untagged_t
+- headers: documentation/doxygen_docs.h
+  cname: struct named_outer
+  hsname: Named_outer
+- headers: documentation/doxygen_docs.h
+  cname: struct named_inner
+  hsname: Named_inner
+- headers: documentation/doxygen_docs.h
+  cname: struct deep_outer
+  hsname: Deep_outer
+- headers: documentation/doxygen_docs.h
+  cname: struct deep_mid
+  hsname: Deep_mid
+- headers: documentation/doxygen_docs.h
+  cname: struct @deep_mid_untagged_field
+  hsname: Deep_mid_untagged_field
+- headers: documentation/doxygen_docs.h
+  cname: struct unnamed_field_t
+  hsname: Unnamed_field_t
+- headers: documentation/doxygen_docs.h
+  cname: struct @unnamed_field_t_anon'ua
+  hsname: Unnamed_field_t_anon'ua
+- headers: documentation/doxygen_docs.h
+  cname: unnamed_field_t
+  hsname: Unnamed_field_t
+- headers: documentation/doxygen_docs.h
+  cname: api_version_t
+  hsname: Api_version_t
+hstypes:
+- hsname: Api_version_t
+  representation:
+    newtype:
+      constructor: Api_version_t
+      fields:
+      - unwrapApi_version_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bitfield_t
+  representation:
+    record:
+      constructor: Bitfield_t
+      fields:
+      - bitfield_t_flag1
+      - bitfield_t_flag2
+      - bitfield_t_counter
+      - bitfield_t_reserved
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Color_enum
+  representation:
+    newtype:
+      constructor: Color_enum
+      fields:
+      - unwrapColor_enum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Config_t
+  representation:
+    record:
+      constructor: Config_t
+      fields:
+      - config_t_id
+      - config_t_name
+      - config_t_flags
+      - config_t_callback
+      - config_t_user_data
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Data_union_t
+  representation:
+    newtype:
+      constructor: Data_union_t
+      fields:
+      - unwrapData_union_t
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Data_union_t_as_parts
+  representation:
+    record:
+      constructor: Data_union_t_as_parts
+      fields:
+      - data_union_t_as_parts_low
+      - data_union_t_as_parts_high
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Deep_mid
+  representation:
+    record:
+      constructor: Deep_mid
+      fields:
+      - deep_mid_m
+      - deep_mid_untagged_field
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Deep_mid_untagged_field
+  representation:
+    record:
+      constructor: Deep_mid_untagged_field
+      fields:
+      - deep_mid_untagged_field_deep_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Deep_outer
+  representation:
+    record:
+      constructor: Deep_outer
+      fields:
+      - deep_outer_mid_field
+      - deep_outer_o
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Dyn_array_t
+  representation:
+    record:
+      constructor: Dyn_array_t
+      fields:
+      - dyn_array_t_data
+      - dyn_array_t_size
+      - dyn_array_t_capacity
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Event_callback_t
+  representation:
+    newtype:
+      constructor: Event_callback_t
+      fields:
+      - unwrapEvent_callback_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Filename_t
+  representation:
+    newtype:
+      constructor: Filename_t
+      fields:
+      - unwrapFilename_t
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Flexible_array
+  representation: typealias
+- hsname: Flexible_array_Aux
+  representation:
+    record:
+      constructor: Flexible_array
+      fields:
+      - flexible_array_count
+  instances:
+  - Eq
+  - Flam_Offset
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Multi_untagged_t
+  representation:
+    record:
+      constructor: Multi_untagged_t
+      fields:
+      - multi_untagged_t_pos
+      - multi_untagged_t_dim
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Multi_untagged_t_dim
+  representation:
+    record:
+      constructor: Multi_untagged_t_dim
+      fields:
+      - multi_untagged_t_dim_w
+      - multi_untagged_t_dim_h
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Multi_untagged_t_pos
+  representation:
+    record:
+      constructor: Multi_untagged_t_pos
+      fields:
+      - multi_untagged_t_pos_x
+      - multi_untagged_t_pos_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Named_inner
+  representation:
+    record:
+      constructor: Named_inner
+      fields:
+      - named_inner_nx
+      - named_inner_ny
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Named_outer
+  representation:
+    record:
+      constructor: Named_outer
+      fields:
+      - named_outer_inner_field
+      - named_outer_nz
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Opaque_struct
+  representation: emptydata
+- hsname: Opaque_union
+  representation: emptydata
+- hsname: Processor_fn_t
+  representation:
+    newtype:
+      constructor: Processor_fn_t
+      fields:
+      - unwrapProcessor_fn_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Size_type
+  representation:
+    newtype:
+      constructor: Size_type
+      fields:
+      - unwrapSize_type
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CSize
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Status_code_t
+  representation:
+    newtype:
+      constructor: Status_code_t
+      fields:
+      - unwrapStatus_code_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unnamed_field_t
+  representation:
+    record:
+      constructor: Unnamed_field_t
+      fields:
+      - unnamed_field_t_before
+      - unnamed_field_t_anon'ua
+      - unnamed_field_t_after
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Unnamed_field_t_anon'ua
+  representation:
+    record:
+      constructor: Unnamed_field_t_anon'ua
+      fields:
+      - unnamed_field_t_anon'ua_ua
+      - unnamed_field_t_anon'ua_ub
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/documentation/doxygen_docs/th.txt b/test-artefacts/fixtures/documentation/doxygen_docs/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/doxygen_docs/th.txt
@@ -0,0 +1,5878 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile musl-include/x86_64/stdbool.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile test-artefacts/headers/golden/documentation/doxygen_docs.h
+-- #include <documentation/doxygen_docs.h>
+-- signed int hs_bindgen_7eada9f65d982412 (
+--   uint8_t const *arg1,
+--   uint8_t *arg2,
+--   size_t *arg3
+-- )
+-- {
+--   return (process_data)(arg1, arg2, arg3);
+-- }
+-- _Bool hs_bindgen_fb85499c501da1a7 (
+--   char const *arg1
+-- )
+-- {
+--   return (process_file)(arg1);
+-- }
+-- signed int hs_bindgen_a73fc7b108035c5c (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (calculate_value)(arg1, arg2);
+-- }
+-- _Bool hs_bindgen_9b7f6745401b4652 (
+--   signed int arg1
+-- )
+-- {
+--   return (html_example)(arg1);
+-- }
+-- _Bool hs_bindgen_825411dc114e599b (
+--   char const **arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (list_example)(arg1, arg2);
+-- }
+-- void *hs_bindgen_17264dcff7e9b698 (
+--   void *arg1
+-- )
+-- {
+--   return (dangerous_function)(arg1);
+-- }
+-- signed int hs_bindgen_c8ca619ec2e70d8d (
+--   char const *arg1
+-- )
+-- {
+--   return (detailed_return_codes)(arg1);
+-- }
+-- signed int hs_bindgen_25e1070e2ce10048 (
+--   signed int arg1
+-- )
+-- {
+--   return (old_function)(arg1);
+-- }
+-- signed int hs_bindgen_a9eeeb09808e71cc (
+--   signed int arg1
+-- )
+-- {
+--   return (versioned_function)(arg1);
+-- }
+-- signed int hs_bindgen_0c0057f1700372a7 (
+--   char *arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (process_buffer)(arg1, arg2);
+-- }
+-- void *hs_bindgen_294db77671f95524 (
+--   void *arg1,
+--   void const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (my_memcpy)(arg1, arg2, arg3);
+-- }
+-- signed int hs_bindgen_f5bc63a9952c2618 (
+--   signed int arg1
+-- )
+-- {
+--   return (double_value)(arg1);
+-- }
+-- signed int hs_bindgen_3545f99d29c4fc53 (
+--   signed int arg1,
+--   void *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (read_chunk)(arg1, arg2, arg3);
+-- }
+-- signed int hs_bindgen_839c1d19dfe95042 (
+--   signed int arg1,
+--   void const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (write_chunk)(arg1, arg2, arg3);
+-- }
+-- status_code_t hs_bindgen_c4e7e99dba20204d (
+--   config_t *arg1,
+--   uint8_t const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (complex_function)(arg1, arg2, arg3);
+-- }
+-- signed int hs_bindgen_935f2aead358d9ef (
+--   char *arg1
+-- )
+-- {
+--   return (hash)(arg1);
+-- }
+-- signed int hs_bindgen_39fef54c23d4e1ee (
+--   signed int arg1
+-- )
+-- {
+--   return (square)(arg1);
+-- }
+-- signed int hs_bindgen_29749932a4449f10 (
+--   signed int arg1
+-- )
+-- {
+--   return (auto_brief_func)(arg1);
+-- }
+-- void hs_bindgen_03f0269c9296b8c0 (
+--   char *arg1,
+--   size_t arg2
+-- )
+-- {
+--   (multi_paragraph_details)(arg1, arg2);
+-- }
+-- signed int *hs_bindgen_0446a821eb966f46 (
+--   signed int arg1
+-- )
+-- {
+--   return (todo_remark_attention)(arg1);
+-- }
+-- signed int hs_bindgen_25a9ea376bb793e9 (
+--   signed int arg1
+-- )
+-- {
+--   return (html_entities_func)(arg1);
+-- }
+-- void hs_bindgen_6f311771e5e063e6 (
+--   signed int arg1
+-- )
+-- {
+--   (nested_inline_format)(arg1);
+-- }
+-- signed int hs_bindgen_34473a588f1157e4 (
+--   signed int arg1
+-- )
+-- {
+--   return (tagged_code_example)(arg1);
+-- }
+-- signed int hs_bindgen_471f4a3c2db31252 (
+--   char const *arg1,
+--   char *arg2
+-- )
+-- {
+--   return (backslash_syntax)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_e6085a910ba41ecb (
+--   uint8_t const *arg1,
+--   uint8_t *arg2,
+--   size_t *arg3
+-- )
+-- {
+--   return (process_data)(arg1, arg2, arg3);
+-- }
+-- _Bool hs_bindgen_c27e893aea0b0a77 (
+--   char const *arg1
+-- )
+-- {
+--   return (process_file)(arg1);
+-- }
+-- signed int hs_bindgen_bc1b0e25a72f4ec0 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (calculate_value)(arg1, arg2);
+-- }
+-- _Bool hs_bindgen_09abc3cb74562964 (
+--   signed int arg1
+-- )
+-- {
+--   return (html_example)(arg1);
+-- }
+-- _Bool hs_bindgen_47cba1a95d265f84 (
+--   char const **arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (list_example)(arg1, arg2);
+-- }
+-- void *hs_bindgen_e065fc013e4eccd6 (
+--   void *arg1
+-- )
+-- {
+--   return (dangerous_function)(arg1);
+-- }
+-- signed int hs_bindgen_bc4f7e24b2ad4ace (
+--   char const *arg1
+-- )
+-- {
+--   return (detailed_return_codes)(arg1);
+-- }
+-- signed int hs_bindgen_8deec146389ae8b3 (
+--   signed int arg1
+-- )
+-- {
+--   return (old_function)(arg1);
+-- }
+-- signed int hs_bindgen_da2dcc1473935665 (
+--   signed int arg1
+-- )
+-- {
+--   return (versioned_function)(arg1);
+-- }
+-- signed int hs_bindgen_97c1191917e6eece (
+--   char *arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (process_buffer)(arg1, arg2);
+-- }
+-- void *hs_bindgen_58253bb560dc3eb3 (
+--   void *arg1,
+--   void const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (my_memcpy)(arg1, arg2, arg3);
+-- }
+-- signed int hs_bindgen_44dd19b16ee38e5b (
+--   signed int arg1
+-- )
+-- {
+--   return (double_value)(arg1);
+-- }
+-- signed int hs_bindgen_a7d2e6fe1e9b3164 (
+--   signed int arg1,
+--   void *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (read_chunk)(arg1, arg2, arg3);
+-- }
+-- signed int hs_bindgen_59f0c5ef262c5f3b (
+--   signed int arg1,
+--   void const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (write_chunk)(arg1, arg2, arg3);
+-- }
+-- status_code_t hs_bindgen_fd6fce7c8d8b2f79 (
+--   config_t *arg1,
+--   uint8_t const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (complex_function)(arg1, arg2, arg3);
+-- }
+-- signed int hs_bindgen_dd36c8b317ccfcc4 (
+--   char *arg1
+-- )
+-- {
+--   return (hash)(arg1);
+-- }
+-- signed int hs_bindgen_6875e30a7fe8d30a (
+--   signed int arg1
+-- )
+-- {
+--   return (square)(arg1);
+-- }
+-- signed int hs_bindgen_3094fd32a3eedd49 (
+--   signed int arg1
+-- )
+-- {
+--   return (auto_brief_func)(arg1);
+-- }
+-- void hs_bindgen_73270d34a2bf31b5 (
+--   char *arg1,
+--   size_t arg2
+-- )
+-- {
+--   (multi_paragraph_details)(arg1, arg2);
+-- }
+-- signed int *hs_bindgen_836de64a94d7bf03 (
+--   signed int arg1
+-- )
+-- {
+--   return (todo_remark_attention)(arg1);
+-- }
+-- signed int hs_bindgen_aa0467b9d3b1a48d (
+--   signed int arg1
+-- )
+-- {
+--   return (html_entities_func)(arg1);
+-- }
+-- void hs_bindgen_b654d8047edfed77 (
+--   signed int arg1
+-- )
+-- {
+--   (nested_inline_format)(arg1);
+-- }
+-- signed int hs_bindgen_aeb274aded3470e5 (
+--   signed int arg1
+-- )
+-- {
+--   return (tagged_code_example)(arg1);
+-- }
+-- signed int hs_bindgen_907720dffab9442a (
+--   char const *arg1,
+--   char *arg2
+-- )
+-- {
+--   return (backslash_syntax)(arg1, arg2);
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_process_data */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_4a5cd66a4f26f8d5 (void)) (
+--   uint8_t const *arg1,
+--   uint8_t *arg2,
+--   size_t *arg3
+-- )
+-- {
+--   return &process_data;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_process_file */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_c8a059c65f18fea9 (void)) (
+--   char const *arg1
+-- )
+-- {
+--   return &process_file;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_calculate_value */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_5ab7e06724867ab3 (void)) (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &calculate_value;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_html_example */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_3f74fb834b0cd46b (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &html_example;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_list_example */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_2175b3c627db39cf (void)) (
+--   char const **arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &list_example;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_dangerous_function */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_b7a4debd18827a19 (void)) (
+--   void *arg1
+-- )
+-- {
+--   return &dangerous_function;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_detailed_return_codes */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_9700b22f82eedafe (void)) (
+--   char const *arg1
+-- )
+-- {
+--   return &detailed_return_codes;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_old_function */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_49e0d34a627c6c19 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &old_function;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_versioned_function */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_180cd7537e40ce99 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &versioned_function;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_process_buffer */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_f4ccc6d90e8d3ebd (void)) (
+--   char *arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &process_buffer;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_my_memcpy */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_6a74d376c901b531 (void)) (
+--   void *arg1,
+--   void const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return &my_memcpy;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_double_value */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_156a92f3c5176105 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &double_value;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_read_chunk */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_373de63fa8345f66 (void)) (
+--   signed int arg1,
+--   void *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return &read_chunk;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_write_chunk */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_78a029fc9807a27f (void)) (
+--   signed int arg1,
+--   void const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return &write_chunk;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_complex_function */
+-- __attribute__ ((const))
+-- status_code_t (*hs_bindgen_dfa39b6be50cb2ca (void)) (
+--   config_t *arg1,
+--   uint8_t const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return &complex_function;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_hash */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_8ad88b79fd71f9d4 (void)) (
+--   char *arg1
+-- )
+-- {
+--   return &hash;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_square */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_7ede0f7ec1b30650 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &square;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_auto_brief_func */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_11a28326d5a28a43 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &auto_brief_func;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_multi_paragraph_details */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_05c7a7832fb84e2e (void)) (
+--   char *arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &multi_paragraph_details;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_todo_remark_attention */
+-- __attribute__ ((const))
+-- signed int *(*hs_bindgen_092b9697f2154ac5 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &todo_remark_attention;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_html_entities_func */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2e8b5e895e58fc3d (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &html_entities_func;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_nested_inline_format */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_db292926f05c7b36 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &nested_inline_format;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_tagged_code_example */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_492a4fd860afb02a (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &tagged_code_example;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_backslash_syntax */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_9ef09ad63fac68e2 (void)) (
+--   char const *arg1,
+--   char *arg2
+-- )
+-- {
+--   return &backslash_syntax;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_global_counter */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_f9dede86496f59c9 (void)
+-- {
+--   return &global_counter;
+-- }
+-- /* test_documentationdoxygen_docs_Example_get_version_string */
+-- __attribute__ ((const))
+-- char const **hs_bindgen_a294be08386c9257 (void)
+-- {
+--   return &version_string;
+-- }
+{-| Maximum length for name strings.
+
+    __C declaration:__ @macro MAX_NAME_LENGTH@
+
+    __defined at:__ @documentation\/doxygen_docs.h 39:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+mAX_NAME_LENGTH :: CInt
+{-| Maximum length for name strings.
+
+    __C declaration:__ @macro MAX_NAME_LENGTH@
+
+    __defined at:__ @documentation\/doxygen_docs.h 39:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+mAX_NAME_LENGTH = 64 :: CInt
+{-| Size type for this library.
+
+    This is the comment __title__
+
+    __C declaration:__ @size_type@
+
+    __defined at:__ @documentation\/doxygen_docs.h 56:16@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Size_type
+    = Size_type {unwrapSize_type :: HsBindgen.Runtime.LibC.CSize}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "unwrapSize_type" Size_type ty
+    where hasField = \x_0 -> (\y_1 -> Size_type{unwrapSize_type = y_1},
+                              getField @"unwrapSize_type" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "unwrapSize_type" (Ptr Size_type) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSize_type")
+instance HasCField Size_type "unwrapSize_type"
+    where type CFieldType Size_type
+                          "unwrapSize_type" = HsBindgen.Runtime.LibC.CSize
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct opaque_struct@
+
+    __defined at:__ @documentation\/doxygen_docs.h 76:8@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Opaque_struct
+{-| __C declaration:__ @union opaque_union@
+
+    __defined at:__ @documentation\/doxygen_docs.h 81:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Opaque_union
+{-| Color enumeration without typedef.
+
+    __C declaration:__ @enum color_enum@
+
+    __defined at:__ @documentation\/doxygen_docs.h 87:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Color_enum
+    = Color_enum {unwrapColor_enum :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Color_enum
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Color_enum
+    where readRaw = \ptr_0 -> pure Color_enum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Color_enum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Color_enum unwrapColor_enum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapColor_enum_2
+deriving via (EquivStorable Color_enum) instance Storable Color_enum
+deriving via CUInt instance Prim Color_enum
+instance CEnum Color_enum
+    where type CEnumZ Color_enum = CUInt
+          toCEnum = Color_enum
+          fromCEnum = getField @"unwrapColor_enum"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "COLOR_RED"),
+                                                         (1, singleton "COLOR_GREEN"),
+                                                         (2, singleton "COLOR_BLUE")]
+          showsUndeclared = showsWrappedUndeclared "Color_enum"
+          readPrecUndeclared = readPrecWrappedUndeclared "Color_enum"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Color_enum
+    where minDeclaredValue = COLOR_RED
+          maxDeclaredValue = COLOR_BLUE
+instance Show Color_enum
+    where showsPrec = shows
+instance Read Color_enum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapColor_enum" Color_enum ty
+    where hasField = \x_0 -> (\y_1 -> Color_enum{unwrapColor_enum = y_1},
+                              getField @"unwrapColor_enum" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapColor_enum" (Ptr Color_enum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapColor_enum")
+instance HasCField Color_enum "unwrapColor_enum"
+    where type CFieldType Color_enum "unwrapColor_enum" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| Red color
+
+    __C declaration:__ @COLOR_RED@
+
+    __defined at:__ @documentation\/doxygen_docs.h 88:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern COLOR_RED :: Color_enum
+pattern COLOR_RED = Color_enum 0
+{-| Green color
+
+    __C declaration:__ @COLOR_GREEN@
+
+    __defined at:__ @documentation\/doxygen_docs.h 89:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern COLOR_GREEN :: Color_enum
+pattern COLOR_GREEN = Color_enum 1
+{-| Blue color
+
+    __C declaration:__ @COLOR_BLUE@
+
+    __defined at:__ @documentation\/doxygen_docs.h 90:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern COLOR_BLUE :: Color_enum
+pattern COLOR_BLUE = Color_enum 2
+{-| Auxiliary type used by 'Event_callback_t'
+
+    __C declaration:__ @event_callback_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 231:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Event_callback_t_Aux
+    = Event_callback_t_Aux {unwrapEvent_callback_t_Aux :: (CInt ->
+                                                           Ptr Void -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toEvent_callback_t_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_111918b0aee2a7fb_base ::
+    CInt -> Ptr Void -> IO CInt
+ -> IO (FunPtr (CInt -> Ptr Void -> IO CInt))
+-- __unique:__ @toEvent_callback_t_Aux@
+hs_bindgen_111918b0aee2a7fb :: Event_callback_t_Aux ->
+                               IO (FunPtr Event_callback_t_Aux)
+-- __unique:__ @toEvent_callback_t_Aux@
+hs_bindgen_111918b0aee2a7fb = \fun_0 -> fmap castFunPtr (hs_bindgen_111918b0aee2a7fb_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapEvent_callback_t_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromEvent_callback_t_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_9e9d478c2d75628c_base ::
+    FunPtr (CInt -> Ptr Void -> IO CInt)
+ -> CInt
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @fromEvent_callback_t_Aux@
+hs_bindgen_9e9d478c2d75628c :: FunPtr Event_callback_t_Aux ->
+                               Event_callback_t_Aux
+-- __unique:__ @fromEvent_callback_t_Aux@
+hs_bindgen_9e9d478c2d75628c = \funPtr_0 -> Event_callback_t_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_9e9d478c2d75628c_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Event_callback_t_Aux
+    where toFunPtr = hs_bindgen_111918b0aee2a7fb
+instance FromFunPtr Event_callback_t_Aux
+    where fromFunPtr = hs_bindgen_9e9d478c2d75628c
+instance (~) ty (CInt -> Ptr Void -> IO CInt) =>
+         HasField "unwrapEvent_callback_t_Aux" Event_callback_t_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Event_callback_t_Aux{unwrapEvent_callback_t_Aux = y_1},
+                              getField @"unwrapEvent_callback_t_Aux" x_0)
+instance (~) ty (CInt -> Ptr Void -> IO CInt) =>
+         HasField "unwrapEvent_callback_t_Aux"
+                  (Ptr Event_callback_t_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapEvent_callback_t_Aux")
+instance HasCField Event_callback_t_Aux
+                   "unwrapEvent_callback_t_Aux"
+    where type CFieldType Event_callback_t_Aux
+                          "unwrapEvent_callback_t_Aux" = CInt -> Ptr Void -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| Callback function type.
+
+    [__@event_type@__]: Type of event
+
+    [__@user_data@__]: User-provided data
+
+    __Returns:__ Handling result
+
+    __C declaration:__ @event_callback_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 231:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Event_callback_t
+    = Event_callback_t {unwrapEvent_callback_t :: (FunPtr Event_callback_t_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Event_callback_t_Aux) =>
+         HasField "unwrapEvent_callback_t" Event_callback_t ty
+    where hasField = \x_0 -> (\y_1 -> Event_callback_t{unwrapEvent_callback_t = y_1},
+                              getField @"unwrapEvent_callback_t" x_0)
+instance (~) ty (FunPtr Event_callback_t_Aux) =>
+         HasField "unwrapEvent_callback_t" (Ptr Event_callback_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapEvent_callback_t")
+instance HasCField Event_callback_t "unwrapEvent_callback_t"
+    where type CFieldType Event_callback_t
+                          "unwrapEvent_callback_t" = FunPtr Event_callback_t_Aux
+          offset# = \_ -> \_ -> 0
+{-| Structure with documented fields.
+
+    This structure demonstrates field documentation.
+
+    __C declaration:__ @struct config_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 238:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Config_t
+    = Config_t {config_t_id :: HsBindgen.Runtime.LibC.Word32
+                {- ^ Unique identifier.
+
+                     __C declaration:__ @id@
+
+                     __defined at:__ @documentation\/doxygen_docs.h 240:14@
+
+                     __exported by:__ @documentation\/doxygen_docs.h@
+                -},
+                config_t_name :: (ConstantArray 64 CChar)
+                {- ^ Human-readable name.
+
+                     __C declaration:__ @name@
+
+                     __defined at:__ @documentation\/doxygen_docs.h 243:10@
+
+                     __exported by:__ @documentation\/doxygen_docs.h@
+                -},
+                config_t_flags :: HsBindgen.Runtime.LibC.Word32
+                {- ^ Configuration flags.
+
+                     __C declaration:__ @flags@
+
+                     __defined at:__ @documentation\/doxygen_docs.h 246:14@
+
+                     __exported by:__ @documentation\/doxygen_docs.h@
+                -},
+                config_t_callback :: Event_callback_t
+                {- ^ Optional callback function.
+
+                     See also: 'Event_callback_t'
+
+                     __C declaration:__ @callback@
+
+                     __defined at:__ @documentation\/doxygen_docs.h 253:22@
+
+                     __exported by:__ @documentation\/doxygen_docs.h@
+                -},
+                config_t_user_data :: (Ptr Void)
+                {- ^ User data for callback.
+
+                     __C declaration:__ @user_data@
+
+                     __defined at:__ @documentation\/doxygen_docs.h 256:11@
+
+                     __exported by:__ @documentation\/doxygen_docs.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Config_t
+    where staticSizeOf = \_ -> 88 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Config_t
+    where readRaw = \ptr_0 -> ((((pure Config_t <*> readRaw (Proxy @"config_t_id") ptr_0) <*> readRaw (Proxy @"config_t_name") ptr_0) <*> readRaw (Proxy @"config_t_flags") ptr_0) <*> readRaw (Proxy @"config_t_callback") ptr_0) <*> readRaw (Proxy @"config_t_user_data") ptr_0
+instance WriteRaw Config_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Config_t config_t_id_2
+                                                config_t_name_3
+                                                config_t_flags_4
+                                                config_t_callback_5
+                                                config_t_user_data_6 -> writeRaw (Proxy @"config_t_id") ptr_0 config_t_id_2 >> (writeRaw (Proxy @"config_t_name") ptr_0 config_t_name_3 >> (writeRaw (Proxy @"config_t_flags") ptr_0 config_t_flags_4 >> (writeRaw (Proxy @"config_t_callback") ptr_0 config_t_callback_5 >> writeRaw (Proxy @"config_t_user_data") ptr_0 config_t_user_data_6)))
+deriving via (EquivStorable Config_t) instance Storable Config_t
+deriving via (IsStructViaReadRaw Config_t) instance IsStruct Config_t
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "config_t_id" Config_t ty
+    where hasField = \x_0 -> (\y_1 -> Config_t{config_t_id = y_1,
+                                               config_t_name = getField @"config_t_name" x_0,
+                                               config_t_flags = getField @"config_t_flags" x_0,
+                                               config_t_callback = getField @"config_t_callback" x_0,
+                                               config_t_user_data = getField @"config_t_user_data" x_0},
+                              getField @"config_t_id" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "config_t_id" (Ptr Config_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"config_t_id")
+instance HasCField Config_t "config_t_id"
+    where type CFieldType Config_t
+                          "config_t_id" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 0
+instance (~) ty (ConstantArray 64 CChar) =>
+         HasField "config_t_name" Config_t ty
+    where hasField = \x_0 -> (\y_1 -> Config_t{config_t_name = y_1,
+                                               config_t_id = getField @"config_t_id" x_0,
+                                               config_t_flags = getField @"config_t_flags" x_0,
+                                               config_t_callback = getField @"config_t_callback" x_0,
+                                               config_t_user_data = getField @"config_t_user_data" x_0},
+                              getField @"config_t_name" x_0)
+instance (~) ty (ConstantArray 64 CChar) =>
+         HasField "config_t_name" (Ptr Config_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"config_t_name")
+instance HasCField Config_t "config_t_name"
+    where type CFieldType Config_t "config_t_name" = ConstantArray 64
+                                                                   CChar
+          offset# = \_ -> \_ -> 4
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "config_t_flags" Config_t ty
+    where hasField = \x_0 -> (\y_1 -> Config_t{config_t_flags = y_1,
+                                               config_t_id = getField @"config_t_id" x_0,
+                                               config_t_name = getField @"config_t_name" x_0,
+                                               config_t_callback = getField @"config_t_callback" x_0,
+                                               config_t_user_data = getField @"config_t_user_data" x_0},
+                              getField @"config_t_flags" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "config_t_flags" (Ptr Config_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"config_t_flags")
+instance HasCField Config_t "config_t_flags"
+    where type CFieldType Config_t
+                          "config_t_flags" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 68
+instance (~) ty Event_callback_t =>
+         HasField "config_t_callback" Config_t ty
+    where hasField = \x_0 -> (\y_1 -> Config_t{config_t_callback = y_1,
+                                               config_t_id = getField @"config_t_id" x_0,
+                                               config_t_name = getField @"config_t_name" x_0,
+                                               config_t_flags = getField @"config_t_flags" x_0,
+                                               config_t_user_data = getField @"config_t_user_data" x_0},
+                              getField @"config_t_callback" x_0)
+instance (~) ty Event_callback_t =>
+         HasField "config_t_callback" (Ptr Config_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"config_t_callback")
+instance HasCField Config_t "config_t_callback"
+    where type CFieldType Config_t
+                          "config_t_callback" = Event_callback_t
+          offset# = \_ -> \_ -> 72
+instance (~) ty (Ptr Void) =>
+         HasField "config_t_user_data" Config_t ty
+    where hasField = \x_0 -> (\y_1 -> Config_t{config_t_user_data = y_1,
+                                               config_t_id = getField @"config_t_id" x_0,
+                                               config_t_name = getField @"config_t_name" x_0,
+                                               config_t_flags = getField @"config_t_flags" x_0,
+                                               config_t_callback = getField @"config_t_callback" x_0},
+                              getField @"config_t_user_data" x_0)
+instance (~) ty (Ptr Void) =>
+         HasField "config_t_user_data" (Ptr Config_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"config_t_user_data")
+instance HasCField Config_t "config_t_user_data"
+    where type CFieldType Config_t "config_t_user_data" = Ptr Void
+          offset# = \_ -> \_ -> 80
+{-| Enumeration with documented values.
+
+    This enum shows different status codes.
+
+    __C declaration:__ @enum status_code_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 264:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Status_code_t
+    = Status_code_t {unwrapStatus_code_t :: CInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Status_code_t
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Status_code_t
+    where readRaw = \ptr_0 -> pure Status_code_t <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Status_code_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Status_code_t unwrapStatus_code_t_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapStatus_code_t_2
+deriving via (EquivStorable Status_code_t) instance Storable Status_code_t
+deriving via CInt instance Prim Status_code_t
+instance CEnum Status_code_t
+    where type CEnumZ Status_code_t = CInt
+          toCEnum = Status_code_t
+          fromCEnum = getField @"unwrapStatus_code_t"
+          declaredValues = \_ -> declaredValuesFromList [(-99,
+                                                          singleton "STATUS_ERROR"),
+                                                         (-3, singleton "STATUS_TIMEOUT"),
+                                                         (-2, singleton "STATUS_NO_MEMORY"),
+                                                         (-1, singleton "STATUS_INVALID_PARAM"),
+                                                         (0, singleton "STATUS_OK")]
+          showsUndeclared = showsWrappedUndeclared "Status_code_t"
+          readPrecUndeclared = readPrecWrappedUndeclared "Status_code_t"
+instance Show Status_code_t
+    where showsPrec = shows
+instance Read Status_code_t
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CInt =>
+         HasField "unwrapStatus_code_t" Status_code_t ty
+    where hasField = \x_0 -> (\y_1 -> Status_code_t{unwrapStatus_code_t = y_1},
+                              getField @"unwrapStatus_code_t" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapStatus_code_t" (Ptr Status_code_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStatus_code_t")
+instance HasCField Status_code_t "unwrapStatus_code_t"
+    where type CFieldType Status_code_t "unwrapStatus_code_t" = CInt
+          offset# = \_ -> \_ -> 0
+{-| Operation successful.
+
+    __C declaration:__ @STATUS_OK@
+
+    __defined at:__ @documentation\/doxygen_docs.h 266:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_OK :: Status_code_t
+pattern STATUS_OK = Status_code_t 0
+{-| Invalid parameter provided.
+
+    __C declaration:__ @STATUS_INVALID_PARAM@
+
+    __defined at:__ @documentation\/doxygen_docs.h 269:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_INVALID_PARAM :: Status_code_t
+pattern STATUS_INVALID_PARAM = Status_code_t (-1)
+{-| Memory allocation failed.
+
+    __C declaration:__ @STATUS_NO_MEMORY@
+
+    __defined at:__ @documentation\/doxygen_docs.h 272:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_NO_MEMORY :: Status_code_t
+pattern STATUS_NO_MEMORY = Status_code_t (-2)
+{-| Operation timed out.
+
+    __C declaration:__ @STATUS_TIMEOUT@
+
+    __defined at:__ @documentation\/doxygen_docs.h 275:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_TIMEOUT :: Status_code_t
+pattern STATUS_TIMEOUT = Status_code_t (-3)
+{-| Generic error.
+
+    __C declaration:__ @STATUS_ERROR@
+
+    __defined at:__ @documentation\/doxygen_docs.h 278:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+pattern STATUS_ERROR :: Status_code_t
+pattern STATUS_ERROR = Status_code_t (-99)
+{-| __C declaration:__ @struct \@data_union_t_as_parts@
+
+    __defined at:__ @documentation\/doxygen_docs.h 296:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Data_union_t_as_parts
+    = Data_union_t_as_parts {data_union_t_as_parts_low :: HsBindgen.Runtime.LibC.Word16
+                             {- ^ Low 16 bits.
+
+                                  __C declaration:__ @low@
+
+                                  __defined at:__ @documentation\/doxygen_docs.h 297:18@
+
+                                  __exported by:__ @documentation\/doxygen_docs.h@
+                             -},
+                             data_union_t_as_parts_high :: HsBindgen.Runtime.LibC.Word16
+                             {- ^ High 16 bits.
+
+                                  __C declaration:__ @high@
+
+                                  __defined at:__ @documentation\/doxygen_docs.h 298:18@
+
+                                  __exported by:__ @documentation\/doxygen_docs.h@
+                             -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Data_union_t_as_parts
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Data_union_t_as_parts
+    where readRaw = \ptr_0 -> (pure Data_union_t_as_parts <*> readRaw (Proxy @"data_union_t_as_parts_low") ptr_0) <*> readRaw (Proxy @"data_union_t_as_parts_high") ptr_0
+instance WriteRaw Data_union_t_as_parts
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Data_union_t_as_parts data_union_t_as_parts_low_2
+                                                             data_union_t_as_parts_high_3 -> writeRaw (Proxy @"data_union_t_as_parts_low") ptr_0 data_union_t_as_parts_low_2 >> writeRaw (Proxy @"data_union_t_as_parts_high") ptr_0 data_union_t_as_parts_high_3
+deriving via (EquivStorable Data_union_t_as_parts) instance Storable Data_union_t_as_parts
+deriving via (IsStructViaReadRaw Data_union_t_as_parts) instance IsStruct Data_union_t_as_parts
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "data_union_t_as_parts_low" Data_union_t_as_parts ty
+    where hasField = \x_0 -> (\y_1 -> Data_union_t_as_parts{data_union_t_as_parts_low = y_1,
+                                                            data_union_t_as_parts_high = getField @"data_union_t_as_parts_high" x_0},
+                              getField @"data_union_t_as_parts_low" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "data_union_t_as_parts_low"
+                  (Ptr Data_union_t_as_parts)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"data_union_t_as_parts_low")
+instance HasCField Data_union_t_as_parts
+                   "data_union_t_as_parts_low"
+    where type CFieldType Data_union_t_as_parts
+                          "data_union_t_as_parts_low" = HsBindgen.Runtime.LibC.Word16
+          offset# = \_ -> \_ -> 0
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "data_union_t_as_parts_high" Data_union_t_as_parts ty
+    where hasField = \x_0 -> (\y_1 -> Data_union_t_as_parts{data_union_t_as_parts_high = y_1,
+                                                            data_union_t_as_parts_low = getField @"data_union_t_as_parts_low" x_0},
+                              getField @"data_union_t_as_parts_high" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "data_union_t_as_parts_high"
+                  (Ptr Data_union_t_as_parts)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"data_union_t_as_parts_high")
+instance HasCField Data_union_t_as_parts
+                   "data_union_t_as_parts_high"
+    where type CFieldType Data_union_t_as_parts
+                          "data_union_t_as_parts_high" = HsBindgen.Runtime.LibC.Word16
+          offset# = \_ -> \_ -> 2
+{-| Union with documented fields.
+
+    This union demonstrates different data representations.
+
+    __C declaration:__ @union data_union_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 287:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Data_union_t
+    = Data_union_t {unwrapData_union_t :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Data_union_t
+deriving via (SizedByteArray 4 4) instance ReadRaw Data_union_t
+deriving via (SizedByteArray 4 4) instance WriteRaw Data_union_t
+deriving via (EquivStorable Data_union_t) instance Storable Data_union_t
+deriving via (SizedByteArray 4 4) instance IsUnion Data_union_t
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "data_union_t_as_int" Data_union_t ty
+    where getField = getUnionPayload
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "data_union_t_as_int" Data_union_t ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"data_union_t_as_int" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "data_union_t_as_int" (Ptr Data_union_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"data_union_t_as_int")
+instance HasCField Data_union_t "data_union_t_as_int"
+    where type CFieldType Data_union_t
+                          "data_union_t_as_int" = HsBindgen.Runtime.LibC.Int32
+          offset# = \_ -> \_ -> 0
+instance (~) ty CFloat =>
+         HasField "data_union_t_as_float" Data_union_t ty
+    where getField = getUnionPayload
+instance (~) ty CFloat =>
+         HasField "data_union_t_as_float" Data_union_t ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"data_union_t_as_float" x_0)
+instance (~) ty CFloat =>
+         HasField "data_union_t_as_float" (Ptr Data_union_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"data_union_t_as_float")
+instance HasCField Data_union_t "data_union_t_as_float"
+    where type CFieldType Data_union_t "data_union_t_as_float" = CFloat
+          offset# = \_ -> \_ -> 0
+instance (~) ty (ConstantArray 4 HsBindgen.Runtime.LibC.Word8) =>
+         HasField "data_union_t_as_bytes" Data_union_t ty
+    where getField = getUnionPayload
+instance (~) ty (ConstantArray 4 HsBindgen.Runtime.LibC.Word8) =>
+         HasField "data_union_t_as_bytes" Data_union_t ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"data_union_t_as_bytes" x_0)
+instance (~) ty (ConstantArray 4 HsBindgen.Runtime.LibC.Word8) =>
+         HasField "data_union_t_as_bytes" (Ptr Data_union_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"data_union_t_as_bytes")
+instance HasCField Data_union_t "data_union_t_as_bytes"
+    where type CFieldType Data_union_t
+                          "data_union_t_as_bytes" = ConstantArray 4
+                                                                  HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 0
+instance (~) ty Data_union_t_as_parts =>
+         HasField "data_union_t_as_parts" Data_union_t ty
+    where getField = getUnionPayload
+instance (~) ty Data_union_t_as_parts =>
+         HasField "data_union_t_as_parts" Data_union_t ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"data_union_t_as_parts" x_0)
+instance (~) ty Data_union_t_as_parts =>
+         HasField "data_union_t_as_parts" (Ptr Data_union_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"data_union_t_as_parts")
+instance HasCField Data_union_t "data_union_t_as_parts"
+    where type CFieldType Data_union_t
+                          "data_union_t_as_parts" = Data_union_t_as_parts
+          offset# = \_ -> \_ -> 0
+{-| Bit field structure.
+
+    Demonstrates bit field documentation.
+
+    __C declaration:__ @struct bitfield_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 308:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Bitfield_t
+    = Bitfield_t {bitfield_t_flag1 :: CUInt
+                  {- ^ First flag (1 bit).
+
+                       __C declaration:__ @flag1@
+
+                       __defined at:__ @documentation\/doxygen_docs.h 309:14@
+
+                       __exported by:__ @documentation\/doxygen_docs.h@
+                  -},
+                  bitfield_t_flag2 :: CUInt
+                  {- ^ Second flag (1 bit).
+
+                       __C declaration:__ @flag2@
+
+                       __defined at:__ @documentation\/doxygen_docs.h 310:14@
+
+                       __exported by:__ @documentation\/doxygen_docs.h@
+                  -},
+                  bitfield_t_counter :: CUInt
+                  {- ^ Counter value (6 bits).
+
+                       __C declaration:__ @counter@
+
+                       __defined at:__ @documentation\/doxygen_docs.h 311:14@
+
+                       __exported by:__ @documentation\/doxygen_docs.h@
+                  -},
+                  bitfield_t_reserved :: CUInt
+                  {- ^ Reserved bits (24 bits).
+
+                       __C declaration:__ @reserved@
+
+                       __defined at:__ @documentation\/doxygen_docs.h 312:14@
+
+                       __exported by:__ @documentation\/doxygen_docs.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bitfield_t
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bitfield_t
+    where readRaw = \ptr_0 -> (((pure Bitfield_t <*> peek (Proxy @"bitfield_t_flag1") ptr_0) <*> peek (Proxy @"bitfield_t_flag2") ptr_0) <*> peek (Proxy @"bitfield_t_counter") ptr_0) <*> peek (Proxy @"bitfield_t_reserved") ptr_0
+instance WriteRaw Bitfield_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bitfield_t bitfield_t_flag1_2
+                                                  bitfield_t_flag2_3
+                                                  bitfield_t_counter_4
+                                                  bitfield_t_reserved_5 -> poke (Proxy @"bitfield_t_flag1") ptr_0 bitfield_t_flag1_2 >> (poke (Proxy @"bitfield_t_flag2") ptr_0 bitfield_t_flag2_3 >> (poke (Proxy @"bitfield_t_counter") ptr_0 bitfield_t_counter_4 >> poke (Proxy @"bitfield_t_reserved") ptr_0 bitfield_t_reserved_5))
+deriving via (EquivStorable Bitfield_t) instance Storable Bitfield_t
+deriving via (IsStructViaReadRaw Bitfield_t) instance IsStruct Bitfield_t
+instance (~) ty CUInt => HasField "bitfield_t_flag1" Bitfield_t ty
+    where hasField = \x_0 -> (\y_1 -> Bitfield_t{bitfield_t_flag1 = y_1,
+                                                 bitfield_t_flag2 = getField @"bitfield_t_flag2" x_0,
+                                                 bitfield_t_counter = getField @"bitfield_t_counter" x_0,
+                                                 bitfield_t_reserved = getField @"bitfield_t_reserved" x_0},
+                              getField @"bitfield_t_flag1" x_0)
+instance (~) ty CUInt =>
+         HasField "bitfield_t_flag1" (Ptr Bitfield_t) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bitfield_t_flag1")
+instance HasCBitfield Bitfield_t "bitfield_t_flag1"
+    where type CBitfieldType Bitfield_t "bitfield_t_flag1" = CUInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 1
+instance (~) ty CUInt => HasField "bitfield_t_flag2" Bitfield_t ty
+    where hasField = \x_0 -> (\y_1 -> Bitfield_t{bitfield_t_flag2 = y_1,
+                                                 bitfield_t_flag1 = getField @"bitfield_t_flag1" x_0,
+                                                 bitfield_t_counter = getField @"bitfield_t_counter" x_0,
+                                                 bitfield_t_reserved = getField @"bitfield_t_reserved" x_0},
+                              getField @"bitfield_t_flag2" x_0)
+instance (~) ty CUInt =>
+         HasField "bitfield_t_flag2" (Ptr Bitfield_t) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bitfield_t_flag2")
+instance HasCBitfield Bitfield_t "bitfield_t_flag2"
+    where type CBitfieldType Bitfield_t "bitfield_t_flag2" = CUInt
+          bitfieldOffset# = \_ -> \_ -> 1
+          bitfieldWidth# = \_ -> \_ -> 1
+instance (~) ty CUInt =>
+         HasField "bitfield_t_counter" Bitfield_t ty
+    where hasField = \x_0 -> (\y_1 -> Bitfield_t{bitfield_t_counter = y_1,
+                                                 bitfield_t_flag1 = getField @"bitfield_t_flag1" x_0,
+                                                 bitfield_t_flag2 = getField @"bitfield_t_flag2" x_0,
+                                                 bitfield_t_reserved = getField @"bitfield_t_reserved" x_0},
+                              getField @"bitfield_t_counter" x_0)
+instance (~) ty CUInt =>
+         HasField "bitfield_t_counter" (Ptr Bitfield_t) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bitfield_t_counter")
+instance HasCBitfield Bitfield_t "bitfield_t_counter"
+    where type CBitfieldType Bitfield_t "bitfield_t_counter" = CUInt
+          bitfieldOffset# = \_ -> \_ -> 2
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CUInt =>
+         HasField "bitfield_t_reserved" Bitfield_t ty
+    where hasField = \x_0 -> (\y_1 -> Bitfield_t{bitfield_t_reserved = y_1,
+                                                 bitfield_t_flag1 = getField @"bitfield_t_flag1" x_0,
+                                                 bitfield_t_flag2 = getField @"bitfield_t_flag2" x_0,
+                                                 bitfield_t_counter = getField @"bitfield_t_counter" x_0},
+                              getField @"bitfield_t_reserved" x_0)
+instance (~) ty CUInt =>
+         HasField "bitfield_t_reserved" (Ptr Bitfield_t) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bitfield_t_reserved")
+instance HasCBitfield Bitfield_t "bitfield_t_reserved"
+    where type CBitfieldType Bitfield_t "bitfield_t_reserved" = CUInt
+          bitfieldOffset# = \_ -> \_ -> 8
+          bitfieldWidth# = \_ -> \_ -> 24
+{-| Auxiliary type used by 'Processor_fn_t'
+
+    __C declaration:__ @processor_fn_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 323:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Processor_fn_t_Aux
+    = Processor_fn_t_Aux {unwrapProcessor_fn_t_Aux :: (CInt ->
+                                                       Ptr Void -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toProcessor_fn_t_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d4e16471c82d5df0_base ::
+    CInt -> Ptr Void -> IO CInt
+ -> IO (FunPtr (CInt -> Ptr Void -> IO CInt))
+-- __unique:__ @toProcessor_fn_t_Aux@
+hs_bindgen_d4e16471c82d5df0 :: Processor_fn_t_Aux ->
+                               IO (FunPtr Processor_fn_t_Aux)
+-- __unique:__ @toProcessor_fn_t_Aux@
+hs_bindgen_d4e16471c82d5df0 = \fun_0 -> fmap castFunPtr (hs_bindgen_d4e16471c82d5df0_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapProcessor_fn_t_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromProcessor_fn_t_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_0d4b3d0461629423_base ::
+    FunPtr (CInt -> Ptr Void -> IO CInt)
+ -> CInt
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @fromProcessor_fn_t_Aux@
+hs_bindgen_0d4b3d0461629423 :: FunPtr Processor_fn_t_Aux ->
+                               Processor_fn_t_Aux
+-- __unique:__ @fromProcessor_fn_t_Aux@
+hs_bindgen_0d4b3d0461629423 = \funPtr_0 -> Processor_fn_t_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_0d4b3d0461629423_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Processor_fn_t_Aux
+    where toFunPtr = hs_bindgen_d4e16471c82d5df0
+instance FromFunPtr Processor_fn_t_Aux
+    where fromFunPtr = hs_bindgen_0d4b3d0461629423
+instance (~) ty (CInt -> Ptr Void -> IO CInt) =>
+         HasField "unwrapProcessor_fn_t_Aux" Processor_fn_t_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Processor_fn_t_Aux{unwrapProcessor_fn_t_Aux = y_1},
+                              getField @"unwrapProcessor_fn_t_Aux" x_0)
+instance (~) ty (CInt -> Ptr Void -> IO CInt) =>
+         HasField "unwrapProcessor_fn_t_Aux"
+                  (Ptr Processor_fn_t_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapProcessor_fn_t_Aux")
+instance HasCField Processor_fn_t_Aux "unwrapProcessor_fn_t_Aux"
+    where type CFieldType Processor_fn_t_Aux
+                          "unwrapProcessor_fn_t_Aux" = CInt -> Ptr Void -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| Function pointer typedef.
+
+    [__@input@__]: Input value
+
+    [__@context@__]: Context pointer
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @processor_fn_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 323:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Processor_fn_t
+    = Processor_fn_t {unwrapProcessor_fn_t :: (FunPtr Processor_fn_t_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Processor_fn_t_Aux) =>
+         HasField "unwrapProcessor_fn_t" Processor_fn_t ty
+    where hasField = \x_0 -> (\y_1 -> Processor_fn_t{unwrapProcessor_fn_t = y_1},
+                              getField @"unwrapProcessor_fn_t" x_0)
+instance (~) ty (FunPtr Processor_fn_t_Aux) =>
+         HasField "unwrapProcessor_fn_t" (Ptr Processor_fn_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapProcessor_fn_t")
+instance HasCField Processor_fn_t "unwrapProcessor_fn_t"
+    where type CFieldType Processor_fn_t
+                          "unwrapProcessor_fn_t" = FunPtr Processor_fn_t_Aux
+          offset# = \_ -> \_ -> 0
+{-| Array typedef with size.
+
+    __C declaration:__ @filename_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 329:14@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Filename_t
+    = Filename_t {unwrapFilename_t :: (ConstantArray 256 CChar)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 256 CChar) =>
+         HasField "unwrapFilename_t" Filename_t ty
+    where hasField = \x_0 -> (\y_1 -> Filename_t{unwrapFilename_t = y_1},
+                              getField @"unwrapFilename_t" x_0)
+instance (~) ty (ConstantArray 256 CChar) =>
+         HasField "unwrapFilename_t" (Ptr Filename_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFilename_t")
+instance HasCField Filename_t "unwrapFilename_t"
+    where type CFieldType Filename_t
+                          "unwrapFilename_t" = ConstantArray 256 CChar
+          offset# = \_ -> \_ -> 0
+{-| Structure with flexible array member.
+
+    Used for variable-length data buffers.
+
+    __C declaration:__ @struct flexible_array@
+
+    __defined at:__ @documentation\/doxygen_docs.h 365:8@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Flexible_array_Aux
+    = Flexible_array {flexible_array_count :: HsBindgen.Runtime.LibC.CSize
+                      {- ^ Number of elements.
+
+                           __C declaration:__ @count@
+
+                           __defined at:__ @documentation\/doxygen_docs.h 366:12@
+
+                           __exported by:__ @documentation\/doxygen_docs.h@
+                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Flexible_array_Aux
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Flexible_array_Aux
+    where readRaw = \ptr_0 -> pure Flexible_array <*> readRaw (Proxy @"flexible_array_count") ptr_0
+instance WriteRaw Flexible_array_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Flexible_array flexible_array_count_2 -> writeRaw (Proxy @"flexible_array_count") ptr_0 flexible_array_count_2
+deriving via (EquivStorable Flexible_array_Aux) instance Storable Flexible_array_Aux
+deriving via (IsStructViaReadRaw Flexible_array_Aux) instance IsStruct Flexible_array_Aux
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "flexible_array_count" Flexible_array_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Flexible_array{flexible_array_count = y_1},
+                              getField @"flexible_array_count" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "flexible_array_count" (Ptr Flexible_array_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"flexible_array_count")
+instance HasCField Flexible_array_Aux "flexible_array_count"
+    where type CFieldType Flexible_array_Aux
+                          "flexible_array_count" = HsBindgen.Runtime.LibC.CSize
+          offset# = \_ -> \_ -> 0
+instance Offset CInt Flexible_array_Aux
+    where offset = \_proxy_0 -> 8
+type Flexible_array = WithFlam CInt Flexible_array_Aux
+{-| Struct with invariant.
+
+    __Invariant:__ capacity >= size at all times
+
+    __C declaration:__ @struct dyn_array_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 523:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Dyn_array_t
+    = Dyn_array_t {dyn_array_t_data :: (Ptr CInt)
+                   {- ^ Pointer to data.
+
+                        __C declaration:__ @data@
+
+                        __defined at:__ @documentation\/doxygen_docs.h 524:10@
+
+                        __exported by:__ @documentation\/doxygen_docs.h@
+                   -},
+                   dyn_array_t_size :: HsBindgen.Runtime.LibC.CSize
+                   {- ^ Current number of elements.
+
+                        __C declaration:__ @size@
+
+                        __defined at:__ @documentation\/doxygen_docs.h 525:12@
+
+                        __exported by:__ @documentation\/doxygen_docs.h@
+                   -},
+                   dyn_array_t_capacity :: HsBindgen.Runtime.LibC.CSize
+                   {- ^ Allocated capacity.
+
+                        __C declaration:__ @capacity@
+
+                        __defined at:__ @documentation\/doxygen_docs.h 526:12@
+
+                        __exported by:__ @documentation\/doxygen_docs.h@
+                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Dyn_array_t
+    where staticSizeOf = \_ -> 24 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Dyn_array_t
+    where readRaw = \ptr_0 -> ((pure Dyn_array_t <*> readRaw (Proxy @"dyn_array_t_data") ptr_0) <*> readRaw (Proxy @"dyn_array_t_size") ptr_0) <*> readRaw (Proxy @"dyn_array_t_capacity") ptr_0
+instance WriteRaw Dyn_array_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Dyn_array_t dyn_array_t_data_2
+                                                   dyn_array_t_size_3
+                                                   dyn_array_t_capacity_4 -> writeRaw (Proxy @"dyn_array_t_data") ptr_0 dyn_array_t_data_2 >> (writeRaw (Proxy @"dyn_array_t_size") ptr_0 dyn_array_t_size_3 >> writeRaw (Proxy @"dyn_array_t_capacity") ptr_0 dyn_array_t_capacity_4)
+deriving via (EquivStorable Dyn_array_t) instance Storable Dyn_array_t
+deriving via (IsStructViaReadRaw Dyn_array_t) instance IsStruct Dyn_array_t
+instance (~) ty (Ptr CInt) =>
+         HasField "dyn_array_t_data" Dyn_array_t ty
+    where hasField = \x_0 -> (\y_1 -> Dyn_array_t{dyn_array_t_data = y_1,
+                                                  dyn_array_t_size = getField @"dyn_array_t_size" x_0,
+                                                  dyn_array_t_capacity = getField @"dyn_array_t_capacity" x_0},
+                              getField @"dyn_array_t_data" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "dyn_array_t_data" (Ptr Dyn_array_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"dyn_array_t_data")
+instance HasCField Dyn_array_t "dyn_array_t_data"
+    where type CFieldType Dyn_array_t "dyn_array_t_data" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "dyn_array_t_size" Dyn_array_t ty
+    where hasField = \x_0 -> (\y_1 -> Dyn_array_t{dyn_array_t_size = y_1,
+                                                  dyn_array_t_data = getField @"dyn_array_t_data" x_0,
+                                                  dyn_array_t_capacity = getField @"dyn_array_t_capacity" x_0},
+                              getField @"dyn_array_t_size" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "dyn_array_t_size" (Ptr Dyn_array_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"dyn_array_t_size")
+instance HasCField Dyn_array_t "dyn_array_t_size"
+    where type CFieldType Dyn_array_t
+                          "dyn_array_t_size" = HsBindgen.Runtime.LibC.CSize
+          offset# = \_ -> \_ -> 8
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "dyn_array_t_capacity" Dyn_array_t ty
+    where hasField = \x_0 -> (\y_1 -> Dyn_array_t{dyn_array_t_capacity = y_1,
+                                                  dyn_array_t_data = getField @"dyn_array_t_data" x_0,
+                                                  dyn_array_t_size = getField @"dyn_array_t_size" x_0},
+                              getField @"dyn_array_t_capacity" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "dyn_array_t_capacity" (Ptr Dyn_array_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"dyn_array_t_capacity")
+instance HasCField Dyn_array_t "dyn_array_t_capacity"
+    where type CFieldType Dyn_array_t
+                          "dyn_array_t_capacity" = HsBindgen.Runtime.LibC.CSize
+          offset# = \_ -> \_ -> 16
+{-| __C declaration:__ @struct \@multi_untagged_t_pos@
+
+    __defined at:__ @documentation\/doxygen_docs.h 586:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Multi_untagged_t_pos
+    = Multi_untagged_t_pos {multi_untagged_t_pos_x :: CFloat
+                            {- ^ X coordinate.
+
+                                 __C declaration:__ @x@
+
+                                 __defined at:__ @documentation\/doxygen_docs.h 587:15@
+
+                                 __exported by:__ @documentation\/doxygen_docs.h@
+                            -},
+                            multi_untagged_t_pos_y :: CFloat
+                            {- ^ Y coordinate.
+
+                                 __C declaration:__ @y@
+
+                                 __defined at:__ @documentation\/doxygen_docs.h 588:15@
+
+                                 __exported by:__ @documentation\/doxygen_docs.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Multi_untagged_t_pos
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Multi_untagged_t_pos
+    where readRaw = \ptr_0 -> (pure Multi_untagged_t_pos <*> readRaw (Proxy @"multi_untagged_t_pos_x") ptr_0) <*> readRaw (Proxy @"multi_untagged_t_pos_y") ptr_0
+instance WriteRaw Multi_untagged_t_pos
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Multi_untagged_t_pos multi_untagged_t_pos_x_2
+                                                            multi_untagged_t_pos_y_3 -> writeRaw (Proxy @"multi_untagged_t_pos_x") ptr_0 multi_untagged_t_pos_x_2 >> writeRaw (Proxy @"multi_untagged_t_pos_y") ptr_0 multi_untagged_t_pos_y_3
+deriving via (EquivStorable Multi_untagged_t_pos) instance Storable Multi_untagged_t_pos
+deriving via (IsStructViaReadRaw Multi_untagged_t_pos) instance IsStruct Multi_untagged_t_pos
+instance (~) ty CFloat =>
+         HasField "multi_untagged_t_pos_x" Multi_untagged_t_pos ty
+    where hasField = \x_0 -> (\y_1 -> Multi_untagged_t_pos{multi_untagged_t_pos_x = y_1,
+                                                           multi_untagged_t_pos_y = getField @"multi_untagged_t_pos_y" x_0},
+                              getField @"multi_untagged_t_pos_x" x_0)
+instance (~) ty CFloat =>
+         HasField "multi_untagged_t_pos_x"
+                  (Ptr Multi_untagged_t_pos)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"multi_untagged_t_pos_x")
+instance HasCField Multi_untagged_t_pos "multi_untagged_t_pos_x"
+    where type CFieldType Multi_untagged_t_pos
+                          "multi_untagged_t_pos_x" = CFloat
+          offset# = \_ -> \_ -> 0
+instance (~) ty CFloat =>
+         HasField "multi_untagged_t_pos_y" Multi_untagged_t_pos ty
+    where hasField = \x_0 -> (\y_1 -> Multi_untagged_t_pos{multi_untagged_t_pos_y = y_1,
+                                                           multi_untagged_t_pos_x = getField @"multi_untagged_t_pos_x" x_0},
+                              getField @"multi_untagged_t_pos_y" x_0)
+instance (~) ty CFloat =>
+         HasField "multi_untagged_t_pos_y"
+                  (Ptr Multi_untagged_t_pos)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"multi_untagged_t_pos_y")
+instance HasCField Multi_untagged_t_pos "multi_untagged_t_pos_y"
+    where type CFieldType Multi_untagged_t_pos
+                          "multi_untagged_t_pos_y" = CFloat
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@multi_untagged_t_dim@
+
+    __defined at:__ @documentation\/doxygen_docs.h 594:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Multi_untagged_t_dim
+    = Multi_untagged_t_dim {multi_untagged_t_dim_w :: CFloat
+                            {- ^ Width.
+
+                                 __C declaration:__ @w@
+
+                                 __defined at:__ @documentation\/doxygen_docs.h 595:15@
+
+                                 __exported by:__ @documentation\/doxygen_docs.h@
+                            -},
+                            multi_untagged_t_dim_h :: CFloat
+                            {- ^ Height.
+
+                                 __C declaration:__ @h@
+
+                                 __defined at:__ @documentation\/doxygen_docs.h 596:15@
+
+                                 __exported by:__ @documentation\/doxygen_docs.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Multi_untagged_t_dim
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Multi_untagged_t_dim
+    where readRaw = \ptr_0 -> (pure Multi_untagged_t_dim <*> readRaw (Proxy @"multi_untagged_t_dim_w") ptr_0) <*> readRaw (Proxy @"multi_untagged_t_dim_h") ptr_0
+instance WriteRaw Multi_untagged_t_dim
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Multi_untagged_t_dim multi_untagged_t_dim_w_2
+                                                            multi_untagged_t_dim_h_3 -> writeRaw (Proxy @"multi_untagged_t_dim_w") ptr_0 multi_untagged_t_dim_w_2 >> writeRaw (Proxy @"multi_untagged_t_dim_h") ptr_0 multi_untagged_t_dim_h_3
+deriving via (EquivStorable Multi_untagged_t_dim) instance Storable Multi_untagged_t_dim
+deriving via (IsStructViaReadRaw Multi_untagged_t_dim) instance IsStruct Multi_untagged_t_dim
+instance (~) ty CFloat =>
+         HasField "multi_untagged_t_dim_w" Multi_untagged_t_dim ty
+    where hasField = \x_0 -> (\y_1 -> Multi_untagged_t_dim{multi_untagged_t_dim_w = y_1,
+                                                           multi_untagged_t_dim_h = getField @"multi_untagged_t_dim_h" x_0},
+                              getField @"multi_untagged_t_dim_w" x_0)
+instance (~) ty CFloat =>
+         HasField "multi_untagged_t_dim_w"
+                  (Ptr Multi_untagged_t_dim)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"multi_untagged_t_dim_w")
+instance HasCField Multi_untagged_t_dim "multi_untagged_t_dim_w"
+    where type CFieldType Multi_untagged_t_dim
+                          "multi_untagged_t_dim_w" = CFloat
+          offset# = \_ -> \_ -> 0
+instance (~) ty CFloat =>
+         HasField "multi_untagged_t_dim_h" Multi_untagged_t_dim ty
+    where hasField = \x_0 -> (\y_1 -> Multi_untagged_t_dim{multi_untagged_t_dim_h = y_1,
+                                                           multi_untagged_t_dim_w = getField @"multi_untagged_t_dim_w" x_0},
+                              getField @"multi_untagged_t_dim_h" x_0)
+instance (~) ty CFloat =>
+         HasField "multi_untagged_t_dim_h"
+                  (Ptr Multi_untagged_t_dim)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"multi_untagged_t_dim_h")
+instance HasCField Multi_untagged_t_dim "multi_untagged_t_dim_h"
+    where type CFieldType Multi_untagged_t_dim
+                          "multi_untagged_t_dim_h" = CFloat
+          offset# = \_ -> \_ -> 4
+{-| Struct with multiple untagged inner structs.
+
+    Tests that doxygen comment enrichment correctly associates field comments with untagged inner structs at multiple nesting levels.
+
+    __C declaration:__ @struct multi_untagged_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 582:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Multi_untagged_t
+    = Multi_untagged_t {multi_untagged_t_pos :: Multi_untagged_t_pos
+                        {- ^ Position in 2D space.
+
+                             Position fields
+
+                             __C declaration:__ @pos@
+
+                             __defined at:__ @documentation\/doxygen_docs.h 589:30@
+
+                             __exported by:__ @documentation\/doxygen_docs.h@
+                        -},
+                        multi_untagged_t_dim :: Multi_untagged_t_dim
+                        {- ^ Dimensions.
+
+                             Dimension fields
+
+                             __C declaration:__ @dim@
+
+                             __defined at:__ @documentation\/doxygen_docs.h 597:31@
+
+                             __exported by:__ @documentation\/doxygen_docs.h@
+                        -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Multi_untagged_t
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Multi_untagged_t
+    where readRaw = \ptr_0 -> (pure Multi_untagged_t <*> readRaw (Proxy @"multi_untagged_t_pos") ptr_0) <*> readRaw (Proxy @"multi_untagged_t_dim") ptr_0
+instance WriteRaw Multi_untagged_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Multi_untagged_t multi_untagged_t_pos_2
+                                                        multi_untagged_t_dim_3 -> writeRaw (Proxy @"multi_untagged_t_pos") ptr_0 multi_untagged_t_pos_2 >> writeRaw (Proxy @"multi_untagged_t_dim") ptr_0 multi_untagged_t_dim_3
+deriving via (EquivStorable Multi_untagged_t) instance Storable Multi_untagged_t
+deriving via (IsStructViaReadRaw Multi_untagged_t) instance IsStruct Multi_untagged_t
+instance (~) ty Multi_untagged_t_pos =>
+         HasField "multi_untagged_t_pos" Multi_untagged_t ty
+    where hasField = \x_0 -> (\y_1 -> Multi_untagged_t{multi_untagged_t_pos = y_1,
+                                                       multi_untagged_t_dim = getField @"multi_untagged_t_dim" x_0},
+                              getField @"multi_untagged_t_pos" x_0)
+instance (~) ty Multi_untagged_t_pos =>
+         HasField "multi_untagged_t_pos" (Ptr Multi_untagged_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"multi_untagged_t_pos")
+instance HasCField Multi_untagged_t "multi_untagged_t_pos"
+    where type CFieldType Multi_untagged_t
+                          "multi_untagged_t_pos" = Multi_untagged_t_pos
+          offset# = \_ -> \_ -> 0
+instance (~) ty Multi_untagged_t_dim =>
+         HasField "multi_untagged_t_dim" Multi_untagged_t ty
+    where hasField = \x_0 -> (\y_1 -> Multi_untagged_t{multi_untagged_t_dim = y_1,
+                                                       multi_untagged_t_pos = getField @"multi_untagged_t_pos" x_0},
+                              getField @"multi_untagged_t_dim" x_0)
+instance (~) ty Multi_untagged_t_dim =>
+         HasField "multi_untagged_t_dim" (Ptr Multi_untagged_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"multi_untagged_t_dim")
+instance HasCField Multi_untagged_t "multi_untagged_t_dim"
+    where type CFieldType Multi_untagged_t
+                          "multi_untagged_t_dim" = Multi_untagged_t_dim
+          offset# = \_ -> \_ -> 8
+{-| Named inner struct
+
+    __C declaration:__ @struct named_inner@
+
+    __defined at:__ @documentation\/doxygen_docs.h 608:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Named_inner
+    = Named_inner {named_inner_nx :: CInt
+                   {- ^ Inner field nx
+
+                        __C declaration:__ @nx@
+
+                        __defined at:__ @documentation\/doxygen_docs.h 610:13@
+
+                        __exported by:__ @documentation\/doxygen_docs.h@
+                   -},
+                   named_inner_ny :: CInt
+                   {- ^ Inner field ny
+
+                        __C declaration:__ @ny@
+
+                        __defined at:__ @documentation\/doxygen_docs.h 612:13@
+
+                        __exported by:__ @documentation\/doxygen_docs.h@
+                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Named_inner
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Named_inner
+    where readRaw = \ptr_0 -> (pure Named_inner <*> readRaw (Proxy @"named_inner_nx") ptr_0) <*> readRaw (Proxy @"named_inner_ny") ptr_0
+instance WriteRaw Named_inner
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Named_inner named_inner_nx_2
+                                                   named_inner_ny_3 -> writeRaw (Proxy @"named_inner_nx") ptr_0 named_inner_nx_2 >> writeRaw (Proxy @"named_inner_ny") ptr_0 named_inner_ny_3
+deriving via (EquivStorable Named_inner) instance Storable Named_inner
+deriving via (IsStructViaReadRaw Named_inner) instance IsStruct Named_inner
+instance (~) ty CInt => HasField "named_inner_nx" Named_inner ty
+    where hasField = \x_0 -> (\y_1 -> Named_inner{named_inner_nx = y_1,
+                                                  named_inner_ny = getField @"named_inner_ny" x_0},
+                              getField @"named_inner_nx" x_0)
+instance (~) ty CInt =>
+         HasField "named_inner_nx" (Ptr Named_inner) (Ptr ty)
+    where getField = fromPtr (Proxy @"named_inner_nx")
+instance HasCField Named_inner "named_inner_nx"
+    where type CFieldType Named_inner "named_inner_nx" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "named_inner_ny" Named_inner ty
+    where hasField = \x_0 -> (\y_1 -> Named_inner{named_inner_ny = y_1,
+                                                  named_inner_nx = getField @"named_inner_nx" x_0},
+                              getField @"named_inner_ny" x_0)
+instance (~) ty CInt =>
+         HasField "named_inner_ny" (Ptr Named_inner) (Ptr ty)
+    where getField = fromPtr (Proxy @"named_inner_ny")
+instance HasCField Named_inner "named_inner_ny"
+    where type CFieldType Named_inner "named_inner_ny" = CInt
+          offset# = \_ -> \_ -> 4
+{-| Struct with a named inner struct.
+
+    Tests that doxygen comment enrichment uses the qualified name "named_outer::named_inner" for lookups.
+
+    __C declaration:__ @struct named_outer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 606:8@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Named_outer
+    = Named_outer {named_outer_inner_field :: Named_inner
+                   {- ^ __C declaration:__ @inner_field@
+
+                        __defined at:__ @documentation\/doxygen_docs.h 613:7@
+
+                        __exported by:__ @documentation\/doxygen_docs.h@
+                   -},
+                   named_outer_nz :: CInt
+                   {- ^ Outer field nz
+
+                        __C declaration:__ @nz@
+
+                        __defined at:__ @documentation\/doxygen_docs.h 615:9@
+
+                        __exported by:__ @documentation\/doxygen_docs.h@
+                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Named_outer
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Named_outer
+    where readRaw = \ptr_0 -> (pure Named_outer <*> readRaw (Proxy @"named_outer_inner_field") ptr_0) <*> readRaw (Proxy @"named_outer_nz") ptr_0
+instance WriteRaw Named_outer
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Named_outer named_outer_inner_field_2
+                                                   named_outer_nz_3 -> writeRaw (Proxy @"named_outer_inner_field") ptr_0 named_outer_inner_field_2 >> writeRaw (Proxy @"named_outer_nz") ptr_0 named_outer_nz_3
+deriving via (EquivStorable Named_outer) instance Storable Named_outer
+deriving via (IsStructViaReadRaw Named_outer) instance IsStruct Named_outer
+instance (~) ty Named_inner =>
+         HasField "named_outer_inner_field" Named_outer ty
+    where hasField = \x_0 -> (\y_1 -> Named_outer{named_outer_inner_field = y_1,
+                                                  named_outer_nz = getField @"named_outer_nz" x_0},
+                              getField @"named_outer_inner_field" x_0)
+instance (~) ty Named_inner =>
+         HasField "named_outer_inner_field" (Ptr Named_outer) (Ptr ty)
+    where getField = fromPtr (Proxy @"named_outer_inner_field")
+instance HasCField Named_outer "named_outer_inner_field"
+    where type CFieldType Named_outer
+                          "named_outer_inner_field" = Named_inner
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "named_outer_nz" Named_outer ty
+    where hasField = \x_0 -> (\y_1 -> Named_outer{named_outer_nz = y_1,
+                                                  named_outer_inner_field = getField @"named_outer_inner_field" x_0},
+                              getField @"named_outer_nz" x_0)
+instance (~) ty CInt =>
+         HasField "named_outer_nz" (Ptr Named_outer) (Ptr ty)
+    where getField = fromPtr (Proxy @"named_outer_nz")
+instance HasCField Named_outer "named_outer_nz"
+    where type CFieldType Named_outer "named_outer_nz" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct \@deep_mid_untagged_field@
+
+    __defined at:__ @documentation\/doxygen_docs.h 629:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Deep_mid_untagged_field
+    = Deep_mid_untagged_field {deep_mid_untagged_field_deep_a :: CInt
+                               {- ^ Deep field
+
+                                    __C declaration:__ @deep_a@
+
+                                    __defined at:__ @documentation\/doxygen_docs.h 631:17@
+
+                                    __exported by:__ @documentation\/doxygen_docs.h@
+                               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Deep_mid_untagged_field
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Deep_mid_untagged_field
+    where readRaw = \ptr_0 -> pure Deep_mid_untagged_field <*> readRaw (Proxy @"deep_mid_untagged_field_deep_a") ptr_0
+instance WriteRaw Deep_mid_untagged_field
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Deep_mid_untagged_field deep_mid_untagged_field_deep_a_2 -> writeRaw (Proxy @"deep_mid_untagged_field_deep_a") ptr_0 deep_mid_untagged_field_deep_a_2
+deriving via (EquivStorable Deep_mid_untagged_field) instance Storable Deep_mid_untagged_field
+deriving via (IsStructViaReadRaw Deep_mid_untagged_field) instance IsStruct Deep_mid_untagged_field
+instance (~) ty CInt =>
+         HasField "deep_mid_untagged_field_deep_a"
+                  Deep_mid_untagged_field
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Deep_mid_untagged_field{deep_mid_untagged_field_deep_a = y_1},
+                              getField @"deep_mid_untagged_field_deep_a" x_0)
+instance (~) ty CInt =>
+         HasField "deep_mid_untagged_field_deep_a"
+                  (Ptr Deep_mid_untagged_field)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"deep_mid_untagged_field_deep_a")
+instance HasCField Deep_mid_untagged_field
+                   "deep_mid_untagged_field_deep_a"
+    where type CFieldType Deep_mid_untagged_field
+                          "deep_mid_untagged_field_deep_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| The named mid-level struct
+
+    __C declaration:__ @struct deep_mid@
+
+    __defined at:__ @documentation\/doxygen_docs.h 625:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Deep_mid
+    = Deep_mid {deep_mid_m :: CInt
+                {- ^ Mid-level field
+
+                     __C declaration:__ @m@
+
+                     __defined at:__ @documentation\/doxygen_docs.h 627:13@
+
+                     __exported by:__ @documentation\/doxygen_docs.h@
+                -},
+                deep_mid_untagged_field :: Deep_mid_untagged_field
+                {- ^ Untagged struct inside named mid
+
+                     __C declaration:__ @untagged_field@
+
+                     __defined at:__ @documentation\/doxygen_docs.h 632:11@
+
+                     __exported by:__ @documentation\/doxygen_docs.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Deep_mid
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Deep_mid
+    where readRaw = \ptr_0 -> (pure Deep_mid <*> readRaw (Proxy @"deep_mid_m") ptr_0) <*> readRaw (Proxy @"deep_mid_untagged_field") ptr_0
+instance WriteRaw Deep_mid
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Deep_mid deep_mid_m_2
+                                                deep_mid_untagged_field_3 -> writeRaw (Proxy @"deep_mid_m") ptr_0 deep_mid_m_2 >> writeRaw (Proxy @"deep_mid_untagged_field") ptr_0 deep_mid_untagged_field_3
+deriving via (EquivStorable Deep_mid) instance Storable Deep_mid
+deriving via (IsStructViaReadRaw Deep_mid) instance IsStruct Deep_mid
+instance (~) ty CInt => HasField "deep_mid_m" Deep_mid ty
+    where hasField = \x_0 -> (\y_1 -> Deep_mid{deep_mid_m = y_1,
+                                               deep_mid_untagged_field = getField @"deep_mid_untagged_field" x_0},
+                              getField @"deep_mid_m" x_0)
+instance (~) ty CInt =>
+         HasField "deep_mid_m" (Ptr Deep_mid) (Ptr ty)
+    where getField = fromPtr (Proxy @"deep_mid_m")
+instance HasCField Deep_mid "deep_mid_m"
+    where type CFieldType Deep_mid "deep_mid_m" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty Deep_mid_untagged_field =>
+         HasField "deep_mid_untagged_field" Deep_mid ty
+    where hasField = \x_0 -> (\y_1 -> Deep_mid{deep_mid_untagged_field = y_1,
+                                               deep_mid_m = getField @"deep_mid_m" x_0},
+                              getField @"deep_mid_untagged_field" x_0)
+instance (~) ty Deep_mid_untagged_field =>
+         HasField "deep_mid_untagged_field" (Ptr Deep_mid) (Ptr ty)
+    where getField = fromPtr (Proxy @"deep_mid_untagged_field")
+instance HasCField Deep_mid "deep_mid_untagged_field"
+    where type CFieldType Deep_mid
+                          "deep_mid_untagged_field" = Deep_mid_untagged_field
+          offset# = \_ -> \_ -> 4
+{-| Deeply nested mix of tagged and untagged structs.
+
+    Tests the full genealogy walk through mixed tagged/untagged nesting.
+
+    __C declaration:__ @struct deep_outer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 623:8@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Deep_outer
+    = Deep_outer {deep_outer_mid_field :: Deep_mid
+                  {- ^ __C declaration:__ @mid_field@
+
+                       __defined at:__ @documentation\/doxygen_docs.h 633:7@
+
+                       __exported by:__ @documentation\/doxygen_docs.h@
+                  -},
+                  deep_outer_o :: CInt
+                  {- ^ Outer-only field
+
+                       __C declaration:__ @o@
+
+                       __defined at:__ @documentation\/doxygen_docs.h 635:9@
+
+                       __exported by:__ @documentation\/doxygen_docs.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Deep_outer
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Deep_outer
+    where readRaw = \ptr_0 -> (pure Deep_outer <*> readRaw (Proxy @"deep_outer_mid_field") ptr_0) <*> readRaw (Proxy @"deep_outer_o") ptr_0
+instance WriteRaw Deep_outer
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Deep_outer deep_outer_mid_field_2
+                                                  deep_outer_o_3 -> writeRaw (Proxy @"deep_outer_mid_field") ptr_0 deep_outer_mid_field_2 >> writeRaw (Proxy @"deep_outer_o") ptr_0 deep_outer_o_3
+deriving via (EquivStorable Deep_outer) instance Storable Deep_outer
+deriving via (IsStructViaReadRaw Deep_outer) instance IsStruct Deep_outer
+instance (~) ty Deep_mid =>
+         HasField "deep_outer_mid_field" Deep_outer ty
+    where hasField = \x_0 -> (\y_1 -> Deep_outer{deep_outer_mid_field = y_1,
+                                                 deep_outer_o = getField @"deep_outer_o" x_0},
+                              getField @"deep_outer_mid_field" x_0)
+instance (~) ty Deep_mid =>
+         HasField "deep_outer_mid_field" (Ptr Deep_outer) (Ptr ty)
+    where getField = fromPtr (Proxy @"deep_outer_mid_field")
+instance HasCField Deep_outer "deep_outer_mid_field"
+    where type CFieldType Deep_outer "deep_outer_mid_field" = Deep_mid
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "deep_outer_o" Deep_outer ty
+    where hasField = \x_0 -> (\y_1 -> Deep_outer{deep_outer_o = y_1,
+                                                 deep_outer_mid_field = getField @"deep_outer_mid_field" x_0},
+                              getField @"deep_outer_o" x_0)
+instance (~) ty CInt =>
+         HasField "deep_outer_o" (Ptr Deep_outer) (Ptr ty)
+    where getField = fromPtr (Proxy @"deep_outer_o")
+instance HasCField Deep_outer "deep_outer_o"
+    where type CFieldType Deep_outer "deep_outer_o" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct \@unnamed_field_t_anon\'ua@
+
+    __defined at:__ @documentation\/doxygen_docs.h 647:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Unnamed_field_t_anon'ua
+    = Unnamed_field_t_anon'ua {unnamed_field_t_anon'ua_ua :: CInt
+                               {- ^ Unnamed inner a
+
+                                    __C declaration:__ @ua@
+
+                                    __defined at:__ @documentation\/doxygen_docs.h 649:13@
+
+                                    __exported by:__ @documentation\/doxygen_docs.h@
+                               -},
+                               unnamed_field_t_anon'ua_ub :: CInt
+                               {- ^ Unnamed inner b
+
+                                    __C declaration:__ @ub@
+
+                                    __defined at:__ @documentation\/doxygen_docs.h 651:13@
+
+                                    __exported by:__ @documentation\/doxygen_docs.h@
+                               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unnamed_field_t_anon'ua
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Unnamed_field_t_anon'ua
+    where readRaw = \ptr_0 -> (pure Unnamed_field_t_anon'ua <*> readRaw (Proxy @"unnamed_field_t_anon'ua_ua") ptr_0) <*> readRaw (Proxy @"unnamed_field_t_anon'ua_ub") ptr_0
+instance WriteRaw Unnamed_field_t_anon'ua
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unnamed_field_t_anon'ua unnamed_field_t_anon'ua_ua_2
+                                                               unnamed_field_t_anon'ua_ub_3 -> writeRaw (Proxy @"unnamed_field_t_anon'ua_ua") ptr_0 unnamed_field_t_anon'ua_ua_2 >> writeRaw (Proxy @"unnamed_field_t_anon'ua_ub") ptr_0 unnamed_field_t_anon'ua_ub_3
+deriving via (EquivStorable Unnamed_field_t_anon'ua) instance Storable Unnamed_field_t_anon'ua
+deriving via (IsStructViaReadRaw Unnamed_field_t_anon'ua) instance IsStruct Unnamed_field_t_anon'ua
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_anon'ua_ua" Unnamed_field_t_anon'ua ty
+    where hasField = \x_0 -> (\y_1 -> Unnamed_field_t_anon'ua{unnamed_field_t_anon'ua_ua = y_1,
+                                                              unnamed_field_t_anon'ua_ub = getField @"unnamed_field_t_anon'ua_ub" x_0},
+                              getField @"unnamed_field_t_anon'ua_ua" x_0)
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_anon'ua_ua"
+                  (Ptr Unnamed_field_t_anon'ua)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unnamed_field_t_anon'ua_ua")
+instance HasCField Unnamed_field_t_anon'ua
+                   "unnamed_field_t_anon'ua_ua"
+    where type CFieldType Unnamed_field_t_anon'ua
+                          "unnamed_field_t_anon'ua_ua" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_anon'ua_ub" Unnamed_field_t_anon'ua ty
+    where hasField = \x_0 -> (\y_1 -> Unnamed_field_t_anon'ua{unnamed_field_t_anon'ua_ub = y_1,
+                                                              unnamed_field_t_anon'ua_ua = getField @"unnamed_field_t_anon'ua_ua" x_0},
+                              getField @"unnamed_field_t_anon'ua_ub" x_0)
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_anon'ua_ub"
+                  (Ptr Unnamed_field_t_anon'ua)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unnamed_field_t_anon'ua_ub")
+instance HasCField Unnamed_field_t_anon'ua
+                   "unnamed_field_t_anon'ua_ub"
+    where type CFieldType Unnamed_field_t_anon'ua
+                          "unnamed_field_t_anon'ua_ub" = CInt
+          offset# = \_ -> \_ -> 4
+{-| Struct with anonymous struct.
+
+    Tests the case where the inner struct is anonymous: no struct tag and no field name. The inner fields are flattened directly into the parent.
+
+    __C declaration:__ @struct unnamed_field_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 644:9@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+data Unnamed_field_t
+    = Unnamed_field_t {unnamed_field_t_before :: CInt
+                       {- ^ Before field
+
+                            __C declaration:__ @before@
+
+                            __defined at:__ @documentation\/doxygen_docs.h 646:9@
+
+                            __exported by:__ @documentation\/doxygen_docs.h@
+                       -},
+                       unnamed_field_t_anon'ua :: Unnamed_field_t_anon'ua
+                       {- ^ __C declaration:__ @anon\'ua@
+
+                            __defined at:__ @documentation\/doxygen_docs.h 647:5@
+
+                            __exported by:__ @documentation\/doxygen_docs.h@
+                       -},
+                       unnamed_field_t_after :: CInt
+                       {- ^ After field
+
+                            __C declaration:__ @after@
+
+                            __defined at:__ @documentation\/doxygen_docs.h 654:9@
+
+                            __exported by:__ @documentation\/doxygen_docs.h@
+                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Unnamed_field_t
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Unnamed_field_t
+    where readRaw = \ptr_0 -> ((pure Unnamed_field_t <*> readRaw (Proxy @"unnamed_field_t_before") ptr_0) <*> readRaw (Proxy @"unnamed_field_t_anon'ua") ptr_0) <*> readRaw (Proxy @"unnamed_field_t_after") ptr_0
+instance WriteRaw Unnamed_field_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Unnamed_field_t unnamed_field_t_before_2
+                                                       unnamed_field_t_anon'ua_3
+                                                       unnamed_field_t_after_4 -> writeRaw (Proxy @"unnamed_field_t_before") ptr_0 unnamed_field_t_before_2 >> (writeRaw (Proxy @"unnamed_field_t_anon'ua") ptr_0 unnamed_field_t_anon'ua_3 >> writeRaw (Proxy @"unnamed_field_t_after") ptr_0 unnamed_field_t_after_4)
+deriving via (EquivStorable Unnamed_field_t) instance Storable Unnamed_field_t
+deriving via (IsStructViaReadRaw Unnamed_field_t) instance IsStruct Unnamed_field_t
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_before" Unnamed_field_t ty
+    where hasField = \x_0 -> (\y_1 -> Unnamed_field_t{unnamed_field_t_before = y_1,
+                                                      unnamed_field_t_anon'ua = getField @"unnamed_field_t_anon'ua" x_0,
+                                                      unnamed_field_t_after = getField @"unnamed_field_t_after" x_0},
+                              getField @"unnamed_field_t_before" x_0)
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_before" (Ptr Unnamed_field_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unnamed_field_t_before")
+instance HasCField Unnamed_field_t "unnamed_field_t_before"
+    where type CFieldType Unnamed_field_t
+                          "unnamed_field_t_before" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty Unnamed_field_t_anon'ua =>
+         HasField "unnamed_field_t_anon'ua" Unnamed_field_t ty
+    where hasField = \x_0 -> (\y_1 -> Unnamed_field_t{unnamed_field_t_anon'ua = y_1,
+                                                      unnamed_field_t_before = getField @"unnamed_field_t_before" x_0,
+                                                      unnamed_field_t_after = getField @"unnamed_field_t_after" x_0},
+                              getField @"unnamed_field_t_anon'ua" x_0)
+instance (~) ty Unnamed_field_t_anon'ua =>
+         HasField "unnamed_field_t_anon'ua" (Ptr Unnamed_field_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unnamed_field_t_anon'ua")
+instance HasCField Unnamed_field_t "unnamed_field_t_anon'ua"
+    where type CFieldType Unnamed_field_t
+                          "unnamed_field_t_anon'ua" = Unnamed_field_t_anon'ua
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_ua" Unnamed_field_t ty
+    where getField = \x_0 -> getField @"unnamed_field_t_anon'ua_ua" (getField @"unnamed_field_t_anon'ua" x_0)
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_ua" Unnamed_field_t ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"unnamed_field_t_anon'ua" x_0 (\z_2 -> setField @"unnamed_field_t_anon'ua_ua" z_2 y_1),
+                              getField @"unnamed_field_t_ua" x_0)
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_ua" (Ptr Unnamed_field_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unnamed_field_t_ua")
+instance HasCField Unnamed_field_t "unnamed_field_t_ua"
+    where type CFieldType Unnamed_field_t "unnamed_field_t_ua" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_ub" Unnamed_field_t ty
+    where getField = \x_0 -> getField @"unnamed_field_t_anon'ua_ub" (getField @"unnamed_field_t_anon'ua" x_0)
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_ub" Unnamed_field_t ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"unnamed_field_t_anon'ua" x_0 (\z_2 -> setField @"unnamed_field_t_anon'ua_ub" z_2 y_1),
+                              getField @"unnamed_field_t_ub" x_0)
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_ub" (Ptr Unnamed_field_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unnamed_field_t_ub")
+instance HasCField Unnamed_field_t "unnamed_field_t_ub"
+    where type CFieldType Unnamed_field_t "unnamed_field_t_ub" = CInt
+          offset# = \_ -> \_ -> 8
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_after" Unnamed_field_t ty
+    where hasField = \x_0 -> (\y_1 -> Unnamed_field_t{unnamed_field_t_after = y_1,
+                                                      unnamed_field_t_before = getField @"unnamed_field_t_before" x_0,
+                                                      unnamed_field_t_anon'ua = getField @"unnamed_field_t_anon'ua" x_0},
+                              getField @"unnamed_field_t_after" x_0)
+instance (~) ty CInt =>
+         HasField "unnamed_field_t_after" (Ptr Unnamed_field_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unnamed_field_t_after")
+instance HasCField Unnamed_field_t "unnamed_field_t_after"
+    where type CFieldType Unnamed_field_t
+                          "unnamed_field_t_after" = CInt
+          offset# = \_ -> \_ -> 12
+{-| API version number (not in any group).
+
+    __C declaration:__ @api_version_t@
+
+    __defined at:__ @documentation\/doxygen_docs.h 662:13@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+newtype Api_version_t
+    = Api_version_t {unwrapApi_version_t :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapApi_version_t" Api_version_t ty
+    where hasField = \x_0 -> (\y_1 -> Api_version_t{unwrapApi_version_t = y_1},
+                              getField @"unwrapApi_version_t" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapApi_version_t" (Ptr Api_version_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapApi_version_t")
+instance HasCField Api_version_t "unwrapApi_version_t"
+    where type CFieldType Api_version_t "unwrapApi_version_t" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_data@
+foreign import ccall safe "hs_bindgen_7eada9f65d982412" hs_bindgen_7eada9f65d982412_base ::
+    Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_data@
+hs_bindgen_7eada9f65d982412 :: PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                               Ptr HsBindgen.Runtime.LibC.Word8 ->
+                               Ptr HsBindgen.Runtime.LibC.CSize -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_data@
+hs_bindgen_7eada9f65d982412 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_7eada9f65d982412_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Function with detailed parameter documentation.
+
+    This function shows different parameter directions and types.
+
+    [__@input_data@ /(input)/__]: Input data buffer
+
+    [__@output_data@ /(output)/__]: Output data buffer
+
+    [__@size@ /(input,output)/__]: Size of data, updated on return
+
+    __Returns:__ Status code (0 = success, -1 = error)
+
+    __C declaration:__ @process_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 111:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_data_safe :: PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                     Ptr HsBindgen.Runtime.LibC.Word8 ->
+                     Ptr HsBindgen.Runtime.LibC.CSize -> IO CInt
+{-| Function with detailed parameter documentation.
+
+    This function shows different parameter directions and types.
+
+    [__@input_data@ /(input)/__]: Input data buffer
+
+    [__@output_data@ /(output)/__]: Output data buffer
+
+    [__@size@ /(input,output)/__]: Size of data, updated on return
+
+    __Returns:__ Status code (0 = success, -1 = error)
+
+    __C declaration:__ @process_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 111:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_data_safe = hs_bindgen_7eada9f65d982412
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_file@
+foreign import ccall safe "hs_bindgen_fb85499c501da1a7" hs_bindgen_fb85499c501da1a7_base ::
+    Ptr Void
+ -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_file@
+hs_bindgen_fb85499c501da1a7 :: PtrConst CChar -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_file@
+hs_bindgen_fb85499c501da1a7 = \x_0 -> fmap fromFFIType (hs_bindgen_fb85499c501da1a7_base (toFFIType x_0))
+{-| Function with inline commands and formatting.
+
+    This function uses @inline@ @code@ formatting and __bold__ text. It also demonstrates /emphasized/ text.
+
+    [__@filename@__]: The @char*@ filename to process
+
+    __Returns:__ @true@ if successful, @false@ otherwise
+
+    __C declaration:__ @process_file@
+
+    __defined at:__ @documentation\/doxygen_docs.h 122:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_file_safe :: PtrConst CChar -> IO CBool
+{-| Function with inline commands and formatting.
+
+    This function uses @inline@ @code@ formatting and __bold__ text. It also demonstrates /emphasized/ text.
+
+    [__@filename@__]: The @char*@ filename to process
+
+    __Returns:__ @true@ if successful, @false@ otherwise
+
+    __C declaration:__ @process_file@
+
+    __defined at:__ @documentation\/doxygen_docs.h 122:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_file_safe = hs_bindgen_fb85499c501da1a7
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_calculate_value@
+foreign import ccall safe "hs_bindgen_a73fc7b108035c5c" hs_bindgen_a73fc7b108035c5c_base ::
+    CInt
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_calculate_value@
+hs_bindgen_a73fc7b108035c5c :: CInt -> CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_calculate_value@
+hs_bindgen_a73fc7b108035c5c = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_a73fc7b108035c5c_base (toFFIType x_0) (toFFIType x_1))
+{-| Function with verbatim code blocks.
+
+    Example usage:
+
+    @
+    int result = calculate_value(10, 20);
+    printf("Result: %d\n", result);
+    @
+
+    [__@base@__]: Base value
+
+    [__@multiplier@__]: Multiplier value
+
+    __Returns:__ Calculated result
+
+    __C declaration:__ @calculate_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 137:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+calculate_value_safe :: CInt -> CInt -> IO CInt
+{-| Function with verbatim code blocks.
+
+    Example usage:
+
+    @
+    int result = calculate_value(10, 20);
+    printf("Result: %d\n", result);
+    @
+
+    [__@base@__]: Base value
+
+    [__@multiplier@__]: Multiplier value
+
+    __Returns:__ Calculated result
+
+    __C declaration:__ @calculate_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 137:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+calculate_value_safe = hs_bindgen_a73fc7b108035c5c
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_example@
+foreign import ccall safe "hs_bindgen_9b7f6745401b4652" hs_bindgen_9b7f6745401b4652_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_example@
+hs_bindgen_9b7f6745401b4652 :: CInt -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_example@
+hs_bindgen_9b7f6745401b4652 = \x_0 -> fmap fromFFIType (hs_bindgen_9b7f6745401b4652_base (toFFIType x_0))
+{-| Function with HTML formatting.
+
+    This function demonstrates __HTML bold__ and /italic/ text. It also shows @HTML code@ formatting.
+
+    Input
+
+    Output
+
+    0
+
+    false
+
+    1
+
+    true
+
+    [__@value@__]: Input value
+
+    __Returns:__ Boolean result
+
+    __C declaration:__ @html_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 154:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_example_safe :: CInt -> IO CBool
+{-| Function with HTML formatting.
+
+    This function demonstrates __HTML bold__ and /italic/ text. It also shows @HTML code@ formatting.
+
+    Input
+
+    Output
+
+    0
+
+    false
+
+    1
+
+    true
+
+    [__@value@__]: Input value
+
+    __Returns:__ Boolean result
+
+    __C declaration:__ @html_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 154:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_example_safe = hs_bindgen_9b7f6745401b4652
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_list_example@
+foreign import ccall safe "hs_bindgen_825411dc114e599b" hs_bindgen_825411dc114e599b_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_list_example@
+hs_bindgen_825411dc114e599b :: Ptr (PtrConst CChar) ->
+                               HsBindgen.Runtime.LibC.CSize -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_list_example@
+hs_bindgen_825411dc114e599b = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_825411dc114e599b_base (toFFIType x_0) (toFFIType x_1))
+{-| Function with lists and special formatting.
+
+    This function demonstrates:
+
+    * Bullet point lists
+      * Nested list item 1
+      * Nested list item 2
+
+    * Multiple items
+
+    * Nested formatting
+
+    Numbered list:
+
+    1. First @item@ 1. item
+
+    2. Second __item__
+
+    3. Third item
+
+    Other numbered list:
+
+    1. A
+
+    2. B
+
+    3. C
+
+    [__@items@__]: Array of items
+
+    [__@count@__]: Number of items
+
+    __Returns:__ Success status
+
+    __C declaration:__ @list_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 180:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+list_example_safe :: Ptr (PtrConst CChar) ->
+                     HsBindgen.Runtime.LibC.CSize -> IO CBool
+{-| Function with lists and special formatting.
+
+    This function demonstrates:
+
+    * Bullet point lists
+      * Nested list item 1
+      * Nested list item 2
+
+    * Multiple items
+
+    * Nested formatting
+
+    Numbered list:
+
+    1. First @item@ 1. item
+
+    2. Second __item__
+
+    3. Third item
+
+    Other numbered list:
+
+    1. A
+
+    2. B
+
+    3. C
+
+    [__@items@__]: Array of items
+
+    [__@count@__]: Number of items
+
+    __Returns:__ Success status
+
+    __C declaration:__ @list_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 180:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+list_example_safe = hs_bindgen_825411dc114e599b
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_dangerous_function@
+foreign import ccall safe "hs_bindgen_17264dcff7e9b698" hs_bindgen_17264dcff7e9b698_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_dangerous_function@
+hs_bindgen_17264dcff7e9b698 :: Ptr Void -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_dangerous_function@
+hs_bindgen_17264dcff7e9b698 = \x_0 -> fmap fromFFIType (hs_bindgen_17264dcff7e9b698_base (toFFIType x_0))
+{-| Function with warnings and notes.
+
+    __WARNING:__ This function may cause side effects
+
+    __Note:__ Use with caution in multithreaded environments
+
+    __See:__ related_function() for similar functionality
+
+    [__@ptr@__]: Pointer to data
+
+    __Returns:__ Modified pointer
+
+    __C declaration:__ @dangerous_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 192:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+dangerous_function_safe :: Ptr Void -> IO (Ptr Void)
+{-| Function with warnings and notes.
+
+    __WARNING:__ This function may cause side effects
+
+    __Note:__ Use with caution in multithreaded environments
+
+    __See:__ related_function() for similar functionality
+
+    [__@ptr@__]: Pointer to data
+
+    __Returns:__ Modified pointer
+
+    __C declaration:__ @dangerous_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 192:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+dangerous_function_safe = hs_bindgen_17264dcff7e9b698
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_detailed_return_codes@
+foreign import ccall safe "hs_bindgen_c8ca619ec2e70d8d" hs_bindgen_c8ca619ec2e70d8d_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_detailed_return_codes@
+hs_bindgen_c8ca619ec2e70d8d :: PtrConst CChar -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_detailed_return_codes@
+hs_bindgen_c8ca619ec2e70d8d = \x_0 -> fmap fromFFIType (hs_bindgen_c8ca619ec2e70d8d_base (toFFIType x_0))
+{-| Function with return value details.
+
+    [__@input@__]: Input string
+
+    [__@0@__]: Success
+
+    [__@-1@__]: Invalid input
+
+    [__@-2@__]: Memory allocation failed
+
+    [__@-3@__]: Processing error
+
+    __C declaration:__ @detailed_return_codes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 203:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+detailed_return_codes_safe :: PtrConst CChar -> IO CInt
+{-| Function with return value details.
+
+    [__@input@__]: Input string
+
+    [__@0@__]: Success
+
+    [__@-1@__]: Invalid input
+
+    [__@-2@__]: Memory allocation failed
+
+    [__@-3@__]: Processing error
+
+    __C declaration:__ @detailed_return_codes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 203:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+detailed_return_codes_safe = hs_bindgen_c8ca619ec2e70d8d
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_old_function@
+foreign import ccall safe "hs_bindgen_25e1070e2ce10048" hs_bindgen_25e1070e2ce10048_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_old_function@
+hs_bindgen_25e1070e2ce10048 :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_old_function@
+hs_bindgen_25e1070e2ce10048 = \x_0 -> fmap fromFFIType (hs_bindgen_25e1070e2ce10048_base (toFFIType x_0))
+{-| Function with deprecated annotation.
+
+    __Deprecated:__ Use new_function() instead
+
+    [__@old_param@__]: Legacy parameter
+
+    __Returns:__ Legacy result
+
+    __C declaration:__ @old_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 212:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+old_function_safe :: CInt -> IO CInt
+{-| Function with deprecated annotation.
+
+    __Deprecated:__ Use new_function() instead
+
+    [__@old_param@__]: Legacy parameter
+
+    __Returns:__ Legacy result
+
+    __C declaration:__ @old_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 212:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+old_function_safe = hs_bindgen_25e1070e2ce10048
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_versioned_function@
+foreign import ccall safe "hs_bindgen_a9eeeb09808e71cc" hs_bindgen_a9eeeb09808e71cc_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_versioned_function@
+hs_bindgen_a9eeeb09808e71cc :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_versioned_function@
+hs_bindgen_a9eeeb09808e71cc = \x_0 -> fmap fromFFIType (hs_bindgen_a9eeeb09808e71cc_base (toFFIType x_0))
+{-| Function with version information.
+
+    @since 1.0
+
+    __Version:__ 1.2
+
+    [__@data@__]: Input data
+
+    __Returns:__ Processed data
+
+    __C declaration:__ @versioned_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 222:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+versioned_function_safe :: CInt -> IO CInt
+{-| Function with version information.
+
+    @since 1.0
+
+    __Version:__ 1.2
+
+    [__@data@__]: Input data
+
+    __Returns:__ Processed data
+
+    __C declaration:__ @versioned_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 222:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+versioned_function_safe = hs_bindgen_a9eeeb09808e71cc
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_buffer@
+foreign import ccall safe "hs_bindgen_0c0057f1700372a7" hs_bindgen_0c0057f1700372a7_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_buffer@
+hs_bindgen_0c0057f1700372a7 :: Ptr (Elem (ConstantArray 64
+                                                        CChar)) ->
+                               HsBindgen.Runtime.LibC.CSize -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_process_buffer@
+hs_bindgen_0c0057f1700372a7 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_0c0057f1700372a7_base (toFFIType x_0) (toFFIType x_1))
+{-| Static array parameter.
+
+    [__@buffer@__]: Buffer with minimum size
+
+    [__@size@__]: Actual buffer size
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @process_buffer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 338:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_buffer_safe :: Ptr (Elem (ConstantArray 64 CChar)) ->
+                       HsBindgen.Runtime.LibC.CSize -> IO CInt
+{-| Static array parameter.
+
+    [__@buffer@__]: Buffer with minimum size
+
+    [__@size@__]: Actual buffer size
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @process_buffer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 338:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_buffer_safe = hs_bindgen_0c0057f1700372a7
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_my_memcpy@
+foreign import ccall safe "hs_bindgen_294db77671f95524" hs_bindgen_294db77671f95524_base ::
+    Ptr Void
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_my_memcpy@
+hs_bindgen_294db77671f95524 :: Ptr Void ->
+                               PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_my_memcpy@
+hs_bindgen_294db77671f95524 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_294db77671f95524_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Function with restrict pointers.
+
+    [__@dest@__]: Destination buffer (restrict)
+
+    [__@src@__]: Source buffer (restrict)
+
+    [__@n@__]: Number of bytes
+
+    __Returns:__ Destination pointer
+
+    __C declaration:__ @my_memcpy@
+
+    __defined at:__ @documentation\/doxygen_docs.h 348:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+my_memcpy_safe :: Ptr Void ->
+                  PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO (Ptr Void)
+{-| Function with restrict pointers.
+
+    [__@dest@__]: Destination buffer (restrict)
+
+    [__@src@__]: Source buffer (restrict)
+
+    [__@n@__]: Number of bytes
+
+    __Returns:__ Destination pointer
+
+    __C declaration:__ @my_memcpy@
+
+    __defined at:__ @documentation\/doxygen_docs.h 348:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+my_memcpy_safe = hs_bindgen_294db77671f95524
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_double_value@
+foreign import ccall safe "hs_bindgen_f5bc63a9952c2618" hs_bindgen_f5bc63a9952c2618_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_double_value@
+hs_bindgen_f5bc63a9952c2618 :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_double_value@
+hs_bindgen_f5bc63a9952c2618 = \x_0 -> fmap fromFFIType (hs_bindgen_f5bc63a9952c2618_base (toFFIType x_0))
+{-| Inline function.
+
+    [__@x@__]: Input value
+
+    __Returns:__ Doubled value
+
+    __C declaration:__ @double_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 356:19@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+double_value_safe :: CInt -> IO CInt
+{-| Inline function.
+
+    [__@x@__]: Input value
+
+    __Returns:__ Doubled value
+
+    __C declaration:__ @double_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 356:19@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+double_value_safe = hs_bindgen_f5bc63a9952c2618
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_read_chunk@
+foreign import ccall safe "hs_bindgen_3545f99d29c4fc53" hs_bindgen_3545f99d29c4fc53_base ::
+    CInt
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_read_chunk@
+hs_bindgen_3545f99d29c4fc53 :: CInt ->
+                               Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_read_chunk@
+hs_bindgen_3545f99d29c4fc53 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_3545f99d29c4fc53_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Read a chunk of bytes into the provided buffer.
+
+    Demonstrates a section nested inside @functions@ .
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Output buffer
+
+    [__@count@__]: Number of bytes to read
+
+    __Returns:__ Number of bytes read
+
+    __C declaration:__ @read_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 387:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+read_chunk_safe :: CInt ->
+                   Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt
+{-| Read a chunk of bytes into the provided buffer.
+
+    Demonstrates a section nested inside @functions@ .
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Output buffer
+
+    [__@count@__]: Number of bytes to read
+
+    __Returns:__ Number of bytes read
+
+    __C declaration:__ @read_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 387:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+read_chunk_safe = hs_bindgen_3545f99d29c4fc53
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_write_chunk@
+foreign import ccall safe "hs_bindgen_839c1d19dfe95042" hs_bindgen_839c1d19dfe95042_base ::
+    CInt
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_write_chunk@
+hs_bindgen_839c1d19dfe95042 :: CInt ->
+                               PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_write_chunk@
+hs_bindgen_839c1d19dfe95042 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_839c1d19dfe95042_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Write a chunk of bytes from the provided buffer.
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Input buffer
+
+    [__@count@__]: Number of bytes to write
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @write_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 397:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+write_chunk_safe :: CInt ->
+                    PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt
+{-| Write a chunk of bytes from the provided buffer.
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Input buffer
+
+    [__@count@__]: Number of bytes to write
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @write_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 397:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+write_chunk_safe = hs_bindgen_839c1d19dfe95042
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_complex_function@
+foreign import ccall safe "hs_bindgen_c4e7e99dba20204d" hs_bindgen_c4e7e99dba20204d_base ::
+    Ptr Void
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_complex_function@
+hs_bindgen_c4e7e99dba20204d :: Ptr Config_t ->
+                               PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                               HsBindgen.Runtime.LibC.CSize -> IO Status_code_t
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_complex_function@
+hs_bindgen_c4e7e99dba20204d = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_c4e7e99dba20204d_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Function with complex documentation.
+
+    This function demonstrates multiple documentation features:
+
+    __Description:__
+
+    Performs complex data processing with multiple steps.
+
+    __Algorithm:__
+
+    1. Validate input parameters
+
+    2. Allocate temporary buffers
+
+    3. Process data in chunks
+
+    4. Clean up resources
+
+    __Algorithm2:__
+
+    * Validate input parameters
+
+    * Allocate temporary buffers
+
+    * Process data in chunks
+
+    * Clean up resources
+
+    __Example:__
+
+    @
+    config_t cfg = {
+        .id = 1,
+        .name = "test",
+        .flags = 0,
+        .callback = my_callback,
+        .user_data = NULL
+    };
+
+    status_code_t result = complex_function(&cfg, data, size);
+    if (result != STATUS_OK) {
+        handle_error(result);
+    }
+    @
+
+    [__@config@__]: Configuration structure (see 'Config_t' )
+
+    [__@data@__]: Input data buffer
+
+    [__@size@__]: Size of input data
+
+    __Returns:__ Status code indicating success or failure
+
+    __Precondition:__ config must not be NULL
+
+    __Precondition:__ data must not be NULL if size > 0
+
+    __Postcondition:__ Output data is written to config->user_data
+
+    __WARNING:__ May return NULL if memory allocation fails
+
+    __WARNING:__ Sets errno to EINVAL if parameters are invalid
+
+    __C declaration:__ @complex_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 459:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+complex_function_safe :: Ptr Config_t ->
+                         PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                         HsBindgen.Runtime.LibC.CSize -> IO Status_code_t
+{-| Function with complex documentation.
+
+    This function demonstrates multiple documentation features:
+
+    __Description:__
+
+    Performs complex data processing with multiple steps.
+
+    __Algorithm:__
+
+    1. Validate input parameters
+
+    2. Allocate temporary buffers
+
+    3. Process data in chunks
+
+    4. Clean up resources
+
+    __Algorithm2:__
+
+    * Validate input parameters
+
+    * Allocate temporary buffers
+
+    * Process data in chunks
+
+    * Clean up resources
+
+    __Example:__
+
+    @
+    config_t cfg = {
+        .id = 1,
+        .name = "test",
+        .flags = 0,
+        .callback = my_callback,
+        .user_data = NULL
+    };
+
+    status_code_t result = complex_function(&cfg, data, size);
+    if (result != STATUS_OK) {
+        handle_error(result);
+    }
+    @
+
+    [__@config@__]: Configuration structure (see 'Config_t' )
+
+    [__@data@__]: Input data buffer
+
+    [__@size@__]: Size of input data
+
+    __Returns:__ Status code indicating success or failure
+
+    __Precondition:__ config must not be NULL
+
+    __Precondition:__ data must not be NULL if size > 0
+
+    __Postcondition:__ Output data is written to config->user_data
+
+    __WARNING:__ May return NULL if memory allocation fails
+
+    __WARNING:__ Sets errno to EINVAL if parameters are invalid
+
+    __C declaration:__ @complex_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 459:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+complex_function_safe = hs_bindgen_c4e7e99dba20204d
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_hash@
+foreign import ccall safe "hs_bindgen_935f2aead358d9ef" hs_bindgen_935f2aead358d9ef_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_hash@
+hs_bindgen_935f2aead358d9ef :: Ptr CChar -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_hash@
+hs_bindgen_935f2aead358d9ef = \x_0 -> fmap fromFFIType (hs_bindgen_935f2aead358d9ef_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @documentation\/doxygen_docs.h 463:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+hash_safe :: Ptr CChar -> IO CInt
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @documentation\/doxygen_docs.h 463:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+hash_safe = hs_bindgen_935f2aead358d9ef
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_square@
+foreign import ccall safe "hs_bindgen_39fef54c23d4e1ee" hs_bindgen_39fef54c23d4e1ee_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_square@
+hs_bindgen_39fef54c23d4e1ee :: CInt -> CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_square@
+hs_bindgen_39fef54c23d4e1ee = \x_0 -> fromFFIType (hs_bindgen_39fef54c23d4e1ee_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @documentation\/doxygen_docs.h 465:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+square_safe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @documentation\/doxygen_docs.h 465:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+square_safe = hs_bindgen_39fef54c23d4e1ee
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_auto_brief_func@
+foreign import ccall safe "hs_bindgen_29749932a4449f10" hs_bindgen_29749932a4449f10_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_auto_brief_func@
+hs_bindgen_29749932a4449f10 :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_auto_brief_func@
+hs_bindgen_29749932a4449f10 = \x_0 -> fmap fromFFIType (hs_bindgen_29749932a4449f10_base (toFFIType x_0))
+{-| Auto-brief function without explicit @brief tag.
+
+    This tests that the first sentence is used as the brief description when no explicit @brief is present.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The negated value
+
+    __C declaration:__ @auto_brief_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 486:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+auto_brief_func_safe :: CInt -> IO CInt
+{-| Auto-brief function without explicit @brief tag.
+
+    This tests that the first sentence is used as the brief description when no explicit @brief is present.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The negated value
+
+    __C declaration:__ @auto_brief_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 486:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+auto_brief_func_safe = hs_bindgen_29749932a4449f10
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_multi_paragraph_details@
+foreign import ccall safe "hs_bindgen_03f0269c9296b8c0" hs_bindgen_03f0269c9296b8c0_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_multi_paragraph_details@
+hs_bindgen_03f0269c9296b8c0 :: Ptr CChar ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_multi_paragraph_details@
+hs_bindgen_03f0269c9296b8c0 = \x_0 -> \x_1 -> hs_bindgen_03f0269c9296b8c0_base (toFFIType x_0) (toFFIType x_1)
+{-| Multi-paragraph details.
+
+    First paragraph of the detailed description. This explains the basic purpose of the function.
+
+    Second paragraph with more context. This includes information about the algorithm and its complexity, which is O(n) in the input size.
+
+    Third paragraph with usage notes. Callers should ensure that the buffer is large enough before calling this function.
+
+    [__@buf@__]: Output buffer
+
+    [__@len@__]: Buffer length
+
+    __C declaration:__ @multi_paragraph_details@
+
+    __defined at:__ @documentation\/doxygen_docs.h 503:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+multi_paragraph_details_safe :: Ptr CChar ->
+                                HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| Multi-paragraph details.
+
+    First paragraph of the detailed description. This explains the basic purpose of the function.
+
+    Second paragraph with more context. This includes information about the algorithm and its complexity, which is O(n) in the input size.
+
+    Third paragraph with usage notes. Callers should ensure that the buffer is large enough before calling this function.
+
+    [__@buf@__]: Output buffer
+
+    [__@len@__]: Buffer length
+
+    __C declaration:__ @multi_paragraph_details@
+
+    __defined at:__ @documentation\/doxygen_docs.h 503:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+multi_paragraph_details_safe = hs_bindgen_03f0269c9296b8c0
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_todo_remark_attention@
+foreign import ccall safe "hs_bindgen_0446a821eb966f46" hs_bindgen_0446a821eb966f46_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_todo_remark_attention@
+hs_bindgen_0446a821eb966f46 :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_todo_remark_attention@
+hs_bindgen_0446a821eb966f46 = \x_0 -> fmap fromFFIType (hs_bindgen_0446a821eb966f46_base (toFFIType x_0))
+{-| Function with @todo and @remark.
+
+    __Todo:__ Optimize this function for large inputs
+
+    Add support for negative values
+
+    __Remark:__ This function is thread-safe
+
+    __ATTENTION:__ The caller must free the returned pointer
+
+    [__@n@__]: Input count
+
+    __Returns:__ Allocated array
+
+    __C declaration:__ @todo_remark_attention@
+
+    __defined at:__ @documentation\/doxygen_docs.h 516:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+todo_remark_attention_safe :: CInt -> IO (Ptr CInt)
+{-| Function with @todo and @remark.
+
+    __Todo:__ Optimize this function for large inputs
+
+    Add support for negative values
+
+    __Remark:__ This function is thread-safe
+
+    __ATTENTION:__ The caller must free the returned pointer
+
+    [__@n@__]: Input count
+
+    __Returns:__ Allocated array
+
+    __C declaration:__ @todo_remark_attention@
+
+    __defined at:__ @documentation\/doxygen_docs.h 516:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+todo_remark_attention_safe = hs_bindgen_0446a821eb966f46
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_entities_func@
+foreign import ccall safe "hs_bindgen_25a9ea376bb793e9" hs_bindgen_25a9ea376bb793e9_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_entities_func@
+hs_bindgen_25a9ea376bb793e9 :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_html_entities_func@
+hs_bindgen_25a9ea376bb793e9 = \x_0 -> fmap fromFFIType (hs_bindgen_25a9ea376bb793e9_base (toFFIType x_0))
+{-| HTML entities: & means AND, <tag> is a tag.
+
+    Handles values < 0 and values > 100 differently. Copyright 2025.
+
+    [__@x@__]: Input (> 0 required)
+
+    __Returns:__ Result code
+
+    __C declaration:__ @html_entities_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 538:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_entities_func_safe :: CInt -> IO CInt
+{-| HTML entities: & means AND, <tag> is a tag.
+
+    Handles values < 0 and values > 100 differently. Copyright 2025.
+
+    [__@x@__]: Input (> 0 required)
+
+    __Returns:__ Result code
+
+    __C declaration:__ @html_entities_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 538:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_entities_func_safe = hs_bindgen_25a9ea376bb793e9
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_nested_inline_format@
+foreign import ccall safe "hs_bindgen_6f311771e5e063e6" hs_bindgen_6f311771e5e063e6_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_nested_inline_format@
+hs_bindgen_6f311771e5e063e6 :: CInt -> IO ()
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_nested_inline_format@
+hs_bindgen_6f311771e5e063e6 = \x_0 -> hs_bindgen_6f311771e5e063e6_base (toFFIType x_0)
+{-| Nested inline: __bold__ , @code@ , __@bold_code@ ,__ /__emph_bold__ ./
+
+    [__@x@__]: Input value
+
+    __C declaration:__ @nested_inline_format@
+
+    __defined at:__ @documentation\/doxygen_docs.h 545:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+nested_inline_format_safe :: CInt -> IO ()
+{-| Nested inline: __bold__ , @code@ , __@bold_code@ ,__ /__emph_bold__ ./
+
+    [__@x@__]: Input value
+
+    __C declaration:__ @nested_inline_format@
+
+    __defined at:__ @documentation\/doxygen_docs.h 545:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+nested_inline_format_safe = hs_bindgen_6f311771e5e063e6
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_tagged_code_example@
+foreign import ccall safe "hs_bindgen_34473a588f1157e4" hs_bindgen_34473a588f1157e4_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_tagged_code_example@
+hs_bindgen_34473a588f1157e4 :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_tagged_code_example@
+hs_bindgen_34473a588f1157e4 = \x_0 -> fmap fromFFIType (hs_bindgen_34473a588f1157e4_base (toFFIType x_0))
+{-| Language-tagged code block.
+
+    Example usage:
+
+    @
+    int result = tagged_code_example(42);
+    printf("Result: %d\n", result);
+    @
+
+    [__@x@__]: Input value
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @tagged_code_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 559:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+tagged_code_example_safe :: CInt -> IO CInt
+{-| Language-tagged code block.
+
+    Example usage:
+
+    @
+    int result = tagged_code_example(42);
+    printf("Result: %d\n", result);
+    @
+
+    [__@x@__]: Input value
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @tagged_code_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 559:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+tagged_code_example_safe = hs_bindgen_34473a588f1157e4
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_backslash_syntax@
+foreign import ccall safe "hs_bindgen_471f4a3c2db31252" hs_bindgen_471f4a3c2db31252_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_backslash_syntax@
+hs_bindgen_471f4a3c2db31252 :: PtrConst CChar ->
+                               Ptr CChar -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Safe_backslash_syntax@
+hs_bindgen_471f4a3c2db31252 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_471f4a3c2db31252_base (toFFIType x_0) (toFFIType x_1))
+{-| Function documented with backslash syntax.
+
+    This function uses backslash commands instead of @ commands to verify both syntaxes are handled equivalently.
+
+    [__@input@__]: The input string
+
+    [__@output@__]: The output buffer
+
+    __Returns:__ Number of bytes written
+
+    __See:__ 'auto_brief_func'
+
+    @since 2.0
+
+    __C declaration:__ @backslash_syntax@
+
+    __defined at:__ @documentation\/doxygen_docs.h 574:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+backslash_syntax_safe :: PtrConst CChar -> Ptr CChar -> IO CInt
+{-| Function documented with backslash syntax.
+
+    This function uses backslash commands instead of @ commands to verify both syntaxes are handled equivalently.
+
+    [__@input@__]: The input string
+
+    [__@output@__]: The output buffer
+
+    __Returns:__ Number of bytes written
+
+    __See:__ 'auto_brief_func'
+
+    @since 2.0
+
+    __C declaration:__ @backslash_syntax@
+
+    __defined at:__ @documentation\/doxygen_docs.h 574:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+backslash_syntax_safe = hs_bindgen_471f4a3c2db31252
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_data@
+foreign import ccall unsafe "hs_bindgen_e6085a910ba41ecb" hs_bindgen_e6085a910ba41ecb_base ::
+    Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_data@
+hs_bindgen_e6085a910ba41ecb :: PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                               Ptr HsBindgen.Runtime.LibC.Word8 ->
+                               Ptr HsBindgen.Runtime.LibC.CSize -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_data@
+hs_bindgen_e6085a910ba41ecb = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_e6085a910ba41ecb_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Function with detailed parameter documentation.
+
+    This function shows different parameter directions and types.
+
+    [__@input_data@ /(input)/__]: Input data buffer
+
+    [__@output_data@ /(output)/__]: Output data buffer
+
+    [__@size@ /(input,output)/__]: Size of data, updated on return
+
+    __Returns:__ Status code (0 = success, -1 = error)
+
+    __C declaration:__ @process_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 111:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_data_unsafe :: PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                       Ptr HsBindgen.Runtime.LibC.Word8 ->
+                       Ptr HsBindgen.Runtime.LibC.CSize -> IO CInt
+{-| Function with detailed parameter documentation.
+
+    This function shows different parameter directions and types.
+
+    [__@input_data@ /(input)/__]: Input data buffer
+
+    [__@output_data@ /(output)/__]: Output data buffer
+
+    [__@size@ /(input,output)/__]: Size of data, updated on return
+
+    __Returns:__ Status code (0 = success, -1 = error)
+
+    __C declaration:__ @process_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 111:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_data_unsafe = hs_bindgen_e6085a910ba41ecb
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_file@
+foreign import ccall unsafe "hs_bindgen_c27e893aea0b0a77" hs_bindgen_c27e893aea0b0a77_base ::
+    Ptr Void
+ -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_file@
+hs_bindgen_c27e893aea0b0a77 :: PtrConst CChar -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_file@
+hs_bindgen_c27e893aea0b0a77 = \x_0 -> fmap fromFFIType (hs_bindgen_c27e893aea0b0a77_base (toFFIType x_0))
+{-| Function with inline commands and formatting.
+
+    This function uses @inline@ @code@ formatting and __bold__ text. It also demonstrates /emphasized/ text.
+
+    [__@filename@__]: The @char*@ filename to process
+
+    __Returns:__ @true@ if successful, @false@ otherwise
+
+    __C declaration:__ @process_file@
+
+    __defined at:__ @documentation\/doxygen_docs.h 122:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_file_unsafe :: PtrConst CChar -> IO CBool
+{-| Function with inline commands and formatting.
+
+    This function uses @inline@ @code@ formatting and __bold__ text. It also demonstrates /emphasized/ text.
+
+    [__@filename@__]: The @char*@ filename to process
+
+    __Returns:__ @true@ if successful, @false@ otherwise
+
+    __C declaration:__ @process_file@
+
+    __defined at:__ @documentation\/doxygen_docs.h 122:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_file_unsafe = hs_bindgen_c27e893aea0b0a77
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_calculate_value@
+foreign import ccall unsafe "hs_bindgen_bc1b0e25a72f4ec0" hs_bindgen_bc1b0e25a72f4ec0_base ::
+    CInt
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_calculate_value@
+hs_bindgen_bc1b0e25a72f4ec0 :: CInt -> CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_calculate_value@
+hs_bindgen_bc1b0e25a72f4ec0 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_bc1b0e25a72f4ec0_base (toFFIType x_0) (toFFIType x_1))
+{-| Function with verbatim code blocks.
+
+    Example usage:
+
+    @
+    int result = calculate_value(10, 20);
+    printf("Result: %d\n", result);
+    @
+
+    [__@base@__]: Base value
+
+    [__@multiplier@__]: Multiplier value
+
+    __Returns:__ Calculated result
+
+    __C declaration:__ @calculate_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 137:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+calculate_value_unsafe :: CInt -> CInt -> IO CInt
+{-| Function with verbatim code blocks.
+
+    Example usage:
+
+    @
+    int result = calculate_value(10, 20);
+    printf("Result: %d\n", result);
+    @
+
+    [__@base@__]: Base value
+
+    [__@multiplier@__]: Multiplier value
+
+    __Returns:__ Calculated result
+
+    __C declaration:__ @calculate_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 137:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+calculate_value_unsafe = hs_bindgen_bc1b0e25a72f4ec0
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_example@
+foreign import ccall unsafe "hs_bindgen_09abc3cb74562964" hs_bindgen_09abc3cb74562964_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_example@
+hs_bindgen_09abc3cb74562964 :: CInt -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_example@
+hs_bindgen_09abc3cb74562964 = \x_0 -> fmap fromFFIType (hs_bindgen_09abc3cb74562964_base (toFFIType x_0))
+{-| Function with HTML formatting.
+
+    This function demonstrates __HTML bold__ and /italic/ text. It also shows @HTML code@ formatting.
+
+    Input
+
+    Output
+
+    0
+
+    false
+
+    1
+
+    true
+
+    [__@value@__]: Input value
+
+    __Returns:__ Boolean result
+
+    __C declaration:__ @html_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 154:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_example_unsafe :: CInt -> IO CBool
+{-| Function with HTML formatting.
+
+    This function demonstrates __HTML bold__ and /italic/ text. It also shows @HTML code@ formatting.
+
+    Input
+
+    Output
+
+    0
+
+    false
+
+    1
+
+    true
+
+    [__@value@__]: Input value
+
+    __Returns:__ Boolean result
+
+    __C declaration:__ @html_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 154:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_example_unsafe = hs_bindgen_09abc3cb74562964
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_list_example@
+foreign import ccall unsafe "hs_bindgen_47cba1a95d265f84" hs_bindgen_47cba1a95d265f84_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_list_example@
+hs_bindgen_47cba1a95d265f84 :: Ptr (PtrConst CChar) ->
+                               HsBindgen.Runtime.LibC.CSize -> IO CBool
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_list_example@
+hs_bindgen_47cba1a95d265f84 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_47cba1a95d265f84_base (toFFIType x_0) (toFFIType x_1))
+{-| Function with lists and special formatting.
+
+    This function demonstrates:
+
+    * Bullet point lists
+      * Nested list item 1
+      * Nested list item 2
+
+    * Multiple items
+
+    * Nested formatting
+
+    Numbered list:
+
+    1. First @item@ 1. item
+
+    2. Second __item__
+
+    3. Third item
+
+    Other numbered list:
+
+    1. A
+
+    2. B
+
+    3. C
+
+    [__@items@__]: Array of items
+
+    [__@count@__]: Number of items
+
+    __Returns:__ Success status
+
+    __C declaration:__ @list_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 180:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+list_example_unsafe :: Ptr (PtrConst CChar) ->
+                       HsBindgen.Runtime.LibC.CSize -> IO CBool
+{-| Function with lists and special formatting.
+
+    This function demonstrates:
+
+    * Bullet point lists
+      * Nested list item 1
+      * Nested list item 2
+
+    * Multiple items
+
+    * Nested formatting
+
+    Numbered list:
+
+    1. First @item@ 1. item
+
+    2. Second __item__
+
+    3. Third item
+
+    Other numbered list:
+
+    1. A
+
+    2. B
+
+    3. C
+
+    [__@items@__]: Array of items
+
+    [__@count@__]: Number of items
+
+    __Returns:__ Success status
+
+    __C declaration:__ @list_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 180:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+list_example_unsafe = hs_bindgen_47cba1a95d265f84
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_dangerous_function@
+foreign import ccall unsafe "hs_bindgen_e065fc013e4eccd6" hs_bindgen_e065fc013e4eccd6_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_dangerous_function@
+hs_bindgen_e065fc013e4eccd6 :: Ptr Void -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_dangerous_function@
+hs_bindgen_e065fc013e4eccd6 = \x_0 -> fmap fromFFIType (hs_bindgen_e065fc013e4eccd6_base (toFFIType x_0))
+{-| Function with warnings and notes.
+
+    __WARNING:__ This function may cause side effects
+
+    __Note:__ Use with caution in multithreaded environments
+
+    __See:__ related_function() for similar functionality
+
+    [__@ptr@__]: Pointer to data
+
+    __Returns:__ Modified pointer
+
+    __C declaration:__ @dangerous_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 192:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+dangerous_function_unsafe :: Ptr Void -> IO (Ptr Void)
+{-| Function with warnings and notes.
+
+    __WARNING:__ This function may cause side effects
+
+    __Note:__ Use with caution in multithreaded environments
+
+    __See:__ related_function() for similar functionality
+
+    [__@ptr@__]: Pointer to data
+
+    __Returns:__ Modified pointer
+
+    __C declaration:__ @dangerous_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 192:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+dangerous_function_unsafe = hs_bindgen_e065fc013e4eccd6
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_detailed_return_codes@
+foreign import ccall unsafe "hs_bindgen_bc4f7e24b2ad4ace" hs_bindgen_bc4f7e24b2ad4ace_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_detailed_return_codes@
+hs_bindgen_bc4f7e24b2ad4ace :: PtrConst CChar -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_detailed_return_codes@
+hs_bindgen_bc4f7e24b2ad4ace = \x_0 -> fmap fromFFIType (hs_bindgen_bc4f7e24b2ad4ace_base (toFFIType x_0))
+{-| Function with return value details.
+
+    [__@input@__]: Input string
+
+    [__@0@__]: Success
+
+    [__@-1@__]: Invalid input
+
+    [__@-2@__]: Memory allocation failed
+
+    [__@-3@__]: Processing error
+
+    __C declaration:__ @detailed_return_codes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 203:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+detailed_return_codes_unsafe :: PtrConst CChar -> IO CInt
+{-| Function with return value details.
+
+    [__@input@__]: Input string
+
+    [__@0@__]: Success
+
+    [__@-1@__]: Invalid input
+
+    [__@-2@__]: Memory allocation failed
+
+    [__@-3@__]: Processing error
+
+    __C declaration:__ @detailed_return_codes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 203:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+detailed_return_codes_unsafe = hs_bindgen_bc4f7e24b2ad4ace
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_old_function@
+foreign import ccall unsafe "hs_bindgen_8deec146389ae8b3" hs_bindgen_8deec146389ae8b3_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_old_function@
+hs_bindgen_8deec146389ae8b3 :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_old_function@
+hs_bindgen_8deec146389ae8b3 = \x_0 -> fmap fromFFIType (hs_bindgen_8deec146389ae8b3_base (toFFIType x_0))
+{-| Function with deprecated annotation.
+
+    __Deprecated:__ Use new_function() instead
+
+    [__@old_param@__]: Legacy parameter
+
+    __Returns:__ Legacy result
+
+    __C declaration:__ @old_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 212:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+old_function_unsafe :: CInt -> IO CInt
+{-| Function with deprecated annotation.
+
+    __Deprecated:__ Use new_function() instead
+
+    [__@old_param@__]: Legacy parameter
+
+    __Returns:__ Legacy result
+
+    __C declaration:__ @old_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 212:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+old_function_unsafe = hs_bindgen_8deec146389ae8b3
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_versioned_function@
+foreign import ccall unsafe "hs_bindgen_da2dcc1473935665" hs_bindgen_da2dcc1473935665_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_versioned_function@
+hs_bindgen_da2dcc1473935665 :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_versioned_function@
+hs_bindgen_da2dcc1473935665 = \x_0 -> fmap fromFFIType (hs_bindgen_da2dcc1473935665_base (toFFIType x_0))
+{-| Function with version information.
+
+    @since 1.0
+
+    __Version:__ 1.2
+
+    [__@data@__]: Input data
+
+    __Returns:__ Processed data
+
+    __C declaration:__ @versioned_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 222:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+versioned_function_unsafe :: CInt -> IO CInt
+{-| Function with version information.
+
+    @since 1.0
+
+    __Version:__ 1.2
+
+    [__@data@__]: Input data
+
+    __Returns:__ Processed data
+
+    __C declaration:__ @versioned_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 222:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+versioned_function_unsafe = hs_bindgen_da2dcc1473935665
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_buffer@
+foreign import ccall unsafe "hs_bindgen_97c1191917e6eece" hs_bindgen_97c1191917e6eece_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_buffer@
+hs_bindgen_97c1191917e6eece :: Ptr (Elem (ConstantArray 64
+                                                        CChar)) ->
+                               HsBindgen.Runtime.LibC.CSize -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_process_buffer@
+hs_bindgen_97c1191917e6eece = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_97c1191917e6eece_base (toFFIType x_0) (toFFIType x_1))
+{-| Static array parameter.
+
+    [__@buffer@__]: Buffer with minimum size
+
+    [__@size@__]: Actual buffer size
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @process_buffer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 338:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_buffer_unsafe :: Ptr (Elem (ConstantArray 64 CChar)) ->
+                         HsBindgen.Runtime.LibC.CSize -> IO CInt
+{-| Static array parameter.
+
+    [__@buffer@__]: Buffer with minimum size
+
+    [__@size@__]: Actual buffer size
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @process_buffer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 338:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_buffer_unsafe = hs_bindgen_97c1191917e6eece
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_my_memcpy@
+foreign import ccall unsafe "hs_bindgen_58253bb560dc3eb3" hs_bindgen_58253bb560dc3eb3_base ::
+    Ptr Void
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_my_memcpy@
+hs_bindgen_58253bb560dc3eb3 :: Ptr Void ->
+                               PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_my_memcpy@
+hs_bindgen_58253bb560dc3eb3 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_58253bb560dc3eb3_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Function with restrict pointers.
+
+    [__@dest@__]: Destination buffer (restrict)
+
+    [__@src@__]: Source buffer (restrict)
+
+    [__@n@__]: Number of bytes
+
+    __Returns:__ Destination pointer
+
+    __C declaration:__ @my_memcpy@
+
+    __defined at:__ @documentation\/doxygen_docs.h 348:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+my_memcpy_unsafe :: Ptr Void ->
+                    PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO (Ptr Void)
+{-| Function with restrict pointers.
+
+    [__@dest@__]: Destination buffer (restrict)
+
+    [__@src@__]: Source buffer (restrict)
+
+    [__@n@__]: Number of bytes
+
+    __Returns:__ Destination pointer
+
+    __C declaration:__ @my_memcpy@
+
+    __defined at:__ @documentation\/doxygen_docs.h 348:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+my_memcpy_unsafe = hs_bindgen_58253bb560dc3eb3
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_double_value@
+foreign import ccall unsafe "hs_bindgen_44dd19b16ee38e5b" hs_bindgen_44dd19b16ee38e5b_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_double_value@
+hs_bindgen_44dd19b16ee38e5b :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_double_value@
+hs_bindgen_44dd19b16ee38e5b = \x_0 -> fmap fromFFIType (hs_bindgen_44dd19b16ee38e5b_base (toFFIType x_0))
+{-| Inline function.
+
+    [__@x@__]: Input value
+
+    __Returns:__ Doubled value
+
+    __C declaration:__ @double_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 356:19@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+double_value_unsafe :: CInt -> IO CInt
+{-| Inline function.
+
+    [__@x@__]: Input value
+
+    __Returns:__ Doubled value
+
+    __C declaration:__ @double_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 356:19@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+double_value_unsafe = hs_bindgen_44dd19b16ee38e5b
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_read_chunk@
+foreign import ccall unsafe "hs_bindgen_a7d2e6fe1e9b3164" hs_bindgen_a7d2e6fe1e9b3164_base ::
+    CInt
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_read_chunk@
+hs_bindgen_a7d2e6fe1e9b3164 :: CInt ->
+                               Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_read_chunk@
+hs_bindgen_a7d2e6fe1e9b3164 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_a7d2e6fe1e9b3164_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Read a chunk of bytes into the provided buffer.
+
+    Demonstrates a section nested inside @functions@ .
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Output buffer
+
+    [__@count@__]: Number of bytes to read
+
+    __Returns:__ Number of bytes read
+
+    __C declaration:__ @read_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 387:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+read_chunk_unsafe :: CInt ->
+                     Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt
+{-| Read a chunk of bytes into the provided buffer.
+
+    Demonstrates a section nested inside @functions@ .
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Output buffer
+
+    [__@count@__]: Number of bytes to read
+
+    __Returns:__ Number of bytes read
+
+    __C declaration:__ @read_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 387:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+read_chunk_unsafe = hs_bindgen_a7d2e6fe1e9b3164
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_write_chunk@
+foreign import ccall unsafe "hs_bindgen_59f0c5ef262c5f3b" hs_bindgen_59f0c5ef262c5f3b_base ::
+    CInt
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_write_chunk@
+hs_bindgen_59f0c5ef262c5f3b :: CInt ->
+                               PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_write_chunk@
+hs_bindgen_59f0c5ef262c5f3b = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_59f0c5ef262c5f3b_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Write a chunk of bytes from the provided buffer.
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Input buffer
+
+    [__@count@__]: Number of bytes to write
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @write_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 397:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+write_chunk_unsafe :: CInt ->
+                      PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt
+{-| Write a chunk of bytes from the provided buffer.
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Input buffer
+
+    [__@count@__]: Number of bytes to write
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @write_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 397:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+write_chunk_unsafe = hs_bindgen_59f0c5ef262c5f3b
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_complex_function@
+foreign import ccall unsafe "hs_bindgen_fd6fce7c8d8b2f79" hs_bindgen_fd6fce7c8d8b2f79_base ::
+    Ptr Void
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_complex_function@
+hs_bindgen_fd6fce7c8d8b2f79 :: Ptr Config_t ->
+                               PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                               HsBindgen.Runtime.LibC.CSize -> IO Status_code_t
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_complex_function@
+hs_bindgen_fd6fce7c8d8b2f79 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_fd6fce7c8d8b2f79_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| Function with complex documentation.
+
+    This function demonstrates multiple documentation features:
+
+    __Description:__
+
+    Performs complex data processing with multiple steps.
+
+    __Algorithm:__
+
+    1. Validate input parameters
+
+    2. Allocate temporary buffers
+
+    3. Process data in chunks
+
+    4. Clean up resources
+
+    __Algorithm2:__
+
+    * Validate input parameters
+
+    * Allocate temporary buffers
+
+    * Process data in chunks
+
+    * Clean up resources
+
+    __Example:__
+
+    @
+    config_t cfg = {
+        .id = 1,
+        .name = "test",
+        .flags = 0,
+        .callback = my_callback,
+        .user_data = NULL
+    };
+
+    status_code_t result = complex_function(&cfg, data, size);
+    if (result != STATUS_OK) {
+        handle_error(result);
+    }
+    @
+
+    [__@config@__]: Configuration structure (see 'Config_t' )
+
+    [__@data@__]: Input data buffer
+
+    [__@size@__]: Size of input data
+
+    __Returns:__ Status code indicating success or failure
+
+    __Precondition:__ config must not be NULL
+
+    __Precondition:__ data must not be NULL if size > 0
+
+    __Postcondition:__ Output data is written to config->user_data
+
+    __WARNING:__ May return NULL if memory allocation fails
+
+    __WARNING:__ Sets errno to EINVAL if parameters are invalid
+
+    __C declaration:__ @complex_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 459:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+complex_function_unsafe :: Ptr Config_t ->
+                           PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                           HsBindgen.Runtime.LibC.CSize -> IO Status_code_t
+{-| Function with complex documentation.
+
+    This function demonstrates multiple documentation features:
+
+    __Description:__
+
+    Performs complex data processing with multiple steps.
+
+    __Algorithm:__
+
+    1. Validate input parameters
+
+    2. Allocate temporary buffers
+
+    3. Process data in chunks
+
+    4. Clean up resources
+
+    __Algorithm2:__
+
+    * Validate input parameters
+
+    * Allocate temporary buffers
+
+    * Process data in chunks
+
+    * Clean up resources
+
+    __Example:__
+
+    @
+    config_t cfg = {
+        .id = 1,
+        .name = "test",
+        .flags = 0,
+        .callback = my_callback,
+        .user_data = NULL
+    };
+
+    status_code_t result = complex_function(&cfg, data, size);
+    if (result != STATUS_OK) {
+        handle_error(result);
+    }
+    @
+
+    [__@config@__]: Configuration structure (see 'Config_t' )
+
+    [__@data@__]: Input data buffer
+
+    [__@size@__]: Size of input data
+
+    __Returns:__ Status code indicating success or failure
+
+    __Precondition:__ config must not be NULL
+
+    __Precondition:__ data must not be NULL if size > 0
+
+    __Postcondition:__ Output data is written to config->user_data
+
+    __WARNING:__ May return NULL if memory allocation fails
+
+    __WARNING:__ Sets errno to EINVAL if parameters are invalid
+
+    __C declaration:__ @complex_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 459:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+complex_function_unsafe = hs_bindgen_fd6fce7c8d8b2f79
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_hash@
+foreign import ccall unsafe "hs_bindgen_dd36c8b317ccfcc4" hs_bindgen_dd36c8b317ccfcc4_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_hash@
+hs_bindgen_dd36c8b317ccfcc4 :: Ptr CChar -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_hash@
+hs_bindgen_dd36c8b317ccfcc4 = \x_0 -> fmap fromFFIType (hs_bindgen_dd36c8b317ccfcc4_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @documentation\/doxygen_docs.h 463:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+hash_unsafe :: Ptr CChar -> IO CInt
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @documentation\/doxygen_docs.h 463:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+hash_unsafe = hs_bindgen_dd36c8b317ccfcc4
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_square@
+foreign import ccall unsafe "hs_bindgen_6875e30a7fe8d30a" hs_bindgen_6875e30a7fe8d30a_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_square@
+hs_bindgen_6875e30a7fe8d30a :: CInt -> CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_square@
+hs_bindgen_6875e30a7fe8d30a = \x_0 -> fromFFIType (hs_bindgen_6875e30a7fe8d30a_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @documentation\/doxygen_docs.h 465:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+square_unsafe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @documentation\/doxygen_docs.h 465:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+square_unsafe = hs_bindgen_6875e30a7fe8d30a
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_auto_brief_func@
+foreign import ccall unsafe "hs_bindgen_3094fd32a3eedd49" hs_bindgen_3094fd32a3eedd49_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_auto_brief_func@
+hs_bindgen_3094fd32a3eedd49 :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_auto_brief_func@
+hs_bindgen_3094fd32a3eedd49 = \x_0 -> fmap fromFFIType (hs_bindgen_3094fd32a3eedd49_base (toFFIType x_0))
+{-| Auto-brief function without explicit @brief tag.
+
+    This tests that the first sentence is used as the brief description when no explicit @brief is present.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The negated value
+
+    __C declaration:__ @auto_brief_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 486:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+auto_brief_func_unsafe :: CInt -> IO CInt
+{-| Auto-brief function without explicit @brief tag.
+
+    This tests that the first sentence is used as the brief description when no explicit @brief is present.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The negated value
+
+    __C declaration:__ @auto_brief_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 486:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+auto_brief_func_unsafe = hs_bindgen_3094fd32a3eedd49
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_multi_paragraph_details@
+foreign import ccall unsafe "hs_bindgen_73270d34a2bf31b5" hs_bindgen_73270d34a2bf31b5_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_multi_paragraph_details@
+hs_bindgen_73270d34a2bf31b5 :: Ptr CChar ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_multi_paragraph_details@
+hs_bindgen_73270d34a2bf31b5 = \x_0 -> \x_1 -> hs_bindgen_73270d34a2bf31b5_base (toFFIType x_0) (toFFIType x_1)
+{-| Multi-paragraph details.
+
+    First paragraph of the detailed description. This explains the basic purpose of the function.
+
+    Second paragraph with more context. This includes information about the algorithm and its complexity, which is O(n) in the input size.
+
+    Third paragraph with usage notes. Callers should ensure that the buffer is large enough before calling this function.
+
+    [__@buf@__]: Output buffer
+
+    [__@len@__]: Buffer length
+
+    __C declaration:__ @multi_paragraph_details@
+
+    __defined at:__ @documentation\/doxygen_docs.h 503:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+multi_paragraph_details_unsafe :: Ptr CChar ->
+                                  HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| Multi-paragraph details.
+
+    First paragraph of the detailed description. This explains the basic purpose of the function.
+
+    Second paragraph with more context. This includes information about the algorithm and its complexity, which is O(n) in the input size.
+
+    Third paragraph with usage notes. Callers should ensure that the buffer is large enough before calling this function.
+
+    [__@buf@__]: Output buffer
+
+    [__@len@__]: Buffer length
+
+    __C declaration:__ @multi_paragraph_details@
+
+    __defined at:__ @documentation\/doxygen_docs.h 503:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+multi_paragraph_details_unsafe = hs_bindgen_73270d34a2bf31b5
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_todo_remark_attention@
+foreign import ccall unsafe "hs_bindgen_836de64a94d7bf03" hs_bindgen_836de64a94d7bf03_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_todo_remark_attention@
+hs_bindgen_836de64a94d7bf03 :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_todo_remark_attention@
+hs_bindgen_836de64a94d7bf03 = \x_0 -> fmap fromFFIType (hs_bindgen_836de64a94d7bf03_base (toFFIType x_0))
+{-| Function with @todo and @remark.
+
+    __Todo:__ Optimize this function for large inputs
+
+    Add support for negative values
+
+    __Remark:__ This function is thread-safe
+
+    __ATTENTION:__ The caller must free the returned pointer
+
+    [__@n@__]: Input count
+
+    __Returns:__ Allocated array
+
+    __C declaration:__ @todo_remark_attention@
+
+    __defined at:__ @documentation\/doxygen_docs.h 516:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+todo_remark_attention_unsafe :: CInt -> IO (Ptr CInt)
+{-| Function with @todo and @remark.
+
+    __Todo:__ Optimize this function for large inputs
+
+    Add support for negative values
+
+    __Remark:__ This function is thread-safe
+
+    __ATTENTION:__ The caller must free the returned pointer
+
+    [__@n@__]: Input count
+
+    __Returns:__ Allocated array
+
+    __C declaration:__ @todo_remark_attention@
+
+    __defined at:__ @documentation\/doxygen_docs.h 516:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+todo_remark_attention_unsafe = hs_bindgen_836de64a94d7bf03
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_entities_func@
+foreign import ccall unsafe "hs_bindgen_aa0467b9d3b1a48d" hs_bindgen_aa0467b9d3b1a48d_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_entities_func@
+hs_bindgen_aa0467b9d3b1a48d :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_html_entities_func@
+hs_bindgen_aa0467b9d3b1a48d = \x_0 -> fmap fromFFIType (hs_bindgen_aa0467b9d3b1a48d_base (toFFIType x_0))
+{-| HTML entities: & means AND, <tag> is a tag.
+
+    Handles values < 0 and values > 100 differently. Copyright 2025.
+
+    [__@x@__]: Input (> 0 required)
+
+    __Returns:__ Result code
+
+    __C declaration:__ @html_entities_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 538:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_entities_func_unsafe :: CInt -> IO CInt
+{-| HTML entities: & means AND, <tag> is a tag.
+
+    Handles values < 0 and values > 100 differently. Copyright 2025.
+
+    [__@x@__]: Input (> 0 required)
+
+    __Returns:__ Result code
+
+    __C declaration:__ @html_entities_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 538:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_entities_func_unsafe = hs_bindgen_aa0467b9d3b1a48d
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_nested_inline_format@
+foreign import ccall unsafe "hs_bindgen_b654d8047edfed77" hs_bindgen_b654d8047edfed77_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_nested_inline_format@
+hs_bindgen_b654d8047edfed77 :: CInt -> IO ()
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_nested_inline_format@
+hs_bindgen_b654d8047edfed77 = \x_0 -> hs_bindgen_b654d8047edfed77_base (toFFIType x_0)
+{-| Nested inline: __bold__ , @code@ , __@bold_code@ ,__ /__emph_bold__ ./
+
+    [__@x@__]: Input value
+
+    __C declaration:__ @nested_inline_format@
+
+    __defined at:__ @documentation\/doxygen_docs.h 545:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+nested_inline_format_unsafe :: CInt -> IO ()
+{-| Nested inline: __bold__ , @code@ , __@bold_code@ ,__ /__emph_bold__ ./
+
+    [__@x@__]: Input value
+
+    __C declaration:__ @nested_inline_format@
+
+    __defined at:__ @documentation\/doxygen_docs.h 545:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+nested_inline_format_unsafe = hs_bindgen_b654d8047edfed77
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_tagged_code_example@
+foreign import ccall unsafe "hs_bindgen_aeb274aded3470e5" hs_bindgen_aeb274aded3470e5_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_tagged_code_example@
+hs_bindgen_aeb274aded3470e5 :: CInt -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_tagged_code_example@
+hs_bindgen_aeb274aded3470e5 = \x_0 -> fmap fromFFIType (hs_bindgen_aeb274aded3470e5_base (toFFIType x_0))
+{-| Language-tagged code block.
+
+    Example usage:
+
+    @
+    int result = tagged_code_example(42);
+    printf("Result: %d\n", result);
+    @
+
+    [__@x@__]: Input value
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @tagged_code_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 559:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+tagged_code_example_unsafe :: CInt -> IO CInt
+{-| Language-tagged code block.
+
+    Example usage:
+
+    @
+    int result = tagged_code_example(42);
+    printf("Result: %d\n", result);
+    @
+
+    [__@x@__]: Input value
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @tagged_code_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 559:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+tagged_code_example_unsafe = hs_bindgen_aeb274aded3470e5
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_backslash_syntax@
+foreign import ccall unsafe "hs_bindgen_907720dffab9442a" hs_bindgen_907720dffab9442a_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_backslash_syntax@
+hs_bindgen_907720dffab9442a :: PtrConst CChar ->
+                               Ptr CChar -> IO CInt
+-- __unique:__ @test_documentationdoxygen_docs_Example_Unsafe_backslash_syntax@
+hs_bindgen_907720dffab9442a = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_907720dffab9442a_base (toFFIType x_0) (toFFIType x_1))
+{-| Function documented with backslash syntax.
+
+    This function uses backslash commands instead of @ commands to verify both syntaxes are handled equivalently.
+
+    [__@input@__]: The input string
+
+    [__@output@__]: The output buffer
+
+    __Returns:__ Number of bytes written
+
+    __See:__ 'auto_brief_func'
+
+    @since 2.0
+
+    __C declaration:__ @backslash_syntax@
+
+    __defined at:__ @documentation\/doxygen_docs.h 574:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+backslash_syntax_unsafe :: PtrConst CChar -> Ptr CChar -> IO CInt
+{-| Function documented with backslash syntax.
+
+    This function uses backslash commands instead of @ commands to verify both syntaxes are handled equivalently.
+
+    [__@input@__]: The input string
+
+    [__@output@__]: The output buffer
+
+    __Returns:__ Number of bytes written
+
+    __See:__ 'auto_brief_func'
+
+    @since 2.0
+
+    __C declaration:__ @backslash_syntax@
+
+    __defined at:__ @documentation\/doxygen_docs.h 574:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+backslash_syntax_unsafe = hs_bindgen_907720dffab9442a
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_data@
+foreign import ccall unsafe "hs_bindgen_4a5cd66a4f26f8d5" hs_bindgen_4a5cd66a4f26f8d5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_data@
+hs_bindgen_4a5cd66a4f26f8d5 :: IO (FunPtr (PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                                           Ptr HsBindgen.Runtime.LibC.Word8 ->
+                                           Ptr HsBindgen.Runtime.LibC.CSize -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_data@
+hs_bindgen_4a5cd66a4f26f8d5 = fmap fromFFIType hs_bindgen_4a5cd66a4f26f8d5_base
+{-# NOINLINE process_data_funptr #-}
+{-| Function with detailed parameter documentation.
+
+    This function shows different parameter directions and types.
+
+    [__@input_data@ /(input)/__]: Input data buffer
+
+    [__@output_data@ /(output)/__]: Output data buffer
+
+    [__@size@ /(input,output)/__]: Size of data, updated on return
+
+    __Returns:__ Status code (0 = success, -1 = error)
+
+    __C declaration:__ @process_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 111:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_data_funptr :: FunPtr (PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                               Ptr HsBindgen.Runtime.LibC.Word8 ->
+                               Ptr HsBindgen.Runtime.LibC.CSize -> IO CInt)
+{-| Function with detailed parameter documentation.
+
+    This function shows different parameter directions and types.
+
+    [__@input_data@ /(input)/__]: Input data buffer
+
+    [__@output_data@ /(output)/__]: Output data buffer
+
+    [__@size@ /(input,output)/__]: Size of data, updated on return
+
+    __Returns:__ Status code (0 = success, -1 = error)
+
+    __C declaration:__ @process_data@
+
+    __defined at:__ @documentation\/doxygen_docs.h 111:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_data_funptr = unsafePerformIO hs_bindgen_4a5cd66a4f26f8d5
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_file@
+foreign import ccall unsafe "hs_bindgen_c8a059c65f18fea9" hs_bindgen_c8a059c65f18fea9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_file@
+hs_bindgen_c8a059c65f18fea9 :: IO (FunPtr (PtrConst CChar ->
+                                           IO CBool))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_file@
+hs_bindgen_c8a059c65f18fea9 = fmap fromFFIType hs_bindgen_c8a059c65f18fea9_base
+{-# NOINLINE process_file_funptr #-}
+{-| Function with inline commands and formatting.
+
+    This function uses @inline@ @code@ formatting and __bold__ text. It also demonstrates /emphasized/ text.
+
+    [__@filename@__]: The @char*@ filename to process
+
+    __Returns:__ @true@ if successful, @false@ otherwise
+
+    __C declaration:__ @process_file@
+
+    __defined at:__ @documentation\/doxygen_docs.h 122:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_file_funptr :: FunPtr (PtrConst CChar -> IO CBool)
+{-| Function with inline commands and formatting.
+
+    This function uses @inline@ @code@ formatting and __bold__ text. It also demonstrates /emphasized/ text.
+
+    [__@filename@__]: The @char*@ filename to process
+
+    __Returns:__ @true@ if successful, @false@ otherwise
+
+    __C declaration:__ @process_file@
+
+    __defined at:__ @documentation\/doxygen_docs.h 122:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_file_funptr = unsafePerformIO hs_bindgen_c8a059c65f18fea9
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_calculate_value@
+foreign import ccall unsafe "hs_bindgen_5ab7e06724867ab3" hs_bindgen_5ab7e06724867ab3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_calculate_value@
+hs_bindgen_5ab7e06724867ab3 :: IO (FunPtr (CInt ->
+                                           CInt -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_calculate_value@
+hs_bindgen_5ab7e06724867ab3 = fmap fromFFIType hs_bindgen_5ab7e06724867ab3_base
+{-# NOINLINE calculate_value_funptr #-}
+{-| Function with verbatim code blocks.
+
+    Example usage:
+
+    @
+    int result = calculate_value(10, 20);
+    printf("Result: %d\n", result);
+    @
+
+    [__@base@__]: Base value
+
+    [__@multiplier@__]: Multiplier value
+
+    __Returns:__ Calculated result
+
+    __C declaration:__ @calculate_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 137:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+calculate_value_funptr :: FunPtr (CInt -> CInt -> IO CInt)
+{-| Function with verbatim code blocks.
+
+    Example usage:
+
+    @
+    int result = calculate_value(10, 20);
+    printf("Result: %d\n", result);
+    @
+
+    [__@base@__]: Base value
+
+    [__@multiplier@__]: Multiplier value
+
+    __Returns:__ Calculated result
+
+    __C declaration:__ @calculate_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 137:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+calculate_value_funptr = unsafePerformIO hs_bindgen_5ab7e06724867ab3
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_example@
+foreign import ccall unsafe "hs_bindgen_3f74fb834b0cd46b" hs_bindgen_3f74fb834b0cd46b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_example@
+hs_bindgen_3f74fb834b0cd46b :: IO (FunPtr (CInt -> IO CBool))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_example@
+hs_bindgen_3f74fb834b0cd46b = fmap fromFFIType hs_bindgen_3f74fb834b0cd46b_base
+{-# NOINLINE html_example_funptr #-}
+{-| Function with HTML formatting.
+
+    This function demonstrates __HTML bold__ and /italic/ text. It also shows @HTML code@ formatting.
+
+    Input
+
+    Output
+
+    0
+
+    false
+
+    1
+
+    true
+
+    [__@value@__]: Input value
+
+    __Returns:__ Boolean result
+
+    __C declaration:__ @html_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 154:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_example_funptr :: FunPtr (CInt -> IO CBool)
+{-| Function with HTML formatting.
+
+    This function demonstrates __HTML bold__ and /italic/ text. It also shows @HTML code@ formatting.
+
+    Input
+
+    Output
+
+    0
+
+    false
+
+    1
+
+    true
+
+    [__@value@__]: Input value
+
+    __Returns:__ Boolean result
+
+    __C declaration:__ @html_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 154:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_example_funptr = unsafePerformIO hs_bindgen_3f74fb834b0cd46b
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_list_example@
+foreign import ccall unsafe "hs_bindgen_2175b3c627db39cf" hs_bindgen_2175b3c627db39cf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_list_example@
+hs_bindgen_2175b3c627db39cf :: IO (FunPtr (Ptr (PtrConst CChar) ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO CBool))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_list_example@
+hs_bindgen_2175b3c627db39cf = fmap fromFFIType hs_bindgen_2175b3c627db39cf_base
+{-# NOINLINE list_example_funptr #-}
+{-| Function with lists and special formatting.
+
+    This function demonstrates:
+
+    * Bullet point lists
+      * Nested list item 1
+      * Nested list item 2
+
+    * Multiple items
+
+    * Nested formatting
+
+    Numbered list:
+
+    1. First @item@ 1. item
+
+    2. Second __item__
+
+    3. Third item
+
+    Other numbered list:
+
+    1. A
+
+    2. B
+
+    3. C
+
+    [__@items@__]: Array of items
+
+    [__@count@__]: Number of items
+
+    __Returns:__ Success status
+
+    __C declaration:__ @list_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 180:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+list_example_funptr :: FunPtr (Ptr (PtrConst CChar) ->
+                               HsBindgen.Runtime.LibC.CSize -> IO CBool)
+{-| Function with lists and special formatting.
+
+    This function demonstrates:
+
+    * Bullet point lists
+      * Nested list item 1
+      * Nested list item 2
+
+    * Multiple items
+
+    * Nested formatting
+
+    Numbered list:
+
+    1. First @item@ 1. item
+
+    2. Second __item__
+
+    3. Third item
+
+    Other numbered list:
+
+    1. A
+
+    2. B
+
+    3. C
+
+    [__@items@__]: Array of items
+
+    [__@count@__]: Number of items
+
+    __Returns:__ Success status
+
+    __C declaration:__ @list_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 180:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+list_example_funptr = unsafePerformIO hs_bindgen_2175b3c627db39cf
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_dangerous_function@
+foreign import ccall unsafe "hs_bindgen_b7a4debd18827a19" hs_bindgen_b7a4debd18827a19_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_dangerous_function@
+hs_bindgen_b7a4debd18827a19 :: IO (FunPtr (Ptr Void ->
+                                           IO (Ptr Void)))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_dangerous_function@
+hs_bindgen_b7a4debd18827a19 = fmap fromFFIType hs_bindgen_b7a4debd18827a19_base
+{-# NOINLINE dangerous_function_funptr #-}
+{-| Function with warnings and notes.
+
+    __WARNING:__ This function may cause side effects
+
+    __Note:__ Use with caution in multithreaded environments
+
+    __See:__ related_function() for similar functionality
+
+    [__@ptr@__]: Pointer to data
+
+    __Returns:__ Modified pointer
+
+    __C declaration:__ @dangerous_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 192:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+dangerous_function_funptr :: FunPtr (Ptr Void -> IO (Ptr Void))
+{-| Function with warnings and notes.
+
+    __WARNING:__ This function may cause side effects
+
+    __Note:__ Use with caution in multithreaded environments
+
+    __See:__ related_function() for similar functionality
+
+    [__@ptr@__]: Pointer to data
+
+    __Returns:__ Modified pointer
+
+    __C declaration:__ @dangerous_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 192:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+dangerous_function_funptr = unsafePerformIO hs_bindgen_b7a4debd18827a19
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_detailed_return_codes@
+foreign import ccall unsafe "hs_bindgen_9700b22f82eedafe" hs_bindgen_9700b22f82eedafe_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_detailed_return_codes@
+hs_bindgen_9700b22f82eedafe :: IO (FunPtr (PtrConst CChar ->
+                                           IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_detailed_return_codes@
+hs_bindgen_9700b22f82eedafe = fmap fromFFIType hs_bindgen_9700b22f82eedafe_base
+{-# NOINLINE detailed_return_codes_funptr #-}
+{-| Function with return value details.
+
+    [__@input@__]: Input string
+
+    [__@0@__]: Success
+
+    [__@-1@__]: Invalid input
+
+    [__@-2@__]: Memory allocation failed
+
+    [__@-3@__]: Processing error
+
+    __C declaration:__ @detailed_return_codes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 203:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+detailed_return_codes_funptr :: FunPtr (PtrConst CChar -> IO CInt)
+{-| Function with return value details.
+
+    [__@input@__]: Input string
+
+    [__@0@__]: Success
+
+    [__@-1@__]: Invalid input
+
+    [__@-2@__]: Memory allocation failed
+
+    [__@-3@__]: Processing error
+
+    __C declaration:__ @detailed_return_codes@
+
+    __defined at:__ @documentation\/doxygen_docs.h 203:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+detailed_return_codes_funptr = unsafePerformIO hs_bindgen_9700b22f82eedafe
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_old_function@
+foreign import ccall unsafe "hs_bindgen_49e0d34a627c6c19" hs_bindgen_49e0d34a627c6c19_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_old_function@
+hs_bindgen_49e0d34a627c6c19 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_old_function@
+hs_bindgen_49e0d34a627c6c19 = fmap fromFFIType hs_bindgen_49e0d34a627c6c19_base
+{-# NOINLINE old_function_funptr #-}
+{-| Function with deprecated annotation.
+
+    __Deprecated:__ Use new_function() instead
+
+    [__@old_param@__]: Legacy parameter
+
+    __Returns:__ Legacy result
+
+    __C declaration:__ @old_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 212:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+old_function_funptr :: FunPtr (CInt -> IO CInt)
+{-| Function with deprecated annotation.
+
+    __Deprecated:__ Use new_function() instead
+
+    [__@old_param@__]: Legacy parameter
+
+    __Returns:__ Legacy result
+
+    __C declaration:__ @old_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 212:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+old_function_funptr = unsafePerformIO hs_bindgen_49e0d34a627c6c19
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_versioned_function@
+foreign import ccall unsafe "hs_bindgen_180cd7537e40ce99" hs_bindgen_180cd7537e40ce99_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_versioned_function@
+hs_bindgen_180cd7537e40ce99 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_versioned_function@
+hs_bindgen_180cd7537e40ce99 = fmap fromFFIType hs_bindgen_180cd7537e40ce99_base
+{-# NOINLINE versioned_function_funptr #-}
+{-| Function with version information.
+
+    @since 1.0
+
+    __Version:__ 1.2
+
+    [__@data@__]: Input data
+
+    __Returns:__ Processed data
+
+    __C declaration:__ @versioned_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 222:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+versioned_function_funptr :: FunPtr (CInt -> IO CInt)
+{-| Function with version information.
+
+    @since 1.0
+
+    __Version:__ 1.2
+
+    [__@data@__]: Input data
+
+    __Returns:__ Processed data
+
+    __C declaration:__ @versioned_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 222:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+versioned_function_funptr = unsafePerformIO hs_bindgen_180cd7537e40ce99
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_buffer@
+foreign import ccall unsafe "hs_bindgen_f4ccc6d90e8d3ebd" hs_bindgen_f4ccc6d90e8d3ebd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_buffer@
+hs_bindgen_f4ccc6d90e8d3ebd :: IO (FunPtr (Ptr (Elem (ConstantArray 64
+                                                                    CChar)) ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_process_buffer@
+hs_bindgen_f4ccc6d90e8d3ebd = fmap fromFFIType hs_bindgen_f4ccc6d90e8d3ebd_base
+{-# NOINLINE process_buffer_funptr #-}
+{-| Static array parameter.
+
+    [__@buffer@__]: Buffer with minimum size
+
+    [__@size@__]: Actual buffer size
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @process_buffer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 338:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_buffer_funptr :: FunPtr (Ptr (Elem (ConstantArray 64
+                                                          CChar)) ->
+                                 HsBindgen.Runtime.LibC.CSize -> IO CInt)
+{-| Static array parameter.
+
+    [__@buffer@__]: Buffer with minimum size
+
+    [__@size@__]: Actual buffer size
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @process_buffer@
+
+    __defined at:__ @documentation\/doxygen_docs.h 338:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+process_buffer_funptr = unsafePerformIO hs_bindgen_f4ccc6d90e8d3ebd
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_my_memcpy@
+foreign import ccall unsafe "hs_bindgen_6a74d376c901b531" hs_bindgen_6a74d376c901b531_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_my_memcpy@
+hs_bindgen_6a74d376c901b531 :: IO (FunPtr (Ptr Void ->
+                                           PtrConst Void ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO (Ptr Void)))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_my_memcpy@
+hs_bindgen_6a74d376c901b531 = fmap fromFFIType hs_bindgen_6a74d376c901b531_base
+{-# NOINLINE my_memcpy_funptr #-}
+{-| Function with restrict pointers.
+
+    [__@dest@__]: Destination buffer (restrict)
+
+    [__@src@__]: Source buffer (restrict)
+
+    [__@n@__]: Number of bytes
+
+    __Returns:__ Destination pointer
+
+    __C declaration:__ @my_memcpy@
+
+    __defined at:__ @documentation\/doxygen_docs.h 348:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+my_memcpy_funptr :: FunPtr (Ptr Void ->
+                            PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO (Ptr Void))
+{-| Function with restrict pointers.
+
+    [__@dest@__]: Destination buffer (restrict)
+
+    [__@src@__]: Source buffer (restrict)
+
+    [__@n@__]: Number of bytes
+
+    __Returns:__ Destination pointer
+
+    __C declaration:__ @my_memcpy@
+
+    __defined at:__ @documentation\/doxygen_docs.h 348:7@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+my_memcpy_funptr = unsafePerformIO hs_bindgen_6a74d376c901b531
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_double_value@
+foreign import ccall unsafe "hs_bindgen_156a92f3c5176105" hs_bindgen_156a92f3c5176105_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_double_value@
+hs_bindgen_156a92f3c5176105 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_double_value@
+hs_bindgen_156a92f3c5176105 = fmap fromFFIType hs_bindgen_156a92f3c5176105_base
+{-# NOINLINE double_value_funptr #-}
+{-| Inline function.
+
+    [__@x@__]: Input value
+
+    __Returns:__ Doubled value
+
+    __C declaration:__ @double_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 356:19@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+double_value_funptr :: FunPtr (CInt -> IO CInt)
+{-| Inline function.
+
+    [__@x@__]: Input value
+
+    __Returns:__ Doubled value
+
+    __C declaration:__ @double_value@
+
+    __defined at:__ @documentation\/doxygen_docs.h 356:19@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+double_value_funptr = unsafePerformIO hs_bindgen_156a92f3c5176105
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_read_chunk@
+foreign import ccall unsafe "hs_bindgen_373de63fa8345f66" hs_bindgen_373de63fa8345f66_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_read_chunk@
+hs_bindgen_373de63fa8345f66 :: IO (FunPtr (CInt ->
+                                           Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_read_chunk@
+hs_bindgen_373de63fa8345f66 = fmap fromFFIType hs_bindgen_373de63fa8345f66_base
+{-# NOINLINE read_chunk_funptr #-}
+{-| Read a chunk of bytes into the provided buffer.
+
+    Demonstrates a section nested inside @functions@ .
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Output buffer
+
+    [__@count@__]: Number of bytes to read
+
+    __Returns:__ Number of bytes read
+
+    __C declaration:__ @read_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 387:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+read_chunk_funptr :: FunPtr (CInt ->
+                             Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt)
+{-| Read a chunk of bytes into the provided buffer.
+
+    Demonstrates a section nested inside @functions@ .
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Output buffer
+
+    [__@count@__]: Number of bytes to read
+
+    __Returns:__ Number of bytes read
+
+    __C declaration:__ @read_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 387:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+read_chunk_funptr = unsafePerformIO hs_bindgen_373de63fa8345f66
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_write_chunk@
+foreign import ccall unsafe "hs_bindgen_78a029fc9807a27f" hs_bindgen_78a029fc9807a27f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_write_chunk@
+hs_bindgen_78a029fc9807a27f :: IO (FunPtr (CInt ->
+                                           PtrConst Void ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_write_chunk@
+hs_bindgen_78a029fc9807a27f = fmap fromFFIType hs_bindgen_78a029fc9807a27f_base
+{-# NOINLINE write_chunk_funptr #-}
+{-| Write a chunk of bytes from the provided buffer.
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Input buffer
+
+    [__@count@__]: Number of bytes to write
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @write_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 397:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+write_chunk_funptr :: FunPtr (CInt ->
+                              PtrConst Void -> HsBindgen.Runtime.LibC.CSize -> IO CInt)
+{-| Write a chunk of bytes from the provided buffer.
+
+    [__@fd@__]: File descriptor
+
+    [__@buf@__]: Input buffer
+
+    [__@count@__]: Number of bytes to write
+
+    __Returns:__ Number of bytes written
+
+    __C declaration:__ @write_chunk@
+
+    __defined at:__ @documentation\/doxygen_docs.h 397:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+write_chunk_funptr = unsafePerformIO hs_bindgen_78a029fc9807a27f
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_complex_function@
+foreign import ccall unsafe "hs_bindgen_dfa39b6be50cb2ca" hs_bindgen_dfa39b6be50cb2ca_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_complex_function@
+hs_bindgen_dfa39b6be50cb2ca :: IO (FunPtr (Ptr Config_t ->
+                                           PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO Status_code_t))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_complex_function@
+hs_bindgen_dfa39b6be50cb2ca = fmap fromFFIType hs_bindgen_dfa39b6be50cb2ca_base
+{-# NOINLINE complex_function_funptr #-}
+{-| Function with complex documentation.
+
+    This function demonstrates multiple documentation features:
+
+    __Description:__
+
+    Performs complex data processing with multiple steps.
+
+    __Algorithm:__
+
+    1. Validate input parameters
+
+    2. Allocate temporary buffers
+
+    3. Process data in chunks
+
+    4. Clean up resources
+
+    __Algorithm2:__
+
+    * Validate input parameters
+
+    * Allocate temporary buffers
+
+    * Process data in chunks
+
+    * Clean up resources
+
+    __Example:__
+
+    @
+    config_t cfg = {
+        .id = 1,
+        .name = "test",
+        .flags = 0,
+        .callback = my_callback,
+        .user_data = NULL
+    };
+
+    status_code_t result = complex_function(&cfg, data, size);
+    if (result != STATUS_OK) {
+        handle_error(result);
+    }
+    @
+
+    [__@config@__]: Configuration structure (see 'Config_t' )
+
+    [__@data@__]: Input data buffer
+
+    [__@size@__]: Size of input data
+
+    __Returns:__ Status code indicating success or failure
+
+    __Precondition:__ config must not be NULL
+
+    __Precondition:__ data must not be NULL if size > 0
+
+    __Postcondition:__ Output data is written to config->user_data
+
+    __WARNING:__ May return NULL if memory allocation fails
+
+    __WARNING:__ Sets errno to EINVAL if parameters are invalid
+
+    __C declaration:__ @complex_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 459:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+complex_function_funptr :: FunPtr (Ptr Config_t ->
+                                   PtrConst HsBindgen.Runtime.LibC.Word8 ->
+                                   HsBindgen.Runtime.LibC.CSize -> IO Status_code_t)
+{-| Function with complex documentation.
+
+    This function demonstrates multiple documentation features:
+
+    __Description:__
+
+    Performs complex data processing with multiple steps.
+
+    __Algorithm:__
+
+    1. Validate input parameters
+
+    2. Allocate temporary buffers
+
+    3. Process data in chunks
+
+    4. Clean up resources
+
+    __Algorithm2:__
+
+    * Validate input parameters
+
+    * Allocate temporary buffers
+
+    * Process data in chunks
+
+    * Clean up resources
+
+    __Example:__
+
+    @
+    config_t cfg = {
+        .id = 1,
+        .name = "test",
+        .flags = 0,
+        .callback = my_callback,
+        .user_data = NULL
+    };
+
+    status_code_t result = complex_function(&cfg, data, size);
+    if (result != STATUS_OK) {
+        handle_error(result);
+    }
+    @
+
+    [__@config@__]: Configuration structure (see 'Config_t' )
+
+    [__@data@__]: Input data buffer
+
+    [__@size@__]: Size of input data
+
+    __Returns:__ Status code indicating success or failure
+
+    __Precondition:__ config must not be NULL
+
+    __Precondition:__ data must not be NULL if size > 0
+
+    __Postcondition:__ Output data is written to config->user_data
+
+    __WARNING:__ May return NULL if memory allocation fails
+
+    __WARNING:__ Sets errno to EINVAL if parameters are invalid
+
+    __C declaration:__ @complex_function@
+
+    __defined at:__ @documentation\/doxygen_docs.h 459:15@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+complex_function_funptr = unsafePerformIO hs_bindgen_dfa39b6be50cb2ca
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_hash@
+foreign import ccall unsafe "hs_bindgen_8ad88b79fd71f9d4" hs_bindgen_8ad88b79fd71f9d4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_hash@
+hs_bindgen_8ad88b79fd71f9d4 :: IO (FunPtr (Ptr CChar -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_hash@
+hs_bindgen_8ad88b79fd71f9d4 = fmap fromFFIType hs_bindgen_8ad88b79fd71f9d4_base
+{-# NOINLINE hash_funptr #-}
+{-| __C declaration:__ @hash@
+
+    __defined at:__ @documentation\/doxygen_docs.h 463:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+hash_funptr :: FunPtr (Ptr CChar -> IO CInt)
+{-| __C declaration:__ @hash@
+
+    __defined at:__ @documentation\/doxygen_docs.h 463:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+hash_funptr = unsafePerformIO hs_bindgen_8ad88b79fd71f9d4
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_square@
+foreign import ccall unsafe "hs_bindgen_7ede0f7ec1b30650" hs_bindgen_7ede0f7ec1b30650_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_square@
+hs_bindgen_7ede0f7ec1b30650 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_square@
+hs_bindgen_7ede0f7ec1b30650 = fmap fromFFIType hs_bindgen_7ede0f7ec1b30650_base
+{-# NOINLINE square_funptr #-}
+{-| __C declaration:__ @square@
+
+    __defined at:__ @documentation\/doxygen_docs.h 465:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+square_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @square@
+
+    __defined at:__ @documentation\/doxygen_docs.h 465:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+square_funptr = unsafePerformIO hs_bindgen_7ede0f7ec1b30650
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_auto_brief_func@
+foreign import ccall unsafe "hs_bindgen_11a28326d5a28a43" hs_bindgen_11a28326d5a28a43_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_auto_brief_func@
+hs_bindgen_11a28326d5a28a43 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_auto_brief_func@
+hs_bindgen_11a28326d5a28a43 = fmap fromFFIType hs_bindgen_11a28326d5a28a43_base
+{-# NOINLINE auto_brief_func_funptr #-}
+{-| Auto-brief function without explicit @brief tag.
+
+    This tests that the first sentence is used as the brief description when no explicit @brief is present.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The negated value
+
+    __C declaration:__ @auto_brief_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 486:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+auto_brief_func_funptr :: FunPtr (CInt -> IO CInt)
+{-| Auto-brief function without explicit @brief tag.
+
+    This tests that the first sentence is used as the brief description when no explicit @brief is present.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The negated value
+
+    __C declaration:__ @auto_brief_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 486:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+auto_brief_func_funptr = unsafePerformIO hs_bindgen_11a28326d5a28a43
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_multi_paragraph_details@
+foreign import ccall unsafe "hs_bindgen_05c7a7832fb84e2e" hs_bindgen_05c7a7832fb84e2e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_multi_paragraph_details@
+hs_bindgen_05c7a7832fb84e2e :: IO (FunPtr (Ptr CChar ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_multi_paragraph_details@
+hs_bindgen_05c7a7832fb84e2e = fmap fromFFIType hs_bindgen_05c7a7832fb84e2e_base
+{-# NOINLINE multi_paragraph_details_funptr #-}
+{-| Multi-paragraph details.
+
+    First paragraph of the detailed description. This explains the basic purpose of the function.
+
+    Second paragraph with more context. This includes information about the algorithm and its complexity, which is O(n) in the input size.
+
+    Third paragraph with usage notes. Callers should ensure that the buffer is large enough before calling this function.
+
+    [__@buf@__]: Output buffer
+
+    [__@len@__]: Buffer length
+
+    __C declaration:__ @multi_paragraph_details@
+
+    __defined at:__ @documentation\/doxygen_docs.h 503:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+multi_paragraph_details_funptr :: FunPtr (Ptr CChar ->
+                                          HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| Multi-paragraph details.
+
+    First paragraph of the detailed description. This explains the basic purpose of the function.
+
+    Second paragraph with more context. This includes information about the algorithm and its complexity, which is O(n) in the input size.
+
+    Third paragraph with usage notes. Callers should ensure that the buffer is large enough before calling this function.
+
+    [__@buf@__]: Output buffer
+
+    [__@len@__]: Buffer length
+
+    __C declaration:__ @multi_paragraph_details@
+
+    __defined at:__ @documentation\/doxygen_docs.h 503:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+multi_paragraph_details_funptr = unsafePerformIO hs_bindgen_05c7a7832fb84e2e
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_todo_remark_attention@
+foreign import ccall unsafe "hs_bindgen_092b9697f2154ac5" hs_bindgen_092b9697f2154ac5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_todo_remark_attention@
+hs_bindgen_092b9697f2154ac5 :: IO (FunPtr (CInt -> IO (Ptr CInt)))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_todo_remark_attention@
+hs_bindgen_092b9697f2154ac5 = fmap fromFFIType hs_bindgen_092b9697f2154ac5_base
+{-# NOINLINE todo_remark_attention_funptr #-}
+{-| Function with @todo and @remark.
+
+    __Todo:__ Optimize this function for large inputs
+
+    Add support for negative values
+
+    __Remark:__ This function is thread-safe
+
+    __ATTENTION:__ The caller must free the returned pointer
+
+    [__@n@__]: Input count
+
+    __Returns:__ Allocated array
+
+    __C declaration:__ @todo_remark_attention@
+
+    __defined at:__ @documentation\/doxygen_docs.h 516:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+todo_remark_attention_funptr :: FunPtr (CInt -> IO (Ptr CInt))
+{-| Function with @todo and @remark.
+
+    __Todo:__ Optimize this function for large inputs
+
+    Add support for negative values
+
+    __Remark:__ This function is thread-safe
+
+    __ATTENTION:__ The caller must free the returned pointer
+
+    [__@n@__]: Input count
+
+    __Returns:__ Allocated array
+
+    __C declaration:__ @todo_remark_attention@
+
+    __defined at:__ @documentation\/doxygen_docs.h 516:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+todo_remark_attention_funptr = unsafePerformIO hs_bindgen_092b9697f2154ac5
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_entities_func@
+foreign import ccall unsafe "hs_bindgen_2e8b5e895e58fc3d" hs_bindgen_2e8b5e895e58fc3d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_entities_func@
+hs_bindgen_2e8b5e895e58fc3d :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_html_entities_func@
+hs_bindgen_2e8b5e895e58fc3d = fmap fromFFIType hs_bindgen_2e8b5e895e58fc3d_base
+{-# NOINLINE html_entities_func_funptr #-}
+{-| HTML entities: & means AND, <tag> is a tag.
+
+    Handles values < 0 and values > 100 differently. Copyright 2025.
+
+    [__@x@__]: Input (> 0 required)
+
+    __Returns:__ Result code
+
+    __C declaration:__ @html_entities_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 538:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_entities_func_funptr :: FunPtr (CInt -> IO CInt)
+{-| HTML entities: & means AND, <tag> is a tag.
+
+    Handles values < 0 and values > 100 differently. Copyright 2025.
+
+    [__@x@__]: Input (> 0 required)
+
+    __Returns:__ Result code
+
+    __C declaration:__ @html_entities_func@
+
+    __defined at:__ @documentation\/doxygen_docs.h 538:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+html_entities_func_funptr = unsafePerformIO hs_bindgen_2e8b5e895e58fc3d
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_nested_inline_format@
+foreign import ccall unsafe "hs_bindgen_db292926f05c7b36" hs_bindgen_db292926f05c7b36_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_nested_inline_format@
+hs_bindgen_db292926f05c7b36 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_nested_inline_format@
+hs_bindgen_db292926f05c7b36 = fmap fromFFIType hs_bindgen_db292926f05c7b36_base
+{-# NOINLINE nested_inline_format_funptr #-}
+{-| Nested inline: __bold__ , @code@ , __@bold_code@ ,__ /__emph_bold__ ./
+
+    [__@x@__]: Input value
+
+    __C declaration:__ @nested_inline_format@
+
+    __defined at:__ @documentation\/doxygen_docs.h 545:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+nested_inline_format_funptr :: FunPtr (CInt -> IO ())
+{-| Nested inline: __bold__ , @code@ , __@bold_code@ ,__ /__emph_bold__ ./
+
+    [__@x@__]: Input value
+
+    __C declaration:__ @nested_inline_format@
+
+    __defined at:__ @documentation\/doxygen_docs.h 545:6@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+nested_inline_format_funptr = unsafePerformIO hs_bindgen_db292926f05c7b36
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_tagged_code_example@
+foreign import ccall unsafe "hs_bindgen_492a4fd860afb02a" hs_bindgen_492a4fd860afb02a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_tagged_code_example@
+hs_bindgen_492a4fd860afb02a :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_tagged_code_example@
+hs_bindgen_492a4fd860afb02a = fmap fromFFIType hs_bindgen_492a4fd860afb02a_base
+{-# NOINLINE tagged_code_example_funptr #-}
+{-| Language-tagged code block.
+
+    Example usage:
+
+    @
+    int result = tagged_code_example(42);
+    printf("Result: %d\n", result);
+    @
+
+    [__@x@__]: Input value
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @tagged_code_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 559:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+tagged_code_example_funptr :: FunPtr (CInt -> IO CInt)
+{-| Language-tagged code block.
+
+    Example usage:
+
+    @
+    int result = tagged_code_example(42);
+    printf("Result: %d\n", result);
+    @
+
+    [__@x@__]: Input value
+
+    __Returns:__ Processed value
+
+    __C declaration:__ @tagged_code_example@
+
+    __defined at:__ @documentation\/doxygen_docs.h 559:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+tagged_code_example_funptr = unsafePerformIO hs_bindgen_492a4fd860afb02a
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_backslash_syntax@
+foreign import ccall unsafe "hs_bindgen_9ef09ad63fac68e2" hs_bindgen_9ef09ad63fac68e2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_backslash_syntax@
+hs_bindgen_9ef09ad63fac68e2 :: IO (FunPtr (PtrConst CChar ->
+                                           Ptr CChar -> IO CInt))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_backslash_syntax@
+hs_bindgen_9ef09ad63fac68e2 = fmap fromFFIType hs_bindgen_9ef09ad63fac68e2_base
+{-# NOINLINE backslash_syntax_funptr #-}
+{-| Function documented with backslash syntax.
+
+    This function uses backslash commands instead of @ commands to verify both syntaxes are handled equivalently.
+
+    [__@input@__]: The input string
+
+    [__@output@__]: The output buffer
+
+    __Returns:__ Number of bytes written
+
+    __See:__ 'auto_brief_func'
+
+    @since 2.0
+
+    __C declaration:__ @backslash_syntax@
+
+    __defined at:__ @documentation\/doxygen_docs.h 574:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+backslash_syntax_funptr :: FunPtr (PtrConst CChar ->
+                                   Ptr CChar -> IO CInt)
+{-| Function documented with backslash syntax.
+
+    This function uses backslash commands instead of @ commands to verify both syntaxes are handled equivalently.
+
+    [__@input@__]: The input string
+
+    [__@output@__]: The output buffer
+
+    __Returns:__ Number of bytes written
+
+    __See:__ 'auto_brief_func'
+
+    @since 2.0
+
+    __C declaration:__ @backslash_syntax@
+
+    __defined at:__ @documentation\/doxygen_docs.h 574:5@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+backslash_syntax_funptr = unsafePerformIO hs_bindgen_9ef09ad63fac68e2
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_global_counter@
+foreign import ccall unsafe "hs_bindgen_f9dede86496f59c9" hs_bindgen_f9dede86496f59c9_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_global_counter@
+hs_bindgen_f9dede86496f59c9 :: IO (Ptr CInt)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_global_counter@
+hs_bindgen_f9dede86496f59c9 = fmap fromFFIType hs_bindgen_f9dede86496f59c9_base
+{-# NOINLINE global_counter #-}
+{-| Global counter variable.
+
+    This variable tracks the number of operations performed.
+
+    __C declaration:__ @global_counter@
+
+    __defined at:__ @documentation\/doxygen_docs.h 63:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+global_counter :: Ptr CInt
+{-| Global counter variable.
+
+    This variable tracks the number of operations performed.
+
+    __C declaration:__ @global_counter@
+
+    __defined at:__ @documentation\/doxygen_docs.h 63:12@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+global_counter = unsafePerformIO hs_bindgen_f9dede86496f59c9
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_version_string@
+foreign import ccall unsafe "hs_bindgen_a294be08386c9257" hs_bindgen_a294be08386c9257_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_version_string@
+hs_bindgen_a294be08386c9257 :: IO (Ptr (PtrConst CChar))
+-- __unique:__ @test_documentationdoxygen_docs_Example_get_version_string@
+hs_bindgen_a294be08386c9257 = fmap fromFFIType hs_bindgen_a294be08386c9257_base
+{-# NOINLINE version_string #-}
+{-| Version string constant.
+
+    __C declaration:__ @version_string@
+
+    __defined at:__ @documentation\/doxygen_docs.h 69:20@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+version_string :: Ptr (PtrConst CChar)
+{-| Version string constant.
+
+    __C declaration:__ @version_string@
+
+    __defined at:__ @documentation\/doxygen_docs.h 69:20@
+
+    __exported by:__ @documentation\/doxygen_docs.h@
+-}
+version_string = unsafePerformIO hs_bindgen_a294be08386c9257
diff --git a/test-artefacts/fixtures/documentation/javadoc_banner/Example.hs b/test-artefacts/fixtures/documentation/javadoc_banner/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/javadoc_banner/Example.hs
@@ -0,0 +1,146 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Banner_point(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| A struct documented with a Javadoc banner comment.
+
+    __C declaration:__ @struct banner_point@
+
+    __defined at:__ @documentation\/javadoc_banner.h 19:8@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+data Banner_point = Banner_point
+  { banner_point_x :: BG.CInt
+    {- ^ X coordinate
+
+         __C declaration:__ @x@
+
+         __defined at:__ @documentation\/javadoc_banner.h 23:9@
+
+         __exported by:__ @documentation\/javadoc_banner.h@
+    -}
+  , banner_point_y :: BG.CInt
+    {- ^ Y coordinate
+
+         __C declaration:__ @y@
+
+         __defined at:__ @documentation\/javadoc_banner.h 28:9@
+
+         __exported by:__ @documentation\/javadoc_banner.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Banner_point where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Banner_point where
+
+  readRaw =
+    \ptr0 ->
+          pure Banner_point
+      <*> HasCField.readRaw (BG.Proxy @"banner_point_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"banner_point_y") ptr0
+
+instance Marshal.WriteRaw Banner_point where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Banner_point banner_point_x2 banner_point_y3 ->
+               HasCField.writeRaw (BG.Proxy @"banner_point_x") ptr0 banner_point_x2
+            >> HasCField.writeRaw (BG.Proxy @"banner_point_y") ptr0 banner_point_y3
+
+deriving via Marshal.EquivStorable Banner_point instance BG.Storable Banner_point
+
+deriving via Struct.IsStructViaReadRaw Banner_point instance Struct.IsStruct Banner_point
+
+{-| X coordinate
+
+    __C declaration:__ @x@
+
+    __defined at:__ @documentation\/javadoc_banner.h 23:9@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "banner_point_x" Banner_point ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Banner_point {banner_point_x = y1, banner_point_y = BG.getField @"banner_point_y" x0}
+      , BG.getField @"banner_point_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "banner_point_x" (BG.Ptr Banner_point) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"banner_point_x")
+
+instance HasCField.HasCField Banner_point "banner_point_x" where
+
+  type CFieldType Banner_point "banner_point_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Y coordinate
+
+    __C declaration:__ @y@
+
+    __defined at:__ @documentation\/javadoc_banner.h 28:9@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "banner_point_y" Banner_point ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Banner_point {banner_point_y = y1, banner_point_x = BG.getField @"banner_point_x" x0}
+      , BG.getField @"banner_point_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "banner_point_y" (BG.Ptr Banner_point) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"banner_point_y")
+
+instance HasCField.HasCField Banner_point "banner_point_y" where
+
+  type CFieldType Banner_point "banner_point_y" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/documentation/javadoc_banner/Example/FunPtr.hs b/test-artefacts/fixtures/documentation/javadoc_banner/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/javadoc_banner/Example/FunPtr.hs
@@ -0,0 +1,53 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.banner_double
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <documentation/javadoc_banner.h>"
+  , "/* test_documentationjavadoc_banner_Example_get_banner_double */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_57ce95431493ea3f (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &banner_double;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_documentationjavadoc_banner_Example_get_banner_double@
+foreign import ccall unsafe "hs_bindgen_57ce95431493ea3f" hs_bindgen_57ce95431493ea3f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_documentationjavadoc_banner_Example_get_banner_double@
+hs_bindgen_57ce95431493ea3f :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_57ce95431493ea3f =
+  fmap BG.fromFFIType hs_bindgen_57ce95431493ea3f_base
+
+{-# NOINLINE banner_double #-}
+{-| A function documented with a Javadoc banner-style comment.
+
+    The decorative asterisks should be stripped by doxygen, producing clean documentation without any '*' noise.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The doubled value
+
+    __C declaration:__ @banner_double@
+
+    __defined at:__ @documentation\/javadoc_banner.h 14:5@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+banner_double :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+banner_double =
+  BG.unsafePerformIO hs_bindgen_57ce95431493ea3f
diff --git a/test-artefacts/fixtures/documentation/javadoc_banner/Example/Safe.hs b/test-artefacts/fixtures/documentation/javadoc_banner/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/javadoc_banner/Example/Safe.hs
@@ -0,0 +1,61 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.banner_double
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <documentation/javadoc_banner.h>"
+  , "signed int hs_bindgen_7d3fd818d0780e11 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (banner_double)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_documentationjavadoc_banner_Example_Safe_banner_double@
+foreign import ccall safe "hs_bindgen_7d3fd818d0780e11" hs_bindgen_7d3fd818d0780e11_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationjavadoc_banner_Example_Safe_banner_double@
+hs_bindgen_7d3fd818d0780e11 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_7d3fd818d0780e11 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7d3fd818d0780e11_base (BG.toFFIType x0))
+
+{-| A function documented with a Javadoc banner-style comment.
+
+    The decorative asterisks should be stripped by doxygen, producing clean documentation without any '*' noise.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The doubled value
+
+    __C declaration:__ @banner_double@
+
+    __defined at:__ @documentation\/javadoc_banner.h 14:5@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+banner_double ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: The input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+banner_double = hs_bindgen_7d3fd818d0780e11
diff --git a/test-artefacts/fixtures/documentation/javadoc_banner/Example/Unsafe.hs b/test-artefacts/fixtures/documentation/javadoc_banner/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/javadoc_banner/Example/Unsafe.hs
@@ -0,0 +1,61 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.banner_double
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <documentation/javadoc_banner.h>"
+  , "signed int hs_bindgen_3d6508e65f7dad3c ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (banner_double)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_documentationjavadoc_banner_Example_Unsafe_banner_double@
+foreign import ccall unsafe "hs_bindgen_3d6508e65f7dad3c" hs_bindgen_3d6508e65f7dad3c_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_documentationjavadoc_banner_Example_Unsafe_banner_double@
+hs_bindgen_3d6508e65f7dad3c ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_3d6508e65f7dad3c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3d6508e65f7dad3c_base (BG.toFFIType x0))
+
+{-| A function documented with a Javadoc banner-style comment.
+
+    The decorative asterisks should be stripped by doxygen, producing clean documentation without any '*' noise.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The doubled value
+
+    __C declaration:__ @banner_double@
+
+    __defined at:__ @documentation\/javadoc_banner.h 14:5@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+banner_double ::
+     BG.CInt
+     {- ^
+
+          [__@x@__]: The input value
+
+          __C declaration:__ @x@
+     -}
+  -> IO BG.CInt
+banner_double = hs_bindgen_3d6508e65f7dad3c
diff --git a/test-artefacts/fixtures/documentation/javadoc_banner/bindingspec.yaml b/test-artefacts/fixtures/documentation/javadoc_banner/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/javadoc_banner/bindingspec.yaml
@@ -0,0 +1,29 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: documentation/javadoc_banner.h
+  cname: struct banner_point
+  hsname: Banner_point
+hstypes:
+- hsname: Banner_point
+  representation:
+    record:
+      constructor: Banner_point
+      fields:
+      - banner_point_x
+      - banner_point_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/documentation/javadoc_banner/th.txt b/test-artefacts/fixtures/documentation/javadoc_banner/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/documentation/javadoc_banner/th.txt
@@ -0,0 +1,195 @@
+-- addDependentFile test-artefacts/headers/golden/documentation/javadoc_banner.h
+-- #include <documentation/javadoc_banner.h>
+-- signed int hs_bindgen_7d3fd818d0780e11 (
+--   signed int arg1
+-- )
+-- {
+--   return (banner_double)(arg1);
+-- }
+-- signed int hs_bindgen_3d6508e65f7dad3c (
+--   signed int arg1
+-- )
+-- {
+--   return (banner_double)(arg1);
+-- }
+-- /* test_documentationjavadoc_banner_Example_get_banner_double */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_57ce95431493ea3f (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &banner_double;
+-- }
+{-| A struct documented with a Javadoc banner comment.
+
+    __C declaration:__ @struct banner_point@
+
+    __defined at:__ @documentation\/javadoc_banner.h 19:8@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+data Banner_point
+    = Banner_point {banner_point_x :: CInt
+                    {- ^ X coordinate
+
+                         __C declaration:__ @x@
+
+                         __defined at:__ @documentation\/javadoc_banner.h 23:9@
+
+                         __exported by:__ @documentation\/javadoc_banner.h@
+                    -},
+                    banner_point_y :: CInt
+                    {- ^ Y coordinate
+
+                         __C declaration:__ @y@
+
+                         __defined at:__ @documentation\/javadoc_banner.h 28:9@
+
+                         __exported by:__ @documentation\/javadoc_banner.h@
+                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Banner_point
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Banner_point
+    where readRaw = \ptr_0 -> (pure Banner_point <*> readRaw (Proxy @"banner_point_x") ptr_0) <*> readRaw (Proxy @"banner_point_y") ptr_0
+instance WriteRaw Banner_point
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Banner_point banner_point_x_2
+                                                    banner_point_y_3 -> writeRaw (Proxy @"banner_point_x") ptr_0 banner_point_x_2 >> writeRaw (Proxy @"banner_point_y") ptr_0 banner_point_y_3
+deriving via (EquivStorable Banner_point) instance Storable Banner_point
+deriving via (IsStructViaReadRaw Banner_point) instance IsStruct Banner_point
+instance (~) ty CInt => HasField "banner_point_x" Banner_point ty
+    where hasField = \x_0 -> (\y_1 -> Banner_point{banner_point_x = y_1,
+                                                   banner_point_y = getField @"banner_point_y" x_0},
+                              getField @"banner_point_x" x_0)
+instance (~) ty CInt =>
+         HasField "banner_point_x" (Ptr Banner_point) (Ptr ty)
+    where getField = fromPtr (Proxy @"banner_point_x")
+instance HasCField Banner_point "banner_point_x"
+    where type CFieldType Banner_point "banner_point_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "banner_point_y" Banner_point ty
+    where hasField = \x_0 -> (\y_1 -> Banner_point{banner_point_y = y_1,
+                                                   banner_point_x = getField @"banner_point_x" x_0},
+                              getField @"banner_point_y" x_0)
+instance (~) ty CInt =>
+         HasField "banner_point_y" (Ptr Banner_point) (Ptr ty)
+    where getField = fromPtr (Proxy @"banner_point_y")
+instance HasCField Banner_point "banner_point_y"
+    where type CFieldType Banner_point "banner_point_y" = CInt
+          offset# = \_ -> \_ -> 4
+-- __unique:__ @test_documentationjavadoc_banner_Example_Safe_banner_double@
+foreign import ccall safe "hs_bindgen_7d3fd818d0780e11" hs_bindgen_7d3fd818d0780e11_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationjavadoc_banner_Example_Safe_banner_double@
+hs_bindgen_7d3fd818d0780e11 :: CInt -> IO CInt
+-- __unique:__ @test_documentationjavadoc_banner_Example_Safe_banner_double@
+hs_bindgen_7d3fd818d0780e11 = \x_0 -> fmap fromFFIType (hs_bindgen_7d3fd818d0780e11_base (toFFIType x_0))
+{-| A function documented with a Javadoc banner-style comment.
+
+    The decorative asterisks should be stripped by doxygen, producing clean documentation without any '*' noise.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The doubled value
+
+    __C declaration:__ @banner_double@
+
+    __defined at:__ @documentation\/javadoc_banner.h 14:5@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+banner_double_safe :: CInt -> IO CInt
+{-| A function documented with a Javadoc banner-style comment.
+
+    The decorative asterisks should be stripped by doxygen, producing clean documentation without any '*' noise.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The doubled value
+
+    __C declaration:__ @banner_double@
+
+    __defined at:__ @documentation\/javadoc_banner.h 14:5@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+banner_double_safe = hs_bindgen_7d3fd818d0780e11
+-- __unique:__ @test_documentationjavadoc_banner_Example_Unsafe_banner_double@
+foreign import ccall unsafe "hs_bindgen_3d6508e65f7dad3c" hs_bindgen_3d6508e65f7dad3c_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_documentationjavadoc_banner_Example_Unsafe_banner_double@
+hs_bindgen_3d6508e65f7dad3c :: CInt -> IO CInt
+-- __unique:__ @test_documentationjavadoc_banner_Example_Unsafe_banner_double@
+hs_bindgen_3d6508e65f7dad3c = \x_0 -> fmap fromFFIType (hs_bindgen_3d6508e65f7dad3c_base (toFFIType x_0))
+{-| A function documented with a Javadoc banner-style comment.
+
+    The decorative asterisks should be stripped by doxygen, producing clean documentation without any '*' noise.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The doubled value
+
+    __C declaration:__ @banner_double@
+
+    __defined at:__ @documentation\/javadoc_banner.h 14:5@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+banner_double_unsafe :: CInt -> IO CInt
+{-| A function documented with a Javadoc banner-style comment.
+
+    The decorative asterisks should be stripped by doxygen, producing clean documentation without any '*' noise.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The doubled value
+
+    __C declaration:__ @banner_double@
+
+    __defined at:__ @documentation\/javadoc_banner.h 14:5@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+banner_double_unsafe = hs_bindgen_3d6508e65f7dad3c
+-- __unique:__ @test_documentationjavadoc_banner_Example_get_banner_double@
+foreign import ccall unsafe "hs_bindgen_57ce95431493ea3f" hs_bindgen_57ce95431493ea3f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_documentationjavadoc_banner_Example_get_banner_double@
+hs_bindgen_57ce95431493ea3f :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_documentationjavadoc_banner_Example_get_banner_double@
+hs_bindgen_57ce95431493ea3f = fmap fromFFIType hs_bindgen_57ce95431493ea3f_base
+{-# NOINLINE banner_double_funptr #-}
+{-| A function documented with a Javadoc banner-style comment.
+
+    The decorative asterisks should be stripped by doxygen, producing clean documentation without any '*' noise.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The doubled value
+
+    __C declaration:__ @banner_double@
+
+    __defined at:__ @documentation\/javadoc_banner.h 14:5@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+banner_double_funptr :: FunPtr (CInt -> IO CInt)
+{-| A function documented with a Javadoc banner-style comment.
+
+    The decorative asterisks should be stripped by doxygen, producing clean documentation without any '*' noise.
+
+    [__@x@__]: The input value
+
+    __Returns:__ The doubled value
+
+    __C declaration:__ @banner_double@
+
+    __defined at:__ @documentation\/javadoc_banner.h 14:5@
+
+    __exported by:__ @documentation\/javadoc_banner.h@
+-}
+banner_double_funptr = unsafePerformIO hs_bindgen_57ce95431493ea3f
diff --git a/test-artefacts/fixtures/edge-cases/adios/Example.hs b/test-artefacts/fixtures/edge-cases/adios/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/adios/Example.hs
@@ -0,0 +1,124 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Adio'0301s(..)
+    , Example.C数字(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @adiós@
+
+    __defined at:__ @edge-cases\/adios.h 7:13@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+newtype Adio'0301s = Adio'0301s
+  { unwrapAdio'0301s :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapAdio'0301s" Adio'0301s ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Adio'0301s {unwrapAdio'0301s = y1}
+      , BG.getField @"unwrapAdio'0301s" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapAdio'0301s" (BG.Ptr Adio'0301s) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapAdio'0301s")
+
+instance HasCField.HasCField Adio'0301s "unwrapAdio'0301s" where
+
+  type CFieldType Adio'0301s "unwrapAdio'0301s" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @数字@
+
+    __defined at:__ @edge-cases\/adios.h 17:13@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+newtype C数字 = C数字
+  { unwrapC数字 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapC\25968\23383" C数字 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         C数字 {unwrapC数字 = y1}, BG.getField @"unwrapC\25968\23383" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapC\25968\23383" (BG.Ptr C数字) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapC\25968\23383")
+
+instance HasCField.HasCField C数字 "unwrapC\25968\23383" where
+
+  type CFieldType C数字 "unwrapC\25968\23383" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/edge-cases/adios/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/adios/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/adios/Example/FunPtr.hs
@@ -0,0 +1,122 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.adio'0301s_fun
+    , Example.FunPtr.cϒ
+    , Example.FunPtr.拜拜
+    , Example.FunPtr.say拜拜
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/adios.h>"
+  , "/* test_edgecasesadios_Example_get_adio\769s_fun */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_4ac23afef85d3af0 (void)) (void)"
+  , "{"
+  , "  return &adio\769s_fun;"
+  , "}"
+  , "/* test_edgecasesadios_Example_get_\978 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0b1168f405aafe83 (void)) (void)"
+  , "{"
+  , "  return &\978;"
+  , "}"
+  , "/* test_edgecasesadios_Example_get_\25308\25308 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0a95358747546f1b (void)) (void)"
+  , "{"
+  , "  return &\25308\25308;"
+  , "}"
+  , "/* test_edgecasesadios_Example_get_Say\25308\25308 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a01e420336bfa879 (void)) (void)"
+  , "{"
+  , "  return &Say\25308\25308;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesadios_Example_get_adiós_fun@
+foreign import ccall unsafe "hs_bindgen_4ac23afef85d3af0" hs_bindgen_4ac23afef85d3af0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesadios_Example_get_adiós_fun@
+hs_bindgen_4ac23afef85d3af0 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_4ac23afef85d3af0 =
+  fmap BG.fromFFIType hs_bindgen_4ac23afef85d3af0_base
+
+{-# NOINLINE adio'0301s_fun #-}
+{-| __C declaration:__ @adiós_fun@
+
+    __defined at:__ @edge-cases\/adios.h 12:5@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+adio'0301s_fun :: BG.FunPtr (IO BG.CInt)
+adio'0301s_fun =
+  BG.unsafePerformIO hs_bindgen_4ac23afef85d3af0
+
+-- __unique:__ @test_edgecasesadios_Example_get_ϒ@
+foreign import ccall unsafe "hs_bindgen_0b1168f405aafe83" hs_bindgen_0b1168f405aafe83_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesadios_Example_get_ϒ@
+hs_bindgen_0b1168f405aafe83 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_0b1168f405aafe83 =
+  fmap BG.fromFFIType hs_bindgen_0b1168f405aafe83_base
+
+{-# NOINLINE cϒ #-}
+{-| __C declaration:__ @ϒ@
+
+    __defined at:__ @edge-cases\/adios.h 23:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒ :: BG.FunPtr (IO ())
+cϒ = BG.unsafePerformIO hs_bindgen_0b1168f405aafe83
+
+-- __unique:__ @test_edgecasesadios_Example_get_拜拜@
+foreign import ccall unsafe "hs_bindgen_0a95358747546f1b" hs_bindgen_0a95358747546f1b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesadios_Example_get_拜拜@
+hs_bindgen_0a95358747546f1b :: IO (BG.FunPtr (IO ()))
+hs_bindgen_0a95358747546f1b =
+  fmap BG.fromFFIType hs_bindgen_0a95358747546f1b_base
+
+{-# NOINLINE 拜拜 #-}
+{-| __C declaration:__ @拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 32:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+拜拜 :: BG.FunPtr (IO ())
+拜拜 = BG.unsafePerformIO hs_bindgen_0a95358747546f1b
+
+-- __unique:__ @test_edgecasesadios_Example_get_Say拜拜@
+foreign import ccall unsafe "hs_bindgen_a01e420336bfa879" hs_bindgen_a01e420336bfa879_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesadios_Example_get_Say拜拜@
+hs_bindgen_a01e420336bfa879 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_a01e420336bfa879 =
+  fmap BG.fromFFIType hs_bindgen_a01e420336bfa879_base
+
+{-# NOINLINE say拜拜 #-}
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 36:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+say拜拜 :: BG.FunPtr (IO ())
+say拜拜 =
+  BG.unsafePerformIO hs_bindgen_a01e420336bfa879
diff --git a/test-artefacts/fixtures/edge-cases/adios/Example/Global.hs b/test-artefacts/fixtures/edge-cases/adios/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/adios/Example/Global.hs
@@ -0,0 +1,77 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.cϒϒ
+    , Example.Global.cϒϒϒ
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/adios.h>"
+  , "/* test_edgecasesadios_Example_get_\978\978 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_aa137b95cfa81f42 (void)"
+  , "{"
+  , "  return &\978\978;"
+  , "}"
+  , "/* test_edgecasesadios_Example_get_\978\978\978 */"
+  , "__attribute__ ((const))"
+  , "signed int const *hs_bindgen_7e61df7271c4ff58 (void)"
+  , "{"
+  , "  return &\978\978\978;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒ@
+foreign import ccall unsafe "hs_bindgen_aa137b95cfa81f42" hs_bindgen_aa137b95cfa81f42_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒ@
+hs_bindgen_aa137b95cfa81f42 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_aa137b95cfa81f42 =
+  fmap BG.fromFFIType hs_bindgen_aa137b95cfa81f42_base
+
+{-# NOINLINE cϒϒ #-}
+{-| __C declaration:__ @ϒϒ@
+
+    __defined at:__ @edge-cases\/adios.h 26:12@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒϒ :: BG.Ptr BG.CInt
+cϒϒ = BG.unsafePerformIO hs_bindgen_aa137b95cfa81f42
+
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒϒ@
+foreign import ccall unsafe "hs_bindgen_7e61df7271c4ff58" hs_bindgen_7e61df7271c4ff58_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒϒ@
+hs_bindgen_7e61df7271c4ff58 :: IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_7e61df7271c4ff58 =
+  fmap BG.fromFFIType hs_bindgen_7e61df7271c4ff58_base
+
+{-# NOINLINE hs_bindgen_7af49c80665b9a25 #-}
+{-| __C declaration:__ @ϒϒϒ@
+
+    __defined at:__ @edge-cases\/adios.h 29:18@
+
+    __exported by:__ @edge-cases\/adios.h@
+
+    __unique:__ @test_edgecasesadios_Example_cϒϒϒ@
+-}
+hs_bindgen_7af49c80665b9a25 :: PtrConst.PtrConst BG.CInt
+hs_bindgen_7af49c80665b9a25 =
+  BG.unsafePerformIO hs_bindgen_7e61df7271c4ff58
+
+{-# NOINLINE cϒϒϒ #-}
+cϒϒϒ :: BG.CInt
+cϒϒϒ =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_7af49c80665b9a25)
diff --git a/test-artefacts/fixtures/edge-cases/adios/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/adios/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/adios/Example/Safe.hs
@@ -0,0 +1,108 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.adio'0301s_fun
+    , Example.Safe.cϒ
+    , Example.Safe.拜拜
+    , Example.Safe.say拜拜
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/adios.h>"
+  , "signed int hs_bindgen_2f6d4be143076044 (void)"
+  , "{"
+  , "  return (adio\769s_fun)();"
+  , "}"
+  , "void hs_bindgen_2010521804ef9a6e (void)"
+  , "{"
+  , "  (\978)();"
+  , "}"
+  , "void hs_bindgen_3bc3e53cc82c9580 (void)"
+  , "{"
+  , "  (\25308\25308)();"
+  , "}"
+  , "void hs_bindgen_ad8eb47027b2d49d (void)"
+  , "{"
+  , "  (Say\25308\25308)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesadios_Example_Safe_adiós_fun@
+foreign import ccall safe "hs_bindgen_2f6d4be143076044" hs_bindgen_2f6d4be143076044_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_edgecasesadios_Example_Safe_adiós_fun@
+hs_bindgen_2f6d4be143076044 :: IO BG.CInt
+hs_bindgen_2f6d4be143076044 =
+  fmap BG.fromFFIType hs_bindgen_2f6d4be143076044_base
+
+{-| __C declaration:__ @adiós_fun@
+
+    __defined at:__ @edge-cases\/adios.h 12:5@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+adio'0301s_fun :: IO BG.CInt
+adio'0301s_fun = hs_bindgen_2f6d4be143076044
+
+-- __unique:__ @test_edgecasesadios_Example_Safe_ϒ@
+foreign import ccall safe "hs_bindgen_2010521804ef9a6e" hs_bindgen_2010521804ef9a6e_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesadios_Example_Safe_ϒ@
+hs_bindgen_2010521804ef9a6e :: IO ()
+hs_bindgen_2010521804ef9a6e =
+  hs_bindgen_2010521804ef9a6e_base
+
+{-| __C declaration:__ @ϒ@
+
+    __defined at:__ @edge-cases\/adios.h 23:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒ :: IO ()
+cϒ = hs_bindgen_2010521804ef9a6e
+
+-- __unique:__ @test_edgecasesadios_Example_Safe_拜拜@
+foreign import ccall safe "hs_bindgen_3bc3e53cc82c9580" hs_bindgen_3bc3e53cc82c9580_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesadios_Example_Safe_拜拜@
+hs_bindgen_3bc3e53cc82c9580 :: IO ()
+hs_bindgen_3bc3e53cc82c9580 =
+  hs_bindgen_3bc3e53cc82c9580_base
+
+{-| __C declaration:__ @拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 32:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+拜拜 :: IO ()
+拜拜 = hs_bindgen_3bc3e53cc82c9580
+
+-- __unique:__ @test_edgecasesadios_Example_Safe_Say拜拜@
+foreign import ccall safe "hs_bindgen_ad8eb47027b2d49d" hs_bindgen_ad8eb47027b2d49d_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesadios_Example_Safe_Say拜拜@
+hs_bindgen_ad8eb47027b2d49d :: IO ()
+hs_bindgen_ad8eb47027b2d49d =
+  hs_bindgen_ad8eb47027b2d49d_base
+
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 36:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+say拜拜 :: IO ()
+say拜拜 = hs_bindgen_ad8eb47027b2d49d
diff --git a/test-artefacts/fixtures/edge-cases/adios/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/adios/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/adios/Example/Unsafe.hs
@@ -0,0 +1,108 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.adio'0301s_fun
+    , Example.Unsafe.cϒ
+    , Example.Unsafe.拜拜
+    , Example.Unsafe.say拜拜
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/adios.h>"
+  , "signed int hs_bindgen_2a3071850c230aa3 (void)"
+  , "{"
+  , "  return (adio\769s_fun)();"
+  , "}"
+  , "void hs_bindgen_1814d14d59d9daf7 (void)"
+  , "{"
+  , "  (\978)();"
+  , "}"
+  , "void hs_bindgen_c1ab9527e537714b (void)"
+  , "{"
+  , "  (\25308\25308)();"
+  , "}"
+  , "void hs_bindgen_d532055af9051fad (void)"
+  , "{"
+  , "  (Say\25308\25308)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_adiós_fun@
+foreign import ccall unsafe "hs_bindgen_2a3071850c230aa3" hs_bindgen_2a3071850c230aa3_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_adiós_fun@
+hs_bindgen_2a3071850c230aa3 :: IO BG.CInt
+hs_bindgen_2a3071850c230aa3 =
+  fmap BG.fromFFIType hs_bindgen_2a3071850c230aa3_base
+
+{-| __C declaration:__ @adiós_fun@
+
+    __defined at:__ @edge-cases\/adios.h 12:5@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+adio'0301s_fun :: IO BG.CInt
+adio'0301s_fun = hs_bindgen_2a3071850c230aa3
+
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_ϒ@
+foreign import ccall unsafe "hs_bindgen_1814d14d59d9daf7" hs_bindgen_1814d14d59d9daf7_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_ϒ@
+hs_bindgen_1814d14d59d9daf7 :: IO ()
+hs_bindgen_1814d14d59d9daf7 =
+  hs_bindgen_1814d14d59d9daf7_base
+
+{-| __C declaration:__ @ϒ@
+
+    __defined at:__ @edge-cases\/adios.h 23:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒ :: IO ()
+cϒ = hs_bindgen_1814d14d59d9daf7
+
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_拜拜@
+foreign import ccall unsafe "hs_bindgen_c1ab9527e537714b" hs_bindgen_c1ab9527e537714b_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_拜拜@
+hs_bindgen_c1ab9527e537714b :: IO ()
+hs_bindgen_c1ab9527e537714b =
+  hs_bindgen_c1ab9527e537714b_base
+
+{-| __C declaration:__ @拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 32:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+拜拜 :: IO ()
+拜拜 = hs_bindgen_c1ab9527e537714b
+
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_Say拜拜@
+foreign import ccall unsafe "hs_bindgen_d532055af9051fad" hs_bindgen_d532055af9051fad_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_Say拜拜@
+hs_bindgen_d532055af9051fad :: IO ()
+hs_bindgen_d532055af9051fad =
+  hs_bindgen_d532055af9051fad_base
+
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 36:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+say拜拜 :: IO ()
+say拜拜 = hs_bindgen_d532055af9051fad
diff --git a/test-artefacts/fixtures/edge-cases/adios/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/adios/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/adios/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/adios.h
+  cname: adiós
+  hsname: Adio'0301s
+- headers: edge-cases/adios.h
+  cname: 数字
+  hsname: C数字
+hstypes:
+- hsname: Adio'0301s
+  representation:
+    newtype:
+      constructor: Adio'0301s
+      fields:
+      - unwrapAdio'0301s
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: C数字
+  representation:
+    newtype:
+      constructor: C数字
+      fields:
+      - unwrapC数字
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/adios/th.txt b/test-artefacts/fixtures/edge-cases/adios/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/adios/th.txt
@@ -0,0 +1,443 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/adios.h
+-- #include <edge-cases/adios.h>
+-- signed int hs_bindgen_2f6d4be143076044 (void)
+-- {
+--   return (adiós_fun)();
+-- }
+-- void hs_bindgen_2010521804ef9a6e (void)
+-- {
+--   (ϒ)();
+-- }
+-- void hs_bindgen_3bc3e53cc82c9580 (void)
+-- {
+--   (拜拜)();
+-- }
+-- void hs_bindgen_ad8eb47027b2d49d (void)
+-- {
+--   (Say拜拜)();
+-- }
+-- signed int hs_bindgen_2a3071850c230aa3 (void)
+-- {
+--   return (adiós_fun)();
+-- }
+-- void hs_bindgen_1814d14d59d9daf7 (void)
+-- {
+--   (ϒ)();
+-- }
+-- void hs_bindgen_c1ab9527e537714b (void)
+-- {
+--   (拜拜)();
+-- }
+-- void hs_bindgen_d532055af9051fad (void)
+-- {
+--   (Say拜拜)();
+-- }
+-- /* test_edgecasesadios_Example_get_adiós_fun */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_4ac23afef85d3af0 (void)) (void)
+-- {
+--   return &adiós_fun;
+-- }
+-- /* test_edgecasesadios_Example_get_ϒ */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0b1168f405aafe83 (void)) (void)
+-- {
+--   return &ϒ;
+-- }
+-- /* test_edgecasesadios_Example_get_拜拜 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0a95358747546f1b (void)) (void)
+-- {
+--   return &拜拜;
+-- }
+-- /* test_edgecasesadios_Example_get_Say拜拜 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a01e420336bfa879 (void)) (void)
+-- {
+--   return &Say拜拜;
+-- }
+-- /* test_edgecasesadios_Example_get_ϒϒ */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_aa137b95cfa81f42 (void)
+-- {
+--   return &ϒϒ;
+-- }
+-- /* test_edgecasesadios_Example_get_ϒϒϒ */
+-- __attribute__ ((const))
+-- signed int const *hs_bindgen_7e61df7271c4ff58 (void)
+-- {
+--   return &ϒϒϒ;
+-- }
+{-| __C declaration:__ @adiós@
+
+    __defined at:__ @edge-cases\/adios.h 7:13@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+newtype Adio'0301s
+    = Adio'0301s {unwrapAdio'0301s :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapAdio'0301s" Adio'0301s ty
+    where hasField = \x_0 -> (\y_1 -> Adio'0301s{unwrapAdio'0301s = y_1},
+                              getField @"unwrapAdio'0301s" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapAdio'0301s" (Ptr Adio'0301s) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapAdio'0301s")
+instance HasCField Adio'0301s "unwrapAdio'0301s"
+    where type CFieldType Adio'0301s "unwrapAdio'0301s" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @数字@
+
+    __defined at:__ @edge-cases\/adios.h 17:13@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+newtype C数字
+    = C数字 {unwrapC数字 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapC\25968\23383" C数字 ty
+    where hasField = \x_0 -> (\y_1 -> C数字{unwrapC数字 = y_1},
+                              getField @"unwrapC\25968\23383" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapC\25968\23383" (Ptr C数字) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapC\25968\23383")
+instance HasCField C数字 "unwrapC\25968\23383"
+    where type CFieldType C数字 "unwrapC\25968\23383" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_edgecasesadios_Example_Safe_adiós_fun@
+foreign import ccall safe "hs_bindgen_2f6d4be143076044" hs_bindgen_2f6d4be143076044_base ::
+    IO CInt
+-- __unique:__ @test_edgecasesadios_Example_Safe_adiós_fun@
+hs_bindgen_2f6d4be143076044 :: IO CInt
+-- __unique:__ @test_edgecasesadios_Example_Safe_adiós_fun@
+hs_bindgen_2f6d4be143076044 = fmap fromFFIType hs_bindgen_2f6d4be143076044_base
+{-| __C declaration:__ @adiós_fun@
+
+    __defined at:__ @edge-cases\/adios.h 12:5@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+adio'0301s_fun_safe :: IO CInt
+{-| __C declaration:__ @adiós_fun@
+
+    __defined at:__ @edge-cases\/adios.h 12:5@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+adio'0301s_fun_safe = hs_bindgen_2f6d4be143076044
+-- __unique:__ @test_edgecasesadios_Example_Safe_ϒ@
+foreign import ccall safe "hs_bindgen_2010521804ef9a6e" hs_bindgen_2010521804ef9a6e_base ::
+    IO ()
+-- __unique:__ @test_edgecasesadios_Example_Safe_ϒ@
+hs_bindgen_2010521804ef9a6e :: IO ()
+-- __unique:__ @test_edgecasesadios_Example_Safe_ϒ@
+hs_bindgen_2010521804ef9a6e = hs_bindgen_2010521804ef9a6e_base
+{-| __C declaration:__ @ϒ@
+
+    __defined at:__ @edge-cases\/adios.h 23:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒ_safe :: IO ()
+{-| __C declaration:__ @ϒ@
+
+    __defined at:__ @edge-cases\/adios.h 23:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒ_safe = hs_bindgen_2010521804ef9a6e
+-- __unique:__ @test_edgecasesadios_Example_Safe_拜拜@
+foreign import ccall safe "hs_bindgen_3bc3e53cc82c9580" hs_bindgen_3bc3e53cc82c9580_base ::
+    IO ()
+-- __unique:__ @test_edgecasesadios_Example_Safe_拜拜@
+hs_bindgen_3bc3e53cc82c9580 :: IO ()
+-- __unique:__ @test_edgecasesadios_Example_Safe_拜拜@
+hs_bindgen_3bc3e53cc82c9580 = hs_bindgen_3bc3e53cc82c9580_base
+{-| __C declaration:__ @拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 32:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+拜拜_safe :: IO ()
+{-| __C declaration:__ @拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 32:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+拜拜_safe = hs_bindgen_3bc3e53cc82c9580
+-- __unique:__ @test_edgecasesadios_Example_Safe_Say拜拜@
+foreign import ccall safe "hs_bindgen_ad8eb47027b2d49d" hs_bindgen_ad8eb47027b2d49d_base ::
+    IO ()
+-- __unique:__ @test_edgecasesadios_Example_Safe_Say拜拜@
+hs_bindgen_ad8eb47027b2d49d :: IO ()
+-- __unique:__ @test_edgecasesadios_Example_Safe_Say拜拜@
+hs_bindgen_ad8eb47027b2d49d = hs_bindgen_ad8eb47027b2d49d_base
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 36:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+say拜拜_safe :: IO ()
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 36:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+say拜拜_safe = hs_bindgen_ad8eb47027b2d49d
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_adiós_fun@
+foreign import ccall unsafe "hs_bindgen_2a3071850c230aa3" hs_bindgen_2a3071850c230aa3_base ::
+    IO CInt
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_adiós_fun@
+hs_bindgen_2a3071850c230aa3 :: IO CInt
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_adiós_fun@
+hs_bindgen_2a3071850c230aa3 = fmap fromFFIType hs_bindgen_2a3071850c230aa3_base
+{-| __C declaration:__ @adiós_fun@
+
+    __defined at:__ @edge-cases\/adios.h 12:5@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+adio'0301s_fun_unsafe :: IO CInt
+{-| __C declaration:__ @adiós_fun@
+
+    __defined at:__ @edge-cases\/adios.h 12:5@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+adio'0301s_fun_unsafe = hs_bindgen_2a3071850c230aa3
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_ϒ@
+foreign import ccall unsafe "hs_bindgen_1814d14d59d9daf7" hs_bindgen_1814d14d59d9daf7_base ::
+    IO ()
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_ϒ@
+hs_bindgen_1814d14d59d9daf7 :: IO ()
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_ϒ@
+hs_bindgen_1814d14d59d9daf7 = hs_bindgen_1814d14d59d9daf7_base
+{-| __C declaration:__ @ϒ@
+
+    __defined at:__ @edge-cases\/adios.h 23:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒ_unsafe :: IO ()
+{-| __C declaration:__ @ϒ@
+
+    __defined at:__ @edge-cases\/adios.h 23:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒ_unsafe = hs_bindgen_1814d14d59d9daf7
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_拜拜@
+foreign import ccall unsafe "hs_bindgen_c1ab9527e537714b" hs_bindgen_c1ab9527e537714b_base ::
+    IO ()
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_拜拜@
+hs_bindgen_c1ab9527e537714b :: IO ()
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_拜拜@
+hs_bindgen_c1ab9527e537714b = hs_bindgen_c1ab9527e537714b_base
+{-| __C declaration:__ @拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 32:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+拜拜_unsafe :: IO ()
+{-| __C declaration:__ @拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 32:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+拜拜_unsafe = hs_bindgen_c1ab9527e537714b
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_Say拜拜@
+foreign import ccall unsafe "hs_bindgen_d532055af9051fad" hs_bindgen_d532055af9051fad_base ::
+    IO ()
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_Say拜拜@
+hs_bindgen_d532055af9051fad :: IO ()
+-- __unique:__ @test_edgecasesadios_Example_Unsafe_Say拜拜@
+hs_bindgen_d532055af9051fad = hs_bindgen_d532055af9051fad_base
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 36:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+say拜拜_unsafe :: IO ()
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 36:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+say拜拜_unsafe = hs_bindgen_d532055af9051fad
+-- __unique:__ @test_edgecasesadios_Example_get_adiós_fun@
+foreign import ccall unsafe "hs_bindgen_4ac23afef85d3af0" hs_bindgen_4ac23afef85d3af0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesadios_Example_get_adiós_fun@
+hs_bindgen_4ac23afef85d3af0 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_edgecasesadios_Example_get_adiós_fun@
+hs_bindgen_4ac23afef85d3af0 = fmap fromFFIType hs_bindgen_4ac23afef85d3af0_base
+{-# NOINLINE adio'0301s_fun_funptr #-}
+{-| __C declaration:__ @adiós_fun@
+
+    __defined at:__ @edge-cases\/adios.h 12:5@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+adio'0301s_fun_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @adiós_fun@
+
+    __defined at:__ @edge-cases\/adios.h 12:5@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+adio'0301s_fun_funptr = unsafePerformIO hs_bindgen_4ac23afef85d3af0
+-- __unique:__ @test_edgecasesadios_Example_get_ϒ@
+foreign import ccall unsafe "hs_bindgen_0b1168f405aafe83" hs_bindgen_0b1168f405aafe83_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesadios_Example_get_ϒ@
+hs_bindgen_0b1168f405aafe83 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesadios_Example_get_ϒ@
+hs_bindgen_0b1168f405aafe83 = fmap fromFFIType hs_bindgen_0b1168f405aafe83_base
+{-# NOINLINE cϒ_funptr #-}
+{-| __C declaration:__ @ϒ@
+
+    __defined at:__ @edge-cases\/adios.h 23:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒ_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @ϒ@
+
+    __defined at:__ @edge-cases\/adios.h 23:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒ_funptr = unsafePerformIO hs_bindgen_0b1168f405aafe83
+-- __unique:__ @test_edgecasesadios_Example_get_拜拜@
+foreign import ccall unsafe "hs_bindgen_0a95358747546f1b" hs_bindgen_0a95358747546f1b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesadios_Example_get_拜拜@
+hs_bindgen_0a95358747546f1b :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesadios_Example_get_拜拜@
+hs_bindgen_0a95358747546f1b = fmap fromFFIType hs_bindgen_0a95358747546f1b_base
+{-# NOINLINE 拜拜_funptr #-}
+{-| __C declaration:__ @拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 32:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+拜拜_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 32:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+拜拜_funptr = unsafePerformIO hs_bindgen_0a95358747546f1b
+-- __unique:__ @test_edgecasesadios_Example_get_Say拜拜@
+foreign import ccall unsafe "hs_bindgen_a01e420336bfa879" hs_bindgen_a01e420336bfa879_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesadios_Example_get_Say拜拜@
+hs_bindgen_a01e420336bfa879 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesadios_Example_get_Say拜拜@
+hs_bindgen_a01e420336bfa879 = fmap fromFFIType hs_bindgen_a01e420336bfa879_base
+{-# NOINLINE say拜拜_funptr #-}
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 36:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+say拜拜_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/adios.h 36:6@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+say拜拜_funptr = unsafePerformIO hs_bindgen_a01e420336bfa879
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒ@
+foreign import ccall unsafe "hs_bindgen_aa137b95cfa81f42" hs_bindgen_aa137b95cfa81f42_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒ@
+hs_bindgen_aa137b95cfa81f42 :: IO (Ptr CInt)
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒ@
+hs_bindgen_aa137b95cfa81f42 = fmap fromFFIType hs_bindgen_aa137b95cfa81f42_base
+{-# NOINLINE cϒϒ #-}
+{-| __C declaration:__ @ϒϒ@
+
+    __defined at:__ @edge-cases\/adios.h 26:12@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒϒ :: Ptr CInt
+{-| __C declaration:__ @ϒϒ@
+
+    __defined at:__ @edge-cases\/adios.h 26:12@
+
+    __exported by:__ @edge-cases\/adios.h@
+-}
+cϒϒ = unsafePerformIO hs_bindgen_aa137b95cfa81f42
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒϒ@
+foreign import ccall unsafe "hs_bindgen_7e61df7271c4ff58" hs_bindgen_7e61df7271c4ff58_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒϒ@
+hs_bindgen_7e61df7271c4ff58 :: IO (PtrConst CInt)
+-- __unique:__ @test_edgecasesadios_Example_get_ϒϒϒ@
+hs_bindgen_7e61df7271c4ff58 = fmap fromFFIType hs_bindgen_7e61df7271c4ff58_base
+{-# NOINLINE hs_bindgen_7af49c80665b9a25 #-}
+{-| __C declaration:__ @ϒϒϒ@
+
+    __defined at:__ @edge-cases\/adios.h 29:18@
+
+    __exported by:__ @edge-cases\/adios.h@
+
+    __unique:__ @test_edgecasesadios_Example_cϒϒϒ@
+-}
+hs_bindgen_7af49c80665b9a25 :: PtrConst CInt
+{-| __C declaration:__ @ϒϒϒ@
+
+    __defined at:__ @edge-cases\/adios.h 29:18@
+
+    __exported by:__ @edge-cases\/adios.h@
+
+    __unique:__ @test_edgecasesadios_Example_cϒϒϒ@
+-}
+hs_bindgen_7af49c80665b9a25 = unsafePerformIO hs_bindgen_7e61df7271c4ff58
+{-# NOINLINE cϒϒϒ #-}
+cϒϒϒ :: CInt
+cϒϒϒ = unsafePerformIO (peek hs_bindgen_7af49c80665b9a25)
diff --git a/test-artefacts/fixtures/edge-cases/aux_funptr_newtypes/Example.hs b/test-artefacts/fixtures/edge-cases/aux_funptr_newtypes/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/aux_funptr_newtypes/Example.hs
@@ -0,0 +1,205 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.FunPtr_Aux(..)
+    , Example.FunPtr(..)
+    , Example.Foo(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, IO, Int, Ord, Show, pure, type (~))
+
+{-| Auxiliary type used by 'FunPtr'
+
+    __C declaration:__ @FunPtr@
+
+    __defined at:__ @edge-cases\/aux_funptr_newtypes.h 6:16@
+
+    __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+-}
+newtype FunPtr_Aux = FunPtr_Aux
+  { unwrapFunPtr_Aux :: Foo -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ (Foo -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapFunPtr_Aux" FunPtr_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> FunPtr_Aux {unwrapFunPtr_Aux = y1}
+      , BG.getField @"unwrapFunPtr_Aux" x0
+      )
+
+instance ( ty ~ (Foo -> IO ())
+         ) => BG.HasField "unwrapFunPtr_Aux" (BG.Ptr FunPtr_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunPtr_Aux")
+
+instance HasCField.HasCField FunPtr_Aux "unwrapFunPtr_Aux" where
+
+  type CFieldType FunPtr_Aux "unwrapFunPtr_Aux" =
+    Foo -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @FunPtr@
+
+    __defined at:__ @edge-cases\/aux_funptr_newtypes.h 6:16@
+
+    __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+-}
+newtype FunPtr = FunPtr
+  { unwrapFunPtr :: BG.FunPtr FunPtr_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr FunPtr_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunPtr" FunPtr ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         FunPtr {unwrapFunPtr = y1}, BG.getField @"unwrapFunPtr" x0)
+
+instance ( ty ~ BG.FunPtr FunPtr_Aux
+         ) => BG.HasField "unwrapFunPtr" (BG.Ptr FunPtr) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunPtr")
+
+instance HasCField.HasCField FunPtr "unwrapFunPtr" where
+
+  type CFieldType FunPtr "unwrapFunPtr" =
+    BG.FunPtr FunPtr_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @edge-cases\/aux_funptr_newtypes.h 8:8@
+
+    __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+-}
+data Foo = Foo
+  { foo_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/aux_funptr_newtypes.h 9:7@
+
+         __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+    -}
+  , foo_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @edge-cases\/aux_funptr_newtypes.h 10:7@
+
+         __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Foo where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo
+      <*> HasCField.readRaw (BG.Proxy @"foo_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"foo_y") ptr0
+
+instance Marshal.WriteRaw Foo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo foo_x2 foo_y3 ->
+               HasCField.writeRaw (BG.Proxy @"foo_x") ptr0 foo_x2
+            >> HasCField.writeRaw (BG.Proxy @"foo_y") ptr0 foo_y3
+
+deriving via Marshal.EquivStorable Foo instance BG.Storable Foo
+
+deriving via Struct.IsStructViaReadRaw Foo instance Struct.IsStruct Foo
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/aux_funptr_newtypes.h 9:7@
+
+    __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_x" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_x = y1, foo_y = BG.getField @"foo_y" x0}
+      , BG.getField @"foo_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "foo_x" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_x")
+
+instance HasCField.HasCField Foo "foo_x" where
+
+  type CFieldType Foo "foo_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @edge-cases\/aux_funptr_newtypes.h 10:7@
+
+    __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_y" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_y = y1, foo_x = BG.getField @"foo_x" x0}
+      , BG.getField @"foo_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "foo_y" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_y")
+
+instance HasCField.HasCField Foo "foo_y" where
+
+  type CFieldType Foo "foo_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/edge-cases/aux_funptr_newtypes/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/aux_funptr_newtypes/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/aux_funptr_newtypes/bindingspec.yaml
@@ -0,0 +1,55 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/aux_funptr_newtypes.h
+  cname: FunPtr
+  hsname: FunPtr
+- headers: edge-cases/aux_funptr_newtypes.h
+  cname: struct foo
+  hsname: Foo
+hstypes:
+- hsname: Foo
+  representation:
+    record:
+      constructor: Foo
+      fields:
+      - foo_x
+      - foo_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: FunPtr
+  representation:
+    newtype:
+      constructor: FunPtr
+      fields:
+      - unwrapFunPtr
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/aux_funptr_newtypes/th.txt b/test-artefacts/fixtures/edge-cases/aux_funptr_newtypes/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/aux_funptr_newtypes/th.txt
@@ -0,0 +1,97 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/aux_funptr_newtypes.h
+{-| Auxiliary type used by 'FunPtr'
+
+    __C declaration:__ @FunPtr@
+
+    __defined at:__ @edge-cases\/aux_funptr_newtypes.h 6:16@
+
+    __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+-}
+newtype FunPtr_Aux
+    = FunPtr_Aux {unwrapFunPtr_Aux :: (Foo -> IO ())}
+    deriving stock Generic
+instance (~) ty (Foo -> IO ()) =>
+         HasField "unwrapFunPtr_Aux" FunPtr_Aux ty
+    where hasField = \x_0 -> (\y_1 -> FunPtr_Aux{unwrapFunPtr_Aux = y_1},
+                              getField @"unwrapFunPtr_Aux" x_0)
+instance (~) ty (Foo -> IO ()) =>
+         HasField "unwrapFunPtr_Aux" (Ptr FunPtr_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunPtr_Aux")
+instance HasCField FunPtr_Aux "unwrapFunPtr_Aux"
+    where type CFieldType FunPtr_Aux "unwrapFunPtr_Aux" = Foo -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @FunPtr@
+
+    __defined at:__ @edge-cases\/aux_funptr_newtypes.h 6:16@
+
+    __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+-}
+newtype FunPtr
+    = FunPtr {unwrapFunPtr :: (FunPtr FunPtr_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr FunPtr_Aux) =>
+         HasField "unwrapFunPtr" FunPtr ty
+    where hasField = \x_0 -> (\y_1 -> FunPtr{unwrapFunPtr = y_1},
+                              getField @"unwrapFunPtr" x_0)
+instance (~) ty (FunPtr FunPtr_Aux) =>
+         HasField "unwrapFunPtr" (Ptr FunPtr) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunPtr")
+instance HasCField FunPtr "unwrapFunPtr"
+    where type CFieldType FunPtr "unwrapFunPtr" = FunPtr FunPtr_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @edge-cases\/aux_funptr_newtypes.h 8:8@
+
+    __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+-}
+data Foo
+    = Foo {foo_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @edge-cases\/aux_funptr_newtypes.h 9:7@
+
+                __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+           -},
+           foo_y :: CInt
+           {- ^ __C declaration:__ @y@
+
+                __defined at:__ @edge-cases\/aux_funptr_newtypes.h 10:7@
+
+                __exported by:__ @edge-cases\/aux_funptr_newtypes.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Foo
+    where readRaw = \ptr_0 -> (pure Foo <*> readRaw (Proxy @"foo_x") ptr_0) <*> readRaw (Proxy @"foo_y") ptr_0
+instance WriteRaw Foo
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo foo_x_2
+                                           foo_y_3 -> writeRaw (Proxy @"foo_x") ptr_0 foo_x_2 >> writeRaw (Proxy @"foo_y") ptr_0 foo_y_3
+deriving via (EquivStorable Foo) instance Storable Foo
+deriving via (IsStructViaReadRaw Foo) instance IsStruct Foo
+instance (~) ty CInt => HasField "foo_x" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_x = y_1,
+                                          foo_y = getField @"foo_y" x_0},
+                              getField @"foo_x" x_0)
+instance (~) ty CInt => HasField "foo_x" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_x")
+instance HasCField Foo "foo_x"
+    where type CFieldType Foo "foo_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "foo_y" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_y = y_1,
+                                          foo_x = getField @"foo_x" x_0},
+                              getField @"foo_y" x_0)
+instance (~) ty CInt => HasField "foo_y" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_y")
+instance HasCField Foo "foo_y"
+    where type CFieldType Foo "foo_y" = CInt
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/edge-cases/clang_generated_collision/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/clang_generated_collision/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/clang_generated_collision/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/edge-cases/clang_generated_collision/th.txt b/test-artefacts/fixtures/edge-cases/clang_generated_collision/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/clang_generated_collision/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/clang_generated_collision.h
diff --git a/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example.hs b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example.hs
@@ -0,0 +1,1287 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Another_typedef_struct_t(..)
+    , Example.Another_typedef_enum_e(..)
+    , pattern Example.FOO
+    , pattern Example.BAR
+    , Example.a
+    , Example.b
+    , Example.sOME_DEFINED_CONSTANT
+    , Example.A_type_t(..)
+    , Example.Var_t(..)
+    , Example.A_typedef_struct_t(..)
+    , Example.a_DEFINE_0
+    , Example.a_DEFINE_1
+    , Example.a_DEFINE_2
+    , Example.tWO_ARGS
+    , Example.A_typedef_enum_e(..)
+    , pattern Example.ENUM_CASE_0
+    , pattern Example.ENUM_CASE_1
+    , pattern Example.ENUM_CASE_2
+    , pattern Example.ENUM_CASE_3
+    , Example.Callback_t_Aux(..)
+    , Example.Callback_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, fmap, pure, type (~))
+
+{-| __C declaration:__ @struct another_typedef_struct_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 9:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+data Another_typedef_struct_t = Another_typedef_struct_t
+  { another_typedef_struct_t_foo :: BG.CInt
+    {- ^ __C declaration:__ @foo@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 9:22@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , another_typedef_struct_t_bar :: BG.CChar
+    {- ^ __C declaration:__ @bar@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 9:32@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Another_typedef_struct_t where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Another_typedef_struct_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Another_typedef_struct_t
+      <*> HasCField.readRaw (BG.Proxy @"another_typedef_struct_t_foo") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"another_typedef_struct_t_bar") ptr0
+
+instance Marshal.WriteRaw Another_typedef_struct_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Another_typedef_struct_t
+            another_typedef_struct_t_foo2
+            another_typedef_struct_t_bar3 ->
+                 HasCField.writeRaw (BG.Proxy @"another_typedef_struct_t_foo") ptr0 another_typedef_struct_t_foo2
+              >> HasCField.writeRaw (BG.Proxy @"another_typedef_struct_t_bar") ptr0 another_typedef_struct_t_bar3
+
+deriving via Marshal.EquivStorable Another_typedef_struct_t instance BG.Storable Another_typedef_struct_t
+
+deriving via Struct.IsStructViaReadRaw Another_typedef_struct_t instance Struct.IsStruct Another_typedef_struct_t
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 9:22@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "another_typedef_struct_t_foo" Another_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Another_typedef_struct_t { another_typedef_struct_t_foo = y1
+                                   , another_typedef_struct_t_bar = BG.getField @"another_typedef_struct_t_bar" x0
+                                   }
+      , BG.getField @"another_typedef_struct_t_foo" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "another_typedef_struct_t_foo" (BG.Ptr Another_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"another_typedef_struct_t_foo")
+
+instance HasCField.HasCField Another_typedef_struct_t "another_typedef_struct_t_foo" where
+
+  type CFieldType Another_typedef_struct_t "another_typedef_struct_t_foo" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 9:32@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "another_typedef_struct_t_bar" Another_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Another_typedef_struct_t { another_typedef_struct_t_bar = y1
+                                   , another_typedef_struct_t_foo = BG.getField @"another_typedef_struct_t_foo" x0
+                                   }
+      , BG.getField @"another_typedef_struct_t_bar" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "another_typedef_struct_t_bar" (BG.Ptr Another_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"another_typedef_struct_t_bar")
+
+instance HasCField.HasCField Another_typedef_struct_t "another_typedef_struct_t_bar" where
+
+  type CFieldType Another_typedef_struct_t "another_typedef_struct_t_bar" =
+    BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @enum another_typedef_enum_e@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 10:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype Another_typedef_enum_e = Another_typedef_enum_e
+  { unwrapAnother_typedef_enum_e :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Another_typedef_enum_e where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Another_typedef_enum_e where
+
+  readRaw =
+    \ptr0 ->
+          pure Another_typedef_enum_e
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Another_typedef_enum_e where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Another_typedef_enum_e unwrapAnother_typedef_enum_e2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapAnother_typedef_enum_e2
+
+deriving via Marshal.EquivStorable Another_typedef_enum_e instance BG.Storable Another_typedef_enum_e
+
+deriving via BG.CUInt instance BG.Prim Another_typedef_enum_e
+
+instance CEnum.CEnum Another_typedef_enum_e where
+
+  type CEnumZ Another_typedef_enum_e = BG.CUInt
+
+  toCEnum = Another_typedef_enum_e
+
+  fromCEnum =
+    BG.getField @"unwrapAnother_typedef_enum_e"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "FOO"), (1, BG.singleton "BAR")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Another_typedef_enum_e"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Another_typedef_enum_e"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Another_typedef_enum_e where
+
+  minDeclaredValue = FOO
+
+  maxDeclaredValue = BAR
+
+instance Show Another_typedef_enum_e where
+
+  showsPrec = CEnum.shows
+
+instance Read Another_typedef_enum_e where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapAnother_typedef_enum_e" Another_typedef_enum_e ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Another_typedef_enum_e {unwrapAnother_typedef_enum_e = y1}
+      , BG.getField @"unwrapAnother_typedef_enum_e" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapAnother_typedef_enum_e" (BG.Ptr Another_typedef_enum_e) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapAnother_typedef_enum_e")
+
+instance HasCField.HasCField Another_typedef_enum_e "unwrapAnother_typedef_enum_e" where
+
+  type CFieldType Another_typedef_enum_e "unwrapAnother_typedef_enum_e" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @FOO@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 10:16@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern FOO :: Another_typedef_enum_e
+pattern FOO = Another_typedef_enum_e 0
+
+{-| __C declaration:__ @BAR@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 10:21@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern BAR :: Another_typedef_enum_e
+pattern BAR = Another_typedef_enum_e 1
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 11:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a :: BG.CInt
+a = (5 :: BG.CInt)
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 12:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+b :: BG.CInt
+b = (3 :: BG.CInt)
+
+{-| __C declaration:__ @macro SOME_DEFINED_CONSTANT@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 13:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+sOME_DEFINED_CONSTANT :: BG.CInt
+sOME_DEFINED_CONSTANT = (4 :: BG.CInt)
+
+{-| __C declaration:__ @a_type_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 14:13@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype A_type_t = A_type_t
+  { unwrapA_type_t :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapA_type_t" A_type_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         A_type_t {unwrapA_type_t = y1}, BG.getField @"unwrapA_type_t" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapA_type_t" (BG.Ptr A_type_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapA_type_t")
+
+instance HasCField.HasCField A_type_t "unwrapA_type_t" where
+
+  type CFieldType A_type_t "unwrapA_type_t" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @var_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 15:13@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype Var_t = Var_t
+  { unwrapVar_t :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapVar_t" Var_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Var_t {unwrapVar_t = y1}, BG.getField @"unwrapVar_t" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapVar_t" (BG.Ptr Var_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapVar_t")
+
+instance HasCField.HasCField Var_t "unwrapVar_t" where
+
+  type CFieldType Var_t "unwrapVar_t" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct a_typedef_struct@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 35:16@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+data A_typedef_struct_t = A_typedef_struct_t
+  { a_typedef_struct_t_field_0 :: BG.CBool
+    {- ^ __C declaration:__ @field_0@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 37:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_1 :: HsBindgen.Runtime.LibC.Word8
+    {- ^ __C declaration:__ @field_1@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 38:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_2 :: HsBindgen.Runtime.LibC.Word16
+    {- ^ __C declaration:__ @field_2@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 39:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_3 :: HsBindgen.Runtime.LibC.Word32
+    {- ^ __C declaration:__ @field_3@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 40:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_4 :: Another_typedef_struct_t
+    {- ^ __C declaration:__ @field_4@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 41:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_5 :: BG.Ptr Another_typedef_struct_t
+    {- ^ __C declaration:__ @field_5@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 42:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_6 :: BG.Ptr BG.Void
+    {- ^ __C declaration:__ @field_6@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 43:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_7 :: CA.ConstantArray 7 HsBindgen.Runtime.LibC.Word32
+    {- ^ __C declaration:__ @field_7@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 44:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_8 :: Another_typedef_enum_e
+    {- ^ __C declaration:__ @field_8@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 45:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_9 :: CA.ConstantArray 4 Another_typedef_enum_e
+    {- ^ __C declaration:__ @field_9@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 46:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  , a_typedef_struct_t_field_10 :: CA.ConstantArray 5 (CA.ConstantArray 3 Another_typedef_enum_e)
+    {- ^ __C declaration:__ @field_10@
+
+         __defined at:__ @edge-cases\/distilled_lib_1.h 47:31@
+
+         __exported by:__ @edge-cases\/distilled_lib_1.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize A_typedef_struct_t where
+
+  staticSizeOf = \_ -> (140 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw A_typedef_struct_t where
+
+  readRaw =
+    \ptr0 ->
+          pure A_typedef_struct_t
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_0") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_3") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_4") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_5") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_6") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_7") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_8") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_9") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_typedef_struct_t_field_10") ptr0
+
+instance Marshal.WriteRaw A_typedef_struct_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          A_typedef_struct_t
+            a_typedef_struct_t_field_02
+            a_typedef_struct_t_field_13
+            a_typedef_struct_t_field_24
+            a_typedef_struct_t_field_35
+            a_typedef_struct_t_field_46
+            a_typedef_struct_t_field_57
+            a_typedef_struct_t_field_68
+            a_typedef_struct_t_field_79
+            a_typedef_struct_t_field_810
+            a_typedef_struct_t_field_911
+            a_typedef_struct_t_field_1012 ->
+                 HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_0") ptr0 a_typedef_struct_t_field_02
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_1") ptr0 a_typedef_struct_t_field_13
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_2") ptr0 a_typedef_struct_t_field_24
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_3") ptr0 a_typedef_struct_t_field_35
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_4") ptr0 a_typedef_struct_t_field_46
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_5") ptr0 a_typedef_struct_t_field_57
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_6") ptr0 a_typedef_struct_t_field_68
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_7") ptr0 a_typedef_struct_t_field_79
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_8") ptr0 a_typedef_struct_t_field_810
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_9") ptr0 a_typedef_struct_t_field_911
+              >> HasCField.writeRaw (BG.Proxy @"a_typedef_struct_t_field_10") ptr0 a_typedef_struct_t_field_1012
+
+deriving via Marshal.EquivStorable A_typedef_struct_t instance BG.Storable A_typedef_struct_t
+
+deriving via Struct.IsStructViaReadRaw A_typedef_struct_t instance Struct.IsStruct A_typedef_struct_t
+
+{-| __C declaration:__ @field_0@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 37:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_0" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_0 = y1
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_0" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "a_typedef_struct_t_field_0" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_0")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_0" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_0" =
+    BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @field_1@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 38:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_1" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_1 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_1" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "a_typedef_struct_t_field_1" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_1")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_1" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_1" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @field_2@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 39:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_2" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_2 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_2" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.HasField "a_typedef_struct_t_field_2" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_2")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_2" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_2" =
+    HsBindgen.Runtime.LibC.Word16
+
+  offset# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @field_3@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 40:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_3" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_3 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_3" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "a_typedef_struct_t_field_3" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_3")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_3" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_3" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @field_4@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 41:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ Another_typedef_struct_t
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_4" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_4 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_4" x0
+      )
+
+instance ( ty ~ Another_typedef_struct_t
+         ) => BG.HasField "a_typedef_struct_t_field_4" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_4")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_4" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_4" =
+    Another_typedef_struct_t
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @field_5@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 42:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ BG.Ptr Another_typedef_struct_t
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_5" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_5 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_5" x0
+      )
+
+instance ( ty ~ BG.Ptr Another_typedef_struct_t
+         ) => BG.HasField "a_typedef_struct_t_field_5" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_5")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_5" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_5" =
+    BG.Ptr Another_typedef_struct_t
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @field_6@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 43:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_6" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_6 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_6" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "a_typedef_struct_t_field_6" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_6")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_6" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_6" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @field_7@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 44:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ CA.ConstantArray 7 HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_7" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_7 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_7" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 7 HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "a_typedef_struct_t_field_7" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_7")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_7" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_7" =
+    CA.ConstantArray 7 HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @field_8@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 45:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ Another_typedef_enum_e
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_8" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_8 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_8" x0
+      )
+
+instance ( ty ~ Another_typedef_enum_e
+         ) => BG.HasField "a_typedef_struct_t_field_8" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_8")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_8" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_8" =
+    Another_typedef_enum_e
+
+  offset# = \_ -> \_ -> 60
+
+{-| __C declaration:__ @field_9@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 46:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ CA.ConstantArray 4 Another_typedef_enum_e
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_9" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_9 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_10 = BG.getField @"a_typedef_struct_t_field_10" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_9" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 4 Another_typedef_enum_e
+         ) => BG.HasField "a_typedef_struct_t_field_9" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_9")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_9" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_9" =
+    CA.ConstantArray 4 Another_typedef_enum_e
+
+  offset# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @field_10@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 47:31@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+instance ( ty ~ CA.ConstantArray 5 (CA.ConstantArray 3 Another_typedef_enum_e)
+         ) => BG.CompatHasField.HasField "a_typedef_struct_t_field_10" A_typedef_struct_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_struct_t { a_typedef_struct_t_field_10 = y1
+                             , a_typedef_struct_t_field_0 = BG.getField @"a_typedef_struct_t_field_0" x0
+                             , a_typedef_struct_t_field_1 = BG.getField @"a_typedef_struct_t_field_1" x0
+                             , a_typedef_struct_t_field_2 = BG.getField @"a_typedef_struct_t_field_2" x0
+                             , a_typedef_struct_t_field_3 = BG.getField @"a_typedef_struct_t_field_3" x0
+                             , a_typedef_struct_t_field_4 = BG.getField @"a_typedef_struct_t_field_4" x0
+                             , a_typedef_struct_t_field_5 = BG.getField @"a_typedef_struct_t_field_5" x0
+                             , a_typedef_struct_t_field_6 = BG.getField @"a_typedef_struct_t_field_6" x0
+                             , a_typedef_struct_t_field_7 = BG.getField @"a_typedef_struct_t_field_7" x0
+                             , a_typedef_struct_t_field_8 = BG.getField @"a_typedef_struct_t_field_8" x0
+                             , a_typedef_struct_t_field_9 = BG.getField @"a_typedef_struct_t_field_9" x0
+                             }
+      , BG.getField @"a_typedef_struct_t_field_10" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 5 (CA.ConstantArray 3 Another_typedef_enum_e)
+         ) => BG.HasField "a_typedef_struct_t_field_10" (BG.Ptr A_typedef_struct_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"a_typedef_struct_t_field_10")
+
+instance HasCField.HasCField A_typedef_struct_t "a_typedef_struct_t_field_10" where
+
+  type CFieldType A_typedef_struct_t "a_typedef_struct_t_field_10" =
+    CA.ConstantArray 5 (CA.ConstantArray 3 Another_typedef_enum_e)
+
+  offset# = \_ -> \_ -> 80
+
+{-| __C declaration:__ @macro A_DEFINE_0@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 53:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a_DEFINE_0 :: BG.CInt
+a_DEFINE_0 = (0 :: BG.CInt)
+
+{-| __C declaration:__ @macro A_DEFINE_1@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 54:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a_DEFINE_1 :: BG.CUInt
+a_DEFINE_1 = (20560 :: BG.CUInt)
+
+{-| __C declaration:__ @macro A_DEFINE_2@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 55:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a_DEFINE_2 :: BG.CInt
+a_DEFINE_2 = (2 :: BG.CInt)
+
+{-| __C declaration:__ @macro TWO_ARGS@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 56:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+tWO_ARGS :: (BG.CInt, BG.CInt)
+tWO_ARGS = ((13398 :: BG.CInt), (30874 :: BG.CInt))
+
+{-| __C declaration:__ @enum a_typedef_enum_e@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 61:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype A_typedef_enum_e = A_typedef_enum_e
+  { unwrapA_typedef_enum_e :: BG.CUChar
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize A_typedef_enum_e where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw A_typedef_enum_e where
+
+  readRaw =
+    \ptr0 ->
+          pure A_typedef_enum_e
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw A_typedef_enum_e where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          A_typedef_enum_e unwrapA_typedef_enum_e2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapA_typedef_enum_e2
+
+deriving via Marshal.EquivStorable A_typedef_enum_e instance BG.Storable A_typedef_enum_e
+
+deriving via BG.CUChar instance BG.Prim A_typedef_enum_e
+
+instance CEnum.CEnum A_typedef_enum_e where
+
+  type CEnumZ A_typedef_enum_e = BG.CUChar
+
+  toCEnum = A_typedef_enum_e
+
+  fromCEnum = BG.getField @"unwrapA_typedef_enum_e"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "ENUM_CASE_0")
+                                   , (1, BG.singleton "ENUM_CASE_1")
+                                   , (2, BG.singleton "ENUM_CASE_2")
+                                   , (3, BG.singleton "ENUM_CASE_3")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "A_typedef_enum_e"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "A_typedef_enum_e"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum A_typedef_enum_e where
+
+  minDeclaredValue = ENUM_CASE_0
+
+  maxDeclaredValue = ENUM_CASE_3
+
+instance Show A_typedef_enum_e where
+
+  showsPrec = CEnum.shows
+
+instance Read A_typedef_enum_e where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUChar
+         ) => BG.CompatHasField.HasField "unwrapA_typedef_enum_e" A_typedef_enum_e ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A_typedef_enum_e {unwrapA_typedef_enum_e = y1}
+      , BG.getField @"unwrapA_typedef_enum_e" x0
+      )
+
+instance ( ty ~ BG.CUChar
+         ) => BG.HasField "unwrapA_typedef_enum_e" (BG.Ptr A_typedef_enum_e) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapA_typedef_enum_e")
+
+instance HasCField.HasCField A_typedef_enum_e "unwrapA_typedef_enum_e" where
+
+  type CFieldType A_typedef_enum_e "unwrapA_typedef_enum_e" =
+    BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @ENUM_CASE_0@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 63:3@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern ENUM_CASE_0 :: A_typedef_enum_e
+pattern ENUM_CASE_0 = A_typedef_enum_e 0
+
+{-| __C declaration:__ @ENUM_CASE_1@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 64:3@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern ENUM_CASE_1 :: A_typedef_enum_e
+pattern ENUM_CASE_1 = A_typedef_enum_e 1
+
+{-| __C declaration:__ @ENUM_CASE_2@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 65:3@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern ENUM_CASE_2 :: A_typedef_enum_e
+pattern ENUM_CASE_2 = A_typedef_enum_e 2
+
+{-| __C declaration:__ @ENUM_CASE_3@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 66:3@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern ENUM_CASE_3 :: A_typedef_enum_e
+pattern ENUM_CASE_3 = A_typedef_enum_e 3
+
+{-| Auxiliary type used by 'Callback_t'
+
+    __C declaration:__ @callback_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 77:19@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype Callback_t_Aux = Callback_t_Aux
+  { unwrapCallback_t_Aux :: BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toCallback_t_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b6b6922e35047658_base ::
+     (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32))
+
+-- __unique:__ @toCallback_t_Aux@
+hs_bindgen_b6b6922e35047658 ::
+     Callback_t_Aux
+  -> IO (BG.FunPtr Callback_t_Aux)
+hs_bindgen_b6b6922e35047658 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b6b6922e35047658_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapCallback_t_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromCallback_t_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d6debb4b8d5bb869_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32)
+  -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @fromCallback_t_Aux@
+hs_bindgen_d6debb4b8d5bb869 ::
+     BG.FunPtr Callback_t_Aux
+  -> Callback_t_Aux
+hs_bindgen_d6debb4b8d5bb869 =
+  \funPtr0 ->
+    Callback_t_Aux (\x1 ->
+                      \x2 ->
+                        fmap BG.fromFFIType (hs_bindgen_d6debb4b8d5bb869_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Callback_t_Aux where
+
+  toFunPtr = hs_bindgen_b6b6922e35047658
+
+instance BG.FromFunPtr Callback_t_Aux where
+
+  fromFunPtr = hs_bindgen_d6debb4b8d5bb869
+
+instance ( ty ~ (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32)
+         ) => BG.CompatHasField.HasField "unwrapCallback_t_Aux" Callback_t_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Callback_t_Aux {unwrapCallback_t_Aux = y1}
+      , BG.getField @"unwrapCallback_t_Aux" x0
+      )
+
+instance ( ty ~ (BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32)
+         ) => BG.HasField "unwrapCallback_t_Aux" (BG.Ptr Callback_t_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapCallback_t_Aux")
+
+instance HasCField.HasCField Callback_t_Aux "unwrapCallback_t_Aux" where
+
+  type CFieldType Callback_t_Aux "unwrapCallback_t_Aux" =
+    BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @callback_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 77:19@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype Callback_t = Callback_t
+  { unwrapCallback_t :: BG.FunPtr Callback_t_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Callback_t_Aux
+         ) => BG.CompatHasField.HasField "unwrapCallback_t" Callback_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Callback_t {unwrapCallback_t = y1}
+      , BG.getField @"unwrapCallback_t" x0
+      )
+
+instance ( ty ~ BG.FunPtr Callback_t_Aux
+         ) => BG.HasField "unwrapCallback_t" (BG.Ptr Callback_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapCallback_t")
+
+instance HasCField.HasCField Callback_t "unwrapCallback_t" where
+
+  type CFieldType Callback_t "unwrapCallback_t" =
+    BG.FunPtr Callback_t_Aux
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/FunPtr.hs
@@ -0,0 +1,51 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.some_fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/distilled_lib_1.h>"
+  , "/* test_edgecasesdistilled_lib_1_Example_get_some_fun */"
+  , "__attribute__ ((const))"
+  , "int32_t (*hs_bindgen_1ade3cfc18679577 (void)) ("
+  , "  a_type_t *arg1,"
+  , "  uint32_t arg2,"
+  , "  uint8_t *arg3"
+  , ")"
+  , "{"
+  , "  return &some_fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_some_fun@
+foreign import ccall unsafe "hs_bindgen_1ade3cfc18679577" hs_bindgen_1ade3cfc18679577_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_some_fun@
+hs_bindgen_1ade3cfc18679577 :: IO (BG.FunPtr (BG.Ptr A_type_t -> HsBindgen.Runtime.LibC.Word32 -> BG.Ptr (IsA.Elem (IA.IncompleteArray HsBindgen.Runtime.LibC.Word8)) -> IO HsBindgen.Runtime.LibC.Int32))
+hs_bindgen_1ade3cfc18679577 =
+  fmap BG.fromFFIType hs_bindgen_1ade3cfc18679577_base
+
+{-# NOINLINE some_fun #-}
+{-| __C declaration:__ @some_fun@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 72:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+some_fun :: BG.FunPtr (BG.Ptr A_type_t -> HsBindgen.Runtime.LibC.Word32 -> BG.Ptr (IsA.Elem (IA.IncompleteArray HsBindgen.Runtime.LibC.Word8)) -> IO HsBindgen.Runtime.LibC.Int32)
+some_fun =
+  BG.unsafePerformIO hs_bindgen_1ade3cfc18679577
diff --git a/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/Global.hs b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/Global.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.v
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/distilled_lib_1.h>"
+  , "/* test_edgecasesdistilled_lib_1_Example_get_v */"
+  , "__attribute__ ((const))"
+  , "var_t *hs_bindgen_226b16768d8906f3 (void)"
+  , "{"
+  , "  return &v;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_v@
+foreign import ccall unsafe "hs_bindgen_226b16768d8906f3" hs_bindgen_226b16768d8906f3_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_v@
+hs_bindgen_226b16768d8906f3 :: IO (BG.Ptr Var_t)
+hs_bindgen_226b16768d8906f3 =
+  fmap BG.fromFFIType hs_bindgen_226b16768d8906f3_base
+
+{-# NOINLINE v #-}
+{-| __C declaration:__ @v@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 91:14@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+v :: BG.Ptr Var_t
+v = BG.unsafePerformIO hs_bindgen_226b16768d8906f3
diff --git a/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/Safe.hs
@@ -0,0 +1,64 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.some_fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/distilled_lib_1.h>"
+  , "int32_t hs_bindgen_57cb99ed92c001ad ("
+  , "  a_type_t *arg1,"
+  , "  uint32_t arg2,"
+  , "  uint8_t *arg3"
+  , ")"
+  , "{"
+  , "  return (some_fun)(arg1, arg2, arg3);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Safe_some_fun@
+foreign import ccall safe "hs_bindgen_57cb99ed92c001ad" hs_bindgen_57cb99ed92c001ad_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word32
+  -> BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Safe_some_fun@
+hs_bindgen_57cb99ed92c001ad ::
+     BG.Ptr A_type_t
+  -> HsBindgen.Runtime.LibC.Word32
+  -> BG.Ptr (IsA.Elem (IA.IncompleteArray HsBindgen.Runtime.LibC.Word8))
+  -> IO HsBindgen.Runtime.LibC.Int32
+hs_bindgen_57cb99ed92c001ad =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_57cb99ed92c001ad_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @some_fun@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 72:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+some_fun ::
+     BG.Ptr A_type_t
+     -- ^ __C declaration:__ @i@
+  -> HsBindgen.Runtime.LibC.Word32
+     -- ^ __C declaration:__ @j@
+  -> BG.Ptr (IsA.Elem (IA.IncompleteArray HsBindgen.Runtime.LibC.Word8))
+     -- ^ __C declaration:__ @k@
+  -> IO HsBindgen.Runtime.LibC.Int32
+some_fun = hs_bindgen_57cb99ed92c001ad
diff --git a/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/distilled_lib_1/Example/Unsafe.hs
@@ -0,0 +1,64 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.some_fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/distilled_lib_1.h>"
+  , "int32_t hs_bindgen_2a91c367a9380a63 ("
+  , "  a_type_t *arg1,"
+  , "  uint32_t arg2,"
+  , "  uint8_t *arg3"
+  , ")"
+  , "{"
+  , "  return (some_fun)(arg1, arg2, arg3);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Unsafe_some_fun@
+foreign import ccall unsafe "hs_bindgen_2a91c367a9380a63" hs_bindgen_2a91c367a9380a63_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.Word32
+  -> BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Unsafe_some_fun@
+hs_bindgen_2a91c367a9380a63 ::
+     BG.Ptr A_type_t
+  -> HsBindgen.Runtime.LibC.Word32
+  -> BG.Ptr (IsA.Elem (IA.IncompleteArray HsBindgen.Runtime.LibC.Word8))
+  -> IO HsBindgen.Runtime.LibC.Int32
+hs_bindgen_2a91c367a9380a63 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_2a91c367a9380a63_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @some_fun@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 72:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+some_fun ::
+     BG.Ptr A_type_t
+     -- ^ __C declaration:__ @i@
+  -> HsBindgen.Runtime.LibC.Word32
+     -- ^ __C declaration:__ @j@
+  -> BG.Ptr (IsA.Elem (IA.IncompleteArray HsBindgen.Runtime.LibC.Word8))
+     -- ^ __C declaration:__ @k@
+  -> IO HsBindgen.Runtime.LibC.Int32
+some_fun = hs_bindgen_2a91c367a9380a63
diff --git a/test-artefacts/fixtures/edge-cases/distilled_lib_1/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/distilled_lib_1/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/distilled_lib_1/bindingspec.yaml
@@ -0,0 +1,235 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/distilled_lib_1.h
+  cname: struct another_typedef_struct_t
+  hsname: Another_typedef_struct_t
+- headers: edge-cases/distilled_lib_1.h
+  cname: another_typedef_struct_t
+  hsname: Another_typedef_struct_t
+- headers: edge-cases/distilled_lib_1.h
+  cname: enum another_typedef_enum_e
+  hsname: Another_typedef_enum_e
+  enum: open
+- headers: edge-cases/distilled_lib_1.h
+  cname: another_typedef_enum_e
+  hsname: Another_typedef_enum_e
+- headers: edge-cases/distilled_lib_1.h
+  cname: a_type_t
+  hsname: A_type_t
+- headers: edge-cases/distilled_lib_1.h
+  cname: var_t
+  hsname: Var_t
+- headers: edge-cases/distilled_lib_1.h
+  cname: struct a_typedef_struct
+  hsname: A_typedef_struct_t
+- headers: edge-cases/distilled_lib_1.h
+  cname: a_typedef_struct_t
+  hsname: A_typedef_struct_t
+- headers: edge-cases/distilled_lib_1.h
+  cname: enum a_typedef_enum_e
+  hsname: A_typedef_enum_e
+  enum: open
+- headers: edge-cases/distilled_lib_1.h
+  cname: a_typedef_enum_e
+  hsname: A_typedef_enum_e
+- headers: edge-cases/distilled_lib_1.h
+  cname: callback_t
+  hsname: Callback_t
+hstypes:
+- hsname: A_type_t
+  representation:
+    newtype:
+      constructor: A_type_t
+      fields:
+      - unwrapA_type_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: A_typedef_enum_e
+  representation:
+    newtype:
+      constructor: A_typedef_enum_e
+      fields:
+      - unwrapA_typedef_enum_e
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUChar
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: A_typedef_struct_t
+  representation:
+    record:
+      constructor: A_typedef_struct_t
+      fields:
+      - a_typedef_struct_t_field_0
+      - a_typedef_struct_t_field_1
+      - a_typedef_struct_t_field_2
+      - a_typedef_struct_t_field_3
+      - a_typedef_struct_t_field_4
+      - a_typedef_struct_t_field_5
+      - a_typedef_struct_t_field_6
+      - a_typedef_struct_t_field_7
+      - a_typedef_struct_t_field_8
+      - a_typedef_struct_t_field_9
+      - a_typedef_struct_t_field_10
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Another_typedef_enum_e
+  representation:
+    newtype:
+      constructor: Another_typedef_enum_e
+      fields:
+      - unwrapAnother_typedef_enum_e
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Another_typedef_struct_t
+  representation:
+    record:
+      constructor: Another_typedef_struct_t
+      fields:
+      - another_typedef_struct_t_foo
+      - another_typedef_struct_t_bar
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Callback_t
+  representation:
+    newtype:
+      constructor: Callback_t
+      fields:
+      - unwrapCallback_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Var_t
+  representation:
+    newtype:
+      constructor: Var_t
+      fields:
+      - unwrapVar_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/distilled_lib_1/th.txt b/test-artefacts/fixtures/edge-cases/distilled_lib_1/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/distilled_lib_1/th.txt
@@ -0,0 +1,981 @@
+-- addDependentFile musl-include/x86_64/stdbool.h
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile test-artefacts/headers/golden/edge-cases/distilled_lib_1.h
+-- #include <edge-cases/distilled_lib_1.h>
+-- int32_t hs_bindgen_57cb99ed92c001ad (
+--   a_type_t *arg1,
+--   uint32_t arg2,
+--   uint8_t *arg3
+-- )
+-- {
+--   return (some_fun)(arg1, arg2, arg3);
+-- }
+-- int32_t hs_bindgen_2a91c367a9380a63 (
+--   a_type_t *arg1,
+--   uint32_t arg2,
+--   uint8_t *arg3
+-- )
+-- {
+--   return (some_fun)(arg1, arg2, arg3);
+-- }
+-- /* test_edgecasesdistilled_lib_1_Example_get_some_fun */
+-- __attribute__ ((const))
+-- int32_t (*hs_bindgen_1ade3cfc18679577 (void)) (
+--   a_type_t *arg1,
+--   uint32_t arg2,
+--   uint8_t *arg3
+-- )
+-- {
+--   return &some_fun;
+-- }
+-- /* test_edgecasesdistilled_lib_1_Example_get_v */
+-- __attribute__ ((const))
+-- var_t *hs_bindgen_226b16768d8906f3 (void)
+-- {
+--   return &v;
+-- }
+{-| __C declaration:__ @struct another_typedef_struct_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 9:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+data Another_typedef_struct_t
+    = Another_typedef_struct_t {another_typedef_struct_t_foo :: CInt
+                                {- ^ __C declaration:__ @foo@
+
+                                     __defined at:__ @edge-cases\/distilled_lib_1.h 9:22@
+
+                                     __exported by:__ @edge-cases\/distilled_lib_1.h@
+                                -},
+                                another_typedef_struct_t_bar :: CChar
+                                {- ^ __C declaration:__ @bar@
+
+                                     __defined at:__ @edge-cases\/distilled_lib_1.h 9:32@
+
+                                     __exported by:__ @edge-cases\/distilled_lib_1.h@
+                                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Another_typedef_struct_t
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Another_typedef_struct_t
+    where readRaw = \ptr_0 -> (pure Another_typedef_struct_t <*> readRaw (Proxy @"another_typedef_struct_t_foo") ptr_0) <*> readRaw (Proxy @"another_typedef_struct_t_bar") ptr_0
+instance WriteRaw Another_typedef_struct_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Another_typedef_struct_t another_typedef_struct_t_foo_2
+                                                                another_typedef_struct_t_bar_3 -> writeRaw (Proxy @"another_typedef_struct_t_foo") ptr_0 another_typedef_struct_t_foo_2 >> writeRaw (Proxy @"another_typedef_struct_t_bar") ptr_0 another_typedef_struct_t_bar_3
+deriving via (EquivStorable Another_typedef_struct_t) instance Storable Another_typedef_struct_t
+deriving via (IsStructViaReadRaw Another_typedef_struct_t) instance IsStruct Another_typedef_struct_t
+instance (~) ty CInt =>
+         HasField "another_typedef_struct_t_foo" Another_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> Another_typedef_struct_t{another_typedef_struct_t_foo = y_1,
+                                                               another_typedef_struct_t_bar = getField @"another_typedef_struct_t_bar" x_0},
+                              getField @"another_typedef_struct_t_foo" x_0)
+instance (~) ty CInt =>
+         HasField "another_typedef_struct_t_foo"
+                  (Ptr Another_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"another_typedef_struct_t_foo")
+instance HasCField Another_typedef_struct_t
+                   "another_typedef_struct_t_foo"
+    where type CFieldType Another_typedef_struct_t
+                          "another_typedef_struct_t_foo" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar =>
+         HasField "another_typedef_struct_t_bar" Another_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> Another_typedef_struct_t{another_typedef_struct_t_bar = y_1,
+                                                               another_typedef_struct_t_foo = getField @"another_typedef_struct_t_foo" x_0},
+                              getField @"another_typedef_struct_t_bar" x_0)
+instance (~) ty CChar =>
+         HasField "another_typedef_struct_t_bar"
+                  (Ptr Another_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"another_typedef_struct_t_bar")
+instance HasCField Another_typedef_struct_t
+                   "another_typedef_struct_t_bar"
+    where type CFieldType Another_typedef_struct_t
+                          "another_typedef_struct_t_bar" = CChar
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @enum another_typedef_enum_e@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 10:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype Another_typedef_enum_e
+    = Another_typedef_enum_e {unwrapAnother_typedef_enum_e :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Another_typedef_enum_e
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Another_typedef_enum_e
+    where readRaw = \ptr_0 -> pure Another_typedef_enum_e <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Another_typedef_enum_e
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Another_typedef_enum_e unwrapAnother_typedef_enum_e_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapAnother_typedef_enum_e_2
+deriving via (EquivStorable Another_typedef_enum_e) instance Storable Another_typedef_enum_e
+deriving via CUInt instance Prim Another_typedef_enum_e
+instance CEnum Another_typedef_enum_e
+    where type CEnumZ Another_typedef_enum_e = CUInt
+          toCEnum = Another_typedef_enum_e
+          fromCEnum = getField @"unwrapAnother_typedef_enum_e"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "FOO"),
+                                                         (1, singleton "BAR")]
+          showsUndeclared = showsWrappedUndeclared "Another_typedef_enum_e"
+          readPrecUndeclared = readPrecWrappedUndeclared "Another_typedef_enum_e"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Another_typedef_enum_e
+    where minDeclaredValue = FOO
+          maxDeclaredValue = BAR
+instance Show Another_typedef_enum_e
+    where showsPrec = shows
+instance Read Another_typedef_enum_e
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt =>
+         HasField "unwrapAnother_typedef_enum_e" Another_typedef_enum_e ty
+    where hasField = \x_0 -> (\y_1 -> Another_typedef_enum_e{unwrapAnother_typedef_enum_e = y_1},
+                              getField @"unwrapAnother_typedef_enum_e" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapAnother_typedef_enum_e"
+                  (Ptr Another_typedef_enum_e)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapAnother_typedef_enum_e")
+instance HasCField Another_typedef_enum_e
+                   "unwrapAnother_typedef_enum_e"
+    where type CFieldType Another_typedef_enum_e
+                          "unwrapAnother_typedef_enum_e" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @FOO@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 10:16@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern FOO :: Another_typedef_enum_e
+pattern FOO = Another_typedef_enum_e 0
+{-| __C declaration:__ @BAR@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 10:21@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern BAR :: Another_typedef_enum_e
+pattern BAR = Another_typedef_enum_e 1
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 11:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a :: CInt
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 11:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a = 5 :: CInt
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 12:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+b :: CInt
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 12:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+b = 3 :: CInt
+{-| __C declaration:__ @macro SOME_DEFINED_CONSTANT@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 13:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+sOME_DEFINED_CONSTANT :: CInt
+{-| __C declaration:__ @macro SOME_DEFINED_CONSTANT@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 13:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+sOME_DEFINED_CONSTANT = 4 :: CInt
+{-| __C declaration:__ @a_type_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 14:13@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype A_type_t
+    = A_type_t {unwrapA_type_t :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapA_type_t" A_type_t ty
+    where hasField = \x_0 -> (\y_1 -> A_type_t{unwrapA_type_t = y_1},
+                              getField @"unwrapA_type_t" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapA_type_t" (Ptr A_type_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA_type_t")
+instance HasCField A_type_t "unwrapA_type_t"
+    where type CFieldType A_type_t "unwrapA_type_t" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @var_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 15:13@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype Var_t
+    = Var_t {unwrapVar_t :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapVar_t" Var_t ty
+    where hasField = \x_0 -> (\y_1 -> Var_t{unwrapVar_t = y_1},
+                              getField @"unwrapVar_t" x_0)
+instance (~) ty CInt => HasField "unwrapVar_t" (Ptr Var_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapVar_t")
+instance HasCField Var_t "unwrapVar_t"
+    where type CFieldType Var_t "unwrapVar_t" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct a_typedef_struct@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 35:16@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+data A_typedef_struct_t
+    = A_typedef_struct_t {a_typedef_struct_t_field_0 :: CBool
+                          {- ^ __C declaration:__ @field_0@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 37:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_1 :: HsBindgen.Runtime.LibC.Word8
+                          {- ^ __C declaration:__ @field_1@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 38:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_2 :: HsBindgen.Runtime.LibC.Word16
+                          {- ^ __C declaration:__ @field_2@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 39:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_3 :: HsBindgen.Runtime.LibC.Word32
+                          {- ^ __C declaration:__ @field_3@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 40:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_4 :: Another_typedef_struct_t
+                          {- ^ __C declaration:__ @field_4@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 41:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_5 :: (Ptr Another_typedef_struct_t)
+                          {- ^ __C declaration:__ @field_5@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 42:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_6 :: (Ptr Void)
+                          {- ^ __C declaration:__ @field_6@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 43:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_7 :: (ConstantArray 7
+                                                                       HsBindgen.Runtime.LibC.Word32)
+                          {- ^ __C declaration:__ @field_7@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 44:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_8 :: Another_typedef_enum_e
+                          {- ^ __C declaration:__ @field_8@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 45:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_9 :: (ConstantArray 4
+                                                                       Another_typedef_enum_e)
+                          {- ^ __C declaration:__ @field_9@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 46:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -},
+                          a_typedef_struct_t_field_10 :: (ConstantArray 5
+                                                                        (ConstantArray 3
+                                                                                       Another_typedef_enum_e))
+                          {- ^ __C declaration:__ @field_10@
+
+                               __defined at:__ @edge-cases\/distilled_lib_1.h 47:31@
+
+                               __exported by:__ @edge-cases\/distilled_lib_1.h@
+                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize A_typedef_struct_t
+    where staticSizeOf = \_ -> 140 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw A_typedef_struct_t
+    where readRaw = \ptr_0 -> ((((((((((pure A_typedef_struct_t <*> readRaw (Proxy @"a_typedef_struct_t_field_0") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_1") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_2") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_3") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_4") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_5") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_6") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_7") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_8") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_9") ptr_0) <*> readRaw (Proxy @"a_typedef_struct_t_field_10") ptr_0
+instance WriteRaw A_typedef_struct_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       A_typedef_struct_t a_typedef_struct_t_field_0_2
+                                                          a_typedef_struct_t_field_1_3
+                                                          a_typedef_struct_t_field_2_4
+                                                          a_typedef_struct_t_field_3_5
+                                                          a_typedef_struct_t_field_4_6
+                                                          a_typedef_struct_t_field_5_7
+                                                          a_typedef_struct_t_field_6_8
+                                                          a_typedef_struct_t_field_7_9
+                                                          a_typedef_struct_t_field_8_10
+                                                          a_typedef_struct_t_field_9_11
+                                                          a_typedef_struct_t_field_10_12 -> writeRaw (Proxy @"a_typedef_struct_t_field_0") ptr_0 a_typedef_struct_t_field_0_2 >> (writeRaw (Proxy @"a_typedef_struct_t_field_1") ptr_0 a_typedef_struct_t_field_1_3 >> (writeRaw (Proxy @"a_typedef_struct_t_field_2") ptr_0 a_typedef_struct_t_field_2_4 >> (writeRaw (Proxy @"a_typedef_struct_t_field_3") ptr_0 a_typedef_struct_t_field_3_5 >> (writeRaw (Proxy @"a_typedef_struct_t_field_4") ptr_0 a_typedef_struct_t_field_4_6 >> (writeRaw (Proxy @"a_typedef_struct_t_field_5") ptr_0 a_typedef_struct_t_field_5_7 >> (writeRaw (Proxy @"a_typedef_struct_t_field_6") ptr_0 a_typedef_struct_t_field_6_8 >> (writeRaw (Proxy @"a_typedef_struct_t_field_7") ptr_0 a_typedef_struct_t_field_7_9 >> (writeRaw (Proxy @"a_typedef_struct_t_field_8") ptr_0 a_typedef_struct_t_field_8_10 >> (writeRaw (Proxy @"a_typedef_struct_t_field_9") ptr_0 a_typedef_struct_t_field_9_11 >> writeRaw (Proxy @"a_typedef_struct_t_field_10") ptr_0 a_typedef_struct_t_field_10_12)))))))))
+deriving via (EquivStorable A_typedef_struct_t) instance Storable A_typedef_struct_t
+deriving via (IsStructViaReadRaw A_typedef_struct_t) instance IsStruct A_typedef_struct_t
+instance (~) ty CBool =>
+         HasField "a_typedef_struct_t_field_0" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_0 = y_1,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_0" x_0)
+instance (~) ty CBool =>
+         HasField "a_typedef_struct_t_field_0"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_0")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_0"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_0" = CBool
+          offset# = \_ -> \_ -> 0
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "a_typedef_struct_t_field_1" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_1 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_1" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "a_typedef_struct_t_field_1"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_1")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_1"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_1" = HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 1
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "a_typedef_struct_t_field_2" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_2 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_2" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "a_typedef_struct_t_field_2"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_2")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_2"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_2" = HsBindgen.Runtime.LibC.Word16
+          offset# = \_ -> \_ -> 2
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "a_typedef_struct_t_field_3" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_3 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_3" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "a_typedef_struct_t_field_3"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_3")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_3"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_3" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 4
+instance (~) ty Another_typedef_struct_t =>
+         HasField "a_typedef_struct_t_field_4" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_4 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_4" x_0)
+instance (~) ty Another_typedef_struct_t =>
+         HasField "a_typedef_struct_t_field_4"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_4")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_4"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_4" = Another_typedef_struct_t
+          offset# = \_ -> \_ -> 8
+instance (~) ty (Ptr Another_typedef_struct_t) =>
+         HasField "a_typedef_struct_t_field_5" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_5 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_5" x_0)
+instance (~) ty (Ptr Another_typedef_struct_t) =>
+         HasField "a_typedef_struct_t_field_5"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_5")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_5"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_5" = Ptr Another_typedef_struct_t
+          offset# = \_ -> \_ -> 16
+instance (~) ty (Ptr Void) =>
+         HasField "a_typedef_struct_t_field_6" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_6 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_6" x_0)
+instance (~) ty (Ptr Void) =>
+         HasField "a_typedef_struct_t_field_6"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_6")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_6"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_6" = Ptr Void
+          offset# = \_ -> \_ -> 24
+instance (~) ty (ConstantArray 7 HsBindgen.Runtime.LibC.Word32) =>
+         HasField "a_typedef_struct_t_field_7" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_7 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_7" x_0)
+instance (~) ty (ConstantArray 7 HsBindgen.Runtime.LibC.Word32) =>
+         HasField "a_typedef_struct_t_field_7"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_7")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_7"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_7" = ConstantArray 7
+                                                                       HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 32
+instance (~) ty Another_typedef_enum_e =>
+         HasField "a_typedef_struct_t_field_8" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_8 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_8" x_0)
+instance (~) ty Another_typedef_enum_e =>
+         HasField "a_typedef_struct_t_field_8"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_8")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_8"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_8" = Another_typedef_enum_e
+          offset# = \_ -> \_ -> 60
+instance (~) ty (ConstantArray 4 Another_typedef_enum_e) =>
+         HasField "a_typedef_struct_t_field_9" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_9 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_10 = getField @"a_typedef_struct_t_field_10" x_0},
+                              getField @"a_typedef_struct_t_field_9" x_0)
+instance (~) ty (ConstantArray 4 Another_typedef_enum_e) =>
+         HasField "a_typedef_struct_t_field_9"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_9")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_9"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_9" = ConstantArray 4
+                                                                       Another_typedef_enum_e
+          offset# = \_ -> \_ -> 64
+instance (~) ty
+             (ConstantArray 5 (ConstantArray 3 Another_typedef_enum_e)) =>
+         HasField "a_typedef_struct_t_field_10" A_typedef_struct_t ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_struct_t{a_typedef_struct_t_field_10 = y_1,
+                                                         a_typedef_struct_t_field_0 = getField @"a_typedef_struct_t_field_0" x_0,
+                                                         a_typedef_struct_t_field_1 = getField @"a_typedef_struct_t_field_1" x_0,
+                                                         a_typedef_struct_t_field_2 = getField @"a_typedef_struct_t_field_2" x_0,
+                                                         a_typedef_struct_t_field_3 = getField @"a_typedef_struct_t_field_3" x_0,
+                                                         a_typedef_struct_t_field_4 = getField @"a_typedef_struct_t_field_4" x_0,
+                                                         a_typedef_struct_t_field_5 = getField @"a_typedef_struct_t_field_5" x_0,
+                                                         a_typedef_struct_t_field_6 = getField @"a_typedef_struct_t_field_6" x_0,
+                                                         a_typedef_struct_t_field_7 = getField @"a_typedef_struct_t_field_7" x_0,
+                                                         a_typedef_struct_t_field_8 = getField @"a_typedef_struct_t_field_8" x_0,
+                                                         a_typedef_struct_t_field_9 = getField @"a_typedef_struct_t_field_9" x_0},
+                              getField @"a_typedef_struct_t_field_10" x_0)
+instance (~) ty
+             (ConstantArray 5 (ConstantArray 3 Another_typedef_enum_e)) =>
+         HasField "a_typedef_struct_t_field_10"
+                  (Ptr A_typedef_struct_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"a_typedef_struct_t_field_10")
+instance HasCField A_typedef_struct_t "a_typedef_struct_t_field_10"
+    where type CFieldType A_typedef_struct_t
+                          "a_typedef_struct_t_field_10" = ConstantArray 5
+                                                                        (ConstantArray 3
+                                                                                       Another_typedef_enum_e)
+          offset# = \_ -> \_ -> 80
+{-| __C declaration:__ @macro A_DEFINE_0@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 53:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a_DEFINE_0 :: CInt
+{-| __C declaration:__ @macro A_DEFINE_0@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 53:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a_DEFINE_0 = 0 :: CInt
+{-| __C declaration:__ @macro A_DEFINE_1@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 54:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a_DEFINE_1 :: CUInt
+{-| __C declaration:__ @macro A_DEFINE_1@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 54:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a_DEFINE_1 = 20560 :: CUInt
+{-| __C declaration:__ @macro A_DEFINE_2@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 55:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a_DEFINE_2 :: CInt
+{-| __C declaration:__ @macro A_DEFINE_2@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 55:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+a_DEFINE_2 = 2 :: CInt
+{-| __C declaration:__ @macro TWO_ARGS@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 56:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+tWO_ARGS :: (CInt, CInt)
+{-| __C declaration:__ @macro TWO_ARGS@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 56:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+tWO_ARGS = (13398 :: CInt, 30874 :: CInt)
+{-| __C declaration:__ @enum a_typedef_enum_e@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 61:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype A_typedef_enum_e
+    = A_typedef_enum_e {unwrapA_typedef_enum_e :: CUChar}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize A_typedef_enum_e
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw A_typedef_enum_e
+    where readRaw = \ptr_0 -> pure A_typedef_enum_e <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw A_typedef_enum_e
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       A_typedef_enum_e unwrapA_typedef_enum_e_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapA_typedef_enum_e_2
+deriving via (EquivStorable A_typedef_enum_e) instance Storable A_typedef_enum_e
+deriving via CUChar instance Prim A_typedef_enum_e
+instance CEnum A_typedef_enum_e
+    where type CEnumZ A_typedef_enum_e = CUChar
+          toCEnum = A_typedef_enum_e
+          fromCEnum = getField @"unwrapA_typedef_enum_e"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "ENUM_CASE_0"),
+                                                         (1, singleton "ENUM_CASE_1"),
+                                                         (2, singleton "ENUM_CASE_2"),
+                                                         (3, singleton "ENUM_CASE_3")]
+          showsUndeclared = showsWrappedUndeclared "A_typedef_enum_e"
+          readPrecUndeclared = readPrecWrappedUndeclared "A_typedef_enum_e"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum A_typedef_enum_e
+    where minDeclaredValue = ENUM_CASE_0
+          maxDeclaredValue = ENUM_CASE_3
+instance Show A_typedef_enum_e
+    where showsPrec = shows
+instance Read A_typedef_enum_e
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUChar =>
+         HasField "unwrapA_typedef_enum_e" A_typedef_enum_e ty
+    where hasField = \x_0 -> (\y_1 -> A_typedef_enum_e{unwrapA_typedef_enum_e = y_1},
+                              getField @"unwrapA_typedef_enum_e" x_0)
+instance (~) ty CUChar =>
+         HasField "unwrapA_typedef_enum_e" (Ptr A_typedef_enum_e) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA_typedef_enum_e")
+instance HasCField A_typedef_enum_e "unwrapA_typedef_enum_e"
+    where type CFieldType A_typedef_enum_e
+                          "unwrapA_typedef_enum_e" = CUChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @ENUM_CASE_0@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 63:3@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern ENUM_CASE_0 :: A_typedef_enum_e
+pattern ENUM_CASE_0 = A_typedef_enum_e 0
+{-| __C declaration:__ @ENUM_CASE_1@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 64:3@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern ENUM_CASE_1 :: A_typedef_enum_e
+pattern ENUM_CASE_1 = A_typedef_enum_e 1
+{-| __C declaration:__ @ENUM_CASE_2@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 65:3@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern ENUM_CASE_2 :: A_typedef_enum_e
+pattern ENUM_CASE_2 = A_typedef_enum_e 2
+{-| __C declaration:__ @ENUM_CASE_3@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 66:3@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+pattern ENUM_CASE_3 :: A_typedef_enum_e
+pattern ENUM_CASE_3 = A_typedef_enum_e 3
+{-| Auxiliary type used by 'Callback_t'
+
+    __C declaration:__ @callback_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 77:19@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype Callback_t_Aux
+    = Callback_t_Aux {unwrapCallback_t_Aux :: (Ptr Void ->
+                                               HsBindgen.Runtime.LibC.Word32 ->
+                                               IO HsBindgen.Runtime.LibC.Word32)}
+    deriving stock Generic
+-- __unique:__ @toCallback_t_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b6b6922e35047658_base ::
+    Ptr Void ->
+    HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32
+ -> IO (FunPtr (Ptr Void ->
+                HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32))
+-- __unique:__ @toCallback_t_Aux@
+hs_bindgen_b6b6922e35047658 :: Callback_t_Aux ->
+                               IO (FunPtr Callback_t_Aux)
+-- __unique:__ @toCallback_t_Aux@
+hs_bindgen_b6b6922e35047658 = \fun_0 -> fmap castFunPtr (hs_bindgen_b6b6922e35047658_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapCallback_t_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromCallback_t_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d6debb4b8d5bb869_base ::
+    FunPtr (Ptr Void ->
+            HsBindgen.Runtime.LibC.Word32 -> IO HsBindgen.Runtime.LibC.Word32)
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.Word32
+ -> IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @fromCallback_t_Aux@
+hs_bindgen_d6debb4b8d5bb869 :: FunPtr Callback_t_Aux ->
+                               Callback_t_Aux
+-- __unique:__ @fromCallback_t_Aux@
+hs_bindgen_d6debb4b8d5bb869 = \funPtr_0 -> Callback_t_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_d6debb4b8d5bb869_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Callback_t_Aux
+    where toFunPtr = hs_bindgen_b6b6922e35047658
+instance FromFunPtr Callback_t_Aux
+    where fromFunPtr = hs_bindgen_d6debb4b8d5bb869
+instance (~) ty
+             (Ptr Void ->
+              HsBindgen.Runtime.LibC.Word32 ->
+              IO HsBindgen.Runtime.LibC.Word32) =>
+         HasField "unwrapCallback_t_Aux" Callback_t_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Callback_t_Aux{unwrapCallback_t_Aux = y_1},
+                              getField @"unwrapCallback_t_Aux" x_0)
+instance (~) ty
+             (Ptr Void ->
+              HsBindgen.Runtime.LibC.Word32 ->
+              IO HsBindgen.Runtime.LibC.Word32) =>
+         HasField "unwrapCallback_t_Aux" (Ptr Callback_t_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapCallback_t_Aux")
+instance HasCField Callback_t_Aux "unwrapCallback_t_Aux"
+    where type CFieldType Callback_t_Aux
+                          "unwrapCallback_t_Aux" = Ptr Void ->
+                                                   HsBindgen.Runtime.LibC.Word32 ->
+                                                   IO HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @callback_t@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 77:19@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+newtype Callback_t
+    = Callback_t {unwrapCallback_t :: (FunPtr Callback_t_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Callback_t_Aux) =>
+         HasField "unwrapCallback_t" Callback_t ty
+    where hasField = \x_0 -> (\y_1 -> Callback_t{unwrapCallback_t = y_1},
+                              getField @"unwrapCallback_t" x_0)
+instance (~) ty (FunPtr Callback_t_Aux) =>
+         HasField "unwrapCallback_t" (Ptr Callback_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapCallback_t")
+instance HasCField Callback_t "unwrapCallback_t"
+    where type CFieldType Callback_t
+                          "unwrapCallback_t" = FunPtr Callback_t_Aux
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Safe_some_fun@
+foreign import ccall safe "hs_bindgen_57cb99ed92c001ad" hs_bindgen_57cb99ed92c001ad_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.Word32
+ -> Ptr Void
+ -> IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Safe_some_fun@
+hs_bindgen_57cb99ed92c001ad :: Ptr A_type_t ->
+                               HsBindgen.Runtime.LibC.Word32 ->
+                               Ptr (Elem (IncompleteArray HsBindgen.Runtime.LibC.Word8)) ->
+                               IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Safe_some_fun@
+hs_bindgen_57cb99ed92c001ad = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_57cb99ed92c001ad_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @some_fun@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 72:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+some_fun_safe :: Ptr A_type_t ->
+                 HsBindgen.Runtime.LibC.Word32 ->
+                 Ptr (Elem (IncompleteArray HsBindgen.Runtime.LibC.Word8)) ->
+                 IO HsBindgen.Runtime.LibC.Int32
+{-| __C declaration:__ @some_fun@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 72:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+some_fun_safe = hs_bindgen_57cb99ed92c001ad
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Unsafe_some_fun@
+foreign import ccall unsafe "hs_bindgen_2a91c367a9380a63" hs_bindgen_2a91c367a9380a63_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.Word32
+ -> Ptr Void
+ -> IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Unsafe_some_fun@
+hs_bindgen_2a91c367a9380a63 :: Ptr A_type_t ->
+                               HsBindgen.Runtime.LibC.Word32 ->
+                               Ptr (Elem (IncompleteArray HsBindgen.Runtime.LibC.Word8)) ->
+                               IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_Unsafe_some_fun@
+hs_bindgen_2a91c367a9380a63 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_2a91c367a9380a63_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @some_fun@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 72:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+some_fun_unsafe :: Ptr A_type_t ->
+                   HsBindgen.Runtime.LibC.Word32 ->
+                   Ptr (Elem (IncompleteArray HsBindgen.Runtime.LibC.Word8)) ->
+                   IO HsBindgen.Runtime.LibC.Int32
+{-| __C declaration:__ @some_fun@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 72:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+some_fun_unsafe = hs_bindgen_2a91c367a9380a63
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_some_fun@
+foreign import ccall unsafe "hs_bindgen_1ade3cfc18679577" hs_bindgen_1ade3cfc18679577_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_some_fun@
+hs_bindgen_1ade3cfc18679577 :: IO (FunPtr (Ptr A_type_t ->
+                                           HsBindgen.Runtime.LibC.Word32 ->
+                                           Ptr (Elem (IncompleteArray HsBindgen.Runtime.LibC.Word8)) ->
+                                           IO HsBindgen.Runtime.LibC.Int32))
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_some_fun@
+hs_bindgen_1ade3cfc18679577 = fmap fromFFIType hs_bindgen_1ade3cfc18679577_base
+{-# NOINLINE some_fun_funptr #-}
+{-| __C declaration:__ @some_fun@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 72:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+some_fun_funptr :: FunPtr (Ptr A_type_t ->
+                           HsBindgen.Runtime.LibC.Word32 ->
+                           Ptr (Elem (IncompleteArray HsBindgen.Runtime.LibC.Word8)) ->
+                           IO HsBindgen.Runtime.LibC.Int32)
+{-| __C declaration:__ @some_fun@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 72:9@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+some_fun_funptr = unsafePerformIO hs_bindgen_1ade3cfc18679577
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_v@
+foreign import ccall unsafe "hs_bindgen_226b16768d8906f3" hs_bindgen_226b16768d8906f3_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_v@
+hs_bindgen_226b16768d8906f3 :: IO (Ptr Var_t)
+-- __unique:__ @test_edgecasesdistilled_lib_1_Example_get_v@
+hs_bindgen_226b16768d8906f3 = fmap fromFFIType hs_bindgen_226b16768d8906f3_base
+{-# NOINLINE v #-}
+{-| __C declaration:__ @v@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 91:14@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+v :: Ptr Var_t
+{-| __C declaration:__ @v@
+
+    __defined at:__ @edge-cases\/distilled_lib_1.h 91:14@
+
+    __exported by:__ @edge-cases\/distilled_lib_1.h@
+-}
+v = unsafePerformIO hs_bindgen_226b16768d8906f3
diff --git a/test-artefacts/fixtures/edge-cases/duplicate/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/duplicate/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/duplicate/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/edge-cases/duplicate/th.txt b/test-artefacts/fixtures/edge-cases/duplicate/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/duplicate/th.txt
@@ -0,0 +1,2 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/duplicate_macro.h
+-- addDependentFile test-artefacts/headers/golden/edge-cases/duplicate.h
diff --git a/test-artefacts/fixtures/edge-cases/duplicate_record_field/Example.hs b/test-artefacts/fixtures/edge-cases/duplicate_record_field/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/duplicate_record_field/Example.hs
@@ -0,0 +1,157 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    , Example.B(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct A@
+
+    __defined at:__ @edge-cases\/duplicate_record_field.h 1:8@
+
+    __exported by:__ @edge-cases\/duplicate_record_field.h@
+-}
+data A = A
+  { dup :: BG.CInt
+    {- ^ __C declaration:__ @dup@
+
+         __defined at:__ @edge-cases\/duplicate_record_field.h 2:7@
+
+         __exported by:__ @edge-cases\/duplicate_record_field.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize A where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw A where
+
+  readRaw =
+    \ptr0 ->
+          pure A
+      <*> HasCField.readRaw (BG.Proxy @"dup") ptr0
+
+instance Marshal.WriteRaw A where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          A dup2 ->
+            HasCField.writeRaw (BG.Proxy @"dup") ptr0 dup2
+
+deriving via Marshal.EquivStorable A instance BG.Storable A
+
+deriving via Struct.IsStructViaReadRaw A instance Struct.IsStruct A
+
+{-| __C declaration:__ @dup@
+
+    __defined at:__ @edge-cases\/duplicate_record_field.h 2:7@
+
+    __exported by:__ @edge-cases\/duplicate_record_field.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "dup" A ty where
+
+  hasField =
+    \x0 -> (\y1 -> A {dup = y1}, BG.getField @"dup" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "dup" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dup")
+
+instance HasCField.HasCField A "dup" where
+
+  type CFieldType A "dup" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct B@
+
+    __defined at:__ @edge-cases\/duplicate_record_field.h 5:8@
+
+    __exported by:__ @edge-cases\/duplicate_record_field.h@
+-}
+data B = B
+  { dup :: BG.CInt
+    {- ^ __C declaration:__ @dup@
+
+         __defined at:__ @edge-cases\/duplicate_record_field.h 6:7@
+
+         __exported by:__ @edge-cases\/duplicate_record_field.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize B where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw B where
+
+  readRaw =
+    \ptr0 ->
+          pure B
+      <*> HasCField.readRaw (BG.Proxy @"dup") ptr0
+
+instance Marshal.WriteRaw B where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          B dup2 ->
+            HasCField.writeRaw (BG.Proxy @"dup") ptr0 dup2
+
+deriving via Marshal.EquivStorable B instance BG.Storable B
+
+deriving via Struct.IsStructViaReadRaw B instance Struct.IsStruct B
+
+{-| __C declaration:__ @dup@
+
+    __defined at:__ @edge-cases\/duplicate_record_field.h 6:7@
+
+    __exported by:__ @edge-cases\/duplicate_record_field.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "dup" B ty where
+
+  hasField =
+    \x0 -> (\y1 -> B {dup = y1}, BG.getField @"dup" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "dup" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dup")
+
+instance HasCField.HasCField B "dup" where
+
+  type CFieldType B "dup" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/edge-cases/duplicate_record_field/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/duplicate_record_field/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/duplicate_record_field/bindingspec.yaml
@@ -0,0 +1,50 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/duplicate_record_field.h
+  cname: struct A
+  hsname: A
+- headers: edge-cases/duplicate_record_field.h
+  cname: struct B
+  hsname: B
+hstypes:
+- hsname: A
+  representation:
+    record:
+      constructor: A
+      fields:
+      - dup
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    record:
+      constructor: B
+      fields:
+      - dup
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/duplicate_record_field/th.txt b/test-artefacts/fixtures/edge-cases/duplicate_record_field/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/duplicate_record_field/th.txt
@@ -0,0 +1,67 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/duplicate_record_field.h
+{-| __C declaration:__ @struct A@
+
+    __defined at:__ @edge-cases\/duplicate_record_field.h 1:8@
+
+    __exported by:__ @edge-cases\/duplicate_record_field.h@
+-}
+data A
+    = A {dup :: CInt
+         {- ^ __C declaration:__ @dup@
+
+              __defined at:__ @edge-cases\/duplicate_record_field.h 2:7@
+
+              __exported by:__ @edge-cases\/duplicate_record_field.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize A
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw A
+    where readRaw = \ptr_0 -> pure A <*> readRaw (Proxy @"dup") ptr_0
+instance WriteRaw A
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       A dup_2 -> writeRaw (Proxy @"dup") ptr_0 dup_2
+deriving via (EquivStorable A) instance Storable A
+deriving via (IsStructViaReadRaw A) instance IsStruct A
+instance (~) ty CInt => HasField "dup" A ty
+    where hasField = \x_0 -> (\y_1 -> A{dup = y_1},
+                              getField @"dup" x_0)
+instance (~) ty CInt => HasField "dup" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"dup")
+instance HasCField A "dup"
+    where type CFieldType A "dup" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct B@
+
+    __defined at:__ @edge-cases\/duplicate_record_field.h 5:8@
+
+    __exported by:__ @edge-cases\/duplicate_record_field.h@
+-}
+data B
+    = B {dup :: CInt
+         {- ^ __C declaration:__ @dup@
+
+              __defined at:__ @edge-cases\/duplicate_record_field.h 6:7@
+
+              __exported by:__ @edge-cases\/duplicate_record_field.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize B
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw B
+    where readRaw = \ptr_0 -> pure B <*> readRaw (Proxy @"dup") ptr_0
+instance WriteRaw B
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       B dup_2 -> writeRaw (Proxy @"dup") ptr_0 dup_2
+deriving via (EquivStorable B) instance Storable B
+deriving via (IsStructViaReadRaw B) instance IsStruct B
+instance (~) ty CInt => HasField "dup" B ty
+    where hasField = \x_0 -> (\y_1 -> B{dup = y_1},
+                              getField @"dup" x_0)
+instance (~) ty CInt => HasField "dup" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"dup")
+instance HasCField B "dup"
+    where type CFieldType B "dup" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/edge-cases/enum_as_array_size/Example.hs b/test-artefacts/fixtures/edge-cases/enum_as_array_size/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/enum_as_array_size/Example.hs
@@ -0,0 +1,145 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Test(..)
+    , pattern Example.Test_a
+    , pattern Example.Test_count
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum test@
+
+    __defined at:__ @edge-cases\/enum_as_array_size.h 3:6@
+
+    __exported by:__ @edge-cases\/enum_as_array_size.h@
+-}
+newtype Test = Test
+  { unwrapTest :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Test where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Test where
+
+  readRaw =
+    \ptr0 ->
+          pure Test
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Test where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Test unwrapTest2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapTest2
+
+deriving via Marshal.EquivStorable Test instance BG.Storable Test
+
+deriving via BG.CUInt instance BG.Prim Test
+
+instance CEnum.CEnum Test where
+
+  type CEnumZ Test = BG.CUInt
+
+  toCEnum = Test
+
+  fromCEnum = BG.getField @"unwrapTest"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "Test_a"), (1, BG.singleton "Test_count")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "Test"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Test"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Test where
+
+  minDeclaredValue = Test_a
+
+  maxDeclaredValue = Test_count
+
+instance Show Test where
+
+  showsPrec = CEnum.shows
+
+instance Read Test where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapTest" Test ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Test {unwrapTest = y1}, BG.getField @"unwrapTest" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapTest" (BG.Ptr Test) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTest")
+
+instance HasCField.HasCField Test "unwrapTest" where
+
+  type CFieldType Test "unwrapTest" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @test_a@
+
+    __defined at:__ @edge-cases\/enum_as_array_size.h 4:3@
+
+    __exported by:__ @edge-cases\/enum_as_array_size.h@
+-}
+pattern Test_a :: Test
+pattern Test_a = Test 0
+
+{-| __C declaration:__ @test_count@
+
+    __defined at:__ @edge-cases\/enum_as_array_size.h 5:3@
+
+    __exported by:__ @edge-cases\/enum_as_array_size.h@
+-}
+pattern Test_count :: Test
+pattern Test_count = Test 1
diff --git a/test-artefacts/fixtures/edge-cases/enum_as_array_size/Example/Global.hs b/test-artefacts/fixtures/edge-cases/enum_as_array_size/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/enum_as_array_size/Example/Global.hs
@@ -0,0 +1,53 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.test_array
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/enum_as_array_size.h>"
+  , "/* test_edgecasesenum_as_array_size_Example_get_test_array */"
+  , "__attribute__ ((const))"
+  , "char const (*hs_bindgen_30b94bcf7e387817 (void))[1]"
+  , "{"
+  , "  return &test_array;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesenum_as_array_size_Example_get_test_array@
+foreign import ccall unsafe "hs_bindgen_30b94bcf7e387817" hs_bindgen_30b94bcf7e387817_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesenum_as_array_size_Example_get_test_array@
+hs_bindgen_30b94bcf7e387817 :: IO (PtrConst.PtrConst (CA.ConstantArray 1 BG.CChar))
+hs_bindgen_30b94bcf7e387817 =
+  fmap BG.fromFFIType hs_bindgen_30b94bcf7e387817_base
+
+{-# NOINLINE hs_bindgen_e30c033f156164cc #-}
+{-| __C declaration:__ @test_array@
+
+    __defined at:__ @edge-cases\/enum_as_array_size.h 8:19@
+
+    __exported by:__ @edge-cases\/enum_as_array_size.h@
+
+    __unique:__ @test_edgecasesenum_as_array_size_Example_test_array@
+-}
+hs_bindgen_e30c033f156164cc :: PtrConst.PtrConst (CA.ConstantArray 1 BG.CChar)
+hs_bindgen_e30c033f156164cc =
+  BG.unsafePerformIO hs_bindgen_30b94bcf7e387817
+
+{-# NOINLINE test_array #-}
+test_array :: CA.ConstantArray 1 BG.CChar
+test_array =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_e30c033f156164cc)
diff --git a/test-artefacts/fixtures/edge-cases/enum_as_array_size/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/enum_as_array_size/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/enum_as_array_size/bindingspec.yaml
@@ -0,0 +1,37 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/enum_as_array_size.h
+  cname: enum test
+  hsname: Test
+  enum: open
+hstypes:
+- hsname: Test
+  representation:
+    newtype:
+      constructor: Test
+      fields:
+      - unwrapTest
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/enum_as_array_size/th.txt b/test-artefacts/fixtures/edge-cases/enum_as_array_size/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/enum_as_array_size/th.txt
@@ -0,0 +1,102 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/enum_as_array_size.h
+-- #include <edge-cases/enum_as_array_size.h>
+-- /* test_edgecasesenum_as_array_size_Example_get_test_array */
+-- __attribute__ ((const))
+-- char const (*hs_bindgen_30b94bcf7e387817 (void))[1]
+-- {
+--   return &test_array;
+-- }
+{-| __C declaration:__ @enum test@
+
+    __defined at:__ @edge-cases\/enum_as_array_size.h 3:6@
+
+    __exported by:__ @edge-cases\/enum_as_array_size.h@
+-}
+newtype Test
+    = Test {unwrapTest :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Test
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Test
+    where readRaw = \ptr_0 -> pure Test <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Test
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Test unwrapTest_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapTest_2
+deriving via (EquivStorable Test) instance Storable Test
+deriving via CUInt instance Prim Test
+instance CEnum Test
+    where type CEnumZ Test = CUInt
+          toCEnum = Test
+          fromCEnum = getField @"unwrapTest"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "Test_a"),
+                                                         (1, singleton "Test_count")]
+          showsUndeclared = showsWrappedUndeclared "Test"
+          readPrecUndeclared = readPrecWrappedUndeclared "Test"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Test
+    where minDeclaredValue = Test_a
+          maxDeclaredValue = Test_count
+instance Show Test
+    where showsPrec = shows
+instance Read Test
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapTest" Test ty
+    where hasField = \x_0 -> (\y_1 -> Test{unwrapTest = y_1},
+                              getField @"unwrapTest" x_0)
+instance (~) ty CUInt => HasField "unwrapTest" (Ptr Test) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTest")
+instance HasCField Test "unwrapTest"
+    where type CFieldType Test "unwrapTest" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @test_a@
+
+    __defined at:__ @edge-cases\/enum_as_array_size.h 4:3@
+
+    __exported by:__ @edge-cases\/enum_as_array_size.h@
+-}
+pattern Test_a :: Test
+pattern Test_a = Test 0
+{-| __C declaration:__ @test_count@
+
+    __defined at:__ @edge-cases\/enum_as_array_size.h 5:3@
+
+    __exported by:__ @edge-cases\/enum_as_array_size.h@
+-}
+pattern Test_count :: Test
+pattern Test_count = Test 1
+-- __unique:__ @test_edgecasesenum_as_array_size_Example_get_test_array@
+foreign import ccall unsafe "hs_bindgen_30b94bcf7e387817" hs_bindgen_30b94bcf7e387817_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_edgecasesenum_as_array_size_Example_get_test_array@
+hs_bindgen_30b94bcf7e387817 :: IO (PtrConst (ConstantArray 1
+                                                           CChar))
+-- __unique:__ @test_edgecasesenum_as_array_size_Example_get_test_array@
+hs_bindgen_30b94bcf7e387817 = fmap fromFFIType hs_bindgen_30b94bcf7e387817_base
+{-# NOINLINE hs_bindgen_e30c033f156164cc #-}
+{-| __C declaration:__ @test_array@
+
+    __defined at:__ @edge-cases\/enum_as_array_size.h 8:19@
+
+    __exported by:__ @edge-cases\/enum_as_array_size.h@
+
+    __unique:__ @test_edgecasesenum_as_array_size_Example_test_array@
+-}
+hs_bindgen_e30c033f156164cc :: PtrConst (ConstantArray 1 CChar)
+{-| __C declaration:__ @test_array@
+
+    __defined at:__ @edge-cases\/enum_as_array_size.h 8:19@
+
+    __exported by:__ @edge-cases\/enum_as_array_size.h@
+
+    __unique:__ @test_edgecasesenum_as_array_size_Example_test_array@
+-}
+hs_bindgen_e30c033f156164cc = unsafePerformIO hs_bindgen_30b94bcf7e387817
+{-# NOINLINE test_array #-}
+test_array :: ConstantArray 1 CChar
+test_array = unsafePerformIO (peek hs_bindgen_e30c033f156164cc)
diff --git a/test-artefacts/fixtures/edge-cases/flam/Example.hs b/test-artefacts/fixtures/edge-cases/flam/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/flam/Example.hs
@@ -0,0 +1,506 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Pascal_Aux(..)
+    , Example.Pascal
+    , Example.Foo_bar(..)
+    , Example.Foo_Aux(..)
+    , Example.Foo
+    , Example.Diff_Aux(..)
+    , Example.Diff
+    , Example.Triplets_Aux(..)
+    , Example.Triplets
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.FLAM as FLAM
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct pascal@
+
+    __defined at:__ @edge-cases\/flam.h 2:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Pascal_Aux = Pascal
+  { pascal_len :: BG.CInt
+    {- ^ __C declaration:__ @len@
+
+         __defined at:__ @edge-cases\/flam.h 3:9@
+
+         __exported by:__ @edge-cases\/flam.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Pascal_Aux where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Pascal_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure Pascal
+      <*> HasCField.readRaw (BG.Proxy @"pascal_len") ptr0
+
+instance Marshal.WriteRaw Pascal_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Pascal pascal_len2 ->
+            HasCField.writeRaw (BG.Proxy @"pascal_len") ptr0 pascal_len2
+
+deriving via Marshal.EquivStorable Pascal_Aux instance BG.Storable Pascal_Aux
+
+deriving via Struct.IsStructViaReadRaw Pascal_Aux instance Struct.IsStruct Pascal_Aux
+
+{-| __C declaration:__ @len@
+
+    __defined at:__ @edge-cases\/flam.h 3:9@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "pascal_len" Pascal_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Pascal {pascal_len = y1}, BG.getField @"pascal_len" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "pascal_len" (BG.Ptr Pascal_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"pascal_len")
+
+instance HasCField.HasCField Pascal_Aux "pascal_len" where
+
+  type CFieldType Pascal_Aux "pascal_len" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+instance FLAM.Offset BG.CChar Pascal_Aux where
+
+  offset = \_proxy0 -> 4
+
+{-| __C declaration:__ @struct pascal@
+
+    __defined at:__ @edge-cases\/flam.h 2:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+type Pascal = FLAM.WithFlam BG.CChar Pascal_Aux
+
+{-| __C declaration:__ @struct \@foo_bar@
+
+    __defined at:__ @edge-cases\/flam.h 10:2@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Foo_bar = Foo_bar
+  { foo_bar_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/flam.h 11:7@
+
+         __exported by:__ @edge-cases\/flam.h@
+    -}
+  , foo_bar_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @edge-cases\/flam.h 12:7@
+
+         __exported by:__ @edge-cases\/flam.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo_bar where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Foo_bar where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo_bar
+      <*> HasCField.readRaw (BG.Proxy @"foo_bar_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"foo_bar_y") ptr0
+
+instance Marshal.WriteRaw Foo_bar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo_bar foo_bar_x2 foo_bar_y3 ->
+               HasCField.writeRaw (BG.Proxy @"foo_bar_x") ptr0 foo_bar_x2
+            >> HasCField.writeRaw (BG.Proxy @"foo_bar_y") ptr0 foo_bar_y3
+
+deriving via Marshal.EquivStorable Foo_bar instance BG.Storable Foo_bar
+
+deriving via Struct.IsStructViaReadRaw Foo_bar instance Struct.IsStruct Foo_bar
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/flam.h 11:7@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_bar_x" Foo_bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_bar {foo_bar_x = y1, foo_bar_y = BG.getField @"foo_bar_y" x0}
+      , BG.getField @"foo_bar_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_bar_x" (BG.Ptr Foo_bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_bar_x")
+
+instance HasCField.HasCField Foo_bar "foo_bar_x" where
+
+  type CFieldType Foo_bar "foo_bar_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @edge-cases\/flam.h 12:7@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_bar_y" Foo_bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_bar {foo_bar_y = y1, foo_bar_x = BG.getField @"foo_bar_x" x0}
+      , BG.getField @"foo_bar_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_bar_y" (BG.Ptr Foo_bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_bar_y")
+
+instance HasCField.HasCField Foo_bar "foo_bar_y" where
+
+  type CFieldType Foo_bar "foo_bar_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @edge-cases\/flam.h 8:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Foo_Aux = Foo
+  { foo_len :: BG.CInt
+    {- ^ __C declaration:__ @len@
+
+         __defined at:__ @edge-cases\/flam.h 9:6@
+
+         __exported by:__ @edge-cases\/flam.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo_Aux where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Foo_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo
+      <*> HasCField.readRaw (BG.Proxy @"foo_len") ptr0
+
+instance Marshal.WriteRaw Foo_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo foo_len2 ->
+            HasCField.writeRaw (BG.Proxy @"foo_len") ptr0 foo_len2
+
+deriving via Marshal.EquivStorable Foo_Aux instance BG.Storable Foo_Aux
+
+deriving via Struct.IsStructViaReadRaw Foo_Aux instance Struct.IsStruct Foo_Aux
+
+{-| __C declaration:__ @len@
+
+    __defined at:__ @edge-cases\/flam.h 9:6@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_len" Foo_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo {foo_len = y1}, BG.getField @"foo_len" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_len" (BG.Ptr Foo_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_len")
+
+instance HasCField.HasCField Foo_Aux "foo_len" where
+
+  type CFieldType Foo_Aux "foo_len" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+instance FLAM.Offset Foo_bar Foo_Aux where
+
+  offset = \_proxy0 -> 4
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @edge-cases\/flam.h 8:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+type Foo = FLAM.WithFlam Foo_bar Foo_Aux
+
+{-| __C declaration:__ @struct diff@
+
+    __defined at:__ @edge-cases\/flam.h 17:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Diff_Aux = Diff
+  { diff_first :: BG.CLong
+    {- ^ __C declaration:__ @first@
+
+         __defined at:__ @edge-cases\/flam.h 18:7@
+
+         __exported by:__ @edge-cases\/flam.h@
+    -}
+  , diff_second :: BG.CChar
+    {- ^ __C declaration:__ @second@
+
+         __defined at:__ @edge-cases\/flam.h 19:7@
+
+         __exported by:__ @edge-cases\/flam.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Diff_Aux where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Diff_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure Diff
+      <*> HasCField.readRaw (BG.Proxy @"diff_first") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"diff_second") ptr0
+
+instance Marshal.WriteRaw Diff_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Diff diff_first2 diff_second3 ->
+               HasCField.writeRaw (BG.Proxy @"diff_first") ptr0 diff_first2
+            >> HasCField.writeRaw (BG.Proxy @"diff_second") ptr0 diff_second3
+
+deriving via Marshal.EquivStorable Diff_Aux instance BG.Storable Diff_Aux
+
+deriving via Struct.IsStructViaReadRaw Diff_Aux instance Struct.IsStruct Diff_Aux
+
+{-| __C declaration:__ @first@
+
+    __defined at:__ @edge-cases\/flam.h 18:7@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "diff_first" Diff_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Diff {diff_first = y1, diff_second = BG.getField @"diff_second" x0}
+      , BG.getField @"diff_first" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "diff_first" (BG.Ptr Diff_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"diff_first")
+
+instance HasCField.HasCField Diff_Aux "diff_first" where
+
+  type CFieldType Diff_Aux "diff_first" = BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @second@
+
+    __defined at:__ @edge-cases\/flam.h 19:7@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "diff_second" Diff_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Diff {diff_second = y1, diff_first = BG.getField @"diff_first" x0}
+      , BG.getField @"diff_second" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "diff_second" (BG.Ptr Diff_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"diff_second")
+
+instance HasCField.HasCField Diff_Aux "diff_second" where
+
+  type CFieldType Diff_Aux "diff_second" = BG.CChar
+
+  offset# = \_ -> \_ -> 8
+
+instance FLAM.Offset BG.CChar Diff_Aux where
+
+  offset = \_proxy0 -> 9
+
+{-| __C declaration:__ @struct diff@
+
+    __defined at:__ @edge-cases\/flam.h 17:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+type Diff = FLAM.WithFlam BG.CChar Diff_Aux
+
+{-| The flexible array member is a multi-dimensional array of unknown size. In particular, it is a is an array of unknown size, where each element is of type length-3-array-of-int.
+
+    __C declaration:__ @struct triplets@
+
+    __defined at:__ @edge-cases\/flam.h 26:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Triplets_Aux = Triplets
+  { triplets_len :: BG.CInt
+    {- ^ __C declaration:__ @len@
+
+         __defined at:__ @edge-cases\/flam.h 27:7@
+
+         __exported by:__ @edge-cases\/flam.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Triplets_Aux where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Triplets_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure Triplets
+      <*> HasCField.readRaw (BG.Proxy @"triplets_len") ptr0
+
+instance Marshal.WriteRaw Triplets_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Triplets triplets_len2 ->
+            HasCField.writeRaw (BG.Proxy @"triplets_len") ptr0 triplets_len2
+
+deriving via Marshal.EquivStorable Triplets_Aux instance BG.Storable Triplets_Aux
+
+deriving via Struct.IsStructViaReadRaw Triplets_Aux instance Struct.IsStruct Triplets_Aux
+
+{-| __C declaration:__ @len@
+
+    __defined at:__ @edge-cases\/flam.h 27:7@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "triplets_len" Triplets_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Triplets {triplets_len = y1}, BG.getField @"triplets_len" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "triplets_len" (BG.Ptr Triplets_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"triplets_len")
+
+instance HasCField.HasCField Triplets_Aux "triplets_len" where
+
+  type CFieldType Triplets_Aux "triplets_len" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+instance FLAM.Offset (CA.ConstantArray 3 BG.CInt) Triplets_Aux where
+
+  offset = \_proxy0 -> 4
+
+{-| The flexible array member is a multi-dimensional array of unknown size. In particular, it is a is an array of unknown size, where each element is of type length-3-array-of-int.
+
+    __C declaration:__ @struct triplets@
+
+    __defined at:__ @edge-cases\/flam.h 26:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+type Triplets =
+  FLAM.WithFlam (CA.ConstantArray 3 BG.CInt) Triplets_Aux
diff --git a/test-artefacts/fixtures/edge-cases/flam/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/flam/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/flam/bindingspec.yaml
@@ -0,0 +1,142 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/flam.h
+  cname: struct pascal
+  hsname: Pascal_Aux
+- headers: edge-cases/flam.h
+  cname: struct pascal
+  hsname: Pascal
+- headers: edge-cases/flam.h
+  cname: struct foo
+  hsname: Foo_Aux
+- headers: edge-cases/flam.h
+  cname: struct foo
+  hsname: Foo
+- headers: edge-cases/flam.h
+  cname: struct @foo_bar
+  hsname: Foo_bar
+- headers: edge-cases/flam.h
+  cname: struct diff
+  hsname: Diff_Aux
+- headers: edge-cases/flam.h
+  cname: struct diff
+  hsname: Diff
+- headers: edge-cases/flam.h
+  cname: struct triplets
+  hsname: Triplets_Aux
+- headers: edge-cases/flam.h
+  cname: struct triplets
+  hsname: Triplets
+hstypes:
+- hsname: Diff
+  representation: typealias
+- hsname: Diff_Aux
+  representation:
+    record:
+      constructor: Diff
+      fields:
+      - diff_first
+      - diff_second
+  instances:
+  - Eq
+  - Flam_Offset
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation: typealias
+- hsname: Foo_Aux
+  representation:
+    record:
+      constructor: Foo
+      fields:
+      - foo_len
+  instances:
+  - Eq
+  - Flam_Offset
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_bar
+  representation:
+    record:
+      constructor: Foo_bar
+      fields:
+      - foo_bar_x
+      - foo_bar_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Pascal
+  representation: typealias
+- hsname: Pascal_Aux
+  representation:
+    record:
+      constructor: Pascal
+      fields:
+      - pascal_len
+  instances:
+  - Eq
+  - Flam_Offset
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Triplets
+  representation: typealias
+- hsname: Triplets_Aux
+  representation:
+    record:
+      constructor: Triplets
+      fields:
+      - triplets_len
+  instances:
+  - Eq
+  - Flam_Offset
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/flam/th.txt b/test-artefacts/fixtures/edge-cases/flam/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/flam/th.txt
@@ -0,0 +1,220 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/flam.h
+{-| __C declaration:__ @struct pascal@
+
+    __defined at:__ @edge-cases\/flam.h 2:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Pascal_Aux
+    = Pascal {pascal_len :: CInt
+              {- ^ __C declaration:__ @len@
+
+                   __defined at:__ @edge-cases\/flam.h 3:9@
+
+                   __exported by:__ @edge-cases\/flam.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Pascal_Aux
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Pascal_Aux
+    where readRaw = \ptr_0 -> pure Pascal <*> readRaw (Proxy @"pascal_len") ptr_0
+instance WriteRaw Pascal_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Pascal pascal_len_2 -> writeRaw (Proxy @"pascal_len") ptr_0 pascal_len_2
+deriving via (EquivStorable Pascal_Aux) instance Storable Pascal_Aux
+deriving via (IsStructViaReadRaw Pascal_Aux) instance IsStruct Pascal_Aux
+instance (~) ty CInt => HasField "pascal_len" Pascal_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Pascal{pascal_len = y_1},
+                              getField @"pascal_len" x_0)
+instance (~) ty CInt =>
+         HasField "pascal_len" (Ptr Pascal_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"pascal_len")
+instance HasCField Pascal_Aux "pascal_len"
+    where type CFieldType Pascal_Aux "pascal_len" = CInt
+          offset# = \_ -> \_ -> 0
+instance Offset CChar Pascal_Aux
+    where offset = \_proxy_0 -> 4
+type Pascal = WithFlam CChar Pascal_Aux
+{-| __C declaration:__ @struct \@foo_bar@
+
+    __defined at:__ @edge-cases\/flam.h 10:2@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Foo_bar
+    = Foo_bar {foo_bar_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @edge-cases\/flam.h 11:7@
+
+                    __exported by:__ @edge-cases\/flam.h@
+               -},
+               foo_bar_y :: CInt
+               {- ^ __C declaration:__ @y@
+
+                    __defined at:__ @edge-cases\/flam.h 12:7@
+
+                    __exported by:__ @edge-cases\/flam.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo_bar
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Foo_bar
+    where readRaw = \ptr_0 -> (pure Foo_bar <*> readRaw (Proxy @"foo_bar_x") ptr_0) <*> readRaw (Proxy @"foo_bar_y") ptr_0
+instance WriteRaw Foo_bar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo_bar foo_bar_x_2
+                                               foo_bar_y_3 -> writeRaw (Proxy @"foo_bar_x") ptr_0 foo_bar_x_2 >> writeRaw (Proxy @"foo_bar_y") ptr_0 foo_bar_y_3
+deriving via (EquivStorable Foo_bar) instance Storable Foo_bar
+deriving via (IsStructViaReadRaw Foo_bar) instance IsStruct Foo_bar
+instance (~) ty CInt => HasField "foo_bar_x" Foo_bar ty
+    where hasField = \x_0 -> (\y_1 -> Foo_bar{foo_bar_x = y_1,
+                                              foo_bar_y = getField @"foo_bar_y" x_0},
+                              getField @"foo_bar_x" x_0)
+instance (~) ty CInt => HasField "foo_bar_x" (Ptr Foo_bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_bar_x")
+instance HasCField Foo_bar "foo_bar_x"
+    where type CFieldType Foo_bar "foo_bar_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "foo_bar_y" Foo_bar ty
+    where hasField = \x_0 -> (\y_1 -> Foo_bar{foo_bar_y = y_1,
+                                              foo_bar_x = getField @"foo_bar_x" x_0},
+                              getField @"foo_bar_y" x_0)
+instance (~) ty CInt => HasField "foo_bar_y" (Ptr Foo_bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_bar_y")
+instance HasCField Foo_bar "foo_bar_y"
+    where type CFieldType Foo_bar "foo_bar_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @edge-cases\/flam.h 8:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Foo_Aux
+    = Foo {foo_len :: CInt
+           {- ^ __C declaration:__ @len@
+
+                __defined at:__ @edge-cases\/flam.h 9:6@
+
+                __exported by:__ @edge-cases\/flam.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo_Aux
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Foo_Aux
+    where readRaw = \ptr_0 -> pure Foo <*> readRaw (Proxy @"foo_len") ptr_0
+instance WriteRaw Foo_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo foo_len_2 -> writeRaw (Proxy @"foo_len") ptr_0 foo_len_2
+deriving via (EquivStorable Foo_Aux) instance Storable Foo_Aux
+deriving via (IsStructViaReadRaw Foo_Aux) instance IsStruct Foo_Aux
+instance (~) ty CInt => HasField "foo_len" Foo_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_len = y_1},
+                              getField @"foo_len" x_0)
+instance (~) ty CInt => HasField "foo_len" (Ptr Foo_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_len")
+instance HasCField Foo_Aux "foo_len"
+    where type CFieldType Foo_Aux "foo_len" = CInt
+          offset# = \_ -> \_ -> 0
+instance Offset Foo_bar Foo_Aux
+    where offset = \_proxy_0 -> 4
+type Foo = WithFlam Foo_bar Foo_Aux
+{-| __C declaration:__ @struct diff@
+
+    __defined at:__ @edge-cases\/flam.h 17:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Diff_Aux
+    = Diff {diff_first :: CLong
+            {- ^ __C declaration:__ @first@
+
+                 __defined at:__ @edge-cases\/flam.h 18:7@
+
+                 __exported by:__ @edge-cases\/flam.h@
+            -},
+            diff_second :: CChar
+            {- ^ __C declaration:__ @second@
+
+                 __defined at:__ @edge-cases\/flam.h 19:7@
+
+                 __exported by:__ @edge-cases\/flam.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Diff_Aux
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Diff_Aux
+    where readRaw = \ptr_0 -> (pure Diff <*> readRaw (Proxy @"diff_first") ptr_0) <*> readRaw (Proxy @"diff_second") ptr_0
+instance WriteRaw Diff_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Diff diff_first_2
+                                            diff_second_3 -> writeRaw (Proxy @"diff_first") ptr_0 diff_first_2 >> writeRaw (Proxy @"diff_second") ptr_0 diff_second_3
+deriving via (EquivStorable Diff_Aux) instance Storable Diff_Aux
+deriving via (IsStructViaReadRaw Diff_Aux) instance IsStruct Diff_Aux
+instance (~) ty CLong => HasField "diff_first" Diff_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Diff{diff_first = y_1,
+                                           diff_second = getField @"diff_second" x_0},
+                              getField @"diff_first" x_0)
+instance (~) ty CLong =>
+         HasField "diff_first" (Ptr Diff_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"diff_first")
+instance HasCField Diff_Aux "diff_first"
+    where type CFieldType Diff_Aux "diff_first" = CLong
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar => HasField "diff_second" Diff_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Diff{diff_second = y_1,
+                                           diff_first = getField @"diff_first" x_0},
+                              getField @"diff_second" x_0)
+instance (~) ty CChar =>
+         HasField "diff_second" (Ptr Diff_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"diff_second")
+instance HasCField Diff_Aux "diff_second"
+    where type CFieldType Diff_Aux "diff_second" = CChar
+          offset# = \_ -> \_ -> 8
+instance Offset CChar Diff_Aux
+    where offset = \_proxy_0 -> 9
+type Diff = WithFlam CChar Diff_Aux
+{-| The flexible array member is a multi-dimensional array of unknown size. In particular, it is a is an array of unknown size, where each element is of type length-3-array-of-int.
+
+    __C declaration:__ @struct triplets@
+
+    __defined at:__ @edge-cases\/flam.h 26:8@
+
+    __exported by:__ @edge-cases\/flam.h@
+-}
+data Triplets_Aux
+    = Triplets {triplets_len :: CInt
+                {- ^ __C declaration:__ @len@
+
+                     __defined at:__ @edge-cases\/flam.h 27:7@
+
+                     __exported by:__ @edge-cases\/flam.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Triplets_Aux
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Triplets_Aux
+    where readRaw = \ptr_0 -> pure Triplets <*> readRaw (Proxy @"triplets_len") ptr_0
+instance WriteRaw Triplets_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Triplets triplets_len_2 -> writeRaw (Proxy @"triplets_len") ptr_0 triplets_len_2
+deriving via (EquivStorable Triplets_Aux) instance Storable Triplets_Aux
+deriving via (IsStructViaReadRaw Triplets_Aux) instance IsStruct Triplets_Aux
+instance (~) ty CInt => HasField "triplets_len" Triplets_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Triplets{triplets_len = y_1},
+                              getField @"triplets_len" x_0)
+instance (~) ty CInt =>
+         HasField "triplets_len" (Ptr Triplets_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"triplets_len")
+instance HasCField Triplets_Aux "triplets_len"
+    where type CFieldType Triplets_Aux "triplets_len" = CInt
+          offset# = \_ -> \_ -> 0
+instance Offset (ConstantArray 3 CInt) Triplets_Aux
+    where offset = \_proxy_0 -> 4
+type Triplets = WithFlam (ConstantArray 3 CInt) Triplets_Aux
diff --git a/test-artefacts/fixtures/edge-cases/flam_functions/Example.hs b/test-artefacts/fixtures/edge-cases/flam_functions/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/flam_functions/Example.hs
@@ -0,0 +1,109 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Vector_Aux(..)
+    , Example.Vector
+    )
+  where
+
+import qualified HsBindgen.Runtime.FLAM as FLAM
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct Vector@
+
+    __defined at:__ @edge-cases\/flam_functions.h 1:8@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+data Vector_Aux = Vector
+  { vector_length :: BG.CInt
+    {- ^ __C declaration:__ @length@
+
+         __defined at:__ @edge-cases\/flam_functions.h 2:7@
+
+         __exported by:__ @edge-cases\/flam_functions.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Vector_Aux where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Vector_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure Vector
+      <*> HasCField.readRaw (BG.Proxy @"vector_length") ptr0
+
+instance Marshal.WriteRaw Vector_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Vector vector_length2 ->
+            HasCField.writeRaw (BG.Proxy @"vector_length") ptr0 vector_length2
+
+deriving via Marshal.EquivStorable Vector_Aux instance BG.Storable Vector_Aux
+
+deriving via Struct.IsStructViaReadRaw Vector_Aux instance Struct.IsStruct Vector_Aux
+
+{-| __C declaration:__ @length@
+
+    __defined at:__ @edge-cases\/flam_functions.h 2:7@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vector_length" Vector_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Vector {vector_length = y1}, BG.getField @"vector_length" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vector_length" (BG.Ptr Vector_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vector_length")
+
+instance HasCField.HasCField Vector_Aux "vector_length" where
+
+  type CFieldType Vector_Aux "vector_length" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+instance FLAM.Offset BG.CLong Vector_Aux where
+
+  offset = \_proxy0 -> 8
+
+{-| __C declaration:__ @struct Vector@
+
+    __defined at:__ @edge-cases\/flam_functions.h 1:8@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+type Vector = FLAM.WithFlam BG.CLong Vector_Aux
diff --git a/test-artefacts/fixtures/edge-cases/flam_functions/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/flam_functions/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/flam_functions/Example/FunPtr.hs
@@ -0,0 +1,104 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.vector_alloc
+    , Example.FunPtr.vector_free
+    , Example.FunPtr.vector_reverse
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/flam_functions.h>"
+  , "/* test_edgecasesflam_functions_Example_get_vector_alloc */"
+  , "__attribute__ ((const))"
+  , "struct Vector *(*hs_bindgen_d243fc6d495ec901 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &vector_alloc;"
+  , "}"
+  , "/* test_edgecasesflam_functions_Example_get_vector_free */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1d7c878fb2029890 (void)) ("
+  , "  struct Vector *arg1"
+  , ")"
+  , "{"
+  , "  return &vector_free;"
+  , "}"
+  , "/* test_edgecasesflam_functions_Example_get_vector_reverse */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_630caac5f56516fe (void)) ("
+  , "  struct Vector *arg1"
+  , ")"
+  , "{"
+  , "  return &vector_reverse;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_alloc@
+foreign import ccall unsafe "hs_bindgen_d243fc6d495ec901" hs_bindgen_d243fc6d495ec901_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_alloc@
+hs_bindgen_d243fc6d495ec901 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr Vector)))
+hs_bindgen_d243fc6d495ec901 =
+  fmap BG.fromFFIType hs_bindgen_d243fc6d495ec901_base
+
+{-# NOINLINE vector_alloc #-}
+{-| __C declaration:__ @vector_alloc@
+
+    __defined at:__ @edge-cases\/flam_functions.h 6:16@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_alloc :: BG.FunPtr (BG.CInt -> IO (BG.Ptr Vector))
+vector_alloc =
+  BG.unsafePerformIO hs_bindgen_d243fc6d495ec901
+
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_free@
+foreign import ccall unsafe "hs_bindgen_1d7c878fb2029890" hs_bindgen_1d7c878fb2029890_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_free@
+hs_bindgen_1d7c878fb2029890 :: IO (BG.FunPtr (BG.Ptr Vector -> IO ()))
+hs_bindgen_1d7c878fb2029890 =
+  fmap BG.fromFFIType hs_bindgen_1d7c878fb2029890_base
+
+{-# NOINLINE vector_free #-}
+{-| __C declaration:__ @vector_free@
+
+    __defined at:__ @edge-cases\/flam_functions.h 8:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_free :: BG.FunPtr (BG.Ptr Vector -> IO ())
+vector_free =
+  BG.unsafePerformIO hs_bindgen_1d7c878fb2029890
+
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_reverse@
+foreign import ccall unsafe "hs_bindgen_630caac5f56516fe" hs_bindgen_630caac5f56516fe_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_reverse@
+hs_bindgen_630caac5f56516fe :: IO (BG.FunPtr (BG.Ptr Vector -> IO ()))
+hs_bindgen_630caac5f56516fe =
+  fmap BG.fromFFIType hs_bindgen_630caac5f56516fe_base
+
+{-# NOINLINE vector_reverse #-}
+{-| __C declaration:__ @vector_reverse@
+
+    __defined at:__ @edge-cases\/flam_functions.h 10:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_reverse :: BG.FunPtr (BG.Ptr Vector -> IO ())
+vector_reverse =
+  BG.unsafePerformIO hs_bindgen_630caac5f56516fe
diff --git a/test-artefacts/fixtures/edge-cases/flam_functions/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/flam_functions/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/flam_functions/Example/Safe.hs
@@ -0,0 +1,113 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.vector_alloc
+    , Example.Safe.vector_free
+    , Example.Safe.vector_reverse
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/flam_functions.h>"
+  , "struct Vector *hs_bindgen_231473be98482b20 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (vector_alloc)(arg1);"
+  , "}"
+  , "void hs_bindgen_d3aecc79bd3c1993 ("
+  , "  struct Vector *arg1"
+  , ")"
+  , "{"
+  , "  (vector_free)(arg1);"
+  , "}"
+  , "void hs_bindgen_bfc48cbf5e4cc2ca ("
+  , "  struct Vector *arg1"
+  , ")"
+  , "{"
+  , "  (vector_reverse)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_alloc@
+foreign import ccall safe "hs_bindgen_231473be98482b20" hs_bindgen_231473be98482b20_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_alloc@
+hs_bindgen_231473be98482b20 ::
+     BG.CInt
+  -> IO (BG.Ptr Vector)
+hs_bindgen_231473be98482b20 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_231473be98482b20_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @vector_alloc@
+
+    __defined at:__ @edge-cases\/flam_functions.h 6:16@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_alloc ::
+     BG.CInt
+     -- ^ __C declaration:__ @n@
+  -> IO (BG.Ptr Vector)
+vector_alloc = hs_bindgen_231473be98482b20
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_free@
+foreign import ccall safe "hs_bindgen_d3aecc79bd3c1993" hs_bindgen_d3aecc79bd3c1993_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_free@
+hs_bindgen_d3aecc79bd3c1993 ::
+     BG.Ptr Vector
+  -> IO ()
+hs_bindgen_d3aecc79bd3c1993 =
+  \x0 ->
+    hs_bindgen_d3aecc79bd3c1993_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @vector_free@
+
+    __defined at:__ @edge-cases\/flam_functions.h 8:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_free ::
+     BG.Ptr Vector
+     -- ^ __C declaration:__ @v@
+  -> IO ()
+vector_free = hs_bindgen_d3aecc79bd3c1993
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_reverse@
+foreign import ccall safe "hs_bindgen_bfc48cbf5e4cc2ca" hs_bindgen_bfc48cbf5e4cc2ca_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_reverse@
+hs_bindgen_bfc48cbf5e4cc2ca ::
+     BG.Ptr Vector
+  -> IO ()
+hs_bindgen_bfc48cbf5e4cc2ca =
+  \x0 ->
+    hs_bindgen_bfc48cbf5e4cc2ca_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @vector_reverse@
+
+    __defined at:__ @edge-cases\/flam_functions.h 10:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_reverse ::
+     BG.Ptr Vector
+     -- ^ __C declaration:__ @v@
+  -> IO ()
+vector_reverse = hs_bindgen_bfc48cbf5e4cc2ca
diff --git a/test-artefacts/fixtures/edge-cases/flam_functions/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/flam_functions/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/flam_functions/Example/Unsafe.hs
@@ -0,0 +1,113 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.vector_alloc
+    , Example.Unsafe.vector_free
+    , Example.Unsafe.vector_reverse
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/flam_functions.h>"
+  , "struct Vector *hs_bindgen_66fe57793f0712c2 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (vector_alloc)(arg1);"
+  , "}"
+  , "void hs_bindgen_2fb197c3fb9a75a3 ("
+  , "  struct Vector *arg1"
+  , ")"
+  , "{"
+  , "  (vector_free)(arg1);"
+  , "}"
+  , "void hs_bindgen_c3965610d4826d1a ("
+  , "  struct Vector *arg1"
+  , ")"
+  , "{"
+  , "  (vector_reverse)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_alloc@
+foreign import ccall unsafe "hs_bindgen_66fe57793f0712c2" hs_bindgen_66fe57793f0712c2_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_alloc@
+hs_bindgen_66fe57793f0712c2 ::
+     BG.CInt
+  -> IO (BG.Ptr Vector)
+hs_bindgen_66fe57793f0712c2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_66fe57793f0712c2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @vector_alloc@
+
+    __defined at:__ @edge-cases\/flam_functions.h 6:16@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_alloc ::
+     BG.CInt
+     -- ^ __C declaration:__ @n@
+  -> IO (BG.Ptr Vector)
+vector_alloc = hs_bindgen_66fe57793f0712c2
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_free@
+foreign import ccall unsafe "hs_bindgen_2fb197c3fb9a75a3" hs_bindgen_2fb197c3fb9a75a3_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_free@
+hs_bindgen_2fb197c3fb9a75a3 ::
+     BG.Ptr Vector
+  -> IO ()
+hs_bindgen_2fb197c3fb9a75a3 =
+  \x0 ->
+    hs_bindgen_2fb197c3fb9a75a3_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @vector_free@
+
+    __defined at:__ @edge-cases\/flam_functions.h 8:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_free ::
+     BG.Ptr Vector
+     -- ^ __C declaration:__ @v@
+  -> IO ()
+vector_free = hs_bindgen_2fb197c3fb9a75a3
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_reverse@
+foreign import ccall unsafe "hs_bindgen_c3965610d4826d1a" hs_bindgen_c3965610d4826d1a_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_reverse@
+hs_bindgen_c3965610d4826d1a ::
+     BG.Ptr Vector
+  -> IO ()
+hs_bindgen_c3965610d4826d1a =
+  \x0 ->
+    hs_bindgen_c3965610d4826d1a_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @vector_reverse@
+
+    __defined at:__ @edge-cases\/flam_functions.h 10:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_reverse ::
+     BG.Ptr Vector
+     -- ^ __C declaration:__ @v@
+  -> IO ()
+vector_reverse = hs_bindgen_c3965610d4826d1a
diff --git a/test-artefacts/fixtures/edge-cases/flam_functions/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/flam_functions/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/flam_functions/bindingspec.yaml
@@ -0,0 +1,34 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/flam_functions.h
+  cname: struct Vector
+  hsname: Vector_Aux
+- headers: edge-cases/flam_functions.h
+  cname: struct Vector
+  hsname: Vector
+hstypes:
+- hsname: Vector
+  representation: typealias
+- hsname: Vector_Aux
+  representation:
+    record:
+      constructor: Vector
+      fields:
+      - vector_length
+  instances:
+  - Eq
+  - Flam_Offset
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/flam_functions/th.txt b/test-artefacts/fixtures/edge-cases/flam_functions/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/flam_functions/th.txt
@@ -0,0 +1,298 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/flam_functions.h
+-- #include <edge-cases/flam_functions.h>
+-- struct Vector *hs_bindgen_231473be98482b20 (
+--   signed int arg1
+-- )
+-- {
+--   return (vector_alloc)(arg1);
+-- }
+-- void hs_bindgen_d3aecc79bd3c1993 (
+--   struct Vector *arg1
+-- )
+-- {
+--   (vector_free)(arg1);
+-- }
+-- void hs_bindgen_bfc48cbf5e4cc2ca (
+--   struct Vector *arg1
+-- )
+-- {
+--   (vector_reverse)(arg1);
+-- }
+-- struct Vector *hs_bindgen_66fe57793f0712c2 (
+--   signed int arg1
+-- )
+-- {
+--   return (vector_alloc)(arg1);
+-- }
+-- void hs_bindgen_2fb197c3fb9a75a3 (
+--   struct Vector *arg1
+-- )
+-- {
+--   (vector_free)(arg1);
+-- }
+-- void hs_bindgen_c3965610d4826d1a (
+--   struct Vector *arg1
+-- )
+-- {
+--   (vector_reverse)(arg1);
+-- }
+-- /* test_edgecasesflam_functions_Example_get_vector_alloc */
+-- __attribute__ ((const))
+-- struct Vector *(*hs_bindgen_d243fc6d495ec901 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &vector_alloc;
+-- }
+-- /* test_edgecasesflam_functions_Example_get_vector_free */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1d7c878fb2029890 (void)) (
+--   struct Vector *arg1
+-- )
+-- {
+--   return &vector_free;
+-- }
+-- /* test_edgecasesflam_functions_Example_get_vector_reverse */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_630caac5f56516fe (void)) (
+--   struct Vector *arg1
+-- )
+-- {
+--   return &vector_reverse;
+-- }
+{-| __C declaration:__ @struct Vector@
+
+    __defined at:__ @edge-cases\/flam_functions.h 1:8@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+data Vector_Aux
+    = Vector {vector_length :: CInt
+              {- ^ __C declaration:__ @length@
+
+                   __defined at:__ @edge-cases\/flam_functions.h 2:7@
+
+                   __exported by:__ @edge-cases\/flam_functions.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Vector_Aux
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Vector_Aux
+    where readRaw = \ptr_0 -> pure Vector <*> readRaw (Proxy @"vector_length") ptr_0
+instance WriteRaw Vector_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Vector vector_length_2 -> writeRaw (Proxy @"vector_length") ptr_0 vector_length_2
+deriving via (EquivStorable Vector_Aux) instance Storable Vector_Aux
+deriving via (IsStructViaReadRaw Vector_Aux) instance IsStruct Vector_Aux
+instance (~) ty CInt => HasField "vector_length" Vector_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Vector{vector_length = y_1},
+                              getField @"vector_length" x_0)
+instance (~) ty CInt =>
+         HasField "vector_length" (Ptr Vector_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"vector_length")
+instance HasCField Vector_Aux "vector_length"
+    where type CFieldType Vector_Aux "vector_length" = CInt
+          offset# = \_ -> \_ -> 0
+instance Offset CLong Vector_Aux
+    where offset = \_proxy_0 -> 8
+type Vector = WithFlam CLong Vector_Aux
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_alloc@
+foreign import ccall safe "hs_bindgen_231473be98482b20" hs_bindgen_231473be98482b20_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_alloc@
+hs_bindgen_231473be98482b20 :: CInt -> IO (Ptr Vector)
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_alloc@
+hs_bindgen_231473be98482b20 = \x_0 -> fmap fromFFIType (hs_bindgen_231473be98482b20_base (toFFIType x_0))
+{-| __C declaration:__ @vector_alloc@
+
+    __defined at:__ @edge-cases\/flam_functions.h 6:16@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_alloc_safe :: CInt -> IO (Ptr Vector)
+{-| __C declaration:__ @vector_alloc@
+
+    __defined at:__ @edge-cases\/flam_functions.h 6:16@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_alloc_safe = hs_bindgen_231473be98482b20
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_free@
+foreign import ccall safe "hs_bindgen_d3aecc79bd3c1993" hs_bindgen_d3aecc79bd3c1993_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_free@
+hs_bindgen_d3aecc79bd3c1993 :: Ptr Vector -> IO ()
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_free@
+hs_bindgen_d3aecc79bd3c1993 = \x_0 -> hs_bindgen_d3aecc79bd3c1993_base (toFFIType x_0)
+{-| __C declaration:__ @vector_free@
+
+    __defined at:__ @edge-cases\/flam_functions.h 8:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_free_safe :: Ptr Vector -> IO ()
+{-| __C declaration:__ @vector_free@
+
+    __defined at:__ @edge-cases\/flam_functions.h 8:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_free_safe = hs_bindgen_d3aecc79bd3c1993
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_reverse@
+foreign import ccall safe "hs_bindgen_bfc48cbf5e4cc2ca" hs_bindgen_bfc48cbf5e4cc2ca_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_reverse@
+hs_bindgen_bfc48cbf5e4cc2ca :: Ptr Vector -> IO ()
+-- __unique:__ @test_edgecasesflam_functions_Example_Safe_vector_reverse@
+hs_bindgen_bfc48cbf5e4cc2ca = \x_0 -> hs_bindgen_bfc48cbf5e4cc2ca_base (toFFIType x_0)
+{-| __C declaration:__ @vector_reverse@
+
+    __defined at:__ @edge-cases\/flam_functions.h 10:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_reverse_safe :: Ptr Vector -> IO ()
+{-| __C declaration:__ @vector_reverse@
+
+    __defined at:__ @edge-cases\/flam_functions.h 10:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_reverse_safe = hs_bindgen_bfc48cbf5e4cc2ca
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_alloc@
+foreign import ccall unsafe "hs_bindgen_66fe57793f0712c2" hs_bindgen_66fe57793f0712c2_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_alloc@
+hs_bindgen_66fe57793f0712c2 :: CInt -> IO (Ptr Vector)
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_alloc@
+hs_bindgen_66fe57793f0712c2 = \x_0 -> fmap fromFFIType (hs_bindgen_66fe57793f0712c2_base (toFFIType x_0))
+{-| __C declaration:__ @vector_alloc@
+
+    __defined at:__ @edge-cases\/flam_functions.h 6:16@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_alloc_unsafe :: CInt -> IO (Ptr Vector)
+{-| __C declaration:__ @vector_alloc@
+
+    __defined at:__ @edge-cases\/flam_functions.h 6:16@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_alloc_unsafe = hs_bindgen_66fe57793f0712c2
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_free@
+foreign import ccall unsafe "hs_bindgen_2fb197c3fb9a75a3" hs_bindgen_2fb197c3fb9a75a3_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_free@
+hs_bindgen_2fb197c3fb9a75a3 :: Ptr Vector -> IO ()
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_free@
+hs_bindgen_2fb197c3fb9a75a3 = \x_0 -> hs_bindgen_2fb197c3fb9a75a3_base (toFFIType x_0)
+{-| __C declaration:__ @vector_free@
+
+    __defined at:__ @edge-cases\/flam_functions.h 8:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_free_unsafe :: Ptr Vector -> IO ()
+{-| __C declaration:__ @vector_free@
+
+    __defined at:__ @edge-cases\/flam_functions.h 8:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_free_unsafe = hs_bindgen_2fb197c3fb9a75a3
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_reverse@
+foreign import ccall unsafe "hs_bindgen_c3965610d4826d1a" hs_bindgen_c3965610d4826d1a_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_reverse@
+hs_bindgen_c3965610d4826d1a :: Ptr Vector -> IO ()
+-- __unique:__ @test_edgecasesflam_functions_Example_Unsafe_vector_reverse@
+hs_bindgen_c3965610d4826d1a = \x_0 -> hs_bindgen_c3965610d4826d1a_base (toFFIType x_0)
+{-| __C declaration:__ @vector_reverse@
+
+    __defined at:__ @edge-cases\/flam_functions.h 10:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_reverse_unsafe :: Ptr Vector -> IO ()
+{-| __C declaration:__ @vector_reverse@
+
+    __defined at:__ @edge-cases\/flam_functions.h 10:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_reverse_unsafe = hs_bindgen_c3965610d4826d1a
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_alloc@
+foreign import ccall unsafe "hs_bindgen_d243fc6d495ec901" hs_bindgen_d243fc6d495ec901_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_alloc@
+hs_bindgen_d243fc6d495ec901 :: IO (FunPtr (CInt ->
+                                           IO (Ptr Vector)))
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_alloc@
+hs_bindgen_d243fc6d495ec901 = fmap fromFFIType hs_bindgen_d243fc6d495ec901_base
+{-# NOINLINE vector_alloc_funptr #-}
+{-| __C declaration:__ @vector_alloc@
+
+    __defined at:__ @edge-cases\/flam_functions.h 6:16@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_alloc_funptr :: FunPtr (CInt -> IO (Ptr Vector))
+{-| __C declaration:__ @vector_alloc@
+
+    __defined at:__ @edge-cases\/flam_functions.h 6:16@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_alloc_funptr = unsafePerformIO hs_bindgen_d243fc6d495ec901
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_free@
+foreign import ccall unsafe "hs_bindgen_1d7c878fb2029890" hs_bindgen_1d7c878fb2029890_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_free@
+hs_bindgen_1d7c878fb2029890 :: IO (FunPtr (Ptr Vector -> IO ()))
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_free@
+hs_bindgen_1d7c878fb2029890 = fmap fromFFIType hs_bindgen_1d7c878fb2029890_base
+{-# NOINLINE vector_free_funptr #-}
+{-| __C declaration:__ @vector_free@
+
+    __defined at:__ @edge-cases\/flam_functions.h 8:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_free_funptr :: FunPtr (Ptr Vector -> IO ())
+{-| __C declaration:__ @vector_free@
+
+    __defined at:__ @edge-cases\/flam_functions.h 8:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_free_funptr = unsafePerformIO hs_bindgen_1d7c878fb2029890
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_reverse@
+foreign import ccall unsafe "hs_bindgen_630caac5f56516fe" hs_bindgen_630caac5f56516fe_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_reverse@
+hs_bindgen_630caac5f56516fe :: IO (FunPtr (Ptr Vector -> IO ()))
+-- __unique:__ @test_edgecasesflam_functions_Example_get_vector_reverse@
+hs_bindgen_630caac5f56516fe = fmap fromFFIType hs_bindgen_630caac5f56516fe_base
+{-# NOINLINE vector_reverse_funptr #-}
+{-| __C declaration:__ @vector_reverse@
+
+    __defined at:__ @edge-cases\/flam_functions.h 10:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_reverse_funptr :: FunPtr (Ptr Vector -> IO ())
+{-| __C declaration:__ @vector_reverse@
+
+    __defined at:__ @edge-cases\/flam_functions.h 10:6@
+
+    __exported by:__ @edge-cases\/flam_functions.h@
+-}
+vector_reverse_funptr = unsafePerformIO hs_bindgen_630caac5f56516fe
diff --git a/test-artefacts/fixtures/edge-cases/headers/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/headers/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/headers/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/edge-cases/headers/th.txt b/test-artefacts/fixtures/edge-cases/headers/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/headers/th.txt
@@ -0,0 +1,3 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile test-artefacts/headers/golden/edge-cases/headers.h
diff --git a/test-artefacts/fixtures/edge-cases/include_macro_parent/Example.hs b/test-artefacts/fixtures/edge-cases/include_macro_parent/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/include_macro_parent/Example.hs
@@ -0,0 +1,245 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Pt(..)
+    , Example.cHILD_HEADER
+    , Example.Rect(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct pt@
+
+    __defined at:__ @include_macro_child.h (CHILD_HEADER) 1:9@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+data Pt = Pt
+  { pt_x :: BG.CDouble
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @include_macro_child.h (CHILD_HEADER) 1:25@
+
+         __exported by:__ @edge-cases\/include_macro_parent.h@
+    -}
+  , pt_y :: BG.CDouble
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @include_macro_child.h (CHILD_HEADER) 1:28@
+
+         __exported by:__ @edge-cases\/include_macro_parent.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Pt where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Pt where
+
+  readRaw =
+    \ptr0 ->
+          pure Pt
+      <*> HasCField.readRaw (BG.Proxy @"pt_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"pt_y") ptr0
+
+instance Marshal.WriteRaw Pt where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Pt pt_x2 pt_y3 ->
+               HasCField.writeRaw (BG.Proxy @"pt_x") ptr0 pt_x2
+            >> HasCField.writeRaw (BG.Proxy @"pt_y") ptr0 pt_y3
+
+deriving via Marshal.EquivStorable Pt instance BG.Storable Pt
+
+deriving via Struct.IsStructViaReadRaw Pt instance Struct.IsStruct Pt
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @include_macro_child.h (CHILD_HEADER) 1:25@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+instance (ty ~ BG.CDouble) => BG.CompatHasField.HasField "pt_x" Pt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Pt {pt_x = y1, pt_y = BG.getField @"pt_y" x0}
+      , BG.getField @"pt_x" x0
+      )
+
+instance (ty ~ BG.CDouble) => BG.HasField "pt_x" (BG.Ptr Pt) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"pt_x")
+
+instance HasCField.HasCField Pt "pt_x" where
+
+  type CFieldType Pt "pt_x" = BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @include_macro_child.h (CHILD_HEADER) 1:28@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+instance (ty ~ BG.CDouble) => BG.CompatHasField.HasField "pt_y" Pt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Pt {pt_y = y1, pt_x = BG.getField @"pt_x" x0}
+      , BG.getField @"pt_y" x0
+      )
+
+instance (ty ~ BG.CDouble) => BG.HasField "pt_y" (BG.Ptr Pt) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"pt_y")
+
+instance HasCField.HasCField Pt "pt_y" where
+
+  type CFieldType Pt "pt_y" = BG.CDouble
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @macro CHILD_HEADER@
+
+    __C literal:__ @\"include_macro_child.h\"@
+
+    __defined at:__ @edge-cases\/include_macro_parent.h 4:9@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+cHILD_HEADER :: BG.ByteString
+cHILD_HEADER =
+  BG.pack [0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x5F, 0x6D, 0x61, 0x63, 0x72, 0x6F, 0x5F, 0x63, 0x68, 0x69, 0x6C, 0x64, 0x2E, 0x68]
+
+{-| __C declaration:__ @struct rect@
+
+    __defined at:__ @edge-cases\/include_macro_parent.h 7:8@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+data Rect = Rect
+  { rect_tl :: Pt
+    {- ^ __C declaration:__ @tl@
+
+         __defined at:__ @edge-cases\/include_macro_parent.h 7:18@
+
+         __exported by:__ @edge-cases\/include_macro_parent.h@
+    -}
+  , rect_br :: Pt
+    {- ^ __C declaration:__ @br@
+
+         __defined at:__ @edge-cases\/include_macro_parent.h 7:22@
+
+         __exported by:__ @edge-cases\/include_macro_parent.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Rect where
+
+  staticSizeOf = \_ -> (32 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Rect where
+
+  readRaw =
+    \ptr0 ->
+          pure Rect
+      <*> HasCField.readRaw (BG.Proxy @"rect_tl") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"rect_br") ptr0
+
+instance Marshal.WriteRaw Rect where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Rect rect_tl2 rect_br3 ->
+               HasCField.writeRaw (BG.Proxy @"rect_tl") ptr0 rect_tl2
+            >> HasCField.writeRaw (BG.Proxy @"rect_br") ptr0 rect_br3
+
+deriving via Marshal.EquivStorable Rect instance BG.Storable Rect
+
+deriving via Struct.IsStructViaReadRaw Rect instance Struct.IsStruct Rect
+
+{-| __C declaration:__ @tl@
+
+    __defined at:__ @edge-cases\/include_macro_parent.h 7:18@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+instance (ty ~ Pt) => BG.CompatHasField.HasField "rect_tl" Rect ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Rect {rect_tl = y1, rect_br = BG.getField @"rect_br" x0}
+      , BG.getField @"rect_tl" x0
+      )
+
+instance (ty ~ Pt) => BG.HasField "rect_tl" (BG.Ptr Rect) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"rect_tl")
+
+instance HasCField.HasCField Rect "rect_tl" where
+
+  type CFieldType Rect "rect_tl" = Pt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @br@
+
+    __defined at:__ @edge-cases\/include_macro_parent.h 7:22@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+instance (ty ~ Pt) => BG.CompatHasField.HasField "rect_br" Rect ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Rect {rect_br = y1, rect_tl = BG.getField @"rect_tl" x0}
+      , BG.getField @"rect_br" x0
+      )
+
+instance (ty ~ Pt) => BG.HasField "rect_br" (BG.Ptr Rect) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"rect_br")
+
+instance HasCField.HasCField Rect "rect_br" where
+
+  type CFieldType Rect "rect_br" = Pt
+
+  offset# = \_ -> \_ -> 16
diff --git a/test-artefacts/fixtures/edge-cases/include_macro_parent/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/include_macro_parent/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/include_macro_parent/bindingspec.yaml
@@ -0,0 +1,55 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/include_macro_parent.h
+  cname: struct pt
+  hsname: Pt
+- headers: edge-cases/include_macro_parent.h
+  cname: pt
+  hsname: Pt
+- headers: edge-cases/include_macro_parent.h
+  cname: struct rect
+  hsname: Rect
+hstypes:
+- hsname: Pt
+  representation:
+    record:
+      constructor: Pt
+      fields:
+      - pt_x
+      - pt_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Rect
+  representation:
+    record:
+      constructor: Rect
+      fields:
+      - rect_tl
+      - rect_br
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/include_macro_parent/th.txt b/test-artefacts/fixtures/edge-cases/include_macro_parent/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/include_macro_parent/th.txt
@@ -0,0 +1,142 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/include_macro_child.h
+-- addDependentFile test-artefacts/headers/golden/edge-cases/include_macro_parent.h
+{-| __C declaration:__ @struct pt@
+
+    __defined at:__ @include_macro_child.h (CHILD_HEADER) 1:9@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+data Pt
+    = Pt {pt_x :: CDouble
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @include_macro_child.h (CHILD_HEADER) 1:25@
+
+               __exported by:__ @edge-cases\/include_macro_parent.h@
+          -},
+          pt_y :: CDouble
+          {- ^ __C declaration:__ @y@
+
+               __defined at:__ @include_macro_child.h (CHILD_HEADER) 1:28@
+
+               __exported by:__ @edge-cases\/include_macro_parent.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Pt
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Pt
+    where readRaw = \ptr_0 -> (pure Pt <*> readRaw (Proxy @"pt_x") ptr_0) <*> readRaw (Proxy @"pt_y") ptr_0
+instance WriteRaw Pt
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Pt pt_x_2
+                                          pt_y_3 -> writeRaw (Proxy @"pt_x") ptr_0 pt_x_2 >> writeRaw (Proxy @"pt_y") ptr_0 pt_y_3
+deriving via (EquivStorable Pt) instance Storable Pt
+deriving via (IsStructViaReadRaw Pt) instance IsStruct Pt
+instance (~) ty CDouble => HasField "pt_x" Pt ty
+    where hasField = \x_0 -> (\y_1 -> Pt{pt_x = y_1,
+                                         pt_y = getField @"pt_y" x_0},
+                              getField @"pt_x" x_0)
+instance (~) ty CDouble => HasField "pt_x" (Ptr Pt) (Ptr ty)
+    where getField = fromPtr (Proxy @"pt_x")
+instance HasCField Pt "pt_x"
+    where type CFieldType Pt "pt_x" = CDouble
+          offset# = \_ -> \_ -> 0
+instance (~) ty CDouble => HasField "pt_y" Pt ty
+    where hasField = \x_0 -> (\y_1 -> Pt{pt_y = y_1,
+                                         pt_x = getField @"pt_x" x_0},
+                              getField @"pt_y" x_0)
+instance (~) ty CDouble => HasField "pt_y" (Ptr Pt) (Ptr ty)
+    where getField = fromPtr (Proxy @"pt_y")
+instance HasCField Pt "pt_y"
+    where type CFieldType Pt "pt_y" = CDouble
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @macro CHILD_HEADER@
+
+    __C literal:__ @\"include_macro_child.h\"@
+
+    __defined at:__ @edge-cases\/include_macro_parent.h 4:9@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+cHILD_HEADER :: ByteString
+{-| __C declaration:__ @macro CHILD_HEADER@
+
+    __C literal:__ @\"include_macro_child.h\"@
+
+    __defined at:__ @edge-cases\/include_macro_parent.h 4:9@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+cHILD_HEADER = pack [105,
+                     110,
+                     99,
+                     108,
+                     117,
+                     100,
+                     101,
+                     95,
+                     109,
+                     97,
+                     99,
+                     114,
+                     111,
+                     95,
+                     99,
+                     104,
+                     105,
+                     108,
+                     100,
+                     46,
+                     104]
+{-| __C declaration:__ @struct rect@
+
+    __defined at:__ @edge-cases\/include_macro_parent.h 7:8@
+
+    __exported by:__ @edge-cases\/include_macro_parent.h@
+-}
+data Rect
+    = Rect {rect_tl :: Pt
+            {- ^ __C declaration:__ @tl@
+
+                 __defined at:__ @edge-cases\/include_macro_parent.h 7:18@
+
+                 __exported by:__ @edge-cases\/include_macro_parent.h@
+            -},
+            rect_br :: Pt
+            {- ^ __C declaration:__ @br@
+
+                 __defined at:__ @edge-cases\/include_macro_parent.h 7:22@
+
+                 __exported by:__ @edge-cases\/include_macro_parent.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Rect
+    where staticSizeOf = \_ -> 32 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Rect
+    where readRaw = \ptr_0 -> (pure Rect <*> readRaw (Proxy @"rect_tl") ptr_0) <*> readRaw (Proxy @"rect_br") ptr_0
+instance WriteRaw Rect
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Rect rect_tl_2
+                                            rect_br_3 -> writeRaw (Proxy @"rect_tl") ptr_0 rect_tl_2 >> writeRaw (Proxy @"rect_br") ptr_0 rect_br_3
+deriving via (EquivStorable Rect) instance Storable Rect
+deriving via (IsStructViaReadRaw Rect) instance IsStruct Rect
+instance (~) ty Pt => HasField "rect_tl" Rect ty
+    where hasField = \x_0 -> (\y_1 -> Rect{rect_tl = y_1,
+                                           rect_br = getField @"rect_br" x_0},
+                              getField @"rect_tl" x_0)
+instance (~) ty Pt => HasField "rect_tl" (Ptr Rect) (Ptr ty)
+    where getField = fromPtr (Proxy @"rect_tl")
+instance HasCField Rect "rect_tl"
+    where type CFieldType Rect "rect_tl" = Pt
+          offset# = \_ -> \_ -> 0
+instance (~) ty Pt => HasField "rect_br" Rect ty
+    where hasField = \x_0 -> (\y_1 -> Rect{rect_br = y_1,
+                                           rect_tl = getField @"rect_tl" x_0},
+                              getField @"rect_br" x_0)
+instance (~) ty Pt => HasField "rect_br" (Ptr Rect) (Ptr ty)
+    where getField = fromPtr (Proxy @"rect_br")
+instance HasCField Rect "rect_br"
+    where type CFieldType Rect "rect_br" = Pt
+          offset# = \_ -> \_ -> 16
diff --git a/test-artefacts/fixtures/edge-cases/iterator/Example.hs b/test-artefacts/fixtures/edge-cases/iterator/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/iterator/Example.hs
@@ -0,0 +1,339 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Toggle_Aux(..)
+    , Example.Toggle(..)
+    , Example.Counter_Aux(..)
+    , Example.Counter(..)
+    , Example.VarCounter_Aux(..)
+    , Example.VarCounter(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.Block as Block
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (IO, fmap, type (~))
+
+{-| Auxiliary type used by 'Toggle'
+
+    __C declaration:__ @Toggle@
+
+    __defined at:__ @edge-cases\/iterator.h 3:16@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype Toggle_Aux = Toggle_Aux
+  { unwrapToggle_Aux :: IO BG.CBool
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toToggle_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_eca2bca8e63194be_base ::
+     IO BG.CBool
+  -> IO (BG.FunPtr (IO BG.CBool))
+
+-- __unique:__ @toToggle_Aux@
+hs_bindgen_eca2bca8e63194be ::
+     Toggle_Aux
+  -> IO (BG.FunPtr Toggle_Aux)
+hs_bindgen_eca2bca8e63194be =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_eca2bca8e63194be_base (fmap BG.toFFIType (BG.getField @"unwrapToggle_Aux" fun0)))
+
+-- __unique:__ @fromToggle_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_703fc4bdc168721d_base ::
+     BG.FunPtr (IO BG.CBool)
+  -> IO BG.CBool
+
+-- __unique:__ @fromToggle_Aux@
+hs_bindgen_703fc4bdc168721d ::
+     BG.FunPtr Toggle_Aux
+  -> Toggle_Aux
+hs_bindgen_703fc4bdc168721d =
+  \funPtr0 ->
+    Toggle_Aux (fmap BG.fromFFIType (hs_bindgen_703fc4bdc168721d_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Toggle_Aux where
+
+  toFunPtr = hs_bindgen_eca2bca8e63194be
+
+instance BG.FromFunPtr Toggle_Aux where
+
+  fromFunPtr = hs_bindgen_703fc4bdc168721d
+
+instance ( ty ~ IO BG.CBool
+         ) => BG.CompatHasField.HasField "unwrapToggle_Aux" Toggle_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Toggle_Aux {unwrapToggle_Aux = y1}
+      , BG.getField @"unwrapToggle_Aux" x0
+      )
+
+instance ( ty ~ IO BG.CBool
+         ) => BG.HasField "unwrapToggle_Aux" (BG.Ptr Toggle_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapToggle_Aux")
+
+instance HasCField.HasCField Toggle_Aux "unwrapToggle_Aux" where
+
+  type CFieldType Toggle_Aux "unwrapToggle_Aux" =
+    IO BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @Toggle@
+
+    __defined at:__ @edge-cases\/iterator.h 3:16@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype Toggle = Toggle
+  { unwrapToggle :: Block.Block Toggle_Aux
+  }
+  deriving stock (BG.Generic)
+  deriving newtype (BG.HasFFIType)
+
+instance ( ty ~ Block.Block Toggle_Aux
+         ) => BG.CompatHasField.HasField "unwrapToggle" Toggle ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Toggle {unwrapToggle = y1}, BG.getField @"unwrapToggle" x0)
+
+instance ( ty ~ Block.Block Toggle_Aux
+         ) => BG.HasField "unwrapToggle" (BG.Ptr Toggle) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapToggle")
+
+instance HasCField.HasCField Toggle "unwrapToggle" where
+
+  type CFieldType Toggle "unwrapToggle" =
+    Block.Block Toggle_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Counter'
+
+    __C declaration:__ @Counter@
+
+    __defined at:__ @edge-cases\/iterator.h 10:14@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype Counter_Aux = Counter_Aux
+  { unwrapCounter_Aux :: IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toCounter_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2202848aad97fe0a_base ::
+     IO BG.CInt
+  -> IO (BG.FunPtr (IO BG.CInt))
+
+-- __unique:__ @toCounter_Aux@
+hs_bindgen_2202848aad97fe0a ::
+     Counter_Aux
+  -> IO (BG.FunPtr Counter_Aux)
+hs_bindgen_2202848aad97fe0a =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_2202848aad97fe0a_base (fmap BG.toFFIType (BG.getField @"unwrapCounter_Aux" fun0)))
+
+-- __unique:__ @fromCounter_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_73304cb84e9a2f8f_base ::
+     BG.FunPtr (IO BG.CInt)
+  -> IO BG.CInt
+
+-- __unique:__ @fromCounter_Aux@
+hs_bindgen_73304cb84e9a2f8f ::
+     BG.FunPtr Counter_Aux
+  -> Counter_Aux
+hs_bindgen_73304cb84e9a2f8f =
+  \funPtr0 ->
+    Counter_Aux (fmap BG.fromFFIType (hs_bindgen_73304cb84e9a2f8f_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Counter_Aux where
+
+  toFunPtr = hs_bindgen_2202848aad97fe0a
+
+instance BG.FromFunPtr Counter_Aux where
+
+  fromFunPtr = hs_bindgen_73304cb84e9a2f8f
+
+instance ( ty ~ IO BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapCounter_Aux" Counter_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Counter_Aux {unwrapCounter_Aux = y1}
+      , BG.getField @"unwrapCounter_Aux" x0
+      )
+
+instance ( ty ~ IO BG.CInt
+         ) => BG.HasField "unwrapCounter_Aux" (BG.Ptr Counter_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapCounter_Aux")
+
+instance HasCField.HasCField Counter_Aux "unwrapCounter_Aux" where
+
+  type CFieldType Counter_Aux "unwrapCounter_Aux" =
+    IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @Counter@
+
+    __defined at:__ @edge-cases\/iterator.h 10:14@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype Counter = Counter
+  { unwrapCounter :: Block.Block Counter_Aux
+  }
+  deriving stock (BG.Generic)
+  deriving newtype (BG.HasFFIType)
+
+instance ( ty ~ Block.Block Counter_Aux
+         ) => BG.CompatHasField.HasField "unwrapCounter" Counter ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Counter {unwrapCounter = y1}, BG.getField @"unwrapCounter" x0)
+
+instance ( ty ~ Block.Block Counter_Aux
+         ) => BG.HasField "unwrapCounter" (BG.Ptr Counter) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapCounter")
+
+instance HasCField.HasCField Counter "unwrapCounter" where
+
+  type CFieldType Counter "unwrapCounter" =
+    Block.Block Counter_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'VarCounter'
+
+    __C declaration:__ @VarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 17:14@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype VarCounter_Aux = VarCounter_Aux
+  { unwrapVarCounter_Aux :: BG.CInt -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toVarCounter_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_42a7337570f8b0d0_base ::
+     (BG.CInt -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+
+-- __unique:__ @toVarCounter_Aux@
+hs_bindgen_42a7337570f8b0d0 ::
+     VarCounter_Aux
+  -> IO (BG.FunPtr VarCounter_Aux)
+hs_bindgen_42a7337570f8b0d0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_42a7337570f8b0d0_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrapVarCounter_Aux" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromVarCounter_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_43d902480175fccf_base ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> BG.CInt -> IO BG.CInt
+
+-- __unique:__ @fromVarCounter_Aux@
+hs_bindgen_43d902480175fccf ::
+     BG.FunPtr VarCounter_Aux
+  -> VarCounter_Aux
+hs_bindgen_43d902480175fccf =
+  \funPtr0 ->
+    VarCounter_Aux (\x1 ->
+                      fmap BG.fromFFIType (hs_bindgen_43d902480175fccf_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr VarCounter_Aux where
+
+  toFunPtr = hs_bindgen_42a7337570f8b0d0
+
+instance BG.FromFunPtr VarCounter_Aux where
+
+  fromFunPtr = hs_bindgen_43d902480175fccf
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapVarCounter_Aux" VarCounter_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> VarCounter_Aux {unwrapVarCounter_Aux = y1}
+      , BG.getField @"unwrapVarCounter_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "unwrapVarCounter_Aux" (BG.Ptr VarCounter_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapVarCounter_Aux")
+
+instance HasCField.HasCField VarCounter_Aux "unwrapVarCounter_Aux" where
+
+  type CFieldType VarCounter_Aux "unwrapVarCounter_Aux" =
+    BG.CInt -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @VarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 17:14@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype VarCounter = VarCounter
+  { unwrapVarCounter :: Block.Block VarCounter_Aux
+  }
+  deriving stock (BG.Generic)
+  deriving newtype (BG.HasFFIType)
+
+instance ( ty ~ Block.Block VarCounter_Aux
+         ) => BG.CompatHasField.HasField "unwrapVarCounter" VarCounter ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> VarCounter {unwrapVarCounter = y1}
+      , BG.getField @"unwrapVarCounter" x0
+      )
+
+instance ( ty ~ Block.Block VarCounter_Aux
+         ) => BG.HasField "unwrapVarCounter" (BG.Ptr VarCounter) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapVarCounter")
+
+instance HasCField.HasCField VarCounter "unwrapVarCounter" where
+
+  type CFieldType VarCounter "unwrapVarCounter" =
+    Block.Block VarCounter_Aux
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/edge-cases/iterator/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/iterator/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/iterator/Example/FunPtr.hs
@@ -0,0 +1,280 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.makeToggle
+    , Example.FunPtr.toggleNext
+    , Example.FunPtr.releaseToggle
+    , Example.FunPtr.makeCounter
+    , Example.FunPtr.counterNext
+    , Example.FunPtr.releaseCounter
+    , Example.FunPtr.makeVarCounter
+    , Example.FunPtr.varCounterNext
+    , Example.FunPtr.releaseVarCounter
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/iterator.h>"
+  , "/* test_edgecasesiterator_Example_get_makeToggle */"
+  , "__attribute__ ((const))"
+  , "Toggle (*hs_bindgen_ccdad25a057f8efd (void)) ("
+  , "  _Bool arg1"
+  , ")"
+  , "{"
+  , "  return &makeToggle;"
+  , "}"
+  , "/* test_edgecasesiterator_Example_get_toggleNext */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_fd8e19ba2d78baa9 (void)) ("
+  , "  Toggle arg1"
+  , ")"
+  , "{"
+  , "  return &toggleNext;"
+  , "}"
+  , "/* test_edgecasesiterator_Example_get_releaseToggle */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_780e490698de9df1 (void)) ("
+  , "  Toggle arg1"
+  , ")"
+  , "{"
+  , "  return &releaseToggle;"
+  , "}"
+  , "/* test_edgecasesiterator_Example_get_makeCounter */"
+  , "__attribute__ ((const))"
+  , "Counter (*hs_bindgen_517dd14dbdb5e3ba (void)) ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &makeCounter;"
+  , "}"
+  , "/* test_edgecasesiterator_Example_get_counterNext */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_28d81dd8ce6aca30 (void)) ("
+  , "  Counter arg1"
+  , ")"
+  , "{"
+  , "  return &counterNext;"
+  , "}"
+  , "/* test_edgecasesiterator_Example_get_releaseCounter */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_849de94baad0430a (void)) ("
+  , "  Counter arg1"
+  , ")"
+  , "{"
+  , "  return &releaseCounter;"
+  , "}"
+  , "/* test_edgecasesiterator_Example_get_makeVarCounter */"
+  , "__attribute__ ((const))"
+  , "VarCounter (*hs_bindgen_8eea20d99febeef3 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &makeVarCounter;"
+  , "}"
+  , "/* test_edgecasesiterator_Example_get_varCounterNext */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_3ae982266c863a3d (void)) ("
+  , "  VarCounter arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &varCounterNext;"
+  , "}"
+  , "/* test_edgecasesiterator_Example_get_releaseVarCounter */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_802a723805cb041f (void)) ("
+  , "  VarCounter arg1"
+  , ")"
+  , "{"
+  , "  return &releaseVarCounter;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesiterator_Example_get_makeToggle@
+foreign import ccall unsafe "hs_bindgen_ccdad25a057f8efd" hs_bindgen_ccdad25a057f8efd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_get_makeToggle@
+hs_bindgen_ccdad25a057f8efd :: IO (BG.FunPtr (BG.CBool -> IO Toggle))
+hs_bindgen_ccdad25a057f8efd =
+  fmap BG.fromFFIType hs_bindgen_ccdad25a057f8efd_base
+
+{-# NOINLINE makeToggle #-}
+{-| __C declaration:__ @makeToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 4:8@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeToggle :: BG.FunPtr (BG.CBool -> IO Toggle)
+makeToggle =
+  BG.unsafePerformIO hs_bindgen_ccdad25a057f8efd
+
+-- __unique:__ @test_edgecasesiterator_Example_get_toggleNext@
+foreign import ccall unsafe "hs_bindgen_fd8e19ba2d78baa9" hs_bindgen_fd8e19ba2d78baa9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_get_toggleNext@
+hs_bindgen_fd8e19ba2d78baa9 :: IO (BG.FunPtr (Toggle -> IO BG.CBool))
+hs_bindgen_fd8e19ba2d78baa9 =
+  fmap BG.fromFFIType hs_bindgen_fd8e19ba2d78baa9_base
+
+{-# NOINLINE toggleNext #-}
+{-| __C declaration:__ @toggleNext@
+
+    __defined at:__ @edge-cases\/iterator.h 5:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+toggleNext :: BG.FunPtr (Toggle -> IO BG.CBool)
+toggleNext =
+  BG.unsafePerformIO hs_bindgen_fd8e19ba2d78baa9
+
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseToggle@
+foreign import ccall unsafe "hs_bindgen_780e490698de9df1" hs_bindgen_780e490698de9df1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseToggle@
+hs_bindgen_780e490698de9df1 :: IO (BG.FunPtr (Toggle -> IO ()))
+hs_bindgen_780e490698de9df1 =
+  fmap BG.fromFFIType hs_bindgen_780e490698de9df1_base
+
+{-# NOINLINE releaseToggle #-}
+{-| __C declaration:__ @releaseToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 6:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseToggle :: BG.FunPtr (Toggle -> IO ())
+releaseToggle =
+  BG.unsafePerformIO hs_bindgen_780e490698de9df1
+
+-- __unique:__ @test_edgecasesiterator_Example_get_makeCounter@
+foreign import ccall unsafe "hs_bindgen_517dd14dbdb5e3ba" hs_bindgen_517dd14dbdb5e3ba_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_get_makeCounter@
+hs_bindgen_517dd14dbdb5e3ba :: IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO Counter))
+hs_bindgen_517dd14dbdb5e3ba =
+  fmap BG.fromFFIType hs_bindgen_517dd14dbdb5e3ba_base
+
+{-# NOINLINE makeCounter #-}
+{-| __C declaration:__ @makeCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 11:9@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeCounter :: BG.FunPtr (BG.CInt -> BG.CInt -> IO Counter)
+makeCounter =
+  BG.unsafePerformIO hs_bindgen_517dd14dbdb5e3ba
+
+-- __unique:__ @test_edgecasesiterator_Example_get_counterNext@
+foreign import ccall unsafe "hs_bindgen_28d81dd8ce6aca30" hs_bindgen_28d81dd8ce6aca30_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_get_counterNext@
+hs_bindgen_28d81dd8ce6aca30 :: IO (BG.FunPtr (Counter -> IO BG.CInt))
+hs_bindgen_28d81dd8ce6aca30 =
+  fmap BG.fromFFIType hs_bindgen_28d81dd8ce6aca30_base
+
+{-# NOINLINE counterNext #-}
+{-| __C declaration:__ @counterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 12:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+counterNext :: BG.FunPtr (Counter -> IO BG.CInt)
+counterNext =
+  BG.unsafePerformIO hs_bindgen_28d81dd8ce6aca30
+
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseCounter@
+foreign import ccall unsafe "hs_bindgen_849de94baad0430a" hs_bindgen_849de94baad0430a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseCounter@
+hs_bindgen_849de94baad0430a :: IO (BG.FunPtr (Counter -> IO ()))
+hs_bindgen_849de94baad0430a =
+  fmap BG.fromFFIType hs_bindgen_849de94baad0430a_base
+
+{-# NOINLINE releaseCounter #-}
+{-| __C declaration:__ @releaseCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 13:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseCounter :: BG.FunPtr (Counter -> IO ())
+releaseCounter =
+  BG.unsafePerformIO hs_bindgen_849de94baad0430a
+
+-- __unique:__ @test_edgecasesiterator_Example_get_makeVarCounter@
+foreign import ccall unsafe "hs_bindgen_8eea20d99febeef3" hs_bindgen_8eea20d99febeef3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_get_makeVarCounter@
+hs_bindgen_8eea20d99febeef3 :: IO (BG.FunPtr (BG.CInt -> IO VarCounter))
+hs_bindgen_8eea20d99febeef3 =
+  fmap BG.fromFFIType hs_bindgen_8eea20d99febeef3_base
+
+{-# NOINLINE makeVarCounter #-}
+{-| __C declaration:__ @makeVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 18:12@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeVarCounter :: BG.FunPtr (BG.CInt -> IO VarCounter)
+makeVarCounter =
+  BG.unsafePerformIO hs_bindgen_8eea20d99febeef3
+
+-- __unique:__ @test_edgecasesiterator_Example_get_varCounterNext@
+foreign import ccall unsafe "hs_bindgen_3ae982266c863a3d" hs_bindgen_3ae982266c863a3d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_get_varCounterNext@
+hs_bindgen_3ae982266c863a3d :: IO (BG.FunPtr (VarCounter -> BG.CInt -> IO BG.CInt))
+hs_bindgen_3ae982266c863a3d =
+  fmap BG.fromFFIType hs_bindgen_3ae982266c863a3d_base
+
+{-# NOINLINE varCounterNext #-}
+{-| __C declaration:__ @varCounterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 19:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+varCounterNext :: BG.FunPtr (VarCounter -> BG.CInt -> IO BG.CInt)
+varCounterNext =
+  BG.unsafePerformIO hs_bindgen_3ae982266c863a3d
+
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseVarCounter@
+foreign import ccall unsafe "hs_bindgen_802a723805cb041f" hs_bindgen_802a723805cb041f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseVarCounter@
+hs_bindgen_802a723805cb041f :: IO (BG.FunPtr (VarCounter -> IO ()))
+hs_bindgen_802a723805cb041f =
+  fmap BG.fromFFIType hs_bindgen_802a723805cb041f_base
+
+{-# NOINLINE releaseVarCounter #-}
+{-| __C declaration:__ @releaseVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 20:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseVarCounter :: BG.FunPtr (VarCounter -> IO ())
+releaseVarCounter =
+  BG.unsafePerformIO hs_bindgen_802a723805cb041f
diff --git a/test-artefacts/fixtures/edge-cases/iterator/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/iterator/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/iterator/Example/Safe.hs
@@ -0,0 +1,317 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.makeToggle
+    , Example.Safe.toggleNext
+    , Example.Safe.releaseToggle
+    , Example.Safe.makeCounter
+    , Example.Safe.counterNext
+    , Example.Safe.releaseCounter
+    , Example.Safe.makeVarCounter
+    , Example.Safe.varCounterNext
+    , Example.Safe.releaseVarCounter
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/iterator.h>"
+  , "Toggle hs_bindgen_9d01035006b66206 ("
+  , "  _Bool arg1"
+  , ")"
+  , "{"
+  , "  return (makeToggle)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_ccd3ba727d0c0cf4 ("
+  , "  Toggle arg1"
+  , ")"
+  , "{"
+  , "  return (toggleNext)(arg1);"
+  , "}"
+  , "void hs_bindgen_602b40e971b06c72 ("
+  , "  Toggle arg1"
+  , ")"
+  , "{"
+  , "  (releaseToggle)(arg1);"
+  , "}"
+  , "Counter hs_bindgen_234fa6f1fb089e1d ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (makeCounter)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_f0fca62d78f225c3 ("
+  , "  Counter arg1"
+  , ")"
+  , "{"
+  , "  return (counterNext)(arg1);"
+  , "}"
+  , "void hs_bindgen_e42dcbee8a114957 ("
+  , "  Counter arg1"
+  , ")"
+  , "{"
+  , "  (releaseCounter)(arg1);"
+  , "}"
+  , "VarCounter hs_bindgen_2bee4eb5b4d895c1 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (makeVarCounter)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_276b9cb5320fec37 ("
+  , "  VarCounter arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (varCounterNext)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_8423b076f7c9df21 ("
+  , "  VarCounter arg1"
+  , ")"
+  , "{"
+  , "  (releaseVarCounter)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeToggle@
+foreign import ccall safe "hs_bindgen_9d01035006b66206" hs_bindgen_9d01035006b66206_base ::
+     BG.CBool
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeToggle@
+hs_bindgen_9d01035006b66206 ::
+     BG.CBool
+  -> IO Toggle
+hs_bindgen_9d01035006b66206 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9d01035006b66206_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @makeToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 4:8@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeToggle ::
+     BG.CBool
+     -- ^ __C declaration:__ @start@
+  -> IO Toggle
+makeToggle = hs_bindgen_9d01035006b66206
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_toggleNext@
+foreign import ccall safe "hs_bindgen_ccd3ba727d0c0cf4" hs_bindgen_ccd3ba727d0c0cf4_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_toggleNext@
+hs_bindgen_ccd3ba727d0c0cf4 ::
+     Toggle
+  -> IO BG.CBool
+hs_bindgen_ccd3ba727d0c0cf4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ccd3ba727d0c0cf4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @toggleNext@
+
+    __defined at:__ @edge-cases\/iterator.h 5:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+toggleNext ::
+     Toggle
+     -- ^ __C declaration:__ @block@
+  -> IO BG.CBool
+toggleNext = hs_bindgen_ccd3ba727d0c0cf4
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseToggle@
+foreign import ccall safe "hs_bindgen_602b40e971b06c72" hs_bindgen_602b40e971b06c72_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseToggle@
+hs_bindgen_602b40e971b06c72 ::
+     Toggle
+  -> IO ()
+hs_bindgen_602b40e971b06c72 =
+  \x0 ->
+    hs_bindgen_602b40e971b06c72_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @releaseToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 6:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseToggle ::
+     Toggle
+     -- ^ __C declaration:__ @block@
+  -> IO ()
+releaseToggle = hs_bindgen_602b40e971b06c72
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeCounter@
+foreign import ccall safe "hs_bindgen_234fa6f1fb089e1d" hs_bindgen_234fa6f1fb089e1d_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeCounter@
+hs_bindgen_234fa6f1fb089e1d ::
+     BG.CInt
+  -> BG.CInt
+  -> IO Counter
+hs_bindgen_234fa6f1fb089e1d =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_234fa6f1fb089e1d_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @makeCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 11:9@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeCounter ::
+     BG.CInt
+     -- ^ __C declaration:__ @start@
+  -> BG.CInt
+     -- ^ __C declaration:__ @increment@
+  -> IO Counter
+makeCounter = hs_bindgen_234fa6f1fb089e1d
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_counterNext@
+foreign import ccall safe "hs_bindgen_f0fca62d78f225c3" hs_bindgen_f0fca62d78f225c3_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_counterNext@
+hs_bindgen_f0fca62d78f225c3 ::
+     Counter
+  -> IO BG.CInt
+hs_bindgen_f0fca62d78f225c3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f0fca62d78f225c3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @counterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 12:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+counterNext ::
+     Counter
+     -- ^ __C declaration:__ @block@
+  -> IO BG.CInt
+counterNext = hs_bindgen_f0fca62d78f225c3
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseCounter@
+foreign import ccall safe "hs_bindgen_e42dcbee8a114957" hs_bindgen_e42dcbee8a114957_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseCounter@
+hs_bindgen_e42dcbee8a114957 ::
+     Counter
+  -> IO ()
+hs_bindgen_e42dcbee8a114957 =
+  \x0 ->
+    hs_bindgen_e42dcbee8a114957_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @releaseCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 13:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseCounter ::
+     Counter
+     -- ^ __C declaration:__ @block@
+  -> IO ()
+releaseCounter = hs_bindgen_e42dcbee8a114957
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeVarCounter@
+foreign import ccall safe "hs_bindgen_2bee4eb5b4d895c1" hs_bindgen_2bee4eb5b4d895c1_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeVarCounter@
+hs_bindgen_2bee4eb5b4d895c1 ::
+     BG.CInt
+  -> IO VarCounter
+hs_bindgen_2bee4eb5b4d895c1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2bee4eb5b4d895c1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @makeVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 18:12@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeVarCounter ::
+     BG.CInt
+     -- ^ __C declaration:__ @start@
+  -> IO VarCounter
+makeVarCounter = hs_bindgen_2bee4eb5b4d895c1
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_varCounterNext@
+foreign import ccall safe "hs_bindgen_276b9cb5320fec37" hs_bindgen_276b9cb5320fec37_base ::
+     BG.Ptr BG.Void
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_varCounterNext@
+hs_bindgen_276b9cb5320fec37 ::
+     VarCounter
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_276b9cb5320fec37 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_276b9cb5320fec37_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @varCounterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 19:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+varCounterNext ::
+     VarCounter
+     -- ^ __C declaration:__ @block@
+  -> BG.CInt
+     -- ^ __C declaration:__ @increment@
+  -> IO BG.CInt
+varCounterNext = hs_bindgen_276b9cb5320fec37
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseVarCounter@
+foreign import ccall safe "hs_bindgen_8423b076f7c9df21" hs_bindgen_8423b076f7c9df21_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseVarCounter@
+hs_bindgen_8423b076f7c9df21 ::
+     VarCounter
+  -> IO ()
+hs_bindgen_8423b076f7c9df21 =
+  \x0 ->
+    hs_bindgen_8423b076f7c9df21_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @releaseVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 20:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseVarCounter ::
+     VarCounter
+     -- ^ __C declaration:__ @block@
+  -> IO ()
+releaseVarCounter = hs_bindgen_8423b076f7c9df21
diff --git a/test-artefacts/fixtures/edge-cases/iterator/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/iterator/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/iterator/Example/Unsafe.hs
@@ -0,0 +1,317 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.makeToggle
+    , Example.Unsafe.toggleNext
+    , Example.Unsafe.releaseToggle
+    , Example.Unsafe.makeCounter
+    , Example.Unsafe.counterNext
+    , Example.Unsafe.releaseCounter
+    , Example.Unsafe.makeVarCounter
+    , Example.Unsafe.varCounterNext
+    , Example.Unsafe.releaseVarCounter
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/iterator.h>"
+  , "Toggle hs_bindgen_1b7a6a61a9c0da07 ("
+  , "  _Bool arg1"
+  , ")"
+  , "{"
+  , "  return (makeToggle)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_4d2d650f2c8798d6 ("
+  , "  Toggle arg1"
+  , ")"
+  , "{"
+  , "  return (toggleNext)(arg1);"
+  , "}"
+  , "void hs_bindgen_ddbe11e76502cbdc ("
+  , "  Toggle arg1"
+  , ")"
+  , "{"
+  , "  (releaseToggle)(arg1);"
+  , "}"
+  , "Counter hs_bindgen_2b04d558934551d2 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (makeCounter)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_5bba69c8bfbeedf0 ("
+  , "  Counter arg1"
+  , ")"
+  , "{"
+  , "  return (counterNext)(arg1);"
+  , "}"
+  , "void hs_bindgen_429845bb55a5a7b5 ("
+  , "  Counter arg1"
+  , ")"
+  , "{"
+  , "  (releaseCounter)(arg1);"
+  , "}"
+  , "VarCounter hs_bindgen_4421633e88fc96c4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (makeVarCounter)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_31edd817cb78027d ("
+  , "  VarCounter arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (varCounterNext)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_32e5b257124f69a2 ("
+  , "  VarCounter arg1"
+  , ")"
+  , "{"
+  , "  (releaseVarCounter)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeToggle@
+foreign import ccall unsafe "hs_bindgen_1b7a6a61a9c0da07" hs_bindgen_1b7a6a61a9c0da07_base ::
+     BG.CBool
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeToggle@
+hs_bindgen_1b7a6a61a9c0da07 ::
+     BG.CBool
+  -> IO Toggle
+hs_bindgen_1b7a6a61a9c0da07 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1b7a6a61a9c0da07_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @makeToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 4:8@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeToggle ::
+     BG.CBool
+     -- ^ __C declaration:__ @start@
+  -> IO Toggle
+makeToggle = hs_bindgen_1b7a6a61a9c0da07
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_toggleNext@
+foreign import ccall unsafe "hs_bindgen_4d2d650f2c8798d6" hs_bindgen_4d2d650f2c8798d6_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CBool
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_toggleNext@
+hs_bindgen_4d2d650f2c8798d6 ::
+     Toggle
+  -> IO BG.CBool
+hs_bindgen_4d2d650f2c8798d6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4d2d650f2c8798d6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @toggleNext@
+
+    __defined at:__ @edge-cases\/iterator.h 5:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+toggleNext ::
+     Toggle
+     -- ^ __C declaration:__ @block@
+  -> IO BG.CBool
+toggleNext = hs_bindgen_4d2d650f2c8798d6
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseToggle@
+foreign import ccall unsafe "hs_bindgen_ddbe11e76502cbdc" hs_bindgen_ddbe11e76502cbdc_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseToggle@
+hs_bindgen_ddbe11e76502cbdc ::
+     Toggle
+  -> IO ()
+hs_bindgen_ddbe11e76502cbdc =
+  \x0 ->
+    hs_bindgen_ddbe11e76502cbdc_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @releaseToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 6:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseToggle ::
+     Toggle
+     -- ^ __C declaration:__ @block@
+  -> IO ()
+releaseToggle = hs_bindgen_ddbe11e76502cbdc
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeCounter@
+foreign import ccall unsafe "hs_bindgen_2b04d558934551d2" hs_bindgen_2b04d558934551d2_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeCounter@
+hs_bindgen_2b04d558934551d2 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO Counter
+hs_bindgen_2b04d558934551d2 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_2b04d558934551d2_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @makeCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 11:9@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeCounter ::
+     BG.CInt
+     -- ^ __C declaration:__ @start@
+  -> BG.CInt
+     -- ^ __C declaration:__ @increment@
+  -> IO Counter
+makeCounter = hs_bindgen_2b04d558934551d2
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_counterNext@
+foreign import ccall unsafe "hs_bindgen_5bba69c8bfbeedf0" hs_bindgen_5bba69c8bfbeedf0_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_counterNext@
+hs_bindgen_5bba69c8bfbeedf0 ::
+     Counter
+  -> IO BG.CInt
+hs_bindgen_5bba69c8bfbeedf0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5bba69c8bfbeedf0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @counterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 12:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+counterNext ::
+     Counter
+     -- ^ __C declaration:__ @block@
+  -> IO BG.CInt
+counterNext = hs_bindgen_5bba69c8bfbeedf0
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseCounter@
+foreign import ccall unsafe "hs_bindgen_429845bb55a5a7b5" hs_bindgen_429845bb55a5a7b5_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseCounter@
+hs_bindgen_429845bb55a5a7b5 ::
+     Counter
+  -> IO ()
+hs_bindgen_429845bb55a5a7b5 =
+  \x0 ->
+    hs_bindgen_429845bb55a5a7b5_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @releaseCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 13:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseCounter ::
+     Counter
+     -- ^ __C declaration:__ @block@
+  -> IO ()
+releaseCounter = hs_bindgen_429845bb55a5a7b5
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeVarCounter@
+foreign import ccall unsafe "hs_bindgen_4421633e88fc96c4" hs_bindgen_4421633e88fc96c4_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeVarCounter@
+hs_bindgen_4421633e88fc96c4 ::
+     BG.CInt
+  -> IO VarCounter
+hs_bindgen_4421633e88fc96c4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4421633e88fc96c4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @makeVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 18:12@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeVarCounter ::
+     BG.CInt
+     -- ^ __C declaration:__ @start@
+  -> IO VarCounter
+makeVarCounter = hs_bindgen_4421633e88fc96c4
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_varCounterNext@
+foreign import ccall unsafe "hs_bindgen_31edd817cb78027d" hs_bindgen_31edd817cb78027d_base ::
+     BG.Ptr BG.Void
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_varCounterNext@
+hs_bindgen_31edd817cb78027d ::
+     VarCounter
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_31edd817cb78027d =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_31edd817cb78027d_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @varCounterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 19:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+varCounterNext ::
+     VarCounter
+     -- ^ __C declaration:__ @block@
+  -> BG.CInt
+     -- ^ __C declaration:__ @increment@
+  -> IO BG.CInt
+varCounterNext = hs_bindgen_31edd817cb78027d
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseVarCounter@
+foreign import ccall unsafe "hs_bindgen_32e5b257124f69a2" hs_bindgen_32e5b257124f69a2_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseVarCounter@
+hs_bindgen_32e5b257124f69a2 ::
+     VarCounter
+  -> IO ()
+hs_bindgen_32e5b257124f69a2 =
+  \x0 ->
+    hs_bindgen_32e5b257124f69a2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @releaseVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 20:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseVarCounter ::
+     VarCounter
+     -- ^ __C declaration:__ @block@
+  -> IO ()
+releaseVarCounter = hs_bindgen_32e5b257124f69a2
diff --git a/test-artefacts/fixtures/edge-cases/iterator/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/iterator/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/iterator/bindingspec.yaml
@@ -0,0 +1,63 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/iterator.h
+  cname: Toggle
+  hsname: Toggle
+- headers: edge-cases/iterator.h
+  cname: Counter
+  hsname: Counter
+- headers: edge-cases/iterator.h
+  cname: VarCounter
+  hsname: VarCounter
+hstypes:
+- hsname: Counter
+  representation:
+    newtype:
+      constructor: Counter
+      fields:
+      - unwrapCounter
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Toggle
+  representation:
+    newtype:
+      constructor: Toggle
+      fields:
+      - unwrapToggle
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: VarCounter
+  representation:
+    newtype:
+      constructor: VarCounter
+      fields:
+      - unwrapVarCounter
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
diff --git a/test-artefacts/fixtures/edge-cases/iterator/th.txt b/test-artefacts/fixtures/edge-cases/iterator/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/iterator/th.txt
@@ -0,0 +1,977 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/iterator.h
+-- #include <edge-cases/iterator.h>
+-- Toggle hs_bindgen_9d01035006b66206 (
+--   _Bool arg1
+-- )
+-- {
+--   return (makeToggle)(arg1);
+-- }
+-- _Bool hs_bindgen_ccd3ba727d0c0cf4 (
+--   Toggle arg1
+-- )
+-- {
+--   return (toggleNext)(arg1);
+-- }
+-- void hs_bindgen_602b40e971b06c72 (
+--   Toggle arg1
+-- )
+-- {
+--   (releaseToggle)(arg1);
+-- }
+-- Counter hs_bindgen_234fa6f1fb089e1d (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (makeCounter)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_f0fca62d78f225c3 (
+--   Counter arg1
+-- )
+-- {
+--   return (counterNext)(arg1);
+-- }
+-- void hs_bindgen_e42dcbee8a114957 (
+--   Counter arg1
+-- )
+-- {
+--   (releaseCounter)(arg1);
+-- }
+-- VarCounter hs_bindgen_2bee4eb5b4d895c1 (
+--   signed int arg1
+-- )
+-- {
+--   return (makeVarCounter)(arg1);
+-- }
+-- signed int hs_bindgen_276b9cb5320fec37 (
+--   VarCounter arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (varCounterNext)(arg1, arg2);
+-- }
+-- void hs_bindgen_8423b076f7c9df21 (
+--   VarCounter arg1
+-- )
+-- {
+--   (releaseVarCounter)(arg1);
+-- }
+-- Toggle hs_bindgen_1b7a6a61a9c0da07 (
+--   _Bool arg1
+-- )
+-- {
+--   return (makeToggle)(arg1);
+-- }
+-- _Bool hs_bindgen_4d2d650f2c8798d6 (
+--   Toggle arg1
+-- )
+-- {
+--   return (toggleNext)(arg1);
+-- }
+-- void hs_bindgen_ddbe11e76502cbdc (
+--   Toggle arg1
+-- )
+-- {
+--   (releaseToggle)(arg1);
+-- }
+-- Counter hs_bindgen_2b04d558934551d2 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (makeCounter)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_5bba69c8bfbeedf0 (
+--   Counter arg1
+-- )
+-- {
+--   return (counterNext)(arg1);
+-- }
+-- void hs_bindgen_429845bb55a5a7b5 (
+--   Counter arg1
+-- )
+-- {
+--   (releaseCounter)(arg1);
+-- }
+-- VarCounter hs_bindgen_4421633e88fc96c4 (
+--   signed int arg1
+-- )
+-- {
+--   return (makeVarCounter)(arg1);
+-- }
+-- signed int hs_bindgen_31edd817cb78027d (
+--   VarCounter arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (varCounterNext)(arg1, arg2);
+-- }
+-- void hs_bindgen_32e5b257124f69a2 (
+--   VarCounter arg1
+-- )
+-- {
+--   (releaseVarCounter)(arg1);
+-- }
+-- /* test_edgecasesiterator_Example_get_makeToggle */
+-- __attribute__ ((const))
+-- Toggle (*hs_bindgen_ccdad25a057f8efd (void)) (
+--   _Bool arg1
+-- )
+-- {
+--   return &makeToggle;
+-- }
+-- /* test_edgecasesiterator_Example_get_toggleNext */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_fd8e19ba2d78baa9 (void)) (
+--   Toggle arg1
+-- )
+-- {
+--   return &toggleNext;
+-- }
+-- /* test_edgecasesiterator_Example_get_releaseToggle */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_780e490698de9df1 (void)) (
+--   Toggle arg1
+-- )
+-- {
+--   return &releaseToggle;
+-- }
+-- /* test_edgecasesiterator_Example_get_makeCounter */
+-- __attribute__ ((const))
+-- Counter (*hs_bindgen_517dd14dbdb5e3ba (void)) (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &makeCounter;
+-- }
+-- /* test_edgecasesiterator_Example_get_counterNext */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_28d81dd8ce6aca30 (void)) (
+--   Counter arg1
+-- )
+-- {
+--   return &counterNext;
+-- }
+-- /* test_edgecasesiterator_Example_get_releaseCounter */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_849de94baad0430a (void)) (
+--   Counter arg1
+-- )
+-- {
+--   return &releaseCounter;
+-- }
+-- /* test_edgecasesiterator_Example_get_makeVarCounter */
+-- __attribute__ ((const))
+-- VarCounter (*hs_bindgen_8eea20d99febeef3 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &makeVarCounter;
+-- }
+-- /* test_edgecasesiterator_Example_get_varCounterNext */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_3ae982266c863a3d (void)) (
+--   VarCounter arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &varCounterNext;
+-- }
+-- /* test_edgecasesiterator_Example_get_releaseVarCounter */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_802a723805cb041f (void)) (
+--   VarCounter arg1
+-- )
+-- {
+--   return &releaseVarCounter;
+-- }
+{-| Auxiliary type used by 'Toggle'
+
+    __C declaration:__ @Toggle@
+
+    __defined at:__ @edge-cases\/iterator.h 3:16@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype Toggle_Aux
+    = Toggle_Aux {unwrapToggle_Aux :: (IO CBool)}
+    deriving stock Generic
+-- __unique:__ @toToggle_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_eca2bca8e63194be_base ::
+    IO CBool
+ -> IO (FunPtr (IO CBool))
+-- __unique:__ @toToggle_Aux@
+hs_bindgen_eca2bca8e63194be :: Toggle_Aux -> IO (FunPtr Toggle_Aux)
+-- __unique:__ @toToggle_Aux@
+hs_bindgen_eca2bca8e63194be = \fun_0 -> fmap castFunPtr (hs_bindgen_eca2bca8e63194be_base (fmap toFFIType (getField @"unwrapToggle_Aux" fun_0)))
+-- __unique:__ @fromToggle_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_703fc4bdc168721d_base ::
+    FunPtr (IO CBool)
+ -> IO CBool
+-- __unique:__ @fromToggle_Aux@
+hs_bindgen_703fc4bdc168721d :: FunPtr Toggle_Aux -> Toggle_Aux
+-- __unique:__ @fromToggle_Aux@
+hs_bindgen_703fc4bdc168721d = \funPtr_0 -> Toggle_Aux (fmap fromFFIType (hs_bindgen_703fc4bdc168721d_base (castFunPtr funPtr_0)))
+instance ToFunPtr Toggle_Aux
+    where toFunPtr = hs_bindgen_eca2bca8e63194be
+instance FromFunPtr Toggle_Aux
+    where fromFunPtr = hs_bindgen_703fc4bdc168721d
+instance (~) ty (IO CBool) =>
+         HasField "unwrapToggle_Aux" Toggle_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Toggle_Aux{unwrapToggle_Aux = y_1},
+                              getField @"unwrapToggle_Aux" x_0)
+instance (~) ty (IO CBool) =>
+         HasField "unwrapToggle_Aux" (Ptr Toggle_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapToggle_Aux")
+instance HasCField Toggle_Aux "unwrapToggle_Aux"
+    where type CFieldType Toggle_Aux "unwrapToggle_Aux" = IO CBool
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @Toggle@
+
+    __defined at:__ @edge-cases\/iterator.h 3:16@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype Toggle
+    = Toggle {unwrapToggle :: (Block Toggle_Aux)}
+    deriving stock Generic
+    deriving newtype HasFFIType
+instance (~) ty (Block Toggle_Aux) =>
+         HasField "unwrapToggle" Toggle ty
+    where hasField = \x_0 -> (\y_1 -> Toggle{unwrapToggle = y_1},
+                              getField @"unwrapToggle" x_0)
+instance (~) ty (Block Toggle_Aux) =>
+         HasField "unwrapToggle" (Ptr Toggle) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapToggle")
+instance HasCField Toggle "unwrapToggle"
+    where type CFieldType Toggle "unwrapToggle" = Block Toggle_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Counter'
+
+    __C declaration:__ @Counter@
+
+    __defined at:__ @edge-cases\/iterator.h 10:14@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype Counter_Aux
+    = Counter_Aux {unwrapCounter_Aux :: (IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toCounter_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2202848aad97fe0a_base ::
+    IO CInt
+ -> IO (FunPtr (IO CInt))
+-- __unique:__ @toCounter_Aux@
+hs_bindgen_2202848aad97fe0a :: Counter_Aux ->
+                               IO (FunPtr Counter_Aux)
+-- __unique:__ @toCounter_Aux@
+hs_bindgen_2202848aad97fe0a = \fun_0 -> fmap castFunPtr (hs_bindgen_2202848aad97fe0a_base (fmap toFFIType (getField @"unwrapCounter_Aux" fun_0)))
+-- __unique:__ @fromCounter_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_73304cb84e9a2f8f_base ::
+    FunPtr (IO CInt)
+ -> IO CInt
+-- __unique:__ @fromCounter_Aux@
+hs_bindgen_73304cb84e9a2f8f :: FunPtr Counter_Aux -> Counter_Aux
+-- __unique:__ @fromCounter_Aux@
+hs_bindgen_73304cb84e9a2f8f = \funPtr_0 -> Counter_Aux (fmap fromFFIType (hs_bindgen_73304cb84e9a2f8f_base (castFunPtr funPtr_0)))
+instance ToFunPtr Counter_Aux
+    where toFunPtr = hs_bindgen_2202848aad97fe0a
+instance FromFunPtr Counter_Aux
+    where fromFunPtr = hs_bindgen_73304cb84e9a2f8f
+instance (~) ty (IO CInt) =>
+         HasField "unwrapCounter_Aux" Counter_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Counter_Aux{unwrapCounter_Aux = y_1},
+                              getField @"unwrapCounter_Aux" x_0)
+instance (~) ty (IO CInt) =>
+         HasField "unwrapCounter_Aux" (Ptr Counter_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapCounter_Aux")
+instance HasCField Counter_Aux "unwrapCounter_Aux"
+    where type CFieldType Counter_Aux "unwrapCounter_Aux" = IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @Counter@
+
+    __defined at:__ @edge-cases\/iterator.h 10:14@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype Counter
+    = Counter {unwrapCounter :: (Block Counter_Aux)}
+    deriving stock Generic
+    deriving newtype HasFFIType
+instance (~) ty (Block Counter_Aux) =>
+         HasField "unwrapCounter" Counter ty
+    where hasField = \x_0 -> (\y_1 -> Counter{unwrapCounter = y_1},
+                              getField @"unwrapCounter" x_0)
+instance (~) ty (Block Counter_Aux) =>
+         HasField "unwrapCounter" (Ptr Counter) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapCounter")
+instance HasCField Counter "unwrapCounter"
+    where type CFieldType Counter "unwrapCounter" = Block Counter_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'VarCounter'
+
+    __C declaration:__ @VarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 17:14@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype VarCounter_Aux
+    = VarCounter_Aux {unwrapVarCounter_Aux :: (CInt -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toVarCounter_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_42a7337570f8b0d0_base ::
+    CInt -> IO CInt
+ -> IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @toVarCounter_Aux@
+hs_bindgen_42a7337570f8b0d0 :: VarCounter_Aux ->
+                               IO (FunPtr VarCounter_Aux)
+-- __unique:__ @toVarCounter_Aux@
+hs_bindgen_42a7337570f8b0d0 = \fun_0 -> fmap castFunPtr (hs_bindgen_42a7337570f8b0d0_base (\x_1 -> fmap toFFIType (getField @"unwrapVarCounter_Aux" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromVarCounter_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_43d902480175fccf_base ::
+    FunPtr (CInt -> IO CInt)
+ -> CInt
+ -> IO CInt
+-- __unique:__ @fromVarCounter_Aux@
+hs_bindgen_43d902480175fccf :: FunPtr VarCounter_Aux ->
+                               VarCounter_Aux
+-- __unique:__ @fromVarCounter_Aux@
+hs_bindgen_43d902480175fccf = \funPtr_0 -> VarCounter_Aux (\x_1 -> fmap fromFFIType (hs_bindgen_43d902480175fccf_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr VarCounter_Aux
+    where toFunPtr = hs_bindgen_42a7337570f8b0d0
+instance FromFunPtr VarCounter_Aux
+    where fromFunPtr = hs_bindgen_43d902480175fccf
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapVarCounter_Aux" VarCounter_Aux ty
+    where hasField = \x_0 -> (\y_1 -> VarCounter_Aux{unwrapVarCounter_Aux = y_1},
+                              getField @"unwrapVarCounter_Aux" x_0)
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapVarCounter_Aux" (Ptr VarCounter_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapVarCounter_Aux")
+instance HasCField VarCounter_Aux "unwrapVarCounter_Aux"
+    where type CFieldType VarCounter_Aux
+                          "unwrapVarCounter_Aux" = CInt -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @VarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 17:14@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+newtype VarCounter
+    = VarCounter {unwrapVarCounter :: (Block VarCounter_Aux)}
+    deriving stock Generic
+    deriving newtype HasFFIType
+instance (~) ty (Block VarCounter_Aux) =>
+         HasField "unwrapVarCounter" VarCounter ty
+    where hasField = \x_0 -> (\y_1 -> VarCounter{unwrapVarCounter = y_1},
+                              getField @"unwrapVarCounter" x_0)
+instance (~) ty (Block VarCounter_Aux) =>
+         HasField "unwrapVarCounter" (Ptr VarCounter) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapVarCounter")
+instance HasCField VarCounter "unwrapVarCounter"
+    where type CFieldType VarCounter
+                          "unwrapVarCounter" = Block VarCounter_Aux
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeToggle@
+foreign import ccall safe "hs_bindgen_9d01035006b66206" hs_bindgen_9d01035006b66206_base ::
+    CBool
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeToggle@
+hs_bindgen_9d01035006b66206 :: CBool -> IO Toggle
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeToggle@
+hs_bindgen_9d01035006b66206 = \x_0 -> fmap fromFFIType (hs_bindgen_9d01035006b66206_base (toFFIType x_0))
+{-| __C declaration:__ @makeToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 4:8@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeToggle_safe :: CBool -> IO Toggle
+{-| __C declaration:__ @makeToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 4:8@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeToggle_safe = hs_bindgen_9d01035006b66206
+-- __unique:__ @test_edgecasesiterator_Example_Safe_toggleNext@
+foreign import ccall safe "hs_bindgen_ccd3ba727d0c0cf4" hs_bindgen_ccd3ba727d0c0cf4_base ::
+    Ptr Void
+ -> IO CBool
+-- __unique:__ @test_edgecasesiterator_Example_Safe_toggleNext@
+hs_bindgen_ccd3ba727d0c0cf4 :: Toggle -> IO CBool
+-- __unique:__ @test_edgecasesiterator_Example_Safe_toggleNext@
+hs_bindgen_ccd3ba727d0c0cf4 = \x_0 -> fmap fromFFIType (hs_bindgen_ccd3ba727d0c0cf4_base (toFFIType x_0))
+{-| __C declaration:__ @toggleNext@
+
+    __defined at:__ @edge-cases\/iterator.h 5:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+toggleNext_safe :: Toggle -> IO CBool
+{-| __C declaration:__ @toggleNext@
+
+    __defined at:__ @edge-cases\/iterator.h 5:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+toggleNext_safe = hs_bindgen_ccd3ba727d0c0cf4
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseToggle@
+foreign import ccall safe "hs_bindgen_602b40e971b06c72" hs_bindgen_602b40e971b06c72_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseToggle@
+hs_bindgen_602b40e971b06c72 :: Toggle -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseToggle@
+hs_bindgen_602b40e971b06c72 = \x_0 -> hs_bindgen_602b40e971b06c72_base (toFFIType x_0)
+{-| __C declaration:__ @releaseToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 6:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseToggle_safe :: Toggle -> IO ()
+{-| __C declaration:__ @releaseToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 6:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseToggle_safe = hs_bindgen_602b40e971b06c72
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeCounter@
+foreign import ccall safe "hs_bindgen_234fa6f1fb089e1d" hs_bindgen_234fa6f1fb089e1d_base ::
+    CInt
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeCounter@
+hs_bindgen_234fa6f1fb089e1d :: CInt -> CInt -> IO Counter
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeCounter@
+hs_bindgen_234fa6f1fb089e1d = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_234fa6f1fb089e1d_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @makeCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 11:9@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeCounter_safe :: CInt -> CInt -> IO Counter
+{-| __C declaration:__ @makeCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 11:9@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeCounter_safe = hs_bindgen_234fa6f1fb089e1d
+-- __unique:__ @test_edgecasesiterator_Example_Safe_counterNext@
+foreign import ccall safe "hs_bindgen_f0fca62d78f225c3" hs_bindgen_f0fca62d78f225c3_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_edgecasesiterator_Example_Safe_counterNext@
+hs_bindgen_f0fca62d78f225c3 :: Counter -> IO CInt
+-- __unique:__ @test_edgecasesiterator_Example_Safe_counterNext@
+hs_bindgen_f0fca62d78f225c3 = \x_0 -> fmap fromFFIType (hs_bindgen_f0fca62d78f225c3_base (toFFIType x_0))
+{-| __C declaration:__ @counterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 12:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+counterNext_safe :: Counter -> IO CInt
+{-| __C declaration:__ @counterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 12:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+counterNext_safe = hs_bindgen_f0fca62d78f225c3
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseCounter@
+foreign import ccall safe "hs_bindgen_e42dcbee8a114957" hs_bindgen_e42dcbee8a114957_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseCounter@
+hs_bindgen_e42dcbee8a114957 :: Counter -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseCounter@
+hs_bindgen_e42dcbee8a114957 = \x_0 -> hs_bindgen_e42dcbee8a114957_base (toFFIType x_0)
+{-| __C declaration:__ @releaseCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 13:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseCounter_safe :: Counter -> IO ()
+{-| __C declaration:__ @releaseCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 13:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseCounter_safe = hs_bindgen_e42dcbee8a114957
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeVarCounter@
+foreign import ccall safe "hs_bindgen_2bee4eb5b4d895c1" hs_bindgen_2bee4eb5b4d895c1_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeVarCounter@
+hs_bindgen_2bee4eb5b4d895c1 :: CInt -> IO VarCounter
+-- __unique:__ @test_edgecasesiterator_Example_Safe_makeVarCounter@
+hs_bindgen_2bee4eb5b4d895c1 = \x_0 -> fmap fromFFIType (hs_bindgen_2bee4eb5b4d895c1_base (toFFIType x_0))
+{-| __C declaration:__ @makeVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 18:12@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeVarCounter_safe :: CInt -> IO VarCounter
+{-| __C declaration:__ @makeVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 18:12@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeVarCounter_safe = hs_bindgen_2bee4eb5b4d895c1
+-- __unique:__ @test_edgecasesiterator_Example_Safe_varCounterNext@
+foreign import ccall safe "hs_bindgen_276b9cb5320fec37" hs_bindgen_276b9cb5320fec37_base ::
+    Ptr Void
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_edgecasesiterator_Example_Safe_varCounterNext@
+hs_bindgen_276b9cb5320fec37 :: VarCounter -> CInt -> IO CInt
+-- __unique:__ @test_edgecasesiterator_Example_Safe_varCounterNext@
+hs_bindgen_276b9cb5320fec37 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_276b9cb5320fec37_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @varCounterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 19:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+varCounterNext_safe :: VarCounter -> CInt -> IO CInt
+{-| __C declaration:__ @varCounterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 19:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+varCounterNext_safe = hs_bindgen_276b9cb5320fec37
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseVarCounter@
+foreign import ccall safe "hs_bindgen_8423b076f7c9df21" hs_bindgen_8423b076f7c9df21_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseVarCounter@
+hs_bindgen_8423b076f7c9df21 :: VarCounter -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Safe_releaseVarCounter@
+hs_bindgen_8423b076f7c9df21 = \x_0 -> hs_bindgen_8423b076f7c9df21_base (toFFIType x_0)
+{-| __C declaration:__ @releaseVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 20:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseVarCounter_safe :: VarCounter -> IO ()
+{-| __C declaration:__ @releaseVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 20:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseVarCounter_safe = hs_bindgen_8423b076f7c9df21
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeToggle@
+foreign import ccall unsafe "hs_bindgen_1b7a6a61a9c0da07" hs_bindgen_1b7a6a61a9c0da07_base ::
+    CBool
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeToggle@
+hs_bindgen_1b7a6a61a9c0da07 :: CBool -> IO Toggle
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeToggle@
+hs_bindgen_1b7a6a61a9c0da07 = \x_0 -> fmap fromFFIType (hs_bindgen_1b7a6a61a9c0da07_base (toFFIType x_0))
+{-| __C declaration:__ @makeToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 4:8@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeToggle_unsafe :: CBool -> IO Toggle
+{-| __C declaration:__ @makeToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 4:8@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeToggle_unsafe = hs_bindgen_1b7a6a61a9c0da07
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_toggleNext@
+foreign import ccall unsafe "hs_bindgen_4d2d650f2c8798d6" hs_bindgen_4d2d650f2c8798d6_base ::
+    Ptr Void
+ -> IO CBool
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_toggleNext@
+hs_bindgen_4d2d650f2c8798d6 :: Toggle -> IO CBool
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_toggleNext@
+hs_bindgen_4d2d650f2c8798d6 = \x_0 -> fmap fromFFIType (hs_bindgen_4d2d650f2c8798d6_base (toFFIType x_0))
+{-| __C declaration:__ @toggleNext@
+
+    __defined at:__ @edge-cases\/iterator.h 5:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+toggleNext_unsafe :: Toggle -> IO CBool
+{-| __C declaration:__ @toggleNext@
+
+    __defined at:__ @edge-cases\/iterator.h 5:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+toggleNext_unsafe = hs_bindgen_4d2d650f2c8798d6
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseToggle@
+foreign import ccall unsafe "hs_bindgen_ddbe11e76502cbdc" hs_bindgen_ddbe11e76502cbdc_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseToggle@
+hs_bindgen_ddbe11e76502cbdc :: Toggle -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseToggle@
+hs_bindgen_ddbe11e76502cbdc = \x_0 -> hs_bindgen_ddbe11e76502cbdc_base (toFFIType x_0)
+{-| __C declaration:__ @releaseToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 6:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseToggle_unsafe :: Toggle -> IO ()
+{-| __C declaration:__ @releaseToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 6:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseToggle_unsafe = hs_bindgen_ddbe11e76502cbdc
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeCounter@
+foreign import ccall unsafe "hs_bindgen_2b04d558934551d2" hs_bindgen_2b04d558934551d2_base ::
+    CInt
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeCounter@
+hs_bindgen_2b04d558934551d2 :: CInt -> CInt -> IO Counter
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeCounter@
+hs_bindgen_2b04d558934551d2 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_2b04d558934551d2_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @makeCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 11:9@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeCounter_unsafe :: CInt -> CInt -> IO Counter
+{-| __C declaration:__ @makeCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 11:9@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeCounter_unsafe = hs_bindgen_2b04d558934551d2
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_counterNext@
+foreign import ccall unsafe "hs_bindgen_5bba69c8bfbeedf0" hs_bindgen_5bba69c8bfbeedf0_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_counterNext@
+hs_bindgen_5bba69c8bfbeedf0 :: Counter -> IO CInt
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_counterNext@
+hs_bindgen_5bba69c8bfbeedf0 = \x_0 -> fmap fromFFIType (hs_bindgen_5bba69c8bfbeedf0_base (toFFIType x_0))
+{-| __C declaration:__ @counterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 12:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+counterNext_unsafe :: Counter -> IO CInt
+{-| __C declaration:__ @counterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 12:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+counterNext_unsafe = hs_bindgen_5bba69c8bfbeedf0
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseCounter@
+foreign import ccall unsafe "hs_bindgen_429845bb55a5a7b5" hs_bindgen_429845bb55a5a7b5_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseCounter@
+hs_bindgen_429845bb55a5a7b5 :: Counter -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseCounter@
+hs_bindgen_429845bb55a5a7b5 = \x_0 -> hs_bindgen_429845bb55a5a7b5_base (toFFIType x_0)
+{-| __C declaration:__ @releaseCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 13:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseCounter_unsafe :: Counter -> IO ()
+{-| __C declaration:__ @releaseCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 13:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseCounter_unsafe = hs_bindgen_429845bb55a5a7b5
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeVarCounter@
+foreign import ccall unsafe "hs_bindgen_4421633e88fc96c4" hs_bindgen_4421633e88fc96c4_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeVarCounter@
+hs_bindgen_4421633e88fc96c4 :: CInt -> IO VarCounter
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_makeVarCounter@
+hs_bindgen_4421633e88fc96c4 = \x_0 -> fmap fromFFIType (hs_bindgen_4421633e88fc96c4_base (toFFIType x_0))
+{-| __C declaration:__ @makeVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 18:12@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeVarCounter_unsafe :: CInt -> IO VarCounter
+{-| __C declaration:__ @makeVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 18:12@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeVarCounter_unsafe = hs_bindgen_4421633e88fc96c4
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_varCounterNext@
+foreign import ccall unsafe "hs_bindgen_31edd817cb78027d" hs_bindgen_31edd817cb78027d_base ::
+    Ptr Void
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_varCounterNext@
+hs_bindgen_31edd817cb78027d :: VarCounter -> CInt -> IO CInt
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_varCounterNext@
+hs_bindgen_31edd817cb78027d = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_31edd817cb78027d_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @varCounterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 19:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+varCounterNext_unsafe :: VarCounter -> CInt -> IO CInt
+{-| __C declaration:__ @varCounterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 19:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+varCounterNext_unsafe = hs_bindgen_31edd817cb78027d
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseVarCounter@
+foreign import ccall unsafe "hs_bindgen_32e5b257124f69a2" hs_bindgen_32e5b257124f69a2_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseVarCounter@
+hs_bindgen_32e5b257124f69a2 :: VarCounter -> IO ()
+-- __unique:__ @test_edgecasesiterator_Example_Unsafe_releaseVarCounter@
+hs_bindgen_32e5b257124f69a2 = \x_0 -> hs_bindgen_32e5b257124f69a2_base (toFFIType x_0)
+{-| __C declaration:__ @releaseVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 20:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseVarCounter_unsafe :: VarCounter -> IO ()
+{-| __C declaration:__ @releaseVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 20:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseVarCounter_unsafe = hs_bindgen_32e5b257124f69a2
+-- __unique:__ @test_edgecasesiterator_Example_get_makeToggle@
+foreign import ccall unsafe "hs_bindgen_ccdad25a057f8efd" hs_bindgen_ccdad25a057f8efd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesiterator_Example_get_makeToggle@
+hs_bindgen_ccdad25a057f8efd :: IO (FunPtr (CBool -> IO Toggle))
+-- __unique:__ @test_edgecasesiterator_Example_get_makeToggle@
+hs_bindgen_ccdad25a057f8efd = fmap fromFFIType hs_bindgen_ccdad25a057f8efd_base
+{-# NOINLINE makeToggle_funptr #-}
+{-| __C declaration:__ @makeToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 4:8@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeToggle_funptr :: FunPtr (CBool -> IO Toggle)
+{-| __C declaration:__ @makeToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 4:8@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeToggle_funptr = unsafePerformIO hs_bindgen_ccdad25a057f8efd
+-- __unique:__ @test_edgecasesiterator_Example_get_toggleNext@
+foreign import ccall unsafe "hs_bindgen_fd8e19ba2d78baa9" hs_bindgen_fd8e19ba2d78baa9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesiterator_Example_get_toggleNext@
+hs_bindgen_fd8e19ba2d78baa9 :: IO (FunPtr (Toggle -> IO CBool))
+-- __unique:__ @test_edgecasesiterator_Example_get_toggleNext@
+hs_bindgen_fd8e19ba2d78baa9 = fmap fromFFIType hs_bindgen_fd8e19ba2d78baa9_base
+{-# NOINLINE toggleNext_funptr #-}
+{-| __C declaration:__ @toggleNext@
+
+    __defined at:__ @edge-cases\/iterator.h 5:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+toggleNext_funptr :: FunPtr (Toggle -> IO CBool)
+{-| __C declaration:__ @toggleNext@
+
+    __defined at:__ @edge-cases\/iterator.h 5:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+toggleNext_funptr = unsafePerformIO hs_bindgen_fd8e19ba2d78baa9
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseToggle@
+foreign import ccall unsafe "hs_bindgen_780e490698de9df1" hs_bindgen_780e490698de9df1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseToggle@
+hs_bindgen_780e490698de9df1 :: IO (FunPtr (Toggle -> IO ()))
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseToggle@
+hs_bindgen_780e490698de9df1 = fmap fromFFIType hs_bindgen_780e490698de9df1_base
+{-# NOINLINE releaseToggle_funptr #-}
+{-| __C declaration:__ @releaseToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 6:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseToggle_funptr :: FunPtr (Toggle -> IO ())
+{-| __C declaration:__ @releaseToggle@
+
+    __defined at:__ @edge-cases\/iterator.h 6:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseToggle_funptr = unsafePerformIO hs_bindgen_780e490698de9df1
+-- __unique:__ @test_edgecasesiterator_Example_get_makeCounter@
+foreign import ccall unsafe "hs_bindgen_517dd14dbdb5e3ba" hs_bindgen_517dd14dbdb5e3ba_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesiterator_Example_get_makeCounter@
+hs_bindgen_517dd14dbdb5e3ba :: IO (FunPtr (CInt ->
+                                           CInt -> IO Counter))
+-- __unique:__ @test_edgecasesiterator_Example_get_makeCounter@
+hs_bindgen_517dd14dbdb5e3ba = fmap fromFFIType hs_bindgen_517dd14dbdb5e3ba_base
+{-# NOINLINE makeCounter_funptr #-}
+{-| __C declaration:__ @makeCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 11:9@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeCounter_funptr :: FunPtr (CInt -> CInt -> IO Counter)
+{-| __C declaration:__ @makeCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 11:9@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeCounter_funptr = unsafePerformIO hs_bindgen_517dd14dbdb5e3ba
+-- __unique:__ @test_edgecasesiterator_Example_get_counterNext@
+foreign import ccall unsafe "hs_bindgen_28d81dd8ce6aca30" hs_bindgen_28d81dd8ce6aca30_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesiterator_Example_get_counterNext@
+hs_bindgen_28d81dd8ce6aca30 :: IO (FunPtr (Counter -> IO CInt))
+-- __unique:__ @test_edgecasesiterator_Example_get_counterNext@
+hs_bindgen_28d81dd8ce6aca30 = fmap fromFFIType hs_bindgen_28d81dd8ce6aca30_base
+{-# NOINLINE counterNext_funptr #-}
+{-| __C declaration:__ @counterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 12:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+counterNext_funptr :: FunPtr (Counter -> IO CInt)
+{-| __C declaration:__ @counterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 12:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+counterNext_funptr = unsafePerformIO hs_bindgen_28d81dd8ce6aca30
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseCounter@
+foreign import ccall unsafe "hs_bindgen_849de94baad0430a" hs_bindgen_849de94baad0430a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseCounter@
+hs_bindgen_849de94baad0430a :: IO (FunPtr (Counter -> IO ()))
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseCounter@
+hs_bindgen_849de94baad0430a = fmap fromFFIType hs_bindgen_849de94baad0430a_base
+{-# NOINLINE releaseCounter_funptr #-}
+{-| __C declaration:__ @releaseCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 13:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseCounter_funptr :: FunPtr (Counter -> IO ())
+{-| __C declaration:__ @releaseCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 13:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseCounter_funptr = unsafePerformIO hs_bindgen_849de94baad0430a
+-- __unique:__ @test_edgecasesiterator_Example_get_makeVarCounter@
+foreign import ccall unsafe "hs_bindgen_8eea20d99febeef3" hs_bindgen_8eea20d99febeef3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesiterator_Example_get_makeVarCounter@
+hs_bindgen_8eea20d99febeef3 :: IO (FunPtr (CInt -> IO VarCounter))
+-- __unique:__ @test_edgecasesiterator_Example_get_makeVarCounter@
+hs_bindgen_8eea20d99febeef3 = fmap fromFFIType hs_bindgen_8eea20d99febeef3_base
+{-# NOINLINE makeVarCounter_funptr #-}
+{-| __C declaration:__ @makeVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 18:12@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeVarCounter_funptr :: FunPtr (CInt -> IO VarCounter)
+{-| __C declaration:__ @makeVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 18:12@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+makeVarCounter_funptr = unsafePerformIO hs_bindgen_8eea20d99febeef3
+-- __unique:__ @test_edgecasesiterator_Example_get_varCounterNext@
+foreign import ccall unsafe "hs_bindgen_3ae982266c863a3d" hs_bindgen_3ae982266c863a3d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesiterator_Example_get_varCounterNext@
+hs_bindgen_3ae982266c863a3d :: IO (FunPtr (VarCounter ->
+                                           CInt -> IO CInt))
+-- __unique:__ @test_edgecasesiterator_Example_get_varCounterNext@
+hs_bindgen_3ae982266c863a3d = fmap fromFFIType hs_bindgen_3ae982266c863a3d_base
+{-# NOINLINE varCounterNext_funptr #-}
+{-| __C declaration:__ @varCounterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 19:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+varCounterNext_funptr :: FunPtr (VarCounter -> CInt -> IO CInt)
+{-| __C declaration:__ @varCounterNext@
+
+    __defined at:__ @edge-cases\/iterator.h 19:5@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+varCounterNext_funptr = unsafePerformIO hs_bindgen_3ae982266c863a3d
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseVarCounter@
+foreign import ccall unsafe "hs_bindgen_802a723805cb041f" hs_bindgen_802a723805cb041f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseVarCounter@
+hs_bindgen_802a723805cb041f :: IO (FunPtr (VarCounter -> IO ()))
+-- __unique:__ @test_edgecasesiterator_Example_get_releaseVarCounter@
+hs_bindgen_802a723805cb041f = fmap fromFFIType hs_bindgen_802a723805cb041f_base
+{-# NOINLINE releaseVarCounter_funptr #-}
+{-| __C declaration:__ @releaseVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 20:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseVarCounter_funptr :: FunPtr (VarCounter -> IO ())
+{-| __C declaration:__ @releaseVarCounter@
+
+    __defined at:__ @edge-cases\/iterator.h 20:6@
+
+    __exported by:__ @edge-cases\/iterator.h@
+-}
+releaseVarCounter_funptr = unsafePerformIO hs_bindgen_802a723805cb041f
diff --git a/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example.hs b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 3:8@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+data T = T
+  { t_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/mangle_fun_param_names.h 4:7@
+
+         __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> HasCField.readRaw (BG.Proxy @"t_x") ptr0
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T t_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t_x") ptr0 t_x2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via Struct.IsStructViaReadRaw T instance Struct.IsStruct T
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 4:7@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_x" T ty where
+
+  hasField =
+    \x0 -> (\y1 -> T {t_x = y1}, BG.getField @"t_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_x" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_x")
+
+instance HasCField.HasCField T "t_x" where
+
+  type CFieldType T "t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example/FunPtr.hs
@@ -0,0 +1,133 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.param_underscore
+    , Example.FunPtr.param_uppercase
+    , Example.FunPtr.param_undersore_capital
+    , Example.FunPtr.param_haskell_reserved_name
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/mangle_fun_param_names.h>"
+  , "/* test_edgecasesmangle_fun_param_na_Example_get_param_underscore */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2e4a9e3fbd884275 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &param_underscore;"
+  , "}"
+  , "/* test_edgecasesmangle_fun_param_na_Example_get_param_uppercase */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3364ddfa127443d9 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &param_uppercase;"
+  , "}"
+  , "/* test_edgecasesmangle_fun_param_na_Example_get_param_undersore_capital */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_33f2dcd4eac093b3 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &param_undersore_capital;"
+  , "}"
+  , "/* test_edgecasesmangle_fun_param_na_Example_get_param_haskell_reserved_name */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_89c62efefee0f3b3 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &param_haskell_reserved_name;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_underscore@
+foreign import ccall unsafe "hs_bindgen_2e4a9e3fbd884275" hs_bindgen_2e4a9e3fbd884275_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_underscore@
+hs_bindgen_2e4a9e3fbd884275 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_2e4a9e3fbd884275 =
+  fmap BG.fromFFIType hs_bindgen_2e4a9e3fbd884275_base
+
+{-# NOINLINE param_underscore #-}
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 9:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_underscore :: BG.FunPtr (T -> IO ())
+param_underscore =
+  BG.unsafePerformIO hs_bindgen_2e4a9e3fbd884275
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_uppercase@
+foreign import ccall unsafe "hs_bindgen_3364ddfa127443d9" hs_bindgen_3364ddfa127443d9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_uppercase@
+hs_bindgen_3364ddfa127443d9 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_3364ddfa127443d9 =
+  fmap BG.fromFFIType hs_bindgen_3364ddfa127443d9_base
+
+{-# NOINLINE param_uppercase #-}
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 10:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_uppercase :: BG.FunPtr (T -> IO ())
+param_uppercase =
+  BG.unsafePerformIO hs_bindgen_3364ddfa127443d9
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_undersore_capital@
+foreign import ccall unsafe "hs_bindgen_33f2dcd4eac093b3" hs_bindgen_33f2dcd4eac093b3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_undersore_capital@
+hs_bindgen_33f2dcd4eac093b3 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_33f2dcd4eac093b3 =
+  fmap BG.fromFFIType hs_bindgen_33f2dcd4eac093b3_base
+
+{-# NOINLINE param_undersore_capital #-}
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 11:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_undersore_capital :: BG.FunPtr (T -> IO ())
+param_undersore_capital =
+  BG.unsafePerformIO hs_bindgen_33f2dcd4eac093b3
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_haskell_reserved_name@
+foreign import ccall unsafe "hs_bindgen_89c62efefee0f3b3" hs_bindgen_89c62efefee0f3b3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_haskell_reserved_name@
+hs_bindgen_89c62efefee0f3b3 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_89c62efefee0f3b3 =
+  fmap BG.fromFFIType hs_bindgen_89c62efefee0f3b3_base
+
+{-# NOINLINE param_haskell_reserved_name #-}
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 12:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_haskell_reserved_name :: BG.FunPtr (T -> IO ())
+param_haskell_reserved_name =
+  BG.unsafePerformIO hs_bindgen_89c62efefee0f3b3
diff --git a/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example/Safe.hs
@@ -0,0 +1,155 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.param_underscore
+    , Example.Safe.param_uppercase
+    , Example.Safe.param_undersore_capital
+    , Example.Safe.param_haskell_reserved_name
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/mangle_fun_param_names.h>"
+  , "void hs_bindgen_32fb10fccaa5c64b ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_underscore)(*arg1);"
+  , "}"
+  , "void hs_bindgen_5888c48ab8bc55c6 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_uppercase)(*arg1);"
+  , "}"
+  , "void hs_bindgen_330a5861a2d663d1 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_undersore_capital)(*arg1);"
+  , "}"
+  , "void hs_bindgen_8db88cfd2f21fdb1 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_haskell_reserved_name)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_underscore@
+foreign import ccall safe "hs_bindgen_32fb10fccaa5c64b" hs_bindgen_32fb10fccaa5c64b_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_underscore@
+hs_bindgen_32fb10fccaa5c64b ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_32fb10fccaa5c64b =
+  \x0 ->
+    hs_bindgen_32fb10fccaa5c64b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 9:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_underscore ::
+     T
+     -- ^ __C declaration:__ @_@
+  -> IO ()
+param_underscore =
+  \_0 ->
+    BG.with _0 (\_1 -> hs_bindgen_32fb10fccaa5c64b _1)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_uppercase@
+foreign import ccall safe "hs_bindgen_5888c48ab8bc55c6" hs_bindgen_5888c48ab8bc55c6_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_uppercase@
+hs_bindgen_5888c48ab8bc55c6 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_5888c48ab8bc55c6 =
+  \x0 ->
+    hs_bindgen_5888c48ab8bc55c6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 10:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_uppercase ::
+     T
+     -- ^ __C declaration:__ @Type@
+  -> IO ()
+param_uppercase =
+  \type'0 ->
+    BG.with type'0 (\type'1 ->
+                      hs_bindgen_5888c48ab8bc55c6 type'1)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_undersore_capital@
+foreign import ccall safe "hs_bindgen_330a5861a2d663d1" hs_bindgen_330a5861a2d663d1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_undersore_capital@
+hs_bindgen_330a5861a2d663d1 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_330a5861a2d663d1 =
+  \x0 ->
+    hs_bindgen_330a5861a2d663d1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 11:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_undersore_capital ::
+     T
+     -- ^ __C declaration:__ @_T@
+  -> IO ()
+param_undersore_capital =
+  \_T0 ->
+    BG.with _T0 (\_T1 -> hs_bindgen_330a5861a2d663d1 _T1)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_haskell_reserved_name@
+foreign import ccall safe "hs_bindgen_8db88cfd2f21fdb1" hs_bindgen_8db88cfd2f21fdb1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_haskell_reserved_name@
+hs_bindgen_8db88cfd2f21fdb1 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_8db88cfd2f21fdb1 =
+  \x0 ->
+    hs_bindgen_8db88cfd2f21fdb1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 12:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_haskell_reserved_name ::
+     T
+     -- ^ __C declaration:__ @type@
+  -> IO ()
+param_haskell_reserved_name =
+  \type'0 ->
+    BG.with type'0 (\type'1 ->
+                      hs_bindgen_8db88cfd2f21fdb1 type'1)
diff --git a/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/Example/Unsafe.hs
@@ -0,0 +1,155 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.param_underscore
+    , Example.Unsafe.param_uppercase
+    , Example.Unsafe.param_undersore_capital
+    , Example.Unsafe.param_haskell_reserved_name
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/mangle_fun_param_names.h>"
+  , "void hs_bindgen_0ff5c586f093fdab ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_underscore)(*arg1);"
+  , "}"
+  , "void hs_bindgen_83f7b80a01e50f06 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_uppercase)(*arg1);"
+  , "}"
+  , "void hs_bindgen_a015d9b3e63c0a07 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_undersore_capital)(*arg1);"
+  , "}"
+  , "void hs_bindgen_6ac28bcdfd5bcd07 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_haskell_reserved_name)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_underscore@
+foreign import ccall unsafe "hs_bindgen_0ff5c586f093fdab" hs_bindgen_0ff5c586f093fdab_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_underscore@
+hs_bindgen_0ff5c586f093fdab ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_0ff5c586f093fdab =
+  \x0 ->
+    hs_bindgen_0ff5c586f093fdab_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 9:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_underscore ::
+     T
+     -- ^ __C declaration:__ @_@
+  -> IO ()
+param_underscore =
+  \_0 ->
+    BG.with _0 (\_1 -> hs_bindgen_0ff5c586f093fdab _1)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_uppercase@
+foreign import ccall unsafe "hs_bindgen_83f7b80a01e50f06" hs_bindgen_83f7b80a01e50f06_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_uppercase@
+hs_bindgen_83f7b80a01e50f06 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_83f7b80a01e50f06 =
+  \x0 ->
+    hs_bindgen_83f7b80a01e50f06_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 10:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_uppercase ::
+     T
+     -- ^ __C declaration:__ @Type@
+  -> IO ()
+param_uppercase =
+  \type'0 ->
+    BG.with type'0 (\type'1 ->
+                      hs_bindgen_83f7b80a01e50f06 type'1)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_undersore_capital@
+foreign import ccall unsafe "hs_bindgen_a015d9b3e63c0a07" hs_bindgen_a015d9b3e63c0a07_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_undersore_capital@
+hs_bindgen_a015d9b3e63c0a07 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_a015d9b3e63c0a07 =
+  \x0 ->
+    hs_bindgen_a015d9b3e63c0a07_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 11:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_undersore_capital ::
+     T
+     -- ^ __C declaration:__ @_T@
+  -> IO ()
+param_undersore_capital =
+  \_T0 ->
+    BG.with _T0 (\_T1 -> hs_bindgen_a015d9b3e63c0a07 _T1)
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_haskell_reserved_name@
+foreign import ccall unsafe "hs_bindgen_6ac28bcdfd5bcd07" hs_bindgen_6ac28bcdfd5bcd07_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_haskell_reserved_name@
+hs_bindgen_6ac28bcdfd5bcd07 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_6ac28bcdfd5bcd07 =
+  \x0 ->
+    hs_bindgen_6ac28bcdfd5bcd07_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 12:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_haskell_reserved_name ::
+     T
+     -- ^ __C declaration:__ @type@
+  -> IO ()
+param_haskell_reserved_name =
+  \type'0 ->
+    BG.with type'0 (\type'1 ->
+                      hs_bindgen_6ac28bcdfd5bcd07 type'1)
diff --git a/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/bindingspec.yaml
@@ -0,0 +1,31 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/mangle_fun_param_names.h
+  cname: struct S
+  hsname: T
+- headers: edge-cases/mangle_fun_param_names.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    record:
+      constructor: T
+      fields:
+      - t_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/th.txt b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/mangle_fun_param_names/th.txt
@@ -0,0 +1,379 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/mangle_fun_param_names.h
+-- #include <edge-cases/mangle_fun_param_names.h>
+-- void hs_bindgen_32fb10fccaa5c64b (
+--   T *arg1
+-- )
+-- {
+--   (param_underscore)(*arg1);
+-- }
+-- void hs_bindgen_5888c48ab8bc55c6 (
+--   T *arg1
+-- )
+-- {
+--   (param_uppercase)(*arg1);
+-- }
+-- void hs_bindgen_330a5861a2d663d1 (
+--   T *arg1
+-- )
+-- {
+--   (param_undersore_capital)(*arg1);
+-- }
+-- void hs_bindgen_8db88cfd2f21fdb1 (
+--   T *arg1
+-- )
+-- {
+--   (param_haskell_reserved_name)(*arg1);
+-- }
+-- void hs_bindgen_0ff5c586f093fdab (
+--   T *arg1
+-- )
+-- {
+--   (param_underscore)(*arg1);
+-- }
+-- void hs_bindgen_83f7b80a01e50f06 (
+--   T *arg1
+-- )
+-- {
+--   (param_uppercase)(*arg1);
+-- }
+-- void hs_bindgen_a015d9b3e63c0a07 (
+--   T *arg1
+-- )
+-- {
+--   (param_undersore_capital)(*arg1);
+-- }
+-- void hs_bindgen_6ac28bcdfd5bcd07 (
+--   T *arg1
+-- )
+-- {
+--   (param_haskell_reserved_name)(*arg1);
+-- }
+-- /* test_edgecasesmangle_fun_param_na_Example_get_param_underscore */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2e4a9e3fbd884275 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &param_underscore;
+-- }
+-- /* test_edgecasesmangle_fun_param_na_Example_get_param_uppercase */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3364ddfa127443d9 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &param_uppercase;
+-- }
+-- /* test_edgecasesmangle_fun_param_na_Example_get_param_undersore_capital */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_33f2dcd4eac093b3 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &param_undersore_capital;
+-- }
+-- /* test_edgecasesmangle_fun_param_na_Example_get_param_haskell_reserved_name */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_89c62efefee0f3b3 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &param_haskell_reserved_name;
+-- }
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 3:8@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+data T
+    = T {t_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @edge-cases\/mangle_fun_param_names.h 4:7@
+
+              __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRaw (Proxy @"t_x") ptr_0
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T t_x_2 -> writeRaw (Proxy @"t_x") ptr_0 t_x_2
+deriving via (EquivStorable T) instance Storable T
+deriving via (IsStructViaReadRaw T) instance IsStruct T
+instance (~) ty CInt => HasField "t_x" T ty
+    where hasField = \x_0 -> (\y_1 -> T{t_x = y_1},
+                              getField @"t_x" x_0)
+instance (~) ty CInt => HasField "t_x" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_x")
+instance HasCField T "t_x"
+    where type CFieldType T "t_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_underscore@
+foreign import ccall safe "hs_bindgen_32fb10fccaa5c64b" hs_bindgen_32fb10fccaa5c64b_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_underscore@
+hs_bindgen_32fb10fccaa5c64b :: Ptr T -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_underscore@
+hs_bindgen_32fb10fccaa5c64b = \x_0 -> hs_bindgen_32fb10fccaa5c64b_base (toFFIType x_0)
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 9:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_underscore_safe :: T -> IO ()
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 9:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_underscore_safe = \__0 -> with __0 (\__1 -> hs_bindgen_32fb10fccaa5c64b __1)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_uppercase@
+foreign import ccall safe "hs_bindgen_5888c48ab8bc55c6" hs_bindgen_5888c48ab8bc55c6_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_uppercase@
+hs_bindgen_5888c48ab8bc55c6 :: Ptr T -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_uppercase@
+hs_bindgen_5888c48ab8bc55c6 = \x_0 -> hs_bindgen_5888c48ab8bc55c6_base (toFFIType x_0)
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 10:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_uppercase_safe :: T -> IO ()
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 10:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_uppercase_safe = \type'_0 -> with type'_0 (\type'_1 -> hs_bindgen_5888c48ab8bc55c6 type'_1)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_undersore_capital@
+foreign import ccall safe "hs_bindgen_330a5861a2d663d1" hs_bindgen_330a5861a2d663d1_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_undersore_capital@
+hs_bindgen_330a5861a2d663d1 :: Ptr T -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_undersore_capital@
+hs_bindgen_330a5861a2d663d1 = \x_0 -> hs_bindgen_330a5861a2d663d1_base (toFFIType x_0)
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 11:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_undersore_capital_safe :: T -> IO ()
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 11:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_undersore_capital_safe = \_T_0 -> with _T_0 (\_T_1 -> hs_bindgen_330a5861a2d663d1 _T_1)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_haskell_reserved_name@
+foreign import ccall safe "hs_bindgen_8db88cfd2f21fdb1" hs_bindgen_8db88cfd2f21fdb1_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_haskell_reserved_name@
+hs_bindgen_8db88cfd2f21fdb1 :: Ptr T -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Safe_param_haskell_reserved_name@
+hs_bindgen_8db88cfd2f21fdb1 = \x_0 -> hs_bindgen_8db88cfd2f21fdb1_base (toFFIType x_0)
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 12:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_haskell_reserved_name_safe :: T -> IO ()
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 12:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_haskell_reserved_name_safe = \type'_0 -> with type'_0 (\type'_1 -> hs_bindgen_8db88cfd2f21fdb1 type'_1)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_underscore@
+foreign import ccall unsafe "hs_bindgen_0ff5c586f093fdab" hs_bindgen_0ff5c586f093fdab_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_underscore@
+hs_bindgen_0ff5c586f093fdab :: Ptr T -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_underscore@
+hs_bindgen_0ff5c586f093fdab = \x_0 -> hs_bindgen_0ff5c586f093fdab_base (toFFIType x_0)
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 9:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_underscore_unsafe :: T -> IO ()
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 9:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_underscore_unsafe = \__0 -> with __0 (\__1 -> hs_bindgen_0ff5c586f093fdab __1)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_uppercase@
+foreign import ccall unsafe "hs_bindgen_83f7b80a01e50f06" hs_bindgen_83f7b80a01e50f06_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_uppercase@
+hs_bindgen_83f7b80a01e50f06 :: Ptr T -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_uppercase@
+hs_bindgen_83f7b80a01e50f06 = \x_0 -> hs_bindgen_83f7b80a01e50f06_base (toFFIType x_0)
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 10:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_uppercase_unsafe :: T -> IO ()
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 10:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_uppercase_unsafe = \type'_0 -> with type'_0 (\type'_1 -> hs_bindgen_83f7b80a01e50f06 type'_1)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_undersore_capital@
+foreign import ccall unsafe "hs_bindgen_a015d9b3e63c0a07" hs_bindgen_a015d9b3e63c0a07_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_undersore_capital@
+hs_bindgen_a015d9b3e63c0a07 :: Ptr T -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_undersore_capital@
+hs_bindgen_a015d9b3e63c0a07 = \x_0 -> hs_bindgen_a015d9b3e63c0a07_base (toFFIType x_0)
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 11:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_undersore_capital_unsafe :: T -> IO ()
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 11:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_undersore_capital_unsafe = \_T_0 -> with _T_0 (\_T_1 -> hs_bindgen_a015d9b3e63c0a07 _T_1)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_haskell_reserved_name@
+foreign import ccall unsafe "hs_bindgen_6ac28bcdfd5bcd07" hs_bindgen_6ac28bcdfd5bcd07_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_haskell_reserved_name@
+hs_bindgen_6ac28bcdfd5bcd07 :: Ptr T -> IO ()
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_Unsafe_param_haskell_reserved_name@
+hs_bindgen_6ac28bcdfd5bcd07 = \x_0 -> hs_bindgen_6ac28bcdfd5bcd07_base (toFFIType x_0)
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 12:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_haskell_reserved_name_unsafe :: T -> IO ()
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 12:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_haskell_reserved_name_unsafe = \type'_0 -> with type'_0 (\type'_1 -> hs_bindgen_6ac28bcdfd5bcd07 type'_1)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_underscore@
+foreign import ccall unsafe "hs_bindgen_2e4a9e3fbd884275" hs_bindgen_2e4a9e3fbd884275_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_underscore@
+hs_bindgen_2e4a9e3fbd884275 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_underscore@
+hs_bindgen_2e4a9e3fbd884275 = fmap fromFFIType hs_bindgen_2e4a9e3fbd884275_base
+{-# NOINLINE param_underscore_funptr #-}
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 9:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_underscore_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 9:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_underscore_funptr = unsafePerformIO hs_bindgen_2e4a9e3fbd884275
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_uppercase@
+foreign import ccall unsafe "hs_bindgen_3364ddfa127443d9" hs_bindgen_3364ddfa127443d9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_uppercase@
+hs_bindgen_3364ddfa127443d9 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_uppercase@
+hs_bindgen_3364ddfa127443d9 = fmap fromFFIType hs_bindgen_3364ddfa127443d9_base
+{-# NOINLINE param_uppercase_funptr #-}
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 10:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_uppercase_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 10:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_uppercase_funptr = unsafePerformIO hs_bindgen_3364ddfa127443d9
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_undersore_capital@
+foreign import ccall unsafe "hs_bindgen_33f2dcd4eac093b3" hs_bindgen_33f2dcd4eac093b3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_undersore_capital@
+hs_bindgen_33f2dcd4eac093b3 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_undersore_capital@
+hs_bindgen_33f2dcd4eac093b3 = fmap fromFFIType hs_bindgen_33f2dcd4eac093b3_base
+{-# NOINLINE param_undersore_capital_funptr #-}
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 11:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_undersore_capital_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 11:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_undersore_capital_funptr = unsafePerformIO hs_bindgen_33f2dcd4eac093b3
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_haskell_reserved_name@
+foreign import ccall unsafe "hs_bindgen_89c62efefee0f3b3" hs_bindgen_89c62efefee0f3b3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_haskell_reserved_name@
+hs_bindgen_89c62efefee0f3b3 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_edgecasesmangle_fun_param_na_Example_get_param_haskell_reserved_name@
+hs_bindgen_89c62efefee0f3b3 = fmap fromFFIType hs_bindgen_89c62efefee0f3b3_base
+{-# NOINLINE param_haskell_reserved_name_funptr #-}
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 12:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_haskell_reserved_name_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @edge-cases\/mangle_fun_param_names.h 12:6@
+
+    __exported by:__ @edge-cases\/mangle_fun_param_names.h@
+-}
+param_haskell_reserved_name_funptr = unsafePerformIO hs_bindgen_89c62efefee0f3b3
diff --git a/test-artefacts/fixtures/edge-cases/names/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/names/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/names/Example/FunPtr.hs
@@ -0,0 +1,683 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.by'
+    , Example.FunPtr.forall'
+    , Example.FunPtr.mdo'
+    , Example.FunPtr.pattern'
+    , Example.FunPtr.proc'
+    , Example.FunPtr.rec'
+    , Example.FunPtr.using'
+    , Example.FunPtr.anyclass
+    , Example.FunPtr.capi
+    , Example.FunPtr.cases
+    , Example.FunPtr.ccall
+    , Example.FunPtr.dynamic
+    , Example.FunPtr.export
+    , Example.FunPtr.family
+    , Example.FunPtr.group
+    , Example.FunPtr.interruptible
+    , Example.FunPtr.javascript
+    , Example.FunPtr.label
+    , Example.FunPtr.prim
+    , Example.FunPtr.role
+    , Example.FunPtr.safe
+    , Example.FunPtr.stdcall
+    , Example.FunPtr.stock
+    , Example.FunPtr.unsafe
+    , Example.FunPtr.via
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/names.h>"
+  , "/* test_edgecasesnames_Example_get_by */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d50b20f504174dd5 (void)) (void)"
+  , "{"
+  , "  return &by;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_forall */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f7e660ea9223a909 (void)) (void)"
+  , "{"
+  , "  return &forall;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_mdo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_15319d1b8d2ca927 (void)) (void)"
+  , "{"
+  , "  return &mdo;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_pattern */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e5a1961c11d641ed (void)) (void)"
+  , "{"
+  , "  return &pattern;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_proc */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d2dd74adbb4a606c (void)) (void)"
+  , "{"
+  , "  return &proc;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_rec */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_bab6d9c9540c9d58 (void)) (void)"
+  , "{"
+  , "  return &rec;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_using */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_447fa7223c86f5c7 (void)) (void)"
+  , "{"
+  , "  return &using;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_anyclass */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f2292c17facdbcde (void)) (void)"
+  , "{"
+  , "  return &anyclass;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_capi */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_393b62c1a821de61 (void)) (void)"
+  , "{"
+  , "  return &capi;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_cases */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_962b5bf9813ea6dd (void)) (void)"
+  , "{"
+  , "  return &cases;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_ccall */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_599948844183b4ea (void)) (void)"
+  , "{"
+  , "  return &ccall;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_dynamic */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_aa442ea764d9d93c (void)) (void)"
+  , "{"
+  , "  return &dynamic;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_export */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_98dfb21e9f7b6857 (void)) (void)"
+  , "{"
+  , "  return &export;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_family */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b96b9fd3fa689c75 (void)) (void)"
+  , "{"
+  , "  return &family;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_group */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a4413aed06e03d16 (void)) (void)"
+  , "{"
+  , "  return &group;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_interruptible */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_52223789a2752bbe (void)) (void)"
+  , "{"
+  , "  return &interruptible;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_javascript */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3d349ab20e55d3d5 (void)) (void)"
+  , "{"
+  , "  return &javascript;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_label */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7ab78b24e63738f5 (void)) (void)"
+  , "{"
+  , "  return &label;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_prim */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_13caa66b81eebdfb (void)) (void)"
+  , "{"
+  , "  return &prim;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_role */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_99189a38ba22fdad (void)) (void)"
+  , "{"
+  , "  return &role;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_safe */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fe3819b9444e41b6 (void)) (void)"
+  , "{"
+  , "  return &safe;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_stdcall */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7d4e52bd26694f13 (void)) (void)"
+  , "{"
+  , "  return &stdcall;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_stock */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_be2fd8368b1f85bc (void)) (void)"
+  , "{"
+  , "  return &stock;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_unsafe */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d0faf7702a235ae1 (void)) (void)"
+  , "{"
+  , "  return &unsafe;"
+  , "}"
+  , "/* test_edgecasesnames_Example_get_via */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_56fc690ff4bc7c4e (void)) (void)"
+  , "{"
+  , "  return &via;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesnames_Example_get_by@
+foreign import ccall unsafe "hs_bindgen_d50b20f504174dd5" hs_bindgen_d50b20f504174dd5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_by@
+hs_bindgen_d50b20f504174dd5 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_d50b20f504174dd5 =
+  fmap BG.fromFFIType hs_bindgen_d50b20f504174dd5_base
+
+{-# NOINLINE by' #-}
+{-| __C declaration:__ @by@
+
+    __defined at:__ @edge-cases\/names.h 3:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+by' :: BG.FunPtr (IO ())
+by' = BG.unsafePerformIO hs_bindgen_d50b20f504174dd5
+
+-- __unique:__ @test_edgecasesnames_Example_get_forall@
+foreign import ccall unsafe "hs_bindgen_f7e660ea9223a909" hs_bindgen_f7e660ea9223a909_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_forall@
+hs_bindgen_f7e660ea9223a909 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_f7e660ea9223a909 =
+  fmap BG.fromFFIType hs_bindgen_f7e660ea9223a909_base
+
+{-# NOINLINE forall' #-}
+{-| __C declaration:__ @forall@
+
+    __defined at:__ @edge-cases\/names.h 4:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+forall' :: BG.FunPtr (IO ())
+forall' =
+  BG.unsafePerformIO hs_bindgen_f7e660ea9223a909
+
+-- __unique:__ @test_edgecasesnames_Example_get_mdo@
+foreign import ccall unsafe "hs_bindgen_15319d1b8d2ca927" hs_bindgen_15319d1b8d2ca927_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_mdo@
+hs_bindgen_15319d1b8d2ca927 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_15319d1b8d2ca927 =
+  fmap BG.fromFFIType hs_bindgen_15319d1b8d2ca927_base
+
+{-# NOINLINE mdo' #-}
+{-| __C declaration:__ @mdo@
+
+    __defined at:__ @edge-cases\/names.h 5:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+mdo' :: BG.FunPtr (IO ())
+mdo' = BG.unsafePerformIO hs_bindgen_15319d1b8d2ca927
+
+-- __unique:__ @test_edgecasesnames_Example_get_pattern@
+foreign import ccall unsafe "hs_bindgen_e5a1961c11d641ed" hs_bindgen_e5a1961c11d641ed_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_pattern@
+hs_bindgen_e5a1961c11d641ed :: IO (BG.FunPtr (IO ()))
+hs_bindgen_e5a1961c11d641ed =
+  fmap BG.fromFFIType hs_bindgen_e5a1961c11d641ed_base
+
+{-# NOINLINE pattern' #-}
+{-| __C declaration:__ @pattern@
+
+    __defined at:__ @edge-cases\/names.h 6:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+pattern' :: BG.FunPtr (IO ())
+pattern' =
+  BG.unsafePerformIO hs_bindgen_e5a1961c11d641ed
+
+-- __unique:__ @test_edgecasesnames_Example_get_proc@
+foreign import ccall unsafe "hs_bindgen_d2dd74adbb4a606c" hs_bindgen_d2dd74adbb4a606c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_proc@
+hs_bindgen_d2dd74adbb4a606c :: IO (BG.FunPtr (IO ()))
+hs_bindgen_d2dd74adbb4a606c =
+  fmap BG.fromFFIType hs_bindgen_d2dd74adbb4a606c_base
+
+{-# NOINLINE proc' #-}
+{-| __C declaration:__ @proc@
+
+    __defined at:__ @edge-cases\/names.h 7:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+proc' :: BG.FunPtr (IO ())
+proc' =
+  BG.unsafePerformIO hs_bindgen_d2dd74adbb4a606c
+
+-- __unique:__ @test_edgecasesnames_Example_get_rec@
+foreign import ccall unsafe "hs_bindgen_bab6d9c9540c9d58" hs_bindgen_bab6d9c9540c9d58_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_rec@
+hs_bindgen_bab6d9c9540c9d58 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_bab6d9c9540c9d58 =
+  fmap BG.fromFFIType hs_bindgen_bab6d9c9540c9d58_base
+
+{-# NOINLINE rec' #-}
+{-| __C declaration:__ @rec@
+
+    __defined at:__ @edge-cases\/names.h 8:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+rec' :: BG.FunPtr (IO ())
+rec' = BG.unsafePerformIO hs_bindgen_bab6d9c9540c9d58
+
+-- __unique:__ @test_edgecasesnames_Example_get_using@
+foreign import ccall unsafe "hs_bindgen_447fa7223c86f5c7" hs_bindgen_447fa7223c86f5c7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_using@
+hs_bindgen_447fa7223c86f5c7 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_447fa7223c86f5c7 =
+  fmap BG.fromFFIType hs_bindgen_447fa7223c86f5c7_base
+
+{-# NOINLINE using' #-}
+{-| __C declaration:__ @using@
+
+    __defined at:__ @edge-cases\/names.h 9:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+using' :: BG.FunPtr (IO ())
+using' =
+  BG.unsafePerformIO hs_bindgen_447fa7223c86f5c7
+
+-- __unique:__ @test_edgecasesnames_Example_get_anyclass@
+foreign import ccall unsafe "hs_bindgen_f2292c17facdbcde" hs_bindgen_f2292c17facdbcde_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_anyclass@
+hs_bindgen_f2292c17facdbcde :: IO (BG.FunPtr (IO ()))
+hs_bindgen_f2292c17facdbcde =
+  fmap BG.fromFFIType hs_bindgen_f2292c17facdbcde_base
+
+{-# NOINLINE anyclass #-}
+{-| __C declaration:__ @anyclass@
+
+    __defined at:__ @edge-cases\/names.h 12:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+anyclass :: BG.FunPtr (IO ())
+anyclass =
+  BG.unsafePerformIO hs_bindgen_f2292c17facdbcde
+
+-- __unique:__ @test_edgecasesnames_Example_get_capi@
+foreign import ccall unsafe "hs_bindgen_393b62c1a821de61" hs_bindgen_393b62c1a821de61_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_capi@
+hs_bindgen_393b62c1a821de61 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_393b62c1a821de61 =
+  fmap BG.fromFFIType hs_bindgen_393b62c1a821de61_base
+
+{-# NOINLINE capi #-}
+{-| __C declaration:__ @capi@
+
+    __defined at:__ @edge-cases\/names.h 13:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+capi :: BG.FunPtr (IO ())
+capi = BG.unsafePerformIO hs_bindgen_393b62c1a821de61
+
+-- __unique:__ @test_edgecasesnames_Example_get_cases@
+foreign import ccall unsafe "hs_bindgen_962b5bf9813ea6dd" hs_bindgen_962b5bf9813ea6dd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_cases@
+hs_bindgen_962b5bf9813ea6dd :: IO (BG.FunPtr (IO ()))
+hs_bindgen_962b5bf9813ea6dd =
+  fmap BG.fromFFIType hs_bindgen_962b5bf9813ea6dd_base
+
+{-# NOINLINE cases #-}
+{-| __C declaration:__ @cases@
+
+    __defined at:__ @edge-cases\/names.h 14:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+cases :: BG.FunPtr (IO ())
+cases =
+  BG.unsafePerformIO hs_bindgen_962b5bf9813ea6dd
+
+-- __unique:__ @test_edgecasesnames_Example_get_ccall@
+foreign import ccall unsafe "hs_bindgen_599948844183b4ea" hs_bindgen_599948844183b4ea_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_ccall@
+hs_bindgen_599948844183b4ea :: IO (BG.FunPtr (IO ()))
+hs_bindgen_599948844183b4ea =
+  fmap BG.fromFFIType hs_bindgen_599948844183b4ea_base
+
+{-# NOINLINE ccall #-}
+{-| __C declaration:__ @ccall@
+
+    __defined at:__ @edge-cases\/names.h 15:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+ccall :: BG.FunPtr (IO ())
+ccall =
+  BG.unsafePerformIO hs_bindgen_599948844183b4ea
+
+-- __unique:__ @test_edgecasesnames_Example_get_dynamic@
+foreign import ccall unsafe "hs_bindgen_aa442ea764d9d93c" hs_bindgen_aa442ea764d9d93c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_dynamic@
+hs_bindgen_aa442ea764d9d93c :: IO (BG.FunPtr (IO ()))
+hs_bindgen_aa442ea764d9d93c =
+  fmap BG.fromFFIType hs_bindgen_aa442ea764d9d93c_base
+
+{-# NOINLINE dynamic #-}
+{-| __C declaration:__ @dynamic@
+
+    __defined at:__ @edge-cases\/names.h 16:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+dynamic :: BG.FunPtr (IO ())
+dynamic =
+  BG.unsafePerformIO hs_bindgen_aa442ea764d9d93c
+
+-- __unique:__ @test_edgecasesnames_Example_get_export@
+foreign import ccall unsafe "hs_bindgen_98dfb21e9f7b6857" hs_bindgen_98dfb21e9f7b6857_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_export@
+hs_bindgen_98dfb21e9f7b6857 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_98dfb21e9f7b6857 =
+  fmap BG.fromFFIType hs_bindgen_98dfb21e9f7b6857_base
+
+{-# NOINLINE export #-}
+{-| __C declaration:__ @export@
+
+    __defined at:__ @edge-cases\/names.h 17:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+export :: BG.FunPtr (IO ())
+export =
+  BG.unsafePerformIO hs_bindgen_98dfb21e9f7b6857
+
+-- __unique:__ @test_edgecasesnames_Example_get_family@
+foreign import ccall unsafe "hs_bindgen_b96b9fd3fa689c75" hs_bindgen_b96b9fd3fa689c75_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_family@
+hs_bindgen_b96b9fd3fa689c75 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_b96b9fd3fa689c75 =
+  fmap BG.fromFFIType hs_bindgen_b96b9fd3fa689c75_base
+
+{-# NOINLINE family #-}
+{-| __C declaration:__ @family@
+
+    __defined at:__ @edge-cases\/names.h 18:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+family :: BG.FunPtr (IO ())
+family =
+  BG.unsafePerformIO hs_bindgen_b96b9fd3fa689c75
+
+-- __unique:__ @test_edgecasesnames_Example_get_group@
+foreign import ccall unsafe "hs_bindgen_a4413aed06e03d16" hs_bindgen_a4413aed06e03d16_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_group@
+hs_bindgen_a4413aed06e03d16 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_a4413aed06e03d16 =
+  fmap BG.fromFFIType hs_bindgen_a4413aed06e03d16_base
+
+{-# NOINLINE group #-}
+{-| __C declaration:__ @group@
+
+    __defined at:__ @edge-cases\/names.h 19:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+group :: BG.FunPtr (IO ())
+group =
+  BG.unsafePerformIO hs_bindgen_a4413aed06e03d16
+
+-- __unique:__ @test_edgecasesnames_Example_get_interruptible@
+foreign import ccall unsafe "hs_bindgen_52223789a2752bbe" hs_bindgen_52223789a2752bbe_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_interruptible@
+hs_bindgen_52223789a2752bbe :: IO (BG.FunPtr (IO ()))
+hs_bindgen_52223789a2752bbe =
+  fmap BG.fromFFIType hs_bindgen_52223789a2752bbe_base
+
+{-# NOINLINE interruptible #-}
+{-| __C declaration:__ @interruptible@
+
+    __defined at:__ @edge-cases\/names.h 20:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+interruptible :: BG.FunPtr (IO ())
+interruptible =
+  BG.unsafePerformIO hs_bindgen_52223789a2752bbe
+
+-- __unique:__ @test_edgecasesnames_Example_get_javascript@
+foreign import ccall unsafe "hs_bindgen_3d349ab20e55d3d5" hs_bindgen_3d349ab20e55d3d5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_javascript@
+hs_bindgen_3d349ab20e55d3d5 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_3d349ab20e55d3d5 =
+  fmap BG.fromFFIType hs_bindgen_3d349ab20e55d3d5_base
+
+{-# NOINLINE javascript #-}
+{-| __C declaration:__ @javascript@
+
+    __defined at:__ @edge-cases\/names.h 21:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+javascript :: BG.FunPtr (IO ())
+javascript =
+  BG.unsafePerformIO hs_bindgen_3d349ab20e55d3d5
+
+-- __unique:__ @test_edgecasesnames_Example_get_label@
+foreign import ccall unsafe "hs_bindgen_7ab78b24e63738f5" hs_bindgen_7ab78b24e63738f5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_label@
+hs_bindgen_7ab78b24e63738f5 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_7ab78b24e63738f5 =
+  fmap BG.fromFFIType hs_bindgen_7ab78b24e63738f5_base
+
+{-# NOINLINE label #-}
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/names.h 22:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+label :: BG.FunPtr (IO ())
+label =
+  BG.unsafePerformIO hs_bindgen_7ab78b24e63738f5
+
+-- __unique:__ @test_edgecasesnames_Example_get_prim@
+foreign import ccall unsafe "hs_bindgen_13caa66b81eebdfb" hs_bindgen_13caa66b81eebdfb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_prim@
+hs_bindgen_13caa66b81eebdfb :: IO (BG.FunPtr (IO ()))
+hs_bindgen_13caa66b81eebdfb =
+  fmap BG.fromFFIType hs_bindgen_13caa66b81eebdfb_base
+
+{-# NOINLINE prim #-}
+{-| __C declaration:__ @prim@
+
+    __defined at:__ @edge-cases\/names.h 23:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+prim :: BG.FunPtr (IO ())
+prim = BG.unsafePerformIO hs_bindgen_13caa66b81eebdfb
+
+-- __unique:__ @test_edgecasesnames_Example_get_role@
+foreign import ccall unsafe "hs_bindgen_99189a38ba22fdad" hs_bindgen_99189a38ba22fdad_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_role@
+hs_bindgen_99189a38ba22fdad :: IO (BG.FunPtr (IO ()))
+hs_bindgen_99189a38ba22fdad =
+  fmap BG.fromFFIType hs_bindgen_99189a38ba22fdad_base
+
+{-# NOINLINE role #-}
+{-| __C declaration:__ @role@
+
+    __defined at:__ @edge-cases\/names.h 24:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+role :: BG.FunPtr (IO ())
+role = BG.unsafePerformIO hs_bindgen_99189a38ba22fdad
+
+-- __unique:__ @test_edgecasesnames_Example_get_safe@
+foreign import ccall unsafe "hs_bindgen_fe3819b9444e41b6" hs_bindgen_fe3819b9444e41b6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_safe@
+hs_bindgen_fe3819b9444e41b6 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_fe3819b9444e41b6 =
+  fmap BG.fromFFIType hs_bindgen_fe3819b9444e41b6_base
+
+{-# NOINLINE safe #-}
+{-| __C declaration:__ @safe@
+
+    __defined at:__ @edge-cases\/names.h 25:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+safe :: BG.FunPtr (IO ())
+safe = BG.unsafePerformIO hs_bindgen_fe3819b9444e41b6
+
+-- __unique:__ @test_edgecasesnames_Example_get_stdcall@
+foreign import ccall unsafe "hs_bindgen_7d4e52bd26694f13" hs_bindgen_7d4e52bd26694f13_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_stdcall@
+hs_bindgen_7d4e52bd26694f13 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_7d4e52bd26694f13 =
+  fmap BG.fromFFIType hs_bindgen_7d4e52bd26694f13_base
+
+{-# NOINLINE stdcall #-}
+{-| __C declaration:__ @stdcall@
+
+    __defined at:__ @edge-cases\/names.h 26:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stdcall :: BG.FunPtr (IO ())
+stdcall =
+  BG.unsafePerformIO hs_bindgen_7d4e52bd26694f13
+
+-- __unique:__ @test_edgecasesnames_Example_get_stock@
+foreign import ccall unsafe "hs_bindgen_be2fd8368b1f85bc" hs_bindgen_be2fd8368b1f85bc_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_stock@
+hs_bindgen_be2fd8368b1f85bc :: IO (BG.FunPtr (IO ()))
+hs_bindgen_be2fd8368b1f85bc =
+  fmap BG.fromFFIType hs_bindgen_be2fd8368b1f85bc_base
+
+{-# NOINLINE stock #-}
+{-| __C declaration:__ @stock@
+
+    __defined at:__ @edge-cases\/names.h 27:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stock :: BG.FunPtr (IO ())
+stock =
+  BG.unsafePerformIO hs_bindgen_be2fd8368b1f85bc
+
+-- __unique:__ @test_edgecasesnames_Example_get_unsafe@
+foreign import ccall unsafe "hs_bindgen_d0faf7702a235ae1" hs_bindgen_d0faf7702a235ae1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_unsafe@
+hs_bindgen_d0faf7702a235ae1 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_d0faf7702a235ae1 =
+  fmap BG.fromFFIType hs_bindgen_d0faf7702a235ae1_base
+
+{-# NOINLINE unsafe #-}
+{-| __C declaration:__ @unsafe@
+
+    __defined at:__ @edge-cases\/names.h 28:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+unsafe :: BG.FunPtr (IO ())
+unsafe =
+  BG.unsafePerformIO hs_bindgen_d0faf7702a235ae1
+
+-- __unique:__ @test_edgecasesnames_Example_get_via@
+foreign import ccall unsafe "hs_bindgen_56fc690ff4bc7c4e" hs_bindgen_56fc690ff4bc7c4e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesnames_Example_get_via@
+hs_bindgen_56fc690ff4bc7c4e :: IO (BG.FunPtr (IO ()))
+hs_bindgen_56fc690ff4bc7c4e =
+  fmap BG.fromFFIType hs_bindgen_56fc690ff4bc7c4e_base
+
+{-# NOINLINE via #-}
+{-| __C declaration:__ @via@
+
+    __defined at:__ @edge-cases\/names.h 29:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+via :: BG.FunPtr (IO ())
+via = BG.unsafePerformIO hs_bindgen_56fc690ff4bc7c4e
diff --git a/test-artefacts/fixtures/edge-cases/names/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/names/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/names/Example/Safe.hs
@@ -0,0 +1,590 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.by'
+    , Example.Safe.forall'
+    , Example.Safe.mdo'
+    , Example.Safe.pattern'
+    , Example.Safe.proc'
+    , Example.Safe.rec'
+    , Example.Safe.using'
+    , Example.Safe.anyclass
+    , Example.Safe.capi
+    , Example.Safe.cases
+    , Example.Safe.ccall
+    , Example.Safe.dynamic
+    , Example.Safe.export
+    , Example.Safe.family
+    , Example.Safe.group
+    , Example.Safe.interruptible
+    , Example.Safe.javascript
+    , Example.Safe.label
+    , Example.Safe.prim
+    , Example.Safe.role
+    , Example.Safe.safe
+    , Example.Safe.stdcall
+    , Example.Safe.stock
+    , Example.Safe.unsafe
+    , Example.Safe.via
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/names.h>"
+  , "void hs_bindgen_601290db9e101424 (void)"
+  , "{"
+  , "  (by)();"
+  , "}"
+  , "void hs_bindgen_f03dbed5eebb711a (void)"
+  , "{"
+  , "  (forall)();"
+  , "}"
+  , "void hs_bindgen_d1e3196c869f9fa1 (void)"
+  , "{"
+  , "  (mdo)();"
+  , "}"
+  , "void hs_bindgen_d3dcd898c88fb2e0 (void)"
+  , "{"
+  , "  (pattern)();"
+  , "}"
+  , "void hs_bindgen_7f08456473f564e3 (void)"
+  , "{"
+  , "  (proc)();"
+  , "}"
+  , "void hs_bindgen_5df814c22f546599 (void)"
+  , "{"
+  , "  (rec)();"
+  , "}"
+  , "void hs_bindgen_3877b6deb653b5a4 (void)"
+  , "{"
+  , "  (using)();"
+  , "}"
+  , "void hs_bindgen_7b8790d04357731b (void)"
+  , "{"
+  , "  (anyclass)();"
+  , "}"
+  , "void hs_bindgen_0bf4ab515f3279b9 (void)"
+  , "{"
+  , "  (capi)();"
+  , "}"
+  , "void hs_bindgen_fa8166b2793e4236 (void)"
+  , "{"
+  , "  (cases)();"
+  , "}"
+  , "void hs_bindgen_decc2d43a62d063d (void)"
+  , "{"
+  , "  (ccall)();"
+  , "}"
+  , "void hs_bindgen_b5a75e2b6434134b (void)"
+  , "{"
+  , "  (dynamic)();"
+  , "}"
+  , "void hs_bindgen_406f7b014573b3d3 (void)"
+  , "{"
+  , "  (export)();"
+  , "}"
+  , "void hs_bindgen_14aab2af04efc222 (void)"
+  , "{"
+  , "  (family)();"
+  , "}"
+  , "void hs_bindgen_ee9285b26b11b393 (void)"
+  , "{"
+  , "  (group)();"
+  , "}"
+  , "void hs_bindgen_b2463d5c1d51883e (void)"
+  , "{"
+  , "  (interruptible)();"
+  , "}"
+  , "void hs_bindgen_55a55462d9cd296c (void)"
+  , "{"
+  , "  (javascript)();"
+  , "}"
+  , "void hs_bindgen_227f34efb176d1fb (void)"
+  , "{"
+  , "  (label)();"
+  , "}"
+  , "void hs_bindgen_51c6e0d18dce403a (void)"
+  , "{"
+  , "  (prim)();"
+  , "}"
+  , "void hs_bindgen_f85f2418d208e6a0 (void)"
+  , "{"
+  , "  (role)();"
+  , "}"
+  , "void hs_bindgen_0855ecbc4b53ebbb (void)"
+  , "{"
+  , "  (safe)();"
+  , "}"
+  , "void hs_bindgen_e5238d13788a6df9 (void)"
+  , "{"
+  , "  (stdcall)();"
+  , "}"
+  , "void hs_bindgen_cf38d8bd096a7a42 (void)"
+  , "{"
+  , "  (stock)();"
+  , "}"
+  , "void hs_bindgen_fda9b083b24404f0 (void)"
+  , "{"
+  , "  (unsafe)();"
+  , "}"
+  , "void hs_bindgen_1d2a76a3a595be25 (void)"
+  , "{"
+  , "  (via)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_by@
+foreign import ccall safe "hs_bindgen_601290db9e101424" hs_bindgen_601290db9e101424_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_by@
+hs_bindgen_601290db9e101424 :: IO ()
+hs_bindgen_601290db9e101424 =
+  hs_bindgen_601290db9e101424_base
+
+{-| __C declaration:__ @by@
+
+    __defined at:__ @edge-cases\/names.h 3:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+by' :: IO ()
+by' = hs_bindgen_601290db9e101424
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_forall@
+foreign import ccall safe "hs_bindgen_f03dbed5eebb711a" hs_bindgen_f03dbed5eebb711a_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_forall@
+hs_bindgen_f03dbed5eebb711a :: IO ()
+hs_bindgen_f03dbed5eebb711a =
+  hs_bindgen_f03dbed5eebb711a_base
+
+{-| __C declaration:__ @forall@
+
+    __defined at:__ @edge-cases\/names.h 4:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+forall' :: IO ()
+forall' = hs_bindgen_f03dbed5eebb711a
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_mdo@
+foreign import ccall safe "hs_bindgen_d1e3196c869f9fa1" hs_bindgen_d1e3196c869f9fa1_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_mdo@
+hs_bindgen_d1e3196c869f9fa1 :: IO ()
+hs_bindgen_d1e3196c869f9fa1 =
+  hs_bindgen_d1e3196c869f9fa1_base
+
+{-| __C declaration:__ @mdo@
+
+    __defined at:__ @edge-cases\/names.h 5:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+mdo' :: IO ()
+mdo' = hs_bindgen_d1e3196c869f9fa1
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_pattern@
+foreign import ccall safe "hs_bindgen_d3dcd898c88fb2e0" hs_bindgen_d3dcd898c88fb2e0_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_pattern@
+hs_bindgen_d3dcd898c88fb2e0 :: IO ()
+hs_bindgen_d3dcd898c88fb2e0 =
+  hs_bindgen_d3dcd898c88fb2e0_base
+
+{-| __C declaration:__ @pattern@
+
+    __defined at:__ @edge-cases\/names.h 6:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+pattern' :: IO ()
+pattern' = hs_bindgen_d3dcd898c88fb2e0
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_proc@
+foreign import ccall safe "hs_bindgen_7f08456473f564e3" hs_bindgen_7f08456473f564e3_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_proc@
+hs_bindgen_7f08456473f564e3 :: IO ()
+hs_bindgen_7f08456473f564e3 =
+  hs_bindgen_7f08456473f564e3_base
+
+{-| __C declaration:__ @proc@
+
+    __defined at:__ @edge-cases\/names.h 7:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+proc' :: IO ()
+proc' = hs_bindgen_7f08456473f564e3
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_rec@
+foreign import ccall safe "hs_bindgen_5df814c22f546599" hs_bindgen_5df814c22f546599_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_rec@
+hs_bindgen_5df814c22f546599 :: IO ()
+hs_bindgen_5df814c22f546599 =
+  hs_bindgen_5df814c22f546599_base
+
+{-| __C declaration:__ @rec@
+
+    __defined at:__ @edge-cases\/names.h 8:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+rec' :: IO ()
+rec' = hs_bindgen_5df814c22f546599
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_using@
+foreign import ccall safe "hs_bindgen_3877b6deb653b5a4" hs_bindgen_3877b6deb653b5a4_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_using@
+hs_bindgen_3877b6deb653b5a4 :: IO ()
+hs_bindgen_3877b6deb653b5a4 =
+  hs_bindgen_3877b6deb653b5a4_base
+
+{-| __C declaration:__ @using@
+
+    __defined at:__ @edge-cases\/names.h 9:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+using' :: IO ()
+using' = hs_bindgen_3877b6deb653b5a4
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_anyclass@
+foreign import ccall safe "hs_bindgen_7b8790d04357731b" hs_bindgen_7b8790d04357731b_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_anyclass@
+hs_bindgen_7b8790d04357731b :: IO ()
+hs_bindgen_7b8790d04357731b =
+  hs_bindgen_7b8790d04357731b_base
+
+{-| __C declaration:__ @anyclass@
+
+    __defined at:__ @edge-cases\/names.h 12:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+anyclass :: IO ()
+anyclass = hs_bindgen_7b8790d04357731b
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_capi@
+foreign import ccall safe "hs_bindgen_0bf4ab515f3279b9" hs_bindgen_0bf4ab515f3279b9_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_capi@
+hs_bindgen_0bf4ab515f3279b9 :: IO ()
+hs_bindgen_0bf4ab515f3279b9 =
+  hs_bindgen_0bf4ab515f3279b9_base
+
+{-| __C declaration:__ @capi@
+
+    __defined at:__ @edge-cases\/names.h 13:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+capi :: IO ()
+capi = hs_bindgen_0bf4ab515f3279b9
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_cases@
+foreign import ccall safe "hs_bindgen_fa8166b2793e4236" hs_bindgen_fa8166b2793e4236_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_cases@
+hs_bindgen_fa8166b2793e4236 :: IO ()
+hs_bindgen_fa8166b2793e4236 =
+  hs_bindgen_fa8166b2793e4236_base
+
+{-| __C declaration:__ @cases@
+
+    __defined at:__ @edge-cases\/names.h 14:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+cases :: IO ()
+cases = hs_bindgen_fa8166b2793e4236
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_ccall@
+foreign import ccall safe "hs_bindgen_decc2d43a62d063d" hs_bindgen_decc2d43a62d063d_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_ccall@
+hs_bindgen_decc2d43a62d063d :: IO ()
+hs_bindgen_decc2d43a62d063d =
+  hs_bindgen_decc2d43a62d063d_base
+
+{-| __C declaration:__ @ccall@
+
+    __defined at:__ @edge-cases\/names.h 15:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+ccall :: IO ()
+ccall = hs_bindgen_decc2d43a62d063d
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_dynamic@
+foreign import ccall safe "hs_bindgen_b5a75e2b6434134b" hs_bindgen_b5a75e2b6434134b_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_dynamic@
+hs_bindgen_b5a75e2b6434134b :: IO ()
+hs_bindgen_b5a75e2b6434134b =
+  hs_bindgen_b5a75e2b6434134b_base
+
+{-| __C declaration:__ @dynamic@
+
+    __defined at:__ @edge-cases\/names.h 16:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+dynamic :: IO ()
+dynamic = hs_bindgen_b5a75e2b6434134b
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_export@
+foreign import ccall safe "hs_bindgen_406f7b014573b3d3" hs_bindgen_406f7b014573b3d3_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_export@
+hs_bindgen_406f7b014573b3d3 :: IO ()
+hs_bindgen_406f7b014573b3d3 =
+  hs_bindgen_406f7b014573b3d3_base
+
+{-| __C declaration:__ @export@
+
+    __defined at:__ @edge-cases\/names.h 17:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+export :: IO ()
+export = hs_bindgen_406f7b014573b3d3
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_family@
+foreign import ccall safe "hs_bindgen_14aab2af04efc222" hs_bindgen_14aab2af04efc222_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_family@
+hs_bindgen_14aab2af04efc222 :: IO ()
+hs_bindgen_14aab2af04efc222 =
+  hs_bindgen_14aab2af04efc222_base
+
+{-| __C declaration:__ @family@
+
+    __defined at:__ @edge-cases\/names.h 18:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+family :: IO ()
+family = hs_bindgen_14aab2af04efc222
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_group@
+foreign import ccall safe "hs_bindgen_ee9285b26b11b393" hs_bindgen_ee9285b26b11b393_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_group@
+hs_bindgen_ee9285b26b11b393 :: IO ()
+hs_bindgen_ee9285b26b11b393 =
+  hs_bindgen_ee9285b26b11b393_base
+
+{-| __C declaration:__ @group@
+
+    __defined at:__ @edge-cases\/names.h 19:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+group :: IO ()
+group = hs_bindgen_ee9285b26b11b393
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_interruptible@
+foreign import ccall safe "hs_bindgen_b2463d5c1d51883e" hs_bindgen_b2463d5c1d51883e_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_interruptible@
+hs_bindgen_b2463d5c1d51883e :: IO ()
+hs_bindgen_b2463d5c1d51883e =
+  hs_bindgen_b2463d5c1d51883e_base
+
+{-| __C declaration:__ @interruptible@
+
+    __defined at:__ @edge-cases\/names.h 20:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+interruptible :: IO ()
+interruptible = hs_bindgen_b2463d5c1d51883e
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_javascript@
+foreign import ccall safe "hs_bindgen_55a55462d9cd296c" hs_bindgen_55a55462d9cd296c_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_javascript@
+hs_bindgen_55a55462d9cd296c :: IO ()
+hs_bindgen_55a55462d9cd296c =
+  hs_bindgen_55a55462d9cd296c_base
+
+{-| __C declaration:__ @javascript@
+
+    __defined at:__ @edge-cases\/names.h 21:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+javascript :: IO ()
+javascript = hs_bindgen_55a55462d9cd296c
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_label@
+foreign import ccall safe "hs_bindgen_227f34efb176d1fb" hs_bindgen_227f34efb176d1fb_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_label@
+hs_bindgen_227f34efb176d1fb :: IO ()
+hs_bindgen_227f34efb176d1fb =
+  hs_bindgen_227f34efb176d1fb_base
+
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/names.h 22:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+label :: IO ()
+label = hs_bindgen_227f34efb176d1fb
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_prim@
+foreign import ccall safe "hs_bindgen_51c6e0d18dce403a" hs_bindgen_51c6e0d18dce403a_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_prim@
+hs_bindgen_51c6e0d18dce403a :: IO ()
+hs_bindgen_51c6e0d18dce403a =
+  hs_bindgen_51c6e0d18dce403a_base
+
+{-| __C declaration:__ @prim@
+
+    __defined at:__ @edge-cases\/names.h 23:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+prim :: IO ()
+prim = hs_bindgen_51c6e0d18dce403a
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_role@
+foreign import ccall safe "hs_bindgen_f85f2418d208e6a0" hs_bindgen_f85f2418d208e6a0_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_role@
+hs_bindgen_f85f2418d208e6a0 :: IO ()
+hs_bindgen_f85f2418d208e6a0 =
+  hs_bindgen_f85f2418d208e6a0_base
+
+{-| __C declaration:__ @role@
+
+    __defined at:__ @edge-cases\/names.h 24:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+role :: IO ()
+role = hs_bindgen_f85f2418d208e6a0
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_safe@
+foreign import ccall safe "hs_bindgen_0855ecbc4b53ebbb" hs_bindgen_0855ecbc4b53ebbb_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_safe@
+hs_bindgen_0855ecbc4b53ebbb :: IO ()
+hs_bindgen_0855ecbc4b53ebbb =
+  hs_bindgen_0855ecbc4b53ebbb_base
+
+{-| __C declaration:__ @safe@
+
+    __defined at:__ @edge-cases\/names.h 25:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+safe :: IO ()
+safe = hs_bindgen_0855ecbc4b53ebbb
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_stdcall@
+foreign import ccall safe "hs_bindgen_e5238d13788a6df9" hs_bindgen_e5238d13788a6df9_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_stdcall@
+hs_bindgen_e5238d13788a6df9 :: IO ()
+hs_bindgen_e5238d13788a6df9 =
+  hs_bindgen_e5238d13788a6df9_base
+
+{-| __C declaration:__ @stdcall@
+
+    __defined at:__ @edge-cases\/names.h 26:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stdcall :: IO ()
+stdcall = hs_bindgen_e5238d13788a6df9
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_stock@
+foreign import ccall safe "hs_bindgen_cf38d8bd096a7a42" hs_bindgen_cf38d8bd096a7a42_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_stock@
+hs_bindgen_cf38d8bd096a7a42 :: IO ()
+hs_bindgen_cf38d8bd096a7a42 =
+  hs_bindgen_cf38d8bd096a7a42_base
+
+{-| __C declaration:__ @stock@
+
+    __defined at:__ @edge-cases\/names.h 27:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stock :: IO ()
+stock = hs_bindgen_cf38d8bd096a7a42
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_unsafe@
+foreign import ccall safe "hs_bindgen_fda9b083b24404f0" hs_bindgen_fda9b083b24404f0_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_unsafe@
+hs_bindgen_fda9b083b24404f0 :: IO ()
+hs_bindgen_fda9b083b24404f0 =
+  hs_bindgen_fda9b083b24404f0_base
+
+{-| __C declaration:__ @unsafe@
+
+    __defined at:__ @edge-cases\/names.h 28:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+unsafe :: IO ()
+unsafe = hs_bindgen_fda9b083b24404f0
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_via@
+foreign import ccall safe "hs_bindgen_1d2a76a3a595be25" hs_bindgen_1d2a76a3a595be25_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Safe_via@
+hs_bindgen_1d2a76a3a595be25 :: IO ()
+hs_bindgen_1d2a76a3a595be25 =
+  hs_bindgen_1d2a76a3a595be25_base
+
+{-| __C declaration:__ @via@
+
+    __defined at:__ @edge-cases\/names.h 29:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+via :: IO ()
+via = hs_bindgen_1d2a76a3a595be25
diff --git a/test-artefacts/fixtures/edge-cases/names/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/names/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/names/Example/Unsafe.hs
@@ -0,0 +1,590 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.by'
+    , Example.Unsafe.forall'
+    , Example.Unsafe.mdo'
+    , Example.Unsafe.pattern'
+    , Example.Unsafe.proc'
+    , Example.Unsafe.rec'
+    , Example.Unsafe.using'
+    , Example.Unsafe.anyclass
+    , Example.Unsafe.capi
+    , Example.Unsafe.cases
+    , Example.Unsafe.ccall
+    , Example.Unsafe.dynamic
+    , Example.Unsafe.export
+    , Example.Unsafe.family
+    , Example.Unsafe.group
+    , Example.Unsafe.interruptible
+    , Example.Unsafe.javascript
+    , Example.Unsafe.label
+    , Example.Unsafe.prim
+    , Example.Unsafe.role
+    , Example.Unsafe.safe
+    , Example.Unsafe.stdcall
+    , Example.Unsafe.stock
+    , Example.Unsafe.unsafe
+    , Example.Unsafe.via
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/names.h>"
+  , "void hs_bindgen_28b998af1f39a743 (void)"
+  , "{"
+  , "  (by)();"
+  , "}"
+  , "void hs_bindgen_5d7ea7c4d11a5fc8 (void)"
+  , "{"
+  , "  (forall)();"
+  , "}"
+  , "void hs_bindgen_2d65448c684c09d5 (void)"
+  , "{"
+  , "  (mdo)();"
+  , "}"
+  , "void hs_bindgen_13fe653d670d3712 (void)"
+  , "{"
+  , "  (pattern)();"
+  , "}"
+  , "void hs_bindgen_e9cc2037d33041aa (void)"
+  , "{"
+  , "  (proc)();"
+  , "}"
+  , "void hs_bindgen_4a1e741f9ef596ff (void)"
+  , "{"
+  , "  (rec)();"
+  , "}"
+  , "void hs_bindgen_ef6f3f22c615db58 (void)"
+  , "{"
+  , "  (using)();"
+  , "}"
+  , "void hs_bindgen_3c7afeaaf3ff040b (void)"
+  , "{"
+  , "  (anyclass)();"
+  , "}"
+  , "void hs_bindgen_0518740d4c3caa1d (void)"
+  , "{"
+  , "  (capi)();"
+  , "}"
+  , "void hs_bindgen_61f14ad7bb2e3d54 (void)"
+  , "{"
+  , "  (cases)();"
+  , "}"
+  , "void hs_bindgen_ace8c96ed6673c3b (void)"
+  , "{"
+  , "  (ccall)();"
+  , "}"
+  , "void hs_bindgen_8865833b99552d03 (void)"
+  , "{"
+  , "  (dynamic)();"
+  , "}"
+  , "void hs_bindgen_15729ba251f5ec57 (void)"
+  , "{"
+  , "  (export)();"
+  , "}"
+  , "void hs_bindgen_e6a4f7e833da2687 (void)"
+  , "{"
+  , "  (family)();"
+  , "}"
+  , "void hs_bindgen_d4dd1bb5e95de858 (void)"
+  , "{"
+  , "  (group)();"
+  , "}"
+  , "void hs_bindgen_516f1ad5aba6de29 (void)"
+  , "{"
+  , "  (interruptible)();"
+  , "}"
+  , "void hs_bindgen_214230db174dc3e6 (void)"
+  , "{"
+  , "  (javascript)();"
+  , "}"
+  , "void hs_bindgen_88f1f0cf9c0f080e (void)"
+  , "{"
+  , "  (label)();"
+  , "}"
+  , "void hs_bindgen_93a4c73f587dcf3c (void)"
+  , "{"
+  , "  (prim)();"
+  , "}"
+  , "void hs_bindgen_a267fe5585862ecc (void)"
+  , "{"
+  , "  (role)();"
+  , "}"
+  , "void hs_bindgen_ddac4cdf91c756a8 (void)"
+  , "{"
+  , "  (safe)();"
+  , "}"
+  , "void hs_bindgen_8dd57b02f322a7ae (void)"
+  , "{"
+  , "  (stdcall)();"
+  , "}"
+  , "void hs_bindgen_3b69e1860d72507c (void)"
+  , "{"
+  , "  (stock)();"
+  , "}"
+  , "void hs_bindgen_b9d80fa39d7ebb06 (void)"
+  , "{"
+  , "  (unsafe)();"
+  , "}"
+  , "void hs_bindgen_708f6397f5e5ac73 (void)"
+  , "{"
+  , "  (via)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_by@
+foreign import ccall unsafe "hs_bindgen_28b998af1f39a743" hs_bindgen_28b998af1f39a743_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_by@
+hs_bindgen_28b998af1f39a743 :: IO ()
+hs_bindgen_28b998af1f39a743 =
+  hs_bindgen_28b998af1f39a743_base
+
+{-| __C declaration:__ @by@
+
+    __defined at:__ @edge-cases\/names.h 3:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+by' :: IO ()
+by' = hs_bindgen_28b998af1f39a743
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_forall@
+foreign import ccall unsafe "hs_bindgen_5d7ea7c4d11a5fc8" hs_bindgen_5d7ea7c4d11a5fc8_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_forall@
+hs_bindgen_5d7ea7c4d11a5fc8 :: IO ()
+hs_bindgen_5d7ea7c4d11a5fc8 =
+  hs_bindgen_5d7ea7c4d11a5fc8_base
+
+{-| __C declaration:__ @forall@
+
+    __defined at:__ @edge-cases\/names.h 4:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+forall' :: IO ()
+forall' = hs_bindgen_5d7ea7c4d11a5fc8
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_mdo@
+foreign import ccall unsafe "hs_bindgen_2d65448c684c09d5" hs_bindgen_2d65448c684c09d5_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_mdo@
+hs_bindgen_2d65448c684c09d5 :: IO ()
+hs_bindgen_2d65448c684c09d5 =
+  hs_bindgen_2d65448c684c09d5_base
+
+{-| __C declaration:__ @mdo@
+
+    __defined at:__ @edge-cases\/names.h 5:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+mdo' :: IO ()
+mdo' = hs_bindgen_2d65448c684c09d5
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_pattern@
+foreign import ccall unsafe "hs_bindgen_13fe653d670d3712" hs_bindgen_13fe653d670d3712_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_pattern@
+hs_bindgen_13fe653d670d3712 :: IO ()
+hs_bindgen_13fe653d670d3712 =
+  hs_bindgen_13fe653d670d3712_base
+
+{-| __C declaration:__ @pattern@
+
+    __defined at:__ @edge-cases\/names.h 6:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+pattern' :: IO ()
+pattern' = hs_bindgen_13fe653d670d3712
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_proc@
+foreign import ccall unsafe "hs_bindgen_e9cc2037d33041aa" hs_bindgen_e9cc2037d33041aa_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_proc@
+hs_bindgen_e9cc2037d33041aa :: IO ()
+hs_bindgen_e9cc2037d33041aa =
+  hs_bindgen_e9cc2037d33041aa_base
+
+{-| __C declaration:__ @proc@
+
+    __defined at:__ @edge-cases\/names.h 7:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+proc' :: IO ()
+proc' = hs_bindgen_e9cc2037d33041aa
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_rec@
+foreign import ccall unsafe "hs_bindgen_4a1e741f9ef596ff" hs_bindgen_4a1e741f9ef596ff_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_rec@
+hs_bindgen_4a1e741f9ef596ff :: IO ()
+hs_bindgen_4a1e741f9ef596ff =
+  hs_bindgen_4a1e741f9ef596ff_base
+
+{-| __C declaration:__ @rec@
+
+    __defined at:__ @edge-cases\/names.h 8:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+rec' :: IO ()
+rec' = hs_bindgen_4a1e741f9ef596ff
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_using@
+foreign import ccall unsafe "hs_bindgen_ef6f3f22c615db58" hs_bindgen_ef6f3f22c615db58_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_using@
+hs_bindgen_ef6f3f22c615db58 :: IO ()
+hs_bindgen_ef6f3f22c615db58 =
+  hs_bindgen_ef6f3f22c615db58_base
+
+{-| __C declaration:__ @using@
+
+    __defined at:__ @edge-cases\/names.h 9:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+using' :: IO ()
+using' = hs_bindgen_ef6f3f22c615db58
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_anyclass@
+foreign import ccall unsafe "hs_bindgen_3c7afeaaf3ff040b" hs_bindgen_3c7afeaaf3ff040b_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_anyclass@
+hs_bindgen_3c7afeaaf3ff040b :: IO ()
+hs_bindgen_3c7afeaaf3ff040b =
+  hs_bindgen_3c7afeaaf3ff040b_base
+
+{-| __C declaration:__ @anyclass@
+
+    __defined at:__ @edge-cases\/names.h 12:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+anyclass :: IO ()
+anyclass = hs_bindgen_3c7afeaaf3ff040b
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_capi@
+foreign import ccall unsafe "hs_bindgen_0518740d4c3caa1d" hs_bindgen_0518740d4c3caa1d_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_capi@
+hs_bindgen_0518740d4c3caa1d :: IO ()
+hs_bindgen_0518740d4c3caa1d =
+  hs_bindgen_0518740d4c3caa1d_base
+
+{-| __C declaration:__ @capi@
+
+    __defined at:__ @edge-cases\/names.h 13:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+capi :: IO ()
+capi = hs_bindgen_0518740d4c3caa1d
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_cases@
+foreign import ccall unsafe "hs_bindgen_61f14ad7bb2e3d54" hs_bindgen_61f14ad7bb2e3d54_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_cases@
+hs_bindgen_61f14ad7bb2e3d54 :: IO ()
+hs_bindgen_61f14ad7bb2e3d54 =
+  hs_bindgen_61f14ad7bb2e3d54_base
+
+{-| __C declaration:__ @cases@
+
+    __defined at:__ @edge-cases\/names.h 14:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+cases :: IO ()
+cases = hs_bindgen_61f14ad7bb2e3d54
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_ccall@
+foreign import ccall unsafe "hs_bindgen_ace8c96ed6673c3b" hs_bindgen_ace8c96ed6673c3b_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_ccall@
+hs_bindgen_ace8c96ed6673c3b :: IO ()
+hs_bindgen_ace8c96ed6673c3b =
+  hs_bindgen_ace8c96ed6673c3b_base
+
+{-| __C declaration:__ @ccall@
+
+    __defined at:__ @edge-cases\/names.h 15:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+ccall :: IO ()
+ccall = hs_bindgen_ace8c96ed6673c3b
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_dynamic@
+foreign import ccall unsafe "hs_bindgen_8865833b99552d03" hs_bindgen_8865833b99552d03_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_dynamic@
+hs_bindgen_8865833b99552d03 :: IO ()
+hs_bindgen_8865833b99552d03 =
+  hs_bindgen_8865833b99552d03_base
+
+{-| __C declaration:__ @dynamic@
+
+    __defined at:__ @edge-cases\/names.h 16:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+dynamic :: IO ()
+dynamic = hs_bindgen_8865833b99552d03
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_export@
+foreign import ccall unsafe "hs_bindgen_15729ba251f5ec57" hs_bindgen_15729ba251f5ec57_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_export@
+hs_bindgen_15729ba251f5ec57 :: IO ()
+hs_bindgen_15729ba251f5ec57 =
+  hs_bindgen_15729ba251f5ec57_base
+
+{-| __C declaration:__ @export@
+
+    __defined at:__ @edge-cases\/names.h 17:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+export :: IO ()
+export = hs_bindgen_15729ba251f5ec57
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_family@
+foreign import ccall unsafe "hs_bindgen_e6a4f7e833da2687" hs_bindgen_e6a4f7e833da2687_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_family@
+hs_bindgen_e6a4f7e833da2687 :: IO ()
+hs_bindgen_e6a4f7e833da2687 =
+  hs_bindgen_e6a4f7e833da2687_base
+
+{-| __C declaration:__ @family@
+
+    __defined at:__ @edge-cases\/names.h 18:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+family :: IO ()
+family = hs_bindgen_e6a4f7e833da2687
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_group@
+foreign import ccall unsafe "hs_bindgen_d4dd1bb5e95de858" hs_bindgen_d4dd1bb5e95de858_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_group@
+hs_bindgen_d4dd1bb5e95de858 :: IO ()
+hs_bindgen_d4dd1bb5e95de858 =
+  hs_bindgen_d4dd1bb5e95de858_base
+
+{-| __C declaration:__ @group@
+
+    __defined at:__ @edge-cases\/names.h 19:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+group :: IO ()
+group = hs_bindgen_d4dd1bb5e95de858
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_interruptible@
+foreign import ccall unsafe "hs_bindgen_516f1ad5aba6de29" hs_bindgen_516f1ad5aba6de29_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_interruptible@
+hs_bindgen_516f1ad5aba6de29 :: IO ()
+hs_bindgen_516f1ad5aba6de29 =
+  hs_bindgen_516f1ad5aba6de29_base
+
+{-| __C declaration:__ @interruptible@
+
+    __defined at:__ @edge-cases\/names.h 20:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+interruptible :: IO ()
+interruptible = hs_bindgen_516f1ad5aba6de29
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_javascript@
+foreign import ccall unsafe "hs_bindgen_214230db174dc3e6" hs_bindgen_214230db174dc3e6_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_javascript@
+hs_bindgen_214230db174dc3e6 :: IO ()
+hs_bindgen_214230db174dc3e6 =
+  hs_bindgen_214230db174dc3e6_base
+
+{-| __C declaration:__ @javascript@
+
+    __defined at:__ @edge-cases\/names.h 21:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+javascript :: IO ()
+javascript = hs_bindgen_214230db174dc3e6
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_label@
+foreign import ccall unsafe "hs_bindgen_88f1f0cf9c0f080e" hs_bindgen_88f1f0cf9c0f080e_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_label@
+hs_bindgen_88f1f0cf9c0f080e :: IO ()
+hs_bindgen_88f1f0cf9c0f080e =
+  hs_bindgen_88f1f0cf9c0f080e_base
+
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/names.h 22:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+label :: IO ()
+label = hs_bindgen_88f1f0cf9c0f080e
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_prim@
+foreign import ccall unsafe "hs_bindgen_93a4c73f587dcf3c" hs_bindgen_93a4c73f587dcf3c_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_prim@
+hs_bindgen_93a4c73f587dcf3c :: IO ()
+hs_bindgen_93a4c73f587dcf3c =
+  hs_bindgen_93a4c73f587dcf3c_base
+
+{-| __C declaration:__ @prim@
+
+    __defined at:__ @edge-cases\/names.h 23:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+prim :: IO ()
+prim = hs_bindgen_93a4c73f587dcf3c
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_role@
+foreign import ccall unsafe "hs_bindgen_a267fe5585862ecc" hs_bindgen_a267fe5585862ecc_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_role@
+hs_bindgen_a267fe5585862ecc :: IO ()
+hs_bindgen_a267fe5585862ecc =
+  hs_bindgen_a267fe5585862ecc_base
+
+{-| __C declaration:__ @role@
+
+    __defined at:__ @edge-cases\/names.h 24:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+role :: IO ()
+role = hs_bindgen_a267fe5585862ecc
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_safe@
+foreign import ccall unsafe "hs_bindgen_ddac4cdf91c756a8" hs_bindgen_ddac4cdf91c756a8_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_safe@
+hs_bindgen_ddac4cdf91c756a8 :: IO ()
+hs_bindgen_ddac4cdf91c756a8 =
+  hs_bindgen_ddac4cdf91c756a8_base
+
+{-| __C declaration:__ @safe@
+
+    __defined at:__ @edge-cases\/names.h 25:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+safe :: IO ()
+safe = hs_bindgen_ddac4cdf91c756a8
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stdcall@
+foreign import ccall unsafe "hs_bindgen_8dd57b02f322a7ae" hs_bindgen_8dd57b02f322a7ae_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stdcall@
+hs_bindgen_8dd57b02f322a7ae :: IO ()
+hs_bindgen_8dd57b02f322a7ae =
+  hs_bindgen_8dd57b02f322a7ae_base
+
+{-| __C declaration:__ @stdcall@
+
+    __defined at:__ @edge-cases\/names.h 26:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stdcall :: IO ()
+stdcall = hs_bindgen_8dd57b02f322a7ae
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stock@
+foreign import ccall unsafe "hs_bindgen_3b69e1860d72507c" hs_bindgen_3b69e1860d72507c_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stock@
+hs_bindgen_3b69e1860d72507c :: IO ()
+hs_bindgen_3b69e1860d72507c =
+  hs_bindgen_3b69e1860d72507c_base
+
+{-| __C declaration:__ @stock@
+
+    __defined at:__ @edge-cases\/names.h 27:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stock :: IO ()
+stock = hs_bindgen_3b69e1860d72507c
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_unsafe@
+foreign import ccall unsafe "hs_bindgen_b9d80fa39d7ebb06" hs_bindgen_b9d80fa39d7ebb06_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_unsafe@
+hs_bindgen_b9d80fa39d7ebb06 :: IO ()
+hs_bindgen_b9d80fa39d7ebb06 =
+  hs_bindgen_b9d80fa39d7ebb06_base
+
+{-| __C declaration:__ @unsafe@
+
+    __defined at:__ @edge-cases\/names.h 28:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+unsafe :: IO ()
+unsafe = hs_bindgen_b9d80fa39d7ebb06
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_via@
+foreign import ccall unsafe "hs_bindgen_708f6397f5e5ac73" hs_bindgen_708f6397f5e5ac73_base ::
+     IO ()
+
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_via@
+hs_bindgen_708f6397f5e5ac73 :: IO ()
+hs_bindgen_708f6397f5e5ac73 =
+  hs_bindgen_708f6397f5e5ac73_base
+
+{-| __C declaration:__ @via@
+
+    __defined at:__ @edge-cases\/names.h 29:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+via :: IO ()
+via = hs_bindgen_708f6397f5e5ac73
diff --git a/test-artefacts/fixtures/edge-cases/names/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/names/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/names/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/edge-cases/names/th.txt b/test-artefacts/fixtures/edge-cases/names/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/names/th.txt
@@ -0,0 +1,1952 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/names.h
+-- #include <edge-cases/names.h>
+-- void hs_bindgen_601290db9e101424 (void)
+-- {
+--   (by)();
+-- }
+-- void hs_bindgen_f03dbed5eebb711a (void)
+-- {
+--   (forall)();
+-- }
+-- void hs_bindgen_d1e3196c869f9fa1 (void)
+-- {
+--   (mdo)();
+-- }
+-- void hs_bindgen_d3dcd898c88fb2e0 (void)
+-- {
+--   (pattern)();
+-- }
+-- void hs_bindgen_7f08456473f564e3 (void)
+-- {
+--   (proc)();
+-- }
+-- void hs_bindgen_5df814c22f546599 (void)
+-- {
+--   (rec)();
+-- }
+-- void hs_bindgen_3877b6deb653b5a4 (void)
+-- {
+--   (using)();
+-- }
+-- void hs_bindgen_7b8790d04357731b (void)
+-- {
+--   (anyclass)();
+-- }
+-- void hs_bindgen_0bf4ab515f3279b9 (void)
+-- {
+--   (capi)();
+-- }
+-- void hs_bindgen_fa8166b2793e4236 (void)
+-- {
+--   (cases)();
+-- }
+-- void hs_bindgen_decc2d43a62d063d (void)
+-- {
+--   (ccall)();
+-- }
+-- void hs_bindgen_b5a75e2b6434134b (void)
+-- {
+--   (dynamic)();
+-- }
+-- void hs_bindgen_406f7b014573b3d3 (void)
+-- {
+--   (export)();
+-- }
+-- void hs_bindgen_14aab2af04efc222 (void)
+-- {
+--   (family)();
+-- }
+-- void hs_bindgen_ee9285b26b11b393 (void)
+-- {
+--   (group)();
+-- }
+-- void hs_bindgen_b2463d5c1d51883e (void)
+-- {
+--   (interruptible)();
+-- }
+-- void hs_bindgen_55a55462d9cd296c (void)
+-- {
+--   (javascript)();
+-- }
+-- void hs_bindgen_227f34efb176d1fb (void)
+-- {
+--   (label)();
+-- }
+-- void hs_bindgen_51c6e0d18dce403a (void)
+-- {
+--   (prim)();
+-- }
+-- void hs_bindgen_f85f2418d208e6a0 (void)
+-- {
+--   (role)();
+-- }
+-- void hs_bindgen_0855ecbc4b53ebbb (void)
+-- {
+--   (safe)();
+-- }
+-- void hs_bindgen_e5238d13788a6df9 (void)
+-- {
+--   (stdcall)();
+-- }
+-- void hs_bindgen_cf38d8bd096a7a42 (void)
+-- {
+--   (stock)();
+-- }
+-- void hs_bindgen_fda9b083b24404f0 (void)
+-- {
+--   (unsafe)();
+-- }
+-- void hs_bindgen_1d2a76a3a595be25 (void)
+-- {
+--   (via)();
+-- }
+-- void hs_bindgen_28b998af1f39a743 (void)
+-- {
+--   (by)();
+-- }
+-- void hs_bindgen_5d7ea7c4d11a5fc8 (void)
+-- {
+--   (forall)();
+-- }
+-- void hs_bindgen_2d65448c684c09d5 (void)
+-- {
+--   (mdo)();
+-- }
+-- void hs_bindgen_13fe653d670d3712 (void)
+-- {
+--   (pattern)();
+-- }
+-- void hs_bindgen_e9cc2037d33041aa (void)
+-- {
+--   (proc)();
+-- }
+-- void hs_bindgen_4a1e741f9ef596ff (void)
+-- {
+--   (rec)();
+-- }
+-- void hs_bindgen_ef6f3f22c615db58 (void)
+-- {
+--   (using)();
+-- }
+-- void hs_bindgen_3c7afeaaf3ff040b (void)
+-- {
+--   (anyclass)();
+-- }
+-- void hs_bindgen_0518740d4c3caa1d (void)
+-- {
+--   (capi)();
+-- }
+-- void hs_bindgen_61f14ad7bb2e3d54 (void)
+-- {
+--   (cases)();
+-- }
+-- void hs_bindgen_ace8c96ed6673c3b (void)
+-- {
+--   (ccall)();
+-- }
+-- void hs_bindgen_8865833b99552d03 (void)
+-- {
+--   (dynamic)();
+-- }
+-- void hs_bindgen_15729ba251f5ec57 (void)
+-- {
+--   (export)();
+-- }
+-- void hs_bindgen_e6a4f7e833da2687 (void)
+-- {
+--   (family)();
+-- }
+-- void hs_bindgen_d4dd1bb5e95de858 (void)
+-- {
+--   (group)();
+-- }
+-- void hs_bindgen_516f1ad5aba6de29 (void)
+-- {
+--   (interruptible)();
+-- }
+-- void hs_bindgen_214230db174dc3e6 (void)
+-- {
+--   (javascript)();
+-- }
+-- void hs_bindgen_88f1f0cf9c0f080e (void)
+-- {
+--   (label)();
+-- }
+-- void hs_bindgen_93a4c73f587dcf3c (void)
+-- {
+--   (prim)();
+-- }
+-- void hs_bindgen_a267fe5585862ecc (void)
+-- {
+--   (role)();
+-- }
+-- void hs_bindgen_ddac4cdf91c756a8 (void)
+-- {
+--   (safe)();
+-- }
+-- void hs_bindgen_8dd57b02f322a7ae (void)
+-- {
+--   (stdcall)();
+-- }
+-- void hs_bindgen_3b69e1860d72507c (void)
+-- {
+--   (stock)();
+-- }
+-- void hs_bindgen_b9d80fa39d7ebb06 (void)
+-- {
+--   (unsafe)();
+-- }
+-- void hs_bindgen_708f6397f5e5ac73 (void)
+-- {
+--   (via)();
+-- }
+-- /* test_edgecasesnames_Example_get_by */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d50b20f504174dd5 (void)) (void)
+-- {
+--   return &by;
+-- }
+-- /* test_edgecasesnames_Example_get_forall */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f7e660ea9223a909 (void)) (void)
+-- {
+--   return &forall;
+-- }
+-- /* test_edgecasesnames_Example_get_mdo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_15319d1b8d2ca927 (void)) (void)
+-- {
+--   return &mdo;
+-- }
+-- /* test_edgecasesnames_Example_get_pattern */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e5a1961c11d641ed (void)) (void)
+-- {
+--   return &pattern;
+-- }
+-- /* test_edgecasesnames_Example_get_proc */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d2dd74adbb4a606c (void)) (void)
+-- {
+--   return &proc;
+-- }
+-- /* test_edgecasesnames_Example_get_rec */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_bab6d9c9540c9d58 (void)) (void)
+-- {
+--   return &rec;
+-- }
+-- /* test_edgecasesnames_Example_get_using */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_447fa7223c86f5c7 (void)) (void)
+-- {
+--   return &using;
+-- }
+-- /* test_edgecasesnames_Example_get_anyclass */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f2292c17facdbcde (void)) (void)
+-- {
+--   return &anyclass;
+-- }
+-- /* test_edgecasesnames_Example_get_capi */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_393b62c1a821de61 (void)) (void)
+-- {
+--   return &capi;
+-- }
+-- /* test_edgecasesnames_Example_get_cases */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_962b5bf9813ea6dd (void)) (void)
+-- {
+--   return &cases;
+-- }
+-- /* test_edgecasesnames_Example_get_ccall */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_599948844183b4ea (void)) (void)
+-- {
+--   return &ccall;
+-- }
+-- /* test_edgecasesnames_Example_get_dynamic */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_aa442ea764d9d93c (void)) (void)
+-- {
+--   return &dynamic;
+-- }
+-- /* test_edgecasesnames_Example_get_export */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_98dfb21e9f7b6857 (void)) (void)
+-- {
+--   return &export;
+-- }
+-- /* test_edgecasesnames_Example_get_family */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b96b9fd3fa689c75 (void)) (void)
+-- {
+--   return &family;
+-- }
+-- /* test_edgecasesnames_Example_get_group */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a4413aed06e03d16 (void)) (void)
+-- {
+--   return &group;
+-- }
+-- /* test_edgecasesnames_Example_get_interruptible */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_52223789a2752bbe (void)) (void)
+-- {
+--   return &interruptible;
+-- }
+-- /* test_edgecasesnames_Example_get_javascript */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3d349ab20e55d3d5 (void)) (void)
+-- {
+--   return &javascript;
+-- }
+-- /* test_edgecasesnames_Example_get_label */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7ab78b24e63738f5 (void)) (void)
+-- {
+--   return &label;
+-- }
+-- /* test_edgecasesnames_Example_get_prim */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_13caa66b81eebdfb (void)) (void)
+-- {
+--   return &prim;
+-- }
+-- /* test_edgecasesnames_Example_get_role */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_99189a38ba22fdad (void)) (void)
+-- {
+--   return &role;
+-- }
+-- /* test_edgecasesnames_Example_get_safe */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fe3819b9444e41b6 (void)) (void)
+-- {
+--   return &safe;
+-- }
+-- /* test_edgecasesnames_Example_get_stdcall */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7d4e52bd26694f13 (void)) (void)
+-- {
+--   return &stdcall;
+-- }
+-- /* test_edgecasesnames_Example_get_stock */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_be2fd8368b1f85bc (void)) (void)
+-- {
+--   return &stock;
+-- }
+-- /* test_edgecasesnames_Example_get_unsafe */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d0faf7702a235ae1 (void)) (void)
+-- {
+--   return &unsafe;
+-- }
+-- /* test_edgecasesnames_Example_get_via */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_56fc690ff4bc7c4e (void)) (void)
+-- {
+--   return &via;
+-- }
+-- __unique:__ @test_edgecasesnames_Example_Safe_by@
+foreign import ccall safe "hs_bindgen_601290db9e101424" hs_bindgen_601290db9e101424_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_by@
+hs_bindgen_601290db9e101424 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_by@
+hs_bindgen_601290db9e101424 = hs_bindgen_601290db9e101424_base
+{-| __C declaration:__ @by@
+
+    __defined at:__ @edge-cases\/names.h 3:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+by'_safe :: IO ()
+{-| __C declaration:__ @by@
+
+    __defined at:__ @edge-cases\/names.h 3:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+by'_safe = hs_bindgen_601290db9e101424
+-- __unique:__ @test_edgecasesnames_Example_Safe_forall@
+foreign import ccall safe "hs_bindgen_f03dbed5eebb711a" hs_bindgen_f03dbed5eebb711a_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_forall@
+hs_bindgen_f03dbed5eebb711a :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_forall@
+hs_bindgen_f03dbed5eebb711a = hs_bindgen_f03dbed5eebb711a_base
+{-| __C declaration:__ @forall@
+
+    __defined at:__ @edge-cases\/names.h 4:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+forall'_safe :: IO ()
+{-| __C declaration:__ @forall@
+
+    __defined at:__ @edge-cases\/names.h 4:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+forall'_safe = hs_bindgen_f03dbed5eebb711a
+-- __unique:__ @test_edgecasesnames_Example_Safe_mdo@
+foreign import ccall safe "hs_bindgen_d1e3196c869f9fa1" hs_bindgen_d1e3196c869f9fa1_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_mdo@
+hs_bindgen_d1e3196c869f9fa1 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_mdo@
+hs_bindgen_d1e3196c869f9fa1 = hs_bindgen_d1e3196c869f9fa1_base
+{-| __C declaration:__ @mdo@
+
+    __defined at:__ @edge-cases\/names.h 5:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+mdo'_safe :: IO ()
+{-| __C declaration:__ @mdo@
+
+    __defined at:__ @edge-cases\/names.h 5:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+mdo'_safe = hs_bindgen_d1e3196c869f9fa1
+-- __unique:__ @test_edgecasesnames_Example_Safe_pattern@
+foreign import ccall safe "hs_bindgen_d3dcd898c88fb2e0" hs_bindgen_d3dcd898c88fb2e0_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_pattern@
+hs_bindgen_d3dcd898c88fb2e0 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_pattern@
+hs_bindgen_d3dcd898c88fb2e0 = hs_bindgen_d3dcd898c88fb2e0_base
+{-| __C declaration:__ @pattern@
+
+    __defined at:__ @edge-cases\/names.h 6:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+pattern'_safe :: IO ()
+{-| __C declaration:__ @pattern@
+
+    __defined at:__ @edge-cases\/names.h 6:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+pattern'_safe = hs_bindgen_d3dcd898c88fb2e0
+-- __unique:__ @test_edgecasesnames_Example_Safe_proc@
+foreign import ccall safe "hs_bindgen_7f08456473f564e3" hs_bindgen_7f08456473f564e3_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_proc@
+hs_bindgen_7f08456473f564e3 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_proc@
+hs_bindgen_7f08456473f564e3 = hs_bindgen_7f08456473f564e3_base
+{-| __C declaration:__ @proc@
+
+    __defined at:__ @edge-cases\/names.h 7:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+proc'_safe :: IO ()
+{-| __C declaration:__ @proc@
+
+    __defined at:__ @edge-cases\/names.h 7:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+proc'_safe = hs_bindgen_7f08456473f564e3
+-- __unique:__ @test_edgecasesnames_Example_Safe_rec@
+foreign import ccall safe "hs_bindgen_5df814c22f546599" hs_bindgen_5df814c22f546599_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_rec@
+hs_bindgen_5df814c22f546599 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_rec@
+hs_bindgen_5df814c22f546599 = hs_bindgen_5df814c22f546599_base
+{-| __C declaration:__ @rec@
+
+    __defined at:__ @edge-cases\/names.h 8:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+rec'_safe :: IO ()
+{-| __C declaration:__ @rec@
+
+    __defined at:__ @edge-cases\/names.h 8:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+rec'_safe = hs_bindgen_5df814c22f546599
+-- __unique:__ @test_edgecasesnames_Example_Safe_using@
+foreign import ccall safe "hs_bindgen_3877b6deb653b5a4" hs_bindgen_3877b6deb653b5a4_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_using@
+hs_bindgen_3877b6deb653b5a4 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_using@
+hs_bindgen_3877b6deb653b5a4 = hs_bindgen_3877b6deb653b5a4_base
+{-| __C declaration:__ @using@
+
+    __defined at:__ @edge-cases\/names.h 9:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+using'_safe :: IO ()
+{-| __C declaration:__ @using@
+
+    __defined at:__ @edge-cases\/names.h 9:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+using'_safe = hs_bindgen_3877b6deb653b5a4
+-- __unique:__ @test_edgecasesnames_Example_Safe_anyclass@
+foreign import ccall safe "hs_bindgen_7b8790d04357731b" hs_bindgen_7b8790d04357731b_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_anyclass@
+hs_bindgen_7b8790d04357731b :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_anyclass@
+hs_bindgen_7b8790d04357731b = hs_bindgen_7b8790d04357731b_base
+{-| __C declaration:__ @anyclass@
+
+    __defined at:__ @edge-cases\/names.h 12:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+anyclass_safe :: IO ()
+{-| __C declaration:__ @anyclass@
+
+    __defined at:__ @edge-cases\/names.h 12:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+anyclass_safe = hs_bindgen_7b8790d04357731b
+-- __unique:__ @test_edgecasesnames_Example_Safe_capi@
+foreign import ccall safe "hs_bindgen_0bf4ab515f3279b9" hs_bindgen_0bf4ab515f3279b9_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_capi@
+hs_bindgen_0bf4ab515f3279b9 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_capi@
+hs_bindgen_0bf4ab515f3279b9 = hs_bindgen_0bf4ab515f3279b9_base
+{-| __C declaration:__ @capi@
+
+    __defined at:__ @edge-cases\/names.h 13:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+capi_safe :: IO ()
+{-| __C declaration:__ @capi@
+
+    __defined at:__ @edge-cases\/names.h 13:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+capi_safe = hs_bindgen_0bf4ab515f3279b9
+-- __unique:__ @test_edgecasesnames_Example_Safe_cases@
+foreign import ccall safe "hs_bindgen_fa8166b2793e4236" hs_bindgen_fa8166b2793e4236_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_cases@
+hs_bindgen_fa8166b2793e4236 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_cases@
+hs_bindgen_fa8166b2793e4236 = hs_bindgen_fa8166b2793e4236_base
+{-| __C declaration:__ @cases@
+
+    __defined at:__ @edge-cases\/names.h 14:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+cases_safe :: IO ()
+{-| __C declaration:__ @cases@
+
+    __defined at:__ @edge-cases\/names.h 14:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+cases_safe = hs_bindgen_fa8166b2793e4236
+-- __unique:__ @test_edgecasesnames_Example_Safe_ccall@
+foreign import ccall safe "hs_bindgen_decc2d43a62d063d" hs_bindgen_decc2d43a62d063d_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_ccall@
+hs_bindgen_decc2d43a62d063d :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_ccall@
+hs_bindgen_decc2d43a62d063d = hs_bindgen_decc2d43a62d063d_base
+{-| __C declaration:__ @ccall@
+
+    __defined at:__ @edge-cases\/names.h 15:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+ccall_safe :: IO ()
+{-| __C declaration:__ @ccall@
+
+    __defined at:__ @edge-cases\/names.h 15:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+ccall_safe = hs_bindgen_decc2d43a62d063d
+-- __unique:__ @test_edgecasesnames_Example_Safe_dynamic@
+foreign import ccall safe "hs_bindgen_b5a75e2b6434134b" hs_bindgen_b5a75e2b6434134b_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_dynamic@
+hs_bindgen_b5a75e2b6434134b :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_dynamic@
+hs_bindgen_b5a75e2b6434134b = hs_bindgen_b5a75e2b6434134b_base
+{-| __C declaration:__ @dynamic@
+
+    __defined at:__ @edge-cases\/names.h 16:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+dynamic_safe :: IO ()
+{-| __C declaration:__ @dynamic@
+
+    __defined at:__ @edge-cases\/names.h 16:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+dynamic_safe = hs_bindgen_b5a75e2b6434134b
+-- __unique:__ @test_edgecasesnames_Example_Safe_export@
+foreign import ccall safe "hs_bindgen_406f7b014573b3d3" hs_bindgen_406f7b014573b3d3_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_export@
+hs_bindgen_406f7b014573b3d3 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_export@
+hs_bindgen_406f7b014573b3d3 = hs_bindgen_406f7b014573b3d3_base
+{-| __C declaration:__ @export@
+
+    __defined at:__ @edge-cases\/names.h 17:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+export_safe :: IO ()
+{-| __C declaration:__ @export@
+
+    __defined at:__ @edge-cases\/names.h 17:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+export_safe = hs_bindgen_406f7b014573b3d3
+-- __unique:__ @test_edgecasesnames_Example_Safe_family@
+foreign import ccall safe "hs_bindgen_14aab2af04efc222" hs_bindgen_14aab2af04efc222_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_family@
+hs_bindgen_14aab2af04efc222 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_family@
+hs_bindgen_14aab2af04efc222 = hs_bindgen_14aab2af04efc222_base
+{-| __C declaration:__ @family@
+
+    __defined at:__ @edge-cases\/names.h 18:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+family_safe :: IO ()
+{-| __C declaration:__ @family@
+
+    __defined at:__ @edge-cases\/names.h 18:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+family_safe = hs_bindgen_14aab2af04efc222
+-- __unique:__ @test_edgecasesnames_Example_Safe_group@
+foreign import ccall safe "hs_bindgen_ee9285b26b11b393" hs_bindgen_ee9285b26b11b393_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_group@
+hs_bindgen_ee9285b26b11b393 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_group@
+hs_bindgen_ee9285b26b11b393 = hs_bindgen_ee9285b26b11b393_base
+{-| __C declaration:__ @group@
+
+    __defined at:__ @edge-cases\/names.h 19:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+group_safe :: IO ()
+{-| __C declaration:__ @group@
+
+    __defined at:__ @edge-cases\/names.h 19:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+group_safe = hs_bindgen_ee9285b26b11b393
+-- __unique:__ @test_edgecasesnames_Example_Safe_interruptible@
+foreign import ccall safe "hs_bindgen_b2463d5c1d51883e" hs_bindgen_b2463d5c1d51883e_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_interruptible@
+hs_bindgen_b2463d5c1d51883e :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_interruptible@
+hs_bindgen_b2463d5c1d51883e = hs_bindgen_b2463d5c1d51883e_base
+{-| __C declaration:__ @interruptible@
+
+    __defined at:__ @edge-cases\/names.h 20:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+interruptible_safe :: IO ()
+{-| __C declaration:__ @interruptible@
+
+    __defined at:__ @edge-cases\/names.h 20:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+interruptible_safe = hs_bindgen_b2463d5c1d51883e
+-- __unique:__ @test_edgecasesnames_Example_Safe_javascript@
+foreign import ccall safe "hs_bindgen_55a55462d9cd296c" hs_bindgen_55a55462d9cd296c_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_javascript@
+hs_bindgen_55a55462d9cd296c :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_javascript@
+hs_bindgen_55a55462d9cd296c = hs_bindgen_55a55462d9cd296c_base
+{-| __C declaration:__ @javascript@
+
+    __defined at:__ @edge-cases\/names.h 21:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+javascript_safe :: IO ()
+{-| __C declaration:__ @javascript@
+
+    __defined at:__ @edge-cases\/names.h 21:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+javascript_safe = hs_bindgen_55a55462d9cd296c
+-- __unique:__ @test_edgecasesnames_Example_Safe_label@
+foreign import ccall safe "hs_bindgen_227f34efb176d1fb" hs_bindgen_227f34efb176d1fb_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_label@
+hs_bindgen_227f34efb176d1fb :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_label@
+hs_bindgen_227f34efb176d1fb = hs_bindgen_227f34efb176d1fb_base
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/names.h 22:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+label_safe :: IO ()
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/names.h 22:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+label_safe = hs_bindgen_227f34efb176d1fb
+-- __unique:__ @test_edgecasesnames_Example_Safe_prim@
+foreign import ccall safe "hs_bindgen_51c6e0d18dce403a" hs_bindgen_51c6e0d18dce403a_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_prim@
+hs_bindgen_51c6e0d18dce403a :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_prim@
+hs_bindgen_51c6e0d18dce403a = hs_bindgen_51c6e0d18dce403a_base
+{-| __C declaration:__ @prim@
+
+    __defined at:__ @edge-cases\/names.h 23:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+prim_safe :: IO ()
+{-| __C declaration:__ @prim@
+
+    __defined at:__ @edge-cases\/names.h 23:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+prim_safe = hs_bindgen_51c6e0d18dce403a
+-- __unique:__ @test_edgecasesnames_Example_Safe_role@
+foreign import ccall safe "hs_bindgen_f85f2418d208e6a0" hs_bindgen_f85f2418d208e6a0_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_role@
+hs_bindgen_f85f2418d208e6a0 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_role@
+hs_bindgen_f85f2418d208e6a0 = hs_bindgen_f85f2418d208e6a0_base
+{-| __C declaration:__ @role@
+
+    __defined at:__ @edge-cases\/names.h 24:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+role_safe :: IO ()
+{-| __C declaration:__ @role@
+
+    __defined at:__ @edge-cases\/names.h 24:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+role_safe = hs_bindgen_f85f2418d208e6a0
+-- __unique:__ @test_edgecasesnames_Example_Safe_safe@
+foreign import ccall safe "hs_bindgen_0855ecbc4b53ebbb" hs_bindgen_0855ecbc4b53ebbb_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_safe@
+hs_bindgen_0855ecbc4b53ebbb :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_safe@
+hs_bindgen_0855ecbc4b53ebbb = hs_bindgen_0855ecbc4b53ebbb_base
+{-| __C declaration:__ @safe@
+
+    __defined at:__ @edge-cases\/names.h 25:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+safe_safe :: IO ()
+{-| __C declaration:__ @safe@
+
+    __defined at:__ @edge-cases\/names.h 25:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+safe_safe = hs_bindgen_0855ecbc4b53ebbb
+-- __unique:__ @test_edgecasesnames_Example_Safe_stdcall@
+foreign import ccall safe "hs_bindgen_e5238d13788a6df9" hs_bindgen_e5238d13788a6df9_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_stdcall@
+hs_bindgen_e5238d13788a6df9 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_stdcall@
+hs_bindgen_e5238d13788a6df9 = hs_bindgen_e5238d13788a6df9_base
+{-| __C declaration:__ @stdcall@
+
+    __defined at:__ @edge-cases\/names.h 26:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stdcall_safe :: IO ()
+{-| __C declaration:__ @stdcall@
+
+    __defined at:__ @edge-cases\/names.h 26:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stdcall_safe = hs_bindgen_e5238d13788a6df9
+-- __unique:__ @test_edgecasesnames_Example_Safe_stock@
+foreign import ccall safe "hs_bindgen_cf38d8bd096a7a42" hs_bindgen_cf38d8bd096a7a42_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_stock@
+hs_bindgen_cf38d8bd096a7a42 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_stock@
+hs_bindgen_cf38d8bd096a7a42 = hs_bindgen_cf38d8bd096a7a42_base
+{-| __C declaration:__ @stock@
+
+    __defined at:__ @edge-cases\/names.h 27:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stock_safe :: IO ()
+{-| __C declaration:__ @stock@
+
+    __defined at:__ @edge-cases\/names.h 27:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stock_safe = hs_bindgen_cf38d8bd096a7a42
+-- __unique:__ @test_edgecasesnames_Example_Safe_unsafe@
+foreign import ccall safe "hs_bindgen_fda9b083b24404f0" hs_bindgen_fda9b083b24404f0_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_unsafe@
+hs_bindgen_fda9b083b24404f0 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_unsafe@
+hs_bindgen_fda9b083b24404f0 = hs_bindgen_fda9b083b24404f0_base
+{-| __C declaration:__ @unsafe@
+
+    __defined at:__ @edge-cases\/names.h 28:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+unsafe_safe :: IO ()
+{-| __C declaration:__ @unsafe@
+
+    __defined at:__ @edge-cases\/names.h 28:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+unsafe_safe = hs_bindgen_fda9b083b24404f0
+-- __unique:__ @test_edgecasesnames_Example_Safe_via@
+foreign import ccall safe "hs_bindgen_1d2a76a3a595be25" hs_bindgen_1d2a76a3a595be25_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_via@
+hs_bindgen_1d2a76a3a595be25 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Safe_via@
+hs_bindgen_1d2a76a3a595be25 = hs_bindgen_1d2a76a3a595be25_base
+{-| __C declaration:__ @via@
+
+    __defined at:__ @edge-cases\/names.h 29:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+via_safe :: IO ()
+{-| __C declaration:__ @via@
+
+    __defined at:__ @edge-cases\/names.h 29:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+via_safe = hs_bindgen_1d2a76a3a595be25
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_by@
+foreign import ccall unsafe "hs_bindgen_28b998af1f39a743" hs_bindgen_28b998af1f39a743_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_by@
+hs_bindgen_28b998af1f39a743 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_by@
+hs_bindgen_28b998af1f39a743 = hs_bindgen_28b998af1f39a743_base
+{-| __C declaration:__ @by@
+
+    __defined at:__ @edge-cases\/names.h 3:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+by'_unsafe :: IO ()
+{-| __C declaration:__ @by@
+
+    __defined at:__ @edge-cases\/names.h 3:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+by'_unsafe = hs_bindgen_28b998af1f39a743
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_forall@
+foreign import ccall unsafe "hs_bindgen_5d7ea7c4d11a5fc8" hs_bindgen_5d7ea7c4d11a5fc8_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_forall@
+hs_bindgen_5d7ea7c4d11a5fc8 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_forall@
+hs_bindgen_5d7ea7c4d11a5fc8 = hs_bindgen_5d7ea7c4d11a5fc8_base
+{-| __C declaration:__ @forall@
+
+    __defined at:__ @edge-cases\/names.h 4:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+forall'_unsafe :: IO ()
+{-| __C declaration:__ @forall@
+
+    __defined at:__ @edge-cases\/names.h 4:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+forall'_unsafe = hs_bindgen_5d7ea7c4d11a5fc8
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_mdo@
+foreign import ccall unsafe "hs_bindgen_2d65448c684c09d5" hs_bindgen_2d65448c684c09d5_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_mdo@
+hs_bindgen_2d65448c684c09d5 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_mdo@
+hs_bindgen_2d65448c684c09d5 = hs_bindgen_2d65448c684c09d5_base
+{-| __C declaration:__ @mdo@
+
+    __defined at:__ @edge-cases\/names.h 5:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+mdo'_unsafe :: IO ()
+{-| __C declaration:__ @mdo@
+
+    __defined at:__ @edge-cases\/names.h 5:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+mdo'_unsafe = hs_bindgen_2d65448c684c09d5
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_pattern@
+foreign import ccall unsafe "hs_bindgen_13fe653d670d3712" hs_bindgen_13fe653d670d3712_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_pattern@
+hs_bindgen_13fe653d670d3712 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_pattern@
+hs_bindgen_13fe653d670d3712 = hs_bindgen_13fe653d670d3712_base
+{-| __C declaration:__ @pattern@
+
+    __defined at:__ @edge-cases\/names.h 6:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+pattern'_unsafe :: IO ()
+{-| __C declaration:__ @pattern@
+
+    __defined at:__ @edge-cases\/names.h 6:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+pattern'_unsafe = hs_bindgen_13fe653d670d3712
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_proc@
+foreign import ccall unsafe "hs_bindgen_e9cc2037d33041aa" hs_bindgen_e9cc2037d33041aa_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_proc@
+hs_bindgen_e9cc2037d33041aa :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_proc@
+hs_bindgen_e9cc2037d33041aa = hs_bindgen_e9cc2037d33041aa_base
+{-| __C declaration:__ @proc@
+
+    __defined at:__ @edge-cases\/names.h 7:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+proc'_unsafe :: IO ()
+{-| __C declaration:__ @proc@
+
+    __defined at:__ @edge-cases\/names.h 7:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+proc'_unsafe = hs_bindgen_e9cc2037d33041aa
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_rec@
+foreign import ccall unsafe "hs_bindgen_4a1e741f9ef596ff" hs_bindgen_4a1e741f9ef596ff_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_rec@
+hs_bindgen_4a1e741f9ef596ff :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_rec@
+hs_bindgen_4a1e741f9ef596ff = hs_bindgen_4a1e741f9ef596ff_base
+{-| __C declaration:__ @rec@
+
+    __defined at:__ @edge-cases\/names.h 8:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+rec'_unsafe :: IO ()
+{-| __C declaration:__ @rec@
+
+    __defined at:__ @edge-cases\/names.h 8:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+rec'_unsafe = hs_bindgen_4a1e741f9ef596ff
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_using@
+foreign import ccall unsafe "hs_bindgen_ef6f3f22c615db58" hs_bindgen_ef6f3f22c615db58_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_using@
+hs_bindgen_ef6f3f22c615db58 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_using@
+hs_bindgen_ef6f3f22c615db58 = hs_bindgen_ef6f3f22c615db58_base
+{-| __C declaration:__ @using@
+
+    __defined at:__ @edge-cases\/names.h 9:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+using'_unsafe :: IO ()
+{-| __C declaration:__ @using@
+
+    __defined at:__ @edge-cases\/names.h 9:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+using'_unsafe = hs_bindgen_ef6f3f22c615db58
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_anyclass@
+foreign import ccall unsafe "hs_bindgen_3c7afeaaf3ff040b" hs_bindgen_3c7afeaaf3ff040b_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_anyclass@
+hs_bindgen_3c7afeaaf3ff040b :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_anyclass@
+hs_bindgen_3c7afeaaf3ff040b = hs_bindgen_3c7afeaaf3ff040b_base
+{-| __C declaration:__ @anyclass@
+
+    __defined at:__ @edge-cases\/names.h 12:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+anyclass_unsafe :: IO ()
+{-| __C declaration:__ @anyclass@
+
+    __defined at:__ @edge-cases\/names.h 12:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+anyclass_unsafe = hs_bindgen_3c7afeaaf3ff040b
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_capi@
+foreign import ccall unsafe "hs_bindgen_0518740d4c3caa1d" hs_bindgen_0518740d4c3caa1d_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_capi@
+hs_bindgen_0518740d4c3caa1d :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_capi@
+hs_bindgen_0518740d4c3caa1d = hs_bindgen_0518740d4c3caa1d_base
+{-| __C declaration:__ @capi@
+
+    __defined at:__ @edge-cases\/names.h 13:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+capi_unsafe :: IO ()
+{-| __C declaration:__ @capi@
+
+    __defined at:__ @edge-cases\/names.h 13:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+capi_unsafe = hs_bindgen_0518740d4c3caa1d
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_cases@
+foreign import ccall unsafe "hs_bindgen_61f14ad7bb2e3d54" hs_bindgen_61f14ad7bb2e3d54_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_cases@
+hs_bindgen_61f14ad7bb2e3d54 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_cases@
+hs_bindgen_61f14ad7bb2e3d54 = hs_bindgen_61f14ad7bb2e3d54_base
+{-| __C declaration:__ @cases@
+
+    __defined at:__ @edge-cases\/names.h 14:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+cases_unsafe :: IO ()
+{-| __C declaration:__ @cases@
+
+    __defined at:__ @edge-cases\/names.h 14:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+cases_unsafe = hs_bindgen_61f14ad7bb2e3d54
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_ccall@
+foreign import ccall unsafe "hs_bindgen_ace8c96ed6673c3b" hs_bindgen_ace8c96ed6673c3b_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_ccall@
+hs_bindgen_ace8c96ed6673c3b :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_ccall@
+hs_bindgen_ace8c96ed6673c3b = hs_bindgen_ace8c96ed6673c3b_base
+{-| __C declaration:__ @ccall@
+
+    __defined at:__ @edge-cases\/names.h 15:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+ccall_unsafe :: IO ()
+{-| __C declaration:__ @ccall@
+
+    __defined at:__ @edge-cases\/names.h 15:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+ccall_unsafe = hs_bindgen_ace8c96ed6673c3b
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_dynamic@
+foreign import ccall unsafe "hs_bindgen_8865833b99552d03" hs_bindgen_8865833b99552d03_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_dynamic@
+hs_bindgen_8865833b99552d03 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_dynamic@
+hs_bindgen_8865833b99552d03 = hs_bindgen_8865833b99552d03_base
+{-| __C declaration:__ @dynamic@
+
+    __defined at:__ @edge-cases\/names.h 16:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+dynamic_unsafe :: IO ()
+{-| __C declaration:__ @dynamic@
+
+    __defined at:__ @edge-cases\/names.h 16:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+dynamic_unsafe = hs_bindgen_8865833b99552d03
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_export@
+foreign import ccall unsafe "hs_bindgen_15729ba251f5ec57" hs_bindgen_15729ba251f5ec57_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_export@
+hs_bindgen_15729ba251f5ec57 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_export@
+hs_bindgen_15729ba251f5ec57 = hs_bindgen_15729ba251f5ec57_base
+{-| __C declaration:__ @export@
+
+    __defined at:__ @edge-cases\/names.h 17:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+export_unsafe :: IO ()
+{-| __C declaration:__ @export@
+
+    __defined at:__ @edge-cases\/names.h 17:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+export_unsafe = hs_bindgen_15729ba251f5ec57
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_family@
+foreign import ccall unsafe "hs_bindgen_e6a4f7e833da2687" hs_bindgen_e6a4f7e833da2687_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_family@
+hs_bindgen_e6a4f7e833da2687 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_family@
+hs_bindgen_e6a4f7e833da2687 = hs_bindgen_e6a4f7e833da2687_base
+{-| __C declaration:__ @family@
+
+    __defined at:__ @edge-cases\/names.h 18:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+family_unsafe :: IO ()
+{-| __C declaration:__ @family@
+
+    __defined at:__ @edge-cases\/names.h 18:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+family_unsafe = hs_bindgen_e6a4f7e833da2687
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_group@
+foreign import ccall unsafe "hs_bindgen_d4dd1bb5e95de858" hs_bindgen_d4dd1bb5e95de858_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_group@
+hs_bindgen_d4dd1bb5e95de858 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_group@
+hs_bindgen_d4dd1bb5e95de858 = hs_bindgen_d4dd1bb5e95de858_base
+{-| __C declaration:__ @group@
+
+    __defined at:__ @edge-cases\/names.h 19:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+group_unsafe :: IO ()
+{-| __C declaration:__ @group@
+
+    __defined at:__ @edge-cases\/names.h 19:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+group_unsafe = hs_bindgen_d4dd1bb5e95de858
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_interruptible@
+foreign import ccall unsafe "hs_bindgen_516f1ad5aba6de29" hs_bindgen_516f1ad5aba6de29_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_interruptible@
+hs_bindgen_516f1ad5aba6de29 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_interruptible@
+hs_bindgen_516f1ad5aba6de29 = hs_bindgen_516f1ad5aba6de29_base
+{-| __C declaration:__ @interruptible@
+
+    __defined at:__ @edge-cases\/names.h 20:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+interruptible_unsafe :: IO ()
+{-| __C declaration:__ @interruptible@
+
+    __defined at:__ @edge-cases\/names.h 20:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+interruptible_unsafe = hs_bindgen_516f1ad5aba6de29
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_javascript@
+foreign import ccall unsafe "hs_bindgen_214230db174dc3e6" hs_bindgen_214230db174dc3e6_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_javascript@
+hs_bindgen_214230db174dc3e6 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_javascript@
+hs_bindgen_214230db174dc3e6 = hs_bindgen_214230db174dc3e6_base
+{-| __C declaration:__ @javascript@
+
+    __defined at:__ @edge-cases\/names.h 21:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+javascript_unsafe :: IO ()
+{-| __C declaration:__ @javascript@
+
+    __defined at:__ @edge-cases\/names.h 21:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+javascript_unsafe = hs_bindgen_214230db174dc3e6
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_label@
+foreign import ccall unsafe "hs_bindgen_88f1f0cf9c0f080e" hs_bindgen_88f1f0cf9c0f080e_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_label@
+hs_bindgen_88f1f0cf9c0f080e :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_label@
+hs_bindgen_88f1f0cf9c0f080e = hs_bindgen_88f1f0cf9c0f080e_base
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/names.h 22:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+label_unsafe :: IO ()
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/names.h 22:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+label_unsafe = hs_bindgen_88f1f0cf9c0f080e
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_prim@
+foreign import ccall unsafe "hs_bindgen_93a4c73f587dcf3c" hs_bindgen_93a4c73f587dcf3c_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_prim@
+hs_bindgen_93a4c73f587dcf3c :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_prim@
+hs_bindgen_93a4c73f587dcf3c = hs_bindgen_93a4c73f587dcf3c_base
+{-| __C declaration:__ @prim@
+
+    __defined at:__ @edge-cases\/names.h 23:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+prim_unsafe :: IO ()
+{-| __C declaration:__ @prim@
+
+    __defined at:__ @edge-cases\/names.h 23:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+prim_unsafe = hs_bindgen_93a4c73f587dcf3c
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_role@
+foreign import ccall unsafe "hs_bindgen_a267fe5585862ecc" hs_bindgen_a267fe5585862ecc_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_role@
+hs_bindgen_a267fe5585862ecc :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_role@
+hs_bindgen_a267fe5585862ecc = hs_bindgen_a267fe5585862ecc_base
+{-| __C declaration:__ @role@
+
+    __defined at:__ @edge-cases\/names.h 24:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+role_unsafe :: IO ()
+{-| __C declaration:__ @role@
+
+    __defined at:__ @edge-cases\/names.h 24:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+role_unsafe = hs_bindgen_a267fe5585862ecc
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_safe@
+foreign import ccall unsafe "hs_bindgen_ddac4cdf91c756a8" hs_bindgen_ddac4cdf91c756a8_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_safe@
+hs_bindgen_ddac4cdf91c756a8 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_safe@
+hs_bindgen_ddac4cdf91c756a8 = hs_bindgen_ddac4cdf91c756a8_base
+{-| __C declaration:__ @safe@
+
+    __defined at:__ @edge-cases\/names.h 25:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+safe_unsafe :: IO ()
+{-| __C declaration:__ @safe@
+
+    __defined at:__ @edge-cases\/names.h 25:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+safe_unsafe = hs_bindgen_ddac4cdf91c756a8
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stdcall@
+foreign import ccall unsafe "hs_bindgen_8dd57b02f322a7ae" hs_bindgen_8dd57b02f322a7ae_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stdcall@
+hs_bindgen_8dd57b02f322a7ae :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stdcall@
+hs_bindgen_8dd57b02f322a7ae = hs_bindgen_8dd57b02f322a7ae_base
+{-| __C declaration:__ @stdcall@
+
+    __defined at:__ @edge-cases\/names.h 26:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stdcall_unsafe :: IO ()
+{-| __C declaration:__ @stdcall@
+
+    __defined at:__ @edge-cases\/names.h 26:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stdcall_unsafe = hs_bindgen_8dd57b02f322a7ae
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stock@
+foreign import ccall unsafe "hs_bindgen_3b69e1860d72507c" hs_bindgen_3b69e1860d72507c_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stock@
+hs_bindgen_3b69e1860d72507c :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_stock@
+hs_bindgen_3b69e1860d72507c = hs_bindgen_3b69e1860d72507c_base
+{-| __C declaration:__ @stock@
+
+    __defined at:__ @edge-cases\/names.h 27:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stock_unsafe :: IO ()
+{-| __C declaration:__ @stock@
+
+    __defined at:__ @edge-cases\/names.h 27:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stock_unsafe = hs_bindgen_3b69e1860d72507c
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_unsafe@
+foreign import ccall unsafe "hs_bindgen_b9d80fa39d7ebb06" hs_bindgen_b9d80fa39d7ebb06_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_unsafe@
+hs_bindgen_b9d80fa39d7ebb06 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_unsafe@
+hs_bindgen_b9d80fa39d7ebb06 = hs_bindgen_b9d80fa39d7ebb06_base
+{-| __C declaration:__ @unsafe@
+
+    __defined at:__ @edge-cases\/names.h 28:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+unsafe_unsafe :: IO ()
+{-| __C declaration:__ @unsafe@
+
+    __defined at:__ @edge-cases\/names.h 28:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+unsafe_unsafe = hs_bindgen_b9d80fa39d7ebb06
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_via@
+foreign import ccall unsafe "hs_bindgen_708f6397f5e5ac73" hs_bindgen_708f6397f5e5ac73_base ::
+    IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_via@
+hs_bindgen_708f6397f5e5ac73 :: IO ()
+-- __unique:__ @test_edgecasesnames_Example_Unsafe_via@
+hs_bindgen_708f6397f5e5ac73 = hs_bindgen_708f6397f5e5ac73_base
+{-| __C declaration:__ @via@
+
+    __defined at:__ @edge-cases\/names.h 29:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+via_unsafe :: IO ()
+{-| __C declaration:__ @via@
+
+    __defined at:__ @edge-cases\/names.h 29:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+via_unsafe = hs_bindgen_708f6397f5e5ac73
+-- __unique:__ @test_edgecasesnames_Example_get_by@
+foreign import ccall unsafe "hs_bindgen_d50b20f504174dd5" hs_bindgen_d50b20f504174dd5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_by@
+hs_bindgen_d50b20f504174dd5 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_by@
+hs_bindgen_d50b20f504174dd5 = fmap fromFFIType hs_bindgen_d50b20f504174dd5_base
+{-# NOINLINE by'_funptr #-}
+{-| __C declaration:__ @by@
+
+    __defined at:__ @edge-cases\/names.h 3:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+by'_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @by@
+
+    __defined at:__ @edge-cases\/names.h 3:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+by'_funptr = unsafePerformIO hs_bindgen_d50b20f504174dd5
+-- __unique:__ @test_edgecasesnames_Example_get_forall@
+foreign import ccall unsafe "hs_bindgen_f7e660ea9223a909" hs_bindgen_f7e660ea9223a909_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_forall@
+hs_bindgen_f7e660ea9223a909 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_forall@
+hs_bindgen_f7e660ea9223a909 = fmap fromFFIType hs_bindgen_f7e660ea9223a909_base
+{-# NOINLINE forall'_funptr #-}
+{-| __C declaration:__ @forall@
+
+    __defined at:__ @edge-cases\/names.h 4:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+forall'_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @forall@
+
+    __defined at:__ @edge-cases\/names.h 4:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+forall'_funptr = unsafePerformIO hs_bindgen_f7e660ea9223a909
+-- __unique:__ @test_edgecasesnames_Example_get_mdo@
+foreign import ccall unsafe "hs_bindgen_15319d1b8d2ca927" hs_bindgen_15319d1b8d2ca927_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_mdo@
+hs_bindgen_15319d1b8d2ca927 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_mdo@
+hs_bindgen_15319d1b8d2ca927 = fmap fromFFIType hs_bindgen_15319d1b8d2ca927_base
+{-# NOINLINE mdo'_funptr #-}
+{-| __C declaration:__ @mdo@
+
+    __defined at:__ @edge-cases\/names.h 5:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+mdo'_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @mdo@
+
+    __defined at:__ @edge-cases\/names.h 5:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+mdo'_funptr = unsafePerformIO hs_bindgen_15319d1b8d2ca927
+-- __unique:__ @test_edgecasesnames_Example_get_pattern@
+foreign import ccall unsafe "hs_bindgen_e5a1961c11d641ed" hs_bindgen_e5a1961c11d641ed_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_pattern@
+hs_bindgen_e5a1961c11d641ed :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_pattern@
+hs_bindgen_e5a1961c11d641ed = fmap fromFFIType hs_bindgen_e5a1961c11d641ed_base
+{-# NOINLINE pattern'_funptr #-}
+{-| __C declaration:__ @pattern@
+
+    __defined at:__ @edge-cases\/names.h 6:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+pattern'_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @pattern@
+
+    __defined at:__ @edge-cases\/names.h 6:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+pattern'_funptr = unsafePerformIO hs_bindgen_e5a1961c11d641ed
+-- __unique:__ @test_edgecasesnames_Example_get_proc@
+foreign import ccall unsafe "hs_bindgen_d2dd74adbb4a606c" hs_bindgen_d2dd74adbb4a606c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_proc@
+hs_bindgen_d2dd74adbb4a606c :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_proc@
+hs_bindgen_d2dd74adbb4a606c = fmap fromFFIType hs_bindgen_d2dd74adbb4a606c_base
+{-# NOINLINE proc'_funptr #-}
+{-| __C declaration:__ @proc@
+
+    __defined at:__ @edge-cases\/names.h 7:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+proc'_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @proc@
+
+    __defined at:__ @edge-cases\/names.h 7:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+proc'_funptr = unsafePerformIO hs_bindgen_d2dd74adbb4a606c
+-- __unique:__ @test_edgecasesnames_Example_get_rec@
+foreign import ccall unsafe "hs_bindgen_bab6d9c9540c9d58" hs_bindgen_bab6d9c9540c9d58_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_rec@
+hs_bindgen_bab6d9c9540c9d58 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_rec@
+hs_bindgen_bab6d9c9540c9d58 = fmap fromFFIType hs_bindgen_bab6d9c9540c9d58_base
+{-# NOINLINE rec'_funptr #-}
+{-| __C declaration:__ @rec@
+
+    __defined at:__ @edge-cases\/names.h 8:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+rec'_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @rec@
+
+    __defined at:__ @edge-cases\/names.h 8:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+rec'_funptr = unsafePerformIO hs_bindgen_bab6d9c9540c9d58
+-- __unique:__ @test_edgecasesnames_Example_get_using@
+foreign import ccall unsafe "hs_bindgen_447fa7223c86f5c7" hs_bindgen_447fa7223c86f5c7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_using@
+hs_bindgen_447fa7223c86f5c7 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_using@
+hs_bindgen_447fa7223c86f5c7 = fmap fromFFIType hs_bindgen_447fa7223c86f5c7_base
+{-# NOINLINE using'_funptr #-}
+{-| __C declaration:__ @using@
+
+    __defined at:__ @edge-cases\/names.h 9:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+using'_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @using@
+
+    __defined at:__ @edge-cases\/names.h 9:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+using'_funptr = unsafePerformIO hs_bindgen_447fa7223c86f5c7
+-- __unique:__ @test_edgecasesnames_Example_get_anyclass@
+foreign import ccall unsafe "hs_bindgen_f2292c17facdbcde" hs_bindgen_f2292c17facdbcde_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_anyclass@
+hs_bindgen_f2292c17facdbcde :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_anyclass@
+hs_bindgen_f2292c17facdbcde = fmap fromFFIType hs_bindgen_f2292c17facdbcde_base
+{-# NOINLINE anyclass_funptr #-}
+{-| __C declaration:__ @anyclass@
+
+    __defined at:__ @edge-cases\/names.h 12:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+anyclass_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @anyclass@
+
+    __defined at:__ @edge-cases\/names.h 12:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+anyclass_funptr = unsafePerformIO hs_bindgen_f2292c17facdbcde
+-- __unique:__ @test_edgecasesnames_Example_get_capi@
+foreign import ccall unsafe "hs_bindgen_393b62c1a821de61" hs_bindgen_393b62c1a821de61_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_capi@
+hs_bindgen_393b62c1a821de61 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_capi@
+hs_bindgen_393b62c1a821de61 = fmap fromFFIType hs_bindgen_393b62c1a821de61_base
+{-# NOINLINE capi_funptr #-}
+{-| __C declaration:__ @capi@
+
+    __defined at:__ @edge-cases\/names.h 13:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+capi_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @capi@
+
+    __defined at:__ @edge-cases\/names.h 13:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+capi_funptr = unsafePerformIO hs_bindgen_393b62c1a821de61
+-- __unique:__ @test_edgecasesnames_Example_get_cases@
+foreign import ccall unsafe "hs_bindgen_962b5bf9813ea6dd" hs_bindgen_962b5bf9813ea6dd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_cases@
+hs_bindgen_962b5bf9813ea6dd :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_cases@
+hs_bindgen_962b5bf9813ea6dd = fmap fromFFIType hs_bindgen_962b5bf9813ea6dd_base
+{-# NOINLINE cases_funptr #-}
+{-| __C declaration:__ @cases@
+
+    __defined at:__ @edge-cases\/names.h 14:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+cases_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @cases@
+
+    __defined at:__ @edge-cases\/names.h 14:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+cases_funptr = unsafePerformIO hs_bindgen_962b5bf9813ea6dd
+-- __unique:__ @test_edgecasesnames_Example_get_ccall@
+foreign import ccall unsafe "hs_bindgen_599948844183b4ea" hs_bindgen_599948844183b4ea_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_ccall@
+hs_bindgen_599948844183b4ea :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_ccall@
+hs_bindgen_599948844183b4ea = fmap fromFFIType hs_bindgen_599948844183b4ea_base
+{-# NOINLINE ccall_funptr #-}
+{-| __C declaration:__ @ccall@
+
+    __defined at:__ @edge-cases\/names.h 15:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+ccall_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @ccall@
+
+    __defined at:__ @edge-cases\/names.h 15:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+ccall_funptr = unsafePerformIO hs_bindgen_599948844183b4ea
+-- __unique:__ @test_edgecasesnames_Example_get_dynamic@
+foreign import ccall unsafe "hs_bindgen_aa442ea764d9d93c" hs_bindgen_aa442ea764d9d93c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_dynamic@
+hs_bindgen_aa442ea764d9d93c :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_dynamic@
+hs_bindgen_aa442ea764d9d93c = fmap fromFFIType hs_bindgen_aa442ea764d9d93c_base
+{-# NOINLINE dynamic_funptr #-}
+{-| __C declaration:__ @dynamic@
+
+    __defined at:__ @edge-cases\/names.h 16:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+dynamic_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @dynamic@
+
+    __defined at:__ @edge-cases\/names.h 16:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+dynamic_funptr = unsafePerformIO hs_bindgen_aa442ea764d9d93c
+-- __unique:__ @test_edgecasesnames_Example_get_export@
+foreign import ccall unsafe "hs_bindgen_98dfb21e9f7b6857" hs_bindgen_98dfb21e9f7b6857_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_export@
+hs_bindgen_98dfb21e9f7b6857 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_export@
+hs_bindgen_98dfb21e9f7b6857 = fmap fromFFIType hs_bindgen_98dfb21e9f7b6857_base
+{-# NOINLINE export_funptr #-}
+{-| __C declaration:__ @export@
+
+    __defined at:__ @edge-cases\/names.h 17:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+export_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @export@
+
+    __defined at:__ @edge-cases\/names.h 17:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+export_funptr = unsafePerformIO hs_bindgen_98dfb21e9f7b6857
+-- __unique:__ @test_edgecasesnames_Example_get_family@
+foreign import ccall unsafe "hs_bindgen_b96b9fd3fa689c75" hs_bindgen_b96b9fd3fa689c75_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_family@
+hs_bindgen_b96b9fd3fa689c75 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_family@
+hs_bindgen_b96b9fd3fa689c75 = fmap fromFFIType hs_bindgen_b96b9fd3fa689c75_base
+{-# NOINLINE family_funptr #-}
+{-| __C declaration:__ @family@
+
+    __defined at:__ @edge-cases\/names.h 18:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+family_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @family@
+
+    __defined at:__ @edge-cases\/names.h 18:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+family_funptr = unsafePerformIO hs_bindgen_b96b9fd3fa689c75
+-- __unique:__ @test_edgecasesnames_Example_get_group@
+foreign import ccall unsafe "hs_bindgen_a4413aed06e03d16" hs_bindgen_a4413aed06e03d16_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_group@
+hs_bindgen_a4413aed06e03d16 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_group@
+hs_bindgen_a4413aed06e03d16 = fmap fromFFIType hs_bindgen_a4413aed06e03d16_base
+{-# NOINLINE group_funptr #-}
+{-| __C declaration:__ @group@
+
+    __defined at:__ @edge-cases\/names.h 19:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+group_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @group@
+
+    __defined at:__ @edge-cases\/names.h 19:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+group_funptr = unsafePerformIO hs_bindgen_a4413aed06e03d16
+-- __unique:__ @test_edgecasesnames_Example_get_interruptible@
+foreign import ccall unsafe "hs_bindgen_52223789a2752bbe" hs_bindgen_52223789a2752bbe_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_interruptible@
+hs_bindgen_52223789a2752bbe :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_interruptible@
+hs_bindgen_52223789a2752bbe = fmap fromFFIType hs_bindgen_52223789a2752bbe_base
+{-# NOINLINE interruptible_funptr #-}
+{-| __C declaration:__ @interruptible@
+
+    __defined at:__ @edge-cases\/names.h 20:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+interruptible_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @interruptible@
+
+    __defined at:__ @edge-cases\/names.h 20:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+interruptible_funptr = unsafePerformIO hs_bindgen_52223789a2752bbe
+-- __unique:__ @test_edgecasesnames_Example_get_javascript@
+foreign import ccall unsafe "hs_bindgen_3d349ab20e55d3d5" hs_bindgen_3d349ab20e55d3d5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_javascript@
+hs_bindgen_3d349ab20e55d3d5 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_javascript@
+hs_bindgen_3d349ab20e55d3d5 = fmap fromFFIType hs_bindgen_3d349ab20e55d3d5_base
+{-# NOINLINE javascript_funptr #-}
+{-| __C declaration:__ @javascript@
+
+    __defined at:__ @edge-cases\/names.h 21:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+javascript_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @javascript@
+
+    __defined at:__ @edge-cases\/names.h 21:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+javascript_funptr = unsafePerformIO hs_bindgen_3d349ab20e55d3d5
+-- __unique:__ @test_edgecasesnames_Example_get_label@
+foreign import ccall unsafe "hs_bindgen_7ab78b24e63738f5" hs_bindgen_7ab78b24e63738f5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_label@
+hs_bindgen_7ab78b24e63738f5 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_label@
+hs_bindgen_7ab78b24e63738f5 = fmap fromFFIType hs_bindgen_7ab78b24e63738f5_base
+{-# NOINLINE label_funptr #-}
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/names.h 22:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+label_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/names.h 22:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+label_funptr = unsafePerformIO hs_bindgen_7ab78b24e63738f5
+-- __unique:__ @test_edgecasesnames_Example_get_prim@
+foreign import ccall unsafe "hs_bindgen_13caa66b81eebdfb" hs_bindgen_13caa66b81eebdfb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_prim@
+hs_bindgen_13caa66b81eebdfb :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_prim@
+hs_bindgen_13caa66b81eebdfb = fmap fromFFIType hs_bindgen_13caa66b81eebdfb_base
+{-# NOINLINE prim_funptr #-}
+{-| __C declaration:__ @prim@
+
+    __defined at:__ @edge-cases\/names.h 23:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+prim_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @prim@
+
+    __defined at:__ @edge-cases\/names.h 23:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+prim_funptr = unsafePerformIO hs_bindgen_13caa66b81eebdfb
+-- __unique:__ @test_edgecasesnames_Example_get_role@
+foreign import ccall unsafe "hs_bindgen_99189a38ba22fdad" hs_bindgen_99189a38ba22fdad_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_role@
+hs_bindgen_99189a38ba22fdad :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_role@
+hs_bindgen_99189a38ba22fdad = fmap fromFFIType hs_bindgen_99189a38ba22fdad_base
+{-# NOINLINE role_funptr #-}
+{-| __C declaration:__ @role@
+
+    __defined at:__ @edge-cases\/names.h 24:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+role_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @role@
+
+    __defined at:__ @edge-cases\/names.h 24:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+role_funptr = unsafePerformIO hs_bindgen_99189a38ba22fdad
+-- __unique:__ @test_edgecasesnames_Example_get_safe@
+foreign import ccall unsafe "hs_bindgen_fe3819b9444e41b6" hs_bindgen_fe3819b9444e41b6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_safe@
+hs_bindgen_fe3819b9444e41b6 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_safe@
+hs_bindgen_fe3819b9444e41b6 = fmap fromFFIType hs_bindgen_fe3819b9444e41b6_base
+{-# NOINLINE safe_funptr #-}
+{-| __C declaration:__ @safe@
+
+    __defined at:__ @edge-cases\/names.h 25:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+safe_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @safe@
+
+    __defined at:__ @edge-cases\/names.h 25:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+safe_funptr = unsafePerformIO hs_bindgen_fe3819b9444e41b6
+-- __unique:__ @test_edgecasesnames_Example_get_stdcall@
+foreign import ccall unsafe "hs_bindgen_7d4e52bd26694f13" hs_bindgen_7d4e52bd26694f13_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_stdcall@
+hs_bindgen_7d4e52bd26694f13 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_stdcall@
+hs_bindgen_7d4e52bd26694f13 = fmap fromFFIType hs_bindgen_7d4e52bd26694f13_base
+{-# NOINLINE stdcall_funptr #-}
+{-| __C declaration:__ @stdcall@
+
+    __defined at:__ @edge-cases\/names.h 26:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stdcall_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @stdcall@
+
+    __defined at:__ @edge-cases\/names.h 26:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stdcall_funptr = unsafePerformIO hs_bindgen_7d4e52bd26694f13
+-- __unique:__ @test_edgecasesnames_Example_get_stock@
+foreign import ccall unsafe "hs_bindgen_be2fd8368b1f85bc" hs_bindgen_be2fd8368b1f85bc_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_stock@
+hs_bindgen_be2fd8368b1f85bc :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_stock@
+hs_bindgen_be2fd8368b1f85bc = fmap fromFFIType hs_bindgen_be2fd8368b1f85bc_base
+{-# NOINLINE stock_funptr #-}
+{-| __C declaration:__ @stock@
+
+    __defined at:__ @edge-cases\/names.h 27:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stock_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @stock@
+
+    __defined at:__ @edge-cases\/names.h 27:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+stock_funptr = unsafePerformIO hs_bindgen_be2fd8368b1f85bc
+-- __unique:__ @test_edgecasesnames_Example_get_unsafe@
+foreign import ccall unsafe "hs_bindgen_d0faf7702a235ae1" hs_bindgen_d0faf7702a235ae1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_unsafe@
+hs_bindgen_d0faf7702a235ae1 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_unsafe@
+hs_bindgen_d0faf7702a235ae1 = fmap fromFFIType hs_bindgen_d0faf7702a235ae1_base
+{-# NOINLINE unsafe_funptr #-}
+{-| __C declaration:__ @unsafe@
+
+    __defined at:__ @edge-cases\/names.h 28:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+unsafe_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @unsafe@
+
+    __defined at:__ @edge-cases\/names.h 28:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+unsafe_funptr = unsafePerformIO hs_bindgen_d0faf7702a235ae1
+-- __unique:__ @test_edgecasesnames_Example_get_via@
+foreign import ccall unsafe "hs_bindgen_56fc690ff4bc7c4e" hs_bindgen_56fc690ff4bc7c4e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesnames_Example_get_via@
+hs_bindgen_56fc690ff4bc7c4e :: IO (FunPtr (IO ()))
+-- __unique:__ @test_edgecasesnames_Example_get_via@
+hs_bindgen_56fc690ff4bc7c4e = fmap fromFFIType hs_bindgen_56fc690ff4bc7c4e_base
+{-# NOINLINE via_funptr #-}
+{-| __C declaration:__ @via@
+
+    __defined at:__ @edge-cases\/names.h 29:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+via_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @via@
+
+    __defined at:__ @edge-cases\/names.h 29:6@
+
+    __exported by:__ @edge-cases\/names.h@
+-}
+via_funptr = unsafePerformIO hs_bindgen_56fc690ff4bc7c4e
diff --git a/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr._acos
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/ordinary_unnamed_decl_parent.h>"
+  , "/* test_edgecasesordinary_unnamed_de_Example_get__acos */"
+  , "__attribute__ ((const))"
+  , "double (*hs_bindgen_3e079012b2dabc0c (void)) ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return &_acos;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_get__acos@
+foreign import ccall unsafe "hs_bindgen_3e079012b2dabc0c" hs_bindgen_3e079012b2dabc0c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_get__acos@
+hs_bindgen_3e079012b2dabc0c :: IO (BG.FunPtr (BG.CDouble -> IO BG.CDouble))
+hs_bindgen_3e079012b2dabc0c =
+  fmap BG.fromFFIType hs_bindgen_3e079012b2dabc0c_base
+
+{-# NOINLINE _acos #-}
+{-| __C declaration:__ @_acos@
+
+    __defined at:__ @ordinary_unnamed_decl_child.h 4:1@
+
+    __exported by:__ @edge-cases\/ordinary_unnamed_decl_parent.h@
+-}
+_acos :: BG.FunPtr (BG.CDouble -> IO BG.CDouble)
+_acos =
+  BG.unsafePerformIO hs_bindgen_3e079012b2dabc0c
diff --git a/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/Example/Safe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe._acos
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/ordinary_unnamed_decl_parent.h>"
+  , "double hs_bindgen_dfefd17e87559d1a ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (_acos)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Safe__acos@
+foreign import ccall safe "hs_bindgen_dfefd17e87559d1a" hs_bindgen_dfefd17e87559d1a_base ::
+     BG.CDouble
+  -> IO BG.CDouble
+
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Safe__acos@
+hs_bindgen_dfefd17e87559d1a ::
+     BG.CDouble
+  -> IO BG.CDouble
+hs_bindgen_dfefd17e87559d1a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_dfefd17e87559d1a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @_acos@
+
+    __defined at:__ @ordinary_unnamed_decl_child.h 4:1@
+
+    __exported by:__ @edge-cases\/ordinary_unnamed_decl_parent.h@
+-}
+_acos ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CDouble
+_acos = hs_bindgen_dfefd17e87559d1a
diff --git a/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/Example/Unsafe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe._acos
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/ordinary_unnamed_decl_parent.h>"
+  , "double hs_bindgen_751dc472004ee482 ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (_acos)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Unsafe__acos@
+foreign import ccall unsafe "hs_bindgen_751dc472004ee482" hs_bindgen_751dc472004ee482_base ::
+     BG.CDouble
+  -> IO BG.CDouble
+
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Unsafe__acos@
+hs_bindgen_751dc472004ee482 ::
+     BG.CDouble
+  -> IO BG.CDouble
+hs_bindgen_751dc472004ee482 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_751dc472004ee482_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @_acos@
+
+    __defined at:__ @ordinary_unnamed_decl_child.h 4:1@
+
+    __exported by:__ @edge-cases\/ordinary_unnamed_decl_parent.h@
+-}
+_acos ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CDouble
+_acos = hs_bindgen_751dc472004ee482
diff --git a/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/th.txt b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/ordinary_unnamed_decl_parent/th.txt
@@ -0,0 +1,89 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/ordinary_unnamed_decl_child.h
+-- addDependentFile test-artefacts/headers/golden/edge-cases/ordinary_unnamed_decl_parent.h
+-- #include <edge-cases/ordinary_unnamed_decl_parent.h>
+-- double hs_bindgen_dfefd17e87559d1a (
+--   double arg1
+-- )
+-- {
+--   return (_acos)(arg1);
+-- }
+-- double hs_bindgen_751dc472004ee482 (
+--   double arg1
+-- )
+-- {
+--   return (_acos)(arg1);
+-- }
+-- /* test_edgecasesordinary_unnamed_de_Example_get__acos */
+-- __attribute__ ((const))
+-- double (*hs_bindgen_3e079012b2dabc0c (void)) (
+--   double arg1
+-- )
+-- {
+--   return &_acos;
+-- }
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Safe__acos@
+foreign import ccall safe "hs_bindgen_dfefd17e87559d1a" hs_bindgen_dfefd17e87559d1a_base ::
+    CDouble
+ -> IO CDouble
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Safe__acos@
+hs_bindgen_dfefd17e87559d1a :: CDouble -> IO CDouble
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Safe__acos@
+hs_bindgen_dfefd17e87559d1a = \x_0 -> fmap fromFFIType (hs_bindgen_dfefd17e87559d1a_base (toFFIType x_0))
+{-| __C declaration:__ @_acos@
+
+    __defined at:__ @ordinary_unnamed_decl_child.h 4:1@
+
+    __exported by:__ @edge-cases\/ordinary_unnamed_decl_parent.h@
+-}
+_acos_safe :: CDouble -> IO CDouble
+{-| __C declaration:__ @_acos@
+
+    __defined at:__ @ordinary_unnamed_decl_child.h 4:1@
+
+    __exported by:__ @edge-cases\/ordinary_unnamed_decl_parent.h@
+-}
+_acos_safe = hs_bindgen_dfefd17e87559d1a
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Unsafe__acos@
+foreign import ccall unsafe "hs_bindgen_751dc472004ee482" hs_bindgen_751dc472004ee482_base ::
+    CDouble
+ -> IO CDouble
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Unsafe__acos@
+hs_bindgen_751dc472004ee482 :: CDouble -> IO CDouble
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_Unsafe__acos@
+hs_bindgen_751dc472004ee482 = \x_0 -> fmap fromFFIType (hs_bindgen_751dc472004ee482_base (toFFIType x_0))
+{-| __C declaration:__ @_acos@
+
+    __defined at:__ @ordinary_unnamed_decl_child.h 4:1@
+
+    __exported by:__ @edge-cases\/ordinary_unnamed_decl_parent.h@
+-}
+_acos_unsafe :: CDouble -> IO CDouble
+{-| __C declaration:__ @_acos@
+
+    __defined at:__ @ordinary_unnamed_decl_child.h 4:1@
+
+    __exported by:__ @edge-cases\/ordinary_unnamed_decl_parent.h@
+-}
+_acos_unsafe = hs_bindgen_751dc472004ee482
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_get__acos@
+foreign import ccall unsafe "hs_bindgen_3e079012b2dabc0c" hs_bindgen_3e079012b2dabc0c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_get__acos@
+hs_bindgen_3e079012b2dabc0c :: IO (FunPtr (CDouble -> IO CDouble))
+-- __unique:__ @test_edgecasesordinary_unnamed_de_Example_get__acos@
+hs_bindgen_3e079012b2dabc0c = fmap fromFFIType hs_bindgen_3e079012b2dabc0c_base
+{-# NOINLINE _acos_funptr #-}
+{-| __C declaration:__ @_acos@
+
+    __defined at:__ @ordinary_unnamed_decl_child.h 4:1@
+
+    __exported by:__ @edge-cases\/ordinary_unnamed_decl_parent.h@
+-}
+_acos_funptr :: FunPtr (CDouble -> IO CDouble)
+{-| __C declaration:__ @_acos@
+
+    __defined at:__ @ordinary_unnamed_decl_child.h 4:1@
+
+    __exported by:__ @edge-cases\/ordinary_unnamed_decl_parent.h@
+-}
+_acos_funptr = unsafePerformIO hs_bindgen_3e079012b2dabc0c
diff --git a/test-artefacts/fixtures/edge-cases/prelude_names/Example.hs b/test-artefacts/fixtures/edge-cases/prelude_names/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/prelude_names/Example.hs
@@ -0,0 +1,808 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.String'(..)
+    , Example.Show'(..)
+    , Example.CChar'(..)
+    , Example.C_types(..)
+    , pattern Example.CInt'
+    , Example.Constants(..)
+    , pattern Example.Eq
+    , pattern Example.Int
+    , pattern Example.True
+    , Example.Ordering(..)
+    , pattern Example.LT
+    , pattern Example.EQ
+    , pattern Example.GT
+    , Example.Maybe(..)
+    , Example.Word(..)
+    , Example.maximum
+    , Example.twice_maximum
+    , Example.readList
+    , Example.showsPrec
+    , Example.Void(..)
+    )
+  where
+
+import qualified C.Expr.HostPlatform
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @struct string@
+
+    __defined at:__ @edge-cases\/prelude_names.h 3:8@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+data String' = String'
+  { string'_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/prelude_names.h 3:21@
+
+         __exported by:__ @edge-cases\/prelude_names.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize String' where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw String' where
+
+  readRaw =
+    \ptr0 ->
+          pure String'
+      <*> HasCField.readRaw (BG.Proxy @"string'_x") ptr0
+
+instance Marshal.WriteRaw String' where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          String' string'_x2 ->
+            HasCField.writeRaw (BG.Proxy @"string'_x") ptr0 string'_x2
+
+deriving via Marshal.EquivStorable String' instance BG.Storable String'
+
+deriving via Struct.IsStructViaReadRaw String' instance Struct.IsStruct String'
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/prelude_names.h 3:21@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "string'_x" String' ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         String' {string'_x = y1}, BG.getField @"string'_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "string'_x" (BG.Ptr String') (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"string'_x")
+
+instance HasCField.HasCField String' "string'_x" where
+
+  type CFieldType String' "string'_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @Show@
+
+    __defined at:__ @edge-cases\/prelude_names.h 4:13@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype Show' = Show'
+  { unwrapShow' :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapShow'" Show' ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Show' {unwrapShow' = y1}, BG.getField @"unwrapShow'" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapShow'" (BG.Ptr Show') (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapShow'")
+
+instance HasCField.HasCField Show' "unwrapShow'" where
+
+  type CFieldType Show' "unwrapShow'" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct CChar@
+
+    __defined at:__ @edge-cases\/prelude_names.h 9:8@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+data CChar' = CChar'
+  { cChar'_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/prelude_names.h 9:20@
+
+         __exported by:__ @edge-cases\/prelude_names.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize CChar' where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw CChar' where
+
+  readRaw =
+    \ptr0 ->
+          pure CChar'
+      <*> HasCField.readRaw (BG.Proxy @"cChar'_x") ptr0
+
+instance Marshal.WriteRaw CChar' where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          CChar' cChar'_x2 ->
+            HasCField.writeRaw (BG.Proxy @"cChar'_x") ptr0 cChar'_x2
+
+deriving via Marshal.EquivStorable CChar' instance BG.Storable CChar'
+
+deriving via Struct.IsStructViaReadRaw CChar' instance Struct.IsStruct CChar'
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/prelude_names.h 9:20@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "cChar'_x" CChar' ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         CChar' {cChar'_x = y1}, BG.getField @"cChar'_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "cChar'_x" (BG.Ptr CChar') (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"cChar'_x")
+
+instance HasCField.HasCField CChar' "cChar'_x" where
+
+  type CFieldType CChar' "cChar'_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @enum c_types@
+
+    __defined at:__ @edge-cases\/prelude_names.h 10:6@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype C_types = C_types
+  { unwrapC_types :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize C_types where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw C_types where
+
+  readRaw =
+    \ptr0 ->
+          pure C_types
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw C_types where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          C_types unwrapC_types2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapC_types2
+
+deriving via Marshal.EquivStorable C_types instance BG.Storable C_types
+
+deriving via BG.CUInt instance BG.Prim C_types
+
+instance CEnum.CEnum C_types where
+
+  type CEnumZ C_types = BG.CUInt
+
+  toCEnum = C_types
+
+  fromCEnum = BG.getField @"unwrapC_types"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "CInt'")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "C_types"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "C_types"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum C_types where
+
+  minDeclaredValue = CInt'
+
+  maxDeclaredValue = CInt'
+
+instance Show C_types where
+
+  showsPrec = CEnum.shows
+
+instance Read C_types where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapC_types" C_types ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         C_types {unwrapC_types = y1}, BG.getField @"unwrapC_types" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapC_types" (BG.Ptr C_types) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapC_types")
+
+instance HasCField.HasCField C_types "unwrapC_types" where
+
+  type CFieldType C_types "unwrapC_types" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @CInt@
+
+    __defined at:__ @edge-cases\/prelude_names.h 10:16@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern CInt' :: C_types
+pattern CInt' = C_types 0
+
+{-| __C declaration:__ @enum constants@
+
+    __defined at:__ @edge-cases\/prelude_names.h 14:6@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype Constants = Constants
+  { unwrapConstants :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Constants where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Constants where
+
+  readRaw =
+    \ptr0 ->
+          pure Constants
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Constants where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Constants unwrapConstants2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapConstants2
+
+deriving via Marshal.EquivStorable Constants instance BG.Storable Constants
+
+deriving via BG.CUInt instance BG.Prim Constants
+
+instance CEnum.CEnum Constants where
+
+  type CEnumZ Constants = BG.CUInt
+
+  toCEnum = Constants
+
+  fromCEnum = BG.getField @"unwrapConstants"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "Eq"), (1, BG.singleton "Int"), (2, BG.singleton "True")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Constants"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Constants"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Constants where
+
+  minDeclaredValue = Eq
+
+  maxDeclaredValue = True
+
+instance Show Constants where
+
+  showsPrec = CEnum.shows
+
+instance Read Constants where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapConstants" Constants ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Constants {unwrapConstants = y1}, BG.getField @"unwrapConstants" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapConstants" (BG.Ptr Constants) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConstants")
+
+instance HasCField.HasCField Constants "unwrapConstants" where
+
+  type CFieldType Constants "unwrapConstants" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @Eq@
+
+    __defined at:__ @edge-cases\/prelude_names.h 14:18@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern Eq :: Constants
+pattern Eq = Constants 0
+
+{-| __C declaration:__ @Int@
+
+    __defined at:__ @edge-cases\/prelude_names.h 14:22@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern Int :: Constants
+pattern Int = Constants 1
+
+{-| __C declaration:__ @True@
+
+    __defined at:__ @edge-cases\/prelude_names.h 14:27@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern True :: Constants
+pattern True = Constants 2
+
+{-| __C declaration:__ @enum ordering@
+
+    __defined at:__ @edge-cases\/prelude_names.h 15:6@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype Ordering = Ordering
+  { unwrapOrdering :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Ordering where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Ordering where
+
+  readRaw =
+    \ptr0 ->
+          pure Ordering
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Ordering where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ordering unwrapOrdering2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapOrdering2
+
+deriving via Marshal.EquivStorable Ordering instance BG.Storable Ordering
+
+deriving via BG.CUInt instance BG.Prim Ordering
+
+instance CEnum.CEnum Ordering where
+
+  type CEnumZ Ordering = BG.CUInt
+
+  toCEnum = Ordering
+
+  fromCEnum = BG.getField @"unwrapOrdering"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "LT"), (1, BG.singleton "EQ"), (2, BG.singleton "GT")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Ordering"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Ordering"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Ordering where
+
+  minDeclaredValue = LT
+
+  maxDeclaredValue = GT
+
+instance Show Ordering where
+
+  showsPrec = CEnum.shows
+
+instance Read Ordering where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapOrdering" Ordering ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Ordering {unwrapOrdering = y1}, BG.getField @"unwrapOrdering" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapOrdering" (BG.Ptr Ordering) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapOrdering")
+
+instance HasCField.HasCField Ordering "unwrapOrdering" where
+
+  type CFieldType Ordering "unwrapOrdering" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @LT@
+
+    __defined at:__ @edge-cases\/prelude_names.h 15:17@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern LT :: Ordering
+pattern LT = Ordering 0
+
+{-| __C declaration:__ @EQ@
+
+    __defined at:__ @edge-cases\/prelude_names.h 15:21@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern EQ :: Ordering
+pattern EQ = Ordering 1
+
+{-| __C declaration:__ @GT@
+
+    __defined at:__ @edge-cases\/prelude_names.h 15:25@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern GT :: Ordering
+pattern GT = Ordering 2
+
+{-| __C declaration:__ @Maybe@
+
+    __defined at:__ @edge-cases\/prelude_names.h 16:13@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype Maybe = Maybe
+  { unwrapMaybe :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMaybe" Maybe ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Maybe {unwrapMaybe = y1}, BG.getField @"unwrapMaybe" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMaybe" (BG.Ptr Maybe) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMaybe")
+
+instance HasCField.HasCField Maybe "unwrapMaybe" where
+
+  type CFieldType Maybe "unwrapMaybe" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct Word@
+
+    __defined at:__ @edge-cases\/prelude_names.h 17:8@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+data Word = Word
+  { word_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/prelude_names.h 17:19@
+
+         __exported by:__ @edge-cases\/prelude_names.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Word where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Word where
+
+  readRaw =
+    \ptr0 ->
+          pure Word
+      <*> HasCField.readRaw (BG.Proxy @"word_x") ptr0
+
+instance Marshal.WriteRaw Word where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Word word_x2 ->
+            HasCField.writeRaw (BG.Proxy @"word_x") ptr0 word_x2
+
+deriving via Marshal.EquivStorable Word instance BG.Storable Word
+
+deriving via Struct.IsStructViaReadRaw Word instance Struct.IsStruct Word
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/prelude_names.h 17:19@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "word_x" Word ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> Word {word_x = y1}, BG.getField @"word_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "word_x" (BG.Ptr Word) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"word_x")
+
+instance HasCField.HasCField Word "word_x" where
+
+  type CFieldType Word "word_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro maximum@
+
+    __defined at:__ @edge-cases\/prelude_names.h 21:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+maximum :: BG.CInt
+maximum = (3 :: BG.CInt)
+
+{-| __C declaration:__ @macro twice_maximum@
+
+    __defined at:__ @edge-cases\/prelude_names.h 22:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+twice_maximum :: BG.CInt
+twice_maximum =
+  (C.Expr.HostPlatform.*) (2 :: BG.CInt) maximum
+
+{-| __C declaration:__ @macro readList@
+
+    __defined at:__ @edge-cases\/prelude_names.h 26:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+readList :: BG.CInt
+readList = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro showsPrec@
+
+    __defined at:__ @edge-cases\/prelude_names.h 27:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+showsPrec :: BG.CInt
+showsPrec =
+  (C.Expr.HostPlatform.*) (2 :: BG.CInt) readList
+
+{-| __C declaration:__ @struct Void@
+
+    __defined at:__ @edge-cases\/prelude_names.h 30:8@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+data Void = Void
+  { void_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/prelude_names.h 30:19@
+
+         __exported by:__ @edge-cases\/prelude_names.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Void where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Void where
+
+  readRaw =
+    \ptr0 ->
+          pure Void
+      <*> HasCField.readRaw (BG.Proxy @"void_x") ptr0
+
+instance Marshal.WriteRaw Void where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Void void_x2 ->
+            HasCField.writeRaw (BG.Proxy @"void_x") ptr0 void_x2
+
+deriving via Marshal.EquivStorable Void instance BG.Storable Void
+
+deriving via Struct.IsStructViaReadRaw Void instance Struct.IsStruct Void
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/prelude_names.h 30:19@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "void_x" Void ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> Void {void_x = y1}, BG.getField @"void_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "void_x" (BG.Ptr Void) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"void_x")
+
+instance HasCField.HasCField Void "void_x" where
+
+  type CFieldType Void "void_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/edge-cases/prelude_names/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/prelude_names/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/prelude_names/Example/FunPtr.hs
@@ -0,0 +1,103 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fmap'
+    , Example.FunPtr.reverse
+    , Example.FunPtr.identity
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/prelude_names.h>"
+  , "/* test_edgecasesprelude_names_Example_get_fmap */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_8ec725a8c9df6bc9 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &fmap;"
+  , "}"
+  , "/* test_edgecasesprelude_names_Example_get_reverse */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_a7d70ec0c8acc7e7 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &reverse;"
+  , "}"
+  , "/* test_edgecasesprelude_names_Example_get_identity */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_535374ba193530ae (void)) ("
+  , "  void *arg1"
+  , ")"
+  , "{"
+  , "  return &identity;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesprelude_names_Example_get_fmap@
+foreign import ccall unsafe "hs_bindgen_8ec725a8c9df6bc9" hs_bindgen_8ec725a8c9df6bc9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesprelude_names_Example_get_fmap@
+hs_bindgen_8ec725a8c9df6bc9 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_8ec725a8c9df6bc9 =
+  fmap BG.fromFFIType hs_bindgen_8ec725a8c9df6bc9_base
+
+{-# NOINLINE fmap' #-}
+{-| __C declaration:__ @fmap@
+
+    __defined at:__ @edge-cases\/prelude_names.h 5:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+fmap' :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+fmap' =
+  BG.unsafePerformIO hs_bindgen_8ec725a8c9df6bc9
+
+-- __unique:__ @test_edgecasesprelude_names_Example_get_reverse@
+foreign import ccall unsafe "hs_bindgen_a7d70ec0c8acc7e7" hs_bindgen_a7d70ec0c8acc7e7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesprelude_names_Example_get_reverse@
+hs_bindgen_a7d70ec0c8acc7e7 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_a7d70ec0c8acc7e7 =
+  fmap BG.fromFFIType hs_bindgen_a7d70ec0c8acc7e7_base
+
+{-# NOINLINE reverse #-}
+{-| __C declaration:__ @reverse@
+
+    __defined at:__ @edge-cases\/prelude_names.h 18:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+reverse :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+reverse =
+  BG.unsafePerformIO hs_bindgen_a7d70ec0c8acc7e7
+
+-- __unique:__ @test_edgecasesprelude_names_Example_get_identity@
+foreign import ccall unsafe "hs_bindgen_535374ba193530ae" hs_bindgen_535374ba193530ae_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesprelude_names_Example_get_identity@
+hs_bindgen_535374ba193530ae :: IO (BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void)))
+hs_bindgen_535374ba193530ae =
+  fmap BG.fromFFIType hs_bindgen_535374ba193530ae_base
+
+{-# NOINLINE identity #-}
+{-| __C declaration:__ @identity@
+
+    __defined at:__ @edge-cases\/prelude_names.h 31:7@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+identity :: BG.FunPtr (BG.Ptr BG.Void -> IO (BG.Ptr BG.Void))
+identity =
+  BG.unsafePerformIO hs_bindgen_535374ba193530ae
diff --git a/test-artefacts/fixtures/edge-cases/prelude_names/Example/Global.hs b/test-artefacts/fixtures/edge-cases/prelude_names/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/prelude_names/Example/Global.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.length
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/prelude_names.h>"
+  , "/* test_edgecasesprelude_names_Example_get_length */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_d73ae441829395d0 (void)"
+  , "{"
+  , "  return &length;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesprelude_names_Example_get_length@
+foreign import ccall unsafe "hs_bindgen_d73ae441829395d0" hs_bindgen_d73ae441829395d0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesprelude_names_Example_get_length@
+hs_bindgen_d73ae441829395d0 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_d73ae441829395d0 =
+  fmap BG.fromFFIType hs_bindgen_d73ae441829395d0_base
+
+{-# NOINLINE length #-}
+{-| __C declaration:__ @length@
+
+    __defined at:__ @edge-cases\/prelude_names.h 19:12@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+length :: BG.Ptr BG.CInt
+length =
+  BG.unsafePerformIO hs_bindgen_d73ae441829395d0
diff --git a/test-artefacts/fixtures/edge-cases/prelude_names/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/prelude_names/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/prelude_names/Example/Safe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fmap'
+    , Example.Safe.reverse
+    , Example.Safe.identity
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/prelude_names.h>"
+  , "signed int hs_bindgen_06a0882e0fd9fc01 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (fmap)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_cb71068e35beb37d ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (reverse)(arg1);"
+  , "}"
+  , "void *hs_bindgen_0de5f98d74dd3b0b ("
+  , "  void *arg1"
+  , ")"
+  , "{"
+  , "  return (identity)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_fmap@
+foreign import ccall safe "hs_bindgen_06a0882e0fd9fc01" hs_bindgen_06a0882e0fd9fc01_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_fmap@
+hs_bindgen_06a0882e0fd9fc01 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_06a0882e0fd9fc01 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_06a0882e0fd9fc01_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @fmap@
+
+    __defined at:__ @edge-cases\/prelude_names.h 5:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+fmap' ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+fmap' = hs_bindgen_06a0882e0fd9fc01
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_reverse@
+foreign import ccall safe "hs_bindgen_cb71068e35beb37d" hs_bindgen_cb71068e35beb37d_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_reverse@
+hs_bindgen_cb71068e35beb37d ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_cb71068e35beb37d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cb71068e35beb37d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @reverse@
+
+    __defined at:__ @edge-cases\/prelude_names.h 18:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+reverse ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+reverse = hs_bindgen_cb71068e35beb37d
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_identity@
+foreign import ccall safe "hs_bindgen_0de5f98d74dd3b0b" hs_bindgen_0de5f98d74dd3b0b_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_identity@
+hs_bindgen_0de5f98d74dd3b0b ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_0de5f98d74dd3b0b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0de5f98d74dd3b0b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @identity@
+
+    __defined at:__ @edge-cases\/prelude_names.h 31:7@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+identity ::
+     BG.Ptr BG.Void
+     -- ^ __C declaration:__ @ptr@
+  -> IO (BG.Ptr BG.Void)
+identity = hs_bindgen_0de5f98d74dd3b0b
diff --git a/test-artefacts/fixtures/edge-cases/prelude_names/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/prelude_names/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/prelude_names/Example/Unsafe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fmap'
+    , Example.Unsafe.reverse
+    , Example.Unsafe.identity
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/prelude_names.h>"
+  , "signed int hs_bindgen_b6805fb9ba57fb59 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (fmap)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e4643018a1638d28 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (reverse)(arg1);"
+  , "}"
+  , "void *hs_bindgen_3cdf92558d7dc09d ("
+  , "  void *arg1"
+  , ")"
+  , "{"
+  , "  return (identity)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_fmap@
+foreign import ccall unsafe "hs_bindgen_b6805fb9ba57fb59" hs_bindgen_b6805fb9ba57fb59_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_fmap@
+hs_bindgen_b6805fb9ba57fb59 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_b6805fb9ba57fb59 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b6805fb9ba57fb59_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @fmap@
+
+    __defined at:__ @edge-cases\/prelude_names.h 5:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+fmap' ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+fmap' = hs_bindgen_b6805fb9ba57fb59
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_reverse@
+foreign import ccall unsafe "hs_bindgen_e4643018a1638d28" hs_bindgen_e4643018a1638d28_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_reverse@
+hs_bindgen_e4643018a1638d28 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_e4643018a1638d28 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e4643018a1638d28_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @reverse@
+
+    __defined at:__ @edge-cases\/prelude_names.h 18:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+reverse ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+reverse = hs_bindgen_e4643018a1638d28
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_identity@
+foreign import ccall unsafe "hs_bindgen_3cdf92558d7dc09d" hs_bindgen_3cdf92558d7dc09d_base ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_identity@
+hs_bindgen_3cdf92558d7dc09d ::
+     BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_3cdf92558d7dc09d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3cdf92558d7dc09d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @identity@
+
+    __defined at:__ @edge-cases\/prelude_names.h 31:7@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+identity ::
+     BG.Ptr BG.Void
+     -- ^ __C declaration:__ @ptr@
+  -> IO (BG.Ptr BG.Void)
+identity = hs_bindgen_3cdf92558d7dc09d
diff --git a/test-artefacts/fixtures/edge-cases/prelude_names/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/prelude_names/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/prelude_names/bindingspec.yaml
@@ -0,0 +1,261 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/prelude_names.h
+  cname: struct string
+  hsname: String'
+- headers: edge-cases/prelude_names.h
+  cname: Show
+  hsname: Show'
+- headers: edge-cases/prelude_names.h
+  cname: struct CChar
+  hsname: CChar'
+- headers: edge-cases/prelude_names.h
+  cname: enum c_types
+  hsname: C_types
+  enum: open
+- headers: edge-cases/prelude_names.h
+  cname: enum constants
+  hsname: Constants
+  enum: open
+- headers: edge-cases/prelude_names.h
+  cname: enum ordering
+  hsname: Ordering
+  enum: open
+- headers: edge-cases/prelude_names.h
+  cname: Maybe
+  hsname: Maybe
+- headers: edge-cases/prelude_names.h
+  cname: struct Word
+  hsname: Word
+- headers: edge-cases/prelude_names.h
+  cname: struct Void
+  hsname: Void
+hstypes:
+- hsname: CChar'
+  representation:
+    record:
+      constructor: CChar'
+      fields:
+      - cChar'_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: C_types
+  representation:
+    newtype:
+      constructor: C_types
+      fields:
+      - unwrapC_types
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Constants
+  representation:
+    newtype:
+      constructor: Constants
+      fields:
+      - unwrapConstants
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Maybe
+  representation:
+    newtype:
+      constructor: Maybe
+      fields:
+      - unwrapMaybe
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ordering
+  representation:
+    newtype:
+      constructor: Ordering
+      fields:
+      - unwrapOrdering
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Show'
+  representation:
+    newtype:
+      constructor: Show'
+      fields:
+      - unwrapShow'
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: String'
+  representation:
+    record:
+      constructor: String'
+      fields:
+      - string'_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Void
+  representation:
+    record:
+      constructor: Void
+      fields:
+      - void_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Word
+  representation:
+    record:
+      constructor: Word
+      fields:
+      - word_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/prelude_names/th.txt b/test-artefacts/fixtures/edge-cases/prelude_names/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/prelude_names/th.txt
@@ -0,0 +1,779 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/prelude_names.h
+-- #include <edge-cases/prelude_names.h>
+-- signed int hs_bindgen_06a0882e0fd9fc01 (
+--   signed int arg1
+-- )
+-- {
+--   return (fmap)(arg1);
+-- }
+-- signed int hs_bindgen_cb71068e35beb37d (
+--   signed int arg1
+-- )
+-- {
+--   return (reverse)(arg1);
+-- }
+-- void *hs_bindgen_0de5f98d74dd3b0b (
+--   void *arg1
+-- )
+-- {
+--   return (identity)(arg1);
+-- }
+-- signed int hs_bindgen_b6805fb9ba57fb59 (
+--   signed int arg1
+-- )
+-- {
+--   return (fmap)(arg1);
+-- }
+-- signed int hs_bindgen_e4643018a1638d28 (
+--   signed int arg1
+-- )
+-- {
+--   return (reverse)(arg1);
+-- }
+-- void *hs_bindgen_3cdf92558d7dc09d (
+--   void *arg1
+-- )
+-- {
+--   return (identity)(arg1);
+-- }
+-- /* test_edgecasesprelude_names_Example_get_fmap */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_8ec725a8c9df6bc9 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &fmap;
+-- }
+-- /* test_edgecasesprelude_names_Example_get_reverse */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_a7d70ec0c8acc7e7 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &reverse;
+-- }
+-- /* test_edgecasesprelude_names_Example_get_identity */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_535374ba193530ae (void)) (
+--   void *arg1
+-- )
+-- {
+--   return &identity;
+-- }
+-- /* test_edgecasesprelude_names_Example_get_length */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_d73ae441829395d0 (void)
+-- {
+--   return &length;
+-- }
+{-| __C declaration:__ @struct string@
+
+    __defined at:__ @edge-cases\/prelude_names.h 3:8@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+data String'
+    = String' {string'_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @edge-cases\/prelude_names.h 3:21@
+
+                    __exported by:__ @edge-cases\/prelude_names.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize String'
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw String'
+    where readRaw = \ptr_0 -> pure String' <*> readRaw (Proxy @"string'_x") ptr_0
+instance WriteRaw String'
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       String' string'_x_2 -> writeRaw (Proxy @"string'_x") ptr_0 string'_x_2
+deriving via (EquivStorable String') instance Storable String'
+deriving via (IsStructViaReadRaw String') instance IsStruct String'
+instance (~) ty CInt => HasField "string'_x" String' ty
+    where hasField = \x_0 -> (\y_1 -> String'{string'_x = y_1},
+                              getField @"string'_x" x_0)
+instance (~) ty CInt => HasField "string'_x" (Ptr String') (Ptr ty)
+    where getField = fromPtr (Proxy @"string'_x")
+instance HasCField String' "string'_x"
+    where type CFieldType String' "string'_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @Show@
+
+    __defined at:__ @edge-cases\/prelude_names.h 4:13@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype Show'
+    = Show' {unwrapShow' :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapShow'" Show' ty
+    where hasField = \x_0 -> (\y_1 -> Show'{unwrapShow' = y_1},
+                              getField @"unwrapShow'" x_0)
+instance (~) ty CInt => HasField "unwrapShow'" (Ptr Show') (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapShow'")
+instance HasCField Show' "unwrapShow'"
+    where type CFieldType Show' "unwrapShow'" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct CChar@
+
+    __defined at:__ @edge-cases\/prelude_names.h 9:8@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+data CChar'
+    = CChar' {cChar'_x :: CInt
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @edge-cases\/prelude_names.h 9:20@
+
+                   __exported by:__ @edge-cases\/prelude_names.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize CChar'
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw CChar'
+    where readRaw = \ptr_0 -> pure CChar' <*> readRaw (Proxy @"cChar'_x") ptr_0
+instance WriteRaw CChar'
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       CChar' cChar'_x_2 -> writeRaw (Proxy @"cChar'_x") ptr_0 cChar'_x_2
+deriving via (EquivStorable CChar') instance Storable CChar'
+deriving via (IsStructViaReadRaw CChar') instance IsStruct CChar'
+instance (~) ty CInt => HasField "cChar'_x" CChar' ty
+    where hasField = \x_0 -> (\y_1 -> CChar'{cChar'_x = y_1},
+                              getField @"cChar'_x" x_0)
+instance (~) ty CInt => HasField "cChar'_x" (Ptr CChar') (Ptr ty)
+    where getField = fromPtr (Proxy @"cChar'_x")
+instance HasCField CChar' "cChar'_x"
+    where type CFieldType CChar' "cChar'_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @enum c_types@
+
+    __defined at:__ @edge-cases\/prelude_names.h 10:6@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype C_types
+    = C_types {unwrapC_types :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize C_types
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw C_types
+    where readRaw = \ptr_0 -> pure C_types <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw C_types
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       C_types unwrapC_types_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapC_types_2
+deriving via (EquivStorable C_types) instance Storable C_types
+deriving via CUInt instance Prim C_types
+instance CEnum C_types
+    where type CEnumZ C_types = CUInt
+          toCEnum = C_types
+          fromCEnum = getField @"unwrapC_types"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "CInt'")]
+          showsUndeclared = showsWrappedUndeclared "C_types"
+          readPrecUndeclared = readPrecWrappedUndeclared "C_types"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum C_types
+    where minDeclaredValue = CInt'
+          maxDeclaredValue = CInt'
+instance Show C_types
+    where {-| __C declaration:__ @macro showsPrec@
+
+              __defined at:__ @edge-cases\/prelude_names.h 27:9@
+
+              __exported by:__ @edge-cases\/prelude_names.h@
+          -}
+          showsPrec = shows
+instance Read C_types
+    where readPrec = readPrec
+          {-| __C declaration:__ @macro readList@
+
+              __defined at:__ @edge-cases\/prelude_names.h 26:9@
+
+              __exported by:__ @edge-cases\/prelude_names.h@
+          -}
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapC_types" C_types ty
+    where hasField = \x_0 -> (\y_1 -> C_types{unwrapC_types = y_1},
+                              getField @"unwrapC_types" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapC_types" (Ptr C_types) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapC_types")
+instance HasCField C_types "unwrapC_types"
+    where type CFieldType C_types "unwrapC_types" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @CInt@
+
+    __defined at:__ @edge-cases\/prelude_names.h 10:16@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern CInt' :: C_types
+pattern CInt' = C_types 0
+{-| __C declaration:__ @enum constants@
+
+    __defined at:__ @edge-cases\/prelude_names.h 14:6@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype Constants
+    = Constants {unwrapConstants :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Constants
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Constants
+    where readRaw = \ptr_0 -> pure Constants <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Constants
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Constants unwrapConstants_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapConstants_2
+deriving via (EquivStorable Constants) instance Storable Constants
+deriving via CUInt instance Prim Constants
+instance CEnum Constants
+    where type CEnumZ Constants = CUInt
+          toCEnum = Constants
+          fromCEnum = getField @"unwrapConstants"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "Eq"),
+                                                         (1, singleton "Int"),
+                                                         (2, singleton "True")]
+          showsUndeclared = showsWrappedUndeclared "Constants"
+          readPrecUndeclared = readPrecWrappedUndeclared "Constants"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Constants
+    where minDeclaredValue = Eq
+          maxDeclaredValue = True
+instance Show Constants
+    where {-| __C declaration:__ @macro showsPrec@
+
+              __defined at:__ @edge-cases\/prelude_names.h 27:9@
+
+              __exported by:__ @edge-cases\/prelude_names.h@
+          -}
+          showsPrec = shows
+instance Read Constants
+    where readPrec = readPrec
+          {-| __C declaration:__ @macro readList@
+
+              __defined at:__ @edge-cases\/prelude_names.h 26:9@
+
+              __exported by:__ @edge-cases\/prelude_names.h@
+          -}
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapConstants" Constants ty
+    where hasField = \x_0 -> (\y_1 -> Constants{unwrapConstants = y_1},
+                              getField @"unwrapConstants" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapConstants" (Ptr Constants) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConstants")
+instance HasCField Constants "unwrapConstants"
+    where type CFieldType Constants "unwrapConstants" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @Eq@
+
+    __defined at:__ @edge-cases\/prelude_names.h 14:18@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern Eq :: Constants
+pattern Eq = Constants 0
+{-| __C declaration:__ @Int@
+
+    __defined at:__ @edge-cases\/prelude_names.h 14:22@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern Int :: Constants
+pattern Int = Constants 1
+{-| __C declaration:__ @True@
+
+    __defined at:__ @edge-cases\/prelude_names.h 14:27@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern True :: Constants
+pattern True = Constants 2
+{-| __C declaration:__ @enum ordering@
+
+    __defined at:__ @edge-cases\/prelude_names.h 15:6@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype Ordering
+    = Ordering {unwrapOrdering :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Ordering
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Ordering
+    where readRaw = \ptr_0 -> pure Ordering <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Ordering
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ordering unwrapOrdering_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapOrdering_2
+deriving via (EquivStorable Ordering) instance Storable Ordering
+deriving via CUInt instance Prim Ordering
+instance CEnum Ordering
+    where type CEnumZ Ordering = CUInt
+          toCEnum = Ordering
+          fromCEnum = getField @"unwrapOrdering"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "LT"),
+                                                         (1, singleton "EQ"),
+                                                         (2, singleton "GT")]
+          showsUndeclared = showsWrappedUndeclared "Ordering"
+          readPrecUndeclared = readPrecWrappedUndeclared "Ordering"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Ordering
+    where minDeclaredValue = LT
+          maxDeclaredValue = GT
+instance Show Ordering
+    where {-| __C declaration:__ @macro showsPrec@
+
+              __defined at:__ @edge-cases\/prelude_names.h 27:9@
+
+              __exported by:__ @edge-cases\/prelude_names.h@
+          -}
+          showsPrec = shows
+instance Read Ordering
+    where readPrec = readPrec
+          {-| __C declaration:__ @macro readList@
+
+              __defined at:__ @edge-cases\/prelude_names.h 26:9@
+
+              __exported by:__ @edge-cases\/prelude_names.h@
+          -}
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapOrdering" Ordering ty
+    where hasField = \x_0 -> (\y_1 -> Ordering{unwrapOrdering = y_1},
+                              getField @"unwrapOrdering" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapOrdering" (Ptr Ordering) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapOrdering")
+instance HasCField Ordering "unwrapOrdering"
+    where type CFieldType Ordering "unwrapOrdering" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @LT@
+
+    __defined at:__ @edge-cases\/prelude_names.h 15:17@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern LT :: Ordering
+pattern LT = Ordering 0
+{-| __C declaration:__ @EQ@
+
+    __defined at:__ @edge-cases\/prelude_names.h 15:21@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern EQ :: Ordering
+pattern EQ = Ordering 1
+{-| __C declaration:__ @GT@
+
+    __defined at:__ @edge-cases\/prelude_names.h 15:25@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+pattern GT :: Ordering
+pattern GT = Ordering 2
+{-| __C declaration:__ @Maybe@
+
+    __defined at:__ @edge-cases\/prelude_names.h 16:13@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+newtype Maybe
+    = Maybe {unwrapMaybe :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMaybe" Maybe ty
+    where hasField = \x_0 -> (\y_1 -> Maybe{unwrapMaybe = y_1},
+                              getField @"unwrapMaybe" x_0)
+instance (~) ty CInt => HasField "unwrapMaybe" (Ptr Maybe) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMaybe")
+instance HasCField Maybe "unwrapMaybe"
+    where type CFieldType Maybe "unwrapMaybe" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct Word@
+
+    __defined at:__ @edge-cases\/prelude_names.h 17:8@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+data Word
+    = Word {word_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @edge-cases\/prelude_names.h 17:19@
+
+                 __exported by:__ @edge-cases\/prelude_names.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Word
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Word
+    where readRaw = \ptr_0 -> pure Word <*> readRaw (Proxy @"word_x") ptr_0
+instance WriteRaw Word
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Word word_x_2 -> writeRaw (Proxy @"word_x") ptr_0 word_x_2
+deriving via (EquivStorable Word) instance Storable Word
+deriving via (IsStructViaReadRaw Word) instance IsStruct Word
+instance (~) ty CInt => HasField "word_x" Word ty
+    where hasField = \x_0 -> (\y_1 -> Word{word_x = y_1},
+                              getField @"word_x" x_0)
+instance (~) ty CInt => HasField "word_x" (Ptr Word) (Ptr ty)
+    where getField = fromPtr (Proxy @"word_x")
+instance HasCField Word "word_x"
+    where type CFieldType Word "word_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro maximum@
+
+    __defined at:__ @edge-cases\/prelude_names.h 21:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+maximum :: CInt
+{-| __C declaration:__ @macro maximum@
+
+    __defined at:__ @edge-cases\/prelude_names.h 21:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+maximum = 3 :: CInt
+{-| __C declaration:__ @macro twice_maximum@
+
+    __defined at:__ @edge-cases\/prelude_names.h 22:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+twice_maximum :: CInt
+{-| __C declaration:__ @macro twice_maximum@
+
+    __defined at:__ @edge-cases\/prelude_names.h 22:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+twice_maximum = (*) (2 :: CInt) maximum
+{-| __C declaration:__ @macro readList@
+
+    __defined at:__ @edge-cases\/prelude_names.h 26:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+readList :: CInt
+{-| __C declaration:__ @macro readList@
+
+    __defined at:__ @edge-cases\/prelude_names.h 26:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+readList = 1 :: CInt
+{-| __C declaration:__ @macro showsPrec@
+
+    __defined at:__ @edge-cases\/prelude_names.h 27:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+showsPrec :: CInt
+{-| __C declaration:__ @macro showsPrec@
+
+    __defined at:__ @edge-cases\/prelude_names.h 27:9@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+showsPrec = (*) (2 :: CInt) readList
+{-| __C declaration:__ @struct Void@
+
+    __defined at:__ @edge-cases\/prelude_names.h 30:8@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+data Void
+    = Void {void_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @edge-cases\/prelude_names.h 30:19@
+
+                 __exported by:__ @edge-cases\/prelude_names.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Void
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Void
+    where readRaw = \ptr_0 -> pure Void <*> readRaw (Proxy @"void_x") ptr_0
+instance WriteRaw Void
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Void void_x_2 -> writeRaw (Proxy @"void_x") ptr_0 void_x_2
+deriving via (EquivStorable Void) instance Storable Void
+deriving via (IsStructViaReadRaw Void) instance IsStruct Void
+instance (~) ty CInt => HasField "void_x" Void ty
+    where hasField = \x_0 -> (\y_1 -> Void{void_x = y_1},
+                              getField @"void_x" x_0)
+instance (~) ty CInt => HasField "void_x" (Ptr Void) (Ptr ty)
+    where getField = fromPtr (Proxy @"void_x")
+instance HasCField Void "void_x"
+    where type CFieldType Void "void_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_fmap@
+foreign import ccall safe "hs_bindgen_06a0882e0fd9fc01" hs_bindgen_06a0882e0fd9fc01_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_fmap@
+hs_bindgen_06a0882e0fd9fc01 :: CInt -> IO CInt
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_fmap@
+hs_bindgen_06a0882e0fd9fc01 = \x_0 -> fmap fromFFIType (hs_bindgen_06a0882e0fd9fc01_base (toFFIType x_0))
+{-| __C declaration:__ @fmap@
+
+    __defined at:__ @edge-cases\/prelude_names.h 5:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+fmap'_safe :: CInt -> IO CInt
+{-| __C declaration:__ @fmap@
+
+    __defined at:__ @edge-cases\/prelude_names.h 5:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+fmap'_safe = hs_bindgen_06a0882e0fd9fc01
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_reverse@
+foreign import ccall safe "hs_bindgen_cb71068e35beb37d" hs_bindgen_cb71068e35beb37d_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_reverse@
+hs_bindgen_cb71068e35beb37d :: CInt -> IO CInt
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_reverse@
+hs_bindgen_cb71068e35beb37d = \x_0 -> fmap fromFFIType (hs_bindgen_cb71068e35beb37d_base (toFFIType x_0))
+{-| __C declaration:__ @reverse@
+
+    __defined at:__ @edge-cases\/prelude_names.h 18:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+reverse_safe :: CInt -> IO CInt
+{-| __C declaration:__ @reverse@
+
+    __defined at:__ @edge-cases\/prelude_names.h 18:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+reverse_safe = hs_bindgen_cb71068e35beb37d
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_identity@
+foreign import ccall safe "hs_bindgen_0de5f98d74dd3b0b" hs_bindgen_0de5f98d74dd3b0b_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_identity@
+hs_bindgen_0de5f98d74dd3b0b :: Ptr Void -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesprelude_names_Example_Safe_identity@
+hs_bindgen_0de5f98d74dd3b0b = \x_0 -> fmap fromFFIType (hs_bindgen_0de5f98d74dd3b0b_base (toFFIType x_0))
+{-| __C declaration:__ @identity@
+
+    __defined at:__ @edge-cases\/prelude_names.h 31:7@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+identity_safe :: Ptr Void -> IO (Ptr Void)
+{-| __C declaration:__ @identity@
+
+    __defined at:__ @edge-cases\/prelude_names.h 31:7@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+identity_safe = hs_bindgen_0de5f98d74dd3b0b
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_fmap@
+foreign import ccall unsafe "hs_bindgen_b6805fb9ba57fb59" hs_bindgen_b6805fb9ba57fb59_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_fmap@
+hs_bindgen_b6805fb9ba57fb59 :: CInt -> IO CInt
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_fmap@
+hs_bindgen_b6805fb9ba57fb59 = \x_0 -> fmap fromFFIType (hs_bindgen_b6805fb9ba57fb59_base (toFFIType x_0))
+{-| __C declaration:__ @fmap@
+
+    __defined at:__ @edge-cases\/prelude_names.h 5:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+fmap'_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @fmap@
+
+    __defined at:__ @edge-cases\/prelude_names.h 5:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+fmap'_unsafe = hs_bindgen_b6805fb9ba57fb59
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_reverse@
+foreign import ccall unsafe "hs_bindgen_e4643018a1638d28" hs_bindgen_e4643018a1638d28_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_reverse@
+hs_bindgen_e4643018a1638d28 :: CInt -> IO CInt
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_reverse@
+hs_bindgen_e4643018a1638d28 = \x_0 -> fmap fromFFIType (hs_bindgen_e4643018a1638d28_base (toFFIType x_0))
+{-| __C declaration:__ @reverse@
+
+    __defined at:__ @edge-cases\/prelude_names.h 18:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+reverse_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @reverse@
+
+    __defined at:__ @edge-cases\/prelude_names.h 18:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+reverse_unsafe = hs_bindgen_e4643018a1638d28
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_identity@
+foreign import ccall unsafe "hs_bindgen_3cdf92558d7dc09d" hs_bindgen_3cdf92558d7dc09d_base ::
+    Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_identity@
+hs_bindgen_3cdf92558d7dc09d :: Ptr Void -> IO (Ptr Void)
+-- __unique:__ @test_edgecasesprelude_names_Example_Unsafe_identity@
+hs_bindgen_3cdf92558d7dc09d = \x_0 -> fmap fromFFIType (hs_bindgen_3cdf92558d7dc09d_base (toFFIType x_0))
+{-| __C declaration:__ @identity@
+
+    __defined at:__ @edge-cases\/prelude_names.h 31:7@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+identity_unsafe :: Ptr Void -> IO (Ptr Void)
+{-| __C declaration:__ @identity@
+
+    __defined at:__ @edge-cases\/prelude_names.h 31:7@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+identity_unsafe = hs_bindgen_3cdf92558d7dc09d
+-- __unique:__ @test_edgecasesprelude_names_Example_get_fmap@
+foreign import ccall unsafe "hs_bindgen_8ec725a8c9df6bc9" hs_bindgen_8ec725a8c9df6bc9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesprelude_names_Example_get_fmap@
+hs_bindgen_8ec725a8c9df6bc9 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_edgecasesprelude_names_Example_get_fmap@
+hs_bindgen_8ec725a8c9df6bc9 = fmap fromFFIType hs_bindgen_8ec725a8c9df6bc9_base
+{-# NOINLINE fmap'_funptr #-}
+{-| __C declaration:__ @fmap@
+
+    __defined at:__ @edge-cases\/prelude_names.h 5:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+fmap'_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @fmap@
+
+    __defined at:__ @edge-cases\/prelude_names.h 5:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+fmap'_funptr = unsafePerformIO hs_bindgen_8ec725a8c9df6bc9
+-- __unique:__ @test_edgecasesprelude_names_Example_get_reverse@
+foreign import ccall unsafe "hs_bindgen_a7d70ec0c8acc7e7" hs_bindgen_a7d70ec0c8acc7e7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesprelude_names_Example_get_reverse@
+hs_bindgen_a7d70ec0c8acc7e7 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_edgecasesprelude_names_Example_get_reverse@
+hs_bindgen_a7d70ec0c8acc7e7 = fmap fromFFIType hs_bindgen_a7d70ec0c8acc7e7_base
+{-# NOINLINE reverse_funptr #-}
+{-| __C declaration:__ @reverse@
+
+    __defined at:__ @edge-cases\/prelude_names.h 18:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+reverse_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @reverse@
+
+    __defined at:__ @edge-cases\/prelude_names.h 18:5@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+reverse_funptr = unsafePerformIO hs_bindgen_a7d70ec0c8acc7e7
+-- __unique:__ @test_edgecasesprelude_names_Example_get_identity@
+foreign import ccall unsafe "hs_bindgen_535374ba193530ae" hs_bindgen_535374ba193530ae_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesprelude_names_Example_get_identity@
+hs_bindgen_535374ba193530ae :: IO (FunPtr (Ptr Void ->
+                                           IO (Ptr Void)))
+-- __unique:__ @test_edgecasesprelude_names_Example_get_identity@
+hs_bindgen_535374ba193530ae = fmap fromFFIType hs_bindgen_535374ba193530ae_base
+{-# NOINLINE identity_funptr #-}
+{-| __C declaration:__ @identity@
+
+    __defined at:__ @edge-cases\/prelude_names.h 31:7@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+identity_funptr :: FunPtr (Ptr Void -> IO (Ptr Void))
+{-| __C declaration:__ @identity@
+
+    __defined at:__ @edge-cases\/prelude_names.h 31:7@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+identity_funptr = unsafePerformIO hs_bindgen_535374ba193530ae
+-- __unique:__ @test_edgecasesprelude_names_Example_get_length@
+foreign import ccall unsafe "hs_bindgen_d73ae441829395d0" hs_bindgen_d73ae441829395d0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_edgecasesprelude_names_Example_get_length@
+hs_bindgen_d73ae441829395d0 :: IO (Ptr CInt)
+-- __unique:__ @test_edgecasesprelude_names_Example_get_length@
+hs_bindgen_d73ae441829395d0 = fmap fromFFIType hs_bindgen_d73ae441829395d0_base
+{-# NOINLINE length #-}
+{-| __C declaration:__ @length@
+
+    __defined at:__ @edge-cases\/prelude_names.h 19:12@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+length :: Ptr CInt
+{-| __C declaration:__ @length@
+
+    __defined at:__ @edge-cases\/prelude_names.h 19:12@
+
+    __exported by:__ @edge-cases\/prelude_names.h@
+-}
+length = unsafePerformIO hs_bindgen_d73ae441829395d0
diff --git a/test-artefacts/fixtures/edge-cases/select_no_match/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/select_no_match/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/select_no_match/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/edge-cases/select_no_match/th.txt b/test-artefacts/fixtures/edge-cases/select_no_match/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/select_no_match/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/select_no_match.h
diff --git a/test-artefacts/fixtures/edge-cases/spec_examples/Example.hs b/test-artefacts/fixtures/edge-cases/spec_examples/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/spec_examples/Example.hs
@@ -0,0 +1,562 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Int16_T(..)
+    , Example.Int32_T(..)
+    , Example.Int64_T(..)
+    , Example.Cint16_T(..)
+    , Example.B(..)
+    , Example.A(..)
+    , Example.C
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @int16_T@
+
+    __defined at:__ @edge-cases\/spec_examples.h 10:15@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+newtype Int16_T = Int16_T
+  { unwrapInt16_T :: BG.CShort
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "unwrapInt16_T" Int16_T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Int16_T {unwrapInt16_T = y1}, BG.getField @"unwrapInt16_T" x0)
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "unwrapInt16_T" (BG.Ptr Int16_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt16_T")
+
+instance HasCField.HasCField Int16_T "unwrapInt16_T" where
+
+  type CFieldType Int16_T "unwrapInt16_T" = BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int32_T@
+
+    __defined at:__ @edge-cases\/spec_examples.h 11:13@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+newtype Int32_T = Int32_T
+  { unwrapInt32_T :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapInt32_T" Int32_T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Int32_T {unwrapInt32_T = y1}, BG.getField @"unwrapInt32_T" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapInt32_T" (BG.Ptr Int32_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt32_T")
+
+instance HasCField.HasCField Int32_T "unwrapInt32_T" where
+
+  type CFieldType Int32_T "unwrapInt32_T" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int64_T@
+
+    __defined at:__ @edge-cases\/spec_examples.h 12:19@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+newtype Int64_T = Int64_T
+  { unwrapInt64_T :: BG.CLLong
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "unwrapInt64_T" Int64_T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Int64_T {unwrapInt64_T = y1}, BG.getField @"unwrapInt64_T" x0)
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "unwrapInt64_T" (BG.Ptr Int64_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt64_T")
+
+instance HasCField.HasCField Int64_T "unwrapInt64_T" where
+
+  type CFieldType Int64_T "unwrapInt64_T" = BG.CLLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct cint16_T@
+
+    __defined at:__ @edge-cases\/spec_examples.h 14:9@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+data Cint16_T = Cint16_T
+  { cint16_T_re :: Int16_T
+    {- ^ __C declaration:__ @re@
+
+         __defined at:__ @edge-cases\/spec_examples.h 15:11@
+
+         __exported by:__ @edge-cases\/spec_examples.h@
+    -}
+  , cint16_T_im :: Int16_T
+    {- ^ __C declaration:__ @im@
+
+         __defined at:__ @edge-cases\/spec_examples.h 16:11@
+
+         __exported by:__ @edge-cases\/spec_examples.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Cint16_T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Cint16_T where
+
+  readRaw =
+    \ptr0 ->
+          pure Cint16_T
+      <*> HasCField.readRaw (BG.Proxy @"cint16_T_re") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"cint16_T_im") ptr0
+
+instance Marshal.WriteRaw Cint16_T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Cint16_T cint16_T_re2 cint16_T_im3 ->
+               HasCField.writeRaw (BG.Proxy @"cint16_T_re") ptr0 cint16_T_re2
+            >> HasCField.writeRaw (BG.Proxy @"cint16_T_im") ptr0 cint16_T_im3
+
+deriving via Marshal.EquivStorable Cint16_T instance BG.Storable Cint16_T
+
+deriving via Struct.IsStructViaReadRaw Cint16_T instance Struct.IsStruct Cint16_T
+
+{-| __C declaration:__ @re@
+
+    __defined at:__ @edge-cases\/spec_examples.h 15:11@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+instance ( ty ~ Int16_T
+         ) => BG.CompatHasField.HasField "cint16_T_re" Cint16_T ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Cint16_T {cint16_T_re = y1, cint16_T_im = BG.getField @"cint16_T_im" x0}
+      , BG.getField @"cint16_T_re" x0
+      )
+
+instance ( ty ~ Int16_T
+         ) => BG.HasField "cint16_T_re" (BG.Ptr Cint16_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"cint16_T_re")
+
+instance HasCField.HasCField Cint16_T "cint16_T_re" where
+
+  type CFieldType Cint16_T "cint16_T_re" = Int16_T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @im@
+
+    __defined at:__ @edge-cases\/spec_examples.h 16:11@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+instance ( ty ~ Int16_T
+         ) => BG.CompatHasField.HasField "cint16_T_im" Cint16_T ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Cint16_T {cint16_T_im = y1, cint16_T_re = BG.getField @"cint16_T_re" x0}
+      , BG.getField @"cint16_T_im" x0
+      )
+
+instance ( ty ~ Int16_T
+         ) => BG.HasField "cint16_T_im" (BG.Ptr Cint16_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"cint16_T_im")
+
+instance HasCField.HasCField Cint16_T "cint16_T_im" where
+
+  type CFieldType Cint16_T "cint16_T_im" = Int16_T
+
+  offset# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @struct B@
+
+    __defined at:__ @edge-cases\/spec_examples.h 19:8@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+data B = B
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize B where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw B where
+
+  readRaw = \ptr0 -> pure B
+
+instance Marshal.WriteRaw B where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          B -> pure ()
+
+deriving via Marshal.EquivStorable B instance BG.Storable B
+
+deriving via Struct.IsStructViaReadRaw B instance Struct.IsStruct B
+
+{-| __C declaration:__ @struct A@
+
+    __defined at:__ @edge-cases\/spec_examples.h 23:8@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+data A = A
+  { a_x :: BG.CDouble
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/spec_examples.h 24:10@
+
+         __exported by:__ @edge-cases\/spec_examples.h@
+    -}
+  , a_label :: BG.Ptr BG.CChar
+    {- ^ __C declaration:__ @label@
+
+         __defined at:__ @edge-cases\/spec_examples.h 25:9@
+
+         __exported by:__ @edge-cases\/spec_examples.h@
+    -}
+  , a_samples :: CA.ConstantArray 128 BG.CChar
+    {- ^ __C declaration:__ @samples@
+
+         __defined at:__ @edge-cases\/spec_examples.h 26:8@
+
+         __exported by:__ @edge-cases\/spec_examples.h@
+    -}
+  , a_b :: B
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @edge-cases\/spec_examples.h 27:12@
+
+         __exported by:__ @edge-cases\/spec_examples.h@
+    -}
+  , a_c :: BG.Ptr C
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @edge-cases\/spec_examples.h 28:13@
+
+         __exported by:__ @edge-cases\/spec_examples.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize A where
+
+  staticSizeOf = \_ -> (152 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw A where
+
+  readRaw =
+    \ptr0 ->
+          pure A
+      <*> HasCField.readRaw (BG.Proxy @"a_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_label") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_samples") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a_c") ptr0
+
+instance Marshal.WriteRaw A where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          A a_x2 a_label3 a_samples4 a_b5 a_c6 ->
+               HasCField.writeRaw (BG.Proxy @"a_x") ptr0 a_x2
+            >> HasCField.writeRaw (BG.Proxy @"a_label") ptr0 a_label3
+            >> HasCField.writeRaw (BG.Proxy @"a_samples") ptr0 a_samples4
+            >> HasCField.writeRaw (BG.Proxy @"a_b") ptr0 a_b5
+            >> HasCField.writeRaw (BG.Proxy @"a_c") ptr0 a_c6
+
+deriving via Marshal.EquivStorable A instance BG.Storable A
+
+deriving via Struct.IsStructViaReadRaw A instance Struct.IsStruct A
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/spec_examples.h 24:10@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+instance (ty ~ BG.CDouble) => BG.CompatHasField.HasField "a_x" A ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A { a_x = y1
+            , a_label = BG.getField @"a_label" x0
+            , a_samples = BG.getField @"a_samples" x0
+            , a_b = BG.getField @"a_b" x0
+            , a_c = BG.getField @"a_c" x0
+            }
+      , BG.getField @"a_x" x0
+      )
+
+instance (ty ~ BG.CDouble) => BG.HasField "a_x" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a_x")
+
+instance HasCField.HasCField A "a_x" where
+
+  type CFieldType A "a_x" = BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @label@
+
+    __defined at:__ @edge-cases\/spec_examples.h 25:9@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.CompatHasField.HasField "a_label" A ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A { a_label = y1
+            , a_x = BG.getField @"a_x" x0
+            , a_samples = BG.getField @"a_samples" x0
+            , a_b = BG.getField @"a_b" x0
+            , a_c = BG.getField @"a_c" x0
+            }
+      , BG.getField @"a_label" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CChar
+         ) => BG.HasField "a_label" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a_label")
+
+instance HasCField.HasCField A "a_label" where
+
+  type CFieldType A "a_label" = BG.Ptr BG.CChar
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @samples@
+
+    __defined at:__ @edge-cases\/spec_examples.h 26:8@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+instance ( ty ~ CA.ConstantArray 128 BG.CChar
+         ) => BG.CompatHasField.HasField "a_samples" A ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A { a_samples = y1
+            , a_x = BG.getField @"a_x" x0
+            , a_label = BG.getField @"a_label" x0
+            , a_b = BG.getField @"a_b" x0
+            , a_c = BG.getField @"a_c" x0
+            }
+      , BG.getField @"a_samples" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 128 BG.CChar
+         ) => BG.HasField "a_samples" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a_samples")
+
+instance HasCField.HasCField A "a_samples" where
+
+  type CFieldType A "a_samples" =
+    CA.ConstantArray 128 BG.CChar
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @edge-cases\/spec_examples.h 27:12@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+instance (ty ~ B) => BG.CompatHasField.HasField "a_b" A ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A { a_b = y1
+            , a_x = BG.getField @"a_x" x0
+            , a_label = BG.getField @"a_label" x0
+            , a_samples = BG.getField @"a_samples" x0
+            , a_c = BG.getField @"a_c" x0
+            }
+      , BG.getField @"a_b" x0
+      )
+
+instance (ty ~ B) => BG.HasField "a_b" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a_b")
+
+instance HasCField.HasCField A "a_b" where
+
+  type CFieldType A "a_b" = B
+
+  offset# = \_ -> \_ -> 144
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @edge-cases\/spec_examples.h 28:13@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+instance (ty ~ BG.Ptr C) => BG.CompatHasField.HasField "a_c" A ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          A { a_c = y1
+            , a_x = BG.getField @"a_x" x0
+            , a_label = BG.getField @"a_label" x0
+            , a_samples = BG.getField @"a_samples" x0
+            , a_b = BG.getField @"a_b" x0
+            }
+      , BG.getField @"a_c" x0
+      )
+
+instance (ty ~ BG.Ptr C) => BG.HasField "a_c" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a_c")
+
+instance HasCField.HasCField A "a_c" where
+
+  type CFieldType A "a_c" = BG.Ptr C
+
+  offset# = \_ -> \_ -> 144
+
+{-| __C declaration:__ @struct C@
+
+    __defined at:__ @edge-cases\/spec_examples.h 28:10@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+data C
diff --git a/test-artefacts/fixtures/edge-cases/spec_examples/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/spec_examples/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/spec_examples/Example/FunPtr.hs
@@ -0,0 +1,53 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.resample
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/spec_examples.h>"
+  , "/* test_edgecasesspec_examples_Example_get_resample */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2b8fc800dad87ec8 (void)) ("
+  , "  int32_T *arg1,"
+  , "  cint16_T *arg2,"
+  , "  int64_T arg3,"
+  , "  int64_T arg4,"
+  , "  cint16_T *arg5"
+  , ")"
+  , "{"
+  , "  return &resample;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesspec_examples_Example_get_resample@
+foreign import ccall unsafe "hs_bindgen_2b8fc800dad87ec8" hs_bindgen_2b8fc800dad87ec8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesspec_examples_Example_get_resample@
+hs_bindgen_2b8fc800dad87ec8 :: IO (BG.FunPtr (BG.Ptr Int32_T -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T)) -> Int64_T -> Int64_T -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T)) -> IO ()))
+hs_bindgen_2b8fc800dad87ec8 =
+  fmap BG.fromFFIType hs_bindgen_2b8fc800dad87ec8_base
+
+{-# NOINLINE resample #-}
+{-| __C declaration:__ @resample@
+
+    __defined at:__ @edge-cases\/spec_examples.h 31:6@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+resample :: BG.FunPtr (BG.Ptr Int32_T -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T)) -> Int64_T -> Int64_T -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T)) -> IO ())
+resample =
+  BG.unsafePerformIO hs_bindgen_2b8fc800dad87ec8
diff --git a/test-artefacts/fixtures/edge-cases/spec_examples/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/spec_examples/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/spec_examples/Example/Safe.hs
@@ -0,0 +1,76 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.resample
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/spec_examples.h>"
+  , "void hs_bindgen_8a72aafc705daf44 ("
+  , "  int32_T *arg1,"
+  , "  cint16_T *arg2,"
+  , "  int64_T arg3,"
+  , "  int64_T arg4,"
+  , "  cint16_T *arg5"
+  , ")"
+  , "{"
+  , "  (resample)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
+foreign import ccall safe "hs_bindgen_8a72aafc705daf44" hs_bindgen_8a72aafc705daf44_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CLLong
+  -> BG.CLLong
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
+hs_bindgen_8a72aafc705daf44 ::
+     BG.Ptr Int32_T
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T))
+  -> Int64_T
+  -> Int64_T
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T))
+  -> IO ()
+hs_bindgen_8a72aafc705daf44 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            hs_bindgen_8a72aafc705daf44_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4)
+
+{-| __C declaration:__ @resample@
+
+    __defined at:__ @edge-cases\/spec_examples.h 31:6@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+resample ::
+     BG.Ptr Int32_T
+     -- ^ __C declaration:__ @res_m_num_valid_samples@
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T))
+     -- ^ __C declaration:__ @res_m_iq_int@
+  -> Int64_T
+     -- ^ __C declaration:__ @res_m_old_rate@
+  -> Int64_T
+     -- ^ __C declaration:__ @res_m_new_rate@
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T))
+     -- ^ __C declaration:__ @res_m_iq_resampled_int@
+  -> IO ()
+resample = hs_bindgen_8a72aafc705daf44
diff --git a/test-artefacts/fixtures/edge-cases/spec_examples/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/spec_examples/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/spec_examples/Example/Unsafe.hs
@@ -0,0 +1,76 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.resample
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/spec_examples.h>"
+  , "void hs_bindgen_2311fa9c0d0d6d06 ("
+  , "  int32_T *arg1,"
+  , "  cint16_T *arg2,"
+  , "  int64_T arg3,"
+  , "  int64_T arg4,"
+  , "  cint16_T *arg5"
+  , ")"
+  , "{"
+  , "  (resample)(arg1, arg2, arg3, arg4, arg5);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
+foreign import ccall unsafe "hs_bindgen_2311fa9c0d0d6d06" hs_bindgen_2311fa9c0d0d6d06_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CLLong
+  -> BG.CLLong
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
+hs_bindgen_2311fa9c0d0d6d06 ::
+     BG.Ptr Int32_T
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T))
+  -> Int64_T
+  -> Int64_T
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T))
+  -> IO ()
+hs_bindgen_2311fa9c0d0d6d06 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          \x4 ->
+            hs_bindgen_2311fa9c0d0d6d06_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3) (BG.toFFIType x4)
+
+{-| __C declaration:__ @resample@
+
+    __defined at:__ @edge-cases\/spec_examples.h 31:6@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+resample ::
+     BG.Ptr Int32_T
+     -- ^ __C declaration:__ @res_m_num_valid_samples@
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T))
+     -- ^ __C declaration:__ @res_m_iq_int@
+  -> Int64_T
+     -- ^ __C declaration:__ @res_m_old_rate@
+  -> Int64_T
+     -- ^ __C declaration:__ @res_m_new_rate@
+  -> BG.Ptr (IsA.Elem (CA.ConstantArray 30720000 Cint16_T))
+     -- ^ __C declaration:__ @res_m_iq_resampled_int@
+  -> IO ()
+resample = hs_bindgen_2311fa9c0d0d6d06
diff --git a/test-artefacts/fixtures/edge-cases/spec_examples/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/spec_examples/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/spec_examples/bindingspec.yaml
@@ -0,0 +1,191 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/spec_examples.h
+  cname: int16_T
+  hsname: Int16_T
+- headers: edge-cases/spec_examples.h
+  cname: int32_T
+  hsname: Int32_T
+- headers: edge-cases/spec_examples.h
+  cname: int64_T
+  hsname: Int64_T
+- headers: edge-cases/spec_examples.h
+  cname: struct cint16_T
+  hsname: Cint16_T
+- headers: edge-cases/spec_examples.h
+  cname: cint16_T
+  hsname: Cint16_T
+- headers: edge-cases/spec_examples.h
+  cname: struct B
+  hsname: B
+- headers: edge-cases/spec_examples.h
+  cname: struct A
+  hsname: A
+- headers: edge-cases/spec_examples.h
+  cname: struct C
+  hsname: C
+hstypes:
+- hsname: A
+  representation:
+    record:
+      constructor: A
+      fields:
+      - a_x
+      - a_label
+      - a_samples
+      - a_b
+      - a_c
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    record:
+      constructor: B
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: C
+  representation: emptydata
+- hsname: Cint16_T
+  representation:
+    record:
+      constructor: Cint16_T
+      fields:
+      - cint16_T_re
+      - cint16_T_im
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int16_T
+  representation:
+    newtype:
+      constructor: Int16_T
+      fields:
+      - unwrapInt16_T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CShort
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int32_T
+  representation:
+    newtype:
+      constructor: Int32_T
+      fields:
+      - unwrapInt32_T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int64_T
+  representation:
+    newtype:
+      constructor: Int64_T
+      fields:
+      - unwrapInt64_T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CLLong
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/spec_examples/th.txt b/test-artefacts/fixtures/edge-cases/spec_examples/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/spec_examples/th.txt
@@ -0,0 +1,422 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/spec_examples.h
+-- #include <edge-cases/spec_examples.h>
+-- void hs_bindgen_8a72aafc705daf44 (
+--   int32_T *arg1,
+--   cint16_T *arg2,
+--   int64_T arg3,
+--   int64_T arg4,
+--   cint16_T *arg5
+-- )
+-- {
+--   (resample)(arg1, arg2, arg3, arg4, arg5);
+-- }
+-- void hs_bindgen_2311fa9c0d0d6d06 (
+--   int32_T *arg1,
+--   cint16_T *arg2,
+--   int64_T arg3,
+--   int64_T arg4,
+--   cint16_T *arg5
+-- )
+-- {
+--   (resample)(arg1, arg2, arg3, arg4, arg5);
+-- }
+-- /* test_edgecasesspec_examples_Example_get_resample */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2b8fc800dad87ec8 (void)) (
+--   int32_T *arg1,
+--   cint16_T *arg2,
+--   int64_T arg3,
+--   int64_T arg4,
+--   cint16_T *arg5
+-- )
+-- {
+--   return &resample;
+-- }
+{-| __C declaration:__ @int16_T@
+
+    __defined at:__ @edge-cases\/spec_examples.h 10:15@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+newtype Int16_T
+    = Int16_T {unwrapInt16_T :: CShort}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CShort => HasField "unwrapInt16_T" Int16_T ty
+    where hasField = \x_0 -> (\y_1 -> Int16_T{unwrapInt16_T = y_1},
+                              getField @"unwrapInt16_T" x_0)
+instance (~) ty CShort =>
+         HasField "unwrapInt16_T" (Ptr Int16_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt16_T")
+instance HasCField Int16_T "unwrapInt16_T"
+    where type CFieldType Int16_T "unwrapInt16_T" = CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int32_T@
+
+    __defined at:__ @edge-cases\/spec_examples.h 11:13@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+newtype Int32_T
+    = Int32_T {unwrapInt32_T :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapInt32_T" Int32_T ty
+    where hasField = \x_0 -> (\y_1 -> Int32_T{unwrapInt32_T = y_1},
+                              getField @"unwrapInt32_T" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapInt32_T" (Ptr Int32_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt32_T")
+instance HasCField Int32_T "unwrapInt32_T"
+    where type CFieldType Int32_T "unwrapInt32_T" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int64_T@
+
+    __defined at:__ @edge-cases\/spec_examples.h 12:19@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+newtype Int64_T
+    = Int64_T {unwrapInt64_T :: CLLong}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CLLong => HasField "unwrapInt64_T" Int64_T ty
+    where hasField = \x_0 -> (\y_1 -> Int64_T{unwrapInt64_T = y_1},
+                              getField @"unwrapInt64_T" x_0)
+instance (~) ty CLLong =>
+         HasField "unwrapInt64_T" (Ptr Int64_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt64_T")
+instance HasCField Int64_T "unwrapInt64_T"
+    where type CFieldType Int64_T "unwrapInt64_T" = CLLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct cint16_T@
+
+    __defined at:__ @edge-cases\/spec_examples.h 14:9@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+data Cint16_T
+    = Cint16_T {cint16_T_re :: Int16_T
+                {- ^ __C declaration:__ @re@
+
+                     __defined at:__ @edge-cases\/spec_examples.h 15:11@
+
+                     __exported by:__ @edge-cases\/spec_examples.h@
+                -},
+                cint16_T_im :: Int16_T
+                {- ^ __C declaration:__ @im@
+
+                     __defined at:__ @edge-cases\/spec_examples.h 16:11@
+
+                     __exported by:__ @edge-cases\/spec_examples.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Cint16_T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Cint16_T
+    where readRaw = \ptr_0 -> (pure Cint16_T <*> readRaw (Proxy @"cint16_T_re") ptr_0) <*> readRaw (Proxy @"cint16_T_im") ptr_0
+instance WriteRaw Cint16_T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Cint16_T cint16_T_re_2
+                                                cint16_T_im_3 -> writeRaw (Proxy @"cint16_T_re") ptr_0 cint16_T_re_2 >> writeRaw (Proxy @"cint16_T_im") ptr_0 cint16_T_im_3
+deriving via (EquivStorable Cint16_T) instance Storable Cint16_T
+deriving via (IsStructViaReadRaw Cint16_T) instance IsStruct Cint16_T
+instance (~) ty Int16_T => HasField "cint16_T_re" Cint16_T ty
+    where hasField = \x_0 -> (\y_1 -> Cint16_T{cint16_T_re = y_1,
+                                               cint16_T_im = getField @"cint16_T_im" x_0},
+                              getField @"cint16_T_re" x_0)
+instance (~) ty Int16_T =>
+         HasField "cint16_T_re" (Ptr Cint16_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"cint16_T_re")
+instance HasCField Cint16_T "cint16_T_re"
+    where type CFieldType Cint16_T "cint16_T_re" = Int16_T
+          offset# = \_ -> \_ -> 0
+instance (~) ty Int16_T => HasField "cint16_T_im" Cint16_T ty
+    where hasField = \x_0 -> (\y_1 -> Cint16_T{cint16_T_im = y_1,
+                                               cint16_T_re = getField @"cint16_T_re" x_0},
+                              getField @"cint16_T_im" x_0)
+instance (~) ty Int16_T =>
+         HasField "cint16_T_im" (Ptr Cint16_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"cint16_T_im")
+instance HasCField Cint16_T "cint16_T_im"
+    where type CFieldType Cint16_T "cint16_T_im" = Int16_T
+          offset# = \_ -> \_ -> 2
+{-| __C declaration:__ @struct B@
+
+    __defined at:__ @edge-cases\/spec_examples.h 19:8@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+data B = B {} deriving stock (Eq, Generic, Show)
+instance StaticSize B
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw B
+    where readRaw = \ptr_0 -> pure B
+instance WriteRaw B
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       B -> pure ()
+deriving via (EquivStorable B) instance Storable B
+deriving via (IsStructViaReadRaw B) instance IsStruct B
+{-| __C declaration:__ @struct A@
+
+    __defined at:__ @edge-cases\/spec_examples.h 23:8@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+data A
+    = A {a_x :: CDouble
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @edge-cases\/spec_examples.h 24:10@
+
+              __exported by:__ @edge-cases\/spec_examples.h@
+         -},
+         a_label :: (Ptr CChar)
+         {- ^ __C declaration:__ @label@
+
+              __defined at:__ @edge-cases\/spec_examples.h 25:9@
+
+              __exported by:__ @edge-cases\/spec_examples.h@
+         -},
+         a_samples :: (ConstantArray 128 CChar)
+         {- ^ __C declaration:__ @samples@
+
+              __defined at:__ @edge-cases\/spec_examples.h 26:8@
+
+              __exported by:__ @edge-cases\/spec_examples.h@
+         -},
+         a_b :: B
+         {- ^ __C declaration:__ @b@
+
+              __defined at:__ @edge-cases\/spec_examples.h 27:12@
+
+              __exported by:__ @edge-cases\/spec_examples.h@
+         -},
+         a_c :: (Ptr C)
+         {- ^ __C declaration:__ @c@
+
+              __defined at:__ @edge-cases\/spec_examples.h 28:13@
+
+              __exported by:__ @edge-cases\/spec_examples.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize A
+    where staticSizeOf = \_ -> 152 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw A
+    where readRaw = \ptr_0 -> ((((pure A <*> readRaw (Proxy @"a_x") ptr_0) <*> readRaw (Proxy @"a_label") ptr_0) <*> readRaw (Proxy @"a_samples") ptr_0) <*> readRaw (Proxy @"a_b") ptr_0) <*> readRaw (Proxy @"a_c") ptr_0
+instance WriteRaw A
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       A a_x_2
+                                         a_label_3
+                                         a_samples_4
+                                         a_b_5
+                                         a_c_6 -> writeRaw (Proxy @"a_x") ptr_0 a_x_2 >> (writeRaw (Proxy @"a_label") ptr_0 a_label_3 >> (writeRaw (Proxy @"a_samples") ptr_0 a_samples_4 >> (writeRaw (Proxy @"a_b") ptr_0 a_b_5 >> writeRaw (Proxy @"a_c") ptr_0 a_c_6)))
+deriving via (EquivStorable A) instance Storable A
+deriving via (IsStructViaReadRaw A) instance IsStruct A
+instance (~) ty CDouble => HasField "a_x" A ty
+    where hasField = \x_0 -> (\y_1 -> A{a_x = y_1,
+                                        a_label = getField @"a_label" x_0,
+                                        a_samples = getField @"a_samples" x_0,
+                                        a_b = getField @"a_b" x_0,
+                                        a_c = getField @"a_c" x_0},
+                              getField @"a_x" x_0)
+instance (~) ty CDouble => HasField "a_x" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"a_x")
+instance HasCField A "a_x"
+    where type CFieldType A "a_x" = CDouble
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr CChar) => HasField "a_label" A ty
+    where hasField = \x_0 -> (\y_1 -> A{a_label = y_1,
+                                        a_x = getField @"a_x" x_0,
+                                        a_samples = getField @"a_samples" x_0,
+                                        a_b = getField @"a_b" x_0,
+                                        a_c = getField @"a_c" x_0},
+                              getField @"a_label" x_0)
+instance (~) ty (Ptr CChar) => HasField "a_label" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"a_label")
+instance HasCField A "a_label"
+    where type CFieldType A "a_label" = Ptr CChar
+          offset# = \_ -> \_ -> 8
+instance (~) ty (ConstantArray 128 CChar) =>
+         HasField "a_samples" A ty
+    where hasField = \x_0 -> (\y_1 -> A{a_samples = y_1,
+                                        a_x = getField @"a_x" x_0,
+                                        a_label = getField @"a_label" x_0,
+                                        a_b = getField @"a_b" x_0,
+                                        a_c = getField @"a_c" x_0},
+                              getField @"a_samples" x_0)
+instance (~) ty (ConstantArray 128 CChar) =>
+         HasField "a_samples" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"a_samples")
+instance HasCField A "a_samples"
+    where type CFieldType A "a_samples" = ConstantArray 128 CChar
+          offset# = \_ -> \_ -> 16
+instance (~) ty B => HasField "a_b" A ty
+    where hasField = \x_0 -> (\y_1 -> A{a_b = y_1,
+                                        a_x = getField @"a_x" x_0,
+                                        a_label = getField @"a_label" x_0,
+                                        a_samples = getField @"a_samples" x_0,
+                                        a_c = getField @"a_c" x_0},
+                              getField @"a_b" x_0)
+instance (~) ty B => HasField "a_b" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"a_b")
+instance HasCField A "a_b"
+    where type CFieldType A "a_b" = B
+          offset# = \_ -> \_ -> 144
+instance (~) ty (Ptr C) => HasField "a_c" A ty
+    where hasField = \x_0 -> (\y_1 -> A{a_c = y_1,
+                                        a_x = getField @"a_x" x_0,
+                                        a_label = getField @"a_label" x_0,
+                                        a_samples = getField @"a_samples" x_0,
+                                        a_b = getField @"a_b" x_0},
+                              getField @"a_c" x_0)
+instance (~) ty (Ptr C) => HasField "a_c" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"a_c")
+instance HasCField A "a_c"
+    where type CFieldType A "a_c" = Ptr C
+          offset# = \_ -> \_ -> 144
+{-| __C declaration:__ @struct C@
+
+    __defined at:__ @edge-cases\/spec_examples.h 28:10@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+data C
+-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
+foreign import ccall safe "hs_bindgen_8a72aafc705daf44" hs_bindgen_8a72aafc705daf44_base ::
+    Ptr Void
+ -> Ptr Void
+ -> CLLong
+ -> CLLong
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
+hs_bindgen_8a72aafc705daf44 :: Ptr Int32_T ->
+                               Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
+                               Int64_T ->
+                               Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()
+-- __unique:__ @test_edgecasesspec_examples_Example_Safe_resample@
+hs_bindgen_8a72aafc705daf44 = \x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> hs_bindgen_8a72aafc705daf44_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3) (toFFIType x_4)
+{-| __C declaration:__ @resample@
+
+    __defined at:__ @edge-cases\/spec_examples.h 31:6@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+resample_safe :: Ptr Int32_T ->
+                 Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
+                 Int64_T ->
+                 Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()
+{-| __C declaration:__ @resample@
+
+    __defined at:__ @edge-cases\/spec_examples.h 31:6@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+resample_safe = hs_bindgen_8a72aafc705daf44
+-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
+foreign import ccall unsafe "hs_bindgen_2311fa9c0d0d6d06" hs_bindgen_2311fa9c0d0d6d06_base ::
+    Ptr Void
+ -> Ptr Void
+ -> CLLong
+ -> CLLong
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
+hs_bindgen_2311fa9c0d0d6d06 :: Ptr Int32_T ->
+                               Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
+                               Int64_T ->
+                               Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()
+-- __unique:__ @test_edgecasesspec_examples_Example_Unsafe_resample@
+hs_bindgen_2311fa9c0d0d6d06 = \x_0 -> \x_1 -> \x_2 -> \x_3 -> \x_4 -> hs_bindgen_2311fa9c0d0d6d06_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3) (toFFIType x_4)
+{-| __C declaration:__ @resample@
+
+    __defined at:__ @edge-cases\/spec_examples.h 31:6@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+resample_unsafe :: Ptr Int32_T ->
+                   Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
+                   Int64_T ->
+                   Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()
+{-| __C declaration:__ @resample@
+
+    __defined at:__ @edge-cases\/spec_examples.h 31:6@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+resample_unsafe = hs_bindgen_2311fa9c0d0d6d06
+-- __unique:__ @test_edgecasesspec_examples_Example_get_resample@
+foreign import ccall unsafe "hs_bindgen_2b8fc800dad87ec8" hs_bindgen_2b8fc800dad87ec8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesspec_examples_Example_get_resample@
+hs_bindgen_2b8fc800dad87ec8 :: IO (FunPtr (Ptr Int32_T ->
+                                           Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
+                                           Int64_T ->
+                                           Int64_T ->
+                                           Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ()))
+-- __unique:__ @test_edgecasesspec_examples_Example_get_resample@
+hs_bindgen_2b8fc800dad87ec8 = fmap fromFFIType hs_bindgen_2b8fc800dad87ec8_base
+{-# NOINLINE resample_funptr #-}
+{-| __C declaration:__ @resample@
+
+    __defined at:__ @edge-cases\/spec_examples.h 31:6@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+resample_funptr :: FunPtr (Ptr Int32_T ->
+                           Ptr (Elem (ConstantArray 30720000 Cint16_T)) ->
+                           Int64_T ->
+                           Int64_T -> Ptr (Elem (ConstantArray 30720000 Cint16_T)) -> IO ())
+{-| __C declaration:__ @resample@
+
+    __defined at:__ @edge-cases\/spec_examples.h 31:6@
+
+    __exported by:__ @edge-cases\/spec_examples.h@
+-}
+resample_funptr = unsafePerformIO hs_bindgen_2b8fc800dad87ec8
diff --git a/test-artefacts/fixtures/edge-cases/thread_local/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/thread_local/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/thread_local/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/edge-cases/thread_local/th.txt b/test-artefacts/fixtures/edge-cases/thread_local/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/thread_local/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/thread_local.h
diff --git a/test-artefacts/fixtures/edge-cases/typedef_bitfield/Example.hs b/test-artefacts/fixtures/edge-cases/typedef_bitfield/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/typedef_bitfield/Example.hs
@@ -0,0 +1,337 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.MyUInt(..)
+    , Example.MyLong(..)
+    , Example.MyStruct(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.BitfieldPtr as BitfieldPtr
+import qualified HsBindgen.Runtime.HasCBitfield as HasCBitfield
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @myInt@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 2:13@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @myUInt@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 3:22@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+newtype MyUInt = MyUInt
+  { unwrapMyUInt :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapMyUInt" MyUInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyUInt {unwrapMyUInt = y1}, BG.getField @"unwrapMyUInt" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapMyUInt" (BG.Ptr MyUInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyUInt")
+
+instance HasCField.HasCField MyUInt "unwrapMyUInt" where
+
+  type CFieldType MyUInt "unwrapMyUInt" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @myLong@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 4:14@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+newtype MyLong = MyLong
+  { unwrapMyLong :: BG.CLong
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "unwrapMyLong" MyLong ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyLong {unwrapMyLong = y1}, BG.getField @"unwrapMyLong" x0)
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "unwrapMyLong" (BG.Ptr MyLong) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyLong")
+
+instance HasCField.HasCField MyLong "unwrapMyLong" where
+
+  type CFieldType MyLong "unwrapMyLong" = BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct myStruct@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 6:8@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+data MyStruct = MyStruct
+  { myStruct_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/typedef_bitfield.h 7:9@
+
+         __exported by:__ @edge-cases\/typedef_bitfield.h@
+    -}
+  , myStruct_y :: MyUInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @edge-cases\/typedef_bitfield.h 8:10@
+
+         __exported by:__ @edge-cases\/typedef_bitfield.h@
+    -}
+  , myStruct_z :: MyLong
+    {- ^ __C declaration:__ @z@
+
+         __defined at:__ @edge-cases\/typedef_bitfield.h 9:10@
+
+         __exported by:__ @edge-cases\/typedef_bitfield.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize MyStruct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw MyStruct where
+
+  readRaw =
+    \ptr0 ->
+          pure MyStruct
+      <*> HasCBitfield.peek (BG.Proxy @"myStruct_x") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"myStruct_y") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"myStruct_z") ptr0
+
+instance Marshal.WriteRaw MyStruct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MyStruct myStruct_x2 myStruct_y3 myStruct_z4 ->
+               HasCBitfield.poke (BG.Proxy @"myStruct_x") ptr0 myStruct_x2
+            >> HasCBitfield.poke (BG.Proxy @"myStruct_y") ptr0 myStruct_y3
+            >> HasCBitfield.poke (BG.Proxy @"myStruct_z") ptr0 myStruct_z4
+
+deriving via Marshal.EquivStorable MyStruct instance BG.Storable MyStruct
+
+deriving via Struct.IsStructViaReadRaw MyStruct instance Struct.IsStruct MyStruct
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 7:9@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+instance ( ty ~ MyInt
+         ) => BG.CompatHasField.HasField "myStruct_x" MyStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MyStruct { myStruct_x = y1
+                   , myStruct_y = BG.getField @"myStruct_y" x0
+                   , myStruct_z = BG.getField @"myStruct_z" x0
+                   }
+      , BG.getField @"myStruct_x" x0
+      )
+
+instance ( ty ~ MyInt
+         ) => BG.HasField "myStruct_x" (BG.Ptr MyStruct) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"myStruct_x")
+
+instance HasCBitfield.HasCBitfield MyStruct "myStruct_x" where
+
+  type CBitfieldType MyStruct "myStruct_x" = MyInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 8:10@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+instance ( ty ~ MyUInt
+         ) => BG.CompatHasField.HasField "myStruct_y" MyStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MyStruct { myStruct_y = y1
+                   , myStruct_x = BG.getField @"myStruct_x" x0
+                   , myStruct_z = BG.getField @"myStruct_z" x0
+                   }
+      , BG.getField @"myStruct_y" x0
+      )
+
+instance ( ty ~ MyUInt
+         ) => BG.HasField "myStruct_y" (BG.Ptr MyStruct) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"myStruct_y")
+
+instance HasCBitfield.HasCBitfield MyStruct "myStruct_y" where
+
+  type CBitfieldType MyStruct "myStruct_y" = MyUInt
+
+  bitfieldOffset# = \_ -> \_ -> 2
+
+  bitfieldWidth# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 9:10@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+instance ( ty ~ MyLong
+         ) => BG.CompatHasField.HasField "myStruct_z" MyStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MyStruct { myStruct_z = y1
+                   , myStruct_x = BG.getField @"myStruct_x" x0
+                   , myStruct_y = BG.getField @"myStruct_y" x0
+                   }
+      , BG.getField @"myStruct_z" x0
+      )
+
+instance ( ty ~ MyLong
+         ) => BG.HasField "myStruct_z" (BG.Ptr MyStruct) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"myStruct_z")
+
+instance HasCBitfield.HasCBitfield MyStruct "myStruct_z" where
+
+  type CBitfieldType MyStruct "myStruct_z" = MyLong
+
+  bitfieldOffset# = \_ -> \_ -> 6
+
+  bitfieldWidth# = \_ -> \_ -> 3
diff --git a/test-artefacts/fixtures/edge-cases/typedef_bitfield/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/typedef_bitfield/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/typedef_bitfield/bindingspec.yaml
@@ -0,0 +1,141 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/typedef_bitfield.h
+  cname: myInt
+  hsname: MyInt
+- headers: edge-cases/typedef_bitfield.h
+  cname: myUInt
+  hsname: MyUInt
+- headers: edge-cases/typedef_bitfield.h
+  cname: myLong
+  hsname: MyLong
+- headers: edge-cases/typedef_bitfield.h
+  cname: struct myStruct
+  hsname: MyStruct
+hstypes:
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyLong
+  representation:
+    newtype:
+      constructor: MyLong
+      fields:
+      - unwrapMyLong
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CLong
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyStruct
+  representation:
+    record:
+      constructor: MyStruct
+      fields:
+      - myStruct_x
+      - myStruct_y
+      - myStruct_z
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyUInt
+  representation:
+    newtype:
+      constructor: MyUInt
+      fields:
+      - unwrapMyUInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/typedef_bitfield/th.txt b/test-artefacts/fixtures/edge-cases/typedef_bitfield/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/typedef_bitfield/th.txt
@@ -0,0 +1,176 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/typedef_bitfield.h
+{-| __C declaration:__ @myInt@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 2:13@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @myUInt@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 3:22@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+newtype MyUInt
+    = MyUInt {unwrapMyUInt :: CUInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUInt => HasField "unwrapMyUInt" MyUInt ty
+    where hasField = \x_0 -> (\y_1 -> MyUInt{unwrapMyUInt = y_1},
+                              getField @"unwrapMyUInt" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapMyUInt" (Ptr MyUInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyUInt")
+instance HasCField MyUInt "unwrapMyUInt"
+    where type CFieldType MyUInt "unwrapMyUInt" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @myLong@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 4:14@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+newtype MyLong
+    = MyLong {unwrapMyLong :: CLong}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CLong => HasField "unwrapMyLong" MyLong ty
+    where hasField = \x_0 -> (\y_1 -> MyLong{unwrapMyLong = y_1},
+                              getField @"unwrapMyLong" x_0)
+instance (~) ty CLong =>
+         HasField "unwrapMyLong" (Ptr MyLong) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyLong")
+instance HasCField MyLong "unwrapMyLong"
+    where type CFieldType MyLong "unwrapMyLong" = CLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct myStruct@
+
+    __defined at:__ @edge-cases\/typedef_bitfield.h 6:8@
+
+    __exported by:__ @edge-cases\/typedef_bitfield.h@
+-}
+data MyStruct
+    = MyStruct {myStruct_x :: MyInt
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @edge-cases\/typedef_bitfield.h 7:9@
+
+                     __exported by:__ @edge-cases\/typedef_bitfield.h@
+                -},
+                myStruct_y :: MyUInt
+                {- ^ __C declaration:__ @y@
+
+                     __defined at:__ @edge-cases\/typedef_bitfield.h 8:10@
+
+                     __exported by:__ @edge-cases\/typedef_bitfield.h@
+                -},
+                myStruct_z :: MyLong
+                {- ^ __C declaration:__ @z@
+
+                     __defined at:__ @edge-cases\/typedef_bitfield.h 9:10@
+
+                     __exported by:__ @edge-cases\/typedef_bitfield.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize MyStruct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw MyStruct
+    where readRaw = \ptr_0 -> ((pure MyStruct <*> peek (Proxy @"myStruct_x") ptr_0) <*> peek (Proxy @"myStruct_y") ptr_0) <*> peek (Proxy @"myStruct_z") ptr_0
+instance WriteRaw MyStruct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MyStruct myStruct_x_2
+                                                myStruct_y_3
+                                                myStruct_z_4 -> poke (Proxy @"myStruct_x") ptr_0 myStruct_x_2 >> (poke (Proxy @"myStruct_y") ptr_0 myStruct_y_3 >> poke (Proxy @"myStruct_z") ptr_0 myStruct_z_4)
+deriving via (EquivStorable MyStruct) instance Storable MyStruct
+deriving via (IsStructViaReadRaw MyStruct) instance IsStruct MyStruct
+instance (~) ty MyInt => HasField "myStruct_x" MyStruct ty
+    where hasField = \x_0 -> (\y_1 -> MyStruct{myStruct_x = y_1,
+                                               myStruct_y = getField @"myStruct_y" x_0,
+                                               myStruct_z = getField @"myStruct_z" x_0},
+                              getField @"myStruct_x" x_0)
+instance (~) ty MyInt =>
+         HasField "myStruct_x" (Ptr MyStruct) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"myStruct_x")
+instance HasCBitfield MyStruct "myStruct_x"
+    where type CBitfieldType MyStruct "myStruct_x" = MyInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 2
+instance (~) ty MyUInt => HasField "myStruct_y" MyStruct ty
+    where hasField = \x_0 -> (\y_1 -> MyStruct{myStruct_y = y_1,
+                                               myStruct_x = getField @"myStruct_x" x_0,
+                                               myStruct_z = getField @"myStruct_z" x_0},
+                              getField @"myStruct_y" x_0)
+instance (~) ty MyUInt =>
+         HasField "myStruct_y" (Ptr MyStruct) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"myStruct_y")
+instance HasCBitfield MyStruct "myStruct_y"
+    where type CBitfieldType MyStruct "myStruct_y" = MyUInt
+          bitfieldOffset# = \_ -> \_ -> 2
+          bitfieldWidth# = \_ -> \_ -> 4
+instance (~) ty MyLong => HasField "myStruct_z" MyStruct ty
+    where hasField = \x_0 -> (\y_1 -> MyStruct{myStruct_z = y_1,
+                                               myStruct_x = getField @"myStruct_x" x_0,
+                                               myStruct_y = getField @"myStruct_y" x_0},
+                              getField @"myStruct_z" x_0)
+instance (~) ty MyLong =>
+         HasField "myStruct_z" (Ptr MyStruct) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"myStruct_z")
+instance HasCBitfield MyStruct "myStruct_z"
+    where type CBitfieldType MyStruct "myStruct_z" = MyLong
+          bitfieldOffset# = \_ -> \_ -> 6
+          bitfieldWidth# = \_ -> \_ -> 3
diff --git a/test-artefacts/fixtures/edge-cases/typedef_void/Example.hs b/test-artefacts/fixtures/edge-cases/typedef_void/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/typedef_void/Example.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.Foo
+    )
+  where
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @edge-cases\/typedef_void.h 4:14@
+
+    __exported by:__ @edge-cases\/typedef_void.h@
+-}
+data Foo
diff --git a/test-artefacts/fixtures/edge-cases/typedef_void/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/typedef_void/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/typedef_void/bindingspec.yaml
@@ -0,0 +1,11 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/typedef_void.h
+  cname: foo
+  hsname: Foo
+hstypes:
+- hsname: Foo
+  representation: emptydata
diff --git a/test-artefacts/fixtures/edge-cases/typedef_void/th.txt b/test-artefacts/fixtures/edge-cases/typedef_void/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/typedef_void/th.txt
@@ -0,0 +1,8 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/typedef_void.h
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @edge-cases\/typedef_void.h 4:14@
+
+    __exported by:__ @edge-cases\/typedef_void.h@
+-}
+data Foo
diff --git a/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_fields/Example.hs b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_fields/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_fields/Example.hs
@@ -0,0 +1,298 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Some_struct_field1(..)
+    , Example.Some_struct(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@some_struct_field1@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:3@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+-}
+data Some_struct_field1 = Some_struct_field1
+  { some_struct_field1_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:16@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+    -}
+  , some_struct_field1_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:23@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Some_struct_field1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Some_struct_field1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Some_struct_field1
+      <*> HasCField.readRaw (BG.Proxy @"some_struct_field1_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"some_struct_field1_y") ptr0
+
+instance Marshal.WriteRaw Some_struct_field1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Some_struct_field1 some_struct_field1_x2 some_struct_field1_y3 ->
+               HasCField.writeRaw (BG.Proxy @"some_struct_field1_x") ptr0 some_struct_field1_x2
+            >> HasCField.writeRaw (BG.Proxy @"some_struct_field1_y") ptr0 some_struct_field1_y3
+
+deriving via Marshal.EquivStorable Some_struct_field1 instance BG.Storable Some_struct_field1
+
+deriving via Struct.IsStructViaReadRaw Some_struct_field1 instance Struct.IsStruct Some_struct_field1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:16@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "some_struct_field1_x" Some_struct_field1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Some_struct_field1 { some_struct_field1_x = y1
+                             , some_struct_field1_y = BG.getField @"some_struct_field1_y" x0
+                             }
+      , BG.getField @"some_struct_field1_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "some_struct_field1_x" (BG.Ptr Some_struct_field1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"some_struct_field1_x")
+
+instance HasCField.HasCField Some_struct_field1 "some_struct_field1_x" where
+
+  type CFieldType Some_struct_field1 "some_struct_field1_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:23@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "some_struct_field1_y" Some_struct_field1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Some_struct_field1 { some_struct_field1_y = y1
+                             , some_struct_field1_x = BG.getField @"some_struct_field1_x" x0
+                             }
+      , BG.getField @"some_struct_field1_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "some_struct_field1_y" (BG.Ptr Some_struct_field1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"some_struct_field1_y")
+
+instance HasCField.HasCField Some_struct_field1 "some_struct_field1_y" where
+
+  type CFieldType Some_struct_field1 "some_struct_field1_y" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct some_struct@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 4:8@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+-}
+data Some_struct = Some_struct
+  { some_struct_field1 :: Some_struct_field1
+    {- ^ __C declaration:__ @field1@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:28@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+    -}
+  , some_struct_field2 :: Some_struct_field1
+    {- ^ __C declaration:__ @field2@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:36@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+    -}
+  , some_struct_field3 :: Some_struct_field1
+    {- ^ __C declaration:__ @field3@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:44@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Some_struct where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Some_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Some_struct
+      <*> HasCField.readRaw (BG.Proxy @"some_struct_field1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"some_struct_field2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"some_struct_field3") ptr0
+
+instance Marshal.WriteRaw Some_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Some_struct some_struct_field12 some_struct_field23 some_struct_field34 ->
+               HasCField.writeRaw (BG.Proxy @"some_struct_field1") ptr0 some_struct_field12
+            >> HasCField.writeRaw (BG.Proxy @"some_struct_field2") ptr0 some_struct_field23
+            >> HasCField.writeRaw (BG.Proxy @"some_struct_field3") ptr0 some_struct_field34
+
+deriving via Marshal.EquivStorable Some_struct instance BG.Storable Some_struct
+
+deriving via Struct.IsStructViaReadRaw Some_struct instance Struct.IsStruct Some_struct
+
+{-| __C declaration:__ @field1@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:28@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+-}
+instance ( ty ~ Some_struct_field1
+         ) => BG.CompatHasField.HasField "some_struct_field1" Some_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Some_struct { some_struct_field1 = y1
+                      , some_struct_field2 = BG.getField @"some_struct_field2" x0
+                      , some_struct_field3 = BG.getField @"some_struct_field3" x0
+                      }
+      , BG.getField @"some_struct_field1" x0
+      )
+
+instance ( ty ~ Some_struct_field1
+         ) => BG.HasField "some_struct_field1" (BG.Ptr Some_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"some_struct_field1")
+
+instance HasCField.HasCField Some_struct "some_struct_field1" where
+
+  type CFieldType Some_struct "some_struct_field1" =
+    Some_struct_field1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @field2@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:36@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+-}
+instance ( ty ~ Some_struct_field1
+         ) => BG.CompatHasField.HasField "some_struct_field2" Some_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Some_struct { some_struct_field2 = y1
+                      , some_struct_field1 = BG.getField @"some_struct_field1" x0
+                      , some_struct_field3 = BG.getField @"some_struct_field3" x0
+                      }
+      , BG.getField @"some_struct_field2" x0
+      )
+
+instance ( ty ~ Some_struct_field1
+         ) => BG.HasField "some_struct_field2" (BG.Ptr Some_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"some_struct_field2")
+
+instance HasCField.HasCField Some_struct "some_struct_field2" where
+
+  type CFieldType Some_struct "some_struct_field2" =
+    Some_struct_field1
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @field3@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:44@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+-}
+instance ( ty ~ Some_struct_field1
+         ) => BG.CompatHasField.HasField "some_struct_field3" Some_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Some_struct { some_struct_field3 = y1
+                      , some_struct_field1 = BG.getField @"some_struct_field1" x0
+                      , some_struct_field2 = BG.getField @"some_struct_field2" x0
+                      }
+      , BG.getField @"some_struct_field3" x0
+      )
+
+instance ( ty ~ Some_struct_field1
+         ) => BG.HasField "some_struct_field3" (BG.Ptr Some_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"some_struct_field3")
+
+instance HasCField.HasCField Some_struct "some_struct_field3" where
+
+  type CFieldType Some_struct "some_struct_field3" =
+    Some_struct_field1
+
+  offset# = \_ -> \_ -> 16
diff --git a/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_fields/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_fields/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_fields/bindingspec.yaml
@@ -0,0 +1,53 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/unnamed_type_multiple_fields.h
+  cname: struct some_struct
+  hsname: Some_struct
+- headers: edge-cases/unnamed_type_multiple_fields.h
+  cname: struct @some_struct_field1
+  hsname: Some_struct_field1
+hstypes:
+- hsname: Some_struct
+  representation:
+    record:
+      constructor: Some_struct
+      fields:
+      - some_struct_field1
+      - some_struct_field2
+      - some_struct_field3
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_struct_field1
+  representation:
+    record:
+      constructor: Some_struct_field1
+      fields:
+      - some_struct_field1_x
+      - some_struct_field1_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_fields/th.txt b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_fields/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_fields/th.txt
@@ -0,0 +1,138 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/unnamed_type_multiple_fields.h
+{-| __C declaration:__ @struct \@some_struct_field1@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:3@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+-}
+data Some_struct_field1
+    = Some_struct_field1 {some_struct_field1_x :: CInt
+                          {- ^ __C declaration:__ @x@
+
+                               __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:16@
+
+                               __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+                          -},
+                          some_struct_field1_y :: CInt
+                          {- ^ __C declaration:__ @y@
+
+                               __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:23@
+
+                               __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Some_struct_field1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Some_struct_field1
+    where readRaw = \ptr_0 -> (pure Some_struct_field1 <*> readRaw (Proxy @"some_struct_field1_x") ptr_0) <*> readRaw (Proxy @"some_struct_field1_y") ptr_0
+instance WriteRaw Some_struct_field1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Some_struct_field1 some_struct_field1_x_2
+                                                          some_struct_field1_y_3 -> writeRaw (Proxy @"some_struct_field1_x") ptr_0 some_struct_field1_x_2 >> writeRaw (Proxy @"some_struct_field1_y") ptr_0 some_struct_field1_y_3
+deriving via (EquivStorable Some_struct_field1) instance Storable Some_struct_field1
+deriving via (IsStructViaReadRaw Some_struct_field1) instance IsStruct Some_struct_field1
+instance (~) ty CInt =>
+         HasField "some_struct_field1_x" Some_struct_field1 ty
+    where hasField = \x_0 -> (\y_1 -> Some_struct_field1{some_struct_field1_x = y_1,
+                                                         some_struct_field1_y = getField @"some_struct_field1_y" x_0},
+                              getField @"some_struct_field1_x" x_0)
+instance (~) ty CInt =>
+         HasField "some_struct_field1_x" (Ptr Some_struct_field1) (Ptr ty)
+    where getField = fromPtr (Proxy @"some_struct_field1_x")
+instance HasCField Some_struct_field1 "some_struct_field1_x"
+    where type CFieldType Some_struct_field1
+                          "some_struct_field1_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "some_struct_field1_y" Some_struct_field1 ty
+    where hasField = \x_0 -> (\y_1 -> Some_struct_field1{some_struct_field1_y = y_1,
+                                                         some_struct_field1_x = getField @"some_struct_field1_x" x_0},
+                              getField @"some_struct_field1_y" x_0)
+instance (~) ty CInt =>
+         HasField "some_struct_field1_y" (Ptr Some_struct_field1) (Ptr ty)
+    where getField = fromPtr (Proxy @"some_struct_field1_y")
+instance HasCField Some_struct_field1 "some_struct_field1_y"
+    where type CFieldType Some_struct_field1
+                          "some_struct_field1_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct some_struct@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 4:8@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+-}
+data Some_struct
+    = Some_struct {some_struct_field1 :: Some_struct_field1
+                   {- ^ __C declaration:__ @field1@
+
+                        __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:28@
+
+                        __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+                   -},
+                   some_struct_field2 :: Some_struct_field1
+                   {- ^ __C declaration:__ @field2@
+
+                        __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:36@
+
+                        __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+                   -},
+                   some_struct_field3 :: Some_struct_field1
+                   {- ^ __C declaration:__ @field3@
+
+                        __defined at:__ @edge-cases\/unnamed_type_multiple_fields.h 5:44@
+
+                        __exported by:__ @edge-cases\/unnamed_type_multiple_fields.h@
+                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Some_struct
+    where staticSizeOf = \_ -> 24 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Some_struct
+    where readRaw = \ptr_0 -> ((pure Some_struct <*> readRaw (Proxy @"some_struct_field1") ptr_0) <*> readRaw (Proxy @"some_struct_field2") ptr_0) <*> readRaw (Proxy @"some_struct_field3") ptr_0
+instance WriteRaw Some_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Some_struct some_struct_field1_2
+                                                   some_struct_field2_3
+                                                   some_struct_field3_4 -> writeRaw (Proxy @"some_struct_field1") ptr_0 some_struct_field1_2 >> (writeRaw (Proxy @"some_struct_field2") ptr_0 some_struct_field2_3 >> writeRaw (Proxy @"some_struct_field3") ptr_0 some_struct_field3_4)
+deriving via (EquivStorable Some_struct) instance Storable Some_struct
+deriving via (IsStructViaReadRaw Some_struct) instance IsStruct Some_struct
+instance (~) ty Some_struct_field1 =>
+         HasField "some_struct_field1" Some_struct ty
+    where hasField = \x_0 -> (\y_1 -> Some_struct{some_struct_field1 = y_1,
+                                                  some_struct_field2 = getField @"some_struct_field2" x_0,
+                                                  some_struct_field3 = getField @"some_struct_field3" x_0},
+                              getField @"some_struct_field1" x_0)
+instance (~) ty Some_struct_field1 =>
+         HasField "some_struct_field1" (Ptr Some_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"some_struct_field1")
+instance HasCField Some_struct "some_struct_field1"
+    where type CFieldType Some_struct
+                          "some_struct_field1" = Some_struct_field1
+          offset# = \_ -> \_ -> 0
+instance (~) ty Some_struct_field1 =>
+         HasField "some_struct_field2" Some_struct ty
+    where hasField = \x_0 -> (\y_1 -> Some_struct{some_struct_field2 = y_1,
+                                                  some_struct_field1 = getField @"some_struct_field1" x_0,
+                                                  some_struct_field3 = getField @"some_struct_field3" x_0},
+                              getField @"some_struct_field2" x_0)
+instance (~) ty Some_struct_field1 =>
+         HasField "some_struct_field2" (Ptr Some_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"some_struct_field2")
+instance HasCField Some_struct "some_struct_field2"
+    where type CFieldType Some_struct
+                          "some_struct_field2" = Some_struct_field1
+          offset# = \_ -> \_ -> 8
+instance (~) ty Some_struct_field1 =>
+         HasField "some_struct_field3" Some_struct ty
+    where hasField = \x_0 -> (\y_1 -> Some_struct{some_struct_field3 = y_1,
+                                                  some_struct_field1 = getField @"some_struct_field1" x_0,
+                                                  some_struct_field2 = getField @"some_struct_field2" x_0},
+                              getField @"some_struct_field3" x_0)
+instance (~) ty Some_struct_field1 =>
+         HasField "some_struct_field3" (Ptr Some_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"some_struct_field3")
+instance HasCField Some_struct "some_struct_field3"
+    where type CFieldType Some_struct
+                          "some_struct_field3" = Some_struct_field1
+          offset# = \_ -> \_ -> 16
diff --git a/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example.hs b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example.hs
@@ -0,0 +1,507 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Point1a(..)
+    , Example.Point1b(..)
+    , Example.Point2a(..)
+    , Example.Point2b(..)
+    , Example.Point3a_Aux(..)
+    , Example.Point3a(..)
+    , Example.Point3b(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Ord, Show, pure, type (~))
+
+{-| __C declaration:__ @struct point1a@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:9@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+data Point1a = Point1a
+  { point1a_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:22@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+    -}
+  , point1a_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:29@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Point1a where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Point1a where
+
+  readRaw =
+    \ptr0 ->
+          pure Point1a
+      <*> HasCField.readRaw (BG.Proxy @"point1a_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"point1a_y") ptr0
+
+instance Marshal.WriteRaw Point1a where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Point1a point1a_x2 point1a_y3 ->
+               HasCField.writeRaw (BG.Proxy @"point1a_x") ptr0 point1a_x2
+            >> HasCField.writeRaw (BG.Proxy @"point1a_y") ptr0 point1a_y3
+
+deriving via Marshal.EquivStorable Point1a instance BG.Storable Point1a
+
+deriving via Struct.IsStructViaReadRaw Point1a instance Struct.IsStruct Point1a
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:22@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "point1a_x" Point1a ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Point1a {point1a_x = y1, point1a_y = BG.getField @"point1a_y" x0}
+      , BG.getField @"point1a_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "point1a_x" (BG.Ptr Point1a) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"point1a_x")
+
+instance HasCField.HasCField Point1a "point1a_x" where
+
+  type CFieldType Point1a "point1a_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:29@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "point1a_y" Point1a ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Point1a {point1a_y = y1, point1a_x = BG.getField @"point1a_x" x0}
+      , BG.getField @"point1a_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "point1a_y" (BG.Ptr Point1a) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"point1a_y")
+
+instance HasCField.HasCField Point1a "point1a_y" where
+
+  type CFieldType Point1a "point1a_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @point1b@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:43@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+newtype Point1b = Point1b
+  { unwrapPoint1b :: Point1a
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Point1a
+         ) => BG.CompatHasField.HasField "unwrapPoint1b" Point1b ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Point1b {unwrapPoint1b = y1}, BG.getField @"unwrapPoint1b" x0)
+
+instance ( ty ~ Point1a
+         ) => BG.HasField "unwrapPoint1b" (BG.Ptr Point1b) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPoint1b")
+
+instance HasCField.HasCField Point1b "unwrapPoint1b" where
+
+  type CFieldType Point1b "unwrapPoint1b" = Point1a
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct point2a@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:9@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+data Point2a = Point2a
+  { point2a_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:22@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+    -}
+  , point2a_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:29@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Point2a where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Point2a where
+
+  readRaw =
+    \ptr0 ->
+          pure Point2a
+      <*> HasCField.readRaw (BG.Proxy @"point2a_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"point2a_y") ptr0
+
+instance Marshal.WriteRaw Point2a where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Point2a point2a_x2 point2a_y3 ->
+               HasCField.writeRaw (BG.Proxy @"point2a_x") ptr0 point2a_x2
+            >> HasCField.writeRaw (BG.Proxy @"point2a_y") ptr0 point2a_y3
+
+deriving via Marshal.EquivStorable Point2a instance BG.Storable Point2a
+
+deriving via Struct.IsStructViaReadRaw Point2a instance Struct.IsStruct Point2a
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:22@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "point2a_x" Point2a ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Point2a {point2a_x = y1, point2a_y = BG.getField @"point2a_y" x0}
+      , BG.getField @"point2a_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "point2a_x" (BG.Ptr Point2a) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"point2a_x")
+
+instance HasCField.HasCField Point2a "point2a_x" where
+
+  type CFieldType Point2a "point2a_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:29@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "point2a_y" Point2a ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Point2a {point2a_y = y1, point2a_x = BG.getField @"point2a_x" x0}
+      , BG.getField @"point2a_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "point2a_y" (BG.Ptr Point2a) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"point2a_y")
+
+instance HasCField.HasCField Point2a "point2a_y" where
+
+  type CFieldType Point2a "point2a_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @point2b@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:44@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+newtype Point2b = Point2b
+  { unwrapPoint2b :: BG.Ptr Point2a
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr Point2a
+         ) => BG.CompatHasField.HasField "unwrapPoint2b" Point2b ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Point2b {unwrapPoint2b = y1}, BG.getField @"unwrapPoint2b" x0)
+
+instance ( ty ~ BG.Ptr Point2a
+         ) => BG.HasField "unwrapPoint2b" (BG.Ptr Point2b) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPoint2b")
+
+instance HasCField.HasCField Point2b "unwrapPoint2b" where
+
+  type CFieldType Point2b "unwrapPoint2b" =
+    BG.Ptr Point2a
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@point3a_Aux@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:9@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+data Point3a_Aux = Point3a_Aux
+  { point3a_Aux_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:22@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+    -}
+  , point3a_Aux_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:29@
+
+         __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Point3a_Aux where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Point3a_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure Point3a_Aux
+      <*> HasCField.readRaw (BG.Proxy @"point3a_Aux_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"point3a_Aux_y") ptr0
+
+instance Marshal.WriteRaw Point3a_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Point3a_Aux point3a_Aux_x2 point3a_Aux_y3 ->
+               HasCField.writeRaw (BG.Proxy @"point3a_Aux_x") ptr0 point3a_Aux_x2
+            >> HasCField.writeRaw (BG.Proxy @"point3a_Aux_y") ptr0 point3a_Aux_y3
+
+deriving via Marshal.EquivStorable Point3a_Aux instance BG.Storable Point3a_Aux
+
+deriving via Struct.IsStructViaReadRaw Point3a_Aux instance Struct.IsStruct Point3a_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:22@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "point3a_Aux_x" Point3a_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Point3a_Aux {point3a_Aux_x = y1, point3a_Aux_y = BG.getField @"point3a_Aux_y" x0}
+      , BG.getField @"point3a_Aux_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "point3a_Aux_x" (BG.Ptr Point3a_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"point3a_Aux_x")
+
+instance HasCField.HasCField Point3a_Aux "point3a_Aux_x" where
+
+  type CFieldType Point3a_Aux "point3a_Aux_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:29@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "point3a_Aux_y" Point3a_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Point3a_Aux {point3a_Aux_y = y1, point3a_Aux_x = BG.getField @"point3a_Aux_x" x0}
+      , BG.getField @"point3a_Aux_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "point3a_Aux_y" (BG.Ptr Point3a_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"point3a_Aux_y")
+
+instance HasCField.HasCField Point3a_Aux "point3a_Aux_y" where
+
+  type CFieldType Point3a_Aux "point3a_Aux_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @point3a@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:35@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+newtype Point3a = Point3a
+  { unwrapPoint3a :: BG.Ptr Point3a_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr Point3a_Aux
+         ) => BG.CompatHasField.HasField "unwrapPoint3a" Point3a ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Point3a {unwrapPoint3a = y1}, BG.getField @"unwrapPoint3a" x0)
+
+instance ( ty ~ BG.Ptr Point3a_Aux
+         ) => BG.HasField "unwrapPoint3a" (BG.Ptr Point3a) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPoint3a")
+
+instance HasCField.HasCField Point3a "unwrapPoint3a" where
+
+  type CFieldType Point3a "unwrapPoint3a" =
+    BG.Ptr Point3a_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @point3b@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:45@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+newtype Point3b = Point3b
+  { unwrapPoint3b :: BG.Ptr Point3a_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr Point3a_Aux
+         ) => BG.CompatHasField.HasField "unwrapPoint3b" Point3b ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Point3b {unwrapPoint3b = y1}, BG.getField @"unwrapPoint3b" x0)
+
+instance ( ty ~ BG.Ptr Point3a_Aux
+         ) => BG.HasField "unwrapPoint3b" (BG.Ptr Point3b) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPoint3b")
+
+instance HasCField.HasCField Point3b "unwrapPoint3b" where
+
+  type CFieldType Point3b "unwrapPoint3b" =
+    BG.Ptr Point3a_Aux
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example/FunPtr.hs b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example/FunPtr.hs
@@ -0,0 +1,46 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.test
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/unnamed_type_multiple_typedefs.h>"
+  , "/* test_edgecasesunnamed_type_multip_Example_get_test */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_bf2645b646fa0825 (void)) ("
+  , "  point2a arg1,"
+  , "  point2b arg2"
+  , ")"
+  , "{"
+  , "  return &test;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_get_test@
+foreign import ccall unsafe "hs_bindgen_bf2645b646fa0825" hs_bindgen_bf2645b646fa0825_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_get_test@
+hs_bindgen_bf2645b646fa0825 :: IO (BG.FunPtr (Point2a -> Point2b -> IO ()))
+hs_bindgen_bf2645b646fa0825 =
+  fmap BG.fromFFIType hs_bindgen_bf2645b646fa0825_base
+
+{-# NOINLINE test #-}
+{-| __C declaration:__ @test@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 14:6@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+test :: BG.FunPtr (Point2a -> Point2b -> IO ())
+test = BG.unsafePerformIO hs_bindgen_bf2645b646fa0825
diff --git a/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example/Safe.hs b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example/Safe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.test
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/unnamed_type_multiple_typedefs.h>"
+  , "void hs_bindgen_f01f9e6bbeae9e46 ("
+  , "  point2a *arg1,"
+  , "  point2b arg2"
+  , ")"
+  , "{"
+  , "  (test)(*arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Safe_test@
+foreign import ccall safe "hs_bindgen_f01f9e6bbeae9e46" hs_bindgen_f01f9e6bbeae9e46_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Safe_test@
+hs_bindgen_f01f9e6bbeae9e46 ::
+     BG.Ptr Point2a
+  -> Point2b
+  -> IO ()
+hs_bindgen_f01f9e6bbeae9e46 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f01f9e6bbeae9e46_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @test@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 14:6@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+test ::
+     Point2a
+     -- ^ __C declaration:__ @x@
+  -> Point2b
+     -- ^ __C declaration:__ @y@
+  -> IO ()
+test =
+  \x0 ->
+    \y1 ->
+      BG.with x0 (\x2 -> hs_bindgen_f01f9e6bbeae9e46 x2 y1)
diff --git a/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example/Unsafe.hs b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/Example/Unsafe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.test
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <edge-cases/unnamed_type_multiple_typedefs.h>"
+  , "void hs_bindgen_8c745f70a3e4e4af ("
+  , "  point2a *arg1,"
+  , "  point2b arg2"
+  , ")"
+  , "{"
+  , "  (test)(*arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Unsafe_test@
+foreign import ccall unsafe "hs_bindgen_8c745f70a3e4e4af" hs_bindgen_8c745f70a3e4e4af_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Unsafe_test@
+hs_bindgen_8c745f70a3e4e4af ::
+     BG.Ptr Point2a
+  -> Point2b
+  -> IO ()
+hs_bindgen_8c745f70a3e4e4af =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8c745f70a3e4e4af_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @test@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 14:6@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+test ::
+     Point2a
+     -- ^ __C declaration:__ @x@
+  -> Point2b
+     -- ^ __C declaration:__ @y@
+  -> IO ()
+test =
+  \x0 ->
+    \y1 ->
+      BG.with x0 (\x2 -> hs_bindgen_8c745f70a3e4e4af x2 y1)
diff --git a/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/bindingspec.yaml
@@ -0,0 +1,180 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/unnamed_type_multiple_typedefs.h
+  cname: struct point1a
+  hsname: Point1a
+- headers: edge-cases/unnamed_type_multiple_typedefs.h
+  cname: point1a
+  hsname: Point1a
+- headers: edge-cases/unnamed_type_multiple_typedefs.h
+  cname: point1b
+  hsname: Point1b
+- headers: edge-cases/unnamed_type_multiple_typedefs.h
+  cname: struct point2a
+  hsname: Point2a
+- headers: edge-cases/unnamed_type_multiple_typedefs.h
+  cname: point2a
+  hsname: Point2a
+- headers: edge-cases/unnamed_type_multiple_typedefs.h
+  cname: point2b
+  hsname: Point2b
+- headers: edge-cases/unnamed_type_multiple_typedefs.h
+  cname: struct @point3a_Aux
+  hsname: Point3a_Aux
+- headers: edge-cases/unnamed_type_multiple_typedefs.h
+  cname: point3a
+  hsname: Point3a
+- headers: edge-cases/unnamed_type_multiple_typedefs.h
+  cname: point3b
+  hsname: Point3b
+hstypes:
+- hsname: Point1a
+  representation:
+    record:
+      constructor: Point1a
+      fields:
+      - point1a_x
+      - point1a_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Point1b
+  representation:
+    newtype:
+      constructor: Point1b
+      fields:
+      - unwrapPoint1b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Point2a
+  representation:
+    record:
+      constructor: Point2a
+      fields:
+      - point2a_x
+      - point2a_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Point2b
+  representation:
+    newtype:
+      constructor: Point2b
+      fields:
+      - unwrapPoint2b
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Point3a
+  representation:
+    newtype:
+      constructor: Point3a
+      fields:
+      - unwrapPoint3a
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Point3a_Aux
+  representation:
+    record:
+      constructor: Point3a_Aux
+      fields:
+      - point3a_Aux_x
+      - point3a_Aux_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Point3b
+  representation:
+    newtype:
+      constructor: Point3b
+      fields:
+      - unwrapPoint3b
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/th.txt b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unnamed_type_multiple_typedefs/th.txt
@@ -0,0 +1,340 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/unnamed_type_multiple_typedefs.h
+-- #include <edge-cases/unnamed_type_multiple_typedefs.h>
+-- void hs_bindgen_f01f9e6bbeae9e46 (
+--   point2a *arg1,
+--   point2b arg2
+-- )
+-- {
+--   (test)(*arg1, arg2);
+-- }
+-- void hs_bindgen_8c745f70a3e4e4af (
+--   point2a *arg1,
+--   point2b arg2
+-- )
+-- {
+--   (test)(*arg1, arg2);
+-- }
+-- /* test_edgecasesunnamed_type_multip_Example_get_test */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_bf2645b646fa0825 (void)) (
+--   point2a arg1,
+--   point2b arg2
+-- )
+-- {
+--   return &test;
+-- }
+{-| __C declaration:__ @struct point1a@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:9@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+data Point1a
+    = Point1a {point1a_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:22@
+
+                    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+               -},
+               point1a_y :: CInt
+               {- ^ __C declaration:__ @y@
+
+                    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:29@
+
+                    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Point1a
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Point1a
+    where readRaw = \ptr_0 -> (pure Point1a <*> readRaw (Proxy @"point1a_x") ptr_0) <*> readRaw (Proxy @"point1a_y") ptr_0
+instance WriteRaw Point1a
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Point1a point1a_x_2
+                                               point1a_y_3 -> writeRaw (Proxy @"point1a_x") ptr_0 point1a_x_2 >> writeRaw (Proxy @"point1a_y") ptr_0 point1a_y_3
+deriving via (EquivStorable Point1a) instance Storable Point1a
+deriving via (IsStructViaReadRaw Point1a) instance IsStruct Point1a
+instance (~) ty CInt => HasField "point1a_x" Point1a ty
+    where hasField = \x_0 -> (\y_1 -> Point1a{point1a_x = y_1,
+                                              point1a_y = getField @"point1a_y" x_0},
+                              getField @"point1a_x" x_0)
+instance (~) ty CInt => HasField "point1a_x" (Ptr Point1a) (Ptr ty)
+    where getField = fromPtr (Proxy @"point1a_x")
+instance HasCField Point1a "point1a_x"
+    where type CFieldType Point1a "point1a_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "point1a_y" Point1a ty
+    where hasField = \x_0 -> (\y_1 -> Point1a{point1a_y = y_1,
+                                              point1a_x = getField @"point1a_x" x_0},
+                              getField @"point1a_y" x_0)
+instance (~) ty CInt => HasField "point1a_y" (Ptr Point1a) (Ptr ty)
+    where getField = fromPtr (Proxy @"point1a_y")
+instance HasCField Point1a "point1a_y"
+    where type CFieldType Point1a "point1a_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @point1b@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 5:43@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+newtype Point1b
+    = Point1b {unwrapPoint1b :: Point1a}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty Point1a => HasField "unwrapPoint1b" Point1b ty
+    where hasField = \x_0 -> (\y_1 -> Point1b{unwrapPoint1b = y_1},
+                              getField @"unwrapPoint1b" x_0)
+instance (~) ty Point1a =>
+         HasField "unwrapPoint1b" (Ptr Point1b) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPoint1b")
+instance HasCField Point1b "unwrapPoint1b"
+    where type CFieldType Point1b "unwrapPoint1b" = Point1a
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct point2a@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:9@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+data Point2a
+    = Point2a {point2a_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:22@
+
+                    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+               -},
+               point2a_y :: CInt
+               {- ^ __C declaration:__ @y@
+
+                    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:29@
+
+                    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Point2a
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Point2a
+    where readRaw = \ptr_0 -> (pure Point2a <*> readRaw (Proxy @"point2a_x") ptr_0) <*> readRaw (Proxy @"point2a_y") ptr_0
+instance WriteRaw Point2a
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Point2a point2a_x_2
+                                               point2a_y_3 -> writeRaw (Proxy @"point2a_x") ptr_0 point2a_x_2 >> writeRaw (Proxy @"point2a_y") ptr_0 point2a_y_3
+deriving via (EquivStorable Point2a) instance Storable Point2a
+deriving via (IsStructViaReadRaw Point2a) instance IsStruct Point2a
+instance (~) ty CInt => HasField "point2a_x" Point2a ty
+    where hasField = \x_0 -> (\y_1 -> Point2a{point2a_x = y_1,
+                                              point2a_y = getField @"point2a_y" x_0},
+                              getField @"point2a_x" x_0)
+instance (~) ty CInt => HasField "point2a_x" (Ptr Point2a) (Ptr ty)
+    where getField = fromPtr (Proxy @"point2a_x")
+instance HasCField Point2a "point2a_x"
+    where type CFieldType Point2a "point2a_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "point2a_y" Point2a ty
+    where hasField = \x_0 -> (\y_1 -> Point2a{point2a_y = y_1,
+                                              point2a_x = getField @"point2a_x" x_0},
+                              getField @"point2a_y" x_0)
+instance (~) ty CInt => HasField "point2a_y" (Ptr Point2a) (Ptr ty)
+    where getField = fromPtr (Proxy @"point2a_y")
+instance HasCField Point2a "point2a_y"
+    where type CFieldType Point2a "point2a_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @point2b@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 8:44@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+newtype Point2b
+    = Point2b {unwrapPoint2b :: (Ptr Point2a)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr Point2a) =>
+         HasField "unwrapPoint2b" Point2b ty
+    where hasField = \x_0 -> (\y_1 -> Point2b{unwrapPoint2b = y_1},
+                              getField @"unwrapPoint2b" x_0)
+instance (~) ty (Ptr Point2a) =>
+         HasField "unwrapPoint2b" (Ptr Point2b) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPoint2b")
+instance HasCField Point2b "unwrapPoint2b"
+    where type CFieldType Point2b "unwrapPoint2b" = Ptr Point2a
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@point3a_Aux@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:9@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+data Point3a_Aux
+    = Point3a_Aux {point3a_Aux_x :: CInt
+                   {- ^ __C declaration:__ @x@
+
+                        __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:22@
+
+                        __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+                   -},
+                   point3a_Aux_y :: CInt
+                   {- ^ __C declaration:__ @y@
+
+                        __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:29@
+
+                        __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Point3a_Aux
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Point3a_Aux
+    where readRaw = \ptr_0 -> (pure Point3a_Aux <*> readRaw (Proxy @"point3a_Aux_x") ptr_0) <*> readRaw (Proxy @"point3a_Aux_y") ptr_0
+instance WriteRaw Point3a_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Point3a_Aux point3a_Aux_x_2
+                                                   point3a_Aux_y_3 -> writeRaw (Proxy @"point3a_Aux_x") ptr_0 point3a_Aux_x_2 >> writeRaw (Proxy @"point3a_Aux_y") ptr_0 point3a_Aux_y_3
+deriving via (EquivStorable Point3a_Aux) instance Storable Point3a_Aux
+deriving via (IsStructViaReadRaw Point3a_Aux) instance IsStruct Point3a_Aux
+instance (~) ty CInt => HasField "point3a_Aux_x" Point3a_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Point3a_Aux{point3a_Aux_x = y_1,
+                                                  point3a_Aux_y = getField @"point3a_Aux_y" x_0},
+                              getField @"point3a_Aux_x" x_0)
+instance (~) ty CInt =>
+         HasField "point3a_Aux_x" (Ptr Point3a_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"point3a_Aux_x")
+instance HasCField Point3a_Aux "point3a_Aux_x"
+    where type CFieldType Point3a_Aux "point3a_Aux_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "point3a_Aux_y" Point3a_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Point3a_Aux{point3a_Aux_y = y_1,
+                                                  point3a_Aux_x = getField @"point3a_Aux_x" x_0},
+                              getField @"point3a_Aux_y" x_0)
+instance (~) ty CInt =>
+         HasField "point3a_Aux_y" (Ptr Point3a_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"point3a_Aux_y")
+instance HasCField Point3a_Aux "point3a_Aux_y"
+    where type CFieldType Point3a_Aux "point3a_Aux_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @point3a@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:35@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+newtype Point3a
+    = Point3a {unwrapPoint3a :: (Ptr Point3a_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr Point3a_Aux) =>
+         HasField "unwrapPoint3a" Point3a ty
+    where hasField = \x_0 -> (\y_1 -> Point3a{unwrapPoint3a = y_1},
+                              getField @"unwrapPoint3a" x_0)
+instance (~) ty (Ptr Point3a_Aux) =>
+         HasField "unwrapPoint3a" (Ptr Point3a) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPoint3a")
+instance HasCField Point3a "unwrapPoint3a"
+    where type CFieldType Point3a "unwrapPoint3a" = Ptr Point3a_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @point3b@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 11:45@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+newtype Point3b
+    = Point3b {unwrapPoint3b :: (Ptr Point3a_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr Point3a_Aux) =>
+         HasField "unwrapPoint3b" Point3b ty
+    where hasField = \x_0 -> (\y_1 -> Point3b{unwrapPoint3b = y_1},
+                              getField @"unwrapPoint3b" x_0)
+instance (~) ty (Ptr Point3a_Aux) =>
+         HasField "unwrapPoint3b" (Ptr Point3b) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPoint3b")
+instance HasCField Point3b "unwrapPoint3b"
+    where type CFieldType Point3b "unwrapPoint3b" = Ptr Point3a_Aux
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Safe_test@
+foreign import ccall safe "hs_bindgen_f01f9e6bbeae9e46" hs_bindgen_f01f9e6bbeae9e46_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Safe_test@
+hs_bindgen_f01f9e6bbeae9e46 :: Ptr Point2a -> Point2b -> IO ()
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Safe_test@
+hs_bindgen_f01f9e6bbeae9e46 = \x_0 -> \x_1 -> hs_bindgen_f01f9e6bbeae9e46_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @test@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 14:6@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+test_safe :: Point2a -> Point2b -> IO ()
+{-| __C declaration:__ @test@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 14:6@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+test_safe = \x_0 -> \y_1 -> with x_0 (\x_2 -> hs_bindgen_f01f9e6bbeae9e46 x_2 y_1)
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Unsafe_test@
+foreign import ccall unsafe "hs_bindgen_8c745f70a3e4e4af" hs_bindgen_8c745f70a3e4e4af_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Unsafe_test@
+hs_bindgen_8c745f70a3e4e4af :: Ptr Point2a -> Point2b -> IO ()
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_Unsafe_test@
+hs_bindgen_8c745f70a3e4e4af = \x_0 -> \x_1 -> hs_bindgen_8c745f70a3e4e4af_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @test@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 14:6@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+test_unsafe :: Point2a -> Point2b -> IO ()
+{-| __C declaration:__ @test@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 14:6@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+test_unsafe = \x_0 -> \y_1 -> with x_0 (\x_2 -> hs_bindgen_8c745f70a3e4e4af x_2 y_1)
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_get_test@
+foreign import ccall unsafe "hs_bindgen_bf2645b646fa0825" hs_bindgen_bf2645b646fa0825_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_get_test@
+hs_bindgen_bf2645b646fa0825 :: IO (FunPtr (Point2a ->
+                                           Point2b -> IO ()))
+-- __unique:__ @test_edgecasesunnamed_type_multip_Example_get_test@
+hs_bindgen_bf2645b646fa0825 = fmap fromFFIType hs_bindgen_bf2645b646fa0825_base
+{-# NOINLINE test_funptr #-}
+{-| __C declaration:__ @test@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 14:6@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+test_funptr :: FunPtr (Point2a -> Point2b -> IO ())
+{-| __C declaration:__ @test@
+
+    __defined at:__ @edge-cases\/unnamed_type_multiple_typedefs.h 14:6@
+
+    __exported by:__ @edge-cases\/unnamed_type_multiple_typedefs.h@
+-}
+test_funptr = unsafePerformIO hs_bindgen_bf2645b646fa0825
diff --git a/test-artefacts/fixtures/edge-cases/unsupported_builtin/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/unsupported_builtin/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unsupported_builtin/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/edge-cases/unsupported_builtin/th.txt b/test-artefacts/fixtures/edge-cases/unsupported_builtin/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/unsupported_builtin/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/unsupported_builtin.h
diff --git a/test-artefacts/fixtures/edge-cases/uses_utf8/Example.hs b/test-artefacts/fixtures/edge-cases/uses_utf8/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/uses_utf8/Example.hs
@@ -0,0 +1,147 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyEnum(..)
+    , pattern Example.Say你好
+    , pattern Example.Say拜拜
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum MyEnum@
+
+    __defined at:__ @edge-cases\/uses_utf8.h 4:6@
+
+    __exported by:__ @edge-cases\/uses_utf8.h@
+-}
+newtype MyEnum = MyEnum
+  { unwrapMyEnum :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize MyEnum where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw MyEnum where
+
+  readRaw =
+    \ptr0 ->
+          pure MyEnum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw MyEnum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MyEnum unwrapMyEnum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapMyEnum2
+
+deriving via Marshal.EquivStorable MyEnum instance BG.Storable MyEnum
+
+deriving via BG.CUInt instance BG.Prim MyEnum
+
+instance CEnum.CEnum MyEnum where
+
+  type CEnumZ MyEnum = BG.CUInt
+
+  toCEnum = MyEnum
+
+  fromCEnum = BG.getField @"unwrapMyEnum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "Say\20320\22909"), (1, BG.singleton "Say\25308\25308")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "MyEnum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "MyEnum"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum MyEnum where
+
+  minDeclaredValue = Say你好
+
+  maxDeclaredValue = Say拜拜
+
+instance Show MyEnum where
+
+  showsPrec = CEnum.shows
+
+instance Read MyEnum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapMyEnum" MyEnum ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyEnum {unwrapMyEnum = y1}, BG.getField @"unwrapMyEnum" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapMyEnum" (BG.Ptr MyEnum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyEnum")
+
+instance HasCField.HasCField MyEnum "unwrapMyEnum" where
+
+  type CFieldType MyEnum "unwrapMyEnum" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @Say你好@
+
+    __defined at:__ @edge-cases\/uses_utf8.h 5:9@
+
+    __exported by:__ @edge-cases\/uses_utf8.h@
+-}
+pattern Say你好 :: MyEnum
+pattern Say你好 = MyEnum 0
+
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/uses_utf8.h 6:9@
+
+    __exported by:__ @edge-cases\/uses_utf8.h@
+-}
+pattern Say拜拜 :: MyEnum
+pattern Say拜拜 = MyEnum 1
diff --git a/test-artefacts/fixtures/edge-cases/uses_utf8/bindingspec.yaml b/test-artefacts/fixtures/edge-cases/uses_utf8/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/uses_utf8/bindingspec.yaml
@@ -0,0 +1,37 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: edge-cases/uses_utf8.h
+  cname: enum MyEnum
+  hsname: MyEnum
+  enum: open
+hstypes:
+- hsname: MyEnum
+  representation:
+    newtype:
+      constructor: MyEnum
+      fields:
+      - unwrapMyEnum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/edge-cases/uses_utf8/th.txt b/test-artefacts/fixtures/edge-cases/uses_utf8/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/edge-cases/uses_utf8/th.txt
@@ -0,0 +1,66 @@
+-- addDependentFile test-artefacts/headers/golden/edge-cases/uses_utf8.h
+{-| __C declaration:__ @enum MyEnum@
+
+    __defined at:__ @edge-cases\/uses_utf8.h 4:6@
+
+    __exported by:__ @edge-cases\/uses_utf8.h@
+-}
+newtype MyEnum
+    = MyEnum {unwrapMyEnum :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize MyEnum
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw MyEnum
+    where readRaw = \ptr_0 -> pure MyEnum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw MyEnum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MyEnum unwrapMyEnum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapMyEnum_2
+deriving via (EquivStorable MyEnum) instance Storable MyEnum
+deriving via CUInt instance Prim MyEnum
+instance CEnum MyEnum
+    where type CEnumZ MyEnum = CUInt
+          toCEnum = MyEnum
+          fromCEnum = getField @"unwrapMyEnum"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "Say\20320\22909"),
+                                                         (1, singleton "Say\25308\25308")]
+          showsUndeclared = showsWrappedUndeclared "MyEnum"
+          readPrecUndeclared = readPrecWrappedUndeclared "MyEnum"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum MyEnum
+    where minDeclaredValue = Say你好
+          maxDeclaredValue = Say拜拜
+instance Show MyEnum
+    where showsPrec = shows
+instance Read MyEnum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapMyEnum" MyEnum ty
+    where hasField = \x_0 -> (\y_1 -> MyEnum{unwrapMyEnum = y_1},
+                              getField @"unwrapMyEnum" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapMyEnum" (Ptr MyEnum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyEnum")
+instance HasCField MyEnum "unwrapMyEnum"
+    where type CFieldType MyEnum "unwrapMyEnum" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @Say你好@
+
+    __defined at:__ @edge-cases\/uses_utf8.h 5:9@
+
+    __exported by:__ @edge-cases\/uses_utf8.h@
+-}
+pattern Say你好 :: MyEnum
+pattern Say你好 = MyEnum 0
+{-| __C declaration:__ @Say拜拜@
+
+    __defined at:__ @edge-cases\/uses_utf8.h 6:9@
+
+    __exported by:__ @edge-cases\/uses_utf8.h@
+-}
+pattern Say拜拜 :: MyEnum
+pattern Say拜拜 = MyEnum 1
diff --git a/test-artefacts/fixtures/functions/callbacks/Example.hs b/test-artefacts/fixtures/functions/callbacks/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/callbacks/Example.hs
@@ -0,0 +1,2494 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.FileOpenedNotification_Aux(..)
+    , Example.FileOpenedNotification(..)
+    , Example.ProgressUpdate_Aux(..)
+    , Example.ProgressUpdate(..)
+    , Example.DataValidator_Aux(..)
+    , Example.DataValidator(..)
+    , Example.Measurement(..)
+    , Example.MeasurementReceived_Aux(..)
+    , Example.MeasurementReceived(..)
+    , Example.MeasurementReceived2_Aux(..)
+    , Example.MeasurementReceived2(..)
+    , Example.SampleBufferFull_Aux(..)
+    , Example.SampleBufferFull(..)
+    , Example.MeasurementHandler(..)
+    , Example.DataPipeline(..)
+    , Example.ProcessorCallback(..)
+    , Example.Processor_mode(..)
+    , pattern Example.MODE_SIMPLE
+    , pattern Example.MODE_VALIDATED
+    , pattern Example.MODE_PROGRESS
+    , Example.Processor(..)
+    , Example.Foo(..)
+    , Example.Foo2(..)
+    , Example.A(..)
+    , Example.B(..)
+    , Example.S(..)
+    , Example.C(..)
+    , Example.U(..)
+    , Example.D(..)
+    , Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, fmap, pure, type (~))
+
+{-| Auxiliary type used by 'FileOpenedNotification'
+
+    __C declaration:__ @FileOpenedNotification@
+
+    __defined at:__ @functions\/callbacks.h 10:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype FileOpenedNotification_Aux = FileOpenedNotification_Aux
+  { unwrapFileOpenedNotification_Aux :: IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFileOpenedNotification_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b3b8b1fad168671a_base ::
+     IO ()
+  -> IO (BG.FunPtr (IO ()))
+
+-- __unique:__ @toFileOpenedNotification_Aux@
+hs_bindgen_b3b8b1fad168671a ::
+     FileOpenedNotification_Aux
+  -> IO (BG.FunPtr FileOpenedNotification_Aux)
+hs_bindgen_b3b8b1fad168671a =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b3b8b1fad168671a_base (BG.getField @"unwrapFileOpenedNotification_Aux" fun0))
+
+-- __unique:__ @fromFileOpenedNotification_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_f3ba5920f34c7f6a_base ::
+     BG.FunPtr (IO ())
+  -> IO ()
+
+-- __unique:__ @fromFileOpenedNotification_Aux@
+hs_bindgen_f3ba5920f34c7f6a ::
+     BG.FunPtr FileOpenedNotification_Aux
+  -> FileOpenedNotification_Aux
+hs_bindgen_f3ba5920f34c7f6a =
+  \funPtr0 ->
+    FileOpenedNotification_Aux (hs_bindgen_f3ba5920f34c7f6a_base (BG.castFunPtr funPtr0))
+
+instance BG.ToFunPtr FileOpenedNotification_Aux where
+
+  toFunPtr = hs_bindgen_b3b8b1fad168671a
+
+instance BG.FromFunPtr FileOpenedNotification_Aux where
+
+  fromFunPtr = hs_bindgen_f3ba5920f34c7f6a
+
+instance ( ty ~ IO ()
+         ) => BG.CompatHasField.HasField "unwrapFileOpenedNotification_Aux" FileOpenedNotification_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FileOpenedNotification_Aux {unwrapFileOpenedNotification_Aux = y1}
+      , BG.getField @"unwrapFileOpenedNotification_Aux" x0
+      )
+
+instance ( ty ~ IO ()
+         ) => BG.HasField "unwrapFileOpenedNotification_Aux" (BG.Ptr FileOpenedNotification_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFileOpenedNotification_Aux")
+
+instance HasCField.HasCField FileOpenedNotification_Aux "unwrapFileOpenedNotification_Aux" where
+
+  type CFieldType FileOpenedNotification_Aux "unwrapFileOpenedNotification_Aux" =
+    IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @FileOpenedNotification@
+
+    __defined at:__ @functions\/callbacks.h 10:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype FileOpenedNotification = FileOpenedNotification
+  { unwrapFileOpenedNotification :: BG.FunPtr FileOpenedNotification_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr FileOpenedNotification_Aux
+         ) => BG.CompatHasField.HasField "unwrapFileOpenedNotification" FileOpenedNotification ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FileOpenedNotification {unwrapFileOpenedNotification = y1}
+      , BG.getField @"unwrapFileOpenedNotification" x0
+      )
+
+instance ( ty ~ BG.FunPtr FileOpenedNotification_Aux
+         ) => BG.HasField "unwrapFileOpenedNotification" (BG.Ptr FileOpenedNotification) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFileOpenedNotification")
+
+instance HasCField.HasCField FileOpenedNotification "unwrapFileOpenedNotification" where
+
+  type CFieldType FileOpenedNotification "unwrapFileOpenedNotification" =
+    BG.FunPtr FileOpenedNotification_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'ProgressUpdate'
+
+    __C declaration:__ @ProgressUpdate@
+
+    __defined at:__ @functions\/callbacks.h 11:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype ProgressUpdate_Aux = ProgressUpdate_Aux
+  { unwrapProgressUpdate_Aux :: BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toProgressUpdate_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d551f31556ffa727_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @toProgressUpdate_Aux@
+hs_bindgen_d551f31556ffa727 ::
+     ProgressUpdate_Aux
+  -> IO (BG.FunPtr ProgressUpdate_Aux)
+hs_bindgen_d551f31556ffa727 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_d551f31556ffa727_base (\x1 ->
+                                                            BG.getField @"unwrapProgressUpdate_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromProgressUpdate_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ccf7f4b62a839a04_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @fromProgressUpdate_Aux@
+hs_bindgen_ccf7f4b62a839a04 ::
+     BG.FunPtr ProgressUpdate_Aux
+  -> ProgressUpdate_Aux
+hs_bindgen_ccf7f4b62a839a04 =
+  \funPtr0 ->
+    ProgressUpdate_Aux (\x1 ->
+                          hs_bindgen_ccf7f4b62a839a04_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr ProgressUpdate_Aux where
+
+  toFunPtr = hs_bindgen_d551f31556ffa727
+
+instance BG.FromFunPtr ProgressUpdate_Aux where
+
+  fromFunPtr = hs_bindgen_ccf7f4b62a839a04
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapProgressUpdate_Aux" ProgressUpdate_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ProgressUpdate_Aux {unwrapProgressUpdate_Aux = y1}
+      , BG.getField @"unwrapProgressUpdate_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.HasField "unwrapProgressUpdate_Aux" (BG.Ptr ProgressUpdate_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapProgressUpdate_Aux")
+
+instance HasCField.HasCField ProgressUpdate_Aux "unwrapProgressUpdate_Aux" where
+
+  type CFieldType ProgressUpdate_Aux "unwrapProgressUpdate_Aux" =
+    BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @ProgressUpdate@
+
+    __defined at:__ @functions\/callbacks.h 11:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype ProgressUpdate = ProgressUpdate
+  { unwrapProgressUpdate :: BG.FunPtr ProgressUpdate_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr ProgressUpdate_Aux
+         ) => BG.CompatHasField.HasField "unwrapProgressUpdate" ProgressUpdate ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> ProgressUpdate {unwrapProgressUpdate = y1}
+      , BG.getField @"unwrapProgressUpdate" x0
+      )
+
+instance ( ty ~ BG.FunPtr ProgressUpdate_Aux
+         ) => BG.HasField "unwrapProgressUpdate" (BG.Ptr ProgressUpdate) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapProgressUpdate")
+
+instance HasCField.HasCField ProgressUpdate "unwrapProgressUpdate" where
+
+  type CFieldType ProgressUpdate "unwrapProgressUpdate" =
+    BG.FunPtr ProgressUpdate_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'DataValidator'
+
+    __C declaration:__ @DataValidator@
+
+    __defined at:__ @functions\/callbacks.h 12:15@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype DataValidator_Aux = DataValidator_Aux
+  { unwrapDataValidator_Aux :: BG.CInt -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toDataValidator_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c656ca21e63343d6_base ::
+     (BG.CInt -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+
+-- __unique:__ @toDataValidator_Aux@
+hs_bindgen_c656ca21e63343d6 ::
+     DataValidator_Aux
+  -> IO (BG.FunPtr DataValidator_Aux)
+hs_bindgen_c656ca21e63343d6 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c656ca21e63343d6_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrapDataValidator_Aux" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromDataValidator_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_c1e79a4c11ca4033_base ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> BG.CInt -> IO BG.CInt
+
+-- __unique:__ @fromDataValidator_Aux@
+hs_bindgen_c1e79a4c11ca4033 ::
+     BG.FunPtr DataValidator_Aux
+  -> DataValidator_Aux
+hs_bindgen_c1e79a4c11ca4033 =
+  \funPtr0 ->
+    DataValidator_Aux (\x1 ->
+                         fmap BG.fromFFIType (hs_bindgen_c1e79a4c11ca4033_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr DataValidator_Aux where
+
+  toFunPtr = hs_bindgen_c656ca21e63343d6
+
+instance BG.FromFunPtr DataValidator_Aux where
+
+  fromFunPtr = hs_bindgen_c1e79a4c11ca4033
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapDataValidator_Aux" DataValidator_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DataValidator_Aux {unwrapDataValidator_Aux = y1}
+      , BG.getField @"unwrapDataValidator_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "unwrapDataValidator_Aux" (BG.Ptr DataValidator_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapDataValidator_Aux")
+
+instance HasCField.HasCField DataValidator_Aux "unwrapDataValidator_Aux" where
+
+  type CFieldType DataValidator_Aux "unwrapDataValidator_Aux" =
+    BG.CInt -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @DataValidator@
+
+    __defined at:__ @functions\/callbacks.h 12:15@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype DataValidator = DataValidator
+  { unwrapDataValidator :: BG.FunPtr DataValidator_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr DataValidator_Aux
+         ) => BG.CompatHasField.HasField "unwrapDataValidator" DataValidator ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> DataValidator {unwrapDataValidator = y1}
+      , BG.getField @"unwrapDataValidator" x0
+      )
+
+instance ( ty ~ BG.FunPtr DataValidator_Aux
+         ) => BG.HasField "unwrapDataValidator" (BG.Ptr DataValidator) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapDataValidator")
+
+instance HasCField.HasCField DataValidator "unwrapDataValidator" where
+
+  type CFieldType DataValidator "unwrapDataValidator" =
+    BG.FunPtr DataValidator_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct Measurement@
+
+    __defined at:__ @functions\/callbacks.h 21:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data Measurement = Measurement
+  { measurement_value :: BG.CDouble
+    {- ^ __C declaration:__ @value@
+
+         __defined at:__ @functions\/callbacks.h 22:10@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  , measurement_timestamp :: BG.CDouble
+    {- ^ __C declaration:__ @timestamp@
+
+         __defined at:__ @functions\/callbacks.h 23:10@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Measurement where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Measurement where
+
+  readRaw =
+    \ptr0 ->
+          pure Measurement
+      <*> HasCField.readRaw (BG.Proxy @"measurement_value") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"measurement_timestamp") ptr0
+
+instance Marshal.WriteRaw Measurement where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Measurement measurement_value2 measurement_timestamp3 ->
+               HasCField.writeRaw (BG.Proxy @"measurement_value") ptr0 measurement_value2
+            >> HasCField.writeRaw (BG.Proxy @"measurement_timestamp") ptr0 measurement_timestamp3
+
+deriving via Marshal.EquivStorable Measurement instance BG.Storable Measurement
+
+deriving via Struct.IsStructViaReadRaw Measurement instance Struct.IsStruct Measurement
+
+{-| __C declaration:__ @value@
+
+    __defined at:__ @functions\/callbacks.h 22:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "measurement_value" Measurement ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Measurement { measurement_value = y1
+                      , measurement_timestamp = BG.getField @"measurement_timestamp" x0
+                      }
+      , BG.getField @"measurement_value" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "measurement_value" (BG.Ptr Measurement) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"measurement_value")
+
+instance HasCField.HasCField Measurement "measurement_value" where
+
+  type CFieldType Measurement "measurement_value" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @timestamp@
+
+    __defined at:__ @functions\/callbacks.h 23:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "measurement_timestamp" Measurement ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Measurement { measurement_timestamp = y1
+                      , measurement_value = BG.getField @"measurement_value" x0
+                      }
+      , BG.getField @"measurement_timestamp" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "measurement_timestamp" (BG.Ptr Measurement) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"measurement_timestamp")
+
+instance HasCField.HasCField Measurement "measurement_timestamp" where
+
+  type CFieldType Measurement "measurement_timestamp" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 8
+
+{-| Auxiliary type used by 'MeasurementReceived'
+
+    __C declaration:__ @MeasurementReceived@
+
+    __defined at:__ @functions\/callbacks.h 26:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype MeasurementReceived_Aux = MeasurementReceived_Aux
+  { unwrapMeasurementReceived_Aux :: BG.Ptr Measurement -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toMeasurementReceived_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_9259654df9d40f5b_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toMeasurementReceived_Aux@
+hs_bindgen_9259654df9d40f5b ::
+     MeasurementReceived_Aux
+  -> IO (BG.FunPtr MeasurementReceived_Aux)
+hs_bindgen_9259654df9d40f5b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_9259654df9d40f5b_base (\x1 ->
+                                                            BG.getField @"unwrapMeasurementReceived_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromMeasurementReceived_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_383c36bb22947621_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromMeasurementReceived_Aux@
+hs_bindgen_383c36bb22947621 ::
+     BG.FunPtr MeasurementReceived_Aux
+  -> MeasurementReceived_Aux
+hs_bindgen_383c36bb22947621 =
+  \funPtr0 ->
+    MeasurementReceived_Aux (\x1 ->
+                               hs_bindgen_383c36bb22947621_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr MeasurementReceived_Aux where
+
+  toFunPtr = hs_bindgen_9259654df9d40f5b
+
+instance BG.FromFunPtr MeasurementReceived_Aux where
+
+  fromFunPtr = hs_bindgen_383c36bb22947621
+
+instance ( ty ~ (BG.Ptr Measurement -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapMeasurementReceived_Aux" MeasurementReceived_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MeasurementReceived_Aux {unwrapMeasurementReceived_Aux = y1}
+      , BG.getField @"unwrapMeasurementReceived_Aux" x0
+      )
+
+instance ( ty ~ (BG.Ptr Measurement -> IO ())
+         ) => BG.HasField "unwrapMeasurementReceived_Aux" (BG.Ptr MeasurementReceived_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMeasurementReceived_Aux")
+
+instance HasCField.HasCField MeasurementReceived_Aux "unwrapMeasurementReceived_Aux" where
+
+  type CFieldType MeasurementReceived_Aux "unwrapMeasurementReceived_Aux" =
+    BG.Ptr Measurement -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @MeasurementReceived@
+
+    __defined at:__ @functions\/callbacks.h 26:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype MeasurementReceived = MeasurementReceived
+  { unwrapMeasurementReceived :: BG.FunPtr MeasurementReceived_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr MeasurementReceived_Aux
+         ) => BG.CompatHasField.HasField "unwrapMeasurementReceived" MeasurementReceived ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MeasurementReceived {unwrapMeasurementReceived = y1}
+      , BG.getField @"unwrapMeasurementReceived" x0
+      )
+
+instance ( ty ~ BG.FunPtr MeasurementReceived_Aux
+         ) => BG.HasField "unwrapMeasurementReceived" (BG.Ptr MeasurementReceived) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMeasurementReceived")
+
+instance HasCField.HasCField MeasurementReceived "unwrapMeasurementReceived" where
+
+  type CFieldType MeasurementReceived "unwrapMeasurementReceived" =
+    BG.FunPtr MeasurementReceived_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'MeasurementReceived2'
+
+    __C declaration:__ @MeasurementReceived2@
+
+    __defined at:__ @functions\/callbacks.h 29:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype MeasurementReceived2_Aux = MeasurementReceived2_Aux
+  { unwrapMeasurementReceived2_Aux :: Measurement -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ (Measurement -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapMeasurementReceived2_Aux" MeasurementReceived2_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MeasurementReceived2_Aux {unwrapMeasurementReceived2_Aux = y1}
+      , BG.getField @"unwrapMeasurementReceived2_Aux" x0
+      )
+
+instance ( ty ~ (Measurement -> IO ())
+         ) => BG.HasField "unwrapMeasurementReceived2_Aux" (BG.Ptr MeasurementReceived2_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMeasurementReceived2_Aux")
+
+instance HasCField.HasCField MeasurementReceived2_Aux "unwrapMeasurementReceived2_Aux" where
+
+  type CFieldType MeasurementReceived2_Aux "unwrapMeasurementReceived2_Aux" =
+    Measurement -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @MeasurementReceived2@
+
+    __defined at:__ @functions\/callbacks.h 29:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype MeasurementReceived2 = MeasurementReceived2
+  { unwrapMeasurementReceived2 :: BG.FunPtr MeasurementReceived2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr MeasurementReceived2_Aux
+         ) => BG.CompatHasField.HasField "unwrapMeasurementReceived2" MeasurementReceived2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MeasurementReceived2 {unwrapMeasurementReceived2 = y1}
+      , BG.getField @"unwrapMeasurementReceived2" x0
+      )
+
+instance ( ty ~ BG.FunPtr MeasurementReceived2_Aux
+         ) => BG.HasField "unwrapMeasurementReceived2" (BG.Ptr MeasurementReceived2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMeasurementReceived2")
+
+instance HasCField.HasCField MeasurementReceived2 "unwrapMeasurementReceived2" where
+
+  type CFieldType MeasurementReceived2 "unwrapMeasurementReceived2" =
+    BG.FunPtr MeasurementReceived2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'SampleBufferFull'
+
+    __C declaration:__ @SampleBufferFull@
+
+    __defined at:__ @functions\/callbacks.h 32:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype SampleBufferFull_Aux = SampleBufferFull_Aux
+  { unwrapSampleBufferFull_Aux :: BG.Ptr (IsA.Elem (CA.ConstantArray 10 BG.CInt)) -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toSampleBufferFull_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_57d9e30494ae4453_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toSampleBufferFull_Aux@
+hs_bindgen_57d9e30494ae4453 ::
+     SampleBufferFull_Aux
+  -> IO (BG.FunPtr SampleBufferFull_Aux)
+hs_bindgen_57d9e30494ae4453 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_57d9e30494ae4453_base (\x1 ->
+                                                            BG.getField @"unwrapSampleBufferFull_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromSampleBufferFull_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_2ab7ac6bb756ba7e_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromSampleBufferFull_Aux@
+hs_bindgen_2ab7ac6bb756ba7e ::
+     BG.FunPtr SampleBufferFull_Aux
+  -> SampleBufferFull_Aux
+hs_bindgen_2ab7ac6bb756ba7e =
+  \funPtr0 ->
+    SampleBufferFull_Aux (\x1 ->
+                            hs_bindgen_2ab7ac6bb756ba7e_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr SampleBufferFull_Aux where
+
+  toFunPtr = hs_bindgen_57d9e30494ae4453
+
+instance BG.FromFunPtr SampleBufferFull_Aux where
+
+  fromFunPtr = hs_bindgen_2ab7ac6bb756ba7e
+
+instance ( ty ~ (BG.Ptr (IsA.Elem (CA.ConstantArray 10 BG.CInt)) -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapSampleBufferFull_Aux" SampleBufferFull_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SampleBufferFull_Aux {unwrapSampleBufferFull_Aux = y1}
+      , BG.getField @"unwrapSampleBufferFull_Aux" x0
+      )
+
+instance ( ty ~ (BG.Ptr (IsA.Elem (CA.ConstantArray 10 BG.CInt)) -> IO ())
+         ) => BG.HasField "unwrapSampleBufferFull_Aux" (BG.Ptr SampleBufferFull_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSampleBufferFull_Aux")
+
+instance HasCField.HasCField SampleBufferFull_Aux "unwrapSampleBufferFull_Aux" where
+
+  type CFieldType SampleBufferFull_Aux "unwrapSampleBufferFull_Aux" =
+    BG.Ptr (IsA.Elem (CA.ConstantArray 10 BG.CInt)) -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @SampleBufferFull@
+
+    __defined at:__ @functions\/callbacks.h 32:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype SampleBufferFull = SampleBufferFull
+  { unwrapSampleBufferFull :: BG.FunPtr SampleBufferFull_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr SampleBufferFull_Aux
+         ) => BG.CompatHasField.HasField "unwrapSampleBufferFull" SampleBufferFull ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SampleBufferFull {unwrapSampleBufferFull = y1}
+      , BG.getField @"unwrapSampleBufferFull" x0
+      )
+
+instance ( ty ~ BG.FunPtr SampleBufferFull_Aux
+         ) => BG.HasField "unwrapSampleBufferFull" (BG.Ptr SampleBufferFull) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSampleBufferFull")
+
+instance HasCField.HasCField SampleBufferFull "unwrapSampleBufferFull" where
+
+  type CFieldType SampleBufferFull "unwrapSampleBufferFull" =
+    BG.FunPtr SampleBufferFull_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct MeasurementHandler@
+
+    __defined at:__ @functions\/callbacks.h 50:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data MeasurementHandler = MeasurementHandler
+  { measurementHandler_onReceived :: BG.FunPtr (BG.Ptr Measurement -> IO ())
+    {- ^ __C declaration:__ @onReceived@
+
+         __defined at:__ @functions\/callbacks.h 51:10@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  , measurementHandler_validate :: BG.FunPtr (BG.Ptr Measurement -> IO BG.CInt)
+    {- ^ __C declaration:__ @validate@
+
+         __defined at:__ @functions\/callbacks.h 52:9@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  , measurementHandler_onError :: BG.FunPtr (BG.CInt -> IO ())
+    {- ^ __C declaration:__ @onError@
+
+         __defined at:__ @functions\/callbacks.h 53:10@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize MeasurementHandler where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw MeasurementHandler where
+
+  readRaw =
+    \ptr0 ->
+          pure MeasurementHandler
+      <*> HasCField.readRaw (BG.Proxy @"measurementHandler_onReceived") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"measurementHandler_validate") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"measurementHandler_onError") ptr0
+
+instance Marshal.WriteRaw MeasurementHandler where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          MeasurementHandler
+            measurementHandler_onReceived2
+            measurementHandler_validate3
+            measurementHandler_onError4 ->
+                 HasCField.writeRaw (BG.Proxy @"measurementHandler_onReceived") ptr0 measurementHandler_onReceived2
+              >> HasCField.writeRaw (BG.Proxy @"measurementHandler_validate") ptr0 measurementHandler_validate3
+              >> HasCField.writeRaw (BG.Proxy @"measurementHandler_onError") ptr0 measurementHandler_onError4
+
+deriving via Marshal.EquivStorable MeasurementHandler instance BG.Storable MeasurementHandler
+
+deriving via Struct.IsStructViaReadRaw MeasurementHandler instance Struct.IsStruct MeasurementHandler
+
+{-| __C declaration:__ @onReceived@
+
+    __defined at:__ @functions\/callbacks.h 51:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> IO ())
+         ) => BG.CompatHasField.HasField "measurementHandler_onReceived" MeasurementHandler ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MeasurementHandler { measurementHandler_onReceived = y1
+                             , measurementHandler_validate = BG.getField @"measurementHandler_validate" x0
+                             , measurementHandler_onError = BG.getField @"measurementHandler_onError" x0
+                             }
+      , BG.getField @"measurementHandler_onReceived" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> IO ())
+         ) => BG.HasField "measurementHandler_onReceived" (BG.Ptr MeasurementHandler) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"measurementHandler_onReceived")
+
+instance HasCField.HasCField MeasurementHandler "measurementHandler_onReceived" where
+
+  type CFieldType MeasurementHandler "measurementHandler_onReceived" =
+    BG.FunPtr (BG.Ptr Measurement -> IO ())
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @validate@
+
+    __defined at:__ @functions\/callbacks.h 52:9@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "measurementHandler_validate" MeasurementHandler ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MeasurementHandler { measurementHandler_validate = y1
+                             , measurementHandler_onReceived = BG.getField @"measurementHandler_onReceived" x0
+                             , measurementHandler_onError = BG.getField @"measurementHandler_onError" x0
+                             }
+      , BG.getField @"measurementHandler_validate" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> IO BG.CInt)
+         ) => BG.HasField "measurementHandler_validate" (BG.Ptr MeasurementHandler) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"measurementHandler_validate")
+
+instance HasCField.HasCField MeasurementHandler "measurementHandler_validate" where
+
+  type CFieldType MeasurementHandler "measurementHandler_validate" =
+    BG.FunPtr (BG.Ptr Measurement -> IO BG.CInt)
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @onError@
+
+    __defined at:__ @functions\/callbacks.h 53:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "measurementHandler_onError" MeasurementHandler ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          MeasurementHandler { measurementHandler_onError = y1
+                             , measurementHandler_onReceived = BG.getField @"measurementHandler_onReceived" x0
+                             , measurementHandler_validate = BG.getField @"measurementHandler_validate" x0
+                             }
+      , BG.getField @"measurementHandler_onError" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.CInt -> IO ())
+         ) => BG.HasField "measurementHandler_onError" (BG.Ptr MeasurementHandler) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"measurementHandler_onError")
+
+instance HasCField.HasCField MeasurementHandler "measurementHandler_onError" where
+
+  type CFieldType MeasurementHandler "measurementHandler_onError" =
+    BG.FunPtr (BG.CInt -> IO ())
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @struct DataPipeline@
+
+    __defined at:__ @functions\/callbacks.h 58:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data DataPipeline = DataPipeline
+  { dataPipeline_preProcess :: BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ())
+    {- ^ __C declaration:__ @preProcess@
+
+         __defined at:__ @functions\/callbacks.h 59:10@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  , dataPipeline_process :: BG.FunPtr (BG.Ptr Measurement -> IO ())
+    {- ^ __C declaration:__ @process@
+
+         __defined at:__ @functions\/callbacks.h 60:10@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  , dataPipeline_postProcess :: BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+    {- ^ __C declaration:__ @postProcess@
+
+         __defined at:__ @functions\/callbacks.h 61:10@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DataPipeline where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw DataPipeline where
+
+  readRaw =
+    \ptr0 ->
+          pure DataPipeline
+      <*> HasCField.readRaw (BG.Proxy @"dataPipeline_preProcess") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dataPipeline_process") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dataPipeline_postProcess") ptr0
+
+instance Marshal.WriteRaw DataPipeline where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DataPipeline
+            dataPipeline_preProcess2
+            dataPipeline_process3
+            dataPipeline_postProcess4 ->
+                 HasCField.writeRaw (BG.Proxy @"dataPipeline_preProcess") ptr0 dataPipeline_preProcess2
+              >> HasCField.writeRaw (BG.Proxy @"dataPipeline_process") ptr0 dataPipeline_process3
+              >> HasCField.writeRaw (BG.Proxy @"dataPipeline_postProcess") ptr0 dataPipeline_postProcess4
+
+deriving via Marshal.EquivStorable DataPipeline instance BG.Storable DataPipeline
+
+deriving via Struct.IsStructViaReadRaw DataPipeline instance Struct.IsStruct DataPipeline
+
+{-| __C declaration:__ @preProcess@
+
+    __defined at:__ @functions\/callbacks.h 59:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ())
+         ) => BG.CompatHasField.HasField "dataPipeline_preProcess" DataPipeline ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DataPipeline { dataPipeline_preProcess = y1
+                       , dataPipeline_process = BG.getField @"dataPipeline_process" x0
+                       , dataPipeline_postProcess = BG.getField @"dataPipeline_postProcess" x0
+                       }
+      , BG.getField @"dataPipeline_preProcess" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ())
+         ) => BG.HasField "dataPipeline_preProcess" (BG.Ptr DataPipeline) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dataPipeline_preProcess")
+
+instance HasCField.HasCField DataPipeline "dataPipeline_preProcess" where
+
+  type CFieldType DataPipeline "dataPipeline_preProcess" =
+    BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ())
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @process@
+
+    __defined at:__ @functions\/callbacks.h 60:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> IO ())
+         ) => BG.CompatHasField.HasField "dataPipeline_process" DataPipeline ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DataPipeline { dataPipeline_process = y1
+                       , dataPipeline_preProcess = BG.getField @"dataPipeline_preProcess" x0
+                       , dataPipeline_postProcess = BG.getField @"dataPipeline_postProcess" x0
+                       }
+      , BG.getField @"dataPipeline_process" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> IO ())
+         ) => BG.HasField "dataPipeline_process" (BG.Ptr DataPipeline) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dataPipeline_process")
+
+instance HasCField.HasCField DataPipeline "dataPipeline_process" where
+
+  type CFieldType DataPipeline "dataPipeline_process" =
+    BG.FunPtr (BG.Ptr Measurement -> IO ())
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @postProcess@
+
+    __defined at:__ @functions\/callbacks.h 61:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+         ) => BG.CompatHasField.HasField "dataPipeline_postProcess" DataPipeline ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DataPipeline { dataPipeline_postProcess = y1
+                       , dataPipeline_preProcess = BG.getField @"dataPipeline_preProcess" x0
+                       , dataPipeline_process = BG.getField @"dataPipeline_process" x0
+                       }
+      , BG.getField @"dataPipeline_postProcess" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+         ) => BG.HasField "dataPipeline_postProcess" (BG.Ptr DataPipeline) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dataPipeline_postProcess")
+
+instance HasCField.HasCField DataPipeline "dataPipeline_postProcess" where
+
+  type CFieldType DataPipeline "dataPipeline_postProcess" =
+    BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @union ProcessorCallback@
+
+    __defined at:__ @functions\/callbacks.h 69:7@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype ProcessorCallback = ProcessorCallback
+  { unwrapProcessorCallback :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize ProcessorCallback
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw ProcessorCallback
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw ProcessorCallback
+
+deriving via Marshal.EquivStorable ProcessorCallback instance BG.Storable ProcessorCallback
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion ProcessorCallback
+
+{-| __C declaration:__ @simple@
+
+    __defined at:__ @functions\/callbacks.h 70:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> IO ())
+         ) => BG.HasField "processorCallback_simple" ProcessorCallback ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @simple@
+
+    __defined at:__ @functions\/callbacks.h 70:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> IO ())
+         ) => BG.CompatHasField.HasField "processorCallback_simple" ProcessorCallback ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"processorCallback_simple" x0)
+
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> IO ())
+         ) => BG.HasField "processorCallback_simple" (BG.Ptr ProcessorCallback) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"processorCallback_simple")
+
+instance HasCField.HasCField ProcessorCallback "processorCallback_simple" where
+
+  type CFieldType ProcessorCallback "processorCallback_simple" =
+    BG.FunPtr (BG.Ptr Measurement -> IO ())
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @withValidator@
+
+    __defined at:__ @functions\/callbacks.h 71:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ())
+         ) => BG.HasField "processorCallback_withValidator" ProcessorCallback ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @withValidator@
+
+    __defined at:__ @functions\/callbacks.h 71:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ())
+         ) => BG.CompatHasField.HasField "processorCallback_withValidator" ProcessorCallback ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"processorCallback_withValidator" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ())
+         ) => BG.HasField "processorCallback_withValidator" (BG.Ptr ProcessorCallback) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"processorCallback_withValidator")
+
+instance HasCField.HasCField ProcessorCallback "processorCallback_withValidator" where
+
+  type CFieldType ProcessorCallback "processorCallback_withValidator" =
+    BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ())
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @withProgress@
+
+    __defined at:__ @functions\/callbacks.h 72:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+         ) => BG.HasField "processorCallback_withProgress" ProcessorCallback ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @withProgress@
+
+    __defined at:__ @functions\/callbacks.h 72:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+         ) => BG.CompatHasField.HasField "processorCallback_withProgress" ProcessorCallback ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"processorCallback_withProgress" x0
+      )
+
+instance ( ty ~ BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+         ) => BG.HasField "processorCallback_withProgress" (BG.Ptr ProcessorCallback) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"processorCallback_withProgress")
+
+instance HasCField.HasCField ProcessorCallback "processorCallback_withProgress" where
+
+  type CFieldType ProcessorCallback "processorCallback_withProgress" =
+    BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @enum \@Processor_mode@
+
+    __defined at:__ @functions\/callbacks.h 76:3@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype Processor_mode = Processor_mode
+  { unwrapProcessor_mode :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Processor_mode where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Processor_mode where
+
+  readRaw =
+    \ptr0 ->
+          pure Processor_mode
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Processor_mode where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Processor_mode unwrapProcessor_mode2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapProcessor_mode2
+
+deriving via Marshal.EquivStorable Processor_mode instance BG.Storable Processor_mode
+
+deriving via BG.CUInt instance BG.Prim Processor_mode
+
+instance CEnum.CEnum Processor_mode where
+
+  type CEnumZ Processor_mode = BG.CUInt
+
+  toCEnum = Processor_mode
+
+  fromCEnum = BG.getField @"unwrapProcessor_mode"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "MODE_SIMPLE")
+                                   , (1, BG.singleton "MODE_VALIDATED")
+                                   , (2, BG.singleton "MODE_PROGRESS")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Processor_mode"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Processor_mode"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Processor_mode where
+
+  minDeclaredValue = MODE_SIMPLE
+
+  maxDeclaredValue = MODE_PROGRESS
+
+instance Show Processor_mode where
+
+  showsPrec = CEnum.shows
+
+instance Read Processor_mode where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapProcessor_mode" Processor_mode ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Processor_mode {unwrapProcessor_mode = y1}
+      , BG.getField @"unwrapProcessor_mode" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapProcessor_mode" (BG.Ptr Processor_mode) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapProcessor_mode")
+
+instance HasCField.HasCField Processor_mode "unwrapProcessor_mode" where
+
+  type CFieldType Processor_mode "unwrapProcessor_mode" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @MODE_SIMPLE@
+
+    __defined at:__ @functions\/callbacks.h 76:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+pattern MODE_SIMPLE :: Processor_mode
+pattern MODE_SIMPLE = Processor_mode 0
+
+{-| __C declaration:__ @MODE_VALIDATED@
+
+    __defined at:__ @functions\/callbacks.h 76:23@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+pattern MODE_VALIDATED :: Processor_mode
+pattern MODE_VALIDATED = Processor_mode 1
+
+{-| __C declaration:__ @MODE_PROGRESS@
+
+    __defined at:__ @functions\/callbacks.h 76:39@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+pattern MODE_PROGRESS :: Processor_mode
+pattern MODE_PROGRESS = Processor_mode 2
+
+{-| __C declaration:__ @struct Processor@
+
+    __defined at:__ @functions\/callbacks.h 75:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data Processor = Processor
+  { processor_mode :: Processor_mode
+    {- ^ __C declaration:__ @mode@
+
+         __defined at:__ @functions\/callbacks.h 76:55@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  , processor_callback :: ProcessorCallback
+    {- ^ __C declaration:__ @callback@
+
+         __defined at:__ @functions\/callbacks.h 77:27@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize Processor where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Processor where
+
+  readRaw =
+    \ptr0 ->
+          pure Processor
+      <*> HasCField.readRaw (BG.Proxy @"processor_mode") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"processor_callback") ptr0
+
+instance Marshal.WriteRaw Processor where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Processor processor_mode2 processor_callback3 ->
+               HasCField.writeRaw (BG.Proxy @"processor_mode") ptr0 processor_mode2
+            >> HasCField.writeRaw (BG.Proxy @"processor_callback") ptr0 processor_callback3
+
+deriving via Marshal.EquivStorable Processor instance BG.Storable Processor
+
+deriving via Struct.IsStructViaReadRaw Processor instance Struct.IsStruct Processor
+
+{-| __C declaration:__ @mode@
+
+    __defined at:__ @functions\/callbacks.h 76:55@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ Processor_mode
+         ) => BG.CompatHasField.HasField "processor_mode" Processor ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Processor {processor_mode = y1, processor_callback = BG.getField @"processor_callback" x0}
+      , BG.getField @"processor_mode" x0
+      )
+
+instance ( ty ~ Processor_mode
+         ) => BG.HasField "processor_mode" (BG.Ptr Processor) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"processor_mode")
+
+instance HasCField.HasCField Processor "processor_mode" where
+
+  type CFieldType Processor "processor_mode" =
+    Processor_mode
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @callback@
+
+    __defined at:__ @functions\/callbacks.h 77:27@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ ProcessorCallback
+         ) => BG.CompatHasField.HasField "processor_callback" Processor ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Processor {processor_callback = y1, processor_mode = BG.getField @"processor_mode" x0}
+      , BG.getField @"processor_callback" x0
+      )
+
+instance ( ty ~ ProcessorCallback
+         ) => BG.HasField "processor_callback" (BG.Ptr Processor) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"processor_callback")
+
+instance HasCField.HasCField Processor "processor_callback" where
+
+  type CFieldType Processor "processor_callback" =
+    ProcessorCallback
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @functions\/callbacks.h 94:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype Foo = Foo
+  { unwrapFoo :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapFoo" Foo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo {unwrapFoo = y1}, BG.getField @"unwrapFoo" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapFoo" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFoo")
+
+instance HasCField.HasCField Foo "unwrapFoo" where
+
+  type CFieldType Foo "unwrapFoo" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @functions\/callbacks.h 95:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype Foo2 = Foo2
+  { unwrapFoo2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapFoo2" Foo2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo2 {unwrapFoo2 = y1}, BG.getField @"unwrapFoo2" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapFoo2" (BG.Ptr Foo2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFoo2")
+
+instance HasCField.HasCField Foo2 "unwrapFoo2" where
+
+  type CFieldType Foo2 "unwrapFoo2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @functions\/callbacks.h 102:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype A = A
+  { unwrapA :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @B@
+
+    __defined at:__ @functions\/callbacks.h 108:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype B = B
+  { unwrapB :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/callbacks.h 109:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data S = S
+  { s_fn :: BG.FunPtr (B -> IO ())
+    {- ^ __C declaration:__ @fn@
+
+         __defined at:__ @functions\/callbacks.h 110:17@
+
+         __exported by:__ @functions\/callbacks.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_fn") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_fn2 ->
+            HasCField.writeRaw (BG.Proxy @"s_fn") ptr0 s_fn2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/callbacks.h 110:17@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ BG.FunPtr (B -> IO ())
+         ) => BG.CompatHasField.HasField "s_fn" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_fn = y1}, BG.getField @"s_fn" x0)
+
+instance ( ty ~ BG.FunPtr (B -> IO ())
+         ) => BG.HasField "s_fn" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_fn")
+
+instance HasCField.HasCField S "s_fn" where
+
+  type CFieldType S "s_fn" = BG.FunPtr (B -> IO ())
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @C@
+
+    __defined at:__ @functions\/callbacks.h 116:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype C = C
+  { unwrapC :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapC" C ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> C {unwrapC = y1}, BG.getField @"unwrapC" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapC" (BG.Ptr C) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapC")
+
+instance HasCField.HasCField C "unwrapC" where
+
+  type CFieldType C "unwrapC" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/callbacks.h 117:7@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype U = U
+  { unwrapU :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 24 8 instance Marshal.StaticSize U
+
+deriving via BG.SizedByteArray 24 8 instance Marshal.ReadRaw U
+
+deriving via BG.SizedByteArray 24 8 instance Marshal.WriteRaw U
+
+deriving via Marshal.EquivStorable U instance BG.Storable U
+
+deriving via BG.SizedByteArray 24 8 instance Union.IsUnion U
+
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/callbacks.h 118:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ CA.ConstantArray 3 (BG.FunPtr (C -> IO ()))
+         ) => BG.HasField "u_fn" U ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/callbacks.h 118:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+instance ( ty ~ CA.ConstantArray 3 (BG.FunPtr (C -> IO ()))
+         ) => BG.CompatHasField.HasField "u_fn" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"u_fn" x0)
+
+instance ( ty ~ CA.ConstantArray 3 (BG.FunPtr (C -> IO ()))
+         ) => BG.HasField "u_fn" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"u_fn")
+
+instance HasCField.HasCField U "u_fn" where
+
+  type CFieldType U "u_fn" =
+    CA.ConstantArray 3 (BG.FunPtr (C -> IO ()))
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @D@
+
+    __defined at:__ @functions\/callbacks.h 124:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype D = D
+  { unwrapD :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapD" D ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> D {unwrapD = y1}, BG.getField @"unwrapD" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapD" (BG.Ptr D) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapD")
+
+instance HasCField.HasCField D "unwrapD" where
+
+  type CFieldType D "unwrapD" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @functions\/callbacks.h 125:15@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype T = T
+  { unwrapT :: BG.FunPtr (D -> IO ()) -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toT@
+foreign import ccall safe "wrapper" hs_bindgen_b8534912f6256492_base ::
+     (BG.FunPtr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.FunPtr BG.Void -> IO ()))
+
+-- __unique:__ @toT@
+hs_bindgen_b8534912f6256492 ::
+     T
+  -> IO (BG.FunPtr T)
+hs_bindgen_b8534912f6256492 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b8534912f6256492_base (\x1 ->
+                                                            BG.getField @"unwrapT" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromT@
+foreign import ccall safe "dynamic" hs_bindgen_8f830eadb43a6fe4_base ::
+     BG.FunPtr (BG.FunPtr BG.Void -> IO ())
+  -> BG.FunPtr BG.Void -> IO ()
+
+-- __unique:__ @fromT@
+hs_bindgen_8f830eadb43a6fe4 ::
+     BG.FunPtr T
+  -> T
+hs_bindgen_8f830eadb43a6fe4 =
+  \funPtr0 ->
+    T (\x1 ->
+         hs_bindgen_8f830eadb43a6fe4_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr T where
+
+  toFunPtr = hs_bindgen_b8534912f6256492
+
+instance BG.FromFunPtr T where
+
+  fromFunPtr = hs_bindgen_8f830eadb43a6fe4
+
+instance ( ty ~ (BG.FunPtr (D -> IO ()) -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance ( ty ~ (BG.FunPtr (D -> IO ()) -> IO ())
+         ) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" =
+    BG.FunPtr (D -> IO ()) -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+-- __unique:__ @instance ToFunPtr (A -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_a46c670f88b5e6d2_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (A -> IO ())@
+hs_bindgen_a46c670f88b5e6d2 ::
+     (A -> IO ())
+  -> IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_a46c670f88b5e6d2 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_a46c670f88b5e6d2_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (A -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_542fc348d1df7dff_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @instance FromFunPtr (A -> IO ())@
+hs_bindgen_542fc348d1df7dff ::
+     BG.FunPtr (A -> IO ())
+  -> A -> IO ()
+hs_bindgen_542fc348d1df7dff =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_542fc348d1df7dff_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (A -> IO ()) where
+
+  toFunPtr = hs_bindgen_a46c670f88b5e6d2
+
+instance BG.FromFunPtr (A -> IO ()) where
+
+  fromFunPtr = hs_bindgen_542fc348d1df7dff
+
+-- __unique:__ @instance ToFunPtr (B -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_ca9230f035bf19b1_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (B -> IO ())@
+hs_bindgen_ca9230f035bf19b1 ::
+     (B -> IO ())
+  -> IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_ca9230f035bf19b1 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_ca9230f035bf19b1_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (B -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_05635addcbfd7dd4_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @instance FromFunPtr (B -> IO ())@
+hs_bindgen_05635addcbfd7dd4 ::
+     BG.FunPtr (B -> IO ())
+  -> B -> IO ()
+hs_bindgen_05635addcbfd7dd4 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_05635addcbfd7dd4_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (B -> IO ()) where
+
+  toFunPtr = hs_bindgen_ca9230f035bf19b1
+
+instance BG.FromFunPtr (B -> IO ()) where
+
+  fromFunPtr = hs_bindgen_05635addcbfd7dd4
+
+-- __unique:__ @instance ToFunPtr (C -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_151c4eb8866d683f_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (C -> IO ())@
+hs_bindgen_151c4eb8866d683f ::
+     (C -> IO ())
+  -> IO (BG.FunPtr (C -> IO ()))
+hs_bindgen_151c4eb8866d683f =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_151c4eb8866d683f_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (C -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_f9f9dcb4f8267450_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @instance FromFunPtr (C -> IO ())@
+hs_bindgen_f9f9dcb4f8267450 ::
+     BG.FunPtr (C -> IO ())
+  -> C -> IO ()
+hs_bindgen_f9f9dcb4f8267450 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_f9f9dcb4f8267450_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (C -> IO ()) where
+
+  toFunPtr = hs_bindgen_151c4eb8866d683f
+
+instance BG.FromFunPtr (C -> IO ()) where
+
+  fromFunPtr = hs_bindgen_f9f9dcb4f8267450
+
+-- __unique:__ @instance ToFunPtr (D -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_bb8d99987b90516d_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (D -> IO ())@
+hs_bindgen_bb8d99987b90516d ::
+     (D -> IO ())
+  -> IO (BG.FunPtr (D -> IO ()))
+hs_bindgen_bb8d99987b90516d =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_bb8d99987b90516d_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (D -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_8eef50c371b3a153_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @instance FromFunPtr (D -> IO ())@
+hs_bindgen_8eef50c371b3a153 ::
+     BG.FunPtr (D -> IO ())
+  -> D -> IO ()
+hs_bindgen_8eef50c371b3a153 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_8eef50c371b3a153_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (D -> IO ()) where
+
+  toFunPtr = hs_bindgen_bb8d99987b90516d
+
+instance BG.FromFunPtr (D -> IO ()) where
+
+  fromFunPtr = hs_bindgen_8eef50c371b3a153
+
+-- __unique:__ @instance ToFunPtr (Foo -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_d2a71f330b782e41_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (Foo -> IO ())@
+hs_bindgen_d2a71f330b782e41 ::
+     (Foo -> IO ())
+  -> IO (BG.FunPtr (Foo -> IO ()))
+hs_bindgen_d2a71f330b782e41 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_d2a71f330b782e41_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (Foo -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_c08440542d338bad_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @instance FromFunPtr (Foo -> IO ())@
+hs_bindgen_c08440542d338bad ::
+     BG.FunPtr (Foo -> IO ())
+  -> Foo -> IO ()
+hs_bindgen_c08440542d338bad =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_c08440542d338bad_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (Foo -> IO ()) where
+
+  toFunPtr = hs_bindgen_d2a71f330b782e41
+
+instance BG.FromFunPtr (Foo -> IO ()) where
+
+  fromFunPtr = hs_bindgen_c08440542d338bad
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+foreign import ccall safe "wrapper" hs_bindgen_4064610c89a52f99_base ::
+     (BG.Ptr BG.Void -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO BG.CInt))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+hs_bindgen_4064610c89a52f99 ::
+     (BG.Ptr Measurement -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr Measurement -> IO BG.CInt))
+hs_bindgen_4064610c89a52f99 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_4064610c89a52f99_base (\x1 ->
+                                                            fmap BG.toFFIType (fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+foreign import ccall safe "dynamic" hs_bindgen_46b04bdda1fdaafc_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO BG.CInt)
+  -> BG.Ptr BG.Void -> IO BG.CInt
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+hs_bindgen_46b04bdda1fdaafc ::
+     BG.FunPtr (BG.Ptr Measurement -> IO BG.CInt)
+  -> BG.Ptr Measurement -> IO BG.CInt
+hs_bindgen_46b04bdda1fdaafc =
+  \funPtr0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_46b04bdda1fdaafc_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr (BG.Ptr Measurement -> IO BG.CInt) where
+
+  toFunPtr = hs_bindgen_4064610c89a52f99
+
+instance BG.FromFunPtr (BG.Ptr Measurement -> IO BG.CInt) where
+
+  fromFunPtr = hs_bindgen_46b04bdda1fdaafc
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_0e70e3ef331da59c_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO ())@
+hs_bindgen_0e70e3ef331da59c ::
+     (BG.Ptr Measurement -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr Measurement -> IO ()))
+hs_bindgen_0e70e3ef331da59c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_0e70e3ef331da59c_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_900e47c9e85104f3_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO ())@
+hs_bindgen_900e47c9e85104f3 ::
+     BG.FunPtr (BG.Ptr Measurement -> IO ())
+  -> BG.Ptr Measurement -> IO ()
+hs_bindgen_900e47c9e85104f3 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_900e47c9e85104f3_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (BG.Ptr Measurement -> IO ()) where
+
+  toFunPtr = hs_bindgen_0e70e3ef331da59c
+
+instance BG.FromFunPtr (BG.Ptr Measurement -> IO ()) where
+
+  fromFunPtr = hs_bindgen_900e47c9e85104f3
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_ee5115ecd6cd3b7d_base ::
+     (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+hs_bindgen_ee5115ecd6cd3b7d ::
+     (BG.Ptr Measurement -> DataValidator -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ()))
+hs_bindgen_ee5115ecd6cd3b7d =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_ee5115ecd6cd3b7d_base (\x1 ->
+                                                            \x2 ->
+                                                              fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_767024eb494db15e_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.FunPtr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+hs_bindgen_767024eb494db15e ::
+     BG.FunPtr (BG.Ptr Measurement -> DataValidator -> IO ())
+  -> BG.Ptr Measurement -> DataValidator -> IO ()
+hs_bindgen_767024eb494db15e =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_767024eb494db15e_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+instance BG.ToFunPtr (BG.Ptr Measurement -> DataValidator -> IO ()) where
+
+  toFunPtr = hs_bindgen_ee5115ecd6cd3b7d
+
+instance BG.FromFunPtr (BG.Ptr Measurement -> DataValidator -> IO ()) where
+
+  fromFunPtr = hs_bindgen_767024eb494db15e
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_9c62e3e4c665b341_base ::
+     (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+hs_bindgen_9c62e3e4c665b341 ::
+     (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()))
+hs_bindgen_9c62e3e4c665b341 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_9c62e3e4c665b341_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_be989dc6cfcbaa3c_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ())
+  -> BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+hs_bindgen_be989dc6cfcbaa3c ::
+     BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())
+  -> BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()
+hs_bindgen_be989dc6cfcbaa3c =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_be989dc6cfcbaa3c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+instance BG.ToFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) where
+
+  toFunPtr = hs_bindgen_9c62e3e4c665b341
+
+instance BG.FromFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) where
+
+  fromFunPtr = hs_bindgen_be989dc6cfcbaa3c
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_cbc1799daa163d3d_base ::
+     (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+hs_bindgen_cbc1799daa163d3d ::
+     (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ()))
+hs_bindgen_cbc1799daa163d3d =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_cbc1799daa163d3d_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_b313881940dff0dc_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ())
+  -> BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+hs_bindgen_b313881940dff0dc ::
+     BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())
+  -> BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ()
+hs_bindgen_b313881940dff0dc =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_b313881940dff0dc_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+instance BG.ToFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ()) where
+
+  toFunPtr = hs_bindgen_cbc1799daa163d3d
+
+instance BG.FromFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ()) where
+
+  fromFunPtr = hs_bindgen_b313881940dff0dc
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_7b1e0c518e5f0b1b_base ::
+     (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+hs_bindgen_7b1e0c518e5f0b1b ::
+     (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ()))
+hs_bindgen_7b1e0c518e5f0b1b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7b1e0c518e5f0b1b_base (\x1 ->
+                                                            \x2 ->
+                                                              fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_0a3b532434d7e43c_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.FunPtr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+hs_bindgen_0a3b532434d7e43c ::
+     BG.FunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())
+  -> BG.Ptr Measurement -> ProgressUpdate -> IO ()
+hs_bindgen_0a3b532434d7e43c =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_0a3b532434d7e43c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+instance BG.ToFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ()) where
+
+  toFunPtr = hs_bindgen_7b1e0c518e5f0b1b
+
+instance BG.FromFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ()) where
+
+  fromFunPtr = hs_bindgen_0a3b532434d7e43c
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_ba073f1e0ec5008b_base ::
+     (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+hs_bindgen_ba073f1e0ec5008b ::
+     (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ()))
+hs_bindgen_ba073f1e0ec5008b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_ba073f1e0ec5008b_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_090d079ea979a39d_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ())
+  -> BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.CInt -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+hs_bindgen_090d079ea979a39d ::
+     BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())
+  -> BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ()
+hs_bindgen_090d079ea979a39d =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_090d079ea979a39d_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+instance BG.ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ()) where
+
+  toFunPtr = hs_bindgen_ba073f1e0ec5008b
+
+instance BG.FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ()) where
+
+  fromFunPtr = hs_bindgen_090d079ea979a39d
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_e1d08f76a35007c0_base ::
+     (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.FunPtr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.FunPtr BG.Void -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+hs_bindgen_e1d08f76a35007c0 ::
+     (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ()))
+hs_bindgen_e1d08f76a35007c0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_e1d08f76a35007c0_base (\x1 ->
+                                                            \x2 ->
+                                                              \x3 ->
+                                                                fun0 (BG.fromFFIType x1) (BG.fromFFIType x2) (BG.fromFFIType x3)))
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_74f2cb0fd2d13cc1_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.FunPtr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> BG.FunPtr BG.Void -> BG.FunPtr BG.Void -> IO ()
+
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+hs_bindgen_74f2cb0fd2d13cc1 ::
+     BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())
+  -> BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ()
+hs_bindgen_74f2cb0fd2d13cc1 =
+  \funPtr0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_74f2cb0fd2d13cc1_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+instance BG.ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ()) where
+
+  toFunPtr = hs_bindgen_e1d08f76a35007c0
+
+instance BG.FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ()) where
+
+  fromFunPtr = hs_bindgen_74f2cb0fd2d13cc1
+
+-- __unique:__ @instance ToFunPtr (Foo2 -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_235fa4a89af25f04_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @instance ToFunPtr (Foo2 -> IO ())@
+hs_bindgen_235fa4a89af25f04 ::
+     (Foo2 -> IO ())
+  -> IO (BG.FunPtr (Foo2 -> IO ()))
+hs_bindgen_235fa4a89af25f04 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_235fa4a89af25f04_base (\x1 ->
+                                                            fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @instance FromFunPtr (Foo2 -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_8605b223a9ab9562_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @instance FromFunPtr (Foo2 -> IO ())@
+hs_bindgen_8605b223a9ab9562 ::
+     BG.FunPtr (Foo2 -> IO ())
+  -> Foo2 -> IO ()
+hs_bindgen_8605b223a9ab9562 =
+  \funPtr0 ->
+    \x1 ->
+      hs_bindgen_8605b223a9ab9562_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)
+
+instance BG.ToFunPtr (Foo2 -> IO ()) where
+
+  toFunPtr = hs_bindgen_235fa4a89af25f04
+
+instance BG.FromFunPtr (Foo2 -> IO ()) where
+
+  fromFunPtr = hs_bindgen_8605b223a9ab9562
diff --git a/test-artefacts/fixtures/functions/callbacks/Example/FunPtr.hs b/test-artefacts/fixtures/functions/callbacks/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/callbacks/Example/FunPtr.hs
@@ -0,0 +1,513 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.readFileWithProcessor
+    , Example.FunPtr.watchTemperature
+    , Example.FunPtr.onFileOpened
+    , Example.FunPtr.onProgressChanged
+    , Example.FunPtr.validateInput
+    , Example.FunPtr.onNewMeasurement
+    , Example.FunPtr.onNewMeasurement2
+    , Example.FunPtr.onBufferReady
+    , Example.FunPtr.transformMeasurement
+    , Example.FunPtr.processWithCallbacks
+    , Example.FunPtr.registerHandler
+    , Example.FunPtr.executePipeline
+    , Example.FunPtr.runProcessor
+    , Example.FunPtr.processMeasurementWithValidation
+    , Example.FunPtr.f
+    , Example.FunPtr.f2
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/callbacks.h>"
+  , "/* test_functionscallbacks_Example_get_readFileWithProcessor */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_793b9ca86a272b6a (void)) ("
+  , "  void (*arg1) ("
+  , "  signed int arg1"
+  , "),"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &readFileWithProcessor;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_watchTemperature */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a2b606291df27114 (void)) ("
+  , "  void (*arg1) ("
+  , "  signed int arg1"
+  , "),"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &watchTemperature;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_onFileOpened */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2c00a09a05e4c87b (void)) ("
+  , "  FileOpenedNotification arg1"
+  , ")"
+  , "{"
+  , "  return &onFileOpened;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_onProgressChanged */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_84066778519d3ea8 (void)) ("
+  , "  ProgressUpdate arg1"
+  , ")"
+  , "{"
+  , "  return &onProgressChanged;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_validateInput */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_4d522e3ec1eb0b9f (void)) ("
+  , "  DataValidator arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &validateInput;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_onNewMeasurement */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a26d6914af82ade0 (void)) ("
+  , "  MeasurementReceived arg1"
+  , ")"
+  , "{"
+  , "  return &onNewMeasurement;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_onNewMeasurement2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2c377b597bd80e50 (void)) ("
+  , "  MeasurementReceived2 arg1"
+  , ")"
+  , "{"
+  , "  return &onNewMeasurement2;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_onBufferReady */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d1ce142d0c667e22 (void)) ("
+  , "  SampleBufferFull arg1"
+  , ")"
+  , "{"
+  , "  return &onBufferReady;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_transformMeasurement */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2e8d6b201521b14a (void)) ("
+  , "  struct Measurement *arg1,"
+  , "  void (*arg2) ("
+  , "  struct Measurement *arg1,"
+  , "  double (*arg2) ("
+  , "  double arg1,"
+  , "  signed int arg2"
+  , "),"
+  , "  signed int arg3"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &transformMeasurement;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_processWithCallbacks */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7f4acb7260277d86 (void)) ("
+  , "  void (*arg1) ("
+  , "  struct Measurement *arg1,"
+  , "  FileOpenedNotification arg2,"
+  , "  signed int arg3"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &processWithCallbacks;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_registerHandler */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_80684ecfa6d982b7 (void)) ("
+  , "  struct MeasurementHandler *arg1"
+  , ")"
+  , "{"
+  , "  return &registerHandler;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_executePipeline */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1714a267564c9f6f (void)) ("
+  , "  struct Measurement *arg1,"
+  , "  struct DataPipeline *arg2"
+  , ")"
+  , "{"
+  , "  return &executePipeline;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_runProcessor */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fedf80fe8e91dc7a (void)) ("
+  , "  struct Measurement *arg1,"
+  , "  struct Processor *arg2"
+  , ")"
+  , "{"
+  , "  return &runProcessor;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_processMeasurementWithValidation */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_443cb57c681c2cab (void)) ("
+  , "  struct Measurement *arg1,"
+  , "  void (*arg2) ("
+  , "  struct Measurement *arg1,"
+  , "  void (*arg2) ("
+  , "  struct Measurement *arg1,"
+  , "  DataValidator arg2,"
+  , "  signed int arg3"
+  , "),"
+  , "  DataValidator arg3"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &processMeasurementWithValidation;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_f */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7cf6cffd19682c36 (void)) ("
+  , "  void (*arg1) ("
+  , "  foo arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &f;"
+  , "}"
+  , "/* test_functionscallbacks_Example_get_f2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_81fde2984e04c791 (void)) ("
+  , "  void (*arg1) ("
+  , "  foo2 const arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &f2;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionscallbacks_Example_get_readFileWithProcessor@
+foreign import ccall unsafe "hs_bindgen_793b9ca86a272b6a" hs_bindgen_793b9ca86a272b6a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_readFileWithProcessor@
+hs_bindgen_793b9ca86a272b6a :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO ()) -> BG.CInt -> IO BG.CInt))
+hs_bindgen_793b9ca86a272b6a =
+  fmap BG.fromFFIType hs_bindgen_793b9ca86a272b6a_base
+
+{-# NOINLINE readFileWithProcessor #-}
+{-| __C declaration:__ @readFileWithProcessor@
+
+    __defined at:__ @functions\/callbacks.h 4:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+readFileWithProcessor :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO ()) -> BG.CInt -> IO BG.CInt)
+readFileWithProcessor =
+  BG.unsafePerformIO hs_bindgen_793b9ca86a272b6a
+
+-- __unique:__ @test_functionscallbacks_Example_get_watchTemperature@
+foreign import ccall unsafe "hs_bindgen_a2b606291df27114" hs_bindgen_a2b606291df27114_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_watchTemperature@
+hs_bindgen_a2b606291df27114 :: IO (BG.FunPtr (BG.FunPtr (BG.CInt -> IO ()) -> BG.CInt -> IO ()))
+hs_bindgen_a2b606291df27114 =
+  fmap BG.fromFFIType hs_bindgen_a2b606291df27114_base
+
+{-# NOINLINE watchTemperature #-}
+{-| __C declaration:__ @watchTemperature@
+
+    __defined at:__ @functions\/callbacks.h 5:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+watchTemperature :: BG.FunPtr (BG.FunPtr (BG.CInt -> IO ()) -> BG.CInt -> IO ())
+watchTemperature =
+  BG.unsafePerformIO hs_bindgen_a2b606291df27114
+
+-- __unique:__ @test_functionscallbacks_Example_get_onFileOpened@
+foreign import ccall unsafe "hs_bindgen_2c00a09a05e4c87b" hs_bindgen_2c00a09a05e4c87b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_onFileOpened@
+hs_bindgen_2c00a09a05e4c87b :: IO (BG.FunPtr (FileOpenedNotification -> IO ()))
+hs_bindgen_2c00a09a05e4c87b =
+  fmap BG.fromFFIType hs_bindgen_2c00a09a05e4c87b_base
+
+{-# NOINLINE onFileOpened #-}
+{-| __C declaration:__ @onFileOpened@
+
+    __defined at:__ @functions\/callbacks.h 14:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onFileOpened :: BG.FunPtr (FileOpenedNotification -> IO ())
+onFileOpened =
+  BG.unsafePerformIO hs_bindgen_2c00a09a05e4c87b
+
+-- __unique:__ @test_functionscallbacks_Example_get_onProgressChanged@
+foreign import ccall unsafe "hs_bindgen_84066778519d3ea8" hs_bindgen_84066778519d3ea8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_onProgressChanged@
+hs_bindgen_84066778519d3ea8 :: IO (BG.FunPtr (ProgressUpdate -> IO ()))
+hs_bindgen_84066778519d3ea8 =
+  fmap BG.fromFFIType hs_bindgen_84066778519d3ea8_base
+
+{-# NOINLINE onProgressChanged #-}
+{-| __C declaration:__ @onProgressChanged@
+
+    __defined at:__ @functions\/callbacks.h 15:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onProgressChanged :: BG.FunPtr (ProgressUpdate -> IO ())
+onProgressChanged =
+  BG.unsafePerformIO hs_bindgen_84066778519d3ea8
+
+-- __unique:__ @test_functionscallbacks_Example_get_validateInput@
+foreign import ccall unsafe "hs_bindgen_4d522e3ec1eb0b9f" hs_bindgen_4d522e3ec1eb0b9f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_validateInput@
+hs_bindgen_4d522e3ec1eb0b9f :: IO (BG.FunPtr (DataValidator -> BG.CInt -> IO BG.CInt))
+hs_bindgen_4d522e3ec1eb0b9f =
+  fmap BG.fromFFIType hs_bindgen_4d522e3ec1eb0b9f_base
+
+{-# NOINLINE validateInput #-}
+{-| __C declaration:__ @validateInput@
+
+    __defined at:__ @functions\/callbacks.h 16:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+validateInput :: BG.FunPtr (DataValidator -> BG.CInt -> IO BG.CInt)
+validateInput =
+  BG.unsafePerformIO hs_bindgen_4d522e3ec1eb0b9f
+
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement@
+foreign import ccall unsafe "hs_bindgen_a26d6914af82ade0" hs_bindgen_a26d6914af82ade0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement@
+hs_bindgen_a26d6914af82ade0 :: IO (BG.FunPtr (MeasurementReceived -> IO ()))
+hs_bindgen_a26d6914af82ade0 =
+  fmap BG.fromFFIType hs_bindgen_a26d6914af82ade0_base
+
+{-# NOINLINE onNewMeasurement #-}
+{-| __C declaration:__ @onNewMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 27:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement :: BG.FunPtr (MeasurementReceived -> IO ())
+onNewMeasurement =
+  BG.unsafePerformIO hs_bindgen_a26d6914af82ade0
+
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement2@
+foreign import ccall unsafe "hs_bindgen_2c377b597bd80e50" hs_bindgen_2c377b597bd80e50_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement2@
+hs_bindgen_2c377b597bd80e50 :: IO (BG.FunPtr (MeasurementReceived2 -> IO ()))
+hs_bindgen_2c377b597bd80e50 =
+  fmap BG.fromFFIType hs_bindgen_2c377b597bd80e50_base
+
+{-# NOINLINE onNewMeasurement2 #-}
+{-| __C declaration:__ @onNewMeasurement2@
+
+    __defined at:__ @functions\/callbacks.h 30:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement2 :: BG.FunPtr (MeasurementReceived2 -> IO ())
+onNewMeasurement2 =
+  BG.unsafePerformIO hs_bindgen_2c377b597bd80e50
+
+-- __unique:__ @test_functionscallbacks_Example_get_onBufferReady@
+foreign import ccall unsafe "hs_bindgen_d1ce142d0c667e22" hs_bindgen_d1ce142d0c667e22_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_onBufferReady@
+hs_bindgen_d1ce142d0c667e22 :: IO (BG.FunPtr (SampleBufferFull -> IO ()))
+hs_bindgen_d1ce142d0c667e22 =
+  fmap BG.fromFFIType hs_bindgen_d1ce142d0c667e22_base
+
+{-# NOINLINE onBufferReady #-}
+{-| __C declaration:__ @onBufferReady@
+
+    __defined at:__ @functions\/callbacks.h 33:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onBufferReady :: BG.FunPtr (SampleBufferFull -> IO ())
+onBufferReady =
+  BG.unsafePerformIO hs_bindgen_d1ce142d0c667e22
+
+-- __unique:__ @test_functionscallbacks_Example_get_transformMeasurement@
+foreign import ccall unsafe "hs_bindgen_2e8d6b201521b14a" hs_bindgen_2e8d6b201521b14a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_transformMeasurement@
+hs_bindgen_2e8d6b201521b14a :: IO (BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ()) -> IO ()))
+hs_bindgen_2e8d6b201521b14a =
+  fmap BG.fromFFIType hs_bindgen_2e8d6b201521b14a_base
+
+{-# NOINLINE transformMeasurement #-}
+{-| __C declaration:__ @transformMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 38:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+transformMeasurement :: BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ()) -> IO ())
+transformMeasurement =
+  BG.unsafePerformIO hs_bindgen_2e8d6b201521b14a
+
+-- __unique:__ @test_functionscallbacks_Example_get_processWithCallbacks@
+foreign import ccall unsafe "hs_bindgen_7f4acb7260277d86" hs_bindgen_7f4acb7260277d86_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_processWithCallbacks@
+hs_bindgen_7f4acb7260277d86 :: IO (BG.FunPtr (BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ()) -> IO ()))
+hs_bindgen_7f4acb7260277d86 =
+  fmap BG.fromFFIType hs_bindgen_7f4acb7260277d86_base
+
+{-# NOINLINE processWithCallbacks #-}
+{-| __C declaration:__ @processWithCallbacks@
+
+    __defined at:__ @functions\/callbacks.h 43:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processWithCallbacks :: BG.FunPtr (BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ()) -> IO ())
+processWithCallbacks =
+  BG.unsafePerformIO hs_bindgen_7f4acb7260277d86
+
+-- __unique:__ @test_functionscallbacks_Example_get_registerHandler@
+foreign import ccall unsafe "hs_bindgen_80684ecfa6d982b7" hs_bindgen_80684ecfa6d982b7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_registerHandler@
+hs_bindgen_80684ecfa6d982b7 :: IO (BG.FunPtr (BG.Ptr MeasurementHandler -> IO ()))
+hs_bindgen_80684ecfa6d982b7 =
+  fmap BG.fromFFIType hs_bindgen_80684ecfa6d982b7_base
+
+{-# NOINLINE registerHandler #-}
+{-| __C declaration:__ @registerHandler@
+
+    __defined at:__ @functions\/callbacks.h 56:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+registerHandler :: BG.FunPtr (BG.Ptr MeasurementHandler -> IO ())
+registerHandler =
+  BG.unsafePerformIO hs_bindgen_80684ecfa6d982b7
+
+-- __unique:__ @test_functionscallbacks_Example_get_executePipeline@
+foreign import ccall unsafe "hs_bindgen_1714a267564c9f6f" hs_bindgen_1714a267564c9f6f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_executePipeline@
+hs_bindgen_1714a267564c9f6f :: IO (BG.FunPtr (BG.Ptr Measurement -> BG.Ptr DataPipeline -> IO ()))
+hs_bindgen_1714a267564c9f6f =
+  fmap BG.fromFFIType hs_bindgen_1714a267564c9f6f_base
+
+{-# NOINLINE executePipeline #-}
+{-| __C declaration:__ @executePipeline@
+
+    __defined at:__ @functions\/callbacks.h 64:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+executePipeline :: BG.FunPtr (BG.Ptr Measurement -> BG.Ptr DataPipeline -> IO ())
+executePipeline =
+  BG.unsafePerformIO hs_bindgen_1714a267564c9f6f
+
+-- __unique:__ @test_functionscallbacks_Example_get_runProcessor@
+foreign import ccall unsafe "hs_bindgen_fedf80fe8e91dc7a" hs_bindgen_fedf80fe8e91dc7a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_runProcessor@
+hs_bindgen_fedf80fe8e91dc7a :: IO (BG.FunPtr (BG.Ptr Measurement -> BG.Ptr Processor -> IO ()))
+hs_bindgen_fedf80fe8e91dc7a =
+  fmap BG.fromFFIType hs_bindgen_fedf80fe8e91dc7a_base
+
+{-# NOINLINE runProcessor #-}
+{-| __C declaration:__ @runProcessor@
+
+    __defined at:__ @functions\/callbacks.h 80:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+runProcessor :: BG.FunPtr (BG.Ptr Measurement -> BG.Ptr Processor -> IO ())
+runProcessor =
+  BG.unsafePerformIO hs_bindgen_fedf80fe8e91dc7a
+
+-- __unique:__ @test_functionscallbacks_Example_get_processMeasurementWithValidation@
+foreign import ccall unsafe "hs_bindgen_443cb57c681c2cab" hs_bindgen_443cb57c681c2cab_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_processMeasurementWithValidation@
+hs_bindgen_443cb57c681c2cab :: IO (BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ()) -> IO ()))
+hs_bindgen_443cb57c681c2cab =
+  fmap BG.fromFFIType hs_bindgen_443cb57c681c2cab_base
+
+{-# NOINLINE processMeasurementWithValidation #-}
+{-| __C declaration:__ @processMeasurementWithValidation@
+
+    __defined at:__ @functions\/callbacks.h 85:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processMeasurementWithValidation :: BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ()) -> IO ())
+processMeasurementWithValidation =
+  BG.unsafePerformIO hs_bindgen_443cb57c681c2cab
+
+-- __unique:__ @test_functionscallbacks_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_7cf6cffd19682c36" hs_bindgen_7cf6cffd19682c36_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_f@
+hs_bindgen_7cf6cffd19682c36 :: IO (BG.FunPtr (BG.FunPtr (Foo -> IO ()) -> IO ()))
+hs_bindgen_7cf6cffd19682c36 =
+  fmap BG.fromFFIType hs_bindgen_7cf6cffd19682c36_base
+
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/callbacks.h 96:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f :: BG.FunPtr (BG.FunPtr (Foo -> IO ()) -> IO ())
+f = BG.unsafePerformIO hs_bindgen_7cf6cffd19682c36
+
+-- __unique:__ @test_functionscallbacks_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_81fde2984e04c791" hs_bindgen_81fde2984e04c791_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_f2@
+hs_bindgen_81fde2984e04c791 :: IO (BG.FunPtr (BG.FunPtr (Foo2 -> IO ()) -> IO ()))
+hs_bindgen_81fde2984e04c791 =
+  fmap BG.fromFFIType hs_bindgen_81fde2984e04c791_base
+
+{-# NOINLINE f2 #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/callbacks.h 97:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f2 :: BG.FunPtr (BG.FunPtr (Foo2 -> IO ()) -> IO ())
+f2 = BG.unsafePerformIO hs_bindgen_81fde2984e04c791
diff --git a/test-artefacts/fixtures/functions/callbacks/Example/Global.hs b/test-artefacts/fixtures/functions/callbacks/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/callbacks/Example/Global.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.globalVar
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/callbacks.h>"
+  , "/* test_functionscallbacks_Example_get_globalVar */"
+  , "__attribute__ ((const))"
+  , "void (*(*hs_bindgen_a370a6faf1531caa (void))[3]) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &globalVar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionscallbacks_Example_get_globalVar@
+foreign import ccall unsafe "hs_bindgen_a370a6faf1531caa" hs_bindgen_a370a6faf1531caa_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionscallbacks_Example_get_globalVar@
+hs_bindgen_a370a6faf1531caa :: IO (BG.Ptr (CA.ConstantArray 3 (BG.FunPtr (A -> IO ()))))
+hs_bindgen_a370a6faf1531caa =
+  fmap BG.fromFFIType hs_bindgen_a370a6faf1531caa_base
+
+{-# NOINLINE globalVar #-}
+{-| __C declaration:__ @globalVar@
+
+    __defined at:__ @functions\/callbacks.h 103:15@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+globalVar :: BG.Ptr (CA.ConstantArray 3 (BG.FunPtr (A -> IO ())))
+globalVar =
+  BG.unsafePerformIO hs_bindgen_a370a6faf1531caa
diff --git a/test-artefacts/fixtures/functions/callbacks/Example/Safe.hs b/test-artefacts/fixtures/functions/callbacks/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/callbacks/Example/Safe.hs
@@ -0,0 +1,599 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.readFileWithProcessor
+    , Example.Safe.watchTemperature
+    , Example.Safe.onFileOpened
+    , Example.Safe.onProgressChanged
+    , Example.Safe.validateInput
+    , Example.Safe.onNewMeasurement
+    , Example.Safe.onNewMeasurement2
+    , Example.Safe.onBufferReady
+    , Example.Safe.transformMeasurement
+    , Example.Safe.processWithCallbacks
+    , Example.Safe.registerHandler
+    , Example.Safe.executePipeline
+    , Example.Safe.runProcessor
+    , Example.Safe.processMeasurementWithValidation
+    , Example.Safe.f
+    , Example.Safe.f2
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/callbacks.h>"
+  , "signed int hs_bindgen_99bda9cd8097b0ea ("
+  , "  void (*arg1) ("
+  , "  signed int arg1"
+  , "),"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (readFileWithProcessor)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_84b75366c836fc85 ("
+  , "  void (*arg1) ("
+  , "  signed int arg1"
+  , "),"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (watchTemperature)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f2580f574faa3697 ("
+  , "  FileOpenedNotification arg1"
+  , ")"
+  , "{"
+  , "  (onFileOpened)(arg1);"
+  , "}"
+  , "void hs_bindgen_654057b291ee37ea ("
+  , "  ProgressUpdate arg1"
+  , ")"
+  , "{"
+  , "  (onProgressChanged)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_5df7aac6996be10f ("
+  , "  DataValidator arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (validateInput)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_8f1bb1c4d2b5355f ("
+  , "  MeasurementReceived arg1"
+  , ")"
+  , "{"
+  , "  (onNewMeasurement)(arg1);"
+  , "}"
+  , "void hs_bindgen_d805e39c6cbdd620 ("
+  , "  MeasurementReceived2 arg1"
+  , ")"
+  , "{"
+  , "  (onNewMeasurement2)(arg1);"
+  , "}"
+  , "void hs_bindgen_8d803591bcf10ba5 ("
+  , "  SampleBufferFull arg1"
+  , ")"
+  , "{"
+  , "  (onBufferReady)(arg1);"
+  , "}"
+  , "void hs_bindgen_16c298a15b737eb2 ("
+  , "  struct Measurement *arg1,"
+  , "  void (*arg2) ("
+  , "  struct Measurement *arg1,"
+  , "  double (*arg2) ("
+  , "  double arg1,"
+  , "  signed int arg2"
+  , "),"
+  , "  signed int arg3"
+  , ")"
+  , ")"
+  , "{"
+  , "  (transformMeasurement)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e6a073138e56764f ("
+  , "  void (*arg1) ("
+  , "  struct Measurement *arg1,"
+  , "  FileOpenedNotification arg2,"
+  , "  signed int arg3"
+  , ")"
+  , ")"
+  , "{"
+  , "  (processWithCallbacks)(arg1);"
+  , "}"
+  , "void hs_bindgen_ece0d4f94c2319f0 ("
+  , "  struct MeasurementHandler *arg1"
+  , ")"
+  , "{"
+  , "  (registerHandler)(arg1);"
+  , "}"
+  , "void hs_bindgen_d66d7470a7a213b0 ("
+  , "  struct Measurement *arg1,"
+  , "  struct DataPipeline *arg2"
+  , ")"
+  , "{"
+  , "  (executePipeline)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e925d3ce6e5fb395 ("
+  , "  struct Measurement *arg1,"
+  , "  struct Processor *arg2"
+  , ")"
+  , "{"
+  , "  (runProcessor)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1e432e1595a1ef55 ("
+  , "  struct Measurement *arg1,"
+  , "  void (*arg2) ("
+  , "  struct Measurement *arg1,"
+  , "  void (*arg2) ("
+  , "  struct Measurement *arg1,"
+  , "  DataValidator arg2,"
+  , "  signed int arg3"
+  , "),"
+  , "  DataValidator arg3"
+  , ")"
+  , ")"
+  , "{"
+  , "  (processMeasurementWithValidation)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d5cd030edf2e0364 ("
+  , "  void (*arg1) ("
+  , "  foo arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (f)(arg1);"
+  , "}"
+  , "void hs_bindgen_a10eec74074627ba ("
+  , "  void (*arg1) ("
+  , "  foo2 const arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (f2)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_readFileWithProcessor@
+foreign import ccall safe "hs_bindgen_99bda9cd8097b0ea" hs_bindgen_99bda9cd8097b0ea_base ::
+     BG.FunPtr BG.Void
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_readFileWithProcessor@
+hs_bindgen_99bda9cd8097b0ea ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_99bda9cd8097b0ea =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_99bda9cd8097b0ea_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @readFileWithProcessor@
+
+    __defined at:__ @functions\/callbacks.h 4:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+readFileWithProcessor ::
+     BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @processLine@
+  -> BG.CInt
+     -- ^ __C declaration:__ @fileId@
+  -> IO BG.CInt
+readFileWithProcessor = hs_bindgen_99bda9cd8097b0ea
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_watchTemperature@
+foreign import ccall safe "hs_bindgen_84b75366c836fc85" hs_bindgen_84b75366c836fc85_base ::
+     BG.FunPtr BG.Void
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_watchTemperature@
+hs_bindgen_84b75366c836fc85 ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_84b75366c836fc85 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_84b75366c836fc85_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @watchTemperature@
+
+    __defined at:__ @functions\/callbacks.h 5:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+watchTemperature ::
+     BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @onTempChange@
+  -> BG.CInt
+     -- ^ __C declaration:__ @sensorId@
+  -> IO ()
+watchTemperature = hs_bindgen_84b75366c836fc85
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onFileOpened@
+foreign import ccall safe "hs_bindgen_f2580f574faa3697" hs_bindgen_f2580f574faa3697_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onFileOpened@
+hs_bindgen_f2580f574faa3697 ::
+     FileOpenedNotification
+  -> IO ()
+hs_bindgen_f2580f574faa3697 =
+  \x0 ->
+    hs_bindgen_f2580f574faa3697_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onFileOpened@
+
+    __defined at:__ @functions\/callbacks.h 14:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onFileOpened ::
+     FileOpenedNotification
+     -- ^ __C declaration:__ @notify@
+  -> IO ()
+onFileOpened = hs_bindgen_f2580f574faa3697
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onProgressChanged@
+foreign import ccall safe "hs_bindgen_654057b291ee37ea" hs_bindgen_654057b291ee37ea_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onProgressChanged@
+hs_bindgen_654057b291ee37ea ::
+     ProgressUpdate
+  -> IO ()
+hs_bindgen_654057b291ee37ea =
+  \x0 ->
+    hs_bindgen_654057b291ee37ea_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onProgressChanged@
+
+    __defined at:__ @functions\/callbacks.h 15:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onProgressChanged ::
+     ProgressUpdate
+     -- ^ __C declaration:__ @update@
+  -> IO ()
+onProgressChanged = hs_bindgen_654057b291ee37ea
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_validateInput@
+foreign import ccall safe "hs_bindgen_5df7aac6996be10f" hs_bindgen_5df7aac6996be10f_base ::
+     BG.FunPtr BG.Void
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_validateInput@
+hs_bindgen_5df7aac6996be10f ::
+     DataValidator
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_5df7aac6996be10f =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_5df7aac6996be10f_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @validateInput@
+
+    __defined at:__ @functions\/callbacks.h 16:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+validateInput ::
+     DataValidator
+     -- ^ __C declaration:__ @validator@
+  -> BG.CInt
+     -- ^ __C declaration:__ @rawValue@
+  -> IO BG.CInt
+validateInput = hs_bindgen_5df7aac6996be10f
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement@
+foreign import ccall safe "hs_bindgen_8f1bb1c4d2b5355f" hs_bindgen_8f1bb1c4d2b5355f_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement@
+hs_bindgen_8f1bb1c4d2b5355f ::
+     MeasurementReceived
+  -> IO ()
+hs_bindgen_8f1bb1c4d2b5355f =
+  \x0 ->
+    hs_bindgen_8f1bb1c4d2b5355f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onNewMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 27:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement ::
+     MeasurementReceived
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+onNewMeasurement = hs_bindgen_8f1bb1c4d2b5355f
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement2@
+foreign import ccall safe "hs_bindgen_d805e39c6cbdd620" hs_bindgen_d805e39c6cbdd620_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement2@
+hs_bindgen_d805e39c6cbdd620 ::
+     MeasurementReceived2
+  -> IO ()
+hs_bindgen_d805e39c6cbdd620 =
+  \x0 ->
+    hs_bindgen_d805e39c6cbdd620_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onNewMeasurement2@
+
+    __defined at:__ @functions\/callbacks.h 30:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement2 ::
+     MeasurementReceived2
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+onNewMeasurement2 = hs_bindgen_d805e39c6cbdd620
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onBufferReady@
+foreign import ccall safe "hs_bindgen_8d803591bcf10ba5" hs_bindgen_8d803591bcf10ba5_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_onBufferReady@
+hs_bindgen_8d803591bcf10ba5 ::
+     SampleBufferFull
+  -> IO ()
+hs_bindgen_8d803591bcf10ba5 =
+  \x0 ->
+    hs_bindgen_8d803591bcf10ba5_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onBufferReady@
+
+    __defined at:__ @functions\/callbacks.h 33:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onBufferReady ::
+     SampleBufferFull
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+onBufferReady = hs_bindgen_8d803591bcf10ba5
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_transformMeasurement@
+foreign import ccall safe "hs_bindgen_16c298a15b737eb2" hs_bindgen_16c298a15b737eb2_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_transformMeasurement@
+hs_bindgen_16c298a15b737eb2 ::
+     BG.Ptr Measurement
+  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_16c298a15b737eb2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_16c298a15b737eb2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @transformMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 38:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+transformMeasurement ::
+     BG.Ptr Measurement
+     -- ^ __C declaration:__ @data@
+  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())
+     -- ^ __C declaration:__ @transformer@
+  -> IO ()
+transformMeasurement = hs_bindgen_16c298a15b737eb2
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_processWithCallbacks@
+foreign import ccall safe "hs_bindgen_e6a073138e56764f" hs_bindgen_e6a073138e56764f_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_processWithCallbacks@
+hs_bindgen_e6a073138e56764f ::
+     BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_e6a073138e56764f =
+  \x0 ->
+    hs_bindgen_e6a073138e56764f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @processWithCallbacks@
+
+    __defined at:__ @functions\/callbacks.h 43:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processWithCallbacks ::
+     BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+processWithCallbacks = hs_bindgen_e6a073138e56764f
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_registerHandler@
+foreign import ccall safe "hs_bindgen_ece0d4f94c2319f0" hs_bindgen_ece0d4f94c2319f0_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_registerHandler@
+hs_bindgen_ece0d4f94c2319f0 ::
+     BG.Ptr MeasurementHandler
+  -> IO ()
+hs_bindgen_ece0d4f94c2319f0 =
+  \x0 ->
+    hs_bindgen_ece0d4f94c2319f0_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @registerHandler@
+
+    __defined at:__ @functions\/callbacks.h 56:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+registerHandler ::
+     BG.Ptr MeasurementHandler
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+registerHandler = hs_bindgen_ece0d4f94c2319f0
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_executePipeline@
+foreign import ccall safe "hs_bindgen_d66d7470a7a213b0" hs_bindgen_d66d7470a7a213b0_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_executePipeline@
+hs_bindgen_d66d7470a7a213b0 ::
+     BG.Ptr Measurement
+  -> BG.Ptr DataPipeline
+  -> IO ()
+hs_bindgen_d66d7470a7a213b0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d66d7470a7a213b0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @executePipeline@
+
+    __defined at:__ @functions\/callbacks.h 64:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+executePipeline ::
+     BG.Ptr Measurement
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DataPipeline
+     -- ^ __C declaration:__ @pipeline@
+  -> IO ()
+executePipeline = hs_bindgen_d66d7470a7a213b0
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_runProcessor@
+foreign import ccall safe "hs_bindgen_e925d3ce6e5fb395" hs_bindgen_e925d3ce6e5fb395_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_runProcessor@
+hs_bindgen_e925d3ce6e5fb395 ::
+     BG.Ptr Measurement
+  -> BG.Ptr Processor
+  -> IO ()
+hs_bindgen_e925d3ce6e5fb395 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e925d3ce6e5fb395_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @runProcessor@
+
+    __defined at:__ @functions\/callbacks.h 80:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+runProcessor ::
+     BG.Ptr Measurement
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr Processor
+     -- ^ __C declaration:__ @processor@
+  -> IO ()
+runProcessor = hs_bindgen_e925d3ce6e5fb395
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_processMeasurementWithValidation@
+foreign import ccall safe "hs_bindgen_1e432e1595a1ef55" hs_bindgen_1e432e1595a1ef55_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_processMeasurementWithValidation@
+hs_bindgen_1e432e1595a1ef55 ::
+     BG.Ptr Measurement
+  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())
+  -> IO ()
+hs_bindgen_1e432e1595a1ef55 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1e432e1595a1ef55_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @processMeasurementWithValidation@
+
+    __defined at:__ @functions\/callbacks.h 85:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processMeasurementWithValidation ::
+     BG.Ptr Measurement
+     -- ^ __C declaration:__ @data@
+  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())
+     -- ^ __C declaration:__ @processor@
+  -> IO ()
+processMeasurementWithValidation =
+  hs_bindgen_1e432e1595a1ef55
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_d5cd030edf2e0364" hs_bindgen_d5cd030edf2e0364_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_f@
+hs_bindgen_d5cd030edf2e0364 ::
+     BG.FunPtr (Foo -> IO ())
+  -> IO ()
+hs_bindgen_d5cd030edf2e0364 =
+  \x0 ->
+    hs_bindgen_d5cd030edf2e0364_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/callbacks.h 96:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f ::
+     BG.FunPtr (Foo -> IO ())
+     -- ^ __C declaration:__ @callback@
+  -> IO ()
+f = hs_bindgen_d5cd030edf2e0364
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_a10eec74074627ba" hs_bindgen_a10eec74074627ba_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Safe_f2@
+hs_bindgen_a10eec74074627ba ::
+     BG.FunPtr (Foo2 -> IO ())
+  -> IO ()
+hs_bindgen_a10eec74074627ba =
+  \x0 ->
+    hs_bindgen_a10eec74074627ba_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/callbacks.h 97:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f2 ::
+     BG.FunPtr (Foo2 -> IO ())
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+f2 = hs_bindgen_a10eec74074627ba
diff --git a/test-artefacts/fixtures/functions/callbacks/Example/Unsafe.hs b/test-artefacts/fixtures/functions/callbacks/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/callbacks/Example/Unsafe.hs
@@ -0,0 +1,599 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.readFileWithProcessor
+    , Example.Unsafe.watchTemperature
+    , Example.Unsafe.onFileOpened
+    , Example.Unsafe.onProgressChanged
+    , Example.Unsafe.validateInput
+    , Example.Unsafe.onNewMeasurement
+    , Example.Unsafe.onNewMeasurement2
+    , Example.Unsafe.onBufferReady
+    , Example.Unsafe.transformMeasurement
+    , Example.Unsafe.processWithCallbacks
+    , Example.Unsafe.registerHandler
+    , Example.Unsafe.executePipeline
+    , Example.Unsafe.runProcessor
+    , Example.Unsafe.processMeasurementWithValidation
+    , Example.Unsafe.f
+    , Example.Unsafe.f2
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/callbacks.h>"
+  , "signed int hs_bindgen_d07f3a3e526e7017 ("
+  , "  void (*arg1) ("
+  , "  signed int arg1"
+  , "),"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (readFileWithProcessor)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_cb0219aedd5afed5 ("
+  , "  void (*arg1) ("
+  , "  signed int arg1"
+  , "),"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (watchTemperature)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d96938841a039f9b ("
+  , "  FileOpenedNotification arg1"
+  , ")"
+  , "{"
+  , "  (onFileOpened)(arg1);"
+  , "}"
+  , "void hs_bindgen_3cb24888fc3e1751 ("
+  , "  ProgressUpdate arg1"
+  , ")"
+  , "{"
+  , "  (onProgressChanged)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_567ea6dc040b50a1 ("
+  , "  DataValidator arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return (validateInput)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_aab80c08edfa6b4b ("
+  , "  MeasurementReceived arg1"
+  , ")"
+  , "{"
+  , "  (onNewMeasurement)(arg1);"
+  , "}"
+  , "void hs_bindgen_6c8fae51df7c46a1 ("
+  , "  MeasurementReceived2 arg1"
+  , ")"
+  , "{"
+  , "  (onNewMeasurement2)(arg1);"
+  , "}"
+  , "void hs_bindgen_d44afeb36d2ae523 ("
+  , "  SampleBufferFull arg1"
+  , ")"
+  , "{"
+  , "  (onBufferReady)(arg1);"
+  , "}"
+  , "void hs_bindgen_523fee13fb646cad ("
+  , "  struct Measurement *arg1,"
+  , "  void (*arg2) ("
+  , "  struct Measurement *arg1,"
+  , "  double (*arg2) ("
+  , "  double arg1,"
+  , "  signed int arg2"
+  , "),"
+  , "  signed int arg3"
+  , ")"
+  , ")"
+  , "{"
+  , "  (transformMeasurement)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_98d0c5bd1271eeb7 ("
+  , "  void (*arg1) ("
+  , "  struct Measurement *arg1,"
+  , "  FileOpenedNotification arg2,"
+  , "  signed int arg3"
+  , ")"
+  , ")"
+  , "{"
+  , "  (processWithCallbacks)(arg1);"
+  , "}"
+  , "void hs_bindgen_b96f4d4d7893e301 ("
+  , "  struct MeasurementHandler *arg1"
+  , ")"
+  , "{"
+  , "  (registerHandler)(arg1);"
+  , "}"
+  , "void hs_bindgen_c062ded603732aae ("
+  , "  struct Measurement *arg1,"
+  , "  struct DataPipeline *arg2"
+  , ")"
+  , "{"
+  , "  (executePipeline)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_02d41a1f48eebff7 ("
+  , "  struct Measurement *arg1,"
+  , "  struct Processor *arg2"
+  , ")"
+  , "{"
+  , "  (runProcessor)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_39704c8b14c2ce3c ("
+  , "  struct Measurement *arg1,"
+  , "  void (*arg2) ("
+  , "  struct Measurement *arg1,"
+  , "  void (*arg2) ("
+  , "  struct Measurement *arg1,"
+  , "  DataValidator arg2,"
+  , "  signed int arg3"
+  , "),"
+  , "  DataValidator arg3"
+  , ")"
+  , ")"
+  , "{"
+  , "  (processMeasurementWithValidation)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_10c383cdf6eddb0d ("
+  , "  void (*arg1) ("
+  , "  foo arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (f)(arg1);"
+  , "}"
+  , "void hs_bindgen_831d03bed0065a4e ("
+  , "  void (*arg1) ("
+  , "  foo2 const arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (f2)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_readFileWithProcessor@
+foreign import ccall unsafe "hs_bindgen_d07f3a3e526e7017" hs_bindgen_d07f3a3e526e7017_base ::
+     BG.FunPtr BG.Void
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_readFileWithProcessor@
+hs_bindgen_d07f3a3e526e7017 ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_d07f3a3e526e7017 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_d07f3a3e526e7017_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @readFileWithProcessor@
+
+    __defined at:__ @functions\/callbacks.h 4:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+readFileWithProcessor ::
+     BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @processLine@
+  -> BG.CInt
+     -- ^ __C declaration:__ @fileId@
+  -> IO BG.CInt
+readFileWithProcessor = hs_bindgen_d07f3a3e526e7017
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_watchTemperature@
+foreign import ccall unsafe "hs_bindgen_cb0219aedd5afed5" hs_bindgen_cb0219aedd5afed5_base ::
+     BG.FunPtr BG.Void
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_watchTemperature@
+hs_bindgen_cb0219aedd5afed5 ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_cb0219aedd5afed5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_cb0219aedd5afed5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @watchTemperature@
+
+    __defined at:__ @functions\/callbacks.h 5:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+watchTemperature ::
+     BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @onTempChange@
+  -> BG.CInt
+     -- ^ __C declaration:__ @sensorId@
+  -> IO ()
+watchTemperature = hs_bindgen_cb0219aedd5afed5
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onFileOpened@
+foreign import ccall unsafe "hs_bindgen_d96938841a039f9b" hs_bindgen_d96938841a039f9b_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onFileOpened@
+hs_bindgen_d96938841a039f9b ::
+     FileOpenedNotification
+  -> IO ()
+hs_bindgen_d96938841a039f9b =
+  \x0 ->
+    hs_bindgen_d96938841a039f9b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onFileOpened@
+
+    __defined at:__ @functions\/callbacks.h 14:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onFileOpened ::
+     FileOpenedNotification
+     -- ^ __C declaration:__ @notify@
+  -> IO ()
+onFileOpened = hs_bindgen_d96938841a039f9b
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onProgressChanged@
+foreign import ccall unsafe "hs_bindgen_3cb24888fc3e1751" hs_bindgen_3cb24888fc3e1751_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onProgressChanged@
+hs_bindgen_3cb24888fc3e1751 ::
+     ProgressUpdate
+  -> IO ()
+hs_bindgen_3cb24888fc3e1751 =
+  \x0 ->
+    hs_bindgen_3cb24888fc3e1751_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onProgressChanged@
+
+    __defined at:__ @functions\/callbacks.h 15:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onProgressChanged ::
+     ProgressUpdate
+     -- ^ __C declaration:__ @update@
+  -> IO ()
+onProgressChanged = hs_bindgen_3cb24888fc3e1751
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_validateInput@
+foreign import ccall unsafe "hs_bindgen_567ea6dc040b50a1" hs_bindgen_567ea6dc040b50a1_base ::
+     BG.FunPtr BG.Void
+  -> BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_validateInput@
+hs_bindgen_567ea6dc040b50a1 ::
+     DataValidator
+  -> BG.CInt
+  -> IO BG.CInt
+hs_bindgen_567ea6dc040b50a1 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_567ea6dc040b50a1_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @validateInput@
+
+    __defined at:__ @functions\/callbacks.h 16:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+validateInput ::
+     DataValidator
+     -- ^ __C declaration:__ @validator@
+  -> BG.CInt
+     -- ^ __C declaration:__ @rawValue@
+  -> IO BG.CInt
+validateInput = hs_bindgen_567ea6dc040b50a1
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement@
+foreign import ccall unsafe "hs_bindgen_aab80c08edfa6b4b" hs_bindgen_aab80c08edfa6b4b_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement@
+hs_bindgen_aab80c08edfa6b4b ::
+     MeasurementReceived
+  -> IO ()
+hs_bindgen_aab80c08edfa6b4b =
+  \x0 ->
+    hs_bindgen_aab80c08edfa6b4b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onNewMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 27:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement ::
+     MeasurementReceived
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+onNewMeasurement = hs_bindgen_aab80c08edfa6b4b
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement2@
+foreign import ccall unsafe "hs_bindgen_6c8fae51df7c46a1" hs_bindgen_6c8fae51df7c46a1_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement2@
+hs_bindgen_6c8fae51df7c46a1 ::
+     MeasurementReceived2
+  -> IO ()
+hs_bindgen_6c8fae51df7c46a1 =
+  \x0 ->
+    hs_bindgen_6c8fae51df7c46a1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onNewMeasurement2@
+
+    __defined at:__ @functions\/callbacks.h 30:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement2 ::
+     MeasurementReceived2
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+onNewMeasurement2 = hs_bindgen_6c8fae51df7c46a1
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onBufferReady@
+foreign import ccall unsafe "hs_bindgen_d44afeb36d2ae523" hs_bindgen_d44afeb36d2ae523_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onBufferReady@
+hs_bindgen_d44afeb36d2ae523 ::
+     SampleBufferFull
+  -> IO ()
+hs_bindgen_d44afeb36d2ae523 =
+  \x0 ->
+    hs_bindgen_d44afeb36d2ae523_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @onBufferReady@
+
+    __defined at:__ @functions\/callbacks.h 33:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onBufferReady ::
+     SampleBufferFull
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+onBufferReady = hs_bindgen_d44afeb36d2ae523
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_transformMeasurement@
+foreign import ccall unsafe "hs_bindgen_523fee13fb646cad" hs_bindgen_523fee13fb646cad_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_transformMeasurement@
+hs_bindgen_523fee13fb646cad ::
+     BG.Ptr Measurement
+  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_523fee13fb646cad =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_523fee13fb646cad_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @transformMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 38:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+transformMeasurement ::
+     BG.Ptr Measurement
+     -- ^ __C declaration:__ @data@
+  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())
+     -- ^ __C declaration:__ @transformer@
+  -> IO ()
+transformMeasurement = hs_bindgen_523fee13fb646cad
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processWithCallbacks@
+foreign import ccall unsafe "hs_bindgen_98d0c5bd1271eeb7" hs_bindgen_98d0c5bd1271eeb7_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processWithCallbacks@
+hs_bindgen_98d0c5bd1271eeb7 ::
+     BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_98d0c5bd1271eeb7 =
+  \x0 ->
+    hs_bindgen_98d0c5bd1271eeb7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @processWithCallbacks@
+
+    __defined at:__ @functions\/callbacks.h 43:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processWithCallbacks ::
+     BG.FunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+processWithCallbacks = hs_bindgen_98d0c5bd1271eeb7
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_registerHandler@
+foreign import ccall unsafe "hs_bindgen_b96f4d4d7893e301" hs_bindgen_b96f4d4d7893e301_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_registerHandler@
+hs_bindgen_b96f4d4d7893e301 ::
+     BG.Ptr MeasurementHandler
+  -> IO ()
+hs_bindgen_b96f4d4d7893e301 =
+  \x0 ->
+    hs_bindgen_b96f4d4d7893e301_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @registerHandler@
+
+    __defined at:__ @functions\/callbacks.h 56:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+registerHandler ::
+     BG.Ptr MeasurementHandler
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+registerHandler = hs_bindgen_b96f4d4d7893e301
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_executePipeline@
+foreign import ccall unsafe "hs_bindgen_c062ded603732aae" hs_bindgen_c062ded603732aae_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_executePipeline@
+hs_bindgen_c062ded603732aae ::
+     BG.Ptr Measurement
+  -> BG.Ptr DataPipeline
+  -> IO ()
+hs_bindgen_c062ded603732aae =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c062ded603732aae_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @executePipeline@
+
+    __defined at:__ @functions\/callbacks.h 64:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+executePipeline ::
+     BG.Ptr Measurement
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr DataPipeline
+     -- ^ __C declaration:__ @pipeline@
+  -> IO ()
+executePipeline = hs_bindgen_c062ded603732aae
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_runProcessor@
+foreign import ccall unsafe "hs_bindgen_02d41a1f48eebff7" hs_bindgen_02d41a1f48eebff7_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_runProcessor@
+hs_bindgen_02d41a1f48eebff7 ::
+     BG.Ptr Measurement
+  -> BG.Ptr Processor
+  -> IO ()
+hs_bindgen_02d41a1f48eebff7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_02d41a1f48eebff7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @runProcessor@
+
+    __defined at:__ @functions\/callbacks.h 80:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+runProcessor ::
+     BG.Ptr Measurement
+     -- ^ __C declaration:__ @data@
+  -> BG.Ptr Processor
+     -- ^ __C declaration:__ @processor@
+  -> IO ()
+runProcessor = hs_bindgen_02d41a1f48eebff7
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processMeasurementWithValidation@
+foreign import ccall unsafe "hs_bindgen_39704c8b14c2ce3c" hs_bindgen_39704c8b14c2ce3c_base ::
+     BG.Ptr BG.Void
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processMeasurementWithValidation@
+hs_bindgen_39704c8b14c2ce3c ::
+     BG.Ptr Measurement
+  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())
+  -> IO ()
+hs_bindgen_39704c8b14c2ce3c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_39704c8b14c2ce3c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @processMeasurementWithValidation@
+
+    __defined at:__ @functions\/callbacks.h 85:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processMeasurementWithValidation ::
+     BG.Ptr Measurement
+     -- ^ __C declaration:__ @data@
+  -> BG.FunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())
+     -- ^ __C declaration:__ @processor@
+  -> IO ()
+processMeasurementWithValidation =
+  hs_bindgen_39704c8b14c2ce3c
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_10c383cdf6eddb0d" hs_bindgen_10c383cdf6eddb0d_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f@
+hs_bindgen_10c383cdf6eddb0d ::
+     BG.FunPtr (Foo -> IO ())
+  -> IO ()
+hs_bindgen_10c383cdf6eddb0d =
+  \x0 ->
+    hs_bindgen_10c383cdf6eddb0d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/callbacks.h 96:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f ::
+     BG.FunPtr (Foo -> IO ())
+     -- ^ __C declaration:__ @callback@
+  -> IO ()
+f = hs_bindgen_10c383cdf6eddb0d
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_831d03bed0065a4e" hs_bindgen_831d03bed0065a4e_base ::
+     BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f2@
+hs_bindgen_831d03bed0065a4e ::
+     BG.FunPtr (Foo2 -> IO ())
+  -> IO ()
+hs_bindgen_831d03bed0065a4e =
+  \x0 ->
+    hs_bindgen_831d03bed0065a4e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/callbacks.h 97:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f2 ::
+     BG.FunPtr (Foo2 -> IO ())
+     -- ^ __C declaration:__ @handler@
+  -> IO ()
+f2 = hs_bindgen_831d03bed0065a4e
diff --git a/test-artefacts/fixtures/functions/callbacks/bindingspec.yaml b/test-artefacts/fixtures/functions/callbacks/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/callbacks/bindingspec.yaml
@@ -0,0 +1,586 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/callbacks.h
+  cname: FileOpenedNotification
+  hsname: FileOpenedNotification
+- headers: functions/callbacks.h
+  cname: ProgressUpdate
+  hsname: ProgressUpdate
+- headers: functions/callbacks.h
+  cname: DataValidator
+  hsname: DataValidator
+- headers: functions/callbacks.h
+  cname: struct Measurement
+  hsname: Measurement
+- headers: functions/callbacks.h
+  cname: MeasurementReceived
+  hsname: MeasurementReceived
+- headers: functions/callbacks.h
+  cname: MeasurementReceived2
+  hsname: MeasurementReceived2
+- headers: functions/callbacks.h
+  cname: SampleBufferFull
+  hsname: SampleBufferFull
+- headers: functions/callbacks.h
+  cname: struct MeasurementHandler
+  hsname: MeasurementHandler
+- headers: functions/callbacks.h
+  cname: struct DataPipeline
+  hsname: DataPipeline
+- headers: functions/callbacks.h
+  cname: union ProcessorCallback
+  hsname: ProcessorCallback
+- headers: functions/callbacks.h
+  cname: struct Processor
+  hsname: Processor
+- headers: functions/callbacks.h
+  cname: enum @Processor_mode
+  hsname: Processor_mode
+  enum: open
+- headers: functions/callbacks.h
+  cname: foo
+  hsname: Foo
+- headers: functions/callbacks.h
+  cname: foo2
+  hsname: Foo2
+- headers: functions/callbacks.h
+  cname: A
+  hsname: A
+- headers: functions/callbacks.h
+  cname: B
+  hsname: B
+- headers: functions/callbacks.h
+  cname: struct S
+  hsname: S
+- headers: functions/callbacks.h
+  cname: C
+  hsname: C
+- headers: functions/callbacks.h
+  cname: union U
+  hsname: U
+- headers: functions/callbacks.h
+  cname: D
+  hsname: D
+- headers: functions/callbacks.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: DataPipeline
+  representation:
+    record:
+      constructor: DataPipeline
+      fields:
+      - dataPipeline_preProcess
+      - dataPipeline_process
+      - dataPipeline_postProcess
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: DataValidator
+  representation:
+    newtype:
+      constructor: DataValidator
+      fields:
+      - unwrapDataValidator
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: FileOpenedNotification
+  representation:
+    newtype:
+      constructor: FileOpenedNotification
+      fields:
+      - unwrapFileOpenedNotification
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    newtype:
+      constructor: Foo
+      fields:
+      - unwrapFoo
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo2
+  representation:
+    newtype:
+      constructor: Foo2
+      fields:
+      - unwrapFoo2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Measurement
+  representation:
+    record:
+      constructor: Measurement
+      fields:
+      - measurement_value
+      - measurement_timestamp
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MeasurementHandler
+  representation:
+    record:
+      constructor: MeasurementHandler
+      fields:
+      - measurementHandler_onReceived
+      - measurementHandler_validate
+      - measurementHandler_onError
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MeasurementReceived
+  representation:
+    newtype:
+      constructor: MeasurementReceived
+      fields:
+      - unwrapMeasurementReceived
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MeasurementReceived2
+  representation:
+    newtype:
+      constructor: MeasurementReceived2
+      fields:
+      - unwrapMeasurementReceived2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Processor
+  representation:
+    record:
+      constructor: Processor
+      fields:
+      - processor_mode
+      - processor_callback
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: ProcessorCallback
+  representation:
+    newtype:
+      constructor: ProcessorCallback
+      fields:
+      - unwrapProcessorCallback
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Processor_mode
+  representation:
+    newtype:
+      constructor: Processor_mode
+      fields:
+      - unwrapProcessor_mode
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: ProgressUpdate
+  representation:
+    newtype:
+      constructor: ProgressUpdate
+      fields:
+      - unwrapProgressUpdate
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_fn
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SampleBufferFull
+  representation:
+    newtype:
+      constructor: SampleBufferFull
+      fields:
+      - unwrapSampleBufferFull
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - FromFunPtr
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ToFunPtr
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/callbacks/th.txt b/test-artefacts/fixtures/functions/callbacks/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/callbacks/th.txt
@@ -0,0 +1,3138 @@
+-- addDependentFile test-artefacts/headers/golden/functions/callbacks.h
+-- #include <functions/callbacks.h>
+-- signed int hs_bindgen_99bda9cd8097b0ea (
+--   void (*arg1) (
+--   signed int arg1
+-- ),
+--   signed int arg2
+-- )
+-- {
+--   return (readFileWithProcessor)(arg1, arg2);
+-- }
+-- void hs_bindgen_84b75366c836fc85 (
+--   void (*arg1) (
+--   signed int arg1
+-- ),
+--   signed int arg2
+-- )
+-- {
+--   (watchTemperature)(arg1, arg2);
+-- }
+-- void hs_bindgen_f2580f574faa3697 (
+--   FileOpenedNotification arg1
+-- )
+-- {
+--   (onFileOpened)(arg1);
+-- }
+-- void hs_bindgen_654057b291ee37ea (
+--   ProgressUpdate arg1
+-- )
+-- {
+--   (onProgressChanged)(arg1);
+-- }
+-- signed int hs_bindgen_5df7aac6996be10f (
+--   DataValidator arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (validateInput)(arg1, arg2);
+-- }
+-- void hs_bindgen_8f1bb1c4d2b5355f (
+--   MeasurementReceived arg1
+-- )
+-- {
+--   (onNewMeasurement)(arg1);
+-- }
+-- void hs_bindgen_d805e39c6cbdd620 (
+--   MeasurementReceived2 arg1
+-- )
+-- {
+--   (onNewMeasurement2)(arg1);
+-- }
+-- void hs_bindgen_8d803591bcf10ba5 (
+--   SampleBufferFull arg1
+-- )
+-- {
+--   (onBufferReady)(arg1);
+-- }
+-- void hs_bindgen_16c298a15b737eb2 (
+--   struct Measurement *arg1,
+--   void (*arg2) (
+--   struct Measurement *arg1,
+--   double (*arg2) (
+--   double arg1,
+--   signed int arg2
+-- ),
+--   signed int arg3
+-- )
+-- )
+-- {
+--   (transformMeasurement)(arg1, arg2);
+-- }
+-- void hs_bindgen_e6a073138e56764f (
+--   void (*arg1) (
+--   struct Measurement *arg1,
+--   FileOpenedNotification arg2,
+--   signed int arg3
+-- )
+-- )
+-- {
+--   (processWithCallbacks)(arg1);
+-- }
+-- void hs_bindgen_ece0d4f94c2319f0 (
+--   struct MeasurementHandler *arg1
+-- )
+-- {
+--   (registerHandler)(arg1);
+-- }
+-- void hs_bindgen_d66d7470a7a213b0 (
+--   struct Measurement *arg1,
+--   struct DataPipeline *arg2
+-- )
+-- {
+--   (executePipeline)(arg1, arg2);
+-- }
+-- void hs_bindgen_e925d3ce6e5fb395 (
+--   struct Measurement *arg1,
+--   struct Processor *arg2
+-- )
+-- {
+--   (runProcessor)(arg1, arg2);
+-- }
+-- void hs_bindgen_1e432e1595a1ef55 (
+--   struct Measurement *arg1,
+--   void (*arg2) (
+--   struct Measurement *arg1,
+--   void (*arg2) (
+--   struct Measurement *arg1,
+--   DataValidator arg2,
+--   signed int arg3
+-- ),
+--   DataValidator arg3
+-- )
+-- )
+-- {
+--   (processMeasurementWithValidation)(arg1, arg2);
+-- }
+-- void hs_bindgen_d5cd030edf2e0364 (
+--   void (*arg1) (
+--   foo arg1
+-- )
+-- )
+-- {
+--   (f)(arg1);
+-- }
+-- void hs_bindgen_a10eec74074627ba (
+--   void (*arg1) (
+--   foo2 const arg1
+-- )
+-- )
+-- {
+--   (f2)(arg1);
+-- }
+-- signed int hs_bindgen_d07f3a3e526e7017 (
+--   void (*arg1) (
+--   signed int arg1
+-- ),
+--   signed int arg2
+-- )
+-- {
+--   return (readFileWithProcessor)(arg1, arg2);
+-- }
+-- void hs_bindgen_cb0219aedd5afed5 (
+--   void (*arg1) (
+--   signed int arg1
+-- ),
+--   signed int arg2
+-- )
+-- {
+--   (watchTemperature)(arg1, arg2);
+-- }
+-- void hs_bindgen_d96938841a039f9b (
+--   FileOpenedNotification arg1
+-- )
+-- {
+--   (onFileOpened)(arg1);
+-- }
+-- void hs_bindgen_3cb24888fc3e1751 (
+--   ProgressUpdate arg1
+-- )
+-- {
+--   (onProgressChanged)(arg1);
+-- }
+-- signed int hs_bindgen_567ea6dc040b50a1 (
+--   DataValidator arg1,
+--   signed int arg2
+-- )
+-- {
+--   return (validateInput)(arg1, arg2);
+-- }
+-- void hs_bindgen_aab80c08edfa6b4b (
+--   MeasurementReceived arg1
+-- )
+-- {
+--   (onNewMeasurement)(arg1);
+-- }
+-- void hs_bindgen_6c8fae51df7c46a1 (
+--   MeasurementReceived2 arg1
+-- )
+-- {
+--   (onNewMeasurement2)(arg1);
+-- }
+-- void hs_bindgen_d44afeb36d2ae523 (
+--   SampleBufferFull arg1
+-- )
+-- {
+--   (onBufferReady)(arg1);
+-- }
+-- void hs_bindgen_523fee13fb646cad (
+--   struct Measurement *arg1,
+--   void (*arg2) (
+--   struct Measurement *arg1,
+--   double (*arg2) (
+--   double arg1,
+--   signed int arg2
+-- ),
+--   signed int arg3
+-- )
+-- )
+-- {
+--   (transformMeasurement)(arg1, arg2);
+-- }
+-- void hs_bindgen_98d0c5bd1271eeb7 (
+--   void (*arg1) (
+--   struct Measurement *arg1,
+--   FileOpenedNotification arg2,
+--   signed int arg3
+-- )
+-- )
+-- {
+--   (processWithCallbacks)(arg1);
+-- }
+-- void hs_bindgen_b96f4d4d7893e301 (
+--   struct MeasurementHandler *arg1
+-- )
+-- {
+--   (registerHandler)(arg1);
+-- }
+-- void hs_bindgen_c062ded603732aae (
+--   struct Measurement *arg1,
+--   struct DataPipeline *arg2
+-- )
+-- {
+--   (executePipeline)(arg1, arg2);
+-- }
+-- void hs_bindgen_02d41a1f48eebff7 (
+--   struct Measurement *arg1,
+--   struct Processor *arg2
+-- )
+-- {
+--   (runProcessor)(arg1, arg2);
+-- }
+-- void hs_bindgen_39704c8b14c2ce3c (
+--   struct Measurement *arg1,
+--   void (*arg2) (
+--   struct Measurement *arg1,
+--   void (*arg2) (
+--   struct Measurement *arg1,
+--   DataValidator arg2,
+--   signed int arg3
+-- ),
+--   DataValidator arg3
+-- )
+-- )
+-- {
+--   (processMeasurementWithValidation)(arg1, arg2);
+-- }
+-- void hs_bindgen_10c383cdf6eddb0d (
+--   void (*arg1) (
+--   foo arg1
+-- )
+-- )
+-- {
+--   (f)(arg1);
+-- }
+-- void hs_bindgen_831d03bed0065a4e (
+--   void (*arg1) (
+--   foo2 const arg1
+-- )
+-- )
+-- {
+--   (f2)(arg1);
+-- }
+-- /* test_functionscallbacks_Example_get_readFileWithProcessor */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_793b9ca86a272b6a (void)) (
+--   void (*arg1) (
+--   signed int arg1
+-- ),
+--   signed int arg2
+-- )
+-- {
+--   return &readFileWithProcessor;
+-- }
+-- /* test_functionscallbacks_Example_get_watchTemperature */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a2b606291df27114 (void)) (
+--   void (*arg1) (
+--   signed int arg1
+-- ),
+--   signed int arg2
+-- )
+-- {
+--   return &watchTemperature;
+-- }
+-- /* test_functionscallbacks_Example_get_onFileOpened */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2c00a09a05e4c87b (void)) (
+--   FileOpenedNotification arg1
+-- )
+-- {
+--   return &onFileOpened;
+-- }
+-- /* test_functionscallbacks_Example_get_onProgressChanged */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_84066778519d3ea8 (void)) (
+--   ProgressUpdate arg1
+-- )
+-- {
+--   return &onProgressChanged;
+-- }
+-- /* test_functionscallbacks_Example_get_validateInput */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_4d522e3ec1eb0b9f (void)) (
+--   DataValidator arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &validateInput;
+-- }
+-- /* test_functionscallbacks_Example_get_onNewMeasurement */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a26d6914af82ade0 (void)) (
+--   MeasurementReceived arg1
+-- )
+-- {
+--   return &onNewMeasurement;
+-- }
+-- /* test_functionscallbacks_Example_get_onNewMeasurement2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2c377b597bd80e50 (void)) (
+--   MeasurementReceived2 arg1
+-- )
+-- {
+--   return &onNewMeasurement2;
+-- }
+-- /* test_functionscallbacks_Example_get_onBufferReady */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d1ce142d0c667e22 (void)) (
+--   SampleBufferFull arg1
+-- )
+-- {
+--   return &onBufferReady;
+-- }
+-- /* test_functionscallbacks_Example_get_transformMeasurement */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2e8d6b201521b14a (void)) (
+--   struct Measurement *arg1,
+--   void (*arg2) (
+--   struct Measurement *arg1,
+--   double (*arg2) (
+--   double arg1,
+--   signed int arg2
+-- ),
+--   signed int arg3
+-- )
+-- )
+-- {
+--   return &transformMeasurement;
+-- }
+-- /* test_functionscallbacks_Example_get_processWithCallbacks */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7f4acb7260277d86 (void)) (
+--   void (*arg1) (
+--   struct Measurement *arg1,
+--   FileOpenedNotification arg2,
+--   signed int arg3
+-- )
+-- )
+-- {
+--   return &processWithCallbacks;
+-- }
+-- /* test_functionscallbacks_Example_get_registerHandler */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_80684ecfa6d982b7 (void)) (
+--   struct MeasurementHandler *arg1
+-- )
+-- {
+--   return &registerHandler;
+-- }
+-- /* test_functionscallbacks_Example_get_executePipeline */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1714a267564c9f6f (void)) (
+--   struct Measurement *arg1,
+--   struct DataPipeline *arg2
+-- )
+-- {
+--   return &executePipeline;
+-- }
+-- /* test_functionscallbacks_Example_get_runProcessor */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fedf80fe8e91dc7a (void)) (
+--   struct Measurement *arg1,
+--   struct Processor *arg2
+-- )
+-- {
+--   return &runProcessor;
+-- }
+-- /* test_functionscallbacks_Example_get_processMeasurementWithValidation */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_443cb57c681c2cab (void)) (
+--   struct Measurement *arg1,
+--   void (*arg2) (
+--   struct Measurement *arg1,
+--   void (*arg2) (
+--   struct Measurement *arg1,
+--   DataValidator arg2,
+--   signed int arg3
+-- ),
+--   DataValidator arg3
+-- )
+-- )
+-- {
+--   return &processMeasurementWithValidation;
+-- }
+-- /* test_functionscallbacks_Example_get_f */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7cf6cffd19682c36 (void)) (
+--   void (*arg1) (
+--   foo arg1
+-- )
+-- )
+-- {
+--   return &f;
+-- }
+-- /* test_functionscallbacks_Example_get_f2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_81fde2984e04c791 (void)) (
+--   void (*arg1) (
+--   foo2 const arg1
+-- )
+-- )
+-- {
+--   return &f2;
+-- }
+-- /* test_functionscallbacks_Example_get_globalVar */
+-- __attribute__ ((const))
+-- void (*(*hs_bindgen_a370a6faf1531caa (void))[3]) (
+--   A arg1
+-- )
+-- {
+--   return &globalVar;
+-- }
+{-| Auxiliary type used by 'FileOpenedNotification'
+
+    __C declaration:__ @FileOpenedNotification@
+
+    __defined at:__ @functions\/callbacks.h 10:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype FileOpenedNotification_Aux
+    = FileOpenedNotification_Aux {unwrapFileOpenedNotification_Aux :: (IO ())}
+    deriving stock Generic
+-- __unique:__ @toFileOpenedNotification_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b3b8b1fad168671a_base ::
+    IO ()
+ -> IO (FunPtr (IO ()))
+-- __unique:__ @toFileOpenedNotification_Aux@
+hs_bindgen_b3b8b1fad168671a :: FileOpenedNotification_Aux ->
+                               IO (FunPtr FileOpenedNotification_Aux)
+-- __unique:__ @toFileOpenedNotification_Aux@
+hs_bindgen_b3b8b1fad168671a = \fun_0 -> fmap castFunPtr (hs_bindgen_b3b8b1fad168671a_base (getField @"unwrapFileOpenedNotification_Aux" fun_0))
+-- __unique:__ @fromFileOpenedNotification_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_f3ba5920f34c7f6a_base ::
+    FunPtr (IO ())
+ -> IO ()
+-- __unique:__ @fromFileOpenedNotification_Aux@
+hs_bindgen_f3ba5920f34c7f6a :: FunPtr FileOpenedNotification_Aux ->
+                               FileOpenedNotification_Aux
+-- __unique:__ @fromFileOpenedNotification_Aux@
+hs_bindgen_f3ba5920f34c7f6a = \funPtr_0 -> FileOpenedNotification_Aux (hs_bindgen_f3ba5920f34c7f6a_base (castFunPtr funPtr_0))
+instance ToFunPtr FileOpenedNotification_Aux
+    where toFunPtr = hs_bindgen_b3b8b1fad168671a
+instance FromFunPtr FileOpenedNotification_Aux
+    where fromFunPtr = hs_bindgen_f3ba5920f34c7f6a
+instance (~) ty (IO ()) =>
+         HasField "unwrapFileOpenedNotification_Aux"
+                  FileOpenedNotification_Aux
+                  ty
+    where hasField = \x_0 -> (\y_1 -> FileOpenedNotification_Aux{unwrapFileOpenedNotification_Aux = y_1},
+                              getField @"unwrapFileOpenedNotification_Aux" x_0)
+instance (~) ty (IO ()) =>
+         HasField "unwrapFileOpenedNotification_Aux"
+                  (Ptr FileOpenedNotification_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFileOpenedNotification_Aux")
+instance HasCField FileOpenedNotification_Aux
+                   "unwrapFileOpenedNotification_Aux"
+    where type CFieldType FileOpenedNotification_Aux
+                          "unwrapFileOpenedNotification_Aux" = IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @FileOpenedNotification@
+
+    __defined at:__ @functions\/callbacks.h 10:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype FileOpenedNotification
+    = FileOpenedNotification {unwrapFileOpenedNotification :: (FunPtr FileOpenedNotification_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr FileOpenedNotification_Aux) =>
+         HasField "unwrapFileOpenedNotification" FileOpenedNotification ty
+    where hasField = \x_0 -> (\y_1 -> FileOpenedNotification{unwrapFileOpenedNotification = y_1},
+                              getField @"unwrapFileOpenedNotification" x_0)
+instance (~) ty (FunPtr FileOpenedNotification_Aux) =>
+         HasField "unwrapFileOpenedNotification"
+                  (Ptr FileOpenedNotification)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFileOpenedNotification")
+instance HasCField FileOpenedNotification
+                   "unwrapFileOpenedNotification"
+    where type CFieldType FileOpenedNotification
+                          "unwrapFileOpenedNotification" = FunPtr FileOpenedNotification_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'ProgressUpdate'
+
+    __C declaration:__ @ProgressUpdate@
+
+    __defined at:__ @functions\/callbacks.h 11:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype ProgressUpdate_Aux
+    = ProgressUpdate_Aux {unwrapProgressUpdate_Aux :: (CInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toProgressUpdate_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d551f31556ffa727_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @toProgressUpdate_Aux@
+hs_bindgen_d551f31556ffa727 :: ProgressUpdate_Aux ->
+                               IO (FunPtr ProgressUpdate_Aux)
+-- __unique:__ @toProgressUpdate_Aux@
+hs_bindgen_d551f31556ffa727 = \fun_0 -> fmap castFunPtr (hs_bindgen_d551f31556ffa727_base (\x_1 -> getField @"unwrapProgressUpdate_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromProgressUpdate_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ccf7f4b62a839a04_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromProgressUpdate_Aux@
+hs_bindgen_ccf7f4b62a839a04 :: FunPtr ProgressUpdate_Aux ->
+                               ProgressUpdate_Aux
+-- __unique:__ @fromProgressUpdate_Aux@
+hs_bindgen_ccf7f4b62a839a04 = \funPtr_0 -> ProgressUpdate_Aux (\x_1 -> hs_bindgen_ccf7f4b62a839a04_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr ProgressUpdate_Aux
+    where toFunPtr = hs_bindgen_d551f31556ffa727
+instance FromFunPtr ProgressUpdate_Aux
+    where fromFunPtr = hs_bindgen_ccf7f4b62a839a04
+instance (~) ty (CInt -> IO ()) =>
+         HasField "unwrapProgressUpdate_Aux" ProgressUpdate_Aux ty
+    where hasField = \x_0 -> (\y_1 -> ProgressUpdate_Aux{unwrapProgressUpdate_Aux = y_1},
+                              getField @"unwrapProgressUpdate_Aux" x_0)
+instance (~) ty (CInt -> IO ()) =>
+         HasField "unwrapProgressUpdate_Aux"
+                  (Ptr ProgressUpdate_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapProgressUpdate_Aux")
+instance HasCField ProgressUpdate_Aux "unwrapProgressUpdate_Aux"
+    where type CFieldType ProgressUpdate_Aux
+                          "unwrapProgressUpdate_Aux" = CInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @ProgressUpdate@
+
+    __defined at:__ @functions\/callbacks.h 11:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype ProgressUpdate
+    = ProgressUpdate {unwrapProgressUpdate :: (FunPtr ProgressUpdate_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr ProgressUpdate_Aux) =>
+         HasField "unwrapProgressUpdate" ProgressUpdate ty
+    where hasField = \x_0 -> (\y_1 -> ProgressUpdate{unwrapProgressUpdate = y_1},
+                              getField @"unwrapProgressUpdate" x_0)
+instance (~) ty (FunPtr ProgressUpdate_Aux) =>
+         HasField "unwrapProgressUpdate" (Ptr ProgressUpdate) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapProgressUpdate")
+instance HasCField ProgressUpdate "unwrapProgressUpdate"
+    where type CFieldType ProgressUpdate
+                          "unwrapProgressUpdate" = FunPtr ProgressUpdate_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'DataValidator'
+
+    __C declaration:__ @DataValidator@
+
+    __defined at:__ @functions\/callbacks.h 12:15@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype DataValidator_Aux
+    = DataValidator_Aux {unwrapDataValidator_Aux :: (CInt -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toDataValidator_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c656ca21e63343d6_base ::
+    CInt -> IO CInt
+ -> IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @toDataValidator_Aux@
+hs_bindgen_c656ca21e63343d6 :: DataValidator_Aux ->
+                               IO (FunPtr DataValidator_Aux)
+-- __unique:__ @toDataValidator_Aux@
+hs_bindgen_c656ca21e63343d6 = \fun_0 -> fmap castFunPtr (hs_bindgen_c656ca21e63343d6_base (\x_1 -> fmap toFFIType (getField @"unwrapDataValidator_Aux" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromDataValidator_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_c1e79a4c11ca4033_base ::
+    FunPtr (CInt -> IO CInt)
+ -> CInt
+ -> IO CInt
+-- __unique:__ @fromDataValidator_Aux@
+hs_bindgen_c1e79a4c11ca4033 :: FunPtr DataValidator_Aux ->
+                               DataValidator_Aux
+-- __unique:__ @fromDataValidator_Aux@
+hs_bindgen_c1e79a4c11ca4033 = \funPtr_0 -> DataValidator_Aux (\x_1 -> fmap fromFFIType (hs_bindgen_c1e79a4c11ca4033_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr DataValidator_Aux
+    where toFunPtr = hs_bindgen_c656ca21e63343d6
+instance FromFunPtr DataValidator_Aux
+    where fromFunPtr = hs_bindgen_c1e79a4c11ca4033
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapDataValidator_Aux" DataValidator_Aux ty
+    where hasField = \x_0 -> (\y_1 -> DataValidator_Aux{unwrapDataValidator_Aux = y_1},
+                              getField @"unwrapDataValidator_Aux" x_0)
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapDataValidator_Aux" (Ptr DataValidator_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapDataValidator_Aux")
+instance HasCField DataValidator_Aux "unwrapDataValidator_Aux"
+    where type CFieldType DataValidator_Aux
+                          "unwrapDataValidator_Aux" = CInt -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @DataValidator@
+
+    __defined at:__ @functions\/callbacks.h 12:15@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype DataValidator
+    = DataValidator {unwrapDataValidator :: (FunPtr DataValidator_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr DataValidator_Aux) =>
+         HasField "unwrapDataValidator" DataValidator ty
+    where hasField = \x_0 -> (\y_1 -> DataValidator{unwrapDataValidator = y_1},
+                              getField @"unwrapDataValidator" x_0)
+instance (~) ty (FunPtr DataValidator_Aux) =>
+         HasField "unwrapDataValidator" (Ptr DataValidator) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapDataValidator")
+instance HasCField DataValidator "unwrapDataValidator"
+    where type CFieldType DataValidator
+                          "unwrapDataValidator" = FunPtr DataValidator_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct Measurement@
+
+    __defined at:__ @functions\/callbacks.h 21:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data Measurement
+    = Measurement {measurement_value :: CDouble
+                   {- ^ __C declaration:__ @value@
+
+                        __defined at:__ @functions\/callbacks.h 22:10@
+
+                        __exported by:__ @functions\/callbacks.h@
+                   -},
+                   measurement_timestamp :: CDouble
+                   {- ^ __C declaration:__ @timestamp@
+
+                        __defined at:__ @functions\/callbacks.h 23:10@
+
+                        __exported by:__ @functions\/callbacks.h@
+                   -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Measurement
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Measurement
+    where readRaw = \ptr_0 -> (pure Measurement <*> readRaw (Proxy @"measurement_value") ptr_0) <*> readRaw (Proxy @"measurement_timestamp") ptr_0
+instance WriteRaw Measurement
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Measurement measurement_value_2
+                                                   measurement_timestamp_3 -> writeRaw (Proxy @"measurement_value") ptr_0 measurement_value_2 >> writeRaw (Proxy @"measurement_timestamp") ptr_0 measurement_timestamp_3
+deriving via (EquivStorable Measurement) instance Storable Measurement
+deriving via (IsStructViaReadRaw Measurement) instance IsStruct Measurement
+instance (~) ty CDouble =>
+         HasField "measurement_value" Measurement ty
+    where hasField = \x_0 -> (\y_1 -> Measurement{measurement_value = y_1,
+                                                  measurement_timestamp = getField @"measurement_timestamp" x_0},
+                              getField @"measurement_value" x_0)
+instance (~) ty CDouble =>
+         HasField "measurement_value" (Ptr Measurement) (Ptr ty)
+    where getField = fromPtr (Proxy @"measurement_value")
+instance HasCField Measurement "measurement_value"
+    where type CFieldType Measurement "measurement_value" = CDouble
+          offset# = \_ -> \_ -> 0
+instance (~) ty CDouble =>
+         HasField "measurement_timestamp" Measurement ty
+    where hasField = \x_0 -> (\y_1 -> Measurement{measurement_timestamp = y_1,
+                                                  measurement_value = getField @"measurement_value" x_0},
+                              getField @"measurement_timestamp" x_0)
+instance (~) ty CDouble =>
+         HasField "measurement_timestamp" (Ptr Measurement) (Ptr ty)
+    where getField = fromPtr (Proxy @"measurement_timestamp")
+instance HasCField Measurement "measurement_timestamp"
+    where type CFieldType Measurement "measurement_timestamp" = CDouble
+          offset# = \_ -> \_ -> 8
+{-| Auxiliary type used by 'MeasurementReceived'
+
+    __C declaration:__ @MeasurementReceived@
+
+    __defined at:__ @functions\/callbacks.h 26:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype MeasurementReceived_Aux
+    = MeasurementReceived_Aux {unwrapMeasurementReceived_Aux :: (Ptr Measurement ->
+                                                                 IO ())}
+    deriving stock Generic
+-- __unique:__ @toMeasurementReceived_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_9259654df9d40f5b_base ::
+    Ptr Void -> IO ()
+ -> IO (FunPtr (Ptr Void -> IO ()))
+-- __unique:__ @toMeasurementReceived_Aux@
+hs_bindgen_9259654df9d40f5b :: MeasurementReceived_Aux ->
+                               IO (FunPtr MeasurementReceived_Aux)
+-- __unique:__ @toMeasurementReceived_Aux@
+hs_bindgen_9259654df9d40f5b = \fun_0 -> fmap castFunPtr (hs_bindgen_9259654df9d40f5b_base (\x_1 -> getField @"unwrapMeasurementReceived_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromMeasurementReceived_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_383c36bb22947621_base ::
+    FunPtr (Ptr Void -> IO ())
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @fromMeasurementReceived_Aux@
+hs_bindgen_383c36bb22947621 :: FunPtr MeasurementReceived_Aux ->
+                               MeasurementReceived_Aux
+-- __unique:__ @fromMeasurementReceived_Aux@
+hs_bindgen_383c36bb22947621 = \funPtr_0 -> MeasurementReceived_Aux (\x_1 -> hs_bindgen_383c36bb22947621_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr MeasurementReceived_Aux
+    where toFunPtr = hs_bindgen_9259654df9d40f5b
+instance FromFunPtr MeasurementReceived_Aux
+    where fromFunPtr = hs_bindgen_383c36bb22947621
+instance (~) ty (Ptr Measurement -> IO ()) =>
+         HasField "unwrapMeasurementReceived_Aux" MeasurementReceived_Aux ty
+    where hasField = \x_0 -> (\y_1 -> MeasurementReceived_Aux{unwrapMeasurementReceived_Aux = y_1},
+                              getField @"unwrapMeasurementReceived_Aux" x_0)
+instance (~) ty (Ptr Measurement -> IO ()) =>
+         HasField "unwrapMeasurementReceived_Aux"
+                  (Ptr MeasurementReceived_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMeasurementReceived_Aux")
+instance HasCField MeasurementReceived_Aux
+                   "unwrapMeasurementReceived_Aux"
+    where type CFieldType MeasurementReceived_Aux
+                          "unwrapMeasurementReceived_Aux" = Ptr Measurement -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @MeasurementReceived@
+
+    __defined at:__ @functions\/callbacks.h 26:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype MeasurementReceived
+    = MeasurementReceived {unwrapMeasurementReceived :: (FunPtr MeasurementReceived_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr MeasurementReceived_Aux) =>
+         HasField "unwrapMeasurementReceived" MeasurementReceived ty
+    where hasField = \x_0 -> (\y_1 -> MeasurementReceived{unwrapMeasurementReceived = y_1},
+                              getField @"unwrapMeasurementReceived" x_0)
+instance (~) ty (FunPtr MeasurementReceived_Aux) =>
+         HasField "unwrapMeasurementReceived"
+                  (Ptr MeasurementReceived)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMeasurementReceived")
+instance HasCField MeasurementReceived "unwrapMeasurementReceived"
+    where type CFieldType MeasurementReceived
+                          "unwrapMeasurementReceived" = FunPtr MeasurementReceived_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'MeasurementReceived2'
+
+    __C declaration:__ @MeasurementReceived2@
+
+    __defined at:__ @functions\/callbacks.h 29:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype MeasurementReceived2_Aux
+    = MeasurementReceived2_Aux {unwrapMeasurementReceived2_Aux :: (Measurement ->
+                                                                   IO ())}
+    deriving stock Generic
+instance (~) ty (Measurement -> IO ()) =>
+         HasField "unwrapMeasurementReceived2_Aux"
+                  MeasurementReceived2_Aux
+                  ty
+    where hasField = \x_0 -> (\y_1 -> MeasurementReceived2_Aux{unwrapMeasurementReceived2_Aux = y_1},
+                              getField @"unwrapMeasurementReceived2_Aux" x_0)
+instance (~) ty (Measurement -> IO ()) =>
+         HasField "unwrapMeasurementReceived2_Aux"
+                  (Ptr MeasurementReceived2_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMeasurementReceived2_Aux")
+instance HasCField MeasurementReceived2_Aux
+                   "unwrapMeasurementReceived2_Aux"
+    where type CFieldType MeasurementReceived2_Aux
+                          "unwrapMeasurementReceived2_Aux" = Measurement -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @MeasurementReceived2@
+
+    __defined at:__ @functions\/callbacks.h 29:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype MeasurementReceived2
+    = MeasurementReceived2 {unwrapMeasurementReceived2 :: (FunPtr MeasurementReceived2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr MeasurementReceived2_Aux) =>
+         HasField "unwrapMeasurementReceived2" MeasurementReceived2 ty
+    where hasField = \x_0 -> (\y_1 -> MeasurementReceived2{unwrapMeasurementReceived2 = y_1},
+                              getField @"unwrapMeasurementReceived2" x_0)
+instance (~) ty (FunPtr MeasurementReceived2_Aux) =>
+         HasField "unwrapMeasurementReceived2"
+                  (Ptr MeasurementReceived2)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMeasurementReceived2")
+instance HasCField MeasurementReceived2
+                   "unwrapMeasurementReceived2"
+    where type CFieldType MeasurementReceived2
+                          "unwrapMeasurementReceived2" = FunPtr MeasurementReceived2_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'SampleBufferFull'
+
+    __C declaration:__ @SampleBufferFull@
+
+    __defined at:__ @functions\/callbacks.h 32:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype SampleBufferFull_Aux
+    = SampleBufferFull_Aux {unwrapSampleBufferFull_Aux :: (Ptr (Elem (ConstantArray 10
+                                                                                    CInt)) ->
+                                                           IO ())}
+    deriving stock Generic
+-- __unique:__ @toSampleBufferFull_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_57d9e30494ae4453_base ::
+    Ptr Void -> IO ()
+ -> IO (FunPtr (Ptr Void -> IO ()))
+-- __unique:__ @toSampleBufferFull_Aux@
+hs_bindgen_57d9e30494ae4453 :: SampleBufferFull_Aux ->
+                               IO (FunPtr SampleBufferFull_Aux)
+-- __unique:__ @toSampleBufferFull_Aux@
+hs_bindgen_57d9e30494ae4453 = \fun_0 -> fmap castFunPtr (hs_bindgen_57d9e30494ae4453_base (\x_1 -> getField @"unwrapSampleBufferFull_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromSampleBufferFull_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_2ab7ac6bb756ba7e_base ::
+    FunPtr (Ptr Void -> IO ())
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @fromSampleBufferFull_Aux@
+hs_bindgen_2ab7ac6bb756ba7e :: FunPtr SampleBufferFull_Aux ->
+                               SampleBufferFull_Aux
+-- __unique:__ @fromSampleBufferFull_Aux@
+hs_bindgen_2ab7ac6bb756ba7e = \funPtr_0 -> SampleBufferFull_Aux (\x_1 -> hs_bindgen_2ab7ac6bb756ba7e_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr SampleBufferFull_Aux
+    where toFunPtr = hs_bindgen_57d9e30494ae4453
+instance FromFunPtr SampleBufferFull_Aux
+    where fromFunPtr = hs_bindgen_2ab7ac6bb756ba7e
+instance (~) ty (Ptr (Elem (ConstantArray 10 CInt)) -> IO ()) =>
+         HasField "unwrapSampleBufferFull_Aux" SampleBufferFull_Aux ty
+    where hasField = \x_0 -> (\y_1 -> SampleBufferFull_Aux{unwrapSampleBufferFull_Aux = y_1},
+                              getField @"unwrapSampleBufferFull_Aux" x_0)
+instance (~) ty (Ptr (Elem (ConstantArray 10 CInt)) -> IO ()) =>
+         HasField "unwrapSampleBufferFull_Aux"
+                  (Ptr SampleBufferFull_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSampleBufferFull_Aux")
+instance HasCField SampleBufferFull_Aux
+                   "unwrapSampleBufferFull_Aux"
+    where type CFieldType SampleBufferFull_Aux
+                          "unwrapSampleBufferFull_Aux" = Ptr (Elem (ConstantArray 10
+                                                                                  CInt)) ->
+                                                         IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @SampleBufferFull@
+
+    __defined at:__ @functions\/callbacks.h 32:16@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype SampleBufferFull
+    = SampleBufferFull {unwrapSampleBufferFull :: (FunPtr SampleBufferFull_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr SampleBufferFull_Aux) =>
+         HasField "unwrapSampleBufferFull" SampleBufferFull ty
+    where hasField = \x_0 -> (\y_1 -> SampleBufferFull{unwrapSampleBufferFull = y_1},
+                              getField @"unwrapSampleBufferFull" x_0)
+instance (~) ty (FunPtr SampleBufferFull_Aux) =>
+         HasField "unwrapSampleBufferFull" (Ptr SampleBufferFull) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSampleBufferFull")
+instance HasCField SampleBufferFull "unwrapSampleBufferFull"
+    where type CFieldType SampleBufferFull
+                          "unwrapSampleBufferFull" = FunPtr SampleBufferFull_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct MeasurementHandler@
+
+    __defined at:__ @functions\/callbacks.h 50:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data MeasurementHandler
+    = MeasurementHandler {measurementHandler_onReceived :: (FunPtr (Ptr Measurement ->
+                                                                    IO ()))
+                          {- ^ __C declaration:__ @onReceived@
+
+                               __defined at:__ @functions\/callbacks.h 51:10@
+
+                               __exported by:__ @functions\/callbacks.h@
+                          -},
+                          measurementHandler_validate :: (FunPtr (Ptr Measurement ->
+                                                                  IO CInt))
+                          {- ^ __C declaration:__ @validate@
+
+                               __defined at:__ @functions\/callbacks.h 52:9@
+
+                               __exported by:__ @functions\/callbacks.h@
+                          -},
+                          measurementHandler_onError :: (FunPtr (CInt -> IO ()))
+                          {- ^ __C declaration:__ @onError@
+
+                               __defined at:__ @functions\/callbacks.h 53:10@
+
+                               __exported by:__ @functions\/callbacks.h@
+                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize MeasurementHandler
+    where staticSizeOf = \_ -> 24 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw MeasurementHandler
+    where readRaw = \ptr_0 -> ((pure MeasurementHandler <*> readRaw (Proxy @"measurementHandler_onReceived") ptr_0) <*> readRaw (Proxy @"measurementHandler_validate") ptr_0) <*> readRaw (Proxy @"measurementHandler_onError") ptr_0
+instance WriteRaw MeasurementHandler
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       MeasurementHandler measurementHandler_onReceived_2
+                                                          measurementHandler_validate_3
+                                                          measurementHandler_onError_4 -> writeRaw (Proxy @"measurementHandler_onReceived") ptr_0 measurementHandler_onReceived_2 >> (writeRaw (Proxy @"measurementHandler_validate") ptr_0 measurementHandler_validate_3 >> writeRaw (Proxy @"measurementHandler_onError") ptr_0 measurementHandler_onError_4)
+deriving via (EquivStorable MeasurementHandler) instance Storable MeasurementHandler
+deriving via (IsStructViaReadRaw MeasurementHandler) instance IsStruct MeasurementHandler
+instance (~) ty (FunPtr (Ptr Measurement -> IO ())) =>
+         HasField "measurementHandler_onReceived" MeasurementHandler ty
+    where hasField = \x_0 -> (\y_1 -> MeasurementHandler{measurementHandler_onReceived = y_1,
+                                                         measurementHandler_validate = getField @"measurementHandler_validate" x_0,
+                                                         measurementHandler_onError = getField @"measurementHandler_onError" x_0},
+                              getField @"measurementHandler_onReceived" x_0)
+instance (~) ty (FunPtr (Ptr Measurement -> IO ())) =>
+         HasField "measurementHandler_onReceived"
+                  (Ptr MeasurementHandler)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"measurementHandler_onReceived")
+instance HasCField MeasurementHandler
+                   "measurementHandler_onReceived"
+    where type CFieldType MeasurementHandler
+                          "measurementHandler_onReceived" = FunPtr (Ptr Measurement -> IO ())
+          offset# = \_ -> \_ -> 0
+instance (~) ty (FunPtr (Ptr Measurement -> IO CInt)) =>
+         HasField "measurementHandler_validate" MeasurementHandler ty
+    where hasField = \x_0 -> (\y_1 -> MeasurementHandler{measurementHandler_validate = y_1,
+                                                         measurementHandler_onReceived = getField @"measurementHandler_onReceived" x_0,
+                                                         measurementHandler_onError = getField @"measurementHandler_onError" x_0},
+                              getField @"measurementHandler_validate" x_0)
+instance (~) ty (FunPtr (Ptr Measurement -> IO CInt)) =>
+         HasField "measurementHandler_validate"
+                  (Ptr MeasurementHandler)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"measurementHandler_validate")
+instance HasCField MeasurementHandler "measurementHandler_validate"
+    where type CFieldType MeasurementHandler
+                          "measurementHandler_validate" = FunPtr (Ptr Measurement -> IO CInt)
+          offset# = \_ -> \_ -> 8
+instance (~) ty (FunPtr (CInt -> IO ())) =>
+         HasField "measurementHandler_onError" MeasurementHandler ty
+    where hasField = \x_0 -> (\y_1 -> MeasurementHandler{measurementHandler_onError = y_1,
+                                                         measurementHandler_onReceived = getField @"measurementHandler_onReceived" x_0,
+                                                         measurementHandler_validate = getField @"measurementHandler_validate" x_0},
+                              getField @"measurementHandler_onError" x_0)
+instance (~) ty (FunPtr (CInt -> IO ())) =>
+         HasField "measurementHandler_onError"
+                  (Ptr MeasurementHandler)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"measurementHandler_onError")
+instance HasCField MeasurementHandler "measurementHandler_onError"
+    where type CFieldType MeasurementHandler
+                          "measurementHandler_onError" = FunPtr (CInt -> IO ())
+          offset# = \_ -> \_ -> 16
+{-| __C declaration:__ @struct DataPipeline@
+
+    __defined at:__ @functions\/callbacks.h 58:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data DataPipeline
+    = DataPipeline {dataPipeline_preProcess :: (FunPtr (Ptr Measurement ->
+                                                        DataValidator -> IO ()))
+                    {- ^ __C declaration:__ @preProcess@
+
+                         __defined at:__ @functions\/callbacks.h 59:10@
+
+                         __exported by:__ @functions\/callbacks.h@
+                    -},
+                    dataPipeline_process :: (FunPtr (Ptr Measurement -> IO ()))
+                    {- ^ __C declaration:__ @process@
+
+                         __defined at:__ @functions\/callbacks.h 60:10@
+
+                         __exported by:__ @functions\/callbacks.h@
+                    -},
+                    dataPipeline_postProcess :: (FunPtr (Ptr Measurement ->
+                                                         ProgressUpdate -> IO ()))
+                    {- ^ __C declaration:__ @postProcess@
+
+                         __defined at:__ @functions\/callbacks.h 61:10@
+
+                         __exported by:__ @functions\/callbacks.h@
+                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize DataPipeline
+    where staticSizeOf = \_ -> 24 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw DataPipeline
+    where readRaw = \ptr_0 -> ((pure DataPipeline <*> readRaw (Proxy @"dataPipeline_preProcess") ptr_0) <*> readRaw (Proxy @"dataPipeline_process") ptr_0) <*> readRaw (Proxy @"dataPipeline_postProcess") ptr_0
+instance WriteRaw DataPipeline
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       DataPipeline dataPipeline_preProcess_2
+                                                    dataPipeline_process_3
+                                                    dataPipeline_postProcess_4 -> writeRaw (Proxy @"dataPipeline_preProcess") ptr_0 dataPipeline_preProcess_2 >> (writeRaw (Proxy @"dataPipeline_process") ptr_0 dataPipeline_process_3 >> writeRaw (Proxy @"dataPipeline_postProcess") ptr_0 dataPipeline_postProcess_4)
+deriving via (EquivStorable DataPipeline) instance Storable DataPipeline
+deriving via (IsStructViaReadRaw DataPipeline) instance IsStruct DataPipeline
+instance (~) ty
+             (FunPtr (Ptr Measurement -> DataValidator -> IO ())) =>
+         HasField "dataPipeline_preProcess" DataPipeline ty
+    where hasField = \x_0 -> (\y_1 -> DataPipeline{dataPipeline_preProcess = y_1,
+                                                   dataPipeline_process = getField @"dataPipeline_process" x_0,
+                                                   dataPipeline_postProcess = getField @"dataPipeline_postProcess" x_0},
+                              getField @"dataPipeline_preProcess" x_0)
+instance (~) ty
+             (FunPtr (Ptr Measurement -> DataValidator -> IO ())) =>
+         HasField "dataPipeline_preProcess" (Ptr DataPipeline) (Ptr ty)
+    where getField = fromPtr (Proxy @"dataPipeline_preProcess")
+instance HasCField DataPipeline "dataPipeline_preProcess"
+    where type CFieldType DataPipeline
+                          "dataPipeline_preProcess" = FunPtr (Ptr Measurement ->
+                                                              DataValidator -> IO ())
+          offset# = \_ -> \_ -> 0
+instance (~) ty (FunPtr (Ptr Measurement -> IO ())) =>
+         HasField "dataPipeline_process" DataPipeline ty
+    where hasField = \x_0 -> (\y_1 -> DataPipeline{dataPipeline_process = y_1,
+                                                   dataPipeline_preProcess = getField @"dataPipeline_preProcess" x_0,
+                                                   dataPipeline_postProcess = getField @"dataPipeline_postProcess" x_0},
+                              getField @"dataPipeline_process" x_0)
+instance (~) ty (FunPtr (Ptr Measurement -> IO ())) =>
+         HasField "dataPipeline_process" (Ptr DataPipeline) (Ptr ty)
+    where getField = fromPtr (Proxy @"dataPipeline_process")
+instance HasCField DataPipeline "dataPipeline_process"
+    where type CFieldType DataPipeline
+                          "dataPipeline_process" = FunPtr (Ptr Measurement -> IO ())
+          offset# = \_ -> \_ -> 8
+instance (~) ty
+             (FunPtr (Ptr Measurement -> ProgressUpdate -> IO ())) =>
+         HasField "dataPipeline_postProcess" DataPipeline ty
+    where hasField = \x_0 -> (\y_1 -> DataPipeline{dataPipeline_postProcess = y_1,
+                                                   dataPipeline_preProcess = getField @"dataPipeline_preProcess" x_0,
+                                                   dataPipeline_process = getField @"dataPipeline_process" x_0},
+                              getField @"dataPipeline_postProcess" x_0)
+instance (~) ty
+             (FunPtr (Ptr Measurement -> ProgressUpdate -> IO ())) =>
+         HasField "dataPipeline_postProcess" (Ptr DataPipeline) (Ptr ty)
+    where getField = fromPtr (Proxy @"dataPipeline_postProcess")
+instance HasCField DataPipeline "dataPipeline_postProcess"
+    where type CFieldType DataPipeline
+                          "dataPipeline_postProcess" = FunPtr (Ptr Measurement ->
+                                                               ProgressUpdate -> IO ())
+          offset# = \_ -> \_ -> 16
+{-| __C declaration:__ @union ProcessorCallback@
+
+    __defined at:__ @functions\/callbacks.h 69:7@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype ProcessorCallback
+    = ProcessorCallback {unwrapProcessorCallback :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8
+                             8) instance StaticSize ProcessorCallback
+deriving via (SizedByteArray 8
+                             8) instance ReadRaw ProcessorCallback
+deriving via (SizedByteArray 8
+                             8) instance WriteRaw ProcessorCallback
+deriving via (EquivStorable ProcessorCallback) instance Storable ProcessorCallback
+deriving via (SizedByteArray 8
+                             8) instance IsUnion ProcessorCallback
+instance (~) ty (FunPtr (Ptr Measurement -> IO ())) =>
+         HasField "processorCallback_simple" ProcessorCallback ty
+    where getField = getUnionPayload
+instance (~) ty (FunPtr (Ptr Measurement -> IO ())) =>
+         HasField "processorCallback_simple" ProcessorCallback ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"processorCallback_simple" x_0)
+instance (~) ty (FunPtr (Ptr Measurement -> IO ())) =>
+         HasField "processorCallback_simple"
+                  (Ptr ProcessorCallback)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"processorCallback_simple")
+instance HasCField ProcessorCallback "processorCallback_simple"
+    where type CFieldType ProcessorCallback
+                          "processorCallback_simple" = FunPtr (Ptr Measurement -> IO ())
+          offset# = \_ -> \_ -> 0
+instance (~) ty
+             (FunPtr (Ptr Measurement -> DataValidator -> IO ())) =>
+         HasField "processorCallback_withValidator" ProcessorCallback ty
+    where getField = getUnionPayload
+instance (~) ty
+             (FunPtr (Ptr Measurement -> DataValidator -> IO ())) =>
+         HasField "processorCallback_withValidator" ProcessorCallback ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"processorCallback_withValidator" x_0)
+instance (~) ty
+             (FunPtr (Ptr Measurement -> DataValidator -> IO ())) =>
+         HasField "processorCallback_withValidator"
+                  (Ptr ProcessorCallback)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"processorCallback_withValidator")
+instance HasCField ProcessorCallback
+                   "processorCallback_withValidator"
+    where type CFieldType ProcessorCallback
+                          "processorCallback_withValidator" = FunPtr (Ptr Measurement ->
+                                                                      DataValidator -> IO ())
+          offset# = \_ -> \_ -> 0
+instance (~) ty
+             (FunPtr (Ptr Measurement -> ProgressUpdate -> IO ())) =>
+         HasField "processorCallback_withProgress" ProcessorCallback ty
+    where getField = getUnionPayload
+instance (~) ty
+             (FunPtr (Ptr Measurement -> ProgressUpdate -> IO ())) =>
+         HasField "processorCallback_withProgress" ProcessorCallback ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"processorCallback_withProgress" x_0)
+instance (~) ty
+             (FunPtr (Ptr Measurement -> ProgressUpdate -> IO ())) =>
+         HasField "processorCallback_withProgress"
+                  (Ptr ProcessorCallback)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"processorCallback_withProgress")
+instance HasCField ProcessorCallback
+                   "processorCallback_withProgress"
+    where type CFieldType ProcessorCallback
+                          "processorCallback_withProgress" = FunPtr (Ptr Measurement ->
+                                                                     ProgressUpdate -> IO ())
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @enum \@Processor_mode@
+
+    __defined at:__ @functions\/callbacks.h 76:3@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype Processor_mode
+    = Processor_mode {unwrapProcessor_mode :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Processor_mode
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Processor_mode
+    where readRaw = \ptr_0 -> pure Processor_mode <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Processor_mode
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Processor_mode unwrapProcessor_mode_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapProcessor_mode_2
+deriving via (EquivStorable Processor_mode) instance Storable Processor_mode
+deriving via CUInt instance Prim Processor_mode
+instance CEnum Processor_mode
+    where type CEnumZ Processor_mode = CUInt
+          toCEnum = Processor_mode
+          fromCEnum = getField @"unwrapProcessor_mode"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "MODE_SIMPLE"),
+                                                         (1, singleton "MODE_VALIDATED"),
+                                                         (2, singleton "MODE_PROGRESS")]
+          showsUndeclared = showsWrappedUndeclared "Processor_mode"
+          readPrecUndeclared = readPrecWrappedUndeclared "Processor_mode"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Processor_mode
+    where minDeclaredValue = MODE_SIMPLE
+          maxDeclaredValue = MODE_PROGRESS
+instance Show Processor_mode
+    where showsPrec = shows
+instance Read Processor_mode
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt =>
+         HasField "unwrapProcessor_mode" Processor_mode ty
+    where hasField = \x_0 -> (\y_1 -> Processor_mode{unwrapProcessor_mode = y_1},
+                              getField @"unwrapProcessor_mode" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapProcessor_mode" (Ptr Processor_mode) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapProcessor_mode")
+instance HasCField Processor_mode "unwrapProcessor_mode"
+    where type CFieldType Processor_mode "unwrapProcessor_mode" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @MODE_SIMPLE@
+
+    __defined at:__ @functions\/callbacks.h 76:10@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+pattern MODE_SIMPLE :: Processor_mode
+pattern MODE_SIMPLE = Processor_mode 0
+{-| __C declaration:__ @MODE_VALIDATED@
+
+    __defined at:__ @functions\/callbacks.h 76:23@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+pattern MODE_VALIDATED :: Processor_mode
+pattern MODE_VALIDATED = Processor_mode 1
+{-| __C declaration:__ @MODE_PROGRESS@
+
+    __defined at:__ @functions\/callbacks.h 76:39@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+pattern MODE_PROGRESS :: Processor_mode
+pattern MODE_PROGRESS = Processor_mode 2
+{-| __C declaration:__ @struct Processor@
+
+    __defined at:__ @functions\/callbacks.h 75:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data Processor
+    = Processor {processor_mode :: Processor_mode
+                 {- ^ __C declaration:__ @mode@
+
+                      __defined at:__ @functions\/callbacks.h 76:55@
+
+                      __exported by:__ @functions\/callbacks.h@
+                 -},
+                 processor_callback :: ProcessorCallback
+                 {- ^ __C declaration:__ @callback@
+
+                      __defined at:__ @functions\/callbacks.h 77:27@
+
+                      __exported by:__ @functions\/callbacks.h@
+                 -}}
+    deriving stock Generic
+instance StaticSize Processor
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Processor
+    where readRaw = \ptr_0 -> (pure Processor <*> readRaw (Proxy @"processor_mode") ptr_0) <*> readRaw (Proxy @"processor_callback") ptr_0
+instance WriteRaw Processor
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Processor processor_mode_2
+                                                 processor_callback_3 -> writeRaw (Proxy @"processor_mode") ptr_0 processor_mode_2 >> writeRaw (Proxy @"processor_callback") ptr_0 processor_callback_3
+deriving via (EquivStorable Processor) instance Storable Processor
+deriving via (IsStructViaReadRaw Processor) instance IsStruct Processor
+instance (~) ty Processor_mode =>
+         HasField "processor_mode" Processor ty
+    where hasField = \x_0 -> (\y_1 -> Processor{processor_mode = y_1,
+                                                processor_callback = getField @"processor_callback" x_0},
+                              getField @"processor_mode" x_0)
+instance (~) ty Processor_mode =>
+         HasField "processor_mode" (Ptr Processor) (Ptr ty)
+    where getField = fromPtr (Proxy @"processor_mode")
+instance HasCField Processor "processor_mode"
+    where type CFieldType Processor "processor_mode" = Processor_mode
+          offset# = \_ -> \_ -> 0
+instance (~) ty ProcessorCallback =>
+         HasField "processor_callback" Processor ty
+    where hasField = \x_0 -> (\y_1 -> Processor{processor_callback = y_1,
+                                                processor_mode = getField @"processor_mode" x_0},
+                              getField @"processor_callback" x_0)
+instance (~) ty ProcessorCallback =>
+         HasField "processor_callback" (Ptr Processor) (Ptr ty)
+    where getField = fromPtr (Proxy @"processor_callback")
+instance HasCField Processor "processor_callback"
+    where type CFieldType Processor
+                          "processor_callback" = ProcessorCallback
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @functions\/callbacks.h 94:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype Foo
+    = Foo {unwrapFoo :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapFoo" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{unwrapFoo = y_1},
+                              getField @"unwrapFoo" x_0)
+instance (~) ty CInt => HasField "unwrapFoo" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo")
+instance HasCField Foo "unwrapFoo"
+    where type CFieldType Foo "unwrapFoo" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @functions\/callbacks.h 95:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype Foo2
+    = Foo2 {unwrapFoo2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapFoo2" Foo2 ty
+    where hasField = \x_0 -> (\y_1 -> Foo2{unwrapFoo2 = y_1},
+                              getField @"unwrapFoo2" x_0)
+instance (~) ty CInt => HasField "unwrapFoo2" (Ptr Foo2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo2")
+instance HasCField Foo2 "unwrapFoo2"
+    where type CFieldType Foo2 "unwrapFoo2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @A@
+
+    __defined at:__ @functions\/callbacks.h 102:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype A
+    = A {unwrapA :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty CInt => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @B@
+
+    __defined at:__ @functions\/callbacks.h 108:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype B
+    = B {unwrapB :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty CInt => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/callbacks.h 109:8@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+data S
+    = S {s_fn :: (FunPtr (B -> IO ()))
+         {- ^ __C declaration:__ @fn@
+
+              __defined at:__ @functions\/callbacks.h 110:17@
+
+              __exported by:__ @functions\/callbacks.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_fn") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_fn_2 -> writeRaw (Proxy @"s_fn") ptr_0 s_fn_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty (FunPtr (B -> IO ())) => HasField "s_fn" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_fn = y_1},
+                              getField @"s_fn" x_0)
+instance (~) ty (FunPtr (B -> IO ())) =>
+         HasField "s_fn" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_fn")
+instance HasCField S "s_fn"
+    where type CFieldType S "s_fn" = FunPtr (B -> IO ())
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @C@
+
+    __defined at:__ @functions\/callbacks.h 116:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype C
+    = C {unwrapC :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapC" C ty
+    where hasField = \x_0 -> (\y_1 -> C{unwrapC = y_1},
+                              getField @"unwrapC" x_0)
+instance (~) ty CInt => HasField "unwrapC" (Ptr C) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapC")
+instance HasCField C "unwrapC"
+    where type CFieldType C "unwrapC" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/callbacks.h 117:7@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype U = U {unwrapU :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 24 8) instance StaticSize U
+deriving via (SizedByteArray 24 8) instance ReadRaw U
+deriving via (SizedByteArray 24 8) instance WriteRaw U
+deriving via (EquivStorable U) instance Storable U
+deriving via (SizedByteArray 24 8) instance IsUnion U
+instance (~) ty (ConstantArray 3 (FunPtr (C -> IO ()))) =>
+         HasField "u_fn" U ty
+    where getField = getUnionPayload
+instance (~) ty (ConstantArray 3 (FunPtr (C -> IO ()))) =>
+         HasField "u_fn" U ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"u_fn" x_0)
+instance (~) ty (ConstantArray 3 (FunPtr (C -> IO ()))) =>
+         HasField "u_fn" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"u_fn")
+instance HasCField U "u_fn"
+    where type CFieldType U "u_fn" = ConstantArray 3
+                                                   (FunPtr (C -> IO ()))
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @D@
+
+    __defined at:__ @functions\/callbacks.h 124:13@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype D
+    = D {unwrapD :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapD" D ty
+    where hasField = \x_0 -> (\y_1 -> D{unwrapD = y_1},
+                              getField @"unwrapD" x_0)
+instance (~) ty CInt => HasField "unwrapD" (Ptr D) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapD")
+instance HasCField D "unwrapD"
+    where type CFieldType D "unwrapD" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T@
+
+    __defined at:__ @functions\/callbacks.h 125:15@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+newtype T
+    = T {unwrapT :: (FunPtr (D -> IO ()) -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toT@
+foreign import ccall safe "wrapper" hs_bindgen_b8534912f6256492_base ::
+    FunPtr Void -> IO ()
+ -> IO (FunPtr (FunPtr Void -> IO ()))
+-- __unique:__ @toT@
+hs_bindgen_b8534912f6256492 :: T -> IO (FunPtr T)
+-- __unique:__ @toT@
+hs_bindgen_b8534912f6256492 = \fun_0 -> fmap castFunPtr (hs_bindgen_b8534912f6256492_base (\x_1 -> getField @"unwrapT" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromT@
+foreign import ccall safe "dynamic" hs_bindgen_8f830eadb43a6fe4_base ::
+    FunPtr (FunPtr Void -> IO ())
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @fromT@
+hs_bindgen_8f830eadb43a6fe4 :: FunPtr T -> T
+-- __unique:__ @fromT@
+hs_bindgen_8f830eadb43a6fe4 = \funPtr_0 -> T (\x_1 -> hs_bindgen_8f830eadb43a6fe4_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr T
+    where toFunPtr = hs_bindgen_b8534912f6256492
+instance FromFunPtr T
+    where fromFunPtr = hs_bindgen_8f830eadb43a6fe4
+instance (~) ty (FunPtr (D -> IO ()) -> IO ()) =>
+         HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty (FunPtr (D -> IO ()) -> IO ()) =>
+         HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = FunPtr (D -> IO ()) -> IO ()
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @instance ToFunPtr (A -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_a46c670f88b5e6d2_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (A -> IO ())@
+hs_bindgen_a46c670f88b5e6d2 :: (A -> IO ()) ->
+                               IO (FunPtr (A -> IO ()))
+-- __unique:__ @instance ToFunPtr (A -> IO ())@
+hs_bindgen_a46c670f88b5e6d2 = \fun_0 -> fmap castFunPtr (hs_bindgen_a46c670f88b5e6d2_base (\x_1 -> fun_0 (fromFFIType x_1)))
+-- __unique:__ @instance FromFunPtr (A -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_542fc348d1df7dff_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (A -> IO ())@
+hs_bindgen_542fc348d1df7dff :: FunPtr (A -> IO ()) -> A -> IO ()
+-- __unique:__ @instance FromFunPtr (A -> IO ())@
+hs_bindgen_542fc348d1df7dff = \funPtr_0 -> \x_1 -> hs_bindgen_542fc348d1df7dff_base (castFunPtr funPtr_0) (toFFIType x_1)
+instance ToFunPtr (A -> IO ())
+    where toFunPtr = hs_bindgen_a46c670f88b5e6d2
+instance FromFunPtr (A -> IO ())
+    where fromFunPtr = hs_bindgen_542fc348d1df7dff
+-- __unique:__ @instance ToFunPtr (B -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_ca9230f035bf19b1_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (B -> IO ())@
+hs_bindgen_ca9230f035bf19b1 :: (B -> IO ()) ->
+                               IO (FunPtr (B -> IO ()))
+-- __unique:__ @instance ToFunPtr (B -> IO ())@
+hs_bindgen_ca9230f035bf19b1 = \fun_0 -> fmap castFunPtr (hs_bindgen_ca9230f035bf19b1_base (\x_1 -> fun_0 (fromFFIType x_1)))
+-- __unique:__ @instance FromFunPtr (B -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_05635addcbfd7dd4_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (B -> IO ())@
+hs_bindgen_05635addcbfd7dd4 :: FunPtr (B -> IO ()) -> B -> IO ()
+-- __unique:__ @instance FromFunPtr (B -> IO ())@
+hs_bindgen_05635addcbfd7dd4 = \funPtr_0 -> \x_1 -> hs_bindgen_05635addcbfd7dd4_base (castFunPtr funPtr_0) (toFFIType x_1)
+instance ToFunPtr (B -> IO ())
+    where toFunPtr = hs_bindgen_ca9230f035bf19b1
+instance FromFunPtr (B -> IO ())
+    where fromFunPtr = hs_bindgen_05635addcbfd7dd4
+-- __unique:__ @instance ToFunPtr (C -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_151c4eb8866d683f_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (C -> IO ())@
+hs_bindgen_151c4eb8866d683f :: (C -> IO ()) ->
+                               IO (FunPtr (C -> IO ()))
+-- __unique:__ @instance ToFunPtr (C -> IO ())@
+hs_bindgen_151c4eb8866d683f = \fun_0 -> fmap castFunPtr (hs_bindgen_151c4eb8866d683f_base (\x_1 -> fun_0 (fromFFIType x_1)))
+-- __unique:__ @instance FromFunPtr (C -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_f9f9dcb4f8267450_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (C -> IO ())@
+hs_bindgen_f9f9dcb4f8267450 :: FunPtr (C -> IO ()) -> C -> IO ()
+-- __unique:__ @instance FromFunPtr (C -> IO ())@
+hs_bindgen_f9f9dcb4f8267450 = \funPtr_0 -> \x_1 -> hs_bindgen_f9f9dcb4f8267450_base (castFunPtr funPtr_0) (toFFIType x_1)
+instance ToFunPtr (C -> IO ())
+    where toFunPtr = hs_bindgen_151c4eb8866d683f
+instance FromFunPtr (C -> IO ())
+    where fromFunPtr = hs_bindgen_f9f9dcb4f8267450
+-- __unique:__ @instance ToFunPtr (D -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_bb8d99987b90516d_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (D -> IO ())@
+hs_bindgen_bb8d99987b90516d :: (D -> IO ()) ->
+                               IO (FunPtr (D -> IO ()))
+-- __unique:__ @instance ToFunPtr (D -> IO ())@
+hs_bindgen_bb8d99987b90516d = \fun_0 -> fmap castFunPtr (hs_bindgen_bb8d99987b90516d_base (\x_1 -> fun_0 (fromFFIType x_1)))
+-- __unique:__ @instance FromFunPtr (D -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_8eef50c371b3a153_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (D -> IO ())@
+hs_bindgen_8eef50c371b3a153 :: FunPtr (D -> IO ()) -> D -> IO ()
+-- __unique:__ @instance FromFunPtr (D -> IO ())@
+hs_bindgen_8eef50c371b3a153 = \funPtr_0 -> \x_1 -> hs_bindgen_8eef50c371b3a153_base (castFunPtr funPtr_0) (toFFIType x_1)
+instance ToFunPtr (D -> IO ())
+    where toFunPtr = hs_bindgen_bb8d99987b90516d
+instance FromFunPtr (D -> IO ())
+    where fromFunPtr = hs_bindgen_8eef50c371b3a153
+-- __unique:__ @instance ToFunPtr (Foo -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_d2a71f330b782e41_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (Foo -> IO ())@
+hs_bindgen_d2a71f330b782e41 :: (Foo -> IO ()) ->
+                               IO (FunPtr (Foo -> IO ()))
+-- __unique:__ @instance ToFunPtr (Foo -> IO ())@
+hs_bindgen_d2a71f330b782e41 = \fun_0 -> fmap castFunPtr (hs_bindgen_d2a71f330b782e41_base (\x_1 -> fun_0 (fromFFIType x_1)))
+-- __unique:__ @instance FromFunPtr (Foo -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_c08440542d338bad_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (Foo -> IO ())@
+hs_bindgen_c08440542d338bad :: FunPtr (Foo -> IO ()) ->
+                               Foo -> IO ()
+-- __unique:__ @instance FromFunPtr (Foo -> IO ())@
+hs_bindgen_c08440542d338bad = \funPtr_0 -> \x_1 -> hs_bindgen_c08440542d338bad_base (castFunPtr funPtr_0) (toFFIType x_1)
+instance ToFunPtr (Foo -> IO ())
+    where toFunPtr = hs_bindgen_d2a71f330b782e41
+instance FromFunPtr (Foo -> IO ())
+    where fromFunPtr = hs_bindgen_c08440542d338bad
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+foreign import ccall safe "wrapper" hs_bindgen_4064610c89a52f99_base ::
+    Ptr Void -> IO CInt
+ -> IO (FunPtr (Ptr Void -> IO CInt))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+hs_bindgen_4064610c89a52f99 :: (Ptr Measurement -> IO CInt) ->
+                               IO (FunPtr (Ptr Measurement -> IO CInt))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+hs_bindgen_4064610c89a52f99 = \fun_0 -> fmap castFunPtr (hs_bindgen_4064610c89a52f99_base (\x_1 -> fmap toFFIType (fun_0 (fromFFIType x_1))))
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+foreign import ccall safe "dynamic" hs_bindgen_46b04bdda1fdaafc_base ::
+    FunPtr (Ptr Void -> IO CInt)
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+hs_bindgen_46b04bdda1fdaafc :: FunPtr (Ptr Measurement ->
+                                       IO CInt) ->
+                               Ptr Measurement -> IO CInt
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO BG.CInt)@
+hs_bindgen_46b04bdda1fdaafc = \funPtr_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_46b04bdda1fdaafc_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr (Ptr Measurement -> IO CInt)
+    where toFunPtr = hs_bindgen_4064610c89a52f99
+instance FromFunPtr (Ptr Measurement -> IO CInt)
+    where fromFunPtr = hs_bindgen_46b04bdda1fdaafc
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_0e70e3ef331da59c_base ::
+    Ptr Void -> IO ()
+ -> IO (FunPtr (Ptr Void -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO ())@
+hs_bindgen_0e70e3ef331da59c :: (Ptr Measurement -> IO ()) ->
+                               IO (FunPtr (Ptr Measurement -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> IO ())@
+hs_bindgen_0e70e3ef331da59c = \fun_0 -> fmap castFunPtr (hs_bindgen_0e70e3ef331da59c_base (\x_1 -> fun_0 (fromFFIType x_1)))
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_900e47c9e85104f3_base ::
+    FunPtr (Ptr Void -> IO ())
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO ())@
+hs_bindgen_900e47c9e85104f3 :: FunPtr (Ptr Measurement -> IO ()) ->
+                               Ptr Measurement -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> IO ())@
+hs_bindgen_900e47c9e85104f3 = \funPtr_0 -> \x_1 -> hs_bindgen_900e47c9e85104f3_base (castFunPtr funPtr_0) (toFFIType x_1)
+instance ToFunPtr (Ptr Measurement -> IO ())
+    where toFunPtr = hs_bindgen_0e70e3ef331da59c
+instance FromFunPtr (Ptr Measurement -> IO ())
+    where fromFunPtr = hs_bindgen_900e47c9e85104f3
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_ee5115ecd6cd3b7d_base ::
+    Ptr Void -> FunPtr Void -> IO ()
+ -> IO (FunPtr (Ptr Void -> FunPtr Void -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+hs_bindgen_ee5115ecd6cd3b7d :: (Ptr Measurement ->
+                                DataValidator -> IO ()) ->
+                               IO (FunPtr (Ptr Measurement -> DataValidator -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+hs_bindgen_ee5115ecd6cd3b7d = \fun_0 -> fmap castFunPtr (hs_bindgen_ee5115ecd6cd3b7d_base (\x_1 -> \x_2 -> fun_0 (fromFFIType x_1) (fromFFIType x_2)))
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_767024eb494db15e_base ::
+    FunPtr (Ptr Void -> FunPtr Void -> IO ())
+ -> Ptr Void
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+hs_bindgen_767024eb494db15e :: FunPtr (Ptr Measurement ->
+                                       DataValidator -> IO ()) ->
+                               Ptr Measurement -> DataValidator -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> IO ())@
+hs_bindgen_767024eb494db15e = \funPtr_0 -> \x_1 -> \x_2 -> hs_bindgen_767024eb494db15e_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)
+instance ToFunPtr (Ptr Measurement -> DataValidator -> IO ())
+    where toFunPtr = hs_bindgen_ee5115ecd6cd3b7d
+instance FromFunPtr (Ptr Measurement -> DataValidator -> IO ())
+    where fromFunPtr = hs_bindgen_767024eb494db15e
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_9c62e3e4c665b341_base ::
+    Ptr Void -> FunPtr Void -> CInt -> IO ()
+ -> IO (FunPtr (Ptr Void -> FunPtr Void -> CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+hs_bindgen_9c62e3e4c665b341 :: (Ptr Measurement ->
+                                DataValidator -> CInt -> IO ()) ->
+                               IO (FunPtr (Ptr Measurement -> DataValidator -> CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+hs_bindgen_9c62e3e4c665b341 = \fun_0 -> fmap castFunPtr (hs_bindgen_9c62e3e4c665b341_base (\x_1 -> \x_2 -> \x_3 -> fun_0 (fromFFIType x_1) (fromFFIType x_2) (fromFFIType x_3)))
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_be989dc6cfcbaa3c_base ::
+    FunPtr (Ptr Void -> FunPtr Void -> CInt -> IO ())
+ -> Ptr Void
+ -> FunPtr Void
+ -> CInt
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+hs_bindgen_be989dc6cfcbaa3c :: FunPtr (Ptr Measurement ->
+                                       DataValidator -> CInt -> IO ()) ->
+                               Ptr Measurement -> DataValidator -> CInt -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ())@
+hs_bindgen_be989dc6cfcbaa3c = \funPtr_0 -> \x_1 -> \x_2 -> \x_3 -> hs_bindgen_be989dc6cfcbaa3c_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3)
+instance ToFunPtr (Ptr Measurement ->
+                   DataValidator -> CInt -> IO ())
+    where toFunPtr = hs_bindgen_9c62e3e4c665b341
+instance FromFunPtr (Ptr Measurement ->
+                     DataValidator -> CInt -> IO ())
+    where fromFunPtr = hs_bindgen_be989dc6cfcbaa3c
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_cbc1799daa163d3d_base ::
+    Ptr Void -> FunPtr Void -> CInt -> IO ()
+ -> IO (FunPtr (Ptr Void -> FunPtr Void -> CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+hs_bindgen_cbc1799daa163d3d :: (Ptr Measurement ->
+                                FileOpenedNotification -> CInt -> IO ()) ->
+                               IO (FunPtr (Ptr Measurement ->
+                                           FileOpenedNotification -> CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+hs_bindgen_cbc1799daa163d3d = \fun_0 -> fmap castFunPtr (hs_bindgen_cbc1799daa163d3d_base (\x_1 -> \x_2 -> \x_3 -> fun_0 (fromFFIType x_1) (fromFFIType x_2) (fromFFIType x_3)))
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_b313881940dff0dc_base ::
+    FunPtr (Ptr Void -> FunPtr Void -> CInt -> IO ())
+ -> Ptr Void
+ -> FunPtr Void
+ -> CInt
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+hs_bindgen_b313881940dff0dc :: FunPtr (Ptr Measurement ->
+                                       FileOpenedNotification -> CInt -> IO ()) ->
+                               Ptr Measurement -> FileOpenedNotification -> CInt -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> FileOpenedNotification -> BG.CInt -> IO ())@
+hs_bindgen_b313881940dff0dc = \funPtr_0 -> \x_1 -> \x_2 -> \x_3 -> hs_bindgen_b313881940dff0dc_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3)
+instance ToFunPtr (Ptr Measurement ->
+                   FileOpenedNotification -> CInt -> IO ())
+    where toFunPtr = hs_bindgen_cbc1799daa163d3d
+instance FromFunPtr (Ptr Measurement ->
+                     FileOpenedNotification -> CInt -> IO ())
+    where fromFunPtr = hs_bindgen_b313881940dff0dc
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_7b1e0c518e5f0b1b_base ::
+    Ptr Void -> FunPtr Void -> IO ()
+ -> IO (FunPtr (Ptr Void -> FunPtr Void -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+hs_bindgen_7b1e0c518e5f0b1b :: (Ptr Measurement ->
+                                ProgressUpdate -> IO ()) ->
+                               IO (FunPtr (Ptr Measurement -> ProgressUpdate -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+hs_bindgen_7b1e0c518e5f0b1b = \fun_0 -> fmap castFunPtr (hs_bindgen_7b1e0c518e5f0b1b_base (\x_1 -> \x_2 -> fun_0 (fromFFIType x_1) (fromFFIType x_2)))
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_0a3b532434d7e43c_base ::
+    FunPtr (Ptr Void -> FunPtr Void -> IO ())
+ -> Ptr Void
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+hs_bindgen_0a3b532434d7e43c :: FunPtr (Ptr Measurement ->
+                                       ProgressUpdate -> IO ()) ->
+                               Ptr Measurement -> ProgressUpdate -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> ProgressUpdate -> IO ())@
+hs_bindgen_0a3b532434d7e43c = \funPtr_0 -> \x_1 -> \x_2 -> hs_bindgen_0a3b532434d7e43c_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)
+instance ToFunPtr (Ptr Measurement -> ProgressUpdate -> IO ())
+    where toFunPtr = hs_bindgen_7b1e0c518e5f0b1b
+instance FromFunPtr (Ptr Measurement -> ProgressUpdate -> IO ())
+    where fromFunPtr = hs_bindgen_0a3b532434d7e43c
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_ba073f1e0ec5008b_base ::
+    Ptr Void -> FunPtr Void -> CInt -> IO ()
+ -> IO (FunPtr (Ptr Void -> FunPtr Void -> CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+hs_bindgen_ba073f1e0ec5008b :: (Ptr Measurement ->
+                                FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ()) ->
+                               IO (FunPtr (Ptr Measurement ->
+                                           FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+hs_bindgen_ba073f1e0ec5008b = \fun_0 -> fmap castFunPtr (hs_bindgen_ba073f1e0ec5008b_base (\x_1 -> \x_2 -> \x_3 -> fun_0 (fromFFIType x_1) (fromFFIType x_2) (fromFFIType x_3)))
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_090d079ea979a39d_base ::
+    FunPtr (Ptr Void -> FunPtr Void -> CInt -> IO ())
+ -> Ptr Void
+ -> FunPtr Void
+ -> CInt
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+hs_bindgen_090d079ea979a39d :: FunPtr (Ptr Measurement ->
+                                       FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ()) ->
+                               Ptr Measurement ->
+                               FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.CDouble -> BG.CInt -> IO BG.CDouble) -> BG.CInt -> IO ())@
+hs_bindgen_090d079ea979a39d = \funPtr_0 -> \x_1 -> \x_2 -> \x_3 -> hs_bindgen_090d079ea979a39d_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3)
+instance ToFunPtr (Ptr Measurement ->
+                   FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ())
+    where toFunPtr = hs_bindgen_ba073f1e0ec5008b
+instance FromFunPtr (Ptr Measurement ->
+                     FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ())
+    where fromFunPtr = hs_bindgen_090d079ea979a39d
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_e1d08f76a35007c0_base ::
+    Ptr Void -> FunPtr Void -> FunPtr Void -> IO ()
+ -> IO (FunPtr (Ptr Void -> FunPtr Void -> FunPtr Void -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+hs_bindgen_e1d08f76a35007c0 :: (Ptr Measurement ->
+                                FunPtr (Ptr Measurement -> DataValidator -> CInt -> IO ()) ->
+                                DataValidator -> IO ()) ->
+                               IO (FunPtr (Ptr Measurement ->
+                                           FunPtr (Ptr Measurement ->
+                                                   DataValidator -> CInt -> IO ()) ->
+                                           DataValidator -> IO ()))
+-- __unique:__ @instance ToFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+hs_bindgen_e1d08f76a35007c0 = \fun_0 -> fmap castFunPtr (hs_bindgen_e1d08f76a35007c0_base (\x_1 -> \x_2 -> \x_3 -> fun_0 (fromFFIType x_1) (fromFFIType x_2) (fromFFIType x_3)))
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_74f2cb0fd2d13cc1_base ::
+    FunPtr (Ptr Void -> FunPtr Void -> FunPtr Void -> IO ())
+ -> Ptr Void
+ -> FunPtr Void
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+hs_bindgen_74f2cb0fd2d13cc1 :: FunPtr (Ptr Measurement ->
+                                       FunPtr (Ptr Measurement -> DataValidator -> CInt -> IO ()) ->
+                                       DataValidator -> IO ()) ->
+                               Ptr Measurement ->
+                               FunPtr (Ptr Measurement -> DataValidator -> CInt -> IO ()) ->
+                               DataValidator -> IO ()
+-- __unique:__ @instance FromFunPtr (BG.Ptr Measurement -> BG.FunPtr (BG.Ptr Measurement -> DataValidator -> BG.CInt -> IO ()) -> DataValidator -> IO ())@
+hs_bindgen_74f2cb0fd2d13cc1 = \funPtr_0 -> \x_1 -> \x_2 -> \x_3 -> hs_bindgen_74f2cb0fd2d13cc1_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3)
+instance ToFunPtr (Ptr Measurement ->
+                   FunPtr (Ptr Measurement -> DataValidator -> CInt -> IO ()) ->
+                   DataValidator -> IO ())
+    where toFunPtr = hs_bindgen_e1d08f76a35007c0
+instance FromFunPtr (Ptr Measurement ->
+                     FunPtr (Ptr Measurement -> DataValidator -> CInt -> IO ()) ->
+                     DataValidator -> IO ())
+    where fromFunPtr = hs_bindgen_74f2cb0fd2d13cc1
+-- __unique:__ @instance ToFunPtr (Foo2 -> IO ())@
+foreign import ccall safe "wrapper" hs_bindgen_235fa4a89af25f04_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @instance ToFunPtr (Foo2 -> IO ())@
+hs_bindgen_235fa4a89af25f04 :: (Foo2 -> IO ()) ->
+                               IO (FunPtr (Foo2 -> IO ()))
+-- __unique:__ @instance ToFunPtr (Foo2 -> IO ())@
+hs_bindgen_235fa4a89af25f04 = \fun_0 -> fmap castFunPtr (hs_bindgen_235fa4a89af25f04_base (\x_1 -> fun_0 (fromFFIType x_1)))
+-- __unique:__ @instance FromFunPtr (Foo2 -> IO ())@
+foreign import ccall safe "dynamic" hs_bindgen_8605b223a9ab9562_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @instance FromFunPtr (Foo2 -> IO ())@
+hs_bindgen_8605b223a9ab9562 :: FunPtr (Foo2 -> IO ()) ->
+                               Foo2 -> IO ()
+-- __unique:__ @instance FromFunPtr (Foo2 -> IO ())@
+hs_bindgen_8605b223a9ab9562 = \funPtr_0 -> \x_1 -> hs_bindgen_8605b223a9ab9562_base (castFunPtr funPtr_0) (toFFIType x_1)
+instance ToFunPtr (Foo2 -> IO ())
+    where toFunPtr = hs_bindgen_235fa4a89af25f04
+instance FromFunPtr (Foo2 -> IO ())
+    where fromFunPtr = hs_bindgen_8605b223a9ab9562
+-- __unique:__ @test_functionscallbacks_Example_Safe_readFileWithProcessor@
+foreign import ccall safe "hs_bindgen_99bda9cd8097b0ea" hs_bindgen_99bda9cd8097b0ea_base ::
+    FunPtr Void
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_functionscallbacks_Example_Safe_readFileWithProcessor@
+hs_bindgen_99bda9cd8097b0ea :: FunPtr (CInt -> IO ()) ->
+                               CInt -> IO CInt
+-- __unique:__ @test_functionscallbacks_Example_Safe_readFileWithProcessor@
+hs_bindgen_99bda9cd8097b0ea = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_99bda9cd8097b0ea_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @readFileWithProcessor@
+
+    __defined at:__ @functions\/callbacks.h 4:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+readFileWithProcessor_safe :: FunPtr (CInt -> IO ()) ->
+                              CInt -> IO CInt
+{-| __C declaration:__ @readFileWithProcessor@
+
+    __defined at:__ @functions\/callbacks.h 4:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+readFileWithProcessor_safe = hs_bindgen_99bda9cd8097b0ea
+-- __unique:__ @test_functionscallbacks_Example_Safe_watchTemperature@
+foreign import ccall safe "hs_bindgen_84b75366c836fc85" hs_bindgen_84b75366c836fc85_base ::
+    FunPtr Void
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_watchTemperature@
+hs_bindgen_84b75366c836fc85 :: FunPtr (CInt -> IO ()) ->
+                               CInt -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_watchTemperature@
+hs_bindgen_84b75366c836fc85 = \x_0 -> \x_1 -> hs_bindgen_84b75366c836fc85_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @watchTemperature@
+
+    __defined at:__ @functions\/callbacks.h 5:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+watchTemperature_safe :: FunPtr (CInt -> IO ()) -> CInt -> IO ()
+{-| __C declaration:__ @watchTemperature@
+
+    __defined at:__ @functions\/callbacks.h 5:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+watchTemperature_safe = hs_bindgen_84b75366c836fc85
+-- __unique:__ @test_functionscallbacks_Example_Safe_onFileOpened@
+foreign import ccall safe "hs_bindgen_f2580f574faa3697" hs_bindgen_f2580f574faa3697_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onFileOpened@
+hs_bindgen_f2580f574faa3697 :: FileOpenedNotification -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onFileOpened@
+hs_bindgen_f2580f574faa3697 = \x_0 -> hs_bindgen_f2580f574faa3697_base (toFFIType x_0)
+{-| __C declaration:__ @onFileOpened@
+
+    __defined at:__ @functions\/callbacks.h 14:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onFileOpened_safe :: FileOpenedNotification -> IO ()
+{-| __C declaration:__ @onFileOpened@
+
+    __defined at:__ @functions\/callbacks.h 14:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onFileOpened_safe = hs_bindgen_f2580f574faa3697
+-- __unique:__ @test_functionscallbacks_Example_Safe_onProgressChanged@
+foreign import ccall safe "hs_bindgen_654057b291ee37ea" hs_bindgen_654057b291ee37ea_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onProgressChanged@
+hs_bindgen_654057b291ee37ea :: ProgressUpdate -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onProgressChanged@
+hs_bindgen_654057b291ee37ea = \x_0 -> hs_bindgen_654057b291ee37ea_base (toFFIType x_0)
+{-| __C declaration:__ @onProgressChanged@
+
+    __defined at:__ @functions\/callbacks.h 15:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onProgressChanged_safe :: ProgressUpdate -> IO ()
+{-| __C declaration:__ @onProgressChanged@
+
+    __defined at:__ @functions\/callbacks.h 15:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onProgressChanged_safe = hs_bindgen_654057b291ee37ea
+-- __unique:__ @test_functionscallbacks_Example_Safe_validateInput@
+foreign import ccall safe "hs_bindgen_5df7aac6996be10f" hs_bindgen_5df7aac6996be10f_base ::
+    FunPtr Void
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_functionscallbacks_Example_Safe_validateInput@
+hs_bindgen_5df7aac6996be10f :: DataValidator -> CInt -> IO CInt
+-- __unique:__ @test_functionscallbacks_Example_Safe_validateInput@
+hs_bindgen_5df7aac6996be10f = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_5df7aac6996be10f_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @validateInput@
+
+    __defined at:__ @functions\/callbacks.h 16:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+validateInput_safe :: DataValidator -> CInt -> IO CInt
+{-| __C declaration:__ @validateInput@
+
+    __defined at:__ @functions\/callbacks.h 16:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+validateInput_safe = hs_bindgen_5df7aac6996be10f
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement@
+foreign import ccall safe "hs_bindgen_8f1bb1c4d2b5355f" hs_bindgen_8f1bb1c4d2b5355f_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement@
+hs_bindgen_8f1bb1c4d2b5355f :: MeasurementReceived -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement@
+hs_bindgen_8f1bb1c4d2b5355f = \x_0 -> hs_bindgen_8f1bb1c4d2b5355f_base (toFFIType x_0)
+{-| __C declaration:__ @onNewMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 27:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement_safe :: MeasurementReceived -> IO ()
+{-| __C declaration:__ @onNewMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 27:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement_safe = hs_bindgen_8f1bb1c4d2b5355f
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement2@
+foreign import ccall safe "hs_bindgen_d805e39c6cbdd620" hs_bindgen_d805e39c6cbdd620_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement2@
+hs_bindgen_d805e39c6cbdd620 :: MeasurementReceived2 -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onNewMeasurement2@
+hs_bindgen_d805e39c6cbdd620 = \x_0 -> hs_bindgen_d805e39c6cbdd620_base (toFFIType x_0)
+{-| __C declaration:__ @onNewMeasurement2@
+
+    __defined at:__ @functions\/callbacks.h 30:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement2_safe :: MeasurementReceived2 -> IO ()
+{-| __C declaration:__ @onNewMeasurement2@
+
+    __defined at:__ @functions\/callbacks.h 30:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement2_safe = hs_bindgen_d805e39c6cbdd620
+-- __unique:__ @test_functionscallbacks_Example_Safe_onBufferReady@
+foreign import ccall safe "hs_bindgen_8d803591bcf10ba5" hs_bindgen_8d803591bcf10ba5_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onBufferReady@
+hs_bindgen_8d803591bcf10ba5 :: SampleBufferFull -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_onBufferReady@
+hs_bindgen_8d803591bcf10ba5 = \x_0 -> hs_bindgen_8d803591bcf10ba5_base (toFFIType x_0)
+{-| __C declaration:__ @onBufferReady@
+
+    __defined at:__ @functions\/callbacks.h 33:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onBufferReady_safe :: SampleBufferFull -> IO ()
+{-| __C declaration:__ @onBufferReady@
+
+    __defined at:__ @functions\/callbacks.h 33:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onBufferReady_safe = hs_bindgen_8d803591bcf10ba5
+-- __unique:__ @test_functionscallbacks_Example_Safe_transformMeasurement@
+foreign import ccall safe "hs_bindgen_16c298a15b737eb2" hs_bindgen_16c298a15b737eb2_base ::
+    Ptr Void
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_transformMeasurement@
+hs_bindgen_16c298a15b737eb2 :: Ptr Measurement ->
+                               FunPtr (Ptr Measurement ->
+                                       FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ()) ->
+                               IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_transformMeasurement@
+hs_bindgen_16c298a15b737eb2 = \x_0 -> \x_1 -> hs_bindgen_16c298a15b737eb2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @transformMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 38:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+transformMeasurement_safe :: Ptr Measurement ->
+                             FunPtr (Ptr Measurement ->
+                                     FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ()) ->
+                             IO ()
+{-| __C declaration:__ @transformMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 38:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+transformMeasurement_safe = hs_bindgen_16c298a15b737eb2
+-- __unique:__ @test_functionscallbacks_Example_Safe_processWithCallbacks@
+foreign import ccall safe "hs_bindgen_e6a073138e56764f" hs_bindgen_e6a073138e56764f_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_processWithCallbacks@
+hs_bindgen_e6a073138e56764f :: FunPtr (Ptr Measurement ->
+                                       FileOpenedNotification -> CInt -> IO ()) ->
+                               IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_processWithCallbacks@
+hs_bindgen_e6a073138e56764f = \x_0 -> hs_bindgen_e6a073138e56764f_base (toFFIType x_0)
+{-| __C declaration:__ @processWithCallbacks@
+
+    __defined at:__ @functions\/callbacks.h 43:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processWithCallbacks_safe :: FunPtr (Ptr Measurement ->
+                                     FileOpenedNotification -> CInt -> IO ()) ->
+                             IO ()
+{-| __C declaration:__ @processWithCallbacks@
+
+    __defined at:__ @functions\/callbacks.h 43:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processWithCallbacks_safe = hs_bindgen_e6a073138e56764f
+-- __unique:__ @test_functionscallbacks_Example_Safe_registerHandler@
+foreign import ccall safe "hs_bindgen_ece0d4f94c2319f0" hs_bindgen_ece0d4f94c2319f0_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_registerHandler@
+hs_bindgen_ece0d4f94c2319f0 :: Ptr MeasurementHandler -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_registerHandler@
+hs_bindgen_ece0d4f94c2319f0 = \x_0 -> hs_bindgen_ece0d4f94c2319f0_base (toFFIType x_0)
+{-| __C declaration:__ @registerHandler@
+
+    __defined at:__ @functions\/callbacks.h 56:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+registerHandler_safe :: Ptr MeasurementHandler -> IO ()
+{-| __C declaration:__ @registerHandler@
+
+    __defined at:__ @functions\/callbacks.h 56:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+registerHandler_safe = hs_bindgen_ece0d4f94c2319f0
+-- __unique:__ @test_functionscallbacks_Example_Safe_executePipeline@
+foreign import ccall safe "hs_bindgen_d66d7470a7a213b0" hs_bindgen_d66d7470a7a213b0_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_executePipeline@
+hs_bindgen_d66d7470a7a213b0 :: Ptr Measurement ->
+                               Ptr DataPipeline -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_executePipeline@
+hs_bindgen_d66d7470a7a213b0 = \x_0 -> \x_1 -> hs_bindgen_d66d7470a7a213b0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @executePipeline@
+
+    __defined at:__ @functions\/callbacks.h 64:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+executePipeline_safe :: Ptr Measurement ->
+                        Ptr DataPipeline -> IO ()
+{-| __C declaration:__ @executePipeline@
+
+    __defined at:__ @functions\/callbacks.h 64:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+executePipeline_safe = hs_bindgen_d66d7470a7a213b0
+-- __unique:__ @test_functionscallbacks_Example_Safe_runProcessor@
+foreign import ccall safe "hs_bindgen_e925d3ce6e5fb395" hs_bindgen_e925d3ce6e5fb395_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_runProcessor@
+hs_bindgen_e925d3ce6e5fb395 :: Ptr Measurement ->
+                               Ptr Processor -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_runProcessor@
+hs_bindgen_e925d3ce6e5fb395 = \x_0 -> \x_1 -> hs_bindgen_e925d3ce6e5fb395_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @runProcessor@
+
+    __defined at:__ @functions\/callbacks.h 80:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+runProcessor_safe :: Ptr Measurement -> Ptr Processor -> IO ()
+{-| __C declaration:__ @runProcessor@
+
+    __defined at:__ @functions\/callbacks.h 80:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+runProcessor_safe = hs_bindgen_e925d3ce6e5fb395
+-- __unique:__ @test_functionscallbacks_Example_Safe_processMeasurementWithValidation@
+foreign import ccall safe "hs_bindgen_1e432e1595a1ef55" hs_bindgen_1e432e1595a1ef55_base ::
+    Ptr Void
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_processMeasurementWithValidation@
+hs_bindgen_1e432e1595a1ef55 :: Ptr Measurement ->
+                               FunPtr (Ptr Measurement ->
+                                       FunPtr (Ptr Measurement -> DataValidator -> CInt -> IO ()) ->
+                                       DataValidator -> IO ()) ->
+                               IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_processMeasurementWithValidation@
+hs_bindgen_1e432e1595a1ef55 = \x_0 -> \x_1 -> hs_bindgen_1e432e1595a1ef55_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @processMeasurementWithValidation@
+
+    __defined at:__ @functions\/callbacks.h 85:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processMeasurementWithValidation_safe :: Ptr Measurement ->
+                                         FunPtr (Ptr Measurement ->
+                                                 FunPtr (Ptr Measurement ->
+                                                         DataValidator -> CInt -> IO ()) ->
+                                                 DataValidator -> IO ()) ->
+                                         IO ()
+{-| __C declaration:__ @processMeasurementWithValidation@
+
+    __defined at:__ @functions\/callbacks.h 85:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processMeasurementWithValidation_safe = hs_bindgen_1e432e1595a1ef55
+-- __unique:__ @test_functionscallbacks_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_d5cd030edf2e0364" hs_bindgen_d5cd030edf2e0364_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_f@
+hs_bindgen_d5cd030edf2e0364 :: FunPtr (Foo -> IO ()) -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_f@
+hs_bindgen_d5cd030edf2e0364 = \x_0 -> hs_bindgen_d5cd030edf2e0364_base (toFFIType x_0)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/callbacks.h 96:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f_safe :: FunPtr (Foo -> IO ()) -> IO ()
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/callbacks.h 96:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f_safe = hs_bindgen_d5cd030edf2e0364
+-- __unique:__ @test_functionscallbacks_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_a10eec74074627ba" hs_bindgen_a10eec74074627ba_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_f2@
+hs_bindgen_a10eec74074627ba :: FunPtr (Foo2 -> IO ()) -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Safe_f2@
+hs_bindgen_a10eec74074627ba = \x_0 -> hs_bindgen_a10eec74074627ba_base (toFFIType x_0)
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/callbacks.h 97:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f2_safe :: FunPtr (Foo2 -> IO ()) -> IO ()
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/callbacks.h 97:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f2_safe = hs_bindgen_a10eec74074627ba
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_readFileWithProcessor@
+foreign import ccall unsafe "hs_bindgen_d07f3a3e526e7017" hs_bindgen_d07f3a3e526e7017_base ::
+    FunPtr Void
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_readFileWithProcessor@
+hs_bindgen_d07f3a3e526e7017 :: FunPtr (CInt -> IO ()) ->
+                               CInt -> IO CInt
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_readFileWithProcessor@
+hs_bindgen_d07f3a3e526e7017 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_d07f3a3e526e7017_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @readFileWithProcessor@
+
+    __defined at:__ @functions\/callbacks.h 4:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+readFileWithProcessor_unsafe :: FunPtr (CInt -> IO ()) ->
+                                CInt -> IO CInt
+{-| __C declaration:__ @readFileWithProcessor@
+
+    __defined at:__ @functions\/callbacks.h 4:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+readFileWithProcessor_unsafe = hs_bindgen_d07f3a3e526e7017
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_watchTemperature@
+foreign import ccall unsafe "hs_bindgen_cb0219aedd5afed5" hs_bindgen_cb0219aedd5afed5_base ::
+    FunPtr Void
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_watchTemperature@
+hs_bindgen_cb0219aedd5afed5 :: FunPtr (CInt -> IO ()) ->
+                               CInt -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_watchTemperature@
+hs_bindgen_cb0219aedd5afed5 = \x_0 -> \x_1 -> hs_bindgen_cb0219aedd5afed5_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @watchTemperature@
+
+    __defined at:__ @functions\/callbacks.h 5:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+watchTemperature_unsafe :: FunPtr (CInt -> IO ()) -> CInt -> IO ()
+{-| __C declaration:__ @watchTemperature@
+
+    __defined at:__ @functions\/callbacks.h 5:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+watchTemperature_unsafe = hs_bindgen_cb0219aedd5afed5
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onFileOpened@
+foreign import ccall unsafe "hs_bindgen_d96938841a039f9b" hs_bindgen_d96938841a039f9b_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onFileOpened@
+hs_bindgen_d96938841a039f9b :: FileOpenedNotification -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onFileOpened@
+hs_bindgen_d96938841a039f9b = \x_0 -> hs_bindgen_d96938841a039f9b_base (toFFIType x_0)
+{-| __C declaration:__ @onFileOpened@
+
+    __defined at:__ @functions\/callbacks.h 14:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onFileOpened_unsafe :: FileOpenedNotification -> IO ()
+{-| __C declaration:__ @onFileOpened@
+
+    __defined at:__ @functions\/callbacks.h 14:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onFileOpened_unsafe = hs_bindgen_d96938841a039f9b
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onProgressChanged@
+foreign import ccall unsafe "hs_bindgen_3cb24888fc3e1751" hs_bindgen_3cb24888fc3e1751_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onProgressChanged@
+hs_bindgen_3cb24888fc3e1751 :: ProgressUpdate -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onProgressChanged@
+hs_bindgen_3cb24888fc3e1751 = \x_0 -> hs_bindgen_3cb24888fc3e1751_base (toFFIType x_0)
+{-| __C declaration:__ @onProgressChanged@
+
+    __defined at:__ @functions\/callbacks.h 15:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onProgressChanged_unsafe :: ProgressUpdate -> IO ()
+{-| __C declaration:__ @onProgressChanged@
+
+    __defined at:__ @functions\/callbacks.h 15:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onProgressChanged_unsafe = hs_bindgen_3cb24888fc3e1751
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_validateInput@
+foreign import ccall unsafe "hs_bindgen_567ea6dc040b50a1" hs_bindgen_567ea6dc040b50a1_base ::
+    FunPtr Void
+ -> CInt
+ -> IO CInt
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_validateInput@
+hs_bindgen_567ea6dc040b50a1 :: DataValidator -> CInt -> IO CInt
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_validateInput@
+hs_bindgen_567ea6dc040b50a1 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_567ea6dc040b50a1_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @validateInput@
+
+    __defined at:__ @functions\/callbacks.h 16:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+validateInput_unsafe :: DataValidator -> CInt -> IO CInt
+{-| __C declaration:__ @validateInput@
+
+    __defined at:__ @functions\/callbacks.h 16:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+validateInput_unsafe = hs_bindgen_567ea6dc040b50a1
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement@
+foreign import ccall unsafe "hs_bindgen_aab80c08edfa6b4b" hs_bindgen_aab80c08edfa6b4b_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement@
+hs_bindgen_aab80c08edfa6b4b :: MeasurementReceived -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement@
+hs_bindgen_aab80c08edfa6b4b = \x_0 -> hs_bindgen_aab80c08edfa6b4b_base (toFFIType x_0)
+{-| __C declaration:__ @onNewMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 27:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement_unsafe :: MeasurementReceived -> IO ()
+{-| __C declaration:__ @onNewMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 27:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement_unsafe = hs_bindgen_aab80c08edfa6b4b
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement2@
+foreign import ccall unsafe "hs_bindgen_6c8fae51df7c46a1" hs_bindgen_6c8fae51df7c46a1_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement2@
+hs_bindgen_6c8fae51df7c46a1 :: MeasurementReceived2 -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onNewMeasurement2@
+hs_bindgen_6c8fae51df7c46a1 = \x_0 -> hs_bindgen_6c8fae51df7c46a1_base (toFFIType x_0)
+{-| __C declaration:__ @onNewMeasurement2@
+
+    __defined at:__ @functions\/callbacks.h 30:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement2_unsafe :: MeasurementReceived2 -> IO ()
+{-| __C declaration:__ @onNewMeasurement2@
+
+    __defined at:__ @functions\/callbacks.h 30:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement2_unsafe = hs_bindgen_6c8fae51df7c46a1
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onBufferReady@
+foreign import ccall unsafe "hs_bindgen_d44afeb36d2ae523" hs_bindgen_d44afeb36d2ae523_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onBufferReady@
+hs_bindgen_d44afeb36d2ae523 :: SampleBufferFull -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_onBufferReady@
+hs_bindgen_d44afeb36d2ae523 = \x_0 -> hs_bindgen_d44afeb36d2ae523_base (toFFIType x_0)
+{-| __C declaration:__ @onBufferReady@
+
+    __defined at:__ @functions\/callbacks.h 33:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onBufferReady_unsafe :: SampleBufferFull -> IO ()
+{-| __C declaration:__ @onBufferReady@
+
+    __defined at:__ @functions\/callbacks.h 33:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onBufferReady_unsafe = hs_bindgen_d44afeb36d2ae523
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_transformMeasurement@
+foreign import ccall unsafe "hs_bindgen_523fee13fb646cad" hs_bindgen_523fee13fb646cad_base ::
+    Ptr Void
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_transformMeasurement@
+hs_bindgen_523fee13fb646cad :: Ptr Measurement ->
+                               FunPtr (Ptr Measurement ->
+                                       FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ()) ->
+                               IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_transformMeasurement@
+hs_bindgen_523fee13fb646cad = \x_0 -> \x_1 -> hs_bindgen_523fee13fb646cad_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @transformMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 38:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+transformMeasurement_unsafe :: Ptr Measurement ->
+                               FunPtr (Ptr Measurement ->
+                                       FunPtr (CDouble -> CInt -> IO CDouble) -> CInt -> IO ()) ->
+                               IO ()
+{-| __C declaration:__ @transformMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 38:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+transformMeasurement_unsafe = hs_bindgen_523fee13fb646cad
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processWithCallbacks@
+foreign import ccall unsafe "hs_bindgen_98d0c5bd1271eeb7" hs_bindgen_98d0c5bd1271eeb7_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processWithCallbacks@
+hs_bindgen_98d0c5bd1271eeb7 :: FunPtr (Ptr Measurement ->
+                                       FileOpenedNotification -> CInt -> IO ()) ->
+                               IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processWithCallbacks@
+hs_bindgen_98d0c5bd1271eeb7 = \x_0 -> hs_bindgen_98d0c5bd1271eeb7_base (toFFIType x_0)
+{-| __C declaration:__ @processWithCallbacks@
+
+    __defined at:__ @functions\/callbacks.h 43:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processWithCallbacks_unsafe :: FunPtr (Ptr Measurement ->
+                                       FileOpenedNotification -> CInt -> IO ()) ->
+                               IO ()
+{-| __C declaration:__ @processWithCallbacks@
+
+    __defined at:__ @functions\/callbacks.h 43:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processWithCallbacks_unsafe = hs_bindgen_98d0c5bd1271eeb7
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_registerHandler@
+foreign import ccall unsafe "hs_bindgen_b96f4d4d7893e301" hs_bindgen_b96f4d4d7893e301_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_registerHandler@
+hs_bindgen_b96f4d4d7893e301 :: Ptr MeasurementHandler -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_registerHandler@
+hs_bindgen_b96f4d4d7893e301 = \x_0 -> hs_bindgen_b96f4d4d7893e301_base (toFFIType x_0)
+{-| __C declaration:__ @registerHandler@
+
+    __defined at:__ @functions\/callbacks.h 56:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+registerHandler_unsafe :: Ptr MeasurementHandler -> IO ()
+{-| __C declaration:__ @registerHandler@
+
+    __defined at:__ @functions\/callbacks.h 56:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+registerHandler_unsafe = hs_bindgen_b96f4d4d7893e301
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_executePipeline@
+foreign import ccall unsafe "hs_bindgen_c062ded603732aae" hs_bindgen_c062ded603732aae_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_executePipeline@
+hs_bindgen_c062ded603732aae :: Ptr Measurement ->
+                               Ptr DataPipeline -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_executePipeline@
+hs_bindgen_c062ded603732aae = \x_0 -> \x_1 -> hs_bindgen_c062ded603732aae_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @executePipeline@
+
+    __defined at:__ @functions\/callbacks.h 64:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+executePipeline_unsafe :: Ptr Measurement ->
+                          Ptr DataPipeline -> IO ()
+{-| __C declaration:__ @executePipeline@
+
+    __defined at:__ @functions\/callbacks.h 64:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+executePipeline_unsafe = hs_bindgen_c062ded603732aae
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_runProcessor@
+foreign import ccall unsafe "hs_bindgen_02d41a1f48eebff7" hs_bindgen_02d41a1f48eebff7_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_runProcessor@
+hs_bindgen_02d41a1f48eebff7 :: Ptr Measurement ->
+                               Ptr Processor -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_runProcessor@
+hs_bindgen_02d41a1f48eebff7 = \x_0 -> \x_1 -> hs_bindgen_02d41a1f48eebff7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @runProcessor@
+
+    __defined at:__ @functions\/callbacks.h 80:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+runProcessor_unsafe :: Ptr Measurement -> Ptr Processor -> IO ()
+{-| __C declaration:__ @runProcessor@
+
+    __defined at:__ @functions\/callbacks.h 80:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+runProcessor_unsafe = hs_bindgen_02d41a1f48eebff7
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processMeasurementWithValidation@
+foreign import ccall unsafe "hs_bindgen_39704c8b14c2ce3c" hs_bindgen_39704c8b14c2ce3c_base ::
+    Ptr Void
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processMeasurementWithValidation@
+hs_bindgen_39704c8b14c2ce3c :: Ptr Measurement ->
+                               FunPtr (Ptr Measurement ->
+                                       FunPtr (Ptr Measurement -> DataValidator -> CInt -> IO ()) ->
+                                       DataValidator -> IO ()) ->
+                               IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_processMeasurementWithValidation@
+hs_bindgen_39704c8b14c2ce3c = \x_0 -> \x_1 -> hs_bindgen_39704c8b14c2ce3c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @processMeasurementWithValidation@
+
+    __defined at:__ @functions\/callbacks.h 85:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processMeasurementWithValidation_unsafe :: Ptr Measurement ->
+                                           FunPtr (Ptr Measurement ->
+                                                   FunPtr (Ptr Measurement ->
+                                                           DataValidator -> CInt -> IO ()) ->
+                                                   DataValidator -> IO ()) ->
+                                           IO ()
+{-| __C declaration:__ @processMeasurementWithValidation@
+
+    __defined at:__ @functions\/callbacks.h 85:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processMeasurementWithValidation_unsafe = hs_bindgen_39704c8b14c2ce3c
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_10c383cdf6eddb0d" hs_bindgen_10c383cdf6eddb0d_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f@
+hs_bindgen_10c383cdf6eddb0d :: FunPtr (Foo -> IO ()) -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f@
+hs_bindgen_10c383cdf6eddb0d = \x_0 -> hs_bindgen_10c383cdf6eddb0d_base (toFFIType x_0)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/callbacks.h 96:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f_unsafe :: FunPtr (Foo -> IO ()) -> IO ()
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/callbacks.h 96:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f_unsafe = hs_bindgen_10c383cdf6eddb0d
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_831d03bed0065a4e" hs_bindgen_831d03bed0065a4e_base ::
+    FunPtr Void
+ -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f2@
+hs_bindgen_831d03bed0065a4e :: FunPtr (Foo2 -> IO ()) -> IO ()
+-- __unique:__ @test_functionscallbacks_Example_Unsafe_f2@
+hs_bindgen_831d03bed0065a4e = \x_0 -> hs_bindgen_831d03bed0065a4e_base (toFFIType x_0)
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/callbacks.h 97:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f2_unsafe :: FunPtr (Foo2 -> IO ()) -> IO ()
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/callbacks.h 97:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f2_unsafe = hs_bindgen_831d03bed0065a4e
+-- __unique:__ @test_functionscallbacks_Example_get_readFileWithProcessor@
+foreign import ccall unsafe "hs_bindgen_793b9ca86a272b6a" hs_bindgen_793b9ca86a272b6a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_readFileWithProcessor@
+hs_bindgen_793b9ca86a272b6a :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO ()) ->
+                                           CInt -> IO CInt))
+-- __unique:__ @test_functionscallbacks_Example_get_readFileWithProcessor@
+hs_bindgen_793b9ca86a272b6a = fmap fromFFIType hs_bindgen_793b9ca86a272b6a_base
+{-# NOINLINE readFileWithProcessor_funptr #-}
+{-| __C declaration:__ @readFileWithProcessor@
+
+    __defined at:__ @functions\/callbacks.h 4:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+readFileWithProcessor_funptr :: FunPtr (FunPtr (CInt -> IO ()) ->
+                                        CInt -> IO CInt)
+{-| __C declaration:__ @readFileWithProcessor@
+
+    __defined at:__ @functions\/callbacks.h 4:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+readFileWithProcessor_funptr = unsafePerformIO hs_bindgen_793b9ca86a272b6a
+-- __unique:__ @test_functionscallbacks_Example_get_watchTemperature@
+foreign import ccall unsafe "hs_bindgen_a2b606291df27114" hs_bindgen_a2b606291df27114_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_watchTemperature@
+hs_bindgen_a2b606291df27114 :: IO (FunPtr (FunPtr (CInt ->
+                                                   IO ()) ->
+                                           CInt -> IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_watchTemperature@
+hs_bindgen_a2b606291df27114 = fmap fromFFIType hs_bindgen_a2b606291df27114_base
+{-# NOINLINE watchTemperature_funptr #-}
+{-| __C declaration:__ @watchTemperature@
+
+    __defined at:__ @functions\/callbacks.h 5:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+watchTemperature_funptr :: FunPtr (FunPtr (CInt -> IO ()) ->
+                                   CInt -> IO ())
+{-| __C declaration:__ @watchTemperature@
+
+    __defined at:__ @functions\/callbacks.h 5:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+watchTemperature_funptr = unsafePerformIO hs_bindgen_a2b606291df27114
+-- __unique:__ @test_functionscallbacks_Example_get_onFileOpened@
+foreign import ccall unsafe "hs_bindgen_2c00a09a05e4c87b" hs_bindgen_2c00a09a05e4c87b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_onFileOpened@
+hs_bindgen_2c00a09a05e4c87b :: IO (FunPtr (FileOpenedNotification ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_onFileOpened@
+hs_bindgen_2c00a09a05e4c87b = fmap fromFFIType hs_bindgen_2c00a09a05e4c87b_base
+{-# NOINLINE onFileOpened_funptr #-}
+{-| __C declaration:__ @onFileOpened@
+
+    __defined at:__ @functions\/callbacks.h 14:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onFileOpened_funptr :: FunPtr (FileOpenedNotification -> IO ())
+{-| __C declaration:__ @onFileOpened@
+
+    __defined at:__ @functions\/callbacks.h 14:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onFileOpened_funptr = unsafePerformIO hs_bindgen_2c00a09a05e4c87b
+-- __unique:__ @test_functionscallbacks_Example_get_onProgressChanged@
+foreign import ccall unsafe "hs_bindgen_84066778519d3ea8" hs_bindgen_84066778519d3ea8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_onProgressChanged@
+hs_bindgen_84066778519d3ea8 :: IO (FunPtr (ProgressUpdate ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_onProgressChanged@
+hs_bindgen_84066778519d3ea8 = fmap fromFFIType hs_bindgen_84066778519d3ea8_base
+{-# NOINLINE onProgressChanged_funptr #-}
+{-| __C declaration:__ @onProgressChanged@
+
+    __defined at:__ @functions\/callbacks.h 15:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onProgressChanged_funptr :: FunPtr (ProgressUpdate -> IO ())
+{-| __C declaration:__ @onProgressChanged@
+
+    __defined at:__ @functions\/callbacks.h 15:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onProgressChanged_funptr = unsafePerformIO hs_bindgen_84066778519d3ea8
+-- __unique:__ @test_functionscallbacks_Example_get_validateInput@
+foreign import ccall unsafe "hs_bindgen_4d522e3ec1eb0b9f" hs_bindgen_4d522e3ec1eb0b9f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_validateInput@
+hs_bindgen_4d522e3ec1eb0b9f :: IO (FunPtr (DataValidator ->
+                                           CInt -> IO CInt))
+-- __unique:__ @test_functionscallbacks_Example_get_validateInput@
+hs_bindgen_4d522e3ec1eb0b9f = fmap fromFFIType hs_bindgen_4d522e3ec1eb0b9f_base
+{-# NOINLINE validateInput_funptr #-}
+{-| __C declaration:__ @validateInput@
+
+    __defined at:__ @functions\/callbacks.h 16:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+validateInput_funptr :: FunPtr (DataValidator -> CInt -> IO CInt)
+{-| __C declaration:__ @validateInput@
+
+    __defined at:__ @functions\/callbacks.h 16:5@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+validateInput_funptr = unsafePerformIO hs_bindgen_4d522e3ec1eb0b9f
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement@
+foreign import ccall unsafe "hs_bindgen_a26d6914af82ade0" hs_bindgen_a26d6914af82ade0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement@
+hs_bindgen_a26d6914af82ade0 :: IO (FunPtr (MeasurementReceived ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement@
+hs_bindgen_a26d6914af82ade0 = fmap fromFFIType hs_bindgen_a26d6914af82ade0_base
+{-# NOINLINE onNewMeasurement_funptr #-}
+{-| __C declaration:__ @onNewMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 27:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement_funptr :: FunPtr (MeasurementReceived -> IO ())
+{-| __C declaration:__ @onNewMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 27:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement_funptr = unsafePerformIO hs_bindgen_a26d6914af82ade0
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement2@
+foreign import ccall unsafe "hs_bindgen_2c377b597bd80e50" hs_bindgen_2c377b597bd80e50_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement2@
+hs_bindgen_2c377b597bd80e50 :: IO (FunPtr (MeasurementReceived2 ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_onNewMeasurement2@
+hs_bindgen_2c377b597bd80e50 = fmap fromFFIType hs_bindgen_2c377b597bd80e50_base
+{-# NOINLINE onNewMeasurement2_funptr #-}
+{-| __C declaration:__ @onNewMeasurement2@
+
+    __defined at:__ @functions\/callbacks.h 30:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement2_funptr :: FunPtr (MeasurementReceived2 -> IO ())
+{-| __C declaration:__ @onNewMeasurement2@
+
+    __defined at:__ @functions\/callbacks.h 30:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onNewMeasurement2_funptr = unsafePerformIO hs_bindgen_2c377b597bd80e50
+-- __unique:__ @test_functionscallbacks_Example_get_onBufferReady@
+foreign import ccall unsafe "hs_bindgen_d1ce142d0c667e22" hs_bindgen_d1ce142d0c667e22_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_onBufferReady@
+hs_bindgen_d1ce142d0c667e22 :: IO (FunPtr (SampleBufferFull ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_onBufferReady@
+hs_bindgen_d1ce142d0c667e22 = fmap fromFFIType hs_bindgen_d1ce142d0c667e22_base
+{-# NOINLINE onBufferReady_funptr #-}
+{-| __C declaration:__ @onBufferReady@
+
+    __defined at:__ @functions\/callbacks.h 33:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onBufferReady_funptr :: FunPtr (SampleBufferFull -> IO ())
+{-| __C declaration:__ @onBufferReady@
+
+    __defined at:__ @functions\/callbacks.h 33:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+onBufferReady_funptr = unsafePerformIO hs_bindgen_d1ce142d0c667e22
+-- __unique:__ @test_functionscallbacks_Example_get_transformMeasurement@
+foreign import ccall unsafe "hs_bindgen_2e8d6b201521b14a" hs_bindgen_2e8d6b201521b14a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_transformMeasurement@
+hs_bindgen_2e8d6b201521b14a :: IO (FunPtr (Ptr Measurement ->
+                                           FunPtr (Ptr Measurement ->
+                                                   FunPtr (CDouble -> CInt -> IO CDouble) ->
+                                                   CInt -> IO ()) ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_transformMeasurement@
+hs_bindgen_2e8d6b201521b14a = fmap fromFFIType hs_bindgen_2e8d6b201521b14a_base
+{-# NOINLINE transformMeasurement_funptr #-}
+{-| __C declaration:__ @transformMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 38:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+transformMeasurement_funptr :: FunPtr (Ptr Measurement ->
+                                       FunPtr (Ptr Measurement ->
+                                               FunPtr (CDouble -> CInt -> IO CDouble) ->
+                                               CInt -> IO ()) ->
+                                       IO ())
+{-| __C declaration:__ @transformMeasurement@
+
+    __defined at:__ @functions\/callbacks.h 38:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+transformMeasurement_funptr = unsafePerformIO hs_bindgen_2e8d6b201521b14a
+-- __unique:__ @test_functionscallbacks_Example_get_processWithCallbacks@
+foreign import ccall unsafe "hs_bindgen_7f4acb7260277d86" hs_bindgen_7f4acb7260277d86_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_processWithCallbacks@
+hs_bindgen_7f4acb7260277d86 :: IO (FunPtr (FunPtr (Ptr Measurement ->
+                                                   FileOpenedNotification -> CInt -> IO ()) ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_processWithCallbacks@
+hs_bindgen_7f4acb7260277d86 = fmap fromFFIType hs_bindgen_7f4acb7260277d86_base
+{-# NOINLINE processWithCallbacks_funptr #-}
+{-| __C declaration:__ @processWithCallbacks@
+
+    __defined at:__ @functions\/callbacks.h 43:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processWithCallbacks_funptr :: FunPtr (FunPtr (Ptr Measurement ->
+                                               FileOpenedNotification -> CInt -> IO ()) ->
+                                       IO ())
+{-| __C declaration:__ @processWithCallbacks@
+
+    __defined at:__ @functions\/callbacks.h 43:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processWithCallbacks_funptr = unsafePerformIO hs_bindgen_7f4acb7260277d86
+-- __unique:__ @test_functionscallbacks_Example_get_registerHandler@
+foreign import ccall unsafe "hs_bindgen_80684ecfa6d982b7" hs_bindgen_80684ecfa6d982b7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_registerHandler@
+hs_bindgen_80684ecfa6d982b7 :: IO (FunPtr (Ptr MeasurementHandler ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_registerHandler@
+hs_bindgen_80684ecfa6d982b7 = fmap fromFFIType hs_bindgen_80684ecfa6d982b7_base
+{-# NOINLINE registerHandler_funptr #-}
+{-| __C declaration:__ @registerHandler@
+
+    __defined at:__ @functions\/callbacks.h 56:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+registerHandler_funptr :: FunPtr (Ptr MeasurementHandler -> IO ())
+{-| __C declaration:__ @registerHandler@
+
+    __defined at:__ @functions\/callbacks.h 56:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+registerHandler_funptr = unsafePerformIO hs_bindgen_80684ecfa6d982b7
+-- __unique:__ @test_functionscallbacks_Example_get_executePipeline@
+foreign import ccall unsafe "hs_bindgen_1714a267564c9f6f" hs_bindgen_1714a267564c9f6f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_executePipeline@
+hs_bindgen_1714a267564c9f6f :: IO (FunPtr (Ptr Measurement ->
+                                           Ptr DataPipeline -> IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_executePipeline@
+hs_bindgen_1714a267564c9f6f = fmap fromFFIType hs_bindgen_1714a267564c9f6f_base
+{-# NOINLINE executePipeline_funptr #-}
+{-| __C declaration:__ @executePipeline@
+
+    __defined at:__ @functions\/callbacks.h 64:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+executePipeline_funptr :: FunPtr (Ptr Measurement ->
+                                  Ptr DataPipeline -> IO ())
+{-| __C declaration:__ @executePipeline@
+
+    __defined at:__ @functions\/callbacks.h 64:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+executePipeline_funptr = unsafePerformIO hs_bindgen_1714a267564c9f6f
+-- __unique:__ @test_functionscallbacks_Example_get_runProcessor@
+foreign import ccall unsafe "hs_bindgen_fedf80fe8e91dc7a" hs_bindgen_fedf80fe8e91dc7a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_runProcessor@
+hs_bindgen_fedf80fe8e91dc7a :: IO (FunPtr (Ptr Measurement ->
+                                           Ptr Processor -> IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_runProcessor@
+hs_bindgen_fedf80fe8e91dc7a = fmap fromFFIType hs_bindgen_fedf80fe8e91dc7a_base
+{-# NOINLINE runProcessor_funptr #-}
+{-| __C declaration:__ @runProcessor@
+
+    __defined at:__ @functions\/callbacks.h 80:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+runProcessor_funptr :: FunPtr (Ptr Measurement ->
+                               Ptr Processor -> IO ())
+{-| __C declaration:__ @runProcessor@
+
+    __defined at:__ @functions\/callbacks.h 80:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+runProcessor_funptr = unsafePerformIO hs_bindgen_fedf80fe8e91dc7a
+-- __unique:__ @test_functionscallbacks_Example_get_processMeasurementWithValidation@
+foreign import ccall unsafe "hs_bindgen_443cb57c681c2cab" hs_bindgen_443cb57c681c2cab_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_processMeasurementWithValidation@
+hs_bindgen_443cb57c681c2cab :: IO (FunPtr (Ptr Measurement ->
+                                           FunPtr (Ptr Measurement ->
+                                                   FunPtr (Ptr Measurement ->
+                                                           DataValidator -> CInt -> IO ()) ->
+                                                   DataValidator -> IO ()) ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_processMeasurementWithValidation@
+hs_bindgen_443cb57c681c2cab = fmap fromFFIType hs_bindgen_443cb57c681c2cab_base
+{-# NOINLINE processMeasurementWithValidation_funptr #-}
+{-| __C declaration:__ @processMeasurementWithValidation@
+
+    __defined at:__ @functions\/callbacks.h 85:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processMeasurementWithValidation_funptr :: FunPtr (Ptr Measurement ->
+                                                   FunPtr (Ptr Measurement ->
+                                                           FunPtr (Ptr Measurement ->
+                                                                   DataValidator ->
+                                                                   CInt -> IO ()) ->
+                                                           DataValidator -> IO ()) ->
+                                                   IO ())
+{-| __C declaration:__ @processMeasurementWithValidation@
+
+    __defined at:__ @functions\/callbacks.h 85:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+processMeasurementWithValidation_funptr = unsafePerformIO hs_bindgen_443cb57c681c2cab
+-- __unique:__ @test_functionscallbacks_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_7cf6cffd19682c36" hs_bindgen_7cf6cffd19682c36_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_f@
+hs_bindgen_7cf6cffd19682c36 :: IO (FunPtr (FunPtr (Foo -> IO ()) ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_f@
+hs_bindgen_7cf6cffd19682c36 = fmap fromFFIType hs_bindgen_7cf6cffd19682c36_base
+{-# NOINLINE f_funptr #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/callbacks.h 96:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f_funptr :: FunPtr (FunPtr (Foo -> IO ()) -> IO ())
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/callbacks.h 96:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f_funptr = unsafePerformIO hs_bindgen_7cf6cffd19682c36
+-- __unique:__ @test_functionscallbacks_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_81fde2984e04c791" hs_bindgen_81fde2984e04c791_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_f2@
+hs_bindgen_81fde2984e04c791 :: IO (FunPtr (FunPtr (Foo2 ->
+                                                   IO ()) ->
+                                           IO ()))
+-- __unique:__ @test_functionscallbacks_Example_get_f2@
+hs_bindgen_81fde2984e04c791 = fmap fromFFIType hs_bindgen_81fde2984e04c791_base
+{-# NOINLINE f2_funptr #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/callbacks.h 97:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f2_funptr :: FunPtr (FunPtr (Foo2 -> IO ()) -> IO ())
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/callbacks.h 97:6@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+f2_funptr = unsafePerformIO hs_bindgen_81fde2984e04c791
+-- __unique:__ @test_functionscallbacks_Example_get_globalVar@
+foreign import ccall unsafe "hs_bindgen_a370a6faf1531caa" hs_bindgen_a370a6faf1531caa_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_functionscallbacks_Example_get_globalVar@
+hs_bindgen_a370a6faf1531caa :: IO (Ptr (ConstantArray 3
+                                                      (FunPtr (A -> IO ()))))
+-- __unique:__ @test_functionscallbacks_Example_get_globalVar@
+hs_bindgen_a370a6faf1531caa = fmap fromFFIType hs_bindgen_a370a6faf1531caa_base
+{-# NOINLINE globalVar #-}
+{-| __C declaration:__ @globalVar@
+
+    __defined at:__ @functions\/callbacks.h 103:15@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+globalVar :: Ptr (ConstantArray 3 (FunPtr (A -> IO ())))
+{-| __C declaration:__ @globalVar@
+
+    __defined at:__ @functions\/callbacks.h 103:15@
+
+    __exported by:__ @functions\/callbacks.h@
+-}
+globalVar = unsafePerformIO hs_bindgen_a370a6faf1531caa
diff --git a/test-artefacts/fixtures/functions/circular_dependency_fun/Example.hs b/test-artefacts/fixtures/functions/circular_dependency_fun/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/circular_dependency_fun/Example.hs
@@ -0,0 +1,212 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Fun_ptr_Aux(..)
+    , Example.Fun_ptr(..)
+    , Example.Forward_declaration(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, IO, Int, Ord, Show, fmap, pure, type (~))
+
+{-| Auxiliary type used by 'Fun_ptr'
+
+    __C declaration:__ @fun_ptr@
+
+    __defined at:__ @functions\/circular_dependency_fun.h 3:16@
+
+    __exported by:__ @functions\/circular_dependency_fun.h@
+-}
+newtype Fun_ptr_Aux = Fun_ptr_Aux
+  { unwrapFun_ptr_Aux :: BG.Ptr Forward_declaration -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFun_ptr_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5964bbadb359ee4a_base ::
+     (BG.Ptr BG.Void -> IO ())
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO ()))
+
+-- __unique:__ @toFun_ptr_Aux@
+hs_bindgen_5964bbadb359ee4a ::
+     Fun_ptr_Aux
+  -> IO (BG.FunPtr Fun_ptr_Aux)
+hs_bindgen_5964bbadb359ee4a =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_5964bbadb359ee4a_base (\x1 ->
+                                                            BG.getField @"unwrapFun_ptr_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromFun_ptr_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_f8391e85af67fcb6_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO ())
+  -> BG.Ptr BG.Void -> IO ()
+
+-- __unique:__ @fromFun_ptr_Aux@
+hs_bindgen_f8391e85af67fcb6 ::
+     BG.FunPtr Fun_ptr_Aux
+  -> Fun_ptr_Aux
+hs_bindgen_f8391e85af67fcb6 =
+  \funPtr0 ->
+    Fun_ptr_Aux (\x1 ->
+                   hs_bindgen_f8391e85af67fcb6_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr Fun_ptr_Aux where
+
+  toFunPtr = hs_bindgen_5964bbadb359ee4a
+
+instance BG.FromFunPtr Fun_ptr_Aux where
+
+  fromFunPtr = hs_bindgen_f8391e85af67fcb6
+
+instance ( ty ~ (BG.Ptr Forward_declaration -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapFun_ptr_Aux" Fun_ptr_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Fun_ptr_Aux {unwrapFun_ptr_Aux = y1}
+      , BG.getField @"unwrapFun_ptr_Aux" x0
+      )
+
+instance ( ty ~ (BG.Ptr Forward_declaration -> IO ())
+         ) => BG.HasField "unwrapFun_ptr_Aux" (BG.Ptr Fun_ptr_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFun_ptr_Aux")
+
+instance HasCField.HasCField Fun_ptr_Aux "unwrapFun_ptr_Aux" where
+
+  type CFieldType Fun_ptr_Aux "unwrapFun_ptr_Aux" =
+    BG.Ptr Forward_declaration -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fun_ptr@
+
+    __defined at:__ @functions\/circular_dependency_fun.h 3:16@
+
+    __exported by:__ @functions\/circular_dependency_fun.h@
+-}
+newtype Fun_ptr = Fun_ptr
+  { unwrapFun_ptr :: BG.FunPtr Fun_ptr_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Fun_ptr_Aux
+         ) => BG.CompatHasField.HasField "unwrapFun_ptr" Fun_ptr ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Fun_ptr {unwrapFun_ptr = y1}, BG.getField @"unwrapFun_ptr" x0)
+
+instance ( ty ~ BG.FunPtr Fun_ptr_Aux
+         ) => BG.HasField "unwrapFun_ptr" (BG.Ptr Fun_ptr) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFun_ptr")
+
+instance HasCField.HasCField Fun_ptr "unwrapFun_ptr" where
+
+  type CFieldType Fun_ptr "unwrapFun_ptr" =
+    BG.FunPtr Fun_ptr_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct forward_declaration@
+
+    __defined at:__ @functions\/circular_dependency_fun.h 5:8@
+
+    __exported by:__ @functions\/circular_dependency_fun.h@
+-}
+data Forward_declaration = Forward_declaration
+  { forward_declaration_f :: Fun_ptr
+    {- ^ __C declaration:__ @f@
+
+         __defined at:__ @functions\/circular_dependency_fun.h 6:11@
+
+         __exported by:__ @functions\/circular_dependency_fun.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Forward_declaration where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Forward_declaration where
+
+  readRaw =
+    \ptr0 ->
+          pure Forward_declaration
+      <*> HasCField.readRaw (BG.Proxy @"forward_declaration_f") ptr0
+
+instance Marshal.WriteRaw Forward_declaration where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Forward_declaration forward_declaration_f2 ->
+            HasCField.writeRaw (BG.Proxy @"forward_declaration_f") ptr0 forward_declaration_f2
+
+deriving via Marshal.EquivStorable Forward_declaration instance BG.Storable Forward_declaration
+
+deriving via Struct.IsStructViaReadRaw Forward_declaration instance Struct.IsStruct Forward_declaration
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @functions\/circular_dependency_fun.h 6:11@
+
+    __exported by:__ @functions\/circular_dependency_fun.h@
+-}
+instance ( ty ~ Fun_ptr
+         ) => BG.CompatHasField.HasField "forward_declaration_f" Forward_declaration ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Forward_declaration {forward_declaration_f = y1}
+      , BG.getField @"forward_declaration_f" x0
+      )
+
+instance ( ty ~ Fun_ptr
+         ) => BG.HasField "forward_declaration_f" (BG.Ptr Forward_declaration) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"forward_declaration_f")
+
+instance HasCField.HasCField Forward_declaration "forward_declaration_f" where
+
+  type CFieldType Forward_declaration "forward_declaration_f" =
+    Fun_ptr
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/circular_dependency_fun/bindingspec.yaml b/test-artefacts/fixtures/functions/circular_dependency_fun/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/circular_dependency_fun/bindingspec.yaml
@@ -0,0 +1,54 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/circular_dependency_fun.h
+  cname: fun_ptr
+  hsname: Fun_ptr
+- headers: functions/circular_dependency_fun.h
+  cname: struct forward_declaration
+  hsname: Forward_declaration
+hstypes:
+- hsname: Forward_declaration
+  representation:
+    record:
+      constructor: Forward_declaration
+      fields:
+      - forward_declaration_f
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Fun_ptr
+  representation:
+    newtype:
+      constructor: Fun_ptr
+      fields:
+      - unwrapFun_ptr
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/circular_dependency_fun/th.txt b/test-artefacts/fixtures/functions/circular_dependency_fun/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/circular_dependency_fun/th.txt
@@ -0,0 +1,106 @@
+-- addDependentFile test-artefacts/headers/golden/functions/circular_dependency_fun.h
+{-| Auxiliary type used by 'Fun_ptr'
+
+    __C declaration:__ @fun_ptr@
+
+    __defined at:__ @functions\/circular_dependency_fun.h 3:16@
+
+    __exported by:__ @functions\/circular_dependency_fun.h@
+-}
+newtype Fun_ptr_Aux
+    = Fun_ptr_Aux {unwrapFun_ptr_Aux :: (Ptr Forward_declaration ->
+                                         IO ())}
+    deriving stock Generic
+-- __unique:__ @toFun_ptr_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5964bbadb359ee4a_base ::
+    Ptr Void -> IO ()
+ -> IO (FunPtr (Ptr Void -> IO ()))
+-- __unique:__ @toFun_ptr_Aux@
+hs_bindgen_5964bbadb359ee4a :: Fun_ptr_Aux ->
+                               IO (FunPtr Fun_ptr_Aux)
+-- __unique:__ @toFun_ptr_Aux@
+hs_bindgen_5964bbadb359ee4a = \fun_0 -> fmap castFunPtr (hs_bindgen_5964bbadb359ee4a_base (\x_1 -> getField @"unwrapFun_ptr_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromFun_ptr_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_f8391e85af67fcb6_base ::
+    FunPtr (Ptr Void -> IO ())
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @fromFun_ptr_Aux@
+hs_bindgen_f8391e85af67fcb6 :: FunPtr Fun_ptr_Aux -> Fun_ptr_Aux
+-- __unique:__ @fromFun_ptr_Aux@
+hs_bindgen_f8391e85af67fcb6 = \funPtr_0 -> Fun_ptr_Aux (\x_1 -> hs_bindgen_f8391e85af67fcb6_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr Fun_ptr_Aux
+    where toFunPtr = hs_bindgen_5964bbadb359ee4a
+instance FromFunPtr Fun_ptr_Aux
+    where fromFunPtr = hs_bindgen_f8391e85af67fcb6
+instance (~) ty (Ptr Forward_declaration -> IO ()) =>
+         HasField "unwrapFun_ptr_Aux" Fun_ptr_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Fun_ptr_Aux{unwrapFun_ptr_Aux = y_1},
+                              getField @"unwrapFun_ptr_Aux" x_0)
+instance (~) ty (Ptr Forward_declaration -> IO ()) =>
+         HasField "unwrapFun_ptr_Aux" (Ptr Fun_ptr_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFun_ptr_Aux")
+instance HasCField Fun_ptr_Aux "unwrapFun_ptr_Aux"
+    where type CFieldType Fun_ptr_Aux
+                          "unwrapFun_ptr_Aux" = Ptr Forward_declaration -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @fun_ptr@
+
+    __defined at:__ @functions\/circular_dependency_fun.h 3:16@
+
+    __exported by:__ @functions\/circular_dependency_fun.h@
+-}
+newtype Fun_ptr
+    = Fun_ptr {unwrapFun_ptr :: (FunPtr Fun_ptr_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Fun_ptr_Aux) =>
+         HasField "unwrapFun_ptr" Fun_ptr ty
+    where hasField = \x_0 -> (\y_1 -> Fun_ptr{unwrapFun_ptr = y_1},
+                              getField @"unwrapFun_ptr" x_0)
+instance (~) ty (FunPtr Fun_ptr_Aux) =>
+         HasField "unwrapFun_ptr" (Ptr Fun_ptr) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFun_ptr")
+instance HasCField Fun_ptr "unwrapFun_ptr"
+    where type CFieldType Fun_ptr "unwrapFun_ptr" = FunPtr Fun_ptr_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct forward_declaration@
+
+    __defined at:__ @functions\/circular_dependency_fun.h 5:8@
+
+    __exported by:__ @functions\/circular_dependency_fun.h@
+-}
+data Forward_declaration
+    = Forward_declaration {forward_declaration_f :: Fun_ptr
+                           {- ^ __C declaration:__ @f@
+
+                                __defined at:__ @functions\/circular_dependency_fun.h 6:11@
+
+                                __exported by:__ @functions\/circular_dependency_fun.h@
+                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Forward_declaration
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Forward_declaration
+    where readRaw = \ptr_0 -> pure Forward_declaration <*> readRaw (Proxy @"forward_declaration_f") ptr_0
+instance WriteRaw Forward_declaration
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Forward_declaration forward_declaration_f_2 -> writeRaw (Proxy @"forward_declaration_f") ptr_0 forward_declaration_f_2
+deriving via (EquivStorable Forward_declaration) instance Storable Forward_declaration
+deriving via (IsStructViaReadRaw Forward_declaration) instance IsStruct Forward_declaration
+instance (~) ty Fun_ptr =>
+         HasField "forward_declaration_f" Forward_declaration ty
+    where hasField = \x_0 -> (\y_1 -> Forward_declaration{forward_declaration_f = y_1},
+                              getField @"forward_declaration_f" x_0)
+instance (~) ty Fun_ptr =>
+         HasField "forward_declaration_f" (Ptr Forward_declaration) (Ptr ty)
+    where getField = fromPtr (Proxy @"forward_declaration_f")
+instance HasCField Forward_declaration "forward_declaration_f"
+    where type CFieldType Forward_declaration
+                          "forward_declaration_f" = Fun_ptr
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/decls_in_signature/Example.hs b/test-artefacts/fixtures/functions/decls_in_signature/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/decls_in_signature/Example.hs
@@ -0,0 +1,142 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Opaque
+    , Example.Outside(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct opaque@
+
+    __defined at:__ @functions\/decls_in_signature.h 2:8@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+data Opaque
+
+{-| __C declaration:__ @struct outside@
+
+    __defined at:__ @functions\/decls_in_signature.h 3:8@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+data Outside = Outside
+  { outside_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @functions\/decls_in_signature.h 4:7@
+
+         __exported by:__ @functions\/decls_in_signature.h@
+    -}
+  , outside_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @functions\/decls_in_signature.h 5:7@
+
+         __exported by:__ @functions\/decls_in_signature.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Outside where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outside where
+
+  readRaw =
+    \ptr0 ->
+          pure Outside
+      <*> HasCField.readRaw (BG.Proxy @"outside_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outside_y") ptr0
+
+instance Marshal.WriteRaw Outside where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outside outside_x2 outside_y3 ->
+               HasCField.writeRaw (BG.Proxy @"outside_x") ptr0 outside_x2
+            >> HasCField.writeRaw (BG.Proxy @"outside_y") ptr0 outside_y3
+
+deriving via Marshal.EquivStorable Outside instance BG.Storable Outside
+
+deriving via Struct.IsStructViaReadRaw Outside instance Struct.IsStruct Outside
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/decls_in_signature.h 4:7@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outside_x" Outside ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outside {outside_x = y1, outside_y = BG.getField @"outside_y" x0}
+      , BG.getField @"outside_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outside_x" (BG.Ptr Outside) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"outside_x")
+
+instance HasCField.HasCField Outside "outside_x" where
+
+  type CFieldType Outside "outside_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/decls_in_signature.h 5:7@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outside_y" Outside ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outside {outside_y = y1, outside_x = BG.getField @"outside_x" x0}
+      , BG.getField @"outside_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outside_y" (BG.Ptr Outside) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"outside_y")
+
+instance HasCField.HasCField Outside "outside_y" where
+
+  type CFieldType Outside "outside_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/functions/decls_in_signature/Example/FunPtr.hs b/test-artefacts/fixtures/functions/decls_in_signature/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/decls_in_signature/Example/FunPtr.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.normal
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/decls_in_signature.h>"
+  , "/* test_functionsdecls_in_signature_Example_get_normal */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f3036965ea57b87f (void)) ("
+  , "  struct opaque *arg1,"
+  , "  struct outside *arg2,"
+  , "  struct outside arg3"
+  , ")"
+  , "{"
+  , "  return &normal;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsdecls_in_signature_Example_get_normal@
+foreign import ccall unsafe "hs_bindgen_f3036965ea57b87f" hs_bindgen_f3036965ea57b87f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsdecls_in_signature_Example_get_normal@
+hs_bindgen_f3036965ea57b87f :: IO (BG.FunPtr (BG.Ptr Opaque -> BG.Ptr Outside -> Outside -> IO ()))
+hs_bindgen_f3036965ea57b87f =
+  fmap BG.fromFFIType hs_bindgen_f3036965ea57b87f_base
+
+{-# NOINLINE normal #-}
+{-| __C declaration:__ @normal@
+
+    __defined at:__ @functions\/decls_in_signature.h 7:6@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+normal :: BG.FunPtr (BG.Ptr Opaque -> BG.Ptr Outside -> Outside -> IO ())
+normal =
+  BG.unsafePerformIO hs_bindgen_f3036965ea57b87f
diff --git a/test-artefacts/fixtures/functions/decls_in_signature/Example/Safe.hs b/test-artefacts/fixtures/functions/decls_in_signature/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/decls_in_signature/Example/Safe.hs
@@ -0,0 +1,66 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.normal
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/decls_in_signature.h>"
+  , "void hs_bindgen_920e5c20f770432b ("
+  , "  struct opaque *arg1,"
+  , "  struct outside *arg2,"
+  , "  struct outside *arg3"
+  , ")"
+  , "{"
+  , "  (normal)(arg1, arg2, *arg3);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsdecls_in_signature_Example_Safe_normal@
+foreign import ccall safe "hs_bindgen_920e5c20f770432b" hs_bindgen_920e5c20f770432b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsdecls_in_signature_Example_Safe_normal@
+hs_bindgen_920e5c20f770432b ::
+     BG.Ptr Opaque
+  -> BG.Ptr Outside
+  -> BG.Ptr Outside
+  -> IO ()
+hs_bindgen_920e5c20f770432b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_920e5c20f770432b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| __C declaration:__ @normal@
+
+    __defined at:__ @functions\/decls_in_signature.h 7:6@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+normal ::
+     BG.Ptr Opaque
+     -- ^ __C declaration:__ @ptr_to_opaque@
+  -> BG.Ptr Outside
+     -- ^ __C declaration:__ @ptr_to_defined@
+  -> Outside
+     -- ^ __C declaration:__ @by_value@
+  -> IO ()
+normal =
+  \ptr_to_opaque0 ->
+    \ptr_to_defined1 ->
+      \by_value2 ->
+        BG.with by_value2 (\by_value3 ->
+                             hs_bindgen_920e5c20f770432b ptr_to_opaque0 ptr_to_defined1 by_value3)
diff --git a/test-artefacts/fixtures/functions/decls_in_signature/Example/Unsafe.hs b/test-artefacts/fixtures/functions/decls_in_signature/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/decls_in_signature/Example/Unsafe.hs
@@ -0,0 +1,66 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.normal
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/decls_in_signature.h>"
+  , "void hs_bindgen_247ee31a29b7e5a8 ("
+  , "  struct opaque *arg1,"
+  , "  struct outside *arg2,"
+  , "  struct outside *arg3"
+  , ")"
+  , "{"
+  , "  (normal)(arg1, arg2, *arg3);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsdecls_in_signature_Example_Unsafe_normal@
+foreign import ccall unsafe "hs_bindgen_247ee31a29b7e5a8" hs_bindgen_247ee31a29b7e5a8_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsdecls_in_signature_Example_Unsafe_normal@
+hs_bindgen_247ee31a29b7e5a8 ::
+     BG.Ptr Opaque
+  -> BG.Ptr Outside
+  -> BG.Ptr Outside
+  -> IO ()
+hs_bindgen_247ee31a29b7e5a8 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_247ee31a29b7e5a8_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| __C declaration:__ @normal@
+
+    __defined at:__ @functions\/decls_in_signature.h 7:6@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+normal ::
+     BG.Ptr Opaque
+     -- ^ __C declaration:__ @ptr_to_opaque@
+  -> BG.Ptr Outside
+     -- ^ __C declaration:__ @ptr_to_defined@
+  -> Outside
+     -- ^ __C declaration:__ @by_value@
+  -> IO ()
+normal =
+  \ptr_to_opaque0 ->
+    \ptr_to_defined1 ->
+      \by_value2 ->
+        BG.with by_value2 (\by_value3 ->
+                             hs_bindgen_247ee31a29b7e5a8 ptr_to_opaque0 ptr_to_defined1 by_value3)
diff --git a/test-artefacts/fixtures/functions/decls_in_signature/bindingspec.yaml b/test-artefacts/fixtures/functions/decls_in_signature/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/decls_in_signature/bindingspec.yaml
@@ -0,0 +1,34 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/decls_in_signature.h
+  cname: struct opaque
+  hsname: Opaque
+- headers: functions/decls_in_signature.h
+  cname: struct outside
+  hsname: Outside
+hstypes:
+- hsname: Opaque
+  representation: emptydata
+- hsname: Outside
+  representation:
+    record:
+      constructor: Outside
+      fields:
+      - outside_x
+      - outside_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/decls_in_signature/th.txt b/test-artefacts/fixtures/functions/decls_in_signature/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/decls_in_signature/th.txt
@@ -0,0 +1,160 @@
+-- addDependentFile test-artefacts/headers/golden/functions/decls_in_signature.h
+-- #include <functions/decls_in_signature.h>
+-- void hs_bindgen_920e5c20f770432b (
+--   struct opaque *arg1,
+--   struct outside *arg2,
+--   struct outside *arg3
+-- )
+-- {
+--   (normal)(arg1, arg2, *arg3);
+-- }
+-- void hs_bindgen_247ee31a29b7e5a8 (
+--   struct opaque *arg1,
+--   struct outside *arg2,
+--   struct outside *arg3
+-- )
+-- {
+--   (normal)(arg1, arg2, *arg3);
+-- }
+-- /* test_functionsdecls_in_signature_Example_get_normal */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f3036965ea57b87f (void)) (
+--   struct opaque *arg1,
+--   struct outside *arg2,
+--   struct outside arg3
+-- )
+-- {
+--   return &normal;
+-- }
+{-| __C declaration:__ @struct opaque@
+
+    __defined at:__ @functions\/decls_in_signature.h 2:8@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+data Opaque
+{-| __C declaration:__ @struct outside@
+
+    __defined at:__ @functions\/decls_in_signature.h 3:8@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+data Outside
+    = Outside {outside_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @functions\/decls_in_signature.h 4:7@
+
+                    __exported by:__ @functions\/decls_in_signature.h@
+               -},
+               outside_y :: CInt
+               {- ^ __C declaration:__ @y@
+
+                    __defined at:__ @functions\/decls_in_signature.h 5:7@
+
+                    __exported by:__ @functions\/decls_in_signature.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Outside
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outside
+    where readRaw = \ptr_0 -> (pure Outside <*> readRaw (Proxy @"outside_x") ptr_0) <*> readRaw (Proxy @"outside_y") ptr_0
+instance WriteRaw Outside
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outside outside_x_2
+                                               outside_y_3 -> writeRaw (Proxy @"outside_x") ptr_0 outside_x_2 >> writeRaw (Proxy @"outside_y") ptr_0 outside_y_3
+deriving via (EquivStorable Outside) instance Storable Outside
+deriving via (IsStructViaReadRaw Outside) instance IsStruct Outside
+instance (~) ty CInt => HasField "outside_x" Outside ty
+    where hasField = \x_0 -> (\y_1 -> Outside{outside_x = y_1,
+                                              outside_y = getField @"outside_y" x_0},
+                              getField @"outside_x" x_0)
+instance (~) ty CInt => HasField "outside_x" (Ptr Outside) (Ptr ty)
+    where getField = fromPtr (Proxy @"outside_x")
+instance HasCField Outside "outside_x"
+    where type CFieldType Outside "outside_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outside_y" Outside ty
+    where hasField = \x_0 -> (\y_1 -> Outside{outside_y = y_1,
+                                              outside_x = getField @"outside_x" x_0},
+                              getField @"outside_y" x_0)
+instance (~) ty CInt => HasField "outside_y" (Ptr Outside) (Ptr ty)
+    where getField = fromPtr (Proxy @"outside_y")
+instance HasCField Outside "outside_y"
+    where type CFieldType Outside "outside_y" = CInt
+          offset# = \_ -> \_ -> 4
+-- __unique:__ @test_functionsdecls_in_signature_Example_Safe_normal@
+foreign import ccall safe "hs_bindgen_920e5c20f770432b" hs_bindgen_920e5c20f770432b_base ::
+    Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsdecls_in_signature_Example_Safe_normal@
+hs_bindgen_920e5c20f770432b :: Ptr Opaque ->
+                               Ptr Outside -> Ptr Outside -> IO ()
+-- __unique:__ @test_functionsdecls_in_signature_Example_Safe_normal@
+hs_bindgen_920e5c20f770432b = \x_0 -> \x_1 -> \x_2 -> hs_bindgen_920e5c20f770432b_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2)
+{-| __C declaration:__ @normal@
+
+    __defined at:__ @functions\/decls_in_signature.h 7:6@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+normal_safe :: Ptr Opaque -> Ptr Outside -> Outside -> IO ()
+{-| __C declaration:__ @normal@
+
+    __defined at:__ @functions\/decls_in_signature.h 7:6@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+normal_safe = \ptr_to_opaque_0 -> \ptr_to_defined_1 -> \by_value_2 -> with by_value_2 (\by_value_3 -> hs_bindgen_920e5c20f770432b ptr_to_opaque_0 ptr_to_defined_1 by_value_3)
+-- __unique:__ @test_functionsdecls_in_signature_Example_Unsafe_normal@
+foreign import ccall unsafe "hs_bindgen_247ee31a29b7e5a8" hs_bindgen_247ee31a29b7e5a8_base ::
+    Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsdecls_in_signature_Example_Unsafe_normal@
+hs_bindgen_247ee31a29b7e5a8 :: Ptr Opaque ->
+                               Ptr Outside -> Ptr Outside -> IO ()
+-- __unique:__ @test_functionsdecls_in_signature_Example_Unsafe_normal@
+hs_bindgen_247ee31a29b7e5a8 = \x_0 -> \x_1 -> \x_2 -> hs_bindgen_247ee31a29b7e5a8_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2)
+{-| __C declaration:__ @normal@
+
+    __defined at:__ @functions\/decls_in_signature.h 7:6@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+normal_unsafe :: Ptr Opaque -> Ptr Outside -> Outside -> IO ()
+{-| __C declaration:__ @normal@
+
+    __defined at:__ @functions\/decls_in_signature.h 7:6@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+normal_unsafe = \ptr_to_opaque_0 -> \ptr_to_defined_1 -> \by_value_2 -> with by_value_2 (\by_value_3 -> hs_bindgen_247ee31a29b7e5a8 ptr_to_opaque_0 ptr_to_defined_1 by_value_3)
+-- __unique:__ @test_functionsdecls_in_signature_Example_get_normal@
+foreign import ccall unsafe "hs_bindgen_f3036965ea57b87f" hs_bindgen_f3036965ea57b87f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsdecls_in_signature_Example_get_normal@
+hs_bindgen_f3036965ea57b87f :: IO (FunPtr (Ptr Opaque ->
+                                           Ptr Outside -> Outside -> IO ()))
+-- __unique:__ @test_functionsdecls_in_signature_Example_get_normal@
+hs_bindgen_f3036965ea57b87f = fmap fromFFIType hs_bindgen_f3036965ea57b87f_base
+{-# NOINLINE normal_funptr #-}
+{-| __C declaration:__ @normal@
+
+    __defined at:__ @functions\/decls_in_signature.h 7:6@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+normal_funptr :: FunPtr (Ptr Opaque ->
+                         Ptr Outside -> Outside -> IO ())
+{-| __C declaration:__ @normal@
+
+    __defined at:__ @functions\/decls_in_signature.h 7:6@
+
+    __exported by:__ @functions\/decls_in_signature.h@
+-}
+normal_funptr = unsafePerformIO hs_bindgen_f3036965ea57b87f
diff --git a/test-artefacts/fixtures/functions/fun_attributes/Example.hs b/test-artefacts/fixtures/functions/fun_attributes/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes/Example.hs
@@ -0,0 +1,109 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.FILE(..)
+    , Example.Size_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @struct FILE@
+
+    __defined at:__ @functions\/fun_attributes.h 7:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+data FILE = FILE
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize FILE where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw FILE where
+
+  readRaw = \ptr0 -> pure FILE
+
+instance Marshal.WriteRaw FILE where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          FILE -> pure ()
+
+deriving via Marshal.EquivStorable FILE instance BG.Storable FILE
+
+deriving via Struct.IsStructViaReadRaw FILE instance Struct.IsStruct FILE
+
+{-| __C declaration:__ @size_t@
+
+    __defined at:__ @functions\/fun_attributes.h 8:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+newtype Size_t = Size_t
+  { unwrapSize_t :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapSize_t" Size_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Size_t {unwrapSize_t = y1}, BG.getField @"unwrapSize_t" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapSize_t" (BG.Ptr Size_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSize_t")
+
+instance HasCField.HasCField Size_t "unwrapSize_t" where
+
+  type CFieldType Size_t "unwrapSize_t" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/fun_attributes/Example/FunPtr.hs b/test-artefacts/fixtures/functions/fun_attributes/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes/Example/FunPtr.hs
@@ -0,0 +1,686 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.__f1
+    , Example.FunPtr.f1
+    , Example.FunPtr.my_memalign
+    , Example.FunPtr.my_calloc
+    , Example.FunPtr.my_realloc
+    , Example.FunPtr.my_alloc1
+    , Example.FunPtr.my_alloc2
+    , Example.FunPtr.square
+    , Example.FunPtr.old_fn_deprecated
+    , Example.FunPtr.my_dgettext
+    , Example.FunPtr.fdopen
+    , Example.FunPtr.f2
+    , Example.FunPtr.my_memcpy
+    , Example.FunPtr.fatal
+    , Example.FunPtr.hash
+    , Example.FunPtr.mymalloc
+    , Example.FunPtr.foobar
+    , Example.FunPtr.core2_func
+    , Example.FunPtr.sse3_func
+    , Example.FunPtr.f3
+    , Example.FunPtr.fn
+    , Example.FunPtr.y
+    , Example.FunPtr.z1
+    , Example.FunPtr.z2
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/fun_attributes.h>"
+  , "/* test_functionsfun_attributes_Example_get___f1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_99da7108788a2cf4 (void)) (void)"
+  , "{"
+  , "  return &__f1;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_f1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a0d2ec6ffc23fc5a (void)) (void)"
+  , "{"
+  , "  return &f1;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_my_memalign */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_16a2a5a807cc26ec (void)) ("
+  , "  size_t arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &my_memalign;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_my_calloc */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_976df97f9c9c1223 (void)) ("
+  , "  size_t arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &my_calloc;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_my_realloc */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_4021d3c6eae30c8c (void)) ("
+  , "  void *arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &my_realloc;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_my_alloc1 */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_2ca35d0827c76ff7 (void)) ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return &my_alloc1;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_my_alloc2 */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_a43746fed9206f42 (void)) ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return &my_alloc2;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_square */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_d41557222fd2ab94 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &square;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_old_fn_deprecated */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_beee43878922a900 (void)) (void)"
+  , "{"
+  , "  return &old_fn_deprecated;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_my_dgettext */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_f95f43d50ed8f2b4 (void)) ("
+  , "  char *arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return &my_dgettext;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_fdopen */"
+  , "__attribute__ ((const))"
+  , "FILE *(*hs_bindgen_986260288574592d (void)) ("
+  , "  signed int arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return &fdopen;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_f2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fa90d405c15977a2 (void)) (void)"
+  , "{"
+  , "  return &f2;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_my_memcpy */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_481e3a75205c85f2 (void)) ("
+  , "  void *arg1,"
+  , "  void const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return &my_memcpy;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_fatal */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_99cc62837ebec657 (void)) (void)"
+  , "{"
+  , "  return &fatal;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_hash */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_196cbfce2a9df94f (void)) ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return &hash;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_mymalloc */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_ae6b503283507bd2 (void)) ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return &mymalloc;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_foobar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ad3e5c88477c9e92 (void)) (void)"
+  , "{"
+  , "  return &foobar;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_core2_func */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_508f28109ff2076e (void)) (void)"
+  , "{"
+  , "  return &core2_func;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_sse3_func */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_6e4f5b53b36a3ecb (void)) (void)"
+  , "{"
+  , "  return &sse3_func;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_f3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e39d5186f5da6c3f (void)) (void)"
+  , "{"
+  , "  return &f3;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_fn */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_acb0e567f47dc0eb (void)) (void)"
+  , "{"
+  , "  return &fn;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_y */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_a1f58949b267b87f (void)) (void)"
+  , "{"
+  , "  return &y;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_z1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_27c558455e5d5b1a (void)) (void)"
+  , "{"
+  , "  return &z1;"
+  , "}"
+  , "/* test_functionsfun_attributes_Example_get_z2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ef816c1d50bc7bb9 (void)) (void)"
+  , "{"
+  , "  return &z2;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsfun_attributes_Example_get___f1@
+foreign import ccall unsafe "hs_bindgen_99da7108788a2cf4" hs_bindgen_99da7108788a2cf4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get___f1@
+hs_bindgen_99da7108788a2cf4 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_99da7108788a2cf4 =
+  fmap BG.fromFFIType hs_bindgen_99da7108788a2cf4_base
+
+{-# NOINLINE __f1 #-}
+{-| __C declaration:__ @__f1@
+
+    __defined at:__ @functions\/fun_attributes.h 16:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+__f1 :: BG.FunPtr (IO ())
+__f1 = BG.unsafePerformIO hs_bindgen_99da7108788a2cf4
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_a0d2ec6ffc23fc5a" hs_bindgen_a0d2ec6ffc23fc5a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_f1@
+hs_bindgen_a0d2ec6ffc23fc5a :: IO (BG.FunPtr (IO ()))
+hs_bindgen_a0d2ec6ffc23fc5a =
+  fmap BG.fromFFIType hs_bindgen_a0d2ec6ffc23fc5a_base
+
+{-# NOINLINE f1 #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @functions\/fun_attributes.h 19:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f1 :: BG.FunPtr (IO ())
+f1 = BG.unsafePerformIO hs_bindgen_a0d2ec6ffc23fc5a
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memalign@
+foreign import ccall unsafe "hs_bindgen_16a2a5a807cc26ec" hs_bindgen_16a2a5a807cc26ec_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memalign@
+hs_bindgen_16a2a5a807cc26ec :: IO (BG.FunPtr (Size_t -> Size_t -> IO (BG.Ptr BG.Void)))
+hs_bindgen_16a2a5a807cc26ec =
+  fmap BG.fromFFIType hs_bindgen_16a2a5a807cc26ec_base
+
+{-# NOINLINE my_memalign #-}
+{-| __C declaration:__ @my_memalign@
+
+    __defined at:__ @functions\/fun_attributes.h 23:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memalign :: BG.FunPtr (Size_t -> Size_t -> IO (BG.Ptr BG.Void))
+my_memalign =
+  BG.unsafePerformIO hs_bindgen_16a2a5a807cc26ec
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_calloc@
+foreign import ccall unsafe "hs_bindgen_976df97f9c9c1223" hs_bindgen_976df97f9c9c1223_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_calloc@
+hs_bindgen_976df97f9c9c1223 :: IO (BG.FunPtr (Size_t -> Size_t -> IO (BG.Ptr BG.Void)))
+hs_bindgen_976df97f9c9c1223 =
+  fmap BG.fromFFIType hs_bindgen_976df97f9c9c1223_base
+
+{-# NOINLINE my_calloc #-}
+{-| __C declaration:__ @my_calloc@
+
+    __defined at:__ @functions\/fun_attributes.h 28:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_calloc :: BG.FunPtr (Size_t -> Size_t -> IO (BG.Ptr BG.Void))
+my_calloc =
+  BG.unsafePerformIO hs_bindgen_976df97f9c9c1223
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_realloc@
+foreign import ccall unsafe "hs_bindgen_4021d3c6eae30c8c" hs_bindgen_4021d3c6eae30c8c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_realloc@
+hs_bindgen_4021d3c6eae30c8c :: IO (BG.FunPtr (BG.Ptr BG.Void -> Size_t -> IO (BG.Ptr BG.Void)))
+hs_bindgen_4021d3c6eae30c8c =
+  fmap BG.fromFFIType hs_bindgen_4021d3c6eae30c8c_base
+
+{-# NOINLINE my_realloc #-}
+{-| __C declaration:__ @my_realloc@
+
+    __defined at:__ @functions\/fun_attributes.h 29:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_realloc :: BG.FunPtr (BG.Ptr BG.Void -> Size_t -> IO (BG.Ptr BG.Void))
+my_realloc =
+  BG.unsafePerformIO hs_bindgen_4021d3c6eae30c8c
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc1@
+foreign import ccall unsafe "hs_bindgen_2ca35d0827c76ff7" hs_bindgen_2ca35d0827c76ff7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc1@
+hs_bindgen_2ca35d0827c76ff7 :: IO (BG.FunPtr (Size_t -> IO (BG.Ptr BG.Void)))
+hs_bindgen_2ca35d0827c76ff7 =
+  fmap BG.fromFFIType hs_bindgen_2ca35d0827c76ff7_base
+
+{-# NOINLINE my_alloc1 #-}
+{-| __C declaration:__ @my_alloc1@
+
+    __defined at:__ @functions\/fun_attributes.h 34:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc1 :: BG.FunPtr (Size_t -> IO (BG.Ptr BG.Void))
+my_alloc1 =
+  BG.unsafePerformIO hs_bindgen_2ca35d0827c76ff7
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc2@
+foreign import ccall unsafe "hs_bindgen_a43746fed9206f42" hs_bindgen_a43746fed9206f42_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc2@
+hs_bindgen_a43746fed9206f42 :: IO (BG.FunPtr (Size_t -> IO (BG.Ptr BG.Void)))
+hs_bindgen_a43746fed9206f42 =
+  fmap BG.fromFFIType hs_bindgen_a43746fed9206f42_base
+
+{-# NOINLINE my_alloc2 #-}
+{-| __C declaration:__ @my_alloc2@
+
+    __defined at:__ @functions\/fun_attributes.h 35:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc2 :: BG.FunPtr (Size_t -> IO (BG.Ptr BG.Void))
+my_alloc2 =
+  BG.unsafePerformIO hs_bindgen_a43746fed9206f42
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_square@
+foreign import ccall unsafe "hs_bindgen_d41557222fd2ab94" hs_bindgen_d41557222fd2ab94_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_square@
+hs_bindgen_d41557222fd2ab94 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_d41557222fd2ab94 =
+  fmap BG.fromFFIType hs_bindgen_d41557222fd2ab94_base
+
+{-# NOINLINE square #-}
+{-| __C declaration:__ @square@
+
+    __defined at:__ @functions\/fun_attributes.h 39:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+square :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+square =
+  BG.unsafePerformIO hs_bindgen_d41557222fd2ab94
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_old_fn_deprecated@
+foreign import ccall unsafe "hs_bindgen_beee43878922a900" hs_bindgen_beee43878922a900_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_old_fn_deprecated@
+hs_bindgen_beee43878922a900 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_beee43878922a900 =
+  fmap BG.fromFFIType hs_bindgen_beee43878922a900_base
+
+{-# NOINLINE old_fn_deprecated #-}
+{-| __C declaration:__ @old_fn_deprecated@
+
+    __defined at:__ @functions\/fun_attributes.h 48:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+old_fn_deprecated :: BG.FunPtr (IO BG.CInt)
+old_fn_deprecated =
+  BG.unsafePerformIO hs_bindgen_beee43878922a900
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_dgettext@
+foreign import ccall unsafe "hs_bindgen_f95f43d50ed8f2b4" hs_bindgen_f95f43d50ed8f2b4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_dgettext@
+hs_bindgen_f95f43d50ed8f2b4 :: IO (BG.FunPtr (BG.Ptr BG.CChar -> PtrConst.PtrConst BG.CChar -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_f95f43d50ed8f2b4 =
+  fmap BG.fromFFIType hs_bindgen_f95f43d50ed8f2b4_base
+
+{-# NOINLINE my_dgettext #-}
+{-| __C declaration:__ @my_dgettext@
+
+    __defined at:__ @functions\/fun_attributes.h 64:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_dgettext :: BG.FunPtr (BG.Ptr BG.CChar -> PtrConst.PtrConst BG.CChar -> IO (BG.Ptr BG.CChar))
+my_dgettext =
+  BG.unsafePerformIO hs_bindgen_f95f43d50ed8f2b4
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_fdopen@
+foreign import ccall unsafe "hs_bindgen_986260288574592d" hs_bindgen_986260288574592d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_fdopen@
+hs_bindgen_986260288574592d :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CChar -> IO (BG.Ptr FILE)))
+hs_bindgen_986260288574592d =
+  fmap BG.fromFFIType hs_bindgen_986260288574592d_base
+
+{-# NOINLINE fdopen #-}
+{-| __C declaration:__ @fdopen@
+
+    __defined at:__ @functions\/fun_attributes.h 75:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fdopen :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CChar -> IO (BG.Ptr FILE))
+fdopen =
+  BG.unsafePerformIO hs_bindgen_986260288574592d
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_fa90d405c15977a2" hs_bindgen_fa90d405c15977a2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_f2@
+hs_bindgen_fa90d405c15977a2 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_fa90d405c15977a2 =
+  fmap BG.fromFFIType hs_bindgen_fa90d405c15977a2_base
+
+{-# NOINLINE f2 #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/fun_attributes.h 79:65@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f2 :: BG.FunPtr (IO ())
+f2 = BG.unsafePerformIO hs_bindgen_fa90d405c15977a2
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memcpy@
+foreign import ccall unsafe "hs_bindgen_481e3a75205c85f2" hs_bindgen_481e3a75205c85f2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memcpy@
+hs_bindgen_481e3a75205c85f2 :: IO (BG.FunPtr (BG.Ptr BG.Void -> PtrConst.PtrConst BG.Void -> Size_t -> IO (BG.Ptr BG.Void)))
+hs_bindgen_481e3a75205c85f2 =
+  fmap BG.fromFFIType hs_bindgen_481e3a75205c85f2_base
+
+{-# NOINLINE my_memcpy #-}
+{-| __C declaration:__ @my_memcpy@
+
+    __defined at:__ @functions\/fun_attributes.h 85:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memcpy :: BG.FunPtr (BG.Ptr BG.Void -> PtrConst.PtrConst BG.Void -> Size_t -> IO (BG.Ptr BG.Void))
+my_memcpy =
+  BG.unsafePerformIO hs_bindgen_481e3a75205c85f2
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_fatal@
+foreign import ccall unsafe "hs_bindgen_99cc62837ebec657" hs_bindgen_99cc62837ebec657_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_fatal@
+hs_bindgen_99cc62837ebec657 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_99cc62837ebec657 =
+  fmap BG.fromFFIType hs_bindgen_99cc62837ebec657_base
+
+{-# NOINLINE fatal #-}
+{-| __C declaration:__ @fatal@
+
+    __defined at:__ @functions\/fun_attributes.h 102:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fatal :: BG.FunPtr (IO ())
+fatal =
+  BG.unsafePerformIO hs_bindgen_99cc62837ebec657
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_hash@
+foreign import ccall unsafe "hs_bindgen_196cbfce2a9df94f" hs_bindgen_196cbfce2a9df94f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_hash@
+hs_bindgen_196cbfce2a9df94f :: IO (BG.FunPtr (BG.Ptr BG.CChar -> IO BG.CInt))
+hs_bindgen_196cbfce2a9df94f =
+  fmap BG.fromFFIType hs_bindgen_196cbfce2a9df94f_base
+
+{-# NOINLINE hash #-}
+{-| __C declaration:__ @hash@
+
+    __defined at:__ @functions\/fun_attributes.h 110:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+hash :: BG.FunPtr (BG.Ptr BG.CChar -> IO BG.CInt)
+hash = BG.unsafePerformIO hs_bindgen_196cbfce2a9df94f
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_mymalloc@
+foreign import ccall unsafe "hs_bindgen_ae6b503283507bd2" hs_bindgen_ae6b503283507bd2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_mymalloc@
+hs_bindgen_ae6b503283507bd2 :: IO (BG.FunPtr (Size_t -> IO (BG.Ptr BG.Void)))
+hs_bindgen_ae6b503283507bd2 =
+  fmap BG.fromFFIType hs_bindgen_ae6b503283507bd2_base
+
+{-# NOINLINE mymalloc #-}
+{-| __C declaration:__ @mymalloc@
+
+    __defined at:__ @functions\/fun_attributes.h 115:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+mymalloc :: BG.FunPtr (Size_t -> IO (BG.Ptr BG.Void))
+mymalloc =
+  BG.unsafePerformIO hs_bindgen_ae6b503283507bd2
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_foobar@
+foreign import ccall unsafe "hs_bindgen_ad3e5c88477c9e92" hs_bindgen_ad3e5c88477c9e92_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_foobar@
+hs_bindgen_ad3e5c88477c9e92 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_ad3e5c88477c9e92 =
+  fmap BG.fromFFIType hs_bindgen_ad3e5c88477c9e92_base
+
+{-# NOINLINE foobar #-}
+{-| __C declaration:__ @foobar@
+
+    __defined at:__ @functions\/fun_attributes.h 119:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+foobar :: BG.FunPtr (IO ())
+foobar =
+  BG.unsafePerformIO hs_bindgen_ad3e5c88477c9e92
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_core2_func@
+foreign import ccall unsafe "hs_bindgen_508f28109ff2076e" hs_bindgen_508f28109ff2076e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_core2_func@
+hs_bindgen_508f28109ff2076e :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_508f28109ff2076e =
+  fmap BG.fromFFIType hs_bindgen_508f28109ff2076e_base
+
+{-# NOINLINE core2_func #-}
+{-| __C declaration:__ @core2_func@
+
+    __defined at:__ @functions\/fun_attributes.h 126:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+core2_func :: BG.FunPtr (IO BG.CInt)
+core2_func =
+  BG.unsafePerformIO hs_bindgen_508f28109ff2076e
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_sse3_func@
+foreign import ccall unsafe "hs_bindgen_6e4f5b53b36a3ecb" hs_bindgen_6e4f5b53b36a3ecb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_sse3_func@
+hs_bindgen_6e4f5b53b36a3ecb :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_6e4f5b53b36a3ecb =
+  fmap BG.fromFFIType hs_bindgen_6e4f5b53b36a3ecb_base
+
+{-# NOINLINE sse3_func #-}
+{-| __C declaration:__ @sse3_func@
+
+    __defined at:__ @functions\/fun_attributes.h 127:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+sse3_func :: BG.FunPtr (IO BG.CInt)
+sse3_func =
+  BG.unsafePerformIO hs_bindgen_6e4f5b53b36a3ecb
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_e39d5186f5da6c3f" hs_bindgen_e39d5186f5da6c3f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_f3@
+hs_bindgen_e39d5186f5da6c3f :: IO (BG.FunPtr (IO ()))
+hs_bindgen_e39d5186f5da6c3f =
+  fmap BG.fromFFIType hs_bindgen_e39d5186f5da6c3f_base
+
+{-# NOINLINE f3 #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @functions\/fun_attributes.h 131:49@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f3 :: BG.FunPtr (IO ())
+f3 = BG.unsafePerformIO hs_bindgen_e39d5186f5da6c3f
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_fn@
+foreign import ccall unsafe "hs_bindgen_acb0e567f47dc0eb" hs_bindgen_acb0e567f47dc0eb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_fn@
+hs_bindgen_acb0e567f47dc0eb :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_acb0e567f47dc0eb =
+  fmap BG.fromFFIType hs_bindgen_acb0e567f47dc0eb_base
+
+{-# NOINLINE fn #-}
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/fun_attributes.h 136:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fn :: BG.FunPtr (IO BG.CInt)
+fn = BG.unsafePerformIO hs_bindgen_acb0e567f47dc0eb
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_y@
+foreign import ccall unsafe "hs_bindgen_a1f58949b267b87f" hs_bindgen_a1f58949b267b87f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_y@
+hs_bindgen_a1f58949b267b87f :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_a1f58949b267b87f =
+  fmap BG.fromFFIType hs_bindgen_a1f58949b267b87f_base
+
+{-# NOINLINE y #-}
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/fun_attributes.h 142:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+y :: BG.FunPtr (IO BG.CInt)
+y = BG.unsafePerformIO hs_bindgen_a1f58949b267b87f
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_z1@
+foreign import ccall unsafe "hs_bindgen_27c558455e5d5b1a" hs_bindgen_27c558455e5d5b1a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_z1@
+hs_bindgen_27c558455e5d5b1a :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_27c558455e5d5b1a =
+  fmap BG.fromFFIType hs_bindgen_27c558455e5d5b1a_base
+
+{-# NOINLINE z1 #-}
+{-| __C declaration:__ @z1@
+
+    __defined at:__ @functions\/fun_attributes.h 145:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z1 :: BG.FunPtr (IO BG.CInt)
+z1 = BG.unsafePerformIO hs_bindgen_27c558455e5d5b1a
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_z2@
+foreign import ccall unsafe "hs_bindgen_ef816c1d50bc7bb9" hs_bindgen_ef816c1d50bc7bb9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_z2@
+hs_bindgen_ef816c1d50bc7bb9 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_ef816c1d50bc7bb9 =
+  fmap BG.fromFFIType hs_bindgen_ef816c1d50bc7bb9_base
+
+{-# NOINLINE z2 #-}
+{-| __C declaration:__ @z2@
+
+    __defined at:__ @functions\/fun_attributes.h 148:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z2 :: BG.FunPtr (IO BG.CInt)
+z2 = BG.unsafePerformIO hs_bindgen_ef816c1d50bc7bb9
diff --git a/test-artefacts/fixtures/functions/fun_attributes/Example/Global.hs b/test-artefacts/fixtures/functions/fun_attributes/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes/Example/Global.hs
@@ -0,0 +1,42 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.i
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/fun_attributes.h>"
+  , "/* test_functionsfun_attributes_Example_get_i */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_cd32cb4982dd2d1a (void)"
+  , "{"
+  , "  return &i;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_i@
+foreign import ccall unsafe "hs_bindgen_cd32cb4982dd2d1a" hs_bindgen_cd32cb4982dd2d1a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_get_i@
+hs_bindgen_cd32cb4982dd2d1a :: IO (BG.Ptr BG.CInt)
+hs_bindgen_cd32cb4982dd2d1a =
+  fmap BG.fromFFIType hs_bindgen_cd32cb4982dd2d1a_base
+
+{-# NOINLINE i #-}
+{-| __C declaration:__ @i@
+
+    __defined at:__ @functions\/fun_attributes.h 132:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+i :: BG.Ptr BG.CInt
+i = BG.unsafePerformIO hs_bindgen_cd32cb4982dd2d1a
diff --git a/test-artefacts/fixtures/functions/fun_attributes/Example/Safe.hs b/test-artefacts/fixtures/functions/fun_attributes/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes/Example/Safe.hs
@@ -0,0 +1,707 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.__f1
+    , Example.Safe.f1
+    , Example.Safe.my_memalign
+    , Example.Safe.my_calloc
+    , Example.Safe.my_realloc
+    , Example.Safe.my_alloc1
+    , Example.Safe.my_alloc2
+    , Example.Safe.square
+    , Example.Safe.old_fn_deprecated
+    , Example.Safe.my_dgettext
+    , Example.Safe.fdopen
+    , Example.Safe.f2
+    , Example.Safe.my_memcpy
+    , Example.Safe.fatal
+    , Example.Safe.hash
+    , Example.Safe.mymalloc
+    , Example.Safe.foobar
+    , Example.Safe.core2_func
+    , Example.Safe.sse3_func
+    , Example.Safe.f3
+    , Example.Safe.fn
+    , Example.Safe.y
+    , Example.Safe.z1
+    , Example.Safe.z2
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/fun_attributes.h>"
+  , "void hs_bindgen_0560fe42a40f777f (void)"
+  , "{"
+  , "  (__f1)();"
+  , "}"
+  , "void hs_bindgen_1a4676387075dc40 (void)"
+  , "{"
+  , "  (f1)();"
+  , "}"
+  , "void *hs_bindgen_63adcb061045c5ac ("
+  , "  size_t arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (my_memalign)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_733b29547ce864f6 ("
+  , "  size_t arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (my_calloc)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_4c69efa2a8a2b7c0 ("
+  , "  void *arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (my_realloc)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_1eae846583dd415c ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return (my_alloc1)(arg1);"
+  , "}"
+  , "void *hs_bindgen_790482b4016de326 ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return (my_alloc2)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_3f72dedf649beccd ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_a8f71f2272dae572 (void)"
+  , "{"
+  , "  return (old_fn_deprecated)();"
+  , "}"
+  , "char *hs_bindgen_11a623401451cca5 ("
+  , "  char *arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (my_dgettext)(arg1, arg2);"
+  , "}"
+  , "FILE *hs_bindgen_30143e337a327ef0 ("
+  , "  signed int arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (fdopen)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7b2c420d0febf062 (void)"
+  , "{"
+  , "  (f2)();"
+  , "}"
+  , "void *hs_bindgen_af1f131d9e98a2ff ("
+  , "  void *arg1,"
+  , "  void const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (my_memcpy)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_0afa6ff8226517c8 (void)"
+  , "{"
+  , "  (fatal)();"
+  , "}"
+  , "signed int hs_bindgen_948fc14ee9d5d56f ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (hash)(arg1);"
+  , "}"
+  , "void *hs_bindgen_60517fb6ae2517ff ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return (mymalloc)(arg1);"
+  , "}"
+  , "void hs_bindgen_f1451b46f1bd3813 (void)"
+  , "{"
+  , "  (foobar)();"
+  , "}"
+  , "signed int hs_bindgen_07f5843dd5c65611 (void)"
+  , "{"
+  , "  return (core2_func)();"
+  , "}"
+  , "signed int hs_bindgen_2c7c9e9a45042696 (void)"
+  , "{"
+  , "  return (sse3_func)();"
+  , "}"
+  , "void hs_bindgen_4ff2d7abd6099082 (void)"
+  , "{"
+  , "  (f3)();"
+  , "}"
+  , "signed int hs_bindgen_c3ae037518ec9b4e (void)"
+  , "{"
+  , "  return (fn)();"
+  , "}"
+  , "signed int hs_bindgen_da9708096863a242 (void)"
+  , "{"
+  , "  return (y)();"
+  , "}"
+  , "signed int hs_bindgen_1b5a954ee8d33472 (void)"
+  , "{"
+  , "  return (z1)();"
+  , "}"
+  , "signed int hs_bindgen_871d232f0a2386a3 (void)"
+  , "{"
+  , "  return (z2)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe___f1@
+foreign import ccall safe "hs_bindgen_0560fe42a40f777f" hs_bindgen_0560fe42a40f777f_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe___f1@
+hs_bindgen_0560fe42a40f777f :: IO ()
+hs_bindgen_0560fe42a40f777f =
+  hs_bindgen_0560fe42a40f777f_base
+
+{-| __C declaration:__ @__f1@
+
+    __defined at:__ @functions\/fun_attributes.h 16:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+__f1 :: IO ()
+__f1 = hs_bindgen_0560fe42a40f777f
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_1a4676387075dc40" hs_bindgen_1a4676387075dc40_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f1@
+hs_bindgen_1a4676387075dc40 :: IO ()
+hs_bindgen_1a4676387075dc40 =
+  hs_bindgen_1a4676387075dc40_base
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @functions\/fun_attributes.h 19:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f1 :: IO ()
+f1 = hs_bindgen_1a4676387075dc40
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memalign@
+foreign import ccall safe "hs_bindgen_63adcb061045c5ac" hs_bindgen_63adcb061045c5ac_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memalign@
+hs_bindgen_63adcb061045c5ac ::
+     Size_t
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_63adcb061045c5ac =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_63adcb061045c5ac_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @my_memalign@
+
+    __defined at:__ @functions\/fun_attributes.h 23:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memalign ::
+     Size_t
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+my_memalign = hs_bindgen_63adcb061045c5ac
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_calloc@
+foreign import ccall safe "hs_bindgen_733b29547ce864f6" hs_bindgen_733b29547ce864f6_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_calloc@
+hs_bindgen_733b29547ce864f6 ::
+     Size_t
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_733b29547ce864f6 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_733b29547ce864f6_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @my_calloc@
+
+    __defined at:__ @functions\/fun_attributes.h 28:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_calloc ::
+     Size_t
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+my_calloc = hs_bindgen_733b29547ce864f6
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_realloc@
+foreign import ccall safe "hs_bindgen_4c69efa2a8a2b7c0" hs_bindgen_4c69efa2a8a2b7c0_base ::
+     BG.Ptr BG.Void
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_realloc@
+hs_bindgen_4c69efa2a8a2b7c0 ::
+     BG.Ptr BG.Void
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_4c69efa2a8a2b7c0 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_4c69efa2a8a2b7c0_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @my_realloc@
+
+    __defined at:__ @functions\/fun_attributes.h 29:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_realloc ::
+     BG.Ptr BG.Void
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+my_realloc = hs_bindgen_4c69efa2a8a2b7c0
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc1@
+foreign import ccall safe "hs_bindgen_1eae846583dd415c" hs_bindgen_1eae846583dd415c_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc1@
+hs_bindgen_1eae846583dd415c ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_1eae846583dd415c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1eae846583dd415c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @my_alloc1@
+
+    __defined at:__ @functions\/fun_attributes.h 34:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc1 ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+my_alloc1 = hs_bindgen_1eae846583dd415c
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc2@
+foreign import ccall safe "hs_bindgen_790482b4016de326" hs_bindgen_790482b4016de326_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc2@
+hs_bindgen_790482b4016de326 ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_790482b4016de326 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_790482b4016de326_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @my_alloc2@
+
+    __defined at:__ @functions\/fun_attributes.h 35:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc2 ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+my_alloc2 = hs_bindgen_790482b4016de326
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_square@
+foreign import ccall safe "hs_bindgen_3f72dedf649beccd" hs_bindgen_3f72dedf649beccd_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_square@
+hs_bindgen_3f72dedf649beccd ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_3f72dedf649beccd =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_3f72dedf649beccd_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @functions\/fun_attributes.h 39:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+square ::
+     BG.CInt
+  -> BG.CInt
+square = hs_bindgen_3f72dedf649beccd
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_old_fn_deprecated@
+foreign import ccall safe "hs_bindgen_a8f71f2272dae572" hs_bindgen_a8f71f2272dae572_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_old_fn_deprecated@
+hs_bindgen_a8f71f2272dae572 :: IO BG.CInt
+hs_bindgen_a8f71f2272dae572 =
+  fmap BG.fromFFIType hs_bindgen_a8f71f2272dae572_base
+
+{-| __C declaration:__ @old_fn_deprecated@
+
+    __defined at:__ @functions\/fun_attributes.h 48:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+old_fn_deprecated :: IO BG.CInt
+old_fn_deprecated = hs_bindgen_a8f71f2272dae572
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_dgettext@
+foreign import ccall safe "hs_bindgen_11a623401451cca5" hs_bindgen_11a623401451cca5_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_dgettext@
+hs_bindgen_11a623401451cca5 ::
+     BG.Ptr BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_11a623401451cca5 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_11a623401451cca5_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @my_dgettext@
+
+    __defined at:__ @functions\/fun_attributes.h 64:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_dgettext ::
+     BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @my_domain@
+  -> PtrConst.PtrConst BG.CChar
+     -- ^ __C declaration:__ @my_format@
+  -> IO (BG.Ptr BG.CChar)
+my_dgettext = hs_bindgen_11a623401451cca5
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fdopen@
+foreign import ccall safe "hs_bindgen_30143e337a327ef0" hs_bindgen_30143e337a327ef0_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fdopen@
+hs_bindgen_30143e337a327ef0 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CChar
+  -> IO (BG.Ptr FILE)
+hs_bindgen_30143e337a327ef0 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_30143e337a327ef0_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @fdopen@
+
+    __defined at:__ @functions\/fun_attributes.h 75:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fdopen ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CChar
+  -> IO (BG.Ptr FILE)
+fdopen = hs_bindgen_30143e337a327ef0
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_7b2c420d0febf062" hs_bindgen_7b2c420d0febf062_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f2@
+hs_bindgen_7b2c420d0febf062 :: IO ()
+hs_bindgen_7b2c420d0febf062 =
+  hs_bindgen_7b2c420d0febf062_base
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/fun_attributes.h 79:65@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f2 :: IO ()
+f2 = hs_bindgen_7b2c420d0febf062
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memcpy@
+foreign import ccall safe "hs_bindgen_af1f131d9e98a2ff" hs_bindgen_af1f131d9e98a2ff_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memcpy@
+hs_bindgen_af1f131d9e98a2ff ::
+     BG.Ptr BG.Void
+  -> PtrConst.PtrConst BG.Void
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_af1f131d9e98a2ff =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_af1f131d9e98a2ff_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @my_memcpy@
+
+    __defined at:__ @functions\/fun_attributes.h 85:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memcpy ::
+     BG.Ptr BG.Void
+     -- ^ __C declaration:__ @dest@
+  -> PtrConst.PtrConst BG.Void
+     -- ^ __C declaration:__ @src@
+  -> Size_t
+     -- ^ __C declaration:__ @len@
+  -> IO (BG.Ptr BG.Void)
+my_memcpy = hs_bindgen_af1f131d9e98a2ff
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fatal@
+foreign import ccall safe "hs_bindgen_0afa6ff8226517c8" hs_bindgen_0afa6ff8226517c8_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fatal@
+hs_bindgen_0afa6ff8226517c8 :: IO ()
+hs_bindgen_0afa6ff8226517c8 =
+  hs_bindgen_0afa6ff8226517c8_base
+
+{-| __C declaration:__ @fatal@
+
+    __defined at:__ @functions\/fun_attributes.h 102:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fatal :: IO ()
+fatal = hs_bindgen_0afa6ff8226517c8
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_hash@
+foreign import ccall safe "hs_bindgen_948fc14ee9d5d56f" hs_bindgen_948fc14ee9d5d56f_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_hash@
+hs_bindgen_948fc14ee9d5d56f ::
+     BG.Ptr BG.CChar
+  -> IO BG.CInt
+hs_bindgen_948fc14ee9d5d56f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_948fc14ee9d5d56f_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @functions\/fun_attributes.h 110:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+hash ::
+     BG.Ptr BG.CChar
+  -> IO BG.CInt
+hash = hs_bindgen_948fc14ee9d5d56f
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_mymalloc@
+foreign import ccall safe "hs_bindgen_60517fb6ae2517ff" hs_bindgen_60517fb6ae2517ff_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_mymalloc@
+hs_bindgen_60517fb6ae2517ff ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_60517fb6ae2517ff =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_60517fb6ae2517ff_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @mymalloc@
+
+    __defined at:__ @functions\/fun_attributes.h 115:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+mymalloc ::
+     Size_t
+     -- ^ __C declaration:__ @len@
+  -> IO (BG.Ptr BG.Void)
+mymalloc = hs_bindgen_60517fb6ae2517ff
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_foobar@
+foreign import ccall safe "hs_bindgen_f1451b46f1bd3813" hs_bindgen_f1451b46f1bd3813_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_foobar@
+hs_bindgen_f1451b46f1bd3813 :: IO ()
+hs_bindgen_f1451b46f1bd3813 =
+  hs_bindgen_f1451b46f1bd3813_base
+
+{-| __C declaration:__ @foobar@
+
+    __defined at:__ @functions\/fun_attributes.h 119:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+foobar :: IO ()
+foobar = hs_bindgen_f1451b46f1bd3813
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_core2_func@
+foreign import ccall safe "hs_bindgen_07f5843dd5c65611" hs_bindgen_07f5843dd5c65611_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_core2_func@
+hs_bindgen_07f5843dd5c65611 :: IO BG.CInt
+hs_bindgen_07f5843dd5c65611 =
+  fmap BG.fromFFIType hs_bindgen_07f5843dd5c65611_base
+
+{-| __C declaration:__ @core2_func@
+
+    __defined at:__ @functions\/fun_attributes.h 126:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+core2_func :: IO BG.CInt
+core2_func = hs_bindgen_07f5843dd5c65611
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_sse3_func@
+foreign import ccall safe "hs_bindgen_2c7c9e9a45042696" hs_bindgen_2c7c9e9a45042696_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_sse3_func@
+hs_bindgen_2c7c9e9a45042696 :: IO BG.CInt
+hs_bindgen_2c7c9e9a45042696 =
+  fmap BG.fromFFIType hs_bindgen_2c7c9e9a45042696_base
+
+{-| __C declaration:__ @sse3_func@
+
+    __defined at:__ @functions\/fun_attributes.h 127:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+sse3_func :: IO BG.CInt
+sse3_func = hs_bindgen_2c7c9e9a45042696
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_4ff2d7abd6099082" hs_bindgen_4ff2d7abd6099082_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f3@
+hs_bindgen_4ff2d7abd6099082 :: IO ()
+hs_bindgen_4ff2d7abd6099082 =
+  hs_bindgen_4ff2d7abd6099082_base
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @functions\/fun_attributes.h 131:49@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f3 :: IO ()
+f3 = hs_bindgen_4ff2d7abd6099082
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fn@
+foreign import ccall safe "hs_bindgen_c3ae037518ec9b4e" hs_bindgen_c3ae037518ec9b4e_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fn@
+hs_bindgen_c3ae037518ec9b4e :: IO BG.CInt
+hs_bindgen_c3ae037518ec9b4e =
+  fmap BG.fromFFIType hs_bindgen_c3ae037518ec9b4e_base
+
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/fun_attributes.h 136:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fn :: IO BG.CInt
+fn = hs_bindgen_c3ae037518ec9b4e
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_y@
+foreign import ccall safe "hs_bindgen_da9708096863a242" hs_bindgen_da9708096863a242_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_y@
+hs_bindgen_da9708096863a242 :: IO BG.CInt
+hs_bindgen_da9708096863a242 =
+  fmap BG.fromFFIType hs_bindgen_da9708096863a242_base
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/fun_attributes.h 142:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+y :: IO BG.CInt
+y = hs_bindgen_da9708096863a242
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z1@
+foreign import ccall safe "hs_bindgen_1b5a954ee8d33472" hs_bindgen_1b5a954ee8d33472_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z1@
+hs_bindgen_1b5a954ee8d33472 :: IO BG.CInt
+hs_bindgen_1b5a954ee8d33472 =
+  fmap BG.fromFFIType hs_bindgen_1b5a954ee8d33472_base
+
+{-| __C declaration:__ @z1@
+
+    __defined at:__ @functions\/fun_attributes.h 145:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z1 :: IO BG.CInt
+z1 = hs_bindgen_1b5a954ee8d33472
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z2@
+foreign import ccall safe "hs_bindgen_871d232f0a2386a3" hs_bindgen_871d232f0a2386a3_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z2@
+hs_bindgen_871d232f0a2386a3 :: IO BG.CInt
+hs_bindgen_871d232f0a2386a3 =
+  fmap BG.fromFFIType hs_bindgen_871d232f0a2386a3_base
+
+{-| __C declaration:__ @z2@
+
+    __defined at:__ @functions\/fun_attributes.h 148:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z2 :: IO BG.CInt
+z2 = hs_bindgen_871d232f0a2386a3
diff --git a/test-artefacts/fixtures/functions/fun_attributes/Example/Unsafe.hs b/test-artefacts/fixtures/functions/fun_attributes/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes/Example/Unsafe.hs
@@ -0,0 +1,707 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.__f1
+    , Example.Unsafe.f1
+    , Example.Unsafe.my_memalign
+    , Example.Unsafe.my_calloc
+    , Example.Unsafe.my_realloc
+    , Example.Unsafe.my_alloc1
+    , Example.Unsafe.my_alloc2
+    , Example.Unsafe.square
+    , Example.Unsafe.old_fn_deprecated
+    , Example.Unsafe.my_dgettext
+    , Example.Unsafe.fdopen
+    , Example.Unsafe.f2
+    , Example.Unsafe.my_memcpy
+    , Example.Unsafe.fatal
+    , Example.Unsafe.hash
+    , Example.Unsafe.mymalloc
+    , Example.Unsafe.foobar
+    , Example.Unsafe.core2_func
+    , Example.Unsafe.sse3_func
+    , Example.Unsafe.f3
+    , Example.Unsafe.fn
+    , Example.Unsafe.y
+    , Example.Unsafe.z1
+    , Example.Unsafe.z2
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/fun_attributes.h>"
+  , "void hs_bindgen_52759f125bf2b140 (void)"
+  , "{"
+  , "  (__f1)();"
+  , "}"
+  , "void hs_bindgen_80bb9d1445e894ca (void)"
+  , "{"
+  , "  (f1)();"
+  , "}"
+  , "void *hs_bindgen_ebf8d1f009064640 ("
+  , "  size_t arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (my_memalign)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_a062d8e757dc6824 ("
+  , "  size_t arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (my_calloc)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_899561850b80c305 ("
+  , "  void *arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (my_realloc)(arg1, arg2);"
+  , "}"
+  , "void *hs_bindgen_d5eb45f9de991bca ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return (my_alloc1)(arg1);"
+  , "}"
+  , "void *hs_bindgen_a7aa3949fa7cae3f ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return (my_alloc2)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_dbe49279b6585cea ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f51c36dd7e8f4133 (void)"
+  , "{"
+  , "  return (old_fn_deprecated)();"
+  , "}"
+  , "char *hs_bindgen_bf6f222178bd7c31 ("
+  , "  char *arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (my_dgettext)(arg1, arg2);"
+  , "}"
+  , "FILE *hs_bindgen_830629dc11c2fdfc ("
+  , "  signed int arg1,"
+  , "  char const *arg2"
+  , ")"
+  , "{"
+  , "  return (fdopen)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a5f34f5beb1c74f1 (void)"
+  , "{"
+  , "  (f2)();"
+  , "}"
+  , "void *hs_bindgen_0f3586df383dffea ("
+  , "  void *arg1,"
+  , "  void const *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (my_memcpy)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_667d3280d945cd0c (void)"
+  , "{"
+  , "  (fatal)();"
+  , "}"
+  , "signed int hs_bindgen_394fd662d5fb7aa6 ("
+  , "  char *arg1"
+  , ")"
+  , "{"
+  , "  return (hash)(arg1);"
+  , "}"
+  , "void *hs_bindgen_5594a84fb65782e1 ("
+  , "  size_t arg1"
+  , ")"
+  , "{"
+  , "  return (mymalloc)(arg1);"
+  , "}"
+  , "void hs_bindgen_1f19397195b32853 (void)"
+  , "{"
+  , "  (foobar)();"
+  , "}"
+  , "signed int hs_bindgen_f80f9b58791a9cf2 (void)"
+  , "{"
+  , "  return (core2_func)();"
+  , "}"
+  , "signed int hs_bindgen_6a951361c18a91a0 (void)"
+  , "{"
+  , "  return (sse3_func)();"
+  , "}"
+  , "void hs_bindgen_1d7f2cdf95b3bfa3 (void)"
+  , "{"
+  , "  (f3)();"
+  , "}"
+  , "signed int hs_bindgen_c1fff017165ba0e1 (void)"
+  , "{"
+  , "  return (fn)();"
+  , "}"
+  , "signed int hs_bindgen_67dc9f91fbda20c7 (void)"
+  , "{"
+  , "  return (y)();"
+  , "}"
+  , "signed int hs_bindgen_92dc5692c137b4da (void)"
+  , "{"
+  , "  return (z1)();"
+  , "}"
+  , "signed int hs_bindgen_6e662527d3f0decc (void)"
+  , "{"
+  , "  return (z2)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe___f1@
+foreign import ccall unsafe "hs_bindgen_52759f125bf2b140" hs_bindgen_52759f125bf2b140_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe___f1@
+hs_bindgen_52759f125bf2b140 :: IO ()
+hs_bindgen_52759f125bf2b140 =
+  hs_bindgen_52759f125bf2b140_base
+
+{-| __C declaration:__ @__f1@
+
+    __defined at:__ @functions\/fun_attributes.h 16:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+__f1 :: IO ()
+__f1 = hs_bindgen_52759f125bf2b140
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_80bb9d1445e894ca" hs_bindgen_80bb9d1445e894ca_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f1@
+hs_bindgen_80bb9d1445e894ca :: IO ()
+hs_bindgen_80bb9d1445e894ca =
+  hs_bindgen_80bb9d1445e894ca_base
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @functions\/fun_attributes.h 19:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f1 :: IO ()
+f1 = hs_bindgen_80bb9d1445e894ca
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memalign@
+foreign import ccall unsafe "hs_bindgen_ebf8d1f009064640" hs_bindgen_ebf8d1f009064640_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memalign@
+hs_bindgen_ebf8d1f009064640 ::
+     Size_t
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_ebf8d1f009064640 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ebf8d1f009064640_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @my_memalign@
+
+    __defined at:__ @functions\/fun_attributes.h 23:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memalign ::
+     Size_t
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+my_memalign = hs_bindgen_ebf8d1f009064640
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_calloc@
+foreign import ccall unsafe "hs_bindgen_a062d8e757dc6824" hs_bindgen_a062d8e757dc6824_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_calloc@
+hs_bindgen_a062d8e757dc6824 ::
+     Size_t
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_a062d8e757dc6824 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a062d8e757dc6824_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @my_calloc@
+
+    __defined at:__ @functions\/fun_attributes.h 28:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_calloc ::
+     Size_t
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+my_calloc = hs_bindgen_a062d8e757dc6824
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_realloc@
+foreign import ccall unsafe "hs_bindgen_899561850b80c305" hs_bindgen_899561850b80c305_base ::
+     BG.Ptr BG.Void
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_realloc@
+hs_bindgen_899561850b80c305 ::
+     BG.Ptr BG.Void
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_899561850b80c305 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_899561850b80c305_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @my_realloc@
+
+    __defined at:__ @functions\/fun_attributes.h 29:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_realloc ::
+     BG.Ptr BG.Void
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+my_realloc = hs_bindgen_899561850b80c305
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc1@
+foreign import ccall unsafe "hs_bindgen_d5eb45f9de991bca" hs_bindgen_d5eb45f9de991bca_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc1@
+hs_bindgen_d5eb45f9de991bca ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_d5eb45f9de991bca =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d5eb45f9de991bca_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @my_alloc1@
+
+    __defined at:__ @functions\/fun_attributes.h 34:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc1 ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+my_alloc1 = hs_bindgen_d5eb45f9de991bca
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc2@
+foreign import ccall unsafe "hs_bindgen_a7aa3949fa7cae3f" hs_bindgen_a7aa3949fa7cae3f_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc2@
+hs_bindgen_a7aa3949fa7cae3f ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_a7aa3949fa7cae3f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a7aa3949fa7cae3f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @my_alloc2@
+
+    __defined at:__ @functions\/fun_attributes.h 35:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc2 ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+my_alloc2 = hs_bindgen_a7aa3949fa7cae3f
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_square@
+foreign import ccall unsafe "hs_bindgen_dbe49279b6585cea" hs_bindgen_dbe49279b6585cea_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_square@
+hs_bindgen_dbe49279b6585cea ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_dbe49279b6585cea =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_dbe49279b6585cea_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @functions\/fun_attributes.h 39:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+square ::
+     BG.CInt
+  -> BG.CInt
+square = hs_bindgen_dbe49279b6585cea
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_old_fn_deprecated@
+foreign import ccall unsafe "hs_bindgen_f51c36dd7e8f4133" hs_bindgen_f51c36dd7e8f4133_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_old_fn_deprecated@
+hs_bindgen_f51c36dd7e8f4133 :: IO BG.CInt
+hs_bindgen_f51c36dd7e8f4133 =
+  fmap BG.fromFFIType hs_bindgen_f51c36dd7e8f4133_base
+
+{-| __C declaration:__ @old_fn_deprecated@
+
+    __defined at:__ @functions\/fun_attributes.h 48:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+old_fn_deprecated :: IO BG.CInt
+old_fn_deprecated = hs_bindgen_f51c36dd7e8f4133
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_dgettext@
+foreign import ccall unsafe "hs_bindgen_bf6f222178bd7c31" hs_bindgen_bf6f222178bd7c31_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_dgettext@
+hs_bindgen_bf6f222178bd7c31 ::
+     BG.Ptr BG.CChar
+  -> PtrConst.PtrConst BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_bf6f222178bd7c31 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_bf6f222178bd7c31_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @my_dgettext@
+
+    __defined at:__ @functions\/fun_attributes.h 64:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_dgettext ::
+     BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @my_domain@
+  -> PtrConst.PtrConst BG.CChar
+     -- ^ __C declaration:__ @my_format@
+  -> IO (BG.Ptr BG.CChar)
+my_dgettext = hs_bindgen_bf6f222178bd7c31
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fdopen@
+foreign import ccall unsafe "hs_bindgen_830629dc11c2fdfc" hs_bindgen_830629dc11c2fdfc_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fdopen@
+hs_bindgen_830629dc11c2fdfc ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CChar
+  -> IO (BG.Ptr FILE)
+hs_bindgen_830629dc11c2fdfc =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_830629dc11c2fdfc_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @fdopen@
+
+    __defined at:__ @functions\/fun_attributes.h 75:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fdopen ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CChar
+  -> IO (BG.Ptr FILE)
+fdopen = hs_bindgen_830629dc11c2fdfc
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_a5f34f5beb1c74f1" hs_bindgen_a5f34f5beb1c74f1_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f2@
+hs_bindgen_a5f34f5beb1c74f1 :: IO ()
+hs_bindgen_a5f34f5beb1c74f1 =
+  hs_bindgen_a5f34f5beb1c74f1_base
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/fun_attributes.h 79:65@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f2 :: IO ()
+f2 = hs_bindgen_a5f34f5beb1c74f1
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memcpy@
+foreign import ccall unsafe "hs_bindgen_0f3586df383dffea" hs_bindgen_0f3586df383dffea_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memcpy@
+hs_bindgen_0f3586df383dffea ::
+     BG.Ptr BG.Void
+  -> PtrConst.PtrConst BG.Void
+  -> Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_0f3586df383dffea =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_0f3586df383dffea_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @my_memcpy@
+
+    __defined at:__ @functions\/fun_attributes.h 85:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memcpy ::
+     BG.Ptr BG.Void
+     -- ^ __C declaration:__ @dest@
+  -> PtrConst.PtrConst BG.Void
+     -- ^ __C declaration:__ @src@
+  -> Size_t
+     -- ^ __C declaration:__ @len@
+  -> IO (BG.Ptr BG.Void)
+my_memcpy = hs_bindgen_0f3586df383dffea
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fatal@
+foreign import ccall unsafe "hs_bindgen_667d3280d945cd0c" hs_bindgen_667d3280d945cd0c_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fatal@
+hs_bindgen_667d3280d945cd0c :: IO ()
+hs_bindgen_667d3280d945cd0c =
+  hs_bindgen_667d3280d945cd0c_base
+
+{-| __C declaration:__ @fatal@
+
+    __defined at:__ @functions\/fun_attributes.h 102:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fatal :: IO ()
+fatal = hs_bindgen_667d3280d945cd0c
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_hash@
+foreign import ccall unsafe "hs_bindgen_394fd662d5fb7aa6" hs_bindgen_394fd662d5fb7aa6_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_hash@
+hs_bindgen_394fd662d5fb7aa6 ::
+     BG.Ptr BG.CChar
+  -> IO BG.CInt
+hs_bindgen_394fd662d5fb7aa6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_394fd662d5fb7aa6_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @functions\/fun_attributes.h 110:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+hash ::
+     BG.Ptr BG.CChar
+  -> IO BG.CInt
+hash = hs_bindgen_394fd662d5fb7aa6
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_mymalloc@
+foreign import ccall unsafe "hs_bindgen_5594a84fb65782e1" hs_bindgen_5594a84fb65782e1_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_mymalloc@
+hs_bindgen_5594a84fb65782e1 ::
+     Size_t
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_5594a84fb65782e1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5594a84fb65782e1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @mymalloc@
+
+    __defined at:__ @functions\/fun_attributes.h 115:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+mymalloc ::
+     Size_t
+     -- ^ __C declaration:__ @len@
+  -> IO (BG.Ptr BG.Void)
+mymalloc = hs_bindgen_5594a84fb65782e1
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_foobar@
+foreign import ccall unsafe "hs_bindgen_1f19397195b32853" hs_bindgen_1f19397195b32853_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_foobar@
+hs_bindgen_1f19397195b32853 :: IO ()
+hs_bindgen_1f19397195b32853 =
+  hs_bindgen_1f19397195b32853_base
+
+{-| __C declaration:__ @foobar@
+
+    __defined at:__ @functions\/fun_attributes.h 119:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+foobar :: IO ()
+foobar = hs_bindgen_1f19397195b32853
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_core2_func@
+foreign import ccall unsafe "hs_bindgen_f80f9b58791a9cf2" hs_bindgen_f80f9b58791a9cf2_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_core2_func@
+hs_bindgen_f80f9b58791a9cf2 :: IO BG.CInt
+hs_bindgen_f80f9b58791a9cf2 =
+  fmap BG.fromFFIType hs_bindgen_f80f9b58791a9cf2_base
+
+{-| __C declaration:__ @core2_func@
+
+    __defined at:__ @functions\/fun_attributes.h 126:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+core2_func :: IO BG.CInt
+core2_func = hs_bindgen_f80f9b58791a9cf2
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_sse3_func@
+foreign import ccall unsafe "hs_bindgen_6a951361c18a91a0" hs_bindgen_6a951361c18a91a0_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_sse3_func@
+hs_bindgen_6a951361c18a91a0 :: IO BG.CInt
+hs_bindgen_6a951361c18a91a0 =
+  fmap BG.fromFFIType hs_bindgen_6a951361c18a91a0_base
+
+{-| __C declaration:__ @sse3_func@
+
+    __defined at:__ @functions\/fun_attributes.h 127:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+sse3_func :: IO BG.CInt
+sse3_func = hs_bindgen_6a951361c18a91a0
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_1d7f2cdf95b3bfa3" hs_bindgen_1d7f2cdf95b3bfa3_base ::
+     IO ()
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f3@
+hs_bindgen_1d7f2cdf95b3bfa3 :: IO ()
+hs_bindgen_1d7f2cdf95b3bfa3 =
+  hs_bindgen_1d7f2cdf95b3bfa3_base
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @functions\/fun_attributes.h 131:49@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f3 :: IO ()
+f3 = hs_bindgen_1d7f2cdf95b3bfa3
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fn@
+foreign import ccall unsafe "hs_bindgen_c1fff017165ba0e1" hs_bindgen_c1fff017165ba0e1_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fn@
+hs_bindgen_c1fff017165ba0e1 :: IO BG.CInt
+hs_bindgen_c1fff017165ba0e1 =
+  fmap BG.fromFFIType hs_bindgen_c1fff017165ba0e1_base
+
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/fun_attributes.h 136:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fn :: IO BG.CInt
+fn = hs_bindgen_c1fff017165ba0e1
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_y@
+foreign import ccall unsafe "hs_bindgen_67dc9f91fbda20c7" hs_bindgen_67dc9f91fbda20c7_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_y@
+hs_bindgen_67dc9f91fbda20c7 :: IO BG.CInt
+hs_bindgen_67dc9f91fbda20c7 =
+  fmap BG.fromFFIType hs_bindgen_67dc9f91fbda20c7_base
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/fun_attributes.h 142:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+y :: IO BG.CInt
+y = hs_bindgen_67dc9f91fbda20c7
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z1@
+foreign import ccall unsafe "hs_bindgen_92dc5692c137b4da" hs_bindgen_92dc5692c137b4da_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z1@
+hs_bindgen_92dc5692c137b4da :: IO BG.CInt
+hs_bindgen_92dc5692c137b4da =
+  fmap BG.fromFFIType hs_bindgen_92dc5692c137b4da_base
+
+{-| __C declaration:__ @z1@
+
+    __defined at:__ @functions\/fun_attributes.h 145:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z1 :: IO BG.CInt
+z1 = hs_bindgen_92dc5692c137b4da
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z2@
+foreign import ccall unsafe "hs_bindgen_6e662527d3f0decc" hs_bindgen_6e662527d3f0decc_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z2@
+hs_bindgen_6e662527d3f0decc :: IO BG.CInt
+hs_bindgen_6e662527d3f0decc =
+  fmap BG.fromFFIType hs_bindgen_6e662527d3f0decc_base
+
+{-| __C declaration:__ @z2@
+
+    __defined at:__ @functions\/fun_attributes.h 148:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z2 :: IO BG.CInt
+z2 = hs_bindgen_6e662527d3f0decc
diff --git a/test-artefacts/fixtures/functions/fun_attributes/bindingspec.yaml b/test-artefacts/fixtures/functions/fun_attributes/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes/bindingspec.yaml
@@ -0,0 +1,63 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/fun_attributes.h
+  cname: struct FILE
+  hsname: FILE
+- headers: functions/fun_attributes.h
+  cname: FILE
+  hsname: FILE
+- headers: functions/fun_attributes.h
+  cname: size_t
+  hsname: Size_t
+hstypes:
+- hsname: FILE
+  representation:
+    record:
+      constructor: FILE
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Size_t
+  representation:
+    newtype:
+      constructor: Size_t
+      fields:
+      - unwrapSize_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/fun_attributes/th.txt b/test-artefacts/fixtures/functions/fun_attributes/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes/th.txt
@@ -0,0 +1,2126 @@
+-- addDependentFile test-artefacts/headers/golden/functions/fun_attributes.h
+-- #include <functions/fun_attributes.h>
+-- void hs_bindgen_0560fe42a40f777f (void)
+-- {
+--   (__f1)();
+-- }
+-- void hs_bindgen_1a4676387075dc40 (void)
+-- {
+--   (f1)();
+-- }
+-- void *hs_bindgen_63adcb061045c5ac (
+--   size_t arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (my_memalign)(arg1, arg2);
+-- }
+-- void *hs_bindgen_733b29547ce864f6 (
+--   size_t arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (my_calloc)(arg1, arg2);
+-- }
+-- void *hs_bindgen_4c69efa2a8a2b7c0 (
+--   void *arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (my_realloc)(arg1, arg2);
+-- }
+-- void *hs_bindgen_1eae846583dd415c (
+--   size_t arg1
+-- )
+-- {
+--   return (my_alloc1)(arg1);
+-- }
+-- void *hs_bindgen_790482b4016de326 (
+--   size_t arg1
+-- )
+-- {
+--   return (my_alloc2)(arg1);
+-- }
+-- signed int hs_bindgen_3f72dedf649beccd (
+--   signed int arg1
+-- )
+-- {
+--   return (square)(arg1);
+-- }
+-- signed int hs_bindgen_a8f71f2272dae572 (void)
+-- {
+--   return (old_fn_deprecated)();
+-- }
+-- char *hs_bindgen_11a623401451cca5 (
+--   char *arg1,
+--   char const *arg2
+-- )
+-- {
+--   return (my_dgettext)(arg1, arg2);
+-- }
+-- FILE *hs_bindgen_30143e337a327ef0 (
+--   signed int arg1,
+--   char const *arg2
+-- )
+-- {
+--   return (fdopen)(arg1, arg2);
+-- }
+-- void hs_bindgen_7b2c420d0febf062 (void)
+-- {
+--   (f2)();
+-- }
+-- void *hs_bindgen_af1f131d9e98a2ff (
+--   void *arg1,
+--   void const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (my_memcpy)(arg1, arg2, arg3);
+-- }
+-- void hs_bindgen_0afa6ff8226517c8 (void)
+-- {
+--   (fatal)();
+-- }
+-- signed int hs_bindgen_948fc14ee9d5d56f (
+--   char *arg1
+-- )
+-- {
+--   return (hash)(arg1);
+-- }
+-- void *hs_bindgen_60517fb6ae2517ff (
+--   size_t arg1
+-- )
+-- {
+--   return (mymalloc)(arg1);
+-- }
+-- void hs_bindgen_f1451b46f1bd3813 (void)
+-- {
+--   (foobar)();
+-- }
+-- signed int hs_bindgen_07f5843dd5c65611 (void)
+-- {
+--   return (core2_func)();
+-- }
+-- signed int hs_bindgen_2c7c9e9a45042696 (void)
+-- {
+--   return (sse3_func)();
+-- }
+-- void hs_bindgen_4ff2d7abd6099082 (void)
+-- {
+--   (f3)();
+-- }
+-- signed int hs_bindgen_c3ae037518ec9b4e (void)
+-- {
+--   return (fn)();
+-- }
+-- signed int hs_bindgen_da9708096863a242 (void)
+-- {
+--   return (y)();
+-- }
+-- signed int hs_bindgen_1b5a954ee8d33472 (void)
+-- {
+--   return (z1)();
+-- }
+-- signed int hs_bindgen_871d232f0a2386a3 (void)
+-- {
+--   return (z2)();
+-- }
+-- void hs_bindgen_52759f125bf2b140 (void)
+-- {
+--   (__f1)();
+-- }
+-- void hs_bindgen_80bb9d1445e894ca (void)
+-- {
+--   (f1)();
+-- }
+-- void *hs_bindgen_ebf8d1f009064640 (
+--   size_t arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (my_memalign)(arg1, arg2);
+-- }
+-- void *hs_bindgen_a062d8e757dc6824 (
+--   size_t arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (my_calloc)(arg1, arg2);
+-- }
+-- void *hs_bindgen_899561850b80c305 (
+--   void *arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (my_realloc)(arg1, arg2);
+-- }
+-- void *hs_bindgen_d5eb45f9de991bca (
+--   size_t arg1
+-- )
+-- {
+--   return (my_alloc1)(arg1);
+-- }
+-- void *hs_bindgen_a7aa3949fa7cae3f (
+--   size_t arg1
+-- )
+-- {
+--   return (my_alloc2)(arg1);
+-- }
+-- signed int hs_bindgen_dbe49279b6585cea (
+--   signed int arg1
+-- )
+-- {
+--   return (square)(arg1);
+-- }
+-- signed int hs_bindgen_f51c36dd7e8f4133 (void)
+-- {
+--   return (old_fn_deprecated)();
+-- }
+-- char *hs_bindgen_bf6f222178bd7c31 (
+--   char *arg1,
+--   char const *arg2
+-- )
+-- {
+--   return (my_dgettext)(arg1, arg2);
+-- }
+-- FILE *hs_bindgen_830629dc11c2fdfc (
+--   signed int arg1,
+--   char const *arg2
+-- )
+-- {
+--   return (fdopen)(arg1, arg2);
+-- }
+-- void hs_bindgen_a5f34f5beb1c74f1 (void)
+-- {
+--   (f2)();
+-- }
+-- void *hs_bindgen_0f3586df383dffea (
+--   void *arg1,
+--   void const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (my_memcpy)(arg1, arg2, arg3);
+-- }
+-- void hs_bindgen_667d3280d945cd0c (void)
+-- {
+--   (fatal)();
+-- }
+-- signed int hs_bindgen_394fd662d5fb7aa6 (
+--   char *arg1
+-- )
+-- {
+--   return (hash)(arg1);
+-- }
+-- void *hs_bindgen_5594a84fb65782e1 (
+--   size_t arg1
+-- )
+-- {
+--   return (mymalloc)(arg1);
+-- }
+-- void hs_bindgen_1f19397195b32853 (void)
+-- {
+--   (foobar)();
+-- }
+-- signed int hs_bindgen_f80f9b58791a9cf2 (void)
+-- {
+--   return (core2_func)();
+-- }
+-- signed int hs_bindgen_6a951361c18a91a0 (void)
+-- {
+--   return (sse3_func)();
+-- }
+-- void hs_bindgen_1d7f2cdf95b3bfa3 (void)
+-- {
+--   (f3)();
+-- }
+-- signed int hs_bindgen_c1fff017165ba0e1 (void)
+-- {
+--   return (fn)();
+-- }
+-- signed int hs_bindgen_67dc9f91fbda20c7 (void)
+-- {
+--   return (y)();
+-- }
+-- signed int hs_bindgen_92dc5692c137b4da (void)
+-- {
+--   return (z1)();
+-- }
+-- signed int hs_bindgen_6e662527d3f0decc (void)
+-- {
+--   return (z2)();
+-- }
+-- /* test_functionsfun_attributes_Example_get___f1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_99da7108788a2cf4 (void)) (void)
+-- {
+--   return &__f1;
+-- }
+-- /* test_functionsfun_attributes_Example_get_f1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a0d2ec6ffc23fc5a (void)) (void)
+-- {
+--   return &f1;
+-- }
+-- /* test_functionsfun_attributes_Example_get_my_memalign */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_16a2a5a807cc26ec (void)) (
+--   size_t arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &my_memalign;
+-- }
+-- /* test_functionsfun_attributes_Example_get_my_calloc */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_976df97f9c9c1223 (void)) (
+--   size_t arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &my_calloc;
+-- }
+-- /* test_functionsfun_attributes_Example_get_my_realloc */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_4021d3c6eae30c8c (void)) (
+--   void *arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &my_realloc;
+-- }
+-- /* test_functionsfun_attributes_Example_get_my_alloc1 */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_2ca35d0827c76ff7 (void)) (
+--   size_t arg1
+-- )
+-- {
+--   return &my_alloc1;
+-- }
+-- /* test_functionsfun_attributes_Example_get_my_alloc2 */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_a43746fed9206f42 (void)) (
+--   size_t arg1
+-- )
+-- {
+--   return &my_alloc2;
+-- }
+-- /* test_functionsfun_attributes_Example_get_square */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_d41557222fd2ab94 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &square;
+-- }
+-- /* test_functionsfun_attributes_Example_get_old_fn_deprecated */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_beee43878922a900 (void)) (void)
+-- {
+--   return &old_fn_deprecated;
+-- }
+-- /* test_functionsfun_attributes_Example_get_my_dgettext */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_f95f43d50ed8f2b4 (void)) (
+--   char *arg1,
+--   char const *arg2
+-- )
+-- {
+--   return &my_dgettext;
+-- }
+-- /* test_functionsfun_attributes_Example_get_fdopen */
+-- __attribute__ ((const))
+-- FILE *(*hs_bindgen_986260288574592d (void)) (
+--   signed int arg1,
+--   char const *arg2
+-- )
+-- {
+--   return &fdopen;
+-- }
+-- /* test_functionsfun_attributes_Example_get_f2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fa90d405c15977a2 (void)) (void)
+-- {
+--   return &f2;
+-- }
+-- /* test_functionsfun_attributes_Example_get_my_memcpy */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_481e3a75205c85f2 (void)) (
+--   void *arg1,
+--   void const *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return &my_memcpy;
+-- }
+-- /* test_functionsfun_attributes_Example_get_fatal */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_99cc62837ebec657 (void)) (void)
+-- {
+--   return &fatal;
+-- }
+-- /* test_functionsfun_attributes_Example_get_hash */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_196cbfce2a9df94f (void)) (
+--   char *arg1
+-- )
+-- {
+--   return &hash;
+-- }
+-- /* test_functionsfun_attributes_Example_get_mymalloc */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_ae6b503283507bd2 (void)) (
+--   size_t arg1
+-- )
+-- {
+--   return &mymalloc;
+-- }
+-- /* test_functionsfun_attributes_Example_get_foobar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ad3e5c88477c9e92 (void)) (void)
+-- {
+--   return &foobar;
+-- }
+-- /* test_functionsfun_attributes_Example_get_core2_func */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_508f28109ff2076e (void)) (void)
+-- {
+--   return &core2_func;
+-- }
+-- /* test_functionsfun_attributes_Example_get_sse3_func */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_6e4f5b53b36a3ecb (void)) (void)
+-- {
+--   return &sse3_func;
+-- }
+-- /* test_functionsfun_attributes_Example_get_f3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e39d5186f5da6c3f (void)) (void)
+-- {
+--   return &f3;
+-- }
+-- /* test_functionsfun_attributes_Example_get_fn */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_acb0e567f47dc0eb (void)) (void)
+-- {
+--   return &fn;
+-- }
+-- /* test_functionsfun_attributes_Example_get_y */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_a1f58949b267b87f (void)) (void)
+-- {
+--   return &y;
+-- }
+-- /* test_functionsfun_attributes_Example_get_z1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_27c558455e5d5b1a (void)) (void)
+-- {
+--   return &z1;
+-- }
+-- /* test_functionsfun_attributes_Example_get_z2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ef816c1d50bc7bb9 (void)) (void)
+-- {
+--   return &z2;
+-- }
+-- /* test_functionsfun_attributes_Example_get_i */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_cd32cb4982dd2d1a (void)
+-- {
+--   return &i;
+-- }
+{-| __C declaration:__ @struct FILE@
+
+    __defined at:__ @functions\/fun_attributes.h 7:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+data FILE = FILE {} deriving stock (Eq, Generic, Show)
+instance StaticSize FILE
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw FILE
+    where readRaw = \ptr_0 -> pure FILE
+instance WriteRaw FILE
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       FILE -> pure ()
+deriving via (EquivStorable FILE) instance Storable FILE
+deriving via (IsStructViaReadRaw FILE) instance IsStruct FILE
+{-| __C declaration:__ @size_t@
+
+    __defined at:__ @functions\/fun_attributes.h 8:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+newtype Size_t
+    = Size_t {unwrapSize_t :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapSize_t" Size_t ty
+    where hasField = \x_0 -> (\y_1 -> Size_t{unwrapSize_t = y_1},
+                              getField @"unwrapSize_t" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapSize_t" (Ptr Size_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSize_t")
+instance HasCField Size_t "unwrapSize_t"
+    where type CFieldType Size_t "unwrapSize_t" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionsfun_attributes_Example_Safe___f1@
+foreign import ccall safe "hs_bindgen_0560fe42a40f777f" hs_bindgen_0560fe42a40f777f_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe___f1@
+hs_bindgen_0560fe42a40f777f :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe___f1@
+hs_bindgen_0560fe42a40f777f = hs_bindgen_0560fe42a40f777f_base
+{-| __C declaration:__ @__f1@
+
+    __defined at:__ @functions\/fun_attributes.h 16:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+__f1_safe :: IO ()
+{-| __C declaration:__ @__f1@
+
+    __defined at:__ @functions\/fun_attributes.h 16:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+__f1_safe = hs_bindgen_0560fe42a40f777f
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_1a4676387075dc40" hs_bindgen_1a4676387075dc40_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f1@
+hs_bindgen_1a4676387075dc40 :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f1@
+hs_bindgen_1a4676387075dc40 = hs_bindgen_1a4676387075dc40_base
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @functions\/fun_attributes.h 19:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f1_safe :: IO ()
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @functions\/fun_attributes.h 19:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f1_safe = hs_bindgen_1a4676387075dc40
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memalign@
+foreign import ccall safe "hs_bindgen_63adcb061045c5ac" hs_bindgen_63adcb061045c5ac_base ::
+    CInt
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memalign@
+hs_bindgen_63adcb061045c5ac :: Size_t -> Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memalign@
+hs_bindgen_63adcb061045c5ac = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_63adcb061045c5ac_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @my_memalign@
+
+    __defined at:__ @functions\/fun_attributes.h 23:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memalign_safe :: Size_t -> Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_memalign@
+
+    __defined at:__ @functions\/fun_attributes.h 23:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memalign_safe = hs_bindgen_63adcb061045c5ac
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_calloc@
+foreign import ccall safe "hs_bindgen_733b29547ce864f6" hs_bindgen_733b29547ce864f6_base ::
+    CInt
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_calloc@
+hs_bindgen_733b29547ce864f6 :: Size_t -> Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_calloc@
+hs_bindgen_733b29547ce864f6 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_733b29547ce864f6_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @my_calloc@
+
+    __defined at:__ @functions\/fun_attributes.h 28:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_calloc_safe :: Size_t -> Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_calloc@
+
+    __defined at:__ @functions\/fun_attributes.h 28:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_calloc_safe = hs_bindgen_733b29547ce864f6
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_realloc@
+foreign import ccall safe "hs_bindgen_4c69efa2a8a2b7c0" hs_bindgen_4c69efa2a8a2b7c0_base ::
+    Ptr Void
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_realloc@
+hs_bindgen_4c69efa2a8a2b7c0 :: Ptr Void -> Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_realloc@
+hs_bindgen_4c69efa2a8a2b7c0 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_4c69efa2a8a2b7c0_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @my_realloc@
+
+    __defined at:__ @functions\/fun_attributes.h 29:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_realloc_safe :: Ptr Void -> Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_realloc@
+
+    __defined at:__ @functions\/fun_attributes.h 29:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_realloc_safe = hs_bindgen_4c69efa2a8a2b7c0
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc1@
+foreign import ccall safe "hs_bindgen_1eae846583dd415c" hs_bindgen_1eae846583dd415c_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc1@
+hs_bindgen_1eae846583dd415c :: Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc1@
+hs_bindgen_1eae846583dd415c = \x_0 -> fmap fromFFIType (hs_bindgen_1eae846583dd415c_base (toFFIType x_0))
+{-| __C declaration:__ @my_alloc1@
+
+    __defined at:__ @functions\/fun_attributes.h 34:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc1_safe :: Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_alloc1@
+
+    __defined at:__ @functions\/fun_attributes.h 34:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc1_safe = hs_bindgen_1eae846583dd415c
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc2@
+foreign import ccall safe "hs_bindgen_790482b4016de326" hs_bindgen_790482b4016de326_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc2@
+hs_bindgen_790482b4016de326 :: Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_alloc2@
+hs_bindgen_790482b4016de326 = \x_0 -> fmap fromFFIType (hs_bindgen_790482b4016de326_base (toFFIType x_0))
+{-| __C declaration:__ @my_alloc2@
+
+    __defined at:__ @functions\/fun_attributes.h 35:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc2_safe :: Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_alloc2@
+
+    __defined at:__ @functions\/fun_attributes.h 35:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc2_safe = hs_bindgen_790482b4016de326
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_square@
+foreign import ccall safe "hs_bindgen_3f72dedf649beccd" hs_bindgen_3f72dedf649beccd_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_square@
+hs_bindgen_3f72dedf649beccd :: CInt -> CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_square@
+hs_bindgen_3f72dedf649beccd = \x_0 -> fromFFIType (hs_bindgen_3f72dedf649beccd_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @functions\/fun_attributes.h 39:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+square_safe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @functions\/fun_attributes.h 39:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+square_safe = hs_bindgen_3f72dedf649beccd
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_old_fn_deprecated@
+foreign import ccall safe "hs_bindgen_a8f71f2272dae572" hs_bindgen_a8f71f2272dae572_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_old_fn_deprecated@
+hs_bindgen_a8f71f2272dae572 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_old_fn_deprecated@
+hs_bindgen_a8f71f2272dae572 = fmap fromFFIType hs_bindgen_a8f71f2272dae572_base
+{-| __C declaration:__ @old_fn_deprecated@
+
+    __defined at:__ @functions\/fun_attributes.h 48:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+old_fn_deprecated_safe :: IO CInt
+{-| __C declaration:__ @old_fn_deprecated@
+
+    __defined at:__ @functions\/fun_attributes.h 48:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+old_fn_deprecated_safe = hs_bindgen_a8f71f2272dae572
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_dgettext@
+foreign import ccall safe "hs_bindgen_11a623401451cca5" hs_bindgen_11a623401451cca5_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_dgettext@
+hs_bindgen_11a623401451cca5 :: Ptr CChar ->
+                               PtrConst CChar -> IO (Ptr CChar)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_dgettext@
+hs_bindgen_11a623401451cca5 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_11a623401451cca5_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @my_dgettext@
+
+    __defined at:__ @functions\/fun_attributes.h 64:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_dgettext_safe :: Ptr CChar -> PtrConst CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @my_dgettext@
+
+    __defined at:__ @functions\/fun_attributes.h 64:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_dgettext_safe = hs_bindgen_11a623401451cca5
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fdopen@
+foreign import ccall safe "hs_bindgen_30143e337a327ef0" hs_bindgen_30143e337a327ef0_base ::
+    CInt
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fdopen@
+hs_bindgen_30143e337a327ef0 :: CInt ->
+                               PtrConst CChar -> IO (Ptr FILE)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fdopen@
+hs_bindgen_30143e337a327ef0 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_30143e337a327ef0_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @fdopen@
+
+    __defined at:__ @functions\/fun_attributes.h 75:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fdopen_safe :: CInt -> PtrConst CChar -> IO (Ptr FILE)
+{-| __C declaration:__ @fdopen@
+
+    __defined at:__ @functions\/fun_attributes.h 75:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fdopen_safe = hs_bindgen_30143e337a327ef0
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_7b2c420d0febf062" hs_bindgen_7b2c420d0febf062_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f2@
+hs_bindgen_7b2c420d0febf062 :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f2@
+hs_bindgen_7b2c420d0febf062 = hs_bindgen_7b2c420d0febf062_base
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/fun_attributes.h 79:65@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f2_safe :: IO ()
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/fun_attributes.h 79:65@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f2_safe = hs_bindgen_7b2c420d0febf062
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memcpy@
+foreign import ccall safe "hs_bindgen_af1f131d9e98a2ff" hs_bindgen_af1f131d9e98a2ff_base ::
+    Ptr Void
+ -> Ptr Void
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memcpy@
+hs_bindgen_af1f131d9e98a2ff :: Ptr Void ->
+                               PtrConst Void -> Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_my_memcpy@
+hs_bindgen_af1f131d9e98a2ff = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_af1f131d9e98a2ff_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @my_memcpy@
+
+    __defined at:__ @functions\/fun_attributes.h 85:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memcpy_safe :: Ptr Void ->
+                  PtrConst Void -> Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_memcpy@
+
+    __defined at:__ @functions\/fun_attributes.h 85:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memcpy_safe = hs_bindgen_af1f131d9e98a2ff
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fatal@
+foreign import ccall safe "hs_bindgen_0afa6ff8226517c8" hs_bindgen_0afa6ff8226517c8_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fatal@
+hs_bindgen_0afa6ff8226517c8 :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fatal@
+hs_bindgen_0afa6ff8226517c8 = hs_bindgen_0afa6ff8226517c8_base
+{-| __C declaration:__ @fatal@
+
+    __defined at:__ @functions\/fun_attributes.h 102:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fatal_safe :: IO ()
+{-| __C declaration:__ @fatal@
+
+    __defined at:__ @functions\/fun_attributes.h 102:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fatal_safe = hs_bindgen_0afa6ff8226517c8
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_hash@
+foreign import ccall safe "hs_bindgen_948fc14ee9d5d56f" hs_bindgen_948fc14ee9d5d56f_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_hash@
+hs_bindgen_948fc14ee9d5d56f :: Ptr CChar -> IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_hash@
+hs_bindgen_948fc14ee9d5d56f = \x_0 -> fmap fromFFIType (hs_bindgen_948fc14ee9d5d56f_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @functions\/fun_attributes.h 110:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+hash_safe :: Ptr CChar -> IO CInt
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @functions\/fun_attributes.h 110:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+hash_safe = hs_bindgen_948fc14ee9d5d56f
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_mymalloc@
+foreign import ccall safe "hs_bindgen_60517fb6ae2517ff" hs_bindgen_60517fb6ae2517ff_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_mymalloc@
+hs_bindgen_60517fb6ae2517ff :: Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_mymalloc@
+hs_bindgen_60517fb6ae2517ff = \x_0 -> fmap fromFFIType (hs_bindgen_60517fb6ae2517ff_base (toFFIType x_0))
+{-| __C declaration:__ @mymalloc@
+
+    __defined at:__ @functions\/fun_attributes.h 115:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+mymalloc_safe :: Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @mymalloc@
+
+    __defined at:__ @functions\/fun_attributes.h 115:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+mymalloc_safe = hs_bindgen_60517fb6ae2517ff
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_foobar@
+foreign import ccall safe "hs_bindgen_f1451b46f1bd3813" hs_bindgen_f1451b46f1bd3813_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_foobar@
+hs_bindgen_f1451b46f1bd3813 :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_foobar@
+hs_bindgen_f1451b46f1bd3813 = hs_bindgen_f1451b46f1bd3813_base
+{-| __C declaration:__ @foobar@
+
+    __defined at:__ @functions\/fun_attributes.h 119:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+foobar_safe :: IO ()
+{-| __C declaration:__ @foobar@
+
+    __defined at:__ @functions\/fun_attributes.h 119:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+foobar_safe = hs_bindgen_f1451b46f1bd3813
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_core2_func@
+foreign import ccall safe "hs_bindgen_07f5843dd5c65611" hs_bindgen_07f5843dd5c65611_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_core2_func@
+hs_bindgen_07f5843dd5c65611 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_core2_func@
+hs_bindgen_07f5843dd5c65611 = fmap fromFFIType hs_bindgen_07f5843dd5c65611_base
+{-| __C declaration:__ @core2_func@
+
+    __defined at:__ @functions\/fun_attributes.h 126:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+core2_func_safe :: IO CInt
+{-| __C declaration:__ @core2_func@
+
+    __defined at:__ @functions\/fun_attributes.h 126:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+core2_func_safe = hs_bindgen_07f5843dd5c65611
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_sse3_func@
+foreign import ccall safe "hs_bindgen_2c7c9e9a45042696" hs_bindgen_2c7c9e9a45042696_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_sse3_func@
+hs_bindgen_2c7c9e9a45042696 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_sse3_func@
+hs_bindgen_2c7c9e9a45042696 = fmap fromFFIType hs_bindgen_2c7c9e9a45042696_base
+{-| __C declaration:__ @sse3_func@
+
+    __defined at:__ @functions\/fun_attributes.h 127:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+sse3_func_safe :: IO CInt
+{-| __C declaration:__ @sse3_func@
+
+    __defined at:__ @functions\/fun_attributes.h 127:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+sse3_func_safe = hs_bindgen_2c7c9e9a45042696
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_4ff2d7abd6099082" hs_bindgen_4ff2d7abd6099082_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f3@
+hs_bindgen_4ff2d7abd6099082 :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_f3@
+hs_bindgen_4ff2d7abd6099082 = hs_bindgen_4ff2d7abd6099082_base
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @functions\/fun_attributes.h 131:49@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f3_safe :: IO ()
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @functions\/fun_attributes.h 131:49@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f3_safe = hs_bindgen_4ff2d7abd6099082
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fn@
+foreign import ccall safe "hs_bindgen_c3ae037518ec9b4e" hs_bindgen_c3ae037518ec9b4e_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fn@
+hs_bindgen_c3ae037518ec9b4e :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_fn@
+hs_bindgen_c3ae037518ec9b4e = fmap fromFFIType hs_bindgen_c3ae037518ec9b4e_base
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/fun_attributes.h 136:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fn_safe :: IO CInt
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/fun_attributes.h 136:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fn_safe = hs_bindgen_c3ae037518ec9b4e
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_y@
+foreign import ccall safe "hs_bindgen_da9708096863a242" hs_bindgen_da9708096863a242_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_y@
+hs_bindgen_da9708096863a242 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_y@
+hs_bindgen_da9708096863a242 = fmap fromFFIType hs_bindgen_da9708096863a242_base
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/fun_attributes.h 142:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+y_safe :: IO CInt
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/fun_attributes.h 142:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+y_safe = hs_bindgen_da9708096863a242
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z1@
+foreign import ccall safe "hs_bindgen_1b5a954ee8d33472" hs_bindgen_1b5a954ee8d33472_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z1@
+hs_bindgen_1b5a954ee8d33472 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z1@
+hs_bindgen_1b5a954ee8d33472 = fmap fromFFIType hs_bindgen_1b5a954ee8d33472_base
+{-| __C declaration:__ @z1@
+
+    __defined at:__ @functions\/fun_attributes.h 145:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z1_safe :: IO CInt
+{-| __C declaration:__ @z1@
+
+    __defined at:__ @functions\/fun_attributes.h 145:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z1_safe = hs_bindgen_1b5a954ee8d33472
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z2@
+foreign import ccall safe "hs_bindgen_871d232f0a2386a3" hs_bindgen_871d232f0a2386a3_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z2@
+hs_bindgen_871d232f0a2386a3 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Safe_z2@
+hs_bindgen_871d232f0a2386a3 = fmap fromFFIType hs_bindgen_871d232f0a2386a3_base
+{-| __C declaration:__ @z2@
+
+    __defined at:__ @functions\/fun_attributes.h 148:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z2_safe :: IO CInt
+{-| __C declaration:__ @z2@
+
+    __defined at:__ @functions\/fun_attributes.h 148:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z2_safe = hs_bindgen_871d232f0a2386a3
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe___f1@
+foreign import ccall unsafe "hs_bindgen_52759f125bf2b140" hs_bindgen_52759f125bf2b140_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe___f1@
+hs_bindgen_52759f125bf2b140 :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe___f1@
+hs_bindgen_52759f125bf2b140 = hs_bindgen_52759f125bf2b140_base
+{-| __C declaration:__ @__f1@
+
+    __defined at:__ @functions\/fun_attributes.h 16:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+__f1_unsafe :: IO ()
+{-| __C declaration:__ @__f1@
+
+    __defined at:__ @functions\/fun_attributes.h 16:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+__f1_unsafe = hs_bindgen_52759f125bf2b140
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_80bb9d1445e894ca" hs_bindgen_80bb9d1445e894ca_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f1@
+hs_bindgen_80bb9d1445e894ca :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f1@
+hs_bindgen_80bb9d1445e894ca = hs_bindgen_80bb9d1445e894ca_base
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @functions\/fun_attributes.h 19:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f1_unsafe :: IO ()
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @functions\/fun_attributes.h 19:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f1_unsafe = hs_bindgen_80bb9d1445e894ca
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memalign@
+foreign import ccall unsafe "hs_bindgen_ebf8d1f009064640" hs_bindgen_ebf8d1f009064640_base ::
+    CInt
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memalign@
+hs_bindgen_ebf8d1f009064640 :: Size_t -> Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memalign@
+hs_bindgen_ebf8d1f009064640 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_ebf8d1f009064640_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @my_memalign@
+
+    __defined at:__ @functions\/fun_attributes.h 23:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memalign_unsafe :: Size_t -> Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_memalign@
+
+    __defined at:__ @functions\/fun_attributes.h 23:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memalign_unsafe = hs_bindgen_ebf8d1f009064640
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_calloc@
+foreign import ccall unsafe "hs_bindgen_a062d8e757dc6824" hs_bindgen_a062d8e757dc6824_base ::
+    CInt
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_calloc@
+hs_bindgen_a062d8e757dc6824 :: Size_t -> Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_calloc@
+hs_bindgen_a062d8e757dc6824 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_a062d8e757dc6824_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @my_calloc@
+
+    __defined at:__ @functions\/fun_attributes.h 28:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_calloc_unsafe :: Size_t -> Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_calloc@
+
+    __defined at:__ @functions\/fun_attributes.h 28:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_calloc_unsafe = hs_bindgen_a062d8e757dc6824
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_realloc@
+foreign import ccall unsafe "hs_bindgen_899561850b80c305" hs_bindgen_899561850b80c305_base ::
+    Ptr Void
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_realloc@
+hs_bindgen_899561850b80c305 :: Ptr Void -> Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_realloc@
+hs_bindgen_899561850b80c305 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_899561850b80c305_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @my_realloc@
+
+    __defined at:__ @functions\/fun_attributes.h 29:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_realloc_unsafe :: Ptr Void -> Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_realloc@
+
+    __defined at:__ @functions\/fun_attributes.h 29:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_realloc_unsafe = hs_bindgen_899561850b80c305
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc1@
+foreign import ccall unsafe "hs_bindgen_d5eb45f9de991bca" hs_bindgen_d5eb45f9de991bca_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc1@
+hs_bindgen_d5eb45f9de991bca :: Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc1@
+hs_bindgen_d5eb45f9de991bca = \x_0 -> fmap fromFFIType (hs_bindgen_d5eb45f9de991bca_base (toFFIType x_0))
+{-| __C declaration:__ @my_alloc1@
+
+    __defined at:__ @functions\/fun_attributes.h 34:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc1_unsafe :: Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_alloc1@
+
+    __defined at:__ @functions\/fun_attributes.h 34:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc1_unsafe = hs_bindgen_d5eb45f9de991bca
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc2@
+foreign import ccall unsafe "hs_bindgen_a7aa3949fa7cae3f" hs_bindgen_a7aa3949fa7cae3f_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc2@
+hs_bindgen_a7aa3949fa7cae3f :: Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_alloc2@
+hs_bindgen_a7aa3949fa7cae3f = \x_0 -> fmap fromFFIType (hs_bindgen_a7aa3949fa7cae3f_base (toFFIType x_0))
+{-| __C declaration:__ @my_alloc2@
+
+    __defined at:__ @functions\/fun_attributes.h 35:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc2_unsafe :: Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_alloc2@
+
+    __defined at:__ @functions\/fun_attributes.h 35:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc2_unsafe = hs_bindgen_a7aa3949fa7cae3f
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_square@
+foreign import ccall unsafe "hs_bindgen_dbe49279b6585cea" hs_bindgen_dbe49279b6585cea_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_square@
+hs_bindgen_dbe49279b6585cea :: CInt -> CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_square@
+hs_bindgen_dbe49279b6585cea = \x_0 -> fromFFIType (hs_bindgen_dbe49279b6585cea_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @functions\/fun_attributes.h 39:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+square_unsafe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square@
+
+    __defined at:__ @functions\/fun_attributes.h 39:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+square_unsafe = hs_bindgen_dbe49279b6585cea
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_old_fn_deprecated@
+foreign import ccall unsafe "hs_bindgen_f51c36dd7e8f4133" hs_bindgen_f51c36dd7e8f4133_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_old_fn_deprecated@
+hs_bindgen_f51c36dd7e8f4133 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_old_fn_deprecated@
+hs_bindgen_f51c36dd7e8f4133 = fmap fromFFIType hs_bindgen_f51c36dd7e8f4133_base
+{-| __C declaration:__ @old_fn_deprecated@
+
+    __defined at:__ @functions\/fun_attributes.h 48:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+old_fn_deprecated_unsafe :: IO CInt
+{-| __C declaration:__ @old_fn_deprecated@
+
+    __defined at:__ @functions\/fun_attributes.h 48:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+old_fn_deprecated_unsafe = hs_bindgen_f51c36dd7e8f4133
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_dgettext@
+foreign import ccall unsafe "hs_bindgen_bf6f222178bd7c31" hs_bindgen_bf6f222178bd7c31_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_dgettext@
+hs_bindgen_bf6f222178bd7c31 :: Ptr CChar ->
+                               PtrConst CChar -> IO (Ptr CChar)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_dgettext@
+hs_bindgen_bf6f222178bd7c31 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_bf6f222178bd7c31_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @my_dgettext@
+
+    __defined at:__ @functions\/fun_attributes.h 64:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_dgettext_unsafe :: Ptr CChar -> PtrConst CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @my_dgettext@
+
+    __defined at:__ @functions\/fun_attributes.h 64:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_dgettext_unsafe = hs_bindgen_bf6f222178bd7c31
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fdopen@
+foreign import ccall unsafe "hs_bindgen_830629dc11c2fdfc" hs_bindgen_830629dc11c2fdfc_base ::
+    CInt
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fdopen@
+hs_bindgen_830629dc11c2fdfc :: CInt ->
+                               PtrConst CChar -> IO (Ptr FILE)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fdopen@
+hs_bindgen_830629dc11c2fdfc = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_830629dc11c2fdfc_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @fdopen@
+
+    __defined at:__ @functions\/fun_attributes.h 75:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fdopen_unsafe :: CInt -> PtrConst CChar -> IO (Ptr FILE)
+{-| __C declaration:__ @fdopen@
+
+    __defined at:__ @functions\/fun_attributes.h 75:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fdopen_unsafe = hs_bindgen_830629dc11c2fdfc
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_a5f34f5beb1c74f1" hs_bindgen_a5f34f5beb1c74f1_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f2@
+hs_bindgen_a5f34f5beb1c74f1 :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f2@
+hs_bindgen_a5f34f5beb1c74f1 = hs_bindgen_a5f34f5beb1c74f1_base
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/fun_attributes.h 79:65@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f2_unsafe :: IO ()
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/fun_attributes.h 79:65@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f2_unsafe = hs_bindgen_a5f34f5beb1c74f1
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memcpy@
+foreign import ccall unsafe "hs_bindgen_0f3586df383dffea" hs_bindgen_0f3586df383dffea_base ::
+    Ptr Void
+ -> Ptr Void
+ -> CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memcpy@
+hs_bindgen_0f3586df383dffea :: Ptr Void ->
+                               PtrConst Void -> Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_my_memcpy@
+hs_bindgen_0f3586df383dffea = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_0f3586df383dffea_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @my_memcpy@
+
+    __defined at:__ @functions\/fun_attributes.h 85:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memcpy_unsafe :: Ptr Void ->
+                    PtrConst Void -> Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @my_memcpy@
+
+    __defined at:__ @functions\/fun_attributes.h 85:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memcpy_unsafe = hs_bindgen_0f3586df383dffea
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fatal@
+foreign import ccall unsafe "hs_bindgen_667d3280d945cd0c" hs_bindgen_667d3280d945cd0c_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fatal@
+hs_bindgen_667d3280d945cd0c :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fatal@
+hs_bindgen_667d3280d945cd0c = hs_bindgen_667d3280d945cd0c_base
+{-| __C declaration:__ @fatal@
+
+    __defined at:__ @functions\/fun_attributes.h 102:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fatal_unsafe :: IO ()
+{-| __C declaration:__ @fatal@
+
+    __defined at:__ @functions\/fun_attributes.h 102:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fatal_unsafe = hs_bindgen_667d3280d945cd0c
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_hash@
+foreign import ccall unsafe "hs_bindgen_394fd662d5fb7aa6" hs_bindgen_394fd662d5fb7aa6_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_hash@
+hs_bindgen_394fd662d5fb7aa6 :: Ptr CChar -> IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_hash@
+hs_bindgen_394fd662d5fb7aa6 = \x_0 -> fmap fromFFIType (hs_bindgen_394fd662d5fb7aa6_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @functions\/fun_attributes.h 110:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+hash_unsafe :: Ptr CChar -> IO CInt
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @hash@
+
+    __defined at:__ @functions\/fun_attributes.h 110:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+hash_unsafe = hs_bindgen_394fd662d5fb7aa6
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_mymalloc@
+foreign import ccall unsafe "hs_bindgen_5594a84fb65782e1" hs_bindgen_5594a84fb65782e1_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_mymalloc@
+hs_bindgen_5594a84fb65782e1 :: Size_t -> IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_mymalloc@
+hs_bindgen_5594a84fb65782e1 = \x_0 -> fmap fromFFIType (hs_bindgen_5594a84fb65782e1_base (toFFIType x_0))
+{-| __C declaration:__ @mymalloc@
+
+    __defined at:__ @functions\/fun_attributes.h 115:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+mymalloc_unsafe :: Size_t -> IO (Ptr Void)
+{-| __C declaration:__ @mymalloc@
+
+    __defined at:__ @functions\/fun_attributes.h 115:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+mymalloc_unsafe = hs_bindgen_5594a84fb65782e1
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_foobar@
+foreign import ccall unsafe "hs_bindgen_1f19397195b32853" hs_bindgen_1f19397195b32853_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_foobar@
+hs_bindgen_1f19397195b32853 :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_foobar@
+hs_bindgen_1f19397195b32853 = hs_bindgen_1f19397195b32853_base
+{-| __C declaration:__ @foobar@
+
+    __defined at:__ @functions\/fun_attributes.h 119:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+foobar_unsafe :: IO ()
+{-| __C declaration:__ @foobar@
+
+    __defined at:__ @functions\/fun_attributes.h 119:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+foobar_unsafe = hs_bindgen_1f19397195b32853
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_core2_func@
+foreign import ccall unsafe "hs_bindgen_f80f9b58791a9cf2" hs_bindgen_f80f9b58791a9cf2_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_core2_func@
+hs_bindgen_f80f9b58791a9cf2 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_core2_func@
+hs_bindgen_f80f9b58791a9cf2 = fmap fromFFIType hs_bindgen_f80f9b58791a9cf2_base
+{-| __C declaration:__ @core2_func@
+
+    __defined at:__ @functions\/fun_attributes.h 126:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+core2_func_unsafe :: IO CInt
+{-| __C declaration:__ @core2_func@
+
+    __defined at:__ @functions\/fun_attributes.h 126:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+core2_func_unsafe = hs_bindgen_f80f9b58791a9cf2
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_sse3_func@
+foreign import ccall unsafe "hs_bindgen_6a951361c18a91a0" hs_bindgen_6a951361c18a91a0_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_sse3_func@
+hs_bindgen_6a951361c18a91a0 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_sse3_func@
+hs_bindgen_6a951361c18a91a0 = fmap fromFFIType hs_bindgen_6a951361c18a91a0_base
+{-| __C declaration:__ @sse3_func@
+
+    __defined at:__ @functions\/fun_attributes.h 127:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+sse3_func_unsafe :: IO CInt
+{-| __C declaration:__ @sse3_func@
+
+    __defined at:__ @functions\/fun_attributes.h 127:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+sse3_func_unsafe = hs_bindgen_6a951361c18a91a0
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_1d7f2cdf95b3bfa3" hs_bindgen_1d7f2cdf95b3bfa3_base ::
+    IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f3@
+hs_bindgen_1d7f2cdf95b3bfa3 :: IO ()
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_f3@
+hs_bindgen_1d7f2cdf95b3bfa3 = hs_bindgen_1d7f2cdf95b3bfa3_base
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @functions\/fun_attributes.h 131:49@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f3_unsafe :: IO ()
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @functions\/fun_attributes.h 131:49@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f3_unsafe = hs_bindgen_1d7f2cdf95b3bfa3
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fn@
+foreign import ccall unsafe "hs_bindgen_c1fff017165ba0e1" hs_bindgen_c1fff017165ba0e1_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fn@
+hs_bindgen_c1fff017165ba0e1 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_fn@
+hs_bindgen_c1fff017165ba0e1 = fmap fromFFIType hs_bindgen_c1fff017165ba0e1_base
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/fun_attributes.h 136:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fn_unsafe :: IO CInt
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/fun_attributes.h 136:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fn_unsafe = hs_bindgen_c1fff017165ba0e1
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_y@
+foreign import ccall unsafe "hs_bindgen_67dc9f91fbda20c7" hs_bindgen_67dc9f91fbda20c7_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_y@
+hs_bindgen_67dc9f91fbda20c7 :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_y@
+hs_bindgen_67dc9f91fbda20c7 = fmap fromFFIType hs_bindgen_67dc9f91fbda20c7_base
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/fun_attributes.h 142:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+y_unsafe :: IO CInt
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/fun_attributes.h 142:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+y_unsafe = hs_bindgen_67dc9f91fbda20c7
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z1@
+foreign import ccall unsafe "hs_bindgen_92dc5692c137b4da" hs_bindgen_92dc5692c137b4da_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z1@
+hs_bindgen_92dc5692c137b4da :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z1@
+hs_bindgen_92dc5692c137b4da = fmap fromFFIType hs_bindgen_92dc5692c137b4da_base
+{-| __C declaration:__ @z1@
+
+    __defined at:__ @functions\/fun_attributes.h 145:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z1_unsafe :: IO CInt
+{-| __C declaration:__ @z1@
+
+    __defined at:__ @functions\/fun_attributes.h 145:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z1_unsafe = hs_bindgen_92dc5692c137b4da
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z2@
+foreign import ccall unsafe "hs_bindgen_6e662527d3f0decc" hs_bindgen_6e662527d3f0decc_base ::
+    IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z2@
+hs_bindgen_6e662527d3f0decc :: IO CInt
+-- __unique:__ @test_functionsfun_attributes_Example_Unsafe_z2@
+hs_bindgen_6e662527d3f0decc = fmap fromFFIType hs_bindgen_6e662527d3f0decc_base
+{-| __C declaration:__ @z2@
+
+    __defined at:__ @functions\/fun_attributes.h 148:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z2_unsafe :: IO CInt
+{-| __C declaration:__ @z2@
+
+    __defined at:__ @functions\/fun_attributes.h 148:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z2_unsafe = hs_bindgen_6e662527d3f0decc
+-- __unique:__ @test_functionsfun_attributes_Example_get___f1@
+foreign import ccall unsafe "hs_bindgen_99da7108788a2cf4" hs_bindgen_99da7108788a2cf4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get___f1@
+hs_bindgen_99da7108788a2cf4 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionsfun_attributes_Example_get___f1@
+hs_bindgen_99da7108788a2cf4 = fmap fromFFIType hs_bindgen_99da7108788a2cf4_base
+{-# NOINLINE __f1_funptr #-}
+{-| __C declaration:__ @__f1@
+
+    __defined at:__ @functions\/fun_attributes.h 16:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+__f1_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @__f1@
+
+    __defined at:__ @functions\/fun_attributes.h 16:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+__f1_funptr = unsafePerformIO hs_bindgen_99da7108788a2cf4
+-- __unique:__ @test_functionsfun_attributes_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_a0d2ec6ffc23fc5a" hs_bindgen_a0d2ec6ffc23fc5a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_f1@
+hs_bindgen_a0d2ec6ffc23fc5a :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionsfun_attributes_Example_get_f1@
+hs_bindgen_a0d2ec6ffc23fc5a = fmap fromFFIType hs_bindgen_a0d2ec6ffc23fc5a_base
+{-# NOINLINE f1_funptr #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @functions\/fun_attributes.h 19:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f1_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @functions\/fun_attributes.h 19:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f1_funptr = unsafePerformIO hs_bindgen_a0d2ec6ffc23fc5a
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memalign@
+foreign import ccall unsafe "hs_bindgen_16a2a5a807cc26ec" hs_bindgen_16a2a5a807cc26ec_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memalign@
+hs_bindgen_16a2a5a807cc26ec :: IO (FunPtr (Size_t ->
+                                           Size_t -> IO (Ptr Void)))
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memalign@
+hs_bindgen_16a2a5a807cc26ec = fmap fromFFIType hs_bindgen_16a2a5a807cc26ec_base
+{-# NOINLINE my_memalign_funptr #-}
+{-| __C declaration:__ @my_memalign@
+
+    __defined at:__ @functions\/fun_attributes.h 23:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memalign_funptr :: FunPtr (Size_t -> Size_t -> IO (Ptr Void))
+{-| __C declaration:__ @my_memalign@
+
+    __defined at:__ @functions\/fun_attributes.h 23:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memalign_funptr = unsafePerformIO hs_bindgen_16a2a5a807cc26ec
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_calloc@
+foreign import ccall unsafe "hs_bindgen_976df97f9c9c1223" hs_bindgen_976df97f9c9c1223_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_calloc@
+hs_bindgen_976df97f9c9c1223 :: IO (FunPtr (Size_t ->
+                                           Size_t -> IO (Ptr Void)))
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_calloc@
+hs_bindgen_976df97f9c9c1223 = fmap fromFFIType hs_bindgen_976df97f9c9c1223_base
+{-# NOINLINE my_calloc_funptr #-}
+{-| __C declaration:__ @my_calloc@
+
+    __defined at:__ @functions\/fun_attributes.h 28:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_calloc_funptr :: FunPtr (Size_t -> Size_t -> IO (Ptr Void))
+{-| __C declaration:__ @my_calloc@
+
+    __defined at:__ @functions\/fun_attributes.h 28:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_calloc_funptr = unsafePerformIO hs_bindgen_976df97f9c9c1223
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_realloc@
+foreign import ccall unsafe "hs_bindgen_4021d3c6eae30c8c" hs_bindgen_4021d3c6eae30c8c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_realloc@
+hs_bindgen_4021d3c6eae30c8c :: IO (FunPtr (Ptr Void ->
+                                           Size_t -> IO (Ptr Void)))
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_realloc@
+hs_bindgen_4021d3c6eae30c8c = fmap fromFFIType hs_bindgen_4021d3c6eae30c8c_base
+{-# NOINLINE my_realloc_funptr #-}
+{-| __C declaration:__ @my_realloc@
+
+    __defined at:__ @functions\/fun_attributes.h 29:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_realloc_funptr :: FunPtr (Ptr Void -> Size_t -> IO (Ptr Void))
+{-| __C declaration:__ @my_realloc@
+
+    __defined at:__ @functions\/fun_attributes.h 29:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_realloc_funptr = unsafePerformIO hs_bindgen_4021d3c6eae30c8c
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc1@
+foreign import ccall unsafe "hs_bindgen_2ca35d0827c76ff7" hs_bindgen_2ca35d0827c76ff7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc1@
+hs_bindgen_2ca35d0827c76ff7 :: IO (FunPtr (Size_t ->
+                                           IO (Ptr Void)))
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc1@
+hs_bindgen_2ca35d0827c76ff7 = fmap fromFFIType hs_bindgen_2ca35d0827c76ff7_base
+{-# NOINLINE my_alloc1_funptr #-}
+{-| __C declaration:__ @my_alloc1@
+
+    __defined at:__ @functions\/fun_attributes.h 34:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc1_funptr :: FunPtr (Size_t -> IO (Ptr Void))
+{-| __C declaration:__ @my_alloc1@
+
+    __defined at:__ @functions\/fun_attributes.h 34:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc1_funptr = unsafePerformIO hs_bindgen_2ca35d0827c76ff7
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc2@
+foreign import ccall unsafe "hs_bindgen_a43746fed9206f42" hs_bindgen_a43746fed9206f42_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc2@
+hs_bindgen_a43746fed9206f42 :: IO (FunPtr (Size_t ->
+                                           IO (Ptr Void)))
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_alloc2@
+hs_bindgen_a43746fed9206f42 = fmap fromFFIType hs_bindgen_a43746fed9206f42_base
+{-# NOINLINE my_alloc2_funptr #-}
+{-| __C declaration:__ @my_alloc2@
+
+    __defined at:__ @functions\/fun_attributes.h 35:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc2_funptr :: FunPtr (Size_t -> IO (Ptr Void))
+{-| __C declaration:__ @my_alloc2@
+
+    __defined at:__ @functions\/fun_attributes.h 35:7@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_alloc2_funptr = unsafePerformIO hs_bindgen_a43746fed9206f42
+-- __unique:__ @test_functionsfun_attributes_Example_get_square@
+foreign import ccall unsafe "hs_bindgen_d41557222fd2ab94" hs_bindgen_d41557222fd2ab94_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_square@
+hs_bindgen_d41557222fd2ab94 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_functionsfun_attributes_Example_get_square@
+hs_bindgen_d41557222fd2ab94 = fmap fromFFIType hs_bindgen_d41557222fd2ab94_base
+{-# NOINLINE square_funptr #-}
+{-| __C declaration:__ @square@
+
+    __defined at:__ @functions\/fun_attributes.h 39:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+square_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @square@
+
+    __defined at:__ @functions\/fun_attributes.h 39:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+square_funptr = unsafePerformIO hs_bindgen_d41557222fd2ab94
+-- __unique:__ @test_functionsfun_attributes_Example_get_old_fn_deprecated@
+foreign import ccall unsafe "hs_bindgen_beee43878922a900" hs_bindgen_beee43878922a900_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_old_fn_deprecated@
+hs_bindgen_beee43878922a900 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_functionsfun_attributes_Example_get_old_fn_deprecated@
+hs_bindgen_beee43878922a900 = fmap fromFFIType hs_bindgen_beee43878922a900_base
+{-# NOINLINE old_fn_deprecated_funptr #-}
+{-| __C declaration:__ @old_fn_deprecated@
+
+    __defined at:__ @functions\/fun_attributes.h 48:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+old_fn_deprecated_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @old_fn_deprecated@
+
+    __defined at:__ @functions\/fun_attributes.h 48:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+old_fn_deprecated_funptr = unsafePerformIO hs_bindgen_beee43878922a900
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_dgettext@
+foreign import ccall unsafe "hs_bindgen_f95f43d50ed8f2b4" hs_bindgen_f95f43d50ed8f2b4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_dgettext@
+hs_bindgen_f95f43d50ed8f2b4 :: IO (FunPtr (Ptr CChar ->
+                                           PtrConst CChar -> IO (Ptr CChar)))
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_dgettext@
+hs_bindgen_f95f43d50ed8f2b4 = fmap fromFFIType hs_bindgen_f95f43d50ed8f2b4_base
+{-# NOINLINE my_dgettext_funptr #-}
+{-| __C declaration:__ @my_dgettext@
+
+    __defined at:__ @functions\/fun_attributes.h 64:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_dgettext_funptr :: FunPtr (Ptr CChar ->
+                              PtrConst CChar -> IO (Ptr CChar))
+{-| __C declaration:__ @my_dgettext@
+
+    __defined at:__ @functions\/fun_attributes.h 64:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_dgettext_funptr = unsafePerformIO hs_bindgen_f95f43d50ed8f2b4
+-- __unique:__ @test_functionsfun_attributes_Example_get_fdopen@
+foreign import ccall unsafe "hs_bindgen_986260288574592d" hs_bindgen_986260288574592d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_fdopen@
+hs_bindgen_986260288574592d :: IO (FunPtr (CInt ->
+                                           PtrConst CChar -> IO (Ptr FILE)))
+-- __unique:__ @test_functionsfun_attributes_Example_get_fdopen@
+hs_bindgen_986260288574592d = fmap fromFFIType hs_bindgen_986260288574592d_base
+{-# NOINLINE fdopen_funptr #-}
+{-| __C declaration:__ @fdopen@
+
+    __defined at:__ @functions\/fun_attributes.h 75:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fdopen_funptr :: FunPtr (CInt -> PtrConst CChar -> IO (Ptr FILE))
+{-| __C declaration:__ @fdopen@
+
+    __defined at:__ @functions\/fun_attributes.h 75:9@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fdopen_funptr = unsafePerformIO hs_bindgen_986260288574592d
+-- __unique:__ @test_functionsfun_attributes_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_fa90d405c15977a2" hs_bindgen_fa90d405c15977a2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_f2@
+hs_bindgen_fa90d405c15977a2 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionsfun_attributes_Example_get_f2@
+hs_bindgen_fa90d405c15977a2 = fmap fromFFIType hs_bindgen_fa90d405c15977a2_base
+{-# NOINLINE f2_funptr #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/fun_attributes.h 79:65@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f2_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @functions\/fun_attributes.h 79:65@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f2_funptr = unsafePerformIO hs_bindgen_fa90d405c15977a2
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memcpy@
+foreign import ccall unsafe "hs_bindgen_481e3a75205c85f2" hs_bindgen_481e3a75205c85f2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memcpy@
+hs_bindgen_481e3a75205c85f2 :: IO (FunPtr (Ptr Void ->
+                                           PtrConst Void -> Size_t -> IO (Ptr Void)))
+-- __unique:__ @test_functionsfun_attributes_Example_get_my_memcpy@
+hs_bindgen_481e3a75205c85f2 = fmap fromFFIType hs_bindgen_481e3a75205c85f2_base
+{-# NOINLINE my_memcpy_funptr #-}
+{-| __C declaration:__ @my_memcpy@
+
+    __defined at:__ @functions\/fun_attributes.h 85:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memcpy_funptr :: FunPtr (Ptr Void ->
+                            PtrConst Void -> Size_t -> IO (Ptr Void))
+{-| __C declaration:__ @my_memcpy@
+
+    __defined at:__ @functions\/fun_attributes.h 85:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+my_memcpy_funptr = unsafePerformIO hs_bindgen_481e3a75205c85f2
+-- __unique:__ @test_functionsfun_attributes_Example_get_fatal@
+foreign import ccall unsafe "hs_bindgen_99cc62837ebec657" hs_bindgen_99cc62837ebec657_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_fatal@
+hs_bindgen_99cc62837ebec657 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionsfun_attributes_Example_get_fatal@
+hs_bindgen_99cc62837ebec657 = fmap fromFFIType hs_bindgen_99cc62837ebec657_base
+{-# NOINLINE fatal_funptr #-}
+{-| __C declaration:__ @fatal@
+
+    __defined at:__ @functions\/fun_attributes.h 102:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fatal_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @fatal@
+
+    __defined at:__ @functions\/fun_attributes.h 102:6@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fatal_funptr = unsafePerformIO hs_bindgen_99cc62837ebec657
+-- __unique:__ @test_functionsfun_attributes_Example_get_hash@
+foreign import ccall unsafe "hs_bindgen_196cbfce2a9df94f" hs_bindgen_196cbfce2a9df94f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_hash@
+hs_bindgen_196cbfce2a9df94f :: IO (FunPtr (Ptr CChar -> IO CInt))
+-- __unique:__ @test_functionsfun_attributes_Example_get_hash@
+hs_bindgen_196cbfce2a9df94f = fmap fromFFIType hs_bindgen_196cbfce2a9df94f_base
+{-# NOINLINE hash_funptr #-}
+{-| __C declaration:__ @hash@
+
+    __defined at:__ @functions\/fun_attributes.h 110:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+hash_funptr :: FunPtr (Ptr CChar -> IO CInt)
+{-| __C declaration:__ @hash@
+
+    __defined at:__ @functions\/fun_attributes.h 110:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+hash_funptr = unsafePerformIO hs_bindgen_196cbfce2a9df94f
+-- __unique:__ @test_functionsfun_attributes_Example_get_mymalloc@
+foreign import ccall unsafe "hs_bindgen_ae6b503283507bd2" hs_bindgen_ae6b503283507bd2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_mymalloc@
+hs_bindgen_ae6b503283507bd2 :: IO (FunPtr (Size_t ->
+                                           IO (Ptr Void)))
+-- __unique:__ @test_functionsfun_attributes_Example_get_mymalloc@
+hs_bindgen_ae6b503283507bd2 = fmap fromFFIType hs_bindgen_ae6b503283507bd2_base
+{-# NOINLINE mymalloc_funptr #-}
+{-| __C declaration:__ @mymalloc@
+
+    __defined at:__ @functions\/fun_attributes.h 115:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+mymalloc_funptr :: FunPtr (Size_t -> IO (Ptr Void))
+{-| __C declaration:__ @mymalloc@
+
+    __defined at:__ @functions\/fun_attributes.h 115:1@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+mymalloc_funptr = unsafePerformIO hs_bindgen_ae6b503283507bd2
+-- __unique:__ @test_functionsfun_attributes_Example_get_foobar@
+foreign import ccall unsafe "hs_bindgen_ad3e5c88477c9e92" hs_bindgen_ad3e5c88477c9e92_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_foobar@
+hs_bindgen_ad3e5c88477c9e92 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionsfun_attributes_Example_get_foobar@
+hs_bindgen_ad3e5c88477c9e92 = fmap fromFFIType hs_bindgen_ad3e5c88477c9e92_base
+{-# NOINLINE foobar_funptr #-}
+{-| __C declaration:__ @foobar@
+
+    __defined at:__ @functions\/fun_attributes.h 119:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+foobar_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @foobar@
+
+    __defined at:__ @functions\/fun_attributes.h 119:13@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+foobar_funptr = unsafePerformIO hs_bindgen_ad3e5c88477c9e92
+-- __unique:__ @test_functionsfun_attributes_Example_get_core2_func@
+foreign import ccall unsafe "hs_bindgen_508f28109ff2076e" hs_bindgen_508f28109ff2076e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_core2_func@
+hs_bindgen_508f28109ff2076e :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_functionsfun_attributes_Example_get_core2_func@
+hs_bindgen_508f28109ff2076e = fmap fromFFIType hs_bindgen_508f28109ff2076e_base
+{-# NOINLINE core2_func_funptr #-}
+{-| __C declaration:__ @core2_func@
+
+    __defined at:__ @functions\/fun_attributes.h 126:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+core2_func_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @core2_func@
+
+    __defined at:__ @functions\/fun_attributes.h 126:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+core2_func_funptr = unsafePerformIO hs_bindgen_508f28109ff2076e
+-- __unique:__ @test_functionsfun_attributes_Example_get_sse3_func@
+foreign import ccall unsafe "hs_bindgen_6e4f5b53b36a3ecb" hs_bindgen_6e4f5b53b36a3ecb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_sse3_func@
+hs_bindgen_6e4f5b53b36a3ecb :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_functionsfun_attributes_Example_get_sse3_func@
+hs_bindgen_6e4f5b53b36a3ecb = fmap fromFFIType hs_bindgen_6e4f5b53b36a3ecb_base
+{-# NOINLINE sse3_func_funptr #-}
+{-| __C declaration:__ @sse3_func@
+
+    __defined at:__ @functions\/fun_attributes.h 127:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+sse3_func_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @sse3_func@
+
+    __defined at:__ @functions\/fun_attributes.h 127:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+sse3_func_funptr = unsafePerformIO hs_bindgen_6e4f5b53b36a3ecb
+-- __unique:__ @test_functionsfun_attributes_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_e39d5186f5da6c3f" hs_bindgen_e39d5186f5da6c3f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_f3@
+hs_bindgen_e39d5186f5da6c3f :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionsfun_attributes_Example_get_f3@
+hs_bindgen_e39d5186f5da6c3f = fmap fromFFIType hs_bindgen_e39d5186f5da6c3f_base
+{-# NOINLINE f3_funptr #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @functions\/fun_attributes.h 131:49@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f3_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @functions\/fun_attributes.h 131:49@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+f3_funptr = unsafePerformIO hs_bindgen_e39d5186f5da6c3f
+-- __unique:__ @test_functionsfun_attributes_Example_get_fn@
+foreign import ccall unsafe "hs_bindgen_acb0e567f47dc0eb" hs_bindgen_acb0e567f47dc0eb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_fn@
+hs_bindgen_acb0e567f47dc0eb :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_functionsfun_attributes_Example_get_fn@
+hs_bindgen_acb0e567f47dc0eb = fmap fromFFIType hs_bindgen_acb0e567f47dc0eb_base
+{-# NOINLINE fn_funptr #-}
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/fun_attributes.h 136:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fn_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @fn@
+
+    __defined at:__ @functions\/fun_attributes.h 136:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+fn_funptr = unsafePerformIO hs_bindgen_acb0e567f47dc0eb
+-- __unique:__ @test_functionsfun_attributes_Example_get_y@
+foreign import ccall unsafe "hs_bindgen_a1f58949b267b87f" hs_bindgen_a1f58949b267b87f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_y@
+hs_bindgen_a1f58949b267b87f :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_functionsfun_attributes_Example_get_y@
+hs_bindgen_a1f58949b267b87f = fmap fromFFIType hs_bindgen_a1f58949b267b87f_base
+{-# NOINLINE y_funptr #-}
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/fun_attributes.h 142:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+y_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @y@
+
+    __defined at:__ @functions\/fun_attributes.h 142:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+y_funptr = unsafePerformIO hs_bindgen_a1f58949b267b87f
+-- __unique:__ @test_functionsfun_attributes_Example_get_z1@
+foreign import ccall unsafe "hs_bindgen_27c558455e5d5b1a" hs_bindgen_27c558455e5d5b1a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_z1@
+hs_bindgen_27c558455e5d5b1a :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_functionsfun_attributes_Example_get_z1@
+hs_bindgen_27c558455e5d5b1a = fmap fromFFIType hs_bindgen_27c558455e5d5b1a_base
+{-# NOINLINE z1_funptr #-}
+{-| __C declaration:__ @z1@
+
+    __defined at:__ @functions\/fun_attributes.h 145:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z1_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @z1@
+
+    __defined at:__ @functions\/fun_attributes.h 145:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z1_funptr = unsafePerformIO hs_bindgen_27c558455e5d5b1a
+-- __unique:__ @test_functionsfun_attributes_Example_get_z2@
+foreign import ccall unsafe "hs_bindgen_ef816c1d50bc7bb9" hs_bindgen_ef816c1d50bc7bb9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_z2@
+hs_bindgen_ef816c1d50bc7bb9 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_functionsfun_attributes_Example_get_z2@
+hs_bindgen_ef816c1d50bc7bb9 = fmap fromFFIType hs_bindgen_ef816c1d50bc7bb9_base
+{-# NOINLINE z2_funptr #-}
+{-| __C declaration:__ @z2@
+
+    __defined at:__ @functions\/fun_attributes.h 148:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z2_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @z2@
+
+    __defined at:__ @functions\/fun_attributes.h 148:12@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+z2_funptr = unsafePerformIO hs_bindgen_ef816c1d50bc7bb9
+-- __unique:__ @test_functionsfun_attributes_Example_get_i@
+foreign import ccall unsafe "hs_bindgen_cd32cb4982dd2d1a" hs_bindgen_cd32cb4982dd2d1a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_functionsfun_attributes_Example_get_i@
+hs_bindgen_cd32cb4982dd2d1a :: IO (Ptr CInt)
+-- __unique:__ @test_functionsfun_attributes_Example_get_i@
+hs_bindgen_cd32cb4982dd2d1a = fmap fromFFIType hs_bindgen_cd32cb4982dd2d1a_base
+{-# NOINLINE i #-}
+{-| __C declaration:__ @i@
+
+    __defined at:__ @functions\/fun_attributes.h 132:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+i :: Ptr CInt
+{-| __C declaration:__ @i@
+
+    __defined at:__ @functions\/fun_attributes.h 132:5@
+
+    __exported by:__ @functions\/fun_attributes.h@
+-}
+i = unsafePerformIO hs_bindgen_cd32cb4982dd2d1a
diff --git a/test-artefacts/fixtures/functions/fun_attributes_conflict/Example/FunPtr.hs b/test-artefacts/fixtures/functions/fun_attributes_conflict/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes_conflict/Example/FunPtr.hs
@@ -0,0 +1,132 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.square_cp
+    , Example.FunPtr.square_pc
+    , Example.FunPtr.square_cc
+    , Example.FunPtr.square_pp
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/fun_attributes_conflict.h>"
+  , "/* test_functionsfun_attributes_confl_Example_get_square_cp */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_9445b7269de35e9e (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &square_cp;"
+  , "}"
+  , "/* test_functionsfun_attributes_confl_Example_get_square_pc */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_b0c647124e93645d (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &square_pc;"
+  , "}"
+  , "/* test_functionsfun_attributes_confl_Example_get_square_cc */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_87ee2f018e6d262a (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &square_cc;"
+  , "}"
+  , "/* test_functionsfun_attributes_confl_Example_get_square_pp */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_0f31a17bf5ee4e4f (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &square_pp;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cp@
+foreign import ccall unsafe "hs_bindgen_9445b7269de35e9e" hs_bindgen_9445b7269de35e9e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cp@
+hs_bindgen_9445b7269de35e9e :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_9445b7269de35e9e =
+  fmap BG.fromFFIType hs_bindgen_9445b7269de35e9e_base
+
+{-# NOINLINE square_cp #-}
+{-| __C declaration:__ @square_cp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 9:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cp :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+square_cp =
+  BG.unsafePerformIO hs_bindgen_9445b7269de35e9e
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pc@
+foreign import ccall unsafe "hs_bindgen_b0c647124e93645d" hs_bindgen_b0c647124e93645d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pc@
+hs_bindgen_b0c647124e93645d :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_b0c647124e93645d =
+  fmap BG.fromFFIType hs_bindgen_b0c647124e93645d_base
+
+{-# NOINLINE square_pc #-}
+{-| __C declaration:__ @square_pc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 11:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pc :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+square_pc =
+  BG.unsafePerformIO hs_bindgen_b0c647124e93645d
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cc@
+foreign import ccall unsafe "hs_bindgen_87ee2f018e6d262a" hs_bindgen_87ee2f018e6d262a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cc@
+hs_bindgen_87ee2f018e6d262a :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_87ee2f018e6d262a =
+  fmap BG.fromFFIType hs_bindgen_87ee2f018e6d262a_base
+
+{-# NOINLINE square_cc #-}
+{-| __C declaration:__ @square_cc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 13:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cc :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+square_cc =
+  BG.unsafePerformIO hs_bindgen_87ee2f018e6d262a
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pp@
+foreign import ccall unsafe "hs_bindgen_0f31a17bf5ee4e4f" hs_bindgen_0f31a17bf5ee4e4f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pp@
+hs_bindgen_0f31a17bf5ee4e4f :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_0f31a17bf5ee4e4f =
+  fmap BG.fromFFIType hs_bindgen_0f31a17bf5ee4e4f_base
+
+{-# NOINLINE square_pp #-}
+{-| __C declaration:__ @square_pp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 15:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pp :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+square_pp =
+  BG.unsafePerformIO hs_bindgen_0f31a17bf5ee4e4f
diff --git a/test-artefacts/fixtures/functions/fun_attributes_conflict/Example/Safe.hs b/test-artefacts/fixtures/functions/fun_attributes_conflict/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes_conflict/Example/Safe.hs
@@ -0,0 +1,160 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.square_cp
+    , Example.Safe.square_pc
+    , Example.Safe.square_cc
+    , Example.Safe.square_pp
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/fun_attributes_conflict.h>"
+  , "signed int hs_bindgen_5d7162df3a16d8d5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square_cp)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_7f240b4e0c2eea24 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square_pc)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d32b50f04af10764 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square_cc)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_fab6c9860ff1400b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square_pp)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cp@
+foreign import ccall safe "hs_bindgen_5d7162df3a16d8d5" hs_bindgen_5d7162df3a16d8d5_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cp@
+hs_bindgen_5d7162df3a16d8d5 ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_5d7162df3a16d8d5 =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_5d7162df3a16d8d5_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 9:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cp ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+square_cp = hs_bindgen_5d7162df3a16d8d5
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pc@
+foreign import ccall safe "hs_bindgen_7f240b4e0c2eea24" hs_bindgen_7f240b4e0c2eea24_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pc@
+hs_bindgen_7f240b4e0c2eea24 ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_7f240b4e0c2eea24 =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_7f240b4e0c2eea24_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_pc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 11:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pc ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+square_pc = hs_bindgen_7f240b4e0c2eea24
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cc@
+foreign import ccall safe "hs_bindgen_d32b50f04af10764" hs_bindgen_d32b50f04af10764_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cc@
+hs_bindgen_d32b50f04af10764 ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_d32b50f04af10764 =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_d32b50f04af10764_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 13:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cc ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+square_cc = hs_bindgen_d32b50f04af10764
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pp@
+foreign import ccall safe "hs_bindgen_fab6c9860ff1400b" hs_bindgen_fab6c9860ff1400b_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pp@
+hs_bindgen_fab6c9860ff1400b ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_fab6c9860ff1400b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fab6c9860ff1400b_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @square_pp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 15:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pp ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+square_pp = hs_bindgen_fab6c9860ff1400b
diff --git a/test-artefacts/fixtures/functions/fun_attributes_conflict/Example/Unsafe.hs b/test-artefacts/fixtures/functions/fun_attributes_conflict/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes_conflict/Example/Unsafe.hs
@@ -0,0 +1,160 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.square_cp
+    , Example.Unsafe.square_pc
+    , Example.Unsafe.square_cc
+    , Example.Unsafe.square_pp
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/fun_attributes_conflict.h>"
+  , "signed int hs_bindgen_648d4f0fd0df4c79 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square_cp)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_632a1e6eb5ceeda7 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square_pc)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_56d75b1ff2482f13 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square_cc)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_eac2f9645ef29119 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (square_pp)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cp@
+foreign import ccall unsafe "hs_bindgen_648d4f0fd0df4c79" hs_bindgen_648d4f0fd0df4c79_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cp@
+hs_bindgen_648d4f0fd0df4c79 ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_648d4f0fd0df4c79 =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_648d4f0fd0df4c79_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 9:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cp ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+square_cp = hs_bindgen_648d4f0fd0df4c79
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pc@
+foreign import ccall unsafe "hs_bindgen_632a1e6eb5ceeda7" hs_bindgen_632a1e6eb5ceeda7_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pc@
+hs_bindgen_632a1e6eb5ceeda7 ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_632a1e6eb5ceeda7 =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_632a1e6eb5ceeda7_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_pc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 11:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pc ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+square_pc = hs_bindgen_632a1e6eb5ceeda7
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cc@
+foreign import ccall unsafe "hs_bindgen_56d75b1ff2482f13" hs_bindgen_56d75b1ff2482f13_base ::
+     BG.CInt
+  -> BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cc@
+hs_bindgen_56d75b1ff2482f13 ::
+     BG.CInt
+  -> BG.CInt
+hs_bindgen_56d75b1ff2482f13 =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_56d75b1ff2482f13_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 13:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cc ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> BG.CInt
+square_cc = hs_bindgen_56d75b1ff2482f13
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pp@
+foreign import ccall unsafe "hs_bindgen_eac2f9645ef29119" hs_bindgen_eac2f9645ef29119_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pp@
+hs_bindgen_eac2f9645ef29119 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_eac2f9645ef29119 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_eac2f9645ef29119_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @square_pp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 15:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pp ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+square_pp = hs_bindgen_eac2f9645ef29119
diff --git a/test-artefacts/fixtures/functions/fun_attributes_conflict/bindingspec.yaml b/test-artefacts/fixtures/functions/fun_attributes_conflict/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes_conflict/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/functions/fun_attributes_conflict/th.txt b/test-artefacts/fixtures/functions/fun_attributes_conflict/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/fun_attributes_conflict/th.txt
@@ -0,0 +1,410 @@
+-- addDependentFile test-artefacts/headers/golden/functions/fun_attributes_conflict.h
+-- #include <functions/fun_attributes_conflict.h>
+-- signed int hs_bindgen_5d7162df3a16d8d5 (
+--   signed int arg1
+-- )
+-- {
+--   return (square_cp)(arg1);
+-- }
+-- signed int hs_bindgen_7f240b4e0c2eea24 (
+--   signed int arg1
+-- )
+-- {
+--   return (square_pc)(arg1);
+-- }
+-- signed int hs_bindgen_d32b50f04af10764 (
+--   signed int arg1
+-- )
+-- {
+--   return (square_cc)(arg1);
+-- }
+-- signed int hs_bindgen_fab6c9860ff1400b (
+--   signed int arg1
+-- )
+-- {
+--   return (square_pp)(arg1);
+-- }
+-- signed int hs_bindgen_648d4f0fd0df4c79 (
+--   signed int arg1
+-- )
+-- {
+--   return (square_cp)(arg1);
+-- }
+-- signed int hs_bindgen_632a1e6eb5ceeda7 (
+--   signed int arg1
+-- )
+-- {
+--   return (square_pc)(arg1);
+-- }
+-- signed int hs_bindgen_56d75b1ff2482f13 (
+--   signed int arg1
+-- )
+-- {
+--   return (square_cc)(arg1);
+-- }
+-- signed int hs_bindgen_eac2f9645ef29119 (
+--   signed int arg1
+-- )
+-- {
+--   return (square_pp)(arg1);
+-- }
+-- /* test_functionsfun_attributes_confl_Example_get_square_cp */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_9445b7269de35e9e (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &square_cp;
+-- }
+-- /* test_functionsfun_attributes_confl_Example_get_square_pc */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_b0c647124e93645d (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &square_pc;
+-- }
+-- /* test_functionsfun_attributes_confl_Example_get_square_cc */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_87ee2f018e6d262a (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &square_cc;
+-- }
+-- /* test_functionsfun_attributes_confl_Example_get_square_pp */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_0f31a17bf5ee4e4f (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &square_pp;
+-- }
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cp@
+foreign import ccall safe "hs_bindgen_5d7162df3a16d8d5" hs_bindgen_5d7162df3a16d8d5_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cp@
+hs_bindgen_5d7162df3a16d8d5 :: CInt -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cp@
+hs_bindgen_5d7162df3a16d8d5 = \x_0 -> fromFFIType (hs_bindgen_5d7162df3a16d8d5_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 9:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cp_safe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 9:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cp_safe = hs_bindgen_5d7162df3a16d8d5
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pc@
+foreign import ccall safe "hs_bindgen_7f240b4e0c2eea24" hs_bindgen_7f240b4e0c2eea24_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pc@
+hs_bindgen_7f240b4e0c2eea24 :: CInt -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pc@
+hs_bindgen_7f240b4e0c2eea24 = \x_0 -> fromFFIType (hs_bindgen_7f240b4e0c2eea24_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_pc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 11:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pc_safe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_pc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 11:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pc_safe = hs_bindgen_7f240b4e0c2eea24
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cc@
+foreign import ccall safe "hs_bindgen_d32b50f04af10764" hs_bindgen_d32b50f04af10764_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cc@
+hs_bindgen_d32b50f04af10764 :: CInt -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_cc@
+hs_bindgen_d32b50f04af10764 = \x_0 -> fromFFIType (hs_bindgen_d32b50f04af10764_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 13:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cc_safe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 13:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cc_safe = hs_bindgen_d32b50f04af10764
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pp@
+foreign import ccall safe "hs_bindgen_fab6c9860ff1400b" hs_bindgen_fab6c9860ff1400b_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pp@
+hs_bindgen_fab6c9860ff1400b :: CInt -> IO CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Safe_square_pp@
+hs_bindgen_fab6c9860ff1400b = \x_0 -> fmap fromFFIType (hs_bindgen_fab6c9860ff1400b_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @square_pp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 15:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pp_safe :: CInt -> IO CInt
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @square_pp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 15:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pp_safe = hs_bindgen_fab6c9860ff1400b
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cp@
+foreign import ccall unsafe "hs_bindgen_648d4f0fd0df4c79" hs_bindgen_648d4f0fd0df4c79_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cp@
+hs_bindgen_648d4f0fd0df4c79 :: CInt -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cp@
+hs_bindgen_648d4f0fd0df4c79 = \x_0 -> fromFFIType (hs_bindgen_648d4f0fd0df4c79_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 9:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cp_unsafe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 9:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cp_unsafe = hs_bindgen_648d4f0fd0df4c79
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pc@
+foreign import ccall unsafe "hs_bindgen_632a1e6eb5ceeda7" hs_bindgen_632a1e6eb5ceeda7_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pc@
+hs_bindgen_632a1e6eb5ceeda7 :: CInt -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pc@
+hs_bindgen_632a1e6eb5ceeda7 = \x_0 -> fromFFIType (hs_bindgen_632a1e6eb5ceeda7_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_pc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 11:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pc_unsafe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_pc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 11:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pc_unsafe = hs_bindgen_632a1e6eb5ceeda7
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cc@
+foreign import ccall unsafe "hs_bindgen_56d75b1ff2482f13" hs_bindgen_56d75b1ff2482f13_base ::
+    CInt
+ -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cc@
+hs_bindgen_56d75b1ff2482f13 :: CInt -> CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_cc@
+hs_bindgen_56d75b1ff2482f13 = \x_0 -> fromFFIType (hs_bindgen_56d75b1ff2482f13_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 13:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cc_unsafe :: CInt -> CInt
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @square_cc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 13:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cc_unsafe = hs_bindgen_56d75b1ff2482f13
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pp@
+foreign import ccall unsafe "hs_bindgen_eac2f9645ef29119" hs_bindgen_eac2f9645ef29119_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pp@
+hs_bindgen_eac2f9645ef29119 :: CInt -> IO CInt
+-- __unique:__ @test_functionsfun_attributes_confl_Example_Unsafe_square_pp@
+hs_bindgen_eac2f9645ef29119 = \x_0 -> fmap fromFFIType (hs_bindgen_eac2f9645ef29119_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @square_pp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 15:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pp_unsafe :: CInt -> IO CInt
+{-|
+
+    Marked @__attribute((pure))__@
+
+    __C declaration:__ @square_pp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 15:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pp_unsafe = hs_bindgen_eac2f9645ef29119
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cp@
+foreign import ccall unsafe "hs_bindgen_9445b7269de35e9e" hs_bindgen_9445b7269de35e9e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cp@
+hs_bindgen_9445b7269de35e9e :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cp@
+hs_bindgen_9445b7269de35e9e = fmap fromFFIType hs_bindgen_9445b7269de35e9e_base
+{-# NOINLINE square_cp_funptr #-}
+{-| __C declaration:__ @square_cp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 9:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cp_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @square_cp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 9:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cp_funptr = unsafePerformIO hs_bindgen_9445b7269de35e9e
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pc@
+foreign import ccall unsafe "hs_bindgen_b0c647124e93645d" hs_bindgen_b0c647124e93645d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pc@
+hs_bindgen_b0c647124e93645d :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pc@
+hs_bindgen_b0c647124e93645d = fmap fromFFIType hs_bindgen_b0c647124e93645d_base
+{-# NOINLINE square_pc_funptr #-}
+{-| __C declaration:__ @square_pc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 11:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pc_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @square_pc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 11:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pc_funptr = unsafePerformIO hs_bindgen_b0c647124e93645d
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cc@
+foreign import ccall unsafe "hs_bindgen_87ee2f018e6d262a" hs_bindgen_87ee2f018e6d262a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cc@
+hs_bindgen_87ee2f018e6d262a :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_cc@
+hs_bindgen_87ee2f018e6d262a = fmap fromFFIType hs_bindgen_87ee2f018e6d262a_base
+{-# NOINLINE square_cc_funptr #-}
+{-| __C declaration:__ @square_cc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 13:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cc_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @square_cc@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 13:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_cc_funptr = unsafePerformIO hs_bindgen_87ee2f018e6d262a
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pp@
+foreign import ccall unsafe "hs_bindgen_0f31a17bf5ee4e4f" hs_bindgen_0f31a17bf5ee4e4f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pp@
+hs_bindgen_0f31a17bf5ee4e4f :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_functionsfun_attributes_confl_Example_get_square_pp@
+hs_bindgen_0f31a17bf5ee4e4f = fmap fromFFIType hs_bindgen_0f31a17bf5ee4e4f_base
+{-# NOINLINE square_pp_funptr #-}
+{-| __C declaration:__ @square_pp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 15:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pp_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @square_pp@
+
+    __defined at:__ @functions\/fun_attributes_conflict.h 15:5@
+
+    __exported by:__ @functions\/fun_attributes_conflict.h@
+-}
+square_pp_funptr = unsafePerformIO hs_bindgen_0f31a17bf5ee4e4f
diff --git a/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example.hs b/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example.hs
@@ -0,0 +1,116 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.mY_FEATURE
+    , Example.mY_SIZE
+    , Example.Hash_defines_buffer(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @macro MY_FEATURE@
+
+    __defined at:__ @root directive@
+-}
+mY_FEATURE :: BG.CInt
+mY_FEATURE = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro MY_SIZE@
+
+    __defined at:__ @root directive@
+-}
+mY_SIZE :: BG.CInt
+mY_SIZE = (8 :: BG.CInt)
+
+{-| __C declaration:__ @struct hash_defines_buffer@
+
+    __defined at:__ @functions\/hash_defines.h 14:8@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+data Hash_defines_buffer = Hash_defines_buffer
+  { hash_defines_buffer_data :: CA.ConstantArray 8 BG.CChar
+    {- ^ __C declaration:__ @data@
+
+         __defined at:__ @functions\/hash_defines.h 15:8@
+
+         __exported by:__ @functions\/hash_defines.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Hash_defines_buffer where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Hash_defines_buffer where
+
+  readRaw =
+    \ptr0 ->
+          pure Hash_defines_buffer
+      <*> HasCField.readRaw (BG.Proxy @"hash_defines_buffer_data") ptr0
+
+instance Marshal.WriteRaw Hash_defines_buffer where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Hash_defines_buffer hash_defines_buffer_data2 ->
+            HasCField.writeRaw (BG.Proxy @"hash_defines_buffer_data") ptr0 hash_defines_buffer_data2
+
+deriving via Marshal.EquivStorable Hash_defines_buffer instance BG.Storable Hash_defines_buffer
+
+deriving via Struct.IsStructViaReadRaw Hash_defines_buffer instance Struct.IsStruct Hash_defines_buffer
+
+{-| __C declaration:__ @data@
+
+    __defined at:__ @functions\/hash_defines.h 15:8@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+instance ( ty ~ CA.ConstantArray 8 BG.CChar
+         ) => BG.CompatHasField.HasField "hash_defines_buffer_data" Hash_defines_buffer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Hash_defines_buffer {hash_defines_buffer_data = y1}
+      , BG.getField @"hash_defines_buffer_data" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 8 BG.CChar
+         ) => BG.HasField "hash_defines_buffer_data" (BG.Ptr Hash_defines_buffer) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"hash_defines_buffer_data")
+
+instance HasCField.HasCField Hash_defines_buffer "hash_defines_buffer_data" where
+
+  type CFieldType Hash_defines_buffer "hash_defines_buffer_data" =
+    CA.ConstantArray 8 BG.CChar
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example/FunPtr.hs b/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example/FunPtr.hs
@@ -0,0 +1,75 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.hash_defines_feature
+    , Example.FunPtr.hash_defines_empty
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#define MY_FEATURE 1"
+  , "#define MY_SIZE 8"
+  , "#define MY_EMPTY"
+  , "#include <functions/hash_defines.h>"
+  , "/* test_functionshash_defines_1_selec_Example_get_hash_defines_feature */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_50e4783814da01a4 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &hash_defines_feature;"
+  , "}"
+  , "/* test_functionshash_defines_1_selec_Example_get_hash_defines_empty */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_b21d3bcdf79e0d85 (void)) (void)"
+  , "{"
+  , "  return &hash_defines_empty;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_feature@
+foreign import ccall unsafe "hs_bindgen_50e4783814da01a4" hs_bindgen_50e4783814da01a4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_feature@
+hs_bindgen_50e4783814da01a4 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_50e4783814da01a4 =
+  fmap BG.fromFFIType hs_bindgen_50e4783814da01a4_base
+
+{-# NOINLINE hash_defines_feature #-}
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+hash_defines_feature =
+  BG.unsafePerformIO hs_bindgen_50e4783814da01a4
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_empty@
+foreign import ccall unsafe "hs_bindgen_b21d3bcdf79e0d85" hs_bindgen_b21d3bcdf79e0d85_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_empty@
+hs_bindgen_b21d3bcdf79e0d85 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_b21d3bcdf79e0d85 =
+  fmap BG.fromFFIType hs_bindgen_b21d3bcdf79e0d85_base
+
+{-# NOINLINE hash_defines_empty #-}
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty :: BG.FunPtr (IO BG.CInt)
+hash_defines_empty =
+  BG.unsafePerformIO hs_bindgen_b21d3bcdf79e0d85
diff --git a/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example/Safe.hs b/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example/Safe.hs
@@ -0,0 +1,74 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.hash_defines_feature
+    , Example.Safe.hash_defines_empty
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#define MY_FEATURE 1"
+  , "#define MY_SIZE 8"
+  , "#define MY_EMPTY"
+  , "#include <functions/hash_defines.h>"
+  , "signed int hs_bindgen_6aab0c8e3c921393 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (hash_defines_feature)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_af6bf91e93f5ed0c (void)"
+  , "{"
+  , "  return (hash_defines_empty)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_feature@
+foreign import ccall safe "hs_bindgen_6aab0c8e3c921393" hs_bindgen_6aab0c8e3c921393_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_feature@
+hs_bindgen_6aab0c8e3c921393 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_6aab0c8e3c921393 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6aab0c8e3c921393_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+hash_defines_feature = hs_bindgen_6aab0c8e3c921393
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_empty@
+foreign import ccall safe "hs_bindgen_af6bf91e93f5ed0c" hs_bindgen_af6bf91e93f5ed0c_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_empty@
+hs_bindgen_af6bf91e93f5ed0c :: IO BG.CInt
+hs_bindgen_af6bf91e93f5ed0c =
+  fmap BG.fromFFIType hs_bindgen_af6bf91e93f5ed0c_base
+
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty :: IO BG.CInt
+hash_defines_empty = hs_bindgen_af6bf91e93f5ed0c
diff --git a/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example/Unsafe.hs b/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines.1.select_all/Example/Unsafe.hs
@@ -0,0 +1,74 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.hash_defines_feature
+    , Example.Unsafe.hash_defines_empty
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#define MY_FEATURE 1"
+  , "#define MY_SIZE 8"
+  , "#define MY_EMPTY"
+  , "#include <functions/hash_defines.h>"
+  , "signed int hs_bindgen_9c64b65744839a8b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (hash_defines_feature)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f811fa46f514d285 (void)"
+  , "{"
+  , "  return (hash_defines_empty)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_feature@
+foreign import ccall unsafe "hs_bindgen_9c64b65744839a8b" hs_bindgen_9c64b65744839a8b_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_feature@
+hs_bindgen_9c64b65744839a8b ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_9c64b65744839a8b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9c64b65744839a8b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+hash_defines_feature = hs_bindgen_9c64b65744839a8b
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_empty@
+foreign import ccall unsafe "hs_bindgen_f811fa46f514d285" hs_bindgen_f811fa46f514d285_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_empty@
+hs_bindgen_f811fa46f514d285 :: IO BG.CInt
+hs_bindgen_f811fa46f514d285 =
+  fmap BG.fromFFIType hs_bindgen_f811fa46f514d285_base
+
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty :: IO BG.CInt
+hash_defines_empty = hs_bindgen_f811fa46f514d285
diff --git a/test-artefacts/fixtures/functions/hash_defines.1.select_all/bindingspec.yaml b/test-artefacts/fixtures/functions/hash_defines.1.select_all/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines.1.select_all/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/hash_defines.h
+  cname: struct hash_defines_buffer
+  hsname: Hash_defines_buffer
+hstypes:
+- hsname: Hash_defines_buffer
+  representation:
+    record:
+      constructor: Hash_defines_buffer
+      fields:
+      - hash_defines_buffer_data
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/hash_defines.1.select_all/th.txt b/test-artefacts/fixtures/functions/hash_defines.1.select_all/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines.1.select_all/th.txt
@@ -0,0 +1,228 @@
+-- addDependentFile test-artefacts/headers/golden/functions/hash_defines.h
+-- #define MY_FEATURE 1
+-- #define MY_SIZE 8
+-- #define MY_EMPTY
+-- #include <functions/hash_defines.h>
+-- signed int hs_bindgen_6aab0c8e3c921393 (
+--   signed int arg1
+-- )
+-- {
+--   return (hash_defines_feature)(arg1);
+-- }
+-- signed int hs_bindgen_af6bf91e93f5ed0c (void)
+-- {
+--   return (hash_defines_empty)();
+-- }
+-- signed int hs_bindgen_9c64b65744839a8b (
+--   signed int arg1
+-- )
+-- {
+--   return (hash_defines_feature)(arg1);
+-- }
+-- signed int hs_bindgen_f811fa46f514d285 (void)
+-- {
+--   return (hash_defines_empty)();
+-- }
+-- /* test_functionshash_defines_1_selec_Example_get_hash_defines_feature */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_50e4783814da01a4 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &hash_defines_feature;
+-- }
+-- /* test_functionshash_defines_1_selec_Example_get_hash_defines_empty */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_b21d3bcdf79e0d85 (void)) (void)
+-- {
+--   return &hash_defines_empty;
+-- }
+{-| __C declaration:__ @macro MY_FEATURE@
+
+    __defined at:__ @root directive@
+-}
+mY_FEATURE :: CInt
+{-| __C declaration:__ @macro MY_FEATURE@
+
+    __defined at:__ @root directive@
+-}
+mY_FEATURE = 1 :: CInt
+{-| __C declaration:__ @macro MY_SIZE@
+
+    __defined at:__ @root directive@
+-}
+mY_SIZE :: CInt
+{-| __C declaration:__ @macro MY_SIZE@
+
+    __defined at:__ @root directive@
+-}
+mY_SIZE = 8 :: CInt
+{-| __C declaration:__ @struct hash_defines_buffer@
+
+    __defined at:__ @functions\/hash_defines.h 14:8@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+data Hash_defines_buffer
+    = Hash_defines_buffer {hash_defines_buffer_data :: (ConstantArray 8
+                                                                      CChar)
+                           {- ^ __C declaration:__ @data@
+
+                                __defined at:__ @functions\/hash_defines.h 15:8@
+
+                                __exported by:__ @functions\/hash_defines.h@
+                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Hash_defines_buffer
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Hash_defines_buffer
+    where readRaw = \ptr_0 -> pure Hash_defines_buffer <*> readRaw (Proxy @"hash_defines_buffer_data") ptr_0
+instance WriteRaw Hash_defines_buffer
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Hash_defines_buffer hash_defines_buffer_data_2 -> writeRaw (Proxy @"hash_defines_buffer_data") ptr_0 hash_defines_buffer_data_2
+deriving via (EquivStorable Hash_defines_buffer) instance Storable Hash_defines_buffer
+deriving via (IsStructViaReadRaw Hash_defines_buffer) instance IsStruct Hash_defines_buffer
+instance (~) ty (ConstantArray 8 CChar) =>
+         HasField "hash_defines_buffer_data" Hash_defines_buffer ty
+    where hasField = \x_0 -> (\y_1 -> Hash_defines_buffer{hash_defines_buffer_data = y_1},
+                              getField @"hash_defines_buffer_data" x_0)
+instance (~) ty (ConstantArray 8 CChar) =>
+         HasField "hash_defines_buffer_data"
+                  (Ptr Hash_defines_buffer)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"hash_defines_buffer_data")
+instance HasCField Hash_defines_buffer "hash_defines_buffer_data"
+    where type CFieldType Hash_defines_buffer
+                          "hash_defines_buffer_data" = ConstantArray 8 CChar
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_feature@
+foreign import ccall safe "hs_bindgen_6aab0c8e3c921393" hs_bindgen_6aab0c8e3c921393_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_feature@
+hs_bindgen_6aab0c8e3c921393 :: CInt -> IO CInt
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_feature@
+hs_bindgen_6aab0c8e3c921393 = \x_0 -> fmap fromFFIType (hs_bindgen_6aab0c8e3c921393_base (toFFIType x_0))
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_safe :: CInt -> IO CInt
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_safe = hs_bindgen_6aab0c8e3c921393
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_empty@
+foreign import ccall safe "hs_bindgen_af6bf91e93f5ed0c" hs_bindgen_af6bf91e93f5ed0c_base ::
+    IO CInt
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_empty@
+hs_bindgen_af6bf91e93f5ed0c :: IO CInt
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Safe_hash_defines_empty@
+hs_bindgen_af6bf91e93f5ed0c = fmap fromFFIType hs_bindgen_af6bf91e93f5ed0c_base
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_safe :: IO CInt
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_safe = hs_bindgen_af6bf91e93f5ed0c
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_feature@
+foreign import ccall unsafe "hs_bindgen_9c64b65744839a8b" hs_bindgen_9c64b65744839a8b_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_feature@
+hs_bindgen_9c64b65744839a8b :: CInt -> IO CInt
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_feature@
+hs_bindgen_9c64b65744839a8b = \x_0 -> fmap fromFFIType (hs_bindgen_9c64b65744839a8b_base (toFFIType x_0))
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_unsafe = hs_bindgen_9c64b65744839a8b
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_empty@
+foreign import ccall unsafe "hs_bindgen_f811fa46f514d285" hs_bindgen_f811fa46f514d285_base ::
+    IO CInt
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_empty@
+hs_bindgen_f811fa46f514d285 :: IO CInt
+-- __unique:__ @test_functionshash_defines_1_selec_Example_Unsafe_hash_defines_empty@
+hs_bindgen_f811fa46f514d285 = fmap fromFFIType hs_bindgen_f811fa46f514d285_base
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_unsafe :: IO CInt
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_unsafe = hs_bindgen_f811fa46f514d285
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_feature@
+foreign import ccall unsafe "hs_bindgen_50e4783814da01a4" hs_bindgen_50e4783814da01a4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_feature@
+hs_bindgen_50e4783814da01a4 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_feature@
+hs_bindgen_50e4783814da01a4 = fmap fromFFIType hs_bindgen_50e4783814da01a4_base
+{-# NOINLINE hash_defines_feature_funptr #-}
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_funptr = unsafePerformIO hs_bindgen_50e4783814da01a4
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_empty@
+foreign import ccall unsafe "hs_bindgen_b21d3bcdf79e0d85" hs_bindgen_b21d3bcdf79e0d85_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_empty@
+hs_bindgen_b21d3bcdf79e0d85 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_functionshash_defines_1_selec_Example_get_hash_defines_empty@
+hs_bindgen_b21d3bcdf79e0d85 = fmap fromFFIType hs_bindgen_b21d3bcdf79e0d85_base
+{-# NOINLINE hash_defines_empty_funptr #-}
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_funptr = unsafePerformIO hs_bindgen_b21d3bcdf79e0d85
diff --git a/test-artefacts/fixtures/functions/hash_defines/Example.hs b/test-artefacts/fixtures/functions/hash_defines/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines/Example.hs
@@ -0,0 +1,99 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Hash_defines_buffer(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct hash_defines_buffer@
+
+    __defined at:__ @functions\/hash_defines.h 14:8@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+data Hash_defines_buffer = Hash_defines_buffer
+  { hash_defines_buffer_data :: CA.ConstantArray 8 BG.CChar
+    {- ^ __C declaration:__ @data@
+
+         __defined at:__ @functions\/hash_defines.h 15:8@
+
+         __exported by:__ @functions\/hash_defines.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Hash_defines_buffer where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Hash_defines_buffer where
+
+  readRaw =
+    \ptr0 ->
+          pure Hash_defines_buffer
+      <*> HasCField.readRaw (BG.Proxy @"hash_defines_buffer_data") ptr0
+
+instance Marshal.WriteRaw Hash_defines_buffer where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Hash_defines_buffer hash_defines_buffer_data2 ->
+            HasCField.writeRaw (BG.Proxy @"hash_defines_buffer_data") ptr0 hash_defines_buffer_data2
+
+deriving via Marshal.EquivStorable Hash_defines_buffer instance BG.Storable Hash_defines_buffer
+
+deriving via Struct.IsStructViaReadRaw Hash_defines_buffer instance Struct.IsStruct Hash_defines_buffer
+
+{-| __C declaration:__ @data@
+
+    __defined at:__ @functions\/hash_defines.h 15:8@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+instance ( ty ~ CA.ConstantArray 8 BG.CChar
+         ) => BG.CompatHasField.HasField "hash_defines_buffer_data" Hash_defines_buffer ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Hash_defines_buffer {hash_defines_buffer_data = y1}
+      , BG.getField @"hash_defines_buffer_data" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 8 BG.CChar
+         ) => BG.HasField "hash_defines_buffer_data" (BG.Ptr Hash_defines_buffer) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"hash_defines_buffer_data")
+
+instance HasCField.HasCField Hash_defines_buffer "hash_defines_buffer_data" where
+
+  type CFieldType Hash_defines_buffer "hash_defines_buffer_data" =
+    CA.ConstantArray 8 BG.CChar
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/hash_defines/Example/FunPtr.hs b/test-artefacts/fixtures/functions/hash_defines/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines/Example/FunPtr.hs
@@ -0,0 +1,75 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.hash_defines_feature
+    , Example.FunPtr.hash_defines_empty
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#define MY_FEATURE 1"
+  , "#define MY_SIZE 8"
+  , "#define MY_EMPTY"
+  , "#include <functions/hash_defines.h>"
+  , "/* test_functionshash_defines_Example_get_hash_defines_feature */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ebc7bd37f43918fa (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &hash_defines_feature;"
+  , "}"
+  , "/* test_functionshash_defines_Example_get_hash_defines_empty */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_11624d9d43a105dc (void)) (void)"
+  , "{"
+  , "  return &hash_defines_empty;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_feature@
+foreign import ccall unsafe "hs_bindgen_ebc7bd37f43918fa" hs_bindgen_ebc7bd37f43918fa_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_feature@
+hs_bindgen_ebc7bd37f43918fa :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_ebc7bd37f43918fa =
+  fmap BG.fromFFIType hs_bindgen_ebc7bd37f43918fa_base
+
+{-# NOINLINE hash_defines_feature #-}
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+hash_defines_feature =
+  BG.unsafePerformIO hs_bindgen_ebc7bd37f43918fa
+
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_empty@
+foreign import ccall unsafe "hs_bindgen_11624d9d43a105dc" hs_bindgen_11624d9d43a105dc_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_empty@
+hs_bindgen_11624d9d43a105dc :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_11624d9d43a105dc =
+  fmap BG.fromFFIType hs_bindgen_11624d9d43a105dc_base
+
+{-# NOINLINE hash_defines_empty #-}
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty :: BG.FunPtr (IO BG.CInt)
+hash_defines_empty =
+  BG.unsafePerformIO hs_bindgen_11624d9d43a105dc
diff --git a/test-artefacts/fixtures/functions/hash_defines/Example/Safe.hs b/test-artefacts/fixtures/functions/hash_defines/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines/Example/Safe.hs
@@ -0,0 +1,74 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.hash_defines_feature
+    , Example.Safe.hash_defines_empty
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#define MY_FEATURE 1"
+  , "#define MY_SIZE 8"
+  , "#define MY_EMPTY"
+  , "#include <functions/hash_defines.h>"
+  , "signed int hs_bindgen_8b3d8c537a5a6361 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (hash_defines_feature)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_60d52d7fed356c54 (void)"
+  , "{"
+  , "  return (hash_defines_empty)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_feature@
+foreign import ccall safe "hs_bindgen_8b3d8c537a5a6361" hs_bindgen_8b3d8c537a5a6361_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_feature@
+hs_bindgen_8b3d8c537a5a6361 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_8b3d8c537a5a6361 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8b3d8c537a5a6361_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+hash_defines_feature = hs_bindgen_8b3d8c537a5a6361
+
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_empty@
+foreign import ccall safe "hs_bindgen_60d52d7fed356c54" hs_bindgen_60d52d7fed356c54_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_empty@
+hs_bindgen_60d52d7fed356c54 :: IO BG.CInt
+hs_bindgen_60d52d7fed356c54 =
+  fmap BG.fromFFIType hs_bindgen_60d52d7fed356c54_base
+
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty :: IO BG.CInt
+hash_defines_empty = hs_bindgen_60d52d7fed356c54
diff --git a/test-artefacts/fixtures/functions/hash_defines/Example/Unsafe.hs b/test-artefacts/fixtures/functions/hash_defines/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines/Example/Unsafe.hs
@@ -0,0 +1,74 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.hash_defines_feature
+    , Example.Unsafe.hash_defines_empty
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#define MY_FEATURE 1"
+  , "#define MY_SIZE 8"
+  , "#define MY_EMPTY"
+  , "#include <functions/hash_defines.h>"
+  , "signed int hs_bindgen_2d6dbb74d32d186a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (hash_defines_feature)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_ba61b6fc716692e4 (void)"
+  , "{"
+  , "  return (hash_defines_empty)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_feature@
+foreign import ccall unsafe "hs_bindgen_2d6dbb74d32d186a" hs_bindgen_2d6dbb74d32d186a_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_feature@
+hs_bindgen_2d6dbb74d32d186a ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_2d6dbb74d32d186a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2d6dbb74d32d186a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+hash_defines_feature = hs_bindgen_2d6dbb74d32d186a
+
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_empty@
+foreign import ccall unsafe "hs_bindgen_ba61b6fc716692e4" hs_bindgen_ba61b6fc716692e4_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_empty@
+hs_bindgen_ba61b6fc716692e4 :: IO BG.CInt
+hs_bindgen_ba61b6fc716692e4 =
+  fmap BG.fromFFIType hs_bindgen_ba61b6fc716692e4_base
+
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty :: IO BG.CInt
+hash_defines_empty = hs_bindgen_ba61b6fc716692e4
diff --git a/test-artefacts/fixtures/functions/hash_defines/bindingspec.yaml b/test-artefacts/fixtures/functions/hash_defines/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/hash_defines.h
+  cname: struct hash_defines_buffer
+  hsname: Hash_defines_buffer
+hstypes:
+- hsname: Hash_defines_buffer
+  representation:
+    record:
+      constructor: Hash_defines_buffer
+      fields:
+      - hash_defines_buffer_data
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/hash_defines/th.txt b/test-artefacts/fixtures/functions/hash_defines/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/hash_defines/th.txt
@@ -0,0 +1,208 @@
+-- addDependentFile test-artefacts/headers/golden/functions/hash_defines.h
+-- #define MY_FEATURE 1
+-- #define MY_SIZE 8
+-- #define MY_EMPTY
+-- #include <functions/hash_defines.h>
+-- signed int hs_bindgen_8b3d8c537a5a6361 (
+--   signed int arg1
+-- )
+-- {
+--   return (hash_defines_feature)(arg1);
+-- }
+-- signed int hs_bindgen_60d52d7fed356c54 (void)
+-- {
+--   return (hash_defines_empty)();
+-- }
+-- signed int hs_bindgen_2d6dbb74d32d186a (
+--   signed int arg1
+-- )
+-- {
+--   return (hash_defines_feature)(arg1);
+-- }
+-- signed int hs_bindgen_ba61b6fc716692e4 (void)
+-- {
+--   return (hash_defines_empty)();
+-- }
+-- /* test_functionshash_defines_Example_get_hash_defines_feature */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ebc7bd37f43918fa (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &hash_defines_feature;
+-- }
+-- /* test_functionshash_defines_Example_get_hash_defines_empty */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_11624d9d43a105dc (void)) (void)
+-- {
+--   return &hash_defines_empty;
+-- }
+{-| __C declaration:__ @struct hash_defines_buffer@
+
+    __defined at:__ @functions\/hash_defines.h 14:8@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+data Hash_defines_buffer
+    = Hash_defines_buffer {hash_defines_buffer_data :: (ConstantArray 8
+                                                                      CChar)
+                           {- ^ __C declaration:__ @data@
+
+                                __defined at:__ @functions\/hash_defines.h 15:8@
+
+                                __exported by:__ @functions\/hash_defines.h@
+                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Hash_defines_buffer
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Hash_defines_buffer
+    where readRaw = \ptr_0 -> pure Hash_defines_buffer <*> readRaw (Proxy @"hash_defines_buffer_data") ptr_0
+instance WriteRaw Hash_defines_buffer
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Hash_defines_buffer hash_defines_buffer_data_2 -> writeRaw (Proxy @"hash_defines_buffer_data") ptr_0 hash_defines_buffer_data_2
+deriving via (EquivStorable Hash_defines_buffer) instance Storable Hash_defines_buffer
+deriving via (IsStructViaReadRaw Hash_defines_buffer) instance IsStruct Hash_defines_buffer
+instance (~) ty (ConstantArray 8 CChar) =>
+         HasField "hash_defines_buffer_data" Hash_defines_buffer ty
+    where hasField = \x_0 -> (\y_1 -> Hash_defines_buffer{hash_defines_buffer_data = y_1},
+                              getField @"hash_defines_buffer_data" x_0)
+instance (~) ty (ConstantArray 8 CChar) =>
+         HasField "hash_defines_buffer_data"
+                  (Ptr Hash_defines_buffer)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"hash_defines_buffer_data")
+instance HasCField Hash_defines_buffer "hash_defines_buffer_data"
+    where type CFieldType Hash_defines_buffer
+                          "hash_defines_buffer_data" = ConstantArray 8 CChar
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_feature@
+foreign import ccall safe "hs_bindgen_8b3d8c537a5a6361" hs_bindgen_8b3d8c537a5a6361_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_feature@
+hs_bindgen_8b3d8c537a5a6361 :: CInt -> IO CInt
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_feature@
+hs_bindgen_8b3d8c537a5a6361 = \x_0 -> fmap fromFFIType (hs_bindgen_8b3d8c537a5a6361_base (toFFIType x_0))
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_safe :: CInt -> IO CInt
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_safe = hs_bindgen_8b3d8c537a5a6361
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_empty@
+foreign import ccall safe "hs_bindgen_60d52d7fed356c54" hs_bindgen_60d52d7fed356c54_base ::
+    IO CInt
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_empty@
+hs_bindgen_60d52d7fed356c54 :: IO CInt
+-- __unique:__ @test_functionshash_defines_Example_Safe_hash_defines_empty@
+hs_bindgen_60d52d7fed356c54 = fmap fromFFIType hs_bindgen_60d52d7fed356c54_base
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_safe :: IO CInt
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_safe = hs_bindgen_60d52d7fed356c54
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_feature@
+foreign import ccall unsafe "hs_bindgen_2d6dbb74d32d186a" hs_bindgen_2d6dbb74d32d186a_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_feature@
+hs_bindgen_2d6dbb74d32d186a :: CInt -> IO CInt
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_feature@
+hs_bindgen_2d6dbb74d32d186a = \x_0 -> fmap fromFFIType (hs_bindgen_2d6dbb74d32d186a_base (toFFIType x_0))
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_unsafe = hs_bindgen_2d6dbb74d32d186a
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_empty@
+foreign import ccall unsafe "hs_bindgen_ba61b6fc716692e4" hs_bindgen_ba61b6fc716692e4_base ::
+    IO CInt
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_empty@
+hs_bindgen_ba61b6fc716692e4 :: IO CInt
+-- __unique:__ @test_functionshash_defines_Example_Unsafe_hash_defines_empty@
+hs_bindgen_ba61b6fc716692e4 = fmap fromFFIType hs_bindgen_ba61b6fc716692e4_base
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_unsafe :: IO CInt
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_unsafe = hs_bindgen_ba61b6fc716692e4
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_feature@
+foreign import ccall unsafe "hs_bindgen_ebc7bd37f43918fa" hs_bindgen_ebc7bd37f43918fa_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_feature@
+hs_bindgen_ebc7bd37f43918fa :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_feature@
+hs_bindgen_ebc7bd37f43918fa = fmap fromFFIType hs_bindgen_ebc7bd37f43918fa_base
+{-# NOINLINE hash_defines_feature_funptr #-}
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @hash_defines_feature@
+
+    __defined at:__ @functions\/hash_defines.h 9:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_feature_funptr = unsafePerformIO hs_bindgen_ebc7bd37f43918fa
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_empty@
+foreign import ccall unsafe "hs_bindgen_11624d9d43a105dc" hs_bindgen_11624d9d43a105dc_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_empty@
+hs_bindgen_11624d9d43a105dc :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_functionshash_defines_Example_get_hash_defines_empty@
+hs_bindgen_11624d9d43a105dc = fmap fromFFIType hs_bindgen_11624d9d43a105dc_base
+{-# NOINLINE hash_defines_empty_funptr #-}
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @hash_defines_empty@
+
+    __defined at:__ @functions\/hash_defines.h 20:5@
+
+    __exported by:__ @functions\/hash_defines.h@
+-}
+hash_defines_empty_funptr = unsafePerformIO hs_bindgen_11624d9d43a105dc
diff --git a/test-artefacts/fixtures/functions/heap_types/struct/Example.hs b/test-artefacts/fixtures/functions/heap_types/struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/heap_types\/struct.h 3:8@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+data T = T
+  { t_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @functions\/heap_types\/struct.h 4:7@
+
+         __exported by:__ @functions\/heap_types\/struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> HasCField.readRaw (BG.Proxy @"t_x") ptr0
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T t_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t_x") ptr0 t_x2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via Struct.IsStructViaReadRaw T instance Struct.IsStruct T
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/struct.h 4:7@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_x" T ty where
+
+  hasField =
+    \x0 -> (\y1 -> T {t_x = y1}, BG.getField @"t_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_x" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_x")
+
+instance HasCField.HasCField T "t_x" where
+
+  type CFieldType T "t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/heap_types/struct/Example/FunPtr.hs b/test-artefacts/fixtures/functions/heap_types/struct/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct/Example/FunPtr.hs
@@ -0,0 +1,161 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun
+    , Example.FunPtr.param_underscore
+    , Example.FunPtr.param_uppercase
+    , Example.FunPtr.param_undersore_capital
+    , Example.FunPtr.param_haskell_reserved_name
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct.h>"
+  , "/* test_functionsheap_typesstruct_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "T (*hs_bindgen_071e2eda58051e4a (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  , "/* test_functionsheap_typesstruct_Example_get_param_underscore */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ee52ac50697405f8 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &param_underscore;"
+  , "}"
+  , "/* test_functionsheap_typesstruct_Example_get_param_uppercase */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b51cac34e6c4eca3 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &param_uppercase;"
+  , "}"
+  , "/* test_functionsheap_typesstruct_Example_get_param_undersore_capital */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2302284a38d84764 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &param_undersore_capital;"
+  , "}"
+  , "/* test_functionsheap_typesstruct_Example_get_param_haskell_reserved_name */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_af57be8569d5f651 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &param_haskell_reserved_name;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_071e2eda58051e4a" hs_bindgen_071e2eda58051e4a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_fun@
+hs_bindgen_071e2eda58051e4a :: IO (BG.FunPtr (T -> IO T))
+hs_bindgen_071e2eda58051e4a =
+  fmap BG.fromFFIType hs_bindgen_071e2eda58051e4a_base
+
+{-# NOINLINE fun #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+fun :: BG.FunPtr (T -> IO T)
+fun = BG.unsafePerformIO hs_bindgen_071e2eda58051e4a
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_underscore@
+foreign import ccall unsafe "hs_bindgen_ee52ac50697405f8" hs_bindgen_ee52ac50697405f8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_underscore@
+hs_bindgen_ee52ac50697405f8 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_ee52ac50697405f8 =
+  fmap BG.fromFFIType hs_bindgen_ee52ac50697405f8_base
+
+{-# NOINLINE param_underscore #-}
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @functions\/heap_types\/struct.h 12:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_underscore :: BG.FunPtr (T -> IO ())
+param_underscore =
+  BG.unsafePerformIO hs_bindgen_ee52ac50697405f8
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_uppercase@
+foreign import ccall unsafe "hs_bindgen_b51cac34e6c4eca3" hs_bindgen_b51cac34e6c4eca3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_uppercase@
+hs_bindgen_b51cac34e6c4eca3 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_b51cac34e6c4eca3 =
+  fmap BG.fromFFIType hs_bindgen_b51cac34e6c4eca3_base
+
+{-# NOINLINE param_uppercase #-}
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @functions\/heap_types\/struct.h 13:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_uppercase :: BG.FunPtr (T -> IO ())
+param_uppercase =
+  BG.unsafePerformIO hs_bindgen_b51cac34e6c4eca3
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_undersore_capital@
+foreign import ccall unsafe "hs_bindgen_2302284a38d84764" hs_bindgen_2302284a38d84764_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_undersore_capital@
+hs_bindgen_2302284a38d84764 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_2302284a38d84764 =
+  fmap BG.fromFFIType hs_bindgen_2302284a38d84764_base
+
+{-# NOINLINE param_undersore_capital #-}
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @functions\/heap_types\/struct.h 14:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_undersore_capital :: BG.FunPtr (T -> IO ())
+param_undersore_capital =
+  BG.unsafePerformIO hs_bindgen_2302284a38d84764
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_haskell_reserved_name@
+foreign import ccall unsafe "hs_bindgen_af57be8569d5f651" hs_bindgen_af57be8569d5f651_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_haskell_reserved_name@
+hs_bindgen_af57be8569d5f651 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_af57be8569d5f651 =
+  fmap BG.fromFFIType hs_bindgen_af57be8569d5f651_base
+
+{-# NOINLINE param_haskell_reserved_name #-}
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @functions\/heap_types\/struct.h 15:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_haskell_reserved_name :: BG.FunPtr (T -> IO ())
+param_haskell_reserved_name =
+  BG.unsafePerformIO hs_bindgen_af57be8569d5f651
diff --git a/test-artefacts/fixtures/functions/heap_types/struct/Example/Safe.hs b/test-artefacts/fixtures/functions/heap_types/struct/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct/Example/Safe.hs
@@ -0,0 +1,195 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun
+    , Example.Safe.param_underscore
+    , Example.Safe.param_uppercase
+    , Example.Safe.param_undersore_capital
+    , Example.Safe.param_haskell_reserved_name
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct.h>"
+  , "void hs_bindgen_a5d53f538e59b1fc ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  , "void hs_bindgen_8b003c42270f977d ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_underscore)(*arg1);"
+  , "}"
+  , "void hs_bindgen_820d4de13c1d8dff ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_uppercase)(*arg1);"
+  , "}"
+  , "void hs_bindgen_aa622269ffe58e15 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_undersore_capital)(*arg1);"
+  , "}"
+  , "void hs_bindgen_40fff9d72335931a ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_haskell_reserved_name)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_a5d53f538e59b1fc" hs_bindgen_a5d53f538e59b1fc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_fun@
+hs_bindgen_a5d53f538e59b1fc ::
+     BG.Ptr T
+  -> BG.Ptr T
+  -> IO ()
+hs_bindgen_a5d53f538e59b1fc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a5d53f538e59b1fc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_a5d53f538e59b1fc x1 res2))
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_underscore@
+foreign import ccall safe "hs_bindgen_8b003c42270f977d" hs_bindgen_8b003c42270f977d_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_underscore@
+hs_bindgen_8b003c42270f977d ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_8b003c42270f977d =
+  \x0 ->
+    hs_bindgen_8b003c42270f977d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @functions\/heap_types\/struct.h 12:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_underscore ::
+     T
+     -- ^ __C declaration:__ @_@
+  -> IO ()
+param_underscore =
+  \_0 ->
+    BG.with _0 (\_1 -> hs_bindgen_8b003c42270f977d _1)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_uppercase@
+foreign import ccall safe "hs_bindgen_820d4de13c1d8dff" hs_bindgen_820d4de13c1d8dff_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_uppercase@
+hs_bindgen_820d4de13c1d8dff ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_820d4de13c1d8dff =
+  \x0 ->
+    hs_bindgen_820d4de13c1d8dff_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @functions\/heap_types\/struct.h 13:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_uppercase ::
+     T
+     -- ^ __C declaration:__ @Type@
+  -> IO ()
+param_uppercase =
+  \type'0 ->
+    BG.with type'0 (\type'1 ->
+                      hs_bindgen_820d4de13c1d8dff type'1)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_undersore_capital@
+foreign import ccall safe "hs_bindgen_aa622269ffe58e15" hs_bindgen_aa622269ffe58e15_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_undersore_capital@
+hs_bindgen_aa622269ffe58e15 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_aa622269ffe58e15 =
+  \x0 ->
+    hs_bindgen_aa622269ffe58e15_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @functions\/heap_types\/struct.h 14:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_undersore_capital ::
+     T
+     -- ^ __C declaration:__ @_T@
+  -> IO ()
+param_undersore_capital =
+  \_T0 ->
+    BG.with _T0 (\_T1 -> hs_bindgen_aa622269ffe58e15 _T1)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_haskell_reserved_name@
+foreign import ccall safe "hs_bindgen_40fff9d72335931a" hs_bindgen_40fff9d72335931a_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_haskell_reserved_name@
+hs_bindgen_40fff9d72335931a ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_40fff9d72335931a =
+  \x0 ->
+    hs_bindgen_40fff9d72335931a_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @functions\/heap_types\/struct.h 15:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_haskell_reserved_name ::
+     T
+     -- ^ __C declaration:__ @type@
+  -> IO ()
+param_haskell_reserved_name =
+  \type'0 ->
+    BG.with type'0 (\type'1 ->
+                      hs_bindgen_40fff9d72335931a type'1)
diff --git a/test-artefacts/fixtures/functions/heap_types/struct/Example/Unsafe.hs b/test-artefacts/fixtures/functions/heap_types/struct/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct/Example/Unsafe.hs
@@ -0,0 +1,195 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun
+    , Example.Unsafe.param_underscore
+    , Example.Unsafe.param_uppercase
+    , Example.Unsafe.param_undersore_capital
+    , Example.Unsafe.param_haskell_reserved_name
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct.h>"
+  , "void hs_bindgen_c4af6bb824712c6a ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  , "void hs_bindgen_80a83be02e40bf03 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_underscore)(*arg1);"
+  , "}"
+  , "void hs_bindgen_bda30535ff7fd9f4 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_uppercase)(*arg1);"
+  , "}"
+  , "void hs_bindgen_7b5f5cbdd8a5ff0e ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_undersore_capital)(*arg1);"
+  , "}"
+  , "void hs_bindgen_5b71629b3ccc3fa8 ("
+  , "  T *arg1"
+  , ")"
+  , "{"
+  , "  (param_haskell_reserved_name)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_c4af6bb824712c6a" hs_bindgen_c4af6bb824712c6a_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_fun@
+hs_bindgen_c4af6bb824712c6a ::
+     BG.Ptr T
+  -> BG.Ptr T
+  -> IO ()
+hs_bindgen_c4af6bb824712c6a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c4af6bb824712c6a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_c4af6bb824712c6a x1 res2))
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_underscore@
+foreign import ccall unsafe "hs_bindgen_80a83be02e40bf03" hs_bindgen_80a83be02e40bf03_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_underscore@
+hs_bindgen_80a83be02e40bf03 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_80a83be02e40bf03 =
+  \x0 ->
+    hs_bindgen_80a83be02e40bf03_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @functions\/heap_types\/struct.h 12:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_underscore ::
+     T
+     -- ^ __C declaration:__ @_@
+  -> IO ()
+param_underscore =
+  \_0 ->
+    BG.with _0 (\_1 -> hs_bindgen_80a83be02e40bf03 _1)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_uppercase@
+foreign import ccall unsafe "hs_bindgen_bda30535ff7fd9f4" hs_bindgen_bda30535ff7fd9f4_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_uppercase@
+hs_bindgen_bda30535ff7fd9f4 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_bda30535ff7fd9f4 =
+  \x0 ->
+    hs_bindgen_bda30535ff7fd9f4_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @functions\/heap_types\/struct.h 13:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_uppercase ::
+     T
+     -- ^ __C declaration:__ @Type@
+  -> IO ()
+param_uppercase =
+  \type'0 ->
+    BG.with type'0 (\type'1 ->
+                      hs_bindgen_bda30535ff7fd9f4 type'1)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_undersore_capital@
+foreign import ccall unsafe "hs_bindgen_7b5f5cbdd8a5ff0e" hs_bindgen_7b5f5cbdd8a5ff0e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_undersore_capital@
+hs_bindgen_7b5f5cbdd8a5ff0e ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_7b5f5cbdd8a5ff0e =
+  \x0 ->
+    hs_bindgen_7b5f5cbdd8a5ff0e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @functions\/heap_types\/struct.h 14:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_undersore_capital ::
+     T
+     -- ^ __C declaration:__ @_T@
+  -> IO ()
+param_undersore_capital =
+  \_T0 ->
+    BG.with _T0 (\_T1 -> hs_bindgen_7b5f5cbdd8a5ff0e _T1)
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_haskell_reserved_name@
+foreign import ccall unsafe "hs_bindgen_5b71629b3ccc3fa8" hs_bindgen_5b71629b3ccc3fa8_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_haskell_reserved_name@
+hs_bindgen_5b71629b3ccc3fa8 ::
+     BG.Ptr T
+  -> IO ()
+hs_bindgen_5b71629b3ccc3fa8 =
+  \x0 ->
+    hs_bindgen_5b71629b3ccc3fa8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @functions\/heap_types\/struct.h 15:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_haskell_reserved_name ::
+     T
+     -- ^ __C declaration:__ @type@
+  -> IO ()
+param_haskell_reserved_name =
+  \type'0 ->
+    BG.with type'0 (\type'1 ->
+                      hs_bindgen_5b71629b3ccc3fa8 type'1)
diff --git a/test-artefacts/fixtures/functions/heap_types/struct/bindingspec.yaml b/test-artefacts/fixtures/functions/heap_types/struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct/bindingspec.yaml
@@ -0,0 +1,31 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/heap_types/struct.h
+  cname: struct S
+  hsname: T
+- headers: functions/heap_types/struct.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    record:
+      constructor: T
+      fields:
+      - t_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/heap_types/struct/th.txt b/test-artefacts/fixtures/functions/heap_types/struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct/th.txt
@@ -0,0 +1,469 @@
+-- addDependentFile test-artefacts/headers/golden/functions/heap_types/struct.h
+-- #include <functions/heap_types/struct.h>
+-- void hs_bindgen_a5d53f538e59b1fc (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- void hs_bindgen_8b003c42270f977d (
+--   T *arg1
+-- )
+-- {
+--   (param_underscore)(*arg1);
+-- }
+-- void hs_bindgen_820d4de13c1d8dff (
+--   T *arg1
+-- )
+-- {
+--   (param_uppercase)(*arg1);
+-- }
+-- void hs_bindgen_aa622269ffe58e15 (
+--   T *arg1
+-- )
+-- {
+--   (param_undersore_capital)(*arg1);
+-- }
+-- void hs_bindgen_40fff9d72335931a (
+--   T *arg1
+-- )
+-- {
+--   (param_haskell_reserved_name)(*arg1);
+-- }
+-- void hs_bindgen_c4af6bb824712c6a (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- void hs_bindgen_80a83be02e40bf03 (
+--   T *arg1
+-- )
+-- {
+--   (param_underscore)(*arg1);
+-- }
+-- void hs_bindgen_bda30535ff7fd9f4 (
+--   T *arg1
+-- )
+-- {
+--   (param_uppercase)(*arg1);
+-- }
+-- void hs_bindgen_7b5f5cbdd8a5ff0e (
+--   T *arg1
+-- )
+-- {
+--   (param_undersore_capital)(*arg1);
+-- }
+-- void hs_bindgen_5b71629b3ccc3fa8 (
+--   T *arg1
+-- )
+-- {
+--   (param_haskell_reserved_name)(*arg1);
+-- }
+-- /* test_functionsheap_typesstruct_Example_get_fun */
+-- __attribute__ ((const))
+-- T (*hs_bindgen_071e2eda58051e4a (void)) (
+--   T arg1
+-- )
+-- {
+--   return &fun;
+-- }
+-- /* test_functionsheap_typesstruct_Example_get_param_underscore */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ee52ac50697405f8 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &param_underscore;
+-- }
+-- /* test_functionsheap_typesstruct_Example_get_param_uppercase */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b51cac34e6c4eca3 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &param_uppercase;
+-- }
+-- /* test_functionsheap_typesstruct_Example_get_param_undersore_capital */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2302284a38d84764 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &param_undersore_capital;
+-- }
+-- /* test_functionsheap_typesstruct_Example_get_param_haskell_reserved_name */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_af57be8569d5f651 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &param_haskell_reserved_name;
+-- }
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/heap_types\/struct.h 3:8@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+data T
+    = T {t_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @functions\/heap_types\/struct.h 4:7@
+
+              __exported by:__ @functions\/heap_types\/struct.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRaw (Proxy @"t_x") ptr_0
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T t_x_2 -> writeRaw (Proxy @"t_x") ptr_0 t_x_2
+deriving via (EquivStorable T) instance Storable T
+deriving via (IsStructViaReadRaw T) instance IsStruct T
+instance (~) ty CInt => HasField "t_x" T ty
+    where hasField = \x_0 -> (\y_1 -> T{t_x = y_1},
+                              getField @"t_x" x_0)
+instance (~) ty CInt => HasField "t_x" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_x")
+instance HasCField T "t_x"
+    where type CFieldType T "t_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_a5d53f538e59b1fc" hs_bindgen_a5d53f538e59b1fc_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_fun@
+hs_bindgen_a5d53f538e59b1fc :: Ptr T -> Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_fun@
+hs_bindgen_a5d53f538e59b1fc = \x_0 -> \x_1 -> hs_bindgen_a5d53f538e59b1fc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+fun_safe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+fun_safe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_a5d53f538e59b1fc x_1 res_2))
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_underscore@
+foreign import ccall safe "hs_bindgen_8b003c42270f977d" hs_bindgen_8b003c42270f977d_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_underscore@
+hs_bindgen_8b003c42270f977d :: Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_underscore@
+hs_bindgen_8b003c42270f977d = \x_0 -> hs_bindgen_8b003c42270f977d_base (toFFIType x_0)
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @functions\/heap_types\/struct.h 12:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_underscore_safe :: T -> IO ()
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @functions\/heap_types\/struct.h 12:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_underscore_safe = \__0 -> with __0 (\__1 -> hs_bindgen_8b003c42270f977d __1)
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_uppercase@
+foreign import ccall safe "hs_bindgen_820d4de13c1d8dff" hs_bindgen_820d4de13c1d8dff_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_uppercase@
+hs_bindgen_820d4de13c1d8dff :: Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_uppercase@
+hs_bindgen_820d4de13c1d8dff = \x_0 -> hs_bindgen_820d4de13c1d8dff_base (toFFIType x_0)
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @functions\/heap_types\/struct.h 13:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_uppercase_safe :: T -> IO ()
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @functions\/heap_types\/struct.h 13:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_uppercase_safe = \type'_0 -> with type'_0 (\type'_1 -> hs_bindgen_820d4de13c1d8dff type'_1)
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_undersore_capital@
+foreign import ccall safe "hs_bindgen_aa622269ffe58e15" hs_bindgen_aa622269ffe58e15_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_undersore_capital@
+hs_bindgen_aa622269ffe58e15 :: Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_undersore_capital@
+hs_bindgen_aa622269ffe58e15 = \x_0 -> hs_bindgen_aa622269ffe58e15_base (toFFIType x_0)
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @functions\/heap_types\/struct.h 14:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_undersore_capital_safe :: T -> IO ()
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @functions\/heap_types\/struct.h 14:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_undersore_capital_safe = \_T_0 -> with _T_0 (\_T_1 -> hs_bindgen_aa622269ffe58e15 _T_1)
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_haskell_reserved_name@
+foreign import ccall safe "hs_bindgen_40fff9d72335931a" hs_bindgen_40fff9d72335931a_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_haskell_reserved_name@
+hs_bindgen_40fff9d72335931a :: Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Safe_param_haskell_reserved_name@
+hs_bindgen_40fff9d72335931a = \x_0 -> hs_bindgen_40fff9d72335931a_base (toFFIType x_0)
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @functions\/heap_types\/struct.h 15:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_haskell_reserved_name_safe :: T -> IO ()
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @functions\/heap_types\/struct.h 15:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_haskell_reserved_name_safe = \type'_0 -> with type'_0 (\type'_1 -> hs_bindgen_40fff9d72335931a type'_1)
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_c4af6bb824712c6a" hs_bindgen_c4af6bb824712c6a_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_fun@
+hs_bindgen_c4af6bb824712c6a :: Ptr T -> Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_fun@
+hs_bindgen_c4af6bb824712c6a = \x_0 -> \x_1 -> hs_bindgen_c4af6bb824712c6a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+fun_unsafe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+fun_unsafe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_c4af6bb824712c6a x_1 res_2))
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_underscore@
+foreign import ccall unsafe "hs_bindgen_80a83be02e40bf03" hs_bindgen_80a83be02e40bf03_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_underscore@
+hs_bindgen_80a83be02e40bf03 :: Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_underscore@
+hs_bindgen_80a83be02e40bf03 = \x_0 -> hs_bindgen_80a83be02e40bf03_base (toFFIType x_0)
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @functions\/heap_types\/struct.h 12:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_underscore_unsafe :: T -> IO ()
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @functions\/heap_types\/struct.h 12:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_underscore_unsafe = \__0 -> with __0 (\__1 -> hs_bindgen_80a83be02e40bf03 __1)
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_uppercase@
+foreign import ccall unsafe "hs_bindgen_bda30535ff7fd9f4" hs_bindgen_bda30535ff7fd9f4_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_uppercase@
+hs_bindgen_bda30535ff7fd9f4 :: Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_uppercase@
+hs_bindgen_bda30535ff7fd9f4 = \x_0 -> hs_bindgen_bda30535ff7fd9f4_base (toFFIType x_0)
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @functions\/heap_types\/struct.h 13:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_uppercase_unsafe :: T -> IO ()
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @functions\/heap_types\/struct.h 13:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_uppercase_unsafe = \type'_0 -> with type'_0 (\type'_1 -> hs_bindgen_bda30535ff7fd9f4 type'_1)
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_undersore_capital@
+foreign import ccall unsafe "hs_bindgen_7b5f5cbdd8a5ff0e" hs_bindgen_7b5f5cbdd8a5ff0e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_undersore_capital@
+hs_bindgen_7b5f5cbdd8a5ff0e :: Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_undersore_capital@
+hs_bindgen_7b5f5cbdd8a5ff0e = \x_0 -> hs_bindgen_7b5f5cbdd8a5ff0e_base (toFFIType x_0)
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @functions\/heap_types\/struct.h 14:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_undersore_capital_unsafe :: T -> IO ()
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @functions\/heap_types\/struct.h 14:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_undersore_capital_unsafe = \_T_0 -> with _T_0 (\_T_1 -> hs_bindgen_7b5f5cbdd8a5ff0e _T_1)
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_haskell_reserved_name@
+foreign import ccall unsafe "hs_bindgen_5b71629b3ccc3fa8" hs_bindgen_5b71629b3ccc3fa8_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_haskell_reserved_name@
+hs_bindgen_5b71629b3ccc3fa8 :: Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_Example_Unsafe_param_haskell_reserved_name@
+hs_bindgen_5b71629b3ccc3fa8 = \x_0 -> hs_bindgen_5b71629b3ccc3fa8_base (toFFIType x_0)
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @functions\/heap_types\/struct.h 15:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_haskell_reserved_name_unsafe :: T -> IO ()
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @functions\/heap_types\/struct.h 15:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_haskell_reserved_name_unsafe = \type'_0 -> with type'_0 (\type'_1 -> hs_bindgen_5b71629b3ccc3fa8 type'_1)
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_071e2eda58051e4a" hs_bindgen_071e2eda58051e4a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_fun@
+hs_bindgen_071e2eda58051e4a :: IO (FunPtr (T -> IO T))
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_fun@
+hs_bindgen_071e2eda58051e4a = fmap fromFFIType hs_bindgen_071e2eda58051e4a_base
+{-# NOINLINE fun_funptr #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+fun_funptr :: FunPtr (T -> IO T)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+fun_funptr = unsafePerformIO hs_bindgen_071e2eda58051e4a
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_underscore@
+foreign import ccall unsafe "hs_bindgen_ee52ac50697405f8" hs_bindgen_ee52ac50697405f8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_underscore@
+hs_bindgen_ee52ac50697405f8 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_underscore@
+hs_bindgen_ee52ac50697405f8 = fmap fromFFIType hs_bindgen_ee52ac50697405f8_base
+{-# NOINLINE param_underscore_funptr #-}
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @functions\/heap_types\/struct.h 12:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_underscore_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @param_underscore@
+
+    __defined at:__ @functions\/heap_types\/struct.h 12:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_underscore_funptr = unsafePerformIO hs_bindgen_ee52ac50697405f8
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_uppercase@
+foreign import ccall unsafe "hs_bindgen_b51cac34e6c4eca3" hs_bindgen_b51cac34e6c4eca3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_uppercase@
+hs_bindgen_b51cac34e6c4eca3 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_uppercase@
+hs_bindgen_b51cac34e6c4eca3 = fmap fromFFIType hs_bindgen_b51cac34e6c4eca3_base
+{-# NOINLINE param_uppercase_funptr #-}
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @functions\/heap_types\/struct.h 13:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_uppercase_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @param_uppercase@
+
+    __defined at:__ @functions\/heap_types\/struct.h 13:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_uppercase_funptr = unsafePerformIO hs_bindgen_b51cac34e6c4eca3
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_undersore_capital@
+foreign import ccall unsafe "hs_bindgen_2302284a38d84764" hs_bindgen_2302284a38d84764_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_undersore_capital@
+hs_bindgen_2302284a38d84764 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_undersore_capital@
+hs_bindgen_2302284a38d84764 = fmap fromFFIType hs_bindgen_2302284a38d84764_base
+{-# NOINLINE param_undersore_capital_funptr #-}
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @functions\/heap_types\/struct.h 14:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_undersore_capital_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @param_undersore_capital@
+
+    __defined at:__ @functions\/heap_types\/struct.h 14:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_undersore_capital_funptr = unsafePerformIO hs_bindgen_2302284a38d84764
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_haskell_reserved_name@
+foreign import ccall unsafe "hs_bindgen_af57be8569d5f651" hs_bindgen_af57be8569d5f651_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_haskell_reserved_name@
+hs_bindgen_af57be8569d5f651 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_functionsheap_typesstruct_Example_get_param_haskell_reserved_name@
+hs_bindgen_af57be8569d5f651 = fmap fromFFIType hs_bindgen_af57be8569d5f651_base
+{-# NOINLINE param_haskell_reserved_name_funptr #-}
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @functions\/heap_types\/struct.h 15:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_haskell_reserved_name_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @param_haskell_reserved_name@
+
+    __defined at:__ @functions\/heap_types\/struct.h 15:6@
+
+    __exported by:__ @functions\/heap_types\/struct.h@
+-}
+param_haskell_reserved_name_funptr = unsafePerformIO hs_bindgen_af57be8569d5f651
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const/Example.hs b/test-artefacts/fixtures/functions/heap_types/struct_const/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 3:8@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+data T = T
+  { t_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @functions\/heap_types\/struct_const.h 4:7@
+
+         __exported by:__ @functions\/heap_types\/struct_const.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> HasCField.readRaw (BG.Proxy @"t_x") ptr0
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T t_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t_x") ptr0 t_x2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via Struct.IsStructViaReadRaw T instance Struct.IsStruct T
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 4:7@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_x" T ty where
+
+  hasField =
+    \x0 -> (\y1 -> T {t_x = y1}, BG.getField @"t_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_x" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_x")
+
+instance HasCField.HasCField T "t_x" where
+
+  type CFieldType T "t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const/Example/FunPtr.hs b/test-artefacts/fixtures/functions/heap_types/struct_const/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct_const.h>"
+  , "/* test_functionsheap_typesstruct_co_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "T const (*hs_bindgen_564814e9ac709cad (void)) ("
+  , "  T const arg1"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_564814e9ac709cad" hs_bindgen_564814e9ac709cad_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+hs_bindgen_564814e9ac709cad :: IO (BG.FunPtr (T -> IO T))
+hs_bindgen_564814e9ac709cad =
+  fmap BG.fromFFIType hs_bindgen_564814e9ac709cad_base
+
+{-# NOINLINE fun #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+fun :: BG.FunPtr (T -> IO T)
+fun = BG.unsafePerformIO hs_bindgen_564814e9ac709cad
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const/Example/Safe.hs b/test-artefacts/fixtures/functions/heap_types/struct_const/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const/Example/Safe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct_const.h>"
+  , "void hs_bindgen_67465eb5641985dc ("
+  , "  T const *arg1,"
+  , "  T const *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_67465eb5641985dc" hs_bindgen_67465eb5641985dc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+hs_bindgen_67465eb5641985dc ::
+     PtrConst.PtrConst T
+  -> PtrConst.PtrConst T
+  -> IO ()
+hs_bindgen_67465eb5641985dc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_67465eb5641985dc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_67465eb5641985dc (PtrConst.unsafeFromPtr x1) res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const/Example/Unsafe.hs b/test-artefacts/fixtures/functions/heap_types/struct_const/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const/Example/Unsafe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct_const.h>"
+  , "void hs_bindgen_4351e21e32969011 ("
+  , "  T const *arg1,"
+  , "  T const *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4351e21e32969011" hs_bindgen_4351e21e32969011_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+hs_bindgen_4351e21e32969011 ::
+     PtrConst.PtrConst T
+  -> PtrConst.PtrConst T
+  -> IO ()
+hs_bindgen_4351e21e32969011 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4351e21e32969011_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_4351e21e32969011 (PtrConst.unsafeFromPtr x1) res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const/bindingspec.yaml b/test-artefacts/fixtures/functions/heap_types/struct_const/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const/bindingspec.yaml
@@ -0,0 +1,31 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/heap_types/struct_const.h
+  cname: struct S
+  hsname: T
+- headers: functions/heap_types/struct_const.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    record:
+      constructor: T
+      fields:
+      - t_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const/th.txt b/test-artefacts/fixtures/functions/heap_types/struct_const/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const/th.txt
@@ -0,0 +1,125 @@
+-- addDependentFile test-artefacts/headers/golden/functions/heap_types/struct_const.h
+-- #include <functions/heap_types/struct_const.h>
+-- void hs_bindgen_67465eb5641985dc (
+--   T const *arg1,
+--   T const *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- void hs_bindgen_4351e21e32969011 (
+--   T const *arg1,
+--   T const *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- /* test_functionsheap_typesstruct_co_Example_get_fun */
+-- __attribute__ ((const))
+-- T const (*hs_bindgen_564814e9ac709cad (void)) (
+--   T const arg1
+-- )
+-- {
+--   return &fun;
+-- }
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 3:8@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+data T
+    = T {t_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @functions\/heap_types\/struct_const.h 4:7@
+
+              __exported by:__ @functions\/heap_types\/struct_const.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRaw (Proxy @"t_x") ptr_0
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T t_x_2 -> writeRaw (Proxy @"t_x") ptr_0 t_x_2
+deriving via (EquivStorable T) instance Storable T
+deriving via (IsStructViaReadRaw T) instance IsStruct T
+instance (~) ty CInt => HasField "t_x" T ty
+    where hasField = \x_0 -> (\y_1 -> T{t_x = y_1},
+                              getField @"t_x" x_0)
+instance (~) ty CInt => HasField "t_x" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_x")
+instance HasCField T "t_x"
+    where type CFieldType T "t_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_67465eb5641985dc" hs_bindgen_67465eb5641985dc_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+hs_bindgen_67465eb5641985dc :: PtrConst T -> PtrConst T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+hs_bindgen_67465eb5641985dc = \x_0 -> \x_1 -> hs_bindgen_67465eb5641985dc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+fun_safe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+fun_safe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_67465eb5641985dc (unsafeFromPtr x_1) res_2))
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4351e21e32969011" hs_bindgen_4351e21e32969011_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+hs_bindgen_4351e21e32969011 :: PtrConst T -> PtrConst T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+hs_bindgen_4351e21e32969011 = \x_0 -> \x_1 -> hs_bindgen_4351e21e32969011_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+fun_unsafe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+fun_unsafe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_4351e21e32969011 (unsafeFromPtr x_1) res_2))
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_564814e9ac709cad" hs_bindgen_564814e9ac709cad_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+hs_bindgen_564814e9ac709cad :: IO (FunPtr (T -> IO T))
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+hs_bindgen_564814e9ac709cad = fmap fromFFIType hs_bindgen_564814e9ac709cad_base
+{-# NOINLINE fun_funptr #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+fun_funptr :: FunPtr (T -> IO T)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/struct_const.h@
+-}
+fun_funptr = unsafePerformIO hs_bindgen_564814e9ac709cad
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example.hs b/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 3:8@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+data T = T
+  { t_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @functions\/heap_types\/struct_const_member.h 4:13@
+
+         __exported by:__ @functions\/heap_types\/struct_const_member.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> HasCField.readRaw (BG.Proxy @"t_x") ptr0
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T t_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t_x") ptr0 t_x2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via Struct.IsStructViaReadRaw T instance Struct.IsStruct T
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 4:13@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_x" T ty where
+
+  hasField =
+    \x0 -> (\y1 -> T {t_x = y1}, BG.getField @"t_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_x" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_x")
+
+instance HasCField.HasCField T "t_x" where
+
+  type CFieldType T "t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example/FunPtr.hs b/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct_const_member.h>"
+  , "/* test_functionsheap_typesstruct_co_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "T (*hs_bindgen_564814e9ac709cad (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_564814e9ac709cad" hs_bindgen_564814e9ac709cad_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+hs_bindgen_564814e9ac709cad :: IO (BG.FunPtr (T -> IO T))
+hs_bindgen_564814e9ac709cad =
+  fmap BG.fromFFIType hs_bindgen_564814e9ac709cad_base
+
+{-# NOINLINE fun #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+fun :: BG.FunPtr (T -> IO T)
+fun = BG.unsafePerformIO hs_bindgen_564814e9ac709cad
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example/Safe.hs b/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example/Safe.hs
@@ -0,0 +1,57 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct_const_member.h>"
+  , "void hs_bindgen_67465eb5641985dc ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_67465eb5641985dc" hs_bindgen_67465eb5641985dc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+hs_bindgen_67465eb5641985dc ::
+     BG.Ptr T
+  -> BG.Ptr T
+  -> IO ()
+hs_bindgen_67465eb5641985dc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_67465eb5641985dc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_67465eb5641985dc x1 res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example/Unsafe.hs b/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_member/Example/Unsafe.hs
@@ -0,0 +1,57 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct_const_member.h>"
+  , "void hs_bindgen_4351e21e32969011 ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4351e21e32969011" hs_bindgen_4351e21e32969011_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+hs_bindgen_4351e21e32969011 ::
+     BG.Ptr T
+  -> BG.Ptr T
+  -> IO ()
+hs_bindgen_4351e21e32969011 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4351e21e32969011_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_4351e21e32969011 x1 res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_member/bindingspec.yaml b/test-artefacts/fixtures/functions/heap_types/struct_const_member/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_member/bindingspec.yaml
@@ -0,0 +1,31 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/heap_types/struct_const_member.h
+  cname: struct S
+  hsname: T
+- headers: functions/heap_types/struct_const_member.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    record:
+      constructor: T
+      fields:
+      - t_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_member/th.txt b/test-artefacts/fixtures/functions/heap_types/struct_const_member/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_member/th.txt
@@ -0,0 +1,125 @@
+-- addDependentFile test-artefacts/headers/golden/functions/heap_types/struct_const_member.h
+-- #include <functions/heap_types/struct_const_member.h>
+-- void hs_bindgen_67465eb5641985dc (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- void hs_bindgen_4351e21e32969011 (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- /* test_functionsheap_typesstruct_co_Example_get_fun */
+-- __attribute__ ((const))
+-- T (*hs_bindgen_564814e9ac709cad (void)) (
+--   T arg1
+-- )
+-- {
+--   return &fun;
+-- }
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 3:8@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+data T
+    = T {t_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @functions\/heap_types\/struct_const_member.h 4:13@
+
+              __exported by:__ @functions\/heap_types\/struct_const_member.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRaw (Proxy @"t_x") ptr_0
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T t_x_2 -> writeRaw (Proxy @"t_x") ptr_0 t_x_2
+deriving via (EquivStorable T) instance Storable T
+deriving via (IsStructViaReadRaw T) instance IsStruct T
+instance (~) ty CInt => HasField "t_x" T ty
+    where hasField = \x_0 -> (\y_1 -> T{t_x = y_1},
+                              getField @"t_x" x_0)
+instance (~) ty CInt => HasField "t_x" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_x")
+instance HasCField T "t_x"
+    where type CFieldType T "t_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_67465eb5641985dc" hs_bindgen_67465eb5641985dc_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+hs_bindgen_67465eb5641985dc :: Ptr T -> Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+hs_bindgen_67465eb5641985dc = \x_0 -> \x_1 -> hs_bindgen_67465eb5641985dc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+fun_safe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+fun_safe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_67465eb5641985dc x_1 res_2))
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4351e21e32969011" hs_bindgen_4351e21e32969011_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+hs_bindgen_4351e21e32969011 :: Ptr T -> Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+hs_bindgen_4351e21e32969011 = \x_0 -> \x_1 -> hs_bindgen_4351e21e32969011_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+fun_unsafe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+fun_unsafe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_4351e21e32969011 x_1 res_2))
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_564814e9ac709cad" hs_bindgen_564814e9ac709cad_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+hs_bindgen_564814e9ac709cad :: IO (FunPtr (T -> IO T))
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+hs_bindgen_564814e9ac709cad = fmap fromFFIType hs_bindgen_564814e9ac709cad_base
+{-# NOINLINE fun_funptr #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+fun_funptr :: FunPtr (T -> IO T)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_member.h@
+-}
+fun_funptr = unsafePerformIO hs_bindgen_564814e9ac709cad
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example.hs b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 3:8@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+data T = T
+  { t_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @functions\/heap_types\/struct_const_typedef.h 4:7@
+
+         __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> HasCField.readRaw (BG.Proxy @"t_x") ptr0
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T t_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t_x") ptr0 t_x2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via Struct.IsStructViaReadRaw T instance Struct.IsStruct T
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 4:7@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_x" T ty where
+
+  hasField =
+    \x0 -> (\y1 -> T {t_x = y1}, BG.getField @"t_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_x" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_x")
+
+instance HasCField.HasCField T "t_x" where
+
+  type CFieldType T "t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example/FunPtr.hs b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct_const_typedef.h>"
+  , "/* test_functionsheap_typesstruct_co_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "T (*hs_bindgen_564814e9ac709cad (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_564814e9ac709cad" hs_bindgen_564814e9ac709cad_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+hs_bindgen_564814e9ac709cad :: IO (BG.FunPtr (T -> IO T))
+hs_bindgen_564814e9ac709cad =
+  fmap BG.fromFFIType hs_bindgen_564814e9ac709cad_base
+
+{-# NOINLINE fun #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+fun :: BG.FunPtr (T -> IO T)
+fun = BG.unsafePerformIO hs_bindgen_564814e9ac709cad
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example/Safe.hs b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example/Safe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct_const_typedef.h>"
+  , "void hs_bindgen_67465eb5641985dc ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_67465eb5641985dc" hs_bindgen_67465eb5641985dc_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+hs_bindgen_67465eb5641985dc ::
+     PtrConst.PtrConst T
+  -> PtrConst.PtrConst T
+  -> IO ()
+hs_bindgen_67465eb5641985dc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_67465eb5641985dc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_67465eb5641985dc (PtrConst.unsafeFromPtr x1) res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example/Unsafe.hs b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/Example/Unsafe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/struct_const_typedef.h>"
+  , "void hs_bindgen_4351e21e32969011 ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4351e21e32969011" hs_bindgen_4351e21e32969011_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+hs_bindgen_4351e21e32969011 ::
+     PtrConst.PtrConst T
+  -> PtrConst.PtrConst T
+  -> IO ()
+hs_bindgen_4351e21e32969011 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4351e21e32969011_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_4351e21e32969011 (PtrConst.unsafeFromPtr x1) res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/bindingspec.yaml b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/bindingspec.yaml
@@ -0,0 +1,31 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/heap_types/struct_const_typedef.h
+  cname: struct S
+  hsname: T
+- headers: functions/heap_types/struct_const_typedef.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    record:
+      constructor: T
+      fields:
+      - t_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/th.txt b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/struct_const_typedef/th.txt
@@ -0,0 +1,125 @@
+-- addDependentFile test-artefacts/headers/golden/functions/heap_types/struct_const_typedef.h
+-- #include <functions/heap_types/struct_const_typedef.h>
+-- void hs_bindgen_67465eb5641985dc (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- void hs_bindgen_4351e21e32969011 (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- /* test_functionsheap_typesstruct_co_Example_get_fun */
+-- __attribute__ ((const))
+-- T (*hs_bindgen_564814e9ac709cad (void)) (
+--   T arg1
+-- )
+-- {
+--   return &fun;
+-- }
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 3:8@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+data T
+    = T {t_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @functions\/heap_types\/struct_const_typedef.h 4:7@
+
+              __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRaw (Proxy @"t_x") ptr_0
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T t_x_2 -> writeRaw (Proxy @"t_x") ptr_0 t_x_2
+deriving via (EquivStorable T) instance Storable T
+deriving via (IsStructViaReadRaw T) instance IsStruct T
+instance (~) ty CInt => HasField "t_x" T ty
+    where hasField = \x_0 -> (\y_1 -> T{t_x = y_1},
+                              getField @"t_x" x_0)
+instance (~) ty CInt => HasField "t_x" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_x")
+instance HasCField T "t_x"
+    where type CFieldType T "t_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_67465eb5641985dc" hs_bindgen_67465eb5641985dc_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+hs_bindgen_67465eb5641985dc :: PtrConst T -> PtrConst T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
+hs_bindgen_67465eb5641985dc = \x_0 -> \x_1 -> hs_bindgen_67465eb5641985dc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+fun_safe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+fun_safe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_67465eb5641985dc (unsafeFromPtr x_1) res_2))
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4351e21e32969011" hs_bindgen_4351e21e32969011_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+hs_bindgen_4351e21e32969011 :: PtrConst T -> PtrConst T -> IO ()
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
+hs_bindgen_4351e21e32969011 = \x_0 -> \x_1 -> hs_bindgen_4351e21e32969011_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+fun_unsafe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+fun_unsafe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_4351e21e32969011 (unsafeFromPtr x_1) res_2))
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_564814e9ac709cad" hs_bindgen_564814e9ac709cad_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+hs_bindgen_564814e9ac709cad :: IO (FunPtr (T -> IO T))
+-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
+hs_bindgen_564814e9ac709cad = fmap fromFFIType hs_bindgen_564814e9ac709cad_base
+{-# NOINLINE fun_funptr #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+fun_funptr :: FunPtr (T -> IO T)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
+-}
+fun_funptr = unsafePerformIO hs_bindgen_564814e9ac709cad
diff --git a/test-artefacts/fixtures/functions/heap_types/union/Example.hs b/test-artefacts/fixtures/functions/heap_types/union/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union/Example.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (type (~))
+
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/heap_types\/union.h 3:7@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+newtype T = T
+  { unwrapT :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/union.h 4:7@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t_x" T ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/union.h 4:7@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_x" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_x" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_x")
+
+instance HasCField.HasCField T "t_x" where
+
+  type CFieldType T "t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/heap_types/union/Example/FunPtr.hs b/test-artefacts/fixtures/functions/heap_types/union/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union.h>"
+  , "/* test_functionsheap_typesunion_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "T (*hs_bindgen_d5d6e9f882bc09ed (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_d5d6e9f882bc09ed" hs_bindgen_d5d6e9f882bc09ed_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesunion_Example_get_fun@
+hs_bindgen_d5d6e9f882bc09ed :: IO (BG.FunPtr (T -> IO T))
+hs_bindgen_d5d6e9f882bc09ed =
+  fmap BG.fromFFIType hs_bindgen_d5d6e9f882bc09ed_base
+
+{-# NOINLINE fun #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+fun :: BG.FunPtr (T -> IO T)
+fun = BG.unsafePerformIO hs_bindgen_d5d6e9f882bc09ed
diff --git a/test-artefacts/fixtures/functions/heap_types/union/Example/Safe.hs b/test-artefacts/fixtures/functions/heap_types/union/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union/Example/Safe.hs
@@ -0,0 +1,57 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union.h>"
+  , "void hs_bindgen_9fc5746860ab93cb ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_9fc5746860ab93cb" hs_bindgen_9fc5746860ab93cb_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesunion_Example_Safe_fun@
+hs_bindgen_9fc5746860ab93cb ::
+     BG.Ptr T
+  -> BG.Ptr T
+  -> IO ()
+hs_bindgen_9fc5746860ab93cb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9fc5746860ab93cb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_9fc5746860ab93cb x1 res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/union/Example/Unsafe.hs b/test-artefacts/fixtures/functions/heap_types/union/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union/Example/Unsafe.hs
@@ -0,0 +1,57 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union.h>"
+  , "void hs_bindgen_54b038887c811176 ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_54b038887c811176" hs_bindgen_54b038887c811176_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesunion_Example_Unsafe_fun@
+hs_bindgen_54b038887c811176 ::
+     BG.Ptr T
+  -> BG.Ptr T
+  -> IO ()
+hs_bindgen_54b038887c811176 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_54b038887c811176_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_54b038887c811176 x1 res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/union/bindingspec.yaml b/test-artefacts/fixtures/functions/heap_types/union/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union/bindingspec.yaml
@@ -0,0 +1,29 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/heap_types/union.h
+  cname: union U
+  hsname: T
+- headers: functions/heap_types/union.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/heap_types/union/th.txt b/test-artefacts/fixtures/functions/heap_types/union/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union/th.txt
@@ -0,0 +1,114 @@
+-- addDependentFile test-artefacts/headers/golden/functions/heap_types/union.h
+-- #include <functions/heap_types/union.h>
+-- void hs_bindgen_9fc5746860ab93cb (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- void hs_bindgen_54b038887c811176 (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- /* test_functionsheap_typesunion_Example_get_fun */
+-- __attribute__ ((const))
+-- T (*hs_bindgen_d5d6e9f882bc09ed (void)) (
+--   T arg1
+-- )
+-- {
+--   return &fun;
+-- }
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/heap_types\/union.h 3:7@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+newtype T = T {unwrapT :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T
+deriving via (SizedByteArray 4 4) instance ReadRaw T
+deriving via (SizedByteArray 4 4) instance WriteRaw T
+deriving via (EquivStorable T) instance Storable T
+deriving via (SizedByteArray 4 4) instance IsUnion T
+instance (~) ty CInt => HasField "t_x" T ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t_x" T ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t_x" x_0)
+instance (~) ty CInt => HasField "t_x" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_x")
+instance HasCField T "t_x"
+    where type CFieldType T "t_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionsheap_typesunion_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_9fc5746860ab93cb" hs_bindgen_9fc5746860ab93cb_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_Example_Safe_fun@
+hs_bindgen_9fc5746860ab93cb :: Ptr T -> Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_Example_Safe_fun@
+hs_bindgen_9fc5746860ab93cb = \x_0 -> \x_1 -> hs_bindgen_9fc5746860ab93cb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+fun_safe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+fun_safe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_9fc5746860ab93cb x_1 res_2))
+-- __unique:__ @test_functionsheap_typesunion_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_54b038887c811176" hs_bindgen_54b038887c811176_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_Example_Unsafe_fun@
+hs_bindgen_54b038887c811176 :: Ptr T -> Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_Example_Unsafe_fun@
+hs_bindgen_54b038887c811176 = \x_0 -> \x_1 -> hs_bindgen_54b038887c811176_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+fun_unsafe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+fun_unsafe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_54b038887c811176 x_1 res_2))
+-- __unique:__ @test_functionsheap_typesunion_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_d5d6e9f882bc09ed" hs_bindgen_d5d6e9f882bc09ed_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesunion_Example_get_fun@
+hs_bindgen_d5d6e9f882bc09ed :: IO (FunPtr (T -> IO T))
+-- __unique:__ @test_functionsheap_typesunion_Example_get_fun@
+hs_bindgen_d5d6e9f882bc09ed = fmap fromFFIType hs_bindgen_d5d6e9f882bc09ed_base
+{-# NOINLINE fun_funptr #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+fun_funptr :: FunPtr (T -> IO T)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union.h@
+-}
+fun_funptr = unsafePerformIO hs_bindgen_d5d6e9f882bc09ed
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const/Example.hs b/test-artefacts/fixtures/functions/heap_types/union_const/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const/Example.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (type (~))
+
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 3:7@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+newtype T = T
+  { unwrapT :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 4:7@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t_x" T ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 4:7@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_x" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_x" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_x")
+
+instance HasCField.HasCField T "t_x" where
+
+  type CFieldType T "t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const/Example/FunPtr.hs b/test-artefacts/fixtures/functions/heap_types/union_const/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union_const.h>"
+  , "/* test_functionsheap_typesunion_con_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "T const (*hs_bindgen_7e6af500caa71b85 (void)) ("
+  , "  T const arg1"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_7e6af500caa71b85" hs_bindgen_7e6af500caa71b85_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+hs_bindgen_7e6af500caa71b85 :: IO (BG.FunPtr (T -> IO T))
+hs_bindgen_7e6af500caa71b85 =
+  fmap BG.fromFFIType hs_bindgen_7e6af500caa71b85_base
+
+{-# NOINLINE fun #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+fun :: BG.FunPtr (T -> IO T)
+fun = BG.unsafePerformIO hs_bindgen_7e6af500caa71b85
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const/Example/Safe.hs b/test-artefacts/fixtures/functions/heap_types/union_const/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const/Example/Safe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union_const.h>"
+  , "void hs_bindgen_8a303cd5b4f7787b ("
+  , "  T const *arg1,"
+  , "  T const *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_8a303cd5b4f7787b" hs_bindgen_8a303cd5b4f7787b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+hs_bindgen_8a303cd5b4f7787b ::
+     PtrConst.PtrConst T
+  -> PtrConst.PtrConst T
+  -> IO ()
+hs_bindgen_8a303cd5b4f7787b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8a303cd5b4f7787b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_8a303cd5b4f7787b (PtrConst.unsafeFromPtr x1) res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const/Example/Unsafe.hs b/test-artefacts/fixtures/functions/heap_types/union_const/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const/Example/Unsafe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union_const.h>"
+  , "void hs_bindgen_4e22c71ca196dc5e ("
+  , "  T const *arg1,"
+  , "  T const *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4e22c71ca196dc5e" hs_bindgen_4e22c71ca196dc5e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+hs_bindgen_4e22c71ca196dc5e ::
+     PtrConst.PtrConst T
+  -> PtrConst.PtrConst T
+  -> IO ()
+hs_bindgen_4e22c71ca196dc5e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4e22c71ca196dc5e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_4e22c71ca196dc5e (PtrConst.unsafeFromPtr x1) res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const/bindingspec.yaml b/test-artefacts/fixtures/functions/heap_types/union_const/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const/bindingspec.yaml
@@ -0,0 +1,29 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/heap_types/union_const.h
+  cname: union U
+  hsname: T
+- headers: functions/heap_types/union_const.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const/th.txt b/test-artefacts/fixtures/functions/heap_types/union_const/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const/th.txt
@@ -0,0 +1,114 @@
+-- addDependentFile test-artefacts/headers/golden/functions/heap_types/union_const.h
+-- #include <functions/heap_types/union_const.h>
+-- void hs_bindgen_8a303cd5b4f7787b (
+--   T const *arg1,
+--   T const *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- void hs_bindgen_4e22c71ca196dc5e (
+--   T const *arg1,
+--   T const *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- /* test_functionsheap_typesunion_con_Example_get_fun */
+-- __attribute__ ((const))
+-- T const (*hs_bindgen_7e6af500caa71b85 (void)) (
+--   T const arg1
+-- )
+-- {
+--   return &fun;
+-- }
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 3:7@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+newtype T = T {unwrapT :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T
+deriving via (SizedByteArray 4 4) instance ReadRaw T
+deriving via (SizedByteArray 4 4) instance WriteRaw T
+deriving via (EquivStorable T) instance Storable T
+deriving via (SizedByteArray 4 4) instance IsUnion T
+instance (~) ty CInt => HasField "t_x" T ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t_x" T ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t_x" x_0)
+instance (~) ty CInt => HasField "t_x" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_x")
+instance HasCField T "t_x"
+    where type CFieldType T "t_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_8a303cd5b4f7787b" hs_bindgen_8a303cd5b4f7787b_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+hs_bindgen_8a303cd5b4f7787b :: PtrConst T -> PtrConst T -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+hs_bindgen_8a303cd5b4f7787b = \x_0 -> \x_1 -> hs_bindgen_8a303cd5b4f7787b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+fun_safe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+fun_safe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_8a303cd5b4f7787b (unsafeFromPtr x_1) res_2))
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4e22c71ca196dc5e" hs_bindgen_4e22c71ca196dc5e_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+hs_bindgen_4e22c71ca196dc5e :: PtrConst T -> PtrConst T -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+hs_bindgen_4e22c71ca196dc5e = \x_0 -> \x_1 -> hs_bindgen_4e22c71ca196dc5e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+fun_unsafe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+fun_unsafe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_4e22c71ca196dc5e (unsafeFromPtr x_1) res_2))
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_7e6af500caa71b85" hs_bindgen_7e6af500caa71b85_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+hs_bindgen_7e6af500caa71b85 :: IO (FunPtr (T -> IO T))
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+hs_bindgen_7e6af500caa71b85 = fmap fromFFIType hs_bindgen_7e6af500caa71b85_base
+{-# NOINLINE fun_funptr #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+fun_funptr :: FunPtr (T -> IO T)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const.h 9:9@
+
+    __exported by:__ @functions\/heap_types\/union_const.h@
+-}
+fun_funptr = unsafePerformIO hs_bindgen_7e6af500caa71b85
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_member/Example.hs b/test-artefacts/fixtures/functions/heap_types/union_const_member/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_member/Example.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (type (~))
+
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 3:7@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+newtype T = T
+  { unwrapT :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 4:13@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t_x" T ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 4:13@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_x" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_x" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_x")
+
+instance HasCField.HasCField T "t_x" where
+
+  type CFieldType T "t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_member/Example/FunPtr.hs b/test-artefacts/fixtures/functions/heap_types/union_const_member/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_member/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union_const_member.h>"
+  , "/* test_functionsheap_typesunion_con_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "T (*hs_bindgen_7e6af500caa71b85 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_7e6af500caa71b85" hs_bindgen_7e6af500caa71b85_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+hs_bindgen_7e6af500caa71b85 :: IO (BG.FunPtr (T -> IO T))
+hs_bindgen_7e6af500caa71b85 =
+  fmap BG.fromFFIType hs_bindgen_7e6af500caa71b85_base
+
+{-# NOINLINE fun #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+fun :: BG.FunPtr (T -> IO T)
+fun = BG.unsafePerformIO hs_bindgen_7e6af500caa71b85
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_member/Example/Safe.hs b/test-artefacts/fixtures/functions/heap_types/union_const_member/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_member/Example/Safe.hs
@@ -0,0 +1,57 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union_const_member.h>"
+  , "void hs_bindgen_8a303cd5b4f7787b ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_8a303cd5b4f7787b" hs_bindgen_8a303cd5b4f7787b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+hs_bindgen_8a303cd5b4f7787b ::
+     BG.Ptr T
+  -> BG.Ptr T
+  -> IO ()
+hs_bindgen_8a303cd5b4f7787b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8a303cd5b4f7787b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_8a303cd5b4f7787b x1 res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_member/Example/Unsafe.hs b/test-artefacts/fixtures/functions/heap_types/union_const_member/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_member/Example/Unsafe.hs
@@ -0,0 +1,57 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union_const_member.h>"
+  , "void hs_bindgen_4e22c71ca196dc5e ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4e22c71ca196dc5e" hs_bindgen_4e22c71ca196dc5e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+hs_bindgen_4e22c71ca196dc5e ::
+     BG.Ptr T
+  -> BG.Ptr T
+  -> IO ()
+hs_bindgen_4e22c71ca196dc5e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4e22c71ca196dc5e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_4e22c71ca196dc5e x1 res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_member/bindingspec.yaml b/test-artefacts/fixtures/functions/heap_types/union_const_member/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_member/bindingspec.yaml
@@ -0,0 +1,29 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/heap_types/union_const_member.h
+  cname: union U
+  hsname: T
+- headers: functions/heap_types/union_const_member.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_member/th.txt b/test-artefacts/fixtures/functions/heap_types/union_const_member/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_member/th.txt
@@ -0,0 +1,114 @@
+-- addDependentFile test-artefacts/headers/golden/functions/heap_types/union_const_member.h
+-- #include <functions/heap_types/union_const_member.h>
+-- void hs_bindgen_8a303cd5b4f7787b (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- void hs_bindgen_4e22c71ca196dc5e (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- /* test_functionsheap_typesunion_con_Example_get_fun */
+-- __attribute__ ((const))
+-- T (*hs_bindgen_7e6af500caa71b85 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &fun;
+-- }
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 3:7@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+newtype T = T {unwrapT :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T
+deriving via (SizedByteArray 4 4) instance ReadRaw T
+deriving via (SizedByteArray 4 4) instance WriteRaw T
+deriving via (EquivStorable T) instance Storable T
+deriving via (SizedByteArray 4 4) instance IsUnion T
+instance (~) ty CInt => HasField "t_x" T ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t_x" T ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t_x" x_0)
+instance (~) ty CInt => HasField "t_x" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_x")
+instance HasCField T "t_x"
+    where type CFieldType T "t_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_8a303cd5b4f7787b" hs_bindgen_8a303cd5b4f7787b_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+hs_bindgen_8a303cd5b4f7787b :: Ptr T -> Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+hs_bindgen_8a303cd5b4f7787b = \x_0 -> \x_1 -> hs_bindgen_8a303cd5b4f7787b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+fun_safe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+fun_safe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_8a303cd5b4f7787b x_1 res_2))
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4e22c71ca196dc5e" hs_bindgen_4e22c71ca196dc5e_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+hs_bindgen_4e22c71ca196dc5e :: Ptr T -> Ptr T -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+hs_bindgen_4e22c71ca196dc5e = \x_0 -> \x_1 -> hs_bindgen_4e22c71ca196dc5e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+fun_unsafe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+fun_unsafe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_4e22c71ca196dc5e x_1 res_2))
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_7e6af500caa71b85" hs_bindgen_7e6af500caa71b85_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+hs_bindgen_7e6af500caa71b85 :: IO (FunPtr (T -> IO T))
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+hs_bindgen_7e6af500caa71b85 = fmap fromFFIType hs_bindgen_7e6af500caa71b85_base
+{-# NOINLINE fun_funptr #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+fun_funptr :: FunPtr (T -> IO T)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_member.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_member.h@
+-}
+fun_funptr = unsafePerformIO hs_bindgen_7e6af500caa71b85
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example.hs b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (type (~))
+
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 3:7@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+newtype T = T
+  { unwrapT :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 4:7@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t_x" T ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 4:7@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_x" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_x" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_x")
+
+instance HasCField.HasCField T "t_x" where
+
+  type CFieldType T "t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example/FunPtr.hs b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union_const_typedef.h>"
+  , "/* test_functionsheap_typesunion_con_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "T (*hs_bindgen_7e6af500caa71b85 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_7e6af500caa71b85" hs_bindgen_7e6af500caa71b85_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+hs_bindgen_7e6af500caa71b85 :: IO (BG.FunPtr (T -> IO T))
+hs_bindgen_7e6af500caa71b85 =
+  fmap BG.fromFFIType hs_bindgen_7e6af500caa71b85_base
+
+{-# NOINLINE fun #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+fun :: BG.FunPtr (T -> IO T)
+fun = BG.unsafePerformIO hs_bindgen_7e6af500caa71b85
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example/Safe.hs b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example/Safe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union_const_typedef.h>"
+  , "void hs_bindgen_8a303cd5b4f7787b ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_8a303cd5b4f7787b" hs_bindgen_8a303cd5b4f7787b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+hs_bindgen_8a303cd5b4f7787b ::
+     PtrConst.PtrConst T
+  -> PtrConst.PtrConst T
+  -> IO ()
+hs_bindgen_8a303cd5b4f7787b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8a303cd5b4f7787b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_8a303cd5b4f7787b (PtrConst.unsafeFromPtr x1) res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example/Unsafe.hs b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/Example/Unsafe.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/heap_types/union_const_typedef.h>"
+  , "void hs_bindgen_4e22c71ca196dc5e ("
+  , "  T *arg1,"
+  , "  T *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (fun)(*arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4e22c71ca196dc5e" hs_bindgen_4e22c71ca196dc5e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+hs_bindgen_4e22c71ca196dc5e ::
+     PtrConst.PtrConst T
+  -> PtrConst.PtrConst T
+  -> IO ()
+hs_bindgen_4e22c71ca196dc5e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4e22c71ca196dc5e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+fun ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO T
+fun =
+  \x0 ->
+    BG.with x0 (\x1 ->
+                  BG.allocaAndPeek (\res2 ->
+                                      hs_bindgen_4e22c71ca196dc5e (PtrConst.unsafeFromPtr x1) res2))
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_typedef/bindingspec.yaml b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/bindingspec.yaml
@@ -0,0 +1,29 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/heap_types/union_const_typedef.h
+  cname: union U
+  hsname: T
+- headers: functions/heap_types/union_const_typedef.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/heap_types/union_const_typedef/th.txt b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/heap_types/union_const_typedef/th.txt
@@ -0,0 +1,114 @@
+-- addDependentFile test-artefacts/headers/golden/functions/heap_types/union_const_typedef.h
+-- #include <functions/heap_types/union_const_typedef.h>
+-- void hs_bindgen_8a303cd5b4f7787b (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- void hs_bindgen_4e22c71ca196dc5e (
+--   T *arg1,
+--   T *arg2
+-- )
+-- {
+--   *arg2 = (fun)(*arg1);
+-- }
+-- /* test_functionsheap_typesunion_con_Example_get_fun */
+-- __attribute__ ((const))
+-- T (*hs_bindgen_7e6af500caa71b85 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &fun;
+-- }
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 3:7@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+newtype T = T {unwrapT :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T
+deriving via (SizedByteArray 4 4) instance ReadRaw T
+deriving via (SizedByteArray 4 4) instance WriteRaw T
+deriving via (EquivStorable T) instance Storable T
+deriving via (SizedByteArray 4 4) instance IsUnion T
+instance (~) ty CInt => HasField "t_x" T ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t_x" T ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t_x" x_0)
+instance (~) ty CInt => HasField "t_x" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_x")
+instance HasCField T "t_x"
+    where type CFieldType T "t_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_8a303cd5b4f7787b" hs_bindgen_8a303cd5b4f7787b_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+hs_bindgen_8a303cd5b4f7787b :: PtrConst T -> PtrConst T -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Safe_fun@
+hs_bindgen_8a303cd5b4f7787b = \x_0 -> \x_1 -> hs_bindgen_8a303cd5b4f7787b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+fun_safe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+fun_safe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_8a303cd5b4f7787b (unsafeFromPtr x_1) res_2))
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_4e22c71ca196dc5e" hs_bindgen_4e22c71ca196dc5e_base ::
+    Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+hs_bindgen_4e22c71ca196dc5e :: PtrConst T -> PtrConst T -> IO ()
+-- __unique:__ @test_functionsheap_typesunion_con_Example_Unsafe_fun@
+hs_bindgen_4e22c71ca196dc5e = \x_0 -> \x_1 -> hs_bindgen_4e22c71ca196dc5e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+fun_unsafe :: T -> IO T
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+fun_unsafe = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_4e22c71ca196dc5e (unsafeFromPtr x_1) res_2))
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_7e6af500caa71b85" hs_bindgen_7e6af500caa71b85_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+hs_bindgen_7e6af500caa71b85 :: IO (FunPtr (T -> IO T))
+-- __unique:__ @test_functionsheap_typesunion_con_Example_get_fun@
+hs_bindgen_7e6af500caa71b85 = fmap fromFFIType hs_bindgen_7e6af500caa71b85_base
+{-# NOINLINE fun_funptr #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+fun_funptr :: FunPtr (T -> IO T)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/heap_types\/union_const_typedef.h 9:3@
+
+    __exported by:__ @functions\/heap_types\/union_const_typedef.h@
+-}
+fun_funptr = unsafePerformIO hs_bindgen_7e6af500caa71b85
diff --git a/test-artefacts/fixtures/functions/libc_builtins/Example/FunPtr.hs b/test-artefacts/fixtures/functions/libc_builtins/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/libc_builtins/Example/FunPtr.hs
@@ -0,0 +1,105 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.malloc
+    , Example.FunPtr.strlen
+    , Example.FunPtr.my_strlen
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/libc_builtins.h>"
+  , "/* test_functionslibc_builtins_Example_get_malloc */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_d52eebfcdc653f31 (void)) ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return &malloc;"
+  , "}"
+  , "/* test_functionslibc_builtins_Example_get_strlen */"
+  , "__attribute__ ((const))"
+  , "unsigned long (*hs_bindgen_7c713081d7e72a10 (void)) ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return &strlen;"
+  , "}"
+  , "/* test_functionslibc_builtins_Example_get_my_strlen */"
+  , "__attribute__ ((const))"
+  , "size_t (*hs_bindgen_a92eb31aeb03f8c0 (void)) ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return &my_strlen;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionslibc_builtins_Example_get_malloc@
+foreign import ccall unsafe "hs_bindgen_d52eebfcdc653f31" hs_bindgen_d52eebfcdc653f31_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionslibc_builtins_Example_get_malloc@
+hs_bindgen_d52eebfcdc653f31 :: IO (BG.FunPtr (BG.CULong -> IO (BG.Ptr BG.Void)))
+hs_bindgen_d52eebfcdc653f31 =
+  fmap BG.fromFFIType hs_bindgen_d52eebfcdc653f31_base
+
+{-# NOINLINE malloc #-}
+{-| __C declaration:__ @malloc@
+
+    __defined at:__ @functions\/libc_builtins.h 7:7@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+malloc :: BG.FunPtr (BG.CULong -> IO (BG.Ptr BG.Void))
+malloc =
+  BG.unsafePerformIO hs_bindgen_d52eebfcdc653f31
+
+-- __unique:__ @test_functionslibc_builtins_Example_get_strlen@
+foreign import ccall unsafe "hs_bindgen_7c713081d7e72a10" hs_bindgen_7c713081d7e72a10_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionslibc_builtins_Example_get_strlen@
+hs_bindgen_7c713081d7e72a10 :: IO (BG.FunPtr (PtrConst.PtrConst BG.CChar -> IO BG.CULong))
+hs_bindgen_7c713081d7e72a10 =
+  fmap BG.fromFFIType hs_bindgen_7c713081d7e72a10_base
+
+{-# NOINLINE strlen #-}
+{-| __C declaration:__ @strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 8:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+strlen :: BG.FunPtr (PtrConst.PtrConst BG.CChar -> IO BG.CULong)
+strlen =
+  BG.unsafePerformIO hs_bindgen_7c713081d7e72a10
+
+-- __unique:__ @test_functionslibc_builtins_Example_get_my_strlen@
+foreign import ccall unsafe "hs_bindgen_a92eb31aeb03f8c0" hs_bindgen_a92eb31aeb03f8c0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionslibc_builtins_Example_get_my_strlen@
+hs_bindgen_a92eb31aeb03f8c0 :: IO (BG.FunPtr (PtrConst.PtrConst BG.CChar -> IO HsBindgen.Runtime.LibC.CSize))
+hs_bindgen_a92eb31aeb03f8c0 =
+  fmap BG.fromFFIType hs_bindgen_a92eb31aeb03f8c0_base
+
+{-# NOINLINE my_strlen #-}
+{-| __C declaration:__ @my_strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 11:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+my_strlen :: BG.FunPtr (PtrConst.PtrConst BG.CChar -> IO HsBindgen.Runtime.LibC.CSize)
+my_strlen =
+  BG.unsafePerformIO hs_bindgen_a92eb31aeb03f8c0
diff --git a/test-artefacts/fixtures/functions/libc_builtins/Example/Safe.hs b/test-artefacts/fixtures/functions/libc_builtins/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/libc_builtins/Example/Safe.hs
@@ -0,0 +1,114 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.malloc
+    , Example.Safe.strlen
+    , Example.Safe.my_strlen
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/libc_builtins.h>"
+  , "void *hs_bindgen_eb5883c88daf674e ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (malloc)(arg1);"
+  , "}"
+  , "unsigned long hs_bindgen_be2c0f129cd05083 ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (strlen)(arg1);"
+  , "}"
+  , "size_t hs_bindgen_988f2c37e046701b ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (my_strlen)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_malloc@
+foreign import ccall safe "hs_bindgen_eb5883c88daf674e" hs_bindgen_eb5883c88daf674e_base ::
+     BG.CULong
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_malloc@
+hs_bindgen_eb5883c88daf674e ::
+     BG.CULong
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_eb5883c88daf674e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_eb5883c88daf674e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @malloc@
+
+    __defined at:__ @functions\/libc_builtins.h 7:7@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+malloc ::
+     BG.CULong
+     -- ^ __C declaration:__ @size@
+  -> IO (BG.Ptr BG.Void)
+malloc = hs_bindgen_eb5883c88daf674e
+
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_strlen@
+foreign import ccall safe "hs_bindgen_be2c0f129cd05083" hs_bindgen_be2c0f129cd05083_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CULong
+
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_strlen@
+hs_bindgen_be2c0f129cd05083 ::
+     PtrConst.PtrConst BG.CChar
+  -> IO BG.CULong
+hs_bindgen_be2c0f129cd05083 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_be2c0f129cd05083_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 8:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+strlen ::
+     PtrConst.PtrConst BG.CChar
+     -- ^ __C declaration:__ @s@
+  -> IO BG.CULong
+strlen = hs_bindgen_be2c0f129cd05083
+
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_my_strlen@
+foreign import ccall safe "hs_bindgen_988f2c37e046701b" hs_bindgen_988f2c37e046701b_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_my_strlen@
+hs_bindgen_988f2c37e046701b ::
+     PtrConst.PtrConst BG.CChar
+  -> IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_988f2c37e046701b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_988f2c37e046701b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @my_strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 11:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+my_strlen ::
+     PtrConst.PtrConst BG.CChar
+     -- ^ __C declaration:__ @s@
+  -> IO HsBindgen.Runtime.LibC.CSize
+my_strlen = hs_bindgen_988f2c37e046701b
diff --git a/test-artefacts/fixtures/functions/libc_builtins/Example/Unsafe.hs b/test-artefacts/fixtures/functions/libc_builtins/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/libc_builtins/Example/Unsafe.hs
@@ -0,0 +1,114 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.malloc
+    , Example.Unsafe.strlen
+    , Example.Unsafe.my_strlen
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/libc_builtins.h>"
+  , "void *hs_bindgen_89545f6dff974fe2 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (malloc)(arg1);"
+  , "}"
+  , "unsigned long hs_bindgen_246dfd0630c4cbb6 ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (strlen)(arg1);"
+  , "}"
+  , "size_t hs_bindgen_9674282b2423839e ("
+  , "  char const *arg1"
+  , ")"
+  , "{"
+  , "  return (my_strlen)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_malloc@
+foreign import ccall unsafe "hs_bindgen_89545f6dff974fe2" hs_bindgen_89545f6dff974fe2_base ::
+     BG.CULong
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_malloc@
+hs_bindgen_89545f6dff974fe2 ::
+     BG.CULong
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_89545f6dff974fe2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_89545f6dff974fe2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @malloc@
+
+    __defined at:__ @functions\/libc_builtins.h 7:7@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+malloc ::
+     BG.CULong
+     -- ^ __C declaration:__ @size@
+  -> IO (BG.Ptr BG.Void)
+malloc = hs_bindgen_89545f6dff974fe2
+
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_strlen@
+foreign import ccall unsafe "hs_bindgen_246dfd0630c4cbb6" hs_bindgen_246dfd0630c4cbb6_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CULong
+
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_strlen@
+hs_bindgen_246dfd0630c4cbb6 ::
+     PtrConst.PtrConst BG.CChar
+  -> IO BG.CULong
+hs_bindgen_246dfd0630c4cbb6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_246dfd0630c4cbb6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 8:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+strlen ::
+     PtrConst.PtrConst BG.CChar
+     -- ^ __C declaration:__ @s@
+  -> IO BG.CULong
+strlen = hs_bindgen_246dfd0630c4cbb6
+
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_my_strlen@
+foreign import ccall unsafe "hs_bindgen_9674282b2423839e" hs_bindgen_9674282b2423839e_base ::
+     BG.Ptr BG.Void
+  -> IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_my_strlen@
+hs_bindgen_9674282b2423839e ::
+     PtrConst.PtrConst BG.CChar
+  -> IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_9674282b2423839e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9674282b2423839e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @my_strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 11:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+my_strlen ::
+     PtrConst.PtrConst BG.CChar
+     -- ^ __C declaration:__ @s@
+  -> IO HsBindgen.Runtime.LibC.CSize
+my_strlen = hs_bindgen_9674282b2423839e
diff --git a/test-artefacts/fixtures/functions/libc_builtins/bindingspec.yaml b/test-artefacts/fixtures/functions/libc_builtins/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/libc_builtins/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/functions/libc_builtins/th.txt b/test-artefacts/fixtures/functions/libc_builtins/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/libc_builtins/th.txt
@@ -0,0 +1,269 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile test-artefacts/headers/golden/functions/libc_builtins.h
+-- #include <functions/libc_builtins.h>
+-- void *hs_bindgen_eb5883c88daf674e (
+--   unsigned long arg1
+-- )
+-- {
+--   return (malloc)(arg1);
+-- }
+-- unsigned long hs_bindgen_be2c0f129cd05083 (
+--   char const *arg1
+-- )
+-- {
+--   return (strlen)(arg1);
+-- }
+-- size_t hs_bindgen_988f2c37e046701b (
+--   char const *arg1
+-- )
+-- {
+--   return (my_strlen)(arg1);
+-- }
+-- void *hs_bindgen_89545f6dff974fe2 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (malloc)(arg1);
+-- }
+-- unsigned long hs_bindgen_246dfd0630c4cbb6 (
+--   char const *arg1
+-- )
+-- {
+--   return (strlen)(arg1);
+-- }
+-- size_t hs_bindgen_9674282b2423839e (
+--   char const *arg1
+-- )
+-- {
+--   return (my_strlen)(arg1);
+-- }
+-- /* test_functionslibc_builtins_Example_get_malloc */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_d52eebfcdc653f31 (void)) (
+--   unsigned long arg1
+-- )
+-- {
+--   return &malloc;
+-- }
+-- /* test_functionslibc_builtins_Example_get_strlen */
+-- __attribute__ ((const))
+-- unsigned long (*hs_bindgen_7c713081d7e72a10 (void)) (
+--   char const *arg1
+-- )
+-- {
+--   return &strlen;
+-- }
+-- /* test_functionslibc_builtins_Example_get_my_strlen */
+-- __attribute__ ((const))
+-- size_t (*hs_bindgen_a92eb31aeb03f8c0 (void)) (
+--   char const *arg1
+-- )
+-- {
+--   return &my_strlen;
+-- }
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_malloc@
+foreign import ccall safe "hs_bindgen_eb5883c88daf674e" hs_bindgen_eb5883c88daf674e_base ::
+    CULong
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_malloc@
+hs_bindgen_eb5883c88daf674e :: CULong -> IO (Ptr Void)
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_malloc@
+hs_bindgen_eb5883c88daf674e = \x_0 -> fmap fromFFIType (hs_bindgen_eb5883c88daf674e_base (toFFIType x_0))
+{-| __C declaration:__ @malloc@
+
+    __defined at:__ @functions\/libc_builtins.h 7:7@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+malloc_safe :: CULong -> IO (Ptr Void)
+{-| __C declaration:__ @malloc@
+
+    __defined at:__ @functions\/libc_builtins.h 7:7@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+malloc_safe = hs_bindgen_eb5883c88daf674e
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_strlen@
+foreign import ccall safe "hs_bindgen_be2c0f129cd05083" hs_bindgen_be2c0f129cd05083_base ::
+    Ptr Void
+ -> IO CULong
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_strlen@
+hs_bindgen_be2c0f129cd05083 :: PtrConst CChar -> IO CULong
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_strlen@
+hs_bindgen_be2c0f129cd05083 = \x_0 -> fmap fromFFIType (hs_bindgen_be2c0f129cd05083_base (toFFIType x_0))
+{-| __C declaration:__ @strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 8:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+strlen_safe :: PtrConst CChar -> IO CULong
+{-| __C declaration:__ @strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 8:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+strlen_safe = hs_bindgen_be2c0f129cd05083
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_my_strlen@
+foreign import ccall safe "hs_bindgen_988f2c37e046701b" hs_bindgen_988f2c37e046701b_base ::
+    Ptr Void
+ -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_my_strlen@
+hs_bindgen_988f2c37e046701b :: PtrConst CChar ->
+                               IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_functionslibc_builtins_Example_Safe_my_strlen@
+hs_bindgen_988f2c37e046701b = \x_0 -> fmap fromFFIType (hs_bindgen_988f2c37e046701b_base (toFFIType x_0))
+{-| __C declaration:__ @my_strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 11:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+my_strlen_safe :: PtrConst CChar -> IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @my_strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 11:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+my_strlen_safe = hs_bindgen_988f2c37e046701b
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_malloc@
+foreign import ccall unsafe "hs_bindgen_89545f6dff974fe2" hs_bindgen_89545f6dff974fe2_base ::
+    CULong
+ -> IO (Ptr Void)
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_malloc@
+hs_bindgen_89545f6dff974fe2 :: CULong -> IO (Ptr Void)
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_malloc@
+hs_bindgen_89545f6dff974fe2 = \x_0 -> fmap fromFFIType (hs_bindgen_89545f6dff974fe2_base (toFFIType x_0))
+{-| __C declaration:__ @malloc@
+
+    __defined at:__ @functions\/libc_builtins.h 7:7@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+malloc_unsafe :: CULong -> IO (Ptr Void)
+{-| __C declaration:__ @malloc@
+
+    __defined at:__ @functions\/libc_builtins.h 7:7@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+malloc_unsafe = hs_bindgen_89545f6dff974fe2
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_strlen@
+foreign import ccall unsafe "hs_bindgen_246dfd0630c4cbb6" hs_bindgen_246dfd0630c4cbb6_base ::
+    Ptr Void
+ -> IO CULong
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_strlen@
+hs_bindgen_246dfd0630c4cbb6 :: PtrConst CChar -> IO CULong
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_strlen@
+hs_bindgen_246dfd0630c4cbb6 = \x_0 -> fmap fromFFIType (hs_bindgen_246dfd0630c4cbb6_base (toFFIType x_0))
+{-| __C declaration:__ @strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 8:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+strlen_unsafe :: PtrConst CChar -> IO CULong
+{-| __C declaration:__ @strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 8:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+strlen_unsafe = hs_bindgen_246dfd0630c4cbb6
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_my_strlen@
+foreign import ccall unsafe "hs_bindgen_9674282b2423839e" hs_bindgen_9674282b2423839e_base ::
+    Ptr Void
+ -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_my_strlen@
+hs_bindgen_9674282b2423839e :: PtrConst CChar ->
+                               IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_functionslibc_builtins_Example_Unsafe_my_strlen@
+hs_bindgen_9674282b2423839e = \x_0 -> fmap fromFFIType (hs_bindgen_9674282b2423839e_base (toFFIType x_0))
+{-| __C declaration:__ @my_strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 11:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+my_strlen_unsafe :: PtrConst CChar ->
+                    IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @my_strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 11:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+my_strlen_unsafe = hs_bindgen_9674282b2423839e
+-- __unique:__ @test_functionslibc_builtins_Example_get_malloc@
+foreign import ccall unsafe "hs_bindgen_d52eebfcdc653f31" hs_bindgen_d52eebfcdc653f31_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionslibc_builtins_Example_get_malloc@
+hs_bindgen_d52eebfcdc653f31 :: IO (FunPtr (CULong ->
+                                           IO (Ptr Void)))
+-- __unique:__ @test_functionslibc_builtins_Example_get_malloc@
+hs_bindgen_d52eebfcdc653f31 = fmap fromFFIType hs_bindgen_d52eebfcdc653f31_base
+{-# NOINLINE malloc_funptr #-}
+{-| __C declaration:__ @malloc@
+
+    __defined at:__ @functions\/libc_builtins.h 7:7@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+malloc_funptr :: FunPtr (CULong -> IO (Ptr Void))
+{-| __C declaration:__ @malloc@
+
+    __defined at:__ @functions\/libc_builtins.h 7:7@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+malloc_funptr = unsafePerformIO hs_bindgen_d52eebfcdc653f31
+-- __unique:__ @test_functionslibc_builtins_Example_get_strlen@
+foreign import ccall unsafe "hs_bindgen_7c713081d7e72a10" hs_bindgen_7c713081d7e72a10_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionslibc_builtins_Example_get_strlen@
+hs_bindgen_7c713081d7e72a10 :: IO (FunPtr (PtrConst CChar ->
+                                           IO CULong))
+-- __unique:__ @test_functionslibc_builtins_Example_get_strlen@
+hs_bindgen_7c713081d7e72a10 = fmap fromFFIType hs_bindgen_7c713081d7e72a10_base
+{-# NOINLINE strlen_funptr #-}
+{-| __C declaration:__ @strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 8:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+strlen_funptr :: FunPtr (PtrConst CChar -> IO CULong)
+{-| __C declaration:__ @strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 8:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+strlen_funptr = unsafePerformIO hs_bindgen_7c713081d7e72a10
+-- __unique:__ @test_functionslibc_builtins_Example_get_my_strlen@
+foreign import ccall unsafe "hs_bindgen_a92eb31aeb03f8c0" hs_bindgen_a92eb31aeb03f8c0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionslibc_builtins_Example_get_my_strlen@
+hs_bindgen_a92eb31aeb03f8c0 :: IO (FunPtr (PtrConst CChar ->
+                                           IO HsBindgen.Runtime.LibC.CSize))
+-- __unique:__ @test_functionslibc_builtins_Example_get_my_strlen@
+hs_bindgen_a92eb31aeb03f8c0 = fmap fromFFIType hs_bindgen_a92eb31aeb03f8c0_base
+{-# NOINLINE my_strlen_funptr #-}
+{-| __C declaration:__ @my_strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 11:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+my_strlen_funptr :: FunPtr (PtrConst CChar ->
+                            IO HsBindgen.Runtime.LibC.CSize)
+{-| __C declaration:__ @my_strlen@
+
+    __defined at:__ @functions\/libc_builtins.h 11:8@
+
+    __exported by:__ @functions\/libc_builtins.h@
+-}
+my_strlen_funptr = unsafePerformIO hs_bindgen_a92eb31aeb03f8c0
diff --git a/test-artefacts/fixtures/functions/not_visible_decl/bindingspec.yaml b/test-artefacts/fixtures/functions/not_visible_decl/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/not_visible_decl/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/functions/not_visible_decl/th.txt b/test-artefacts/fixtures/functions/not_visible_decl/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/not_visible_decl/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/functions/not_visible_decl.h
diff --git a/test-artefacts/fixtures/functions/simple_func.1.rename/Example/FunPtr.hs b/test-artefacts/fixtures/functions/simple_func.1.rename/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/simple_func.1.rename/Example/FunPtr.hs
@@ -0,0 +1,160 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.erf_random_user_specified_suffix
+    , Example.FunPtr.bad_fma_random_user_specified_suffix
+    , Example.FunPtr.no_args_random_user_specified_suffix
+    , Example.FunPtr.no_args_no_void_random_user_specified_suffix
+    , Example.FunPtr.fun_random_user_specified_suffix
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/simple_func.h>"
+  , "/* test_functionssimple_func_1_rename_Example_get_erf */"
+  , "__attribute__ ((const))"
+  , "double (*hs_bindgen_7d72952bb141f2c8 (void)) ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return &erf;"
+  , "}"
+  , "/* test_functionssimple_func_1_rename_Example_get_bad_fma */"
+  , "__attribute__ ((const))"
+  , "double (*hs_bindgen_d8b56ce4d948e996 (void)) ("
+  , "  double arg1,"
+  , "  double arg2,"
+  , "  double arg3"
+  , ")"
+  , "{"
+  , "  return &bad_fma;"
+  , "}"
+  , "/* test_functionssimple_func_1_rename_Example_get_no_args */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b07b517c1cb304fc (void)) (void)"
+  , "{"
+  , "  return &no_args;"
+  , "}"
+  , "/* test_functionssimple_func_1_rename_Example_get_no_args_no_void */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cc43ff8560009309 (void)) (void)"
+  , "{"
+  , "  return &no_args_no_void;"
+  , "}"
+  , "/* test_functionssimple_func_1_rename_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_14a306e8e8f0ba6c (void)) ("
+  , "  char arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_erf@
+foreign import ccall unsafe "hs_bindgen_7d72952bb141f2c8" hs_bindgen_7d72952bb141f2c8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_erf@
+hs_bindgen_7d72952bb141f2c8 :: IO (BG.FunPtr (BG.CDouble -> IO BG.CDouble))
+hs_bindgen_7d72952bb141f2c8 =
+  fmap BG.fromFFIType hs_bindgen_7d72952bb141f2c8_base
+
+{-# NOINLINE erf_random_user_specified_suffix #-}
+{-| __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf_random_user_specified_suffix :: BG.FunPtr (BG.CDouble -> IO BG.CDouble)
+erf_random_user_specified_suffix =
+  BG.unsafePerformIO hs_bindgen_7d72952bb141f2c8
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_bad_fma@
+foreign import ccall unsafe "hs_bindgen_d8b56ce4d948e996" hs_bindgen_d8b56ce4d948e996_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_bad_fma@
+hs_bindgen_d8b56ce4d948e996 :: IO (BG.FunPtr (BG.CDouble -> BG.CDouble -> BG.CDouble -> IO BG.CDouble))
+hs_bindgen_d8b56ce4d948e996 =
+  fmap BG.fromFFIType hs_bindgen_d8b56ce4d948e996_base
+
+{-# NOINLINE bad_fma_random_user_specified_suffix #-}
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma_random_user_specified_suffix :: BG.FunPtr (BG.CDouble -> BG.CDouble -> BG.CDouble -> IO BG.CDouble)
+bad_fma_random_user_specified_suffix =
+  BG.unsafePerformIO hs_bindgen_d8b56ce4d948e996
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args@
+foreign import ccall unsafe "hs_bindgen_b07b517c1cb304fc" hs_bindgen_b07b517c1cb304fc_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args@
+hs_bindgen_b07b517c1cb304fc :: IO (BG.FunPtr (IO ()))
+hs_bindgen_b07b517c1cb304fc =
+  fmap BG.fromFFIType hs_bindgen_b07b517c1cb304fc_base
+
+{-# NOINLINE no_args_random_user_specified_suffix #-}
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_random_user_specified_suffix :: BG.FunPtr (IO ())
+no_args_random_user_specified_suffix =
+  BG.unsafePerformIO hs_bindgen_b07b517c1cb304fc
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_cc43ff8560009309" hs_bindgen_cc43ff8560009309_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args_no_void@
+hs_bindgen_cc43ff8560009309 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_cc43ff8560009309 =
+  fmap BG.fromFFIType hs_bindgen_cc43ff8560009309_base
+
+{-# NOINLINE no_args_no_void_random_user_specified_suffix #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void_random_user_specified_suffix :: BG.FunPtr (IO ())
+no_args_no_void_random_user_specified_suffix =
+  BG.unsafePerformIO hs_bindgen_cc43ff8560009309
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_14a306e8e8f0ba6c" hs_bindgen_14a306e8e8f0ba6c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_fun@
+hs_bindgen_14a306e8e8f0ba6c :: IO (BG.FunPtr (BG.CChar -> BG.CDouble -> IO BG.CInt))
+hs_bindgen_14a306e8e8f0ba6c =
+  fmap BG.fromFFIType hs_bindgen_14a306e8e8f0ba6c_base
+
+{-# NOINLINE fun_random_user_specified_suffix #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun_random_user_specified_suffix :: BG.FunPtr (BG.CChar -> BG.CDouble -> IO BG.CInt)
+fun_random_user_specified_suffix =
+  BG.unsafePerformIO hs_bindgen_14a306e8e8f0ba6c
diff --git a/test-artefacts/fixtures/functions/simple_func.1.rename/bindingspec.yaml b/test-artefacts/fixtures/functions/simple_func.1.rename/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/simple_func.1.rename/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/functions/simple_func.1.rename/th.txt b/test-artefacts/fixtures/functions/simple_func.1.rename/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/simple_func.1.rename/th.txt
@@ -0,0 +1,155 @@
+-- addDependentFile test-artefacts/headers/golden/functions/simple_func.h
+-- #include <functions/simple_func.h>
+-- /* test_functionssimple_func_1_rename_Example_get_erf */
+-- __attribute__ ((const))
+-- double (*hs_bindgen_7d72952bb141f2c8 (void)) (
+--   double arg1
+-- )
+-- {
+--   return &erf;
+-- }
+-- /* test_functionssimple_func_1_rename_Example_get_bad_fma */
+-- __attribute__ ((const))
+-- double (*hs_bindgen_d8b56ce4d948e996 (void)) (
+--   double arg1,
+--   double arg2,
+--   double arg3
+-- )
+-- {
+--   return &bad_fma;
+-- }
+-- /* test_functionssimple_func_1_rename_Example_get_no_args */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b07b517c1cb304fc (void)) (void)
+-- {
+--   return &no_args;
+-- }
+-- /* test_functionssimple_func_1_rename_Example_get_no_args_no_void */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cc43ff8560009309 (void)) (void)
+-- {
+--   return &no_args_no_void;
+-- }
+-- /* test_functionssimple_func_1_rename_Example_get_fun */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_14a306e8e8f0ba6c (void)) (
+--   char arg1,
+--   double arg2
+-- )
+-- {
+--   return &fun;
+-- }
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_erf@
+foreign import ccall unsafe "hs_bindgen_7d72952bb141f2c8" hs_bindgen_7d72952bb141f2c8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_erf@
+hs_bindgen_7d72952bb141f2c8 :: IO (FunPtr (CDouble -> IO CDouble))
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_erf@
+hs_bindgen_7d72952bb141f2c8 = fmap fromFFIType hs_bindgen_7d72952bb141f2c8_base
+{-# NOINLINE erf_random_user_specified_suffix #-}
+{-| __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf_random_user_specified_suffix :: FunPtr (CDouble -> IO CDouble)
+{-| __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf_random_user_specified_suffix = unsafePerformIO hs_bindgen_7d72952bb141f2c8
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_bad_fma@
+foreign import ccall unsafe "hs_bindgen_d8b56ce4d948e996" hs_bindgen_d8b56ce4d948e996_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_bad_fma@
+hs_bindgen_d8b56ce4d948e996 :: IO (FunPtr (CDouble ->
+                                           CDouble -> CDouble -> IO CDouble))
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_bad_fma@
+hs_bindgen_d8b56ce4d948e996 = fmap fromFFIType hs_bindgen_d8b56ce4d948e996_base
+{-# NOINLINE bad_fma_random_user_specified_suffix #-}
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma_random_user_specified_suffix :: FunPtr (CDouble ->
+                                                CDouble -> CDouble -> IO CDouble)
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma_random_user_specified_suffix = unsafePerformIO hs_bindgen_d8b56ce4d948e996
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args@
+foreign import ccall unsafe "hs_bindgen_b07b517c1cb304fc" hs_bindgen_b07b517c1cb304fc_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args@
+hs_bindgen_b07b517c1cb304fc :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args@
+hs_bindgen_b07b517c1cb304fc = fmap fromFFIType hs_bindgen_b07b517c1cb304fc_base
+{-# NOINLINE no_args_random_user_specified_suffix #-}
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_random_user_specified_suffix :: FunPtr (IO ())
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_random_user_specified_suffix = unsafePerformIO hs_bindgen_b07b517c1cb304fc
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_cc43ff8560009309" hs_bindgen_cc43ff8560009309_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args_no_void@
+hs_bindgen_cc43ff8560009309 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_no_args_no_void@
+hs_bindgen_cc43ff8560009309 = fmap fromFFIType hs_bindgen_cc43ff8560009309_base
+{-# NOINLINE no_args_no_void_random_user_specified_suffix #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void_random_user_specified_suffix :: FunPtr (IO ())
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void_random_user_specified_suffix = unsafePerformIO hs_bindgen_cc43ff8560009309
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_14a306e8e8f0ba6c" hs_bindgen_14a306e8e8f0ba6c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_fun@
+hs_bindgen_14a306e8e8f0ba6c :: IO (FunPtr (CChar ->
+                                           CDouble -> IO CInt))
+-- __unique:__ @test_functionssimple_func_1_rename_Example_get_fun@
+hs_bindgen_14a306e8e8f0ba6c = fmap fromFFIType hs_bindgen_14a306e8e8f0ba6c_base
+{-# NOINLINE fun_random_user_specified_suffix #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun_random_user_specified_suffix :: FunPtr (CChar ->
+                                            CDouble -> IO CInt)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun_random_user_specified_suffix = unsafePerformIO hs_bindgen_14a306e8e8f0ba6c
diff --git a/test-artefacts/fixtures/functions/simple_func/Example/FunPtr.hs b/test-artefacts/fixtures/functions/simple_func/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/simple_func/Example/FunPtr.hs
@@ -0,0 +1,158 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.erf
+    , Example.FunPtr.bad_fma
+    , Example.FunPtr.no_args
+    , Example.FunPtr.no_args_no_void
+    , Example.FunPtr.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/simple_func.h>"
+  , "/* test_functionssimple_func_Example_get_erf */"
+  , "__attribute__ ((const))"
+  , "double (*hs_bindgen_97654202e0d79fbb (void)) ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return &erf;"
+  , "}"
+  , "/* test_functionssimple_func_Example_get_bad_fma */"
+  , "__attribute__ ((const))"
+  , "double (*hs_bindgen_4c8418e152e9ddbc (void)) ("
+  , "  double arg1,"
+  , "  double arg2,"
+  , "  double arg3"
+  , ")"
+  , "{"
+  , "  return &bad_fma;"
+  , "}"
+  , "/* test_functionssimple_func_Example_get_no_args */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a271856b1fcc9477 (void)) (void)"
+  , "{"
+  , "  return &no_args;"
+  , "}"
+  , "/* test_functionssimple_func_Example_get_no_args_no_void */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_73f2a4bbf4a49702 (void)) (void)"
+  , "{"
+  , "  return &no_args_no_void;"
+  , "}"
+  , "/* test_functionssimple_func_Example_get_fun */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_5416cbf886368c01 (void)) ("
+  , "  char arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionssimple_func_Example_get_erf@
+foreign import ccall unsafe "hs_bindgen_97654202e0d79fbb" hs_bindgen_97654202e0d79fbb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_Example_get_erf@
+hs_bindgen_97654202e0d79fbb :: IO (BG.FunPtr (BG.CDouble -> IO BG.CDouble))
+hs_bindgen_97654202e0d79fbb =
+  fmap BG.fromFFIType hs_bindgen_97654202e0d79fbb_base
+
+{-# NOINLINE erf #-}
+{-| __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf :: BG.FunPtr (BG.CDouble -> IO BG.CDouble)
+erf = BG.unsafePerformIO hs_bindgen_97654202e0d79fbb
+
+-- __unique:__ @test_functionssimple_func_Example_get_bad_fma@
+foreign import ccall unsafe "hs_bindgen_4c8418e152e9ddbc" hs_bindgen_4c8418e152e9ddbc_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_Example_get_bad_fma@
+hs_bindgen_4c8418e152e9ddbc :: IO (BG.FunPtr (BG.CDouble -> BG.CDouble -> BG.CDouble -> IO BG.CDouble))
+hs_bindgen_4c8418e152e9ddbc =
+  fmap BG.fromFFIType hs_bindgen_4c8418e152e9ddbc_base
+
+{-# NOINLINE bad_fma #-}
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma :: BG.FunPtr (BG.CDouble -> BG.CDouble -> BG.CDouble -> IO BG.CDouble)
+bad_fma =
+  BG.unsafePerformIO hs_bindgen_4c8418e152e9ddbc
+
+-- __unique:__ @test_functionssimple_func_Example_get_no_args@
+foreign import ccall unsafe "hs_bindgen_a271856b1fcc9477" hs_bindgen_a271856b1fcc9477_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_Example_get_no_args@
+hs_bindgen_a271856b1fcc9477 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_a271856b1fcc9477 =
+  fmap BG.fromFFIType hs_bindgen_a271856b1fcc9477_base
+
+{-# NOINLINE no_args #-}
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args :: BG.FunPtr (IO ())
+no_args =
+  BG.unsafePerformIO hs_bindgen_a271856b1fcc9477
+
+-- __unique:__ @test_functionssimple_func_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_73f2a4bbf4a49702" hs_bindgen_73f2a4bbf4a49702_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_Example_get_no_args_no_void@
+hs_bindgen_73f2a4bbf4a49702 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_73f2a4bbf4a49702 =
+  fmap BG.fromFFIType hs_bindgen_73f2a4bbf4a49702_base
+
+{-# NOINLINE no_args_no_void #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void :: BG.FunPtr (IO ())
+no_args_no_void =
+  BG.unsafePerformIO hs_bindgen_73f2a4bbf4a49702
+
+-- __unique:__ @test_functionssimple_func_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_5416cbf886368c01" hs_bindgen_5416cbf886368c01_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionssimple_func_Example_get_fun@
+hs_bindgen_5416cbf886368c01 :: IO (BG.FunPtr (BG.CChar -> BG.CDouble -> IO BG.CInt))
+hs_bindgen_5416cbf886368c01 =
+  fmap BG.fromFFIType hs_bindgen_5416cbf886368c01_base
+
+{-# NOINLINE fun #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun :: BG.FunPtr (BG.CChar -> BG.CDouble -> IO BG.CInt)
+fun = BG.unsafePerformIO hs_bindgen_5416cbf886368c01
diff --git a/test-artefacts/fixtures/functions/simple_func/Example/Safe.hs b/test-artefacts/fixtures/functions/simple_func/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/simple_func/Example/Safe.hs
@@ -0,0 +1,180 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.erf
+    , Example.Safe.bad_fma
+    , Example.Safe.no_args
+    , Example.Safe.no_args_no_void
+    , Example.Safe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/simple_func.h>"
+  , "double hs_bindgen_1c811bfb80de8f77 ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (erf)(arg1);"
+  , "}"
+  , "double hs_bindgen_180022d3518c53bd ("
+  , "  double arg1,"
+  , "  double arg2,"
+  , "  double arg3"
+  , ")"
+  , "{"
+  , "  return (bad_fma)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_d72558f6f977200c (void)"
+  , "{"
+  , "  (no_args)();"
+  , "}"
+  , "void hs_bindgen_d8523e2ccea5c7ba (void)"
+  , "{"
+  , "  (no_args_no_void)();"
+  , "}"
+  , "signed int hs_bindgen_48cbd3cd1c6e874f ("
+  , "  char arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (fun)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_erf@
+foreign import ccall safe "hs_bindgen_1c811bfb80de8f77" hs_bindgen_1c811bfb80de8f77_base ::
+     BG.CDouble
+  -> BG.CDouble
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_erf@
+hs_bindgen_1c811bfb80de8f77 ::
+     BG.CDouble
+  -> BG.CDouble
+hs_bindgen_1c811bfb80de8f77 =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_1c811bfb80de8f77_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf ::
+     BG.CDouble
+     -- ^ __C declaration:__ @arg@
+  -> BG.CDouble
+erf = hs_bindgen_1c811bfb80de8f77
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_bad_fma@
+foreign import ccall safe "hs_bindgen_180022d3518c53bd" hs_bindgen_180022d3518c53bd_base ::
+     BG.CDouble
+  -> BG.CDouble
+  -> BG.CDouble
+  -> IO BG.CDouble
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_bad_fma@
+hs_bindgen_180022d3518c53bd ::
+     BG.CDouble
+  -> BG.CDouble
+  -> BG.CDouble
+  -> IO BG.CDouble
+hs_bindgen_180022d3518c53bd =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_180022d3518c53bd_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @y@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @z@
+  -> IO BG.CDouble
+bad_fma = hs_bindgen_180022d3518c53bd
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args@
+foreign import ccall safe "hs_bindgen_d72558f6f977200c" hs_bindgen_d72558f6f977200c_base ::
+     IO ()
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args@
+hs_bindgen_d72558f6f977200c :: IO ()
+hs_bindgen_d72558f6f977200c =
+  hs_bindgen_d72558f6f977200c_base
+
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args :: IO ()
+no_args = hs_bindgen_d72558f6f977200c
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args_no_void@
+foreign import ccall safe "hs_bindgen_d8523e2ccea5c7ba" hs_bindgen_d8523e2ccea5c7ba_base ::
+     IO ()
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args_no_void@
+hs_bindgen_d8523e2ccea5c7ba :: IO ()
+hs_bindgen_d8523e2ccea5c7ba =
+  hs_bindgen_d8523e2ccea5c7ba_base
+
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void :: IO ()
+no_args_no_void = hs_bindgen_d8523e2ccea5c7ba
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_48cbd3cd1c6e874f" hs_bindgen_48cbd3cd1c6e874f_base ::
+     BG.CChar
+  -> BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionssimple_func_Example_Safe_fun@
+hs_bindgen_48cbd3cd1c6e874f ::
+     BG.CChar
+  -> BG.CDouble
+  -> IO BG.CInt
+hs_bindgen_48cbd3cd1c6e874f =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_48cbd3cd1c6e874f_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CInt
+fun = hs_bindgen_48cbd3cd1c6e874f
diff --git a/test-artefacts/fixtures/functions/simple_func/Example/Unsafe.hs b/test-artefacts/fixtures/functions/simple_func/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/simple_func/Example/Unsafe.hs
@@ -0,0 +1,180 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.erf
+    , Example.Unsafe.bad_fma
+    , Example.Unsafe.no_args
+    , Example.Unsafe.no_args_no_void
+    , Example.Unsafe.fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/simple_func.h>"
+  , "double hs_bindgen_da5d889180d72efd ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (erf)(arg1);"
+  , "}"
+  , "double hs_bindgen_d02f37accebc0cb3 ("
+  , "  double arg1,"
+  , "  double arg2,"
+  , "  double arg3"
+  , ")"
+  , "{"
+  , "  return (bad_fma)(arg1, arg2, arg3);"
+  , "}"
+  , "void hs_bindgen_9ea56ae4fab9a418 (void)"
+  , "{"
+  , "  (no_args)();"
+  , "}"
+  , "void hs_bindgen_a3d1783059ec7820 (void)"
+  , "{"
+  , "  (no_args_no_void)();"
+  , "}"
+  , "signed int hs_bindgen_91392ef466aa34e7 ("
+  , "  char arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (fun)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_erf@
+foreign import ccall unsafe "hs_bindgen_da5d889180d72efd" hs_bindgen_da5d889180d72efd_base ::
+     BG.CDouble
+  -> BG.CDouble
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_erf@
+hs_bindgen_da5d889180d72efd ::
+     BG.CDouble
+  -> BG.CDouble
+hs_bindgen_da5d889180d72efd =
+  \x0 ->
+    BG.fromFFIType (hs_bindgen_da5d889180d72efd_base (BG.toFFIType x0))
+
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf ::
+     BG.CDouble
+     -- ^ __C declaration:__ @arg@
+  -> BG.CDouble
+erf = hs_bindgen_da5d889180d72efd
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_bad_fma@
+foreign import ccall unsafe "hs_bindgen_d02f37accebc0cb3" hs_bindgen_d02f37accebc0cb3_base ::
+     BG.CDouble
+  -> BG.CDouble
+  -> BG.CDouble
+  -> IO BG.CDouble
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_bad_fma@
+hs_bindgen_d02f37accebc0cb3 ::
+     BG.CDouble
+  -> BG.CDouble
+  -> BG.CDouble
+  -> IO BG.CDouble
+hs_bindgen_d02f37accebc0cb3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_d02f37accebc0cb3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @y@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @z@
+  -> IO BG.CDouble
+bad_fma = hs_bindgen_d02f37accebc0cb3
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args@
+foreign import ccall unsafe "hs_bindgen_9ea56ae4fab9a418" hs_bindgen_9ea56ae4fab9a418_base ::
+     IO ()
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args@
+hs_bindgen_9ea56ae4fab9a418 :: IO ()
+hs_bindgen_9ea56ae4fab9a418 =
+  hs_bindgen_9ea56ae4fab9a418_base
+
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args :: IO ()
+no_args = hs_bindgen_9ea56ae4fab9a418
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_a3d1783059ec7820" hs_bindgen_a3d1783059ec7820_base ::
+     IO ()
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args_no_void@
+hs_bindgen_a3d1783059ec7820 :: IO ()
+hs_bindgen_a3d1783059ec7820 =
+  hs_bindgen_a3d1783059ec7820_base
+
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void :: IO ()
+no_args_no_void = hs_bindgen_a3d1783059ec7820
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_91392ef466aa34e7" hs_bindgen_91392ef466aa34e7_base ::
+     BG.CChar
+  -> BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_fun@
+hs_bindgen_91392ef466aa34e7 ::
+     BG.CChar
+  -> BG.CDouble
+  -> IO BG.CInt
+hs_bindgen_91392ef466aa34e7 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_91392ef466aa34e7_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CInt
+fun = hs_bindgen_91392ef466aa34e7
diff --git a/test-artefacts/fixtures/functions/simple_func/bindingspec.yaml b/test-artefacts/fixtures/functions/simple_func/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/simple_func/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/functions/simple_func/th.txt b/test-artefacts/fixtures/functions/simple_func/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/simple_func/th.txt
@@ -0,0 +1,452 @@
+-- addDependentFile test-artefacts/headers/golden/functions/simple_func.h
+-- #include <functions/simple_func.h>
+-- double hs_bindgen_1c811bfb80de8f77 (
+--   double arg1
+-- )
+-- {
+--   return (erf)(arg1);
+-- }
+-- double hs_bindgen_180022d3518c53bd (
+--   double arg1,
+--   double arg2,
+--   double arg3
+-- )
+-- {
+--   return (bad_fma)(arg1, arg2, arg3);
+-- }
+-- void hs_bindgen_d72558f6f977200c (void)
+-- {
+--   (no_args)();
+-- }
+-- void hs_bindgen_d8523e2ccea5c7ba (void)
+-- {
+--   (no_args_no_void)();
+-- }
+-- signed int hs_bindgen_48cbd3cd1c6e874f (
+--   char arg1,
+--   double arg2
+-- )
+-- {
+--   return (fun)(arg1, arg2);
+-- }
+-- double hs_bindgen_da5d889180d72efd (
+--   double arg1
+-- )
+-- {
+--   return (erf)(arg1);
+-- }
+-- double hs_bindgen_d02f37accebc0cb3 (
+--   double arg1,
+--   double arg2,
+--   double arg3
+-- )
+-- {
+--   return (bad_fma)(arg1, arg2, arg3);
+-- }
+-- void hs_bindgen_9ea56ae4fab9a418 (void)
+-- {
+--   (no_args)();
+-- }
+-- void hs_bindgen_a3d1783059ec7820 (void)
+-- {
+--   (no_args_no_void)();
+-- }
+-- signed int hs_bindgen_91392ef466aa34e7 (
+--   char arg1,
+--   double arg2
+-- )
+-- {
+--   return (fun)(arg1, arg2);
+-- }
+-- /* test_functionssimple_func_Example_get_erf */
+-- __attribute__ ((const))
+-- double (*hs_bindgen_97654202e0d79fbb (void)) (
+--   double arg1
+-- )
+-- {
+--   return &erf;
+-- }
+-- /* test_functionssimple_func_Example_get_bad_fma */
+-- __attribute__ ((const))
+-- double (*hs_bindgen_4c8418e152e9ddbc (void)) (
+--   double arg1,
+--   double arg2,
+--   double arg3
+-- )
+-- {
+--   return &bad_fma;
+-- }
+-- /* test_functionssimple_func_Example_get_no_args */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a271856b1fcc9477 (void)) (void)
+-- {
+--   return &no_args;
+-- }
+-- /* test_functionssimple_func_Example_get_no_args_no_void */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_73f2a4bbf4a49702 (void)) (void)
+-- {
+--   return &no_args_no_void;
+-- }
+-- /* test_functionssimple_func_Example_get_fun */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_5416cbf886368c01 (void)) (
+--   char arg1,
+--   double arg2
+-- )
+-- {
+--   return &fun;
+-- }
+-- __unique:__ @test_functionssimple_func_Example_Safe_erf@
+foreign import ccall safe "hs_bindgen_1c811bfb80de8f77" hs_bindgen_1c811bfb80de8f77_base ::
+    CDouble
+ -> CDouble
+-- __unique:__ @test_functionssimple_func_Example_Safe_erf@
+hs_bindgen_1c811bfb80de8f77 :: CDouble -> CDouble
+-- __unique:__ @test_functionssimple_func_Example_Safe_erf@
+hs_bindgen_1c811bfb80de8f77 = \x_0 -> fromFFIType (hs_bindgen_1c811bfb80de8f77_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf_safe :: CDouble -> CDouble
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf_safe = hs_bindgen_1c811bfb80de8f77
+-- __unique:__ @test_functionssimple_func_Example_Safe_bad_fma@
+foreign import ccall safe "hs_bindgen_180022d3518c53bd" hs_bindgen_180022d3518c53bd_base ::
+    CDouble
+ -> CDouble
+ -> CDouble
+ -> IO CDouble
+-- __unique:__ @test_functionssimple_func_Example_Safe_bad_fma@
+hs_bindgen_180022d3518c53bd :: CDouble ->
+                               CDouble -> CDouble -> IO CDouble
+-- __unique:__ @test_functionssimple_func_Example_Safe_bad_fma@
+hs_bindgen_180022d3518c53bd = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_180022d3518c53bd_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma_safe :: CDouble -> CDouble -> CDouble -> IO CDouble
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma_safe = hs_bindgen_180022d3518c53bd
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args@
+foreign import ccall safe "hs_bindgen_d72558f6f977200c" hs_bindgen_d72558f6f977200c_base ::
+    IO ()
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args@
+hs_bindgen_d72558f6f977200c :: IO ()
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args@
+hs_bindgen_d72558f6f977200c = hs_bindgen_d72558f6f977200c_base
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_safe :: IO ()
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_safe = hs_bindgen_d72558f6f977200c
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args_no_void@
+foreign import ccall safe "hs_bindgen_d8523e2ccea5c7ba" hs_bindgen_d8523e2ccea5c7ba_base ::
+    IO ()
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args_no_void@
+hs_bindgen_d8523e2ccea5c7ba :: IO ()
+-- __unique:__ @test_functionssimple_func_Example_Safe_no_args_no_void@
+hs_bindgen_d8523e2ccea5c7ba = hs_bindgen_d8523e2ccea5c7ba_base
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void_safe :: IO ()
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void_safe = hs_bindgen_d8523e2ccea5c7ba
+-- __unique:__ @test_functionssimple_func_Example_Safe_fun@
+foreign import ccall safe "hs_bindgen_48cbd3cd1c6e874f" hs_bindgen_48cbd3cd1c6e874f_base ::
+    CChar
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @test_functionssimple_func_Example_Safe_fun@
+hs_bindgen_48cbd3cd1c6e874f :: CChar -> CDouble -> IO CInt
+-- __unique:__ @test_functionssimple_func_Example_Safe_fun@
+hs_bindgen_48cbd3cd1c6e874f = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_48cbd3cd1c6e874f_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun_safe :: CChar -> CDouble -> IO CInt
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun_safe = hs_bindgen_48cbd3cd1c6e874f
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_erf@
+foreign import ccall unsafe "hs_bindgen_da5d889180d72efd" hs_bindgen_da5d889180d72efd_base ::
+    CDouble
+ -> CDouble
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_erf@
+hs_bindgen_da5d889180d72efd :: CDouble -> CDouble
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_erf@
+hs_bindgen_da5d889180d72efd = \x_0 -> fromFFIType (hs_bindgen_da5d889180d72efd_base (toFFIType x_0))
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf_unsafe :: CDouble -> CDouble
+{-|
+
+    Marked @__attribute((const))__@
+
+    __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf_unsafe = hs_bindgen_da5d889180d72efd
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_bad_fma@
+foreign import ccall unsafe "hs_bindgen_d02f37accebc0cb3" hs_bindgen_d02f37accebc0cb3_base ::
+    CDouble
+ -> CDouble
+ -> CDouble
+ -> IO CDouble
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_bad_fma@
+hs_bindgen_d02f37accebc0cb3 :: CDouble ->
+                               CDouble -> CDouble -> IO CDouble
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_bad_fma@
+hs_bindgen_d02f37accebc0cb3 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_d02f37accebc0cb3_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma_unsafe :: CDouble -> CDouble -> CDouble -> IO CDouble
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma_unsafe = hs_bindgen_d02f37accebc0cb3
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args@
+foreign import ccall unsafe "hs_bindgen_9ea56ae4fab9a418" hs_bindgen_9ea56ae4fab9a418_base ::
+    IO ()
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args@
+hs_bindgen_9ea56ae4fab9a418 :: IO ()
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args@
+hs_bindgen_9ea56ae4fab9a418 = hs_bindgen_9ea56ae4fab9a418_base
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_unsafe :: IO ()
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_unsafe = hs_bindgen_9ea56ae4fab9a418
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_a3d1783059ec7820" hs_bindgen_a3d1783059ec7820_base ::
+    IO ()
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args_no_void@
+hs_bindgen_a3d1783059ec7820 :: IO ()
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_no_args_no_void@
+hs_bindgen_a3d1783059ec7820 = hs_bindgen_a3d1783059ec7820_base
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void_unsafe :: IO ()
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void_unsafe = hs_bindgen_a3d1783059ec7820
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_fun@
+foreign import ccall unsafe "hs_bindgen_91392ef466aa34e7" hs_bindgen_91392ef466aa34e7_base ::
+    CChar
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_fun@
+hs_bindgen_91392ef466aa34e7 :: CChar -> CDouble -> IO CInt
+-- __unique:__ @test_functionssimple_func_Example_Unsafe_fun@
+hs_bindgen_91392ef466aa34e7 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_91392ef466aa34e7_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun_unsafe :: CChar -> CDouble -> IO CInt
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun_unsafe = hs_bindgen_91392ef466aa34e7
+-- __unique:__ @test_functionssimple_func_Example_get_erf@
+foreign import ccall unsafe "hs_bindgen_97654202e0d79fbb" hs_bindgen_97654202e0d79fbb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_Example_get_erf@
+hs_bindgen_97654202e0d79fbb :: IO (FunPtr (CDouble -> IO CDouble))
+-- __unique:__ @test_functionssimple_func_Example_get_erf@
+hs_bindgen_97654202e0d79fbb = fmap fromFFIType hs_bindgen_97654202e0d79fbb_base
+{-# NOINLINE erf_funptr #-}
+{-| __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf_funptr :: FunPtr (CDouble -> IO CDouble)
+{-| __C declaration:__ @erf@
+
+    __defined at:__ @functions\/simple_func.h 1:8@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+erf_funptr = unsafePerformIO hs_bindgen_97654202e0d79fbb
+-- __unique:__ @test_functionssimple_func_Example_get_bad_fma@
+foreign import ccall unsafe "hs_bindgen_4c8418e152e9ddbc" hs_bindgen_4c8418e152e9ddbc_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_Example_get_bad_fma@
+hs_bindgen_4c8418e152e9ddbc :: IO (FunPtr (CDouble ->
+                                           CDouble -> CDouble -> IO CDouble))
+-- __unique:__ @test_functionssimple_func_Example_get_bad_fma@
+hs_bindgen_4c8418e152e9ddbc = fmap fromFFIType hs_bindgen_4c8418e152e9ddbc_base
+{-# NOINLINE bad_fma_funptr #-}
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma_funptr :: FunPtr (CDouble ->
+                          CDouble -> CDouble -> IO CDouble)
+{-| __C declaration:__ @bad_fma@
+
+    __defined at:__ @functions\/simple_func.h 3:22@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+bad_fma_funptr = unsafePerformIO hs_bindgen_4c8418e152e9ddbc
+-- __unique:__ @test_functionssimple_func_Example_get_no_args@
+foreign import ccall unsafe "hs_bindgen_a271856b1fcc9477" hs_bindgen_a271856b1fcc9477_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_Example_get_no_args@
+hs_bindgen_a271856b1fcc9477 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionssimple_func_Example_get_no_args@
+hs_bindgen_a271856b1fcc9477 = fmap fromFFIType hs_bindgen_a271856b1fcc9477_base
+{-# NOINLINE no_args_funptr #-}
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @no_args@
+
+    __defined at:__ @functions\/simple_func.h 7:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_funptr = unsafePerformIO hs_bindgen_a271856b1fcc9477
+-- __unique:__ @test_functionssimple_func_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_73f2a4bbf4a49702" hs_bindgen_73f2a4bbf4a49702_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_Example_get_no_args_no_void@
+hs_bindgen_73f2a4bbf4a49702 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionssimple_func_Example_get_no_args_no_void@
+hs_bindgen_73f2a4bbf4a49702 = fmap fromFFIType hs_bindgen_73f2a4bbf4a49702_base
+{-# NOINLINE no_args_no_void_funptr #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @functions\/simple_func.h 9:6@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+no_args_no_void_funptr = unsafePerformIO hs_bindgen_73f2a4bbf4a49702
+-- __unique:__ @test_functionssimple_func_Example_get_fun@
+foreign import ccall unsafe "hs_bindgen_5416cbf886368c01" hs_bindgen_5416cbf886368c01_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionssimple_func_Example_get_fun@
+hs_bindgen_5416cbf886368c01 :: IO (FunPtr (CChar ->
+                                           CDouble -> IO CInt))
+-- __unique:__ @test_functionssimple_func_Example_get_fun@
+hs_bindgen_5416cbf886368c01 = fmap fromFFIType hs_bindgen_5416cbf886368c01_base
+{-# NOINLINE fun_funptr #-}
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun_funptr :: FunPtr (CChar -> CDouble -> IO CInt)
+{-| __C declaration:__ @fun@
+
+    __defined at:__ @functions\/simple_func.h 11:5@
+
+    __exported by:__ @functions\/simple_func.h@
+-}
+fun_funptr = unsafePerformIO hs_bindgen_5416cbf886368c01
diff --git a/test-artefacts/fixtures/functions/typedef_funptr/Example.hs b/test-artefacts/fixtures/functions/typedef_funptr/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/typedef_funptr/Example.hs
@@ -0,0 +1,279 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.RunDriver_Aux(..)
+    , Example.RunDriver(..)
+    , Example.Driver(..)
+    , Example.Bare(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, IO, Int, Ord, Show, fmap, pure, type (~))
+
+{-| Auxiliary type used by 'RunDriver'
+
+    __C declaration:__ @RunDriver@
+
+    __defined at:__ @functions\/typedef_funptr.h 12:15@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+newtype RunDriver_Aux = RunDriver_Aux
+  { unwrapRunDriver_Aux :: BG.Ptr Driver -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toRunDriver_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d86ecf261d7044c6_base ::
+     (BG.Ptr BG.Void -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.Ptr BG.Void -> IO BG.CInt))
+
+-- __unique:__ @toRunDriver_Aux@
+hs_bindgen_d86ecf261d7044c6 ::
+     RunDriver_Aux
+  -> IO (BG.FunPtr RunDriver_Aux)
+hs_bindgen_d86ecf261d7044c6 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_d86ecf261d7044c6_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrapRunDriver_Aux" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromRunDriver_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_6520ae39b50ffb4e_base ::
+     BG.FunPtr (BG.Ptr BG.Void -> IO BG.CInt)
+  -> BG.Ptr BG.Void -> IO BG.CInt
+
+-- __unique:__ @fromRunDriver_Aux@
+hs_bindgen_6520ae39b50ffb4e ::
+     BG.FunPtr RunDriver_Aux
+  -> RunDriver_Aux
+hs_bindgen_6520ae39b50ffb4e =
+  \funPtr0 ->
+    RunDriver_Aux (\x1 ->
+                     fmap BG.fromFFIType (hs_bindgen_6520ae39b50ffb4e_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr RunDriver_Aux where
+
+  toFunPtr = hs_bindgen_d86ecf261d7044c6
+
+instance BG.FromFunPtr RunDriver_Aux where
+
+  fromFunPtr = hs_bindgen_6520ae39b50ffb4e
+
+instance ( ty ~ (BG.Ptr Driver -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapRunDriver_Aux" RunDriver_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> RunDriver_Aux {unwrapRunDriver_Aux = y1}
+      , BG.getField @"unwrapRunDriver_Aux" x0
+      )
+
+instance ( ty ~ (BG.Ptr Driver -> IO BG.CInt)
+         ) => BG.HasField "unwrapRunDriver_Aux" (BG.Ptr RunDriver_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapRunDriver_Aux")
+
+instance HasCField.HasCField RunDriver_Aux "unwrapRunDriver_Aux" where
+
+  type CFieldType RunDriver_Aux "unwrapRunDriver_Aux" =
+    BG.Ptr Driver -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @RunDriver@
+
+    __defined at:__ @functions\/typedef_funptr.h 12:15@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+newtype RunDriver = RunDriver
+  { unwrapRunDriver :: BG.FunPtr RunDriver_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr RunDriver_Aux
+         ) => BG.CompatHasField.HasField "unwrapRunDriver" RunDriver ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         RunDriver {unwrapRunDriver = y1}, BG.getField @"unwrapRunDriver" x0)
+
+instance ( ty ~ BG.FunPtr RunDriver_Aux
+         ) => BG.HasField "unwrapRunDriver" (BG.Ptr RunDriver) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapRunDriver")
+
+instance HasCField.HasCField RunDriver "unwrapRunDriver" where
+
+  type CFieldType RunDriver "unwrapRunDriver" =
+    BG.FunPtr RunDriver_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct Driver@
+
+    __defined at:__ @functions\/typedef_funptr.h 13:8@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+data Driver = Driver
+  { driver_run :: RunDriver
+    {- ^ __C declaration:__ @run@
+
+         __defined at:__ @functions\/typedef_funptr.h 14:13@
+
+         __exported by:__ @functions\/typedef_funptr.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Driver where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Driver where
+
+  readRaw =
+    \ptr0 ->
+          pure Driver
+      <*> HasCField.readRaw (BG.Proxy @"driver_run") ptr0
+
+instance Marshal.WriteRaw Driver where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Driver driver_run2 ->
+            HasCField.writeRaw (BG.Proxy @"driver_run") ptr0 driver_run2
+
+deriving via Marshal.EquivStorable Driver instance BG.Storable Driver
+
+deriving via Struct.IsStructViaReadRaw Driver instance Struct.IsStruct Driver
+
+{-| __C declaration:__ @run@
+
+    __defined at:__ @functions\/typedef_funptr.h 14:13@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+instance ( ty ~ RunDriver
+         ) => BG.CompatHasField.HasField "driver_run" Driver ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Driver {driver_run = y1}, BG.getField @"driver_run" x0)
+
+instance ( ty ~ RunDriver
+         ) => BG.HasField "driver_run" (BG.Ptr Driver) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"driver_run")
+
+instance HasCField.HasCField Driver "driver_run" where
+
+  type CFieldType Driver "driver_run" = RunDriver
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct Bare@
+
+    __defined at:__ @functions\/typedef_funptr.h 20:8@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+data Bare = Bare
+  { bare_callback :: BG.FunPtr (BG.CInt -> IO ())
+    {- ^ __C declaration:__ @callback@
+
+         __defined at:__ @functions\/typedef_funptr.h 21:10@
+
+         __exported by:__ @functions\/typedef_funptr.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bare where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Bare where
+
+  readRaw =
+    \ptr0 ->
+          pure Bare
+      <*> HasCField.readRaw (BG.Proxy @"bare_callback") ptr0
+
+instance Marshal.WriteRaw Bare where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bare bare_callback2 ->
+            HasCField.writeRaw (BG.Proxy @"bare_callback") ptr0 bare_callback2
+
+deriving via Marshal.EquivStorable Bare instance BG.Storable Bare
+
+deriving via Struct.IsStructViaReadRaw Bare instance Struct.IsStruct Bare
+
+{-| __C declaration:__ @callback@
+
+    __defined at:__ @functions\/typedef_funptr.h 21:10@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+instance ( ty ~ BG.FunPtr (BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "bare_callback" Bare ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bare {bare_callback = y1}, BG.getField @"bare_callback" x0)
+
+instance ( ty ~ BG.FunPtr (BG.CInt -> IO ())
+         ) => BG.HasField "bare_callback" (BG.Ptr Bare) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"bare_callback")
+
+instance HasCField.HasCField Bare "bare_callback" where
+
+  type CFieldType Bare "bare_callback" =
+    BG.FunPtr (BG.CInt -> IO ())
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/typedef_funptr/bindingspec.yaml b/test-artefacts/fixtures/functions/typedef_funptr/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/typedef_funptr/bindingspec.yaml
@@ -0,0 +1,76 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: functions/typedef_funptr.h
+  cname: RunDriver
+  hsname: RunDriver
+- headers: functions/typedef_funptr.h
+  cname: struct Driver
+  hsname: Driver
+- headers: functions/typedef_funptr.h
+  cname: struct Bare
+  hsname: Bare
+hstypes:
+- hsname: Bare
+  representation:
+    record:
+      constructor: Bare
+      fields:
+      - bare_callback
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Driver
+  representation:
+    record:
+      constructor: Driver
+      fields:
+      - driver_run
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: RunDriver
+  representation:
+    newtype:
+      constructor: RunDriver
+      fields:
+      - unwrapRunDriver
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/functions/typedef_funptr/th.txt b/test-artefacts/fixtures/functions/typedef_funptr/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/typedef_funptr/th.txt
@@ -0,0 +1,140 @@
+-- addDependentFile test-artefacts/headers/golden/functions/typedef_funptr.h
+{-| Auxiliary type used by 'RunDriver'
+
+    __C declaration:__ @RunDriver@
+
+    __defined at:__ @functions\/typedef_funptr.h 12:15@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+newtype RunDriver_Aux
+    = RunDriver_Aux {unwrapRunDriver_Aux :: (Ptr Driver -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toRunDriver_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_d86ecf261d7044c6_base ::
+    Ptr Void -> IO CInt
+ -> IO (FunPtr (Ptr Void -> IO CInt))
+-- __unique:__ @toRunDriver_Aux@
+hs_bindgen_d86ecf261d7044c6 :: RunDriver_Aux ->
+                               IO (FunPtr RunDriver_Aux)
+-- __unique:__ @toRunDriver_Aux@
+hs_bindgen_d86ecf261d7044c6 = \fun_0 -> fmap castFunPtr (hs_bindgen_d86ecf261d7044c6_base (\x_1 -> fmap toFFIType (getField @"unwrapRunDriver_Aux" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromRunDriver_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_6520ae39b50ffb4e_base ::
+    FunPtr (Ptr Void -> IO CInt)
+ -> Ptr Void
+ -> IO CInt
+-- __unique:__ @fromRunDriver_Aux@
+hs_bindgen_6520ae39b50ffb4e :: FunPtr RunDriver_Aux ->
+                               RunDriver_Aux
+-- __unique:__ @fromRunDriver_Aux@
+hs_bindgen_6520ae39b50ffb4e = \funPtr_0 -> RunDriver_Aux (\x_1 -> fmap fromFFIType (hs_bindgen_6520ae39b50ffb4e_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr RunDriver_Aux
+    where toFunPtr = hs_bindgen_d86ecf261d7044c6
+instance FromFunPtr RunDriver_Aux
+    where fromFunPtr = hs_bindgen_6520ae39b50ffb4e
+instance (~) ty (Ptr Driver -> IO CInt) =>
+         HasField "unwrapRunDriver_Aux" RunDriver_Aux ty
+    where hasField = \x_0 -> (\y_1 -> RunDriver_Aux{unwrapRunDriver_Aux = y_1},
+                              getField @"unwrapRunDriver_Aux" x_0)
+instance (~) ty (Ptr Driver -> IO CInt) =>
+         HasField "unwrapRunDriver_Aux" (Ptr RunDriver_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapRunDriver_Aux")
+instance HasCField RunDriver_Aux "unwrapRunDriver_Aux"
+    where type CFieldType RunDriver_Aux
+                          "unwrapRunDriver_Aux" = Ptr Driver -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @RunDriver@
+
+    __defined at:__ @functions\/typedef_funptr.h 12:15@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+newtype RunDriver
+    = RunDriver {unwrapRunDriver :: (FunPtr RunDriver_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr RunDriver_Aux) =>
+         HasField "unwrapRunDriver" RunDriver ty
+    where hasField = \x_0 -> (\y_1 -> RunDriver{unwrapRunDriver = y_1},
+                              getField @"unwrapRunDriver" x_0)
+instance (~) ty (FunPtr RunDriver_Aux) =>
+         HasField "unwrapRunDriver" (Ptr RunDriver) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapRunDriver")
+instance HasCField RunDriver "unwrapRunDriver"
+    where type CFieldType RunDriver
+                          "unwrapRunDriver" = FunPtr RunDriver_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct Driver@
+
+    __defined at:__ @functions\/typedef_funptr.h 13:8@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+data Driver
+    = Driver {driver_run :: RunDriver
+              {- ^ __C declaration:__ @run@
+
+                   __defined at:__ @functions\/typedef_funptr.h 14:13@
+
+                   __exported by:__ @functions\/typedef_funptr.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Driver
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Driver
+    where readRaw = \ptr_0 -> pure Driver <*> readRaw (Proxy @"driver_run") ptr_0
+instance WriteRaw Driver
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Driver driver_run_2 -> writeRaw (Proxy @"driver_run") ptr_0 driver_run_2
+deriving via (EquivStorable Driver) instance Storable Driver
+deriving via (IsStructViaReadRaw Driver) instance IsStruct Driver
+instance (~) ty RunDriver => HasField "driver_run" Driver ty
+    where hasField = \x_0 -> (\y_1 -> Driver{driver_run = y_1},
+                              getField @"driver_run" x_0)
+instance (~) ty RunDriver =>
+         HasField "driver_run" (Ptr Driver) (Ptr ty)
+    where getField = fromPtr (Proxy @"driver_run")
+instance HasCField Driver "driver_run"
+    where type CFieldType Driver "driver_run" = RunDriver
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct Bare@
+
+    __defined at:__ @functions\/typedef_funptr.h 20:8@
+
+    __exported by:__ @functions\/typedef_funptr.h@
+-}
+data Bare
+    = Bare {bare_callback :: (FunPtr (CInt -> IO ()))
+            {- ^ __C declaration:__ @callback@
+
+                 __defined at:__ @functions\/typedef_funptr.h 21:10@
+
+                 __exported by:__ @functions\/typedef_funptr.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bare
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Bare
+    where readRaw = \ptr_0 -> pure Bare <*> readRaw (Proxy @"bare_callback") ptr_0
+instance WriteRaw Bare
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bare bare_callback_2 -> writeRaw (Proxy @"bare_callback") ptr_0 bare_callback_2
+deriving via (EquivStorable Bare) instance Storable Bare
+deriving via (IsStructViaReadRaw Bare) instance IsStruct Bare
+instance (~) ty (FunPtr (CInt -> IO ())) =>
+         HasField "bare_callback" Bare ty
+    where hasField = \x_0 -> (\y_1 -> Bare{bare_callback = y_1},
+                              getField @"bare_callback" x_0)
+instance (~) ty (FunPtr (CInt -> IO ())) =>
+         HasField "bare_callback" (Ptr Bare) (Ptr ty)
+    where getField = fromPtr (Proxy @"bare_callback")
+instance HasCField Bare "bare_callback"
+    where type CFieldType Bare "bare_callback" = FunPtr (CInt -> IO ())
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/functions/varargs/Example/FunPtr.hs b/test-artefacts/fixtures/functions/varargs/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/varargs/Example/FunPtr.hs
@@ -0,0 +1,42 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.h
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/varargs.h>"
+  , "/* test_functionsvarargs_Example_get_h */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d7b5ad93f4d7fa04 (void)) (void)"
+  , "{"
+  , "  return &h;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsvarargs_Example_get_h@
+foreign import ccall unsafe "hs_bindgen_d7b5ad93f4d7fa04" hs_bindgen_d7b5ad93f4d7fa04_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_functionsvarargs_Example_get_h@
+hs_bindgen_d7b5ad93f4d7fa04 :: IO (BG.FunPtr (IO ()))
+hs_bindgen_d7b5ad93f4d7fa04 =
+  fmap BG.fromFFIType hs_bindgen_d7b5ad93f4d7fa04_base
+
+{-# NOINLINE h #-}
+{-| __C declaration:__ @h@
+
+    __defined at:__ @functions\/varargs.h 8:6@
+
+    __exported by:__ @functions\/varargs.h@
+-}
+h :: BG.FunPtr (IO ())
+h = BG.unsafePerformIO hs_bindgen_d7b5ad93f4d7fa04
diff --git a/test-artefacts/fixtures/functions/varargs/Example/Safe.hs b/test-artefacts/fixtures/functions/varargs/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/varargs/Example/Safe.hs
@@ -0,0 +1,38 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.h
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/varargs.h>"
+  , "void hs_bindgen_77a4bac5bbe80f62 (void)"
+  , "{"
+  , "  (h)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsvarargs_Example_Safe_h@
+foreign import ccall safe "hs_bindgen_77a4bac5bbe80f62" hs_bindgen_77a4bac5bbe80f62_base ::
+     IO ()
+
+-- __unique:__ @test_functionsvarargs_Example_Safe_h@
+hs_bindgen_77a4bac5bbe80f62 :: IO ()
+hs_bindgen_77a4bac5bbe80f62 =
+  hs_bindgen_77a4bac5bbe80f62_base
+
+{-| __C declaration:__ @h@
+
+    __defined at:__ @functions\/varargs.h 8:6@
+
+    __exported by:__ @functions\/varargs.h@
+-}
+h :: IO ()
+h = hs_bindgen_77a4bac5bbe80f62
diff --git a/test-artefacts/fixtures/functions/varargs/Example/Unsafe.hs b/test-artefacts/fixtures/functions/varargs/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/varargs/Example/Unsafe.hs
@@ -0,0 +1,38 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.h
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <functions/varargs.h>"
+  , "void hs_bindgen_32ebae80cc3543e1 (void)"
+  , "{"
+  , "  (h)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_functionsvarargs_Example_Unsafe_h@
+foreign import ccall unsafe "hs_bindgen_32ebae80cc3543e1" hs_bindgen_32ebae80cc3543e1_base ::
+     IO ()
+
+-- __unique:__ @test_functionsvarargs_Example_Unsafe_h@
+hs_bindgen_32ebae80cc3543e1 :: IO ()
+hs_bindgen_32ebae80cc3543e1 =
+  hs_bindgen_32ebae80cc3543e1_base
+
+{-| __C declaration:__ @h@
+
+    __defined at:__ @functions\/varargs.h 8:6@
+
+    __exported by:__ @functions\/varargs.h@
+-}
+h :: IO ()
+h = hs_bindgen_32ebae80cc3543e1
diff --git a/test-artefacts/fixtures/functions/varargs/bindingspec.yaml b/test-artefacts/fixtures/functions/varargs/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/varargs/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/functions/varargs/th.txt b/test-artefacts/fixtures/functions/varargs/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/functions/varargs/th.txt
@@ -0,0 +1,82 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stdarg.h
+-- addDependentFile test-artefacts/headers/golden/functions/varargs.h
+-- #include <functions/varargs.h>
+-- void hs_bindgen_77a4bac5bbe80f62 (void)
+-- {
+--   (h)();
+-- }
+-- void hs_bindgen_32ebae80cc3543e1 (void)
+-- {
+--   (h)();
+-- }
+-- /* test_functionsvarargs_Example_get_h */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d7b5ad93f4d7fa04 (void)) (void)
+-- {
+--   return &h;
+-- }
+-- __unique:__ @test_functionsvarargs_Example_Safe_h@
+foreign import ccall safe "hs_bindgen_77a4bac5bbe80f62" hs_bindgen_77a4bac5bbe80f62_base ::
+    IO ()
+-- __unique:__ @test_functionsvarargs_Example_Safe_h@
+hs_bindgen_77a4bac5bbe80f62 :: IO ()
+-- __unique:__ @test_functionsvarargs_Example_Safe_h@
+hs_bindgen_77a4bac5bbe80f62 = hs_bindgen_77a4bac5bbe80f62_base
+{-| __C declaration:__ @h@
+
+    __defined at:__ @functions\/varargs.h 8:6@
+
+    __exported by:__ @functions\/varargs.h@
+-}
+h_safe :: IO ()
+{-| __C declaration:__ @h@
+
+    __defined at:__ @functions\/varargs.h 8:6@
+
+    __exported by:__ @functions\/varargs.h@
+-}
+h_safe = hs_bindgen_77a4bac5bbe80f62
+-- __unique:__ @test_functionsvarargs_Example_Unsafe_h@
+foreign import ccall unsafe "hs_bindgen_32ebae80cc3543e1" hs_bindgen_32ebae80cc3543e1_base ::
+    IO ()
+-- __unique:__ @test_functionsvarargs_Example_Unsafe_h@
+hs_bindgen_32ebae80cc3543e1 :: IO ()
+-- __unique:__ @test_functionsvarargs_Example_Unsafe_h@
+hs_bindgen_32ebae80cc3543e1 = hs_bindgen_32ebae80cc3543e1_base
+{-| __C declaration:__ @h@
+
+    __defined at:__ @functions\/varargs.h 8:6@
+
+    __exported by:__ @functions\/varargs.h@
+-}
+h_unsafe :: IO ()
+{-| __C declaration:__ @h@
+
+    __defined at:__ @functions\/varargs.h 8:6@
+
+    __exported by:__ @functions\/varargs.h@
+-}
+h_unsafe = hs_bindgen_32ebae80cc3543e1
+-- __unique:__ @test_functionsvarargs_Example_get_h@
+foreign import ccall unsafe "hs_bindgen_d7b5ad93f4d7fa04" hs_bindgen_d7b5ad93f4d7fa04_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_functionsvarargs_Example_get_h@
+hs_bindgen_d7b5ad93f4d7fa04 :: IO (FunPtr (IO ()))
+-- __unique:__ @test_functionsvarargs_Example_get_h@
+hs_bindgen_d7b5ad93f4d7fa04 = fmap fromFFIType hs_bindgen_d7b5ad93f4d7fa04_base
+{-# NOINLINE h_funptr #-}
+{-| __C declaration:__ @h@
+
+    __defined at:__ @functions\/varargs.h 8:6@
+
+    __exported by:__ @functions\/varargs.h@
+-}
+h_funptr :: FunPtr (IO ())
+{-| __C declaration:__ @h@
+
+    __defined at:__ @functions\/varargs.h 8:6@
+
+    __exported by:__ @functions\/varargs.h@
+-}
+h_funptr = unsafePerformIO hs_bindgen_d7b5ad93f4d7fa04
diff --git a/test-artefacts/fixtures/globals/globals/Example.hs b/test-artefacts/fixtures/globals/globals/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/globals/globals/Example.hs
@@ -0,0 +1,629 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Config(..)
+    , Example.Inline_struct(..)
+    , Example.Version_t(..)
+    , Example.Struct1_t(..)
+    , Example.Struct2_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct config@
+
+    __defined at:__ @globals\/globals.h 13:8@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Config = Config
+  { config_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @globals\/globals.h 14:7@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  , config_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @globals\/globals.h 15:7@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Config where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Config where
+
+  readRaw =
+    \ptr0 ->
+          pure Config
+      <*> HasCField.readRaw (BG.Proxy @"config_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"config_y") ptr0
+
+instance Marshal.WriteRaw Config where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Config config_x2 config_y3 ->
+               HasCField.writeRaw (BG.Proxy @"config_x") ptr0 config_x2
+            >> HasCField.writeRaw (BG.Proxy @"config_y") ptr0 config_y3
+
+deriving via Marshal.EquivStorable Config instance BG.Storable Config
+
+deriving via Struct.IsStructViaReadRaw Config instance Struct.IsStruct Config
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @globals\/globals.h 14:7@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "config_x" Config ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Config {config_x = y1, config_y = BG.getField @"config_y" x0}
+      , BG.getField @"config_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "config_x" (BG.Ptr Config) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"config_x")
+
+instance HasCField.HasCField Config "config_x" where
+
+  type CFieldType Config "config_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @globals\/globals.h 15:7@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "config_y" Config ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Config {config_y = y1, config_x = BG.getField @"config_x" x0}
+      , BG.getField @"config_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "config_y" (BG.Ptr Config) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"config_y")
+
+instance HasCField.HasCField Config "config_y" where
+
+  type CFieldType Config "config_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct inline_struct@
+
+    __defined at:__ @globals\/globals.h 20:15@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Inline_struct = Inline_struct
+  { inline_struct_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @globals\/globals.h 20:35@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  , inline_struct_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @globals\/globals.h 20:42@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Inline_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Inline_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Inline_struct
+      <*> HasCField.readRaw (BG.Proxy @"inline_struct_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"inline_struct_y") ptr0
+
+instance Marshal.WriteRaw Inline_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Inline_struct inline_struct_x2 inline_struct_y3 ->
+               HasCField.writeRaw (BG.Proxy @"inline_struct_x") ptr0 inline_struct_x2
+            >> HasCField.writeRaw (BG.Proxy @"inline_struct_y") ptr0 inline_struct_y3
+
+deriving via Marshal.EquivStorable Inline_struct instance BG.Storable Inline_struct
+
+deriving via Struct.IsStructViaReadRaw Inline_struct instance Struct.IsStruct Inline_struct
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @globals\/globals.h 20:35@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inline_struct_x" Inline_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Inline_struct {inline_struct_x = y1, inline_struct_y = BG.getField @"inline_struct_y" x0}
+      , BG.getField @"inline_struct_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inline_struct_x" (BG.Ptr Inline_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inline_struct_x")
+
+instance HasCField.HasCField Inline_struct "inline_struct_x" where
+
+  type CFieldType Inline_struct "inline_struct_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @globals\/globals.h 20:42@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inline_struct_y" Inline_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Inline_struct {inline_struct_y = y1, inline_struct_x = BG.getField @"inline_struct_x" x0}
+      , BG.getField @"inline_struct_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inline_struct_y" (BG.Ptr Inline_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inline_struct_y")
+
+instance HasCField.HasCField Inline_struct "inline_struct_y" where
+
+  type CFieldType Inline_struct "inline_struct_y" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct version_t@
+
+    __defined at:__ @globals\/globals.h 407:9@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Version_t = Version_t
+  { version_t_major :: HsBindgen.Runtime.LibC.Word8
+    {- ^ __C declaration:__ @major@
+
+         __defined at:__ @globals\/globals.h 409:12@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  , version_t_minor :: HsBindgen.Runtime.LibC.Word16
+    {- ^ __C declaration:__ @minor@
+
+         __defined at:__ @globals\/globals.h 410:12@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  , version_t_patch :: HsBindgen.Runtime.LibC.Word8
+    {- ^ __C declaration:__ @patch@
+
+         __defined at:__ @globals\/globals.h 411:12@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Version_t where
+
+  staticSizeOf = \_ -> (6 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Version_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Version_t
+      <*> HasCField.readRaw (BG.Proxy @"version_t_major") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"version_t_minor") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"version_t_patch") ptr0
+
+instance Marshal.WriteRaw Version_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Version_t version_t_major2 version_t_minor3 version_t_patch4 ->
+               HasCField.writeRaw (BG.Proxy @"version_t_major") ptr0 version_t_major2
+            >> HasCField.writeRaw (BG.Proxy @"version_t_minor") ptr0 version_t_minor3
+            >> HasCField.writeRaw (BG.Proxy @"version_t_patch") ptr0 version_t_patch4
+
+deriving via Marshal.EquivStorable Version_t instance BG.Storable Version_t
+
+deriving via Struct.IsStructViaReadRaw Version_t instance Struct.IsStruct Version_t
+
+{-| __C declaration:__ @major@
+
+    __defined at:__ @globals\/globals.h 409:12@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "version_t_major" Version_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Version_t { version_t_major = y1
+                    , version_t_minor = BG.getField @"version_t_minor" x0
+                    , version_t_patch = BG.getField @"version_t_patch" x0
+                    }
+      , BG.getField @"version_t_major" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "version_t_major" (BG.Ptr Version_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"version_t_major")
+
+instance HasCField.HasCField Version_t "version_t_major" where
+
+  type CFieldType Version_t "version_t_major" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @minor@
+
+    __defined at:__ @globals\/globals.h 410:12@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.CompatHasField.HasField "version_t_minor" Version_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Version_t { version_t_minor = y1
+                    , version_t_major = BG.getField @"version_t_major" x0
+                    , version_t_patch = BG.getField @"version_t_patch" x0
+                    }
+      , BG.getField @"version_t_minor" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.HasField "version_t_minor" (BG.Ptr Version_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"version_t_minor")
+
+instance HasCField.HasCField Version_t "version_t_minor" where
+
+  type CFieldType Version_t "version_t_minor" =
+    HsBindgen.Runtime.LibC.Word16
+
+  offset# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @patch@
+
+    __defined at:__ @globals\/globals.h 411:12@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "version_t_patch" Version_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Version_t { version_t_patch = y1
+                    , version_t_major = BG.getField @"version_t_major" x0
+                    , version_t_minor = BG.getField @"version_t_minor" x0
+                    }
+      , BG.getField @"version_t_patch" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "version_t_patch" (BG.Ptr Version_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"version_t_patch")
+
+instance HasCField.HasCField Version_t "version_t_patch" where
+
+  type CFieldType Version_t "version_t_patch" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct struct1_t@
+
+    __defined at:__ @globals\/globals.h 414:9@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Struct1_t = Struct1_t
+  { struct1_t_x :: HsBindgen.Runtime.LibC.Word16
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @globals\/globals.h 416:13@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  , struct1_t_y :: BG.CBool
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @globals\/globals.h 417:13@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  , struct1_t_version :: Version_t
+    {- ^ __C declaration:__ @version@
+
+         __defined at:__ @globals\/globals.h 418:13@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct1_t where
+
+  staticSizeOf = \_ -> (10 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Struct1_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct1_t
+      <*> HasCField.readRaw (BG.Proxy @"struct1_t_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"struct1_t_y") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"struct1_t_version") ptr0
+
+instance Marshal.WriteRaw Struct1_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct1_t struct1_t_x2 struct1_t_y3 struct1_t_version4 ->
+               HasCField.writeRaw (BG.Proxy @"struct1_t_x") ptr0 struct1_t_x2
+            >> HasCField.writeRaw (BG.Proxy @"struct1_t_y") ptr0 struct1_t_y3
+            >> HasCField.writeRaw (BG.Proxy @"struct1_t_version") ptr0 struct1_t_version4
+
+deriving via Marshal.EquivStorable Struct1_t instance BG.Storable Struct1_t
+
+deriving via Struct.IsStructViaReadRaw Struct1_t instance Struct.IsStruct Struct1_t
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @globals\/globals.h 416:13@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.CompatHasField.HasField "struct1_t_x" Struct1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Struct1_t { struct1_t_x = y1
+                    , struct1_t_y = BG.getField @"struct1_t_y" x0
+                    , struct1_t_version = BG.getField @"struct1_t_version" x0
+                    }
+      , BG.getField @"struct1_t_x" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.HasField "struct1_t_x" (BG.Ptr Struct1_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"struct1_t_x")
+
+instance HasCField.HasCField Struct1_t "struct1_t_x" where
+
+  type CFieldType Struct1_t "struct1_t_x" =
+    HsBindgen.Runtime.LibC.Word16
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @globals\/globals.h 417:13@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "struct1_t_y" Struct1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Struct1_t { struct1_t_y = y1
+                    , struct1_t_x = BG.getField @"struct1_t_x" x0
+                    , struct1_t_version = BG.getField @"struct1_t_version" x0
+                    }
+      , BG.getField @"struct1_t_y" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "struct1_t_y" (BG.Ptr Struct1_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"struct1_t_y")
+
+instance HasCField.HasCField Struct1_t "struct1_t_y" where
+
+  type CFieldType Struct1_t "struct1_t_y" = BG.CBool
+
+  offset# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @version@
+
+    __defined at:__ @globals\/globals.h 418:13@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance ( ty ~ Version_t
+         ) => BG.CompatHasField.HasField "struct1_t_version" Struct1_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Struct1_t { struct1_t_version = y1
+                    , struct1_t_x = BG.getField @"struct1_t_x" x0
+                    , struct1_t_y = BG.getField @"struct1_t_y" x0
+                    }
+      , BG.getField @"struct1_t_version" x0
+      )
+
+instance ( ty ~ Version_t
+         ) => BG.HasField "struct1_t_version" (BG.Ptr Struct1_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"struct1_t_version")
+
+instance HasCField.HasCField Struct1_t "struct1_t_version" where
+
+  type CFieldType Struct1_t "struct1_t_version" =
+    Version_t
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct struct2_t@
+
+    __defined at:__ @globals\/globals.h 421:9@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Struct2_t = Struct2_t
+  { struct2_t_field1 :: Struct1_t
+    {- ^ __C declaration:__ @field1@
+
+         __defined at:__ @globals\/globals.h 423:13@
+
+         __exported by:__ @globals\/globals.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct2_t where
+
+  staticSizeOf = \_ -> (10 :: Int)
+
+  staticAlignment = \_ -> (2 :: Int)
+
+instance Marshal.ReadRaw Struct2_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct2_t
+      <*> HasCField.readRaw (BG.Proxy @"struct2_t_field1") ptr0
+
+instance Marshal.WriteRaw Struct2_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct2_t struct2_t_field12 ->
+            HasCField.writeRaw (BG.Proxy @"struct2_t_field1") ptr0 struct2_t_field12
+
+deriving via Marshal.EquivStorable Struct2_t instance BG.Storable Struct2_t
+
+deriving via Struct.IsStructViaReadRaw Struct2_t instance Struct.IsStruct Struct2_t
+
+{-| __C declaration:__ @field1@
+
+    __defined at:__ @globals\/globals.h 423:13@
+
+    __exported by:__ @globals\/globals.h@
+-}
+instance ( ty ~ Struct1_t
+         ) => BG.CompatHasField.HasField "struct2_t_field1" Struct2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Struct2_t {struct2_t_field1 = y1}
+      , BG.getField @"struct2_t_field1" x0
+      )
+
+instance ( ty ~ Struct1_t
+         ) => BG.HasField "struct2_t_field1" (BG.Ptr Struct2_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"struct2_t_field1")
+
+instance HasCField.HasCField Struct2_t "struct2_t_field1" where
+
+  type CFieldType Struct2_t "struct2_t_field1" =
+    Struct1_t
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/globals/globals/Example/Global.hs b/test-artefacts/fixtures/globals/globals/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/globals/globals/Example/Global.hs
@@ -0,0 +1,570 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.simpleGlobal
+    , Example.Global.compoundGlobal1
+    , Example.Global.compoundGlobal2
+    , Example.Global.nesInteger
+    , Example.Global.nesFloating
+    , Example.Global.nesImaginary
+    , Example.Global.nesString1
+    , Example.Global.nesString2
+    , Example.Global.nesCharacter
+    , Example.Global.nesParen
+    , Example.Global.nesUnary
+    , Example.Global.nesBinary
+    , Example.Global.nesConditional
+    , Example.Global.nesCast
+    , Example.Global.nesCompound
+    , Example.Global.nesInitList
+    , Example.Global.nesBool
+    , Example.Global.streamBinary
+    , Example.Global.streamBinary_len
+    , Example.Global.some_global_struct
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <globals/globals.h>"
+  , "/* test_globalsglobals_Example_get_simpleGlobal */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_4f8e7b3d91414aa8 (void)"
+  , "{"
+  , "  return &simpleGlobal;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_compoundGlobal1 */"
+  , "__attribute__ ((const))"
+  , "struct config *hs_bindgen_7f4cd619c55119dd (void)"
+  , "{"
+  , "  return &compoundGlobal1;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_compoundGlobal2 */"
+  , "__attribute__ ((const))"
+  , "struct inline_struct *hs_bindgen_ed5c7196c3291592 (void)"
+  , "{"
+  , "  return &compoundGlobal2;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesInteger */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_0be07820afb78239 (void)"
+  , "{"
+  , "  return &nesInteger;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesFloating */"
+  , "__attribute__ ((const))"
+  , "float *hs_bindgen_e3497c0a80a77750 (void)"
+  , "{"
+  , "  return &nesFloating;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesImaginary */"
+  , "__attribute__ ((const))"
+  , "double _Complex *hs_bindgen_e958634c96270349 (void)"
+  , "{"
+  , "  return &nesImaginary;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesString1 */"
+  , "__attribute__ ((const))"
+  , "char **hs_bindgen_78918168bc760476 (void)"
+  , "{"
+  , "  return &nesString1;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesString2 */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_c6c52463f890e752 (void))[3]"
+  , "{"
+  , "  return &nesString2;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesCharacter */"
+  , "__attribute__ ((const))"
+  , "char *hs_bindgen_9b33d990c25069a0 (void)"
+  , "{"
+  , "  return &nesCharacter;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesParen */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_561a1d5a05307329 (void)"
+  , "{"
+  , "  return &nesParen;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesUnary */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_4d3d64def4cf943f (void)"
+  , "{"
+  , "  return &nesUnary;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesBinary */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_dcb8301e1cb444b7 (void)"
+  , "{"
+  , "  return &nesBinary;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesConditional */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_798d6b9c7136a5d0 (void)"
+  , "{"
+  , "  return &nesConditional;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesCast */"
+  , "__attribute__ ((const))"
+  , "float *hs_bindgen_9c15dc9805f8abb8 (void)"
+  , "{"
+  , "  return &nesCast;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesCompound */"
+  , "__attribute__ ((const))"
+  , "signed int **hs_bindgen_089dfddcc6667ac2 (void)"
+  , "{"
+  , "  return &nesCompound;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesInitList */"
+  , "__attribute__ ((const))"
+  , "uint8_t (*hs_bindgen_798af9a98bfc3030 (void))[4]"
+  , "{"
+  , "  return &nesInitList;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_nesBool */"
+  , "__attribute__ ((const))"
+  , "_Bool *hs_bindgen_846b0fde4d102012 (void)"
+  , "{"
+  , "  return &nesBool;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_streamBinary */"
+  , "__attribute__ ((const))"
+  , "uint8_t (*hs_bindgen_b243f9b292f8b883 (void))[4096]"
+  , "{"
+  , "  return &streamBinary;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_streamBinary_len */"
+  , "__attribute__ ((const))"
+  , "uint32_t *hs_bindgen_60adad2a6178e6cc (void)"
+  , "{"
+  , "  return &streamBinary_len;"
+  , "}"
+  , "/* test_globalsglobals_Example_get_some_global_struct */"
+  , "__attribute__ ((const))"
+  , "struct2_t *hs_bindgen_fe50ca9a4fea641c (void)"
+  , "{"
+  , "  return &some_global_struct;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_globalsglobals_Example_get_simpleGlobal@
+foreign import ccall unsafe "hs_bindgen_4f8e7b3d91414aa8" hs_bindgen_4f8e7b3d91414aa8_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_simpleGlobal@
+hs_bindgen_4f8e7b3d91414aa8 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_4f8e7b3d91414aa8 =
+  fmap BG.fromFFIType hs_bindgen_4f8e7b3d91414aa8_base
+
+{-# NOINLINE simpleGlobal #-}
+{-| __C declaration:__ @simpleGlobal@
+
+    __defined at:__ @globals\/globals.h 10:12@
+
+    __exported by:__ @globals\/globals.h@
+-}
+simpleGlobal :: BG.Ptr BG.CInt
+simpleGlobal =
+  BG.unsafePerformIO hs_bindgen_4f8e7b3d91414aa8
+
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal1@
+foreign import ccall unsafe "hs_bindgen_7f4cd619c55119dd" hs_bindgen_7f4cd619c55119dd_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal1@
+hs_bindgen_7f4cd619c55119dd :: IO (BG.Ptr Config)
+hs_bindgen_7f4cd619c55119dd =
+  fmap BG.fromFFIType hs_bindgen_7f4cd619c55119dd_base
+
+{-# NOINLINE compoundGlobal1 #-}
+{-| __C declaration:__ @compoundGlobal1@
+
+    __defined at:__ @globals\/globals.h 17:22@
+
+    __exported by:__ @globals\/globals.h@
+-}
+compoundGlobal1 :: BG.Ptr Config
+compoundGlobal1 =
+  BG.unsafePerformIO hs_bindgen_7f4cd619c55119dd
+
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal2@
+foreign import ccall unsafe "hs_bindgen_ed5c7196c3291592" hs_bindgen_ed5c7196c3291592_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal2@
+hs_bindgen_ed5c7196c3291592 :: IO (BG.Ptr Inline_struct)
+hs_bindgen_ed5c7196c3291592 =
+  fmap BG.fromFFIType hs_bindgen_ed5c7196c3291592_base
+
+{-# NOINLINE compoundGlobal2 #-}
+{-| __C declaration:__ @compoundGlobal2@
+
+    __defined at:__ @globals\/globals.h 20:47@
+
+    __exported by:__ @globals\/globals.h@
+-}
+compoundGlobal2 :: BG.Ptr Inline_struct
+compoundGlobal2 =
+  BG.unsafePerformIO hs_bindgen_ed5c7196c3291592
+
+-- __unique:__ @test_globalsglobals_Example_get_nesInteger@
+foreign import ccall unsafe "hs_bindgen_0be07820afb78239" hs_bindgen_0be07820afb78239_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesInteger@
+hs_bindgen_0be07820afb78239 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_0be07820afb78239 =
+  fmap BG.fromFFIType hs_bindgen_0be07820afb78239_base
+
+{-# NOINLINE nesInteger #-}
+{-| Non-extern non-static global variables
+
+    These kinds of variables need to be treated with care, to avoid duplicate symbols, but do exist in the wild.
+
+    We test with various kinds of initializers as we must explicitly ignore them in our parser. The list here roughly follows the definition of @CXCursor@ [1](https://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d470913f9ef0013) , starting at @CXCursor_IntegerLiteral@ ; see also definition of 'varDecl' in @HsBindgen.Frontend.Pass.Parse.Decl@ .
+
+    __C declaration:__ @nesInteger@
+
+    __defined at:__ @globals\/globals.h 36:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesInteger :: BG.Ptr BG.CInt
+nesInteger =
+  BG.unsafePerformIO hs_bindgen_0be07820afb78239
+
+-- __unique:__ @test_globalsglobals_Example_get_nesFloating@
+foreign import ccall unsafe "hs_bindgen_e3497c0a80a77750" hs_bindgen_e3497c0a80a77750_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesFloating@
+hs_bindgen_e3497c0a80a77750 :: IO (BG.Ptr BG.CFloat)
+hs_bindgen_e3497c0a80a77750 =
+  fmap BG.fromFFIType hs_bindgen_e3497c0a80a77750_base
+
+{-# NOINLINE nesFloating #-}
+{-| __C declaration:__ @nesFloating@
+
+    __defined at:__ @globals\/globals.h 37:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesFloating :: BG.Ptr BG.CFloat
+nesFloating =
+  BG.unsafePerformIO hs_bindgen_e3497c0a80a77750
+
+-- __unique:__ @test_globalsglobals_Example_get_nesImaginary@
+foreign import ccall unsafe "hs_bindgen_e958634c96270349" hs_bindgen_e958634c96270349_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesImaginary@
+hs_bindgen_e958634c96270349 :: IO (BG.Ptr (BG.Complex BG.CDouble))
+hs_bindgen_e958634c96270349 =
+  fmap BG.fromFFIType hs_bindgen_e958634c96270349_base
+
+{-# NOINLINE nesImaginary #-}
+{-| __C declaration:__ @nesImaginary@
+
+    __defined at:__ @globals\/globals.h 38:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesImaginary :: BG.Ptr (BG.Complex BG.CDouble)
+nesImaginary =
+  BG.unsafePerformIO hs_bindgen_e958634c96270349
+
+-- __unique:__ @test_globalsglobals_Example_get_nesString1@
+foreign import ccall unsafe "hs_bindgen_78918168bc760476" hs_bindgen_78918168bc760476_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesString1@
+hs_bindgen_78918168bc760476 :: IO (BG.Ptr (BG.Ptr BG.CChar))
+hs_bindgen_78918168bc760476 =
+  fmap BG.fromFFIType hs_bindgen_78918168bc760476_base
+
+{-# NOINLINE nesString1 #-}
+{-| __C declaration:__ @nesString1@
+
+    __defined at:__ @globals\/globals.h 39:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesString1 :: BG.Ptr (BG.Ptr BG.CChar)
+nesString1 =
+  BG.unsafePerformIO hs_bindgen_78918168bc760476
+
+-- __unique:__ @test_globalsglobals_Example_get_nesString2@
+foreign import ccall unsafe "hs_bindgen_c6c52463f890e752" hs_bindgen_c6c52463f890e752_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesString2@
+hs_bindgen_c6c52463f890e752 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CChar))
+hs_bindgen_c6c52463f890e752 =
+  fmap BG.fromFFIType hs_bindgen_c6c52463f890e752_base
+
+{-# NOINLINE nesString2 #-}
+{-| __C declaration:__ @nesString2@
+
+    __defined at:__ @globals\/globals.h 40:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesString2 :: BG.Ptr (CA.ConstantArray 3 BG.CChar)
+nesString2 =
+  BG.unsafePerformIO hs_bindgen_c6c52463f890e752
+
+-- __unique:__ @test_globalsglobals_Example_get_nesCharacter@
+foreign import ccall unsafe "hs_bindgen_9b33d990c25069a0" hs_bindgen_9b33d990c25069a0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesCharacter@
+hs_bindgen_9b33d990c25069a0 :: IO (BG.Ptr BG.CChar)
+hs_bindgen_9b33d990c25069a0 =
+  fmap BG.fromFFIType hs_bindgen_9b33d990c25069a0_base
+
+{-# NOINLINE nesCharacter #-}
+{-| __C declaration:__ @nesCharacter@
+
+    __defined at:__ @globals\/globals.h 41:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesCharacter :: BG.Ptr BG.CChar
+nesCharacter =
+  BG.unsafePerformIO hs_bindgen_9b33d990c25069a0
+
+-- __unique:__ @test_globalsglobals_Example_get_nesParen@
+foreign import ccall unsafe "hs_bindgen_561a1d5a05307329" hs_bindgen_561a1d5a05307329_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesParen@
+hs_bindgen_561a1d5a05307329 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_561a1d5a05307329 =
+  fmap BG.fromFFIType hs_bindgen_561a1d5a05307329_base
+
+{-# NOINLINE nesParen #-}
+{-| __C declaration:__ @nesParen@
+
+    __defined at:__ @globals\/globals.h 42:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesParen :: BG.Ptr BG.CInt
+nesParen =
+  BG.unsafePerformIO hs_bindgen_561a1d5a05307329
+
+-- __unique:__ @test_globalsglobals_Example_get_nesUnary@
+foreign import ccall unsafe "hs_bindgen_4d3d64def4cf943f" hs_bindgen_4d3d64def4cf943f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesUnary@
+hs_bindgen_4d3d64def4cf943f :: IO (BG.Ptr BG.CInt)
+hs_bindgen_4d3d64def4cf943f =
+  fmap BG.fromFFIType hs_bindgen_4d3d64def4cf943f_base
+
+{-# NOINLINE nesUnary #-}
+{-| __C declaration:__ @nesUnary@
+
+    __defined at:__ @globals\/globals.h 43:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesUnary :: BG.Ptr BG.CInt
+nesUnary =
+  BG.unsafePerformIO hs_bindgen_4d3d64def4cf943f
+
+-- __unique:__ @test_globalsglobals_Example_get_nesBinary@
+foreign import ccall unsafe "hs_bindgen_dcb8301e1cb444b7" hs_bindgen_dcb8301e1cb444b7_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesBinary@
+hs_bindgen_dcb8301e1cb444b7 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_dcb8301e1cb444b7 =
+  fmap BG.fromFFIType hs_bindgen_dcb8301e1cb444b7_base
+
+{-# NOINLINE nesBinary #-}
+{-| __C declaration:__ @nesBinary@
+
+    __defined at:__ @globals\/globals.h 44:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesBinary :: BG.Ptr BG.CInt
+nesBinary =
+  BG.unsafePerformIO hs_bindgen_dcb8301e1cb444b7
+
+-- __unique:__ @test_globalsglobals_Example_get_nesConditional@
+foreign import ccall unsafe "hs_bindgen_798d6b9c7136a5d0" hs_bindgen_798d6b9c7136a5d0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesConditional@
+hs_bindgen_798d6b9c7136a5d0 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_798d6b9c7136a5d0 =
+  fmap BG.fromFFIType hs_bindgen_798d6b9c7136a5d0_base
+
+{-# NOINLINE nesConditional #-}
+{-| __C declaration:__ @nesConditional@
+
+    __defined at:__ @globals\/globals.h 45:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesConditional :: BG.Ptr BG.CInt
+nesConditional =
+  BG.unsafePerformIO hs_bindgen_798d6b9c7136a5d0
+
+-- __unique:__ @test_globalsglobals_Example_get_nesCast@
+foreign import ccall unsafe "hs_bindgen_9c15dc9805f8abb8" hs_bindgen_9c15dc9805f8abb8_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesCast@
+hs_bindgen_9c15dc9805f8abb8 :: IO (BG.Ptr BG.CFloat)
+hs_bindgen_9c15dc9805f8abb8 =
+  fmap BG.fromFFIType hs_bindgen_9c15dc9805f8abb8_base
+
+{-# NOINLINE nesCast #-}
+{-| __C declaration:__ @nesCast@
+
+    __defined at:__ @globals\/globals.h 46:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesCast :: BG.Ptr BG.CFloat
+nesCast =
+  BG.unsafePerformIO hs_bindgen_9c15dc9805f8abb8
+
+-- __unique:__ @test_globalsglobals_Example_get_nesCompound@
+foreign import ccall unsafe "hs_bindgen_089dfddcc6667ac2" hs_bindgen_089dfddcc6667ac2_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesCompound@
+hs_bindgen_089dfddcc6667ac2 :: IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_089dfddcc6667ac2 =
+  fmap BG.fromFFIType hs_bindgen_089dfddcc6667ac2_base
+
+{-# NOINLINE nesCompound #-}
+{-| __C declaration:__ @nesCompound@
+
+    __defined at:__ @globals\/globals.h 47:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesCompound :: BG.Ptr (BG.Ptr BG.CInt)
+nesCompound =
+  BG.unsafePerformIO hs_bindgen_089dfddcc6667ac2
+
+-- __unique:__ @test_globalsglobals_Example_get_nesInitList@
+foreign import ccall unsafe "hs_bindgen_798af9a98bfc3030" hs_bindgen_798af9a98bfc3030_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesInitList@
+hs_bindgen_798af9a98bfc3030 :: IO (BG.Ptr (CA.ConstantArray 4 HsBindgen.Runtime.LibC.Word8))
+hs_bindgen_798af9a98bfc3030 =
+  fmap BG.fromFFIType hs_bindgen_798af9a98bfc3030_base
+
+{-# NOINLINE nesInitList #-}
+{-| __C declaration:__ @nesInitList@
+
+    __defined at:__ @globals\/globals.h 48:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesInitList :: BG.Ptr (CA.ConstantArray 4 HsBindgen.Runtime.LibC.Word8)
+nesInitList =
+  BG.unsafePerformIO hs_bindgen_798af9a98bfc3030
+
+-- __unique:__ @test_globalsglobals_Example_get_nesBool@
+foreign import ccall unsafe "hs_bindgen_846b0fde4d102012" hs_bindgen_846b0fde4d102012_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_nesBool@
+hs_bindgen_846b0fde4d102012 :: IO (BG.Ptr BG.CBool)
+hs_bindgen_846b0fde4d102012 =
+  fmap BG.fromFFIType hs_bindgen_846b0fde4d102012_base
+
+{-# NOINLINE nesBool #-}
+{-| __C declaration:__ @nesBool@
+
+    __defined at:__ @globals\/globals.h 49:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesBool :: BG.Ptr BG.CBool
+nesBool =
+  BG.unsafePerformIO hs_bindgen_846b0fde4d102012
+
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary@
+foreign import ccall unsafe "hs_bindgen_b243f9b292f8b883" hs_bindgen_b243f9b292f8b883_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary@
+hs_bindgen_b243f9b292f8b883 :: IO (BG.Ptr (CA.ConstantArray 4096 HsBindgen.Runtime.LibC.Word8))
+hs_bindgen_b243f9b292f8b883 =
+  fmap BG.fromFFIType hs_bindgen_b243f9b292f8b883_base
+
+{-# NOINLINE streamBinary #-}
+{-| Additional examples of global variables, abstracted from real examples
+
+    The @'streamBinary'@ / @'streamBinary_len'@ example comes from [1](https://github.com/analogdevicesinc/no-OS/blob/855c4b3c34f2297865e448661ba4fcc0931bf430/drivers/rf-transceiver/talise/firmware/talise_stream_binary.h#L322-L325) , and is an example of a non-extern non-static global (indeed, the header does not even use @pragma once@ or similar).
+
+    __C declaration:__ @streamBinary@
+
+    __defined at:__ @globals\/globals.h 61:9@
+
+    __exported by:__ @globals\/globals.h@
+-}
+streamBinary :: BG.Ptr (CA.ConstantArray 4096 HsBindgen.Runtime.LibC.Word8)
+streamBinary =
+  BG.unsafePerformIO hs_bindgen_b243f9b292f8b883
+
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary_len@
+foreign import ccall unsafe "hs_bindgen_60adad2a6178e6cc" hs_bindgen_60adad2a6178e6cc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary_len@
+hs_bindgen_60adad2a6178e6cc :: IO (BG.Ptr HsBindgen.Runtime.LibC.Word32)
+hs_bindgen_60adad2a6178e6cc =
+  fmap BG.fromFFIType hs_bindgen_60adad2a6178e6cc_base
+
+{-# NOINLINE streamBinary_len #-}
+{-| __C declaration:__ @streamBinary_len@
+
+    __defined at:__ @globals\/globals.h 405:10@
+
+    __exported by:__ @globals\/globals.h@
+-}
+streamBinary_len :: BG.Ptr HsBindgen.Runtime.LibC.Word32
+streamBinary_len =
+  BG.unsafePerformIO hs_bindgen_60adad2a6178e6cc
+
+-- __unique:__ @test_globalsglobals_Example_get_some_global_struct@
+foreign import ccall unsafe "hs_bindgen_fe50ca9a4fea641c" hs_bindgen_fe50ca9a4fea641c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsglobals_Example_get_some_global_struct@
+hs_bindgen_fe50ca9a4fea641c :: IO (BG.Ptr Struct2_t)
+hs_bindgen_fe50ca9a4fea641c =
+  fmap BG.fromFFIType hs_bindgen_fe50ca9a4fea641c_base
+
+{-# NOINLINE some_global_struct #-}
+{-| __C declaration:__ @some_global_struct@
+
+    __defined at:__ @globals\/globals.h 426:11@
+
+    __exported by:__ @globals\/globals.h@
+-}
+some_global_struct :: BG.Ptr Struct2_t
+some_global_struct =
+  BG.unsafePerformIO hs_bindgen_fe50ca9a4fea641c
diff --git a/test-artefacts/fixtures/globals/globals/bindingspec.yaml b/test-artefacts/fixtures/globals/globals/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/globals/globals/bindingspec.yaml
@@ -0,0 +1,131 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: globals/globals.h
+  cname: struct config
+  hsname: Config
+- headers: globals/globals.h
+  cname: struct inline_struct
+  hsname: Inline_struct
+- headers: globals/globals.h
+  cname: struct version_t
+  hsname: Version_t
+- headers: globals/globals.h
+  cname: version_t
+  hsname: Version_t
+- headers: globals/globals.h
+  cname: struct struct1_t
+  hsname: Struct1_t
+- headers: globals/globals.h
+  cname: struct1_t
+  hsname: Struct1_t
+- headers: globals/globals.h
+  cname: struct struct2_t
+  hsname: Struct2_t
+- headers: globals/globals.h
+  cname: struct2_t
+  hsname: Struct2_t
+hstypes:
+- hsname: Config
+  representation:
+    record:
+      constructor: Config
+      fields:
+      - config_x
+      - config_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Inline_struct
+  representation:
+    record:
+      constructor: Inline_struct
+      fields:
+      - inline_struct_x
+      - inline_struct_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct1_t
+  representation:
+    record:
+      constructor: Struct1_t
+      fields:
+      - struct1_t_x
+      - struct1_t_y
+      - struct1_t_version
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct2_t
+  representation:
+    record:
+      constructor: Struct2_t
+      fields:
+      - struct2_t_field1
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Version_t
+  representation:
+    record:
+      constructor: Version_t
+      fields:
+      - version_t_major
+      - version_t_minor
+      - version_t_patch
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/globals/globals/th.txt b/test-artefacts/fixtures/globals/globals/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/globals/globals/th.txt
@@ -0,0 +1,886 @@
+-- addDependentFile musl-include/x86_64/complex.h
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile musl-include/x86_64/stdbool.h
+-- addDependentFile test-artefacts/headers/golden/globals/globals.h
+-- #include <globals/globals.h>
+-- /* test_globalsglobals_Example_get_simpleGlobal */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_4f8e7b3d91414aa8 (void)
+-- {
+--   return &simpleGlobal;
+-- }
+-- /* test_globalsglobals_Example_get_compoundGlobal1 */
+-- __attribute__ ((const))
+-- struct config *hs_bindgen_7f4cd619c55119dd (void)
+-- {
+--   return &compoundGlobal1;
+-- }
+-- /* test_globalsglobals_Example_get_compoundGlobal2 */
+-- __attribute__ ((const))
+-- struct inline_struct *hs_bindgen_ed5c7196c3291592 (void)
+-- {
+--   return &compoundGlobal2;
+-- }
+-- /* test_globalsglobals_Example_get_nesInteger */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_0be07820afb78239 (void)
+-- {
+--   return &nesInteger;
+-- }
+-- /* test_globalsglobals_Example_get_nesFloating */
+-- __attribute__ ((const))
+-- float *hs_bindgen_e3497c0a80a77750 (void)
+-- {
+--   return &nesFloating;
+-- }
+-- /* test_globalsglobals_Example_get_nesImaginary */
+-- __attribute__ ((const))
+-- double _Complex *hs_bindgen_e958634c96270349 (void)
+-- {
+--   return &nesImaginary;
+-- }
+-- /* test_globalsglobals_Example_get_nesString1 */
+-- __attribute__ ((const))
+-- char **hs_bindgen_78918168bc760476 (void)
+-- {
+--   return &nesString1;
+-- }
+-- /* test_globalsglobals_Example_get_nesString2 */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_c6c52463f890e752 (void))[3]
+-- {
+--   return &nesString2;
+-- }
+-- /* test_globalsglobals_Example_get_nesCharacter */
+-- __attribute__ ((const))
+-- char *hs_bindgen_9b33d990c25069a0 (void)
+-- {
+--   return &nesCharacter;
+-- }
+-- /* test_globalsglobals_Example_get_nesParen */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_561a1d5a05307329 (void)
+-- {
+--   return &nesParen;
+-- }
+-- /* test_globalsglobals_Example_get_nesUnary */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_4d3d64def4cf943f (void)
+-- {
+--   return &nesUnary;
+-- }
+-- /* test_globalsglobals_Example_get_nesBinary */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_dcb8301e1cb444b7 (void)
+-- {
+--   return &nesBinary;
+-- }
+-- /* test_globalsglobals_Example_get_nesConditional */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_798d6b9c7136a5d0 (void)
+-- {
+--   return &nesConditional;
+-- }
+-- /* test_globalsglobals_Example_get_nesCast */
+-- __attribute__ ((const))
+-- float *hs_bindgen_9c15dc9805f8abb8 (void)
+-- {
+--   return &nesCast;
+-- }
+-- /* test_globalsglobals_Example_get_nesCompound */
+-- __attribute__ ((const))
+-- signed int **hs_bindgen_089dfddcc6667ac2 (void)
+-- {
+--   return &nesCompound;
+-- }
+-- /* test_globalsglobals_Example_get_nesInitList */
+-- __attribute__ ((const))
+-- uint8_t (*hs_bindgen_798af9a98bfc3030 (void))[4]
+-- {
+--   return &nesInitList;
+-- }
+-- /* test_globalsglobals_Example_get_nesBool */
+-- __attribute__ ((const))
+-- _Bool *hs_bindgen_846b0fde4d102012 (void)
+-- {
+--   return &nesBool;
+-- }
+-- /* test_globalsglobals_Example_get_streamBinary */
+-- __attribute__ ((const))
+-- uint8_t (*hs_bindgen_b243f9b292f8b883 (void))[4096]
+-- {
+--   return &streamBinary;
+-- }
+-- /* test_globalsglobals_Example_get_streamBinary_len */
+-- __attribute__ ((const))
+-- uint32_t *hs_bindgen_60adad2a6178e6cc (void)
+-- {
+--   return &streamBinary_len;
+-- }
+-- /* test_globalsglobals_Example_get_some_global_struct */
+-- __attribute__ ((const))
+-- struct2_t *hs_bindgen_fe50ca9a4fea641c (void)
+-- {
+--   return &some_global_struct;
+-- }
+{-| __C declaration:__ @struct config@
+
+    __defined at:__ @globals\/globals.h 13:8@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Config
+    = Config {config_x :: CInt
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @globals\/globals.h 14:7@
+
+                   __exported by:__ @globals\/globals.h@
+              -},
+              config_y :: CInt
+              {- ^ __C declaration:__ @y@
+
+                   __defined at:__ @globals\/globals.h 15:7@
+
+                   __exported by:__ @globals\/globals.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Config
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Config
+    where readRaw = \ptr_0 -> (pure Config <*> readRaw (Proxy @"config_x") ptr_0) <*> readRaw (Proxy @"config_y") ptr_0
+instance WriteRaw Config
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Config config_x_2
+                                              config_y_3 -> writeRaw (Proxy @"config_x") ptr_0 config_x_2 >> writeRaw (Proxy @"config_y") ptr_0 config_y_3
+deriving via (EquivStorable Config) instance Storable Config
+deriving via (IsStructViaReadRaw Config) instance IsStruct Config
+instance (~) ty CInt => HasField "config_x" Config ty
+    where hasField = \x_0 -> (\y_1 -> Config{config_x = y_1,
+                                             config_y = getField @"config_y" x_0},
+                              getField @"config_x" x_0)
+instance (~) ty CInt => HasField "config_x" (Ptr Config) (Ptr ty)
+    where getField = fromPtr (Proxy @"config_x")
+instance HasCField Config "config_x"
+    where type CFieldType Config "config_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "config_y" Config ty
+    where hasField = \x_0 -> (\y_1 -> Config{config_y = y_1,
+                                             config_x = getField @"config_x" x_0},
+                              getField @"config_y" x_0)
+instance (~) ty CInt => HasField "config_y" (Ptr Config) (Ptr ty)
+    where getField = fromPtr (Proxy @"config_y")
+instance HasCField Config "config_y"
+    where type CFieldType Config "config_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct inline_struct@
+
+    __defined at:__ @globals\/globals.h 20:15@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Inline_struct
+    = Inline_struct {inline_struct_x :: CInt
+                     {- ^ __C declaration:__ @x@
+
+                          __defined at:__ @globals\/globals.h 20:35@
+
+                          __exported by:__ @globals\/globals.h@
+                     -},
+                     inline_struct_y :: CInt
+                     {- ^ __C declaration:__ @y@
+
+                          __defined at:__ @globals\/globals.h 20:42@
+
+                          __exported by:__ @globals\/globals.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Inline_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Inline_struct
+    where readRaw = \ptr_0 -> (pure Inline_struct <*> readRaw (Proxy @"inline_struct_x") ptr_0) <*> readRaw (Proxy @"inline_struct_y") ptr_0
+instance WriteRaw Inline_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Inline_struct inline_struct_x_2
+                                                     inline_struct_y_3 -> writeRaw (Proxy @"inline_struct_x") ptr_0 inline_struct_x_2 >> writeRaw (Proxy @"inline_struct_y") ptr_0 inline_struct_y_3
+deriving via (EquivStorable Inline_struct) instance Storable Inline_struct
+deriving via (IsStructViaReadRaw Inline_struct) instance IsStruct Inline_struct
+instance (~) ty CInt => HasField "inline_struct_x" Inline_struct ty
+    where hasField = \x_0 -> (\y_1 -> Inline_struct{inline_struct_x = y_1,
+                                                    inline_struct_y = getField @"inline_struct_y" x_0},
+                              getField @"inline_struct_x" x_0)
+instance (~) ty CInt =>
+         HasField "inline_struct_x" (Ptr Inline_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"inline_struct_x")
+instance HasCField Inline_struct "inline_struct_x"
+    where type CFieldType Inline_struct "inline_struct_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "inline_struct_y" Inline_struct ty
+    where hasField = \x_0 -> (\y_1 -> Inline_struct{inline_struct_y = y_1,
+                                                    inline_struct_x = getField @"inline_struct_x" x_0},
+                              getField @"inline_struct_y" x_0)
+instance (~) ty CInt =>
+         HasField "inline_struct_y" (Ptr Inline_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"inline_struct_y")
+instance HasCField Inline_struct "inline_struct_y"
+    where type CFieldType Inline_struct "inline_struct_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct version_t@
+
+    __defined at:__ @globals\/globals.h 407:9@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Version_t
+    = Version_t {version_t_major :: HsBindgen.Runtime.LibC.Word8
+                 {- ^ __C declaration:__ @major@
+
+                      __defined at:__ @globals\/globals.h 409:12@
+
+                      __exported by:__ @globals\/globals.h@
+                 -},
+                 version_t_minor :: HsBindgen.Runtime.LibC.Word16
+                 {- ^ __C declaration:__ @minor@
+
+                      __defined at:__ @globals\/globals.h 410:12@
+
+                      __exported by:__ @globals\/globals.h@
+                 -},
+                 version_t_patch :: HsBindgen.Runtime.LibC.Word8
+                 {- ^ __C declaration:__ @patch@
+
+                      __defined at:__ @globals\/globals.h 411:12@
+
+                      __exported by:__ @globals\/globals.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Version_t
+    where staticSizeOf = \_ -> 6 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Version_t
+    where readRaw = \ptr_0 -> ((pure Version_t <*> readRaw (Proxy @"version_t_major") ptr_0) <*> readRaw (Proxy @"version_t_minor") ptr_0) <*> readRaw (Proxy @"version_t_patch") ptr_0
+instance WriteRaw Version_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Version_t version_t_major_2
+                                                 version_t_minor_3
+                                                 version_t_patch_4 -> writeRaw (Proxy @"version_t_major") ptr_0 version_t_major_2 >> (writeRaw (Proxy @"version_t_minor") ptr_0 version_t_minor_3 >> writeRaw (Proxy @"version_t_patch") ptr_0 version_t_patch_4)
+deriving via (EquivStorable Version_t) instance Storable Version_t
+deriving via (IsStructViaReadRaw Version_t) instance IsStruct Version_t
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "version_t_major" Version_t ty
+    where hasField = \x_0 -> (\y_1 -> Version_t{version_t_major = y_1,
+                                                version_t_minor = getField @"version_t_minor" x_0,
+                                                version_t_patch = getField @"version_t_patch" x_0},
+                              getField @"version_t_major" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "version_t_major" (Ptr Version_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"version_t_major")
+instance HasCField Version_t "version_t_major"
+    where type CFieldType Version_t
+                          "version_t_major" = HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 0
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "version_t_minor" Version_t ty
+    where hasField = \x_0 -> (\y_1 -> Version_t{version_t_minor = y_1,
+                                                version_t_major = getField @"version_t_major" x_0,
+                                                version_t_patch = getField @"version_t_patch" x_0},
+                              getField @"version_t_minor" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "version_t_minor" (Ptr Version_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"version_t_minor")
+instance HasCField Version_t "version_t_minor"
+    where type CFieldType Version_t
+                          "version_t_minor" = HsBindgen.Runtime.LibC.Word16
+          offset# = \_ -> \_ -> 2
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "version_t_patch" Version_t ty
+    where hasField = \x_0 -> (\y_1 -> Version_t{version_t_patch = y_1,
+                                                version_t_major = getField @"version_t_major" x_0,
+                                                version_t_minor = getField @"version_t_minor" x_0},
+                              getField @"version_t_patch" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "version_t_patch" (Ptr Version_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"version_t_patch")
+instance HasCField Version_t "version_t_patch"
+    where type CFieldType Version_t
+                          "version_t_patch" = HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct struct1_t@
+
+    __defined at:__ @globals\/globals.h 414:9@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Struct1_t
+    = Struct1_t {struct1_t_x :: HsBindgen.Runtime.LibC.Word16
+                 {- ^ __C declaration:__ @x@
+
+                      __defined at:__ @globals\/globals.h 416:13@
+
+                      __exported by:__ @globals\/globals.h@
+                 -},
+                 struct1_t_y :: CBool
+                 {- ^ __C declaration:__ @y@
+
+                      __defined at:__ @globals\/globals.h 417:13@
+
+                      __exported by:__ @globals\/globals.h@
+                 -},
+                 struct1_t_version :: Version_t
+                 {- ^ __C declaration:__ @version@
+
+                      __defined at:__ @globals\/globals.h 418:13@
+
+                      __exported by:__ @globals\/globals.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct1_t
+    where staticSizeOf = \_ -> 10 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Struct1_t
+    where readRaw = \ptr_0 -> ((pure Struct1_t <*> readRaw (Proxy @"struct1_t_x") ptr_0) <*> readRaw (Proxy @"struct1_t_y") ptr_0) <*> readRaw (Proxy @"struct1_t_version") ptr_0
+instance WriteRaw Struct1_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct1_t struct1_t_x_2
+                                                 struct1_t_y_3
+                                                 struct1_t_version_4 -> writeRaw (Proxy @"struct1_t_x") ptr_0 struct1_t_x_2 >> (writeRaw (Proxy @"struct1_t_y") ptr_0 struct1_t_y_3 >> writeRaw (Proxy @"struct1_t_version") ptr_0 struct1_t_version_4)
+deriving via (EquivStorable Struct1_t) instance Storable Struct1_t
+deriving via (IsStructViaReadRaw Struct1_t) instance IsStruct Struct1_t
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "struct1_t_x" Struct1_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct1_t{struct1_t_x = y_1,
+                                                struct1_t_y = getField @"struct1_t_y" x_0,
+                                                struct1_t_version = getField @"struct1_t_version" x_0},
+                              getField @"struct1_t_x" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "struct1_t_x" (Ptr Struct1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct1_t_x")
+instance HasCField Struct1_t "struct1_t_x"
+    where type CFieldType Struct1_t
+                          "struct1_t_x" = HsBindgen.Runtime.LibC.Word16
+          offset# = \_ -> \_ -> 0
+instance (~) ty CBool => HasField "struct1_t_y" Struct1_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct1_t{struct1_t_y = y_1,
+                                                struct1_t_x = getField @"struct1_t_x" x_0,
+                                                struct1_t_version = getField @"struct1_t_version" x_0},
+                              getField @"struct1_t_y" x_0)
+instance (~) ty CBool =>
+         HasField "struct1_t_y" (Ptr Struct1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct1_t_y")
+instance HasCField Struct1_t "struct1_t_y"
+    where type CFieldType Struct1_t "struct1_t_y" = CBool
+          offset# = \_ -> \_ -> 2
+instance (~) ty Version_t =>
+         HasField "struct1_t_version" Struct1_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct1_t{struct1_t_version = y_1,
+                                                struct1_t_x = getField @"struct1_t_x" x_0,
+                                                struct1_t_y = getField @"struct1_t_y" x_0},
+                              getField @"struct1_t_version" x_0)
+instance (~) ty Version_t =>
+         HasField "struct1_t_version" (Ptr Struct1_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct1_t_version")
+instance HasCField Struct1_t "struct1_t_version"
+    where type CFieldType Struct1_t "struct1_t_version" = Version_t
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct struct2_t@
+
+    __defined at:__ @globals\/globals.h 421:9@
+
+    __exported by:__ @globals\/globals.h@
+-}
+data Struct2_t
+    = Struct2_t {struct2_t_field1 :: Struct1_t
+                 {- ^ __C declaration:__ @field1@
+
+                      __defined at:__ @globals\/globals.h 423:13@
+
+                      __exported by:__ @globals\/globals.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct2_t
+    where staticSizeOf = \_ -> 10 :: Int
+          staticAlignment = \_ -> 2 :: Int
+instance ReadRaw Struct2_t
+    where readRaw = \ptr_0 -> pure Struct2_t <*> readRaw (Proxy @"struct2_t_field1") ptr_0
+instance WriteRaw Struct2_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct2_t struct2_t_field1_2 -> writeRaw (Proxy @"struct2_t_field1") ptr_0 struct2_t_field1_2
+deriving via (EquivStorable Struct2_t) instance Storable Struct2_t
+deriving via (IsStructViaReadRaw Struct2_t) instance IsStruct Struct2_t
+instance (~) ty Struct1_t =>
+         HasField "struct2_t_field1" Struct2_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct2_t{struct2_t_field1 = y_1},
+                              getField @"struct2_t_field1" x_0)
+instance (~) ty Struct1_t =>
+         HasField "struct2_t_field1" (Ptr Struct2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct2_t_field1")
+instance HasCField Struct2_t "struct2_t_field1"
+    where type CFieldType Struct2_t "struct2_t_field1" = Struct1_t
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_globalsglobals_Example_get_simpleGlobal@
+foreign import ccall unsafe "hs_bindgen_4f8e7b3d91414aa8" hs_bindgen_4f8e7b3d91414aa8_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_simpleGlobal@
+hs_bindgen_4f8e7b3d91414aa8 :: IO (Ptr CInt)
+-- __unique:__ @test_globalsglobals_Example_get_simpleGlobal@
+hs_bindgen_4f8e7b3d91414aa8 = fmap fromFFIType hs_bindgen_4f8e7b3d91414aa8_base
+{-# NOINLINE simpleGlobal #-}
+{-| __C declaration:__ @simpleGlobal@
+
+    __defined at:__ @globals\/globals.h 10:12@
+
+    __exported by:__ @globals\/globals.h@
+-}
+simpleGlobal :: Ptr CInt
+{-| __C declaration:__ @simpleGlobal@
+
+    __defined at:__ @globals\/globals.h 10:12@
+
+    __exported by:__ @globals\/globals.h@
+-}
+simpleGlobal = unsafePerformIO hs_bindgen_4f8e7b3d91414aa8
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal1@
+foreign import ccall unsafe "hs_bindgen_7f4cd619c55119dd" hs_bindgen_7f4cd619c55119dd_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal1@
+hs_bindgen_7f4cd619c55119dd :: IO (Ptr Config)
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal1@
+hs_bindgen_7f4cd619c55119dd = fmap fromFFIType hs_bindgen_7f4cd619c55119dd_base
+{-# NOINLINE compoundGlobal1 #-}
+{-| __C declaration:__ @compoundGlobal1@
+
+    __defined at:__ @globals\/globals.h 17:22@
+
+    __exported by:__ @globals\/globals.h@
+-}
+compoundGlobal1 :: Ptr Config
+{-| __C declaration:__ @compoundGlobal1@
+
+    __defined at:__ @globals\/globals.h 17:22@
+
+    __exported by:__ @globals\/globals.h@
+-}
+compoundGlobal1 = unsafePerformIO hs_bindgen_7f4cd619c55119dd
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal2@
+foreign import ccall unsafe "hs_bindgen_ed5c7196c3291592" hs_bindgen_ed5c7196c3291592_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal2@
+hs_bindgen_ed5c7196c3291592 :: IO (Ptr Inline_struct)
+-- __unique:__ @test_globalsglobals_Example_get_compoundGlobal2@
+hs_bindgen_ed5c7196c3291592 = fmap fromFFIType hs_bindgen_ed5c7196c3291592_base
+{-# NOINLINE compoundGlobal2 #-}
+{-| __C declaration:__ @compoundGlobal2@
+
+    __defined at:__ @globals\/globals.h 20:47@
+
+    __exported by:__ @globals\/globals.h@
+-}
+compoundGlobal2 :: Ptr Inline_struct
+{-| __C declaration:__ @compoundGlobal2@
+
+    __defined at:__ @globals\/globals.h 20:47@
+
+    __exported by:__ @globals\/globals.h@
+-}
+compoundGlobal2 = unsafePerformIO hs_bindgen_ed5c7196c3291592
+-- __unique:__ @test_globalsglobals_Example_get_nesInteger@
+foreign import ccall unsafe "hs_bindgen_0be07820afb78239" hs_bindgen_0be07820afb78239_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesInteger@
+hs_bindgen_0be07820afb78239 :: IO (Ptr CInt)
+-- __unique:__ @test_globalsglobals_Example_get_nesInteger@
+hs_bindgen_0be07820afb78239 = fmap fromFFIType hs_bindgen_0be07820afb78239_base
+{-# NOINLINE nesInteger #-}
+{-| Non-extern non-static global variables
+
+    These kinds of variables need to be treated with care, to avoid duplicate symbols, but do exist in the wild.
+
+    We test with various kinds of initializers as we must explicitly ignore them in our parser. The list here roughly follows the definition of @CXCursor@ [1](https://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d470913f9ef0013) , starting at @CXCursor_IntegerLiteral@ ; see also definition of 'varDecl' in @HsBindgen.Frontend.Pass.Parse.Decl@ .
+
+    __C declaration:__ @nesInteger@
+
+    __defined at:__ @globals\/globals.h 36:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesInteger :: Ptr CInt
+{-| Non-extern non-static global variables
+
+    These kinds of variables need to be treated with care, to avoid duplicate symbols, but do exist in the wild.
+
+    We test with various kinds of initializers as we must explicitly ignore them in our parser. The list here roughly follows the definition of @CXCursor@ [1](https://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d470913f9ef0013) , starting at @CXCursor_IntegerLiteral@ ; see also definition of 'varDecl' in @HsBindgen.Frontend.Pass.Parse.Decl@ .
+
+    __C declaration:__ @nesInteger@
+
+    __defined at:__ @globals\/globals.h 36:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesInteger = unsafePerformIO hs_bindgen_0be07820afb78239
+-- __unique:__ @test_globalsglobals_Example_get_nesFloating@
+foreign import ccall unsafe "hs_bindgen_e3497c0a80a77750" hs_bindgen_e3497c0a80a77750_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesFloating@
+hs_bindgen_e3497c0a80a77750 :: IO (Ptr CFloat)
+-- __unique:__ @test_globalsglobals_Example_get_nesFloating@
+hs_bindgen_e3497c0a80a77750 = fmap fromFFIType hs_bindgen_e3497c0a80a77750_base
+{-# NOINLINE nesFloating #-}
+{-| __C declaration:__ @nesFloating@
+
+    __defined at:__ @globals\/globals.h 37:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesFloating :: Ptr CFloat
+{-| __C declaration:__ @nesFloating@
+
+    __defined at:__ @globals\/globals.h 37:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesFloating = unsafePerformIO hs_bindgen_e3497c0a80a77750
+-- __unique:__ @test_globalsglobals_Example_get_nesImaginary@
+foreign import ccall unsafe "hs_bindgen_e958634c96270349" hs_bindgen_e958634c96270349_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesImaginary@
+hs_bindgen_e958634c96270349 :: IO (Ptr (Complex CDouble))
+-- __unique:__ @test_globalsglobals_Example_get_nesImaginary@
+hs_bindgen_e958634c96270349 = fmap fromFFIType hs_bindgen_e958634c96270349_base
+{-# NOINLINE nesImaginary #-}
+{-| __C declaration:__ @nesImaginary@
+
+    __defined at:__ @globals\/globals.h 38:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesImaginary :: Ptr (Complex CDouble)
+{-| __C declaration:__ @nesImaginary@
+
+    __defined at:__ @globals\/globals.h 38:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesImaginary = unsafePerformIO hs_bindgen_e958634c96270349
+-- __unique:__ @test_globalsglobals_Example_get_nesString1@
+foreign import ccall unsafe "hs_bindgen_78918168bc760476" hs_bindgen_78918168bc760476_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesString1@
+hs_bindgen_78918168bc760476 :: IO (Ptr (Ptr CChar))
+-- __unique:__ @test_globalsglobals_Example_get_nesString1@
+hs_bindgen_78918168bc760476 = fmap fromFFIType hs_bindgen_78918168bc760476_base
+{-# NOINLINE nesString1 #-}
+{-| __C declaration:__ @nesString1@
+
+    __defined at:__ @globals\/globals.h 39:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesString1 :: Ptr (Ptr CChar)
+{-| __C declaration:__ @nesString1@
+
+    __defined at:__ @globals\/globals.h 39:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesString1 = unsafePerformIO hs_bindgen_78918168bc760476
+-- __unique:__ @test_globalsglobals_Example_get_nesString2@
+foreign import ccall unsafe "hs_bindgen_c6c52463f890e752" hs_bindgen_c6c52463f890e752_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesString2@
+hs_bindgen_c6c52463f890e752 :: IO (Ptr (ConstantArray 3 CChar))
+-- __unique:__ @test_globalsglobals_Example_get_nesString2@
+hs_bindgen_c6c52463f890e752 = fmap fromFFIType hs_bindgen_c6c52463f890e752_base
+{-# NOINLINE nesString2 #-}
+{-| __C declaration:__ @nesString2@
+
+    __defined at:__ @globals\/globals.h 40:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesString2 :: Ptr (ConstantArray 3 CChar)
+{-| __C declaration:__ @nesString2@
+
+    __defined at:__ @globals\/globals.h 40:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesString2 = unsafePerformIO hs_bindgen_c6c52463f890e752
+-- __unique:__ @test_globalsglobals_Example_get_nesCharacter@
+foreign import ccall unsafe "hs_bindgen_9b33d990c25069a0" hs_bindgen_9b33d990c25069a0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesCharacter@
+hs_bindgen_9b33d990c25069a0 :: IO (Ptr CChar)
+-- __unique:__ @test_globalsglobals_Example_get_nesCharacter@
+hs_bindgen_9b33d990c25069a0 = fmap fromFFIType hs_bindgen_9b33d990c25069a0_base
+{-# NOINLINE nesCharacter #-}
+{-| __C declaration:__ @nesCharacter@
+
+    __defined at:__ @globals\/globals.h 41:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesCharacter :: Ptr CChar
+{-| __C declaration:__ @nesCharacter@
+
+    __defined at:__ @globals\/globals.h 41:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesCharacter = unsafePerformIO hs_bindgen_9b33d990c25069a0
+-- __unique:__ @test_globalsglobals_Example_get_nesParen@
+foreign import ccall unsafe "hs_bindgen_561a1d5a05307329" hs_bindgen_561a1d5a05307329_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesParen@
+hs_bindgen_561a1d5a05307329 :: IO (Ptr CInt)
+-- __unique:__ @test_globalsglobals_Example_get_nesParen@
+hs_bindgen_561a1d5a05307329 = fmap fromFFIType hs_bindgen_561a1d5a05307329_base
+{-# NOINLINE nesParen #-}
+{-| __C declaration:__ @nesParen@
+
+    __defined at:__ @globals\/globals.h 42:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesParen :: Ptr CInt
+{-| __C declaration:__ @nesParen@
+
+    __defined at:__ @globals\/globals.h 42:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesParen = unsafePerformIO hs_bindgen_561a1d5a05307329
+-- __unique:__ @test_globalsglobals_Example_get_nesUnary@
+foreign import ccall unsafe "hs_bindgen_4d3d64def4cf943f" hs_bindgen_4d3d64def4cf943f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesUnary@
+hs_bindgen_4d3d64def4cf943f :: IO (Ptr CInt)
+-- __unique:__ @test_globalsglobals_Example_get_nesUnary@
+hs_bindgen_4d3d64def4cf943f = fmap fromFFIType hs_bindgen_4d3d64def4cf943f_base
+{-# NOINLINE nesUnary #-}
+{-| __C declaration:__ @nesUnary@
+
+    __defined at:__ @globals\/globals.h 43:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesUnary :: Ptr CInt
+{-| __C declaration:__ @nesUnary@
+
+    __defined at:__ @globals\/globals.h 43:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesUnary = unsafePerformIO hs_bindgen_4d3d64def4cf943f
+-- __unique:__ @test_globalsglobals_Example_get_nesBinary@
+foreign import ccall unsafe "hs_bindgen_dcb8301e1cb444b7" hs_bindgen_dcb8301e1cb444b7_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesBinary@
+hs_bindgen_dcb8301e1cb444b7 :: IO (Ptr CInt)
+-- __unique:__ @test_globalsglobals_Example_get_nesBinary@
+hs_bindgen_dcb8301e1cb444b7 = fmap fromFFIType hs_bindgen_dcb8301e1cb444b7_base
+{-# NOINLINE nesBinary #-}
+{-| __C declaration:__ @nesBinary@
+
+    __defined at:__ @globals\/globals.h 44:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesBinary :: Ptr CInt
+{-| __C declaration:__ @nesBinary@
+
+    __defined at:__ @globals\/globals.h 44:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesBinary = unsafePerformIO hs_bindgen_dcb8301e1cb444b7
+-- __unique:__ @test_globalsglobals_Example_get_nesConditional@
+foreign import ccall unsafe "hs_bindgen_798d6b9c7136a5d0" hs_bindgen_798d6b9c7136a5d0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesConditional@
+hs_bindgen_798d6b9c7136a5d0 :: IO (Ptr CInt)
+-- __unique:__ @test_globalsglobals_Example_get_nesConditional@
+hs_bindgen_798d6b9c7136a5d0 = fmap fromFFIType hs_bindgen_798d6b9c7136a5d0_base
+{-# NOINLINE nesConditional #-}
+{-| __C declaration:__ @nesConditional@
+
+    __defined at:__ @globals\/globals.h 45:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesConditional :: Ptr CInt
+{-| __C declaration:__ @nesConditional@
+
+    __defined at:__ @globals\/globals.h 45:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesConditional = unsafePerformIO hs_bindgen_798d6b9c7136a5d0
+-- __unique:__ @test_globalsglobals_Example_get_nesCast@
+foreign import ccall unsafe "hs_bindgen_9c15dc9805f8abb8" hs_bindgen_9c15dc9805f8abb8_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesCast@
+hs_bindgen_9c15dc9805f8abb8 :: IO (Ptr CFloat)
+-- __unique:__ @test_globalsglobals_Example_get_nesCast@
+hs_bindgen_9c15dc9805f8abb8 = fmap fromFFIType hs_bindgen_9c15dc9805f8abb8_base
+{-# NOINLINE nesCast #-}
+{-| __C declaration:__ @nesCast@
+
+    __defined at:__ @globals\/globals.h 46:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesCast :: Ptr CFloat
+{-| __C declaration:__ @nesCast@
+
+    __defined at:__ @globals\/globals.h 46:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesCast = unsafePerformIO hs_bindgen_9c15dc9805f8abb8
+-- __unique:__ @test_globalsglobals_Example_get_nesCompound@
+foreign import ccall unsafe "hs_bindgen_089dfddcc6667ac2" hs_bindgen_089dfddcc6667ac2_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesCompound@
+hs_bindgen_089dfddcc6667ac2 :: IO (Ptr (Ptr CInt))
+-- __unique:__ @test_globalsglobals_Example_get_nesCompound@
+hs_bindgen_089dfddcc6667ac2 = fmap fromFFIType hs_bindgen_089dfddcc6667ac2_base
+{-# NOINLINE nesCompound #-}
+{-| __C declaration:__ @nesCompound@
+
+    __defined at:__ @globals\/globals.h 47:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesCompound :: Ptr (Ptr CInt)
+{-| __C declaration:__ @nesCompound@
+
+    __defined at:__ @globals\/globals.h 47:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesCompound = unsafePerformIO hs_bindgen_089dfddcc6667ac2
+-- __unique:__ @test_globalsglobals_Example_get_nesInitList@
+foreign import ccall unsafe "hs_bindgen_798af9a98bfc3030" hs_bindgen_798af9a98bfc3030_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesInitList@
+hs_bindgen_798af9a98bfc3030 :: IO (Ptr (ConstantArray 4
+                                                      HsBindgen.Runtime.LibC.Word8))
+-- __unique:__ @test_globalsglobals_Example_get_nesInitList@
+hs_bindgen_798af9a98bfc3030 = fmap fromFFIType hs_bindgen_798af9a98bfc3030_base
+{-# NOINLINE nesInitList #-}
+{-| __C declaration:__ @nesInitList@
+
+    __defined at:__ @globals\/globals.h 48:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesInitList :: Ptr (ConstantArray 4 HsBindgen.Runtime.LibC.Word8)
+{-| __C declaration:__ @nesInitList@
+
+    __defined at:__ @globals\/globals.h 48:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesInitList = unsafePerformIO hs_bindgen_798af9a98bfc3030
+-- __unique:__ @test_globalsglobals_Example_get_nesBool@
+foreign import ccall unsafe "hs_bindgen_846b0fde4d102012" hs_bindgen_846b0fde4d102012_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_nesBool@
+hs_bindgen_846b0fde4d102012 :: IO (Ptr CBool)
+-- __unique:__ @test_globalsglobals_Example_get_nesBool@
+hs_bindgen_846b0fde4d102012 = fmap fromFFIType hs_bindgen_846b0fde4d102012_base
+{-# NOINLINE nesBool #-}
+{-| __C declaration:__ @nesBool@
+
+    __defined at:__ @globals\/globals.h 49:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesBool :: Ptr CBool
+{-| __C declaration:__ @nesBool@
+
+    __defined at:__ @globals\/globals.h 49:16@
+
+    __exported by:__ @globals\/globals.h@
+-}
+nesBool = unsafePerformIO hs_bindgen_846b0fde4d102012
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary@
+foreign import ccall unsafe "hs_bindgen_b243f9b292f8b883" hs_bindgen_b243f9b292f8b883_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary@
+hs_bindgen_b243f9b292f8b883 :: IO (Ptr (ConstantArray 4096
+                                                      HsBindgen.Runtime.LibC.Word8))
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary@
+hs_bindgen_b243f9b292f8b883 = fmap fromFFIType hs_bindgen_b243f9b292f8b883_base
+{-# NOINLINE streamBinary #-}
+{-| Additional examples of global variables, abstracted from real examples
+
+    The @'streamBinary'@ / @'streamBinary_len'@ example comes from [1](https://github.com/analogdevicesinc/no-OS/blob/855c4b3c34f2297865e448661ba4fcc0931bf430/drivers/rf-transceiver/talise/firmware/talise_stream_binary.h#L322-L325) , and is an example of a non-extern non-static global (indeed, the header does not even use @pragma once@ or similar).
+
+    __C declaration:__ @streamBinary@
+
+    __defined at:__ @globals\/globals.h 61:9@
+
+    __exported by:__ @globals\/globals.h@
+-}
+streamBinary :: Ptr (ConstantArray 4096
+                                   HsBindgen.Runtime.LibC.Word8)
+{-| Additional examples of global variables, abstracted from real examples
+
+    The @'streamBinary'@ / @'streamBinary_len'@ example comes from [1](https://github.com/analogdevicesinc/no-OS/blob/855c4b3c34f2297865e448661ba4fcc0931bf430/drivers/rf-transceiver/talise/firmware/talise_stream_binary.h#L322-L325) , and is an example of a non-extern non-static global (indeed, the header does not even use @pragma once@ or similar).
+
+    __C declaration:__ @streamBinary@
+
+    __defined at:__ @globals\/globals.h 61:9@
+
+    __exported by:__ @globals\/globals.h@
+-}
+streamBinary = unsafePerformIO hs_bindgen_b243f9b292f8b883
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary_len@
+foreign import ccall unsafe "hs_bindgen_60adad2a6178e6cc" hs_bindgen_60adad2a6178e6cc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary_len@
+hs_bindgen_60adad2a6178e6cc :: IO (Ptr HsBindgen.Runtime.LibC.Word32)
+-- __unique:__ @test_globalsglobals_Example_get_streamBinary_len@
+hs_bindgen_60adad2a6178e6cc = fmap fromFFIType hs_bindgen_60adad2a6178e6cc_base
+{-# NOINLINE streamBinary_len #-}
+{-| __C declaration:__ @streamBinary_len@
+
+    __defined at:__ @globals\/globals.h 405:10@
+
+    __exported by:__ @globals\/globals.h@
+-}
+streamBinary_len :: Ptr HsBindgen.Runtime.LibC.Word32
+{-| __C declaration:__ @streamBinary_len@
+
+    __defined at:__ @globals\/globals.h 405:10@
+
+    __exported by:__ @globals\/globals.h@
+-}
+streamBinary_len = unsafePerformIO hs_bindgen_60adad2a6178e6cc
+-- __unique:__ @test_globalsglobals_Example_get_some_global_struct@
+foreign import ccall unsafe "hs_bindgen_fe50ca9a4fea641c" hs_bindgen_fe50ca9a4fea641c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsglobals_Example_get_some_global_struct@
+hs_bindgen_fe50ca9a4fea641c :: IO (Ptr Struct2_t)
+-- __unique:__ @test_globalsglobals_Example_get_some_global_struct@
+hs_bindgen_fe50ca9a4fea641c = fmap fromFFIType hs_bindgen_fe50ca9a4fea641c_base
+{-# NOINLINE some_global_struct #-}
+{-| __C declaration:__ @some_global_struct@
+
+    __defined at:__ @globals\/globals.h 426:11@
+
+    __exported by:__ @globals\/globals.h@
+-}
+some_global_struct :: Ptr Struct2_t
+{-| __C declaration:__ @some_global_struct@
+
+    __defined at:__ @globals\/globals.h 426:11@
+
+    __exported by:__ @globals\/globals.h@
+-}
+some_global_struct = unsafePerformIO hs_bindgen_fe50ca9a4fea641c
diff --git a/test-artefacts/fixtures/globals/untagged/Example.hs b/test-artefacts/fixtures/globals/untagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/globals/untagged/Example.hs
@@ -0,0 +1,719 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.UntaggedPoint(..)
+    , Example.UntaggedPair(..)
+    , Example.UntaggedEnum(..)
+    , pattern Example.VAL_A
+    , pattern Example.VAL_B
+    , Example.UntaggedEnumCoords(..)
+    , pattern Example.X
+    , pattern Example.Y
+    , pattern Example.Z
+    , Example.A(..)
+    , pattern Example.A1
+    , Example.B(..)
+    , Example.C(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@untaggedPoint@
+
+    __defined at:__ @globals\/untagged.h 12:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+data UntaggedPoint = UntaggedPoint
+  { untaggedPoint_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @globals\/untagged.h 12:14@
+
+         __exported by:__ @globals\/untagged.h@
+    -}
+  , untaggedPoint_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @globals\/untagged.h 12:21@
+
+         __exported by:__ @globals\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UntaggedPoint where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UntaggedPoint where
+
+  readRaw =
+    \ptr0 ->
+          pure UntaggedPoint
+      <*> HasCField.readRaw (BG.Proxy @"untaggedPoint_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"untaggedPoint_y") ptr0
+
+instance Marshal.WriteRaw UntaggedPoint where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UntaggedPoint untaggedPoint_x2 untaggedPoint_y3 ->
+               HasCField.writeRaw (BG.Proxy @"untaggedPoint_x") ptr0 untaggedPoint_x2
+            >> HasCField.writeRaw (BG.Proxy @"untaggedPoint_y") ptr0 untaggedPoint_y3
+
+deriving via Marshal.EquivStorable UntaggedPoint instance BG.Storable UntaggedPoint
+
+deriving via Struct.IsStructViaReadRaw UntaggedPoint instance Struct.IsStruct UntaggedPoint
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @globals\/untagged.h 12:14@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "untaggedPoint_x" UntaggedPoint ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UntaggedPoint {untaggedPoint_x = y1, untaggedPoint_y = BG.getField @"untaggedPoint_y" x0}
+      , BG.getField @"untaggedPoint_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "untaggedPoint_x" (BG.Ptr UntaggedPoint) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedPoint_x")
+
+instance HasCField.HasCField UntaggedPoint "untaggedPoint_x" where
+
+  type CFieldType UntaggedPoint "untaggedPoint_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @globals\/untagged.h 12:21@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "untaggedPoint_y" UntaggedPoint ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UntaggedPoint {untaggedPoint_y = y1, untaggedPoint_x = BG.getField @"untaggedPoint_x" x0}
+      , BG.getField @"untaggedPoint_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "untaggedPoint_y" (BG.Ptr UntaggedPoint) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedPoint_y")
+
+instance HasCField.HasCField UntaggedPoint "untaggedPoint_y" where
+
+  type CFieldType UntaggedPoint "untaggedPoint_y" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@untaggedPair@
+
+    __defined at:__ @globals\/untagged.h 14:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+data UntaggedPair = UntaggedPair
+  { untaggedPair_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @globals\/untagged.h 14:14@
+
+         __exported by:__ @globals\/untagged.h@
+    -}
+  , untaggedPair_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @globals\/untagged.h 14:21@
+
+         __exported by:__ @globals\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UntaggedPair where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UntaggedPair where
+
+  readRaw =
+    \ptr0 ->
+          pure UntaggedPair
+      <*> HasCField.readRaw (BG.Proxy @"untaggedPair_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"untaggedPair_b") ptr0
+
+instance Marshal.WriteRaw UntaggedPair where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UntaggedPair untaggedPair_a2 untaggedPair_b3 ->
+               HasCField.writeRaw (BG.Proxy @"untaggedPair_a") ptr0 untaggedPair_a2
+            >> HasCField.writeRaw (BG.Proxy @"untaggedPair_b") ptr0 untaggedPair_b3
+
+deriving via Marshal.EquivStorable UntaggedPair instance BG.Storable UntaggedPair
+
+deriving via Struct.IsStructViaReadRaw UntaggedPair instance Struct.IsStruct UntaggedPair
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @globals\/untagged.h 14:14@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "untaggedPair_a" UntaggedPair ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UntaggedPair {untaggedPair_a = y1, untaggedPair_b = BG.getField @"untaggedPair_b" x0}
+      , BG.getField @"untaggedPair_a" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "untaggedPair_a" (BG.Ptr UntaggedPair) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedPair_a")
+
+instance HasCField.HasCField UntaggedPair "untaggedPair_a" where
+
+  type CFieldType UntaggedPair "untaggedPair_a" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @globals\/untagged.h 14:21@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "untaggedPair_b" UntaggedPair ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UntaggedPair {untaggedPair_b = y1, untaggedPair_a = BG.getField @"untaggedPair_a" x0}
+      , BG.getField @"untaggedPair_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "untaggedPair_b" (BG.Ptr UntaggedPair) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedPair_b")
+
+instance HasCField.HasCField UntaggedPair "untaggedPair_b" where
+
+  type CFieldType UntaggedPair "untaggedPair_b" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @enum \@untaggedEnum@
+
+    __defined at:__ @globals\/untagged.h 16:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+newtype UntaggedEnum = UntaggedEnum
+  { unwrapUntaggedEnum :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize UntaggedEnum where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UntaggedEnum where
+
+  readRaw =
+    \ptr0 ->
+          pure UntaggedEnum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw UntaggedEnum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UntaggedEnum unwrapUntaggedEnum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapUntaggedEnum2
+
+deriving via Marshal.EquivStorable UntaggedEnum instance BG.Storable UntaggedEnum
+
+deriving via BG.CUInt instance BG.Prim UntaggedEnum
+
+instance CEnum.CEnum UntaggedEnum where
+
+  type CEnumZ UntaggedEnum = BG.CUInt
+
+  toCEnum = UntaggedEnum
+
+  fromCEnum = BG.getField @"unwrapUntaggedEnum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "VAL_A"), (1, BG.singleton "VAL_B")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "UntaggedEnum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "UntaggedEnum"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum UntaggedEnum where
+
+  minDeclaredValue = VAL_A
+
+  maxDeclaredValue = VAL_B
+
+instance Show UntaggedEnum where
+
+  showsPrec = CEnum.shows
+
+instance Read UntaggedEnum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapUntaggedEnum" UntaggedEnum ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> UntaggedEnum {unwrapUntaggedEnum = y1}
+      , BG.getField @"unwrapUntaggedEnum" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapUntaggedEnum" (BG.Ptr UntaggedEnum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUntaggedEnum")
+
+instance HasCField.HasCField UntaggedEnum "unwrapUntaggedEnum" where
+
+  type CFieldType UntaggedEnum "unwrapUntaggedEnum" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @VAL_A@
+
+    __defined at:__ @globals\/untagged.h 16:8@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern VAL_A :: UntaggedEnum
+pattern VAL_A = UntaggedEnum 0
+
+{-| __C declaration:__ @VAL_B@
+
+    __defined at:__ @globals\/untagged.h 16:19@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern VAL_B :: UntaggedEnum
+pattern VAL_B = UntaggedEnum 1
+
+{-| __C declaration:__ @enum \@untaggedEnumCoords@
+
+    __defined at:__ @globals\/untagged.h 18:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+newtype UntaggedEnumCoords = UntaggedEnumCoords
+  { unwrapUntaggedEnumCoords :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize UntaggedEnumCoords where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UntaggedEnumCoords where
+
+  readRaw =
+    \ptr0 ->
+          pure UntaggedEnumCoords
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw UntaggedEnumCoords where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UntaggedEnumCoords unwrapUntaggedEnumCoords2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapUntaggedEnumCoords2
+
+deriving via Marshal.EquivStorable UntaggedEnumCoords instance BG.Storable UntaggedEnumCoords
+
+deriving via BG.CUInt instance BG.Prim UntaggedEnumCoords
+
+instance CEnum.CEnum UntaggedEnumCoords where
+
+  type CEnumZ UntaggedEnumCoords = BG.CUInt
+
+  toCEnum = UntaggedEnumCoords
+
+  fromCEnum = BG.getField @"unwrapUntaggedEnumCoords"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(10, BG.singleton "X"), (20, BG.singleton "Y"), (30, BG.singleton "Z")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "UntaggedEnumCoords"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "UntaggedEnumCoords"
+
+instance Show UntaggedEnumCoords where
+
+  showsPrec = CEnum.shows
+
+instance Read UntaggedEnumCoords where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapUntaggedEnumCoords" UntaggedEnumCoords ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UntaggedEnumCoords {unwrapUntaggedEnumCoords = y1}
+      , BG.getField @"unwrapUntaggedEnumCoords" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapUntaggedEnumCoords" (BG.Ptr UntaggedEnumCoords) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUntaggedEnumCoords")
+
+instance HasCField.HasCField UntaggedEnumCoords "unwrapUntaggedEnumCoords" where
+
+  type CFieldType UntaggedEnumCoords "unwrapUntaggedEnumCoords" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @X@
+
+    __defined at:__ @globals\/untagged.h 18:8@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern X :: UntaggedEnumCoords
+pattern X = UntaggedEnumCoords 10
+
+{-| __C declaration:__ @Y@
+
+    __defined at:__ @globals\/untagged.h 18:16@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern Y :: UntaggedEnumCoords
+pattern Y = UntaggedEnumCoords 20
+
+{-| __C declaration:__ @Z@
+
+    __defined at:__ @globals\/untagged.h 18:24@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern Z :: UntaggedEnumCoords
+pattern Z = UntaggedEnumCoords 30
+
+{-| __C declaration:__ @enum \@A@
+
+    __defined at:__ @globals\/untagged.h 24:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+newtype A = A
+  { unwrapA :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize A where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw A where
+
+  readRaw =
+    \ptr0 ->
+          pure A
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw A where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          A unwrapA2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapA2
+
+deriving via Marshal.EquivStorable A instance BG.Storable A
+
+deriving via BG.CUInt instance BG.Prim A
+
+instance CEnum.CEnum A where
+
+  type CEnumZ A = BG.CUInt
+
+  toCEnum = A
+
+  fromCEnum = BG.getField @"unwrapA"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "A1")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "A"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "A"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum A where
+
+  minDeclaredValue = A1
+
+  maxDeclaredValue = A1
+
+instance Show A where
+
+  showsPrec = CEnum.shows
+
+instance Read A where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @a1@
+
+    __defined at:__ @globals\/untagged.h 24:8@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern A1 :: A
+pattern A1 = A 0
+
+{-| __C declaration:__ @union \@B@
+
+    __defined at:__ @globals\/untagged.h 27:7@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+newtype B = B
+  { unwrapB :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize B
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw B
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw B
+
+deriving via Marshal.EquivStorable B instance BG.Storable B
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion B
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @globals\/untagged.h 27:19@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "b_x" B ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @globals\/untagged.h 27:19@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "b_x" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"b_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "b_x" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b_x")
+
+instance HasCField.HasCField B "b_x" where
+
+  type CFieldType B "b_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@C@
+
+    __defined at:__ @globals\/untagged.h 30:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+data C = C
+  { c_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @globals\/untagged.h 30:14@
+
+         __exported by:__ @globals\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize C where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw C where
+
+  readRaw =
+    \ptr0 ->
+          pure C
+      <*> HasCField.readRaw (BG.Proxy @"c_x") ptr0
+
+instance Marshal.WriteRaw C where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          C c_x2 ->
+            HasCField.writeRaw (BG.Proxy @"c_x") ptr0 c_x2
+
+deriving via Marshal.EquivStorable C instance BG.Storable C
+
+deriving via Struct.IsStructViaReadRaw C instance Struct.IsStruct C
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @globals\/untagged.h 30:14@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "c_x" C ty where
+
+  hasField =
+    \x0 -> (\y1 -> C {c_x = y1}, BG.getField @"c_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "c_x" (BG.Ptr C) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"c_x")
+
+instance HasCField.HasCField C "c_x" where
+
+  type CFieldType C "c_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/globals/untagged/Example/Global.hs b/test-artefacts/fixtures/globals/untagged/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/globals/untagged/Example/Global.hs
@@ -0,0 +1,215 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.untaggedPoint
+    , Example.Global.untaggedPair
+    , Example.Global.untaggedEnum
+    , Example.Global.untaggedEnumCoords
+    , Example.Global.a
+    , Example.Global.b
+    , Example.Global.c
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <globals/untagged.h>"
+  , "/* test_globalsuntagged_Example_get_untaggedPoint */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_d77490b2fc5f4d07 (void)"
+  , "{"
+  , "  return &untaggedPoint;"
+  , "}"
+  , "/* test_globalsuntagged_Example_get_untaggedPair */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_0c5d4010212a5c60 (void)"
+  , "{"
+  , "  return &untaggedPair;"
+  , "}"
+  , "/* test_globalsuntagged_Example_get_untaggedEnum */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_6913d0b9652bbf6f (void)"
+  , "{"
+  , "  return &untaggedEnum;"
+  , "}"
+  , "/* test_globalsuntagged_Example_get_untaggedEnumCoords */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_d7232446972b888a (void)"
+  , "{"
+  , "  return &untaggedEnumCoords;"
+  , "}"
+  , "/* test_globalsuntagged_Example_get_A */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_9d7d1fc84d6966f1 (void)"
+  , "{"
+  , "  return &A;"
+  , "}"
+  , "/* test_globalsuntagged_Example_get_B */"
+  , "__attribute__ ((const))"
+  , "void const *hs_bindgen_38f1407628b3330b (void)"
+  , "{"
+  , "  return &B;"
+  , "}"
+  , "/* test_globalsuntagged_Example_get_C */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_492f8d9f3437df29 (void)"
+  , "{"
+  , "  return &C;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPoint@
+foreign import ccall unsafe "hs_bindgen_d77490b2fc5f4d07" hs_bindgen_d77490b2fc5f4d07_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPoint@
+hs_bindgen_d77490b2fc5f4d07 :: IO (BG.Ptr UntaggedPoint)
+hs_bindgen_d77490b2fc5f4d07 =
+  fmap BG.fromFFIType hs_bindgen_d77490b2fc5f4d07_base
+
+{-# NOINLINE untaggedPoint #-}
+{-| __C declaration:__ @untaggedPoint@
+
+    __defined at:__ @globals\/untagged.h 12:26@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedPoint :: BG.Ptr UntaggedPoint
+untaggedPoint =
+  BG.unsafePerformIO hs_bindgen_d77490b2fc5f4d07
+
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPair@
+foreign import ccall unsafe "hs_bindgen_0c5d4010212a5c60" hs_bindgen_0c5d4010212a5c60_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPair@
+hs_bindgen_0c5d4010212a5c60 :: IO (BG.Ptr UntaggedPair)
+hs_bindgen_0c5d4010212a5c60 =
+  fmap BG.fromFFIType hs_bindgen_0c5d4010212a5c60_base
+
+{-# NOINLINE untaggedPair #-}
+{-| __C declaration:__ @untaggedPair@
+
+    __defined at:__ @globals\/untagged.h 14:26@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedPair :: BG.Ptr UntaggedPair
+untaggedPair =
+  BG.unsafePerformIO hs_bindgen_0c5d4010212a5c60
+
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnum@
+foreign import ccall unsafe "hs_bindgen_6913d0b9652bbf6f" hs_bindgen_6913d0b9652bbf6f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnum@
+hs_bindgen_6913d0b9652bbf6f :: IO (BG.Ptr UntaggedEnum)
+hs_bindgen_6913d0b9652bbf6f =
+  fmap BG.fromFFIType hs_bindgen_6913d0b9652bbf6f_base
+
+{-# NOINLINE untaggedEnum #-}
+{-| __C declaration:__ @untaggedEnum@
+
+    __defined at:__ @globals\/untagged.h 16:31@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedEnum :: BG.Ptr UntaggedEnum
+untaggedEnum =
+  BG.unsafePerformIO hs_bindgen_6913d0b9652bbf6f
+
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnumCoords@
+foreign import ccall unsafe "hs_bindgen_d7232446972b888a" hs_bindgen_d7232446972b888a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnumCoords@
+hs_bindgen_d7232446972b888a :: IO (BG.Ptr UntaggedEnumCoords)
+hs_bindgen_d7232446972b888a =
+  fmap BG.fromFFIType hs_bindgen_d7232446972b888a_base
+
+{-# NOINLINE untaggedEnumCoords #-}
+{-| __C declaration:__ @untaggedEnumCoords@
+
+    __defined at:__ @globals\/untagged.h 18:33@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedEnumCoords :: BG.Ptr UntaggedEnumCoords
+untaggedEnumCoords =
+  BG.unsafePerformIO hs_bindgen_d7232446972b888a
+
+-- __unique:__ @test_globalsuntagged_Example_get_A@
+foreign import ccall unsafe "hs_bindgen_9d7d1fc84d6966f1" hs_bindgen_9d7d1fc84d6966f1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsuntagged_Example_get_A@
+hs_bindgen_9d7d1fc84d6966f1 :: IO (BG.Ptr (CA.ConstantArray 17 A))
+hs_bindgen_9d7d1fc84d6966f1 =
+  fmap BG.fromFFIType hs_bindgen_9d7d1fc84d6966f1_base
+
+{-# NOINLINE a #-}
+{-| __C declaration:__ @A@
+
+    __defined at:__ @globals\/untagged.h 24:13@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+a :: BG.Ptr (CA.ConstantArray 17 A)
+a = BG.unsafePerformIO hs_bindgen_9d7d1fc84d6966f1
+
+-- __unique:__ @test_globalsuntagged_Example_get_B@
+foreign import ccall unsafe "hs_bindgen_38f1407628b3330b" hs_bindgen_38f1407628b3330b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsuntagged_Example_get_B@
+hs_bindgen_38f1407628b3330b :: IO (PtrConst.PtrConst B)
+hs_bindgen_38f1407628b3330b =
+  fmap BG.fromFFIType hs_bindgen_38f1407628b3330b_base
+
+{-# NOINLINE hs_bindgen_c84e7bea962cf7bc #-}
+{-| __C declaration:__ @B@
+
+    __defined at:__ @globals\/untagged.h 27:24@
+
+    __exported by:__ @globals\/untagged.h@
+
+    __unique:__ @test_globalsuntagged_Example_b@
+-}
+hs_bindgen_c84e7bea962cf7bc :: PtrConst.PtrConst B
+hs_bindgen_c84e7bea962cf7bc =
+  BG.unsafePerformIO hs_bindgen_38f1407628b3330b
+
+{-# NOINLINE b #-}
+b :: B
+b =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_c84e7bea962cf7bc)
+
+-- __unique:__ @test_globalsuntagged_Example_get_C@
+foreign import ccall unsafe "hs_bindgen_492f8d9f3437df29" hs_bindgen_492f8d9f3437df29_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_globalsuntagged_Example_get_C@
+hs_bindgen_492f8d9f3437df29 :: IO (BG.Ptr (PtrConst.PtrConst (IA.IncompleteArray (BG.Ptr C))))
+hs_bindgen_492f8d9f3437df29 =
+  fmap BG.fromFFIType hs_bindgen_492f8d9f3437df29_base
+
+{-# NOINLINE c #-}
+{-| __C declaration:__ @C@
+
+    __defined at:__ @globals\/untagged.h 30:29@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+c :: BG.Ptr (PtrConst.PtrConst (IA.IncompleteArray (BG.Ptr C)))
+c = BG.unsafePerformIO hs_bindgen_492f8d9f3437df29
diff --git a/test-artefacts/fixtures/globals/untagged/bindingspec.yaml b/test-artefacts/fixtures/globals/untagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/globals/untagged/bindingspec.yaml
@@ -0,0 +1,186 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: globals/untagged.h
+  cname: struct @untaggedPoint
+  hsname: UntaggedPoint
+- headers: globals/untagged.h
+  cname: struct @untaggedPair
+  hsname: UntaggedPair
+- headers: globals/untagged.h
+  cname: enum @untaggedEnum
+  hsname: UntaggedEnum
+  enum: open
+- headers: globals/untagged.h
+  cname: enum @untaggedEnumCoords
+  hsname: UntaggedEnumCoords
+  enum: open
+- headers: globals/untagged.h
+  cname: enum @A
+  hsname: A
+  enum: open
+- headers: globals/untagged.h
+  cname: union @B
+  hsname: B
+- headers: globals/untagged.h
+  cname: struct @C
+  hsname: C
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: C
+  representation:
+    record:
+      constructor: C
+      fields:
+      - c_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UntaggedEnum
+  representation:
+    newtype:
+      constructor: UntaggedEnum
+      fields:
+      - unwrapUntaggedEnum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UntaggedEnumCoords
+  representation:
+    newtype:
+      constructor: UntaggedEnumCoords
+      fields:
+      - unwrapUntaggedEnumCoords
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UntaggedPair
+  representation:
+    record:
+      constructor: UntaggedPair
+      fields:
+      - untaggedPair_a
+      - untaggedPair_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UntaggedPoint
+  representation:
+    record:
+      constructor: UntaggedPoint
+      fields:
+      - untaggedPoint_x
+      - untaggedPoint_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/globals/untagged/th.txt b/test-artefacts/fixtures/globals/untagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/globals/untagged/th.txt
@@ -0,0 +1,558 @@
+-- addDependentFile test-artefacts/headers/golden/globals/untagged.h
+-- #include <globals/untagged.h>
+-- /* test_globalsuntagged_Example_get_untaggedPoint */
+-- __attribute__ ((const))
+-- void *hs_bindgen_d77490b2fc5f4d07 (void)
+-- {
+--   return &untaggedPoint;
+-- }
+-- /* test_globalsuntagged_Example_get_untaggedPair */
+-- __attribute__ ((const))
+-- void *hs_bindgen_0c5d4010212a5c60 (void)
+-- {
+--   return &untaggedPair;
+-- }
+-- /* test_globalsuntagged_Example_get_untaggedEnum */
+-- __attribute__ ((const))
+-- void *hs_bindgen_6913d0b9652bbf6f (void)
+-- {
+--   return &untaggedEnum;
+-- }
+-- /* test_globalsuntagged_Example_get_untaggedEnumCoords */
+-- __attribute__ ((const))
+-- void *hs_bindgen_d7232446972b888a (void)
+-- {
+--   return &untaggedEnumCoords;
+-- }
+-- /* test_globalsuntagged_Example_get_A */
+-- __attribute__ ((const))
+-- void *hs_bindgen_9d7d1fc84d6966f1 (void)
+-- {
+--   return &A;
+-- }
+-- /* test_globalsuntagged_Example_get_B */
+-- __attribute__ ((const))
+-- void const *hs_bindgen_38f1407628b3330b (void)
+-- {
+--   return &B;
+-- }
+-- /* test_globalsuntagged_Example_get_C */
+-- __attribute__ ((const))
+-- void *hs_bindgen_492f8d9f3437df29 (void)
+-- {
+--   return &C;
+-- }
+{-| __C declaration:__ @struct \@untaggedPoint@
+
+    __defined at:__ @globals\/untagged.h 12:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+data UntaggedPoint
+    = UntaggedPoint {untaggedPoint_x :: CInt
+                     {- ^ __C declaration:__ @x@
+
+                          __defined at:__ @globals\/untagged.h 12:14@
+
+                          __exported by:__ @globals\/untagged.h@
+                     -},
+                     untaggedPoint_y :: CInt
+                     {- ^ __C declaration:__ @y@
+
+                          __defined at:__ @globals\/untagged.h 12:21@
+
+                          __exported by:__ @globals\/untagged.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UntaggedPoint
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UntaggedPoint
+    where readRaw = \ptr_0 -> (pure UntaggedPoint <*> readRaw (Proxy @"untaggedPoint_x") ptr_0) <*> readRaw (Proxy @"untaggedPoint_y") ptr_0
+instance WriteRaw UntaggedPoint
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UntaggedPoint untaggedPoint_x_2
+                                                     untaggedPoint_y_3 -> writeRaw (Proxy @"untaggedPoint_x") ptr_0 untaggedPoint_x_2 >> writeRaw (Proxy @"untaggedPoint_y") ptr_0 untaggedPoint_y_3
+deriving via (EquivStorable UntaggedPoint) instance Storable UntaggedPoint
+deriving via (IsStructViaReadRaw UntaggedPoint) instance IsStruct UntaggedPoint
+instance (~) ty CInt => HasField "untaggedPoint_x" UntaggedPoint ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedPoint{untaggedPoint_x = y_1,
+                                                    untaggedPoint_y = getField @"untaggedPoint_y" x_0},
+                              getField @"untaggedPoint_x" x_0)
+instance (~) ty CInt =>
+         HasField "untaggedPoint_x" (Ptr UntaggedPoint) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedPoint_x")
+instance HasCField UntaggedPoint "untaggedPoint_x"
+    where type CFieldType UntaggedPoint "untaggedPoint_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "untaggedPoint_y" UntaggedPoint ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedPoint{untaggedPoint_y = y_1,
+                                                    untaggedPoint_x = getField @"untaggedPoint_x" x_0},
+                              getField @"untaggedPoint_y" x_0)
+instance (~) ty CInt =>
+         HasField "untaggedPoint_y" (Ptr UntaggedPoint) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedPoint_y")
+instance HasCField UntaggedPoint "untaggedPoint_y"
+    where type CFieldType UntaggedPoint "untaggedPoint_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@untaggedPair@
+
+    __defined at:__ @globals\/untagged.h 14:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+data UntaggedPair
+    = UntaggedPair {untaggedPair_a :: CInt
+                    {- ^ __C declaration:__ @a@
+
+                         __defined at:__ @globals\/untagged.h 14:14@
+
+                         __exported by:__ @globals\/untagged.h@
+                    -},
+                    untaggedPair_b :: CInt
+                    {- ^ __C declaration:__ @b@
+
+                         __defined at:__ @globals\/untagged.h 14:21@
+
+                         __exported by:__ @globals\/untagged.h@
+                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UntaggedPair
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UntaggedPair
+    where readRaw = \ptr_0 -> (pure UntaggedPair <*> readRaw (Proxy @"untaggedPair_a") ptr_0) <*> readRaw (Proxy @"untaggedPair_b") ptr_0
+instance WriteRaw UntaggedPair
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UntaggedPair untaggedPair_a_2
+                                                    untaggedPair_b_3 -> writeRaw (Proxy @"untaggedPair_a") ptr_0 untaggedPair_a_2 >> writeRaw (Proxy @"untaggedPair_b") ptr_0 untaggedPair_b_3
+deriving via (EquivStorable UntaggedPair) instance Storable UntaggedPair
+deriving via (IsStructViaReadRaw UntaggedPair) instance IsStruct UntaggedPair
+instance (~) ty CInt => HasField "untaggedPair_a" UntaggedPair ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedPair{untaggedPair_a = y_1,
+                                                   untaggedPair_b = getField @"untaggedPair_b" x_0},
+                              getField @"untaggedPair_a" x_0)
+instance (~) ty CInt =>
+         HasField "untaggedPair_a" (Ptr UntaggedPair) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedPair_a")
+instance HasCField UntaggedPair "untaggedPair_a"
+    where type CFieldType UntaggedPair "untaggedPair_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "untaggedPair_b" UntaggedPair ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedPair{untaggedPair_b = y_1,
+                                                   untaggedPair_a = getField @"untaggedPair_a" x_0},
+                              getField @"untaggedPair_b" x_0)
+instance (~) ty CInt =>
+         HasField "untaggedPair_b" (Ptr UntaggedPair) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedPair_b")
+instance HasCField UntaggedPair "untaggedPair_b"
+    where type CFieldType UntaggedPair "untaggedPair_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @enum \@untaggedEnum@
+
+    __defined at:__ @globals\/untagged.h 16:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+newtype UntaggedEnum
+    = UntaggedEnum {unwrapUntaggedEnum :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize UntaggedEnum
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UntaggedEnum
+    where readRaw = \ptr_0 -> pure UntaggedEnum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw UntaggedEnum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UntaggedEnum unwrapUntaggedEnum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapUntaggedEnum_2
+deriving via (EquivStorable UntaggedEnum) instance Storable UntaggedEnum
+deriving via CUInt instance Prim UntaggedEnum
+instance CEnum UntaggedEnum
+    where type CEnumZ UntaggedEnum = CUInt
+          toCEnum = UntaggedEnum
+          fromCEnum = getField @"unwrapUntaggedEnum"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "VAL_A"),
+                                                         (1, singleton "VAL_B")]
+          showsUndeclared = showsWrappedUndeclared "UntaggedEnum"
+          readPrecUndeclared = readPrecWrappedUndeclared "UntaggedEnum"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum UntaggedEnum
+    where minDeclaredValue = VAL_A
+          maxDeclaredValue = VAL_B
+instance Show UntaggedEnum
+    where showsPrec = shows
+instance Read UntaggedEnum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt =>
+         HasField "unwrapUntaggedEnum" UntaggedEnum ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedEnum{unwrapUntaggedEnum = y_1},
+                              getField @"unwrapUntaggedEnum" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapUntaggedEnum" (Ptr UntaggedEnum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUntaggedEnum")
+instance HasCField UntaggedEnum "unwrapUntaggedEnum"
+    where type CFieldType UntaggedEnum "unwrapUntaggedEnum" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @VAL_A@
+
+    __defined at:__ @globals\/untagged.h 16:8@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern VAL_A :: UntaggedEnum
+pattern VAL_A = UntaggedEnum 0
+{-| __C declaration:__ @VAL_B@
+
+    __defined at:__ @globals\/untagged.h 16:19@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern VAL_B :: UntaggedEnum
+pattern VAL_B = UntaggedEnum 1
+{-| __C declaration:__ @enum \@untaggedEnumCoords@
+
+    __defined at:__ @globals\/untagged.h 18:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+newtype UntaggedEnumCoords
+    = UntaggedEnumCoords {unwrapUntaggedEnumCoords :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize UntaggedEnumCoords
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UntaggedEnumCoords
+    where readRaw = \ptr_0 -> pure UntaggedEnumCoords <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw UntaggedEnumCoords
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UntaggedEnumCoords unwrapUntaggedEnumCoords_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapUntaggedEnumCoords_2
+deriving via (EquivStorable UntaggedEnumCoords) instance Storable UntaggedEnumCoords
+deriving via CUInt instance Prim UntaggedEnumCoords
+instance CEnum UntaggedEnumCoords
+    where type CEnumZ UntaggedEnumCoords = CUInt
+          toCEnum = UntaggedEnumCoords
+          fromCEnum = getField @"unwrapUntaggedEnumCoords"
+          declaredValues = \_ -> declaredValuesFromList [(10, singleton "X"),
+                                                         (20, singleton "Y"),
+                                                         (30, singleton "Z")]
+          showsUndeclared = showsWrappedUndeclared "UntaggedEnumCoords"
+          readPrecUndeclared = readPrecWrappedUndeclared "UntaggedEnumCoords"
+instance Show UntaggedEnumCoords
+    where showsPrec = shows
+instance Read UntaggedEnumCoords
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt =>
+         HasField "unwrapUntaggedEnumCoords" UntaggedEnumCoords ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedEnumCoords{unwrapUntaggedEnumCoords = y_1},
+                              getField @"unwrapUntaggedEnumCoords" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapUntaggedEnumCoords"
+                  (Ptr UntaggedEnumCoords)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUntaggedEnumCoords")
+instance HasCField UntaggedEnumCoords "unwrapUntaggedEnumCoords"
+    where type CFieldType UntaggedEnumCoords
+                          "unwrapUntaggedEnumCoords" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @X@
+
+    __defined at:__ @globals\/untagged.h 18:8@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern X :: UntaggedEnumCoords
+pattern X = UntaggedEnumCoords 10
+{-| __C declaration:__ @Y@
+
+    __defined at:__ @globals\/untagged.h 18:16@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern Y :: UntaggedEnumCoords
+pattern Y = UntaggedEnumCoords 20
+{-| __C declaration:__ @Z@
+
+    __defined at:__ @globals\/untagged.h 18:24@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern Z :: UntaggedEnumCoords
+pattern Z = UntaggedEnumCoords 30
+{-| __C declaration:__ @enum \@A@
+
+    __defined at:__ @globals\/untagged.h 24:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+newtype A
+    = A {unwrapA :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize A
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw A
+    where readRaw = \ptr_0 -> pure A <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw A
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       A unwrapA_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapA_2
+deriving via (EquivStorable A) instance Storable A
+deriving via CUInt instance Prim A
+instance CEnum A
+    where type CEnumZ A = CUInt
+          toCEnum = A
+          fromCEnum = getField @"unwrapA"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "A1")]
+          showsUndeclared = showsWrappedUndeclared "A"
+          readPrecUndeclared = readPrecWrappedUndeclared "A"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum A
+    where minDeclaredValue = A1
+          maxDeclaredValue = A1
+instance Show A
+    where showsPrec = shows
+instance Read A
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty CUInt => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @a1@
+
+    __defined at:__ @globals\/untagged.h 24:8@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+pattern A1 :: A
+pattern A1 = A 0
+{-| __C declaration:__ @union \@B@
+
+    __defined at:__ @globals\/untagged.h 27:7@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+newtype B = B {unwrapB :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize B
+deriving via (SizedByteArray 4 4) instance ReadRaw B
+deriving via (SizedByteArray 4 4) instance WriteRaw B
+deriving via (EquivStorable B) instance Storable B
+deriving via (SizedByteArray 4 4) instance IsUnion B
+instance (~) ty CInt => HasField "b_x" B ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "b_x" B ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"b_x" x_0)
+instance (~) ty CInt => HasField "b_x" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"b_x")
+instance HasCField B "b_x"
+    where type CFieldType B "b_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@C@
+
+    __defined at:__ @globals\/untagged.h 30:1@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+data C
+    = C {c_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @globals\/untagged.h 30:14@
+
+              __exported by:__ @globals\/untagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize C
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw C
+    where readRaw = \ptr_0 -> pure C <*> readRaw (Proxy @"c_x") ptr_0
+instance WriteRaw C
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       C c_x_2 -> writeRaw (Proxy @"c_x") ptr_0 c_x_2
+deriving via (EquivStorable C) instance Storable C
+deriving via (IsStructViaReadRaw C) instance IsStruct C
+instance (~) ty CInt => HasField "c_x" C ty
+    where hasField = \x_0 -> (\y_1 -> C{c_x = y_1},
+                              getField @"c_x" x_0)
+instance (~) ty CInt => HasField "c_x" (Ptr C) (Ptr ty)
+    where getField = fromPtr (Proxy @"c_x")
+instance HasCField C "c_x"
+    where type CFieldType C "c_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPoint@
+foreign import ccall unsafe "hs_bindgen_d77490b2fc5f4d07" hs_bindgen_d77490b2fc5f4d07_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPoint@
+hs_bindgen_d77490b2fc5f4d07 :: IO (Ptr UntaggedPoint)
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPoint@
+hs_bindgen_d77490b2fc5f4d07 = fmap fromFFIType hs_bindgen_d77490b2fc5f4d07_base
+{-# NOINLINE untaggedPoint #-}
+{-| __C declaration:__ @untaggedPoint@
+
+    __defined at:__ @globals\/untagged.h 12:26@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedPoint :: Ptr UntaggedPoint
+{-| __C declaration:__ @untaggedPoint@
+
+    __defined at:__ @globals\/untagged.h 12:26@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedPoint = unsafePerformIO hs_bindgen_d77490b2fc5f4d07
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPair@
+foreign import ccall unsafe "hs_bindgen_0c5d4010212a5c60" hs_bindgen_0c5d4010212a5c60_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPair@
+hs_bindgen_0c5d4010212a5c60 :: IO (Ptr UntaggedPair)
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedPair@
+hs_bindgen_0c5d4010212a5c60 = fmap fromFFIType hs_bindgen_0c5d4010212a5c60_base
+{-# NOINLINE untaggedPair #-}
+{-| __C declaration:__ @untaggedPair@
+
+    __defined at:__ @globals\/untagged.h 14:26@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedPair :: Ptr UntaggedPair
+{-| __C declaration:__ @untaggedPair@
+
+    __defined at:__ @globals\/untagged.h 14:26@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedPair = unsafePerformIO hs_bindgen_0c5d4010212a5c60
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnum@
+foreign import ccall unsafe "hs_bindgen_6913d0b9652bbf6f" hs_bindgen_6913d0b9652bbf6f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnum@
+hs_bindgen_6913d0b9652bbf6f :: IO (Ptr UntaggedEnum)
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnum@
+hs_bindgen_6913d0b9652bbf6f = fmap fromFFIType hs_bindgen_6913d0b9652bbf6f_base
+{-# NOINLINE untaggedEnum #-}
+{-| __C declaration:__ @untaggedEnum@
+
+    __defined at:__ @globals\/untagged.h 16:31@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedEnum :: Ptr UntaggedEnum
+{-| __C declaration:__ @untaggedEnum@
+
+    __defined at:__ @globals\/untagged.h 16:31@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedEnum = unsafePerformIO hs_bindgen_6913d0b9652bbf6f
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnumCoords@
+foreign import ccall unsafe "hs_bindgen_d7232446972b888a" hs_bindgen_d7232446972b888a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnumCoords@
+hs_bindgen_d7232446972b888a :: IO (Ptr UntaggedEnumCoords)
+-- __unique:__ @test_globalsuntagged_Example_get_untaggedEnumCoords@
+hs_bindgen_d7232446972b888a = fmap fromFFIType hs_bindgen_d7232446972b888a_base
+{-# NOINLINE untaggedEnumCoords #-}
+{-| __C declaration:__ @untaggedEnumCoords@
+
+    __defined at:__ @globals\/untagged.h 18:33@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedEnumCoords :: Ptr UntaggedEnumCoords
+{-| __C declaration:__ @untaggedEnumCoords@
+
+    __defined at:__ @globals\/untagged.h 18:33@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+untaggedEnumCoords = unsafePerformIO hs_bindgen_d7232446972b888a
+-- __unique:__ @test_globalsuntagged_Example_get_A@
+foreign import ccall unsafe "hs_bindgen_9d7d1fc84d6966f1" hs_bindgen_9d7d1fc84d6966f1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsuntagged_Example_get_A@
+hs_bindgen_9d7d1fc84d6966f1 :: IO (Ptr (ConstantArray 17 A))
+-- __unique:__ @test_globalsuntagged_Example_get_A@
+hs_bindgen_9d7d1fc84d6966f1 = fmap fromFFIType hs_bindgen_9d7d1fc84d6966f1_base
+{-# NOINLINE a #-}
+{-| __C declaration:__ @A@
+
+    __defined at:__ @globals\/untagged.h 24:13@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+a :: Ptr (ConstantArray 17 A)
+{-| __C declaration:__ @A@
+
+    __defined at:__ @globals\/untagged.h 24:13@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+a = unsafePerformIO hs_bindgen_9d7d1fc84d6966f1
+-- __unique:__ @test_globalsuntagged_Example_get_B@
+foreign import ccall unsafe "hs_bindgen_38f1407628b3330b" hs_bindgen_38f1407628b3330b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsuntagged_Example_get_B@
+hs_bindgen_38f1407628b3330b :: IO (PtrConst B)
+-- __unique:__ @test_globalsuntagged_Example_get_B@
+hs_bindgen_38f1407628b3330b = fmap fromFFIType hs_bindgen_38f1407628b3330b_base
+{-# NOINLINE hs_bindgen_c84e7bea962cf7bc #-}
+{-| __C declaration:__ @B@
+
+    __defined at:__ @globals\/untagged.h 27:24@
+
+    __exported by:__ @globals\/untagged.h@
+
+    __unique:__ @test_globalsuntagged_Example_b@
+-}
+hs_bindgen_c84e7bea962cf7bc :: PtrConst B
+{-| __C declaration:__ @B@
+
+    __defined at:__ @globals\/untagged.h 27:24@
+
+    __exported by:__ @globals\/untagged.h@
+
+    __unique:__ @test_globalsuntagged_Example_b@
+-}
+hs_bindgen_c84e7bea962cf7bc = unsafePerformIO hs_bindgen_38f1407628b3330b
+{-# NOINLINE b #-}
+b :: B
+b = unsafePerformIO (peek hs_bindgen_c84e7bea962cf7bc)
+-- __unique:__ @test_globalsuntagged_Example_get_C@
+foreign import ccall unsafe "hs_bindgen_492f8d9f3437df29" hs_bindgen_492f8d9f3437df29_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_globalsuntagged_Example_get_C@
+hs_bindgen_492f8d9f3437df29 :: IO (Ptr (PtrConst (IncompleteArray (Ptr C))))
+-- __unique:__ @test_globalsuntagged_Example_get_C@
+hs_bindgen_492f8d9f3437df29 = fmap fromFFIType hs_bindgen_492f8d9f3437df29_base
+{-# NOINLINE c #-}
+{-| __C declaration:__ @C@
+
+    __defined at:__ @globals\/untagged.h 30:29@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+c :: Ptr (PtrConst (IncompleteArray (Ptr C)))
+{-| __C declaration:__ @C@
+
+    __defined at:__ @globals\/untagged.h 30:29@
+
+    __exported by:__ @globals\/untagged.h@
+-}
+c = unsafePerformIO hs_bindgen_492f8d9f3437df29
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.1.empty/Example.hs b/test-artefacts/fixtures/macros/command_line/redefined.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.1.empty/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+         __exported by:__ @macros\/command_line\/redefined.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/redefined.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.1.empty/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/redefined.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.1.empty/th.txt b/test-artefacts/fixtures/macros/command_line/redefined.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.1.empty/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/redefined.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+              __exported by:__ @macros\/command_line\/redefined.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.2.raw/Example.hs b/test-artefacts/fixtures/macros/command_line/redefined.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.2.raw/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+         __exported by:__ @macros\/command_line\/redefined.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/redefined.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.2.raw/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/redefined.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.2.raw/th.txt b/test-artefacts/fixtures/macros/command_line/redefined.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.2.raw/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/redefined.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+              __exported by:__ @macros\/command_line\/redefined.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.hash_define.1.empty/Example.hs b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.1.empty/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+         __exported by:__ @macros\/command_line\/redefined.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.hash_define.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.1.empty/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/redefined.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.hash_define.1.empty/th.txt b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.1.empty/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/redefined.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+              __exported by:__ @macros\/command_line\/redefined.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.hash_define.2.raw/Example.hs b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.2.raw/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+         __exported by:__ @macros\/command_line\/redefined.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.hash_define.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.2.raw/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/redefined.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.hash_define.2.raw/th.txt b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.hash_define.2.raw/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/redefined.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+              __exported by:__ @macros\/command_line\/redefined.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.hash_define/Example.hs b/test-artefacts/fixtures/macros/command_line/redefined.hash_define/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.hash_define/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+         __exported by:__ @macros\/command_line\/redefined.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.hash_define/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/redefined.hash_define/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.hash_define/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/redefined.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/redefined.hash_define/th.txt b/test-artefacts/fixtures/macros/command_line/redefined.hash_define/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined.hash_define/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/redefined.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+              __exported by:__ @macros\/command_line\/redefined.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined/Example.hs b/test-artefacts/fixtures/macros/command_line/redefined/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+         __exported by:__ @macros\/command_line\/redefined.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/redefined/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/redefined/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/redefined.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/redefined/th.txt b/test-artefacts/fixtures/macros/command_line/redefined/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/redefined/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/redefined.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/redefined.h 9:8@
+
+    __exported by:__ @macros\/command_line\/redefined.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/redefined.h 9:14@
+
+              __exported by:__ @macros\/command_line\/redefined.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/uses.1.empty/Example.hs b/test-artefacts/fixtures/macros/command_line/uses.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.1.empty/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+         __exported by:__ @macros\/command_line\/uses.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/uses.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/uses.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.1.empty/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/uses.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/uses.1.empty/th.txt b/test-artefacts/fixtures/macros/command_line/uses.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.1.empty/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/uses.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+              __exported by:__ @macros\/command_line\/uses.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/uses.2.raw/Example.hs b/test-artefacts/fixtures/macros/command_line/uses.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.2.raw/Example.hs
@@ -0,0 +1,101 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    , Example.w
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+         __exported by:__ @macros\/command_line\/uses.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro W@
+
+    __defined at:__ @macros\/command_line\/uses.h 9:9@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+w :: Macro.Raw String
+w = Macro.objectLike "W" ["F", "(", "V", ")"]
diff --git a/test-artefacts/fixtures/macros/command_line/uses.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/uses.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.2.raw/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/uses.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/uses.2.raw/th.txt b/test-artefacts/fixtures/macros/command_line/uses.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.2.raw/th.txt
@@ -0,0 +1,48 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/uses.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+              __exported by:__ @macros\/command_line\/uses.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro W@
+
+    __defined at:__ @macros\/command_line\/uses.h 9:9@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+w :: Raw String
+{-| __C declaration:__ @macro W@
+
+    __defined at:__ @macros\/command_line\/uses.h 9:9@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+w = objectLike "W" ["F", "(", "V", ")"]
diff --git a/test-artefacts/fixtures/macros/command_line/uses.no_slicing.1.empty/Example.hs b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.1.empty/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+         __exported by:__ @macros\/command_line\/uses.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/uses.no_slicing.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.1.empty/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/uses.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/uses.no_slicing.1.empty/th.txt b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.1.empty/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/uses.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+              __exported by:__ @macros\/command_line\/uses.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/command_line/uses.no_slicing.2.raw/Example.hs b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.2.raw/Example.hs
@@ -0,0 +1,101 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    , Example.w
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+         __exported by:__ @macros\/command_line\/uses.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro W@
+
+    __defined at:__ @macros\/command_line\/uses.h 9:9@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+w :: Macro.Raw String
+w = Macro.objectLike "W" ["F", "(", "V", ")"]
diff --git a/test-artefacts/fixtures/macros/command_line/uses.no_slicing.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.2.raw/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/uses.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/uses.no_slicing.2.raw/th.txt b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.no_slicing.2.raw/th.txt
@@ -0,0 +1,48 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/uses.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+              __exported by:__ @macros\/command_line\/uses.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro W@
+
+    __defined at:__ @macros\/command_line\/uses.h 9:9@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+w :: Raw String
+{-| __C declaration:__ @macro W@
+
+    __defined at:__ @macros\/command_line\/uses.h 9:9@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+w = objectLike "W" ["F", "(", "V", ")"]
diff --git a/test-artefacts/fixtures/macros/command_line/uses.no_slicing/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/uses.no_slicing/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.no_slicing/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/command_line/uses.no_slicing/th.txt b/test-artefacts/fixtures/macros/command_line/uses.no_slicing/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses.no_slicing/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/uses.h
diff --git a/test-artefacts/fixtures/macros/command_line/uses/Example.hs b/test-artefacts/fixtures/macros/command_line/uses/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses/Example.hs
@@ -0,0 +1,163 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , Example.v
+    , Example.f
+    , Example.S(..)
+    , Example.w
+    )
+  where
+
+import qualified C.Expr.HostPlatform
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @command line@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @command line@
+-}
+v :: BG.CInt
+v = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @command line@
+-}
+f :: forall a0. C.Expr.HostPlatform.Add a0 BG.CInt => a0 -> C.Expr.HostPlatform.AddRes a0 BG.CInt
+f = \x0 -> (C.Expr.HostPlatform.+) x0 (1 :: BG.CInt)
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S = S
+  { s_x :: T
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+         __exported by:__ @macros\/command_line\/uses.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ T) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro W@
+
+    __defined at:__ @macros\/command_line\/uses.h 9:9@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+w :: BG.CInt
+w = f v
diff --git a/test-artefacts/fixtures/macros/command_line/uses/bindingspec.yaml b/test-artefacts/fixtures/macros/command_line/uses/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/command_line/uses.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/command_line/uses/th.txt b/test-artefacts/fixtures/macros/command_line/uses/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/command_line/uses/th.txt
@@ -0,0 +1,98 @@
+-- addDependentFile test-artefacts/headers/golden/macros/command_line/uses.h
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @command line@
+-}
+newtype T
+    = T {unwrapT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @command line@
+-}
+v :: CInt
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @command line@
+-}
+v = 1 :: CInt
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @command line@
+-}
+f :: forall a_0 . Add a_0 CInt => a_0 -> AddRes a_0 CInt
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @command line@
+-}
+f = \x_0 -> (+) x_0 (1 :: CInt)
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/command_line\/uses.h 7:8@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+data S
+    = S {s_x :: T
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/command_line\/uses.h 7:14@
+
+              __exported by:__ @macros\/command_line\/uses.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty T => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty T => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro W@
+
+    __defined at:__ @macros\/command_line\/uses.h 9:9@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+w :: CInt
+{-| __C declaration:__ @macro W@
+
+    __defined at:__ @macros\/command_line\/uses.h 9:9@
+
+    __exported by:__ @macros\/command_line\/uses.h@
+-}
+w = f v
diff --git a/test-artefacts/fixtures/macros/empty_body.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/empty_body.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/empty_body.1.empty/th.txt b/test-artefacts/fixtures/macros/empty_body.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/empty_body.h
diff --git a/test-artefacts/fixtures/macros/empty_body.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/empty_body.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/empty_body.2.raw/th.txt b/test-artefacts/fixtures/macros/empty_body.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.2.raw/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/empty_body.h
diff --git a/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.1.empty/th.txt b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/empty_body.h
diff --git a/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.2.raw/Example.hs b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.2.raw/Example.hs
@@ -0,0 +1,51 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.eMPTY_OBJECT
+    , Example.eMPTY_FUNCTION
+    , Example.eMPTY_FUNCTION_PARAMS
+    , Example.eMPTY_FUNCTION_VARIADIC
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro EMPTY_OBJECT@
+
+    __defined at:__ @macros\/empty_body.h 9:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_OBJECT :: Macro.Raw String
+eMPTY_OBJECT = Macro.objectLike "EMPTY_OBJECT" []
+
+{-| __C declaration:__ @macro EMPTY_FUNCTION@
+
+    __defined at:__ @macros\/empty_body.h 10:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_FUNCTION :: Macro.Raw String
+eMPTY_FUNCTION =
+  Macro.functionLike "EMPTY_FUNCTION" [] []
+
+{-| __C declaration:__ @macro EMPTY_FUNCTION_PARAMS@
+
+    __defined at:__ @macros\/empty_body.h 11:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_FUNCTION_PARAMS :: Macro.Raw String
+eMPTY_FUNCTION_PARAMS =
+  Macro.functionLike "EMPTY_FUNCTION_PARAMS" ["x", "y"] []
+
+{-| __C declaration:__ @macro EMPTY_FUNCTION_VARIADIC@
+
+    __defined at:__ @macros\/empty_body.h 12:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_FUNCTION_VARIADIC :: Macro.Raw String
+eMPTY_FUNCTION_VARIADIC =
+  Macro.variadic "EMPTY_FUNCTION_VARIADIC" ["x"] []
diff --git a/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.2.raw/th.txt b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros.2.raw/th.txt
@@ -0,0 +1,58 @@
+-- addDependentFile test-artefacts/headers/golden/macros/empty_body.h
+{-| __C declaration:__ @macro EMPTY_OBJECT@
+
+    __defined at:__ @macros\/empty_body.h 9:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_OBJECT :: Raw String
+{-| __C declaration:__ @macro EMPTY_OBJECT@
+
+    __defined at:__ @macros\/empty_body.h 9:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_OBJECT = objectLike "EMPTY_OBJECT" []
+{-| __C declaration:__ @macro EMPTY_FUNCTION@
+
+    __defined at:__ @macros\/empty_body.h 10:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_FUNCTION :: Raw String
+{-| __C declaration:__ @macro EMPTY_FUNCTION@
+
+    __defined at:__ @macros\/empty_body.h 10:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_FUNCTION = functionLike "EMPTY_FUNCTION" [] []
+{-| __C declaration:__ @macro EMPTY_FUNCTION_PARAMS@
+
+    __defined at:__ @macros\/empty_body.h 11:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_FUNCTION_PARAMS :: Raw String
+{-| __C declaration:__ @macro EMPTY_FUNCTION_PARAMS@
+
+    __defined at:__ @macros\/empty_body.h 11:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_FUNCTION_PARAMS = functionLike "EMPTY_FUNCTION_PARAMS" ["x",
+                                                              "y"] []
+{-| __C declaration:__ @macro EMPTY_FUNCTION_VARIADIC@
+
+    __defined at:__ @macros\/empty_body.h 12:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_FUNCTION_VARIADIC :: Raw String
+{-| __C declaration:__ @macro EMPTY_FUNCTION_VARIADIC@
+
+    __defined at:__ @macros\/empty_body.h 12:9@
+
+    __exported by:__ @macros\/empty_body.h@
+-}
+eMPTY_FUNCTION_VARIADIC = variadic "EMPTY_FUNCTION_VARIADIC" ["x"] []
diff --git a/test-artefacts/fixtures/macros/empty_body.parse_empty_macros/bindingspec.yaml b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/empty_body.parse_empty_macros/th.txt b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body.parse_empty_macros/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/empty_body.h
diff --git a/test-artefacts/fixtures/macros/empty_body/bindingspec.yaml b/test-artefacts/fixtures/macros/empty_body/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/empty_body/th.txt b/test-artefacts/fixtures/macros/empty_body/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/empty_body/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/empty_body.h
diff --git a/test-artefacts/fixtures/macros/gnu_variadic.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/gnu_variadic.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/gnu_variadic.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/gnu_variadic.1.empty/th.txt b/test-artefacts/fixtures/macros/gnu_variadic.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/gnu_variadic.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/gnu_variadic.h
diff --git a/test-artefacts/fixtures/macros/gnu_variadic.2.raw/Example.hs b/test-artefacts/fixtures/macros/gnu_variadic.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/gnu_variadic.2.raw/Example.hs
@@ -0,0 +1,41 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.c99_VARIADIC
+    , Example.gNU_VARIADIC
+    , Example.gNU_VARIADIC_ONLY
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro C99_VARIADIC@
+
+    __defined at:__ @macros\/gnu_variadic.h 9:9@
+
+    __exported by:__ @macros\/gnu_variadic.h@
+-}
+c99_VARIADIC :: Macro.Raw String
+c99_VARIADIC =
+  Macro.variadic "C99_VARIADIC" ["fmt"] ["fmt"]
+
+{-| __C declaration:__ @macro GNU_VARIADIC@
+
+    __defined at:__ @macros\/gnu_variadic.h 11:9@
+
+    __exported by:__ @macros\/gnu_variadic.h@
+-}
+gNU_VARIADIC :: Macro.Raw String
+gNU_VARIADIC =
+  Macro.variadicNamed "GNU_VARIADIC" ["fmt"] "args" ["args"]
+
+{-| __C declaration:__ @macro GNU_VARIADIC_ONLY@
+
+    __defined at:__ @macros\/gnu_variadic.h 13:9@
+
+    __exported by:__ @macros\/gnu_variadic.h@
+-}
+gNU_VARIADIC_ONLY :: Macro.Raw String
+gNU_VARIADIC_ONLY =
+  Macro.variadicNamed "GNU_VARIADIC_ONLY" [] "args" ["args"]
diff --git a/test-artefacts/fixtures/macros/gnu_variadic.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/gnu_variadic.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/gnu_variadic.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/gnu_variadic.2.raw/th.txt b/test-artefacts/fixtures/macros/gnu_variadic.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/gnu_variadic.2.raw/th.txt
@@ -0,0 +1,43 @@
+-- addDependentFile test-artefacts/headers/golden/macros/gnu_variadic.h
+{-| __C declaration:__ @macro C99_VARIADIC@
+
+    __defined at:__ @macros\/gnu_variadic.h 9:9@
+
+    __exported by:__ @macros\/gnu_variadic.h@
+-}
+c99_VARIADIC :: Raw String
+{-| __C declaration:__ @macro C99_VARIADIC@
+
+    __defined at:__ @macros\/gnu_variadic.h 9:9@
+
+    __exported by:__ @macros\/gnu_variadic.h@
+-}
+c99_VARIADIC = variadic "C99_VARIADIC" ["fmt"] ["fmt"]
+{-| __C declaration:__ @macro GNU_VARIADIC@
+
+    __defined at:__ @macros\/gnu_variadic.h 11:9@
+
+    __exported by:__ @macros\/gnu_variadic.h@
+-}
+gNU_VARIADIC :: Raw String
+{-| __C declaration:__ @macro GNU_VARIADIC@
+
+    __defined at:__ @macros\/gnu_variadic.h 11:9@
+
+    __exported by:__ @macros\/gnu_variadic.h@
+-}
+gNU_VARIADIC = variadicNamed "GNU_VARIADIC" ["fmt"] "args" ["args"]
+{-| __C declaration:__ @macro GNU_VARIADIC_ONLY@
+
+    __defined at:__ @macros\/gnu_variadic.h 13:9@
+
+    __exported by:__ @macros\/gnu_variadic.h@
+-}
+gNU_VARIADIC_ONLY :: Raw String
+{-| __C declaration:__ @macro GNU_VARIADIC_ONLY@
+
+    __defined at:__ @macros\/gnu_variadic.h 13:9@
+
+    __exported by:__ @macros\/gnu_variadic.h@
+-}
+gNU_VARIADIC_ONLY = variadicNamed "GNU_VARIADIC_ONLY" [] "args" ["args"]
diff --git a/test-artefacts/fixtures/macros/gnu_variadic/bindingspec.yaml b/test-artefacts/fixtures/macros/gnu_variadic/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/gnu_variadic/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/gnu_variadic/th.txt b/test-artefacts/fixtures/macros/gnu_variadic/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/gnu_variadic/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/gnu_variadic.h
diff --git a/test-artefacts/fixtures/macros/issue_890.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/issue_890.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/issue_890.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/issue_890.1.empty/th.txt b/test-artefacts/fixtures/macros/issue_890.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/issue_890.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/issue_890.h
diff --git a/test-artefacts/fixtures/macros/issue_890.2.raw/Example.hs b/test-artefacts/fixtures/macros/issue_890.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/issue_890.2.raw/Example.hs
@@ -0,0 +1,59 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.a
+    , Example.b
+    , Example.c
+    , Example.d
+    , Example.e
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/issue_890.h 1:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+a :: Macro.Raw String
+a = Macro.objectLike "A" ["0"]
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/issue_890.h 2:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+b :: Macro.Raw String
+b =
+  Macro.functionLike "B" ["x"] ["(", "x", "+", "1", ")"]
+
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/issue_890.h 3:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+c :: Macro.Raw String
+c = Macro.objectLike "C" ["B", "(", "0", ")"]
+
+{-| __C declaration:__ @macro D@
+
+    __defined at:__ @macros\/issue_890.h 4:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+d :: Macro.Raw String
+d = Macro.objectLike "D" ["B", "(", "A", ")"]
+
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @macros\/issue_890.h 5:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+e :: Macro.Raw String
+e = Macro.objectLike "E" ["B", "(", "1", ")"]
diff --git a/test-artefacts/fixtures/macros/issue_890.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/issue_890.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/issue_890.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/issue_890.2.raw/th.txt b/test-artefacts/fixtures/macros/issue_890.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/issue_890.2.raw/th.txt
@@ -0,0 +1,71 @@
+-- addDependentFile test-artefacts/headers/golden/macros/issue_890.h
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/issue_890.h 1:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+a :: Raw String
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/issue_890.h 1:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+a = objectLike "A" ["0"]
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/issue_890.h 2:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+b :: Raw String
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/issue_890.h 2:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+b = functionLike "B" ["x"] ["(", "x", "+", "1", ")"]
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/issue_890.h 3:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+c :: Raw String
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/issue_890.h 3:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+c = objectLike "C" ["B", "(", "0", ")"]
+{-| __C declaration:__ @macro D@
+
+    __defined at:__ @macros\/issue_890.h 4:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+d :: Raw String
+{-| __C declaration:__ @macro D@
+
+    __defined at:__ @macros\/issue_890.h 4:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+d = objectLike "D" ["B", "(", "A", ")"]
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @macros\/issue_890.h 5:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+e :: Raw String
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @macros\/issue_890.h 5:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+e = objectLike "E" ["B", "(", "1", ")"]
diff --git a/test-artefacts/fixtures/macros/issue_890/Example.hs b/test-artefacts/fixtures/macros/issue_890/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/issue_890/Example.hs
@@ -0,0 +1,60 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.a
+    , Example.b
+    , Example.c
+    , Example.d
+    , Example.e
+    )
+  where
+
+import qualified C.Expr.HostPlatform
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/issue_890.h 1:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+a :: BG.CInt
+a = (0 :: BG.CInt)
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/issue_890.h 2:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+b :: forall a0. C.Expr.HostPlatform.Add a0 BG.CInt => a0 -> C.Expr.HostPlatform.AddRes a0 BG.CInt
+b = \x0 -> (C.Expr.HostPlatform.+) x0 (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/issue_890.h 3:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+c :: BG.CInt
+c = b (0 :: BG.CInt)
+
+{-| __C declaration:__ @macro D@
+
+    __defined at:__ @macros\/issue_890.h 4:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+d :: BG.CInt
+d = b a
+
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @macros\/issue_890.h 5:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+e :: BG.CInt
+e = b (1 :: BG.CInt)
diff --git a/test-artefacts/fixtures/macros/issue_890/bindingspec.yaml b/test-artefacts/fixtures/macros/issue_890/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/issue_890/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/issue_890/th.txt b/test-artefacts/fixtures/macros/issue_890/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/issue_890/th.txt
@@ -0,0 +1,71 @@
+-- addDependentFile test-artefacts/headers/golden/macros/issue_890.h
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/issue_890.h 1:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+a :: CInt
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/issue_890.h 1:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+a = 0 :: CInt
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/issue_890.h 2:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+b :: forall a_0 . Add a_0 CInt => a_0 -> AddRes a_0 CInt
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/issue_890.h 2:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+b = \x_0 -> (+) x_0 (1 :: CInt)
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/issue_890.h 3:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+c :: CInt
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/issue_890.h 3:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+c = b (0 :: CInt)
+{-| __C declaration:__ @macro D@
+
+    __defined at:__ @macros\/issue_890.h 4:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+d :: CInt
+{-| __C declaration:__ @macro D@
+
+    __defined at:__ @macros\/issue_890.h 4:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+d = b a
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @macros\/issue_890.h 5:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+e :: CInt
+{-| __C declaration:__ @macro E@
+
+    __defined at:__ @macros\/issue_890.h 5:9@
+
+    __exported by:__ @macros\/issue_890.h@
+-}
+e = b (1 :: CInt)
diff --git a/test-artefacts/fixtures/macros/keyword_params.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/keyword_params.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/keyword_params.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/keyword_params.1.empty/th.txt b/test-artefacts/fixtures/macros/keyword_params.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/keyword_params.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/keyword_params.h
diff --git a/test-artefacts/fixtures/macros/keyword_params.2.raw/Example.hs b/test-artefacts/fixtures/macros/keyword_params.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/keyword_params.2.raw/Example.hs
@@ -0,0 +1,40 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.iD_INT
+    , Example.aDD_SIZEOF
+    , Example.fST_CONST
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro ID_INT@
+
+    __defined at:__ @macros\/keyword_params.h 9:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+iD_INT :: Macro.Raw String
+iD_INT = Macro.functionLike "ID_INT" ["int"] ["int"]
+
+{-| __C declaration:__ @macro ADD_SIZEOF@
+
+    __defined at:__ @macros\/keyword_params.h 10:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+aDD_SIZEOF :: Macro.Raw String
+aDD_SIZEOF =
+  Macro.functionLike "ADD_SIZEOF" ["sizeof", "x"] ["sizeof", "+", "x"]
+
+{-| __C declaration:__ @macro FST_CONST@
+
+    __defined at:__ @macros\/keyword_params.h 11:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+fST_CONST :: Macro.Raw String
+fST_CONST =
+  Macro.functionLike "FST_CONST" ["const", "volatile"] ["const"]
diff --git a/test-artefacts/fixtures/macros/keyword_params.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/keyword_params.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/keyword_params.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/keyword_params.2.raw/th.txt b/test-artefacts/fixtures/macros/keyword_params.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/keyword_params.2.raw/th.txt
@@ -0,0 +1,46 @@
+-- addDependentFile test-artefacts/headers/golden/macros/keyword_params.h
+{-| __C declaration:__ @macro ID_INT@
+
+    __defined at:__ @macros\/keyword_params.h 9:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+iD_INT :: Raw String
+{-| __C declaration:__ @macro ID_INT@
+
+    __defined at:__ @macros\/keyword_params.h 9:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+iD_INT = functionLike "ID_INT" ["int"] ["int"]
+{-| __C declaration:__ @macro ADD_SIZEOF@
+
+    __defined at:__ @macros\/keyword_params.h 10:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+aDD_SIZEOF :: Raw String
+{-| __C declaration:__ @macro ADD_SIZEOF@
+
+    __defined at:__ @macros\/keyword_params.h 10:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+aDD_SIZEOF = functionLike "ADD_SIZEOF" ["sizeof", "x"] ["sizeof",
+                                                        "+",
+                                                        "x"]
+{-| __C declaration:__ @macro FST_CONST@
+
+    __defined at:__ @macros\/keyword_params.h 11:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+fST_CONST :: Raw String
+{-| __C declaration:__ @macro FST_CONST@
+
+    __defined at:__ @macros\/keyword_params.h 11:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+fST_CONST = functionLike "FST_CONST" ["const",
+                                      "volatile"] ["const"]
diff --git a/test-artefacts/fixtures/macros/keyword_params/Example.hs b/test-artefacts/fixtures/macros/keyword_params/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/keyword_params/Example.hs
@@ -0,0 +1,40 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.iD_INT
+    , Example.aDD_SIZEOF
+    , Example.fST_CONST
+    )
+  where
+
+import qualified C.Expr.HostPlatform
+
+{-| __C declaration:__ @macro ID_INT@
+
+    __defined at:__ @macros\/keyword_params.h 9:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+iD_INT :: forall a0. a0 -> a0
+iD_INT = \int0 -> int0
+
+{-| __C declaration:__ @macro ADD_SIZEOF@
+
+    __defined at:__ @macros\/keyword_params.h 10:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+aDD_SIZEOF :: forall a0 b1. C.Expr.HostPlatform.Add a0 b1 => a0 -> b1 -> C.Expr.HostPlatform.AddRes a0 b1
+aDD_SIZEOF =
+  \sizeof0 -> \x1 -> (C.Expr.HostPlatform.+) sizeof0 x1
+
+{-| __C declaration:__ @macro FST_CONST@
+
+    __defined at:__ @macros\/keyword_params.h 11:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+fST_CONST :: forall a0 b1. a0 -> b1 -> a0
+fST_CONST = \const0 -> \volatile1 -> const0
diff --git a/test-artefacts/fixtures/macros/keyword_params/bindingspec.yaml b/test-artefacts/fixtures/macros/keyword_params/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/keyword_params/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/keyword_params/th.txt b/test-artefacts/fixtures/macros/keyword_params/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/keyword_params/th.txt
@@ -0,0 +1,44 @@
+-- addDependentFile test-artefacts/headers/golden/macros/keyword_params.h
+{-| __C declaration:__ @macro ID_INT@
+
+    __defined at:__ @macros\/keyword_params.h 9:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+iD_INT :: forall a_0 . a_0 -> a_0
+{-| __C declaration:__ @macro ID_INT@
+
+    __defined at:__ @macros\/keyword_params.h 9:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+iD_INT = \int_0 -> int_0
+{-| __C declaration:__ @macro ADD_SIZEOF@
+
+    __defined at:__ @macros\/keyword_params.h 10:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+aDD_SIZEOF :: forall a_0 b_1 . Add a_0 b_1 =>
+              a_0 -> b_1 -> AddRes a_0 b_1
+{-| __C declaration:__ @macro ADD_SIZEOF@
+
+    __defined at:__ @macros\/keyword_params.h 10:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+aDD_SIZEOF = \sizeof_0 -> \x_1 -> (+) sizeof_0 x_1
+{-| __C declaration:__ @macro FST_CONST@
+
+    __defined at:__ @macros\/keyword_params.h 11:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+fST_CONST :: forall a_0 b_1 . a_0 -> b_1 -> a_0
+{-| __C declaration:__ @macro FST_CONST@
+
+    __defined at:__ @macros\/keyword_params.h 11:9@
+
+    __exported by:__ @macros\/keyword_params.h@
+-}
+fST_CONST = \const_0 -> \volatile_1 -> const_0
diff --git a/test-artefacts/fixtures/macros/macro_comma.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_comma.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_comma.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_comma.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_comma.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_comma.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_comma.h
diff --git a/test-artefacts/fixtures/macros/macro_comma.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_comma.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_comma.2.raw/Example.hs
@@ -0,0 +1,63 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.oBJ
+    , Example.oBJ_NO_PARENS
+    , Example.fUN
+    , Example.fUN_THREE
+    , Example.aRITH
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro OBJ@
+
+    __defined at:__ @macros\/macro_comma.h 8:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ :: Macro.Raw String
+oBJ =
+  Macro.objectLike "OBJ" ["(", "1", ",", "2", ")"]
+
+{-| __C declaration:__ @macro OBJ_NO_PARENS@
+
+    __defined at:__ @macros\/macro_comma.h 9:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ_NO_PARENS :: Macro.Raw String
+oBJ_NO_PARENS =
+  Macro.objectLike "OBJ_NO_PARENS" ["1", ",", "2"]
+
+{-| __C declaration:__ @macro FUN@
+
+    __defined at:__ @macros\/macro_comma.h 10:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN :: Macro.Raw String
+fUN =
+  Macro.functionLike "FUN" ["x", "y"] ["(", "x", ",", "y", ")"]
+
+{-| __C declaration:__ @macro FUN_THREE@
+
+    __defined at:__ @macros\/macro_comma.h 11:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN_THREE :: Macro.Raw String
+fUN_THREE =
+  Macro.functionLike "FUN_THREE" ["x", "y", "z"] ["(", "(", "x", ")", ",", "(", "y", ")", ",", "(", "z", ")", ")"]
+
+{-| __C declaration:__ @macro ARITH@
+
+    __defined at:__ @macros\/macro_comma.h 15:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+aRITH :: Macro.Raw String
+aRITH =
+  Macro.objectLike "ARITH" ["(", "(", "1", ",", "2", ")", "+", "3", ")"]
diff --git a/test-artefacts/fixtures/macros/macro_comma.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_comma.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_comma.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_comma.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_comma.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_comma.2.raw/th.txt
@@ -0,0 +1,91 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_comma.h
+{-| __C declaration:__ @macro OBJ@
+
+    __defined at:__ @macros\/macro_comma.h 8:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ :: Raw String
+{-| __C declaration:__ @macro OBJ@
+
+    __defined at:__ @macros\/macro_comma.h 8:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ = objectLike "OBJ" ["(", "1", ",", "2", ")"]
+{-| __C declaration:__ @macro OBJ_NO_PARENS@
+
+    __defined at:__ @macros\/macro_comma.h 9:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ_NO_PARENS :: Raw String
+{-| __C declaration:__ @macro OBJ_NO_PARENS@
+
+    __defined at:__ @macros\/macro_comma.h 9:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ_NO_PARENS = objectLike "OBJ_NO_PARENS" ["1", ",", "2"]
+{-| __C declaration:__ @macro FUN@
+
+    __defined at:__ @macros\/macro_comma.h 10:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN :: Raw String
+{-| __C declaration:__ @macro FUN@
+
+    __defined at:__ @macros\/macro_comma.h 10:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN = functionLike "FUN" ["x", "y"] ["(", "x", ",", "y", ")"]
+{-| __C declaration:__ @macro FUN_THREE@
+
+    __defined at:__ @macros\/macro_comma.h 11:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN_THREE :: Raw String
+{-| __C declaration:__ @macro FUN_THREE@
+
+    __defined at:__ @macros\/macro_comma.h 11:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN_THREE = functionLike "FUN_THREE" ["x", "y", "z"] ["(",
+                                                      "(",
+                                                      "x",
+                                                      ")",
+                                                      ",",
+                                                      "(",
+                                                      "y",
+                                                      ")",
+                                                      ",",
+                                                      "(",
+                                                      "z",
+                                                      ")",
+                                                      ")"]
+{-| __C declaration:__ @macro ARITH@
+
+    __defined at:__ @macros\/macro_comma.h 15:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+aRITH :: Raw String
+{-| __C declaration:__ @macro ARITH@
+
+    __defined at:__ @macros\/macro_comma.h 15:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+aRITH = objectLike "ARITH" ["(",
+                            "(",
+                            "1",
+                            ",",
+                            "2",
+                            ")",
+                            "+",
+                            "3",
+                            ")"]
diff --git a/test-artefacts/fixtures/macros/macro_comma/Example.hs b/test-artefacts/fixtures/macros/macro_comma/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_comma/Example.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.oBJ
+    , Example.oBJ_NO_PARENS
+    , Example.fUN
+    , Example.fUN_THREE
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @macro OBJ@
+
+    __defined at:__ @macros\/macro_comma.h 8:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ :: (BG.CInt, BG.CInt)
+oBJ = ((1 :: BG.CInt), (2 :: BG.CInt))
+
+{-| __C declaration:__ @macro OBJ_NO_PARENS@
+
+    __defined at:__ @macros\/macro_comma.h 9:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ_NO_PARENS :: (BG.CInt, BG.CInt)
+oBJ_NO_PARENS = ((1 :: BG.CInt), (2 :: BG.CInt))
+
+{-| __C declaration:__ @macro FUN@
+
+    __defined at:__ @macros\/macro_comma.h 10:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN :: forall a0 b1. a0 -> b1 -> (a0, b1)
+fUN = \x0 -> \y1 -> (x0, y1)
+
+{-| __C declaration:__ @macro FUN_THREE@
+
+    __defined at:__ @macros\/macro_comma.h 11:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN_THREE :: forall a0 b1 c2. a0 -> b1 -> c2 -> (a0, b1, c2)
+fUN_THREE = \x0 -> \y1 -> \z2 -> (x0, y1, z2)
diff --git a/test-artefacts/fixtures/macros/macro_comma/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_comma/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_comma/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_comma/th.txt b/test-artefacts/fixtures/macros/macro_comma/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_comma/th.txt
@@ -0,0 +1,58 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_comma.h
+{-| __C declaration:__ @macro OBJ@
+
+    __defined at:__ @macros\/macro_comma.h 8:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ :: (CInt, CInt)
+{-| __C declaration:__ @macro OBJ@
+
+    __defined at:__ @macros\/macro_comma.h 8:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ = (1 :: CInt, 2 :: CInt)
+{-| __C declaration:__ @macro OBJ_NO_PARENS@
+
+    __defined at:__ @macros\/macro_comma.h 9:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ_NO_PARENS :: (CInt, CInt)
+{-| __C declaration:__ @macro OBJ_NO_PARENS@
+
+    __defined at:__ @macros\/macro_comma.h 9:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+oBJ_NO_PARENS = (1 :: CInt, 2 :: CInt)
+{-| __C declaration:__ @macro FUN@
+
+    __defined at:__ @macros\/macro_comma.h 10:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN :: forall a_0 b_1 . a_0 -> b_1 -> (a_0, b_1)
+{-| __C declaration:__ @macro FUN@
+
+    __defined at:__ @macros\/macro_comma.h 10:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN = \x_0 -> \y_1 -> (x_0, y_1)
+{-| __C declaration:__ @macro FUN_THREE@
+
+    __defined at:__ @macros\/macro_comma.h 11:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN_THREE :: forall a_0 b_1 c_2 .
+             a_0 -> b_1 -> c_2 -> (a_0, b_1, c_2)
+{-| __C declaration:__ @macro FUN_THREE@
+
+    __defined at:__ @macros\/macro_comma.h 11:9@
+
+    __exported by:__ @macros\/macro_comma.h@
+-}
+fUN_THREE = \x_0 -> \y_1 -> \z_2 -> (x_0, y_1, z_2)
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/Example/FunPtr.hs
@@ -0,0 +1,46 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.use_b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_ext_binding_dep.h>"
+  , "/* test_macrosmacro_ext_binding_dep_1_Example_get_use_b */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e3008b3ee93f5ee9 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &use_b;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_get_use_b@
+foreign import ccall unsafe "hs_bindgen_e3008b3ee93f5ee9" hs_bindgen_e3008b3ee93f5ee9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_get_use_b@
+hs_bindgen_e3008b3ee93f5ee9 :: IO (BG.FunPtr (M.A -> IO ()))
+hs_bindgen_e3008b3ee93f5ee9 =
+  fmap BG.fromFFIType hs_bindgen_e3008b3ee93f5ee9_base
+
+{-# NOINLINE use_b #-}
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b :: BG.FunPtr (M.A -> IO ())
+use_b =
+  BG.unsafePerformIO hs_bindgen_e3008b3ee93f5ee9
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/Example/Safe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.use_b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_ext_binding_dep.h>"
+  , "void hs_bindgen_f8c6775667265898 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (use_b)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Safe_use_b@
+foreign import ccall safe "hs_bindgen_f8c6775667265898" hs_bindgen_f8c6775667265898_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Safe_use_b@
+hs_bindgen_f8c6775667265898 ::
+     M.A
+  -> IO ()
+hs_bindgen_f8c6775667265898 =
+  \x0 ->
+    hs_bindgen_f8c6775667265898_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b ::
+     M.A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+use_b = hs_bindgen_f8c6775667265898
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/Example/Unsafe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.use_b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_ext_binding_dep.h>"
+  , "void hs_bindgen_495d2cdae3c804b4 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (use_b)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Unsafe_use_b@
+foreign import ccall unsafe "hs_bindgen_495d2cdae3c804b4" hs_bindgen_495d2cdae3c804b4_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Unsafe_use_b@
+hs_bindgen_495d2cdae3c804b4 ::
+     M.A
+  -> IO ()
+hs_bindgen_495d2cdae3c804b4 =
+  \x0 ->
+    hs_bindgen_495d2cdae3c804b4_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b ::
+     M.A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+use_b = hs_bindgen_495d2cdae3c804b4
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.1.empty/th.txt
@@ -0,0 +1,88 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_ext_binding_dep.h
+-- #include <macros/macro_ext_binding_dep.h>
+-- void hs_bindgen_f8c6775667265898 (
+--   A arg1
+-- )
+-- {
+--   (use_b)(arg1);
+-- }
+-- void hs_bindgen_495d2cdae3c804b4 (
+--   A arg1
+-- )
+-- {
+--   (use_b)(arg1);
+-- }
+-- /* test_macrosmacro_ext_binding_dep_1_Example_get_use_b */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e3008b3ee93f5ee9 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &use_b;
+-- }
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Safe_use_b@
+foreign import ccall safe "hs_bindgen_f8c6775667265898" hs_bindgen_f8c6775667265898_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Safe_use_b@
+hs_bindgen_f8c6775667265898 :: M.A -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Safe_use_b@
+hs_bindgen_f8c6775667265898 = \x_0 -> hs_bindgen_f8c6775667265898_base (toFFIType x_0)
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_safe :: M.A -> IO ()
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_safe = hs_bindgen_f8c6775667265898
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Unsafe_use_b@
+foreign import ccall unsafe "hs_bindgen_495d2cdae3c804b4" hs_bindgen_495d2cdae3c804b4_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Unsafe_use_b@
+hs_bindgen_495d2cdae3c804b4 :: M.A -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_Unsafe_use_b@
+hs_bindgen_495d2cdae3c804b4 = \x_0 -> hs_bindgen_495d2cdae3c804b4_base (toFFIType x_0)
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_unsafe :: M.A -> IO ()
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_unsafe = hs_bindgen_495d2cdae3c804b4
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_get_use_b@
+foreign import ccall unsafe "hs_bindgen_e3008b3ee93f5ee9" hs_bindgen_e3008b3ee93f5ee9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_get_use_b@
+hs_bindgen_e3008b3ee93f5ee9 :: IO (FunPtr (M.A -> IO ()))
+-- __unique:__ @test_macrosmacro_ext_binding_dep_1_Example_get_use_b@
+hs_bindgen_e3008b3ee93f5ee9 = fmap fromFFIType hs_bindgen_e3008b3ee93f5ee9_base
+{-# NOINLINE use_b_funptr #-}
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_funptr :: FunPtr (M.A -> IO ())
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_funptr = unsafePerformIO hs_bindgen_e3008b3ee93f5ee9
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 6:9@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+b :: Macro.Raw String
+b = Macro.objectLike "B" ["A"]
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example/FunPtr.hs
@@ -0,0 +1,46 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.use_b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_ext_binding_dep.h>"
+  , "/* test_macrosmacro_ext_binding_dep_2_Example_get_use_b */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2ea258d8b3c67286 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &use_b;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_get_use_b@
+foreign import ccall unsafe "hs_bindgen_2ea258d8b3c67286" hs_bindgen_2ea258d8b3c67286_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_get_use_b@
+hs_bindgen_2ea258d8b3c67286 :: IO (BG.FunPtr (M.A -> IO ()))
+hs_bindgen_2ea258d8b3c67286 =
+  fmap BG.fromFFIType hs_bindgen_2ea258d8b3c67286_base
+
+{-# NOINLINE use_b #-}
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b :: BG.FunPtr (M.A -> IO ())
+use_b =
+  BG.unsafePerformIO hs_bindgen_2ea258d8b3c67286
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example/Safe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.use_b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_ext_binding_dep.h>"
+  , "void hs_bindgen_92afe64d8d8fc053 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (use_b)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Safe_use_b@
+foreign import ccall safe "hs_bindgen_92afe64d8d8fc053" hs_bindgen_92afe64d8d8fc053_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Safe_use_b@
+hs_bindgen_92afe64d8d8fc053 ::
+     M.A
+  -> IO ()
+hs_bindgen_92afe64d8d8fc053 =
+  \x0 ->
+    hs_bindgen_92afe64d8d8fc053_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b ::
+     M.A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+use_b = hs_bindgen_92afe64d8d8fc053
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/Example/Unsafe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.use_b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import qualified M
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_ext_binding_dep.h>"
+  , "void hs_bindgen_f1dab51ba21acc43 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (use_b)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Unsafe_use_b@
+foreign import ccall unsafe "hs_bindgen_f1dab51ba21acc43" hs_bindgen_f1dab51ba21acc43_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Unsafe_use_b@
+hs_bindgen_f1dab51ba21acc43 ::
+     M.A
+  -> IO ()
+hs_bindgen_f1dab51ba21acc43 =
+  \x0 ->
+    hs_bindgen_f1dab51ba21acc43_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b ::
+     M.A
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+use_b = hs_bindgen_f1dab51ba21acc43
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep.2.raw/th.txt
@@ -0,0 +1,102 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_ext_binding_dep.h
+-- #include <macros/macro_ext_binding_dep.h>
+-- void hs_bindgen_92afe64d8d8fc053 (
+--   A arg1
+-- )
+-- {
+--   (use_b)(arg1);
+-- }
+-- void hs_bindgen_f1dab51ba21acc43 (
+--   A arg1
+-- )
+-- {
+--   (use_b)(arg1);
+-- }
+-- /* test_macrosmacro_ext_binding_dep_2_Example_get_use_b */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2ea258d8b3c67286 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &use_b;
+-- }
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 6:9@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+b :: Raw String
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 6:9@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+b = objectLike "B" ["A"]
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Safe_use_b@
+foreign import ccall safe "hs_bindgen_92afe64d8d8fc053" hs_bindgen_92afe64d8d8fc053_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Safe_use_b@
+hs_bindgen_92afe64d8d8fc053 :: M.A -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Safe_use_b@
+hs_bindgen_92afe64d8d8fc053 = \x_0 -> hs_bindgen_92afe64d8d8fc053_base (toFFIType x_0)
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_safe :: M.A -> IO ()
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_safe = hs_bindgen_92afe64d8d8fc053
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Unsafe_use_b@
+foreign import ccall unsafe "hs_bindgen_f1dab51ba21acc43" hs_bindgen_f1dab51ba21acc43_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Unsafe_use_b@
+hs_bindgen_f1dab51ba21acc43 :: M.A -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_Unsafe_use_b@
+hs_bindgen_f1dab51ba21acc43 = \x_0 -> hs_bindgen_f1dab51ba21acc43_base (toFFIType x_0)
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_unsafe :: M.A -> IO ()
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_unsafe = hs_bindgen_f1dab51ba21acc43
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_get_use_b@
+foreign import ccall unsafe "hs_bindgen_2ea258d8b3c67286" hs_bindgen_2ea258d8b3c67286_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_get_use_b@
+hs_bindgen_2ea258d8b3c67286 :: IO (FunPtr (M.A -> IO ()))
+-- __unique:__ @test_macrosmacro_ext_binding_dep_2_Example_get_use_b@
+hs_bindgen_2ea258d8b3c67286 = fmap fromFFIType hs_bindgen_2ea258d8b3c67286_base
+{-# NOINLINE use_b_funptr #-}
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_funptr :: FunPtr (M.A -> IO ())
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_funptr = unsafePerformIO hs_bindgen_2ea258d8b3c67286
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example.hs
@@ -0,0 +1,50 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.B(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified M
+import Prelude (type (~))
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 6:9@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+newtype B = B
+  { unwrapB :: M.A
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ M.A) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ M.A) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = M.A
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example/FunPtr.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example/FunPtr.hs
@@ -0,0 +1,46 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.use_b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_ext_binding_dep.h>"
+  , "/* test_macrosmacro_ext_binding_dep_Example_get_use_b */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b341ec07f48c8cc1 (void)) ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  return &use_b;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_get_use_b@
+foreign import ccall unsafe "hs_bindgen_b341ec07f48c8cc1" hs_bindgen_b341ec07f48c8cc1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_get_use_b@
+hs_bindgen_b341ec07f48c8cc1 :: IO (BG.FunPtr (B -> IO ()))
+hs_bindgen_b341ec07f48c8cc1 =
+  fmap BG.fromFFIType hs_bindgen_b341ec07f48c8cc1_base
+
+{-# NOINLINE use_b #-}
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b :: BG.FunPtr (B -> IO ())
+use_b =
+  BG.unsafePerformIO hs_bindgen_b341ec07f48c8cc1
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example/Safe.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example/Safe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.use_b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_ext_binding_dep.h>"
+  , "void hs_bindgen_f70130e6504e0e5e ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (use_b)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Safe_use_b@
+foreign import ccall safe "hs_bindgen_f70130e6504e0e5e" hs_bindgen_f70130e6504e0e5e_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Safe_use_b@
+hs_bindgen_f70130e6504e0e5e ::
+     B
+  -> IO ()
+hs_bindgen_f70130e6504e0e5e =
+  \x0 ->
+    hs_bindgen_f70130e6504e0e5e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+use_b = hs_bindgen_f70130e6504e0e5e
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example/Unsafe.hs b/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep/Example/Unsafe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.use_b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_ext_binding_dep.h>"
+  , "void hs_bindgen_432a5c7b5df51cfa ("
+  , "  B arg1"
+  , ")"
+  , "{"
+  , "  (use_b)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Unsafe_use_b@
+foreign import ccall unsafe "hs_bindgen_432a5c7b5df51cfa" hs_bindgen_432a5c7b5df51cfa_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Unsafe_use_b@
+hs_bindgen_432a5c7b5df51cfa ::
+     B
+  -> IO ()
+hs_bindgen_432a5c7b5df51cfa =
+  \x0 ->
+    hs_bindgen_432a5c7b5df51cfa_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b ::
+     B
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+use_b = hs_bindgen_432a5c7b5df51cfa
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_ext_binding_dep/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep/bindingspec.yaml
@@ -0,0 +1,21 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_ext_binding_dep.h
+  cname: macro B
+  hsname: B
+hstypes:
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
diff --git a/test-artefacts/fixtures/macros/macro_ext_binding_dep/th.txt b/test-artefacts/fixtures/macros/macro_ext_binding_dep/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_ext_binding_dep/th.txt
@@ -0,0 +1,103 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_ext_binding_dep.h
+-- #include <macros/macro_ext_binding_dep.h>
+-- void hs_bindgen_f70130e6504e0e5e (
+--   B arg1
+-- )
+-- {
+--   (use_b)(arg1);
+-- }
+-- void hs_bindgen_432a5c7b5df51cfa (
+--   B arg1
+-- )
+-- {
+--   (use_b)(arg1);
+-- }
+-- /* test_macrosmacro_ext_binding_dep_Example_get_use_b */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b341ec07f48c8cc1 (void)) (
+--   B arg1
+-- )
+-- {
+--   return &use_b;
+-- }
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 6:9@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+newtype B = B {unwrapB :: M.A} deriving stock Generic
+instance (~) ty M.A => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty M.A => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = M.A
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Safe_use_b@
+foreign import ccall safe "hs_bindgen_f70130e6504e0e5e" hs_bindgen_f70130e6504e0e5e_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Safe_use_b@
+hs_bindgen_f70130e6504e0e5e :: B -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Safe_use_b@
+hs_bindgen_f70130e6504e0e5e = \x_0 -> hs_bindgen_f70130e6504e0e5e_base (toFFIType x_0)
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_safe :: B -> IO ()
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_safe = hs_bindgen_f70130e6504e0e5e
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Unsafe_use_b@
+foreign import ccall unsafe "hs_bindgen_432a5c7b5df51cfa" hs_bindgen_432a5c7b5df51cfa_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Unsafe_use_b@
+hs_bindgen_432a5c7b5df51cfa :: B -> IO ()
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_Unsafe_use_b@
+hs_bindgen_432a5c7b5df51cfa = \x_0 -> hs_bindgen_432a5c7b5df51cfa_base (toFFIType x_0)
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_unsafe :: B -> IO ()
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_unsafe = hs_bindgen_432a5c7b5df51cfa
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_get_use_b@
+foreign import ccall unsafe "hs_bindgen_b341ec07f48c8cc1" hs_bindgen_b341ec07f48c8cc1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_get_use_b@
+hs_bindgen_b341ec07f48c8cc1 :: IO (FunPtr (B -> IO ()))
+-- __unique:__ @test_macrosmacro_ext_binding_dep_Example_get_use_b@
+hs_bindgen_b341ec07f48c8cc1 = fmap fromFFIType hs_bindgen_b341ec07f48c8cc1_base
+{-# NOINLINE use_b_funptr #-}
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_funptr :: FunPtr (B -> IO ())
+{-| __C declaration:__ @use_b@
+
+    __defined at:__ @macros\/macro_ext_binding_dep.h 8:6@
+
+    __exported by:__ @macros\/macro_ext_binding_dep.h@
+-}
+use_b_funptr = unsafePerformIO hs_bindgen_b341ec07f48c8cc1
diff --git a/test-artefacts/fixtures/macros/macro_functions.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_functions.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_functions.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_functions.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_functions.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_functions.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_functions.h
diff --git a/test-artefacts/fixtures/macros/macro_functions.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_functions.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_functions.2.raw/Example.hs
@@ -0,0 +1,217 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.iNCR
+    , Example.aDD
+    , Example.iD
+    , Example.cONST
+    , Example.cONST_3
+    , Example.cMP
+    , Example.fUN1
+    , Example.fUN2
+    , Example.g
+    , Example.g_3
+    , Example.dIV1
+    , Example.dIV2
+    , Example.sWAP32
+    , Example.aV_VERSION_INT
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro INCR@
+
+    __defined at:__ @macros\/macro_functions.h 1:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iNCR :: Macro.Raw String
+iNCR =
+  Macro.functionLike "INCR" ["x"] ["x", "+", "1"]
+
+{-| __C declaration:__ @macro ADD@
+
+    __defined at:__ @macros\/macro_functions.h 2:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aDD :: Macro.Raw String
+aDD =
+  Macro.functionLike "ADD" ["x", "y"] ["x", "+", "y"]
+
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/macro_functions.h 4:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iD :: Macro.Raw String
+iD = Macro.functionLike "ID" ["X"] ["X"]
+
+{-| __C declaration:__ @macro CONST@
+
+    __defined at:__ @macros\/macro_functions.h 5:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST :: Macro.Raw String
+cONST = Macro.functionLike "CONST" ["X", "Y"] ["X"]
+
+{-| __C declaration:__ @macro CONST_3@
+
+    __defined at:__ @macros\/macro_functions.h 6:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST_3 :: Macro.Raw String
+cONST_3 =
+  Macro.functionLike "CONST_3" ["X", "Y", "Z"] ["X"]
+
+{-| __C declaration:__ @macro CMP@
+
+    __defined at:__ @macros\/macro_functions.h 8:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cMP :: Macro.Raw String
+cMP =
+  Macro.functionLike "CMP" ["X", "Y"] ["X", "<", "Y"]
+
+{-| __C declaration:__ @macro FUN1@
+
+    __defined at:__ @macros\/macro_functions.h 9:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN1 :: Macro.Raw String
+fUN1 =
+  Macro.functionLike "FUN1" ["X", "Y"] ["X", "+", "12ull", "*", "Y"]
+
+{-| __C declaration:__ @macro FUN2@
+
+    __defined at:__ @macros\/macro_functions.h 10:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN2 :: Macro.Raw String
+fUN2 =
+  Macro.functionLike "FUN2" ["X", "Y"] ["X", "<<", "(", "3ull", "*", "Y", ")"]
+
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @macros\/macro_functions.h 12:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g :: Macro.Raw String
+g =
+  Macro.functionLike "G" ["X", "Y"] ["CONST", "(", "INCR", "(", "Y", ")", ",", "ID", "(", "X", ")", ")"]
+
+{-| __C declaration:__ @macro G_3@
+
+    __defined at:__ @macros\/macro_functions.h 13:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g_3 :: Macro.Raw String
+g_3 =
+  Macro.functionLike "G_3" ["X", "Y", "Z"] [ "CONST_3"
+                                           , "("
+                                           , "INCR"
+                                           , "("
+                                           , "Y"
+                                           , ")"
+                                           , ","
+                                           , "ID"
+                                           , "("
+                                           , "X"
+                                           , ")"
+                                           , ","
+                                           , "ID"
+                                           , "("
+                                           , "Z"
+                                           , ")"
+                                           , ")"
+                                           ]
+
+{-| __C declaration:__ @macro DIV1@
+
+    __defined at:__ @macros\/macro_functions.h 15:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV1 :: Macro.Raw String
+dIV1 =
+  Macro.functionLike "DIV1" ["X", "Y"] ["X", "/", "(", "Y", "+", "12u", ")"]
+
+{-| __C declaration:__ @macro DIV2@
+
+    __defined at:__ @macros\/macro_functions.h 16:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV2 :: Macro.Raw String
+dIV2 =
+  Macro.functionLike "DIV2" ["X", "Y"] ["10.0f", "*", "X", "/", "Y"]
+
+{-| __C declaration:__ @macro SWAP32@
+
+    __defined at:__ @macros\/macro_functions.h 20:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+sWAP32 :: Macro.Raw String
+sWAP32 =
+  Macro.functionLike "SWAP32" ["w"] [ "("
+                                    , "("
+                                    , "("
+                                    , "w"
+                                    , ")"
+                                    , ">>"
+                                    , "24"
+                                    , ")"
+                                    , "&"
+                                    , "0xff"
+                                    , ")"
+                                    , "|"
+                                    , "("
+                                    , "("
+                                    , "("
+                                    , "w"
+                                    , ")"
+                                    , "<<"
+                                    , "8"
+                                    , ")"
+                                    , "&"
+                                    , "0xff0000"
+                                    , ")"
+                                    ]
+
+{-| __C declaration:__ @macro AV_VERSION_INT@
+
+    __defined at:__ @macros\/macro_functions.h 21:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aV_VERSION_INT :: Macro.Raw String
+aV_VERSION_INT =
+  Macro.functionLike "AV_VERSION_INT" ["a", "b", "c"] [ "("
+                                                      , "("
+                                                      , "a"
+                                                      , ")"
+                                                      , "<<"
+                                                      , "16"
+                                                      , "|"
+                                                      , "("
+                                                      , "b"
+                                                      , ")"
+                                                      , "<<"
+                                                      , "8"
+                                                      , "|"
+                                                      , "("
+                                                      , "c"
+                                                      , ")"
+                                                      , ")"
+                                                      ]
diff --git a/test-artefacts/fixtures/macros/macro_functions.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_functions.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_functions.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_functions.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_functions.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_functions.2.raw/th.txt
@@ -0,0 +1,276 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_functions.h
+{-| __C declaration:__ @macro INCR@
+
+    __defined at:__ @macros\/macro_functions.h 1:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iNCR :: Raw String
+{-| __C declaration:__ @macro INCR@
+
+    __defined at:__ @macros\/macro_functions.h 1:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iNCR = functionLike "INCR" ["x"] ["x", "+", "1"]
+{-| __C declaration:__ @macro ADD@
+
+    __defined at:__ @macros\/macro_functions.h 2:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aDD :: Raw String
+{-| __C declaration:__ @macro ADD@
+
+    __defined at:__ @macros\/macro_functions.h 2:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aDD = functionLike "ADD" ["x", "y"] ["x", "+", "y"]
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/macro_functions.h 4:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iD :: Raw String
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/macro_functions.h 4:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iD = functionLike "ID" ["X"] ["X"]
+{-| __C declaration:__ @macro CONST@
+
+    __defined at:__ @macros\/macro_functions.h 5:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST :: Raw String
+{-| __C declaration:__ @macro CONST@
+
+    __defined at:__ @macros\/macro_functions.h 5:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST = functionLike "CONST" ["X", "Y"] ["X"]
+{-| __C declaration:__ @macro CONST_3@
+
+    __defined at:__ @macros\/macro_functions.h 6:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST_3 :: Raw String
+{-| __C declaration:__ @macro CONST_3@
+
+    __defined at:__ @macros\/macro_functions.h 6:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST_3 = functionLike "CONST_3" ["X", "Y", "Z"] ["X"]
+{-| __C declaration:__ @macro CMP@
+
+    __defined at:__ @macros\/macro_functions.h 8:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cMP :: Raw String
+{-| __C declaration:__ @macro CMP@
+
+    __defined at:__ @macros\/macro_functions.h 8:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cMP = functionLike "CMP" ["X", "Y"] ["X", "<", "Y"]
+{-| __C declaration:__ @macro FUN1@
+
+    __defined at:__ @macros\/macro_functions.h 9:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN1 :: Raw String
+{-| __C declaration:__ @macro FUN1@
+
+    __defined at:__ @macros\/macro_functions.h 9:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN1 = functionLike "FUN1" ["X", "Y"] ["X", "+", "12ull", "*", "Y"]
+{-| __C declaration:__ @macro FUN2@
+
+    __defined at:__ @macros\/macro_functions.h 10:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN2 :: Raw String
+{-| __C declaration:__ @macro FUN2@
+
+    __defined at:__ @macros\/macro_functions.h 10:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN2 = functionLike "FUN2" ["X", "Y"] ["X",
+                                       "<<",
+                                       "(",
+                                       "3ull",
+                                       "*",
+                                       "Y",
+                                       ")"]
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @macros\/macro_functions.h 12:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g :: Raw String
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @macros\/macro_functions.h 12:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g = functionLike "G" ["X", "Y"] ["CONST",
+                                 "(",
+                                 "INCR",
+                                 "(",
+                                 "Y",
+                                 ")",
+                                 ",",
+                                 "ID",
+                                 "(",
+                                 "X",
+                                 ")",
+                                 ")"]
+{-| __C declaration:__ @macro G_3@
+
+    __defined at:__ @macros\/macro_functions.h 13:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g_3 :: Raw String
+{-| __C declaration:__ @macro G_3@
+
+    __defined at:__ @macros\/macro_functions.h 13:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g_3 = functionLike "G_3" ["X", "Y", "Z"] ["CONST_3",
+                                          "(",
+                                          "INCR",
+                                          "(",
+                                          "Y",
+                                          ")",
+                                          ",",
+                                          "ID",
+                                          "(",
+                                          "X",
+                                          ")",
+                                          ",",
+                                          "ID",
+                                          "(",
+                                          "Z",
+                                          ")",
+                                          ")"]
+{-| __C declaration:__ @macro DIV1@
+
+    __defined at:__ @macros\/macro_functions.h 15:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV1 :: Raw String
+{-| __C declaration:__ @macro DIV1@
+
+    __defined at:__ @macros\/macro_functions.h 15:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV1 = functionLike "DIV1" ["X", "Y"] ["X",
+                                       "/",
+                                       "(",
+                                       "Y",
+                                       "+",
+                                       "12u",
+                                       ")"]
+{-| __C declaration:__ @macro DIV2@
+
+    __defined at:__ @macros\/macro_functions.h 16:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV2 :: Raw String
+{-| __C declaration:__ @macro DIV2@
+
+    __defined at:__ @macros\/macro_functions.h 16:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV2 = functionLike "DIV2" ["X", "Y"] ["10.0f", "*", "X", "/", "Y"]
+{-| __C declaration:__ @macro SWAP32@
+
+    __defined at:__ @macros\/macro_functions.h 20:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+sWAP32 :: Raw String
+{-| __C declaration:__ @macro SWAP32@
+
+    __defined at:__ @macros\/macro_functions.h 20:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+sWAP32 = functionLike "SWAP32" ["w"] ["(",
+                                      "(",
+                                      "(",
+                                      "w",
+                                      ")",
+                                      ">>",
+                                      "24",
+                                      ")",
+                                      "&",
+                                      "0xff",
+                                      ")",
+                                      "|",
+                                      "(",
+                                      "(",
+                                      "(",
+                                      "w",
+                                      ")",
+                                      "<<",
+                                      "8",
+                                      ")",
+                                      "&",
+                                      "0xff0000",
+                                      ")"]
+{-| __C declaration:__ @macro AV_VERSION_INT@
+
+    __defined at:__ @macros\/macro_functions.h 21:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aV_VERSION_INT :: Raw String
+{-| __C declaration:__ @macro AV_VERSION_INT@
+
+    __defined at:__ @macros\/macro_functions.h 21:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aV_VERSION_INT = functionLike "AV_VERSION_INT" ["a",
+                                                "b",
+                                                "c"] ["(",
+                                                      "(",
+                                                      "a",
+                                                      ")",
+                                                      "<<",
+                                                      "16",
+                                                      "|",
+                                                      "(",
+                                                      "b",
+                                                      ")",
+                                                      "<<",
+                                                      "8",
+                                                      "|",
+                                                      "(",
+                                                      "c",
+                                                      ")",
+                                                      ")"]
diff --git a/test-artefacts/fixtures/macros/macro_functions/Example.hs b/test-artefacts/fixtures/macros/macro_functions/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_functions/Example.hs
@@ -0,0 +1,171 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.iNCR
+    , Example.aDD
+    , Example.iD
+    , Example.cONST
+    , Example.cONST_3
+    , Example.cMP
+    , Example.fUN1
+    , Example.fUN2
+    , Example.g
+    , Example.g_3
+    , Example.dIV1
+    , Example.dIV2
+    , Example.sWAP32
+    , Example.aV_VERSION_INT
+    )
+  where
+
+import qualified C.Expr.HostPlatform
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @macro INCR@
+
+    __defined at:__ @macros\/macro_functions.h 1:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iNCR :: forall a0. C.Expr.HostPlatform.Add a0 BG.CInt => a0 -> C.Expr.HostPlatform.AddRes a0 BG.CInt
+iNCR =
+  \x0 -> (C.Expr.HostPlatform.+) x0 (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro ADD@
+
+    __defined at:__ @macros\/macro_functions.h 2:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aDD :: forall a0 b1. C.Expr.HostPlatform.Add a0 b1 => a0 -> b1 -> C.Expr.HostPlatform.AddRes a0 b1
+aDD = \x0 -> \y1 -> (C.Expr.HostPlatform.+) x0 y1
+
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/macro_functions.h 4:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iD :: forall a0. a0 -> a0
+iD = \x0 -> x0
+
+{-| __C declaration:__ @macro CONST@
+
+    __defined at:__ @macros\/macro_functions.h 5:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST :: forall a0 b1. a0 -> b1 -> a0
+cONST = \x0 -> \y1 -> x0
+
+{-| __C declaration:__ @macro CONST_3@
+
+    __defined at:__ @macros\/macro_functions.h 6:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST_3 :: forall a0 b1 c2. a0 -> b1 -> c2 -> a0
+cONST_3 = \x0 -> \y1 -> \z2 -> x0
+
+{-| __C declaration:__ @macro CMP@
+
+    __defined at:__ @macros\/macro_functions.h 8:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cMP :: forall a0 b1. C.Expr.HostPlatform.RelOrd a0 b1 => a0 -> b1 -> BG.CInt
+cMP = \x0 -> \y1 -> (C.Expr.HostPlatform.<) x0 y1
+
+{-| __C declaration:__ @macro FUN1@
+
+    __defined at:__ @macros\/macro_functions.h 9:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN1 :: forall a0 b1. C.Expr.HostPlatform.Add a0 (C.Expr.HostPlatform.MultRes BG.CULLong b1) => C.Expr.HostPlatform.Mult BG.CULLong b1 => a0 -> b1 -> C.Expr.HostPlatform.AddRes a0 (C.Expr.HostPlatform.MultRes BG.CULLong b1)
+fUN1 =
+  \x0 ->
+    \y1 ->
+      (C.Expr.HostPlatform.+) x0 ((C.Expr.HostPlatform.*) (12 :: BG.CULLong) y1)
+
+{-| __C declaration:__ @macro FUN2@
+
+    __defined at:__ @macros\/macro_functions.h 10:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN2 :: forall a0 b1. C.Expr.HostPlatform.Mult BG.CULLong b1 => C.Expr.HostPlatform.Shift a0 (C.Expr.HostPlatform.MultRes BG.CULLong b1) => a0 -> b1 -> C.Expr.HostPlatform.ShiftRes a0
+fUN2 =
+  \x0 ->
+    \y1 ->
+      (C.Expr.HostPlatform.<<) x0 ((C.Expr.HostPlatform.*) (3 :: BG.CULLong) y1)
+
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @macros\/macro_functions.h 12:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g :: forall a0 b1. C.Expr.HostPlatform.Add b1 BG.CInt => a0 -> b1 -> C.Expr.HostPlatform.AddRes b1 BG.CInt
+g = \x0 -> \y1 -> cONST (iNCR y1) (iD x0)
+
+{-| __C declaration:__ @macro G_3@
+
+    __defined at:__ @macros\/macro_functions.h 13:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g_3 :: forall a0 b1 c2. C.Expr.HostPlatform.Add b1 BG.CInt => a0 -> b1 -> c2 -> C.Expr.HostPlatform.AddRes b1 BG.CInt
+g_3 =
+  \x0 ->
+    \y1 -> \z2 -> cONST_3 (iNCR y1) (iD x0) (iD z2)
+
+{-| __C declaration:__ @macro DIV1@
+
+    __defined at:__ @macros\/macro_functions.h 15:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV1 :: forall a0 b1. C.Expr.HostPlatform.Add b1 BG.CUInt => C.Expr.HostPlatform.Div a0 (C.Expr.HostPlatform.AddRes b1 BG.CUInt) => a0 -> b1 -> C.Expr.HostPlatform.DivRes a0 (C.Expr.HostPlatform.AddRes b1 BG.CUInt)
+dIV1 =
+  \x0 ->
+    \y1 ->
+      (C.Expr.HostPlatform./) x0 ((C.Expr.HostPlatform.+) y1 (12 :: BG.CUInt))
+
+{-| __C declaration:__ @macro DIV2@
+
+    __defined at:__ @macros\/macro_functions.h 16:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV2 :: forall a0 b1. C.Expr.HostPlatform.Mult BG.CFloat a0 => C.Expr.HostPlatform.Div (C.Expr.HostPlatform.MultRes BG.CFloat a0) b1 => a0 -> b1 -> C.Expr.HostPlatform.DivRes (C.Expr.HostPlatform.MultRes BG.CFloat a0) b1
+dIV2 =
+  \x0 ->
+    \y1 ->
+      (C.Expr.HostPlatform./) ((C.Expr.HostPlatform.*) (10.0 :: BG.CFloat) x0) y1
+
+{-| __C declaration:__ @macro SWAP32@
+
+    __defined at:__ @macros\/macro_functions.h 20:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+sWAP32 :: forall a0. C.Expr.HostPlatform.Bitwise (C.Expr.HostPlatform.BitsRes (C.Expr.HostPlatform.ShiftRes a0) BG.CInt) (C.Expr.HostPlatform.BitsRes (C.Expr.HostPlatform.ShiftRes a0) BG.CInt) => C.Expr.HostPlatform.Bitwise (C.Expr.HostPlatform.ShiftRes a0) BG.CInt => C.Expr.HostPlatform.Shift a0 BG.CInt => a0 -> C.Expr.HostPlatform.BitsRes (C.Expr.HostPlatform.BitsRes (C.Expr.HostPlatform.ShiftRes a0) BG.CInt) (C.Expr.HostPlatform.BitsRes (C.Expr.HostPlatform.ShiftRes a0) BG.CInt)
+sWAP32 =
+  \w0 ->
+    (C.Expr.HostPlatform..|.) ((C.Expr.HostPlatform..&.) ((C.Expr.HostPlatform.>>) w0 (24 :: BG.CInt)) (255 :: BG.CInt)) ((C.Expr.HostPlatform..&.) ((C.Expr.HostPlatform.<<) w0 (8 :: BG.CInt)) (16711680 :: BG.CInt))
+
+{-| __C declaration:__ @macro AV_VERSION_INT@
+
+    __defined at:__ @macros\/macro_functions.h 21:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aV_VERSION_INT :: forall a0 b1 c2. C.Expr.HostPlatform.Bitwise (C.Expr.HostPlatform.ShiftRes a0) (C.Expr.HostPlatform.ShiftRes b1) => C.Expr.HostPlatform.Bitwise (C.Expr.HostPlatform.BitsRes (C.Expr.HostPlatform.ShiftRes a0) (C.Expr.HostPlatform.ShiftRes b1)) c2 => C.Expr.HostPlatform.Shift b1 BG.CInt => C.Expr.HostPlatform.Shift a0 BG.CInt => a0 -> b1 -> c2 -> C.Expr.HostPlatform.BitsRes (C.Expr.HostPlatform.BitsRes (C.Expr.HostPlatform.ShiftRes a0) (C.Expr.HostPlatform.ShiftRes b1)) c2
+aV_VERSION_INT =
+  \a0 ->
+    \b1 ->
+      \c2 ->
+        (C.Expr.HostPlatform..|.) ((C.Expr.HostPlatform..|.) ((C.Expr.HostPlatform.<<) a0 (16 :: BG.CInt)) ((C.Expr.HostPlatform.<<) b1 (8 :: BG.CInt))) c2
diff --git a/test-artefacts/fixtures/macros/macro_functions/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_functions/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_functions/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_functions/th.txt b/test-artefacts/fixtures/macros/macro_functions/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_functions/th.txt
@@ -0,0 +1,217 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_functions.h
+{-| __C declaration:__ @macro INCR@
+
+    __defined at:__ @macros\/macro_functions.h 1:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iNCR :: forall a_0 . Add a_0 CInt => a_0 -> AddRes a_0 CInt
+{-| __C declaration:__ @macro INCR@
+
+    __defined at:__ @macros\/macro_functions.h 1:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iNCR = \x_0 -> (+) x_0 (1 :: CInt)
+{-| __C declaration:__ @macro ADD@
+
+    __defined at:__ @macros\/macro_functions.h 2:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aDD :: forall a_0 b_1 . Add a_0 b_1 => a_0 -> b_1 -> AddRes a_0 b_1
+{-| __C declaration:__ @macro ADD@
+
+    __defined at:__ @macros\/macro_functions.h 2:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aDD = \x_0 -> \y_1 -> (+) x_0 y_1
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/macro_functions.h 4:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iD :: forall a_0 . a_0 -> a_0
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/macro_functions.h 4:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+iD = \x_0 -> x_0
+{-| __C declaration:__ @macro CONST@
+
+    __defined at:__ @macros\/macro_functions.h 5:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST :: forall a_0 b_1 . a_0 -> b_1 -> a_0
+{-| __C declaration:__ @macro CONST@
+
+    __defined at:__ @macros\/macro_functions.h 5:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST = \x_0 -> \y_1 -> x_0
+{-| __C declaration:__ @macro CONST_3@
+
+    __defined at:__ @macros\/macro_functions.h 6:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST_3 :: forall a_0 b_1 c_2 . a_0 -> b_1 -> c_2 -> a_0
+{-| __C declaration:__ @macro CONST_3@
+
+    __defined at:__ @macros\/macro_functions.h 6:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cONST_3 = \x_0 -> \y_1 -> \z_2 -> x_0
+{-| __C declaration:__ @macro CMP@
+
+    __defined at:__ @macros\/macro_functions.h 8:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cMP :: forall a_0 b_1 . RelOrd a_0 b_1 => a_0 -> b_1 -> CInt
+{-| __C declaration:__ @macro CMP@
+
+    __defined at:__ @macros\/macro_functions.h 8:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+cMP = \x_0 -> \y_1 -> (<) x_0 y_1
+{-| __C declaration:__ @macro FUN1@
+
+    __defined at:__ @macros\/macro_functions.h 9:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN1 :: forall a_0 b_1 . (Add a_0 (MultRes CULLong b_1),
+                          Mult CULLong b_1) =>
+        a_0 -> b_1 -> AddRes a_0 (MultRes CULLong b_1)
+{-| __C declaration:__ @macro FUN1@
+
+    __defined at:__ @macros\/macro_functions.h 9:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN1 = \x_0 -> \y_1 -> (+) x_0 ((*) (12 :: CULLong) y_1)
+{-| __C declaration:__ @macro FUN2@
+
+    __defined at:__ @macros\/macro_functions.h 10:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN2 :: forall a_0 b_1 . (Mult CULLong b_1,
+                          Shift a_0 (MultRes CULLong b_1)) =>
+        a_0 -> b_1 -> ShiftRes a_0
+{-| __C declaration:__ @macro FUN2@
+
+    __defined at:__ @macros\/macro_functions.h 10:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+fUN2 = \x_0 -> \y_1 -> (<<) x_0 ((*) (3 :: CULLong) y_1)
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @macros\/macro_functions.h 12:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g :: forall a_0 b_1 . Add b_1 CInt => a_0 -> b_1 -> AddRes b_1 CInt
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @macros\/macro_functions.h 12:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g = \x_0 -> \y_1 -> cONST (iNCR y_1) (iD x_0)
+{-| __C declaration:__ @macro G_3@
+
+    __defined at:__ @macros\/macro_functions.h 13:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g_3 :: forall a_0 b_1 c_2 . Add b_1 CInt =>
+       a_0 -> b_1 -> c_2 -> AddRes b_1 CInt
+{-| __C declaration:__ @macro G_3@
+
+    __defined at:__ @macros\/macro_functions.h 13:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+g_3 = \x_0 -> \y_1 -> \z_2 -> cONST_3 (iNCR y_1) (iD x_0) (iD z_2)
+{-| __C declaration:__ @macro DIV1@
+
+    __defined at:__ @macros\/macro_functions.h 15:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV1 :: forall a_0 b_1 . (Add b_1 CUInt,
+                          Div a_0 (AddRes b_1 CUInt)) =>
+        a_0 -> b_1 -> DivRes a_0 (AddRes b_1 CUInt)
+{-| __C declaration:__ @macro DIV1@
+
+    __defined at:__ @macros\/macro_functions.h 15:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV1 = \x_0 -> \y_1 -> (/) x_0 ((+) y_1 (12 :: CUInt))
+{-| __C declaration:__ @macro DIV2@
+
+    __defined at:__ @macros\/macro_functions.h 16:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV2 :: forall a_0 b_1 . (Mult CFloat a_0,
+                          Div (MultRes CFloat a_0) b_1) =>
+        a_0 -> b_1 -> DivRes (MultRes CFloat a_0) b_1
+{-| __C declaration:__ @macro DIV2@
+
+    __defined at:__ @macros\/macro_functions.h 16:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+dIV2 = \x_0 -> \y_1 -> (/) ((*) (10.0 :: CFloat) x_0) y_1
+{-| __C declaration:__ @macro SWAP32@
+
+    __defined at:__ @macros\/macro_functions.h 20:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+sWAP32 :: forall a_0 . (Bitwise (BitsRes (ShiftRes a_0) CInt)
+                                (BitsRes (ShiftRes a_0) CInt),
+                        Bitwise (ShiftRes a_0) CInt,
+                        Shift a_0 CInt) =>
+          a_0 ->
+          BitsRes (BitsRes (ShiftRes a_0) CInt) (BitsRes (ShiftRes a_0) CInt)
+{-| __C declaration:__ @macro SWAP32@
+
+    __defined at:__ @macros\/macro_functions.h 20:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+sWAP32 = \w_0 -> (.|.) ((.&.) ((>>) w_0 (24 :: CInt)) (255 :: CInt)) ((.&.) ((<<) w_0 (8 :: CInt)) (16711680 :: CInt))
+{-| __C declaration:__ @macro AV_VERSION_INT@
+
+    __defined at:__ @macros\/macro_functions.h 21:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aV_VERSION_INT :: forall a_0 b_1 c_2 . (Bitwise (ShiftRes a_0)
+                                                (ShiftRes b_1),
+                                        Bitwise (BitsRes (ShiftRes a_0) (ShiftRes b_1)) c_2,
+                                        Shift b_1 CInt,
+                                        Shift a_0 CInt) =>
+                  a_0 ->
+                  b_1 -> c_2 -> BitsRes (BitsRes (ShiftRes a_0) (ShiftRes b_1)) c_2
+{-| __C declaration:__ @macro AV_VERSION_INT@
+
+    __defined at:__ @macros\/macro_functions.h 21:9@
+
+    __exported by:__ @macros\/macro_functions.h@
+-}
+aV_VERSION_INT = \a_0 -> \b_1 -> \c_2 -> (.|.) ((.|.) ((<<) a_0 (16 :: CInt)) ((<<) b_1 (8 :: CInt))) c_2
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/Example/FunPtr.hs
@@ -0,0 +1,400 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.quux
+    , Example.FunPtr.wam
+    , Example.FunPtr.foo1
+    , Example.FunPtr.foo2
+    , Example.FunPtr.foo3
+    , Example.FunPtr.bar1
+    , Example.FunPtr.bar2
+    , Example.FunPtr.bar3
+    , Example.FunPtr.bar4
+    , Example.FunPtr.baz1
+    , Example.FunPtr.baz2
+    , Example.FunPtr.baz3
+    , Example.FunPtr.no_args_no_void
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl.h>"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_quux */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_5287e20e5e7b825d (void)) ("
+  , "  float arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &quux;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_wam */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_c99bba48e65f69c2 (void)) ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return &wam;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_foo1 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_c6abb6228804eb6f (void)) ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_foo2 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_2cd68a8ff1c700b1 (void)) ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_foo3 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_7f22a584414189b4 (void)) ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_bar1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_c1bdd45feff88132 (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_bar2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_db4789e738f22433 (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_bar3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_ce7381c4dae45aa0 (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_bar4 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_9fc1ae53f4373826 (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar4;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_baz1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_7371729bfd8f41e0 (void)) ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return &baz1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_baz2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_348d64df5f006ad8 (void)) ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return &baz2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_baz3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_d8409f68bb588204 (void)) ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return &baz3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_1_empt_Example_get_no_args_no_void */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_5a80b21813f738d7 (void)) (void)"
+  , "{"
+  , "  return &no_args_no_void;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_5287e20e5e7b825d" hs_bindgen_5287e20e5e7b825d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_quux@
+hs_bindgen_5287e20e5e7b825d :: IO (BG.FunPtr (BG.CFloat -> BG.CChar -> IO BG.CChar))
+hs_bindgen_5287e20e5e7b825d =
+  fmap BG.fromFFIType hs_bindgen_5287e20e5e7b825d_base
+
+{-# NOINLINE quux #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux :: BG.FunPtr (BG.CFloat -> BG.CChar -> IO BG.CChar)
+quux = BG.unsafePerformIO hs_bindgen_5287e20e5e7b825d
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_wam@
+foreign import ccall unsafe "hs_bindgen_c99bba48e65f69c2" hs_bindgen_c99bba48e65f69c2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_wam@
+hs_bindgen_c99bba48e65f69c2 :: IO (BG.FunPtr (BG.CFloat -> BG.Ptr BG.CChar -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_c99bba48e65f69c2 =
+  fmap BG.fromFFIType hs_bindgen_c99bba48e65f69c2_base
+
+{-# NOINLINE wam #-}
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam :: BG.FunPtr (BG.CFloat -> BG.Ptr BG.CChar -> IO (BG.Ptr BG.CChar))
+wam = BG.unsafePerformIO hs_bindgen_c99bba48e65f69c2
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo1@
+foreign import ccall unsafe "hs_bindgen_c6abb6228804eb6f" hs_bindgen_c6abb6228804eb6f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo1@
+hs_bindgen_c6abb6228804eb6f :: IO (BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_c6abb6228804eb6f =
+  fmap BG.fromFFIType hs_bindgen_c6abb6228804eb6f_base
+
+{-# NOINLINE foo1 #-}
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1 :: BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar))
+foo1 = BG.unsafePerformIO hs_bindgen_c6abb6228804eb6f
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo2@
+foreign import ccall unsafe "hs_bindgen_2cd68a8ff1c700b1" hs_bindgen_2cd68a8ff1c700b1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo2@
+hs_bindgen_2cd68a8ff1c700b1 :: IO (BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_2cd68a8ff1c700b1 =
+  fmap BG.fromFFIType hs_bindgen_2cd68a8ff1c700b1_base
+
+{-# NOINLINE foo2 #-}
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2 :: BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar))
+foo2 = BG.unsafePerformIO hs_bindgen_2cd68a8ff1c700b1
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo3@
+foreign import ccall unsafe "hs_bindgen_7f22a584414189b4" hs_bindgen_7f22a584414189b4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo3@
+hs_bindgen_7f22a584414189b4 :: IO (BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_7f22a584414189b4 =
+  fmap BG.fromFFIType hs_bindgen_7f22a584414189b4_base
+
+{-# NOINLINE foo3 #-}
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3 :: BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar))
+foo3 = BG.unsafePerformIO hs_bindgen_7f22a584414189b4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar1@
+foreign import ccall unsafe "hs_bindgen_c1bdd45feff88132" hs_bindgen_c1bdd45feff88132_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar1@
+hs_bindgen_c1bdd45feff88132 :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_c1bdd45feff88132 =
+  fmap BG.fromFFIType hs_bindgen_c1bdd45feff88132_base
+
+{-# NOINLINE bar1 #-}
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar1 = BG.unsafePerformIO hs_bindgen_c1bdd45feff88132
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar2@
+foreign import ccall unsafe "hs_bindgen_db4789e738f22433" hs_bindgen_db4789e738f22433_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar2@
+hs_bindgen_db4789e738f22433 :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_db4789e738f22433 =
+  fmap BG.fromFFIType hs_bindgen_db4789e738f22433_base
+
+{-# NOINLINE bar2 #-}
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar2 = BG.unsafePerformIO hs_bindgen_db4789e738f22433
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar3@
+foreign import ccall unsafe "hs_bindgen_ce7381c4dae45aa0" hs_bindgen_ce7381c4dae45aa0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar3@
+hs_bindgen_ce7381c4dae45aa0 :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_ce7381c4dae45aa0 =
+  fmap BG.fromFFIType hs_bindgen_ce7381c4dae45aa0_base
+
+{-# NOINLINE bar3 #-}
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar3 = BG.unsafePerformIO hs_bindgen_ce7381c4dae45aa0
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar4@
+foreign import ccall unsafe "hs_bindgen_9fc1ae53f4373826" hs_bindgen_9fc1ae53f4373826_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar4@
+hs_bindgen_9fc1ae53f4373826 :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_9fc1ae53f4373826 =
+  fmap BG.fromFFIType hs_bindgen_9fc1ae53f4373826_base
+
+{-# NOINLINE bar4 #-}
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar4 = BG.unsafePerformIO hs_bindgen_9fc1ae53f4373826
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz1@
+foreign import ccall unsafe "hs_bindgen_7371729bfd8f41e0" hs_bindgen_7371729bfd8f41e0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz1@
+hs_bindgen_7371729bfd8f41e0 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_7371729bfd8f41e0 =
+  fmap BG.fromFFIType hs_bindgen_7371729bfd8f41e0_base
+
+{-# NOINLINE baz1 #-}
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt))))
+baz1 = BG.unsafePerformIO hs_bindgen_7371729bfd8f41e0
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz2@
+foreign import ccall unsafe "hs_bindgen_348d64df5f006ad8" hs_bindgen_348d64df5f006ad8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz2@
+hs_bindgen_348d64df5f006ad8 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_348d64df5f006ad8 =
+  fmap BG.fromFFIType hs_bindgen_348d64df5f006ad8_base
+
+{-# NOINLINE baz2 #-}
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt))))
+baz2 = BG.unsafePerformIO hs_bindgen_348d64df5f006ad8
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz3@
+foreign import ccall unsafe "hs_bindgen_d8409f68bb588204" hs_bindgen_d8409f68bb588204_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz3@
+hs_bindgen_d8409f68bb588204 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_d8409f68bb588204 =
+  fmap BG.fromFFIType hs_bindgen_d8409f68bb588204_base
+
+{-# NOINLINE baz3 #-}
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt))))
+baz3 = BG.unsafePerformIO hs_bindgen_d8409f68bb588204
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_5a80b21813f738d7" hs_bindgen_5a80b21813f738d7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_no_args_no_void@
+hs_bindgen_5a80b21813f738d7 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_5a80b21813f738d7 =
+  fmap BG.fromFFIType hs_bindgen_5a80b21813f738d7_base
+
+{-# NOINLINE no_args_no_void #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void :: BG.FunPtr (IO BG.CInt)
+no_args_no_void =
+  BG.unsafePerformIO hs_bindgen_5a80b21813f738d7
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/Example/Safe.hs
@@ -0,0 +1,469 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.quux
+    , Example.Safe.wam
+    , Example.Safe.foo1
+    , Example.Safe.foo2
+    , Example.Safe.foo3
+    , Example.Safe.bar1
+    , Example.Safe.bar2
+    , Example.Safe.bar3
+    , Example.Safe.bar4
+    , Example.Safe.baz1
+    , Example.Safe.baz2
+    , Example.Safe.baz3
+    , Example.Safe.no_args_no_void
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl.h>"
+  , "char hs_bindgen_0d589d05ef4464f1 ("
+  , "  float arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_5e34a9a021a16ef2 ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (wam)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_a653f9965418fe35 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo1)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_27d5c3bf56ffe127 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo2)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_28f84ffb010a241f ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo3)(arg1, arg2);"
+  , "}"
+  , "signed int (*hs_bindgen_bd2ce04af55e7267 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_71466c42e4144c66 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_158e79501bca5645 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar3)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_114a38b3ab9e70ba ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar4)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_3bbe244ce8f2af84 ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_1d115779ef74db4e ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_3609a59984f4f6c6 ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0d9adddf37d97870 (void)"
+  , "{"
+  , "  return (no_args_no_void)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_0d589d05ef4464f1" hs_bindgen_0d589d05ef4464f1_base ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_quux@
+hs_bindgen_0d589d05ef4464f1 ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+hs_bindgen_0d589d05ef4464f1 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0d589d05ef4464f1_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux = hs_bindgen_0d589d05ef4464f1
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_wam@
+foreign import ccall safe "hs_bindgen_5e34a9a021a16ef2" hs_bindgen_5e34a9a021a16ef2_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_wam@
+hs_bindgen_5e34a9a021a16ef2 ::
+     BG.CFloat
+  -> BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_5e34a9a021a16ef2 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_5e34a9a021a16ef2_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr BG.CChar)
+wam = hs_bindgen_5e34a9a021a16ef2
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo1@
+foreign import ccall safe "hs_bindgen_a653f9965418fe35" hs_bindgen_a653f9965418fe35_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo1@
+hs_bindgen_a653f9965418fe35 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_a653f9965418fe35 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a653f9965418fe35_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo1 = hs_bindgen_a653f9965418fe35
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo2@
+foreign import ccall safe "hs_bindgen_27d5c3bf56ffe127" hs_bindgen_27d5c3bf56ffe127_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo2@
+hs_bindgen_27d5c3bf56ffe127 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_27d5c3bf56ffe127 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_27d5c3bf56ffe127_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo2 = hs_bindgen_27d5c3bf56ffe127
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo3@
+foreign import ccall safe "hs_bindgen_28f84ffb010a241f" hs_bindgen_28f84ffb010a241f_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo3@
+hs_bindgen_28f84ffb010a241f ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_28f84ffb010a241f =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_28f84ffb010a241f_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo3 = hs_bindgen_28f84ffb010a241f
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar1@
+foreign import ccall safe "hs_bindgen_bd2ce04af55e7267" hs_bindgen_bd2ce04af55e7267_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar1@
+hs_bindgen_bd2ce04af55e7267 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_bd2ce04af55e7267 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bd2ce04af55e7267_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar1 = hs_bindgen_bd2ce04af55e7267
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar2@
+foreign import ccall safe "hs_bindgen_71466c42e4144c66" hs_bindgen_71466c42e4144c66_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar2@
+hs_bindgen_71466c42e4144c66 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_71466c42e4144c66 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_71466c42e4144c66_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar2 = hs_bindgen_71466c42e4144c66
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar3@
+foreign import ccall safe "hs_bindgen_158e79501bca5645" hs_bindgen_158e79501bca5645_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar3@
+hs_bindgen_158e79501bca5645 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_158e79501bca5645 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_158e79501bca5645_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar3 = hs_bindgen_158e79501bca5645
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar4@
+foreign import ccall safe "hs_bindgen_114a38b3ab9e70ba" hs_bindgen_114a38b3ab9e70ba_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar4@
+hs_bindgen_114a38b3ab9e70ba ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_114a38b3ab9e70ba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_114a38b3ab9e70ba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar4 = hs_bindgen_114a38b3ab9e70ba
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz1@
+foreign import ccall safe "hs_bindgen_3bbe244ce8f2af84" hs_bindgen_3bbe244ce8f2af84_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz1@
+hs_bindgen_3bbe244ce8f2af84 ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_3bbe244ce8f2af84 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3bbe244ce8f2af84_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz1 = hs_bindgen_3bbe244ce8f2af84
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz2@
+foreign import ccall safe "hs_bindgen_1d115779ef74db4e" hs_bindgen_1d115779ef74db4e_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz2@
+hs_bindgen_1d115779ef74db4e ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_1d115779ef74db4e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1d115779ef74db4e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz2 = hs_bindgen_1d115779ef74db4e
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz3@
+foreign import ccall safe "hs_bindgen_3609a59984f4f6c6" hs_bindgen_3609a59984f4f6c6_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz3@
+hs_bindgen_3609a59984f4f6c6 ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_3609a59984f4f6c6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3609a59984f4f6c6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz3 = hs_bindgen_3609a59984f4f6c6
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_no_args_no_void@
+foreign import ccall safe "hs_bindgen_0d9adddf37d97870" hs_bindgen_0d9adddf37d97870_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_no_args_no_void@
+hs_bindgen_0d9adddf37d97870 :: IO BG.CInt
+hs_bindgen_0d9adddf37d97870 =
+  fmap BG.fromFFIType hs_bindgen_0d9adddf37d97870_base
+
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void :: IO BG.CInt
+no_args_no_void = hs_bindgen_0d9adddf37d97870
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/Example/Unsafe.hs
@@ -0,0 +1,469 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.quux
+    , Example.Unsafe.wam
+    , Example.Unsafe.foo1
+    , Example.Unsafe.foo2
+    , Example.Unsafe.foo3
+    , Example.Unsafe.bar1
+    , Example.Unsafe.bar2
+    , Example.Unsafe.bar3
+    , Example.Unsafe.bar4
+    , Example.Unsafe.baz1
+    , Example.Unsafe.baz2
+    , Example.Unsafe.baz3
+    , Example.Unsafe.no_args_no_void
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl.h>"
+  , "char hs_bindgen_8742f64b88435032 ("
+  , "  float arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_2a7521a4578b9021 ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (wam)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_4997a9f97e766872 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo1)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_8f7161a0cc6544ab ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo2)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_964a5990350e54ca ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo3)(arg1, arg2);"
+  , "}"
+  , "signed int (*hs_bindgen_1845a22f2691bd3f ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_2ab30ac8925b7281 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_7a3bc5222b2ae81a ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar3)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_87b07373f703a039 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar4)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_4e9b527f6825fd5f ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_615bc960b75a0bef ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_414bbfce612b733a ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_56bb882786815655 (void)"
+  , "{"
+  , "  return (no_args_no_void)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_8742f64b88435032" hs_bindgen_8742f64b88435032_base ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_quux@
+hs_bindgen_8742f64b88435032 ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+hs_bindgen_8742f64b88435032 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_8742f64b88435032_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux = hs_bindgen_8742f64b88435032
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_wam@
+foreign import ccall unsafe "hs_bindgen_2a7521a4578b9021" hs_bindgen_2a7521a4578b9021_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_wam@
+hs_bindgen_2a7521a4578b9021 ::
+     BG.CFloat
+  -> BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_2a7521a4578b9021 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_2a7521a4578b9021_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr BG.CChar)
+wam = hs_bindgen_2a7521a4578b9021
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo1@
+foreign import ccall unsafe "hs_bindgen_4997a9f97e766872" hs_bindgen_4997a9f97e766872_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo1@
+hs_bindgen_4997a9f97e766872 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_4997a9f97e766872 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_4997a9f97e766872_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo1 = hs_bindgen_4997a9f97e766872
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo2@
+foreign import ccall unsafe "hs_bindgen_8f7161a0cc6544ab" hs_bindgen_8f7161a0cc6544ab_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo2@
+hs_bindgen_8f7161a0cc6544ab ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_8f7161a0cc6544ab =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_8f7161a0cc6544ab_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo2 = hs_bindgen_8f7161a0cc6544ab
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo3@
+foreign import ccall unsafe "hs_bindgen_964a5990350e54ca" hs_bindgen_964a5990350e54ca_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo3@
+hs_bindgen_964a5990350e54ca ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_964a5990350e54ca =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_964a5990350e54ca_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo3 = hs_bindgen_964a5990350e54ca
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar1@
+foreign import ccall unsafe "hs_bindgen_1845a22f2691bd3f" hs_bindgen_1845a22f2691bd3f_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar1@
+hs_bindgen_1845a22f2691bd3f ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_1845a22f2691bd3f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1845a22f2691bd3f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar1 = hs_bindgen_1845a22f2691bd3f
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar2@
+foreign import ccall unsafe "hs_bindgen_2ab30ac8925b7281" hs_bindgen_2ab30ac8925b7281_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar2@
+hs_bindgen_2ab30ac8925b7281 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_2ab30ac8925b7281 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2ab30ac8925b7281_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar2 = hs_bindgen_2ab30ac8925b7281
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar3@
+foreign import ccall unsafe "hs_bindgen_7a3bc5222b2ae81a" hs_bindgen_7a3bc5222b2ae81a_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar3@
+hs_bindgen_7a3bc5222b2ae81a ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_7a3bc5222b2ae81a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7a3bc5222b2ae81a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar3 = hs_bindgen_7a3bc5222b2ae81a
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar4@
+foreign import ccall unsafe "hs_bindgen_87b07373f703a039" hs_bindgen_87b07373f703a039_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar4@
+hs_bindgen_87b07373f703a039 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_87b07373f703a039 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_87b07373f703a039_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar4 = hs_bindgen_87b07373f703a039
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz1@
+foreign import ccall unsafe "hs_bindgen_4e9b527f6825fd5f" hs_bindgen_4e9b527f6825fd5f_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz1@
+hs_bindgen_4e9b527f6825fd5f ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_4e9b527f6825fd5f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4e9b527f6825fd5f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz1 = hs_bindgen_4e9b527f6825fd5f
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz2@
+foreign import ccall unsafe "hs_bindgen_615bc960b75a0bef" hs_bindgen_615bc960b75a0bef_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz2@
+hs_bindgen_615bc960b75a0bef ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_615bc960b75a0bef =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_615bc960b75a0bef_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz2 = hs_bindgen_615bc960b75a0bef
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz3@
+foreign import ccall unsafe "hs_bindgen_414bbfce612b733a" hs_bindgen_414bbfce612b733a_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz3@
+hs_bindgen_414bbfce612b733a ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_414bbfce612b733a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_414bbfce612b733a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz3 = hs_bindgen_414bbfce612b733a
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_56bb882786815655" hs_bindgen_56bb882786815655_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_no_args_no_void@
+hs_bindgen_56bb882786815655 :: IO BG.CInt
+hs_bindgen_56bb882786815655 =
+  fmap BG.fromFFIType hs_bindgen_56bb882786815655_base
+
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void :: IO BG.CInt
+no_args_no_void = hs_bindgen_56bb882786815655
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.1.empty/th.txt
@@ -0,0 +1,1225 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_in_fundecl.h
+-- #include <macros/macro_in_fundecl.h>
+-- char hs_bindgen_0d589d05ef4464f1 (
+--   float arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux)(arg1, arg2);
+-- }
+-- char *hs_bindgen_5e34a9a021a16ef2 (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return (wam)(arg1, arg2);
+-- }
+-- char *hs_bindgen_a653f9965418fe35 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo1)(arg1, arg2);
+-- }
+-- char *hs_bindgen_27d5c3bf56ffe127 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo2)(arg1, arg2);
+-- }
+-- char *hs_bindgen_28f84ffb010a241f (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo3)(arg1, arg2);
+-- }
+-- signed int (*hs_bindgen_bd2ce04af55e7267 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar1)(arg1);
+-- }
+-- signed int (*hs_bindgen_71466c42e4144c66 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar2)(arg1);
+-- }
+-- signed int (*hs_bindgen_158e79501bca5645 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar3)(arg1);
+-- }
+-- signed int (*hs_bindgen_114a38b3ab9e70ba (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar4)(arg1);
+-- }
+-- signed int (*hs_bindgen_3bbe244ce8f2af84 (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz1)(arg1);
+-- }
+-- signed int (*hs_bindgen_1d115779ef74db4e (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz2)(arg1);
+-- }
+-- signed int (*hs_bindgen_3609a59984f4f6c6 (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz3)(arg1);
+-- }
+-- signed int hs_bindgen_0d9adddf37d97870 (void)
+-- {
+--   return (no_args_no_void)();
+-- }
+-- char hs_bindgen_8742f64b88435032 (
+--   float arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux)(arg1, arg2);
+-- }
+-- char *hs_bindgen_2a7521a4578b9021 (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return (wam)(arg1, arg2);
+-- }
+-- char *hs_bindgen_4997a9f97e766872 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo1)(arg1, arg2);
+-- }
+-- char *hs_bindgen_8f7161a0cc6544ab (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo2)(arg1, arg2);
+-- }
+-- char *hs_bindgen_964a5990350e54ca (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo3)(arg1, arg2);
+-- }
+-- signed int (*hs_bindgen_1845a22f2691bd3f (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar1)(arg1);
+-- }
+-- signed int (*hs_bindgen_2ab30ac8925b7281 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar2)(arg1);
+-- }
+-- signed int (*hs_bindgen_7a3bc5222b2ae81a (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar3)(arg1);
+-- }
+-- signed int (*hs_bindgen_87b07373f703a039 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar4)(arg1);
+-- }
+-- signed int (*hs_bindgen_4e9b527f6825fd5f (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz1)(arg1);
+-- }
+-- signed int (*hs_bindgen_615bc960b75a0bef (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz2)(arg1);
+-- }
+-- signed int (*hs_bindgen_414bbfce612b733a (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz3)(arg1);
+-- }
+-- signed int hs_bindgen_56bb882786815655 (void)
+-- {
+--   return (no_args_no_void)();
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_quux */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_5287e20e5e7b825d (void)) (
+--   float arg1,
+--   char arg2
+-- )
+-- {
+--   return &quux;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_wam */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_c99bba48e65f69c2 (void)) (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return &wam;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_foo1 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_c6abb6228804eb6f (void)) (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo1;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_foo2 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_2cd68a8ff1c700b1 (void)) (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo2;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_foo3 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_7f22a584414189b4 (void)) (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo3;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_bar1 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_c1bdd45feff88132 (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar1;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_bar2 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_db4789e738f22433 (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar2;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_bar3 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_ce7381c4dae45aa0 (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar3;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_bar4 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_9fc1ae53f4373826 (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar4;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_baz1 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_7371729bfd8f41e0 (void)) (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return &baz1;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_baz2 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_348d64df5f006ad8 (void)) (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return &baz2;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_baz3 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_d8409f68bb588204 (void)) (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return &baz3;
+-- }
+-- /* test_macrosmacro_in_fundecl_1_empt_Example_get_no_args_no_void */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_5a80b21813f738d7 (void)) (void)
+-- {
+--   return &no_args_no_void;
+-- }
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_0d589d05ef4464f1" hs_bindgen_0d589d05ef4464f1_base ::
+    CFloat
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_quux@
+hs_bindgen_0d589d05ef4464f1 :: CFloat -> CChar -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_quux@
+hs_bindgen_0d589d05ef4464f1 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_0d589d05ef4464f1_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_safe :: CFloat -> CChar -> IO CChar
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_safe = hs_bindgen_0d589d05ef4464f1
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_wam@
+foreign import ccall safe "hs_bindgen_5e34a9a021a16ef2" hs_bindgen_5e34a9a021a16ef2_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_wam@
+hs_bindgen_5e34a9a021a16ef2 :: CFloat ->
+                               Ptr CChar -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_wam@
+hs_bindgen_5e34a9a021a16ef2 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_5e34a9a021a16ef2_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_safe :: CFloat -> Ptr CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_safe = hs_bindgen_5e34a9a021a16ef2
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo1@
+foreign import ccall safe "hs_bindgen_a653f9965418fe35" hs_bindgen_a653f9965418fe35_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo1@
+hs_bindgen_a653f9965418fe35 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo1@
+hs_bindgen_a653f9965418fe35 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_a653f9965418fe35_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_safe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_safe = hs_bindgen_a653f9965418fe35
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo2@
+foreign import ccall safe "hs_bindgen_27d5c3bf56ffe127" hs_bindgen_27d5c3bf56ffe127_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo2@
+hs_bindgen_27d5c3bf56ffe127 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo2@
+hs_bindgen_27d5c3bf56ffe127 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_27d5c3bf56ffe127_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_safe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_safe = hs_bindgen_27d5c3bf56ffe127
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo3@
+foreign import ccall safe "hs_bindgen_28f84ffb010a241f" hs_bindgen_28f84ffb010a241f_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo3@
+hs_bindgen_28f84ffb010a241f :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_foo3@
+hs_bindgen_28f84ffb010a241f = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_28f84ffb010a241f_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_safe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_safe = hs_bindgen_28f84ffb010a241f
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar1@
+foreign import ccall safe "hs_bindgen_bd2ce04af55e7267" hs_bindgen_bd2ce04af55e7267_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar1@
+hs_bindgen_bd2ce04af55e7267 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar1@
+hs_bindgen_bd2ce04af55e7267 = \x_0 -> fmap fromFFIType (hs_bindgen_bd2ce04af55e7267_base (toFFIType x_0))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_safe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_safe = hs_bindgen_bd2ce04af55e7267
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar2@
+foreign import ccall safe "hs_bindgen_71466c42e4144c66" hs_bindgen_71466c42e4144c66_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar2@
+hs_bindgen_71466c42e4144c66 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar2@
+hs_bindgen_71466c42e4144c66 = \x_0 -> fmap fromFFIType (hs_bindgen_71466c42e4144c66_base (toFFIType x_0))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_safe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_safe = hs_bindgen_71466c42e4144c66
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar3@
+foreign import ccall safe "hs_bindgen_158e79501bca5645" hs_bindgen_158e79501bca5645_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar3@
+hs_bindgen_158e79501bca5645 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar3@
+hs_bindgen_158e79501bca5645 = \x_0 -> fmap fromFFIType (hs_bindgen_158e79501bca5645_base (toFFIType x_0))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_safe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_safe = hs_bindgen_158e79501bca5645
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar4@
+foreign import ccall safe "hs_bindgen_114a38b3ab9e70ba" hs_bindgen_114a38b3ab9e70ba_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar4@
+hs_bindgen_114a38b3ab9e70ba :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_bar4@
+hs_bindgen_114a38b3ab9e70ba = \x_0 -> fmap fromFFIType (hs_bindgen_114a38b3ab9e70ba_base (toFFIType x_0))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_safe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_safe = hs_bindgen_114a38b3ab9e70ba
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz1@
+foreign import ccall safe "hs_bindgen_3bbe244ce8f2af84" hs_bindgen_3bbe244ce8f2af84_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz1@
+hs_bindgen_3bbe244ce8f2af84 :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz1@
+hs_bindgen_3bbe244ce8f2af84 = \x_0 -> fmap fromFFIType (hs_bindgen_3bbe244ce8f2af84_base (toFFIType x_0))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_safe :: CInt ->
+             IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_safe = hs_bindgen_3bbe244ce8f2af84
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz2@
+foreign import ccall safe "hs_bindgen_1d115779ef74db4e" hs_bindgen_1d115779ef74db4e_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz2@
+hs_bindgen_1d115779ef74db4e :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz2@
+hs_bindgen_1d115779ef74db4e = \x_0 -> fmap fromFFIType (hs_bindgen_1d115779ef74db4e_base (toFFIType x_0))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_safe :: CInt ->
+             IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_safe = hs_bindgen_1d115779ef74db4e
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz3@
+foreign import ccall safe "hs_bindgen_3609a59984f4f6c6" hs_bindgen_3609a59984f4f6c6_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz3@
+hs_bindgen_3609a59984f4f6c6 :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_baz3@
+hs_bindgen_3609a59984f4f6c6 = \x_0 -> fmap fromFFIType (hs_bindgen_3609a59984f4f6c6_base (toFFIType x_0))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_safe :: CInt ->
+             IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_safe = hs_bindgen_3609a59984f4f6c6
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_no_args_no_void@
+foreign import ccall safe "hs_bindgen_0d9adddf37d97870" hs_bindgen_0d9adddf37d97870_base ::
+    IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_no_args_no_void@
+hs_bindgen_0d9adddf37d97870 :: IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Safe_no_args_no_void@
+hs_bindgen_0d9adddf37d97870 = fmap fromFFIType hs_bindgen_0d9adddf37d97870_base
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_safe :: IO CInt
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_safe = hs_bindgen_0d9adddf37d97870
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_8742f64b88435032" hs_bindgen_8742f64b88435032_base ::
+    CFloat
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_quux@
+hs_bindgen_8742f64b88435032 :: CFloat -> CChar -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_quux@
+hs_bindgen_8742f64b88435032 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_8742f64b88435032_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_unsafe :: CFloat -> CChar -> IO CChar
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_unsafe = hs_bindgen_8742f64b88435032
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_wam@
+foreign import ccall unsafe "hs_bindgen_2a7521a4578b9021" hs_bindgen_2a7521a4578b9021_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_wam@
+hs_bindgen_2a7521a4578b9021 :: CFloat ->
+                               Ptr CChar -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_wam@
+hs_bindgen_2a7521a4578b9021 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_2a7521a4578b9021_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_unsafe :: CFloat -> Ptr CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_unsafe = hs_bindgen_2a7521a4578b9021
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo1@
+foreign import ccall unsafe "hs_bindgen_4997a9f97e766872" hs_bindgen_4997a9f97e766872_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo1@
+hs_bindgen_4997a9f97e766872 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo1@
+hs_bindgen_4997a9f97e766872 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_4997a9f97e766872_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_unsafe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_unsafe = hs_bindgen_4997a9f97e766872
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo2@
+foreign import ccall unsafe "hs_bindgen_8f7161a0cc6544ab" hs_bindgen_8f7161a0cc6544ab_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo2@
+hs_bindgen_8f7161a0cc6544ab :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo2@
+hs_bindgen_8f7161a0cc6544ab = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_8f7161a0cc6544ab_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_unsafe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_unsafe = hs_bindgen_8f7161a0cc6544ab
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo3@
+foreign import ccall unsafe "hs_bindgen_964a5990350e54ca" hs_bindgen_964a5990350e54ca_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo3@
+hs_bindgen_964a5990350e54ca :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_foo3@
+hs_bindgen_964a5990350e54ca = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_964a5990350e54ca_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_unsafe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_unsafe = hs_bindgen_964a5990350e54ca
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar1@
+foreign import ccall unsafe "hs_bindgen_1845a22f2691bd3f" hs_bindgen_1845a22f2691bd3f_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar1@
+hs_bindgen_1845a22f2691bd3f :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar1@
+hs_bindgen_1845a22f2691bd3f = \x_0 -> fmap fromFFIType (hs_bindgen_1845a22f2691bd3f_base (toFFIType x_0))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_unsafe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_unsafe = hs_bindgen_1845a22f2691bd3f
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar2@
+foreign import ccall unsafe "hs_bindgen_2ab30ac8925b7281" hs_bindgen_2ab30ac8925b7281_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar2@
+hs_bindgen_2ab30ac8925b7281 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar2@
+hs_bindgen_2ab30ac8925b7281 = \x_0 -> fmap fromFFIType (hs_bindgen_2ab30ac8925b7281_base (toFFIType x_0))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_unsafe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_unsafe = hs_bindgen_2ab30ac8925b7281
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar3@
+foreign import ccall unsafe "hs_bindgen_7a3bc5222b2ae81a" hs_bindgen_7a3bc5222b2ae81a_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar3@
+hs_bindgen_7a3bc5222b2ae81a :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar3@
+hs_bindgen_7a3bc5222b2ae81a = \x_0 -> fmap fromFFIType (hs_bindgen_7a3bc5222b2ae81a_base (toFFIType x_0))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_unsafe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_unsafe = hs_bindgen_7a3bc5222b2ae81a
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar4@
+foreign import ccall unsafe "hs_bindgen_87b07373f703a039" hs_bindgen_87b07373f703a039_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar4@
+hs_bindgen_87b07373f703a039 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_bar4@
+hs_bindgen_87b07373f703a039 = \x_0 -> fmap fromFFIType (hs_bindgen_87b07373f703a039_base (toFFIType x_0))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_unsafe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_unsafe = hs_bindgen_87b07373f703a039
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz1@
+foreign import ccall unsafe "hs_bindgen_4e9b527f6825fd5f" hs_bindgen_4e9b527f6825fd5f_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz1@
+hs_bindgen_4e9b527f6825fd5f :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz1@
+hs_bindgen_4e9b527f6825fd5f = \x_0 -> fmap fromFFIType (hs_bindgen_4e9b527f6825fd5f_base (toFFIType x_0))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_unsafe :: CInt ->
+               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_unsafe = hs_bindgen_4e9b527f6825fd5f
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz2@
+foreign import ccall unsafe "hs_bindgen_615bc960b75a0bef" hs_bindgen_615bc960b75a0bef_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz2@
+hs_bindgen_615bc960b75a0bef :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz2@
+hs_bindgen_615bc960b75a0bef = \x_0 -> fmap fromFFIType (hs_bindgen_615bc960b75a0bef_base (toFFIType x_0))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_unsafe :: CInt ->
+               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_unsafe = hs_bindgen_615bc960b75a0bef
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz3@
+foreign import ccall unsafe "hs_bindgen_414bbfce612b733a" hs_bindgen_414bbfce612b733a_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz3@
+hs_bindgen_414bbfce612b733a :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_baz3@
+hs_bindgen_414bbfce612b733a = \x_0 -> fmap fromFFIType (hs_bindgen_414bbfce612b733a_base (toFFIType x_0))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_unsafe :: CInt ->
+               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_unsafe = hs_bindgen_414bbfce612b733a
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_56bb882786815655" hs_bindgen_56bb882786815655_base ::
+    IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_no_args_no_void@
+hs_bindgen_56bb882786815655 :: IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_Unsafe_no_args_no_void@
+hs_bindgen_56bb882786815655 = fmap fromFFIType hs_bindgen_56bb882786815655_base
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_unsafe :: IO CInt
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_unsafe = hs_bindgen_56bb882786815655
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_5287e20e5e7b825d" hs_bindgen_5287e20e5e7b825d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_quux@
+hs_bindgen_5287e20e5e7b825d :: IO (FunPtr (CFloat ->
+                                           CChar -> IO CChar))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_quux@
+hs_bindgen_5287e20e5e7b825d = fmap fromFFIType hs_bindgen_5287e20e5e7b825d_base
+{-# NOINLINE quux_funptr #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_funptr :: FunPtr (CFloat -> CChar -> IO CChar)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_funptr = unsafePerformIO hs_bindgen_5287e20e5e7b825d
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_wam@
+foreign import ccall unsafe "hs_bindgen_c99bba48e65f69c2" hs_bindgen_c99bba48e65f69c2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_wam@
+hs_bindgen_c99bba48e65f69c2 :: IO (FunPtr (CFloat ->
+                                           Ptr CChar -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_wam@
+hs_bindgen_c99bba48e65f69c2 = fmap fromFFIType hs_bindgen_c99bba48e65f69c2_base
+{-# NOINLINE wam_funptr #-}
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_funptr :: FunPtr (CFloat -> Ptr CChar -> IO (Ptr CChar))
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_funptr = unsafePerformIO hs_bindgen_c99bba48e65f69c2
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo1@
+foreign import ccall unsafe "hs_bindgen_c6abb6228804eb6f" hs_bindgen_c6abb6228804eb6f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo1@
+hs_bindgen_c6abb6228804eb6f :: IO (FunPtr (CFloat ->
+                                           FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo1@
+hs_bindgen_c6abb6228804eb6f = fmap fromFFIType hs_bindgen_c6abb6228804eb6f_base
+{-# NOINLINE foo1_funptr #-}
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_funptr :: FunPtr (CFloat ->
+                       FunPtr (CInt -> IO CInt) -> IO (Ptr CChar))
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_funptr = unsafePerformIO hs_bindgen_c6abb6228804eb6f
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo2@
+foreign import ccall unsafe "hs_bindgen_2cd68a8ff1c700b1" hs_bindgen_2cd68a8ff1c700b1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo2@
+hs_bindgen_2cd68a8ff1c700b1 :: IO (FunPtr (CFloat ->
+                                           FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo2@
+hs_bindgen_2cd68a8ff1c700b1 = fmap fromFFIType hs_bindgen_2cd68a8ff1c700b1_base
+{-# NOINLINE foo2_funptr #-}
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_funptr :: FunPtr (CFloat ->
+                       FunPtr (CInt -> IO CInt) -> IO (Ptr CChar))
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_funptr = unsafePerformIO hs_bindgen_2cd68a8ff1c700b1
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo3@
+foreign import ccall unsafe "hs_bindgen_7f22a584414189b4" hs_bindgen_7f22a584414189b4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo3@
+hs_bindgen_7f22a584414189b4 :: IO (FunPtr (CFloat ->
+                                           FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_foo3@
+hs_bindgen_7f22a584414189b4 = fmap fromFFIType hs_bindgen_7f22a584414189b4_base
+{-# NOINLINE foo3_funptr #-}
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_funptr :: FunPtr (CFloat ->
+                       FunPtr (CInt -> IO CInt) -> IO (Ptr CChar))
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_funptr = unsafePerformIO hs_bindgen_7f22a584414189b4
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar1@
+foreign import ccall unsafe "hs_bindgen_c1bdd45feff88132" hs_bindgen_c1bdd45feff88132_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar1@
+hs_bindgen_c1bdd45feff88132 :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar1@
+hs_bindgen_c1bdd45feff88132 = fmap fromFFIType hs_bindgen_c1bdd45feff88132_base
+{-# NOINLINE bar1_funptr #-}
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_funptr = unsafePerformIO hs_bindgen_c1bdd45feff88132
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar2@
+foreign import ccall unsafe "hs_bindgen_db4789e738f22433" hs_bindgen_db4789e738f22433_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar2@
+hs_bindgen_db4789e738f22433 :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar2@
+hs_bindgen_db4789e738f22433 = fmap fromFFIType hs_bindgen_db4789e738f22433_base
+{-# NOINLINE bar2_funptr #-}
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_funptr = unsafePerformIO hs_bindgen_db4789e738f22433
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar3@
+foreign import ccall unsafe "hs_bindgen_ce7381c4dae45aa0" hs_bindgen_ce7381c4dae45aa0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar3@
+hs_bindgen_ce7381c4dae45aa0 :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar3@
+hs_bindgen_ce7381c4dae45aa0 = fmap fromFFIType hs_bindgen_ce7381c4dae45aa0_base
+{-# NOINLINE bar3_funptr #-}
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_funptr = unsafePerformIO hs_bindgen_ce7381c4dae45aa0
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar4@
+foreign import ccall unsafe "hs_bindgen_9fc1ae53f4373826" hs_bindgen_9fc1ae53f4373826_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar4@
+hs_bindgen_9fc1ae53f4373826 :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_bar4@
+hs_bindgen_9fc1ae53f4373826 = fmap fromFFIType hs_bindgen_9fc1ae53f4373826_base
+{-# NOINLINE bar4_funptr #-}
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_funptr = unsafePerformIO hs_bindgen_9fc1ae53f4373826
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz1@
+foreign import ccall unsafe "hs_bindgen_7371729bfd8f41e0" hs_bindgen_7371729bfd8f41e0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz1@
+hs_bindgen_7371729bfd8f41e0 :: IO (FunPtr (CInt ->
+                                           IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz1@
+hs_bindgen_7371729bfd8f41e0 = fmap fromFFIType hs_bindgen_7371729bfd8f41e0_base
+{-# NOINLINE baz1_funptr #-}
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_funptr :: FunPtr (CInt ->
+                       IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt))))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_funptr = unsafePerformIO hs_bindgen_7371729bfd8f41e0
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz2@
+foreign import ccall unsafe "hs_bindgen_348d64df5f006ad8" hs_bindgen_348d64df5f006ad8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz2@
+hs_bindgen_348d64df5f006ad8 :: IO (FunPtr (CInt ->
+                                           IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz2@
+hs_bindgen_348d64df5f006ad8 = fmap fromFFIType hs_bindgen_348d64df5f006ad8_base
+{-# NOINLINE baz2_funptr #-}
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_funptr :: FunPtr (CInt ->
+                       IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt))))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_funptr = unsafePerformIO hs_bindgen_348d64df5f006ad8
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz3@
+foreign import ccall unsafe "hs_bindgen_d8409f68bb588204" hs_bindgen_d8409f68bb588204_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz3@
+hs_bindgen_d8409f68bb588204 :: IO (FunPtr (CInt ->
+                                           IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_baz3@
+hs_bindgen_d8409f68bb588204 = fmap fromFFIType hs_bindgen_d8409f68bb588204_base
+{-# NOINLINE baz3_funptr #-}
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_funptr :: FunPtr (CInt ->
+                       IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt))))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_funptr = unsafePerformIO hs_bindgen_d8409f68bb588204
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_5a80b21813f738d7" hs_bindgen_5a80b21813f738d7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_no_args_no_void@
+hs_bindgen_5a80b21813f738d7 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_1_empt_Example_get_no_args_no_void@
+hs_bindgen_5a80b21813f738d7 = fmap fromFFIType hs_bindgen_5a80b21813f738d7_base
+{-# NOINLINE no_args_no_void_funptr #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_funptr = unsafePerformIO hs_bindgen_5a80b21813f738d7
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example.hs
@@ -0,0 +1,58 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.i
+    , Example.c
+    , Example.f
+    , Example.l
+    , Example.s
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro I@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 5:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+i :: Macro.Raw String
+i = Macro.objectLike "I" ["int"]
+
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 6:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+c :: Macro.Raw String
+c = Macro.objectLike "C" ["char"]
+
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 7:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+f :: Macro.Raw String
+f = Macro.objectLike "F" ["float"]
+
+{-| __C declaration:__ @macro L@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 8:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+l :: Macro.Raw String
+l = Macro.objectLike "L" ["long"]
+
+{-| __C declaration:__ @macro S@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 9:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+s :: Macro.Raw String
+s = Macro.objectLike "S" ["short"]
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example/FunPtr.hs
@@ -0,0 +1,400 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.quux
+    , Example.FunPtr.wam
+    , Example.FunPtr.foo1
+    , Example.FunPtr.foo2
+    , Example.FunPtr.foo3
+    , Example.FunPtr.bar1
+    , Example.FunPtr.bar2
+    , Example.FunPtr.bar3
+    , Example.FunPtr.bar4
+    , Example.FunPtr.baz1
+    , Example.FunPtr.baz2
+    , Example.FunPtr.baz3
+    , Example.FunPtr.no_args_no_void
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl.h>"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_quux */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_74169d8db55aee29 (void)) ("
+  , "  float arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &quux;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_wam */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_5181a3906e0dbcd0 (void)) ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return &wam;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_foo1 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_a36f322a391d1892 (void)) ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_foo2 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_d4a2d20bdafd587c (void)) ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_foo3 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_e12635d17ba76dbe (void)) ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_bar1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_0d4abdd006893d05 (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_bar2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_48eea819ab113ebd (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_bar3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_14e5e584697348b2 (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_bar4 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_84c4ab01f92c9531 (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar4;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_baz1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_735e74a32eb70545 (void)) ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return &baz1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_baz2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_e99b238adefb8ed5 (void)) ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return &baz2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_baz3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_b00b767b92358e5e (void)) ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return &baz3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_2_raw_Example_get_no_args_no_void */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_d6825192c2bff8ef (void)) (void)"
+  , "{"
+  , "  return &no_args_no_void;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_74169d8db55aee29" hs_bindgen_74169d8db55aee29_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_quux@
+hs_bindgen_74169d8db55aee29 :: IO (BG.FunPtr (BG.CFloat -> BG.CChar -> IO BG.CChar))
+hs_bindgen_74169d8db55aee29 =
+  fmap BG.fromFFIType hs_bindgen_74169d8db55aee29_base
+
+{-# NOINLINE quux #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux :: BG.FunPtr (BG.CFloat -> BG.CChar -> IO BG.CChar)
+quux = BG.unsafePerformIO hs_bindgen_74169d8db55aee29
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_wam@
+foreign import ccall unsafe "hs_bindgen_5181a3906e0dbcd0" hs_bindgen_5181a3906e0dbcd0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_wam@
+hs_bindgen_5181a3906e0dbcd0 :: IO (BG.FunPtr (BG.CFloat -> BG.Ptr BG.CChar -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_5181a3906e0dbcd0 =
+  fmap BG.fromFFIType hs_bindgen_5181a3906e0dbcd0_base
+
+{-# NOINLINE wam #-}
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam :: BG.FunPtr (BG.CFloat -> BG.Ptr BG.CChar -> IO (BG.Ptr BG.CChar))
+wam = BG.unsafePerformIO hs_bindgen_5181a3906e0dbcd0
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo1@
+foreign import ccall unsafe "hs_bindgen_a36f322a391d1892" hs_bindgen_a36f322a391d1892_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo1@
+hs_bindgen_a36f322a391d1892 :: IO (BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_a36f322a391d1892 =
+  fmap BG.fromFFIType hs_bindgen_a36f322a391d1892_base
+
+{-# NOINLINE foo1 #-}
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1 :: BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar))
+foo1 = BG.unsafePerformIO hs_bindgen_a36f322a391d1892
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo2@
+foreign import ccall unsafe "hs_bindgen_d4a2d20bdafd587c" hs_bindgen_d4a2d20bdafd587c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo2@
+hs_bindgen_d4a2d20bdafd587c :: IO (BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_d4a2d20bdafd587c =
+  fmap BG.fromFFIType hs_bindgen_d4a2d20bdafd587c_base
+
+{-# NOINLINE foo2 #-}
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2 :: BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar))
+foo2 = BG.unsafePerformIO hs_bindgen_d4a2d20bdafd587c
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo3@
+foreign import ccall unsafe "hs_bindgen_e12635d17ba76dbe" hs_bindgen_e12635d17ba76dbe_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo3@
+hs_bindgen_e12635d17ba76dbe :: IO (BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_e12635d17ba76dbe =
+  fmap BG.fromFFIType hs_bindgen_e12635d17ba76dbe_base
+
+{-# NOINLINE foo3 #-}
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3 :: BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar))
+foo3 = BG.unsafePerformIO hs_bindgen_e12635d17ba76dbe
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar1@
+foreign import ccall unsafe "hs_bindgen_0d4abdd006893d05" hs_bindgen_0d4abdd006893d05_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar1@
+hs_bindgen_0d4abdd006893d05 :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_0d4abdd006893d05 =
+  fmap BG.fromFFIType hs_bindgen_0d4abdd006893d05_base
+
+{-# NOINLINE bar1 #-}
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar1 = BG.unsafePerformIO hs_bindgen_0d4abdd006893d05
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar2@
+foreign import ccall unsafe "hs_bindgen_48eea819ab113ebd" hs_bindgen_48eea819ab113ebd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar2@
+hs_bindgen_48eea819ab113ebd :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_48eea819ab113ebd =
+  fmap BG.fromFFIType hs_bindgen_48eea819ab113ebd_base
+
+{-# NOINLINE bar2 #-}
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar2 = BG.unsafePerformIO hs_bindgen_48eea819ab113ebd
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar3@
+foreign import ccall unsafe "hs_bindgen_14e5e584697348b2" hs_bindgen_14e5e584697348b2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar3@
+hs_bindgen_14e5e584697348b2 :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_14e5e584697348b2 =
+  fmap BG.fromFFIType hs_bindgen_14e5e584697348b2_base
+
+{-# NOINLINE bar3 #-}
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar3 = BG.unsafePerformIO hs_bindgen_14e5e584697348b2
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar4@
+foreign import ccall unsafe "hs_bindgen_84c4ab01f92c9531" hs_bindgen_84c4ab01f92c9531_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar4@
+hs_bindgen_84c4ab01f92c9531 :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_84c4ab01f92c9531 =
+  fmap BG.fromFFIType hs_bindgen_84c4ab01f92c9531_base
+
+{-# NOINLINE bar4 #-}
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar4 = BG.unsafePerformIO hs_bindgen_84c4ab01f92c9531
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz1@
+foreign import ccall unsafe "hs_bindgen_735e74a32eb70545" hs_bindgen_735e74a32eb70545_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz1@
+hs_bindgen_735e74a32eb70545 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_735e74a32eb70545 =
+  fmap BG.fromFFIType hs_bindgen_735e74a32eb70545_base
+
+{-# NOINLINE baz1 #-}
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt))))
+baz1 = BG.unsafePerformIO hs_bindgen_735e74a32eb70545
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz2@
+foreign import ccall unsafe "hs_bindgen_e99b238adefb8ed5" hs_bindgen_e99b238adefb8ed5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz2@
+hs_bindgen_e99b238adefb8ed5 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_e99b238adefb8ed5 =
+  fmap BG.fromFFIType hs_bindgen_e99b238adefb8ed5_base
+
+{-# NOINLINE baz2 #-}
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt))))
+baz2 = BG.unsafePerformIO hs_bindgen_e99b238adefb8ed5
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz3@
+foreign import ccall unsafe "hs_bindgen_b00b767b92358e5e" hs_bindgen_b00b767b92358e5e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz3@
+hs_bindgen_b00b767b92358e5e :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_b00b767b92358e5e =
+  fmap BG.fromFFIType hs_bindgen_b00b767b92358e5e_base
+
+{-# NOINLINE baz3 #-}
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt))))
+baz3 = BG.unsafePerformIO hs_bindgen_b00b767b92358e5e
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_d6825192c2bff8ef" hs_bindgen_d6825192c2bff8ef_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_no_args_no_void@
+hs_bindgen_d6825192c2bff8ef :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_d6825192c2bff8ef =
+  fmap BG.fromFFIType hs_bindgen_d6825192c2bff8ef_base
+
+{-# NOINLINE no_args_no_void #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void :: BG.FunPtr (IO BG.CInt)
+no_args_no_void =
+  BG.unsafePerformIO hs_bindgen_d6825192c2bff8ef
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example/Safe.hs
@@ -0,0 +1,469 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.quux
+    , Example.Safe.wam
+    , Example.Safe.foo1
+    , Example.Safe.foo2
+    , Example.Safe.foo3
+    , Example.Safe.bar1
+    , Example.Safe.bar2
+    , Example.Safe.bar3
+    , Example.Safe.bar4
+    , Example.Safe.baz1
+    , Example.Safe.baz2
+    , Example.Safe.baz3
+    , Example.Safe.no_args_no_void
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl.h>"
+  , "char hs_bindgen_d9bba200e8ee3d2e ("
+  , "  float arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_8e4fd99c7d7552e4 ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (wam)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_0d427252ce24447b ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo1)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_6e91d4c8387d9391 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo2)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_d36a763eccc05a06 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo3)(arg1, arg2);"
+  , "}"
+  , "signed int (*hs_bindgen_f38b40583a94f166 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_2eee4ad4c74521f2 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_e390113427697fef ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar3)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_30d0a25d063e8e6d ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar4)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_4f754558fc5ce39a ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_cd12ed5725181713 ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_442db04f13fdac86 ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e84f5f25b8a3d57c (void)"
+  , "{"
+  , "  return (no_args_no_void)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_d9bba200e8ee3d2e" hs_bindgen_d9bba200e8ee3d2e_base ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_quux@
+hs_bindgen_d9bba200e8ee3d2e ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+hs_bindgen_d9bba200e8ee3d2e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_d9bba200e8ee3d2e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux = hs_bindgen_d9bba200e8ee3d2e
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_wam@
+foreign import ccall safe "hs_bindgen_8e4fd99c7d7552e4" hs_bindgen_8e4fd99c7d7552e4_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_wam@
+hs_bindgen_8e4fd99c7d7552e4 ::
+     BG.CFloat
+  -> BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_8e4fd99c7d7552e4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_8e4fd99c7d7552e4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr BG.CChar)
+wam = hs_bindgen_8e4fd99c7d7552e4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo1@
+foreign import ccall safe "hs_bindgen_0d427252ce24447b" hs_bindgen_0d427252ce24447b_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo1@
+hs_bindgen_0d427252ce24447b ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_0d427252ce24447b =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0d427252ce24447b_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo1 = hs_bindgen_0d427252ce24447b
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo2@
+foreign import ccall safe "hs_bindgen_6e91d4c8387d9391" hs_bindgen_6e91d4c8387d9391_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo2@
+hs_bindgen_6e91d4c8387d9391 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_6e91d4c8387d9391 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6e91d4c8387d9391_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo2 = hs_bindgen_6e91d4c8387d9391
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo3@
+foreign import ccall safe "hs_bindgen_d36a763eccc05a06" hs_bindgen_d36a763eccc05a06_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo3@
+hs_bindgen_d36a763eccc05a06 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_d36a763eccc05a06 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_d36a763eccc05a06_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo3 = hs_bindgen_d36a763eccc05a06
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar1@
+foreign import ccall safe "hs_bindgen_f38b40583a94f166" hs_bindgen_f38b40583a94f166_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar1@
+hs_bindgen_f38b40583a94f166 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_f38b40583a94f166 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f38b40583a94f166_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar1 = hs_bindgen_f38b40583a94f166
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar2@
+foreign import ccall safe "hs_bindgen_2eee4ad4c74521f2" hs_bindgen_2eee4ad4c74521f2_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar2@
+hs_bindgen_2eee4ad4c74521f2 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_2eee4ad4c74521f2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2eee4ad4c74521f2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar2 = hs_bindgen_2eee4ad4c74521f2
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar3@
+foreign import ccall safe "hs_bindgen_e390113427697fef" hs_bindgen_e390113427697fef_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar3@
+hs_bindgen_e390113427697fef ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_e390113427697fef =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e390113427697fef_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar3 = hs_bindgen_e390113427697fef
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar4@
+foreign import ccall safe "hs_bindgen_30d0a25d063e8e6d" hs_bindgen_30d0a25d063e8e6d_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar4@
+hs_bindgen_30d0a25d063e8e6d ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_30d0a25d063e8e6d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_30d0a25d063e8e6d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar4 = hs_bindgen_30d0a25d063e8e6d
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz1@
+foreign import ccall safe "hs_bindgen_4f754558fc5ce39a" hs_bindgen_4f754558fc5ce39a_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz1@
+hs_bindgen_4f754558fc5ce39a ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_4f754558fc5ce39a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4f754558fc5ce39a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz1 = hs_bindgen_4f754558fc5ce39a
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz2@
+foreign import ccall safe "hs_bindgen_cd12ed5725181713" hs_bindgen_cd12ed5725181713_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz2@
+hs_bindgen_cd12ed5725181713 ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_cd12ed5725181713 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cd12ed5725181713_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz2 = hs_bindgen_cd12ed5725181713
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz3@
+foreign import ccall safe "hs_bindgen_442db04f13fdac86" hs_bindgen_442db04f13fdac86_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz3@
+hs_bindgen_442db04f13fdac86 ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_442db04f13fdac86 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_442db04f13fdac86_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz3 = hs_bindgen_442db04f13fdac86
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_no_args_no_void@
+foreign import ccall safe "hs_bindgen_e84f5f25b8a3d57c" hs_bindgen_e84f5f25b8a3d57c_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_no_args_no_void@
+hs_bindgen_e84f5f25b8a3d57c :: IO BG.CInt
+hs_bindgen_e84f5f25b8a3d57c =
+  fmap BG.fromFFIType hs_bindgen_e84f5f25b8a3d57c_base
+
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void :: IO BG.CInt
+no_args_no_void = hs_bindgen_e84f5f25b8a3d57c
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/Example/Unsafe.hs
@@ -0,0 +1,469 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.quux
+    , Example.Unsafe.wam
+    , Example.Unsafe.foo1
+    , Example.Unsafe.foo2
+    , Example.Unsafe.foo3
+    , Example.Unsafe.bar1
+    , Example.Unsafe.bar2
+    , Example.Unsafe.bar3
+    , Example.Unsafe.bar4
+    , Example.Unsafe.baz1
+    , Example.Unsafe.baz2
+    , Example.Unsafe.baz3
+    , Example.Unsafe.no_args_no_void
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl.h>"
+  , "char hs_bindgen_6b552cf38fe835d9 ("
+  , "  float arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_c21f84e027d8887c ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (wam)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_2401297c490b2b53 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo1)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_245d9b4b607a0239 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo2)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_f731296a8b75c18c ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo3)(arg1, arg2);"
+  , "}"
+  , "signed int (*hs_bindgen_9e8e0078d6f5f10d ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_c3dc7bc6e13e4444 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_b10397be2af8a563 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar3)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_3670d1c6cdde814b ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar4)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_9d5573689ffc268e ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_936c3cbcdbf36457 ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_6fdade83f34edbda ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_8909620ea33bb4d6 (void)"
+  , "{"
+  , "  return (no_args_no_void)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_6b552cf38fe835d9" hs_bindgen_6b552cf38fe835d9_base ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_quux@
+hs_bindgen_6b552cf38fe835d9 ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+hs_bindgen_6b552cf38fe835d9 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6b552cf38fe835d9_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux = hs_bindgen_6b552cf38fe835d9
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_wam@
+foreign import ccall unsafe "hs_bindgen_c21f84e027d8887c" hs_bindgen_c21f84e027d8887c_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_wam@
+hs_bindgen_c21f84e027d8887c ::
+     BG.CFloat
+  -> BG.Ptr BG.CChar
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_c21f84e027d8887c =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_c21f84e027d8887c_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr BG.CChar)
+wam = hs_bindgen_c21f84e027d8887c
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo1@
+foreign import ccall unsafe "hs_bindgen_2401297c490b2b53" hs_bindgen_2401297c490b2b53_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo1@
+hs_bindgen_2401297c490b2b53 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_2401297c490b2b53 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_2401297c490b2b53_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo1 = hs_bindgen_2401297c490b2b53
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo2@
+foreign import ccall unsafe "hs_bindgen_245d9b4b607a0239" hs_bindgen_245d9b4b607a0239_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo2@
+hs_bindgen_245d9b4b607a0239 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_245d9b4b607a0239 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_245d9b4b607a0239_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo2 = hs_bindgen_245d9b4b607a0239
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo3@
+foreign import ccall unsafe "hs_bindgen_f731296a8b75c18c" hs_bindgen_f731296a8b75c18c_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo3@
+hs_bindgen_f731296a8b75c18c ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_f731296a8b75c18c =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_f731296a8b75c18c_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo3 = hs_bindgen_f731296a8b75c18c
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar1@
+foreign import ccall unsafe "hs_bindgen_9e8e0078d6f5f10d" hs_bindgen_9e8e0078d6f5f10d_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar1@
+hs_bindgen_9e8e0078d6f5f10d ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_9e8e0078d6f5f10d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9e8e0078d6f5f10d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar1 = hs_bindgen_9e8e0078d6f5f10d
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar2@
+foreign import ccall unsafe "hs_bindgen_c3dc7bc6e13e4444" hs_bindgen_c3dc7bc6e13e4444_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar2@
+hs_bindgen_c3dc7bc6e13e4444 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_c3dc7bc6e13e4444 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c3dc7bc6e13e4444_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar2 = hs_bindgen_c3dc7bc6e13e4444
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar3@
+foreign import ccall unsafe "hs_bindgen_b10397be2af8a563" hs_bindgen_b10397be2af8a563_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar3@
+hs_bindgen_b10397be2af8a563 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_b10397be2af8a563 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b10397be2af8a563_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar3 = hs_bindgen_b10397be2af8a563
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar4@
+foreign import ccall unsafe "hs_bindgen_3670d1c6cdde814b" hs_bindgen_3670d1c6cdde814b_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar4@
+hs_bindgen_3670d1c6cdde814b ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_3670d1c6cdde814b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3670d1c6cdde814b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar4 = hs_bindgen_3670d1c6cdde814b
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz1@
+foreign import ccall unsafe "hs_bindgen_9d5573689ffc268e" hs_bindgen_9d5573689ffc268e_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz1@
+hs_bindgen_9d5573689ffc268e ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_9d5573689ffc268e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9d5573689ffc268e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz1 = hs_bindgen_9d5573689ffc268e
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz2@
+foreign import ccall unsafe "hs_bindgen_936c3cbcdbf36457" hs_bindgen_936c3cbcdbf36457_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz2@
+hs_bindgen_936c3cbcdbf36457 ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_936c3cbcdbf36457 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_936c3cbcdbf36457_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz2 = hs_bindgen_936c3cbcdbf36457
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz3@
+foreign import ccall unsafe "hs_bindgen_6fdade83f34edbda" hs_bindgen_6fdade83f34edbda_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz3@
+hs_bindgen_6fdade83f34edbda ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_6fdade83f34edbda =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6fdade83f34edbda_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz3 = hs_bindgen_6fdade83f34edbda
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_8909620ea33bb4d6" hs_bindgen_8909620ea33bb4d6_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_no_args_no_void@
+hs_bindgen_8909620ea33bb4d6 :: IO BG.CInt
+hs_bindgen_8909620ea33bb4d6 =
+  fmap BG.fromFFIType hs_bindgen_8909620ea33bb4d6_base
+
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void :: IO BG.CInt
+no_args_no_void = hs_bindgen_8909620ea33bb4d6
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl.2.raw/th.txt
@@ -0,0 +1,1295 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_in_fundecl.h
+-- #include <macros/macro_in_fundecl.h>
+-- char hs_bindgen_d9bba200e8ee3d2e (
+--   float arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux)(arg1, arg2);
+-- }
+-- char *hs_bindgen_8e4fd99c7d7552e4 (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return (wam)(arg1, arg2);
+-- }
+-- char *hs_bindgen_0d427252ce24447b (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo1)(arg1, arg2);
+-- }
+-- char *hs_bindgen_6e91d4c8387d9391 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo2)(arg1, arg2);
+-- }
+-- char *hs_bindgen_d36a763eccc05a06 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo3)(arg1, arg2);
+-- }
+-- signed int (*hs_bindgen_f38b40583a94f166 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar1)(arg1);
+-- }
+-- signed int (*hs_bindgen_2eee4ad4c74521f2 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar2)(arg1);
+-- }
+-- signed int (*hs_bindgen_e390113427697fef (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar3)(arg1);
+-- }
+-- signed int (*hs_bindgen_30d0a25d063e8e6d (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar4)(arg1);
+-- }
+-- signed int (*hs_bindgen_4f754558fc5ce39a (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz1)(arg1);
+-- }
+-- signed int (*hs_bindgen_cd12ed5725181713 (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz2)(arg1);
+-- }
+-- signed int (*hs_bindgen_442db04f13fdac86 (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz3)(arg1);
+-- }
+-- signed int hs_bindgen_e84f5f25b8a3d57c (void)
+-- {
+--   return (no_args_no_void)();
+-- }
+-- char hs_bindgen_6b552cf38fe835d9 (
+--   float arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux)(arg1, arg2);
+-- }
+-- char *hs_bindgen_c21f84e027d8887c (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return (wam)(arg1, arg2);
+-- }
+-- char *hs_bindgen_2401297c490b2b53 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo1)(arg1, arg2);
+-- }
+-- char *hs_bindgen_245d9b4b607a0239 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo2)(arg1, arg2);
+-- }
+-- char *hs_bindgen_f731296a8b75c18c (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo3)(arg1, arg2);
+-- }
+-- signed int (*hs_bindgen_9e8e0078d6f5f10d (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar1)(arg1);
+-- }
+-- signed int (*hs_bindgen_c3dc7bc6e13e4444 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar2)(arg1);
+-- }
+-- signed int (*hs_bindgen_b10397be2af8a563 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar3)(arg1);
+-- }
+-- signed int (*hs_bindgen_3670d1c6cdde814b (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar4)(arg1);
+-- }
+-- signed int (*hs_bindgen_9d5573689ffc268e (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz1)(arg1);
+-- }
+-- signed int (*hs_bindgen_936c3cbcdbf36457 (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz2)(arg1);
+-- }
+-- signed int (*hs_bindgen_6fdade83f34edbda (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz3)(arg1);
+-- }
+-- signed int hs_bindgen_8909620ea33bb4d6 (void)
+-- {
+--   return (no_args_no_void)();
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_quux */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_74169d8db55aee29 (void)) (
+--   float arg1,
+--   char arg2
+-- )
+-- {
+--   return &quux;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_wam */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_5181a3906e0dbcd0 (void)) (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return &wam;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_foo1 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_a36f322a391d1892 (void)) (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo1;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_foo2 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_d4a2d20bdafd587c (void)) (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo2;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_foo3 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_e12635d17ba76dbe (void)) (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo3;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_bar1 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_0d4abdd006893d05 (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar1;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_bar2 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_48eea819ab113ebd (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar2;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_bar3 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_14e5e584697348b2 (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar3;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_bar4 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_84c4ab01f92c9531 (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar4;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_baz1 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_735e74a32eb70545 (void)) (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return &baz1;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_baz2 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_e99b238adefb8ed5 (void)) (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return &baz2;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_baz3 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_b00b767b92358e5e (void)) (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return &baz3;
+-- }
+-- /* test_macrosmacro_in_fundecl_2_raw_Example_get_no_args_no_void */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_d6825192c2bff8ef (void)) (void)
+-- {
+--   return &no_args_no_void;
+-- }
+{-| __C declaration:__ @macro I@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 5:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+i :: Raw String
+{-| __C declaration:__ @macro I@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 5:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+i = objectLike "I" ["int"]
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 6:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+c :: Raw String
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 6:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+c = objectLike "C" ["char"]
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 7:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+f :: Raw String
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 7:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+f = objectLike "F" ["float"]
+{-| __C declaration:__ @macro L@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 8:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+l :: Raw String
+{-| __C declaration:__ @macro L@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 8:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+l = objectLike "L" ["long"]
+{-| __C declaration:__ @macro S@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 9:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+s :: Raw String
+{-| __C declaration:__ @macro S@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 9:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+s = objectLike "S" ["short"]
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_d9bba200e8ee3d2e" hs_bindgen_d9bba200e8ee3d2e_base ::
+    CFloat
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_quux@
+hs_bindgen_d9bba200e8ee3d2e :: CFloat -> CChar -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_quux@
+hs_bindgen_d9bba200e8ee3d2e = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_d9bba200e8ee3d2e_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_safe :: CFloat -> CChar -> IO CChar
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_safe = hs_bindgen_d9bba200e8ee3d2e
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_wam@
+foreign import ccall safe "hs_bindgen_8e4fd99c7d7552e4" hs_bindgen_8e4fd99c7d7552e4_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_wam@
+hs_bindgen_8e4fd99c7d7552e4 :: CFloat ->
+                               Ptr CChar -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_wam@
+hs_bindgen_8e4fd99c7d7552e4 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_8e4fd99c7d7552e4_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_safe :: CFloat -> Ptr CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_safe = hs_bindgen_8e4fd99c7d7552e4
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo1@
+foreign import ccall safe "hs_bindgen_0d427252ce24447b" hs_bindgen_0d427252ce24447b_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo1@
+hs_bindgen_0d427252ce24447b :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo1@
+hs_bindgen_0d427252ce24447b = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_0d427252ce24447b_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_safe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_safe = hs_bindgen_0d427252ce24447b
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo2@
+foreign import ccall safe "hs_bindgen_6e91d4c8387d9391" hs_bindgen_6e91d4c8387d9391_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo2@
+hs_bindgen_6e91d4c8387d9391 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo2@
+hs_bindgen_6e91d4c8387d9391 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_6e91d4c8387d9391_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_safe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_safe = hs_bindgen_6e91d4c8387d9391
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo3@
+foreign import ccall safe "hs_bindgen_d36a763eccc05a06" hs_bindgen_d36a763eccc05a06_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo3@
+hs_bindgen_d36a763eccc05a06 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_foo3@
+hs_bindgen_d36a763eccc05a06 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_d36a763eccc05a06_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_safe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_safe = hs_bindgen_d36a763eccc05a06
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar1@
+foreign import ccall safe "hs_bindgen_f38b40583a94f166" hs_bindgen_f38b40583a94f166_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar1@
+hs_bindgen_f38b40583a94f166 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar1@
+hs_bindgen_f38b40583a94f166 = \x_0 -> fmap fromFFIType (hs_bindgen_f38b40583a94f166_base (toFFIType x_0))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_safe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_safe = hs_bindgen_f38b40583a94f166
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar2@
+foreign import ccall safe "hs_bindgen_2eee4ad4c74521f2" hs_bindgen_2eee4ad4c74521f2_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar2@
+hs_bindgen_2eee4ad4c74521f2 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar2@
+hs_bindgen_2eee4ad4c74521f2 = \x_0 -> fmap fromFFIType (hs_bindgen_2eee4ad4c74521f2_base (toFFIType x_0))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_safe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_safe = hs_bindgen_2eee4ad4c74521f2
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar3@
+foreign import ccall safe "hs_bindgen_e390113427697fef" hs_bindgen_e390113427697fef_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar3@
+hs_bindgen_e390113427697fef :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar3@
+hs_bindgen_e390113427697fef = \x_0 -> fmap fromFFIType (hs_bindgen_e390113427697fef_base (toFFIType x_0))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_safe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_safe = hs_bindgen_e390113427697fef
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar4@
+foreign import ccall safe "hs_bindgen_30d0a25d063e8e6d" hs_bindgen_30d0a25d063e8e6d_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar4@
+hs_bindgen_30d0a25d063e8e6d :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_bar4@
+hs_bindgen_30d0a25d063e8e6d = \x_0 -> fmap fromFFIType (hs_bindgen_30d0a25d063e8e6d_base (toFFIType x_0))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_safe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_safe = hs_bindgen_30d0a25d063e8e6d
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz1@
+foreign import ccall safe "hs_bindgen_4f754558fc5ce39a" hs_bindgen_4f754558fc5ce39a_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz1@
+hs_bindgen_4f754558fc5ce39a :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz1@
+hs_bindgen_4f754558fc5ce39a = \x_0 -> fmap fromFFIType (hs_bindgen_4f754558fc5ce39a_base (toFFIType x_0))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_safe :: CInt ->
+             IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_safe = hs_bindgen_4f754558fc5ce39a
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz2@
+foreign import ccall safe "hs_bindgen_cd12ed5725181713" hs_bindgen_cd12ed5725181713_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz2@
+hs_bindgen_cd12ed5725181713 :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz2@
+hs_bindgen_cd12ed5725181713 = \x_0 -> fmap fromFFIType (hs_bindgen_cd12ed5725181713_base (toFFIType x_0))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_safe :: CInt ->
+             IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_safe = hs_bindgen_cd12ed5725181713
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz3@
+foreign import ccall safe "hs_bindgen_442db04f13fdac86" hs_bindgen_442db04f13fdac86_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz3@
+hs_bindgen_442db04f13fdac86 :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_baz3@
+hs_bindgen_442db04f13fdac86 = \x_0 -> fmap fromFFIType (hs_bindgen_442db04f13fdac86_base (toFFIType x_0))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_safe :: CInt ->
+             IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_safe = hs_bindgen_442db04f13fdac86
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_no_args_no_void@
+foreign import ccall safe "hs_bindgen_e84f5f25b8a3d57c" hs_bindgen_e84f5f25b8a3d57c_base ::
+    IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_no_args_no_void@
+hs_bindgen_e84f5f25b8a3d57c :: IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Safe_no_args_no_void@
+hs_bindgen_e84f5f25b8a3d57c = fmap fromFFIType hs_bindgen_e84f5f25b8a3d57c_base
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_safe :: IO CInt
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_safe = hs_bindgen_e84f5f25b8a3d57c
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_6b552cf38fe835d9" hs_bindgen_6b552cf38fe835d9_base ::
+    CFloat
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_quux@
+hs_bindgen_6b552cf38fe835d9 :: CFloat -> CChar -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_quux@
+hs_bindgen_6b552cf38fe835d9 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_6b552cf38fe835d9_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_unsafe :: CFloat -> CChar -> IO CChar
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_unsafe = hs_bindgen_6b552cf38fe835d9
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_wam@
+foreign import ccall unsafe "hs_bindgen_c21f84e027d8887c" hs_bindgen_c21f84e027d8887c_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_wam@
+hs_bindgen_c21f84e027d8887c :: CFloat ->
+                               Ptr CChar -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_wam@
+hs_bindgen_c21f84e027d8887c = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_c21f84e027d8887c_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_unsafe :: CFloat -> Ptr CChar -> IO (Ptr CChar)
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_unsafe = hs_bindgen_c21f84e027d8887c
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo1@
+foreign import ccall unsafe "hs_bindgen_2401297c490b2b53" hs_bindgen_2401297c490b2b53_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo1@
+hs_bindgen_2401297c490b2b53 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo1@
+hs_bindgen_2401297c490b2b53 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_2401297c490b2b53_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_unsafe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_unsafe = hs_bindgen_2401297c490b2b53
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo2@
+foreign import ccall unsafe "hs_bindgen_245d9b4b607a0239" hs_bindgen_245d9b4b607a0239_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo2@
+hs_bindgen_245d9b4b607a0239 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo2@
+hs_bindgen_245d9b4b607a0239 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_245d9b4b607a0239_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_unsafe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_unsafe = hs_bindgen_245d9b4b607a0239
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo3@
+foreign import ccall unsafe "hs_bindgen_f731296a8b75c18c" hs_bindgen_f731296a8b75c18c_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo3@
+hs_bindgen_f731296a8b75c18c :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_foo3@
+hs_bindgen_f731296a8b75c18c = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_f731296a8b75c18c_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_unsafe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_unsafe = hs_bindgen_f731296a8b75c18c
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar1@
+foreign import ccall unsafe "hs_bindgen_9e8e0078d6f5f10d" hs_bindgen_9e8e0078d6f5f10d_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar1@
+hs_bindgen_9e8e0078d6f5f10d :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar1@
+hs_bindgen_9e8e0078d6f5f10d = \x_0 -> fmap fromFFIType (hs_bindgen_9e8e0078d6f5f10d_base (toFFIType x_0))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_unsafe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_unsafe = hs_bindgen_9e8e0078d6f5f10d
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar2@
+foreign import ccall unsafe "hs_bindgen_c3dc7bc6e13e4444" hs_bindgen_c3dc7bc6e13e4444_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar2@
+hs_bindgen_c3dc7bc6e13e4444 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar2@
+hs_bindgen_c3dc7bc6e13e4444 = \x_0 -> fmap fromFFIType (hs_bindgen_c3dc7bc6e13e4444_base (toFFIType x_0))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_unsafe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_unsafe = hs_bindgen_c3dc7bc6e13e4444
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar3@
+foreign import ccall unsafe "hs_bindgen_b10397be2af8a563" hs_bindgen_b10397be2af8a563_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar3@
+hs_bindgen_b10397be2af8a563 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar3@
+hs_bindgen_b10397be2af8a563 = \x_0 -> fmap fromFFIType (hs_bindgen_b10397be2af8a563_base (toFFIType x_0))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_unsafe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_unsafe = hs_bindgen_b10397be2af8a563
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar4@
+foreign import ccall unsafe "hs_bindgen_3670d1c6cdde814b" hs_bindgen_3670d1c6cdde814b_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar4@
+hs_bindgen_3670d1c6cdde814b :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_bar4@
+hs_bindgen_3670d1c6cdde814b = \x_0 -> fmap fromFFIType (hs_bindgen_3670d1c6cdde814b_base (toFFIType x_0))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_unsafe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_unsafe = hs_bindgen_3670d1c6cdde814b
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz1@
+foreign import ccall unsafe "hs_bindgen_9d5573689ffc268e" hs_bindgen_9d5573689ffc268e_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz1@
+hs_bindgen_9d5573689ffc268e :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz1@
+hs_bindgen_9d5573689ffc268e = \x_0 -> fmap fromFFIType (hs_bindgen_9d5573689ffc268e_base (toFFIType x_0))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_unsafe :: CInt ->
+               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_unsafe = hs_bindgen_9d5573689ffc268e
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz2@
+foreign import ccall unsafe "hs_bindgen_936c3cbcdbf36457" hs_bindgen_936c3cbcdbf36457_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz2@
+hs_bindgen_936c3cbcdbf36457 :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz2@
+hs_bindgen_936c3cbcdbf36457 = \x_0 -> fmap fromFFIType (hs_bindgen_936c3cbcdbf36457_base (toFFIType x_0))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_unsafe :: CInt ->
+               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_unsafe = hs_bindgen_936c3cbcdbf36457
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz3@
+foreign import ccall unsafe "hs_bindgen_6fdade83f34edbda" hs_bindgen_6fdade83f34edbda_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz3@
+hs_bindgen_6fdade83f34edbda :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_baz3@
+hs_bindgen_6fdade83f34edbda = \x_0 -> fmap fromFFIType (hs_bindgen_6fdade83f34edbda_base (toFFIType x_0))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_unsafe :: CInt ->
+               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_unsafe = hs_bindgen_6fdade83f34edbda
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_8909620ea33bb4d6" hs_bindgen_8909620ea33bb4d6_base ::
+    IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_no_args_no_void@
+hs_bindgen_8909620ea33bb4d6 :: IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_Unsafe_no_args_no_void@
+hs_bindgen_8909620ea33bb4d6 = fmap fromFFIType hs_bindgen_8909620ea33bb4d6_base
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_unsafe :: IO CInt
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_unsafe = hs_bindgen_8909620ea33bb4d6
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_74169d8db55aee29" hs_bindgen_74169d8db55aee29_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_quux@
+hs_bindgen_74169d8db55aee29 :: IO (FunPtr (CFloat ->
+                                           CChar -> IO CChar))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_quux@
+hs_bindgen_74169d8db55aee29 = fmap fromFFIType hs_bindgen_74169d8db55aee29_base
+{-# NOINLINE quux_funptr #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_funptr :: FunPtr (CFloat -> CChar -> IO CChar)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_funptr = unsafePerformIO hs_bindgen_74169d8db55aee29
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_wam@
+foreign import ccall unsafe "hs_bindgen_5181a3906e0dbcd0" hs_bindgen_5181a3906e0dbcd0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_wam@
+hs_bindgen_5181a3906e0dbcd0 :: IO (FunPtr (CFloat ->
+                                           Ptr CChar -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_wam@
+hs_bindgen_5181a3906e0dbcd0 = fmap fromFFIType hs_bindgen_5181a3906e0dbcd0_base
+{-# NOINLINE wam_funptr #-}
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_funptr :: FunPtr (CFloat -> Ptr CChar -> IO (Ptr CChar))
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_funptr = unsafePerformIO hs_bindgen_5181a3906e0dbcd0
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo1@
+foreign import ccall unsafe "hs_bindgen_a36f322a391d1892" hs_bindgen_a36f322a391d1892_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo1@
+hs_bindgen_a36f322a391d1892 :: IO (FunPtr (CFloat ->
+                                           FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo1@
+hs_bindgen_a36f322a391d1892 = fmap fromFFIType hs_bindgen_a36f322a391d1892_base
+{-# NOINLINE foo1_funptr #-}
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_funptr :: FunPtr (CFloat ->
+                       FunPtr (CInt -> IO CInt) -> IO (Ptr CChar))
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_funptr = unsafePerformIO hs_bindgen_a36f322a391d1892
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo2@
+foreign import ccall unsafe "hs_bindgen_d4a2d20bdafd587c" hs_bindgen_d4a2d20bdafd587c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo2@
+hs_bindgen_d4a2d20bdafd587c :: IO (FunPtr (CFloat ->
+                                           FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo2@
+hs_bindgen_d4a2d20bdafd587c = fmap fromFFIType hs_bindgen_d4a2d20bdafd587c_base
+{-# NOINLINE foo2_funptr #-}
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_funptr :: FunPtr (CFloat ->
+                       FunPtr (CInt -> IO CInt) -> IO (Ptr CChar))
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_funptr = unsafePerformIO hs_bindgen_d4a2d20bdafd587c
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo3@
+foreign import ccall unsafe "hs_bindgen_e12635d17ba76dbe" hs_bindgen_e12635d17ba76dbe_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo3@
+hs_bindgen_e12635d17ba76dbe :: IO (FunPtr (CFloat ->
+                                           FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_foo3@
+hs_bindgen_e12635d17ba76dbe = fmap fromFFIType hs_bindgen_e12635d17ba76dbe_base
+{-# NOINLINE foo3_funptr #-}
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_funptr :: FunPtr (CFloat ->
+                       FunPtr (CInt -> IO CInt) -> IO (Ptr CChar))
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_funptr = unsafePerformIO hs_bindgen_e12635d17ba76dbe
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar1@
+foreign import ccall unsafe "hs_bindgen_0d4abdd006893d05" hs_bindgen_0d4abdd006893d05_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar1@
+hs_bindgen_0d4abdd006893d05 :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar1@
+hs_bindgen_0d4abdd006893d05 = fmap fromFFIType hs_bindgen_0d4abdd006893d05_base
+{-# NOINLINE bar1_funptr #-}
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_funptr = unsafePerformIO hs_bindgen_0d4abdd006893d05
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar2@
+foreign import ccall unsafe "hs_bindgen_48eea819ab113ebd" hs_bindgen_48eea819ab113ebd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar2@
+hs_bindgen_48eea819ab113ebd :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar2@
+hs_bindgen_48eea819ab113ebd = fmap fromFFIType hs_bindgen_48eea819ab113ebd_base
+{-# NOINLINE bar2_funptr #-}
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_funptr = unsafePerformIO hs_bindgen_48eea819ab113ebd
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar3@
+foreign import ccall unsafe "hs_bindgen_14e5e584697348b2" hs_bindgen_14e5e584697348b2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar3@
+hs_bindgen_14e5e584697348b2 :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar3@
+hs_bindgen_14e5e584697348b2 = fmap fromFFIType hs_bindgen_14e5e584697348b2_base
+{-# NOINLINE bar3_funptr #-}
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_funptr = unsafePerformIO hs_bindgen_14e5e584697348b2
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar4@
+foreign import ccall unsafe "hs_bindgen_84c4ab01f92c9531" hs_bindgen_84c4ab01f92c9531_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar4@
+hs_bindgen_84c4ab01f92c9531 :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_bar4@
+hs_bindgen_84c4ab01f92c9531 = fmap fromFFIType hs_bindgen_84c4ab01f92c9531_base
+{-# NOINLINE bar4_funptr #-}
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_funptr = unsafePerformIO hs_bindgen_84c4ab01f92c9531
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz1@
+foreign import ccall unsafe "hs_bindgen_735e74a32eb70545" hs_bindgen_735e74a32eb70545_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz1@
+hs_bindgen_735e74a32eb70545 :: IO (FunPtr (CInt ->
+                                           IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz1@
+hs_bindgen_735e74a32eb70545 = fmap fromFFIType hs_bindgen_735e74a32eb70545_base
+{-# NOINLINE baz1_funptr #-}
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_funptr :: FunPtr (CInt ->
+                       IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt))))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_funptr = unsafePerformIO hs_bindgen_735e74a32eb70545
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz2@
+foreign import ccall unsafe "hs_bindgen_e99b238adefb8ed5" hs_bindgen_e99b238adefb8ed5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz2@
+hs_bindgen_e99b238adefb8ed5 :: IO (FunPtr (CInt ->
+                                           IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz2@
+hs_bindgen_e99b238adefb8ed5 = fmap fromFFIType hs_bindgen_e99b238adefb8ed5_base
+{-# NOINLINE baz2_funptr #-}
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_funptr :: FunPtr (CInt ->
+                       IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt))))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_funptr = unsafePerformIO hs_bindgen_e99b238adefb8ed5
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz3@
+foreign import ccall unsafe "hs_bindgen_b00b767b92358e5e" hs_bindgen_b00b767b92358e5e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz3@
+hs_bindgen_b00b767b92358e5e :: IO (FunPtr (CInt ->
+                                           IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_baz3@
+hs_bindgen_b00b767b92358e5e = fmap fromFFIType hs_bindgen_b00b767b92358e5e_base
+{-# NOINLINE baz3_funptr #-}
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_funptr :: FunPtr (CInt ->
+                       IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt))))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_funptr = unsafePerformIO hs_bindgen_b00b767b92358e5e
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_d6825192c2bff8ef" hs_bindgen_d6825192c2bff8ef_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_no_args_no_void@
+hs_bindgen_d6825192c2bff8ef :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_2_raw_Example_get_no_args_no_void@
+hs_bindgen_d6825192c2bff8ef = fmap fromFFIType hs_bindgen_d6825192c2bff8ef_base
+{-# NOINLINE no_args_no_void_funptr #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_funptr = unsafePerformIO hs_bindgen_d6825192c2bff8ef
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl/Example.hs b/test-artefacts/fixtures/macros/macro_in_fundecl/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl/Example.hs
@@ -0,0 +1,320 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.I(..)
+    , Example.C(..)
+    , Example.F(..)
+    , Example.L(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Floating, Fractional, IO, Integral, Num, Ord, Read, Real, RealFloat, RealFrac, Show, fmap, type (~))
+
+{-| __C declaration:__ @macro I@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 5:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype I = I
+  { unwrapI :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapI" I ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> I {unwrapI = y1}, BG.getField @"unwrapI" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapI" (BG.Ptr I) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapI")
+
+instance HasCField.HasCField I "unwrapI" where
+
+  type CFieldType I "unwrapI" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 6:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype C = C
+  { unwrapC :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "unwrapC" C ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> C {unwrapC = y1}, BG.getField @"unwrapC" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "unwrapC" (BG.Ptr C) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapC")
+
+instance HasCField.HasCField C "unwrapC" where
+
+  type CFieldType C "unwrapC" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 7:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype F = F
+  { unwrapF :: BG.CFloat
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "unwrapF" F ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> F {unwrapF = y1}, BG.getField @"unwrapF" x0)
+
+instance (ty ~ BG.CFloat) => BG.HasField "unwrapF" (BG.Ptr F) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapF")
+
+instance HasCField.HasCField F "unwrapF" where
+
+  type CFieldType F "unwrapF" = BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro L@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 8:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype L = L
+  { unwrapL :: BG.CLong
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CLong) => BG.CompatHasField.HasField "unwrapL" L ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> L {unwrapL = y1}, BG.getField @"unwrapL" x0)
+
+instance (ty ~ BG.CLong) => BG.HasField "unwrapL" (BG.Ptr L) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapL")
+
+instance HasCField.HasCField L "unwrapL" where
+
+  type CFieldType L "unwrapL" = BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro S@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 9:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype S = S
+  { unwrapS :: BG.CShort
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CShort) => BG.CompatHasField.HasField "unwrapS" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S {unwrapS = y1}, BG.getField @"unwrapS" x0)
+
+instance (ty ~ BG.CShort) => BG.HasField "unwrapS" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapS")
+
+instance HasCField.HasCField S "unwrapS" where
+
+  type CFieldType S "unwrapS" = BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+-- __unique:__ @instance ToFunPtr (BG.CShort -> IO I)@
+foreign import ccall safe "wrapper" hs_bindgen_03e9923d8d301cca_base ::
+     (BG.CShort -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+
+-- __unique:__ @instance ToFunPtr (BG.CShort -> IO I)@
+hs_bindgen_03e9923d8d301cca ::
+     (BG.CShort -> IO I)
+  -> IO (BG.FunPtr (BG.CShort -> IO I))
+hs_bindgen_03e9923d8d301cca =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_03e9923d8d301cca_base (\x1 ->
+                                                            fmap BG.toFFIType (fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @instance FromFunPtr (BG.CShort -> IO I)@
+foreign import ccall safe "dynamic" hs_bindgen_ee10a61bcb1a5d39_base ::
+     BG.FunPtr (BG.CShort -> IO BG.CInt)
+  -> BG.CShort -> IO BG.CInt
+
+-- __unique:__ @instance FromFunPtr (BG.CShort -> IO I)@
+hs_bindgen_ee10a61bcb1a5d39 ::
+     BG.FunPtr (BG.CShort -> IO I)
+  -> BG.CShort -> IO I
+hs_bindgen_ee10a61bcb1a5d39 =
+  \funPtr0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ee10a61bcb1a5d39_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr (BG.CShort -> IO I) where
+
+  toFunPtr = hs_bindgen_03e9923d8d301cca
+
+instance BG.FromFunPtr (BG.CShort -> IO I) where
+
+  fromFunPtr = hs_bindgen_ee10a61bcb1a5d39
+
+-- __unique:__ @instance ToFunPtr (S -> IO BG.CInt)@
+foreign import ccall safe "wrapper" hs_bindgen_140ec1313a27c405_base ::
+     (BG.CShort -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+
+-- __unique:__ @instance ToFunPtr (S -> IO BG.CInt)@
+hs_bindgen_140ec1313a27c405 ::
+     (S -> IO BG.CInt)
+  -> IO (BG.FunPtr (S -> IO BG.CInt))
+hs_bindgen_140ec1313a27c405 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_140ec1313a27c405_base (\x1 ->
+                                                            fmap BG.toFFIType (fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @instance FromFunPtr (S -> IO BG.CInt)@
+foreign import ccall safe "dynamic" hs_bindgen_e86a5fa3f995e6fb_base ::
+     BG.FunPtr (BG.CShort -> IO BG.CInt)
+  -> BG.CShort -> IO BG.CInt
+
+-- __unique:__ @instance FromFunPtr (S -> IO BG.CInt)@
+hs_bindgen_e86a5fa3f995e6fb ::
+     BG.FunPtr (S -> IO BG.CInt)
+  -> S -> IO BG.CInt
+hs_bindgen_e86a5fa3f995e6fb =
+  \funPtr0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_e86a5fa3f995e6fb_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr (S -> IO BG.CInt) where
+
+  toFunPtr = hs_bindgen_140ec1313a27c405
+
+instance BG.FromFunPtr (S -> IO BG.CInt) where
+
+  fromFunPtr = hs_bindgen_e86a5fa3f995e6fb
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl/Example/FunPtr.hs b/test-artefacts/fixtures/macros/macro_in_fundecl/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl/Example/FunPtr.hs
@@ -0,0 +1,401 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.quux
+    , Example.FunPtr.wam
+    , Example.FunPtr.foo1
+    , Example.FunPtr.foo2
+    , Example.FunPtr.foo3
+    , Example.FunPtr.bar1
+    , Example.FunPtr.bar2
+    , Example.FunPtr.bar3
+    , Example.FunPtr.bar4
+    , Example.FunPtr.baz1
+    , Example.FunPtr.baz2
+    , Example.FunPtr.baz3
+    , Example.FunPtr.no_args_no_void
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl.h>"
+  , "/* test_macrosmacro_in_fundecl_Example_get_quux */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_930b4f8122942dae (void)) ("
+  , "  F arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &quux;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_wam */"
+  , "__attribute__ ((const))"
+  , "C *(*hs_bindgen_31f433dd4aceda85 (void)) ("
+  , "  float arg1,"
+  , "  C *arg2"
+  , ")"
+  , "{"
+  , "  return &wam;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_foo1 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_8d7a85b3867041bf (void)) ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_foo2 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_c9dcd020e5be4af9 (void)) ("
+  , "  F arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_foo3 */"
+  , "__attribute__ ((const))"
+  , "C *(*hs_bindgen_c2295c3f61edf4e7 (void)) ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &foo3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_bar1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_d9b2e6e188ecbfea (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_bar2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_111db9707ae2a631 (void)) ("
+  , "  L arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_bar3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_00996e2c7c9e793b (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  S arg1"
+  , ")"
+  , "{"
+  , "  return &bar3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_bar4 */"
+  , "__attribute__ ((const))"
+  , "I (*(*hs_bindgen_aa46ba685e4693da (void)) ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &bar4;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_baz1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_86b147342f608069 (void)) ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return &baz1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_baz2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_a7194966e4f375df (void)) ("
+  , "  I const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return &baz2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_baz3 */"
+  , "__attribute__ ((const))"
+  , "I (*(*hs_bindgen_cd69bb91c3e6d7ea (void)) ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return &baz3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_Example_get_no_args_no_void */"
+  , "__attribute__ ((const))"
+  , "I (*hs_bindgen_d5b5e70d96cc6b8d (void)) (void)"
+  , "{"
+  , "  return &no_args_no_void;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_930b4f8122942dae" hs_bindgen_930b4f8122942dae_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_quux@
+hs_bindgen_930b4f8122942dae :: IO (BG.FunPtr (F -> BG.CChar -> IO BG.CChar))
+hs_bindgen_930b4f8122942dae =
+  fmap BG.fromFFIType hs_bindgen_930b4f8122942dae_base
+
+{-# NOINLINE quux #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux :: BG.FunPtr (F -> BG.CChar -> IO BG.CChar)
+quux = BG.unsafePerformIO hs_bindgen_930b4f8122942dae
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_wam@
+foreign import ccall unsafe "hs_bindgen_31f433dd4aceda85" hs_bindgen_31f433dd4aceda85_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_wam@
+hs_bindgen_31f433dd4aceda85 :: IO (BG.FunPtr (BG.CFloat -> BG.Ptr C -> IO (BG.Ptr C)))
+hs_bindgen_31f433dd4aceda85 =
+  fmap BG.fromFFIType hs_bindgen_31f433dd4aceda85_base
+
+{-# NOINLINE wam #-}
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam :: BG.FunPtr (BG.CFloat -> BG.Ptr C -> IO (BG.Ptr C))
+wam = BG.unsafePerformIO hs_bindgen_31f433dd4aceda85
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo1@
+foreign import ccall unsafe "hs_bindgen_8d7a85b3867041bf" hs_bindgen_8d7a85b3867041bf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo1@
+hs_bindgen_8d7a85b3867041bf :: IO (BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_8d7a85b3867041bf =
+  fmap BG.fromFFIType hs_bindgen_8d7a85b3867041bf_base
+
+{-# NOINLINE foo1 #-}
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1 :: BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar))
+foo1 = BG.unsafePerformIO hs_bindgen_8d7a85b3867041bf
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo2@
+foreign import ccall unsafe "hs_bindgen_c9dcd020e5be4af9" hs_bindgen_c9dcd020e5be4af9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo2@
+hs_bindgen_c9dcd020e5be4af9 :: IO (BG.FunPtr (F -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_c9dcd020e5be4af9 =
+  fmap BG.fromFFIType hs_bindgen_c9dcd020e5be4af9_base
+
+{-# NOINLINE foo2 #-}
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2 :: BG.FunPtr (F -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr BG.CChar))
+foo2 = BG.unsafePerformIO hs_bindgen_c9dcd020e5be4af9
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo3@
+foreign import ccall unsafe "hs_bindgen_c2295c3f61edf4e7" hs_bindgen_c2295c3f61edf4e7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo3@
+hs_bindgen_c2295c3f61edf4e7 :: IO (BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr C)))
+hs_bindgen_c2295c3f61edf4e7 =
+  fmap BG.fromFFIType hs_bindgen_c2295c3f61edf4e7_base
+
+{-# NOINLINE foo3 #-}
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3 :: BG.FunPtr (BG.CFloat -> BG.FunPtr (BG.CInt -> IO BG.CInt) -> IO (BG.Ptr C))
+foo3 = BG.unsafePerformIO hs_bindgen_c2295c3f61edf4e7
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar1@
+foreign import ccall unsafe "hs_bindgen_d9b2e6e188ecbfea" hs_bindgen_d9b2e6e188ecbfea_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar1@
+hs_bindgen_d9b2e6e188ecbfea :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_d9b2e6e188ecbfea =
+  fmap BG.fromFFIType hs_bindgen_d9b2e6e188ecbfea_base
+
+{-# NOINLINE bar1 #-}
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar1 = BG.unsafePerformIO hs_bindgen_d9b2e6e188ecbfea
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar2@
+foreign import ccall unsafe "hs_bindgen_111db9707ae2a631" hs_bindgen_111db9707ae2a631_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar2@
+hs_bindgen_111db9707ae2a631 :: IO (BG.FunPtr (L -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))))
+hs_bindgen_111db9707ae2a631 =
+  fmap BG.fromFFIType hs_bindgen_111db9707ae2a631_base
+
+{-# NOINLINE bar2 #-}
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2 :: BG.FunPtr (L -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt)))
+bar2 = BG.unsafePerformIO hs_bindgen_111db9707ae2a631
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar3@
+foreign import ccall unsafe "hs_bindgen_00996e2c7c9e793b" hs_bindgen_00996e2c7c9e793b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar3@
+hs_bindgen_00996e2c7c9e793b :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (S -> IO BG.CInt))))
+hs_bindgen_00996e2c7c9e793b =
+  fmap BG.fromFFIType hs_bindgen_00996e2c7c9e793b_base
+
+{-# NOINLINE bar3 #-}
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (S -> IO BG.CInt)))
+bar3 = BG.unsafePerformIO hs_bindgen_00996e2c7c9e793b
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar4@
+foreign import ccall unsafe "hs_bindgen_aa46ba685e4693da" hs_bindgen_aa46ba685e4693da_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar4@
+hs_bindgen_aa46ba685e4693da :: IO (BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO I))))
+hs_bindgen_aa46ba685e4693da =
+  fmap BG.fromFFIType hs_bindgen_aa46ba685e4693da_base
+
+{-# NOINLINE bar4 #-}
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4 :: BG.FunPtr (BG.CLong -> IO (BG.FunPtr (BG.CShort -> IO I)))
+bar4 = BG.unsafePerformIO hs_bindgen_aa46ba685e4693da
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz1@
+foreign import ccall unsafe "hs_bindgen_86b147342f608069" hs_bindgen_86b147342f608069_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz1@
+hs_bindgen_86b147342f608069 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_86b147342f608069 =
+  fmap BG.fromFFIType hs_bindgen_86b147342f608069_base
+
+{-# NOINLINE baz1 #-}
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt))))
+baz1 = BG.unsafePerformIO hs_bindgen_86b147342f608069
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz2@
+foreign import ccall unsafe "hs_bindgen_a7194966e4f375df" hs_bindgen_a7194966e4f375df_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz2@
+hs_bindgen_a7194966e4f375df :: IO (BG.FunPtr (I -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))))
+hs_bindgen_a7194966e4f375df =
+  fmap BG.fromFFIType hs_bindgen_a7194966e4f375df_base
+
+{-# NOINLINE baz2 #-}
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2 :: BG.FunPtr (I -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt))))
+baz2 = BG.unsafePerformIO hs_bindgen_a7194966e4f375df
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz3@
+foreign import ccall unsafe "hs_bindgen_cd69bb91c3e6d7ea" hs_bindgen_cd69bb91c3e6d7ea_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz3@
+hs_bindgen_cd69bb91c3e6d7ea :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 I)))))
+hs_bindgen_cd69bb91c3e6d7ea =
+  fmap BG.fromFFIType hs_bindgen_cd69bb91c3e6d7ea_base
+
+{-# NOINLINE baz3 #-}
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 I))))
+baz3 = BG.unsafePerformIO hs_bindgen_cd69bb91c3e6d7ea
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_d5b5e70d96cc6b8d" hs_bindgen_d5b5e70d96cc6b8d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_no_args_no_void@
+hs_bindgen_d5b5e70d96cc6b8d :: IO (BG.FunPtr (IO I))
+hs_bindgen_d5b5e70d96cc6b8d =
+  fmap BG.fromFFIType hs_bindgen_d5b5e70d96cc6b8d_base
+
+{-# NOINLINE no_args_no_void #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void :: BG.FunPtr (IO I)
+no_args_no_void =
+  BG.unsafePerformIO hs_bindgen_d5b5e70d96cc6b8d
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl/Example/Safe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl/Example/Safe.hs
@@ -0,0 +1,470 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.quux
+    , Example.Safe.wam
+    , Example.Safe.foo1
+    , Example.Safe.foo2
+    , Example.Safe.foo3
+    , Example.Safe.bar1
+    , Example.Safe.bar2
+    , Example.Safe.bar3
+    , Example.Safe.bar4
+    , Example.Safe.baz1
+    , Example.Safe.baz2
+    , Example.Safe.baz3
+    , Example.Safe.no_args_no_void
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl.h>"
+  , "char hs_bindgen_d345c332b6547629 ("
+  , "  F arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux)(arg1, arg2);"
+  , "}"
+  , "C *hs_bindgen_195036c94aad554b ("
+  , "  float arg1,"
+  , "  C *arg2"
+  , ")"
+  , "{"
+  , "  return (wam)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_a40b504a8f7c1d11 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo1)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_83392129a2035c99 ("
+  , "  F arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo2)(arg1, arg2);"
+  , "}"
+  , "C *hs_bindgen_0c7f4bce7905d355 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo3)(arg1, arg2);"
+  , "}"
+  , "signed int (*hs_bindgen_3471ca0525deb2c0 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_d5a4af88f772ff72 ("
+  , "  L arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_b289d62136acab77 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  S arg1"
+  , ")"
+  , "{"
+  , "  return (bar3)(arg1);"
+  , "}"
+  , "I (*hs_bindgen_2b5b36cf49f0e40e ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar4)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_b56f5f3515f3cc33 ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_0b9b2e4d1699b6f3 ("
+  , "  I const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz2)(arg1);"
+  , "}"
+  , "I (*hs_bindgen_459eabcbd019687c ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz3)(arg1);"
+  , "}"
+  , "I hs_bindgen_7ae4ab0ad4fb8cad (void)"
+  , "{"
+  , "  return (no_args_no_void)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_d345c332b6547629" hs_bindgen_d345c332b6547629_base ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_quux@
+hs_bindgen_d345c332b6547629 ::
+     F
+  -> BG.CChar
+  -> IO BG.CChar
+hs_bindgen_d345c332b6547629 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_d345c332b6547629_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux ::
+     F
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux = hs_bindgen_d345c332b6547629
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_wam@
+foreign import ccall safe "hs_bindgen_195036c94aad554b" hs_bindgen_195036c94aad554b_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_wam@
+hs_bindgen_195036c94aad554b ::
+     BG.CFloat
+  -> BG.Ptr C
+  -> IO (BG.Ptr C)
+hs_bindgen_195036c94aad554b =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_195036c94aad554b_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr C
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr C)
+wam = hs_bindgen_195036c94aad554b
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo1@
+foreign import ccall safe "hs_bindgen_a40b504a8f7c1d11" hs_bindgen_a40b504a8f7c1d11_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo1@
+hs_bindgen_a40b504a8f7c1d11 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_a40b504a8f7c1d11 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a40b504a8f7c1d11_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo1 = hs_bindgen_a40b504a8f7c1d11
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo2@
+foreign import ccall safe "hs_bindgen_83392129a2035c99" hs_bindgen_83392129a2035c99_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo2@
+hs_bindgen_83392129a2035c99 ::
+     F
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_83392129a2035c99 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_83392129a2035c99_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2 ::
+     F
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo2 = hs_bindgen_83392129a2035c99
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo3@
+foreign import ccall safe "hs_bindgen_0c7f4bce7905d355" hs_bindgen_0c7f4bce7905d355_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo3@
+hs_bindgen_0c7f4bce7905d355 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr C)
+hs_bindgen_0c7f4bce7905d355 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_0c7f4bce7905d355_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr C)
+foo3 = hs_bindgen_0c7f4bce7905d355
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar1@
+foreign import ccall safe "hs_bindgen_3471ca0525deb2c0" hs_bindgen_3471ca0525deb2c0_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar1@
+hs_bindgen_3471ca0525deb2c0 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_3471ca0525deb2c0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3471ca0525deb2c0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar1 = hs_bindgen_3471ca0525deb2c0
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar2@
+foreign import ccall safe "hs_bindgen_d5a4af88f772ff72" hs_bindgen_d5a4af88f772ff72_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar2@
+hs_bindgen_d5a4af88f772ff72 ::
+     L
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_d5a4af88f772ff72 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d5a4af88f772ff72_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2 ::
+     L
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar2 = hs_bindgen_d5a4af88f772ff72
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar3@
+foreign import ccall safe "hs_bindgen_b289d62136acab77" hs_bindgen_b289d62136acab77_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar3@
+hs_bindgen_b289d62136acab77 ::
+     BG.CLong
+  -> IO (BG.FunPtr (S -> IO BG.CInt))
+hs_bindgen_b289d62136acab77 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b289d62136acab77_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (S -> IO BG.CInt))
+bar3 = hs_bindgen_b289d62136acab77
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar4@
+foreign import ccall safe "hs_bindgen_2b5b36cf49f0e40e" hs_bindgen_2b5b36cf49f0e40e_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar4@
+hs_bindgen_2b5b36cf49f0e40e ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO I))
+hs_bindgen_2b5b36cf49f0e40e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2b5b36cf49f0e40e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO I))
+bar4 = hs_bindgen_2b5b36cf49f0e40e
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz1@
+foreign import ccall safe "hs_bindgen_b56f5f3515f3cc33" hs_bindgen_b56f5f3515f3cc33_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz1@
+hs_bindgen_b56f5f3515f3cc33 ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_b56f5f3515f3cc33 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b56f5f3515f3cc33_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz1 = hs_bindgen_b56f5f3515f3cc33
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz2@
+foreign import ccall safe "hs_bindgen_0b9b2e4d1699b6f3" hs_bindgen_0b9b2e4d1699b6f3_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz2@
+hs_bindgen_0b9b2e4d1699b6f3 ::
+     I
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_0b9b2e4d1699b6f3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0b9b2e4d1699b6f3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2 ::
+     I
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz2 = hs_bindgen_0b9b2e4d1699b6f3
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz3@
+foreign import ccall safe "hs_bindgen_459eabcbd019687c" hs_bindgen_459eabcbd019687c_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz3@
+hs_bindgen_459eabcbd019687c ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 I)))
+hs_bindgen_459eabcbd019687c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_459eabcbd019687c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 I)))
+baz3 = hs_bindgen_459eabcbd019687c
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_no_args_no_void@
+foreign import ccall safe "hs_bindgen_7ae4ab0ad4fb8cad" hs_bindgen_7ae4ab0ad4fb8cad_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_no_args_no_void@
+hs_bindgen_7ae4ab0ad4fb8cad :: IO I
+hs_bindgen_7ae4ab0ad4fb8cad =
+  fmap BG.fromFFIType hs_bindgen_7ae4ab0ad4fb8cad_base
+
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void :: IO I
+no_args_no_void = hs_bindgen_7ae4ab0ad4fb8cad
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl/Example/Unsafe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl/Example/Unsafe.hs
@@ -0,0 +1,470 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.quux
+    , Example.Unsafe.wam
+    , Example.Unsafe.foo1
+    , Example.Unsafe.foo2
+    , Example.Unsafe.foo3
+    , Example.Unsafe.bar1
+    , Example.Unsafe.bar2
+    , Example.Unsafe.bar3
+    , Example.Unsafe.bar4
+    , Example.Unsafe.baz1
+    , Example.Unsafe.baz2
+    , Example.Unsafe.baz3
+    , Example.Unsafe.no_args_no_void
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl.h>"
+  , "char hs_bindgen_ab9081efcd629826 ("
+  , "  F arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux)(arg1, arg2);"
+  , "}"
+  , "C *hs_bindgen_7db4d5f10d9904d8 ("
+  , "  float arg1,"
+  , "  C *arg2"
+  , ")"
+  , "{"
+  , "  return (wam)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_18401e906d384fd5 ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo1)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_1e16ebe63a290ff6 ("
+  , "  F arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo2)(arg1, arg2);"
+  , "}"
+  , "C *hs_bindgen_091043692da958ac ("
+  , "  float arg1,"
+  , "  signed int (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return (foo3)(arg1, arg2);"
+  , "}"
+  , "signed int (*hs_bindgen_cf4fa39c5b4ef431 ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_9092ebfb46f7f31b ("
+  , "  L arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar2)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_a5e6607b472003eb ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  S arg1"
+  , ")"
+  , "{"
+  , "  return (bar3)(arg1);"
+  , "}"
+  , "I (*hs_bindgen_050bd8903c7b13dd ("
+  , "  signed long arg1"
+  , ")) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (bar4)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_f378b374e8c8c095 ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_27cf571d08ac8c04 ("
+  , "  I const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz2)(arg1);"
+  , "}"
+  , "I (*hs_bindgen_c4035ef23b908e27 ("
+  , "  signed int const arg1"
+  , "))[2][3]"
+  , "{"
+  , "  return (baz3)(arg1);"
+  , "}"
+  , "I hs_bindgen_77a9149f03b2767f (void)"
+  , "{"
+  , "  return (no_args_no_void)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_ab9081efcd629826" hs_bindgen_ab9081efcd629826_base ::
+     BG.CFloat
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_quux@
+hs_bindgen_ab9081efcd629826 ::
+     F
+  -> BG.CChar
+  -> IO BG.CChar
+hs_bindgen_ab9081efcd629826 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ab9081efcd629826_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux ::
+     F
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux = hs_bindgen_ab9081efcd629826
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_wam@
+foreign import ccall unsafe "hs_bindgen_7db4d5f10d9904d8" hs_bindgen_7db4d5f10d9904d8_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_wam@
+hs_bindgen_7db4d5f10d9904d8 ::
+     BG.CFloat
+  -> BG.Ptr C
+  -> IO (BG.Ptr C)
+hs_bindgen_7db4d5f10d9904d8 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_7db4d5f10d9904d8_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr C
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr C)
+wam = hs_bindgen_7db4d5f10d9904d8
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo1@
+foreign import ccall unsafe "hs_bindgen_18401e906d384fd5" hs_bindgen_18401e906d384fd5_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo1@
+hs_bindgen_18401e906d384fd5 ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_18401e906d384fd5 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_18401e906d384fd5_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo1 = hs_bindgen_18401e906d384fd5
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo2@
+foreign import ccall unsafe "hs_bindgen_1e16ebe63a290ff6" hs_bindgen_1e16ebe63a290ff6_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo2@
+hs_bindgen_1e16ebe63a290ff6 ::
+     F
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_1e16ebe63a290ff6 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_1e16ebe63a290ff6_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2 ::
+     F
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr BG.CChar)
+foo2 = hs_bindgen_1e16ebe63a290ff6
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo3@
+foreign import ccall unsafe "hs_bindgen_091043692da958ac" hs_bindgen_091043692da958ac_base ::
+     BG.CFloat
+  -> BG.FunPtr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo3@
+hs_bindgen_091043692da958ac ::
+     BG.CFloat
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> IO (BG.Ptr C)
+hs_bindgen_091043692da958ac =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_091043692da958ac_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.FunPtr (BG.CInt -> IO BG.CInt)
+     -- ^ __C declaration:__ @g@
+  -> IO (BG.Ptr C)
+foo3 = hs_bindgen_091043692da958ac
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar1@
+foreign import ccall unsafe "hs_bindgen_cf4fa39c5b4ef431" hs_bindgen_cf4fa39c5b4ef431_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar1@
+hs_bindgen_cf4fa39c5b4ef431 ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_cf4fa39c5b4ef431 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cf4fa39c5b4ef431_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar1 = hs_bindgen_cf4fa39c5b4ef431
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar2@
+foreign import ccall unsafe "hs_bindgen_9092ebfb46f7f31b" hs_bindgen_9092ebfb46f7f31b_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar2@
+hs_bindgen_9092ebfb46f7f31b ::
+     L
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_9092ebfb46f7f31b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9092ebfb46f7f31b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2 ::
+     L
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+bar2 = hs_bindgen_9092ebfb46f7f31b
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar3@
+foreign import ccall unsafe "hs_bindgen_a5e6607b472003eb" hs_bindgen_a5e6607b472003eb_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar3@
+hs_bindgen_a5e6607b472003eb ::
+     BG.CLong
+  -> IO (BG.FunPtr (S -> IO BG.CInt))
+hs_bindgen_a5e6607b472003eb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a5e6607b472003eb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (S -> IO BG.CInt))
+bar3 = hs_bindgen_a5e6607b472003eb
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar4@
+foreign import ccall unsafe "hs_bindgen_050bd8903c7b13dd" hs_bindgen_050bd8903c7b13dd_base ::
+     BG.CLong
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar4@
+hs_bindgen_050bd8903c7b13dd ::
+     BG.CLong
+  -> IO (BG.FunPtr (BG.CShort -> IO I))
+hs_bindgen_050bd8903c7b13dd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_050bd8903c7b13dd_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO (BG.FunPtr (BG.CShort -> IO I))
+bar4 = hs_bindgen_050bd8903c7b13dd
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz1@
+foreign import ccall unsafe "hs_bindgen_f378b374e8c8c095" hs_bindgen_f378b374e8c8c095_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz1@
+hs_bindgen_f378b374e8c8c095 ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_f378b374e8c8c095 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f378b374e8c8c095_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz1 = hs_bindgen_f378b374e8c8c095
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz2@
+foreign import ccall unsafe "hs_bindgen_27cf571d08ac8c04" hs_bindgen_27cf571d08ac8c04_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz2@
+hs_bindgen_27cf571d08ac8c04 ::
+     I
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+hs_bindgen_27cf571d08ac8c04 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_27cf571d08ac8c04_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2 ::
+     I
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 BG.CInt)))
+baz2 = hs_bindgen_27cf571d08ac8c04
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz3@
+foreign import ccall unsafe "hs_bindgen_c4035ef23b908e27" hs_bindgen_c4035ef23b908e27_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz3@
+hs_bindgen_c4035ef23b908e27 ::
+     BG.CInt
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 I)))
+hs_bindgen_c4035ef23b908e27 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c4035ef23b908e27_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @i@
+  -> IO (BG.Ptr (CA.ConstantArray 2 (CA.ConstantArray 3 I)))
+baz3 = hs_bindgen_c4035ef23b908e27
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_77a9149f03b2767f" hs_bindgen_77a9149f03b2767f_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_no_args_no_void@
+hs_bindgen_77a9149f03b2767f :: IO I
+hs_bindgen_77a9149f03b2767f =
+  fmap BG.fromFFIType hs_bindgen_77a9149f03b2767f_base
+
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void :: IO I
+no_args_no_void = hs_bindgen_77a9149f03b2767f
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_in_fundecl/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl/bindingspec.yaml
@@ -0,0 +1,189 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_in_fundecl.h
+  cname: macro I
+  hsname: I
+- headers: macros/macro_in_fundecl.h
+  cname: macro C
+  hsname: C
+- headers: macros/macro_in_fundecl.h
+  cname: macro F
+  hsname: F
+- headers: macros/macro_in_fundecl.h
+  cname: macro L
+  hsname: L
+- headers: macros/macro_in_fundecl.h
+  cname: macro S
+  hsname: S
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: F
+  representation:
+    newtype:
+      constructor: F
+      fields:
+      - unwrapF
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CFloat
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: I
+  representation:
+    newtype:
+      constructor: I
+      fields:
+      - unwrapI
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: L
+  representation:
+    newtype:
+      constructor: L
+      fields:
+      - unwrapL
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CLong
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    newtype:
+      constructor: S
+      fields:
+      - unwrapS
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CShort
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl/th.txt b/test-artefacts/fixtures/macros/macro_in_fundecl/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl/th.txt
@@ -0,0 +1,1420 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_in_fundecl.h
+-- #include <macros/macro_in_fundecl.h>
+-- char hs_bindgen_d345c332b6547629 (
+--   F arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux)(arg1, arg2);
+-- }
+-- C *hs_bindgen_195036c94aad554b (
+--   float arg1,
+--   C *arg2
+-- )
+-- {
+--   return (wam)(arg1, arg2);
+-- }
+-- char *hs_bindgen_a40b504a8f7c1d11 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo1)(arg1, arg2);
+-- }
+-- char *hs_bindgen_83392129a2035c99 (
+--   F arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo2)(arg1, arg2);
+-- }
+-- C *hs_bindgen_0c7f4bce7905d355 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo3)(arg1, arg2);
+-- }
+-- signed int (*hs_bindgen_3471ca0525deb2c0 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar1)(arg1);
+-- }
+-- signed int (*hs_bindgen_d5a4af88f772ff72 (
+--   L arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar2)(arg1);
+-- }
+-- signed int (*hs_bindgen_b289d62136acab77 (
+--   signed long arg1
+-- )) (
+--   S arg1
+-- )
+-- {
+--   return (bar3)(arg1);
+-- }
+-- I (*hs_bindgen_2b5b36cf49f0e40e (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar4)(arg1);
+-- }
+-- signed int (*hs_bindgen_b56f5f3515f3cc33 (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz1)(arg1);
+-- }
+-- signed int (*hs_bindgen_0b9b2e4d1699b6f3 (
+--   I const arg1
+-- ))[2][3]
+-- {
+--   return (baz2)(arg1);
+-- }
+-- I (*hs_bindgen_459eabcbd019687c (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz3)(arg1);
+-- }
+-- I hs_bindgen_7ae4ab0ad4fb8cad (void)
+-- {
+--   return (no_args_no_void)();
+-- }
+-- char hs_bindgen_ab9081efcd629826 (
+--   F arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux)(arg1, arg2);
+-- }
+-- C *hs_bindgen_7db4d5f10d9904d8 (
+--   float arg1,
+--   C *arg2
+-- )
+-- {
+--   return (wam)(arg1, arg2);
+-- }
+-- char *hs_bindgen_18401e906d384fd5 (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo1)(arg1, arg2);
+-- }
+-- char *hs_bindgen_1e16ebe63a290ff6 (
+--   F arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo2)(arg1, arg2);
+-- }
+-- C *hs_bindgen_091043692da958ac (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return (foo3)(arg1, arg2);
+-- }
+-- signed int (*hs_bindgen_cf4fa39c5b4ef431 (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar1)(arg1);
+-- }
+-- signed int (*hs_bindgen_9092ebfb46f7f31b (
+--   L arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar2)(arg1);
+-- }
+-- signed int (*hs_bindgen_a5e6607b472003eb (
+--   signed long arg1
+-- )) (
+--   S arg1
+-- )
+-- {
+--   return (bar3)(arg1);
+-- }
+-- I (*hs_bindgen_050bd8903c7b13dd (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return (bar4)(arg1);
+-- }
+-- signed int (*hs_bindgen_f378b374e8c8c095 (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz1)(arg1);
+-- }
+-- signed int (*hs_bindgen_27cf571d08ac8c04 (
+--   I const arg1
+-- ))[2][3]
+-- {
+--   return (baz2)(arg1);
+-- }
+-- I (*hs_bindgen_c4035ef23b908e27 (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return (baz3)(arg1);
+-- }
+-- I hs_bindgen_77a9149f03b2767f (void)
+-- {
+--   return (no_args_no_void)();
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_quux */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_930b4f8122942dae (void)) (
+--   F arg1,
+--   char arg2
+-- )
+-- {
+--   return &quux;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_wam */
+-- __attribute__ ((const))
+-- C *(*hs_bindgen_31f433dd4aceda85 (void)) (
+--   float arg1,
+--   C *arg2
+-- )
+-- {
+--   return &wam;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_foo1 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_8d7a85b3867041bf (void)) (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo1;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_foo2 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_c9dcd020e5be4af9 (void)) (
+--   F arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo2;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_foo3 */
+-- __attribute__ ((const))
+-- C *(*hs_bindgen_c2295c3f61edf4e7 (void)) (
+--   float arg1,
+--   signed int (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &foo3;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_bar1 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_d9b2e6e188ecbfea (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar1;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_bar2 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_111db9707ae2a631 (void)) (
+--   L arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar2;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_bar3 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_00996e2c7c9e793b (void)) (
+--   signed long arg1
+-- )) (
+--   S arg1
+-- )
+-- {
+--   return &bar3;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_bar4 */
+-- __attribute__ ((const))
+-- I (*(*hs_bindgen_aa46ba685e4693da (void)) (
+--   signed long arg1
+-- )) (
+--   signed short arg1
+-- )
+-- {
+--   return &bar4;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_baz1 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_86b147342f608069 (void)) (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return &baz1;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_baz2 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_a7194966e4f375df (void)) (
+--   I const arg1
+-- ))[2][3]
+-- {
+--   return &baz2;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_baz3 */
+-- __attribute__ ((const))
+-- I (*(*hs_bindgen_cd69bb91c3e6d7ea (void)) (
+--   signed int const arg1
+-- ))[2][3]
+-- {
+--   return &baz3;
+-- }
+-- /* test_macrosmacro_in_fundecl_Example_get_no_args_no_void */
+-- __attribute__ ((const))
+-- I (*hs_bindgen_d5b5e70d96cc6b8d (void)) (void)
+-- {
+--   return &no_args_no_void;
+-- }
+{-| __C declaration:__ @macro I@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 5:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype I
+    = I {unwrapI :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapI" I ty
+    where hasField = \x_0 -> (\y_1 -> I{unwrapI = y_1},
+                              getField @"unwrapI" x_0)
+instance (~) ty CInt => HasField "unwrapI" (Ptr I) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapI")
+instance HasCField I "unwrapI"
+    where type CFieldType I "unwrapI" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro C@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 6:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype C
+    = C {unwrapC :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapC" C ty
+    where hasField = \x_0 -> (\y_1 -> C{unwrapC = y_1},
+                              getField @"unwrapC" x_0)
+instance (~) ty CChar => HasField "unwrapC" (Ptr C) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapC")
+instance HasCField C "unwrapC"
+    where type CFieldType C "unwrapC" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 7:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype F
+    = F {unwrapF :: CFloat}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CFloat => HasField "unwrapF" F ty
+    where hasField = \x_0 -> (\y_1 -> F{unwrapF = y_1},
+                              getField @"unwrapF" x_0)
+instance (~) ty CFloat => HasField "unwrapF" (Ptr F) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF")
+instance HasCField F "unwrapF"
+    where type CFieldType F "unwrapF" = CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro L@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 8:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype L
+    = L {unwrapL :: CLong}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CLong => HasField "unwrapL" L ty
+    where hasField = \x_0 -> (\y_1 -> L{unwrapL = y_1},
+                              getField @"unwrapL" x_0)
+instance (~) ty CLong => HasField "unwrapL" (Ptr L) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapL")
+instance HasCField L "unwrapL"
+    where type CFieldType L "unwrapL" = CLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro S@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 9:9@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+newtype S
+    = S {unwrapS :: CShort}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CShort => HasField "unwrapS" S ty
+    where hasField = \x_0 -> (\y_1 -> S{unwrapS = y_1},
+                              getField @"unwrapS" x_0)
+instance (~) ty CShort => HasField "unwrapS" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapS")
+instance HasCField S "unwrapS"
+    where type CFieldType S "unwrapS" = CShort
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @instance ToFunPtr (BG.CShort -> IO I)@
+foreign import ccall safe "wrapper" hs_bindgen_03e9923d8d301cca_base ::
+    CShort -> IO CInt
+ -> IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @instance ToFunPtr (BG.CShort -> IO I)@
+hs_bindgen_03e9923d8d301cca :: (CShort -> IO I) ->
+                               IO (FunPtr (CShort -> IO I))
+-- __unique:__ @instance ToFunPtr (BG.CShort -> IO I)@
+hs_bindgen_03e9923d8d301cca = \fun_0 -> fmap castFunPtr (hs_bindgen_03e9923d8d301cca_base (\x_1 -> fmap toFFIType (fun_0 (fromFFIType x_1))))
+-- __unique:__ @instance FromFunPtr (BG.CShort -> IO I)@
+foreign import ccall safe "dynamic" hs_bindgen_ee10a61bcb1a5d39_base ::
+    FunPtr (CShort -> IO CInt)
+ -> CShort
+ -> IO CInt
+-- __unique:__ @instance FromFunPtr (BG.CShort -> IO I)@
+hs_bindgen_ee10a61bcb1a5d39 :: FunPtr (CShort -> IO I) ->
+                               CShort -> IO I
+-- __unique:__ @instance FromFunPtr (BG.CShort -> IO I)@
+hs_bindgen_ee10a61bcb1a5d39 = \funPtr_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_ee10a61bcb1a5d39_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr (CShort -> IO I)
+    where toFunPtr = hs_bindgen_03e9923d8d301cca
+instance FromFunPtr (CShort -> IO I)
+    where fromFunPtr = hs_bindgen_ee10a61bcb1a5d39
+-- __unique:__ @instance ToFunPtr (S -> IO BG.CInt)@
+foreign import ccall safe "wrapper" hs_bindgen_140ec1313a27c405_base ::
+    CShort -> IO CInt
+ -> IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @instance ToFunPtr (S -> IO BG.CInt)@
+hs_bindgen_140ec1313a27c405 :: (S -> IO CInt) ->
+                               IO (FunPtr (S -> IO CInt))
+-- __unique:__ @instance ToFunPtr (S -> IO BG.CInt)@
+hs_bindgen_140ec1313a27c405 = \fun_0 -> fmap castFunPtr (hs_bindgen_140ec1313a27c405_base (\x_1 -> fmap toFFIType (fun_0 (fromFFIType x_1))))
+-- __unique:__ @instance FromFunPtr (S -> IO BG.CInt)@
+foreign import ccall safe "dynamic" hs_bindgen_e86a5fa3f995e6fb_base ::
+    FunPtr (CShort -> IO CInt)
+ -> CShort
+ -> IO CInt
+-- __unique:__ @instance FromFunPtr (S -> IO BG.CInt)@
+hs_bindgen_e86a5fa3f995e6fb :: FunPtr (S -> IO CInt) ->
+                               S -> IO CInt
+-- __unique:__ @instance FromFunPtr (S -> IO BG.CInt)@
+hs_bindgen_e86a5fa3f995e6fb = \funPtr_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_e86a5fa3f995e6fb_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr (S -> IO CInt)
+    where toFunPtr = hs_bindgen_140ec1313a27c405
+instance FromFunPtr (S -> IO CInt)
+    where fromFunPtr = hs_bindgen_e86a5fa3f995e6fb
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_d345c332b6547629" hs_bindgen_d345c332b6547629_base ::
+    CFloat
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_quux@
+hs_bindgen_d345c332b6547629 :: F -> CChar -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_quux@
+hs_bindgen_d345c332b6547629 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_d345c332b6547629_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_safe :: F -> CChar -> IO CChar
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_safe = hs_bindgen_d345c332b6547629
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_wam@
+foreign import ccall safe "hs_bindgen_195036c94aad554b" hs_bindgen_195036c94aad554b_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_wam@
+hs_bindgen_195036c94aad554b :: CFloat -> Ptr C -> IO (Ptr C)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_wam@
+hs_bindgen_195036c94aad554b = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_195036c94aad554b_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_safe :: CFloat -> Ptr C -> IO (Ptr C)
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_safe = hs_bindgen_195036c94aad554b
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo1@
+foreign import ccall safe "hs_bindgen_a40b504a8f7c1d11" hs_bindgen_a40b504a8f7c1d11_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo1@
+hs_bindgen_a40b504a8f7c1d11 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo1@
+hs_bindgen_a40b504a8f7c1d11 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_a40b504a8f7c1d11_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_safe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_safe = hs_bindgen_a40b504a8f7c1d11
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo2@
+foreign import ccall safe "hs_bindgen_83392129a2035c99" hs_bindgen_83392129a2035c99_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo2@
+hs_bindgen_83392129a2035c99 :: F ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo2@
+hs_bindgen_83392129a2035c99 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_83392129a2035c99_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_safe :: F -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_safe = hs_bindgen_83392129a2035c99
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo3@
+foreign import ccall safe "hs_bindgen_0c7f4bce7905d355" hs_bindgen_0c7f4bce7905d355_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo3@
+hs_bindgen_0c7f4bce7905d355 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr C)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_foo3@
+hs_bindgen_0c7f4bce7905d355 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_0c7f4bce7905d355_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_safe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr C)
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_safe = hs_bindgen_0c7f4bce7905d355
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar1@
+foreign import ccall safe "hs_bindgen_3471ca0525deb2c0" hs_bindgen_3471ca0525deb2c0_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar1@
+hs_bindgen_3471ca0525deb2c0 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar1@
+hs_bindgen_3471ca0525deb2c0 = \x_0 -> fmap fromFFIType (hs_bindgen_3471ca0525deb2c0_base (toFFIType x_0))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_safe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_safe = hs_bindgen_3471ca0525deb2c0
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar2@
+foreign import ccall safe "hs_bindgen_d5a4af88f772ff72" hs_bindgen_d5a4af88f772ff72_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar2@
+hs_bindgen_d5a4af88f772ff72 :: L -> IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar2@
+hs_bindgen_d5a4af88f772ff72 = \x_0 -> fmap fromFFIType (hs_bindgen_d5a4af88f772ff72_base (toFFIType x_0))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_safe :: L -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_safe = hs_bindgen_d5a4af88f772ff72
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar3@
+foreign import ccall safe "hs_bindgen_b289d62136acab77" hs_bindgen_b289d62136acab77_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar3@
+hs_bindgen_b289d62136acab77 :: CLong -> IO (FunPtr (S -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar3@
+hs_bindgen_b289d62136acab77 = \x_0 -> fmap fromFFIType (hs_bindgen_b289d62136acab77_base (toFFIType x_0))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_safe :: CLong -> IO (FunPtr (S -> IO CInt))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_safe = hs_bindgen_b289d62136acab77
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar4@
+foreign import ccall safe "hs_bindgen_2b5b36cf49f0e40e" hs_bindgen_2b5b36cf49f0e40e_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar4@
+hs_bindgen_2b5b36cf49f0e40e :: CLong ->
+                               IO (FunPtr (CShort -> IO I))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_bar4@
+hs_bindgen_2b5b36cf49f0e40e = \x_0 -> fmap fromFFIType (hs_bindgen_2b5b36cf49f0e40e_base (toFFIType x_0))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_safe :: CLong -> IO (FunPtr (CShort -> IO I))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_safe = hs_bindgen_2b5b36cf49f0e40e
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz1@
+foreign import ccall safe "hs_bindgen_b56f5f3515f3cc33" hs_bindgen_b56f5f3515f3cc33_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz1@
+hs_bindgen_b56f5f3515f3cc33 :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz1@
+hs_bindgen_b56f5f3515f3cc33 = \x_0 -> fmap fromFFIType (hs_bindgen_b56f5f3515f3cc33_base (toFFIType x_0))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_safe :: CInt ->
+             IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_safe = hs_bindgen_b56f5f3515f3cc33
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz2@
+foreign import ccall safe "hs_bindgen_0b9b2e4d1699b6f3" hs_bindgen_0b9b2e4d1699b6f3_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz2@
+hs_bindgen_0b9b2e4d1699b6f3 :: I ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz2@
+hs_bindgen_0b9b2e4d1699b6f3 = \x_0 -> fmap fromFFIType (hs_bindgen_0b9b2e4d1699b6f3_base (toFFIType x_0))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_safe :: I -> IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_safe = hs_bindgen_0b9b2e4d1699b6f3
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz3@
+foreign import ccall safe "hs_bindgen_459eabcbd019687c" hs_bindgen_459eabcbd019687c_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz3@
+hs_bindgen_459eabcbd019687c :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 I)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_baz3@
+hs_bindgen_459eabcbd019687c = \x_0 -> fmap fromFFIType (hs_bindgen_459eabcbd019687c_base (toFFIType x_0))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_safe :: CInt -> IO (Ptr (ConstantArray 2 (ConstantArray 3 I)))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_safe = hs_bindgen_459eabcbd019687c
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_no_args_no_void@
+foreign import ccall safe "hs_bindgen_7ae4ab0ad4fb8cad" hs_bindgen_7ae4ab0ad4fb8cad_base ::
+    IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_no_args_no_void@
+hs_bindgen_7ae4ab0ad4fb8cad :: IO I
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Safe_no_args_no_void@
+hs_bindgen_7ae4ab0ad4fb8cad = fmap fromFFIType hs_bindgen_7ae4ab0ad4fb8cad_base
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_safe :: IO I
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_safe = hs_bindgen_7ae4ab0ad4fb8cad
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_ab9081efcd629826" hs_bindgen_ab9081efcd629826_base ::
+    CFloat
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_quux@
+hs_bindgen_ab9081efcd629826 :: F -> CChar -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_quux@
+hs_bindgen_ab9081efcd629826 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_ab9081efcd629826_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_unsafe :: F -> CChar -> IO CChar
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_unsafe = hs_bindgen_ab9081efcd629826
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_wam@
+foreign import ccall unsafe "hs_bindgen_7db4d5f10d9904d8" hs_bindgen_7db4d5f10d9904d8_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_wam@
+hs_bindgen_7db4d5f10d9904d8 :: CFloat -> Ptr C -> IO (Ptr C)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_wam@
+hs_bindgen_7db4d5f10d9904d8 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_7db4d5f10d9904d8_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_unsafe :: CFloat -> Ptr C -> IO (Ptr C)
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_unsafe = hs_bindgen_7db4d5f10d9904d8
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo1@
+foreign import ccall unsafe "hs_bindgen_18401e906d384fd5" hs_bindgen_18401e906d384fd5_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo1@
+hs_bindgen_18401e906d384fd5 :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo1@
+hs_bindgen_18401e906d384fd5 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_18401e906d384fd5_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_unsafe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_unsafe = hs_bindgen_18401e906d384fd5
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo2@
+foreign import ccall unsafe "hs_bindgen_1e16ebe63a290ff6" hs_bindgen_1e16ebe63a290ff6_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo2@
+hs_bindgen_1e16ebe63a290ff6 :: F ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo2@
+hs_bindgen_1e16ebe63a290ff6 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_1e16ebe63a290ff6_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_unsafe :: F -> FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_unsafe = hs_bindgen_1e16ebe63a290ff6
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo3@
+foreign import ccall unsafe "hs_bindgen_091043692da958ac" hs_bindgen_091043692da958ac_base ::
+    CFloat
+ -> FunPtr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo3@
+hs_bindgen_091043692da958ac :: CFloat ->
+                               FunPtr (CInt -> IO CInt) -> IO (Ptr C)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_foo3@
+hs_bindgen_091043692da958ac = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_091043692da958ac_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_unsafe :: CFloat -> FunPtr (CInt -> IO CInt) -> IO (Ptr C)
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_unsafe = hs_bindgen_091043692da958ac
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar1@
+foreign import ccall unsafe "hs_bindgen_cf4fa39c5b4ef431" hs_bindgen_cf4fa39c5b4ef431_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar1@
+hs_bindgen_cf4fa39c5b4ef431 :: CLong ->
+                               IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar1@
+hs_bindgen_cf4fa39c5b4ef431 = \x_0 -> fmap fromFFIType (hs_bindgen_cf4fa39c5b4ef431_base (toFFIType x_0))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_unsafe :: CLong -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_unsafe = hs_bindgen_cf4fa39c5b4ef431
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar2@
+foreign import ccall unsafe "hs_bindgen_9092ebfb46f7f31b" hs_bindgen_9092ebfb46f7f31b_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar2@
+hs_bindgen_9092ebfb46f7f31b :: L -> IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar2@
+hs_bindgen_9092ebfb46f7f31b = \x_0 -> fmap fromFFIType (hs_bindgen_9092ebfb46f7f31b_base (toFFIType x_0))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_unsafe :: L -> IO (FunPtr (CShort -> IO CInt))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_unsafe = hs_bindgen_9092ebfb46f7f31b
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar3@
+foreign import ccall unsafe "hs_bindgen_a5e6607b472003eb" hs_bindgen_a5e6607b472003eb_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar3@
+hs_bindgen_a5e6607b472003eb :: CLong -> IO (FunPtr (S -> IO CInt))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar3@
+hs_bindgen_a5e6607b472003eb = \x_0 -> fmap fromFFIType (hs_bindgen_a5e6607b472003eb_base (toFFIType x_0))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_unsafe :: CLong -> IO (FunPtr (S -> IO CInt))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_unsafe = hs_bindgen_a5e6607b472003eb
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar4@
+foreign import ccall unsafe "hs_bindgen_050bd8903c7b13dd" hs_bindgen_050bd8903c7b13dd_base ::
+    CLong
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar4@
+hs_bindgen_050bd8903c7b13dd :: CLong ->
+                               IO (FunPtr (CShort -> IO I))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_bar4@
+hs_bindgen_050bd8903c7b13dd = \x_0 -> fmap fromFFIType (hs_bindgen_050bd8903c7b13dd_base (toFFIType x_0))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_unsafe :: CLong -> IO (FunPtr (CShort -> IO I))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_unsafe = hs_bindgen_050bd8903c7b13dd
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz1@
+foreign import ccall unsafe "hs_bindgen_f378b374e8c8c095" hs_bindgen_f378b374e8c8c095_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz1@
+hs_bindgen_f378b374e8c8c095 :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz1@
+hs_bindgen_f378b374e8c8c095 = \x_0 -> fmap fromFFIType (hs_bindgen_f378b374e8c8c095_base (toFFIType x_0))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_unsafe :: CInt ->
+               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_unsafe = hs_bindgen_f378b374e8c8c095
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz2@
+foreign import ccall unsafe "hs_bindgen_27cf571d08ac8c04" hs_bindgen_27cf571d08ac8c04_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz2@
+hs_bindgen_27cf571d08ac8c04 :: I ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz2@
+hs_bindgen_27cf571d08ac8c04 = \x_0 -> fmap fromFFIType (hs_bindgen_27cf571d08ac8c04_base (toFFIType x_0))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_unsafe :: I ->
+               IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_unsafe = hs_bindgen_27cf571d08ac8c04
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz3@
+foreign import ccall unsafe "hs_bindgen_c4035ef23b908e27" hs_bindgen_c4035ef23b908e27_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz3@
+hs_bindgen_c4035ef23b908e27 :: CInt ->
+                               IO (Ptr (ConstantArray 2 (ConstantArray 3 I)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_baz3@
+hs_bindgen_c4035ef23b908e27 = \x_0 -> fmap fromFFIType (hs_bindgen_c4035ef23b908e27_base (toFFIType x_0))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_unsafe :: CInt ->
+               IO (Ptr (ConstantArray 2 (ConstantArray 3 I)))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_unsafe = hs_bindgen_c4035ef23b908e27
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_77a9149f03b2767f" hs_bindgen_77a9149f03b2767f_base ::
+    IO CInt
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_no_args_no_void@
+hs_bindgen_77a9149f03b2767f :: IO I
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_Unsafe_no_args_no_void@
+hs_bindgen_77a9149f03b2767f = fmap fromFFIType hs_bindgen_77a9149f03b2767f_base
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_unsafe :: IO I
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_unsafe = hs_bindgen_77a9149f03b2767f
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_930b4f8122942dae" hs_bindgen_930b4f8122942dae_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_quux@
+hs_bindgen_930b4f8122942dae :: IO (FunPtr (F -> CChar -> IO CChar))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_quux@
+hs_bindgen_930b4f8122942dae = fmap fromFFIType hs_bindgen_930b4f8122942dae_base
+{-# NOINLINE quux_funptr #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_funptr :: FunPtr (F -> CChar -> IO CChar)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 12:6@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+quux_funptr = unsafePerformIO hs_bindgen_930b4f8122942dae
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_wam@
+foreign import ccall unsafe "hs_bindgen_31f433dd4aceda85" hs_bindgen_31f433dd4aceda85_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_wam@
+hs_bindgen_31f433dd4aceda85 :: IO (FunPtr (CFloat ->
+                                           Ptr C -> IO (Ptr C)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_wam@
+hs_bindgen_31f433dd4aceda85 = fmap fromFFIType hs_bindgen_31f433dd4aceda85_base
+{-# NOINLINE wam_funptr #-}
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_funptr :: FunPtr (CFloat -> Ptr C -> IO (Ptr C))
+{-| __C declaration:__ @wam@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 13:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+wam_funptr = unsafePerformIO hs_bindgen_31f433dd4aceda85
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo1@
+foreign import ccall unsafe "hs_bindgen_8d7a85b3867041bf" hs_bindgen_8d7a85b3867041bf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo1@
+hs_bindgen_8d7a85b3867041bf :: IO (FunPtr (CFloat ->
+                                           FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo1@
+hs_bindgen_8d7a85b3867041bf = fmap fromFFIType hs_bindgen_8d7a85b3867041bf_base
+{-# NOINLINE foo1_funptr #-}
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_funptr :: FunPtr (CFloat ->
+                       FunPtr (CInt -> IO CInt) -> IO (Ptr CChar))
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 16:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo1_funptr = unsafePerformIO hs_bindgen_8d7a85b3867041bf
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo2@
+foreign import ccall unsafe "hs_bindgen_c9dcd020e5be4af9" hs_bindgen_c9dcd020e5be4af9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo2@
+hs_bindgen_c9dcd020e5be4af9 :: IO (FunPtr (F ->
+                                           FunPtr (CInt -> IO CInt) -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo2@
+hs_bindgen_c9dcd020e5be4af9 = fmap fromFFIType hs_bindgen_c9dcd020e5be4af9_base
+{-# NOINLINE foo2_funptr #-}
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_funptr :: FunPtr (F ->
+                       FunPtr (CInt -> IO CInt) -> IO (Ptr CChar))
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 17:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo2_funptr = unsafePerformIO hs_bindgen_c9dcd020e5be4af9
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo3@
+foreign import ccall unsafe "hs_bindgen_c2295c3f61edf4e7" hs_bindgen_c2295c3f61edf4e7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo3@
+hs_bindgen_c2295c3f61edf4e7 :: IO (FunPtr (CFloat ->
+                                           FunPtr (CInt -> IO CInt) -> IO (Ptr C)))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_foo3@
+hs_bindgen_c2295c3f61edf4e7 = fmap fromFFIType hs_bindgen_c2295c3f61edf4e7_base
+{-# NOINLINE foo3_funptr #-}
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_funptr :: FunPtr (CFloat ->
+                       FunPtr (CInt -> IO CInt) -> IO (Ptr C))
+{-| __C declaration:__ @foo3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 18:4@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+foo3_funptr = unsafePerformIO hs_bindgen_c2295c3f61edf4e7
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar1@
+foreign import ccall unsafe "hs_bindgen_d9b2e6e188ecbfea" hs_bindgen_d9b2e6e188ecbfea_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar1@
+hs_bindgen_d9b2e6e188ecbfea :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar1@
+hs_bindgen_d9b2e6e188ecbfea = fmap fromFFIType hs_bindgen_d9b2e6e188ecbfea_base
+{-# NOINLINE bar1_funptr #-}
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 21:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar1_funptr = unsafePerformIO hs_bindgen_d9b2e6e188ecbfea
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar2@
+foreign import ccall unsafe "hs_bindgen_111db9707ae2a631" hs_bindgen_111db9707ae2a631_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar2@
+hs_bindgen_111db9707ae2a631 :: IO (FunPtr (L ->
+                                           IO (FunPtr (CShort -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar2@
+hs_bindgen_111db9707ae2a631 = fmap fromFFIType hs_bindgen_111db9707ae2a631_base
+{-# NOINLINE bar2_funptr #-}
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_funptr :: FunPtr (L -> IO (FunPtr (CShort -> IO CInt)))
+{-| __C declaration:__ @bar2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 22:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar2_funptr = unsafePerformIO hs_bindgen_111db9707ae2a631
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar3@
+foreign import ccall unsafe "hs_bindgen_00996e2c7c9e793b" hs_bindgen_00996e2c7c9e793b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar3@
+hs_bindgen_00996e2c7c9e793b :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (S -> IO CInt))))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar3@
+hs_bindgen_00996e2c7c9e793b = fmap fromFFIType hs_bindgen_00996e2c7c9e793b_base
+{-# NOINLINE bar3_funptr #-}
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_funptr :: FunPtr (CLong -> IO (FunPtr (S -> IO CInt)))
+{-| __C declaration:__ @bar3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 23:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar3_funptr = unsafePerformIO hs_bindgen_00996e2c7c9e793b
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar4@
+foreign import ccall unsafe "hs_bindgen_aa46ba685e4693da" hs_bindgen_aa46ba685e4693da_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar4@
+hs_bindgen_aa46ba685e4693da :: IO (FunPtr (CLong ->
+                                           IO (FunPtr (CShort -> IO I))))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_bar4@
+hs_bindgen_aa46ba685e4693da = fmap fromFFIType hs_bindgen_aa46ba685e4693da_base
+{-# NOINLINE bar4_funptr #-}
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_funptr :: FunPtr (CLong -> IO (FunPtr (CShort -> IO I)))
+{-| __C declaration:__ @bar4@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 24:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+bar4_funptr = unsafePerformIO hs_bindgen_aa46ba685e4693da
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz1@
+foreign import ccall unsafe "hs_bindgen_86b147342f608069" hs_bindgen_86b147342f608069_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz1@
+hs_bindgen_86b147342f608069 :: IO (FunPtr (CInt ->
+                                           IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz1@
+hs_bindgen_86b147342f608069 = fmap fromFFIType hs_bindgen_86b147342f608069_base
+{-# NOINLINE baz1_funptr #-}
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_funptr :: FunPtr (CInt ->
+                       IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt))))
+{-| __C declaration:__ @baz1@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 27:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz1_funptr = unsafePerformIO hs_bindgen_86b147342f608069
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz2@
+foreign import ccall unsafe "hs_bindgen_a7194966e4f375df" hs_bindgen_a7194966e4f375df_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz2@
+hs_bindgen_a7194966e4f375df :: IO (FunPtr (I ->
+                                           IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt)))))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz2@
+hs_bindgen_a7194966e4f375df = fmap fromFFIType hs_bindgen_a7194966e4f375df_base
+{-# NOINLINE baz2_funptr #-}
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_funptr :: FunPtr (I ->
+                       IO (Ptr (ConstantArray 2 (ConstantArray 3 CInt))))
+{-| __C declaration:__ @baz2@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 35:7@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz2_funptr = unsafePerformIO hs_bindgen_a7194966e4f375df
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz3@
+foreign import ccall unsafe "hs_bindgen_cd69bb91c3e6d7ea" hs_bindgen_cd69bb91c3e6d7ea_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz3@
+hs_bindgen_cd69bb91c3e6d7ea :: IO (FunPtr (CInt ->
+                                           IO (Ptr (ConstantArray 2 (ConstantArray 3 I)))))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_baz3@
+hs_bindgen_cd69bb91c3e6d7ea = fmap fromFFIType hs_bindgen_cd69bb91c3e6d7ea_base
+{-# NOINLINE baz3_funptr #-}
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_funptr :: FunPtr (CInt ->
+                       IO (Ptr (ConstantArray 2 (ConstantArray 3 I))))
+{-| __C declaration:__ @baz3@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 43:5@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+baz3_funptr = unsafePerformIO hs_bindgen_cd69bb91c3e6d7ea
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_no_args_no_void@
+foreign import ccall unsafe "hs_bindgen_d5b5e70d96cc6b8d" hs_bindgen_d5b5e70d96cc6b8d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_no_args_no_void@
+hs_bindgen_d5b5e70d96cc6b8d :: IO (FunPtr (IO I))
+-- __unique:__ @test_macrosmacro_in_fundecl_Example_get_no_args_no_void@
+hs_bindgen_d5b5e70d96cc6b8d = fmap fromFFIType hs_bindgen_d5b5e70d96cc6b8d_base
+{-# NOINLINE no_args_no_void_funptr #-}
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_funptr :: FunPtr (IO I)
+{-| __C declaration:__ @no_args_no_void@
+
+    __defined at:__ @macros\/macro_in_fundecl.h 53:3@
+
+    __exported by:__ @macros\/macro_in_fundecl.h@
+-}
+no_args_no_void_funptr = unsafePerformIO hs_bindgen_d5b5e70d96cc6b8d
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example.hs
@@ -0,0 +1,387 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.TC(..)
+    , Example.Struct1(..)
+    , Example.Struct2(..)
+    , Example.Struct3(..)
+    , Example.Struct3_t(..)
+    , Example.Struct4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @TC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 5:14@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype TC = TC
+  { unwrapTC :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "unwrapTC" TC ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TC {unwrapTC = y1}, BG.getField @"unwrapTC" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "unwrapTC" (BG.Ptr TC) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTC")
+
+instance HasCField.HasCField TC "unwrapTC" where
+
+  type CFieldType TC "unwrapTC" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct1 = Struct1
+  { struct1_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct1
+      <*> HasCField.readRaw (BG.Proxy @"struct1_a") ptr0
+
+instance Marshal.WriteRaw Struct1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct1 struct1_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct1_a") ptr0 struct1_a2
+
+deriving via Marshal.EquivStorable Struct1 instance BG.Storable Struct1
+
+deriving via Struct.IsStructViaReadRaw Struct1 instance Struct.IsStruct Struct1
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct1_a" Struct1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct1 {struct1_a = y1}, BG.getField @"struct1_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct1_a" (BG.Ptr Struct1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct1_a")
+
+instance HasCField.HasCField Struct1 "struct1_a" where
+
+  type CFieldType Struct1 "struct1_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct2 = Struct2
+  { struct2_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct2 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct2
+      <*> HasCField.readRaw (BG.Proxy @"struct2_a") ptr0
+
+instance Marshal.WriteRaw Struct2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct2 struct2_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct2_a") ptr0 struct2_a2
+
+deriving via Marshal.EquivStorable Struct2 instance BG.Storable Struct2
+
+deriving via Struct.IsStructViaReadRaw Struct2 instance Struct.IsStruct Struct2
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct2_a" Struct2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct2 {struct2_a = y1}, BG.getField @"struct2_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct2_a" (BG.Ptr Struct2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct2_a")
+
+instance HasCField.HasCField Struct2 "struct2_a" where
+
+  type CFieldType Struct2 "struct2_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct3 = Struct3
+  { struct3_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct3 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct3
+      <*> HasCField.readRaw (BG.Proxy @"struct3_a") ptr0
+
+instance Marshal.WriteRaw Struct3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct3 struct3_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct3_a") ptr0 struct3_a2
+
+deriving via Marshal.EquivStorable Struct3 instance BG.Storable Struct3
+
+deriving via Struct.IsStructViaReadRaw Struct3 instance Struct.IsStruct Struct3
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct3_a" Struct3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct3 {struct3_a = y1}, BG.getField @"struct3_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct3_a" (BG.Ptr Struct3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct3_a")
+
+instance HasCField.HasCField Struct3 "struct3_a" where
+
+  type CFieldType Struct3 "struct3_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct3_t@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:35@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype Struct3_t = Struct3_t
+  { unwrapStruct3_t :: Struct3
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Struct3
+         ) => BG.CompatHasField.HasField "unwrapStruct3_t" Struct3_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct3_t {unwrapStruct3_t = y1}, BG.getField @"unwrapStruct3_t" x0)
+
+instance ( ty ~ Struct3
+         ) => BG.HasField "unwrapStruct3_t" (BG.Ptr Struct3_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct3_t")
+
+instance HasCField.HasCField Struct3_t "unwrapStruct3_t" where
+
+  type CFieldType Struct3_t "unwrapStruct3_t" = Struct3
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct4 = Struct4
+  { struct4_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct4 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct4 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct4
+      <*> HasCField.readRaw (BG.Proxy @"struct4_a") ptr0
+
+instance Marshal.WriteRaw Struct4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct4 struct4_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct4_a") ptr0 struct4_a2
+
+deriving via Marshal.EquivStorable Struct4 instance BG.Storable Struct4
+
+deriving via Struct.IsStructViaReadRaw Struct4 instance Struct.IsStruct Struct4
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct4_a" Struct4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct4 {struct4_a = y1}, BG.getField @"struct4_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct4_a" (BG.Ptr Struct4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct4_a")
+
+instance HasCField.HasCField Struct4 "struct4_a" where
+
+  type CFieldType Struct4 "struct4_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example/FunPtr.hs
@@ -0,0 +1,315 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.quux1
+    , Example.FunPtr.quux2
+    , Example.FunPtr.wam1
+    , Example.FunPtr.wam2
+    , Example.FunPtr.struct_typedef1
+    , Example.FunPtr.struct_typedef2
+    , Example.FunPtr.struct_typedef3
+    , Example.FunPtr.struct_name1
+    , Example.FunPtr.struct_name2
+    , Example.FunPtr.struct_name3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl_vs_typedef.h>"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1 */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_8c77c87c8985f5b4 (void)) ("
+  , "  char arg1,"
+  , "  TC arg2"
+  , ")"
+  , "{"
+  , "  return &quux1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2 */"
+  , "__attribute__ ((const))"
+  , "TC (*hs_bindgen_ad1c057fd2e38491 (void)) ("
+  , "  char arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &quux2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_05b0ef45be2bc377 (void)) ("
+  , "  float arg1,"
+  , "  TC *arg2"
+  , ")"
+  , "{"
+  , "  return &wam1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2 */"
+  , "__attribute__ ((const))"
+  , "TC *(*hs_bindgen_cd643a7a3c18ccf6 (void)) ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return &wam2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0322539d81aee229 (void)) ("
+  , "  struct2 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_typedef1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8522498cba39ada6 (void)) ("
+  , "  struct3_t *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_typedef2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e19fc7f7dee46424 (void)) ("
+  , "  struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_typedef3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_00f81edda453ec64 (void)) ("
+  , "  struct struct1 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_name1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8f4de3d502f3466d (void)) ("
+  , "  struct struct3 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_name2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ba133ae0ff062248 (void)) ("
+  , "  struct struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_name3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+foreign import ccall unsafe "hs_bindgen_8c77c87c8985f5b4" hs_bindgen_8c77c87c8985f5b4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+hs_bindgen_8c77c87c8985f5b4 :: IO (BG.FunPtr (BG.CChar -> TC -> IO BG.CChar))
+hs_bindgen_8c77c87c8985f5b4 =
+  fmap BG.fromFFIType hs_bindgen_8c77c87c8985f5b4_base
+
+{-# NOINLINE quux1 #-}
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1 :: BG.FunPtr (BG.CChar -> TC -> IO BG.CChar)
+quux1 =
+  BG.unsafePerformIO hs_bindgen_8c77c87c8985f5b4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+foreign import ccall unsafe "hs_bindgen_ad1c057fd2e38491" hs_bindgen_ad1c057fd2e38491_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+hs_bindgen_ad1c057fd2e38491 :: IO (BG.FunPtr (BG.CChar -> BG.CChar -> IO TC))
+hs_bindgen_ad1c057fd2e38491 =
+  fmap BG.fromFFIType hs_bindgen_ad1c057fd2e38491_base
+
+{-# NOINLINE quux2 #-}
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2 :: BG.FunPtr (BG.CChar -> BG.CChar -> IO TC)
+quux2 =
+  BG.unsafePerformIO hs_bindgen_ad1c057fd2e38491
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+foreign import ccall unsafe "hs_bindgen_05b0ef45be2bc377" hs_bindgen_05b0ef45be2bc377_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+hs_bindgen_05b0ef45be2bc377 :: IO (BG.FunPtr (BG.CFloat -> BG.Ptr TC -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_05b0ef45be2bc377 =
+  fmap BG.fromFFIType hs_bindgen_05b0ef45be2bc377_base
+
+{-# NOINLINE wam1 #-}
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1 :: BG.FunPtr (BG.CFloat -> BG.Ptr TC -> IO (BG.Ptr BG.CChar))
+wam1 = BG.unsafePerformIO hs_bindgen_05b0ef45be2bc377
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+foreign import ccall unsafe "hs_bindgen_cd643a7a3c18ccf6" hs_bindgen_cd643a7a3c18ccf6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+hs_bindgen_cd643a7a3c18ccf6 :: IO (BG.FunPtr (BG.CFloat -> BG.Ptr BG.CChar -> IO (BG.Ptr TC)))
+hs_bindgen_cd643a7a3c18ccf6 =
+  fmap BG.fromFFIType hs_bindgen_cd643a7a3c18ccf6_base
+
+{-# NOINLINE wam2 #-}
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2 :: BG.FunPtr (BG.CFloat -> BG.Ptr BG.CChar -> IO (BG.Ptr TC))
+wam2 = BG.unsafePerformIO hs_bindgen_cd643a7a3c18ccf6
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_0322539d81aee229" hs_bindgen_0322539d81aee229_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+hs_bindgen_0322539d81aee229 :: IO (BG.FunPtr (BG.Ptr Struct2 -> BG.CChar -> IO ()))
+hs_bindgen_0322539d81aee229 =
+  fmap BG.fromFFIType hs_bindgen_0322539d81aee229_base
+
+{-# NOINLINE struct_typedef1 #-}
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1 :: BG.FunPtr (BG.Ptr Struct2 -> BG.CChar -> IO ())
+struct_typedef1 =
+  BG.unsafePerformIO hs_bindgen_0322539d81aee229
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_8522498cba39ada6" hs_bindgen_8522498cba39ada6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+hs_bindgen_8522498cba39ada6 :: IO (BG.FunPtr (BG.Ptr Struct3_t -> BG.CChar -> IO ()))
+hs_bindgen_8522498cba39ada6 =
+  fmap BG.fromFFIType hs_bindgen_8522498cba39ada6_base
+
+{-# NOINLINE struct_typedef2 #-}
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2 :: BG.FunPtr (BG.Ptr Struct3_t -> BG.CChar -> IO ())
+struct_typedef2 =
+  BG.unsafePerformIO hs_bindgen_8522498cba39ada6
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_e19fc7f7dee46424" hs_bindgen_e19fc7f7dee46424_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+hs_bindgen_e19fc7f7dee46424 :: IO (BG.FunPtr (BG.Ptr Struct4 -> BG.CChar -> IO ()))
+hs_bindgen_e19fc7f7dee46424 =
+  fmap BG.fromFFIType hs_bindgen_e19fc7f7dee46424_base
+
+{-# NOINLINE struct_typedef3 #-}
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3 :: BG.FunPtr (BG.Ptr Struct4 -> BG.CChar -> IO ())
+struct_typedef3 =
+  BG.unsafePerformIO hs_bindgen_e19fc7f7dee46424
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+foreign import ccall unsafe "hs_bindgen_00f81edda453ec64" hs_bindgen_00f81edda453ec64_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+hs_bindgen_00f81edda453ec64 :: IO (BG.FunPtr (BG.Ptr Struct1 -> BG.CChar -> IO ()))
+hs_bindgen_00f81edda453ec64 =
+  fmap BG.fromFFIType hs_bindgen_00f81edda453ec64_base
+
+{-# NOINLINE struct_name1 #-}
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1 :: BG.FunPtr (BG.Ptr Struct1 -> BG.CChar -> IO ())
+struct_name1 =
+  BG.unsafePerformIO hs_bindgen_00f81edda453ec64
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+foreign import ccall unsafe "hs_bindgen_8f4de3d502f3466d" hs_bindgen_8f4de3d502f3466d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+hs_bindgen_8f4de3d502f3466d :: IO (BG.FunPtr (BG.Ptr Struct3 -> BG.CChar -> IO ()))
+hs_bindgen_8f4de3d502f3466d =
+  fmap BG.fromFFIType hs_bindgen_8f4de3d502f3466d_base
+
+{-# NOINLINE struct_name2 #-}
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2 :: BG.FunPtr (BG.Ptr Struct3 -> BG.CChar -> IO ())
+struct_name2 =
+  BG.unsafePerformIO hs_bindgen_8f4de3d502f3466d
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+foreign import ccall unsafe "hs_bindgen_ba133ae0ff062248" hs_bindgen_ba133ae0ff062248_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+hs_bindgen_ba133ae0ff062248 :: IO (BG.FunPtr (BG.Ptr Struct4 -> BG.CChar -> IO ()))
+hs_bindgen_ba133ae0ff062248 =
+  fmap BG.fromFFIType hs_bindgen_ba133ae0ff062248_base
+
+{-# NOINLINE struct_name3 #-}
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3 :: BG.FunPtr (BG.Ptr Struct4 -> BG.CChar -> IO ())
+struct_name3 =
+  BG.unsafePerformIO hs_bindgen_ba133ae0ff062248
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example/Safe.hs
@@ -0,0 +1,397 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.quux1
+    , Example.Safe.quux2
+    , Example.Safe.wam1
+    , Example.Safe.wam2
+    , Example.Safe.struct_typedef1
+    , Example.Safe.struct_typedef2
+    , Example.Safe.struct_typedef3
+    , Example.Safe.struct_name1
+    , Example.Safe.struct_name2
+    , Example.Safe.struct_name3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl_vs_typedef.h>"
+  , "char hs_bindgen_02e0e3b28d470fd4 ("
+  , "  char arg1,"
+  , "  TC arg2"
+  , ")"
+  , "{"
+  , "  return (quux1)(arg1, arg2);"
+  , "}"
+  , "TC hs_bindgen_bb79188c8775e2e4 ("
+  , "  char arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux2)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_a398fb73645271c5 ("
+  , "  float arg1,"
+  , "  TC *arg2"
+  , ")"
+  , "{"
+  , "  return (wam1)(arg1, arg2);"
+  , "}"
+  , "TC *hs_bindgen_ad904da072e0711e ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (wam2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_88e976dc10571000 ("
+  , "  struct2 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_edb3806d45d7605b ("
+  , "  struct3_t *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7c7f3ab0dd790fe8 ("
+  , "  struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2cfbb4f5834d4bcb ("
+  , "  struct struct1 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c8b765fa70f95167 ("
+  , "  struct struct3 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0ff3632971f092bb ("
+  , "  struct struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name3)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+foreign import ccall safe "hs_bindgen_02e0e3b28d470fd4" hs_bindgen_02e0e3b28d470fd4_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+hs_bindgen_02e0e3b28d470fd4 ::
+     BG.CChar
+  -> TC
+  -> IO BG.CChar
+hs_bindgen_02e0e3b28d470fd4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_02e0e3b28d470fd4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> TC
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux1 = hs_bindgen_02e0e3b28d470fd4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+foreign import ccall safe "hs_bindgen_bb79188c8775e2e4" hs_bindgen_bb79188c8775e2e4_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+hs_bindgen_bb79188c8775e2e4 ::
+     BG.CChar
+  -> BG.CChar
+  -> IO TC
+hs_bindgen_bb79188c8775e2e4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_bb79188c8775e2e4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO TC
+quux2 = hs_bindgen_bb79188c8775e2e4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+foreign import ccall safe "hs_bindgen_a398fb73645271c5" hs_bindgen_a398fb73645271c5_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+hs_bindgen_a398fb73645271c5 ::
+     BG.CFloat
+  -> BG.Ptr TC
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_a398fb73645271c5 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a398fb73645271c5_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr TC
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr BG.CChar)
+wam1 = hs_bindgen_a398fb73645271c5
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+foreign import ccall safe "hs_bindgen_ad904da072e0711e" hs_bindgen_ad904da072e0711e_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+hs_bindgen_ad904da072e0711e ::
+     BG.CFloat
+  -> BG.Ptr BG.CChar
+  -> IO (BG.Ptr TC)
+hs_bindgen_ad904da072e0711e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ad904da072e0711e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr TC)
+wam2 = hs_bindgen_ad904da072e0711e
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+foreign import ccall safe "hs_bindgen_88e976dc10571000" hs_bindgen_88e976dc10571000_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+hs_bindgen_88e976dc10571000 ::
+     BG.Ptr Struct2
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_88e976dc10571000 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_88e976dc10571000_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1 ::
+     BG.Ptr Struct2
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef1 = hs_bindgen_88e976dc10571000
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+foreign import ccall safe "hs_bindgen_edb3806d45d7605b" hs_bindgen_edb3806d45d7605b_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+hs_bindgen_edb3806d45d7605b ::
+     BG.Ptr Struct3_t
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_edb3806d45d7605b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_edb3806d45d7605b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2 ::
+     BG.Ptr Struct3_t
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef2 = hs_bindgen_edb3806d45d7605b
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+foreign import ccall safe "hs_bindgen_7c7f3ab0dd790fe8" hs_bindgen_7c7f3ab0dd790fe8_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+hs_bindgen_7c7f3ab0dd790fe8 ::
+     BG.Ptr Struct4
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_7c7f3ab0dd790fe8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7c7f3ab0dd790fe8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef3 = hs_bindgen_7c7f3ab0dd790fe8
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+foreign import ccall safe "hs_bindgen_2cfbb4f5834d4bcb" hs_bindgen_2cfbb4f5834d4bcb_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+hs_bindgen_2cfbb4f5834d4bcb ::
+     BG.Ptr Struct1
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_2cfbb4f5834d4bcb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2cfbb4f5834d4bcb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1 ::
+     BG.Ptr Struct1
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name1 = hs_bindgen_2cfbb4f5834d4bcb
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+foreign import ccall safe "hs_bindgen_c8b765fa70f95167" hs_bindgen_c8b765fa70f95167_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+hs_bindgen_c8b765fa70f95167 ::
+     BG.Ptr Struct3
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_c8b765fa70f95167 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c8b765fa70f95167_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2 ::
+     BG.Ptr Struct3
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name2 = hs_bindgen_c8b765fa70f95167
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+foreign import ccall safe "hs_bindgen_0ff3632971f092bb" hs_bindgen_0ff3632971f092bb_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+hs_bindgen_0ff3632971f092bb ::
+     BG.Ptr Struct4
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_0ff3632971f092bb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0ff3632971f092bb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name3 = hs_bindgen_0ff3632971f092bb
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/Example/Unsafe.hs
@@ -0,0 +1,397 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.quux1
+    , Example.Unsafe.quux2
+    , Example.Unsafe.wam1
+    , Example.Unsafe.wam2
+    , Example.Unsafe.struct_typedef1
+    , Example.Unsafe.struct_typedef2
+    , Example.Unsafe.struct_typedef3
+    , Example.Unsafe.struct_name1
+    , Example.Unsafe.struct_name2
+    , Example.Unsafe.struct_name3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl_vs_typedef.h>"
+  , "char hs_bindgen_df7e2b8e86de411a ("
+  , "  char arg1,"
+  , "  TC arg2"
+  , ")"
+  , "{"
+  , "  return (quux1)(arg1, arg2);"
+  , "}"
+  , "TC hs_bindgen_6f0b13ed02b696df ("
+  , "  char arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux2)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_f92059cc98dde342 ("
+  , "  float arg1,"
+  , "  TC *arg2"
+  , ")"
+  , "{"
+  , "  return (wam1)(arg1, arg2);"
+  , "}"
+  , "TC *hs_bindgen_3e6ecd1b2cc616bc ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (wam2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ffa9d5a3e8f0f221 ("
+  , "  struct2 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4801667560542114 ("
+  , "  struct3_t *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_04fa5bbd479146eb ("
+  , "  struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_08025fd0bd589ac2 ("
+  , "  struct struct1 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9de286608f952fc7 ("
+  , "  struct struct3 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_38cce6bb1ac71578 ("
+  , "  struct struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name3)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+foreign import ccall unsafe "hs_bindgen_df7e2b8e86de411a" hs_bindgen_df7e2b8e86de411a_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+hs_bindgen_df7e2b8e86de411a ::
+     BG.CChar
+  -> TC
+  -> IO BG.CChar
+hs_bindgen_df7e2b8e86de411a =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_df7e2b8e86de411a_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> TC
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux1 = hs_bindgen_df7e2b8e86de411a
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+foreign import ccall unsafe "hs_bindgen_6f0b13ed02b696df" hs_bindgen_6f0b13ed02b696df_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+hs_bindgen_6f0b13ed02b696df ::
+     BG.CChar
+  -> BG.CChar
+  -> IO TC
+hs_bindgen_6f0b13ed02b696df =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6f0b13ed02b696df_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO TC
+quux2 = hs_bindgen_6f0b13ed02b696df
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+foreign import ccall unsafe "hs_bindgen_f92059cc98dde342" hs_bindgen_f92059cc98dde342_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+hs_bindgen_f92059cc98dde342 ::
+     BG.CFloat
+  -> BG.Ptr TC
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_f92059cc98dde342 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_f92059cc98dde342_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr TC
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr BG.CChar)
+wam1 = hs_bindgen_f92059cc98dde342
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+foreign import ccall unsafe "hs_bindgen_3e6ecd1b2cc616bc" hs_bindgen_3e6ecd1b2cc616bc_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+hs_bindgen_3e6ecd1b2cc616bc ::
+     BG.CFloat
+  -> BG.Ptr BG.CChar
+  -> IO (BG.Ptr TC)
+hs_bindgen_3e6ecd1b2cc616bc =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_3e6ecd1b2cc616bc_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr TC)
+wam2 = hs_bindgen_3e6ecd1b2cc616bc
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_ffa9d5a3e8f0f221" hs_bindgen_ffa9d5a3e8f0f221_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+hs_bindgen_ffa9d5a3e8f0f221 ::
+     BG.Ptr Struct2
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_ffa9d5a3e8f0f221 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ffa9d5a3e8f0f221_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1 ::
+     BG.Ptr Struct2
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef1 = hs_bindgen_ffa9d5a3e8f0f221
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_4801667560542114" hs_bindgen_4801667560542114_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+hs_bindgen_4801667560542114 ::
+     BG.Ptr Struct3_t
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_4801667560542114 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4801667560542114_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2 ::
+     BG.Ptr Struct3_t
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef2 = hs_bindgen_4801667560542114
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_04fa5bbd479146eb" hs_bindgen_04fa5bbd479146eb_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+hs_bindgen_04fa5bbd479146eb ::
+     BG.Ptr Struct4
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_04fa5bbd479146eb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_04fa5bbd479146eb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef3 = hs_bindgen_04fa5bbd479146eb
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+foreign import ccall unsafe "hs_bindgen_08025fd0bd589ac2" hs_bindgen_08025fd0bd589ac2_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+hs_bindgen_08025fd0bd589ac2 ::
+     BG.Ptr Struct1
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_08025fd0bd589ac2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_08025fd0bd589ac2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1 ::
+     BG.Ptr Struct1
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name1 = hs_bindgen_08025fd0bd589ac2
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+foreign import ccall unsafe "hs_bindgen_9de286608f952fc7" hs_bindgen_9de286608f952fc7_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+hs_bindgen_9de286608f952fc7 ::
+     BG.Ptr Struct3
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_9de286608f952fc7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9de286608f952fc7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2 ::
+     BG.Ptr Struct3
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name2 = hs_bindgen_9de286608f952fc7
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+foreign import ccall unsafe "hs_bindgen_38cce6bb1ac71578" hs_bindgen_38cce6bb1ac71578_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+hs_bindgen_38cce6bb1ac71578 ::
+     BG.Ptr Struct4
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_38cce6bb1ac71578 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_38cce6bb1ac71578_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name3 = hs_bindgen_38cce6bb1ac71578
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/bindingspec.yaml
@@ -0,0 +1,158 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: TC
+  hsname: TC
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct1
+  hsname: Struct1
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct2
+  hsname: Struct2
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct2
+  hsname: Struct2
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct3
+  hsname: Struct3
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct3_t
+  hsname: Struct3_t
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct4
+  hsname: Struct4
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct4
+  hsname: Struct4
+hstypes:
+- hsname: Struct1
+  representation:
+    record:
+      constructor: Struct1
+      fields:
+      - struct1_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct2
+  representation:
+    record:
+      constructor: Struct2
+      fields:
+      - struct2_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct3
+  representation:
+    record:
+      constructor: Struct3
+      fields:
+      - struct3_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct3_t
+  representation:
+    newtype:
+      constructor: Struct3_t
+      fields:
+      - unwrapStruct3_t
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct4
+  representation:
+    record:
+      constructor: Struct4
+      fields:
+      - struct4_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TC
+  representation:
+    newtype:
+      constructor: TC
+      fields:
+      - unwrapTC
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.1.empty/th.txt
@@ -0,0 +1,1105 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_in_fundecl_vs_typedef.h
+-- #include <macros/macro_in_fundecl_vs_typedef.h>
+-- char hs_bindgen_02e0e3b28d470fd4 (
+--   char arg1,
+--   TC arg2
+-- )
+-- {
+--   return (quux1)(arg1, arg2);
+-- }
+-- TC hs_bindgen_bb79188c8775e2e4 (
+--   char arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux2)(arg1, arg2);
+-- }
+-- char *hs_bindgen_a398fb73645271c5 (
+--   float arg1,
+--   TC *arg2
+-- )
+-- {
+--   return (wam1)(arg1, arg2);
+-- }
+-- TC *hs_bindgen_ad904da072e0711e (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return (wam2)(arg1, arg2);
+-- }
+-- void hs_bindgen_88e976dc10571000 (
+--   struct2 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef1)(arg1, arg2);
+-- }
+-- void hs_bindgen_edb3806d45d7605b (
+--   struct3_t *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef2)(arg1, arg2);
+-- }
+-- void hs_bindgen_7c7f3ab0dd790fe8 (
+--   struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef3)(arg1, arg2);
+-- }
+-- void hs_bindgen_2cfbb4f5834d4bcb (
+--   struct struct1 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name1)(arg1, arg2);
+-- }
+-- void hs_bindgen_c8b765fa70f95167 (
+--   struct struct3 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name2)(arg1, arg2);
+-- }
+-- void hs_bindgen_0ff3632971f092bb (
+--   struct struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name3)(arg1, arg2);
+-- }
+-- char hs_bindgen_df7e2b8e86de411a (
+--   char arg1,
+--   TC arg2
+-- )
+-- {
+--   return (quux1)(arg1, arg2);
+-- }
+-- TC hs_bindgen_6f0b13ed02b696df (
+--   char arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux2)(arg1, arg2);
+-- }
+-- char *hs_bindgen_f92059cc98dde342 (
+--   float arg1,
+--   TC *arg2
+-- )
+-- {
+--   return (wam1)(arg1, arg2);
+-- }
+-- TC *hs_bindgen_3e6ecd1b2cc616bc (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return (wam2)(arg1, arg2);
+-- }
+-- void hs_bindgen_ffa9d5a3e8f0f221 (
+--   struct2 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef1)(arg1, arg2);
+-- }
+-- void hs_bindgen_4801667560542114 (
+--   struct3_t *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef2)(arg1, arg2);
+-- }
+-- void hs_bindgen_04fa5bbd479146eb (
+--   struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef3)(arg1, arg2);
+-- }
+-- void hs_bindgen_08025fd0bd589ac2 (
+--   struct struct1 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name1)(arg1, arg2);
+-- }
+-- void hs_bindgen_9de286608f952fc7 (
+--   struct struct3 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name2)(arg1, arg2);
+-- }
+-- void hs_bindgen_38cce6bb1ac71578 (
+--   struct struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name3)(arg1, arg2);
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1 */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_8c77c87c8985f5b4 (void)) (
+--   char arg1,
+--   TC arg2
+-- )
+-- {
+--   return &quux1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2 */
+-- __attribute__ ((const))
+-- TC (*hs_bindgen_ad1c057fd2e38491 (void)) (
+--   char arg1,
+--   char arg2
+-- )
+-- {
+--   return &quux2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_05b0ef45be2bc377 (void)) (
+--   float arg1,
+--   TC *arg2
+-- )
+-- {
+--   return &wam1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2 */
+-- __attribute__ ((const))
+-- TC *(*hs_bindgen_cd643a7a3c18ccf6 (void)) (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return &wam2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0322539d81aee229 (void)) (
+--   struct2 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_typedef1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8522498cba39ada6 (void)) (
+--   struct3_t *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_typedef2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e19fc7f7dee46424 (void)) (
+--   struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_typedef3;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_00f81edda453ec64 (void)) (
+--   struct struct1 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_name1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8f4de3d502f3466d (void)) (
+--   struct struct3 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_name2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ba133ae0ff062248 (void)) (
+--   struct struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_name3;
+-- }
+{-| __C declaration:__ @TC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 5:14@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype TC
+    = TC {unwrapTC :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapTC" TC ty
+    where hasField = \x_0 -> (\y_1 -> TC{unwrapTC = y_1},
+                              getField @"unwrapTC" x_0)
+instance (~) ty CChar => HasField "unwrapTC" (Ptr TC) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTC")
+instance HasCField TC "unwrapTC"
+    where type CFieldType TC "unwrapTC" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct1
+    = Struct1 {struct1_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct1
+    where readRaw = \ptr_0 -> pure Struct1 <*> readRaw (Proxy @"struct1_a") ptr_0
+instance WriteRaw Struct1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct1 struct1_a_2 -> writeRaw (Proxy @"struct1_a") ptr_0 struct1_a_2
+deriving via (EquivStorable Struct1) instance Storable Struct1
+deriving via (IsStructViaReadRaw Struct1) instance IsStruct Struct1
+instance (~) ty CInt => HasField "struct1_a" Struct1 ty
+    where hasField = \x_0 -> (\y_1 -> Struct1{struct1_a = y_1},
+                              getField @"struct1_a" x_0)
+instance (~) ty CInt => HasField "struct1_a" (Ptr Struct1) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct1_a")
+instance HasCField Struct1 "struct1_a"
+    where type CFieldType Struct1 "struct1_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct2
+    = Struct2 {struct2_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct2
+    where readRaw = \ptr_0 -> pure Struct2 <*> readRaw (Proxy @"struct2_a") ptr_0
+instance WriteRaw Struct2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct2 struct2_a_2 -> writeRaw (Proxy @"struct2_a") ptr_0 struct2_a_2
+deriving via (EquivStorable Struct2) instance Storable Struct2
+deriving via (IsStructViaReadRaw Struct2) instance IsStruct Struct2
+instance (~) ty CInt => HasField "struct2_a" Struct2 ty
+    where hasField = \x_0 -> (\y_1 -> Struct2{struct2_a = y_1},
+                              getField @"struct2_a" x_0)
+instance (~) ty CInt => HasField "struct2_a" (Ptr Struct2) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct2_a")
+instance HasCField Struct2 "struct2_a"
+    where type CFieldType Struct2 "struct2_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct3
+    = Struct3 {struct3_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct3
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct3
+    where readRaw = \ptr_0 -> pure Struct3 <*> readRaw (Proxy @"struct3_a") ptr_0
+instance WriteRaw Struct3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct3 struct3_a_2 -> writeRaw (Proxy @"struct3_a") ptr_0 struct3_a_2
+deriving via (EquivStorable Struct3) instance Storable Struct3
+deriving via (IsStructViaReadRaw Struct3) instance IsStruct Struct3
+instance (~) ty CInt => HasField "struct3_a" Struct3 ty
+    where hasField = \x_0 -> (\y_1 -> Struct3{struct3_a = y_1},
+                              getField @"struct3_a" x_0)
+instance (~) ty CInt => HasField "struct3_a" (Ptr Struct3) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct3_a")
+instance HasCField Struct3 "struct3_a"
+    where type CFieldType Struct3 "struct3_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct3_t@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:35@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype Struct3_t
+    = Struct3_t {unwrapStruct3_t :: Struct3}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty Struct3 => HasField "unwrapStruct3_t" Struct3_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct3_t{unwrapStruct3_t = y_1},
+                              getField @"unwrapStruct3_t" x_0)
+instance (~) ty Struct3 =>
+         HasField "unwrapStruct3_t" (Ptr Struct3_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct3_t")
+instance HasCField Struct3_t "unwrapStruct3_t"
+    where type CFieldType Struct3_t "unwrapStruct3_t" = Struct3
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct4
+    = Struct4 {struct4_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct4
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct4
+    where readRaw = \ptr_0 -> pure Struct4 <*> readRaw (Proxy @"struct4_a") ptr_0
+instance WriteRaw Struct4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct4 struct4_a_2 -> writeRaw (Proxy @"struct4_a") ptr_0 struct4_a_2
+deriving via (EquivStorable Struct4) instance Storable Struct4
+deriving via (IsStructViaReadRaw Struct4) instance IsStruct Struct4
+instance (~) ty CInt => HasField "struct4_a" Struct4 ty
+    where hasField = \x_0 -> (\y_1 -> Struct4{struct4_a = y_1},
+                              getField @"struct4_a" x_0)
+instance (~) ty CInt => HasField "struct4_a" (Ptr Struct4) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct4_a")
+instance HasCField Struct4 "struct4_a"
+    where type CFieldType Struct4 "struct4_a" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+foreign import ccall safe "hs_bindgen_02e0e3b28d470fd4" hs_bindgen_02e0e3b28d470fd4_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+hs_bindgen_02e0e3b28d470fd4 :: CChar -> TC -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+hs_bindgen_02e0e3b28d470fd4 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_02e0e3b28d470fd4_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_safe :: CChar -> TC -> IO CChar
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_safe = hs_bindgen_02e0e3b28d470fd4
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+foreign import ccall safe "hs_bindgen_bb79188c8775e2e4" hs_bindgen_bb79188c8775e2e4_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+hs_bindgen_bb79188c8775e2e4 :: CChar -> CChar -> IO TC
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+hs_bindgen_bb79188c8775e2e4 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_bb79188c8775e2e4_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_safe :: CChar -> CChar -> IO TC
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_safe = hs_bindgen_bb79188c8775e2e4
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+foreign import ccall safe "hs_bindgen_a398fb73645271c5" hs_bindgen_a398fb73645271c5_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+hs_bindgen_a398fb73645271c5 :: CFloat -> Ptr TC -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+hs_bindgen_a398fb73645271c5 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_a398fb73645271c5_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_safe :: CFloat -> Ptr TC -> IO (Ptr CChar)
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_safe = hs_bindgen_a398fb73645271c5
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+foreign import ccall safe "hs_bindgen_ad904da072e0711e" hs_bindgen_ad904da072e0711e_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+hs_bindgen_ad904da072e0711e :: CFloat -> Ptr CChar -> IO (Ptr TC)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+hs_bindgen_ad904da072e0711e = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_ad904da072e0711e_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_safe :: CFloat -> Ptr CChar -> IO (Ptr TC)
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_safe = hs_bindgen_ad904da072e0711e
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+foreign import ccall safe "hs_bindgen_88e976dc10571000" hs_bindgen_88e976dc10571000_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+hs_bindgen_88e976dc10571000 :: Ptr Struct2 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+hs_bindgen_88e976dc10571000 = \x_0 -> \x_1 -> hs_bindgen_88e976dc10571000_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_safe :: Ptr Struct2 -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_safe = hs_bindgen_88e976dc10571000
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+foreign import ccall safe "hs_bindgen_edb3806d45d7605b" hs_bindgen_edb3806d45d7605b_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+hs_bindgen_edb3806d45d7605b :: Ptr Struct3_t -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+hs_bindgen_edb3806d45d7605b = \x_0 -> \x_1 -> hs_bindgen_edb3806d45d7605b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_safe :: Ptr Struct3_t -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_safe = hs_bindgen_edb3806d45d7605b
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+foreign import ccall safe "hs_bindgen_7c7f3ab0dd790fe8" hs_bindgen_7c7f3ab0dd790fe8_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+hs_bindgen_7c7f3ab0dd790fe8 :: Ptr Struct4 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+hs_bindgen_7c7f3ab0dd790fe8 = \x_0 -> \x_1 -> hs_bindgen_7c7f3ab0dd790fe8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_safe :: Ptr Struct4 -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_safe = hs_bindgen_7c7f3ab0dd790fe8
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+foreign import ccall safe "hs_bindgen_2cfbb4f5834d4bcb" hs_bindgen_2cfbb4f5834d4bcb_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+hs_bindgen_2cfbb4f5834d4bcb :: Ptr Struct1 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+hs_bindgen_2cfbb4f5834d4bcb = \x_0 -> \x_1 -> hs_bindgen_2cfbb4f5834d4bcb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_safe :: Ptr Struct1 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_safe = hs_bindgen_2cfbb4f5834d4bcb
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+foreign import ccall safe "hs_bindgen_c8b765fa70f95167" hs_bindgen_c8b765fa70f95167_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+hs_bindgen_c8b765fa70f95167 :: Ptr Struct3 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+hs_bindgen_c8b765fa70f95167 = \x_0 -> \x_1 -> hs_bindgen_c8b765fa70f95167_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_safe :: Ptr Struct3 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_safe = hs_bindgen_c8b765fa70f95167
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+foreign import ccall safe "hs_bindgen_0ff3632971f092bb" hs_bindgen_0ff3632971f092bb_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+hs_bindgen_0ff3632971f092bb :: Ptr Struct4 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+hs_bindgen_0ff3632971f092bb = \x_0 -> \x_1 -> hs_bindgen_0ff3632971f092bb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_safe :: Ptr Struct4 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_safe = hs_bindgen_0ff3632971f092bb
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+foreign import ccall unsafe "hs_bindgen_df7e2b8e86de411a" hs_bindgen_df7e2b8e86de411a_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+hs_bindgen_df7e2b8e86de411a :: CChar -> TC -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+hs_bindgen_df7e2b8e86de411a = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_df7e2b8e86de411a_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_unsafe :: CChar -> TC -> IO CChar
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_unsafe = hs_bindgen_df7e2b8e86de411a
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+foreign import ccall unsafe "hs_bindgen_6f0b13ed02b696df" hs_bindgen_6f0b13ed02b696df_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+hs_bindgen_6f0b13ed02b696df :: CChar -> CChar -> IO TC
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+hs_bindgen_6f0b13ed02b696df = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_6f0b13ed02b696df_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_unsafe :: CChar -> CChar -> IO TC
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_unsafe = hs_bindgen_6f0b13ed02b696df
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+foreign import ccall unsafe "hs_bindgen_f92059cc98dde342" hs_bindgen_f92059cc98dde342_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+hs_bindgen_f92059cc98dde342 :: CFloat -> Ptr TC -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+hs_bindgen_f92059cc98dde342 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_f92059cc98dde342_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_unsafe :: CFloat -> Ptr TC -> IO (Ptr CChar)
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_unsafe = hs_bindgen_f92059cc98dde342
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+foreign import ccall unsafe "hs_bindgen_3e6ecd1b2cc616bc" hs_bindgen_3e6ecd1b2cc616bc_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+hs_bindgen_3e6ecd1b2cc616bc :: CFloat -> Ptr CChar -> IO (Ptr TC)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+hs_bindgen_3e6ecd1b2cc616bc = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_3e6ecd1b2cc616bc_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_unsafe :: CFloat -> Ptr CChar -> IO (Ptr TC)
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_unsafe = hs_bindgen_3e6ecd1b2cc616bc
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_ffa9d5a3e8f0f221" hs_bindgen_ffa9d5a3e8f0f221_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+hs_bindgen_ffa9d5a3e8f0f221 :: Ptr Struct2 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+hs_bindgen_ffa9d5a3e8f0f221 = \x_0 -> \x_1 -> hs_bindgen_ffa9d5a3e8f0f221_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_unsafe :: Ptr Struct2 -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_unsafe = hs_bindgen_ffa9d5a3e8f0f221
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_4801667560542114" hs_bindgen_4801667560542114_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+hs_bindgen_4801667560542114 :: Ptr Struct3_t -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+hs_bindgen_4801667560542114 = \x_0 -> \x_1 -> hs_bindgen_4801667560542114_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_unsafe :: Ptr Struct3_t -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_unsafe = hs_bindgen_4801667560542114
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_04fa5bbd479146eb" hs_bindgen_04fa5bbd479146eb_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+hs_bindgen_04fa5bbd479146eb :: Ptr Struct4 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+hs_bindgen_04fa5bbd479146eb = \x_0 -> \x_1 -> hs_bindgen_04fa5bbd479146eb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_unsafe :: Ptr Struct4 -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_unsafe = hs_bindgen_04fa5bbd479146eb
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+foreign import ccall unsafe "hs_bindgen_08025fd0bd589ac2" hs_bindgen_08025fd0bd589ac2_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+hs_bindgen_08025fd0bd589ac2 :: Ptr Struct1 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+hs_bindgen_08025fd0bd589ac2 = \x_0 -> \x_1 -> hs_bindgen_08025fd0bd589ac2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_unsafe :: Ptr Struct1 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_unsafe = hs_bindgen_08025fd0bd589ac2
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+foreign import ccall unsafe "hs_bindgen_9de286608f952fc7" hs_bindgen_9de286608f952fc7_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+hs_bindgen_9de286608f952fc7 :: Ptr Struct3 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+hs_bindgen_9de286608f952fc7 = \x_0 -> \x_1 -> hs_bindgen_9de286608f952fc7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_unsafe :: Ptr Struct3 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_unsafe = hs_bindgen_9de286608f952fc7
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+foreign import ccall unsafe "hs_bindgen_38cce6bb1ac71578" hs_bindgen_38cce6bb1ac71578_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+hs_bindgen_38cce6bb1ac71578 :: Ptr Struct4 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+hs_bindgen_38cce6bb1ac71578 = \x_0 -> \x_1 -> hs_bindgen_38cce6bb1ac71578_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_unsafe :: Ptr Struct4 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_unsafe = hs_bindgen_38cce6bb1ac71578
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+foreign import ccall unsafe "hs_bindgen_8c77c87c8985f5b4" hs_bindgen_8c77c87c8985f5b4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+hs_bindgen_8c77c87c8985f5b4 :: IO (FunPtr (CChar ->
+                                           TC -> IO CChar))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+hs_bindgen_8c77c87c8985f5b4 = fmap fromFFIType hs_bindgen_8c77c87c8985f5b4_base
+{-# NOINLINE quux1_funptr #-}
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_funptr :: FunPtr (CChar -> TC -> IO CChar)
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_funptr = unsafePerformIO hs_bindgen_8c77c87c8985f5b4
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+foreign import ccall unsafe "hs_bindgen_ad1c057fd2e38491" hs_bindgen_ad1c057fd2e38491_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+hs_bindgen_ad1c057fd2e38491 :: IO (FunPtr (CChar ->
+                                           CChar -> IO TC))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+hs_bindgen_ad1c057fd2e38491 = fmap fromFFIType hs_bindgen_ad1c057fd2e38491_base
+{-# NOINLINE quux2_funptr #-}
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_funptr :: FunPtr (CChar -> CChar -> IO TC)
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_funptr = unsafePerformIO hs_bindgen_ad1c057fd2e38491
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+foreign import ccall unsafe "hs_bindgen_05b0ef45be2bc377" hs_bindgen_05b0ef45be2bc377_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+hs_bindgen_05b0ef45be2bc377 :: IO (FunPtr (CFloat ->
+                                           Ptr TC -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+hs_bindgen_05b0ef45be2bc377 = fmap fromFFIType hs_bindgen_05b0ef45be2bc377_base
+{-# NOINLINE wam1_funptr #-}
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_funptr :: FunPtr (CFloat -> Ptr TC -> IO (Ptr CChar))
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_funptr = unsafePerformIO hs_bindgen_05b0ef45be2bc377
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+foreign import ccall unsafe "hs_bindgen_cd643a7a3c18ccf6" hs_bindgen_cd643a7a3c18ccf6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+hs_bindgen_cd643a7a3c18ccf6 :: IO (FunPtr (CFloat ->
+                                           Ptr CChar -> IO (Ptr TC)))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+hs_bindgen_cd643a7a3c18ccf6 = fmap fromFFIType hs_bindgen_cd643a7a3c18ccf6_base
+{-# NOINLINE wam2_funptr #-}
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_funptr :: FunPtr (CFloat -> Ptr CChar -> IO (Ptr TC))
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_funptr = unsafePerformIO hs_bindgen_cd643a7a3c18ccf6
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_0322539d81aee229" hs_bindgen_0322539d81aee229_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+hs_bindgen_0322539d81aee229 :: IO (FunPtr (Ptr Struct2 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+hs_bindgen_0322539d81aee229 = fmap fromFFIType hs_bindgen_0322539d81aee229_base
+{-# NOINLINE struct_typedef1_funptr #-}
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_funptr :: FunPtr (Ptr Struct2 -> CChar -> IO ())
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_funptr = unsafePerformIO hs_bindgen_0322539d81aee229
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_8522498cba39ada6" hs_bindgen_8522498cba39ada6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+hs_bindgen_8522498cba39ada6 :: IO (FunPtr (Ptr Struct3_t ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+hs_bindgen_8522498cba39ada6 = fmap fromFFIType hs_bindgen_8522498cba39ada6_base
+{-# NOINLINE struct_typedef2_funptr #-}
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_funptr :: FunPtr (Ptr Struct3_t -> CChar -> IO ())
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_funptr = unsafePerformIO hs_bindgen_8522498cba39ada6
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_e19fc7f7dee46424" hs_bindgen_e19fc7f7dee46424_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+hs_bindgen_e19fc7f7dee46424 :: IO (FunPtr (Ptr Struct4 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+hs_bindgen_e19fc7f7dee46424 = fmap fromFFIType hs_bindgen_e19fc7f7dee46424_base
+{-# NOINLINE struct_typedef3_funptr #-}
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_funptr :: FunPtr (Ptr Struct4 -> CChar -> IO ())
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_funptr = unsafePerformIO hs_bindgen_e19fc7f7dee46424
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+foreign import ccall unsafe "hs_bindgen_00f81edda453ec64" hs_bindgen_00f81edda453ec64_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+hs_bindgen_00f81edda453ec64 :: IO (FunPtr (Ptr Struct1 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+hs_bindgen_00f81edda453ec64 = fmap fromFFIType hs_bindgen_00f81edda453ec64_base
+{-# NOINLINE struct_name1_funptr #-}
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_funptr :: FunPtr (Ptr Struct1 -> CChar -> IO ())
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_funptr = unsafePerformIO hs_bindgen_00f81edda453ec64
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+foreign import ccall unsafe "hs_bindgen_8f4de3d502f3466d" hs_bindgen_8f4de3d502f3466d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+hs_bindgen_8f4de3d502f3466d :: IO (FunPtr (Ptr Struct3 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+hs_bindgen_8f4de3d502f3466d = fmap fromFFIType hs_bindgen_8f4de3d502f3466d_base
+{-# NOINLINE struct_name2_funptr #-}
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_funptr :: FunPtr (Ptr Struct3 -> CChar -> IO ())
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_funptr = unsafePerformIO hs_bindgen_8f4de3d502f3466d
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+foreign import ccall unsafe "hs_bindgen_ba133ae0ff062248" hs_bindgen_ba133ae0ff062248_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+hs_bindgen_ba133ae0ff062248 :: IO (FunPtr (Ptr Struct4 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+hs_bindgen_ba133ae0ff062248 = fmap fromFFIType hs_bindgen_ba133ae0ff062248_base
+{-# NOINLINE struct_name3_funptr #-}
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_funptr :: FunPtr (Ptr Struct4 -> CChar -> IO ())
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_funptr = unsafePerformIO hs_bindgen_ba133ae0ff062248
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example.hs
@@ -0,0 +1,398 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.mC
+    , Example.TC(..)
+    , Example.Struct1(..)
+    , Example.Struct2(..)
+    , Example.Struct3(..)
+    , Example.Struct3_t(..)
+    , Example.Struct4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro MC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 4:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+mC :: Macro.Raw String
+mC = Macro.objectLike "MC" ["char"]
+
+{-| __C declaration:__ @TC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 5:14@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype TC = TC
+  { unwrapTC :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "unwrapTC" TC ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TC {unwrapTC = y1}, BG.getField @"unwrapTC" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "unwrapTC" (BG.Ptr TC) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTC")
+
+instance HasCField.HasCField TC "unwrapTC" where
+
+  type CFieldType TC "unwrapTC" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct1 = Struct1
+  { struct1_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct1
+      <*> HasCField.readRaw (BG.Proxy @"struct1_a") ptr0
+
+instance Marshal.WriteRaw Struct1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct1 struct1_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct1_a") ptr0 struct1_a2
+
+deriving via Marshal.EquivStorable Struct1 instance BG.Storable Struct1
+
+deriving via Struct.IsStructViaReadRaw Struct1 instance Struct.IsStruct Struct1
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct1_a" Struct1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct1 {struct1_a = y1}, BG.getField @"struct1_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct1_a" (BG.Ptr Struct1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct1_a")
+
+instance HasCField.HasCField Struct1 "struct1_a" where
+
+  type CFieldType Struct1 "struct1_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct2 = Struct2
+  { struct2_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct2 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct2
+      <*> HasCField.readRaw (BG.Proxy @"struct2_a") ptr0
+
+instance Marshal.WriteRaw Struct2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct2 struct2_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct2_a") ptr0 struct2_a2
+
+deriving via Marshal.EquivStorable Struct2 instance BG.Storable Struct2
+
+deriving via Struct.IsStructViaReadRaw Struct2 instance Struct.IsStruct Struct2
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct2_a" Struct2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct2 {struct2_a = y1}, BG.getField @"struct2_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct2_a" (BG.Ptr Struct2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct2_a")
+
+instance HasCField.HasCField Struct2 "struct2_a" where
+
+  type CFieldType Struct2 "struct2_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct3 = Struct3
+  { struct3_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct3 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct3
+      <*> HasCField.readRaw (BG.Proxy @"struct3_a") ptr0
+
+instance Marshal.WriteRaw Struct3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct3 struct3_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct3_a") ptr0 struct3_a2
+
+deriving via Marshal.EquivStorable Struct3 instance BG.Storable Struct3
+
+deriving via Struct.IsStructViaReadRaw Struct3 instance Struct.IsStruct Struct3
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct3_a" Struct3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct3 {struct3_a = y1}, BG.getField @"struct3_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct3_a" (BG.Ptr Struct3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct3_a")
+
+instance HasCField.HasCField Struct3 "struct3_a" where
+
+  type CFieldType Struct3 "struct3_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct3_t@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:35@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype Struct3_t = Struct3_t
+  { unwrapStruct3_t :: Struct3
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Struct3
+         ) => BG.CompatHasField.HasField "unwrapStruct3_t" Struct3_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct3_t {unwrapStruct3_t = y1}, BG.getField @"unwrapStruct3_t" x0)
+
+instance ( ty ~ Struct3
+         ) => BG.HasField "unwrapStruct3_t" (BG.Ptr Struct3_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct3_t")
+
+instance HasCField.HasCField Struct3_t "unwrapStruct3_t" where
+
+  type CFieldType Struct3_t "unwrapStruct3_t" = Struct3
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct4 = Struct4
+  { struct4_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct4 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct4 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct4
+      <*> HasCField.readRaw (BG.Proxy @"struct4_a") ptr0
+
+instance Marshal.WriteRaw Struct4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct4 struct4_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct4_a") ptr0 struct4_a2
+
+deriving via Marshal.EquivStorable Struct4 instance BG.Storable Struct4
+
+deriving via Struct.IsStructViaReadRaw Struct4 instance Struct.IsStruct Struct4
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct4_a" Struct4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct4 {struct4_a = y1}, BG.getField @"struct4_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct4_a" (BG.Ptr Struct4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct4_a")
+
+instance HasCField.HasCField Struct4 "struct4_a" where
+
+  type CFieldType Struct4 "struct4_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example/FunPtr.hs
@@ -0,0 +1,315 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.quux1
+    , Example.FunPtr.quux2
+    , Example.FunPtr.wam1
+    , Example.FunPtr.wam2
+    , Example.FunPtr.struct_typedef1
+    , Example.FunPtr.struct_typedef2
+    , Example.FunPtr.struct_typedef3
+    , Example.FunPtr.struct_name1
+    , Example.FunPtr.struct_name2
+    , Example.FunPtr.struct_name3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl_vs_typedef.h>"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1 */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_8c77c87c8985f5b4 (void)) ("
+  , "  char arg1,"
+  , "  TC arg2"
+  , ")"
+  , "{"
+  , "  return &quux1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2 */"
+  , "__attribute__ ((const))"
+  , "TC (*hs_bindgen_ad1c057fd2e38491 (void)) ("
+  , "  char arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &quux2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1 */"
+  , "__attribute__ ((const))"
+  , "char *(*hs_bindgen_05b0ef45be2bc377 (void)) ("
+  , "  float arg1,"
+  , "  TC *arg2"
+  , ")"
+  , "{"
+  , "  return &wam1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2 */"
+  , "__attribute__ ((const))"
+  , "TC *(*hs_bindgen_cd643a7a3c18ccf6 (void)) ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return &wam2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0322539d81aee229 (void)) ("
+  , "  struct2 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_typedef1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8522498cba39ada6 (void)) ("
+  , "  struct3_t *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_typedef2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e19fc7f7dee46424 (void)) ("
+  , "  struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_typedef3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_00f81edda453ec64 (void)) ("
+  , "  struct struct1 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_name1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8f4de3d502f3466d (void)) ("
+  , "  struct struct3 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_name2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ba133ae0ff062248 (void)) ("
+  , "  struct struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &struct_name3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+foreign import ccall unsafe "hs_bindgen_8c77c87c8985f5b4" hs_bindgen_8c77c87c8985f5b4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+hs_bindgen_8c77c87c8985f5b4 :: IO (BG.FunPtr (BG.CChar -> TC -> IO BG.CChar))
+hs_bindgen_8c77c87c8985f5b4 =
+  fmap BG.fromFFIType hs_bindgen_8c77c87c8985f5b4_base
+
+{-# NOINLINE quux1 #-}
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1 :: BG.FunPtr (BG.CChar -> TC -> IO BG.CChar)
+quux1 =
+  BG.unsafePerformIO hs_bindgen_8c77c87c8985f5b4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+foreign import ccall unsafe "hs_bindgen_ad1c057fd2e38491" hs_bindgen_ad1c057fd2e38491_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+hs_bindgen_ad1c057fd2e38491 :: IO (BG.FunPtr (BG.CChar -> BG.CChar -> IO TC))
+hs_bindgen_ad1c057fd2e38491 =
+  fmap BG.fromFFIType hs_bindgen_ad1c057fd2e38491_base
+
+{-# NOINLINE quux2 #-}
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2 :: BG.FunPtr (BG.CChar -> BG.CChar -> IO TC)
+quux2 =
+  BG.unsafePerformIO hs_bindgen_ad1c057fd2e38491
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+foreign import ccall unsafe "hs_bindgen_05b0ef45be2bc377" hs_bindgen_05b0ef45be2bc377_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+hs_bindgen_05b0ef45be2bc377 :: IO (BG.FunPtr (BG.CFloat -> BG.Ptr TC -> IO (BG.Ptr BG.CChar)))
+hs_bindgen_05b0ef45be2bc377 =
+  fmap BG.fromFFIType hs_bindgen_05b0ef45be2bc377_base
+
+{-# NOINLINE wam1 #-}
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1 :: BG.FunPtr (BG.CFloat -> BG.Ptr TC -> IO (BG.Ptr BG.CChar))
+wam1 = BG.unsafePerformIO hs_bindgen_05b0ef45be2bc377
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+foreign import ccall unsafe "hs_bindgen_cd643a7a3c18ccf6" hs_bindgen_cd643a7a3c18ccf6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+hs_bindgen_cd643a7a3c18ccf6 :: IO (BG.FunPtr (BG.CFloat -> BG.Ptr BG.CChar -> IO (BG.Ptr TC)))
+hs_bindgen_cd643a7a3c18ccf6 =
+  fmap BG.fromFFIType hs_bindgen_cd643a7a3c18ccf6_base
+
+{-# NOINLINE wam2 #-}
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2 :: BG.FunPtr (BG.CFloat -> BG.Ptr BG.CChar -> IO (BG.Ptr TC))
+wam2 = BG.unsafePerformIO hs_bindgen_cd643a7a3c18ccf6
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_0322539d81aee229" hs_bindgen_0322539d81aee229_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+hs_bindgen_0322539d81aee229 :: IO (BG.FunPtr (BG.Ptr Struct2 -> BG.CChar -> IO ()))
+hs_bindgen_0322539d81aee229 =
+  fmap BG.fromFFIType hs_bindgen_0322539d81aee229_base
+
+{-# NOINLINE struct_typedef1 #-}
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1 :: BG.FunPtr (BG.Ptr Struct2 -> BG.CChar -> IO ())
+struct_typedef1 =
+  BG.unsafePerformIO hs_bindgen_0322539d81aee229
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_8522498cba39ada6" hs_bindgen_8522498cba39ada6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+hs_bindgen_8522498cba39ada6 :: IO (BG.FunPtr (BG.Ptr Struct3_t -> BG.CChar -> IO ()))
+hs_bindgen_8522498cba39ada6 =
+  fmap BG.fromFFIType hs_bindgen_8522498cba39ada6_base
+
+{-# NOINLINE struct_typedef2 #-}
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2 :: BG.FunPtr (BG.Ptr Struct3_t -> BG.CChar -> IO ())
+struct_typedef2 =
+  BG.unsafePerformIO hs_bindgen_8522498cba39ada6
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_e19fc7f7dee46424" hs_bindgen_e19fc7f7dee46424_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+hs_bindgen_e19fc7f7dee46424 :: IO (BG.FunPtr (BG.Ptr Struct4 -> BG.CChar -> IO ()))
+hs_bindgen_e19fc7f7dee46424 =
+  fmap BG.fromFFIType hs_bindgen_e19fc7f7dee46424_base
+
+{-# NOINLINE struct_typedef3 #-}
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3 :: BG.FunPtr (BG.Ptr Struct4 -> BG.CChar -> IO ())
+struct_typedef3 =
+  BG.unsafePerformIO hs_bindgen_e19fc7f7dee46424
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+foreign import ccall unsafe "hs_bindgen_00f81edda453ec64" hs_bindgen_00f81edda453ec64_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+hs_bindgen_00f81edda453ec64 :: IO (BG.FunPtr (BG.Ptr Struct1 -> BG.CChar -> IO ()))
+hs_bindgen_00f81edda453ec64 =
+  fmap BG.fromFFIType hs_bindgen_00f81edda453ec64_base
+
+{-# NOINLINE struct_name1 #-}
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1 :: BG.FunPtr (BG.Ptr Struct1 -> BG.CChar -> IO ())
+struct_name1 =
+  BG.unsafePerformIO hs_bindgen_00f81edda453ec64
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+foreign import ccall unsafe "hs_bindgen_8f4de3d502f3466d" hs_bindgen_8f4de3d502f3466d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+hs_bindgen_8f4de3d502f3466d :: IO (BG.FunPtr (BG.Ptr Struct3 -> BG.CChar -> IO ()))
+hs_bindgen_8f4de3d502f3466d =
+  fmap BG.fromFFIType hs_bindgen_8f4de3d502f3466d_base
+
+{-# NOINLINE struct_name2 #-}
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2 :: BG.FunPtr (BG.Ptr Struct3 -> BG.CChar -> IO ())
+struct_name2 =
+  BG.unsafePerformIO hs_bindgen_8f4de3d502f3466d
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+foreign import ccall unsafe "hs_bindgen_ba133ae0ff062248" hs_bindgen_ba133ae0ff062248_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+hs_bindgen_ba133ae0ff062248 :: IO (BG.FunPtr (BG.Ptr Struct4 -> BG.CChar -> IO ()))
+hs_bindgen_ba133ae0ff062248 =
+  fmap BG.fromFFIType hs_bindgen_ba133ae0ff062248_base
+
+{-# NOINLINE struct_name3 #-}
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3 :: BG.FunPtr (BG.Ptr Struct4 -> BG.CChar -> IO ())
+struct_name3 =
+  BG.unsafePerformIO hs_bindgen_ba133ae0ff062248
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example/Safe.hs
@@ -0,0 +1,397 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.quux1
+    , Example.Safe.quux2
+    , Example.Safe.wam1
+    , Example.Safe.wam2
+    , Example.Safe.struct_typedef1
+    , Example.Safe.struct_typedef2
+    , Example.Safe.struct_typedef3
+    , Example.Safe.struct_name1
+    , Example.Safe.struct_name2
+    , Example.Safe.struct_name3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl_vs_typedef.h>"
+  , "char hs_bindgen_02e0e3b28d470fd4 ("
+  , "  char arg1,"
+  , "  TC arg2"
+  , ")"
+  , "{"
+  , "  return (quux1)(arg1, arg2);"
+  , "}"
+  , "TC hs_bindgen_bb79188c8775e2e4 ("
+  , "  char arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux2)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_a398fb73645271c5 ("
+  , "  float arg1,"
+  , "  TC *arg2"
+  , ")"
+  , "{"
+  , "  return (wam1)(arg1, arg2);"
+  , "}"
+  , "TC *hs_bindgen_ad904da072e0711e ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (wam2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_88e976dc10571000 ("
+  , "  struct2 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_edb3806d45d7605b ("
+  , "  struct3_t *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7c7f3ab0dd790fe8 ("
+  , "  struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2cfbb4f5834d4bcb ("
+  , "  struct struct1 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c8b765fa70f95167 ("
+  , "  struct struct3 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0ff3632971f092bb ("
+  , "  struct struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name3)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+foreign import ccall safe "hs_bindgen_02e0e3b28d470fd4" hs_bindgen_02e0e3b28d470fd4_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+hs_bindgen_02e0e3b28d470fd4 ::
+     BG.CChar
+  -> TC
+  -> IO BG.CChar
+hs_bindgen_02e0e3b28d470fd4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_02e0e3b28d470fd4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> TC
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux1 = hs_bindgen_02e0e3b28d470fd4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+foreign import ccall safe "hs_bindgen_bb79188c8775e2e4" hs_bindgen_bb79188c8775e2e4_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+hs_bindgen_bb79188c8775e2e4 ::
+     BG.CChar
+  -> BG.CChar
+  -> IO TC
+hs_bindgen_bb79188c8775e2e4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_bb79188c8775e2e4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO TC
+quux2 = hs_bindgen_bb79188c8775e2e4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+foreign import ccall safe "hs_bindgen_a398fb73645271c5" hs_bindgen_a398fb73645271c5_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+hs_bindgen_a398fb73645271c5 ::
+     BG.CFloat
+  -> BG.Ptr TC
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_a398fb73645271c5 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a398fb73645271c5_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr TC
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr BG.CChar)
+wam1 = hs_bindgen_a398fb73645271c5
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+foreign import ccall safe "hs_bindgen_ad904da072e0711e" hs_bindgen_ad904da072e0711e_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+hs_bindgen_ad904da072e0711e ::
+     BG.CFloat
+  -> BG.Ptr BG.CChar
+  -> IO (BG.Ptr TC)
+hs_bindgen_ad904da072e0711e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ad904da072e0711e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr TC)
+wam2 = hs_bindgen_ad904da072e0711e
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+foreign import ccall safe "hs_bindgen_88e976dc10571000" hs_bindgen_88e976dc10571000_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+hs_bindgen_88e976dc10571000 ::
+     BG.Ptr Struct2
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_88e976dc10571000 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_88e976dc10571000_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1 ::
+     BG.Ptr Struct2
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef1 = hs_bindgen_88e976dc10571000
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+foreign import ccall safe "hs_bindgen_edb3806d45d7605b" hs_bindgen_edb3806d45d7605b_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+hs_bindgen_edb3806d45d7605b ::
+     BG.Ptr Struct3_t
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_edb3806d45d7605b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_edb3806d45d7605b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2 ::
+     BG.Ptr Struct3_t
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef2 = hs_bindgen_edb3806d45d7605b
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+foreign import ccall safe "hs_bindgen_7c7f3ab0dd790fe8" hs_bindgen_7c7f3ab0dd790fe8_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+hs_bindgen_7c7f3ab0dd790fe8 ::
+     BG.Ptr Struct4
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_7c7f3ab0dd790fe8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7c7f3ab0dd790fe8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef3 = hs_bindgen_7c7f3ab0dd790fe8
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+foreign import ccall safe "hs_bindgen_2cfbb4f5834d4bcb" hs_bindgen_2cfbb4f5834d4bcb_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+hs_bindgen_2cfbb4f5834d4bcb ::
+     BG.Ptr Struct1
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_2cfbb4f5834d4bcb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2cfbb4f5834d4bcb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1 ::
+     BG.Ptr Struct1
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name1 = hs_bindgen_2cfbb4f5834d4bcb
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+foreign import ccall safe "hs_bindgen_c8b765fa70f95167" hs_bindgen_c8b765fa70f95167_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+hs_bindgen_c8b765fa70f95167 ::
+     BG.Ptr Struct3
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_c8b765fa70f95167 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c8b765fa70f95167_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2 ::
+     BG.Ptr Struct3
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name2 = hs_bindgen_c8b765fa70f95167
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+foreign import ccall safe "hs_bindgen_0ff3632971f092bb" hs_bindgen_0ff3632971f092bb_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+hs_bindgen_0ff3632971f092bb ::
+     BG.Ptr Struct4
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_0ff3632971f092bb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0ff3632971f092bb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name3 = hs_bindgen_0ff3632971f092bb
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/Example/Unsafe.hs
@@ -0,0 +1,397 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.quux1
+    , Example.Unsafe.quux2
+    , Example.Unsafe.wam1
+    , Example.Unsafe.wam2
+    , Example.Unsafe.struct_typedef1
+    , Example.Unsafe.struct_typedef2
+    , Example.Unsafe.struct_typedef3
+    , Example.Unsafe.struct_name1
+    , Example.Unsafe.struct_name2
+    , Example.Unsafe.struct_name3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl_vs_typedef.h>"
+  , "char hs_bindgen_df7e2b8e86de411a ("
+  , "  char arg1,"
+  , "  TC arg2"
+  , ")"
+  , "{"
+  , "  return (quux1)(arg1, arg2);"
+  , "}"
+  , "TC hs_bindgen_6f0b13ed02b696df ("
+  , "  char arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux2)(arg1, arg2);"
+  , "}"
+  , "char *hs_bindgen_f92059cc98dde342 ("
+  , "  float arg1,"
+  , "  TC *arg2"
+  , ")"
+  , "{"
+  , "  return (wam1)(arg1, arg2);"
+  , "}"
+  , "TC *hs_bindgen_3e6ecd1b2cc616bc ("
+  , "  float arg1,"
+  , "  char *arg2"
+  , ")"
+  , "{"
+  , "  return (wam2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ffa9d5a3e8f0f221 ("
+  , "  struct2 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4801667560542114 ("
+  , "  struct3_t *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_04fa5bbd479146eb ("
+  , "  struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_08025fd0bd589ac2 ("
+  , "  struct struct1 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9de286608f952fc7 ("
+  , "  struct struct3 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_38cce6bb1ac71578 ("
+  , "  struct struct4 *arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (struct_name3)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+foreign import ccall unsafe "hs_bindgen_df7e2b8e86de411a" hs_bindgen_df7e2b8e86de411a_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+hs_bindgen_df7e2b8e86de411a ::
+     BG.CChar
+  -> TC
+  -> IO BG.CChar
+hs_bindgen_df7e2b8e86de411a =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_df7e2b8e86de411a_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> TC
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux1 = hs_bindgen_df7e2b8e86de411a
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+foreign import ccall unsafe "hs_bindgen_6f0b13ed02b696df" hs_bindgen_6f0b13ed02b696df_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+hs_bindgen_6f0b13ed02b696df ::
+     BG.CChar
+  -> BG.CChar
+  -> IO TC
+hs_bindgen_6f0b13ed02b696df =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6f0b13ed02b696df_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO TC
+quux2 = hs_bindgen_6f0b13ed02b696df
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+foreign import ccall unsafe "hs_bindgen_f92059cc98dde342" hs_bindgen_f92059cc98dde342_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+hs_bindgen_f92059cc98dde342 ::
+     BG.CFloat
+  -> BG.Ptr TC
+  -> IO (BG.Ptr BG.CChar)
+hs_bindgen_f92059cc98dde342 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_f92059cc98dde342_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr TC
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr BG.CChar)
+wam1 = hs_bindgen_f92059cc98dde342
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+foreign import ccall unsafe "hs_bindgen_3e6ecd1b2cc616bc" hs_bindgen_3e6ecd1b2cc616bc_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+hs_bindgen_3e6ecd1b2cc616bc ::
+     BG.CFloat
+  -> BG.Ptr BG.CChar
+  -> IO (BG.Ptr TC)
+hs_bindgen_3e6ecd1b2cc616bc =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_3e6ecd1b2cc616bc_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr TC)
+wam2 = hs_bindgen_3e6ecd1b2cc616bc
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_ffa9d5a3e8f0f221" hs_bindgen_ffa9d5a3e8f0f221_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+hs_bindgen_ffa9d5a3e8f0f221 ::
+     BG.Ptr Struct2
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_ffa9d5a3e8f0f221 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ffa9d5a3e8f0f221_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1 ::
+     BG.Ptr Struct2
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef1 = hs_bindgen_ffa9d5a3e8f0f221
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_4801667560542114" hs_bindgen_4801667560542114_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+hs_bindgen_4801667560542114 ::
+     BG.Ptr Struct3_t
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_4801667560542114 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4801667560542114_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2 ::
+     BG.Ptr Struct3_t
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef2 = hs_bindgen_4801667560542114
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_04fa5bbd479146eb" hs_bindgen_04fa5bbd479146eb_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+hs_bindgen_04fa5bbd479146eb ::
+     BG.Ptr Struct4
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_04fa5bbd479146eb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_04fa5bbd479146eb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef3 = hs_bindgen_04fa5bbd479146eb
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+foreign import ccall unsafe "hs_bindgen_08025fd0bd589ac2" hs_bindgen_08025fd0bd589ac2_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+hs_bindgen_08025fd0bd589ac2 ::
+     BG.Ptr Struct1
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_08025fd0bd589ac2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_08025fd0bd589ac2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1 ::
+     BG.Ptr Struct1
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name1 = hs_bindgen_08025fd0bd589ac2
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+foreign import ccall unsafe "hs_bindgen_9de286608f952fc7" hs_bindgen_9de286608f952fc7_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+hs_bindgen_9de286608f952fc7 ::
+     BG.Ptr Struct3
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_9de286608f952fc7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9de286608f952fc7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2 ::
+     BG.Ptr Struct3
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name2 = hs_bindgen_9de286608f952fc7
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+foreign import ccall unsafe "hs_bindgen_38cce6bb1ac71578" hs_bindgen_38cce6bb1ac71578_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+hs_bindgen_38cce6bb1ac71578 ::
+     BG.Ptr Struct4
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_38cce6bb1ac71578 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_38cce6bb1ac71578_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name3 = hs_bindgen_38cce6bb1ac71578
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/bindingspec.yaml
@@ -0,0 +1,158 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: TC
+  hsname: TC
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct1
+  hsname: Struct1
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct2
+  hsname: Struct2
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct2
+  hsname: Struct2
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct3
+  hsname: Struct3
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct3_t
+  hsname: Struct3_t
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct4
+  hsname: Struct4
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct4
+  hsname: Struct4
+hstypes:
+- hsname: Struct1
+  representation:
+    record:
+      constructor: Struct1
+      fields:
+      - struct1_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct2
+  representation:
+    record:
+      constructor: Struct2
+      fields:
+      - struct2_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct3
+  representation:
+    record:
+      constructor: Struct3
+      fields:
+      - struct3_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct3_t
+  representation:
+    newtype:
+      constructor: Struct3_t
+      fields:
+      - unwrapStruct3_t
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct4
+  representation:
+    record:
+      constructor: Struct4
+      fields:
+      - struct4_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TC
+  representation:
+    newtype:
+      constructor: TC
+      fields:
+      - unwrapTC
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef.2.raw/th.txt
@@ -0,0 +1,1119 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_in_fundecl_vs_typedef.h
+-- #include <macros/macro_in_fundecl_vs_typedef.h>
+-- char hs_bindgen_02e0e3b28d470fd4 (
+--   char arg1,
+--   TC arg2
+-- )
+-- {
+--   return (quux1)(arg1, arg2);
+-- }
+-- TC hs_bindgen_bb79188c8775e2e4 (
+--   char arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux2)(arg1, arg2);
+-- }
+-- char *hs_bindgen_a398fb73645271c5 (
+--   float arg1,
+--   TC *arg2
+-- )
+-- {
+--   return (wam1)(arg1, arg2);
+-- }
+-- TC *hs_bindgen_ad904da072e0711e (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return (wam2)(arg1, arg2);
+-- }
+-- void hs_bindgen_88e976dc10571000 (
+--   struct2 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef1)(arg1, arg2);
+-- }
+-- void hs_bindgen_edb3806d45d7605b (
+--   struct3_t *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef2)(arg1, arg2);
+-- }
+-- void hs_bindgen_7c7f3ab0dd790fe8 (
+--   struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef3)(arg1, arg2);
+-- }
+-- void hs_bindgen_2cfbb4f5834d4bcb (
+--   struct struct1 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name1)(arg1, arg2);
+-- }
+-- void hs_bindgen_c8b765fa70f95167 (
+--   struct struct3 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name2)(arg1, arg2);
+-- }
+-- void hs_bindgen_0ff3632971f092bb (
+--   struct struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name3)(arg1, arg2);
+-- }
+-- char hs_bindgen_df7e2b8e86de411a (
+--   char arg1,
+--   TC arg2
+-- )
+-- {
+--   return (quux1)(arg1, arg2);
+-- }
+-- TC hs_bindgen_6f0b13ed02b696df (
+--   char arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux2)(arg1, arg2);
+-- }
+-- char *hs_bindgen_f92059cc98dde342 (
+--   float arg1,
+--   TC *arg2
+-- )
+-- {
+--   return (wam1)(arg1, arg2);
+-- }
+-- TC *hs_bindgen_3e6ecd1b2cc616bc (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return (wam2)(arg1, arg2);
+-- }
+-- void hs_bindgen_ffa9d5a3e8f0f221 (
+--   struct2 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef1)(arg1, arg2);
+-- }
+-- void hs_bindgen_4801667560542114 (
+--   struct3_t *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef2)(arg1, arg2);
+-- }
+-- void hs_bindgen_04fa5bbd479146eb (
+--   struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_typedef3)(arg1, arg2);
+-- }
+-- void hs_bindgen_08025fd0bd589ac2 (
+--   struct struct1 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name1)(arg1, arg2);
+-- }
+-- void hs_bindgen_9de286608f952fc7 (
+--   struct struct3 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name2)(arg1, arg2);
+-- }
+-- void hs_bindgen_38cce6bb1ac71578 (
+--   struct struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   (struct_name3)(arg1, arg2);
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1 */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_8c77c87c8985f5b4 (void)) (
+--   char arg1,
+--   TC arg2
+-- )
+-- {
+--   return &quux1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2 */
+-- __attribute__ ((const))
+-- TC (*hs_bindgen_ad1c057fd2e38491 (void)) (
+--   char arg1,
+--   char arg2
+-- )
+-- {
+--   return &quux2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1 */
+-- __attribute__ ((const))
+-- char *(*hs_bindgen_05b0ef45be2bc377 (void)) (
+--   float arg1,
+--   TC *arg2
+-- )
+-- {
+--   return &wam1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2 */
+-- __attribute__ ((const))
+-- TC *(*hs_bindgen_cd643a7a3c18ccf6 (void)) (
+--   float arg1,
+--   char *arg2
+-- )
+-- {
+--   return &wam2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0322539d81aee229 (void)) (
+--   struct2 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_typedef1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8522498cba39ada6 (void)) (
+--   struct3_t *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_typedef2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e19fc7f7dee46424 (void)) (
+--   struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_typedef3;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_00f81edda453ec64 (void)) (
+--   struct struct1 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_name1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8f4de3d502f3466d (void)) (
+--   struct struct3 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_name2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ba133ae0ff062248 (void)) (
+--   struct struct4 *arg1,
+--   char arg2
+-- )
+-- {
+--   return &struct_name3;
+-- }
+{-| __C declaration:__ @macro MC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 4:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+mC :: Raw String
+{-| __C declaration:__ @macro MC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 4:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+mC = objectLike "MC" ["char"]
+{-| __C declaration:__ @TC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 5:14@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype TC
+    = TC {unwrapTC :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapTC" TC ty
+    where hasField = \x_0 -> (\y_1 -> TC{unwrapTC = y_1},
+                              getField @"unwrapTC" x_0)
+instance (~) ty CChar => HasField "unwrapTC" (Ptr TC) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTC")
+instance HasCField TC "unwrapTC"
+    where type CFieldType TC "unwrapTC" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct1
+    = Struct1 {struct1_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct1
+    where readRaw = \ptr_0 -> pure Struct1 <*> readRaw (Proxy @"struct1_a") ptr_0
+instance WriteRaw Struct1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct1 struct1_a_2 -> writeRaw (Proxy @"struct1_a") ptr_0 struct1_a_2
+deriving via (EquivStorable Struct1) instance Storable Struct1
+deriving via (IsStructViaReadRaw Struct1) instance IsStruct Struct1
+instance (~) ty CInt => HasField "struct1_a" Struct1 ty
+    where hasField = \x_0 -> (\y_1 -> Struct1{struct1_a = y_1},
+                              getField @"struct1_a" x_0)
+instance (~) ty CInt => HasField "struct1_a" (Ptr Struct1) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct1_a")
+instance HasCField Struct1 "struct1_a"
+    where type CFieldType Struct1 "struct1_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct2
+    = Struct2 {struct2_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct2
+    where readRaw = \ptr_0 -> pure Struct2 <*> readRaw (Proxy @"struct2_a") ptr_0
+instance WriteRaw Struct2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct2 struct2_a_2 -> writeRaw (Proxy @"struct2_a") ptr_0 struct2_a_2
+deriving via (EquivStorable Struct2) instance Storable Struct2
+deriving via (IsStructViaReadRaw Struct2) instance IsStruct Struct2
+instance (~) ty CInt => HasField "struct2_a" Struct2 ty
+    where hasField = \x_0 -> (\y_1 -> Struct2{struct2_a = y_1},
+                              getField @"struct2_a" x_0)
+instance (~) ty CInt => HasField "struct2_a" (Ptr Struct2) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct2_a")
+instance HasCField Struct2 "struct2_a"
+    where type CFieldType Struct2 "struct2_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct3
+    = Struct3 {struct3_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct3
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct3
+    where readRaw = \ptr_0 -> pure Struct3 <*> readRaw (Proxy @"struct3_a") ptr_0
+instance WriteRaw Struct3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct3 struct3_a_2 -> writeRaw (Proxy @"struct3_a") ptr_0 struct3_a_2
+deriving via (EquivStorable Struct3) instance Storable Struct3
+deriving via (IsStructViaReadRaw Struct3) instance IsStruct Struct3
+instance (~) ty CInt => HasField "struct3_a" Struct3 ty
+    where hasField = \x_0 -> (\y_1 -> Struct3{struct3_a = y_1},
+                              getField @"struct3_a" x_0)
+instance (~) ty CInt => HasField "struct3_a" (Ptr Struct3) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct3_a")
+instance HasCField Struct3 "struct3_a"
+    where type CFieldType Struct3 "struct3_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct3_t@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:35@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype Struct3_t
+    = Struct3_t {unwrapStruct3_t :: Struct3}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty Struct3 => HasField "unwrapStruct3_t" Struct3_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct3_t{unwrapStruct3_t = y_1},
+                              getField @"unwrapStruct3_t" x_0)
+instance (~) ty Struct3 =>
+         HasField "unwrapStruct3_t" (Ptr Struct3_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct3_t")
+instance HasCField Struct3_t "unwrapStruct3_t"
+    where type CFieldType Struct3_t "unwrapStruct3_t" = Struct3
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct4
+    = Struct4 {struct4_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct4
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct4
+    where readRaw = \ptr_0 -> pure Struct4 <*> readRaw (Proxy @"struct4_a") ptr_0
+instance WriteRaw Struct4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct4 struct4_a_2 -> writeRaw (Proxy @"struct4_a") ptr_0 struct4_a_2
+deriving via (EquivStorable Struct4) instance Storable Struct4
+deriving via (IsStructViaReadRaw Struct4) instance IsStruct Struct4
+instance (~) ty CInt => HasField "struct4_a" Struct4 ty
+    where hasField = \x_0 -> (\y_1 -> Struct4{struct4_a = y_1},
+                              getField @"struct4_a" x_0)
+instance (~) ty CInt => HasField "struct4_a" (Ptr Struct4) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct4_a")
+instance HasCField Struct4 "struct4_a"
+    where type CFieldType Struct4 "struct4_a" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+foreign import ccall safe "hs_bindgen_02e0e3b28d470fd4" hs_bindgen_02e0e3b28d470fd4_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+hs_bindgen_02e0e3b28d470fd4 :: CChar -> TC -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+hs_bindgen_02e0e3b28d470fd4 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_02e0e3b28d470fd4_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_safe :: CChar -> TC -> IO CChar
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_safe = hs_bindgen_02e0e3b28d470fd4
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+foreign import ccall safe "hs_bindgen_bb79188c8775e2e4" hs_bindgen_bb79188c8775e2e4_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+hs_bindgen_bb79188c8775e2e4 :: CChar -> CChar -> IO TC
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+hs_bindgen_bb79188c8775e2e4 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_bb79188c8775e2e4_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_safe :: CChar -> CChar -> IO TC
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_safe = hs_bindgen_bb79188c8775e2e4
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+foreign import ccall safe "hs_bindgen_a398fb73645271c5" hs_bindgen_a398fb73645271c5_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+hs_bindgen_a398fb73645271c5 :: CFloat -> Ptr TC -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+hs_bindgen_a398fb73645271c5 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_a398fb73645271c5_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_safe :: CFloat -> Ptr TC -> IO (Ptr CChar)
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_safe = hs_bindgen_a398fb73645271c5
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+foreign import ccall safe "hs_bindgen_ad904da072e0711e" hs_bindgen_ad904da072e0711e_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+hs_bindgen_ad904da072e0711e :: CFloat -> Ptr CChar -> IO (Ptr TC)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+hs_bindgen_ad904da072e0711e = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_ad904da072e0711e_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_safe :: CFloat -> Ptr CChar -> IO (Ptr TC)
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_safe = hs_bindgen_ad904da072e0711e
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+foreign import ccall safe "hs_bindgen_88e976dc10571000" hs_bindgen_88e976dc10571000_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+hs_bindgen_88e976dc10571000 :: Ptr Struct2 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+hs_bindgen_88e976dc10571000 = \x_0 -> \x_1 -> hs_bindgen_88e976dc10571000_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_safe :: Ptr Struct2 -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_safe = hs_bindgen_88e976dc10571000
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+foreign import ccall safe "hs_bindgen_edb3806d45d7605b" hs_bindgen_edb3806d45d7605b_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+hs_bindgen_edb3806d45d7605b :: Ptr Struct3_t -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+hs_bindgen_edb3806d45d7605b = \x_0 -> \x_1 -> hs_bindgen_edb3806d45d7605b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_safe :: Ptr Struct3_t -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_safe = hs_bindgen_edb3806d45d7605b
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+foreign import ccall safe "hs_bindgen_7c7f3ab0dd790fe8" hs_bindgen_7c7f3ab0dd790fe8_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+hs_bindgen_7c7f3ab0dd790fe8 :: Ptr Struct4 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+hs_bindgen_7c7f3ab0dd790fe8 = \x_0 -> \x_1 -> hs_bindgen_7c7f3ab0dd790fe8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_safe :: Ptr Struct4 -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_safe = hs_bindgen_7c7f3ab0dd790fe8
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+foreign import ccall safe "hs_bindgen_2cfbb4f5834d4bcb" hs_bindgen_2cfbb4f5834d4bcb_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+hs_bindgen_2cfbb4f5834d4bcb :: Ptr Struct1 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+hs_bindgen_2cfbb4f5834d4bcb = \x_0 -> \x_1 -> hs_bindgen_2cfbb4f5834d4bcb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_safe :: Ptr Struct1 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_safe = hs_bindgen_2cfbb4f5834d4bcb
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+foreign import ccall safe "hs_bindgen_c8b765fa70f95167" hs_bindgen_c8b765fa70f95167_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+hs_bindgen_c8b765fa70f95167 :: Ptr Struct3 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+hs_bindgen_c8b765fa70f95167 = \x_0 -> \x_1 -> hs_bindgen_c8b765fa70f95167_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_safe :: Ptr Struct3 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_safe = hs_bindgen_c8b765fa70f95167
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+foreign import ccall safe "hs_bindgen_0ff3632971f092bb" hs_bindgen_0ff3632971f092bb_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+hs_bindgen_0ff3632971f092bb :: Ptr Struct4 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+hs_bindgen_0ff3632971f092bb = \x_0 -> \x_1 -> hs_bindgen_0ff3632971f092bb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_safe :: Ptr Struct4 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_safe = hs_bindgen_0ff3632971f092bb
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+foreign import ccall unsafe "hs_bindgen_df7e2b8e86de411a" hs_bindgen_df7e2b8e86de411a_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+hs_bindgen_df7e2b8e86de411a :: CChar -> TC -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+hs_bindgen_df7e2b8e86de411a = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_df7e2b8e86de411a_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_unsafe :: CChar -> TC -> IO CChar
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_unsafe = hs_bindgen_df7e2b8e86de411a
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+foreign import ccall unsafe "hs_bindgen_6f0b13ed02b696df" hs_bindgen_6f0b13ed02b696df_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+hs_bindgen_6f0b13ed02b696df :: CChar -> CChar -> IO TC
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+hs_bindgen_6f0b13ed02b696df = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_6f0b13ed02b696df_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_unsafe :: CChar -> CChar -> IO TC
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_unsafe = hs_bindgen_6f0b13ed02b696df
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+foreign import ccall unsafe "hs_bindgen_f92059cc98dde342" hs_bindgen_f92059cc98dde342_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+hs_bindgen_f92059cc98dde342 :: CFloat -> Ptr TC -> IO (Ptr CChar)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+hs_bindgen_f92059cc98dde342 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_f92059cc98dde342_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_unsafe :: CFloat -> Ptr TC -> IO (Ptr CChar)
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_unsafe = hs_bindgen_f92059cc98dde342
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+foreign import ccall unsafe "hs_bindgen_3e6ecd1b2cc616bc" hs_bindgen_3e6ecd1b2cc616bc_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+hs_bindgen_3e6ecd1b2cc616bc :: CFloat -> Ptr CChar -> IO (Ptr TC)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+hs_bindgen_3e6ecd1b2cc616bc = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_3e6ecd1b2cc616bc_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_unsafe :: CFloat -> Ptr CChar -> IO (Ptr TC)
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_unsafe = hs_bindgen_3e6ecd1b2cc616bc
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_ffa9d5a3e8f0f221" hs_bindgen_ffa9d5a3e8f0f221_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+hs_bindgen_ffa9d5a3e8f0f221 :: Ptr Struct2 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+hs_bindgen_ffa9d5a3e8f0f221 = \x_0 -> \x_1 -> hs_bindgen_ffa9d5a3e8f0f221_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_unsafe :: Ptr Struct2 -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_unsafe = hs_bindgen_ffa9d5a3e8f0f221
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_4801667560542114" hs_bindgen_4801667560542114_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+hs_bindgen_4801667560542114 :: Ptr Struct3_t -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+hs_bindgen_4801667560542114 = \x_0 -> \x_1 -> hs_bindgen_4801667560542114_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_unsafe :: Ptr Struct3_t -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_unsafe = hs_bindgen_4801667560542114
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_04fa5bbd479146eb" hs_bindgen_04fa5bbd479146eb_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+hs_bindgen_04fa5bbd479146eb :: Ptr Struct4 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+hs_bindgen_04fa5bbd479146eb = \x_0 -> \x_1 -> hs_bindgen_04fa5bbd479146eb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_unsafe :: Ptr Struct4 -> CChar -> IO ()
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_unsafe = hs_bindgen_04fa5bbd479146eb
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+foreign import ccall unsafe "hs_bindgen_08025fd0bd589ac2" hs_bindgen_08025fd0bd589ac2_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+hs_bindgen_08025fd0bd589ac2 :: Ptr Struct1 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+hs_bindgen_08025fd0bd589ac2 = \x_0 -> \x_1 -> hs_bindgen_08025fd0bd589ac2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_unsafe :: Ptr Struct1 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_unsafe = hs_bindgen_08025fd0bd589ac2
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+foreign import ccall unsafe "hs_bindgen_9de286608f952fc7" hs_bindgen_9de286608f952fc7_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+hs_bindgen_9de286608f952fc7 :: Ptr Struct3 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+hs_bindgen_9de286608f952fc7 = \x_0 -> \x_1 -> hs_bindgen_9de286608f952fc7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_unsafe :: Ptr Struct3 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_unsafe = hs_bindgen_9de286608f952fc7
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+foreign import ccall unsafe "hs_bindgen_38cce6bb1ac71578" hs_bindgen_38cce6bb1ac71578_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+hs_bindgen_38cce6bb1ac71578 :: Ptr Struct4 -> CChar -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+hs_bindgen_38cce6bb1ac71578 = \x_0 -> \x_1 -> hs_bindgen_38cce6bb1ac71578_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_unsafe :: Ptr Struct4 -> CChar -> IO ()
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_unsafe = hs_bindgen_38cce6bb1ac71578
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+foreign import ccall unsafe "hs_bindgen_8c77c87c8985f5b4" hs_bindgen_8c77c87c8985f5b4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+hs_bindgen_8c77c87c8985f5b4 :: IO (FunPtr (CChar ->
+                                           TC -> IO CChar))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+hs_bindgen_8c77c87c8985f5b4 = fmap fromFFIType hs_bindgen_8c77c87c8985f5b4_base
+{-# NOINLINE quux1_funptr #-}
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_funptr :: FunPtr (CChar -> TC -> IO CChar)
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_funptr = unsafePerformIO hs_bindgen_8c77c87c8985f5b4
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+foreign import ccall unsafe "hs_bindgen_ad1c057fd2e38491" hs_bindgen_ad1c057fd2e38491_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+hs_bindgen_ad1c057fd2e38491 :: IO (FunPtr (CChar ->
+                                           CChar -> IO TC))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+hs_bindgen_ad1c057fd2e38491 = fmap fromFFIType hs_bindgen_ad1c057fd2e38491_base
+{-# NOINLINE quux2_funptr #-}
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_funptr :: FunPtr (CChar -> CChar -> IO TC)
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_funptr = unsafePerformIO hs_bindgen_ad1c057fd2e38491
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+foreign import ccall unsafe "hs_bindgen_05b0ef45be2bc377" hs_bindgen_05b0ef45be2bc377_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+hs_bindgen_05b0ef45be2bc377 :: IO (FunPtr (CFloat ->
+                                           Ptr TC -> IO (Ptr CChar)))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+hs_bindgen_05b0ef45be2bc377 = fmap fromFFIType hs_bindgen_05b0ef45be2bc377_base
+{-# NOINLINE wam1_funptr #-}
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_funptr :: FunPtr (CFloat -> Ptr TC -> IO (Ptr CChar))
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_funptr = unsafePerformIO hs_bindgen_05b0ef45be2bc377
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+foreign import ccall unsafe "hs_bindgen_cd643a7a3c18ccf6" hs_bindgen_cd643a7a3c18ccf6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+hs_bindgen_cd643a7a3c18ccf6 :: IO (FunPtr (CFloat ->
+                                           Ptr CChar -> IO (Ptr TC)))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+hs_bindgen_cd643a7a3c18ccf6 = fmap fromFFIType hs_bindgen_cd643a7a3c18ccf6_base
+{-# NOINLINE wam2_funptr #-}
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_funptr :: FunPtr (CFloat -> Ptr CChar -> IO (Ptr TC))
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_funptr = unsafePerformIO hs_bindgen_cd643a7a3c18ccf6
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_0322539d81aee229" hs_bindgen_0322539d81aee229_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+hs_bindgen_0322539d81aee229 :: IO (FunPtr (Ptr Struct2 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+hs_bindgen_0322539d81aee229 = fmap fromFFIType hs_bindgen_0322539d81aee229_base
+{-# NOINLINE struct_typedef1_funptr #-}
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_funptr :: FunPtr (Ptr Struct2 -> CChar -> IO ())
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_funptr = unsafePerformIO hs_bindgen_0322539d81aee229
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_8522498cba39ada6" hs_bindgen_8522498cba39ada6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+hs_bindgen_8522498cba39ada6 :: IO (FunPtr (Ptr Struct3_t ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+hs_bindgen_8522498cba39ada6 = fmap fromFFIType hs_bindgen_8522498cba39ada6_base
+{-# NOINLINE struct_typedef2_funptr #-}
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_funptr :: FunPtr (Ptr Struct3_t -> CChar -> IO ())
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_funptr = unsafePerformIO hs_bindgen_8522498cba39ada6
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_e19fc7f7dee46424" hs_bindgen_e19fc7f7dee46424_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+hs_bindgen_e19fc7f7dee46424 :: IO (FunPtr (Ptr Struct4 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+hs_bindgen_e19fc7f7dee46424 = fmap fromFFIType hs_bindgen_e19fc7f7dee46424_base
+{-# NOINLINE struct_typedef3_funptr #-}
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_funptr :: FunPtr (Ptr Struct4 -> CChar -> IO ())
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_funptr = unsafePerformIO hs_bindgen_e19fc7f7dee46424
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+foreign import ccall unsafe "hs_bindgen_00f81edda453ec64" hs_bindgen_00f81edda453ec64_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+hs_bindgen_00f81edda453ec64 :: IO (FunPtr (Ptr Struct1 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+hs_bindgen_00f81edda453ec64 = fmap fromFFIType hs_bindgen_00f81edda453ec64_base
+{-# NOINLINE struct_name1_funptr #-}
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_funptr :: FunPtr (Ptr Struct1 -> CChar -> IO ())
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_funptr = unsafePerformIO hs_bindgen_00f81edda453ec64
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+foreign import ccall unsafe "hs_bindgen_8f4de3d502f3466d" hs_bindgen_8f4de3d502f3466d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+hs_bindgen_8f4de3d502f3466d :: IO (FunPtr (Ptr Struct3 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+hs_bindgen_8f4de3d502f3466d = fmap fromFFIType hs_bindgen_8f4de3d502f3466d_base
+{-# NOINLINE struct_name2_funptr #-}
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_funptr :: FunPtr (Ptr Struct3 -> CChar -> IO ())
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_funptr = unsafePerformIO hs_bindgen_8f4de3d502f3466d
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+foreign import ccall unsafe "hs_bindgen_ba133ae0ff062248" hs_bindgen_ba133ae0ff062248_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+hs_bindgen_ba133ae0ff062248 :: IO (FunPtr (Ptr Struct4 ->
+                                           CChar -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+hs_bindgen_ba133ae0ff062248 = fmap fromFFIType hs_bindgen_ba133ae0ff062248_base
+{-# NOINLINE struct_name3_funptr #-}
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_funptr :: FunPtr (Ptr Struct4 -> CChar -> IO ())
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_funptr = unsafePerformIO hs_bindgen_ba133ae0ff062248
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example.hs
@@ -0,0 +1,433 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MC(..)
+    , Example.TC(..)
+    , Example.Struct1(..)
+    , Example.Struct2(..)
+    , Example.Struct3(..)
+    , Example.Struct3_t(..)
+    , Example.Struct4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro MC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 4:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype MC = MC
+  { unwrapMC :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "unwrapMC" MC ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MC {unwrapMC = y1}, BG.getField @"unwrapMC" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "unwrapMC" (BG.Ptr MC) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapMC")
+
+instance HasCField.HasCField MC "unwrapMC" where
+
+  type CFieldType MC "unwrapMC" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @TC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 5:14@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype TC = TC
+  { unwrapTC :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "unwrapTC" TC ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TC {unwrapTC = y1}, BG.getField @"unwrapTC" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "unwrapTC" (BG.Ptr TC) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTC")
+
+instance HasCField.HasCField TC "unwrapTC" where
+
+  type CFieldType TC "unwrapTC" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct1 = Struct1
+  { struct1_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct1
+      <*> HasCField.readRaw (BG.Proxy @"struct1_a") ptr0
+
+instance Marshal.WriteRaw Struct1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct1 struct1_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct1_a") ptr0 struct1_a2
+
+deriving via Marshal.EquivStorable Struct1 instance BG.Storable Struct1
+
+deriving via Struct.IsStructViaReadRaw Struct1 instance Struct.IsStruct Struct1
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct1_a" Struct1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct1 {struct1_a = y1}, BG.getField @"struct1_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct1_a" (BG.Ptr Struct1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct1_a")
+
+instance HasCField.HasCField Struct1 "struct1_a" where
+
+  type CFieldType Struct1 "struct1_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct2 = Struct2
+  { struct2_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct2 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct2
+      <*> HasCField.readRaw (BG.Proxy @"struct2_a") ptr0
+
+instance Marshal.WriteRaw Struct2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct2 struct2_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct2_a") ptr0 struct2_a2
+
+deriving via Marshal.EquivStorable Struct2 instance BG.Storable Struct2
+
+deriving via Struct.IsStructViaReadRaw Struct2 instance Struct.IsStruct Struct2
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct2_a" Struct2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct2 {struct2_a = y1}, BG.getField @"struct2_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct2_a" (BG.Ptr Struct2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct2_a")
+
+instance HasCField.HasCField Struct2 "struct2_a" where
+
+  type CFieldType Struct2 "struct2_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct3 = Struct3
+  { struct3_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct3 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct3
+      <*> HasCField.readRaw (BG.Proxy @"struct3_a") ptr0
+
+instance Marshal.WriteRaw Struct3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct3 struct3_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct3_a") ptr0 struct3_a2
+
+deriving via Marshal.EquivStorable Struct3 instance BG.Storable Struct3
+
+deriving via Struct.IsStructViaReadRaw Struct3 instance Struct.IsStruct Struct3
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct3_a" Struct3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct3 {struct3_a = y1}, BG.getField @"struct3_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct3_a" (BG.Ptr Struct3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct3_a")
+
+instance HasCField.HasCField Struct3 "struct3_a" where
+
+  type CFieldType Struct3 "struct3_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct3_t@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:35@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype Struct3_t = Struct3_t
+  { unwrapStruct3_t :: Struct3
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Struct3
+         ) => BG.CompatHasField.HasField "unwrapStruct3_t" Struct3_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct3_t {unwrapStruct3_t = y1}, BG.getField @"unwrapStruct3_t" x0)
+
+instance ( ty ~ Struct3
+         ) => BG.HasField "unwrapStruct3_t" (BG.Ptr Struct3_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct3_t")
+
+instance HasCField.HasCField Struct3_t "unwrapStruct3_t" where
+
+  type CFieldType Struct3_t "unwrapStruct3_t" = Struct3
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct4 = Struct4
+  { struct4_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:30@
+
+         __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct4 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct4 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct4
+      <*> HasCField.readRaw (BG.Proxy @"struct4_a") ptr0
+
+instance Marshal.WriteRaw Struct4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct4 struct4_a2 ->
+            HasCField.writeRaw (BG.Proxy @"struct4_a") ptr0 struct4_a2
+
+deriving via Marshal.EquivStorable Struct4 instance BG.Storable Struct4
+
+deriving via Struct.IsStructViaReadRaw Struct4 instance Struct.IsStruct Struct4
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:30@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct4_a" Struct4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct4 {struct4_a = y1}, BG.getField @"struct4_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct4_a" (BG.Ptr Struct4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct4_a")
+
+instance HasCField.HasCField Struct4 "struct4_a" where
+
+  type CFieldType Struct4 "struct4_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example/FunPtr.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example/FunPtr.hs
@@ -0,0 +1,315 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.quux1
+    , Example.FunPtr.quux2
+    , Example.FunPtr.wam1
+    , Example.FunPtr.wam2
+    , Example.FunPtr.struct_typedef1
+    , Example.FunPtr.struct_typedef2
+    , Example.FunPtr.struct_typedef3
+    , Example.FunPtr.struct_name1
+    , Example.FunPtr.struct_name2
+    , Example.FunPtr.struct_name3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl_vs_typedef.h>"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1 */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_8c77c87c8985f5b4 (void)) ("
+  , "  MC arg1,"
+  , "  TC arg2"
+  , ")"
+  , "{"
+  , "  return &quux1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2 */"
+  , "__attribute__ ((const))"
+  , "TC (*hs_bindgen_ad1c057fd2e38491 (void)) ("
+  , "  MC arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &quux2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1 */"
+  , "__attribute__ ((const))"
+  , "MC *(*hs_bindgen_05b0ef45be2bc377 (void)) ("
+  , "  float arg1,"
+  , "  TC *arg2"
+  , ")"
+  , "{"
+  , "  return &wam1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2 */"
+  , "__attribute__ ((const))"
+  , "TC *(*hs_bindgen_cd643a7a3c18ccf6 (void)) ("
+  , "  float arg1,"
+  , "  MC *arg2"
+  , ")"
+  , "{"
+  , "  return &wam2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0322539d81aee229 (void)) ("
+  , "  struct2 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  return &struct_typedef1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8522498cba39ada6 (void)) ("
+  , "  struct3_t *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  return &struct_typedef2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e19fc7f7dee46424 (void)) ("
+  , "  struct4 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  return &struct_typedef3;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_00f81edda453ec64 (void)) ("
+  , "  struct struct1 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  return &struct_name1;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8f4de3d502f3466d (void)) ("
+  , "  struct struct3 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  return &struct_name2;"
+  , "}"
+  , "/* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ba133ae0ff062248 (void)) ("
+  , "  struct struct4 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  return &struct_name3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+foreign import ccall unsafe "hs_bindgen_8c77c87c8985f5b4" hs_bindgen_8c77c87c8985f5b4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+hs_bindgen_8c77c87c8985f5b4 :: IO (BG.FunPtr (MC -> TC -> IO BG.CChar))
+hs_bindgen_8c77c87c8985f5b4 =
+  fmap BG.fromFFIType hs_bindgen_8c77c87c8985f5b4_base
+
+{-# NOINLINE quux1 #-}
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1 :: BG.FunPtr (MC -> TC -> IO BG.CChar)
+quux1 =
+  BG.unsafePerformIO hs_bindgen_8c77c87c8985f5b4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+foreign import ccall unsafe "hs_bindgen_ad1c057fd2e38491" hs_bindgen_ad1c057fd2e38491_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+hs_bindgen_ad1c057fd2e38491 :: IO (BG.FunPtr (MC -> BG.CChar -> IO TC))
+hs_bindgen_ad1c057fd2e38491 =
+  fmap BG.fromFFIType hs_bindgen_ad1c057fd2e38491_base
+
+{-# NOINLINE quux2 #-}
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2 :: BG.FunPtr (MC -> BG.CChar -> IO TC)
+quux2 =
+  BG.unsafePerformIO hs_bindgen_ad1c057fd2e38491
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+foreign import ccall unsafe "hs_bindgen_05b0ef45be2bc377" hs_bindgen_05b0ef45be2bc377_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+hs_bindgen_05b0ef45be2bc377 :: IO (BG.FunPtr (BG.CFloat -> BG.Ptr TC -> IO (BG.Ptr MC)))
+hs_bindgen_05b0ef45be2bc377 =
+  fmap BG.fromFFIType hs_bindgen_05b0ef45be2bc377_base
+
+{-# NOINLINE wam1 #-}
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1 :: BG.FunPtr (BG.CFloat -> BG.Ptr TC -> IO (BG.Ptr MC))
+wam1 = BG.unsafePerformIO hs_bindgen_05b0ef45be2bc377
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+foreign import ccall unsafe "hs_bindgen_cd643a7a3c18ccf6" hs_bindgen_cd643a7a3c18ccf6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+hs_bindgen_cd643a7a3c18ccf6 :: IO (BG.FunPtr (BG.CFloat -> BG.Ptr MC -> IO (BG.Ptr TC)))
+hs_bindgen_cd643a7a3c18ccf6 =
+  fmap BG.fromFFIType hs_bindgen_cd643a7a3c18ccf6_base
+
+{-# NOINLINE wam2 #-}
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2 :: BG.FunPtr (BG.CFloat -> BG.Ptr MC -> IO (BG.Ptr TC))
+wam2 = BG.unsafePerformIO hs_bindgen_cd643a7a3c18ccf6
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_0322539d81aee229" hs_bindgen_0322539d81aee229_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+hs_bindgen_0322539d81aee229 :: IO (BG.FunPtr (BG.Ptr Struct2 -> MC -> IO ()))
+hs_bindgen_0322539d81aee229 =
+  fmap BG.fromFFIType hs_bindgen_0322539d81aee229_base
+
+{-# NOINLINE struct_typedef1 #-}
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1 :: BG.FunPtr (BG.Ptr Struct2 -> MC -> IO ())
+struct_typedef1 =
+  BG.unsafePerformIO hs_bindgen_0322539d81aee229
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_8522498cba39ada6" hs_bindgen_8522498cba39ada6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+hs_bindgen_8522498cba39ada6 :: IO (BG.FunPtr (BG.Ptr Struct3_t -> MC -> IO ()))
+hs_bindgen_8522498cba39ada6 =
+  fmap BG.fromFFIType hs_bindgen_8522498cba39ada6_base
+
+{-# NOINLINE struct_typedef2 #-}
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2 :: BG.FunPtr (BG.Ptr Struct3_t -> MC -> IO ())
+struct_typedef2 =
+  BG.unsafePerformIO hs_bindgen_8522498cba39ada6
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_e19fc7f7dee46424" hs_bindgen_e19fc7f7dee46424_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+hs_bindgen_e19fc7f7dee46424 :: IO (BG.FunPtr (BG.Ptr Struct4 -> MC -> IO ()))
+hs_bindgen_e19fc7f7dee46424 =
+  fmap BG.fromFFIType hs_bindgen_e19fc7f7dee46424_base
+
+{-# NOINLINE struct_typedef3 #-}
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3 :: BG.FunPtr (BG.Ptr Struct4 -> MC -> IO ())
+struct_typedef3 =
+  BG.unsafePerformIO hs_bindgen_e19fc7f7dee46424
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+foreign import ccall unsafe "hs_bindgen_00f81edda453ec64" hs_bindgen_00f81edda453ec64_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+hs_bindgen_00f81edda453ec64 :: IO (BG.FunPtr (BG.Ptr Struct1 -> MC -> IO ()))
+hs_bindgen_00f81edda453ec64 =
+  fmap BG.fromFFIType hs_bindgen_00f81edda453ec64_base
+
+{-# NOINLINE struct_name1 #-}
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1 :: BG.FunPtr (BG.Ptr Struct1 -> MC -> IO ())
+struct_name1 =
+  BG.unsafePerformIO hs_bindgen_00f81edda453ec64
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+foreign import ccall unsafe "hs_bindgen_8f4de3d502f3466d" hs_bindgen_8f4de3d502f3466d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+hs_bindgen_8f4de3d502f3466d :: IO (BG.FunPtr (BG.Ptr Struct3 -> MC -> IO ()))
+hs_bindgen_8f4de3d502f3466d =
+  fmap BG.fromFFIType hs_bindgen_8f4de3d502f3466d_base
+
+{-# NOINLINE struct_name2 #-}
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2 :: BG.FunPtr (BG.Ptr Struct3 -> MC -> IO ())
+struct_name2 =
+  BG.unsafePerformIO hs_bindgen_8f4de3d502f3466d
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+foreign import ccall unsafe "hs_bindgen_ba133ae0ff062248" hs_bindgen_ba133ae0ff062248_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+hs_bindgen_ba133ae0ff062248 :: IO (BG.FunPtr (BG.Ptr Struct4 -> MC -> IO ()))
+hs_bindgen_ba133ae0ff062248 =
+  fmap BG.fromFFIType hs_bindgen_ba133ae0ff062248_base
+
+{-# NOINLINE struct_name3 #-}
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3 :: BG.FunPtr (BG.Ptr Struct4 -> MC -> IO ())
+struct_name3 =
+  BG.unsafePerformIO hs_bindgen_ba133ae0ff062248
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example/Safe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example/Safe.hs
@@ -0,0 +1,397 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.quux1
+    , Example.Safe.quux2
+    , Example.Safe.wam1
+    , Example.Safe.wam2
+    , Example.Safe.struct_typedef1
+    , Example.Safe.struct_typedef2
+    , Example.Safe.struct_typedef3
+    , Example.Safe.struct_name1
+    , Example.Safe.struct_name2
+    , Example.Safe.struct_name3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl_vs_typedef.h>"
+  , "char hs_bindgen_02e0e3b28d470fd4 ("
+  , "  MC arg1,"
+  , "  TC arg2"
+  , ")"
+  , "{"
+  , "  return (quux1)(arg1, arg2);"
+  , "}"
+  , "TC hs_bindgen_bb79188c8775e2e4 ("
+  , "  MC arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux2)(arg1, arg2);"
+  , "}"
+  , "MC *hs_bindgen_a398fb73645271c5 ("
+  , "  float arg1,"
+  , "  TC *arg2"
+  , ")"
+  , "{"
+  , "  return (wam1)(arg1, arg2);"
+  , "}"
+  , "TC *hs_bindgen_ad904da072e0711e ("
+  , "  float arg1,"
+  , "  MC *arg2"
+  , ")"
+  , "{"
+  , "  return (wam2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_88e976dc10571000 ("
+  , "  struct2 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_edb3806d45d7605b ("
+  , "  struct3_t *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7c7f3ab0dd790fe8 ("
+  , "  struct4 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2cfbb4f5834d4bcb ("
+  , "  struct struct1 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_name1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c8b765fa70f95167 ("
+  , "  struct struct3 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_name2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0ff3632971f092bb ("
+  , "  struct struct4 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_name3)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+foreign import ccall safe "hs_bindgen_02e0e3b28d470fd4" hs_bindgen_02e0e3b28d470fd4_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+hs_bindgen_02e0e3b28d470fd4 ::
+     MC
+  -> TC
+  -> IO BG.CChar
+hs_bindgen_02e0e3b28d470fd4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_02e0e3b28d470fd4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1 ::
+     MC
+     -- ^ __C declaration:__ @x@
+  -> TC
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux1 = hs_bindgen_02e0e3b28d470fd4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+foreign import ccall safe "hs_bindgen_bb79188c8775e2e4" hs_bindgen_bb79188c8775e2e4_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+hs_bindgen_bb79188c8775e2e4 ::
+     MC
+  -> BG.CChar
+  -> IO TC
+hs_bindgen_bb79188c8775e2e4 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_bb79188c8775e2e4_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2 ::
+     MC
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO TC
+quux2 = hs_bindgen_bb79188c8775e2e4
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+foreign import ccall safe "hs_bindgen_a398fb73645271c5" hs_bindgen_a398fb73645271c5_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+hs_bindgen_a398fb73645271c5 ::
+     BG.CFloat
+  -> BG.Ptr TC
+  -> IO (BG.Ptr MC)
+hs_bindgen_a398fb73645271c5 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_a398fb73645271c5_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr TC
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr MC)
+wam1 = hs_bindgen_a398fb73645271c5
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+foreign import ccall safe "hs_bindgen_ad904da072e0711e" hs_bindgen_ad904da072e0711e_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+hs_bindgen_ad904da072e0711e ::
+     BG.CFloat
+  -> BG.Ptr MC
+  -> IO (BG.Ptr TC)
+hs_bindgen_ad904da072e0711e =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_ad904da072e0711e_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr MC
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr TC)
+wam2 = hs_bindgen_ad904da072e0711e
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+foreign import ccall safe "hs_bindgen_88e976dc10571000" hs_bindgen_88e976dc10571000_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+hs_bindgen_88e976dc10571000 ::
+     BG.Ptr Struct2
+  -> MC
+  -> IO ()
+hs_bindgen_88e976dc10571000 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_88e976dc10571000_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1 ::
+     BG.Ptr Struct2
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef1 = hs_bindgen_88e976dc10571000
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+foreign import ccall safe "hs_bindgen_edb3806d45d7605b" hs_bindgen_edb3806d45d7605b_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+hs_bindgen_edb3806d45d7605b ::
+     BG.Ptr Struct3_t
+  -> MC
+  -> IO ()
+hs_bindgen_edb3806d45d7605b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_edb3806d45d7605b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2 ::
+     BG.Ptr Struct3_t
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef2 = hs_bindgen_edb3806d45d7605b
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+foreign import ccall safe "hs_bindgen_7c7f3ab0dd790fe8" hs_bindgen_7c7f3ab0dd790fe8_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+hs_bindgen_7c7f3ab0dd790fe8 ::
+     BG.Ptr Struct4
+  -> MC
+  -> IO ()
+hs_bindgen_7c7f3ab0dd790fe8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7c7f3ab0dd790fe8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef3 = hs_bindgen_7c7f3ab0dd790fe8
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+foreign import ccall safe "hs_bindgen_2cfbb4f5834d4bcb" hs_bindgen_2cfbb4f5834d4bcb_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+hs_bindgen_2cfbb4f5834d4bcb ::
+     BG.Ptr Struct1
+  -> MC
+  -> IO ()
+hs_bindgen_2cfbb4f5834d4bcb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2cfbb4f5834d4bcb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1 ::
+     BG.Ptr Struct1
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name1 = hs_bindgen_2cfbb4f5834d4bcb
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+foreign import ccall safe "hs_bindgen_c8b765fa70f95167" hs_bindgen_c8b765fa70f95167_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+hs_bindgen_c8b765fa70f95167 ::
+     BG.Ptr Struct3
+  -> MC
+  -> IO ()
+hs_bindgen_c8b765fa70f95167 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c8b765fa70f95167_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2 ::
+     BG.Ptr Struct3
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name2 = hs_bindgen_c8b765fa70f95167
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+foreign import ccall safe "hs_bindgen_0ff3632971f092bb" hs_bindgen_0ff3632971f092bb_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+hs_bindgen_0ff3632971f092bb ::
+     BG.Ptr Struct4
+  -> MC
+  -> IO ()
+hs_bindgen_0ff3632971f092bb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0ff3632971f092bb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name3 = hs_bindgen_0ff3632971f092bb
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example/Unsafe.hs b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/Example/Unsafe.hs
@@ -0,0 +1,397 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.quux1
+    , Example.Unsafe.quux2
+    , Example.Unsafe.wam1
+    , Example.Unsafe.wam2
+    , Example.Unsafe.struct_typedef1
+    , Example.Unsafe.struct_typedef2
+    , Example.Unsafe.struct_typedef3
+    , Example.Unsafe.struct_name1
+    , Example.Unsafe.struct_name2
+    , Example.Unsafe.struct_name3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/macro_in_fundecl_vs_typedef.h>"
+  , "char hs_bindgen_df7e2b8e86de411a ("
+  , "  MC arg1,"
+  , "  TC arg2"
+  , ")"
+  , "{"
+  , "  return (quux1)(arg1, arg2);"
+  , "}"
+  , "TC hs_bindgen_6f0b13ed02b696df ("
+  , "  MC arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return (quux2)(arg1, arg2);"
+  , "}"
+  , "MC *hs_bindgen_f92059cc98dde342 ("
+  , "  float arg1,"
+  , "  TC *arg2"
+  , ")"
+  , "{"
+  , "  return (wam1)(arg1, arg2);"
+  , "}"
+  , "TC *hs_bindgen_3e6ecd1b2cc616bc ("
+  , "  float arg1,"
+  , "  MC *arg2"
+  , ")"
+  , "{"
+  , "  return (wam2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ffa9d5a3e8f0f221 ("
+  , "  struct2 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4801667560542114 ("
+  , "  struct3_t *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_04fa5bbd479146eb ("
+  , "  struct4 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_typedef3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_08025fd0bd589ac2 ("
+  , "  struct struct1 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_name1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9de286608f952fc7 ("
+  , "  struct struct3 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_name2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_38cce6bb1ac71578 ("
+  , "  struct struct4 *arg1,"
+  , "  MC arg2"
+  , ")"
+  , "{"
+  , "  (struct_name3)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+foreign import ccall unsafe "hs_bindgen_df7e2b8e86de411a" hs_bindgen_df7e2b8e86de411a_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+hs_bindgen_df7e2b8e86de411a ::
+     MC
+  -> TC
+  -> IO BG.CChar
+hs_bindgen_df7e2b8e86de411a =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_df7e2b8e86de411a_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1 ::
+     MC
+     -- ^ __C declaration:__ @x@
+  -> TC
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CChar
+quux1 = hs_bindgen_df7e2b8e86de411a
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+foreign import ccall unsafe "hs_bindgen_6f0b13ed02b696df" hs_bindgen_6f0b13ed02b696df_base ::
+     BG.CChar
+  -> BG.CChar
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+hs_bindgen_6f0b13ed02b696df ::
+     MC
+  -> BG.CChar
+  -> IO TC
+hs_bindgen_6f0b13ed02b696df =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_6f0b13ed02b696df_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2 ::
+     MC
+     -- ^ __C declaration:__ @x@
+  -> BG.CChar
+     -- ^ __C declaration:__ @y@
+  -> IO TC
+quux2 = hs_bindgen_6f0b13ed02b696df
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+foreign import ccall unsafe "hs_bindgen_f92059cc98dde342" hs_bindgen_f92059cc98dde342_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+hs_bindgen_f92059cc98dde342 ::
+     BG.CFloat
+  -> BG.Ptr TC
+  -> IO (BG.Ptr MC)
+hs_bindgen_f92059cc98dde342 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_f92059cc98dde342_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr TC
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr MC)
+wam1 = hs_bindgen_f92059cc98dde342
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+foreign import ccall unsafe "hs_bindgen_3e6ecd1b2cc616bc" hs_bindgen_3e6ecd1b2cc616bc_base ::
+     BG.CFloat
+  -> BG.Ptr BG.Void
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+hs_bindgen_3e6ecd1b2cc616bc ::
+     BG.CFloat
+  -> BG.Ptr MC
+  -> IO (BG.Ptr TC)
+hs_bindgen_3e6ecd1b2cc616bc =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_3e6ecd1b2cc616bc_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> BG.Ptr MC
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr TC)
+wam2 = hs_bindgen_3e6ecd1b2cc616bc
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_ffa9d5a3e8f0f221" hs_bindgen_ffa9d5a3e8f0f221_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+hs_bindgen_ffa9d5a3e8f0f221 ::
+     BG.Ptr Struct2
+  -> MC
+  -> IO ()
+hs_bindgen_ffa9d5a3e8f0f221 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ffa9d5a3e8f0f221_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1 ::
+     BG.Ptr Struct2
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef1 = hs_bindgen_ffa9d5a3e8f0f221
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_4801667560542114" hs_bindgen_4801667560542114_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+hs_bindgen_4801667560542114 ::
+     BG.Ptr Struct3_t
+  -> MC
+  -> IO ()
+hs_bindgen_4801667560542114 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4801667560542114_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2 ::
+     BG.Ptr Struct3_t
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef2 = hs_bindgen_4801667560542114
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_04fa5bbd479146eb" hs_bindgen_04fa5bbd479146eb_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+hs_bindgen_04fa5bbd479146eb ::
+     BG.Ptr Struct4
+  -> MC
+  -> IO ()
+hs_bindgen_04fa5bbd479146eb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_04fa5bbd479146eb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_typedef3 = hs_bindgen_04fa5bbd479146eb
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+foreign import ccall unsafe "hs_bindgen_08025fd0bd589ac2" hs_bindgen_08025fd0bd589ac2_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+hs_bindgen_08025fd0bd589ac2 ::
+     BG.Ptr Struct1
+  -> MC
+  -> IO ()
+hs_bindgen_08025fd0bd589ac2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_08025fd0bd589ac2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1 ::
+     BG.Ptr Struct1
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name1 = hs_bindgen_08025fd0bd589ac2
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+foreign import ccall unsafe "hs_bindgen_9de286608f952fc7" hs_bindgen_9de286608f952fc7_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+hs_bindgen_9de286608f952fc7 ::
+     BG.Ptr Struct3
+  -> MC
+  -> IO ()
+hs_bindgen_9de286608f952fc7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9de286608f952fc7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2 ::
+     BG.Ptr Struct3
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name2 = hs_bindgen_9de286608f952fc7
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+foreign import ccall unsafe "hs_bindgen_38cce6bb1ac71578" hs_bindgen_38cce6bb1ac71578_base ::
+     BG.Ptr BG.Void
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+hs_bindgen_38cce6bb1ac71578 ::
+     BG.Ptr Struct4
+  -> MC
+  -> IO ()
+hs_bindgen_38cce6bb1ac71578 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_38cce6bb1ac71578_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3 ::
+     BG.Ptr Struct4
+     -- ^ __C declaration:__ @s@
+  -> MC
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+struct_name3 = hs_bindgen_38cce6bb1ac71578
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/bindingspec.yaml
@@ -0,0 +1,195 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: macro MC
+  hsname: MC
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: TC
+  hsname: TC
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct1
+  hsname: Struct1
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct2
+  hsname: Struct2
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct2
+  hsname: Struct2
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct3
+  hsname: Struct3
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct3_t
+  hsname: Struct3_t
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct struct4
+  hsname: Struct4
+- headers: macros/macro_in_fundecl_vs_typedef.h
+  cname: struct4
+  hsname: Struct4
+hstypes:
+- hsname: MC
+  representation:
+    newtype:
+      constructor: MC
+      fields:
+      - unwrapMC
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct1
+  representation:
+    record:
+      constructor: Struct1
+      fields:
+      - struct1_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct2
+  representation:
+    record:
+      constructor: Struct2
+      fields:
+      - struct2_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct3
+  representation:
+    record:
+      constructor: Struct3
+      fields:
+      - struct3_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct3_t
+  representation:
+    newtype:
+      constructor: Struct3_t
+      fields:
+      - unwrapStruct3_t
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct4
+  representation:
+    record:
+      constructor: Struct4
+      fields:
+      - struct4_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TC
+  representation:
+    newtype:
+      constructor: TC
+      fields:
+      - unwrapTC
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/th.txt b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_in_fundecl_vs_typedef/th.txt
@@ -0,0 +1,1135 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_in_fundecl_vs_typedef.h
+-- #include <macros/macro_in_fundecl_vs_typedef.h>
+-- char hs_bindgen_02e0e3b28d470fd4 (
+--   MC arg1,
+--   TC arg2
+-- )
+-- {
+--   return (quux1)(arg1, arg2);
+-- }
+-- TC hs_bindgen_bb79188c8775e2e4 (
+--   MC arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux2)(arg1, arg2);
+-- }
+-- MC *hs_bindgen_a398fb73645271c5 (
+--   float arg1,
+--   TC *arg2
+-- )
+-- {
+--   return (wam1)(arg1, arg2);
+-- }
+-- TC *hs_bindgen_ad904da072e0711e (
+--   float arg1,
+--   MC *arg2
+-- )
+-- {
+--   return (wam2)(arg1, arg2);
+-- }
+-- void hs_bindgen_88e976dc10571000 (
+--   struct2 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_typedef1)(arg1, arg2);
+-- }
+-- void hs_bindgen_edb3806d45d7605b (
+--   struct3_t *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_typedef2)(arg1, arg2);
+-- }
+-- void hs_bindgen_7c7f3ab0dd790fe8 (
+--   struct4 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_typedef3)(arg1, arg2);
+-- }
+-- void hs_bindgen_2cfbb4f5834d4bcb (
+--   struct struct1 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_name1)(arg1, arg2);
+-- }
+-- void hs_bindgen_c8b765fa70f95167 (
+--   struct struct3 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_name2)(arg1, arg2);
+-- }
+-- void hs_bindgen_0ff3632971f092bb (
+--   struct struct4 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_name3)(arg1, arg2);
+-- }
+-- char hs_bindgen_df7e2b8e86de411a (
+--   MC arg1,
+--   TC arg2
+-- )
+-- {
+--   return (quux1)(arg1, arg2);
+-- }
+-- TC hs_bindgen_6f0b13ed02b696df (
+--   MC arg1,
+--   char arg2
+-- )
+-- {
+--   return (quux2)(arg1, arg2);
+-- }
+-- MC *hs_bindgen_f92059cc98dde342 (
+--   float arg1,
+--   TC *arg2
+-- )
+-- {
+--   return (wam1)(arg1, arg2);
+-- }
+-- TC *hs_bindgen_3e6ecd1b2cc616bc (
+--   float arg1,
+--   MC *arg2
+-- )
+-- {
+--   return (wam2)(arg1, arg2);
+-- }
+-- void hs_bindgen_ffa9d5a3e8f0f221 (
+--   struct2 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_typedef1)(arg1, arg2);
+-- }
+-- void hs_bindgen_4801667560542114 (
+--   struct3_t *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_typedef2)(arg1, arg2);
+-- }
+-- void hs_bindgen_04fa5bbd479146eb (
+--   struct4 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_typedef3)(arg1, arg2);
+-- }
+-- void hs_bindgen_08025fd0bd589ac2 (
+--   struct struct1 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_name1)(arg1, arg2);
+-- }
+-- void hs_bindgen_9de286608f952fc7 (
+--   struct struct3 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_name2)(arg1, arg2);
+-- }
+-- void hs_bindgen_38cce6bb1ac71578 (
+--   struct struct4 *arg1,
+--   MC arg2
+-- )
+-- {
+--   (struct_name3)(arg1, arg2);
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1 */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_8c77c87c8985f5b4 (void)) (
+--   MC arg1,
+--   TC arg2
+-- )
+-- {
+--   return &quux1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2 */
+-- __attribute__ ((const))
+-- TC (*hs_bindgen_ad1c057fd2e38491 (void)) (
+--   MC arg1,
+--   char arg2
+-- )
+-- {
+--   return &quux2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1 */
+-- __attribute__ ((const))
+-- MC *(*hs_bindgen_05b0ef45be2bc377 (void)) (
+--   float arg1,
+--   TC *arg2
+-- )
+-- {
+--   return &wam1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2 */
+-- __attribute__ ((const))
+-- TC *(*hs_bindgen_cd643a7a3c18ccf6 (void)) (
+--   float arg1,
+--   MC *arg2
+-- )
+-- {
+--   return &wam2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0322539d81aee229 (void)) (
+--   struct2 *arg1,
+--   MC arg2
+-- )
+-- {
+--   return &struct_typedef1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8522498cba39ada6 (void)) (
+--   struct3_t *arg1,
+--   MC arg2
+-- )
+-- {
+--   return &struct_typedef2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e19fc7f7dee46424 (void)) (
+--   struct4 *arg1,
+--   MC arg2
+-- )
+-- {
+--   return &struct_typedef3;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_00f81edda453ec64 (void)) (
+--   struct struct1 *arg1,
+--   MC arg2
+-- )
+-- {
+--   return &struct_name1;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8f4de3d502f3466d (void)) (
+--   struct struct3 *arg1,
+--   MC arg2
+-- )
+-- {
+--   return &struct_name2;
+-- }
+-- /* test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ba133ae0ff062248 (void)) (
+--   struct struct4 *arg1,
+--   MC arg2
+-- )
+-- {
+--   return &struct_name3;
+-- }
+{-| __C declaration:__ @macro MC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 4:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype MC
+    = MC {unwrapMC :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapMC" MC ty
+    where hasField = \x_0 -> (\y_1 -> MC{unwrapMC = y_1},
+                              getField @"unwrapMC" x_0)
+instance (~) ty CChar => HasField "unwrapMC" (Ptr MC) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMC")
+instance HasCField MC "unwrapMC"
+    where type CFieldType MC "unwrapMC" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @TC@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 5:14@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype TC
+    = TC {unwrapTC :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapTC" TC ty
+    where hasField = \x_0 -> (\y_1 -> TC{unwrapTC = y_1},
+                              getField @"unwrapTC" x_0)
+instance (~) ty CChar => HasField "unwrapTC" (Ptr TC) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTC")
+instance HasCField TC "unwrapTC"
+    where type CFieldType TC "unwrapTC" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct1
+    = Struct1 {struct1_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 18:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct1
+    where readRaw = \ptr_0 -> pure Struct1 <*> readRaw (Proxy @"struct1_a") ptr_0
+instance WriteRaw Struct1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct1 struct1_a_2 -> writeRaw (Proxy @"struct1_a") ptr_0 struct1_a_2
+deriving via (EquivStorable Struct1) instance Storable Struct1
+deriving via (IsStructViaReadRaw Struct1) instance IsStruct Struct1
+instance (~) ty CInt => HasField "struct1_a" Struct1 ty
+    where hasField = \x_0 -> (\y_1 -> Struct1{struct1_a = y_1},
+                              getField @"struct1_a" x_0)
+instance (~) ty CInt => HasField "struct1_a" (Ptr Struct1) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct1_a")
+instance HasCField Struct1 "struct1_a"
+    where type CFieldType Struct1 "struct1_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:9@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct2
+    = Struct2 {struct2_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 19:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct2
+    where readRaw = \ptr_0 -> pure Struct2 <*> readRaw (Proxy @"struct2_a") ptr_0
+instance WriteRaw Struct2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct2 struct2_a_2 -> writeRaw (Proxy @"struct2_a") ptr_0 struct2_a_2
+deriving via (EquivStorable Struct2) instance Storable Struct2
+deriving via (IsStructViaReadRaw Struct2) instance IsStruct Struct2
+instance (~) ty CInt => HasField "struct2_a" Struct2 ty
+    where hasField = \x_0 -> (\y_1 -> Struct2{struct2_a = y_1},
+                              getField @"struct2_a" x_0)
+instance (~) ty CInt => HasField "struct2_a" (Ptr Struct2) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct2_a")
+instance HasCField Struct2 "struct2_a"
+    where type CFieldType Struct2 "struct2_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct3
+    = Struct3 {struct3_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct3
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct3
+    where readRaw = \ptr_0 -> pure Struct3 <*> readRaw (Proxy @"struct3_a") ptr_0
+instance WriteRaw Struct3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct3 struct3_a_2 -> writeRaw (Proxy @"struct3_a") ptr_0 struct3_a_2
+deriving via (EquivStorable Struct3) instance Storable Struct3
+deriving via (IsStructViaReadRaw Struct3) instance IsStruct Struct3
+instance (~) ty CInt => HasField "struct3_a" Struct3 ty
+    where hasField = \x_0 -> (\y_1 -> Struct3{struct3_a = y_1},
+                              getField @"struct3_a" x_0)
+instance (~) ty CInt => HasField "struct3_a" (Ptr Struct3) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct3_a")
+instance HasCField Struct3 "struct3_a"
+    where type CFieldType Struct3 "struct3_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct3_t@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 20:35@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+newtype Struct3_t
+    = Struct3_t {unwrapStruct3_t :: Struct3}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty Struct3 => HasField "unwrapStruct3_t" Struct3_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct3_t{unwrapStruct3_t = y_1},
+                              getField @"unwrapStruct3_t" x_0)
+instance (~) ty Struct3 =>
+         HasField "unwrapStruct3_t" (Ptr Struct3_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct3_t")
+instance HasCField Struct3_t "unwrapStruct3_t"
+    where type CFieldType Struct3_t "unwrapStruct3_t" = Struct3
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:16@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+data Struct4
+    = Struct4 {struct4_a :: CInt
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 21:30@
+
+                    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct4
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct4
+    where readRaw = \ptr_0 -> pure Struct4 <*> readRaw (Proxy @"struct4_a") ptr_0
+instance WriteRaw Struct4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct4 struct4_a_2 -> writeRaw (Proxy @"struct4_a") ptr_0 struct4_a_2
+deriving via (EquivStorable Struct4) instance Storable Struct4
+deriving via (IsStructViaReadRaw Struct4) instance IsStruct Struct4
+instance (~) ty CInt => HasField "struct4_a" Struct4 ty
+    where hasField = \x_0 -> (\y_1 -> Struct4{struct4_a = y_1},
+                              getField @"struct4_a" x_0)
+instance (~) ty CInt => HasField "struct4_a" (Ptr Struct4) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct4_a")
+instance HasCField Struct4 "struct4_a"
+    where type CFieldType Struct4 "struct4_a" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+foreign import ccall safe "hs_bindgen_02e0e3b28d470fd4" hs_bindgen_02e0e3b28d470fd4_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+hs_bindgen_02e0e3b28d470fd4 :: MC -> TC -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux1@
+hs_bindgen_02e0e3b28d470fd4 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_02e0e3b28d470fd4_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_safe :: MC -> TC -> IO CChar
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_safe = hs_bindgen_02e0e3b28d470fd4
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+foreign import ccall safe "hs_bindgen_bb79188c8775e2e4" hs_bindgen_bb79188c8775e2e4_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+hs_bindgen_bb79188c8775e2e4 :: MC -> CChar -> IO TC
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_quux2@
+hs_bindgen_bb79188c8775e2e4 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_bb79188c8775e2e4_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_safe :: MC -> CChar -> IO TC
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_safe = hs_bindgen_bb79188c8775e2e4
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+foreign import ccall safe "hs_bindgen_a398fb73645271c5" hs_bindgen_a398fb73645271c5_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+hs_bindgen_a398fb73645271c5 :: CFloat -> Ptr TC -> IO (Ptr MC)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam1@
+hs_bindgen_a398fb73645271c5 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_a398fb73645271c5_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_safe :: CFloat -> Ptr TC -> IO (Ptr MC)
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_safe = hs_bindgen_a398fb73645271c5
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+foreign import ccall safe "hs_bindgen_ad904da072e0711e" hs_bindgen_ad904da072e0711e_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+hs_bindgen_ad904da072e0711e :: CFloat -> Ptr MC -> IO (Ptr TC)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_wam2@
+hs_bindgen_ad904da072e0711e = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_ad904da072e0711e_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_safe :: CFloat -> Ptr MC -> IO (Ptr TC)
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_safe = hs_bindgen_ad904da072e0711e
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+foreign import ccall safe "hs_bindgen_88e976dc10571000" hs_bindgen_88e976dc10571000_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+hs_bindgen_88e976dc10571000 :: Ptr Struct2 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef1@
+hs_bindgen_88e976dc10571000 = \x_0 -> \x_1 -> hs_bindgen_88e976dc10571000_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_safe :: Ptr Struct2 -> MC -> IO ()
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_safe = hs_bindgen_88e976dc10571000
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+foreign import ccall safe "hs_bindgen_edb3806d45d7605b" hs_bindgen_edb3806d45d7605b_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+hs_bindgen_edb3806d45d7605b :: Ptr Struct3_t -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef2@
+hs_bindgen_edb3806d45d7605b = \x_0 -> \x_1 -> hs_bindgen_edb3806d45d7605b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_safe :: Ptr Struct3_t -> MC -> IO ()
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_safe = hs_bindgen_edb3806d45d7605b
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+foreign import ccall safe "hs_bindgen_7c7f3ab0dd790fe8" hs_bindgen_7c7f3ab0dd790fe8_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+hs_bindgen_7c7f3ab0dd790fe8 :: Ptr Struct4 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_typedef3@
+hs_bindgen_7c7f3ab0dd790fe8 = \x_0 -> \x_1 -> hs_bindgen_7c7f3ab0dd790fe8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_safe :: Ptr Struct4 -> MC -> IO ()
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_safe = hs_bindgen_7c7f3ab0dd790fe8
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+foreign import ccall safe "hs_bindgen_2cfbb4f5834d4bcb" hs_bindgen_2cfbb4f5834d4bcb_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+hs_bindgen_2cfbb4f5834d4bcb :: Ptr Struct1 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name1@
+hs_bindgen_2cfbb4f5834d4bcb = \x_0 -> \x_1 -> hs_bindgen_2cfbb4f5834d4bcb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_safe :: Ptr Struct1 -> MC -> IO ()
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_safe = hs_bindgen_2cfbb4f5834d4bcb
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+foreign import ccall safe "hs_bindgen_c8b765fa70f95167" hs_bindgen_c8b765fa70f95167_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+hs_bindgen_c8b765fa70f95167 :: Ptr Struct3 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name2@
+hs_bindgen_c8b765fa70f95167 = \x_0 -> \x_1 -> hs_bindgen_c8b765fa70f95167_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_safe :: Ptr Struct3 -> MC -> IO ()
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_safe = hs_bindgen_c8b765fa70f95167
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+foreign import ccall safe "hs_bindgen_0ff3632971f092bb" hs_bindgen_0ff3632971f092bb_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+hs_bindgen_0ff3632971f092bb :: Ptr Struct4 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Safe_struct_name3@
+hs_bindgen_0ff3632971f092bb = \x_0 -> \x_1 -> hs_bindgen_0ff3632971f092bb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_safe :: Ptr Struct4 -> MC -> IO ()
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_safe = hs_bindgen_0ff3632971f092bb
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+foreign import ccall unsafe "hs_bindgen_df7e2b8e86de411a" hs_bindgen_df7e2b8e86de411a_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+hs_bindgen_df7e2b8e86de411a :: MC -> TC -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux1@
+hs_bindgen_df7e2b8e86de411a = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_df7e2b8e86de411a_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_unsafe :: MC -> TC -> IO CChar
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_unsafe = hs_bindgen_df7e2b8e86de411a
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+foreign import ccall unsafe "hs_bindgen_6f0b13ed02b696df" hs_bindgen_6f0b13ed02b696df_base ::
+    CChar
+ -> CChar
+ -> IO CChar
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+hs_bindgen_6f0b13ed02b696df :: MC -> CChar -> IO TC
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_quux2@
+hs_bindgen_6f0b13ed02b696df = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_6f0b13ed02b696df_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_unsafe :: MC -> CChar -> IO TC
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_unsafe = hs_bindgen_6f0b13ed02b696df
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+foreign import ccall unsafe "hs_bindgen_f92059cc98dde342" hs_bindgen_f92059cc98dde342_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+hs_bindgen_f92059cc98dde342 :: CFloat -> Ptr TC -> IO (Ptr MC)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam1@
+hs_bindgen_f92059cc98dde342 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_f92059cc98dde342_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_unsafe :: CFloat -> Ptr TC -> IO (Ptr MC)
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_unsafe = hs_bindgen_f92059cc98dde342
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+foreign import ccall unsafe "hs_bindgen_3e6ecd1b2cc616bc" hs_bindgen_3e6ecd1b2cc616bc_base ::
+    CFloat
+ -> Ptr Void
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+hs_bindgen_3e6ecd1b2cc616bc :: CFloat -> Ptr MC -> IO (Ptr TC)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_wam2@
+hs_bindgen_3e6ecd1b2cc616bc = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_3e6ecd1b2cc616bc_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_unsafe :: CFloat -> Ptr MC -> IO (Ptr TC)
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_unsafe = hs_bindgen_3e6ecd1b2cc616bc
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_ffa9d5a3e8f0f221" hs_bindgen_ffa9d5a3e8f0f221_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+hs_bindgen_ffa9d5a3e8f0f221 :: Ptr Struct2 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef1@
+hs_bindgen_ffa9d5a3e8f0f221 = \x_0 -> \x_1 -> hs_bindgen_ffa9d5a3e8f0f221_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_unsafe :: Ptr Struct2 -> MC -> IO ()
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_unsafe = hs_bindgen_ffa9d5a3e8f0f221
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_4801667560542114" hs_bindgen_4801667560542114_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+hs_bindgen_4801667560542114 :: Ptr Struct3_t -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef2@
+hs_bindgen_4801667560542114 = \x_0 -> \x_1 -> hs_bindgen_4801667560542114_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_unsafe :: Ptr Struct3_t -> MC -> IO ()
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_unsafe = hs_bindgen_4801667560542114
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_04fa5bbd479146eb" hs_bindgen_04fa5bbd479146eb_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+hs_bindgen_04fa5bbd479146eb :: Ptr Struct4 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_typedef3@
+hs_bindgen_04fa5bbd479146eb = \x_0 -> \x_1 -> hs_bindgen_04fa5bbd479146eb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_unsafe :: Ptr Struct4 -> MC -> IO ()
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_unsafe = hs_bindgen_04fa5bbd479146eb
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+foreign import ccall unsafe "hs_bindgen_08025fd0bd589ac2" hs_bindgen_08025fd0bd589ac2_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+hs_bindgen_08025fd0bd589ac2 :: Ptr Struct1 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name1@
+hs_bindgen_08025fd0bd589ac2 = \x_0 -> \x_1 -> hs_bindgen_08025fd0bd589ac2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_unsafe :: Ptr Struct1 -> MC -> IO ()
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_unsafe = hs_bindgen_08025fd0bd589ac2
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+foreign import ccall unsafe "hs_bindgen_9de286608f952fc7" hs_bindgen_9de286608f952fc7_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+hs_bindgen_9de286608f952fc7 :: Ptr Struct3 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name2@
+hs_bindgen_9de286608f952fc7 = \x_0 -> \x_1 -> hs_bindgen_9de286608f952fc7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_unsafe :: Ptr Struct3 -> MC -> IO ()
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_unsafe = hs_bindgen_9de286608f952fc7
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+foreign import ccall unsafe "hs_bindgen_38cce6bb1ac71578" hs_bindgen_38cce6bb1ac71578_base ::
+    Ptr Void
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+hs_bindgen_38cce6bb1ac71578 :: Ptr Struct4 -> MC -> IO ()
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_Unsafe_struct_name3@
+hs_bindgen_38cce6bb1ac71578 = \x_0 -> \x_1 -> hs_bindgen_38cce6bb1ac71578_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_unsafe :: Ptr Struct4 -> MC -> IO ()
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_unsafe = hs_bindgen_38cce6bb1ac71578
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+foreign import ccall unsafe "hs_bindgen_8c77c87c8985f5b4" hs_bindgen_8c77c87c8985f5b4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+hs_bindgen_8c77c87c8985f5b4 :: IO (FunPtr (MC -> TC -> IO CChar))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux1@
+hs_bindgen_8c77c87c8985f5b4 = fmap fromFFIType hs_bindgen_8c77c87c8985f5b4_base
+{-# NOINLINE quux1_funptr #-}
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_funptr :: FunPtr (MC -> TC -> IO CChar)
+{-| __C declaration:__ @quux1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 8:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux1_funptr = unsafePerformIO hs_bindgen_8c77c87c8985f5b4
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+foreign import ccall unsafe "hs_bindgen_ad1c057fd2e38491" hs_bindgen_ad1c057fd2e38491_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+hs_bindgen_ad1c057fd2e38491 :: IO (FunPtr (MC -> CChar -> IO TC))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_quux2@
+hs_bindgen_ad1c057fd2e38491 = fmap fromFFIType hs_bindgen_ad1c057fd2e38491_base
+{-# NOINLINE quux2_funptr #-}
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_funptr :: FunPtr (MC -> CChar -> IO TC)
+{-| __C declaration:__ @quux2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 9:4@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+quux2_funptr = unsafePerformIO hs_bindgen_ad1c057fd2e38491
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+foreign import ccall unsafe "hs_bindgen_05b0ef45be2bc377" hs_bindgen_05b0ef45be2bc377_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+hs_bindgen_05b0ef45be2bc377 :: IO (FunPtr (CFloat ->
+                                           Ptr TC -> IO (Ptr MC)))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam1@
+hs_bindgen_05b0ef45be2bc377 = fmap fromFFIType hs_bindgen_05b0ef45be2bc377_base
+{-# NOINLINE wam1_funptr #-}
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_funptr :: FunPtr (CFloat -> Ptr TC -> IO (Ptr MC))
+{-| __C declaration:__ @wam1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 10:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam1_funptr = unsafePerformIO hs_bindgen_05b0ef45be2bc377
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+foreign import ccall unsafe "hs_bindgen_cd643a7a3c18ccf6" hs_bindgen_cd643a7a3c18ccf6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+hs_bindgen_cd643a7a3c18ccf6 :: IO (FunPtr (CFloat ->
+                                           Ptr MC -> IO (Ptr TC)))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_wam2@
+hs_bindgen_cd643a7a3c18ccf6 = fmap fromFFIType hs_bindgen_cd643a7a3c18ccf6_base
+{-# NOINLINE wam2_funptr #-}
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_funptr :: FunPtr (CFloat -> Ptr MC -> IO (Ptr TC))
+{-| __C declaration:__ @wam2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 11:5@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+wam2_funptr = unsafePerformIO hs_bindgen_cd643a7a3c18ccf6
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+foreign import ccall unsafe "hs_bindgen_0322539d81aee229" hs_bindgen_0322539d81aee229_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+hs_bindgen_0322539d81aee229 :: IO (FunPtr (Ptr Struct2 ->
+                                           MC -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef1@
+hs_bindgen_0322539d81aee229 = fmap fromFFIType hs_bindgen_0322539d81aee229_base
+{-# NOINLINE struct_typedef1_funptr #-}
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_funptr :: FunPtr (Ptr Struct2 -> MC -> IO ())
+{-| __C declaration:__ @struct_typedef1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 23:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef1_funptr = unsafePerformIO hs_bindgen_0322539d81aee229
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+foreign import ccall unsafe "hs_bindgen_8522498cba39ada6" hs_bindgen_8522498cba39ada6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+hs_bindgen_8522498cba39ada6 :: IO (FunPtr (Ptr Struct3_t ->
+                                           MC -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef2@
+hs_bindgen_8522498cba39ada6 = fmap fromFFIType hs_bindgen_8522498cba39ada6_base
+{-# NOINLINE struct_typedef2_funptr #-}
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_funptr :: FunPtr (Ptr Struct3_t -> MC -> IO ())
+{-| __C declaration:__ @struct_typedef2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 24:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef2_funptr = unsafePerformIO hs_bindgen_8522498cba39ada6
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+foreign import ccall unsafe "hs_bindgen_e19fc7f7dee46424" hs_bindgen_e19fc7f7dee46424_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+hs_bindgen_e19fc7f7dee46424 :: IO (FunPtr (Ptr Struct4 ->
+                                           MC -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_typedef3@
+hs_bindgen_e19fc7f7dee46424 = fmap fromFFIType hs_bindgen_e19fc7f7dee46424_base
+{-# NOINLINE struct_typedef3_funptr #-}
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_funptr :: FunPtr (Ptr Struct4 -> MC -> IO ())
+{-| __C declaration:__ @struct_typedef3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 25:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_typedef3_funptr = unsafePerformIO hs_bindgen_e19fc7f7dee46424
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+foreign import ccall unsafe "hs_bindgen_00f81edda453ec64" hs_bindgen_00f81edda453ec64_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+hs_bindgen_00f81edda453ec64 :: IO (FunPtr (Ptr Struct1 ->
+                                           MC -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name1@
+hs_bindgen_00f81edda453ec64 = fmap fromFFIType hs_bindgen_00f81edda453ec64_base
+{-# NOINLINE struct_name1_funptr #-}
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_funptr :: FunPtr (Ptr Struct1 -> MC -> IO ())
+{-| __C declaration:__ @struct_name1@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 27:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name1_funptr = unsafePerformIO hs_bindgen_00f81edda453ec64
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+foreign import ccall unsafe "hs_bindgen_8f4de3d502f3466d" hs_bindgen_8f4de3d502f3466d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+hs_bindgen_8f4de3d502f3466d :: IO (FunPtr (Ptr Struct3 ->
+                                           MC -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name2@
+hs_bindgen_8f4de3d502f3466d = fmap fromFFIType hs_bindgen_8f4de3d502f3466d_base
+{-# NOINLINE struct_name2_funptr #-}
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_funptr :: FunPtr (Ptr Struct3 -> MC -> IO ())
+{-| __C declaration:__ @struct_name2@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 28:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name2_funptr = unsafePerformIO hs_bindgen_8f4de3d502f3466d
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+foreign import ccall unsafe "hs_bindgen_ba133ae0ff062248" hs_bindgen_ba133ae0ff062248_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+hs_bindgen_ba133ae0ff062248 :: IO (FunPtr (Ptr Struct4 ->
+                                           MC -> IO ()))
+-- __unique:__ @test_macrosmacro_in_fundecl_vs_typ_Example_get_struct_name3@
+hs_bindgen_ba133ae0ff062248 = fmap fromFFIType hs_bindgen_ba133ae0ff062248_base
+{-# NOINLINE struct_name3_funptr #-}
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_funptr :: FunPtr (Ptr Struct4 -> MC -> IO ())
+{-| __C declaration:__ @struct_name3@
+
+    __defined at:__ @macros\/macro_in_fundecl_vs_typedef.h 29:6@
+
+    __exported by:__ @macros\/macro_in_fundecl_vs_typedef.h@
+-}
+struct_name3_funptr = unsafePerformIO hs_bindgen_ba133ae0ff062248
diff --git a/test-artefacts/fixtures/macros/macro_redefines_global.1.empty/Example.hs b/test-artefacts/fixtures/macros/macro_redefines_global.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_redefines_global.1.empty/Example.hs
@@ -0,0 +1,71 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.FILE(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @FILE@
+
+    __defined at:__ @macros\/macro_redefines_global.h 7:13@
+
+    __exported by:__ @macros\/macro_redefines_global.h@
+-}
+newtype FILE = FILE
+  { unwrapFILE :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapFILE" FILE ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         FILE {unwrapFILE = y1}, BG.getField @"unwrapFILE" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapFILE" (BG.Ptr FILE) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFILE")
+
+instance HasCField.HasCField FILE "unwrapFILE" where
+
+  type CFieldType FILE "unwrapFILE" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_redefines_global.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_redefines_global.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_redefines_global.1.empty/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_redefines_global.h
+  cname: FILE
+  hsname: FILE
+hstypes:
+- hsname: FILE
+  representation:
+    newtype:
+      constructor: FILE
+      fields:
+      - unwrapFILE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_redefines_global.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_redefines_global.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_redefines_global.1.empty/th.txt
@@ -0,0 +1,33 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_redefines_global.h
+{-| __C declaration:__ @FILE@
+
+    __defined at:__ @macros\/macro_redefines_global.h 7:13@
+
+    __exported by:__ @macros\/macro_redefines_global.h@
+-}
+newtype FILE
+    = FILE {unwrapFILE :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapFILE" FILE ty
+    where hasField = \x_0 -> (\y_1 -> FILE{unwrapFILE = y_1},
+                              getField @"unwrapFILE" x_0)
+instance (~) ty CInt => HasField "unwrapFILE" (Ptr FILE) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFILE")
+instance HasCField FILE "unwrapFILE"
+    where type CFieldType FILE "unwrapFILE" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_redefines_global.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_redefines_global.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_redefines_global.2.raw/Example.hs
@@ -0,0 +1,71 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.FILE(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @FILE@
+
+    __defined at:__ @macros\/macro_redefines_global.h 7:13@
+
+    __exported by:__ @macros\/macro_redefines_global.h@
+-}
+newtype FILE = FILE
+  { unwrapFILE :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapFILE" FILE ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         FILE {unwrapFILE = y1}, BG.getField @"unwrapFILE" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapFILE" (BG.Ptr FILE) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFILE")
+
+instance HasCField.HasCField FILE "unwrapFILE" where
+
+  type CFieldType FILE "unwrapFILE" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_redefines_global.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_redefines_global.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_redefines_global.2.raw/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_redefines_global.h
+  cname: FILE
+  hsname: FILE
+hstypes:
+- hsname: FILE
+  representation:
+    newtype:
+      constructor: FILE
+      fields:
+      - unwrapFILE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_redefines_global.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_redefines_global.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_redefines_global.2.raw/th.txt
@@ -0,0 +1,33 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_redefines_global.h
+{-| __C declaration:__ @FILE@
+
+    __defined at:__ @macros\/macro_redefines_global.h 7:13@
+
+    __exported by:__ @macros\/macro_redefines_global.h@
+-}
+newtype FILE
+    = FILE {unwrapFILE :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapFILE" FILE ty
+    where hasField = \x_0 -> (\y_1 -> FILE{unwrapFILE = y_1},
+                              getField @"unwrapFILE" x_0)
+instance (~) ty CInt => HasField "unwrapFILE" (Ptr FILE) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFILE")
+instance HasCField FILE "unwrapFILE"
+    where type CFieldType FILE "unwrapFILE" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_redefines_global/Example.hs b/test-artefacts/fixtures/macros/macro_redefines_global/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_redefines_global/Example.hs
@@ -0,0 +1,71 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.FILE(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @FILE@
+
+    __defined at:__ @macros\/macro_redefines_global.h 7:13@
+
+    __exported by:__ @macros\/macro_redefines_global.h@
+-}
+newtype FILE = FILE
+  { unwrapFILE :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapFILE" FILE ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         FILE {unwrapFILE = y1}, BG.getField @"unwrapFILE" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapFILE" (BG.Ptr FILE) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFILE")
+
+instance HasCField.HasCField FILE "unwrapFILE" where
+
+  type CFieldType FILE "unwrapFILE" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_redefines_global/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_redefines_global/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_redefines_global/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_redefines_global.h
+  cname: FILE
+  hsname: FILE
+hstypes:
+- hsname: FILE
+  representation:
+    newtype:
+      constructor: FILE
+      fields:
+      - unwrapFILE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_redefines_global/th.txt b/test-artefacts/fixtures/macros/macro_redefines_global/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_redefines_global/th.txt
@@ -0,0 +1,33 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_redefines_global.h
+{-| __C declaration:__ @FILE@
+
+    __defined at:__ @macros\/macro_redefines_global.h 7:13@
+
+    __exported by:__ @macros\/macro_redefines_global.h@
+-}
+newtype FILE
+    = FILE {unwrapFILE :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapFILE" FILE ty
+    where hasField = \x_0 -> (\y_1 -> FILE{unwrapFILE = y_1},
+                              getField @"unwrapFILE" x_0)
+instance (~) ty CInt => HasField "unwrapFILE" (Ptr FILE) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFILE")
+instance HasCField FILE "unwrapFILE"
+    where type CFieldType FILE "unwrapFILE" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.default.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.default.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_resolution_log_level.h
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.default.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.2.raw/Example.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.uNRESOLVED_MACRO
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro UNRESOLVED_MACRO@
+
+    __defined at:__ @macros\/macro_resolution_log_level.h 7:9@
+
+    __exported by:__ @macros\/macro_resolution_log_level.h@
+-}
+uNRESOLVED_MACRO :: Macro.Raw String
+uNRESOLVED_MACRO =
+  Macro.objectLike "UNRESOLVED_MACRO" ["struct", "DoesNotExist"]
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.default.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.default.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.default.2.raw/th.txt
@@ -0,0 +1,16 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_resolution_log_level.h
+{-| __C declaration:__ @macro UNRESOLVED_MACRO@
+
+    __defined at:__ @macros\/macro_resolution_log_level.h 7:9@
+
+    __exported by:__ @macros\/macro_resolution_log_level.h@
+-}
+uNRESOLVED_MACRO :: Raw String
+{-| __C declaration:__ @macro UNRESOLVED_MACRO@
+
+    __defined at:__ @macros\/macro_resolution_log_level.h 7:9@
+
+    __exported by:__ @macros\/macro_resolution_log_level.h@
+-}
+uNRESOLVED_MACRO = objectLike "UNRESOLVED_MACRO" ["struct",
+                                                  "DoesNotExist"]
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.default/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_resolution_log_level.default/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.default/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.default/th.txt b/test-artefacts/fixtures/macros/macro_resolution_log_level.default/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.default/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_resolution_log_level.h
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_resolution_log_level.h
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.2.raw/Example.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.uNRESOLVED_MACRO
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro UNRESOLVED_MACRO@
+
+    __defined at:__ @macros\/macro_resolution_log_level.h 7:9@
+
+    __exported by:__ @macros\/macro_resolution_log_level.h@
+-}
+uNRESOLVED_MACRO :: Macro.Raw String
+uNRESOLVED_MACRO =
+  Macro.objectLike "UNRESOLVED_MACRO" ["struct", "DoesNotExist"]
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings.2.raw/th.txt
@@ -0,0 +1,16 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_resolution_log_level.h
+{-| __C declaration:__ @macro UNRESOLVED_MACRO@
+
+    __defined at:__ @macros\/macro_resolution_log_level.h 7:9@
+
+    __exported by:__ @macros\/macro_resolution_log_level.h@
+-}
+uNRESOLVED_MACRO :: Raw String
+{-| __C declaration:__ @macro UNRESOLVED_MACRO@
+
+    __defined at:__ @macros\/macro_resolution_log_level.h 7:9@
+
+    __exported by:__ @macros\/macro_resolution_log_level.h@
+-}
+uNRESOLVED_MACRO = objectLike "UNRESOLVED_MACRO" ["struct",
+                                                  "DoesNotExist"]
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings/th.txt b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_resolution_log_level.enable_macro_warnings/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_resolution_log_level.h
diff --git a/test-artefacts/fixtures/macros/macro_strings.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_strings.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_strings.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_strings.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_strings.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_strings.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_strings.h
diff --git a/test-artefacts/fixtures/macros/macro_strings.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_strings.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_strings.2.raw/Example.hs
@@ -0,0 +1,278 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.c1
+    , Example.c2
+    , Example.c3
+    , Example.c4
+    , Example.c5
+    , Example.c6
+    , Example.c7
+    , Example.c8
+    , Example.d
+    , Example.j1
+    , Example.j2
+    , Example.j3
+    , Example.s1
+    , Example.s2
+    , Example.s3
+    , Example.s4
+    , Example.s5
+    , Example.s6
+    , Example.s7
+    , Example.s8
+    , Example.t1
+    , Example.t2
+    , Example.t3
+    , Example.u
+    , Example.v
+    , Example.w1
+    , Example.w2
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro C1@
+
+    __defined at:__ @macros\/macro_strings.h 4:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c1 :: Macro.Raw String
+c1 = Macro.objectLike "C1" ["'a'"]
+
+{-| __C declaration:__ @macro C2@
+
+    __defined at:__ @macros\/macro_strings.h 5:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c2 :: Macro.Raw String
+c2 = Macro.objectLike "C2" ["'\"'"]
+
+{-| __C declaration:__ @macro C3@
+
+    __defined at:__ @macros\/macro_strings.h 6:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c3 :: Macro.Raw String
+c3 = Macro.objectLike "C3" ["'\\t'"]
+
+{-| __C declaration:__ @macro C4@
+
+    __defined at:__ @macros\/macro_strings.h 7:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c4 :: Macro.Raw String
+c4 = Macro.objectLike "C4" ["'\\0'"]
+
+{-| __C declaration:__ @macro C5@
+
+    __defined at:__ @macros\/macro_strings.h 8:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c5 :: Macro.Raw String
+c5 = Macro.objectLike "C5" ["'\\''"]
+
+{-| __C declaration:__ @macro C6@
+
+    __defined at:__ @macros\/macro_strings.h 9:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c6 :: Macro.Raw String
+c6 = Macro.objectLike "C6" ["'\\?'"]
+
+{-| __C declaration:__ @macro C7@
+
+    __defined at:__ @macros\/macro_strings.h 10:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c7 :: Macro.Raw String
+c7 = Macro.objectLike "C7" ["'\\123'"]
+
+{-| __C declaration:__ @macro C8@
+
+    __defined at:__ @macros\/macro_strings.h 11:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c8 :: Macro.Raw String
+c8 = Macro.objectLike "C8" ["'\\x53'"]
+
+{-| __C declaration:__ @macro D@
+
+    __defined at:__ @macros\/macro_strings.h 13:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+d :: Macro.Raw String
+d = Macro.objectLike "D" ["'\\777'"]
+
+{-| __C declaration:__ @macro J1@
+
+    __defined at:__ @macros\/macro_strings.h 15:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+j1 :: Macro.Raw String
+j1 = Macro.objectLike "J1" ["'\12354'"]
+
+{-| __C declaration:__ @macro J2@
+
+    __defined at:__ @macros\/macro_strings.h 16:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+j2 :: Macro.Raw String
+j2 = Macro.objectLike "J2" ["'\\u3042'"]
+
+{-| __C declaration:__ @macro J3@
+
+    __defined at:__ @macros\/macro_strings.h 17:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+j3 :: Macro.Raw String
+j3 = Macro.objectLike "J3" ["'\\xE3\\x81\\x82'"]
+
+{-| __C declaration:__ @macro S1@
+
+    __defined at:__ @macros\/macro_strings.h 20:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s1 :: Macro.Raw String
+s1 = Macro.objectLike "S1" ["\"a\""]
+
+{-| __C declaration:__ @macro S2@
+
+    __defined at:__ @macros\/macro_strings.h 21:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s2 :: Macro.Raw String
+s2 = Macro.objectLike "S2" ["\"'\""]
+
+{-| __C declaration:__ @macro S3@
+
+    __defined at:__ @macros\/macro_strings.h 22:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s3 :: Macro.Raw String
+s3 = Macro.objectLike "S3" ["\"\\t\""]
+
+{-| __C declaration:__ @macro S4@
+
+    __defined at:__ @macros\/macro_strings.h 23:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s4 :: Macro.Raw String
+s4 = Macro.objectLike "S4" ["\"\\0\""]
+
+{-| __C declaration:__ @macro S5@
+
+    __defined at:__ @macros\/macro_strings.h 24:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s5 :: Macro.Raw String
+s5 = Macro.objectLike "S5" ["\"\\'\""]
+
+{-| __C declaration:__ @macro S6@
+
+    __defined at:__ @macros\/macro_strings.h 25:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s6 :: Macro.Raw String
+s6 = Macro.objectLike "S6" ["\"\\?\""]
+
+{-| __C declaration:__ @macro S7@
+
+    __defined at:__ @macros\/macro_strings.h 26:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s7 :: Macro.Raw String
+s7 = Macro.objectLike "S7" ["\"\\123\""]
+
+{-| __C declaration:__ @macro S8@
+
+    __defined at:__ @macros\/macro_strings.h 27:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s8 :: Macro.Raw String
+s8 = Macro.objectLike "S8" ["\"\\x53\""]
+
+{-| __C declaration:__ @macro T1@
+
+    __defined at:__ @macros\/macro_strings.h 29:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t1 :: Macro.Raw String
+t1 = Macro.objectLike "T1" ["\"\12354\""]
+
+{-| __C declaration:__ @macro T2@
+
+    __defined at:__ @macros\/macro_strings.h 30:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t2 :: Macro.Raw String
+t2 = Macro.objectLike "T2" ["\"\\u3042\""]
+
+{-| __C declaration:__ @macro T3@
+
+    __defined at:__ @macros\/macro_strings.h 31:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t3 :: Macro.Raw String
+t3 = Macro.objectLike "T3" ["\"\\xE3\\x81\\x82\""]
+
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @macros\/macro_strings.h 33:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+u :: Macro.Raw String
+u = Macro.objectLike "U" ["\"\\777\\777\\777\\777\""]
+
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @macros\/macro_strings.h 34:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+v :: Macro.Raw String
+v = Macro.objectLike "V" ["\"\\1\\2\\3\\4\\5\\6\""]
+
+{-| __C declaration:__ @macro W1@
+
+    __defined at:__ @macros\/macro_strings.h 36:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w1 :: Macro.Raw String
+w1 = Macro.objectLike "W1" ["\"hij\\0\""]
+
+{-| __C declaration:__ @macro W2@
+
+    __defined at:__ @macros\/macro_strings.h 37:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w2 :: Macro.Raw String
+w2 = Macro.objectLike "W2" ["\"abc\\0def\\0g\""]
diff --git a/test-artefacts/fixtures/macros/macro_strings.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_strings.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_strings.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_strings.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_strings.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_strings.2.raw/th.txt
@@ -0,0 +1,379 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_strings.h
+{-| __C declaration:__ @macro C1@
+
+    __defined at:__ @macros\/macro_strings.h 4:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c1 :: Raw String
+{-| __C declaration:__ @macro C1@
+
+    __defined at:__ @macros\/macro_strings.h 4:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c1 = objectLike "C1" ["'a'"]
+{-| __C declaration:__ @macro C2@
+
+    __defined at:__ @macros\/macro_strings.h 5:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c2 :: Raw String
+{-| __C declaration:__ @macro C2@
+
+    __defined at:__ @macros\/macro_strings.h 5:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c2 = objectLike "C2" ["'\"'"]
+{-| __C declaration:__ @macro C3@
+
+    __defined at:__ @macros\/macro_strings.h 6:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c3 :: Raw String
+{-| __C declaration:__ @macro C3@
+
+    __defined at:__ @macros\/macro_strings.h 6:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c3 = objectLike "C3" ["'\\t'"]
+{-| __C declaration:__ @macro C4@
+
+    __defined at:__ @macros\/macro_strings.h 7:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c4 :: Raw String
+{-| __C declaration:__ @macro C4@
+
+    __defined at:__ @macros\/macro_strings.h 7:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c4 = objectLike "C4" ["'\\0'"]
+{-| __C declaration:__ @macro C5@
+
+    __defined at:__ @macros\/macro_strings.h 8:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c5 :: Raw String
+{-| __C declaration:__ @macro C5@
+
+    __defined at:__ @macros\/macro_strings.h 8:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c5 = objectLike "C5" ["'\\''"]
+{-| __C declaration:__ @macro C6@
+
+    __defined at:__ @macros\/macro_strings.h 9:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c6 :: Raw String
+{-| __C declaration:__ @macro C6@
+
+    __defined at:__ @macros\/macro_strings.h 9:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c6 = objectLike "C6" ["'\\?'"]
+{-| __C declaration:__ @macro C7@
+
+    __defined at:__ @macros\/macro_strings.h 10:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c7 :: Raw String
+{-| __C declaration:__ @macro C7@
+
+    __defined at:__ @macros\/macro_strings.h 10:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c7 = objectLike "C7" ["'\\123'"]
+{-| __C declaration:__ @macro C8@
+
+    __defined at:__ @macros\/macro_strings.h 11:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c8 :: Raw String
+{-| __C declaration:__ @macro C8@
+
+    __defined at:__ @macros\/macro_strings.h 11:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c8 = objectLike "C8" ["'\\x53'"]
+{-| __C declaration:__ @macro D@
+
+    __defined at:__ @macros\/macro_strings.h 13:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+d :: Raw String
+{-| __C declaration:__ @macro D@
+
+    __defined at:__ @macros\/macro_strings.h 13:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+d = objectLike "D" ["'\\777'"]
+{-| __C declaration:__ @macro J1@
+
+    __defined at:__ @macros\/macro_strings.h 15:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+j1 :: Raw String
+{-| __C declaration:__ @macro J1@
+
+    __defined at:__ @macros\/macro_strings.h 15:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+j1 = objectLike "J1" ["'\12354'"]
+{-| __C declaration:__ @macro J2@
+
+    __defined at:__ @macros\/macro_strings.h 16:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+j2 :: Raw String
+{-| __C declaration:__ @macro J2@
+
+    __defined at:__ @macros\/macro_strings.h 16:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+j2 = objectLike "J2" ["'\\u3042'"]
+{-| __C declaration:__ @macro J3@
+
+    __defined at:__ @macros\/macro_strings.h 17:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+j3 :: Raw String
+{-| __C declaration:__ @macro J3@
+
+    __defined at:__ @macros\/macro_strings.h 17:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+j3 = objectLike "J3" ["'\\xE3\\x81\\x82'"]
+{-| __C declaration:__ @macro S1@
+
+    __defined at:__ @macros\/macro_strings.h 20:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s1 :: Raw String
+{-| __C declaration:__ @macro S1@
+
+    __defined at:__ @macros\/macro_strings.h 20:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s1 = objectLike "S1" ["\"a\""]
+{-| __C declaration:__ @macro S2@
+
+    __defined at:__ @macros\/macro_strings.h 21:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s2 :: Raw String
+{-| __C declaration:__ @macro S2@
+
+    __defined at:__ @macros\/macro_strings.h 21:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s2 = objectLike "S2" ["\"'\""]
+{-| __C declaration:__ @macro S3@
+
+    __defined at:__ @macros\/macro_strings.h 22:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s3 :: Raw String
+{-| __C declaration:__ @macro S3@
+
+    __defined at:__ @macros\/macro_strings.h 22:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s3 = objectLike "S3" ["\"\\t\""]
+{-| __C declaration:__ @macro S4@
+
+    __defined at:__ @macros\/macro_strings.h 23:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s4 :: Raw String
+{-| __C declaration:__ @macro S4@
+
+    __defined at:__ @macros\/macro_strings.h 23:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s4 = objectLike "S4" ["\"\\0\""]
+{-| __C declaration:__ @macro S5@
+
+    __defined at:__ @macros\/macro_strings.h 24:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s5 :: Raw String
+{-| __C declaration:__ @macro S5@
+
+    __defined at:__ @macros\/macro_strings.h 24:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s5 = objectLike "S5" ["\"\\'\""]
+{-| __C declaration:__ @macro S6@
+
+    __defined at:__ @macros\/macro_strings.h 25:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s6 :: Raw String
+{-| __C declaration:__ @macro S6@
+
+    __defined at:__ @macros\/macro_strings.h 25:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s6 = objectLike "S6" ["\"\\?\""]
+{-| __C declaration:__ @macro S7@
+
+    __defined at:__ @macros\/macro_strings.h 26:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s7 :: Raw String
+{-| __C declaration:__ @macro S7@
+
+    __defined at:__ @macros\/macro_strings.h 26:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s7 = objectLike "S7" ["\"\\123\""]
+{-| __C declaration:__ @macro S8@
+
+    __defined at:__ @macros\/macro_strings.h 27:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s8 :: Raw String
+{-| __C declaration:__ @macro S8@
+
+    __defined at:__ @macros\/macro_strings.h 27:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s8 = objectLike "S8" ["\"\\x53\""]
+{-| __C declaration:__ @macro T1@
+
+    __defined at:__ @macros\/macro_strings.h 29:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t1 :: Raw String
+{-| __C declaration:__ @macro T1@
+
+    __defined at:__ @macros\/macro_strings.h 29:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t1 = objectLike "T1" ["\"\12354\""]
+{-| __C declaration:__ @macro T2@
+
+    __defined at:__ @macros\/macro_strings.h 30:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t2 :: Raw String
+{-| __C declaration:__ @macro T2@
+
+    __defined at:__ @macros\/macro_strings.h 30:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t2 = objectLike "T2" ["\"\\u3042\""]
+{-| __C declaration:__ @macro T3@
+
+    __defined at:__ @macros\/macro_strings.h 31:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t3 :: Raw String
+{-| __C declaration:__ @macro T3@
+
+    __defined at:__ @macros\/macro_strings.h 31:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t3 = objectLike "T3" ["\"\\xE3\\x81\\x82\""]
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @macros\/macro_strings.h 33:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+u :: Raw String
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @macros\/macro_strings.h 33:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+u = objectLike "U" ["\"\\777\\777\\777\\777\""]
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @macros\/macro_strings.h 34:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+v :: Raw String
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @macros\/macro_strings.h 34:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+v = objectLike "V" ["\"\\1\\2\\3\\4\\5\\6\""]
+{-| __C declaration:__ @macro W1@
+
+    __defined at:__ @macros\/macro_strings.h 36:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w1 :: Raw String
+{-| __C declaration:__ @macro W1@
+
+    __defined at:__ @macros\/macro_strings.h 36:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w1 = objectLike "W1" ["\"hij\\0\""]
+{-| __C declaration:__ @macro W2@
+
+    __defined at:__ @macros\/macro_strings.h 37:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w2 :: Raw String
+{-| __C declaration:__ @macro W2@
+
+    __defined at:__ @macros\/macro_strings.h 37:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w2 = objectLike "W2" ["\"abc\\0def\\0g\""]
diff --git a/test-artefacts/fixtures/macros/macro_strings/Example.hs b/test-artefacts/fixtures/macros/macro_strings/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_strings/Example.hs
@@ -0,0 +1,286 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.c1
+    , Example.c2
+    , Example.c3
+    , Example.c4
+    , Example.c5
+    , Example.c6
+    , Example.c7
+    , Example.c8
+    , Example.s1
+    , Example.s2
+    , Example.s3
+    , Example.s4
+    , Example.s5
+    , Example.s6
+    , Example.s7
+    , Example.s8
+    , Example.t1
+    , Example.t2
+    , Example.t3
+    , Example.u
+    , Example.v
+    , Example.w1
+    , Example.w2
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @macro C1@
+
+    __C literal:__ @\'a\'@
+
+    __defined at:__ @macros\/macro_strings.h 4:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c1 :: BG.CChar
+c1 = 97
+
+{-| __C declaration:__ @macro C2@
+
+    __C literal:__ @\'\"\'@
+
+    __defined at:__ @macros\/macro_strings.h 5:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c2 :: BG.CChar
+c2 = 34
+
+{-| __C declaration:__ @macro C3@
+
+    __C literal:__ @\'\\t\'@
+
+    __defined at:__ @macros\/macro_strings.h 6:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c3 :: BG.CChar
+c3 = 9
+
+{-| __C declaration:__ @macro C4@
+
+    __C literal:__ @\'\\NUL\'@
+
+    __defined at:__ @macros\/macro_strings.h 7:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c4 :: BG.CChar
+c4 = 0
+
+{-| __C declaration:__ @macro C5@
+
+    __C literal:__ @\'\\\'\'@
+
+    __defined at:__ @macros\/macro_strings.h 8:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c5 :: BG.CChar
+c5 = 39
+
+{-| __C declaration:__ @macro C6@
+
+    __C literal:__ @\'?\'@
+
+    __defined at:__ @macros\/macro_strings.h 9:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c6 :: BG.CChar
+c6 = 63
+
+{-| __C declaration:__ @macro C7@
+
+    __C literal:__ @\'S\'@
+
+    __defined at:__ @macros\/macro_strings.h 10:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c7 :: BG.CChar
+c7 = 83
+
+{-| __C declaration:__ @macro C8@
+
+    __C literal:__ @\'S\'@
+
+    __defined at:__ @macros\/macro_strings.h 11:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c8 :: BG.CChar
+c8 = 83
+
+{-| __C declaration:__ @macro S1@
+
+    __C literal:__ @\"a\"@
+
+    __defined at:__ @macros\/macro_strings.h 20:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s1 :: BG.ByteString
+s1 = BG.pack [0x61]
+
+{-| __C declaration:__ @macro S2@
+
+    __C literal:__ @\"\'\"@
+
+    __defined at:__ @macros\/macro_strings.h 21:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s2 :: BG.ByteString
+s2 = BG.pack [0x27]
+
+{-| __C declaration:__ @macro S3@
+
+    __C literal:__ @\"\\t\"@
+
+    __defined at:__ @macros\/macro_strings.h 22:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s3 :: BG.ByteString
+s3 = BG.pack [0x09]
+
+{-| __C declaration:__ @macro S4@
+
+    __C literal:__ @\"\\NUL\"@
+
+    __defined at:__ @macros\/macro_strings.h 23:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s4 :: BG.ByteString
+s4 = BG.pack [0x00]
+
+{-| __C declaration:__ @macro S5@
+
+    __C literal:__ @\"\'\"@
+
+    __defined at:__ @macros\/macro_strings.h 24:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s5 :: BG.ByteString
+s5 = BG.pack [0x27]
+
+{-| __C declaration:__ @macro S6@
+
+    __C literal:__ @\"?\"@
+
+    __defined at:__ @macros\/macro_strings.h 25:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s6 :: BG.ByteString
+s6 = BG.pack [0x3F]
+
+{-| __C declaration:__ @macro S7@
+
+    __C literal:__ @\"S\"@
+
+    __defined at:__ @macros\/macro_strings.h 26:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s7 :: BG.ByteString
+s7 = BG.pack [0x53]
+
+{-| __C declaration:__ @macro S8@
+
+    __C literal:__ @\"S\"@
+
+    __defined at:__ @macros\/macro_strings.h 27:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s8 :: BG.ByteString
+s8 = BG.pack [0x53]
+
+{-| __C declaration:__ @macro T1@
+
+    __C literal:__ @\"\\227\\129\\130\"@
+
+    __defined at:__ @macros\/macro_strings.h 29:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t1 :: BG.ByteString
+t1 = BG.pack [0xE3, 0x81, 0x82]
+
+{-| __C declaration:__ @macro T2@
+
+    __C literal:__ @\"\\227\\129\\130\"@
+
+    __defined at:__ @macros\/macro_strings.h 30:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t2 :: BG.ByteString
+t2 = BG.pack [0xE3, 0x81, 0x82]
+
+{-| __C declaration:__ @macro T3@
+
+    __C literal:__ @\"\\227\\129\\130\"@
+
+    __defined at:__ @macros\/macro_strings.h 31:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t3 :: BG.ByteString
+t3 = BG.pack [0xE3, 0x81, 0x82]
+
+{-| __C declaration:__ @macro U@
+
+    __C literal:__ @\"\\SOH\\255\\SOH\\255\\SOH\\255\\SOH\\255\"@
+
+    __defined at:__ @macros\/macro_strings.h 33:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+u :: BG.ByteString
+u =
+  BG.pack [0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF]
+
+{-| __C declaration:__ @macro V@
+
+    __C literal:__ @\"\\SOH\\STX\\ETX\\EOT\\ENQ\\ACK\"@
+
+    __defined at:__ @macros\/macro_strings.h 34:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+v :: BG.ByteString
+v = BG.pack [0x01, 0x02, 0x03, 0x04, 0x05, 0x06]
+
+{-| __C declaration:__ @macro W1@
+
+    __C literal:__ @\"hij\\NUL\"@
+
+    __defined at:__ @macros\/macro_strings.h 36:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w1 :: BG.ByteString
+w1 = BG.pack [0x68, 0x69, 0x6A, 0x00]
+
+{-| __C declaration:__ @macro W2@
+
+    __C literal:__ @\"abc\\NULdef\\NULg\"@
+
+    __defined at:__ @macros\/macro_strings.h 37:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w2 :: BG.ByteString
+w2 =
+  BG.pack [0x61, 0x62, 0x63, 0x00, 0x64, 0x65, 0x66, 0x00, 0x67]
diff --git a/test-artefacts/fixtures/macros/macro_strings/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_strings/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_strings/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_strings/th.txt b/test-artefacts/fixtures/macros/macro_strings/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_strings/th.txt
@@ -0,0 +1,415 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_strings.h
+{-| __C declaration:__ @macro C1@
+
+    __C literal:__ @\'a\'@
+
+    __defined at:__ @macros\/macro_strings.h 4:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c1 :: CChar
+{-| __C declaration:__ @macro C1@
+
+    __C literal:__ @\'a\'@
+
+    __defined at:__ @macros\/macro_strings.h 4:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c1 = CChar 97
+{-| __C declaration:__ @macro C2@
+
+    __C literal:__ @\'\"\'@
+
+    __defined at:__ @macros\/macro_strings.h 5:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c2 :: CChar
+{-| __C declaration:__ @macro C2@
+
+    __C literal:__ @\'\"\'@
+
+    __defined at:__ @macros\/macro_strings.h 5:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c2 = CChar 34
+{-| __C declaration:__ @macro C3@
+
+    __C literal:__ @\'\\t\'@
+
+    __defined at:__ @macros\/macro_strings.h 6:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c3 :: CChar
+{-| __C declaration:__ @macro C3@
+
+    __C literal:__ @\'\\t\'@
+
+    __defined at:__ @macros\/macro_strings.h 6:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c3 = CChar 9
+{-| __C declaration:__ @macro C4@
+
+    __C literal:__ @\'\\NUL\'@
+
+    __defined at:__ @macros\/macro_strings.h 7:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c4 :: CChar
+{-| __C declaration:__ @macro C4@
+
+    __C literal:__ @\'\\NUL\'@
+
+    __defined at:__ @macros\/macro_strings.h 7:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c4 = CChar 0
+{-| __C declaration:__ @macro C5@
+
+    __C literal:__ @\'\\\'\'@
+
+    __defined at:__ @macros\/macro_strings.h 8:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c5 :: CChar
+{-| __C declaration:__ @macro C5@
+
+    __C literal:__ @\'\\\'\'@
+
+    __defined at:__ @macros\/macro_strings.h 8:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c5 = CChar 39
+{-| __C declaration:__ @macro C6@
+
+    __C literal:__ @\'?\'@
+
+    __defined at:__ @macros\/macro_strings.h 9:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c6 :: CChar
+{-| __C declaration:__ @macro C6@
+
+    __C literal:__ @\'?\'@
+
+    __defined at:__ @macros\/macro_strings.h 9:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c6 = CChar 63
+{-| __C declaration:__ @macro C7@
+
+    __C literal:__ @\'S\'@
+
+    __defined at:__ @macros\/macro_strings.h 10:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c7 :: CChar
+{-| __C declaration:__ @macro C7@
+
+    __C literal:__ @\'S\'@
+
+    __defined at:__ @macros\/macro_strings.h 10:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c7 = CChar 83
+{-| __C declaration:__ @macro C8@
+
+    __C literal:__ @\'S\'@
+
+    __defined at:__ @macros\/macro_strings.h 11:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c8 :: CChar
+{-| __C declaration:__ @macro C8@
+
+    __C literal:__ @\'S\'@
+
+    __defined at:__ @macros\/macro_strings.h 11:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+c8 = CChar 83
+{-| __C declaration:__ @macro S1@
+
+    __C literal:__ @\"a\"@
+
+    __defined at:__ @macros\/macro_strings.h 20:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s1 :: ByteString
+{-| __C declaration:__ @macro S1@
+
+    __C literal:__ @\"a\"@
+
+    __defined at:__ @macros\/macro_strings.h 20:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s1 = pack [97]
+{-| __C declaration:__ @macro S2@
+
+    __C literal:__ @\"\'\"@
+
+    __defined at:__ @macros\/macro_strings.h 21:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s2 :: ByteString
+{-| __C declaration:__ @macro S2@
+
+    __C literal:__ @\"\'\"@
+
+    __defined at:__ @macros\/macro_strings.h 21:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s2 = pack [39]
+{-| __C declaration:__ @macro S3@
+
+    __C literal:__ @\"\\t\"@
+
+    __defined at:__ @macros\/macro_strings.h 22:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s3 :: ByteString
+{-| __C declaration:__ @macro S3@
+
+    __C literal:__ @\"\\t\"@
+
+    __defined at:__ @macros\/macro_strings.h 22:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s3 = pack [9]
+{-| __C declaration:__ @macro S4@
+
+    __C literal:__ @\"\\NUL\"@
+
+    __defined at:__ @macros\/macro_strings.h 23:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s4 :: ByteString
+{-| __C declaration:__ @macro S4@
+
+    __C literal:__ @\"\\NUL\"@
+
+    __defined at:__ @macros\/macro_strings.h 23:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s4 = pack [0]
+{-| __C declaration:__ @macro S5@
+
+    __C literal:__ @\"\'\"@
+
+    __defined at:__ @macros\/macro_strings.h 24:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s5 :: ByteString
+{-| __C declaration:__ @macro S5@
+
+    __C literal:__ @\"\'\"@
+
+    __defined at:__ @macros\/macro_strings.h 24:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s5 = pack [39]
+{-| __C declaration:__ @macro S6@
+
+    __C literal:__ @\"?\"@
+
+    __defined at:__ @macros\/macro_strings.h 25:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s6 :: ByteString
+{-| __C declaration:__ @macro S6@
+
+    __C literal:__ @\"?\"@
+
+    __defined at:__ @macros\/macro_strings.h 25:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s6 = pack [63]
+{-| __C declaration:__ @macro S7@
+
+    __C literal:__ @\"S\"@
+
+    __defined at:__ @macros\/macro_strings.h 26:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s7 :: ByteString
+{-| __C declaration:__ @macro S7@
+
+    __C literal:__ @\"S\"@
+
+    __defined at:__ @macros\/macro_strings.h 26:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s7 = pack [83]
+{-| __C declaration:__ @macro S8@
+
+    __C literal:__ @\"S\"@
+
+    __defined at:__ @macros\/macro_strings.h 27:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s8 :: ByteString
+{-| __C declaration:__ @macro S8@
+
+    __C literal:__ @\"S\"@
+
+    __defined at:__ @macros\/macro_strings.h 27:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+s8 = pack [83]
+{-| __C declaration:__ @macro T1@
+
+    __C literal:__ @\"\\227\\129\\130\"@
+
+    __defined at:__ @macros\/macro_strings.h 29:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t1 :: ByteString
+{-| __C declaration:__ @macro T1@
+
+    __C literal:__ @\"\\227\\129\\130\"@
+
+    __defined at:__ @macros\/macro_strings.h 29:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t1 = pack [227, 129, 130]
+{-| __C declaration:__ @macro T2@
+
+    __C literal:__ @\"\\227\\129\\130\"@
+
+    __defined at:__ @macros\/macro_strings.h 30:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t2 :: ByteString
+{-| __C declaration:__ @macro T2@
+
+    __C literal:__ @\"\\227\\129\\130\"@
+
+    __defined at:__ @macros\/macro_strings.h 30:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t2 = pack [227, 129, 130]
+{-| __C declaration:__ @macro T3@
+
+    __C literal:__ @\"\\227\\129\\130\"@
+
+    __defined at:__ @macros\/macro_strings.h 31:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t3 :: ByteString
+{-| __C declaration:__ @macro T3@
+
+    __C literal:__ @\"\\227\\129\\130\"@
+
+    __defined at:__ @macros\/macro_strings.h 31:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+t3 = pack [227, 129, 130]
+{-| __C declaration:__ @macro U@
+
+    __C literal:__ @\"\\SOH\\255\\SOH\\255\\SOH\\255\\SOH\\255\"@
+
+    __defined at:__ @macros\/macro_strings.h 33:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+u :: ByteString
+{-| __C declaration:__ @macro U@
+
+    __C literal:__ @\"\\SOH\\255\\SOH\\255\\SOH\\255\\SOH\\255\"@
+
+    __defined at:__ @macros\/macro_strings.h 33:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+u = pack [1, 255, 1, 255, 1, 255, 1, 255]
+{-| __C declaration:__ @macro V@
+
+    __C literal:__ @\"\\SOH\\STX\\ETX\\EOT\\ENQ\\ACK\"@
+
+    __defined at:__ @macros\/macro_strings.h 34:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+v :: ByteString
+{-| __C declaration:__ @macro V@
+
+    __C literal:__ @\"\\SOH\\STX\\ETX\\EOT\\ENQ\\ACK\"@
+
+    __defined at:__ @macros\/macro_strings.h 34:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+v = pack [1, 2, 3, 4, 5, 6]
+{-| __C declaration:__ @macro W1@
+
+    __C literal:__ @\"hij\\NUL\"@
+
+    __defined at:__ @macros\/macro_strings.h 36:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w1 :: ByteString
+{-| __C declaration:__ @macro W1@
+
+    __C literal:__ @\"hij\\NUL\"@
+
+    __defined at:__ @macros\/macro_strings.h 36:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w1 = pack [104, 105, 106, 0]
+{-| __C declaration:__ @macro W2@
+
+    __C literal:__ @\"abc\\NULdef\\NULg\"@
+
+    __defined at:__ @macros\/macro_strings.h 37:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w2 :: ByteString
+{-| __C declaration:__ @macro W2@
+
+    __C literal:__ @\"abc\\NULdef\\NULg\"@
+
+    __defined at:__ @macros\/macro_strings.h 37:9@
+
+    __exported by:__ @macros\/macro_strings.h@
+-}
+w2 = pack [97, 98, 99, 0, 100, 101, 102, 0, 103]
diff --git a/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_type_ptr_qualifiers.h
diff --git a/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.2.raw/Example.hs
@@ -0,0 +1,74 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.ptrToVoid
+    , Example.ptrToConstVoidL
+    , Example.ptrToConstVoidR
+    , Example.ptrToConstIntL
+    , Example.ptrToConstIntR
+    , Example.constPtrToInt
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro PtrToVoid@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 2:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToVoid :: Macro.Raw String
+ptrToVoid =
+  Macro.objectLike "PtrToVoid" ["void", "*"]
+
+{-| __C declaration:__ @macro PtrToConstVoidL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 5:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstVoidL :: Macro.Raw String
+ptrToConstVoidL =
+  Macro.objectLike "PtrToConstVoidL" ["const", "void", "*"]
+
+{-| __C declaration:__ @macro PtrToConstVoidR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 8:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstVoidR :: Macro.Raw String
+ptrToConstVoidR =
+  Macro.objectLike "PtrToConstVoidR" ["void", "const", "*"]
+
+{-| __C declaration:__ @macro PtrToConstIntL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 11:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstIntL :: Macro.Raw String
+ptrToConstIntL =
+  Macro.objectLike "PtrToConstIntL" ["const", "int", "*"]
+
+{-| __C declaration:__ @macro PtrToConstIntR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 14:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstIntR :: Macro.Raw String
+ptrToConstIntR =
+  Macro.objectLike "PtrToConstIntR" ["int", "const", "*"]
+
+{-| __C declaration:__ @macro ConstPtrToInt@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 17:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+constPtrToInt :: Macro.Raw String
+constPtrToInt =
+  Macro.objectLike "ConstPtrToInt" ["int", "*", "const"]
diff --git a/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers.2.raw/th.txt
@@ -0,0 +1,89 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_type_ptr_qualifiers.h
+{-| __C declaration:__ @macro PtrToVoid@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 2:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToVoid :: Raw String
+{-| __C declaration:__ @macro PtrToVoid@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 2:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToVoid = objectLike "PtrToVoid" ["void", "*"]
+{-| __C declaration:__ @macro PtrToConstVoidL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 5:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstVoidL :: Raw String
+{-| __C declaration:__ @macro PtrToConstVoidL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 5:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstVoidL = objectLike "PtrToConstVoidL" ["const",
+                                                "void",
+                                                "*"]
+{-| __C declaration:__ @macro PtrToConstVoidR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 8:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstVoidR :: Raw String
+{-| __C declaration:__ @macro PtrToConstVoidR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 8:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstVoidR = objectLike "PtrToConstVoidR" ["void",
+                                                "const",
+                                                "*"]
+{-| __C declaration:__ @macro PtrToConstIntL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 11:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstIntL :: Raw String
+{-| __C declaration:__ @macro PtrToConstIntL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 11:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstIntL = objectLike "PtrToConstIntL" ["const", "int", "*"]
+{-| __C declaration:__ @macro PtrToConstIntR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 14:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstIntR :: Raw String
+{-| __C declaration:__ @macro PtrToConstIntR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 14:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+ptrToConstIntR = objectLike "PtrToConstIntR" ["int", "const", "*"]
+{-| __C declaration:__ @macro ConstPtrToInt@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 17:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+constPtrToInt :: Raw String
+{-| __C declaration:__ @macro ConstPtrToInt@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 17:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+constPtrToInt = objectLike "ConstPtrToInt" ["int", "*", "const"]
diff --git a/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers/Example.hs b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers/Example.hs
@@ -0,0 +1,269 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.PtrToVoid(..)
+    , Example.PtrToConstVoidL(..)
+    , Example.PtrToConstVoidR(..)
+    , Example.PtrToConstIntL(..)
+    , Example.PtrToConstIntR(..)
+    , Example.ConstPtrToInt(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Eq, Ord, Show, type (~))
+
+{-| __C declaration:__ @macro PtrToVoid@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 2:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToVoid = PtrToVoid
+  { unwrapPtrToVoid :: BG.Ptr BG.Void
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.CompatHasField.HasField "unwrapPtrToVoid" PtrToVoid ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         PtrToVoid {unwrapPtrToVoid = y1}, BG.getField @"unwrapPtrToVoid" x0)
+
+instance ( ty ~ BG.Ptr BG.Void
+         ) => BG.HasField "unwrapPtrToVoid" (BG.Ptr PtrToVoid) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPtrToVoid")
+
+instance HasCField.HasCField PtrToVoid "unwrapPtrToVoid" where
+
+  type CFieldType PtrToVoid "unwrapPtrToVoid" =
+    BG.Ptr BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro PtrToConstVoidL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 5:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToConstVoidL = PtrToConstVoidL
+  { unwrapPtrToConstVoidL :: PtrConst.PtrConst BG.Void
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.Void
+         ) => BG.CompatHasField.HasField "unwrapPtrToConstVoidL" PtrToConstVoidL ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> PtrToConstVoidL {unwrapPtrToConstVoidL = y1}
+      , BG.getField @"unwrapPtrToConstVoidL" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.Void
+         ) => BG.HasField "unwrapPtrToConstVoidL" (BG.Ptr PtrToConstVoidL) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPtrToConstVoidL")
+
+instance HasCField.HasCField PtrToConstVoidL "unwrapPtrToConstVoidL" where
+
+  type CFieldType PtrToConstVoidL "unwrapPtrToConstVoidL" =
+    PtrConst.PtrConst BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro PtrToConstVoidR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 8:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToConstVoidR = PtrToConstVoidR
+  { unwrapPtrToConstVoidR :: PtrConst.PtrConst BG.Void
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.Void
+         ) => BG.CompatHasField.HasField "unwrapPtrToConstVoidR" PtrToConstVoidR ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> PtrToConstVoidR {unwrapPtrToConstVoidR = y1}
+      , BG.getField @"unwrapPtrToConstVoidR" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.Void
+         ) => BG.HasField "unwrapPtrToConstVoidR" (BG.Ptr PtrToConstVoidR) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPtrToConstVoidR")
+
+instance HasCField.HasCField PtrToConstVoidR "unwrapPtrToConstVoidR" where
+
+  type CFieldType PtrToConstVoidR "unwrapPtrToConstVoidR" =
+    PtrConst.PtrConst BG.Void
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro PtrToConstIntL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 11:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToConstIntL = PtrToConstIntL
+  { unwrapPtrToConstIntL :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapPtrToConstIntL" PtrToConstIntL ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> PtrToConstIntL {unwrapPtrToConstIntL = y1}
+      , BG.getField @"unwrapPtrToConstIntL" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapPtrToConstIntL" (BG.Ptr PtrToConstIntL) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPtrToConstIntL")
+
+instance HasCField.HasCField PtrToConstIntL "unwrapPtrToConstIntL" where
+
+  type CFieldType PtrToConstIntL "unwrapPtrToConstIntL" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro PtrToConstIntR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 14:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToConstIntR = PtrToConstIntR
+  { unwrapPtrToConstIntR :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapPtrToConstIntR" PtrToConstIntR ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> PtrToConstIntR {unwrapPtrToConstIntR = y1}
+      , BG.getField @"unwrapPtrToConstIntR" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapPtrToConstIntR" (BG.Ptr PtrToConstIntR) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPtrToConstIntR")
+
+instance HasCField.HasCField PtrToConstIntR "unwrapPtrToConstIntR" where
+
+  type CFieldType PtrToConstIntR "unwrapPtrToConstIntR" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro ConstPtrToInt@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 17:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype ConstPtrToInt = ConstPtrToInt
+  { unwrapConstPtrToInt :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConstPtrToInt" ConstPtrToInt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> ConstPtrToInt {unwrapConstPtrToInt = y1}
+      , BG.getField @"unwrapConstPtrToInt" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrapConstPtrToInt" (BG.Ptr ConstPtrToInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConstPtrToInt")
+
+instance HasCField.HasCField ConstPtrToInt "unwrapConstPtrToInt" where
+
+  type CFieldType ConstPtrToInt "unwrapConstPtrToInt" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers/bindingspec.yaml
@@ -0,0 +1,162 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_type_ptr_qualifiers.h
+  cname: macro PtrToVoid
+  hsname: PtrToVoid
+- headers: macros/macro_type_ptr_qualifiers.h
+  cname: macro PtrToConstVoidL
+  hsname: PtrToConstVoidL
+- headers: macros/macro_type_ptr_qualifiers.h
+  cname: macro PtrToConstVoidR
+  hsname: PtrToConstVoidR
+- headers: macros/macro_type_ptr_qualifiers.h
+  cname: macro PtrToConstIntL
+  hsname: PtrToConstIntL
+- headers: macros/macro_type_ptr_qualifiers.h
+  cname: macro PtrToConstIntR
+  hsname: PtrToConstIntR
+- headers: macros/macro_type_ptr_qualifiers.h
+  cname: macro ConstPtrToInt
+  hsname: ConstPtrToInt
+hstypes:
+- hsname: ConstPtrToInt
+  representation:
+    newtype:
+      constructor: ConstPtrToInt
+      fields:
+      - unwrapConstPtrToInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: PtrToConstIntL
+  representation:
+    newtype:
+      constructor: PtrToConstIntL
+      fields:
+      - unwrapPtrToConstIntL
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: PtrToConstIntR
+  representation:
+    newtype:
+      constructor: PtrToConstIntR
+      fields:
+      - unwrapPtrToConstIntR
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: PtrToConstVoidL
+  representation:
+    newtype:
+      constructor: PtrToConstVoidL
+      fields:
+      - unwrapPtrToConstVoidL
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: PtrToConstVoidR
+  representation:
+    newtype:
+      constructor: PtrToConstVoidR
+      fields:
+      - unwrapPtrToConstVoidR
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: PtrToVoid
+  representation:
+    newtype:
+      constructor: PtrToVoid
+      fields:
+      - unwrapPtrToVoid
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers/th.txt b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_ptr_qualifiers/th.txt
@@ -0,0 +1,150 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_type_ptr_qualifiers.h
+{-| __C declaration:__ @macro PtrToVoid@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 2:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToVoid
+    = PtrToVoid {unwrapPtrToVoid :: (Ptr Void)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr Void) =>
+         HasField "unwrapPtrToVoid" PtrToVoid ty
+    where hasField = \x_0 -> (\y_1 -> PtrToVoid{unwrapPtrToVoid = y_1},
+                              getField @"unwrapPtrToVoid" x_0)
+instance (~) ty (Ptr Void) =>
+         HasField "unwrapPtrToVoid" (Ptr PtrToVoid) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPtrToVoid")
+instance HasCField PtrToVoid "unwrapPtrToVoid"
+    where type CFieldType PtrToVoid "unwrapPtrToVoid" = Ptr Void
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro PtrToConstVoidL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 5:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToConstVoidL
+    = PtrToConstVoidL {unwrapPtrToConstVoidL :: (PtrConst Void)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst Void) =>
+         HasField "unwrapPtrToConstVoidL" PtrToConstVoidL ty
+    where hasField = \x_0 -> (\y_1 -> PtrToConstVoidL{unwrapPtrToConstVoidL = y_1},
+                              getField @"unwrapPtrToConstVoidL" x_0)
+instance (~) ty (PtrConst Void) =>
+         HasField "unwrapPtrToConstVoidL" (Ptr PtrToConstVoidL) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPtrToConstVoidL")
+instance HasCField PtrToConstVoidL "unwrapPtrToConstVoidL"
+    where type CFieldType PtrToConstVoidL
+                          "unwrapPtrToConstVoidL" = PtrConst Void
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro PtrToConstVoidR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 8:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToConstVoidR
+    = PtrToConstVoidR {unwrapPtrToConstVoidR :: (PtrConst Void)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst Void) =>
+         HasField "unwrapPtrToConstVoidR" PtrToConstVoidR ty
+    where hasField = \x_0 -> (\y_1 -> PtrToConstVoidR{unwrapPtrToConstVoidR = y_1},
+                              getField @"unwrapPtrToConstVoidR" x_0)
+instance (~) ty (PtrConst Void) =>
+         HasField "unwrapPtrToConstVoidR" (Ptr PtrToConstVoidR) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPtrToConstVoidR")
+instance HasCField PtrToConstVoidR "unwrapPtrToConstVoidR"
+    where type CFieldType PtrToConstVoidR
+                          "unwrapPtrToConstVoidR" = PtrConst Void
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro PtrToConstIntL@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 11:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToConstIntL
+    = PtrToConstIntL {unwrapPtrToConstIntL :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapPtrToConstIntL" PtrToConstIntL ty
+    where hasField = \x_0 -> (\y_1 -> PtrToConstIntL{unwrapPtrToConstIntL = y_1},
+                              getField @"unwrapPtrToConstIntL" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapPtrToConstIntL" (Ptr PtrToConstIntL) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPtrToConstIntL")
+instance HasCField PtrToConstIntL "unwrapPtrToConstIntL"
+    where type CFieldType PtrToConstIntL
+                          "unwrapPtrToConstIntL" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro PtrToConstIntR@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 14:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype PtrToConstIntR
+    = PtrToConstIntR {unwrapPtrToConstIntR :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapPtrToConstIntR" PtrToConstIntR ty
+    where hasField = \x_0 -> (\y_1 -> PtrToConstIntR{unwrapPtrToConstIntR = y_1},
+                              getField @"unwrapPtrToConstIntR" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapPtrToConstIntR" (Ptr PtrToConstIntR) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPtrToConstIntR")
+instance HasCField PtrToConstIntR "unwrapPtrToConstIntR"
+    where type CFieldType PtrToConstIntR
+                          "unwrapPtrToConstIntR" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro ConstPtrToInt@
+
+    __defined at:__ @macros\/macro_type_ptr_qualifiers.h 17:9@
+
+    __exported by:__ @macros\/macro_type_ptr_qualifiers.h@
+-}
+newtype ConstPtrToInt
+    = ConstPtrToInt {unwrapConstPtrToInt :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapConstPtrToInt" ConstPtrToInt ty
+    where hasField = \x_0 -> (\y_1 -> ConstPtrToInt{unwrapConstPtrToInt = y_1},
+                              getField @"unwrapConstPtrToInt" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapConstPtrToInt" (Ptr ConstPtrToInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConstPtrToInt")
+instance HasCField ConstPtrToInt "unwrapConstPtrToInt"
+    where type CFieldType ConstPtrToInt
+                          "unwrapConstPtrToInt" = Ptr CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_type_unresolved_tagged.h
diff --git a/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.2.raw/Example.hs
@@ -0,0 +1,41 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.pTR_UNPARSABLE
+    , Example.pTR_DOES_NOT_EXIST
+    , Example.dOES_NOT_EXIST
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro PTR_UNPARSABLE@
+
+    __defined at:__ @macros\/macro_type_unresolved_tagged.h 8:9@
+
+    __exported by:__ @macros\/macro_type_unresolved_tagged.h@
+-}
+pTR_UNPARSABLE :: Macro.Raw String
+pTR_UNPARSABLE =
+  Macro.objectLike "PTR_UNPARSABLE" ["struct", "Unparsable", "*"]
+
+{-| __C declaration:__ @macro PTR_DOES_NOT_EXIST@
+
+    __defined at:__ @macros\/macro_type_unresolved_tagged.h 10:9@
+
+    __exported by:__ @macros\/macro_type_unresolved_tagged.h@
+-}
+pTR_DOES_NOT_EXIST :: Macro.Raw String
+pTR_DOES_NOT_EXIST =
+  Macro.objectLike "PTR_DOES_NOT_EXIST" ["struct", "DoesNotExist", "*"]
+
+{-| __C declaration:__ @macro DOES_NOT_EXIST@
+
+    __defined at:__ @macros\/macro_type_unresolved_tagged.h 12:9@
+
+    __exported by:__ @macros\/macro_type_unresolved_tagged.h@
+-}
+dOES_NOT_EXIST :: Macro.Raw String
+dOES_NOT_EXIST =
+  Macro.objectLike "DOES_NOT_EXIST" ["struct", "DoesNotExist"]
diff --git a/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged.2.raw/th.txt
@@ -0,0 +1,48 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_type_unresolved_tagged.h
+{-| __C declaration:__ @macro PTR_UNPARSABLE@
+
+    __defined at:__ @macros\/macro_type_unresolved_tagged.h 8:9@
+
+    __exported by:__ @macros\/macro_type_unresolved_tagged.h@
+-}
+pTR_UNPARSABLE :: Raw String
+{-| __C declaration:__ @macro PTR_UNPARSABLE@
+
+    __defined at:__ @macros\/macro_type_unresolved_tagged.h 8:9@
+
+    __exported by:__ @macros\/macro_type_unresolved_tagged.h@
+-}
+pTR_UNPARSABLE = objectLike "PTR_UNPARSABLE" ["struct",
+                                              "Unparsable",
+                                              "*"]
+{-| __C declaration:__ @macro PTR_DOES_NOT_EXIST@
+
+    __defined at:__ @macros\/macro_type_unresolved_tagged.h 10:9@
+
+    __exported by:__ @macros\/macro_type_unresolved_tagged.h@
+-}
+pTR_DOES_NOT_EXIST :: Raw String
+{-| __C declaration:__ @macro PTR_DOES_NOT_EXIST@
+
+    __defined at:__ @macros\/macro_type_unresolved_tagged.h 10:9@
+
+    __exported by:__ @macros\/macro_type_unresolved_tagged.h@
+-}
+pTR_DOES_NOT_EXIST = objectLike "PTR_DOES_NOT_EXIST" ["struct",
+                                                      "DoesNotExist",
+                                                      "*"]
+{-| __C declaration:__ @macro DOES_NOT_EXIST@
+
+    __defined at:__ @macros\/macro_type_unresolved_tagged.h 12:9@
+
+    __exported by:__ @macros\/macro_type_unresolved_tagged.h@
+-}
+dOES_NOT_EXIST :: Raw String
+{-| __C declaration:__ @macro DOES_NOT_EXIST@
+
+    __defined at:__ @macros\/macro_type_unresolved_tagged.h 12:9@
+
+    __exported by:__ @macros\/macro_type_unresolved_tagged.h@
+-}
+dOES_NOT_EXIST = objectLike "DOES_NOT_EXIST" ["struct",
+                                              "DoesNotExist"]
diff --git a/test-artefacts/fixtures/macros/macro_type_unresolved_tagged/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_type_unresolved_tagged/th.txt b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_unresolved_tagged/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_type_unresolved_tagged.h
diff --git a/test-artefacts/fixtures/macros/macro_type_void.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_type_void.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_void.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_type_void.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_type_void.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_void.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_type_void.h
diff --git a/test-artefacts/fixtures/macros/macro_type_void.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_type_void.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_void.2.raw/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.myVoid
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro MyVoid@
+
+    __defined at:__ @macros\/macro_type_void.h 3:9@
+
+    __exported by:__ @macros\/macro_type_void.h@
+-}
+myVoid :: Macro.Raw String
+myVoid = Macro.objectLike "MyVoid" ["void"]
diff --git a/test-artefacts/fixtures/macros/macro_type_void.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_type_void.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_void.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_type_void.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_type_void.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_void.2.raw/th.txt
@@ -0,0 +1,15 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_type_void.h
+{-| __C declaration:__ @macro MyVoid@
+
+    __defined at:__ @macros\/macro_type_void.h 3:9@
+
+    __exported by:__ @macros\/macro_type_void.h@
+-}
+myVoid :: Raw String
+{-| __C declaration:__ @macro MyVoid@
+
+    __defined at:__ @macros\/macro_type_void.h 3:9@
+
+    __exported by:__ @macros\/macro_type_void.h@
+-}
+myVoid = objectLike "MyVoid" ["void"]
diff --git a/test-artefacts/fixtures/macros/macro_type_void/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_type_void/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_void/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macro_type_void/th.txt b/test-artefacts/fixtures/macros/macro_type_void/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_type_void/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_type_void.h
diff --git a/test-artefacts/fixtures/macros/macro_typedef_struct.1.empty/Example.hs b/test-artefacts/fixtures/macros/macro_typedef_struct.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_typedef_struct.1.empty/Example.hs
@@ -0,0 +1,128 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Bar(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 3:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+data Bar = Bar
+  { bar_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/macro_typedef_struct.h 4:7@
+
+         __exported by:__ @macros\/macro_typedef_struct.h@
+    -}
+  , bar_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @macros\/macro_typedef_struct.h 5:11@
+
+         __exported by:__ @macros\/macro_typedef_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bar where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar
+      <*> HasCField.readRaw (BG.Proxy @"bar_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bar_y") ptr0
+
+instance Marshal.WriteRaw Bar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar bar_x2 bar_y3 ->
+               HasCField.writeRaw (BG.Proxy @"bar_x") ptr0 bar_x2
+            >> HasCField.writeRaw (BG.Proxy @"bar_y") ptr0 bar_y3
+
+deriving via Marshal.EquivStorable Bar instance BG.Storable Bar
+
+deriving via Struct.IsStructViaReadRaw Bar instance Struct.IsStruct Bar
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 4:7@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "bar_x" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_x = y1, bar_y = BG.getField @"bar_y" x0}
+      , BG.getField @"bar_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "bar_x" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_x")
+
+instance HasCField.HasCField Bar "bar_x" where
+
+  type CFieldType Bar "bar_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 5:11@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "bar_y" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_y = y1, bar_x = BG.getField @"bar_x" x0}
+      , BG.getField @"bar_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "bar_y" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_y")
+
+instance HasCField.HasCField Bar "bar_y" where
+
+  type CFieldType Bar "bar_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/macro_typedef_struct.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_typedef_struct.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_typedef_struct.1.empty/bindingspec.yaml
@@ -0,0 +1,32 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_typedef_struct.h
+  cname: struct bar
+  hsname: Bar
+- headers: macros/macro_typedef_struct.h
+  cname: bar
+  hsname: Bar
+hstypes:
+- hsname: Bar
+  representation:
+    record:
+      constructor: Bar
+      fields:
+      - bar_x
+      - bar_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_typedef_struct.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_typedef_struct.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_typedef_struct.1.empty/th.txt
@@ -0,0 +1,52 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_typedef_struct.h
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 3:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+data Bar
+    = Bar {bar_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @macros\/macro_typedef_struct.h 4:7@
+
+                __exported by:__ @macros\/macro_typedef_struct.h@
+           -},
+           bar_y :: CInt
+           {- ^ __C declaration:__ @y@
+
+                __defined at:__ @macros\/macro_typedef_struct.h 5:11@
+
+                __exported by:__ @macros\/macro_typedef_struct.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bar
+    where readRaw = \ptr_0 -> (pure Bar <*> readRaw (Proxy @"bar_x") ptr_0) <*> readRaw (Proxy @"bar_y") ptr_0
+instance WriteRaw Bar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar bar_x_2
+                                           bar_y_3 -> writeRaw (Proxy @"bar_x") ptr_0 bar_x_2 >> writeRaw (Proxy @"bar_y") ptr_0 bar_y_3
+deriving via (EquivStorable Bar) instance Storable Bar
+deriving via (IsStructViaReadRaw Bar) instance IsStruct Bar
+instance (~) ty CInt => HasField "bar_x" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_x = y_1,
+                                          bar_y = getField @"bar_y" x_0},
+                              getField @"bar_x" x_0)
+instance (~) ty CInt => HasField "bar_x" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_x")
+instance HasCField Bar "bar_x"
+    where type CFieldType Bar "bar_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "bar_y" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_y = y_1,
+                                          bar_x = getField @"bar_x" x_0},
+                              getField @"bar_y" x_0)
+instance (~) ty CInt => HasField "bar_y" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_y")
+instance HasCField Bar "bar_y"
+    where type CFieldType Bar "bar_y" = CInt
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/macro_typedef_struct.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_typedef_struct.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_typedef_struct.2.raw/Example.hs
@@ -0,0 +1,139 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.mY_TYPE
+    , Example.Bar(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro MY_TYPE@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 1:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+mY_TYPE :: Macro.Raw String
+mY_TYPE = Macro.objectLike "MY_TYPE" ["int"]
+
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 3:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+data Bar = Bar
+  { bar_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/macro_typedef_struct.h 4:7@
+
+         __exported by:__ @macros\/macro_typedef_struct.h@
+    -}
+  , bar_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @macros\/macro_typedef_struct.h 5:11@
+
+         __exported by:__ @macros\/macro_typedef_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bar where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar
+      <*> HasCField.readRaw (BG.Proxy @"bar_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bar_y") ptr0
+
+instance Marshal.WriteRaw Bar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar bar_x2 bar_y3 ->
+               HasCField.writeRaw (BG.Proxy @"bar_x") ptr0 bar_x2
+            >> HasCField.writeRaw (BG.Proxy @"bar_y") ptr0 bar_y3
+
+deriving via Marshal.EquivStorable Bar instance BG.Storable Bar
+
+deriving via Struct.IsStructViaReadRaw Bar instance Struct.IsStruct Bar
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 4:7@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "bar_x" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_x = y1, bar_y = BG.getField @"bar_y" x0}
+      , BG.getField @"bar_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "bar_x" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_x")
+
+instance HasCField.HasCField Bar "bar_x" where
+
+  type CFieldType Bar "bar_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 5:11@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "bar_y" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_y = y1, bar_x = BG.getField @"bar_x" x0}
+      , BG.getField @"bar_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "bar_y" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_y")
+
+instance HasCField.HasCField Bar "bar_y" where
+
+  type CFieldType Bar "bar_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/macro_typedef_struct.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_typedef_struct.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_typedef_struct.2.raw/bindingspec.yaml
@@ -0,0 +1,32 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_typedef_struct.h
+  cname: struct bar
+  hsname: Bar
+- headers: macros/macro_typedef_struct.h
+  cname: bar
+  hsname: Bar
+hstypes:
+- hsname: Bar
+  representation:
+    record:
+      constructor: Bar
+      fields:
+      - bar_x
+      - bar_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_typedef_struct.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_typedef_struct.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_typedef_struct.2.raw/th.txt
@@ -0,0 +1,66 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_typedef_struct.h
+{-| __C declaration:__ @macro MY_TYPE@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 1:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+mY_TYPE :: Raw String
+{-| __C declaration:__ @macro MY_TYPE@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 1:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+mY_TYPE = objectLike "MY_TYPE" ["int"]
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 3:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+data Bar
+    = Bar {bar_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @macros\/macro_typedef_struct.h 4:7@
+
+                __exported by:__ @macros\/macro_typedef_struct.h@
+           -},
+           bar_y :: CInt
+           {- ^ __C declaration:__ @y@
+
+                __defined at:__ @macros\/macro_typedef_struct.h 5:11@
+
+                __exported by:__ @macros\/macro_typedef_struct.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bar
+    where readRaw = \ptr_0 -> (pure Bar <*> readRaw (Proxy @"bar_x") ptr_0) <*> readRaw (Proxy @"bar_y") ptr_0
+instance WriteRaw Bar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar bar_x_2
+                                           bar_y_3 -> writeRaw (Proxy @"bar_x") ptr_0 bar_x_2 >> writeRaw (Proxy @"bar_y") ptr_0 bar_y_3
+deriving via (EquivStorable Bar) instance Storable Bar
+deriving via (IsStructViaReadRaw Bar) instance IsStruct Bar
+instance (~) ty CInt => HasField "bar_x" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_x = y_1,
+                                          bar_y = getField @"bar_y" x_0},
+                              getField @"bar_x" x_0)
+instance (~) ty CInt => HasField "bar_x" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_x")
+instance HasCField Bar "bar_x"
+    where type CFieldType Bar "bar_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "bar_y" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_y = y_1,
+                                          bar_x = getField @"bar_x" x_0},
+                              getField @"bar_y" x_0)
+instance (~) ty CInt => HasField "bar_y" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_y")
+instance HasCField Bar "bar_y"
+    where type CFieldType Bar "bar_y" = CInt
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/macro_typedef_struct/Example.hs b/test-artefacts/fixtures/macros/macro_typedef_struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_typedef_struct/Example.hs
@@ -0,0 +1,179 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MY_TYPE(..)
+    , Example.Bar(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro MY_TYPE@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 1:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+newtype MY_TYPE = MY_TYPE
+  { unwrapMY_TYPE :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMY_TYPE" MY_TYPE ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MY_TYPE {unwrapMY_TYPE = y1}, BG.getField @"unwrapMY_TYPE" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMY_TYPE" (BG.Ptr MY_TYPE) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMY_TYPE")
+
+instance HasCField.HasCField MY_TYPE "unwrapMY_TYPE" where
+
+  type CFieldType MY_TYPE "unwrapMY_TYPE" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 3:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+data Bar = Bar
+  { bar_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/macro_typedef_struct.h 4:7@
+
+         __exported by:__ @macros\/macro_typedef_struct.h@
+    -}
+  , bar_y :: MY_TYPE
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @macros\/macro_typedef_struct.h 5:11@
+
+         __exported by:__ @macros\/macro_typedef_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bar where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar
+      <*> HasCField.readRaw (BG.Proxy @"bar_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bar_y") ptr0
+
+instance Marshal.WriteRaw Bar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar bar_x2 bar_y3 ->
+               HasCField.writeRaw (BG.Proxy @"bar_x") ptr0 bar_x2
+            >> HasCField.writeRaw (BG.Proxy @"bar_y") ptr0 bar_y3
+
+deriving via Marshal.EquivStorable Bar instance BG.Storable Bar
+
+deriving via Struct.IsStructViaReadRaw Bar instance Struct.IsStruct Bar
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 4:7@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "bar_x" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_x = y1, bar_y = BG.getField @"bar_y" x0}
+      , BG.getField @"bar_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "bar_x" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_x")
+
+instance HasCField.HasCField Bar "bar_x" where
+
+  type CFieldType Bar "bar_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 5:11@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+instance (ty ~ MY_TYPE) => BG.CompatHasField.HasField "bar_y" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_y = y1, bar_x = BG.getField @"bar_x" x0}
+      , BG.getField @"bar_y" x0
+      )
+
+instance (ty ~ MY_TYPE) => BG.HasField "bar_y" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_y")
+
+instance HasCField.HasCField Bar "bar_y" where
+
+  type CFieldType Bar "bar_y" = MY_TYPE
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/macro_typedef_struct/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_typedef_struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_typedef_struct/bindingspec.yaml
@@ -0,0 +1,69 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_typedef_struct.h
+  cname: macro MY_TYPE
+  hsname: MY_TYPE
+- headers: macros/macro_typedef_struct.h
+  cname: struct bar
+  hsname: Bar
+- headers: macros/macro_typedef_struct.h
+  cname: bar
+  hsname: Bar
+hstypes:
+- hsname: Bar
+  representation:
+    record:
+      constructor: Bar
+      fields:
+      - bar_x
+      - bar_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MY_TYPE
+  representation:
+    newtype:
+      constructor: MY_TYPE
+      fields:
+      - unwrapMY_TYPE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_typedef_struct/th.txt b/test-artefacts/fixtures/macros/macro_typedef_struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_typedef_struct/th.txt
@@ -0,0 +1,85 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_typedef_struct.h
+{-| __C declaration:__ @macro MY_TYPE@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 1:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+newtype MY_TYPE
+    = MY_TYPE {unwrapMY_TYPE :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMY_TYPE" MY_TYPE ty
+    where hasField = \x_0 -> (\y_1 -> MY_TYPE{unwrapMY_TYPE = y_1},
+                              getField @"unwrapMY_TYPE" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapMY_TYPE" (Ptr MY_TYPE) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMY_TYPE")
+instance HasCField MY_TYPE "unwrapMY_TYPE"
+    where type CFieldType MY_TYPE "unwrapMY_TYPE" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @macros\/macro_typedef_struct.h 3:9@
+
+    __exported by:__ @macros\/macro_typedef_struct.h@
+-}
+data Bar
+    = Bar {bar_x :: CInt
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @macros\/macro_typedef_struct.h 4:7@
+
+                __exported by:__ @macros\/macro_typedef_struct.h@
+           -},
+           bar_y :: MY_TYPE
+           {- ^ __C declaration:__ @y@
+
+                __defined at:__ @macros\/macro_typedef_struct.h 5:11@
+
+                __exported by:__ @macros\/macro_typedef_struct.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bar
+    where readRaw = \ptr_0 -> (pure Bar <*> readRaw (Proxy @"bar_x") ptr_0) <*> readRaw (Proxy @"bar_y") ptr_0
+instance WriteRaw Bar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar bar_x_2
+                                           bar_y_3 -> writeRaw (Proxy @"bar_x") ptr_0 bar_x_2 >> writeRaw (Proxy @"bar_y") ptr_0 bar_y_3
+deriving via (EquivStorable Bar) instance Storable Bar
+deriving via (IsStructViaReadRaw Bar) instance IsStruct Bar
+instance (~) ty CInt => HasField "bar_x" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_x = y_1,
+                                          bar_y = getField @"bar_y" x_0},
+                              getField @"bar_x" x_0)
+instance (~) ty CInt => HasField "bar_x" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_x")
+instance HasCField Bar "bar_x"
+    where type CFieldType Bar "bar_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty MY_TYPE => HasField "bar_y" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_y = y_1,
+                                          bar_x = getField @"bar_x" x_0},
+                              getField @"bar_y" x_0)
+instance (~) ty MY_TYPE => HasField "bar_y" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_y")
+instance HasCField Bar "bar_y"
+    where type CFieldType Bar "bar_y" = MY_TYPE
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/macro_types.1.empty/Example.hs b/test-artefacts/fixtures/macros/macro_types.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_types.1.empty/Example.hs
@@ -0,0 +1,119 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Tty(..)
+    , Example.Boolean_T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Floating, Fractional, Integral, Num, Ord, Read, Real, RealFloat, RealFrac, Show, type (~))
+
+{-| __C declaration:__ @tty@
+
+    __defined at:__ @macros\/macro_types.h 12:13@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Tty = Tty
+  { unwrapTty :: BG.CFloat
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "unwrapTty" Tty ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Tty {unwrapTty = y1}, BG.getField @"unwrapTty" x0)
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "unwrapTty" (BG.Ptr Tty) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTty")
+
+instance HasCField.HasCField Tty "unwrapTty" where
+
+  type CFieldType Tty "unwrapTty" = BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @boolean_T@
+
+    __defined at:__ @macros\/macro_types.h 16:19@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Boolean_T = Boolean_T
+  { unwrapBoolean_T :: BG.CUChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CUChar
+         ) => BG.CompatHasField.HasField "unwrapBoolean_T" Boolean_T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Boolean_T {unwrapBoolean_T = y1}, BG.getField @"unwrapBoolean_T" x0)
+
+instance ( ty ~ BG.CUChar
+         ) => BG.HasField "unwrapBoolean_T" (BG.Ptr Boolean_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBoolean_T")
+
+instance HasCField.HasCField Boolean_T "unwrapBoolean_T" where
+
+  type CFieldType Boolean_T "unwrapBoolean_T" =
+    BG.CUChar
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_types.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_types.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_types.1.empty/bindingspec.yaml
@@ -0,0 +1,78 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_types.h
+  cname: tty
+  hsname: Tty
+- headers: macros/macro_types.h
+  cname: boolean_T
+  hsname: Boolean_T
+hstypes:
+- hsname: Boolean_T
+  representation:
+    newtype:
+      constructor: Boolean_T
+      fields:
+      - unwrapBoolean_T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Tty
+  representation:
+    newtype:
+      constructor: Tty
+      fields:
+      - unwrapTty
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CFloat
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_types.1.empty/th.txt b/test-artefacts/fixtures/macros/macro_types.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_types.1.empty/th.txt
@@ -0,0 +1,64 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_types.h
+{-| __C declaration:__ @tty@
+
+    __defined at:__ @macros\/macro_types.h 12:13@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Tty
+    = Tty {unwrapTty :: CFloat}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CFloat => HasField "unwrapTty" Tty ty
+    where hasField = \x_0 -> (\y_1 -> Tty{unwrapTty = y_1},
+                              getField @"unwrapTty" x_0)
+instance (~) ty CFloat => HasField "unwrapTty" (Ptr Tty) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTty")
+instance HasCField Tty "unwrapTty"
+    where type CFieldType Tty "unwrapTty" = CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @boolean_T@
+
+    __defined at:__ @macros\/macro_types.h 16:19@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Boolean_T
+    = Boolean_T {unwrapBoolean_T :: CUChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUChar => HasField "unwrapBoolean_T" Boolean_T ty
+    where hasField = \x_0 -> (\y_1 -> Boolean_T{unwrapBoolean_T = y_1},
+                              getField @"unwrapBoolean_T" x_0)
+instance (~) ty CUChar =>
+         HasField "unwrapBoolean_T" (Ptr Boolean_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBoolean_T")
+instance HasCField Boolean_T "unwrapBoolean_T"
+    where type CFieldType Boolean_T "unwrapBoolean_T" = CUChar
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_types.2.raw/Example.hs b/test-artefacts/fixtures/macros/macro_types.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_types.2.raw/Example.hs
@@ -0,0 +1,205 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.ptrInt
+    , Example.shortInt
+    , Example.signedShortInt
+    , Example.unsignedShortInt
+    , Example.ptrPtrChar
+    , Example.mTy
+    , Example.Tty(..)
+    , Example.uINT8_T
+    , Example.bOOLEAN_T
+    , Example.Boolean_T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Floating, Fractional, Integral, Num, Ord, Read, Real, RealFloat, RealFrac, Show, String, type (~))
+
+{-| __C declaration:__ @macro PtrInt@
+
+    __defined at:__ @macros\/macro_types.h 2:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+ptrInt :: Macro.Raw String
+ptrInt = Macro.objectLike "PtrInt" ["int", "*"]
+
+{-| __C declaration:__ @macro ShortInt@
+
+    __defined at:__ @macros\/macro_types.h 3:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+shortInt :: Macro.Raw String
+shortInt =
+  Macro.objectLike "ShortInt" ["short", "int"]
+
+{-| __C declaration:__ @macro SignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 4:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+signedShortInt :: Macro.Raw String
+signedShortInt =
+  Macro.objectLike "SignedShortInt" ["signed", "short", "int"]
+
+{-| __C declaration:__ @macro UnsignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 5:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+unsignedShortInt :: Macro.Raw String
+unsignedShortInt =
+  Macro.objectLike "UnsignedShortInt" ["unsigned", "short", "int"]
+
+{-| __C declaration:__ @macro PtrPtrChar@
+
+    __defined at:__ @macros\/macro_types.h 8:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+ptrPtrChar :: Macro.Raw String
+ptrPtrChar =
+  Macro.objectLike "PtrPtrChar" ["char", "*", "*"]
+
+{-| __C declaration:__ @macro MTy@
+
+    __defined at:__ @macros\/macro_types.h 11:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+mTy :: Macro.Raw String
+mTy = Macro.objectLike "MTy" ["float"]
+
+{-| __C declaration:__ @tty@
+
+    __defined at:__ @macros\/macro_types.h 12:13@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Tty = Tty
+  { unwrapTty :: BG.CFloat
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "unwrapTty" Tty ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Tty {unwrapTty = y1}, BG.getField @"unwrapTty" x0)
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "unwrapTty" (BG.Ptr Tty) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTty")
+
+instance HasCField.HasCField Tty "unwrapTty" where
+
+  type CFieldType Tty "unwrapTty" = BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro UINT8_T@
+
+    __defined at:__ @macros\/macro_types.h 14:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+uINT8_T :: Macro.Raw String
+uINT8_T =
+  Macro.objectLike "UINT8_T" ["unsigned", "char"]
+
+{-| __C declaration:__ @macro BOOLEAN_T@
+
+    __defined at:__ @macros\/macro_types.h 15:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+bOOLEAN_T :: Macro.Raw String
+bOOLEAN_T = Macro.objectLike "BOOLEAN_T" ["UINT8_T"]
+
+{-| __C declaration:__ @boolean_T@
+
+    __defined at:__ @macros\/macro_types.h 16:19@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Boolean_T = Boolean_T
+  { unwrapBoolean_T :: BG.CUChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CUChar
+         ) => BG.CompatHasField.HasField "unwrapBoolean_T" Boolean_T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Boolean_T {unwrapBoolean_T = y1}, BG.getField @"unwrapBoolean_T" x0)
+
+instance ( ty ~ BG.CUChar
+         ) => BG.HasField "unwrapBoolean_T" (BG.Ptr Boolean_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBoolean_T")
+
+instance HasCField.HasCField Boolean_T "unwrapBoolean_T" where
+
+  type CFieldType Boolean_T "unwrapBoolean_T" =
+    BG.CUChar
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_types.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_types.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_types.2.raw/bindingspec.yaml
@@ -0,0 +1,78 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_types.h
+  cname: tty
+  hsname: Tty
+- headers: macros/macro_types.h
+  cname: boolean_T
+  hsname: Boolean_T
+hstypes:
+- hsname: Boolean_T
+  representation:
+    newtype:
+      constructor: Boolean_T
+      fields:
+      - unwrapBoolean_T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Tty
+  representation:
+    newtype:
+      constructor: Tty
+      fields:
+      - unwrapTty
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CFloat
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_types.2.raw/th.txt b/test-artefacts/fixtures/macros/macro_types.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_types.2.raw/th.txt
@@ -0,0 +1,180 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_types.h
+{-| __C declaration:__ @macro PtrInt@
+
+    __defined at:__ @macros\/macro_types.h 2:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+ptrInt :: Raw String
+{-| __C declaration:__ @macro PtrInt@
+
+    __defined at:__ @macros\/macro_types.h 2:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+ptrInt = objectLike "PtrInt" ["int", "*"]
+{-| __C declaration:__ @macro ShortInt@
+
+    __defined at:__ @macros\/macro_types.h 3:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+shortInt :: Raw String
+{-| __C declaration:__ @macro ShortInt@
+
+    __defined at:__ @macros\/macro_types.h 3:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+shortInt = objectLike "ShortInt" ["short", "int"]
+{-| __C declaration:__ @macro SignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 4:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+signedShortInt :: Raw String
+{-| __C declaration:__ @macro SignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 4:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+signedShortInt = objectLike "SignedShortInt" ["signed",
+                                              "short",
+                                              "int"]
+{-| __C declaration:__ @macro UnsignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 5:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+unsignedShortInt :: Raw String
+{-| __C declaration:__ @macro UnsignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 5:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+unsignedShortInt = objectLike "UnsignedShortInt" ["unsigned",
+                                                  "short",
+                                                  "int"]
+{-| __C declaration:__ @macro PtrPtrChar@
+
+    __defined at:__ @macros\/macro_types.h 8:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+ptrPtrChar :: Raw String
+{-| __C declaration:__ @macro PtrPtrChar@
+
+    __defined at:__ @macros\/macro_types.h 8:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+ptrPtrChar = objectLike "PtrPtrChar" ["char", "*", "*"]
+{-| __C declaration:__ @macro MTy@
+
+    __defined at:__ @macros\/macro_types.h 11:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+mTy :: Raw String
+{-| __C declaration:__ @macro MTy@
+
+    __defined at:__ @macros\/macro_types.h 11:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+mTy = objectLike "MTy" ["float"]
+{-| __C declaration:__ @tty@
+
+    __defined at:__ @macros\/macro_types.h 12:13@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Tty
+    = Tty {unwrapTty :: CFloat}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CFloat => HasField "unwrapTty" Tty ty
+    where hasField = \x_0 -> (\y_1 -> Tty{unwrapTty = y_1},
+                              getField @"unwrapTty" x_0)
+instance (~) ty CFloat => HasField "unwrapTty" (Ptr Tty) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTty")
+instance HasCField Tty "unwrapTty"
+    where type CFieldType Tty "unwrapTty" = CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro UINT8_T@
+
+    __defined at:__ @macros\/macro_types.h 14:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+uINT8_T :: Raw String
+{-| __C declaration:__ @macro UINT8_T@
+
+    __defined at:__ @macros\/macro_types.h 14:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+uINT8_T = objectLike "UINT8_T" ["unsigned", "char"]
+{-| __C declaration:__ @macro BOOLEAN_T@
+
+    __defined at:__ @macros\/macro_types.h 15:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+bOOLEAN_T :: Raw String
+{-| __C declaration:__ @macro BOOLEAN_T@
+
+    __defined at:__ @macros\/macro_types.h 15:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+bOOLEAN_T = objectLike "BOOLEAN_T" ["UINT8_T"]
+{-| __C declaration:__ @boolean_T@
+
+    __defined at:__ @macros\/macro_types.h 16:19@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Boolean_T
+    = Boolean_T {unwrapBoolean_T :: CUChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUChar => HasField "unwrapBoolean_T" Boolean_T ty
+    where hasField = \x_0 -> (\y_1 -> Boolean_T{unwrapBoolean_T = y_1},
+                              getField @"unwrapBoolean_T" x_0)
+instance (~) ty CUChar =>
+         HasField "unwrapBoolean_T" (Ptr Boolean_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBoolean_T")
+instance HasCField Boolean_T "unwrapBoolean_T"
+    where type CFieldType Boolean_T "unwrapBoolean_T" = CUChar
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_types/Example.hs b/test-artefacts/fixtures/macros/macro_types/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_types/Example.hs
@@ -0,0 +1,494 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.PtrInt(..)
+    , Example.ShortInt(..)
+    , Example.SignedShortInt(..)
+    , Example.UnsignedShortInt(..)
+    , Example.PtrPtrChar(..)
+    , Example.MTy(..)
+    , Example.Tty(..)
+    , Example.UINT8_T(..)
+    , Example.BOOLEAN_T(..)
+    , Example.Boolean_T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Floating, Fractional, Integral, Num, Ord, Read, Real, RealFloat, RealFrac, Show, type (~))
+
+{-| __C declaration:__ @macro PtrInt@
+
+    __defined at:__ @macros\/macro_types.h 2:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype PtrInt = PtrInt
+  { unwrapPtrInt :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapPtrInt" PtrInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         PtrInt {unwrapPtrInt = y1}, BG.getField @"unwrapPtrInt" x0)
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrapPtrInt" (BG.Ptr PtrInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPtrInt")
+
+instance HasCField.HasCField PtrInt "unwrapPtrInt" where
+
+  type CFieldType PtrInt "unwrapPtrInt" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro ShortInt@
+
+    __defined at:__ @macros\/macro_types.h 3:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype ShortInt = ShortInt
+  { unwrapShortInt :: BG.CShort
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "unwrapShortInt" ShortInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         ShortInt {unwrapShortInt = y1}, BG.getField @"unwrapShortInt" x0)
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "unwrapShortInt" (BG.Ptr ShortInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapShortInt")
+
+instance HasCField.HasCField ShortInt "unwrapShortInt" where
+
+  type CFieldType ShortInt "unwrapShortInt" = BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro SignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 4:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype SignedShortInt = SignedShortInt
+  { unwrapSignedShortInt :: BG.CShort
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "unwrapSignedShortInt" SignedShortInt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> SignedShortInt {unwrapSignedShortInt = y1}
+      , BG.getField @"unwrapSignedShortInt" x0
+      )
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "unwrapSignedShortInt" (BG.Ptr SignedShortInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSignedShortInt")
+
+instance HasCField.HasCField SignedShortInt "unwrapSignedShortInt" where
+
+  type CFieldType SignedShortInt "unwrapSignedShortInt" =
+    BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro UnsignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 5:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype UnsignedShortInt = UnsignedShortInt
+  { unwrapUnsignedShortInt :: BG.CUShort
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CUShort
+         ) => BG.CompatHasField.HasField "unwrapUnsignedShortInt" UnsignedShortInt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UnsignedShortInt {unwrapUnsignedShortInt = y1}
+      , BG.getField @"unwrapUnsignedShortInt" x0
+      )
+
+instance ( ty ~ BG.CUShort
+         ) => BG.HasField "unwrapUnsignedShortInt" (BG.Ptr UnsignedShortInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUnsignedShortInt")
+
+instance HasCField.HasCField UnsignedShortInt "unwrapUnsignedShortInt" where
+
+  type CFieldType UnsignedShortInt "unwrapUnsignedShortInt" =
+    BG.CUShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro PtrPtrChar@
+
+    __defined at:__ @macros\/macro_types.h 8:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype PtrPtrChar = PtrPtrChar
+  { unwrapPtrPtrChar :: BG.Ptr (BG.Ptr BG.CChar)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CChar)
+         ) => BG.CompatHasField.HasField "unwrapPtrPtrChar" PtrPtrChar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> PtrPtrChar {unwrapPtrPtrChar = y1}
+      , BG.getField @"unwrapPtrPtrChar" x0
+      )
+
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CChar)
+         ) => BG.HasField "unwrapPtrPtrChar" (BG.Ptr PtrPtrChar) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPtrPtrChar")
+
+instance HasCField.HasCField PtrPtrChar "unwrapPtrPtrChar" where
+
+  type CFieldType PtrPtrChar "unwrapPtrPtrChar" =
+    BG.Ptr (BG.Ptr BG.CChar)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro MTy@
+
+    __defined at:__ @macros\/macro_types.h 11:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype MTy = MTy
+  { unwrapMTy :: BG.CFloat
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "unwrapMTy" MTy ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MTy {unwrapMTy = y1}, BG.getField @"unwrapMTy" x0)
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "unwrapMTy" (BG.Ptr MTy) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapMTy")
+
+instance HasCField.HasCField MTy "unwrapMTy" where
+
+  type CFieldType MTy "unwrapMTy" = BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @tty@
+
+    __defined at:__ @macros\/macro_types.h 12:13@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Tty = Tty
+  { unwrapTty :: MTy
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ MTy) => BG.CompatHasField.HasField "unwrapTty" Tty ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Tty {unwrapTty = y1}, BG.getField @"unwrapTty" x0)
+
+instance (ty ~ MTy) => BG.HasField "unwrapTty" (BG.Ptr Tty) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTty")
+
+instance HasCField.HasCField Tty "unwrapTty" where
+
+  type CFieldType Tty "unwrapTty" = MTy
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro UINT8_T@
+
+    __defined at:__ @macros\/macro_types.h 14:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype UINT8_T = UINT8_T
+  { unwrapUINT8_T :: BG.CUChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CUChar
+         ) => BG.CompatHasField.HasField "unwrapUINT8_T" UINT8_T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         UINT8_T {unwrapUINT8_T = y1}, BG.getField @"unwrapUINT8_T" x0)
+
+instance ( ty ~ BG.CUChar
+         ) => BG.HasField "unwrapUINT8_T" (BG.Ptr UINT8_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUINT8_T")
+
+instance HasCField.HasCField UINT8_T "unwrapUINT8_T" where
+
+  type CFieldType UINT8_T "unwrapUINT8_T" = BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro BOOLEAN_T@
+
+    __defined at:__ @macros\/macro_types.h 15:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype BOOLEAN_T = BOOLEAN_T
+  { unwrapBOOLEAN_T :: UINT8_T
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ UINT8_T
+         ) => BG.CompatHasField.HasField "unwrapBOOLEAN_T" BOOLEAN_T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BOOLEAN_T {unwrapBOOLEAN_T = y1}, BG.getField @"unwrapBOOLEAN_T" x0)
+
+instance ( ty ~ UINT8_T
+         ) => BG.HasField "unwrapBOOLEAN_T" (BG.Ptr BOOLEAN_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBOOLEAN_T")
+
+instance HasCField.HasCField BOOLEAN_T "unwrapBOOLEAN_T" where
+
+  type CFieldType BOOLEAN_T "unwrapBOOLEAN_T" = UINT8_T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @boolean_T@
+
+    __defined at:__ @macros\/macro_types.h 16:19@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Boolean_T = Boolean_T
+  { unwrapBoolean_T :: BOOLEAN_T
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BOOLEAN_T
+         ) => BG.CompatHasField.HasField "unwrapBoolean_T" Boolean_T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Boolean_T {unwrapBoolean_T = y1}, BG.getField @"unwrapBoolean_T" x0)
+
+instance ( ty ~ BOOLEAN_T
+         ) => BG.HasField "unwrapBoolean_T" (BG.Ptr Boolean_T) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBoolean_T")
+
+instance HasCField.HasCField Boolean_T "unwrapBoolean_T" where
+
+  type CFieldType Boolean_T "unwrapBoolean_T" =
+    BOOLEAN_T
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macro_types/bindingspec.yaml b/test-artefacts/fixtures/macros/macro_types/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_types/bindingspec.yaml
@@ -0,0 +1,347 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/macro_types.h
+  cname: macro PtrInt
+  hsname: PtrInt
+- headers: macros/macro_types.h
+  cname: macro ShortInt
+  hsname: ShortInt
+- headers: macros/macro_types.h
+  cname: macro SignedShortInt
+  hsname: SignedShortInt
+- headers: macros/macro_types.h
+  cname: macro UnsignedShortInt
+  hsname: UnsignedShortInt
+- headers: macros/macro_types.h
+  cname: macro PtrPtrChar
+  hsname: PtrPtrChar
+- headers: macros/macro_types.h
+  cname: macro MTy
+  hsname: MTy
+- headers: macros/macro_types.h
+  cname: tty
+  hsname: Tty
+- headers: macros/macro_types.h
+  cname: macro UINT8_T
+  hsname: UINT8_T
+- headers: macros/macro_types.h
+  cname: macro BOOLEAN_T
+  hsname: BOOLEAN_T
+- headers: macros/macro_types.h
+  cname: boolean_T
+  hsname: Boolean_T
+hstypes:
+- hsname: BOOLEAN_T
+  representation:
+    newtype:
+      constructor: BOOLEAN_T
+      fields:
+      - unwrapBOOLEAN_T
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Boolean_T
+  representation:
+    newtype:
+      constructor: Boolean_T
+      fields:
+      - unwrapBoolean_T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MTy
+  representation:
+    newtype:
+      constructor: MTy
+      fields:
+      - unwrapMTy
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CFloat
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: PtrInt
+  representation:
+    newtype:
+      constructor: PtrInt
+      fields:
+      - unwrapPtrInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: PtrPtrChar
+  representation:
+    newtype:
+      constructor: PtrPtrChar
+      fields:
+      - unwrapPtrPtrChar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: ShortInt
+  representation:
+    newtype:
+      constructor: ShortInt
+      fields:
+      - unwrapShortInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CShort
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SignedShortInt
+  representation:
+    newtype:
+      constructor: SignedShortInt
+      fields:
+      - unwrapSignedShortInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CShort
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Tty
+  representation:
+    newtype:
+      constructor: Tty
+      fields:
+      - unwrapTty
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CFloat
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UINT8_T
+  representation:
+    newtype:
+      constructor: UINT8_T
+      fields:
+      - unwrapUINT8_T
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UnsignedShortInt
+  representation:
+    newtype:
+      constructor: UnsignedShortInt
+      fields:
+      - unwrapUnsignedShortInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUShort
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/macro_types/th.txt b/test-artefacts/fixtures/macros/macro_types/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macro_types/th.txt
@@ -0,0 +1,312 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macro_types.h
+{-| __C declaration:__ @macro PtrInt@
+
+    __defined at:__ @macros\/macro_types.h 2:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype PtrInt
+    = PtrInt {unwrapPtrInt :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) => HasField "unwrapPtrInt" PtrInt ty
+    where hasField = \x_0 -> (\y_1 -> PtrInt{unwrapPtrInt = y_1},
+                              getField @"unwrapPtrInt" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapPtrInt" (Ptr PtrInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPtrInt")
+instance HasCField PtrInt "unwrapPtrInt"
+    where type CFieldType PtrInt "unwrapPtrInt" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro ShortInt@
+
+    __defined at:__ @macros\/macro_types.h 3:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype ShortInt
+    = ShortInt {unwrapShortInt :: CShort}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CShort => HasField "unwrapShortInt" ShortInt ty
+    where hasField = \x_0 -> (\y_1 -> ShortInt{unwrapShortInt = y_1},
+                              getField @"unwrapShortInt" x_0)
+instance (~) ty CShort =>
+         HasField "unwrapShortInt" (Ptr ShortInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapShortInt")
+instance HasCField ShortInt "unwrapShortInt"
+    where type CFieldType ShortInt "unwrapShortInt" = CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro SignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 4:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype SignedShortInt
+    = SignedShortInt {unwrapSignedShortInt :: CShort}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CShort =>
+         HasField "unwrapSignedShortInt" SignedShortInt ty
+    where hasField = \x_0 -> (\y_1 -> SignedShortInt{unwrapSignedShortInt = y_1},
+                              getField @"unwrapSignedShortInt" x_0)
+instance (~) ty CShort =>
+         HasField "unwrapSignedShortInt" (Ptr SignedShortInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSignedShortInt")
+instance HasCField SignedShortInt "unwrapSignedShortInt"
+    where type CFieldType SignedShortInt
+                          "unwrapSignedShortInt" = CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro UnsignedShortInt@
+
+    __defined at:__ @macros\/macro_types.h 5:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype UnsignedShortInt
+    = UnsignedShortInt {unwrapUnsignedShortInt :: CUShort}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUShort =>
+         HasField "unwrapUnsignedShortInt" UnsignedShortInt ty
+    where hasField = \x_0 -> (\y_1 -> UnsignedShortInt{unwrapUnsignedShortInt = y_1},
+                              getField @"unwrapUnsignedShortInt" x_0)
+instance (~) ty CUShort =>
+         HasField "unwrapUnsignedShortInt" (Ptr UnsignedShortInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUnsignedShortInt")
+instance HasCField UnsignedShortInt "unwrapUnsignedShortInt"
+    where type CFieldType UnsignedShortInt
+                          "unwrapUnsignedShortInt" = CUShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro PtrPtrChar@
+
+    __defined at:__ @macros\/macro_types.h 8:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype PtrPtrChar
+    = PtrPtrChar {unwrapPtrPtrChar :: (Ptr (Ptr CChar))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr CChar)) =>
+         HasField "unwrapPtrPtrChar" PtrPtrChar ty
+    where hasField = \x_0 -> (\y_1 -> PtrPtrChar{unwrapPtrPtrChar = y_1},
+                              getField @"unwrapPtrPtrChar" x_0)
+instance (~) ty (Ptr (Ptr CChar)) =>
+         HasField "unwrapPtrPtrChar" (Ptr PtrPtrChar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPtrPtrChar")
+instance HasCField PtrPtrChar "unwrapPtrPtrChar"
+    where type CFieldType PtrPtrChar
+                          "unwrapPtrPtrChar" = Ptr (Ptr CChar)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro MTy@
+
+    __defined at:__ @macros\/macro_types.h 11:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype MTy
+    = MTy {unwrapMTy :: CFloat}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CFloat => HasField "unwrapMTy" MTy ty
+    where hasField = \x_0 -> (\y_1 -> MTy{unwrapMTy = y_1},
+                              getField @"unwrapMTy" x_0)
+instance (~) ty CFloat => HasField "unwrapMTy" (Ptr MTy) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMTy")
+instance HasCField MTy "unwrapMTy"
+    where type CFieldType MTy "unwrapMTy" = CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @tty@
+
+    __defined at:__ @macros\/macro_types.h 12:13@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Tty
+    = Tty {unwrapTty :: MTy}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty MTy => HasField "unwrapTty" Tty ty
+    where hasField = \x_0 -> (\y_1 -> Tty{unwrapTty = y_1},
+                              getField @"unwrapTty" x_0)
+instance (~) ty MTy => HasField "unwrapTty" (Ptr Tty) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTty")
+instance HasCField Tty "unwrapTty"
+    where type CFieldType Tty "unwrapTty" = MTy
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro UINT8_T@
+
+    __defined at:__ @macros\/macro_types.h 14:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype UINT8_T
+    = UINT8_T {unwrapUINT8_T :: CUChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUChar => HasField "unwrapUINT8_T" UINT8_T ty
+    where hasField = \x_0 -> (\y_1 -> UINT8_T{unwrapUINT8_T = y_1},
+                              getField @"unwrapUINT8_T" x_0)
+instance (~) ty CUChar =>
+         HasField "unwrapUINT8_T" (Ptr UINT8_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUINT8_T")
+instance HasCField UINT8_T "unwrapUINT8_T"
+    where type CFieldType UINT8_T "unwrapUINT8_T" = CUChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro BOOLEAN_T@
+
+    __defined at:__ @macros\/macro_types.h 15:9@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype BOOLEAN_T
+    = BOOLEAN_T {unwrapBOOLEAN_T :: UINT8_T}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty UINT8_T => HasField "unwrapBOOLEAN_T" BOOLEAN_T ty
+    where hasField = \x_0 -> (\y_1 -> BOOLEAN_T{unwrapBOOLEAN_T = y_1},
+                              getField @"unwrapBOOLEAN_T" x_0)
+instance (~) ty UINT8_T =>
+         HasField "unwrapBOOLEAN_T" (Ptr BOOLEAN_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBOOLEAN_T")
+instance HasCField BOOLEAN_T "unwrapBOOLEAN_T"
+    where type CFieldType BOOLEAN_T "unwrapBOOLEAN_T" = UINT8_T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @boolean_T@
+
+    __defined at:__ @macros\/macro_types.h 16:19@
+
+    __exported by:__ @macros\/macro_types.h@
+-}
+newtype Boolean_T
+    = Boolean_T {unwrapBoolean_T :: BOOLEAN_T}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty BOOLEAN_T =>
+         HasField "unwrapBoolean_T" Boolean_T ty
+    where hasField = \x_0 -> (\y_1 -> Boolean_T{unwrapBoolean_T = y_1},
+                              getField @"unwrapBoolean_T" x_0)
+instance (~) ty BOOLEAN_T =>
+         HasField "unwrapBoolean_T" (Ptr Boolean_T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBoolean_T")
+instance HasCField Boolean_T "unwrapBoolean_T"
+    where type CFieldType Boolean_T "unwrapBoolean_T" = BOOLEAN_T
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/macros.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/macros.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macros.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macros.1.empty/th.txt b/test-artefacts/fixtures/macros/macros.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macros.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macros.h
diff --git a/test-artefacts/fixtures/macros/macros.2.raw/Example.hs b/test-artefacts/fixtures/macros/macros.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macros.2.raw/Example.hs
@@ -0,0 +1,381 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.oBJECTLIKE1
+    , Example.oBJECTLIKE2
+    , Example.oBJECTLIKE3
+    , Example.oBJECTLIKE4
+    , Example.mEANING_OF_LIFE1
+    , Example.mEANING_OF_LIFE2
+    , Example.mEANING_OF_LIFE3
+    , Example.mEANING_OF_LIFE4
+    , Example.mEANING_OF_LIFE5
+    , Example.lONG_INT_TOKEN1
+    , Example.lONG_INT_TOKEN2
+    , Example.lONG_INT_TOKEN3
+    , Example.lONG_INT_TOKEN4
+    , Example.tUPLE1
+    , Example.tUPLE2
+    , Example.tUPLE3
+    , Example.fLT1_1
+    , Example.fLT1_2
+    , Example.fLT1_3
+    , Example.fLT2_1
+    , Example.fLT2_2
+    , Example.fLT2_3
+    , Example.fLT3_1
+    , Example.fLT3_2
+    , Example.fLT3_3
+    , Example.fLT3_4
+    , Example.fLT4_1
+    , Example.fLT4_2
+    , Example.fLT4_3
+    , Example.fLT5_1
+    , Example.fLT5_2
+    , Example.fLT6_1
+    , Example.fLT6_2
+    , Example.fLT6_3
+    , Example.bAD1
+    , Example.bAD2
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro OBJECTLIKE1@
+
+    __defined at:__ @macros\/macros.h 1:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE1 :: Macro.Raw String
+oBJECTLIKE1 = Macro.objectLike "OBJECTLIKE1" ["1"]
+
+{-| __C declaration:__ @macro OBJECTLIKE2@
+
+    __defined at:__ @macros\/macros.h 2:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE2 :: Macro.Raw String
+oBJECTLIKE2 =
+  Macro.objectLike "OBJECTLIKE2" ["(", "2", ")"]
+
+{-| __C declaration:__ @macro OBJECTLIKE3@
+
+    __defined at:__ @macros\/macros.h 3:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE3 :: Macro.Raw String
+oBJECTLIKE3 =
+  Macro.objectLike "OBJECTLIKE3" ["3", "+", "3"]
+
+{-| __C declaration:__ @macro OBJECTLIKE4@
+
+    __defined at:__ @macros\/macros.h 4:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE4 :: Macro.Raw String
+oBJECTLIKE4 =
+  Macro.objectLike "OBJECTLIKE4" ["(", "4", "+", "4", ")"]
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE1@
+
+    __defined at:__ @macros\/macros.h 6:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE1 :: Macro.Raw String
+mEANING_OF_LIFE1 =
+  Macro.objectLike "MEANING_OF_LIFE1" ["42"]
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE2@
+
+    __defined at:__ @macros\/macros.h 7:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE2 :: Macro.Raw String
+mEANING_OF_LIFE2 =
+  Macro.objectLike "MEANING_OF_LIFE2" ["052"]
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE3@
+
+    __defined at:__ @macros\/macros.h 8:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE3 :: Macro.Raw String
+mEANING_OF_LIFE3 =
+  Macro.objectLike "MEANING_OF_LIFE3" ["0x2a"]
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE4@
+
+    __defined at:__ @macros\/macros.h 9:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE4 :: Macro.Raw String
+mEANING_OF_LIFE4 =
+  Macro.objectLike "MEANING_OF_LIFE4" ["0X2A"]
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE5@
+
+    __defined at:__ @macros\/macros.h 10:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE5 :: Macro.Raw String
+mEANING_OF_LIFE5 =
+  Macro.objectLike "MEANING_OF_LIFE5" ["0b101010"]
+
+{-| __C declaration:__ @macro LONG_INT_TOKEN1@
+
+    __defined at:__ @macros\/macros.h 12:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN1 :: Macro.Raw String
+lONG_INT_TOKEN1 =
+  Macro.objectLike "LONG_INT_TOKEN1" ["18446744073709550592ull"]
+
+{-| __C declaration:__ @macro LONG_INT_TOKEN2@
+
+    __defined at:__ @macros\/macros.h 13:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN2 :: Macro.Raw String
+lONG_INT_TOKEN2 =
+  Macro.objectLike "LONG_INT_TOKEN2" ["18'446'744'073'709'550'592llu"]
+
+{-| __C declaration:__ @macro LONG_INT_TOKEN3@
+
+    __defined at:__ @macros\/macros.h 14:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN3 :: Macro.Raw String
+lONG_INT_TOKEN3 =
+  Macro.objectLike "LONG_INT_TOKEN3" ["1844'6744'0737'0955'0592uLL"]
+
+{-| __C declaration:__ @macro LONG_INT_TOKEN4@
+
+    __defined at:__ @macros\/macros.h 15:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN4 :: Macro.Raw String
+lONG_INT_TOKEN4 =
+  Macro.objectLike "LONG_INT_TOKEN4" ["184467'440737'0'95505'92LLU"]
+
+{-| __C declaration:__ @macro TUPLE1@
+
+    __defined at:__ @macros\/macros.h 17:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE1 :: Macro.Raw String
+tUPLE1 =
+  Macro.objectLike "TUPLE1" ["(", "1", ",", "2", ")"]
+
+{-| __C declaration:__ @macro TUPLE2@
+
+    __defined at:__ @macros\/macros.h 18:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE2 :: Macro.Raw String
+tUPLE2 = Macro.objectLike "TUPLE2" ["3", ",", "4"]
+
+{-| __C declaration:__ @macro TUPLE3@
+
+    __defined at:__ @macros\/macros.h 19:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE3 :: Macro.Raw String
+tUPLE3 = Macro.objectLike "TUPLE3" ["5", ",", "6"]
+
+{-| __C declaration:__ @macro FLT1_1@
+
+    __defined at:__ @macros\/macros.h 24:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_1 :: Macro.Raw String
+fLT1_1 = Macro.objectLike "FLT1_1" ["11e4"]
+
+{-| __C declaration:__ @macro FLT1_2@
+
+    __defined at:__ @macros\/macros.h 25:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_2 :: Macro.Raw String
+fLT1_2 = Macro.objectLike "FLT1_2" ["12E-3"]
+
+{-| __C declaration:__ @macro FLT1_3@
+
+    __defined at:__ @macros\/macros.h 26:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_3 :: Macro.Raw String
+fLT1_3 = Macro.objectLike "FLT1_3" ["13e-03f"]
+
+{-| __C declaration:__ @macro FLT2_1@
+
+    __defined at:__ @macros\/macros.h 28:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_1 :: Macro.Raw String
+fLT2_1 = Macro.objectLike "FLT2_1" ["21."]
+
+{-| __C declaration:__ @macro FLT2_2@
+
+    __defined at:__ @macros\/macros.h 29:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_2 :: Macro.Raw String
+fLT2_2 = Macro.objectLike "FLT2_2" ["22.e2"]
+
+{-| __C declaration:__ @macro FLT2_3@
+
+    __defined at:__ @macros\/macros.h 30:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_3 :: Macro.Raw String
+fLT2_3 = Macro.objectLike "FLT2_3" ["23.f"]
+
+{-| __C declaration:__ @macro FLT3_1@
+
+    __defined at:__ @macros\/macros.h 32:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_1 :: Macro.Raw String
+fLT3_1 = Macro.objectLike "FLT3_1" ["31.0"]
+
+{-| __C declaration:__ @macro FLT3_2@
+
+    __defined at:__ @macros\/macros.h 33:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_2 :: Macro.Raw String
+fLT3_2 = Macro.objectLike "FLT3_2" [".32"]
+
+{-| __C declaration:__ @macro FLT3_3@
+
+    __defined at:__ @macros\/macros.h 34:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_3 :: Macro.Raw String
+fLT3_3 = Macro.objectLike "FLT3_3" [".33e2"]
+
+{-| __C declaration:__ @macro FLT3_4@
+
+    __defined at:__ @macros\/macros.h 35:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_4 :: Macro.Raw String
+fLT3_4 = Macro.objectLike "FLT3_4" [".34e-2f"]
+
+{-| __C declaration:__ @macro FLT4_1@
+
+    __defined at:__ @macros\/macros.h 37:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_1 :: Macro.Raw String
+fLT4_1 = Macro.objectLike "FLT4_1" ["0x41p4"]
+
+{-| __C declaration:__ @macro FLT4_2@
+
+    __defined at:__ @macros\/macros.h 38:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_2 :: Macro.Raw String
+fLT4_2 = Macro.objectLike "FLT4_2" ["0x42P-3"]
+
+{-| __C declaration:__ @macro FLT4_3@
+
+    __defined at:__ @macros\/macros.h 39:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_3 :: Macro.Raw String
+fLT4_3 = Macro.objectLike "FLT4_3" ["0x43p-03f"]
+
+{-| __C declaration:__ @macro FLT5_1@
+
+    __defined at:__ @macros\/macros.h 41:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_1 :: Macro.Raw String
+fLT5_1 = Macro.objectLike "FLT5_1" ["0x51.p0"]
+
+{-| __C declaration:__ @macro FLT5_2@
+
+    __defined at:__ @macros\/macros.h 42:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_2 :: Macro.Raw String
+fLT5_2 = Macro.objectLike "FLT5_2" ["0x52.P0f"]
+
+{-| __C declaration:__ @macro FLT6_1@
+
+    __defined at:__ @macros\/macros.h 44:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_1 :: Macro.Raw String
+fLT6_1 = Macro.objectLike "FLT6_1" ["0x61.0P2"]
+
+{-| __C declaration:__ @macro FLT6_2@
+
+    __defined at:__ @macros\/macros.h 45:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_2 :: Macro.Raw String
+fLT6_2 = Macro.objectLike "FLT6_2" ["0x.62p2"]
+
+{-| __C declaration:__ @macro FLT6_3@
+
+    __defined at:__ @macros\/macros.h 46:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_3 :: Macro.Raw String
+fLT6_3 = Macro.objectLike "FLT6_3" ["0x.63p-2f"]
+
+{-| __C declaration:__ @macro BAD1@
+
+    __defined at:__ @macros\/macros.h 49:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD1 :: Macro.Raw String
+bAD1 = Macro.objectLike "BAD1" ["0.1", "+", "1"]
+
+{-| __C declaration:__ @macro BAD2@
+
+    __defined at:__ @macros\/macros.h 50:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD2 :: Macro.Raw String
+bAD2 = Macro.objectLike "BAD2" ["2l", "*", "2ul"]
diff --git a/test-artefacts/fixtures/macros/macros.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/macros.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macros.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macros.2.raw/th.txt b/test-artefacts/fixtures/macros/macros.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macros.2.raw/th.txt
@@ -0,0 +1,505 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macros.h
+{-| __C declaration:__ @macro OBJECTLIKE1@
+
+    __defined at:__ @macros\/macros.h 1:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE1 :: Raw String
+{-| __C declaration:__ @macro OBJECTLIKE1@
+
+    __defined at:__ @macros\/macros.h 1:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE1 = objectLike "OBJECTLIKE1" ["1"]
+{-| __C declaration:__ @macro OBJECTLIKE2@
+
+    __defined at:__ @macros\/macros.h 2:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE2 :: Raw String
+{-| __C declaration:__ @macro OBJECTLIKE2@
+
+    __defined at:__ @macros\/macros.h 2:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE2 = objectLike "OBJECTLIKE2" ["(", "2", ")"]
+{-| __C declaration:__ @macro OBJECTLIKE3@
+
+    __defined at:__ @macros\/macros.h 3:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE3 :: Raw String
+{-| __C declaration:__ @macro OBJECTLIKE3@
+
+    __defined at:__ @macros\/macros.h 3:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE3 = objectLike "OBJECTLIKE3" ["3", "+", "3"]
+{-| __C declaration:__ @macro OBJECTLIKE4@
+
+    __defined at:__ @macros\/macros.h 4:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE4 :: Raw String
+{-| __C declaration:__ @macro OBJECTLIKE4@
+
+    __defined at:__ @macros\/macros.h 4:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE4 = objectLike "OBJECTLIKE4" ["(", "4", "+", "4", ")"]
+{-| __C declaration:__ @macro MEANING_OF_LIFE1@
+
+    __defined at:__ @macros\/macros.h 6:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE1 :: Raw String
+{-| __C declaration:__ @macro MEANING_OF_LIFE1@
+
+    __defined at:__ @macros\/macros.h 6:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE1 = objectLike "MEANING_OF_LIFE1" ["42"]
+{-| __C declaration:__ @macro MEANING_OF_LIFE2@
+
+    __defined at:__ @macros\/macros.h 7:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE2 :: Raw String
+{-| __C declaration:__ @macro MEANING_OF_LIFE2@
+
+    __defined at:__ @macros\/macros.h 7:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE2 = objectLike "MEANING_OF_LIFE2" ["052"]
+{-| __C declaration:__ @macro MEANING_OF_LIFE3@
+
+    __defined at:__ @macros\/macros.h 8:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE3 :: Raw String
+{-| __C declaration:__ @macro MEANING_OF_LIFE3@
+
+    __defined at:__ @macros\/macros.h 8:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE3 = objectLike "MEANING_OF_LIFE3" ["0x2a"]
+{-| __C declaration:__ @macro MEANING_OF_LIFE4@
+
+    __defined at:__ @macros\/macros.h 9:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE4 :: Raw String
+{-| __C declaration:__ @macro MEANING_OF_LIFE4@
+
+    __defined at:__ @macros\/macros.h 9:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE4 = objectLike "MEANING_OF_LIFE4" ["0X2A"]
+{-| __C declaration:__ @macro MEANING_OF_LIFE5@
+
+    __defined at:__ @macros\/macros.h 10:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE5 :: Raw String
+{-| __C declaration:__ @macro MEANING_OF_LIFE5@
+
+    __defined at:__ @macros\/macros.h 10:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE5 = objectLike "MEANING_OF_LIFE5" ["0b101010"]
+{-| __C declaration:__ @macro LONG_INT_TOKEN1@
+
+    __defined at:__ @macros\/macros.h 12:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN1 :: Raw String
+{-| __C declaration:__ @macro LONG_INT_TOKEN1@
+
+    __defined at:__ @macros\/macros.h 12:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN1 = objectLike "LONG_INT_TOKEN1" ["18446744073709550592ull"]
+{-| __C declaration:__ @macro LONG_INT_TOKEN2@
+
+    __defined at:__ @macros\/macros.h 13:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN2 :: Raw String
+{-| __C declaration:__ @macro LONG_INT_TOKEN2@
+
+    __defined at:__ @macros\/macros.h 13:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN2 = objectLike "LONG_INT_TOKEN2" ["18'446'744'073'709'550'592llu"]
+{-| __C declaration:__ @macro LONG_INT_TOKEN3@
+
+    __defined at:__ @macros\/macros.h 14:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN3 :: Raw String
+{-| __C declaration:__ @macro LONG_INT_TOKEN3@
+
+    __defined at:__ @macros\/macros.h 14:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN3 = objectLike "LONG_INT_TOKEN3" ["1844'6744'0737'0955'0592uLL"]
+{-| __C declaration:__ @macro LONG_INT_TOKEN4@
+
+    __defined at:__ @macros\/macros.h 15:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN4 :: Raw String
+{-| __C declaration:__ @macro LONG_INT_TOKEN4@
+
+    __defined at:__ @macros\/macros.h 15:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN4 = objectLike "LONG_INT_TOKEN4" ["184467'440737'0'95505'92LLU"]
+{-| __C declaration:__ @macro TUPLE1@
+
+    __defined at:__ @macros\/macros.h 17:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE1 :: Raw String
+{-| __C declaration:__ @macro TUPLE1@
+
+    __defined at:__ @macros\/macros.h 17:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE1 = objectLike "TUPLE1" ["(", "1", ",", "2", ")"]
+{-| __C declaration:__ @macro TUPLE2@
+
+    __defined at:__ @macros\/macros.h 18:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE2 :: Raw String
+{-| __C declaration:__ @macro TUPLE2@
+
+    __defined at:__ @macros\/macros.h 18:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE2 = objectLike "TUPLE2" ["3", ",", "4"]
+{-| __C declaration:__ @macro TUPLE3@
+
+    __defined at:__ @macros\/macros.h 19:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE3 :: Raw String
+{-| __C declaration:__ @macro TUPLE3@
+
+    __defined at:__ @macros\/macros.h 19:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE3 = objectLike "TUPLE3" ["5", ",", "6"]
+{-| __C declaration:__ @macro FLT1_1@
+
+    __defined at:__ @macros\/macros.h 24:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_1 :: Raw String
+{-| __C declaration:__ @macro FLT1_1@
+
+    __defined at:__ @macros\/macros.h 24:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_1 = objectLike "FLT1_1" ["11e4"]
+{-| __C declaration:__ @macro FLT1_2@
+
+    __defined at:__ @macros\/macros.h 25:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_2 :: Raw String
+{-| __C declaration:__ @macro FLT1_2@
+
+    __defined at:__ @macros\/macros.h 25:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_2 = objectLike "FLT1_2" ["12E-3"]
+{-| __C declaration:__ @macro FLT1_3@
+
+    __defined at:__ @macros\/macros.h 26:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_3 :: Raw String
+{-| __C declaration:__ @macro FLT1_3@
+
+    __defined at:__ @macros\/macros.h 26:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_3 = objectLike "FLT1_3" ["13e-03f"]
+{-| __C declaration:__ @macro FLT2_1@
+
+    __defined at:__ @macros\/macros.h 28:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_1 :: Raw String
+{-| __C declaration:__ @macro FLT2_1@
+
+    __defined at:__ @macros\/macros.h 28:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_1 = objectLike "FLT2_1" ["21."]
+{-| __C declaration:__ @macro FLT2_2@
+
+    __defined at:__ @macros\/macros.h 29:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_2 :: Raw String
+{-| __C declaration:__ @macro FLT2_2@
+
+    __defined at:__ @macros\/macros.h 29:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_2 = objectLike "FLT2_2" ["22.e2"]
+{-| __C declaration:__ @macro FLT2_3@
+
+    __defined at:__ @macros\/macros.h 30:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_3 :: Raw String
+{-| __C declaration:__ @macro FLT2_3@
+
+    __defined at:__ @macros\/macros.h 30:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_3 = objectLike "FLT2_3" ["23.f"]
+{-| __C declaration:__ @macro FLT3_1@
+
+    __defined at:__ @macros\/macros.h 32:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_1 :: Raw String
+{-| __C declaration:__ @macro FLT3_1@
+
+    __defined at:__ @macros\/macros.h 32:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_1 = objectLike "FLT3_1" ["31.0"]
+{-| __C declaration:__ @macro FLT3_2@
+
+    __defined at:__ @macros\/macros.h 33:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_2 :: Raw String
+{-| __C declaration:__ @macro FLT3_2@
+
+    __defined at:__ @macros\/macros.h 33:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_2 = objectLike "FLT3_2" [".32"]
+{-| __C declaration:__ @macro FLT3_3@
+
+    __defined at:__ @macros\/macros.h 34:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_3 :: Raw String
+{-| __C declaration:__ @macro FLT3_3@
+
+    __defined at:__ @macros\/macros.h 34:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_3 = objectLike "FLT3_3" [".33e2"]
+{-| __C declaration:__ @macro FLT3_4@
+
+    __defined at:__ @macros\/macros.h 35:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_4 :: Raw String
+{-| __C declaration:__ @macro FLT3_4@
+
+    __defined at:__ @macros\/macros.h 35:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_4 = objectLike "FLT3_4" [".34e-2f"]
+{-| __C declaration:__ @macro FLT4_1@
+
+    __defined at:__ @macros\/macros.h 37:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_1 :: Raw String
+{-| __C declaration:__ @macro FLT4_1@
+
+    __defined at:__ @macros\/macros.h 37:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_1 = objectLike "FLT4_1" ["0x41p4"]
+{-| __C declaration:__ @macro FLT4_2@
+
+    __defined at:__ @macros\/macros.h 38:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_2 :: Raw String
+{-| __C declaration:__ @macro FLT4_2@
+
+    __defined at:__ @macros\/macros.h 38:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_2 = objectLike "FLT4_2" ["0x42P-3"]
+{-| __C declaration:__ @macro FLT4_3@
+
+    __defined at:__ @macros\/macros.h 39:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_3 :: Raw String
+{-| __C declaration:__ @macro FLT4_3@
+
+    __defined at:__ @macros\/macros.h 39:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_3 = objectLike "FLT4_3" ["0x43p-03f"]
+{-| __C declaration:__ @macro FLT5_1@
+
+    __defined at:__ @macros\/macros.h 41:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_1 :: Raw String
+{-| __C declaration:__ @macro FLT5_1@
+
+    __defined at:__ @macros\/macros.h 41:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_1 = objectLike "FLT5_1" ["0x51.p0"]
+{-| __C declaration:__ @macro FLT5_2@
+
+    __defined at:__ @macros\/macros.h 42:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_2 :: Raw String
+{-| __C declaration:__ @macro FLT5_2@
+
+    __defined at:__ @macros\/macros.h 42:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_2 = objectLike "FLT5_2" ["0x52.P0f"]
+{-| __C declaration:__ @macro FLT6_1@
+
+    __defined at:__ @macros\/macros.h 44:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_1 :: Raw String
+{-| __C declaration:__ @macro FLT6_1@
+
+    __defined at:__ @macros\/macros.h 44:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_1 = objectLike "FLT6_1" ["0x61.0P2"]
+{-| __C declaration:__ @macro FLT6_2@
+
+    __defined at:__ @macros\/macros.h 45:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_2 :: Raw String
+{-| __C declaration:__ @macro FLT6_2@
+
+    __defined at:__ @macros\/macros.h 45:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_2 = objectLike "FLT6_2" ["0x.62p2"]
+{-| __C declaration:__ @macro FLT6_3@
+
+    __defined at:__ @macros\/macros.h 46:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_3 :: Raw String
+{-| __C declaration:__ @macro FLT6_3@
+
+    __defined at:__ @macros\/macros.h 46:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_3 = objectLike "FLT6_3" ["0x.63p-2f"]
+{-| __C declaration:__ @macro BAD1@
+
+    __defined at:__ @macros\/macros.h 49:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD1 :: Raw String
+{-| __C declaration:__ @macro BAD1@
+
+    __defined at:__ @macros\/macros.h 49:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD1 = objectLike "BAD1" ["0.1", "+", "1"]
+{-| __C declaration:__ @macro BAD2@
+
+    __defined at:__ @macros\/macros.h 50:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD2 :: Raw String
+{-| __C declaration:__ @macro BAD2@
+
+    __defined at:__ @macros\/macros.h 50:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD2 = objectLike "BAD2" ["2l", "*", "2ul"]
diff --git a/test-artefacts/fixtures/macros/macros/Example.hs b/test-artefacts/fixtures/macros/macros/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macros/Example.hs
@@ -0,0 +1,377 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.oBJECTLIKE1
+    , Example.oBJECTLIKE2
+    , Example.oBJECTLIKE3
+    , Example.oBJECTLIKE4
+    , Example.mEANING_OF_LIFE1
+    , Example.mEANING_OF_LIFE2
+    , Example.mEANING_OF_LIFE3
+    , Example.mEANING_OF_LIFE4
+    , Example.mEANING_OF_LIFE5
+    , Example.lONG_INT_TOKEN1
+    , Example.lONG_INT_TOKEN2
+    , Example.lONG_INT_TOKEN3
+    , Example.lONG_INT_TOKEN4
+    , Example.tUPLE1
+    , Example.tUPLE2
+    , Example.tUPLE3
+    , Example.fLT1_1
+    , Example.fLT1_2
+    , Example.fLT1_3
+    , Example.fLT2_1
+    , Example.fLT2_2
+    , Example.fLT2_3
+    , Example.fLT3_1
+    , Example.fLT3_2
+    , Example.fLT3_3
+    , Example.fLT3_4
+    , Example.fLT4_1
+    , Example.fLT4_2
+    , Example.fLT4_3
+    , Example.fLT5_1
+    , Example.fLT5_2
+    , Example.fLT6_1
+    , Example.fLT6_2
+    , Example.fLT6_3
+    , Example.bAD1
+    , Example.bAD2
+    )
+  where
+
+import qualified C.Expr.HostPlatform
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @macro OBJECTLIKE1@
+
+    __defined at:__ @macros\/macros.h 1:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE1 :: BG.CInt
+oBJECTLIKE1 = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro OBJECTLIKE2@
+
+    __defined at:__ @macros\/macros.h 2:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE2 :: BG.CInt
+oBJECTLIKE2 = (2 :: BG.CInt)
+
+{-| __C declaration:__ @macro OBJECTLIKE3@
+
+    __defined at:__ @macros\/macros.h 3:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE3 :: BG.CInt
+oBJECTLIKE3 =
+  (C.Expr.HostPlatform.+) (3 :: BG.CInt) (3 :: BG.CInt)
+
+{-| __C declaration:__ @macro OBJECTLIKE4@
+
+    __defined at:__ @macros\/macros.h 4:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE4 :: BG.CInt
+oBJECTLIKE4 =
+  (C.Expr.HostPlatform.+) (4 :: BG.CInt) (4 :: BG.CInt)
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE1@
+
+    __defined at:__ @macros\/macros.h 6:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE1 :: BG.CInt
+mEANING_OF_LIFE1 = (42 :: BG.CInt)
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE2@
+
+    __defined at:__ @macros\/macros.h 7:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE2 :: BG.CInt
+mEANING_OF_LIFE2 = (42 :: BG.CInt)
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE3@
+
+    __defined at:__ @macros\/macros.h 8:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE3 :: BG.CInt
+mEANING_OF_LIFE3 = (42 :: BG.CInt)
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE4@
+
+    __defined at:__ @macros\/macros.h 9:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE4 :: BG.CInt
+mEANING_OF_LIFE4 = (42 :: BG.CInt)
+
+{-| __C declaration:__ @macro MEANING_OF_LIFE5@
+
+    __defined at:__ @macros\/macros.h 10:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE5 :: BG.CInt
+mEANING_OF_LIFE5 = (42 :: BG.CInt)
+
+{-| __C declaration:__ @macro LONG_INT_TOKEN1@
+
+    __defined at:__ @macros\/macros.h 12:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN1 :: BG.CULLong
+lONG_INT_TOKEN1 =
+  (18446744073709550592 :: BG.CULLong)
+
+{-| __C declaration:__ @macro LONG_INT_TOKEN2@
+
+    __defined at:__ @macros\/macros.h 13:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN2 :: BG.CULLong
+lONG_INT_TOKEN2 =
+  (18446744073709550592 :: BG.CULLong)
+
+{-| __C declaration:__ @macro LONG_INT_TOKEN3@
+
+    __defined at:__ @macros\/macros.h 14:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN3 :: BG.CULLong
+lONG_INT_TOKEN3 =
+  (18446744073709550592 :: BG.CULLong)
+
+{-| __C declaration:__ @macro LONG_INT_TOKEN4@
+
+    __defined at:__ @macros\/macros.h 15:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN4 :: BG.CULLong
+lONG_INT_TOKEN4 =
+  (18446744073709550592 :: BG.CULLong)
+
+{-| __C declaration:__ @macro TUPLE1@
+
+    __defined at:__ @macros\/macros.h 17:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE1 :: (BG.CInt, BG.CInt)
+tUPLE1 = ((1 :: BG.CInt), (2 :: BG.CInt))
+
+{-| __C declaration:__ @macro TUPLE2@
+
+    __defined at:__ @macros\/macros.h 18:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE2 :: (BG.CInt, BG.CInt)
+tUPLE2 = ((3 :: BG.CInt), (4 :: BG.CInt))
+
+{-| __C declaration:__ @macro TUPLE3@
+
+    __defined at:__ @macros\/macros.h 19:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE3 :: (BG.CInt, BG.CInt)
+tUPLE3 = ((5 :: BG.CInt), (6 :: BG.CInt))
+
+{-| __C declaration:__ @macro FLT1_1@
+
+    __defined at:__ @macros\/macros.h 24:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_1 :: BG.CDouble
+fLT1_1 = (110000.0 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT1_2@
+
+    __defined at:__ @macros\/macros.h 25:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_2 :: BG.CDouble
+fLT1_2 = (1.2e-2 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT1_3@
+
+    __defined at:__ @macros\/macros.h 26:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_3 :: BG.CFloat
+fLT1_3 = (1.3e-2 :: BG.CFloat)
+
+{-| __C declaration:__ @macro FLT2_1@
+
+    __defined at:__ @macros\/macros.h 28:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_1 :: BG.CDouble
+fLT2_1 = (21.0 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT2_2@
+
+    __defined at:__ @macros\/macros.h 29:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_2 :: BG.CDouble
+fLT2_2 = (2200.0 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT2_3@
+
+    __defined at:__ @macros\/macros.h 30:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_3 :: BG.CFloat
+fLT2_3 = (23.0 :: BG.CFloat)
+
+{-| __C declaration:__ @macro FLT3_1@
+
+    __defined at:__ @macros\/macros.h 32:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_1 :: BG.CDouble
+fLT3_1 = (31.0 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT3_2@
+
+    __defined at:__ @macros\/macros.h 33:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_2 :: BG.CDouble
+fLT3_2 = (0.32 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT3_3@
+
+    __defined at:__ @macros\/macros.h 34:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_3 :: BG.CDouble
+fLT3_3 = (33.0 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT3_4@
+
+    __defined at:__ @macros\/macros.h 35:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_4 :: BG.CFloat
+fLT3_4 = (3.4e-3 :: BG.CFloat)
+
+{-| __C declaration:__ @macro FLT4_1@
+
+    __defined at:__ @macros\/macros.h 37:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_1 :: BG.CDouble
+fLT4_1 = (650000.0 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT4_2@
+
+    __defined at:__ @macros\/macros.h 38:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_2 :: BG.CDouble
+fLT4_2 = (6.6e-2 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT4_3@
+
+    __defined at:__ @macros\/macros.h 39:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_3 :: BG.CFloat
+fLT4_3 = (6.7e-2 :: BG.CFloat)
+
+{-| __C declaration:__ @macro FLT5_1@
+
+    __defined at:__ @macros\/macros.h 41:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_1 :: BG.CDouble
+fLT5_1 = (81.0 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT5_2@
+
+    __defined at:__ @macros\/macros.h 42:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_2 :: BG.CFloat
+fLT5_2 = (82.0 :: BG.CFloat)
+
+{-| __C declaration:__ @macro FLT6_1@
+
+    __defined at:__ @macros\/macros.h 44:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_1 :: BG.CDouble
+fLT6_1 = (15520.0 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT6_2@
+
+    __defined at:__ @macros\/macros.h 45:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_2 :: BG.CDouble
+fLT6_2 = (98.0 :: BG.CDouble)
+
+{-| __C declaration:__ @macro FLT6_3@
+
+    __defined at:__ @macros\/macros.h 46:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_3 :: BG.CFloat
+fLT6_3 = (9.9e-3 :: BG.CFloat)
+
+{-| __C declaration:__ @macro BAD1@
+
+    __defined at:__ @macros\/macros.h 49:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD1 :: BG.CDouble
+bAD1 =
+  (C.Expr.HostPlatform.+) (0.1 :: BG.CDouble) (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro BAD2@
+
+    __defined at:__ @macros\/macros.h 50:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD2 :: BG.CULong
+bAD2 =
+  (C.Expr.HostPlatform.*) (2 :: BG.CLong) (2 :: BG.CULong)
diff --git a/test-artefacts/fixtures/macros/macros/bindingspec.yaml b/test-artefacts/fixtures/macros/macros/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macros/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/macros/th.txt b/test-artefacts/fixtures/macros/macros/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/macros/th.txt
@@ -0,0 +1,505 @@
+-- addDependentFile test-artefacts/headers/golden/macros/macros.h
+{-| __C declaration:__ @macro OBJECTLIKE1@
+
+    __defined at:__ @macros\/macros.h 1:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE1 :: CInt
+{-| __C declaration:__ @macro OBJECTLIKE1@
+
+    __defined at:__ @macros\/macros.h 1:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE1 = 1 :: CInt
+{-| __C declaration:__ @macro OBJECTLIKE2@
+
+    __defined at:__ @macros\/macros.h 2:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE2 :: CInt
+{-| __C declaration:__ @macro OBJECTLIKE2@
+
+    __defined at:__ @macros\/macros.h 2:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE2 = 2 :: CInt
+{-| __C declaration:__ @macro OBJECTLIKE3@
+
+    __defined at:__ @macros\/macros.h 3:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE3 :: CInt
+{-| __C declaration:__ @macro OBJECTLIKE3@
+
+    __defined at:__ @macros\/macros.h 3:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE3 = (+) (3 :: CInt) (3 :: CInt)
+{-| __C declaration:__ @macro OBJECTLIKE4@
+
+    __defined at:__ @macros\/macros.h 4:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE4 :: CInt
+{-| __C declaration:__ @macro OBJECTLIKE4@
+
+    __defined at:__ @macros\/macros.h 4:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+oBJECTLIKE4 = (+) (4 :: CInt) (4 :: CInt)
+{-| __C declaration:__ @macro MEANING_OF_LIFE1@
+
+    __defined at:__ @macros\/macros.h 6:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE1 :: CInt
+{-| __C declaration:__ @macro MEANING_OF_LIFE1@
+
+    __defined at:__ @macros\/macros.h 6:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE1 = 42 :: CInt
+{-| __C declaration:__ @macro MEANING_OF_LIFE2@
+
+    __defined at:__ @macros\/macros.h 7:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE2 :: CInt
+{-| __C declaration:__ @macro MEANING_OF_LIFE2@
+
+    __defined at:__ @macros\/macros.h 7:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE2 = 42 :: CInt
+{-| __C declaration:__ @macro MEANING_OF_LIFE3@
+
+    __defined at:__ @macros\/macros.h 8:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE3 :: CInt
+{-| __C declaration:__ @macro MEANING_OF_LIFE3@
+
+    __defined at:__ @macros\/macros.h 8:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE3 = 42 :: CInt
+{-| __C declaration:__ @macro MEANING_OF_LIFE4@
+
+    __defined at:__ @macros\/macros.h 9:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE4 :: CInt
+{-| __C declaration:__ @macro MEANING_OF_LIFE4@
+
+    __defined at:__ @macros\/macros.h 9:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE4 = 42 :: CInt
+{-| __C declaration:__ @macro MEANING_OF_LIFE5@
+
+    __defined at:__ @macros\/macros.h 10:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE5 :: CInt
+{-| __C declaration:__ @macro MEANING_OF_LIFE5@
+
+    __defined at:__ @macros\/macros.h 10:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+mEANING_OF_LIFE5 = 42 :: CInt
+{-| __C declaration:__ @macro LONG_INT_TOKEN1@
+
+    __defined at:__ @macros\/macros.h 12:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN1 :: CULLong
+{-| __C declaration:__ @macro LONG_INT_TOKEN1@
+
+    __defined at:__ @macros\/macros.h 12:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN1 = 18446744073709550592 :: CULLong
+{-| __C declaration:__ @macro LONG_INT_TOKEN2@
+
+    __defined at:__ @macros\/macros.h 13:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN2 :: CULLong
+{-| __C declaration:__ @macro LONG_INT_TOKEN2@
+
+    __defined at:__ @macros\/macros.h 13:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN2 = 18446744073709550592 :: CULLong
+{-| __C declaration:__ @macro LONG_INT_TOKEN3@
+
+    __defined at:__ @macros\/macros.h 14:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN3 :: CULLong
+{-| __C declaration:__ @macro LONG_INT_TOKEN3@
+
+    __defined at:__ @macros\/macros.h 14:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN3 = 18446744073709550592 :: CULLong
+{-| __C declaration:__ @macro LONG_INT_TOKEN4@
+
+    __defined at:__ @macros\/macros.h 15:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN4 :: CULLong
+{-| __C declaration:__ @macro LONG_INT_TOKEN4@
+
+    __defined at:__ @macros\/macros.h 15:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+lONG_INT_TOKEN4 = 18446744073709550592 :: CULLong
+{-| __C declaration:__ @macro TUPLE1@
+
+    __defined at:__ @macros\/macros.h 17:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE1 :: (CInt, CInt)
+{-| __C declaration:__ @macro TUPLE1@
+
+    __defined at:__ @macros\/macros.h 17:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE1 = (1 :: CInt, 2 :: CInt)
+{-| __C declaration:__ @macro TUPLE2@
+
+    __defined at:__ @macros\/macros.h 18:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE2 :: (CInt, CInt)
+{-| __C declaration:__ @macro TUPLE2@
+
+    __defined at:__ @macros\/macros.h 18:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE2 = (3 :: CInt, 4 :: CInt)
+{-| __C declaration:__ @macro TUPLE3@
+
+    __defined at:__ @macros\/macros.h 19:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE3 :: (CInt, CInt)
+{-| __C declaration:__ @macro TUPLE3@
+
+    __defined at:__ @macros\/macros.h 19:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+tUPLE3 = (5 :: CInt, 6 :: CInt)
+{-| __C declaration:__ @macro FLT1_1@
+
+    __defined at:__ @macros\/macros.h 24:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_1 :: CDouble
+{-| __C declaration:__ @macro FLT1_1@
+
+    __defined at:__ @macros\/macros.h 24:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_1 = 110000.0 :: CDouble
+{-| __C declaration:__ @macro FLT1_2@
+
+    __defined at:__ @macros\/macros.h 25:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_2 :: CDouble
+{-| __C declaration:__ @macro FLT1_2@
+
+    __defined at:__ @macros\/macros.h 25:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_2 = 0.0120000000000000002498001805406602215953171253204345703125 :: CDouble
+{-| __C declaration:__ @macro FLT1_3@
+
+    __defined at:__ @macros\/macros.h 26:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_3 :: CFloat
+{-| __C declaration:__ @macro FLT1_3@
+
+    __defined at:__ @macros\/macros.h 26:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT1_3 = 0.0130000002682209014892578125 :: CFloat
+{-| __C declaration:__ @macro FLT2_1@
+
+    __defined at:__ @macros\/macros.h 28:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_1 :: CDouble
+{-| __C declaration:__ @macro FLT2_1@
+
+    __defined at:__ @macros\/macros.h 28:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_1 = 21.0 :: CDouble
+{-| __C declaration:__ @macro FLT2_2@
+
+    __defined at:__ @macros\/macros.h 29:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_2 :: CDouble
+{-| __C declaration:__ @macro FLT2_2@
+
+    __defined at:__ @macros\/macros.h 29:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_2 = 2200.0 :: CDouble
+{-| __C declaration:__ @macro FLT2_3@
+
+    __defined at:__ @macros\/macros.h 30:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_3 :: CFloat
+{-| __C declaration:__ @macro FLT2_3@
+
+    __defined at:__ @macros\/macros.h 30:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT2_3 = 23.0 :: CFloat
+{-| __C declaration:__ @macro FLT3_1@
+
+    __defined at:__ @macros\/macros.h 32:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_1 :: CDouble
+{-| __C declaration:__ @macro FLT3_1@
+
+    __defined at:__ @macros\/macros.h 32:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_1 = 31.0 :: CDouble
+{-| __C declaration:__ @macro FLT3_2@
+
+    __defined at:__ @macros\/macros.h 33:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_2 :: CDouble
+{-| __C declaration:__ @macro FLT3_2@
+
+    __defined at:__ @macros\/macros.h 33:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_2 = 0.320000000000000006661338147750939242541790008544921875 :: CDouble
+{-| __C declaration:__ @macro FLT3_3@
+
+    __defined at:__ @macros\/macros.h 34:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_3 :: CDouble
+{-| __C declaration:__ @macro FLT3_3@
+
+    __defined at:__ @macros\/macros.h 34:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_3 = 33.0 :: CDouble
+{-| __C declaration:__ @macro FLT3_4@
+
+    __defined at:__ @macros\/macros.h 35:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_4 :: CFloat
+{-| __C declaration:__ @macro FLT3_4@
+
+    __defined at:__ @macros\/macros.h 35:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT3_4 = 3.40000004507601261138916015625e-3 :: CFloat
+{-| __C declaration:__ @macro FLT4_1@
+
+    __defined at:__ @macros\/macros.h 37:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_1 :: CDouble
+{-| __C declaration:__ @macro FLT4_1@
+
+    __defined at:__ @macros\/macros.h 37:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_1 = 650000.0 :: CDouble
+{-| __C declaration:__ @macro FLT4_2@
+
+    __defined at:__ @macros\/macros.h 38:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_2 :: CDouble
+{-| __C declaration:__ @macro FLT4_2@
+
+    __defined at:__ @macros\/macros.h 38:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_2 = 0.066000000000000003108624468950438313186168670654296875 :: CDouble
+{-| __C declaration:__ @macro FLT4_3@
+
+    __defined at:__ @macros\/macros.h 39:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_3 :: CFloat
+{-| __C declaration:__ @macro FLT4_3@
+
+    __defined at:__ @macros\/macros.h 39:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT4_3 = 0.0670000016689300537109375 :: CFloat
+{-| __C declaration:__ @macro FLT5_1@
+
+    __defined at:__ @macros\/macros.h 41:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_1 :: CDouble
+{-| __C declaration:__ @macro FLT5_1@
+
+    __defined at:__ @macros\/macros.h 41:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_1 = 81.0 :: CDouble
+{-| __C declaration:__ @macro FLT5_2@
+
+    __defined at:__ @macros\/macros.h 42:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_2 :: CFloat
+{-| __C declaration:__ @macro FLT5_2@
+
+    __defined at:__ @macros\/macros.h 42:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT5_2 = 82.0 :: CFloat
+{-| __C declaration:__ @macro FLT6_1@
+
+    __defined at:__ @macros\/macros.h 44:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_1 :: CDouble
+{-| __C declaration:__ @macro FLT6_1@
+
+    __defined at:__ @macros\/macros.h 44:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_1 = 15520.0 :: CDouble
+{-| __C declaration:__ @macro FLT6_2@
+
+    __defined at:__ @macros\/macros.h 45:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_2 :: CDouble
+{-| __C declaration:__ @macro FLT6_2@
+
+    __defined at:__ @macros\/macros.h 45:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_2 = 98.0 :: CDouble
+{-| __C declaration:__ @macro FLT6_3@
+
+    __defined at:__ @macros\/macros.h 46:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_3 :: CFloat
+{-| __C declaration:__ @macro FLT6_3@
+
+    __defined at:__ @macros\/macros.h 46:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+fLT6_3 = 9.8999999463558197021484375e-3 :: CFloat
+{-| __C declaration:__ @macro BAD1@
+
+    __defined at:__ @macros\/macros.h 49:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD1 :: CDouble
+{-| __C declaration:__ @macro BAD1@
+
+    __defined at:__ @macros\/macros.h 49:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD1 = (+) (0.1000000000000000055511151231257827021181583404541015625 :: CDouble) (1 :: CInt)
+{-| __C declaration:__ @macro BAD2@
+
+    __defined at:__ @macros\/macros.h 50:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD2 :: CULong
+{-| __C declaration:__ @macro BAD2@
+
+    __defined at:__ @macros\/macros.h 50:9@
+
+    __exported by:__ @macros\/macros.h@
+-}
+bAD2 = (*) (2 :: CLong) (2 :: CULong)
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like.1.empty/Example/Global.hs b/test-artefacts/fixtures/macros/object_like_as_function_like.1.empty/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like.1.empty/Example/Global.hs
@@ -0,0 +1,42 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.a
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/object_like_as_function_like.h>"
+  , "/* test_macrosobject_like_as_function_Example_get_a */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_06ace787c069879f (void)"
+  , "{"
+  , "  return &a;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+foreign import ccall unsafe "hs_bindgen_06ace787c069879f" hs_bindgen_06ace787c069879f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+hs_bindgen_06ace787c069879f :: IO (BG.Ptr BG.CInt)
+hs_bindgen_06ace787c069879f =
+  fmap BG.fromFFIType hs_bindgen_06ace787c069879f_base
+
+{-# NOINLINE a #-}
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 13:5@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+a :: BG.Ptr BG.CInt
+a = BG.unsafePerformIO hs_bindgen_06ace787c069879f
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/object_like_as_function_like.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like.1.empty/th.txt b/test-artefacts/fixtures/macros/object_like_as_function_like.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like.1.empty/th.txt
@@ -0,0 +1,30 @@
+-- addDependentFile test-artefacts/headers/golden/macros/object_like_as_function_like.h
+-- #include <macros/object_like_as_function_like.h>
+-- /* test_macrosobject_like_as_function_Example_get_a */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_06ace787c069879f (void)
+-- {
+--   return &a;
+-- }
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+foreign import ccall unsafe "hs_bindgen_06ace787c069879f" hs_bindgen_06ace787c069879f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+hs_bindgen_06ace787c069879f :: IO (Ptr CInt)
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+hs_bindgen_06ace787c069879f = fmap fromFFIType hs_bindgen_06ace787c069879f_base
+{-# NOINLINE a #-}
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 13:5@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+a :: Ptr CInt
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 13:5@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+a = unsafePerformIO hs_bindgen_06ace787c069879f
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/Example.hs b/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/Example.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.f
+    , Example.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 10:9@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+f :: Macro.Raw String
+f = Macro.functionLike "F" ["x", "y"] ["x", "+", "y"]
+
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 11:9@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+g :: Macro.Raw String
+g =
+  Macro.objectLike "G" ["(", "x", ",", "y", ")", "x", "+", "y"]
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/Example/Global.hs b/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/Example/Global.hs
@@ -0,0 +1,42 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.a
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/object_like_as_function_like.h>"
+  , "/* test_macrosobject_like_as_function_Example_get_a */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_06ace787c069879f (void)"
+  , "{"
+  , "  return &a;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+foreign import ccall unsafe "hs_bindgen_06ace787c069879f" hs_bindgen_06ace787c069879f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+hs_bindgen_06ace787c069879f :: IO (BG.Ptr BG.CInt)
+hs_bindgen_06ace787c069879f =
+  fmap BG.fromFFIType hs_bindgen_06ace787c069879f_base
+
+{-# NOINLINE a #-}
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 13:5@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+a :: BG.Ptr BG.CInt
+a = BG.unsafePerformIO hs_bindgen_06ace787c069879f
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/th.txt b/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like.2.raw/th.txt
@@ -0,0 +1,58 @@
+-- addDependentFile test-artefacts/headers/golden/macros/object_like_as_function_like.h
+-- #include <macros/object_like_as_function_like.h>
+-- /* test_macrosobject_like_as_function_Example_get_a */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_06ace787c069879f (void)
+-- {
+--   return &a;
+-- }
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 10:9@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+f :: Raw String
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 10:9@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+f = functionLike "F" ["x", "y"] ["x", "+", "y"]
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 11:9@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+g :: Raw String
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 11:9@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+g = objectLike "G" ["(", "x", ",", "y", ")", "x", "+", "y"]
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+foreign import ccall unsafe "hs_bindgen_06ace787c069879f" hs_bindgen_06ace787c069879f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+hs_bindgen_06ace787c069879f :: IO (Ptr CInt)
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+hs_bindgen_06ace787c069879f = fmap fromFFIType hs_bindgen_06ace787c069879f_base
+{-# NOINLINE a #-}
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 13:5@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+a :: Ptr CInt
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 13:5@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+a = unsafePerformIO hs_bindgen_06ace787c069879f
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like/Example.hs b/test-artefacts/fixtures/macros/object_like_as_function_like/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like/Example.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.f
+    )
+  where
+
+import qualified C.Expr.HostPlatform
+
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 10:9@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+f :: forall a0 b1. C.Expr.HostPlatform.Add a0 b1 => a0 -> b1 -> C.Expr.HostPlatform.AddRes a0 b1
+f = \x0 -> \y1 -> (C.Expr.HostPlatform.+) x0 y1
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like/Example/Global.hs b/test-artefacts/fixtures/macros/object_like_as_function_like/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like/Example/Global.hs
@@ -0,0 +1,42 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.a
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/object_like_as_function_like.h>"
+  , "/* test_macrosobject_like_as_function_Example_get_a */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_06ace787c069879f (void)"
+  , "{"
+  , "  return &a;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+foreign import ccall unsafe "hs_bindgen_06ace787c069879f" hs_bindgen_06ace787c069879f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+hs_bindgen_06ace787c069879f :: IO (BG.Ptr BG.CInt)
+hs_bindgen_06ace787c069879f =
+  fmap BG.fromFFIType hs_bindgen_06ace787c069879f_base
+
+{-# NOINLINE a #-}
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 13:5@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+a :: BG.Ptr BG.CInt
+a = BG.unsafePerformIO hs_bindgen_06ace787c069879f
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like/bindingspec.yaml b/test-artefacts/fixtures/macros/object_like_as_function_like/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/object_like_as_function_like/th.txt b/test-artefacts/fixtures/macros/object_like_as_function_like/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/object_like_as_function_like/th.txt
@@ -0,0 +1,44 @@
+-- addDependentFile test-artefacts/headers/golden/macros/object_like_as_function_like.h
+-- #include <macros/object_like_as_function_like.h>
+-- /* test_macrosobject_like_as_function_Example_get_a */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_06ace787c069879f (void)
+-- {
+--   return &a;
+-- }
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 10:9@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+f :: forall a_0 b_1 . Add a_0 b_1 => a_0 -> b_1 -> AddRes a_0 b_1
+{-| __C declaration:__ @macro F@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 10:9@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+f = \x_0 -> \y_1 -> (+) x_0 y_1
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+foreign import ccall unsafe "hs_bindgen_06ace787c069879f" hs_bindgen_06ace787c069879f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+hs_bindgen_06ace787c069879f :: IO (Ptr CInt)
+-- __unique:__ @test_macrosobject_like_as_function_Example_get_a@
+hs_bindgen_06ace787c069879f = fmap fromFFIType hs_bindgen_06ace787c069879f_base
+{-# NOINLINE a #-}
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 13:5@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+a :: Ptr CInt
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/object_like_as_function_like.h 13:5@
+
+    __exported by:__ @macros\/object_like_as_function_like.h@
+-}
+a = unsafePerformIO hs_bindgen_06ace787c069879f
diff --git a/test-artefacts/fixtures/macros/parse/elaborate.1.empty/Example.hs b/test-artefacts/fixtures/macros/parse/elaborate.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/elaborate.1.empty/Example.hs
@@ -0,0 +1,123 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Outer_int(..)
+    , Example.Inner_int(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @outer_int@
+
+    __defined at:__ @macros\/parse\/elaborate.h 8:13@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Outer_int = Outer_int
+  { unwrapOuter_int :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapOuter_int" Outer_int ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Outer_int {unwrapOuter_int = y1}, BG.getField @"unwrapOuter_int" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapOuter_int" (BG.Ptr Outer_int) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapOuter_int")
+
+instance HasCField.HasCField Outer_int "unwrapOuter_int" where
+
+  type CFieldType Outer_int "unwrapOuter_int" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @inner_int@
+
+    __defined at:__ @elaborate_inner.h 3:19@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Inner_int = Inner_int
+  { unwrapInner_int :: Outer_int
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Outer_int
+         ) => BG.CompatHasField.HasField "unwrapInner_int" Inner_int ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Inner_int {unwrapInner_int = y1}, BG.getField @"unwrapInner_int" x0)
+
+instance ( ty ~ Outer_int
+         ) => BG.HasField "unwrapInner_int" (BG.Ptr Inner_int) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInner_int")
+
+instance HasCField.HasCField Inner_int "unwrapInner_int" where
+
+  type CFieldType Inner_int "unwrapInner_int" =
+    Outer_int
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/elaborate.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/elaborate.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/elaborate.1.empty/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/elaborate.h
+  cname: inner_int
+  hsname: Inner_int
+- headers: macros/parse/elaborate.h
+  cname: outer_int
+  hsname: Outer_int
+hstypes:
+- hsname: Inner_int
+  representation:
+    newtype:
+      constructor: Inner_int
+      fields:
+      - unwrapInner_int
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer_int
+  representation:
+    newtype:
+      constructor: Outer_int
+      fields:
+      - unwrapOuter_int
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/elaborate.1.empty/th.txt b/test-artefacts/fixtures/macros/parse/elaborate.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/elaborate.1.empty/th.txt
@@ -0,0 +1,69 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/elaborate_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/elaborate.h
+{-| __C declaration:__ @outer_int@
+
+    __defined at:__ @macros\/parse\/elaborate.h 8:13@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Outer_int
+    = Outer_int {unwrapOuter_int :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapOuter_int" Outer_int ty
+    where hasField = \x_0 -> (\y_1 -> Outer_int{unwrapOuter_int = y_1},
+                              getField @"unwrapOuter_int" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapOuter_int" (Ptr Outer_int) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapOuter_int")
+instance HasCField Outer_int "unwrapOuter_int"
+    where type CFieldType Outer_int "unwrapOuter_int" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @inner_int@
+
+    __defined at:__ @elaborate_inner.h 3:19@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Inner_int
+    = Inner_int {unwrapInner_int :: Outer_int}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty Outer_int =>
+         HasField "unwrapInner_int" Inner_int ty
+    where hasField = \x_0 -> (\y_1 -> Inner_int{unwrapInner_int = y_1},
+                              getField @"unwrapInner_int" x_0)
+instance (~) ty Outer_int =>
+         HasField "unwrapInner_int" (Ptr Inner_int) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInner_int")
+instance HasCField Inner_int "unwrapInner_int"
+    where type CFieldType Inner_int "unwrapInner_int" = Outer_int
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/elaborate.2.raw/Example.hs b/test-artefacts/fixtures/macros/parse/elaborate.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/elaborate.2.raw/Example.hs
@@ -0,0 +1,174 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.iNNER_A
+    , Example.iNNER_B
+    , Example.oUTER_A
+    , Example.Outer_int(..)
+    , Example.Inner_int(..)
+    , Example.oUTER_B
+    , Example.oUTER_C
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, String, type (~))
+
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @elaborate_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_A :: Macro.Raw String
+iNNER_A = Macro.objectLike "INNER_A" ["OUTER_A"]
+
+{-| __C declaration:__ @macro INNER_B@
+
+    __defined at:__ @elaborate_inner.h 2:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_B :: Macro.Raw String
+iNNER_B = Macro.objectLike "INNER_B" ["2"]
+
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/elaborate.h 7:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_A :: Macro.Raw String
+oUTER_A = Macro.objectLike "OUTER_A" ["1"]
+
+{-| __C declaration:__ @outer_int@
+
+    __defined at:__ @macros\/parse\/elaborate.h 8:13@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Outer_int = Outer_int
+  { unwrapOuter_int :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapOuter_int" Outer_int ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Outer_int {unwrapOuter_int = y1}, BG.getField @"unwrapOuter_int" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapOuter_int" (BG.Ptr Outer_int) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapOuter_int")
+
+instance HasCField.HasCField Outer_int "unwrapOuter_int" where
+
+  type CFieldType Outer_int "unwrapOuter_int" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @inner_int@
+
+    __defined at:__ @elaborate_inner.h 3:19@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Inner_int = Inner_int
+  { unwrapInner_int :: Outer_int
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Outer_int
+         ) => BG.CompatHasField.HasField "unwrapInner_int" Inner_int ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Inner_int {unwrapInner_int = y1}, BG.getField @"unwrapInner_int" x0)
+
+instance ( ty ~ Outer_int
+         ) => BG.HasField "unwrapInner_int" (BG.Ptr Inner_int) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInner_int")
+
+instance HasCField.HasCField Inner_int "unwrapInner_int" where
+
+  type CFieldType Inner_int "unwrapInner_int" =
+    Outer_int
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro OUTER_B@
+
+    __defined at:__ @macros\/parse\/elaborate.h 12:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_B :: Macro.Raw String
+oUTER_B = Macro.objectLike "OUTER_B" ["INNER_A"]
+
+{-| __C declaration:__ @macro OUTER_C@
+
+    __defined at:__ @macros\/parse\/elaborate.h 13:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_C :: Macro.Raw String
+oUTER_C = Macro.objectLike "OUTER_C" ["INNER_B"]
diff --git a/test-artefacts/fixtures/macros/parse/elaborate.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/elaborate.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/elaborate.2.raw/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/elaborate.h
+  cname: inner_int
+  hsname: Inner_int
+- headers: macros/parse/elaborate.h
+  cname: outer_int
+  hsname: Outer_int
+hstypes:
+- hsname: Inner_int
+  representation:
+    newtype:
+      constructor: Inner_int
+      fields:
+      - unwrapInner_int
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer_int
+  representation:
+    newtype:
+      constructor: Outer_int
+      fields:
+      - unwrapOuter_int
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/elaborate.2.raw/th.txt b/test-artefacts/fixtures/macros/parse/elaborate.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/elaborate.2.raw/th.txt
@@ -0,0 +1,139 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/elaborate_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/elaborate.h
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @elaborate_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_A :: Raw String
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @elaborate_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_A = objectLike "INNER_A" ["OUTER_A"]
+{-| __C declaration:__ @macro INNER_B@
+
+    __defined at:__ @elaborate_inner.h 2:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_B :: Raw String
+{-| __C declaration:__ @macro INNER_B@
+
+    __defined at:__ @elaborate_inner.h 2:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_B = objectLike "INNER_B" ["2"]
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/elaborate.h 7:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_A :: Raw String
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/elaborate.h 7:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_A = objectLike "OUTER_A" ["1"]
+{-| __C declaration:__ @outer_int@
+
+    __defined at:__ @macros\/parse\/elaborate.h 8:13@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Outer_int
+    = Outer_int {unwrapOuter_int :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapOuter_int" Outer_int ty
+    where hasField = \x_0 -> (\y_1 -> Outer_int{unwrapOuter_int = y_1},
+                              getField @"unwrapOuter_int" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapOuter_int" (Ptr Outer_int) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapOuter_int")
+instance HasCField Outer_int "unwrapOuter_int"
+    where type CFieldType Outer_int "unwrapOuter_int" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @inner_int@
+
+    __defined at:__ @elaborate_inner.h 3:19@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Inner_int
+    = Inner_int {unwrapInner_int :: Outer_int}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty Outer_int =>
+         HasField "unwrapInner_int" Inner_int ty
+    where hasField = \x_0 -> (\y_1 -> Inner_int{unwrapInner_int = y_1},
+                              getField @"unwrapInner_int" x_0)
+instance (~) ty Outer_int =>
+         HasField "unwrapInner_int" (Ptr Inner_int) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInner_int")
+instance HasCField Inner_int "unwrapInner_int"
+    where type CFieldType Inner_int "unwrapInner_int" = Outer_int
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro OUTER_B@
+
+    __defined at:__ @macros\/parse\/elaborate.h 12:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_B :: Raw String
+{-| __C declaration:__ @macro OUTER_B@
+
+    __defined at:__ @macros\/parse\/elaborate.h 12:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_B = objectLike "OUTER_B" ["INNER_A"]
+{-| __C declaration:__ @macro OUTER_C@
+
+    __defined at:__ @macros\/parse\/elaborate.h 13:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_C :: Raw String
+{-| __C declaration:__ @macro OUTER_C@
+
+    __defined at:__ @macros\/parse\/elaborate.h 13:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_C = objectLike "OUTER_C" ["INNER_B"]
diff --git a/test-artefacts/fixtures/macros/parse/elaborate/Example.hs b/test-artefacts/fixtures/macros/parse/elaborate/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/elaborate/Example.hs
@@ -0,0 +1,174 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.iNNER_B
+    , Example.oUTER_A
+    , Example.iNNER_A
+    , Example.Outer_int(..)
+    , Example.Inner_int(..)
+    , Example.oUTER_B
+    , Example.oUTER_C
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro INNER_B@
+
+    __defined at:__ @elaborate_inner.h 2:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_B :: BG.CInt
+iNNER_B = (2 :: BG.CInt)
+
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/elaborate.h 7:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_A :: BG.CInt
+oUTER_A = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @elaborate_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_A :: BG.CInt
+iNNER_A = oUTER_A
+
+{-| __C declaration:__ @outer_int@
+
+    __defined at:__ @macros\/parse\/elaborate.h 8:13@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Outer_int = Outer_int
+  { unwrapOuter_int :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapOuter_int" Outer_int ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Outer_int {unwrapOuter_int = y1}, BG.getField @"unwrapOuter_int" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapOuter_int" (BG.Ptr Outer_int) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapOuter_int")
+
+instance HasCField.HasCField Outer_int "unwrapOuter_int" where
+
+  type CFieldType Outer_int "unwrapOuter_int" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @inner_int@
+
+    __defined at:__ @elaborate_inner.h 3:19@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Inner_int = Inner_int
+  { unwrapInner_int :: Outer_int
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Outer_int
+         ) => BG.CompatHasField.HasField "unwrapInner_int" Inner_int ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Inner_int {unwrapInner_int = y1}, BG.getField @"unwrapInner_int" x0)
+
+instance ( ty ~ Outer_int
+         ) => BG.HasField "unwrapInner_int" (BG.Ptr Inner_int) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInner_int")
+
+instance HasCField.HasCField Inner_int "unwrapInner_int" where
+
+  type CFieldType Inner_int "unwrapInner_int" =
+    Outer_int
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro OUTER_B@
+
+    __defined at:__ @macros\/parse\/elaborate.h 12:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_B :: BG.CInt
+oUTER_B = iNNER_A
+
+{-| __C declaration:__ @macro OUTER_C@
+
+    __defined at:__ @macros\/parse\/elaborate.h 13:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_C :: BG.CInt
+oUTER_C = iNNER_B
diff --git a/test-artefacts/fixtures/macros/parse/elaborate/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/elaborate/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/elaborate/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/elaborate.h
+  cname: inner_int
+  hsname: Inner_int
+- headers: macros/parse/elaborate.h
+  cname: outer_int
+  hsname: Outer_int
+hstypes:
+- hsname: Inner_int
+  representation:
+    newtype:
+      constructor: Inner_int
+      fields:
+      - unwrapInner_int
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer_int
+  representation:
+    newtype:
+      constructor: Outer_int
+      fields:
+      - unwrapOuter_int
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/elaborate/th.txt b/test-artefacts/fixtures/macros/parse/elaborate/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/elaborate/th.txt
@@ -0,0 +1,139 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/elaborate_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/elaborate.h
+{-| __C declaration:__ @macro INNER_B@
+
+    __defined at:__ @elaborate_inner.h 2:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_B :: CInt
+{-| __C declaration:__ @macro INNER_B@
+
+    __defined at:__ @elaborate_inner.h 2:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_B = 2 :: CInt
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/elaborate.h 7:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_A :: CInt
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/elaborate.h 7:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_A = 1 :: CInt
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @elaborate_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_A :: CInt
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @elaborate_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+iNNER_A = oUTER_A
+{-| __C declaration:__ @outer_int@
+
+    __defined at:__ @macros\/parse\/elaborate.h 8:13@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Outer_int
+    = Outer_int {unwrapOuter_int :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapOuter_int" Outer_int ty
+    where hasField = \x_0 -> (\y_1 -> Outer_int{unwrapOuter_int = y_1},
+                              getField @"unwrapOuter_int" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapOuter_int" (Ptr Outer_int) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapOuter_int")
+instance HasCField Outer_int "unwrapOuter_int"
+    where type CFieldType Outer_int "unwrapOuter_int" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @inner_int@
+
+    __defined at:__ @elaborate_inner.h 3:19@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+newtype Inner_int
+    = Inner_int {unwrapInner_int :: Outer_int}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty Outer_int =>
+         HasField "unwrapInner_int" Inner_int ty
+    where hasField = \x_0 -> (\y_1 -> Inner_int{unwrapInner_int = y_1},
+                              getField @"unwrapInner_int" x_0)
+instance (~) ty Outer_int =>
+         HasField "unwrapInner_int" (Ptr Inner_int) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInner_int")
+instance HasCField Inner_int "unwrapInner_int"
+    where type CFieldType Inner_int "unwrapInner_int" = Outer_int
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro OUTER_B@
+
+    __defined at:__ @macros\/parse\/elaborate.h 12:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_B :: CInt
+{-| __C declaration:__ @macro OUTER_B@
+
+    __defined at:__ @macros\/parse\/elaborate.h 12:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_B = iNNER_A
+{-| __C declaration:__ @macro OUTER_C@
+
+    __defined at:__ @macros\/parse\/elaborate.h 13:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_C :: CInt
+{-| __C declaration:__ @macro OUTER_C@
+
+    __defined at:__ @macros\/parse\/elaborate.h 13:9@
+
+    __exported by:__ @macros\/parse\/elaborate.h@
+-}
+oUTER_C = iNNER_B
diff --git a/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.1.empty/th.txt b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/first_parse_then_typecheck.h
diff --git a/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.2.raw/Example.hs b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.2.raw/Example.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.valueB
+    , Example.valueA
+    , Example.typeB
+    , Example.typeA
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro ValueB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 6:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueB :: Macro.Raw String
+valueB = Macro.objectLike "ValueB" ["ValueA"]
+
+{-| __C declaration:__ @macro ValueA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 7:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueA :: Macro.Raw String
+valueA = Macro.objectLike "ValueA" ["1"]
+
+{-| __C declaration:__ @macro TypeB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 9:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+typeB :: Macro.Raw String
+typeB = Macro.objectLike "TypeB" ["TypeA"]
+
+{-| __C declaration:__ @macro TypeA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 10:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+typeA :: Macro.Raw String
+typeA = Macro.objectLike "TypeA" ["int"]
diff --git a/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.2.raw/th.txt b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck.2.raw/th.txt
@@ -0,0 +1,57 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/first_parse_then_typecheck.h
+{-| __C declaration:__ @macro ValueB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 6:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueB :: Raw String
+{-| __C declaration:__ @macro ValueB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 6:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueB = objectLike "ValueB" ["ValueA"]
+{-| __C declaration:__ @macro ValueA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 7:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueA :: Raw String
+{-| __C declaration:__ @macro ValueA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 7:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueA = objectLike "ValueA" ["1"]
+{-| __C declaration:__ @macro TypeB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 9:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+typeB :: Raw String
+{-| __C declaration:__ @macro TypeB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 9:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+typeB = objectLike "TypeB" ["TypeA"]
+{-| __C declaration:__ @macro TypeA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 10:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+typeA :: Raw String
+{-| __C declaration:__ @macro TypeA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 10:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+typeA = objectLike "TypeA" ["int"]
diff --git a/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck/Example.hs b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck/Example.hs
@@ -0,0 +1,142 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.valueA
+    , Example.valueB
+    , Example.TypeA(..)
+    , Example.TypeB(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro ValueA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 7:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueA :: BG.CInt
+valueA = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro ValueB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 6:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueB :: BG.CInt
+valueB = valueA
+
+{-| __C declaration:__ @macro TypeA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 10:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+newtype TypeA = TypeA
+  { unwrapTypeA :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapTypeA" TypeA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TypeA {unwrapTypeA = y1}, BG.getField @"unwrapTypeA" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapTypeA" (BG.Ptr TypeA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypeA")
+
+instance HasCField.HasCField TypeA "unwrapTypeA" where
+
+  type CFieldType TypeA "unwrapTypeA" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro TypeB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 9:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+newtype TypeB = TypeB
+  { unwrapTypeB :: TypeA
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ TypeA) => BG.CompatHasField.HasField "unwrapTypeB" TypeB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TypeB {unwrapTypeB = y1}, BG.getField @"unwrapTypeB" x0)
+
+instance ( ty ~ TypeA
+         ) => BG.HasField "unwrapTypeB" (BG.Ptr TypeB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypeB")
+
+instance HasCField.HasCField TypeB "unwrapTypeB" where
+
+  type CFieldType TypeB "unwrapTypeB" = TypeA
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck/bindingspec.yaml
@@ -0,0 +1,77 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/first_parse_then_typecheck.h
+  cname: macro TypeB
+  hsname: TypeB
+- headers: macros/parse/first_parse_then_typecheck.h
+  cname: macro TypeA
+  hsname: TypeA
+hstypes:
+- hsname: TypeA
+  representation:
+    newtype:
+      constructor: TypeA
+      fields:
+      - unwrapTypeA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TypeB
+  representation:
+    newtype:
+      constructor: TypeB
+      fields:
+      - unwrapTypeB
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck/th.txt b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/first_parse_then_typecheck/th.txt
@@ -0,0 +1,94 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/first_parse_then_typecheck.h
+{-| __C declaration:__ @macro ValueA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 7:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueA :: CInt
+{-| __C declaration:__ @macro ValueA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 7:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueA = 1 :: CInt
+{-| __C declaration:__ @macro ValueB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 6:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueB :: CInt
+{-| __C declaration:__ @macro ValueB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 6:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+valueB = valueA
+{-| __C declaration:__ @macro TypeA@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 10:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+newtype TypeA
+    = TypeA {unwrapTypeA :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapTypeA" TypeA ty
+    where hasField = \x_0 -> (\y_1 -> TypeA{unwrapTypeA = y_1},
+                              getField @"unwrapTypeA" x_0)
+instance (~) ty CInt => HasField "unwrapTypeA" (Ptr TypeA) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypeA")
+instance HasCField TypeA "unwrapTypeA"
+    where type CFieldType TypeA "unwrapTypeA" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro TypeB@
+
+    __defined at:__ @macros\/parse\/first_parse_then_typecheck.h 9:9@
+
+    __exported by:__ @macros\/parse\/first_parse_then_typecheck.h@
+-}
+newtype TypeB
+    = TypeB {unwrapTypeB :: TypeA}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty TypeA => HasField "unwrapTypeB" TypeB ty
+    where hasField = \x_0 -> (\y_1 -> TypeB{unwrapTypeB = y_1},
+                              getField @"unwrapTypeB" x_0)
+instance (~) ty TypeA =>
+         HasField "unwrapTypeB" (Ptr TypeB) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypeB")
+instance HasCField TypeB "unwrapTypeB"
+    where type CFieldType TypeB "unwrapTypeB" = TypeA
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/Example.hs b/test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/Example.hs
@@ -0,0 +1,162 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Ta(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @Ta@
+
+    __defined at:__ @intermittent_include_inner.h 3:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype Ta = Ta
+  { unwrapTa :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapTa" Ta ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Ta {unwrapTa = y1}, BG.getField @"unwrapTa" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapTa" (BG.Ptr Ta) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTa")
+
+instance HasCField.HasCField Ta "unwrapTa" where
+
+  type CFieldType Ta "unwrapTa" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 9:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT1" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T1 {unwrapT1 = y1}, BG.getField @"unwrapT1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT1" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT1")
+
+instance HasCField.HasCField T1 "unwrapT1" where
+
+  type CFieldType T1 "unwrapT1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 17:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/bindingspec.yaml
@@ -0,0 +1,117 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/intermittent_include.h
+  cname: Ta
+  hsname: Ta
+- headers: macros/parse/intermittent_include.h
+  cname: T1
+  hsname: T1
+- headers: macros/parse/intermittent_include.h
+  cname: T2
+  hsname: T2
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ta
+  representation:
+    newtype:
+      constructor: Ta
+      fields:
+      - unwrapTa
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/th.txt b/test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include.1.empty/th.txt
@@ -0,0 +1,98 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include.h
+{-| __C declaration:__ @Ta@
+
+    __defined at:__ @intermittent_include_inner.h 3:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype Ta
+    = Ta {unwrapTa :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapTa" Ta ty
+    where hasField = \x_0 -> (\y_1 -> Ta{unwrapTa = y_1},
+                              getField @"unwrapTa" x_0)
+instance (~) ty CInt => HasField "unwrapTa" (Ptr Ta) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTa")
+instance HasCField Ta "unwrapTa"
+    where type CFieldType Ta "unwrapTa" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 9:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T1
+    = T1 {unwrapT1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT1" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{unwrapT1 = y_1},
+                              getField @"unwrapT1" x_0)
+instance (~) ty CInt => HasField "unwrapT1" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT1")
+instance HasCField T1 "unwrapT1"
+    where type CFieldType T1 "unwrapT1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 17:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CInt => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include.2.raw/Example.hs b/test-artefacts/fixtures/macros/parse/intermittent_include.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include.2.raw/Example.hs
@@ -0,0 +1,213 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.ma
+    , Example.Ta(..)
+    , Example.m1
+    , Example.T1(..)
+    , Example.m2
+    , Example.m3
+    , Example.T2(..)
+    , Example.m4
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, String, type (~))
+
+{-| __C declaration:__ @macro Ma@
+
+    __defined at:__ @intermittent_include_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+ma :: Macro.Raw String
+ma = Macro.objectLike "Ma" ["Ta"]
+
+{-| __C declaration:__ @Ta@
+
+    __defined at:__ @intermittent_include_inner.h 3:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype Ta = Ta
+  { unwrapTa :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapTa" Ta ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Ta {unwrapTa = y1}, BG.getField @"unwrapTa" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapTa" (BG.Ptr Ta) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTa")
+
+instance HasCField.HasCField Ta "unwrapTa" where
+
+  type CFieldType Ta "unwrapTa" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 7:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m1 :: Macro.Raw String
+m1 = Macro.objectLike "M1" ["T1"]
+
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 9:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT1" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T1 {unwrapT1 = y1}, BG.getField @"unwrapT1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT1" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT1")
+
+instance HasCField.HasCField T1 "unwrapT1" where
+
+  type CFieldType T1 "unwrapT1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 11:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m2 :: Macro.Raw String
+m2 = Macro.objectLike "M2" ["T1"]
+
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 15:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m3 :: Macro.Raw String
+m3 = Macro.objectLike "M3" ["T2"]
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 17:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M4@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 19:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m4 :: Macro.Raw String
+m4 = Macro.objectLike "M4" ["T2"]
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/intermittent_include.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include.2.raw/bindingspec.yaml
@@ -0,0 +1,117 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/intermittent_include.h
+  cname: Ta
+  hsname: Ta
+- headers: macros/parse/intermittent_include.h
+  cname: T1
+  hsname: T1
+- headers: macros/parse/intermittent_include.h
+  cname: T2
+  hsname: T2
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ta
+  representation:
+    newtype:
+      constructor: Ta
+      fields:
+      - unwrapTa
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include.2.raw/th.txt b/test-artefacts/fixtures/macros/parse/intermittent_include.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include.2.raw/th.txt
@@ -0,0 +1,168 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include.h
+{-| __C declaration:__ @macro Ma@
+
+    __defined at:__ @intermittent_include_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+ma :: Raw String
+{-| __C declaration:__ @macro Ma@
+
+    __defined at:__ @intermittent_include_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+ma = objectLike "Ma" ["Ta"]
+{-| __C declaration:__ @Ta@
+
+    __defined at:__ @intermittent_include_inner.h 3:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype Ta
+    = Ta {unwrapTa :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapTa" Ta ty
+    where hasField = \x_0 -> (\y_1 -> Ta{unwrapTa = y_1},
+                              getField @"unwrapTa" x_0)
+instance (~) ty CInt => HasField "unwrapTa" (Ptr Ta) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTa")
+instance HasCField Ta "unwrapTa"
+    where type CFieldType Ta "unwrapTa" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 7:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m1 :: Raw String
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 7:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m1 = objectLike "M1" ["T1"]
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 9:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T1
+    = T1 {unwrapT1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT1" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{unwrapT1 = y_1},
+                              getField @"unwrapT1" x_0)
+instance (~) ty CInt => HasField "unwrapT1" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT1")
+instance HasCField T1 "unwrapT1"
+    where type CFieldType T1 "unwrapT1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 11:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m2 :: Raw String
+{-| __C declaration:__ @macro M2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 11:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m2 = objectLike "M2" ["T1"]
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 15:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m3 :: Raw String
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 15:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m3 = objectLike "M3" ["T2"]
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 17:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CInt => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M4@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 19:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m4 :: Raw String
+{-| __C declaration:__ @macro M4@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 19:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+m4 = objectLike "M4" ["T2"]
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include/Example.hs b/test-artefacts/fixtures/macros/parse/intermittent_include/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include/Example.hs
@@ -0,0 +1,392 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Ta(..)
+    , Example.Ma(..)
+    , Example.T1(..)
+    , Example.M1(..)
+    , Example.M2(..)
+    , Example.T2(..)
+    , Example.M3(..)
+    , Example.M4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @Ta@
+
+    __defined at:__ @intermittent_include_inner.h 3:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype Ta = Ta
+  { unwrapTa :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapTa" Ta ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Ta {unwrapTa = y1}, BG.getField @"unwrapTa" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapTa" (BG.Ptr Ta) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTa")
+
+instance HasCField.HasCField Ta "unwrapTa" where
+
+  type CFieldType Ta "unwrapTa" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro Ma@
+
+    __defined at:__ @intermittent_include_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype Ma = Ma
+  { unwrapMa :: Ta
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ Ta) => BG.CompatHasField.HasField "unwrapMa" Ma ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Ma {unwrapMa = y1}, BG.getField @"unwrapMa" x0)
+
+instance (ty ~ Ta) => BG.HasField "unwrapMa" (BG.Ptr Ma) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapMa")
+
+instance HasCField.HasCField Ma "unwrapMa" where
+
+  type CFieldType Ma "unwrapMa" = Ta
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 9:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT1" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T1 {unwrapT1 = y1}, BG.getField @"unwrapT1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT1" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT1")
+
+instance HasCField.HasCField T1 "unwrapT1" where
+
+  type CFieldType T1 "unwrapT1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 7:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype M1 = M1
+  { unwrapM1 :: T1
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T1) => BG.CompatHasField.HasField "unwrapM1" M1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M1 {unwrapM1 = y1}, BG.getField @"unwrapM1" x0)
+
+instance (ty ~ T1) => BG.HasField "unwrapM1" (BG.Ptr M1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM1")
+
+instance HasCField.HasCField M1 "unwrapM1" where
+
+  type CFieldType M1 "unwrapM1" = T1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 11:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype M2 = M2
+  { unwrapM2 :: T1
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T1) => BG.CompatHasField.HasField "unwrapM2" M2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M2 {unwrapM2 = y1}, BG.getField @"unwrapM2" x0)
+
+instance (ty ~ T1) => BG.HasField "unwrapM2" (BG.Ptr M2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM2")
+
+instance HasCField.HasCField M2 "unwrapM2" where
+
+  type CFieldType M2 "unwrapM2" = T1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 17:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 15:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype M3 = M3
+  { unwrapM3 :: T2
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T2) => BG.CompatHasField.HasField "unwrapM3" M3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M3 {unwrapM3 = y1}, BG.getField @"unwrapM3" x0)
+
+instance (ty ~ T2) => BG.HasField "unwrapM3" (BG.Ptr M3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM3")
+
+instance HasCField.HasCField M3 "unwrapM3" where
+
+  type CFieldType M3 "unwrapM3" = T2
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M4@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 19:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype M4 = M4
+  { unwrapM4 :: T2
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T2) => BG.CompatHasField.HasField "unwrapM4" M4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M4 {unwrapM4 = y1}, BG.getField @"unwrapM4" x0)
+
+instance (ty ~ T2) => BG.HasField "unwrapM4" (BG.Ptr M4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM4")
+
+instance HasCField.HasCField M4 "unwrapM4" where
+
+  type CFieldType M4 "unwrapM4" = T2
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/intermittent_include/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include/bindingspec.yaml
@@ -0,0 +1,287 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/intermittent_include.h
+  cname: macro Ma
+  hsname: Ma
+- headers: macros/parse/intermittent_include.h
+  cname: Ta
+  hsname: Ta
+- headers: macros/parse/intermittent_include.h
+  cname: macro M1
+  hsname: M1
+- headers: macros/parse/intermittent_include.h
+  cname: T1
+  hsname: T1
+- headers: macros/parse/intermittent_include.h
+  cname: macro M2
+  hsname: M2
+- headers: macros/parse/intermittent_include.h
+  cname: macro M3
+  hsname: M3
+- headers: macros/parse/intermittent_include.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/intermittent_include.h
+  cname: macro M4
+  hsname: M4
+hstypes:
+- hsname: M1
+  representation:
+    newtype:
+      constructor: M1
+      fields:
+      - unwrapM1
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: M2
+  representation:
+    newtype:
+      constructor: M2
+      fields:
+      - unwrapM2
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: M3
+  representation:
+    newtype:
+      constructor: M3
+      fields:
+      - unwrapM3
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: M4
+  representation:
+    newtype:
+      constructor: M4
+      fields:
+      - unwrapM4
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ma
+  representation:
+    newtype:
+      constructor: Ma
+      fields:
+      - unwrapMa
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ta
+  representation:
+    newtype:
+      constructor: Ta
+      fields:
+      - unwrapTa
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include/th.txt b/test-artefacts/fixtures/macros/parse/intermittent_include/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include/th.txt
@@ -0,0 +1,258 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include.h
+{-| __C declaration:__ @Ta@
+
+    __defined at:__ @intermittent_include_inner.h 3:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype Ta
+    = Ta {unwrapTa :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapTa" Ta ty
+    where hasField = \x_0 -> (\y_1 -> Ta{unwrapTa = y_1},
+                              getField @"unwrapTa" x_0)
+instance (~) ty CInt => HasField "unwrapTa" (Ptr Ta) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTa")
+instance HasCField Ta "unwrapTa"
+    where type CFieldType Ta "unwrapTa" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro Ma@
+
+    __defined at:__ @intermittent_include_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype Ma
+    = Ma {unwrapMa :: Ta}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty Ta => HasField "unwrapMa" Ma ty
+    where hasField = \x_0 -> (\y_1 -> Ma{unwrapMa = y_1},
+                              getField @"unwrapMa" x_0)
+instance (~) ty Ta => HasField "unwrapMa" (Ptr Ma) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMa")
+instance HasCField Ma "unwrapMa"
+    where type CFieldType Ma "unwrapMa" = Ta
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 9:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T1
+    = T1 {unwrapT1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT1" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{unwrapT1 = y_1},
+                              getField @"unwrapT1" x_0)
+instance (~) ty CInt => HasField "unwrapT1" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT1")
+instance HasCField T1 "unwrapT1"
+    where type CFieldType T1 "unwrapT1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 7:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype M1
+    = M1 {unwrapM1 :: T1}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T1 => HasField "unwrapM1" M1 ty
+    where hasField = \x_0 -> (\y_1 -> M1{unwrapM1 = y_1},
+                              getField @"unwrapM1" x_0)
+instance (~) ty T1 => HasField "unwrapM1" (Ptr M1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM1")
+instance HasCField M1 "unwrapM1"
+    where type CFieldType M1 "unwrapM1" = T1
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 11:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype M2
+    = M2 {unwrapM2 :: T1}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T1 => HasField "unwrapM2" M2 ty
+    where hasField = \x_0 -> (\y_1 -> M2{unwrapM2 = y_1},
+                              getField @"unwrapM2" x_0)
+instance (~) ty T1 => HasField "unwrapM2" (Ptr M2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM2")
+instance HasCField M2 "unwrapM2"
+    where type CFieldType M2 "unwrapM2" = T1
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 17:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CInt => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 15:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype M3
+    = M3 {unwrapM3 :: T2}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T2 => HasField "unwrapM3" M3 ty
+    where hasField = \x_0 -> (\y_1 -> M3{unwrapM3 = y_1},
+                              getField @"unwrapM3" x_0)
+instance (~) ty T2 => HasField "unwrapM3" (Ptr M3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM3")
+instance HasCField M3 "unwrapM3"
+    where type CFieldType M3 "unwrapM3" = T2
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M4@
+
+    __defined at:__ @macros\/parse\/intermittent_include.h 19:9@
+
+    __exported by:__ @macros\/parse\/intermittent_include.h@
+-}
+newtype M4
+    = M4 {unwrapM4 :: T2}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T2 => HasField "unwrapM4" M4 ty
+    where hasField = \x_0 -> (\y_1 -> M4{unwrapM4 = y_1},
+                              getField @"unwrapM4" x_0)
+instance (~) ty T2 => HasField "unwrapM4" (Ptr M4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM4")
+instance HasCField M4 "unwrapM4"
+    where type CFieldType M4 "unwrapM4" = T2
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.1.empty/Example.hs b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.1.empty/Example.hs
@@ -0,0 +1,252 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T2(..)
+    , Example.T4(..)
+    , Example.T1(..)
+    , Example.T3(..)
+    , Example.T5(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Floating, Fractional, Integral, Num, Ord, Read, Real, RealFloat, RealFrac, Show, type (~))
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 2:15@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CFloat
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 6:16@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T4 = T4
+  { unwrapT4 :: BG.CDouble
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CDouble) => BG.CompatHasField.HasField "unwrapT4" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T4 {unwrapT4 = y1}, BG.getField @"unwrapT4" x0)
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "unwrapT4" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT4")
+
+instance HasCField.HasCField T4 "unwrapT4" where
+
+  type CFieldType T4 "unwrapT4" = BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 1:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT1" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T1 {unwrapT1 = y1}, BG.getField @"unwrapT1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT1" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT1")
+
+instance HasCField.HasCField T1 "unwrapT1" where
+
+  type CFieldType T1 "unwrapT1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 6:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT3" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3 {unwrapT3 = y1}, BG.getField @"unwrapT3" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT3" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT3")
+
+instance HasCField.HasCField T3 "unwrapT3" where
+
+  type CFieldType T3 "unwrapT3" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T5@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 11:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T5 = T5
+  { unwrapT5 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT5" T5 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T5 {unwrapT5 = y1}, BG.getField @"unwrapT5" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT5" (BG.Ptr T5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT5")
+
+instance HasCField.HasCField T5 "unwrapT5" where
+
+  type CFieldType T5 "unwrapT5" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.1.empty/bindingspec.yaml
@@ -0,0 +1,187 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T4
+  hsname: T4
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T1
+  hsname: T1
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T3
+  hsname: T3
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T5
+  hsname: T5
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CFloat
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    newtype:
+      constructor: T4
+      fields:
+      - unwrapT4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CDouble
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T5
+  representation:
+    newtype:
+      constructor: T5
+      fields:
+      - unwrapT5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.1.empty/th.txt b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.1.empty/th.txt
@@ -0,0 +1,158 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include_conditional_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include_conditional.h
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 2:15@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CFloat}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CFloat => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CFloat => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 6:16@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T4
+    = T4 {unwrapT4 :: CDouble}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CDouble => HasField "unwrapT4" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{unwrapT4 = y_1},
+                              getField @"unwrapT4" x_0)
+instance (~) ty CDouble => HasField "unwrapT4" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT4")
+instance HasCField T4 "unwrapT4"
+    where type CFieldType T4 "unwrapT4" = CDouble
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 1:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T1
+    = T1 {unwrapT1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT1" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{unwrapT1 = y_1},
+                              getField @"unwrapT1" x_0)
+instance (~) ty CInt => HasField "unwrapT1" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT1")
+instance HasCField T1 "unwrapT1"
+    where type CFieldType T1 "unwrapT1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 6:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T3
+    = T3 {unwrapT3 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT3" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{unwrapT3 = y_1},
+                              getField @"unwrapT3" x_0)
+instance (~) ty CInt => HasField "unwrapT3" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT3")
+instance HasCField T3 "unwrapT3"
+    where type CFieldType T3 "unwrapT3" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T5@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 11:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T5
+    = T5 {unwrapT5 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT5" T5 ty
+    where hasField = \x_0 -> (\y_1 -> T5{unwrapT5 = y_1},
+                              getField @"unwrapT5" x_0)
+instance (~) ty CInt => HasField "unwrapT5" (Ptr T5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT5")
+instance HasCField T5 "unwrapT5"
+    where type CFieldType T5 "unwrapT5" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.2.raw/Example.hs b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.2.raw/Example.hs
@@ -0,0 +1,252 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T2(..)
+    , Example.T4(..)
+    , Example.T1(..)
+    , Example.T3(..)
+    , Example.T5(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Floating, Fractional, Integral, Num, Ord, Read, Real, RealFloat, RealFrac, Show, type (~))
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 2:15@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CFloat
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 6:16@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T4 = T4
+  { unwrapT4 :: BG.CDouble
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CDouble) => BG.CompatHasField.HasField "unwrapT4" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T4 {unwrapT4 = y1}, BG.getField @"unwrapT4" x0)
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "unwrapT4" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT4")
+
+instance HasCField.HasCField T4 "unwrapT4" where
+
+  type CFieldType T4 "unwrapT4" = BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 1:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT1" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T1 {unwrapT1 = y1}, BG.getField @"unwrapT1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT1" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT1")
+
+instance HasCField.HasCField T1 "unwrapT1" where
+
+  type CFieldType T1 "unwrapT1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 6:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT3" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3 {unwrapT3 = y1}, BG.getField @"unwrapT3" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT3" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT3")
+
+instance HasCField.HasCField T3 "unwrapT3" where
+
+  type CFieldType T3 "unwrapT3" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T5@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 11:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T5 = T5
+  { unwrapT5 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT5" T5 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T5 {unwrapT5 = y1}, BG.getField @"unwrapT5" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT5" (BG.Ptr T5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT5")
+
+instance HasCField.HasCField T5 "unwrapT5" where
+
+  type CFieldType T5 "unwrapT5" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.2.raw/bindingspec.yaml
@@ -0,0 +1,187 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T4
+  hsname: T4
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T1
+  hsname: T1
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T3
+  hsname: T3
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T5
+  hsname: T5
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CFloat
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    newtype:
+      constructor: T4
+      fields:
+      - unwrapT4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CDouble
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T5
+  representation:
+    newtype:
+      constructor: T5
+      fields:
+      - unwrapT5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.2.raw/th.txt b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional.2.raw/th.txt
@@ -0,0 +1,158 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include_conditional_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include_conditional.h
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 2:15@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CFloat}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CFloat => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CFloat => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 6:16@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T4
+    = T4 {unwrapT4 :: CDouble}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CDouble => HasField "unwrapT4" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{unwrapT4 = y_1},
+                              getField @"unwrapT4" x_0)
+instance (~) ty CDouble => HasField "unwrapT4" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT4")
+instance HasCField T4 "unwrapT4"
+    where type CFieldType T4 "unwrapT4" = CDouble
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 1:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T1
+    = T1 {unwrapT1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT1" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{unwrapT1 = y_1},
+                              getField @"unwrapT1" x_0)
+instance (~) ty CInt => HasField "unwrapT1" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT1")
+instance HasCField T1 "unwrapT1"
+    where type CFieldType T1 "unwrapT1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 6:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T3
+    = T3 {unwrapT3 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT3" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{unwrapT3 = y_1},
+                              getField @"unwrapT3" x_0)
+instance (~) ty CInt => HasField "unwrapT3" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT3")
+instance HasCField T3 "unwrapT3"
+    where type CFieldType T3 "unwrapT3" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T5@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 11:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T5
+    = T5 {unwrapT5 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT5" T5 ty
+    where hasField = \x_0 -> (\y_1 -> T5{unwrapT5 = y_1},
+                              getField @"unwrapT5" x_0)
+instance (~) ty CInt => HasField "unwrapT5" (Ptr T5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT5")
+instance HasCField T5 "unwrapT5"
+    where type CFieldType T5 "unwrapT5" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include_conditional/Example.hs b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional/Example.hs
@@ -0,0 +1,252 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T2(..)
+    , Example.T4(..)
+    , Example.T1(..)
+    , Example.T3(..)
+    , Example.T5(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Floating, Fractional, Integral, Num, Ord, Read, Real, RealFloat, RealFrac, Show, type (~))
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 2:15@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CFloat
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 6:16@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T4 = T4
+  { unwrapT4 :: BG.CDouble
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CDouble) => BG.CompatHasField.HasField "unwrapT4" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T4 {unwrapT4 = y1}, BG.getField @"unwrapT4" x0)
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "unwrapT4" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT4")
+
+instance HasCField.HasCField T4 "unwrapT4" where
+
+  type CFieldType T4 "unwrapT4" = BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 1:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT1" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T1 {unwrapT1 = y1}, BG.getField @"unwrapT1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT1" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT1")
+
+instance HasCField.HasCField T1 "unwrapT1" where
+
+  type CFieldType T1 "unwrapT1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 6:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT3" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3 {unwrapT3 = y1}, BG.getField @"unwrapT3" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT3" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT3")
+
+instance HasCField.HasCField T3 "unwrapT3" where
+
+  type CFieldType T3 "unwrapT3" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T5@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 11:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T5 = T5
+  { unwrapT5 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT5" T5 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T5 {unwrapT5 = y1}, BG.getField @"unwrapT5" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT5" (BG.Ptr T5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT5")
+
+instance HasCField.HasCField T5 "unwrapT5" where
+
+  type CFieldType T5 "unwrapT5" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include_conditional/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional/bindingspec.yaml
@@ -0,0 +1,187 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T4
+  hsname: T4
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T1
+  hsname: T1
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T3
+  hsname: T3
+- headers: macros/parse/intermittent_include_conditional.h
+  cname: T5
+  hsname: T5
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CFloat
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    newtype:
+      constructor: T4
+      fields:
+      - unwrapT4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CDouble
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T5
+  representation:
+    newtype:
+      constructor: T5
+      fields:
+      - unwrapT5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/intermittent_include_conditional/th.txt b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/intermittent_include_conditional/th.txt
@@ -0,0 +1,158 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include_conditional_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/intermittent_include_conditional.h
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 2:15@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CFloat}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CFloat => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CFloat => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @intermittent_include_conditional_inner.h 6:16@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T4
+    = T4 {unwrapT4 :: CDouble}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CDouble => HasField "unwrapT4" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{unwrapT4 = y_1},
+                              getField @"unwrapT4" x_0)
+instance (~) ty CDouble => HasField "unwrapT4" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT4")
+instance HasCField T4 "unwrapT4"
+    where type CFieldType T4 "unwrapT4" = CDouble
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 1:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T1
+    = T1 {unwrapT1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT1" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{unwrapT1 = y_1},
+                              getField @"unwrapT1" x_0)
+instance (~) ty CInt => HasField "unwrapT1" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT1")
+instance HasCField T1 "unwrapT1"
+    where type CFieldType T1 "unwrapT1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 6:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T3
+    = T3 {unwrapT3 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT3" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{unwrapT3 = y_1},
+                              getField @"unwrapT3" x_0)
+instance (~) ty CInt => HasField "unwrapT3" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT3")
+instance HasCField T3 "unwrapT3"
+    where type CFieldType T3 "unwrapT3" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T5@
+
+    __defined at:__ @macros\/parse\/intermittent_include_conditional.h 11:13@
+
+    __exported by:__ @macros\/parse\/intermittent_include_conditional.h@
+-}
+newtype T5
+    = T5 {unwrapT5 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT5" T5 ty
+    where hasField = \x_0 -> (\y_1 -> T5{unwrapT5 = y_1},
+                              getField @"unwrapT5" x_0)
+instance (~) ty CInt => HasField "unwrapT5" (Ptr T5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT5")
+instance HasCField T5 "unwrapT5"
+    where type CFieldType T5 "unwrapT5" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope.1.empty/Example.hs b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.1.empty/Example.hs
@@ -0,0 +1,116 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T2(..)
+    , Example.T4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 5:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 7:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T4 = T4
+  { unwrapT4 :: T2
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T2) => BG.CompatHasField.HasField "unwrapT4" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T4 {unwrapT4 = y1}, BG.getField @"unwrapT4" x0)
+
+instance (ty ~ T2) => BG.HasField "unwrapT4" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT4")
+
+instance HasCField.HasCField T4 "unwrapT4" where
+
+  type CFieldType T4 "unwrapT4" = T2
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.1.empty/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/macro_typedef_scope.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/macro_typedef_scope.h
+  cname: T4
+  hsname: T4
+hstypes:
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    newtype:
+      constructor: T4
+      fields:
+      - unwrapT4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope.1.empty/th.txt b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.1.empty/th.txt
@@ -0,0 +1,65 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope.h
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 5:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CInt => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 7:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T4
+    = T4 {unwrapT4 :: T2}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T2 => HasField "unwrapT4" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{unwrapT4 = y_1},
+                              getField @"unwrapT4" x_0)
+instance (~) ty T2 => HasField "unwrapT4" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT4")
+instance HasCField T4 "unwrapT4"
+    where type CFieldType T4 "unwrapT4" = T2
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope.2.raw/Example.hs b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.2.raw/Example.hs
@@ -0,0 +1,137 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.m1
+    , Example.T2(..)
+    , Example.m3
+    , Example.T4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, String, type (~))
+
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 4:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+m1 :: Macro.Raw String
+m1 = Macro.objectLike "M1" ["int"]
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 5:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 6:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+m3 :: Macro.Raw String
+m3 = Macro.objectLike "M3" ["T2"]
+
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 7:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T4 = T4
+  { unwrapT4 :: T2
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T2) => BG.CompatHasField.HasField "unwrapT4" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T4 {unwrapT4 = y1}, BG.getField @"unwrapT4" x0)
+
+instance (ty ~ T2) => BG.HasField "unwrapT4" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT4")
+
+instance HasCField.HasCField T4 "unwrapT4" where
+
+  type CFieldType T4 "unwrapT4" = T2
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.2.raw/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/macro_typedef_scope.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/macro_typedef_scope.h
+  cname: T4
+  hsname: T4
+hstypes:
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    newtype:
+      constructor: T4
+      fields:
+      - unwrapT4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope.2.raw/th.txt b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope.2.raw/th.txt
@@ -0,0 +1,93 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope.h
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 4:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+m1 :: Raw String
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 4:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+m1 = objectLike "M1" ["int"]
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 5:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CInt => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 6:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+m3 :: Raw String
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 6:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+m3 = objectLike "M3" ["T2"]
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 7:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T4
+    = T4 {unwrapT4 :: T2}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T2 => HasField "unwrapT4" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{unwrapT4 = y_1},
+                              getField @"unwrapT4" x_0)
+instance (~) ty T2 => HasField "unwrapT4" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT4")
+instance HasCField T4 "unwrapT4"
+    where type CFieldType T4 "unwrapT4" = T2
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope/Example.hs b/test-artefacts/fixtures/macros/parse/macro_typedef_scope/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope/Example.hs
@@ -0,0 +1,208 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.M1(..)
+    , Example.T2(..)
+    , Example.M3(..)
+    , Example.T4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 4:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype M1 = M1
+  { unwrapM1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapM1" M1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M1 {unwrapM1 = y1}, BG.getField @"unwrapM1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapM1" (BG.Ptr M1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM1")
+
+instance HasCField.HasCField M1 "unwrapM1" where
+
+  type CFieldType M1 "unwrapM1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 5:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: M1
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ M1) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ M1) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = M1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 6:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype M3 = M3
+  { unwrapM3 :: T2
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T2) => BG.CompatHasField.HasField "unwrapM3" M3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M3 {unwrapM3 = y1}, BG.getField @"unwrapM3" x0)
+
+instance (ty ~ T2) => BG.HasField "unwrapM3" (BG.Ptr M3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM3")
+
+instance HasCField.HasCField M3 "unwrapM3" where
+
+  type CFieldType M3 "unwrapM3" = T2
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 7:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T4 = T4
+  { unwrapT4 :: M3
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ M3) => BG.CompatHasField.HasField "unwrapT4" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T4 {unwrapT4 = y1}, BG.getField @"unwrapT4" x0)
+
+instance (ty ~ M3) => BG.HasField "unwrapT4" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT4")
+
+instance HasCField.HasCField T4 "unwrapT4" where
+
+  type CFieldType T4 "unwrapT4" = M3
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/macro_typedef_scope/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope/bindingspec.yaml
@@ -0,0 +1,151 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/macro_typedef_scope.h
+  cname: macro M1
+  hsname: M1
+- headers: macros/parse/macro_typedef_scope.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/macro_typedef_scope.h
+  cname: macro M3
+  hsname: M3
+- headers: macros/parse/macro_typedef_scope.h
+  cname: T4
+  hsname: T4
+hstypes:
+- hsname: M1
+  representation:
+    newtype:
+      constructor: M1
+      fields:
+      - unwrapM1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: M3
+  representation:
+    newtype:
+      constructor: M3
+      fields:
+      - unwrapM3
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    newtype:
+      constructor: T4
+      fields:
+      - unwrapT4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope/th.txt b/test-artefacts/fixtures/macros/parse/macro_typedef_scope/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope/th.txt
@@ -0,0 +1,129 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope.h
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 4:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype M1
+    = M1 {unwrapM1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapM1" M1 ty
+    where hasField = \x_0 -> (\y_1 -> M1{unwrapM1 = y_1},
+                              getField @"unwrapM1" x_0)
+instance (~) ty CInt => HasField "unwrapM1" (Ptr M1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM1")
+instance HasCField M1 "unwrapM1"
+    where type CFieldType M1 "unwrapM1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 5:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: M1}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty M1 => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty M1 => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = M1
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 6:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype M3
+    = M3 {unwrapM3 :: T2}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T2 => HasField "unwrapM3" M3 ty
+    where hasField = \x_0 -> (\y_1 -> M3{unwrapM3 = y_1},
+                              getField @"unwrapM3" x_0)
+instance (~) ty T2 => HasField "unwrapM3" (Ptr M3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM3")
+instance HasCField M3 "unwrapM3"
+    where type CFieldType M3 "unwrapM3" = T2
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macros\/parse\/macro_typedef_scope.h 7:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope.h@
+-}
+newtype T4
+    = T4 {unwrapT4 :: M3}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty M3 => HasField "unwrapT4" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{unwrapT4 = y_1},
+                              getField @"unwrapT4" x_0)
+instance (~) ty M3 => HasField "unwrapT4" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT4")
+instance HasCField T4 "unwrapT4"
+    where type CFieldType T4 "unwrapT4" = M3
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.1.empty/Example.hs b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.1.empty/Example.hs
@@ -0,0 +1,116 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T2(..)
+    , Example.T4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T4 = T4
+  { unwrapT4 :: T2
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T2) => BG.CompatHasField.HasField "unwrapT4" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T4 {unwrapT4 = y1}, BG.getField @"unwrapT4" x0)
+
+instance (ty ~ T2) => BG.HasField "unwrapT4" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT4")
+
+instance HasCField.HasCField T4 "unwrapT4" where
+
+  type CFieldType T4 "unwrapT4" = T2
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.1.empty/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/macro_typedef_scope_multiple.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/macro_typedef_scope_multiple.h
+  cname: T4
+  hsname: T4
+hstypes:
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    newtype:
+      constructor: T4
+      fields:
+      - unwrapT4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.1.empty/th.txt b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.1.empty/th.txt
@@ -0,0 +1,67 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner1.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner2.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple.h
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CInt => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T4
+    = T4 {unwrapT4 :: T2}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T2 => HasField "unwrapT4" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{unwrapT4 = y_1},
+                              getField @"unwrapT4" x_0)
+instance (~) ty T2 => HasField "unwrapT4" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT4")
+instance HasCField T4 "unwrapT4"
+    where type CFieldType T4 "unwrapT4" = T2
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.2.raw/Example.hs b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.2.raw/Example.hs
@@ -0,0 +1,137 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.m1
+    , Example.T2(..)
+    , Example.m3
+    , Example.T4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, String, type (~))
+
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+m1 :: Macro.Raw String
+m1 = Macro.objectLike "M1" ["int"]
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+m3 :: Macro.Raw String
+m3 = Macro.objectLike "M3" ["T2"]
+
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T4 = T4
+  { unwrapT4 :: T2
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T2) => BG.CompatHasField.HasField "unwrapT4" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T4 {unwrapT4 = y1}, BG.getField @"unwrapT4" x0)
+
+instance (ty ~ T2) => BG.HasField "unwrapT4" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT4")
+
+instance HasCField.HasCField T4 "unwrapT4" where
+
+  type CFieldType T4 "unwrapT4" = T2
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.2.raw/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/macro_typedef_scope_multiple.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/macro_typedef_scope_multiple.h
+  cname: T4
+  hsname: T4
+hstypes:
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    newtype:
+      constructor: T4
+      fields:
+      - unwrapT4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.2.raw/th.txt b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple.2.raw/th.txt
@@ -0,0 +1,95 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner1.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner2.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple.h
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+m1 :: Raw String
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+m1 = objectLike "M1" ["int"]
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CInt => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+m3 :: Raw String
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+m3 = objectLike "M3" ["T2"]
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T4
+    = T4 {unwrapT4 :: T2}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T2 => HasField "unwrapT4" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{unwrapT4 = y_1},
+                              getField @"unwrapT4" x_0)
+instance (~) ty T2 => HasField "unwrapT4" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT4")
+instance HasCField T4 "unwrapT4"
+    where type CFieldType T4 "unwrapT4" = T2
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple/Example.hs b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple/Example.hs
@@ -0,0 +1,208 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.M1(..)
+    , Example.T2(..)
+    , Example.M3(..)
+    , Example.T4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype M1 = M1
+  { unwrapM1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapM1" M1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M1 {unwrapM1 = y1}, BG.getField @"unwrapM1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapM1" (BG.Ptr M1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM1")
+
+instance HasCField.HasCField M1 "unwrapM1" where
+
+  type CFieldType M1 "unwrapM1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: M1
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ M1) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ M1) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = M1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype M3 = M3
+  { unwrapM3 :: T2
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T2) => BG.CompatHasField.HasField "unwrapM3" M3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M3 {unwrapM3 = y1}, BG.getField @"unwrapM3" x0)
+
+instance (ty ~ T2) => BG.HasField "unwrapM3" (BG.Ptr M3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM3")
+
+instance HasCField.HasCField M3 "unwrapM3" where
+
+  type CFieldType M3 "unwrapM3" = T2
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T4 = T4
+  { unwrapT4 :: M3
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ M3) => BG.CompatHasField.HasField "unwrapT4" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T4 {unwrapT4 = y1}, BG.getField @"unwrapT4" x0)
+
+instance (ty ~ M3) => BG.HasField "unwrapT4" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT4")
+
+instance HasCField.HasCField T4 "unwrapT4" where
+
+  type CFieldType T4 "unwrapT4" = M3
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple/bindingspec.yaml
@@ -0,0 +1,151 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/parse/macro_typedef_scope_multiple.h
+  cname: macro M1
+  hsname: M1
+- headers: macros/parse/macro_typedef_scope_multiple.h
+  cname: T2
+  hsname: T2
+- headers: macros/parse/macro_typedef_scope_multiple.h
+  cname: macro M3
+  hsname: M3
+- headers: macros/parse/macro_typedef_scope_multiple.h
+  cname: T4
+  hsname: T4
+hstypes:
+- hsname: M1
+  representation:
+    newtype:
+      constructor: M1
+      fields:
+      - unwrapM1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: M3
+  representation:
+    newtype:
+      constructor: M3
+      fields:
+      - unwrapM3
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    newtype:
+      constructor: T4
+      fields:
+      - unwrapT4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple/th.txt b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/macro_typedef_scope_multiple/th.txt
@@ -0,0 +1,131 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner1.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner2.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple.h
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype M1
+    = M1 {unwrapM1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapM1" M1 ty
+    where hasField = \x_0 -> (\y_1 -> M1{unwrapM1 = y_1},
+                              getField @"unwrapM1" x_0)
+instance (~) ty CInt => HasField "unwrapM1" (Ptr M1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM1")
+instance HasCField M1 "unwrapM1"
+    where type CFieldType M1 "unwrapM1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner1.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: M1}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty M1 => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty M1 => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = M1
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 1:9@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype M3
+    = M3 {unwrapM3 :: T2}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty T2 => HasField "unwrapM3" M3 ty
+    where hasField = \x_0 -> (\y_1 -> M3{unwrapM3 = y_1},
+                              getField @"unwrapM3" x_0)
+instance (~) ty T2 => HasField "unwrapM3" (Ptr M3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM3")
+instance HasCField M3 "unwrapM3"
+    where type CFieldType M3 "unwrapM3" = T2
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T4@
+
+    __defined at:__ @macro_typedef_scope_multiple_inner2.h 2:12@
+
+    __exported by:__ @macros\/parse\/macro_typedef_scope_multiple.h@
+-}
+newtype T4
+    = T4 {unwrapT4 :: M3}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty M3 => HasField "unwrapT4" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{unwrapT4 = y_1},
+                              getField @"unwrapT4" x_0)
+instance (~) ty M3 => HasField "unwrapT4" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT4")
+instance HasCField T4 "unwrapT4"
+    where type CFieldType T4 "unwrapT4" = M3
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/parse/simple.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/simple.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/simple.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/parse/simple.1.empty/th.txt b/test-artefacts/fixtures/macros/parse/simple.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/simple.1.empty/th.txt
@@ -0,0 +1,2 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/simple_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/simple.h
diff --git a/test-artefacts/fixtures/macros/parse/simple.2.raw/Example.hs b/test-artefacts/fixtures/macros/parse/simple.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/simple.2.raw/Example.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.iNNER_A
+    , Example.oUTER_A
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @simple_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+iNNER_A :: Macro.Raw String
+iNNER_A = Macro.objectLike "INNER_A" ["OUTER_A"]
+
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/simple.h 7:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+oUTER_A :: Macro.Raw String
+oUTER_A = Macro.objectLike "OUTER_A" ["1"]
diff --git a/test-artefacts/fixtures/macros/parse/simple.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/simple.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/simple.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/parse/simple.2.raw/th.txt b/test-artefacts/fixtures/macros/parse/simple.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/simple.2.raw/th.txt
@@ -0,0 +1,30 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/simple_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/simple.h
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @simple_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+iNNER_A :: Raw String
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @simple_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+iNNER_A = objectLike "INNER_A" ["OUTER_A"]
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/simple.h 7:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+oUTER_A :: Raw String
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/simple.h 7:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+oUTER_A = objectLike "OUTER_A" ["1"]
diff --git a/test-artefacts/fixtures/macros/parse/simple/Example.hs b/test-artefacts/fixtures/macros/parse/simple/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/simple/Example.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.oUTER_A
+    , Example.iNNER_A
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/simple.h 7:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+oUTER_A :: BG.CInt
+oUTER_A = (1 :: BG.CInt)
+
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @simple_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+iNNER_A :: BG.CInt
+iNNER_A = oUTER_A
diff --git a/test-artefacts/fixtures/macros/parse/simple/bindingspec.yaml b/test-artefacts/fixtures/macros/parse/simple/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/simple/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/parse/simple/th.txt b/test-artefacts/fixtures/macros/parse/simple/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/parse/simple/th.txt
@@ -0,0 +1,30 @@
+-- addDependentFile test-artefacts/headers/golden/macros/parse/simple_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/parse/simple.h
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/simple.h 7:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+oUTER_A :: CInt
+{-| __C declaration:__ @macro OUTER_A@
+
+    __defined at:__ @macros\/parse\/simple.h 7:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+oUTER_A = 1 :: CInt
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @simple_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+iNNER_A :: CInt
+{-| __C declaration:__ @macro INNER_A@
+
+    __defined at:__ @simple_inner.h 1:9@
+
+    __exported by:__ @macros\/parse\/simple.h@
+-}
+iNNER_A = oUTER_A
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/def_undef_def.h>"
+  , "/* test_macrosredeclarationdef_undef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf4e7a02d3afe48b (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationdef_undef_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0d437e8c57fae439 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_cf4e7a02d3afe48b" hs_bindgen_cf4e7a02d3afe48b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+hs_bindgen_cf4e7a02d3afe48b :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_cf4e7a02d3afe48b =
+  fmap BG.fromFFIType hs_bindgen_cf4e7a02d3afe48b_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_cf4e7a02d3afe48b
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_0d437e8c57fae439" hs_bindgen_0d437e8c57fae439_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+hs_bindgen_0d437e8c57fae439 :: IO (BG.FunPtr (BG.CChar -> IO ()))
+hs_bindgen_0d437e8c57fae439 =
+  fmap BG.fromFFIType hs_bindgen_0d437e8c57fae439_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar :: BG.FunPtr (BG.CChar -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_0d437e8c57fae439
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/def_undef_def.h>"
+  , "void hs_bindgen_79fe9113b0a5d6a5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_4327dd00f245ace9 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_79fe9113b0a5d6a5" hs_bindgen_79fe9113b0a5d6a5_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+hs_bindgen_79fe9113b0a5d6a5 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_79fe9113b0a5d6a5 =
+  \x0 ->
+    hs_bindgen_79fe9113b0a5d6a5_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_79fe9113b0a5d6a5
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_4327dd00f245ace9" hs_bindgen_4327dd00f245ace9_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+hs_bindgen_4327dd00f245ace9 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_4327dd00f245ace9 =
+  \x0 ->
+    hs_bindgen_4327dd00f245ace9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_4327dd00f245ace9
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/def_undef_def.h>"
+  , "void hs_bindgen_cd656f42f4fc25f4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_fe4fb459e811e272 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_cd656f42f4fc25f4" hs_bindgen_cd656f42f4fc25f4_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+hs_bindgen_cd656f42f4fc25f4 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_cd656f42f4fc25f4 =
+  \x0 ->
+    hs_bindgen_cd656f42f4fc25f4_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_cd656f42f4fc25f4
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_fe4fb459e811e272" hs_bindgen_fe4fb459e811e272_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+hs_bindgen_fe4fb459e811e272 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_fe4fb459e811e272 =
+  \x0 ->
+    hs_bindgen_fe4fb459e811e272_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_fe4fb459e811e272
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.1.empty/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/def_undef_def.h
+-- #include <macros/redeclaration/def_undef_def.h>
+-- void hs_bindgen_79fe9113b0a5d6a5 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_4327dd00f245ace9 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_cd656f42f4fc25f4 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_fe4fb459e811e272 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationdef_undef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf4e7a02d3afe48b (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationdef_undef_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0d437e8c57fae439 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_79fe9113b0a5d6a5" hs_bindgen_79fe9113b0a5d6a5_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+hs_bindgen_79fe9113b0a5d6a5 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+hs_bindgen_79fe9113b0a5d6a5 = \x_0 -> hs_bindgen_79fe9113b0a5d6a5_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_safe = hs_bindgen_79fe9113b0a5d6a5
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_4327dd00f245ace9" hs_bindgen_4327dd00f245ace9_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+hs_bindgen_4327dd00f245ace9 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+hs_bindgen_4327dd00f245ace9 = \x_0 -> hs_bindgen_4327dd00f245ace9_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_safe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_safe = hs_bindgen_4327dd00f245ace9
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_cd656f42f4fc25f4" hs_bindgen_cd656f42f4fc25f4_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+hs_bindgen_cd656f42f4fc25f4 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+hs_bindgen_cd656f42f4fc25f4 = \x_0 -> hs_bindgen_cd656f42f4fc25f4_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_unsafe = hs_bindgen_cd656f42f4fc25f4
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_fe4fb459e811e272" hs_bindgen_fe4fb459e811e272_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+hs_bindgen_fe4fb459e811e272 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+hs_bindgen_fe4fb459e811e272 = \x_0 -> hs_bindgen_fe4fb459e811e272_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_unsafe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_unsafe = hs_bindgen_fe4fb459e811e272
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_cf4e7a02d3afe48b" hs_bindgen_cf4e7a02d3afe48b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+hs_bindgen_cf4e7a02d3afe48b :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+hs_bindgen_cf4e7a02d3afe48b = fmap fromFFIType hs_bindgen_cf4e7a02d3afe48b_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_cf4e7a02d3afe48b
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_0d437e8c57fae439" hs_bindgen_0d437e8c57fae439_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+hs_bindgen_0d437e8c57fae439 :: IO (FunPtr (CChar -> IO ()))
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+hs_bindgen_0d437e8c57fae439 = fmap fromFFIType hs_bindgen_0d437e8c57fae439_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_funptr :: FunPtr (CChar -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_0d437e8c57fae439
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/def_undef_def.h>"
+  , "/* test_macrosredeclarationdef_undef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf4e7a02d3afe48b (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationdef_undef_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0d437e8c57fae439 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_cf4e7a02d3afe48b" hs_bindgen_cf4e7a02d3afe48b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+hs_bindgen_cf4e7a02d3afe48b :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_cf4e7a02d3afe48b =
+  fmap BG.fromFFIType hs_bindgen_cf4e7a02d3afe48b_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_cf4e7a02d3afe48b
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_0d437e8c57fae439" hs_bindgen_0d437e8c57fae439_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+hs_bindgen_0d437e8c57fae439 :: IO (BG.FunPtr (BG.CChar -> IO ()))
+hs_bindgen_0d437e8c57fae439 =
+  fmap BG.fromFFIType hs_bindgen_0d437e8c57fae439_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar :: BG.FunPtr (BG.CChar -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_0d437e8c57fae439
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/def_undef_def.h>"
+  , "void hs_bindgen_79fe9113b0a5d6a5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_4327dd00f245ace9 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_79fe9113b0a5d6a5" hs_bindgen_79fe9113b0a5d6a5_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+hs_bindgen_79fe9113b0a5d6a5 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_79fe9113b0a5d6a5 =
+  \x0 ->
+    hs_bindgen_79fe9113b0a5d6a5_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_79fe9113b0a5d6a5
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_4327dd00f245ace9" hs_bindgen_4327dd00f245ace9_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+hs_bindgen_4327dd00f245ace9 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_4327dd00f245ace9 =
+  \x0 ->
+    hs_bindgen_4327dd00f245ace9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_4327dd00f245ace9
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/def_undef_def.h>"
+  , "void hs_bindgen_cd656f42f4fc25f4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_fe4fb459e811e272 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_cd656f42f4fc25f4" hs_bindgen_cd656f42f4fc25f4_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+hs_bindgen_cd656f42f4fc25f4 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_cd656f42f4fc25f4 =
+  \x0 ->
+    hs_bindgen_cd656f42f4fc25f4_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_cd656f42f4fc25f4
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_fe4fb459e811e272" hs_bindgen_fe4fb459e811e272_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+hs_bindgen_fe4fb459e811e272 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_fe4fb459e811e272 =
+  \x0 ->
+    hs_bindgen_fe4fb459e811e272_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_fe4fb459e811e272
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def.2.raw/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/def_undef_def.h
+-- #include <macros/redeclaration/def_undef_def.h>
+-- void hs_bindgen_79fe9113b0a5d6a5 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_4327dd00f245ace9 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_cd656f42f4fc25f4 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_fe4fb459e811e272 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationdef_undef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf4e7a02d3afe48b (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationdef_undef_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0d437e8c57fae439 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_79fe9113b0a5d6a5" hs_bindgen_79fe9113b0a5d6a5_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+hs_bindgen_79fe9113b0a5d6a5 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+hs_bindgen_79fe9113b0a5d6a5 = \x_0 -> hs_bindgen_79fe9113b0a5d6a5_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_safe = hs_bindgen_79fe9113b0a5d6a5
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_4327dd00f245ace9" hs_bindgen_4327dd00f245ace9_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+hs_bindgen_4327dd00f245ace9 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+hs_bindgen_4327dd00f245ace9 = \x_0 -> hs_bindgen_4327dd00f245ace9_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_safe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_safe = hs_bindgen_4327dd00f245ace9
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_cd656f42f4fc25f4" hs_bindgen_cd656f42f4fc25f4_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+hs_bindgen_cd656f42f4fc25f4 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+hs_bindgen_cd656f42f4fc25f4 = \x_0 -> hs_bindgen_cd656f42f4fc25f4_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_unsafe = hs_bindgen_cd656f42f4fc25f4
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_fe4fb459e811e272" hs_bindgen_fe4fb459e811e272_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+hs_bindgen_fe4fb459e811e272 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+hs_bindgen_fe4fb459e811e272 = \x_0 -> hs_bindgen_fe4fb459e811e272_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_unsafe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_unsafe = hs_bindgen_fe4fb459e811e272
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_cf4e7a02d3afe48b" hs_bindgen_cf4e7a02d3afe48b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+hs_bindgen_cf4e7a02d3afe48b :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+hs_bindgen_cf4e7a02d3afe48b = fmap fromFFIType hs_bindgen_cf4e7a02d3afe48b_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_cf4e7a02d3afe48b
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_0d437e8c57fae439" hs_bindgen_0d437e8c57fae439_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+hs_bindgen_0d437e8c57fae439 :: IO (FunPtr (CChar -> IO ()))
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+hs_bindgen_0d437e8c57fae439 = fmap fromFFIType hs_bindgen_0d437e8c57fae439_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_funptr :: FunPtr (CChar -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_0d437e8c57fae439
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/def_undef_def.h>"
+  , "/* test_macrosredeclarationdef_undef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cf4e7a02d3afe48b (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationdef_undef_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0d437e8c57fae439 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_cf4e7a02d3afe48b" hs_bindgen_cf4e7a02d3afe48b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+hs_bindgen_cf4e7a02d3afe48b :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_cf4e7a02d3afe48b =
+  fmap BG.fromFFIType hs_bindgen_cf4e7a02d3afe48b_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_cf4e7a02d3afe48b
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_0d437e8c57fae439" hs_bindgen_0d437e8c57fae439_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+hs_bindgen_0d437e8c57fae439 :: IO (BG.FunPtr (BG.CChar -> IO ()))
+hs_bindgen_0d437e8c57fae439 =
+  fmap BG.fromFFIType hs_bindgen_0d437e8c57fae439_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar :: BG.FunPtr (BG.CChar -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_0d437e8c57fae439
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/def_undef_def.h>"
+  , "void hs_bindgen_79fe9113b0a5d6a5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_4327dd00f245ace9 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_79fe9113b0a5d6a5" hs_bindgen_79fe9113b0a5d6a5_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+hs_bindgen_79fe9113b0a5d6a5 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_79fe9113b0a5d6a5 =
+  \x0 ->
+    hs_bindgen_79fe9113b0a5d6a5_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_79fe9113b0a5d6a5
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_4327dd00f245ace9" hs_bindgen_4327dd00f245ace9_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+hs_bindgen_4327dd00f245ace9 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_4327dd00f245ace9 =
+  \x0 ->
+    hs_bindgen_4327dd00f245ace9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_4327dd00f245ace9
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/def_undef_def.h>"
+  , "void hs_bindgen_cd656f42f4fc25f4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_fe4fb459e811e272 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_cd656f42f4fc25f4" hs_bindgen_cd656f42f4fc25f4_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+hs_bindgen_cd656f42f4fc25f4 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_cd656f42f4fc25f4 =
+  \x0 ->
+    hs_bindgen_cd656f42f4fc25f4_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_cd656f42f4fc25f4
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_fe4fb459e811e272" hs_bindgen_fe4fb459e811e272_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+hs_bindgen_fe4fb459e811e272 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_fe4fb459e811e272 =
+  \x0 ->
+    hs_bindgen_fe4fb459e811e272_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_fe4fb459e811e272
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/def_undef_def/th.txt b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/def_undef_def/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/def_undef_def.h
+-- #include <macros/redeclaration/def_undef_def.h>
+-- void hs_bindgen_79fe9113b0a5d6a5 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_4327dd00f245ace9 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_cd656f42f4fc25f4 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_fe4fb459e811e272 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationdef_undef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cf4e7a02d3afe48b (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationdef_undef_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0d437e8c57fae439 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_79fe9113b0a5d6a5" hs_bindgen_79fe9113b0a5d6a5_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+hs_bindgen_79fe9113b0a5d6a5 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_foo@
+hs_bindgen_79fe9113b0a5d6a5 = \x_0 -> hs_bindgen_79fe9113b0a5d6a5_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_safe = hs_bindgen_79fe9113b0a5d6a5
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_4327dd00f245ace9" hs_bindgen_4327dd00f245ace9_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+hs_bindgen_4327dd00f245ace9 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Safe_bar@
+hs_bindgen_4327dd00f245ace9 = \x_0 -> hs_bindgen_4327dd00f245ace9_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_safe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_safe = hs_bindgen_4327dd00f245ace9
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_cd656f42f4fc25f4" hs_bindgen_cd656f42f4fc25f4_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+hs_bindgen_cd656f42f4fc25f4 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_foo@
+hs_bindgen_cd656f42f4fc25f4 = \x_0 -> hs_bindgen_cd656f42f4fc25f4_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_unsafe = hs_bindgen_cd656f42f4fc25f4
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_fe4fb459e811e272" hs_bindgen_fe4fb459e811e272_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+hs_bindgen_fe4fb459e811e272 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_Unsafe_bar@
+hs_bindgen_fe4fb459e811e272 = \x_0 -> hs_bindgen_fe4fb459e811e272_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_unsafe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_unsafe = hs_bindgen_fe4fb459e811e272
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_cf4e7a02d3afe48b" hs_bindgen_cf4e7a02d3afe48b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+hs_bindgen_cf4e7a02d3afe48b :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_foo@
+hs_bindgen_cf4e7a02d3afe48b = fmap fromFFIType hs_bindgen_cf4e7a02d3afe48b_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 4:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_cf4e7a02d3afe48b
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_0d437e8c57fae439" hs_bindgen_0d437e8c57fae439_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+hs_bindgen_0d437e8c57fae439 :: IO (FunPtr (CChar -> IO ()))
+-- __unique:__ @test_macrosredeclarationdef_undef_Example_get_bar@
+hs_bindgen_0d437e8c57fae439 = fmap fromFFIType hs_bindgen_0d437e8c57fae439_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_funptr :: FunPtr (CChar -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/def_undef_def.h 7:6@
+
+    __exported by:__ @macros\/redeclaration\/def_undef_def.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_0d437e8c57fae439
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/different.h>"
+  , "/* test_macrosredeclarationdifferent_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d0db0eb938233932 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationdifferent_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_46700de9dec9ddc2 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_d0db0eb938233932" hs_bindgen_d0db0eb938233932_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+hs_bindgen_d0db0eb938233932 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_d0db0eb938233932 =
+  fmap BG.fromFFIType hs_bindgen_d0db0eb938233932_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_d0db0eb938233932
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_46700de9dec9ddc2" hs_bindgen_46700de9dec9ddc2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+hs_bindgen_46700de9dec9ddc2 :: IO (BG.FunPtr (BG.CChar -> IO ()))
+hs_bindgen_46700de9dec9ddc2 =
+  fmap BG.fromFFIType hs_bindgen_46700de9dec9ddc2_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar :: BG.FunPtr (BG.CChar -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_46700de9dec9ddc2
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/different.h>"
+  , "void hs_bindgen_07088bb3b4171c29 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_190787b2a527df76 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_07088bb3b4171c29" hs_bindgen_07088bb3b4171c29_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+hs_bindgen_07088bb3b4171c29 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_07088bb3b4171c29 =
+  \x0 ->
+    hs_bindgen_07088bb3b4171c29_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_07088bb3b4171c29
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_190787b2a527df76" hs_bindgen_190787b2a527df76_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+hs_bindgen_190787b2a527df76 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_190787b2a527df76 =
+  \x0 ->
+    hs_bindgen_190787b2a527df76_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_190787b2a527df76
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/different.h>"
+  , "void hs_bindgen_42c808e061719a11 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_06a03878580406ca ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_42c808e061719a11" hs_bindgen_42c808e061719a11_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+hs_bindgen_42c808e061719a11 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_42c808e061719a11 =
+  \x0 ->
+    hs_bindgen_42c808e061719a11_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_42c808e061719a11
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_06a03878580406ca" hs_bindgen_06a03878580406ca_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+hs_bindgen_06a03878580406ca ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_06a03878580406ca =
+  \x0 ->
+    hs_bindgen_06a03878580406ca_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_06a03878580406ca
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.1.empty/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/different.h
+-- #include <macros/redeclaration/different.h>
+-- void hs_bindgen_07088bb3b4171c29 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_190787b2a527df76 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_42c808e061719a11 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_06a03878580406ca (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationdifferent_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d0db0eb938233932 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationdifferent_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_46700de9dec9ddc2 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_07088bb3b4171c29" hs_bindgen_07088bb3b4171c29_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+hs_bindgen_07088bb3b4171c29 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+hs_bindgen_07088bb3b4171c29 = \x_0 -> hs_bindgen_07088bb3b4171c29_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_safe = hs_bindgen_07088bb3b4171c29
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_190787b2a527df76" hs_bindgen_190787b2a527df76_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+hs_bindgen_190787b2a527df76 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+hs_bindgen_190787b2a527df76 = \x_0 -> hs_bindgen_190787b2a527df76_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_safe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_safe = hs_bindgen_190787b2a527df76
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_42c808e061719a11" hs_bindgen_42c808e061719a11_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+hs_bindgen_42c808e061719a11 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+hs_bindgen_42c808e061719a11 = \x_0 -> hs_bindgen_42c808e061719a11_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_unsafe = hs_bindgen_42c808e061719a11
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_06a03878580406ca" hs_bindgen_06a03878580406ca_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+hs_bindgen_06a03878580406ca :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+hs_bindgen_06a03878580406ca = \x_0 -> hs_bindgen_06a03878580406ca_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_unsafe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_unsafe = hs_bindgen_06a03878580406ca
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_d0db0eb938233932" hs_bindgen_d0db0eb938233932_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+hs_bindgen_d0db0eb938233932 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+hs_bindgen_d0db0eb938233932 = fmap fromFFIType hs_bindgen_d0db0eb938233932_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_d0db0eb938233932
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_46700de9dec9ddc2" hs_bindgen_46700de9dec9ddc2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+hs_bindgen_46700de9dec9ddc2 :: IO (FunPtr (CChar -> IO ()))
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+hs_bindgen_46700de9dec9ddc2 = fmap fromFFIType hs_bindgen_46700de9dec9ddc2_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_funptr :: FunPtr (CChar -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_46700de9dec9ddc2
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/different.h>"
+  , "/* test_macrosredeclarationdifferent_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d0db0eb938233932 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationdifferent_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_46700de9dec9ddc2 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_d0db0eb938233932" hs_bindgen_d0db0eb938233932_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+hs_bindgen_d0db0eb938233932 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_d0db0eb938233932 =
+  fmap BG.fromFFIType hs_bindgen_d0db0eb938233932_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_d0db0eb938233932
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_46700de9dec9ddc2" hs_bindgen_46700de9dec9ddc2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+hs_bindgen_46700de9dec9ddc2 :: IO (BG.FunPtr (BG.CChar -> IO ()))
+hs_bindgen_46700de9dec9ddc2 =
+  fmap BG.fromFFIType hs_bindgen_46700de9dec9ddc2_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar :: BG.FunPtr (BG.CChar -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_46700de9dec9ddc2
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/different.h>"
+  , "void hs_bindgen_07088bb3b4171c29 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_190787b2a527df76 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_07088bb3b4171c29" hs_bindgen_07088bb3b4171c29_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+hs_bindgen_07088bb3b4171c29 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_07088bb3b4171c29 =
+  \x0 ->
+    hs_bindgen_07088bb3b4171c29_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_07088bb3b4171c29
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_190787b2a527df76" hs_bindgen_190787b2a527df76_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+hs_bindgen_190787b2a527df76 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_190787b2a527df76 =
+  \x0 ->
+    hs_bindgen_190787b2a527df76_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_190787b2a527df76
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/different.h>"
+  , "void hs_bindgen_42c808e061719a11 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_06a03878580406ca ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_42c808e061719a11" hs_bindgen_42c808e061719a11_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+hs_bindgen_42c808e061719a11 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_42c808e061719a11 =
+  \x0 ->
+    hs_bindgen_42c808e061719a11_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_42c808e061719a11
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_06a03878580406ca" hs_bindgen_06a03878580406ca_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+hs_bindgen_06a03878580406ca ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_06a03878580406ca =
+  \x0 ->
+    hs_bindgen_06a03878580406ca_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_06a03878580406ca
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/different.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different.2.raw/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/different.h
+-- #include <macros/redeclaration/different.h>
+-- void hs_bindgen_07088bb3b4171c29 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_190787b2a527df76 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_42c808e061719a11 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_06a03878580406ca (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationdifferent_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d0db0eb938233932 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationdifferent_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_46700de9dec9ddc2 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_07088bb3b4171c29" hs_bindgen_07088bb3b4171c29_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+hs_bindgen_07088bb3b4171c29 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+hs_bindgen_07088bb3b4171c29 = \x_0 -> hs_bindgen_07088bb3b4171c29_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_safe = hs_bindgen_07088bb3b4171c29
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_190787b2a527df76" hs_bindgen_190787b2a527df76_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+hs_bindgen_190787b2a527df76 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+hs_bindgen_190787b2a527df76 = \x_0 -> hs_bindgen_190787b2a527df76_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_safe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_safe = hs_bindgen_190787b2a527df76
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_42c808e061719a11" hs_bindgen_42c808e061719a11_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+hs_bindgen_42c808e061719a11 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+hs_bindgen_42c808e061719a11 = \x_0 -> hs_bindgen_42c808e061719a11_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_unsafe = hs_bindgen_42c808e061719a11
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_06a03878580406ca" hs_bindgen_06a03878580406ca_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+hs_bindgen_06a03878580406ca :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+hs_bindgen_06a03878580406ca = \x_0 -> hs_bindgen_06a03878580406ca_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_unsafe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_unsafe = hs_bindgen_06a03878580406ca
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_d0db0eb938233932" hs_bindgen_d0db0eb938233932_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+hs_bindgen_d0db0eb938233932 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+hs_bindgen_d0db0eb938233932 = fmap fromFFIType hs_bindgen_d0db0eb938233932_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_d0db0eb938233932
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_46700de9dec9ddc2" hs_bindgen_46700de9dec9ddc2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+hs_bindgen_46700de9dec9ddc2 :: IO (FunPtr (CChar -> IO ()))
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+hs_bindgen_46700de9dec9ddc2 = fmap fromFFIType hs_bindgen_46700de9dec9ddc2_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_funptr :: FunPtr (CChar -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_46700de9dec9ddc2
diff --git a/test-artefacts/fixtures/macros/redeclaration/different/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/different/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/different.h>"
+  , "/* test_macrosredeclarationdifferent_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d0db0eb938233932 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationdifferent_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_46700de9dec9ddc2 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_d0db0eb938233932" hs_bindgen_d0db0eb938233932_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+hs_bindgen_d0db0eb938233932 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_d0db0eb938233932 =
+  fmap BG.fromFFIType hs_bindgen_d0db0eb938233932_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_d0db0eb938233932
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_46700de9dec9ddc2" hs_bindgen_46700de9dec9ddc2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+hs_bindgen_46700de9dec9ddc2 :: IO (BG.FunPtr (BG.CChar -> IO ()))
+hs_bindgen_46700de9dec9ddc2 =
+  fmap BG.fromFFIType hs_bindgen_46700de9dec9ddc2_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar :: BG.FunPtr (BG.CChar -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_46700de9dec9ddc2
diff --git a/test-artefacts/fixtures/macros/redeclaration/different/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/different/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/different.h>"
+  , "void hs_bindgen_07088bb3b4171c29 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_190787b2a527df76 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_07088bb3b4171c29" hs_bindgen_07088bb3b4171c29_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+hs_bindgen_07088bb3b4171c29 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_07088bb3b4171c29 =
+  \x0 ->
+    hs_bindgen_07088bb3b4171c29_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_07088bb3b4171c29
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_190787b2a527df76" hs_bindgen_190787b2a527df76_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+hs_bindgen_190787b2a527df76 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_190787b2a527df76 =
+  \x0 ->
+    hs_bindgen_190787b2a527df76_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_190787b2a527df76
diff --git a/test-artefacts/fixtures/macros/redeclaration/different/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/different/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/different.h>"
+  , "void hs_bindgen_42c808e061719a11 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_06a03878580406ca ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_42c808e061719a11" hs_bindgen_42c808e061719a11_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+hs_bindgen_42c808e061719a11 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_42c808e061719a11 =
+  \x0 ->
+    hs_bindgen_42c808e061719a11_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_42c808e061719a11
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_06a03878580406ca" hs_bindgen_06a03878580406ca_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+hs_bindgen_06a03878580406ca ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_06a03878580406ca =
+  \x0 ->
+    hs_bindgen_06a03878580406ca_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_06a03878580406ca
diff --git a/test-artefacts/fixtures/macros/redeclaration/different/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/different/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/different/th.txt b/test-artefacts/fixtures/macros/redeclaration/different/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/different.h
+-- #include <macros/redeclaration/different.h>
+-- void hs_bindgen_07088bb3b4171c29 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_190787b2a527df76 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_42c808e061719a11 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_06a03878580406ca (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationdifferent_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d0db0eb938233932 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationdifferent_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_46700de9dec9ddc2 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_07088bb3b4171c29" hs_bindgen_07088bb3b4171c29_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+hs_bindgen_07088bb3b4171c29 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_foo@
+hs_bindgen_07088bb3b4171c29 = \x_0 -> hs_bindgen_07088bb3b4171c29_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_safe = hs_bindgen_07088bb3b4171c29
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_190787b2a527df76" hs_bindgen_190787b2a527df76_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+hs_bindgen_190787b2a527df76 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Safe_bar@
+hs_bindgen_190787b2a527df76 = \x_0 -> hs_bindgen_190787b2a527df76_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_safe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_safe = hs_bindgen_190787b2a527df76
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_42c808e061719a11" hs_bindgen_42c808e061719a11_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+hs_bindgen_42c808e061719a11 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_foo@
+hs_bindgen_42c808e061719a11 = \x_0 -> hs_bindgen_42c808e061719a11_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_unsafe = hs_bindgen_42c808e061719a11
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_06a03878580406ca" hs_bindgen_06a03878580406ca_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+hs_bindgen_06a03878580406ca :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationdifferent_Example_Unsafe_bar@
+hs_bindgen_06a03878580406ca = \x_0 -> hs_bindgen_06a03878580406ca_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_unsafe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_unsafe = hs_bindgen_06a03878580406ca
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_d0db0eb938233932" hs_bindgen_d0db0eb938233932_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+hs_bindgen_d0db0eb938233932 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_foo@
+hs_bindgen_d0db0eb938233932 = fmap fromFFIType hs_bindgen_d0db0eb938233932_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/different.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_d0db0eb938233932
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_46700de9dec9ddc2" hs_bindgen_46700de9dec9ddc2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+hs_bindgen_46700de9dec9ddc2 :: IO (FunPtr (CChar -> IO ()))
+-- __unique:__ @test_macrosredeclarationdifferent_Example_get_bar@
+hs_bindgen_46700de9dec9ddc2 = fmap fromFFIType hs_bindgen_46700de9dec9ddc2_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_funptr :: FunPtr (CChar -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/different.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/different.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_46700de9dec9ddc2
diff --git a/test-artefacts/fixtures/macros/redeclaration/different_value.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/different_value.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different_value.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/different_value.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/different_value.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different_value.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/different_value.h
diff --git a/test-artefacts/fixtures/macros/redeclaration/different_value.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/different_value.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different_value.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/different_value.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/different_value.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different_value.2.raw/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/different_value.h
diff --git a/test-artefacts/fixtures/macros/redeclaration/different_value/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/different_value/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different_value/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/different_value/th.txt b/test-artefacts/fixtures/macros/redeclaration/different_value/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/different_value/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/different_value.h
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_semantics.h>"
+  , "/* test_macrosredeclarationidentical_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a17f85783f80f294 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationidentical_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fbbde3e7da8ad667 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_a17f85783f80f294 =
+  fmap BG.fromFFIType hs_bindgen_a17f85783f80f294_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_a17f85783f80f294
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_fbbde3e7da8ad667 =
+  fmap BG.fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar :: BG.FunPtr (BG.CInt -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_semantics.h>"
+  , "void hs_bindgen_3a672aa51059499f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_f6ce0c67437e90e7 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_3a672aa51059499f =
+  \x0 ->
+    hs_bindgen_3a672aa51059499f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_3a672aa51059499f
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_f6ce0c67437e90e7 =
+  \x0 ->
+    hs_bindgen_f6ce0c67437e90e7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_f6ce0c67437e90e7
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_semantics.h>"
+  , "void hs_bindgen_1f6a4a088740d7bc ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_69080a62615bc0d8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_1f6a4a088740d7bc =
+  \x0 ->
+    hs_bindgen_1f6a4a088740d7bc_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_1f6a4a088740d7bc
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_69080a62615bc0d8 =
+  \x0 ->
+    hs_bindgen_69080a62615bc0d8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_69080a62615bc0d8
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.1.empty/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/identical_semantics.h
+-- #include <macros/redeclaration/identical_semantics.h>
+-- void hs_bindgen_3a672aa51059499f (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_f6ce0c67437e90e7 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_1f6a4a088740d7bc (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_69080a62615bc0d8 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a17f85783f80f294 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fbbde3e7da8ad667 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f = \x_0 -> hs_bindgen_3a672aa51059499f_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_safe = hs_bindgen_3a672aa51059499f
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 = \x_0 -> hs_bindgen_f6ce0c67437e90e7_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_safe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_safe = hs_bindgen_f6ce0c67437e90e7
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc = \x_0 -> hs_bindgen_1f6a4a088740d7bc_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_unsafe = hs_bindgen_1f6a4a088740d7bc
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 = \x_0 -> hs_bindgen_69080a62615bc0d8_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_unsafe = hs_bindgen_69080a62615bc0d8
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 = fmap fromFFIType hs_bindgen_a17f85783f80f294_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_a17f85783f80f294
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 = fmap fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.t
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+t :: Macro.Raw String
+t = Macro.objectLike "T" ["int"]
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_semantics.h>"
+  , "/* test_macrosredeclarationidentical_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a17f85783f80f294 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationidentical_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fbbde3e7da8ad667 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_a17f85783f80f294 =
+  fmap BG.fromFFIType hs_bindgen_a17f85783f80f294_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_a17f85783f80f294
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_fbbde3e7da8ad667 =
+  fmap BG.fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar :: BG.FunPtr (BG.CInt -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_semantics.h>"
+  , "void hs_bindgen_3a672aa51059499f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_f6ce0c67437e90e7 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_3a672aa51059499f =
+  \x0 ->
+    hs_bindgen_3a672aa51059499f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_3a672aa51059499f
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_f6ce0c67437e90e7 =
+  \x0 ->
+    hs_bindgen_f6ce0c67437e90e7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_f6ce0c67437e90e7
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_semantics.h>"
+  , "void hs_bindgen_1f6a4a088740d7bc ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_69080a62615bc0d8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_1f6a4a088740d7bc =
+  \x0 ->
+    hs_bindgen_1f6a4a088740d7bc_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_1f6a4a088740d7bc
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_69080a62615bc0d8 =
+  \x0 ->
+    hs_bindgen_69080a62615bc0d8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_69080a62615bc0d8
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics.2.raw/th.txt
@@ -0,0 +1,188 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/identical_semantics.h
+-- #include <macros/redeclaration/identical_semantics.h>
+-- void hs_bindgen_3a672aa51059499f (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_f6ce0c67437e90e7 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_1f6a4a088740d7bc (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_69080a62615bc0d8 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a17f85783f80f294 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fbbde3e7da8ad667 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bar;
+-- }
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+t :: Raw String
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+t = objectLike "T" ["int"]
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f = \x_0 -> hs_bindgen_3a672aa51059499f_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_safe = hs_bindgen_3a672aa51059499f
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 = \x_0 -> hs_bindgen_f6ce0c67437e90e7_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_safe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_safe = hs_bindgen_f6ce0c67437e90e7
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc = \x_0 -> hs_bindgen_1f6a4a088740d7bc_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_unsafe = hs_bindgen_1f6a4a088740d7bc
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 = \x_0 -> hs_bindgen_69080a62615bc0d8_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_unsafe = hs_bindgen_69080a62615bc0d8
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 = fmap fromFFIType hs_bindgen_a17f85783f80f294_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_a17f85783f80f294
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 = fmap fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example.hs
@@ -0,0 +1,69 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example/FunPtr.hs
@@ -0,0 +1,73 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_semantics.h>"
+  , "/* test_macrosredeclarationidentical_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a17f85783f80f294 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationidentical_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fbbde3e7da8ad667 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_a17f85783f80f294 =
+  fmap BG.fromFFIType hs_bindgen_a17f85783f80f294_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo :: BG.FunPtr (T -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_a17f85783f80f294
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_fbbde3e7da8ad667 =
+  fmap BG.fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar :: BG.FunPtr (T -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example/Safe.hs
@@ -0,0 +1,81 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_semantics.h>"
+  , "void hs_bindgen_3a672aa51059499f ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_f6ce0c67437e90e7 ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f ::
+     T
+  -> IO ()
+hs_bindgen_3a672aa51059499f =
+  \x0 ->
+    hs_bindgen_3a672aa51059499f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_3a672aa51059499f
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 ::
+     T
+  -> IO ()
+hs_bindgen_f6ce0c67437e90e7 =
+  \x0 ->
+    hs_bindgen_f6ce0c67437e90e7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_f6ce0c67437e90e7
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/Example/Unsafe.hs
@@ -0,0 +1,81 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_semantics.h>"
+  , "void hs_bindgen_1f6a4a088740d7bc ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_69080a62615bc0d8 ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc ::
+     T
+  -> IO ()
+hs_bindgen_1f6a4a088740d7bc =
+  \x0 ->
+    hs_bindgen_1f6a4a088740d7bc_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_1f6a4a088740d7bc
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 ::
+     T
+  -> IO ()
+hs_bindgen_69080a62615bc0d8 =
+  \x0 ->
+    hs_bindgen_69080a62615bc0d8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_69080a62615bc0d8
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/redeclaration/identical_semantics.h
+  cname: macro T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_semantics/th.txt b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_semantics/th.txt
@@ -0,0 +1,206 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/identical_semantics.h
+-- #include <macros/redeclaration/identical_semantics.h>
+-- void hs_bindgen_3a672aa51059499f (
+--   T arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_f6ce0c67437e90e7 (
+--   T arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_1f6a4a088740d7bc (
+--   T arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_69080a62615bc0d8 (
+--   T arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a17f85783f80f294 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fbbde3e7da8ad667 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &bar;
+-- }
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+newtype T
+    = T {unwrapT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f :: T -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f = \x_0 -> hs_bindgen_3a672aa51059499f_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_safe :: T -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_safe = hs_bindgen_3a672aa51059499f
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 :: T -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 = \x_0 -> hs_bindgen_f6ce0c67437e90e7_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_safe :: T -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_safe = hs_bindgen_f6ce0c67437e90e7
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc :: T -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc = \x_0 -> hs_bindgen_1f6a4a088740d7bc_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_unsafe :: T -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_unsafe = hs_bindgen_1f6a4a088740d7bc
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 :: T -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 = \x_0 -> hs_bindgen_69080a62615bc0d8_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_unsafe :: T -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_unsafe = hs_bindgen_69080a62615bc0d8
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 = fmap fromFFIType hs_bindgen_a17f85783f80f294_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 3:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_a17f85783f80f294
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 = fmap fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_semantics.h 5:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_semantics.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_syntax.h>"
+  , "/* test_macrosredeclarationidentical_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a17f85783f80f294 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationidentical_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fbbde3e7da8ad667 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_a17f85783f80f294 =
+  fmap BG.fromFFIType hs_bindgen_a17f85783f80f294_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_a17f85783f80f294
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (BG.FunPtr (BG.CChar -> IO ()))
+hs_bindgen_fbbde3e7da8ad667 =
+  fmap BG.fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar :: BG.FunPtr (BG.CChar -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_syntax.h>"
+  , "void hs_bindgen_3a672aa51059499f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_f6ce0c67437e90e7 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_3a672aa51059499f =
+  \x0 ->
+    hs_bindgen_3a672aa51059499f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_3a672aa51059499f
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_f6ce0c67437e90e7 =
+  \x0 ->
+    hs_bindgen_f6ce0c67437e90e7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_f6ce0c67437e90e7
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_syntax.h>"
+  , "void hs_bindgen_1f6a4a088740d7bc ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_69080a62615bc0d8 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_1f6a4a088740d7bc =
+  \x0 ->
+    hs_bindgen_1f6a4a088740d7bc_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_1f6a4a088740d7bc
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_69080a62615bc0d8 =
+  \x0 ->
+    hs_bindgen_69080a62615bc0d8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_69080a62615bc0d8
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.1.empty/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/identical_syntax.h
+-- #include <macros/redeclaration/identical_syntax.h>
+-- void hs_bindgen_3a672aa51059499f (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_f6ce0c67437e90e7 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_1f6a4a088740d7bc (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_69080a62615bc0d8 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a17f85783f80f294 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fbbde3e7da8ad667 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f = \x_0 -> hs_bindgen_3a672aa51059499f_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_safe = hs_bindgen_3a672aa51059499f
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 = \x_0 -> hs_bindgen_f6ce0c67437e90e7_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_safe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_safe = hs_bindgen_f6ce0c67437e90e7
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc = \x_0 -> hs_bindgen_1f6a4a088740d7bc_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_unsafe = hs_bindgen_1f6a4a088740d7bc
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 = \x_0 -> hs_bindgen_69080a62615bc0d8_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_unsafe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_unsafe = hs_bindgen_69080a62615bc0d8
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 = fmap fromFFIType hs_bindgen_a17f85783f80f294_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_a17f85783f80f294
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (FunPtr (CChar -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 = fmap fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_funptr :: FunPtr (CChar -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_syntax.h>"
+  , "/* test_macrosredeclarationidentical_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a17f85783f80f294 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationidentical_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fbbde3e7da8ad667 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_a17f85783f80f294 =
+  fmap BG.fromFFIType hs_bindgen_a17f85783f80f294_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_a17f85783f80f294
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (BG.FunPtr (BG.CChar -> IO ()))
+hs_bindgen_fbbde3e7da8ad667 =
+  fmap BG.fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar :: BG.FunPtr (BG.CChar -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_syntax.h>"
+  , "void hs_bindgen_3a672aa51059499f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_f6ce0c67437e90e7 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_3a672aa51059499f =
+  \x0 ->
+    hs_bindgen_3a672aa51059499f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_3a672aa51059499f
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_f6ce0c67437e90e7 =
+  \x0 ->
+    hs_bindgen_f6ce0c67437e90e7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_f6ce0c67437e90e7
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_syntax.h>"
+  , "void hs_bindgen_1f6a4a088740d7bc ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_69080a62615bc0d8 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_1f6a4a088740d7bc =
+  \x0 ->
+    hs_bindgen_1f6a4a088740d7bc_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_1f6a4a088740d7bc
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_69080a62615bc0d8 =
+  \x0 ->
+    hs_bindgen_69080a62615bc0d8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_69080a62615bc0d8
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax.2.raw/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/identical_syntax.h
+-- #include <macros/redeclaration/identical_syntax.h>
+-- void hs_bindgen_3a672aa51059499f (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_f6ce0c67437e90e7 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_1f6a4a088740d7bc (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_69080a62615bc0d8 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a17f85783f80f294 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fbbde3e7da8ad667 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f = \x_0 -> hs_bindgen_3a672aa51059499f_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_safe = hs_bindgen_3a672aa51059499f
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 = \x_0 -> hs_bindgen_f6ce0c67437e90e7_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_safe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_safe = hs_bindgen_f6ce0c67437e90e7
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc = \x_0 -> hs_bindgen_1f6a4a088740d7bc_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_unsafe = hs_bindgen_1f6a4a088740d7bc
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 = \x_0 -> hs_bindgen_69080a62615bc0d8_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_unsafe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_unsafe = hs_bindgen_69080a62615bc0d8
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 = fmap fromFFIType hs_bindgen_a17f85783f80f294_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_a17f85783f80f294
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (FunPtr (CChar -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 = fmap fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_funptr :: FunPtr (CChar -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax/Example/FunPtr.hs b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_syntax.h>"
+  , "/* test_macrosredeclarationidentical_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a17f85783f80f294 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosredeclarationidentical_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fbbde3e7da8ad667 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_a17f85783f80f294 =
+  fmap BG.fromFFIType hs_bindgen_a17f85783f80f294_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_a17f85783f80f294
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (BG.FunPtr (BG.CChar -> IO ()))
+hs_bindgen_fbbde3e7da8ad667 =
+  fmap BG.fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar :: BG.FunPtr (BG.CChar -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax/Example/Safe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_syntax.h>"
+  , "void hs_bindgen_3a672aa51059499f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_f6ce0c67437e90e7 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_3a672aa51059499f =
+  \x0 ->
+    hs_bindgen_3a672aa51059499f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_3a672aa51059499f
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_f6ce0c67437e90e7 =
+  \x0 ->
+    hs_bindgen_f6ce0c67437e90e7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_f6ce0c67437e90e7
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax/Example/Unsafe.hs b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/redeclaration/identical_syntax.h>"
+  , "void hs_bindgen_1f6a4a088740d7bc ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_69080a62615bc0d8 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_1f6a4a088740d7bc =
+  \x0 ->
+    hs_bindgen_1f6a4a088740d7bc_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_1f6a4a088740d7bc
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+     BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 ::
+     BG.CChar
+  -> IO ()
+hs_bindgen_69080a62615bc0d8 =
+  \x0 ->
+    hs_bindgen_69080a62615bc0d8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_69080a62615bc0d8
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_syntax/th.txt b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_syntax/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/identical_syntax.h
+-- #include <macros/redeclaration/identical_syntax.h>
+-- void hs_bindgen_3a672aa51059499f (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_f6ce0c67437e90e7 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_1f6a4a088740d7bc (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_69080a62615bc0d8 (
+--   char arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a17f85783f80f294 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosredeclarationidentical_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fbbde3e7da8ad667 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_3a672aa51059499f" hs_bindgen_3a672aa51059499f_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_foo@
+hs_bindgen_3a672aa51059499f = \x_0 -> hs_bindgen_3a672aa51059499f_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_safe = hs_bindgen_3a672aa51059499f
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_f6ce0c67437e90e7" hs_bindgen_f6ce0c67437e90e7_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Safe_bar@
+hs_bindgen_f6ce0c67437e90e7 = \x_0 -> hs_bindgen_f6ce0c67437e90e7_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_safe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_safe = hs_bindgen_f6ce0c67437e90e7
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_1f6a4a088740d7bc" hs_bindgen_1f6a4a088740d7bc_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc :: CInt -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_foo@
+hs_bindgen_1f6a4a088740d7bc = \x_0 -> hs_bindgen_1f6a4a088740d7bc_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_unsafe = hs_bindgen_1f6a4a088740d7bc
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_69080a62615bc0d8" hs_bindgen_69080a62615bc0d8_base ::
+    CChar
+ -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 :: CChar -> IO ()
+-- __unique:__ @test_macrosredeclarationidentical_Example_Unsafe_bar@
+hs_bindgen_69080a62615bc0d8 = \x_0 -> hs_bindgen_69080a62615bc0d8_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_unsafe :: CChar -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_unsafe = hs_bindgen_69080a62615bc0d8
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_a17f85783f80f294" hs_bindgen_a17f85783f80f294_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_foo@
+hs_bindgen_a17f85783f80f294 = fmap fromFFIType hs_bindgen_a17f85783f80f294_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 6:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_a17f85783f80f294
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_fbbde3e7da8ad667" hs_bindgen_fbbde3e7da8ad667_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 :: IO (FunPtr (CChar -> IO ()))
+-- __unique:__ @test_macrosredeclarationidentical_Example_get_bar@
+hs_bindgen_fbbde3e7da8ad667 = fmap fromFFIType hs_bindgen_fbbde3e7da8ad667_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_funptr :: FunPtr (CChar -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/redeclaration\/identical_syntax.h 10:6@
+
+    __exported by:__ @macros\/redeclaration\/identical_syntax.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_fbbde3e7da8ad667
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_value.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/identical_value.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_value.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_value.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/identical_value.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_value.1.empty/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/identical_value.h
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_value.2.raw/Example.hs b/test-artefacts/fixtures/macros/redeclaration/identical_value.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_value.2.raw/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.a
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/redeclaration\/identical_value.h 3:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_value.h@
+-}
+a :: Macro.Raw String
+a = Macro.objectLike "A" ["5"]
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_value.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/identical_value.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_value.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_value.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/identical_value.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_value.2.raw/th.txt
@@ -0,0 +1,15 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/identical_value.h
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/redeclaration\/identical_value.h 3:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_value.h@
+-}
+a :: Raw String
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/redeclaration\/identical_value.h 3:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_value.h@
+-}
+a = objectLike "A" ["5"]
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_value/Example.hs b/test-artefacts/fixtures/macros/redeclaration/identical_value/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_value/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.a
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/redeclaration\/identical_value.h 3:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_value.h@
+-}
+a :: BG.CInt
+a = (5 :: BG.CInt)
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_value/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/identical_value/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_value/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/identical_value/th.txt b/test-artefacts/fixtures/macros/redeclaration/identical_value/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/identical_value/th.txt
@@ -0,0 +1,15 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/identical_value.h
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/redeclaration\/identical_value.h 3:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_value.h@
+-}
+a :: CInt
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/redeclaration\/identical_value.h 3:9@
+
+    __exported by:__ @macros\/redeclaration\/identical_value.h@
+-}
+a = 5 :: CInt
diff --git a/test-artefacts/fixtures/macros/redeclaration/main_header.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/main_header.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/main_header.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/main_header.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/main_header.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/main_header.1.empty/th.txt
@@ -0,0 +1,2 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/main_header_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/main_header.h
diff --git a/test-artefacts/fixtures/macros/redeclaration/main_header.2.raw/Example.hs b/test-artefacts/fixtures/macros/redeclaration/main_header.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/main_header.2.raw/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.v
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @macros\/redeclaration\/main_header.h 5:9@
+
+    __exported by:__ @macros\/redeclaration\/main_header.h@
+-}
+v :: Macro.Raw String
+v = Macro.objectLike "V" ["3"]
diff --git a/test-artefacts/fixtures/macros/redeclaration/main_header.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/main_header.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/main_header.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/main_header.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/main_header.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/main_header.2.raw/th.txt
@@ -0,0 +1,16 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/main_header_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/main_header.h
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @macros\/redeclaration\/main_header.h 5:9@
+
+    __exported by:__ @macros\/redeclaration\/main_header.h@
+-}
+v :: Raw String
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @macros\/redeclaration\/main_header.h 5:9@
+
+    __exported by:__ @macros\/redeclaration\/main_header.h@
+-}
+v = objectLike "V" ["3"]
diff --git a/test-artefacts/fixtures/macros/redeclaration/main_header/Example.hs b/test-artefacts/fixtures/macros/redeclaration/main_header/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/main_header/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.v
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @macros\/redeclaration\/main_header.h 5:9@
+
+    __exported by:__ @macros\/redeclaration\/main_header.h@
+-}
+v :: BG.CInt
+v = (3 :: BG.CInt)
diff --git a/test-artefacts/fixtures/macros/redeclaration/main_header/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/main_header/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/main_header/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/main_header/th.txt b/test-artefacts/fixtures/macros/redeclaration/main_header/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/main_header/th.txt
@@ -0,0 +1,16 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/main_header_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/main_header.h
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @macros\/redeclaration\/main_header.h 5:9@
+
+    __exported by:__ @macros\/redeclaration\/main_header.h@
+-}
+v :: CInt
+{-| __C declaration:__ @macro V@
+
+    __defined at:__ @macros\/redeclaration\/main_header.h 5:9@
+
+    __exported by:__ @macros\/redeclaration\/main_header.h@
+-}
+v = 3 :: CInt
diff --git a/test-artefacts/fixtures/macros/redeclaration/noguard.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/noguard.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/noguard.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/noguard.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/noguard.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/noguard.1.empty/th.txt
@@ -0,0 +1,2 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/noguard_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/noguard.h
diff --git a/test-artefacts/fixtures/macros/redeclaration/noguard.2.raw/Example.hs b/test-artefacts/fixtures/macros/redeclaration/noguard.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/noguard.2.raw/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @noguard_inner.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/noguard.h@
+-}
+g :: Macro.Raw String
+g = Macro.objectLike "G" ["9"]
diff --git a/test-artefacts/fixtures/macros/redeclaration/noguard.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/noguard.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/noguard.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/noguard.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/noguard.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/noguard.2.raw/th.txt
@@ -0,0 +1,16 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/noguard_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/noguard.h
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @noguard_inner.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/noguard.h@
+-}
+g :: Raw String
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @noguard_inner.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/noguard.h@
+-}
+g = objectLike "G" ["9"]
diff --git a/test-artefacts/fixtures/macros/redeclaration/noguard/Example.hs b/test-artefacts/fixtures/macros/redeclaration/noguard/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/noguard/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @noguard_inner.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/noguard.h@
+-}
+g :: BG.CInt
+g = (9 :: BG.CInt)
diff --git a/test-artefacts/fixtures/macros/redeclaration/noguard/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/noguard/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/noguard/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/redeclaration/noguard/th.txt b/test-artefacts/fixtures/macros/redeclaration/noguard/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/noguard/th.txt
@@ -0,0 +1,16 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/noguard_inner.h
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/noguard.h
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @noguard_inner.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/noguard.h@
+-}
+g :: CInt
+{-| __C declaration:__ @macro G@
+
+    __defined at:__ @noguard_inner.h 2:9@
+
+    __exported by:__ @macros\/redeclaration\/noguard.h@
+-}
+g = 9 :: CInt
diff --git a/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.1.empty/Example.hs b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.1.empty/Example.hs
@@ -0,0 +1,90 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:8@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:13@
+
+         __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:13@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.1.empty/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/redeclaration/same_line_tag_field.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.1.empty/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/same_line_tag_field.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:8@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:13@
+
+              __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.2.raw/Example.hs b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.2.raw/Example.hs
@@ -0,0 +1,101 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.b
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 15:9@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+b :: Macro.Raw String
+b = Macro.objectLike "B" ["int"]
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:8@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:13@
+
+         __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:13@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.2.raw/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/redeclaration/same_line_tag_field.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field.2.raw/th.txt
@@ -0,0 +1,48 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/same_line_tag_field.h
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 15:9@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+b :: Raw String
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 15:9@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+b = objectLike "B" ["int"]
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:8@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:13@
+
+              __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field/Example.hs b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field/Example.hs
@@ -0,0 +1,137 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.B(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 15:9@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+newtype B = B
+  { unwrapB :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:8@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+data S = S
+  { s_x :: B
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:13@
+
+         __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:13@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+instance (ty ~ B) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ B) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = B
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field/bindingspec.yaml
@@ -0,0 +1,65 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/redeclaration/same_line_tag_field.h
+  cname: macro B
+  hsname: B
+- headers: macros/redeclaration/same_line_tag_field.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field/th.txt b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/same_line_tag_field/th.txt
@@ -0,0 +1,66 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/same_line_tag_field.h
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 15:9@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+newtype B
+    = B {unwrapB :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty CInt => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:8@
+
+    __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+-}
+data S
+    = S {s_x :: B
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/redeclaration\/same_line_tag_field.h 16:13@
+
+              __exported by:__ @macros\/redeclaration\/same_line_tag_field.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty B => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty B => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = B
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/variadic.1.empty/Example.hs b/test-artefacts/fixtures/macros/redeclaration/variadic.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/variadic.1.empty/Example.hs
@@ -0,0 +1,69 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @macros\/redeclaration\/variadic.h 7:24@
+
+    __exported by:__ @macros\/redeclaration\/variadic.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/variadic.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/variadic.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/variadic.1.empty/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/redeclaration/variadic.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/redeclaration/variadic.1.empty/th.txt b/test-artefacts/fixtures/macros/redeclaration/variadic.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/variadic.1.empty/th.txt
@@ -0,0 +1,33 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/variadic.h
+{-| __C declaration:__ @T@
+
+    __defined at:__ @macros\/redeclaration\/variadic.h 7:24@
+
+    __exported by:__ @macros\/redeclaration\/variadic.h@
+-}
+newtype T
+    = T {unwrapT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/variadic.2.raw/Example.hs b/test-artefacts/fixtures/macros/redeclaration/variadic.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/variadic.2.raw/Example.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.iD
+    , Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, String, type (~))
+
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/redeclaration\/variadic.h 6:9@
+
+    __exported by:__ @macros\/redeclaration\/variadic.h@
+-}
+iD :: Macro.Raw String
+iD = Macro.variadic "ID" ["A"] ["A", "__VA_ARGS__"]
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @macros\/redeclaration\/variadic.h 7:24@
+
+    __exported by:__ @macros\/redeclaration\/variadic.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/variadic.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/variadic.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/variadic.2.raw/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/redeclaration/variadic.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/redeclaration/variadic.2.raw/th.txt b/test-artefacts/fixtures/macros/redeclaration/variadic.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/variadic.2.raw/th.txt
@@ -0,0 +1,47 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/variadic.h
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/redeclaration\/variadic.h 6:9@
+
+    __exported by:__ @macros\/redeclaration\/variadic.h@
+-}
+iD :: Raw String
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/redeclaration\/variadic.h 6:9@
+
+    __exported by:__ @macros\/redeclaration\/variadic.h@
+-}
+iD = variadic "ID" ["A"] ["A", "__VA_ARGS__"]
+{-| __C declaration:__ @T@
+
+    __defined at:__ @macros\/redeclaration\/variadic.h 7:24@
+
+    __exported by:__ @macros\/redeclaration\/variadic.h@
+-}
+newtype T
+    = T {unwrapT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/variadic/Example.hs b/test-artefacts/fixtures/macros/redeclaration/variadic/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/variadic/Example.hs
@@ -0,0 +1,69 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @macros\/redeclaration\/variadic.h 7:24@
+
+    __exported by:__ @macros\/redeclaration\/variadic.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/redeclaration/variadic/bindingspec.yaml b/test-artefacts/fixtures/macros/redeclaration/variadic/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/variadic/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/redeclaration/variadic.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/redeclaration/variadic/th.txt b/test-artefacts/fixtures/macros/redeclaration/variadic/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/redeclaration/variadic/th.txt
@@ -0,0 +1,33 @@
+-- addDependentFile test-artefacts/headers/golden/macros/redeclaration/variadic.h
+{-| __C declaration:__ @T@
+
+    __defined at:__ @macros\/redeclaration\/variadic.h 7:24@
+
+    __exported by:__ @macros\/redeclaration\/variadic.h@
+-}
+newtype T
+    = T {unwrapT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.1.empty/Example.hs
@@ -0,0 +1,2739 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Some_struct(..)
+    , Example.Some_union(..)
+    , Example.Some_enum(..)
+    , pattern Example.ENUM_A
+    , Example.Arr_typedef1(..)
+    , Example.Arr_typedef2(..)
+    , Example.Arr_typedef3(..)
+    , Example.Arr_typedef4(..)
+    , Example.Typedef1(..)
+    , Example.Typedef2(..)
+    , Example.Typedef3(..)
+    , Example.Funptr_typedef1_Aux(..)
+    , Example.Funptr_typedef1(..)
+    , Example.Funptr_typedef2_Aux(..)
+    , Example.Funptr_typedef2(..)
+    , Example.Funptr_typedef3_Aux(..)
+    , Example.Funptr_typedef3(..)
+    , Example.Funptr_typedef4_Aux(..)
+    , Example.Funptr_typedef4(..)
+    , Example.Funptr_typedef5_Aux(..)
+    , Example.Funptr_typedef5(..)
+    , Example.Comments2(..)
+    , Example.Example_struct(..)
+    , Example.Const_typedef1(..)
+    , Example.Const_typedef2(..)
+    , Example.Const_typedef3(..)
+    , Example.Const_typedef4(..)
+    , Example.Const_typedef5(..)
+    , Example.Const_typedef6(..)
+    , Example.Const_typedef7(..)
+    , Example.Example_struct_with_const(..)
+    , Example.Const_funptr1_Aux(..)
+    , Example.Const_funptr1(..)
+    , Example.Const_funptr2_Aux(..)
+    , Example.Const_funptr2(..)
+    , Example.Const_funptr3_Aux(..)
+    , Example.Const_funptr3(..)
+    , Example.Const_funptr4_Aux(..)
+    , Example.Const_funptr4(..)
+    , Example.Const_funptr5_Aux(..)
+    , Example.Const_funptr5(..)
+    , Example.Const_funptr6_Aux(..)
+    , Example.Const_funptr6(..)
+    , Example.Const_funptr7_Aux(..)
+    , Example.Const_funptr7(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, fmap, pure, type (~))
+
+{-| __C declaration:__ @struct some_struct@
+
+    __defined at:__ @macros\/reparse.h 7:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Some_struct = Some_struct
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Some_struct where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Some_struct where
+
+  readRaw = \ptr0 -> pure Some_struct
+
+instance Marshal.WriteRaw Some_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Some_struct -> pure ()
+
+deriving via Marshal.EquivStorable Some_struct instance BG.Storable Some_struct
+
+deriving via Struct.IsStructViaReadRaw Some_struct instance Struct.IsStruct Some_struct
+
+{-| __C declaration:__ @union some_union@
+
+    __defined at:__ @macros\/reparse.h 8:7@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_union = Some_union
+  { unwrapSome_union :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.StaticSize Some_union
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.ReadRaw Some_union
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.WriteRaw Some_union
+
+deriving via Marshal.EquivStorable Some_union instance BG.Storable Some_union
+
+deriving via BG.SizedByteArray 0 1 instance Union.IsUnion Some_union
+
+{-| __C declaration:__ @enum some_enum@
+
+    __defined at:__ @macros\/reparse.h 9:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_enum = Some_enum
+  { unwrapSome_enum :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Some_enum where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Some_enum where
+
+  readRaw =
+    \ptr0 ->
+          pure Some_enum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Some_enum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Some_enum unwrapSome_enum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapSome_enum2
+
+deriving via Marshal.EquivStorable Some_enum instance BG.Storable Some_enum
+
+deriving via BG.CUInt instance BG.Prim Some_enum
+
+instance CEnum.CEnum Some_enum where
+
+  type CEnumZ Some_enum = BG.CUInt
+
+  toCEnum = Some_enum
+
+  fromCEnum = BG.getField @"unwrapSome_enum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "ENUM_A")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Some_enum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Some_enum"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Some_enum where
+
+  minDeclaredValue = ENUM_A
+
+  maxDeclaredValue = ENUM_A
+
+instance Show Some_enum where
+
+  showsPrec = CEnum.shows
+
+instance Read Some_enum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapSome_enum" Some_enum ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Some_enum {unwrapSome_enum = y1}, BG.getField @"unwrapSome_enum" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapSome_enum" (BG.Ptr Some_enum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSome_enum")
+
+instance HasCField.HasCField Some_enum "unwrapSome_enum" where
+
+  type CFieldType Some_enum "unwrapSome_enum" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @ENUM_A@
+
+    __defined at:__ @macros\/reparse.h 9:18@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+pattern ENUM_A :: Some_enum
+pattern ENUM_A = Some_enum 0
+
+{-| __C declaration:__ @arr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 109:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef1 = Arr_typedef1
+  { unwrapArr_typedef1 :: IA.IncompleteArray BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef1" Arr_typedef1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef1 {unwrapArr_typedef1 = y1}
+      , BG.getField @"unwrapArr_typedef1" x0
+      )
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.HasField "unwrapArr_typedef1" (BG.Ptr Arr_typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef1")
+
+instance HasCField.HasCField Arr_typedef1 "unwrapArr_typedef1" where
+
+  type CFieldType Arr_typedef1 "unwrapArr_typedef1" =
+    IA.IncompleteArray BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @arr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 110:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef2 = Arr_typedef2
+  { unwrapArr_typedef2 :: IA.IncompleteArray (BG.Ptr BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef2" Arr_typedef2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef2 {unwrapArr_typedef2 = y1}
+      , BG.getField @"unwrapArr_typedef2" x0
+      )
+
+instance ( ty ~ IA.IncompleteArray (BG.Ptr BG.CInt)
+         ) => BG.HasField "unwrapArr_typedef2" (BG.Ptr Arr_typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef2")
+
+instance HasCField.HasCField Arr_typedef2 "unwrapArr_typedef2" where
+
+  type CFieldType Arr_typedef2 "unwrapArr_typedef2" =
+    IA.IncompleteArray (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @arr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 111:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef3 = Arr_typedef3
+  { unwrapArr_typedef3 :: CA.ConstantArray 5 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 5 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef3" Arr_typedef3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef3 {unwrapArr_typedef3 = y1}
+      , BG.getField @"unwrapArr_typedef3" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 5 BG.CInt
+         ) => BG.HasField "unwrapArr_typedef3" (BG.Ptr Arr_typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef3")
+
+instance HasCField.HasCField Arr_typedef3 "unwrapArr_typedef3" where
+
+  type CFieldType Arr_typedef3 "unwrapArr_typedef3" =
+    CA.ConstantArray 5 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @arr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 112:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef4 = Arr_typedef4
+  { unwrapArr_typedef4 :: CA.ConstantArray 5 (BG.Ptr BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 5 (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef4" Arr_typedef4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef4 {unwrapArr_typedef4 = y1}
+      , BG.getField @"unwrapArr_typedef4" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 5 (BG.Ptr BG.CInt)
+         ) => BG.HasField "unwrapArr_typedef4" (BG.Ptr Arr_typedef4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef4")
+
+instance HasCField.HasCField Arr_typedef4 "unwrapArr_typedef4" where
+
+  type CFieldType Arr_typedef4 "unwrapArr_typedef4" =
+    CA.ConstantArray 5 (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Typedefs
+
+    __C declaration:__ @typedef1@
+
+    __defined at:__ @macros\/reparse.h 118:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef1 = Typedef1
+  { unwrapTypedef1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapTypedef1" Typedef1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Typedef1 {unwrapTypedef1 = y1}, BG.getField @"unwrapTypedef1" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapTypedef1" (BG.Ptr Typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypedef1")
+
+instance HasCField.HasCField Typedef1 "unwrapTypedef1" where
+
+  type CFieldType Typedef1 "unwrapTypedef1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @typedef2@
+
+    __defined at:__ @macros\/reparse.h 119:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef2 = Typedef2
+  { unwrapTypedef2 :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapTypedef2" Typedef2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Typedef2 {unwrapTypedef2 = y1}, BG.getField @"unwrapTypedef2" x0)
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrapTypedef2" (BG.Ptr Typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypedef2")
+
+instance HasCField.HasCField Typedef2 "unwrapTypedef2" where
+
+  type CFieldType Typedef2 "unwrapTypedef2" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @typedef3@
+
+    __defined at:__ @macros\/reparse.h 120:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef3 = Typedef3
+  { unwrapTypedef3 :: BG.Ptr (BG.Ptr BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapTypedef3" Typedef3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Typedef3 {unwrapTypedef3 = y1}, BG.getField @"unwrapTypedef3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CInt)
+         ) => BG.HasField "unwrapTypedef3" (BG.Ptr Typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypedef3")
+
+instance HasCField.HasCField Typedef3 "unwrapTypedef3" where
+
+  type CFieldType Typedef3 "unwrapTypedef3" =
+    BG.Ptr (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef1'
+
+    __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1_Aux = Funptr_typedef1_Aux
+  { unwrapFunptr_typedef1_Aux :: IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c584d0f839fd43de_base ::
+     IO BG.CInt
+  -> IO (BG.FunPtr (IO BG.CInt))
+
+-- __unique:__ @toFunptr_typedef1_Aux@
+hs_bindgen_c584d0f839fd43de ::
+     Funptr_typedef1_Aux
+  -> IO (BG.FunPtr Funptr_typedef1_Aux)
+hs_bindgen_c584d0f839fd43de =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c584d0f839fd43de_base (fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef1_Aux" fun0)))
+
+-- __unique:__ @fromFunptr_typedef1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_806a46dc418a062c_base ::
+     BG.FunPtr (IO BG.CInt)
+  -> IO BG.CInt
+
+-- __unique:__ @fromFunptr_typedef1_Aux@
+hs_bindgen_806a46dc418a062c ::
+     BG.FunPtr Funptr_typedef1_Aux
+  -> Funptr_typedef1_Aux
+hs_bindgen_806a46dc418a062c =
+  \funPtr0 ->
+    Funptr_typedef1_Aux (fmap BG.fromFFIType (hs_bindgen_806a46dc418a062c_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Funptr_typedef1_Aux where
+
+  toFunPtr = hs_bindgen_c584d0f839fd43de
+
+instance BG.FromFunPtr Funptr_typedef1_Aux where
+
+  fromFunPtr = hs_bindgen_806a46dc418a062c
+
+instance ( ty ~ IO BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef1_Aux" Funptr_typedef1_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef1_Aux {unwrapFunptr_typedef1_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef1_Aux" x0
+      )
+
+instance ( ty ~ IO BG.CInt
+         ) => BG.HasField "unwrapFunptr_typedef1_Aux" (BG.Ptr Funptr_typedef1_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef1_Aux")
+
+instance HasCField.HasCField Funptr_typedef1_Aux "unwrapFunptr_typedef1_Aux" where
+
+  type CFieldType Funptr_typedef1_Aux "unwrapFunptr_typedef1_Aux" =
+    IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1 = Funptr_typedef1
+  { unwrapFunptr_typedef1 :: BG.FunPtr Funptr_typedef1_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef1_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef1" Funptr_typedef1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef1 {unwrapFunptr_typedef1 = y1}
+      , BG.getField @"unwrapFunptr_typedef1" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef1_Aux
+         ) => BG.HasField "unwrapFunptr_typedef1" (BG.Ptr Funptr_typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef1")
+
+instance HasCField.HasCField Funptr_typedef1 "unwrapFunptr_typedef1" where
+
+  type CFieldType Funptr_typedef1 "unwrapFunptr_typedef1" =
+    BG.FunPtr Funptr_typedef1_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef2'
+
+    __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2_Aux = Funptr_typedef2_Aux
+  { unwrapFunptr_typedef2_Aux :: IO (BG.Ptr BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_f174457a161ac5a0_base ::
+     IO (BG.Ptr BG.Void)
+  -> IO (BG.FunPtr (IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toFunptr_typedef2_Aux@
+hs_bindgen_f174457a161ac5a0 ::
+     Funptr_typedef2_Aux
+  -> IO (BG.FunPtr Funptr_typedef2_Aux)
+hs_bindgen_f174457a161ac5a0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_f174457a161ac5a0_base (fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef2_Aux" fun0)))
+
+-- __unique:__ @fromFunptr_typedef2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_323d07dff85b802c_base ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromFunptr_typedef2_Aux@
+hs_bindgen_323d07dff85b802c ::
+     BG.FunPtr Funptr_typedef2_Aux
+  -> Funptr_typedef2_Aux
+hs_bindgen_323d07dff85b802c =
+  \funPtr0 ->
+    Funptr_typedef2_Aux (fmap BG.fromFFIType (hs_bindgen_323d07dff85b802c_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Funptr_typedef2_Aux where
+
+  toFunPtr = hs_bindgen_f174457a161ac5a0
+
+instance BG.FromFunPtr Funptr_typedef2_Aux where
+
+  fromFunPtr = hs_bindgen_323d07dff85b802c
+
+instance ( ty ~ IO (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef2_Aux" Funptr_typedef2_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef2_Aux {unwrapFunptr_typedef2_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef2_Aux" x0
+      )
+
+instance ( ty ~ IO (BG.Ptr BG.CInt)
+         ) => BG.HasField "unwrapFunptr_typedef2_Aux" (BG.Ptr Funptr_typedef2_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef2_Aux")
+
+instance HasCField.HasCField Funptr_typedef2_Aux "unwrapFunptr_typedef2_Aux" where
+
+  type CFieldType Funptr_typedef2_Aux "unwrapFunptr_typedef2_Aux" =
+    IO (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2 = Funptr_typedef2
+  { unwrapFunptr_typedef2 :: BG.FunPtr Funptr_typedef2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef2_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef2" Funptr_typedef2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef2 {unwrapFunptr_typedef2 = y1}
+      , BG.getField @"unwrapFunptr_typedef2" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef2_Aux
+         ) => BG.HasField "unwrapFunptr_typedef2" (BG.Ptr Funptr_typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef2")
+
+instance HasCField.HasCField Funptr_typedef2 "unwrapFunptr_typedef2" where
+
+  type CFieldType Funptr_typedef2 "unwrapFunptr_typedef2" =
+    BG.FunPtr Funptr_typedef2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef3'
+
+    __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3_Aux = Funptr_typedef3_Aux
+  { unwrapFunptr_typedef3_Aux :: IO (BG.Ptr (BG.Ptr BG.CInt))
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_031d1a7decd790d8_base ::
+     IO (BG.Ptr BG.Void)
+  -> IO (BG.FunPtr (IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toFunptr_typedef3_Aux@
+hs_bindgen_031d1a7decd790d8 ::
+     Funptr_typedef3_Aux
+  -> IO (BG.FunPtr Funptr_typedef3_Aux)
+hs_bindgen_031d1a7decd790d8 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_031d1a7decd790d8_base (fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef3_Aux" fun0)))
+
+-- __unique:__ @fromFunptr_typedef3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_82dc7b932974117e_base ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromFunptr_typedef3_Aux@
+hs_bindgen_82dc7b932974117e ::
+     BG.FunPtr Funptr_typedef3_Aux
+  -> Funptr_typedef3_Aux
+hs_bindgen_82dc7b932974117e =
+  \funPtr0 ->
+    Funptr_typedef3_Aux (fmap BG.fromFFIType (hs_bindgen_82dc7b932974117e_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Funptr_typedef3_Aux where
+
+  toFunPtr = hs_bindgen_031d1a7decd790d8
+
+instance BG.FromFunPtr Funptr_typedef3_Aux where
+
+  fromFunPtr = hs_bindgen_82dc7b932974117e
+
+instance ( ty ~ IO (BG.Ptr (BG.Ptr BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef3_Aux" Funptr_typedef3_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef3_Aux {unwrapFunptr_typedef3_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef3_Aux" x0
+      )
+
+instance ( ty ~ IO (BG.Ptr (BG.Ptr BG.CInt))
+         ) => BG.HasField "unwrapFunptr_typedef3_Aux" (BG.Ptr Funptr_typedef3_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef3_Aux")
+
+instance HasCField.HasCField Funptr_typedef3_Aux "unwrapFunptr_typedef3_Aux" where
+
+  type CFieldType Funptr_typedef3_Aux "unwrapFunptr_typedef3_Aux" =
+    IO (BG.Ptr (BG.Ptr BG.CInt))
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3 = Funptr_typedef3
+  { unwrapFunptr_typedef3 :: BG.FunPtr Funptr_typedef3_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef3_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef3" Funptr_typedef3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef3 {unwrapFunptr_typedef3 = y1}
+      , BG.getField @"unwrapFunptr_typedef3" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef3_Aux
+         ) => BG.HasField "unwrapFunptr_typedef3" (BG.Ptr Funptr_typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef3")
+
+instance HasCField.HasCField Funptr_typedef3 "unwrapFunptr_typedef3" where
+
+  type CFieldType Funptr_typedef3 "unwrapFunptr_typedef3" =
+    BG.FunPtr Funptr_typedef3_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef4'
+
+    __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4_Aux = Funptr_typedef4_Aux
+  { unwrapFunptr_typedef4_Aux :: BG.CInt -> BG.CDouble -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_da2336d254667386_base ::
+     (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt))
+
+-- __unique:__ @toFunptr_typedef4_Aux@
+hs_bindgen_da2336d254667386 ::
+     Funptr_typedef4_Aux
+  -> IO (BG.FunPtr Funptr_typedef4_Aux)
+hs_bindgen_da2336d254667386 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_da2336d254667386_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef4_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromFunptr_typedef4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d4a97954476da161_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> BG.CInt -> BG.CDouble -> IO BG.CInt
+
+-- __unique:__ @fromFunptr_typedef4_Aux@
+hs_bindgen_d4a97954476da161 ::
+     BG.FunPtr Funptr_typedef4_Aux
+  -> Funptr_typedef4_Aux
+hs_bindgen_d4a97954476da161 =
+  \funPtr0 ->
+    Funptr_typedef4_Aux (\x1 ->
+                           \x2 ->
+                             fmap BG.fromFFIType (hs_bindgen_d4a97954476da161_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Funptr_typedef4_Aux where
+
+  toFunPtr = hs_bindgen_da2336d254667386
+
+instance BG.FromFunPtr Funptr_typedef4_Aux where
+
+  fromFunPtr = hs_bindgen_d4a97954476da161
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef4_Aux" Funptr_typedef4_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef4_Aux {unwrapFunptr_typedef4_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef4_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.HasField "unwrapFunptr_typedef4_Aux" (BG.Ptr Funptr_typedef4_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef4_Aux")
+
+instance HasCField.HasCField Funptr_typedef4_Aux "unwrapFunptr_typedef4_Aux" where
+
+  type CFieldType Funptr_typedef4_Aux "unwrapFunptr_typedef4_Aux" =
+    BG.CInt -> BG.CDouble -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4 = Funptr_typedef4
+  { unwrapFunptr_typedef4 :: BG.FunPtr Funptr_typedef4_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef4_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef4" Funptr_typedef4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef4 {unwrapFunptr_typedef4 = y1}
+      , BG.getField @"unwrapFunptr_typedef4" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef4_Aux
+         ) => BG.HasField "unwrapFunptr_typedef4" (BG.Ptr Funptr_typedef4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef4")
+
+instance HasCField.HasCField Funptr_typedef4 "unwrapFunptr_typedef4" where
+
+  type CFieldType Funptr_typedef4 "unwrapFunptr_typedef4" =
+    BG.FunPtr Funptr_typedef4_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef5'
+
+    __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5_Aux = Funptr_typedef5_Aux
+  { unwrapFunptr_typedef5_Aux :: BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1f45632f07742a46_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toFunptr_typedef5_Aux@
+hs_bindgen_1f45632f07742a46 ::
+     Funptr_typedef5_Aux
+  -> IO (BG.FunPtr Funptr_typedef5_Aux)
+hs_bindgen_1f45632f07742a46 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1f45632f07742a46_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef5_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromFunptr_typedef5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_0bd1877eaaba0d3e_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromFunptr_typedef5_Aux@
+hs_bindgen_0bd1877eaaba0d3e ::
+     BG.FunPtr Funptr_typedef5_Aux
+  -> Funptr_typedef5_Aux
+hs_bindgen_0bd1877eaaba0d3e =
+  \funPtr0 ->
+    Funptr_typedef5_Aux (\x1 ->
+                           \x2 ->
+                             fmap BG.fromFFIType (hs_bindgen_0bd1877eaaba0d3e_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Funptr_typedef5_Aux where
+
+  toFunPtr = hs_bindgen_1f45632f07742a46
+
+instance BG.FromFunPtr Funptr_typedef5_Aux where
+
+  fromFunPtr = hs_bindgen_0bd1877eaaba0d3e
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef5_Aux" Funptr_typedef5_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef5_Aux {unwrapFunptr_typedef5_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef5_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+         ) => BG.HasField "unwrapFunptr_typedef5_Aux" (BG.Ptr Funptr_typedef5_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef5_Aux")
+
+instance HasCField.HasCField Funptr_typedef5_Aux "unwrapFunptr_typedef5_Aux" where
+
+  type CFieldType Funptr_typedef5_Aux "unwrapFunptr_typedef5_Aux" =
+    BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5 = Funptr_typedef5
+  { unwrapFunptr_typedef5 :: BG.FunPtr Funptr_typedef5_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef5_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef5" Funptr_typedef5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef5 {unwrapFunptr_typedef5 = y1}
+      , BG.getField @"unwrapFunptr_typedef5" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef5_Aux
+         ) => BG.HasField "unwrapFunptr_typedef5" (BG.Ptr Funptr_typedef5) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef5")
+
+instance HasCField.HasCField Funptr_typedef5 "unwrapFunptr_typedef5" where
+
+  type CFieldType Funptr_typedef5 "unwrapFunptr_typedef5" =
+    BG.FunPtr Funptr_typedef5_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @comments2@
+
+    __defined at:__ @macros\/reparse.h 145:30@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Comments2 = Comments2
+  { unwrapComments2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapComments2" Comments2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Comments2 {unwrapComments2 = y1}, BG.getField @"unwrapComments2" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapComments2" (BG.Ptr Comments2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapComments2")
+
+instance HasCField.HasCField Comments2 "unwrapComments2" where
+
+  type CFieldType Comments2 "unwrapComments2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Struct fields
+
+    __C declaration:__ @struct example_struct@
+
+    __defined at:__ @macros\/reparse.h 151:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct = Example_struct
+  { example_struct_field1 :: BG.CInt
+    {- ^ __C declaration:__ @field1@
+
+         __defined at:__ @macros\/reparse.h 152:8@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_field2 :: BG.Ptr BG.CInt
+    {- ^ __C declaration:__ @field2@
+
+         __defined at:__ @macros\/reparse.h 153:8@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_field3 :: BG.Ptr (BG.Ptr BG.CInt)
+    {- ^ __C declaration:__ @field3@
+
+         __defined at:__ @macros\/reparse.h 154:8@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Example_struct where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Example_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Example_struct
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_field1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_field2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_field3") ptr0
+
+instance Marshal.WriteRaw Example_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Example_struct
+            example_struct_field12
+            example_struct_field23
+            example_struct_field34 ->
+                 HasCField.writeRaw (BG.Proxy @"example_struct_field1") ptr0 example_struct_field12
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_field2") ptr0 example_struct_field23
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_field3") ptr0 example_struct_field34
+
+deriving via Marshal.EquivStorable Example_struct instance BG.Storable Example_struct
+
+deriving via Struct.IsStructViaReadRaw Example_struct instance Struct.IsStruct Example_struct
+
+{-| __C declaration:__ @field1@
+
+    __defined at:__ @macros\/reparse.h 152:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_field1" Example_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct { example_struct_field1 = y1
+                         , example_struct_field2 = BG.getField @"example_struct_field2" x0
+                         , example_struct_field3 = BG.getField @"example_struct_field3" x0
+                         }
+      , BG.getField @"example_struct_field1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "example_struct_field1" (BG.Ptr Example_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_field1")
+
+instance HasCField.HasCField Example_struct "example_struct_field1" where
+
+  type CFieldType Example_struct "example_struct_field1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @field2@
+
+    __defined at:__ @macros\/reparse.h 153:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_field2" Example_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct { example_struct_field2 = y1
+                         , example_struct_field1 = BG.getField @"example_struct_field1" x0
+                         , example_struct_field3 = BG.getField @"example_struct_field3" x0
+                         }
+      , BG.getField @"example_struct_field2" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "example_struct_field2" (BG.Ptr Example_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_field2")
+
+instance HasCField.HasCField Example_struct "example_struct_field2" where
+
+  type CFieldType Example_struct "example_struct_field2" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @field3@
+
+    __defined at:__ @macros\/reparse.h 154:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "example_struct_field3" Example_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct { example_struct_field3 = y1
+                         , example_struct_field1 = BG.getField @"example_struct_field1" x0
+                         , example_struct_field2 = BG.getField @"example_struct_field2" x0
+                         }
+      , BG.getField @"example_struct_field3" x0
+      )
+
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CInt)
+         ) => BG.HasField "example_struct_field3" (BG.Ptr Example_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_field3")
+
+instance HasCField.HasCField Example_struct "example_struct_field3" where
+
+  type CFieldType Example_struct "example_struct_field3" =
+    BG.Ptr (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @const_typedef1@
+
+    __defined at:__ @macros\/reparse.h 218:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef1 = Const_typedef1
+  { unwrapConst_typedef1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef1" Const_typedef1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef1 {unwrapConst_typedef1 = y1}
+      , BG.getField @"unwrapConst_typedef1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapConst_typedef1" (BG.Ptr Const_typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef1")
+
+instance HasCField.HasCField Const_typedef1 "unwrapConst_typedef1" where
+
+  type CFieldType Const_typedef1 "unwrapConst_typedef1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef2@
+
+    __defined at:__ @macros\/reparse.h 219:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef2 = Const_typedef2
+  { unwrapConst_typedef2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef2" Const_typedef2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef2 {unwrapConst_typedef2 = y1}
+      , BG.getField @"unwrapConst_typedef2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapConst_typedef2" (BG.Ptr Const_typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef2")
+
+instance HasCField.HasCField Const_typedef2 "unwrapConst_typedef2" where
+
+  type CFieldType Const_typedef2 "unwrapConst_typedef2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef3@
+
+    __defined at:__ @macros\/reparse.h 220:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef3 = Const_typedef3
+  { unwrapConst_typedef3 :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef3" Const_typedef3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef3 {unwrapConst_typedef3 = y1}
+      , BG.getField @"unwrapConst_typedef3" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapConst_typedef3" (BG.Ptr Const_typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef3")
+
+instance HasCField.HasCField Const_typedef3 "unwrapConst_typedef3" where
+
+  type CFieldType Const_typedef3 "unwrapConst_typedef3" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef4@
+
+    __defined at:__ @macros\/reparse.h 221:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef4 = Const_typedef4
+  { unwrapConst_typedef4 :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef4" Const_typedef4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef4 {unwrapConst_typedef4 = y1}
+      , BG.getField @"unwrapConst_typedef4" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapConst_typedef4" (BG.Ptr Const_typedef4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef4")
+
+instance HasCField.HasCField Const_typedef4 "unwrapConst_typedef4" where
+
+  type CFieldType Const_typedef4 "unwrapConst_typedef4" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef5@
+
+    __defined at:__ @macros\/reparse.h 222:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef5 = Const_typedef5
+  { unwrapConst_typedef5 :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef5" Const_typedef5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef5 {unwrapConst_typedef5 = y1}
+      , BG.getField @"unwrapConst_typedef5" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrapConst_typedef5" (BG.Ptr Const_typedef5) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef5")
+
+instance HasCField.HasCField Const_typedef5 "unwrapConst_typedef5" where
+
+  type CFieldType Const_typedef5 "unwrapConst_typedef5" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef6@
+
+    __defined at:__ @macros\/reparse.h 223:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef6 = Const_typedef6
+  { unwrapConst_typedef6 :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef6" Const_typedef6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef6 {unwrapConst_typedef6 = y1}
+      , BG.getField @"unwrapConst_typedef6" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapConst_typedef6" (BG.Ptr Const_typedef6) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef6")
+
+instance HasCField.HasCField Const_typedef6 "unwrapConst_typedef6" where
+
+  type CFieldType Const_typedef6 "unwrapConst_typedef6" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef7@
+
+    __defined at:__ @macros\/reparse.h 224:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef7 = Const_typedef7
+  { unwrapConst_typedef7 :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef7" Const_typedef7 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef7 {unwrapConst_typedef7 = y1}
+      , BG.getField @"unwrapConst_typedef7" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapConst_typedef7" (BG.Ptr Const_typedef7) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef7")
+
+instance HasCField.HasCField Const_typedef7 "unwrapConst_typedef7" where
+
+  type CFieldType Const_typedef7 "unwrapConst_typedef7" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct example_struct_with_const@
+
+    __defined at:__ @macros\/reparse.h 226:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct_with_const = Example_struct_with_const
+  { example_struct_with_const_const_field1 :: BG.CInt
+    {- ^ __C declaration:__ @const_field1@
+
+         __defined at:__ @macros\/reparse.h 227:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field2 :: BG.CInt
+    {- ^ __C declaration:__ @const_field2@
+
+         __defined at:__ @macros\/reparse.h 228:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field3 :: PtrConst.PtrConst BG.CInt
+    {- ^ __C declaration:__ @const_field3@
+
+         __defined at:__ @macros\/reparse.h 229:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field4 :: PtrConst.PtrConst BG.CInt
+    {- ^ __C declaration:__ @const_field4@
+
+         __defined at:__ @macros\/reparse.h 230:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field5 :: BG.Ptr BG.CInt
+    {- ^ __C declaration:__ @const_field5@
+
+         __defined at:__ @macros\/reparse.h 231:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field6 :: PtrConst.PtrConst BG.CInt
+    {- ^ __C declaration:__ @const_field6@
+
+         __defined at:__ @macros\/reparse.h 232:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field7 :: PtrConst.PtrConst BG.CInt
+    {- ^ __C declaration:__ @const_field7@
+
+         __defined at:__ @macros\/reparse.h 233:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Example_struct_with_const where
+
+  staticSizeOf = \_ -> (48 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Example_struct_with_const where
+
+  readRaw =
+    \ptr0 ->
+          pure Example_struct_with_const
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field3") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field4") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field5") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field6") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field7") ptr0
+
+instance Marshal.WriteRaw Example_struct_with_const where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Example_struct_with_const
+            example_struct_with_const_const_field12
+            example_struct_with_const_const_field23
+            example_struct_with_const_const_field34
+            example_struct_with_const_const_field45
+            example_struct_with_const_const_field56
+            example_struct_with_const_const_field67
+            example_struct_with_const_const_field78 ->
+                 HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field1") ptr0 example_struct_with_const_const_field12
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field2") ptr0 example_struct_with_const_const_field23
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field3") ptr0 example_struct_with_const_const_field34
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field4") ptr0 example_struct_with_const_const_field45
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field5") ptr0 example_struct_with_const_const_field56
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field6") ptr0 example_struct_with_const_const_field67
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field7") ptr0 example_struct_with_const_const_field78
+
+deriving via Marshal.EquivStorable Example_struct_with_const instance BG.Storable Example_struct_with_const
+
+deriving via Struct.IsStructViaReadRaw Example_struct_with_const instance Struct.IsStruct Example_struct_with_const
+
+{-| __C declaration:__ @const_field1@
+
+    __defined at:__ @macros\/reparse.h 227:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field1" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field1 = y1
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field1" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field1")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field1" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_field2@
+
+    __defined at:__ @macros\/reparse.h 228:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field2" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field2 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field2" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field2")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field2" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @const_field3@
+
+    __defined at:__ @macros\/reparse.h 229:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field3" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field3 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field3" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field3" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field3")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field3" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field3" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @const_field4@
+
+    __defined at:__ @macros\/reparse.h 230:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field4" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field4 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field4" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field4" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field4")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field4" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field4" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @const_field5@
+
+    __defined at:__ @macros\/reparse.h 231:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field5" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field5 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field5" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field5" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field5")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field5" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field5" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @const_field6@
+
+    __defined at:__ @macros\/reparse.h 232:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field6" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field6 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field6" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field6" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field6")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field6" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field6" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @const_field7@
+
+    __defined at:__ @macros\/reparse.h 233:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field7" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field7 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field7" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field7" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field7")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field7" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field7" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 40
+
+{-| Auxiliary type used by 'Const_funptr1'
+
+    __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1_Aux = Const_funptr1_Aux
+  { unwrapConst_funptr1_Aux :: BG.CInt -> BG.CDouble -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7f125e20a9d4075b_base ::
+     (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt))
+
+-- __unique:__ @toConst_funptr1_Aux@
+hs_bindgen_7f125e20a9d4075b ::
+     Const_funptr1_Aux
+  -> IO (BG.FunPtr Const_funptr1_Aux)
+hs_bindgen_7f125e20a9d4075b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7f125e20a9d4075b_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr1_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ac4bd8d789bba94b_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> BG.CInt -> BG.CDouble -> IO BG.CInt
+
+-- __unique:__ @fromConst_funptr1_Aux@
+hs_bindgen_ac4bd8d789bba94b ::
+     BG.FunPtr Const_funptr1_Aux
+  -> Const_funptr1_Aux
+hs_bindgen_ac4bd8d789bba94b =
+  \funPtr0 ->
+    Const_funptr1_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_ac4bd8d789bba94b_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr1_Aux where
+
+  toFunPtr = hs_bindgen_7f125e20a9d4075b
+
+instance BG.FromFunPtr Const_funptr1_Aux where
+
+  fromFunPtr = hs_bindgen_ac4bd8d789bba94b
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr1_Aux" Const_funptr1_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr1_Aux {unwrapConst_funptr1_Aux = y1}
+      , BG.getField @"unwrapConst_funptr1_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.HasField "unwrapConst_funptr1_Aux" (BG.Ptr Const_funptr1_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr1_Aux")
+
+instance HasCField.HasCField Const_funptr1_Aux "unwrapConst_funptr1_Aux" where
+
+  type CFieldType Const_funptr1_Aux "unwrapConst_funptr1_Aux" =
+    BG.CInt -> BG.CDouble -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1 = Const_funptr1
+  { unwrapConst_funptr1 :: BG.FunPtr Const_funptr1_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr1_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr1" Const_funptr1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr1 {unwrapConst_funptr1 = y1}
+      , BG.getField @"unwrapConst_funptr1" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr1_Aux
+         ) => BG.HasField "unwrapConst_funptr1" (BG.Ptr Const_funptr1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr1")
+
+instance HasCField.HasCField Const_funptr1 "unwrapConst_funptr1" where
+
+  type CFieldType Const_funptr1 "unwrapConst_funptr1" =
+    BG.FunPtr Const_funptr1_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr2'
+
+    __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2_Aux = Const_funptr2_Aux
+  { unwrapConst_funptr2_Aux :: BG.CInt -> BG.CDouble -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c7b1e36d845634fb_base ::
+     (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt))
+
+-- __unique:__ @toConst_funptr2_Aux@
+hs_bindgen_c7b1e36d845634fb ::
+     Const_funptr2_Aux
+  -> IO (BG.FunPtr Const_funptr2_Aux)
+hs_bindgen_c7b1e36d845634fb =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c7b1e36d845634fb_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr2_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_352cebf463125ca9_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> BG.CInt -> BG.CDouble -> IO BG.CInt
+
+-- __unique:__ @fromConst_funptr2_Aux@
+hs_bindgen_352cebf463125ca9 ::
+     BG.FunPtr Const_funptr2_Aux
+  -> Const_funptr2_Aux
+hs_bindgen_352cebf463125ca9 =
+  \funPtr0 ->
+    Const_funptr2_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_352cebf463125ca9_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr2_Aux where
+
+  toFunPtr = hs_bindgen_c7b1e36d845634fb
+
+instance BG.FromFunPtr Const_funptr2_Aux where
+
+  fromFunPtr = hs_bindgen_352cebf463125ca9
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr2_Aux" Const_funptr2_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr2_Aux {unwrapConst_funptr2_Aux = y1}
+      , BG.getField @"unwrapConst_funptr2_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.HasField "unwrapConst_funptr2_Aux" (BG.Ptr Const_funptr2_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr2_Aux")
+
+instance HasCField.HasCField Const_funptr2_Aux "unwrapConst_funptr2_Aux" where
+
+  type CFieldType Const_funptr2_Aux "unwrapConst_funptr2_Aux" =
+    BG.CInt -> BG.CDouble -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2 = Const_funptr2
+  { unwrapConst_funptr2 :: BG.FunPtr Const_funptr2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr2_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr2" Const_funptr2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr2 {unwrapConst_funptr2 = y1}
+      , BG.getField @"unwrapConst_funptr2" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr2_Aux
+         ) => BG.HasField "unwrapConst_funptr2" (BG.Ptr Const_funptr2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr2")
+
+instance HasCField.HasCField Const_funptr2 "unwrapConst_funptr2" where
+
+  type CFieldType Const_funptr2 "unwrapConst_funptr2" =
+    BG.FunPtr Const_funptr2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr3'
+
+    __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3_Aux = Const_funptr3_Aux
+  { unwrapConst_funptr3_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2dcbfe1c2502178c_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr3_Aux@
+hs_bindgen_2dcbfe1c2502178c ::
+     Const_funptr3_Aux
+  -> IO (BG.FunPtr Const_funptr3_Aux)
+hs_bindgen_2dcbfe1c2502178c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_2dcbfe1c2502178c_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr3_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_86738dcfd7c9d33c_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr3_Aux@
+hs_bindgen_86738dcfd7c9d33c ::
+     BG.FunPtr Const_funptr3_Aux
+  -> Const_funptr3_Aux
+hs_bindgen_86738dcfd7c9d33c =
+  \funPtr0 ->
+    Const_funptr3_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_86738dcfd7c9d33c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr3_Aux where
+
+  toFunPtr = hs_bindgen_2dcbfe1c2502178c
+
+instance BG.FromFunPtr Const_funptr3_Aux where
+
+  fromFunPtr = hs_bindgen_86738dcfd7c9d33c
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr3_Aux" Const_funptr3_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr3_Aux {unwrapConst_funptr3_Aux = y1}
+      , BG.getField @"unwrapConst_funptr3_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr3_Aux" (BG.Ptr Const_funptr3_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr3_Aux")
+
+instance HasCField.HasCField Const_funptr3_Aux "unwrapConst_funptr3_Aux" where
+
+  type CFieldType Const_funptr3_Aux "unwrapConst_funptr3_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3 = Const_funptr3
+  { unwrapConst_funptr3 :: BG.FunPtr Const_funptr3_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr3_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr3" Const_funptr3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr3 {unwrapConst_funptr3 = y1}
+      , BG.getField @"unwrapConst_funptr3" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr3_Aux
+         ) => BG.HasField "unwrapConst_funptr3" (BG.Ptr Const_funptr3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr3")
+
+instance HasCField.HasCField Const_funptr3 "unwrapConst_funptr3" where
+
+  type CFieldType Const_funptr3 "unwrapConst_funptr3" =
+    BG.FunPtr Const_funptr3_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr4'
+
+    __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4_Aux = Const_funptr4_Aux
+  { unwrapConst_funptr4_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5461deeda491de0b_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr4_Aux@
+hs_bindgen_5461deeda491de0b ::
+     Const_funptr4_Aux
+  -> IO (BG.FunPtr Const_funptr4_Aux)
+hs_bindgen_5461deeda491de0b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_5461deeda491de0b_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr4_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_de7846fca3bfd1b6_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr4_Aux@
+hs_bindgen_de7846fca3bfd1b6 ::
+     BG.FunPtr Const_funptr4_Aux
+  -> Const_funptr4_Aux
+hs_bindgen_de7846fca3bfd1b6 =
+  \funPtr0 ->
+    Const_funptr4_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_de7846fca3bfd1b6_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr4_Aux where
+
+  toFunPtr = hs_bindgen_5461deeda491de0b
+
+instance BG.FromFunPtr Const_funptr4_Aux where
+
+  fromFunPtr = hs_bindgen_de7846fca3bfd1b6
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr4_Aux" Const_funptr4_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr4_Aux {unwrapConst_funptr4_Aux = y1}
+      , BG.getField @"unwrapConst_funptr4_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr4_Aux" (BG.Ptr Const_funptr4_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr4_Aux")
+
+instance HasCField.HasCField Const_funptr4_Aux "unwrapConst_funptr4_Aux" where
+
+  type CFieldType Const_funptr4_Aux "unwrapConst_funptr4_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4 = Const_funptr4
+  { unwrapConst_funptr4 :: BG.FunPtr Const_funptr4_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr4_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr4" Const_funptr4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr4 {unwrapConst_funptr4 = y1}
+      , BG.getField @"unwrapConst_funptr4" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr4_Aux
+         ) => BG.HasField "unwrapConst_funptr4" (BG.Ptr Const_funptr4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr4")
+
+instance HasCField.HasCField Const_funptr4 "unwrapConst_funptr4" where
+
+  type CFieldType Const_funptr4 "unwrapConst_funptr4" =
+    BG.FunPtr Const_funptr4_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr5'
+
+    __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5_Aux = Const_funptr5_Aux
+  { unwrapConst_funptr5_Aux :: BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7b0174fc978a1ce1_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr5_Aux@
+hs_bindgen_7b0174fc978a1ce1 ::
+     Const_funptr5_Aux
+  -> IO (BG.FunPtr Const_funptr5_Aux)
+hs_bindgen_7b0174fc978a1ce1 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7b0174fc978a1ce1_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr5_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_38a21d84bb7115b5_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr5_Aux@
+hs_bindgen_38a21d84bb7115b5 ::
+     BG.FunPtr Const_funptr5_Aux
+  -> Const_funptr5_Aux
+hs_bindgen_38a21d84bb7115b5 =
+  \funPtr0 ->
+    Const_funptr5_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_38a21d84bb7115b5_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr5_Aux where
+
+  toFunPtr = hs_bindgen_7b0174fc978a1ce1
+
+instance BG.FromFunPtr Const_funptr5_Aux where
+
+  fromFunPtr = hs_bindgen_38a21d84bb7115b5
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr5_Aux" Const_funptr5_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr5_Aux {unwrapConst_funptr5_Aux = y1}
+      , BG.getField @"unwrapConst_funptr5_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr5_Aux" (BG.Ptr Const_funptr5_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr5_Aux")
+
+instance HasCField.HasCField Const_funptr5_Aux "unwrapConst_funptr5_Aux" where
+
+  type CFieldType Const_funptr5_Aux "unwrapConst_funptr5_Aux" =
+    BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5 = Const_funptr5
+  { unwrapConst_funptr5 :: BG.FunPtr Const_funptr5_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr5_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr5" Const_funptr5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr5 {unwrapConst_funptr5 = y1}
+      , BG.getField @"unwrapConst_funptr5" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr5_Aux
+         ) => BG.HasField "unwrapConst_funptr5" (BG.Ptr Const_funptr5) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr5")
+
+instance HasCField.HasCField Const_funptr5 "unwrapConst_funptr5" where
+
+  type CFieldType Const_funptr5 "unwrapConst_funptr5" =
+    BG.FunPtr Const_funptr5_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr6'
+
+    __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6_Aux = Const_funptr6_Aux
+  { unwrapConst_funptr6_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr6_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_4e32721222f4df9f_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr6_Aux@
+hs_bindgen_4e32721222f4df9f ::
+     Const_funptr6_Aux
+  -> IO (BG.FunPtr Const_funptr6_Aux)
+hs_bindgen_4e32721222f4df9f =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_4e32721222f4df9f_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr6_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr6_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_45251216b04aa8b5_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr6_Aux@
+hs_bindgen_45251216b04aa8b5 ::
+     BG.FunPtr Const_funptr6_Aux
+  -> Const_funptr6_Aux
+hs_bindgen_45251216b04aa8b5 =
+  \funPtr0 ->
+    Const_funptr6_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_45251216b04aa8b5_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr6_Aux where
+
+  toFunPtr = hs_bindgen_4e32721222f4df9f
+
+instance BG.FromFunPtr Const_funptr6_Aux where
+
+  fromFunPtr = hs_bindgen_45251216b04aa8b5
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr6_Aux" Const_funptr6_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr6_Aux {unwrapConst_funptr6_Aux = y1}
+      , BG.getField @"unwrapConst_funptr6_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr6_Aux" (BG.Ptr Const_funptr6_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr6_Aux")
+
+instance HasCField.HasCField Const_funptr6_Aux "unwrapConst_funptr6_Aux" where
+
+  type CFieldType Const_funptr6_Aux "unwrapConst_funptr6_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6 = Const_funptr6
+  { unwrapConst_funptr6 :: BG.FunPtr Const_funptr6_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr6_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr6" Const_funptr6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr6 {unwrapConst_funptr6 = y1}
+      , BG.getField @"unwrapConst_funptr6" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr6_Aux
+         ) => BG.HasField "unwrapConst_funptr6" (BG.Ptr Const_funptr6) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr6")
+
+instance HasCField.HasCField Const_funptr6 "unwrapConst_funptr6" where
+
+  type CFieldType Const_funptr6 "unwrapConst_funptr6" =
+    BG.FunPtr Const_funptr6_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr7'
+
+    __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7_Aux = Const_funptr7_Aux
+  { unwrapConst_funptr7_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr7_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_0d04fc96ffb9de06_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr7_Aux@
+hs_bindgen_0d04fc96ffb9de06 ::
+     Const_funptr7_Aux
+  -> IO (BG.FunPtr Const_funptr7_Aux)
+hs_bindgen_0d04fc96ffb9de06 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_0d04fc96ffb9de06_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr7_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr7_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_42fbcebf75a973ba_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr7_Aux@
+hs_bindgen_42fbcebf75a973ba ::
+     BG.FunPtr Const_funptr7_Aux
+  -> Const_funptr7_Aux
+hs_bindgen_42fbcebf75a973ba =
+  \funPtr0 ->
+    Const_funptr7_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_42fbcebf75a973ba_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr7_Aux where
+
+  toFunPtr = hs_bindgen_0d04fc96ffb9de06
+
+instance BG.FromFunPtr Const_funptr7_Aux where
+
+  fromFunPtr = hs_bindgen_42fbcebf75a973ba
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr7_Aux" Const_funptr7_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr7_Aux {unwrapConst_funptr7_Aux = y1}
+      , BG.getField @"unwrapConst_funptr7_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr7_Aux" (BG.Ptr Const_funptr7_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr7_Aux")
+
+instance HasCField.HasCField Const_funptr7_Aux "unwrapConst_funptr7_Aux" where
+
+  type CFieldType Const_funptr7_Aux "unwrapConst_funptr7_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7 = Const_funptr7
+  { unwrapConst_funptr7 :: BG.FunPtr Const_funptr7_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr7_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr7" Const_funptr7 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr7 {unwrapConst_funptr7 = y1}
+      , BG.getField @"unwrapConst_funptr7" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr7_Aux
+         ) => BG.HasField "unwrapConst_funptr7" (BG.Ptr Const_funptr7) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr7")
+
+instance HasCField.HasCField Const_funptr7 "unwrapConst_funptr7" where
+
+  type CFieldType Const_funptr7 "unwrapConst_funptr7" =
+    BG.FunPtr Const_funptr7_Aux
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.1.empty/Example/FunPtr.hs
@@ -0,0 +1,3339 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.args_char1
+    , Example.FunPtr.args_char2
+    , Example.FunPtr.args_char3
+    , Example.FunPtr.args_short1
+    , Example.FunPtr.args_short2
+    , Example.FunPtr.args_short3
+    , Example.FunPtr.args_int1
+    , Example.FunPtr.args_int2
+    , Example.FunPtr.args_int3
+    , Example.FunPtr.args_long1
+    , Example.FunPtr.args_long2
+    , Example.FunPtr.args_long3
+    , Example.FunPtr.args_float
+    , Example.FunPtr.args_double
+    , Example.FunPtr.args_bool1
+    , Example.FunPtr.args_struct
+    , Example.FunPtr.args_union
+    , Example.FunPtr.args_enum
+    , Example.FunPtr.args_pointer1
+    , Example.FunPtr.args_pointer2
+    , Example.FunPtr.args_pointer3
+    , Example.FunPtr.ret_A
+    , Example.FunPtr.ret_char1
+    , Example.FunPtr.ret_char2
+    , Example.FunPtr.ret_char3
+    , Example.FunPtr.ret_short1
+    , Example.FunPtr.ret_short2
+    , Example.FunPtr.ret_short3
+    , Example.FunPtr.ret_int1
+    , Example.FunPtr.ret_int2
+    , Example.FunPtr.ret_int3
+    , Example.FunPtr.ret_long1
+    , Example.FunPtr.ret_long2
+    , Example.FunPtr.ret_long3
+    , Example.FunPtr.ret_float
+    , Example.FunPtr.ret_double
+    , Example.FunPtr.ret_bool1
+    , Example.FunPtr.ret_struct
+    , Example.FunPtr.ret_union
+    , Example.FunPtr.ret_enum
+    , Example.FunPtr.ret_pointer1
+    , Example.FunPtr.ret_pointer2
+    , Example.FunPtr.ret_pointer3
+    , Example.FunPtr.body1
+    , Example.FunPtr.body2
+    , Example.FunPtr.args_complex_float
+    , Example.FunPtr.args_complex_double
+    , Example.FunPtr.ret_complex_float
+    , Example.FunPtr.ret_complex_double
+    , Example.FunPtr.bespoke_args1
+    , Example.FunPtr.bespoke_args2
+    , Example.FunPtr.bespoke_ret1
+    , Example.FunPtr.bespoke_ret2
+    , Example.FunPtr.arr_args1
+    , Example.FunPtr.arr_args2
+    , Example.FunPtr.arr_args3
+    , Example.FunPtr.arr_args4
+    , Example.FunPtr.funptr_args1
+    , Example.FunPtr.funptr_args2
+    , Example.FunPtr.funptr_args3
+    , Example.FunPtr.funptr_args4
+    , Example.FunPtr.funptr_args5
+    , Example.FunPtr.comments1
+    , Example.FunPtr.const_prim_before1
+    , Example.FunPtr.const_prim_before2
+    , Example.FunPtr.const_prim_before3
+    , Example.FunPtr.const_prim_after1
+    , Example.FunPtr.const_prim_after2
+    , Example.FunPtr.const_prim_after3
+    , Example.FunPtr.const_withoutSign_before1
+    , Example.FunPtr.const_withoutSign_before2
+    , Example.FunPtr.const_withoutSign_before3
+    , Example.FunPtr.const_withoutSign_before4
+    , Example.FunPtr.const_withoutSign_before5
+    , Example.FunPtr.const_withoutSign_before6
+    , Example.FunPtr.const_withoutSign_before7
+    , Example.FunPtr.const_withoutSign_before8
+    , Example.FunPtr.const_withoutSign_after1
+    , Example.FunPtr.const_withoutSign_after2
+    , Example.FunPtr.const_withoutSign_after3
+    , Example.FunPtr.const_withoutSign_after4
+    , Example.FunPtr.const_withoutSign_after5
+    , Example.FunPtr.const_withoutSign_after6
+    , Example.FunPtr.const_withoutSign_after7
+    , Example.FunPtr.const_withoutSign_after8
+    , Example.FunPtr.const_pointers_args1
+    , Example.FunPtr.const_pointers_args2
+    , Example.FunPtr.const_pointers_args3
+    , Example.FunPtr.const_pointers_args4
+    , Example.FunPtr.const_pointers_args5
+    , Example.FunPtr.const_pointers_ret1
+    , Example.FunPtr.const_pointers_ret2
+    , Example.FunPtr.const_pointers_ret3
+    , Example.FunPtr.const_pointers_ret4
+    , Example.FunPtr.const_pointers_ret5
+    , Example.FunPtr.const_array_elem1
+    , Example.FunPtr.const_array_elem2
+    , Example.FunPtr.const_array_elem3
+    , Example.FunPtr.noParams1
+    , Example.FunPtr.noParams2
+    , Example.FunPtr.noParams3
+    , Example.FunPtr.funptr_ret1
+    , Example.FunPtr.funptr_ret2
+    , Example.FunPtr.funptr_ret3
+    , Example.FunPtr.funptr_ret4
+    , Example.FunPtr.funptr_ret5
+    , Example.FunPtr.funptr_ret6
+    , Example.FunPtr.funptr_ret7
+    , Example.FunPtr.funptr_ret8
+    , Example.FunPtr.funptr_ret9
+    , Example.FunPtr.funptr_ret10
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "/* test_macrosreparse_1_empty_Example_get_args_char1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b80f882fdcf9d390 (void)) ("
+  , "  signed int arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &args_char1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_char2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b604969d2857133d (void)) ("
+  , "  signed int arg1,"
+  , "  signed char arg2"
+  , ")"
+  , "{"
+  , "  return &args_char2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_char3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9b95a55e6ceb1621 (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned char arg2"
+  , ")"
+  , "{"
+  , "  return &args_char3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_short1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f72fa5fc8023eb3f (void)) ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  return &args_short1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_short2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_5e4d62486e4f3759 (void)) ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  return &args_short2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_short3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cef5409d73a3ebb9 (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned short arg2"
+  , ")"
+  , "{"
+  , "  return &args_short3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_int1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_67400948e9390e71 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &args_int1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_int2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f931f0229bddda59 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &args_int2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_int3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fa14da0adf102175 (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned int arg2"
+  , ")"
+  , "{"
+  , "  return &args_int3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_long1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_af7f311d12eb20c0 (void)) ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  return &args_long1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_long2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_09143fbe9a30e2a2 (void)) ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  return &args_long2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_long3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9a73b75e254c0317 (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned long arg2"
+  , ")"
+  , "{"
+  , "  return &args_long3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_float */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_98a70ab7e71e634d (void)) ("
+  , "  signed int arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  return &args_float;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_double */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2bc72f8a3bdbad63 (void)) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &args_double;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_bool1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_4f6046208f0c55ab (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  return &args_bool1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_struct */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_511a8f421aca49d7 (void)) ("
+  , "  signed int arg1,"
+  , "  struct some_struct arg2"
+  , ")"
+  , "{"
+  , "  return &args_struct;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_union */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_edf2a54db0ba78fa (void)) ("
+  , "  signed int arg1,"
+  , "  union some_union arg2"
+  , ")"
+  , "{"
+  , "  return &args_union;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_enum */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fc74034537b4ecf6 (void)) ("
+  , "  signed int arg1,"
+  , "  enum some_enum arg2"
+  , ")"
+  , "{"
+  , "  return &args_enum;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_pointer1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_594ea5d2885bc64d (void)) ("
+  , "  signed int arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  return &args_pointer1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_pointer2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_5179b8dedaed5e5e (void)) ("
+  , "  signed int arg1,"
+  , "  signed int **arg2"
+  , ")"
+  , "{"
+  , "  return &args_pointer2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_pointer3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_72daaebaddd12e45 (void)) ("
+  , "  signed int arg1,"
+  , "  void *arg2"
+  , ")"
+  , "{"
+  , "  return &args_pointer3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_A */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_cf6e0ba74be5a2da (void)) (void)"
+  , "{"
+  , "  return &ret_A;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_char1 */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_f223792546e3022e (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_char1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_char2 */"
+  , "__attribute__ ((const))"
+  , "signed char (*hs_bindgen_9bb497f3e0172b6d (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_char2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_char3 */"
+  , "__attribute__ ((const))"
+  , "unsigned char (*hs_bindgen_3be11c39ee59643e (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_char3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_short1 */"
+  , "__attribute__ ((const))"
+  , "signed short (*hs_bindgen_a65b0b8d17719893 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_short1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_short2 */"
+  , "__attribute__ ((const))"
+  , "signed short (*hs_bindgen_5190e7513c922ff0 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_short2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_short3 */"
+  , "__attribute__ ((const))"
+  , "unsigned short (*hs_bindgen_43b7df2a55a61277 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_short3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_int1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_0c98313fb5db2326 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_int1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_int2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ec162368f9f436e3 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_int2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_int3 */"
+  , "__attribute__ ((const))"
+  , "unsigned int (*hs_bindgen_7affbbac42cd29e2 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_int3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_long1 */"
+  , "__attribute__ ((const))"
+  , "signed long (*hs_bindgen_7622c56c9539e04c (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_long1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_long2 */"
+  , "__attribute__ ((const))"
+  , "signed long (*hs_bindgen_815df1fcd6285cb1 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_long2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_long3 */"
+  , "__attribute__ ((const))"
+  , "unsigned long (*hs_bindgen_246bedca6a708d23 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_long3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_float */"
+  , "__attribute__ ((const))"
+  , "float (*hs_bindgen_d0a43141a677f147 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_float;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_double */"
+  , "__attribute__ ((const))"
+  , "double (*hs_bindgen_e39c2a2347167cd5 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_double;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_bool1 */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_2f72fbc044a4bbfd (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_bool1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_struct */"
+  , "__attribute__ ((const))"
+  , "struct some_struct (*hs_bindgen_3ed00edaff786c0e (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_struct;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_union */"
+  , "__attribute__ ((const))"
+  , "union some_union (*hs_bindgen_1b270595798725a6 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_union;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_enum */"
+  , "__attribute__ ((const))"
+  , "enum some_enum (*hs_bindgen_df1e959d57683966 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_enum;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_pointer1 */"
+  , "__attribute__ ((const))"
+  , "signed int *(*hs_bindgen_f66df065bdb19e72 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_pointer1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_pointer2 */"
+  , "__attribute__ ((const))"
+  , "signed int **(*hs_bindgen_12d9b147f5523ea9 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_pointer2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_pointer3 */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_4ac9f0fe826d0748 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_pointer3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_body1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2974316436a63e20 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &body1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_body2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2b14d27784f519af (void)) (void)"
+  , "{"
+  , "  return &body2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_complex_float */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_387d68ceb6d006f9 (void)) ("
+  , "  signed int arg1,"
+  , "  float _Complex arg2"
+  , ")"
+  , "{"
+  , "  return &args_complex_float;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_args_complex_double */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a0dd7e51d4c3782c (void)) ("
+  , "  signed int arg1,"
+  , "  double _Complex arg2"
+  , ")"
+  , "{"
+  , "  return &args_complex_double;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_complex_float */"
+  , "__attribute__ ((const))"
+  , "float _Complex (*hs_bindgen_121af3746ec0fe57 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_complex_float;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_ret_complex_double */"
+  , "__attribute__ ((const))"
+  , "double _Complex (*hs_bindgen_f5f4fa2b769a0807 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_complex_double;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_bespoke_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6c590995b92657c7 (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  return &bespoke_args1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_bespoke_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b871d8c50d13d10a (void)) ("
+  , "  signed int arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &bespoke_args2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_bespoke_ret1 */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_457eeaee9b36d630 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bespoke_ret1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_bespoke_ret2 */"
+  , "__attribute__ ((const))"
+  , "size_t (*hs_bindgen_11a75beb43d5fc2e (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bespoke_ret2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_arr_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_618624c6e6b83a22 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_arr_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2ad0461638177d93 (void)) ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_arr_args3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c77b1b370d4c5f4b (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_arr_args4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_de199c863fb8ac12 (void)) ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args4;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7fc280d0a83fec73 (void)) ("
+  , "  signed int arg1,"
+  , "  void (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  return &funptr_args1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9beb81169b296475 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  return &funptr_args2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_args3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d85158bc0b976b5a (void)) ("
+  , "  signed int arg1,"
+  , "  void (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &funptr_args3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_args4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0b011779ec7227d9 (void)) ("
+  , "  signed int arg1,"
+  , "  char (*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &funptr_args4;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_args5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d358fcc92cb10cf3 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int *(*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &funptr_args5;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_comments1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0fd159d332801a82 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &comments1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_prim_before1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a40876f663bcef73 (void)) ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_before1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_prim_before2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dc5eb25e2e741ab6 (void)) ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_before2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_prim_before3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9718326f589a56a0 (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_before3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_prim_after1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cde59c88cf7b3db3 (void)) ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_after1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_prim_after2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d5ab011afdbef099 (void)) ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_after2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_prim_after3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_30f31bede8bfc87c (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_after3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_before1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6cc702c24ac0eeb2 (void)) ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_before2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e77ba4a5962cc68c (void)) ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_before3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c4d9de5a3852ba73 (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_before4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_585a37cd5f43f5da (void)) ("
+  , "  signed int arg1,"
+  , "  struct some_struct const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before4;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_before5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_655c28dba28a9a53 (void)) ("
+  , "  signed int arg1,"
+  , "  union some_union const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before5;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_before6 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9e08bdc34bafeee1 (void)) ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before6;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_before7 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_5736b6db8251bdd5 (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before7;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_before8 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c398560b654a8d9d (void)) ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before8;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_after1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_10bff078d94c8cd0 (void)) ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_after2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b75e6b8d1be2004b (void)) ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_after3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_60f26b5a2f8cf394 (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_after4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0503ec9e78e10edf (void)) ("
+  , "  signed int arg1,"
+  , "  struct some_struct const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after4;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_after5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1657dae083620adf (void)) ("
+  , "  signed int arg1,"
+  , "  union some_union const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after5;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_after6 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_44c293b62ff2015d (void)) ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after6;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_after7 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ed406d5edbd28ec1 (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after7;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_withoutSign_after8 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2cca685d1adca496 (void)) ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after8;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_5da738696e5beb04 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_783634f682149eb7 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_args3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e8c26ca0eb024ce8 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int *const arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_args4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_21e206a694593eb1 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args4;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_args5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cc3a8f368db00421 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args5;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_ret1 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*hs_bindgen_a9979680c0124010 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_ret2 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*hs_bindgen_c865f82ab69a4a3e (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_ret3 */"
+  , "__attribute__ ((const))"
+  , "signed int *const (*hs_bindgen_61570ab40d22e404 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_ret4 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*hs_bindgen_7d02f676d3a68181 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret4;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_pointers_ret5 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*hs_bindgen_3a389377331b29b9 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret5;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_array_elem1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_4810bd323f24b8d0 (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &const_array_elem1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_array_elem2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8bed93eafa056c5e (void)) ("
+  , "  signed int const **arg1"
+  , ")"
+  , "{"
+  , "  return &const_array_elem2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const_array_elem3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c569d0da33bf00e3 (void)) ("
+  , "  signed int *const *arg1"
+  , ")"
+  , "{"
+  , "  return &const_array_elem3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_noParams1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_91d4c9002424f82d (void)) (void)"
+  , "{"
+  , "  return &noParams1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_noParams2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_a317809988dfeb84 (void)) (void)"
+  , "{"
+  , "  return &noParams2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_noParams3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c23ef724e4f315be (void)) ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  return &noParams3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret1 */"
+  , "__attribute__ ((const))"
+  , "void (*(*hs_bindgen_660d89308b2b5a69 (void)) ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return &funptr_ret1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_bc7009eeb6b86418 (void)) ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return &funptr_ret2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret3 */"
+  , "__attribute__ ((const))"
+  , "void (*(*hs_bindgen_565629b4e4c20a7e (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &funptr_ret3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret4 */"
+  , "__attribute__ ((const))"
+  , "char (*(*hs_bindgen_3563760f061700c9 (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret4;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret5 */"
+  , "__attribute__ ((const))"
+  , "signed int *(*(*hs_bindgen_65c114a912faa4d1 (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret5;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret6 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*(*hs_bindgen_13dce2f12ceb5ef5 (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret6;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret7 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*(*hs_bindgen_e69f4bc4bd10259c (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret7;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret8 */"
+  , "__attribute__ ((const))"
+  , "signed int *const (*(*hs_bindgen_f06ecca1a94b60e8 (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret8;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret9 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*(*hs_bindgen_65e9b457479db3fb (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret9;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_funptr_ret10 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*(*hs_bindgen_b5fb601528eabcdb (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret10;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char1@
+foreign import ccall unsafe "hs_bindgen_b80f882fdcf9d390" hs_bindgen_b80f882fdcf9d390_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char1@
+hs_bindgen_b80f882fdcf9d390 :: IO (BG.FunPtr (BG.CInt -> BG.CChar -> IO ()))
+hs_bindgen_b80f882fdcf9d390 =
+  fmap BG.fromFFIType hs_bindgen_b80f882fdcf9d390_base
+
+{-# NOINLINE args_char1 #-}
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1 :: BG.FunPtr (BG.CInt -> BG.CChar -> IO ())
+args_char1 =
+  BG.unsafePerformIO hs_bindgen_b80f882fdcf9d390
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char2@
+foreign import ccall unsafe "hs_bindgen_b604969d2857133d" hs_bindgen_b604969d2857133d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char2@
+hs_bindgen_b604969d2857133d :: IO (BG.FunPtr (BG.CInt -> BG.CSChar -> IO ()))
+hs_bindgen_b604969d2857133d =
+  fmap BG.fromFFIType hs_bindgen_b604969d2857133d_base
+
+{-# NOINLINE args_char2 #-}
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2 :: BG.FunPtr (BG.CInt -> BG.CSChar -> IO ())
+args_char2 =
+  BG.unsafePerformIO hs_bindgen_b604969d2857133d
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char3@
+foreign import ccall unsafe "hs_bindgen_9b95a55e6ceb1621" hs_bindgen_9b95a55e6ceb1621_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char3@
+hs_bindgen_9b95a55e6ceb1621 :: IO (BG.FunPtr (BG.CInt -> BG.CUChar -> IO ()))
+hs_bindgen_9b95a55e6ceb1621 =
+  fmap BG.fromFFIType hs_bindgen_9b95a55e6ceb1621_base
+
+{-# NOINLINE args_char3 #-}
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3 :: BG.FunPtr (BG.CInt -> BG.CUChar -> IO ())
+args_char3 =
+  BG.unsafePerformIO hs_bindgen_9b95a55e6ceb1621
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short1@
+foreign import ccall unsafe "hs_bindgen_f72fa5fc8023eb3f" hs_bindgen_f72fa5fc8023eb3f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short1@
+hs_bindgen_f72fa5fc8023eb3f :: IO (BG.FunPtr (BG.CInt -> BG.CShort -> IO ()))
+hs_bindgen_f72fa5fc8023eb3f =
+  fmap BG.fromFFIType hs_bindgen_f72fa5fc8023eb3f_base
+
+{-# NOINLINE args_short1 #-}
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1 :: BG.FunPtr (BG.CInt -> BG.CShort -> IO ())
+args_short1 =
+  BG.unsafePerformIO hs_bindgen_f72fa5fc8023eb3f
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short2@
+foreign import ccall unsafe "hs_bindgen_5e4d62486e4f3759" hs_bindgen_5e4d62486e4f3759_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short2@
+hs_bindgen_5e4d62486e4f3759 :: IO (BG.FunPtr (BG.CInt -> BG.CShort -> IO ()))
+hs_bindgen_5e4d62486e4f3759 =
+  fmap BG.fromFFIType hs_bindgen_5e4d62486e4f3759_base
+
+{-# NOINLINE args_short2 #-}
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2 :: BG.FunPtr (BG.CInt -> BG.CShort -> IO ())
+args_short2 =
+  BG.unsafePerformIO hs_bindgen_5e4d62486e4f3759
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short3@
+foreign import ccall unsafe "hs_bindgen_cef5409d73a3ebb9" hs_bindgen_cef5409d73a3ebb9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short3@
+hs_bindgen_cef5409d73a3ebb9 :: IO (BG.FunPtr (BG.CInt -> BG.CUShort -> IO ()))
+hs_bindgen_cef5409d73a3ebb9 =
+  fmap BG.fromFFIType hs_bindgen_cef5409d73a3ebb9_base
+
+{-# NOINLINE args_short3 #-}
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3 :: BG.FunPtr (BG.CInt -> BG.CUShort -> IO ())
+args_short3 =
+  BG.unsafePerformIO hs_bindgen_cef5409d73a3ebb9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int1@
+foreign import ccall unsafe "hs_bindgen_67400948e9390e71" hs_bindgen_67400948e9390e71_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int1@
+hs_bindgen_67400948e9390e71 :: IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO ()))
+hs_bindgen_67400948e9390e71 =
+  fmap BG.fromFFIType hs_bindgen_67400948e9390e71_base
+
+{-# NOINLINE args_int1 #-}
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1 :: BG.FunPtr (BG.CInt -> BG.CInt -> IO ())
+args_int1 =
+  BG.unsafePerformIO hs_bindgen_67400948e9390e71
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int2@
+foreign import ccall unsafe "hs_bindgen_f931f0229bddda59" hs_bindgen_f931f0229bddda59_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int2@
+hs_bindgen_f931f0229bddda59 :: IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO ()))
+hs_bindgen_f931f0229bddda59 =
+  fmap BG.fromFFIType hs_bindgen_f931f0229bddda59_base
+
+{-# NOINLINE args_int2 #-}
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2 :: BG.FunPtr (BG.CInt -> BG.CInt -> IO ())
+args_int2 =
+  BG.unsafePerformIO hs_bindgen_f931f0229bddda59
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int3@
+foreign import ccall unsafe "hs_bindgen_fa14da0adf102175" hs_bindgen_fa14da0adf102175_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int3@
+hs_bindgen_fa14da0adf102175 :: IO (BG.FunPtr (BG.CInt -> BG.CUInt -> IO ()))
+hs_bindgen_fa14da0adf102175 =
+  fmap BG.fromFFIType hs_bindgen_fa14da0adf102175_base
+
+{-# NOINLINE args_int3 #-}
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3 :: BG.FunPtr (BG.CInt -> BG.CUInt -> IO ())
+args_int3 =
+  BG.unsafePerformIO hs_bindgen_fa14da0adf102175
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long1@
+foreign import ccall unsafe "hs_bindgen_af7f311d12eb20c0" hs_bindgen_af7f311d12eb20c0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long1@
+hs_bindgen_af7f311d12eb20c0 :: IO (BG.FunPtr (BG.CInt -> BG.CLong -> IO ()))
+hs_bindgen_af7f311d12eb20c0 =
+  fmap BG.fromFFIType hs_bindgen_af7f311d12eb20c0_base
+
+{-# NOINLINE args_long1 #-}
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1 :: BG.FunPtr (BG.CInt -> BG.CLong -> IO ())
+args_long1 =
+  BG.unsafePerformIO hs_bindgen_af7f311d12eb20c0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long2@
+foreign import ccall unsafe "hs_bindgen_09143fbe9a30e2a2" hs_bindgen_09143fbe9a30e2a2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long2@
+hs_bindgen_09143fbe9a30e2a2 :: IO (BG.FunPtr (BG.CInt -> BG.CLong -> IO ()))
+hs_bindgen_09143fbe9a30e2a2 =
+  fmap BG.fromFFIType hs_bindgen_09143fbe9a30e2a2_base
+
+{-# NOINLINE args_long2 #-}
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2 :: BG.FunPtr (BG.CInt -> BG.CLong -> IO ())
+args_long2 =
+  BG.unsafePerformIO hs_bindgen_09143fbe9a30e2a2
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long3@
+foreign import ccall unsafe "hs_bindgen_9a73b75e254c0317" hs_bindgen_9a73b75e254c0317_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long3@
+hs_bindgen_9a73b75e254c0317 :: IO (BG.FunPtr (BG.CInt -> BG.CULong -> IO ()))
+hs_bindgen_9a73b75e254c0317 =
+  fmap BG.fromFFIType hs_bindgen_9a73b75e254c0317_base
+
+{-# NOINLINE args_long3 #-}
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3 :: BG.FunPtr (BG.CInt -> BG.CULong -> IO ())
+args_long3 =
+  BG.unsafePerformIO hs_bindgen_9a73b75e254c0317
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_float@
+foreign import ccall unsafe "hs_bindgen_98a70ab7e71e634d" hs_bindgen_98a70ab7e71e634d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_float@
+hs_bindgen_98a70ab7e71e634d :: IO (BG.FunPtr (BG.CInt -> BG.CFloat -> IO ()))
+hs_bindgen_98a70ab7e71e634d =
+  fmap BG.fromFFIType hs_bindgen_98a70ab7e71e634d_base
+
+{-# NOINLINE args_float #-}
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float :: BG.FunPtr (BG.CInt -> BG.CFloat -> IO ())
+args_float =
+  BG.unsafePerformIO hs_bindgen_98a70ab7e71e634d
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_double@
+foreign import ccall unsafe "hs_bindgen_2bc72f8a3bdbad63" hs_bindgen_2bc72f8a3bdbad63_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_double@
+hs_bindgen_2bc72f8a3bdbad63 :: IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO ()))
+hs_bindgen_2bc72f8a3bdbad63 =
+  fmap BG.fromFFIType hs_bindgen_2bc72f8a3bdbad63_base
+
+{-# NOINLINE args_double #-}
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double :: BG.FunPtr (BG.CInt -> BG.CDouble -> IO ())
+args_double =
+  BG.unsafePerformIO hs_bindgen_2bc72f8a3bdbad63
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_bool1@
+foreign import ccall unsafe "hs_bindgen_4f6046208f0c55ab" hs_bindgen_4f6046208f0c55ab_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_bool1@
+hs_bindgen_4f6046208f0c55ab :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_4f6046208f0c55ab =
+  fmap BG.fromFFIType hs_bindgen_4f6046208f0c55ab_base
+
+{-# NOINLINE args_bool1 #-}
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+args_bool1 =
+  BG.unsafePerformIO hs_bindgen_4f6046208f0c55ab
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_struct@
+foreign import ccall unsafe "hs_bindgen_511a8f421aca49d7" hs_bindgen_511a8f421aca49d7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_struct@
+hs_bindgen_511a8f421aca49d7 :: IO (BG.FunPtr (BG.CInt -> Some_struct -> IO ()))
+hs_bindgen_511a8f421aca49d7 =
+  fmap BG.fromFFIType hs_bindgen_511a8f421aca49d7_base
+
+{-# NOINLINE args_struct #-}
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct :: BG.FunPtr (BG.CInt -> Some_struct -> IO ())
+args_struct =
+  BG.unsafePerformIO hs_bindgen_511a8f421aca49d7
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_union@
+foreign import ccall unsafe "hs_bindgen_edf2a54db0ba78fa" hs_bindgen_edf2a54db0ba78fa_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_union@
+hs_bindgen_edf2a54db0ba78fa :: IO (BG.FunPtr (BG.CInt -> Some_union -> IO ()))
+hs_bindgen_edf2a54db0ba78fa =
+  fmap BG.fromFFIType hs_bindgen_edf2a54db0ba78fa_base
+
+{-# NOINLINE args_union #-}
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union :: BG.FunPtr (BG.CInt -> Some_union -> IO ())
+args_union =
+  BG.unsafePerformIO hs_bindgen_edf2a54db0ba78fa
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_enum@
+foreign import ccall unsafe "hs_bindgen_fc74034537b4ecf6" hs_bindgen_fc74034537b4ecf6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_enum@
+hs_bindgen_fc74034537b4ecf6 :: IO (BG.FunPtr (BG.CInt -> Some_enum -> IO ()))
+hs_bindgen_fc74034537b4ecf6 =
+  fmap BG.fromFFIType hs_bindgen_fc74034537b4ecf6_base
+
+{-# NOINLINE args_enum #-}
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum :: BG.FunPtr (BG.CInt -> Some_enum -> IO ())
+args_enum =
+  BG.unsafePerformIO hs_bindgen_fc74034537b4ecf6
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_594ea5d2885bc64d" hs_bindgen_594ea5d2885bc64d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer1@
+hs_bindgen_594ea5d2885bc64d :: IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> IO ()))
+hs_bindgen_594ea5d2885bc64d =
+  fmap BG.fromFFIType hs_bindgen_594ea5d2885bc64d_base
+
+{-# NOINLINE args_pointer1 #-}
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1 :: BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> IO ())
+args_pointer1 =
+  BG.unsafePerformIO hs_bindgen_594ea5d2885bc64d
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_5179b8dedaed5e5e" hs_bindgen_5179b8dedaed5e5e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer2@
+hs_bindgen_5179b8dedaed5e5e :: IO (BG.FunPtr (BG.CInt -> BG.Ptr (BG.Ptr BG.CInt) -> IO ()))
+hs_bindgen_5179b8dedaed5e5e =
+  fmap BG.fromFFIType hs_bindgen_5179b8dedaed5e5e_base
+
+{-# NOINLINE args_pointer2 #-}
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2 :: BG.FunPtr (BG.CInt -> BG.Ptr (BG.Ptr BG.CInt) -> IO ())
+args_pointer2 =
+  BG.unsafePerformIO hs_bindgen_5179b8dedaed5e5e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_72daaebaddd12e45" hs_bindgen_72daaebaddd12e45_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer3@
+hs_bindgen_72daaebaddd12e45 :: IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> IO ()))
+hs_bindgen_72daaebaddd12e45 =
+  fmap BG.fromFFIType hs_bindgen_72daaebaddd12e45_base
+
+{-# NOINLINE args_pointer3 #-}
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3 :: BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> IO ())
+args_pointer3 =
+  BG.unsafePerformIO hs_bindgen_72daaebaddd12e45
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_A@
+foreign import ccall unsafe "hs_bindgen_cf6e0ba74be5a2da" hs_bindgen_cf6e0ba74be5a2da_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_A@
+hs_bindgen_cf6e0ba74be5a2da :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_cf6e0ba74be5a2da =
+  fmap BG.fromFFIType hs_bindgen_cf6e0ba74be5a2da_base
+
+{-# NOINLINE ret_A #-}
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A :: BG.FunPtr (IO BG.CInt)
+ret_A =
+  BG.unsafePerformIO hs_bindgen_cf6e0ba74be5a2da
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char1@
+foreign import ccall unsafe "hs_bindgen_f223792546e3022e" hs_bindgen_f223792546e3022e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char1@
+hs_bindgen_f223792546e3022e :: IO (BG.FunPtr (BG.CInt -> IO BG.CChar))
+hs_bindgen_f223792546e3022e =
+  fmap BG.fromFFIType hs_bindgen_f223792546e3022e_base
+
+{-# NOINLINE ret_char1 #-}
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1 :: BG.FunPtr (BG.CInt -> IO BG.CChar)
+ret_char1 =
+  BG.unsafePerformIO hs_bindgen_f223792546e3022e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char2@
+foreign import ccall unsafe "hs_bindgen_9bb497f3e0172b6d" hs_bindgen_9bb497f3e0172b6d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char2@
+hs_bindgen_9bb497f3e0172b6d :: IO (BG.FunPtr (BG.CInt -> IO BG.CSChar))
+hs_bindgen_9bb497f3e0172b6d =
+  fmap BG.fromFFIType hs_bindgen_9bb497f3e0172b6d_base
+
+{-# NOINLINE ret_char2 #-}
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2 :: BG.FunPtr (BG.CInt -> IO BG.CSChar)
+ret_char2 =
+  BG.unsafePerformIO hs_bindgen_9bb497f3e0172b6d
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char3@
+foreign import ccall unsafe "hs_bindgen_3be11c39ee59643e" hs_bindgen_3be11c39ee59643e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char3@
+hs_bindgen_3be11c39ee59643e :: IO (BG.FunPtr (BG.CInt -> IO BG.CUChar))
+hs_bindgen_3be11c39ee59643e =
+  fmap BG.fromFFIType hs_bindgen_3be11c39ee59643e_base
+
+{-# NOINLINE ret_char3 #-}
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3 :: BG.FunPtr (BG.CInt -> IO BG.CUChar)
+ret_char3 =
+  BG.unsafePerformIO hs_bindgen_3be11c39ee59643e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short1@
+foreign import ccall unsafe "hs_bindgen_a65b0b8d17719893" hs_bindgen_a65b0b8d17719893_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short1@
+hs_bindgen_a65b0b8d17719893 :: IO (BG.FunPtr (BG.CInt -> IO BG.CShort))
+hs_bindgen_a65b0b8d17719893 =
+  fmap BG.fromFFIType hs_bindgen_a65b0b8d17719893_base
+
+{-# NOINLINE ret_short1 #-}
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1 :: BG.FunPtr (BG.CInt -> IO BG.CShort)
+ret_short1 =
+  BG.unsafePerformIO hs_bindgen_a65b0b8d17719893
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short2@
+foreign import ccall unsafe "hs_bindgen_5190e7513c922ff0" hs_bindgen_5190e7513c922ff0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short2@
+hs_bindgen_5190e7513c922ff0 :: IO (BG.FunPtr (BG.CInt -> IO BG.CShort))
+hs_bindgen_5190e7513c922ff0 =
+  fmap BG.fromFFIType hs_bindgen_5190e7513c922ff0_base
+
+{-# NOINLINE ret_short2 #-}
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2 :: BG.FunPtr (BG.CInt -> IO BG.CShort)
+ret_short2 =
+  BG.unsafePerformIO hs_bindgen_5190e7513c922ff0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short3@
+foreign import ccall unsafe "hs_bindgen_43b7df2a55a61277" hs_bindgen_43b7df2a55a61277_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short3@
+hs_bindgen_43b7df2a55a61277 :: IO (BG.FunPtr (BG.CInt -> IO BG.CUShort))
+hs_bindgen_43b7df2a55a61277 =
+  fmap BG.fromFFIType hs_bindgen_43b7df2a55a61277_base
+
+{-# NOINLINE ret_short3 #-}
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3 :: BG.FunPtr (BG.CInt -> IO BG.CUShort)
+ret_short3 =
+  BG.unsafePerformIO hs_bindgen_43b7df2a55a61277
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int1@
+foreign import ccall unsafe "hs_bindgen_0c98313fb5db2326" hs_bindgen_0c98313fb5db2326_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int1@
+hs_bindgen_0c98313fb5db2326 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_0c98313fb5db2326 =
+  fmap BG.fromFFIType hs_bindgen_0c98313fb5db2326_base
+
+{-# NOINLINE ret_int1 #-}
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+ret_int1 =
+  BG.unsafePerformIO hs_bindgen_0c98313fb5db2326
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int2@
+foreign import ccall unsafe "hs_bindgen_ec162368f9f436e3" hs_bindgen_ec162368f9f436e3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int2@
+hs_bindgen_ec162368f9f436e3 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_ec162368f9f436e3 =
+  fmap BG.fromFFIType hs_bindgen_ec162368f9f436e3_base
+
+{-# NOINLINE ret_int2 #-}
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+ret_int2 =
+  BG.unsafePerformIO hs_bindgen_ec162368f9f436e3
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int3@
+foreign import ccall unsafe "hs_bindgen_7affbbac42cd29e2" hs_bindgen_7affbbac42cd29e2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int3@
+hs_bindgen_7affbbac42cd29e2 :: IO (BG.FunPtr (BG.CInt -> IO BG.CUInt))
+hs_bindgen_7affbbac42cd29e2 =
+  fmap BG.fromFFIType hs_bindgen_7affbbac42cd29e2_base
+
+{-# NOINLINE ret_int3 #-}
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3 :: BG.FunPtr (BG.CInt -> IO BG.CUInt)
+ret_int3 =
+  BG.unsafePerformIO hs_bindgen_7affbbac42cd29e2
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long1@
+foreign import ccall unsafe "hs_bindgen_7622c56c9539e04c" hs_bindgen_7622c56c9539e04c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long1@
+hs_bindgen_7622c56c9539e04c :: IO (BG.FunPtr (BG.CInt -> IO BG.CLong))
+hs_bindgen_7622c56c9539e04c =
+  fmap BG.fromFFIType hs_bindgen_7622c56c9539e04c_base
+
+{-# NOINLINE ret_long1 #-}
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1 :: BG.FunPtr (BG.CInt -> IO BG.CLong)
+ret_long1 =
+  BG.unsafePerformIO hs_bindgen_7622c56c9539e04c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long2@
+foreign import ccall unsafe "hs_bindgen_815df1fcd6285cb1" hs_bindgen_815df1fcd6285cb1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long2@
+hs_bindgen_815df1fcd6285cb1 :: IO (BG.FunPtr (BG.CInt -> IO BG.CLong))
+hs_bindgen_815df1fcd6285cb1 =
+  fmap BG.fromFFIType hs_bindgen_815df1fcd6285cb1_base
+
+{-# NOINLINE ret_long2 #-}
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2 :: BG.FunPtr (BG.CInt -> IO BG.CLong)
+ret_long2 =
+  BG.unsafePerformIO hs_bindgen_815df1fcd6285cb1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long3@
+foreign import ccall unsafe "hs_bindgen_246bedca6a708d23" hs_bindgen_246bedca6a708d23_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long3@
+hs_bindgen_246bedca6a708d23 :: IO (BG.FunPtr (BG.CInt -> IO BG.CULong))
+hs_bindgen_246bedca6a708d23 =
+  fmap BG.fromFFIType hs_bindgen_246bedca6a708d23_base
+
+{-# NOINLINE ret_long3 #-}
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3 :: BG.FunPtr (BG.CInt -> IO BG.CULong)
+ret_long3 =
+  BG.unsafePerformIO hs_bindgen_246bedca6a708d23
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_float@
+foreign import ccall unsafe "hs_bindgen_d0a43141a677f147" hs_bindgen_d0a43141a677f147_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_float@
+hs_bindgen_d0a43141a677f147 :: IO (BG.FunPtr (BG.CInt -> IO BG.CFloat))
+hs_bindgen_d0a43141a677f147 =
+  fmap BG.fromFFIType hs_bindgen_d0a43141a677f147_base
+
+{-# NOINLINE ret_float #-}
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float :: BG.FunPtr (BG.CInt -> IO BG.CFloat)
+ret_float =
+  BG.unsafePerformIO hs_bindgen_d0a43141a677f147
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_double@
+foreign import ccall unsafe "hs_bindgen_e39c2a2347167cd5" hs_bindgen_e39c2a2347167cd5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_double@
+hs_bindgen_e39c2a2347167cd5 :: IO (BG.FunPtr (BG.CInt -> IO BG.CDouble))
+hs_bindgen_e39c2a2347167cd5 =
+  fmap BG.fromFFIType hs_bindgen_e39c2a2347167cd5_base
+
+{-# NOINLINE ret_double #-}
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double :: BG.FunPtr (BG.CInt -> IO BG.CDouble)
+ret_double =
+  BG.unsafePerformIO hs_bindgen_e39c2a2347167cd5
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_2f72fbc044a4bbfd" hs_bindgen_2f72fbc044a4bbfd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_bool1@
+hs_bindgen_2f72fbc044a4bbfd :: IO (BG.FunPtr (BG.CInt -> IO BG.CBool))
+hs_bindgen_2f72fbc044a4bbfd =
+  fmap BG.fromFFIType hs_bindgen_2f72fbc044a4bbfd_base
+
+{-# NOINLINE ret_bool1 #-}
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1 :: BG.FunPtr (BG.CInt -> IO BG.CBool)
+ret_bool1 =
+  BG.unsafePerformIO hs_bindgen_2f72fbc044a4bbfd
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_struct@
+foreign import ccall unsafe "hs_bindgen_3ed00edaff786c0e" hs_bindgen_3ed00edaff786c0e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_struct@
+hs_bindgen_3ed00edaff786c0e :: IO (BG.FunPtr (BG.CInt -> IO Some_struct))
+hs_bindgen_3ed00edaff786c0e =
+  fmap BG.fromFFIType hs_bindgen_3ed00edaff786c0e_base
+
+{-# NOINLINE ret_struct #-}
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct :: BG.FunPtr (BG.CInt -> IO Some_struct)
+ret_struct =
+  BG.unsafePerformIO hs_bindgen_3ed00edaff786c0e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_union@
+foreign import ccall unsafe "hs_bindgen_1b270595798725a6" hs_bindgen_1b270595798725a6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_union@
+hs_bindgen_1b270595798725a6 :: IO (BG.FunPtr (BG.CInt -> IO Some_union))
+hs_bindgen_1b270595798725a6 =
+  fmap BG.fromFFIType hs_bindgen_1b270595798725a6_base
+
+{-# NOINLINE ret_union #-}
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union :: BG.FunPtr (BG.CInt -> IO Some_union)
+ret_union =
+  BG.unsafePerformIO hs_bindgen_1b270595798725a6
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_enum@
+foreign import ccall unsafe "hs_bindgen_df1e959d57683966" hs_bindgen_df1e959d57683966_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_enum@
+hs_bindgen_df1e959d57683966 :: IO (BG.FunPtr (BG.CInt -> IO Some_enum))
+hs_bindgen_df1e959d57683966 =
+  fmap BG.fromFFIType hs_bindgen_df1e959d57683966_base
+
+{-# NOINLINE ret_enum #-}
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum :: BG.FunPtr (BG.CInt -> IO Some_enum)
+ret_enum =
+  BG.unsafePerformIO hs_bindgen_df1e959d57683966
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_f66df065bdb19e72" hs_bindgen_f66df065bdb19e72_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer1@
+hs_bindgen_f66df065bdb19e72 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_f66df065bdb19e72 =
+  fmap BG.fromFFIType hs_bindgen_f66df065bdb19e72_base
+
+{-# NOINLINE ret_pointer1 #-}
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+ret_pointer1 =
+  BG.unsafePerformIO hs_bindgen_f66df065bdb19e72
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_12d9b147f5523ea9" hs_bindgen_12d9b147f5523ea9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer2@
+hs_bindgen_12d9b147f5523ea9 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt))))
+hs_bindgen_12d9b147f5523ea9 =
+  fmap BG.fromFFIType hs_bindgen_12d9b147f5523ea9_base
+
+{-# NOINLINE ret_pointer2 #-}
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+ret_pointer2 =
+  BG.unsafePerformIO hs_bindgen_12d9b147f5523ea9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_4ac9f0fe826d0748" hs_bindgen_4ac9f0fe826d0748_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer3@
+hs_bindgen_4ac9f0fe826d0748 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void)))
+hs_bindgen_4ac9f0fe826d0748 =
+  fmap BG.fromFFIType hs_bindgen_4ac9f0fe826d0748_base
+
+{-# NOINLINE ret_pointer3 #-}
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void))
+ret_pointer3 =
+  BG.unsafePerformIO hs_bindgen_4ac9f0fe826d0748
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body1@
+foreign import ccall unsafe "hs_bindgen_2974316436a63e20" hs_bindgen_2974316436a63e20_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body1@
+hs_bindgen_2974316436a63e20 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_2974316436a63e20 =
+  fmap BG.fromFFIType hs_bindgen_2974316436a63e20_base
+
+{-# NOINLINE body1 #-}
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+body1 =
+  BG.unsafePerformIO hs_bindgen_2974316436a63e20
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body2@
+foreign import ccall unsafe "hs_bindgen_2b14d27784f519af" hs_bindgen_2b14d27784f519af_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body2@
+hs_bindgen_2b14d27784f519af :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_2b14d27784f519af =
+  fmap BG.fromFFIType hs_bindgen_2b14d27784f519af_base
+
+{-# NOINLINE body2 #-}
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2 :: BG.FunPtr (IO BG.CInt)
+body2 =
+  BG.unsafePerformIO hs_bindgen_2b14d27784f519af
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_387d68ceb6d006f9" hs_bindgen_387d68ceb6d006f9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_float@
+hs_bindgen_387d68ceb6d006f9 :: IO (BG.FunPtr (BG.CInt -> BG.Complex BG.CFloat -> IO ()))
+hs_bindgen_387d68ceb6d006f9 =
+  fmap BG.fromFFIType hs_bindgen_387d68ceb6d006f9_base
+
+{-# NOINLINE args_complex_float #-}
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float :: BG.FunPtr (BG.CInt -> BG.Complex BG.CFloat -> IO ())
+args_complex_float =
+  BG.unsafePerformIO hs_bindgen_387d68ceb6d006f9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_a0dd7e51d4c3782c" hs_bindgen_a0dd7e51d4c3782c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_double@
+hs_bindgen_a0dd7e51d4c3782c :: IO (BG.FunPtr (BG.CInt -> BG.Complex BG.CDouble -> IO ()))
+hs_bindgen_a0dd7e51d4c3782c =
+  fmap BG.fromFFIType hs_bindgen_a0dd7e51d4c3782c_base
+
+{-# NOINLINE args_complex_double #-}
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double :: BG.FunPtr (BG.CInt -> BG.Complex BG.CDouble -> IO ())
+args_complex_double =
+  BG.unsafePerformIO hs_bindgen_a0dd7e51d4c3782c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_121af3746ec0fe57" hs_bindgen_121af3746ec0fe57_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_float@
+hs_bindgen_121af3746ec0fe57 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Complex BG.CFloat)))
+hs_bindgen_121af3746ec0fe57 =
+  fmap BG.fromFFIType hs_bindgen_121af3746ec0fe57_base
+
+{-# NOINLINE ret_complex_float #-}
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float :: BG.FunPtr (BG.CInt -> IO (BG.Complex BG.CFloat))
+ret_complex_float =
+  BG.unsafePerformIO hs_bindgen_121af3746ec0fe57
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_f5f4fa2b769a0807" hs_bindgen_f5f4fa2b769a0807_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_double@
+hs_bindgen_f5f4fa2b769a0807 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Complex BG.CDouble)))
+hs_bindgen_f5f4fa2b769a0807 =
+  fmap BG.fromFFIType hs_bindgen_f5f4fa2b769a0807_base
+
+{-# NOINLINE ret_complex_double #-}
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double :: BG.FunPtr (BG.CInt -> IO (BG.Complex BG.CDouble))
+ret_complex_double =
+  BG.unsafePerformIO hs_bindgen_f5f4fa2b769a0807
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_6c590995b92657c7" hs_bindgen_6c590995b92657c7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args1@
+hs_bindgen_6c590995b92657c7 :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_6c590995b92657c7 =
+  fmap BG.fromFFIType hs_bindgen_6c590995b92657c7_base
+
+{-# NOINLINE bespoke_args1 #-}
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+bespoke_args1 =
+  BG.unsafePerformIO hs_bindgen_6c590995b92657c7
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_b871d8c50d13d10a" hs_bindgen_b871d8c50d13d10a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args2@
+hs_bindgen_b871d8c50d13d10a :: IO (BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_b871d8c50d13d10a =
+  fmap BG.fromFFIType hs_bindgen_b871d8c50d13d10a_base
+
+{-# NOINLINE bespoke_args2 #-}
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2 :: BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ())
+bespoke_args2 =
+  BG.unsafePerformIO hs_bindgen_b871d8c50d13d10a
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_457eeaee9b36d630" hs_bindgen_457eeaee9b36d630_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret1@
+hs_bindgen_457eeaee9b36d630 :: IO (BG.FunPtr (BG.CInt -> IO BG.CBool))
+hs_bindgen_457eeaee9b36d630 =
+  fmap BG.fromFFIType hs_bindgen_457eeaee9b36d630_base
+
+{-# NOINLINE bespoke_ret1 #-}
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1 :: BG.FunPtr (BG.CInt -> IO BG.CBool)
+bespoke_ret1 =
+  BG.unsafePerformIO hs_bindgen_457eeaee9b36d630
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_11a75beb43d5fc2e" hs_bindgen_11a75beb43d5fc2e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret2@
+hs_bindgen_11a75beb43d5fc2e :: IO (BG.FunPtr (BG.CInt -> IO HsBindgen.Runtime.LibC.CSize))
+hs_bindgen_11a75beb43d5fc2e =
+  fmap BG.fromFFIType hs_bindgen_11a75beb43d5fc2e_base
+
+{-# NOINLINE bespoke_ret2 #-}
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2 :: BG.FunPtr (BG.CInt -> IO HsBindgen.Runtime.LibC.CSize)
+bespoke_ret2 =
+  BG.unsafePerformIO hs_bindgen_11a75beb43d5fc2e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args1@
+foreign import ccall unsafe "hs_bindgen_618624c6e6b83a22" hs_bindgen_618624c6e6b83a22_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args1@
+hs_bindgen_618624c6e6b83a22 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ()))
+hs_bindgen_618624c6e6b83a22 =
+  fmap BG.fromFFIType hs_bindgen_618624c6e6b83a22_base
+
+{-# NOINLINE arr_args1 #-}
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ())
+arr_args1 =
+  BG.unsafePerformIO hs_bindgen_618624c6e6b83a22
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args2@
+foreign import ccall unsafe "hs_bindgen_2ad0461638177d93" hs_bindgen_2ad0461638177d93_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args2@
+hs_bindgen_2ad0461638177d93 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt))) -> IO ()))
+hs_bindgen_2ad0461638177d93 =
+  fmap BG.fromFFIType hs_bindgen_2ad0461638177d93_base
+
+{-# NOINLINE arr_args2 #-}
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt))) -> IO ())
+arr_args2 =
+  BG.unsafePerformIO hs_bindgen_2ad0461638177d93
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args3@
+foreign import ccall unsafe "hs_bindgen_c77b1b370d4c5f4b" hs_bindgen_c77b1b370d4c5f4b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args3@
+hs_bindgen_c77b1b370d4c5f4b :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt)) -> IO ()))
+hs_bindgen_c77b1b370d4c5f4b =
+  fmap BG.fromFFIType hs_bindgen_c77b1b370d4c5f4b_base
+
+{-# NOINLINE arr_args3 #-}
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3 :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt)) -> IO ())
+arr_args3 =
+  BG.unsafePerformIO hs_bindgen_c77b1b370d4c5f4b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args4@
+foreign import ccall unsafe "hs_bindgen_de199c863fb8ac12" hs_bindgen_de199c863fb8ac12_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args4@
+hs_bindgen_de199c863fb8ac12 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt))) -> IO ()))
+hs_bindgen_de199c863fb8ac12 =
+  fmap BG.fromFFIType hs_bindgen_de199c863fb8ac12_base
+
+{-# NOINLINE arr_args4 #-}
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4 :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt))) -> IO ())
+arr_args4 =
+  BG.unsafePerformIO hs_bindgen_de199c863fb8ac12
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_7fc280d0a83fec73" hs_bindgen_7fc280d0a83fec73_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args1@
+hs_bindgen_7fc280d0a83fec73 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (IO ()) -> IO ()))
+hs_bindgen_7fc280d0a83fec73 =
+  fmap BG.fromFFIType hs_bindgen_7fc280d0a83fec73_base
+
+{-# NOINLINE funptr_args1 #-}
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1 :: BG.FunPtr (BG.CInt -> BG.FunPtr (IO ()) -> IO ())
+funptr_args1 =
+  BG.unsafePerformIO hs_bindgen_7fc280d0a83fec73
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_9beb81169b296475" hs_bindgen_9beb81169b296475_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args2@
+hs_bindgen_9beb81169b296475 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (IO BG.CInt) -> IO ()))
+hs_bindgen_9beb81169b296475 =
+  fmap BG.fromFFIType hs_bindgen_9beb81169b296475_base
+
+{-# NOINLINE funptr_args2 #-}
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2 :: BG.FunPtr (BG.CInt -> BG.FunPtr (IO BG.CInt) -> IO ())
+funptr_args2 =
+  BG.unsafePerformIO hs_bindgen_9beb81169b296475
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_d85158bc0b976b5a" hs_bindgen_d85158bc0b976b5a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args3@
+hs_bindgen_d85158bc0b976b5a :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> IO ()) -> IO ()))
+hs_bindgen_d85158bc0b976b5a =
+  fmap BG.fromFFIType hs_bindgen_d85158bc0b976b5a_base
+
+{-# NOINLINE funptr_args3 #-}
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3 :: BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> IO ()) -> IO ())
+funptr_args3 =
+  BG.unsafePerformIO hs_bindgen_d85158bc0b976b5a
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_0b011779ec7227d9" hs_bindgen_0b011779ec7227d9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args4@
+hs_bindgen_0b011779ec7227d9 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar) -> IO ()))
+hs_bindgen_0b011779ec7227d9 =
+  fmap BG.fromFFIType hs_bindgen_0b011779ec7227d9_base
+
+{-# NOINLINE funptr_args4 #-}
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4 :: BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar) -> IO ())
+funptr_args4 =
+  BG.unsafePerformIO hs_bindgen_0b011779ec7227d9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_d358fcc92cb10cf3" hs_bindgen_d358fcc92cb10cf3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args5@
+hs_bindgen_d358fcc92cb10cf3 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)) -> IO ()))
+hs_bindgen_d358fcc92cb10cf3 =
+  fmap BG.fromFFIType hs_bindgen_d358fcc92cb10cf3_base
+
+{-# NOINLINE funptr_args5 #-}
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5 :: BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)) -> IO ())
+funptr_args5 =
+  BG.unsafePerformIO hs_bindgen_d358fcc92cb10cf3
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_comments1@
+foreign import ccall unsafe "hs_bindgen_0fd159d332801a82" hs_bindgen_0fd159d332801a82_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_comments1@
+hs_bindgen_0fd159d332801a82 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_0fd159d332801a82 =
+  fmap BG.fromFFIType hs_bindgen_0fd159d332801a82_base
+
+{-# NOINLINE comments1 #-}
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1 :: BG.FunPtr (BG.CInt -> IO ())
+comments1 =
+  BG.unsafePerformIO hs_bindgen_0fd159d332801a82
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_a40876f663bcef73" hs_bindgen_a40876f663bcef73_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before1@
+hs_bindgen_a40876f663bcef73 :: IO (BG.FunPtr (BG.CInt -> BG.CChar -> IO ()))
+hs_bindgen_a40876f663bcef73 =
+  fmap BG.fromFFIType hs_bindgen_a40876f663bcef73_base
+
+{-# NOINLINE const_prim_before1 #-}
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1 :: BG.FunPtr (BG.CInt -> BG.CChar -> IO ())
+const_prim_before1 =
+  BG.unsafePerformIO hs_bindgen_a40876f663bcef73
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_dc5eb25e2e741ab6" hs_bindgen_dc5eb25e2e741ab6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before2@
+hs_bindgen_dc5eb25e2e741ab6 :: IO (BG.FunPtr (BG.CInt -> BG.CSChar -> IO ()))
+hs_bindgen_dc5eb25e2e741ab6 =
+  fmap BG.fromFFIType hs_bindgen_dc5eb25e2e741ab6_base
+
+{-# NOINLINE const_prim_before2 #-}
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2 :: BG.FunPtr (BG.CInt -> BG.CSChar -> IO ())
+const_prim_before2 =
+  BG.unsafePerformIO hs_bindgen_dc5eb25e2e741ab6
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_9718326f589a56a0" hs_bindgen_9718326f589a56a0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before3@
+hs_bindgen_9718326f589a56a0 :: IO (BG.FunPtr (BG.CInt -> BG.CUChar -> IO ()))
+hs_bindgen_9718326f589a56a0 =
+  fmap BG.fromFFIType hs_bindgen_9718326f589a56a0_base
+
+{-# NOINLINE const_prim_before3 #-}
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3 :: BG.FunPtr (BG.CInt -> BG.CUChar -> IO ())
+const_prim_before3 =
+  BG.unsafePerformIO hs_bindgen_9718326f589a56a0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_cde59c88cf7b3db3" hs_bindgen_cde59c88cf7b3db3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after1@
+hs_bindgen_cde59c88cf7b3db3 :: IO (BG.FunPtr (BG.CInt -> BG.CChar -> IO ()))
+hs_bindgen_cde59c88cf7b3db3 =
+  fmap BG.fromFFIType hs_bindgen_cde59c88cf7b3db3_base
+
+{-# NOINLINE const_prim_after1 #-}
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1 :: BG.FunPtr (BG.CInt -> BG.CChar -> IO ())
+const_prim_after1 =
+  BG.unsafePerformIO hs_bindgen_cde59c88cf7b3db3
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_d5ab011afdbef099" hs_bindgen_d5ab011afdbef099_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after2@
+hs_bindgen_d5ab011afdbef099 :: IO (BG.FunPtr (BG.CInt -> BG.CSChar -> IO ()))
+hs_bindgen_d5ab011afdbef099 =
+  fmap BG.fromFFIType hs_bindgen_d5ab011afdbef099_base
+
+{-# NOINLINE const_prim_after2 #-}
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2 :: BG.FunPtr (BG.CInt -> BG.CSChar -> IO ())
+const_prim_after2 =
+  BG.unsafePerformIO hs_bindgen_d5ab011afdbef099
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_30f31bede8bfc87c" hs_bindgen_30f31bede8bfc87c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after3@
+hs_bindgen_30f31bede8bfc87c :: IO (BG.FunPtr (BG.CInt -> BG.CUChar -> IO ()))
+hs_bindgen_30f31bede8bfc87c =
+  fmap BG.fromFFIType hs_bindgen_30f31bede8bfc87c_base
+
+{-# NOINLINE const_prim_after3 #-}
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3 :: BG.FunPtr (BG.CInt -> BG.CUChar -> IO ())
+const_prim_after3 =
+  BG.unsafePerformIO hs_bindgen_30f31bede8bfc87c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_6cc702c24ac0eeb2" hs_bindgen_6cc702c24ac0eeb2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before1@
+hs_bindgen_6cc702c24ac0eeb2 :: IO (BG.FunPtr (BG.CInt -> BG.CFloat -> IO ()))
+hs_bindgen_6cc702c24ac0eeb2 =
+  fmap BG.fromFFIType hs_bindgen_6cc702c24ac0eeb2_base
+
+{-# NOINLINE const_withoutSign_before1 #-}
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1 :: BG.FunPtr (BG.CInt -> BG.CFloat -> IO ())
+const_withoutSign_before1 =
+  BG.unsafePerformIO hs_bindgen_6cc702c24ac0eeb2
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_e77ba4a5962cc68c" hs_bindgen_e77ba4a5962cc68c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before2@
+hs_bindgen_e77ba4a5962cc68c :: IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO ()))
+hs_bindgen_e77ba4a5962cc68c =
+  fmap BG.fromFFIType hs_bindgen_e77ba4a5962cc68c_base
+
+{-# NOINLINE const_withoutSign_before2 #-}
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2 :: BG.FunPtr (BG.CInt -> BG.CDouble -> IO ())
+const_withoutSign_before2 =
+  BG.unsafePerformIO hs_bindgen_e77ba4a5962cc68c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_c4d9de5a3852ba73" hs_bindgen_c4d9de5a3852ba73_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before3@
+hs_bindgen_c4d9de5a3852ba73 :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_c4d9de5a3852ba73 =
+  fmap BG.fromFFIType hs_bindgen_c4d9de5a3852ba73_base
+
+{-# NOINLINE const_withoutSign_before3 #-}
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+const_withoutSign_before3 =
+  BG.unsafePerformIO hs_bindgen_c4d9de5a3852ba73
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_585a37cd5f43f5da" hs_bindgen_585a37cd5f43f5da_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before4@
+hs_bindgen_585a37cd5f43f5da :: IO (BG.FunPtr (BG.CInt -> Some_struct -> IO ()))
+hs_bindgen_585a37cd5f43f5da =
+  fmap BG.fromFFIType hs_bindgen_585a37cd5f43f5da_base
+
+{-# NOINLINE const_withoutSign_before4 #-}
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4 :: BG.FunPtr (BG.CInt -> Some_struct -> IO ())
+const_withoutSign_before4 =
+  BG.unsafePerformIO hs_bindgen_585a37cd5f43f5da
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_655c28dba28a9a53" hs_bindgen_655c28dba28a9a53_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before5@
+hs_bindgen_655c28dba28a9a53 :: IO (BG.FunPtr (BG.CInt -> Some_union -> IO ()))
+hs_bindgen_655c28dba28a9a53 =
+  fmap BG.fromFFIType hs_bindgen_655c28dba28a9a53_base
+
+{-# NOINLINE const_withoutSign_before5 #-}
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5 :: BG.FunPtr (BG.CInt -> Some_union -> IO ())
+const_withoutSign_before5 =
+  BG.unsafePerformIO hs_bindgen_655c28dba28a9a53
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_9e08bdc34bafeee1" hs_bindgen_9e08bdc34bafeee1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before6@
+hs_bindgen_9e08bdc34bafeee1 :: IO (BG.FunPtr (BG.CInt -> Some_enum -> IO ()))
+hs_bindgen_9e08bdc34bafeee1 =
+  fmap BG.fromFFIType hs_bindgen_9e08bdc34bafeee1_base
+
+{-# NOINLINE const_withoutSign_before6 #-}
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6 :: BG.FunPtr (BG.CInt -> Some_enum -> IO ())
+const_withoutSign_before6 =
+  BG.unsafePerformIO hs_bindgen_9e08bdc34bafeee1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_5736b6db8251bdd5" hs_bindgen_5736b6db8251bdd5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before7@
+hs_bindgen_5736b6db8251bdd5 :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_5736b6db8251bdd5 =
+  fmap BG.fromFFIType hs_bindgen_5736b6db8251bdd5_base
+
+{-# NOINLINE const_withoutSign_before7 #-}
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+const_withoutSign_before7 =
+  BG.unsafePerformIO hs_bindgen_5736b6db8251bdd5
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_c398560b654a8d9d" hs_bindgen_c398560b654a8d9d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before8@
+hs_bindgen_c398560b654a8d9d :: IO (BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_c398560b654a8d9d =
+  fmap BG.fromFFIType hs_bindgen_c398560b654a8d9d_base
+
+{-# NOINLINE const_withoutSign_before8 #-}
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8 :: BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ())
+const_withoutSign_before8 =
+  BG.unsafePerformIO hs_bindgen_c398560b654a8d9d
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_10bff078d94c8cd0" hs_bindgen_10bff078d94c8cd0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after1@
+hs_bindgen_10bff078d94c8cd0 :: IO (BG.FunPtr (BG.CInt -> BG.CFloat -> IO ()))
+hs_bindgen_10bff078d94c8cd0 =
+  fmap BG.fromFFIType hs_bindgen_10bff078d94c8cd0_base
+
+{-# NOINLINE const_withoutSign_after1 #-}
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1 :: BG.FunPtr (BG.CInt -> BG.CFloat -> IO ())
+const_withoutSign_after1 =
+  BG.unsafePerformIO hs_bindgen_10bff078d94c8cd0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_b75e6b8d1be2004b" hs_bindgen_b75e6b8d1be2004b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after2@
+hs_bindgen_b75e6b8d1be2004b :: IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO ()))
+hs_bindgen_b75e6b8d1be2004b =
+  fmap BG.fromFFIType hs_bindgen_b75e6b8d1be2004b_base
+
+{-# NOINLINE const_withoutSign_after2 #-}
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2 :: BG.FunPtr (BG.CInt -> BG.CDouble -> IO ())
+const_withoutSign_after2 =
+  BG.unsafePerformIO hs_bindgen_b75e6b8d1be2004b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_60f26b5a2f8cf394" hs_bindgen_60f26b5a2f8cf394_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after3@
+hs_bindgen_60f26b5a2f8cf394 :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_60f26b5a2f8cf394 =
+  fmap BG.fromFFIType hs_bindgen_60f26b5a2f8cf394_base
+
+{-# NOINLINE const_withoutSign_after3 #-}
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+const_withoutSign_after3 =
+  BG.unsafePerformIO hs_bindgen_60f26b5a2f8cf394
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_0503ec9e78e10edf" hs_bindgen_0503ec9e78e10edf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after4@
+hs_bindgen_0503ec9e78e10edf :: IO (BG.FunPtr (BG.CInt -> Some_struct -> IO ()))
+hs_bindgen_0503ec9e78e10edf =
+  fmap BG.fromFFIType hs_bindgen_0503ec9e78e10edf_base
+
+{-# NOINLINE const_withoutSign_after4 #-}
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4 :: BG.FunPtr (BG.CInt -> Some_struct -> IO ())
+const_withoutSign_after4 =
+  BG.unsafePerformIO hs_bindgen_0503ec9e78e10edf
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_1657dae083620adf" hs_bindgen_1657dae083620adf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after5@
+hs_bindgen_1657dae083620adf :: IO (BG.FunPtr (BG.CInt -> Some_union -> IO ()))
+hs_bindgen_1657dae083620adf =
+  fmap BG.fromFFIType hs_bindgen_1657dae083620adf_base
+
+{-# NOINLINE const_withoutSign_after5 #-}
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5 :: BG.FunPtr (BG.CInt -> Some_union -> IO ())
+const_withoutSign_after5 =
+  BG.unsafePerformIO hs_bindgen_1657dae083620adf
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_44c293b62ff2015d" hs_bindgen_44c293b62ff2015d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after6@
+hs_bindgen_44c293b62ff2015d :: IO (BG.FunPtr (BG.CInt -> Some_enum -> IO ()))
+hs_bindgen_44c293b62ff2015d =
+  fmap BG.fromFFIType hs_bindgen_44c293b62ff2015d_base
+
+{-# NOINLINE const_withoutSign_after6 #-}
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6 :: BG.FunPtr (BG.CInt -> Some_enum -> IO ())
+const_withoutSign_after6 =
+  BG.unsafePerformIO hs_bindgen_44c293b62ff2015d
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_ed406d5edbd28ec1" hs_bindgen_ed406d5edbd28ec1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after7@
+hs_bindgen_ed406d5edbd28ec1 :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_ed406d5edbd28ec1 =
+  fmap BG.fromFFIType hs_bindgen_ed406d5edbd28ec1_base
+
+{-# NOINLINE const_withoutSign_after7 #-}
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+const_withoutSign_after7 =
+  BG.unsafePerformIO hs_bindgen_ed406d5edbd28ec1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_2cca685d1adca496" hs_bindgen_2cca685d1adca496_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after8@
+hs_bindgen_2cca685d1adca496 :: IO (BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_2cca685d1adca496 =
+  fmap BG.fromFFIType hs_bindgen_2cca685d1adca496_base
+
+{-# NOINLINE const_withoutSign_after8 #-}
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8 :: BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ())
+const_withoutSign_after8 =
+  BG.unsafePerformIO hs_bindgen_2cca685d1adca496
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_5da738696e5beb04" hs_bindgen_5da738696e5beb04_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args1@
+hs_bindgen_5da738696e5beb04 :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_5da738696e5beb04 =
+  fmap BG.fromFFIType hs_bindgen_5da738696e5beb04_base
+
+{-# NOINLINE const_pointers_args1 #-}
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1 :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args1 =
+  BG.unsafePerformIO hs_bindgen_5da738696e5beb04
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_783634f682149eb7" hs_bindgen_783634f682149eb7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args2@
+hs_bindgen_783634f682149eb7 :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_783634f682149eb7 =
+  fmap BG.fromFFIType hs_bindgen_783634f682149eb7_base
+
+{-# NOINLINE const_pointers_args2 #-}
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2 :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args2 =
+  BG.unsafePerformIO hs_bindgen_783634f682149eb7
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_e8c26ca0eb024ce8" hs_bindgen_e8c26ca0eb024ce8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args3@
+hs_bindgen_e8c26ca0eb024ce8 :: IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> IO ()))
+hs_bindgen_e8c26ca0eb024ce8 =
+  fmap BG.fromFFIType hs_bindgen_e8c26ca0eb024ce8_base
+
+{-# NOINLINE const_pointers_args3 #-}
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3 :: BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> IO ())
+const_pointers_args3 =
+  BG.unsafePerformIO hs_bindgen_e8c26ca0eb024ce8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_21e206a694593eb1" hs_bindgen_21e206a694593eb1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args4@
+hs_bindgen_21e206a694593eb1 :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_21e206a694593eb1 =
+  fmap BG.fromFFIType hs_bindgen_21e206a694593eb1_base
+
+{-# NOINLINE const_pointers_args4 #-}
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4 :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args4 =
+  BG.unsafePerformIO hs_bindgen_21e206a694593eb1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_cc3a8f368db00421" hs_bindgen_cc3a8f368db00421_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args5@
+hs_bindgen_cc3a8f368db00421 :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_cc3a8f368db00421 =
+  fmap BG.fromFFIType hs_bindgen_cc3a8f368db00421_base
+
+{-# NOINLINE const_pointers_args5 #-}
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5 :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args5 =
+  BG.unsafePerformIO hs_bindgen_cc3a8f368db00421
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_a9979680c0124010" hs_bindgen_a9979680c0124010_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret1@
+hs_bindgen_a9979680c0124010 :: IO (BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_a9979680c0124010 =
+  fmap BG.fromFFIType hs_bindgen_a9979680c0124010_base
+
+{-# NOINLINE const_pointers_ret1 #-}
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1 :: BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret1 =
+  BG.unsafePerformIO hs_bindgen_a9979680c0124010
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_c865f82ab69a4a3e" hs_bindgen_c865f82ab69a4a3e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret2@
+hs_bindgen_c865f82ab69a4a3e :: IO (BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_c865f82ab69a4a3e =
+  fmap BG.fromFFIType hs_bindgen_c865f82ab69a4a3e_base
+
+{-# NOINLINE const_pointers_ret2 #-}
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2 :: BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret2 =
+  BG.unsafePerformIO hs_bindgen_c865f82ab69a4a3e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_61570ab40d22e404" hs_bindgen_61570ab40d22e404_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret3@
+hs_bindgen_61570ab40d22e404 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_61570ab40d22e404 =
+  fmap BG.fromFFIType hs_bindgen_61570ab40d22e404_base
+
+{-# NOINLINE const_pointers_ret3 #-}
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+const_pointers_ret3 =
+  BG.unsafePerformIO hs_bindgen_61570ab40d22e404
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_7d02f676d3a68181" hs_bindgen_7d02f676d3a68181_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret4@
+hs_bindgen_7d02f676d3a68181 :: IO (BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_7d02f676d3a68181 =
+  fmap BG.fromFFIType hs_bindgen_7d02f676d3a68181_base
+
+{-# NOINLINE const_pointers_ret4 #-}
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4 :: BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret4 =
+  BG.unsafePerformIO hs_bindgen_7d02f676d3a68181
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_3a389377331b29b9" hs_bindgen_3a389377331b29b9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret5@
+hs_bindgen_3a389377331b29b9 :: IO (BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_3a389377331b29b9 =
+  fmap BG.fromFFIType hs_bindgen_3a389377331b29b9_base
+
+{-# NOINLINE const_pointers_ret5 #-}
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5 :: BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret5 =
+  BG.unsafePerformIO hs_bindgen_3a389377331b29b9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_4810bd323f24b8d0" hs_bindgen_4810bd323f24b8d0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem1@
+hs_bindgen_4810bd323f24b8d0 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ()))
+hs_bindgen_4810bd323f24b8d0 =
+  fmap BG.fromFFIType hs_bindgen_4810bd323f24b8d0_base
+
+{-# NOINLINE const_array_elem1 #-}
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1 :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ())
+const_array_elem1 =
+  BG.unsafePerformIO hs_bindgen_4810bd323f24b8d0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_8bed93eafa056c5e" hs_bindgen_8bed93eafa056c5e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem2@
+hs_bindgen_8bed93eafa056c5e :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt))) -> IO ()))
+hs_bindgen_8bed93eafa056c5e =
+  fmap BG.fromFFIType hs_bindgen_8bed93eafa056c5e_base
+
+{-# NOINLINE const_array_elem2 #-}
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt))) -> IO ())
+const_array_elem2 =
+  BG.unsafePerformIO hs_bindgen_8bed93eafa056c5e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_c569d0da33bf00e3" hs_bindgen_c569d0da33bf00e3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem3@
+hs_bindgen_c569d0da33bf00e3 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt))) -> IO ()))
+hs_bindgen_c569d0da33bf00e3 =
+  fmap BG.fromFFIType hs_bindgen_c569d0da33bf00e3_base
+
+{-# NOINLINE const_array_elem3 #-}
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3 :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt))) -> IO ())
+const_array_elem3 =
+  BG.unsafePerformIO hs_bindgen_c569d0da33bf00e3
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams1@
+foreign import ccall unsafe "hs_bindgen_91d4c9002424f82d" hs_bindgen_91d4c9002424f82d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams1@
+hs_bindgen_91d4c9002424f82d :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_91d4c9002424f82d =
+  fmap BG.fromFFIType hs_bindgen_91d4c9002424f82d_base
+
+{-# NOINLINE noParams1 #-}
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1 :: BG.FunPtr (IO BG.CInt)
+noParams1 =
+  BG.unsafePerformIO hs_bindgen_91d4c9002424f82d
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams2@
+foreign import ccall unsafe "hs_bindgen_a317809988dfeb84" hs_bindgen_a317809988dfeb84_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams2@
+hs_bindgen_a317809988dfeb84 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_a317809988dfeb84 =
+  fmap BG.fromFFIType hs_bindgen_a317809988dfeb84_base
+
+{-# NOINLINE noParams2 #-}
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2 :: BG.FunPtr (IO BG.CInt)
+noParams2 =
+  BG.unsafePerformIO hs_bindgen_a317809988dfeb84
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams3@
+foreign import ccall unsafe "hs_bindgen_c23ef724e4f315be" hs_bindgen_c23ef724e4f315be_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams3@
+hs_bindgen_c23ef724e4f315be :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (IO BG.CInt) -> IO ()))
+hs_bindgen_c23ef724e4f315be =
+  fmap BG.fromFFIType hs_bindgen_c23ef724e4f315be_base
+
+{-# NOINLINE noParams3 #-}
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3 :: BG.FunPtr (BG.CInt -> BG.FunPtr (IO BG.CInt) -> IO ())
+noParams3 =
+  BG.unsafePerformIO hs_bindgen_c23ef724e4f315be
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_660d89308b2b5a69" hs_bindgen_660d89308b2b5a69_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret1@
+hs_bindgen_660d89308b2b5a69 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (IO ()))))
+hs_bindgen_660d89308b2b5a69 =
+  fmap BG.fromFFIType hs_bindgen_660d89308b2b5a69_base
+
+{-# NOINLINE funptr_ret1 #-}
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (IO ())))
+funptr_ret1 =
+  BG.unsafePerformIO hs_bindgen_660d89308b2b5a69
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_bc7009eeb6b86418" hs_bindgen_bc7009eeb6b86418_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret2@
+hs_bindgen_bc7009eeb6b86418 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (IO BG.CInt))))
+hs_bindgen_bc7009eeb6b86418 =
+  fmap BG.fromFFIType hs_bindgen_bc7009eeb6b86418_base
+
+{-# NOINLINE funptr_ret2 #-}
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (IO BG.CInt)))
+funptr_ret2 =
+  BG.unsafePerformIO hs_bindgen_bc7009eeb6b86418
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_565629b4e4c20a7e" hs_bindgen_565629b4e4c20a7e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret3@
+hs_bindgen_565629b4e4c20a7e :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> IO ()))))
+hs_bindgen_565629b4e4c20a7e =
+  fmap BG.fromFFIType hs_bindgen_565629b4e4c20a7e_base
+
+{-# NOINLINE funptr_ret3 #-}
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> IO ())))
+funptr_ret3 =
+  BG.unsafePerformIO hs_bindgen_565629b4e4c20a7e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_3563760f061700c9" hs_bindgen_3563760f061700c9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret4@
+hs_bindgen_3563760f061700c9 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))))
+hs_bindgen_3563760f061700c9 =
+  fmap BG.fromFFIType hs_bindgen_3563760f061700c9_base
+
+{-# NOINLINE funptr_ret4 #-}
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)))
+funptr_ret4 =
+  BG.unsafePerformIO hs_bindgen_3563760f061700c9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_65c114a912faa4d1" hs_bindgen_65c114a912faa4d1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret5@
+hs_bindgen_65c114a912faa4d1 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))))
+hs_bindgen_65c114a912faa4d1 =
+  fmap BG.fromFFIType hs_bindgen_65c114a912faa4d1_base
+
+{-# NOINLINE funptr_ret5 #-}
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))))
+funptr_ret5 =
+  BG.unsafePerformIO hs_bindgen_65c114a912faa4d1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_13dce2f12ceb5ef5" hs_bindgen_13dce2f12ceb5ef5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret6@
+hs_bindgen_13dce2f12ceb5ef5 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_13dce2f12ceb5ef5 =
+  fmap BG.fromFFIType hs_bindgen_13dce2f12ceb5ef5_base
+
+{-# NOINLINE funptr_ret6 #-}
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret6 =
+  BG.unsafePerformIO hs_bindgen_13dce2f12ceb5ef5
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_e69f4bc4bd10259c" hs_bindgen_e69f4bc4bd10259c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret7@
+hs_bindgen_e69f4bc4bd10259c :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_e69f4bc4bd10259c =
+  fmap BG.fromFFIType hs_bindgen_e69f4bc4bd10259c_base
+
+{-# NOINLINE funptr_ret7 #-}
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret7 =
+  BG.unsafePerformIO hs_bindgen_e69f4bc4bd10259c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_f06ecca1a94b60e8" hs_bindgen_f06ecca1a94b60e8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret8@
+hs_bindgen_f06ecca1a94b60e8 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))))
+hs_bindgen_f06ecca1a94b60e8 =
+  fmap BG.fromFFIType hs_bindgen_f06ecca1a94b60e8_base
+
+{-# NOINLINE funptr_ret8 #-}
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))))
+funptr_ret8 =
+  BG.unsafePerformIO hs_bindgen_f06ecca1a94b60e8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_65e9b457479db3fb" hs_bindgen_65e9b457479db3fb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret9@
+hs_bindgen_65e9b457479db3fb :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_65e9b457479db3fb =
+  fmap BG.fromFFIType hs_bindgen_65e9b457479db3fb_base
+
+{-# NOINLINE funptr_ret9 #-}
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret9 =
+  BG.unsafePerformIO hs_bindgen_65e9b457479db3fb
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_b5fb601528eabcdb" hs_bindgen_b5fb601528eabcdb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret10@
+hs_bindgen_b5fb601528eabcdb :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_b5fb601528eabcdb =
+  fmap BG.fromFFIType hs_bindgen_b5fb601528eabcdb_base
+
+{-# NOINLINE funptr_ret10 #-}
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret10 =
+  BG.unsafePerformIO hs_bindgen_b5fb601528eabcdb
diff --git a/test-artefacts/fixtures/macros/reparse.1.empty/Example/Global.hs b/test-artefacts/fixtures/macros/reparse.1.empty/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.1.empty/Example/Global.hs
@@ -0,0 +1,202 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.global1
+    , Example.Global.global2
+    , Example.Global.global3
+    , Example.Global.const1
+    , Example.Global.const2
+    , Example.Global.const3
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "/* test_macrosreparse_1_empty_Example_get_global1 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_c2929de3db3ebc68 (void)"
+  , "{"
+  , "  return &global1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_global2 */"
+  , "__attribute__ ((const))"
+  , "signed int **hs_bindgen_b642618eb14a88bf (void)"
+  , "{"
+  , "  return &global2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_global3 */"
+  , "__attribute__ ((const))"
+  , "signed int ***hs_bindgen_37e22dedff20b0fa (void)"
+  , "{"
+  , "  return &global3;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const1 */"
+  , "__attribute__ ((const))"
+  , "signed int const *hs_bindgen_f54afb44a4459d9c (void)"
+  , "{"
+  , "  return &const1;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const2 */"
+  , "__attribute__ ((const))"
+  , "signed int *const *hs_bindgen_139264d86115f755 (void)"
+  , "{"
+  , "  return &const2;"
+  , "}"
+  , "/* test_macrosreparse_1_empty_Example_get_const3 */"
+  , "__attribute__ ((const))"
+  , "signed int **const *hs_bindgen_a13825d736275018 (void)"
+  , "{"
+  , "  return &const3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global1@
+foreign import ccall unsafe "hs_bindgen_c2929de3db3ebc68" hs_bindgen_c2929de3db3ebc68_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global1@
+hs_bindgen_c2929de3db3ebc68 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_c2929de3db3ebc68 =
+  fmap BG.fromFFIType hs_bindgen_c2929de3db3ebc68_base
+
+{-# NOINLINE global1 #-}
+{-| Globals and constants
+
+    __C declaration:__ @global1@
+
+    __defined at:__ @macros\/reparse.h 161:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global1 :: BG.Ptr BG.CInt
+global1 =
+  BG.unsafePerformIO hs_bindgen_c2929de3db3ebc68
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global2@
+foreign import ccall unsafe "hs_bindgen_b642618eb14a88bf" hs_bindgen_b642618eb14a88bf_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global2@
+hs_bindgen_b642618eb14a88bf :: IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_b642618eb14a88bf =
+  fmap BG.fromFFIType hs_bindgen_b642618eb14a88bf_base
+
+{-# NOINLINE global2 #-}
+{-| __C declaration:__ @global2@
+
+    __defined at:__ @macros\/reparse.h 162:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global2 :: BG.Ptr (BG.Ptr BG.CInt)
+global2 =
+  BG.unsafePerformIO hs_bindgen_b642618eb14a88bf
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global3@
+foreign import ccall unsafe "hs_bindgen_37e22dedff20b0fa" hs_bindgen_37e22dedff20b0fa_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global3@
+hs_bindgen_37e22dedff20b0fa :: IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+hs_bindgen_37e22dedff20b0fa =
+  fmap BG.fromFFIType hs_bindgen_37e22dedff20b0fa_base
+
+{-# NOINLINE global3 #-}
+{-| __C declaration:__ @global3@
+
+    __defined at:__ @macros\/reparse.h 163:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global3 :: BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))
+global3 =
+  BG.unsafePerformIO hs_bindgen_37e22dedff20b0fa
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const1@
+foreign import ccall unsafe "hs_bindgen_f54afb44a4459d9c" hs_bindgen_f54afb44a4459d9c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const1@
+hs_bindgen_f54afb44a4459d9c :: IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_f54afb44a4459d9c =
+  fmap BG.fromFFIType hs_bindgen_f54afb44a4459d9c_base
+
+{-# NOINLINE hs_bindgen_c9e1c2f1b5f1a18b #-}
+{-| __C declaration:__ @const1@
+
+    __defined at:__ @macros\/reparse.h 165:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_1_empty_Example_const1@
+-}
+hs_bindgen_c9e1c2f1b5f1a18b :: PtrConst.PtrConst BG.CInt
+hs_bindgen_c9e1c2f1b5f1a18b =
+  BG.unsafePerformIO hs_bindgen_f54afb44a4459d9c
+
+{-# NOINLINE const1 #-}
+const1 :: BG.CInt
+const1 =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_c9e1c2f1b5f1a18b)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const2@
+foreign import ccall unsafe "hs_bindgen_139264d86115f755" hs_bindgen_139264d86115f755_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const2@
+hs_bindgen_139264d86115f755 :: IO (PtrConst.PtrConst (BG.Ptr BG.CInt))
+hs_bindgen_139264d86115f755 =
+  fmap BG.fromFFIType hs_bindgen_139264d86115f755_base
+
+{-# NOINLINE hs_bindgen_e27452ffe7a65d32 #-}
+{-| __C declaration:__ @const2@
+
+    __defined at:__ @macros\/reparse.h 166:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_1_empty_Example_const2@
+-}
+hs_bindgen_e27452ffe7a65d32 :: PtrConst.PtrConst (BG.Ptr BG.CInt)
+hs_bindgen_e27452ffe7a65d32 =
+  BG.unsafePerformIO hs_bindgen_139264d86115f755
+
+{-# NOINLINE const2 #-}
+const2 :: BG.Ptr BG.CInt
+const2 =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_e27452ffe7a65d32)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const3@
+foreign import ccall unsafe "hs_bindgen_a13825d736275018" hs_bindgen_a13825d736275018_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const3@
+hs_bindgen_a13825d736275018 :: IO (PtrConst.PtrConst (BG.Ptr (BG.Ptr BG.CInt)))
+hs_bindgen_a13825d736275018 =
+  fmap BG.fromFFIType hs_bindgen_a13825d736275018_base
+
+{-# NOINLINE hs_bindgen_217857747c06d0ce #-}
+{-| __C declaration:__ @const3@
+
+    __defined at:__ @macros\/reparse.h 167:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_1_empty_Example_const3@
+-}
+hs_bindgen_217857747c06d0ce :: PtrConst.PtrConst (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_217857747c06d0ce =
+  BG.unsafePerformIO hs_bindgen_a13825d736275018
+
+{-# NOINLINE const3 #-}
+const3 :: BG.Ptr (BG.Ptr BG.CInt)
+const3 =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_217857747c06d0ce)
diff --git a/test-artefacts/fixtures/macros/reparse.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.1.empty/Example/Safe.hs
@@ -0,0 +1,4006 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.args_char1
+    , Example.Safe.args_char2
+    , Example.Safe.args_char3
+    , Example.Safe.args_short1
+    , Example.Safe.args_short2
+    , Example.Safe.args_short3
+    , Example.Safe.args_int1
+    , Example.Safe.args_int2
+    , Example.Safe.args_int3
+    , Example.Safe.args_long1
+    , Example.Safe.args_long2
+    , Example.Safe.args_long3
+    , Example.Safe.args_float
+    , Example.Safe.args_double
+    , Example.Safe.args_bool1
+    , Example.Safe.args_struct
+    , Example.Safe.args_union
+    , Example.Safe.args_enum
+    , Example.Safe.args_pointer1
+    , Example.Safe.args_pointer2
+    , Example.Safe.args_pointer3
+    , Example.Safe.ret_A
+    , Example.Safe.ret_char1
+    , Example.Safe.ret_char2
+    , Example.Safe.ret_char3
+    , Example.Safe.ret_short1
+    , Example.Safe.ret_short2
+    , Example.Safe.ret_short3
+    , Example.Safe.ret_int1
+    , Example.Safe.ret_int2
+    , Example.Safe.ret_int3
+    , Example.Safe.ret_long1
+    , Example.Safe.ret_long2
+    , Example.Safe.ret_long3
+    , Example.Safe.ret_float
+    , Example.Safe.ret_double
+    , Example.Safe.ret_bool1
+    , Example.Safe.ret_struct
+    , Example.Safe.ret_union
+    , Example.Safe.ret_enum
+    , Example.Safe.ret_pointer1
+    , Example.Safe.ret_pointer2
+    , Example.Safe.ret_pointer3
+    , Example.Safe.body1
+    , Example.Safe.body2
+    , Example.Safe.args_complex_float
+    , Example.Safe.args_complex_double
+    , Example.Safe.ret_complex_float
+    , Example.Safe.ret_complex_double
+    , Example.Safe.bespoke_args1
+    , Example.Safe.bespoke_args2
+    , Example.Safe.bespoke_ret1
+    , Example.Safe.bespoke_ret2
+    , Example.Safe.arr_args1
+    , Example.Safe.arr_args2
+    , Example.Safe.arr_args3
+    , Example.Safe.arr_args4
+    , Example.Safe.funptr_args1
+    , Example.Safe.funptr_args2
+    , Example.Safe.funptr_args3
+    , Example.Safe.funptr_args4
+    , Example.Safe.funptr_args5
+    , Example.Safe.comments1
+    , Example.Safe.const_prim_before1
+    , Example.Safe.const_prim_before2
+    , Example.Safe.const_prim_before3
+    , Example.Safe.const_prim_after1
+    , Example.Safe.const_prim_after2
+    , Example.Safe.const_prim_after3
+    , Example.Safe.const_withoutSign_before1
+    , Example.Safe.const_withoutSign_before2
+    , Example.Safe.const_withoutSign_before3
+    , Example.Safe.const_withoutSign_before4
+    , Example.Safe.const_withoutSign_before5
+    , Example.Safe.const_withoutSign_before6
+    , Example.Safe.const_withoutSign_before7
+    , Example.Safe.const_withoutSign_before8
+    , Example.Safe.const_withoutSign_after1
+    , Example.Safe.const_withoutSign_after2
+    , Example.Safe.const_withoutSign_after3
+    , Example.Safe.const_withoutSign_after4
+    , Example.Safe.const_withoutSign_after5
+    , Example.Safe.const_withoutSign_after6
+    , Example.Safe.const_withoutSign_after7
+    , Example.Safe.const_withoutSign_after8
+    , Example.Safe.const_pointers_args1
+    , Example.Safe.const_pointers_args2
+    , Example.Safe.const_pointers_args3
+    , Example.Safe.const_pointers_args4
+    , Example.Safe.const_pointers_args5
+    , Example.Safe.const_pointers_ret1
+    , Example.Safe.const_pointers_ret2
+    , Example.Safe.const_pointers_ret3
+    , Example.Safe.const_pointers_ret4
+    , Example.Safe.const_pointers_ret5
+    , Example.Safe.const_array_elem1
+    , Example.Safe.const_array_elem2
+    , Example.Safe.const_array_elem3
+    , Example.Safe.noParams1
+    , Example.Safe.noParams2
+    , Example.Safe.noParams3
+    , Example.Safe.funptr_ret1
+    , Example.Safe.funptr_ret2
+    , Example.Safe.funptr_ret3
+    , Example.Safe.funptr_ret4
+    , Example.Safe.funptr_ret5
+    , Example.Safe.funptr_ret6
+    , Example.Safe.funptr_ret7
+    , Example.Safe.funptr_ret8
+    , Example.Safe.funptr_ret9
+    , Example.Safe.funptr_ret10
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "void hs_bindgen_9950741591b35cb0 ("
+  , "  signed int arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (args_char1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3b213f36de64a78b ("
+  , "  signed int arg1,"
+  , "  signed char arg2"
+  , ")"
+  , "{"
+  , "  (args_char2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d72da53837273ed1 ("
+  , "  signed int arg1,"
+  , "  unsigned char arg2"
+  , ")"
+  , "{"
+  , "  (args_char3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_8e00ad94407efdce ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e5814201b232d64c ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3bbb21d02f9e8caa ("
+  , "  signed int arg1,"
+  , "  unsigned short arg2"
+  , ")"
+  , "{"
+  , "  (args_short3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_fba8d44819fb4d50 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_42cfc5afda432a51 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b877c77021f548cb ("
+  , "  signed int arg1,"
+  , "  unsigned int arg2"
+  , ")"
+  , "{"
+  , "  (args_int3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_365ed0d5f00ece62 ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a1204b1083b6700a ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4af0668f1653ce01 ("
+  , "  signed int arg1,"
+  , "  unsigned long arg2"
+  , ")"
+  , "{"
+  , "  (args_long3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b8acf83f3c3a43b0 ("
+  , "  signed int arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  (args_float)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2a27bb82268cc870 ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  (args_double)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3f1481ac913e0394 ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (args_bool1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_998092a62cba613e ("
+  , "  signed int arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  (args_struct)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_b83fe7017c88f63e ("
+  , "  signed int arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  (args_union)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_45ef9d5579ceaa74 ("
+  , "  signed int arg1,"
+  , "  enum some_enum arg2"
+  , ")"
+  , "{"
+  , "  (args_enum)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_862d74c6849bbcd0 ("
+  , "  signed int arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0df09844c5645db9 ("
+  , "  signed int arg1,"
+  , "  signed int **arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_221cb5a1c4ce6a3b ("
+  , "  signed int arg1,"
+  , "  void *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer3)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_dfd4e13321b706b1 (void)"
+  , "{"
+  , "  return (ret_A)();"
+  , "}"
+  , "char hs_bindgen_5289300b6ae3ff51 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char1)(arg1);"
+  , "}"
+  , "signed char hs_bindgen_b258f6c4e2c9be38 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char2)(arg1);"
+  , "}"
+  , "unsigned char hs_bindgen_734b5b749255713a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char3)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_d17d4780d98d2561 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short1)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_1f808a3cec3781e1 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short2)(arg1);"
+  , "}"
+  , "unsigned short hs_bindgen_5204d0272f75f1a2 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_14351eeb2c92732a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f91baafc096613a0 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int2)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_e78391249ef8ffbf ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int3)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_4f8ae7ed648c72e4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long1)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_c0a47369a5a10695 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long2)(arg1);"
+  , "}"
+  , "unsigned long hs_bindgen_64aa36b6c820a3bf ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long3)(arg1);"
+  , "}"
+  , "float hs_bindgen_b53c45aaccbaaf3a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_float)(arg1);"
+  , "}"
+  , "double hs_bindgen_0ca050f5bbe69c94 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_double)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_530e0725cadf8f52 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_bool1)(arg1);"
+  , "}"
+  , "void hs_bindgen_8f19d5621a4f3e92 ("
+  , "  signed int arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_struct)(arg1);"
+  , "}"
+  , "void hs_bindgen_e93cfabcefb5051b ("
+  , "  signed int arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_union)(arg1);"
+  , "}"
+  , "enum some_enum hs_bindgen_f672d8d1020b037f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_enum)(arg1);"
+  , "}"
+  , "signed int *hs_bindgen_1b0ed1f4c7ddeb1e ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer1)(arg1);"
+  , "}"
+  , "signed int **hs_bindgen_46ff1f39be014f9f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer2)(arg1);"
+  , "}"
+  , "void *hs_bindgen_c4737a52f27dfdac ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_fdef71f6bc647af6 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (body1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4ebf4e201327a21a (void)"
+  , "{"
+  , "  return (body2)();"
+  , "}"
+  , "void hs_bindgen_7229e893bab43698 ("
+  , "  signed int arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_float)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_0cbb6cfd403656ec ("
+  , "  signed int arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_double)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_7fa01b9c64606663 ("
+  , "  signed int arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_float)(arg1);"
+  , "}"
+  , "void hs_bindgen_81ad2d3ffe70c3a9 ("
+  , "  signed int arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_double)(arg1);"
+  , "}"
+  , "void hs_bindgen_1c3c1f6f6a7e2bc8 ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a5e6d8b6d973331f ("
+  , "  signed int arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args2)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_0f143bde59bade44 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret1)(arg1);"
+  , "}"
+  , "size_t hs_bindgen_3fe674df63c48d30 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret2)(arg1);"
+  , "}"
+  , "void hs_bindgen_a8eaeaa944a099d9 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args1)(arg1);"
+  , "}"
+  , "void hs_bindgen_f928df06f2f528e0 ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args2)(arg1);"
+  , "}"
+  , "void hs_bindgen_2fb2e9d0563a690b ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args3)(arg1);"
+  , "}"
+  , "void hs_bindgen_b9b529def42c1efd ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args4)(arg1);"
+  , "}"
+  , "void hs_bindgen_5ab0516185b48906 ("
+  , "  signed int arg1,"
+  , "  void (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_682810b65a83f101 ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a06192a621a12016 ("
+  , "  signed int arg1,"
+  , "  void (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_414fd8b92ff2611b ("
+  , "  signed int arg1,"
+  , "  char (*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_62b477fc0c092e32 ("
+  , "  signed int arg1,"
+  , "  signed int *(*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args5)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_17fb56aae1527722 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (comments1)(arg1);"
+  , "}"
+  , "void hs_bindgen_e70333f7108e59a8 ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_14a503cc3e41e014 ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_504ad9cb98a4f946 ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c0c67bf5b144c658 ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_72fa51e2c7023b88 ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b09c2805c508fddf ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_85bf325f09491972 ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_45a61f720b0fe2ed ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_36c611aa17d28531 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a614ed967b401309 ("
+  , "  signed int arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_0e258c684851b84f ("
+  , "  signed int arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_9f7d70e8a0106516 ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0b71a82a5fa4fc87 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7ebb88bce2abdf74 ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7188d6a351cf7dd5 ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_bd2e5fd19a5f4d84 ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ab0f4d2e36402e2f ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d4fdffd51b526049 ("
+  , "  signed int arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_662a5811d33311fd ("
+  , "  signed int arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_6755aa8f356d9bb1 ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_38694a08d2a7599a ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_44cd79114d322610 ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_30969f0e26032752 ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_35235928bc01e390 ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9853f1c7b6472022 ("
+  , "  signed int arg1,"
+  , "  signed int *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e3b1d92f43d9cda7 ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b4a0d9b232b8ee87 ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args5)(arg1, arg2);"
+  , "}"
+  , "signed int const *hs_bindgen_ce61a185fdbd1b5e ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret1)(arg1);"
+  , "}"
+  , "signed int const *hs_bindgen_001714607a85bf44 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret2)(arg1);"
+  , "}"
+  , "signed int *const hs_bindgen_0481dd02a7bda0cb ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret3)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_2b32282230882c4f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret4)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_094656d98097f48e ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret5)(arg1);"
+  , "}"
+  , "void hs_bindgen_5f2909e0d90b7530 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem1)(arg1);"
+  , "}"
+  , "void hs_bindgen_a9a1c34158c32e13 ("
+  , "  signed int const **arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem2)(arg1);"
+  , "}"
+  , "void hs_bindgen_55765da8c98676da ("
+  , "  signed int *const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_2692ad6e69dd9bf6 (void)"
+  , "{"
+  , "  return (noParams1)();"
+  , "}"
+  , "signed int hs_bindgen_b016e4354ee966d9 (void)"
+  , "{"
+  , "  return (noParams2)();"
+  , "}"
+  , "void hs_bindgen_9a5fca17446c0b64 ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (noParams3)(arg1, arg2);"
+  , "}"
+  , "void (*hs_bindgen_e0ae2ea8372de864 ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_105cd0216456de95 ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret2)(arg1);"
+  , "}"
+  , "void (*hs_bindgen_2d7d8cfa71504d88 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (funptr_ret3)(arg1);"
+  , "}"
+  , "char (*hs_bindgen_46f0ed4c8295ba70 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret4)(arg1);"
+  , "}"
+  , "signed int *(*hs_bindgen_f8291bd691623354 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret5)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_2eb8ef0a6794c225 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret6)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_8cc60b45c83cb72b ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret7)(arg1);"
+  , "}"
+  , "signed int *const (*hs_bindgen_2ad075d6ca6beea5 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret8)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_fe5e863d48f781be ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret9)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_2a029ddc00ba6ce1 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret10)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char1@
+foreign import ccall safe "hs_bindgen_9950741591b35cb0" hs_bindgen_9950741591b35cb0_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char1@
+hs_bindgen_9950741591b35cb0 ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_9950741591b35cb0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9950741591b35cb0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char1 = hs_bindgen_9950741591b35cb0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char2@
+foreign import ccall safe "hs_bindgen_3b213f36de64a78b" hs_bindgen_3b213f36de64a78b_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char2@
+hs_bindgen_3b213f36de64a78b ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_3b213f36de64a78b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3b213f36de64a78b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char2 = hs_bindgen_3b213f36de64a78b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char3@
+foreign import ccall safe "hs_bindgen_d72da53837273ed1" hs_bindgen_d72da53837273ed1_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char3@
+hs_bindgen_d72da53837273ed1 ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_d72da53837273ed1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d72da53837273ed1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char3 = hs_bindgen_d72da53837273ed1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short1@
+foreign import ccall safe "hs_bindgen_8e00ad94407efdce" hs_bindgen_8e00ad94407efdce_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short1@
+hs_bindgen_8e00ad94407efdce ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_8e00ad94407efdce =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8e00ad94407efdce_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short1 = hs_bindgen_8e00ad94407efdce
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short2@
+foreign import ccall safe "hs_bindgen_e5814201b232d64c" hs_bindgen_e5814201b232d64c_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short2@
+hs_bindgen_e5814201b232d64c ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_e5814201b232d64c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e5814201b232d64c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short2 = hs_bindgen_e5814201b232d64c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short3@
+foreign import ccall safe "hs_bindgen_3bbb21d02f9e8caa" hs_bindgen_3bbb21d02f9e8caa_base ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short3@
+hs_bindgen_3bbb21d02f9e8caa ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+hs_bindgen_3bbb21d02f9e8caa =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3bbb21d02f9e8caa_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short3 = hs_bindgen_3bbb21d02f9e8caa
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int1@
+foreign import ccall safe "hs_bindgen_fba8d44819fb4d50" hs_bindgen_fba8d44819fb4d50_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int1@
+hs_bindgen_fba8d44819fb4d50 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_fba8d44819fb4d50 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_fba8d44819fb4d50_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int1 = hs_bindgen_fba8d44819fb4d50
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int2@
+foreign import ccall safe "hs_bindgen_42cfc5afda432a51" hs_bindgen_42cfc5afda432a51_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int2@
+hs_bindgen_42cfc5afda432a51 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_42cfc5afda432a51 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_42cfc5afda432a51_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int2 = hs_bindgen_42cfc5afda432a51
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int3@
+foreign import ccall safe "hs_bindgen_b877c77021f548cb" hs_bindgen_b877c77021f548cb_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int3@
+hs_bindgen_b877c77021f548cb ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+hs_bindgen_b877c77021f548cb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b877c77021f548cb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int3 = hs_bindgen_b877c77021f548cb
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long1@
+foreign import ccall safe "hs_bindgen_365ed0d5f00ece62" hs_bindgen_365ed0d5f00ece62_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long1@
+hs_bindgen_365ed0d5f00ece62 ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_365ed0d5f00ece62 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_365ed0d5f00ece62_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long1 = hs_bindgen_365ed0d5f00ece62
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long2@
+foreign import ccall safe "hs_bindgen_a1204b1083b6700a" hs_bindgen_a1204b1083b6700a_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long2@
+hs_bindgen_a1204b1083b6700a ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_a1204b1083b6700a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a1204b1083b6700a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long2 = hs_bindgen_a1204b1083b6700a
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long3@
+foreign import ccall safe "hs_bindgen_4af0668f1653ce01" hs_bindgen_4af0668f1653ce01_base ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long3@
+hs_bindgen_4af0668f1653ce01 ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+hs_bindgen_4af0668f1653ce01 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4af0668f1653ce01_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CULong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long3 = hs_bindgen_4af0668f1653ce01
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_float@
+foreign import ccall safe "hs_bindgen_b8acf83f3c3a43b0" hs_bindgen_b8acf83f3c3a43b0_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_float@
+hs_bindgen_b8acf83f3c3a43b0 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_b8acf83f3c3a43b0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b8acf83f3c3a43b0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_float = hs_bindgen_b8acf83f3c3a43b0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_double@
+foreign import ccall safe "hs_bindgen_2a27bb82268cc870" hs_bindgen_2a27bb82268cc870_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_double@
+hs_bindgen_2a27bb82268cc870 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_2a27bb82268cc870 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2a27bb82268cc870_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_double = hs_bindgen_2a27bb82268cc870
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_bool1@
+foreign import ccall safe "hs_bindgen_3f1481ac913e0394" hs_bindgen_3f1481ac913e0394_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_bool1@
+hs_bindgen_3f1481ac913e0394 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_3f1481ac913e0394 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3f1481ac913e0394_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_bool1 = hs_bindgen_3f1481ac913e0394
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_struct@
+foreign import ccall safe "hs_bindgen_998092a62cba613e" hs_bindgen_998092a62cba613e_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_struct@
+hs_bindgen_998092a62cba613e ::
+     BG.CInt
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_998092a62cba613e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_998092a62cba613e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_struct =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_998092a62cba613e arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_union@
+foreign import ccall safe "hs_bindgen_b83fe7017c88f63e" hs_bindgen_b83fe7017c88f63e_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_union@
+hs_bindgen_b83fe7017c88f63e ::
+     BG.CInt
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_b83fe7017c88f63e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b83fe7017c88f63e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_union =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_b83fe7017c88f63e arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_enum@
+foreign import ccall safe "hs_bindgen_45ef9d5579ceaa74" hs_bindgen_45ef9d5579ceaa74_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_enum@
+hs_bindgen_45ef9d5579ceaa74 ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_45ef9d5579ceaa74 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_45ef9d5579ceaa74_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_enum = hs_bindgen_45ef9d5579ceaa74
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer1@
+foreign import ccall safe "hs_bindgen_862d74c6849bbcd0" hs_bindgen_862d74c6849bbcd0_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer1@
+hs_bindgen_862d74c6849bbcd0 ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_862d74c6849bbcd0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_862d74c6849bbcd0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer1 = hs_bindgen_862d74c6849bbcd0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer2@
+foreign import ccall safe "hs_bindgen_0df09844c5645db9" hs_bindgen_0df09844c5645db9_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer2@
+hs_bindgen_0df09844c5645db9 ::
+     BG.CInt
+  -> BG.Ptr (BG.Ptr BG.CInt)
+  -> IO ()
+hs_bindgen_0df09844c5645db9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0df09844c5645db9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr (BG.Ptr BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer2 = hs_bindgen_0df09844c5645db9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer3@
+foreign import ccall safe "hs_bindgen_221cb5a1c4ce6a3b" hs_bindgen_221cb5a1c4ce6a3b_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer3@
+hs_bindgen_221cb5a1c4ce6a3b ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+hs_bindgen_221cb5a1c4ce6a3b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_221cb5a1c4ce6a3b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @arg3@
+  -> IO ()
+args_pointer3 = hs_bindgen_221cb5a1c4ce6a3b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_A@
+foreign import ccall safe "hs_bindgen_dfd4e13321b706b1" hs_bindgen_dfd4e13321b706b1_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_A@
+hs_bindgen_dfd4e13321b706b1 :: IO BG.CInt
+hs_bindgen_dfd4e13321b706b1 =
+  fmap BG.fromFFIType hs_bindgen_dfd4e13321b706b1_base
+
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A :: IO BG.CInt
+ret_A = hs_bindgen_dfd4e13321b706b1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char1@
+foreign import ccall safe "hs_bindgen_5289300b6ae3ff51" hs_bindgen_5289300b6ae3ff51_base ::
+     BG.CInt
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char1@
+hs_bindgen_5289300b6ae3ff51 ::
+     BG.CInt
+  -> IO BG.CChar
+hs_bindgen_5289300b6ae3ff51 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5289300b6ae3ff51_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CChar
+ret_char1 = hs_bindgen_5289300b6ae3ff51
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char2@
+foreign import ccall safe "hs_bindgen_b258f6c4e2c9be38" hs_bindgen_b258f6c4e2c9be38_base ::
+     BG.CInt
+  -> IO BG.CSChar
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char2@
+hs_bindgen_b258f6c4e2c9be38 ::
+     BG.CInt
+  -> IO BG.CSChar
+hs_bindgen_b258f6c4e2c9be38 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b258f6c4e2c9be38_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CSChar
+ret_char2 = hs_bindgen_b258f6c4e2c9be38
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char3@
+foreign import ccall safe "hs_bindgen_734b5b749255713a" hs_bindgen_734b5b749255713a_base ::
+     BG.CInt
+  -> IO BG.CUChar
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char3@
+hs_bindgen_734b5b749255713a ::
+     BG.CInt
+  -> IO BG.CUChar
+hs_bindgen_734b5b749255713a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_734b5b749255713a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUChar
+ret_char3 = hs_bindgen_734b5b749255713a
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short1@
+foreign import ccall safe "hs_bindgen_d17d4780d98d2561" hs_bindgen_d17d4780d98d2561_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short1@
+hs_bindgen_d17d4780d98d2561 ::
+     BG.CInt
+  -> IO BG.CShort
+hs_bindgen_d17d4780d98d2561 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d17d4780d98d2561_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short1 = hs_bindgen_d17d4780d98d2561
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short2@
+foreign import ccall safe "hs_bindgen_1f808a3cec3781e1" hs_bindgen_1f808a3cec3781e1_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short2@
+hs_bindgen_1f808a3cec3781e1 ::
+     BG.CInt
+  -> IO BG.CShort
+hs_bindgen_1f808a3cec3781e1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1f808a3cec3781e1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short2 = hs_bindgen_1f808a3cec3781e1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short3@
+foreign import ccall safe "hs_bindgen_5204d0272f75f1a2" hs_bindgen_5204d0272f75f1a2_base ::
+     BG.CInt
+  -> IO BG.CUShort
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short3@
+hs_bindgen_5204d0272f75f1a2 ::
+     BG.CInt
+  -> IO BG.CUShort
+hs_bindgen_5204d0272f75f1a2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5204d0272f75f1a2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUShort
+ret_short3 = hs_bindgen_5204d0272f75f1a2
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int1@
+foreign import ccall safe "hs_bindgen_14351eeb2c92732a" hs_bindgen_14351eeb2c92732a_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int1@
+hs_bindgen_14351eeb2c92732a ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_14351eeb2c92732a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_14351eeb2c92732a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int1 = hs_bindgen_14351eeb2c92732a
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int2@
+foreign import ccall safe "hs_bindgen_f91baafc096613a0" hs_bindgen_f91baafc096613a0_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int2@
+hs_bindgen_f91baafc096613a0 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_f91baafc096613a0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f91baafc096613a0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int2 = hs_bindgen_f91baafc096613a0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int3@
+foreign import ccall safe "hs_bindgen_e78391249ef8ffbf" hs_bindgen_e78391249ef8ffbf_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int3@
+hs_bindgen_e78391249ef8ffbf ::
+     BG.CInt
+  -> IO BG.CUInt
+hs_bindgen_e78391249ef8ffbf =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e78391249ef8ffbf_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUInt
+ret_int3 = hs_bindgen_e78391249ef8ffbf
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long1@
+foreign import ccall safe "hs_bindgen_4f8ae7ed648c72e4" hs_bindgen_4f8ae7ed648c72e4_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long1@
+hs_bindgen_4f8ae7ed648c72e4 ::
+     BG.CInt
+  -> IO BG.CLong
+hs_bindgen_4f8ae7ed648c72e4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4f8ae7ed648c72e4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long1 = hs_bindgen_4f8ae7ed648c72e4
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long2@
+foreign import ccall safe "hs_bindgen_c0a47369a5a10695" hs_bindgen_c0a47369a5a10695_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long2@
+hs_bindgen_c0a47369a5a10695 ::
+     BG.CInt
+  -> IO BG.CLong
+hs_bindgen_c0a47369a5a10695 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c0a47369a5a10695_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long2 = hs_bindgen_c0a47369a5a10695
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long3@
+foreign import ccall safe "hs_bindgen_64aa36b6c820a3bf" hs_bindgen_64aa36b6c820a3bf_base ::
+     BG.CInt
+  -> IO BG.CULong
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long3@
+hs_bindgen_64aa36b6c820a3bf ::
+     BG.CInt
+  -> IO BG.CULong
+hs_bindgen_64aa36b6c820a3bf =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_64aa36b6c820a3bf_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CULong
+ret_long3 = hs_bindgen_64aa36b6c820a3bf
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_float@
+foreign import ccall safe "hs_bindgen_b53c45aaccbaaf3a" hs_bindgen_b53c45aaccbaaf3a_base ::
+     BG.CInt
+  -> IO BG.CFloat
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_float@
+hs_bindgen_b53c45aaccbaaf3a ::
+     BG.CInt
+  -> IO BG.CFloat
+hs_bindgen_b53c45aaccbaaf3a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b53c45aaccbaaf3a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CFloat
+ret_float = hs_bindgen_b53c45aaccbaaf3a
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_double@
+foreign import ccall safe "hs_bindgen_0ca050f5bbe69c94" hs_bindgen_0ca050f5bbe69c94_base ::
+     BG.CInt
+  -> IO BG.CDouble
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_double@
+hs_bindgen_0ca050f5bbe69c94 ::
+     BG.CInt
+  -> IO BG.CDouble
+hs_bindgen_0ca050f5bbe69c94 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0ca050f5bbe69c94_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CDouble
+ret_double = hs_bindgen_0ca050f5bbe69c94
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_bool1@
+foreign import ccall safe "hs_bindgen_530e0725cadf8f52" hs_bindgen_530e0725cadf8f52_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_bool1@
+hs_bindgen_530e0725cadf8f52 ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_530e0725cadf8f52 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_530e0725cadf8f52_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+ret_bool1 = hs_bindgen_530e0725cadf8f52
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_struct@
+foreign import ccall safe "hs_bindgen_8f19d5621a4f3e92" hs_bindgen_8f19d5621a4f3e92_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_struct@
+hs_bindgen_8f19d5621a4f3e92 ::
+     BG.CInt
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_8f19d5621a4f3e92 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8f19d5621a4f3e92_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_struct
+ret_struct =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_8f19d5621a4f3e92 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_union@
+foreign import ccall safe "hs_bindgen_e93cfabcefb5051b" hs_bindgen_e93cfabcefb5051b_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_union@
+hs_bindgen_e93cfabcefb5051b ::
+     BG.CInt
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_e93cfabcefb5051b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e93cfabcefb5051b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_union
+ret_union =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_e93cfabcefb5051b arg10 res1)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_enum@
+foreign import ccall safe "hs_bindgen_f672d8d1020b037f" hs_bindgen_f672d8d1020b037f_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_enum@
+hs_bindgen_f672d8d1020b037f ::
+     BG.CInt
+  -> IO Some_enum
+hs_bindgen_f672d8d1020b037f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f672d8d1020b037f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_enum
+ret_enum = hs_bindgen_f672d8d1020b037f
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer1@
+foreign import ccall safe "hs_bindgen_1b0ed1f4c7ddeb1e" hs_bindgen_1b0ed1f4c7ddeb1e_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer1@
+hs_bindgen_1b0ed1f4c7ddeb1e ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_1b0ed1f4c7ddeb1e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1b0ed1f4c7ddeb1e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+ret_pointer1 = hs_bindgen_1b0ed1f4c7ddeb1e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer2@
+foreign import ccall safe "hs_bindgen_46ff1f39be014f9f" hs_bindgen_46ff1f39be014f9f_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer2@
+hs_bindgen_46ff1f39be014f9f ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_46ff1f39be014f9f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_46ff1f39be014f9f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+ret_pointer2 = hs_bindgen_46ff1f39be014f9f
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer3@
+foreign import ccall safe "hs_bindgen_c4737a52f27dfdac" hs_bindgen_c4737a52f27dfdac_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer3@
+hs_bindgen_c4737a52f27dfdac ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_c4737a52f27dfdac =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c4737a52f27dfdac_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.Void)
+ret_pointer3 = hs_bindgen_c4737a52f27dfdac
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body1@
+foreign import ccall safe "hs_bindgen_fdef71f6bc647af6" hs_bindgen_fdef71f6bc647af6_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body1@
+hs_bindgen_fdef71f6bc647af6 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_fdef71f6bc647af6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fdef71f6bc647af6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+body1 = hs_bindgen_fdef71f6bc647af6
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body2@
+foreign import ccall safe "hs_bindgen_4ebf4e201327a21a" hs_bindgen_4ebf4e201327a21a_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body2@
+hs_bindgen_4ebf4e201327a21a :: IO BG.CInt
+hs_bindgen_4ebf4e201327a21a =
+  fmap BG.fromFFIType hs_bindgen_4ebf4e201327a21a_base
+
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2 :: IO BG.CInt
+body2 = hs_bindgen_4ebf4e201327a21a
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_float@
+foreign import ccall safe "hs_bindgen_7229e893bab43698" hs_bindgen_7229e893bab43698_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_float@
+hs_bindgen_7229e893bab43698 ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_7229e893bab43698 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7229e893bab43698_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_float =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_7229e893bab43698 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_double@
+foreign import ccall safe "hs_bindgen_0cbb6cfd403656ec" hs_bindgen_0cbb6cfd403656ec_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_double@
+hs_bindgen_0cbb6cfd403656ec ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_0cbb6cfd403656ec =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0cbb6cfd403656ec_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_double =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_0cbb6cfd403656ec arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_float@
+foreign import ccall safe "hs_bindgen_7fa01b9c64606663" hs_bindgen_7fa01b9c64606663_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_float@
+hs_bindgen_7fa01b9c64606663 ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_7fa01b9c64606663 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7fa01b9c64606663_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CFloat)
+ret_complex_float =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_7fa01b9c64606663 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_double@
+foreign import ccall safe "hs_bindgen_81ad2d3ffe70c3a9" hs_bindgen_81ad2d3ffe70c3a9_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_double@
+hs_bindgen_81ad2d3ffe70c3a9 ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_81ad2d3ffe70c3a9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_81ad2d3ffe70c3a9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CDouble)
+ret_complex_double =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_81ad2d3ffe70c3a9 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args1@
+foreign import ccall safe "hs_bindgen_1c3c1f6f6a7e2bc8" hs_bindgen_1c3c1f6f6a7e2bc8_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args1@
+hs_bindgen_1c3c1f6f6a7e2bc8 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_1c3c1f6f6a7e2bc8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1c3c1f6f6a7e2bc8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args1 = hs_bindgen_1c3c1f6f6a7e2bc8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args2@
+foreign import ccall safe "hs_bindgen_a5e6d8b6d973331f" hs_bindgen_a5e6d8b6d973331f_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args2@
+hs_bindgen_a5e6d8b6d973331f ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_a5e6d8b6d973331f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a5e6d8b6d973331f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args2 = hs_bindgen_a5e6d8b6d973331f
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret1@
+foreign import ccall safe "hs_bindgen_0f143bde59bade44" hs_bindgen_0f143bde59bade44_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret1@
+hs_bindgen_0f143bde59bade44 ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_0f143bde59bade44 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0f143bde59bade44_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+bespoke_ret1 = hs_bindgen_0f143bde59bade44
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret2@
+foreign import ccall safe "hs_bindgen_3fe674df63c48d30" hs_bindgen_3fe674df63c48d30_base ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret2@
+hs_bindgen_3fe674df63c48d30 ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_3fe674df63c48d30 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3fe674df63c48d30_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO HsBindgen.Runtime.LibC.CSize
+bespoke_ret2 = hs_bindgen_3fe674df63c48d30
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args1@
+foreign import ccall safe "hs_bindgen_a8eaeaa944a099d9" hs_bindgen_a8eaeaa944a099d9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args1@
+hs_bindgen_a8eaeaa944a099d9 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_a8eaeaa944a099d9 =
+  \x0 ->
+    hs_bindgen_a8eaeaa944a099d9_base (BG.toFFIType x0)
+
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args1 = hs_bindgen_a8eaeaa944a099d9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args2@
+foreign import ccall safe "hs_bindgen_f928df06f2f528e0" hs_bindgen_f928df06f2f528e0_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args2@
+hs_bindgen_f928df06f2f528e0 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_f928df06f2f528e0 =
+  \x0 ->
+    hs_bindgen_f928df06f2f528e0_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args2 = hs_bindgen_f928df06f2f528e0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args3@
+foreign import ccall safe "hs_bindgen_2fb2e9d0563a690b" hs_bindgen_2fb2e9d0563a690b_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args3@
+hs_bindgen_2fb2e9d0563a690b ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt))
+  -> IO ()
+hs_bindgen_2fb2e9d0563a690b =
+  \x0 ->
+    hs_bindgen_2fb2e9d0563a690b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args3 = hs_bindgen_2fb2e9d0563a690b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args4@
+foreign import ccall safe "hs_bindgen_b9b529def42c1efd" hs_bindgen_b9b529def42c1efd_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args4@
+hs_bindgen_b9b529def42c1efd ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_b9b529def42c1efd =
+  \x0 ->
+    hs_bindgen_b9b529def42c1efd_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args4 = hs_bindgen_b9b529def42c1efd
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args1@
+foreign import ccall safe "hs_bindgen_5ab0516185b48906" hs_bindgen_5ab0516185b48906_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args1@
+hs_bindgen_5ab0516185b48906 ::
+     BG.CInt
+  -> BG.FunPtr (IO ())
+  -> IO ()
+hs_bindgen_5ab0516185b48906 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5ab0516185b48906_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args1 = hs_bindgen_5ab0516185b48906
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args2@
+foreign import ccall safe "hs_bindgen_682810b65a83f101" hs_bindgen_682810b65a83f101_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args2@
+hs_bindgen_682810b65a83f101 ::
+     BG.CInt
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_682810b65a83f101 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_682810b65a83f101_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args2 = hs_bindgen_682810b65a83f101
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args3@
+foreign import ccall safe "hs_bindgen_a06192a621a12016" hs_bindgen_a06192a621a12016_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args3@
+hs_bindgen_a06192a621a12016 ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_a06192a621a12016 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a06192a621a12016_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args3 = hs_bindgen_a06192a621a12016
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args4@
+foreign import ccall safe "hs_bindgen_414fd8b92ff2611b" hs_bindgen_414fd8b92ff2611b_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args4@
+hs_bindgen_414fd8b92ff2611b ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+  -> IO ()
+hs_bindgen_414fd8b92ff2611b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_414fd8b92ff2611b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args4 = hs_bindgen_414fd8b92ff2611b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args5@
+foreign import ccall safe "hs_bindgen_62b477fc0c092e32" hs_bindgen_62b477fc0c092e32_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args5@
+hs_bindgen_62b477fc0c092e32 ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+  -> IO ()
+hs_bindgen_62b477fc0c092e32 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_62b477fc0c092e32_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args5 = hs_bindgen_62b477fc0c092e32
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_comments1@
+foreign import ccall safe "hs_bindgen_17fb56aae1527722" hs_bindgen_17fb56aae1527722_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_comments1@
+hs_bindgen_17fb56aae1527722 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_17fb56aae1527722 =
+  \x0 ->
+    hs_bindgen_17fb56aae1527722_base (BG.toFFIType x0)
+
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+comments1 = hs_bindgen_17fb56aae1527722
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before1@
+foreign import ccall safe "hs_bindgen_e70333f7108e59a8" hs_bindgen_e70333f7108e59a8_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before1@
+hs_bindgen_e70333f7108e59a8 ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_e70333f7108e59a8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e70333f7108e59a8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before1 = hs_bindgen_e70333f7108e59a8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before2@
+foreign import ccall safe "hs_bindgen_14a503cc3e41e014" hs_bindgen_14a503cc3e41e014_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before2@
+hs_bindgen_14a503cc3e41e014 ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_14a503cc3e41e014 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_14a503cc3e41e014_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before2 = hs_bindgen_14a503cc3e41e014
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before3@
+foreign import ccall safe "hs_bindgen_504ad9cb98a4f946" hs_bindgen_504ad9cb98a4f946_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before3@
+hs_bindgen_504ad9cb98a4f946 ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_504ad9cb98a4f946 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_504ad9cb98a4f946_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before3 = hs_bindgen_504ad9cb98a4f946
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after1@
+foreign import ccall safe "hs_bindgen_c0c67bf5b144c658" hs_bindgen_c0c67bf5b144c658_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after1@
+hs_bindgen_c0c67bf5b144c658 ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_c0c67bf5b144c658 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c0c67bf5b144c658_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after1 = hs_bindgen_c0c67bf5b144c658
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after2@
+foreign import ccall safe "hs_bindgen_72fa51e2c7023b88" hs_bindgen_72fa51e2c7023b88_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after2@
+hs_bindgen_72fa51e2c7023b88 ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_72fa51e2c7023b88 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_72fa51e2c7023b88_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after2 = hs_bindgen_72fa51e2c7023b88
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after3@
+foreign import ccall safe "hs_bindgen_b09c2805c508fddf" hs_bindgen_b09c2805c508fddf_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after3@
+hs_bindgen_b09c2805c508fddf ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_b09c2805c508fddf =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b09c2805c508fddf_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after3 = hs_bindgen_b09c2805c508fddf
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before1@
+foreign import ccall safe "hs_bindgen_85bf325f09491972" hs_bindgen_85bf325f09491972_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before1@
+hs_bindgen_85bf325f09491972 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_85bf325f09491972 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_85bf325f09491972_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before1 =
+  hs_bindgen_85bf325f09491972
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before2@
+foreign import ccall safe "hs_bindgen_45a61f720b0fe2ed" hs_bindgen_45a61f720b0fe2ed_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before2@
+hs_bindgen_45a61f720b0fe2ed ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_45a61f720b0fe2ed =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_45a61f720b0fe2ed_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before2 =
+  hs_bindgen_45a61f720b0fe2ed
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before3@
+foreign import ccall safe "hs_bindgen_36c611aa17d28531" hs_bindgen_36c611aa17d28531_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before3@
+hs_bindgen_36c611aa17d28531 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_36c611aa17d28531 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_36c611aa17d28531_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before3 =
+  hs_bindgen_36c611aa17d28531
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before4@
+foreign import ccall safe "hs_bindgen_a614ed967b401309" hs_bindgen_a614ed967b401309_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before4@
+hs_bindgen_a614ed967b401309 ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_a614ed967b401309 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a614ed967b401309_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_a614ed967b401309 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before5@
+foreign import ccall safe "hs_bindgen_0e258c684851b84f" hs_bindgen_0e258c684851b84f_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before5@
+hs_bindgen_0e258c684851b84f ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_0e258c684851b84f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0e258c684851b84f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_0e258c684851b84f arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before6@
+foreign import ccall safe "hs_bindgen_9f7d70e8a0106516" hs_bindgen_9f7d70e8a0106516_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before6@
+hs_bindgen_9f7d70e8a0106516 ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_9f7d70e8a0106516 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9f7d70e8a0106516_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before6 =
+  hs_bindgen_9f7d70e8a0106516
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before7@
+foreign import ccall safe "hs_bindgen_0b71a82a5fa4fc87" hs_bindgen_0b71a82a5fa4fc87_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before7@
+hs_bindgen_0b71a82a5fa4fc87 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_0b71a82a5fa4fc87 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0b71a82a5fa4fc87_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before7 =
+  hs_bindgen_0b71a82a5fa4fc87
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before8@
+foreign import ccall safe "hs_bindgen_7ebb88bce2abdf74" hs_bindgen_7ebb88bce2abdf74_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before8@
+hs_bindgen_7ebb88bce2abdf74 ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_7ebb88bce2abdf74 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7ebb88bce2abdf74_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before8 =
+  hs_bindgen_7ebb88bce2abdf74
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after1@
+foreign import ccall safe "hs_bindgen_7188d6a351cf7dd5" hs_bindgen_7188d6a351cf7dd5_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after1@
+hs_bindgen_7188d6a351cf7dd5 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_7188d6a351cf7dd5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7188d6a351cf7dd5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after1 =
+  hs_bindgen_7188d6a351cf7dd5
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after2@
+foreign import ccall safe "hs_bindgen_bd2e5fd19a5f4d84" hs_bindgen_bd2e5fd19a5f4d84_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after2@
+hs_bindgen_bd2e5fd19a5f4d84 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_bd2e5fd19a5f4d84 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_bd2e5fd19a5f4d84_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after2 =
+  hs_bindgen_bd2e5fd19a5f4d84
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after3@
+foreign import ccall safe "hs_bindgen_ab0f4d2e36402e2f" hs_bindgen_ab0f4d2e36402e2f_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after3@
+hs_bindgen_ab0f4d2e36402e2f ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_ab0f4d2e36402e2f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ab0f4d2e36402e2f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after3 =
+  hs_bindgen_ab0f4d2e36402e2f
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after4@
+foreign import ccall safe "hs_bindgen_d4fdffd51b526049" hs_bindgen_d4fdffd51b526049_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after4@
+hs_bindgen_d4fdffd51b526049 ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_d4fdffd51b526049 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d4fdffd51b526049_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_d4fdffd51b526049 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after5@
+foreign import ccall safe "hs_bindgen_662a5811d33311fd" hs_bindgen_662a5811d33311fd_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after5@
+hs_bindgen_662a5811d33311fd ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_662a5811d33311fd =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_662a5811d33311fd_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_662a5811d33311fd arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after6@
+foreign import ccall safe "hs_bindgen_6755aa8f356d9bb1" hs_bindgen_6755aa8f356d9bb1_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after6@
+hs_bindgen_6755aa8f356d9bb1 ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_6755aa8f356d9bb1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6755aa8f356d9bb1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after6 =
+  hs_bindgen_6755aa8f356d9bb1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after7@
+foreign import ccall safe "hs_bindgen_38694a08d2a7599a" hs_bindgen_38694a08d2a7599a_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after7@
+hs_bindgen_38694a08d2a7599a ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_38694a08d2a7599a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_38694a08d2a7599a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after7 =
+  hs_bindgen_38694a08d2a7599a
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after8@
+foreign import ccall safe "hs_bindgen_44cd79114d322610" hs_bindgen_44cd79114d322610_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after8@
+hs_bindgen_44cd79114d322610 ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_44cd79114d322610 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_44cd79114d322610_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after8 =
+  hs_bindgen_44cd79114d322610
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args1@
+foreign import ccall safe "hs_bindgen_30969f0e26032752" hs_bindgen_30969f0e26032752_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args1@
+hs_bindgen_30969f0e26032752 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_30969f0e26032752 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_30969f0e26032752_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args1 = hs_bindgen_30969f0e26032752
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args2@
+foreign import ccall safe "hs_bindgen_35235928bc01e390" hs_bindgen_35235928bc01e390_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args2@
+hs_bindgen_35235928bc01e390 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_35235928bc01e390 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_35235928bc01e390_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args2 = hs_bindgen_35235928bc01e390
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args3@
+foreign import ccall safe "hs_bindgen_9853f1c7b6472022" hs_bindgen_9853f1c7b6472022_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args3@
+hs_bindgen_9853f1c7b6472022 ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_9853f1c7b6472022 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9853f1c7b6472022_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args3 = hs_bindgen_9853f1c7b6472022
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args4@
+foreign import ccall safe "hs_bindgen_e3b1d92f43d9cda7" hs_bindgen_e3b1d92f43d9cda7_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args4@
+hs_bindgen_e3b1d92f43d9cda7 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_e3b1d92f43d9cda7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e3b1d92f43d9cda7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args4 = hs_bindgen_e3b1d92f43d9cda7
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args5@
+foreign import ccall safe "hs_bindgen_b4a0d9b232b8ee87" hs_bindgen_b4a0d9b232b8ee87_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args5@
+hs_bindgen_b4a0d9b232b8ee87 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_b4a0d9b232b8ee87 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b4a0d9b232b8ee87_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args5 = hs_bindgen_b4a0d9b232b8ee87
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret1@
+foreign import ccall safe "hs_bindgen_ce61a185fdbd1b5e" hs_bindgen_ce61a185fdbd1b5e_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret1@
+hs_bindgen_ce61a185fdbd1b5e ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_ce61a185fdbd1b5e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ce61a185fdbd1b5e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret1 = hs_bindgen_ce61a185fdbd1b5e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret2@
+foreign import ccall safe "hs_bindgen_001714607a85bf44" hs_bindgen_001714607a85bf44_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret2@
+hs_bindgen_001714607a85bf44 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_001714607a85bf44 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_001714607a85bf44_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret2 = hs_bindgen_001714607a85bf44
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret3@
+foreign import ccall safe "hs_bindgen_0481dd02a7bda0cb" hs_bindgen_0481dd02a7bda0cb_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret3@
+hs_bindgen_0481dd02a7bda0cb ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_0481dd02a7bda0cb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0481dd02a7bda0cb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+const_pointers_ret3 = hs_bindgen_0481dd02a7bda0cb
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret4@
+foreign import ccall safe "hs_bindgen_2b32282230882c4f" hs_bindgen_2b32282230882c4f_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret4@
+hs_bindgen_2b32282230882c4f ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_2b32282230882c4f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2b32282230882c4f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret4 = hs_bindgen_2b32282230882c4f
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret5@
+foreign import ccall safe "hs_bindgen_094656d98097f48e" hs_bindgen_094656d98097f48e_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret5@
+hs_bindgen_094656d98097f48e ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_094656d98097f48e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_094656d98097f48e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret5 = hs_bindgen_094656d98097f48e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem1@
+foreign import ccall safe "hs_bindgen_5f2909e0d90b7530" hs_bindgen_5f2909e0d90b7530_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem1@
+hs_bindgen_5f2909e0d90b7530 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_5f2909e0d90b7530 =
+  \x0 ->
+    hs_bindgen_5f2909e0d90b7530_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem1 = hs_bindgen_5f2909e0d90b7530
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem2@
+foreign import ccall safe "hs_bindgen_a9a1c34158c32e13" hs_bindgen_a9a1c34158c32e13_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem2@
+hs_bindgen_a9a1c34158c32e13 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt)))
+  -> IO ()
+hs_bindgen_a9a1c34158c32e13 =
+  \x0 ->
+    hs_bindgen_a9a1c34158c32e13_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem2 = hs_bindgen_a9a1c34158c32e13
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem3@
+foreign import ccall safe "hs_bindgen_55765da8c98676da" hs_bindgen_55765da8c98676da_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem3@
+hs_bindgen_55765da8c98676da ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_55765da8c98676da =
+  \x0 ->
+    hs_bindgen_55765da8c98676da_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem3 = hs_bindgen_55765da8c98676da
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams1@
+foreign import ccall safe "hs_bindgen_2692ad6e69dd9bf6" hs_bindgen_2692ad6e69dd9bf6_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams1@
+hs_bindgen_2692ad6e69dd9bf6 :: IO BG.CInt
+hs_bindgen_2692ad6e69dd9bf6 =
+  fmap BG.fromFFIType hs_bindgen_2692ad6e69dd9bf6_base
+
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1 :: IO BG.CInt
+noParams1 = hs_bindgen_2692ad6e69dd9bf6
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams2@
+foreign import ccall safe "hs_bindgen_b016e4354ee966d9" hs_bindgen_b016e4354ee966d9_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams2@
+hs_bindgen_b016e4354ee966d9 :: IO BG.CInt
+hs_bindgen_b016e4354ee966d9 =
+  fmap BG.fromFFIType hs_bindgen_b016e4354ee966d9_base
+
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2 :: IO BG.CInt
+noParams2 = hs_bindgen_b016e4354ee966d9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams3@
+foreign import ccall safe "hs_bindgen_9a5fca17446c0b64" hs_bindgen_9a5fca17446c0b64_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams3@
+hs_bindgen_9a5fca17446c0b64 ::
+     BG.CInt
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_9a5fca17446c0b64 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9a5fca17446c0b64_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+noParams3 = hs_bindgen_9a5fca17446c0b64
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret1@
+foreign import ccall safe "hs_bindgen_e0ae2ea8372de864" hs_bindgen_e0ae2ea8372de864_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret1@
+hs_bindgen_e0ae2ea8372de864 ::
+     BG.CInt
+  -> IO (BG.FunPtr (IO ()))
+hs_bindgen_e0ae2ea8372de864 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e0ae2ea8372de864_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO ()))
+funptr_ret1 = hs_bindgen_e0ae2ea8372de864
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret2@
+foreign import ccall safe "hs_bindgen_105cd0216456de95" hs_bindgen_105cd0216456de95_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret2@
+hs_bindgen_105cd0216456de95 ::
+     BG.CInt
+  -> IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_105cd0216456de95 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_105cd0216456de95_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO BG.CInt))
+funptr_ret2 = hs_bindgen_105cd0216456de95
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret3@
+foreign import ccall safe "hs_bindgen_2d7d8cfa71504d88" hs_bindgen_2d7d8cfa71504d88_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret3@
+hs_bindgen_2d7d8cfa71504d88 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_2d7d8cfa71504d88 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2d7d8cfa71504d88_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+funptr_ret3 = hs_bindgen_2d7d8cfa71504d88
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret4@
+foreign import ccall safe "hs_bindgen_46f0ed4c8295ba70" hs_bindgen_46f0ed4c8295ba70_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret4@
+hs_bindgen_46f0ed4c8295ba70 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+hs_bindgen_46f0ed4c8295ba70 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_46f0ed4c8295ba70_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+funptr_ret4 = hs_bindgen_46f0ed4c8295ba70
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret5@
+foreign import ccall safe "hs_bindgen_f8291bd691623354" hs_bindgen_f8291bd691623354_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret5@
+hs_bindgen_f8291bd691623354 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_f8291bd691623354 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f8291bd691623354_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret5 = hs_bindgen_f8291bd691623354
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret6@
+foreign import ccall safe "hs_bindgen_2eb8ef0a6794c225" hs_bindgen_2eb8ef0a6794c225_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret6@
+hs_bindgen_2eb8ef0a6794c225 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_2eb8ef0a6794c225 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2eb8ef0a6794c225_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret6 = hs_bindgen_2eb8ef0a6794c225
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret7@
+foreign import ccall safe "hs_bindgen_8cc60b45c83cb72b" hs_bindgen_8cc60b45c83cb72b_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret7@
+hs_bindgen_8cc60b45c83cb72b ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_8cc60b45c83cb72b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8cc60b45c83cb72b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret7 = hs_bindgen_8cc60b45c83cb72b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret8@
+foreign import ccall safe "hs_bindgen_2ad075d6ca6beea5" hs_bindgen_2ad075d6ca6beea5_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret8@
+hs_bindgen_2ad075d6ca6beea5 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_2ad075d6ca6beea5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2ad075d6ca6beea5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret8 = hs_bindgen_2ad075d6ca6beea5
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret9@
+foreign import ccall safe "hs_bindgen_fe5e863d48f781be" hs_bindgen_fe5e863d48f781be_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret9@
+hs_bindgen_fe5e863d48f781be ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_fe5e863d48f781be =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fe5e863d48f781be_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret9 = hs_bindgen_fe5e863d48f781be
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret10@
+foreign import ccall safe "hs_bindgen_2a029ddc00ba6ce1" hs_bindgen_2a029ddc00ba6ce1_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret10@
+hs_bindgen_2a029ddc00ba6ce1 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_2a029ddc00ba6ce1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2a029ddc00ba6ce1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret10 = hs_bindgen_2a029ddc00ba6ce1
diff --git a/test-artefacts/fixtures/macros/reparse.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.1.empty/Example/Unsafe.hs
@@ -0,0 +1,4006 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.args_char1
+    , Example.Unsafe.args_char2
+    , Example.Unsafe.args_char3
+    , Example.Unsafe.args_short1
+    , Example.Unsafe.args_short2
+    , Example.Unsafe.args_short3
+    , Example.Unsafe.args_int1
+    , Example.Unsafe.args_int2
+    , Example.Unsafe.args_int3
+    , Example.Unsafe.args_long1
+    , Example.Unsafe.args_long2
+    , Example.Unsafe.args_long3
+    , Example.Unsafe.args_float
+    , Example.Unsafe.args_double
+    , Example.Unsafe.args_bool1
+    , Example.Unsafe.args_struct
+    , Example.Unsafe.args_union
+    , Example.Unsafe.args_enum
+    , Example.Unsafe.args_pointer1
+    , Example.Unsafe.args_pointer2
+    , Example.Unsafe.args_pointer3
+    , Example.Unsafe.ret_A
+    , Example.Unsafe.ret_char1
+    , Example.Unsafe.ret_char2
+    , Example.Unsafe.ret_char3
+    , Example.Unsafe.ret_short1
+    , Example.Unsafe.ret_short2
+    , Example.Unsafe.ret_short3
+    , Example.Unsafe.ret_int1
+    , Example.Unsafe.ret_int2
+    , Example.Unsafe.ret_int3
+    , Example.Unsafe.ret_long1
+    , Example.Unsafe.ret_long2
+    , Example.Unsafe.ret_long3
+    , Example.Unsafe.ret_float
+    , Example.Unsafe.ret_double
+    , Example.Unsafe.ret_bool1
+    , Example.Unsafe.ret_struct
+    , Example.Unsafe.ret_union
+    , Example.Unsafe.ret_enum
+    , Example.Unsafe.ret_pointer1
+    , Example.Unsafe.ret_pointer2
+    , Example.Unsafe.ret_pointer3
+    , Example.Unsafe.body1
+    , Example.Unsafe.body2
+    , Example.Unsafe.args_complex_float
+    , Example.Unsafe.args_complex_double
+    , Example.Unsafe.ret_complex_float
+    , Example.Unsafe.ret_complex_double
+    , Example.Unsafe.bespoke_args1
+    , Example.Unsafe.bespoke_args2
+    , Example.Unsafe.bespoke_ret1
+    , Example.Unsafe.bespoke_ret2
+    , Example.Unsafe.arr_args1
+    , Example.Unsafe.arr_args2
+    , Example.Unsafe.arr_args3
+    , Example.Unsafe.arr_args4
+    , Example.Unsafe.funptr_args1
+    , Example.Unsafe.funptr_args2
+    , Example.Unsafe.funptr_args3
+    , Example.Unsafe.funptr_args4
+    , Example.Unsafe.funptr_args5
+    , Example.Unsafe.comments1
+    , Example.Unsafe.const_prim_before1
+    , Example.Unsafe.const_prim_before2
+    , Example.Unsafe.const_prim_before3
+    , Example.Unsafe.const_prim_after1
+    , Example.Unsafe.const_prim_after2
+    , Example.Unsafe.const_prim_after3
+    , Example.Unsafe.const_withoutSign_before1
+    , Example.Unsafe.const_withoutSign_before2
+    , Example.Unsafe.const_withoutSign_before3
+    , Example.Unsafe.const_withoutSign_before4
+    , Example.Unsafe.const_withoutSign_before5
+    , Example.Unsafe.const_withoutSign_before6
+    , Example.Unsafe.const_withoutSign_before7
+    , Example.Unsafe.const_withoutSign_before8
+    , Example.Unsafe.const_withoutSign_after1
+    , Example.Unsafe.const_withoutSign_after2
+    , Example.Unsafe.const_withoutSign_after3
+    , Example.Unsafe.const_withoutSign_after4
+    , Example.Unsafe.const_withoutSign_after5
+    , Example.Unsafe.const_withoutSign_after6
+    , Example.Unsafe.const_withoutSign_after7
+    , Example.Unsafe.const_withoutSign_after8
+    , Example.Unsafe.const_pointers_args1
+    , Example.Unsafe.const_pointers_args2
+    , Example.Unsafe.const_pointers_args3
+    , Example.Unsafe.const_pointers_args4
+    , Example.Unsafe.const_pointers_args5
+    , Example.Unsafe.const_pointers_ret1
+    , Example.Unsafe.const_pointers_ret2
+    , Example.Unsafe.const_pointers_ret3
+    , Example.Unsafe.const_pointers_ret4
+    , Example.Unsafe.const_pointers_ret5
+    , Example.Unsafe.const_array_elem1
+    , Example.Unsafe.const_array_elem2
+    , Example.Unsafe.const_array_elem3
+    , Example.Unsafe.noParams1
+    , Example.Unsafe.noParams2
+    , Example.Unsafe.noParams3
+    , Example.Unsafe.funptr_ret1
+    , Example.Unsafe.funptr_ret2
+    , Example.Unsafe.funptr_ret3
+    , Example.Unsafe.funptr_ret4
+    , Example.Unsafe.funptr_ret5
+    , Example.Unsafe.funptr_ret6
+    , Example.Unsafe.funptr_ret7
+    , Example.Unsafe.funptr_ret8
+    , Example.Unsafe.funptr_ret9
+    , Example.Unsafe.funptr_ret10
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "void hs_bindgen_c6ccfbc5ac54d3e3 ("
+  , "  signed int arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (args_char1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1b7126ecf0f5ab6e ("
+  , "  signed int arg1,"
+  , "  signed char arg2"
+  , ")"
+  , "{"
+  , "  (args_char2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_8ecc879598b6d3b0 ("
+  , "  signed int arg1,"
+  , "  unsigned char arg2"
+  , ")"
+  , "{"
+  , "  (args_char3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_8e221273096c13a0 ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3de3762c82599242 ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_14352acc60454580 ("
+  , "  signed int arg1,"
+  , "  unsigned short arg2"
+  , ")"
+  , "{"
+  , "  (args_short3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_96096b97ae514d84 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d049eccfdf55015b ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9c1d57b596281f26 ("
+  , "  signed int arg1,"
+  , "  unsigned int arg2"
+  , ")"
+  , "{"
+  , "  (args_int3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_31684dbfb298f18c ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_705e74ceba937567 ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_193cb3a5430102f3 ("
+  , "  signed int arg1,"
+  , "  unsigned long arg2"
+  , ")"
+  , "{"
+  , "  (args_long3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f1b87ec98a54b583 ("
+  , "  signed int arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  (args_float)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_da17ba710f71da80 ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  (args_double)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9e15dd8dbce9cd83 ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (args_bool1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_dc772c3e54b3ef41 ("
+  , "  signed int arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  (args_struct)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_aabbe3419dcd3eb9 ("
+  , "  signed int arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  (args_union)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_731297a830e4c2df ("
+  , "  signed int arg1,"
+  , "  enum some_enum arg2"
+  , ")"
+  , "{"
+  , "  (args_enum)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_31fc55b0aea434ba ("
+  , "  signed int arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_35aa32eabe6cbe1e ("
+  , "  signed int arg1,"
+  , "  signed int **arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c9941830193c9c20 ("
+  , "  signed int arg1,"
+  , "  void *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer3)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_56c5534530515933 (void)"
+  , "{"
+  , "  return (ret_A)();"
+  , "}"
+  , "char hs_bindgen_e36cc4960e15ece8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char1)(arg1);"
+  , "}"
+  , "signed char hs_bindgen_39c01c6ee1b7364f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char2)(arg1);"
+  , "}"
+  , "unsigned char hs_bindgen_6a35179874816c94 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char3)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_9bb2bb254d5dc1c0 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short1)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_6797eb02f4ac3ebe ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short2)(arg1);"
+  , "}"
+  , "unsigned short hs_bindgen_615bd7df3e0134a2 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4fe4545529e753b8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f6e5d129c69c5afe ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int2)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_9551ec72ba55d7a7 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int3)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_e0d1c177d41a7ce8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long1)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_42fbed00ce6b7b08 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long2)(arg1);"
+  , "}"
+  , "unsigned long hs_bindgen_ed9a248d2e643a4b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long3)(arg1);"
+  , "}"
+  , "float hs_bindgen_ff0e9b4eaea0329a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_float)(arg1);"
+  , "}"
+  , "double hs_bindgen_164a83641655c836 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_double)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_53d6d79b1b401e62 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_bool1)(arg1);"
+  , "}"
+  , "void hs_bindgen_75308badf37284ce ("
+  , "  signed int arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_struct)(arg1);"
+  , "}"
+  , "void hs_bindgen_b9ab05b4990fb8dd ("
+  , "  signed int arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_union)(arg1);"
+  , "}"
+  , "enum some_enum hs_bindgen_c46aafe01e3abbca ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_enum)(arg1);"
+  , "}"
+  , "signed int *hs_bindgen_afcc67a9788584d9 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer1)(arg1);"
+  , "}"
+  , "signed int **hs_bindgen_234d0979dbe93733 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer2)(arg1);"
+  , "}"
+  , "void *hs_bindgen_6f3f7c624556cfb3 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_c9d515b8a02ca235 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (body1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d6e10c899b553af9 (void)"
+  , "{"
+  , "  return (body2)();"
+  , "}"
+  , "void hs_bindgen_433860c3d6edf28b ("
+  , "  signed int arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_float)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_8e44029c12a7dddb ("
+  , "  signed int arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_double)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_0dc01ff2cd8fc565 ("
+  , "  signed int arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_float)(arg1);"
+  , "}"
+  , "void hs_bindgen_8f2ebb486a336f80 ("
+  , "  signed int arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_double)(arg1);"
+  , "}"
+  , "void hs_bindgen_26be4a823dc56e01 ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6212b2750a2d5997 ("
+  , "  signed int arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args2)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_e553247e80e3e159 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret1)(arg1);"
+  , "}"
+  , "size_t hs_bindgen_72a7f6cf38bcb00c ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret2)(arg1);"
+  , "}"
+  , "void hs_bindgen_dc7cacd7dbb61f43 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args1)(arg1);"
+  , "}"
+  , "void hs_bindgen_09d9010cbf3c8d41 ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args2)(arg1);"
+  , "}"
+  , "void hs_bindgen_37e1f318a8ae501c ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args3)(arg1);"
+  , "}"
+  , "void hs_bindgen_d9440a8b6d2848ff ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args4)(arg1);"
+  , "}"
+  , "void hs_bindgen_ca61df80135a11f9 ("
+  , "  signed int arg1,"
+  , "  void (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2e803412f5250381 ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1839323a7de53e04 ("
+  , "  signed int arg1,"
+  , "  void (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1966f50d5deb0a77 ("
+  , "  signed int arg1,"
+  , "  char (*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3eacaa3550feb706 ("
+  , "  signed int arg1,"
+  , "  signed int *(*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args5)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_42f3fad04f4a62c7 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (comments1)(arg1);"
+  , "}"
+  , "void hs_bindgen_40fa2adcbadaabf4 ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6560ce91395cf6bf ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_fab04df1b737308d ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3762ecefd71c40d3 ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b3ecb163df7d32c8 ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_706270fd83faddb0 ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ff637beb32dc5931 ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3e0e5c2fa1b03a68 ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_81eefcf233fd167c ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1c849843004ee65e ("
+  , "  signed int arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_c85d4a53a6e1e963 ("
+  , "  signed int arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_796c19d2df50b65f ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0950b2ec97db5b00 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_375085e61e85a2a8 ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2bb6a1d152a87f63 ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2753c469629474c2 ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_5c96f0d6c5fd53b1 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e8d4acc6356ca49d ("
+  , "  signed int arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_6762b5473d8d350a ("
+  , "  signed int arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_55d5e45034c9f572 ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_70dae000d43d8228 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_85e787c823b6c95f ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_efb5ca5187af5610 ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e306bbd2d4a374fc ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_960be6e90be0e7c1 ("
+  , "  signed int arg1,"
+  , "  signed int *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_00950eca61f28e52 ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_96b40db09db83748 ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args5)(arg1, arg2);"
+  , "}"
+  , "signed int const *hs_bindgen_035d9da3770aeff8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret1)(arg1);"
+  , "}"
+  , "signed int const *hs_bindgen_0d195040558fbef7 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret2)(arg1);"
+  , "}"
+  , "signed int *const hs_bindgen_9d5a35ded6d43b33 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret3)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_b00ca0cfd4037848 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret4)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_da92f752b03da901 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret5)(arg1);"
+  , "}"
+  , "void hs_bindgen_fdc3e3307cac5fd0 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem1)(arg1);"
+  , "}"
+  , "void hs_bindgen_cecdce9d64ac85d4 ("
+  , "  signed int const **arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem2)(arg1);"
+  , "}"
+  , "void hs_bindgen_9ee7979e72b4baf6 ("
+  , "  signed int *const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_c6e158d421dda2ac (void)"
+  , "{"
+  , "  return (noParams1)();"
+  , "}"
+  , "signed int hs_bindgen_a34e536ea5931d76 (void)"
+  , "{"
+  , "  return (noParams2)();"
+  , "}"
+  , "void hs_bindgen_80f6772cd6dfe2a9 ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (noParams3)(arg1, arg2);"
+  , "}"
+  , "void (*hs_bindgen_8938b867c00625aa ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_03ba9af419f7c750 ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret2)(arg1);"
+  , "}"
+  , "void (*hs_bindgen_c53c44ca84d8cb81 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (funptr_ret3)(arg1);"
+  , "}"
+  , "char (*hs_bindgen_fb5431b884cc209e ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret4)(arg1);"
+  , "}"
+  , "signed int *(*hs_bindgen_b45419cebf6cb43d ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret5)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_5c14b480ba3cab1e ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret6)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_b8f93b6ff6ce2b1c ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret7)(arg1);"
+  , "}"
+  , "signed int *const (*hs_bindgen_74e1d2bf9ed6b1c5 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret8)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_8e68b5e49b407e0b ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret9)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_1fc54cf36aa5566f ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret10)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char1@
+foreign import ccall unsafe "hs_bindgen_c6ccfbc5ac54d3e3" hs_bindgen_c6ccfbc5ac54d3e3_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char1@
+hs_bindgen_c6ccfbc5ac54d3e3 ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_c6ccfbc5ac54d3e3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c6ccfbc5ac54d3e3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char1 = hs_bindgen_c6ccfbc5ac54d3e3
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char2@
+foreign import ccall unsafe "hs_bindgen_1b7126ecf0f5ab6e" hs_bindgen_1b7126ecf0f5ab6e_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char2@
+hs_bindgen_1b7126ecf0f5ab6e ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_1b7126ecf0f5ab6e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1b7126ecf0f5ab6e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char2 = hs_bindgen_1b7126ecf0f5ab6e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char3@
+foreign import ccall unsafe "hs_bindgen_8ecc879598b6d3b0" hs_bindgen_8ecc879598b6d3b0_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char3@
+hs_bindgen_8ecc879598b6d3b0 ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_8ecc879598b6d3b0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8ecc879598b6d3b0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char3 = hs_bindgen_8ecc879598b6d3b0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short1@
+foreign import ccall unsafe "hs_bindgen_8e221273096c13a0" hs_bindgen_8e221273096c13a0_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short1@
+hs_bindgen_8e221273096c13a0 ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_8e221273096c13a0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8e221273096c13a0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short1 = hs_bindgen_8e221273096c13a0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short2@
+foreign import ccall unsafe "hs_bindgen_3de3762c82599242" hs_bindgen_3de3762c82599242_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short2@
+hs_bindgen_3de3762c82599242 ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_3de3762c82599242 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3de3762c82599242_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short2 = hs_bindgen_3de3762c82599242
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short3@
+foreign import ccall unsafe "hs_bindgen_14352acc60454580" hs_bindgen_14352acc60454580_base ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short3@
+hs_bindgen_14352acc60454580 ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+hs_bindgen_14352acc60454580 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_14352acc60454580_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short3 = hs_bindgen_14352acc60454580
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int1@
+foreign import ccall unsafe "hs_bindgen_96096b97ae514d84" hs_bindgen_96096b97ae514d84_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int1@
+hs_bindgen_96096b97ae514d84 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_96096b97ae514d84 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_96096b97ae514d84_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int1 = hs_bindgen_96096b97ae514d84
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int2@
+foreign import ccall unsafe "hs_bindgen_d049eccfdf55015b" hs_bindgen_d049eccfdf55015b_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int2@
+hs_bindgen_d049eccfdf55015b ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_d049eccfdf55015b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d049eccfdf55015b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int2 = hs_bindgen_d049eccfdf55015b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int3@
+foreign import ccall unsafe "hs_bindgen_9c1d57b596281f26" hs_bindgen_9c1d57b596281f26_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int3@
+hs_bindgen_9c1d57b596281f26 ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+hs_bindgen_9c1d57b596281f26 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9c1d57b596281f26_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int3 = hs_bindgen_9c1d57b596281f26
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long1@
+foreign import ccall unsafe "hs_bindgen_31684dbfb298f18c" hs_bindgen_31684dbfb298f18c_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long1@
+hs_bindgen_31684dbfb298f18c ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_31684dbfb298f18c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_31684dbfb298f18c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long1 = hs_bindgen_31684dbfb298f18c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long2@
+foreign import ccall unsafe "hs_bindgen_705e74ceba937567" hs_bindgen_705e74ceba937567_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long2@
+hs_bindgen_705e74ceba937567 ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_705e74ceba937567 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_705e74ceba937567_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long2 = hs_bindgen_705e74ceba937567
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long3@
+foreign import ccall unsafe "hs_bindgen_193cb3a5430102f3" hs_bindgen_193cb3a5430102f3_base ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long3@
+hs_bindgen_193cb3a5430102f3 ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+hs_bindgen_193cb3a5430102f3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_193cb3a5430102f3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CULong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long3 = hs_bindgen_193cb3a5430102f3
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_float@
+foreign import ccall unsafe "hs_bindgen_f1b87ec98a54b583" hs_bindgen_f1b87ec98a54b583_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_float@
+hs_bindgen_f1b87ec98a54b583 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_f1b87ec98a54b583 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f1b87ec98a54b583_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_float = hs_bindgen_f1b87ec98a54b583
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_double@
+foreign import ccall unsafe "hs_bindgen_da17ba710f71da80" hs_bindgen_da17ba710f71da80_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_double@
+hs_bindgen_da17ba710f71da80 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_da17ba710f71da80 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_da17ba710f71da80_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_double = hs_bindgen_da17ba710f71da80
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_bool1@
+foreign import ccall unsafe "hs_bindgen_9e15dd8dbce9cd83" hs_bindgen_9e15dd8dbce9cd83_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_bool1@
+hs_bindgen_9e15dd8dbce9cd83 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_9e15dd8dbce9cd83 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9e15dd8dbce9cd83_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_bool1 = hs_bindgen_9e15dd8dbce9cd83
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_struct@
+foreign import ccall unsafe "hs_bindgen_dc772c3e54b3ef41" hs_bindgen_dc772c3e54b3ef41_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_struct@
+hs_bindgen_dc772c3e54b3ef41 ::
+     BG.CInt
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_dc772c3e54b3ef41 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_dc772c3e54b3ef41_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_struct =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_dc772c3e54b3ef41 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_union@
+foreign import ccall unsafe "hs_bindgen_aabbe3419dcd3eb9" hs_bindgen_aabbe3419dcd3eb9_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_union@
+hs_bindgen_aabbe3419dcd3eb9 ::
+     BG.CInt
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_aabbe3419dcd3eb9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_aabbe3419dcd3eb9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_union =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_aabbe3419dcd3eb9 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_enum@
+foreign import ccall unsafe "hs_bindgen_731297a830e4c2df" hs_bindgen_731297a830e4c2df_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_enum@
+hs_bindgen_731297a830e4c2df ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_731297a830e4c2df =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_731297a830e4c2df_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_enum = hs_bindgen_731297a830e4c2df
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_31fc55b0aea434ba" hs_bindgen_31fc55b0aea434ba_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer1@
+hs_bindgen_31fc55b0aea434ba ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_31fc55b0aea434ba =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_31fc55b0aea434ba_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer1 = hs_bindgen_31fc55b0aea434ba
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_35aa32eabe6cbe1e" hs_bindgen_35aa32eabe6cbe1e_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer2@
+hs_bindgen_35aa32eabe6cbe1e ::
+     BG.CInt
+  -> BG.Ptr (BG.Ptr BG.CInt)
+  -> IO ()
+hs_bindgen_35aa32eabe6cbe1e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_35aa32eabe6cbe1e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr (BG.Ptr BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer2 = hs_bindgen_35aa32eabe6cbe1e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_c9941830193c9c20" hs_bindgen_c9941830193c9c20_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer3@
+hs_bindgen_c9941830193c9c20 ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+hs_bindgen_c9941830193c9c20 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c9941830193c9c20_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @arg3@
+  -> IO ()
+args_pointer3 = hs_bindgen_c9941830193c9c20
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_A@
+foreign import ccall unsafe "hs_bindgen_56c5534530515933" hs_bindgen_56c5534530515933_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_A@
+hs_bindgen_56c5534530515933 :: IO BG.CInt
+hs_bindgen_56c5534530515933 =
+  fmap BG.fromFFIType hs_bindgen_56c5534530515933_base
+
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A :: IO BG.CInt
+ret_A = hs_bindgen_56c5534530515933
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char1@
+foreign import ccall unsafe "hs_bindgen_e36cc4960e15ece8" hs_bindgen_e36cc4960e15ece8_base ::
+     BG.CInt
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char1@
+hs_bindgen_e36cc4960e15ece8 ::
+     BG.CInt
+  -> IO BG.CChar
+hs_bindgen_e36cc4960e15ece8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e36cc4960e15ece8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CChar
+ret_char1 = hs_bindgen_e36cc4960e15ece8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char2@
+foreign import ccall unsafe "hs_bindgen_39c01c6ee1b7364f" hs_bindgen_39c01c6ee1b7364f_base ::
+     BG.CInt
+  -> IO BG.CSChar
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char2@
+hs_bindgen_39c01c6ee1b7364f ::
+     BG.CInt
+  -> IO BG.CSChar
+hs_bindgen_39c01c6ee1b7364f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_39c01c6ee1b7364f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CSChar
+ret_char2 = hs_bindgen_39c01c6ee1b7364f
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char3@
+foreign import ccall unsafe "hs_bindgen_6a35179874816c94" hs_bindgen_6a35179874816c94_base ::
+     BG.CInt
+  -> IO BG.CUChar
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char3@
+hs_bindgen_6a35179874816c94 ::
+     BG.CInt
+  -> IO BG.CUChar
+hs_bindgen_6a35179874816c94 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6a35179874816c94_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUChar
+ret_char3 = hs_bindgen_6a35179874816c94
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short1@
+foreign import ccall unsafe "hs_bindgen_9bb2bb254d5dc1c0" hs_bindgen_9bb2bb254d5dc1c0_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short1@
+hs_bindgen_9bb2bb254d5dc1c0 ::
+     BG.CInt
+  -> IO BG.CShort
+hs_bindgen_9bb2bb254d5dc1c0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9bb2bb254d5dc1c0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short1 = hs_bindgen_9bb2bb254d5dc1c0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short2@
+foreign import ccall unsafe "hs_bindgen_6797eb02f4ac3ebe" hs_bindgen_6797eb02f4ac3ebe_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short2@
+hs_bindgen_6797eb02f4ac3ebe ::
+     BG.CInt
+  -> IO BG.CShort
+hs_bindgen_6797eb02f4ac3ebe =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6797eb02f4ac3ebe_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short2 = hs_bindgen_6797eb02f4ac3ebe
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short3@
+foreign import ccall unsafe "hs_bindgen_615bd7df3e0134a2" hs_bindgen_615bd7df3e0134a2_base ::
+     BG.CInt
+  -> IO BG.CUShort
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short3@
+hs_bindgen_615bd7df3e0134a2 ::
+     BG.CInt
+  -> IO BG.CUShort
+hs_bindgen_615bd7df3e0134a2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_615bd7df3e0134a2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUShort
+ret_short3 = hs_bindgen_615bd7df3e0134a2
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int1@
+foreign import ccall unsafe "hs_bindgen_4fe4545529e753b8" hs_bindgen_4fe4545529e753b8_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int1@
+hs_bindgen_4fe4545529e753b8 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_4fe4545529e753b8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4fe4545529e753b8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int1 = hs_bindgen_4fe4545529e753b8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int2@
+foreign import ccall unsafe "hs_bindgen_f6e5d129c69c5afe" hs_bindgen_f6e5d129c69c5afe_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int2@
+hs_bindgen_f6e5d129c69c5afe ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_f6e5d129c69c5afe =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f6e5d129c69c5afe_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int2 = hs_bindgen_f6e5d129c69c5afe
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int3@
+foreign import ccall unsafe "hs_bindgen_9551ec72ba55d7a7" hs_bindgen_9551ec72ba55d7a7_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int3@
+hs_bindgen_9551ec72ba55d7a7 ::
+     BG.CInt
+  -> IO BG.CUInt
+hs_bindgen_9551ec72ba55d7a7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9551ec72ba55d7a7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUInt
+ret_int3 = hs_bindgen_9551ec72ba55d7a7
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long1@
+foreign import ccall unsafe "hs_bindgen_e0d1c177d41a7ce8" hs_bindgen_e0d1c177d41a7ce8_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long1@
+hs_bindgen_e0d1c177d41a7ce8 ::
+     BG.CInt
+  -> IO BG.CLong
+hs_bindgen_e0d1c177d41a7ce8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e0d1c177d41a7ce8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long1 = hs_bindgen_e0d1c177d41a7ce8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long2@
+foreign import ccall unsafe "hs_bindgen_42fbed00ce6b7b08" hs_bindgen_42fbed00ce6b7b08_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long2@
+hs_bindgen_42fbed00ce6b7b08 ::
+     BG.CInt
+  -> IO BG.CLong
+hs_bindgen_42fbed00ce6b7b08 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_42fbed00ce6b7b08_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long2 = hs_bindgen_42fbed00ce6b7b08
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long3@
+foreign import ccall unsafe "hs_bindgen_ed9a248d2e643a4b" hs_bindgen_ed9a248d2e643a4b_base ::
+     BG.CInt
+  -> IO BG.CULong
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long3@
+hs_bindgen_ed9a248d2e643a4b ::
+     BG.CInt
+  -> IO BG.CULong
+hs_bindgen_ed9a248d2e643a4b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ed9a248d2e643a4b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CULong
+ret_long3 = hs_bindgen_ed9a248d2e643a4b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_float@
+foreign import ccall unsafe "hs_bindgen_ff0e9b4eaea0329a" hs_bindgen_ff0e9b4eaea0329a_base ::
+     BG.CInt
+  -> IO BG.CFloat
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_float@
+hs_bindgen_ff0e9b4eaea0329a ::
+     BG.CInt
+  -> IO BG.CFloat
+hs_bindgen_ff0e9b4eaea0329a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ff0e9b4eaea0329a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CFloat
+ret_float = hs_bindgen_ff0e9b4eaea0329a
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_double@
+foreign import ccall unsafe "hs_bindgen_164a83641655c836" hs_bindgen_164a83641655c836_base ::
+     BG.CInt
+  -> IO BG.CDouble
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_double@
+hs_bindgen_164a83641655c836 ::
+     BG.CInt
+  -> IO BG.CDouble
+hs_bindgen_164a83641655c836 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_164a83641655c836_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CDouble
+ret_double = hs_bindgen_164a83641655c836
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_53d6d79b1b401e62" hs_bindgen_53d6d79b1b401e62_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_bool1@
+hs_bindgen_53d6d79b1b401e62 ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_53d6d79b1b401e62 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_53d6d79b1b401e62_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+ret_bool1 = hs_bindgen_53d6d79b1b401e62
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_struct@
+foreign import ccall unsafe "hs_bindgen_75308badf37284ce" hs_bindgen_75308badf37284ce_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_struct@
+hs_bindgen_75308badf37284ce ::
+     BG.CInt
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_75308badf37284ce =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_75308badf37284ce_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_struct
+ret_struct =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_75308badf37284ce arg10 res1)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_union@
+foreign import ccall unsafe "hs_bindgen_b9ab05b4990fb8dd" hs_bindgen_b9ab05b4990fb8dd_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_union@
+hs_bindgen_b9ab05b4990fb8dd ::
+     BG.CInt
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_b9ab05b4990fb8dd =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b9ab05b4990fb8dd_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_union
+ret_union =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_b9ab05b4990fb8dd arg10 res1)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_enum@
+foreign import ccall unsafe "hs_bindgen_c46aafe01e3abbca" hs_bindgen_c46aafe01e3abbca_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_enum@
+hs_bindgen_c46aafe01e3abbca ::
+     BG.CInt
+  -> IO Some_enum
+hs_bindgen_c46aafe01e3abbca =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c46aafe01e3abbca_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_enum
+ret_enum = hs_bindgen_c46aafe01e3abbca
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_afcc67a9788584d9" hs_bindgen_afcc67a9788584d9_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer1@
+hs_bindgen_afcc67a9788584d9 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_afcc67a9788584d9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_afcc67a9788584d9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+ret_pointer1 = hs_bindgen_afcc67a9788584d9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_234d0979dbe93733" hs_bindgen_234d0979dbe93733_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer2@
+hs_bindgen_234d0979dbe93733 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_234d0979dbe93733 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_234d0979dbe93733_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+ret_pointer2 = hs_bindgen_234d0979dbe93733
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_6f3f7c624556cfb3" hs_bindgen_6f3f7c624556cfb3_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer3@
+hs_bindgen_6f3f7c624556cfb3 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_6f3f7c624556cfb3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6f3f7c624556cfb3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.Void)
+ret_pointer3 = hs_bindgen_6f3f7c624556cfb3
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body1@
+foreign import ccall unsafe "hs_bindgen_c9d515b8a02ca235" hs_bindgen_c9d515b8a02ca235_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body1@
+hs_bindgen_c9d515b8a02ca235 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_c9d515b8a02ca235 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c9d515b8a02ca235_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+body1 = hs_bindgen_c9d515b8a02ca235
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body2@
+foreign import ccall unsafe "hs_bindgen_d6e10c899b553af9" hs_bindgen_d6e10c899b553af9_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body2@
+hs_bindgen_d6e10c899b553af9 :: IO BG.CInt
+hs_bindgen_d6e10c899b553af9 =
+  fmap BG.fromFFIType hs_bindgen_d6e10c899b553af9_base
+
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2 :: IO BG.CInt
+body2 = hs_bindgen_d6e10c899b553af9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_433860c3d6edf28b" hs_bindgen_433860c3d6edf28b_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_float@
+hs_bindgen_433860c3d6edf28b ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_433860c3d6edf28b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_433860c3d6edf28b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_float =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_433860c3d6edf28b arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_8e44029c12a7dddb" hs_bindgen_8e44029c12a7dddb_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_double@
+hs_bindgen_8e44029c12a7dddb ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_8e44029c12a7dddb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8e44029c12a7dddb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_double =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_8e44029c12a7dddb arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_0dc01ff2cd8fc565" hs_bindgen_0dc01ff2cd8fc565_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_float@
+hs_bindgen_0dc01ff2cd8fc565 ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_0dc01ff2cd8fc565 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0dc01ff2cd8fc565_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CFloat)
+ret_complex_float =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_0dc01ff2cd8fc565 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_8f2ebb486a336f80" hs_bindgen_8f2ebb486a336f80_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_double@
+hs_bindgen_8f2ebb486a336f80 ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_8f2ebb486a336f80 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8f2ebb486a336f80_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CDouble)
+ret_complex_double =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_8f2ebb486a336f80 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_26be4a823dc56e01" hs_bindgen_26be4a823dc56e01_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args1@
+hs_bindgen_26be4a823dc56e01 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_26be4a823dc56e01 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_26be4a823dc56e01_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args1 = hs_bindgen_26be4a823dc56e01
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_6212b2750a2d5997" hs_bindgen_6212b2750a2d5997_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args2@
+hs_bindgen_6212b2750a2d5997 ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_6212b2750a2d5997 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6212b2750a2d5997_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args2 = hs_bindgen_6212b2750a2d5997
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_e553247e80e3e159" hs_bindgen_e553247e80e3e159_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret1@
+hs_bindgen_e553247e80e3e159 ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_e553247e80e3e159 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e553247e80e3e159_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+bespoke_ret1 = hs_bindgen_e553247e80e3e159
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_72a7f6cf38bcb00c" hs_bindgen_72a7f6cf38bcb00c_base ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret2@
+hs_bindgen_72a7f6cf38bcb00c ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_72a7f6cf38bcb00c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_72a7f6cf38bcb00c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO HsBindgen.Runtime.LibC.CSize
+bespoke_ret2 = hs_bindgen_72a7f6cf38bcb00c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args1@
+foreign import ccall unsafe "hs_bindgen_dc7cacd7dbb61f43" hs_bindgen_dc7cacd7dbb61f43_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args1@
+hs_bindgen_dc7cacd7dbb61f43 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_dc7cacd7dbb61f43 =
+  \x0 ->
+    hs_bindgen_dc7cacd7dbb61f43_base (BG.toFFIType x0)
+
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args1 = hs_bindgen_dc7cacd7dbb61f43
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args2@
+foreign import ccall unsafe "hs_bindgen_09d9010cbf3c8d41" hs_bindgen_09d9010cbf3c8d41_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args2@
+hs_bindgen_09d9010cbf3c8d41 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_09d9010cbf3c8d41 =
+  \x0 ->
+    hs_bindgen_09d9010cbf3c8d41_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args2 = hs_bindgen_09d9010cbf3c8d41
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args3@
+foreign import ccall unsafe "hs_bindgen_37e1f318a8ae501c" hs_bindgen_37e1f318a8ae501c_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args3@
+hs_bindgen_37e1f318a8ae501c ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt))
+  -> IO ()
+hs_bindgen_37e1f318a8ae501c =
+  \x0 ->
+    hs_bindgen_37e1f318a8ae501c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args3 = hs_bindgen_37e1f318a8ae501c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args4@
+foreign import ccall unsafe "hs_bindgen_d9440a8b6d2848ff" hs_bindgen_d9440a8b6d2848ff_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args4@
+hs_bindgen_d9440a8b6d2848ff ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_d9440a8b6d2848ff =
+  \x0 ->
+    hs_bindgen_d9440a8b6d2848ff_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args4 = hs_bindgen_d9440a8b6d2848ff
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_ca61df80135a11f9" hs_bindgen_ca61df80135a11f9_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args1@
+hs_bindgen_ca61df80135a11f9 ::
+     BG.CInt
+  -> BG.FunPtr (IO ())
+  -> IO ()
+hs_bindgen_ca61df80135a11f9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ca61df80135a11f9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args1 = hs_bindgen_ca61df80135a11f9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_2e803412f5250381" hs_bindgen_2e803412f5250381_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args2@
+hs_bindgen_2e803412f5250381 ::
+     BG.CInt
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_2e803412f5250381 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2e803412f5250381_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args2 = hs_bindgen_2e803412f5250381
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_1839323a7de53e04" hs_bindgen_1839323a7de53e04_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args3@
+hs_bindgen_1839323a7de53e04 ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_1839323a7de53e04 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1839323a7de53e04_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args3 = hs_bindgen_1839323a7de53e04
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_1966f50d5deb0a77" hs_bindgen_1966f50d5deb0a77_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args4@
+hs_bindgen_1966f50d5deb0a77 ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+  -> IO ()
+hs_bindgen_1966f50d5deb0a77 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1966f50d5deb0a77_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args4 = hs_bindgen_1966f50d5deb0a77
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_3eacaa3550feb706" hs_bindgen_3eacaa3550feb706_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args5@
+hs_bindgen_3eacaa3550feb706 ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+  -> IO ()
+hs_bindgen_3eacaa3550feb706 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3eacaa3550feb706_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args5 = hs_bindgen_3eacaa3550feb706
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_comments1@
+foreign import ccall unsafe "hs_bindgen_42f3fad04f4a62c7" hs_bindgen_42f3fad04f4a62c7_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_comments1@
+hs_bindgen_42f3fad04f4a62c7 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_42f3fad04f4a62c7 =
+  \x0 ->
+    hs_bindgen_42f3fad04f4a62c7_base (BG.toFFIType x0)
+
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+comments1 = hs_bindgen_42f3fad04f4a62c7
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_40fa2adcbadaabf4" hs_bindgen_40fa2adcbadaabf4_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before1@
+hs_bindgen_40fa2adcbadaabf4 ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_40fa2adcbadaabf4 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_40fa2adcbadaabf4_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before1 = hs_bindgen_40fa2adcbadaabf4
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_6560ce91395cf6bf" hs_bindgen_6560ce91395cf6bf_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before2@
+hs_bindgen_6560ce91395cf6bf ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_6560ce91395cf6bf =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6560ce91395cf6bf_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before2 = hs_bindgen_6560ce91395cf6bf
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_fab04df1b737308d" hs_bindgen_fab04df1b737308d_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before3@
+hs_bindgen_fab04df1b737308d ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_fab04df1b737308d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_fab04df1b737308d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before3 = hs_bindgen_fab04df1b737308d
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_3762ecefd71c40d3" hs_bindgen_3762ecefd71c40d3_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after1@
+hs_bindgen_3762ecefd71c40d3 ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_3762ecefd71c40d3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3762ecefd71c40d3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after1 = hs_bindgen_3762ecefd71c40d3
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_b3ecb163df7d32c8" hs_bindgen_b3ecb163df7d32c8_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after2@
+hs_bindgen_b3ecb163df7d32c8 ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_b3ecb163df7d32c8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b3ecb163df7d32c8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after2 = hs_bindgen_b3ecb163df7d32c8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_706270fd83faddb0" hs_bindgen_706270fd83faddb0_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after3@
+hs_bindgen_706270fd83faddb0 ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_706270fd83faddb0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_706270fd83faddb0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after3 = hs_bindgen_706270fd83faddb0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_ff637beb32dc5931" hs_bindgen_ff637beb32dc5931_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before1@
+hs_bindgen_ff637beb32dc5931 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_ff637beb32dc5931 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ff637beb32dc5931_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before1 =
+  hs_bindgen_ff637beb32dc5931
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_3e0e5c2fa1b03a68" hs_bindgen_3e0e5c2fa1b03a68_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before2@
+hs_bindgen_3e0e5c2fa1b03a68 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_3e0e5c2fa1b03a68 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3e0e5c2fa1b03a68_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before2 =
+  hs_bindgen_3e0e5c2fa1b03a68
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_81eefcf233fd167c" hs_bindgen_81eefcf233fd167c_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before3@
+hs_bindgen_81eefcf233fd167c ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_81eefcf233fd167c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_81eefcf233fd167c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before3 =
+  hs_bindgen_81eefcf233fd167c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_1c849843004ee65e" hs_bindgen_1c849843004ee65e_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before4@
+hs_bindgen_1c849843004ee65e ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_1c849843004ee65e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1c849843004ee65e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_1c849843004ee65e arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_c85d4a53a6e1e963" hs_bindgen_c85d4a53a6e1e963_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before5@
+hs_bindgen_c85d4a53a6e1e963 ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_c85d4a53a6e1e963 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c85d4a53a6e1e963_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_c85d4a53a6e1e963 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_796c19d2df50b65f" hs_bindgen_796c19d2df50b65f_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before6@
+hs_bindgen_796c19d2df50b65f ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_796c19d2df50b65f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_796c19d2df50b65f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before6 =
+  hs_bindgen_796c19d2df50b65f
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_0950b2ec97db5b00" hs_bindgen_0950b2ec97db5b00_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before7@
+hs_bindgen_0950b2ec97db5b00 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_0950b2ec97db5b00 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0950b2ec97db5b00_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before7 =
+  hs_bindgen_0950b2ec97db5b00
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_375085e61e85a2a8" hs_bindgen_375085e61e85a2a8_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before8@
+hs_bindgen_375085e61e85a2a8 ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_375085e61e85a2a8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_375085e61e85a2a8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before8 =
+  hs_bindgen_375085e61e85a2a8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_2bb6a1d152a87f63" hs_bindgen_2bb6a1d152a87f63_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after1@
+hs_bindgen_2bb6a1d152a87f63 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_2bb6a1d152a87f63 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2bb6a1d152a87f63_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after1 =
+  hs_bindgen_2bb6a1d152a87f63
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_2753c469629474c2" hs_bindgen_2753c469629474c2_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after2@
+hs_bindgen_2753c469629474c2 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_2753c469629474c2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2753c469629474c2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after2 =
+  hs_bindgen_2753c469629474c2
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_5c96f0d6c5fd53b1" hs_bindgen_5c96f0d6c5fd53b1_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after3@
+hs_bindgen_5c96f0d6c5fd53b1 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_5c96f0d6c5fd53b1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5c96f0d6c5fd53b1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after3 =
+  hs_bindgen_5c96f0d6c5fd53b1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_e8d4acc6356ca49d" hs_bindgen_e8d4acc6356ca49d_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after4@
+hs_bindgen_e8d4acc6356ca49d ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_e8d4acc6356ca49d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e8d4acc6356ca49d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_e8d4acc6356ca49d arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_6762b5473d8d350a" hs_bindgen_6762b5473d8d350a_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after5@
+hs_bindgen_6762b5473d8d350a ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_6762b5473d8d350a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6762b5473d8d350a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_6762b5473d8d350a arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_55d5e45034c9f572" hs_bindgen_55d5e45034c9f572_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after6@
+hs_bindgen_55d5e45034c9f572 ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_55d5e45034c9f572 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_55d5e45034c9f572_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after6 =
+  hs_bindgen_55d5e45034c9f572
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_70dae000d43d8228" hs_bindgen_70dae000d43d8228_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after7@
+hs_bindgen_70dae000d43d8228 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_70dae000d43d8228 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_70dae000d43d8228_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after7 =
+  hs_bindgen_70dae000d43d8228
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_85e787c823b6c95f" hs_bindgen_85e787c823b6c95f_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after8@
+hs_bindgen_85e787c823b6c95f ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_85e787c823b6c95f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_85e787c823b6c95f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after8 =
+  hs_bindgen_85e787c823b6c95f
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_efb5ca5187af5610" hs_bindgen_efb5ca5187af5610_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args1@
+hs_bindgen_efb5ca5187af5610 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_efb5ca5187af5610 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_efb5ca5187af5610_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args1 = hs_bindgen_efb5ca5187af5610
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_e306bbd2d4a374fc" hs_bindgen_e306bbd2d4a374fc_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args2@
+hs_bindgen_e306bbd2d4a374fc ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_e306bbd2d4a374fc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e306bbd2d4a374fc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args2 = hs_bindgen_e306bbd2d4a374fc
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_960be6e90be0e7c1" hs_bindgen_960be6e90be0e7c1_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args3@
+hs_bindgen_960be6e90be0e7c1 ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_960be6e90be0e7c1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_960be6e90be0e7c1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args3 = hs_bindgen_960be6e90be0e7c1
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_00950eca61f28e52" hs_bindgen_00950eca61f28e52_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args4@
+hs_bindgen_00950eca61f28e52 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_00950eca61f28e52 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_00950eca61f28e52_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args4 = hs_bindgen_00950eca61f28e52
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_96b40db09db83748" hs_bindgen_96b40db09db83748_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args5@
+hs_bindgen_96b40db09db83748 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_96b40db09db83748 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_96b40db09db83748_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args5 = hs_bindgen_96b40db09db83748
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_035d9da3770aeff8" hs_bindgen_035d9da3770aeff8_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret1@
+hs_bindgen_035d9da3770aeff8 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_035d9da3770aeff8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_035d9da3770aeff8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret1 = hs_bindgen_035d9da3770aeff8
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_0d195040558fbef7" hs_bindgen_0d195040558fbef7_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret2@
+hs_bindgen_0d195040558fbef7 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_0d195040558fbef7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0d195040558fbef7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret2 = hs_bindgen_0d195040558fbef7
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_9d5a35ded6d43b33" hs_bindgen_9d5a35ded6d43b33_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret3@
+hs_bindgen_9d5a35ded6d43b33 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_9d5a35ded6d43b33 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9d5a35ded6d43b33_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+const_pointers_ret3 = hs_bindgen_9d5a35ded6d43b33
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_b00ca0cfd4037848" hs_bindgen_b00ca0cfd4037848_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret4@
+hs_bindgen_b00ca0cfd4037848 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_b00ca0cfd4037848 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b00ca0cfd4037848_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret4 = hs_bindgen_b00ca0cfd4037848
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_da92f752b03da901" hs_bindgen_da92f752b03da901_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret5@
+hs_bindgen_da92f752b03da901 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_da92f752b03da901 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_da92f752b03da901_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret5 = hs_bindgen_da92f752b03da901
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_fdc3e3307cac5fd0" hs_bindgen_fdc3e3307cac5fd0_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem1@
+hs_bindgen_fdc3e3307cac5fd0 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_fdc3e3307cac5fd0 =
+  \x0 ->
+    hs_bindgen_fdc3e3307cac5fd0_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem1 = hs_bindgen_fdc3e3307cac5fd0
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_cecdce9d64ac85d4" hs_bindgen_cecdce9d64ac85d4_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem2@
+hs_bindgen_cecdce9d64ac85d4 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt)))
+  -> IO ()
+hs_bindgen_cecdce9d64ac85d4 =
+  \x0 ->
+    hs_bindgen_cecdce9d64ac85d4_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem2 = hs_bindgen_cecdce9d64ac85d4
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_9ee7979e72b4baf6" hs_bindgen_9ee7979e72b4baf6_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem3@
+hs_bindgen_9ee7979e72b4baf6 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_9ee7979e72b4baf6 =
+  \x0 ->
+    hs_bindgen_9ee7979e72b4baf6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem3 = hs_bindgen_9ee7979e72b4baf6
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams1@
+foreign import ccall unsafe "hs_bindgen_c6e158d421dda2ac" hs_bindgen_c6e158d421dda2ac_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams1@
+hs_bindgen_c6e158d421dda2ac :: IO BG.CInt
+hs_bindgen_c6e158d421dda2ac =
+  fmap BG.fromFFIType hs_bindgen_c6e158d421dda2ac_base
+
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1 :: IO BG.CInt
+noParams1 = hs_bindgen_c6e158d421dda2ac
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams2@
+foreign import ccall unsafe "hs_bindgen_a34e536ea5931d76" hs_bindgen_a34e536ea5931d76_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams2@
+hs_bindgen_a34e536ea5931d76 :: IO BG.CInt
+hs_bindgen_a34e536ea5931d76 =
+  fmap BG.fromFFIType hs_bindgen_a34e536ea5931d76_base
+
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2 :: IO BG.CInt
+noParams2 = hs_bindgen_a34e536ea5931d76
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams3@
+foreign import ccall unsafe "hs_bindgen_80f6772cd6dfe2a9" hs_bindgen_80f6772cd6dfe2a9_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams3@
+hs_bindgen_80f6772cd6dfe2a9 ::
+     BG.CInt
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_80f6772cd6dfe2a9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_80f6772cd6dfe2a9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+noParams3 = hs_bindgen_80f6772cd6dfe2a9
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_8938b867c00625aa" hs_bindgen_8938b867c00625aa_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret1@
+hs_bindgen_8938b867c00625aa ::
+     BG.CInt
+  -> IO (BG.FunPtr (IO ()))
+hs_bindgen_8938b867c00625aa =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8938b867c00625aa_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO ()))
+funptr_ret1 = hs_bindgen_8938b867c00625aa
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_03ba9af419f7c750" hs_bindgen_03ba9af419f7c750_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret2@
+hs_bindgen_03ba9af419f7c750 ::
+     BG.CInt
+  -> IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_03ba9af419f7c750 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_03ba9af419f7c750_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO BG.CInt))
+funptr_ret2 = hs_bindgen_03ba9af419f7c750
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_c53c44ca84d8cb81" hs_bindgen_c53c44ca84d8cb81_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret3@
+hs_bindgen_c53c44ca84d8cb81 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_c53c44ca84d8cb81 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c53c44ca84d8cb81_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+funptr_ret3 = hs_bindgen_c53c44ca84d8cb81
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_fb5431b884cc209e" hs_bindgen_fb5431b884cc209e_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret4@
+hs_bindgen_fb5431b884cc209e ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+hs_bindgen_fb5431b884cc209e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fb5431b884cc209e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+funptr_ret4 = hs_bindgen_fb5431b884cc209e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_b45419cebf6cb43d" hs_bindgen_b45419cebf6cb43d_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret5@
+hs_bindgen_b45419cebf6cb43d ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_b45419cebf6cb43d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b45419cebf6cb43d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret5 = hs_bindgen_b45419cebf6cb43d
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_5c14b480ba3cab1e" hs_bindgen_5c14b480ba3cab1e_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret6@
+hs_bindgen_5c14b480ba3cab1e ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_5c14b480ba3cab1e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5c14b480ba3cab1e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret6 = hs_bindgen_5c14b480ba3cab1e
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_b8f93b6ff6ce2b1c" hs_bindgen_b8f93b6ff6ce2b1c_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret7@
+hs_bindgen_b8f93b6ff6ce2b1c ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_b8f93b6ff6ce2b1c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b8f93b6ff6ce2b1c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret7 = hs_bindgen_b8f93b6ff6ce2b1c
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_74e1d2bf9ed6b1c5" hs_bindgen_74e1d2bf9ed6b1c5_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret8@
+hs_bindgen_74e1d2bf9ed6b1c5 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_74e1d2bf9ed6b1c5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_74e1d2bf9ed6b1c5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret8 = hs_bindgen_74e1d2bf9ed6b1c5
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_8e68b5e49b407e0b" hs_bindgen_8e68b5e49b407e0b_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret9@
+hs_bindgen_8e68b5e49b407e0b ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_8e68b5e49b407e0b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8e68b5e49b407e0b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret9 = hs_bindgen_8e68b5e49b407e0b
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_1fc54cf36aa5566f" hs_bindgen_1fc54cf36aa5566f_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret10@
+hs_bindgen_1fc54cf36aa5566f ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_1fc54cf36aa5566f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1fc54cf36aa5566f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret10 = hs_bindgen_1fc54cf36aa5566f
diff --git a/test-artefacts/fixtures/macros/reparse.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.1.empty/bindingspec.yaml
@@ -0,0 +1,844 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse.h
+  cname: struct some_struct
+  hsname: Some_struct
+- headers: macros/reparse.h
+  cname: union some_union
+  hsname: Some_union
+- headers: macros/reparse.h
+  cname: enum some_enum
+  hsname: Some_enum
+  enum: open
+- headers: macros/reparse.h
+  cname: arr_typedef1
+  hsname: Arr_typedef1
+- headers: macros/reparse.h
+  cname: arr_typedef2
+  hsname: Arr_typedef2
+- headers: macros/reparse.h
+  cname: arr_typedef3
+  hsname: Arr_typedef3
+- headers: macros/reparse.h
+  cname: arr_typedef4
+  hsname: Arr_typedef4
+- headers: macros/reparse.h
+  cname: typedef1
+  hsname: Typedef1
+- headers: macros/reparse.h
+  cname: typedef2
+  hsname: Typedef2
+- headers: macros/reparse.h
+  cname: typedef3
+  hsname: Typedef3
+- headers: macros/reparse.h
+  cname: funptr_typedef1
+  hsname: Funptr_typedef1
+- headers: macros/reparse.h
+  cname: funptr_typedef2
+  hsname: Funptr_typedef2
+- headers: macros/reparse.h
+  cname: funptr_typedef3
+  hsname: Funptr_typedef3
+- headers: macros/reparse.h
+  cname: funptr_typedef4
+  hsname: Funptr_typedef4
+- headers: macros/reparse.h
+  cname: funptr_typedef5
+  hsname: Funptr_typedef5
+- headers: macros/reparse.h
+  cname: comments2
+  hsname: Comments2
+- headers: macros/reparse.h
+  cname: struct example_struct
+  hsname: Example_struct
+- headers: macros/reparse.h
+  cname: const_typedef1
+  hsname: Const_typedef1
+- headers: macros/reparse.h
+  cname: const_typedef2
+  hsname: Const_typedef2
+- headers: macros/reparse.h
+  cname: const_typedef3
+  hsname: Const_typedef3
+- headers: macros/reparse.h
+  cname: const_typedef4
+  hsname: Const_typedef4
+- headers: macros/reparse.h
+  cname: const_typedef5
+  hsname: Const_typedef5
+- headers: macros/reparse.h
+  cname: const_typedef6
+  hsname: Const_typedef6
+- headers: macros/reparse.h
+  cname: const_typedef7
+  hsname: Const_typedef7
+- headers: macros/reparse.h
+  cname: struct example_struct_with_const
+  hsname: Example_struct_with_const
+- headers: macros/reparse.h
+  cname: const_funptr1
+  hsname: Const_funptr1
+- headers: macros/reparse.h
+  cname: const_funptr2
+  hsname: Const_funptr2
+- headers: macros/reparse.h
+  cname: const_funptr3
+  hsname: Const_funptr3
+- headers: macros/reparse.h
+  cname: const_funptr4
+  hsname: Const_funptr4
+- headers: macros/reparse.h
+  cname: const_funptr5
+  hsname: Const_funptr5
+- headers: macros/reparse.h
+  cname: const_funptr6
+  hsname: Const_funptr6
+- headers: macros/reparse.h
+  cname: const_funptr7
+  hsname: Const_funptr7
+hstypes:
+- hsname: Arr_typedef1
+  representation:
+    newtype:
+      constructor: Arr_typedef1
+      fields:
+      - unwrapArr_typedef1
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: Arr_typedef2
+  representation:
+    newtype:
+      constructor: Arr_typedef2
+      fields:
+      - unwrapArr_typedef2
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: Arr_typedef3
+  representation:
+    newtype:
+      constructor: Arr_typedef3
+      fields:
+      - unwrapArr_typedef3
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Arr_typedef4
+  representation:
+    newtype:
+      constructor: Arr_typedef4
+      fields:
+      - unwrapArr_typedef4
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Comments2
+  representation:
+    newtype:
+      constructor: Comments2
+      fields:
+      - unwrapComments2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr1
+  representation:
+    newtype:
+      constructor: Const_funptr1
+      fields:
+      - unwrapConst_funptr1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr2
+  representation:
+    newtype:
+      constructor: Const_funptr2
+      fields:
+      - unwrapConst_funptr2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr3
+  representation:
+    newtype:
+      constructor: Const_funptr3
+      fields:
+      - unwrapConst_funptr3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr4
+  representation:
+    newtype:
+      constructor: Const_funptr4
+      fields:
+      - unwrapConst_funptr4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr5
+  representation:
+    newtype:
+      constructor: Const_funptr5
+      fields:
+      - unwrapConst_funptr5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr6
+  representation:
+    newtype:
+      constructor: Const_funptr6
+      fields:
+      - unwrapConst_funptr6
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr7
+  representation:
+    newtype:
+      constructor: Const_funptr7
+      fields:
+      - unwrapConst_funptr7
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef1
+  representation:
+    newtype:
+      constructor: Const_typedef1
+      fields:
+      - unwrapConst_typedef1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef2
+  representation:
+    newtype:
+      constructor: Const_typedef2
+      fields:
+      - unwrapConst_typedef2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef3
+  representation:
+    newtype:
+      constructor: Const_typedef3
+      fields:
+      - unwrapConst_typedef3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef4
+  representation:
+    newtype:
+      constructor: Const_typedef4
+      fields:
+      - unwrapConst_typedef4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef5
+  representation:
+    newtype:
+      constructor: Const_typedef5
+      fields:
+      - unwrapConst_typedef5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef6
+  representation:
+    newtype:
+      constructor: Const_typedef6
+      fields:
+      - unwrapConst_typedef6
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef7
+  representation:
+    newtype:
+      constructor: Const_typedef7
+      fields:
+      - unwrapConst_typedef7
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Example_struct
+  representation:
+    record:
+      constructor: Example_struct
+      fields:
+      - example_struct_field1
+      - example_struct_field2
+      - example_struct_field3
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Example_struct_with_const
+  representation:
+    record:
+      constructor: Example_struct_with_const
+      fields:
+      - example_struct_with_const_const_field1
+      - example_struct_with_const_const_field2
+      - example_struct_with_const_const_field3
+      - example_struct_with_const_const_field4
+      - example_struct_with_const_const_field5
+      - example_struct_with_const_const_field6
+      - example_struct_with_const_const_field7
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef1
+  representation:
+    newtype:
+      constructor: Funptr_typedef1
+      fields:
+      - unwrapFunptr_typedef1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef2
+  representation:
+    newtype:
+      constructor: Funptr_typedef2
+      fields:
+      - unwrapFunptr_typedef2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef3
+  representation:
+    newtype:
+      constructor: Funptr_typedef3
+      fields:
+      - unwrapFunptr_typedef3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef4
+  representation:
+    newtype:
+      constructor: Funptr_typedef4
+      fields:
+      - unwrapFunptr_typedef4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef5
+  representation:
+    newtype:
+      constructor: Funptr_typedef5
+      fields:
+      - unwrapFunptr_typedef5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_enum
+  representation:
+    newtype:
+      constructor: Some_enum
+      fields:
+      - unwrapSome_enum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_struct
+  representation:
+    record:
+      constructor: Some_struct
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_union
+  representation:
+    newtype:
+      constructor: Some_union
+      fields:
+      - unwrapSome_union
+  instances:
+  - Generic
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef1
+  representation:
+    newtype:
+      constructor: Typedef1
+      fields:
+      - unwrapTypedef1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef2
+  representation:
+    newtype:
+      constructor: Typedef2
+      fields:
+      - unwrapTypedef2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef3
+  representation:
+    newtype:
+      constructor: Typedef3
+      fields:
+      - unwrapTypedef3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.1.empty/th.txt
@@ -0,0 +1,12055 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile test-artefacts/headers/golden/macros/reparse.h
+-- #include <macros/reparse.h>
+-- void hs_bindgen_9950741591b35cb0 (
+--   signed int arg1,
+--   char arg2
+-- )
+-- {
+--   (args_char1)(arg1, arg2);
+-- }
+-- void hs_bindgen_3b213f36de64a78b (
+--   signed int arg1,
+--   signed char arg2
+-- )
+-- {
+--   (args_char2)(arg1, arg2);
+-- }
+-- void hs_bindgen_d72da53837273ed1 (
+--   signed int arg1,
+--   unsigned char arg2
+-- )
+-- {
+--   (args_char3)(arg1, arg2);
+-- }
+-- void hs_bindgen_8e00ad94407efdce (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short1)(arg1, arg2);
+-- }
+-- void hs_bindgen_e5814201b232d64c (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short2)(arg1, arg2);
+-- }
+-- void hs_bindgen_3bbb21d02f9e8caa (
+--   signed int arg1,
+--   unsigned short arg2
+-- )
+-- {
+--   (args_short3)(arg1, arg2);
+-- }
+-- void hs_bindgen_fba8d44819fb4d50 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int1)(arg1, arg2);
+-- }
+-- void hs_bindgen_42cfc5afda432a51 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int2)(arg1, arg2);
+-- }
+-- void hs_bindgen_b877c77021f548cb (
+--   signed int arg1,
+--   unsigned int arg2
+-- )
+-- {
+--   (args_int3)(arg1, arg2);
+-- }
+-- void hs_bindgen_365ed0d5f00ece62 (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long1)(arg1, arg2);
+-- }
+-- void hs_bindgen_a1204b1083b6700a (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long2)(arg1, arg2);
+-- }
+-- void hs_bindgen_4af0668f1653ce01 (
+--   signed int arg1,
+--   unsigned long arg2
+-- )
+-- {
+--   (args_long3)(arg1, arg2);
+-- }
+-- void hs_bindgen_b8acf83f3c3a43b0 (
+--   signed int arg1,
+--   float arg2
+-- )
+-- {
+--   (args_float)(arg1, arg2);
+-- }
+-- void hs_bindgen_2a27bb82268cc870 (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   (args_double)(arg1, arg2);
+-- }
+-- void hs_bindgen_3f1481ac913e0394 (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (args_bool1)(arg1, arg2);
+-- }
+-- void hs_bindgen_998092a62cba613e (
+--   signed int arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   (args_struct)(arg1, *arg2);
+-- }
+-- void hs_bindgen_b83fe7017c88f63e (
+--   signed int arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   (args_union)(arg1, *arg2);
+-- }
+-- void hs_bindgen_45ef9d5579ceaa74 (
+--   signed int arg1,
+--   enum some_enum arg2
+-- )
+-- {
+--   (args_enum)(arg1, arg2);
+-- }
+-- void hs_bindgen_862d74c6849bbcd0 (
+--   signed int arg1,
+--   signed int *arg2
+-- )
+-- {
+--   (args_pointer1)(arg1, arg2);
+-- }
+-- void hs_bindgen_0df09844c5645db9 (
+--   signed int arg1,
+--   signed int **arg2
+-- )
+-- {
+--   (args_pointer2)(arg1, arg2);
+-- }
+-- void hs_bindgen_221cb5a1c4ce6a3b (
+--   signed int arg1,
+--   void *arg2
+-- )
+-- {
+--   (args_pointer3)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_dfd4e13321b706b1 (void)
+-- {
+--   return (ret_A)();
+-- }
+-- char hs_bindgen_5289300b6ae3ff51 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char1)(arg1);
+-- }
+-- signed char hs_bindgen_b258f6c4e2c9be38 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char2)(arg1);
+-- }
+-- unsigned char hs_bindgen_734b5b749255713a (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char3)(arg1);
+-- }
+-- signed short hs_bindgen_d17d4780d98d2561 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short1)(arg1);
+-- }
+-- signed short hs_bindgen_1f808a3cec3781e1 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short2)(arg1);
+-- }
+-- unsigned short hs_bindgen_5204d0272f75f1a2 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short3)(arg1);
+-- }
+-- signed int hs_bindgen_14351eeb2c92732a (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int1)(arg1);
+-- }
+-- signed int hs_bindgen_f91baafc096613a0 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int2)(arg1);
+-- }
+-- unsigned int hs_bindgen_e78391249ef8ffbf (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int3)(arg1);
+-- }
+-- signed long hs_bindgen_4f8ae7ed648c72e4 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long1)(arg1);
+-- }
+-- signed long hs_bindgen_c0a47369a5a10695 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long2)(arg1);
+-- }
+-- unsigned long hs_bindgen_64aa36b6c820a3bf (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long3)(arg1);
+-- }
+-- float hs_bindgen_b53c45aaccbaaf3a (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_float)(arg1);
+-- }
+-- double hs_bindgen_0ca050f5bbe69c94 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_double)(arg1);
+-- }
+-- _Bool hs_bindgen_530e0725cadf8f52 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_bool1)(arg1);
+-- }
+-- void hs_bindgen_8f19d5621a4f3e92 (
+--   signed int arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   *arg2 = (ret_struct)(arg1);
+-- }
+-- void hs_bindgen_e93cfabcefb5051b (
+--   signed int arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   *arg2 = (ret_union)(arg1);
+-- }
+-- enum some_enum hs_bindgen_f672d8d1020b037f (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_enum)(arg1);
+-- }
+-- signed int *hs_bindgen_1b0ed1f4c7ddeb1e (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer1)(arg1);
+-- }
+-- signed int **hs_bindgen_46ff1f39be014f9f (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer2)(arg1);
+-- }
+-- void *hs_bindgen_c4737a52f27dfdac (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer3)(arg1);
+-- }
+-- signed int hs_bindgen_fdef71f6bc647af6 (
+--   signed int arg1
+-- )
+-- {
+--   return (body1)(arg1);
+-- }
+-- signed int hs_bindgen_4ebf4e201327a21a (void)
+-- {
+--   return (body2)();
+-- }
+-- void hs_bindgen_7229e893bab43698 (
+--   signed int arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   (args_complex_float)(arg1, *arg2);
+-- }
+-- void hs_bindgen_0cbb6cfd403656ec (
+--   signed int arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   (args_complex_double)(arg1, *arg2);
+-- }
+-- void hs_bindgen_7fa01b9c64606663 (
+--   signed int arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_float)(arg1);
+-- }
+-- void hs_bindgen_81ad2d3ffe70c3a9 (
+--   signed int arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_double)(arg1);
+-- }
+-- void hs_bindgen_1c3c1f6f6a7e2bc8 (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (bespoke_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_a5e6d8b6d973331f (
+--   signed int arg1,
+--   size_t arg2
+-- )
+-- {
+--   (bespoke_args2)(arg1, arg2);
+-- }
+-- _Bool hs_bindgen_0f143bde59bade44 (
+--   signed int arg1
+-- )
+-- {
+--   return (bespoke_ret1)(arg1);
+-- }
+-- size_t hs_bindgen_3fe674df63c48d30 (
+--   signed int arg1
+-- )
+-- {
+--   return (bespoke_ret2)(arg1);
+-- }
+-- void hs_bindgen_a8eaeaa944a099d9 (
+--   signed int *arg1
+-- )
+-- {
+--   (arr_args1)(arg1);
+-- }
+-- void hs_bindgen_f928df06f2f528e0 (
+--   signed int **arg1
+-- )
+-- {
+--   (arr_args2)(arg1);
+-- }
+-- void hs_bindgen_2fb2e9d0563a690b (
+--   signed int *arg1
+-- )
+-- {
+--   (arr_args3)(arg1);
+-- }
+-- void hs_bindgen_b9b529def42c1efd (
+--   signed int **arg1
+-- )
+-- {
+--   (arr_args4)(arg1);
+-- }
+-- void hs_bindgen_5ab0516185b48906 (
+--   signed int arg1,
+--   void (*arg2) (void)
+-- )
+-- {
+--   (funptr_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_682810b65a83f101 (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (funptr_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_a06192a621a12016 (
+--   signed int arg1,
+--   void (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (funptr_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_414fd8b92ff2611b (
+--   signed int arg1,
+--   char (*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_62b477fc0c092e32 (
+--   signed int arg1,
+--   signed int *(*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args5)(arg1, arg2);
+-- }
+-- void hs_bindgen_17fb56aae1527722 (
+--   signed int arg1
+-- )
+-- {
+--   (comments1)(arg1);
+-- }
+-- void hs_bindgen_e70333f7108e59a8 (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_14a503cc3e41e014 (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_504ad9cb98a4f946 (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_c0c67bf5b144c658 (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_72fa51e2c7023b88 (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_b09c2805c508fddf (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_85bf325f09491972 (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_45a61f720b0fe2ed (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_36c611aa17d28531 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_a614ed967b401309 (
+--   signed int arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_before4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_0e258c684851b84f (
+--   signed int arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_before5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_9f7d70e8a0106516 (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_before6)(arg1, arg2);
+-- }
+-- void hs_bindgen_0b71a82a5fa4fc87 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before7)(arg1, arg2);
+-- }
+-- void hs_bindgen_7ebb88bce2abdf74 (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_before8)(arg1, arg2);
+-- }
+-- void hs_bindgen_7188d6a351cf7dd5 (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_bd2e5fd19a5f4d84 (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_ab0f4d2e36402e2f (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_d4fdffd51b526049 (
+--   signed int arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_after4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_662a5811d33311fd (
+--   signed int arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_after5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_6755aa8f356d9bb1 (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_after6)(arg1, arg2);
+-- }
+-- void hs_bindgen_38694a08d2a7599a (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after7)(arg1, arg2);
+-- }
+-- void hs_bindgen_44cd79114d322610 (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_after8)(arg1, arg2);
+-- }
+-- void hs_bindgen_30969f0e26032752 (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_35235928bc01e390 (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_9853f1c7b6472022 (
+--   signed int arg1,
+--   signed int *const arg2
+-- )
+-- {
+--   (const_pointers_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_e3b1d92f43d9cda7 (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_b4a0d9b232b8ee87 (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args5)(arg1, arg2);
+-- }
+-- signed int const *hs_bindgen_ce61a185fdbd1b5e (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret1)(arg1);
+-- }
+-- signed int const *hs_bindgen_001714607a85bf44 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret2)(arg1);
+-- }
+-- signed int *const hs_bindgen_0481dd02a7bda0cb (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret3)(arg1);
+-- }
+-- signed int const *const hs_bindgen_2b32282230882c4f (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret4)(arg1);
+-- }
+-- signed int const *const hs_bindgen_094656d98097f48e (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret5)(arg1);
+-- }
+-- void hs_bindgen_5f2909e0d90b7530 (
+--   signed int const *arg1
+-- )
+-- {
+--   (const_array_elem1)(arg1);
+-- }
+-- void hs_bindgen_a9a1c34158c32e13 (
+--   signed int const **arg1
+-- )
+-- {
+--   (const_array_elem2)(arg1);
+-- }
+-- void hs_bindgen_55765da8c98676da (
+--   signed int *const *arg1
+-- )
+-- {
+--   (const_array_elem3)(arg1);
+-- }
+-- signed int hs_bindgen_2692ad6e69dd9bf6 (void)
+-- {
+--   return (noParams1)();
+-- }
+-- signed int hs_bindgen_b016e4354ee966d9 (void)
+-- {
+--   return (noParams2)();
+-- }
+-- void hs_bindgen_9a5fca17446c0b64 (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (noParams3)(arg1, arg2);
+-- }
+-- void (*hs_bindgen_e0ae2ea8372de864 (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return (funptr_ret1)(arg1);
+-- }
+-- signed int (*hs_bindgen_105cd0216456de95 (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return (funptr_ret2)(arg1);
+-- }
+-- void (*hs_bindgen_2d7d8cfa71504d88 (
+--   signed int arg1
+-- )) (
+--   signed int arg1
+-- )
+-- {
+--   return (funptr_ret3)(arg1);
+-- }
+-- char (*hs_bindgen_46f0ed4c8295ba70 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret4)(arg1);
+-- }
+-- signed int *(*hs_bindgen_f8291bd691623354 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret5)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_2eb8ef0a6794c225 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret6)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_8cc60b45c83cb72b (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret7)(arg1);
+-- }
+-- signed int *const (*hs_bindgen_2ad075d6ca6beea5 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret8)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_fe5e863d48f781be (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret9)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_2a029ddc00ba6ce1 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret10)(arg1);
+-- }
+-- void hs_bindgen_c6ccfbc5ac54d3e3 (
+--   signed int arg1,
+--   char arg2
+-- )
+-- {
+--   (args_char1)(arg1, arg2);
+-- }
+-- void hs_bindgen_1b7126ecf0f5ab6e (
+--   signed int arg1,
+--   signed char arg2
+-- )
+-- {
+--   (args_char2)(arg1, arg2);
+-- }
+-- void hs_bindgen_8ecc879598b6d3b0 (
+--   signed int arg1,
+--   unsigned char arg2
+-- )
+-- {
+--   (args_char3)(arg1, arg2);
+-- }
+-- void hs_bindgen_8e221273096c13a0 (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short1)(arg1, arg2);
+-- }
+-- void hs_bindgen_3de3762c82599242 (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short2)(arg1, arg2);
+-- }
+-- void hs_bindgen_14352acc60454580 (
+--   signed int arg1,
+--   unsigned short arg2
+-- )
+-- {
+--   (args_short3)(arg1, arg2);
+-- }
+-- void hs_bindgen_96096b97ae514d84 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int1)(arg1, arg2);
+-- }
+-- void hs_bindgen_d049eccfdf55015b (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int2)(arg1, arg2);
+-- }
+-- void hs_bindgen_9c1d57b596281f26 (
+--   signed int arg1,
+--   unsigned int arg2
+-- )
+-- {
+--   (args_int3)(arg1, arg2);
+-- }
+-- void hs_bindgen_31684dbfb298f18c (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long1)(arg1, arg2);
+-- }
+-- void hs_bindgen_705e74ceba937567 (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long2)(arg1, arg2);
+-- }
+-- void hs_bindgen_193cb3a5430102f3 (
+--   signed int arg1,
+--   unsigned long arg2
+-- )
+-- {
+--   (args_long3)(arg1, arg2);
+-- }
+-- void hs_bindgen_f1b87ec98a54b583 (
+--   signed int arg1,
+--   float arg2
+-- )
+-- {
+--   (args_float)(arg1, arg2);
+-- }
+-- void hs_bindgen_da17ba710f71da80 (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   (args_double)(arg1, arg2);
+-- }
+-- void hs_bindgen_9e15dd8dbce9cd83 (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (args_bool1)(arg1, arg2);
+-- }
+-- void hs_bindgen_dc772c3e54b3ef41 (
+--   signed int arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   (args_struct)(arg1, *arg2);
+-- }
+-- void hs_bindgen_aabbe3419dcd3eb9 (
+--   signed int arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   (args_union)(arg1, *arg2);
+-- }
+-- void hs_bindgen_731297a830e4c2df (
+--   signed int arg1,
+--   enum some_enum arg2
+-- )
+-- {
+--   (args_enum)(arg1, arg2);
+-- }
+-- void hs_bindgen_31fc55b0aea434ba (
+--   signed int arg1,
+--   signed int *arg2
+-- )
+-- {
+--   (args_pointer1)(arg1, arg2);
+-- }
+-- void hs_bindgen_35aa32eabe6cbe1e (
+--   signed int arg1,
+--   signed int **arg2
+-- )
+-- {
+--   (args_pointer2)(arg1, arg2);
+-- }
+-- void hs_bindgen_c9941830193c9c20 (
+--   signed int arg1,
+--   void *arg2
+-- )
+-- {
+--   (args_pointer3)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_56c5534530515933 (void)
+-- {
+--   return (ret_A)();
+-- }
+-- char hs_bindgen_e36cc4960e15ece8 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char1)(arg1);
+-- }
+-- signed char hs_bindgen_39c01c6ee1b7364f (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char2)(arg1);
+-- }
+-- unsigned char hs_bindgen_6a35179874816c94 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char3)(arg1);
+-- }
+-- signed short hs_bindgen_9bb2bb254d5dc1c0 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short1)(arg1);
+-- }
+-- signed short hs_bindgen_6797eb02f4ac3ebe (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short2)(arg1);
+-- }
+-- unsigned short hs_bindgen_615bd7df3e0134a2 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short3)(arg1);
+-- }
+-- signed int hs_bindgen_4fe4545529e753b8 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int1)(arg1);
+-- }
+-- signed int hs_bindgen_f6e5d129c69c5afe (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int2)(arg1);
+-- }
+-- unsigned int hs_bindgen_9551ec72ba55d7a7 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int3)(arg1);
+-- }
+-- signed long hs_bindgen_e0d1c177d41a7ce8 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long1)(arg1);
+-- }
+-- signed long hs_bindgen_42fbed00ce6b7b08 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long2)(arg1);
+-- }
+-- unsigned long hs_bindgen_ed9a248d2e643a4b (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long3)(arg1);
+-- }
+-- float hs_bindgen_ff0e9b4eaea0329a (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_float)(arg1);
+-- }
+-- double hs_bindgen_164a83641655c836 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_double)(arg1);
+-- }
+-- _Bool hs_bindgen_53d6d79b1b401e62 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_bool1)(arg1);
+-- }
+-- void hs_bindgen_75308badf37284ce (
+--   signed int arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   *arg2 = (ret_struct)(arg1);
+-- }
+-- void hs_bindgen_b9ab05b4990fb8dd (
+--   signed int arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   *arg2 = (ret_union)(arg1);
+-- }
+-- enum some_enum hs_bindgen_c46aafe01e3abbca (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_enum)(arg1);
+-- }
+-- signed int *hs_bindgen_afcc67a9788584d9 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer1)(arg1);
+-- }
+-- signed int **hs_bindgen_234d0979dbe93733 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer2)(arg1);
+-- }
+-- void *hs_bindgen_6f3f7c624556cfb3 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer3)(arg1);
+-- }
+-- signed int hs_bindgen_c9d515b8a02ca235 (
+--   signed int arg1
+-- )
+-- {
+--   return (body1)(arg1);
+-- }
+-- signed int hs_bindgen_d6e10c899b553af9 (void)
+-- {
+--   return (body2)();
+-- }
+-- void hs_bindgen_433860c3d6edf28b (
+--   signed int arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   (args_complex_float)(arg1, *arg2);
+-- }
+-- void hs_bindgen_8e44029c12a7dddb (
+--   signed int arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   (args_complex_double)(arg1, *arg2);
+-- }
+-- void hs_bindgen_0dc01ff2cd8fc565 (
+--   signed int arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_float)(arg1);
+-- }
+-- void hs_bindgen_8f2ebb486a336f80 (
+--   signed int arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_double)(arg1);
+-- }
+-- void hs_bindgen_26be4a823dc56e01 (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (bespoke_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_6212b2750a2d5997 (
+--   signed int arg1,
+--   size_t arg2
+-- )
+-- {
+--   (bespoke_args2)(arg1, arg2);
+-- }
+-- _Bool hs_bindgen_e553247e80e3e159 (
+--   signed int arg1
+-- )
+-- {
+--   return (bespoke_ret1)(arg1);
+-- }
+-- size_t hs_bindgen_72a7f6cf38bcb00c (
+--   signed int arg1
+-- )
+-- {
+--   return (bespoke_ret2)(arg1);
+-- }
+-- void hs_bindgen_dc7cacd7dbb61f43 (
+--   signed int *arg1
+-- )
+-- {
+--   (arr_args1)(arg1);
+-- }
+-- void hs_bindgen_09d9010cbf3c8d41 (
+--   signed int **arg1
+-- )
+-- {
+--   (arr_args2)(arg1);
+-- }
+-- void hs_bindgen_37e1f318a8ae501c (
+--   signed int *arg1
+-- )
+-- {
+--   (arr_args3)(arg1);
+-- }
+-- void hs_bindgen_d9440a8b6d2848ff (
+--   signed int **arg1
+-- )
+-- {
+--   (arr_args4)(arg1);
+-- }
+-- void hs_bindgen_ca61df80135a11f9 (
+--   signed int arg1,
+--   void (*arg2) (void)
+-- )
+-- {
+--   (funptr_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_2e803412f5250381 (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (funptr_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_1839323a7de53e04 (
+--   signed int arg1,
+--   void (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (funptr_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_1966f50d5deb0a77 (
+--   signed int arg1,
+--   char (*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_3eacaa3550feb706 (
+--   signed int arg1,
+--   signed int *(*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args5)(arg1, arg2);
+-- }
+-- void hs_bindgen_42f3fad04f4a62c7 (
+--   signed int arg1
+-- )
+-- {
+--   (comments1)(arg1);
+-- }
+-- void hs_bindgen_40fa2adcbadaabf4 (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_6560ce91395cf6bf (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_fab04df1b737308d (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_3762ecefd71c40d3 (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_b3ecb163df7d32c8 (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_706270fd83faddb0 (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_ff637beb32dc5931 (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_3e0e5c2fa1b03a68 (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_81eefcf233fd167c (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_1c849843004ee65e (
+--   signed int arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_before4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_c85d4a53a6e1e963 (
+--   signed int arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_before5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_796c19d2df50b65f (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_before6)(arg1, arg2);
+-- }
+-- void hs_bindgen_0950b2ec97db5b00 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before7)(arg1, arg2);
+-- }
+-- void hs_bindgen_375085e61e85a2a8 (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_before8)(arg1, arg2);
+-- }
+-- void hs_bindgen_2bb6a1d152a87f63 (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_2753c469629474c2 (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_5c96f0d6c5fd53b1 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_e8d4acc6356ca49d (
+--   signed int arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_after4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_6762b5473d8d350a (
+--   signed int arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_after5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_55d5e45034c9f572 (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_after6)(arg1, arg2);
+-- }
+-- void hs_bindgen_70dae000d43d8228 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after7)(arg1, arg2);
+-- }
+-- void hs_bindgen_85e787c823b6c95f (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_after8)(arg1, arg2);
+-- }
+-- void hs_bindgen_efb5ca5187af5610 (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_e306bbd2d4a374fc (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_960be6e90be0e7c1 (
+--   signed int arg1,
+--   signed int *const arg2
+-- )
+-- {
+--   (const_pointers_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_00950eca61f28e52 (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_96b40db09db83748 (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args5)(arg1, arg2);
+-- }
+-- signed int const *hs_bindgen_035d9da3770aeff8 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret1)(arg1);
+-- }
+-- signed int const *hs_bindgen_0d195040558fbef7 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret2)(arg1);
+-- }
+-- signed int *const hs_bindgen_9d5a35ded6d43b33 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret3)(arg1);
+-- }
+-- signed int const *const hs_bindgen_b00ca0cfd4037848 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret4)(arg1);
+-- }
+-- signed int const *const hs_bindgen_da92f752b03da901 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret5)(arg1);
+-- }
+-- void hs_bindgen_fdc3e3307cac5fd0 (
+--   signed int const *arg1
+-- )
+-- {
+--   (const_array_elem1)(arg1);
+-- }
+-- void hs_bindgen_cecdce9d64ac85d4 (
+--   signed int const **arg1
+-- )
+-- {
+--   (const_array_elem2)(arg1);
+-- }
+-- void hs_bindgen_9ee7979e72b4baf6 (
+--   signed int *const *arg1
+-- )
+-- {
+--   (const_array_elem3)(arg1);
+-- }
+-- signed int hs_bindgen_c6e158d421dda2ac (void)
+-- {
+--   return (noParams1)();
+-- }
+-- signed int hs_bindgen_a34e536ea5931d76 (void)
+-- {
+--   return (noParams2)();
+-- }
+-- void hs_bindgen_80f6772cd6dfe2a9 (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (noParams3)(arg1, arg2);
+-- }
+-- void (*hs_bindgen_8938b867c00625aa (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return (funptr_ret1)(arg1);
+-- }
+-- signed int (*hs_bindgen_03ba9af419f7c750 (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return (funptr_ret2)(arg1);
+-- }
+-- void (*hs_bindgen_c53c44ca84d8cb81 (
+--   signed int arg1
+-- )) (
+--   signed int arg1
+-- )
+-- {
+--   return (funptr_ret3)(arg1);
+-- }
+-- char (*hs_bindgen_fb5431b884cc209e (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret4)(arg1);
+-- }
+-- signed int *(*hs_bindgen_b45419cebf6cb43d (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret5)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_5c14b480ba3cab1e (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret6)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_b8f93b6ff6ce2b1c (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret7)(arg1);
+-- }
+-- signed int *const (*hs_bindgen_74e1d2bf9ed6b1c5 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret8)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_8e68b5e49b407e0b (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret9)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_1fc54cf36aa5566f (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret10)(arg1);
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_char1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b80f882fdcf9d390 (void)) (
+--   signed int arg1,
+--   char arg2
+-- )
+-- {
+--   return &args_char1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_char2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b604969d2857133d (void)) (
+--   signed int arg1,
+--   signed char arg2
+-- )
+-- {
+--   return &args_char2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_char3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9b95a55e6ceb1621 (void)) (
+--   signed int arg1,
+--   unsigned char arg2
+-- )
+-- {
+--   return &args_char3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_short1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f72fa5fc8023eb3f (void)) (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   return &args_short1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_short2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_5e4d62486e4f3759 (void)) (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   return &args_short2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_short3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cef5409d73a3ebb9 (void)) (
+--   signed int arg1,
+--   unsigned short arg2
+-- )
+-- {
+--   return &args_short3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_int1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_67400948e9390e71 (void)) (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &args_int1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_int2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f931f0229bddda59 (void)) (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &args_int2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_int3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fa14da0adf102175 (void)) (
+--   signed int arg1,
+--   unsigned int arg2
+-- )
+-- {
+--   return &args_int3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_long1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_af7f311d12eb20c0 (void)) (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   return &args_long1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_long2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_09143fbe9a30e2a2 (void)) (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   return &args_long2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_long3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9a73b75e254c0317 (void)) (
+--   signed int arg1,
+--   unsigned long arg2
+-- )
+-- {
+--   return &args_long3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_float */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_98a70ab7e71e634d (void)) (
+--   signed int arg1,
+--   float arg2
+-- )
+-- {
+--   return &args_float;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_double */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2bc72f8a3bdbad63 (void)) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &args_double;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_bool1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_4f6046208f0c55ab (void)) (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   return &args_bool1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_struct */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_511a8f421aca49d7 (void)) (
+--   signed int arg1,
+--   struct some_struct arg2
+-- )
+-- {
+--   return &args_struct;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_union */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_edf2a54db0ba78fa (void)) (
+--   signed int arg1,
+--   union some_union arg2
+-- )
+-- {
+--   return &args_union;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_enum */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fc74034537b4ecf6 (void)) (
+--   signed int arg1,
+--   enum some_enum arg2
+-- )
+-- {
+--   return &args_enum;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_pointer1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_594ea5d2885bc64d (void)) (
+--   signed int arg1,
+--   signed int *arg2
+-- )
+-- {
+--   return &args_pointer1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_pointer2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_5179b8dedaed5e5e (void)) (
+--   signed int arg1,
+--   signed int **arg2
+-- )
+-- {
+--   return &args_pointer2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_pointer3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_72daaebaddd12e45 (void)) (
+--   signed int arg1,
+--   void *arg2
+-- )
+-- {
+--   return &args_pointer3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_A */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_cf6e0ba74be5a2da (void)) (void)
+-- {
+--   return &ret_A;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_char1 */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_f223792546e3022e (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_char1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_char2 */
+-- __attribute__ ((const))
+-- signed char (*hs_bindgen_9bb497f3e0172b6d (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_char2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_char3 */
+-- __attribute__ ((const))
+-- unsigned char (*hs_bindgen_3be11c39ee59643e (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_char3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_short1 */
+-- __attribute__ ((const))
+-- signed short (*hs_bindgen_a65b0b8d17719893 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_short1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_short2 */
+-- __attribute__ ((const))
+-- signed short (*hs_bindgen_5190e7513c922ff0 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_short2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_short3 */
+-- __attribute__ ((const))
+-- unsigned short (*hs_bindgen_43b7df2a55a61277 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_short3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_int1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_0c98313fb5db2326 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_int1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_int2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ec162368f9f436e3 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_int2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_int3 */
+-- __attribute__ ((const))
+-- unsigned int (*hs_bindgen_7affbbac42cd29e2 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_int3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_long1 */
+-- __attribute__ ((const))
+-- signed long (*hs_bindgen_7622c56c9539e04c (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_long1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_long2 */
+-- __attribute__ ((const))
+-- signed long (*hs_bindgen_815df1fcd6285cb1 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_long2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_long3 */
+-- __attribute__ ((const))
+-- unsigned long (*hs_bindgen_246bedca6a708d23 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_long3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_float */
+-- __attribute__ ((const))
+-- float (*hs_bindgen_d0a43141a677f147 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_float;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_double */
+-- __attribute__ ((const))
+-- double (*hs_bindgen_e39c2a2347167cd5 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_double;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_bool1 */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_2f72fbc044a4bbfd (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_bool1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_struct */
+-- __attribute__ ((const))
+-- struct some_struct (*hs_bindgen_3ed00edaff786c0e (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_struct;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_union */
+-- __attribute__ ((const))
+-- union some_union (*hs_bindgen_1b270595798725a6 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_union;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_enum */
+-- __attribute__ ((const))
+-- enum some_enum (*hs_bindgen_df1e959d57683966 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_enum;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_pointer1 */
+-- __attribute__ ((const))
+-- signed int *(*hs_bindgen_f66df065bdb19e72 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_pointer1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_pointer2 */
+-- __attribute__ ((const))
+-- signed int **(*hs_bindgen_12d9b147f5523ea9 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_pointer2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_pointer3 */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_4ac9f0fe826d0748 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_pointer3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_body1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2974316436a63e20 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &body1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_body2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2b14d27784f519af (void)) (void)
+-- {
+--   return &body2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_complex_float */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_387d68ceb6d006f9 (void)) (
+--   signed int arg1,
+--   float _Complex arg2
+-- )
+-- {
+--   return &args_complex_float;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_args_complex_double */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a0dd7e51d4c3782c (void)) (
+--   signed int arg1,
+--   double _Complex arg2
+-- )
+-- {
+--   return &args_complex_double;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_complex_float */
+-- __attribute__ ((const))
+-- float _Complex (*hs_bindgen_121af3746ec0fe57 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_complex_float;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_ret_complex_double */
+-- __attribute__ ((const))
+-- double _Complex (*hs_bindgen_f5f4fa2b769a0807 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_complex_double;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_bespoke_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6c590995b92657c7 (void)) (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   return &bespoke_args1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_bespoke_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b871d8c50d13d10a (void)) (
+--   signed int arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &bespoke_args2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_bespoke_ret1 */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_457eeaee9b36d630 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bespoke_ret1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_bespoke_ret2 */
+-- __attribute__ ((const))
+-- size_t (*hs_bindgen_11a75beb43d5fc2e (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bespoke_ret2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_arr_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_618624c6e6b83a22 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &arr_args1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_arr_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2ad0461638177d93 (void)) (
+--   signed int **arg1
+-- )
+-- {
+--   return &arr_args2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_arr_args3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c77b1b370d4c5f4b (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &arr_args3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_arr_args4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_de199c863fb8ac12 (void)) (
+--   signed int **arg1
+-- )
+-- {
+--   return &arr_args4;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7fc280d0a83fec73 (void)) (
+--   signed int arg1,
+--   void (*arg2) (void)
+-- )
+-- {
+--   return &funptr_args1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9beb81169b296475 (void)) (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   return &funptr_args2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_args3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d85158bc0b976b5a (void)) (
+--   signed int arg1,
+--   void (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &funptr_args3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_args4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0b011779ec7227d9 (void)) (
+--   signed int arg1,
+--   char (*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   return &funptr_args4;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_args5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d358fcc92cb10cf3 (void)) (
+--   signed int arg1,
+--   signed int *(*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   return &funptr_args5;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_comments1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0fd159d332801a82 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &comments1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_prim_before1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a40876f663bcef73 (void)) (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   return &const_prim_before1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_prim_before2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dc5eb25e2e741ab6 (void)) (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   return &const_prim_before2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_prim_before3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9718326f589a56a0 (void)) (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   return &const_prim_before3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_prim_after1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cde59c88cf7b3db3 (void)) (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   return &const_prim_after1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_prim_after2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d5ab011afdbef099 (void)) (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   return &const_prim_after2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_prim_after3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_30f31bede8bfc87c (void)) (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   return &const_prim_after3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_before1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6cc702c24ac0eeb2 (void)) (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   return &const_withoutSign_before1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_before2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e77ba4a5962cc68c (void)) (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   return &const_withoutSign_before2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_before3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c4d9de5a3852ba73 (void)) (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_before3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_before4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_585a37cd5f43f5da (void)) (
+--   signed int arg1,
+--   struct some_struct const arg2
+-- )
+-- {
+--   return &const_withoutSign_before4;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_before5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_655c28dba28a9a53 (void)) (
+--   signed int arg1,
+--   union some_union const arg2
+-- )
+-- {
+--   return &const_withoutSign_before5;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_before6 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9e08bdc34bafeee1 (void)) (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   return &const_withoutSign_before6;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_before7 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_5736b6db8251bdd5 (void)) (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_before7;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_before8 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c398560b654a8d9d (void)) (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   return &const_withoutSign_before8;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_after1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_10bff078d94c8cd0 (void)) (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   return &const_withoutSign_after1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_after2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b75e6b8d1be2004b (void)) (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   return &const_withoutSign_after2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_after3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_60f26b5a2f8cf394 (void)) (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_after3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_after4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0503ec9e78e10edf (void)) (
+--   signed int arg1,
+--   struct some_struct const arg2
+-- )
+-- {
+--   return &const_withoutSign_after4;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_after5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1657dae083620adf (void)) (
+--   signed int arg1,
+--   union some_union const arg2
+-- )
+-- {
+--   return &const_withoutSign_after5;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_after6 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_44c293b62ff2015d (void)) (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   return &const_withoutSign_after6;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_after7 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ed406d5edbd28ec1 (void)) (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_after7;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_withoutSign_after8 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2cca685d1adca496 (void)) (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   return &const_withoutSign_after8;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_5da738696e5beb04 (void)) (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return &const_pointers_args1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_783634f682149eb7 (void)) (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return &const_pointers_args2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_args3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e8c26ca0eb024ce8 (void)) (
+--   signed int arg1,
+--   signed int *const arg2
+-- )
+-- {
+--   return &const_pointers_args3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_args4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_21e206a694593eb1 (void)) (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   return &const_pointers_args4;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_args5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cc3a8f368db00421 (void)) (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   return &const_pointers_args5;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_ret1 */
+-- __attribute__ ((const))
+-- signed int const *(*hs_bindgen_a9979680c0124010 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_ret2 */
+-- __attribute__ ((const))
+-- signed int const *(*hs_bindgen_c865f82ab69a4a3e (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_ret3 */
+-- __attribute__ ((const))
+-- signed int *const (*hs_bindgen_61570ab40d22e404 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_ret4 */
+-- __attribute__ ((const))
+-- signed int const *const (*hs_bindgen_7d02f676d3a68181 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret4;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_pointers_ret5 */
+-- __attribute__ ((const))
+-- signed int const *const (*hs_bindgen_3a389377331b29b9 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret5;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_array_elem1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_4810bd323f24b8d0 (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &const_array_elem1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_array_elem2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8bed93eafa056c5e (void)) (
+--   signed int const **arg1
+-- )
+-- {
+--   return &const_array_elem2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const_array_elem3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c569d0da33bf00e3 (void)) (
+--   signed int *const *arg1
+-- )
+-- {
+--   return &const_array_elem3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_noParams1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_91d4c9002424f82d (void)) (void)
+-- {
+--   return &noParams1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_noParams2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_a317809988dfeb84 (void)) (void)
+-- {
+--   return &noParams2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_noParams3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c23ef724e4f315be (void)) (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   return &noParams3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret1 */
+-- __attribute__ ((const))
+-- void (*(*hs_bindgen_660d89308b2b5a69 (void)) (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return &funptr_ret1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret2 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_bc7009eeb6b86418 (void)) (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return &funptr_ret2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret3 */
+-- __attribute__ ((const))
+-- void (*(*hs_bindgen_565629b4e4c20a7e (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1
+-- )
+-- {
+--   return &funptr_ret3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret4 */
+-- __attribute__ ((const))
+-- char (*(*hs_bindgen_3563760f061700c9 (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret4;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret5 */
+-- __attribute__ ((const))
+-- signed int *(*(*hs_bindgen_65c114a912faa4d1 (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret5;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret6 */
+-- __attribute__ ((const))
+-- signed int const *(*(*hs_bindgen_13dce2f12ceb5ef5 (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret6;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret7 */
+-- __attribute__ ((const))
+-- signed int const *(*(*hs_bindgen_e69f4bc4bd10259c (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret7;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret8 */
+-- __attribute__ ((const))
+-- signed int *const (*(*hs_bindgen_f06ecca1a94b60e8 (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret8;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret9 */
+-- __attribute__ ((const))
+-- signed int const *const (*(*hs_bindgen_65e9b457479db3fb (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret9;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_funptr_ret10 */
+-- __attribute__ ((const))
+-- signed int const *const (*(*hs_bindgen_b5fb601528eabcdb (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret10;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_global1 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_c2929de3db3ebc68 (void)
+-- {
+--   return &global1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_global2 */
+-- __attribute__ ((const))
+-- signed int **hs_bindgen_b642618eb14a88bf (void)
+-- {
+--   return &global2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_global3 */
+-- __attribute__ ((const))
+-- signed int ***hs_bindgen_37e22dedff20b0fa (void)
+-- {
+--   return &global3;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const1 */
+-- __attribute__ ((const))
+-- signed int const *hs_bindgen_f54afb44a4459d9c (void)
+-- {
+--   return &const1;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const2 */
+-- __attribute__ ((const))
+-- signed int *const *hs_bindgen_139264d86115f755 (void)
+-- {
+--   return &const2;
+-- }
+-- /* test_macrosreparse_1_empty_Example_get_const3 */
+-- __attribute__ ((const))
+-- signed int **const *hs_bindgen_a13825d736275018 (void)
+-- {
+--   return &const3;
+-- }
+{-| __C declaration:__ @struct some_struct@
+
+    __defined at:__ @macros\/reparse.h 7:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Some_struct
+    = Some_struct {}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Some_struct
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Some_struct
+    where readRaw = \ptr_0 -> pure Some_struct
+instance WriteRaw Some_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Some_struct -> pure ()
+deriving via (EquivStorable Some_struct) instance Storable Some_struct
+deriving via (IsStructViaReadRaw Some_struct) instance IsStruct Some_struct
+{-| __C declaration:__ @union some_union@
+
+    __defined at:__ @macros\/reparse.h 8:7@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_union
+    = Some_union {unwrapSome_union :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 0 1) instance StaticSize Some_union
+deriving via (SizedByteArray 0 1) instance ReadRaw Some_union
+deriving via (SizedByteArray 0 1) instance WriteRaw Some_union
+deriving via (EquivStorable Some_union) instance Storable Some_union
+deriving via (SizedByteArray 0 1) instance IsUnion Some_union
+{-| __C declaration:__ @enum some_enum@
+
+    __defined at:__ @macros\/reparse.h 9:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_enum
+    = Some_enum {unwrapSome_enum :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Some_enum
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Some_enum
+    where readRaw = \ptr_0 -> pure Some_enum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Some_enum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Some_enum unwrapSome_enum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapSome_enum_2
+deriving via (EquivStorable Some_enum) instance Storable Some_enum
+deriving via CUInt instance Prim Some_enum
+instance CEnum Some_enum
+    where type CEnumZ Some_enum = CUInt
+          toCEnum = Some_enum
+          fromCEnum = getField @"unwrapSome_enum"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "ENUM_A")]
+          showsUndeclared = showsWrappedUndeclared "Some_enum"
+          readPrecUndeclared = readPrecWrappedUndeclared "Some_enum"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Some_enum
+    where minDeclaredValue = ENUM_A
+          maxDeclaredValue = ENUM_A
+instance Show Some_enum
+    where showsPrec = shows
+instance Read Some_enum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapSome_enum" Some_enum ty
+    where hasField = \x_0 -> (\y_1 -> Some_enum{unwrapSome_enum = y_1},
+                              getField @"unwrapSome_enum" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapSome_enum" (Ptr Some_enum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSome_enum")
+instance HasCField Some_enum "unwrapSome_enum"
+    where type CFieldType Some_enum "unwrapSome_enum" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @ENUM_A@
+
+    __defined at:__ @macros\/reparse.h 9:18@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+pattern ENUM_A :: Some_enum
+pattern ENUM_A = Some_enum 0
+{-| __C declaration:__ @arr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 109:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef1
+    = Arr_typedef1 {unwrapArr_typedef1 :: (IncompleteArray CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapArr_typedef1" Arr_typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef1{unwrapArr_typedef1 = y_1},
+                              getField @"unwrapArr_typedef1" x_0)
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapArr_typedef1" (Ptr Arr_typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef1")
+instance HasCField Arr_typedef1 "unwrapArr_typedef1"
+    where type CFieldType Arr_typedef1
+                          "unwrapArr_typedef1" = IncompleteArray CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @arr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 110:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef2
+    = Arr_typedef2 {unwrapArr_typedef2 :: (IncompleteArray (Ptr CInt))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray (Ptr CInt)) =>
+         HasField "unwrapArr_typedef2" Arr_typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef2{unwrapArr_typedef2 = y_1},
+                              getField @"unwrapArr_typedef2" x_0)
+instance (~) ty (IncompleteArray (Ptr CInt)) =>
+         HasField "unwrapArr_typedef2" (Ptr Arr_typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef2")
+instance HasCField Arr_typedef2 "unwrapArr_typedef2"
+    where type CFieldType Arr_typedef2
+                          "unwrapArr_typedef2" = IncompleteArray (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @arr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 111:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef3
+    = Arr_typedef3 {unwrapArr_typedef3 :: (ConstantArray 5 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 5 CInt) =>
+         HasField "unwrapArr_typedef3" Arr_typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef3{unwrapArr_typedef3 = y_1},
+                              getField @"unwrapArr_typedef3" x_0)
+instance (~) ty (ConstantArray 5 CInt) =>
+         HasField "unwrapArr_typedef3" (Ptr Arr_typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef3")
+instance HasCField Arr_typedef3 "unwrapArr_typedef3"
+    where type CFieldType Arr_typedef3
+                          "unwrapArr_typedef3" = ConstantArray 5 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @arr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 112:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef4
+    = Arr_typedef4 {unwrapArr_typedef4 :: (ConstantArray 5 (Ptr CInt))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 5 (Ptr CInt)) =>
+         HasField "unwrapArr_typedef4" Arr_typedef4 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef4{unwrapArr_typedef4 = y_1},
+                              getField @"unwrapArr_typedef4" x_0)
+instance (~) ty (ConstantArray 5 (Ptr CInt)) =>
+         HasField "unwrapArr_typedef4" (Ptr Arr_typedef4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef4")
+instance HasCField Arr_typedef4 "unwrapArr_typedef4"
+    where type CFieldType Arr_typedef4
+                          "unwrapArr_typedef4" = ConstantArray 5 (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| Typedefs
+
+    __C declaration:__ @typedef1@
+
+    __defined at:__ @macros\/reparse.h 118:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef1
+    = Typedef1 {unwrapTypedef1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapTypedef1" Typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Typedef1{unwrapTypedef1 = y_1},
+                              getField @"unwrapTypedef1" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapTypedef1" (Ptr Typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypedef1")
+instance HasCField Typedef1 "unwrapTypedef1"
+    where type CFieldType Typedef1 "unwrapTypedef1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @typedef2@
+
+    __defined at:__ @macros\/reparse.h 119:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef2
+    = Typedef2 {unwrapTypedef2 :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) => HasField "unwrapTypedef2" Typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Typedef2{unwrapTypedef2 = y_1},
+                              getField @"unwrapTypedef2" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapTypedef2" (Ptr Typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypedef2")
+instance HasCField Typedef2 "unwrapTypedef2"
+    where type CFieldType Typedef2 "unwrapTypedef2" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @typedef3@
+
+    __defined at:__ @macros\/reparse.h 120:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef3
+    = Typedef3 {unwrapTypedef3 :: (Ptr (Ptr CInt))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr CInt)) =>
+         HasField "unwrapTypedef3" Typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Typedef3{unwrapTypedef3 = y_1},
+                              getField @"unwrapTypedef3" x_0)
+instance (~) ty (Ptr (Ptr CInt)) =>
+         HasField "unwrapTypedef3" (Ptr Typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypedef3")
+instance HasCField Typedef3 "unwrapTypedef3"
+    where type CFieldType Typedef3 "unwrapTypedef3" = Ptr (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef1'
+
+    __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1_Aux
+    = Funptr_typedef1_Aux {unwrapFunptr_typedef1_Aux :: (IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c584d0f839fd43de_base ::
+    IO CInt
+ -> IO (FunPtr (IO CInt))
+-- __unique:__ @toFunptr_typedef1_Aux@
+hs_bindgen_c584d0f839fd43de :: Funptr_typedef1_Aux ->
+                               IO (FunPtr Funptr_typedef1_Aux)
+-- __unique:__ @toFunptr_typedef1_Aux@
+hs_bindgen_c584d0f839fd43de = \fun_0 -> fmap castFunPtr (hs_bindgen_c584d0f839fd43de_base (fmap toFFIType (getField @"unwrapFunptr_typedef1_Aux" fun_0)))
+-- __unique:__ @fromFunptr_typedef1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_806a46dc418a062c_base ::
+    FunPtr (IO CInt)
+ -> IO CInt
+-- __unique:__ @fromFunptr_typedef1_Aux@
+hs_bindgen_806a46dc418a062c :: FunPtr Funptr_typedef1_Aux ->
+                               Funptr_typedef1_Aux
+-- __unique:__ @fromFunptr_typedef1_Aux@
+hs_bindgen_806a46dc418a062c = \funPtr_0 -> Funptr_typedef1_Aux (fmap fromFFIType (hs_bindgen_806a46dc418a062c_base (castFunPtr funPtr_0)))
+instance ToFunPtr Funptr_typedef1_Aux
+    where toFunPtr = hs_bindgen_c584d0f839fd43de
+instance FromFunPtr Funptr_typedef1_Aux
+    where fromFunPtr = hs_bindgen_806a46dc418a062c
+instance (~) ty (IO CInt) =>
+         HasField "unwrapFunptr_typedef1_Aux" Funptr_typedef1_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef1_Aux{unwrapFunptr_typedef1_Aux = y_1},
+                              getField @"unwrapFunptr_typedef1_Aux" x_0)
+instance (~) ty (IO CInt) =>
+         HasField "unwrapFunptr_typedef1_Aux"
+                  (Ptr Funptr_typedef1_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef1_Aux")
+instance HasCField Funptr_typedef1_Aux "unwrapFunptr_typedef1_Aux"
+    where type CFieldType Funptr_typedef1_Aux
+                          "unwrapFunptr_typedef1_Aux" = IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1
+    = Funptr_typedef1 {unwrapFunptr_typedef1 :: (FunPtr Funptr_typedef1_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef1_Aux) =>
+         HasField "unwrapFunptr_typedef1" Funptr_typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef1{unwrapFunptr_typedef1 = y_1},
+                              getField @"unwrapFunptr_typedef1" x_0)
+instance (~) ty (FunPtr Funptr_typedef1_Aux) =>
+         HasField "unwrapFunptr_typedef1" (Ptr Funptr_typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef1")
+instance HasCField Funptr_typedef1 "unwrapFunptr_typedef1"
+    where type CFieldType Funptr_typedef1
+                          "unwrapFunptr_typedef1" = FunPtr Funptr_typedef1_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef2'
+
+    __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2_Aux
+    = Funptr_typedef2_Aux {unwrapFunptr_typedef2_Aux :: (IO (Ptr CInt))}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_f174457a161ac5a0_base ::
+    IO (Ptr Void)
+ -> IO (FunPtr (IO (Ptr Void)))
+-- __unique:__ @toFunptr_typedef2_Aux@
+hs_bindgen_f174457a161ac5a0 :: Funptr_typedef2_Aux ->
+                               IO (FunPtr Funptr_typedef2_Aux)
+-- __unique:__ @toFunptr_typedef2_Aux@
+hs_bindgen_f174457a161ac5a0 = \fun_0 -> fmap castFunPtr (hs_bindgen_f174457a161ac5a0_base (fmap toFFIType (getField @"unwrapFunptr_typedef2_Aux" fun_0)))
+-- __unique:__ @fromFunptr_typedef2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_323d07dff85b802c_base ::
+    FunPtr (IO (Ptr Void))
+ -> IO (Ptr Void)
+-- __unique:__ @fromFunptr_typedef2_Aux@
+hs_bindgen_323d07dff85b802c :: FunPtr Funptr_typedef2_Aux ->
+                               Funptr_typedef2_Aux
+-- __unique:__ @fromFunptr_typedef2_Aux@
+hs_bindgen_323d07dff85b802c = \funPtr_0 -> Funptr_typedef2_Aux (fmap fromFFIType (hs_bindgen_323d07dff85b802c_base (castFunPtr funPtr_0)))
+instance ToFunPtr Funptr_typedef2_Aux
+    where toFunPtr = hs_bindgen_f174457a161ac5a0
+instance FromFunPtr Funptr_typedef2_Aux
+    where fromFunPtr = hs_bindgen_323d07dff85b802c
+instance (~) ty (IO (Ptr CInt)) =>
+         HasField "unwrapFunptr_typedef2_Aux" Funptr_typedef2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef2_Aux{unwrapFunptr_typedef2_Aux = y_1},
+                              getField @"unwrapFunptr_typedef2_Aux" x_0)
+instance (~) ty (IO (Ptr CInt)) =>
+         HasField "unwrapFunptr_typedef2_Aux"
+                  (Ptr Funptr_typedef2_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef2_Aux")
+instance HasCField Funptr_typedef2_Aux "unwrapFunptr_typedef2_Aux"
+    where type CFieldType Funptr_typedef2_Aux
+                          "unwrapFunptr_typedef2_Aux" = IO (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2
+    = Funptr_typedef2 {unwrapFunptr_typedef2 :: (FunPtr Funptr_typedef2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef2_Aux) =>
+         HasField "unwrapFunptr_typedef2" Funptr_typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef2{unwrapFunptr_typedef2 = y_1},
+                              getField @"unwrapFunptr_typedef2" x_0)
+instance (~) ty (FunPtr Funptr_typedef2_Aux) =>
+         HasField "unwrapFunptr_typedef2" (Ptr Funptr_typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef2")
+instance HasCField Funptr_typedef2 "unwrapFunptr_typedef2"
+    where type CFieldType Funptr_typedef2
+                          "unwrapFunptr_typedef2" = FunPtr Funptr_typedef2_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef3'
+
+    __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3_Aux
+    = Funptr_typedef3_Aux {unwrapFunptr_typedef3_Aux :: (IO (Ptr (Ptr CInt)))}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_031d1a7decd790d8_base ::
+    IO (Ptr Void)
+ -> IO (FunPtr (IO (Ptr Void)))
+-- __unique:__ @toFunptr_typedef3_Aux@
+hs_bindgen_031d1a7decd790d8 :: Funptr_typedef3_Aux ->
+                               IO (FunPtr Funptr_typedef3_Aux)
+-- __unique:__ @toFunptr_typedef3_Aux@
+hs_bindgen_031d1a7decd790d8 = \fun_0 -> fmap castFunPtr (hs_bindgen_031d1a7decd790d8_base (fmap toFFIType (getField @"unwrapFunptr_typedef3_Aux" fun_0)))
+-- __unique:__ @fromFunptr_typedef3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_82dc7b932974117e_base ::
+    FunPtr (IO (Ptr Void))
+ -> IO (Ptr Void)
+-- __unique:__ @fromFunptr_typedef3_Aux@
+hs_bindgen_82dc7b932974117e :: FunPtr Funptr_typedef3_Aux ->
+                               Funptr_typedef3_Aux
+-- __unique:__ @fromFunptr_typedef3_Aux@
+hs_bindgen_82dc7b932974117e = \funPtr_0 -> Funptr_typedef3_Aux (fmap fromFFIType (hs_bindgen_82dc7b932974117e_base (castFunPtr funPtr_0)))
+instance ToFunPtr Funptr_typedef3_Aux
+    where toFunPtr = hs_bindgen_031d1a7decd790d8
+instance FromFunPtr Funptr_typedef3_Aux
+    where fromFunPtr = hs_bindgen_82dc7b932974117e
+instance (~) ty (IO (Ptr (Ptr CInt))) =>
+         HasField "unwrapFunptr_typedef3_Aux" Funptr_typedef3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef3_Aux{unwrapFunptr_typedef3_Aux = y_1},
+                              getField @"unwrapFunptr_typedef3_Aux" x_0)
+instance (~) ty (IO (Ptr (Ptr CInt))) =>
+         HasField "unwrapFunptr_typedef3_Aux"
+                  (Ptr Funptr_typedef3_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef3_Aux")
+instance HasCField Funptr_typedef3_Aux "unwrapFunptr_typedef3_Aux"
+    where type CFieldType Funptr_typedef3_Aux
+                          "unwrapFunptr_typedef3_Aux" = IO (Ptr (Ptr CInt))
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3
+    = Funptr_typedef3 {unwrapFunptr_typedef3 :: (FunPtr Funptr_typedef3_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef3_Aux) =>
+         HasField "unwrapFunptr_typedef3" Funptr_typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef3{unwrapFunptr_typedef3 = y_1},
+                              getField @"unwrapFunptr_typedef3" x_0)
+instance (~) ty (FunPtr Funptr_typedef3_Aux) =>
+         HasField "unwrapFunptr_typedef3" (Ptr Funptr_typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef3")
+instance HasCField Funptr_typedef3 "unwrapFunptr_typedef3"
+    where type CFieldType Funptr_typedef3
+                          "unwrapFunptr_typedef3" = FunPtr Funptr_typedef3_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef4'
+
+    __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4_Aux
+    = Funptr_typedef4_Aux {unwrapFunptr_typedef4_Aux :: (CInt ->
+                                                         CDouble -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_da2336d254667386_base ::
+    CInt -> CDouble -> IO CInt
+ -> IO (FunPtr (CInt -> CDouble -> IO CInt))
+-- __unique:__ @toFunptr_typedef4_Aux@
+hs_bindgen_da2336d254667386 :: Funptr_typedef4_Aux ->
+                               IO (FunPtr Funptr_typedef4_Aux)
+-- __unique:__ @toFunptr_typedef4_Aux@
+hs_bindgen_da2336d254667386 = \fun_0 -> fmap castFunPtr (hs_bindgen_da2336d254667386_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapFunptr_typedef4_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromFunptr_typedef4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d4a97954476da161_base ::
+    FunPtr (CInt -> CDouble -> IO CInt)
+ -> CInt
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @fromFunptr_typedef4_Aux@
+hs_bindgen_d4a97954476da161 :: FunPtr Funptr_typedef4_Aux ->
+                               Funptr_typedef4_Aux
+-- __unique:__ @fromFunptr_typedef4_Aux@
+hs_bindgen_d4a97954476da161 = \funPtr_0 -> Funptr_typedef4_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_d4a97954476da161_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Funptr_typedef4_Aux
+    where toFunPtr = hs_bindgen_da2336d254667386
+instance FromFunPtr Funptr_typedef4_Aux
+    where fromFunPtr = hs_bindgen_d4a97954476da161
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapFunptr_typedef4_Aux" Funptr_typedef4_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef4_Aux{unwrapFunptr_typedef4_Aux = y_1},
+                              getField @"unwrapFunptr_typedef4_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapFunptr_typedef4_Aux"
+                  (Ptr Funptr_typedef4_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef4_Aux")
+instance HasCField Funptr_typedef4_Aux "unwrapFunptr_typedef4_Aux"
+    where type CFieldType Funptr_typedef4_Aux
+                          "unwrapFunptr_typedef4_Aux" = CInt -> CDouble -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4
+    = Funptr_typedef4 {unwrapFunptr_typedef4 :: (FunPtr Funptr_typedef4_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef4_Aux) =>
+         HasField "unwrapFunptr_typedef4" Funptr_typedef4 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef4{unwrapFunptr_typedef4 = y_1},
+                              getField @"unwrapFunptr_typedef4" x_0)
+instance (~) ty (FunPtr Funptr_typedef4_Aux) =>
+         HasField "unwrapFunptr_typedef4" (Ptr Funptr_typedef4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef4")
+instance HasCField Funptr_typedef4 "unwrapFunptr_typedef4"
+    where type CFieldType Funptr_typedef4
+                          "unwrapFunptr_typedef4" = FunPtr Funptr_typedef4_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef5'
+
+    __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5_Aux
+    = Funptr_typedef5_Aux {unwrapFunptr_typedef5_Aux :: (CInt ->
+                                                         CDouble -> IO (Ptr CInt))}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1f45632f07742a46_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toFunptr_typedef5_Aux@
+hs_bindgen_1f45632f07742a46 :: Funptr_typedef5_Aux ->
+                               IO (FunPtr Funptr_typedef5_Aux)
+-- __unique:__ @toFunptr_typedef5_Aux@
+hs_bindgen_1f45632f07742a46 = \fun_0 -> fmap castFunPtr (hs_bindgen_1f45632f07742a46_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapFunptr_typedef5_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromFunptr_typedef5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_0bd1877eaaba0d3e_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromFunptr_typedef5_Aux@
+hs_bindgen_0bd1877eaaba0d3e :: FunPtr Funptr_typedef5_Aux ->
+                               Funptr_typedef5_Aux
+-- __unique:__ @fromFunptr_typedef5_Aux@
+hs_bindgen_0bd1877eaaba0d3e = \funPtr_0 -> Funptr_typedef5_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_0bd1877eaaba0d3e_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Funptr_typedef5_Aux
+    where toFunPtr = hs_bindgen_1f45632f07742a46
+instance FromFunPtr Funptr_typedef5_Aux
+    where fromFunPtr = hs_bindgen_0bd1877eaaba0d3e
+instance (~) ty (CInt -> CDouble -> IO (Ptr CInt)) =>
+         HasField "unwrapFunptr_typedef5_Aux" Funptr_typedef5_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef5_Aux{unwrapFunptr_typedef5_Aux = y_1},
+                              getField @"unwrapFunptr_typedef5_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (Ptr CInt)) =>
+         HasField "unwrapFunptr_typedef5_Aux"
+                  (Ptr Funptr_typedef5_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef5_Aux")
+instance HasCField Funptr_typedef5_Aux "unwrapFunptr_typedef5_Aux"
+    where type CFieldType Funptr_typedef5_Aux
+                          "unwrapFunptr_typedef5_Aux" = CInt -> CDouble -> IO (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5
+    = Funptr_typedef5 {unwrapFunptr_typedef5 :: (FunPtr Funptr_typedef5_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef5_Aux) =>
+         HasField "unwrapFunptr_typedef5" Funptr_typedef5 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef5{unwrapFunptr_typedef5 = y_1},
+                              getField @"unwrapFunptr_typedef5" x_0)
+instance (~) ty (FunPtr Funptr_typedef5_Aux) =>
+         HasField "unwrapFunptr_typedef5" (Ptr Funptr_typedef5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef5")
+instance HasCField Funptr_typedef5 "unwrapFunptr_typedef5"
+    where type CFieldType Funptr_typedef5
+                          "unwrapFunptr_typedef5" = FunPtr Funptr_typedef5_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @comments2@
+
+    __defined at:__ @macros\/reparse.h 145:30@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Comments2
+    = Comments2 {unwrapComments2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapComments2" Comments2 ty
+    where hasField = \x_0 -> (\y_1 -> Comments2{unwrapComments2 = y_1},
+                              getField @"unwrapComments2" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapComments2" (Ptr Comments2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapComments2")
+instance HasCField Comments2 "unwrapComments2"
+    where type CFieldType Comments2 "unwrapComments2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| Struct fields
+
+    __C declaration:__ @struct example_struct@
+
+    __defined at:__ @macros\/reparse.h 151:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct
+    = Example_struct {example_struct_field1 :: CInt
+                      {- ^ __C declaration:__ @field1@
+
+                           __defined at:__ @macros\/reparse.h 152:8@
+
+                           __exported by:__ @macros\/reparse.h@
+                      -},
+                      example_struct_field2 :: (Ptr CInt)
+                      {- ^ __C declaration:__ @field2@
+
+                           __defined at:__ @macros\/reparse.h 153:8@
+
+                           __exported by:__ @macros\/reparse.h@
+                      -},
+                      example_struct_field3 :: (Ptr (Ptr CInt))
+                      {- ^ __C declaration:__ @field3@
+
+                           __defined at:__ @macros\/reparse.h 154:8@
+
+                           __exported by:__ @macros\/reparse.h@
+                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Example_struct
+    where staticSizeOf = \_ -> 24 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Example_struct
+    where readRaw = \ptr_0 -> ((pure Example_struct <*> readRaw (Proxy @"example_struct_field1") ptr_0) <*> readRaw (Proxy @"example_struct_field2") ptr_0) <*> readRaw (Proxy @"example_struct_field3") ptr_0
+instance WriteRaw Example_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Example_struct example_struct_field1_2
+                                                      example_struct_field2_3
+                                                      example_struct_field3_4 -> writeRaw (Proxy @"example_struct_field1") ptr_0 example_struct_field1_2 >> (writeRaw (Proxy @"example_struct_field2") ptr_0 example_struct_field2_3 >> writeRaw (Proxy @"example_struct_field3") ptr_0 example_struct_field3_4)
+deriving via (EquivStorable Example_struct) instance Storable Example_struct
+deriving via (IsStructViaReadRaw Example_struct) instance IsStruct Example_struct
+instance (~) ty CInt =>
+         HasField "example_struct_field1" Example_struct ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct{example_struct_field1 = y_1,
+                                                     example_struct_field2 = getField @"example_struct_field2" x_0,
+                                                     example_struct_field3 = getField @"example_struct_field3" x_0},
+                              getField @"example_struct_field1" x_0)
+instance (~) ty CInt =>
+         HasField "example_struct_field1" (Ptr Example_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_field1")
+instance HasCField Example_struct "example_struct_field1"
+    where type CFieldType Example_struct "example_struct_field1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr CInt) =>
+         HasField "example_struct_field2" Example_struct ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct{example_struct_field2 = y_1,
+                                                     example_struct_field1 = getField @"example_struct_field1" x_0,
+                                                     example_struct_field3 = getField @"example_struct_field3" x_0},
+                              getField @"example_struct_field2" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "example_struct_field2" (Ptr Example_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_field2")
+instance HasCField Example_struct "example_struct_field2"
+    where type CFieldType Example_struct
+                          "example_struct_field2" = Ptr CInt
+          offset# = \_ -> \_ -> 8
+instance (~) ty (Ptr (Ptr CInt)) =>
+         HasField "example_struct_field3" Example_struct ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct{example_struct_field3 = y_1,
+                                                     example_struct_field1 = getField @"example_struct_field1" x_0,
+                                                     example_struct_field2 = getField @"example_struct_field2" x_0},
+                              getField @"example_struct_field3" x_0)
+instance (~) ty (Ptr (Ptr CInt)) =>
+         HasField "example_struct_field3" (Ptr Example_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_field3")
+instance HasCField Example_struct "example_struct_field3"
+    where type CFieldType Example_struct
+                          "example_struct_field3" = Ptr (Ptr CInt)
+          offset# = \_ -> \_ -> 16
+{-| __C declaration:__ @const_typedef1@
+
+    __defined at:__ @macros\/reparse.h 218:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef1
+    = Const_typedef1 {unwrapConst_typedef1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapConst_typedef1" Const_typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef1{unwrapConst_typedef1 = y_1},
+                              getField @"unwrapConst_typedef1" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapConst_typedef1" (Ptr Const_typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef1")
+instance HasCField Const_typedef1 "unwrapConst_typedef1"
+    where type CFieldType Const_typedef1 "unwrapConst_typedef1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef2@
+
+    __defined at:__ @macros\/reparse.h 219:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef2
+    = Const_typedef2 {unwrapConst_typedef2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapConst_typedef2" Const_typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef2{unwrapConst_typedef2 = y_1},
+                              getField @"unwrapConst_typedef2" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapConst_typedef2" (Ptr Const_typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef2")
+instance HasCField Const_typedef2 "unwrapConst_typedef2"
+    where type CFieldType Const_typedef2 "unwrapConst_typedef2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef3@
+
+    __defined at:__ @macros\/reparse.h 220:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef3
+    = Const_typedef3 {unwrapConst_typedef3 :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef3" Const_typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef3{unwrapConst_typedef3 = y_1},
+                              getField @"unwrapConst_typedef3" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef3" (Ptr Const_typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef3")
+instance HasCField Const_typedef3 "unwrapConst_typedef3"
+    where type CFieldType Const_typedef3
+                          "unwrapConst_typedef3" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef4@
+
+    __defined at:__ @macros\/reparse.h 221:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef4
+    = Const_typedef4 {unwrapConst_typedef4 :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef4" Const_typedef4 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef4{unwrapConst_typedef4 = y_1},
+                              getField @"unwrapConst_typedef4" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef4" (Ptr Const_typedef4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef4")
+instance HasCField Const_typedef4 "unwrapConst_typedef4"
+    where type CFieldType Const_typedef4
+                          "unwrapConst_typedef4" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef5@
+
+    __defined at:__ @macros\/reparse.h 222:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef5
+    = Const_typedef5 {unwrapConst_typedef5 :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapConst_typedef5" Const_typedef5 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef5{unwrapConst_typedef5 = y_1},
+                              getField @"unwrapConst_typedef5" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapConst_typedef5" (Ptr Const_typedef5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef5")
+instance HasCField Const_typedef5 "unwrapConst_typedef5"
+    where type CFieldType Const_typedef5
+                          "unwrapConst_typedef5" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef6@
+
+    __defined at:__ @macros\/reparse.h 223:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef6
+    = Const_typedef6 {unwrapConst_typedef6 :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef6" Const_typedef6 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef6{unwrapConst_typedef6 = y_1},
+                              getField @"unwrapConst_typedef6" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef6" (Ptr Const_typedef6) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef6")
+instance HasCField Const_typedef6 "unwrapConst_typedef6"
+    where type CFieldType Const_typedef6
+                          "unwrapConst_typedef6" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef7@
+
+    __defined at:__ @macros\/reparse.h 224:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef7
+    = Const_typedef7 {unwrapConst_typedef7 :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef7" Const_typedef7 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef7{unwrapConst_typedef7 = y_1},
+                              getField @"unwrapConst_typedef7" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef7" (Ptr Const_typedef7) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef7")
+instance HasCField Const_typedef7 "unwrapConst_typedef7"
+    where type CFieldType Const_typedef7
+                          "unwrapConst_typedef7" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct example_struct_with_const@
+
+    __defined at:__ @macros\/reparse.h 226:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct_with_const
+    = Example_struct_with_const {example_struct_with_const_const_field1 :: CInt
+                                 {- ^ __C declaration:__ @const_field1@
+
+                                      __defined at:__ @macros\/reparse.h 227:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field2 :: CInt
+                                 {- ^ __C declaration:__ @const_field2@
+
+                                      __defined at:__ @macros\/reparse.h 228:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field3 :: (PtrConst CInt)
+                                 {- ^ __C declaration:__ @const_field3@
+
+                                      __defined at:__ @macros\/reparse.h 229:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field4 :: (PtrConst CInt)
+                                 {- ^ __C declaration:__ @const_field4@
+
+                                      __defined at:__ @macros\/reparse.h 230:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field5 :: (Ptr CInt)
+                                 {- ^ __C declaration:__ @const_field5@
+
+                                      __defined at:__ @macros\/reparse.h 231:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field6 :: (PtrConst CInt)
+                                 {- ^ __C declaration:__ @const_field6@
+
+                                      __defined at:__ @macros\/reparse.h 232:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field7 :: (PtrConst CInt)
+                                 {- ^ __C declaration:__ @const_field7@
+
+                                      __defined at:__ @macros\/reparse.h 233:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Example_struct_with_const
+    where staticSizeOf = \_ -> 48 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Example_struct_with_const
+    where readRaw = \ptr_0 -> ((((((pure Example_struct_with_const <*> readRaw (Proxy @"example_struct_with_const_const_field1") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field2") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field3") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field4") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field5") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field6") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field7") ptr_0
+instance WriteRaw Example_struct_with_const
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Example_struct_with_const example_struct_with_const_const_field1_2
+                                                                 example_struct_with_const_const_field2_3
+                                                                 example_struct_with_const_const_field3_4
+                                                                 example_struct_with_const_const_field4_5
+                                                                 example_struct_with_const_const_field5_6
+                                                                 example_struct_with_const_const_field6_7
+                                                                 example_struct_with_const_const_field7_8 -> writeRaw (Proxy @"example_struct_with_const_const_field1") ptr_0 example_struct_with_const_const_field1_2 >> (writeRaw (Proxy @"example_struct_with_const_const_field2") ptr_0 example_struct_with_const_const_field2_3 >> (writeRaw (Proxy @"example_struct_with_const_const_field3") ptr_0 example_struct_with_const_const_field3_4 >> (writeRaw (Proxy @"example_struct_with_const_const_field4") ptr_0 example_struct_with_const_const_field4_5 >> (writeRaw (Proxy @"example_struct_with_const_const_field5") ptr_0 example_struct_with_const_const_field5_6 >> (writeRaw (Proxy @"example_struct_with_const_const_field6") ptr_0 example_struct_with_const_const_field6_7 >> writeRaw (Proxy @"example_struct_with_const_const_field7") ptr_0 example_struct_with_const_const_field7_8)))))
+deriving via (EquivStorable Example_struct_with_const) instance Storable Example_struct_with_const
+deriving via (IsStructViaReadRaw Example_struct_with_const) instance IsStruct Example_struct_with_const
+instance (~) ty CInt =>
+         HasField "example_struct_with_const_const_field1"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field1 = y_1,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field1" x_0)
+instance (~) ty CInt =>
+         HasField "example_struct_with_const_const_field1"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field1")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field1"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "example_struct_with_const_const_field2"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field2 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field2" x_0)
+instance (~) ty CInt =>
+         HasField "example_struct_with_const_const_field2"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field2")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field2"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field2" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field3"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field3 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field3" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field3"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field3")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field3"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field3" = PtrConst CInt
+          offset# = \_ -> \_ -> 8
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field4"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field4 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field4" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field4"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field4")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field4"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field4" = PtrConst CInt
+          offset# = \_ -> \_ -> 16
+instance (~) ty (Ptr CInt) =>
+         HasField "example_struct_with_const_const_field5"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field5 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field5" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "example_struct_with_const_const_field5"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field5")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field5"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field5" = Ptr CInt
+          offset# = \_ -> \_ -> 24
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field6"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field6 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field6" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field6"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field6")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field6"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field6" = PtrConst CInt
+          offset# = \_ -> \_ -> 32
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field7"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field7 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0},
+                              getField @"example_struct_with_const_const_field7" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field7"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field7")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field7"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field7" = PtrConst CInt
+          offset# = \_ -> \_ -> 40
+{-| Auxiliary type used by 'Const_funptr1'
+
+    __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1_Aux
+    = Const_funptr1_Aux {unwrapConst_funptr1_Aux :: (CInt ->
+                                                     CDouble -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7f125e20a9d4075b_base ::
+    CInt -> CDouble -> IO CInt
+ -> IO (FunPtr (CInt -> CDouble -> IO CInt))
+-- __unique:__ @toConst_funptr1_Aux@
+hs_bindgen_7f125e20a9d4075b :: Const_funptr1_Aux ->
+                               IO (FunPtr Const_funptr1_Aux)
+-- __unique:__ @toConst_funptr1_Aux@
+hs_bindgen_7f125e20a9d4075b = \fun_0 -> fmap castFunPtr (hs_bindgen_7f125e20a9d4075b_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr1_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ac4bd8d789bba94b_base ::
+    FunPtr (CInt -> CDouble -> IO CInt)
+ -> CInt
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @fromConst_funptr1_Aux@
+hs_bindgen_ac4bd8d789bba94b :: FunPtr Const_funptr1_Aux ->
+                               Const_funptr1_Aux
+-- __unique:__ @fromConst_funptr1_Aux@
+hs_bindgen_ac4bd8d789bba94b = \funPtr_0 -> Const_funptr1_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_ac4bd8d789bba94b_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr1_Aux
+    where toFunPtr = hs_bindgen_7f125e20a9d4075b
+instance FromFunPtr Const_funptr1_Aux
+    where fromFunPtr = hs_bindgen_ac4bd8d789bba94b
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapConst_funptr1_Aux" Const_funptr1_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr1_Aux{unwrapConst_funptr1_Aux = y_1},
+                              getField @"unwrapConst_funptr1_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapConst_funptr1_Aux" (Ptr Const_funptr1_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr1_Aux")
+instance HasCField Const_funptr1_Aux "unwrapConst_funptr1_Aux"
+    where type CFieldType Const_funptr1_Aux
+                          "unwrapConst_funptr1_Aux" = CInt -> CDouble -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1
+    = Const_funptr1 {unwrapConst_funptr1 :: (FunPtr Const_funptr1_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr1_Aux) =>
+         HasField "unwrapConst_funptr1" Const_funptr1 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr1{unwrapConst_funptr1 = y_1},
+                              getField @"unwrapConst_funptr1" x_0)
+instance (~) ty (FunPtr Const_funptr1_Aux) =>
+         HasField "unwrapConst_funptr1" (Ptr Const_funptr1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr1")
+instance HasCField Const_funptr1 "unwrapConst_funptr1"
+    where type CFieldType Const_funptr1
+                          "unwrapConst_funptr1" = FunPtr Const_funptr1_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr2'
+
+    __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2_Aux
+    = Const_funptr2_Aux {unwrapConst_funptr2_Aux :: (CInt ->
+                                                     CDouble -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c7b1e36d845634fb_base ::
+    CInt -> CDouble -> IO CInt
+ -> IO (FunPtr (CInt -> CDouble -> IO CInt))
+-- __unique:__ @toConst_funptr2_Aux@
+hs_bindgen_c7b1e36d845634fb :: Const_funptr2_Aux ->
+                               IO (FunPtr Const_funptr2_Aux)
+-- __unique:__ @toConst_funptr2_Aux@
+hs_bindgen_c7b1e36d845634fb = \fun_0 -> fmap castFunPtr (hs_bindgen_c7b1e36d845634fb_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr2_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_352cebf463125ca9_base ::
+    FunPtr (CInt -> CDouble -> IO CInt)
+ -> CInt
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @fromConst_funptr2_Aux@
+hs_bindgen_352cebf463125ca9 :: FunPtr Const_funptr2_Aux ->
+                               Const_funptr2_Aux
+-- __unique:__ @fromConst_funptr2_Aux@
+hs_bindgen_352cebf463125ca9 = \funPtr_0 -> Const_funptr2_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_352cebf463125ca9_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr2_Aux
+    where toFunPtr = hs_bindgen_c7b1e36d845634fb
+instance FromFunPtr Const_funptr2_Aux
+    where fromFunPtr = hs_bindgen_352cebf463125ca9
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapConst_funptr2_Aux" Const_funptr2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr2_Aux{unwrapConst_funptr2_Aux = y_1},
+                              getField @"unwrapConst_funptr2_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapConst_funptr2_Aux" (Ptr Const_funptr2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr2_Aux")
+instance HasCField Const_funptr2_Aux "unwrapConst_funptr2_Aux"
+    where type CFieldType Const_funptr2_Aux
+                          "unwrapConst_funptr2_Aux" = CInt -> CDouble -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2
+    = Const_funptr2 {unwrapConst_funptr2 :: (FunPtr Const_funptr2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr2_Aux) =>
+         HasField "unwrapConst_funptr2" Const_funptr2 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr2{unwrapConst_funptr2 = y_1},
+                              getField @"unwrapConst_funptr2" x_0)
+instance (~) ty (FunPtr Const_funptr2_Aux) =>
+         HasField "unwrapConst_funptr2" (Ptr Const_funptr2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr2")
+instance HasCField Const_funptr2 "unwrapConst_funptr2"
+    where type CFieldType Const_funptr2
+                          "unwrapConst_funptr2" = FunPtr Const_funptr2_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr3'
+
+    __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3_Aux
+    = Const_funptr3_Aux {unwrapConst_funptr3_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2dcbfe1c2502178c_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr3_Aux@
+hs_bindgen_2dcbfe1c2502178c :: Const_funptr3_Aux ->
+                               IO (FunPtr Const_funptr3_Aux)
+-- __unique:__ @toConst_funptr3_Aux@
+hs_bindgen_2dcbfe1c2502178c = \fun_0 -> fmap castFunPtr (hs_bindgen_2dcbfe1c2502178c_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr3_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_86738dcfd7c9d33c_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr3_Aux@
+hs_bindgen_86738dcfd7c9d33c :: FunPtr Const_funptr3_Aux ->
+                               Const_funptr3_Aux
+-- __unique:__ @fromConst_funptr3_Aux@
+hs_bindgen_86738dcfd7c9d33c = \funPtr_0 -> Const_funptr3_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_86738dcfd7c9d33c_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr3_Aux
+    where toFunPtr = hs_bindgen_2dcbfe1c2502178c
+instance FromFunPtr Const_funptr3_Aux
+    where fromFunPtr = hs_bindgen_86738dcfd7c9d33c
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr3_Aux" Const_funptr3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr3_Aux{unwrapConst_funptr3_Aux = y_1},
+                              getField @"unwrapConst_funptr3_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr3_Aux" (Ptr Const_funptr3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr3_Aux")
+instance HasCField Const_funptr3_Aux "unwrapConst_funptr3_Aux"
+    where type CFieldType Const_funptr3_Aux
+                          "unwrapConst_funptr3_Aux" = CInt -> CDouble -> IO (PtrConst CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3
+    = Const_funptr3 {unwrapConst_funptr3 :: (FunPtr Const_funptr3_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr3_Aux) =>
+         HasField "unwrapConst_funptr3" Const_funptr3 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr3{unwrapConst_funptr3 = y_1},
+                              getField @"unwrapConst_funptr3" x_0)
+instance (~) ty (FunPtr Const_funptr3_Aux) =>
+         HasField "unwrapConst_funptr3" (Ptr Const_funptr3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr3")
+instance HasCField Const_funptr3 "unwrapConst_funptr3"
+    where type CFieldType Const_funptr3
+                          "unwrapConst_funptr3" = FunPtr Const_funptr3_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr4'
+
+    __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4_Aux
+    = Const_funptr4_Aux {unwrapConst_funptr4_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5461deeda491de0b_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr4_Aux@
+hs_bindgen_5461deeda491de0b :: Const_funptr4_Aux ->
+                               IO (FunPtr Const_funptr4_Aux)
+-- __unique:__ @toConst_funptr4_Aux@
+hs_bindgen_5461deeda491de0b = \fun_0 -> fmap castFunPtr (hs_bindgen_5461deeda491de0b_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr4_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_de7846fca3bfd1b6_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr4_Aux@
+hs_bindgen_de7846fca3bfd1b6 :: FunPtr Const_funptr4_Aux ->
+                               Const_funptr4_Aux
+-- __unique:__ @fromConst_funptr4_Aux@
+hs_bindgen_de7846fca3bfd1b6 = \funPtr_0 -> Const_funptr4_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_de7846fca3bfd1b6_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr4_Aux
+    where toFunPtr = hs_bindgen_5461deeda491de0b
+instance FromFunPtr Const_funptr4_Aux
+    where fromFunPtr = hs_bindgen_de7846fca3bfd1b6
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr4_Aux" Const_funptr4_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr4_Aux{unwrapConst_funptr4_Aux = y_1},
+                              getField @"unwrapConst_funptr4_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr4_Aux" (Ptr Const_funptr4_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr4_Aux")
+instance HasCField Const_funptr4_Aux "unwrapConst_funptr4_Aux"
+    where type CFieldType Const_funptr4_Aux
+                          "unwrapConst_funptr4_Aux" = CInt -> CDouble -> IO (PtrConst CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4
+    = Const_funptr4 {unwrapConst_funptr4 :: (FunPtr Const_funptr4_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr4_Aux) =>
+         HasField "unwrapConst_funptr4" Const_funptr4 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr4{unwrapConst_funptr4 = y_1},
+                              getField @"unwrapConst_funptr4" x_0)
+instance (~) ty (FunPtr Const_funptr4_Aux) =>
+         HasField "unwrapConst_funptr4" (Ptr Const_funptr4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr4")
+instance HasCField Const_funptr4 "unwrapConst_funptr4"
+    where type CFieldType Const_funptr4
+                          "unwrapConst_funptr4" = FunPtr Const_funptr4_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr5'
+
+    __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5_Aux
+    = Const_funptr5_Aux {unwrapConst_funptr5_Aux :: (CInt ->
+                                                     CDouble -> IO (Ptr CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7b0174fc978a1ce1_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr5_Aux@
+hs_bindgen_7b0174fc978a1ce1 :: Const_funptr5_Aux ->
+                               IO (FunPtr Const_funptr5_Aux)
+-- __unique:__ @toConst_funptr5_Aux@
+hs_bindgen_7b0174fc978a1ce1 = \fun_0 -> fmap castFunPtr (hs_bindgen_7b0174fc978a1ce1_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr5_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_38a21d84bb7115b5_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr5_Aux@
+hs_bindgen_38a21d84bb7115b5 :: FunPtr Const_funptr5_Aux ->
+                               Const_funptr5_Aux
+-- __unique:__ @fromConst_funptr5_Aux@
+hs_bindgen_38a21d84bb7115b5 = \funPtr_0 -> Const_funptr5_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_38a21d84bb7115b5_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr5_Aux
+    where toFunPtr = hs_bindgen_7b0174fc978a1ce1
+instance FromFunPtr Const_funptr5_Aux
+    where fromFunPtr = hs_bindgen_38a21d84bb7115b5
+instance (~) ty (CInt -> CDouble -> IO (Ptr CInt)) =>
+         HasField "unwrapConst_funptr5_Aux" Const_funptr5_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr5_Aux{unwrapConst_funptr5_Aux = y_1},
+                              getField @"unwrapConst_funptr5_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (Ptr CInt)) =>
+         HasField "unwrapConst_funptr5_Aux" (Ptr Const_funptr5_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr5_Aux")
+instance HasCField Const_funptr5_Aux "unwrapConst_funptr5_Aux"
+    where type CFieldType Const_funptr5_Aux
+                          "unwrapConst_funptr5_Aux" = CInt -> CDouble -> IO (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5
+    = Const_funptr5 {unwrapConst_funptr5 :: (FunPtr Const_funptr5_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr5_Aux) =>
+         HasField "unwrapConst_funptr5" Const_funptr5 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr5{unwrapConst_funptr5 = y_1},
+                              getField @"unwrapConst_funptr5" x_0)
+instance (~) ty (FunPtr Const_funptr5_Aux) =>
+         HasField "unwrapConst_funptr5" (Ptr Const_funptr5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr5")
+instance HasCField Const_funptr5 "unwrapConst_funptr5"
+    where type CFieldType Const_funptr5
+                          "unwrapConst_funptr5" = FunPtr Const_funptr5_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr6'
+
+    __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6_Aux
+    = Const_funptr6_Aux {unwrapConst_funptr6_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr6_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_4e32721222f4df9f_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr6_Aux@
+hs_bindgen_4e32721222f4df9f :: Const_funptr6_Aux ->
+                               IO (FunPtr Const_funptr6_Aux)
+-- __unique:__ @toConst_funptr6_Aux@
+hs_bindgen_4e32721222f4df9f = \fun_0 -> fmap castFunPtr (hs_bindgen_4e32721222f4df9f_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr6_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr6_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_45251216b04aa8b5_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr6_Aux@
+hs_bindgen_45251216b04aa8b5 :: FunPtr Const_funptr6_Aux ->
+                               Const_funptr6_Aux
+-- __unique:__ @fromConst_funptr6_Aux@
+hs_bindgen_45251216b04aa8b5 = \funPtr_0 -> Const_funptr6_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_45251216b04aa8b5_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr6_Aux
+    where toFunPtr = hs_bindgen_4e32721222f4df9f
+instance FromFunPtr Const_funptr6_Aux
+    where fromFunPtr = hs_bindgen_45251216b04aa8b5
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr6_Aux" Const_funptr6_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr6_Aux{unwrapConst_funptr6_Aux = y_1},
+                              getField @"unwrapConst_funptr6_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr6_Aux" (Ptr Const_funptr6_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr6_Aux")
+instance HasCField Const_funptr6_Aux "unwrapConst_funptr6_Aux"
+    where type CFieldType Const_funptr6_Aux
+                          "unwrapConst_funptr6_Aux" = CInt -> CDouble -> IO (PtrConst CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6
+    = Const_funptr6 {unwrapConst_funptr6 :: (FunPtr Const_funptr6_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr6_Aux) =>
+         HasField "unwrapConst_funptr6" Const_funptr6 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr6{unwrapConst_funptr6 = y_1},
+                              getField @"unwrapConst_funptr6" x_0)
+instance (~) ty (FunPtr Const_funptr6_Aux) =>
+         HasField "unwrapConst_funptr6" (Ptr Const_funptr6) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr6")
+instance HasCField Const_funptr6 "unwrapConst_funptr6"
+    where type CFieldType Const_funptr6
+                          "unwrapConst_funptr6" = FunPtr Const_funptr6_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr7'
+
+    __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7_Aux
+    = Const_funptr7_Aux {unwrapConst_funptr7_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr7_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_0d04fc96ffb9de06_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr7_Aux@
+hs_bindgen_0d04fc96ffb9de06 :: Const_funptr7_Aux ->
+                               IO (FunPtr Const_funptr7_Aux)
+-- __unique:__ @toConst_funptr7_Aux@
+hs_bindgen_0d04fc96ffb9de06 = \fun_0 -> fmap castFunPtr (hs_bindgen_0d04fc96ffb9de06_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr7_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr7_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_42fbcebf75a973ba_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr7_Aux@
+hs_bindgen_42fbcebf75a973ba :: FunPtr Const_funptr7_Aux ->
+                               Const_funptr7_Aux
+-- __unique:__ @fromConst_funptr7_Aux@
+hs_bindgen_42fbcebf75a973ba = \funPtr_0 -> Const_funptr7_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_42fbcebf75a973ba_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr7_Aux
+    where toFunPtr = hs_bindgen_0d04fc96ffb9de06
+instance FromFunPtr Const_funptr7_Aux
+    where fromFunPtr = hs_bindgen_42fbcebf75a973ba
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr7_Aux" Const_funptr7_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr7_Aux{unwrapConst_funptr7_Aux = y_1},
+                              getField @"unwrapConst_funptr7_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr7_Aux" (Ptr Const_funptr7_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr7_Aux")
+instance HasCField Const_funptr7_Aux "unwrapConst_funptr7_Aux"
+    where type CFieldType Const_funptr7_Aux
+                          "unwrapConst_funptr7_Aux" = CInt -> CDouble -> IO (PtrConst CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7
+    = Const_funptr7 {unwrapConst_funptr7 :: (FunPtr Const_funptr7_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr7_Aux) =>
+         HasField "unwrapConst_funptr7" Const_funptr7 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr7{unwrapConst_funptr7 = y_1},
+                              getField @"unwrapConst_funptr7" x_0)
+instance (~) ty (FunPtr Const_funptr7_Aux) =>
+         HasField "unwrapConst_funptr7" (Ptr Const_funptr7) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr7")
+instance HasCField Const_funptr7 "unwrapConst_funptr7"
+    where type CFieldType Const_funptr7
+                          "unwrapConst_funptr7" = FunPtr Const_funptr7_Aux
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char1@
+foreign import ccall safe "hs_bindgen_9950741591b35cb0" hs_bindgen_9950741591b35cb0_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char1@
+hs_bindgen_9950741591b35cb0 :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char1@
+hs_bindgen_9950741591b35cb0 = \x_0 -> \x_1 -> hs_bindgen_9950741591b35cb0_base (toFFIType x_0) (toFFIType x_1)
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_safe :: CInt -> CChar -> IO ()
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_safe = hs_bindgen_9950741591b35cb0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char2@
+foreign import ccall safe "hs_bindgen_3b213f36de64a78b" hs_bindgen_3b213f36de64a78b_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char2@
+hs_bindgen_3b213f36de64a78b :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char2@
+hs_bindgen_3b213f36de64a78b = \x_0 -> \x_1 -> hs_bindgen_3b213f36de64a78b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_safe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_safe = hs_bindgen_3b213f36de64a78b
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char3@
+foreign import ccall safe "hs_bindgen_d72da53837273ed1" hs_bindgen_d72da53837273ed1_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char3@
+hs_bindgen_d72da53837273ed1 :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_char3@
+hs_bindgen_d72da53837273ed1 = \x_0 -> \x_1 -> hs_bindgen_d72da53837273ed1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_safe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_safe = hs_bindgen_d72da53837273ed1
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short1@
+foreign import ccall safe "hs_bindgen_8e00ad94407efdce" hs_bindgen_8e00ad94407efdce_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short1@
+hs_bindgen_8e00ad94407efdce :: CInt -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short1@
+hs_bindgen_8e00ad94407efdce = \x_0 -> \x_1 -> hs_bindgen_8e00ad94407efdce_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_safe :: CInt -> CShort -> IO ()
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_safe = hs_bindgen_8e00ad94407efdce
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short2@
+foreign import ccall safe "hs_bindgen_e5814201b232d64c" hs_bindgen_e5814201b232d64c_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short2@
+hs_bindgen_e5814201b232d64c :: CInt -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short2@
+hs_bindgen_e5814201b232d64c = \x_0 -> \x_1 -> hs_bindgen_e5814201b232d64c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_safe :: CInt -> CShort -> IO ()
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_safe = hs_bindgen_e5814201b232d64c
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short3@
+foreign import ccall safe "hs_bindgen_3bbb21d02f9e8caa" hs_bindgen_3bbb21d02f9e8caa_base ::
+    CInt
+ -> CUShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short3@
+hs_bindgen_3bbb21d02f9e8caa :: CInt -> CUShort -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_short3@
+hs_bindgen_3bbb21d02f9e8caa = \x_0 -> \x_1 -> hs_bindgen_3bbb21d02f9e8caa_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_safe :: CInt -> CUShort -> IO ()
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_safe = hs_bindgen_3bbb21d02f9e8caa
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int1@
+foreign import ccall safe "hs_bindgen_fba8d44819fb4d50" hs_bindgen_fba8d44819fb4d50_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int1@
+hs_bindgen_fba8d44819fb4d50 :: CInt -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int1@
+hs_bindgen_fba8d44819fb4d50 = \x_0 -> \x_1 -> hs_bindgen_fba8d44819fb4d50_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_safe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_safe = hs_bindgen_fba8d44819fb4d50
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int2@
+foreign import ccall safe "hs_bindgen_42cfc5afda432a51" hs_bindgen_42cfc5afda432a51_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int2@
+hs_bindgen_42cfc5afda432a51 :: CInt -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int2@
+hs_bindgen_42cfc5afda432a51 = \x_0 -> \x_1 -> hs_bindgen_42cfc5afda432a51_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_safe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_safe = hs_bindgen_42cfc5afda432a51
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int3@
+foreign import ccall safe "hs_bindgen_b877c77021f548cb" hs_bindgen_b877c77021f548cb_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int3@
+hs_bindgen_b877c77021f548cb :: CInt -> CUInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_int3@
+hs_bindgen_b877c77021f548cb = \x_0 -> \x_1 -> hs_bindgen_b877c77021f548cb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_safe :: CInt -> CUInt -> IO ()
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_safe = hs_bindgen_b877c77021f548cb
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long1@
+foreign import ccall safe "hs_bindgen_365ed0d5f00ece62" hs_bindgen_365ed0d5f00ece62_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long1@
+hs_bindgen_365ed0d5f00ece62 :: CInt -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long1@
+hs_bindgen_365ed0d5f00ece62 = \x_0 -> \x_1 -> hs_bindgen_365ed0d5f00ece62_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_safe :: CInt -> CLong -> IO ()
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_safe = hs_bindgen_365ed0d5f00ece62
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long2@
+foreign import ccall safe "hs_bindgen_a1204b1083b6700a" hs_bindgen_a1204b1083b6700a_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long2@
+hs_bindgen_a1204b1083b6700a :: CInt -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long2@
+hs_bindgen_a1204b1083b6700a = \x_0 -> \x_1 -> hs_bindgen_a1204b1083b6700a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_safe :: CInt -> CLong -> IO ()
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_safe = hs_bindgen_a1204b1083b6700a
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long3@
+foreign import ccall safe "hs_bindgen_4af0668f1653ce01" hs_bindgen_4af0668f1653ce01_base ::
+    CInt
+ -> CULong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long3@
+hs_bindgen_4af0668f1653ce01 :: CInt -> CULong -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_long3@
+hs_bindgen_4af0668f1653ce01 = \x_0 -> \x_1 -> hs_bindgen_4af0668f1653ce01_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_safe :: CInt -> CULong -> IO ()
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_safe = hs_bindgen_4af0668f1653ce01
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_float@
+foreign import ccall safe "hs_bindgen_b8acf83f3c3a43b0" hs_bindgen_b8acf83f3c3a43b0_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_float@
+hs_bindgen_b8acf83f3c3a43b0 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_float@
+hs_bindgen_b8acf83f3c3a43b0 = \x_0 -> \x_1 -> hs_bindgen_b8acf83f3c3a43b0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_safe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_safe = hs_bindgen_b8acf83f3c3a43b0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_double@
+foreign import ccall safe "hs_bindgen_2a27bb82268cc870" hs_bindgen_2a27bb82268cc870_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_double@
+hs_bindgen_2a27bb82268cc870 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_double@
+hs_bindgen_2a27bb82268cc870 = \x_0 -> \x_1 -> hs_bindgen_2a27bb82268cc870_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_safe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_safe = hs_bindgen_2a27bb82268cc870
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_bool1@
+foreign import ccall safe "hs_bindgen_3f1481ac913e0394" hs_bindgen_3f1481ac913e0394_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_bool1@
+hs_bindgen_3f1481ac913e0394 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_bool1@
+hs_bindgen_3f1481ac913e0394 = \x_0 -> \x_1 -> hs_bindgen_3f1481ac913e0394_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_safe = hs_bindgen_3f1481ac913e0394
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_struct@
+foreign import ccall safe "hs_bindgen_998092a62cba613e" hs_bindgen_998092a62cba613e_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_struct@
+hs_bindgen_998092a62cba613e :: CInt -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_struct@
+hs_bindgen_998092a62cba613e = \x_0 -> \x_1 -> hs_bindgen_998092a62cba613e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_safe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_998092a62cba613e arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_union@
+foreign import ccall safe "hs_bindgen_b83fe7017c88f63e" hs_bindgen_b83fe7017c88f63e_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_union@
+hs_bindgen_b83fe7017c88f63e :: CInt -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_union@
+hs_bindgen_b83fe7017c88f63e = \x_0 -> \x_1 -> hs_bindgen_b83fe7017c88f63e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_safe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_b83fe7017c88f63e arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_enum@
+foreign import ccall safe "hs_bindgen_45ef9d5579ceaa74" hs_bindgen_45ef9d5579ceaa74_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_enum@
+hs_bindgen_45ef9d5579ceaa74 :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_enum@
+hs_bindgen_45ef9d5579ceaa74 = \x_0 -> \x_1 -> hs_bindgen_45ef9d5579ceaa74_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_safe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_safe = hs_bindgen_45ef9d5579ceaa74
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer1@
+foreign import ccall safe "hs_bindgen_862d74c6849bbcd0" hs_bindgen_862d74c6849bbcd0_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer1@
+hs_bindgen_862d74c6849bbcd0 :: CInt -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer1@
+hs_bindgen_862d74c6849bbcd0 = \x_0 -> \x_1 -> hs_bindgen_862d74c6849bbcd0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_safe :: CInt -> Ptr CInt -> IO ()
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_safe = hs_bindgen_862d74c6849bbcd0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer2@
+foreign import ccall safe "hs_bindgen_0df09844c5645db9" hs_bindgen_0df09844c5645db9_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer2@
+hs_bindgen_0df09844c5645db9 :: CInt -> Ptr (Ptr CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer2@
+hs_bindgen_0df09844c5645db9 = \x_0 -> \x_1 -> hs_bindgen_0df09844c5645db9_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_safe :: CInt -> Ptr (Ptr CInt) -> IO ()
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_safe = hs_bindgen_0df09844c5645db9
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer3@
+foreign import ccall safe "hs_bindgen_221cb5a1c4ce6a3b" hs_bindgen_221cb5a1c4ce6a3b_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer3@
+hs_bindgen_221cb5a1c4ce6a3b :: CInt -> Ptr Void -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_pointer3@
+hs_bindgen_221cb5a1c4ce6a3b = \x_0 -> \x_1 -> hs_bindgen_221cb5a1c4ce6a3b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_safe :: CInt -> Ptr Void -> IO ()
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_safe = hs_bindgen_221cb5a1c4ce6a3b
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_A@
+foreign import ccall safe "hs_bindgen_dfd4e13321b706b1" hs_bindgen_dfd4e13321b706b1_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_A@
+hs_bindgen_dfd4e13321b706b1 :: IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_A@
+hs_bindgen_dfd4e13321b706b1 = fmap fromFFIType hs_bindgen_dfd4e13321b706b1_base
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_safe :: IO CInt
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_safe = hs_bindgen_dfd4e13321b706b1
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char1@
+foreign import ccall safe "hs_bindgen_5289300b6ae3ff51" hs_bindgen_5289300b6ae3ff51_base ::
+    CInt
+ -> IO CChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char1@
+hs_bindgen_5289300b6ae3ff51 :: CInt -> IO CChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char1@
+hs_bindgen_5289300b6ae3ff51 = \x_0 -> fmap fromFFIType (hs_bindgen_5289300b6ae3ff51_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_safe :: CInt -> IO CChar
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_safe = hs_bindgen_5289300b6ae3ff51
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char2@
+foreign import ccall safe "hs_bindgen_b258f6c4e2c9be38" hs_bindgen_b258f6c4e2c9be38_base ::
+    CInt
+ -> IO CSChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char2@
+hs_bindgen_b258f6c4e2c9be38 :: CInt -> IO CSChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char2@
+hs_bindgen_b258f6c4e2c9be38 = \x_0 -> fmap fromFFIType (hs_bindgen_b258f6c4e2c9be38_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_safe :: CInt -> IO CSChar
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_safe = hs_bindgen_b258f6c4e2c9be38
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char3@
+foreign import ccall safe "hs_bindgen_734b5b749255713a" hs_bindgen_734b5b749255713a_base ::
+    CInt
+ -> IO CUChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char3@
+hs_bindgen_734b5b749255713a :: CInt -> IO CUChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_char3@
+hs_bindgen_734b5b749255713a = \x_0 -> fmap fromFFIType (hs_bindgen_734b5b749255713a_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_safe :: CInt -> IO CUChar
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_safe = hs_bindgen_734b5b749255713a
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short1@
+foreign import ccall safe "hs_bindgen_d17d4780d98d2561" hs_bindgen_d17d4780d98d2561_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short1@
+hs_bindgen_d17d4780d98d2561 :: CInt -> IO CShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short1@
+hs_bindgen_d17d4780d98d2561 = \x_0 -> fmap fromFFIType (hs_bindgen_d17d4780d98d2561_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_safe :: CInt -> IO CShort
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_safe = hs_bindgen_d17d4780d98d2561
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short2@
+foreign import ccall safe "hs_bindgen_1f808a3cec3781e1" hs_bindgen_1f808a3cec3781e1_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short2@
+hs_bindgen_1f808a3cec3781e1 :: CInt -> IO CShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short2@
+hs_bindgen_1f808a3cec3781e1 = \x_0 -> fmap fromFFIType (hs_bindgen_1f808a3cec3781e1_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_safe :: CInt -> IO CShort
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_safe = hs_bindgen_1f808a3cec3781e1
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short3@
+foreign import ccall safe "hs_bindgen_5204d0272f75f1a2" hs_bindgen_5204d0272f75f1a2_base ::
+    CInt
+ -> IO CUShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short3@
+hs_bindgen_5204d0272f75f1a2 :: CInt -> IO CUShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_short3@
+hs_bindgen_5204d0272f75f1a2 = \x_0 -> fmap fromFFIType (hs_bindgen_5204d0272f75f1a2_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_safe :: CInt -> IO CUShort
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_safe = hs_bindgen_5204d0272f75f1a2
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int1@
+foreign import ccall safe "hs_bindgen_14351eeb2c92732a" hs_bindgen_14351eeb2c92732a_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int1@
+hs_bindgen_14351eeb2c92732a :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int1@
+hs_bindgen_14351eeb2c92732a = \x_0 -> fmap fromFFIType (hs_bindgen_14351eeb2c92732a_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_safe :: CInt -> IO CInt
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_safe = hs_bindgen_14351eeb2c92732a
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int2@
+foreign import ccall safe "hs_bindgen_f91baafc096613a0" hs_bindgen_f91baafc096613a0_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int2@
+hs_bindgen_f91baafc096613a0 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int2@
+hs_bindgen_f91baafc096613a0 = \x_0 -> fmap fromFFIType (hs_bindgen_f91baafc096613a0_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_safe :: CInt -> IO CInt
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_safe = hs_bindgen_f91baafc096613a0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int3@
+foreign import ccall safe "hs_bindgen_e78391249ef8ffbf" hs_bindgen_e78391249ef8ffbf_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int3@
+hs_bindgen_e78391249ef8ffbf :: CInt -> IO CUInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_int3@
+hs_bindgen_e78391249ef8ffbf = \x_0 -> fmap fromFFIType (hs_bindgen_e78391249ef8ffbf_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_safe :: CInt -> IO CUInt
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_safe = hs_bindgen_e78391249ef8ffbf
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long1@
+foreign import ccall safe "hs_bindgen_4f8ae7ed648c72e4" hs_bindgen_4f8ae7ed648c72e4_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long1@
+hs_bindgen_4f8ae7ed648c72e4 :: CInt -> IO CLong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long1@
+hs_bindgen_4f8ae7ed648c72e4 = \x_0 -> fmap fromFFIType (hs_bindgen_4f8ae7ed648c72e4_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_safe :: CInt -> IO CLong
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_safe = hs_bindgen_4f8ae7ed648c72e4
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long2@
+foreign import ccall safe "hs_bindgen_c0a47369a5a10695" hs_bindgen_c0a47369a5a10695_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long2@
+hs_bindgen_c0a47369a5a10695 :: CInt -> IO CLong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long2@
+hs_bindgen_c0a47369a5a10695 = \x_0 -> fmap fromFFIType (hs_bindgen_c0a47369a5a10695_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_safe :: CInt -> IO CLong
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_safe = hs_bindgen_c0a47369a5a10695
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long3@
+foreign import ccall safe "hs_bindgen_64aa36b6c820a3bf" hs_bindgen_64aa36b6c820a3bf_base ::
+    CInt
+ -> IO CULong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long3@
+hs_bindgen_64aa36b6c820a3bf :: CInt -> IO CULong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_long3@
+hs_bindgen_64aa36b6c820a3bf = \x_0 -> fmap fromFFIType (hs_bindgen_64aa36b6c820a3bf_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_safe :: CInt -> IO CULong
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_safe = hs_bindgen_64aa36b6c820a3bf
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_float@
+foreign import ccall safe "hs_bindgen_b53c45aaccbaaf3a" hs_bindgen_b53c45aaccbaaf3a_base ::
+    CInt
+ -> IO CFloat
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_float@
+hs_bindgen_b53c45aaccbaaf3a :: CInt -> IO CFloat
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_float@
+hs_bindgen_b53c45aaccbaaf3a = \x_0 -> fmap fromFFIType (hs_bindgen_b53c45aaccbaaf3a_base (toFFIType x_0))
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_safe :: CInt -> IO CFloat
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_safe = hs_bindgen_b53c45aaccbaaf3a
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_double@
+foreign import ccall safe "hs_bindgen_0ca050f5bbe69c94" hs_bindgen_0ca050f5bbe69c94_base ::
+    CInt
+ -> IO CDouble
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_double@
+hs_bindgen_0ca050f5bbe69c94 :: CInt -> IO CDouble
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_double@
+hs_bindgen_0ca050f5bbe69c94 = \x_0 -> fmap fromFFIType (hs_bindgen_0ca050f5bbe69c94_base (toFFIType x_0))
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_safe :: CInt -> IO CDouble
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_safe = hs_bindgen_0ca050f5bbe69c94
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_bool1@
+foreign import ccall safe "hs_bindgen_530e0725cadf8f52" hs_bindgen_530e0725cadf8f52_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_bool1@
+hs_bindgen_530e0725cadf8f52 :: CInt -> IO CBool
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_bool1@
+hs_bindgen_530e0725cadf8f52 = \x_0 -> fmap fromFFIType (hs_bindgen_530e0725cadf8f52_base (toFFIType x_0))
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_safe :: CInt -> IO CBool
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_safe = hs_bindgen_530e0725cadf8f52
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_struct@
+foreign import ccall safe "hs_bindgen_8f19d5621a4f3e92" hs_bindgen_8f19d5621a4f3e92_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_struct@
+hs_bindgen_8f19d5621a4f3e92 :: CInt -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_struct@
+hs_bindgen_8f19d5621a4f3e92 = \x_0 -> \x_1 -> hs_bindgen_8f19d5621a4f3e92_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_safe :: CInt -> IO Some_struct
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_8f19d5621a4f3e92 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_union@
+foreign import ccall safe "hs_bindgen_e93cfabcefb5051b" hs_bindgen_e93cfabcefb5051b_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_union@
+hs_bindgen_e93cfabcefb5051b :: CInt -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_union@
+hs_bindgen_e93cfabcefb5051b = \x_0 -> \x_1 -> hs_bindgen_e93cfabcefb5051b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_safe :: CInt -> IO Some_union
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_e93cfabcefb5051b arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_enum@
+foreign import ccall safe "hs_bindgen_f672d8d1020b037f" hs_bindgen_f672d8d1020b037f_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_enum@
+hs_bindgen_f672d8d1020b037f :: CInt -> IO Some_enum
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_enum@
+hs_bindgen_f672d8d1020b037f = \x_0 -> fmap fromFFIType (hs_bindgen_f672d8d1020b037f_base (toFFIType x_0))
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_safe :: CInt -> IO Some_enum
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_safe = hs_bindgen_f672d8d1020b037f
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer1@
+foreign import ccall safe "hs_bindgen_1b0ed1f4c7ddeb1e" hs_bindgen_1b0ed1f4c7ddeb1e_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer1@
+hs_bindgen_1b0ed1f4c7ddeb1e :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer1@
+hs_bindgen_1b0ed1f4c7ddeb1e = \x_0 -> fmap fromFFIType (hs_bindgen_1b0ed1f4c7ddeb1e_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_safe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_safe = hs_bindgen_1b0ed1f4c7ddeb1e
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer2@
+foreign import ccall safe "hs_bindgen_46ff1f39be014f9f" hs_bindgen_46ff1f39be014f9f_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer2@
+hs_bindgen_46ff1f39be014f9f :: CInt -> IO (Ptr (Ptr CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer2@
+hs_bindgen_46ff1f39be014f9f = \x_0 -> fmap fromFFIType (hs_bindgen_46ff1f39be014f9f_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_safe :: CInt -> IO (Ptr (Ptr CInt))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_safe = hs_bindgen_46ff1f39be014f9f
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer3@
+foreign import ccall safe "hs_bindgen_c4737a52f27dfdac" hs_bindgen_c4737a52f27dfdac_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer3@
+hs_bindgen_c4737a52f27dfdac :: CInt -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_pointer3@
+hs_bindgen_c4737a52f27dfdac = \x_0 -> fmap fromFFIType (hs_bindgen_c4737a52f27dfdac_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_safe :: CInt -> IO (Ptr Void)
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_safe = hs_bindgen_c4737a52f27dfdac
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body1@
+foreign import ccall safe "hs_bindgen_fdef71f6bc647af6" hs_bindgen_fdef71f6bc647af6_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body1@
+hs_bindgen_fdef71f6bc647af6 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body1@
+hs_bindgen_fdef71f6bc647af6 = \x_0 -> fmap fromFFIType (hs_bindgen_fdef71f6bc647af6_base (toFFIType x_0))
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_safe :: CInt -> IO CInt
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_safe = hs_bindgen_fdef71f6bc647af6
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body2@
+foreign import ccall safe "hs_bindgen_4ebf4e201327a21a" hs_bindgen_4ebf4e201327a21a_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body2@
+hs_bindgen_4ebf4e201327a21a :: IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_body2@
+hs_bindgen_4ebf4e201327a21a = fmap fromFFIType hs_bindgen_4ebf4e201327a21a_base
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_safe :: IO CInt
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_safe = hs_bindgen_4ebf4e201327a21a
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_float@
+foreign import ccall safe "hs_bindgen_7229e893bab43698" hs_bindgen_7229e893bab43698_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_float@
+hs_bindgen_7229e893bab43698 :: CInt ->
+                               Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_float@
+hs_bindgen_7229e893bab43698 = \x_0 -> \x_1 -> hs_bindgen_7229e893bab43698_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_safe :: CInt -> Complex CFloat -> IO ()
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_7229e893bab43698 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_double@
+foreign import ccall safe "hs_bindgen_0cbb6cfd403656ec" hs_bindgen_0cbb6cfd403656ec_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_double@
+hs_bindgen_0cbb6cfd403656ec :: CInt ->
+                               Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_args_complex_double@
+hs_bindgen_0cbb6cfd403656ec = \x_0 -> \x_1 -> hs_bindgen_0cbb6cfd403656ec_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_safe :: CInt -> Complex CDouble -> IO ()
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_0cbb6cfd403656ec arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_float@
+foreign import ccall safe "hs_bindgen_7fa01b9c64606663" hs_bindgen_7fa01b9c64606663_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_float@
+hs_bindgen_7fa01b9c64606663 :: CInt ->
+                               Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_float@
+hs_bindgen_7fa01b9c64606663 = \x_0 -> \x_1 -> hs_bindgen_7fa01b9c64606663_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_safe :: CInt -> IO (Complex CFloat)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_7fa01b9c64606663 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_double@
+foreign import ccall safe "hs_bindgen_81ad2d3ffe70c3a9" hs_bindgen_81ad2d3ffe70c3a9_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_double@
+hs_bindgen_81ad2d3ffe70c3a9 :: CInt ->
+                               Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_ret_complex_double@
+hs_bindgen_81ad2d3ffe70c3a9 = \x_0 -> \x_1 -> hs_bindgen_81ad2d3ffe70c3a9_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_safe :: CInt -> IO (Complex CDouble)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_81ad2d3ffe70c3a9 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args1@
+foreign import ccall safe "hs_bindgen_1c3c1f6f6a7e2bc8" hs_bindgen_1c3c1f6f6a7e2bc8_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args1@
+hs_bindgen_1c3c1f6f6a7e2bc8 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args1@
+hs_bindgen_1c3c1f6f6a7e2bc8 = \x_0 -> \x_1 -> hs_bindgen_1c3c1f6f6a7e2bc8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_safe = hs_bindgen_1c3c1f6f6a7e2bc8
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args2@
+foreign import ccall safe "hs_bindgen_a5e6d8b6d973331f" hs_bindgen_a5e6d8b6d973331f_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args2@
+hs_bindgen_a5e6d8b6d973331f :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_args2@
+hs_bindgen_a5e6d8b6d973331f = \x_0 -> \x_1 -> hs_bindgen_a5e6d8b6d973331f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_safe :: CInt -> HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_safe = hs_bindgen_a5e6d8b6d973331f
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret1@
+foreign import ccall safe "hs_bindgen_0f143bde59bade44" hs_bindgen_0f143bde59bade44_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret1@
+hs_bindgen_0f143bde59bade44 :: CInt -> IO CBool
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret1@
+hs_bindgen_0f143bde59bade44 = \x_0 -> fmap fromFFIType (hs_bindgen_0f143bde59bade44_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_safe :: CInt -> IO CBool
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_safe = hs_bindgen_0f143bde59bade44
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret2@
+foreign import ccall safe "hs_bindgen_3fe674df63c48d30" hs_bindgen_3fe674df63c48d30_base ::
+    CInt
+ -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret2@
+hs_bindgen_3fe674df63c48d30 :: CInt ->
+                               IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_bespoke_ret2@
+hs_bindgen_3fe674df63c48d30 = \x_0 -> fmap fromFFIType (hs_bindgen_3fe674df63c48d30_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_safe :: CInt -> IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_safe = hs_bindgen_3fe674df63c48d30
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args1@
+foreign import ccall safe "hs_bindgen_a8eaeaa944a099d9" hs_bindgen_a8eaeaa944a099d9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args1@
+hs_bindgen_a8eaeaa944a099d9 :: Ptr (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args1@
+hs_bindgen_a8eaeaa944a099d9 = \x_0 -> hs_bindgen_a8eaeaa944a099d9_base (toFFIType x_0)
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_safe :: Ptr (Elem (IncompleteArray CInt)) -> IO ()
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_safe = hs_bindgen_a8eaeaa944a099d9
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args2@
+foreign import ccall safe "hs_bindgen_f928df06f2f528e0" hs_bindgen_f928df06f2f528e0_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args2@
+hs_bindgen_f928df06f2f528e0 :: Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args2@
+hs_bindgen_f928df06f2f528e0 = \x_0 -> hs_bindgen_f928df06f2f528e0_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_safe :: Ptr (Elem (IncompleteArray (Ptr CInt))) -> IO ()
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_safe = hs_bindgen_f928df06f2f528e0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args3@
+foreign import ccall safe "hs_bindgen_2fb2e9d0563a690b" hs_bindgen_2fb2e9d0563a690b_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args3@
+hs_bindgen_2fb2e9d0563a690b :: Ptr (Elem (ConstantArray 5 CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args3@
+hs_bindgen_2fb2e9d0563a690b = \x_0 -> hs_bindgen_2fb2e9d0563a690b_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_safe :: Ptr (Elem (ConstantArray 5 CInt)) -> IO ()
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_safe = hs_bindgen_2fb2e9d0563a690b
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args4@
+foreign import ccall safe "hs_bindgen_b9b529def42c1efd" hs_bindgen_b9b529def42c1efd_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args4@
+hs_bindgen_b9b529def42c1efd :: Ptr (Elem (ConstantArray 5
+                                                        (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_arr_args4@
+hs_bindgen_b9b529def42c1efd = \x_0 -> hs_bindgen_b9b529def42c1efd_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_safe :: Ptr (Elem (ConstantArray 5 (Ptr CInt))) -> IO ()
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_safe = hs_bindgen_b9b529def42c1efd
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args1@
+foreign import ccall safe "hs_bindgen_5ab0516185b48906" hs_bindgen_5ab0516185b48906_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args1@
+hs_bindgen_5ab0516185b48906 :: CInt -> FunPtr (IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args1@
+hs_bindgen_5ab0516185b48906 = \x_0 -> \x_1 -> hs_bindgen_5ab0516185b48906_base (toFFIType x_0) (toFFIType x_1)
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_safe :: CInt -> FunPtr (IO ()) -> IO ()
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_safe = hs_bindgen_5ab0516185b48906
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args2@
+foreign import ccall safe "hs_bindgen_682810b65a83f101" hs_bindgen_682810b65a83f101_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args2@
+hs_bindgen_682810b65a83f101 :: CInt -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args2@
+hs_bindgen_682810b65a83f101 = \x_0 -> \x_1 -> hs_bindgen_682810b65a83f101_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_safe :: CInt -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_safe = hs_bindgen_682810b65a83f101
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args3@
+foreign import ccall safe "hs_bindgen_a06192a621a12016" hs_bindgen_a06192a621a12016_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args3@
+hs_bindgen_a06192a621a12016 :: CInt ->
+                               FunPtr (CInt -> IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args3@
+hs_bindgen_a06192a621a12016 = \x_0 -> \x_1 -> hs_bindgen_a06192a621a12016_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_safe :: CInt -> FunPtr (CInt -> IO ()) -> IO ()
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_safe = hs_bindgen_a06192a621a12016
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args4@
+foreign import ccall safe "hs_bindgen_414fd8b92ff2611b" hs_bindgen_414fd8b92ff2611b_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args4@
+hs_bindgen_414fd8b92ff2611b :: CInt ->
+                               FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args4@
+hs_bindgen_414fd8b92ff2611b = \x_0 -> \x_1 -> hs_bindgen_414fd8b92ff2611b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_safe :: CInt ->
+                     FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_safe = hs_bindgen_414fd8b92ff2611b
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args5@
+foreign import ccall safe "hs_bindgen_62b477fc0c092e32" hs_bindgen_62b477fc0c092e32_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args5@
+hs_bindgen_62b477fc0c092e32 :: CInt ->
+                               FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_args5@
+hs_bindgen_62b477fc0c092e32 = \x_0 -> \x_1 -> hs_bindgen_62b477fc0c092e32_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_safe :: CInt ->
+                     FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_safe = hs_bindgen_62b477fc0c092e32
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_comments1@
+foreign import ccall safe "hs_bindgen_17fb56aae1527722" hs_bindgen_17fb56aae1527722_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_comments1@
+hs_bindgen_17fb56aae1527722 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_comments1@
+hs_bindgen_17fb56aae1527722 = \x_0 -> hs_bindgen_17fb56aae1527722_base (toFFIType x_0)
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_safe :: CInt -> IO ()
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_safe = hs_bindgen_17fb56aae1527722
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before1@
+foreign import ccall safe "hs_bindgen_e70333f7108e59a8" hs_bindgen_e70333f7108e59a8_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before1@
+hs_bindgen_e70333f7108e59a8 :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before1@
+hs_bindgen_e70333f7108e59a8 = \x_0 -> \x_1 -> hs_bindgen_e70333f7108e59a8_base (toFFIType x_0) (toFFIType x_1)
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_safe :: CInt -> CChar -> IO ()
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_safe = hs_bindgen_e70333f7108e59a8
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before2@
+foreign import ccall safe "hs_bindgen_14a503cc3e41e014" hs_bindgen_14a503cc3e41e014_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before2@
+hs_bindgen_14a503cc3e41e014 :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before2@
+hs_bindgen_14a503cc3e41e014 = \x_0 -> \x_1 -> hs_bindgen_14a503cc3e41e014_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_safe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_safe = hs_bindgen_14a503cc3e41e014
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before3@
+foreign import ccall safe "hs_bindgen_504ad9cb98a4f946" hs_bindgen_504ad9cb98a4f946_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before3@
+hs_bindgen_504ad9cb98a4f946 :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_before3@
+hs_bindgen_504ad9cb98a4f946 = \x_0 -> \x_1 -> hs_bindgen_504ad9cb98a4f946_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_safe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_safe = hs_bindgen_504ad9cb98a4f946
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after1@
+foreign import ccall safe "hs_bindgen_c0c67bf5b144c658" hs_bindgen_c0c67bf5b144c658_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after1@
+hs_bindgen_c0c67bf5b144c658 :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after1@
+hs_bindgen_c0c67bf5b144c658 = \x_0 -> \x_1 -> hs_bindgen_c0c67bf5b144c658_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_safe :: CInt -> CChar -> IO ()
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_safe = hs_bindgen_c0c67bf5b144c658
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after2@
+foreign import ccall safe "hs_bindgen_72fa51e2c7023b88" hs_bindgen_72fa51e2c7023b88_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after2@
+hs_bindgen_72fa51e2c7023b88 :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after2@
+hs_bindgen_72fa51e2c7023b88 = \x_0 -> \x_1 -> hs_bindgen_72fa51e2c7023b88_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_safe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_safe = hs_bindgen_72fa51e2c7023b88
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after3@
+foreign import ccall safe "hs_bindgen_b09c2805c508fddf" hs_bindgen_b09c2805c508fddf_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after3@
+hs_bindgen_b09c2805c508fddf :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_prim_after3@
+hs_bindgen_b09c2805c508fddf = \x_0 -> \x_1 -> hs_bindgen_b09c2805c508fddf_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_safe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_safe = hs_bindgen_b09c2805c508fddf
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before1@
+foreign import ccall safe "hs_bindgen_85bf325f09491972" hs_bindgen_85bf325f09491972_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before1@
+hs_bindgen_85bf325f09491972 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before1@
+hs_bindgen_85bf325f09491972 = \x_0 -> \x_1 -> hs_bindgen_85bf325f09491972_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_safe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_safe = hs_bindgen_85bf325f09491972
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before2@
+foreign import ccall safe "hs_bindgen_45a61f720b0fe2ed" hs_bindgen_45a61f720b0fe2ed_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before2@
+hs_bindgen_45a61f720b0fe2ed :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before2@
+hs_bindgen_45a61f720b0fe2ed = \x_0 -> \x_1 -> hs_bindgen_45a61f720b0fe2ed_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_safe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_safe = hs_bindgen_45a61f720b0fe2ed
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before3@
+foreign import ccall safe "hs_bindgen_36c611aa17d28531" hs_bindgen_36c611aa17d28531_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before3@
+hs_bindgen_36c611aa17d28531 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before3@
+hs_bindgen_36c611aa17d28531 = \x_0 -> \x_1 -> hs_bindgen_36c611aa17d28531_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_safe = hs_bindgen_36c611aa17d28531
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before4@
+foreign import ccall safe "hs_bindgen_a614ed967b401309" hs_bindgen_a614ed967b401309_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before4@
+hs_bindgen_a614ed967b401309 :: CInt ->
+                               PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before4@
+hs_bindgen_a614ed967b401309 = \x_0 -> \x_1 -> hs_bindgen_a614ed967b401309_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_safe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_a614ed967b401309 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before5@
+foreign import ccall safe "hs_bindgen_0e258c684851b84f" hs_bindgen_0e258c684851b84f_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before5@
+hs_bindgen_0e258c684851b84f :: CInt -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before5@
+hs_bindgen_0e258c684851b84f = \x_0 -> \x_1 -> hs_bindgen_0e258c684851b84f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_safe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_0e258c684851b84f arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before6@
+foreign import ccall safe "hs_bindgen_9f7d70e8a0106516" hs_bindgen_9f7d70e8a0106516_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before6@
+hs_bindgen_9f7d70e8a0106516 :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before6@
+hs_bindgen_9f7d70e8a0106516 = \x_0 -> \x_1 -> hs_bindgen_9f7d70e8a0106516_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_safe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_safe = hs_bindgen_9f7d70e8a0106516
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before7@
+foreign import ccall safe "hs_bindgen_0b71a82a5fa4fc87" hs_bindgen_0b71a82a5fa4fc87_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before7@
+hs_bindgen_0b71a82a5fa4fc87 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before7@
+hs_bindgen_0b71a82a5fa4fc87 = \x_0 -> \x_1 -> hs_bindgen_0b71a82a5fa4fc87_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_safe = hs_bindgen_0b71a82a5fa4fc87
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before8@
+foreign import ccall safe "hs_bindgen_7ebb88bce2abdf74" hs_bindgen_7ebb88bce2abdf74_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before8@
+hs_bindgen_7ebb88bce2abdf74 :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_before8@
+hs_bindgen_7ebb88bce2abdf74 = \x_0 -> \x_1 -> hs_bindgen_7ebb88bce2abdf74_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_safe :: CInt ->
+                                  HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_safe = hs_bindgen_7ebb88bce2abdf74
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after1@
+foreign import ccall safe "hs_bindgen_7188d6a351cf7dd5" hs_bindgen_7188d6a351cf7dd5_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after1@
+hs_bindgen_7188d6a351cf7dd5 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after1@
+hs_bindgen_7188d6a351cf7dd5 = \x_0 -> \x_1 -> hs_bindgen_7188d6a351cf7dd5_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_safe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_safe = hs_bindgen_7188d6a351cf7dd5
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after2@
+foreign import ccall safe "hs_bindgen_bd2e5fd19a5f4d84" hs_bindgen_bd2e5fd19a5f4d84_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after2@
+hs_bindgen_bd2e5fd19a5f4d84 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after2@
+hs_bindgen_bd2e5fd19a5f4d84 = \x_0 -> \x_1 -> hs_bindgen_bd2e5fd19a5f4d84_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_safe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_safe = hs_bindgen_bd2e5fd19a5f4d84
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after3@
+foreign import ccall safe "hs_bindgen_ab0f4d2e36402e2f" hs_bindgen_ab0f4d2e36402e2f_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after3@
+hs_bindgen_ab0f4d2e36402e2f :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after3@
+hs_bindgen_ab0f4d2e36402e2f = \x_0 -> \x_1 -> hs_bindgen_ab0f4d2e36402e2f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_safe = hs_bindgen_ab0f4d2e36402e2f
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after4@
+foreign import ccall safe "hs_bindgen_d4fdffd51b526049" hs_bindgen_d4fdffd51b526049_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after4@
+hs_bindgen_d4fdffd51b526049 :: CInt ->
+                               PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after4@
+hs_bindgen_d4fdffd51b526049 = \x_0 -> \x_1 -> hs_bindgen_d4fdffd51b526049_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_safe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_d4fdffd51b526049 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after5@
+foreign import ccall safe "hs_bindgen_662a5811d33311fd" hs_bindgen_662a5811d33311fd_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after5@
+hs_bindgen_662a5811d33311fd :: CInt -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after5@
+hs_bindgen_662a5811d33311fd = \x_0 -> \x_1 -> hs_bindgen_662a5811d33311fd_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_safe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_662a5811d33311fd arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after6@
+foreign import ccall safe "hs_bindgen_6755aa8f356d9bb1" hs_bindgen_6755aa8f356d9bb1_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after6@
+hs_bindgen_6755aa8f356d9bb1 :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after6@
+hs_bindgen_6755aa8f356d9bb1 = \x_0 -> \x_1 -> hs_bindgen_6755aa8f356d9bb1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_safe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_safe = hs_bindgen_6755aa8f356d9bb1
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after7@
+foreign import ccall safe "hs_bindgen_38694a08d2a7599a" hs_bindgen_38694a08d2a7599a_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after7@
+hs_bindgen_38694a08d2a7599a :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after7@
+hs_bindgen_38694a08d2a7599a = \x_0 -> \x_1 -> hs_bindgen_38694a08d2a7599a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_safe = hs_bindgen_38694a08d2a7599a
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after8@
+foreign import ccall safe "hs_bindgen_44cd79114d322610" hs_bindgen_44cd79114d322610_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after8@
+hs_bindgen_44cd79114d322610 :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_withoutSign_after8@
+hs_bindgen_44cd79114d322610 = \x_0 -> \x_1 -> hs_bindgen_44cd79114d322610_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_safe :: CInt ->
+                                 HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_safe = hs_bindgen_44cd79114d322610
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args1@
+foreign import ccall safe "hs_bindgen_30969f0e26032752" hs_bindgen_30969f0e26032752_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args1@
+hs_bindgen_30969f0e26032752 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args1@
+hs_bindgen_30969f0e26032752 = \x_0 -> \x_1 -> hs_bindgen_30969f0e26032752_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_safe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_safe = hs_bindgen_30969f0e26032752
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args2@
+foreign import ccall safe "hs_bindgen_35235928bc01e390" hs_bindgen_35235928bc01e390_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args2@
+hs_bindgen_35235928bc01e390 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args2@
+hs_bindgen_35235928bc01e390 = \x_0 -> \x_1 -> hs_bindgen_35235928bc01e390_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_safe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_safe = hs_bindgen_35235928bc01e390
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args3@
+foreign import ccall safe "hs_bindgen_9853f1c7b6472022" hs_bindgen_9853f1c7b6472022_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args3@
+hs_bindgen_9853f1c7b6472022 :: CInt -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args3@
+hs_bindgen_9853f1c7b6472022 = \x_0 -> \x_1 -> hs_bindgen_9853f1c7b6472022_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_safe :: CInt -> Ptr CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_safe = hs_bindgen_9853f1c7b6472022
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args4@
+foreign import ccall safe "hs_bindgen_e3b1d92f43d9cda7" hs_bindgen_e3b1d92f43d9cda7_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args4@
+hs_bindgen_e3b1d92f43d9cda7 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args4@
+hs_bindgen_e3b1d92f43d9cda7 = \x_0 -> \x_1 -> hs_bindgen_e3b1d92f43d9cda7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_safe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_safe = hs_bindgen_e3b1d92f43d9cda7
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args5@
+foreign import ccall safe "hs_bindgen_b4a0d9b232b8ee87" hs_bindgen_b4a0d9b232b8ee87_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args5@
+hs_bindgen_b4a0d9b232b8ee87 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_args5@
+hs_bindgen_b4a0d9b232b8ee87 = \x_0 -> \x_1 -> hs_bindgen_b4a0d9b232b8ee87_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_safe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_safe = hs_bindgen_b4a0d9b232b8ee87
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret1@
+foreign import ccall safe "hs_bindgen_ce61a185fdbd1b5e" hs_bindgen_ce61a185fdbd1b5e_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret1@
+hs_bindgen_ce61a185fdbd1b5e :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret1@
+hs_bindgen_ce61a185fdbd1b5e = \x_0 -> fmap fromFFIType (hs_bindgen_ce61a185fdbd1b5e_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_safe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_safe = hs_bindgen_ce61a185fdbd1b5e
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret2@
+foreign import ccall safe "hs_bindgen_001714607a85bf44" hs_bindgen_001714607a85bf44_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret2@
+hs_bindgen_001714607a85bf44 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret2@
+hs_bindgen_001714607a85bf44 = \x_0 -> fmap fromFFIType (hs_bindgen_001714607a85bf44_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_safe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_safe = hs_bindgen_001714607a85bf44
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret3@
+foreign import ccall safe "hs_bindgen_0481dd02a7bda0cb" hs_bindgen_0481dd02a7bda0cb_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret3@
+hs_bindgen_0481dd02a7bda0cb :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret3@
+hs_bindgen_0481dd02a7bda0cb = \x_0 -> fmap fromFFIType (hs_bindgen_0481dd02a7bda0cb_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_safe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_safe = hs_bindgen_0481dd02a7bda0cb
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret4@
+foreign import ccall safe "hs_bindgen_2b32282230882c4f" hs_bindgen_2b32282230882c4f_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret4@
+hs_bindgen_2b32282230882c4f :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret4@
+hs_bindgen_2b32282230882c4f = \x_0 -> fmap fromFFIType (hs_bindgen_2b32282230882c4f_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_safe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_safe = hs_bindgen_2b32282230882c4f
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret5@
+foreign import ccall safe "hs_bindgen_094656d98097f48e" hs_bindgen_094656d98097f48e_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret5@
+hs_bindgen_094656d98097f48e :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_pointers_ret5@
+hs_bindgen_094656d98097f48e = \x_0 -> fmap fromFFIType (hs_bindgen_094656d98097f48e_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_safe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_safe = hs_bindgen_094656d98097f48e
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem1@
+foreign import ccall safe "hs_bindgen_5f2909e0d90b7530" hs_bindgen_5f2909e0d90b7530_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem1@
+hs_bindgen_5f2909e0d90b7530 :: PtrConst (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem1@
+hs_bindgen_5f2909e0d90b7530 = \x_0 -> hs_bindgen_5f2909e0d90b7530_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_safe :: PtrConst (Elem (IncompleteArray CInt)) ->
+                          IO ()
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_safe = hs_bindgen_5f2909e0d90b7530
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem2@
+foreign import ccall safe "hs_bindgen_a9a1c34158c32e13" hs_bindgen_a9a1c34158c32e13_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem2@
+hs_bindgen_a9a1c34158c32e13 :: Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem2@
+hs_bindgen_a9a1c34158c32e13 = \x_0 -> hs_bindgen_a9a1c34158c32e13_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_safe :: Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                          IO ()
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_safe = hs_bindgen_a9a1c34158c32e13
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem3@
+foreign import ccall safe "hs_bindgen_55765da8c98676da" hs_bindgen_55765da8c98676da_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem3@
+hs_bindgen_55765da8c98676da :: PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_const_array_elem3@
+hs_bindgen_55765da8c98676da = \x_0 -> hs_bindgen_55765da8c98676da_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_safe :: PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                          IO ()
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_safe = hs_bindgen_55765da8c98676da
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams1@
+foreign import ccall safe "hs_bindgen_2692ad6e69dd9bf6" hs_bindgen_2692ad6e69dd9bf6_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams1@
+hs_bindgen_2692ad6e69dd9bf6 :: IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams1@
+hs_bindgen_2692ad6e69dd9bf6 = fmap fromFFIType hs_bindgen_2692ad6e69dd9bf6_base
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_safe :: IO CInt
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_safe = hs_bindgen_2692ad6e69dd9bf6
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams2@
+foreign import ccall safe "hs_bindgen_b016e4354ee966d9" hs_bindgen_b016e4354ee966d9_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams2@
+hs_bindgen_b016e4354ee966d9 :: IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams2@
+hs_bindgen_b016e4354ee966d9 = fmap fromFFIType hs_bindgen_b016e4354ee966d9_base
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_safe :: IO CInt
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_safe = hs_bindgen_b016e4354ee966d9
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams3@
+foreign import ccall safe "hs_bindgen_9a5fca17446c0b64" hs_bindgen_9a5fca17446c0b64_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams3@
+hs_bindgen_9a5fca17446c0b64 :: CInt -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_noParams3@
+hs_bindgen_9a5fca17446c0b64 = \x_0 -> \x_1 -> hs_bindgen_9a5fca17446c0b64_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_safe :: CInt -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_safe = hs_bindgen_9a5fca17446c0b64
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret1@
+foreign import ccall safe "hs_bindgen_e0ae2ea8372de864" hs_bindgen_e0ae2ea8372de864_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret1@
+hs_bindgen_e0ae2ea8372de864 :: CInt -> IO (FunPtr (IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret1@
+hs_bindgen_e0ae2ea8372de864 = \x_0 -> fmap fromFFIType (hs_bindgen_e0ae2ea8372de864_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_safe :: CInt -> IO (FunPtr (IO ()))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_safe = hs_bindgen_e0ae2ea8372de864
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret2@
+foreign import ccall safe "hs_bindgen_105cd0216456de95" hs_bindgen_105cd0216456de95_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret2@
+hs_bindgen_105cd0216456de95 :: CInt -> IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret2@
+hs_bindgen_105cd0216456de95 = \x_0 -> fmap fromFFIType (hs_bindgen_105cd0216456de95_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_safe :: CInt -> IO (FunPtr (IO CInt))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_safe = hs_bindgen_105cd0216456de95
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret3@
+foreign import ccall safe "hs_bindgen_2d7d8cfa71504d88" hs_bindgen_2d7d8cfa71504d88_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret3@
+hs_bindgen_2d7d8cfa71504d88 :: CInt -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret3@
+hs_bindgen_2d7d8cfa71504d88 = \x_0 -> fmap fromFFIType (hs_bindgen_2d7d8cfa71504d88_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_safe :: CInt -> IO (FunPtr (CInt -> IO ()))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_safe = hs_bindgen_2d7d8cfa71504d88
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret4@
+foreign import ccall safe "hs_bindgen_46f0ed4c8295ba70" hs_bindgen_46f0ed4c8295ba70_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret4@
+hs_bindgen_46f0ed4c8295ba70 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO CChar))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret4@
+hs_bindgen_46f0ed4c8295ba70 = \x_0 -> fmap fromFFIType (hs_bindgen_46f0ed4c8295ba70_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO CChar))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_safe = hs_bindgen_46f0ed4c8295ba70
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret5@
+foreign import ccall safe "hs_bindgen_f8291bd691623354" hs_bindgen_f8291bd691623354_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret5@
+hs_bindgen_f8291bd691623354 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret5@
+hs_bindgen_f8291bd691623354 = \x_0 -> fmap fromFFIType (hs_bindgen_f8291bd691623354_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_safe = hs_bindgen_f8291bd691623354
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret6@
+foreign import ccall safe "hs_bindgen_2eb8ef0a6794c225" hs_bindgen_2eb8ef0a6794c225_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret6@
+hs_bindgen_2eb8ef0a6794c225 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret6@
+hs_bindgen_2eb8ef0a6794c225 = \x_0 -> fmap fromFFIType (hs_bindgen_2eb8ef0a6794c225_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_safe = hs_bindgen_2eb8ef0a6794c225
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret7@
+foreign import ccall safe "hs_bindgen_8cc60b45c83cb72b" hs_bindgen_8cc60b45c83cb72b_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret7@
+hs_bindgen_8cc60b45c83cb72b :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret7@
+hs_bindgen_8cc60b45c83cb72b = \x_0 -> fmap fromFFIType (hs_bindgen_8cc60b45c83cb72b_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_safe = hs_bindgen_8cc60b45c83cb72b
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret8@
+foreign import ccall safe "hs_bindgen_2ad075d6ca6beea5" hs_bindgen_2ad075d6ca6beea5_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret8@
+hs_bindgen_2ad075d6ca6beea5 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret8@
+hs_bindgen_2ad075d6ca6beea5 = \x_0 -> fmap fromFFIType (hs_bindgen_2ad075d6ca6beea5_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_safe = hs_bindgen_2ad075d6ca6beea5
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret9@
+foreign import ccall safe "hs_bindgen_fe5e863d48f781be" hs_bindgen_fe5e863d48f781be_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret9@
+hs_bindgen_fe5e863d48f781be :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret9@
+hs_bindgen_fe5e863d48f781be = \x_0 -> fmap fromFFIType (hs_bindgen_fe5e863d48f781be_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_safe = hs_bindgen_fe5e863d48f781be
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret10@
+foreign import ccall safe "hs_bindgen_2a029ddc00ba6ce1" hs_bindgen_2a029ddc00ba6ce1_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret10@
+hs_bindgen_2a029ddc00ba6ce1 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Safe_funptr_ret10@
+hs_bindgen_2a029ddc00ba6ce1 = \x_0 -> fmap fromFFIType (hs_bindgen_2a029ddc00ba6ce1_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_safe :: CInt ->
+                     IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_safe = hs_bindgen_2a029ddc00ba6ce1
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char1@
+foreign import ccall unsafe "hs_bindgen_c6ccfbc5ac54d3e3" hs_bindgen_c6ccfbc5ac54d3e3_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char1@
+hs_bindgen_c6ccfbc5ac54d3e3 :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char1@
+hs_bindgen_c6ccfbc5ac54d3e3 = \x_0 -> \x_1 -> hs_bindgen_c6ccfbc5ac54d3e3_base (toFFIType x_0) (toFFIType x_1)
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_unsafe :: CInt -> CChar -> IO ()
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_unsafe = hs_bindgen_c6ccfbc5ac54d3e3
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char2@
+foreign import ccall unsafe "hs_bindgen_1b7126ecf0f5ab6e" hs_bindgen_1b7126ecf0f5ab6e_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char2@
+hs_bindgen_1b7126ecf0f5ab6e :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char2@
+hs_bindgen_1b7126ecf0f5ab6e = \x_0 -> \x_1 -> hs_bindgen_1b7126ecf0f5ab6e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_unsafe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_unsafe = hs_bindgen_1b7126ecf0f5ab6e
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char3@
+foreign import ccall unsafe "hs_bindgen_8ecc879598b6d3b0" hs_bindgen_8ecc879598b6d3b0_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char3@
+hs_bindgen_8ecc879598b6d3b0 :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_char3@
+hs_bindgen_8ecc879598b6d3b0 = \x_0 -> \x_1 -> hs_bindgen_8ecc879598b6d3b0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_unsafe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_unsafe = hs_bindgen_8ecc879598b6d3b0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short1@
+foreign import ccall unsafe "hs_bindgen_8e221273096c13a0" hs_bindgen_8e221273096c13a0_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short1@
+hs_bindgen_8e221273096c13a0 :: CInt -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short1@
+hs_bindgen_8e221273096c13a0 = \x_0 -> \x_1 -> hs_bindgen_8e221273096c13a0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_unsafe :: CInt -> CShort -> IO ()
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_unsafe = hs_bindgen_8e221273096c13a0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short2@
+foreign import ccall unsafe "hs_bindgen_3de3762c82599242" hs_bindgen_3de3762c82599242_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short2@
+hs_bindgen_3de3762c82599242 :: CInt -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short2@
+hs_bindgen_3de3762c82599242 = \x_0 -> \x_1 -> hs_bindgen_3de3762c82599242_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_unsafe :: CInt -> CShort -> IO ()
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_unsafe = hs_bindgen_3de3762c82599242
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short3@
+foreign import ccall unsafe "hs_bindgen_14352acc60454580" hs_bindgen_14352acc60454580_base ::
+    CInt
+ -> CUShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short3@
+hs_bindgen_14352acc60454580 :: CInt -> CUShort -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_short3@
+hs_bindgen_14352acc60454580 = \x_0 -> \x_1 -> hs_bindgen_14352acc60454580_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_unsafe :: CInt -> CUShort -> IO ()
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_unsafe = hs_bindgen_14352acc60454580
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int1@
+foreign import ccall unsafe "hs_bindgen_96096b97ae514d84" hs_bindgen_96096b97ae514d84_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int1@
+hs_bindgen_96096b97ae514d84 :: CInt -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int1@
+hs_bindgen_96096b97ae514d84 = \x_0 -> \x_1 -> hs_bindgen_96096b97ae514d84_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_unsafe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_unsafe = hs_bindgen_96096b97ae514d84
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int2@
+foreign import ccall unsafe "hs_bindgen_d049eccfdf55015b" hs_bindgen_d049eccfdf55015b_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int2@
+hs_bindgen_d049eccfdf55015b :: CInt -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int2@
+hs_bindgen_d049eccfdf55015b = \x_0 -> \x_1 -> hs_bindgen_d049eccfdf55015b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_unsafe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_unsafe = hs_bindgen_d049eccfdf55015b
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int3@
+foreign import ccall unsafe "hs_bindgen_9c1d57b596281f26" hs_bindgen_9c1d57b596281f26_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int3@
+hs_bindgen_9c1d57b596281f26 :: CInt -> CUInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_int3@
+hs_bindgen_9c1d57b596281f26 = \x_0 -> \x_1 -> hs_bindgen_9c1d57b596281f26_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_unsafe :: CInt -> CUInt -> IO ()
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_unsafe = hs_bindgen_9c1d57b596281f26
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long1@
+foreign import ccall unsafe "hs_bindgen_31684dbfb298f18c" hs_bindgen_31684dbfb298f18c_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long1@
+hs_bindgen_31684dbfb298f18c :: CInt -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long1@
+hs_bindgen_31684dbfb298f18c = \x_0 -> \x_1 -> hs_bindgen_31684dbfb298f18c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_unsafe :: CInt -> CLong -> IO ()
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_unsafe = hs_bindgen_31684dbfb298f18c
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long2@
+foreign import ccall unsafe "hs_bindgen_705e74ceba937567" hs_bindgen_705e74ceba937567_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long2@
+hs_bindgen_705e74ceba937567 :: CInt -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long2@
+hs_bindgen_705e74ceba937567 = \x_0 -> \x_1 -> hs_bindgen_705e74ceba937567_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_unsafe :: CInt -> CLong -> IO ()
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_unsafe = hs_bindgen_705e74ceba937567
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long3@
+foreign import ccall unsafe "hs_bindgen_193cb3a5430102f3" hs_bindgen_193cb3a5430102f3_base ::
+    CInt
+ -> CULong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long3@
+hs_bindgen_193cb3a5430102f3 :: CInt -> CULong -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_long3@
+hs_bindgen_193cb3a5430102f3 = \x_0 -> \x_1 -> hs_bindgen_193cb3a5430102f3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_unsafe :: CInt -> CULong -> IO ()
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_unsafe = hs_bindgen_193cb3a5430102f3
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_float@
+foreign import ccall unsafe "hs_bindgen_f1b87ec98a54b583" hs_bindgen_f1b87ec98a54b583_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_float@
+hs_bindgen_f1b87ec98a54b583 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_float@
+hs_bindgen_f1b87ec98a54b583 = \x_0 -> \x_1 -> hs_bindgen_f1b87ec98a54b583_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_unsafe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_unsafe = hs_bindgen_f1b87ec98a54b583
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_double@
+foreign import ccall unsafe "hs_bindgen_da17ba710f71da80" hs_bindgen_da17ba710f71da80_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_double@
+hs_bindgen_da17ba710f71da80 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_double@
+hs_bindgen_da17ba710f71da80 = \x_0 -> \x_1 -> hs_bindgen_da17ba710f71da80_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_unsafe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_unsafe = hs_bindgen_da17ba710f71da80
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_bool1@
+foreign import ccall unsafe "hs_bindgen_9e15dd8dbce9cd83" hs_bindgen_9e15dd8dbce9cd83_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_bool1@
+hs_bindgen_9e15dd8dbce9cd83 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_bool1@
+hs_bindgen_9e15dd8dbce9cd83 = \x_0 -> \x_1 -> hs_bindgen_9e15dd8dbce9cd83_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_unsafe = hs_bindgen_9e15dd8dbce9cd83
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_struct@
+foreign import ccall unsafe "hs_bindgen_dc772c3e54b3ef41" hs_bindgen_dc772c3e54b3ef41_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_struct@
+hs_bindgen_dc772c3e54b3ef41 :: CInt -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_struct@
+hs_bindgen_dc772c3e54b3ef41 = \x_0 -> \x_1 -> hs_bindgen_dc772c3e54b3ef41_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_unsafe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_dc772c3e54b3ef41 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_union@
+foreign import ccall unsafe "hs_bindgen_aabbe3419dcd3eb9" hs_bindgen_aabbe3419dcd3eb9_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_union@
+hs_bindgen_aabbe3419dcd3eb9 :: CInt -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_union@
+hs_bindgen_aabbe3419dcd3eb9 = \x_0 -> \x_1 -> hs_bindgen_aabbe3419dcd3eb9_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_unsafe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_aabbe3419dcd3eb9 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_enum@
+foreign import ccall unsafe "hs_bindgen_731297a830e4c2df" hs_bindgen_731297a830e4c2df_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_enum@
+hs_bindgen_731297a830e4c2df :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_enum@
+hs_bindgen_731297a830e4c2df = \x_0 -> \x_1 -> hs_bindgen_731297a830e4c2df_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_unsafe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_unsafe = hs_bindgen_731297a830e4c2df
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_31fc55b0aea434ba" hs_bindgen_31fc55b0aea434ba_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer1@
+hs_bindgen_31fc55b0aea434ba :: CInt -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer1@
+hs_bindgen_31fc55b0aea434ba = \x_0 -> \x_1 -> hs_bindgen_31fc55b0aea434ba_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_unsafe :: CInt -> Ptr CInt -> IO ()
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_unsafe = hs_bindgen_31fc55b0aea434ba
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_35aa32eabe6cbe1e" hs_bindgen_35aa32eabe6cbe1e_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer2@
+hs_bindgen_35aa32eabe6cbe1e :: CInt -> Ptr (Ptr CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer2@
+hs_bindgen_35aa32eabe6cbe1e = \x_0 -> \x_1 -> hs_bindgen_35aa32eabe6cbe1e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_unsafe :: CInt -> Ptr (Ptr CInt) -> IO ()
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_unsafe = hs_bindgen_35aa32eabe6cbe1e
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_c9941830193c9c20" hs_bindgen_c9941830193c9c20_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer3@
+hs_bindgen_c9941830193c9c20 :: CInt -> Ptr Void -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_pointer3@
+hs_bindgen_c9941830193c9c20 = \x_0 -> \x_1 -> hs_bindgen_c9941830193c9c20_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_unsafe :: CInt -> Ptr Void -> IO ()
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_unsafe = hs_bindgen_c9941830193c9c20
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_A@
+foreign import ccall unsafe "hs_bindgen_56c5534530515933" hs_bindgen_56c5534530515933_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_A@
+hs_bindgen_56c5534530515933 :: IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_A@
+hs_bindgen_56c5534530515933 = fmap fromFFIType hs_bindgen_56c5534530515933_base
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_unsafe :: IO CInt
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_unsafe = hs_bindgen_56c5534530515933
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char1@
+foreign import ccall unsafe "hs_bindgen_e36cc4960e15ece8" hs_bindgen_e36cc4960e15ece8_base ::
+    CInt
+ -> IO CChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char1@
+hs_bindgen_e36cc4960e15ece8 :: CInt -> IO CChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char1@
+hs_bindgen_e36cc4960e15ece8 = \x_0 -> fmap fromFFIType (hs_bindgen_e36cc4960e15ece8_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_unsafe :: CInt -> IO CChar
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_unsafe = hs_bindgen_e36cc4960e15ece8
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char2@
+foreign import ccall unsafe "hs_bindgen_39c01c6ee1b7364f" hs_bindgen_39c01c6ee1b7364f_base ::
+    CInt
+ -> IO CSChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char2@
+hs_bindgen_39c01c6ee1b7364f :: CInt -> IO CSChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char2@
+hs_bindgen_39c01c6ee1b7364f = \x_0 -> fmap fromFFIType (hs_bindgen_39c01c6ee1b7364f_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_unsafe :: CInt -> IO CSChar
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_unsafe = hs_bindgen_39c01c6ee1b7364f
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char3@
+foreign import ccall unsafe "hs_bindgen_6a35179874816c94" hs_bindgen_6a35179874816c94_base ::
+    CInt
+ -> IO CUChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char3@
+hs_bindgen_6a35179874816c94 :: CInt -> IO CUChar
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_char3@
+hs_bindgen_6a35179874816c94 = \x_0 -> fmap fromFFIType (hs_bindgen_6a35179874816c94_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_unsafe :: CInt -> IO CUChar
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_unsafe = hs_bindgen_6a35179874816c94
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short1@
+foreign import ccall unsafe "hs_bindgen_9bb2bb254d5dc1c0" hs_bindgen_9bb2bb254d5dc1c0_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short1@
+hs_bindgen_9bb2bb254d5dc1c0 :: CInt -> IO CShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short1@
+hs_bindgen_9bb2bb254d5dc1c0 = \x_0 -> fmap fromFFIType (hs_bindgen_9bb2bb254d5dc1c0_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_unsafe :: CInt -> IO CShort
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_unsafe = hs_bindgen_9bb2bb254d5dc1c0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short2@
+foreign import ccall unsafe "hs_bindgen_6797eb02f4ac3ebe" hs_bindgen_6797eb02f4ac3ebe_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short2@
+hs_bindgen_6797eb02f4ac3ebe :: CInt -> IO CShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short2@
+hs_bindgen_6797eb02f4ac3ebe = \x_0 -> fmap fromFFIType (hs_bindgen_6797eb02f4ac3ebe_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_unsafe :: CInt -> IO CShort
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_unsafe = hs_bindgen_6797eb02f4ac3ebe
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short3@
+foreign import ccall unsafe "hs_bindgen_615bd7df3e0134a2" hs_bindgen_615bd7df3e0134a2_base ::
+    CInt
+ -> IO CUShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short3@
+hs_bindgen_615bd7df3e0134a2 :: CInt -> IO CUShort
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_short3@
+hs_bindgen_615bd7df3e0134a2 = \x_0 -> fmap fromFFIType (hs_bindgen_615bd7df3e0134a2_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_unsafe :: CInt -> IO CUShort
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_unsafe = hs_bindgen_615bd7df3e0134a2
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int1@
+foreign import ccall unsafe "hs_bindgen_4fe4545529e753b8" hs_bindgen_4fe4545529e753b8_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int1@
+hs_bindgen_4fe4545529e753b8 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int1@
+hs_bindgen_4fe4545529e753b8 = \x_0 -> fmap fromFFIType (hs_bindgen_4fe4545529e753b8_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_unsafe = hs_bindgen_4fe4545529e753b8
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int2@
+foreign import ccall unsafe "hs_bindgen_f6e5d129c69c5afe" hs_bindgen_f6e5d129c69c5afe_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int2@
+hs_bindgen_f6e5d129c69c5afe :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int2@
+hs_bindgen_f6e5d129c69c5afe = \x_0 -> fmap fromFFIType (hs_bindgen_f6e5d129c69c5afe_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_unsafe = hs_bindgen_f6e5d129c69c5afe
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int3@
+foreign import ccall unsafe "hs_bindgen_9551ec72ba55d7a7" hs_bindgen_9551ec72ba55d7a7_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int3@
+hs_bindgen_9551ec72ba55d7a7 :: CInt -> IO CUInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_int3@
+hs_bindgen_9551ec72ba55d7a7 = \x_0 -> fmap fromFFIType (hs_bindgen_9551ec72ba55d7a7_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_unsafe :: CInt -> IO CUInt
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_unsafe = hs_bindgen_9551ec72ba55d7a7
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long1@
+foreign import ccall unsafe "hs_bindgen_e0d1c177d41a7ce8" hs_bindgen_e0d1c177d41a7ce8_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long1@
+hs_bindgen_e0d1c177d41a7ce8 :: CInt -> IO CLong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long1@
+hs_bindgen_e0d1c177d41a7ce8 = \x_0 -> fmap fromFFIType (hs_bindgen_e0d1c177d41a7ce8_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_unsafe :: CInt -> IO CLong
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_unsafe = hs_bindgen_e0d1c177d41a7ce8
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long2@
+foreign import ccall unsafe "hs_bindgen_42fbed00ce6b7b08" hs_bindgen_42fbed00ce6b7b08_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long2@
+hs_bindgen_42fbed00ce6b7b08 :: CInt -> IO CLong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long2@
+hs_bindgen_42fbed00ce6b7b08 = \x_0 -> fmap fromFFIType (hs_bindgen_42fbed00ce6b7b08_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_unsafe :: CInt -> IO CLong
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_unsafe = hs_bindgen_42fbed00ce6b7b08
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long3@
+foreign import ccall unsafe "hs_bindgen_ed9a248d2e643a4b" hs_bindgen_ed9a248d2e643a4b_base ::
+    CInt
+ -> IO CULong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long3@
+hs_bindgen_ed9a248d2e643a4b :: CInt -> IO CULong
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_long3@
+hs_bindgen_ed9a248d2e643a4b = \x_0 -> fmap fromFFIType (hs_bindgen_ed9a248d2e643a4b_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_unsafe :: CInt -> IO CULong
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_unsafe = hs_bindgen_ed9a248d2e643a4b
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_float@
+foreign import ccall unsafe "hs_bindgen_ff0e9b4eaea0329a" hs_bindgen_ff0e9b4eaea0329a_base ::
+    CInt
+ -> IO CFloat
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_float@
+hs_bindgen_ff0e9b4eaea0329a :: CInt -> IO CFloat
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_float@
+hs_bindgen_ff0e9b4eaea0329a = \x_0 -> fmap fromFFIType (hs_bindgen_ff0e9b4eaea0329a_base (toFFIType x_0))
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_unsafe :: CInt -> IO CFloat
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_unsafe = hs_bindgen_ff0e9b4eaea0329a
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_double@
+foreign import ccall unsafe "hs_bindgen_164a83641655c836" hs_bindgen_164a83641655c836_base ::
+    CInt
+ -> IO CDouble
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_double@
+hs_bindgen_164a83641655c836 :: CInt -> IO CDouble
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_double@
+hs_bindgen_164a83641655c836 = \x_0 -> fmap fromFFIType (hs_bindgen_164a83641655c836_base (toFFIType x_0))
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_unsafe :: CInt -> IO CDouble
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_unsafe = hs_bindgen_164a83641655c836
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_53d6d79b1b401e62" hs_bindgen_53d6d79b1b401e62_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_bool1@
+hs_bindgen_53d6d79b1b401e62 :: CInt -> IO CBool
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_bool1@
+hs_bindgen_53d6d79b1b401e62 = \x_0 -> fmap fromFFIType (hs_bindgen_53d6d79b1b401e62_base (toFFIType x_0))
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_unsafe :: CInt -> IO CBool
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_unsafe = hs_bindgen_53d6d79b1b401e62
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_struct@
+foreign import ccall unsafe "hs_bindgen_75308badf37284ce" hs_bindgen_75308badf37284ce_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_struct@
+hs_bindgen_75308badf37284ce :: CInt -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_struct@
+hs_bindgen_75308badf37284ce = \x_0 -> \x_1 -> hs_bindgen_75308badf37284ce_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_unsafe :: CInt -> IO Some_struct
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_75308badf37284ce arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_union@
+foreign import ccall unsafe "hs_bindgen_b9ab05b4990fb8dd" hs_bindgen_b9ab05b4990fb8dd_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_union@
+hs_bindgen_b9ab05b4990fb8dd :: CInt -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_union@
+hs_bindgen_b9ab05b4990fb8dd = \x_0 -> \x_1 -> hs_bindgen_b9ab05b4990fb8dd_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_unsafe :: CInt -> IO Some_union
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_b9ab05b4990fb8dd arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_enum@
+foreign import ccall unsafe "hs_bindgen_c46aafe01e3abbca" hs_bindgen_c46aafe01e3abbca_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_enum@
+hs_bindgen_c46aafe01e3abbca :: CInt -> IO Some_enum
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_enum@
+hs_bindgen_c46aafe01e3abbca = \x_0 -> fmap fromFFIType (hs_bindgen_c46aafe01e3abbca_base (toFFIType x_0))
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_unsafe :: CInt -> IO Some_enum
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_unsafe = hs_bindgen_c46aafe01e3abbca
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_afcc67a9788584d9" hs_bindgen_afcc67a9788584d9_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer1@
+hs_bindgen_afcc67a9788584d9 :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer1@
+hs_bindgen_afcc67a9788584d9 = \x_0 -> fmap fromFFIType (hs_bindgen_afcc67a9788584d9_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_unsafe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_unsafe = hs_bindgen_afcc67a9788584d9
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_234d0979dbe93733" hs_bindgen_234d0979dbe93733_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer2@
+hs_bindgen_234d0979dbe93733 :: CInt -> IO (Ptr (Ptr CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer2@
+hs_bindgen_234d0979dbe93733 = \x_0 -> fmap fromFFIType (hs_bindgen_234d0979dbe93733_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_unsafe :: CInt -> IO (Ptr (Ptr CInt))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_unsafe = hs_bindgen_234d0979dbe93733
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_6f3f7c624556cfb3" hs_bindgen_6f3f7c624556cfb3_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer3@
+hs_bindgen_6f3f7c624556cfb3 :: CInt -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_pointer3@
+hs_bindgen_6f3f7c624556cfb3 = \x_0 -> fmap fromFFIType (hs_bindgen_6f3f7c624556cfb3_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_unsafe :: CInt -> IO (Ptr Void)
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_unsafe = hs_bindgen_6f3f7c624556cfb3
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body1@
+foreign import ccall unsafe "hs_bindgen_c9d515b8a02ca235" hs_bindgen_c9d515b8a02ca235_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body1@
+hs_bindgen_c9d515b8a02ca235 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body1@
+hs_bindgen_c9d515b8a02ca235 = \x_0 -> fmap fromFFIType (hs_bindgen_c9d515b8a02ca235_base (toFFIType x_0))
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_unsafe = hs_bindgen_c9d515b8a02ca235
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body2@
+foreign import ccall unsafe "hs_bindgen_d6e10c899b553af9" hs_bindgen_d6e10c899b553af9_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body2@
+hs_bindgen_d6e10c899b553af9 :: IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_body2@
+hs_bindgen_d6e10c899b553af9 = fmap fromFFIType hs_bindgen_d6e10c899b553af9_base
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_unsafe :: IO CInt
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_unsafe = hs_bindgen_d6e10c899b553af9
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_433860c3d6edf28b" hs_bindgen_433860c3d6edf28b_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_float@
+hs_bindgen_433860c3d6edf28b :: CInt ->
+                               Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_float@
+hs_bindgen_433860c3d6edf28b = \x_0 -> \x_1 -> hs_bindgen_433860c3d6edf28b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_unsafe :: CInt -> Complex CFloat -> IO ()
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_433860c3d6edf28b arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_8e44029c12a7dddb" hs_bindgen_8e44029c12a7dddb_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_double@
+hs_bindgen_8e44029c12a7dddb :: CInt ->
+                               Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_args_complex_double@
+hs_bindgen_8e44029c12a7dddb = \x_0 -> \x_1 -> hs_bindgen_8e44029c12a7dddb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_unsafe :: CInt -> Complex CDouble -> IO ()
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_8e44029c12a7dddb arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_0dc01ff2cd8fc565" hs_bindgen_0dc01ff2cd8fc565_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_float@
+hs_bindgen_0dc01ff2cd8fc565 :: CInt ->
+                               Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_float@
+hs_bindgen_0dc01ff2cd8fc565 = \x_0 -> \x_1 -> hs_bindgen_0dc01ff2cd8fc565_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_unsafe :: CInt -> IO (Complex CFloat)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_0dc01ff2cd8fc565 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_8f2ebb486a336f80" hs_bindgen_8f2ebb486a336f80_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_double@
+hs_bindgen_8f2ebb486a336f80 :: CInt ->
+                               Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_ret_complex_double@
+hs_bindgen_8f2ebb486a336f80 = \x_0 -> \x_1 -> hs_bindgen_8f2ebb486a336f80_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_unsafe :: CInt -> IO (Complex CDouble)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_8f2ebb486a336f80 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_26be4a823dc56e01" hs_bindgen_26be4a823dc56e01_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args1@
+hs_bindgen_26be4a823dc56e01 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args1@
+hs_bindgen_26be4a823dc56e01 = \x_0 -> \x_1 -> hs_bindgen_26be4a823dc56e01_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_unsafe = hs_bindgen_26be4a823dc56e01
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_6212b2750a2d5997" hs_bindgen_6212b2750a2d5997_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args2@
+hs_bindgen_6212b2750a2d5997 :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_args2@
+hs_bindgen_6212b2750a2d5997 = \x_0 -> \x_1 -> hs_bindgen_6212b2750a2d5997_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_unsafe :: CInt ->
+                        HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_unsafe = hs_bindgen_6212b2750a2d5997
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_e553247e80e3e159" hs_bindgen_e553247e80e3e159_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret1@
+hs_bindgen_e553247e80e3e159 :: CInt -> IO CBool
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret1@
+hs_bindgen_e553247e80e3e159 = \x_0 -> fmap fromFFIType (hs_bindgen_e553247e80e3e159_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_unsafe :: CInt -> IO CBool
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_unsafe = hs_bindgen_e553247e80e3e159
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_72a7f6cf38bcb00c" hs_bindgen_72a7f6cf38bcb00c_base ::
+    CInt
+ -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret2@
+hs_bindgen_72a7f6cf38bcb00c :: CInt ->
+                               IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_bespoke_ret2@
+hs_bindgen_72a7f6cf38bcb00c = \x_0 -> fmap fromFFIType (hs_bindgen_72a7f6cf38bcb00c_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_unsafe :: CInt -> IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_unsafe = hs_bindgen_72a7f6cf38bcb00c
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args1@
+foreign import ccall unsafe "hs_bindgen_dc7cacd7dbb61f43" hs_bindgen_dc7cacd7dbb61f43_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args1@
+hs_bindgen_dc7cacd7dbb61f43 :: Ptr (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args1@
+hs_bindgen_dc7cacd7dbb61f43 = \x_0 -> hs_bindgen_dc7cacd7dbb61f43_base (toFFIType x_0)
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_unsafe :: Ptr (Elem (IncompleteArray CInt)) -> IO ()
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_unsafe = hs_bindgen_dc7cacd7dbb61f43
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args2@
+foreign import ccall unsafe "hs_bindgen_09d9010cbf3c8d41" hs_bindgen_09d9010cbf3c8d41_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args2@
+hs_bindgen_09d9010cbf3c8d41 :: Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args2@
+hs_bindgen_09d9010cbf3c8d41 = \x_0 -> hs_bindgen_09d9010cbf3c8d41_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_unsafe :: Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                    IO ()
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_unsafe = hs_bindgen_09d9010cbf3c8d41
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args3@
+foreign import ccall unsafe "hs_bindgen_37e1f318a8ae501c" hs_bindgen_37e1f318a8ae501c_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args3@
+hs_bindgen_37e1f318a8ae501c :: Ptr (Elem (ConstantArray 5 CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args3@
+hs_bindgen_37e1f318a8ae501c = \x_0 -> hs_bindgen_37e1f318a8ae501c_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_unsafe :: Ptr (Elem (ConstantArray 5 CInt)) -> IO ()
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_unsafe = hs_bindgen_37e1f318a8ae501c
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args4@
+foreign import ccall unsafe "hs_bindgen_d9440a8b6d2848ff" hs_bindgen_d9440a8b6d2848ff_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args4@
+hs_bindgen_d9440a8b6d2848ff :: Ptr (Elem (ConstantArray 5
+                                                        (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_arr_args4@
+hs_bindgen_d9440a8b6d2848ff = \x_0 -> hs_bindgen_d9440a8b6d2848ff_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_unsafe :: Ptr (Elem (ConstantArray 5 (Ptr CInt))) ->
+                    IO ()
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_unsafe = hs_bindgen_d9440a8b6d2848ff
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_ca61df80135a11f9" hs_bindgen_ca61df80135a11f9_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args1@
+hs_bindgen_ca61df80135a11f9 :: CInt -> FunPtr (IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args1@
+hs_bindgen_ca61df80135a11f9 = \x_0 -> \x_1 -> hs_bindgen_ca61df80135a11f9_base (toFFIType x_0) (toFFIType x_1)
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_unsafe :: CInt -> FunPtr (IO ()) -> IO ()
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_unsafe = hs_bindgen_ca61df80135a11f9
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_2e803412f5250381" hs_bindgen_2e803412f5250381_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args2@
+hs_bindgen_2e803412f5250381 :: CInt -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args2@
+hs_bindgen_2e803412f5250381 = \x_0 -> \x_1 -> hs_bindgen_2e803412f5250381_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_unsafe :: CInt -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_unsafe = hs_bindgen_2e803412f5250381
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_1839323a7de53e04" hs_bindgen_1839323a7de53e04_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args3@
+hs_bindgen_1839323a7de53e04 :: CInt ->
+                               FunPtr (CInt -> IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args3@
+hs_bindgen_1839323a7de53e04 = \x_0 -> \x_1 -> hs_bindgen_1839323a7de53e04_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_unsafe :: CInt -> FunPtr (CInt -> IO ()) -> IO ()
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_unsafe = hs_bindgen_1839323a7de53e04
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_1966f50d5deb0a77" hs_bindgen_1966f50d5deb0a77_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args4@
+hs_bindgen_1966f50d5deb0a77 :: CInt ->
+                               FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args4@
+hs_bindgen_1966f50d5deb0a77 = \x_0 -> \x_1 -> hs_bindgen_1966f50d5deb0a77_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_unsafe :: CInt ->
+                       FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_unsafe = hs_bindgen_1966f50d5deb0a77
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_3eacaa3550feb706" hs_bindgen_3eacaa3550feb706_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args5@
+hs_bindgen_3eacaa3550feb706 :: CInt ->
+                               FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_args5@
+hs_bindgen_3eacaa3550feb706 = \x_0 -> \x_1 -> hs_bindgen_3eacaa3550feb706_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_unsafe :: CInt ->
+                       FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_unsafe = hs_bindgen_3eacaa3550feb706
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_comments1@
+foreign import ccall unsafe "hs_bindgen_42f3fad04f4a62c7" hs_bindgen_42f3fad04f4a62c7_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_comments1@
+hs_bindgen_42f3fad04f4a62c7 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_comments1@
+hs_bindgen_42f3fad04f4a62c7 = \x_0 -> hs_bindgen_42f3fad04f4a62c7_base (toFFIType x_0)
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_unsafe :: CInt -> IO ()
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_unsafe = hs_bindgen_42f3fad04f4a62c7
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_40fa2adcbadaabf4" hs_bindgen_40fa2adcbadaabf4_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before1@
+hs_bindgen_40fa2adcbadaabf4 :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before1@
+hs_bindgen_40fa2adcbadaabf4 = \x_0 -> \x_1 -> hs_bindgen_40fa2adcbadaabf4_base (toFFIType x_0) (toFFIType x_1)
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_unsafe :: CInt -> CChar -> IO ()
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_unsafe = hs_bindgen_40fa2adcbadaabf4
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_6560ce91395cf6bf" hs_bindgen_6560ce91395cf6bf_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before2@
+hs_bindgen_6560ce91395cf6bf :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before2@
+hs_bindgen_6560ce91395cf6bf = \x_0 -> \x_1 -> hs_bindgen_6560ce91395cf6bf_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_unsafe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_unsafe = hs_bindgen_6560ce91395cf6bf
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_fab04df1b737308d" hs_bindgen_fab04df1b737308d_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before3@
+hs_bindgen_fab04df1b737308d :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_before3@
+hs_bindgen_fab04df1b737308d = \x_0 -> \x_1 -> hs_bindgen_fab04df1b737308d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_unsafe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_unsafe = hs_bindgen_fab04df1b737308d
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_3762ecefd71c40d3" hs_bindgen_3762ecefd71c40d3_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after1@
+hs_bindgen_3762ecefd71c40d3 :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after1@
+hs_bindgen_3762ecefd71c40d3 = \x_0 -> \x_1 -> hs_bindgen_3762ecefd71c40d3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_unsafe :: CInt -> CChar -> IO ()
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_unsafe = hs_bindgen_3762ecefd71c40d3
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_b3ecb163df7d32c8" hs_bindgen_b3ecb163df7d32c8_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after2@
+hs_bindgen_b3ecb163df7d32c8 :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after2@
+hs_bindgen_b3ecb163df7d32c8 = \x_0 -> \x_1 -> hs_bindgen_b3ecb163df7d32c8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_unsafe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_unsafe = hs_bindgen_b3ecb163df7d32c8
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_706270fd83faddb0" hs_bindgen_706270fd83faddb0_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after3@
+hs_bindgen_706270fd83faddb0 :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_prim_after3@
+hs_bindgen_706270fd83faddb0 = \x_0 -> \x_1 -> hs_bindgen_706270fd83faddb0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_unsafe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_unsafe = hs_bindgen_706270fd83faddb0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_ff637beb32dc5931" hs_bindgen_ff637beb32dc5931_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before1@
+hs_bindgen_ff637beb32dc5931 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before1@
+hs_bindgen_ff637beb32dc5931 = \x_0 -> \x_1 -> hs_bindgen_ff637beb32dc5931_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_unsafe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_unsafe = hs_bindgen_ff637beb32dc5931
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_3e0e5c2fa1b03a68" hs_bindgen_3e0e5c2fa1b03a68_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before2@
+hs_bindgen_3e0e5c2fa1b03a68 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before2@
+hs_bindgen_3e0e5c2fa1b03a68 = \x_0 -> \x_1 -> hs_bindgen_3e0e5c2fa1b03a68_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_unsafe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_unsafe = hs_bindgen_3e0e5c2fa1b03a68
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_81eefcf233fd167c" hs_bindgen_81eefcf233fd167c_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before3@
+hs_bindgen_81eefcf233fd167c :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before3@
+hs_bindgen_81eefcf233fd167c = \x_0 -> \x_1 -> hs_bindgen_81eefcf233fd167c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_unsafe = hs_bindgen_81eefcf233fd167c
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_1c849843004ee65e" hs_bindgen_1c849843004ee65e_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before4@
+hs_bindgen_1c849843004ee65e :: CInt ->
+                               PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before4@
+hs_bindgen_1c849843004ee65e = \x_0 -> \x_1 -> hs_bindgen_1c849843004ee65e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_unsafe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_1c849843004ee65e arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_c85d4a53a6e1e963" hs_bindgen_c85d4a53a6e1e963_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before5@
+hs_bindgen_c85d4a53a6e1e963 :: CInt -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before5@
+hs_bindgen_c85d4a53a6e1e963 = \x_0 -> \x_1 -> hs_bindgen_c85d4a53a6e1e963_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_unsafe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_c85d4a53a6e1e963 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_796c19d2df50b65f" hs_bindgen_796c19d2df50b65f_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before6@
+hs_bindgen_796c19d2df50b65f :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before6@
+hs_bindgen_796c19d2df50b65f = \x_0 -> \x_1 -> hs_bindgen_796c19d2df50b65f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_unsafe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_unsafe = hs_bindgen_796c19d2df50b65f
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_0950b2ec97db5b00" hs_bindgen_0950b2ec97db5b00_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before7@
+hs_bindgen_0950b2ec97db5b00 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before7@
+hs_bindgen_0950b2ec97db5b00 = \x_0 -> \x_1 -> hs_bindgen_0950b2ec97db5b00_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_unsafe = hs_bindgen_0950b2ec97db5b00
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_375085e61e85a2a8" hs_bindgen_375085e61e85a2a8_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before8@
+hs_bindgen_375085e61e85a2a8 :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_before8@
+hs_bindgen_375085e61e85a2a8 = \x_0 -> \x_1 -> hs_bindgen_375085e61e85a2a8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_unsafe :: CInt ->
+                                    HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_unsafe = hs_bindgen_375085e61e85a2a8
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_2bb6a1d152a87f63" hs_bindgen_2bb6a1d152a87f63_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after1@
+hs_bindgen_2bb6a1d152a87f63 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after1@
+hs_bindgen_2bb6a1d152a87f63 = \x_0 -> \x_1 -> hs_bindgen_2bb6a1d152a87f63_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_unsafe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_unsafe = hs_bindgen_2bb6a1d152a87f63
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_2753c469629474c2" hs_bindgen_2753c469629474c2_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after2@
+hs_bindgen_2753c469629474c2 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after2@
+hs_bindgen_2753c469629474c2 = \x_0 -> \x_1 -> hs_bindgen_2753c469629474c2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_unsafe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_unsafe = hs_bindgen_2753c469629474c2
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_5c96f0d6c5fd53b1" hs_bindgen_5c96f0d6c5fd53b1_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after3@
+hs_bindgen_5c96f0d6c5fd53b1 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after3@
+hs_bindgen_5c96f0d6c5fd53b1 = \x_0 -> \x_1 -> hs_bindgen_5c96f0d6c5fd53b1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_unsafe = hs_bindgen_5c96f0d6c5fd53b1
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_e8d4acc6356ca49d" hs_bindgen_e8d4acc6356ca49d_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after4@
+hs_bindgen_e8d4acc6356ca49d :: CInt ->
+                               PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after4@
+hs_bindgen_e8d4acc6356ca49d = \x_0 -> \x_1 -> hs_bindgen_e8d4acc6356ca49d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_unsafe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_e8d4acc6356ca49d arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_6762b5473d8d350a" hs_bindgen_6762b5473d8d350a_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after5@
+hs_bindgen_6762b5473d8d350a :: CInt -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after5@
+hs_bindgen_6762b5473d8d350a = \x_0 -> \x_1 -> hs_bindgen_6762b5473d8d350a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_unsafe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_6762b5473d8d350a arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_55d5e45034c9f572" hs_bindgen_55d5e45034c9f572_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after6@
+hs_bindgen_55d5e45034c9f572 :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after6@
+hs_bindgen_55d5e45034c9f572 = \x_0 -> \x_1 -> hs_bindgen_55d5e45034c9f572_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_unsafe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_unsafe = hs_bindgen_55d5e45034c9f572
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_70dae000d43d8228" hs_bindgen_70dae000d43d8228_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after7@
+hs_bindgen_70dae000d43d8228 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after7@
+hs_bindgen_70dae000d43d8228 = \x_0 -> \x_1 -> hs_bindgen_70dae000d43d8228_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_unsafe = hs_bindgen_70dae000d43d8228
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_85e787c823b6c95f" hs_bindgen_85e787c823b6c95f_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after8@
+hs_bindgen_85e787c823b6c95f :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_withoutSign_after8@
+hs_bindgen_85e787c823b6c95f = \x_0 -> \x_1 -> hs_bindgen_85e787c823b6c95f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_unsafe :: CInt ->
+                                   HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_unsafe = hs_bindgen_85e787c823b6c95f
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_efb5ca5187af5610" hs_bindgen_efb5ca5187af5610_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args1@
+hs_bindgen_efb5ca5187af5610 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args1@
+hs_bindgen_efb5ca5187af5610 = \x_0 -> \x_1 -> hs_bindgen_efb5ca5187af5610_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_unsafe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_unsafe = hs_bindgen_efb5ca5187af5610
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_e306bbd2d4a374fc" hs_bindgen_e306bbd2d4a374fc_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args2@
+hs_bindgen_e306bbd2d4a374fc :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args2@
+hs_bindgen_e306bbd2d4a374fc = \x_0 -> \x_1 -> hs_bindgen_e306bbd2d4a374fc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_unsafe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_unsafe = hs_bindgen_e306bbd2d4a374fc
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_960be6e90be0e7c1" hs_bindgen_960be6e90be0e7c1_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args3@
+hs_bindgen_960be6e90be0e7c1 :: CInt -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args3@
+hs_bindgen_960be6e90be0e7c1 = \x_0 -> \x_1 -> hs_bindgen_960be6e90be0e7c1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_unsafe :: CInt -> Ptr CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_unsafe = hs_bindgen_960be6e90be0e7c1
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_00950eca61f28e52" hs_bindgen_00950eca61f28e52_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args4@
+hs_bindgen_00950eca61f28e52 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args4@
+hs_bindgen_00950eca61f28e52 = \x_0 -> \x_1 -> hs_bindgen_00950eca61f28e52_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_unsafe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_unsafe = hs_bindgen_00950eca61f28e52
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_96b40db09db83748" hs_bindgen_96b40db09db83748_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args5@
+hs_bindgen_96b40db09db83748 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_args5@
+hs_bindgen_96b40db09db83748 = \x_0 -> \x_1 -> hs_bindgen_96b40db09db83748_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_unsafe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_unsafe = hs_bindgen_96b40db09db83748
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_035d9da3770aeff8" hs_bindgen_035d9da3770aeff8_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret1@
+hs_bindgen_035d9da3770aeff8 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret1@
+hs_bindgen_035d9da3770aeff8 = \x_0 -> fmap fromFFIType (hs_bindgen_035d9da3770aeff8_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_unsafe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_unsafe = hs_bindgen_035d9da3770aeff8
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_0d195040558fbef7" hs_bindgen_0d195040558fbef7_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret2@
+hs_bindgen_0d195040558fbef7 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret2@
+hs_bindgen_0d195040558fbef7 = \x_0 -> fmap fromFFIType (hs_bindgen_0d195040558fbef7_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_unsafe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_unsafe = hs_bindgen_0d195040558fbef7
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_9d5a35ded6d43b33" hs_bindgen_9d5a35ded6d43b33_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret3@
+hs_bindgen_9d5a35ded6d43b33 :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret3@
+hs_bindgen_9d5a35ded6d43b33 = \x_0 -> fmap fromFFIType (hs_bindgen_9d5a35ded6d43b33_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_unsafe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_unsafe = hs_bindgen_9d5a35ded6d43b33
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_b00ca0cfd4037848" hs_bindgen_b00ca0cfd4037848_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret4@
+hs_bindgen_b00ca0cfd4037848 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret4@
+hs_bindgen_b00ca0cfd4037848 = \x_0 -> fmap fromFFIType (hs_bindgen_b00ca0cfd4037848_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_unsafe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_unsafe = hs_bindgen_b00ca0cfd4037848
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_da92f752b03da901" hs_bindgen_da92f752b03da901_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret5@
+hs_bindgen_da92f752b03da901 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_pointers_ret5@
+hs_bindgen_da92f752b03da901 = \x_0 -> fmap fromFFIType (hs_bindgen_da92f752b03da901_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_unsafe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_unsafe = hs_bindgen_da92f752b03da901
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_fdc3e3307cac5fd0" hs_bindgen_fdc3e3307cac5fd0_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem1@
+hs_bindgen_fdc3e3307cac5fd0 :: PtrConst (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem1@
+hs_bindgen_fdc3e3307cac5fd0 = \x_0 -> hs_bindgen_fdc3e3307cac5fd0_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_unsafe :: PtrConst (Elem (IncompleteArray CInt)) ->
+                            IO ()
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_unsafe = hs_bindgen_fdc3e3307cac5fd0
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_cecdce9d64ac85d4" hs_bindgen_cecdce9d64ac85d4_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem2@
+hs_bindgen_cecdce9d64ac85d4 :: Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem2@
+hs_bindgen_cecdce9d64ac85d4 = \x_0 -> hs_bindgen_cecdce9d64ac85d4_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_unsafe :: Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                            IO ()
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_unsafe = hs_bindgen_cecdce9d64ac85d4
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_9ee7979e72b4baf6" hs_bindgen_9ee7979e72b4baf6_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem3@
+hs_bindgen_9ee7979e72b4baf6 :: PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_const_array_elem3@
+hs_bindgen_9ee7979e72b4baf6 = \x_0 -> hs_bindgen_9ee7979e72b4baf6_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_unsafe :: PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                            IO ()
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_unsafe = hs_bindgen_9ee7979e72b4baf6
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams1@
+foreign import ccall unsafe "hs_bindgen_c6e158d421dda2ac" hs_bindgen_c6e158d421dda2ac_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams1@
+hs_bindgen_c6e158d421dda2ac :: IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams1@
+hs_bindgen_c6e158d421dda2ac = fmap fromFFIType hs_bindgen_c6e158d421dda2ac_base
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_unsafe :: IO CInt
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_unsafe = hs_bindgen_c6e158d421dda2ac
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams2@
+foreign import ccall unsafe "hs_bindgen_a34e536ea5931d76" hs_bindgen_a34e536ea5931d76_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams2@
+hs_bindgen_a34e536ea5931d76 :: IO CInt
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams2@
+hs_bindgen_a34e536ea5931d76 = fmap fromFFIType hs_bindgen_a34e536ea5931d76_base
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_unsafe :: IO CInt
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_unsafe = hs_bindgen_a34e536ea5931d76
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams3@
+foreign import ccall unsafe "hs_bindgen_80f6772cd6dfe2a9" hs_bindgen_80f6772cd6dfe2a9_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams3@
+hs_bindgen_80f6772cd6dfe2a9 :: CInt -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_noParams3@
+hs_bindgen_80f6772cd6dfe2a9 = \x_0 -> \x_1 -> hs_bindgen_80f6772cd6dfe2a9_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_unsafe :: CInt -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_unsafe = hs_bindgen_80f6772cd6dfe2a9
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_8938b867c00625aa" hs_bindgen_8938b867c00625aa_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret1@
+hs_bindgen_8938b867c00625aa :: CInt -> IO (FunPtr (IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret1@
+hs_bindgen_8938b867c00625aa = \x_0 -> fmap fromFFIType (hs_bindgen_8938b867c00625aa_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_unsafe :: CInt -> IO (FunPtr (IO ()))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_unsafe = hs_bindgen_8938b867c00625aa
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_03ba9af419f7c750" hs_bindgen_03ba9af419f7c750_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret2@
+hs_bindgen_03ba9af419f7c750 :: CInt -> IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret2@
+hs_bindgen_03ba9af419f7c750 = \x_0 -> fmap fromFFIType (hs_bindgen_03ba9af419f7c750_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_unsafe :: CInt -> IO (FunPtr (IO CInt))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_unsafe = hs_bindgen_03ba9af419f7c750
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_c53c44ca84d8cb81" hs_bindgen_c53c44ca84d8cb81_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret3@
+hs_bindgen_c53c44ca84d8cb81 :: CInt -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret3@
+hs_bindgen_c53c44ca84d8cb81 = \x_0 -> fmap fromFFIType (hs_bindgen_c53c44ca84d8cb81_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_unsafe :: CInt -> IO (FunPtr (CInt -> IO ()))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_unsafe = hs_bindgen_c53c44ca84d8cb81
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_fb5431b884cc209e" hs_bindgen_fb5431b884cc209e_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret4@
+hs_bindgen_fb5431b884cc209e :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO CChar))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret4@
+hs_bindgen_fb5431b884cc209e = \x_0 -> fmap fromFFIType (hs_bindgen_fb5431b884cc209e_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO CChar))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_unsafe = hs_bindgen_fb5431b884cc209e
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_b45419cebf6cb43d" hs_bindgen_b45419cebf6cb43d_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret5@
+hs_bindgen_b45419cebf6cb43d :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret5@
+hs_bindgen_b45419cebf6cb43d = \x_0 -> fmap fromFFIType (hs_bindgen_b45419cebf6cb43d_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_unsafe = hs_bindgen_b45419cebf6cb43d
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_5c14b480ba3cab1e" hs_bindgen_5c14b480ba3cab1e_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret6@
+hs_bindgen_5c14b480ba3cab1e :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret6@
+hs_bindgen_5c14b480ba3cab1e = \x_0 -> fmap fromFFIType (hs_bindgen_5c14b480ba3cab1e_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_unsafe = hs_bindgen_5c14b480ba3cab1e
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_b8f93b6ff6ce2b1c" hs_bindgen_b8f93b6ff6ce2b1c_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret7@
+hs_bindgen_b8f93b6ff6ce2b1c :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret7@
+hs_bindgen_b8f93b6ff6ce2b1c = \x_0 -> fmap fromFFIType (hs_bindgen_b8f93b6ff6ce2b1c_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_unsafe = hs_bindgen_b8f93b6ff6ce2b1c
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_74e1d2bf9ed6b1c5" hs_bindgen_74e1d2bf9ed6b1c5_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret8@
+hs_bindgen_74e1d2bf9ed6b1c5 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret8@
+hs_bindgen_74e1d2bf9ed6b1c5 = \x_0 -> fmap fromFFIType (hs_bindgen_74e1d2bf9ed6b1c5_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_unsafe = hs_bindgen_74e1d2bf9ed6b1c5
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_8e68b5e49b407e0b" hs_bindgen_8e68b5e49b407e0b_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret9@
+hs_bindgen_8e68b5e49b407e0b :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret9@
+hs_bindgen_8e68b5e49b407e0b = \x_0 -> fmap fromFFIType (hs_bindgen_8e68b5e49b407e0b_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_unsafe = hs_bindgen_8e68b5e49b407e0b
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_1fc54cf36aa5566f" hs_bindgen_1fc54cf36aa5566f_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret10@
+hs_bindgen_1fc54cf36aa5566f :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_Unsafe_funptr_ret10@
+hs_bindgen_1fc54cf36aa5566f = \x_0 -> fmap fromFFIType (hs_bindgen_1fc54cf36aa5566f_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_unsafe :: CInt ->
+                       IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_unsafe = hs_bindgen_1fc54cf36aa5566f
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char1@
+foreign import ccall unsafe "hs_bindgen_b80f882fdcf9d390" hs_bindgen_b80f882fdcf9d390_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char1@
+hs_bindgen_b80f882fdcf9d390 :: IO (FunPtr (CInt -> CChar -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char1@
+hs_bindgen_b80f882fdcf9d390 = fmap fromFFIType hs_bindgen_b80f882fdcf9d390_base
+{-# NOINLINE args_char1_funptr #-}
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_funptr :: FunPtr (CInt -> CChar -> IO ())
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_funptr = unsafePerformIO hs_bindgen_b80f882fdcf9d390
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char2@
+foreign import ccall unsafe "hs_bindgen_b604969d2857133d" hs_bindgen_b604969d2857133d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char2@
+hs_bindgen_b604969d2857133d :: IO (FunPtr (CInt ->
+                                           CSChar -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char2@
+hs_bindgen_b604969d2857133d = fmap fromFFIType hs_bindgen_b604969d2857133d_base
+{-# NOINLINE args_char2_funptr #-}
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_funptr :: FunPtr (CInt -> CSChar -> IO ())
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_funptr = unsafePerformIO hs_bindgen_b604969d2857133d
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char3@
+foreign import ccall unsafe "hs_bindgen_9b95a55e6ceb1621" hs_bindgen_9b95a55e6ceb1621_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char3@
+hs_bindgen_9b95a55e6ceb1621 :: IO (FunPtr (CInt ->
+                                           CUChar -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_char3@
+hs_bindgen_9b95a55e6ceb1621 = fmap fromFFIType hs_bindgen_9b95a55e6ceb1621_base
+{-# NOINLINE args_char3_funptr #-}
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_funptr :: FunPtr (CInt -> CUChar -> IO ())
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_funptr = unsafePerformIO hs_bindgen_9b95a55e6ceb1621
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short1@
+foreign import ccall unsafe "hs_bindgen_f72fa5fc8023eb3f" hs_bindgen_f72fa5fc8023eb3f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short1@
+hs_bindgen_f72fa5fc8023eb3f :: IO (FunPtr (CInt ->
+                                           CShort -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short1@
+hs_bindgen_f72fa5fc8023eb3f = fmap fromFFIType hs_bindgen_f72fa5fc8023eb3f_base
+{-# NOINLINE args_short1_funptr #-}
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_funptr :: FunPtr (CInt -> CShort -> IO ())
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_funptr = unsafePerformIO hs_bindgen_f72fa5fc8023eb3f
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short2@
+foreign import ccall unsafe "hs_bindgen_5e4d62486e4f3759" hs_bindgen_5e4d62486e4f3759_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short2@
+hs_bindgen_5e4d62486e4f3759 :: IO (FunPtr (CInt ->
+                                           CShort -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short2@
+hs_bindgen_5e4d62486e4f3759 = fmap fromFFIType hs_bindgen_5e4d62486e4f3759_base
+{-# NOINLINE args_short2_funptr #-}
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_funptr :: FunPtr (CInt -> CShort -> IO ())
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_funptr = unsafePerformIO hs_bindgen_5e4d62486e4f3759
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short3@
+foreign import ccall unsafe "hs_bindgen_cef5409d73a3ebb9" hs_bindgen_cef5409d73a3ebb9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short3@
+hs_bindgen_cef5409d73a3ebb9 :: IO (FunPtr (CInt ->
+                                           CUShort -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_short3@
+hs_bindgen_cef5409d73a3ebb9 = fmap fromFFIType hs_bindgen_cef5409d73a3ebb9_base
+{-# NOINLINE args_short3_funptr #-}
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_funptr :: FunPtr (CInt -> CUShort -> IO ())
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_funptr = unsafePerformIO hs_bindgen_cef5409d73a3ebb9
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int1@
+foreign import ccall unsafe "hs_bindgen_67400948e9390e71" hs_bindgen_67400948e9390e71_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int1@
+hs_bindgen_67400948e9390e71 :: IO (FunPtr (CInt -> CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int1@
+hs_bindgen_67400948e9390e71 = fmap fromFFIType hs_bindgen_67400948e9390e71_base
+{-# NOINLINE args_int1_funptr #-}
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_funptr :: FunPtr (CInt -> CInt -> IO ())
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_funptr = unsafePerformIO hs_bindgen_67400948e9390e71
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int2@
+foreign import ccall unsafe "hs_bindgen_f931f0229bddda59" hs_bindgen_f931f0229bddda59_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int2@
+hs_bindgen_f931f0229bddda59 :: IO (FunPtr (CInt -> CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int2@
+hs_bindgen_f931f0229bddda59 = fmap fromFFIType hs_bindgen_f931f0229bddda59_base
+{-# NOINLINE args_int2_funptr #-}
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_funptr :: FunPtr (CInt -> CInt -> IO ())
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_funptr = unsafePerformIO hs_bindgen_f931f0229bddda59
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int3@
+foreign import ccall unsafe "hs_bindgen_fa14da0adf102175" hs_bindgen_fa14da0adf102175_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int3@
+hs_bindgen_fa14da0adf102175 :: IO (FunPtr (CInt -> CUInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_int3@
+hs_bindgen_fa14da0adf102175 = fmap fromFFIType hs_bindgen_fa14da0adf102175_base
+{-# NOINLINE args_int3_funptr #-}
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_funptr :: FunPtr (CInt -> CUInt -> IO ())
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_funptr = unsafePerformIO hs_bindgen_fa14da0adf102175
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long1@
+foreign import ccall unsafe "hs_bindgen_af7f311d12eb20c0" hs_bindgen_af7f311d12eb20c0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long1@
+hs_bindgen_af7f311d12eb20c0 :: IO (FunPtr (CInt -> CLong -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long1@
+hs_bindgen_af7f311d12eb20c0 = fmap fromFFIType hs_bindgen_af7f311d12eb20c0_base
+{-# NOINLINE args_long1_funptr #-}
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_funptr :: FunPtr (CInt -> CLong -> IO ())
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_funptr = unsafePerformIO hs_bindgen_af7f311d12eb20c0
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long2@
+foreign import ccall unsafe "hs_bindgen_09143fbe9a30e2a2" hs_bindgen_09143fbe9a30e2a2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long2@
+hs_bindgen_09143fbe9a30e2a2 :: IO (FunPtr (CInt -> CLong -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long2@
+hs_bindgen_09143fbe9a30e2a2 = fmap fromFFIType hs_bindgen_09143fbe9a30e2a2_base
+{-# NOINLINE args_long2_funptr #-}
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_funptr :: FunPtr (CInt -> CLong -> IO ())
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_funptr = unsafePerformIO hs_bindgen_09143fbe9a30e2a2
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long3@
+foreign import ccall unsafe "hs_bindgen_9a73b75e254c0317" hs_bindgen_9a73b75e254c0317_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long3@
+hs_bindgen_9a73b75e254c0317 :: IO (FunPtr (CInt ->
+                                           CULong -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_long3@
+hs_bindgen_9a73b75e254c0317 = fmap fromFFIType hs_bindgen_9a73b75e254c0317_base
+{-# NOINLINE args_long3_funptr #-}
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_funptr :: FunPtr (CInt -> CULong -> IO ())
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_funptr = unsafePerformIO hs_bindgen_9a73b75e254c0317
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_float@
+foreign import ccall unsafe "hs_bindgen_98a70ab7e71e634d" hs_bindgen_98a70ab7e71e634d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_float@
+hs_bindgen_98a70ab7e71e634d :: IO (FunPtr (CInt ->
+                                           CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_float@
+hs_bindgen_98a70ab7e71e634d = fmap fromFFIType hs_bindgen_98a70ab7e71e634d_base
+{-# NOINLINE args_float_funptr #-}
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_funptr :: FunPtr (CInt -> CFloat -> IO ())
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_funptr = unsafePerformIO hs_bindgen_98a70ab7e71e634d
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_double@
+foreign import ccall unsafe "hs_bindgen_2bc72f8a3bdbad63" hs_bindgen_2bc72f8a3bdbad63_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_double@
+hs_bindgen_2bc72f8a3bdbad63 :: IO (FunPtr (CInt ->
+                                           CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_double@
+hs_bindgen_2bc72f8a3bdbad63 = fmap fromFFIType hs_bindgen_2bc72f8a3bdbad63_base
+{-# NOINLINE args_double_funptr #-}
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_funptr :: FunPtr (CInt -> CDouble -> IO ())
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_funptr = unsafePerformIO hs_bindgen_2bc72f8a3bdbad63
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_bool1@
+foreign import ccall unsafe "hs_bindgen_4f6046208f0c55ab" hs_bindgen_4f6046208f0c55ab_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_bool1@
+hs_bindgen_4f6046208f0c55ab :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_bool1@
+hs_bindgen_4f6046208f0c55ab = fmap fromFFIType hs_bindgen_4f6046208f0c55ab_base
+{-# NOINLINE args_bool1_funptr #-}
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_funptr = unsafePerformIO hs_bindgen_4f6046208f0c55ab
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_struct@
+foreign import ccall unsafe "hs_bindgen_511a8f421aca49d7" hs_bindgen_511a8f421aca49d7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_struct@
+hs_bindgen_511a8f421aca49d7 :: IO (FunPtr (CInt ->
+                                           Some_struct -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_struct@
+hs_bindgen_511a8f421aca49d7 = fmap fromFFIType hs_bindgen_511a8f421aca49d7_base
+{-# NOINLINE args_struct_funptr #-}
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_funptr :: FunPtr (CInt -> Some_struct -> IO ())
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_funptr = unsafePerformIO hs_bindgen_511a8f421aca49d7
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_union@
+foreign import ccall unsafe "hs_bindgen_edf2a54db0ba78fa" hs_bindgen_edf2a54db0ba78fa_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_union@
+hs_bindgen_edf2a54db0ba78fa :: IO (FunPtr (CInt ->
+                                           Some_union -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_union@
+hs_bindgen_edf2a54db0ba78fa = fmap fromFFIType hs_bindgen_edf2a54db0ba78fa_base
+{-# NOINLINE args_union_funptr #-}
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_funptr :: FunPtr (CInt -> Some_union -> IO ())
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_funptr = unsafePerformIO hs_bindgen_edf2a54db0ba78fa
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_enum@
+foreign import ccall unsafe "hs_bindgen_fc74034537b4ecf6" hs_bindgen_fc74034537b4ecf6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_enum@
+hs_bindgen_fc74034537b4ecf6 :: IO (FunPtr (CInt ->
+                                           Some_enum -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_enum@
+hs_bindgen_fc74034537b4ecf6 = fmap fromFFIType hs_bindgen_fc74034537b4ecf6_base
+{-# NOINLINE args_enum_funptr #-}
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_funptr :: FunPtr (CInt -> Some_enum -> IO ())
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_funptr = unsafePerformIO hs_bindgen_fc74034537b4ecf6
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_594ea5d2885bc64d" hs_bindgen_594ea5d2885bc64d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer1@
+hs_bindgen_594ea5d2885bc64d :: IO (FunPtr (CInt ->
+                                           Ptr CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer1@
+hs_bindgen_594ea5d2885bc64d = fmap fromFFIType hs_bindgen_594ea5d2885bc64d_base
+{-# NOINLINE args_pointer1_funptr #-}
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_funptr :: FunPtr (CInt -> Ptr CInt -> IO ())
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_funptr = unsafePerformIO hs_bindgen_594ea5d2885bc64d
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_5179b8dedaed5e5e" hs_bindgen_5179b8dedaed5e5e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer2@
+hs_bindgen_5179b8dedaed5e5e :: IO (FunPtr (CInt ->
+                                           Ptr (Ptr CInt) -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer2@
+hs_bindgen_5179b8dedaed5e5e = fmap fromFFIType hs_bindgen_5179b8dedaed5e5e_base
+{-# NOINLINE args_pointer2_funptr #-}
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_funptr :: FunPtr (CInt -> Ptr (Ptr CInt) -> IO ())
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_funptr = unsafePerformIO hs_bindgen_5179b8dedaed5e5e
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_72daaebaddd12e45" hs_bindgen_72daaebaddd12e45_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer3@
+hs_bindgen_72daaebaddd12e45 :: IO (FunPtr (CInt ->
+                                           Ptr Void -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_pointer3@
+hs_bindgen_72daaebaddd12e45 = fmap fromFFIType hs_bindgen_72daaebaddd12e45_base
+{-# NOINLINE args_pointer3_funptr #-}
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_funptr :: FunPtr (CInt -> Ptr Void -> IO ())
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_funptr = unsafePerformIO hs_bindgen_72daaebaddd12e45
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_A@
+foreign import ccall unsafe "hs_bindgen_cf6e0ba74be5a2da" hs_bindgen_cf6e0ba74be5a2da_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_A@
+hs_bindgen_cf6e0ba74be5a2da :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_A@
+hs_bindgen_cf6e0ba74be5a2da = fmap fromFFIType hs_bindgen_cf6e0ba74be5a2da_base
+{-# NOINLINE ret_A_funptr #-}
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_funptr = unsafePerformIO hs_bindgen_cf6e0ba74be5a2da
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char1@
+foreign import ccall unsafe "hs_bindgen_f223792546e3022e" hs_bindgen_f223792546e3022e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char1@
+hs_bindgen_f223792546e3022e :: IO (FunPtr (CInt -> IO CChar))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char1@
+hs_bindgen_f223792546e3022e = fmap fromFFIType hs_bindgen_f223792546e3022e_base
+{-# NOINLINE ret_char1_funptr #-}
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_funptr :: FunPtr (CInt -> IO CChar)
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_funptr = unsafePerformIO hs_bindgen_f223792546e3022e
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char2@
+foreign import ccall unsafe "hs_bindgen_9bb497f3e0172b6d" hs_bindgen_9bb497f3e0172b6d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char2@
+hs_bindgen_9bb497f3e0172b6d :: IO (FunPtr (CInt -> IO CSChar))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char2@
+hs_bindgen_9bb497f3e0172b6d = fmap fromFFIType hs_bindgen_9bb497f3e0172b6d_base
+{-# NOINLINE ret_char2_funptr #-}
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_funptr :: FunPtr (CInt -> IO CSChar)
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_funptr = unsafePerformIO hs_bindgen_9bb497f3e0172b6d
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char3@
+foreign import ccall unsafe "hs_bindgen_3be11c39ee59643e" hs_bindgen_3be11c39ee59643e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char3@
+hs_bindgen_3be11c39ee59643e :: IO (FunPtr (CInt -> IO CUChar))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_char3@
+hs_bindgen_3be11c39ee59643e = fmap fromFFIType hs_bindgen_3be11c39ee59643e_base
+{-# NOINLINE ret_char3_funptr #-}
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_funptr :: FunPtr (CInt -> IO CUChar)
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_funptr = unsafePerformIO hs_bindgen_3be11c39ee59643e
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short1@
+foreign import ccall unsafe "hs_bindgen_a65b0b8d17719893" hs_bindgen_a65b0b8d17719893_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short1@
+hs_bindgen_a65b0b8d17719893 :: IO (FunPtr (CInt -> IO CShort))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short1@
+hs_bindgen_a65b0b8d17719893 = fmap fromFFIType hs_bindgen_a65b0b8d17719893_base
+{-# NOINLINE ret_short1_funptr #-}
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_funptr :: FunPtr (CInt -> IO CShort)
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_funptr = unsafePerformIO hs_bindgen_a65b0b8d17719893
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short2@
+foreign import ccall unsafe "hs_bindgen_5190e7513c922ff0" hs_bindgen_5190e7513c922ff0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short2@
+hs_bindgen_5190e7513c922ff0 :: IO (FunPtr (CInt -> IO CShort))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short2@
+hs_bindgen_5190e7513c922ff0 = fmap fromFFIType hs_bindgen_5190e7513c922ff0_base
+{-# NOINLINE ret_short2_funptr #-}
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_funptr :: FunPtr (CInt -> IO CShort)
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_funptr = unsafePerformIO hs_bindgen_5190e7513c922ff0
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short3@
+foreign import ccall unsafe "hs_bindgen_43b7df2a55a61277" hs_bindgen_43b7df2a55a61277_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short3@
+hs_bindgen_43b7df2a55a61277 :: IO (FunPtr (CInt -> IO CUShort))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_short3@
+hs_bindgen_43b7df2a55a61277 = fmap fromFFIType hs_bindgen_43b7df2a55a61277_base
+{-# NOINLINE ret_short3_funptr #-}
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_funptr :: FunPtr (CInt -> IO CUShort)
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_funptr = unsafePerformIO hs_bindgen_43b7df2a55a61277
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int1@
+foreign import ccall unsafe "hs_bindgen_0c98313fb5db2326" hs_bindgen_0c98313fb5db2326_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int1@
+hs_bindgen_0c98313fb5db2326 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int1@
+hs_bindgen_0c98313fb5db2326 = fmap fromFFIType hs_bindgen_0c98313fb5db2326_base
+{-# NOINLINE ret_int1_funptr #-}
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_funptr = unsafePerformIO hs_bindgen_0c98313fb5db2326
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int2@
+foreign import ccall unsafe "hs_bindgen_ec162368f9f436e3" hs_bindgen_ec162368f9f436e3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int2@
+hs_bindgen_ec162368f9f436e3 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int2@
+hs_bindgen_ec162368f9f436e3 = fmap fromFFIType hs_bindgen_ec162368f9f436e3_base
+{-# NOINLINE ret_int2_funptr #-}
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_funptr = unsafePerformIO hs_bindgen_ec162368f9f436e3
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int3@
+foreign import ccall unsafe "hs_bindgen_7affbbac42cd29e2" hs_bindgen_7affbbac42cd29e2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int3@
+hs_bindgen_7affbbac42cd29e2 :: IO (FunPtr (CInt -> IO CUInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_int3@
+hs_bindgen_7affbbac42cd29e2 = fmap fromFFIType hs_bindgen_7affbbac42cd29e2_base
+{-# NOINLINE ret_int3_funptr #-}
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_funptr :: FunPtr (CInt -> IO CUInt)
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_funptr = unsafePerformIO hs_bindgen_7affbbac42cd29e2
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long1@
+foreign import ccall unsafe "hs_bindgen_7622c56c9539e04c" hs_bindgen_7622c56c9539e04c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long1@
+hs_bindgen_7622c56c9539e04c :: IO (FunPtr (CInt -> IO CLong))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long1@
+hs_bindgen_7622c56c9539e04c = fmap fromFFIType hs_bindgen_7622c56c9539e04c_base
+{-# NOINLINE ret_long1_funptr #-}
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_funptr :: FunPtr (CInt -> IO CLong)
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_funptr = unsafePerformIO hs_bindgen_7622c56c9539e04c
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long2@
+foreign import ccall unsafe "hs_bindgen_815df1fcd6285cb1" hs_bindgen_815df1fcd6285cb1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long2@
+hs_bindgen_815df1fcd6285cb1 :: IO (FunPtr (CInt -> IO CLong))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long2@
+hs_bindgen_815df1fcd6285cb1 = fmap fromFFIType hs_bindgen_815df1fcd6285cb1_base
+{-# NOINLINE ret_long2_funptr #-}
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_funptr :: FunPtr (CInt -> IO CLong)
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_funptr = unsafePerformIO hs_bindgen_815df1fcd6285cb1
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long3@
+foreign import ccall unsafe "hs_bindgen_246bedca6a708d23" hs_bindgen_246bedca6a708d23_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long3@
+hs_bindgen_246bedca6a708d23 :: IO (FunPtr (CInt -> IO CULong))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_long3@
+hs_bindgen_246bedca6a708d23 = fmap fromFFIType hs_bindgen_246bedca6a708d23_base
+{-# NOINLINE ret_long3_funptr #-}
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_funptr :: FunPtr (CInt -> IO CULong)
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_funptr = unsafePerformIO hs_bindgen_246bedca6a708d23
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_float@
+foreign import ccall unsafe "hs_bindgen_d0a43141a677f147" hs_bindgen_d0a43141a677f147_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_float@
+hs_bindgen_d0a43141a677f147 :: IO (FunPtr (CInt -> IO CFloat))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_float@
+hs_bindgen_d0a43141a677f147 = fmap fromFFIType hs_bindgen_d0a43141a677f147_base
+{-# NOINLINE ret_float_funptr #-}
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_funptr :: FunPtr (CInt -> IO CFloat)
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_funptr = unsafePerformIO hs_bindgen_d0a43141a677f147
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_double@
+foreign import ccall unsafe "hs_bindgen_e39c2a2347167cd5" hs_bindgen_e39c2a2347167cd5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_double@
+hs_bindgen_e39c2a2347167cd5 :: IO (FunPtr (CInt -> IO CDouble))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_double@
+hs_bindgen_e39c2a2347167cd5 = fmap fromFFIType hs_bindgen_e39c2a2347167cd5_base
+{-# NOINLINE ret_double_funptr #-}
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_funptr :: FunPtr (CInt -> IO CDouble)
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_funptr = unsafePerformIO hs_bindgen_e39c2a2347167cd5
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_2f72fbc044a4bbfd" hs_bindgen_2f72fbc044a4bbfd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_bool1@
+hs_bindgen_2f72fbc044a4bbfd :: IO (FunPtr (CInt -> IO CBool))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_bool1@
+hs_bindgen_2f72fbc044a4bbfd = fmap fromFFIType hs_bindgen_2f72fbc044a4bbfd_base
+{-# NOINLINE ret_bool1_funptr #-}
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_funptr :: FunPtr (CInt -> IO CBool)
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_funptr = unsafePerformIO hs_bindgen_2f72fbc044a4bbfd
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_struct@
+foreign import ccall unsafe "hs_bindgen_3ed00edaff786c0e" hs_bindgen_3ed00edaff786c0e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_struct@
+hs_bindgen_3ed00edaff786c0e :: IO (FunPtr (CInt -> IO Some_struct))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_struct@
+hs_bindgen_3ed00edaff786c0e = fmap fromFFIType hs_bindgen_3ed00edaff786c0e_base
+{-# NOINLINE ret_struct_funptr #-}
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_funptr :: FunPtr (CInt -> IO Some_struct)
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_funptr = unsafePerformIO hs_bindgen_3ed00edaff786c0e
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_union@
+foreign import ccall unsafe "hs_bindgen_1b270595798725a6" hs_bindgen_1b270595798725a6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_union@
+hs_bindgen_1b270595798725a6 :: IO (FunPtr (CInt -> IO Some_union))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_union@
+hs_bindgen_1b270595798725a6 = fmap fromFFIType hs_bindgen_1b270595798725a6_base
+{-# NOINLINE ret_union_funptr #-}
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_funptr :: FunPtr (CInt -> IO Some_union)
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_funptr = unsafePerformIO hs_bindgen_1b270595798725a6
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_enum@
+foreign import ccall unsafe "hs_bindgen_df1e959d57683966" hs_bindgen_df1e959d57683966_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_enum@
+hs_bindgen_df1e959d57683966 :: IO (FunPtr (CInt -> IO Some_enum))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_enum@
+hs_bindgen_df1e959d57683966 = fmap fromFFIType hs_bindgen_df1e959d57683966_base
+{-# NOINLINE ret_enum_funptr #-}
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_funptr :: FunPtr (CInt -> IO Some_enum)
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_funptr = unsafePerformIO hs_bindgen_df1e959d57683966
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_f66df065bdb19e72" hs_bindgen_f66df065bdb19e72_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer1@
+hs_bindgen_f66df065bdb19e72 :: IO (FunPtr (CInt -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer1@
+hs_bindgen_f66df065bdb19e72 = fmap fromFFIType hs_bindgen_f66df065bdb19e72_base
+{-# NOINLINE ret_pointer1_funptr #-}
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_funptr :: FunPtr (CInt -> IO (Ptr CInt))
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_funptr = unsafePerformIO hs_bindgen_f66df065bdb19e72
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_12d9b147f5523ea9" hs_bindgen_12d9b147f5523ea9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer2@
+hs_bindgen_12d9b147f5523ea9 :: IO (FunPtr (CInt ->
+                                           IO (Ptr (Ptr CInt))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer2@
+hs_bindgen_12d9b147f5523ea9 = fmap fromFFIType hs_bindgen_12d9b147f5523ea9_base
+{-# NOINLINE ret_pointer2_funptr #-}
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_funptr :: FunPtr (CInt -> IO (Ptr (Ptr CInt)))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_funptr = unsafePerformIO hs_bindgen_12d9b147f5523ea9
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_4ac9f0fe826d0748" hs_bindgen_4ac9f0fe826d0748_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer3@
+hs_bindgen_4ac9f0fe826d0748 :: IO (FunPtr (CInt -> IO (Ptr Void)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_pointer3@
+hs_bindgen_4ac9f0fe826d0748 = fmap fromFFIType hs_bindgen_4ac9f0fe826d0748_base
+{-# NOINLINE ret_pointer3_funptr #-}
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_funptr :: FunPtr (CInt -> IO (Ptr Void))
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_funptr = unsafePerformIO hs_bindgen_4ac9f0fe826d0748
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body1@
+foreign import ccall unsafe "hs_bindgen_2974316436a63e20" hs_bindgen_2974316436a63e20_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body1@
+hs_bindgen_2974316436a63e20 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body1@
+hs_bindgen_2974316436a63e20 = fmap fromFFIType hs_bindgen_2974316436a63e20_base
+{-# NOINLINE body1_funptr #-}
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_funptr = unsafePerformIO hs_bindgen_2974316436a63e20
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body2@
+foreign import ccall unsafe "hs_bindgen_2b14d27784f519af" hs_bindgen_2b14d27784f519af_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body2@
+hs_bindgen_2b14d27784f519af :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_body2@
+hs_bindgen_2b14d27784f519af = fmap fromFFIType hs_bindgen_2b14d27784f519af_base
+{-# NOINLINE body2_funptr #-}
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_funptr = unsafePerformIO hs_bindgen_2b14d27784f519af
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_387d68ceb6d006f9" hs_bindgen_387d68ceb6d006f9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_float@
+hs_bindgen_387d68ceb6d006f9 :: IO (FunPtr (CInt ->
+                                           Complex CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_float@
+hs_bindgen_387d68ceb6d006f9 = fmap fromFFIType hs_bindgen_387d68ceb6d006f9_base
+{-# NOINLINE args_complex_float_funptr #-}
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_funptr :: FunPtr (CInt ->
+                                     Complex CFloat -> IO ())
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_funptr = unsafePerformIO hs_bindgen_387d68ceb6d006f9
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_a0dd7e51d4c3782c" hs_bindgen_a0dd7e51d4c3782c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_double@
+hs_bindgen_a0dd7e51d4c3782c :: IO (FunPtr (CInt ->
+                                           Complex CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_args_complex_double@
+hs_bindgen_a0dd7e51d4c3782c = fmap fromFFIType hs_bindgen_a0dd7e51d4c3782c_base
+{-# NOINLINE args_complex_double_funptr #-}
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_funptr :: FunPtr (CInt ->
+                                      Complex CDouble -> IO ())
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_funptr = unsafePerformIO hs_bindgen_a0dd7e51d4c3782c
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_121af3746ec0fe57" hs_bindgen_121af3746ec0fe57_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_float@
+hs_bindgen_121af3746ec0fe57 :: IO (FunPtr (CInt ->
+                                           IO (Complex CFloat)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_float@
+hs_bindgen_121af3746ec0fe57 = fmap fromFFIType hs_bindgen_121af3746ec0fe57_base
+{-# NOINLINE ret_complex_float_funptr #-}
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_funptr :: FunPtr (CInt -> IO (Complex CFloat))
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_funptr = unsafePerformIO hs_bindgen_121af3746ec0fe57
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_f5f4fa2b769a0807" hs_bindgen_f5f4fa2b769a0807_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_double@
+hs_bindgen_f5f4fa2b769a0807 :: IO (FunPtr (CInt ->
+                                           IO (Complex CDouble)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_ret_complex_double@
+hs_bindgen_f5f4fa2b769a0807 = fmap fromFFIType hs_bindgen_f5f4fa2b769a0807_base
+{-# NOINLINE ret_complex_double_funptr #-}
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_funptr :: FunPtr (CInt -> IO (Complex CDouble))
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_funptr = unsafePerformIO hs_bindgen_f5f4fa2b769a0807
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_6c590995b92657c7" hs_bindgen_6c590995b92657c7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args1@
+hs_bindgen_6c590995b92657c7 :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args1@
+hs_bindgen_6c590995b92657c7 = fmap fromFFIType hs_bindgen_6c590995b92657c7_base
+{-# NOINLINE bespoke_args1_funptr #-}
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_funptr = unsafePerformIO hs_bindgen_6c590995b92657c7
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_b871d8c50d13d10a" hs_bindgen_b871d8c50d13d10a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args2@
+hs_bindgen_b871d8c50d13d10a :: IO (FunPtr (CInt ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_args2@
+hs_bindgen_b871d8c50d13d10a = fmap fromFFIType hs_bindgen_b871d8c50d13d10a_base
+{-# NOINLINE bespoke_args2_funptr #-}
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_funptr :: FunPtr (CInt ->
+                                HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_funptr = unsafePerformIO hs_bindgen_b871d8c50d13d10a
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_457eeaee9b36d630" hs_bindgen_457eeaee9b36d630_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret1@
+hs_bindgen_457eeaee9b36d630 :: IO (FunPtr (CInt -> IO CBool))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret1@
+hs_bindgen_457eeaee9b36d630 = fmap fromFFIType hs_bindgen_457eeaee9b36d630_base
+{-# NOINLINE bespoke_ret1_funptr #-}
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_funptr :: FunPtr (CInt -> IO CBool)
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_funptr = unsafePerformIO hs_bindgen_457eeaee9b36d630
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_11a75beb43d5fc2e" hs_bindgen_11a75beb43d5fc2e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret2@
+hs_bindgen_11a75beb43d5fc2e :: IO (FunPtr (CInt ->
+                                           IO HsBindgen.Runtime.LibC.CSize))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_bespoke_ret2@
+hs_bindgen_11a75beb43d5fc2e = fmap fromFFIType hs_bindgen_11a75beb43d5fc2e_base
+{-# NOINLINE bespoke_ret2_funptr #-}
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_funptr :: FunPtr (CInt ->
+                               IO HsBindgen.Runtime.LibC.CSize)
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_funptr = unsafePerformIO hs_bindgen_11a75beb43d5fc2e
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args1@
+foreign import ccall unsafe "hs_bindgen_618624c6e6b83a22" hs_bindgen_618624c6e6b83a22_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args1@
+hs_bindgen_618624c6e6b83a22 :: IO (FunPtr (Ptr (Elem (IncompleteArray CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args1@
+hs_bindgen_618624c6e6b83a22 = fmap fromFFIType hs_bindgen_618624c6e6b83a22_base
+{-# NOINLINE arr_args1_funptr #-}
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_funptr :: FunPtr (Ptr (Elem (IncompleteArray CInt)) ->
+                            IO ())
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_funptr = unsafePerformIO hs_bindgen_618624c6e6b83a22
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args2@
+foreign import ccall unsafe "hs_bindgen_2ad0461638177d93" hs_bindgen_2ad0461638177d93_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args2@
+hs_bindgen_2ad0461638177d93 :: IO (FunPtr (Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args2@
+hs_bindgen_2ad0461638177d93 = fmap fromFFIType hs_bindgen_2ad0461638177d93_base
+{-# NOINLINE arr_args2_funptr #-}
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_funptr :: FunPtr (Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                            IO ())
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_funptr = unsafePerformIO hs_bindgen_2ad0461638177d93
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args3@
+foreign import ccall unsafe "hs_bindgen_c77b1b370d4c5f4b" hs_bindgen_c77b1b370d4c5f4b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args3@
+hs_bindgen_c77b1b370d4c5f4b :: IO (FunPtr (Ptr (Elem (ConstantArray 5
+                                                                    CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args3@
+hs_bindgen_c77b1b370d4c5f4b = fmap fromFFIType hs_bindgen_c77b1b370d4c5f4b_base
+{-# NOINLINE arr_args3_funptr #-}
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_funptr :: FunPtr (Ptr (Elem (ConstantArray 5 CInt)) ->
+                            IO ())
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_funptr = unsafePerformIO hs_bindgen_c77b1b370d4c5f4b
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args4@
+foreign import ccall unsafe "hs_bindgen_de199c863fb8ac12" hs_bindgen_de199c863fb8ac12_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args4@
+hs_bindgen_de199c863fb8ac12 :: IO (FunPtr (Ptr (Elem (ConstantArray 5
+                                                                    (Ptr CInt))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_arr_args4@
+hs_bindgen_de199c863fb8ac12 = fmap fromFFIType hs_bindgen_de199c863fb8ac12_base
+{-# NOINLINE arr_args4_funptr #-}
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_funptr :: FunPtr (Ptr (Elem (ConstantArray 5
+                                                     (Ptr CInt))) ->
+                            IO ())
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_funptr = unsafePerformIO hs_bindgen_de199c863fb8ac12
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_7fc280d0a83fec73" hs_bindgen_7fc280d0a83fec73_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args1@
+hs_bindgen_7fc280d0a83fec73 :: IO (FunPtr (CInt ->
+                                           FunPtr (IO ()) -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args1@
+hs_bindgen_7fc280d0a83fec73 = fmap fromFFIType hs_bindgen_7fc280d0a83fec73_base
+{-# NOINLINE funptr_args1_funptr #-}
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_funptr :: FunPtr (CInt -> FunPtr (IO ()) -> IO ())
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_funptr = unsafePerformIO hs_bindgen_7fc280d0a83fec73
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_9beb81169b296475" hs_bindgen_9beb81169b296475_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args2@
+hs_bindgen_9beb81169b296475 :: IO (FunPtr (CInt ->
+                                           FunPtr (IO CInt) -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args2@
+hs_bindgen_9beb81169b296475 = fmap fromFFIType hs_bindgen_9beb81169b296475_base
+{-# NOINLINE funptr_args2_funptr #-}
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_funptr :: FunPtr (CInt -> FunPtr (IO CInt) -> IO ())
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_funptr = unsafePerformIO hs_bindgen_9beb81169b296475
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_d85158bc0b976b5a" hs_bindgen_d85158bc0b976b5a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args3@
+hs_bindgen_d85158bc0b976b5a :: IO (FunPtr (CInt ->
+                                           FunPtr (CInt -> IO ()) -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args3@
+hs_bindgen_d85158bc0b976b5a = fmap fromFFIType hs_bindgen_d85158bc0b976b5a_base
+{-# NOINLINE funptr_args3_funptr #-}
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_funptr :: FunPtr (CInt ->
+                               FunPtr (CInt -> IO ()) -> IO ())
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_funptr = unsafePerformIO hs_bindgen_d85158bc0b976b5a
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_0b011779ec7227d9" hs_bindgen_0b011779ec7227d9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args4@
+hs_bindgen_0b011779ec7227d9 :: IO (FunPtr (CInt ->
+                                           FunPtr (CInt -> CDouble -> IO CChar) -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args4@
+hs_bindgen_0b011779ec7227d9 = fmap fromFFIType hs_bindgen_0b011779ec7227d9_base
+{-# NOINLINE funptr_args4_funptr #-}
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_funptr :: FunPtr (CInt ->
+                               FunPtr (CInt -> CDouble -> IO CChar) -> IO ())
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_funptr = unsafePerformIO hs_bindgen_0b011779ec7227d9
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_d358fcc92cb10cf3" hs_bindgen_d358fcc92cb10cf3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args5@
+hs_bindgen_d358fcc92cb10cf3 :: IO (FunPtr (CInt ->
+                                           FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_args5@
+hs_bindgen_d358fcc92cb10cf3 = fmap fromFFIType hs_bindgen_d358fcc92cb10cf3_base
+{-# NOINLINE funptr_args5_funptr #-}
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_funptr :: FunPtr (CInt ->
+                               FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ())
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_funptr = unsafePerformIO hs_bindgen_d358fcc92cb10cf3
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_comments1@
+foreign import ccall unsafe "hs_bindgen_0fd159d332801a82" hs_bindgen_0fd159d332801a82_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_comments1@
+hs_bindgen_0fd159d332801a82 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_comments1@
+hs_bindgen_0fd159d332801a82 = fmap fromFFIType hs_bindgen_0fd159d332801a82_base
+{-# NOINLINE comments1_funptr #-}
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_funptr :: FunPtr (CInt -> IO ())
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_funptr = unsafePerformIO hs_bindgen_0fd159d332801a82
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_a40876f663bcef73" hs_bindgen_a40876f663bcef73_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before1@
+hs_bindgen_a40876f663bcef73 :: IO (FunPtr (CInt -> CChar -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before1@
+hs_bindgen_a40876f663bcef73 = fmap fromFFIType hs_bindgen_a40876f663bcef73_base
+{-# NOINLINE const_prim_before1_funptr #-}
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_funptr :: FunPtr (CInt -> CChar -> IO ())
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_funptr = unsafePerformIO hs_bindgen_a40876f663bcef73
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_dc5eb25e2e741ab6" hs_bindgen_dc5eb25e2e741ab6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before2@
+hs_bindgen_dc5eb25e2e741ab6 :: IO (FunPtr (CInt ->
+                                           CSChar -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before2@
+hs_bindgen_dc5eb25e2e741ab6 = fmap fromFFIType hs_bindgen_dc5eb25e2e741ab6_base
+{-# NOINLINE const_prim_before2_funptr #-}
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_funptr :: FunPtr (CInt -> CSChar -> IO ())
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_funptr = unsafePerformIO hs_bindgen_dc5eb25e2e741ab6
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_9718326f589a56a0" hs_bindgen_9718326f589a56a0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before3@
+hs_bindgen_9718326f589a56a0 :: IO (FunPtr (CInt ->
+                                           CUChar -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_before3@
+hs_bindgen_9718326f589a56a0 = fmap fromFFIType hs_bindgen_9718326f589a56a0_base
+{-# NOINLINE const_prim_before3_funptr #-}
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_funptr :: FunPtr (CInt -> CUChar -> IO ())
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_funptr = unsafePerformIO hs_bindgen_9718326f589a56a0
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_cde59c88cf7b3db3" hs_bindgen_cde59c88cf7b3db3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after1@
+hs_bindgen_cde59c88cf7b3db3 :: IO (FunPtr (CInt -> CChar -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after1@
+hs_bindgen_cde59c88cf7b3db3 = fmap fromFFIType hs_bindgen_cde59c88cf7b3db3_base
+{-# NOINLINE const_prim_after1_funptr #-}
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_funptr :: FunPtr (CInt -> CChar -> IO ())
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_funptr = unsafePerformIO hs_bindgen_cde59c88cf7b3db3
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_d5ab011afdbef099" hs_bindgen_d5ab011afdbef099_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after2@
+hs_bindgen_d5ab011afdbef099 :: IO (FunPtr (CInt ->
+                                           CSChar -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after2@
+hs_bindgen_d5ab011afdbef099 = fmap fromFFIType hs_bindgen_d5ab011afdbef099_base
+{-# NOINLINE const_prim_after2_funptr #-}
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_funptr :: FunPtr (CInt -> CSChar -> IO ())
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_funptr = unsafePerformIO hs_bindgen_d5ab011afdbef099
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_30f31bede8bfc87c" hs_bindgen_30f31bede8bfc87c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after3@
+hs_bindgen_30f31bede8bfc87c :: IO (FunPtr (CInt ->
+                                           CUChar -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_prim_after3@
+hs_bindgen_30f31bede8bfc87c = fmap fromFFIType hs_bindgen_30f31bede8bfc87c_base
+{-# NOINLINE const_prim_after3_funptr #-}
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_funptr :: FunPtr (CInt -> CUChar -> IO ())
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_funptr = unsafePerformIO hs_bindgen_30f31bede8bfc87c
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_6cc702c24ac0eeb2" hs_bindgen_6cc702c24ac0eeb2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before1@
+hs_bindgen_6cc702c24ac0eeb2 :: IO (FunPtr (CInt ->
+                                           CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before1@
+hs_bindgen_6cc702c24ac0eeb2 = fmap fromFFIType hs_bindgen_6cc702c24ac0eeb2_base
+{-# NOINLINE const_withoutSign_before1_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_funptr :: FunPtr (CInt ->
+                                            CFloat -> IO ())
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_funptr = unsafePerformIO hs_bindgen_6cc702c24ac0eeb2
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_e77ba4a5962cc68c" hs_bindgen_e77ba4a5962cc68c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before2@
+hs_bindgen_e77ba4a5962cc68c :: IO (FunPtr (CInt ->
+                                           CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before2@
+hs_bindgen_e77ba4a5962cc68c = fmap fromFFIType hs_bindgen_e77ba4a5962cc68c_base
+{-# NOINLINE const_withoutSign_before2_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_funptr :: FunPtr (CInt ->
+                                            CDouble -> IO ())
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_funptr = unsafePerformIO hs_bindgen_e77ba4a5962cc68c
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_c4d9de5a3852ba73" hs_bindgen_c4d9de5a3852ba73_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before3@
+hs_bindgen_c4d9de5a3852ba73 :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before3@
+hs_bindgen_c4d9de5a3852ba73 = fmap fromFFIType hs_bindgen_c4d9de5a3852ba73_base
+{-# NOINLINE const_withoutSign_before3_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_funptr = unsafePerformIO hs_bindgen_c4d9de5a3852ba73
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_585a37cd5f43f5da" hs_bindgen_585a37cd5f43f5da_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before4@
+hs_bindgen_585a37cd5f43f5da :: IO (FunPtr (CInt ->
+                                           Some_struct -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before4@
+hs_bindgen_585a37cd5f43f5da = fmap fromFFIType hs_bindgen_585a37cd5f43f5da_base
+{-# NOINLINE const_withoutSign_before4_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_funptr :: FunPtr (CInt ->
+                                            Some_struct -> IO ())
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_funptr = unsafePerformIO hs_bindgen_585a37cd5f43f5da
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_655c28dba28a9a53" hs_bindgen_655c28dba28a9a53_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before5@
+hs_bindgen_655c28dba28a9a53 :: IO (FunPtr (CInt ->
+                                           Some_union -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before5@
+hs_bindgen_655c28dba28a9a53 = fmap fromFFIType hs_bindgen_655c28dba28a9a53_base
+{-# NOINLINE const_withoutSign_before5_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_funptr :: FunPtr (CInt ->
+                                            Some_union -> IO ())
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_funptr = unsafePerformIO hs_bindgen_655c28dba28a9a53
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_9e08bdc34bafeee1" hs_bindgen_9e08bdc34bafeee1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before6@
+hs_bindgen_9e08bdc34bafeee1 :: IO (FunPtr (CInt ->
+                                           Some_enum -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before6@
+hs_bindgen_9e08bdc34bafeee1 = fmap fromFFIType hs_bindgen_9e08bdc34bafeee1_base
+{-# NOINLINE const_withoutSign_before6_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_funptr :: FunPtr (CInt ->
+                                            Some_enum -> IO ())
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_funptr = unsafePerformIO hs_bindgen_9e08bdc34bafeee1
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_5736b6db8251bdd5" hs_bindgen_5736b6db8251bdd5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before7@
+hs_bindgen_5736b6db8251bdd5 :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before7@
+hs_bindgen_5736b6db8251bdd5 = fmap fromFFIType hs_bindgen_5736b6db8251bdd5_base
+{-# NOINLINE const_withoutSign_before7_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_funptr = unsafePerformIO hs_bindgen_5736b6db8251bdd5
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_c398560b654a8d9d" hs_bindgen_c398560b654a8d9d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before8@
+hs_bindgen_c398560b654a8d9d :: IO (FunPtr (CInt ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_before8@
+hs_bindgen_c398560b654a8d9d = fmap fromFFIType hs_bindgen_c398560b654a8d9d_base
+{-# NOINLINE const_withoutSign_before8_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_funptr :: FunPtr (CInt ->
+                                            HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_funptr = unsafePerformIO hs_bindgen_c398560b654a8d9d
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_10bff078d94c8cd0" hs_bindgen_10bff078d94c8cd0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after1@
+hs_bindgen_10bff078d94c8cd0 :: IO (FunPtr (CInt ->
+                                           CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after1@
+hs_bindgen_10bff078d94c8cd0 = fmap fromFFIType hs_bindgen_10bff078d94c8cd0_base
+{-# NOINLINE const_withoutSign_after1_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_funptr :: FunPtr (CInt -> CFloat -> IO ())
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_funptr = unsafePerformIO hs_bindgen_10bff078d94c8cd0
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_b75e6b8d1be2004b" hs_bindgen_b75e6b8d1be2004b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after2@
+hs_bindgen_b75e6b8d1be2004b :: IO (FunPtr (CInt ->
+                                           CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after2@
+hs_bindgen_b75e6b8d1be2004b = fmap fromFFIType hs_bindgen_b75e6b8d1be2004b_base
+{-# NOINLINE const_withoutSign_after2_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_funptr :: FunPtr (CInt ->
+                                           CDouble -> IO ())
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_funptr = unsafePerformIO hs_bindgen_b75e6b8d1be2004b
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_60f26b5a2f8cf394" hs_bindgen_60f26b5a2f8cf394_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after3@
+hs_bindgen_60f26b5a2f8cf394 :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after3@
+hs_bindgen_60f26b5a2f8cf394 = fmap fromFFIType hs_bindgen_60f26b5a2f8cf394_base
+{-# NOINLINE const_withoutSign_after3_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_funptr = unsafePerformIO hs_bindgen_60f26b5a2f8cf394
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_0503ec9e78e10edf" hs_bindgen_0503ec9e78e10edf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after4@
+hs_bindgen_0503ec9e78e10edf :: IO (FunPtr (CInt ->
+                                           Some_struct -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after4@
+hs_bindgen_0503ec9e78e10edf = fmap fromFFIType hs_bindgen_0503ec9e78e10edf_base
+{-# NOINLINE const_withoutSign_after4_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_funptr :: FunPtr (CInt ->
+                                           Some_struct -> IO ())
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_funptr = unsafePerformIO hs_bindgen_0503ec9e78e10edf
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_1657dae083620adf" hs_bindgen_1657dae083620adf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after5@
+hs_bindgen_1657dae083620adf :: IO (FunPtr (CInt ->
+                                           Some_union -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after5@
+hs_bindgen_1657dae083620adf = fmap fromFFIType hs_bindgen_1657dae083620adf_base
+{-# NOINLINE const_withoutSign_after5_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_funptr :: FunPtr (CInt ->
+                                           Some_union -> IO ())
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_funptr = unsafePerformIO hs_bindgen_1657dae083620adf
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_44c293b62ff2015d" hs_bindgen_44c293b62ff2015d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after6@
+hs_bindgen_44c293b62ff2015d :: IO (FunPtr (CInt ->
+                                           Some_enum -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after6@
+hs_bindgen_44c293b62ff2015d = fmap fromFFIType hs_bindgen_44c293b62ff2015d_base
+{-# NOINLINE const_withoutSign_after6_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_funptr :: FunPtr (CInt ->
+                                           Some_enum -> IO ())
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_funptr = unsafePerformIO hs_bindgen_44c293b62ff2015d
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_ed406d5edbd28ec1" hs_bindgen_ed406d5edbd28ec1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after7@
+hs_bindgen_ed406d5edbd28ec1 :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after7@
+hs_bindgen_ed406d5edbd28ec1 = fmap fromFFIType hs_bindgen_ed406d5edbd28ec1_base
+{-# NOINLINE const_withoutSign_after7_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_funptr = unsafePerformIO hs_bindgen_ed406d5edbd28ec1
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_2cca685d1adca496" hs_bindgen_2cca685d1adca496_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after8@
+hs_bindgen_2cca685d1adca496 :: IO (FunPtr (CInt ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_withoutSign_after8@
+hs_bindgen_2cca685d1adca496 = fmap fromFFIType hs_bindgen_2cca685d1adca496_base
+{-# NOINLINE const_withoutSign_after8_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_funptr :: FunPtr (CInt ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_funptr = unsafePerformIO hs_bindgen_2cca685d1adca496
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_5da738696e5beb04" hs_bindgen_5da738696e5beb04_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args1@
+hs_bindgen_5da738696e5beb04 :: IO (FunPtr (CInt ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args1@
+hs_bindgen_5da738696e5beb04 = fmap fromFFIType hs_bindgen_5da738696e5beb04_base
+{-# NOINLINE const_pointers_args1_funptr #-}
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_funptr :: FunPtr (CInt ->
+                                       PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_funptr = unsafePerformIO hs_bindgen_5da738696e5beb04
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_783634f682149eb7" hs_bindgen_783634f682149eb7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args2@
+hs_bindgen_783634f682149eb7 :: IO (FunPtr (CInt ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args2@
+hs_bindgen_783634f682149eb7 = fmap fromFFIType hs_bindgen_783634f682149eb7_base
+{-# NOINLINE const_pointers_args2_funptr #-}
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_funptr :: FunPtr (CInt ->
+                                       PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_funptr = unsafePerformIO hs_bindgen_783634f682149eb7
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_e8c26ca0eb024ce8" hs_bindgen_e8c26ca0eb024ce8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args3@
+hs_bindgen_e8c26ca0eb024ce8 :: IO (FunPtr (CInt ->
+                                           Ptr CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args3@
+hs_bindgen_e8c26ca0eb024ce8 = fmap fromFFIType hs_bindgen_e8c26ca0eb024ce8_base
+{-# NOINLINE const_pointers_args3_funptr #-}
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_funptr :: FunPtr (CInt -> Ptr CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_funptr = unsafePerformIO hs_bindgen_e8c26ca0eb024ce8
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_21e206a694593eb1" hs_bindgen_21e206a694593eb1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args4@
+hs_bindgen_21e206a694593eb1 :: IO (FunPtr (CInt ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args4@
+hs_bindgen_21e206a694593eb1 = fmap fromFFIType hs_bindgen_21e206a694593eb1_base
+{-# NOINLINE const_pointers_args4_funptr #-}
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_funptr :: FunPtr (CInt ->
+                                       PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_funptr = unsafePerformIO hs_bindgen_21e206a694593eb1
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_cc3a8f368db00421" hs_bindgen_cc3a8f368db00421_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args5@
+hs_bindgen_cc3a8f368db00421 :: IO (FunPtr (CInt ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_args5@
+hs_bindgen_cc3a8f368db00421 = fmap fromFFIType hs_bindgen_cc3a8f368db00421_base
+{-# NOINLINE const_pointers_args5_funptr #-}
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_funptr :: FunPtr (CInt ->
+                                       PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_funptr = unsafePerformIO hs_bindgen_cc3a8f368db00421
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_a9979680c0124010" hs_bindgen_a9979680c0124010_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret1@
+hs_bindgen_a9979680c0124010 :: IO (FunPtr (CInt ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret1@
+hs_bindgen_a9979680c0124010 = fmap fromFFIType hs_bindgen_a9979680c0124010_base
+{-# NOINLINE const_pointers_ret1_funptr #-}
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_funptr :: FunPtr (CInt -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_funptr = unsafePerformIO hs_bindgen_a9979680c0124010
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_c865f82ab69a4a3e" hs_bindgen_c865f82ab69a4a3e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret2@
+hs_bindgen_c865f82ab69a4a3e :: IO (FunPtr (CInt ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret2@
+hs_bindgen_c865f82ab69a4a3e = fmap fromFFIType hs_bindgen_c865f82ab69a4a3e_base
+{-# NOINLINE const_pointers_ret2_funptr #-}
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_funptr :: FunPtr (CInt -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_funptr = unsafePerformIO hs_bindgen_c865f82ab69a4a3e
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_61570ab40d22e404" hs_bindgen_61570ab40d22e404_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret3@
+hs_bindgen_61570ab40d22e404 :: IO (FunPtr (CInt -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret3@
+hs_bindgen_61570ab40d22e404 = fmap fromFFIType hs_bindgen_61570ab40d22e404_base
+{-# NOINLINE const_pointers_ret3_funptr #-}
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_funptr :: FunPtr (CInt -> IO (Ptr CInt))
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_funptr = unsafePerformIO hs_bindgen_61570ab40d22e404
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_7d02f676d3a68181" hs_bindgen_7d02f676d3a68181_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret4@
+hs_bindgen_7d02f676d3a68181 :: IO (FunPtr (CInt ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret4@
+hs_bindgen_7d02f676d3a68181 = fmap fromFFIType hs_bindgen_7d02f676d3a68181_base
+{-# NOINLINE const_pointers_ret4_funptr #-}
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_funptr :: FunPtr (CInt -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_funptr = unsafePerformIO hs_bindgen_7d02f676d3a68181
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_3a389377331b29b9" hs_bindgen_3a389377331b29b9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret5@
+hs_bindgen_3a389377331b29b9 :: IO (FunPtr (CInt ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_pointers_ret5@
+hs_bindgen_3a389377331b29b9 = fmap fromFFIType hs_bindgen_3a389377331b29b9_base
+{-# NOINLINE const_pointers_ret5_funptr #-}
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_funptr :: FunPtr (CInt -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_funptr = unsafePerformIO hs_bindgen_3a389377331b29b9
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_4810bd323f24b8d0" hs_bindgen_4810bd323f24b8d0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem1@
+hs_bindgen_4810bd323f24b8d0 :: IO (FunPtr (PtrConst (Elem (IncompleteArray CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem1@
+hs_bindgen_4810bd323f24b8d0 = fmap fromFFIType hs_bindgen_4810bd323f24b8d0_base
+{-# NOINLINE const_array_elem1_funptr #-}
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_funptr :: FunPtr (PtrConst (Elem (IncompleteArray CInt)) ->
+                                    IO ())
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_funptr = unsafePerformIO hs_bindgen_4810bd323f24b8d0
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_8bed93eafa056c5e" hs_bindgen_8bed93eafa056c5e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem2@
+hs_bindgen_8bed93eafa056c5e :: IO (FunPtr (Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem2@
+hs_bindgen_8bed93eafa056c5e = fmap fromFFIType hs_bindgen_8bed93eafa056c5e_base
+{-# NOINLINE const_array_elem2_funptr #-}
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_funptr :: FunPtr (Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                                    IO ())
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_funptr = unsafePerformIO hs_bindgen_8bed93eafa056c5e
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_c569d0da33bf00e3" hs_bindgen_c569d0da33bf00e3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem3@
+hs_bindgen_c569d0da33bf00e3 :: IO (FunPtr (PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const_array_elem3@
+hs_bindgen_c569d0da33bf00e3 = fmap fromFFIType hs_bindgen_c569d0da33bf00e3_base
+{-# NOINLINE const_array_elem3_funptr #-}
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_funptr :: FunPtr (PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                                    IO ())
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_funptr = unsafePerformIO hs_bindgen_c569d0da33bf00e3
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams1@
+foreign import ccall unsafe "hs_bindgen_91d4c9002424f82d" hs_bindgen_91d4c9002424f82d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams1@
+hs_bindgen_91d4c9002424f82d :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams1@
+hs_bindgen_91d4c9002424f82d = fmap fromFFIType hs_bindgen_91d4c9002424f82d_base
+{-# NOINLINE noParams1_funptr #-}
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_funptr :: FunPtr (IO CInt)
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_funptr = unsafePerformIO hs_bindgen_91d4c9002424f82d
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams2@
+foreign import ccall unsafe "hs_bindgen_a317809988dfeb84" hs_bindgen_a317809988dfeb84_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams2@
+hs_bindgen_a317809988dfeb84 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams2@
+hs_bindgen_a317809988dfeb84 = fmap fromFFIType hs_bindgen_a317809988dfeb84_base
+{-# NOINLINE noParams2_funptr #-}
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_funptr = unsafePerformIO hs_bindgen_a317809988dfeb84
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams3@
+foreign import ccall unsafe "hs_bindgen_c23ef724e4f315be" hs_bindgen_c23ef724e4f315be_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams3@
+hs_bindgen_c23ef724e4f315be :: IO (FunPtr (CInt ->
+                                           FunPtr (IO CInt) -> IO ()))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_noParams3@
+hs_bindgen_c23ef724e4f315be = fmap fromFFIType hs_bindgen_c23ef724e4f315be_base
+{-# NOINLINE noParams3_funptr #-}
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_funptr :: FunPtr (CInt -> FunPtr (IO CInt) -> IO ())
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_funptr = unsafePerformIO hs_bindgen_c23ef724e4f315be
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_660d89308b2b5a69" hs_bindgen_660d89308b2b5a69_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret1@
+hs_bindgen_660d89308b2b5a69 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (IO ()))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret1@
+hs_bindgen_660d89308b2b5a69 = fmap fromFFIType hs_bindgen_660d89308b2b5a69_base
+{-# NOINLINE funptr_ret1_funptr #-}
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_funptr :: FunPtr (CInt -> IO (FunPtr (IO ())))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_funptr = unsafePerformIO hs_bindgen_660d89308b2b5a69
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_bc7009eeb6b86418" hs_bindgen_bc7009eeb6b86418_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret2@
+hs_bindgen_bc7009eeb6b86418 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (IO CInt))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret2@
+hs_bindgen_bc7009eeb6b86418 = fmap fromFFIType hs_bindgen_bc7009eeb6b86418_base
+{-# NOINLINE funptr_ret2_funptr #-}
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_funptr :: FunPtr (CInt -> IO (FunPtr (IO CInt)))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_funptr = unsafePerformIO hs_bindgen_bc7009eeb6b86418
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_565629b4e4c20a7e" hs_bindgen_565629b4e4c20a7e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret3@
+hs_bindgen_565629b4e4c20a7e :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> IO ()))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret3@
+hs_bindgen_565629b4e4c20a7e = fmap fromFFIType hs_bindgen_565629b4e4c20a7e_base
+{-# NOINLINE funptr_ret3_funptr #-}
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_funptr :: FunPtr (CInt -> IO (FunPtr (CInt -> IO ())))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_funptr = unsafePerformIO hs_bindgen_565629b4e4c20a7e
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_3563760f061700c9" hs_bindgen_3563760f061700c9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret4@
+hs_bindgen_3563760f061700c9 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO CChar))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret4@
+hs_bindgen_3563760f061700c9 = fmap fromFFIType hs_bindgen_3563760f061700c9_base
+{-# NOINLINE funptr_ret4_funptr #-}
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO CChar)))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_funptr = unsafePerformIO hs_bindgen_3563760f061700c9
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_65c114a912faa4d1" hs_bindgen_65c114a912faa4d1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret5@
+hs_bindgen_65c114a912faa4d1 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret5@
+hs_bindgen_65c114a912faa4d1 = fmap fromFFIType hs_bindgen_65c114a912faa4d1_base
+{-# NOINLINE funptr_ret5_funptr #-}
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt))))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_funptr = unsafePerformIO hs_bindgen_65c114a912faa4d1
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_13dce2f12ceb5ef5" hs_bindgen_13dce2f12ceb5ef5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret6@
+hs_bindgen_13dce2f12ceb5ef5 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret6@
+hs_bindgen_13dce2f12ceb5ef5 = fmap fromFFIType hs_bindgen_13dce2f12ceb5ef5_base
+{-# NOINLINE funptr_ret6_funptr #-}
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_funptr = unsafePerformIO hs_bindgen_13dce2f12ceb5ef5
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_e69f4bc4bd10259c" hs_bindgen_e69f4bc4bd10259c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret7@
+hs_bindgen_e69f4bc4bd10259c :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret7@
+hs_bindgen_e69f4bc4bd10259c = fmap fromFFIType hs_bindgen_e69f4bc4bd10259c_base
+{-# NOINLINE funptr_ret7_funptr #-}
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_funptr = unsafePerformIO hs_bindgen_e69f4bc4bd10259c
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_f06ecca1a94b60e8" hs_bindgen_f06ecca1a94b60e8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret8@
+hs_bindgen_f06ecca1a94b60e8 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret8@
+hs_bindgen_f06ecca1a94b60e8 = fmap fromFFIType hs_bindgen_f06ecca1a94b60e8_base
+{-# NOINLINE funptr_ret8_funptr #-}
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt))))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_funptr = unsafePerformIO hs_bindgen_f06ecca1a94b60e8
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_65e9b457479db3fb" hs_bindgen_65e9b457479db3fb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret9@
+hs_bindgen_65e9b457479db3fb :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret9@
+hs_bindgen_65e9b457479db3fb = fmap fromFFIType hs_bindgen_65e9b457479db3fb_base
+{-# NOINLINE funptr_ret9_funptr #-}
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_funptr = unsafePerformIO hs_bindgen_65e9b457479db3fb
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_b5fb601528eabcdb" hs_bindgen_b5fb601528eabcdb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret10@
+hs_bindgen_b5fb601528eabcdb :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_funptr_ret10@
+hs_bindgen_b5fb601528eabcdb = fmap fromFFIType hs_bindgen_b5fb601528eabcdb_base
+{-# NOINLINE funptr_ret10_funptr #-}
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_funptr :: FunPtr (CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_funptr = unsafePerformIO hs_bindgen_b5fb601528eabcdb
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global1@
+foreign import ccall unsafe "hs_bindgen_c2929de3db3ebc68" hs_bindgen_c2929de3db3ebc68_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global1@
+hs_bindgen_c2929de3db3ebc68 :: IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global1@
+hs_bindgen_c2929de3db3ebc68 = fmap fromFFIType hs_bindgen_c2929de3db3ebc68_base
+{-# NOINLINE global1 #-}
+{-| Globals and constants
+
+    __C declaration:__ @global1@
+
+    __defined at:__ @macros\/reparse.h 161:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global1 :: Ptr CInt
+{-| Globals and constants
+
+    __C declaration:__ @global1@
+
+    __defined at:__ @macros\/reparse.h 161:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global1 = unsafePerformIO hs_bindgen_c2929de3db3ebc68
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global2@
+foreign import ccall unsafe "hs_bindgen_b642618eb14a88bf" hs_bindgen_b642618eb14a88bf_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global2@
+hs_bindgen_b642618eb14a88bf :: IO (Ptr (Ptr CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global2@
+hs_bindgen_b642618eb14a88bf = fmap fromFFIType hs_bindgen_b642618eb14a88bf_base
+{-# NOINLINE global2 #-}
+{-| __C declaration:__ @global2@
+
+    __defined at:__ @macros\/reparse.h 162:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global2 :: Ptr (Ptr CInt)
+{-| __C declaration:__ @global2@
+
+    __defined at:__ @macros\/reparse.h 162:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global2 = unsafePerformIO hs_bindgen_b642618eb14a88bf
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global3@
+foreign import ccall unsafe "hs_bindgen_37e22dedff20b0fa" hs_bindgen_37e22dedff20b0fa_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global3@
+hs_bindgen_37e22dedff20b0fa :: IO (Ptr (Ptr (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_global3@
+hs_bindgen_37e22dedff20b0fa = fmap fromFFIType hs_bindgen_37e22dedff20b0fa_base
+{-# NOINLINE global3 #-}
+{-| __C declaration:__ @global3@
+
+    __defined at:__ @macros\/reparse.h 163:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global3 :: Ptr (Ptr (Ptr CInt))
+{-| __C declaration:__ @global3@
+
+    __defined at:__ @macros\/reparse.h 163:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global3 = unsafePerformIO hs_bindgen_37e22dedff20b0fa
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const1@
+foreign import ccall unsafe "hs_bindgen_f54afb44a4459d9c" hs_bindgen_f54afb44a4459d9c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const1@
+hs_bindgen_f54afb44a4459d9c :: IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const1@
+hs_bindgen_f54afb44a4459d9c = fmap fromFFIType hs_bindgen_f54afb44a4459d9c_base
+{-# NOINLINE hs_bindgen_c9e1c2f1b5f1a18b #-}
+{-| __C declaration:__ @const1@
+
+    __defined at:__ @macros\/reparse.h 165:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_1_empty_Example_const1@
+-}
+hs_bindgen_c9e1c2f1b5f1a18b :: PtrConst CInt
+{-| __C declaration:__ @const1@
+
+    __defined at:__ @macros\/reparse.h 165:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_1_empty_Example_const1@
+-}
+hs_bindgen_c9e1c2f1b5f1a18b = unsafePerformIO hs_bindgen_f54afb44a4459d9c
+{-# NOINLINE const1 #-}
+const1 :: CInt
+const1 = unsafePerformIO (peek hs_bindgen_c9e1c2f1b5f1a18b)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const2@
+foreign import ccall unsafe "hs_bindgen_139264d86115f755" hs_bindgen_139264d86115f755_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const2@
+hs_bindgen_139264d86115f755 :: IO (PtrConst (Ptr CInt))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const2@
+hs_bindgen_139264d86115f755 = fmap fromFFIType hs_bindgen_139264d86115f755_base
+{-# NOINLINE hs_bindgen_e27452ffe7a65d32 #-}
+{-| __C declaration:__ @const2@
+
+    __defined at:__ @macros\/reparse.h 166:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_1_empty_Example_const2@
+-}
+hs_bindgen_e27452ffe7a65d32 :: PtrConst (Ptr CInt)
+{-| __C declaration:__ @const2@
+
+    __defined at:__ @macros\/reparse.h 166:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_1_empty_Example_const2@
+-}
+hs_bindgen_e27452ffe7a65d32 = unsafePerformIO hs_bindgen_139264d86115f755
+{-# NOINLINE const2 #-}
+const2 :: Ptr CInt
+const2 = unsafePerformIO (peek hs_bindgen_e27452ffe7a65d32)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const3@
+foreign import ccall unsafe "hs_bindgen_a13825d736275018" hs_bindgen_a13825d736275018_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const3@
+hs_bindgen_a13825d736275018 :: IO (PtrConst (Ptr (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_1_empty_Example_get_const3@
+hs_bindgen_a13825d736275018 = fmap fromFFIType hs_bindgen_a13825d736275018_base
+{-# NOINLINE hs_bindgen_217857747c06d0ce #-}
+{-| __C declaration:__ @const3@
+
+    __defined at:__ @macros\/reparse.h 167:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_1_empty_Example_const3@
+-}
+hs_bindgen_217857747c06d0ce :: PtrConst (Ptr (Ptr CInt))
+{-| __C declaration:__ @const3@
+
+    __defined at:__ @macros\/reparse.h 167:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_1_empty_Example_const3@
+-}
+hs_bindgen_217857747c06d0ce = unsafePerformIO hs_bindgen_a13825d736275018
+{-# NOINLINE const3 #-}
+const3 :: Ptr (Ptr CInt)
+const3 = unsafePerformIO (peek hs_bindgen_217857747c06d0ce)
diff --git a/test-artefacts/fixtures/macros/reparse.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.2.raw/Example.hs
@@ -0,0 +1,2793 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.a
+    , Example.Some_struct(..)
+    , Example.Some_union(..)
+    , Example.Some_enum(..)
+    , pattern Example.ENUM_A
+    , Example.Arr_typedef1(..)
+    , Example.Arr_typedef2(..)
+    , Example.Arr_typedef3(..)
+    , Example.Arr_typedef4(..)
+    , Example.Typedef1(..)
+    , Example.Typedef2(..)
+    , Example.Typedef3(..)
+    , Example.Funptr_typedef1_Aux(..)
+    , Example.Funptr_typedef1(..)
+    , Example.Funptr_typedef2_Aux(..)
+    , Example.Funptr_typedef2(..)
+    , Example.Funptr_typedef3_Aux(..)
+    , Example.Funptr_typedef3(..)
+    , Example.Funptr_typedef4_Aux(..)
+    , Example.Funptr_typedef4(..)
+    , Example.Funptr_typedef5_Aux(..)
+    , Example.Funptr_typedef5(..)
+    , Example.Comments2(..)
+    , Example.Example_struct(..)
+    , Example.Const_typedef1(..)
+    , Example.Const_typedef2(..)
+    , Example.Const_typedef3(..)
+    , Example.Const_typedef4(..)
+    , Example.Const_typedef5(..)
+    , Example.Const_typedef6(..)
+    , Example.Const_typedef7(..)
+    , Example.Example_struct_with_const(..)
+    , Example.Const_funptr1_Aux(..)
+    , Example.Const_funptr1(..)
+    , Example.Const_funptr2_Aux(..)
+    , Example.Const_funptr2(..)
+    , Example.Const_funptr3_Aux(..)
+    , Example.Const_funptr3(..)
+    , Example.Const_funptr4_Aux(..)
+    , Example.Const_funptr4(..)
+    , Example.Const_funptr5_Aux(..)
+    , Example.Const_funptr5(..)
+    , Example.Const_funptr6_Aux(..)
+    , Example.Const_funptr6(..)
+    , Example.Const_funptr7_Aux(..)
+    , Example.Const_funptr7(..)
+    , Example.bOOL
+    , Example.iNT
+    , Example.iNTP
+    , Example.iNTCP
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, String, fmap, pure, type (~))
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse.h 3:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+a :: Macro.Raw String
+a = Macro.objectLike "A" ["int"]
+
+{-| __C declaration:__ @struct some_struct@
+
+    __defined at:__ @macros\/reparse.h 7:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Some_struct = Some_struct
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Some_struct where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Some_struct where
+
+  readRaw = \ptr0 -> pure Some_struct
+
+instance Marshal.WriteRaw Some_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Some_struct -> pure ()
+
+deriving via Marshal.EquivStorable Some_struct instance BG.Storable Some_struct
+
+deriving via Struct.IsStructViaReadRaw Some_struct instance Struct.IsStruct Some_struct
+
+{-| __C declaration:__ @union some_union@
+
+    __defined at:__ @macros\/reparse.h 8:7@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_union = Some_union
+  { unwrapSome_union :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.StaticSize Some_union
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.ReadRaw Some_union
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.WriteRaw Some_union
+
+deriving via Marshal.EquivStorable Some_union instance BG.Storable Some_union
+
+deriving via BG.SizedByteArray 0 1 instance Union.IsUnion Some_union
+
+{-| __C declaration:__ @enum some_enum@
+
+    __defined at:__ @macros\/reparse.h 9:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_enum = Some_enum
+  { unwrapSome_enum :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Some_enum where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Some_enum where
+
+  readRaw =
+    \ptr0 ->
+          pure Some_enum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Some_enum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Some_enum unwrapSome_enum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapSome_enum2
+
+deriving via Marshal.EquivStorable Some_enum instance BG.Storable Some_enum
+
+deriving via BG.CUInt instance BG.Prim Some_enum
+
+instance CEnum.CEnum Some_enum where
+
+  type CEnumZ Some_enum = BG.CUInt
+
+  toCEnum = Some_enum
+
+  fromCEnum = BG.getField @"unwrapSome_enum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "ENUM_A")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Some_enum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Some_enum"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Some_enum where
+
+  minDeclaredValue = ENUM_A
+
+  maxDeclaredValue = ENUM_A
+
+instance Show Some_enum where
+
+  showsPrec = CEnum.shows
+
+instance Read Some_enum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapSome_enum" Some_enum ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Some_enum {unwrapSome_enum = y1}, BG.getField @"unwrapSome_enum" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapSome_enum" (BG.Ptr Some_enum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSome_enum")
+
+instance HasCField.HasCField Some_enum "unwrapSome_enum" where
+
+  type CFieldType Some_enum "unwrapSome_enum" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @ENUM_A@
+
+    __defined at:__ @macros\/reparse.h 9:18@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+pattern ENUM_A :: Some_enum
+pattern ENUM_A = Some_enum 0
+
+{-| __C declaration:__ @arr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 109:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef1 = Arr_typedef1
+  { unwrapArr_typedef1 :: IA.IncompleteArray BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef1" Arr_typedef1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef1 {unwrapArr_typedef1 = y1}
+      , BG.getField @"unwrapArr_typedef1" x0
+      )
+
+instance ( ty ~ IA.IncompleteArray BG.CInt
+         ) => BG.HasField "unwrapArr_typedef1" (BG.Ptr Arr_typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef1")
+
+instance HasCField.HasCField Arr_typedef1 "unwrapArr_typedef1" where
+
+  type CFieldType Arr_typedef1 "unwrapArr_typedef1" =
+    IA.IncompleteArray BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @arr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 110:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef2 = Arr_typedef2
+  { unwrapArr_typedef2 :: IA.IncompleteArray (BG.Ptr BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef2" Arr_typedef2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef2 {unwrapArr_typedef2 = y1}
+      , BG.getField @"unwrapArr_typedef2" x0
+      )
+
+instance ( ty ~ IA.IncompleteArray (BG.Ptr BG.CInt)
+         ) => BG.HasField "unwrapArr_typedef2" (BG.Ptr Arr_typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef2")
+
+instance HasCField.HasCField Arr_typedef2 "unwrapArr_typedef2" where
+
+  type CFieldType Arr_typedef2 "unwrapArr_typedef2" =
+    IA.IncompleteArray (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @arr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 111:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef3 = Arr_typedef3
+  { unwrapArr_typedef3 :: CA.ConstantArray 5 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 5 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef3" Arr_typedef3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef3 {unwrapArr_typedef3 = y1}
+      , BG.getField @"unwrapArr_typedef3" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 5 BG.CInt
+         ) => BG.HasField "unwrapArr_typedef3" (BG.Ptr Arr_typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef3")
+
+instance HasCField.HasCField Arr_typedef3 "unwrapArr_typedef3" where
+
+  type CFieldType Arr_typedef3 "unwrapArr_typedef3" =
+    CA.ConstantArray 5 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @arr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 112:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef4 = Arr_typedef4
+  { unwrapArr_typedef4 :: CA.ConstantArray 5 (BG.Ptr BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 5 (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef4" Arr_typedef4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef4 {unwrapArr_typedef4 = y1}
+      , BG.getField @"unwrapArr_typedef4" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 5 (BG.Ptr BG.CInt)
+         ) => BG.HasField "unwrapArr_typedef4" (BG.Ptr Arr_typedef4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef4")
+
+instance HasCField.HasCField Arr_typedef4 "unwrapArr_typedef4" where
+
+  type CFieldType Arr_typedef4 "unwrapArr_typedef4" =
+    CA.ConstantArray 5 (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Typedefs
+
+    __C declaration:__ @typedef1@
+
+    __defined at:__ @macros\/reparse.h 118:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef1 = Typedef1
+  { unwrapTypedef1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapTypedef1" Typedef1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Typedef1 {unwrapTypedef1 = y1}, BG.getField @"unwrapTypedef1" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapTypedef1" (BG.Ptr Typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypedef1")
+
+instance HasCField.HasCField Typedef1 "unwrapTypedef1" where
+
+  type CFieldType Typedef1 "unwrapTypedef1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @typedef2@
+
+    __defined at:__ @macros\/reparse.h 119:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef2 = Typedef2
+  { unwrapTypedef2 :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapTypedef2" Typedef2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Typedef2 {unwrapTypedef2 = y1}, BG.getField @"unwrapTypedef2" x0)
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrapTypedef2" (BG.Ptr Typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypedef2")
+
+instance HasCField.HasCField Typedef2 "unwrapTypedef2" where
+
+  type CFieldType Typedef2 "unwrapTypedef2" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @typedef3@
+
+    __defined at:__ @macros\/reparse.h 120:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef3 = Typedef3
+  { unwrapTypedef3 :: BG.Ptr (BG.Ptr BG.CInt)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapTypedef3" Typedef3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Typedef3 {unwrapTypedef3 = y1}, BG.getField @"unwrapTypedef3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CInt)
+         ) => BG.HasField "unwrapTypedef3" (BG.Ptr Typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypedef3")
+
+instance HasCField.HasCField Typedef3 "unwrapTypedef3" where
+
+  type CFieldType Typedef3 "unwrapTypedef3" =
+    BG.Ptr (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef1'
+
+    __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1_Aux = Funptr_typedef1_Aux
+  { unwrapFunptr_typedef1_Aux :: IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c584d0f839fd43de_base ::
+     IO BG.CInt
+  -> IO (BG.FunPtr (IO BG.CInt))
+
+-- __unique:__ @toFunptr_typedef1_Aux@
+hs_bindgen_c584d0f839fd43de ::
+     Funptr_typedef1_Aux
+  -> IO (BG.FunPtr Funptr_typedef1_Aux)
+hs_bindgen_c584d0f839fd43de =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c584d0f839fd43de_base (fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef1_Aux" fun0)))
+
+-- __unique:__ @fromFunptr_typedef1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_806a46dc418a062c_base ::
+     BG.FunPtr (IO BG.CInt)
+  -> IO BG.CInt
+
+-- __unique:__ @fromFunptr_typedef1_Aux@
+hs_bindgen_806a46dc418a062c ::
+     BG.FunPtr Funptr_typedef1_Aux
+  -> Funptr_typedef1_Aux
+hs_bindgen_806a46dc418a062c =
+  \funPtr0 ->
+    Funptr_typedef1_Aux (fmap BG.fromFFIType (hs_bindgen_806a46dc418a062c_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Funptr_typedef1_Aux where
+
+  toFunPtr = hs_bindgen_c584d0f839fd43de
+
+instance BG.FromFunPtr Funptr_typedef1_Aux where
+
+  fromFunPtr = hs_bindgen_806a46dc418a062c
+
+instance ( ty ~ IO BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef1_Aux" Funptr_typedef1_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef1_Aux {unwrapFunptr_typedef1_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef1_Aux" x0
+      )
+
+instance ( ty ~ IO BG.CInt
+         ) => BG.HasField "unwrapFunptr_typedef1_Aux" (BG.Ptr Funptr_typedef1_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef1_Aux")
+
+instance HasCField.HasCField Funptr_typedef1_Aux "unwrapFunptr_typedef1_Aux" where
+
+  type CFieldType Funptr_typedef1_Aux "unwrapFunptr_typedef1_Aux" =
+    IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1 = Funptr_typedef1
+  { unwrapFunptr_typedef1 :: BG.FunPtr Funptr_typedef1_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef1_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef1" Funptr_typedef1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef1 {unwrapFunptr_typedef1 = y1}
+      , BG.getField @"unwrapFunptr_typedef1" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef1_Aux
+         ) => BG.HasField "unwrapFunptr_typedef1" (BG.Ptr Funptr_typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef1")
+
+instance HasCField.HasCField Funptr_typedef1 "unwrapFunptr_typedef1" where
+
+  type CFieldType Funptr_typedef1 "unwrapFunptr_typedef1" =
+    BG.FunPtr Funptr_typedef1_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef2'
+
+    __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2_Aux = Funptr_typedef2_Aux
+  { unwrapFunptr_typedef2_Aux :: IO (BG.Ptr BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_f174457a161ac5a0_base ::
+     IO (BG.Ptr BG.Void)
+  -> IO (BG.FunPtr (IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toFunptr_typedef2_Aux@
+hs_bindgen_f174457a161ac5a0 ::
+     Funptr_typedef2_Aux
+  -> IO (BG.FunPtr Funptr_typedef2_Aux)
+hs_bindgen_f174457a161ac5a0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_f174457a161ac5a0_base (fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef2_Aux" fun0)))
+
+-- __unique:__ @fromFunptr_typedef2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_323d07dff85b802c_base ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromFunptr_typedef2_Aux@
+hs_bindgen_323d07dff85b802c ::
+     BG.FunPtr Funptr_typedef2_Aux
+  -> Funptr_typedef2_Aux
+hs_bindgen_323d07dff85b802c =
+  \funPtr0 ->
+    Funptr_typedef2_Aux (fmap BG.fromFFIType (hs_bindgen_323d07dff85b802c_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Funptr_typedef2_Aux where
+
+  toFunPtr = hs_bindgen_f174457a161ac5a0
+
+instance BG.FromFunPtr Funptr_typedef2_Aux where
+
+  fromFunPtr = hs_bindgen_323d07dff85b802c
+
+instance ( ty ~ IO (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef2_Aux" Funptr_typedef2_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef2_Aux {unwrapFunptr_typedef2_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef2_Aux" x0
+      )
+
+instance ( ty ~ IO (BG.Ptr BG.CInt)
+         ) => BG.HasField "unwrapFunptr_typedef2_Aux" (BG.Ptr Funptr_typedef2_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef2_Aux")
+
+instance HasCField.HasCField Funptr_typedef2_Aux "unwrapFunptr_typedef2_Aux" where
+
+  type CFieldType Funptr_typedef2_Aux "unwrapFunptr_typedef2_Aux" =
+    IO (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2 = Funptr_typedef2
+  { unwrapFunptr_typedef2 :: BG.FunPtr Funptr_typedef2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef2_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef2" Funptr_typedef2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef2 {unwrapFunptr_typedef2 = y1}
+      , BG.getField @"unwrapFunptr_typedef2" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef2_Aux
+         ) => BG.HasField "unwrapFunptr_typedef2" (BG.Ptr Funptr_typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef2")
+
+instance HasCField.HasCField Funptr_typedef2 "unwrapFunptr_typedef2" where
+
+  type CFieldType Funptr_typedef2 "unwrapFunptr_typedef2" =
+    BG.FunPtr Funptr_typedef2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef3'
+
+    __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3_Aux = Funptr_typedef3_Aux
+  { unwrapFunptr_typedef3_Aux :: IO (BG.Ptr (BG.Ptr BG.CInt))
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_031d1a7decd790d8_base ::
+     IO (BG.Ptr BG.Void)
+  -> IO (BG.FunPtr (IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toFunptr_typedef3_Aux@
+hs_bindgen_031d1a7decd790d8 ::
+     Funptr_typedef3_Aux
+  -> IO (BG.FunPtr Funptr_typedef3_Aux)
+hs_bindgen_031d1a7decd790d8 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_031d1a7decd790d8_base (fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef3_Aux" fun0)))
+
+-- __unique:__ @fromFunptr_typedef3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_82dc7b932974117e_base ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromFunptr_typedef3_Aux@
+hs_bindgen_82dc7b932974117e ::
+     BG.FunPtr Funptr_typedef3_Aux
+  -> Funptr_typedef3_Aux
+hs_bindgen_82dc7b932974117e =
+  \funPtr0 ->
+    Funptr_typedef3_Aux (fmap BG.fromFFIType (hs_bindgen_82dc7b932974117e_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Funptr_typedef3_Aux where
+
+  toFunPtr = hs_bindgen_031d1a7decd790d8
+
+instance BG.FromFunPtr Funptr_typedef3_Aux where
+
+  fromFunPtr = hs_bindgen_82dc7b932974117e
+
+instance ( ty ~ IO (BG.Ptr (BG.Ptr BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef3_Aux" Funptr_typedef3_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef3_Aux {unwrapFunptr_typedef3_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef3_Aux" x0
+      )
+
+instance ( ty ~ IO (BG.Ptr (BG.Ptr BG.CInt))
+         ) => BG.HasField "unwrapFunptr_typedef3_Aux" (BG.Ptr Funptr_typedef3_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef3_Aux")
+
+instance HasCField.HasCField Funptr_typedef3_Aux "unwrapFunptr_typedef3_Aux" where
+
+  type CFieldType Funptr_typedef3_Aux "unwrapFunptr_typedef3_Aux" =
+    IO (BG.Ptr (BG.Ptr BG.CInt))
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3 = Funptr_typedef3
+  { unwrapFunptr_typedef3 :: BG.FunPtr Funptr_typedef3_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef3_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef3" Funptr_typedef3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef3 {unwrapFunptr_typedef3 = y1}
+      , BG.getField @"unwrapFunptr_typedef3" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef3_Aux
+         ) => BG.HasField "unwrapFunptr_typedef3" (BG.Ptr Funptr_typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef3")
+
+instance HasCField.HasCField Funptr_typedef3 "unwrapFunptr_typedef3" where
+
+  type CFieldType Funptr_typedef3 "unwrapFunptr_typedef3" =
+    BG.FunPtr Funptr_typedef3_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef4'
+
+    __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4_Aux = Funptr_typedef4_Aux
+  { unwrapFunptr_typedef4_Aux :: BG.CInt -> BG.CDouble -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_da2336d254667386_base ::
+     (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt))
+
+-- __unique:__ @toFunptr_typedef4_Aux@
+hs_bindgen_da2336d254667386 ::
+     Funptr_typedef4_Aux
+  -> IO (BG.FunPtr Funptr_typedef4_Aux)
+hs_bindgen_da2336d254667386 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_da2336d254667386_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef4_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromFunptr_typedef4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d4a97954476da161_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> BG.CInt -> BG.CDouble -> IO BG.CInt
+
+-- __unique:__ @fromFunptr_typedef4_Aux@
+hs_bindgen_d4a97954476da161 ::
+     BG.FunPtr Funptr_typedef4_Aux
+  -> Funptr_typedef4_Aux
+hs_bindgen_d4a97954476da161 =
+  \funPtr0 ->
+    Funptr_typedef4_Aux (\x1 ->
+                           \x2 ->
+                             fmap BG.fromFFIType (hs_bindgen_d4a97954476da161_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Funptr_typedef4_Aux where
+
+  toFunPtr = hs_bindgen_da2336d254667386
+
+instance BG.FromFunPtr Funptr_typedef4_Aux where
+
+  fromFunPtr = hs_bindgen_d4a97954476da161
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef4_Aux" Funptr_typedef4_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef4_Aux {unwrapFunptr_typedef4_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef4_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.HasField "unwrapFunptr_typedef4_Aux" (BG.Ptr Funptr_typedef4_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef4_Aux")
+
+instance HasCField.HasCField Funptr_typedef4_Aux "unwrapFunptr_typedef4_Aux" where
+
+  type CFieldType Funptr_typedef4_Aux "unwrapFunptr_typedef4_Aux" =
+    BG.CInt -> BG.CDouble -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4 = Funptr_typedef4
+  { unwrapFunptr_typedef4 :: BG.FunPtr Funptr_typedef4_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef4_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef4" Funptr_typedef4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef4 {unwrapFunptr_typedef4 = y1}
+      , BG.getField @"unwrapFunptr_typedef4" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef4_Aux
+         ) => BG.HasField "unwrapFunptr_typedef4" (BG.Ptr Funptr_typedef4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef4")
+
+instance HasCField.HasCField Funptr_typedef4 "unwrapFunptr_typedef4" where
+
+  type CFieldType Funptr_typedef4 "unwrapFunptr_typedef4" =
+    BG.FunPtr Funptr_typedef4_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef5'
+
+    __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5_Aux = Funptr_typedef5_Aux
+  { unwrapFunptr_typedef5_Aux :: BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1f45632f07742a46_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toFunptr_typedef5_Aux@
+hs_bindgen_1f45632f07742a46 ::
+     Funptr_typedef5_Aux
+  -> IO (BG.FunPtr Funptr_typedef5_Aux)
+hs_bindgen_1f45632f07742a46 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1f45632f07742a46_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef5_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromFunptr_typedef5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_0bd1877eaaba0d3e_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromFunptr_typedef5_Aux@
+hs_bindgen_0bd1877eaaba0d3e ::
+     BG.FunPtr Funptr_typedef5_Aux
+  -> Funptr_typedef5_Aux
+hs_bindgen_0bd1877eaaba0d3e =
+  \funPtr0 ->
+    Funptr_typedef5_Aux (\x1 ->
+                           \x2 ->
+                             fmap BG.fromFFIType (hs_bindgen_0bd1877eaaba0d3e_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Funptr_typedef5_Aux where
+
+  toFunPtr = hs_bindgen_1f45632f07742a46
+
+instance BG.FromFunPtr Funptr_typedef5_Aux where
+
+  fromFunPtr = hs_bindgen_0bd1877eaaba0d3e
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef5_Aux" Funptr_typedef5_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef5_Aux {unwrapFunptr_typedef5_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef5_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+         ) => BG.HasField "unwrapFunptr_typedef5_Aux" (BG.Ptr Funptr_typedef5_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef5_Aux")
+
+instance HasCField.HasCField Funptr_typedef5_Aux "unwrapFunptr_typedef5_Aux" where
+
+  type CFieldType Funptr_typedef5_Aux "unwrapFunptr_typedef5_Aux" =
+    BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5 = Funptr_typedef5
+  { unwrapFunptr_typedef5 :: BG.FunPtr Funptr_typedef5_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef5_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef5" Funptr_typedef5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef5 {unwrapFunptr_typedef5 = y1}
+      , BG.getField @"unwrapFunptr_typedef5" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef5_Aux
+         ) => BG.HasField "unwrapFunptr_typedef5" (BG.Ptr Funptr_typedef5) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef5")
+
+instance HasCField.HasCField Funptr_typedef5 "unwrapFunptr_typedef5" where
+
+  type CFieldType Funptr_typedef5 "unwrapFunptr_typedef5" =
+    BG.FunPtr Funptr_typedef5_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @comments2@
+
+    __defined at:__ @macros\/reparse.h 145:30@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Comments2 = Comments2
+  { unwrapComments2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapComments2" Comments2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Comments2 {unwrapComments2 = y1}, BG.getField @"unwrapComments2" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapComments2" (BG.Ptr Comments2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapComments2")
+
+instance HasCField.HasCField Comments2 "unwrapComments2" where
+
+  type CFieldType Comments2 "unwrapComments2" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Struct fields
+
+    __C declaration:__ @struct example_struct@
+
+    __defined at:__ @macros\/reparse.h 151:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct = Example_struct
+  { example_struct_field1 :: BG.CInt
+    {- ^ __C declaration:__ @field1@
+
+         __defined at:__ @macros\/reparse.h 152:8@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_field2 :: BG.Ptr BG.CInt
+    {- ^ __C declaration:__ @field2@
+
+         __defined at:__ @macros\/reparse.h 153:8@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_field3 :: BG.Ptr (BG.Ptr BG.CInt)
+    {- ^ __C declaration:__ @field3@
+
+         __defined at:__ @macros\/reparse.h 154:8@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Example_struct where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Example_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Example_struct
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_field1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_field2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_field3") ptr0
+
+instance Marshal.WriteRaw Example_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Example_struct
+            example_struct_field12
+            example_struct_field23
+            example_struct_field34 ->
+                 HasCField.writeRaw (BG.Proxy @"example_struct_field1") ptr0 example_struct_field12
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_field2") ptr0 example_struct_field23
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_field3") ptr0 example_struct_field34
+
+deriving via Marshal.EquivStorable Example_struct instance BG.Storable Example_struct
+
+deriving via Struct.IsStructViaReadRaw Example_struct instance Struct.IsStruct Example_struct
+
+{-| __C declaration:__ @field1@
+
+    __defined at:__ @macros\/reparse.h 152:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_field1" Example_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct { example_struct_field1 = y1
+                         , example_struct_field2 = BG.getField @"example_struct_field2" x0
+                         , example_struct_field3 = BG.getField @"example_struct_field3" x0
+                         }
+      , BG.getField @"example_struct_field1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "example_struct_field1" (BG.Ptr Example_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_field1")
+
+instance HasCField.HasCField Example_struct "example_struct_field1" where
+
+  type CFieldType Example_struct "example_struct_field1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @field2@
+
+    __defined at:__ @macros\/reparse.h 153:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_field2" Example_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct { example_struct_field2 = y1
+                         , example_struct_field1 = BG.getField @"example_struct_field1" x0
+                         , example_struct_field3 = BG.getField @"example_struct_field3" x0
+                         }
+      , BG.getField @"example_struct_field2" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "example_struct_field2" (BG.Ptr Example_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_field2")
+
+instance HasCField.HasCField Example_struct "example_struct_field2" where
+
+  type CFieldType Example_struct "example_struct_field2" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @field3@
+
+    __defined at:__ @macros\/reparse.h 154:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CInt)
+         ) => BG.CompatHasField.HasField "example_struct_field3" Example_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct { example_struct_field3 = y1
+                         , example_struct_field1 = BG.getField @"example_struct_field1" x0
+                         , example_struct_field2 = BG.getField @"example_struct_field2" x0
+                         }
+      , BG.getField @"example_struct_field3" x0
+      )
+
+instance ( ty ~ BG.Ptr (BG.Ptr BG.CInt)
+         ) => BG.HasField "example_struct_field3" (BG.Ptr Example_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_field3")
+
+instance HasCField.HasCField Example_struct "example_struct_field3" where
+
+  type CFieldType Example_struct "example_struct_field3" =
+    BG.Ptr (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @const_typedef1@
+
+    __defined at:__ @macros\/reparse.h 218:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef1 = Const_typedef1
+  { unwrapConst_typedef1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef1" Const_typedef1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef1 {unwrapConst_typedef1 = y1}
+      , BG.getField @"unwrapConst_typedef1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapConst_typedef1" (BG.Ptr Const_typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef1")
+
+instance HasCField.HasCField Const_typedef1 "unwrapConst_typedef1" where
+
+  type CFieldType Const_typedef1 "unwrapConst_typedef1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef2@
+
+    __defined at:__ @macros\/reparse.h 219:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef2 = Const_typedef2
+  { unwrapConst_typedef2 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef2" Const_typedef2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef2 {unwrapConst_typedef2 = y1}
+      , BG.getField @"unwrapConst_typedef2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapConst_typedef2" (BG.Ptr Const_typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef2")
+
+instance HasCField.HasCField Const_typedef2 "unwrapConst_typedef2" where
+
+  type CFieldType Const_typedef2 "unwrapConst_typedef2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef3@
+
+    __defined at:__ @macros\/reparse.h 220:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef3 = Const_typedef3
+  { unwrapConst_typedef3 :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef3" Const_typedef3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef3 {unwrapConst_typedef3 = y1}
+      , BG.getField @"unwrapConst_typedef3" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapConst_typedef3" (BG.Ptr Const_typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef3")
+
+instance HasCField.HasCField Const_typedef3 "unwrapConst_typedef3" where
+
+  type CFieldType Const_typedef3 "unwrapConst_typedef3" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef4@
+
+    __defined at:__ @macros\/reparse.h 221:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef4 = Const_typedef4
+  { unwrapConst_typedef4 :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef4" Const_typedef4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef4 {unwrapConst_typedef4 = y1}
+      , BG.getField @"unwrapConst_typedef4" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapConst_typedef4" (BG.Ptr Const_typedef4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef4")
+
+instance HasCField.HasCField Const_typedef4 "unwrapConst_typedef4" where
+
+  type CFieldType Const_typedef4 "unwrapConst_typedef4" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef5@
+
+    __defined at:__ @macros\/reparse.h 222:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef5 = Const_typedef5
+  { unwrapConst_typedef5 :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef5" Const_typedef5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef5 {unwrapConst_typedef5 = y1}
+      , BG.getField @"unwrapConst_typedef5" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrapConst_typedef5" (BG.Ptr Const_typedef5) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef5")
+
+instance HasCField.HasCField Const_typedef5 "unwrapConst_typedef5" where
+
+  type CFieldType Const_typedef5 "unwrapConst_typedef5" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef6@
+
+    __defined at:__ @macros\/reparse.h 223:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef6 = Const_typedef6
+  { unwrapConst_typedef6 :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef6" Const_typedef6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef6 {unwrapConst_typedef6 = y1}
+      , BG.getField @"unwrapConst_typedef6" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapConst_typedef6" (BG.Ptr Const_typedef6) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef6")
+
+instance HasCField.HasCField Const_typedef6 "unwrapConst_typedef6" where
+
+  type CFieldType Const_typedef6 "unwrapConst_typedef6" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef7@
+
+    __defined at:__ @macros\/reparse.h 224:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef7 = Const_typedef7
+  { unwrapConst_typedef7 :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef7" Const_typedef7 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef7 {unwrapConst_typedef7 = y1}
+      , BG.getField @"unwrapConst_typedef7" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapConst_typedef7" (BG.Ptr Const_typedef7) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef7")
+
+instance HasCField.HasCField Const_typedef7 "unwrapConst_typedef7" where
+
+  type CFieldType Const_typedef7 "unwrapConst_typedef7" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct example_struct_with_const@
+
+    __defined at:__ @macros\/reparse.h 226:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct_with_const = Example_struct_with_const
+  { example_struct_with_const_const_field1 :: BG.CInt
+    {- ^ __C declaration:__ @const_field1@
+
+         __defined at:__ @macros\/reparse.h 227:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field2 :: BG.CInt
+    {- ^ __C declaration:__ @const_field2@
+
+         __defined at:__ @macros\/reparse.h 228:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field3 :: PtrConst.PtrConst BG.CInt
+    {- ^ __C declaration:__ @const_field3@
+
+         __defined at:__ @macros\/reparse.h 229:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field4 :: PtrConst.PtrConst BG.CInt
+    {- ^ __C declaration:__ @const_field4@
+
+         __defined at:__ @macros\/reparse.h 230:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field5 :: BG.Ptr BG.CInt
+    {- ^ __C declaration:__ @const_field5@
+
+         __defined at:__ @macros\/reparse.h 231:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field6 :: PtrConst.PtrConst BG.CInt
+    {- ^ __C declaration:__ @const_field6@
+
+         __defined at:__ @macros\/reparse.h 232:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field7 :: PtrConst.PtrConst BG.CInt
+    {- ^ __C declaration:__ @const_field7@
+
+         __defined at:__ @macros\/reparse.h 233:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Example_struct_with_const where
+
+  staticSizeOf = \_ -> (48 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Example_struct_with_const where
+
+  readRaw =
+    \ptr0 ->
+          pure Example_struct_with_const
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field3") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field4") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field5") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field6") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field7") ptr0
+
+instance Marshal.WriteRaw Example_struct_with_const where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Example_struct_with_const
+            example_struct_with_const_const_field12
+            example_struct_with_const_const_field23
+            example_struct_with_const_const_field34
+            example_struct_with_const_const_field45
+            example_struct_with_const_const_field56
+            example_struct_with_const_const_field67
+            example_struct_with_const_const_field78 ->
+                 HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field1") ptr0 example_struct_with_const_const_field12
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field2") ptr0 example_struct_with_const_const_field23
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field3") ptr0 example_struct_with_const_const_field34
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field4") ptr0 example_struct_with_const_const_field45
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field5") ptr0 example_struct_with_const_const_field56
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field6") ptr0 example_struct_with_const_const_field67
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field7") ptr0 example_struct_with_const_const_field78
+
+deriving via Marshal.EquivStorable Example_struct_with_const instance BG.Storable Example_struct_with_const
+
+deriving via Struct.IsStructViaReadRaw Example_struct_with_const instance Struct.IsStruct Example_struct_with_const
+
+{-| __C declaration:__ @const_field1@
+
+    __defined at:__ @macros\/reparse.h 227:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field1" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field1 = y1
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field1" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field1")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field1" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_field2@
+
+    __defined at:__ @macros\/reparse.h 228:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field2" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field2 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field2" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field2")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field2" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @const_field3@
+
+    __defined at:__ @macros\/reparse.h 229:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field3" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field3 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field3" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field3" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field3")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field3" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field3" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @const_field4@
+
+    __defined at:__ @macros\/reparse.h 230:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field4" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field4 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field4" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field4" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field4")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field4" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field4" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @const_field5@
+
+    __defined at:__ @macros\/reparse.h 231:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field5" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field5 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field5" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field5" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field5")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field5" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field5" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @const_field6@
+
+    __defined at:__ @macros\/reparse.h 232:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field6" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field6 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field6" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field6" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field6")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field6" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field6" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @const_field7@
+
+    __defined at:__ @macros\/reparse.h 233:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field7" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field7 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field7" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "example_struct_with_const_const_field7" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field7")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field7" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field7" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 40
+
+{-| Auxiliary type used by 'Const_funptr1'
+
+    __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1_Aux = Const_funptr1_Aux
+  { unwrapConst_funptr1_Aux :: BG.CInt -> BG.CDouble -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7f125e20a9d4075b_base ::
+     (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt))
+
+-- __unique:__ @toConst_funptr1_Aux@
+hs_bindgen_7f125e20a9d4075b ::
+     Const_funptr1_Aux
+  -> IO (BG.FunPtr Const_funptr1_Aux)
+hs_bindgen_7f125e20a9d4075b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7f125e20a9d4075b_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr1_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ac4bd8d789bba94b_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> BG.CInt -> BG.CDouble -> IO BG.CInt
+
+-- __unique:__ @fromConst_funptr1_Aux@
+hs_bindgen_ac4bd8d789bba94b ::
+     BG.FunPtr Const_funptr1_Aux
+  -> Const_funptr1_Aux
+hs_bindgen_ac4bd8d789bba94b =
+  \funPtr0 ->
+    Const_funptr1_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_ac4bd8d789bba94b_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr1_Aux where
+
+  toFunPtr = hs_bindgen_7f125e20a9d4075b
+
+instance BG.FromFunPtr Const_funptr1_Aux where
+
+  fromFunPtr = hs_bindgen_ac4bd8d789bba94b
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr1_Aux" Const_funptr1_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr1_Aux {unwrapConst_funptr1_Aux = y1}
+      , BG.getField @"unwrapConst_funptr1_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.HasField "unwrapConst_funptr1_Aux" (BG.Ptr Const_funptr1_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr1_Aux")
+
+instance HasCField.HasCField Const_funptr1_Aux "unwrapConst_funptr1_Aux" where
+
+  type CFieldType Const_funptr1_Aux "unwrapConst_funptr1_Aux" =
+    BG.CInt -> BG.CDouble -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1 = Const_funptr1
+  { unwrapConst_funptr1 :: BG.FunPtr Const_funptr1_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr1_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr1" Const_funptr1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr1 {unwrapConst_funptr1 = y1}
+      , BG.getField @"unwrapConst_funptr1" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr1_Aux
+         ) => BG.HasField "unwrapConst_funptr1" (BG.Ptr Const_funptr1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr1")
+
+instance HasCField.HasCField Const_funptr1 "unwrapConst_funptr1" where
+
+  type CFieldType Const_funptr1 "unwrapConst_funptr1" =
+    BG.FunPtr Const_funptr1_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr2'
+
+    __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2_Aux = Const_funptr2_Aux
+  { unwrapConst_funptr2_Aux :: BG.CInt -> BG.CDouble -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c7b1e36d845634fb_base ::
+     (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt))
+
+-- __unique:__ @toConst_funptr2_Aux@
+hs_bindgen_c7b1e36d845634fb ::
+     Const_funptr2_Aux
+  -> IO (BG.FunPtr Const_funptr2_Aux)
+hs_bindgen_c7b1e36d845634fb =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c7b1e36d845634fb_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr2_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_352cebf463125ca9_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> BG.CInt -> BG.CDouble -> IO BG.CInt
+
+-- __unique:__ @fromConst_funptr2_Aux@
+hs_bindgen_352cebf463125ca9 ::
+     BG.FunPtr Const_funptr2_Aux
+  -> Const_funptr2_Aux
+hs_bindgen_352cebf463125ca9 =
+  \funPtr0 ->
+    Const_funptr2_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_352cebf463125ca9_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr2_Aux where
+
+  toFunPtr = hs_bindgen_c7b1e36d845634fb
+
+instance BG.FromFunPtr Const_funptr2_Aux where
+
+  fromFunPtr = hs_bindgen_352cebf463125ca9
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr2_Aux" Const_funptr2_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr2_Aux {unwrapConst_funptr2_Aux = y1}
+      , BG.getField @"unwrapConst_funptr2_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO BG.CInt)
+         ) => BG.HasField "unwrapConst_funptr2_Aux" (BG.Ptr Const_funptr2_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr2_Aux")
+
+instance HasCField.HasCField Const_funptr2_Aux "unwrapConst_funptr2_Aux" where
+
+  type CFieldType Const_funptr2_Aux "unwrapConst_funptr2_Aux" =
+    BG.CInt -> BG.CDouble -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2 = Const_funptr2
+  { unwrapConst_funptr2 :: BG.FunPtr Const_funptr2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr2_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr2" Const_funptr2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr2 {unwrapConst_funptr2 = y1}
+      , BG.getField @"unwrapConst_funptr2" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr2_Aux
+         ) => BG.HasField "unwrapConst_funptr2" (BG.Ptr Const_funptr2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr2")
+
+instance HasCField.HasCField Const_funptr2 "unwrapConst_funptr2" where
+
+  type CFieldType Const_funptr2 "unwrapConst_funptr2" =
+    BG.FunPtr Const_funptr2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr3'
+
+    __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3_Aux = Const_funptr3_Aux
+  { unwrapConst_funptr3_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2dcbfe1c2502178c_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr3_Aux@
+hs_bindgen_2dcbfe1c2502178c ::
+     Const_funptr3_Aux
+  -> IO (BG.FunPtr Const_funptr3_Aux)
+hs_bindgen_2dcbfe1c2502178c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_2dcbfe1c2502178c_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr3_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_86738dcfd7c9d33c_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr3_Aux@
+hs_bindgen_86738dcfd7c9d33c ::
+     BG.FunPtr Const_funptr3_Aux
+  -> Const_funptr3_Aux
+hs_bindgen_86738dcfd7c9d33c =
+  \funPtr0 ->
+    Const_funptr3_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_86738dcfd7c9d33c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr3_Aux where
+
+  toFunPtr = hs_bindgen_2dcbfe1c2502178c
+
+instance BG.FromFunPtr Const_funptr3_Aux where
+
+  fromFunPtr = hs_bindgen_86738dcfd7c9d33c
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr3_Aux" Const_funptr3_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr3_Aux {unwrapConst_funptr3_Aux = y1}
+      , BG.getField @"unwrapConst_funptr3_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr3_Aux" (BG.Ptr Const_funptr3_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr3_Aux")
+
+instance HasCField.HasCField Const_funptr3_Aux "unwrapConst_funptr3_Aux" where
+
+  type CFieldType Const_funptr3_Aux "unwrapConst_funptr3_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3 = Const_funptr3
+  { unwrapConst_funptr3 :: BG.FunPtr Const_funptr3_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr3_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr3" Const_funptr3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr3 {unwrapConst_funptr3 = y1}
+      , BG.getField @"unwrapConst_funptr3" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr3_Aux
+         ) => BG.HasField "unwrapConst_funptr3" (BG.Ptr Const_funptr3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr3")
+
+instance HasCField.HasCField Const_funptr3 "unwrapConst_funptr3" where
+
+  type CFieldType Const_funptr3 "unwrapConst_funptr3" =
+    BG.FunPtr Const_funptr3_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr4'
+
+    __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4_Aux = Const_funptr4_Aux
+  { unwrapConst_funptr4_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5461deeda491de0b_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr4_Aux@
+hs_bindgen_5461deeda491de0b ::
+     Const_funptr4_Aux
+  -> IO (BG.FunPtr Const_funptr4_Aux)
+hs_bindgen_5461deeda491de0b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_5461deeda491de0b_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr4_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_de7846fca3bfd1b6_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr4_Aux@
+hs_bindgen_de7846fca3bfd1b6 ::
+     BG.FunPtr Const_funptr4_Aux
+  -> Const_funptr4_Aux
+hs_bindgen_de7846fca3bfd1b6 =
+  \funPtr0 ->
+    Const_funptr4_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_de7846fca3bfd1b6_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr4_Aux where
+
+  toFunPtr = hs_bindgen_5461deeda491de0b
+
+instance BG.FromFunPtr Const_funptr4_Aux where
+
+  fromFunPtr = hs_bindgen_de7846fca3bfd1b6
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr4_Aux" Const_funptr4_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr4_Aux {unwrapConst_funptr4_Aux = y1}
+      , BG.getField @"unwrapConst_funptr4_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr4_Aux" (BG.Ptr Const_funptr4_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr4_Aux")
+
+instance HasCField.HasCField Const_funptr4_Aux "unwrapConst_funptr4_Aux" where
+
+  type CFieldType Const_funptr4_Aux "unwrapConst_funptr4_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4 = Const_funptr4
+  { unwrapConst_funptr4 :: BG.FunPtr Const_funptr4_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr4_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr4" Const_funptr4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr4 {unwrapConst_funptr4 = y1}
+      , BG.getField @"unwrapConst_funptr4" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr4_Aux
+         ) => BG.HasField "unwrapConst_funptr4" (BG.Ptr Const_funptr4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr4")
+
+instance HasCField.HasCField Const_funptr4 "unwrapConst_funptr4" where
+
+  type CFieldType Const_funptr4 "unwrapConst_funptr4" =
+    BG.FunPtr Const_funptr4_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr5'
+
+    __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5_Aux = Const_funptr5_Aux
+  { unwrapConst_funptr5_Aux :: BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7b0174fc978a1ce1_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr5_Aux@
+hs_bindgen_7b0174fc978a1ce1 ::
+     Const_funptr5_Aux
+  -> IO (BG.FunPtr Const_funptr5_Aux)
+hs_bindgen_7b0174fc978a1ce1 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7b0174fc978a1ce1_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr5_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_38a21d84bb7115b5_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr5_Aux@
+hs_bindgen_38a21d84bb7115b5 ::
+     BG.FunPtr Const_funptr5_Aux
+  -> Const_funptr5_Aux
+hs_bindgen_38a21d84bb7115b5 =
+  \funPtr0 ->
+    Const_funptr5_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_38a21d84bb7115b5_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr5_Aux where
+
+  toFunPtr = hs_bindgen_7b0174fc978a1ce1
+
+instance BG.FromFunPtr Const_funptr5_Aux where
+
+  fromFunPtr = hs_bindgen_38a21d84bb7115b5
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr5_Aux" Const_funptr5_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr5_Aux {unwrapConst_funptr5_Aux = y1}
+      , BG.getField @"unwrapConst_funptr5_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr5_Aux" (BG.Ptr Const_funptr5_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr5_Aux")
+
+instance HasCField.HasCField Const_funptr5_Aux "unwrapConst_funptr5_Aux" where
+
+  type CFieldType Const_funptr5_Aux "unwrapConst_funptr5_Aux" =
+    BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5 = Const_funptr5
+  { unwrapConst_funptr5 :: BG.FunPtr Const_funptr5_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr5_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr5" Const_funptr5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr5 {unwrapConst_funptr5 = y1}
+      , BG.getField @"unwrapConst_funptr5" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr5_Aux
+         ) => BG.HasField "unwrapConst_funptr5" (BG.Ptr Const_funptr5) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr5")
+
+instance HasCField.HasCField Const_funptr5 "unwrapConst_funptr5" where
+
+  type CFieldType Const_funptr5 "unwrapConst_funptr5" =
+    BG.FunPtr Const_funptr5_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr6'
+
+    __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6_Aux = Const_funptr6_Aux
+  { unwrapConst_funptr6_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr6_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_4e32721222f4df9f_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr6_Aux@
+hs_bindgen_4e32721222f4df9f ::
+     Const_funptr6_Aux
+  -> IO (BG.FunPtr Const_funptr6_Aux)
+hs_bindgen_4e32721222f4df9f =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_4e32721222f4df9f_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr6_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr6_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_45251216b04aa8b5_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr6_Aux@
+hs_bindgen_45251216b04aa8b5 ::
+     BG.FunPtr Const_funptr6_Aux
+  -> Const_funptr6_Aux
+hs_bindgen_45251216b04aa8b5 =
+  \funPtr0 ->
+    Const_funptr6_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_45251216b04aa8b5_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr6_Aux where
+
+  toFunPtr = hs_bindgen_4e32721222f4df9f
+
+instance BG.FromFunPtr Const_funptr6_Aux where
+
+  fromFunPtr = hs_bindgen_45251216b04aa8b5
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr6_Aux" Const_funptr6_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr6_Aux {unwrapConst_funptr6_Aux = y1}
+      , BG.getField @"unwrapConst_funptr6_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr6_Aux" (BG.Ptr Const_funptr6_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr6_Aux")
+
+instance HasCField.HasCField Const_funptr6_Aux "unwrapConst_funptr6_Aux" where
+
+  type CFieldType Const_funptr6_Aux "unwrapConst_funptr6_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6 = Const_funptr6
+  { unwrapConst_funptr6 :: BG.FunPtr Const_funptr6_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr6_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr6" Const_funptr6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr6 {unwrapConst_funptr6 = y1}
+      , BG.getField @"unwrapConst_funptr6" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr6_Aux
+         ) => BG.HasField "unwrapConst_funptr6" (BG.Ptr Const_funptr6) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr6")
+
+instance HasCField.HasCField Const_funptr6 "unwrapConst_funptr6" where
+
+  type CFieldType Const_funptr6 "unwrapConst_funptr6" =
+    BG.FunPtr Const_funptr6_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr7'
+
+    __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7_Aux = Const_funptr7_Aux
+  { unwrapConst_funptr7_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr7_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_0d04fc96ffb9de06_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr7_Aux@
+hs_bindgen_0d04fc96ffb9de06 ::
+     Const_funptr7_Aux
+  -> IO (BG.FunPtr Const_funptr7_Aux)
+hs_bindgen_0d04fc96ffb9de06 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_0d04fc96ffb9de06_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr7_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr7_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_42fbcebf75a973ba_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr7_Aux@
+hs_bindgen_42fbcebf75a973ba ::
+     BG.FunPtr Const_funptr7_Aux
+  -> Const_funptr7_Aux
+hs_bindgen_42fbcebf75a973ba =
+  \funPtr0 ->
+    Const_funptr7_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_42fbcebf75a973ba_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr7_Aux where
+
+  toFunPtr = hs_bindgen_0d04fc96ffb9de06
+
+instance BG.FromFunPtr Const_funptr7_Aux where
+
+  fromFunPtr = hs_bindgen_42fbcebf75a973ba
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr7_Aux" Const_funptr7_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr7_Aux {unwrapConst_funptr7_Aux = y1}
+      , BG.getField @"unwrapConst_funptr7_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))
+         ) => BG.HasField "unwrapConst_funptr7_Aux" (BG.Ptr Const_funptr7_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr7_Aux")
+
+instance HasCField.HasCField Const_funptr7_Aux "unwrapConst_funptr7_Aux" where
+
+  type CFieldType Const_funptr7_Aux "unwrapConst_funptr7_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7 = Const_funptr7
+  { unwrapConst_funptr7 :: BG.FunPtr Const_funptr7_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr7_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr7" Const_funptr7 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr7 {unwrapConst_funptr7 = y1}
+      , BG.getField @"unwrapConst_funptr7" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr7_Aux
+         ) => BG.HasField "unwrapConst_funptr7" (BG.Ptr Const_funptr7) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr7")
+
+instance HasCField.HasCField Const_funptr7 "unwrapConst_funptr7" where
+
+  type CFieldType Const_funptr7 "unwrapConst_funptr7" =
+    BG.FunPtr Const_funptr7_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Macro-defined types
+
+    __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse.h 278:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bOOL :: Macro.Raw String
+bOOL = Macro.objectLike "BOOL" ["_Bool"]
+
+{-| __C declaration:__ @macro INT@
+
+    __defined at:__ @macros\/reparse.h 279:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+iNT :: Macro.Raw String
+iNT = Macro.objectLike "INT" ["int"]
+
+{-| __C declaration:__ @macro INTP@
+
+    __defined at:__ @macros\/reparse.h 280:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+iNTP :: Macro.Raw String
+iNTP = Macro.objectLike "INTP" ["int", "*"]
+
+{-| __C declaration:__ @macro INTCP@
+
+    __defined at:__ @macros\/reparse.h 281:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+iNTCP :: Macro.Raw String
+iNTCP =
+  Macro.objectLike "INTCP" ["const", "int", "*", "const"]
diff --git a/test-artefacts/fixtures/macros/reparse.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.2.raw/Example/FunPtr.hs
@@ -0,0 +1,3339 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.args_char1
+    , Example.FunPtr.args_char2
+    , Example.FunPtr.args_char3
+    , Example.FunPtr.args_short1
+    , Example.FunPtr.args_short2
+    , Example.FunPtr.args_short3
+    , Example.FunPtr.args_int1
+    , Example.FunPtr.args_int2
+    , Example.FunPtr.args_int3
+    , Example.FunPtr.args_long1
+    , Example.FunPtr.args_long2
+    , Example.FunPtr.args_long3
+    , Example.FunPtr.args_float
+    , Example.FunPtr.args_double
+    , Example.FunPtr.args_bool1
+    , Example.FunPtr.args_struct
+    , Example.FunPtr.args_union
+    , Example.FunPtr.args_enum
+    , Example.FunPtr.args_pointer1
+    , Example.FunPtr.args_pointer2
+    , Example.FunPtr.args_pointer3
+    , Example.FunPtr.ret_A
+    , Example.FunPtr.ret_char1
+    , Example.FunPtr.ret_char2
+    , Example.FunPtr.ret_char3
+    , Example.FunPtr.ret_short1
+    , Example.FunPtr.ret_short2
+    , Example.FunPtr.ret_short3
+    , Example.FunPtr.ret_int1
+    , Example.FunPtr.ret_int2
+    , Example.FunPtr.ret_int3
+    , Example.FunPtr.ret_long1
+    , Example.FunPtr.ret_long2
+    , Example.FunPtr.ret_long3
+    , Example.FunPtr.ret_float
+    , Example.FunPtr.ret_double
+    , Example.FunPtr.ret_bool1
+    , Example.FunPtr.ret_struct
+    , Example.FunPtr.ret_union
+    , Example.FunPtr.ret_enum
+    , Example.FunPtr.ret_pointer1
+    , Example.FunPtr.ret_pointer2
+    , Example.FunPtr.ret_pointer3
+    , Example.FunPtr.body1
+    , Example.FunPtr.body2
+    , Example.FunPtr.args_complex_float
+    , Example.FunPtr.args_complex_double
+    , Example.FunPtr.ret_complex_float
+    , Example.FunPtr.ret_complex_double
+    , Example.FunPtr.bespoke_args1
+    , Example.FunPtr.bespoke_args2
+    , Example.FunPtr.bespoke_ret1
+    , Example.FunPtr.bespoke_ret2
+    , Example.FunPtr.arr_args1
+    , Example.FunPtr.arr_args2
+    , Example.FunPtr.arr_args3
+    , Example.FunPtr.arr_args4
+    , Example.FunPtr.funptr_args1
+    , Example.FunPtr.funptr_args2
+    , Example.FunPtr.funptr_args3
+    , Example.FunPtr.funptr_args4
+    , Example.FunPtr.funptr_args5
+    , Example.FunPtr.comments1
+    , Example.FunPtr.const_prim_before1
+    , Example.FunPtr.const_prim_before2
+    , Example.FunPtr.const_prim_before3
+    , Example.FunPtr.const_prim_after1
+    , Example.FunPtr.const_prim_after2
+    , Example.FunPtr.const_prim_after3
+    , Example.FunPtr.const_withoutSign_before1
+    , Example.FunPtr.const_withoutSign_before2
+    , Example.FunPtr.const_withoutSign_before3
+    , Example.FunPtr.const_withoutSign_before4
+    , Example.FunPtr.const_withoutSign_before5
+    , Example.FunPtr.const_withoutSign_before6
+    , Example.FunPtr.const_withoutSign_before7
+    , Example.FunPtr.const_withoutSign_before8
+    , Example.FunPtr.const_withoutSign_after1
+    , Example.FunPtr.const_withoutSign_after2
+    , Example.FunPtr.const_withoutSign_after3
+    , Example.FunPtr.const_withoutSign_after4
+    , Example.FunPtr.const_withoutSign_after5
+    , Example.FunPtr.const_withoutSign_after6
+    , Example.FunPtr.const_withoutSign_after7
+    , Example.FunPtr.const_withoutSign_after8
+    , Example.FunPtr.const_pointers_args1
+    , Example.FunPtr.const_pointers_args2
+    , Example.FunPtr.const_pointers_args3
+    , Example.FunPtr.const_pointers_args4
+    , Example.FunPtr.const_pointers_args5
+    , Example.FunPtr.const_pointers_ret1
+    , Example.FunPtr.const_pointers_ret2
+    , Example.FunPtr.const_pointers_ret3
+    , Example.FunPtr.const_pointers_ret4
+    , Example.FunPtr.const_pointers_ret5
+    , Example.FunPtr.const_array_elem1
+    , Example.FunPtr.const_array_elem2
+    , Example.FunPtr.const_array_elem3
+    , Example.FunPtr.noParams1
+    , Example.FunPtr.noParams2
+    , Example.FunPtr.noParams3
+    , Example.FunPtr.funptr_ret1
+    , Example.FunPtr.funptr_ret2
+    , Example.FunPtr.funptr_ret3
+    , Example.FunPtr.funptr_ret4
+    , Example.FunPtr.funptr_ret5
+    , Example.FunPtr.funptr_ret6
+    , Example.FunPtr.funptr_ret7
+    , Example.FunPtr.funptr_ret8
+    , Example.FunPtr.funptr_ret9
+    , Example.FunPtr.funptr_ret10
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "/* test_macrosreparse_2_raw_Example_get_args_char1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_30055b4cfdb7a3e2 (void)) ("
+  , "  signed int arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &args_char1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_char2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_44f283f141f81fc4 (void)) ("
+  , "  signed int arg1,"
+  , "  signed char arg2"
+  , ")"
+  , "{"
+  , "  return &args_char2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_char3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_27b5bf56bbc8f080 (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned char arg2"
+  , ")"
+  , "{"
+  , "  return &args_char3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_short1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_985bed578f09aef8 (void)) ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  return &args_short1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_short2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_4213a6df8d0c03f1 (void)) ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  return &args_short2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_short3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_82e313aaa763196f (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned short arg2"
+  , ")"
+  , "{"
+  , "  return &args_short3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_int1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_605e1f38f823a881 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &args_int1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_int2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3b8afc742e92814e (void)) ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &args_int2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_int3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_bf10dc64323b0995 (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned int arg2"
+  , ")"
+  , "{"
+  , "  return &args_int3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_long1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dae65ec08c1d514e (void)) ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  return &args_long1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_long2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e83db9fe9e4243df (void)) ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  return &args_long2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_long3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_42d83281e20c0186 (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned long arg2"
+  , ")"
+  , "{"
+  , "  return &args_long3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_float */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3b0ba5af6ce01aed (void)) ("
+  , "  signed int arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  return &args_float;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_double */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d14a589fdc8b9407 (void)) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &args_double;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_bool1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a829f5810873021d (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  return &args_bool1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_struct */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_243cc2e9d0181102 (void)) ("
+  , "  signed int arg1,"
+  , "  struct some_struct arg2"
+  , ")"
+  , "{"
+  , "  return &args_struct;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_union */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b3e0ceada39fdc01 (void)) ("
+  , "  signed int arg1,"
+  , "  union some_union arg2"
+  , ")"
+  , "{"
+  , "  return &args_union;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_enum */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d11159ff99847117 (void)) ("
+  , "  signed int arg1,"
+  , "  enum some_enum arg2"
+  , ")"
+  , "{"
+  , "  return &args_enum;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_pointer1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f3c28cbcc1bc9d17 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  return &args_pointer1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_pointer2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_190bfc6a0f4bff4f (void)) ("
+  , "  signed int arg1,"
+  , "  signed int **arg2"
+  , ")"
+  , "{"
+  , "  return &args_pointer2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_pointer3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_26b1c20d174e45d5 (void)) ("
+  , "  signed int arg1,"
+  , "  void *arg2"
+  , ")"
+  , "{"
+  , "  return &args_pointer3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_A */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_8760cbd218bc55d1 (void)) (void)"
+  , "{"
+  , "  return &ret_A;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_char1 */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_e910062cffeff2d2 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_char1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_char2 */"
+  , "__attribute__ ((const))"
+  , "signed char (*hs_bindgen_d9218f2ac4ee5a50 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_char2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_char3 */"
+  , "__attribute__ ((const))"
+  , "unsigned char (*hs_bindgen_7a2d6ef06c7567a1 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_char3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_short1 */"
+  , "__attribute__ ((const))"
+  , "signed short (*hs_bindgen_c715ac00f4ca7f36 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_short1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_short2 */"
+  , "__attribute__ ((const))"
+  , "signed short (*hs_bindgen_880f34b16d908c1f (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_short2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_short3 */"
+  , "__attribute__ ((const))"
+  , "unsigned short (*hs_bindgen_ea8c8e8164273c1a (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_short3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_int1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_97a22a914dd2414c (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_int1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_int2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_77a2b7921cb7566a (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_int2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_int3 */"
+  , "__attribute__ ((const))"
+  , "unsigned int (*hs_bindgen_0dc8eed9c02e16ff (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_int3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_long1 */"
+  , "__attribute__ ((const))"
+  , "signed long (*hs_bindgen_8a42512fc931fa53 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_long1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_long2 */"
+  , "__attribute__ ((const))"
+  , "signed long (*hs_bindgen_8293ce652f4875b7 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_long2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_long3 */"
+  , "__attribute__ ((const))"
+  , "unsigned long (*hs_bindgen_1ca2d3b54e331b1f (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_long3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_float */"
+  , "__attribute__ ((const))"
+  , "float (*hs_bindgen_5362002da5a787ba (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_float;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_double */"
+  , "__attribute__ ((const))"
+  , "double (*hs_bindgen_0ae8c6485107bf6f (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_double;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_bool1 */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_04d8f1fc8df996ba (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_bool1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_struct */"
+  , "__attribute__ ((const))"
+  , "struct some_struct (*hs_bindgen_b7cd9769c7dac7b8 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_struct;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_union */"
+  , "__attribute__ ((const))"
+  , "union some_union (*hs_bindgen_b4afde7383e5aff4 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_union;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_enum */"
+  , "__attribute__ ((const))"
+  , "enum some_enum (*hs_bindgen_239f0b420c073c18 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_enum;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_pointer1 */"
+  , "__attribute__ ((const))"
+  , "signed int *(*hs_bindgen_56eab0f8d0bdf79f (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_pointer1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_pointer2 */"
+  , "__attribute__ ((const))"
+  , "signed int **(*hs_bindgen_4c952a3d40721870 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_pointer2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_pointer3 */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_ccb0b4753d3e2490 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_pointer3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_body1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_442c91e88aec2368 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &body1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_body2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_cfbec40e47da01c3 (void)) (void)"
+  , "{"
+  , "  return &body2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_complex_float */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_4319227a8aaa0b24 (void)) ("
+  , "  signed int arg1,"
+  , "  float _Complex arg2"
+  , ")"
+  , "{"
+  , "  return &args_complex_float;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_args_complex_double */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9620841c151e1094 (void)) ("
+  , "  signed int arg1,"
+  , "  double _Complex arg2"
+  , ")"
+  , "{"
+  , "  return &args_complex_double;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_complex_float */"
+  , "__attribute__ ((const))"
+  , "float _Complex (*hs_bindgen_aa2302691b1dc578 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_complex_float;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_ret_complex_double */"
+  , "__attribute__ ((const))"
+  , "double _Complex (*hs_bindgen_27f2ccb0e11ce3d4 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &ret_complex_double;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_bespoke_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_5f39596c5788b2cf (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  return &bespoke_args1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_bespoke_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6fc3008f0e66bd81 (void)) ("
+  , "  signed int arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &bespoke_args2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_bespoke_ret1 */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_02e119349dfc0dc6 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bespoke_ret1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_bespoke_ret2 */"
+  , "__attribute__ ((const))"
+  , "size_t (*hs_bindgen_447b3d2bccfb7ae8 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bespoke_ret2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_arr_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_869038d8098a2bf2 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_arr_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d97856ae41779071 (void)) ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_arr_args3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e5fcdc276e072021 (void)) ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_arr_args4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_5960a1a097c40b0b (void)) ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args4;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6e1c21a20bf17727 (void)) ("
+  , "  signed int arg1,"
+  , "  void (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  return &funptr_args1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_316b1d39ef1c99c8 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  return &funptr_args2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_args3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3b587acc49334022 (void)) ("
+  , "  signed int arg1,"
+  , "  void (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &funptr_args3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_args4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_880f8ecb89c20f54 (void)) ("
+  , "  signed int arg1,"
+  , "  char (*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &funptr_args4;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_args5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_25220e78ceba78f8 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int *(*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &funptr_args5;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_comments1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6cef08508aed5305 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &comments1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_prim_before1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_71a50f57cd1216e6 (void)) ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_before1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_prim_before2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_5233d49c08278554 (void)) ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_before2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_prim_before3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b47263d563e229b2 (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_before3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_prim_after1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9b538efe2347a74e (void)) ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_after1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_prim_after2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e9bd30449260d07b (void)) ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_after2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_prim_after3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f1e92cd065630ccb (void)) ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_after3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_before1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_aea63f55c25fa26d (void)) ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_before2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1a34eb11a6ccfd86 (void)) ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_before3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d9af8e3a8991a2e4 (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_before4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_558f393b1eddf40d (void)) ("
+  , "  signed int arg1,"
+  , "  struct some_struct const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before4;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_before5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e62c93c0973b2781 (void)) ("
+  , "  signed int arg1,"
+  , "  union some_union const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before5;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_before6 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e56acb4f339a362d (void)) ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before6;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_before7 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c298f88f131c980b (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before7;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_before8 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_38d5cf2b5d94860c (void)) ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before8;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_after1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_362151a5ba0ce905 (void)) ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_after2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_071d6b5b46afca86 (void)) ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_after3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cb70cd180a753e3a (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_after4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_17e67974fc77dde6 (void)) ("
+  , "  signed int arg1,"
+  , "  struct some_struct const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after4;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_after5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_aea1ac49e3a717ae (void)) ("
+  , "  signed int arg1,"
+  , "  union some_union const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after5;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_after6 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_89ad81e6dc3a6ed4 (void)) ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after6;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_after7 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_29b119a94317aae6 (void)) ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after7;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_withoutSign_after8 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_be8db07cc695795d (void)) ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after8;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3f4562f74152c205 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_87278ccb01e7fee0 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_args3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1e25b241655c3ebb (void)) ("
+  , "  signed int arg1,"
+  , "  signed int *const arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_args4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fa94aed37836859b (void)) ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args4;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_args5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_800407f1e67deddb (void)) ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args5;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_ret1 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*hs_bindgen_91e3fb45ca972f9d (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_ret2 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*hs_bindgen_ce269be70accca82 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_ret3 */"
+  , "__attribute__ ((const))"
+  , "signed int *const (*hs_bindgen_f0f2ae46270c9785 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_ret4 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*hs_bindgen_4ecbc6cf48fbe0c3 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret4;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_pointers_ret5 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*hs_bindgen_c0b16cd44f63f52f (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret5;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_array_elem1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_db9eb973118a6fbf (void)) ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  return &const_array_elem1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_array_elem2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9288cd4171172005 (void)) ("
+  , "  signed int const **arg1"
+  , ")"
+  , "{"
+  , "  return &const_array_elem2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const_array_elem3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c20403bc692b1bde (void)) ("
+  , "  signed int *const *arg1"
+  , ")"
+  , "{"
+  , "  return &const_array_elem3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_noParams1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_5ca24e7f6ac8cff0 (void)) (void)"
+  , "{"
+  , "  return &noParams1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_noParams2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_6f664f6fdcbced27 (void)) (void)"
+  , "{"
+  , "  return &noParams2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_noParams3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1067f730bd5b4c43 (void)) ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  return &noParams3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret1 */"
+  , "__attribute__ ((const))"
+  , "void (*(*hs_bindgen_6b5258a8560bc11c (void)) ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return &funptr_ret1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_723b02be7cb23263 (void)) ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return &funptr_ret2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret3 */"
+  , "__attribute__ ((const))"
+  , "void (*(*hs_bindgen_7c4d8fc844c6f97b (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &funptr_ret3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret4 */"
+  , "__attribute__ ((const))"
+  , "char (*(*hs_bindgen_25b578cce360cf12 (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret4;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret5 */"
+  , "__attribute__ ((const))"
+  , "signed int *(*(*hs_bindgen_5e58691a68a915de (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret5;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret6 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*(*hs_bindgen_0c36a271f93a9dff (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret6;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret7 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*(*hs_bindgen_67439554fe1e797d (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret7;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret8 */"
+  , "__attribute__ ((const))"
+  , "signed int *const (*(*hs_bindgen_870a61b2b66eecf3 (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret8;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret9 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*(*hs_bindgen_e7920c47095333a3 (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret9;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_funptr_ret10 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*(*hs_bindgen_aa1eab9b222fa4b8 (void)) ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret10;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char1@
+foreign import ccall unsafe "hs_bindgen_30055b4cfdb7a3e2" hs_bindgen_30055b4cfdb7a3e2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char1@
+hs_bindgen_30055b4cfdb7a3e2 :: IO (BG.FunPtr (BG.CInt -> BG.CChar -> IO ()))
+hs_bindgen_30055b4cfdb7a3e2 =
+  fmap BG.fromFFIType hs_bindgen_30055b4cfdb7a3e2_base
+
+{-# NOINLINE args_char1 #-}
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1 :: BG.FunPtr (BG.CInt -> BG.CChar -> IO ())
+args_char1 =
+  BG.unsafePerformIO hs_bindgen_30055b4cfdb7a3e2
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char2@
+foreign import ccall unsafe "hs_bindgen_44f283f141f81fc4" hs_bindgen_44f283f141f81fc4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char2@
+hs_bindgen_44f283f141f81fc4 :: IO (BG.FunPtr (BG.CInt -> BG.CSChar -> IO ()))
+hs_bindgen_44f283f141f81fc4 =
+  fmap BG.fromFFIType hs_bindgen_44f283f141f81fc4_base
+
+{-# NOINLINE args_char2 #-}
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2 :: BG.FunPtr (BG.CInt -> BG.CSChar -> IO ())
+args_char2 =
+  BG.unsafePerformIO hs_bindgen_44f283f141f81fc4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char3@
+foreign import ccall unsafe "hs_bindgen_27b5bf56bbc8f080" hs_bindgen_27b5bf56bbc8f080_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char3@
+hs_bindgen_27b5bf56bbc8f080 :: IO (BG.FunPtr (BG.CInt -> BG.CUChar -> IO ()))
+hs_bindgen_27b5bf56bbc8f080 =
+  fmap BG.fromFFIType hs_bindgen_27b5bf56bbc8f080_base
+
+{-# NOINLINE args_char3 #-}
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3 :: BG.FunPtr (BG.CInt -> BG.CUChar -> IO ())
+args_char3 =
+  BG.unsafePerformIO hs_bindgen_27b5bf56bbc8f080
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short1@
+foreign import ccall unsafe "hs_bindgen_985bed578f09aef8" hs_bindgen_985bed578f09aef8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short1@
+hs_bindgen_985bed578f09aef8 :: IO (BG.FunPtr (BG.CInt -> BG.CShort -> IO ()))
+hs_bindgen_985bed578f09aef8 =
+  fmap BG.fromFFIType hs_bindgen_985bed578f09aef8_base
+
+{-# NOINLINE args_short1 #-}
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1 :: BG.FunPtr (BG.CInt -> BG.CShort -> IO ())
+args_short1 =
+  BG.unsafePerformIO hs_bindgen_985bed578f09aef8
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short2@
+foreign import ccall unsafe "hs_bindgen_4213a6df8d0c03f1" hs_bindgen_4213a6df8d0c03f1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short2@
+hs_bindgen_4213a6df8d0c03f1 :: IO (BG.FunPtr (BG.CInt -> BG.CShort -> IO ()))
+hs_bindgen_4213a6df8d0c03f1 =
+  fmap BG.fromFFIType hs_bindgen_4213a6df8d0c03f1_base
+
+{-# NOINLINE args_short2 #-}
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2 :: BG.FunPtr (BG.CInt -> BG.CShort -> IO ())
+args_short2 =
+  BG.unsafePerformIO hs_bindgen_4213a6df8d0c03f1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short3@
+foreign import ccall unsafe "hs_bindgen_82e313aaa763196f" hs_bindgen_82e313aaa763196f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short3@
+hs_bindgen_82e313aaa763196f :: IO (BG.FunPtr (BG.CInt -> BG.CUShort -> IO ()))
+hs_bindgen_82e313aaa763196f =
+  fmap BG.fromFFIType hs_bindgen_82e313aaa763196f_base
+
+{-# NOINLINE args_short3 #-}
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3 :: BG.FunPtr (BG.CInt -> BG.CUShort -> IO ())
+args_short3 =
+  BG.unsafePerformIO hs_bindgen_82e313aaa763196f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int1@
+foreign import ccall unsafe "hs_bindgen_605e1f38f823a881" hs_bindgen_605e1f38f823a881_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int1@
+hs_bindgen_605e1f38f823a881 :: IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO ()))
+hs_bindgen_605e1f38f823a881 =
+  fmap BG.fromFFIType hs_bindgen_605e1f38f823a881_base
+
+{-# NOINLINE args_int1 #-}
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1 :: BG.FunPtr (BG.CInt -> BG.CInt -> IO ())
+args_int1 =
+  BG.unsafePerformIO hs_bindgen_605e1f38f823a881
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int2@
+foreign import ccall unsafe "hs_bindgen_3b8afc742e92814e" hs_bindgen_3b8afc742e92814e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int2@
+hs_bindgen_3b8afc742e92814e :: IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO ()))
+hs_bindgen_3b8afc742e92814e =
+  fmap BG.fromFFIType hs_bindgen_3b8afc742e92814e_base
+
+{-# NOINLINE args_int2 #-}
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2 :: BG.FunPtr (BG.CInt -> BG.CInt -> IO ())
+args_int2 =
+  BG.unsafePerformIO hs_bindgen_3b8afc742e92814e
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int3@
+foreign import ccall unsafe "hs_bindgen_bf10dc64323b0995" hs_bindgen_bf10dc64323b0995_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int3@
+hs_bindgen_bf10dc64323b0995 :: IO (BG.FunPtr (BG.CInt -> BG.CUInt -> IO ()))
+hs_bindgen_bf10dc64323b0995 =
+  fmap BG.fromFFIType hs_bindgen_bf10dc64323b0995_base
+
+{-# NOINLINE args_int3 #-}
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3 :: BG.FunPtr (BG.CInt -> BG.CUInt -> IO ())
+args_int3 =
+  BG.unsafePerformIO hs_bindgen_bf10dc64323b0995
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long1@
+foreign import ccall unsafe "hs_bindgen_dae65ec08c1d514e" hs_bindgen_dae65ec08c1d514e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long1@
+hs_bindgen_dae65ec08c1d514e :: IO (BG.FunPtr (BG.CInt -> BG.CLong -> IO ()))
+hs_bindgen_dae65ec08c1d514e =
+  fmap BG.fromFFIType hs_bindgen_dae65ec08c1d514e_base
+
+{-# NOINLINE args_long1 #-}
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1 :: BG.FunPtr (BG.CInt -> BG.CLong -> IO ())
+args_long1 =
+  BG.unsafePerformIO hs_bindgen_dae65ec08c1d514e
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long2@
+foreign import ccall unsafe "hs_bindgen_e83db9fe9e4243df" hs_bindgen_e83db9fe9e4243df_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long2@
+hs_bindgen_e83db9fe9e4243df :: IO (BG.FunPtr (BG.CInt -> BG.CLong -> IO ()))
+hs_bindgen_e83db9fe9e4243df =
+  fmap BG.fromFFIType hs_bindgen_e83db9fe9e4243df_base
+
+{-# NOINLINE args_long2 #-}
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2 :: BG.FunPtr (BG.CInt -> BG.CLong -> IO ())
+args_long2 =
+  BG.unsafePerformIO hs_bindgen_e83db9fe9e4243df
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long3@
+foreign import ccall unsafe "hs_bindgen_42d83281e20c0186" hs_bindgen_42d83281e20c0186_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long3@
+hs_bindgen_42d83281e20c0186 :: IO (BG.FunPtr (BG.CInt -> BG.CULong -> IO ()))
+hs_bindgen_42d83281e20c0186 =
+  fmap BG.fromFFIType hs_bindgen_42d83281e20c0186_base
+
+{-# NOINLINE args_long3 #-}
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3 :: BG.FunPtr (BG.CInt -> BG.CULong -> IO ())
+args_long3 =
+  BG.unsafePerformIO hs_bindgen_42d83281e20c0186
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_float@
+foreign import ccall unsafe "hs_bindgen_3b0ba5af6ce01aed" hs_bindgen_3b0ba5af6ce01aed_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_float@
+hs_bindgen_3b0ba5af6ce01aed :: IO (BG.FunPtr (BG.CInt -> BG.CFloat -> IO ()))
+hs_bindgen_3b0ba5af6ce01aed =
+  fmap BG.fromFFIType hs_bindgen_3b0ba5af6ce01aed_base
+
+{-# NOINLINE args_float #-}
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float :: BG.FunPtr (BG.CInt -> BG.CFloat -> IO ())
+args_float =
+  BG.unsafePerformIO hs_bindgen_3b0ba5af6ce01aed
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_double@
+foreign import ccall unsafe "hs_bindgen_d14a589fdc8b9407" hs_bindgen_d14a589fdc8b9407_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_double@
+hs_bindgen_d14a589fdc8b9407 :: IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO ()))
+hs_bindgen_d14a589fdc8b9407 =
+  fmap BG.fromFFIType hs_bindgen_d14a589fdc8b9407_base
+
+{-# NOINLINE args_double #-}
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double :: BG.FunPtr (BG.CInt -> BG.CDouble -> IO ())
+args_double =
+  BG.unsafePerformIO hs_bindgen_d14a589fdc8b9407
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_bool1@
+foreign import ccall unsafe "hs_bindgen_a829f5810873021d" hs_bindgen_a829f5810873021d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_bool1@
+hs_bindgen_a829f5810873021d :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_a829f5810873021d =
+  fmap BG.fromFFIType hs_bindgen_a829f5810873021d_base
+
+{-# NOINLINE args_bool1 #-}
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+args_bool1 =
+  BG.unsafePerformIO hs_bindgen_a829f5810873021d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_struct@
+foreign import ccall unsafe "hs_bindgen_243cc2e9d0181102" hs_bindgen_243cc2e9d0181102_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_struct@
+hs_bindgen_243cc2e9d0181102 :: IO (BG.FunPtr (BG.CInt -> Some_struct -> IO ()))
+hs_bindgen_243cc2e9d0181102 =
+  fmap BG.fromFFIType hs_bindgen_243cc2e9d0181102_base
+
+{-# NOINLINE args_struct #-}
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct :: BG.FunPtr (BG.CInt -> Some_struct -> IO ())
+args_struct =
+  BG.unsafePerformIO hs_bindgen_243cc2e9d0181102
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_union@
+foreign import ccall unsafe "hs_bindgen_b3e0ceada39fdc01" hs_bindgen_b3e0ceada39fdc01_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_union@
+hs_bindgen_b3e0ceada39fdc01 :: IO (BG.FunPtr (BG.CInt -> Some_union -> IO ()))
+hs_bindgen_b3e0ceada39fdc01 =
+  fmap BG.fromFFIType hs_bindgen_b3e0ceada39fdc01_base
+
+{-# NOINLINE args_union #-}
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union :: BG.FunPtr (BG.CInt -> Some_union -> IO ())
+args_union =
+  BG.unsafePerformIO hs_bindgen_b3e0ceada39fdc01
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_enum@
+foreign import ccall unsafe "hs_bindgen_d11159ff99847117" hs_bindgen_d11159ff99847117_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_enum@
+hs_bindgen_d11159ff99847117 :: IO (BG.FunPtr (BG.CInt -> Some_enum -> IO ()))
+hs_bindgen_d11159ff99847117 =
+  fmap BG.fromFFIType hs_bindgen_d11159ff99847117_base
+
+{-# NOINLINE args_enum #-}
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum :: BG.FunPtr (BG.CInt -> Some_enum -> IO ())
+args_enum =
+  BG.unsafePerformIO hs_bindgen_d11159ff99847117
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_f3c28cbcc1bc9d17" hs_bindgen_f3c28cbcc1bc9d17_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer1@
+hs_bindgen_f3c28cbcc1bc9d17 :: IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> IO ()))
+hs_bindgen_f3c28cbcc1bc9d17 =
+  fmap BG.fromFFIType hs_bindgen_f3c28cbcc1bc9d17_base
+
+{-# NOINLINE args_pointer1 #-}
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1 :: BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> IO ())
+args_pointer1 =
+  BG.unsafePerformIO hs_bindgen_f3c28cbcc1bc9d17
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_190bfc6a0f4bff4f" hs_bindgen_190bfc6a0f4bff4f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer2@
+hs_bindgen_190bfc6a0f4bff4f :: IO (BG.FunPtr (BG.CInt -> BG.Ptr (BG.Ptr BG.CInt) -> IO ()))
+hs_bindgen_190bfc6a0f4bff4f =
+  fmap BG.fromFFIType hs_bindgen_190bfc6a0f4bff4f_base
+
+{-# NOINLINE args_pointer2 #-}
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2 :: BG.FunPtr (BG.CInt -> BG.Ptr (BG.Ptr BG.CInt) -> IO ())
+args_pointer2 =
+  BG.unsafePerformIO hs_bindgen_190bfc6a0f4bff4f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_26b1c20d174e45d5" hs_bindgen_26b1c20d174e45d5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer3@
+hs_bindgen_26b1c20d174e45d5 :: IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> IO ()))
+hs_bindgen_26b1c20d174e45d5 =
+  fmap BG.fromFFIType hs_bindgen_26b1c20d174e45d5_base
+
+{-# NOINLINE args_pointer3 #-}
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3 :: BG.FunPtr (BG.CInt -> BG.Ptr BG.Void -> IO ())
+args_pointer3 =
+  BG.unsafePerformIO hs_bindgen_26b1c20d174e45d5
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_A@
+foreign import ccall unsafe "hs_bindgen_8760cbd218bc55d1" hs_bindgen_8760cbd218bc55d1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_A@
+hs_bindgen_8760cbd218bc55d1 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_8760cbd218bc55d1 =
+  fmap BG.fromFFIType hs_bindgen_8760cbd218bc55d1_base
+
+{-# NOINLINE ret_A #-}
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A :: BG.FunPtr (IO BG.CInt)
+ret_A =
+  BG.unsafePerformIO hs_bindgen_8760cbd218bc55d1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char1@
+foreign import ccall unsafe "hs_bindgen_e910062cffeff2d2" hs_bindgen_e910062cffeff2d2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char1@
+hs_bindgen_e910062cffeff2d2 :: IO (BG.FunPtr (BG.CInt -> IO BG.CChar))
+hs_bindgen_e910062cffeff2d2 =
+  fmap BG.fromFFIType hs_bindgen_e910062cffeff2d2_base
+
+{-# NOINLINE ret_char1 #-}
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1 :: BG.FunPtr (BG.CInt -> IO BG.CChar)
+ret_char1 =
+  BG.unsafePerformIO hs_bindgen_e910062cffeff2d2
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char2@
+foreign import ccall unsafe "hs_bindgen_d9218f2ac4ee5a50" hs_bindgen_d9218f2ac4ee5a50_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char2@
+hs_bindgen_d9218f2ac4ee5a50 :: IO (BG.FunPtr (BG.CInt -> IO BG.CSChar))
+hs_bindgen_d9218f2ac4ee5a50 =
+  fmap BG.fromFFIType hs_bindgen_d9218f2ac4ee5a50_base
+
+{-# NOINLINE ret_char2 #-}
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2 :: BG.FunPtr (BG.CInt -> IO BG.CSChar)
+ret_char2 =
+  BG.unsafePerformIO hs_bindgen_d9218f2ac4ee5a50
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char3@
+foreign import ccall unsafe "hs_bindgen_7a2d6ef06c7567a1" hs_bindgen_7a2d6ef06c7567a1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char3@
+hs_bindgen_7a2d6ef06c7567a1 :: IO (BG.FunPtr (BG.CInt -> IO BG.CUChar))
+hs_bindgen_7a2d6ef06c7567a1 =
+  fmap BG.fromFFIType hs_bindgen_7a2d6ef06c7567a1_base
+
+{-# NOINLINE ret_char3 #-}
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3 :: BG.FunPtr (BG.CInt -> IO BG.CUChar)
+ret_char3 =
+  BG.unsafePerformIO hs_bindgen_7a2d6ef06c7567a1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short1@
+foreign import ccall unsafe "hs_bindgen_c715ac00f4ca7f36" hs_bindgen_c715ac00f4ca7f36_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short1@
+hs_bindgen_c715ac00f4ca7f36 :: IO (BG.FunPtr (BG.CInt -> IO BG.CShort))
+hs_bindgen_c715ac00f4ca7f36 =
+  fmap BG.fromFFIType hs_bindgen_c715ac00f4ca7f36_base
+
+{-# NOINLINE ret_short1 #-}
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1 :: BG.FunPtr (BG.CInt -> IO BG.CShort)
+ret_short1 =
+  BG.unsafePerformIO hs_bindgen_c715ac00f4ca7f36
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short2@
+foreign import ccall unsafe "hs_bindgen_880f34b16d908c1f" hs_bindgen_880f34b16d908c1f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short2@
+hs_bindgen_880f34b16d908c1f :: IO (BG.FunPtr (BG.CInt -> IO BG.CShort))
+hs_bindgen_880f34b16d908c1f =
+  fmap BG.fromFFIType hs_bindgen_880f34b16d908c1f_base
+
+{-# NOINLINE ret_short2 #-}
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2 :: BG.FunPtr (BG.CInt -> IO BG.CShort)
+ret_short2 =
+  BG.unsafePerformIO hs_bindgen_880f34b16d908c1f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short3@
+foreign import ccall unsafe "hs_bindgen_ea8c8e8164273c1a" hs_bindgen_ea8c8e8164273c1a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short3@
+hs_bindgen_ea8c8e8164273c1a :: IO (BG.FunPtr (BG.CInt -> IO BG.CUShort))
+hs_bindgen_ea8c8e8164273c1a =
+  fmap BG.fromFFIType hs_bindgen_ea8c8e8164273c1a_base
+
+{-# NOINLINE ret_short3 #-}
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3 :: BG.FunPtr (BG.CInt -> IO BG.CUShort)
+ret_short3 =
+  BG.unsafePerformIO hs_bindgen_ea8c8e8164273c1a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int1@
+foreign import ccall unsafe "hs_bindgen_97a22a914dd2414c" hs_bindgen_97a22a914dd2414c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int1@
+hs_bindgen_97a22a914dd2414c :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_97a22a914dd2414c =
+  fmap BG.fromFFIType hs_bindgen_97a22a914dd2414c_base
+
+{-# NOINLINE ret_int1 #-}
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+ret_int1 =
+  BG.unsafePerformIO hs_bindgen_97a22a914dd2414c
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int2@
+foreign import ccall unsafe "hs_bindgen_77a2b7921cb7566a" hs_bindgen_77a2b7921cb7566a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int2@
+hs_bindgen_77a2b7921cb7566a :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_77a2b7921cb7566a =
+  fmap BG.fromFFIType hs_bindgen_77a2b7921cb7566a_base
+
+{-# NOINLINE ret_int2 #-}
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+ret_int2 =
+  BG.unsafePerformIO hs_bindgen_77a2b7921cb7566a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int3@
+foreign import ccall unsafe "hs_bindgen_0dc8eed9c02e16ff" hs_bindgen_0dc8eed9c02e16ff_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int3@
+hs_bindgen_0dc8eed9c02e16ff :: IO (BG.FunPtr (BG.CInt -> IO BG.CUInt))
+hs_bindgen_0dc8eed9c02e16ff =
+  fmap BG.fromFFIType hs_bindgen_0dc8eed9c02e16ff_base
+
+{-# NOINLINE ret_int3 #-}
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3 :: BG.FunPtr (BG.CInt -> IO BG.CUInt)
+ret_int3 =
+  BG.unsafePerformIO hs_bindgen_0dc8eed9c02e16ff
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long1@
+foreign import ccall unsafe "hs_bindgen_8a42512fc931fa53" hs_bindgen_8a42512fc931fa53_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long1@
+hs_bindgen_8a42512fc931fa53 :: IO (BG.FunPtr (BG.CInt -> IO BG.CLong))
+hs_bindgen_8a42512fc931fa53 =
+  fmap BG.fromFFIType hs_bindgen_8a42512fc931fa53_base
+
+{-# NOINLINE ret_long1 #-}
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1 :: BG.FunPtr (BG.CInt -> IO BG.CLong)
+ret_long1 =
+  BG.unsafePerformIO hs_bindgen_8a42512fc931fa53
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long2@
+foreign import ccall unsafe "hs_bindgen_8293ce652f4875b7" hs_bindgen_8293ce652f4875b7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long2@
+hs_bindgen_8293ce652f4875b7 :: IO (BG.FunPtr (BG.CInt -> IO BG.CLong))
+hs_bindgen_8293ce652f4875b7 =
+  fmap BG.fromFFIType hs_bindgen_8293ce652f4875b7_base
+
+{-# NOINLINE ret_long2 #-}
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2 :: BG.FunPtr (BG.CInt -> IO BG.CLong)
+ret_long2 =
+  BG.unsafePerformIO hs_bindgen_8293ce652f4875b7
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long3@
+foreign import ccall unsafe "hs_bindgen_1ca2d3b54e331b1f" hs_bindgen_1ca2d3b54e331b1f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long3@
+hs_bindgen_1ca2d3b54e331b1f :: IO (BG.FunPtr (BG.CInt -> IO BG.CULong))
+hs_bindgen_1ca2d3b54e331b1f =
+  fmap BG.fromFFIType hs_bindgen_1ca2d3b54e331b1f_base
+
+{-# NOINLINE ret_long3 #-}
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3 :: BG.FunPtr (BG.CInt -> IO BG.CULong)
+ret_long3 =
+  BG.unsafePerformIO hs_bindgen_1ca2d3b54e331b1f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_float@
+foreign import ccall unsafe "hs_bindgen_5362002da5a787ba" hs_bindgen_5362002da5a787ba_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_float@
+hs_bindgen_5362002da5a787ba :: IO (BG.FunPtr (BG.CInt -> IO BG.CFloat))
+hs_bindgen_5362002da5a787ba =
+  fmap BG.fromFFIType hs_bindgen_5362002da5a787ba_base
+
+{-# NOINLINE ret_float #-}
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float :: BG.FunPtr (BG.CInt -> IO BG.CFloat)
+ret_float =
+  BG.unsafePerformIO hs_bindgen_5362002da5a787ba
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_double@
+foreign import ccall unsafe "hs_bindgen_0ae8c6485107bf6f" hs_bindgen_0ae8c6485107bf6f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_double@
+hs_bindgen_0ae8c6485107bf6f :: IO (BG.FunPtr (BG.CInt -> IO BG.CDouble))
+hs_bindgen_0ae8c6485107bf6f =
+  fmap BG.fromFFIType hs_bindgen_0ae8c6485107bf6f_base
+
+{-# NOINLINE ret_double #-}
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double :: BG.FunPtr (BG.CInt -> IO BG.CDouble)
+ret_double =
+  BG.unsafePerformIO hs_bindgen_0ae8c6485107bf6f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_04d8f1fc8df996ba" hs_bindgen_04d8f1fc8df996ba_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_bool1@
+hs_bindgen_04d8f1fc8df996ba :: IO (BG.FunPtr (BG.CInt -> IO BG.CBool))
+hs_bindgen_04d8f1fc8df996ba =
+  fmap BG.fromFFIType hs_bindgen_04d8f1fc8df996ba_base
+
+{-# NOINLINE ret_bool1 #-}
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1 :: BG.FunPtr (BG.CInt -> IO BG.CBool)
+ret_bool1 =
+  BG.unsafePerformIO hs_bindgen_04d8f1fc8df996ba
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_struct@
+foreign import ccall unsafe "hs_bindgen_b7cd9769c7dac7b8" hs_bindgen_b7cd9769c7dac7b8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_struct@
+hs_bindgen_b7cd9769c7dac7b8 :: IO (BG.FunPtr (BG.CInt -> IO Some_struct))
+hs_bindgen_b7cd9769c7dac7b8 =
+  fmap BG.fromFFIType hs_bindgen_b7cd9769c7dac7b8_base
+
+{-# NOINLINE ret_struct #-}
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct :: BG.FunPtr (BG.CInt -> IO Some_struct)
+ret_struct =
+  BG.unsafePerformIO hs_bindgen_b7cd9769c7dac7b8
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_union@
+foreign import ccall unsafe "hs_bindgen_b4afde7383e5aff4" hs_bindgen_b4afde7383e5aff4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_union@
+hs_bindgen_b4afde7383e5aff4 :: IO (BG.FunPtr (BG.CInt -> IO Some_union))
+hs_bindgen_b4afde7383e5aff4 =
+  fmap BG.fromFFIType hs_bindgen_b4afde7383e5aff4_base
+
+{-# NOINLINE ret_union #-}
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union :: BG.FunPtr (BG.CInt -> IO Some_union)
+ret_union =
+  BG.unsafePerformIO hs_bindgen_b4afde7383e5aff4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_enum@
+foreign import ccall unsafe "hs_bindgen_239f0b420c073c18" hs_bindgen_239f0b420c073c18_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_enum@
+hs_bindgen_239f0b420c073c18 :: IO (BG.FunPtr (BG.CInt -> IO Some_enum))
+hs_bindgen_239f0b420c073c18 =
+  fmap BG.fromFFIType hs_bindgen_239f0b420c073c18_base
+
+{-# NOINLINE ret_enum #-}
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum :: BG.FunPtr (BG.CInt -> IO Some_enum)
+ret_enum =
+  BG.unsafePerformIO hs_bindgen_239f0b420c073c18
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_56eab0f8d0bdf79f" hs_bindgen_56eab0f8d0bdf79f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer1@
+hs_bindgen_56eab0f8d0bdf79f :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_56eab0f8d0bdf79f =
+  fmap BG.fromFFIType hs_bindgen_56eab0f8d0bdf79f_base
+
+{-# NOINLINE ret_pointer1 #-}
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+ret_pointer1 =
+  BG.unsafePerformIO hs_bindgen_56eab0f8d0bdf79f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_4c952a3d40721870" hs_bindgen_4c952a3d40721870_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer2@
+hs_bindgen_4c952a3d40721870 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt))))
+hs_bindgen_4c952a3d40721870 =
+  fmap BG.fromFFIType hs_bindgen_4c952a3d40721870_base
+
+{-# NOINLINE ret_pointer2 #-}
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+ret_pointer2 =
+  BG.unsafePerformIO hs_bindgen_4c952a3d40721870
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_ccb0b4753d3e2490" hs_bindgen_ccb0b4753d3e2490_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer3@
+hs_bindgen_ccb0b4753d3e2490 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void)))
+hs_bindgen_ccb0b4753d3e2490 =
+  fmap BG.fromFFIType hs_bindgen_ccb0b4753d3e2490_base
+
+{-# NOINLINE ret_pointer3 #-}
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.Void))
+ret_pointer3 =
+  BG.unsafePerformIO hs_bindgen_ccb0b4753d3e2490
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body1@
+foreign import ccall unsafe "hs_bindgen_442c91e88aec2368" hs_bindgen_442c91e88aec2368_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body1@
+hs_bindgen_442c91e88aec2368 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_442c91e88aec2368 =
+  fmap BG.fromFFIType hs_bindgen_442c91e88aec2368_base
+
+{-# NOINLINE body1 #-}
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+body1 =
+  BG.unsafePerformIO hs_bindgen_442c91e88aec2368
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body2@
+foreign import ccall unsafe "hs_bindgen_cfbec40e47da01c3" hs_bindgen_cfbec40e47da01c3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body2@
+hs_bindgen_cfbec40e47da01c3 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_cfbec40e47da01c3 =
+  fmap BG.fromFFIType hs_bindgen_cfbec40e47da01c3_base
+
+{-# NOINLINE body2 #-}
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2 :: BG.FunPtr (IO BG.CInt)
+body2 =
+  BG.unsafePerformIO hs_bindgen_cfbec40e47da01c3
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_4319227a8aaa0b24" hs_bindgen_4319227a8aaa0b24_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_float@
+hs_bindgen_4319227a8aaa0b24 :: IO (BG.FunPtr (BG.CInt -> BG.Complex BG.CFloat -> IO ()))
+hs_bindgen_4319227a8aaa0b24 =
+  fmap BG.fromFFIType hs_bindgen_4319227a8aaa0b24_base
+
+{-# NOINLINE args_complex_float #-}
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float :: BG.FunPtr (BG.CInt -> BG.Complex BG.CFloat -> IO ())
+args_complex_float =
+  BG.unsafePerformIO hs_bindgen_4319227a8aaa0b24
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_9620841c151e1094" hs_bindgen_9620841c151e1094_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_double@
+hs_bindgen_9620841c151e1094 :: IO (BG.FunPtr (BG.CInt -> BG.Complex BG.CDouble -> IO ()))
+hs_bindgen_9620841c151e1094 =
+  fmap BG.fromFFIType hs_bindgen_9620841c151e1094_base
+
+{-# NOINLINE args_complex_double #-}
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double :: BG.FunPtr (BG.CInt -> BG.Complex BG.CDouble -> IO ())
+args_complex_double =
+  BG.unsafePerformIO hs_bindgen_9620841c151e1094
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_aa2302691b1dc578" hs_bindgen_aa2302691b1dc578_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_float@
+hs_bindgen_aa2302691b1dc578 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Complex BG.CFloat)))
+hs_bindgen_aa2302691b1dc578 =
+  fmap BG.fromFFIType hs_bindgen_aa2302691b1dc578_base
+
+{-# NOINLINE ret_complex_float #-}
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float :: BG.FunPtr (BG.CInt -> IO (BG.Complex BG.CFloat))
+ret_complex_float =
+  BG.unsafePerformIO hs_bindgen_aa2302691b1dc578
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_27f2ccb0e11ce3d4" hs_bindgen_27f2ccb0e11ce3d4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_double@
+hs_bindgen_27f2ccb0e11ce3d4 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Complex BG.CDouble)))
+hs_bindgen_27f2ccb0e11ce3d4 =
+  fmap BG.fromFFIType hs_bindgen_27f2ccb0e11ce3d4_base
+
+{-# NOINLINE ret_complex_double #-}
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double :: BG.FunPtr (BG.CInt -> IO (BG.Complex BG.CDouble))
+ret_complex_double =
+  BG.unsafePerformIO hs_bindgen_27f2ccb0e11ce3d4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_5f39596c5788b2cf" hs_bindgen_5f39596c5788b2cf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args1@
+hs_bindgen_5f39596c5788b2cf :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_5f39596c5788b2cf =
+  fmap BG.fromFFIType hs_bindgen_5f39596c5788b2cf_base
+
+{-# NOINLINE bespoke_args1 #-}
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+bespoke_args1 =
+  BG.unsafePerformIO hs_bindgen_5f39596c5788b2cf
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_6fc3008f0e66bd81" hs_bindgen_6fc3008f0e66bd81_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args2@
+hs_bindgen_6fc3008f0e66bd81 :: IO (BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_6fc3008f0e66bd81 =
+  fmap BG.fromFFIType hs_bindgen_6fc3008f0e66bd81_base
+
+{-# NOINLINE bespoke_args2 #-}
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2 :: BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ())
+bespoke_args2 =
+  BG.unsafePerformIO hs_bindgen_6fc3008f0e66bd81
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_02e119349dfc0dc6" hs_bindgen_02e119349dfc0dc6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret1@
+hs_bindgen_02e119349dfc0dc6 :: IO (BG.FunPtr (BG.CInt -> IO BG.CBool))
+hs_bindgen_02e119349dfc0dc6 =
+  fmap BG.fromFFIType hs_bindgen_02e119349dfc0dc6_base
+
+{-# NOINLINE bespoke_ret1 #-}
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1 :: BG.FunPtr (BG.CInt -> IO BG.CBool)
+bespoke_ret1 =
+  BG.unsafePerformIO hs_bindgen_02e119349dfc0dc6
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_447b3d2bccfb7ae8" hs_bindgen_447b3d2bccfb7ae8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret2@
+hs_bindgen_447b3d2bccfb7ae8 :: IO (BG.FunPtr (BG.CInt -> IO HsBindgen.Runtime.LibC.CSize))
+hs_bindgen_447b3d2bccfb7ae8 =
+  fmap BG.fromFFIType hs_bindgen_447b3d2bccfb7ae8_base
+
+{-# NOINLINE bespoke_ret2 #-}
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2 :: BG.FunPtr (BG.CInt -> IO HsBindgen.Runtime.LibC.CSize)
+bespoke_ret2 =
+  BG.unsafePerformIO hs_bindgen_447b3d2bccfb7ae8
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args1@
+foreign import ccall unsafe "hs_bindgen_869038d8098a2bf2" hs_bindgen_869038d8098a2bf2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args1@
+hs_bindgen_869038d8098a2bf2 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ()))
+hs_bindgen_869038d8098a2bf2 =
+  fmap BG.fromFFIType hs_bindgen_869038d8098a2bf2_base
+
+{-# NOINLINE arr_args1 #-}
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ())
+arr_args1 =
+  BG.unsafePerformIO hs_bindgen_869038d8098a2bf2
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args2@
+foreign import ccall unsafe "hs_bindgen_d97856ae41779071" hs_bindgen_d97856ae41779071_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args2@
+hs_bindgen_d97856ae41779071 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt))) -> IO ()))
+hs_bindgen_d97856ae41779071 =
+  fmap BG.fromFFIType hs_bindgen_d97856ae41779071_base
+
+{-# NOINLINE arr_args2 #-}
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt))) -> IO ())
+arr_args2 =
+  BG.unsafePerformIO hs_bindgen_d97856ae41779071
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args3@
+foreign import ccall unsafe "hs_bindgen_e5fcdc276e072021" hs_bindgen_e5fcdc276e072021_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args3@
+hs_bindgen_e5fcdc276e072021 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt)) -> IO ()))
+hs_bindgen_e5fcdc276e072021 =
+  fmap BG.fromFFIType hs_bindgen_e5fcdc276e072021_base
+
+{-# NOINLINE arr_args3 #-}
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3 :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt)) -> IO ())
+arr_args3 =
+  BG.unsafePerformIO hs_bindgen_e5fcdc276e072021
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args4@
+foreign import ccall unsafe "hs_bindgen_5960a1a097c40b0b" hs_bindgen_5960a1a097c40b0b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args4@
+hs_bindgen_5960a1a097c40b0b :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt))) -> IO ()))
+hs_bindgen_5960a1a097c40b0b =
+  fmap BG.fromFFIType hs_bindgen_5960a1a097c40b0b_base
+
+{-# NOINLINE arr_args4 #-}
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4 :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt))) -> IO ())
+arr_args4 =
+  BG.unsafePerformIO hs_bindgen_5960a1a097c40b0b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_6e1c21a20bf17727" hs_bindgen_6e1c21a20bf17727_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args1@
+hs_bindgen_6e1c21a20bf17727 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (IO ()) -> IO ()))
+hs_bindgen_6e1c21a20bf17727 =
+  fmap BG.fromFFIType hs_bindgen_6e1c21a20bf17727_base
+
+{-# NOINLINE funptr_args1 #-}
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1 :: BG.FunPtr (BG.CInt -> BG.FunPtr (IO ()) -> IO ())
+funptr_args1 =
+  BG.unsafePerformIO hs_bindgen_6e1c21a20bf17727
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_316b1d39ef1c99c8" hs_bindgen_316b1d39ef1c99c8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args2@
+hs_bindgen_316b1d39ef1c99c8 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (IO BG.CInt) -> IO ()))
+hs_bindgen_316b1d39ef1c99c8 =
+  fmap BG.fromFFIType hs_bindgen_316b1d39ef1c99c8_base
+
+{-# NOINLINE funptr_args2 #-}
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2 :: BG.FunPtr (BG.CInt -> BG.FunPtr (IO BG.CInt) -> IO ())
+funptr_args2 =
+  BG.unsafePerformIO hs_bindgen_316b1d39ef1c99c8
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_3b587acc49334022" hs_bindgen_3b587acc49334022_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args3@
+hs_bindgen_3b587acc49334022 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> IO ()) -> IO ()))
+hs_bindgen_3b587acc49334022 =
+  fmap BG.fromFFIType hs_bindgen_3b587acc49334022_base
+
+{-# NOINLINE funptr_args3 #-}
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3 :: BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> IO ()) -> IO ())
+funptr_args3 =
+  BG.unsafePerformIO hs_bindgen_3b587acc49334022
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_880f8ecb89c20f54" hs_bindgen_880f8ecb89c20f54_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args4@
+hs_bindgen_880f8ecb89c20f54 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar) -> IO ()))
+hs_bindgen_880f8ecb89c20f54 =
+  fmap BG.fromFFIType hs_bindgen_880f8ecb89c20f54_base
+
+{-# NOINLINE funptr_args4 #-}
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4 :: BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar) -> IO ())
+funptr_args4 =
+  BG.unsafePerformIO hs_bindgen_880f8ecb89c20f54
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_25220e78ceba78f8" hs_bindgen_25220e78ceba78f8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args5@
+hs_bindgen_25220e78ceba78f8 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)) -> IO ()))
+hs_bindgen_25220e78ceba78f8 =
+  fmap BG.fromFFIType hs_bindgen_25220e78ceba78f8_base
+
+{-# NOINLINE funptr_args5 #-}
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5 :: BG.FunPtr (BG.CInt -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)) -> IO ())
+funptr_args5 =
+  BG.unsafePerformIO hs_bindgen_25220e78ceba78f8
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_comments1@
+foreign import ccall unsafe "hs_bindgen_6cef08508aed5305" hs_bindgen_6cef08508aed5305_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_comments1@
+hs_bindgen_6cef08508aed5305 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_6cef08508aed5305 =
+  fmap BG.fromFFIType hs_bindgen_6cef08508aed5305_base
+
+{-# NOINLINE comments1 #-}
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1 :: BG.FunPtr (BG.CInt -> IO ())
+comments1 =
+  BG.unsafePerformIO hs_bindgen_6cef08508aed5305
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_71a50f57cd1216e6" hs_bindgen_71a50f57cd1216e6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before1@
+hs_bindgen_71a50f57cd1216e6 :: IO (BG.FunPtr (BG.CInt -> BG.CChar -> IO ()))
+hs_bindgen_71a50f57cd1216e6 =
+  fmap BG.fromFFIType hs_bindgen_71a50f57cd1216e6_base
+
+{-# NOINLINE const_prim_before1 #-}
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1 :: BG.FunPtr (BG.CInt -> BG.CChar -> IO ())
+const_prim_before1 =
+  BG.unsafePerformIO hs_bindgen_71a50f57cd1216e6
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_5233d49c08278554" hs_bindgen_5233d49c08278554_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before2@
+hs_bindgen_5233d49c08278554 :: IO (BG.FunPtr (BG.CInt -> BG.CSChar -> IO ()))
+hs_bindgen_5233d49c08278554 =
+  fmap BG.fromFFIType hs_bindgen_5233d49c08278554_base
+
+{-# NOINLINE const_prim_before2 #-}
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2 :: BG.FunPtr (BG.CInt -> BG.CSChar -> IO ())
+const_prim_before2 =
+  BG.unsafePerformIO hs_bindgen_5233d49c08278554
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_b47263d563e229b2" hs_bindgen_b47263d563e229b2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before3@
+hs_bindgen_b47263d563e229b2 :: IO (BG.FunPtr (BG.CInt -> BG.CUChar -> IO ()))
+hs_bindgen_b47263d563e229b2 =
+  fmap BG.fromFFIType hs_bindgen_b47263d563e229b2_base
+
+{-# NOINLINE const_prim_before3 #-}
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3 :: BG.FunPtr (BG.CInt -> BG.CUChar -> IO ())
+const_prim_before3 =
+  BG.unsafePerformIO hs_bindgen_b47263d563e229b2
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_9b538efe2347a74e" hs_bindgen_9b538efe2347a74e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after1@
+hs_bindgen_9b538efe2347a74e :: IO (BG.FunPtr (BG.CInt -> BG.CChar -> IO ()))
+hs_bindgen_9b538efe2347a74e =
+  fmap BG.fromFFIType hs_bindgen_9b538efe2347a74e_base
+
+{-# NOINLINE const_prim_after1 #-}
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1 :: BG.FunPtr (BG.CInt -> BG.CChar -> IO ())
+const_prim_after1 =
+  BG.unsafePerformIO hs_bindgen_9b538efe2347a74e
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_e9bd30449260d07b" hs_bindgen_e9bd30449260d07b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after2@
+hs_bindgen_e9bd30449260d07b :: IO (BG.FunPtr (BG.CInt -> BG.CSChar -> IO ()))
+hs_bindgen_e9bd30449260d07b =
+  fmap BG.fromFFIType hs_bindgen_e9bd30449260d07b_base
+
+{-# NOINLINE const_prim_after2 #-}
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2 :: BG.FunPtr (BG.CInt -> BG.CSChar -> IO ())
+const_prim_after2 =
+  BG.unsafePerformIO hs_bindgen_e9bd30449260d07b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_f1e92cd065630ccb" hs_bindgen_f1e92cd065630ccb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after3@
+hs_bindgen_f1e92cd065630ccb :: IO (BG.FunPtr (BG.CInt -> BG.CUChar -> IO ()))
+hs_bindgen_f1e92cd065630ccb =
+  fmap BG.fromFFIType hs_bindgen_f1e92cd065630ccb_base
+
+{-# NOINLINE const_prim_after3 #-}
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3 :: BG.FunPtr (BG.CInt -> BG.CUChar -> IO ())
+const_prim_after3 =
+  BG.unsafePerformIO hs_bindgen_f1e92cd065630ccb
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_aea63f55c25fa26d" hs_bindgen_aea63f55c25fa26d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before1@
+hs_bindgen_aea63f55c25fa26d :: IO (BG.FunPtr (BG.CInt -> BG.CFloat -> IO ()))
+hs_bindgen_aea63f55c25fa26d =
+  fmap BG.fromFFIType hs_bindgen_aea63f55c25fa26d_base
+
+{-# NOINLINE const_withoutSign_before1 #-}
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1 :: BG.FunPtr (BG.CInt -> BG.CFloat -> IO ())
+const_withoutSign_before1 =
+  BG.unsafePerformIO hs_bindgen_aea63f55c25fa26d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_1a34eb11a6ccfd86" hs_bindgen_1a34eb11a6ccfd86_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before2@
+hs_bindgen_1a34eb11a6ccfd86 :: IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO ()))
+hs_bindgen_1a34eb11a6ccfd86 =
+  fmap BG.fromFFIType hs_bindgen_1a34eb11a6ccfd86_base
+
+{-# NOINLINE const_withoutSign_before2 #-}
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2 :: BG.FunPtr (BG.CInt -> BG.CDouble -> IO ())
+const_withoutSign_before2 =
+  BG.unsafePerformIO hs_bindgen_1a34eb11a6ccfd86
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_d9af8e3a8991a2e4" hs_bindgen_d9af8e3a8991a2e4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before3@
+hs_bindgen_d9af8e3a8991a2e4 :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_d9af8e3a8991a2e4 =
+  fmap BG.fromFFIType hs_bindgen_d9af8e3a8991a2e4_base
+
+{-# NOINLINE const_withoutSign_before3 #-}
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+const_withoutSign_before3 =
+  BG.unsafePerformIO hs_bindgen_d9af8e3a8991a2e4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_558f393b1eddf40d" hs_bindgen_558f393b1eddf40d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before4@
+hs_bindgen_558f393b1eddf40d :: IO (BG.FunPtr (BG.CInt -> Some_struct -> IO ()))
+hs_bindgen_558f393b1eddf40d =
+  fmap BG.fromFFIType hs_bindgen_558f393b1eddf40d_base
+
+{-# NOINLINE const_withoutSign_before4 #-}
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4 :: BG.FunPtr (BG.CInt -> Some_struct -> IO ())
+const_withoutSign_before4 =
+  BG.unsafePerformIO hs_bindgen_558f393b1eddf40d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_e62c93c0973b2781" hs_bindgen_e62c93c0973b2781_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before5@
+hs_bindgen_e62c93c0973b2781 :: IO (BG.FunPtr (BG.CInt -> Some_union -> IO ()))
+hs_bindgen_e62c93c0973b2781 =
+  fmap BG.fromFFIType hs_bindgen_e62c93c0973b2781_base
+
+{-# NOINLINE const_withoutSign_before5 #-}
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5 :: BG.FunPtr (BG.CInt -> Some_union -> IO ())
+const_withoutSign_before5 =
+  BG.unsafePerformIO hs_bindgen_e62c93c0973b2781
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_e56acb4f339a362d" hs_bindgen_e56acb4f339a362d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before6@
+hs_bindgen_e56acb4f339a362d :: IO (BG.FunPtr (BG.CInt -> Some_enum -> IO ()))
+hs_bindgen_e56acb4f339a362d =
+  fmap BG.fromFFIType hs_bindgen_e56acb4f339a362d_base
+
+{-# NOINLINE const_withoutSign_before6 #-}
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6 :: BG.FunPtr (BG.CInt -> Some_enum -> IO ())
+const_withoutSign_before6 =
+  BG.unsafePerformIO hs_bindgen_e56acb4f339a362d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_c298f88f131c980b" hs_bindgen_c298f88f131c980b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before7@
+hs_bindgen_c298f88f131c980b :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_c298f88f131c980b =
+  fmap BG.fromFFIType hs_bindgen_c298f88f131c980b_base
+
+{-# NOINLINE const_withoutSign_before7 #-}
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+const_withoutSign_before7 =
+  BG.unsafePerformIO hs_bindgen_c298f88f131c980b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_38d5cf2b5d94860c" hs_bindgen_38d5cf2b5d94860c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before8@
+hs_bindgen_38d5cf2b5d94860c :: IO (BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_38d5cf2b5d94860c =
+  fmap BG.fromFFIType hs_bindgen_38d5cf2b5d94860c_base
+
+{-# NOINLINE const_withoutSign_before8 #-}
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8 :: BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ())
+const_withoutSign_before8 =
+  BG.unsafePerformIO hs_bindgen_38d5cf2b5d94860c
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_362151a5ba0ce905" hs_bindgen_362151a5ba0ce905_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after1@
+hs_bindgen_362151a5ba0ce905 :: IO (BG.FunPtr (BG.CInt -> BG.CFloat -> IO ()))
+hs_bindgen_362151a5ba0ce905 =
+  fmap BG.fromFFIType hs_bindgen_362151a5ba0ce905_base
+
+{-# NOINLINE const_withoutSign_after1 #-}
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1 :: BG.FunPtr (BG.CInt -> BG.CFloat -> IO ())
+const_withoutSign_after1 =
+  BG.unsafePerformIO hs_bindgen_362151a5ba0ce905
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_071d6b5b46afca86" hs_bindgen_071d6b5b46afca86_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after2@
+hs_bindgen_071d6b5b46afca86 :: IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO ()))
+hs_bindgen_071d6b5b46afca86 =
+  fmap BG.fromFFIType hs_bindgen_071d6b5b46afca86_base
+
+{-# NOINLINE const_withoutSign_after2 #-}
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2 :: BG.FunPtr (BG.CInt -> BG.CDouble -> IO ())
+const_withoutSign_after2 =
+  BG.unsafePerformIO hs_bindgen_071d6b5b46afca86
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_cb70cd180a753e3a" hs_bindgen_cb70cd180a753e3a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after3@
+hs_bindgen_cb70cd180a753e3a :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_cb70cd180a753e3a =
+  fmap BG.fromFFIType hs_bindgen_cb70cd180a753e3a_base
+
+{-# NOINLINE const_withoutSign_after3 #-}
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+const_withoutSign_after3 =
+  BG.unsafePerformIO hs_bindgen_cb70cd180a753e3a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_17e67974fc77dde6" hs_bindgen_17e67974fc77dde6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after4@
+hs_bindgen_17e67974fc77dde6 :: IO (BG.FunPtr (BG.CInt -> Some_struct -> IO ()))
+hs_bindgen_17e67974fc77dde6 =
+  fmap BG.fromFFIType hs_bindgen_17e67974fc77dde6_base
+
+{-# NOINLINE const_withoutSign_after4 #-}
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4 :: BG.FunPtr (BG.CInt -> Some_struct -> IO ())
+const_withoutSign_after4 =
+  BG.unsafePerformIO hs_bindgen_17e67974fc77dde6
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_aea1ac49e3a717ae" hs_bindgen_aea1ac49e3a717ae_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after5@
+hs_bindgen_aea1ac49e3a717ae :: IO (BG.FunPtr (BG.CInt -> Some_union -> IO ()))
+hs_bindgen_aea1ac49e3a717ae =
+  fmap BG.fromFFIType hs_bindgen_aea1ac49e3a717ae_base
+
+{-# NOINLINE const_withoutSign_after5 #-}
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5 :: BG.FunPtr (BG.CInt -> Some_union -> IO ())
+const_withoutSign_after5 =
+  BG.unsafePerformIO hs_bindgen_aea1ac49e3a717ae
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_89ad81e6dc3a6ed4" hs_bindgen_89ad81e6dc3a6ed4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after6@
+hs_bindgen_89ad81e6dc3a6ed4 :: IO (BG.FunPtr (BG.CInt -> Some_enum -> IO ()))
+hs_bindgen_89ad81e6dc3a6ed4 =
+  fmap BG.fromFFIType hs_bindgen_89ad81e6dc3a6ed4_base
+
+{-# NOINLINE const_withoutSign_after6 #-}
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6 :: BG.FunPtr (BG.CInt -> Some_enum -> IO ())
+const_withoutSign_after6 =
+  BG.unsafePerformIO hs_bindgen_89ad81e6dc3a6ed4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_29b119a94317aae6" hs_bindgen_29b119a94317aae6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after7@
+hs_bindgen_29b119a94317aae6 :: IO (BG.FunPtr (BG.CInt -> BG.CBool -> IO ()))
+hs_bindgen_29b119a94317aae6 =
+  fmap BG.fromFFIType hs_bindgen_29b119a94317aae6_base
+
+{-# NOINLINE const_withoutSign_after7 #-}
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7 :: BG.FunPtr (BG.CInt -> BG.CBool -> IO ())
+const_withoutSign_after7 =
+  BG.unsafePerformIO hs_bindgen_29b119a94317aae6
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_be8db07cc695795d" hs_bindgen_be8db07cc695795d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after8@
+hs_bindgen_be8db07cc695795d :: IO (BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_be8db07cc695795d =
+  fmap BG.fromFFIType hs_bindgen_be8db07cc695795d_base
+
+{-# NOINLINE const_withoutSign_after8 #-}
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8 :: BG.FunPtr (BG.CInt -> HsBindgen.Runtime.LibC.CSize -> IO ())
+const_withoutSign_after8 =
+  BG.unsafePerformIO hs_bindgen_be8db07cc695795d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_3f4562f74152c205" hs_bindgen_3f4562f74152c205_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args1@
+hs_bindgen_3f4562f74152c205 :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_3f4562f74152c205 =
+  fmap BG.fromFFIType hs_bindgen_3f4562f74152c205_base
+
+{-# NOINLINE const_pointers_args1 #-}
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1 :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args1 =
+  BG.unsafePerformIO hs_bindgen_3f4562f74152c205
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_87278ccb01e7fee0" hs_bindgen_87278ccb01e7fee0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args2@
+hs_bindgen_87278ccb01e7fee0 :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_87278ccb01e7fee0 =
+  fmap BG.fromFFIType hs_bindgen_87278ccb01e7fee0_base
+
+{-# NOINLINE const_pointers_args2 #-}
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2 :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args2 =
+  BG.unsafePerformIO hs_bindgen_87278ccb01e7fee0
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_1e25b241655c3ebb" hs_bindgen_1e25b241655c3ebb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args3@
+hs_bindgen_1e25b241655c3ebb :: IO (BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> IO ()))
+hs_bindgen_1e25b241655c3ebb =
+  fmap BG.fromFFIType hs_bindgen_1e25b241655c3ebb_base
+
+{-# NOINLINE const_pointers_args3 #-}
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3 :: BG.FunPtr (BG.CInt -> BG.Ptr BG.CInt -> IO ())
+const_pointers_args3 =
+  BG.unsafePerformIO hs_bindgen_1e25b241655c3ebb
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_fa94aed37836859b" hs_bindgen_fa94aed37836859b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args4@
+hs_bindgen_fa94aed37836859b :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_fa94aed37836859b =
+  fmap BG.fromFFIType hs_bindgen_fa94aed37836859b_base
+
+{-# NOINLINE const_pointers_args4 #-}
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4 :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args4 =
+  BG.unsafePerformIO hs_bindgen_fa94aed37836859b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_800407f1e67deddb" hs_bindgen_800407f1e67deddb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args5@
+hs_bindgen_800407f1e67deddb :: IO (BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_800407f1e67deddb =
+  fmap BG.fromFFIType hs_bindgen_800407f1e67deddb_base
+
+{-# NOINLINE const_pointers_args5 #-}
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5 :: BG.FunPtr (BG.CInt -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args5 =
+  BG.unsafePerformIO hs_bindgen_800407f1e67deddb
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_91e3fb45ca972f9d" hs_bindgen_91e3fb45ca972f9d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret1@
+hs_bindgen_91e3fb45ca972f9d :: IO (BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_91e3fb45ca972f9d =
+  fmap BG.fromFFIType hs_bindgen_91e3fb45ca972f9d_base
+
+{-# NOINLINE const_pointers_ret1 #-}
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1 :: BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret1 =
+  BG.unsafePerformIO hs_bindgen_91e3fb45ca972f9d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_ce269be70accca82" hs_bindgen_ce269be70accca82_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret2@
+hs_bindgen_ce269be70accca82 :: IO (BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_ce269be70accca82 =
+  fmap BG.fromFFIType hs_bindgen_ce269be70accca82_base
+
+{-# NOINLINE const_pointers_ret2 #-}
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2 :: BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret2 =
+  BG.unsafePerformIO hs_bindgen_ce269be70accca82
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_f0f2ae46270c9785" hs_bindgen_f0f2ae46270c9785_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret3@
+hs_bindgen_f0f2ae46270c9785 :: IO (BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_f0f2ae46270c9785 =
+  fmap BG.fromFFIType hs_bindgen_f0f2ae46270c9785_base
+
+{-# NOINLINE const_pointers_ret3 #-}
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3 :: BG.FunPtr (BG.CInt -> IO (BG.Ptr BG.CInt))
+const_pointers_ret3 =
+  BG.unsafePerformIO hs_bindgen_f0f2ae46270c9785
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_4ecbc6cf48fbe0c3" hs_bindgen_4ecbc6cf48fbe0c3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret4@
+hs_bindgen_4ecbc6cf48fbe0c3 :: IO (BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_4ecbc6cf48fbe0c3 =
+  fmap BG.fromFFIType hs_bindgen_4ecbc6cf48fbe0c3_base
+
+{-# NOINLINE const_pointers_ret4 #-}
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4 :: BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret4 =
+  BG.unsafePerformIO hs_bindgen_4ecbc6cf48fbe0c3
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_c0b16cd44f63f52f" hs_bindgen_c0b16cd44f63f52f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret5@
+hs_bindgen_c0b16cd44f63f52f :: IO (BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_c0b16cd44f63f52f =
+  fmap BG.fromFFIType hs_bindgen_c0b16cd44f63f52f_base
+
+{-# NOINLINE const_pointers_ret5 #-}
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5 :: BG.FunPtr (BG.CInt -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret5 =
+  BG.unsafePerformIO hs_bindgen_c0b16cd44f63f52f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_db9eb973118a6fbf" hs_bindgen_db9eb973118a6fbf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem1@
+hs_bindgen_db9eb973118a6fbf :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ()))
+hs_bindgen_db9eb973118a6fbf =
+  fmap BG.fromFFIType hs_bindgen_db9eb973118a6fbf_base
+
+{-# NOINLINE const_array_elem1 #-}
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1 :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt)) -> IO ())
+const_array_elem1 =
+  BG.unsafePerformIO hs_bindgen_db9eb973118a6fbf
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_9288cd4171172005" hs_bindgen_9288cd4171172005_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem2@
+hs_bindgen_9288cd4171172005 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt))) -> IO ()))
+hs_bindgen_9288cd4171172005 =
+  fmap BG.fromFFIType hs_bindgen_9288cd4171172005_base
+
+{-# NOINLINE const_array_elem2 #-}
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt))) -> IO ())
+const_array_elem2 =
+  BG.unsafePerformIO hs_bindgen_9288cd4171172005
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_c20403bc692b1bde" hs_bindgen_c20403bc692b1bde_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem3@
+hs_bindgen_c20403bc692b1bde :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt))) -> IO ()))
+hs_bindgen_c20403bc692b1bde =
+  fmap BG.fromFFIType hs_bindgen_c20403bc692b1bde_base
+
+{-# NOINLINE const_array_elem3 #-}
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3 :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt))) -> IO ())
+const_array_elem3 =
+  BG.unsafePerformIO hs_bindgen_c20403bc692b1bde
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams1@
+foreign import ccall unsafe "hs_bindgen_5ca24e7f6ac8cff0" hs_bindgen_5ca24e7f6ac8cff0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams1@
+hs_bindgen_5ca24e7f6ac8cff0 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_5ca24e7f6ac8cff0 =
+  fmap BG.fromFFIType hs_bindgen_5ca24e7f6ac8cff0_base
+
+{-# NOINLINE noParams1 #-}
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1 :: BG.FunPtr (IO BG.CInt)
+noParams1 =
+  BG.unsafePerformIO hs_bindgen_5ca24e7f6ac8cff0
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams2@
+foreign import ccall unsafe "hs_bindgen_6f664f6fdcbced27" hs_bindgen_6f664f6fdcbced27_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams2@
+hs_bindgen_6f664f6fdcbced27 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_6f664f6fdcbced27 =
+  fmap BG.fromFFIType hs_bindgen_6f664f6fdcbced27_base
+
+{-# NOINLINE noParams2 #-}
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2 :: BG.FunPtr (IO BG.CInt)
+noParams2 =
+  BG.unsafePerformIO hs_bindgen_6f664f6fdcbced27
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams3@
+foreign import ccall unsafe "hs_bindgen_1067f730bd5b4c43" hs_bindgen_1067f730bd5b4c43_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams3@
+hs_bindgen_1067f730bd5b4c43 :: IO (BG.FunPtr (BG.CInt -> BG.FunPtr (IO BG.CInt) -> IO ()))
+hs_bindgen_1067f730bd5b4c43 =
+  fmap BG.fromFFIType hs_bindgen_1067f730bd5b4c43_base
+
+{-# NOINLINE noParams3 #-}
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3 :: BG.FunPtr (BG.CInt -> BG.FunPtr (IO BG.CInt) -> IO ())
+noParams3 =
+  BG.unsafePerformIO hs_bindgen_1067f730bd5b4c43
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_6b5258a8560bc11c" hs_bindgen_6b5258a8560bc11c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret1@
+hs_bindgen_6b5258a8560bc11c :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (IO ()))))
+hs_bindgen_6b5258a8560bc11c =
+  fmap BG.fromFFIType hs_bindgen_6b5258a8560bc11c_base
+
+{-# NOINLINE funptr_ret1 #-}
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (IO ())))
+funptr_ret1 =
+  BG.unsafePerformIO hs_bindgen_6b5258a8560bc11c
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_723b02be7cb23263" hs_bindgen_723b02be7cb23263_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret2@
+hs_bindgen_723b02be7cb23263 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (IO BG.CInt))))
+hs_bindgen_723b02be7cb23263 =
+  fmap BG.fromFFIType hs_bindgen_723b02be7cb23263_base
+
+{-# NOINLINE funptr_ret2 #-}
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (IO BG.CInt)))
+funptr_ret2 =
+  BG.unsafePerformIO hs_bindgen_723b02be7cb23263
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_7c4d8fc844c6f97b" hs_bindgen_7c4d8fc844c6f97b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret3@
+hs_bindgen_7c4d8fc844c6f97b :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> IO ()))))
+hs_bindgen_7c4d8fc844c6f97b =
+  fmap BG.fromFFIType hs_bindgen_7c4d8fc844c6f97b_base
+
+{-# NOINLINE funptr_ret3 #-}
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> IO ())))
+funptr_ret3 =
+  BG.unsafePerformIO hs_bindgen_7c4d8fc844c6f97b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_25b578cce360cf12" hs_bindgen_25b578cce360cf12_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret4@
+hs_bindgen_25b578cce360cf12 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))))
+hs_bindgen_25b578cce360cf12 =
+  fmap BG.fromFFIType hs_bindgen_25b578cce360cf12_base
+
+{-# NOINLINE funptr_ret4 #-}
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)))
+funptr_ret4 =
+  BG.unsafePerformIO hs_bindgen_25b578cce360cf12
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_5e58691a68a915de" hs_bindgen_5e58691a68a915de_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret5@
+hs_bindgen_5e58691a68a915de :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))))
+hs_bindgen_5e58691a68a915de =
+  fmap BG.fromFFIType hs_bindgen_5e58691a68a915de_base
+
+{-# NOINLINE funptr_ret5 #-}
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))))
+funptr_ret5 =
+  BG.unsafePerformIO hs_bindgen_5e58691a68a915de
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_0c36a271f93a9dff" hs_bindgen_0c36a271f93a9dff_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret6@
+hs_bindgen_0c36a271f93a9dff :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_0c36a271f93a9dff =
+  fmap BG.fromFFIType hs_bindgen_0c36a271f93a9dff_base
+
+{-# NOINLINE funptr_ret6 #-}
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret6 =
+  BG.unsafePerformIO hs_bindgen_0c36a271f93a9dff
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_67439554fe1e797d" hs_bindgen_67439554fe1e797d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret7@
+hs_bindgen_67439554fe1e797d :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_67439554fe1e797d =
+  fmap BG.fromFFIType hs_bindgen_67439554fe1e797d_base
+
+{-# NOINLINE funptr_ret7 #-}
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret7 =
+  BG.unsafePerformIO hs_bindgen_67439554fe1e797d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_870a61b2b66eecf3" hs_bindgen_870a61b2b66eecf3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret8@
+hs_bindgen_870a61b2b66eecf3 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))))
+hs_bindgen_870a61b2b66eecf3 =
+  fmap BG.fromFFIType hs_bindgen_870a61b2b66eecf3_base
+
+{-# NOINLINE funptr_ret8 #-}
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))))
+funptr_ret8 =
+  BG.unsafePerformIO hs_bindgen_870a61b2b66eecf3
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_e7920c47095333a3" hs_bindgen_e7920c47095333a3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret9@
+hs_bindgen_e7920c47095333a3 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_e7920c47095333a3 =
+  fmap BG.fromFFIType hs_bindgen_e7920c47095333a3_base
+
+{-# NOINLINE funptr_ret9 #-}
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret9 =
+  BG.unsafePerformIO hs_bindgen_e7920c47095333a3
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_aa1eab9b222fa4b8" hs_bindgen_aa1eab9b222fa4b8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret10@
+hs_bindgen_aa1eab9b222fa4b8 :: IO (BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_aa1eab9b222fa4b8 =
+  fmap BG.fromFFIType hs_bindgen_aa1eab9b222fa4b8_base
+
+{-# NOINLINE funptr_ret10 #-}
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10 :: BG.FunPtr (BG.CInt -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret10 =
+  BG.unsafePerformIO hs_bindgen_aa1eab9b222fa4b8
diff --git a/test-artefacts/fixtures/macros/reparse.2.raw/Example/Global.hs b/test-artefacts/fixtures/macros/reparse.2.raw/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.2.raw/Example/Global.hs
@@ -0,0 +1,202 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.global1
+    , Example.Global.global2
+    , Example.Global.global3
+    , Example.Global.const1
+    , Example.Global.const2
+    , Example.Global.const3
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "/* test_macrosreparse_2_raw_Example_get_global1 */"
+  , "__attribute__ ((const))"
+  , "signed int *hs_bindgen_93cfa28c4d516159 (void)"
+  , "{"
+  , "  return &global1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_global2 */"
+  , "__attribute__ ((const))"
+  , "signed int **hs_bindgen_9d8438d8f0c6d639 (void)"
+  , "{"
+  , "  return &global2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_global3 */"
+  , "__attribute__ ((const))"
+  , "signed int ***hs_bindgen_29516306ddb7335f (void)"
+  , "{"
+  , "  return &global3;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const1 */"
+  , "__attribute__ ((const))"
+  , "signed int const *hs_bindgen_3326ba6dde505604 (void)"
+  , "{"
+  , "  return &const1;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const2 */"
+  , "__attribute__ ((const))"
+  , "signed int *const *hs_bindgen_8add8e4cd4511ebc (void)"
+  , "{"
+  , "  return &const2;"
+  , "}"
+  , "/* test_macrosreparse_2_raw_Example_get_const3 */"
+  , "__attribute__ ((const))"
+  , "signed int **const *hs_bindgen_e00a055156bc89e4 (void)"
+  , "{"
+  , "  return &const3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global1@
+foreign import ccall unsafe "hs_bindgen_93cfa28c4d516159" hs_bindgen_93cfa28c4d516159_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global1@
+hs_bindgen_93cfa28c4d516159 :: IO (BG.Ptr BG.CInt)
+hs_bindgen_93cfa28c4d516159 =
+  fmap BG.fromFFIType hs_bindgen_93cfa28c4d516159_base
+
+{-# NOINLINE global1 #-}
+{-| Globals and constants
+
+    __C declaration:__ @global1@
+
+    __defined at:__ @macros\/reparse.h 161:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global1 :: BG.Ptr BG.CInt
+global1 =
+  BG.unsafePerformIO hs_bindgen_93cfa28c4d516159
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global2@
+foreign import ccall unsafe "hs_bindgen_9d8438d8f0c6d639" hs_bindgen_9d8438d8f0c6d639_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global2@
+hs_bindgen_9d8438d8f0c6d639 :: IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_9d8438d8f0c6d639 =
+  fmap BG.fromFFIType hs_bindgen_9d8438d8f0c6d639_base
+
+{-# NOINLINE global2 #-}
+{-| __C declaration:__ @global2@
+
+    __defined at:__ @macros\/reparse.h 162:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global2 :: BG.Ptr (BG.Ptr BG.CInt)
+global2 =
+  BG.unsafePerformIO hs_bindgen_9d8438d8f0c6d639
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global3@
+foreign import ccall unsafe "hs_bindgen_29516306ddb7335f" hs_bindgen_29516306ddb7335f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global3@
+hs_bindgen_29516306ddb7335f :: IO (BG.Ptr (BG.Ptr (BG.Ptr BG.CInt)))
+hs_bindgen_29516306ddb7335f =
+  fmap BG.fromFFIType hs_bindgen_29516306ddb7335f_base
+
+{-# NOINLINE global3 #-}
+{-| __C declaration:__ @global3@
+
+    __defined at:__ @macros\/reparse.h 163:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global3 :: BG.Ptr (BG.Ptr (BG.Ptr BG.CInt))
+global3 =
+  BG.unsafePerformIO hs_bindgen_29516306ddb7335f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const1@
+foreign import ccall unsafe "hs_bindgen_3326ba6dde505604" hs_bindgen_3326ba6dde505604_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const1@
+hs_bindgen_3326ba6dde505604 :: IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_3326ba6dde505604 =
+  fmap BG.fromFFIType hs_bindgen_3326ba6dde505604_base
+
+{-# NOINLINE hs_bindgen_0ad29e3e91a18217 #-}
+{-| __C declaration:__ @const1@
+
+    __defined at:__ @macros\/reparse.h 165:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_2_raw_Example_const1@
+-}
+hs_bindgen_0ad29e3e91a18217 :: PtrConst.PtrConst BG.CInt
+hs_bindgen_0ad29e3e91a18217 =
+  BG.unsafePerformIO hs_bindgen_3326ba6dde505604
+
+{-# NOINLINE const1 #-}
+const1 :: BG.CInt
+const1 =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_0ad29e3e91a18217)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const2@
+foreign import ccall unsafe "hs_bindgen_8add8e4cd4511ebc" hs_bindgen_8add8e4cd4511ebc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const2@
+hs_bindgen_8add8e4cd4511ebc :: IO (PtrConst.PtrConst (BG.Ptr BG.CInt))
+hs_bindgen_8add8e4cd4511ebc =
+  fmap BG.fromFFIType hs_bindgen_8add8e4cd4511ebc_base
+
+{-# NOINLINE hs_bindgen_67e8005e9795d40a #-}
+{-| __C declaration:__ @const2@
+
+    __defined at:__ @macros\/reparse.h 166:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_2_raw_Example_const2@
+-}
+hs_bindgen_67e8005e9795d40a :: PtrConst.PtrConst (BG.Ptr BG.CInt)
+hs_bindgen_67e8005e9795d40a =
+  BG.unsafePerformIO hs_bindgen_8add8e4cd4511ebc
+
+{-# NOINLINE const2 #-}
+const2 :: BG.Ptr BG.CInt
+const2 =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_67e8005e9795d40a)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const3@
+foreign import ccall unsafe "hs_bindgen_e00a055156bc89e4" hs_bindgen_e00a055156bc89e4_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const3@
+hs_bindgen_e00a055156bc89e4 :: IO (PtrConst.PtrConst (BG.Ptr (BG.Ptr BG.CInt)))
+hs_bindgen_e00a055156bc89e4 =
+  fmap BG.fromFFIType hs_bindgen_e00a055156bc89e4_base
+
+{-# NOINLINE hs_bindgen_2f3c7514e0b7b99c #-}
+{-| __C declaration:__ @const3@
+
+    __defined at:__ @macros\/reparse.h 167:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_2_raw_Example_const3@
+-}
+hs_bindgen_2f3c7514e0b7b99c :: PtrConst.PtrConst (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_2f3c7514e0b7b99c =
+  BG.unsafePerformIO hs_bindgen_e00a055156bc89e4
+
+{-# NOINLINE const3 #-}
+const3 :: BG.Ptr (BG.Ptr BG.CInt)
+const3 =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_2f3c7514e0b7b99c)
diff --git a/test-artefacts/fixtures/macros/reparse.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.2.raw/Example/Safe.hs
@@ -0,0 +1,4006 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.args_char1
+    , Example.Safe.args_char2
+    , Example.Safe.args_char3
+    , Example.Safe.args_short1
+    , Example.Safe.args_short2
+    , Example.Safe.args_short3
+    , Example.Safe.args_int1
+    , Example.Safe.args_int2
+    , Example.Safe.args_int3
+    , Example.Safe.args_long1
+    , Example.Safe.args_long2
+    , Example.Safe.args_long3
+    , Example.Safe.args_float
+    , Example.Safe.args_double
+    , Example.Safe.args_bool1
+    , Example.Safe.args_struct
+    , Example.Safe.args_union
+    , Example.Safe.args_enum
+    , Example.Safe.args_pointer1
+    , Example.Safe.args_pointer2
+    , Example.Safe.args_pointer3
+    , Example.Safe.ret_A
+    , Example.Safe.ret_char1
+    , Example.Safe.ret_char2
+    , Example.Safe.ret_char3
+    , Example.Safe.ret_short1
+    , Example.Safe.ret_short2
+    , Example.Safe.ret_short3
+    , Example.Safe.ret_int1
+    , Example.Safe.ret_int2
+    , Example.Safe.ret_int3
+    , Example.Safe.ret_long1
+    , Example.Safe.ret_long2
+    , Example.Safe.ret_long3
+    , Example.Safe.ret_float
+    , Example.Safe.ret_double
+    , Example.Safe.ret_bool1
+    , Example.Safe.ret_struct
+    , Example.Safe.ret_union
+    , Example.Safe.ret_enum
+    , Example.Safe.ret_pointer1
+    , Example.Safe.ret_pointer2
+    , Example.Safe.ret_pointer3
+    , Example.Safe.body1
+    , Example.Safe.body2
+    , Example.Safe.args_complex_float
+    , Example.Safe.args_complex_double
+    , Example.Safe.ret_complex_float
+    , Example.Safe.ret_complex_double
+    , Example.Safe.bespoke_args1
+    , Example.Safe.bespoke_args2
+    , Example.Safe.bespoke_ret1
+    , Example.Safe.bespoke_ret2
+    , Example.Safe.arr_args1
+    , Example.Safe.arr_args2
+    , Example.Safe.arr_args3
+    , Example.Safe.arr_args4
+    , Example.Safe.funptr_args1
+    , Example.Safe.funptr_args2
+    , Example.Safe.funptr_args3
+    , Example.Safe.funptr_args4
+    , Example.Safe.funptr_args5
+    , Example.Safe.comments1
+    , Example.Safe.const_prim_before1
+    , Example.Safe.const_prim_before2
+    , Example.Safe.const_prim_before3
+    , Example.Safe.const_prim_after1
+    , Example.Safe.const_prim_after2
+    , Example.Safe.const_prim_after3
+    , Example.Safe.const_withoutSign_before1
+    , Example.Safe.const_withoutSign_before2
+    , Example.Safe.const_withoutSign_before3
+    , Example.Safe.const_withoutSign_before4
+    , Example.Safe.const_withoutSign_before5
+    , Example.Safe.const_withoutSign_before6
+    , Example.Safe.const_withoutSign_before7
+    , Example.Safe.const_withoutSign_before8
+    , Example.Safe.const_withoutSign_after1
+    , Example.Safe.const_withoutSign_after2
+    , Example.Safe.const_withoutSign_after3
+    , Example.Safe.const_withoutSign_after4
+    , Example.Safe.const_withoutSign_after5
+    , Example.Safe.const_withoutSign_after6
+    , Example.Safe.const_withoutSign_after7
+    , Example.Safe.const_withoutSign_after8
+    , Example.Safe.const_pointers_args1
+    , Example.Safe.const_pointers_args2
+    , Example.Safe.const_pointers_args3
+    , Example.Safe.const_pointers_args4
+    , Example.Safe.const_pointers_args5
+    , Example.Safe.const_pointers_ret1
+    , Example.Safe.const_pointers_ret2
+    , Example.Safe.const_pointers_ret3
+    , Example.Safe.const_pointers_ret4
+    , Example.Safe.const_pointers_ret5
+    , Example.Safe.const_array_elem1
+    , Example.Safe.const_array_elem2
+    , Example.Safe.const_array_elem3
+    , Example.Safe.noParams1
+    , Example.Safe.noParams2
+    , Example.Safe.noParams3
+    , Example.Safe.funptr_ret1
+    , Example.Safe.funptr_ret2
+    , Example.Safe.funptr_ret3
+    , Example.Safe.funptr_ret4
+    , Example.Safe.funptr_ret5
+    , Example.Safe.funptr_ret6
+    , Example.Safe.funptr_ret7
+    , Example.Safe.funptr_ret8
+    , Example.Safe.funptr_ret9
+    , Example.Safe.funptr_ret10
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "void hs_bindgen_14b56322053baa3f ("
+  , "  signed int arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (args_char1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_05193644052d4324 ("
+  , "  signed int arg1,"
+  , "  signed char arg2"
+  , ")"
+  , "{"
+  , "  (args_char2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_5b68ff22474d4775 ("
+  , "  signed int arg1,"
+  , "  unsigned char arg2"
+  , ")"
+  , "{"
+  , "  (args_char3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_5a7d0b078ac418a1 ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6d391e69fc74dd4b ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d3d74caa6f6d43ab ("
+  , "  signed int arg1,"
+  , "  unsigned short arg2"
+  , ")"
+  , "{"
+  , "  (args_short3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d005292650dc9976 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2dde5b36f080e07d ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e7207b4f601fa789 ("
+  , "  signed int arg1,"
+  , "  unsigned int arg2"
+  , ")"
+  , "{"
+  , "  (args_int3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_bc717d375990f9e5 ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_db1215183538b75a ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3ac74c7cbfc79685 ("
+  , "  signed int arg1,"
+  , "  unsigned long arg2"
+  , ")"
+  , "{"
+  , "  (args_long3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a2388e64c2a84027 ("
+  , "  signed int arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  (args_float)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e5ad67302deb9698 ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  (args_double)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_bad730ef968d4941 ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (args_bool1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_24f835bba72f92a3 ("
+  , "  signed int arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  (args_struct)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_d06661c0e9399cf0 ("
+  , "  signed int arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  (args_union)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_d37243b7a8d9d58d ("
+  , "  signed int arg1,"
+  , "  enum some_enum arg2"
+  , ")"
+  , "{"
+  , "  (args_enum)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b3bd6759641d67eb ("
+  , "  signed int arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_97b00bc8a470fc69 ("
+  , "  signed int arg1,"
+  , "  signed int **arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_07e7d187d95f6ca2 ("
+  , "  signed int arg1,"
+  , "  void *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer3)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_144178893e488066 (void)"
+  , "{"
+  , "  return (ret_A)();"
+  , "}"
+  , "char hs_bindgen_d7d2bc68373545e4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char1)(arg1);"
+  , "}"
+  , "signed char hs_bindgen_aa47ca542df45b7b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char2)(arg1);"
+  , "}"
+  , "unsigned char hs_bindgen_bcc15cd6faf7b787 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char3)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_4ba7217a94e5e369 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short1)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_ea4e41167ce3686a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short2)(arg1);"
+  , "}"
+  , "unsigned short hs_bindgen_b1021a4826d326a1 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_c23956482c29e1c5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_76475f626bf1d429 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int2)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_e86e93b147924e4a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int3)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_2e5e9b9d09a32b33 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long1)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_9541cb65d260ceec ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long2)(arg1);"
+  , "}"
+  , "unsigned long hs_bindgen_fca665017c551d32 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long3)(arg1);"
+  , "}"
+  , "float hs_bindgen_06152a76d70abec3 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_float)(arg1);"
+  , "}"
+  , "double hs_bindgen_fcbb5b65a6e8dee4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_double)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_d2265e448c2759e9 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_bool1)(arg1);"
+  , "}"
+  , "void hs_bindgen_e6010e994241dd23 ("
+  , "  signed int arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_struct)(arg1);"
+  , "}"
+  , "void hs_bindgen_00be97ea5e3606e4 ("
+  , "  signed int arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_union)(arg1);"
+  , "}"
+  , "enum some_enum hs_bindgen_7ad2540b7cf6b817 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_enum)(arg1);"
+  , "}"
+  , "signed int *hs_bindgen_6dba6060a7ca10de ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer1)(arg1);"
+  , "}"
+  , "signed int **hs_bindgen_7af2522218790e65 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer2)(arg1);"
+  , "}"
+  , "void *hs_bindgen_88562aa8f53d0780 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b9b614c706b250e5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (body1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b0559ae62627b030 (void)"
+  , "{"
+  , "  return (body2)();"
+  , "}"
+  , "void hs_bindgen_ddfc5cefdbda545b ("
+  , "  signed int arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_float)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_cbf4ca3c6e7f80aa ("
+  , "  signed int arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_double)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_0f1f6ea0917ce0ca ("
+  , "  signed int arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_float)(arg1);"
+  , "}"
+  , "void hs_bindgen_955f1c0b383d9a7c ("
+  , "  signed int arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_double)(arg1);"
+  , "}"
+  , "void hs_bindgen_61695282305a53ac ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4c244649666e88b3 ("
+  , "  signed int arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args2)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_1b4cd50ca08ff13a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret1)(arg1);"
+  , "}"
+  , "size_t hs_bindgen_71b4f4a34ec749c5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret2)(arg1);"
+  , "}"
+  , "void hs_bindgen_8588314c8f45b7e1 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args1)(arg1);"
+  , "}"
+  , "void hs_bindgen_2eb08d216276c1b7 ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args2)(arg1);"
+  , "}"
+  , "void hs_bindgen_9e0ebe19b98832b7 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args3)(arg1);"
+  , "}"
+  , "void hs_bindgen_46bbe5c4f9a7db28 ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args4)(arg1);"
+  , "}"
+  , "void hs_bindgen_38985300d47b4487 ("
+  , "  signed int arg1,"
+  , "  void (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_23d1626952d2a132 ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_69073b33110db81a ("
+  , "  signed int arg1,"
+  , "  void (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9e6495d8345f7848 ("
+  , "  signed int arg1,"
+  , "  char (*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d5ab1b462ff6c176 ("
+  , "  signed int arg1,"
+  , "  signed int *(*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args5)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_17cfdc4afa81f262 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (comments1)(arg1);"
+  , "}"
+  , "void hs_bindgen_62dad052d7ac99e6 ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6a954623e8847292 ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_5c4e5530b1f695b7 ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d219b88b917d72cf ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_79a466a4f64a4db1 ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a13884c8125a5f80 ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_5433c1896cba42d3 ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_8300ce11589589f2 ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_be304ec839983d7b ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_445a2c238c734060 ("
+  , "  signed int arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_b5a05c2c1589c243 ("
+  , "  signed int arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_8217e6e9e19e7627 ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_cbcb3411df130b42 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_fb0ddd12de072fd8 ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_91e81e2ec29aa772 ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6703a37e4fd098b1 ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_054259024219dbcc ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_eb4880610136c7bb ("
+  , "  signed int arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_c0478c5f65c7e32e ("
+  , "  signed int arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_764dd29ada03ac05 ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_62f2db62740aa47c ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f9349cbf0c433984 ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_05103ac5c64a70c5 ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2adbdab03502d7c3 ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_02735f713f3663a0 ("
+  , "  signed int arg1,"
+  , "  signed int *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7be4b56f499736ec ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_07806340121e9d7a ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args5)(arg1, arg2);"
+  , "}"
+  , "signed int const *hs_bindgen_964ecbd6daab3ac8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret1)(arg1);"
+  , "}"
+  , "signed int const *hs_bindgen_425aa26fa3f15a85 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret2)(arg1);"
+  , "}"
+  , "signed int *const hs_bindgen_35dc6a2376f4669c ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret3)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_b4704a8e3fa5c1a7 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret4)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_eee06f696926bceb ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret5)(arg1);"
+  , "}"
+  , "void hs_bindgen_85897c18c4db8c38 ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem1)(arg1);"
+  , "}"
+  , "void hs_bindgen_7d19c28372388bd5 ("
+  , "  signed int const **arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem2)(arg1);"
+  , "}"
+  , "void hs_bindgen_b72db4cfe06fec75 ("
+  , "  signed int *const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_8c2d8b6c768235a6 (void)"
+  , "{"
+  , "  return (noParams1)();"
+  , "}"
+  , "signed int hs_bindgen_f406093f4244470f (void)"
+  , "{"
+  , "  return (noParams2)();"
+  , "}"
+  , "void hs_bindgen_7cfe278ffc125a35 ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (noParams3)(arg1, arg2);"
+  , "}"
+  , "void (*hs_bindgen_6f95516796104481 ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_c823e0311ec509b4 ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret2)(arg1);"
+  , "}"
+  , "void (*hs_bindgen_94550ec4aba19f7b ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (funptr_ret3)(arg1);"
+  , "}"
+  , "char (*hs_bindgen_ed3e6ebe628da423 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret4)(arg1);"
+  , "}"
+  , "signed int *(*hs_bindgen_cb5a94e6610ff83d ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret5)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_8cd3005394354b86 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret6)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_0f1393247fcdeb7a ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret7)(arg1);"
+  , "}"
+  , "signed int *const (*hs_bindgen_7da05d4b5c843853 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret8)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_f6f304c980603aae ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret9)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_263377d0e4be3901 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret10)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char1@
+foreign import ccall safe "hs_bindgen_14b56322053baa3f" hs_bindgen_14b56322053baa3f_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char1@
+hs_bindgen_14b56322053baa3f ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_14b56322053baa3f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_14b56322053baa3f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char1 = hs_bindgen_14b56322053baa3f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char2@
+foreign import ccall safe "hs_bindgen_05193644052d4324" hs_bindgen_05193644052d4324_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char2@
+hs_bindgen_05193644052d4324 ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_05193644052d4324 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_05193644052d4324_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char2 = hs_bindgen_05193644052d4324
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char3@
+foreign import ccall safe "hs_bindgen_5b68ff22474d4775" hs_bindgen_5b68ff22474d4775_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char3@
+hs_bindgen_5b68ff22474d4775 ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_5b68ff22474d4775 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5b68ff22474d4775_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char3 = hs_bindgen_5b68ff22474d4775
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short1@
+foreign import ccall safe "hs_bindgen_5a7d0b078ac418a1" hs_bindgen_5a7d0b078ac418a1_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short1@
+hs_bindgen_5a7d0b078ac418a1 ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_5a7d0b078ac418a1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5a7d0b078ac418a1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short1 = hs_bindgen_5a7d0b078ac418a1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short2@
+foreign import ccall safe "hs_bindgen_6d391e69fc74dd4b" hs_bindgen_6d391e69fc74dd4b_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short2@
+hs_bindgen_6d391e69fc74dd4b ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_6d391e69fc74dd4b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6d391e69fc74dd4b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short2 = hs_bindgen_6d391e69fc74dd4b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short3@
+foreign import ccall safe "hs_bindgen_d3d74caa6f6d43ab" hs_bindgen_d3d74caa6f6d43ab_base ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short3@
+hs_bindgen_d3d74caa6f6d43ab ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+hs_bindgen_d3d74caa6f6d43ab =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d3d74caa6f6d43ab_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short3 = hs_bindgen_d3d74caa6f6d43ab
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int1@
+foreign import ccall safe "hs_bindgen_d005292650dc9976" hs_bindgen_d005292650dc9976_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int1@
+hs_bindgen_d005292650dc9976 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_d005292650dc9976 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d005292650dc9976_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int1 = hs_bindgen_d005292650dc9976
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int2@
+foreign import ccall safe "hs_bindgen_2dde5b36f080e07d" hs_bindgen_2dde5b36f080e07d_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int2@
+hs_bindgen_2dde5b36f080e07d ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_2dde5b36f080e07d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2dde5b36f080e07d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int2 = hs_bindgen_2dde5b36f080e07d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int3@
+foreign import ccall safe "hs_bindgen_e7207b4f601fa789" hs_bindgen_e7207b4f601fa789_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int3@
+hs_bindgen_e7207b4f601fa789 ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+hs_bindgen_e7207b4f601fa789 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e7207b4f601fa789_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int3 = hs_bindgen_e7207b4f601fa789
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long1@
+foreign import ccall safe "hs_bindgen_bc717d375990f9e5" hs_bindgen_bc717d375990f9e5_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long1@
+hs_bindgen_bc717d375990f9e5 ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_bc717d375990f9e5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_bc717d375990f9e5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long1 = hs_bindgen_bc717d375990f9e5
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long2@
+foreign import ccall safe "hs_bindgen_db1215183538b75a" hs_bindgen_db1215183538b75a_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long2@
+hs_bindgen_db1215183538b75a ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_db1215183538b75a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_db1215183538b75a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long2 = hs_bindgen_db1215183538b75a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long3@
+foreign import ccall safe "hs_bindgen_3ac74c7cbfc79685" hs_bindgen_3ac74c7cbfc79685_base ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long3@
+hs_bindgen_3ac74c7cbfc79685 ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+hs_bindgen_3ac74c7cbfc79685 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3ac74c7cbfc79685_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CULong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long3 = hs_bindgen_3ac74c7cbfc79685
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_float@
+foreign import ccall safe "hs_bindgen_a2388e64c2a84027" hs_bindgen_a2388e64c2a84027_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_float@
+hs_bindgen_a2388e64c2a84027 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_a2388e64c2a84027 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a2388e64c2a84027_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_float = hs_bindgen_a2388e64c2a84027
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_double@
+foreign import ccall safe "hs_bindgen_e5ad67302deb9698" hs_bindgen_e5ad67302deb9698_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_double@
+hs_bindgen_e5ad67302deb9698 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_e5ad67302deb9698 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e5ad67302deb9698_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_double = hs_bindgen_e5ad67302deb9698
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_bool1@
+foreign import ccall safe "hs_bindgen_bad730ef968d4941" hs_bindgen_bad730ef968d4941_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_bool1@
+hs_bindgen_bad730ef968d4941 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_bad730ef968d4941 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_bad730ef968d4941_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_bool1 = hs_bindgen_bad730ef968d4941
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_struct@
+foreign import ccall safe "hs_bindgen_24f835bba72f92a3" hs_bindgen_24f835bba72f92a3_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_struct@
+hs_bindgen_24f835bba72f92a3 ::
+     BG.CInt
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_24f835bba72f92a3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_24f835bba72f92a3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_struct =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_24f835bba72f92a3 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_union@
+foreign import ccall safe "hs_bindgen_d06661c0e9399cf0" hs_bindgen_d06661c0e9399cf0_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_union@
+hs_bindgen_d06661c0e9399cf0 ::
+     BG.CInt
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_d06661c0e9399cf0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d06661c0e9399cf0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_union =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_d06661c0e9399cf0 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_enum@
+foreign import ccall safe "hs_bindgen_d37243b7a8d9d58d" hs_bindgen_d37243b7a8d9d58d_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_enum@
+hs_bindgen_d37243b7a8d9d58d ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_d37243b7a8d9d58d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d37243b7a8d9d58d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_enum = hs_bindgen_d37243b7a8d9d58d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer1@
+foreign import ccall safe "hs_bindgen_b3bd6759641d67eb" hs_bindgen_b3bd6759641d67eb_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer1@
+hs_bindgen_b3bd6759641d67eb ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_b3bd6759641d67eb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b3bd6759641d67eb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer1 = hs_bindgen_b3bd6759641d67eb
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer2@
+foreign import ccall safe "hs_bindgen_97b00bc8a470fc69" hs_bindgen_97b00bc8a470fc69_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer2@
+hs_bindgen_97b00bc8a470fc69 ::
+     BG.CInt
+  -> BG.Ptr (BG.Ptr BG.CInt)
+  -> IO ()
+hs_bindgen_97b00bc8a470fc69 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_97b00bc8a470fc69_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr (BG.Ptr BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer2 = hs_bindgen_97b00bc8a470fc69
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer3@
+foreign import ccall safe "hs_bindgen_07e7d187d95f6ca2" hs_bindgen_07e7d187d95f6ca2_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer3@
+hs_bindgen_07e7d187d95f6ca2 ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+hs_bindgen_07e7d187d95f6ca2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_07e7d187d95f6ca2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @arg3@
+  -> IO ()
+args_pointer3 = hs_bindgen_07e7d187d95f6ca2
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_A@
+foreign import ccall safe "hs_bindgen_144178893e488066" hs_bindgen_144178893e488066_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_A@
+hs_bindgen_144178893e488066 :: IO BG.CInt
+hs_bindgen_144178893e488066 =
+  fmap BG.fromFFIType hs_bindgen_144178893e488066_base
+
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A :: IO BG.CInt
+ret_A = hs_bindgen_144178893e488066
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char1@
+foreign import ccall safe "hs_bindgen_d7d2bc68373545e4" hs_bindgen_d7d2bc68373545e4_base ::
+     BG.CInt
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char1@
+hs_bindgen_d7d2bc68373545e4 ::
+     BG.CInt
+  -> IO BG.CChar
+hs_bindgen_d7d2bc68373545e4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d7d2bc68373545e4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CChar
+ret_char1 = hs_bindgen_d7d2bc68373545e4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char2@
+foreign import ccall safe "hs_bindgen_aa47ca542df45b7b" hs_bindgen_aa47ca542df45b7b_base ::
+     BG.CInt
+  -> IO BG.CSChar
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char2@
+hs_bindgen_aa47ca542df45b7b ::
+     BG.CInt
+  -> IO BG.CSChar
+hs_bindgen_aa47ca542df45b7b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_aa47ca542df45b7b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CSChar
+ret_char2 = hs_bindgen_aa47ca542df45b7b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char3@
+foreign import ccall safe "hs_bindgen_bcc15cd6faf7b787" hs_bindgen_bcc15cd6faf7b787_base ::
+     BG.CInt
+  -> IO BG.CUChar
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char3@
+hs_bindgen_bcc15cd6faf7b787 ::
+     BG.CInt
+  -> IO BG.CUChar
+hs_bindgen_bcc15cd6faf7b787 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bcc15cd6faf7b787_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUChar
+ret_char3 = hs_bindgen_bcc15cd6faf7b787
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short1@
+foreign import ccall safe "hs_bindgen_4ba7217a94e5e369" hs_bindgen_4ba7217a94e5e369_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short1@
+hs_bindgen_4ba7217a94e5e369 ::
+     BG.CInt
+  -> IO BG.CShort
+hs_bindgen_4ba7217a94e5e369 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4ba7217a94e5e369_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short1 = hs_bindgen_4ba7217a94e5e369
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short2@
+foreign import ccall safe "hs_bindgen_ea4e41167ce3686a" hs_bindgen_ea4e41167ce3686a_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short2@
+hs_bindgen_ea4e41167ce3686a ::
+     BG.CInt
+  -> IO BG.CShort
+hs_bindgen_ea4e41167ce3686a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ea4e41167ce3686a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short2 = hs_bindgen_ea4e41167ce3686a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short3@
+foreign import ccall safe "hs_bindgen_b1021a4826d326a1" hs_bindgen_b1021a4826d326a1_base ::
+     BG.CInt
+  -> IO BG.CUShort
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short3@
+hs_bindgen_b1021a4826d326a1 ::
+     BG.CInt
+  -> IO BG.CUShort
+hs_bindgen_b1021a4826d326a1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b1021a4826d326a1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUShort
+ret_short3 = hs_bindgen_b1021a4826d326a1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int1@
+foreign import ccall safe "hs_bindgen_c23956482c29e1c5" hs_bindgen_c23956482c29e1c5_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int1@
+hs_bindgen_c23956482c29e1c5 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_c23956482c29e1c5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c23956482c29e1c5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int1 = hs_bindgen_c23956482c29e1c5
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int2@
+foreign import ccall safe "hs_bindgen_76475f626bf1d429" hs_bindgen_76475f626bf1d429_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int2@
+hs_bindgen_76475f626bf1d429 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_76475f626bf1d429 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_76475f626bf1d429_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int2 = hs_bindgen_76475f626bf1d429
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int3@
+foreign import ccall safe "hs_bindgen_e86e93b147924e4a" hs_bindgen_e86e93b147924e4a_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int3@
+hs_bindgen_e86e93b147924e4a ::
+     BG.CInt
+  -> IO BG.CUInt
+hs_bindgen_e86e93b147924e4a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e86e93b147924e4a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUInt
+ret_int3 = hs_bindgen_e86e93b147924e4a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long1@
+foreign import ccall safe "hs_bindgen_2e5e9b9d09a32b33" hs_bindgen_2e5e9b9d09a32b33_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long1@
+hs_bindgen_2e5e9b9d09a32b33 ::
+     BG.CInt
+  -> IO BG.CLong
+hs_bindgen_2e5e9b9d09a32b33 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2e5e9b9d09a32b33_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long1 = hs_bindgen_2e5e9b9d09a32b33
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long2@
+foreign import ccall safe "hs_bindgen_9541cb65d260ceec" hs_bindgen_9541cb65d260ceec_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long2@
+hs_bindgen_9541cb65d260ceec ::
+     BG.CInt
+  -> IO BG.CLong
+hs_bindgen_9541cb65d260ceec =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9541cb65d260ceec_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long2 = hs_bindgen_9541cb65d260ceec
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long3@
+foreign import ccall safe "hs_bindgen_fca665017c551d32" hs_bindgen_fca665017c551d32_base ::
+     BG.CInt
+  -> IO BG.CULong
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long3@
+hs_bindgen_fca665017c551d32 ::
+     BG.CInt
+  -> IO BG.CULong
+hs_bindgen_fca665017c551d32 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fca665017c551d32_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CULong
+ret_long3 = hs_bindgen_fca665017c551d32
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_float@
+foreign import ccall safe "hs_bindgen_06152a76d70abec3" hs_bindgen_06152a76d70abec3_base ::
+     BG.CInt
+  -> IO BG.CFloat
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_float@
+hs_bindgen_06152a76d70abec3 ::
+     BG.CInt
+  -> IO BG.CFloat
+hs_bindgen_06152a76d70abec3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_06152a76d70abec3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CFloat
+ret_float = hs_bindgen_06152a76d70abec3
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_double@
+foreign import ccall safe "hs_bindgen_fcbb5b65a6e8dee4" hs_bindgen_fcbb5b65a6e8dee4_base ::
+     BG.CInt
+  -> IO BG.CDouble
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_double@
+hs_bindgen_fcbb5b65a6e8dee4 ::
+     BG.CInt
+  -> IO BG.CDouble
+hs_bindgen_fcbb5b65a6e8dee4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fcbb5b65a6e8dee4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CDouble
+ret_double = hs_bindgen_fcbb5b65a6e8dee4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_bool1@
+foreign import ccall safe "hs_bindgen_d2265e448c2759e9" hs_bindgen_d2265e448c2759e9_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_bool1@
+hs_bindgen_d2265e448c2759e9 ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_d2265e448c2759e9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d2265e448c2759e9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+ret_bool1 = hs_bindgen_d2265e448c2759e9
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_struct@
+foreign import ccall safe "hs_bindgen_e6010e994241dd23" hs_bindgen_e6010e994241dd23_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_struct@
+hs_bindgen_e6010e994241dd23 ::
+     BG.CInt
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_e6010e994241dd23 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e6010e994241dd23_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_struct
+ret_struct =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_e6010e994241dd23 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_union@
+foreign import ccall safe "hs_bindgen_00be97ea5e3606e4" hs_bindgen_00be97ea5e3606e4_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_union@
+hs_bindgen_00be97ea5e3606e4 ::
+     BG.CInt
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_00be97ea5e3606e4 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_00be97ea5e3606e4_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_union
+ret_union =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_00be97ea5e3606e4 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_enum@
+foreign import ccall safe "hs_bindgen_7ad2540b7cf6b817" hs_bindgen_7ad2540b7cf6b817_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_enum@
+hs_bindgen_7ad2540b7cf6b817 ::
+     BG.CInt
+  -> IO Some_enum
+hs_bindgen_7ad2540b7cf6b817 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7ad2540b7cf6b817_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_enum
+ret_enum = hs_bindgen_7ad2540b7cf6b817
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer1@
+foreign import ccall safe "hs_bindgen_6dba6060a7ca10de" hs_bindgen_6dba6060a7ca10de_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer1@
+hs_bindgen_6dba6060a7ca10de ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_6dba6060a7ca10de =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6dba6060a7ca10de_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+ret_pointer1 = hs_bindgen_6dba6060a7ca10de
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer2@
+foreign import ccall safe "hs_bindgen_7af2522218790e65" hs_bindgen_7af2522218790e65_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer2@
+hs_bindgen_7af2522218790e65 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_7af2522218790e65 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7af2522218790e65_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+ret_pointer2 = hs_bindgen_7af2522218790e65
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer3@
+foreign import ccall safe "hs_bindgen_88562aa8f53d0780" hs_bindgen_88562aa8f53d0780_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer3@
+hs_bindgen_88562aa8f53d0780 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_88562aa8f53d0780 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_88562aa8f53d0780_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.Void)
+ret_pointer3 = hs_bindgen_88562aa8f53d0780
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body1@
+foreign import ccall safe "hs_bindgen_b9b614c706b250e5" hs_bindgen_b9b614c706b250e5_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body1@
+hs_bindgen_b9b614c706b250e5 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_b9b614c706b250e5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b9b614c706b250e5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+body1 = hs_bindgen_b9b614c706b250e5
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body2@
+foreign import ccall safe "hs_bindgen_b0559ae62627b030" hs_bindgen_b0559ae62627b030_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body2@
+hs_bindgen_b0559ae62627b030 :: IO BG.CInt
+hs_bindgen_b0559ae62627b030 =
+  fmap BG.fromFFIType hs_bindgen_b0559ae62627b030_base
+
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2 :: IO BG.CInt
+body2 = hs_bindgen_b0559ae62627b030
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_float@
+foreign import ccall safe "hs_bindgen_ddfc5cefdbda545b" hs_bindgen_ddfc5cefdbda545b_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_float@
+hs_bindgen_ddfc5cefdbda545b ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_ddfc5cefdbda545b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ddfc5cefdbda545b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_float =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_ddfc5cefdbda545b arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_double@
+foreign import ccall safe "hs_bindgen_cbf4ca3c6e7f80aa" hs_bindgen_cbf4ca3c6e7f80aa_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_double@
+hs_bindgen_cbf4ca3c6e7f80aa ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_cbf4ca3c6e7f80aa =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_cbf4ca3c6e7f80aa_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_double =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_cbf4ca3c6e7f80aa arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_float@
+foreign import ccall safe "hs_bindgen_0f1f6ea0917ce0ca" hs_bindgen_0f1f6ea0917ce0ca_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_float@
+hs_bindgen_0f1f6ea0917ce0ca ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_0f1f6ea0917ce0ca =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0f1f6ea0917ce0ca_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CFloat)
+ret_complex_float =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_0f1f6ea0917ce0ca arg10 res1)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_double@
+foreign import ccall safe "hs_bindgen_955f1c0b383d9a7c" hs_bindgen_955f1c0b383d9a7c_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_double@
+hs_bindgen_955f1c0b383d9a7c ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_955f1c0b383d9a7c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_955f1c0b383d9a7c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CDouble)
+ret_complex_double =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_955f1c0b383d9a7c arg10 res1)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args1@
+foreign import ccall safe "hs_bindgen_61695282305a53ac" hs_bindgen_61695282305a53ac_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args1@
+hs_bindgen_61695282305a53ac ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_61695282305a53ac =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_61695282305a53ac_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args1 = hs_bindgen_61695282305a53ac
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args2@
+foreign import ccall safe "hs_bindgen_4c244649666e88b3" hs_bindgen_4c244649666e88b3_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args2@
+hs_bindgen_4c244649666e88b3 ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_4c244649666e88b3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4c244649666e88b3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args2 = hs_bindgen_4c244649666e88b3
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret1@
+foreign import ccall safe "hs_bindgen_1b4cd50ca08ff13a" hs_bindgen_1b4cd50ca08ff13a_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret1@
+hs_bindgen_1b4cd50ca08ff13a ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_1b4cd50ca08ff13a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1b4cd50ca08ff13a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+bespoke_ret1 = hs_bindgen_1b4cd50ca08ff13a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret2@
+foreign import ccall safe "hs_bindgen_71b4f4a34ec749c5" hs_bindgen_71b4f4a34ec749c5_base ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret2@
+hs_bindgen_71b4f4a34ec749c5 ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_71b4f4a34ec749c5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_71b4f4a34ec749c5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO HsBindgen.Runtime.LibC.CSize
+bespoke_ret2 = hs_bindgen_71b4f4a34ec749c5
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args1@
+foreign import ccall safe "hs_bindgen_8588314c8f45b7e1" hs_bindgen_8588314c8f45b7e1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args1@
+hs_bindgen_8588314c8f45b7e1 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_8588314c8f45b7e1 =
+  \x0 ->
+    hs_bindgen_8588314c8f45b7e1_base (BG.toFFIType x0)
+
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args1 = hs_bindgen_8588314c8f45b7e1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args2@
+foreign import ccall safe "hs_bindgen_2eb08d216276c1b7" hs_bindgen_2eb08d216276c1b7_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args2@
+hs_bindgen_2eb08d216276c1b7 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_2eb08d216276c1b7 =
+  \x0 ->
+    hs_bindgen_2eb08d216276c1b7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args2 = hs_bindgen_2eb08d216276c1b7
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args3@
+foreign import ccall safe "hs_bindgen_9e0ebe19b98832b7" hs_bindgen_9e0ebe19b98832b7_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args3@
+hs_bindgen_9e0ebe19b98832b7 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt))
+  -> IO ()
+hs_bindgen_9e0ebe19b98832b7 =
+  \x0 ->
+    hs_bindgen_9e0ebe19b98832b7_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args3 = hs_bindgen_9e0ebe19b98832b7
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args4@
+foreign import ccall safe "hs_bindgen_46bbe5c4f9a7db28" hs_bindgen_46bbe5c4f9a7db28_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args4@
+hs_bindgen_46bbe5c4f9a7db28 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_46bbe5c4f9a7db28 =
+  \x0 ->
+    hs_bindgen_46bbe5c4f9a7db28_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args4 = hs_bindgen_46bbe5c4f9a7db28
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args1@
+foreign import ccall safe "hs_bindgen_38985300d47b4487" hs_bindgen_38985300d47b4487_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args1@
+hs_bindgen_38985300d47b4487 ::
+     BG.CInt
+  -> BG.FunPtr (IO ())
+  -> IO ()
+hs_bindgen_38985300d47b4487 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_38985300d47b4487_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args1 = hs_bindgen_38985300d47b4487
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args2@
+foreign import ccall safe "hs_bindgen_23d1626952d2a132" hs_bindgen_23d1626952d2a132_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args2@
+hs_bindgen_23d1626952d2a132 ::
+     BG.CInt
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_23d1626952d2a132 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_23d1626952d2a132_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args2 = hs_bindgen_23d1626952d2a132
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args3@
+foreign import ccall safe "hs_bindgen_69073b33110db81a" hs_bindgen_69073b33110db81a_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args3@
+hs_bindgen_69073b33110db81a ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_69073b33110db81a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_69073b33110db81a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args3 = hs_bindgen_69073b33110db81a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args4@
+foreign import ccall safe "hs_bindgen_9e6495d8345f7848" hs_bindgen_9e6495d8345f7848_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args4@
+hs_bindgen_9e6495d8345f7848 ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+  -> IO ()
+hs_bindgen_9e6495d8345f7848 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9e6495d8345f7848_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args4 = hs_bindgen_9e6495d8345f7848
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args5@
+foreign import ccall safe "hs_bindgen_d5ab1b462ff6c176" hs_bindgen_d5ab1b462ff6c176_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args5@
+hs_bindgen_d5ab1b462ff6c176 ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+  -> IO ()
+hs_bindgen_d5ab1b462ff6c176 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d5ab1b462ff6c176_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args5 = hs_bindgen_d5ab1b462ff6c176
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_comments1@
+foreign import ccall safe "hs_bindgen_17cfdc4afa81f262" hs_bindgen_17cfdc4afa81f262_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_comments1@
+hs_bindgen_17cfdc4afa81f262 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_17cfdc4afa81f262 =
+  \x0 ->
+    hs_bindgen_17cfdc4afa81f262_base (BG.toFFIType x0)
+
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+comments1 = hs_bindgen_17cfdc4afa81f262
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before1@
+foreign import ccall safe "hs_bindgen_62dad052d7ac99e6" hs_bindgen_62dad052d7ac99e6_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before1@
+hs_bindgen_62dad052d7ac99e6 ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_62dad052d7ac99e6 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_62dad052d7ac99e6_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before1 = hs_bindgen_62dad052d7ac99e6
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before2@
+foreign import ccall safe "hs_bindgen_6a954623e8847292" hs_bindgen_6a954623e8847292_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before2@
+hs_bindgen_6a954623e8847292 ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_6a954623e8847292 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6a954623e8847292_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before2 = hs_bindgen_6a954623e8847292
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before3@
+foreign import ccall safe "hs_bindgen_5c4e5530b1f695b7" hs_bindgen_5c4e5530b1f695b7_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before3@
+hs_bindgen_5c4e5530b1f695b7 ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_5c4e5530b1f695b7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5c4e5530b1f695b7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before3 = hs_bindgen_5c4e5530b1f695b7
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after1@
+foreign import ccall safe "hs_bindgen_d219b88b917d72cf" hs_bindgen_d219b88b917d72cf_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after1@
+hs_bindgen_d219b88b917d72cf ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_d219b88b917d72cf =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d219b88b917d72cf_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after1 = hs_bindgen_d219b88b917d72cf
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after2@
+foreign import ccall safe "hs_bindgen_79a466a4f64a4db1" hs_bindgen_79a466a4f64a4db1_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after2@
+hs_bindgen_79a466a4f64a4db1 ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_79a466a4f64a4db1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_79a466a4f64a4db1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after2 = hs_bindgen_79a466a4f64a4db1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after3@
+foreign import ccall safe "hs_bindgen_a13884c8125a5f80" hs_bindgen_a13884c8125a5f80_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after3@
+hs_bindgen_a13884c8125a5f80 ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_a13884c8125a5f80 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a13884c8125a5f80_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after3 = hs_bindgen_a13884c8125a5f80
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before1@
+foreign import ccall safe "hs_bindgen_5433c1896cba42d3" hs_bindgen_5433c1896cba42d3_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before1@
+hs_bindgen_5433c1896cba42d3 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_5433c1896cba42d3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5433c1896cba42d3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before1 =
+  hs_bindgen_5433c1896cba42d3
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before2@
+foreign import ccall safe "hs_bindgen_8300ce11589589f2" hs_bindgen_8300ce11589589f2_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before2@
+hs_bindgen_8300ce11589589f2 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_8300ce11589589f2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8300ce11589589f2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before2 =
+  hs_bindgen_8300ce11589589f2
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before3@
+foreign import ccall safe "hs_bindgen_be304ec839983d7b" hs_bindgen_be304ec839983d7b_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before3@
+hs_bindgen_be304ec839983d7b ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_be304ec839983d7b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_be304ec839983d7b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before3 =
+  hs_bindgen_be304ec839983d7b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before4@
+foreign import ccall safe "hs_bindgen_445a2c238c734060" hs_bindgen_445a2c238c734060_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before4@
+hs_bindgen_445a2c238c734060 ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_445a2c238c734060 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_445a2c238c734060_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_445a2c238c734060 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before5@
+foreign import ccall safe "hs_bindgen_b5a05c2c1589c243" hs_bindgen_b5a05c2c1589c243_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before5@
+hs_bindgen_b5a05c2c1589c243 ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_b5a05c2c1589c243 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b5a05c2c1589c243_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_b5a05c2c1589c243 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before6@
+foreign import ccall safe "hs_bindgen_8217e6e9e19e7627" hs_bindgen_8217e6e9e19e7627_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before6@
+hs_bindgen_8217e6e9e19e7627 ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_8217e6e9e19e7627 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8217e6e9e19e7627_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before6 =
+  hs_bindgen_8217e6e9e19e7627
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before7@
+foreign import ccall safe "hs_bindgen_cbcb3411df130b42" hs_bindgen_cbcb3411df130b42_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before7@
+hs_bindgen_cbcb3411df130b42 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_cbcb3411df130b42 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_cbcb3411df130b42_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before7 =
+  hs_bindgen_cbcb3411df130b42
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before8@
+foreign import ccall safe "hs_bindgen_fb0ddd12de072fd8" hs_bindgen_fb0ddd12de072fd8_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before8@
+hs_bindgen_fb0ddd12de072fd8 ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_fb0ddd12de072fd8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_fb0ddd12de072fd8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before8 =
+  hs_bindgen_fb0ddd12de072fd8
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after1@
+foreign import ccall safe "hs_bindgen_91e81e2ec29aa772" hs_bindgen_91e81e2ec29aa772_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after1@
+hs_bindgen_91e81e2ec29aa772 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_91e81e2ec29aa772 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_91e81e2ec29aa772_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after1 =
+  hs_bindgen_91e81e2ec29aa772
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after2@
+foreign import ccall safe "hs_bindgen_6703a37e4fd098b1" hs_bindgen_6703a37e4fd098b1_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after2@
+hs_bindgen_6703a37e4fd098b1 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_6703a37e4fd098b1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6703a37e4fd098b1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after2 =
+  hs_bindgen_6703a37e4fd098b1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after3@
+foreign import ccall safe "hs_bindgen_054259024219dbcc" hs_bindgen_054259024219dbcc_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after3@
+hs_bindgen_054259024219dbcc ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_054259024219dbcc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_054259024219dbcc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after3 =
+  hs_bindgen_054259024219dbcc
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after4@
+foreign import ccall safe "hs_bindgen_eb4880610136c7bb" hs_bindgen_eb4880610136c7bb_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after4@
+hs_bindgen_eb4880610136c7bb ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_eb4880610136c7bb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_eb4880610136c7bb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_eb4880610136c7bb arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after5@
+foreign import ccall safe "hs_bindgen_c0478c5f65c7e32e" hs_bindgen_c0478c5f65c7e32e_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after5@
+hs_bindgen_c0478c5f65c7e32e ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_c0478c5f65c7e32e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c0478c5f65c7e32e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_c0478c5f65c7e32e arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after6@
+foreign import ccall safe "hs_bindgen_764dd29ada03ac05" hs_bindgen_764dd29ada03ac05_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after6@
+hs_bindgen_764dd29ada03ac05 ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_764dd29ada03ac05 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_764dd29ada03ac05_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after6 =
+  hs_bindgen_764dd29ada03ac05
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after7@
+foreign import ccall safe "hs_bindgen_62f2db62740aa47c" hs_bindgen_62f2db62740aa47c_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after7@
+hs_bindgen_62f2db62740aa47c ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_62f2db62740aa47c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_62f2db62740aa47c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after7 =
+  hs_bindgen_62f2db62740aa47c
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after8@
+foreign import ccall safe "hs_bindgen_f9349cbf0c433984" hs_bindgen_f9349cbf0c433984_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after8@
+hs_bindgen_f9349cbf0c433984 ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_f9349cbf0c433984 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f9349cbf0c433984_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after8 =
+  hs_bindgen_f9349cbf0c433984
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args1@
+foreign import ccall safe "hs_bindgen_05103ac5c64a70c5" hs_bindgen_05103ac5c64a70c5_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args1@
+hs_bindgen_05103ac5c64a70c5 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_05103ac5c64a70c5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_05103ac5c64a70c5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args1 = hs_bindgen_05103ac5c64a70c5
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args2@
+foreign import ccall safe "hs_bindgen_2adbdab03502d7c3" hs_bindgen_2adbdab03502d7c3_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args2@
+hs_bindgen_2adbdab03502d7c3 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_2adbdab03502d7c3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2adbdab03502d7c3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args2 = hs_bindgen_2adbdab03502d7c3
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args3@
+foreign import ccall safe "hs_bindgen_02735f713f3663a0" hs_bindgen_02735f713f3663a0_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args3@
+hs_bindgen_02735f713f3663a0 ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_02735f713f3663a0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_02735f713f3663a0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args3 = hs_bindgen_02735f713f3663a0
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args4@
+foreign import ccall safe "hs_bindgen_7be4b56f499736ec" hs_bindgen_7be4b56f499736ec_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args4@
+hs_bindgen_7be4b56f499736ec ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_7be4b56f499736ec =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7be4b56f499736ec_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args4 = hs_bindgen_7be4b56f499736ec
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args5@
+foreign import ccall safe "hs_bindgen_07806340121e9d7a" hs_bindgen_07806340121e9d7a_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args5@
+hs_bindgen_07806340121e9d7a ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_07806340121e9d7a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_07806340121e9d7a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args5 = hs_bindgen_07806340121e9d7a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret1@
+foreign import ccall safe "hs_bindgen_964ecbd6daab3ac8" hs_bindgen_964ecbd6daab3ac8_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret1@
+hs_bindgen_964ecbd6daab3ac8 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_964ecbd6daab3ac8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_964ecbd6daab3ac8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret1 = hs_bindgen_964ecbd6daab3ac8
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret2@
+foreign import ccall safe "hs_bindgen_425aa26fa3f15a85" hs_bindgen_425aa26fa3f15a85_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret2@
+hs_bindgen_425aa26fa3f15a85 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_425aa26fa3f15a85 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_425aa26fa3f15a85_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret2 = hs_bindgen_425aa26fa3f15a85
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret3@
+foreign import ccall safe "hs_bindgen_35dc6a2376f4669c" hs_bindgen_35dc6a2376f4669c_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret3@
+hs_bindgen_35dc6a2376f4669c ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_35dc6a2376f4669c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_35dc6a2376f4669c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+const_pointers_ret3 = hs_bindgen_35dc6a2376f4669c
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret4@
+foreign import ccall safe "hs_bindgen_b4704a8e3fa5c1a7" hs_bindgen_b4704a8e3fa5c1a7_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret4@
+hs_bindgen_b4704a8e3fa5c1a7 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_b4704a8e3fa5c1a7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b4704a8e3fa5c1a7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret4 = hs_bindgen_b4704a8e3fa5c1a7
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret5@
+foreign import ccall safe "hs_bindgen_eee06f696926bceb" hs_bindgen_eee06f696926bceb_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret5@
+hs_bindgen_eee06f696926bceb ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_eee06f696926bceb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_eee06f696926bceb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret5 = hs_bindgen_eee06f696926bceb
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem1@
+foreign import ccall safe "hs_bindgen_85897c18c4db8c38" hs_bindgen_85897c18c4db8c38_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem1@
+hs_bindgen_85897c18c4db8c38 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_85897c18c4db8c38 =
+  \x0 ->
+    hs_bindgen_85897c18c4db8c38_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem1 = hs_bindgen_85897c18c4db8c38
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem2@
+foreign import ccall safe "hs_bindgen_7d19c28372388bd5" hs_bindgen_7d19c28372388bd5_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem2@
+hs_bindgen_7d19c28372388bd5 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt)))
+  -> IO ()
+hs_bindgen_7d19c28372388bd5 =
+  \x0 ->
+    hs_bindgen_7d19c28372388bd5_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem2 = hs_bindgen_7d19c28372388bd5
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem3@
+foreign import ccall safe "hs_bindgen_b72db4cfe06fec75" hs_bindgen_b72db4cfe06fec75_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem3@
+hs_bindgen_b72db4cfe06fec75 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_b72db4cfe06fec75 =
+  \x0 ->
+    hs_bindgen_b72db4cfe06fec75_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem3 = hs_bindgen_b72db4cfe06fec75
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams1@
+foreign import ccall safe "hs_bindgen_8c2d8b6c768235a6" hs_bindgen_8c2d8b6c768235a6_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams1@
+hs_bindgen_8c2d8b6c768235a6 :: IO BG.CInt
+hs_bindgen_8c2d8b6c768235a6 =
+  fmap BG.fromFFIType hs_bindgen_8c2d8b6c768235a6_base
+
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1 :: IO BG.CInt
+noParams1 = hs_bindgen_8c2d8b6c768235a6
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams2@
+foreign import ccall safe "hs_bindgen_f406093f4244470f" hs_bindgen_f406093f4244470f_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams2@
+hs_bindgen_f406093f4244470f :: IO BG.CInt
+hs_bindgen_f406093f4244470f =
+  fmap BG.fromFFIType hs_bindgen_f406093f4244470f_base
+
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2 :: IO BG.CInt
+noParams2 = hs_bindgen_f406093f4244470f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams3@
+foreign import ccall safe "hs_bindgen_7cfe278ffc125a35" hs_bindgen_7cfe278ffc125a35_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams3@
+hs_bindgen_7cfe278ffc125a35 ::
+     BG.CInt
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_7cfe278ffc125a35 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7cfe278ffc125a35_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+noParams3 = hs_bindgen_7cfe278ffc125a35
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret1@
+foreign import ccall safe "hs_bindgen_6f95516796104481" hs_bindgen_6f95516796104481_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret1@
+hs_bindgen_6f95516796104481 ::
+     BG.CInt
+  -> IO (BG.FunPtr (IO ()))
+hs_bindgen_6f95516796104481 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6f95516796104481_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO ()))
+funptr_ret1 = hs_bindgen_6f95516796104481
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret2@
+foreign import ccall safe "hs_bindgen_c823e0311ec509b4" hs_bindgen_c823e0311ec509b4_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret2@
+hs_bindgen_c823e0311ec509b4 ::
+     BG.CInt
+  -> IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_c823e0311ec509b4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c823e0311ec509b4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO BG.CInt))
+funptr_ret2 = hs_bindgen_c823e0311ec509b4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret3@
+foreign import ccall safe "hs_bindgen_94550ec4aba19f7b" hs_bindgen_94550ec4aba19f7b_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret3@
+hs_bindgen_94550ec4aba19f7b ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_94550ec4aba19f7b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_94550ec4aba19f7b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+funptr_ret3 = hs_bindgen_94550ec4aba19f7b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret4@
+foreign import ccall safe "hs_bindgen_ed3e6ebe628da423" hs_bindgen_ed3e6ebe628da423_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret4@
+hs_bindgen_ed3e6ebe628da423 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+hs_bindgen_ed3e6ebe628da423 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ed3e6ebe628da423_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+funptr_ret4 = hs_bindgen_ed3e6ebe628da423
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret5@
+foreign import ccall safe "hs_bindgen_cb5a94e6610ff83d" hs_bindgen_cb5a94e6610ff83d_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret5@
+hs_bindgen_cb5a94e6610ff83d ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_cb5a94e6610ff83d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cb5a94e6610ff83d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret5 = hs_bindgen_cb5a94e6610ff83d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret6@
+foreign import ccall safe "hs_bindgen_8cd3005394354b86" hs_bindgen_8cd3005394354b86_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret6@
+hs_bindgen_8cd3005394354b86 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_8cd3005394354b86 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8cd3005394354b86_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret6 = hs_bindgen_8cd3005394354b86
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret7@
+foreign import ccall safe "hs_bindgen_0f1393247fcdeb7a" hs_bindgen_0f1393247fcdeb7a_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret7@
+hs_bindgen_0f1393247fcdeb7a ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_0f1393247fcdeb7a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0f1393247fcdeb7a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret7 = hs_bindgen_0f1393247fcdeb7a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret8@
+foreign import ccall safe "hs_bindgen_7da05d4b5c843853" hs_bindgen_7da05d4b5c843853_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret8@
+hs_bindgen_7da05d4b5c843853 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_7da05d4b5c843853 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7da05d4b5c843853_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret8 = hs_bindgen_7da05d4b5c843853
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret9@
+foreign import ccall safe "hs_bindgen_f6f304c980603aae" hs_bindgen_f6f304c980603aae_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret9@
+hs_bindgen_f6f304c980603aae ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_f6f304c980603aae =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f6f304c980603aae_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret9 = hs_bindgen_f6f304c980603aae
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret10@
+foreign import ccall safe "hs_bindgen_263377d0e4be3901" hs_bindgen_263377d0e4be3901_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret10@
+hs_bindgen_263377d0e4be3901 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_263377d0e4be3901 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_263377d0e4be3901_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret10 = hs_bindgen_263377d0e4be3901
diff --git a/test-artefacts/fixtures/macros/reparse.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.2.raw/Example/Unsafe.hs
@@ -0,0 +1,4006 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.args_char1
+    , Example.Unsafe.args_char2
+    , Example.Unsafe.args_char3
+    , Example.Unsafe.args_short1
+    , Example.Unsafe.args_short2
+    , Example.Unsafe.args_short3
+    , Example.Unsafe.args_int1
+    , Example.Unsafe.args_int2
+    , Example.Unsafe.args_int3
+    , Example.Unsafe.args_long1
+    , Example.Unsafe.args_long2
+    , Example.Unsafe.args_long3
+    , Example.Unsafe.args_float
+    , Example.Unsafe.args_double
+    , Example.Unsafe.args_bool1
+    , Example.Unsafe.args_struct
+    , Example.Unsafe.args_union
+    , Example.Unsafe.args_enum
+    , Example.Unsafe.args_pointer1
+    , Example.Unsafe.args_pointer2
+    , Example.Unsafe.args_pointer3
+    , Example.Unsafe.ret_A
+    , Example.Unsafe.ret_char1
+    , Example.Unsafe.ret_char2
+    , Example.Unsafe.ret_char3
+    , Example.Unsafe.ret_short1
+    , Example.Unsafe.ret_short2
+    , Example.Unsafe.ret_short3
+    , Example.Unsafe.ret_int1
+    , Example.Unsafe.ret_int2
+    , Example.Unsafe.ret_int3
+    , Example.Unsafe.ret_long1
+    , Example.Unsafe.ret_long2
+    , Example.Unsafe.ret_long3
+    , Example.Unsafe.ret_float
+    , Example.Unsafe.ret_double
+    , Example.Unsafe.ret_bool1
+    , Example.Unsafe.ret_struct
+    , Example.Unsafe.ret_union
+    , Example.Unsafe.ret_enum
+    , Example.Unsafe.ret_pointer1
+    , Example.Unsafe.ret_pointer2
+    , Example.Unsafe.ret_pointer3
+    , Example.Unsafe.body1
+    , Example.Unsafe.body2
+    , Example.Unsafe.args_complex_float
+    , Example.Unsafe.args_complex_double
+    , Example.Unsafe.ret_complex_float
+    , Example.Unsafe.ret_complex_double
+    , Example.Unsafe.bespoke_args1
+    , Example.Unsafe.bespoke_args2
+    , Example.Unsafe.bespoke_ret1
+    , Example.Unsafe.bespoke_ret2
+    , Example.Unsafe.arr_args1
+    , Example.Unsafe.arr_args2
+    , Example.Unsafe.arr_args3
+    , Example.Unsafe.arr_args4
+    , Example.Unsafe.funptr_args1
+    , Example.Unsafe.funptr_args2
+    , Example.Unsafe.funptr_args3
+    , Example.Unsafe.funptr_args4
+    , Example.Unsafe.funptr_args5
+    , Example.Unsafe.comments1
+    , Example.Unsafe.const_prim_before1
+    , Example.Unsafe.const_prim_before2
+    , Example.Unsafe.const_prim_before3
+    , Example.Unsafe.const_prim_after1
+    , Example.Unsafe.const_prim_after2
+    , Example.Unsafe.const_prim_after3
+    , Example.Unsafe.const_withoutSign_before1
+    , Example.Unsafe.const_withoutSign_before2
+    , Example.Unsafe.const_withoutSign_before3
+    , Example.Unsafe.const_withoutSign_before4
+    , Example.Unsafe.const_withoutSign_before5
+    , Example.Unsafe.const_withoutSign_before6
+    , Example.Unsafe.const_withoutSign_before7
+    , Example.Unsafe.const_withoutSign_before8
+    , Example.Unsafe.const_withoutSign_after1
+    , Example.Unsafe.const_withoutSign_after2
+    , Example.Unsafe.const_withoutSign_after3
+    , Example.Unsafe.const_withoutSign_after4
+    , Example.Unsafe.const_withoutSign_after5
+    , Example.Unsafe.const_withoutSign_after6
+    , Example.Unsafe.const_withoutSign_after7
+    , Example.Unsafe.const_withoutSign_after8
+    , Example.Unsafe.const_pointers_args1
+    , Example.Unsafe.const_pointers_args2
+    , Example.Unsafe.const_pointers_args3
+    , Example.Unsafe.const_pointers_args4
+    , Example.Unsafe.const_pointers_args5
+    , Example.Unsafe.const_pointers_ret1
+    , Example.Unsafe.const_pointers_ret2
+    , Example.Unsafe.const_pointers_ret3
+    , Example.Unsafe.const_pointers_ret4
+    , Example.Unsafe.const_pointers_ret5
+    , Example.Unsafe.const_array_elem1
+    , Example.Unsafe.const_array_elem2
+    , Example.Unsafe.const_array_elem3
+    , Example.Unsafe.noParams1
+    , Example.Unsafe.noParams2
+    , Example.Unsafe.noParams3
+    , Example.Unsafe.funptr_ret1
+    , Example.Unsafe.funptr_ret2
+    , Example.Unsafe.funptr_ret3
+    , Example.Unsafe.funptr_ret4
+    , Example.Unsafe.funptr_ret5
+    , Example.Unsafe.funptr_ret6
+    , Example.Unsafe.funptr_ret7
+    , Example.Unsafe.funptr_ret8
+    , Example.Unsafe.funptr_ret9
+    , Example.Unsafe.funptr_ret10
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "void hs_bindgen_dbcf45ae88784a43 ("
+  , "  signed int arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (args_char1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c72087f2b9c0a851 ("
+  , "  signed int arg1,"
+  , "  signed char arg2"
+  , ")"
+  , "{"
+  , "  (args_char2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d23034ca037d7ee2 ("
+  , "  signed int arg1,"
+  , "  unsigned char arg2"
+  , ")"
+  , "{"
+  , "  (args_char3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_7aba582bac3cdd4c ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_72e80c0c19b73bd1 ("
+  , "  signed int arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1d779b6db021542e ("
+  , "  signed int arg1,"
+  , "  unsigned short arg2"
+  , ")"
+  , "{"
+  , "  (args_short3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_dadb0390936fa7a6 ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_cc4dd71da3d83f3e ("
+  , "  signed int arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c1aa1895338c9c06 ("
+  , "  signed int arg1,"
+  , "  unsigned int arg2"
+  , ")"
+  , "{"
+  , "  (args_int3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ea3ab52d35940c9c ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1ead52aa138d51cf ("
+  , "  signed int arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_93b713dccaf06fed ("
+  , "  signed int arg1,"
+  , "  unsigned long arg2"
+  , ")"
+  , "{"
+  , "  (args_long3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d091d2dc36843d19 ("
+  , "  signed int arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  (args_float)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6ea5acb5ec6f40c4 ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  (args_double)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_689ef6ac4e916b3a ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (args_bool1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3d21d6b68f84eba6 ("
+  , "  signed int arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  (args_struct)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_6c2746bae9e4dab9 ("
+  , "  signed int arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  (args_union)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_6c549405e9baffcf ("
+  , "  signed int arg1,"
+  , "  enum some_enum arg2"
+  , ")"
+  , "{"
+  , "  (args_enum)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_34dfa5eaf97951ec ("
+  , "  signed int arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0d71e7152a20efbd ("
+  , "  signed int arg1,"
+  , "  signed int **arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1ac8f30e6858a673 ("
+  , "  signed int arg1,"
+  , "  void *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer3)(arg1, arg2);"
+  , "}"
+  , "signed int hs_bindgen_74c085d1fc547d65 (void)"
+  , "{"
+  , "  return (ret_A)();"
+  , "}"
+  , "char hs_bindgen_c1173d352155de62 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char1)(arg1);"
+  , "}"
+  , "signed char hs_bindgen_9029d84b81d6df97 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char2)(arg1);"
+  , "}"
+  , "unsigned char hs_bindgen_5076ef968e0b1da6 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char3)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_6c9415155d57e014 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short1)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_24f9af60f9d4b0c4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short2)(arg1);"
+  , "}"
+  , "unsigned short hs_bindgen_7712cc06577c000f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_a4669df8abb549dc ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d471d89e2802f599 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int2)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_551866464fb7e076 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int3)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_1cb0ba330b8fc708 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long1)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_84d65e5f2bb20468 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long2)(arg1);"
+  , "}"
+  , "unsigned long hs_bindgen_8e5c7c7b2f385152 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long3)(arg1);"
+  , "}"
+  , "float hs_bindgen_be7b5328fb1e67e4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_float)(arg1);"
+  , "}"
+  , "double hs_bindgen_67ccecb1f4c2b26b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_double)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_8f3058d29b19c7f8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_bool1)(arg1);"
+  , "}"
+  , "void hs_bindgen_db41d471db80076d ("
+  , "  signed int arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_struct)(arg1);"
+  , "}"
+  , "void hs_bindgen_a2761d3935650b5c ("
+  , "  signed int arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_union)(arg1);"
+  , "}"
+  , "enum some_enum hs_bindgen_c567484984a48bdd ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_enum)(arg1);"
+  , "}"
+  , "signed int *hs_bindgen_a0436717a3858ec2 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer1)(arg1);"
+  , "}"
+  , "signed int **hs_bindgen_92e30e7cf97b7ae8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer2)(arg1);"
+  , "}"
+  , "void *hs_bindgen_cec80a82e028945d ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_373d2dbedb7f3ea1 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (body1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_678c705d71b66fd0 (void)"
+  , "{"
+  , "  return (body2)();"
+  , "}"
+  , "void hs_bindgen_4a4cdf60b6a4885d ("
+  , "  signed int arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_float)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_4b113ac08bbb35bd ("
+  , "  signed int arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_double)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_63483820a803fad0 ("
+  , "  signed int arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_float)(arg1);"
+  , "}"
+  , "void hs_bindgen_00dc8901b39e6dd3 ("
+  , "  signed int arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_double)(arg1);"
+  , "}"
+  , "void hs_bindgen_c4123c64e3799da5 ("
+  , "  signed int arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_56568d64374ea82a ("
+  , "  signed int arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args2)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_e39afd1aad07e0fc ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret1)(arg1);"
+  , "}"
+  , "size_t hs_bindgen_06a7ca6b10b6f1c5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret2)(arg1);"
+  , "}"
+  , "void hs_bindgen_085cd2205e0daeff ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args1)(arg1);"
+  , "}"
+  , "void hs_bindgen_0df3319af542c072 ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args2)(arg1);"
+  , "}"
+  , "void hs_bindgen_4839d1f4a2742c03 ("
+  , "  signed int *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args3)(arg1);"
+  , "}"
+  , "void hs_bindgen_c7e68dd8759c969a ("
+  , "  signed int **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args4)(arg1);"
+  , "}"
+  , "void hs_bindgen_bf24f137d6217c14 ("
+  , "  signed int arg1,"
+  , "  void (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2b6cd604640b023f ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9c35d7346db373f0 ("
+  , "  signed int arg1,"
+  , "  void (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_60245cd22b3cd59b ("
+  , "  signed int arg1,"
+  , "  char (*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_bcd5e0817da0463b ("
+  , "  signed int arg1,"
+  , "  signed int *(*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args5)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_fd3d542dfefd036e ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (comments1)(arg1);"
+  , "}"
+  , "void hs_bindgen_0819c4409f0cb04f ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d31ae17d88140355 ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f0ed5f637cefe96f ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0215a515d1fa3dfa ("
+  , "  signed int arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_e103c029e3630b33 ("
+  , "  signed int arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_bef8a67258cb736b ("
+  , "  signed int arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_589e465944877183 ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_fef23ca0f7241d44 ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_12ed6589e368a6d9 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_acfc6cbb94266577 ("
+  , "  signed int arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_e452087578f98911 ("
+  , "  signed int arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_a943f6ee50043676 ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_425f71a0e411bca9 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_297d1f2aa423722a ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_136c1c8ee6a77c65 ("
+  , "  signed int arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_876526a42ba48417 ("
+  , "  signed int arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b309fa8d82dd7b72 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b7b3fe289c724859 ("
+  , "  signed int arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_55b1796019967748 ("
+  , "  signed int arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_b10d1e8f7c40c632 ("
+  , "  signed int arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_04406c6b24b54172 ("
+  , "  signed int arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ae945fd854416c29 ("
+  , "  signed int arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_315fb7a4e52f51bb ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c8fe0d37027b1cbd ("
+  , "  signed int arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_585e1489b3f5af58 ("
+  , "  signed int arg1,"
+  , "  signed int *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b9568a159c32cefc ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_85f146afc2a27268 ("
+  , "  signed int arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args5)(arg1, arg2);"
+  , "}"
+  , "signed int const *hs_bindgen_ea6a7e1d0274f90d ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret1)(arg1);"
+  , "}"
+  , "signed int const *hs_bindgen_ae320a2e858ccc98 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret2)(arg1);"
+  , "}"
+  , "signed int *const hs_bindgen_3ca6c6656d62db21 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret3)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_83d0056641627b70 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret4)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_89f54f00e5f1ec61 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret5)(arg1);"
+  , "}"
+  , "void hs_bindgen_445aea27fa0b55be ("
+  , "  signed int const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem1)(arg1);"
+  , "}"
+  , "void hs_bindgen_2f9fd49dce178c29 ("
+  , "  signed int const **arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem2)(arg1);"
+  , "}"
+  , "void hs_bindgen_99716bef732a1af1 ("
+  , "  signed int *const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_1721fcf9bca3ea61 (void)"
+  , "{"
+  , "  return (noParams1)();"
+  , "}"
+  , "signed int hs_bindgen_95fe913b1eec4f4e (void)"
+  , "{"
+  , "  return (noParams2)();"
+  , "}"
+  , "void hs_bindgen_d15b46c7c30f29ac ("
+  , "  signed int arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (noParams3)(arg1, arg2);"
+  , "}"
+  , "void (*hs_bindgen_fe09e75d56f9869e ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_7f6cbcd68ce4b354 ("
+  , "  signed int arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret2)(arg1);"
+  , "}"
+  , "void (*hs_bindgen_1bcf333c8e82d009 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (funptr_ret3)(arg1);"
+  , "}"
+  , "char (*hs_bindgen_4793bc049c8510a4 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret4)(arg1);"
+  , "}"
+  , "signed int *(*hs_bindgen_abb2d85efd4fcb3e ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret5)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_6cf3159cf7618393 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret6)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_ae99f146e73b6c1a ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret7)(arg1);"
+  , "}"
+  , "signed int *const (*hs_bindgen_5ac0a15c42b191c7 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret8)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_0dbef4dde3b3d205 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret9)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_c226f0b9bbf08c49 ("
+  , "  signed int arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret10)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char1@
+foreign import ccall unsafe "hs_bindgen_dbcf45ae88784a43" hs_bindgen_dbcf45ae88784a43_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char1@
+hs_bindgen_dbcf45ae88784a43 ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_dbcf45ae88784a43 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_dbcf45ae88784a43_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char1 = hs_bindgen_dbcf45ae88784a43
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char2@
+foreign import ccall unsafe "hs_bindgen_c72087f2b9c0a851" hs_bindgen_c72087f2b9c0a851_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char2@
+hs_bindgen_c72087f2b9c0a851 ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_c72087f2b9c0a851 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c72087f2b9c0a851_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char2 = hs_bindgen_c72087f2b9c0a851
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char3@
+foreign import ccall unsafe "hs_bindgen_d23034ca037d7ee2" hs_bindgen_d23034ca037d7ee2_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char3@
+hs_bindgen_d23034ca037d7ee2 ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_d23034ca037d7ee2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d23034ca037d7ee2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char3 = hs_bindgen_d23034ca037d7ee2
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short1@
+foreign import ccall unsafe "hs_bindgen_7aba582bac3cdd4c" hs_bindgen_7aba582bac3cdd4c_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short1@
+hs_bindgen_7aba582bac3cdd4c ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_7aba582bac3cdd4c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_7aba582bac3cdd4c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short1 = hs_bindgen_7aba582bac3cdd4c
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short2@
+foreign import ccall unsafe "hs_bindgen_72e80c0c19b73bd1" hs_bindgen_72e80c0c19b73bd1_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short2@
+hs_bindgen_72e80c0c19b73bd1 ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_72e80c0c19b73bd1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_72e80c0c19b73bd1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short2 = hs_bindgen_72e80c0c19b73bd1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short3@
+foreign import ccall unsafe "hs_bindgen_1d779b6db021542e" hs_bindgen_1d779b6db021542e_base ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short3@
+hs_bindgen_1d779b6db021542e ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+hs_bindgen_1d779b6db021542e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1d779b6db021542e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short3 = hs_bindgen_1d779b6db021542e
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int1@
+foreign import ccall unsafe "hs_bindgen_dadb0390936fa7a6" hs_bindgen_dadb0390936fa7a6_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int1@
+hs_bindgen_dadb0390936fa7a6 ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_dadb0390936fa7a6 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_dadb0390936fa7a6_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int1 = hs_bindgen_dadb0390936fa7a6
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int2@
+foreign import ccall unsafe "hs_bindgen_cc4dd71da3d83f3e" hs_bindgen_cc4dd71da3d83f3e_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int2@
+hs_bindgen_cc4dd71da3d83f3e ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_cc4dd71da3d83f3e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_cc4dd71da3d83f3e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int2 = hs_bindgen_cc4dd71da3d83f3e
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int3@
+foreign import ccall unsafe "hs_bindgen_c1aa1895338c9c06" hs_bindgen_c1aa1895338c9c06_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int3@
+hs_bindgen_c1aa1895338c9c06 ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+hs_bindgen_c1aa1895338c9c06 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c1aa1895338c9c06_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int3 = hs_bindgen_c1aa1895338c9c06
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long1@
+foreign import ccall unsafe "hs_bindgen_ea3ab52d35940c9c" hs_bindgen_ea3ab52d35940c9c_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long1@
+hs_bindgen_ea3ab52d35940c9c ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_ea3ab52d35940c9c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ea3ab52d35940c9c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long1 = hs_bindgen_ea3ab52d35940c9c
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long2@
+foreign import ccall unsafe "hs_bindgen_1ead52aa138d51cf" hs_bindgen_1ead52aa138d51cf_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long2@
+hs_bindgen_1ead52aa138d51cf ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_1ead52aa138d51cf =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1ead52aa138d51cf_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long2 = hs_bindgen_1ead52aa138d51cf
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long3@
+foreign import ccall unsafe "hs_bindgen_93b713dccaf06fed" hs_bindgen_93b713dccaf06fed_base ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long3@
+hs_bindgen_93b713dccaf06fed ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+hs_bindgen_93b713dccaf06fed =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_93b713dccaf06fed_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CULong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long3 = hs_bindgen_93b713dccaf06fed
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_float@
+foreign import ccall unsafe "hs_bindgen_d091d2dc36843d19" hs_bindgen_d091d2dc36843d19_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_float@
+hs_bindgen_d091d2dc36843d19 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_d091d2dc36843d19 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d091d2dc36843d19_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_float = hs_bindgen_d091d2dc36843d19
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_double@
+foreign import ccall unsafe "hs_bindgen_6ea5acb5ec6f40c4" hs_bindgen_6ea5acb5ec6f40c4_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_double@
+hs_bindgen_6ea5acb5ec6f40c4 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_6ea5acb5ec6f40c4 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6ea5acb5ec6f40c4_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_double = hs_bindgen_6ea5acb5ec6f40c4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_bool1@
+foreign import ccall unsafe "hs_bindgen_689ef6ac4e916b3a" hs_bindgen_689ef6ac4e916b3a_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_bool1@
+hs_bindgen_689ef6ac4e916b3a ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_689ef6ac4e916b3a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_689ef6ac4e916b3a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_bool1 = hs_bindgen_689ef6ac4e916b3a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_struct@
+foreign import ccall unsafe "hs_bindgen_3d21d6b68f84eba6" hs_bindgen_3d21d6b68f84eba6_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_struct@
+hs_bindgen_3d21d6b68f84eba6 ::
+     BG.CInt
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_3d21d6b68f84eba6 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3d21d6b68f84eba6_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_struct =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_3d21d6b68f84eba6 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_union@
+foreign import ccall unsafe "hs_bindgen_6c2746bae9e4dab9" hs_bindgen_6c2746bae9e4dab9_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_union@
+hs_bindgen_6c2746bae9e4dab9 ::
+     BG.CInt
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_6c2746bae9e4dab9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6c2746bae9e4dab9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_union =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_6c2746bae9e4dab9 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_enum@
+foreign import ccall unsafe "hs_bindgen_6c549405e9baffcf" hs_bindgen_6c549405e9baffcf_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_enum@
+hs_bindgen_6c549405e9baffcf ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_6c549405e9baffcf =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6c549405e9baffcf_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_enum = hs_bindgen_6c549405e9baffcf
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_34dfa5eaf97951ec" hs_bindgen_34dfa5eaf97951ec_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer1@
+hs_bindgen_34dfa5eaf97951ec ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_34dfa5eaf97951ec =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_34dfa5eaf97951ec_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer1 = hs_bindgen_34dfa5eaf97951ec
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_0d71e7152a20efbd" hs_bindgen_0d71e7152a20efbd_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer2@
+hs_bindgen_0d71e7152a20efbd ::
+     BG.CInt
+  -> BG.Ptr (BG.Ptr BG.CInt)
+  -> IO ()
+hs_bindgen_0d71e7152a20efbd =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0d71e7152a20efbd_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr (BG.Ptr BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer2 = hs_bindgen_0d71e7152a20efbd
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_1ac8f30e6858a673" hs_bindgen_1ac8f30e6858a673_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer3@
+hs_bindgen_1ac8f30e6858a673 ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+hs_bindgen_1ac8f30e6858a673 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1ac8f30e6858a673_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @arg3@
+  -> IO ()
+args_pointer3 = hs_bindgen_1ac8f30e6858a673
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_A@
+foreign import ccall unsafe "hs_bindgen_74c085d1fc547d65" hs_bindgen_74c085d1fc547d65_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_A@
+hs_bindgen_74c085d1fc547d65 :: IO BG.CInt
+hs_bindgen_74c085d1fc547d65 =
+  fmap BG.fromFFIType hs_bindgen_74c085d1fc547d65_base
+
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A :: IO BG.CInt
+ret_A = hs_bindgen_74c085d1fc547d65
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char1@
+foreign import ccall unsafe "hs_bindgen_c1173d352155de62" hs_bindgen_c1173d352155de62_base ::
+     BG.CInt
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char1@
+hs_bindgen_c1173d352155de62 ::
+     BG.CInt
+  -> IO BG.CChar
+hs_bindgen_c1173d352155de62 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c1173d352155de62_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CChar
+ret_char1 = hs_bindgen_c1173d352155de62
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char2@
+foreign import ccall unsafe "hs_bindgen_9029d84b81d6df97" hs_bindgen_9029d84b81d6df97_base ::
+     BG.CInt
+  -> IO BG.CSChar
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char2@
+hs_bindgen_9029d84b81d6df97 ::
+     BG.CInt
+  -> IO BG.CSChar
+hs_bindgen_9029d84b81d6df97 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9029d84b81d6df97_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CSChar
+ret_char2 = hs_bindgen_9029d84b81d6df97
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char3@
+foreign import ccall unsafe "hs_bindgen_5076ef968e0b1da6" hs_bindgen_5076ef968e0b1da6_base ::
+     BG.CInt
+  -> IO BG.CUChar
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char3@
+hs_bindgen_5076ef968e0b1da6 ::
+     BG.CInt
+  -> IO BG.CUChar
+hs_bindgen_5076ef968e0b1da6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5076ef968e0b1da6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUChar
+ret_char3 = hs_bindgen_5076ef968e0b1da6
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short1@
+foreign import ccall unsafe "hs_bindgen_6c9415155d57e014" hs_bindgen_6c9415155d57e014_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short1@
+hs_bindgen_6c9415155d57e014 ::
+     BG.CInt
+  -> IO BG.CShort
+hs_bindgen_6c9415155d57e014 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6c9415155d57e014_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short1 = hs_bindgen_6c9415155d57e014
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short2@
+foreign import ccall unsafe "hs_bindgen_24f9af60f9d4b0c4" hs_bindgen_24f9af60f9d4b0c4_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short2@
+hs_bindgen_24f9af60f9d4b0c4 ::
+     BG.CInt
+  -> IO BG.CShort
+hs_bindgen_24f9af60f9d4b0c4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_24f9af60f9d4b0c4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short2 = hs_bindgen_24f9af60f9d4b0c4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short3@
+foreign import ccall unsafe "hs_bindgen_7712cc06577c000f" hs_bindgen_7712cc06577c000f_base ::
+     BG.CInt
+  -> IO BG.CUShort
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short3@
+hs_bindgen_7712cc06577c000f ::
+     BG.CInt
+  -> IO BG.CUShort
+hs_bindgen_7712cc06577c000f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7712cc06577c000f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUShort
+ret_short3 = hs_bindgen_7712cc06577c000f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int1@
+foreign import ccall unsafe "hs_bindgen_a4669df8abb549dc" hs_bindgen_a4669df8abb549dc_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int1@
+hs_bindgen_a4669df8abb549dc ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_a4669df8abb549dc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a4669df8abb549dc_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int1 = hs_bindgen_a4669df8abb549dc
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int2@
+foreign import ccall unsafe "hs_bindgen_d471d89e2802f599" hs_bindgen_d471d89e2802f599_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int2@
+hs_bindgen_d471d89e2802f599 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_d471d89e2802f599 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d471d89e2802f599_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int2 = hs_bindgen_d471d89e2802f599
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int3@
+foreign import ccall unsafe "hs_bindgen_551866464fb7e076" hs_bindgen_551866464fb7e076_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int3@
+hs_bindgen_551866464fb7e076 ::
+     BG.CInt
+  -> IO BG.CUInt
+hs_bindgen_551866464fb7e076 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_551866464fb7e076_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUInt
+ret_int3 = hs_bindgen_551866464fb7e076
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long1@
+foreign import ccall unsafe "hs_bindgen_1cb0ba330b8fc708" hs_bindgen_1cb0ba330b8fc708_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long1@
+hs_bindgen_1cb0ba330b8fc708 ::
+     BG.CInt
+  -> IO BG.CLong
+hs_bindgen_1cb0ba330b8fc708 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1cb0ba330b8fc708_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long1 = hs_bindgen_1cb0ba330b8fc708
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long2@
+foreign import ccall unsafe "hs_bindgen_84d65e5f2bb20468" hs_bindgen_84d65e5f2bb20468_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long2@
+hs_bindgen_84d65e5f2bb20468 ::
+     BG.CInt
+  -> IO BG.CLong
+hs_bindgen_84d65e5f2bb20468 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_84d65e5f2bb20468_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long2 = hs_bindgen_84d65e5f2bb20468
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long3@
+foreign import ccall unsafe "hs_bindgen_8e5c7c7b2f385152" hs_bindgen_8e5c7c7b2f385152_base ::
+     BG.CInt
+  -> IO BG.CULong
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long3@
+hs_bindgen_8e5c7c7b2f385152 ::
+     BG.CInt
+  -> IO BG.CULong
+hs_bindgen_8e5c7c7b2f385152 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8e5c7c7b2f385152_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CULong
+ret_long3 = hs_bindgen_8e5c7c7b2f385152
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_float@
+foreign import ccall unsafe "hs_bindgen_be7b5328fb1e67e4" hs_bindgen_be7b5328fb1e67e4_base ::
+     BG.CInt
+  -> IO BG.CFloat
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_float@
+hs_bindgen_be7b5328fb1e67e4 ::
+     BG.CInt
+  -> IO BG.CFloat
+hs_bindgen_be7b5328fb1e67e4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_be7b5328fb1e67e4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CFloat
+ret_float = hs_bindgen_be7b5328fb1e67e4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_double@
+foreign import ccall unsafe "hs_bindgen_67ccecb1f4c2b26b" hs_bindgen_67ccecb1f4c2b26b_base ::
+     BG.CInt
+  -> IO BG.CDouble
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_double@
+hs_bindgen_67ccecb1f4c2b26b ::
+     BG.CInt
+  -> IO BG.CDouble
+hs_bindgen_67ccecb1f4c2b26b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_67ccecb1f4c2b26b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CDouble
+ret_double = hs_bindgen_67ccecb1f4c2b26b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_8f3058d29b19c7f8" hs_bindgen_8f3058d29b19c7f8_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_bool1@
+hs_bindgen_8f3058d29b19c7f8 ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_8f3058d29b19c7f8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8f3058d29b19c7f8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+ret_bool1 = hs_bindgen_8f3058d29b19c7f8
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_struct@
+foreign import ccall unsafe "hs_bindgen_db41d471db80076d" hs_bindgen_db41d471db80076d_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_struct@
+hs_bindgen_db41d471db80076d ::
+     BG.CInt
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_db41d471db80076d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_db41d471db80076d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_struct
+ret_struct =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_db41d471db80076d arg10 res1)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_union@
+foreign import ccall unsafe "hs_bindgen_a2761d3935650b5c" hs_bindgen_a2761d3935650b5c_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_union@
+hs_bindgen_a2761d3935650b5c ::
+     BG.CInt
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_a2761d3935650b5c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a2761d3935650b5c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_union
+ret_union =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_a2761d3935650b5c arg10 res1)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_enum@
+foreign import ccall unsafe "hs_bindgen_c567484984a48bdd" hs_bindgen_c567484984a48bdd_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_enum@
+hs_bindgen_c567484984a48bdd ::
+     BG.CInt
+  -> IO Some_enum
+hs_bindgen_c567484984a48bdd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c567484984a48bdd_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_enum
+ret_enum = hs_bindgen_c567484984a48bdd
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_a0436717a3858ec2" hs_bindgen_a0436717a3858ec2_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer1@
+hs_bindgen_a0436717a3858ec2 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_a0436717a3858ec2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a0436717a3858ec2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+ret_pointer1 = hs_bindgen_a0436717a3858ec2
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_92e30e7cf97b7ae8" hs_bindgen_92e30e7cf97b7ae8_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer2@
+hs_bindgen_92e30e7cf97b7ae8 ::
+     BG.CInt
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_92e30e7cf97b7ae8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_92e30e7cf97b7ae8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+ret_pointer2 = hs_bindgen_92e30e7cf97b7ae8
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_cec80a82e028945d" hs_bindgen_cec80a82e028945d_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer3@
+hs_bindgen_cec80a82e028945d ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_cec80a82e028945d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_cec80a82e028945d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.Void)
+ret_pointer3 = hs_bindgen_cec80a82e028945d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body1@
+foreign import ccall unsafe "hs_bindgen_373d2dbedb7f3ea1" hs_bindgen_373d2dbedb7f3ea1_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body1@
+hs_bindgen_373d2dbedb7f3ea1 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_373d2dbedb7f3ea1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_373d2dbedb7f3ea1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+body1 = hs_bindgen_373d2dbedb7f3ea1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body2@
+foreign import ccall unsafe "hs_bindgen_678c705d71b66fd0" hs_bindgen_678c705d71b66fd0_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body2@
+hs_bindgen_678c705d71b66fd0 :: IO BG.CInt
+hs_bindgen_678c705d71b66fd0 =
+  fmap BG.fromFFIType hs_bindgen_678c705d71b66fd0_base
+
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2 :: IO BG.CInt
+body2 = hs_bindgen_678c705d71b66fd0
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_4a4cdf60b6a4885d" hs_bindgen_4a4cdf60b6a4885d_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_float@
+hs_bindgen_4a4cdf60b6a4885d ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_4a4cdf60b6a4885d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4a4cdf60b6a4885d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_float =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_4a4cdf60b6a4885d arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_4b113ac08bbb35bd" hs_bindgen_4b113ac08bbb35bd_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_double@
+hs_bindgen_4b113ac08bbb35bd ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_4b113ac08bbb35bd =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4b113ac08bbb35bd_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_double =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_4b113ac08bbb35bd arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_63483820a803fad0" hs_bindgen_63483820a803fad0_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_float@
+hs_bindgen_63483820a803fad0 ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_63483820a803fad0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_63483820a803fad0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CFloat)
+ret_complex_float =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_63483820a803fad0 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_00dc8901b39e6dd3" hs_bindgen_00dc8901b39e6dd3_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_double@
+hs_bindgen_00dc8901b39e6dd3 ::
+     BG.CInt
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_00dc8901b39e6dd3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_00dc8901b39e6dd3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CDouble)
+ret_complex_double =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_00dc8901b39e6dd3 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_c4123c64e3799da5" hs_bindgen_c4123c64e3799da5_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args1@
+hs_bindgen_c4123c64e3799da5 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_c4123c64e3799da5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c4123c64e3799da5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args1 = hs_bindgen_c4123c64e3799da5
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_56568d64374ea82a" hs_bindgen_56568d64374ea82a_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args2@
+hs_bindgen_56568d64374ea82a ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_56568d64374ea82a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_56568d64374ea82a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args2 = hs_bindgen_56568d64374ea82a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_e39afd1aad07e0fc" hs_bindgen_e39afd1aad07e0fc_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret1@
+hs_bindgen_e39afd1aad07e0fc ::
+     BG.CInt
+  -> IO BG.CBool
+hs_bindgen_e39afd1aad07e0fc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e39afd1aad07e0fc_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+bespoke_ret1 = hs_bindgen_e39afd1aad07e0fc
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_06a7ca6b10b6f1c5" hs_bindgen_06a7ca6b10b6f1c5_base ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret2@
+hs_bindgen_06a7ca6b10b6f1c5 ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_06a7ca6b10b6f1c5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_06a7ca6b10b6f1c5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO HsBindgen.Runtime.LibC.CSize
+bespoke_ret2 = hs_bindgen_06a7ca6b10b6f1c5
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args1@
+foreign import ccall unsafe "hs_bindgen_085cd2205e0daeff" hs_bindgen_085cd2205e0daeff_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args1@
+hs_bindgen_085cd2205e0daeff ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_085cd2205e0daeff =
+  \x0 ->
+    hs_bindgen_085cd2205e0daeff_base (BG.toFFIType x0)
+
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args1 = hs_bindgen_085cd2205e0daeff
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args2@
+foreign import ccall unsafe "hs_bindgen_0df3319af542c072" hs_bindgen_0df3319af542c072_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args2@
+hs_bindgen_0df3319af542c072 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_0df3319af542c072 =
+  \x0 ->
+    hs_bindgen_0df3319af542c072_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args2 = hs_bindgen_0df3319af542c072
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args3@
+foreign import ccall unsafe "hs_bindgen_4839d1f4a2742c03" hs_bindgen_4839d1f4a2742c03_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args3@
+hs_bindgen_4839d1f4a2742c03 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt))
+  -> IO ()
+hs_bindgen_4839d1f4a2742c03 =
+  \x0 ->
+    hs_bindgen_4839d1f4a2742c03_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args3 = hs_bindgen_4839d1f4a2742c03
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args4@
+foreign import ccall unsafe "hs_bindgen_c7e68dd8759c969a" hs_bindgen_c7e68dd8759c969a_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args4@
+hs_bindgen_c7e68dd8759c969a ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_c7e68dd8759c969a =
+  \x0 ->
+    hs_bindgen_c7e68dd8759c969a_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args4 = hs_bindgen_c7e68dd8759c969a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_bf24f137d6217c14" hs_bindgen_bf24f137d6217c14_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args1@
+hs_bindgen_bf24f137d6217c14 ::
+     BG.CInt
+  -> BG.FunPtr (IO ())
+  -> IO ()
+hs_bindgen_bf24f137d6217c14 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_bf24f137d6217c14_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args1 = hs_bindgen_bf24f137d6217c14
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_2b6cd604640b023f" hs_bindgen_2b6cd604640b023f_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args2@
+hs_bindgen_2b6cd604640b023f ::
+     BG.CInt
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_2b6cd604640b023f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2b6cd604640b023f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args2 = hs_bindgen_2b6cd604640b023f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_9c35d7346db373f0" hs_bindgen_9c35d7346db373f0_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args3@
+hs_bindgen_9c35d7346db373f0 ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_9c35d7346db373f0 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9c35d7346db373f0_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args3 = hs_bindgen_9c35d7346db373f0
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_60245cd22b3cd59b" hs_bindgen_60245cd22b3cd59b_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args4@
+hs_bindgen_60245cd22b3cd59b ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+  -> IO ()
+hs_bindgen_60245cd22b3cd59b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_60245cd22b3cd59b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args4 = hs_bindgen_60245cd22b3cd59b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_bcd5e0817da0463b" hs_bindgen_bcd5e0817da0463b_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args5@
+hs_bindgen_bcd5e0817da0463b ::
+     BG.CInt
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+  -> IO ()
+hs_bindgen_bcd5e0817da0463b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_bcd5e0817da0463b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args5 = hs_bindgen_bcd5e0817da0463b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_comments1@
+foreign import ccall unsafe "hs_bindgen_fd3d542dfefd036e" hs_bindgen_fd3d542dfefd036e_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_comments1@
+hs_bindgen_fd3d542dfefd036e ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_fd3d542dfefd036e =
+  \x0 ->
+    hs_bindgen_fd3d542dfefd036e_base (BG.toFFIType x0)
+
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+comments1 = hs_bindgen_fd3d542dfefd036e
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_0819c4409f0cb04f" hs_bindgen_0819c4409f0cb04f_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before1@
+hs_bindgen_0819c4409f0cb04f ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_0819c4409f0cb04f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0819c4409f0cb04f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before1 = hs_bindgen_0819c4409f0cb04f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_d31ae17d88140355" hs_bindgen_d31ae17d88140355_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before2@
+hs_bindgen_d31ae17d88140355 ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_d31ae17d88140355 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d31ae17d88140355_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before2 = hs_bindgen_d31ae17d88140355
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_f0ed5f637cefe96f" hs_bindgen_f0ed5f637cefe96f_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before3@
+hs_bindgen_f0ed5f637cefe96f ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_f0ed5f637cefe96f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f0ed5f637cefe96f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before3 = hs_bindgen_f0ed5f637cefe96f
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_0215a515d1fa3dfa" hs_bindgen_0215a515d1fa3dfa_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after1@
+hs_bindgen_0215a515d1fa3dfa ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_0215a515d1fa3dfa =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0215a515d1fa3dfa_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after1 = hs_bindgen_0215a515d1fa3dfa
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_e103c029e3630b33" hs_bindgen_e103c029e3630b33_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after2@
+hs_bindgen_e103c029e3630b33 ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_e103c029e3630b33 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e103c029e3630b33_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after2 = hs_bindgen_e103c029e3630b33
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_bef8a67258cb736b" hs_bindgen_bef8a67258cb736b_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after3@
+hs_bindgen_bef8a67258cb736b ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_bef8a67258cb736b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_bef8a67258cb736b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after3 = hs_bindgen_bef8a67258cb736b
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_589e465944877183" hs_bindgen_589e465944877183_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before1@
+hs_bindgen_589e465944877183 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_589e465944877183 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_589e465944877183_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before1 =
+  hs_bindgen_589e465944877183
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_fef23ca0f7241d44" hs_bindgen_fef23ca0f7241d44_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before2@
+hs_bindgen_fef23ca0f7241d44 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_fef23ca0f7241d44 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_fef23ca0f7241d44_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before2 =
+  hs_bindgen_fef23ca0f7241d44
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_12ed6589e368a6d9" hs_bindgen_12ed6589e368a6d9_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before3@
+hs_bindgen_12ed6589e368a6d9 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_12ed6589e368a6d9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_12ed6589e368a6d9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before3 =
+  hs_bindgen_12ed6589e368a6d9
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_acfc6cbb94266577" hs_bindgen_acfc6cbb94266577_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before4@
+hs_bindgen_acfc6cbb94266577 ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_acfc6cbb94266577 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_acfc6cbb94266577_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_acfc6cbb94266577 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_e452087578f98911" hs_bindgen_e452087578f98911_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before5@
+hs_bindgen_e452087578f98911 ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_e452087578f98911 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_e452087578f98911_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_e452087578f98911 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_a943f6ee50043676" hs_bindgen_a943f6ee50043676_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before6@
+hs_bindgen_a943f6ee50043676 ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_a943f6ee50043676 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a943f6ee50043676_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before6 =
+  hs_bindgen_a943f6ee50043676
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_425f71a0e411bca9" hs_bindgen_425f71a0e411bca9_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before7@
+hs_bindgen_425f71a0e411bca9 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_425f71a0e411bca9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_425f71a0e411bca9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before7 =
+  hs_bindgen_425f71a0e411bca9
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_297d1f2aa423722a" hs_bindgen_297d1f2aa423722a_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before8@
+hs_bindgen_297d1f2aa423722a ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_297d1f2aa423722a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_297d1f2aa423722a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before8 =
+  hs_bindgen_297d1f2aa423722a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_136c1c8ee6a77c65" hs_bindgen_136c1c8ee6a77c65_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after1@
+hs_bindgen_136c1c8ee6a77c65 ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_136c1c8ee6a77c65 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_136c1c8ee6a77c65_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after1 =
+  hs_bindgen_136c1c8ee6a77c65
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_876526a42ba48417" hs_bindgen_876526a42ba48417_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after2@
+hs_bindgen_876526a42ba48417 ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_876526a42ba48417 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_876526a42ba48417_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after2 =
+  hs_bindgen_876526a42ba48417
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_b309fa8d82dd7b72" hs_bindgen_b309fa8d82dd7b72_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after3@
+hs_bindgen_b309fa8d82dd7b72 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_b309fa8d82dd7b72 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b309fa8d82dd7b72_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after3 =
+  hs_bindgen_b309fa8d82dd7b72
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_b7b3fe289c724859" hs_bindgen_b7b3fe289c724859_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after4@
+hs_bindgen_b7b3fe289c724859 ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_b7b3fe289c724859 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b7b3fe289c724859_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_b7b3fe289c724859 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_55b1796019967748" hs_bindgen_55b1796019967748_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after5@
+hs_bindgen_55b1796019967748 ::
+     BG.CInt
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_55b1796019967748 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_55b1796019967748_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_55b1796019967748 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_b10d1e8f7c40c632" hs_bindgen_b10d1e8f7c40c632_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after6@
+hs_bindgen_b10d1e8f7c40c632 ::
+     BG.CInt
+  -> Some_enum
+  -> IO ()
+hs_bindgen_b10d1e8f7c40c632 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b10d1e8f7c40c632_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after6 =
+  hs_bindgen_b10d1e8f7c40c632
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_04406c6b24b54172" hs_bindgen_04406c6b24b54172_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after7@
+hs_bindgen_04406c6b24b54172 ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_04406c6b24b54172 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_04406c6b24b54172_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after7 =
+  hs_bindgen_04406c6b24b54172
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_ae945fd854416c29" hs_bindgen_ae945fd854416c29_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after8@
+hs_bindgen_ae945fd854416c29 ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_ae945fd854416c29 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ae945fd854416c29_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after8 =
+  hs_bindgen_ae945fd854416c29
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_315fb7a4e52f51bb" hs_bindgen_315fb7a4e52f51bb_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args1@
+hs_bindgen_315fb7a4e52f51bb ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_315fb7a4e52f51bb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_315fb7a4e52f51bb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args1 = hs_bindgen_315fb7a4e52f51bb
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_c8fe0d37027b1cbd" hs_bindgen_c8fe0d37027b1cbd_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args2@
+hs_bindgen_c8fe0d37027b1cbd ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_c8fe0d37027b1cbd =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c8fe0d37027b1cbd_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args2 = hs_bindgen_c8fe0d37027b1cbd
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_585e1489b3f5af58" hs_bindgen_585e1489b3f5af58_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args3@
+hs_bindgen_585e1489b3f5af58 ::
+     BG.CInt
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_585e1489b3f5af58 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_585e1489b3f5af58_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args3 = hs_bindgen_585e1489b3f5af58
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_b9568a159c32cefc" hs_bindgen_b9568a159c32cefc_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args4@
+hs_bindgen_b9568a159c32cefc ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_b9568a159c32cefc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b9568a159c32cefc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args4 = hs_bindgen_b9568a159c32cefc
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_85f146afc2a27268" hs_bindgen_85f146afc2a27268_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args5@
+hs_bindgen_85f146afc2a27268 ::
+     BG.CInt
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_85f146afc2a27268 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_85f146afc2a27268_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args5 = hs_bindgen_85f146afc2a27268
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_ea6a7e1d0274f90d" hs_bindgen_ea6a7e1d0274f90d_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret1@
+hs_bindgen_ea6a7e1d0274f90d ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_ea6a7e1d0274f90d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ea6a7e1d0274f90d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret1 = hs_bindgen_ea6a7e1d0274f90d
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_ae320a2e858ccc98" hs_bindgen_ae320a2e858ccc98_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret2@
+hs_bindgen_ae320a2e858ccc98 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_ae320a2e858ccc98 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ae320a2e858ccc98_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret2 = hs_bindgen_ae320a2e858ccc98
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_3ca6c6656d62db21" hs_bindgen_3ca6c6656d62db21_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret3@
+hs_bindgen_3ca6c6656d62db21 ::
+     BG.CInt
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_3ca6c6656d62db21 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3ca6c6656d62db21_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+const_pointers_ret3 = hs_bindgen_3ca6c6656d62db21
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_83d0056641627b70" hs_bindgen_83d0056641627b70_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret4@
+hs_bindgen_83d0056641627b70 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_83d0056641627b70 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_83d0056641627b70_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret4 = hs_bindgen_83d0056641627b70
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_89f54f00e5f1ec61" hs_bindgen_89f54f00e5f1ec61_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret5@
+hs_bindgen_89f54f00e5f1ec61 ::
+     BG.CInt
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_89f54f00e5f1ec61 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_89f54f00e5f1ec61_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret5 = hs_bindgen_89f54f00e5f1ec61
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_445aea27fa0b55be" hs_bindgen_445aea27fa0b55be_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem1@
+hs_bindgen_445aea27fa0b55be ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+  -> IO ()
+hs_bindgen_445aea27fa0b55be =
+  \x0 ->
+    hs_bindgen_445aea27fa0b55be_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray BG.CInt))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem1 = hs_bindgen_445aea27fa0b55be
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_2f9fd49dce178c29" hs_bindgen_2f9fd49dce178c29_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem2@
+hs_bindgen_2f9fd49dce178c29 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt)))
+  -> IO ()
+hs_bindgen_2f9fd49dce178c29 =
+  \x0 ->
+    hs_bindgen_2f9fd49dce178c29_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem2 = hs_bindgen_2f9fd49dce178c29
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_99716bef732a1af1" hs_bindgen_99716bef732a1af1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem3@
+hs_bindgen_99716bef732a1af1 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+  -> IO ()
+hs_bindgen_99716bef732a1af1 =
+  \x0 ->
+    hs_bindgen_99716bef732a1af1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr BG.CInt)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem3 = hs_bindgen_99716bef732a1af1
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams1@
+foreign import ccall unsafe "hs_bindgen_1721fcf9bca3ea61" hs_bindgen_1721fcf9bca3ea61_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams1@
+hs_bindgen_1721fcf9bca3ea61 :: IO BG.CInt
+hs_bindgen_1721fcf9bca3ea61 =
+  fmap BG.fromFFIType hs_bindgen_1721fcf9bca3ea61_base
+
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1 :: IO BG.CInt
+noParams1 = hs_bindgen_1721fcf9bca3ea61
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams2@
+foreign import ccall unsafe "hs_bindgen_95fe913b1eec4f4e" hs_bindgen_95fe913b1eec4f4e_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams2@
+hs_bindgen_95fe913b1eec4f4e :: IO BG.CInt
+hs_bindgen_95fe913b1eec4f4e =
+  fmap BG.fromFFIType hs_bindgen_95fe913b1eec4f4e_base
+
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2 :: IO BG.CInt
+noParams2 = hs_bindgen_95fe913b1eec4f4e
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams3@
+foreign import ccall unsafe "hs_bindgen_d15b46c7c30f29ac" hs_bindgen_d15b46c7c30f29ac_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams3@
+hs_bindgen_d15b46c7c30f29ac ::
+     BG.CInt
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_d15b46c7c30f29ac =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d15b46c7c30f29ac_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+noParams3 = hs_bindgen_d15b46c7c30f29ac
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_fe09e75d56f9869e" hs_bindgen_fe09e75d56f9869e_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret1@
+hs_bindgen_fe09e75d56f9869e ::
+     BG.CInt
+  -> IO (BG.FunPtr (IO ()))
+hs_bindgen_fe09e75d56f9869e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_fe09e75d56f9869e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO ()))
+funptr_ret1 = hs_bindgen_fe09e75d56f9869e
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_7f6cbcd68ce4b354" hs_bindgen_7f6cbcd68ce4b354_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret2@
+hs_bindgen_7f6cbcd68ce4b354 ::
+     BG.CInt
+  -> IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_7f6cbcd68ce4b354 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7f6cbcd68ce4b354_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO BG.CInt))
+funptr_ret2 = hs_bindgen_7f6cbcd68ce4b354
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_1bcf333c8e82d009" hs_bindgen_1bcf333c8e82d009_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret3@
+hs_bindgen_1bcf333c8e82d009 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_1bcf333c8e82d009 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1bcf333c8e82d009_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+funptr_ret3 = hs_bindgen_1bcf333c8e82d009
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_4793bc049c8510a4" hs_bindgen_4793bc049c8510a4_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret4@
+hs_bindgen_4793bc049c8510a4 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+hs_bindgen_4793bc049c8510a4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4793bc049c8510a4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+funptr_ret4 = hs_bindgen_4793bc049c8510a4
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_abb2d85efd4fcb3e" hs_bindgen_abb2d85efd4fcb3e_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret5@
+hs_bindgen_abb2d85efd4fcb3e ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_abb2d85efd4fcb3e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_abb2d85efd4fcb3e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret5 = hs_bindgen_abb2d85efd4fcb3e
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_6cf3159cf7618393" hs_bindgen_6cf3159cf7618393_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret6@
+hs_bindgen_6cf3159cf7618393 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_6cf3159cf7618393 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6cf3159cf7618393_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret6 = hs_bindgen_6cf3159cf7618393
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_ae99f146e73b6c1a" hs_bindgen_ae99f146e73b6c1a_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret7@
+hs_bindgen_ae99f146e73b6c1a ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_ae99f146e73b6c1a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ae99f146e73b6c1a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret7 = hs_bindgen_ae99f146e73b6c1a
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_5ac0a15c42b191c7" hs_bindgen_5ac0a15c42b191c7_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret8@
+hs_bindgen_5ac0a15c42b191c7 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_5ac0a15c42b191c7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5ac0a15c42b191c7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret8 = hs_bindgen_5ac0a15c42b191c7
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_0dbef4dde3b3d205" hs_bindgen_0dbef4dde3b3d205_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret9@
+hs_bindgen_0dbef4dde3b3d205 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_0dbef4dde3b3d205 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0dbef4dde3b3d205_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret9 = hs_bindgen_0dbef4dde3b3d205
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_c226f0b9bbf08c49" hs_bindgen_c226f0b9bbf08c49_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret10@
+hs_bindgen_c226f0b9bbf08c49 ::
+     BG.CInt
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_c226f0b9bbf08c49 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c226f0b9bbf08c49_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret10 = hs_bindgen_c226f0b9bbf08c49
diff --git a/test-artefacts/fixtures/macros/reparse.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.2.raw/bindingspec.yaml
@@ -0,0 +1,844 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse.h
+  cname: struct some_struct
+  hsname: Some_struct
+- headers: macros/reparse.h
+  cname: union some_union
+  hsname: Some_union
+- headers: macros/reparse.h
+  cname: enum some_enum
+  hsname: Some_enum
+  enum: open
+- headers: macros/reparse.h
+  cname: arr_typedef1
+  hsname: Arr_typedef1
+- headers: macros/reparse.h
+  cname: arr_typedef2
+  hsname: Arr_typedef2
+- headers: macros/reparse.h
+  cname: arr_typedef3
+  hsname: Arr_typedef3
+- headers: macros/reparse.h
+  cname: arr_typedef4
+  hsname: Arr_typedef4
+- headers: macros/reparse.h
+  cname: typedef1
+  hsname: Typedef1
+- headers: macros/reparse.h
+  cname: typedef2
+  hsname: Typedef2
+- headers: macros/reparse.h
+  cname: typedef3
+  hsname: Typedef3
+- headers: macros/reparse.h
+  cname: funptr_typedef1
+  hsname: Funptr_typedef1
+- headers: macros/reparse.h
+  cname: funptr_typedef2
+  hsname: Funptr_typedef2
+- headers: macros/reparse.h
+  cname: funptr_typedef3
+  hsname: Funptr_typedef3
+- headers: macros/reparse.h
+  cname: funptr_typedef4
+  hsname: Funptr_typedef4
+- headers: macros/reparse.h
+  cname: funptr_typedef5
+  hsname: Funptr_typedef5
+- headers: macros/reparse.h
+  cname: comments2
+  hsname: Comments2
+- headers: macros/reparse.h
+  cname: struct example_struct
+  hsname: Example_struct
+- headers: macros/reparse.h
+  cname: const_typedef1
+  hsname: Const_typedef1
+- headers: macros/reparse.h
+  cname: const_typedef2
+  hsname: Const_typedef2
+- headers: macros/reparse.h
+  cname: const_typedef3
+  hsname: Const_typedef3
+- headers: macros/reparse.h
+  cname: const_typedef4
+  hsname: Const_typedef4
+- headers: macros/reparse.h
+  cname: const_typedef5
+  hsname: Const_typedef5
+- headers: macros/reparse.h
+  cname: const_typedef6
+  hsname: Const_typedef6
+- headers: macros/reparse.h
+  cname: const_typedef7
+  hsname: Const_typedef7
+- headers: macros/reparse.h
+  cname: struct example_struct_with_const
+  hsname: Example_struct_with_const
+- headers: macros/reparse.h
+  cname: const_funptr1
+  hsname: Const_funptr1
+- headers: macros/reparse.h
+  cname: const_funptr2
+  hsname: Const_funptr2
+- headers: macros/reparse.h
+  cname: const_funptr3
+  hsname: Const_funptr3
+- headers: macros/reparse.h
+  cname: const_funptr4
+  hsname: Const_funptr4
+- headers: macros/reparse.h
+  cname: const_funptr5
+  hsname: Const_funptr5
+- headers: macros/reparse.h
+  cname: const_funptr6
+  hsname: Const_funptr6
+- headers: macros/reparse.h
+  cname: const_funptr7
+  hsname: Const_funptr7
+hstypes:
+- hsname: Arr_typedef1
+  representation:
+    newtype:
+      constructor: Arr_typedef1
+      fields:
+      - unwrapArr_typedef1
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: Arr_typedef2
+  representation:
+    newtype:
+      constructor: Arr_typedef2
+      fields:
+      - unwrapArr_typedef2
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: Arr_typedef3
+  representation:
+    newtype:
+      constructor: Arr_typedef3
+      fields:
+      - unwrapArr_typedef3
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Arr_typedef4
+  representation:
+    newtype:
+      constructor: Arr_typedef4
+      fields:
+      - unwrapArr_typedef4
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Comments2
+  representation:
+    newtype:
+      constructor: Comments2
+      fields:
+      - unwrapComments2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr1
+  representation:
+    newtype:
+      constructor: Const_funptr1
+      fields:
+      - unwrapConst_funptr1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr2
+  representation:
+    newtype:
+      constructor: Const_funptr2
+      fields:
+      - unwrapConst_funptr2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr3
+  representation:
+    newtype:
+      constructor: Const_funptr3
+      fields:
+      - unwrapConst_funptr3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr4
+  representation:
+    newtype:
+      constructor: Const_funptr4
+      fields:
+      - unwrapConst_funptr4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr5
+  representation:
+    newtype:
+      constructor: Const_funptr5
+      fields:
+      - unwrapConst_funptr5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr6
+  representation:
+    newtype:
+      constructor: Const_funptr6
+      fields:
+      - unwrapConst_funptr6
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr7
+  representation:
+    newtype:
+      constructor: Const_funptr7
+      fields:
+      - unwrapConst_funptr7
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef1
+  representation:
+    newtype:
+      constructor: Const_typedef1
+      fields:
+      - unwrapConst_typedef1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef2
+  representation:
+    newtype:
+      constructor: Const_typedef2
+      fields:
+      - unwrapConst_typedef2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef3
+  representation:
+    newtype:
+      constructor: Const_typedef3
+      fields:
+      - unwrapConst_typedef3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef4
+  representation:
+    newtype:
+      constructor: Const_typedef4
+      fields:
+      - unwrapConst_typedef4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef5
+  representation:
+    newtype:
+      constructor: Const_typedef5
+      fields:
+      - unwrapConst_typedef5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef6
+  representation:
+    newtype:
+      constructor: Const_typedef6
+      fields:
+      - unwrapConst_typedef6
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef7
+  representation:
+    newtype:
+      constructor: Const_typedef7
+      fields:
+      - unwrapConst_typedef7
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Example_struct
+  representation:
+    record:
+      constructor: Example_struct
+      fields:
+      - example_struct_field1
+      - example_struct_field2
+      - example_struct_field3
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Example_struct_with_const
+  representation:
+    record:
+      constructor: Example_struct_with_const
+      fields:
+      - example_struct_with_const_const_field1
+      - example_struct_with_const_const_field2
+      - example_struct_with_const_const_field3
+      - example_struct_with_const_const_field4
+      - example_struct_with_const_const_field5
+      - example_struct_with_const_const_field6
+      - example_struct_with_const_const_field7
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef1
+  representation:
+    newtype:
+      constructor: Funptr_typedef1
+      fields:
+      - unwrapFunptr_typedef1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef2
+  representation:
+    newtype:
+      constructor: Funptr_typedef2
+      fields:
+      - unwrapFunptr_typedef2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef3
+  representation:
+    newtype:
+      constructor: Funptr_typedef3
+      fields:
+      - unwrapFunptr_typedef3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef4
+  representation:
+    newtype:
+      constructor: Funptr_typedef4
+      fields:
+      - unwrapFunptr_typedef4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef5
+  representation:
+    newtype:
+      constructor: Funptr_typedef5
+      fields:
+      - unwrapFunptr_typedef5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_enum
+  representation:
+    newtype:
+      constructor: Some_enum
+      fields:
+      - unwrapSome_enum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_struct
+  representation:
+    record:
+      constructor: Some_struct
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_union
+  representation:
+    newtype:
+      constructor: Some_union
+      fields:
+      - unwrapSome_union
+  instances:
+  - Generic
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef1
+  representation:
+    newtype:
+      constructor: Typedef1
+      fields:
+      - unwrapTypedef1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef2
+  representation:
+    newtype:
+      constructor: Typedef2
+      fields:
+      - unwrapTypedef2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef3
+  representation:
+    newtype:
+      constructor: Typedef3
+      fields:
+      - unwrapTypedef3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse.2.raw/th.txt
@@ -0,0 +1,12129 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile test-artefacts/headers/golden/macros/reparse.h
+-- #include <macros/reparse.h>
+-- void hs_bindgen_14b56322053baa3f (
+--   signed int arg1,
+--   char arg2
+-- )
+-- {
+--   (args_char1)(arg1, arg2);
+-- }
+-- void hs_bindgen_05193644052d4324 (
+--   signed int arg1,
+--   signed char arg2
+-- )
+-- {
+--   (args_char2)(arg1, arg2);
+-- }
+-- void hs_bindgen_5b68ff22474d4775 (
+--   signed int arg1,
+--   unsigned char arg2
+-- )
+-- {
+--   (args_char3)(arg1, arg2);
+-- }
+-- void hs_bindgen_5a7d0b078ac418a1 (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short1)(arg1, arg2);
+-- }
+-- void hs_bindgen_6d391e69fc74dd4b (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short2)(arg1, arg2);
+-- }
+-- void hs_bindgen_d3d74caa6f6d43ab (
+--   signed int arg1,
+--   unsigned short arg2
+-- )
+-- {
+--   (args_short3)(arg1, arg2);
+-- }
+-- void hs_bindgen_d005292650dc9976 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int1)(arg1, arg2);
+-- }
+-- void hs_bindgen_2dde5b36f080e07d (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int2)(arg1, arg2);
+-- }
+-- void hs_bindgen_e7207b4f601fa789 (
+--   signed int arg1,
+--   unsigned int arg2
+-- )
+-- {
+--   (args_int3)(arg1, arg2);
+-- }
+-- void hs_bindgen_bc717d375990f9e5 (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long1)(arg1, arg2);
+-- }
+-- void hs_bindgen_db1215183538b75a (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long2)(arg1, arg2);
+-- }
+-- void hs_bindgen_3ac74c7cbfc79685 (
+--   signed int arg1,
+--   unsigned long arg2
+-- )
+-- {
+--   (args_long3)(arg1, arg2);
+-- }
+-- void hs_bindgen_a2388e64c2a84027 (
+--   signed int arg1,
+--   float arg2
+-- )
+-- {
+--   (args_float)(arg1, arg2);
+-- }
+-- void hs_bindgen_e5ad67302deb9698 (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   (args_double)(arg1, arg2);
+-- }
+-- void hs_bindgen_bad730ef968d4941 (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (args_bool1)(arg1, arg2);
+-- }
+-- void hs_bindgen_24f835bba72f92a3 (
+--   signed int arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   (args_struct)(arg1, *arg2);
+-- }
+-- void hs_bindgen_d06661c0e9399cf0 (
+--   signed int arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   (args_union)(arg1, *arg2);
+-- }
+-- void hs_bindgen_d37243b7a8d9d58d (
+--   signed int arg1,
+--   enum some_enum arg2
+-- )
+-- {
+--   (args_enum)(arg1, arg2);
+-- }
+-- void hs_bindgen_b3bd6759641d67eb (
+--   signed int arg1,
+--   signed int *arg2
+-- )
+-- {
+--   (args_pointer1)(arg1, arg2);
+-- }
+-- void hs_bindgen_97b00bc8a470fc69 (
+--   signed int arg1,
+--   signed int **arg2
+-- )
+-- {
+--   (args_pointer2)(arg1, arg2);
+-- }
+-- void hs_bindgen_07e7d187d95f6ca2 (
+--   signed int arg1,
+--   void *arg2
+-- )
+-- {
+--   (args_pointer3)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_144178893e488066 (void)
+-- {
+--   return (ret_A)();
+-- }
+-- char hs_bindgen_d7d2bc68373545e4 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char1)(arg1);
+-- }
+-- signed char hs_bindgen_aa47ca542df45b7b (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char2)(arg1);
+-- }
+-- unsigned char hs_bindgen_bcc15cd6faf7b787 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char3)(arg1);
+-- }
+-- signed short hs_bindgen_4ba7217a94e5e369 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short1)(arg1);
+-- }
+-- signed short hs_bindgen_ea4e41167ce3686a (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short2)(arg1);
+-- }
+-- unsigned short hs_bindgen_b1021a4826d326a1 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short3)(arg1);
+-- }
+-- signed int hs_bindgen_c23956482c29e1c5 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int1)(arg1);
+-- }
+-- signed int hs_bindgen_76475f626bf1d429 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int2)(arg1);
+-- }
+-- unsigned int hs_bindgen_e86e93b147924e4a (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int3)(arg1);
+-- }
+-- signed long hs_bindgen_2e5e9b9d09a32b33 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long1)(arg1);
+-- }
+-- signed long hs_bindgen_9541cb65d260ceec (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long2)(arg1);
+-- }
+-- unsigned long hs_bindgen_fca665017c551d32 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long3)(arg1);
+-- }
+-- float hs_bindgen_06152a76d70abec3 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_float)(arg1);
+-- }
+-- double hs_bindgen_fcbb5b65a6e8dee4 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_double)(arg1);
+-- }
+-- _Bool hs_bindgen_d2265e448c2759e9 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_bool1)(arg1);
+-- }
+-- void hs_bindgen_e6010e994241dd23 (
+--   signed int arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   *arg2 = (ret_struct)(arg1);
+-- }
+-- void hs_bindgen_00be97ea5e3606e4 (
+--   signed int arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   *arg2 = (ret_union)(arg1);
+-- }
+-- enum some_enum hs_bindgen_7ad2540b7cf6b817 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_enum)(arg1);
+-- }
+-- signed int *hs_bindgen_6dba6060a7ca10de (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer1)(arg1);
+-- }
+-- signed int **hs_bindgen_7af2522218790e65 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer2)(arg1);
+-- }
+-- void *hs_bindgen_88562aa8f53d0780 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer3)(arg1);
+-- }
+-- signed int hs_bindgen_b9b614c706b250e5 (
+--   signed int arg1
+-- )
+-- {
+--   return (body1)(arg1);
+-- }
+-- signed int hs_bindgen_b0559ae62627b030 (void)
+-- {
+--   return (body2)();
+-- }
+-- void hs_bindgen_ddfc5cefdbda545b (
+--   signed int arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   (args_complex_float)(arg1, *arg2);
+-- }
+-- void hs_bindgen_cbf4ca3c6e7f80aa (
+--   signed int arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   (args_complex_double)(arg1, *arg2);
+-- }
+-- void hs_bindgen_0f1f6ea0917ce0ca (
+--   signed int arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_float)(arg1);
+-- }
+-- void hs_bindgen_955f1c0b383d9a7c (
+--   signed int arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_double)(arg1);
+-- }
+-- void hs_bindgen_61695282305a53ac (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (bespoke_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_4c244649666e88b3 (
+--   signed int arg1,
+--   size_t arg2
+-- )
+-- {
+--   (bespoke_args2)(arg1, arg2);
+-- }
+-- _Bool hs_bindgen_1b4cd50ca08ff13a (
+--   signed int arg1
+-- )
+-- {
+--   return (bespoke_ret1)(arg1);
+-- }
+-- size_t hs_bindgen_71b4f4a34ec749c5 (
+--   signed int arg1
+-- )
+-- {
+--   return (bespoke_ret2)(arg1);
+-- }
+-- void hs_bindgen_8588314c8f45b7e1 (
+--   signed int *arg1
+-- )
+-- {
+--   (arr_args1)(arg1);
+-- }
+-- void hs_bindgen_2eb08d216276c1b7 (
+--   signed int **arg1
+-- )
+-- {
+--   (arr_args2)(arg1);
+-- }
+-- void hs_bindgen_9e0ebe19b98832b7 (
+--   signed int *arg1
+-- )
+-- {
+--   (arr_args3)(arg1);
+-- }
+-- void hs_bindgen_46bbe5c4f9a7db28 (
+--   signed int **arg1
+-- )
+-- {
+--   (arr_args4)(arg1);
+-- }
+-- void hs_bindgen_38985300d47b4487 (
+--   signed int arg1,
+--   void (*arg2) (void)
+-- )
+-- {
+--   (funptr_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_23d1626952d2a132 (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (funptr_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_69073b33110db81a (
+--   signed int arg1,
+--   void (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (funptr_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_9e6495d8345f7848 (
+--   signed int arg1,
+--   char (*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_d5ab1b462ff6c176 (
+--   signed int arg1,
+--   signed int *(*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args5)(arg1, arg2);
+-- }
+-- void hs_bindgen_17cfdc4afa81f262 (
+--   signed int arg1
+-- )
+-- {
+--   (comments1)(arg1);
+-- }
+-- void hs_bindgen_62dad052d7ac99e6 (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_6a954623e8847292 (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_5c4e5530b1f695b7 (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_d219b88b917d72cf (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_79a466a4f64a4db1 (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_a13884c8125a5f80 (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_5433c1896cba42d3 (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_8300ce11589589f2 (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_be304ec839983d7b (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_445a2c238c734060 (
+--   signed int arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_before4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_b5a05c2c1589c243 (
+--   signed int arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_before5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_8217e6e9e19e7627 (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_before6)(arg1, arg2);
+-- }
+-- void hs_bindgen_cbcb3411df130b42 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before7)(arg1, arg2);
+-- }
+-- void hs_bindgen_fb0ddd12de072fd8 (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_before8)(arg1, arg2);
+-- }
+-- void hs_bindgen_91e81e2ec29aa772 (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_6703a37e4fd098b1 (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_054259024219dbcc (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_eb4880610136c7bb (
+--   signed int arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_after4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_c0478c5f65c7e32e (
+--   signed int arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_after5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_764dd29ada03ac05 (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_after6)(arg1, arg2);
+-- }
+-- void hs_bindgen_62f2db62740aa47c (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after7)(arg1, arg2);
+-- }
+-- void hs_bindgen_f9349cbf0c433984 (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_after8)(arg1, arg2);
+-- }
+-- void hs_bindgen_05103ac5c64a70c5 (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_2adbdab03502d7c3 (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_02735f713f3663a0 (
+--   signed int arg1,
+--   signed int *const arg2
+-- )
+-- {
+--   (const_pointers_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_7be4b56f499736ec (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_07806340121e9d7a (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args5)(arg1, arg2);
+-- }
+-- signed int const *hs_bindgen_964ecbd6daab3ac8 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret1)(arg1);
+-- }
+-- signed int const *hs_bindgen_425aa26fa3f15a85 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret2)(arg1);
+-- }
+-- signed int *const hs_bindgen_35dc6a2376f4669c (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret3)(arg1);
+-- }
+-- signed int const *const hs_bindgen_b4704a8e3fa5c1a7 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret4)(arg1);
+-- }
+-- signed int const *const hs_bindgen_eee06f696926bceb (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret5)(arg1);
+-- }
+-- void hs_bindgen_85897c18c4db8c38 (
+--   signed int const *arg1
+-- )
+-- {
+--   (const_array_elem1)(arg1);
+-- }
+-- void hs_bindgen_7d19c28372388bd5 (
+--   signed int const **arg1
+-- )
+-- {
+--   (const_array_elem2)(arg1);
+-- }
+-- void hs_bindgen_b72db4cfe06fec75 (
+--   signed int *const *arg1
+-- )
+-- {
+--   (const_array_elem3)(arg1);
+-- }
+-- signed int hs_bindgen_8c2d8b6c768235a6 (void)
+-- {
+--   return (noParams1)();
+-- }
+-- signed int hs_bindgen_f406093f4244470f (void)
+-- {
+--   return (noParams2)();
+-- }
+-- void hs_bindgen_7cfe278ffc125a35 (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (noParams3)(arg1, arg2);
+-- }
+-- void (*hs_bindgen_6f95516796104481 (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return (funptr_ret1)(arg1);
+-- }
+-- signed int (*hs_bindgen_c823e0311ec509b4 (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return (funptr_ret2)(arg1);
+-- }
+-- void (*hs_bindgen_94550ec4aba19f7b (
+--   signed int arg1
+-- )) (
+--   signed int arg1
+-- )
+-- {
+--   return (funptr_ret3)(arg1);
+-- }
+-- char (*hs_bindgen_ed3e6ebe628da423 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret4)(arg1);
+-- }
+-- signed int *(*hs_bindgen_cb5a94e6610ff83d (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret5)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_8cd3005394354b86 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret6)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_0f1393247fcdeb7a (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret7)(arg1);
+-- }
+-- signed int *const (*hs_bindgen_7da05d4b5c843853 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret8)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_f6f304c980603aae (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret9)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_263377d0e4be3901 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret10)(arg1);
+-- }
+-- void hs_bindgen_dbcf45ae88784a43 (
+--   signed int arg1,
+--   char arg2
+-- )
+-- {
+--   (args_char1)(arg1, arg2);
+-- }
+-- void hs_bindgen_c72087f2b9c0a851 (
+--   signed int arg1,
+--   signed char arg2
+-- )
+-- {
+--   (args_char2)(arg1, arg2);
+-- }
+-- void hs_bindgen_d23034ca037d7ee2 (
+--   signed int arg1,
+--   unsigned char arg2
+-- )
+-- {
+--   (args_char3)(arg1, arg2);
+-- }
+-- void hs_bindgen_7aba582bac3cdd4c (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short1)(arg1, arg2);
+-- }
+-- void hs_bindgen_72e80c0c19b73bd1 (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short2)(arg1, arg2);
+-- }
+-- void hs_bindgen_1d779b6db021542e (
+--   signed int arg1,
+--   unsigned short arg2
+-- )
+-- {
+--   (args_short3)(arg1, arg2);
+-- }
+-- void hs_bindgen_dadb0390936fa7a6 (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int1)(arg1, arg2);
+-- }
+-- void hs_bindgen_cc4dd71da3d83f3e (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int2)(arg1, arg2);
+-- }
+-- void hs_bindgen_c1aa1895338c9c06 (
+--   signed int arg1,
+--   unsigned int arg2
+-- )
+-- {
+--   (args_int3)(arg1, arg2);
+-- }
+-- void hs_bindgen_ea3ab52d35940c9c (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long1)(arg1, arg2);
+-- }
+-- void hs_bindgen_1ead52aa138d51cf (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long2)(arg1, arg2);
+-- }
+-- void hs_bindgen_93b713dccaf06fed (
+--   signed int arg1,
+--   unsigned long arg2
+-- )
+-- {
+--   (args_long3)(arg1, arg2);
+-- }
+-- void hs_bindgen_d091d2dc36843d19 (
+--   signed int arg1,
+--   float arg2
+-- )
+-- {
+--   (args_float)(arg1, arg2);
+-- }
+-- void hs_bindgen_6ea5acb5ec6f40c4 (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   (args_double)(arg1, arg2);
+-- }
+-- void hs_bindgen_689ef6ac4e916b3a (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (args_bool1)(arg1, arg2);
+-- }
+-- void hs_bindgen_3d21d6b68f84eba6 (
+--   signed int arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   (args_struct)(arg1, *arg2);
+-- }
+-- void hs_bindgen_6c2746bae9e4dab9 (
+--   signed int arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   (args_union)(arg1, *arg2);
+-- }
+-- void hs_bindgen_6c549405e9baffcf (
+--   signed int arg1,
+--   enum some_enum arg2
+-- )
+-- {
+--   (args_enum)(arg1, arg2);
+-- }
+-- void hs_bindgen_34dfa5eaf97951ec (
+--   signed int arg1,
+--   signed int *arg2
+-- )
+-- {
+--   (args_pointer1)(arg1, arg2);
+-- }
+-- void hs_bindgen_0d71e7152a20efbd (
+--   signed int arg1,
+--   signed int **arg2
+-- )
+-- {
+--   (args_pointer2)(arg1, arg2);
+-- }
+-- void hs_bindgen_1ac8f30e6858a673 (
+--   signed int arg1,
+--   void *arg2
+-- )
+-- {
+--   (args_pointer3)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_74c085d1fc547d65 (void)
+-- {
+--   return (ret_A)();
+-- }
+-- char hs_bindgen_c1173d352155de62 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char1)(arg1);
+-- }
+-- signed char hs_bindgen_9029d84b81d6df97 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char2)(arg1);
+-- }
+-- unsigned char hs_bindgen_5076ef968e0b1da6 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_char3)(arg1);
+-- }
+-- signed short hs_bindgen_6c9415155d57e014 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short1)(arg1);
+-- }
+-- signed short hs_bindgen_24f9af60f9d4b0c4 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short2)(arg1);
+-- }
+-- unsigned short hs_bindgen_7712cc06577c000f (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_short3)(arg1);
+-- }
+-- signed int hs_bindgen_a4669df8abb549dc (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int1)(arg1);
+-- }
+-- signed int hs_bindgen_d471d89e2802f599 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int2)(arg1);
+-- }
+-- unsigned int hs_bindgen_551866464fb7e076 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_int3)(arg1);
+-- }
+-- signed long hs_bindgen_1cb0ba330b8fc708 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long1)(arg1);
+-- }
+-- signed long hs_bindgen_84d65e5f2bb20468 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long2)(arg1);
+-- }
+-- unsigned long hs_bindgen_8e5c7c7b2f385152 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_long3)(arg1);
+-- }
+-- float hs_bindgen_be7b5328fb1e67e4 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_float)(arg1);
+-- }
+-- double hs_bindgen_67ccecb1f4c2b26b (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_double)(arg1);
+-- }
+-- _Bool hs_bindgen_8f3058d29b19c7f8 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_bool1)(arg1);
+-- }
+-- void hs_bindgen_db41d471db80076d (
+--   signed int arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   *arg2 = (ret_struct)(arg1);
+-- }
+-- void hs_bindgen_a2761d3935650b5c (
+--   signed int arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   *arg2 = (ret_union)(arg1);
+-- }
+-- enum some_enum hs_bindgen_c567484984a48bdd (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_enum)(arg1);
+-- }
+-- signed int *hs_bindgen_a0436717a3858ec2 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer1)(arg1);
+-- }
+-- signed int **hs_bindgen_92e30e7cf97b7ae8 (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer2)(arg1);
+-- }
+-- void *hs_bindgen_cec80a82e028945d (
+--   signed int arg1
+-- )
+-- {
+--   return (ret_pointer3)(arg1);
+-- }
+-- signed int hs_bindgen_373d2dbedb7f3ea1 (
+--   signed int arg1
+-- )
+-- {
+--   return (body1)(arg1);
+-- }
+-- signed int hs_bindgen_678c705d71b66fd0 (void)
+-- {
+--   return (body2)();
+-- }
+-- void hs_bindgen_4a4cdf60b6a4885d (
+--   signed int arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   (args_complex_float)(arg1, *arg2);
+-- }
+-- void hs_bindgen_4b113ac08bbb35bd (
+--   signed int arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   (args_complex_double)(arg1, *arg2);
+-- }
+-- void hs_bindgen_63483820a803fad0 (
+--   signed int arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_float)(arg1);
+-- }
+-- void hs_bindgen_00dc8901b39e6dd3 (
+--   signed int arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_double)(arg1);
+-- }
+-- void hs_bindgen_c4123c64e3799da5 (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (bespoke_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_56568d64374ea82a (
+--   signed int arg1,
+--   size_t arg2
+-- )
+-- {
+--   (bespoke_args2)(arg1, arg2);
+-- }
+-- _Bool hs_bindgen_e39afd1aad07e0fc (
+--   signed int arg1
+-- )
+-- {
+--   return (bespoke_ret1)(arg1);
+-- }
+-- size_t hs_bindgen_06a7ca6b10b6f1c5 (
+--   signed int arg1
+-- )
+-- {
+--   return (bespoke_ret2)(arg1);
+-- }
+-- void hs_bindgen_085cd2205e0daeff (
+--   signed int *arg1
+-- )
+-- {
+--   (arr_args1)(arg1);
+-- }
+-- void hs_bindgen_0df3319af542c072 (
+--   signed int **arg1
+-- )
+-- {
+--   (arr_args2)(arg1);
+-- }
+-- void hs_bindgen_4839d1f4a2742c03 (
+--   signed int *arg1
+-- )
+-- {
+--   (arr_args3)(arg1);
+-- }
+-- void hs_bindgen_c7e68dd8759c969a (
+--   signed int **arg1
+-- )
+-- {
+--   (arr_args4)(arg1);
+-- }
+-- void hs_bindgen_bf24f137d6217c14 (
+--   signed int arg1,
+--   void (*arg2) (void)
+-- )
+-- {
+--   (funptr_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_2b6cd604640b023f (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (funptr_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_9c35d7346db373f0 (
+--   signed int arg1,
+--   void (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (funptr_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_60245cd22b3cd59b (
+--   signed int arg1,
+--   char (*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_bcd5e0817da0463b (
+--   signed int arg1,
+--   signed int *(*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args5)(arg1, arg2);
+-- }
+-- void hs_bindgen_fd3d542dfefd036e (
+--   signed int arg1
+-- )
+-- {
+--   (comments1)(arg1);
+-- }
+-- void hs_bindgen_0819c4409f0cb04f (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_d31ae17d88140355 (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_f0ed5f637cefe96f (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_0215a515d1fa3dfa (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_e103c029e3630b33 (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_bef8a67258cb736b (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_589e465944877183 (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_fef23ca0f7241d44 (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_12ed6589e368a6d9 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_acfc6cbb94266577 (
+--   signed int arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_before4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_e452087578f98911 (
+--   signed int arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_before5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_a943f6ee50043676 (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_before6)(arg1, arg2);
+-- }
+-- void hs_bindgen_425f71a0e411bca9 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before7)(arg1, arg2);
+-- }
+-- void hs_bindgen_297d1f2aa423722a (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_before8)(arg1, arg2);
+-- }
+-- void hs_bindgen_136c1c8ee6a77c65 (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_876526a42ba48417 (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_b309fa8d82dd7b72 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_b7b3fe289c724859 (
+--   signed int arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_after4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_55b1796019967748 (
+--   signed int arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_after5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_b10d1e8f7c40c632 (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_after6)(arg1, arg2);
+-- }
+-- void hs_bindgen_04406c6b24b54172 (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after7)(arg1, arg2);
+-- }
+-- void hs_bindgen_ae945fd854416c29 (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_after8)(arg1, arg2);
+-- }
+-- void hs_bindgen_315fb7a4e52f51bb (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_c8fe0d37027b1cbd (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_585e1489b3f5af58 (
+--   signed int arg1,
+--   signed int *const arg2
+-- )
+-- {
+--   (const_pointers_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_b9568a159c32cefc (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_85f146afc2a27268 (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args5)(arg1, arg2);
+-- }
+-- signed int const *hs_bindgen_ea6a7e1d0274f90d (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret1)(arg1);
+-- }
+-- signed int const *hs_bindgen_ae320a2e858ccc98 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret2)(arg1);
+-- }
+-- signed int *const hs_bindgen_3ca6c6656d62db21 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret3)(arg1);
+-- }
+-- signed int const *const hs_bindgen_83d0056641627b70 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret4)(arg1);
+-- }
+-- signed int const *const hs_bindgen_89f54f00e5f1ec61 (
+--   signed int arg1
+-- )
+-- {
+--   return (const_pointers_ret5)(arg1);
+-- }
+-- void hs_bindgen_445aea27fa0b55be (
+--   signed int const *arg1
+-- )
+-- {
+--   (const_array_elem1)(arg1);
+-- }
+-- void hs_bindgen_2f9fd49dce178c29 (
+--   signed int const **arg1
+-- )
+-- {
+--   (const_array_elem2)(arg1);
+-- }
+-- void hs_bindgen_99716bef732a1af1 (
+--   signed int *const *arg1
+-- )
+-- {
+--   (const_array_elem3)(arg1);
+-- }
+-- signed int hs_bindgen_1721fcf9bca3ea61 (void)
+-- {
+--   return (noParams1)();
+-- }
+-- signed int hs_bindgen_95fe913b1eec4f4e (void)
+-- {
+--   return (noParams2)();
+-- }
+-- void hs_bindgen_d15b46c7c30f29ac (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (noParams3)(arg1, arg2);
+-- }
+-- void (*hs_bindgen_fe09e75d56f9869e (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return (funptr_ret1)(arg1);
+-- }
+-- signed int (*hs_bindgen_7f6cbcd68ce4b354 (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return (funptr_ret2)(arg1);
+-- }
+-- void (*hs_bindgen_1bcf333c8e82d009 (
+--   signed int arg1
+-- )) (
+--   signed int arg1
+-- )
+-- {
+--   return (funptr_ret3)(arg1);
+-- }
+-- char (*hs_bindgen_4793bc049c8510a4 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret4)(arg1);
+-- }
+-- signed int *(*hs_bindgen_abb2d85efd4fcb3e (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret5)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_6cf3159cf7618393 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret6)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_ae99f146e73b6c1a (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret7)(arg1);
+-- }
+-- signed int *const (*hs_bindgen_5ac0a15c42b191c7 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret8)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_0dbef4dde3b3d205 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret9)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_c226f0b9bbf08c49 (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret10)(arg1);
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_char1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_30055b4cfdb7a3e2 (void)) (
+--   signed int arg1,
+--   char arg2
+-- )
+-- {
+--   return &args_char1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_char2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_44f283f141f81fc4 (void)) (
+--   signed int arg1,
+--   signed char arg2
+-- )
+-- {
+--   return &args_char2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_char3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_27b5bf56bbc8f080 (void)) (
+--   signed int arg1,
+--   unsigned char arg2
+-- )
+-- {
+--   return &args_char3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_short1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_985bed578f09aef8 (void)) (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   return &args_short1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_short2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_4213a6df8d0c03f1 (void)) (
+--   signed int arg1,
+--   signed short arg2
+-- )
+-- {
+--   return &args_short2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_short3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_82e313aaa763196f (void)) (
+--   signed int arg1,
+--   unsigned short arg2
+-- )
+-- {
+--   return &args_short3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_int1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_605e1f38f823a881 (void)) (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &args_int1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_int2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3b8afc742e92814e (void)) (
+--   signed int arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &args_int2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_int3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_bf10dc64323b0995 (void)) (
+--   signed int arg1,
+--   unsigned int arg2
+-- )
+-- {
+--   return &args_int3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_long1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dae65ec08c1d514e (void)) (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   return &args_long1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_long2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e83db9fe9e4243df (void)) (
+--   signed int arg1,
+--   signed long arg2
+-- )
+-- {
+--   return &args_long2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_long3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_42d83281e20c0186 (void)) (
+--   signed int arg1,
+--   unsigned long arg2
+-- )
+-- {
+--   return &args_long3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_float */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3b0ba5af6ce01aed (void)) (
+--   signed int arg1,
+--   float arg2
+-- )
+-- {
+--   return &args_float;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_double */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d14a589fdc8b9407 (void)) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &args_double;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_bool1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a829f5810873021d (void)) (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   return &args_bool1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_struct */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_243cc2e9d0181102 (void)) (
+--   signed int arg1,
+--   struct some_struct arg2
+-- )
+-- {
+--   return &args_struct;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_union */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b3e0ceada39fdc01 (void)) (
+--   signed int arg1,
+--   union some_union arg2
+-- )
+-- {
+--   return &args_union;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_enum */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d11159ff99847117 (void)) (
+--   signed int arg1,
+--   enum some_enum arg2
+-- )
+-- {
+--   return &args_enum;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_pointer1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f3c28cbcc1bc9d17 (void)) (
+--   signed int arg1,
+--   signed int *arg2
+-- )
+-- {
+--   return &args_pointer1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_pointer2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_190bfc6a0f4bff4f (void)) (
+--   signed int arg1,
+--   signed int **arg2
+-- )
+-- {
+--   return &args_pointer2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_pointer3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_26b1c20d174e45d5 (void)) (
+--   signed int arg1,
+--   void *arg2
+-- )
+-- {
+--   return &args_pointer3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_A */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_8760cbd218bc55d1 (void)) (void)
+-- {
+--   return &ret_A;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_char1 */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_e910062cffeff2d2 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_char1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_char2 */
+-- __attribute__ ((const))
+-- signed char (*hs_bindgen_d9218f2ac4ee5a50 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_char2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_char3 */
+-- __attribute__ ((const))
+-- unsigned char (*hs_bindgen_7a2d6ef06c7567a1 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_char3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_short1 */
+-- __attribute__ ((const))
+-- signed short (*hs_bindgen_c715ac00f4ca7f36 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_short1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_short2 */
+-- __attribute__ ((const))
+-- signed short (*hs_bindgen_880f34b16d908c1f (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_short2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_short3 */
+-- __attribute__ ((const))
+-- unsigned short (*hs_bindgen_ea8c8e8164273c1a (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_short3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_int1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_97a22a914dd2414c (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_int1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_int2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_77a2b7921cb7566a (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_int2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_int3 */
+-- __attribute__ ((const))
+-- unsigned int (*hs_bindgen_0dc8eed9c02e16ff (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_int3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_long1 */
+-- __attribute__ ((const))
+-- signed long (*hs_bindgen_8a42512fc931fa53 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_long1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_long2 */
+-- __attribute__ ((const))
+-- signed long (*hs_bindgen_8293ce652f4875b7 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_long2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_long3 */
+-- __attribute__ ((const))
+-- unsigned long (*hs_bindgen_1ca2d3b54e331b1f (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_long3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_float */
+-- __attribute__ ((const))
+-- float (*hs_bindgen_5362002da5a787ba (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_float;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_double */
+-- __attribute__ ((const))
+-- double (*hs_bindgen_0ae8c6485107bf6f (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_double;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_bool1 */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_04d8f1fc8df996ba (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_bool1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_struct */
+-- __attribute__ ((const))
+-- struct some_struct (*hs_bindgen_b7cd9769c7dac7b8 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_struct;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_union */
+-- __attribute__ ((const))
+-- union some_union (*hs_bindgen_b4afde7383e5aff4 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_union;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_enum */
+-- __attribute__ ((const))
+-- enum some_enum (*hs_bindgen_239f0b420c073c18 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_enum;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_pointer1 */
+-- __attribute__ ((const))
+-- signed int *(*hs_bindgen_56eab0f8d0bdf79f (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_pointer1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_pointer2 */
+-- __attribute__ ((const))
+-- signed int **(*hs_bindgen_4c952a3d40721870 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_pointer2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_pointer3 */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_ccb0b4753d3e2490 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_pointer3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_body1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_442c91e88aec2368 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &body1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_body2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_cfbec40e47da01c3 (void)) (void)
+-- {
+--   return &body2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_complex_float */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_4319227a8aaa0b24 (void)) (
+--   signed int arg1,
+--   float _Complex arg2
+-- )
+-- {
+--   return &args_complex_float;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_args_complex_double */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9620841c151e1094 (void)) (
+--   signed int arg1,
+--   double _Complex arg2
+-- )
+-- {
+--   return &args_complex_double;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_complex_float */
+-- __attribute__ ((const))
+-- float _Complex (*hs_bindgen_aa2302691b1dc578 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_complex_float;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_ret_complex_double */
+-- __attribute__ ((const))
+-- double _Complex (*hs_bindgen_27f2ccb0e11ce3d4 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &ret_complex_double;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_bespoke_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_5f39596c5788b2cf (void)) (
+--   signed int arg1,
+--   _Bool arg2
+-- )
+-- {
+--   return &bespoke_args1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_bespoke_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6fc3008f0e66bd81 (void)) (
+--   signed int arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &bespoke_args2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_bespoke_ret1 */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_02e119349dfc0dc6 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bespoke_ret1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_bespoke_ret2 */
+-- __attribute__ ((const))
+-- size_t (*hs_bindgen_447b3d2bccfb7ae8 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bespoke_ret2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_arr_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_869038d8098a2bf2 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &arr_args1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_arr_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d97856ae41779071 (void)) (
+--   signed int **arg1
+-- )
+-- {
+--   return &arr_args2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_arr_args3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e5fcdc276e072021 (void)) (
+--   signed int *arg1
+-- )
+-- {
+--   return &arr_args3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_arr_args4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_5960a1a097c40b0b (void)) (
+--   signed int **arg1
+-- )
+-- {
+--   return &arr_args4;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6e1c21a20bf17727 (void)) (
+--   signed int arg1,
+--   void (*arg2) (void)
+-- )
+-- {
+--   return &funptr_args1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_316b1d39ef1c99c8 (void)) (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   return &funptr_args2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_args3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3b587acc49334022 (void)) (
+--   signed int arg1,
+--   void (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &funptr_args3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_args4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_880f8ecb89c20f54 (void)) (
+--   signed int arg1,
+--   char (*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   return &funptr_args4;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_args5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_25220e78ceba78f8 (void)) (
+--   signed int arg1,
+--   signed int *(*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   return &funptr_args5;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_comments1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6cef08508aed5305 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &comments1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_prim_before1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_71a50f57cd1216e6 (void)) (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   return &const_prim_before1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_prim_before2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_5233d49c08278554 (void)) (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   return &const_prim_before2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_prim_before3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b47263d563e229b2 (void)) (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   return &const_prim_before3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_prim_after1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9b538efe2347a74e (void)) (
+--   signed int arg1,
+--   char const arg2
+-- )
+-- {
+--   return &const_prim_after1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_prim_after2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e9bd30449260d07b (void)) (
+--   signed int arg1,
+--   signed char const arg2
+-- )
+-- {
+--   return &const_prim_after2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_prim_after3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f1e92cd065630ccb (void)) (
+--   signed int arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   return &const_prim_after3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_before1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_aea63f55c25fa26d (void)) (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   return &const_withoutSign_before1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_before2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1a34eb11a6ccfd86 (void)) (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   return &const_withoutSign_before2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_before3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d9af8e3a8991a2e4 (void)) (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_before3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_before4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_558f393b1eddf40d (void)) (
+--   signed int arg1,
+--   struct some_struct const arg2
+-- )
+-- {
+--   return &const_withoutSign_before4;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_before5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e62c93c0973b2781 (void)) (
+--   signed int arg1,
+--   union some_union const arg2
+-- )
+-- {
+--   return &const_withoutSign_before5;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_before6 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e56acb4f339a362d (void)) (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   return &const_withoutSign_before6;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_before7 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c298f88f131c980b (void)) (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_before7;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_before8 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_38d5cf2b5d94860c (void)) (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   return &const_withoutSign_before8;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_after1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_362151a5ba0ce905 (void)) (
+--   signed int arg1,
+--   float const arg2
+-- )
+-- {
+--   return &const_withoutSign_after1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_after2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_071d6b5b46afca86 (void)) (
+--   signed int arg1,
+--   double const arg2
+-- )
+-- {
+--   return &const_withoutSign_after2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_after3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cb70cd180a753e3a (void)) (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_after3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_after4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_17e67974fc77dde6 (void)) (
+--   signed int arg1,
+--   struct some_struct const arg2
+-- )
+-- {
+--   return &const_withoutSign_after4;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_after5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_aea1ac49e3a717ae (void)) (
+--   signed int arg1,
+--   union some_union const arg2
+-- )
+-- {
+--   return &const_withoutSign_after5;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_after6 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_89ad81e6dc3a6ed4 (void)) (
+--   signed int arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   return &const_withoutSign_after6;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_after7 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_29b119a94317aae6 (void)) (
+--   signed int arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_after7;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_withoutSign_after8 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_be8db07cc695795d (void)) (
+--   signed int arg1,
+--   size_t const arg2
+-- )
+-- {
+--   return &const_withoutSign_after8;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3f4562f74152c205 (void)) (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return &const_pointers_args1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_87278ccb01e7fee0 (void)) (
+--   signed int arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return &const_pointers_args2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_args3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1e25b241655c3ebb (void)) (
+--   signed int arg1,
+--   signed int *const arg2
+-- )
+-- {
+--   return &const_pointers_args3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_args4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fa94aed37836859b (void)) (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   return &const_pointers_args4;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_args5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_800407f1e67deddb (void)) (
+--   signed int arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   return &const_pointers_args5;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_ret1 */
+-- __attribute__ ((const))
+-- signed int const *(*hs_bindgen_91e3fb45ca972f9d (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_ret2 */
+-- __attribute__ ((const))
+-- signed int const *(*hs_bindgen_ce269be70accca82 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_ret3 */
+-- __attribute__ ((const))
+-- signed int *const (*hs_bindgen_f0f2ae46270c9785 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_ret4 */
+-- __attribute__ ((const))
+-- signed int const *const (*hs_bindgen_4ecbc6cf48fbe0c3 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret4;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_pointers_ret5 */
+-- __attribute__ ((const))
+-- signed int const *const (*hs_bindgen_c0b16cd44f63f52f (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &const_pointers_ret5;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_array_elem1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_db9eb973118a6fbf (void)) (
+--   signed int const *arg1
+-- )
+-- {
+--   return &const_array_elem1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_array_elem2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9288cd4171172005 (void)) (
+--   signed int const **arg1
+-- )
+-- {
+--   return &const_array_elem2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const_array_elem3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c20403bc692b1bde (void)) (
+--   signed int *const *arg1
+-- )
+-- {
+--   return &const_array_elem3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_noParams1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_5ca24e7f6ac8cff0 (void)) (void)
+-- {
+--   return &noParams1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_noParams2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_6f664f6fdcbced27 (void)) (void)
+-- {
+--   return &noParams2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_noParams3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1067f730bd5b4c43 (void)) (
+--   signed int arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   return &noParams3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret1 */
+-- __attribute__ ((const))
+-- void (*(*hs_bindgen_6b5258a8560bc11c (void)) (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return &funptr_ret1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret2 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_723b02be7cb23263 (void)) (
+--   signed int arg1
+-- )) (void)
+-- {
+--   return &funptr_ret2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret3 */
+-- __attribute__ ((const))
+-- void (*(*hs_bindgen_7c4d8fc844c6f97b (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1
+-- )
+-- {
+--   return &funptr_ret3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret4 */
+-- __attribute__ ((const))
+-- char (*(*hs_bindgen_25b578cce360cf12 (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret4;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret5 */
+-- __attribute__ ((const))
+-- signed int *(*(*hs_bindgen_5e58691a68a915de (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret5;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret6 */
+-- __attribute__ ((const))
+-- signed int const *(*(*hs_bindgen_0c36a271f93a9dff (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret6;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret7 */
+-- __attribute__ ((const))
+-- signed int const *(*(*hs_bindgen_67439554fe1e797d (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret7;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret8 */
+-- __attribute__ ((const))
+-- signed int *const (*(*hs_bindgen_870a61b2b66eecf3 (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret8;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret9 */
+-- __attribute__ ((const))
+-- signed int const *const (*(*hs_bindgen_e7920c47095333a3 (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret9;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_funptr_ret10 */
+-- __attribute__ ((const))
+-- signed int const *const (*(*hs_bindgen_aa1eab9b222fa4b8 (void)) (
+--   signed int arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret10;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_global1 */
+-- __attribute__ ((const))
+-- signed int *hs_bindgen_93cfa28c4d516159 (void)
+-- {
+--   return &global1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_global2 */
+-- __attribute__ ((const))
+-- signed int **hs_bindgen_9d8438d8f0c6d639 (void)
+-- {
+--   return &global2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_global3 */
+-- __attribute__ ((const))
+-- signed int ***hs_bindgen_29516306ddb7335f (void)
+-- {
+--   return &global3;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const1 */
+-- __attribute__ ((const))
+-- signed int const *hs_bindgen_3326ba6dde505604 (void)
+-- {
+--   return &const1;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const2 */
+-- __attribute__ ((const))
+-- signed int *const *hs_bindgen_8add8e4cd4511ebc (void)
+-- {
+--   return &const2;
+-- }
+-- /* test_macrosreparse_2_raw_Example_get_const3 */
+-- __attribute__ ((const))
+-- signed int **const *hs_bindgen_e00a055156bc89e4 (void)
+-- {
+--   return &const3;
+-- }
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse.h 3:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+a :: Raw String
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse.h 3:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+a = objectLike "A" ["int"]
+{-| __C declaration:__ @struct some_struct@
+
+    __defined at:__ @macros\/reparse.h 7:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Some_struct
+    = Some_struct {}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Some_struct
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Some_struct
+    where readRaw = \ptr_0 -> pure Some_struct
+instance WriteRaw Some_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Some_struct -> pure ()
+deriving via (EquivStorable Some_struct) instance Storable Some_struct
+deriving via (IsStructViaReadRaw Some_struct) instance IsStruct Some_struct
+{-| __C declaration:__ @union some_union@
+
+    __defined at:__ @macros\/reparse.h 8:7@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_union
+    = Some_union {unwrapSome_union :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 0 1) instance StaticSize Some_union
+deriving via (SizedByteArray 0 1) instance ReadRaw Some_union
+deriving via (SizedByteArray 0 1) instance WriteRaw Some_union
+deriving via (EquivStorable Some_union) instance Storable Some_union
+deriving via (SizedByteArray 0 1) instance IsUnion Some_union
+{-| __C declaration:__ @enum some_enum@
+
+    __defined at:__ @macros\/reparse.h 9:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_enum
+    = Some_enum {unwrapSome_enum :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Some_enum
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Some_enum
+    where readRaw = \ptr_0 -> pure Some_enum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Some_enum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Some_enum unwrapSome_enum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapSome_enum_2
+deriving via (EquivStorable Some_enum) instance Storable Some_enum
+deriving via CUInt instance Prim Some_enum
+instance CEnum Some_enum
+    where type CEnumZ Some_enum = CUInt
+          toCEnum = Some_enum
+          fromCEnum = getField @"unwrapSome_enum"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "ENUM_A")]
+          showsUndeclared = showsWrappedUndeclared "Some_enum"
+          readPrecUndeclared = readPrecWrappedUndeclared "Some_enum"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Some_enum
+    where minDeclaredValue = ENUM_A
+          maxDeclaredValue = ENUM_A
+instance Show Some_enum
+    where showsPrec = shows
+instance Read Some_enum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapSome_enum" Some_enum ty
+    where hasField = \x_0 -> (\y_1 -> Some_enum{unwrapSome_enum = y_1},
+                              getField @"unwrapSome_enum" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapSome_enum" (Ptr Some_enum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSome_enum")
+instance HasCField Some_enum "unwrapSome_enum"
+    where type CFieldType Some_enum "unwrapSome_enum" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @ENUM_A@
+
+    __defined at:__ @macros\/reparse.h 9:18@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+pattern ENUM_A :: Some_enum
+pattern ENUM_A = Some_enum 0
+{-| __C declaration:__ @arr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 109:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef1
+    = Arr_typedef1 {unwrapArr_typedef1 :: (IncompleteArray CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapArr_typedef1" Arr_typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef1{unwrapArr_typedef1 = y_1},
+                              getField @"unwrapArr_typedef1" x_0)
+instance (~) ty (IncompleteArray CInt) =>
+         HasField "unwrapArr_typedef1" (Ptr Arr_typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef1")
+instance HasCField Arr_typedef1 "unwrapArr_typedef1"
+    where type CFieldType Arr_typedef1
+                          "unwrapArr_typedef1" = IncompleteArray CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @arr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 110:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef2
+    = Arr_typedef2 {unwrapArr_typedef2 :: (IncompleteArray (Ptr CInt))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray (Ptr CInt)) =>
+         HasField "unwrapArr_typedef2" Arr_typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef2{unwrapArr_typedef2 = y_1},
+                              getField @"unwrapArr_typedef2" x_0)
+instance (~) ty (IncompleteArray (Ptr CInt)) =>
+         HasField "unwrapArr_typedef2" (Ptr Arr_typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef2")
+instance HasCField Arr_typedef2 "unwrapArr_typedef2"
+    where type CFieldType Arr_typedef2
+                          "unwrapArr_typedef2" = IncompleteArray (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @arr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 111:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef3
+    = Arr_typedef3 {unwrapArr_typedef3 :: (ConstantArray 5 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 5 CInt) =>
+         HasField "unwrapArr_typedef3" Arr_typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef3{unwrapArr_typedef3 = y_1},
+                              getField @"unwrapArr_typedef3" x_0)
+instance (~) ty (ConstantArray 5 CInt) =>
+         HasField "unwrapArr_typedef3" (Ptr Arr_typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef3")
+instance HasCField Arr_typedef3 "unwrapArr_typedef3"
+    where type CFieldType Arr_typedef3
+                          "unwrapArr_typedef3" = ConstantArray 5 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @arr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 112:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef4
+    = Arr_typedef4 {unwrapArr_typedef4 :: (ConstantArray 5 (Ptr CInt))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 5 (Ptr CInt)) =>
+         HasField "unwrapArr_typedef4" Arr_typedef4 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef4{unwrapArr_typedef4 = y_1},
+                              getField @"unwrapArr_typedef4" x_0)
+instance (~) ty (ConstantArray 5 (Ptr CInt)) =>
+         HasField "unwrapArr_typedef4" (Ptr Arr_typedef4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef4")
+instance HasCField Arr_typedef4 "unwrapArr_typedef4"
+    where type CFieldType Arr_typedef4
+                          "unwrapArr_typedef4" = ConstantArray 5 (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| Typedefs
+
+    __C declaration:__ @typedef1@
+
+    __defined at:__ @macros\/reparse.h 118:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef1
+    = Typedef1 {unwrapTypedef1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapTypedef1" Typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Typedef1{unwrapTypedef1 = y_1},
+                              getField @"unwrapTypedef1" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapTypedef1" (Ptr Typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypedef1")
+instance HasCField Typedef1 "unwrapTypedef1"
+    where type CFieldType Typedef1 "unwrapTypedef1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @typedef2@
+
+    __defined at:__ @macros\/reparse.h 119:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef2
+    = Typedef2 {unwrapTypedef2 :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) => HasField "unwrapTypedef2" Typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Typedef2{unwrapTypedef2 = y_1},
+                              getField @"unwrapTypedef2" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapTypedef2" (Ptr Typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypedef2")
+instance HasCField Typedef2 "unwrapTypedef2"
+    where type CFieldType Typedef2 "unwrapTypedef2" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @typedef3@
+
+    __defined at:__ @macros\/reparse.h 120:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef3
+    = Typedef3 {unwrapTypedef3 :: (Ptr (Ptr CInt))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr CInt)) =>
+         HasField "unwrapTypedef3" Typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Typedef3{unwrapTypedef3 = y_1},
+                              getField @"unwrapTypedef3" x_0)
+instance (~) ty (Ptr (Ptr CInt)) =>
+         HasField "unwrapTypedef3" (Ptr Typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypedef3")
+instance HasCField Typedef3 "unwrapTypedef3"
+    where type CFieldType Typedef3 "unwrapTypedef3" = Ptr (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef1'
+
+    __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1_Aux
+    = Funptr_typedef1_Aux {unwrapFunptr_typedef1_Aux :: (IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c584d0f839fd43de_base ::
+    IO CInt
+ -> IO (FunPtr (IO CInt))
+-- __unique:__ @toFunptr_typedef1_Aux@
+hs_bindgen_c584d0f839fd43de :: Funptr_typedef1_Aux ->
+                               IO (FunPtr Funptr_typedef1_Aux)
+-- __unique:__ @toFunptr_typedef1_Aux@
+hs_bindgen_c584d0f839fd43de = \fun_0 -> fmap castFunPtr (hs_bindgen_c584d0f839fd43de_base (fmap toFFIType (getField @"unwrapFunptr_typedef1_Aux" fun_0)))
+-- __unique:__ @fromFunptr_typedef1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_806a46dc418a062c_base ::
+    FunPtr (IO CInt)
+ -> IO CInt
+-- __unique:__ @fromFunptr_typedef1_Aux@
+hs_bindgen_806a46dc418a062c :: FunPtr Funptr_typedef1_Aux ->
+                               Funptr_typedef1_Aux
+-- __unique:__ @fromFunptr_typedef1_Aux@
+hs_bindgen_806a46dc418a062c = \funPtr_0 -> Funptr_typedef1_Aux (fmap fromFFIType (hs_bindgen_806a46dc418a062c_base (castFunPtr funPtr_0)))
+instance ToFunPtr Funptr_typedef1_Aux
+    where toFunPtr = hs_bindgen_c584d0f839fd43de
+instance FromFunPtr Funptr_typedef1_Aux
+    where fromFunPtr = hs_bindgen_806a46dc418a062c
+instance (~) ty (IO CInt) =>
+         HasField "unwrapFunptr_typedef1_Aux" Funptr_typedef1_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef1_Aux{unwrapFunptr_typedef1_Aux = y_1},
+                              getField @"unwrapFunptr_typedef1_Aux" x_0)
+instance (~) ty (IO CInt) =>
+         HasField "unwrapFunptr_typedef1_Aux"
+                  (Ptr Funptr_typedef1_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef1_Aux")
+instance HasCField Funptr_typedef1_Aux "unwrapFunptr_typedef1_Aux"
+    where type CFieldType Funptr_typedef1_Aux
+                          "unwrapFunptr_typedef1_Aux" = IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1
+    = Funptr_typedef1 {unwrapFunptr_typedef1 :: (FunPtr Funptr_typedef1_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef1_Aux) =>
+         HasField "unwrapFunptr_typedef1" Funptr_typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef1{unwrapFunptr_typedef1 = y_1},
+                              getField @"unwrapFunptr_typedef1" x_0)
+instance (~) ty (FunPtr Funptr_typedef1_Aux) =>
+         HasField "unwrapFunptr_typedef1" (Ptr Funptr_typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef1")
+instance HasCField Funptr_typedef1 "unwrapFunptr_typedef1"
+    where type CFieldType Funptr_typedef1
+                          "unwrapFunptr_typedef1" = FunPtr Funptr_typedef1_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef2'
+
+    __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2_Aux
+    = Funptr_typedef2_Aux {unwrapFunptr_typedef2_Aux :: (IO (Ptr CInt))}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_f174457a161ac5a0_base ::
+    IO (Ptr Void)
+ -> IO (FunPtr (IO (Ptr Void)))
+-- __unique:__ @toFunptr_typedef2_Aux@
+hs_bindgen_f174457a161ac5a0 :: Funptr_typedef2_Aux ->
+                               IO (FunPtr Funptr_typedef2_Aux)
+-- __unique:__ @toFunptr_typedef2_Aux@
+hs_bindgen_f174457a161ac5a0 = \fun_0 -> fmap castFunPtr (hs_bindgen_f174457a161ac5a0_base (fmap toFFIType (getField @"unwrapFunptr_typedef2_Aux" fun_0)))
+-- __unique:__ @fromFunptr_typedef2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_323d07dff85b802c_base ::
+    FunPtr (IO (Ptr Void))
+ -> IO (Ptr Void)
+-- __unique:__ @fromFunptr_typedef2_Aux@
+hs_bindgen_323d07dff85b802c :: FunPtr Funptr_typedef2_Aux ->
+                               Funptr_typedef2_Aux
+-- __unique:__ @fromFunptr_typedef2_Aux@
+hs_bindgen_323d07dff85b802c = \funPtr_0 -> Funptr_typedef2_Aux (fmap fromFFIType (hs_bindgen_323d07dff85b802c_base (castFunPtr funPtr_0)))
+instance ToFunPtr Funptr_typedef2_Aux
+    where toFunPtr = hs_bindgen_f174457a161ac5a0
+instance FromFunPtr Funptr_typedef2_Aux
+    where fromFunPtr = hs_bindgen_323d07dff85b802c
+instance (~) ty (IO (Ptr CInt)) =>
+         HasField "unwrapFunptr_typedef2_Aux" Funptr_typedef2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef2_Aux{unwrapFunptr_typedef2_Aux = y_1},
+                              getField @"unwrapFunptr_typedef2_Aux" x_0)
+instance (~) ty (IO (Ptr CInt)) =>
+         HasField "unwrapFunptr_typedef2_Aux"
+                  (Ptr Funptr_typedef2_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef2_Aux")
+instance HasCField Funptr_typedef2_Aux "unwrapFunptr_typedef2_Aux"
+    where type CFieldType Funptr_typedef2_Aux
+                          "unwrapFunptr_typedef2_Aux" = IO (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2
+    = Funptr_typedef2 {unwrapFunptr_typedef2 :: (FunPtr Funptr_typedef2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef2_Aux) =>
+         HasField "unwrapFunptr_typedef2" Funptr_typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef2{unwrapFunptr_typedef2 = y_1},
+                              getField @"unwrapFunptr_typedef2" x_0)
+instance (~) ty (FunPtr Funptr_typedef2_Aux) =>
+         HasField "unwrapFunptr_typedef2" (Ptr Funptr_typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef2")
+instance HasCField Funptr_typedef2 "unwrapFunptr_typedef2"
+    where type CFieldType Funptr_typedef2
+                          "unwrapFunptr_typedef2" = FunPtr Funptr_typedef2_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef3'
+
+    __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3_Aux
+    = Funptr_typedef3_Aux {unwrapFunptr_typedef3_Aux :: (IO (Ptr (Ptr CInt)))}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_031d1a7decd790d8_base ::
+    IO (Ptr Void)
+ -> IO (FunPtr (IO (Ptr Void)))
+-- __unique:__ @toFunptr_typedef3_Aux@
+hs_bindgen_031d1a7decd790d8 :: Funptr_typedef3_Aux ->
+                               IO (FunPtr Funptr_typedef3_Aux)
+-- __unique:__ @toFunptr_typedef3_Aux@
+hs_bindgen_031d1a7decd790d8 = \fun_0 -> fmap castFunPtr (hs_bindgen_031d1a7decd790d8_base (fmap toFFIType (getField @"unwrapFunptr_typedef3_Aux" fun_0)))
+-- __unique:__ @fromFunptr_typedef3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_82dc7b932974117e_base ::
+    FunPtr (IO (Ptr Void))
+ -> IO (Ptr Void)
+-- __unique:__ @fromFunptr_typedef3_Aux@
+hs_bindgen_82dc7b932974117e :: FunPtr Funptr_typedef3_Aux ->
+                               Funptr_typedef3_Aux
+-- __unique:__ @fromFunptr_typedef3_Aux@
+hs_bindgen_82dc7b932974117e = \funPtr_0 -> Funptr_typedef3_Aux (fmap fromFFIType (hs_bindgen_82dc7b932974117e_base (castFunPtr funPtr_0)))
+instance ToFunPtr Funptr_typedef3_Aux
+    where toFunPtr = hs_bindgen_031d1a7decd790d8
+instance FromFunPtr Funptr_typedef3_Aux
+    where fromFunPtr = hs_bindgen_82dc7b932974117e
+instance (~) ty (IO (Ptr (Ptr CInt))) =>
+         HasField "unwrapFunptr_typedef3_Aux" Funptr_typedef3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef3_Aux{unwrapFunptr_typedef3_Aux = y_1},
+                              getField @"unwrapFunptr_typedef3_Aux" x_0)
+instance (~) ty (IO (Ptr (Ptr CInt))) =>
+         HasField "unwrapFunptr_typedef3_Aux"
+                  (Ptr Funptr_typedef3_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef3_Aux")
+instance HasCField Funptr_typedef3_Aux "unwrapFunptr_typedef3_Aux"
+    where type CFieldType Funptr_typedef3_Aux
+                          "unwrapFunptr_typedef3_Aux" = IO (Ptr (Ptr CInt))
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3
+    = Funptr_typedef3 {unwrapFunptr_typedef3 :: (FunPtr Funptr_typedef3_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef3_Aux) =>
+         HasField "unwrapFunptr_typedef3" Funptr_typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef3{unwrapFunptr_typedef3 = y_1},
+                              getField @"unwrapFunptr_typedef3" x_0)
+instance (~) ty (FunPtr Funptr_typedef3_Aux) =>
+         HasField "unwrapFunptr_typedef3" (Ptr Funptr_typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef3")
+instance HasCField Funptr_typedef3 "unwrapFunptr_typedef3"
+    where type CFieldType Funptr_typedef3
+                          "unwrapFunptr_typedef3" = FunPtr Funptr_typedef3_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef4'
+
+    __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4_Aux
+    = Funptr_typedef4_Aux {unwrapFunptr_typedef4_Aux :: (CInt ->
+                                                         CDouble -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_da2336d254667386_base ::
+    CInt -> CDouble -> IO CInt
+ -> IO (FunPtr (CInt -> CDouble -> IO CInt))
+-- __unique:__ @toFunptr_typedef4_Aux@
+hs_bindgen_da2336d254667386 :: Funptr_typedef4_Aux ->
+                               IO (FunPtr Funptr_typedef4_Aux)
+-- __unique:__ @toFunptr_typedef4_Aux@
+hs_bindgen_da2336d254667386 = \fun_0 -> fmap castFunPtr (hs_bindgen_da2336d254667386_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapFunptr_typedef4_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromFunptr_typedef4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d4a97954476da161_base ::
+    FunPtr (CInt -> CDouble -> IO CInt)
+ -> CInt
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @fromFunptr_typedef4_Aux@
+hs_bindgen_d4a97954476da161 :: FunPtr Funptr_typedef4_Aux ->
+                               Funptr_typedef4_Aux
+-- __unique:__ @fromFunptr_typedef4_Aux@
+hs_bindgen_d4a97954476da161 = \funPtr_0 -> Funptr_typedef4_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_d4a97954476da161_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Funptr_typedef4_Aux
+    where toFunPtr = hs_bindgen_da2336d254667386
+instance FromFunPtr Funptr_typedef4_Aux
+    where fromFunPtr = hs_bindgen_d4a97954476da161
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapFunptr_typedef4_Aux" Funptr_typedef4_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef4_Aux{unwrapFunptr_typedef4_Aux = y_1},
+                              getField @"unwrapFunptr_typedef4_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapFunptr_typedef4_Aux"
+                  (Ptr Funptr_typedef4_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef4_Aux")
+instance HasCField Funptr_typedef4_Aux "unwrapFunptr_typedef4_Aux"
+    where type CFieldType Funptr_typedef4_Aux
+                          "unwrapFunptr_typedef4_Aux" = CInt -> CDouble -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4
+    = Funptr_typedef4 {unwrapFunptr_typedef4 :: (FunPtr Funptr_typedef4_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef4_Aux) =>
+         HasField "unwrapFunptr_typedef4" Funptr_typedef4 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef4{unwrapFunptr_typedef4 = y_1},
+                              getField @"unwrapFunptr_typedef4" x_0)
+instance (~) ty (FunPtr Funptr_typedef4_Aux) =>
+         HasField "unwrapFunptr_typedef4" (Ptr Funptr_typedef4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef4")
+instance HasCField Funptr_typedef4 "unwrapFunptr_typedef4"
+    where type CFieldType Funptr_typedef4
+                          "unwrapFunptr_typedef4" = FunPtr Funptr_typedef4_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef5'
+
+    __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5_Aux
+    = Funptr_typedef5_Aux {unwrapFunptr_typedef5_Aux :: (CInt ->
+                                                         CDouble -> IO (Ptr CInt))}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1f45632f07742a46_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toFunptr_typedef5_Aux@
+hs_bindgen_1f45632f07742a46 :: Funptr_typedef5_Aux ->
+                               IO (FunPtr Funptr_typedef5_Aux)
+-- __unique:__ @toFunptr_typedef5_Aux@
+hs_bindgen_1f45632f07742a46 = \fun_0 -> fmap castFunPtr (hs_bindgen_1f45632f07742a46_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapFunptr_typedef5_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromFunptr_typedef5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_0bd1877eaaba0d3e_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromFunptr_typedef5_Aux@
+hs_bindgen_0bd1877eaaba0d3e :: FunPtr Funptr_typedef5_Aux ->
+                               Funptr_typedef5_Aux
+-- __unique:__ @fromFunptr_typedef5_Aux@
+hs_bindgen_0bd1877eaaba0d3e = \funPtr_0 -> Funptr_typedef5_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_0bd1877eaaba0d3e_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Funptr_typedef5_Aux
+    where toFunPtr = hs_bindgen_1f45632f07742a46
+instance FromFunPtr Funptr_typedef5_Aux
+    where fromFunPtr = hs_bindgen_0bd1877eaaba0d3e
+instance (~) ty (CInt -> CDouble -> IO (Ptr CInt)) =>
+         HasField "unwrapFunptr_typedef5_Aux" Funptr_typedef5_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef5_Aux{unwrapFunptr_typedef5_Aux = y_1},
+                              getField @"unwrapFunptr_typedef5_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (Ptr CInt)) =>
+         HasField "unwrapFunptr_typedef5_Aux"
+                  (Ptr Funptr_typedef5_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef5_Aux")
+instance HasCField Funptr_typedef5_Aux "unwrapFunptr_typedef5_Aux"
+    where type CFieldType Funptr_typedef5_Aux
+                          "unwrapFunptr_typedef5_Aux" = CInt -> CDouble -> IO (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5
+    = Funptr_typedef5 {unwrapFunptr_typedef5 :: (FunPtr Funptr_typedef5_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef5_Aux) =>
+         HasField "unwrapFunptr_typedef5" Funptr_typedef5 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef5{unwrapFunptr_typedef5 = y_1},
+                              getField @"unwrapFunptr_typedef5" x_0)
+instance (~) ty (FunPtr Funptr_typedef5_Aux) =>
+         HasField "unwrapFunptr_typedef5" (Ptr Funptr_typedef5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef5")
+instance HasCField Funptr_typedef5 "unwrapFunptr_typedef5"
+    where type CFieldType Funptr_typedef5
+                          "unwrapFunptr_typedef5" = FunPtr Funptr_typedef5_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @comments2@
+
+    __defined at:__ @macros\/reparse.h 145:30@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Comments2
+    = Comments2 {unwrapComments2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapComments2" Comments2 ty
+    where hasField = \x_0 -> (\y_1 -> Comments2{unwrapComments2 = y_1},
+                              getField @"unwrapComments2" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapComments2" (Ptr Comments2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapComments2")
+instance HasCField Comments2 "unwrapComments2"
+    where type CFieldType Comments2 "unwrapComments2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| Struct fields
+
+    __C declaration:__ @struct example_struct@
+
+    __defined at:__ @macros\/reparse.h 151:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct
+    = Example_struct {example_struct_field1 :: CInt
+                      {- ^ __C declaration:__ @field1@
+
+                           __defined at:__ @macros\/reparse.h 152:8@
+
+                           __exported by:__ @macros\/reparse.h@
+                      -},
+                      example_struct_field2 :: (Ptr CInt)
+                      {- ^ __C declaration:__ @field2@
+
+                           __defined at:__ @macros\/reparse.h 153:8@
+
+                           __exported by:__ @macros\/reparse.h@
+                      -},
+                      example_struct_field3 :: (Ptr (Ptr CInt))
+                      {- ^ __C declaration:__ @field3@
+
+                           __defined at:__ @macros\/reparse.h 154:8@
+
+                           __exported by:__ @macros\/reparse.h@
+                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Example_struct
+    where staticSizeOf = \_ -> 24 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Example_struct
+    where readRaw = \ptr_0 -> ((pure Example_struct <*> readRaw (Proxy @"example_struct_field1") ptr_0) <*> readRaw (Proxy @"example_struct_field2") ptr_0) <*> readRaw (Proxy @"example_struct_field3") ptr_0
+instance WriteRaw Example_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Example_struct example_struct_field1_2
+                                                      example_struct_field2_3
+                                                      example_struct_field3_4 -> writeRaw (Proxy @"example_struct_field1") ptr_0 example_struct_field1_2 >> (writeRaw (Proxy @"example_struct_field2") ptr_0 example_struct_field2_3 >> writeRaw (Proxy @"example_struct_field3") ptr_0 example_struct_field3_4)
+deriving via (EquivStorable Example_struct) instance Storable Example_struct
+deriving via (IsStructViaReadRaw Example_struct) instance IsStruct Example_struct
+instance (~) ty CInt =>
+         HasField "example_struct_field1" Example_struct ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct{example_struct_field1 = y_1,
+                                                     example_struct_field2 = getField @"example_struct_field2" x_0,
+                                                     example_struct_field3 = getField @"example_struct_field3" x_0},
+                              getField @"example_struct_field1" x_0)
+instance (~) ty CInt =>
+         HasField "example_struct_field1" (Ptr Example_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_field1")
+instance HasCField Example_struct "example_struct_field1"
+    where type CFieldType Example_struct "example_struct_field1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr CInt) =>
+         HasField "example_struct_field2" Example_struct ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct{example_struct_field2 = y_1,
+                                                     example_struct_field1 = getField @"example_struct_field1" x_0,
+                                                     example_struct_field3 = getField @"example_struct_field3" x_0},
+                              getField @"example_struct_field2" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "example_struct_field2" (Ptr Example_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_field2")
+instance HasCField Example_struct "example_struct_field2"
+    where type CFieldType Example_struct
+                          "example_struct_field2" = Ptr CInt
+          offset# = \_ -> \_ -> 8
+instance (~) ty (Ptr (Ptr CInt)) =>
+         HasField "example_struct_field3" Example_struct ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct{example_struct_field3 = y_1,
+                                                     example_struct_field1 = getField @"example_struct_field1" x_0,
+                                                     example_struct_field2 = getField @"example_struct_field2" x_0},
+                              getField @"example_struct_field3" x_0)
+instance (~) ty (Ptr (Ptr CInt)) =>
+         HasField "example_struct_field3" (Ptr Example_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_field3")
+instance HasCField Example_struct "example_struct_field3"
+    where type CFieldType Example_struct
+                          "example_struct_field3" = Ptr (Ptr CInt)
+          offset# = \_ -> \_ -> 16
+{-| __C declaration:__ @const_typedef1@
+
+    __defined at:__ @macros\/reparse.h 218:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef1
+    = Const_typedef1 {unwrapConst_typedef1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapConst_typedef1" Const_typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef1{unwrapConst_typedef1 = y_1},
+                              getField @"unwrapConst_typedef1" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapConst_typedef1" (Ptr Const_typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef1")
+instance HasCField Const_typedef1 "unwrapConst_typedef1"
+    where type CFieldType Const_typedef1 "unwrapConst_typedef1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef2@
+
+    __defined at:__ @macros\/reparse.h 219:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef2
+    = Const_typedef2 {unwrapConst_typedef2 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapConst_typedef2" Const_typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef2{unwrapConst_typedef2 = y_1},
+                              getField @"unwrapConst_typedef2" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapConst_typedef2" (Ptr Const_typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef2")
+instance HasCField Const_typedef2 "unwrapConst_typedef2"
+    where type CFieldType Const_typedef2 "unwrapConst_typedef2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef3@
+
+    __defined at:__ @macros\/reparse.h 220:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef3
+    = Const_typedef3 {unwrapConst_typedef3 :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef3" Const_typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef3{unwrapConst_typedef3 = y_1},
+                              getField @"unwrapConst_typedef3" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef3" (Ptr Const_typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef3")
+instance HasCField Const_typedef3 "unwrapConst_typedef3"
+    where type CFieldType Const_typedef3
+                          "unwrapConst_typedef3" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef4@
+
+    __defined at:__ @macros\/reparse.h 221:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef4
+    = Const_typedef4 {unwrapConst_typedef4 :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef4" Const_typedef4 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef4{unwrapConst_typedef4 = y_1},
+                              getField @"unwrapConst_typedef4" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef4" (Ptr Const_typedef4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef4")
+instance HasCField Const_typedef4 "unwrapConst_typedef4"
+    where type CFieldType Const_typedef4
+                          "unwrapConst_typedef4" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef5@
+
+    __defined at:__ @macros\/reparse.h 222:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef5
+    = Const_typedef5 {unwrapConst_typedef5 :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapConst_typedef5" Const_typedef5 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef5{unwrapConst_typedef5 = y_1},
+                              getField @"unwrapConst_typedef5" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapConst_typedef5" (Ptr Const_typedef5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef5")
+instance HasCField Const_typedef5 "unwrapConst_typedef5"
+    where type CFieldType Const_typedef5
+                          "unwrapConst_typedef5" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef6@
+
+    __defined at:__ @macros\/reparse.h 223:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef6
+    = Const_typedef6 {unwrapConst_typedef6 :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef6" Const_typedef6 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef6{unwrapConst_typedef6 = y_1},
+                              getField @"unwrapConst_typedef6" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef6" (Ptr Const_typedef6) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef6")
+instance HasCField Const_typedef6 "unwrapConst_typedef6"
+    where type CFieldType Const_typedef6
+                          "unwrapConst_typedef6" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef7@
+
+    __defined at:__ @macros\/reparse.h 224:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef7
+    = Const_typedef7 {unwrapConst_typedef7 :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef7" Const_typedef7 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef7{unwrapConst_typedef7 = y_1},
+                              getField @"unwrapConst_typedef7" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapConst_typedef7" (Ptr Const_typedef7) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef7")
+instance HasCField Const_typedef7 "unwrapConst_typedef7"
+    where type CFieldType Const_typedef7
+                          "unwrapConst_typedef7" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct example_struct_with_const@
+
+    __defined at:__ @macros\/reparse.h 226:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct_with_const
+    = Example_struct_with_const {example_struct_with_const_const_field1 :: CInt
+                                 {- ^ __C declaration:__ @const_field1@
+
+                                      __defined at:__ @macros\/reparse.h 227:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field2 :: CInt
+                                 {- ^ __C declaration:__ @const_field2@
+
+                                      __defined at:__ @macros\/reparse.h 228:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field3 :: (PtrConst CInt)
+                                 {- ^ __C declaration:__ @const_field3@
+
+                                      __defined at:__ @macros\/reparse.h 229:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field4 :: (PtrConst CInt)
+                                 {- ^ __C declaration:__ @const_field4@
+
+                                      __defined at:__ @macros\/reparse.h 230:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field5 :: (Ptr CInt)
+                                 {- ^ __C declaration:__ @const_field5@
+
+                                      __defined at:__ @macros\/reparse.h 231:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field6 :: (PtrConst CInt)
+                                 {- ^ __C declaration:__ @const_field6@
+
+                                      __defined at:__ @macros\/reparse.h 232:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field7 :: (PtrConst CInt)
+                                 {- ^ __C declaration:__ @const_field7@
+
+                                      __defined at:__ @macros\/reparse.h 233:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Example_struct_with_const
+    where staticSizeOf = \_ -> 48 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Example_struct_with_const
+    where readRaw = \ptr_0 -> ((((((pure Example_struct_with_const <*> readRaw (Proxy @"example_struct_with_const_const_field1") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field2") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field3") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field4") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field5") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field6") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field7") ptr_0
+instance WriteRaw Example_struct_with_const
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Example_struct_with_const example_struct_with_const_const_field1_2
+                                                                 example_struct_with_const_const_field2_3
+                                                                 example_struct_with_const_const_field3_4
+                                                                 example_struct_with_const_const_field4_5
+                                                                 example_struct_with_const_const_field5_6
+                                                                 example_struct_with_const_const_field6_7
+                                                                 example_struct_with_const_const_field7_8 -> writeRaw (Proxy @"example_struct_with_const_const_field1") ptr_0 example_struct_with_const_const_field1_2 >> (writeRaw (Proxy @"example_struct_with_const_const_field2") ptr_0 example_struct_with_const_const_field2_3 >> (writeRaw (Proxy @"example_struct_with_const_const_field3") ptr_0 example_struct_with_const_const_field3_4 >> (writeRaw (Proxy @"example_struct_with_const_const_field4") ptr_0 example_struct_with_const_const_field4_5 >> (writeRaw (Proxy @"example_struct_with_const_const_field5") ptr_0 example_struct_with_const_const_field5_6 >> (writeRaw (Proxy @"example_struct_with_const_const_field6") ptr_0 example_struct_with_const_const_field6_7 >> writeRaw (Proxy @"example_struct_with_const_const_field7") ptr_0 example_struct_with_const_const_field7_8)))))
+deriving via (EquivStorable Example_struct_with_const) instance Storable Example_struct_with_const
+deriving via (IsStructViaReadRaw Example_struct_with_const) instance IsStruct Example_struct_with_const
+instance (~) ty CInt =>
+         HasField "example_struct_with_const_const_field1"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field1 = y_1,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field1" x_0)
+instance (~) ty CInt =>
+         HasField "example_struct_with_const_const_field1"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field1")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field1"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "example_struct_with_const_const_field2"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field2 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field2" x_0)
+instance (~) ty CInt =>
+         HasField "example_struct_with_const_const_field2"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field2")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field2"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field2" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field3"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field3 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field3" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field3"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field3")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field3"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field3" = PtrConst CInt
+          offset# = \_ -> \_ -> 8
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field4"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field4 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field4" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field4"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field4")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field4"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field4" = PtrConst CInt
+          offset# = \_ -> \_ -> 16
+instance (~) ty (Ptr CInt) =>
+         HasField "example_struct_with_const_const_field5"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field5 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field5" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "example_struct_with_const_const_field5"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field5")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field5"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field5" = Ptr CInt
+          offset# = \_ -> \_ -> 24
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field6"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field6 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field6" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field6"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field6")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field6"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field6" = PtrConst CInt
+          offset# = \_ -> \_ -> 32
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field7"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field7 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0},
+                              getField @"example_struct_with_const_const_field7" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "example_struct_with_const_const_field7"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field7")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field7"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field7" = PtrConst CInt
+          offset# = \_ -> \_ -> 40
+{-| Auxiliary type used by 'Const_funptr1'
+
+    __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1_Aux
+    = Const_funptr1_Aux {unwrapConst_funptr1_Aux :: (CInt ->
+                                                     CDouble -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7f125e20a9d4075b_base ::
+    CInt -> CDouble -> IO CInt
+ -> IO (FunPtr (CInt -> CDouble -> IO CInt))
+-- __unique:__ @toConst_funptr1_Aux@
+hs_bindgen_7f125e20a9d4075b :: Const_funptr1_Aux ->
+                               IO (FunPtr Const_funptr1_Aux)
+-- __unique:__ @toConst_funptr1_Aux@
+hs_bindgen_7f125e20a9d4075b = \fun_0 -> fmap castFunPtr (hs_bindgen_7f125e20a9d4075b_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr1_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ac4bd8d789bba94b_base ::
+    FunPtr (CInt -> CDouble -> IO CInt)
+ -> CInt
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @fromConst_funptr1_Aux@
+hs_bindgen_ac4bd8d789bba94b :: FunPtr Const_funptr1_Aux ->
+                               Const_funptr1_Aux
+-- __unique:__ @fromConst_funptr1_Aux@
+hs_bindgen_ac4bd8d789bba94b = \funPtr_0 -> Const_funptr1_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_ac4bd8d789bba94b_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr1_Aux
+    where toFunPtr = hs_bindgen_7f125e20a9d4075b
+instance FromFunPtr Const_funptr1_Aux
+    where fromFunPtr = hs_bindgen_ac4bd8d789bba94b
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapConst_funptr1_Aux" Const_funptr1_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr1_Aux{unwrapConst_funptr1_Aux = y_1},
+                              getField @"unwrapConst_funptr1_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapConst_funptr1_Aux" (Ptr Const_funptr1_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr1_Aux")
+instance HasCField Const_funptr1_Aux "unwrapConst_funptr1_Aux"
+    where type CFieldType Const_funptr1_Aux
+                          "unwrapConst_funptr1_Aux" = CInt -> CDouble -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1
+    = Const_funptr1 {unwrapConst_funptr1 :: (FunPtr Const_funptr1_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr1_Aux) =>
+         HasField "unwrapConst_funptr1" Const_funptr1 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr1{unwrapConst_funptr1 = y_1},
+                              getField @"unwrapConst_funptr1" x_0)
+instance (~) ty (FunPtr Const_funptr1_Aux) =>
+         HasField "unwrapConst_funptr1" (Ptr Const_funptr1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr1")
+instance HasCField Const_funptr1 "unwrapConst_funptr1"
+    where type CFieldType Const_funptr1
+                          "unwrapConst_funptr1" = FunPtr Const_funptr1_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr2'
+
+    __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2_Aux
+    = Const_funptr2_Aux {unwrapConst_funptr2_Aux :: (CInt ->
+                                                     CDouble -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c7b1e36d845634fb_base ::
+    CInt -> CDouble -> IO CInt
+ -> IO (FunPtr (CInt -> CDouble -> IO CInt))
+-- __unique:__ @toConst_funptr2_Aux@
+hs_bindgen_c7b1e36d845634fb :: Const_funptr2_Aux ->
+                               IO (FunPtr Const_funptr2_Aux)
+-- __unique:__ @toConst_funptr2_Aux@
+hs_bindgen_c7b1e36d845634fb = \fun_0 -> fmap castFunPtr (hs_bindgen_c7b1e36d845634fb_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr2_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_352cebf463125ca9_base ::
+    FunPtr (CInt -> CDouble -> IO CInt)
+ -> CInt
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @fromConst_funptr2_Aux@
+hs_bindgen_352cebf463125ca9 :: FunPtr Const_funptr2_Aux ->
+                               Const_funptr2_Aux
+-- __unique:__ @fromConst_funptr2_Aux@
+hs_bindgen_352cebf463125ca9 = \funPtr_0 -> Const_funptr2_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_352cebf463125ca9_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr2_Aux
+    where toFunPtr = hs_bindgen_c7b1e36d845634fb
+instance FromFunPtr Const_funptr2_Aux
+    where fromFunPtr = hs_bindgen_352cebf463125ca9
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapConst_funptr2_Aux" Const_funptr2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr2_Aux{unwrapConst_funptr2_Aux = y_1},
+                              getField @"unwrapConst_funptr2_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO CInt) =>
+         HasField "unwrapConst_funptr2_Aux" (Ptr Const_funptr2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr2_Aux")
+instance HasCField Const_funptr2_Aux "unwrapConst_funptr2_Aux"
+    where type CFieldType Const_funptr2_Aux
+                          "unwrapConst_funptr2_Aux" = CInt -> CDouble -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2
+    = Const_funptr2 {unwrapConst_funptr2 :: (FunPtr Const_funptr2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr2_Aux) =>
+         HasField "unwrapConst_funptr2" Const_funptr2 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr2{unwrapConst_funptr2 = y_1},
+                              getField @"unwrapConst_funptr2" x_0)
+instance (~) ty (FunPtr Const_funptr2_Aux) =>
+         HasField "unwrapConst_funptr2" (Ptr Const_funptr2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr2")
+instance HasCField Const_funptr2 "unwrapConst_funptr2"
+    where type CFieldType Const_funptr2
+                          "unwrapConst_funptr2" = FunPtr Const_funptr2_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr3'
+
+    __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3_Aux
+    = Const_funptr3_Aux {unwrapConst_funptr3_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2dcbfe1c2502178c_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr3_Aux@
+hs_bindgen_2dcbfe1c2502178c :: Const_funptr3_Aux ->
+                               IO (FunPtr Const_funptr3_Aux)
+-- __unique:__ @toConst_funptr3_Aux@
+hs_bindgen_2dcbfe1c2502178c = \fun_0 -> fmap castFunPtr (hs_bindgen_2dcbfe1c2502178c_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr3_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_86738dcfd7c9d33c_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr3_Aux@
+hs_bindgen_86738dcfd7c9d33c :: FunPtr Const_funptr3_Aux ->
+                               Const_funptr3_Aux
+-- __unique:__ @fromConst_funptr3_Aux@
+hs_bindgen_86738dcfd7c9d33c = \funPtr_0 -> Const_funptr3_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_86738dcfd7c9d33c_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr3_Aux
+    where toFunPtr = hs_bindgen_2dcbfe1c2502178c
+instance FromFunPtr Const_funptr3_Aux
+    where fromFunPtr = hs_bindgen_86738dcfd7c9d33c
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr3_Aux" Const_funptr3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr3_Aux{unwrapConst_funptr3_Aux = y_1},
+                              getField @"unwrapConst_funptr3_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr3_Aux" (Ptr Const_funptr3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr3_Aux")
+instance HasCField Const_funptr3_Aux "unwrapConst_funptr3_Aux"
+    where type CFieldType Const_funptr3_Aux
+                          "unwrapConst_funptr3_Aux" = CInt -> CDouble -> IO (PtrConst CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3
+    = Const_funptr3 {unwrapConst_funptr3 :: (FunPtr Const_funptr3_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr3_Aux) =>
+         HasField "unwrapConst_funptr3" Const_funptr3 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr3{unwrapConst_funptr3 = y_1},
+                              getField @"unwrapConst_funptr3" x_0)
+instance (~) ty (FunPtr Const_funptr3_Aux) =>
+         HasField "unwrapConst_funptr3" (Ptr Const_funptr3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr3")
+instance HasCField Const_funptr3 "unwrapConst_funptr3"
+    where type CFieldType Const_funptr3
+                          "unwrapConst_funptr3" = FunPtr Const_funptr3_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr4'
+
+    __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4_Aux
+    = Const_funptr4_Aux {unwrapConst_funptr4_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5461deeda491de0b_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr4_Aux@
+hs_bindgen_5461deeda491de0b :: Const_funptr4_Aux ->
+                               IO (FunPtr Const_funptr4_Aux)
+-- __unique:__ @toConst_funptr4_Aux@
+hs_bindgen_5461deeda491de0b = \fun_0 -> fmap castFunPtr (hs_bindgen_5461deeda491de0b_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr4_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_de7846fca3bfd1b6_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr4_Aux@
+hs_bindgen_de7846fca3bfd1b6 :: FunPtr Const_funptr4_Aux ->
+                               Const_funptr4_Aux
+-- __unique:__ @fromConst_funptr4_Aux@
+hs_bindgen_de7846fca3bfd1b6 = \funPtr_0 -> Const_funptr4_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_de7846fca3bfd1b6_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr4_Aux
+    where toFunPtr = hs_bindgen_5461deeda491de0b
+instance FromFunPtr Const_funptr4_Aux
+    where fromFunPtr = hs_bindgen_de7846fca3bfd1b6
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr4_Aux" Const_funptr4_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr4_Aux{unwrapConst_funptr4_Aux = y_1},
+                              getField @"unwrapConst_funptr4_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr4_Aux" (Ptr Const_funptr4_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr4_Aux")
+instance HasCField Const_funptr4_Aux "unwrapConst_funptr4_Aux"
+    where type CFieldType Const_funptr4_Aux
+                          "unwrapConst_funptr4_Aux" = CInt -> CDouble -> IO (PtrConst CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4
+    = Const_funptr4 {unwrapConst_funptr4 :: (FunPtr Const_funptr4_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr4_Aux) =>
+         HasField "unwrapConst_funptr4" Const_funptr4 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr4{unwrapConst_funptr4 = y_1},
+                              getField @"unwrapConst_funptr4" x_0)
+instance (~) ty (FunPtr Const_funptr4_Aux) =>
+         HasField "unwrapConst_funptr4" (Ptr Const_funptr4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr4")
+instance HasCField Const_funptr4 "unwrapConst_funptr4"
+    where type CFieldType Const_funptr4
+                          "unwrapConst_funptr4" = FunPtr Const_funptr4_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr5'
+
+    __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5_Aux
+    = Const_funptr5_Aux {unwrapConst_funptr5_Aux :: (CInt ->
+                                                     CDouble -> IO (Ptr CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7b0174fc978a1ce1_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr5_Aux@
+hs_bindgen_7b0174fc978a1ce1 :: Const_funptr5_Aux ->
+                               IO (FunPtr Const_funptr5_Aux)
+-- __unique:__ @toConst_funptr5_Aux@
+hs_bindgen_7b0174fc978a1ce1 = \fun_0 -> fmap castFunPtr (hs_bindgen_7b0174fc978a1ce1_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr5_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_38a21d84bb7115b5_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr5_Aux@
+hs_bindgen_38a21d84bb7115b5 :: FunPtr Const_funptr5_Aux ->
+                               Const_funptr5_Aux
+-- __unique:__ @fromConst_funptr5_Aux@
+hs_bindgen_38a21d84bb7115b5 = \funPtr_0 -> Const_funptr5_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_38a21d84bb7115b5_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr5_Aux
+    where toFunPtr = hs_bindgen_7b0174fc978a1ce1
+instance FromFunPtr Const_funptr5_Aux
+    where fromFunPtr = hs_bindgen_38a21d84bb7115b5
+instance (~) ty (CInt -> CDouble -> IO (Ptr CInt)) =>
+         HasField "unwrapConst_funptr5_Aux" Const_funptr5_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr5_Aux{unwrapConst_funptr5_Aux = y_1},
+                              getField @"unwrapConst_funptr5_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (Ptr CInt)) =>
+         HasField "unwrapConst_funptr5_Aux" (Ptr Const_funptr5_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr5_Aux")
+instance HasCField Const_funptr5_Aux "unwrapConst_funptr5_Aux"
+    where type CFieldType Const_funptr5_Aux
+                          "unwrapConst_funptr5_Aux" = CInt -> CDouble -> IO (Ptr CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5
+    = Const_funptr5 {unwrapConst_funptr5 :: (FunPtr Const_funptr5_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr5_Aux) =>
+         HasField "unwrapConst_funptr5" Const_funptr5 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr5{unwrapConst_funptr5 = y_1},
+                              getField @"unwrapConst_funptr5" x_0)
+instance (~) ty (FunPtr Const_funptr5_Aux) =>
+         HasField "unwrapConst_funptr5" (Ptr Const_funptr5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr5")
+instance HasCField Const_funptr5 "unwrapConst_funptr5"
+    where type CFieldType Const_funptr5
+                          "unwrapConst_funptr5" = FunPtr Const_funptr5_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr6'
+
+    __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6_Aux
+    = Const_funptr6_Aux {unwrapConst_funptr6_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr6_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_4e32721222f4df9f_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr6_Aux@
+hs_bindgen_4e32721222f4df9f :: Const_funptr6_Aux ->
+                               IO (FunPtr Const_funptr6_Aux)
+-- __unique:__ @toConst_funptr6_Aux@
+hs_bindgen_4e32721222f4df9f = \fun_0 -> fmap castFunPtr (hs_bindgen_4e32721222f4df9f_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr6_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr6_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_45251216b04aa8b5_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr6_Aux@
+hs_bindgen_45251216b04aa8b5 :: FunPtr Const_funptr6_Aux ->
+                               Const_funptr6_Aux
+-- __unique:__ @fromConst_funptr6_Aux@
+hs_bindgen_45251216b04aa8b5 = \funPtr_0 -> Const_funptr6_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_45251216b04aa8b5_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr6_Aux
+    where toFunPtr = hs_bindgen_4e32721222f4df9f
+instance FromFunPtr Const_funptr6_Aux
+    where fromFunPtr = hs_bindgen_45251216b04aa8b5
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr6_Aux" Const_funptr6_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr6_Aux{unwrapConst_funptr6_Aux = y_1},
+                              getField @"unwrapConst_funptr6_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr6_Aux" (Ptr Const_funptr6_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr6_Aux")
+instance HasCField Const_funptr6_Aux "unwrapConst_funptr6_Aux"
+    where type CFieldType Const_funptr6_Aux
+                          "unwrapConst_funptr6_Aux" = CInt -> CDouble -> IO (PtrConst CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6
+    = Const_funptr6 {unwrapConst_funptr6 :: (FunPtr Const_funptr6_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr6_Aux) =>
+         HasField "unwrapConst_funptr6" Const_funptr6 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr6{unwrapConst_funptr6 = y_1},
+                              getField @"unwrapConst_funptr6" x_0)
+instance (~) ty (FunPtr Const_funptr6_Aux) =>
+         HasField "unwrapConst_funptr6" (Ptr Const_funptr6) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr6")
+instance HasCField Const_funptr6 "unwrapConst_funptr6"
+    where type CFieldType Const_funptr6
+                          "unwrapConst_funptr6" = FunPtr Const_funptr6_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr7'
+
+    __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7_Aux
+    = Const_funptr7_Aux {unwrapConst_funptr7_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst CInt))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr7_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_0d04fc96ffb9de06_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr7_Aux@
+hs_bindgen_0d04fc96ffb9de06 :: Const_funptr7_Aux ->
+                               IO (FunPtr Const_funptr7_Aux)
+-- __unique:__ @toConst_funptr7_Aux@
+hs_bindgen_0d04fc96ffb9de06 = \fun_0 -> fmap castFunPtr (hs_bindgen_0d04fc96ffb9de06_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr7_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr7_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_42fbcebf75a973ba_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr7_Aux@
+hs_bindgen_42fbcebf75a973ba :: FunPtr Const_funptr7_Aux ->
+                               Const_funptr7_Aux
+-- __unique:__ @fromConst_funptr7_Aux@
+hs_bindgen_42fbcebf75a973ba = \funPtr_0 -> Const_funptr7_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_42fbcebf75a973ba_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr7_Aux
+    where toFunPtr = hs_bindgen_0d04fc96ffb9de06
+instance FromFunPtr Const_funptr7_Aux
+    where fromFunPtr = hs_bindgen_42fbcebf75a973ba
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr7_Aux" Const_funptr7_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr7_Aux{unwrapConst_funptr7_Aux = y_1},
+                              getField @"unwrapConst_funptr7_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst CInt)) =>
+         HasField "unwrapConst_funptr7_Aux" (Ptr Const_funptr7_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr7_Aux")
+instance HasCField Const_funptr7_Aux "unwrapConst_funptr7_Aux"
+    where type CFieldType Const_funptr7_Aux
+                          "unwrapConst_funptr7_Aux" = CInt -> CDouble -> IO (PtrConst CInt)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7
+    = Const_funptr7 {unwrapConst_funptr7 :: (FunPtr Const_funptr7_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr7_Aux) =>
+         HasField "unwrapConst_funptr7" Const_funptr7 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr7{unwrapConst_funptr7 = y_1},
+                              getField @"unwrapConst_funptr7" x_0)
+instance (~) ty (FunPtr Const_funptr7_Aux) =>
+         HasField "unwrapConst_funptr7" (Ptr Const_funptr7) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr7")
+instance HasCField Const_funptr7 "unwrapConst_funptr7"
+    where type CFieldType Const_funptr7
+                          "unwrapConst_funptr7" = FunPtr Const_funptr7_Aux
+          offset# = \_ -> \_ -> 0
+{-| Macro-defined types
+
+    __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse.h 278:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bOOL :: Raw String
+{-| Macro-defined types
+
+    __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse.h 278:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bOOL = objectLike "BOOL" ["_Bool"]
+{-| __C declaration:__ @macro INT@
+
+    __defined at:__ @macros\/reparse.h 279:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+iNT :: Raw String
+{-| __C declaration:__ @macro INT@
+
+    __defined at:__ @macros\/reparse.h 279:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+iNT = objectLike "INT" ["int"]
+{-| __C declaration:__ @macro INTP@
+
+    __defined at:__ @macros\/reparse.h 280:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+iNTP :: Raw String
+{-| __C declaration:__ @macro INTP@
+
+    __defined at:__ @macros\/reparse.h 280:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+iNTP = objectLike "INTP" ["int", "*"]
+{-| __C declaration:__ @macro INTCP@
+
+    __defined at:__ @macros\/reparse.h 281:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+iNTCP :: Raw String
+{-| __C declaration:__ @macro INTCP@
+
+    __defined at:__ @macros\/reparse.h 281:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+iNTCP = objectLike "INTCP" ["const", "int", "*", "const"]
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char1@
+foreign import ccall safe "hs_bindgen_14b56322053baa3f" hs_bindgen_14b56322053baa3f_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char1@
+hs_bindgen_14b56322053baa3f :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char1@
+hs_bindgen_14b56322053baa3f = \x_0 -> \x_1 -> hs_bindgen_14b56322053baa3f_base (toFFIType x_0) (toFFIType x_1)
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_safe :: CInt -> CChar -> IO ()
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_safe = hs_bindgen_14b56322053baa3f
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char2@
+foreign import ccall safe "hs_bindgen_05193644052d4324" hs_bindgen_05193644052d4324_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char2@
+hs_bindgen_05193644052d4324 :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char2@
+hs_bindgen_05193644052d4324 = \x_0 -> \x_1 -> hs_bindgen_05193644052d4324_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_safe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_safe = hs_bindgen_05193644052d4324
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char3@
+foreign import ccall safe "hs_bindgen_5b68ff22474d4775" hs_bindgen_5b68ff22474d4775_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char3@
+hs_bindgen_5b68ff22474d4775 :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_char3@
+hs_bindgen_5b68ff22474d4775 = \x_0 -> \x_1 -> hs_bindgen_5b68ff22474d4775_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_safe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_safe = hs_bindgen_5b68ff22474d4775
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short1@
+foreign import ccall safe "hs_bindgen_5a7d0b078ac418a1" hs_bindgen_5a7d0b078ac418a1_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short1@
+hs_bindgen_5a7d0b078ac418a1 :: CInt -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short1@
+hs_bindgen_5a7d0b078ac418a1 = \x_0 -> \x_1 -> hs_bindgen_5a7d0b078ac418a1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_safe :: CInt -> CShort -> IO ()
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_safe = hs_bindgen_5a7d0b078ac418a1
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short2@
+foreign import ccall safe "hs_bindgen_6d391e69fc74dd4b" hs_bindgen_6d391e69fc74dd4b_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short2@
+hs_bindgen_6d391e69fc74dd4b :: CInt -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short2@
+hs_bindgen_6d391e69fc74dd4b = \x_0 -> \x_1 -> hs_bindgen_6d391e69fc74dd4b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_safe :: CInt -> CShort -> IO ()
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_safe = hs_bindgen_6d391e69fc74dd4b
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short3@
+foreign import ccall safe "hs_bindgen_d3d74caa6f6d43ab" hs_bindgen_d3d74caa6f6d43ab_base ::
+    CInt
+ -> CUShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short3@
+hs_bindgen_d3d74caa6f6d43ab :: CInt -> CUShort -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_short3@
+hs_bindgen_d3d74caa6f6d43ab = \x_0 -> \x_1 -> hs_bindgen_d3d74caa6f6d43ab_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_safe :: CInt -> CUShort -> IO ()
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_safe = hs_bindgen_d3d74caa6f6d43ab
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int1@
+foreign import ccall safe "hs_bindgen_d005292650dc9976" hs_bindgen_d005292650dc9976_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int1@
+hs_bindgen_d005292650dc9976 :: CInt -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int1@
+hs_bindgen_d005292650dc9976 = \x_0 -> \x_1 -> hs_bindgen_d005292650dc9976_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_safe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_safe = hs_bindgen_d005292650dc9976
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int2@
+foreign import ccall safe "hs_bindgen_2dde5b36f080e07d" hs_bindgen_2dde5b36f080e07d_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int2@
+hs_bindgen_2dde5b36f080e07d :: CInt -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int2@
+hs_bindgen_2dde5b36f080e07d = \x_0 -> \x_1 -> hs_bindgen_2dde5b36f080e07d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_safe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_safe = hs_bindgen_2dde5b36f080e07d
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int3@
+foreign import ccall safe "hs_bindgen_e7207b4f601fa789" hs_bindgen_e7207b4f601fa789_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int3@
+hs_bindgen_e7207b4f601fa789 :: CInt -> CUInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_int3@
+hs_bindgen_e7207b4f601fa789 = \x_0 -> \x_1 -> hs_bindgen_e7207b4f601fa789_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_safe :: CInt -> CUInt -> IO ()
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_safe = hs_bindgen_e7207b4f601fa789
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long1@
+foreign import ccall safe "hs_bindgen_bc717d375990f9e5" hs_bindgen_bc717d375990f9e5_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long1@
+hs_bindgen_bc717d375990f9e5 :: CInt -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long1@
+hs_bindgen_bc717d375990f9e5 = \x_0 -> \x_1 -> hs_bindgen_bc717d375990f9e5_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_safe :: CInt -> CLong -> IO ()
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_safe = hs_bindgen_bc717d375990f9e5
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long2@
+foreign import ccall safe "hs_bindgen_db1215183538b75a" hs_bindgen_db1215183538b75a_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long2@
+hs_bindgen_db1215183538b75a :: CInt -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long2@
+hs_bindgen_db1215183538b75a = \x_0 -> \x_1 -> hs_bindgen_db1215183538b75a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_safe :: CInt -> CLong -> IO ()
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_safe = hs_bindgen_db1215183538b75a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long3@
+foreign import ccall safe "hs_bindgen_3ac74c7cbfc79685" hs_bindgen_3ac74c7cbfc79685_base ::
+    CInt
+ -> CULong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long3@
+hs_bindgen_3ac74c7cbfc79685 :: CInt -> CULong -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_long3@
+hs_bindgen_3ac74c7cbfc79685 = \x_0 -> \x_1 -> hs_bindgen_3ac74c7cbfc79685_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_safe :: CInt -> CULong -> IO ()
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_safe = hs_bindgen_3ac74c7cbfc79685
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_float@
+foreign import ccall safe "hs_bindgen_a2388e64c2a84027" hs_bindgen_a2388e64c2a84027_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_float@
+hs_bindgen_a2388e64c2a84027 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_float@
+hs_bindgen_a2388e64c2a84027 = \x_0 -> \x_1 -> hs_bindgen_a2388e64c2a84027_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_safe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_safe = hs_bindgen_a2388e64c2a84027
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_double@
+foreign import ccall safe "hs_bindgen_e5ad67302deb9698" hs_bindgen_e5ad67302deb9698_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_double@
+hs_bindgen_e5ad67302deb9698 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_double@
+hs_bindgen_e5ad67302deb9698 = \x_0 -> \x_1 -> hs_bindgen_e5ad67302deb9698_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_safe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_safe = hs_bindgen_e5ad67302deb9698
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_bool1@
+foreign import ccall safe "hs_bindgen_bad730ef968d4941" hs_bindgen_bad730ef968d4941_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_bool1@
+hs_bindgen_bad730ef968d4941 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_bool1@
+hs_bindgen_bad730ef968d4941 = \x_0 -> \x_1 -> hs_bindgen_bad730ef968d4941_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_safe = hs_bindgen_bad730ef968d4941
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_struct@
+foreign import ccall safe "hs_bindgen_24f835bba72f92a3" hs_bindgen_24f835bba72f92a3_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_struct@
+hs_bindgen_24f835bba72f92a3 :: CInt -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_struct@
+hs_bindgen_24f835bba72f92a3 = \x_0 -> \x_1 -> hs_bindgen_24f835bba72f92a3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_safe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_24f835bba72f92a3 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_union@
+foreign import ccall safe "hs_bindgen_d06661c0e9399cf0" hs_bindgen_d06661c0e9399cf0_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_union@
+hs_bindgen_d06661c0e9399cf0 :: CInt -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_union@
+hs_bindgen_d06661c0e9399cf0 = \x_0 -> \x_1 -> hs_bindgen_d06661c0e9399cf0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_safe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_d06661c0e9399cf0 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_enum@
+foreign import ccall safe "hs_bindgen_d37243b7a8d9d58d" hs_bindgen_d37243b7a8d9d58d_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_enum@
+hs_bindgen_d37243b7a8d9d58d :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_enum@
+hs_bindgen_d37243b7a8d9d58d = \x_0 -> \x_1 -> hs_bindgen_d37243b7a8d9d58d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_safe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_safe = hs_bindgen_d37243b7a8d9d58d
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer1@
+foreign import ccall safe "hs_bindgen_b3bd6759641d67eb" hs_bindgen_b3bd6759641d67eb_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer1@
+hs_bindgen_b3bd6759641d67eb :: CInt -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer1@
+hs_bindgen_b3bd6759641d67eb = \x_0 -> \x_1 -> hs_bindgen_b3bd6759641d67eb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_safe :: CInt -> Ptr CInt -> IO ()
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_safe = hs_bindgen_b3bd6759641d67eb
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer2@
+foreign import ccall safe "hs_bindgen_97b00bc8a470fc69" hs_bindgen_97b00bc8a470fc69_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer2@
+hs_bindgen_97b00bc8a470fc69 :: CInt -> Ptr (Ptr CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer2@
+hs_bindgen_97b00bc8a470fc69 = \x_0 -> \x_1 -> hs_bindgen_97b00bc8a470fc69_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_safe :: CInt -> Ptr (Ptr CInt) -> IO ()
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_safe = hs_bindgen_97b00bc8a470fc69
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer3@
+foreign import ccall safe "hs_bindgen_07e7d187d95f6ca2" hs_bindgen_07e7d187d95f6ca2_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer3@
+hs_bindgen_07e7d187d95f6ca2 :: CInt -> Ptr Void -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_pointer3@
+hs_bindgen_07e7d187d95f6ca2 = \x_0 -> \x_1 -> hs_bindgen_07e7d187d95f6ca2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_safe :: CInt -> Ptr Void -> IO ()
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_safe = hs_bindgen_07e7d187d95f6ca2
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_A@
+foreign import ccall safe "hs_bindgen_144178893e488066" hs_bindgen_144178893e488066_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_A@
+hs_bindgen_144178893e488066 :: IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_A@
+hs_bindgen_144178893e488066 = fmap fromFFIType hs_bindgen_144178893e488066_base
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_safe :: IO CInt
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_safe = hs_bindgen_144178893e488066
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char1@
+foreign import ccall safe "hs_bindgen_d7d2bc68373545e4" hs_bindgen_d7d2bc68373545e4_base ::
+    CInt
+ -> IO CChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char1@
+hs_bindgen_d7d2bc68373545e4 :: CInt -> IO CChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char1@
+hs_bindgen_d7d2bc68373545e4 = \x_0 -> fmap fromFFIType (hs_bindgen_d7d2bc68373545e4_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_safe :: CInt -> IO CChar
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_safe = hs_bindgen_d7d2bc68373545e4
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char2@
+foreign import ccall safe "hs_bindgen_aa47ca542df45b7b" hs_bindgen_aa47ca542df45b7b_base ::
+    CInt
+ -> IO CSChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char2@
+hs_bindgen_aa47ca542df45b7b :: CInt -> IO CSChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char2@
+hs_bindgen_aa47ca542df45b7b = \x_0 -> fmap fromFFIType (hs_bindgen_aa47ca542df45b7b_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_safe :: CInt -> IO CSChar
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_safe = hs_bindgen_aa47ca542df45b7b
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char3@
+foreign import ccall safe "hs_bindgen_bcc15cd6faf7b787" hs_bindgen_bcc15cd6faf7b787_base ::
+    CInt
+ -> IO CUChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char3@
+hs_bindgen_bcc15cd6faf7b787 :: CInt -> IO CUChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_char3@
+hs_bindgen_bcc15cd6faf7b787 = \x_0 -> fmap fromFFIType (hs_bindgen_bcc15cd6faf7b787_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_safe :: CInt -> IO CUChar
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_safe = hs_bindgen_bcc15cd6faf7b787
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short1@
+foreign import ccall safe "hs_bindgen_4ba7217a94e5e369" hs_bindgen_4ba7217a94e5e369_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short1@
+hs_bindgen_4ba7217a94e5e369 :: CInt -> IO CShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short1@
+hs_bindgen_4ba7217a94e5e369 = \x_0 -> fmap fromFFIType (hs_bindgen_4ba7217a94e5e369_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_safe :: CInt -> IO CShort
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_safe = hs_bindgen_4ba7217a94e5e369
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short2@
+foreign import ccall safe "hs_bindgen_ea4e41167ce3686a" hs_bindgen_ea4e41167ce3686a_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short2@
+hs_bindgen_ea4e41167ce3686a :: CInt -> IO CShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short2@
+hs_bindgen_ea4e41167ce3686a = \x_0 -> fmap fromFFIType (hs_bindgen_ea4e41167ce3686a_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_safe :: CInt -> IO CShort
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_safe = hs_bindgen_ea4e41167ce3686a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short3@
+foreign import ccall safe "hs_bindgen_b1021a4826d326a1" hs_bindgen_b1021a4826d326a1_base ::
+    CInt
+ -> IO CUShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short3@
+hs_bindgen_b1021a4826d326a1 :: CInt -> IO CUShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_short3@
+hs_bindgen_b1021a4826d326a1 = \x_0 -> fmap fromFFIType (hs_bindgen_b1021a4826d326a1_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_safe :: CInt -> IO CUShort
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_safe = hs_bindgen_b1021a4826d326a1
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int1@
+foreign import ccall safe "hs_bindgen_c23956482c29e1c5" hs_bindgen_c23956482c29e1c5_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int1@
+hs_bindgen_c23956482c29e1c5 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int1@
+hs_bindgen_c23956482c29e1c5 = \x_0 -> fmap fromFFIType (hs_bindgen_c23956482c29e1c5_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_safe :: CInt -> IO CInt
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_safe = hs_bindgen_c23956482c29e1c5
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int2@
+foreign import ccall safe "hs_bindgen_76475f626bf1d429" hs_bindgen_76475f626bf1d429_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int2@
+hs_bindgen_76475f626bf1d429 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int2@
+hs_bindgen_76475f626bf1d429 = \x_0 -> fmap fromFFIType (hs_bindgen_76475f626bf1d429_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_safe :: CInt -> IO CInt
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_safe = hs_bindgen_76475f626bf1d429
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int3@
+foreign import ccall safe "hs_bindgen_e86e93b147924e4a" hs_bindgen_e86e93b147924e4a_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int3@
+hs_bindgen_e86e93b147924e4a :: CInt -> IO CUInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_int3@
+hs_bindgen_e86e93b147924e4a = \x_0 -> fmap fromFFIType (hs_bindgen_e86e93b147924e4a_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_safe :: CInt -> IO CUInt
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_safe = hs_bindgen_e86e93b147924e4a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long1@
+foreign import ccall safe "hs_bindgen_2e5e9b9d09a32b33" hs_bindgen_2e5e9b9d09a32b33_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long1@
+hs_bindgen_2e5e9b9d09a32b33 :: CInt -> IO CLong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long1@
+hs_bindgen_2e5e9b9d09a32b33 = \x_0 -> fmap fromFFIType (hs_bindgen_2e5e9b9d09a32b33_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_safe :: CInt -> IO CLong
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_safe = hs_bindgen_2e5e9b9d09a32b33
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long2@
+foreign import ccall safe "hs_bindgen_9541cb65d260ceec" hs_bindgen_9541cb65d260ceec_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long2@
+hs_bindgen_9541cb65d260ceec :: CInt -> IO CLong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long2@
+hs_bindgen_9541cb65d260ceec = \x_0 -> fmap fromFFIType (hs_bindgen_9541cb65d260ceec_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_safe :: CInt -> IO CLong
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_safe = hs_bindgen_9541cb65d260ceec
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long3@
+foreign import ccall safe "hs_bindgen_fca665017c551d32" hs_bindgen_fca665017c551d32_base ::
+    CInt
+ -> IO CULong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long3@
+hs_bindgen_fca665017c551d32 :: CInt -> IO CULong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_long3@
+hs_bindgen_fca665017c551d32 = \x_0 -> fmap fromFFIType (hs_bindgen_fca665017c551d32_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_safe :: CInt -> IO CULong
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_safe = hs_bindgen_fca665017c551d32
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_float@
+foreign import ccall safe "hs_bindgen_06152a76d70abec3" hs_bindgen_06152a76d70abec3_base ::
+    CInt
+ -> IO CFloat
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_float@
+hs_bindgen_06152a76d70abec3 :: CInt -> IO CFloat
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_float@
+hs_bindgen_06152a76d70abec3 = \x_0 -> fmap fromFFIType (hs_bindgen_06152a76d70abec3_base (toFFIType x_0))
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_safe :: CInt -> IO CFloat
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_safe = hs_bindgen_06152a76d70abec3
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_double@
+foreign import ccall safe "hs_bindgen_fcbb5b65a6e8dee4" hs_bindgen_fcbb5b65a6e8dee4_base ::
+    CInt
+ -> IO CDouble
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_double@
+hs_bindgen_fcbb5b65a6e8dee4 :: CInt -> IO CDouble
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_double@
+hs_bindgen_fcbb5b65a6e8dee4 = \x_0 -> fmap fromFFIType (hs_bindgen_fcbb5b65a6e8dee4_base (toFFIType x_0))
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_safe :: CInt -> IO CDouble
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_safe = hs_bindgen_fcbb5b65a6e8dee4
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_bool1@
+foreign import ccall safe "hs_bindgen_d2265e448c2759e9" hs_bindgen_d2265e448c2759e9_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_bool1@
+hs_bindgen_d2265e448c2759e9 :: CInt -> IO CBool
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_bool1@
+hs_bindgen_d2265e448c2759e9 = \x_0 -> fmap fromFFIType (hs_bindgen_d2265e448c2759e9_base (toFFIType x_0))
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_safe :: CInt -> IO CBool
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_safe = hs_bindgen_d2265e448c2759e9
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_struct@
+foreign import ccall safe "hs_bindgen_e6010e994241dd23" hs_bindgen_e6010e994241dd23_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_struct@
+hs_bindgen_e6010e994241dd23 :: CInt -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_struct@
+hs_bindgen_e6010e994241dd23 = \x_0 -> \x_1 -> hs_bindgen_e6010e994241dd23_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_safe :: CInt -> IO Some_struct
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_e6010e994241dd23 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_union@
+foreign import ccall safe "hs_bindgen_00be97ea5e3606e4" hs_bindgen_00be97ea5e3606e4_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_union@
+hs_bindgen_00be97ea5e3606e4 :: CInt -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_union@
+hs_bindgen_00be97ea5e3606e4 = \x_0 -> \x_1 -> hs_bindgen_00be97ea5e3606e4_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_safe :: CInt -> IO Some_union
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_00be97ea5e3606e4 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_enum@
+foreign import ccall safe "hs_bindgen_7ad2540b7cf6b817" hs_bindgen_7ad2540b7cf6b817_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_enum@
+hs_bindgen_7ad2540b7cf6b817 :: CInt -> IO Some_enum
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_enum@
+hs_bindgen_7ad2540b7cf6b817 = \x_0 -> fmap fromFFIType (hs_bindgen_7ad2540b7cf6b817_base (toFFIType x_0))
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_safe :: CInt -> IO Some_enum
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_safe = hs_bindgen_7ad2540b7cf6b817
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer1@
+foreign import ccall safe "hs_bindgen_6dba6060a7ca10de" hs_bindgen_6dba6060a7ca10de_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer1@
+hs_bindgen_6dba6060a7ca10de :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer1@
+hs_bindgen_6dba6060a7ca10de = \x_0 -> fmap fromFFIType (hs_bindgen_6dba6060a7ca10de_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_safe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_safe = hs_bindgen_6dba6060a7ca10de
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer2@
+foreign import ccall safe "hs_bindgen_7af2522218790e65" hs_bindgen_7af2522218790e65_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer2@
+hs_bindgen_7af2522218790e65 :: CInt -> IO (Ptr (Ptr CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer2@
+hs_bindgen_7af2522218790e65 = \x_0 -> fmap fromFFIType (hs_bindgen_7af2522218790e65_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_safe :: CInt -> IO (Ptr (Ptr CInt))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_safe = hs_bindgen_7af2522218790e65
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer3@
+foreign import ccall safe "hs_bindgen_88562aa8f53d0780" hs_bindgen_88562aa8f53d0780_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer3@
+hs_bindgen_88562aa8f53d0780 :: CInt -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_pointer3@
+hs_bindgen_88562aa8f53d0780 = \x_0 -> fmap fromFFIType (hs_bindgen_88562aa8f53d0780_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_safe :: CInt -> IO (Ptr Void)
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_safe = hs_bindgen_88562aa8f53d0780
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body1@
+foreign import ccall safe "hs_bindgen_b9b614c706b250e5" hs_bindgen_b9b614c706b250e5_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body1@
+hs_bindgen_b9b614c706b250e5 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body1@
+hs_bindgen_b9b614c706b250e5 = \x_0 -> fmap fromFFIType (hs_bindgen_b9b614c706b250e5_base (toFFIType x_0))
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_safe :: CInt -> IO CInt
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_safe = hs_bindgen_b9b614c706b250e5
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body2@
+foreign import ccall safe "hs_bindgen_b0559ae62627b030" hs_bindgen_b0559ae62627b030_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body2@
+hs_bindgen_b0559ae62627b030 :: IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_body2@
+hs_bindgen_b0559ae62627b030 = fmap fromFFIType hs_bindgen_b0559ae62627b030_base
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_safe :: IO CInt
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_safe = hs_bindgen_b0559ae62627b030
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_float@
+foreign import ccall safe "hs_bindgen_ddfc5cefdbda545b" hs_bindgen_ddfc5cefdbda545b_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_float@
+hs_bindgen_ddfc5cefdbda545b :: CInt ->
+                               Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_float@
+hs_bindgen_ddfc5cefdbda545b = \x_0 -> \x_1 -> hs_bindgen_ddfc5cefdbda545b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_safe :: CInt -> Complex CFloat -> IO ()
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_ddfc5cefdbda545b arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_double@
+foreign import ccall safe "hs_bindgen_cbf4ca3c6e7f80aa" hs_bindgen_cbf4ca3c6e7f80aa_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_double@
+hs_bindgen_cbf4ca3c6e7f80aa :: CInt ->
+                               Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_args_complex_double@
+hs_bindgen_cbf4ca3c6e7f80aa = \x_0 -> \x_1 -> hs_bindgen_cbf4ca3c6e7f80aa_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_safe :: CInt -> Complex CDouble -> IO ()
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_cbf4ca3c6e7f80aa arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_float@
+foreign import ccall safe "hs_bindgen_0f1f6ea0917ce0ca" hs_bindgen_0f1f6ea0917ce0ca_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_float@
+hs_bindgen_0f1f6ea0917ce0ca :: CInt ->
+                               Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_float@
+hs_bindgen_0f1f6ea0917ce0ca = \x_0 -> \x_1 -> hs_bindgen_0f1f6ea0917ce0ca_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_safe :: CInt -> IO (Complex CFloat)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_0f1f6ea0917ce0ca arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_double@
+foreign import ccall safe "hs_bindgen_955f1c0b383d9a7c" hs_bindgen_955f1c0b383d9a7c_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_double@
+hs_bindgen_955f1c0b383d9a7c :: CInt ->
+                               Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_ret_complex_double@
+hs_bindgen_955f1c0b383d9a7c = \x_0 -> \x_1 -> hs_bindgen_955f1c0b383d9a7c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_safe :: CInt -> IO (Complex CDouble)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_955f1c0b383d9a7c arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args1@
+foreign import ccall safe "hs_bindgen_61695282305a53ac" hs_bindgen_61695282305a53ac_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args1@
+hs_bindgen_61695282305a53ac :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args1@
+hs_bindgen_61695282305a53ac = \x_0 -> \x_1 -> hs_bindgen_61695282305a53ac_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_safe = hs_bindgen_61695282305a53ac
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args2@
+foreign import ccall safe "hs_bindgen_4c244649666e88b3" hs_bindgen_4c244649666e88b3_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args2@
+hs_bindgen_4c244649666e88b3 :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_args2@
+hs_bindgen_4c244649666e88b3 = \x_0 -> \x_1 -> hs_bindgen_4c244649666e88b3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_safe :: CInt -> HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_safe = hs_bindgen_4c244649666e88b3
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret1@
+foreign import ccall safe "hs_bindgen_1b4cd50ca08ff13a" hs_bindgen_1b4cd50ca08ff13a_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret1@
+hs_bindgen_1b4cd50ca08ff13a :: CInt -> IO CBool
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret1@
+hs_bindgen_1b4cd50ca08ff13a = \x_0 -> fmap fromFFIType (hs_bindgen_1b4cd50ca08ff13a_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_safe :: CInt -> IO CBool
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_safe = hs_bindgen_1b4cd50ca08ff13a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret2@
+foreign import ccall safe "hs_bindgen_71b4f4a34ec749c5" hs_bindgen_71b4f4a34ec749c5_base ::
+    CInt
+ -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret2@
+hs_bindgen_71b4f4a34ec749c5 :: CInt ->
+                               IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_bespoke_ret2@
+hs_bindgen_71b4f4a34ec749c5 = \x_0 -> fmap fromFFIType (hs_bindgen_71b4f4a34ec749c5_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_safe :: CInt -> IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_safe = hs_bindgen_71b4f4a34ec749c5
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args1@
+foreign import ccall safe "hs_bindgen_8588314c8f45b7e1" hs_bindgen_8588314c8f45b7e1_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args1@
+hs_bindgen_8588314c8f45b7e1 :: Ptr (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args1@
+hs_bindgen_8588314c8f45b7e1 = \x_0 -> hs_bindgen_8588314c8f45b7e1_base (toFFIType x_0)
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_safe :: Ptr (Elem (IncompleteArray CInt)) -> IO ()
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_safe = hs_bindgen_8588314c8f45b7e1
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args2@
+foreign import ccall safe "hs_bindgen_2eb08d216276c1b7" hs_bindgen_2eb08d216276c1b7_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args2@
+hs_bindgen_2eb08d216276c1b7 :: Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args2@
+hs_bindgen_2eb08d216276c1b7 = \x_0 -> hs_bindgen_2eb08d216276c1b7_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_safe :: Ptr (Elem (IncompleteArray (Ptr CInt))) -> IO ()
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_safe = hs_bindgen_2eb08d216276c1b7
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args3@
+foreign import ccall safe "hs_bindgen_9e0ebe19b98832b7" hs_bindgen_9e0ebe19b98832b7_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args3@
+hs_bindgen_9e0ebe19b98832b7 :: Ptr (Elem (ConstantArray 5 CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args3@
+hs_bindgen_9e0ebe19b98832b7 = \x_0 -> hs_bindgen_9e0ebe19b98832b7_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_safe :: Ptr (Elem (ConstantArray 5 CInt)) -> IO ()
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_safe = hs_bindgen_9e0ebe19b98832b7
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args4@
+foreign import ccall safe "hs_bindgen_46bbe5c4f9a7db28" hs_bindgen_46bbe5c4f9a7db28_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args4@
+hs_bindgen_46bbe5c4f9a7db28 :: Ptr (Elem (ConstantArray 5
+                                                        (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_arr_args4@
+hs_bindgen_46bbe5c4f9a7db28 = \x_0 -> hs_bindgen_46bbe5c4f9a7db28_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_safe :: Ptr (Elem (ConstantArray 5 (Ptr CInt))) -> IO ()
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_safe = hs_bindgen_46bbe5c4f9a7db28
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args1@
+foreign import ccall safe "hs_bindgen_38985300d47b4487" hs_bindgen_38985300d47b4487_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args1@
+hs_bindgen_38985300d47b4487 :: CInt -> FunPtr (IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args1@
+hs_bindgen_38985300d47b4487 = \x_0 -> \x_1 -> hs_bindgen_38985300d47b4487_base (toFFIType x_0) (toFFIType x_1)
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_safe :: CInt -> FunPtr (IO ()) -> IO ()
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_safe = hs_bindgen_38985300d47b4487
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args2@
+foreign import ccall safe "hs_bindgen_23d1626952d2a132" hs_bindgen_23d1626952d2a132_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args2@
+hs_bindgen_23d1626952d2a132 :: CInt -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args2@
+hs_bindgen_23d1626952d2a132 = \x_0 -> \x_1 -> hs_bindgen_23d1626952d2a132_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_safe :: CInt -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_safe = hs_bindgen_23d1626952d2a132
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args3@
+foreign import ccall safe "hs_bindgen_69073b33110db81a" hs_bindgen_69073b33110db81a_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args3@
+hs_bindgen_69073b33110db81a :: CInt ->
+                               FunPtr (CInt -> IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args3@
+hs_bindgen_69073b33110db81a = \x_0 -> \x_1 -> hs_bindgen_69073b33110db81a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_safe :: CInt -> FunPtr (CInt -> IO ()) -> IO ()
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_safe = hs_bindgen_69073b33110db81a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args4@
+foreign import ccall safe "hs_bindgen_9e6495d8345f7848" hs_bindgen_9e6495d8345f7848_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args4@
+hs_bindgen_9e6495d8345f7848 :: CInt ->
+                               FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args4@
+hs_bindgen_9e6495d8345f7848 = \x_0 -> \x_1 -> hs_bindgen_9e6495d8345f7848_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_safe :: CInt ->
+                     FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_safe = hs_bindgen_9e6495d8345f7848
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args5@
+foreign import ccall safe "hs_bindgen_d5ab1b462ff6c176" hs_bindgen_d5ab1b462ff6c176_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args5@
+hs_bindgen_d5ab1b462ff6c176 :: CInt ->
+                               FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_args5@
+hs_bindgen_d5ab1b462ff6c176 = \x_0 -> \x_1 -> hs_bindgen_d5ab1b462ff6c176_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_safe :: CInt ->
+                     FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_safe = hs_bindgen_d5ab1b462ff6c176
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_comments1@
+foreign import ccall safe "hs_bindgen_17cfdc4afa81f262" hs_bindgen_17cfdc4afa81f262_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_comments1@
+hs_bindgen_17cfdc4afa81f262 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_comments1@
+hs_bindgen_17cfdc4afa81f262 = \x_0 -> hs_bindgen_17cfdc4afa81f262_base (toFFIType x_0)
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_safe :: CInt -> IO ()
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_safe = hs_bindgen_17cfdc4afa81f262
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before1@
+foreign import ccall safe "hs_bindgen_62dad052d7ac99e6" hs_bindgen_62dad052d7ac99e6_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before1@
+hs_bindgen_62dad052d7ac99e6 :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before1@
+hs_bindgen_62dad052d7ac99e6 = \x_0 -> \x_1 -> hs_bindgen_62dad052d7ac99e6_base (toFFIType x_0) (toFFIType x_1)
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_safe :: CInt -> CChar -> IO ()
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_safe = hs_bindgen_62dad052d7ac99e6
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before2@
+foreign import ccall safe "hs_bindgen_6a954623e8847292" hs_bindgen_6a954623e8847292_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before2@
+hs_bindgen_6a954623e8847292 :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before2@
+hs_bindgen_6a954623e8847292 = \x_0 -> \x_1 -> hs_bindgen_6a954623e8847292_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_safe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_safe = hs_bindgen_6a954623e8847292
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before3@
+foreign import ccall safe "hs_bindgen_5c4e5530b1f695b7" hs_bindgen_5c4e5530b1f695b7_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before3@
+hs_bindgen_5c4e5530b1f695b7 :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_before3@
+hs_bindgen_5c4e5530b1f695b7 = \x_0 -> \x_1 -> hs_bindgen_5c4e5530b1f695b7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_safe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_safe = hs_bindgen_5c4e5530b1f695b7
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after1@
+foreign import ccall safe "hs_bindgen_d219b88b917d72cf" hs_bindgen_d219b88b917d72cf_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after1@
+hs_bindgen_d219b88b917d72cf :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after1@
+hs_bindgen_d219b88b917d72cf = \x_0 -> \x_1 -> hs_bindgen_d219b88b917d72cf_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_safe :: CInt -> CChar -> IO ()
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_safe = hs_bindgen_d219b88b917d72cf
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after2@
+foreign import ccall safe "hs_bindgen_79a466a4f64a4db1" hs_bindgen_79a466a4f64a4db1_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after2@
+hs_bindgen_79a466a4f64a4db1 :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after2@
+hs_bindgen_79a466a4f64a4db1 = \x_0 -> \x_1 -> hs_bindgen_79a466a4f64a4db1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_safe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_safe = hs_bindgen_79a466a4f64a4db1
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after3@
+foreign import ccall safe "hs_bindgen_a13884c8125a5f80" hs_bindgen_a13884c8125a5f80_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after3@
+hs_bindgen_a13884c8125a5f80 :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_prim_after3@
+hs_bindgen_a13884c8125a5f80 = \x_0 -> \x_1 -> hs_bindgen_a13884c8125a5f80_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_safe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_safe = hs_bindgen_a13884c8125a5f80
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before1@
+foreign import ccall safe "hs_bindgen_5433c1896cba42d3" hs_bindgen_5433c1896cba42d3_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before1@
+hs_bindgen_5433c1896cba42d3 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before1@
+hs_bindgen_5433c1896cba42d3 = \x_0 -> \x_1 -> hs_bindgen_5433c1896cba42d3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_safe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_safe = hs_bindgen_5433c1896cba42d3
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before2@
+foreign import ccall safe "hs_bindgen_8300ce11589589f2" hs_bindgen_8300ce11589589f2_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before2@
+hs_bindgen_8300ce11589589f2 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before2@
+hs_bindgen_8300ce11589589f2 = \x_0 -> \x_1 -> hs_bindgen_8300ce11589589f2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_safe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_safe = hs_bindgen_8300ce11589589f2
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before3@
+foreign import ccall safe "hs_bindgen_be304ec839983d7b" hs_bindgen_be304ec839983d7b_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before3@
+hs_bindgen_be304ec839983d7b :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before3@
+hs_bindgen_be304ec839983d7b = \x_0 -> \x_1 -> hs_bindgen_be304ec839983d7b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_safe = hs_bindgen_be304ec839983d7b
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before4@
+foreign import ccall safe "hs_bindgen_445a2c238c734060" hs_bindgen_445a2c238c734060_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before4@
+hs_bindgen_445a2c238c734060 :: CInt ->
+                               PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before4@
+hs_bindgen_445a2c238c734060 = \x_0 -> \x_1 -> hs_bindgen_445a2c238c734060_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_safe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_445a2c238c734060 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before5@
+foreign import ccall safe "hs_bindgen_b5a05c2c1589c243" hs_bindgen_b5a05c2c1589c243_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before5@
+hs_bindgen_b5a05c2c1589c243 :: CInt -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before5@
+hs_bindgen_b5a05c2c1589c243 = \x_0 -> \x_1 -> hs_bindgen_b5a05c2c1589c243_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_safe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_b5a05c2c1589c243 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before6@
+foreign import ccall safe "hs_bindgen_8217e6e9e19e7627" hs_bindgen_8217e6e9e19e7627_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before6@
+hs_bindgen_8217e6e9e19e7627 :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before6@
+hs_bindgen_8217e6e9e19e7627 = \x_0 -> \x_1 -> hs_bindgen_8217e6e9e19e7627_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_safe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_safe = hs_bindgen_8217e6e9e19e7627
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before7@
+foreign import ccall safe "hs_bindgen_cbcb3411df130b42" hs_bindgen_cbcb3411df130b42_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before7@
+hs_bindgen_cbcb3411df130b42 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before7@
+hs_bindgen_cbcb3411df130b42 = \x_0 -> \x_1 -> hs_bindgen_cbcb3411df130b42_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_safe = hs_bindgen_cbcb3411df130b42
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before8@
+foreign import ccall safe "hs_bindgen_fb0ddd12de072fd8" hs_bindgen_fb0ddd12de072fd8_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before8@
+hs_bindgen_fb0ddd12de072fd8 :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_before8@
+hs_bindgen_fb0ddd12de072fd8 = \x_0 -> \x_1 -> hs_bindgen_fb0ddd12de072fd8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_safe :: CInt ->
+                                  HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_safe = hs_bindgen_fb0ddd12de072fd8
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after1@
+foreign import ccall safe "hs_bindgen_91e81e2ec29aa772" hs_bindgen_91e81e2ec29aa772_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after1@
+hs_bindgen_91e81e2ec29aa772 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after1@
+hs_bindgen_91e81e2ec29aa772 = \x_0 -> \x_1 -> hs_bindgen_91e81e2ec29aa772_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_safe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_safe = hs_bindgen_91e81e2ec29aa772
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after2@
+foreign import ccall safe "hs_bindgen_6703a37e4fd098b1" hs_bindgen_6703a37e4fd098b1_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after2@
+hs_bindgen_6703a37e4fd098b1 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after2@
+hs_bindgen_6703a37e4fd098b1 = \x_0 -> \x_1 -> hs_bindgen_6703a37e4fd098b1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_safe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_safe = hs_bindgen_6703a37e4fd098b1
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after3@
+foreign import ccall safe "hs_bindgen_054259024219dbcc" hs_bindgen_054259024219dbcc_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after3@
+hs_bindgen_054259024219dbcc :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after3@
+hs_bindgen_054259024219dbcc = \x_0 -> \x_1 -> hs_bindgen_054259024219dbcc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_safe = hs_bindgen_054259024219dbcc
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after4@
+foreign import ccall safe "hs_bindgen_eb4880610136c7bb" hs_bindgen_eb4880610136c7bb_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after4@
+hs_bindgen_eb4880610136c7bb :: CInt ->
+                               PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after4@
+hs_bindgen_eb4880610136c7bb = \x_0 -> \x_1 -> hs_bindgen_eb4880610136c7bb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_safe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_eb4880610136c7bb arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after5@
+foreign import ccall safe "hs_bindgen_c0478c5f65c7e32e" hs_bindgen_c0478c5f65c7e32e_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after5@
+hs_bindgen_c0478c5f65c7e32e :: CInt -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after5@
+hs_bindgen_c0478c5f65c7e32e = \x_0 -> \x_1 -> hs_bindgen_c0478c5f65c7e32e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_safe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_c0478c5f65c7e32e arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after6@
+foreign import ccall safe "hs_bindgen_764dd29ada03ac05" hs_bindgen_764dd29ada03ac05_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after6@
+hs_bindgen_764dd29ada03ac05 :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after6@
+hs_bindgen_764dd29ada03ac05 = \x_0 -> \x_1 -> hs_bindgen_764dd29ada03ac05_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_safe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_safe = hs_bindgen_764dd29ada03ac05
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after7@
+foreign import ccall safe "hs_bindgen_62f2db62740aa47c" hs_bindgen_62f2db62740aa47c_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after7@
+hs_bindgen_62f2db62740aa47c :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after7@
+hs_bindgen_62f2db62740aa47c = \x_0 -> \x_1 -> hs_bindgen_62f2db62740aa47c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_safe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_safe = hs_bindgen_62f2db62740aa47c
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after8@
+foreign import ccall safe "hs_bindgen_f9349cbf0c433984" hs_bindgen_f9349cbf0c433984_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after8@
+hs_bindgen_f9349cbf0c433984 :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_withoutSign_after8@
+hs_bindgen_f9349cbf0c433984 = \x_0 -> \x_1 -> hs_bindgen_f9349cbf0c433984_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_safe :: CInt ->
+                                 HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_safe = hs_bindgen_f9349cbf0c433984
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args1@
+foreign import ccall safe "hs_bindgen_05103ac5c64a70c5" hs_bindgen_05103ac5c64a70c5_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args1@
+hs_bindgen_05103ac5c64a70c5 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args1@
+hs_bindgen_05103ac5c64a70c5 = \x_0 -> \x_1 -> hs_bindgen_05103ac5c64a70c5_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_safe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_safe = hs_bindgen_05103ac5c64a70c5
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args2@
+foreign import ccall safe "hs_bindgen_2adbdab03502d7c3" hs_bindgen_2adbdab03502d7c3_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args2@
+hs_bindgen_2adbdab03502d7c3 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args2@
+hs_bindgen_2adbdab03502d7c3 = \x_0 -> \x_1 -> hs_bindgen_2adbdab03502d7c3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_safe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_safe = hs_bindgen_2adbdab03502d7c3
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args3@
+foreign import ccall safe "hs_bindgen_02735f713f3663a0" hs_bindgen_02735f713f3663a0_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args3@
+hs_bindgen_02735f713f3663a0 :: CInt -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args3@
+hs_bindgen_02735f713f3663a0 = \x_0 -> \x_1 -> hs_bindgen_02735f713f3663a0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_safe :: CInt -> Ptr CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_safe = hs_bindgen_02735f713f3663a0
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args4@
+foreign import ccall safe "hs_bindgen_7be4b56f499736ec" hs_bindgen_7be4b56f499736ec_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args4@
+hs_bindgen_7be4b56f499736ec :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args4@
+hs_bindgen_7be4b56f499736ec = \x_0 -> \x_1 -> hs_bindgen_7be4b56f499736ec_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_safe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_safe = hs_bindgen_7be4b56f499736ec
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args5@
+foreign import ccall safe "hs_bindgen_07806340121e9d7a" hs_bindgen_07806340121e9d7a_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args5@
+hs_bindgen_07806340121e9d7a :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_args5@
+hs_bindgen_07806340121e9d7a = \x_0 -> \x_1 -> hs_bindgen_07806340121e9d7a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_safe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_safe = hs_bindgen_07806340121e9d7a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret1@
+foreign import ccall safe "hs_bindgen_964ecbd6daab3ac8" hs_bindgen_964ecbd6daab3ac8_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret1@
+hs_bindgen_964ecbd6daab3ac8 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret1@
+hs_bindgen_964ecbd6daab3ac8 = \x_0 -> fmap fromFFIType (hs_bindgen_964ecbd6daab3ac8_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_safe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_safe = hs_bindgen_964ecbd6daab3ac8
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret2@
+foreign import ccall safe "hs_bindgen_425aa26fa3f15a85" hs_bindgen_425aa26fa3f15a85_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret2@
+hs_bindgen_425aa26fa3f15a85 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret2@
+hs_bindgen_425aa26fa3f15a85 = \x_0 -> fmap fromFFIType (hs_bindgen_425aa26fa3f15a85_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_safe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_safe = hs_bindgen_425aa26fa3f15a85
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret3@
+foreign import ccall safe "hs_bindgen_35dc6a2376f4669c" hs_bindgen_35dc6a2376f4669c_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret3@
+hs_bindgen_35dc6a2376f4669c :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret3@
+hs_bindgen_35dc6a2376f4669c = \x_0 -> fmap fromFFIType (hs_bindgen_35dc6a2376f4669c_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_safe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_safe = hs_bindgen_35dc6a2376f4669c
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret4@
+foreign import ccall safe "hs_bindgen_b4704a8e3fa5c1a7" hs_bindgen_b4704a8e3fa5c1a7_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret4@
+hs_bindgen_b4704a8e3fa5c1a7 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret4@
+hs_bindgen_b4704a8e3fa5c1a7 = \x_0 -> fmap fromFFIType (hs_bindgen_b4704a8e3fa5c1a7_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_safe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_safe = hs_bindgen_b4704a8e3fa5c1a7
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret5@
+foreign import ccall safe "hs_bindgen_eee06f696926bceb" hs_bindgen_eee06f696926bceb_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret5@
+hs_bindgen_eee06f696926bceb :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_pointers_ret5@
+hs_bindgen_eee06f696926bceb = \x_0 -> fmap fromFFIType (hs_bindgen_eee06f696926bceb_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_safe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_safe = hs_bindgen_eee06f696926bceb
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem1@
+foreign import ccall safe "hs_bindgen_85897c18c4db8c38" hs_bindgen_85897c18c4db8c38_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem1@
+hs_bindgen_85897c18c4db8c38 :: PtrConst (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem1@
+hs_bindgen_85897c18c4db8c38 = \x_0 -> hs_bindgen_85897c18c4db8c38_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_safe :: PtrConst (Elem (IncompleteArray CInt)) ->
+                          IO ()
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_safe = hs_bindgen_85897c18c4db8c38
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem2@
+foreign import ccall safe "hs_bindgen_7d19c28372388bd5" hs_bindgen_7d19c28372388bd5_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem2@
+hs_bindgen_7d19c28372388bd5 :: Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem2@
+hs_bindgen_7d19c28372388bd5 = \x_0 -> hs_bindgen_7d19c28372388bd5_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_safe :: Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                          IO ()
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_safe = hs_bindgen_7d19c28372388bd5
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem3@
+foreign import ccall safe "hs_bindgen_b72db4cfe06fec75" hs_bindgen_b72db4cfe06fec75_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem3@
+hs_bindgen_b72db4cfe06fec75 :: PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_const_array_elem3@
+hs_bindgen_b72db4cfe06fec75 = \x_0 -> hs_bindgen_b72db4cfe06fec75_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_safe :: PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                          IO ()
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_safe = hs_bindgen_b72db4cfe06fec75
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams1@
+foreign import ccall safe "hs_bindgen_8c2d8b6c768235a6" hs_bindgen_8c2d8b6c768235a6_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams1@
+hs_bindgen_8c2d8b6c768235a6 :: IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams1@
+hs_bindgen_8c2d8b6c768235a6 = fmap fromFFIType hs_bindgen_8c2d8b6c768235a6_base
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_safe :: IO CInt
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_safe = hs_bindgen_8c2d8b6c768235a6
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams2@
+foreign import ccall safe "hs_bindgen_f406093f4244470f" hs_bindgen_f406093f4244470f_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams2@
+hs_bindgen_f406093f4244470f :: IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams2@
+hs_bindgen_f406093f4244470f = fmap fromFFIType hs_bindgen_f406093f4244470f_base
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_safe :: IO CInt
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_safe = hs_bindgen_f406093f4244470f
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams3@
+foreign import ccall safe "hs_bindgen_7cfe278ffc125a35" hs_bindgen_7cfe278ffc125a35_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams3@
+hs_bindgen_7cfe278ffc125a35 :: CInt -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_noParams3@
+hs_bindgen_7cfe278ffc125a35 = \x_0 -> \x_1 -> hs_bindgen_7cfe278ffc125a35_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_safe :: CInt -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_safe = hs_bindgen_7cfe278ffc125a35
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret1@
+foreign import ccall safe "hs_bindgen_6f95516796104481" hs_bindgen_6f95516796104481_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret1@
+hs_bindgen_6f95516796104481 :: CInt -> IO (FunPtr (IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret1@
+hs_bindgen_6f95516796104481 = \x_0 -> fmap fromFFIType (hs_bindgen_6f95516796104481_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_safe :: CInt -> IO (FunPtr (IO ()))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_safe = hs_bindgen_6f95516796104481
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret2@
+foreign import ccall safe "hs_bindgen_c823e0311ec509b4" hs_bindgen_c823e0311ec509b4_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret2@
+hs_bindgen_c823e0311ec509b4 :: CInt -> IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret2@
+hs_bindgen_c823e0311ec509b4 = \x_0 -> fmap fromFFIType (hs_bindgen_c823e0311ec509b4_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_safe :: CInt -> IO (FunPtr (IO CInt))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_safe = hs_bindgen_c823e0311ec509b4
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret3@
+foreign import ccall safe "hs_bindgen_94550ec4aba19f7b" hs_bindgen_94550ec4aba19f7b_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret3@
+hs_bindgen_94550ec4aba19f7b :: CInt -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret3@
+hs_bindgen_94550ec4aba19f7b = \x_0 -> fmap fromFFIType (hs_bindgen_94550ec4aba19f7b_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_safe :: CInt -> IO (FunPtr (CInt -> IO ()))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_safe = hs_bindgen_94550ec4aba19f7b
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret4@
+foreign import ccall safe "hs_bindgen_ed3e6ebe628da423" hs_bindgen_ed3e6ebe628da423_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret4@
+hs_bindgen_ed3e6ebe628da423 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO CChar))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret4@
+hs_bindgen_ed3e6ebe628da423 = \x_0 -> fmap fromFFIType (hs_bindgen_ed3e6ebe628da423_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO CChar))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_safe = hs_bindgen_ed3e6ebe628da423
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret5@
+foreign import ccall safe "hs_bindgen_cb5a94e6610ff83d" hs_bindgen_cb5a94e6610ff83d_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret5@
+hs_bindgen_cb5a94e6610ff83d :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret5@
+hs_bindgen_cb5a94e6610ff83d = \x_0 -> fmap fromFFIType (hs_bindgen_cb5a94e6610ff83d_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_safe = hs_bindgen_cb5a94e6610ff83d
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret6@
+foreign import ccall safe "hs_bindgen_8cd3005394354b86" hs_bindgen_8cd3005394354b86_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret6@
+hs_bindgen_8cd3005394354b86 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret6@
+hs_bindgen_8cd3005394354b86 = \x_0 -> fmap fromFFIType (hs_bindgen_8cd3005394354b86_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_safe = hs_bindgen_8cd3005394354b86
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret7@
+foreign import ccall safe "hs_bindgen_0f1393247fcdeb7a" hs_bindgen_0f1393247fcdeb7a_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret7@
+hs_bindgen_0f1393247fcdeb7a :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret7@
+hs_bindgen_0f1393247fcdeb7a = \x_0 -> fmap fromFFIType (hs_bindgen_0f1393247fcdeb7a_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_safe = hs_bindgen_0f1393247fcdeb7a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret8@
+foreign import ccall safe "hs_bindgen_7da05d4b5c843853" hs_bindgen_7da05d4b5c843853_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret8@
+hs_bindgen_7da05d4b5c843853 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret8@
+hs_bindgen_7da05d4b5c843853 = \x_0 -> fmap fromFFIType (hs_bindgen_7da05d4b5c843853_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_safe = hs_bindgen_7da05d4b5c843853
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret9@
+foreign import ccall safe "hs_bindgen_f6f304c980603aae" hs_bindgen_f6f304c980603aae_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret9@
+hs_bindgen_f6f304c980603aae :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret9@
+hs_bindgen_f6f304c980603aae = \x_0 -> fmap fromFFIType (hs_bindgen_f6f304c980603aae_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_safe :: CInt ->
+                    IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_safe = hs_bindgen_f6f304c980603aae
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret10@
+foreign import ccall safe "hs_bindgen_263377d0e4be3901" hs_bindgen_263377d0e4be3901_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret10@
+hs_bindgen_263377d0e4be3901 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Safe_funptr_ret10@
+hs_bindgen_263377d0e4be3901 = \x_0 -> fmap fromFFIType (hs_bindgen_263377d0e4be3901_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_safe :: CInt ->
+                     IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_safe = hs_bindgen_263377d0e4be3901
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char1@
+foreign import ccall unsafe "hs_bindgen_dbcf45ae88784a43" hs_bindgen_dbcf45ae88784a43_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char1@
+hs_bindgen_dbcf45ae88784a43 :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char1@
+hs_bindgen_dbcf45ae88784a43 = \x_0 -> \x_1 -> hs_bindgen_dbcf45ae88784a43_base (toFFIType x_0) (toFFIType x_1)
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_unsafe :: CInt -> CChar -> IO ()
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_unsafe = hs_bindgen_dbcf45ae88784a43
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char2@
+foreign import ccall unsafe "hs_bindgen_c72087f2b9c0a851" hs_bindgen_c72087f2b9c0a851_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char2@
+hs_bindgen_c72087f2b9c0a851 :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char2@
+hs_bindgen_c72087f2b9c0a851 = \x_0 -> \x_1 -> hs_bindgen_c72087f2b9c0a851_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_unsafe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_unsafe = hs_bindgen_c72087f2b9c0a851
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char3@
+foreign import ccall unsafe "hs_bindgen_d23034ca037d7ee2" hs_bindgen_d23034ca037d7ee2_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char3@
+hs_bindgen_d23034ca037d7ee2 :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_char3@
+hs_bindgen_d23034ca037d7ee2 = \x_0 -> \x_1 -> hs_bindgen_d23034ca037d7ee2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_unsafe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_unsafe = hs_bindgen_d23034ca037d7ee2
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short1@
+foreign import ccall unsafe "hs_bindgen_7aba582bac3cdd4c" hs_bindgen_7aba582bac3cdd4c_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short1@
+hs_bindgen_7aba582bac3cdd4c :: CInt -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short1@
+hs_bindgen_7aba582bac3cdd4c = \x_0 -> \x_1 -> hs_bindgen_7aba582bac3cdd4c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_unsafe :: CInt -> CShort -> IO ()
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_unsafe = hs_bindgen_7aba582bac3cdd4c
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short2@
+foreign import ccall unsafe "hs_bindgen_72e80c0c19b73bd1" hs_bindgen_72e80c0c19b73bd1_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short2@
+hs_bindgen_72e80c0c19b73bd1 :: CInt -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short2@
+hs_bindgen_72e80c0c19b73bd1 = \x_0 -> \x_1 -> hs_bindgen_72e80c0c19b73bd1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_unsafe :: CInt -> CShort -> IO ()
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_unsafe = hs_bindgen_72e80c0c19b73bd1
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short3@
+foreign import ccall unsafe "hs_bindgen_1d779b6db021542e" hs_bindgen_1d779b6db021542e_base ::
+    CInt
+ -> CUShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short3@
+hs_bindgen_1d779b6db021542e :: CInt -> CUShort -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_short3@
+hs_bindgen_1d779b6db021542e = \x_0 -> \x_1 -> hs_bindgen_1d779b6db021542e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_unsafe :: CInt -> CUShort -> IO ()
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_unsafe = hs_bindgen_1d779b6db021542e
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int1@
+foreign import ccall unsafe "hs_bindgen_dadb0390936fa7a6" hs_bindgen_dadb0390936fa7a6_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int1@
+hs_bindgen_dadb0390936fa7a6 :: CInt -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int1@
+hs_bindgen_dadb0390936fa7a6 = \x_0 -> \x_1 -> hs_bindgen_dadb0390936fa7a6_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_unsafe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_unsafe = hs_bindgen_dadb0390936fa7a6
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int2@
+foreign import ccall unsafe "hs_bindgen_cc4dd71da3d83f3e" hs_bindgen_cc4dd71da3d83f3e_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int2@
+hs_bindgen_cc4dd71da3d83f3e :: CInt -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int2@
+hs_bindgen_cc4dd71da3d83f3e = \x_0 -> \x_1 -> hs_bindgen_cc4dd71da3d83f3e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_unsafe :: CInt -> CInt -> IO ()
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_unsafe = hs_bindgen_cc4dd71da3d83f3e
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int3@
+foreign import ccall unsafe "hs_bindgen_c1aa1895338c9c06" hs_bindgen_c1aa1895338c9c06_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int3@
+hs_bindgen_c1aa1895338c9c06 :: CInt -> CUInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_int3@
+hs_bindgen_c1aa1895338c9c06 = \x_0 -> \x_1 -> hs_bindgen_c1aa1895338c9c06_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_unsafe :: CInt -> CUInt -> IO ()
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_unsafe = hs_bindgen_c1aa1895338c9c06
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long1@
+foreign import ccall unsafe "hs_bindgen_ea3ab52d35940c9c" hs_bindgen_ea3ab52d35940c9c_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long1@
+hs_bindgen_ea3ab52d35940c9c :: CInt -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long1@
+hs_bindgen_ea3ab52d35940c9c = \x_0 -> \x_1 -> hs_bindgen_ea3ab52d35940c9c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_unsafe :: CInt -> CLong -> IO ()
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_unsafe = hs_bindgen_ea3ab52d35940c9c
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long2@
+foreign import ccall unsafe "hs_bindgen_1ead52aa138d51cf" hs_bindgen_1ead52aa138d51cf_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long2@
+hs_bindgen_1ead52aa138d51cf :: CInt -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long2@
+hs_bindgen_1ead52aa138d51cf = \x_0 -> \x_1 -> hs_bindgen_1ead52aa138d51cf_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_unsafe :: CInt -> CLong -> IO ()
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_unsafe = hs_bindgen_1ead52aa138d51cf
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long3@
+foreign import ccall unsafe "hs_bindgen_93b713dccaf06fed" hs_bindgen_93b713dccaf06fed_base ::
+    CInt
+ -> CULong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long3@
+hs_bindgen_93b713dccaf06fed :: CInt -> CULong -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_long3@
+hs_bindgen_93b713dccaf06fed = \x_0 -> \x_1 -> hs_bindgen_93b713dccaf06fed_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_unsafe :: CInt -> CULong -> IO ()
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_unsafe = hs_bindgen_93b713dccaf06fed
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_float@
+foreign import ccall unsafe "hs_bindgen_d091d2dc36843d19" hs_bindgen_d091d2dc36843d19_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_float@
+hs_bindgen_d091d2dc36843d19 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_float@
+hs_bindgen_d091d2dc36843d19 = \x_0 -> \x_1 -> hs_bindgen_d091d2dc36843d19_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_unsafe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_unsafe = hs_bindgen_d091d2dc36843d19
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_double@
+foreign import ccall unsafe "hs_bindgen_6ea5acb5ec6f40c4" hs_bindgen_6ea5acb5ec6f40c4_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_double@
+hs_bindgen_6ea5acb5ec6f40c4 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_double@
+hs_bindgen_6ea5acb5ec6f40c4 = \x_0 -> \x_1 -> hs_bindgen_6ea5acb5ec6f40c4_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_unsafe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_unsafe = hs_bindgen_6ea5acb5ec6f40c4
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_bool1@
+foreign import ccall unsafe "hs_bindgen_689ef6ac4e916b3a" hs_bindgen_689ef6ac4e916b3a_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_bool1@
+hs_bindgen_689ef6ac4e916b3a :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_bool1@
+hs_bindgen_689ef6ac4e916b3a = \x_0 -> \x_1 -> hs_bindgen_689ef6ac4e916b3a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_unsafe = hs_bindgen_689ef6ac4e916b3a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_struct@
+foreign import ccall unsafe "hs_bindgen_3d21d6b68f84eba6" hs_bindgen_3d21d6b68f84eba6_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_struct@
+hs_bindgen_3d21d6b68f84eba6 :: CInt -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_struct@
+hs_bindgen_3d21d6b68f84eba6 = \x_0 -> \x_1 -> hs_bindgen_3d21d6b68f84eba6_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_unsafe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_3d21d6b68f84eba6 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_union@
+foreign import ccall unsafe "hs_bindgen_6c2746bae9e4dab9" hs_bindgen_6c2746bae9e4dab9_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_union@
+hs_bindgen_6c2746bae9e4dab9 :: CInt -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_union@
+hs_bindgen_6c2746bae9e4dab9 = \x_0 -> \x_1 -> hs_bindgen_6c2746bae9e4dab9_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_unsafe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_6c2746bae9e4dab9 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_enum@
+foreign import ccall unsafe "hs_bindgen_6c549405e9baffcf" hs_bindgen_6c549405e9baffcf_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_enum@
+hs_bindgen_6c549405e9baffcf :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_enum@
+hs_bindgen_6c549405e9baffcf = \x_0 -> \x_1 -> hs_bindgen_6c549405e9baffcf_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_unsafe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_unsafe = hs_bindgen_6c549405e9baffcf
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_34dfa5eaf97951ec" hs_bindgen_34dfa5eaf97951ec_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer1@
+hs_bindgen_34dfa5eaf97951ec :: CInt -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer1@
+hs_bindgen_34dfa5eaf97951ec = \x_0 -> \x_1 -> hs_bindgen_34dfa5eaf97951ec_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_unsafe :: CInt -> Ptr CInt -> IO ()
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_unsafe = hs_bindgen_34dfa5eaf97951ec
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_0d71e7152a20efbd" hs_bindgen_0d71e7152a20efbd_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer2@
+hs_bindgen_0d71e7152a20efbd :: CInt -> Ptr (Ptr CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer2@
+hs_bindgen_0d71e7152a20efbd = \x_0 -> \x_1 -> hs_bindgen_0d71e7152a20efbd_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_unsafe :: CInt -> Ptr (Ptr CInt) -> IO ()
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_unsafe = hs_bindgen_0d71e7152a20efbd
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_1ac8f30e6858a673" hs_bindgen_1ac8f30e6858a673_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer3@
+hs_bindgen_1ac8f30e6858a673 :: CInt -> Ptr Void -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_pointer3@
+hs_bindgen_1ac8f30e6858a673 = \x_0 -> \x_1 -> hs_bindgen_1ac8f30e6858a673_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_unsafe :: CInt -> Ptr Void -> IO ()
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_unsafe = hs_bindgen_1ac8f30e6858a673
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_A@
+foreign import ccall unsafe "hs_bindgen_74c085d1fc547d65" hs_bindgen_74c085d1fc547d65_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_A@
+hs_bindgen_74c085d1fc547d65 :: IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_A@
+hs_bindgen_74c085d1fc547d65 = fmap fromFFIType hs_bindgen_74c085d1fc547d65_base
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_unsafe :: IO CInt
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_unsafe = hs_bindgen_74c085d1fc547d65
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char1@
+foreign import ccall unsafe "hs_bindgen_c1173d352155de62" hs_bindgen_c1173d352155de62_base ::
+    CInt
+ -> IO CChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char1@
+hs_bindgen_c1173d352155de62 :: CInt -> IO CChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char1@
+hs_bindgen_c1173d352155de62 = \x_0 -> fmap fromFFIType (hs_bindgen_c1173d352155de62_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_unsafe :: CInt -> IO CChar
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_unsafe = hs_bindgen_c1173d352155de62
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char2@
+foreign import ccall unsafe "hs_bindgen_9029d84b81d6df97" hs_bindgen_9029d84b81d6df97_base ::
+    CInt
+ -> IO CSChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char2@
+hs_bindgen_9029d84b81d6df97 :: CInt -> IO CSChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char2@
+hs_bindgen_9029d84b81d6df97 = \x_0 -> fmap fromFFIType (hs_bindgen_9029d84b81d6df97_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_unsafe :: CInt -> IO CSChar
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_unsafe = hs_bindgen_9029d84b81d6df97
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char3@
+foreign import ccall unsafe "hs_bindgen_5076ef968e0b1da6" hs_bindgen_5076ef968e0b1da6_base ::
+    CInt
+ -> IO CUChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char3@
+hs_bindgen_5076ef968e0b1da6 :: CInt -> IO CUChar
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_char3@
+hs_bindgen_5076ef968e0b1da6 = \x_0 -> fmap fromFFIType (hs_bindgen_5076ef968e0b1da6_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_unsafe :: CInt -> IO CUChar
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_unsafe = hs_bindgen_5076ef968e0b1da6
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short1@
+foreign import ccall unsafe "hs_bindgen_6c9415155d57e014" hs_bindgen_6c9415155d57e014_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short1@
+hs_bindgen_6c9415155d57e014 :: CInt -> IO CShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short1@
+hs_bindgen_6c9415155d57e014 = \x_0 -> fmap fromFFIType (hs_bindgen_6c9415155d57e014_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_unsafe :: CInt -> IO CShort
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_unsafe = hs_bindgen_6c9415155d57e014
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short2@
+foreign import ccall unsafe "hs_bindgen_24f9af60f9d4b0c4" hs_bindgen_24f9af60f9d4b0c4_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short2@
+hs_bindgen_24f9af60f9d4b0c4 :: CInt -> IO CShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short2@
+hs_bindgen_24f9af60f9d4b0c4 = \x_0 -> fmap fromFFIType (hs_bindgen_24f9af60f9d4b0c4_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_unsafe :: CInt -> IO CShort
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_unsafe = hs_bindgen_24f9af60f9d4b0c4
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short3@
+foreign import ccall unsafe "hs_bindgen_7712cc06577c000f" hs_bindgen_7712cc06577c000f_base ::
+    CInt
+ -> IO CUShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short3@
+hs_bindgen_7712cc06577c000f :: CInt -> IO CUShort
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_short3@
+hs_bindgen_7712cc06577c000f = \x_0 -> fmap fromFFIType (hs_bindgen_7712cc06577c000f_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_unsafe :: CInt -> IO CUShort
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_unsafe = hs_bindgen_7712cc06577c000f
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int1@
+foreign import ccall unsafe "hs_bindgen_a4669df8abb549dc" hs_bindgen_a4669df8abb549dc_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int1@
+hs_bindgen_a4669df8abb549dc :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int1@
+hs_bindgen_a4669df8abb549dc = \x_0 -> fmap fromFFIType (hs_bindgen_a4669df8abb549dc_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_unsafe = hs_bindgen_a4669df8abb549dc
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int2@
+foreign import ccall unsafe "hs_bindgen_d471d89e2802f599" hs_bindgen_d471d89e2802f599_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int2@
+hs_bindgen_d471d89e2802f599 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int2@
+hs_bindgen_d471d89e2802f599 = \x_0 -> fmap fromFFIType (hs_bindgen_d471d89e2802f599_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_unsafe = hs_bindgen_d471d89e2802f599
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int3@
+foreign import ccall unsafe "hs_bindgen_551866464fb7e076" hs_bindgen_551866464fb7e076_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int3@
+hs_bindgen_551866464fb7e076 :: CInt -> IO CUInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_int3@
+hs_bindgen_551866464fb7e076 = \x_0 -> fmap fromFFIType (hs_bindgen_551866464fb7e076_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_unsafe :: CInt -> IO CUInt
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_unsafe = hs_bindgen_551866464fb7e076
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long1@
+foreign import ccall unsafe "hs_bindgen_1cb0ba330b8fc708" hs_bindgen_1cb0ba330b8fc708_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long1@
+hs_bindgen_1cb0ba330b8fc708 :: CInt -> IO CLong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long1@
+hs_bindgen_1cb0ba330b8fc708 = \x_0 -> fmap fromFFIType (hs_bindgen_1cb0ba330b8fc708_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_unsafe :: CInt -> IO CLong
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_unsafe = hs_bindgen_1cb0ba330b8fc708
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long2@
+foreign import ccall unsafe "hs_bindgen_84d65e5f2bb20468" hs_bindgen_84d65e5f2bb20468_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long2@
+hs_bindgen_84d65e5f2bb20468 :: CInt -> IO CLong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long2@
+hs_bindgen_84d65e5f2bb20468 = \x_0 -> fmap fromFFIType (hs_bindgen_84d65e5f2bb20468_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_unsafe :: CInt -> IO CLong
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_unsafe = hs_bindgen_84d65e5f2bb20468
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long3@
+foreign import ccall unsafe "hs_bindgen_8e5c7c7b2f385152" hs_bindgen_8e5c7c7b2f385152_base ::
+    CInt
+ -> IO CULong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long3@
+hs_bindgen_8e5c7c7b2f385152 :: CInt -> IO CULong
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_long3@
+hs_bindgen_8e5c7c7b2f385152 = \x_0 -> fmap fromFFIType (hs_bindgen_8e5c7c7b2f385152_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_unsafe :: CInt -> IO CULong
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_unsafe = hs_bindgen_8e5c7c7b2f385152
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_float@
+foreign import ccall unsafe "hs_bindgen_be7b5328fb1e67e4" hs_bindgen_be7b5328fb1e67e4_base ::
+    CInt
+ -> IO CFloat
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_float@
+hs_bindgen_be7b5328fb1e67e4 :: CInt -> IO CFloat
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_float@
+hs_bindgen_be7b5328fb1e67e4 = \x_0 -> fmap fromFFIType (hs_bindgen_be7b5328fb1e67e4_base (toFFIType x_0))
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_unsafe :: CInt -> IO CFloat
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_unsafe = hs_bindgen_be7b5328fb1e67e4
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_double@
+foreign import ccall unsafe "hs_bindgen_67ccecb1f4c2b26b" hs_bindgen_67ccecb1f4c2b26b_base ::
+    CInt
+ -> IO CDouble
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_double@
+hs_bindgen_67ccecb1f4c2b26b :: CInt -> IO CDouble
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_double@
+hs_bindgen_67ccecb1f4c2b26b = \x_0 -> fmap fromFFIType (hs_bindgen_67ccecb1f4c2b26b_base (toFFIType x_0))
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_unsafe :: CInt -> IO CDouble
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_unsafe = hs_bindgen_67ccecb1f4c2b26b
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_8f3058d29b19c7f8" hs_bindgen_8f3058d29b19c7f8_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_bool1@
+hs_bindgen_8f3058d29b19c7f8 :: CInt -> IO CBool
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_bool1@
+hs_bindgen_8f3058d29b19c7f8 = \x_0 -> fmap fromFFIType (hs_bindgen_8f3058d29b19c7f8_base (toFFIType x_0))
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_unsafe :: CInt -> IO CBool
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_unsafe = hs_bindgen_8f3058d29b19c7f8
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_struct@
+foreign import ccall unsafe "hs_bindgen_db41d471db80076d" hs_bindgen_db41d471db80076d_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_struct@
+hs_bindgen_db41d471db80076d :: CInt -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_struct@
+hs_bindgen_db41d471db80076d = \x_0 -> \x_1 -> hs_bindgen_db41d471db80076d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_unsafe :: CInt -> IO Some_struct
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_db41d471db80076d arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_union@
+foreign import ccall unsafe "hs_bindgen_a2761d3935650b5c" hs_bindgen_a2761d3935650b5c_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_union@
+hs_bindgen_a2761d3935650b5c :: CInt -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_union@
+hs_bindgen_a2761d3935650b5c = \x_0 -> \x_1 -> hs_bindgen_a2761d3935650b5c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_unsafe :: CInt -> IO Some_union
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_a2761d3935650b5c arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_enum@
+foreign import ccall unsafe "hs_bindgen_c567484984a48bdd" hs_bindgen_c567484984a48bdd_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_enum@
+hs_bindgen_c567484984a48bdd :: CInt -> IO Some_enum
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_enum@
+hs_bindgen_c567484984a48bdd = \x_0 -> fmap fromFFIType (hs_bindgen_c567484984a48bdd_base (toFFIType x_0))
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_unsafe :: CInt -> IO Some_enum
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_unsafe = hs_bindgen_c567484984a48bdd
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_a0436717a3858ec2" hs_bindgen_a0436717a3858ec2_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer1@
+hs_bindgen_a0436717a3858ec2 :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer1@
+hs_bindgen_a0436717a3858ec2 = \x_0 -> fmap fromFFIType (hs_bindgen_a0436717a3858ec2_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_unsafe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_unsafe = hs_bindgen_a0436717a3858ec2
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_92e30e7cf97b7ae8" hs_bindgen_92e30e7cf97b7ae8_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer2@
+hs_bindgen_92e30e7cf97b7ae8 :: CInt -> IO (Ptr (Ptr CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer2@
+hs_bindgen_92e30e7cf97b7ae8 = \x_0 -> fmap fromFFIType (hs_bindgen_92e30e7cf97b7ae8_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_unsafe :: CInt -> IO (Ptr (Ptr CInt))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_unsafe = hs_bindgen_92e30e7cf97b7ae8
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_cec80a82e028945d" hs_bindgen_cec80a82e028945d_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer3@
+hs_bindgen_cec80a82e028945d :: CInt -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_pointer3@
+hs_bindgen_cec80a82e028945d = \x_0 -> fmap fromFFIType (hs_bindgen_cec80a82e028945d_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_unsafe :: CInt -> IO (Ptr Void)
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_unsafe = hs_bindgen_cec80a82e028945d
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body1@
+foreign import ccall unsafe "hs_bindgen_373d2dbedb7f3ea1" hs_bindgen_373d2dbedb7f3ea1_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body1@
+hs_bindgen_373d2dbedb7f3ea1 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body1@
+hs_bindgen_373d2dbedb7f3ea1 = \x_0 -> fmap fromFFIType (hs_bindgen_373d2dbedb7f3ea1_base (toFFIType x_0))
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_unsafe = hs_bindgen_373d2dbedb7f3ea1
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body2@
+foreign import ccall unsafe "hs_bindgen_678c705d71b66fd0" hs_bindgen_678c705d71b66fd0_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body2@
+hs_bindgen_678c705d71b66fd0 :: IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_body2@
+hs_bindgen_678c705d71b66fd0 = fmap fromFFIType hs_bindgen_678c705d71b66fd0_base
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_unsafe :: IO CInt
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_unsafe = hs_bindgen_678c705d71b66fd0
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_4a4cdf60b6a4885d" hs_bindgen_4a4cdf60b6a4885d_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_float@
+hs_bindgen_4a4cdf60b6a4885d :: CInt ->
+                               Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_float@
+hs_bindgen_4a4cdf60b6a4885d = \x_0 -> \x_1 -> hs_bindgen_4a4cdf60b6a4885d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_unsafe :: CInt -> Complex CFloat -> IO ()
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_4a4cdf60b6a4885d arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_4b113ac08bbb35bd" hs_bindgen_4b113ac08bbb35bd_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_double@
+hs_bindgen_4b113ac08bbb35bd :: CInt ->
+                               Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_args_complex_double@
+hs_bindgen_4b113ac08bbb35bd = \x_0 -> \x_1 -> hs_bindgen_4b113ac08bbb35bd_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_unsafe :: CInt -> Complex CDouble -> IO ()
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_4b113ac08bbb35bd arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_63483820a803fad0" hs_bindgen_63483820a803fad0_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_float@
+hs_bindgen_63483820a803fad0 :: CInt ->
+                               Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_float@
+hs_bindgen_63483820a803fad0 = \x_0 -> \x_1 -> hs_bindgen_63483820a803fad0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_unsafe :: CInt -> IO (Complex CFloat)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_63483820a803fad0 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_00dc8901b39e6dd3" hs_bindgen_00dc8901b39e6dd3_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_double@
+hs_bindgen_00dc8901b39e6dd3 :: CInt ->
+                               Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_ret_complex_double@
+hs_bindgen_00dc8901b39e6dd3 = \x_0 -> \x_1 -> hs_bindgen_00dc8901b39e6dd3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_unsafe :: CInt -> IO (Complex CDouble)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_00dc8901b39e6dd3 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_c4123c64e3799da5" hs_bindgen_c4123c64e3799da5_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args1@
+hs_bindgen_c4123c64e3799da5 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args1@
+hs_bindgen_c4123c64e3799da5 = \x_0 -> \x_1 -> hs_bindgen_c4123c64e3799da5_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_unsafe = hs_bindgen_c4123c64e3799da5
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_56568d64374ea82a" hs_bindgen_56568d64374ea82a_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args2@
+hs_bindgen_56568d64374ea82a :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_args2@
+hs_bindgen_56568d64374ea82a = \x_0 -> \x_1 -> hs_bindgen_56568d64374ea82a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_unsafe :: CInt ->
+                        HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_unsafe = hs_bindgen_56568d64374ea82a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_e39afd1aad07e0fc" hs_bindgen_e39afd1aad07e0fc_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret1@
+hs_bindgen_e39afd1aad07e0fc :: CInt -> IO CBool
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret1@
+hs_bindgen_e39afd1aad07e0fc = \x_0 -> fmap fromFFIType (hs_bindgen_e39afd1aad07e0fc_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_unsafe :: CInt -> IO CBool
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_unsafe = hs_bindgen_e39afd1aad07e0fc
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_06a7ca6b10b6f1c5" hs_bindgen_06a7ca6b10b6f1c5_base ::
+    CInt
+ -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret2@
+hs_bindgen_06a7ca6b10b6f1c5 :: CInt ->
+                               IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_bespoke_ret2@
+hs_bindgen_06a7ca6b10b6f1c5 = \x_0 -> fmap fromFFIType (hs_bindgen_06a7ca6b10b6f1c5_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_unsafe :: CInt -> IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_unsafe = hs_bindgen_06a7ca6b10b6f1c5
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args1@
+foreign import ccall unsafe "hs_bindgen_085cd2205e0daeff" hs_bindgen_085cd2205e0daeff_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args1@
+hs_bindgen_085cd2205e0daeff :: Ptr (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args1@
+hs_bindgen_085cd2205e0daeff = \x_0 -> hs_bindgen_085cd2205e0daeff_base (toFFIType x_0)
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_unsafe :: Ptr (Elem (IncompleteArray CInt)) -> IO ()
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_unsafe = hs_bindgen_085cd2205e0daeff
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args2@
+foreign import ccall unsafe "hs_bindgen_0df3319af542c072" hs_bindgen_0df3319af542c072_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args2@
+hs_bindgen_0df3319af542c072 :: Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args2@
+hs_bindgen_0df3319af542c072 = \x_0 -> hs_bindgen_0df3319af542c072_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_unsafe :: Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                    IO ()
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_unsafe = hs_bindgen_0df3319af542c072
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args3@
+foreign import ccall unsafe "hs_bindgen_4839d1f4a2742c03" hs_bindgen_4839d1f4a2742c03_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args3@
+hs_bindgen_4839d1f4a2742c03 :: Ptr (Elem (ConstantArray 5 CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args3@
+hs_bindgen_4839d1f4a2742c03 = \x_0 -> hs_bindgen_4839d1f4a2742c03_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_unsafe :: Ptr (Elem (ConstantArray 5 CInt)) -> IO ()
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_unsafe = hs_bindgen_4839d1f4a2742c03
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args4@
+foreign import ccall unsafe "hs_bindgen_c7e68dd8759c969a" hs_bindgen_c7e68dd8759c969a_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args4@
+hs_bindgen_c7e68dd8759c969a :: Ptr (Elem (ConstantArray 5
+                                                        (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_arr_args4@
+hs_bindgen_c7e68dd8759c969a = \x_0 -> hs_bindgen_c7e68dd8759c969a_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_unsafe :: Ptr (Elem (ConstantArray 5 (Ptr CInt))) ->
+                    IO ()
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_unsafe = hs_bindgen_c7e68dd8759c969a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_bf24f137d6217c14" hs_bindgen_bf24f137d6217c14_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args1@
+hs_bindgen_bf24f137d6217c14 :: CInt -> FunPtr (IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args1@
+hs_bindgen_bf24f137d6217c14 = \x_0 -> \x_1 -> hs_bindgen_bf24f137d6217c14_base (toFFIType x_0) (toFFIType x_1)
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_unsafe :: CInt -> FunPtr (IO ()) -> IO ()
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_unsafe = hs_bindgen_bf24f137d6217c14
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_2b6cd604640b023f" hs_bindgen_2b6cd604640b023f_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args2@
+hs_bindgen_2b6cd604640b023f :: CInt -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args2@
+hs_bindgen_2b6cd604640b023f = \x_0 -> \x_1 -> hs_bindgen_2b6cd604640b023f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_unsafe :: CInt -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_unsafe = hs_bindgen_2b6cd604640b023f
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_9c35d7346db373f0" hs_bindgen_9c35d7346db373f0_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args3@
+hs_bindgen_9c35d7346db373f0 :: CInt ->
+                               FunPtr (CInt -> IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args3@
+hs_bindgen_9c35d7346db373f0 = \x_0 -> \x_1 -> hs_bindgen_9c35d7346db373f0_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_unsafe :: CInt -> FunPtr (CInt -> IO ()) -> IO ()
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_unsafe = hs_bindgen_9c35d7346db373f0
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_60245cd22b3cd59b" hs_bindgen_60245cd22b3cd59b_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args4@
+hs_bindgen_60245cd22b3cd59b :: CInt ->
+                               FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args4@
+hs_bindgen_60245cd22b3cd59b = \x_0 -> \x_1 -> hs_bindgen_60245cd22b3cd59b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_unsafe :: CInt ->
+                       FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_unsafe = hs_bindgen_60245cd22b3cd59b
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_bcd5e0817da0463b" hs_bindgen_bcd5e0817da0463b_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args5@
+hs_bindgen_bcd5e0817da0463b :: CInt ->
+                               FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_args5@
+hs_bindgen_bcd5e0817da0463b = \x_0 -> \x_1 -> hs_bindgen_bcd5e0817da0463b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_unsafe :: CInt ->
+                       FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_unsafe = hs_bindgen_bcd5e0817da0463b
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_comments1@
+foreign import ccall unsafe "hs_bindgen_fd3d542dfefd036e" hs_bindgen_fd3d542dfefd036e_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_comments1@
+hs_bindgen_fd3d542dfefd036e :: CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_comments1@
+hs_bindgen_fd3d542dfefd036e = \x_0 -> hs_bindgen_fd3d542dfefd036e_base (toFFIType x_0)
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_unsafe :: CInt -> IO ()
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_unsafe = hs_bindgen_fd3d542dfefd036e
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_0819c4409f0cb04f" hs_bindgen_0819c4409f0cb04f_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before1@
+hs_bindgen_0819c4409f0cb04f :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before1@
+hs_bindgen_0819c4409f0cb04f = \x_0 -> \x_1 -> hs_bindgen_0819c4409f0cb04f_base (toFFIType x_0) (toFFIType x_1)
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_unsafe :: CInt -> CChar -> IO ()
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_unsafe = hs_bindgen_0819c4409f0cb04f
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_d31ae17d88140355" hs_bindgen_d31ae17d88140355_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before2@
+hs_bindgen_d31ae17d88140355 :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before2@
+hs_bindgen_d31ae17d88140355 = \x_0 -> \x_1 -> hs_bindgen_d31ae17d88140355_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_unsafe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_unsafe = hs_bindgen_d31ae17d88140355
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_f0ed5f637cefe96f" hs_bindgen_f0ed5f637cefe96f_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before3@
+hs_bindgen_f0ed5f637cefe96f :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_before3@
+hs_bindgen_f0ed5f637cefe96f = \x_0 -> \x_1 -> hs_bindgen_f0ed5f637cefe96f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_unsafe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_unsafe = hs_bindgen_f0ed5f637cefe96f
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_0215a515d1fa3dfa" hs_bindgen_0215a515d1fa3dfa_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after1@
+hs_bindgen_0215a515d1fa3dfa :: CInt -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after1@
+hs_bindgen_0215a515d1fa3dfa = \x_0 -> \x_1 -> hs_bindgen_0215a515d1fa3dfa_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_unsafe :: CInt -> CChar -> IO ()
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_unsafe = hs_bindgen_0215a515d1fa3dfa
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_e103c029e3630b33" hs_bindgen_e103c029e3630b33_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after2@
+hs_bindgen_e103c029e3630b33 :: CInt -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after2@
+hs_bindgen_e103c029e3630b33 = \x_0 -> \x_1 -> hs_bindgen_e103c029e3630b33_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_unsafe :: CInt -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_unsafe = hs_bindgen_e103c029e3630b33
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_bef8a67258cb736b" hs_bindgen_bef8a67258cb736b_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after3@
+hs_bindgen_bef8a67258cb736b :: CInt -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_prim_after3@
+hs_bindgen_bef8a67258cb736b = \x_0 -> \x_1 -> hs_bindgen_bef8a67258cb736b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_unsafe :: CInt -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_unsafe = hs_bindgen_bef8a67258cb736b
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_589e465944877183" hs_bindgen_589e465944877183_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before1@
+hs_bindgen_589e465944877183 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before1@
+hs_bindgen_589e465944877183 = \x_0 -> \x_1 -> hs_bindgen_589e465944877183_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_unsafe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_unsafe = hs_bindgen_589e465944877183
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_fef23ca0f7241d44" hs_bindgen_fef23ca0f7241d44_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before2@
+hs_bindgen_fef23ca0f7241d44 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before2@
+hs_bindgen_fef23ca0f7241d44 = \x_0 -> \x_1 -> hs_bindgen_fef23ca0f7241d44_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_unsafe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_unsafe = hs_bindgen_fef23ca0f7241d44
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_12ed6589e368a6d9" hs_bindgen_12ed6589e368a6d9_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before3@
+hs_bindgen_12ed6589e368a6d9 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before3@
+hs_bindgen_12ed6589e368a6d9 = \x_0 -> \x_1 -> hs_bindgen_12ed6589e368a6d9_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_unsafe = hs_bindgen_12ed6589e368a6d9
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_acfc6cbb94266577" hs_bindgen_acfc6cbb94266577_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before4@
+hs_bindgen_acfc6cbb94266577 :: CInt ->
+                               PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before4@
+hs_bindgen_acfc6cbb94266577 = \x_0 -> \x_1 -> hs_bindgen_acfc6cbb94266577_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_unsafe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_acfc6cbb94266577 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_e452087578f98911" hs_bindgen_e452087578f98911_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before5@
+hs_bindgen_e452087578f98911 :: CInt -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before5@
+hs_bindgen_e452087578f98911 = \x_0 -> \x_1 -> hs_bindgen_e452087578f98911_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_unsafe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_e452087578f98911 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_a943f6ee50043676" hs_bindgen_a943f6ee50043676_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before6@
+hs_bindgen_a943f6ee50043676 :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before6@
+hs_bindgen_a943f6ee50043676 = \x_0 -> \x_1 -> hs_bindgen_a943f6ee50043676_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_unsafe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_unsafe = hs_bindgen_a943f6ee50043676
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_425f71a0e411bca9" hs_bindgen_425f71a0e411bca9_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before7@
+hs_bindgen_425f71a0e411bca9 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before7@
+hs_bindgen_425f71a0e411bca9 = \x_0 -> \x_1 -> hs_bindgen_425f71a0e411bca9_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_unsafe = hs_bindgen_425f71a0e411bca9
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_297d1f2aa423722a" hs_bindgen_297d1f2aa423722a_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before8@
+hs_bindgen_297d1f2aa423722a :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_before8@
+hs_bindgen_297d1f2aa423722a = \x_0 -> \x_1 -> hs_bindgen_297d1f2aa423722a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_unsafe :: CInt ->
+                                    HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_unsafe = hs_bindgen_297d1f2aa423722a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_136c1c8ee6a77c65" hs_bindgen_136c1c8ee6a77c65_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after1@
+hs_bindgen_136c1c8ee6a77c65 :: CInt -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after1@
+hs_bindgen_136c1c8ee6a77c65 = \x_0 -> \x_1 -> hs_bindgen_136c1c8ee6a77c65_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_unsafe :: CInt -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_unsafe = hs_bindgen_136c1c8ee6a77c65
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_876526a42ba48417" hs_bindgen_876526a42ba48417_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after2@
+hs_bindgen_876526a42ba48417 :: CInt -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after2@
+hs_bindgen_876526a42ba48417 = \x_0 -> \x_1 -> hs_bindgen_876526a42ba48417_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_unsafe :: CInt -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_unsafe = hs_bindgen_876526a42ba48417
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_b309fa8d82dd7b72" hs_bindgen_b309fa8d82dd7b72_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after3@
+hs_bindgen_b309fa8d82dd7b72 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after3@
+hs_bindgen_b309fa8d82dd7b72 = \x_0 -> \x_1 -> hs_bindgen_b309fa8d82dd7b72_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_unsafe = hs_bindgen_b309fa8d82dd7b72
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_b7b3fe289c724859" hs_bindgen_b7b3fe289c724859_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after4@
+hs_bindgen_b7b3fe289c724859 :: CInt ->
+                               PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after4@
+hs_bindgen_b7b3fe289c724859 = \x_0 -> \x_1 -> hs_bindgen_b7b3fe289c724859_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_unsafe :: CInt -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_b7b3fe289c724859 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_55b1796019967748" hs_bindgen_55b1796019967748_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after5@
+hs_bindgen_55b1796019967748 :: CInt -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after5@
+hs_bindgen_55b1796019967748 = \x_0 -> \x_1 -> hs_bindgen_55b1796019967748_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_unsafe :: CInt -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_55b1796019967748 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_b10d1e8f7c40c632" hs_bindgen_b10d1e8f7c40c632_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after6@
+hs_bindgen_b10d1e8f7c40c632 :: CInt -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after6@
+hs_bindgen_b10d1e8f7c40c632 = \x_0 -> \x_1 -> hs_bindgen_b10d1e8f7c40c632_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_unsafe :: CInt -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_unsafe = hs_bindgen_b10d1e8f7c40c632
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_04406c6b24b54172" hs_bindgen_04406c6b24b54172_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after7@
+hs_bindgen_04406c6b24b54172 :: CInt -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after7@
+hs_bindgen_04406c6b24b54172 = \x_0 -> \x_1 -> hs_bindgen_04406c6b24b54172_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_unsafe :: CInt -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_unsafe = hs_bindgen_04406c6b24b54172
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_ae945fd854416c29" hs_bindgen_ae945fd854416c29_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after8@
+hs_bindgen_ae945fd854416c29 :: CInt ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_withoutSign_after8@
+hs_bindgen_ae945fd854416c29 = \x_0 -> \x_1 -> hs_bindgen_ae945fd854416c29_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_unsafe :: CInt ->
+                                   HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_unsafe = hs_bindgen_ae945fd854416c29
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_315fb7a4e52f51bb" hs_bindgen_315fb7a4e52f51bb_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args1@
+hs_bindgen_315fb7a4e52f51bb :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args1@
+hs_bindgen_315fb7a4e52f51bb = \x_0 -> \x_1 -> hs_bindgen_315fb7a4e52f51bb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_unsafe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_unsafe = hs_bindgen_315fb7a4e52f51bb
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_c8fe0d37027b1cbd" hs_bindgen_c8fe0d37027b1cbd_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args2@
+hs_bindgen_c8fe0d37027b1cbd :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args2@
+hs_bindgen_c8fe0d37027b1cbd = \x_0 -> \x_1 -> hs_bindgen_c8fe0d37027b1cbd_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_unsafe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_unsafe = hs_bindgen_c8fe0d37027b1cbd
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_585e1489b3f5af58" hs_bindgen_585e1489b3f5af58_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args3@
+hs_bindgen_585e1489b3f5af58 :: CInt -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args3@
+hs_bindgen_585e1489b3f5af58 = \x_0 -> \x_1 -> hs_bindgen_585e1489b3f5af58_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_unsafe :: CInt -> Ptr CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_unsafe = hs_bindgen_585e1489b3f5af58
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_b9568a159c32cefc" hs_bindgen_b9568a159c32cefc_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args4@
+hs_bindgen_b9568a159c32cefc :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args4@
+hs_bindgen_b9568a159c32cefc = \x_0 -> \x_1 -> hs_bindgen_b9568a159c32cefc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_unsafe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_unsafe = hs_bindgen_b9568a159c32cefc
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_85f146afc2a27268" hs_bindgen_85f146afc2a27268_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args5@
+hs_bindgen_85f146afc2a27268 :: CInt -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_args5@
+hs_bindgen_85f146afc2a27268 = \x_0 -> \x_1 -> hs_bindgen_85f146afc2a27268_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_unsafe :: CInt -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_unsafe = hs_bindgen_85f146afc2a27268
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_ea6a7e1d0274f90d" hs_bindgen_ea6a7e1d0274f90d_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret1@
+hs_bindgen_ea6a7e1d0274f90d :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret1@
+hs_bindgen_ea6a7e1d0274f90d = \x_0 -> fmap fromFFIType (hs_bindgen_ea6a7e1d0274f90d_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_unsafe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_unsafe = hs_bindgen_ea6a7e1d0274f90d
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_ae320a2e858ccc98" hs_bindgen_ae320a2e858ccc98_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret2@
+hs_bindgen_ae320a2e858ccc98 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret2@
+hs_bindgen_ae320a2e858ccc98 = \x_0 -> fmap fromFFIType (hs_bindgen_ae320a2e858ccc98_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_unsafe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_unsafe = hs_bindgen_ae320a2e858ccc98
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_3ca6c6656d62db21" hs_bindgen_3ca6c6656d62db21_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret3@
+hs_bindgen_3ca6c6656d62db21 :: CInt -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret3@
+hs_bindgen_3ca6c6656d62db21 = \x_0 -> fmap fromFFIType (hs_bindgen_3ca6c6656d62db21_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_unsafe :: CInt -> IO (Ptr CInt)
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_unsafe = hs_bindgen_3ca6c6656d62db21
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_83d0056641627b70" hs_bindgen_83d0056641627b70_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret4@
+hs_bindgen_83d0056641627b70 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret4@
+hs_bindgen_83d0056641627b70 = \x_0 -> fmap fromFFIType (hs_bindgen_83d0056641627b70_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_unsafe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_unsafe = hs_bindgen_83d0056641627b70
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_89f54f00e5f1ec61" hs_bindgen_89f54f00e5f1ec61_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret5@
+hs_bindgen_89f54f00e5f1ec61 :: CInt -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_pointers_ret5@
+hs_bindgen_89f54f00e5f1ec61 = \x_0 -> fmap fromFFIType (hs_bindgen_89f54f00e5f1ec61_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_unsafe :: CInt -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_unsafe = hs_bindgen_89f54f00e5f1ec61
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_445aea27fa0b55be" hs_bindgen_445aea27fa0b55be_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem1@
+hs_bindgen_445aea27fa0b55be :: PtrConst (Elem (IncompleteArray CInt)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem1@
+hs_bindgen_445aea27fa0b55be = \x_0 -> hs_bindgen_445aea27fa0b55be_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_unsafe :: PtrConst (Elem (IncompleteArray CInt)) ->
+                            IO ()
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_unsafe = hs_bindgen_445aea27fa0b55be
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_2f9fd49dce178c29" hs_bindgen_2f9fd49dce178c29_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem2@
+hs_bindgen_2f9fd49dce178c29 :: Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem2@
+hs_bindgen_2f9fd49dce178c29 = \x_0 -> hs_bindgen_2f9fd49dce178c29_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_unsafe :: Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                            IO ()
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_unsafe = hs_bindgen_2f9fd49dce178c29
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_99716bef732a1af1" hs_bindgen_99716bef732a1af1_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem3@
+hs_bindgen_99716bef732a1af1 :: PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_const_array_elem3@
+hs_bindgen_99716bef732a1af1 = \x_0 -> hs_bindgen_99716bef732a1af1_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_unsafe :: PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                            IO ()
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_unsafe = hs_bindgen_99716bef732a1af1
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams1@
+foreign import ccall unsafe "hs_bindgen_1721fcf9bca3ea61" hs_bindgen_1721fcf9bca3ea61_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams1@
+hs_bindgen_1721fcf9bca3ea61 :: IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams1@
+hs_bindgen_1721fcf9bca3ea61 = fmap fromFFIType hs_bindgen_1721fcf9bca3ea61_base
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_unsafe :: IO CInt
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_unsafe = hs_bindgen_1721fcf9bca3ea61
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams2@
+foreign import ccall unsafe "hs_bindgen_95fe913b1eec4f4e" hs_bindgen_95fe913b1eec4f4e_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams2@
+hs_bindgen_95fe913b1eec4f4e :: IO CInt
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams2@
+hs_bindgen_95fe913b1eec4f4e = fmap fromFFIType hs_bindgen_95fe913b1eec4f4e_base
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_unsafe :: IO CInt
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_unsafe = hs_bindgen_95fe913b1eec4f4e
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams3@
+foreign import ccall unsafe "hs_bindgen_d15b46c7c30f29ac" hs_bindgen_d15b46c7c30f29ac_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams3@
+hs_bindgen_d15b46c7c30f29ac :: CInt -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_noParams3@
+hs_bindgen_d15b46c7c30f29ac = \x_0 -> \x_1 -> hs_bindgen_d15b46c7c30f29ac_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_unsafe :: CInt -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_unsafe = hs_bindgen_d15b46c7c30f29ac
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_fe09e75d56f9869e" hs_bindgen_fe09e75d56f9869e_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret1@
+hs_bindgen_fe09e75d56f9869e :: CInt -> IO (FunPtr (IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret1@
+hs_bindgen_fe09e75d56f9869e = \x_0 -> fmap fromFFIType (hs_bindgen_fe09e75d56f9869e_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_unsafe :: CInt -> IO (FunPtr (IO ()))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_unsafe = hs_bindgen_fe09e75d56f9869e
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_7f6cbcd68ce4b354" hs_bindgen_7f6cbcd68ce4b354_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret2@
+hs_bindgen_7f6cbcd68ce4b354 :: CInt -> IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret2@
+hs_bindgen_7f6cbcd68ce4b354 = \x_0 -> fmap fromFFIType (hs_bindgen_7f6cbcd68ce4b354_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_unsafe :: CInt -> IO (FunPtr (IO CInt))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_unsafe = hs_bindgen_7f6cbcd68ce4b354
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_1bcf333c8e82d009" hs_bindgen_1bcf333c8e82d009_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret3@
+hs_bindgen_1bcf333c8e82d009 :: CInt -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret3@
+hs_bindgen_1bcf333c8e82d009 = \x_0 -> fmap fromFFIType (hs_bindgen_1bcf333c8e82d009_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_unsafe :: CInt -> IO (FunPtr (CInt -> IO ()))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_unsafe = hs_bindgen_1bcf333c8e82d009
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_4793bc049c8510a4" hs_bindgen_4793bc049c8510a4_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret4@
+hs_bindgen_4793bc049c8510a4 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO CChar))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret4@
+hs_bindgen_4793bc049c8510a4 = \x_0 -> fmap fromFFIType (hs_bindgen_4793bc049c8510a4_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO CChar))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_unsafe = hs_bindgen_4793bc049c8510a4
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_abb2d85efd4fcb3e" hs_bindgen_abb2d85efd4fcb3e_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret5@
+hs_bindgen_abb2d85efd4fcb3e :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret5@
+hs_bindgen_abb2d85efd4fcb3e = \x_0 -> fmap fromFFIType (hs_bindgen_abb2d85efd4fcb3e_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_unsafe = hs_bindgen_abb2d85efd4fcb3e
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_6cf3159cf7618393" hs_bindgen_6cf3159cf7618393_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret6@
+hs_bindgen_6cf3159cf7618393 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret6@
+hs_bindgen_6cf3159cf7618393 = \x_0 -> fmap fromFFIType (hs_bindgen_6cf3159cf7618393_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_unsafe = hs_bindgen_6cf3159cf7618393
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_ae99f146e73b6c1a" hs_bindgen_ae99f146e73b6c1a_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret7@
+hs_bindgen_ae99f146e73b6c1a :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret7@
+hs_bindgen_ae99f146e73b6c1a = \x_0 -> fmap fromFFIType (hs_bindgen_ae99f146e73b6c1a_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_unsafe = hs_bindgen_ae99f146e73b6c1a
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_5ac0a15c42b191c7" hs_bindgen_5ac0a15c42b191c7_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret8@
+hs_bindgen_5ac0a15c42b191c7 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret8@
+hs_bindgen_5ac0a15c42b191c7 = \x_0 -> fmap fromFFIType (hs_bindgen_5ac0a15c42b191c7_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_unsafe = hs_bindgen_5ac0a15c42b191c7
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_0dbef4dde3b3d205" hs_bindgen_0dbef4dde3b3d205_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret9@
+hs_bindgen_0dbef4dde3b3d205 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret9@
+hs_bindgen_0dbef4dde3b3d205 = \x_0 -> fmap fromFFIType (hs_bindgen_0dbef4dde3b3d205_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_unsafe :: CInt ->
+                      IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_unsafe = hs_bindgen_0dbef4dde3b3d205
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_c226f0b9bbf08c49" hs_bindgen_c226f0b9bbf08c49_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret10@
+hs_bindgen_c226f0b9bbf08c49 :: CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_Unsafe_funptr_ret10@
+hs_bindgen_c226f0b9bbf08c49 = \x_0 -> fmap fromFFIType (hs_bindgen_c226f0b9bbf08c49_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_unsafe :: CInt ->
+                       IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_unsafe = hs_bindgen_c226f0b9bbf08c49
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char1@
+foreign import ccall unsafe "hs_bindgen_30055b4cfdb7a3e2" hs_bindgen_30055b4cfdb7a3e2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char1@
+hs_bindgen_30055b4cfdb7a3e2 :: IO (FunPtr (CInt -> CChar -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char1@
+hs_bindgen_30055b4cfdb7a3e2 = fmap fromFFIType hs_bindgen_30055b4cfdb7a3e2_base
+{-# NOINLINE args_char1_funptr #-}
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_funptr :: FunPtr (CInt -> CChar -> IO ())
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_funptr = unsafePerformIO hs_bindgen_30055b4cfdb7a3e2
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char2@
+foreign import ccall unsafe "hs_bindgen_44f283f141f81fc4" hs_bindgen_44f283f141f81fc4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char2@
+hs_bindgen_44f283f141f81fc4 :: IO (FunPtr (CInt ->
+                                           CSChar -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char2@
+hs_bindgen_44f283f141f81fc4 = fmap fromFFIType hs_bindgen_44f283f141f81fc4_base
+{-# NOINLINE args_char2_funptr #-}
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_funptr :: FunPtr (CInt -> CSChar -> IO ())
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_funptr = unsafePerformIO hs_bindgen_44f283f141f81fc4
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char3@
+foreign import ccall unsafe "hs_bindgen_27b5bf56bbc8f080" hs_bindgen_27b5bf56bbc8f080_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char3@
+hs_bindgen_27b5bf56bbc8f080 :: IO (FunPtr (CInt ->
+                                           CUChar -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_char3@
+hs_bindgen_27b5bf56bbc8f080 = fmap fromFFIType hs_bindgen_27b5bf56bbc8f080_base
+{-# NOINLINE args_char3_funptr #-}
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_funptr :: FunPtr (CInt -> CUChar -> IO ())
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_funptr = unsafePerformIO hs_bindgen_27b5bf56bbc8f080
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short1@
+foreign import ccall unsafe "hs_bindgen_985bed578f09aef8" hs_bindgen_985bed578f09aef8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short1@
+hs_bindgen_985bed578f09aef8 :: IO (FunPtr (CInt ->
+                                           CShort -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short1@
+hs_bindgen_985bed578f09aef8 = fmap fromFFIType hs_bindgen_985bed578f09aef8_base
+{-# NOINLINE args_short1_funptr #-}
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_funptr :: FunPtr (CInt -> CShort -> IO ())
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_funptr = unsafePerformIO hs_bindgen_985bed578f09aef8
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short2@
+foreign import ccall unsafe "hs_bindgen_4213a6df8d0c03f1" hs_bindgen_4213a6df8d0c03f1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short2@
+hs_bindgen_4213a6df8d0c03f1 :: IO (FunPtr (CInt ->
+                                           CShort -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short2@
+hs_bindgen_4213a6df8d0c03f1 = fmap fromFFIType hs_bindgen_4213a6df8d0c03f1_base
+{-# NOINLINE args_short2_funptr #-}
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_funptr :: FunPtr (CInt -> CShort -> IO ())
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_funptr = unsafePerformIO hs_bindgen_4213a6df8d0c03f1
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short3@
+foreign import ccall unsafe "hs_bindgen_82e313aaa763196f" hs_bindgen_82e313aaa763196f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short3@
+hs_bindgen_82e313aaa763196f :: IO (FunPtr (CInt ->
+                                           CUShort -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_short3@
+hs_bindgen_82e313aaa763196f = fmap fromFFIType hs_bindgen_82e313aaa763196f_base
+{-# NOINLINE args_short3_funptr #-}
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_funptr :: FunPtr (CInt -> CUShort -> IO ())
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_funptr = unsafePerformIO hs_bindgen_82e313aaa763196f
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int1@
+foreign import ccall unsafe "hs_bindgen_605e1f38f823a881" hs_bindgen_605e1f38f823a881_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int1@
+hs_bindgen_605e1f38f823a881 :: IO (FunPtr (CInt -> CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int1@
+hs_bindgen_605e1f38f823a881 = fmap fromFFIType hs_bindgen_605e1f38f823a881_base
+{-# NOINLINE args_int1_funptr #-}
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_funptr :: FunPtr (CInt -> CInt -> IO ())
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_funptr = unsafePerformIO hs_bindgen_605e1f38f823a881
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int2@
+foreign import ccall unsafe "hs_bindgen_3b8afc742e92814e" hs_bindgen_3b8afc742e92814e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int2@
+hs_bindgen_3b8afc742e92814e :: IO (FunPtr (CInt -> CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int2@
+hs_bindgen_3b8afc742e92814e = fmap fromFFIType hs_bindgen_3b8afc742e92814e_base
+{-# NOINLINE args_int2_funptr #-}
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_funptr :: FunPtr (CInt -> CInt -> IO ())
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_funptr = unsafePerformIO hs_bindgen_3b8afc742e92814e
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int3@
+foreign import ccall unsafe "hs_bindgen_bf10dc64323b0995" hs_bindgen_bf10dc64323b0995_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int3@
+hs_bindgen_bf10dc64323b0995 :: IO (FunPtr (CInt -> CUInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_int3@
+hs_bindgen_bf10dc64323b0995 = fmap fromFFIType hs_bindgen_bf10dc64323b0995_base
+{-# NOINLINE args_int3_funptr #-}
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_funptr :: FunPtr (CInt -> CUInt -> IO ())
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_funptr = unsafePerformIO hs_bindgen_bf10dc64323b0995
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long1@
+foreign import ccall unsafe "hs_bindgen_dae65ec08c1d514e" hs_bindgen_dae65ec08c1d514e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long1@
+hs_bindgen_dae65ec08c1d514e :: IO (FunPtr (CInt -> CLong -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long1@
+hs_bindgen_dae65ec08c1d514e = fmap fromFFIType hs_bindgen_dae65ec08c1d514e_base
+{-# NOINLINE args_long1_funptr #-}
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_funptr :: FunPtr (CInt -> CLong -> IO ())
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_funptr = unsafePerformIO hs_bindgen_dae65ec08c1d514e
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long2@
+foreign import ccall unsafe "hs_bindgen_e83db9fe9e4243df" hs_bindgen_e83db9fe9e4243df_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long2@
+hs_bindgen_e83db9fe9e4243df :: IO (FunPtr (CInt -> CLong -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long2@
+hs_bindgen_e83db9fe9e4243df = fmap fromFFIType hs_bindgen_e83db9fe9e4243df_base
+{-# NOINLINE args_long2_funptr #-}
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_funptr :: FunPtr (CInt -> CLong -> IO ())
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_funptr = unsafePerformIO hs_bindgen_e83db9fe9e4243df
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long3@
+foreign import ccall unsafe "hs_bindgen_42d83281e20c0186" hs_bindgen_42d83281e20c0186_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long3@
+hs_bindgen_42d83281e20c0186 :: IO (FunPtr (CInt ->
+                                           CULong -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_long3@
+hs_bindgen_42d83281e20c0186 = fmap fromFFIType hs_bindgen_42d83281e20c0186_base
+{-# NOINLINE args_long3_funptr #-}
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_funptr :: FunPtr (CInt -> CULong -> IO ())
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_funptr = unsafePerformIO hs_bindgen_42d83281e20c0186
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_float@
+foreign import ccall unsafe "hs_bindgen_3b0ba5af6ce01aed" hs_bindgen_3b0ba5af6ce01aed_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_float@
+hs_bindgen_3b0ba5af6ce01aed :: IO (FunPtr (CInt ->
+                                           CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_float@
+hs_bindgen_3b0ba5af6ce01aed = fmap fromFFIType hs_bindgen_3b0ba5af6ce01aed_base
+{-# NOINLINE args_float_funptr #-}
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_funptr :: FunPtr (CInt -> CFloat -> IO ())
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_funptr = unsafePerformIO hs_bindgen_3b0ba5af6ce01aed
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_double@
+foreign import ccall unsafe "hs_bindgen_d14a589fdc8b9407" hs_bindgen_d14a589fdc8b9407_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_double@
+hs_bindgen_d14a589fdc8b9407 :: IO (FunPtr (CInt ->
+                                           CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_double@
+hs_bindgen_d14a589fdc8b9407 = fmap fromFFIType hs_bindgen_d14a589fdc8b9407_base
+{-# NOINLINE args_double_funptr #-}
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_funptr :: FunPtr (CInt -> CDouble -> IO ())
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_funptr = unsafePerformIO hs_bindgen_d14a589fdc8b9407
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_bool1@
+foreign import ccall unsafe "hs_bindgen_a829f5810873021d" hs_bindgen_a829f5810873021d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_bool1@
+hs_bindgen_a829f5810873021d :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_bool1@
+hs_bindgen_a829f5810873021d = fmap fromFFIType hs_bindgen_a829f5810873021d_base
+{-# NOINLINE args_bool1_funptr #-}
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_funptr = unsafePerformIO hs_bindgen_a829f5810873021d
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_struct@
+foreign import ccall unsafe "hs_bindgen_243cc2e9d0181102" hs_bindgen_243cc2e9d0181102_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_struct@
+hs_bindgen_243cc2e9d0181102 :: IO (FunPtr (CInt ->
+                                           Some_struct -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_struct@
+hs_bindgen_243cc2e9d0181102 = fmap fromFFIType hs_bindgen_243cc2e9d0181102_base
+{-# NOINLINE args_struct_funptr #-}
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_funptr :: FunPtr (CInt -> Some_struct -> IO ())
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_funptr = unsafePerformIO hs_bindgen_243cc2e9d0181102
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_union@
+foreign import ccall unsafe "hs_bindgen_b3e0ceada39fdc01" hs_bindgen_b3e0ceada39fdc01_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_union@
+hs_bindgen_b3e0ceada39fdc01 :: IO (FunPtr (CInt ->
+                                           Some_union -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_union@
+hs_bindgen_b3e0ceada39fdc01 = fmap fromFFIType hs_bindgen_b3e0ceada39fdc01_base
+{-# NOINLINE args_union_funptr #-}
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_funptr :: FunPtr (CInt -> Some_union -> IO ())
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_funptr = unsafePerformIO hs_bindgen_b3e0ceada39fdc01
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_enum@
+foreign import ccall unsafe "hs_bindgen_d11159ff99847117" hs_bindgen_d11159ff99847117_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_enum@
+hs_bindgen_d11159ff99847117 :: IO (FunPtr (CInt ->
+                                           Some_enum -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_enum@
+hs_bindgen_d11159ff99847117 = fmap fromFFIType hs_bindgen_d11159ff99847117_base
+{-# NOINLINE args_enum_funptr #-}
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_funptr :: FunPtr (CInt -> Some_enum -> IO ())
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_funptr = unsafePerformIO hs_bindgen_d11159ff99847117
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_f3c28cbcc1bc9d17" hs_bindgen_f3c28cbcc1bc9d17_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer1@
+hs_bindgen_f3c28cbcc1bc9d17 :: IO (FunPtr (CInt ->
+                                           Ptr CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer1@
+hs_bindgen_f3c28cbcc1bc9d17 = fmap fromFFIType hs_bindgen_f3c28cbcc1bc9d17_base
+{-# NOINLINE args_pointer1_funptr #-}
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_funptr :: FunPtr (CInt -> Ptr CInt -> IO ())
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_funptr = unsafePerformIO hs_bindgen_f3c28cbcc1bc9d17
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_190bfc6a0f4bff4f" hs_bindgen_190bfc6a0f4bff4f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer2@
+hs_bindgen_190bfc6a0f4bff4f :: IO (FunPtr (CInt ->
+                                           Ptr (Ptr CInt) -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer2@
+hs_bindgen_190bfc6a0f4bff4f = fmap fromFFIType hs_bindgen_190bfc6a0f4bff4f_base
+{-# NOINLINE args_pointer2_funptr #-}
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_funptr :: FunPtr (CInt -> Ptr (Ptr CInt) -> IO ())
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_funptr = unsafePerformIO hs_bindgen_190bfc6a0f4bff4f
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_26b1c20d174e45d5" hs_bindgen_26b1c20d174e45d5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer3@
+hs_bindgen_26b1c20d174e45d5 :: IO (FunPtr (CInt ->
+                                           Ptr Void -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_pointer3@
+hs_bindgen_26b1c20d174e45d5 = fmap fromFFIType hs_bindgen_26b1c20d174e45d5_base
+{-# NOINLINE args_pointer3_funptr #-}
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_funptr :: FunPtr (CInt -> Ptr Void -> IO ())
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_funptr = unsafePerformIO hs_bindgen_26b1c20d174e45d5
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_A@
+foreign import ccall unsafe "hs_bindgen_8760cbd218bc55d1" hs_bindgen_8760cbd218bc55d1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_A@
+hs_bindgen_8760cbd218bc55d1 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_A@
+hs_bindgen_8760cbd218bc55d1 = fmap fromFFIType hs_bindgen_8760cbd218bc55d1_base
+{-# NOINLINE ret_A_funptr #-}
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_funptr = unsafePerformIO hs_bindgen_8760cbd218bc55d1
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char1@
+foreign import ccall unsafe "hs_bindgen_e910062cffeff2d2" hs_bindgen_e910062cffeff2d2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char1@
+hs_bindgen_e910062cffeff2d2 :: IO (FunPtr (CInt -> IO CChar))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char1@
+hs_bindgen_e910062cffeff2d2 = fmap fromFFIType hs_bindgen_e910062cffeff2d2_base
+{-# NOINLINE ret_char1_funptr #-}
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_funptr :: FunPtr (CInt -> IO CChar)
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_funptr = unsafePerformIO hs_bindgen_e910062cffeff2d2
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char2@
+foreign import ccall unsafe "hs_bindgen_d9218f2ac4ee5a50" hs_bindgen_d9218f2ac4ee5a50_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char2@
+hs_bindgen_d9218f2ac4ee5a50 :: IO (FunPtr (CInt -> IO CSChar))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char2@
+hs_bindgen_d9218f2ac4ee5a50 = fmap fromFFIType hs_bindgen_d9218f2ac4ee5a50_base
+{-# NOINLINE ret_char2_funptr #-}
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_funptr :: FunPtr (CInt -> IO CSChar)
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_funptr = unsafePerformIO hs_bindgen_d9218f2ac4ee5a50
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char3@
+foreign import ccall unsafe "hs_bindgen_7a2d6ef06c7567a1" hs_bindgen_7a2d6ef06c7567a1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char3@
+hs_bindgen_7a2d6ef06c7567a1 :: IO (FunPtr (CInt -> IO CUChar))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_char3@
+hs_bindgen_7a2d6ef06c7567a1 = fmap fromFFIType hs_bindgen_7a2d6ef06c7567a1_base
+{-# NOINLINE ret_char3_funptr #-}
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_funptr :: FunPtr (CInt -> IO CUChar)
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_funptr = unsafePerformIO hs_bindgen_7a2d6ef06c7567a1
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short1@
+foreign import ccall unsafe "hs_bindgen_c715ac00f4ca7f36" hs_bindgen_c715ac00f4ca7f36_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short1@
+hs_bindgen_c715ac00f4ca7f36 :: IO (FunPtr (CInt -> IO CShort))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short1@
+hs_bindgen_c715ac00f4ca7f36 = fmap fromFFIType hs_bindgen_c715ac00f4ca7f36_base
+{-# NOINLINE ret_short1_funptr #-}
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_funptr :: FunPtr (CInt -> IO CShort)
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_funptr = unsafePerformIO hs_bindgen_c715ac00f4ca7f36
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short2@
+foreign import ccall unsafe "hs_bindgen_880f34b16d908c1f" hs_bindgen_880f34b16d908c1f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short2@
+hs_bindgen_880f34b16d908c1f :: IO (FunPtr (CInt -> IO CShort))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short2@
+hs_bindgen_880f34b16d908c1f = fmap fromFFIType hs_bindgen_880f34b16d908c1f_base
+{-# NOINLINE ret_short2_funptr #-}
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_funptr :: FunPtr (CInt -> IO CShort)
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_funptr = unsafePerformIO hs_bindgen_880f34b16d908c1f
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short3@
+foreign import ccall unsafe "hs_bindgen_ea8c8e8164273c1a" hs_bindgen_ea8c8e8164273c1a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short3@
+hs_bindgen_ea8c8e8164273c1a :: IO (FunPtr (CInt -> IO CUShort))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_short3@
+hs_bindgen_ea8c8e8164273c1a = fmap fromFFIType hs_bindgen_ea8c8e8164273c1a_base
+{-# NOINLINE ret_short3_funptr #-}
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_funptr :: FunPtr (CInt -> IO CUShort)
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_funptr = unsafePerformIO hs_bindgen_ea8c8e8164273c1a
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int1@
+foreign import ccall unsafe "hs_bindgen_97a22a914dd2414c" hs_bindgen_97a22a914dd2414c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int1@
+hs_bindgen_97a22a914dd2414c :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int1@
+hs_bindgen_97a22a914dd2414c = fmap fromFFIType hs_bindgen_97a22a914dd2414c_base
+{-# NOINLINE ret_int1_funptr #-}
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_funptr = unsafePerformIO hs_bindgen_97a22a914dd2414c
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int2@
+foreign import ccall unsafe "hs_bindgen_77a2b7921cb7566a" hs_bindgen_77a2b7921cb7566a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int2@
+hs_bindgen_77a2b7921cb7566a :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int2@
+hs_bindgen_77a2b7921cb7566a = fmap fromFFIType hs_bindgen_77a2b7921cb7566a_base
+{-# NOINLINE ret_int2_funptr #-}
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_funptr = unsafePerformIO hs_bindgen_77a2b7921cb7566a
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int3@
+foreign import ccall unsafe "hs_bindgen_0dc8eed9c02e16ff" hs_bindgen_0dc8eed9c02e16ff_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int3@
+hs_bindgen_0dc8eed9c02e16ff :: IO (FunPtr (CInt -> IO CUInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_int3@
+hs_bindgen_0dc8eed9c02e16ff = fmap fromFFIType hs_bindgen_0dc8eed9c02e16ff_base
+{-# NOINLINE ret_int3_funptr #-}
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_funptr :: FunPtr (CInt -> IO CUInt)
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_funptr = unsafePerformIO hs_bindgen_0dc8eed9c02e16ff
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long1@
+foreign import ccall unsafe "hs_bindgen_8a42512fc931fa53" hs_bindgen_8a42512fc931fa53_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long1@
+hs_bindgen_8a42512fc931fa53 :: IO (FunPtr (CInt -> IO CLong))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long1@
+hs_bindgen_8a42512fc931fa53 = fmap fromFFIType hs_bindgen_8a42512fc931fa53_base
+{-# NOINLINE ret_long1_funptr #-}
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_funptr :: FunPtr (CInt -> IO CLong)
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_funptr = unsafePerformIO hs_bindgen_8a42512fc931fa53
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long2@
+foreign import ccall unsafe "hs_bindgen_8293ce652f4875b7" hs_bindgen_8293ce652f4875b7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long2@
+hs_bindgen_8293ce652f4875b7 :: IO (FunPtr (CInt -> IO CLong))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long2@
+hs_bindgen_8293ce652f4875b7 = fmap fromFFIType hs_bindgen_8293ce652f4875b7_base
+{-# NOINLINE ret_long2_funptr #-}
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_funptr :: FunPtr (CInt -> IO CLong)
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_funptr = unsafePerformIO hs_bindgen_8293ce652f4875b7
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long3@
+foreign import ccall unsafe "hs_bindgen_1ca2d3b54e331b1f" hs_bindgen_1ca2d3b54e331b1f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long3@
+hs_bindgen_1ca2d3b54e331b1f :: IO (FunPtr (CInt -> IO CULong))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_long3@
+hs_bindgen_1ca2d3b54e331b1f = fmap fromFFIType hs_bindgen_1ca2d3b54e331b1f_base
+{-# NOINLINE ret_long3_funptr #-}
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_funptr :: FunPtr (CInt -> IO CULong)
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_funptr = unsafePerformIO hs_bindgen_1ca2d3b54e331b1f
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_float@
+foreign import ccall unsafe "hs_bindgen_5362002da5a787ba" hs_bindgen_5362002da5a787ba_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_float@
+hs_bindgen_5362002da5a787ba :: IO (FunPtr (CInt -> IO CFloat))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_float@
+hs_bindgen_5362002da5a787ba = fmap fromFFIType hs_bindgen_5362002da5a787ba_base
+{-# NOINLINE ret_float_funptr #-}
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_funptr :: FunPtr (CInt -> IO CFloat)
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_funptr = unsafePerformIO hs_bindgen_5362002da5a787ba
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_double@
+foreign import ccall unsafe "hs_bindgen_0ae8c6485107bf6f" hs_bindgen_0ae8c6485107bf6f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_double@
+hs_bindgen_0ae8c6485107bf6f :: IO (FunPtr (CInt -> IO CDouble))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_double@
+hs_bindgen_0ae8c6485107bf6f = fmap fromFFIType hs_bindgen_0ae8c6485107bf6f_base
+{-# NOINLINE ret_double_funptr #-}
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_funptr :: FunPtr (CInt -> IO CDouble)
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_funptr = unsafePerformIO hs_bindgen_0ae8c6485107bf6f
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_04d8f1fc8df996ba" hs_bindgen_04d8f1fc8df996ba_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_bool1@
+hs_bindgen_04d8f1fc8df996ba :: IO (FunPtr (CInt -> IO CBool))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_bool1@
+hs_bindgen_04d8f1fc8df996ba = fmap fromFFIType hs_bindgen_04d8f1fc8df996ba_base
+{-# NOINLINE ret_bool1_funptr #-}
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_funptr :: FunPtr (CInt -> IO CBool)
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_funptr = unsafePerformIO hs_bindgen_04d8f1fc8df996ba
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_struct@
+foreign import ccall unsafe "hs_bindgen_b7cd9769c7dac7b8" hs_bindgen_b7cd9769c7dac7b8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_struct@
+hs_bindgen_b7cd9769c7dac7b8 :: IO (FunPtr (CInt -> IO Some_struct))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_struct@
+hs_bindgen_b7cd9769c7dac7b8 = fmap fromFFIType hs_bindgen_b7cd9769c7dac7b8_base
+{-# NOINLINE ret_struct_funptr #-}
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_funptr :: FunPtr (CInt -> IO Some_struct)
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_funptr = unsafePerformIO hs_bindgen_b7cd9769c7dac7b8
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_union@
+foreign import ccall unsafe "hs_bindgen_b4afde7383e5aff4" hs_bindgen_b4afde7383e5aff4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_union@
+hs_bindgen_b4afde7383e5aff4 :: IO (FunPtr (CInt -> IO Some_union))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_union@
+hs_bindgen_b4afde7383e5aff4 = fmap fromFFIType hs_bindgen_b4afde7383e5aff4_base
+{-# NOINLINE ret_union_funptr #-}
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_funptr :: FunPtr (CInt -> IO Some_union)
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_funptr = unsafePerformIO hs_bindgen_b4afde7383e5aff4
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_enum@
+foreign import ccall unsafe "hs_bindgen_239f0b420c073c18" hs_bindgen_239f0b420c073c18_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_enum@
+hs_bindgen_239f0b420c073c18 :: IO (FunPtr (CInt -> IO Some_enum))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_enum@
+hs_bindgen_239f0b420c073c18 = fmap fromFFIType hs_bindgen_239f0b420c073c18_base
+{-# NOINLINE ret_enum_funptr #-}
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_funptr :: FunPtr (CInt -> IO Some_enum)
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_funptr = unsafePerformIO hs_bindgen_239f0b420c073c18
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_56eab0f8d0bdf79f" hs_bindgen_56eab0f8d0bdf79f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer1@
+hs_bindgen_56eab0f8d0bdf79f :: IO (FunPtr (CInt -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer1@
+hs_bindgen_56eab0f8d0bdf79f = fmap fromFFIType hs_bindgen_56eab0f8d0bdf79f_base
+{-# NOINLINE ret_pointer1_funptr #-}
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_funptr :: FunPtr (CInt -> IO (Ptr CInt))
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_funptr = unsafePerformIO hs_bindgen_56eab0f8d0bdf79f
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_4c952a3d40721870" hs_bindgen_4c952a3d40721870_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer2@
+hs_bindgen_4c952a3d40721870 :: IO (FunPtr (CInt ->
+                                           IO (Ptr (Ptr CInt))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer2@
+hs_bindgen_4c952a3d40721870 = fmap fromFFIType hs_bindgen_4c952a3d40721870_base
+{-# NOINLINE ret_pointer2_funptr #-}
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_funptr :: FunPtr (CInt -> IO (Ptr (Ptr CInt)))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_funptr = unsafePerformIO hs_bindgen_4c952a3d40721870
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_ccb0b4753d3e2490" hs_bindgen_ccb0b4753d3e2490_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer3@
+hs_bindgen_ccb0b4753d3e2490 :: IO (FunPtr (CInt -> IO (Ptr Void)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_pointer3@
+hs_bindgen_ccb0b4753d3e2490 = fmap fromFFIType hs_bindgen_ccb0b4753d3e2490_base
+{-# NOINLINE ret_pointer3_funptr #-}
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_funptr :: FunPtr (CInt -> IO (Ptr Void))
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_funptr = unsafePerformIO hs_bindgen_ccb0b4753d3e2490
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body1@
+foreign import ccall unsafe "hs_bindgen_442c91e88aec2368" hs_bindgen_442c91e88aec2368_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body1@
+hs_bindgen_442c91e88aec2368 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body1@
+hs_bindgen_442c91e88aec2368 = fmap fromFFIType hs_bindgen_442c91e88aec2368_base
+{-# NOINLINE body1_funptr #-}
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_funptr = unsafePerformIO hs_bindgen_442c91e88aec2368
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body2@
+foreign import ccall unsafe "hs_bindgen_cfbec40e47da01c3" hs_bindgen_cfbec40e47da01c3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body2@
+hs_bindgen_cfbec40e47da01c3 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_body2@
+hs_bindgen_cfbec40e47da01c3 = fmap fromFFIType hs_bindgen_cfbec40e47da01c3_base
+{-# NOINLINE body2_funptr #-}
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_funptr = unsafePerformIO hs_bindgen_cfbec40e47da01c3
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_4319227a8aaa0b24" hs_bindgen_4319227a8aaa0b24_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_float@
+hs_bindgen_4319227a8aaa0b24 :: IO (FunPtr (CInt ->
+                                           Complex CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_float@
+hs_bindgen_4319227a8aaa0b24 = fmap fromFFIType hs_bindgen_4319227a8aaa0b24_base
+{-# NOINLINE args_complex_float_funptr #-}
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_funptr :: FunPtr (CInt ->
+                                     Complex CFloat -> IO ())
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_funptr = unsafePerformIO hs_bindgen_4319227a8aaa0b24
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_9620841c151e1094" hs_bindgen_9620841c151e1094_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_double@
+hs_bindgen_9620841c151e1094 :: IO (FunPtr (CInt ->
+                                           Complex CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_args_complex_double@
+hs_bindgen_9620841c151e1094 = fmap fromFFIType hs_bindgen_9620841c151e1094_base
+{-# NOINLINE args_complex_double_funptr #-}
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_funptr :: FunPtr (CInt ->
+                                      Complex CDouble -> IO ())
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_funptr = unsafePerformIO hs_bindgen_9620841c151e1094
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_aa2302691b1dc578" hs_bindgen_aa2302691b1dc578_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_float@
+hs_bindgen_aa2302691b1dc578 :: IO (FunPtr (CInt ->
+                                           IO (Complex CFloat)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_float@
+hs_bindgen_aa2302691b1dc578 = fmap fromFFIType hs_bindgen_aa2302691b1dc578_base
+{-# NOINLINE ret_complex_float_funptr #-}
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_funptr :: FunPtr (CInt -> IO (Complex CFloat))
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_funptr = unsafePerformIO hs_bindgen_aa2302691b1dc578
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_27f2ccb0e11ce3d4" hs_bindgen_27f2ccb0e11ce3d4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_double@
+hs_bindgen_27f2ccb0e11ce3d4 :: IO (FunPtr (CInt ->
+                                           IO (Complex CDouble)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_ret_complex_double@
+hs_bindgen_27f2ccb0e11ce3d4 = fmap fromFFIType hs_bindgen_27f2ccb0e11ce3d4_base
+{-# NOINLINE ret_complex_double_funptr #-}
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_funptr :: FunPtr (CInt -> IO (Complex CDouble))
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_funptr = unsafePerformIO hs_bindgen_27f2ccb0e11ce3d4
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_5f39596c5788b2cf" hs_bindgen_5f39596c5788b2cf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args1@
+hs_bindgen_5f39596c5788b2cf :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args1@
+hs_bindgen_5f39596c5788b2cf = fmap fromFFIType hs_bindgen_5f39596c5788b2cf_base
+{-# NOINLINE bespoke_args1_funptr #-}
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_funptr = unsafePerformIO hs_bindgen_5f39596c5788b2cf
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_6fc3008f0e66bd81" hs_bindgen_6fc3008f0e66bd81_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args2@
+hs_bindgen_6fc3008f0e66bd81 :: IO (FunPtr (CInt ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_args2@
+hs_bindgen_6fc3008f0e66bd81 = fmap fromFFIType hs_bindgen_6fc3008f0e66bd81_base
+{-# NOINLINE bespoke_args2_funptr #-}
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_funptr :: FunPtr (CInt ->
+                                HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_funptr = unsafePerformIO hs_bindgen_6fc3008f0e66bd81
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_02e119349dfc0dc6" hs_bindgen_02e119349dfc0dc6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret1@
+hs_bindgen_02e119349dfc0dc6 :: IO (FunPtr (CInt -> IO CBool))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret1@
+hs_bindgen_02e119349dfc0dc6 = fmap fromFFIType hs_bindgen_02e119349dfc0dc6_base
+{-# NOINLINE bespoke_ret1_funptr #-}
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_funptr :: FunPtr (CInt -> IO CBool)
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_funptr = unsafePerformIO hs_bindgen_02e119349dfc0dc6
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_447b3d2bccfb7ae8" hs_bindgen_447b3d2bccfb7ae8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret2@
+hs_bindgen_447b3d2bccfb7ae8 :: IO (FunPtr (CInt ->
+                                           IO HsBindgen.Runtime.LibC.CSize))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_bespoke_ret2@
+hs_bindgen_447b3d2bccfb7ae8 = fmap fromFFIType hs_bindgen_447b3d2bccfb7ae8_base
+{-# NOINLINE bespoke_ret2_funptr #-}
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_funptr :: FunPtr (CInt ->
+                               IO HsBindgen.Runtime.LibC.CSize)
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_funptr = unsafePerformIO hs_bindgen_447b3d2bccfb7ae8
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args1@
+foreign import ccall unsafe "hs_bindgen_869038d8098a2bf2" hs_bindgen_869038d8098a2bf2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args1@
+hs_bindgen_869038d8098a2bf2 :: IO (FunPtr (Ptr (Elem (IncompleteArray CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args1@
+hs_bindgen_869038d8098a2bf2 = fmap fromFFIType hs_bindgen_869038d8098a2bf2_base
+{-# NOINLINE arr_args1_funptr #-}
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_funptr :: FunPtr (Ptr (Elem (IncompleteArray CInt)) ->
+                            IO ())
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_funptr = unsafePerformIO hs_bindgen_869038d8098a2bf2
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args2@
+foreign import ccall unsafe "hs_bindgen_d97856ae41779071" hs_bindgen_d97856ae41779071_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args2@
+hs_bindgen_d97856ae41779071 :: IO (FunPtr (Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args2@
+hs_bindgen_d97856ae41779071 = fmap fromFFIType hs_bindgen_d97856ae41779071_base
+{-# NOINLINE arr_args2_funptr #-}
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_funptr :: FunPtr (Ptr (Elem (IncompleteArray (Ptr CInt))) ->
+                            IO ())
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_funptr = unsafePerformIO hs_bindgen_d97856ae41779071
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args3@
+foreign import ccall unsafe "hs_bindgen_e5fcdc276e072021" hs_bindgen_e5fcdc276e072021_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args3@
+hs_bindgen_e5fcdc276e072021 :: IO (FunPtr (Ptr (Elem (ConstantArray 5
+                                                                    CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args3@
+hs_bindgen_e5fcdc276e072021 = fmap fromFFIType hs_bindgen_e5fcdc276e072021_base
+{-# NOINLINE arr_args3_funptr #-}
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_funptr :: FunPtr (Ptr (Elem (ConstantArray 5 CInt)) ->
+                            IO ())
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_funptr = unsafePerformIO hs_bindgen_e5fcdc276e072021
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args4@
+foreign import ccall unsafe "hs_bindgen_5960a1a097c40b0b" hs_bindgen_5960a1a097c40b0b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args4@
+hs_bindgen_5960a1a097c40b0b :: IO (FunPtr (Ptr (Elem (ConstantArray 5
+                                                                    (Ptr CInt))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_arr_args4@
+hs_bindgen_5960a1a097c40b0b = fmap fromFFIType hs_bindgen_5960a1a097c40b0b_base
+{-# NOINLINE arr_args4_funptr #-}
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_funptr :: FunPtr (Ptr (Elem (ConstantArray 5
+                                                     (Ptr CInt))) ->
+                            IO ())
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_funptr = unsafePerformIO hs_bindgen_5960a1a097c40b0b
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_6e1c21a20bf17727" hs_bindgen_6e1c21a20bf17727_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args1@
+hs_bindgen_6e1c21a20bf17727 :: IO (FunPtr (CInt ->
+                                           FunPtr (IO ()) -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args1@
+hs_bindgen_6e1c21a20bf17727 = fmap fromFFIType hs_bindgen_6e1c21a20bf17727_base
+{-# NOINLINE funptr_args1_funptr #-}
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_funptr :: FunPtr (CInt -> FunPtr (IO ()) -> IO ())
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_funptr = unsafePerformIO hs_bindgen_6e1c21a20bf17727
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_316b1d39ef1c99c8" hs_bindgen_316b1d39ef1c99c8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args2@
+hs_bindgen_316b1d39ef1c99c8 :: IO (FunPtr (CInt ->
+                                           FunPtr (IO CInt) -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args2@
+hs_bindgen_316b1d39ef1c99c8 = fmap fromFFIType hs_bindgen_316b1d39ef1c99c8_base
+{-# NOINLINE funptr_args2_funptr #-}
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_funptr :: FunPtr (CInt -> FunPtr (IO CInt) -> IO ())
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_funptr = unsafePerformIO hs_bindgen_316b1d39ef1c99c8
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_3b587acc49334022" hs_bindgen_3b587acc49334022_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args3@
+hs_bindgen_3b587acc49334022 :: IO (FunPtr (CInt ->
+                                           FunPtr (CInt -> IO ()) -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args3@
+hs_bindgen_3b587acc49334022 = fmap fromFFIType hs_bindgen_3b587acc49334022_base
+{-# NOINLINE funptr_args3_funptr #-}
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_funptr :: FunPtr (CInt ->
+                               FunPtr (CInt -> IO ()) -> IO ())
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_funptr = unsafePerformIO hs_bindgen_3b587acc49334022
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_880f8ecb89c20f54" hs_bindgen_880f8ecb89c20f54_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args4@
+hs_bindgen_880f8ecb89c20f54 :: IO (FunPtr (CInt ->
+                                           FunPtr (CInt -> CDouble -> IO CChar) -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args4@
+hs_bindgen_880f8ecb89c20f54 = fmap fromFFIType hs_bindgen_880f8ecb89c20f54_base
+{-# NOINLINE funptr_args4_funptr #-}
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_funptr :: FunPtr (CInt ->
+                               FunPtr (CInt -> CDouble -> IO CChar) -> IO ())
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_funptr = unsafePerformIO hs_bindgen_880f8ecb89c20f54
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_25220e78ceba78f8" hs_bindgen_25220e78ceba78f8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args5@
+hs_bindgen_25220e78ceba78f8 :: IO (FunPtr (CInt ->
+                                           FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_args5@
+hs_bindgen_25220e78ceba78f8 = fmap fromFFIType hs_bindgen_25220e78ceba78f8_base
+{-# NOINLINE funptr_args5_funptr #-}
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_funptr :: FunPtr (CInt ->
+                               FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ())
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_funptr = unsafePerformIO hs_bindgen_25220e78ceba78f8
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_comments1@
+foreign import ccall unsafe "hs_bindgen_6cef08508aed5305" hs_bindgen_6cef08508aed5305_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_comments1@
+hs_bindgen_6cef08508aed5305 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_comments1@
+hs_bindgen_6cef08508aed5305 = fmap fromFFIType hs_bindgen_6cef08508aed5305_base
+{-# NOINLINE comments1_funptr #-}
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_funptr :: FunPtr (CInt -> IO ())
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_funptr = unsafePerformIO hs_bindgen_6cef08508aed5305
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_71a50f57cd1216e6" hs_bindgen_71a50f57cd1216e6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before1@
+hs_bindgen_71a50f57cd1216e6 :: IO (FunPtr (CInt -> CChar -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before1@
+hs_bindgen_71a50f57cd1216e6 = fmap fromFFIType hs_bindgen_71a50f57cd1216e6_base
+{-# NOINLINE const_prim_before1_funptr #-}
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_funptr :: FunPtr (CInt -> CChar -> IO ())
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_funptr = unsafePerformIO hs_bindgen_71a50f57cd1216e6
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_5233d49c08278554" hs_bindgen_5233d49c08278554_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before2@
+hs_bindgen_5233d49c08278554 :: IO (FunPtr (CInt ->
+                                           CSChar -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before2@
+hs_bindgen_5233d49c08278554 = fmap fromFFIType hs_bindgen_5233d49c08278554_base
+{-# NOINLINE const_prim_before2_funptr #-}
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_funptr :: FunPtr (CInt -> CSChar -> IO ())
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_funptr = unsafePerformIO hs_bindgen_5233d49c08278554
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_b47263d563e229b2" hs_bindgen_b47263d563e229b2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before3@
+hs_bindgen_b47263d563e229b2 :: IO (FunPtr (CInt ->
+                                           CUChar -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_before3@
+hs_bindgen_b47263d563e229b2 = fmap fromFFIType hs_bindgen_b47263d563e229b2_base
+{-# NOINLINE const_prim_before3_funptr #-}
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_funptr :: FunPtr (CInt -> CUChar -> IO ())
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_funptr = unsafePerformIO hs_bindgen_b47263d563e229b2
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_9b538efe2347a74e" hs_bindgen_9b538efe2347a74e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after1@
+hs_bindgen_9b538efe2347a74e :: IO (FunPtr (CInt -> CChar -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after1@
+hs_bindgen_9b538efe2347a74e = fmap fromFFIType hs_bindgen_9b538efe2347a74e_base
+{-# NOINLINE const_prim_after1_funptr #-}
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_funptr :: FunPtr (CInt -> CChar -> IO ())
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_funptr = unsafePerformIO hs_bindgen_9b538efe2347a74e
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_e9bd30449260d07b" hs_bindgen_e9bd30449260d07b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after2@
+hs_bindgen_e9bd30449260d07b :: IO (FunPtr (CInt ->
+                                           CSChar -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after2@
+hs_bindgen_e9bd30449260d07b = fmap fromFFIType hs_bindgen_e9bd30449260d07b_base
+{-# NOINLINE const_prim_after2_funptr #-}
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_funptr :: FunPtr (CInt -> CSChar -> IO ())
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_funptr = unsafePerformIO hs_bindgen_e9bd30449260d07b
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_f1e92cd065630ccb" hs_bindgen_f1e92cd065630ccb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after3@
+hs_bindgen_f1e92cd065630ccb :: IO (FunPtr (CInt ->
+                                           CUChar -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_prim_after3@
+hs_bindgen_f1e92cd065630ccb = fmap fromFFIType hs_bindgen_f1e92cd065630ccb_base
+{-# NOINLINE const_prim_after3_funptr #-}
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_funptr :: FunPtr (CInt -> CUChar -> IO ())
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_funptr = unsafePerformIO hs_bindgen_f1e92cd065630ccb
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_aea63f55c25fa26d" hs_bindgen_aea63f55c25fa26d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before1@
+hs_bindgen_aea63f55c25fa26d :: IO (FunPtr (CInt ->
+                                           CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before1@
+hs_bindgen_aea63f55c25fa26d = fmap fromFFIType hs_bindgen_aea63f55c25fa26d_base
+{-# NOINLINE const_withoutSign_before1_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_funptr :: FunPtr (CInt ->
+                                            CFloat -> IO ())
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_funptr = unsafePerformIO hs_bindgen_aea63f55c25fa26d
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_1a34eb11a6ccfd86" hs_bindgen_1a34eb11a6ccfd86_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before2@
+hs_bindgen_1a34eb11a6ccfd86 :: IO (FunPtr (CInt ->
+                                           CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before2@
+hs_bindgen_1a34eb11a6ccfd86 = fmap fromFFIType hs_bindgen_1a34eb11a6ccfd86_base
+{-# NOINLINE const_withoutSign_before2_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_funptr :: FunPtr (CInt ->
+                                            CDouble -> IO ())
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_funptr = unsafePerformIO hs_bindgen_1a34eb11a6ccfd86
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_d9af8e3a8991a2e4" hs_bindgen_d9af8e3a8991a2e4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before3@
+hs_bindgen_d9af8e3a8991a2e4 :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before3@
+hs_bindgen_d9af8e3a8991a2e4 = fmap fromFFIType hs_bindgen_d9af8e3a8991a2e4_base
+{-# NOINLINE const_withoutSign_before3_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_funptr = unsafePerformIO hs_bindgen_d9af8e3a8991a2e4
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_558f393b1eddf40d" hs_bindgen_558f393b1eddf40d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before4@
+hs_bindgen_558f393b1eddf40d :: IO (FunPtr (CInt ->
+                                           Some_struct -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before4@
+hs_bindgen_558f393b1eddf40d = fmap fromFFIType hs_bindgen_558f393b1eddf40d_base
+{-# NOINLINE const_withoutSign_before4_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_funptr :: FunPtr (CInt ->
+                                            Some_struct -> IO ())
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_funptr = unsafePerformIO hs_bindgen_558f393b1eddf40d
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_e62c93c0973b2781" hs_bindgen_e62c93c0973b2781_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before5@
+hs_bindgen_e62c93c0973b2781 :: IO (FunPtr (CInt ->
+                                           Some_union -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before5@
+hs_bindgen_e62c93c0973b2781 = fmap fromFFIType hs_bindgen_e62c93c0973b2781_base
+{-# NOINLINE const_withoutSign_before5_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_funptr :: FunPtr (CInt ->
+                                            Some_union -> IO ())
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_funptr = unsafePerformIO hs_bindgen_e62c93c0973b2781
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_e56acb4f339a362d" hs_bindgen_e56acb4f339a362d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before6@
+hs_bindgen_e56acb4f339a362d :: IO (FunPtr (CInt ->
+                                           Some_enum -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before6@
+hs_bindgen_e56acb4f339a362d = fmap fromFFIType hs_bindgen_e56acb4f339a362d_base
+{-# NOINLINE const_withoutSign_before6_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_funptr :: FunPtr (CInt ->
+                                            Some_enum -> IO ())
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_funptr = unsafePerformIO hs_bindgen_e56acb4f339a362d
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_c298f88f131c980b" hs_bindgen_c298f88f131c980b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before7@
+hs_bindgen_c298f88f131c980b :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before7@
+hs_bindgen_c298f88f131c980b = fmap fromFFIType hs_bindgen_c298f88f131c980b_base
+{-# NOINLINE const_withoutSign_before7_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_funptr = unsafePerformIO hs_bindgen_c298f88f131c980b
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_38d5cf2b5d94860c" hs_bindgen_38d5cf2b5d94860c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before8@
+hs_bindgen_38d5cf2b5d94860c :: IO (FunPtr (CInt ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_before8@
+hs_bindgen_38d5cf2b5d94860c = fmap fromFFIType hs_bindgen_38d5cf2b5d94860c_base
+{-# NOINLINE const_withoutSign_before8_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_funptr :: FunPtr (CInt ->
+                                            HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_funptr = unsafePerformIO hs_bindgen_38d5cf2b5d94860c
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_362151a5ba0ce905" hs_bindgen_362151a5ba0ce905_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after1@
+hs_bindgen_362151a5ba0ce905 :: IO (FunPtr (CInt ->
+                                           CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after1@
+hs_bindgen_362151a5ba0ce905 = fmap fromFFIType hs_bindgen_362151a5ba0ce905_base
+{-# NOINLINE const_withoutSign_after1_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_funptr :: FunPtr (CInt -> CFloat -> IO ())
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_funptr = unsafePerformIO hs_bindgen_362151a5ba0ce905
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_071d6b5b46afca86" hs_bindgen_071d6b5b46afca86_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after2@
+hs_bindgen_071d6b5b46afca86 :: IO (FunPtr (CInt ->
+                                           CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after2@
+hs_bindgen_071d6b5b46afca86 = fmap fromFFIType hs_bindgen_071d6b5b46afca86_base
+{-# NOINLINE const_withoutSign_after2_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_funptr :: FunPtr (CInt ->
+                                           CDouble -> IO ())
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_funptr = unsafePerformIO hs_bindgen_071d6b5b46afca86
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_cb70cd180a753e3a" hs_bindgen_cb70cd180a753e3a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after3@
+hs_bindgen_cb70cd180a753e3a :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after3@
+hs_bindgen_cb70cd180a753e3a = fmap fromFFIType hs_bindgen_cb70cd180a753e3a_base
+{-# NOINLINE const_withoutSign_after3_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_funptr = unsafePerformIO hs_bindgen_cb70cd180a753e3a
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_17e67974fc77dde6" hs_bindgen_17e67974fc77dde6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after4@
+hs_bindgen_17e67974fc77dde6 :: IO (FunPtr (CInt ->
+                                           Some_struct -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after4@
+hs_bindgen_17e67974fc77dde6 = fmap fromFFIType hs_bindgen_17e67974fc77dde6_base
+{-# NOINLINE const_withoutSign_after4_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_funptr :: FunPtr (CInt ->
+                                           Some_struct -> IO ())
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_funptr = unsafePerformIO hs_bindgen_17e67974fc77dde6
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_aea1ac49e3a717ae" hs_bindgen_aea1ac49e3a717ae_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after5@
+hs_bindgen_aea1ac49e3a717ae :: IO (FunPtr (CInt ->
+                                           Some_union -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after5@
+hs_bindgen_aea1ac49e3a717ae = fmap fromFFIType hs_bindgen_aea1ac49e3a717ae_base
+{-# NOINLINE const_withoutSign_after5_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_funptr :: FunPtr (CInt ->
+                                           Some_union -> IO ())
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_funptr = unsafePerformIO hs_bindgen_aea1ac49e3a717ae
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_89ad81e6dc3a6ed4" hs_bindgen_89ad81e6dc3a6ed4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after6@
+hs_bindgen_89ad81e6dc3a6ed4 :: IO (FunPtr (CInt ->
+                                           Some_enum -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after6@
+hs_bindgen_89ad81e6dc3a6ed4 = fmap fromFFIType hs_bindgen_89ad81e6dc3a6ed4_base
+{-# NOINLINE const_withoutSign_after6_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_funptr :: FunPtr (CInt ->
+                                           Some_enum -> IO ())
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_funptr = unsafePerformIO hs_bindgen_89ad81e6dc3a6ed4
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_29b119a94317aae6" hs_bindgen_29b119a94317aae6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after7@
+hs_bindgen_29b119a94317aae6 :: IO (FunPtr (CInt -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after7@
+hs_bindgen_29b119a94317aae6 = fmap fromFFIType hs_bindgen_29b119a94317aae6_base
+{-# NOINLINE const_withoutSign_after7_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_funptr :: FunPtr (CInt -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_funptr = unsafePerformIO hs_bindgen_29b119a94317aae6
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_be8db07cc695795d" hs_bindgen_be8db07cc695795d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after8@
+hs_bindgen_be8db07cc695795d :: IO (FunPtr (CInt ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_withoutSign_after8@
+hs_bindgen_be8db07cc695795d = fmap fromFFIType hs_bindgen_be8db07cc695795d_base
+{-# NOINLINE const_withoutSign_after8_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_funptr :: FunPtr (CInt ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_funptr = unsafePerformIO hs_bindgen_be8db07cc695795d
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_3f4562f74152c205" hs_bindgen_3f4562f74152c205_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args1@
+hs_bindgen_3f4562f74152c205 :: IO (FunPtr (CInt ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args1@
+hs_bindgen_3f4562f74152c205 = fmap fromFFIType hs_bindgen_3f4562f74152c205_base
+{-# NOINLINE const_pointers_args1_funptr #-}
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_funptr :: FunPtr (CInt ->
+                                       PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_funptr = unsafePerformIO hs_bindgen_3f4562f74152c205
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_87278ccb01e7fee0" hs_bindgen_87278ccb01e7fee0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args2@
+hs_bindgen_87278ccb01e7fee0 :: IO (FunPtr (CInt ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args2@
+hs_bindgen_87278ccb01e7fee0 = fmap fromFFIType hs_bindgen_87278ccb01e7fee0_base
+{-# NOINLINE const_pointers_args2_funptr #-}
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_funptr :: FunPtr (CInt ->
+                                       PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_funptr = unsafePerformIO hs_bindgen_87278ccb01e7fee0
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_1e25b241655c3ebb" hs_bindgen_1e25b241655c3ebb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args3@
+hs_bindgen_1e25b241655c3ebb :: IO (FunPtr (CInt ->
+                                           Ptr CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args3@
+hs_bindgen_1e25b241655c3ebb = fmap fromFFIType hs_bindgen_1e25b241655c3ebb_base
+{-# NOINLINE const_pointers_args3_funptr #-}
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_funptr :: FunPtr (CInt -> Ptr CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_funptr = unsafePerformIO hs_bindgen_1e25b241655c3ebb
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_fa94aed37836859b" hs_bindgen_fa94aed37836859b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args4@
+hs_bindgen_fa94aed37836859b :: IO (FunPtr (CInt ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args4@
+hs_bindgen_fa94aed37836859b = fmap fromFFIType hs_bindgen_fa94aed37836859b_base
+{-# NOINLINE const_pointers_args4_funptr #-}
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_funptr :: FunPtr (CInt ->
+                                       PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_funptr = unsafePerformIO hs_bindgen_fa94aed37836859b
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_800407f1e67deddb" hs_bindgen_800407f1e67deddb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args5@
+hs_bindgen_800407f1e67deddb :: IO (FunPtr (CInt ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_args5@
+hs_bindgen_800407f1e67deddb = fmap fromFFIType hs_bindgen_800407f1e67deddb_base
+{-# NOINLINE const_pointers_args5_funptr #-}
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_funptr :: FunPtr (CInt ->
+                                       PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_funptr = unsafePerformIO hs_bindgen_800407f1e67deddb
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_91e3fb45ca972f9d" hs_bindgen_91e3fb45ca972f9d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret1@
+hs_bindgen_91e3fb45ca972f9d :: IO (FunPtr (CInt ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret1@
+hs_bindgen_91e3fb45ca972f9d = fmap fromFFIType hs_bindgen_91e3fb45ca972f9d_base
+{-# NOINLINE const_pointers_ret1_funptr #-}
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_funptr :: FunPtr (CInt -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_funptr = unsafePerformIO hs_bindgen_91e3fb45ca972f9d
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_ce269be70accca82" hs_bindgen_ce269be70accca82_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret2@
+hs_bindgen_ce269be70accca82 :: IO (FunPtr (CInt ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret2@
+hs_bindgen_ce269be70accca82 = fmap fromFFIType hs_bindgen_ce269be70accca82_base
+{-# NOINLINE const_pointers_ret2_funptr #-}
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_funptr :: FunPtr (CInt -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_funptr = unsafePerformIO hs_bindgen_ce269be70accca82
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_f0f2ae46270c9785" hs_bindgen_f0f2ae46270c9785_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret3@
+hs_bindgen_f0f2ae46270c9785 :: IO (FunPtr (CInt -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret3@
+hs_bindgen_f0f2ae46270c9785 = fmap fromFFIType hs_bindgen_f0f2ae46270c9785_base
+{-# NOINLINE const_pointers_ret3_funptr #-}
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_funptr :: FunPtr (CInt -> IO (Ptr CInt))
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_funptr = unsafePerformIO hs_bindgen_f0f2ae46270c9785
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_4ecbc6cf48fbe0c3" hs_bindgen_4ecbc6cf48fbe0c3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret4@
+hs_bindgen_4ecbc6cf48fbe0c3 :: IO (FunPtr (CInt ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret4@
+hs_bindgen_4ecbc6cf48fbe0c3 = fmap fromFFIType hs_bindgen_4ecbc6cf48fbe0c3_base
+{-# NOINLINE const_pointers_ret4_funptr #-}
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_funptr :: FunPtr (CInt -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_funptr = unsafePerformIO hs_bindgen_4ecbc6cf48fbe0c3
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_c0b16cd44f63f52f" hs_bindgen_c0b16cd44f63f52f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret5@
+hs_bindgen_c0b16cd44f63f52f :: IO (FunPtr (CInt ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_pointers_ret5@
+hs_bindgen_c0b16cd44f63f52f = fmap fromFFIType hs_bindgen_c0b16cd44f63f52f_base
+{-# NOINLINE const_pointers_ret5_funptr #-}
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_funptr :: FunPtr (CInt -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_funptr = unsafePerformIO hs_bindgen_c0b16cd44f63f52f
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_db9eb973118a6fbf" hs_bindgen_db9eb973118a6fbf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem1@
+hs_bindgen_db9eb973118a6fbf :: IO (FunPtr (PtrConst (Elem (IncompleteArray CInt)) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem1@
+hs_bindgen_db9eb973118a6fbf = fmap fromFFIType hs_bindgen_db9eb973118a6fbf_base
+{-# NOINLINE const_array_elem1_funptr #-}
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_funptr :: FunPtr (PtrConst (Elem (IncompleteArray CInt)) ->
+                                    IO ())
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_funptr = unsafePerformIO hs_bindgen_db9eb973118a6fbf
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_9288cd4171172005" hs_bindgen_9288cd4171172005_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem2@
+hs_bindgen_9288cd4171172005 :: IO (FunPtr (Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem2@
+hs_bindgen_9288cd4171172005 = fmap fromFFIType hs_bindgen_9288cd4171172005_base
+{-# NOINLINE const_array_elem2_funptr #-}
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_funptr :: FunPtr (Ptr (Elem (IncompleteArray (PtrConst CInt))) ->
+                                    IO ())
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_funptr = unsafePerformIO hs_bindgen_9288cd4171172005
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_c20403bc692b1bde" hs_bindgen_c20403bc692b1bde_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem3@
+hs_bindgen_c20403bc692b1bde :: IO (FunPtr (PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const_array_elem3@
+hs_bindgen_c20403bc692b1bde = fmap fromFFIType hs_bindgen_c20403bc692b1bde_base
+{-# NOINLINE const_array_elem3_funptr #-}
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_funptr :: FunPtr (PtrConst (Elem (IncompleteArray (Ptr CInt))) ->
+                                    IO ())
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_funptr = unsafePerformIO hs_bindgen_c20403bc692b1bde
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams1@
+foreign import ccall unsafe "hs_bindgen_5ca24e7f6ac8cff0" hs_bindgen_5ca24e7f6ac8cff0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams1@
+hs_bindgen_5ca24e7f6ac8cff0 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams1@
+hs_bindgen_5ca24e7f6ac8cff0 = fmap fromFFIType hs_bindgen_5ca24e7f6ac8cff0_base
+{-# NOINLINE noParams1_funptr #-}
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_funptr :: FunPtr (IO CInt)
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_funptr = unsafePerformIO hs_bindgen_5ca24e7f6ac8cff0
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams2@
+foreign import ccall unsafe "hs_bindgen_6f664f6fdcbced27" hs_bindgen_6f664f6fdcbced27_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams2@
+hs_bindgen_6f664f6fdcbced27 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams2@
+hs_bindgen_6f664f6fdcbced27 = fmap fromFFIType hs_bindgen_6f664f6fdcbced27_base
+{-# NOINLINE noParams2_funptr #-}
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_funptr = unsafePerformIO hs_bindgen_6f664f6fdcbced27
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams3@
+foreign import ccall unsafe "hs_bindgen_1067f730bd5b4c43" hs_bindgen_1067f730bd5b4c43_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams3@
+hs_bindgen_1067f730bd5b4c43 :: IO (FunPtr (CInt ->
+                                           FunPtr (IO CInt) -> IO ()))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_noParams3@
+hs_bindgen_1067f730bd5b4c43 = fmap fromFFIType hs_bindgen_1067f730bd5b4c43_base
+{-# NOINLINE noParams3_funptr #-}
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_funptr :: FunPtr (CInt -> FunPtr (IO CInt) -> IO ())
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_funptr = unsafePerformIO hs_bindgen_1067f730bd5b4c43
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_6b5258a8560bc11c" hs_bindgen_6b5258a8560bc11c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret1@
+hs_bindgen_6b5258a8560bc11c :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (IO ()))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret1@
+hs_bindgen_6b5258a8560bc11c = fmap fromFFIType hs_bindgen_6b5258a8560bc11c_base
+{-# NOINLINE funptr_ret1_funptr #-}
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_funptr :: FunPtr (CInt -> IO (FunPtr (IO ())))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_funptr = unsafePerformIO hs_bindgen_6b5258a8560bc11c
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_723b02be7cb23263" hs_bindgen_723b02be7cb23263_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret2@
+hs_bindgen_723b02be7cb23263 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (IO CInt))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret2@
+hs_bindgen_723b02be7cb23263 = fmap fromFFIType hs_bindgen_723b02be7cb23263_base
+{-# NOINLINE funptr_ret2_funptr #-}
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_funptr :: FunPtr (CInt -> IO (FunPtr (IO CInt)))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_funptr = unsafePerformIO hs_bindgen_723b02be7cb23263
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_7c4d8fc844c6f97b" hs_bindgen_7c4d8fc844c6f97b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret3@
+hs_bindgen_7c4d8fc844c6f97b :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> IO ()))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret3@
+hs_bindgen_7c4d8fc844c6f97b = fmap fromFFIType hs_bindgen_7c4d8fc844c6f97b_base
+{-# NOINLINE funptr_ret3_funptr #-}
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_funptr :: FunPtr (CInt -> IO (FunPtr (CInt -> IO ())))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_funptr = unsafePerformIO hs_bindgen_7c4d8fc844c6f97b
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_25b578cce360cf12" hs_bindgen_25b578cce360cf12_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret4@
+hs_bindgen_25b578cce360cf12 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO CChar))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret4@
+hs_bindgen_25b578cce360cf12 = fmap fromFFIType hs_bindgen_25b578cce360cf12_base
+{-# NOINLINE funptr_ret4_funptr #-}
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO CChar)))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_funptr = unsafePerformIO hs_bindgen_25b578cce360cf12
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_5e58691a68a915de" hs_bindgen_5e58691a68a915de_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret5@
+hs_bindgen_5e58691a68a915de :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret5@
+hs_bindgen_5e58691a68a915de = fmap fromFFIType hs_bindgen_5e58691a68a915de_base
+{-# NOINLINE funptr_ret5_funptr #-}
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt))))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_funptr = unsafePerformIO hs_bindgen_5e58691a68a915de
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_0c36a271f93a9dff" hs_bindgen_0c36a271f93a9dff_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret6@
+hs_bindgen_0c36a271f93a9dff :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret6@
+hs_bindgen_0c36a271f93a9dff = fmap fromFFIType hs_bindgen_0c36a271f93a9dff_base
+{-# NOINLINE funptr_ret6_funptr #-}
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_funptr = unsafePerformIO hs_bindgen_0c36a271f93a9dff
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_67439554fe1e797d" hs_bindgen_67439554fe1e797d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret7@
+hs_bindgen_67439554fe1e797d :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret7@
+hs_bindgen_67439554fe1e797d = fmap fromFFIType hs_bindgen_67439554fe1e797d_base
+{-# NOINLINE funptr_ret7_funptr #-}
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_funptr = unsafePerformIO hs_bindgen_67439554fe1e797d
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_870a61b2b66eecf3" hs_bindgen_870a61b2b66eecf3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret8@
+hs_bindgen_870a61b2b66eecf3 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret8@
+hs_bindgen_870a61b2b66eecf3 = fmap fromFFIType hs_bindgen_870a61b2b66eecf3_base
+{-# NOINLINE funptr_ret8_funptr #-}
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt))))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_funptr = unsafePerformIO hs_bindgen_870a61b2b66eecf3
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_e7920c47095333a3" hs_bindgen_e7920c47095333a3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret9@
+hs_bindgen_e7920c47095333a3 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret9@
+hs_bindgen_e7920c47095333a3 = fmap fromFFIType hs_bindgen_e7920c47095333a3_base
+{-# NOINLINE funptr_ret9_funptr #-}
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_funptr :: FunPtr (CInt ->
+                              IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_funptr = unsafePerformIO hs_bindgen_e7920c47095333a3
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_aa1eab9b222fa4b8" hs_bindgen_aa1eab9b222fa4b8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret10@
+hs_bindgen_aa1eab9b222fa4b8 :: IO (FunPtr (CInt ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_funptr_ret10@
+hs_bindgen_aa1eab9b222fa4b8 = fmap fromFFIType hs_bindgen_aa1eab9b222fa4b8_base
+{-# NOINLINE funptr_ret10_funptr #-}
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_funptr :: FunPtr (CInt ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_funptr = unsafePerformIO hs_bindgen_aa1eab9b222fa4b8
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global1@
+foreign import ccall unsafe "hs_bindgen_93cfa28c4d516159" hs_bindgen_93cfa28c4d516159_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global1@
+hs_bindgen_93cfa28c4d516159 :: IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global1@
+hs_bindgen_93cfa28c4d516159 = fmap fromFFIType hs_bindgen_93cfa28c4d516159_base
+{-# NOINLINE global1 #-}
+{-| Globals and constants
+
+    __C declaration:__ @global1@
+
+    __defined at:__ @macros\/reparse.h 161:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global1 :: Ptr CInt
+{-| Globals and constants
+
+    __C declaration:__ @global1@
+
+    __defined at:__ @macros\/reparse.h 161:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global1 = unsafePerformIO hs_bindgen_93cfa28c4d516159
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global2@
+foreign import ccall unsafe "hs_bindgen_9d8438d8f0c6d639" hs_bindgen_9d8438d8f0c6d639_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global2@
+hs_bindgen_9d8438d8f0c6d639 :: IO (Ptr (Ptr CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global2@
+hs_bindgen_9d8438d8f0c6d639 = fmap fromFFIType hs_bindgen_9d8438d8f0c6d639_base
+{-# NOINLINE global2 #-}
+{-| __C declaration:__ @global2@
+
+    __defined at:__ @macros\/reparse.h 162:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global2 :: Ptr (Ptr CInt)
+{-| __C declaration:__ @global2@
+
+    __defined at:__ @macros\/reparse.h 162:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global2 = unsafePerformIO hs_bindgen_9d8438d8f0c6d639
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global3@
+foreign import ccall unsafe "hs_bindgen_29516306ddb7335f" hs_bindgen_29516306ddb7335f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global3@
+hs_bindgen_29516306ddb7335f :: IO (Ptr (Ptr (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_global3@
+hs_bindgen_29516306ddb7335f = fmap fromFFIType hs_bindgen_29516306ddb7335f_base
+{-# NOINLINE global3 #-}
+{-| __C declaration:__ @global3@
+
+    __defined at:__ @macros\/reparse.h 163:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global3 :: Ptr (Ptr (Ptr CInt))
+{-| __C declaration:__ @global3@
+
+    __defined at:__ @macros\/reparse.h 163:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global3 = unsafePerformIO hs_bindgen_29516306ddb7335f
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const1@
+foreign import ccall unsafe "hs_bindgen_3326ba6dde505604" hs_bindgen_3326ba6dde505604_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const1@
+hs_bindgen_3326ba6dde505604 :: IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const1@
+hs_bindgen_3326ba6dde505604 = fmap fromFFIType hs_bindgen_3326ba6dde505604_base
+{-# NOINLINE hs_bindgen_0ad29e3e91a18217 #-}
+{-| __C declaration:__ @const1@
+
+    __defined at:__ @macros\/reparse.h 165:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_2_raw_Example_const1@
+-}
+hs_bindgen_0ad29e3e91a18217 :: PtrConst CInt
+{-| __C declaration:__ @const1@
+
+    __defined at:__ @macros\/reparse.h 165:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_2_raw_Example_const1@
+-}
+hs_bindgen_0ad29e3e91a18217 = unsafePerformIO hs_bindgen_3326ba6dde505604
+{-# NOINLINE const1 #-}
+const1 :: CInt
+const1 = unsafePerformIO (peek hs_bindgen_0ad29e3e91a18217)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const2@
+foreign import ccall unsafe "hs_bindgen_8add8e4cd4511ebc" hs_bindgen_8add8e4cd4511ebc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const2@
+hs_bindgen_8add8e4cd4511ebc :: IO (PtrConst (Ptr CInt))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const2@
+hs_bindgen_8add8e4cd4511ebc = fmap fromFFIType hs_bindgen_8add8e4cd4511ebc_base
+{-# NOINLINE hs_bindgen_67e8005e9795d40a #-}
+{-| __C declaration:__ @const2@
+
+    __defined at:__ @macros\/reparse.h 166:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_2_raw_Example_const2@
+-}
+hs_bindgen_67e8005e9795d40a :: PtrConst (Ptr CInt)
+{-| __C declaration:__ @const2@
+
+    __defined at:__ @macros\/reparse.h 166:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_2_raw_Example_const2@
+-}
+hs_bindgen_67e8005e9795d40a = unsafePerformIO hs_bindgen_8add8e4cd4511ebc
+{-# NOINLINE const2 #-}
+const2 :: Ptr CInt
+const2 = unsafePerformIO (peek hs_bindgen_67e8005e9795d40a)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const3@
+foreign import ccall unsafe "hs_bindgen_e00a055156bc89e4" hs_bindgen_e00a055156bc89e4_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const3@
+hs_bindgen_e00a055156bc89e4 :: IO (PtrConst (Ptr (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_2_raw_Example_get_const3@
+hs_bindgen_e00a055156bc89e4 = fmap fromFFIType hs_bindgen_e00a055156bc89e4_base
+{-# NOINLINE hs_bindgen_2f3c7514e0b7b99c #-}
+{-| __C declaration:__ @const3@
+
+    __defined at:__ @macros\/reparse.h 167:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_2_raw_Example_const3@
+-}
+hs_bindgen_2f3c7514e0b7b99c :: PtrConst (Ptr (Ptr CInt))
+{-| __C declaration:__ @const3@
+
+    __defined at:__ @macros\/reparse.h 167:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_2_raw_Example_const3@
+-}
+hs_bindgen_2f3c7514e0b7b99c = unsafePerformIO hs_bindgen_e00a055156bc89e4
+{-# NOINLINE const3 #-}
+const3 :: Ptr (Ptr CInt)
+const3 = unsafePerformIO (peek hs_bindgen_2f3c7514e0b7b99c)
diff --git a/test-artefacts/fixtures/macros/reparse/Example.hs b/test-artefacts/fixtures/macros/reparse/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/Example.hs
@@ -0,0 +1,2958 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    , Example.Some_struct(..)
+    , Example.Some_union(..)
+    , Example.Some_enum(..)
+    , pattern Example.ENUM_A
+    , Example.Arr_typedef1(..)
+    , Example.Arr_typedef2(..)
+    , Example.Arr_typedef3(..)
+    , Example.Arr_typedef4(..)
+    , Example.Typedef1(..)
+    , Example.Typedef2(..)
+    , Example.Typedef3(..)
+    , Example.Funptr_typedef1_Aux(..)
+    , Example.Funptr_typedef1(..)
+    , Example.Funptr_typedef2_Aux(..)
+    , Example.Funptr_typedef2(..)
+    , Example.Funptr_typedef3_Aux(..)
+    , Example.Funptr_typedef3(..)
+    , Example.Funptr_typedef4_Aux(..)
+    , Example.Funptr_typedef4(..)
+    , Example.Funptr_typedef5_Aux(..)
+    , Example.Funptr_typedef5(..)
+    , Example.Comments2(..)
+    , Example.Example_struct(..)
+    , Example.Const_typedef1(..)
+    , Example.Const_typedef2(..)
+    , Example.Const_typedef3(..)
+    , Example.Const_typedef4(..)
+    , Example.Const_typedef5(..)
+    , Example.Const_typedef6(..)
+    , Example.Const_typedef7(..)
+    , Example.Example_struct_with_const(..)
+    , Example.Const_funptr1_Aux(..)
+    , Example.Const_funptr1(..)
+    , Example.Const_funptr2_Aux(..)
+    , Example.Const_funptr2(..)
+    , Example.Const_funptr3_Aux(..)
+    , Example.Const_funptr3(..)
+    , Example.Const_funptr4_Aux(..)
+    , Example.Const_funptr4(..)
+    , Example.Const_funptr5_Aux(..)
+    , Example.Const_funptr5(..)
+    , Example.Const_funptr6_Aux(..)
+    , Example.Const_funptr6(..)
+    , Example.Const_funptr7_Aux(..)
+    , Example.Const_funptr7(..)
+    , Example.BOOL(..)
+    , Example.INT(..)
+    , Example.INTP(..)
+    , Example.INTCP(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, IO, Int, Integral, Num, Ord, Read, Real, Show, fmap, pure, type (~))
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse.h 3:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype A = A
+  { unwrapA :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct some_struct@
+
+    __defined at:__ @macros\/reparse.h 7:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Some_struct = Some_struct
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Some_struct where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Some_struct where
+
+  readRaw = \ptr0 -> pure Some_struct
+
+instance Marshal.WriteRaw Some_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Some_struct -> pure ()
+
+deriving via Marshal.EquivStorable Some_struct instance BG.Storable Some_struct
+
+deriving via Struct.IsStructViaReadRaw Some_struct instance Struct.IsStruct Some_struct
+
+{-| __C declaration:__ @union some_union@
+
+    __defined at:__ @macros\/reparse.h 8:7@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_union = Some_union
+  { unwrapSome_union :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.StaticSize Some_union
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.ReadRaw Some_union
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.WriteRaw Some_union
+
+deriving via Marshal.EquivStorable Some_union instance BG.Storable Some_union
+
+deriving via BG.SizedByteArray 0 1 instance Union.IsUnion Some_union
+
+{-| __C declaration:__ @enum some_enum@
+
+    __defined at:__ @macros\/reparse.h 9:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_enum = Some_enum
+  { unwrapSome_enum :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Some_enum where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Some_enum where
+
+  readRaw =
+    \ptr0 ->
+          pure Some_enum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Some_enum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Some_enum unwrapSome_enum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapSome_enum2
+
+deriving via Marshal.EquivStorable Some_enum instance BG.Storable Some_enum
+
+deriving via BG.CUInt instance BG.Prim Some_enum
+
+instance CEnum.CEnum Some_enum where
+
+  type CEnumZ Some_enum = BG.CUInt
+
+  toCEnum = Some_enum
+
+  fromCEnum = BG.getField @"unwrapSome_enum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "ENUM_A")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Some_enum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Some_enum"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Some_enum where
+
+  minDeclaredValue = ENUM_A
+
+  maxDeclaredValue = ENUM_A
+
+instance Show Some_enum where
+
+  showsPrec = CEnum.shows
+
+instance Read Some_enum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapSome_enum" Some_enum ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Some_enum {unwrapSome_enum = y1}, BG.getField @"unwrapSome_enum" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapSome_enum" (BG.Ptr Some_enum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSome_enum")
+
+instance HasCField.HasCField Some_enum "unwrapSome_enum" where
+
+  type CFieldType Some_enum "unwrapSome_enum" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @ENUM_A@
+
+    __defined at:__ @macros\/reparse.h 9:18@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+pattern ENUM_A :: Some_enum
+pattern ENUM_A = Some_enum 0
+
+{-| __C declaration:__ @arr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 109:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef1 = Arr_typedef1
+  { unwrapArr_typedef1 :: IA.IncompleteArray A
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray A
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef1" Arr_typedef1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef1 {unwrapArr_typedef1 = y1}
+      , BG.getField @"unwrapArr_typedef1" x0
+      )
+
+instance ( ty ~ IA.IncompleteArray A
+         ) => BG.HasField "unwrapArr_typedef1" (BG.Ptr Arr_typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef1")
+
+instance HasCField.HasCField Arr_typedef1 "unwrapArr_typedef1" where
+
+  type CFieldType Arr_typedef1 "unwrapArr_typedef1" =
+    IA.IncompleteArray A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @arr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 110:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef2 = Arr_typedef2
+  { unwrapArr_typedef2 :: IA.IncompleteArray (BG.Ptr A)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray (BG.Ptr A)
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef2" Arr_typedef2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef2 {unwrapArr_typedef2 = y1}
+      , BG.getField @"unwrapArr_typedef2" x0
+      )
+
+instance ( ty ~ IA.IncompleteArray (BG.Ptr A)
+         ) => BG.HasField "unwrapArr_typedef2" (BG.Ptr Arr_typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef2")
+
+instance HasCField.HasCField Arr_typedef2 "unwrapArr_typedef2" where
+
+  type CFieldType Arr_typedef2 "unwrapArr_typedef2" =
+    IA.IncompleteArray (BG.Ptr A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @arr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 111:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef3 = Arr_typedef3
+  { unwrapArr_typedef3 :: CA.ConstantArray 5 A
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 5 A
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef3" Arr_typedef3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef3 {unwrapArr_typedef3 = y1}
+      , BG.getField @"unwrapArr_typedef3" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 5 A
+         ) => BG.HasField "unwrapArr_typedef3" (BG.Ptr Arr_typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef3")
+
+instance HasCField.HasCField Arr_typedef3 "unwrapArr_typedef3" where
+
+  type CFieldType Arr_typedef3 "unwrapArr_typedef3" =
+    CA.ConstantArray 5 A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @arr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 112:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef4 = Arr_typedef4
+  { unwrapArr_typedef4 :: CA.ConstantArray 5 (BG.Ptr A)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 5 (BG.Ptr A)
+         ) => BG.CompatHasField.HasField "unwrapArr_typedef4" Arr_typedef4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Arr_typedef4 {unwrapArr_typedef4 = y1}
+      , BG.getField @"unwrapArr_typedef4" x0
+      )
+
+instance ( ty ~ CA.ConstantArray 5 (BG.Ptr A)
+         ) => BG.HasField "unwrapArr_typedef4" (BG.Ptr Arr_typedef4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapArr_typedef4")
+
+instance HasCField.HasCField Arr_typedef4 "unwrapArr_typedef4" where
+
+  type CFieldType Arr_typedef4 "unwrapArr_typedef4" =
+    CA.ConstantArray 5 (BG.Ptr A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Typedefs
+
+    __C declaration:__ @typedef1@
+
+    __defined at:__ @macros\/reparse.h 118:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef1 = Typedef1
+  { unwrapTypedef1 :: A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ A
+         ) => BG.CompatHasField.HasField "unwrapTypedef1" Typedef1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Typedef1 {unwrapTypedef1 = y1}, BG.getField @"unwrapTypedef1" x0)
+
+instance ( ty ~ A
+         ) => BG.HasField "unwrapTypedef1" (BG.Ptr Typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypedef1")
+
+instance HasCField.HasCField Typedef1 "unwrapTypedef1" where
+
+  type CFieldType Typedef1 "unwrapTypedef1" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @typedef2@
+
+    __defined at:__ @macros\/reparse.h 119:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef2 = Typedef2
+  { unwrapTypedef2 :: BG.Ptr A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr A
+         ) => BG.CompatHasField.HasField "unwrapTypedef2" Typedef2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Typedef2 {unwrapTypedef2 = y1}, BG.getField @"unwrapTypedef2" x0)
+
+instance ( ty ~ BG.Ptr A
+         ) => BG.HasField "unwrapTypedef2" (BG.Ptr Typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypedef2")
+
+instance HasCField.HasCField Typedef2 "unwrapTypedef2" where
+
+  type CFieldType Typedef2 "unwrapTypedef2" = BG.Ptr A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @typedef3@
+
+    __defined at:__ @macros\/reparse.h 120:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef3 = Typedef3
+  { unwrapTypedef3 :: BG.Ptr (BG.Ptr A)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr A)
+         ) => BG.CompatHasField.HasField "unwrapTypedef3" Typedef3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Typedef3 {unwrapTypedef3 = y1}, BG.getField @"unwrapTypedef3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr A)
+         ) => BG.HasField "unwrapTypedef3" (BG.Ptr Typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapTypedef3")
+
+instance HasCField.HasCField Typedef3 "unwrapTypedef3" where
+
+  type CFieldType Typedef3 "unwrapTypedef3" =
+    BG.Ptr (BG.Ptr A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef1'
+
+    __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1_Aux = Funptr_typedef1_Aux
+  { unwrapFunptr_typedef1_Aux :: IO A
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c584d0f839fd43de_base ::
+     IO BG.CInt
+  -> IO (BG.FunPtr (IO BG.CInt))
+
+-- __unique:__ @toFunptr_typedef1_Aux@
+hs_bindgen_c584d0f839fd43de ::
+     Funptr_typedef1_Aux
+  -> IO (BG.FunPtr Funptr_typedef1_Aux)
+hs_bindgen_c584d0f839fd43de =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c584d0f839fd43de_base (fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef1_Aux" fun0)))
+
+-- __unique:__ @fromFunptr_typedef1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_806a46dc418a062c_base ::
+     BG.FunPtr (IO BG.CInt)
+  -> IO BG.CInt
+
+-- __unique:__ @fromFunptr_typedef1_Aux@
+hs_bindgen_806a46dc418a062c ::
+     BG.FunPtr Funptr_typedef1_Aux
+  -> Funptr_typedef1_Aux
+hs_bindgen_806a46dc418a062c =
+  \funPtr0 ->
+    Funptr_typedef1_Aux (fmap BG.fromFFIType (hs_bindgen_806a46dc418a062c_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Funptr_typedef1_Aux where
+
+  toFunPtr = hs_bindgen_c584d0f839fd43de
+
+instance BG.FromFunPtr Funptr_typedef1_Aux where
+
+  fromFunPtr = hs_bindgen_806a46dc418a062c
+
+instance ( ty ~ IO A
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef1_Aux" Funptr_typedef1_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef1_Aux {unwrapFunptr_typedef1_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef1_Aux" x0
+      )
+
+instance ( ty ~ IO A
+         ) => BG.HasField "unwrapFunptr_typedef1_Aux" (BG.Ptr Funptr_typedef1_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef1_Aux")
+
+instance HasCField.HasCField Funptr_typedef1_Aux "unwrapFunptr_typedef1_Aux" where
+
+  type CFieldType Funptr_typedef1_Aux "unwrapFunptr_typedef1_Aux" =
+    IO A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1 = Funptr_typedef1
+  { unwrapFunptr_typedef1 :: BG.FunPtr Funptr_typedef1_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef1_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef1" Funptr_typedef1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef1 {unwrapFunptr_typedef1 = y1}
+      , BG.getField @"unwrapFunptr_typedef1" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef1_Aux
+         ) => BG.HasField "unwrapFunptr_typedef1" (BG.Ptr Funptr_typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef1")
+
+instance HasCField.HasCField Funptr_typedef1 "unwrapFunptr_typedef1" where
+
+  type CFieldType Funptr_typedef1 "unwrapFunptr_typedef1" =
+    BG.FunPtr Funptr_typedef1_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef2'
+
+    __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2_Aux = Funptr_typedef2_Aux
+  { unwrapFunptr_typedef2_Aux :: IO (BG.Ptr A)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_f174457a161ac5a0_base ::
+     IO (BG.Ptr BG.Void)
+  -> IO (BG.FunPtr (IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toFunptr_typedef2_Aux@
+hs_bindgen_f174457a161ac5a0 ::
+     Funptr_typedef2_Aux
+  -> IO (BG.FunPtr Funptr_typedef2_Aux)
+hs_bindgen_f174457a161ac5a0 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_f174457a161ac5a0_base (fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef2_Aux" fun0)))
+
+-- __unique:__ @fromFunptr_typedef2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_323d07dff85b802c_base ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromFunptr_typedef2_Aux@
+hs_bindgen_323d07dff85b802c ::
+     BG.FunPtr Funptr_typedef2_Aux
+  -> Funptr_typedef2_Aux
+hs_bindgen_323d07dff85b802c =
+  \funPtr0 ->
+    Funptr_typedef2_Aux (fmap BG.fromFFIType (hs_bindgen_323d07dff85b802c_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Funptr_typedef2_Aux where
+
+  toFunPtr = hs_bindgen_f174457a161ac5a0
+
+instance BG.FromFunPtr Funptr_typedef2_Aux where
+
+  fromFunPtr = hs_bindgen_323d07dff85b802c
+
+instance ( ty ~ IO (BG.Ptr A)
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef2_Aux" Funptr_typedef2_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef2_Aux {unwrapFunptr_typedef2_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef2_Aux" x0
+      )
+
+instance ( ty ~ IO (BG.Ptr A)
+         ) => BG.HasField "unwrapFunptr_typedef2_Aux" (BG.Ptr Funptr_typedef2_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef2_Aux")
+
+instance HasCField.HasCField Funptr_typedef2_Aux "unwrapFunptr_typedef2_Aux" where
+
+  type CFieldType Funptr_typedef2_Aux "unwrapFunptr_typedef2_Aux" =
+    IO (BG.Ptr A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2 = Funptr_typedef2
+  { unwrapFunptr_typedef2 :: BG.FunPtr Funptr_typedef2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef2_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef2" Funptr_typedef2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef2 {unwrapFunptr_typedef2 = y1}
+      , BG.getField @"unwrapFunptr_typedef2" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef2_Aux
+         ) => BG.HasField "unwrapFunptr_typedef2" (BG.Ptr Funptr_typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef2")
+
+instance HasCField.HasCField Funptr_typedef2 "unwrapFunptr_typedef2" where
+
+  type CFieldType Funptr_typedef2 "unwrapFunptr_typedef2" =
+    BG.FunPtr Funptr_typedef2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef3'
+
+    __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3_Aux = Funptr_typedef3_Aux
+  { unwrapFunptr_typedef3_Aux :: IO (BG.Ptr (BG.Ptr A))
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_031d1a7decd790d8_base ::
+     IO (BG.Ptr BG.Void)
+  -> IO (BG.FunPtr (IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toFunptr_typedef3_Aux@
+hs_bindgen_031d1a7decd790d8 ::
+     Funptr_typedef3_Aux
+  -> IO (BG.FunPtr Funptr_typedef3_Aux)
+hs_bindgen_031d1a7decd790d8 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_031d1a7decd790d8_base (fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef3_Aux" fun0)))
+
+-- __unique:__ @fromFunptr_typedef3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_82dc7b932974117e_base ::
+     BG.FunPtr (IO (BG.Ptr BG.Void))
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromFunptr_typedef3_Aux@
+hs_bindgen_82dc7b932974117e ::
+     BG.FunPtr Funptr_typedef3_Aux
+  -> Funptr_typedef3_Aux
+hs_bindgen_82dc7b932974117e =
+  \funPtr0 ->
+    Funptr_typedef3_Aux (fmap BG.fromFFIType (hs_bindgen_82dc7b932974117e_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr Funptr_typedef3_Aux where
+
+  toFunPtr = hs_bindgen_031d1a7decd790d8
+
+instance BG.FromFunPtr Funptr_typedef3_Aux where
+
+  fromFunPtr = hs_bindgen_82dc7b932974117e
+
+instance ( ty ~ IO (BG.Ptr (BG.Ptr A))
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef3_Aux" Funptr_typedef3_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef3_Aux {unwrapFunptr_typedef3_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef3_Aux" x0
+      )
+
+instance ( ty ~ IO (BG.Ptr (BG.Ptr A))
+         ) => BG.HasField "unwrapFunptr_typedef3_Aux" (BG.Ptr Funptr_typedef3_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef3_Aux")
+
+instance HasCField.HasCField Funptr_typedef3_Aux "unwrapFunptr_typedef3_Aux" where
+
+  type CFieldType Funptr_typedef3_Aux "unwrapFunptr_typedef3_Aux" =
+    IO (BG.Ptr (BG.Ptr A))
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3 = Funptr_typedef3
+  { unwrapFunptr_typedef3 :: BG.FunPtr Funptr_typedef3_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef3_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef3" Funptr_typedef3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef3 {unwrapFunptr_typedef3 = y1}
+      , BG.getField @"unwrapFunptr_typedef3" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef3_Aux
+         ) => BG.HasField "unwrapFunptr_typedef3" (BG.Ptr Funptr_typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef3")
+
+instance HasCField.HasCField Funptr_typedef3 "unwrapFunptr_typedef3" where
+
+  type CFieldType Funptr_typedef3 "unwrapFunptr_typedef3" =
+    BG.FunPtr Funptr_typedef3_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef4'
+
+    __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4_Aux = Funptr_typedef4_Aux
+  { unwrapFunptr_typedef4_Aux :: BG.CInt -> BG.CDouble -> IO A
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_da2336d254667386_base ::
+     (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt))
+
+-- __unique:__ @toFunptr_typedef4_Aux@
+hs_bindgen_da2336d254667386 ::
+     Funptr_typedef4_Aux
+  -> IO (BG.FunPtr Funptr_typedef4_Aux)
+hs_bindgen_da2336d254667386 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_da2336d254667386_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef4_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromFunptr_typedef4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d4a97954476da161_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> BG.CInt -> BG.CDouble -> IO BG.CInt
+
+-- __unique:__ @fromFunptr_typedef4_Aux@
+hs_bindgen_d4a97954476da161 ::
+     BG.FunPtr Funptr_typedef4_Aux
+  -> Funptr_typedef4_Aux
+hs_bindgen_d4a97954476da161 =
+  \funPtr0 ->
+    Funptr_typedef4_Aux (\x1 ->
+                           \x2 ->
+                             fmap BG.fromFFIType (hs_bindgen_d4a97954476da161_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Funptr_typedef4_Aux where
+
+  toFunPtr = hs_bindgen_da2336d254667386
+
+instance BG.FromFunPtr Funptr_typedef4_Aux where
+
+  fromFunPtr = hs_bindgen_d4a97954476da161
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO A)
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef4_Aux" Funptr_typedef4_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef4_Aux {unwrapFunptr_typedef4_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef4_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO A)
+         ) => BG.HasField "unwrapFunptr_typedef4_Aux" (BG.Ptr Funptr_typedef4_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef4_Aux")
+
+instance HasCField.HasCField Funptr_typedef4_Aux "unwrapFunptr_typedef4_Aux" where
+
+  type CFieldType Funptr_typedef4_Aux "unwrapFunptr_typedef4_Aux" =
+    BG.CInt -> BG.CDouble -> IO A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4 = Funptr_typedef4
+  { unwrapFunptr_typedef4 :: BG.FunPtr Funptr_typedef4_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef4_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef4" Funptr_typedef4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef4 {unwrapFunptr_typedef4 = y1}
+      , BG.getField @"unwrapFunptr_typedef4" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef4_Aux
+         ) => BG.HasField "unwrapFunptr_typedef4" (BG.Ptr Funptr_typedef4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef4")
+
+instance HasCField.HasCField Funptr_typedef4 "unwrapFunptr_typedef4" where
+
+  type CFieldType Funptr_typedef4 "unwrapFunptr_typedef4" =
+    BG.FunPtr Funptr_typedef4_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Funptr_typedef5'
+
+    __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5_Aux = Funptr_typedef5_Aux
+  { unwrapFunptr_typedef5_Aux :: BG.CInt -> BG.CDouble -> IO (BG.Ptr A)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunptr_typedef5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1f45632f07742a46_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toFunptr_typedef5_Aux@
+hs_bindgen_1f45632f07742a46 ::
+     Funptr_typedef5_Aux
+  -> IO (BG.FunPtr Funptr_typedef5_Aux)
+hs_bindgen_1f45632f07742a46 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_1f45632f07742a46_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapFunptr_typedef5_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromFunptr_typedef5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_0bd1877eaaba0d3e_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromFunptr_typedef5_Aux@
+hs_bindgen_0bd1877eaaba0d3e ::
+     BG.FunPtr Funptr_typedef5_Aux
+  -> Funptr_typedef5_Aux
+hs_bindgen_0bd1877eaaba0d3e =
+  \funPtr0 ->
+    Funptr_typedef5_Aux (\x1 ->
+                           \x2 ->
+                             fmap BG.fromFFIType (hs_bindgen_0bd1877eaaba0d3e_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Funptr_typedef5_Aux where
+
+  toFunPtr = hs_bindgen_1f45632f07742a46
+
+instance BG.FromFunPtr Funptr_typedef5_Aux where
+
+  fromFunPtr = hs_bindgen_0bd1877eaaba0d3e
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr A))
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef5_Aux" Funptr_typedef5_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Funptr_typedef5_Aux {unwrapFunptr_typedef5_Aux = y1}
+      , BG.getField @"unwrapFunptr_typedef5_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr A))
+         ) => BG.HasField "unwrapFunptr_typedef5_Aux" (BG.Ptr Funptr_typedef5_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef5_Aux")
+
+instance HasCField.HasCField Funptr_typedef5_Aux "unwrapFunptr_typedef5_Aux" where
+
+  type CFieldType Funptr_typedef5_Aux "unwrapFunptr_typedef5_Aux" =
+    BG.CInt -> BG.CDouble -> IO (BG.Ptr A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5 = Funptr_typedef5
+  { unwrapFunptr_typedef5 :: BG.FunPtr Funptr_typedef5_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef5_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunptr_typedef5" Funptr_typedef5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Funptr_typedef5 {unwrapFunptr_typedef5 = y1}
+      , BG.getField @"unwrapFunptr_typedef5" x0
+      )
+
+instance ( ty ~ BG.FunPtr Funptr_typedef5_Aux
+         ) => BG.HasField "unwrapFunptr_typedef5" (BG.Ptr Funptr_typedef5) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunptr_typedef5")
+
+instance HasCField.HasCField Funptr_typedef5 "unwrapFunptr_typedef5" where
+
+  type CFieldType Funptr_typedef5 "unwrapFunptr_typedef5" =
+    BG.FunPtr Funptr_typedef5_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @comments2@
+
+    __defined at:__ @macros\/reparse.h 145:30@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Comments2 = Comments2
+  { unwrapComments2 :: A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ A
+         ) => BG.CompatHasField.HasField "unwrapComments2" Comments2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Comments2 {unwrapComments2 = y1}, BG.getField @"unwrapComments2" x0)
+
+instance ( ty ~ A
+         ) => BG.HasField "unwrapComments2" (BG.Ptr Comments2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapComments2")
+
+instance HasCField.HasCField Comments2 "unwrapComments2" where
+
+  type CFieldType Comments2 "unwrapComments2" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| Struct fields
+
+    __C declaration:__ @struct example_struct@
+
+    __defined at:__ @macros\/reparse.h 151:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct = Example_struct
+  { example_struct_field1 :: A
+    {- ^ __C declaration:__ @field1@
+
+         __defined at:__ @macros\/reparse.h 152:8@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_field2 :: BG.Ptr A
+    {- ^ __C declaration:__ @field2@
+
+         __defined at:__ @macros\/reparse.h 153:8@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_field3 :: BG.Ptr (BG.Ptr A)
+    {- ^ __C declaration:__ @field3@
+
+         __defined at:__ @macros\/reparse.h 154:8@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Example_struct where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Example_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Example_struct
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_field1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_field2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_field3") ptr0
+
+instance Marshal.WriteRaw Example_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Example_struct
+            example_struct_field12
+            example_struct_field23
+            example_struct_field34 ->
+                 HasCField.writeRaw (BG.Proxy @"example_struct_field1") ptr0 example_struct_field12
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_field2") ptr0 example_struct_field23
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_field3") ptr0 example_struct_field34
+
+deriving via Marshal.EquivStorable Example_struct instance BG.Storable Example_struct
+
+deriving via Struct.IsStructViaReadRaw Example_struct instance Struct.IsStruct Example_struct
+
+{-| __C declaration:__ @field1@
+
+    __defined at:__ @macros\/reparse.h 152:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ A
+         ) => BG.CompatHasField.HasField "example_struct_field1" Example_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct { example_struct_field1 = y1
+                         , example_struct_field2 = BG.getField @"example_struct_field2" x0
+                         , example_struct_field3 = BG.getField @"example_struct_field3" x0
+                         }
+      , BG.getField @"example_struct_field1" x0
+      )
+
+instance ( ty ~ A
+         ) => BG.HasField "example_struct_field1" (BG.Ptr Example_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_field1")
+
+instance HasCField.HasCField Example_struct "example_struct_field1" where
+
+  type CFieldType Example_struct "example_struct_field1" =
+    A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @field2@
+
+    __defined at:__ @macros\/reparse.h 153:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.Ptr A
+         ) => BG.CompatHasField.HasField "example_struct_field2" Example_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct { example_struct_field2 = y1
+                         , example_struct_field1 = BG.getField @"example_struct_field1" x0
+                         , example_struct_field3 = BG.getField @"example_struct_field3" x0
+                         }
+      , BG.getField @"example_struct_field2" x0
+      )
+
+instance ( ty ~ BG.Ptr A
+         ) => BG.HasField "example_struct_field2" (BG.Ptr Example_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_field2")
+
+instance HasCField.HasCField Example_struct "example_struct_field2" where
+
+  type CFieldType Example_struct "example_struct_field2" =
+    BG.Ptr A
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @field3@
+
+    __defined at:__ @macros\/reparse.h 154:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr A)
+         ) => BG.CompatHasField.HasField "example_struct_field3" Example_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct { example_struct_field3 = y1
+                         , example_struct_field1 = BG.getField @"example_struct_field1" x0
+                         , example_struct_field2 = BG.getField @"example_struct_field2" x0
+                         }
+      , BG.getField @"example_struct_field3" x0
+      )
+
+instance ( ty ~ BG.Ptr (BG.Ptr A)
+         ) => BG.HasField "example_struct_field3" (BG.Ptr Example_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_field3")
+
+instance HasCField.HasCField Example_struct "example_struct_field3" where
+
+  type CFieldType Example_struct "example_struct_field3" =
+    BG.Ptr (BG.Ptr A)
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @const_typedef1@
+
+    __defined at:__ @macros\/reparse.h 218:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef1 = Const_typedef1
+  { unwrapConst_typedef1 :: A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ A
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef1" Const_typedef1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef1 {unwrapConst_typedef1 = y1}
+      , BG.getField @"unwrapConst_typedef1" x0
+      )
+
+instance ( ty ~ A
+         ) => BG.HasField "unwrapConst_typedef1" (BG.Ptr Const_typedef1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef1")
+
+instance HasCField.HasCField Const_typedef1 "unwrapConst_typedef1" where
+
+  type CFieldType Const_typedef1 "unwrapConst_typedef1" =
+    A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef2@
+
+    __defined at:__ @macros\/reparse.h 219:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef2 = Const_typedef2
+  { unwrapConst_typedef2 :: A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ A
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef2" Const_typedef2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef2 {unwrapConst_typedef2 = y1}
+      , BG.getField @"unwrapConst_typedef2" x0
+      )
+
+instance ( ty ~ A
+         ) => BG.HasField "unwrapConst_typedef2" (BG.Ptr Const_typedef2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef2")
+
+instance HasCField.HasCField Const_typedef2 "unwrapConst_typedef2" where
+
+  type CFieldType Const_typedef2 "unwrapConst_typedef2" =
+    A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef3@
+
+    __defined at:__ @macros\/reparse.h 220:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef3 = Const_typedef3
+  { unwrapConst_typedef3 :: PtrConst.PtrConst A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef3" Const_typedef3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef3 {unwrapConst_typedef3 = y1}
+      , BG.getField @"unwrapConst_typedef3" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.HasField "unwrapConst_typedef3" (BG.Ptr Const_typedef3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef3")
+
+instance HasCField.HasCField Const_typedef3 "unwrapConst_typedef3" where
+
+  type CFieldType Const_typedef3 "unwrapConst_typedef3" =
+    PtrConst.PtrConst A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef4@
+
+    __defined at:__ @macros\/reparse.h 221:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef4 = Const_typedef4
+  { unwrapConst_typedef4 :: PtrConst.PtrConst A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef4" Const_typedef4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef4 {unwrapConst_typedef4 = y1}
+      , BG.getField @"unwrapConst_typedef4" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.HasField "unwrapConst_typedef4" (BG.Ptr Const_typedef4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef4")
+
+instance HasCField.HasCField Const_typedef4 "unwrapConst_typedef4" where
+
+  type CFieldType Const_typedef4 "unwrapConst_typedef4" =
+    PtrConst.PtrConst A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef5@
+
+    __defined at:__ @macros\/reparse.h 222:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef5 = Const_typedef5
+  { unwrapConst_typedef5 :: BG.Ptr A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr A
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef5" Const_typedef5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef5 {unwrapConst_typedef5 = y1}
+      , BG.getField @"unwrapConst_typedef5" x0
+      )
+
+instance ( ty ~ BG.Ptr A
+         ) => BG.HasField "unwrapConst_typedef5" (BG.Ptr Const_typedef5) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef5")
+
+instance HasCField.HasCField Const_typedef5 "unwrapConst_typedef5" where
+
+  type CFieldType Const_typedef5 "unwrapConst_typedef5" =
+    BG.Ptr A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef6@
+
+    __defined at:__ @macros\/reparse.h 223:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef6 = Const_typedef6
+  { unwrapConst_typedef6 :: PtrConst.PtrConst A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef6" Const_typedef6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef6 {unwrapConst_typedef6 = y1}
+      , BG.getField @"unwrapConst_typedef6" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.HasField "unwrapConst_typedef6" (BG.Ptr Const_typedef6) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef6")
+
+instance HasCField.HasCField Const_typedef6 "unwrapConst_typedef6" where
+
+  type CFieldType Const_typedef6 "unwrapConst_typedef6" =
+    PtrConst.PtrConst A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_typedef7@
+
+    __defined at:__ @macros\/reparse.h 224:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef7 = Const_typedef7
+  { unwrapConst_typedef7 :: PtrConst.PtrConst A
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.CompatHasField.HasField "unwrapConst_typedef7" Const_typedef7 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_typedef7 {unwrapConst_typedef7 = y1}
+      , BG.getField @"unwrapConst_typedef7" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.HasField "unwrapConst_typedef7" (BG.Ptr Const_typedef7) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_typedef7")
+
+instance HasCField.HasCField Const_typedef7 "unwrapConst_typedef7" where
+
+  type CFieldType Const_typedef7 "unwrapConst_typedef7" =
+    PtrConst.PtrConst A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct example_struct_with_const@
+
+    __defined at:__ @macros\/reparse.h 226:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct_with_const = Example_struct_with_const
+  { example_struct_with_const_const_field1 :: A
+    {- ^ __C declaration:__ @const_field1@
+
+         __defined at:__ @macros\/reparse.h 227:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field2 :: A
+    {- ^ __C declaration:__ @const_field2@
+
+         __defined at:__ @macros\/reparse.h 228:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field3 :: PtrConst.PtrConst A
+    {- ^ __C declaration:__ @const_field3@
+
+         __defined at:__ @macros\/reparse.h 229:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field4 :: PtrConst.PtrConst A
+    {- ^ __C declaration:__ @const_field4@
+
+         __defined at:__ @macros\/reparse.h 230:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field5 :: BG.Ptr A
+    {- ^ __C declaration:__ @const_field5@
+
+         __defined at:__ @macros\/reparse.h 231:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field6 :: PtrConst.PtrConst A
+    {- ^ __C declaration:__ @const_field6@
+
+         __defined at:__ @macros\/reparse.h 232:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  , example_struct_with_const_const_field7 :: PtrConst.PtrConst A
+    {- ^ __C declaration:__ @const_field7@
+
+         __defined at:__ @macros\/reparse.h 233:19@
+
+         __exported by:__ @macros\/reparse.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Example_struct_with_const where
+
+  staticSizeOf = \_ -> (48 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Example_struct_with_const where
+
+  readRaw =
+    \ptr0 ->
+          pure Example_struct_with_const
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field3") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field4") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field5") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field6") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"example_struct_with_const_const_field7") ptr0
+
+instance Marshal.WriteRaw Example_struct_with_const where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Example_struct_with_const
+            example_struct_with_const_const_field12
+            example_struct_with_const_const_field23
+            example_struct_with_const_const_field34
+            example_struct_with_const_const_field45
+            example_struct_with_const_const_field56
+            example_struct_with_const_const_field67
+            example_struct_with_const_const_field78 ->
+                 HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field1") ptr0 example_struct_with_const_const_field12
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field2") ptr0 example_struct_with_const_const_field23
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field3") ptr0 example_struct_with_const_const_field34
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field4") ptr0 example_struct_with_const_const_field45
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field5") ptr0 example_struct_with_const_const_field56
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field6") ptr0 example_struct_with_const_const_field67
+              >> HasCField.writeRaw (BG.Proxy @"example_struct_with_const_const_field7") ptr0 example_struct_with_const_const_field78
+
+deriving via Marshal.EquivStorable Example_struct_with_const instance BG.Storable Example_struct_with_const
+
+deriving via Struct.IsStructViaReadRaw Example_struct_with_const instance Struct.IsStruct Example_struct_with_const
+
+{-| __C declaration:__ @const_field1@
+
+    __defined at:__ @macros\/reparse.h 227:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ A
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field1" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field1 = y1
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field1" x0
+      )
+
+instance ( ty ~ A
+         ) => BG.HasField "example_struct_with_const_const_field1" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field1")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field1" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field1" =
+    A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_field2@
+
+    __defined at:__ @macros\/reparse.h 228:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ A
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field2" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field2 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field2" x0
+      )
+
+instance ( ty ~ A
+         ) => BG.HasField "example_struct_with_const_const_field2" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field2")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field2" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field2" =
+    A
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @const_field3@
+
+    __defined at:__ @macros\/reparse.h 229:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field3" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field3 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field3" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.HasField "example_struct_with_const_const_field3" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field3")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field3" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field3" =
+    PtrConst.PtrConst A
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @const_field4@
+
+    __defined at:__ @macros\/reparse.h 230:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field4" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field4 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field4" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.HasField "example_struct_with_const_const_field4" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field4")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field4" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field4" =
+    PtrConst.PtrConst A
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @const_field5@
+
+    __defined at:__ @macros\/reparse.h 231:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ BG.Ptr A
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field5" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field5 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field5" x0
+      )
+
+instance ( ty ~ BG.Ptr A
+         ) => BG.HasField "example_struct_with_const_const_field5" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field5")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field5" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field5" =
+    BG.Ptr A
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @const_field6@
+
+    __defined at:__ @macros\/reparse.h 232:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field6" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field6 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field7 = BG.getField @"example_struct_with_const_const_field7" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field6" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.HasField "example_struct_with_const_const_field6" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field6")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field6" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field6" =
+    PtrConst.PtrConst A
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @const_field7@
+
+    __defined at:__ @macros\/reparse.h 233:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.CompatHasField.HasField "example_struct_with_const_const_field7" Example_struct_with_const ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Example_struct_with_const { example_struct_with_const_const_field7 = y1
+                                    , example_struct_with_const_const_field1 = BG.getField @"example_struct_with_const_const_field1" x0
+                                    , example_struct_with_const_const_field2 = BG.getField @"example_struct_with_const_const_field2" x0
+                                    , example_struct_with_const_const_field3 = BG.getField @"example_struct_with_const_const_field3" x0
+                                    , example_struct_with_const_const_field4 = BG.getField @"example_struct_with_const_const_field4" x0
+                                    , example_struct_with_const_const_field5 = BG.getField @"example_struct_with_const_const_field5" x0
+                                    , example_struct_with_const_const_field6 = BG.getField @"example_struct_with_const_const_field6" x0
+                                    }
+      , BG.getField @"example_struct_with_const_const_field7" x0
+      )
+
+instance ( ty ~ PtrConst.PtrConst A
+         ) => BG.HasField "example_struct_with_const_const_field7" (BG.Ptr Example_struct_with_const) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"example_struct_with_const_const_field7")
+
+instance HasCField.HasCField Example_struct_with_const "example_struct_with_const_const_field7" where
+
+  type CFieldType Example_struct_with_const "example_struct_with_const_const_field7" =
+    PtrConst.PtrConst A
+
+  offset# = \_ -> \_ -> 40
+
+{-| Auxiliary type used by 'Const_funptr1'
+
+    __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1_Aux = Const_funptr1_Aux
+  { unwrapConst_funptr1_Aux :: BG.CInt -> BG.CDouble -> IO A
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7f125e20a9d4075b_base ::
+     (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt))
+
+-- __unique:__ @toConst_funptr1_Aux@
+hs_bindgen_7f125e20a9d4075b ::
+     Const_funptr1_Aux
+  -> IO (BG.FunPtr Const_funptr1_Aux)
+hs_bindgen_7f125e20a9d4075b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7f125e20a9d4075b_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr1_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ac4bd8d789bba94b_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> BG.CInt -> BG.CDouble -> IO BG.CInt
+
+-- __unique:__ @fromConst_funptr1_Aux@
+hs_bindgen_ac4bd8d789bba94b ::
+     BG.FunPtr Const_funptr1_Aux
+  -> Const_funptr1_Aux
+hs_bindgen_ac4bd8d789bba94b =
+  \funPtr0 ->
+    Const_funptr1_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_ac4bd8d789bba94b_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr1_Aux where
+
+  toFunPtr = hs_bindgen_7f125e20a9d4075b
+
+instance BG.FromFunPtr Const_funptr1_Aux where
+
+  fromFunPtr = hs_bindgen_ac4bd8d789bba94b
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO A)
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr1_Aux" Const_funptr1_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr1_Aux {unwrapConst_funptr1_Aux = y1}
+      , BG.getField @"unwrapConst_funptr1_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO A)
+         ) => BG.HasField "unwrapConst_funptr1_Aux" (BG.Ptr Const_funptr1_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr1_Aux")
+
+instance HasCField.HasCField Const_funptr1_Aux "unwrapConst_funptr1_Aux" where
+
+  type CFieldType Const_funptr1_Aux "unwrapConst_funptr1_Aux" =
+    BG.CInt -> BG.CDouble -> IO A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1 = Const_funptr1
+  { unwrapConst_funptr1 :: BG.FunPtr Const_funptr1_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr1_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr1" Const_funptr1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr1 {unwrapConst_funptr1 = y1}
+      , BG.getField @"unwrapConst_funptr1" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr1_Aux
+         ) => BG.HasField "unwrapConst_funptr1" (BG.Ptr Const_funptr1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr1")
+
+instance HasCField.HasCField Const_funptr1 "unwrapConst_funptr1" where
+
+  type CFieldType Const_funptr1 "unwrapConst_funptr1" =
+    BG.FunPtr Const_funptr1_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr2'
+
+    __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2_Aux = Const_funptr2_Aux
+  { unwrapConst_funptr2_Aux :: BG.CInt -> BG.CDouble -> IO A
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c7b1e36d845634fb_base ::
+     (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt))
+
+-- __unique:__ @toConst_funptr2_Aux@
+hs_bindgen_c7b1e36d845634fb ::
+     Const_funptr2_Aux
+  -> IO (BG.FunPtr Const_funptr2_Aux)
+hs_bindgen_c7b1e36d845634fb =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c7b1e36d845634fb_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr2_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_352cebf463125ca9_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CInt)
+  -> BG.CInt -> BG.CDouble -> IO BG.CInt
+
+-- __unique:__ @fromConst_funptr2_Aux@
+hs_bindgen_352cebf463125ca9 ::
+     BG.FunPtr Const_funptr2_Aux
+  -> Const_funptr2_Aux
+hs_bindgen_352cebf463125ca9 =
+  \funPtr0 ->
+    Const_funptr2_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_352cebf463125ca9_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr2_Aux where
+
+  toFunPtr = hs_bindgen_c7b1e36d845634fb
+
+instance BG.FromFunPtr Const_funptr2_Aux where
+
+  fromFunPtr = hs_bindgen_352cebf463125ca9
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO A)
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr2_Aux" Const_funptr2_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr2_Aux {unwrapConst_funptr2_Aux = y1}
+      , BG.getField @"unwrapConst_funptr2_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO A)
+         ) => BG.HasField "unwrapConst_funptr2_Aux" (BG.Ptr Const_funptr2_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr2_Aux")
+
+instance HasCField.HasCField Const_funptr2_Aux "unwrapConst_funptr2_Aux" where
+
+  type CFieldType Const_funptr2_Aux "unwrapConst_funptr2_Aux" =
+    BG.CInt -> BG.CDouble -> IO A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2 = Const_funptr2
+  { unwrapConst_funptr2 :: BG.FunPtr Const_funptr2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr2_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr2" Const_funptr2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr2 {unwrapConst_funptr2 = y1}
+      , BG.getField @"unwrapConst_funptr2" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr2_Aux
+         ) => BG.HasField "unwrapConst_funptr2" (BG.Ptr Const_funptr2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr2")
+
+instance HasCField.HasCField Const_funptr2 "unwrapConst_funptr2" where
+
+  type CFieldType Const_funptr2 "unwrapConst_funptr2" =
+    BG.FunPtr Const_funptr2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr3'
+
+    __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3_Aux = Const_funptr3_Aux
+  { unwrapConst_funptr3_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2dcbfe1c2502178c_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr3_Aux@
+hs_bindgen_2dcbfe1c2502178c ::
+     Const_funptr3_Aux
+  -> IO (BG.FunPtr Const_funptr3_Aux)
+hs_bindgen_2dcbfe1c2502178c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_2dcbfe1c2502178c_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr3_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_86738dcfd7c9d33c_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr3_Aux@
+hs_bindgen_86738dcfd7c9d33c ::
+     BG.FunPtr Const_funptr3_Aux
+  -> Const_funptr3_Aux
+hs_bindgen_86738dcfd7c9d33c =
+  \funPtr0 ->
+    Const_funptr3_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_86738dcfd7c9d33c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr3_Aux where
+
+  toFunPtr = hs_bindgen_2dcbfe1c2502178c
+
+instance BG.FromFunPtr Const_funptr3_Aux where
+
+  fromFunPtr = hs_bindgen_86738dcfd7c9d33c
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr3_Aux" Const_funptr3_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr3_Aux {unwrapConst_funptr3_Aux = y1}
+      , BG.getField @"unwrapConst_funptr3_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A))
+         ) => BG.HasField "unwrapConst_funptr3_Aux" (BG.Ptr Const_funptr3_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr3_Aux")
+
+instance HasCField.HasCField Const_funptr3_Aux "unwrapConst_funptr3_Aux" where
+
+  type CFieldType Const_funptr3_Aux "unwrapConst_funptr3_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3 = Const_funptr3
+  { unwrapConst_funptr3 :: BG.FunPtr Const_funptr3_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr3_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr3" Const_funptr3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr3 {unwrapConst_funptr3 = y1}
+      , BG.getField @"unwrapConst_funptr3" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr3_Aux
+         ) => BG.HasField "unwrapConst_funptr3" (BG.Ptr Const_funptr3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr3")
+
+instance HasCField.HasCField Const_funptr3 "unwrapConst_funptr3" where
+
+  type CFieldType Const_funptr3 "unwrapConst_funptr3" =
+    BG.FunPtr Const_funptr3_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr4'
+
+    __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4_Aux = Const_funptr4_Aux
+  { unwrapConst_funptr4_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5461deeda491de0b_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr4_Aux@
+hs_bindgen_5461deeda491de0b ::
+     Const_funptr4_Aux
+  -> IO (BG.FunPtr Const_funptr4_Aux)
+hs_bindgen_5461deeda491de0b =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_5461deeda491de0b_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr4_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_de7846fca3bfd1b6_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr4_Aux@
+hs_bindgen_de7846fca3bfd1b6 ::
+     BG.FunPtr Const_funptr4_Aux
+  -> Const_funptr4_Aux
+hs_bindgen_de7846fca3bfd1b6 =
+  \funPtr0 ->
+    Const_funptr4_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_de7846fca3bfd1b6_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr4_Aux where
+
+  toFunPtr = hs_bindgen_5461deeda491de0b
+
+instance BG.FromFunPtr Const_funptr4_Aux where
+
+  fromFunPtr = hs_bindgen_de7846fca3bfd1b6
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr4_Aux" Const_funptr4_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr4_Aux {unwrapConst_funptr4_Aux = y1}
+      , BG.getField @"unwrapConst_funptr4_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A))
+         ) => BG.HasField "unwrapConst_funptr4_Aux" (BG.Ptr Const_funptr4_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr4_Aux")
+
+instance HasCField.HasCField Const_funptr4_Aux "unwrapConst_funptr4_Aux" where
+
+  type CFieldType Const_funptr4_Aux "unwrapConst_funptr4_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4 = Const_funptr4
+  { unwrapConst_funptr4 :: BG.FunPtr Const_funptr4_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr4_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr4" Const_funptr4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr4 {unwrapConst_funptr4 = y1}
+      , BG.getField @"unwrapConst_funptr4" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr4_Aux
+         ) => BG.HasField "unwrapConst_funptr4" (BG.Ptr Const_funptr4) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr4")
+
+instance HasCField.HasCField Const_funptr4 "unwrapConst_funptr4" where
+
+  type CFieldType Const_funptr4 "unwrapConst_funptr4" =
+    BG.FunPtr Const_funptr4_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr5'
+
+    __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5_Aux = Const_funptr5_Aux
+  { unwrapConst_funptr5_Aux :: BG.CInt -> BG.CDouble -> IO (BG.Ptr A)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7b0174fc978a1ce1_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr5_Aux@
+hs_bindgen_7b0174fc978a1ce1 ::
+     Const_funptr5_Aux
+  -> IO (BG.FunPtr Const_funptr5_Aux)
+hs_bindgen_7b0174fc978a1ce1 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_7b0174fc978a1ce1_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr5_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_38a21d84bb7115b5_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr5_Aux@
+hs_bindgen_38a21d84bb7115b5 ::
+     BG.FunPtr Const_funptr5_Aux
+  -> Const_funptr5_Aux
+hs_bindgen_38a21d84bb7115b5 =
+  \funPtr0 ->
+    Const_funptr5_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_38a21d84bb7115b5_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr5_Aux where
+
+  toFunPtr = hs_bindgen_7b0174fc978a1ce1
+
+instance BG.FromFunPtr Const_funptr5_Aux where
+
+  fromFunPtr = hs_bindgen_38a21d84bb7115b5
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr A))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr5_Aux" Const_funptr5_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr5_Aux {unwrapConst_funptr5_Aux = y1}
+      , BG.getField @"unwrapConst_funptr5_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (BG.Ptr A))
+         ) => BG.HasField "unwrapConst_funptr5_Aux" (BG.Ptr Const_funptr5_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr5_Aux")
+
+instance HasCField.HasCField Const_funptr5_Aux "unwrapConst_funptr5_Aux" where
+
+  type CFieldType Const_funptr5_Aux "unwrapConst_funptr5_Aux" =
+    BG.CInt -> BG.CDouble -> IO (BG.Ptr A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5 = Const_funptr5
+  { unwrapConst_funptr5 :: BG.FunPtr Const_funptr5_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr5_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr5" Const_funptr5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr5 {unwrapConst_funptr5 = y1}
+      , BG.getField @"unwrapConst_funptr5" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr5_Aux
+         ) => BG.HasField "unwrapConst_funptr5" (BG.Ptr Const_funptr5) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr5")
+
+instance HasCField.HasCField Const_funptr5 "unwrapConst_funptr5" where
+
+  type CFieldType Const_funptr5 "unwrapConst_funptr5" =
+    BG.FunPtr Const_funptr5_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr6'
+
+    __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6_Aux = Const_funptr6_Aux
+  { unwrapConst_funptr6_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr6_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_4e32721222f4df9f_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr6_Aux@
+hs_bindgen_4e32721222f4df9f ::
+     Const_funptr6_Aux
+  -> IO (BG.FunPtr Const_funptr6_Aux)
+hs_bindgen_4e32721222f4df9f =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_4e32721222f4df9f_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr6_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr6_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_45251216b04aa8b5_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr6_Aux@
+hs_bindgen_45251216b04aa8b5 ::
+     BG.FunPtr Const_funptr6_Aux
+  -> Const_funptr6_Aux
+hs_bindgen_45251216b04aa8b5 =
+  \funPtr0 ->
+    Const_funptr6_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_45251216b04aa8b5_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr6_Aux where
+
+  toFunPtr = hs_bindgen_4e32721222f4df9f
+
+instance BG.FromFunPtr Const_funptr6_Aux where
+
+  fromFunPtr = hs_bindgen_45251216b04aa8b5
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr6_Aux" Const_funptr6_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr6_Aux {unwrapConst_funptr6_Aux = y1}
+      , BG.getField @"unwrapConst_funptr6_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A))
+         ) => BG.HasField "unwrapConst_funptr6_Aux" (BG.Ptr Const_funptr6_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr6_Aux")
+
+instance HasCField.HasCField Const_funptr6_Aux "unwrapConst_funptr6_Aux" where
+
+  type CFieldType Const_funptr6_Aux "unwrapConst_funptr6_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6 = Const_funptr6
+  { unwrapConst_funptr6 :: BG.FunPtr Const_funptr6_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr6_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr6" Const_funptr6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr6 {unwrapConst_funptr6 = y1}
+      , BG.getField @"unwrapConst_funptr6" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr6_Aux
+         ) => BG.HasField "unwrapConst_funptr6" (BG.Ptr Const_funptr6) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr6")
+
+instance HasCField.HasCField Const_funptr6 "unwrapConst_funptr6" where
+
+  type CFieldType Const_funptr6 "unwrapConst_funptr6" =
+    BG.FunPtr Const_funptr6_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Const_funptr7'
+
+    __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7_Aux = Const_funptr7_Aux
+  { unwrapConst_funptr7_Aux :: BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A)
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toConst_funptr7_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_0d04fc96ffb9de06_base ::
+     (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)))
+
+-- __unique:__ @toConst_funptr7_Aux@
+hs_bindgen_0d04fc96ffb9de06 ::
+     Const_funptr7_Aux
+  -> IO (BG.FunPtr Const_funptr7_Aux)
+hs_bindgen_0d04fc96ffb9de06 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_0d04fc96ffb9de06_base (\x1 ->
+                                                            \x2 ->
+                                                              fmap BG.toFFIType (BG.getField @"unwrapConst_funptr7_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2))))
+
+-- __unique:__ @fromConst_funptr7_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_42fbcebf75a973ba_base ::
+     BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void))
+  -> BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @fromConst_funptr7_Aux@
+hs_bindgen_42fbcebf75a973ba ::
+     BG.FunPtr Const_funptr7_Aux
+  -> Const_funptr7_Aux
+hs_bindgen_42fbcebf75a973ba =
+  \funPtr0 ->
+    Const_funptr7_Aux (\x1 ->
+                         \x2 ->
+                           fmap BG.fromFFIType (hs_bindgen_42fbcebf75a973ba_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2)))
+
+instance BG.ToFunPtr Const_funptr7_Aux where
+
+  toFunPtr = hs_bindgen_0d04fc96ffb9de06
+
+instance BG.FromFunPtr Const_funptr7_Aux where
+
+  fromFunPtr = hs_bindgen_42fbcebf75a973ba
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A))
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr7_Aux" Const_funptr7_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Const_funptr7_Aux {unwrapConst_funptr7_Aux = y1}
+      , BG.getField @"unwrapConst_funptr7_Aux" x0
+      )
+
+instance ( ty ~ (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A))
+         ) => BG.HasField "unwrapConst_funptr7_Aux" (BG.Ptr Const_funptr7_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr7_Aux")
+
+instance HasCField.HasCField Const_funptr7_Aux "unwrapConst_funptr7_Aux" where
+
+  type CFieldType Const_funptr7_Aux "unwrapConst_funptr7_Aux" =
+    BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst A)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7 = Const_funptr7
+  { unwrapConst_funptr7 :: BG.FunPtr Const_funptr7_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Const_funptr7_Aux
+         ) => BG.CompatHasField.HasField "unwrapConst_funptr7" Const_funptr7 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Const_funptr7 {unwrapConst_funptr7 = y1}
+      , BG.getField @"unwrapConst_funptr7" x0
+      )
+
+instance ( ty ~ BG.FunPtr Const_funptr7_Aux
+         ) => BG.HasField "unwrapConst_funptr7" (BG.Ptr Const_funptr7) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapConst_funptr7")
+
+instance HasCField.HasCField Const_funptr7 "unwrapConst_funptr7" where
+
+  type CFieldType Const_funptr7 "unwrapConst_funptr7" =
+    BG.FunPtr Const_funptr7_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Macro-defined types
+
+    __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse.h 278:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype BOOL = BOOL
+  { unwrapBOOL :: BG.CBool
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "unwrapBOOL" BOOL ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BOOL {unwrapBOOL = y1}, BG.getField @"unwrapBOOL" x0)
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "unwrapBOOL" (BG.Ptr BOOL) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapBOOL")
+
+instance HasCField.HasCField BOOL "unwrapBOOL" where
+
+  type CFieldType BOOL "unwrapBOOL" = BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro INT@
+
+    __defined at:__ @macros\/reparse.h 279:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype INT = INT
+  { unwrapINT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapINT" INT ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         INT {unwrapINT = y1}, BG.getField @"unwrapINT" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapINT" (BG.Ptr INT) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapINT")
+
+instance HasCField.HasCField INT "unwrapINT" where
+
+  type CFieldType INT "unwrapINT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro INTP@
+
+    __defined at:__ @macros\/reparse.h 280:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype INTP = INTP
+  { unwrapINTP :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapINTP" INTP ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         INTP {unwrapINTP = y1}, BG.getField @"unwrapINTP" x0)
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrapINTP" (BG.Ptr INTP) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapINTP")
+
+instance HasCField.HasCField INTP "unwrapINTP" where
+
+  type CFieldType INTP "unwrapINTP" = BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro INTCP@
+
+    __defined at:__ @macros\/reparse.h 281:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype INTCP = INTCP
+  { unwrapINTCP :: PtrConst.PtrConst BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapINTCP" INTCP ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         INTCP {unwrapINTCP = y1}, BG.getField @"unwrapINTCP" x0)
+
+instance ( ty ~ PtrConst.PtrConst BG.CInt
+         ) => BG.HasField "unwrapINTCP" (BG.Ptr INTCP) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapINTCP")
+
+instance HasCField.HasCField INTCP "unwrapINTCP" where
+
+  type CFieldType INTCP "unwrapINTCP" =
+    PtrConst.PtrConst BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/Example/FunPtr.hs
@@ -0,0 +1,3339 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.args_char1
+    , Example.FunPtr.args_char2
+    , Example.FunPtr.args_char3
+    , Example.FunPtr.args_short1
+    , Example.FunPtr.args_short2
+    , Example.FunPtr.args_short3
+    , Example.FunPtr.args_int1
+    , Example.FunPtr.args_int2
+    , Example.FunPtr.args_int3
+    , Example.FunPtr.args_long1
+    , Example.FunPtr.args_long2
+    , Example.FunPtr.args_long3
+    , Example.FunPtr.args_float
+    , Example.FunPtr.args_double
+    , Example.FunPtr.args_bool1
+    , Example.FunPtr.args_struct
+    , Example.FunPtr.args_union
+    , Example.FunPtr.args_enum
+    , Example.FunPtr.args_pointer1
+    , Example.FunPtr.args_pointer2
+    , Example.FunPtr.args_pointer3
+    , Example.FunPtr.ret_A
+    , Example.FunPtr.ret_char1
+    , Example.FunPtr.ret_char2
+    , Example.FunPtr.ret_char3
+    , Example.FunPtr.ret_short1
+    , Example.FunPtr.ret_short2
+    , Example.FunPtr.ret_short3
+    , Example.FunPtr.ret_int1
+    , Example.FunPtr.ret_int2
+    , Example.FunPtr.ret_int3
+    , Example.FunPtr.ret_long1
+    , Example.FunPtr.ret_long2
+    , Example.FunPtr.ret_long3
+    , Example.FunPtr.ret_float
+    , Example.FunPtr.ret_double
+    , Example.FunPtr.ret_bool1
+    , Example.FunPtr.ret_struct
+    , Example.FunPtr.ret_union
+    , Example.FunPtr.ret_enum
+    , Example.FunPtr.ret_pointer1
+    , Example.FunPtr.ret_pointer2
+    , Example.FunPtr.ret_pointer3
+    , Example.FunPtr.body1
+    , Example.FunPtr.body2
+    , Example.FunPtr.args_complex_float
+    , Example.FunPtr.args_complex_double
+    , Example.FunPtr.ret_complex_float
+    , Example.FunPtr.ret_complex_double
+    , Example.FunPtr.bespoke_args1
+    , Example.FunPtr.bespoke_args2
+    , Example.FunPtr.bespoke_ret1
+    , Example.FunPtr.bespoke_ret2
+    , Example.FunPtr.arr_args1
+    , Example.FunPtr.arr_args2
+    , Example.FunPtr.arr_args3
+    , Example.FunPtr.arr_args4
+    , Example.FunPtr.funptr_args1
+    , Example.FunPtr.funptr_args2
+    , Example.FunPtr.funptr_args3
+    , Example.FunPtr.funptr_args4
+    , Example.FunPtr.funptr_args5
+    , Example.FunPtr.comments1
+    , Example.FunPtr.const_prim_before1
+    , Example.FunPtr.const_prim_before2
+    , Example.FunPtr.const_prim_before3
+    , Example.FunPtr.const_prim_after1
+    , Example.FunPtr.const_prim_after2
+    , Example.FunPtr.const_prim_after3
+    , Example.FunPtr.const_withoutSign_before1
+    , Example.FunPtr.const_withoutSign_before2
+    , Example.FunPtr.const_withoutSign_before3
+    , Example.FunPtr.const_withoutSign_before4
+    , Example.FunPtr.const_withoutSign_before5
+    , Example.FunPtr.const_withoutSign_before6
+    , Example.FunPtr.const_withoutSign_before7
+    , Example.FunPtr.const_withoutSign_before8
+    , Example.FunPtr.const_withoutSign_after1
+    , Example.FunPtr.const_withoutSign_after2
+    , Example.FunPtr.const_withoutSign_after3
+    , Example.FunPtr.const_withoutSign_after4
+    , Example.FunPtr.const_withoutSign_after5
+    , Example.FunPtr.const_withoutSign_after6
+    , Example.FunPtr.const_withoutSign_after7
+    , Example.FunPtr.const_withoutSign_after8
+    , Example.FunPtr.const_pointers_args1
+    , Example.FunPtr.const_pointers_args2
+    , Example.FunPtr.const_pointers_args3
+    , Example.FunPtr.const_pointers_args4
+    , Example.FunPtr.const_pointers_args5
+    , Example.FunPtr.const_pointers_ret1
+    , Example.FunPtr.const_pointers_ret2
+    , Example.FunPtr.const_pointers_ret3
+    , Example.FunPtr.const_pointers_ret4
+    , Example.FunPtr.const_pointers_ret5
+    , Example.FunPtr.const_array_elem1
+    , Example.FunPtr.const_array_elem2
+    , Example.FunPtr.const_array_elem3
+    , Example.FunPtr.noParams1
+    , Example.FunPtr.noParams2
+    , Example.FunPtr.noParams3
+    , Example.FunPtr.funptr_ret1
+    , Example.FunPtr.funptr_ret2
+    , Example.FunPtr.funptr_ret3
+    , Example.FunPtr.funptr_ret4
+    , Example.FunPtr.funptr_ret5
+    , Example.FunPtr.funptr_ret6
+    , Example.FunPtr.funptr_ret7
+    , Example.FunPtr.funptr_ret8
+    , Example.FunPtr.funptr_ret9
+    , Example.FunPtr.funptr_ret10
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "/* test_macrosreparse_Example_get_args_char1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ba0c80bfdbc677bd (void)) ("
+  , "  A arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  return &args_char1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_char2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b1e8a2d5e3935f61 (void)) ("
+  , "  A arg1,"
+  , "  signed char arg2"
+  , ")"
+  , "{"
+  , "  return &args_char2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_char3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_deb136b9b9d89650 (void)) ("
+  , "  A arg1,"
+  , "  unsigned char arg2"
+  , ")"
+  , "{"
+  , "  return &args_char3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_short1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7a71d1e1867636bf (void)) ("
+  , "  A arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  return &args_short1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_short2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ad7132b76947c638 (void)) ("
+  , "  A arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  return &args_short2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_short3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f4842ac12be0c136 (void)) ("
+  , "  A arg1,"
+  , "  unsigned short arg2"
+  , ")"
+  , "{"
+  , "  return &args_short3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_int1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3dc6ae7bb850c676 (void)) ("
+  , "  A arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &args_int1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_int2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a76cb45502a6ea40 (void)) ("
+  , "  A arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  return &args_int2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_int3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_99f48290fac28118 (void)) ("
+  , "  A arg1,"
+  , "  unsigned int arg2"
+  , ")"
+  , "{"
+  , "  return &args_int3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_long1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_60a477b55893fa8e (void)) ("
+  , "  A arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  return &args_long1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_long2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9ba7a90039c212ea (void)) ("
+  , "  A arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  return &args_long2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_long3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b44cf380afb4d650 (void)) ("
+  , "  A arg1,"
+  , "  unsigned long arg2"
+  , ")"
+  , "{"
+  , "  return &args_long3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_float */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b46cc7463fd36e1a (void)) ("
+  , "  A arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  return &args_float;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_double */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_eb95876c1227b1d6 (void)) ("
+  , "  A arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &args_double;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_bool1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_340ecf91e1edd759 (void)) ("
+  , "  A arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  return &args_bool1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_struct */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_940fccf4ff28ad11 (void)) ("
+  , "  A arg1,"
+  , "  struct some_struct arg2"
+  , ")"
+  , "{"
+  , "  return &args_struct;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_union */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c0ae19f85578b58d (void)) ("
+  , "  A arg1,"
+  , "  union some_union arg2"
+  , ")"
+  , "{"
+  , "  return &args_union;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_enum */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_6f4ca5d36cd98d5e (void)) ("
+  , "  A arg1,"
+  , "  enum some_enum arg2"
+  , ")"
+  , "{"
+  , "  return &args_enum;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_pointer1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8f02d93a83f3e2f3 (void)) ("
+  , "  A arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  return &args_pointer1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_pointer2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3217d3d95482b1ac (void)) ("
+  , "  A arg1,"
+  , "  signed int **arg2"
+  , ")"
+  , "{"
+  , "  return &args_pointer2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_pointer3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_8e680c501eeba095 (void)) ("
+  , "  A arg1,"
+  , "  void *arg2"
+  , ")"
+  , "{"
+  , "  return &args_pointer3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_A */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_dfceb7c79cda3aab (void)) (void)"
+  , "{"
+  , "  return &ret_A;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_char1 */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_d30074ed19081e69 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_char1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_char2 */"
+  , "__attribute__ ((const))"
+  , "signed char (*hs_bindgen_c9a2d554e9d3e7e2 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_char2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_char3 */"
+  , "__attribute__ ((const))"
+  , "unsigned char (*hs_bindgen_261f4f5dd5925788 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_char3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_short1 */"
+  , "__attribute__ ((const))"
+  , "signed short (*hs_bindgen_8d5fba739ef413a8 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_short1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_short2 */"
+  , "__attribute__ ((const))"
+  , "signed short (*hs_bindgen_5dbda022b4ddeeb7 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_short2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_short3 */"
+  , "__attribute__ ((const))"
+  , "unsigned short (*hs_bindgen_8bfdaeda59194c69 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_short3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_int1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_6b977384ffcfa7c6 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_int1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_int2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_cc47d3f794021505 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_int2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_int3 */"
+  , "__attribute__ ((const))"
+  , "unsigned int (*hs_bindgen_488fbaf79c234569 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_int3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_long1 */"
+  , "__attribute__ ((const))"
+  , "signed long (*hs_bindgen_8cf14a89b1268b17 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_long1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_long2 */"
+  , "__attribute__ ((const))"
+  , "signed long (*hs_bindgen_617e98b076d9fd82 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_long2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_long3 */"
+  , "__attribute__ ((const))"
+  , "unsigned long (*hs_bindgen_e1892d8eb6a27221 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_long3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_float */"
+  , "__attribute__ ((const))"
+  , "float (*hs_bindgen_db7561d69f707657 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_float;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_double */"
+  , "__attribute__ ((const))"
+  , "double (*hs_bindgen_e37ad3e87e7cf4de (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_double;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_bool1 */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_07705133d0d853ee (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_bool1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_struct */"
+  , "__attribute__ ((const))"
+  , "struct some_struct (*hs_bindgen_72cf2ef70b845850 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_struct;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_union */"
+  , "__attribute__ ((const))"
+  , "union some_union (*hs_bindgen_fe31acee84b319c8 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_union;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_enum */"
+  , "__attribute__ ((const))"
+  , "enum some_enum (*hs_bindgen_0ec7e00f11946277 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_enum;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_pointer1 */"
+  , "__attribute__ ((const))"
+  , "signed int *(*hs_bindgen_b09c0f340896fe06 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_pointer1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_pointer2 */"
+  , "__attribute__ ((const))"
+  , "signed int **(*hs_bindgen_300fabb661902701 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_pointer2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_pointer3 */"
+  , "__attribute__ ((const))"
+  , "void *(*hs_bindgen_12135a6384fcfda7 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_pointer3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_body1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_f6ce3e885e11b623 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &body1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_body2 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_a7010032c19e6947 (void)) (void)"
+  , "{"
+  , "  return &body2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_complex_float */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b9a5de00354a54fe (void)) ("
+  , "  A arg1,"
+  , "  float _Complex arg2"
+  , ")"
+  , "{"
+  , "  return &args_complex_float;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_args_complex_double */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_824a00413581d46c (void)) ("
+  , "  A arg1,"
+  , "  double _Complex arg2"
+  , ")"
+  , "{"
+  , "  return &args_complex_double;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_complex_float */"
+  , "__attribute__ ((const))"
+  , "float _Complex (*hs_bindgen_685d6c0a58e9b874 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_complex_float;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_ret_complex_double */"
+  , "__attribute__ ((const))"
+  , "double _Complex (*hs_bindgen_0dea6be8e06122eb (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &ret_complex_double;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_bespoke_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_cd799b883e59eadd (void)) ("
+  , "  A arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  return &bespoke_args1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_bespoke_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_eabc3e2c716b0250 (void)) ("
+  , "  A arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &bespoke_args2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_bespoke_ret1 */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_8a47565361a0290f (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &bespoke_ret1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_bespoke_ret2 */"
+  , "__attribute__ ((const))"
+  , "size_t (*hs_bindgen_384c8ceed3a4ca90 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &bespoke_ret2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_arr_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b38b526cf0817bf0 (void)) ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_arr_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2c0bca39b42ecbec (void)) ("
+  , "  A **arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_arr_args3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_82a8c15919ae3f33 (void)) ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_arr_args4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_db074918e0d38cb5 (void)) ("
+  , "  A **arg1"
+  , ")"
+  , "{"
+  , "  return &arr_args4;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3fd6d1fbd060ffcf (void)) ("
+  , "  A arg1,"
+  , "  void (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  return &funptr_args1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_300abb7b10649797 (void)) ("
+  , "  A arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  return &funptr_args2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_args3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_78d109e353e05225 (void)) ("
+  , "  A arg1,"
+  , "  void (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &funptr_args3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_args4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ee1815fa9e1c1131 (void)) ("
+  , "  A arg1,"
+  , "  char (*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &funptr_args4;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_args5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_146c4cb7cf7def11 (void)) ("
+  , "  A arg1,"
+  , "  signed int *(*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  return &funptr_args5;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_comments1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7f647ffb81758d69 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &comments1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_prim_before1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ecf341da5dabe306 (void)) ("
+  , "  A arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_before1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_prim_before2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_a0276bc4dac995c4 (void)) ("
+  , "  A arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_before2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_prim_before3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_1555fc380f4c34ba (void)) ("
+  , "  A arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_before3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_prim_after1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e88405f039754f3c (void)) ("
+  , "  A arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_after1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_prim_after2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d267bc5333a36861 (void)) ("
+  , "  A arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_after2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_prim_after3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0e08cac4148d54cd (void)) ("
+  , "  A arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  return &const_prim_after3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_before1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d7140c03594ba60a (void)) ("
+  , "  A arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_before2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_92134abe381cef04 (void)) ("
+  , "  A arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_before3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b80a2c12f1bdb050 (void)) ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_before4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_aa0ffa330554de35 (void)) ("
+  , "  A arg1,"
+  , "  struct some_struct const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before4;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_before5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f59abb8a7dffe11f (void)) ("
+  , "  A arg1,"
+  , "  union some_union const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before5;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_before6 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0df28ff2ac7fa1e0 (void)) ("
+  , "  A arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before6;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_before7 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fa8c89b169233a6a (void)) ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before7;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_before8 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e707228d3913a299 (void)) ("
+  , "  A arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_before8;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_after1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7e7703a610cd6783 (void)) ("
+  , "  A arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_after2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_988863a241cb28f2 (void)) ("
+  , "  A arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_after3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c8182ee9a3467005 (void)) ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_after4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_de1e4bbac808bcbc (void)) ("
+  , "  A arg1,"
+  , "  struct some_struct const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after4;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_after5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_746fb03c27f16031 (void)) ("
+  , "  A arg1,"
+  , "  union some_union const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after5;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_after6 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dc174ac598e92a95 (void)) ("
+  , "  A arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after6;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_after7 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_2c8ddc46cb100dd9 (void)) ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after7;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_withoutSign_after8 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fdf87fbad31246de (void)) ("
+  , "  A arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  return &const_withoutSign_after8;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_args1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_38808e8aa92d3bcb (void)) ("
+  , "  A arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_args2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_4d37887fd82ab559 (void)) ("
+  , "  A arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_args3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_fd675a45f1682dd5 (void)) ("
+  , "  A arg1,"
+  , "  signed int *const arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_args4 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_824cb2084c63b803 (void)) ("
+  , "  A arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args4;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_args5 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_25bdd13aed8f26c4 (void)) ("
+  , "  A arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  return &const_pointers_args5;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_ret1 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*hs_bindgen_f494124b53592961 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_ret2 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*hs_bindgen_32c4b858ef4f3bb8 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_ret3 */"
+  , "__attribute__ ((const))"
+  , "signed int *const (*hs_bindgen_110afe05c6d47b7c (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_ret4 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*hs_bindgen_042a426acfeaa051 (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret4;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_pointers_ret5 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*hs_bindgen_bc3cdc03ae3274bd (void)) ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return &const_pointers_ret5;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_array_elem1 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_ae95c15a81eacd52 (void)) ("
+  , "  A const *arg1"
+  , ")"
+  , "{"
+  , "  return &const_array_elem1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_array_elem2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9dbbae3758752935 (void)) ("
+  , "  A const **arg1"
+  , ")"
+  , "{"
+  , "  return &const_array_elem2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const_array_elem3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_9fdb904f0c0776ed (void)) ("
+  , "  A *const *arg1"
+  , ")"
+  , "{"
+  , "  return &const_array_elem3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_noParams1 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_cd9806a214acd0fa (void)) (void)"
+  , "{"
+  , "  return &noParams1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_noParams2 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_7c7bf9b5a41ea4a9 (void)) (void)"
+  , "{"
+  , "  return &noParams2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_noParams3 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7f154653725d104d (void)) ("
+  , "  A arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  return &noParams3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret1 */"
+  , "__attribute__ ((const))"
+  , "void (*(*hs_bindgen_4460dd1d93c2df6f (void)) ("
+  , "  A arg1"
+  , ")) (void)"
+  , "{"
+  , "  return &funptr_ret1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*(*hs_bindgen_2b8d04e0fe71178b (void)) ("
+  , "  A arg1"
+  , ")) (void)"
+  , "{"
+  , "  return &funptr_ret2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret3 */"
+  , "__attribute__ ((const))"
+  , "void (*(*hs_bindgen_27d05f98fe1e869b (void)) ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &funptr_ret3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret4 */"
+  , "__attribute__ ((const))"
+  , "char (*(*hs_bindgen_f55fb889881240c6 (void)) ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret4;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret5 */"
+  , "__attribute__ ((const))"
+  , "signed int *(*(*hs_bindgen_e59cbfc52cec7177 (void)) ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret5;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret6 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*(*hs_bindgen_f94486b884c7cd44 (void)) ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret6;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret7 */"
+  , "__attribute__ ((const))"
+  , "signed int const *(*(*hs_bindgen_7810d75b42b3bed8 (void)) ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret7;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret8 */"
+  , "__attribute__ ((const))"
+  , "signed int *const (*(*hs_bindgen_fc12014317abd6b4 (void)) ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret8;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret9 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*(*hs_bindgen_cf3bf1d8470acad4 (void)) ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret9;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_funptr_ret10 */"
+  , "__attribute__ ((const))"
+  , "signed int const *const (*(*hs_bindgen_44a7eb47cf87f092 (void)) ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &funptr_ret10;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_Example_get_args_char1@
+foreign import ccall unsafe "hs_bindgen_ba0c80bfdbc677bd" hs_bindgen_ba0c80bfdbc677bd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_char1@
+hs_bindgen_ba0c80bfdbc677bd :: IO (BG.FunPtr (A -> BG.CChar -> IO ()))
+hs_bindgen_ba0c80bfdbc677bd =
+  fmap BG.fromFFIType hs_bindgen_ba0c80bfdbc677bd_base
+
+{-# NOINLINE args_char1 #-}
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1 :: BG.FunPtr (A -> BG.CChar -> IO ())
+args_char1 =
+  BG.unsafePerformIO hs_bindgen_ba0c80bfdbc677bd
+
+-- __unique:__ @test_macrosreparse_Example_get_args_char2@
+foreign import ccall unsafe "hs_bindgen_b1e8a2d5e3935f61" hs_bindgen_b1e8a2d5e3935f61_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_char2@
+hs_bindgen_b1e8a2d5e3935f61 :: IO (BG.FunPtr (A -> BG.CSChar -> IO ()))
+hs_bindgen_b1e8a2d5e3935f61 =
+  fmap BG.fromFFIType hs_bindgen_b1e8a2d5e3935f61_base
+
+{-# NOINLINE args_char2 #-}
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2 :: BG.FunPtr (A -> BG.CSChar -> IO ())
+args_char2 =
+  BG.unsafePerformIO hs_bindgen_b1e8a2d5e3935f61
+
+-- __unique:__ @test_macrosreparse_Example_get_args_char3@
+foreign import ccall unsafe "hs_bindgen_deb136b9b9d89650" hs_bindgen_deb136b9b9d89650_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_char3@
+hs_bindgen_deb136b9b9d89650 :: IO (BG.FunPtr (A -> BG.CUChar -> IO ()))
+hs_bindgen_deb136b9b9d89650 =
+  fmap BG.fromFFIType hs_bindgen_deb136b9b9d89650_base
+
+{-# NOINLINE args_char3 #-}
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3 :: BG.FunPtr (A -> BG.CUChar -> IO ())
+args_char3 =
+  BG.unsafePerformIO hs_bindgen_deb136b9b9d89650
+
+-- __unique:__ @test_macrosreparse_Example_get_args_short1@
+foreign import ccall unsafe "hs_bindgen_7a71d1e1867636bf" hs_bindgen_7a71d1e1867636bf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_short1@
+hs_bindgen_7a71d1e1867636bf :: IO (BG.FunPtr (A -> BG.CShort -> IO ()))
+hs_bindgen_7a71d1e1867636bf =
+  fmap BG.fromFFIType hs_bindgen_7a71d1e1867636bf_base
+
+{-# NOINLINE args_short1 #-}
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1 :: BG.FunPtr (A -> BG.CShort -> IO ())
+args_short1 =
+  BG.unsafePerformIO hs_bindgen_7a71d1e1867636bf
+
+-- __unique:__ @test_macrosreparse_Example_get_args_short2@
+foreign import ccall unsafe "hs_bindgen_ad7132b76947c638" hs_bindgen_ad7132b76947c638_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_short2@
+hs_bindgen_ad7132b76947c638 :: IO (BG.FunPtr (A -> BG.CShort -> IO ()))
+hs_bindgen_ad7132b76947c638 =
+  fmap BG.fromFFIType hs_bindgen_ad7132b76947c638_base
+
+{-# NOINLINE args_short2 #-}
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2 :: BG.FunPtr (A -> BG.CShort -> IO ())
+args_short2 =
+  BG.unsafePerformIO hs_bindgen_ad7132b76947c638
+
+-- __unique:__ @test_macrosreparse_Example_get_args_short3@
+foreign import ccall unsafe "hs_bindgen_f4842ac12be0c136" hs_bindgen_f4842ac12be0c136_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_short3@
+hs_bindgen_f4842ac12be0c136 :: IO (BG.FunPtr (A -> BG.CUShort -> IO ()))
+hs_bindgen_f4842ac12be0c136 =
+  fmap BG.fromFFIType hs_bindgen_f4842ac12be0c136_base
+
+{-# NOINLINE args_short3 #-}
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3 :: BG.FunPtr (A -> BG.CUShort -> IO ())
+args_short3 =
+  BG.unsafePerformIO hs_bindgen_f4842ac12be0c136
+
+-- __unique:__ @test_macrosreparse_Example_get_args_int1@
+foreign import ccall unsafe "hs_bindgen_3dc6ae7bb850c676" hs_bindgen_3dc6ae7bb850c676_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_int1@
+hs_bindgen_3dc6ae7bb850c676 :: IO (BG.FunPtr (A -> BG.CInt -> IO ()))
+hs_bindgen_3dc6ae7bb850c676 =
+  fmap BG.fromFFIType hs_bindgen_3dc6ae7bb850c676_base
+
+{-# NOINLINE args_int1 #-}
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1 :: BG.FunPtr (A -> BG.CInt -> IO ())
+args_int1 =
+  BG.unsafePerformIO hs_bindgen_3dc6ae7bb850c676
+
+-- __unique:__ @test_macrosreparse_Example_get_args_int2@
+foreign import ccall unsafe "hs_bindgen_a76cb45502a6ea40" hs_bindgen_a76cb45502a6ea40_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_int2@
+hs_bindgen_a76cb45502a6ea40 :: IO (BG.FunPtr (A -> BG.CInt -> IO ()))
+hs_bindgen_a76cb45502a6ea40 =
+  fmap BG.fromFFIType hs_bindgen_a76cb45502a6ea40_base
+
+{-# NOINLINE args_int2 #-}
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2 :: BG.FunPtr (A -> BG.CInt -> IO ())
+args_int2 =
+  BG.unsafePerformIO hs_bindgen_a76cb45502a6ea40
+
+-- __unique:__ @test_macrosreparse_Example_get_args_int3@
+foreign import ccall unsafe "hs_bindgen_99f48290fac28118" hs_bindgen_99f48290fac28118_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_int3@
+hs_bindgen_99f48290fac28118 :: IO (BG.FunPtr (A -> BG.CUInt -> IO ()))
+hs_bindgen_99f48290fac28118 =
+  fmap BG.fromFFIType hs_bindgen_99f48290fac28118_base
+
+{-# NOINLINE args_int3 #-}
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3 :: BG.FunPtr (A -> BG.CUInt -> IO ())
+args_int3 =
+  BG.unsafePerformIO hs_bindgen_99f48290fac28118
+
+-- __unique:__ @test_macrosreparse_Example_get_args_long1@
+foreign import ccall unsafe "hs_bindgen_60a477b55893fa8e" hs_bindgen_60a477b55893fa8e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_long1@
+hs_bindgen_60a477b55893fa8e :: IO (BG.FunPtr (A -> BG.CLong -> IO ()))
+hs_bindgen_60a477b55893fa8e =
+  fmap BG.fromFFIType hs_bindgen_60a477b55893fa8e_base
+
+{-# NOINLINE args_long1 #-}
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1 :: BG.FunPtr (A -> BG.CLong -> IO ())
+args_long1 =
+  BG.unsafePerformIO hs_bindgen_60a477b55893fa8e
+
+-- __unique:__ @test_macrosreparse_Example_get_args_long2@
+foreign import ccall unsafe "hs_bindgen_9ba7a90039c212ea" hs_bindgen_9ba7a90039c212ea_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_long2@
+hs_bindgen_9ba7a90039c212ea :: IO (BG.FunPtr (A -> BG.CLong -> IO ()))
+hs_bindgen_9ba7a90039c212ea =
+  fmap BG.fromFFIType hs_bindgen_9ba7a90039c212ea_base
+
+{-# NOINLINE args_long2 #-}
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2 :: BG.FunPtr (A -> BG.CLong -> IO ())
+args_long2 =
+  BG.unsafePerformIO hs_bindgen_9ba7a90039c212ea
+
+-- __unique:__ @test_macrosreparse_Example_get_args_long3@
+foreign import ccall unsafe "hs_bindgen_b44cf380afb4d650" hs_bindgen_b44cf380afb4d650_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_long3@
+hs_bindgen_b44cf380afb4d650 :: IO (BG.FunPtr (A -> BG.CULong -> IO ()))
+hs_bindgen_b44cf380afb4d650 =
+  fmap BG.fromFFIType hs_bindgen_b44cf380afb4d650_base
+
+{-# NOINLINE args_long3 #-}
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3 :: BG.FunPtr (A -> BG.CULong -> IO ())
+args_long3 =
+  BG.unsafePerformIO hs_bindgen_b44cf380afb4d650
+
+-- __unique:__ @test_macrosreparse_Example_get_args_float@
+foreign import ccall unsafe "hs_bindgen_b46cc7463fd36e1a" hs_bindgen_b46cc7463fd36e1a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_float@
+hs_bindgen_b46cc7463fd36e1a :: IO (BG.FunPtr (A -> BG.CFloat -> IO ()))
+hs_bindgen_b46cc7463fd36e1a =
+  fmap BG.fromFFIType hs_bindgen_b46cc7463fd36e1a_base
+
+{-# NOINLINE args_float #-}
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float :: BG.FunPtr (A -> BG.CFloat -> IO ())
+args_float =
+  BG.unsafePerformIO hs_bindgen_b46cc7463fd36e1a
+
+-- __unique:__ @test_macrosreparse_Example_get_args_double@
+foreign import ccall unsafe "hs_bindgen_eb95876c1227b1d6" hs_bindgen_eb95876c1227b1d6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_double@
+hs_bindgen_eb95876c1227b1d6 :: IO (BG.FunPtr (A -> BG.CDouble -> IO ()))
+hs_bindgen_eb95876c1227b1d6 =
+  fmap BG.fromFFIType hs_bindgen_eb95876c1227b1d6_base
+
+{-# NOINLINE args_double #-}
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double :: BG.FunPtr (A -> BG.CDouble -> IO ())
+args_double =
+  BG.unsafePerformIO hs_bindgen_eb95876c1227b1d6
+
+-- __unique:__ @test_macrosreparse_Example_get_args_bool1@
+foreign import ccall unsafe "hs_bindgen_340ecf91e1edd759" hs_bindgen_340ecf91e1edd759_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_bool1@
+hs_bindgen_340ecf91e1edd759 :: IO (BG.FunPtr (A -> BG.CBool -> IO ()))
+hs_bindgen_340ecf91e1edd759 =
+  fmap BG.fromFFIType hs_bindgen_340ecf91e1edd759_base
+
+{-# NOINLINE args_bool1 #-}
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1 :: BG.FunPtr (A -> BG.CBool -> IO ())
+args_bool1 =
+  BG.unsafePerformIO hs_bindgen_340ecf91e1edd759
+
+-- __unique:__ @test_macrosreparse_Example_get_args_struct@
+foreign import ccall unsafe "hs_bindgen_940fccf4ff28ad11" hs_bindgen_940fccf4ff28ad11_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_struct@
+hs_bindgen_940fccf4ff28ad11 :: IO (BG.FunPtr (A -> Some_struct -> IO ()))
+hs_bindgen_940fccf4ff28ad11 =
+  fmap BG.fromFFIType hs_bindgen_940fccf4ff28ad11_base
+
+{-# NOINLINE args_struct #-}
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct :: BG.FunPtr (A -> Some_struct -> IO ())
+args_struct =
+  BG.unsafePerformIO hs_bindgen_940fccf4ff28ad11
+
+-- __unique:__ @test_macrosreparse_Example_get_args_union@
+foreign import ccall unsafe "hs_bindgen_c0ae19f85578b58d" hs_bindgen_c0ae19f85578b58d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_union@
+hs_bindgen_c0ae19f85578b58d :: IO (BG.FunPtr (A -> Some_union -> IO ()))
+hs_bindgen_c0ae19f85578b58d =
+  fmap BG.fromFFIType hs_bindgen_c0ae19f85578b58d_base
+
+{-# NOINLINE args_union #-}
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union :: BG.FunPtr (A -> Some_union -> IO ())
+args_union =
+  BG.unsafePerformIO hs_bindgen_c0ae19f85578b58d
+
+-- __unique:__ @test_macrosreparse_Example_get_args_enum@
+foreign import ccall unsafe "hs_bindgen_6f4ca5d36cd98d5e" hs_bindgen_6f4ca5d36cd98d5e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_enum@
+hs_bindgen_6f4ca5d36cd98d5e :: IO (BG.FunPtr (A -> Some_enum -> IO ()))
+hs_bindgen_6f4ca5d36cd98d5e =
+  fmap BG.fromFFIType hs_bindgen_6f4ca5d36cd98d5e_base
+
+{-# NOINLINE args_enum #-}
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum :: BG.FunPtr (A -> Some_enum -> IO ())
+args_enum =
+  BG.unsafePerformIO hs_bindgen_6f4ca5d36cd98d5e
+
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_8f02d93a83f3e2f3" hs_bindgen_8f02d93a83f3e2f3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer1@
+hs_bindgen_8f02d93a83f3e2f3 :: IO (BG.FunPtr (A -> BG.Ptr BG.CInt -> IO ()))
+hs_bindgen_8f02d93a83f3e2f3 =
+  fmap BG.fromFFIType hs_bindgen_8f02d93a83f3e2f3_base
+
+{-# NOINLINE args_pointer1 #-}
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1 :: BG.FunPtr (A -> BG.Ptr BG.CInt -> IO ())
+args_pointer1 =
+  BG.unsafePerformIO hs_bindgen_8f02d93a83f3e2f3
+
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_3217d3d95482b1ac" hs_bindgen_3217d3d95482b1ac_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer2@
+hs_bindgen_3217d3d95482b1ac :: IO (BG.FunPtr (A -> BG.Ptr (BG.Ptr BG.CInt) -> IO ()))
+hs_bindgen_3217d3d95482b1ac =
+  fmap BG.fromFFIType hs_bindgen_3217d3d95482b1ac_base
+
+{-# NOINLINE args_pointer2 #-}
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2 :: BG.FunPtr (A -> BG.Ptr (BG.Ptr BG.CInt) -> IO ())
+args_pointer2 =
+  BG.unsafePerformIO hs_bindgen_3217d3d95482b1ac
+
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_8e680c501eeba095" hs_bindgen_8e680c501eeba095_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer3@
+hs_bindgen_8e680c501eeba095 :: IO (BG.FunPtr (A -> BG.Ptr BG.Void -> IO ()))
+hs_bindgen_8e680c501eeba095 =
+  fmap BG.fromFFIType hs_bindgen_8e680c501eeba095_base
+
+{-# NOINLINE args_pointer3 #-}
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3 :: BG.FunPtr (A -> BG.Ptr BG.Void -> IO ())
+args_pointer3 =
+  BG.unsafePerformIO hs_bindgen_8e680c501eeba095
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_A@
+foreign import ccall unsafe "hs_bindgen_dfceb7c79cda3aab" hs_bindgen_dfceb7c79cda3aab_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_A@
+hs_bindgen_dfceb7c79cda3aab :: IO (BG.FunPtr (IO A))
+hs_bindgen_dfceb7c79cda3aab =
+  fmap BG.fromFFIType hs_bindgen_dfceb7c79cda3aab_base
+
+{-# NOINLINE ret_A #-}
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A :: BG.FunPtr (IO A)
+ret_A =
+  BG.unsafePerformIO hs_bindgen_dfceb7c79cda3aab
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_char1@
+foreign import ccall unsafe "hs_bindgen_d30074ed19081e69" hs_bindgen_d30074ed19081e69_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_char1@
+hs_bindgen_d30074ed19081e69 :: IO (BG.FunPtr (A -> IO BG.CChar))
+hs_bindgen_d30074ed19081e69 =
+  fmap BG.fromFFIType hs_bindgen_d30074ed19081e69_base
+
+{-# NOINLINE ret_char1 #-}
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1 :: BG.FunPtr (A -> IO BG.CChar)
+ret_char1 =
+  BG.unsafePerformIO hs_bindgen_d30074ed19081e69
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_char2@
+foreign import ccall unsafe "hs_bindgen_c9a2d554e9d3e7e2" hs_bindgen_c9a2d554e9d3e7e2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_char2@
+hs_bindgen_c9a2d554e9d3e7e2 :: IO (BG.FunPtr (A -> IO BG.CSChar))
+hs_bindgen_c9a2d554e9d3e7e2 =
+  fmap BG.fromFFIType hs_bindgen_c9a2d554e9d3e7e2_base
+
+{-# NOINLINE ret_char2 #-}
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2 :: BG.FunPtr (A -> IO BG.CSChar)
+ret_char2 =
+  BG.unsafePerformIO hs_bindgen_c9a2d554e9d3e7e2
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_char3@
+foreign import ccall unsafe "hs_bindgen_261f4f5dd5925788" hs_bindgen_261f4f5dd5925788_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_char3@
+hs_bindgen_261f4f5dd5925788 :: IO (BG.FunPtr (A -> IO BG.CUChar))
+hs_bindgen_261f4f5dd5925788 =
+  fmap BG.fromFFIType hs_bindgen_261f4f5dd5925788_base
+
+{-# NOINLINE ret_char3 #-}
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3 :: BG.FunPtr (A -> IO BG.CUChar)
+ret_char3 =
+  BG.unsafePerformIO hs_bindgen_261f4f5dd5925788
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_short1@
+foreign import ccall unsafe "hs_bindgen_8d5fba739ef413a8" hs_bindgen_8d5fba739ef413a8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_short1@
+hs_bindgen_8d5fba739ef413a8 :: IO (BG.FunPtr (A -> IO BG.CShort))
+hs_bindgen_8d5fba739ef413a8 =
+  fmap BG.fromFFIType hs_bindgen_8d5fba739ef413a8_base
+
+{-# NOINLINE ret_short1 #-}
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1 :: BG.FunPtr (A -> IO BG.CShort)
+ret_short1 =
+  BG.unsafePerformIO hs_bindgen_8d5fba739ef413a8
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_short2@
+foreign import ccall unsafe "hs_bindgen_5dbda022b4ddeeb7" hs_bindgen_5dbda022b4ddeeb7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_short2@
+hs_bindgen_5dbda022b4ddeeb7 :: IO (BG.FunPtr (A -> IO BG.CShort))
+hs_bindgen_5dbda022b4ddeeb7 =
+  fmap BG.fromFFIType hs_bindgen_5dbda022b4ddeeb7_base
+
+{-# NOINLINE ret_short2 #-}
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2 :: BG.FunPtr (A -> IO BG.CShort)
+ret_short2 =
+  BG.unsafePerformIO hs_bindgen_5dbda022b4ddeeb7
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_short3@
+foreign import ccall unsafe "hs_bindgen_8bfdaeda59194c69" hs_bindgen_8bfdaeda59194c69_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_short3@
+hs_bindgen_8bfdaeda59194c69 :: IO (BG.FunPtr (A -> IO BG.CUShort))
+hs_bindgen_8bfdaeda59194c69 =
+  fmap BG.fromFFIType hs_bindgen_8bfdaeda59194c69_base
+
+{-# NOINLINE ret_short3 #-}
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3 :: BG.FunPtr (A -> IO BG.CUShort)
+ret_short3 =
+  BG.unsafePerformIO hs_bindgen_8bfdaeda59194c69
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_int1@
+foreign import ccall unsafe "hs_bindgen_6b977384ffcfa7c6" hs_bindgen_6b977384ffcfa7c6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_int1@
+hs_bindgen_6b977384ffcfa7c6 :: IO (BG.FunPtr (A -> IO BG.CInt))
+hs_bindgen_6b977384ffcfa7c6 =
+  fmap BG.fromFFIType hs_bindgen_6b977384ffcfa7c6_base
+
+{-# NOINLINE ret_int1 #-}
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1 :: BG.FunPtr (A -> IO BG.CInt)
+ret_int1 =
+  BG.unsafePerformIO hs_bindgen_6b977384ffcfa7c6
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_int2@
+foreign import ccall unsafe "hs_bindgen_cc47d3f794021505" hs_bindgen_cc47d3f794021505_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_int2@
+hs_bindgen_cc47d3f794021505 :: IO (BG.FunPtr (A -> IO BG.CInt))
+hs_bindgen_cc47d3f794021505 =
+  fmap BG.fromFFIType hs_bindgen_cc47d3f794021505_base
+
+{-# NOINLINE ret_int2 #-}
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2 :: BG.FunPtr (A -> IO BG.CInt)
+ret_int2 =
+  BG.unsafePerformIO hs_bindgen_cc47d3f794021505
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_int3@
+foreign import ccall unsafe "hs_bindgen_488fbaf79c234569" hs_bindgen_488fbaf79c234569_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_int3@
+hs_bindgen_488fbaf79c234569 :: IO (BG.FunPtr (A -> IO BG.CUInt))
+hs_bindgen_488fbaf79c234569 =
+  fmap BG.fromFFIType hs_bindgen_488fbaf79c234569_base
+
+{-# NOINLINE ret_int3 #-}
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3 :: BG.FunPtr (A -> IO BG.CUInt)
+ret_int3 =
+  BG.unsafePerformIO hs_bindgen_488fbaf79c234569
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_long1@
+foreign import ccall unsafe "hs_bindgen_8cf14a89b1268b17" hs_bindgen_8cf14a89b1268b17_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_long1@
+hs_bindgen_8cf14a89b1268b17 :: IO (BG.FunPtr (A -> IO BG.CLong))
+hs_bindgen_8cf14a89b1268b17 =
+  fmap BG.fromFFIType hs_bindgen_8cf14a89b1268b17_base
+
+{-# NOINLINE ret_long1 #-}
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1 :: BG.FunPtr (A -> IO BG.CLong)
+ret_long1 =
+  BG.unsafePerformIO hs_bindgen_8cf14a89b1268b17
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_long2@
+foreign import ccall unsafe "hs_bindgen_617e98b076d9fd82" hs_bindgen_617e98b076d9fd82_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_long2@
+hs_bindgen_617e98b076d9fd82 :: IO (BG.FunPtr (A -> IO BG.CLong))
+hs_bindgen_617e98b076d9fd82 =
+  fmap BG.fromFFIType hs_bindgen_617e98b076d9fd82_base
+
+{-# NOINLINE ret_long2 #-}
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2 :: BG.FunPtr (A -> IO BG.CLong)
+ret_long2 =
+  BG.unsafePerformIO hs_bindgen_617e98b076d9fd82
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_long3@
+foreign import ccall unsafe "hs_bindgen_e1892d8eb6a27221" hs_bindgen_e1892d8eb6a27221_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_long3@
+hs_bindgen_e1892d8eb6a27221 :: IO (BG.FunPtr (A -> IO BG.CULong))
+hs_bindgen_e1892d8eb6a27221 =
+  fmap BG.fromFFIType hs_bindgen_e1892d8eb6a27221_base
+
+{-# NOINLINE ret_long3 #-}
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3 :: BG.FunPtr (A -> IO BG.CULong)
+ret_long3 =
+  BG.unsafePerformIO hs_bindgen_e1892d8eb6a27221
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_float@
+foreign import ccall unsafe "hs_bindgen_db7561d69f707657" hs_bindgen_db7561d69f707657_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_float@
+hs_bindgen_db7561d69f707657 :: IO (BG.FunPtr (A -> IO BG.CFloat))
+hs_bindgen_db7561d69f707657 =
+  fmap BG.fromFFIType hs_bindgen_db7561d69f707657_base
+
+{-# NOINLINE ret_float #-}
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float :: BG.FunPtr (A -> IO BG.CFloat)
+ret_float =
+  BG.unsafePerformIO hs_bindgen_db7561d69f707657
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_double@
+foreign import ccall unsafe "hs_bindgen_e37ad3e87e7cf4de" hs_bindgen_e37ad3e87e7cf4de_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_double@
+hs_bindgen_e37ad3e87e7cf4de :: IO (BG.FunPtr (A -> IO BG.CDouble))
+hs_bindgen_e37ad3e87e7cf4de =
+  fmap BG.fromFFIType hs_bindgen_e37ad3e87e7cf4de_base
+
+{-# NOINLINE ret_double #-}
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double :: BG.FunPtr (A -> IO BG.CDouble)
+ret_double =
+  BG.unsafePerformIO hs_bindgen_e37ad3e87e7cf4de
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_07705133d0d853ee" hs_bindgen_07705133d0d853ee_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_bool1@
+hs_bindgen_07705133d0d853ee :: IO (BG.FunPtr (A -> IO BG.CBool))
+hs_bindgen_07705133d0d853ee =
+  fmap BG.fromFFIType hs_bindgen_07705133d0d853ee_base
+
+{-# NOINLINE ret_bool1 #-}
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1 :: BG.FunPtr (A -> IO BG.CBool)
+ret_bool1 =
+  BG.unsafePerformIO hs_bindgen_07705133d0d853ee
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_struct@
+foreign import ccall unsafe "hs_bindgen_72cf2ef70b845850" hs_bindgen_72cf2ef70b845850_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_struct@
+hs_bindgen_72cf2ef70b845850 :: IO (BG.FunPtr (A -> IO Some_struct))
+hs_bindgen_72cf2ef70b845850 =
+  fmap BG.fromFFIType hs_bindgen_72cf2ef70b845850_base
+
+{-# NOINLINE ret_struct #-}
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct :: BG.FunPtr (A -> IO Some_struct)
+ret_struct =
+  BG.unsafePerformIO hs_bindgen_72cf2ef70b845850
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_union@
+foreign import ccall unsafe "hs_bindgen_fe31acee84b319c8" hs_bindgen_fe31acee84b319c8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_union@
+hs_bindgen_fe31acee84b319c8 :: IO (BG.FunPtr (A -> IO Some_union))
+hs_bindgen_fe31acee84b319c8 =
+  fmap BG.fromFFIType hs_bindgen_fe31acee84b319c8_base
+
+{-# NOINLINE ret_union #-}
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union :: BG.FunPtr (A -> IO Some_union)
+ret_union =
+  BG.unsafePerformIO hs_bindgen_fe31acee84b319c8
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_enum@
+foreign import ccall unsafe "hs_bindgen_0ec7e00f11946277" hs_bindgen_0ec7e00f11946277_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_enum@
+hs_bindgen_0ec7e00f11946277 :: IO (BG.FunPtr (A -> IO Some_enum))
+hs_bindgen_0ec7e00f11946277 =
+  fmap BG.fromFFIType hs_bindgen_0ec7e00f11946277_base
+
+{-# NOINLINE ret_enum #-}
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum :: BG.FunPtr (A -> IO Some_enum)
+ret_enum =
+  BG.unsafePerformIO hs_bindgen_0ec7e00f11946277
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_b09c0f340896fe06" hs_bindgen_b09c0f340896fe06_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer1@
+hs_bindgen_b09c0f340896fe06 :: IO (BG.FunPtr (A -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_b09c0f340896fe06 =
+  fmap BG.fromFFIType hs_bindgen_b09c0f340896fe06_base
+
+{-# NOINLINE ret_pointer1 #-}
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1 :: BG.FunPtr (A -> IO (BG.Ptr BG.CInt))
+ret_pointer1 =
+  BG.unsafePerformIO hs_bindgen_b09c0f340896fe06
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_300fabb661902701" hs_bindgen_300fabb661902701_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer2@
+hs_bindgen_300fabb661902701 :: IO (BG.FunPtr (A -> IO (BG.Ptr (BG.Ptr BG.CInt))))
+hs_bindgen_300fabb661902701 =
+  fmap BG.fromFFIType hs_bindgen_300fabb661902701_base
+
+{-# NOINLINE ret_pointer2 #-}
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2 :: BG.FunPtr (A -> IO (BG.Ptr (BG.Ptr BG.CInt)))
+ret_pointer2 =
+  BG.unsafePerformIO hs_bindgen_300fabb661902701
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_12135a6384fcfda7" hs_bindgen_12135a6384fcfda7_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer3@
+hs_bindgen_12135a6384fcfda7 :: IO (BG.FunPtr (A -> IO (BG.Ptr BG.Void)))
+hs_bindgen_12135a6384fcfda7 =
+  fmap BG.fromFFIType hs_bindgen_12135a6384fcfda7_base
+
+{-# NOINLINE ret_pointer3 #-}
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3 :: BG.FunPtr (A -> IO (BG.Ptr BG.Void))
+ret_pointer3 =
+  BG.unsafePerformIO hs_bindgen_12135a6384fcfda7
+
+-- __unique:__ @test_macrosreparse_Example_get_body1@
+foreign import ccall unsafe "hs_bindgen_f6ce3e885e11b623" hs_bindgen_f6ce3e885e11b623_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_body1@
+hs_bindgen_f6ce3e885e11b623 :: IO (BG.FunPtr (A -> IO BG.CInt))
+hs_bindgen_f6ce3e885e11b623 =
+  fmap BG.fromFFIType hs_bindgen_f6ce3e885e11b623_base
+
+{-# NOINLINE body1 #-}
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1 :: BG.FunPtr (A -> IO BG.CInt)
+body1 =
+  BG.unsafePerformIO hs_bindgen_f6ce3e885e11b623
+
+-- __unique:__ @test_macrosreparse_Example_get_body2@
+foreign import ccall unsafe "hs_bindgen_a7010032c19e6947" hs_bindgen_a7010032c19e6947_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_body2@
+hs_bindgen_a7010032c19e6947 :: IO (BG.FunPtr (IO A))
+hs_bindgen_a7010032c19e6947 =
+  fmap BG.fromFFIType hs_bindgen_a7010032c19e6947_base
+
+{-# NOINLINE body2 #-}
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2 :: BG.FunPtr (IO A)
+body2 =
+  BG.unsafePerformIO hs_bindgen_a7010032c19e6947
+
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_b9a5de00354a54fe" hs_bindgen_b9a5de00354a54fe_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_float@
+hs_bindgen_b9a5de00354a54fe :: IO (BG.FunPtr (A -> BG.Complex BG.CFloat -> IO ()))
+hs_bindgen_b9a5de00354a54fe =
+  fmap BG.fromFFIType hs_bindgen_b9a5de00354a54fe_base
+
+{-# NOINLINE args_complex_float #-}
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float :: BG.FunPtr (A -> BG.Complex BG.CFloat -> IO ())
+args_complex_float =
+  BG.unsafePerformIO hs_bindgen_b9a5de00354a54fe
+
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_824a00413581d46c" hs_bindgen_824a00413581d46c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_double@
+hs_bindgen_824a00413581d46c :: IO (BG.FunPtr (A -> BG.Complex BG.CDouble -> IO ()))
+hs_bindgen_824a00413581d46c =
+  fmap BG.fromFFIType hs_bindgen_824a00413581d46c_base
+
+{-# NOINLINE args_complex_double #-}
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double :: BG.FunPtr (A -> BG.Complex BG.CDouble -> IO ())
+args_complex_double =
+  BG.unsafePerformIO hs_bindgen_824a00413581d46c
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_685d6c0a58e9b874" hs_bindgen_685d6c0a58e9b874_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_float@
+hs_bindgen_685d6c0a58e9b874 :: IO (BG.FunPtr (A -> IO (BG.Complex BG.CFloat)))
+hs_bindgen_685d6c0a58e9b874 =
+  fmap BG.fromFFIType hs_bindgen_685d6c0a58e9b874_base
+
+{-# NOINLINE ret_complex_float #-}
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float :: BG.FunPtr (A -> IO (BG.Complex BG.CFloat))
+ret_complex_float =
+  BG.unsafePerformIO hs_bindgen_685d6c0a58e9b874
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_0dea6be8e06122eb" hs_bindgen_0dea6be8e06122eb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_double@
+hs_bindgen_0dea6be8e06122eb :: IO (BG.FunPtr (A -> IO (BG.Complex BG.CDouble)))
+hs_bindgen_0dea6be8e06122eb =
+  fmap BG.fromFFIType hs_bindgen_0dea6be8e06122eb_base
+
+{-# NOINLINE ret_complex_double #-}
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double :: BG.FunPtr (A -> IO (BG.Complex BG.CDouble))
+ret_complex_double =
+  BG.unsafePerformIO hs_bindgen_0dea6be8e06122eb
+
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_cd799b883e59eadd" hs_bindgen_cd799b883e59eadd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args1@
+hs_bindgen_cd799b883e59eadd :: IO (BG.FunPtr (A -> BG.CBool -> IO ()))
+hs_bindgen_cd799b883e59eadd =
+  fmap BG.fromFFIType hs_bindgen_cd799b883e59eadd_base
+
+{-# NOINLINE bespoke_args1 #-}
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1 :: BG.FunPtr (A -> BG.CBool -> IO ())
+bespoke_args1 =
+  BG.unsafePerformIO hs_bindgen_cd799b883e59eadd
+
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_eabc3e2c716b0250" hs_bindgen_eabc3e2c716b0250_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args2@
+hs_bindgen_eabc3e2c716b0250 :: IO (BG.FunPtr (A -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_eabc3e2c716b0250 =
+  fmap BG.fromFFIType hs_bindgen_eabc3e2c716b0250_base
+
+{-# NOINLINE bespoke_args2 #-}
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2 :: BG.FunPtr (A -> HsBindgen.Runtime.LibC.CSize -> IO ())
+bespoke_args2 =
+  BG.unsafePerformIO hs_bindgen_eabc3e2c716b0250
+
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_8a47565361a0290f" hs_bindgen_8a47565361a0290f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret1@
+hs_bindgen_8a47565361a0290f :: IO (BG.FunPtr (A -> IO BG.CBool))
+hs_bindgen_8a47565361a0290f =
+  fmap BG.fromFFIType hs_bindgen_8a47565361a0290f_base
+
+{-# NOINLINE bespoke_ret1 #-}
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1 :: BG.FunPtr (A -> IO BG.CBool)
+bespoke_ret1 =
+  BG.unsafePerformIO hs_bindgen_8a47565361a0290f
+
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_384c8ceed3a4ca90" hs_bindgen_384c8ceed3a4ca90_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret2@
+hs_bindgen_384c8ceed3a4ca90 :: IO (BG.FunPtr (A -> IO HsBindgen.Runtime.LibC.CSize))
+hs_bindgen_384c8ceed3a4ca90 =
+  fmap BG.fromFFIType hs_bindgen_384c8ceed3a4ca90_base
+
+{-# NOINLINE bespoke_ret2 #-}
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2 :: BG.FunPtr (A -> IO HsBindgen.Runtime.LibC.CSize)
+bespoke_ret2 =
+  BG.unsafePerformIO hs_bindgen_384c8ceed3a4ca90
+
+-- __unique:__ @test_macrosreparse_Example_get_arr_args1@
+foreign import ccall unsafe "hs_bindgen_b38b526cf0817bf0" hs_bindgen_b38b526cf0817bf0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_arr_args1@
+hs_bindgen_b38b526cf0817bf0 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray A)) -> IO ()))
+hs_bindgen_b38b526cf0817bf0 =
+  fmap BG.fromFFIType hs_bindgen_b38b526cf0817bf0_base
+
+{-# NOINLINE arr_args1 #-}
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray A)) -> IO ())
+arr_args1 =
+  BG.unsafePerformIO hs_bindgen_b38b526cf0817bf0
+
+-- __unique:__ @test_macrosreparse_Example_get_arr_args2@
+foreign import ccall unsafe "hs_bindgen_2c0bca39b42ecbec" hs_bindgen_2c0bca39b42ecbec_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_arr_args2@
+hs_bindgen_2c0bca39b42ecbec :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr A))) -> IO ()))
+hs_bindgen_2c0bca39b42ecbec =
+  fmap BG.fromFFIType hs_bindgen_2c0bca39b42ecbec_base
+
+{-# NOINLINE arr_args2 #-}
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr A))) -> IO ())
+arr_args2 =
+  BG.unsafePerformIO hs_bindgen_2c0bca39b42ecbec
+
+-- __unique:__ @test_macrosreparse_Example_get_arr_args3@
+foreign import ccall unsafe "hs_bindgen_82a8c15919ae3f33" hs_bindgen_82a8c15919ae3f33_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_arr_args3@
+hs_bindgen_82a8c15919ae3f33 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 A)) -> IO ()))
+hs_bindgen_82a8c15919ae3f33 =
+  fmap BG.fromFFIType hs_bindgen_82a8c15919ae3f33_base
+
+{-# NOINLINE arr_args3 #-}
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3 :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 A)) -> IO ())
+arr_args3 =
+  BG.unsafePerformIO hs_bindgen_82a8c15919ae3f33
+
+-- __unique:__ @test_macrosreparse_Example_get_arr_args4@
+foreign import ccall unsafe "hs_bindgen_db074918e0d38cb5" hs_bindgen_db074918e0d38cb5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_arr_args4@
+hs_bindgen_db074918e0d38cb5 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr A))) -> IO ()))
+hs_bindgen_db074918e0d38cb5 =
+  fmap BG.fromFFIType hs_bindgen_db074918e0d38cb5_base
+
+{-# NOINLINE arr_args4 #-}
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4 :: BG.FunPtr (BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr A))) -> IO ())
+arr_args4 =
+  BG.unsafePerformIO hs_bindgen_db074918e0d38cb5
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_3fd6d1fbd060ffcf" hs_bindgen_3fd6d1fbd060ffcf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args1@
+hs_bindgen_3fd6d1fbd060ffcf :: IO (BG.FunPtr (A -> BG.FunPtr (IO ()) -> IO ()))
+hs_bindgen_3fd6d1fbd060ffcf =
+  fmap BG.fromFFIType hs_bindgen_3fd6d1fbd060ffcf_base
+
+{-# NOINLINE funptr_args1 #-}
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1 :: BG.FunPtr (A -> BG.FunPtr (IO ()) -> IO ())
+funptr_args1 =
+  BG.unsafePerformIO hs_bindgen_3fd6d1fbd060ffcf
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_300abb7b10649797" hs_bindgen_300abb7b10649797_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args2@
+hs_bindgen_300abb7b10649797 :: IO (BG.FunPtr (A -> BG.FunPtr (IO BG.CInt) -> IO ()))
+hs_bindgen_300abb7b10649797 =
+  fmap BG.fromFFIType hs_bindgen_300abb7b10649797_base
+
+{-# NOINLINE funptr_args2 #-}
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2 :: BG.FunPtr (A -> BG.FunPtr (IO BG.CInt) -> IO ())
+funptr_args2 =
+  BG.unsafePerformIO hs_bindgen_300abb7b10649797
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_78d109e353e05225" hs_bindgen_78d109e353e05225_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args3@
+hs_bindgen_78d109e353e05225 :: IO (BG.FunPtr (A -> BG.FunPtr (BG.CInt -> IO ()) -> IO ()))
+hs_bindgen_78d109e353e05225 =
+  fmap BG.fromFFIType hs_bindgen_78d109e353e05225_base
+
+{-# NOINLINE funptr_args3 #-}
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3 :: BG.FunPtr (A -> BG.FunPtr (BG.CInt -> IO ()) -> IO ())
+funptr_args3 =
+  BG.unsafePerformIO hs_bindgen_78d109e353e05225
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_ee1815fa9e1c1131" hs_bindgen_ee1815fa9e1c1131_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args4@
+hs_bindgen_ee1815fa9e1c1131 :: IO (BG.FunPtr (A -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar) -> IO ()))
+hs_bindgen_ee1815fa9e1c1131 =
+  fmap BG.fromFFIType hs_bindgen_ee1815fa9e1c1131_base
+
+{-# NOINLINE funptr_args4 #-}
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4 :: BG.FunPtr (A -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar) -> IO ())
+funptr_args4 =
+  BG.unsafePerformIO hs_bindgen_ee1815fa9e1c1131
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_146c4cb7cf7def11" hs_bindgen_146c4cb7cf7def11_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args5@
+hs_bindgen_146c4cb7cf7def11 :: IO (BG.FunPtr (A -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)) -> IO ()))
+hs_bindgen_146c4cb7cf7def11 =
+  fmap BG.fromFFIType hs_bindgen_146c4cb7cf7def11_base
+
+{-# NOINLINE funptr_args5 #-}
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5 :: BG.FunPtr (A -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)) -> IO ())
+funptr_args5 =
+  BG.unsafePerformIO hs_bindgen_146c4cb7cf7def11
+
+-- __unique:__ @test_macrosreparse_Example_get_comments1@
+foreign import ccall unsafe "hs_bindgen_7f647ffb81758d69" hs_bindgen_7f647ffb81758d69_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_comments1@
+hs_bindgen_7f647ffb81758d69 :: IO (BG.FunPtr (A -> IO ()))
+hs_bindgen_7f647ffb81758d69 =
+  fmap BG.fromFFIType hs_bindgen_7f647ffb81758d69_base
+
+{-# NOINLINE comments1 #-}
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1 :: BG.FunPtr (A -> IO ())
+comments1 =
+  BG.unsafePerformIO hs_bindgen_7f647ffb81758d69
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_ecf341da5dabe306" hs_bindgen_ecf341da5dabe306_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before1@
+hs_bindgen_ecf341da5dabe306 :: IO (BG.FunPtr (A -> BG.CChar -> IO ()))
+hs_bindgen_ecf341da5dabe306 =
+  fmap BG.fromFFIType hs_bindgen_ecf341da5dabe306_base
+
+{-# NOINLINE const_prim_before1 #-}
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1 :: BG.FunPtr (A -> BG.CChar -> IO ())
+const_prim_before1 =
+  BG.unsafePerformIO hs_bindgen_ecf341da5dabe306
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_a0276bc4dac995c4" hs_bindgen_a0276bc4dac995c4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before2@
+hs_bindgen_a0276bc4dac995c4 :: IO (BG.FunPtr (A -> BG.CSChar -> IO ()))
+hs_bindgen_a0276bc4dac995c4 =
+  fmap BG.fromFFIType hs_bindgen_a0276bc4dac995c4_base
+
+{-# NOINLINE const_prim_before2 #-}
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2 :: BG.FunPtr (A -> BG.CSChar -> IO ())
+const_prim_before2 =
+  BG.unsafePerformIO hs_bindgen_a0276bc4dac995c4
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_1555fc380f4c34ba" hs_bindgen_1555fc380f4c34ba_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before3@
+hs_bindgen_1555fc380f4c34ba :: IO (BG.FunPtr (A -> BG.CUChar -> IO ()))
+hs_bindgen_1555fc380f4c34ba =
+  fmap BG.fromFFIType hs_bindgen_1555fc380f4c34ba_base
+
+{-# NOINLINE const_prim_before3 #-}
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3 :: BG.FunPtr (A -> BG.CUChar -> IO ())
+const_prim_before3 =
+  BG.unsafePerformIO hs_bindgen_1555fc380f4c34ba
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_e88405f039754f3c" hs_bindgen_e88405f039754f3c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after1@
+hs_bindgen_e88405f039754f3c :: IO (BG.FunPtr (A -> BG.CChar -> IO ()))
+hs_bindgen_e88405f039754f3c =
+  fmap BG.fromFFIType hs_bindgen_e88405f039754f3c_base
+
+{-# NOINLINE const_prim_after1 #-}
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1 :: BG.FunPtr (A -> BG.CChar -> IO ())
+const_prim_after1 =
+  BG.unsafePerformIO hs_bindgen_e88405f039754f3c
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_d267bc5333a36861" hs_bindgen_d267bc5333a36861_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after2@
+hs_bindgen_d267bc5333a36861 :: IO (BG.FunPtr (A -> BG.CSChar -> IO ()))
+hs_bindgen_d267bc5333a36861 =
+  fmap BG.fromFFIType hs_bindgen_d267bc5333a36861_base
+
+{-# NOINLINE const_prim_after2 #-}
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2 :: BG.FunPtr (A -> BG.CSChar -> IO ())
+const_prim_after2 =
+  BG.unsafePerformIO hs_bindgen_d267bc5333a36861
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_0e08cac4148d54cd" hs_bindgen_0e08cac4148d54cd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after3@
+hs_bindgen_0e08cac4148d54cd :: IO (BG.FunPtr (A -> BG.CUChar -> IO ()))
+hs_bindgen_0e08cac4148d54cd =
+  fmap BG.fromFFIType hs_bindgen_0e08cac4148d54cd_base
+
+{-# NOINLINE const_prim_after3 #-}
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3 :: BG.FunPtr (A -> BG.CUChar -> IO ())
+const_prim_after3 =
+  BG.unsafePerformIO hs_bindgen_0e08cac4148d54cd
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_d7140c03594ba60a" hs_bindgen_d7140c03594ba60a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before1@
+hs_bindgen_d7140c03594ba60a :: IO (BG.FunPtr (A -> BG.CFloat -> IO ()))
+hs_bindgen_d7140c03594ba60a =
+  fmap BG.fromFFIType hs_bindgen_d7140c03594ba60a_base
+
+{-# NOINLINE const_withoutSign_before1 #-}
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1 :: BG.FunPtr (A -> BG.CFloat -> IO ())
+const_withoutSign_before1 =
+  BG.unsafePerformIO hs_bindgen_d7140c03594ba60a
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_92134abe381cef04" hs_bindgen_92134abe381cef04_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before2@
+hs_bindgen_92134abe381cef04 :: IO (BG.FunPtr (A -> BG.CDouble -> IO ()))
+hs_bindgen_92134abe381cef04 =
+  fmap BG.fromFFIType hs_bindgen_92134abe381cef04_base
+
+{-# NOINLINE const_withoutSign_before2 #-}
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2 :: BG.FunPtr (A -> BG.CDouble -> IO ())
+const_withoutSign_before2 =
+  BG.unsafePerformIO hs_bindgen_92134abe381cef04
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_b80a2c12f1bdb050" hs_bindgen_b80a2c12f1bdb050_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before3@
+hs_bindgen_b80a2c12f1bdb050 :: IO (BG.FunPtr (A -> BG.CBool -> IO ()))
+hs_bindgen_b80a2c12f1bdb050 =
+  fmap BG.fromFFIType hs_bindgen_b80a2c12f1bdb050_base
+
+{-# NOINLINE const_withoutSign_before3 #-}
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3 :: BG.FunPtr (A -> BG.CBool -> IO ())
+const_withoutSign_before3 =
+  BG.unsafePerformIO hs_bindgen_b80a2c12f1bdb050
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_aa0ffa330554de35" hs_bindgen_aa0ffa330554de35_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before4@
+hs_bindgen_aa0ffa330554de35 :: IO (BG.FunPtr (A -> Some_struct -> IO ()))
+hs_bindgen_aa0ffa330554de35 =
+  fmap BG.fromFFIType hs_bindgen_aa0ffa330554de35_base
+
+{-# NOINLINE const_withoutSign_before4 #-}
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4 :: BG.FunPtr (A -> Some_struct -> IO ())
+const_withoutSign_before4 =
+  BG.unsafePerformIO hs_bindgen_aa0ffa330554de35
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_f59abb8a7dffe11f" hs_bindgen_f59abb8a7dffe11f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before5@
+hs_bindgen_f59abb8a7dffe11f :: IO (BG.FunPtr (A -> Some_union -> IO ()))
+hs_bindgen_f59abb8a7dffe11f =
+  fmap BG.fromFFIType hs_bindgen_f59abb8a7dffe11f_base
+
+{-# NOINLINE const_withoutSign_before5 #-}
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5 :: BG.FunPtr (A -> Some_union -> IO ())
+const_withoutSign_before5 =
+  BG.unsafePerformIO hs_bindgen_f59abb8a7dffe11f
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_0df28ff2ac7fa1e0" hs_bindgen_0df28ff2ac7fa1e0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before6@
+hs_bindgen_0df28ff2ac7fa1e0 :: IO (BG.FunPtr (A -> Some_enum -> IO ()))
+hs_bindgen_0df28ff2ac7fa1e0 =
+  fmap BG.fromFFIType hs_bindgen_0df28ff2ac7fa1e0_base
+
+{-# NOINLINE const_withoutSign_before6 #-}
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6 :: BG.FunPtr (A -> Some_enum -> IO ())
+const_withoutSign_before6 =
+  BG.unsafePerformIO hs_bindgen_0df28ff2ac7fa1e0
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_fa8c89b169233a6a" hs_bindgen_fa8c89b169233a6a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before7@
+hs_bindgen_fa8c89b169233a6a :: IO (BG.FunPtr (A -> BG.CBool -> IO ()))
+hs_bindgen_fa8c89b169233a6a =
+  fmap BG.fromFFIType hs_bindgen_fa8c89b169233a6a_base
+
+{-# NOINLINE const_withoutSign_before7 #-}
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7 :: BG.FunPtr (A -> BG.CBool -> IO ())
+const_withoutSign_before7 =
+  BG.unsafePerformIO hs_bindgen_fa8c89b169233a6a
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_e707228d3913a299" hs_bindgen_e707228d3913a299_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before8@
+hs_bindgen_e707228d3913a299 :: IO (BG.FunPtr (A -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_e707228d3913a299 =
+  fmap BG.fromFFIType hs_bindgen_e707228d3913a299_base
+
+{-# NOINLINE const_withoutSign_before8 #-}
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8 :: BG.FunPtr (A -> HsBindgen.Runtime.LibC.CSize -> IO ())
+const_withoutSign_before8 =
+  BG.unsafePerformIO hs_bindgen_e707228d3913a299
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_7e7703a610cd6783" hs_bindgen_7e7703a610cd6783_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after1@
+hs_bindgen_7e7703a610cd6783 :: IO (BG.FunPtr (A -> BG.CFloat -> IO ()))
+hs_bindgen_7e7703a610cd6783 =
+  fmap BG.fromFFIType hs_bindgen_7e7703a610cd6783_base
+
+{-# NOINLINE const_withoutSign_after1 #-}
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1 :: BG.FunPtr (A -> BG.CFloat -> IO ())
+const_withoutSign_after1 =
+  BG.unsafePerformIO hs_bindgen_7e7703a610cd6783
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_988863a241cb28f2" hs_bindgen_988863a241cb28f2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after2@
+hs_bindgen_988863a241cb28f2 :: IO (BG.FunPtr (A -> BG.CDouble -> IO ()))
+hs_bindgen_988863a241cb28f2 =
+  fmap BG.fromFFIType hs_bindgen_988863a241cb28f2_base
+
+{-# NOINLINE const_withoutSign_after2 #-}
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2 :: BG.FunPtr (A -> BG.CDouble -> IO ())
+const_withoutSign_after2 =
+  BG.unsafePerformIO hs_bindgen_988863a241cb28f2
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_c8182ee9a3467005" hs_bindgen_c8182ee9a3467005_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after3@
+hs_bindgen_c8182ee9a3467005 :: IO (BG.FunPtr (A -> BG.CBool -> IO ()))
+hs_bindgen_c8182ee9a3467005 =
+  fmap BG.fromFFIType hs_bindgen_c8182ee9a3467005_base
+
+{-# NOINLINE const_withoutSign_after3 #-}
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3 :: BG.FunPtr (A -> BG.CBool -> IO ())
+const_withoutSign_after3 =
+  BG.unsafePerformIO hs_bindgen_c8182ee9a3467005
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_de1e4bbac808bcbc" hs_bindgen_de1e4bbac808bcbc_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after4@
+hs_bindgen_de1e4bbac808bcbc :: IO (BG.FunPtr (A -> Some_struct -> IO ()))
+hs_bindgen_de1e4bbac808bcbc =
+  fmap BG.fromFFIType hs_bindgen_de1e4bbac808bcbc_base
+
+{-# NOINLINE const_withoutSign_after4 #-}
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4 :: BG.FunPtr (A -> Some_struct -> IO ())
+const_withoutSign_after4 =
+  BG.unsafePerformIO hs_bindgen_de1e4bbac808bcbc
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_746fb03c27f16031" hs_bindgen_746fb03c27f16031_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after5@
+hs_bindgen_746fb03c27f16031 :: IO (BG.FunPtr (A -> Some_union -> IO ()))
+hs_bindgen_746fb03c27f16031 =
+  fmap BG.fromFFIType hs_bindgen_746fb03c27f16031_base
+
+{-# NOINLINE const_withoutSign_after5 #-}
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5 :: BG.FunPtr (A -> Some_union -> IO ())
+const_withoutSign_after5 =
+  BG.unsafePerformIO hs_bindgen_746fb03c27f16031
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_dc174ac598e92a95" hs_bindgen_dc174ac598e92a95_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after6@
+hs_bindgen_dc174ac598e92a95 :: IO (BG.FunPtr (A -> Some_enum -> IO ()))
+hs_bindgen_dc174ac598e92a95 =
+  fmap BG.fromFFIType hs_bindgen_dc174ac598e92a95_base
+
+{-# NOINLINE const_withoutSign_after6 #-}
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6 :: BG.FunPtr (A -> Some_enum -> IO ())
+const_withoutSign_after6 =
+  BG.unsafePerformIO hs_bindgen_dc174ac598e92a95
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_2c8ddc46cb100dd9" hs_bindgen_2c8ddc46cb100dd9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after7@
+hs_bindgen_2c8ddc46cb100dd9 :: IO (BG.FunPtr (A -> BG.CBool -> IO ()))
+hs_bindgen_2c8ddc46cb100dd9 =
+  fmap BG.fromFFIType hs_bindgen_2c8ddc46cb100dd9_base
+
+{-# NOINLINE const_withoutSign_after7 #-}
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7 :: BG.FunPtr (A -> BG.CBool -> IO ())
+const_withoutSign_after7 =
+  BG.unsafePerformIO hs_bindgen_2c8ddc46cb100dd9
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_fdf87fbad31246de" hs_bindgen_fdf87fbad31246de_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after8@
+hs_bindgen_fdf87fbad31246de :: IO (BG.FunPtr (A -> HsBindgen.Runtime.LibC.CSize -> IO ()))
+hs_bindgen_fdf87fbad31246de =
+  fmap BG.fromFFIType hs_bindgen_fdf87fbad31246de_base
+
+{-# NOINLINE const_withoutSign_after8 #-}
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8 :: BG.FunPtr (A -> HsBindgen.Runtime.LibC.CSize -> IO ())
+const_withoutSign_after8 =
+  BG.unsafePerformIO hs_bindgen_fdf87fbad31246de
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_38808e8aa92d3bcb" hs_bindgen_38808e8aa92d3bcb_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args1@
+hs_bindgen_38808e8aa92d3bcb :: IO (BG.FunPtr (A -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_38808e8aa92d3bcb =
+  fmap BG.fromFFIType hs_bindgen_38808e8aa92d3bcb_base
+
+{-# NOINLINE const_pointers_args1 #-}
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1 :: BG.FunPtr (A -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args1 =
+  BG.unsafePerformIO hs_bindgen_38808e8aa92d3bcb
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_4d37887fd82ab559" hs_bindgen_4d37887fd82ab559_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args2@
+hs_bindgen_4d37887fd82ab559 :: IO (BG.FunPtr (A -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_4d37887fd82ab559 =
+  fmap BG.fromFFIType hs_bindgen_4d37887fd82ab559_base
+
+{-# NOINLINE const_pointers_args2 #-}
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2 :: BG.FunPtr (A -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args2 =
+  BG.unsafePerformIO hs_bindgen_4d37887fd82ab559
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_fd675a45f1682dd5" hs_bindgen_fd675a45f1682dd5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args3@
+hs_bindgen_fd675a45f1682dd5 :: IO (BG.FunPtr (A -> BG.Ptr BG.CInt -> IO ()))
+hs_bindgen_fd675a45f1682dd5 =
+  fmap BG.fromFFIType hs_bindgen_fd675a45f1682dd5_base
+
+{-# NOINLINE const_pointers_args3 #-}
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3 :: BG.FunPtr (A -> BG.Ptr BG.CInt -> IO ())
+const_pointers_args3 =
+  BG.unsafePerformIO hs_bindgen_fd675a45f1682dd5
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_824cb2084c63b803" hs_bindgen_824cb2084c63b803_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args4@
+hs_bindgen_824cb2084c63b803 :: IO (BG.FunPtr (A -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_824cb2084c63b803 =
+  fmap BG.fromFFIType hs_bindgen_824cb2084c63b803_base
+
+{-# NOINLINE const_pointers_args4 #-}
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4 :: BG.FunPtr (A -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args4 =
+  BG.unsafePerformIO hs_bindgen_824cb2084c63b803
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_25bdd13aed8f26c4" hs_bindgen_25bdd13aed8f26c4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args5@
+hs_bindgen_25bdd13aed8f26c4 :: IO (BG.FunPtr (A -> PtrConst.PtrConst BG.CInt -> IO ()))
+hs_bindgen_25bdd13aed8f26c4 =
+  fmap BG.fromFFIType hs_bindgen_25bdd13aed8f26c4_base
+
+{-# NOINLINE const_pointers_args5 #-}
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5 :: BG.FunPtr (A -> PtrConst.PtrConst BG.CInt -> IO ())
+const_pointers_args5 =
+  BG.unsafePerformIO hs_bindgen_25bdd13aed8f26c4
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_f494124b53592961" hs_bindgen_f494124b53592961_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret1@
+hs_bindgen_f494124b53592961 :: IO (BG.FunPtr (A -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_f494124b53592961 =
+  fmap BG.fromFFIType hs_bindgen_f494124b53592961_base
+
+{-# NOINLINE const_pointers_ret1 #-}
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1 :: BG.FunPtr (A -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret1 =
+  BG.unsafePerformIO hs_bindgen_f494124b53592961
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_32c4b858ef4f3bb8" hs_bindgen_32c4b858ef4f3bb8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret2@
+hs_bindgen_32c4b858ef4f3bb8 :: IO (BG.FunPtr (A -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_32c4b858ef4f3bb8 =
+  fmap BG.fromFFIType hs_bindgen_32c4b858ef4f3bb8_base
+
+{-# NOINLINE const_pointers_ret2 #-}
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2 :: BG.FunPtr (A -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret2 =
+  BG.unsafePerformIO hs_bindgen_32c4b858ef4f3bb8
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_110afe05c6d47b7c" hs_bindgen_110afe05c6d47b7c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret3@
+hs_bindgen_110afe05c6d47b7c :: IO (BG.FunPtr (A -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_110afe05c6d47b7c =
+  fmap BG.fromFFIType hs_bindgen_110afe05c6d47b7c_base
+
+{-# NOINLINE const_pointers_ret3 #-}
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3 :: BG.FunPtr (A -> IO (BG.Ptr BG.CInt))
+const_pointers_ret3 =
+  BG.unsafePerformIO hs_bindgen_110afe05c6d47b7c
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_042a426acfeaa051" hs_bindgen_042a426acfeaa051_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret4@
+hs_bindgen_042a426acfeaa051 :: IO (BG.FunPtr (A -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_042a426acfeaa051 =
+  fmap BG.fromFFIType hs_bindgen_042a426acfeaa051_base
+
+{-# NOINLINE const_pointers_ret4 #-}
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4 :: BG.FunPtr (A -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret4 =
+  BG.unsafePerformIO hs_bindgen_042a426acfeaa051
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_bc3cdc03ae3274bd" hs_bindgen_bc3cdc03ae3274bd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret5@
+hs_bindgen_bc3cdc03ae3274bd :: IO (BG.FunPtr (A -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_bc3cdc03ae3274bd =
+  fmap BG.fromFFIType hs_bindgen_bc3cdc03ae3274bd_base
+
+{-# NOINLINE const_pointers_ret5 #-}
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5 :: BG.FunPtr (A -> IO (PtrConst.PtrConst BG.CInt))
+const_pointers_ret5 =
+  BG.unsafePerformIO hs_bindgen_bc3cdc03ae3274bd
+
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_ae95c15a81eacd52" hs_bindgen_ae95c15a81eacd52_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem1@
+hs_bindgen_ae95c15a81eacd52 :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray A)) -> IO ()))
+hs_bindgen_ae95c15a81eacd52 =
+  fmap BG.fromFFIType hs_bindgen_ae95c15a81eacd52_base
+
+{-# NOINLINE const_array_elem1 #-}
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1 :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray A)) -> IO ())
+const_array_elem1 =
+  BG.unsafePerformIO hs_bindgen_ae95c15a81eacd52
+
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_9dbbae3758752935" hs_bindgen_9dbbae3758752935_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem2@
+hs_bindgen_9dbbae3758752935 :: IO (BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst A))) -> IO ()))
+hs_bindgen_9dbbae3758752935 =
+  fmap BG.fromFFIType hs_bindgen_9dbbae3758752935_base
+
+{-# NOINLINE const_array_elem2 #-}
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2 :: BG.FunPtr (BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst A))) -> IO ())
+const_array_elem2 =
+  BG.unsafePerformIO hs_bindgen_9dbbae3758752935
+
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_9fdb904f0c0776ed" hs_bindgen_9fdb904f0c0776ed_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem3@
+hs_bindgen_9fdb904f0c0776ed :: IO (BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr A))) -> IO ()))
+hs_bindgen_9fdb904f0c0776ed =
+  fmap BG.fromFFIType hs_bindgen_9fdb904f0c0776ed_base
+
+{-# NOINLINE const_array_elem3 #-}
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3 :: BG.FunPtr (PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr A))) -> IO ())
+const_array_elem3 =
+  BG.unsafePerformIO hs_bindgen_9fdb904f0c0776ed
+
+-- __unique:__ @test_macrosreparse_Example_get_noParams1@
+foreign import ccall unsafe "hs_bindgen_cd9806a214acd0fa" hs_bindgen_cd9806a214acd0fa_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_noParams1@
+hs_bindgen_cd9806a214acd0fa :: IO (BG.FunPtr (IO A))
+hs_bindgen_cd9806a214acd0fa =
+  fmap BG.fromFFIType hs_bindgen_cd9806a214acd0fa_base
+
+{-# NOINLINE noParams1 #-}
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1 :: BG.FunPtr (IO A)
+noParams1 =
+  BG.unsafePerformIO hs_bindgen_cd9806a214acd0fa
+
+-- __unique:__ @test_macrosreparse_Example_get_noParams2@
+foreign import ccall unsafe "hs_bindgen_7c7bf9b5a41ea4a9" hs_bindgen_7c7bf9b5a41ea4a9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_noParams2@
+hs_bindgen_7c7bf9b5a41ea4a9 :: IO (BG.FunPtr (IO A))
+hs_bindgen_7c7bf9b5a41ea4a9 =
+  fmap BG.fromFFIType hs_bindgen_7c7bf9b5a41ea4a9_base
+
+{-# NOINLINE noParams2 #-}
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2 :: BG.FunPtr (IO A)
+noParams2 =
+  BG.unsafePerformIO hs_bindgen_7c7bf9b5a41ea4a9
+
+-- __unique:__ @test_macrosreparse_Example_get_noParams3@
+foreign import ccall unsafe "hs_bindgen_7f154653725d104d" hs_bindgen_7f154653725d104d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_noParams3@
+hs_bindgen_7f154653725d104d :: IO (BG.FunPtr (A -> BG.FunPtr (IO BG.CInt) -> IO ()))
+hs_bindgen_7f154653725d104d =
+  fmap BG.fromFFIType hs_bindgen_7f154653725d104d_base
+
+{-# NOINLINE noParams3 #-}
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3 :: BG.FunPtr (A -> BG.FunPtr (IO BG.CInt) -> IO ())
+noParams3 =
+  BG.unsafePerformIO hs_bindgen_7f154653725d104d
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_4460dd1d93c2df6f" hs_bindgen_4460dd1d93c2df6f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret1@
+hs_bindgen_4460dd1d93c2df6f :: IO (BG.FunPtr (A -> IO (BG.FunPtr (IO ()))))
+hs_bindgen_4460dd1d93c2df6f =
+  fmap BG.fromFFIType hs_bindgen_4460dd1d93c2df6f_base
+
+{-# NOINLINE funptr_ret1 #-}
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1 :: BG.FunPtr (A -> IO (BG.FunPtr (IO ())))
+funptr_ret1 =
+  BG.unsafePerformIO hs_bindgen_4460dd1d93c2df6f
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_2b8d04e0fe71178b" hs_bindgen_2b8d04e0fe71178b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret2@
+hs_bindgen_2b8d04e0fe71178b :: IO (BG.FunPtr (A -> IO (BG.FunPtr (IO BG.CInt))))
+hs_bindgen_2b8d04e0fe71178b =
+  fmap BG.fromFFIType hs_bindgen_2b8d04e0fe71178b_base
+
+{-# NOINLINE funptr_ret2 #-}
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2 :: BG.FunPtr (A -> IO (BG.FunPtr (IO BG.CInt)))
+funptr_ret2 =
+  BG.unsafePerformIO hs_bindgen_2b8d04e0fe71178b
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_27d05f98fe1e869b" hs_bindgen_27d05f98fe1e869b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret3@
+hs_bindgen_27d05f98fe1e869b :: IO (BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> IO ()))))
+hs_bindgen_27d05f98fe1e869b =
+  fmap BG.fromFFIType hs_bindgen_27d05f98fe1e869b_base
+
+{-# NOINLINE funptr_ret3 #-}
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3 :: BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> IO ())))
+funptr_ret3 =
+  BG.unsafePerformIO hs_bindgen_27d05f98fe1e869b
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_f55fb889881240c6" hs_bindgen_f55fb889881240c6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret4@
+hs_bindgen_f55fb889881240c6 :: IO (BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))))
+hs_bindgen_f55fb889881240c6 =
+  fmap BG.fromFFIType hs_bindgen_f55fb889881240c6_base
+
+{-# NOINLINE funptr_ret4 #-}
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4 :: BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)))
+funptr_ret4 =
+  BG.unsafePerformIO hs_bindgen_f55fb889881240c6
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_e59cbfc52cec7177" hs_bindgen_e59cbfc52cec7177_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret5@
+hs_bindgen_e59cbfc52cec7177 :: IO (BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))))
+hs_bindgen_e59cbfc52cec7177 =
+  fmap BG.fromFFIType hs_bindgen_e59cbfc52cec7177_base
+
+{-# NOINLINE funptr_ret5 #-}
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5 :: BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))))
+funptr_ret5 =
+  BG.unsafePerformIO hs_bindgen_e59cbfc52cec7177
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_f94486b884c7cd44" hs_bindgen_f94486b884c7cd44_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret6@
+hs_bindgen_f94486b884c7cd44 :: IO (BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_f94486b884c7cd44 =
+  fmap BG.fromFFIType hs_bindgen_f94486b884c7cd44_base
+
+{-# NOINLINE funptr_ret6 #-}
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6 :: BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret6 =
+  BG.unsafePerformIO hs_bindgen_f94486b884c7cd44
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_7810d75b42b3bed8" hs_bindgen_7810d75b42b3bed8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret7@
+hs_bindgen_7810d75b42b3bed8 :: IO (BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_7810d75b42b3bed8 =
+  fmap BG.fromFFIType hs_bindgen_7810d75b42b3bed8_base
+
+{-# NOINLINE funptr_ret7 #-}
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7 :: BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret7 =
+  BG.unsafePerformIO hs_bindgen_7810d75b42b3bed8
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_fc12014317abd6b4" hs_bindgen_fc12014317abd6b4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret8@
+hs_bindgen_fc12014317abd6b4 :: IO (BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))))
+hs_bindgen_fc12014317abd6b4 =
+  fmap BG.fromFFIType hs_bindgen_fc12014317abd6b4_base
+
+{-# NOINLINE funptr_ret8 #-}
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8 :: BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))))
+funptr_ret8 =
+  BG.unsafePerformIO hs_bindgen_fc12014317abd6b4
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_cf3bf1d8470acad4" hs_bindgen_cf3bf1d8470acad4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret9@
+hs_bindgen_cf3bf1d8470acad4 :: IO (BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_cf3bf1d8470acad4 =
+  fmap BG.fromFFIType hs_bindgen_cf3bf1d8470acad4_base
+
+{-# NOINLINE funptr_ret9 #-}
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9 :: BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret9 =
+  BG.unsafePerformIO hs_bindgen_cf3bf1d8470acad4
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_44a7eb47cf87f092" hs_bindgen_44a7eb47cf87f092_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret10@
+hs_bindgen_44a7eb47cf87f092 :: IO (BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_44a7eb47cf87f092 =
+  fmap BG.fromFFIType hs_bindgen_44a7eb47cf87f092_base
+
+{-# NOINLINE funptr_ret10 #-}
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10 :: BG.FunPtr (A -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt))))
+funptr_ret10 =
+  BG.unsafePerformIO hs_bindgen_44a7eb47cf87f092
diff --git a/test-artefacts/fixtures/macros/reparse/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/Example/Global.hs
@@ -0,0 +1,203 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.global1
+    , Example.Global.global2
+    , Example.Global.global3
+    , Example.Global.const1
+    , Example.Global.const2
+    , Example.Global.const3
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "/* test_macrosreparse_Example_get_global1 */"
+  , "__attribute__ ((const))"
+  , "A *hs_bindgen_feda7c77651645fe (void)"
+  , "{"
+  , "  return &global1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_global2 */"
+  , "__attribute__ ((const))"
+  , "A **hs_bindgen_61b4abc5e1afa043 (void)"
+  , "{"
+  , "  return &global2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_global3 */"
+  , "__attribute__ ((const))"
+  , "A ***hs_bindgen_f9bcb9580741dbc1 (void)"
+  , "{"
+  , "  return &global3;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const1 */"
+  , "__attribute__ ((const))"
+  , "A const *hs_bindgen_044004234e2019f6 (void)"
+  , "{"
+  , "  return &const1;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const2 */"
+  , "__attribute__ ((const))"
+  , "A *const *hs_bindgen_6c69b6e35fe122c5 (void)"
+  , "{"
+  , "  return &const2;"
+  , "}"
+  , "/* test_macrosreparse_Example_get_const3 */"
+  , "__attribute__ ((const))"
+  , "A **const *hs_bindgen_da21ad94b09d46ae (void)"
+  , "{"
+  , "  return &const3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_Example_get_global1@
+foreign import ccall unsafe "hs_bindgen_feda7c77651645fe" hs_bindgen_feda7c77651645fe_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_global1@
+hs_bindgen_feda7c77651645fe :: IO (BG.Ptr A)
+hs_bindgen_feda7c77651645fe =
+  fmap BG.fromFFIType hs_bindgen_feda7c77651645fe_base
+
+{-# NOINLINE global1 #-}
+{-| Globals and constants
+
+    __C declaration:__ @global1@
+
+    __defined at:__ @macros\/reparse.h 161:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global1 :: BG.Ptr A
+global1 =
+  BG.unsafePerformIO hs_bindgen_feda7c77651645fe
+
+-- __unique:__ @test_macrosreparse_Example_get_global2@
+foreign import ccall unsafe "hs_bindgen_61b4abc5e1afa043" hs_bindgen_61b4abc5e1afa043_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_global2@
+hs_bindgen_61b4abc5e1afa043 :: IO (BG.Ptr (BG.Ptr A))
+hs_bindgen_61b4abc5e1afa043 =
+  fmap BG.fromFFIType hs_bindgen_61b4abc5e1afa043_base
+
+{-# NOINLINE global2 #-}
+{-| __C declaration:__ @global2@
+
+    __defined at:__ @macros\/reparse.h 162:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global2 :: BG.Ptr (BG.Ptr A)
+global2 =
+  BG.unsafePerformIO hs_bindgen_61b4abc5e1afa043
+
+-- __unique:__ @test_macrosreparse_Example_get_global3@
+foreign import ccall unsafe "hs_bindgen_f9bcb9580741dbc1" hs_bindgen_f9bcb9580741dbc1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_global3@
+hs_bindgen_f9bcb9580741dbc1 :: IO (BG.Ptr (BG.Ptr (BG.Ptr A)))
+hs_bindgen_f9bcb9580741dbc1 =
+  fmap BG.fromFFIType hs_bindgen_f9bcb9580741dbc1_base
+
+{-# NOINLINE global3 #-}
+{-| __C declaration:__ @global3@
+
+    __defined at:__ @macros\/reparse.h 163:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global3 :: BG.Ptr (BG.Ptr (BG.Ptr A))
+global3 =
+  BG.unsafePerformIO hs_bindgen_f9bcb9580741dbc1
+
+-- __unique:__ @test_macrosreparse_Example_get_const1@
+foreign import ccall unsafe "hs_bindgen_044004234e2019f6" hs_bindgen_044004234e2019f6_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const1@
+hs_bindgen_044004234e2019f6 :: IO (PtrConst.PtrConst A)
+hs_bindgen_044004234e2019f6 =
+  fmap BG.fromFFIType hs_bindgen_044004234e2019f6_base
+
+{-# NOINLINE hs_bindgen_f883e611325aa029 #-}
+{-| __C declaration:__ @const1@
+
+    __defined at:__ @macros\/reparse.h 165:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_Example_const1@
+-}
+hs_bindgen_f883e611325aa029 :: PtrConst.PtrConst A
+hs_bindgen_f883e611325aa029 =
+  BG.unsafePerformIO hs_bindgen_044004234e2019f6
+
+{-# NOINLINE const1 #-}
+const1 :: A
+const1 =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_f883e611325aa029)
+
+-- __unique:__ @test_macrosreparse_Example_get_const2@
+foreign import ccall unsafe "hs_bindgen_6c69b6e35fe122c5" hs_bindgen_6c69b6e35fe122c5_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const2@
+hs_bindgen_6c69b6e35fe122c5 :: IO (PtrConst.PtrConst (BG.Ptr A))
+hs_bindgen_6c69b6e35fe122c5 =
+  fmap BG.fromFFIType hs_bindgen_6c69b6e35fe122c5_base
+
+{-# NOINLINE hs_bindgen_4a0e98a60a6414ee #-}
+{-| __C declaration:__ @const2@
+
+    __defined at:__ @macros\/reparse.h 166:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_Example_const2@
+-}
+hs_bindgen_4a0e98a60a6414ee :: PtrConst.PtrConst (BG.Ptr A)
+hs_bindgen_4a0e98a60a6414ee =
+  BG.unsafePerformIO hs_bindgen_6c69b6e35fe122c5
+
+{-# NOINLINE const2 #-}
+const2 :: BG.Ptr A
+const2 =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_4a0e98a60a6414ee)
+
+-- __unique:__ @test_macrosreparse_Example_get_const3@
+foreign import ccall unsafe "hs_bindgen_da21ad94b09d46ae" hs_bindgen_da21ad94b09d46ae_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_get_const3@
+hs_bindgen_da21ad94b09d46ae :: IO (PtrConst.PtrConst (BG.Ptr (BG.Ptr A)))
+hs_bindgen_da21ad94b09d46ae =
+  fmap BG.fromFFIType hs_bindgen_da21ad94b09d46ae_base
+
+{-# NOINLINE hs_bindgen_0d6ba48ba79ada14 #-}
+{-| __C declaration:__ @const3@
+
+    __defined at:__ @macros\/reparse.h 167:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_Example_const3@
+-}
+hs_bindgen_0d6ba48ba79ada14 :: PtrConst.PtrConst (BG.Ptr (BG.Ptr A))
+hs_bindgen_0d6ba48ba79ada14 =
+  BG.unsafePerformIO hs_bindgen_da21ad94b09d46ae
+
+{-# NOINLINE const3 #-}
+const3 :: BG.Ptr (BG.Ptr A)
+const3 =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_0d6ba48ba79ada14)
diff --git a/test-artefacts/fixtures/macros/reparse/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/Example/Safe.hs
@@ -0,0 +1,4006 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.args_char1
+    , Example.Safe.args_char2
+    , Example.Safe.args_char3
+    , Example.Safe.args_short1
+    , Example.Safe.args_short2
+    , Example.Safe.args_short3
+    , Example.Safe.args_int1
+    , Example.Safe.args_int2
+    , Example.Safe.args_int3
+    , Example.Safe.args_long1
+    , Example.Safe.args_long2
+    , Example.Safe.args_long3
+    , Example.Safe.args_float
+    , Example.Safe.args_double
+    , Example.Safe.args_bool1
+    , Example.Safe.args_struct
+    , Example.Safe.args_union
+    , Example.Safe.args_enum
+    , Example.Safe.args_pointer1
+    , Example.Safe.args_pointer2
+    , Example.Safe.args_pointer3
+    , Example.Safe.ret_A
+    , Example.Safe.ret_char1
+    , Example.Safe.ret_char2
+    , Example.Safe.ret_char3
+    , Example.Safe.ret_short1
+    , Example.Safe.ret_short2
+    , Example.Safe.ret_short3
+    , Example.Safe.ret_int1
+    , Example.Safe.ret_int2
+    , Example.Safe.ret_int3
+    , Example.Safe.ret_long1
+    , Example.Safe.ret_long2
+    , Example.Safe.ret_long3
+    , Example.Safe.ret_float
+    , Example.Safe.ret_double
+    , Example.Safe.ret_bool1
+    , Example.Safe.ret_struct
+    , Example.Safe.ret_union
+    , Example.Safe.ret_enum
+    , Example.Safe.ret_pointer1
+    , Example.Safe.ret_pointer2
+    , Example.Safe.ret_pointer3
+    , Example.Safe.body1
+    , Example.Safe.body2
+    , Example.Safe.args_complex_float
+    , Example.Safe.args_complex_double
+    , Example.Safe.ret_complex_float
+    , Example.Safe.ret_complex_double
+    , Example.Safe.bespoke_args1
+    , Example.Safe.bespoke_args2
+    , Example.Safe.bespoke_ret1
+    , Example.Safe.bespoke_ret2
+    , Example.Safe.arr_args1
+    , Example.Safe.arr_args2
+    , Example.Safe.arr_args3
+    , Example.Safe.arr_args4
+    , Example.Safe.funptr_args1
+    , Example.Safe.funptr_args2
+    , Example.Safe.funptr_args3
+    , Example.Safe.funptr_args4
+    , Example.Safe.funptr_args5
+    , Example.Safe.comments1
+    , Example.Safe.const_prim_before1
+    , Example.Safe.const_prim_before2
+    , Example.Safe.const_prim_before3
+    , Example.Safe.const_prim_after1
+    , Example.Safe.const_prim_after2
+    , Example.Safe.const_prim_after3
+    , Example.Safe.const_withoutSign_before1
+    , Example.Safe.const_withoutSign_before2
+    , Example.Safe.const_withoutSign_before3
+    , Example.Safe.const_withoutSign_before4
+    , Example.Safe.const_withoutSign_before5
+    , Example.Safe.const_withoutSign_before6
+    , Example.Safe.const_withoutSign_before7
+    , Example.Safe.const_withoutSign_before8
+    , Example.Safe.const_withoutSign_after1
+    , Example.Safe.const_withoutSign_after2
+    , Example.Safe.const_withoutSign_after3
+    , Example.Safe.const_withoutSign_after4
+    , Example.Safe.const_withoutSign_after5
+    , Example.Safe.const_withoutSign_after6
+    , Example.Safe.const_withoutSign_after7
+    , Example.Safe.const_withoutSign_after8
+    , Example.Safe.const_pointers_args1
+    , Example.Safe.const_pointers_args2
+    , Example.Safe.const_pointers_args3
+    , Example.Safe.const_pointers_args4
+    , Example.Safe.const_pointers_args5
+    , Example.Safe.const_pointers_ret1
+    , Example.Safe.const_pointers_ret2
+    , Example.Safe.const_pointers_ret3
+    , Example.Safe.const_pointers_ret4
+    , Example.Safe.const_pointers_ret5
+    , Example.Safe.const_array_elem1
+    , Example.Safe.const_array_elem2
+    , Example.Safe.const_array_elem3
+    , Example.Safe.noParams1
+    , Example.Safe.noParams2
+    , Example.Safe.noParams3
+    , Example.Safe.funptr_ret1
+    , Example.Safe.funptr_ret2
+    , Example.Safe.funptr_ret3
+    , Example.Safe.funptr_ret4
+    , Example.Safe.funptr_ret5
+    , Example.Safe.funptr_ret6
+    , Example.Safe.funptr_ret7
+    , Example.Safe.funptr_ret8
+    , Example.Safe.funptr_ret9
+    , Example.Safe.funptr_ret10
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "void hs_bindgen_f15610128336b06a ("
+  , "  A arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (args_char1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_087f45ca0a284a03 ("
+  , "  A arg1,"
+  , "  signed char arg2"
+  , ")"
+  , "{"
+  , "  (args_char2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f6cb5c5a728c2404 ("
+  , "  A arg1,"
+  , "  unsigned char arg2"
+  , ")"
+  , "{"
+  , "  (args_char3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d485767e0caa1f7c ("
+  , "  A arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_833c96c437533e02 ("
+  , "  A arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0e1eedc3fcbcea7a ("
+  , "  A arg1,"
+  , "  unsigned short arg2"
+  , ")"
+  , "{"
+  , "  (args_short3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_906f0ac7dfd36ab8 ("
+  , "  A arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0edbc9b995b2a589 ("
+  , "  A arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a5c223f58a255115 ("
+  , "  A arg1,"
+  , "  unsigned int arg2"
+  , ")"
+  , "{"
+  , "  (args_int3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_41d1229384b9a529 ("
+  , "  A arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a9a4b09fd3bd83db ("
+  , "  A arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_31dc2e680b3f3eff ("
+  , "  A arg1,"
+  , "  unsigned long arg2"
+  , ")"
+  , "{"
+  , "  (args_long3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3d400757b5cbf4b7 ("
+  , "  A arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  (args_float)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_70df07e39900487e ("
+  , "  A arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  (args_double)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0b7c534fe683f843 ("
+  , "  A arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (args_bool1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b20e084f7b7941b5 ("
+  , "  A arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  (args_struct)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_23aff33f33b6bdd1 ("
+  , "  A arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  (args_union)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_fdd58ae14ce15ed5 ("
+  , "  A arg1,"
+  , "  enum some_enum arg2"
+  , ")"
+  , "{"
+  , "  (args_enum)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_42ce2ec4fd2eda72 ("
+  , "  A arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_01b2f6502d340abe ("
+  , "  A arg1,"
+  , "  signed int **arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3e64133f9aaebbf1 ("
+  , "  A arg1,"
+  , "  void *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer3)(arg1, arg2);"
+  , "}"
+  , "A hs_bindgen_c830401b459192fb (void)"
+  , "{"
+  , "  return (ret_A)();"
+  , "}"
+  , "char hs_bindgen_18b24c6e67a5412e ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char1)(arg1);"
+  , "}"
+  , "signed char hs_bindgen_2da1160aeef9ff64 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char2)(arg1);"
+  , "}"
+  , "unsigned char hs_bindgen_e3183f9de1b9f231 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char3)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_c313966d4478e3f4 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short1)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_737fbec310eb0719 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short2)(arg1);"
+  , "}"
+  , "unsigned short hs_bindgen_b5bd9e111020db4e ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_a30224259287f5f8 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b5be09caf8cf5750 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int2)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_698e3f97470d83be ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int3)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_c7e0705dd09be530 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long1)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_74b1f5b8c56ff22c ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long2)(arg1);"
+  , "}"
+  , "unsigned long hs_bindgen_c2d07eaaab82d408 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long3)(arg1);"
+  , "}"
+  , "float hs_bindgen_0edfbc7067faa1f7 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_float)(arg1);"
+  , "}"
+  , "double hs_bindgen_786ca672396b33be ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_double)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_2e99f19b59650996 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_bool1)(arg1);"
+  , "}"
+  , "void hs_bindgen_6c999121eed8178f ("
+  , "  A arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_struct)(arg1);"
+  , "}"
+  , "void hs_bindgen_481ee5d2d9bd34db ("
+  , "  A arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_union)(arg1);"
+  , "}"
+  , "enum some_enum hs_bindgen_8bb240ba453b700d ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_enum)(arg1);"
+  , "}"
+  , "signed int *hs_bindgen_c346ed2cd20b9af1 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer1)(arg1);"
+  , "}"
+  , "signed int **hs_bindgen_a21f618658151728 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer2)(arg1);"
+  , "}"
+  , "void *hs_bindgen_2d8c6e2d2f395342 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b030d02030ed80bc ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (body1)(arg1);"
+  , "}"
+  , "A hs_bindgen_be50427e6a63df54 (void)"
+  , "{"
+  , "  return (body2)();"
+  , "}"
+  , "void hs_bindgen_627a52a5c7617083 ("
+  , "  A arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_float)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_392babebc1d83503 ("
+  , "  A arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_double)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_8958183ede73dea8 ("
+  , "  A arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_float)(arg1);"
+  , "}"
+  , "void hs_bindgen_a95fabfd391a99aa ("
+  , "  A arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_double)(arg1);"
+  , "}"
+  , "void hs_bindgen_ad9f8630dd04a203 ("
+  , "  A arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4b34178a505131e2 ("
+  , "  A arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args2)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_94b225a6394496c1 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret1)(arg1);"
+  , "}"
+  , "size_t hs_bindgen_7c9a1792426b84a1 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret2)(arg1);"
+  , "}"
+  , "void hs_bindgen_e20689fe39004225 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args1)(arg1);"
+  , "}"
+  , "void hs_bindgen_084796e4bfd3f4cd ("
+  , "  A **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args2)(arg1);"
+  , "}"
+  , "void hs_bindgen_a3d1560aaa4352df ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args3)(arg1);"
+  , "}"
+  , "void hs_bindgen_88659ccccc6c1f5f ("
+  , "  A **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args4)(arg1);"
+  , "}"
+  , "void hs_bindgen_3448d03cfd41161a ("
+  , "  A arg1,"
+  , "  void (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_92d7386f0a327d25 ("
+  , "  A arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2881f594f98043e6 ("
+  , "  A arg1,"
+  , "  void (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_1e85a05df4251f62 ("
+  , "  A arg1,"
+  , "  char (*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ccf4db7511f0d6d6 ("
+  , "  A arg1,"
+  , "  signed int *(*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args5)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4c756db60673d221 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (comments1)(arg1);"
+  , "}"
+  , "void hs_bindgen_278568d7a2a3a4b6 ("
+  , "  A arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_87ee56525e5ea20c ("
+  , "  A arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c0b99594235bd99e ("
+  , "  A arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d718b682f157fc18 ("
+  , "  A arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f2c5b3d5eca68433 ("
+  , "  A arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ae2d994e06667b23 ("
+  , "  A arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6940b58e7f4397a7 ("
+  , "  A arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_00b6fe2282e779b1 ("
+  , "  A arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6517cc8d39aead93 ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_68c7661e95060488 ("
+  , "  A arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_42b3b0bf73a7a51a ("
+  , "  A arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_c4aabe9834aac12f ("
+  , "  A arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_486090a7fb4e34d4 ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_23fa742b614176dd ("
+  , "  A arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_0aacd8a5d48f296d ("
+  , "  A arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_16ec2102221485b7 ("
+  , "  A arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9aa934d44ec3790c ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_043d2869e29bedcf ("
+  , "  A arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_b5f9bca1de9d69de ("
+  , "  A arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_77d641d518b2504f ("
+  , "  A arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_691b4f2909140b49 ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ae74c8dcdc2ec9eb ("
+  , "  A arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_07606c41eadf9146 ("
+  , "  A arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3836769f3a3416ac ("
+  , "  A arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_12f19ea593aefd3f ("
+  , "  A arg1,"
+  , "  signed int *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_5a50e98897696d57 ("
+  , "  A arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_666701f7cb61bd15 ("
+  , "  A arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args5)(arg1, arg2);"
+  , "}"
+  , "signed int const *hs_bindgen_b94fbc3dfd285563 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret1)(arg1);"
+  , "}"
+  , "signed int const *hs_bindgen_33e2960e26b79450 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret2)(arg1);"
+  , "}"
+  , "signed int *const hs_bindgen_50c6e2fe4f3fb777 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret3)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_edc014695d896c8d ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret4)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_6d3308cc5847f033 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret5)(arg1);"
+  , "}"
+  , "void hs_bindgen_678576320923a4d1 ("
+  , "  A const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem1)(arg1);"
+  , "}"
+  , "void hs_bindgen_b317941dde4eeff2 ("
+  , "  A const **arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem2)(arg1);"
+  , "}"
+  , "void hs_bindgen_707e602e6beb1bb6 ("
+  , "  A *const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem3)(arg1);"
+  , "}"
+  , "A hs_bindgen_93fecb4eb766c262 (void)"
+  , "{"
+  , "  return (noParams1)();"
+  , "}"
+  , "A hs_bindgen_4350965157c891f5 (void)"
+  , "{"
+  , "  return (noParams2)();"
+  , "}"
+  , "void hs_bindgen_c4f59272a2b1c3b5 ("
+  , "  A arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (noParams3)(arg1, arg2);"
+  , "}"
+  , "void (*hs_bindgen_387a04c01e23c320 ("
+  , "  A arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_6f0c14cd3478dc19 ("
+  , "  A arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret2)(arg1);"
+  , "}"
+  , "void (*hs_bindgen_08e8661d277cf7be ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (funptr_ret3)(arg1);"
+  , "}"
+  , "char (*hs_bindgen_609b5d953b68da92 ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret4)(arg1);"
+  , "}"
+  , "signed int *(*hs_bindgen_13e6ae43abf40aee ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret5)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_a4a3a86f28ca6299 ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret6)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_eae9dff04c88d00b ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret7)(arg1);"
+  , "}"
+  , "signed int *const (*hs_bindgen_894457d90a2fc8db ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret8)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_c893eb15ad9bc68c ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret9)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_d96c258298a44b28 ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret10)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char1@
+foreign import ccall safe "hs_bindgen_f15610128336b06a" hs_bindgen_f15610128336b06a_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char1@
+hs_bindgen_f15610128336b06a ::
+     A
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_f15610128336b06a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f15610128336b06a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char1 = hs_bindgen_f15610128336b06a
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char2@
+foreign import ccall safe "hs_bindgen_087f45ca0a284a03" hs_bindgen_087f45ca0a284a03_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char2@
+hs_bindgen_087f45ca0a284a03 ::
+     A
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_087f45ca0a284a03 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_087f45ca0a284a03_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char2 = hs_bindgen_087f45ca0a284a03
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char3@
+foreign import ccall safe "hs_bindgen_f6cb5c5a728c2404" hs_bindgen_f6cb5c5a728c2404_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char3@
+hs_bindgen_f6cb5c5a728c2404 ::
+     A
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_f6cb5c5a728c2404 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f6cb5c5a728c2404_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char3 = hs_bindgen_f6cb5c5a728c2404
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short1@
+foreign import ccall safe "hs_bindgen_d485767e0caa1f7c" hs_bindgen_d485767e0caa1f7c_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short1@
+hs_bindgen_d485767e0caa1f7c ::
+     A
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_d485767e0caa1f7c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d485767e0caa1f7c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short1 = hs_bindgen_d485767e0caa1f7c
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short2@
+foreign import ccall safe "hs_bindgen_833c96c437533e02" hs_bindgen_833c96c437533e02_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short2@
+hs_bindgen_833c96c437533e02 ::
+     A
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_833c96c437533e02 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_833c96c437533e02_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short2 = hs_bindgen_833c96c437533e02
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short3@
+foreign import ccall safe "hs_bindgen_0e1eedc3fcbcea7a" hs_bindgen_0e1eedc3fcbcea7a_base ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short3@
+hs_bindgen_0e1eedc3fcbcea7a ::
+     A
+  -> BG.CUShort
+  -> IO ()
+hs_bindgen_0e1eedc3fcbcea7a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0e1eedc3fcbcea7a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short3 = hs_bindgen_0e1eedc3fcbcea7a
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int1@
+foreign import ccall safe "hs_bindgen_906f0ac7dfd36ab8" hs_bindgen_906f0ac7dfd36ab8_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int1@
+hs_bindgen_906f0ac7dfd36ab8 ::
+     A
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_906f0ac7dfd36ab8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_906f0ac7dfd36ab8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int1 = hs_bindgen_906f0ac7dfd36ab8
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int2@
+foreign import ccall safe "hs_bindgen_0edbc9b995b2a589" hs_bindgen_0edbc9b995b2a589_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int2@
+hs_bindgen_0edbc9b995b2a589 ::
+     A
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_0edbc9b995b2a589 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0edbc9b995b2a589_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int2 = hs_bindgen_0edbc9b995b2a589
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int3@
+foreign import ccall safe "hs_bindgen_a5c223f58a255115" hs_bindgen_a5c223f58a255115_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int3@
+hs_bindgen_a5c223f58a255115 ::
+     A
+  -> BG.CUInt
+  -> IO ()
+hs_bindgen_a5c223f58a255115 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a5c223f58a255115_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int3 = hs_bindgen_a5c223f58a255115
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long1@
+foreign import ccall safe "hs_bindgen_41d1229384b9a529" hs_bindgen_41d1229384b9a529_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long1@
+hs_bindgen_41d1229384b9a529 ::
+     A
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_41d1229384b9a529 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_41d1229384b9a529_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long1 = hs_bindgen_41d1229384b9a529
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long2@
+foreign import ccall safe "hs_bindgen_a9a4b09fd3bd83db" hs_bindgen_a9a4b09fd3bd83db_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long2@
+hs_bindgen_a9a4b09fd3bd83db ::
+     A
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_a9a4b09fd3bd83db =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a9a4b09fd3bd83db_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long2 = hs_bindgen_a9a4b09fd3bd83db
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long3@
+foreign import ccall safe "hs_bindgen_31dc2e680b3f3eff" hs_bindgen_31dc2e680b3f3eff_base ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long3@
+hs_bindgen_31dc2e680b3f3eff ::
+     A
+  -> BG.CULong
+  -> IO ()
+hs_bindgen_31dc2e680b3f3eff =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_31dc2e680b3f3eff_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CULong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long3 = hs_bindgen_31dc2e680b3f3eff
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_float@
+foreign import ccall safe "hs_bindgen_3d400757b5cbf4b7" hs_bindgen_3d400757b5cbf4b7_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_float@
+hs_bindgen_3d400757b5cbf4b7 ::
+     A
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_3d400757b5cbf4b7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3d400757b5cbf4b7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_float = hs_bindgen_3d400757b5cbf4b7
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_double@
+foreign import ccall safe "hs_bindgen_70df07e39900487e" hs_bindgen_70df07e39900487e_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_double@
+hs_bindgen_70df07e39900487e ::
+     A
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_70df07e39900487e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_70df07e39900487e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_double = hs_bindgen_70df07e39900487e
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_bool1@
+foreign import ccall safe "hs_bindgen_0b7c534fe683f843" hs_bindgen_0b7c534fe683f843_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_bool1@
+hs_bindgen_0b7c534fe683f843 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_0b7c534fe683f843 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0b7c534fe683f843_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_bool1 = hs_bindgen_0b7c534fe683f843
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_struct@
+foreign import ccall safe "hs_bindgen_b20e084f7b7941b5" hs_bindgen_b20e084f7b7941b5_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_struct@
+hs_bindgen_b20e084f7b7941b5 ::
+     A
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_b20e084f7b7941b5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b20e084f7b7941b5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_struct =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_b20e084f7b7941b5 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_union@
+foreign import ccall safe "hs_bindgen_23aff33f33b6bdd1" hs_bindgen_23aff33f33b6bdd1_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_union@
+hs_bindgen_23aff33f33b6bdd1 ::
+     A
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_23aff33f33b6bdd1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_23aff33f33b6bdd1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_union =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_23aff33f33b6bdd1 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_enum@
+foreign import ccall safe "hs_bindgen_fdd58ae14ce15ed5" hs_bindgen_fdd58ae14ce15ed5_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_enum@
+hs_bindgen_fdd58ae14ce15ed5 ::
+     A
+  -> Some_enum
+  -> IO ()
+hs_bindgen_fdd58ae14ce15ed5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_fdd58ae14ce15ed5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_enum = hs_bindgen_fdd58ae14ce15ed5
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer1@
+foreign import ccall safe "hs_bindgen_42ce2ec4fd2eda72" hs_bindgen_42ce2ec4fd2eda72_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer1@
+hs_bindgen_42ce2ec4fd2eda72 ::
+     A
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_42ce2ec4fd2eda72 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_42ce2ec4fd2eda72_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer1 = hs_bindgen_42ce2ec4fd2eda72
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer2@
+foreign import ccall safe "hs_bindgen_01b2f6502d340abe" hs_bindgen_01b2f6502d340abe_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer2@
+hs_bindgen_01b2f6502d340abe ::
+     A
+  -> BG.Ptr (BG.Ptr BG.CInt)
+  -> IO ()
+hs_bindgen_01b2f6502d340abe =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_01b2f6502d340abe_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr (BG.Ptr BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer2 = hs_bindgen_01b2f6502d340abe
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer3@
+foreign import ccall safe "hs_bindgen_3e64133f9aaebbf1" hs_bindgen_3e64133f9aaebbf1_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer3@
+hs_bindgen_3e64133f9aaebbf1 ::
+     A
+  -> BG.Ptr BG.Void
+  -> IO ()
+hs_bindgen_3e64133f9aaebbf1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3e64133f9aaebbf1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @arg3@
+  -> IO ()
+args_pointer3 = hs_bindgen_3e64133f9aaebbf1
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_A@
+foreign import ccall safe "hs_bindgen_c830401b459192fb" hs_bindgen_c830401b459192fb_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_A@
+hs_bindgen_c830401b459192fb :: IO A
+hs_bindgen_c830401b459192fb =
+  fmap BG.fromFFIType hs_bindgen_c830401b459192fb_base
+
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A :: IO A
+ret_A = hs_bindgen_c830401b459192fb
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char1@
+foreign import ccall safe "hs_bindgen_18b24c6e67a5412e" hs_bindgen_18b24c6e67a5412e_base ::
+     BG.CInt
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char1@
+hs_bindgen_18b24c6e67a5412e ::
+     A
+  -> IO BG.CChar
+hs_bindgen_18b24c6e67a5412e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_18b24c6e67a5412e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CChar
+ret_char1 = hs_bindgen_18b24c6e67a5412e
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char2@
+foreign import ccall safe "hs_bindgen_2da1160aeef9ff64" hs_bindgen_2da1160aeef9ff64_base ::
+     BG.CInt
+  -> IO BG.CSChar
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char2@
+hs_bindgen_2da1160aeef9ff64 ::
+     A
+  -> IO BG.CSChar
+hs_bindgen_2da1160aeef9ff64 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2da1160aeef9ff64_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CSChar
+ret_char2 = hs_bindgen_2da1160aeef9ff64
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char3@
+foreign import ccall safe "hs_bindgen_e3183f9de1b9f231" hs_bindgen_e3183f9de1b9f231_base ::
+     BG.CInt
+  -> IO BG.CUChar
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char3@
+hs_bindgen_e3183f9de1b9f231 ::
+     A
+  -> IO BG.CUChar
+hs_bindgen_e3183f9de1b9f231 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e3183f9de1b9f231_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUChar
+ret_char3 = hs_bindgen_e3183f9de1b9f231
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short1@
+foreign import ccall safe "hs_bindgen_c313966d4478e3f4" hs_bindgen_c313966d4478e3f4_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short1@
+hs_bindgen_c313966d4478e3f4 ::
+     A
+  -> IO BG.CShort
+hs_bindgen_c313966d4478e3f4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c313966d4478e3f4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short1 = hs_bindgen_c313966d4478e3f4
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short2@
+foreign import ccall safe "hs_bindgen_737fbec310eb0719" hs_bindgen_737fbec310eb0719_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short2@
+hs_bindgen_737fbec310eb0719 ::
+     A
+  -> IO BG.CShort
+hs_bindgen_737fbec310eb0719 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_737fbec310eb0719_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short2 = hs_bindgen_737fbec310eb0719
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short3@
+foreign import ccall safe "hs_bindgen_b5bd9e111020db4e" hs_bindgen_b5bd9e111020db4e_base ::
+     BG.CInt
+  -> IO BG.CUShort
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short3@
+hs_bindgen_b5bd9e111020db4e ::
+     A
+  -> IO BG.CUShort
+hs_bindgen_b5bd9e111020db4e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b5bd9e111020db4e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUShort
+ret_short3 = hs_bindgen_b5bd9e111020db4e
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int1@
+foreign import ccall safe "hs_bindgen_a30224259287f5f8" hs_bindgen_a30224259287f5f8_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int1@
+hs_bindgen_a30224259287f5f8 ::
+     A
+  -> IO BG.CInt
+hs_bindgen_a30224259287f5f8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a30224259287f5f8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int1 = hs_bindgen_a30224259287f5f8
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int2@
+foreign import ccall safe "hs_bindgen_b5be09caf8cf5750" hs_bindgen_b5be09caf8cf5750_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int2@
+hs_bindgen_b5be09caf8cf5750 ::
+     A
+  -> IO BG.CInt
+hs_bindgen_b5be09caf8cf5750 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b5be09caf8cf5750_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int2 = hs_bindgen_b5be09caf8cf5750
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int3@
+foreign import ccall safe "hs_bindgen_698e3f97470d83be" hs_bindgen_698e3f97470d83be_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int3@
+hs_bindgen_698e3f97470d83be ::
+     A
+  -> IO BG.CUInt
+hs_bindgen_698e3f97470d83be =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_698e3f97470d83be_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUInt
+ret_int3 = hs_bindgen_698e3f97470d83be
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long1@
+foreign import ccall safe "hs_bindgen_c7e0705dd09be530" hs_bindgen_c7e0705dd09be530_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long1@
+hs_bindgen_c7e0705dd09be530 ::
+     A
+  -> IO BG.CLong
+hs_bindgen_c7e0705dd09be530 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c7e0705dd09be530_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long1 = hs_bindgen_c7e0705dd09be530
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long2@
+foreign import ccall safe "hs_bindgen_74b1f5b8c56ff22c" hs_bindgen_74b1f5b8c56ff22c_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long2@
+hs_bindgen_74b1f5b8c56ff22c ::
+     A
+  -> IO BG.CLong
+hs_bindgen_74b1f5b8c56ff22c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_74b1f5b8c56ff22c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long2 = hs_bindgen_74b1f5b8c56ff22c
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long3@
+foreign import ccall safe "hs_bindgen_c2d07eaaab82d408" hs_bindgen_c2d07eaaab82d408_base ::
+     BG.CInt
+  -> IO BG.CULong
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long3@
+hs_bindgen_c2d07eaaab82d408 ::
+     A
+  -> IO BG.CULong
+hs_bindgen_c2d07eaaab82d408 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c2d07eaaab82d408_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CULong
+ret_long3 = hs_bindgen_c2d07eaaab82d408
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_float@
+foreign import ccall safe "hs_bindgen_0edfbc7067faa1f7" hs_bindgen_0edfbc7067faa1f7_base ::
+     BG.CInt
+  -> IO BG.CFloat
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_float@
+hs_bindgen_0edfbc7067faa1f7 ::
+     A
+  -> IO BG.CFloat
+hs_bindgen_0edfbc7067faa1f7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0edfbc7067faa1f7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CFloat
+ret_float = hs_bindgen_0edfbc7067faa1f7
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_double@
+foreign import ccall safe "hs_bindgen_786ca672396b33be" hs_bindgen_786ca672396b33be_base ::
+     BG.CInt
+  -> IO BG.CDouble
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_double@
+hs_bindgen_786ca672396b33be ::
+     A
+  -> IO BG.CDouble
+hs_bindgen_786ca672396b33be =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_786ca672396b33be_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CDouble
+ret_double = hs_bindgen_786ca672396b33be
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_bool1@
+foreign import ccall safe "hs_bindgen_2e99f19b59650996" hs_bindgen_2e99f19b59650996_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_bool1@
+hs_bindgen_2e99f19b59650996 ::
+     A
+  -> IO BG.CBool
+hs_bindgen_2e99f19b59650996 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2e99f19b59650996_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+ret_bool1 = hs_bindgen_2e99f19b59650996
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_struct@
+foreign import ccall safe "hs_bindgen_6c999121eed8178f" hs_bindgen_6c999121eed8178f_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_struct@
+hs_bindgen_6c999121eed8178f ::
+     A
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_6c999121eed8178f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6c999121eed8178f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_struct
+ret_struct =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_6c999121eed8178f arg10 res1)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_union@
+foreign import ccall safe "hs_bindgen_481ee5d2d9bd34db" hs_bindgen_481ee5d2d9bd34db_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_union@
+hs_bindgen_481ee5d2d9bd34db ::
+     A
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_481ee5d2d9bd34db =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_481ee5d2d9bd34db_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_union
+ret_union =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_481ee5d2d9bd34db arg10 res1)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_enum@
+foreign import ccall safe "hs_bindgen_8bb240ba453b700d" hs_bindgen_8bb240ba453b700d_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_enum@
+hs_bindgen_8bb240ba453b700d ::
+     A
+  -> IO Some_enum
+hs_bindgen_8bb240ba453b700d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8bb240ba453b700d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_enum
+ret_enum = hs_bindgen_8bb240ba453b700d
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer1@
+foreign import ccall safe "hs_bindgen_c346ed2cd20b9af1" hs_bindgen_c346ed2cd20b9af1_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer1@
+hs_bindgen_c346ed2cd20b9af1 ::
+     A
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_c346ed2cd20b9af1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c346ed2cd20b9af1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+ret_pointer1 = hs_bindgen_c346ed2cd20b9af1
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer2@
+foreign import ccall safe "hs_bindgen_a21f618658151728" hs_bindgen_a21f618658151728_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer2@
+hs_bindgen_a21f618658151728 ::
+     A
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_a21f618658151728 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a21f618658151728_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+ret_pointer2 = hs_bindgen_a21f618658151728
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer3@
+foreign import ccall safe "hs_bindgen_2d8c6e2d2f395342" hs_bindgen_2d8c6e2d2f395342_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer3@
+hs_bindgen_2d8c6e2d2f395342 ::
+     A
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_2d8c6e2d2f395342 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2d8c6e2d2f395342_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.Void)
+ret_pointer3 = hs_bindgen_2d8c6e2d2f395342
+
+-- __unique:__ @test_macrosreparse_Example_Safe_body1@
+foreign import ccall safe "hs_bindgen_b030d02030ed80bc" hs_bindgen_b030d02030ed80bc_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Safe_body1@
+hs_bindgen_b030d02030ed80bc ::
+     A
+  -> IO BG.CInt
+hs_bindgen_b030d02030ed80bc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b030d02030ed80bc_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+body1 = hs_bindgen_b030d02030ed80bc
+
+-- __unique:__ @test_macrosreparse_Example_Safe_body2@
+foreign import ccall safe "hs_bindgen_be50427e6a63df54" hs_bindgen_be50427e6a63df54_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Safe_body2@
+hs_bindgen_be50427e6a63df54 :: IO A
+hs_bindgen_be50427e6a63df54 =
+  fmap BG.fromFFIType hs_bindgen_be50427e6a63df54_base
+
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2 :: IO A
+body2 = hs_bindgen_be50427e6a63df54
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_float@
+foreign import ccall safe "hs_bindgen_627a52a5c7617083" hs_bindgen_627a52a5c7617083_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_float@
+hs_bindgen_627a52a5c7617083 ::
+     A
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_627a52a5c7617083 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_627a52a5c7617083_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_float =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_627a52a5c7617083 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_double@
+foreign import ccall safe "hs_bindgen_392babebc1d83503" hs_bindgen_392babebc1d83503_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_double@
+hs_bindgen_392babebc1d83503 ::
+     A
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_392babebc1d83503 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_392babebc1d83503_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_double =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_392babebc1d83503 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_float@
+foreign import ccall safe "hs_bindgen_8958183ede73dea8" hs_bindgen_8958183ede73dea8_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_float@
+hs_bindgen_8958183ede73dea8 ::
+     A
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_8958183ede73dea8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8958183ede73dea8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CFloat)
+ret_complex_float =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_8958183ede73dea8 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_double@
+foreign import ccall safe "hs_bindgen_a95fabfd391a99aa" hs_bindgen_a95fabfd391a99aa_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_double@
+hs_bindgen_a95fabfd391a99aa ::
+     A
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_a95fabfd391a99aa =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a95fabfd391a99aa_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CDouble)
+ret_complex_double =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_a95fabfd391a99aa arg10 res1)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args1@
+foreign import ccall safe "hs_bindgen_ad9f8630dd04a203" hs_bindgen_ad9f8630dd04a203_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args1@
+hs_bindgen_ad9f8630dd04a203 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_ad9f8630dd04a203 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ad9f8630dd04a203_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args1 = hs_bindgen_ad9f8630dd04a203
+
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args2@
+foreign import ccall safe "hs_bindgen_4b34178a505131e2" hs_bindgen_4b34178a505131e2_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args2@
+hs_bindgen_4b34178a505131e2 ::
+     A
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_4b34178a505131e2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4b34178a505131e2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args2 = hs_bindgen_4b34178a505131e2
+
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret1@
+foreign import ccall safe "hs_bindgen_94b225a6394496c1" hs_bindgen_94b225a6394496c1_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret1@
+hs_bindgen_94b225a6394496c1 ::
+     A
+  -> IO BG.CBool
+hs_bindgen_94b225a6394496c1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_94b225a6394496c1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+bespoke_ret1 = hs_bindgen_94b225a6394496c1
+
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret2@
+foreign import ccall safe "hs_bindgen_7c9a1792426b84a1" hs_bindgen_7c9a1792426b84a1_base ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret2@
+hs_bindgen_7c9a1792426b84a1 ::
+     A
+  -> IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_7c9a1792426b84a1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7c9a1792426b84a1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO HsBindgen.Runtime.LibC.CSize
+bespoke_ret2 = hs_bindgen_7c9a1792426b84a1
+
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args1@
+foreign import ccall safe "hs_bindgen_e20689fe39004225" hs_bindgen_e20689fe39004225_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args1@
+hs_bindgen_e20689fe39004225 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray A))
+  -> IO ()
+hs_bindgen_e20689fe39004225 =
+  \x0 ->
+    hs_bindgen_e20689fe39004225_base (BG.toFFIType x0)
+
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray A))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args1 = hs_bindgen_e20689fe39004225
+
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args2@
+foreign import ccall safe "hs_bindgen_084796e4bfd3f4cd" hs_bindgen_084796e4bfd3f4cd_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args2@
+hs_bindgen_084796e4bfd3f4cd ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr A)))
+  -> IO ()
+hs_bindgen_084796e4bfd3f4cd =
+  \x0 ->
+    hs_bindgen_084796e4bfd3f4cd_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr A)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args2 = hs_bindgen_084796e4bfd3f4cd
+
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args3@
+foreign import ccall safe "hs_bindgen_a3d1560aaa4352df" hs_bindgen_a3d1560aaa4352df_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args3@
+hs_bindgen_a3d1560aaa4352df ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 A))
+  -> IO ()
+hs_bindgen_a3d1560aaa4352df =
+  \x0 ->
+    hs_bindgen_a3d1560aaa4352df_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 A))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args3 = hs_bindgen_a3d1560aaa4352df
+
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args4@
+foreign import ccall safe "hs_bindgen_88659ccccc6c1f5f" hs_bindgen_88659ccccc6c1f5f_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args4@
+hs_bindgen_88659ccccc6c1f5f ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr A)))
+  -> IO ()
+hs_bindgen_88659ccccc6c1f5f =
+  \x0 ->
+    hs_bindgen_88659ccccc6c1f5f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr A)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args4 = hs_bindgen_88659ccccc6c1f5f
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args1@
+foreign import ccall safe "hs_bindgen_3448d03cfd41161a" hs_bindgen_3448d03cfd41161a_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args1@
+hs_bindgen_3448d03cfd41161a ::
+     A
+  -> BG.FunPtr (IO ())
+  -> IO ()
+hs_bindgen_3448d03cfd41161a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3448d03cfd41161a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args1 = hs_bindgen_3448d03cfd41161a
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args2@
+foreign import ccall safe "hs_bindgen_92d7386f0a327d25" hs_bindgen_92d7386f0a327d25_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args2@
+hs_bindgen_92d7386f0a327d25 ::
+     A
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_92d7386f0a327d25 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_92d7386f0a327d25_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args2 = hs_bindgen_92d7386f0a327d25
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args3@
+foreign import ccall safe "hs_bindgen_2881f594f98043e6" hs_bindgen_2881f594f98043e6_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args3@
+hs_bindgen_2881f594f98043e6 ::
+     A
+  -> BG.FunPtr (BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_2881f594f98043e6 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2881f594f98043e6_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args3 = hs_bindgen_2881f594f98043e6
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args4@
+foreign import ccall safe "hs_bindgen_1e85a05df4251f62" hs_bindgen_1e85a05df4251f62_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args4@
+hs_bindgen_1e85a05df4251f62 ::
+     A
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+  -> IO ()
+hs_bindgen_1e85a05df4251f62 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1e85a05df4251f62_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args4 = hs_bindgen_1e85a05df4251f62
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args5@
+foreign import ccall safe "hs_bindgen_ccf4db7511f0d6d6" hs_bindgen_ccf4db7511f0d6d6_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args5@
+hs_bindgen_ccf4db7511f0d6d6 ::
+     A
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+  -> IO ()
+hs_bindgen_ccf4db7511f0d6d6 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ccf4db7511f0d6d6_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args5 = hs_bindgen_ccf4db7511f0d6d6
+
+-- __unique:__ @test_macrosreparse_Example_Safe_comments1@
+foreign import ccall safe "hs_bindgen_4c756db60673d221" hs_bindgen_4c756db60673d221_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_comments1@
+hs_bindgen_4c756db60673d221 ::
+     A
+  -> IO ()
+hs_bindgen_4c756db60673d221 =
+  \x0 ->
+    hs_bindgen_4c756db60673d221_base (BG.toFFIType x0)
+
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+comments1 = hs_bindgen_4c756db60673d221
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before1@
+foreign import ccall safe "hs_bindgen_278568d7a2a3a4b6" hs_bindgen_278568d7a2a3a4b6_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before1@
+hs_bindgen_278568d7a2a3a4b6 ::
+     A
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_278568d7a2a3a4b6 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_278568d7a2a3a4b6_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before1 = hs_bindgen_278568d7a2a3a4b6
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before2@
+foreign import ccall safe "hs_bindgen_87ee56525e5ea20c" hs_bindgen_87ee56525e5ea20c_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before2@
+hs_bindgen_87ee56525e5ea20c ::
+     A
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_87ee56525e5ea20c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_87ee56525e5ea20c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before2 = hs_bindgen_87ee56525e5ea20c
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before3@
+foreign import ccall safe "hs_bindgen_c0b99594235bd99e" hs_bindgen_c0b99594235bd99e_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before3@
+hs_bindgen_c0b99594235bd99e ::
+     A
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_c0b99594235bd99e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c0b99594235bd99e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before3 = hs_bindgen_c0b99594235bd99e
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after1@
+foreign import ccall safe "hs_bindgen_d718b682f157fc18" hs_bindgen_d718b682f157fc18_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after1@
+hs_bindgen_d718b682f157fc18 ::
+     A
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_d718b682f157fc18 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d718b682f157fc18_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after1 = hs_bindgen_d718b682f157fc18
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after2@
+foreign import ccall safe "hs_bindgen_f2c5b3d5eca68433" hs_bindgen_f2c5b3d5eca68433_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after2@
+hs_bindgen_f2c5b3d5eca68433 ::
+     A
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_f2c5b3d5eca68433 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f2c5b3d5eca68433_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after2 = hs_bindgen_f2c5b3d5eca68433
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after3@
+foreign import ccall safe "hs_bindgen_ae2d994e06667b23" hs_bindgen_ae2d994e06667b23_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after3@
+hs_bindgen_ae2d994e06667b23 ::
+     A
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_ae2d994e06667b23 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ae2d994e06667b23_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after3 = hs_bindgen_ae2d994e06667b23
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before1@
+foreign import ccall safe "hs_bindgen_6940b58e7f4397a7" hs_bindgen_6940b58e7f4397a7_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before1@
+hs_bindgen_6940b58e7f4397a7 ::
+     A
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_6940b58e7f4397a7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6940b58e7f4397a7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before1 =
+  hs_bindgen_6940b58e7f4397a7
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before2@
+foreign import ccall safe "hs_bindgen_00b6fe2282e779b1" hs_bindgen_00b6fe2282e779b1_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before2@
+hs_bindgen_00b6fe2282e779b1 ::
+     A
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_00b6fe2282e779b1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_00b6fe2282e779b1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before2 =
+  hs_bindgen_00b6fe2282e779b1
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before3@
+foreign import ccall safe "hs_bindgen_6517cc8d39aead93" hs_bindgen_6517cc8d39aead93_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before3@
+hs_bindgen_6517cc8d39aead93 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_6517cc8d39aead93 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6517cc8d39aead93_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before3 =
+  hs_bindgen_6517cc8d39aead93
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before4@
+foreign import ccall safe "hs_bindgen_68c7661e95060488" hs_bindgen_68c7661e95060488_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before4@
+hs_bindgen_68c7661e95060488 ::
+     A
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_68c7661e95060488 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_68c7661e95060488_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_68c7661e95060488 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before5@
+foreign import ccall safe "hs_bindgen_42b3b0bf73a7a51a" hs_bindgen_42b3b0bf73a7a51a_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before5@
+hs_bindgen_42b3b0bf73a7a51a ::
+     A
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_42b3b0bf73a7a51a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_42b3b0bf73a7a51a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_42b3b0bf73a7a51a arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before6@
+foreign import ccall safe "hs_bindgen_c4aabe9834aac12f" hs_bindgen_c4aabe9834aac12f_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before6@
+hs_bindgen_c4aabe9834aac12f ::
+     A
+  -> Some_enum
+  -> IO ()
+hs_bindgen_c4aabe9834aac12f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c4aabe9834aac12f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before6 =
+  hs_bindgen_c4aabe9834aac12f
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before7@
+foreign import ccall safe "hs_bindgen_486090a7fb4e34d4" hs_bindgen_486090a7fb4e34d4_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before7@
+hs_bindgen_486090a7fb4e34d4 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_486090a7fb4e34d4 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_486090a7fb4e34d4_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before7 =
+  hs_bindgen_486090a7fb4e34d4
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before8@
+foreign import ccall safe "hs_bindgen_23fa742b614176dd" hs_bindgen_23fa742b614176dd_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before8@
+hs_bindgen_23fa742b614176dd ::
+     A
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_23fa742b614176dd =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_23fa742b614176dd_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before8 =
+  hs_bindgen_23fa742b614176dd
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after1@
+foreign import ccall safe "hs_bindgen_0aacd8a5d48f296d" hs_bindgen_0aacd8a5d48f296d_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after1@
+hs_bindgen_0aacd8a5d48f296d ::
+     A
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_0aacd8a5d48f296d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0aacd8a5d48f296d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after1 =
+  hs_bindgen_0aacd8a5d48f296d
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after2@
+foreign import ccall safe "hs_bindgen_16ec2102221485b7" hs_bindgen_16ec2102221485b7_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after2@
+hs_bindgen_16ec2102221485b7 ::
+     A
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_16ec2102221485b7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_16ec2102221485b7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after2 =
+  hs_bindgen_16ec2102221485b7
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after3@
+foreign import ccall safe "hs_bindgen_9aa934d44ec3790c" hs_bindgen_9aa934d44ec3790c_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after3@
+hs_bindgen_9aa934d44ec3790c ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_9aa934d44ec3790c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9aa934d44ec3790c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after3 =
+  hs_bindgen_9aa934d44ec3790c
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after4@
+foreign import ccall safe "hs_bindgen_043d2869e29bedcf" hs_bindgen_043d2869e29bedcf_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after4@
+hs_bindgen_043d2869e29bedcf ::
+     A
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_043d2869e29bedcf =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_043d2869e29bedcf_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_043d2869e29bedcf arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after5@
+foreign import ccall safe "hs_bindgen_b5f9bca1de9d69de" hs_bindgen_b5f9bca1de9d69de_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after5@
+hs_bindgen_b5f9bca1de9d69de ::
+     A
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_b5f9bca1de9d69de =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b5f9bca1de9d69de_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_b5f9bca1de9d69de arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after6@
+foreign import ccall safe "hs_bindgen_77d641d518b2504f" hs_bindgen_77d641d518b2504f_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after6@
+hs_bindgen_77d641d518b2504f ::
+     A
+  -> Some_enum
+  -> IO ()
+hs_bindgen_77d641d518b2504f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_77d641d518b2504f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after6 =
+  hs_bindgen_77d641d518b2504f
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after7@
+foreign import ccall safe "hs_bindgen_691b4f2909140b49" hs_bindgen_691b4f2909140b49_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after7@
+hs_bindgen_691b4f2909140b49 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_691b4f2909140b49 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_691b4f2909140b49_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after7 =
+  hs_bindgen_691b4f2909140b49
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after8@
+foreign import ccall safe "hs_bindgen_ae74c8dcdc2ec9eb" hs_bindgen_ae74c8dcdc2ec9eb_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after8@
+hs_bindgen_ae74c8dcdc2ec9eb ::
+     A
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_ae74c8dcdc2ec9eb =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ae74c8dcdc2ec9eb_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after8 =
+  hs_bindgen_ae74c8dcdc2ec9eb
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args1@
+foreign import ccall safe "hs_bindgen_07606c41eadf9146" hs_bindgen_07606c41eadf9146_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args1@
+hs_bindgen_07606c41eadf9146 ::
+     A
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_07606c41eadf9146 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_07606c41eadf9146_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args1 = hs_bindgen_07606c41eadf9146
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args2@
+foreign import ccall safe "hs_bindgen_3836769f3a3416ac" hs_bindgen_3836769f3a3416ac_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args2@
+hs_bindgen_3836769f3a3416ac ::
+     A
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_3836769f3a3416ac =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3836769f3a3416ac_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args2 = hs_bindgen_3836769f3a3416ac
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args3@
+foreign import ccall safe "hs_bindgen_12f19ea593aefd3f" hs_bindgen_12f19ea593aefd3f_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args3@
+hs_bindgen_12f19ea593aefd3f ::
+     A
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_12f19ea593aefd3f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_12f19ea593aefd3f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args3 = hs_bindgen_12f19ea593aefd3f
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args4@
+foreign import ccall safe "hs_bindgen_5a50e98897696d57" hs_bindgen_5a50e98897696d57_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args4@
+hs_bindgen_5a50e98897696d57 ::
+     A
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_5a50e98897696d57 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5a50e98897696d57_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args4 = hs_bindgen_5a50e98897696d57
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args5@
+foreign import ccall safe "hs_bindgen_666701f7cb61bd15" hs_bindgen_666701f7cb61bd15_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args5@
+hs_bindgen_666701f7cb61bd15 ::
+     A
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_666701f7cb61bd15 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_666701f7cb61bd15_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args5 = hs_bindgen_666701f7cb61bd15
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret1@
+foreign import ccall safe "hs_bindgen_b94fbc3dfd285563" hs_bindgen_b94fbc3dfd285563_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret1@
+hs_bindgen_b94fbc3dfd285563 ::
+     A
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_b94fbc3dfd285563 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b94fbc3dfd285563_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret1 = hs_bindgen_b94fbc3dfd285563
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret2@
+foreign import ccall safe "hs_bindgen_33e2960e26b79450" hs_bindgen_33e2960e26b79450_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret2@
+hs_bindgen_33e2960e26b79450 ::
+     A
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_33e2960e26b79450 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_33e2960e26b79450_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret2 = hs_bindgen_33e2960e26b79450
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret3@
+foreign import ccall safe "hs_bindgen_50c6e2fe4f3fb777" hs_bindgen_50c6e2fe4f3fb777_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret3@
+hs_bindgen_50c6e2fe4f3fb777 ::
+     A
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_50c6e2fe4f3fb777 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_50c6e2fe4f3fb777_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+const_pointers_ret3 = hs_bindgen_50c6e2fe4f3fb777
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret4@
+foreign import ccall safe "hs_bindgen_edc014695d896c8d" hs_bindgen_edc014695d896c8d_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret4@
+hs_bindgen_edc014695d896c8d ::
+     A
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_edc014695d896c8d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_edc014695d896c8d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret4 = hs_bindgen_edc014695d896c8d
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret5@
+foreign import ccall safe "hs_bindgen_6d3308cc5847f033" hs_bindgen_6d3308cc5847f033_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret5@
+hs_bindgen_6d3308cc5847f033 ::
+     A
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_6d3308cc5847f033 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6d3308cc5847f033_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret5 = hs_bindgen_6d3308cc5847f033
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem1@
+foreign import ccall safe "hs_bindgen_678576320923a4d1" hs_bindgen_678576320923a4d1_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem1@
+hs_bindgen_678576320923a4d1 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray A))
+  -> IO ()
+hs_bindgen_678576320923a4d1 =
+  \x0 ->
+    hs_bindgen_678576320923a4d1_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray A))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem1 = hs_bindgen_678576320923a4d1
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem2@
+foreign import ccall safe "hs_bindgen_b317941dde4eeff2" hs_bindgen_b317941dde4eeff2_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem2@
+hs_bindgen_b317941dde4eeff2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst A)))
+  -> IO ()
+hs_bindgen_b317941dde4eeff2 =
+  \x0 ->
+    hs_bindgen_b317941dde4eeff2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst A)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem2 = hs_bindgen_b317941dde4eeff2
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem3@
+foreign import ccall safe "hs_bindgen_707e602e6beb1bb6" hs_bindgen_707e602e6beb1bb6_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem3@
+hs_bindgen_707e602e6beb1bb6 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr A)))
+  -> IO ()
+hs_bindgen_707e602e6beb1bb6 =
+  \x0 ->
+    hs_bindgen_707e602e6beb1bb6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr A)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem3 = hs_bindgen_707e602e6beb1bb6
+
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams1@
+foreign import ccall safe "hs_bindgen_93fecb4eb766c262" hs_bindgen_93fecb4eb766c262_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams1@
+hs_bindgen_93fecb4eb766c262 :: IO A
+hs_bindgen_93fecb4eb766c262 =
+  fmap BG.fromFFIType hs_bindgen_93fecb4eb766c262_base
+
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1 :: IO A
+noParams1 = hs_bindgen_93fecb4eb766c262
+
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams2@
+foreign import ccall safe "hs_bindgen_4350965157c891f5" hs_bindgen_4350965157c891f5_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams2@
+hs_bindgen_4350965157c891f5 :: IO A
+hs_bindgen_4350965157c891f5 =
+  fmap BG.fromFFIType hs_bindgen_4350965157c891f5_base
+
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2 :: IO A
+noParams2 = hs_bindgen_4350965157c891f5
+
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams3@
+foreign import ccall safe "hs_bindgen_c4f59272a2b1c3b5" hs_bindgen_c4f59272a2b1c3b5_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams3@
+hs_bindgen_c4f59272a2b1c3b5 ::
+     A
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_c4f59272a2b1c3b5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c4f59272a2b1c3b5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+noParams3 = hs_bindgen_c4f59272a2b1c3b5
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret1@
+foreign import ccall safe "hs_bindgen_387a04c01e23c320" hs_bindgen_387a04c01e23c320_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret1@
+hs_bindgen_387a04c01e23c320 ::
+     A
+  -> IO (BG.FunPtr (IO ()))
+hs_bindgen_387a04c01e23c320 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_387a04c01e23c320_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO ()))
+funptr_ret1 = hs_bindgen_387a04c01e23c320
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret2@
+foreign import ccall safe "hs_bindgen_6f0c14cd3478dc19" hs_bindgen_6f0c14cd3478dc19_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret2@
+hs_bindgen_6f0c14cd3478dc19 ::
+     A
+  -> IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_6f0c14cd3478dc19 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6f0c14cd3478dc19_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO BG.CInt))
+funptr_ret2 = hs_bindgen_6f0c14cd3478dc19
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret3@
+foreign import ccall safe "hs_bindgen_08e8661d277cf7be" hs_bindgen_08e8661d277cf7be_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret3@
+hs_bindgen_08e8661d277cf7be ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_08e8661d277cf7be =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_08e8661d277cf7be_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+funptr_ret3 = hs_bindgen_08e8661d277cf7be
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret4@
+foreign import ccall safe "hs_bindgen_609b5d953b68da92" hs_bindgen_609b5d953b68da92_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret4@
+hs_bindgen_609b5d953b68da92 ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+hs_bindgen_609b5d953b68da92 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_609b5d953b68da92_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+funptr_ret4 = hs_bindgen_609b5d953b68da92
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret5@
+foreign import ccall safe "hs_bindgen_13e6ae43abf40aee" hs_bindgen_13e6ae43abf40aee_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret5@
+hs_bindgen_13e6ae43abf40aee ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_13e6ae43abf40aee =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_13e6ae43abf40aee_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret5 = hs_bindgen_13e6ae43abf40aee
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret6@
+foreign import ccall safe "hs_bindgen_a4a3a86f28ca6299" hs_bindgen_a4a3a86f28ca6299_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret6@
+hs_bindgen_a4a3a86f28ca6299 ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_a4a3a86f28ca6299 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a4a3a86f28ca6299_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret6 = hs_bindgen_a4a3a86f28ca6299
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret7@
+foreign import ccall safe "hs_bindgen_eae9dff04c88d00b" hs_bindgen_eae9dff04c88d00b_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret7@
+hs_bindgen_eae9dff04c88d00b ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_eae9dff04c88d00b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_eae9dff04c88d00b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret7 = hs_bindgen_eae9dff04c88d00b
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret8@
+foreign import ccall safe "hs_bindgen_894457d90a2fc8db" hs_bindgen_894457d90a2fc8db_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret8@
+hs_bindgen_894457d90a2fc8db ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_894457d90a2fc8db =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_894457d90a2fc8db_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret8 = hs_bindgen_894457d90a2fc8db
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret9@
+foreign import ccall safe "hs_bindgen_c893eb15ad9bc68c" hs_bindgen_c893eb15ad9bc68c_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret9@
+hs_bindgen_c893eb15ad9bc68c ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_c893eb15ad9bc68c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c893eb15ad9bc68c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret9 = hs_bindgen_c893eb15ad9bc68c
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret10@
+foreign import ccall safe "hs_bindgen_d96c258298a44b28" hs_bindgen_d96c258298a44b28_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret10@
+hs_bindgen_d96c258298a44b28 ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_d96c258298a44b28 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d96c258298a44b28_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret10 = hs_bindgen_d96c258298a44b28
diff --git a/test-artefacts/fixtures/macros/reparse/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/Example/Unsafe.hs
@@ -0,0 +1,4006 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.args_char1
+    , Example.Unsafe.args_char2
+    , Example.Unsafe.args_char3
+    , Example.Unsafe.args_short1
+    , Example.Unsafe.args_short2
+    , Example.Unsafe.args_short3
+    , Example.Unsafe.args_int1
+    , Example.Unsafe.args_int2
+    , Example.Unsafe.args_int3
+    , Example.Unsafe.args_long1
+    , Example.Unsafe.args_long2
+    , Example.Unsafe.args_long3
+    , Example.Unsafe.args_float
+    , Example.Unsafe.args_double
+    , Example.Unsafe.args_bool1
+    , Example.Unsafe.args_struct
+    , Example.Unsafe.args_union
+    , Example.Unsafe.args_enum
+    , Example.Unsafe.args_pointer1
+    , Example.Unsafe.args_pointer2
+    , Example.Unsafe.args_pointer3
+    , Example.Unsafe.ret_A
+    , Example.Unsafe.ret_char1
+    , Example.Unsafe.ret_char2
+    , Example.Unsafe.ret_char3
+    , Example.Unsafe.ret_short1
+    , Example.Unsafe.ret_short2
+    , Example.Unsafe.ret_short3
+    , Example.Unsafe.ret_int1
+    , Example.Unsafe.ret_int2
+    , Example.Unsafe.ret_int3
+    , Example.Unsafe.ret_long1
+    , Example.Unsafe.ret_long2
+    , Example.Unsafe.ret_long3
+    , Example.Unsafe.ret_float
+    , Example.Unsafe.ret_double
+    , Example.Unsafe.ret_bool1
+    , Example.Unsafe.ret_struct
+    , Example.Unsafe.ret_union
+    , Example.Unsafe.ret_enum
+    , Example.Unsafe.ret_pointer1
+    , Example.Unsafe.ret_pointer2
+    , Example.Unsafe.ret_pointer3
+    , Example.Unsafe.body1
+    , Example.Unsafe.body2
+    , Example.Unsafe.args_complex_float
+    , Example.Unsafe.args_complex_double
+    , Example.Unsafe.ret_complex_float
+    , Example.Unsafe.ret_complex_double
+    , Example.Unsafe.bespoke_args1
+    , Example.Unsafe.bespoke_args2
+    , Example.Unsafe.bespoke_ret1
+    , Example.Unsafe.bespoke_ret2
+    , Example.Unsafe.arr_args1
+    , Example.Unsafe.arr_args2
+    , Example.Unsafe.arr_args3
+    , Example.Unsafe.arr_args4
+    , Example.Unsafe.funptr_args1
+    , Example.Unsafe.funptr_args2
+    , Example.Unsafe.funptr_args3
+    , Example.Unsafe.funptr_args4
+    , Example.Unsafe.funptr_args5
+    , Example.Unsafe.comments1
+    , Example.Unsafe.const_prim_before1
+    , Example.Unsafe.const_prim_before2
+    , Example.Unsafe.const_prim_before3
+    , Example.Unsafe.const_prim_after1
+    , Example.Unsafe.const_prim_after2
+    , Example.Unsafe.const_prim_after3
+    , Example.Unsafe.const_withoutSign_before1
+    , Example.Unsafe.const_withoutSign_before2
+    , Example.Unsafe.const_withoutSign_before3
+    , Example.Unsafe.const_withoutSign_before4
+    , Example.Unsafe.const_withoutSign_before5
+    , Example.Unsafe.const_withoutSign_before6
+    , Example.Unsafe.const_withoutSign_before7
+    , Example.Unsafe.const_withoutSign_before8
+    , Example.Unsafe.const_withoutSign_after1
+    , Example.Unsafe.const_withoutSign_after2
+    , Example.Unsafe.const_withoutSign_after3
+    , Example.Unsafe.const_withoutSign_after4
+    , Example.Unsafe.const_withoutSign_after5
+    , Example.Unsafe.const_withoutSign_after6
+    , Example.Unsafe.const_withoutSign_after7
+    , Example.Unsafe.const_withoutSign_after8
+    , Example.Unsafe.const_pointers_args1
+    , Example.Unsafe.const_pointers_args2
+    , Example.Unsafe.const_pointers_args3
+    , Example.Unsafe.const_pointers_args4
+    , Example.Unsafe.const_pointers_args5
+    , Example.Unsafe.const_pointers_ret1
+    , Example.Unsafe.const_pointers_ret2
+    , Example.Unsafe.const_pointers_ret3
+    , Example.Unsafe.const_pointers_ret4
+    , Example.Unsafe.const_pointers_ret5
+    , Example.Unsafe.const_array_elem1
+    , Example.Unsafe.const_array_elem2
+    , Example.Unsafe.const_array_elem3
+    , Example.Unsafe.noParams1
+    , Example.Unsafe.noParams2
+    , Example.Unsafe.noParams3
+    , Example.Unsafe.funptr_ret1
+    , Example.Unsafe.funptr_ret2
+    , Example.Unsafe.funptr_ret3
+    , Example.Unsafe.funptr_ret4
+    , Example.Unsafe.funptr_ret5
+    , Example.Unsafe.funptr_ret6
+    , Example.Unsafe.funptr_ret7
+    , Example.Unsafe.funptr_ret8
+    , Example.Unsafe.funptr_ret9
+    , Example.Unsafe.funptr_ret10
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse.h>"
+  , "void hs_bindgen_c1716e300ba327c7 ("
+  , "  A arg1,"
+  , "  char arg2"
+  , ")"
+  , "{"
+  , "  (args_char1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3ef14607a6187aaa ("
+  , "  A arg1,"
+  , "  signed char arg2"
+  , ")"
+  , "{"
+  , "  (args_char2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_5b0a626f64912f9d ("
+  , "  A arg1,"
+  , "  unsigned char arg2"
+  , ")"
+  , "{"
+  , "  (args_char3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_36e4501239085bc1 ("
+  , "  A arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a187e0233daeb237 ("
+  , "  A arg1,"
+  , "  signed short arg2"
+  , ")"
+  , "{"
+  , "  (args_short2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_2460adeff61561ce ("
+  , "  A arg1,"
+  , "  unsigned short arg2"
+  , ")"
+  , "{"
+  , "  (args_short3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4f13ab06db79b7f2 ("
+  , "  A arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f1657d18f6f8a1ed ("
+  , "  A arg1,"
+  , "  signed int arg2"
+  , ")"
+  , "{"
+  , "  (args_int2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9ac58b8eb806be42 ("
+  , "  A arg1,"
+  , "  unsigned int arg2"
+  , ")"
+  , "{"
+  , "  (args_int3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_f73c59fe22a9870e ("
+  , "  A arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_84a824853fc83077 ("
+  , "  A arg1,"
+  , "  signed long arg2"
+  , ")"
+  , "{"
+  , "  (args_long2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c4c1a08ddf9cd5bc ("
+  , "  A arg1,"
+  , "  unsigned long arg2"
+  , ")"
+  , "{"
+  , "  (args_long3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_58a6b5f118525c6c ("
+  , "  A arg1,"
+  , "  float arg2"
+  , ")"
+  , "{"
+  , "  (args_float)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_ffc58625c3a51d8f ("
+  , "  A arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  (args_double)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_51fb2da1d100c9a7 ("
+  , "  A arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (args_bool1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b2d19f91a7b9f7d3 ("
+  , "  A arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  (args_struct)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_bc74164a05d282c7 ("
+  , "  A arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  (args_union)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_69f08c1d9f5e590e ("
+  , "  A arg1,"
+  , "  enum some_enum arg2"
+  , ")"
+  , "{"
+  , "  (args_enum)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_785b005f35d4d7ec ("
+  , "  A arg1,"
+  , "  signed int *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_edc45a1b9750dcd3 ("
+  , "  A arg1,"
+  , "  signed int **arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_102895862f35ca35 ("
+  , "  A arg1,"
+  , "  void *arg2"
+  , ")"
+  , "{"
+  , "  (args_pointer3)(arg1, arg2);"
+  , "}"
+  , "A hs_bindgen_78f9ea765accb501 (void)"
+  , "{"
+  , "  return (ret_A)();"
+  , "}"
+  , "char hs_bindgen_e1e99ef9fc54a288 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char1)(arg1);"
+  , "}"
+  , "signed char hs_bindgen_f6217639a7e142d3 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char2)(arg1);"
+  , "}"
+  , "unsigned char hs_bindgen_759b6cec946323f4 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_char3)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_bf062c8332405f82 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short1)(arg1);"
+  , "}"
+  , "signed short hs_bindgen_3d9d5e4b8135169a ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short2)(arg1);"
+  , "}"
+  , "unsigned short hs_bindgen_63b44610868e424f ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_short3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_1a8d68c887085fbf ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f64653c7b4576075 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int2)(arg1);"
+  , "}"
+  , "unsigned int hs_bindgen_d2030910b711f1d8 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_int3)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_2d6a30810e6b27e3 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long1)(arg1);"
+  , "}"
+  , "signed long hs_bindgen_02885fe1cf2771da ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long2)(arg1);"
+  , "}"
+  , "unsigned long hs_bindgen_888c9704132541d5 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_long3)(arg1);"
+  , "}"
+  , "float hs_bindgen_2d2ce0d386f26293 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_float)(arg1);"
+  , "}"
+  , "double hs_bindgen_de353a737de53428 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_double)(arg1);"
+  , "}"
+  , "_Bool hs_bindgen_91e2ab77e68f0288 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_bool1)(arg1);"
+  , "}"
+  , "void hs_bindgen_9f29c7eee02f6d53 ("
+  , "  A arg1,"
+  , "  struct some_struct *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_struct)(arg1);"
+  , "}"
+  , "void hs_bindgen_6844bf5f5a5f6681 ("
+  , "  A arg1,"
+  , "  union some_union *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_union)(arg1);"
+  , "}"
+  , "enum some_enum hs_bindgen_f96c4bc30b6b17e8 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_enum)(arg1);"
+  , "}"
+  , "signed int *hs_bindgen_bfb6069e1423e7a5 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer1)(arg1);"
+  , "}"
+  , "signed int **hs_bindgen_ffae633548386d89 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer2)(arg1);"
+  , "}"
+  , "void *hs_bindgen_550cb4a23c6ab2ff ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (ret_pointer3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f7a7a45a80ae39f7 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (body1)(arg1);"
+  , "}"
+  , "A hs_bindgen_364e73b014d7d4df (void)"
+  , "{"
+  , "  return (body2)();"
+  , "}"
+  , "void hs_bindgen_88b4cd11afc4f6c1 ("
+  , "  A arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_float)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_0ddc53d8e91cb32a ("
+  , "  A arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  (args_complex_double)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_eb82eb840e288900 ("
+  , "  A arg1,"
+  , "  float _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_float)(arg1);"
+  , "}"
+  , "void hs_bindgen_cbc25ea9cbdd2365 ("
+  , "  A arg1,"
+  , "  double _Complex *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (ret_complex_double)(arg1);"
+  , "}"
+  , "void hs_bindgen_3258de4ffd2c08af ("
+  , "  A arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_74b2cd1defdd5609 ("
+  , "  A arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  (bespoke_args2)(arg1, arg2);"
+  , "}"
+  , "_Bool hs_bindgen_5405c1e037d1e115 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret1)(arg1);"
+  , "}"
+  , "size_t hs_bindgen_a6a3e5a828532360 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (bespoke_ret2)(arg1);"
+  , "}"
+  , "void hs_bindgen_4956a52bf5073b9f ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args1)(arg1);"
+  , "}"
+  , "void hs_bindgen_0fc8b091085a88e9 ("
+  , "  A **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args2)(arg1);"
+  , "}"
+  , "void hs_bindgen_ca6f1bc1a29b85f8 ("
+  , "  A *arg1"
+  , ")"
+  , "{"
+  , "  (arr_args3)(arg1);"
+  , "}"
+  , "void hs_bindgen_a168ae0de206febe ("
+  , "  A **arg1"
+  , ")"
+  , "{"
+  , "  (arr_args4)(arg1);"
+  , "}"
+  , "void hs_bindgen_8e63f57f1f5d662e ("
+  , "  A arg1,"
+  , "  void (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_927bd07f48d05d21 ("
+  , "  A arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (funptr_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c82e078d3c54a6bc ("
+  , "  A arg1,"
+  , "  void (*arg2) ("
+  , "  signed int arg1"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_211ad1ac5399caec ("
+  , "  A arg1,"
+  , "  char (*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_9057c59d70e815d7 ("
+  , "  A arg1,"
+  , "  signed int *(*arg2) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , ")"
+  , "{"
+  , "  (funptr_args5)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_153515e0ff74574f ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  (comments1)(arg1);"
+  , "}"
+  , "void hs_bindgen_8cc833db463cc95c ("
+  , "  A arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d767bbef00031d57 ("
+  , "  A arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a36dfeb811993297 ("
+  , "  A arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d7fa2440be24e954 ("
+  , "  A arg1,"
+  , "  char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c169229f24baf752 ("
+  , "  A arg1,"
+  , "  signed char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c0780f7624ed1d3e ("
+  , "  A arg1,"
+  , "  unsigned char const arg2"
+  , ")"
+  , "{"
+  , "  (const_prim_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_fda903bc1139b1d6 ("
+  , "  A arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a5a70f3be654ea00 ("
+  , "  A arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_b813910f6a632ce2 ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_dc22b02b2f53aa5b ("
+  , "  A arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_503736261279760d ("
+  , "  A arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_ed0a8c0e15f5d2ce ("
+  , "  A arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4659c22d39cc1bb3 ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_530245b77093b08c ("
+  , "  A arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_before8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_c31a804bd742193e ("
+  , "  A arg1,"
+  , "  float const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_53756fa3a68ab067 ("
+  , "  A arg1,"
+  , "  double const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_4134ad71149d6139 ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3de6157427334101 ("
+  , "  A arg1,"
+  , "  struct some_struct const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after4)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_fc4ef8c9107c1ae6 ("
+  , "  A arg1,"
+  , "  union some_union const *arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after5)(arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_5e20c60b725ae606 ("
+  , "  A arg1,"
+  , "  enum some_enum const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after6)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_a0f20d4b9a07ff5b ("
+  , "  A arg1,"
+  , "  _Bool const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after7)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_3a020035eb2fe7f8 ("
+  , "  A arg1,"
+  , "  size_t const arg2"
+  , ")"
+  , "{"
+  , "  (const_withoutSign_after8)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_17623ba5065bf95d ("
+  , "  A arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args1)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_02d08ccd5df88a98 ("
+  , "  A arg1,"
+  , "  signed int const *arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args2)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_50c423f2237cb6b5 ("
+  , "  A arg1,"
+  , "  signed int *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args3)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_99c29c45d78348e9 ("
+  , "  A arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args4)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_6a92dbfae24b1bcd ("
+  , "  A arg1,"
+  , "  signed int const *const arg2"
+  , ")"
+  , "{"
+  , "  (const_pointers_args5)(arg1, arg2);"
+  , "}"
+  , "signed int const *hs_bindgen_0c07f1e0256fd705 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret1)(arg1);"
+  , "}"
+  , "signed int const *hs_bindgen_d12c8210ff3c3711 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret2)(arg1);"
+  , "}"
+  , "signed int *const hs_bindgen_a58bc0be6f564801 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret3)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_622bb8150470138b ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret4)(arg1);"
+  , "}"
+  , "signed int const *const hs_bindgen_d49bd331ad2077e5 ("
+  , "  A arg1"
+  , ")"
+  , "{"
+  , "  return (const_pointers_ret5)(arg1);"
+  , "}"
+  , "void hs_bindgen_224608f780bff5bd ("
+  , "  A const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem1)(arg1);"
+  , "}"
+  , "void hs_bindgen_9aa74ad89f2c1fba ("
+  , "  A const **arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem2)(arg1);"
+  , "}"
+  , "void hs_bindgen_6a328300c5ef0c9e ("
+  , "  A *const *arg1"
+  , ")"
+  , "{"
+  , "  (const_array_elem3)(arg1);"
+  , "}"
+  , "A hs_bindgen_13a7d78e11555d58 (void)"
+  , "{"
+  , "  return (noParams1)();"
+  , "}"
+  , "A hs_bindgen_672f4691ee7a367c (void)"
+  , "{"
+  , "  return (noParams2)();"
+  , "}"
+  , "void hs_bindgen_591f84e2163a5d18 ("
+  , "  A arg1,"
+  , "  signed int (*arg2) (void)"
+  , ")"
+  , "{"
+  , "  (noParams3)(arg1, arg2);"
+  , "}"
+  , "void (*hs_bindgen_8cdf7774adb0f0b4 ("
+  , "  A arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret1)(arg1);"
+  , "}"
+  , "signed int (*hs_bindgen_a4e08267a9070ede ("
+  , "  A arg1"
+  , ")) (void)"
+  , "{"
+  , "  return (funptr_ret2)(arg1);"
+  , "}"
+  , "void (*hs_bindgen_65fa30510d244cbf ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (funptr_ret3)(arg1);"
+  , "}"
+  , "char (*hs_bindgen_da12eaec295883aa ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret4)(arg1);"
+  , "}"
+  , "signed int *(*hs_bindgen_281c53214b1cdcb4 ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret5)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_16628c257aa64a76 ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret6)(arg1);"
+  , "}"
+  , "signed int const *(*hs_bindgen_79fb0c30f546a547 ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret7)(arg1);"
+  , "}"
+  , "signed int *const (*hs_bindgen_4668d2ff9d5bfc40 ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret8)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_c044d7074789febc ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret9)(arg1);"
+  , "}"
+  , "signed int const *const (*hs_bindgen_628ced6eccc7783a ("
+  , "  A arg1"
+  , ")) ("
+  , "  signed int arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (funptr_ret10)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char1@
+foreign import ccall unsafe "hs_bindgen_c1716e300ba327c7" hs_bindgen_c1716e300ba327c7_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char1@
+hs_bindgen_c1716e300ba327c7 ::
+     A
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_c1716e300ba327c7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c1716e300ba327c7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char1 = hs_bindgen_c1716e300ba327c7
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char2@
+foreign import ccall unsafe "hs_bindgen_3ef14607a6187aaa" hs_bindgen_3ef14607a6187aaa_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char2@
+hs_bindgen_3ef14607a6187aaa ::
+     A
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_3ef14607a6187aaa =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3ef14607a6187aaa_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char2 = hs_bindgen_3ef14607a6187aaa
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char3@
+foreign import ccall unsafe "hs_bindgen_5b0a626f64912f9d" hs_bindgen_5b0a626f64912f9d_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char3@
+hs_bindgen_5b0a626f64912f9d ::
+     A
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_5b0a626f64912f9d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5b0a626f64912f9d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_char3 = hs_bindgen_5b0a626f64912f9d
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short1@
+foreign import ccall unsafe "hs_bindgen_36e4501239085bc1" hs_bindgen_36e4501239085bc1_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short1@
+hs_bindgen_36e4501239085bc1 ::
+     A
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_36e4501239085bc1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_36e4501239085bc1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short1 = hs_bindgen_36e4501239085bc1
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short2@
+foreign import ccall unsafe "hs_bindgen_a187e0233daeb237" hs_bindgen_a187e0233daeb237_base ::
+     BG.CInt
+  -> BG.CShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short2@
+hs_bindgen_a187e0233daeb237 ::
+     A
+  -> BG.CShort
+  -> IO ()
+hs_bindgen_a187e0233daeb237 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a187e0233daeb237_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short2 = hs_bindgen_a187e0233daeb237
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short3@
+foreign import ccall unsafe "hs_bindgen_2460adeff61561ce" hs_bindgen_2460adeff61561ce_base ::
+     BG.CInt
+  -> BG.CUShort
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short3@
+hs_bindgen_2460adeff61561ce ::
+     A
+  -> BG.CUShort
+  -> IO ()
+hs_bindgen_2460adeff61561ce =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_2460adeff61561ce_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUShort
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_short3 = hs_bindgen_2460adeff61561ce
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int1@
+foreign import ccall unsafe "hs_bindgen_4f13ab06db79b7f2" hs_bindgen_4f13ab06db79b7f2_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int1@
+hs_bindgen_4f13ab06db79b7f2 ::
+     A
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_4f13ab06db79b7f2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4f13ab06db79b7f2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int1 = hs_bindgen_4f13ab06db79b7f2
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int2@
+foreign import ccall unsafe "hs_bindgen_f1657d18f6f8a1ed" hs_bindgen_f1657d18f6f8a1ed_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int2@
+hs_bindgen_f1657d18f6f8a1ed ::
+     A
+  -> BG.CInt
+  -> IO ()
+hs_bindgen_f1657d18f6f8a1ed =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f1657d18f6f8a1ed_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int2 = hs_bindgen_f1657d18f6f8a1ed
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int3@
+foreign import ccall unsafe "hs_bindgen_9ac58b8eb806be42" hs_bindgen_9ac58b8eb806be42_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int3@
+hs_bindgen_9ac58b8eb806be42 ::
+     A
+  -> BG.CUInt
+  -> IO ()
+hs_bindgen_9ac58b8eb806be42 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9ac58b8eb806be42_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_int3 = hs_bindgen_9ac58b8eb806be42
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long1@
+foreign import ccall unsafe "hs_bindgen_f73c59fe22a9870e" hs_bindgen_f73c59fe22a9870e_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long1@
+hs_bindgen_f73c59fe22a9870e ::
+     A
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_f73c59fe22a9870e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_f73c59fe22a9870e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long1 = hs_bindgen_f73c59fe22a9870e
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long2@
+foreign import ccall unsafe "hs_bindgen_84a824853fc83077" hs_bindgen_84a824853fc83077_base ::
+     BG.CInt
+  -> BG.CLong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long2@
+hs_bindgen_84a824853fc83077 ::
+     A
+  -> BG.CLong
+  -> IO ()
+hs_bindgen_84a824853fc83077 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_84a824853fc83077_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CLong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long2 = hs_bindgen_84a824853fc83077
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long3@
+foreign import ccall unsafe "hs_bindgen_c4c1a08ddf9cd5bc" hs_bindgen_c4c1a08ddf9cd5bc_base ::
+     BG.CInt
+  -> BG.CULong
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long3@
+hs_bindgen_c4c1a08ddf9cd5bc ::
+     A
+  -> BG.CULong
+  -> IO ()
+hs_bindgen_c4c1a08ddf9cd5bc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c4c1a08ddf9cd5bc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CULong
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_long3 = hs_bindgen_c4c1a08ddf9cd5bc
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_float@
+foreign import ccall unsafe "hs_bindgen_58a6b5f118525c6c" hs_bindgen_58a6b5f118525c6c_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_float@
+hs_bindgen_58a6b5f118525c6c ::
+     A
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_58a6b5f118525c6c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_58a6b5f118525c6c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_float = hs_bindgen_58a6b5f118525c6c
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_double@
+foreign import ccall unsafe "hs_bindgen_ffc58625c3a51d8f" hs_bindgen_ffc58625c3a51d8f_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_double@
+hs_bindgen_ffc58625c3a51d8f ::
+     A
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_ffc58625c3a51d8f =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ffc58625c3a51d8f_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_double = hs_bindgen_ffc58625c3a51d8f
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_bool1@
+foreign import ccall unsafe "hs_bindgen_51fb2da1d100c9a7" hs_bindgen_51fb2da1d100c9a7_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_bool1@
+hs_bindgen_51fb2da1d100c9a7 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_51fb2da1d100c9a7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_51fb2da1d100c9a7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_bool1 = hs_bindgen_51fb2da1d100c9a7
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_struct@
+foreign import ccall unsafe "hs_bindgen_b2d19f91a7b9f7d3" hs_bindgen_b2d19f91a7b9f7d3_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_struct@
+hs_bindgen_b2d19f91a7b9f7d3 ::
+     A
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_b2d19f91a7b9f7d3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b2d19f91a7b9f7d3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_struct =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_b2d19f91a7b9f7d3 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_union@
+foreign import ccall unsafe "hs_bindgen_bc74164a05d282c7" hs_bindgen_bc74164a05d282c7_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_union@
+hs_bindgen_bc74164a05d282c7 ::
+     A
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_bc74164a05d282c7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_bc74164a05d282c7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_union =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_bc74164a05d282c7 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_enum@
+foreign import ccall unsafe "hs_bindgen_69f08c1d9f5e590e" hs_bindgen_69f08c1d9f5e590e_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_enum@
+hs_bindgen_69f08c1d9f5e590e ::
+     A
+  -> Some_enum
+  -> IO ()
+hs_bindgen_69f08c1d9f5e590e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_69f08c1d9f5e590e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_enum = hs_bindgen_69f08c1d9f5e590e
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_785b005f35d4d7ec" hs_bindgen_785b005f35d4d7ec_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer1@
+hs_bindgen_785b005f35d4d7ec ::
+     A
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_785b005f35d4d7ec =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_785b005f35d4d7ec_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer1 = hs_bindgen_785b005f35d4d7ec
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_edc45a1b9750dcd3" hs_bindgen_edc45a1b9750dcd3_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer2@
+hs_bindgen_edc45a1b9750dcd3 ::
+     A
+  -> BG.Ptr (BG.Ptr BG.CInt)
+  -> IO ()
+hs_bindgen_edc45a1b9750dcd3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_edc45a1b9750dcd3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr (BG.Ptr BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_pointer2 = hs_bindgen_edc45a1b9750dcd3
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_102895862f35ca35" hs_bindgen_102895862f35ca35_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer3@
+hs_bindgen_102895862f35ca35 ::
+     A
+  -> BG.Ptr BG.Void
+  -> IO ()
+hs_bindgen_102895862f35ca35 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_102895862f35ca35_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @arg3@
+  -> IO ()
+args_pointer3 = hs_bindgen_102895862f35ca35
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_A@
+foreign import ccall unsafe "hs_bindgen_78f9ea765accb501" hs_bindgen_78f9ea765accb501_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_A@
+hs_bindgen_78f9ea765accb501 :: IO A
+hs_bindgen_78f9ea765accb501 =
+  fmap BG.fromFFIType hs_bindgen_78f9ea765accb501_base
+
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A :: IO A
+ret_A = hs_bindgen_78f9ea765accb501
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char1@
+foreign import ccall unsafe "hs_bindgen_e1e99ef9fc54a288" hs_bindgen_e1e99ef9fc54a288_base ::
+     BG.CInt
+  -> IO BG.CChar
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char1@
+hs_bindgen_e1e99ef9fc54a288 ::
+     A
+  -> IO BG.CChar
+hs_bindgen_e1e99ef9fc54a288 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e1e99ef9fc54a288_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CChar
+ret_char1 = hs_bindgen_e1e99ef9fc54a288
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char2@
+foreign import ccall unsafe "hs_bindgen_f6217639a7e142d3" hs_bindgen_f6217639a7e142d3_base ::
+     BG.CInt
+  -> IO BG.CSChar
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char2@
+hs_bindgen_f6217639a7e142d3 ::
+     A
+  -> IO BG.CSChar
+hs_bindgen_f6217639a7e142d3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f6217639a7e142d3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CSChar
+ret_char2 = hs_bindgen_f6217639a7e142d3
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char3@
+foreign import ccall unsafe "hs_bindgen_759b6cec946323f4" hs_bindgen_759b6cec946323f4_base ::
+     BG.CInt
+  -> IO BG.CUChar
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char3@
+hs_bindgen_759b6cec946323f4 ::
+     A
+  -> IO BG.CUChar
+hs_bindgen_759b6cec946323f4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_759b6cec946323f4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUChar
+ret_char3 = hs_bindgen_759b6cec946323f4
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short1@
+foreign import ccall unsafe "hs_bindgen_bf062c8332405f82" hs_bindgen_bf062c8332405f82_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short1@
+hs_bindgen_bf062c8332405f82 ::
+     A
+  -> IO BG.CShort
+hs_bindgen_bf062c8332405f82 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bf062c8332405f82_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short1 = hs_bindgen_bf062c8332405f82
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short2@
+foreign import ccall unsafe "hs_bindgen_3d9d5e4b8135169a" hs_bindgen_3d9d5e4b8135169a_base ::
+     BG.CInt
+  -> IO BG.CShort
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short2@
+hs_bindgen_3d9d5e4b8135169a ::
+     A
+  -> IO BG.CShort
+hs_bindgen_3d9d5e4b8135169a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3d9d5e4b8135169a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CShort
+ret_short2 = hs_bindgen_3d9d5e4b8135169a
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short3@
+foreign import ccall unsafe "hs_bindgen_63b44610868e424f" hs_bindgen_63b44610868e424f_base ::
+     BG.CInt
+  -> IO BG.CUShort
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short3@
+hs_bindgen_63b44610868e424f ::
+     A
+  -> IO BG.CUShort
+hs_bindgen_63b44610868e424f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_63b44610868e424f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUShort
+ret_short3 = hs_bindgen_63b44610868e424f
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int1@
+foreign import ccall unsafe "hs_bindgen_1a8d68c887085fbf" hs_bindgen_1a8d68c887085fbf_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int1@
+hs_bindgen_1a8d68c887085fbf ::
+     A
+  -> IO BG.CInt
+hs_bindgen_1a8d68c887085fbf =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_1a8d68c887085fbf_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int1 = hs_bindgen_1a8d68c887085fbf
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int2@
+foreign import ccall unsafe "hs_bindgen_f64653c7b4576075" hs_bindgen_f64653c7b4576075_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int2@
+hs_bindgen_f64653c7b4576075 ::
+     A
+  -> IO BG.CInt
+hs_bindgen_f64653c7b4576075 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f64653c7b4576075_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+ret_int2 = hs_bindgen_f64653c7b4576075
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int3@
+foreign import ccall unsafe "hs_bindgen_d2030910b711f1d8" hs_bindgen_d2030910b711f1d8_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int3@
+hs_bindgen_d2030910b711f1d8 ::
+     A
+  -> IO BG.CUInt
+hs_bindgen_d2030910b711f1d8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d2030910b711f1d8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CUInt
+ret_int3 = hs_bindgen_d2030910b711f1d8
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long1@
+foreign import ccall unsafe "hs_bindgen_2d6a30810e6b27e3" hs_bindgen_2d6a30810e6b27e3_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long1@
+hs_bindgen_2d6a30810e6b27e3 ::
+     A
+  -> IO BG.CLong
+hs_bindgen_2d6a30810e6b27e3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2d6a30810e6b27e3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long1 = hs_bindgen_2d6a30810e6b27e3
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long2@
+foreign import ccall unsafe "hs_bindgen_02885fe1cf2771da" hs_bindgen_02885fe1cf2771da_base ::
+     BG.CInt
+  -> IO BG.CLong
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long2@
+hs_bindgen_02885fe1cf2771da ::
+     A
+  -> IO BG.CLong
+hs_bindgen_02885fe1cf2771da =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_02885fe1cf2771da_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CLong
+ret_long2 = hs_bindgen_02885fe1cf2771da
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long3@
+foreign import ccall unsafe "hs_bindgen_888c9704132541d5" hs_bindgen_888c9704132541d5_base ::
+     BG.CInt
+  -> IO BG.CULong
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long3@
+hs_bindgen_888c9704132541d5 ::
+     A
+  -> IO BG.CULong
+hs_bindgen_888c9704132541d5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_888c9704132541d5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CULong
+ret_long3 = hs_bindgen_888c9704132541d5
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_float@
+foreign import ccall unsafe "hs_bindgen_2d2ce0d386f26293" hs_bindgen_2d2ce0d386f26293_base ::
+     BG.CInt
+  -> IO BG.CFloat
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_float@
+hs_bindgen_2d2ce0d386f26293 ::
+     A
+  -> IO BG.CFloat
+hs_bindgen_2d2ce0d386f26293 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2d2ce0d386f26293_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CFloat
+ret_float = hs_bindgen_2d2ce0d386f26293
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_double@
+foreign import ccall unsafe "hs_bindgen_de353a737de53428" hs_bindgen_de353a737de53428_base ::
+     BG.CInt
+  -> IO BG.CDouble
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_double@
+hs_bindgen_de353a737de53428 ::
+     A
+  -> IO BG.CDouble
+hs_bindgen_de353a737de53428 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_de353a737de53428_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CDouble
+ret_double = hs_bindgen_de353a737de53428
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_91e2ab77e68f0288" hs_bindgen_91e2ab77e68f0288_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_bool1@
+hs_bindgen_91e2ab77e68f0288 ::
+     A
+  -> IO BG.CBool
+hs_bindgen_91e2ab77e68f0288 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_91e2ab77e68f0288_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+ret_bool1 = hs_bindgen_91e2ab77e68f0288
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_struct@
+foreign import ccall unsafe "hs_bindgen_9f29c7eee02f6d53" hs_bindgen_9f29c7eee02f6d53_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_struct@
+hs_bindgen_9f29c7eee02f6d53 ::
+     A
+  -> BG.Ptr Some_struct
+  -> IO ()
+hs_bindgen_9f29c7eee02f6d53 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9f29c7eee02f6d53_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_struct
+ret_struct =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_9f29c7eee02f6d53 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_union@
+foreign import ccall unsafe "hs_bindgen_6844bf5f5a5f6681" hs_bindgen_6844bf5f5a5f6681_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_union@
+hs_bindgen_6844bf5f5a5f6681 ::
+     A
+  -> BG.Ptr Some_union
+  -> IO ()
+hs_bindgen_6844bf5f5a5f6681 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6844bf5f5a5f6681_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_union
+ret_union =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_6844bf5f5a5f6681 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_enum@
+foreign import ccall unsafe "hs_bindgen_f96c4bc30b6b17e8" hs_bindgen_f96c4bc30b6b17e8_base ::
+     BG.CInt
+  -> IO BG.CUInt
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_enum@
+hs_bindgen_f96c4bc30b6b17e8 ::
+     A
+  -> IO Some_enum
+hs_bindgen_f96c4bc30b6b17e8 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f96c4bc30b6b17e8_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO Some_enum
+ret_enum = hs_bindgen_f96c4bc30b6b17e8
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_bfb6069e1423e7a5" hs_bindgen_bfb6069e1423e7a5_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer1@
+hs_bindgen_bfb6069e1423e7a5 ::
+     A
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_bfb6069e1423e7a5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bfb6069e1423e7a5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+ret_pointer1 = hs_bindgen_bfb6069e1423e7a5
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_ffae633548386d89" hs_bindgen_ffae633548386d89_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer2@
+hs_bindgen_ffae633548386d89 ::
+     A
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+hs_bindgen_ffae633548386d89 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ffae633548386d89_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr (BG.Ptr BG.CInt))
+ret_pointer2 = hs_bindgen_ffae633548386d89
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_550cb4a23c6ab2ff" hs_bindgen_550cb4a23c6ab2ff_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer3@
+hs_bindgen_550cb4a23c6ab2ff ::
+     A
+  -> IO (BG.Ptr BG.Void)
+hs_bindgen_550cb4a23c6ab2ff =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_550cb4a23c6ab2ff_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.Void)
+ret_pointer3 = hs_bindgen_550cb4a23c6ab2ff
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body1@
+foreign import ccall unsafe "hs_bindgen_f7a7a45a80ae39f7" hs_bindgen_f7a7a45a80ae39f7_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body1@
+hs_bindgen_f7a7a45a80ae39f7 ::
+     A
+  -> IO BG.CInt
+hs_bindgen_f7a7a45a80ae39f7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f7a7a45a80ae39f7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CInt
+body1 = hs_bindgen_f7a7a45a80ae39f7
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body2@
+foreign import ccall unsafe "hs_bindgen_364e73b014d7d4df" hs_bindgen_364e73b014d7d4df_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body2@
+hs_bindgen_364e73b014d7d4df :: IO A
+hs_bindgen_364e73b014d7d4df =
+  fmap BG.fromFFIType hs_bindgen_364e73b014d7d4df_base
+
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2 :: IO A
+body2 = hs_bindgen_364e73b014d7d4df
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_88b4cd11afc4f6c1" hs_bindgen_88b4cd11afc4f6c1_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_float@
+hs_bindgen_88b4cd11afc4f6c1 ::
+     A
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_88b4cd11afc4f6c1 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_88b4cd11afc4f6c1_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_float =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_88b4cd11afc4f6c1 arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_0ddc53d8e91cb32a" hs_bindgen_0ddc53d8e91cb32a_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_double@
+hs_bindgen_0ddc53d8e91cb32a ::
+     A
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_0ddc53d8e91cb32a =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_0ddc53d8e91cb32a_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+args_complex_double =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_0ddc53d8e91cb32a arg10 arg22)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_eb82eb840e288900" hs_bindgen_eb82eb840e288900_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_float@
+hs_bindgen_eb82eb840e288900 ::
+     A
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_eb82eb840e288900 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_eb82eb840e288900_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CFloat)
+ret_complex_float =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_eb82eb840e288900 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_cbc25ea9cbdd2365" hs_bindgen_cbc25ea9cbdd2365_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_double@
+hs_bindgen_cbc25ea9cbdd2365 ::
+     A
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_cbc25ea9cbdd2365 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_cbc25ea9cbdd2365_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Complex BG.CDouble)
+ret_complex_double =
+  \arg10 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_cbc25ea9cbdd2365 arg10 res1)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_3258de4ffd2c08af" hs_bindgen_3258de4ffd2c08af_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args1@
+hs_bindgen_3258de4ffd2c08af ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_3258de4ffd2c08af =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3258de4ffd2c08af_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args1 = hs_bindgen_3258de4ffd2c08af
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_74b2cd1defdd5609" hs_bindgen_74b2cd1defdd5609_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args2@
+hs_bindgen_74b2cd1defdd5609 ::
+     A
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_74b2cd1defdd5609 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_74b2cd1defdd5609_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+bespoke_args2 = hs_bindgen_74b2cd1defdd5609
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_5405c1e037d1e115" hs_bindgen_5405c1e037d1e115_base ::
+     BG.CInt
+  -> IO BG.CBool
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret1@
+hs_bindgen_5405c1e037d1e115 ::
+     A
+  -> IO BG.CBool
+hs_bindgen_5405c1e037d1e115 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5405c1e037d1e115_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO BG.CBool
+bespoke_ret1 = hs_bindgen_5405c1e037d1e115
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_a6a3e5a828532360" hs_bindgen_a6a3e5a828532360_base ::
+     BG.CInt
+  -> IO HsBindgen.Runtime.LibC.CSize
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret2@
+hs_bindgen_a6a3e5a828532360 ::
+     A
+  -> IO HsBindgen.Runtime.LibC.CSize
+hs_bindgen_a6a3e5a828532360 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a6a3e5a828532360_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO HsBindgen.Runtime.LibC.CSize
+bespoke_ret2 = hs_bindgen_a6a3e5a828532360
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args1@
+foreign import ccall unsafe "hs_bindgen_4956a52bf5073b9f" hs_bindgen_4956a52bf5073b9f_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args1@
+hs_bindgen_4956a52bf5073b9f ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray A))
+  -> IO ()
+hs_bindgen_4956a52bf5073b9f =
+  \x0 ->
+    hs_bindgen_4956a52bf5073b9f_base (BG.toFFIType x0)
+
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray A))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args1 = hs_bindgen_4956a52bf5073b9f
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args2@
+foreign import ccall unsafe "hs_bindgen_0fc8b091085a88e9" hs_bindgen_0fc8b091085a88e9_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args2@
+hs_bindgen_0fc8b091085a88e9 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr A)))
+  -> IO ()
+hs_bindgen_0fc8b091085a88e9 =
+  \x0 ->
+    hs_bindgen_0fc8b091085a88e9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (BG.Ptr A)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args2 = hs_bindgen_0fc8b091085a88e9
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args3@
+foreign import ccall unsafe "hs_bindgen_ca6f1bc1a29b85f8" hs_bindgen_ca6f1bc1a29b85f8_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args3@
+hs_bindgen_ca6f1bc1a29b85f8 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 A))
+  -> IO ()
+hs_bindgen_ca6f1bc1a29b85f8 =
+  \x0 ->
+    hs_bindgen_ca6f1bc1a29b85f8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 A))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args3 = hs_bindgen_ca6f1bc1a29b85f8
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args4@
+foreign import ccall unsafe "hs_bindgen_a168ae0de206febe" hs_bindgen_a168ae0de206febe_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args4@
+hs_bindgen_a168ae0de206febe ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr A)))
+  -> IO ()
+hs_bindgen_a168ae0de206febe =
+  \x0 ->
+    hs_bindgen_a168ae0de206febe_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4 ::
+     BG.Ptr (IsA.Elem (CA.ConstantArray 5 (BG.Ptr A)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+arr_args4 = hs_bindgen_a168ae0de206febe
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_8e63f57f1f5d662e" hs_bindgen_8e63f57f1f5d662e_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args1@
+hs_bindgen_8e63f57f1f5d662e ::
+     A
+  -> BG.FunPtr (IO ())
+  -> IO ()
+hs_bindgen_8e63f57f1f5d662e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8e63f57f1f5d662e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args1 = hs_bindgen_8e63f57f1f5d662e
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_927bd07f48d05d21" hs_bindgen_927bd07f48d05d21_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args2@
+hs_bindgen_927bd07f48d05d21 ::
+     A
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_927bd07f48d05d21 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_927bd07f48d05d21_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args2 = hs_bindgen_927bd07f48d05d21
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_c82e078d3c54a6bc" hs_bindgen_c82e078d3c54a6bc_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args3@
+hs_bindgen_c82e078d3c54a6bc ::
+     A
+  -> BG.FunPtr (BG.CInt -> IO ())
+  -> IO ()
+hs_bindgen_c82e078d3c54a6bc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c82e078d3c54a6bc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> IO ())
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args3 = hs_bindgen_c82e078d3c54a6bc
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_211ad1ac5399caec" hs_bindgen_211ad1ac5399caec_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args4@
+hs_bindgen_211ad1ac5399caec ::
+     A
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+  -> IO ()
+hs_bindgen_211ad1ac5399caec =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_211ad1ac5399caec_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args4 = hs_bindgen_211ad1ac5399caec
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_9057c59d70e815d7" hs_bindgen_9057c59d70e815d7_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args5@
+hs_bindgen_9057c59d70e815d7 ::
+     A
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+  -> IO ()
+hs_bindgen_9057c59d70e815d7 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_9057c59d70e815d7_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt))
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+funptr_args5 = hs_bindgen_9057c59d70e815d7
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_comments1@
+foreign import ccall unsafe "hs_bindgen_153515e0ff74574f" hs_bindgen_153515e0ff74574f_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_comments1@
+hs_bindgen_153515e0ff74574f ::
+     A
+  -> IO ()
+hs_bindgen_153515e0ff74574f =
+  \x0 ->
+    hs_bindgen_153515e0ff74574f_base (BG.toFFIType x0)
+
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+comments1 = hs_bindgen_153515e0ff74574f
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_8cc833db463cc95c" hs_bindgen_8cc833db463cc95c_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before1@
+hs_bindgen_8cc833db463cc95c ::
+     A
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_8cc833db463cc95c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_8cc833db463cc95c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before1 = hs_bindgen_8cc833db463cc95c
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_d767bbef00031d57" hs_bindgen_d767bbef00031d57_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before2@
+hs_bindgen_d767bbef00031d57 ::
+     A
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_d767bbef00031d57 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d767bbef00031d57_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before2 = hs_bindgen_d767bbef00031d57
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_a36dfeb811993297" hs_bindgen_a36dfeb811993297_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before3@
+hs_bindgen_a36dfeb811993297 ::
+     A
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_a36dfeb811993297 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a36dfeb811993297_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_before3 = hs_bindgen_a36dfeb811993297
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_d7fa2440be24e954" hs_bindgen_d7fa2440be24e954_base ::
+     BG.CInt
+  -> BG.CChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after1@
+hs_bindgen_d7fa2440be24e954 ::
+     A
+  -> BG.CChar
+  -> IO ()
+hs_bindgen_d7fa2440be24e954 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d7fa2440be24e954_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after1 = hs_bindgen_d7fa2440be24e954
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_c169229f24baf752" hs_bindgen_c169229f24baf752_base ::
+     BG.CInt
+  -> BG.CSChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after2@
+hs_bindgen_c169229f24baf752 ::
+     A
+  -> BG.CSChar
+  -> IO ()
+hs_bindgen_c169229f24baf752 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c169229f24baf752_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CSChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after2 = hs_bindgen_c169229f24baf752
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_c0780f7624ed1d3e" hs_bindgen_c0780f7624ed1d3e_base ::
+     BG.CInt
+  -> BG.CUChar
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after3@
+hs_bindgen_c0780f7624ed1d3e ::
+     A
+  -> BG.CUChar
+  -> IO ()
+hs_bindgen_c0780f7624ed1d3e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c0780f7624ed1d3e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CUChar
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_prim_after3 = hs_bindgen_c0780f7624ed1d3e
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_fda903bc1139b1d6" hs_bindgen_fda903bc1139b1d6_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before1@
+hs_bindgen_fda903bc1139b1d6 ::
+     A
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_fda903bc1139b1d6 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_fda903bc1139b1d6_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before1 =
+  hs_bindgen_fda903bc1139b1d6
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_a5a70f3be654ea00" hs_bindgen_a5a70f3be654ea00_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before2@
+hs_bindgen_a5a70f3be654ea00 ::
+     A
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_a5a70f3be654ea00 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a5a70f3be654ea00_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before2 =
+  hs_bindgen_a5a70f3be654ea00
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_b813910f6a632ce2" hs_bindgen_b813910f6a632ce2_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before3@
+hs_bindgen_b813910f6a632ce2 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_b813910f6a632ce2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_b813910f6a632ce2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before3 =
+  hs_bindgen_b813910f6a632ce2
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_dc22b02b2f53aa5b" hs_bindgen_dc22b02b2f53aa5b_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before4@
+hs_bindgen_dc22b02b2f53aa5b ::
+     A
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_dc22b02b2f53aa5b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_dc22b02b2f53aa5b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_dc22b02b2f53aa5b arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_503736261279760d" hs_bindgen_503736261279760d_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before5@
+hs_bindgen_503736261279760d ::
+     A
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_503736261279760d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_503736261279760d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_503736261279760d arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_ed0a8c0e15f5d2ce" hs_bindgen_ed0a8c0e15f5d2ce_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before6@
+hs_bindgen_ed0a8c0e15f5d2ce ::
+     A
+  -> Some_enum
+  -> IO ()
+hs_bindgen_ed0a8c0e15f5d2ce =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ed0a8c0e15f5d2ce_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before6 =
+  hs_bindgen_ed0a8c0e15f5d2ce
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_4659c22d39cc1bb3" hs_bindgen_4659c22d39cc1bb3_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before7@
+hs_bindgen_4659c22d39cc1bb3 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_4659c22d39cc1bb3 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4659c22d39cc1bb3_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before7 =
+  hs_bindgen_4659c22d39cc1bb3
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_530245b77093b08c" hs_bindgen_530245b77093b08c_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before8@
+hs_bindgen_530245b77093b08c ::
+     A
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_530245b77093b08c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_530245b77093b08c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_before8 =
+  hs_bindgen_530245b77093b08c
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_c31a804bd742193e" hs_bindgen_c31a804bd742193e_base ::
+     BG.CInt
+  -> BG.CFloat
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after1@
+hs_bindgen_c31a804bd742193e ::
+     A
+  -> BG.CFloat
+  -> IO ()
+hs_bindgen_c31a804bd742193e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c31a804bd742193e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CFloat
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after1 =
+  hs_bindgen_c31a804bd742193e
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_53756fa3a68ab067" hs_bindgen_53756fa3a68ab067_base ::
+     BG.CInt
+  -> BG.CDouble
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after2@
+hs_bindgen_53756fa3a68ab067 ::
+     A
+  -> BG.CDouble
+  -> IO ()
+hs_bindgen_53756fa3a68ab067 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_53756fa3a68ab067_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after2 =
+  hs_bindgen_53756fa3a68ab067
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_4134ad71149d6139" hs_bindgen_4134ad71149d6139_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after3@
+hs_bindgen_4134ad71149d6139 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_4134ad71149d6139 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_4134ad71149d6139_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after3 =
+  hs_bindgen_4134ad71149d6139
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_3de6157427334101" hs_bindgen_3de6157427334101_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after4@
+hs_bindgen_3de6157427334101 ::
+     A
+  -> PtrConst.PtrConst Some_struct
+  -> IO ()
+hs_bindgen_3de6157427334101 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3de6157427334101_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_struct
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after4 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_3de6157427334101 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_fc4ef8c9107c1ae6" hs_bindgen_fc4ef8c9107c1ae6_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after5@
+hs_bindgen_fc4ef8c9107c1ae6 ::
+     A
+  -> PtrConst.PtrConst Some_union
+  -> IO ()
+hs_bindgen_fc4ef8c9107c1ae6 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_fc4ef8c9107c1ae6_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_union
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after5 =
+  \arg10 ->
+    \arg21 ->
+      BG.with arg21 (\arg22 ->
+                       hs_bindgen_fc4ef8c9107c1ae6 arg10 (PtrConst.unsafeFromPtr arg22))
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_5e20c60b725ae606" hs_bindgen_5e20c60b725ae606_base ::
+     BG.CInt
+  -> BG.CUInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after6@
+hs_bindgen_5e20c60b725ae606 ::
+     A
+  -> Some_enum
+  -> IO ()
+hs_bindgen_5e20c60b725ae606 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_5e20c60b725ae606_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> Some_enum
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after6 =
+  hs_bindgen_5e20c60b725ae606
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_a0f20d4b9a07ff5b" hs_bindgen_a0f20d4b9a07ff5b_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after7@
+hs_bindgen_a0f20d4b9a07ff5b ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_a0f20d4b9a07ff5b =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_a0f20d4b9a07ff5b_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.CBool
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after7 =
+  hs_bindgen_a0f20d4b9a07ff5b
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_3a020035eb2fe7f8" hs_bindgen_3a020035eb2fe7f8_base ::
+     BG.CInt
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after8@
+hs_bindgen_3a020035eb2fe7f8 ::
+     A
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO ()
+hs_bindgen_3a020035eb2fe7f8 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_3a020035eb2fe7f8_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_withoutSign_after8 =
+  hs_bindgen_3a020035eb2fe7f8
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_17623ba5065bf95d" hs_bindgen_17623ba5065bf95d_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args1@
+hs_bindgen_17623ba5065bf95d ::
+     A
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_17623ba5065bf95d =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_17623ba5065bf95d_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args1 = hs_bindgen_17623ba5065bf95d
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_02d08ccd5df88a98" hs_bindgen_02d08ccd5df88a98_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args2@
+hs_bindgen_02d08ccd5df88a98 ::
+     A
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_02d08ccd5df88a98 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_02d08ccd5df88a98_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args2 = hs_bindgen_02d08ccd5df88a98
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_50c423f2237cb6b5" hs_bindgen_50c423f2237cb6b5_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args3@
+hs_bindgen_50c423f2237cb6b5 ::
+     A
+  -> BG.Ptr BG.CInt
+  -> IO ()
+hs_bindgen_50c423f2237cb6b5 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_50c423f2237cb6b5_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.Ptr BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args3 = hs_bindgen_50c423f2237cb6b5
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_99c29c45d78348e9" hs_bindgen_99c29c45d78348e9_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args4@
+hs_bindgen_99c29c45d78348e9 ::
+     A
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_99c29c45d78348e9 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_99c29c45d78348e9_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args4 = hs_bindgen_99c29c45d78348e9
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_6a92dbfae24b1bcd" hs_bindgen_6a92dbfae24b1bcd_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args5@
+hs_bindgen_6a92dbfae24b1bcd ::
+     A
+  -> PtrConst.PtrConst BG.CInt
+  -> IO ()
+hs_bindgen_6a92dbfae24b1bcd =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_6a92dbfae24b1bcd_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> PtrConst.PtrConst BG.CInt
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+const_pointers_args5 = hs_bindgen_6a92dbfae24b1bcd
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_0c07f1e0256fd705" hs_bindgen_0c07f1e0256fd705_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret1@
+hs_bindgen_0c07f1e0256fd705 ::
+     A
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_0c07f1e0256fd705 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0c07f1e0256fd705_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret1 = hs_bindgen_0c07f1e0256fd705
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_d12c8210ff3c3711" hs_bindgen_d12c8210ff3c3711_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret2@
+hs_bindgen_d12c8210ff3c3711 ::
+     A
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_d12c8210ff3c3711 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d12c8210ff3c3711_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret2 = hs_bindgen_d12c8210ff3c3711
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_a58bc0be6f564801" hs_bindgen_a58bc0be6f564801_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret3@
+hs_bindgen_a58bc0be6f564801 ::
+     A
+  -> IO (BG.Ptr BG.CInt)
+hs_bindgen_a58bc0be6f564801 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a58bc0be6f564801_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.Ptr BG.CInt)
+const_pointers_ret3 = hs_bindgen_a58bc0be6f564801
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_622bb8150470138b" hs_bindgen_622bb8150470138b_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret4@
+hs_bindgen_622bb8150470138b ::
+     A
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_622bb8150470138b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_622bb8150470138b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret4 = hs_bindgen_622bb8150470138b
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_d49bd331ad2077e5" hs_bindgen_d49bd331ad2077e5_base ::
+     BG.CInt
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret5@
+hs_bindgen_d49bd331ad2077e5 ::
+     A
+  -> IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_d49bd331ad2077e5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d49bd331ad2077e5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (PtrConst.PtrConst BG.CInt)
+const_pointers_ret5 = hs_bindgen_d49bd331ad2077e5
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_224608f780bff5bd" hs_bindgen_224608f780bff5bd_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem1@
+hs_bindgen_224608f780bff5bd ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray A))
+  -> IO ()
+hs_bindgen_224608f780bff5bd =
+  \x0 ->
+    hs_bindgen_224608f780bff5bd_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray A))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem1 = hs_bindgen_224608f780bff5bd
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_9aa74ad89f2c1fba" hs_bindgen_9aa74ad89f2c1fba_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem2@
+hs_bindgen_9aa74ad89f2c1fba ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst A)))
+  -> IO ()
+hs_bindgen_9aa74ad89f2c1fba =
+  \x0 ->
+    hs_bindgen_9aa74ad89f2c1fba_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2 ::
+     BG.Ptr (IsA.Elem (IA.IncompleteArray (PtrConst.PtrConst A)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem2 = hs_bindgen_9aa74ad89f2c1fba
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_6a328300c5ef0c9e" hs_bindgen_6a328300c5ef0c9e_base ::
+     BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem3@
+hs_bindgen_6a328300c5ef0c9e ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr A)))
+  -> IO ()
+hs_bindgen_6a328300c5ef0c9e =
+  \x0 ->
+    hs_bindgen_6a328300c5ef0c9e_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3 ::
+     PtrConst.PtrConst (IsA.Elem (IA.IncompleteArray (BG.Ptr A)))
+     -- ^ __C declaration:__ @arg1@
+  -> IO ()
+const_array_elem3 = hs_bindgen_6a328300c5ef0c9e
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams1@
+foreign import ccall unsafe "hs_bindgen_13a7d78e11555d58" hs_bindgen_13a7d78e11555d58_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams1@
+hs_bindgen_13a7d78e11555d58 :: IO A
+hs_bindgen_13a7d78e11555d58 =
+  fmap BG.fromFFIType hs_bindgen_13a7d78e11555d58_base
+
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1 :: IO A
+noParams1 = hs_bindgen_13a7d78e11555d58
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams2@
+foreign import ccall unsafe "hs_bindgen_672f4691ee7a367c" hs_bindgen_672f4691ee7a367c_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams2@
+hs_bindgen_672f4691ee7a367c :: IO A
+hs_bindgen_672f4691ee7a367c =
+  fmap BG.fromFFIType hs_bindgen_672f4691ee7a367c_base
+
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2 :: IO A
+noParams2 = hs_bindgen_672f4691ee7a367c
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams3@
+foreign import ccall unsafe "hs_bindgen_591f84e2163a5d18" hs_bindgen_591f84e2163a5d18_base ::
+     BG.CInt
+  -> BG.FunPtr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams3@
+hs_bindgen_591f84e2163a5d18 ::
+     A
+  -> BG.FunPtr (IO BG.CInt)
+  -> IO ()
+hs_bindgen_591f84e2163a5d18 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_591f84e2163a5d18_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> BG.FunPtr (IO BG.CInt)
+     -- ^ __C declaration:__ @arg2@
+  -> IO ()
+noParams3 = hs_bindgen_591f84e2163a5d18
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_8cdf7774adb0f0b4" hs_bindgen_8cdf7774adb0f0b4_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret1@
+hs_bindgen_8cdf7774adb0f0b4 ::
+     A
+  -> IO (BG.FunPtr (IO ()))
+hs_bindgen_8cdf7774adb0f0b4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8cdf7774adb0f0b4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO ()))
+funptr_ret1 = hs_bindgen_8cdf7774adb0f0b4
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_a4e08267a9070ede" hs_bindgen_a4e08267a9070ede_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret2@
+hs_bindgen_a4e08267a9070ede ::
+     A
+  -> IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_a4e08267a9070ede =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_a4e08267a9070ede_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (IO BG.CInt))
+funptr_ret2 = hs_bindgen_a4e08267a9070ede
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_65fa30510d244cbf" hs_bindgen_65fa30510d244cbf_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret3@
+hs_bindgen_65fa30510d244cbf ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_65fa30510d244cbf =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_65fa30510d244cbf_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+funptr_ret3 = hs_bindgen_65fa30510d244cbf
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_da12eaec295883aa" hs_bindgen_da12eaec295883aa_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret4@
+hs_bindgen_da12eaec295883aa ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+hs_bindgen_da12eaec295883aa =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_da12eaec295883aa_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO BG.CChar))
+funptr_ret4 = hs_bindgen_da12eaec295883aa
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_281c53214b1cdcb4" hs_bindgen_281c53214b1cdcb4_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret5@
+hs_bindgen_281c53214b1cdcb4 ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_281c53214b1cdcb4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_281c53214b1cdcb4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret5 = hs_bindgen_281c53214b1cdcb4
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_16628c257aa64a76" hs_bindgen_16628c257aa64a76_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret6@
+hs_bindgen_16628c257aa64a76 ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_16628c257aa64a76 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_16628c257aa64a76_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret6 = hs_bindgen_16628c257aa64a76
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_79fb0c30f546a547" hs_bindgen_79fb0c30f546a547_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret7@
+hs_bindgen_79fb0c30f546a547 ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_79fb0c30f546a547 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_79fb0c30f546a547_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret7 = hs_bindgen_79fb0c30f546a547
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_4668d2ff9d5bfc40" hs_bindgen_4668d2ff9d5bfc40_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret8@
+hs_bindgen_4668d2ff9d5bfc40 ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+hs_bindgen_4668d2ff9d5bfc40 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4668d2ff9d5bfc40_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (BG.Ptr BG.CInt)))
+funptr_ret8 = hs_bindgen_4668d2ff9d5bfc40
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_c044d7074789febc" hs_bindgen_c044d7074789febc_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret9@
+hs_bindgen_c044d7074789febc ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_c044d7074789febc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c044d7074789febc_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret9 = hs_bindgen_c044d7074789febc
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_628ced6eccc7783a" hs_bindgen_628ced6eccc7783a_base ::
+     BG.CInt
+  -> IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret10@
+hs_bindgen_628ced6eccc7783a ::
+     A
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_628ced6eccc7783a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_628ced6eccc7783a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10 ::
+     A
+     -- ^ __C declaration:__ @arg1@
+  -> IO (BG.FunPtr (BG.CInt -> BG.CDouble -> IO (PtrConst.PtrConst BG.CInt)))
+funptr_ret10 = hs_bindgen_628ced6eccc7783a
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/Example/FunPtr.hs
@@ -0,0 +1,800 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f1
+    , Example.FunPtr.f2
+    , Example.FunPtr.f3
+    , Example.FunPtr.f4
+    , Example.FunPtr.f5
+    , Example.FunPtr.f6
+    , Example.FunPtr.f7
+    , Example.FunPtr.f8
+    , Example.FunPtr.f9
+    , Example.FunPtr.f10
+    , Example.FunPtr.f11
+    , Example.FunPtr.f12
+    , Example.FunPtr.f13
+    , Example.FunPtr.f14
+    , Example.FunPtr.f15
+    , Example.FunPtr.f16
+    , Example.FunPtr.f17
+    , Example.FunPtr.f18
+    , Example.FunPtr.f19
+    , Example.FunPtr.f20
+    , Example.FunPtr.f21
+    , Example.FunPtr.f22
+    , Example.FunPtr.f23
+    , Example.FunPtr.f24
+    , Example.FunPtr.f25
+    , Example.FunPtr.f26
+    , Example.FunPtr.f27
+    , Example.FunPtr.f28
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/arithmetic_types.h>"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_1208d85624465c51 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &f1;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_90bf738ed6e126cf (void)) ("
+  , "  signed char arg1"
+  , ")"
+  , "{"
+  , "  return &f2;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_541fb107a8c068d0 (void)) ("
+  , "  unsigned char arg1"
+  , ")"
+  , "{"
+  , "  return &f3;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f4 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_695a21f5c624ca64 (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f4;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f5 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_43491bdffe43bbe1 (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f5;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f6 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ffafdd943146661a (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f6;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f7 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_7c6250122a3c59a3 (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f7;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f8 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_60cbc6e072d14643 (void)) ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return &f8;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f9 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_fa356fa03c563829 (void)) ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return &f9;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f10 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_6971f14ec2033453 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f10;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f11 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_18e46ae0dfd9dbe0 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f11;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f12 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_0c1c36784fe71810 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f12;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f13 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_8d9bec0d1944b558 (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &f13;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f14 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_796f92f5831916a6 (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &f14;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f15 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2cb6292b4cc8f420 (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f15;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f16 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_b7dd3e78d24cd30c (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f16;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f17 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_894ff9aa74f040d9 (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f17;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f18 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_57359ef6c14eb820 (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f18;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f19 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2173cee7470d34a4 (void)) ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return &f19;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f20 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_85dc99217461b608 (void)) ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return &f20;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f21 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_350486e538e7ca90 (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f21;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f22 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ad2c8dc646b29be0 (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f22;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f23 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_01837bab50ebbe4c (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f23;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f24 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_051d17dfd1125c86 (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f24;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f25 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ba5dd3a36d6f2756 (void)) ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return &f25;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f26 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_22f3b97563fd757f (void)) ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return &f26;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f27 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_fc81895dfae9b1e5 (void)) ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return &f27;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f28 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_f95062f509265011 (void)) ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return &f28;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_1208d85624465c51" hs_bindgen_1208d85624465c51_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+hs_bindgen_1208d85624465c51 :: IO (BG.FunPtr (BG.CChar -> IO BG.CInt))
+hs_bindgen_1208d85624465c51 =
+  fmap BG.fromFFIType hs_bindgen_1208d85624465c51_base
+
+{-# NOINLINE f1 #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1 :: BG.FunPtr (BG.CChar -> IO BG.CInt)
+f1 = BG.unsafePerformIO hs_bindgen_1208d85624465c51
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_90bf738ed6e126cf" hs_bindgen_90bf738ed6e126cf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+hs_bindgen_90bf738ed6e126cf :: IO (BG.FunPtr (BG.CSChar -> IO BG.CInt))
+hs_bindgen_90bf738ed6e126cf =
+  fmap BG.fromFFIType hs_bindgen_90bf738ed6e126cf_base
+
+{-# NOINLINE f2 #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2 :: BG.FunPtr (BG.CSChar -> IO BG.CInt)
+f2 = BG.unsafePerformIO hs_bindgen_90bf738ed6e126cf
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_541fb107a8c068d0" hs_bindgen_541fb107a8c068d0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+hs_bindgen_541fb107a8c068d0 :: IO (BG.FunPtr (BG.CUChar -> IO BG.CInt))
+hs_bindgen_541fb107a8c068d0 =
+  fmap BG.fromFFIType hs_bindgen_541fb107a8c068d0_base
+
+{-# NOINLINE f3 #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3 :: BG.FunPtr (BG.CUChar -> IO BG.CInt)
+f3 = BG.unsafePerformIO hs_bindgen_541fb107a8c068d0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+foreign import ccall unsafe "hs_bindgen_695a21f5c624ca64" hs_bindgen_695a21f5c624ca64_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+hs_bindgen_695a21f5c624ca64 :: IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_695a21f5c624ca64 =
+  fmap BG.fromFFIType hs_bindgen_695a21f5c624ca64_base
+
+{-# NOINLINE f4 #-}
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4 :: BG.FunPtr (BG.CShort -> IO BG.CInt)
+f4 = BG.unsafePerformIO hs_bindgen_695a21f5c624ca64
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+foreign import ccall unsafe "hs_bindgen_43491bdffe43bbe1" hs_bindgen_43491bdffe43bbe1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+hs_bindgen_43491bdffe43bbe1 :: IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_43491bdffe43bbe1 =
+  fmap BG.fromFFIType hs_bindgen_43491bdffe43bbe1_base
+
+{-# NOINLINE f5 #-}
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5 :: BG.FunPtr (BG.CShort -> IO BG.CInt)
+f5 = BG.unsafePerformIO hs_bindgen_43491bdffe43bbe1
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+foreign import ccall unsafe "hs_bindgen_ffafdd943146661a" hs_bindgen_ffafdd943146661a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+hs_bindgen_ffafdd943146661a :: IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_ffafdd943146661a =
+  fmap BG.fromFFIType hs_bindgen_ffafdd943146661a_base
+
+{-# NOINLINE f6 #-}
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6 :: BG.FunPtr (BG.CShort -> IO BG.CInt)
+f6 = BG.unsafePerformIO hs_bindgen_ffafdd943146661a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+foreign import ccall unsafe "hs_bindgen_7c6250122a3c59a3" hs_bindgen_7c6250122a3c59a3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+hs_bindgen_7c6250122a3c59a3 :: IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_7c6250122a3c59a3 =
+  fmap BG.fromFFIType hs_bindgen_7c6250122a3c59a3_base
+
+{-# NOINLINE f7 #-}
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7 :: BG.FunPtr (BG.CShort -> IO BG.CInt)
+f7 = BG.unsafePerformIO hs_bindgen_7c6250122a3c59a3
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+foreign import ccall unsafe "hs_bindgen_60cbc6e072d14643" hs_bindgen_60cbc6e072d14643_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+hs_bindgen_60cbc6e072d14643 :: IO (BG.FunPtr (BG.CUShort -> IO BG.CInt))
+hs_bindgen_60cbc6e072d14643 =
+  fmap BG.fromFFIType hs_bindgen_60cbc6e072d14643_base
+
+{-# NOINLINE f8 #-}
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8 :: BG.FunPtr (BG.CUShort -> IO BG.CInt)
+f8 = BG.unsafePerformIO hs_bindgen_60cbc6e072d14643
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+foreign import ccall unsafe "hs_bindgen_fa356fa03c563829" hs_bindgen_fa356fa03c563829_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+hs_bindgen_fa356fa03c563829 :: IO (BG.FunPtr (BG.CUShort -> IO BG.CInt))
+hs_bindgen_fa356fa03c563829 =
+  fmap BG.fromFFIType hs_bindgen_fa356fa03c563829_base
+
+{-# NOINLINE f9 #-}
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9 :: BG.FunPtr (BG.CUShort -> IO BG.CInt)
+f9 = BG.unsafePerformIO hs_bindgen_fa356fa03c563829
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+foreign import ccall unsafe "hs_bindgen_6971f14ec2033453" hs_bindgen_6971f14ec2033453_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+hs_bindgen_6971f14ec2033453 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_6971f14ec2033453 =
+  fmap BG.fromFFIType hs_bindgen_6971f14ec2033453_base
+
+{-# NOINLINE f10 #-}
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+f10 = BG.unsafePerformIO hs_bindgen_6971f14ec2033453
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+foreign import ccall unsafe "hs_bindgen_18e46ae0dfd9dbe0" hs_bindgen_18e46ae0dfd9dbe0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+hs_bindgen_18e46ae0dfd9dbe0 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_18e46ae0dfd9dbe0 =
+  fmap BG.fromFFIType hs_bindgen_18e46ae0dfd9dbe0_base
+
+{-# NOINLINE f11 #-}
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+f11 = BG.unsafePerformIO hs_bindgen_18e46ae0dfd9dbe0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+foreign import ccall unsafe "hs_bindgen_0c1c36784fe71810" hs_bindgen_0c1c36784fe71810_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+hs_bindgen_0c1c36784fe71810 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_0c1c36784fe71810 =
+  fmap BG.fromFFIType hs_bindgen_0c1c36784fe71810_base
+
+{-# NOINLINE f12 #-}
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+f12 = BG.unsafePerformIO hs_bindgen_0c1c36784fe71810
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+foreign import ccall unsafe "hs_bindgen_8d9bec0d1944b558" hs_bindgen_8d9bec0d1944b558_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+hs_bindgen_8d9bec0d1944b558 :: IO (BG.FunPtr (BG.CUInt -> IO BG.CInt))
+hs_bindgen_8d9bec0d1944b558 =
+  fmap BG.fromFFIType hs_bindgen_8d9bec0d1944b558_base
+
+{-# NOINLINE f13 #-}
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13 :: BG.FunPtr (BG.CUInt -> IO BG.CInt)
+f13 = BG.unsafePerformIO hs_bindgen_8d9bec0d1944b558
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+foreign import ccall unsafe "hs_bindgen_796f92f5831916a6" hs_bindgen_796f92f5831916a6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+hs_bindgen_796f92f5831916a6 :: IO (BG.FunPtr (BG.CUInt -> IO BG.CInt))
+hs_bindgen_796f92f5831916a6 =
+  fmap BG.fromFFIType hs_bindgen_796f92f5831916a6_base
+
+{-# NOINLINE f14 #-}
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14 :: BG.FunPtr (BG.CUInt -> IO BG.CInt)
+f14 = BG.unsafePerformIO hs_bindgen_796f92f5831916a6
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+foreign import ccall unsafe "hs_bindgen_2cb6292b4cc8f420" hs_bindgen_2cb6292b4cc8f420_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+hs_bindgen_2cb6292b4cc8f420 :: IO (BG.FunPtr (BG.CLong -> IO BG.CInt))
+hs_bindgen_2cb6292b4cc8f420 =
+  fmap BG.fromFFIType hs_bindgen_2cb6292b4cc8f420_base
+
+{-# NOINLINE f15 #-}
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15 :: BG.FunPtr (BG.CLong -> IO BG.CInt)
+f15 = BG.unsafePerformIO hs_bindgen_2cb6292b4cc8f420
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+foreign import ccall unsafe "hs_bindgen_b7dd3e78d24cd30c" hs_bindgen_b7dd3e78d24cd30c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+hs_bindgen_b7dd3e78d24cd30c :: IO (BG.FunPtr (BG.CLong -> IO BG.CInt))
+hs_bindgen_b7dd3e78d24cd30c =
+  fmap BG.fromFFIType hs_bindgen_b7dd3e78d24cd30c_base
+
+{-# NOINLINE f16 #-}
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16 :: BG.FunPtr (BG.CLong -> IO BG.CInt)
+f16 = BG.unsafePerformIO hs_bindgen_b7dd3e78d24cd30c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+foreign import ccall unsafe "hs_bindgen_894ff9aa74f040d9" hs_bindgen_894ff9aa74f040d9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+hs_bindgen_894ff9aa74f040d9 :: IO (BG.FunPtr (BG.CLong -> IO BG.CInt))
+hs_bindgen_894ff9aa74f040d9 =
+  fmap BG.fromFFIType hs_bindgen_894ff9aa74f040d9_base
+
+{-# NOINLINE f17 #-}
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17 :: BG.FunPtr (BG.CLong -> IO BG.CInt)
+f17 = BG.unsafePerformIO hs_bindgen_894ff9aa74f040d9
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+foreign import ccall unsafe "hs_bindgen_57359ef6c14eb820" hs_bindgen_57359ef6c14eb820_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+hs_bindgen_57359ef6c14eb820 :: IO (BG.FunPtr (BG.CLong -> IO BG.CInt))
+hs_bindgen_57359ef6c14eb820 =
+  fmap BG.fromFFIType hs_bindgen_57359ef6c14eb820_base
+
+{-# NOINLINE f18 #-}
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18 :: BG.FunPtr (BG.CLong -> IO BG.CInt)
+f18 = BG.unsafePerformIO hs_bindgen_57359ef6c14eb820
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+foreign import ccall unsafe "hs_bindgen_2173cee7470d34a4" hs_bindgen_2173cee7470d34a4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+hs_bindgen_2173cee7470d34a4 :: IO (BG.FunPtr (BG.CULong -> IO BG.CInt))
+hs_bindgen_2173cee7470d34a4 =
+  fmap BG.fromFFIType hs_bindgen_2173cee7470d34a4_base
+
+{-# NOINLINE f19 #-}
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19 :: BG.FunPtr (BG.CULong -> IO BG.CInt)
+f19 = BG.unsafePerformIO hs_bindgen_2173cee7470d34a4
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+foreign import ccall unsafe "hs_bindgen_85dc99217461b608" hs_bindgen_85dc99217461b608_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+hs_bindgen_85dc99217461b608 :: IO (BG.FunPtr (BG.CULong -> IO BG.CInt))
+hs_bindgen_85dc99217461b608 =
+  fmap BG.fromFFIType hs_bindgen_85dc99217461b608_base
+
+{-# NOINLINE f20 #-}
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20 :: BG.FunPtr (BG.CULong -> IO BG.CInt)
+f20 = BG.unsafePerformIO hs_bindgen_85dc99217461b608
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+foreign import ccall unsafe "hs_bindgen_350486e538e7ca90" hs_bindgen_350486e538e7ca90_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+hs_bindgen_350486e538e7ca90 :: IO (BG.FunPtr (BG.CLLong -> IO BG.CInt))
+hs_bindgen_350486e538e7ca90 =
+  fmap BG.fromFFIType hs_bindgen_350486e538e7ca90_base
+
+{-# NOINLINE f21 #-}
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21 :: BG.FunPtr (BG.CLLong -> IO BG.CInt)
+f21 = BG.unsafePerformIO hs_bindgen_350486e538e7ca90
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+foreign import ccall unsafe "hs_bindgen_ad2c8dc646b29be0" hs_bindgen_ad2c8dc646b29be0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+hs_bindgen_ad2c8dc646b29be0 :: IO (BG.FunPtr (BG.CLLong -> IO BG.CInt))
+hs_bindgen_ad2c8dc646b29be0 =
+  fmap BG.fromFFIType hs_bindgen_ad2c8dc646b29be0_base
+
+{-# NOINLINE f22 #-}
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22 :: BG.FunPtr (BG.CLLong -> IO BG.CInt)
+f22 = BG.unsafePerformIO hs_bindgen_ad2c8dc646b29be0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+foreign import ccall unsafe "hs_bindgen_01837bab50ebbe4c" hs_bindgen_01837bab50ebbe4c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+hs_bindgen_01837bab50ebbe4c :: IO (BG.FunPtr (BG.CLLong -> IO BG.CInt))
+hs_bindgen_01837bab50ebbe4c =
+  fmap BG.fromFFIType hs_bindgen_01837bab50ebbe4c_base
+
+{-# NOINLINE f23 #-}
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23 :: BG.FunPtr (BG.CLLong -> IO BG.CInt)
+f23 = BG.unsafePerformIO hs_bindgen_01837bab50ebbe4c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+foreign import ccall unsafe "hs_bindgen_051d17dfd1125c86" hs_bindgen_051d17dfd1125c86_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+hs_bindgen_051d17dfd1125c86 :: IO (BG.FunPtr (BG.CLLong -> IO BG.CInt))
+hs_bindgen_051d17dfd1125c86 =
+  fmap BG.fromFFIType hs_bindgen_051d17dfd1125c86_base
+
+{-# NOINLINE f24 #-}
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24 :: BG.FunPtr (BG.CLLong -> IO BG.CInt)
+f24 = BG.unsafePerformIO hs_bindgen_051d17dfd1125c86
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+foreign import ccall unsafe "hs_bindgen_ba5dd3a36d6f2756" hs_bindgen_ba5dd3a36d6f2756_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+hs_bindgen_ba5dd3a36d6f2756 :: IO (BG.FunPtr (BG.CULLong -> IO BG.CInt))
+hs_bindgen_ba5dd3a36d6f2756 =
+  fmap BG.fromFFIType hs_bindgen_ba5dd3a36d6f2756_base
+
+{-# NOINLINE f25 #-}
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25 :: BG.FunPtr (BG.CULLong -> IO BG.CInt)
+f25 = BG.unsafePerformIO hs_bindgen_ba5dd3a36d6f2756
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+foreign import ccall unsafe "hs_bindgen_22f3b97563fd757f" hs_bindgen_22f3b97563fd757f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+hs_bindgen_22f3b97563fd757f :: IO (BG.FunPtr (BG.CULLong -> IO BG.CInt))
+hs_bindgen_22f3b97563fd757f =
+  fmap BG.fromFFIType hs_bindgen_22f3b97563fd757f_base
+
+{-# NOINLINE f26 #-}
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26 :: BG.FunPtr (BG.CULLong -> IO BG.CInt)
+f26 = BG.unsafePerformIO hs_bindgen_22f3b97563fd757f
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+foreign import ccall unsafe "hs_bindgen_fc81895dfae9b1e5" hs_bindgen_fc81895dfae9b1e5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+hs_bindgen_fc81895dfae9b1e5 :: IO (BG.FunPtr (BG.CFloat -> IO BG.CInt))
+hs_bindgen_fc81895dfae9b1e5 =
+  fmap BG.fromFFIType hs_bindgen_fc81895dfae9b1e5_base
+
+{-# NOINLINE f27 #-}
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27 :: BG.FunPtr (BG.CFloat -> IO BG.CInt)
+f27 = BG.unsafePerformIO hs_bindgen_fc81895dfae9b1e5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+foreign import ccall unsafe "hs_bindgen_f95062f509265011" hs_bindgen_f95062f509265011_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+hs_bindgen_f95062f509265011 :: IO (BG.FunPtr (BG.CDouble -> IO BG.CInt))
+hs_bindgen_f95062f509265011 =
+  fmap BG.fromFFIType hs_bindgen_f95062f509265011_base
+
+{-# NOINLINE f28 #-}
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28 :: BG.FunPtr (BG.CDouble -> IO BG.CInt)
+f28 = BG.unsafePerformIO hs_bindgen_f95062f509265011
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/Example/Safe.hs
@@ -0,0 +1,912 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f1
+    , Example.Safe.f2
+    , Example.Safe.f3
+    , Example.Safe.f4
+    , Example.Safe.f5
+    , Example.Safe.f6
+    , Example.Safe.f7
+    , Example.Safe.f8
+    , Example.Safe.f9
+    , Example.Safe.f10
+    , Example.Safe.f11
+    , Example.Safe.f12
+    , Example.Safe.f13
+    , Example.Safe.f14
+    , Example.Safe.f15
+    , Example.Safe.f16
+    , Example.Safe.f17
+    , Example.Safe.f18
+    , Example.Safe.f19
+    , Example.Safe.f20
+    , Example.Safe.f21
+    , Example.Safe.f22
+    , Example.Safe.f23
+    , Example.Safe.f24
+    , Example.Safe.f25
+    , Example.Safe.f26
+    , Example.Safe.f27
+    , Example.Safe.f28
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/arithmetic_types.h>"
+  , "signed int hs_bindgen_7e7e01d691b1fb2a ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return (f1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_91658d4948bcfe06 ("
+  , "  signed char arg1"
+  , ")"
+  , "{"
+  , "  return (f2)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_40fb57deec0c99d6 ("
+  , "  unsigned char arg1"
+  , ")"
+  , "{"
+  , "  return (f3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d454dc277e0cb86b ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f4)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_446e834618998df2 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f5)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_267cc7905b42c66c ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f6)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e9eef0af846987d5 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f7)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_926fbc7f9888d375 ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f8)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_ec8aef57bd8d53bc ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f9)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d0045e58c2a6f1c4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f10)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_928bc5a3801d9fba ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f11)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0efc218270b00ee6 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f12)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_403a8a02a230ce24 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f13)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_9371cd597ae3022d ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f14)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f07c6429182c10c0 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f15)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_6af229e466926ec5 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f16)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0bc846cbecfd41ba ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f17)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0985403200f5a9de ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f18)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_91ef2c8f3da40e3c ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f19)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_39b524909ca528b5 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f20)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_efa4b421b2928f1e ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f21)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_881c4734d1b436b5 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f22)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0ed2a5cf6068b35a ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f23)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_157ff76d8f7857e2 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f24)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_6046e1b60a2bdbda ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f25)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_3f072797069fc217 ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f26)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4da0472b80930fbf ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return (f27)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_98b4d9dc27aecea0 ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (f28)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_7e7e01d691b1fb2a" hs_bindgen_7e7e01d691b1fb2a_base ::
+     BG.CChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+hs_bindgen_7e7e01d691b1fb2a ::
+     BG.CChar
+  -> IO BG.CInt
+hs_bindgen_7e7e01d691b1fb2a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7e7e01d691b1fb2a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f1 = hs_bindgen_7e7e01d691b1fb2a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_91658d4948bcfe06" hs_bindgen_91658d4948bcfe06_base ::
+     BG.CSChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+hs_bindgen_91658d4948bcfe06 ::
+     BG.CSChar
+  -> IO BG.CInt
+hs_bindgen_91658d4948bcfe06 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_91658d4948bcfe06_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2 ::
+     BG.CSChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f2 = hs_bindgen_91658d4948bcfe06
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_40fb57deec0c99d6" hs_bindgen_40fb57deec0c99d6_base ::
+     BG.CUChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+hs_bindgen_40fb57deec0c99d6 ::
+     BG.CUChar
+  -> IO BG.CInt
+hs_bindgen_40fb57deec0c99d6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_40fb57deec0c99d6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3 ::
+     BG.CUChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f3 = hs_bindgen_40fb57deec0c99d6
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+foreign import ccall safe "hs_bindgen_d454dc277e0cb86b" hs_bindgen_d454dc277e0cb86b_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+hs_bindgen_d454dc277e0cb86b ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_d454dc277e0cb86b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d454dc277e0cb86b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f4 = hs_bindgen_d454dc277e0cb86b
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+foreign import ccall safe "hs_bindgen_446e834618998df2" hs_bindgen_446e834618998df2_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+hs_bindgen_446e834618998df2 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_446e834618998df2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_446e834618998df2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f5 = hs_bindgen_446e834618998df2
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+foreign import ccall safe "hs_bindgen_267cc7905b42c66c" hs_bindgen_267cc7905b42c66c_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+hs_bindgen_267cc7905b42c66c ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_267cc7905b42c66c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_267cc7905b42c66c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f6 = hs_bindgen_267cc7905b42c66c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+foreign import ccall safe "hs_bindgen_e9eef0af846987d5" hs_bindgen_e9eef0af846987d5_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+hs_bindgen_e9eef0af846987d5 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_e9eef0af846987d5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e9eef0af846987d5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f7 = hs_bindgen_e9eef0af846987d5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+foreign import ccall safe "hs_bindgen_926fbc7f9888d375" hs_bindgen_926fbc7f9888d375_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+hs_bindgen_926fbc7f9888d375 ::
+     BG.CUShort
+  -> IO BG.CInt
+hs_bindgen_926fbc7f9888d375 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_926fbc7f9888d375_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f8 = hs_bindgen_926fbc7f9888d375
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+foreign import ccall safe "hs_bindgen_ec8aef57bd8d53bc" hs_bindgen_ec8aef57bd8d53bc_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+hs_bindgen_ec8aef57bd8d53bc ::
+     BG.CUShort
+  -> IO BG.CInt
+hs_bindgen_ec8aef57bd8d53bc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ec8aef57bd8d53bc_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f9 = hs_bindgen_ec8aef57bd8d53bc
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+foreign import ccall safe "hs_bindgen_d0045e58c2a6f1c4" hs_bindgen_d0045e58c2a6f1c4_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+hs_bindgen_d0045e58c2a6f1c4 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_d0045e58c2a6f1c4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d0045e58c2a6f1c4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f10 = hs_bindgen_d0045e58c2a6f1c4
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+foreign import ccall safe "hs_bindgen_928bc5a3801d9fba" hs_bindgen_928bc5a3801d9fba_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+hs_bindgen_928bc5a3801d9fba ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_928bc5a3801d9fba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_928bc5a3801d9fba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f11 = hs_bindgen_928bc5a3801d9fba
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+foreign import ccall safe "hs_bindgen_0efc218270b00ee6" hs_bindgen_0efc218270b00ee6_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+hs_bindgen_0efc218270b00ee6 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_0efc218270b00ee6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0efc218270b00ee6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f12 = hs_bindgen_0efc218270b00ee6
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+foreign import ccall safe "hs_bindgen_403a8a02a230ce24" hs_bindgen_403a8a02a230ce24_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+hs_bindgen_403a8a02a230ce24 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_403a8a02a230ce24 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_403a8a02a230ce24_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f13 = hs_bindgen_403a8a02a230ce24
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+foreign import ccall safe "hs_bindgen_9371cd597ae3022d" hs_bindgen_9371cd597ae3022d_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+hs_bindgen_9371cd597ae3022d ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_9371cd597ae3022d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9371cd597ae3022d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f14 = hs_bindgen_9371cd597ae3022d
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+foreign import ccall safe "hs_bindgen_f07c6429182c10c0" hs_bindgen_f07c6429182c10c0_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+hs_bindgen_f07c6429182c10c0 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_f07c6429182c10c0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f07c6429182c10c0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f15 = hs_bindgen_f07c6429182c10c0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+foreign import ccall safe "hs_bindgen_6af229e466926ec5" hs_bindgen_6af229e466926ec5_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+hs_bindgen_6af229e466926ec5 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_6af229e466926ec5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6af229e466926ec5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f16 = hs_bindgen_6af229e466926ec5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+foreign import ccall safe "hs_bindgen_0bc846cbecfd41ba" hs_bindgen_0bc846cbecfd41ba_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+hs_bindgen_0bc846cbecfd41ba ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_0bc846cbecfd41ba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0bc846cbecfd41ba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f17 = hs_bindgen_0bc846cbecfd41ba
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+foreign import ccall safe "hs_bindgen_0985403200f5a9de" hs_bindgen_0985403200f5a9de_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+hs_bindgen_0985403200f5a9de ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_0985403200f5a9de =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0985403200f5a9de_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f18 = hs_bindgen_0985403200f5a9de
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+foreign import ccall safe "hs_bindgen_91ef2c8f3da40e3c" hs_bindgen_91ef2c8f3da40e3c_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+hs_bindgen_91ef2c8f3da40e3c ::
+     BG.CULong
+  -> IO BG.CInt
+hs_bindgen_91ef2c8f3da40e3c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_91ef2c8f3da40e3c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f19 = hs_bindgen_91ef2c8f3da40e3c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+foreign import ccall safe "hs_bindgen_39b524909ca528b5" hs_bindgen_39b524909ca528b5_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+hs_bindgen_39b524909ca528b5 ::
+     BG.CULong
+  -> IO BG.CInt
+hs_bindgen_39b524909ca528b5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_39b524909ca528b5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f20 = hs_bindgen_39b524909ca528b5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+foreign import ccall safe "hs_bindgen_efa4b421b2928f1e" hs_bindgen_efa4b421b2928f1e_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+hs_bindgen_efa4b421b2928f1e ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_efa4b421b2928f1e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_efa4b421b2928f1e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f21 = hs_bindgen_efa4b421b2928f1e
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+foreign import ccall safe "hs_bindgen_881c4734d1b436b5" hs_bindgen_881c4734d1b436b5_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+hs_bindgen_881c4734d1b436b5 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_881c4734d1b436b5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_881c4734d1b436b5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f22 = hs_bindgen_881c4734d1b436b5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+foreign import ccall safe "hs_bindgen_0ed2a5cf6068b35a" hs_bindgen_0ed2a5cf6068b35a_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+hs_bindgen_0ed2a5cf6068b35a ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_0ed2a5cf6068b35a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0ed2a5cf6068b35a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f23 = hs_bindgen_0ed2a5cf6068b35a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+foreign import ccall safe "hs_bindgen_157ff76d8f7857e2" hs_bindgen_157ff76d8f7857e2_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+hs_bindgen_157ff76d8f7857e2 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_157ff76d8f7857e2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_157ff76d8f7857e2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f24 = hs_bindgen_157ff76d8f7857e2
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+foreign import ccall safe "hs_bindgen_6046e1b60a2bdbda" hs_bindgen_6046e1b60a2bdbda_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+hs_bindgen_6046e1b60a2bdbda ::
+     BG.CULLong
+  -> IO BG.CInt
+hs_bindgen_6046e1b60a2bdbda =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6046e1b60a2bdbda_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f25 = hs_bindgen_6046e1b60a2bdbda
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+foreign import ccall safe "hs_bindgen_3f072797069fc217" hs_bindgen_3f072797069fc217_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+hs_bindgen_3f072797069fc217 ::
+     BG.CULLong
+  -> IO BG.CInt
+hs_bindgen_3f072797069fc217 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3f072797069fc217_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f26 = hs_bindgen_3f072797069fc217
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+foreign import ccall safe "hs_bindgen_4da0472b80930fbf" hs_bindgen_4da0472b80930fbf_base ::
+     BG.CFloat
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+hs_bindgen_4da0472b80930fbf ::
+     BG.CFloat
+  -> IO BG.CInt
+hs_bindgen_4da0472b80930fbf =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4da0472b80930fbf_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f27 = hs_bindgen_4da0472b80930fbf
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+foreign import ccall safe "hs_bindgen_98b4d9dc27aecea0" hs_bindgen_98b4d9dc27aecea0_base ::
+     BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+hs_bindgen_98b4d9dc27aecea0 ::
+     BG.CDouble
+  -> IO BG.CInt
+hs_bindgen_98b4d9dc27aecea0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_98b4d9dc27aecea0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28 ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f28 = hs_bindgen_98b4d9dc27aecea0
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/Example/Unsafe.hs
@@ -0,0 +1,912 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f1
+    , Example.Unsafe.f2
+    , Example.Unsafe.f3
+    , Example.Unsafe.f4
+    , Example.Unsafe.f5
+    , Example.Unsafe.f6
+    , Example.Unsafe.f7
+    , Example.Unsafe.f8
+    , Example.Unsafe.f9
+    , Example.Unsafe.f10
+    , Example.Unsafe.f11
+    , Example.Unsafe.f12
+    , Example.Unsafe.f13
+    , Example.Unsafe.f14
+    , Example.Unsafe.f15
+    , Example.Unsafe.f16
+    , Example.Unsafe.f17
+    , Example.Unsafe.f18
+    , Example.Unsafe.f19
+    , Example.Unsafe.f20
+    , Example.Unsafe.f21
+    , Example.Unsafe.f22
+    , Example.Unsafe.f23
+    , Example.Unsafe.f24
+    , Example.Unsafe.f25
+    , Example.Unsafe.f26
+    , Example.Unsafe.f27
+    , Example.Unsafe.f28
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/arithmetic_types.h>"
+  , "signed int hs_bindgen_d6e3d8093d108780 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return (f1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_dc34e6197f6f39df ("
+  , "  signed char arg1"
+  , ")"
+  , "{"
+  , "  return (f2)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b642c5b44d663af5 ("
+  , "  unsigned char arg1"
+  , ")"
+  , "{"
+  , "  return (f3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_27f5c806bf4593e7 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f4)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e8c0eab09a235501 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f5)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_7925bdb53e040792 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f6)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e6eb4efed37c1708 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f7)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_21cc8ace7d7441bd ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f8)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_ddca0323ddaaee35 ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f9)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d42a7635d5a1a314 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f10)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_111c67845229b054 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f11)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_6c05305fb77f1073 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f12)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_661a8e9409698789 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f13)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_3bdf905c84cb8fb9 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f14)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_212883c913884d27 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f15)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f72cafc33ec81360 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f16)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_ea5f62444673cf16 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f17)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_9f4e020f892b30cb ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f18)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_47f005495bf88291 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f19)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d02703a7ce8fade2 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f20)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_9f98e2aafc8c5a95 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f21)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_430da5f47172739a ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f22)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_bd83aa03a61a8a06 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f23)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_affcee7ffeebbac9 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f24)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b8a7fb0f9add23ab ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f25)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_377c3e6bd5b69285 ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f26)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b82bda1eaf8b02ba ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return (f27)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_8d36f32587832dae ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (f28)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_d6e3d8093d108780" hs_bindgen_d6e3d8093d108780_base ::
+     BG.CChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+hs_bindgen_d6e3d8093d108780 ::
+     BG.CChar
+  -> IO BG.CInt
+hs_bindgen_d6e3d8093d108780 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d6e3d8093d108780_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f1 = hs_bindgen_d6e3d8093d108780
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_dc34e6197f6f39df" hs_bindgen_dc34e6197f6f39df_base ::
+     BG.CSChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+hs_bindgen_dc34e6197f6f39df ::
+     BG.CSChar
+  -> IO BG.CInt
+hs_bindgen_dc34e6197f6f39df =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_dc34e6197f6f39df_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2 ::
+     BG.CSChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f2 = hs_bindgen_dc34e6197f6f39df
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_b642c5b44d663af5" hs_bindgen_b642c5b44d663af5_base ::
+     BG.CUChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+hs_bindgen_b642c5b44d663af5 ::
+     BG.CUChar
+  -> IO BG.CInt
+hs_bindgen_b642c5b44d663af5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b642c5b44d663af5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3 ::
+     BG.CUChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f3 = hs_bindgen_b642c5b44d663af5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+foreign import ccall unsafe "hs_bindgen_27f5c806bf4593e7" hs_bindgen_27f5c806bf4593e7_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+hs_bindgen_27f5c806bf4593e7 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_27f5c806bf4593e7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_27f5c806bf4593e7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f4 = hs_bindgen_27f5c806bf4593e7
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+foreign import ccall unsafe "hs_bindgen_e8c0eab09a235501" hs_bindgen_e8c0eab09a235501_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+hs_bindgen_e8c0eab09a235501 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_e8c0eab09a235501 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e8c0eab09a235501_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f5 = hs_bindgen_e8c0eab09a235501
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+foreign import ccall unsafe "hs_bindgen_7925bdb53e040792" hs_bindgen_7925bdb53e040792_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+hs_bindgen_7925bdb53e040792 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_7925bdb53e040792 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7925bdb53e040792_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f6 = hs_bindgen_7925bdb53e040792
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+foreign import ccall unsafe "hs_bindgen_e6eb4efed37c1708" hs_bindgen_e6eb4efed37c1708_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+hs_bindgen_e6eb4efed37c1708 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_e6eb4efed37c1708 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e6eb4efed37c1708_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f7 = hs_bindgen_e6eb4efed37c1708
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+foreign import ccall unsafe "hs_bindgen_21cc8ace7d7441bd" hs_bindgen_21cc8ace7d7441bd_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+hs_bindgen_21cc8ace7d7441bd ::
+     BG.CUShort
+  -> IO BG.CInt
+hs_bindgen_21cc8ace7d7441bd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_21cc8ace7d7441bd_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f8 = hs_bindgen_21cc8ace7d7441bd
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+foreign import ccall unsafe "hs_bindgen_ddca0323ddaaee35" hs_bindgen_ddca0323ddaaee35_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+hs_bindgen_ddca0323ddaaee35 ::
+     BG.CUShort
+  -> IO BG.CInt
+hs_bindgen_ddca0323ddaaee35 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ddca0323ddaaee35_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f9 = hs_bindgen_ddca0323ddaaee35
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+foreign import ccall unsafe "hs_bindgen_d42a7635d5a1a314" hs_bindgen_d42a7635d5a1a314_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+hs_bindgen_d42a7635d5a1a314 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_d42a7635d5a1a314 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d42a7635d5a1a314_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f10 = hs_bindgen_d42a7635d5a1a314
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+foreign import ccall unsafe "hs_bindgen_111c67845229b054" hs_bindgen_111c67845229b054_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+hs_bindgen_111c67845229b054 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_111c67845229b054 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_111c67845229b054_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f11 = hs_bindgen_111c67845229b054
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+foreign import ccall unsafe "hs_bindgen_6c05305fb77f1073" hs_bindgen_6c05305fb77f1073_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+hs_bindgen_6c05305fb77f1073 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_6c05305fb77f1073 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6c05305fb77f1073_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f12 = hs_bindgen_6c05305fb77f1073
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+foreign import ccall unsafe "hs_bindgen_661a8e9409698789" hs_bindgen_661a8e9409698789_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+hs_bindgen_661a8e9409698789 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_661a8e9409698789 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_661a8e9409698789_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f13 = hs_bindgen_661a8e9409698789
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+foreign import ccall unsafe "hs_bindgen_3bdf905c84cb8fb9" hs_bindgen_3bdf905c84cb8fb9_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+hs_bindgen_3bdf905c84cb8fb9 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_3bdf905c84cb8fb9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3bdf905c84cb8fb9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f14 = hs_bindgen_3bdf905c84cb8fb9
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+foreign import ccall unsafe "hs_bindgen_212883c913884d27" hs_bindgen_212883c913884d27_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+hs_bindgen_212883c913884d27 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_212883c913884d27 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_212883c913884d27_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f15 = hs_bindgen_212883c913884d27
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+foreign import ccall unsafe "hs_bindgen_f72cafc33ec81360" hs_bindgen_f72cafc33ec81360_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+hs_bindgen_f72cafc33ec81360 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_f72cafc33ec81360 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f72cafc33ec81360_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f16 = hs_bindgen_f72cafc33ec81360
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+foreign import ccall unsafe "hs_bindgen_ea5f62444673cf16" hs_bindgen_ea5f62444673cf16_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+hs_bindgen_ea5f62444673cf16 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_ea5f62444673cf16 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ea5f62444673cf16_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f17 = hs_bindgen_ea5f62444673cf16
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+foreign import ccall unsafe "hs_bindgen_9f4e020f892b30cb" hs_bindgen_9f4e020f892b30cb_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+hs_bindgen_9f4e020f892b30cb ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_9f4e020f892b30cb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9f4e020f892b30cb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f18 = hs_bindgen_9f4e020f892b30cb
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+foreign import ccall unsafe "hs_bindgen_47f005495bf88291" hs_bindgen_47f005495bf88291_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+hs_bindgen_47f005495bf88291 ::
+     BG.CULong
+  -> IO BG.CInt
+hs_bindgen_47f005495bf88291 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_47f005495bf88291_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f19 = hs_bindgen_47f005495bf88291
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+foreign import ccall unsafe "hs_bindgen_d02703a7ce8fade2" hs_bindgen_d02703a7ce8fade2_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+hs_bindgen_d02703a7ce8fade2 ::
+     BG.CULong
+  -> IO BG.CInt
+hs_bindgen_d02703a7ce8fade2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d02703a7ce8fade2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f20 = hs_bindgen_d02703a7ce8fade2
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+foreign import ccall unsafe "hs_bindgen_9f98e2aafc8c5a95" hs_bindgen_9f98e2aafc8c5a95_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+hs_bindgen_9f98e2aafc8c5a95 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_9f98e2aafc8c5a95 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9f98e2aafc8c5a95_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f21 = hs_bindgen_9f98e2aafc8c5a95
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+foreign import ccall unsafe "hs_bindgen_430da5f47172739a" hs_bindgen_430da5f47172739a_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+hs_bindgen_430da5f47172739a ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_430da5f47172739a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_430da5f47172739a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f22 = hs_bindgen_430da5f47172739a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+foreign import ccall unsafe "hs_bindgen_bd83aa03a61a8a06" hs_bindgen_bd83aa03a61a8a06_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+hs_bindgen_bd83aa03a61a8a06 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_bd83aa03a61a8a06 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bd83aa03a61a8a06_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f23 = hs_bindgen_bd83aa03a61a8a06
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+foreign import ccall unsafe "hs_bindgen_affcee7ffeebbac9" hs_bindgen_affcee7ffeebbac9_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+hs_bindgen_affcee7ffeebbac9 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_affcee7ffeebbac9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_affcee7ffeebbac9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f24 = hs_bindgen_affcee7ffeebbac9
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+foreign import ccall unsafe "hs_bindgen_b8a7fb0f9add23ab" hs_bindgen_b8a7fb0f9add23ab_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+hs_bindgen_b8a7fb0f9add23ab ::
+     BG.CULLong
+  -> IO BG.CInt
+hs_bindgen_b8a7fb0f9add23ab =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b8a7fb0f9add23ab_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f25 = hs_bindgen_b8a7fb0f9add23ab
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+foreign import ccall unsafe "hs_bindgen_377c3e6bd5b69285" hs_bindgen_377c3e6bd5b69285_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+hs_bindgen_377c3e6bd5b69285 ::
+     BG.CULLong
+  -> IO BG.CInt
+hs_bindgen_377c3e6bd5b69285 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_377c3e6bd5b69285_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f26 = hs_bindgen_377c3e6bd5b69285
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+foreign import ccall unsafe "hs_bindgen_b82bda1eaf8b02ba" hs_bindgen_b82bda1eaf8b02ba_base ::
+     BG.CFloat
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+hs_bindgen_b82bda1eaf8b02ba ::
+     BG.CFloat
+  -> IO BG.CInt
+hs_bindgen_b82bda1eaf8b02ba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b82bda1eaf8b02ba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f27 = hs_bindgen_b82bda1eaf8b02ba
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+foreign import ccall unsafe "hs_bindgen_8d36f32587832dae" hs_bindgen_8d36f32587832dae_base ::
+     BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+hs_bindgen_8d36f32587832dae ::
+     BG.CDouble
+  -> IO BG.CInt
+hs_bindgen_8d36f32587832dae =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8d36f32587832dae_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28 ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f28 = hs_bindgen_8d36f32587832dae
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.1.empty/th.txt
@@ -0,0 +1,2410 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/arithmetic_types.h
+-- #include <macros/reparse/arithmetic_types.h>
+-- signed int hs_bindgen_7e7e01d691b1fb2a (
+--   char arg1
+-- )
+-- {
+--   return (f1)(arg1);
+-- }
+-- signed int hs_bindgen_91658d4948bcfe06 (
+--   signed char arg1
+-- )
+-- {
+--   return (f2)(arg1);
+-- }
+-- signed int hs_bindgen_40fb57deec0c99d6 (
+--   unsigned char arg1
+-- )
+-- {
+--   return (f3)(arg1);
+-- }
+-- signed int hs_bindgen_d454dc277e0cb86b (
+--   signed short arg1
+-- )
+-- {
+--   return (f4)(arg1);
+-- }
+-- signed int hs_bindgen_446e834618998df2 (
+--   signed short arg1
+-- )
+-- {
+--   return (f5)(arg1);
+-- }
+-- signed int hs_bindgen_267cc7905b42c66c (
+--   signed short arg1
+-- )
+-- {
+--   return (f6)(arg1);
+-- }
+-- signed int hs_bindgen_e9eef0af846987d5 (
+--   signed short arg1
+-- )
+-- {
+--   return (f7)(arg1);
+-- }
+-- signed int hs_bindgen_926fbc7f9888d375 (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f8)(arg1);
+-- }
+-- signed int hs_bindgen_ec8aef57bd8d53bc (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f9)(arg1);
+-- }
+-- signed int hs_bindgen_d0045e58c2a6f1c4 (
+--   signed int arg1
+-- )
+-- {
+--   return (f10)(arg1);
+-- }
+-- signed int hs_bindgen_928bc5a3801d9fba (
+--   signed int arg1
+-- )
+-- {
+--   return (f11)(arg1);
+-- }
+-- signed int hs_bindgen_0efc218270b00ee6 (
+--   signed int arg1
+-- )
+-- {
+--   return (f12)(arg1);
+-- }
+-- signed int hs_bindgen_403a8a02a230ce24 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f13)(arg1);
+-- }
+-- signed int hs_bindgen_9371cd597ae3022d (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f14)(arg1);
+-- }
+-- signed int hs_bindgen_f07c6429182c10c0 (
+--   signed long arg1
+-- )
+-- {
+--   return (f15)(arg1);
+-- }
+-- signed int hs_bindgen_6af229e466926ec5 (
+--   signed long arg1
+-- )
+-- {
+--   return (f16)(arg1);
+-- }
+-- signed int hs_bindgen_0bc846cbecfd41ba (
+--   signed long arg1
+-- )
+-- {
+--   return (f17)(arg1);
+-- }
+-- signed int hs_bindgen_0985403200f5a9de (
+--   signed long arg1
+-- )
+-- {
+--   return (f18)(arg1);
+-- }
+-- signed int hs_bindgen_91ef2c8f3da40e3c (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f19)(arg1);
+-- }
+-- signed int hs_bindgen_39b524909ca528b5 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f20)(arg1);
+-- }
+-- signed int hs_bindgen_efa4b421b2928f1e (
+--   signed long long arg1
+-- )
+-- {
+--   return (f21)(arg1);
+-- }
+-- signed int hs_bindgen_881c4734d1b436b5 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f22)(arg1);
+-- }
+-- signed int hs_bindgen_0ed2a5cf6068b35a (
+--   signed long long arg1
+-- )
+-- {
+--   return (f23)(arg1);
+-- }
+-- signed int hs_bindgen_157ff76d8f7857e2 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f24)(arg1);
+-- }
+-- signed int hs_bindgen_6046e1b60a2bdbda (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f25)(arg1);
+-- }
+-- signed int hs_bindgen_3f072797069fc217 (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f26)(arg1);
+-- }
+-- signed int hs_bindgen_4da0472b80930fbf (
+--   float arg1
+-- )
+-- {
+--   return (f27)(arg1);
+-- }
+-- signed int hs_bindgen_98b4d9dc27aecea0 (
+--   double arg1
+-- )
+-- {
+--   return (f28)(arg1);
+-- }
+-- signed int hs_bindgen_d6e3d8093d108780 (
+--   char arg1
+-- )
+-- {
+--   return (f1)(arg1);
+-- }
+-- signed int hs_bindgen_dc34e6197f6f39df (
+--   signed char arg1
+-- )
+-- {
+--   return (f2)(arg1);
+-- }
+-- signed int hs_bindgen_b642c5b44d663af5 (
+--   unsigned char arg1
+-- )
+-- {
+--   return (f3)(arg1);
+-- }
+-- signed int hs_bindgen_27f5c806bf4593e7 (
+--   signed short arg1
+-- )
+-- {
+--   return (f4)(arg1);
+-- }
+-- signed int hs_bindgen_e8c0eab09a235501 (
+--   signed short arg1
+-- )
+-- {
+--   return (f5)(arg1);
+-- }
+-- signed int hs_bindgen_7925bdb53e040792 (
+--   signed short arg1
+-- )
+-- {
+--   return (f6)(arg1);
+-- }
+-- signed int hs_bindgen_e6eb4efed37c1708 (
+--   signed short arg1
+-- )
+-- {
+--   return (f7)(arg1);
+-- }
+-- signed int hs_bindgen_21cc8ace7d7441bd (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f8)(arg1);
+-- }
+-- signed int hs_bindgen_ddca0323ddaaee35 (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f9)(arg1);
+-- }
+-- signed int hs_bindgen_d42a7635d5a1a314 (
+--   signed int arg1
+-- )
+-- {
+--   return (f10)(arg1);
+-- }
+-- signed int hs_bindgen_111c67845229b054 (
+--   signed int arg1
+-- )
+-- {
+--   return (f11)(arg1);
+-- }
+-- signed int hs_bindgen_6c05305fb77f1073 (
+--   signed int arg1
+-- )
+-- {
+--   return (f12)(arg1);
+-- }
+-- signed int hs_bindgen_661a8e9409698789 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f13)(arg1);
+-- }
+-- signed int hs_bindgen_3bdf905c84cb8fb9 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f14)(arg1);
+-- }
+-- signed int hs_bindgen_212883c913884d27 (
+--   signed long arg1
+-- )
+-- {
+--   return (f15)(arg1);
+-- }
+-- signed int hs_bindgen_f72cafc33ec81360 (
+--   signed long arg1
+-- )
+-- {
+--   return (f16)(arg1);
+-- }
+-- signed int hs_bindgen_ea5f62444673cf16 (
+--   signed long arg1
+-- )
+-- {
+--   return (f17)(arg1);
+-- }
+-- signed int hs_bindgen_9f4e020f892b30cb (
+--   signed long arg1
+-- )
+-- {
+--   return (f18)(arg1);
+-- }
+-- signed int hs_bindgen_47f005495bf88291 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f19)(arg1);
+-- }
+-- signed int hs_bindgen_d02703a7ce8fade2 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f20)(arg1);
+-- }
+-- signed int hs_bindgen_9f98e2aafc8c5a95 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f21)(arg1);
+-- }
+-- signed int hs_bindgen_430da5f47172739a (
+--   signed long long arg1
+-- )
+-- {
+--   return (f22)(arg1);
+-- }
+-- signed int hs_bindgen_bd83aa03a61a8a06 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f23)(arg1);
+-- }
+-- signed int hs_bindgen_affcee7ffeebbac9 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f24)(arg1);
+-- }
+-- signed int hs_bindgen_b8a7fb0f9add23ab (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f25)(arg1);
+-- }
+-- signed int hs_bindgen_377c3e6bd5b69285 (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f26)(arg1);
+-- }
+-- signed int hs_bindgen_b82bda1eaf8b02ba (
+--   float arg1
+-- )
+-- {
+--   return (f27)(arg1);
+-- }
+-- signed int hs_bindgen_8d36f32587832dae (
+--   double arg1
+-- )
+-- {
+--   return (f28)(arg1);
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_1208d85624465c51 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &f1;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_90bf738ed6e126cf (void)) (
+--   signed char arg1
+-- )
+-- {
+--   return &f2;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f3 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_541fb107a8c068d0 (void)) (
+--   unsigned char arg1
+-- )
+-- {
+--   return &f3;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f4 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_695a21f5c624ca64 (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f4;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f5 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_43491bdffe43bbe1 (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f5;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f6 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ffafdd943146661a (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f6;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f7 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_7c6250122a3c59a3 (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f7;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f8 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_60cbc6e072d14643 (void)) (
+--   unsigned short arg1
+-- )
+-- {
+--   return &f8;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f9 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_fa356fa03c563829 (void)) (
+--   unsigned short arg1
+-- )
+-- {
+--   return &f9;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f10 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_6971f14ec2033453 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f10;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f11 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_18e46ae0dfd9dbe0 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f11;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f12 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_0c1c36784fe71810 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f12;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f13 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_8d9bec0d1944b558 (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &f13;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f14 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_796f92f5831916a6 (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &f14;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f15 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2cb6292b4cc8f420 (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f15;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f16 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_b7dd3e78d24cd30c (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f16;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f17 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_894ff9aa74f040d9 (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f17;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f18 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_57359ef6c14eb820 (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f18;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f19 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2173cee7470d34a4 (void)) (
+--   unsigned long arg1
+-- )
+-- {
+--   return &f19;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f20 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_85dc99217461b608 (void)) (
+--   unsigned long arg1
+-- )
+-- {
+--   return &f20;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f21 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_350486e538e7ca90 (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f21;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f22 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ad2c8dc646b29be0 (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f22;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f23 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_01837bab50ebbe4c (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f23;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f24 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_051d17dfd1125c86 (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f24;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f25 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ba5dd3a36d6f2756 (void)) (
+--   unsigned long long arg1
+-- )
+-- {
+--   return &f25;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f26 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_22f3b97563fd757f (void)) (
+--   unsigned long long arg1
+-- )
+-- {
+--   return &f26;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f27 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_fc81895dfae9b1e5 (void)) (
+--   float arg1
+-- )
+-- {
+--   return &f27;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f28 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_f95062f509265011 (void)) (
+--   double arg1
+-- )
+-- {
+--   return &f28;
+-- }
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_7e7e01d691b1fb2a" hs_bindgen_7e7e01d691b1fb2a_base ::
+    CChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+hs_bindgen_7e7e01d691b1fb2a :: CChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+hs_bindgen_7e7e01d691b1fb2a = \x_0 -> fmap fromFFIType (hs_bindgen_7e7e01d691b1fb2a_base (toFFIType x_0))
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_safe :: CChar -> IO CInt
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_safe = hs_bindgen_7e7e01d691b1fb2a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_91658d4948bcfe06" hs_bindgen_91658d4948bcfe06_base ::
+    CSChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+hs_bindgen_91658d4948bcfe06 :: CSChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+hs_bindgen_91658d4948bcfe06 = \x_0 -> fmap fromFFIType (hs_bindgen_91658d4948bcfe06_base (toFFIType x_0))
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_safe :: CSChar -> IO CInt
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_safe = hs_bindgen_91658d4948bcfe06
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_40fb57deec0c99d6" hs_bindgen_40fb57deec0c99d6_base ::
+    CUChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+hs_bindgen_40fb57deec0c99d6 :: CUChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+hs_bindgen_40fb57deec0c99d6 = \x_0 -> fmap fromFFIType (hs_bindgen_40fb57deec0c99d6_base (toFFIType x_0))
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_safe :: CUChar -> IO CInt
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_safe = hs_bindgen_40fb57deec0c99d6
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+foreign import ccall safe "hs_bindgen_d454dc277e0cb86b" hs_bindgen_d454dc277e0cb86b_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+hs_bindgen_d454dc277e0cb86b :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+hs_bindgen_d454dc277e0cb86b = \x_0 -> fmap fromFFIType (hs_bindgen_d454dc277e0cb86b_base (toFFIType x_0))
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_safe :: CShort -> IO CInt
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_safe = hs_bindgen_d454dc277e0cb86b
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+foreign import ccall safe "hs_bindgen_446e834618998df2" hs_bindgen_446e834618998df2_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+hs_bindgen_446e834618998df2 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+hs_bindgen_446e834618998df2 = \x_0 -> fmap fromFFIType (hs_bindgen_446e834618998df2_base (toFFIType x_0))
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_safe :: CShort -> IO CInt
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_safe = hs_bindgen_446e834618998df2
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+foreign import ccall safe "hs_bindgen_267cc7905b42c66c" hs_bindgen_267cc7905b42c66c_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+hs_bindgen_267cc7905b42c66c :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+hs_bindgen_267cc7905b42c66c = \x_0 -> fmap fromFFIType (hs_bindgen_267cc7905b42c66c_base (toFFIType x_0))
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_safe :: CShort -> IO CInt
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_safe = hs_bindgen_267cc7905b42c66c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+foreign import ccall safe "hs_bindgen_e9eef0af846987d5" hs_bindgen_e9eef0af846987d5_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+hs_bindgen_e9eef0af846987d5 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+hs_bindgen_e9eef0af846987d5 = \x_0 -> fmap fromFFIType (hs_bindgen_e9eef0af846987d5_base (toFFIType x_0))
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_safe :: CShort -> IO CInt
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_safe = hs_bindgen_e9eef0af846987d5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+foreign import ccall safe "hs_bindgen_926fbc7f9888d375" hs_bindgen_926fbc7f9888d375_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+hs_bindgen_926fbc7f9888d375 :: CUShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+hs_bindgen_926fbc7f9888d375 = \x_0 -> fmap fromFFIType (hs_bindgen_926fbc7f9888d375_base (toFFIType x_0))
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_safe :: CUShort -> IO CInt
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_safe = hs_bindgen_926fbc7f9888d375
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+foreign import ccall safe "hs_bindgen_ec8aef57bd8d53bc" hs_bindgen_ec8aef57bd8d53bc_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+hs_bindgen_ec8aef57bd8d53bc :: CUShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+hs_bindgen_ec8aef57bd8d53bc = \x_0 -> fmap fromFFIType (hs_bindgen_ec8aef57bd8d53bc_base (toFFIType x_0))
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_safe :: CUShort -> IO CInt
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_safe = hs_bindgen_ec8aef57bd8d53bc
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+foreign import ccall safe "hs_bindgen_d0045e58c2a6f1c4" hs_bindgen_d0045e58c2a6f1c4_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+hs_bindgen_d0045e58c2a6f1c4 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+hs_bindgen_d0045e58c2a6f1c4 = \x_0 -> fmap fromFFIType (hs_bindgen_d0045e58c2a6f1c4_base (toFFIType x_0))
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_safe :: CInt -> IO CInt
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_safe = hs_bindgen_d0045e58c2a6f1c4
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+foreign import ccall safe "hs_bindgen_928bc5a3801d9fba" hs_bindgen_928bc5a3801d9fba_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+hs_bindgen_928bc5a3801d9fba :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+hs_bindgen_928bc5a3801d9fba = \x_0 -> fmap fromFFIType (hs_bindgen_928bc5a3801d9fba_base (toFFIType x_0))
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_safe :: CInt -> IO CInt
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_safe = hs_bindgen_928bc5a3801d9fba
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+foreign import ccall safe "hs_bindgen_0efc218270b00ee6" hs_bindgen_0efc218270b00ee6_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+hs_bindgen_0efc218270b00ee6 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+hs_bindgen_0efc218270b00ee6 = \x_0 -> fmap fromFFIType (hs_bindgen_0efc218270b00ee6_base (toFFIType x_0))
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_safe :: CInt -> IO CInt
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_safe = hs_bindgen_0efc218270b00ee6
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+foreign import ccall safe "hs_bindgen_403a8a02a230ce24" hs_bindgen_403a8a02a230ce24_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+hs_bindgen_403a8a02a230ce24 :: CUInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+hs_bindgen_403a8a02a230ce24 = \x_0 -> fmap fromFFIType (hs_bindgen_403a8a02a230ce24_base (toFFIType x_0))
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_safe :: CUInt -> IO CInt
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_safe = hs_bindgen_403a8a02a230ce24
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+foreign import ccall safe "hs_bindgen_9371cd597ae3022d" hs_bindgen_9371cd597ae3022d_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+hs_bindgen_9371cd597ae3022d :: CUInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+hs_bindgen_9371cd597ae3022d = \x_0 -> fmap fromFFIType (hs_bindgen_9371cd597ae3022d_base (toFFIType x_0))
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_safe :: CUInt -> IO CInt
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_safe = hs_bindgen_9371cd597ae3022d
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+foreign import ccall safe "hs_bindgen_f07c6429182c10c0" hs_bindgen_f07c6429182c10c0_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+hs_bindgen_f07c6429182c10c0 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+hs_bindgen_f07c6429182c10c0 = \x_0 -> fmap fromFFIType (hs_bindgen_f07c6429182c10c0_base (toFFIType x_0))
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_safe :: CLong -> IO CInt
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_safe = hs_bindgen_f07c6429182c10c0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+foreign import ccall safe "hs_bindgen_6af229e466926ec5" hs_bindgen_6af229e466926ec5_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+hs_bindgen_6af229e466926ec5 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+hs_bindgen_6af229e466926ec5 = \x_0 -> fmap fromFFIType (hs_bindgen_6af229e466926ec5_base (toFFIType x_0))
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_safe :: CLong -> IO CInt
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_safe = hs_bindgen_6af229e466926ec5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+foreign import ccall safe "hs_bindgen_0bc846cbecfd41ba" hs_bindgen_0bc846cbecfd41ba_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+hs_bindgen_0bc846cbecfd41ba :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+hs_bindgen_0bc846cbecfd41ba = \x_0 -> fmap fromFFIType (hs_bindgen_0bc846cbecfd41ba_base (toFFIType x_0))
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_safe :: CLong -> IO CInt
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_safe = hs_bindgen_0bc846cbecfd41ba
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+foreign import ccall safe "hs_bindgen_0985403200f5a9de" hs_bindgen_0985403200f5a9de_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+hs_bindgen_0985403200f5a9de :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+hs_bindgen_0985403200f5a9de = \x_0 -> fmap fromFFIType (hs_bindgen_0985403200f5a9de_base (toFFIType x_0))
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_safe :: CLong -> IO CInt
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_safe = hs_bindgen_0985403200f5a9de
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+foreign import ccall safe "hs_bindgen_91ef2c8f3da40e3c" hs_bindgen_91ef2c8f3da40e3c_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+hs_bindgen_91ef2c8f3da40e3c :: CULong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+hs_bindgen_91ef2c8f3da40e3c = \x_0 -> fmap fromFFIType (hs_bindgen_91ef2c8f3da40e3c_base (toFFIType x_0))
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_safe :: CULong -> IO CInt
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_safe = hs_bindgen_91ef2c8f3da40e3c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+foreign import ccall safe "hs_bindgen_39b524909ca528b5" hs_bindgen_39b524909ca528b5_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+hs_bindgen_39b524909ca528b5 :: CULong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+hs_bindgen_39b524909ca528b5 = \x_0 -> fmap fromFFIType (hs_bindgen_39b524909ca528b5_base (toFFIType x_0))
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_safe :: CULong -> IO CInt
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_safe = hs_bindgen_39b524909ca528b5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+foreign import ccall safe "hs_bindgen_efa4b421b2928f1e" hs_bindgen_efa4b421b2928f1e_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+hs_bindgen_efa4b421b2928f1e :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+hs_bindgen_efa4b421b2928f1e = \x_0 -> fmap fromFFIType (hs_bindgen_efa4b421b2928f1e_base (toFFIType x_0))
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_safe :: CLLong -> IO CInt
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_safe = hs_bindgen_efa4b421b2928f1e
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+foreign import ccall safe "hs_bindgen_881c4734d1b436b5" hs_bindgen_881c4734d1b436b5_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+hs_bindgen_881c4734d1b436b5 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+hs_bindgen_881c4734d1b436b5 = \x_0 -> fmap fromFFIType (hs_bindgen_881c4734d1b436b5_base (toFFIType x_0))
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_safe :: CLLong -> IO CInt
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_safe = hs_bindgen_881c4734d1b436b5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+foreign import ccall safe "hs_bindgen_0ed2a5cf6068b35a" hs_bindgen_0ed2a5cf6068b35a_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+hs_bindgen_0ed2a5cf6068b35a :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+hs_bindgen_0ed2a5cf6068b35a = \x_0 -> fmap fromFFIType (hs_bindgen_0ed2a5cf6068b35a_base (toFFIType x_0))
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_safe :: CLLong -> IO CInt
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_safe = hs_bindgen_0ed2a5cf6068b35a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+foreign import ccall safe "hs_bindgen_157ff76d8f7857e2" hs_bindgen_157ff76d8f7857e2_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+hs_bindgen_157ff76d8f7857e2 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+hs_bindgen_157ff76d8f7857e2 = \x_0 -> fmap fromFFIType (hs_bindgen_157ff76d8f7857e2_base (toFFIType x_0))
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_safe :: CLLong -> IO CInt
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_safe = hs_bindgen_157ff76d8f7857e2
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+foreign import ccall safe "hs_bindgen_6046e1b60a2bdbda" hs_bindgen_6046e1b60a2bdbda_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+hs_bindgen_6046e1b60a2bdbda :: CULLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+hs_bindgen_6046e1b60a2bdbda = \x_0 -> fmap fromFFIType (hs_bindgen_6046e1b60a2bdbda_base (toFFIType x_0))
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_safe :: CULLong -> IO CInt
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_safe = hs_bindgen_6046e1b60a2bdbda
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+foreign import ccall safe "hs_bindgen_3f072797069fc217" hs_bindgen_3f072797069fc217_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+hs_bindgen_3f072797069fc217 :: CULLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+hs_bindgen_3f072797069fc217 = \x_0 -> fmap fromFFIType (hs_bindgen_3f072797069fc217_base (toFFIType x_0))
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_safe :: CULLong -> IO CInt
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_safe = hs_bindgen_3f072797069fc217
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+foreign import ccall safe "hs_bindgen_4da0472b80930fbf" hs_bindgen_4da0472b80930fbf_base ::
+    CFloat
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+hs_bindgen_4da0472b80930fbf :: CFloat -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+hs_bindgen_4da0472b80930fbf = \x_0 -> fmap fromFFIType (hs_bindgen_4da0472b80930fbf_base (toFFIType x_0))
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_safe :: CFloat -> IO CInt
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_safe = hs_bindgen_4da0472b80930fbf
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+foreign import ccall safe "hs_bindgen_98b4d9dc27aecea0" hs_bindgen_98b4d9dc27aecea0_base ::
+    CDouble
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+hs_bindgen_98b4d9dc27aecea0 :: CDouble -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+hs_bindgen_98b4d9dc27aecea0 = \x_0 -> fmap fromFFIType (hs_bindgen_98b4d9dc27aecea0_base (toFFIType x_0))
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_safe :: CDouble -> IO CInt
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_safe = hs_bindgen_98b4d9dc27aecea0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_d6e3d8093d108780" hs_bindgen_d6e3d8093d108780_base ::
+    CChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+hs_bindgen_d6e3d8093d108780 :: CChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+hs_bindgen_d6e3d8093d108780 = \x_0 -> fmap fromFFIType (hs_bindgen_d6e3d8093d108780_base (toFFIType x_0))
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_unsafe :: CChar -> IO CInt
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_unsafe = hs_bindgen_d6e3d8093d108780
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_dc34e6197f6f39df" hs_bindgen_dc34e6197f6f39df_base ::
+    CSChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+hs_bindgen_dc34e6197f6f39df :: CSChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+hs_bindgen_dc34e6197f6f39df = \x_0 -> fmap fromFFIType (hs_bindgen_dc34e6197f6f39df_base (toFFIType x_0))
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_unsafe :: CSChar -> IO CInt
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_unsafe = hs_bindgen_dc34e6197f6f39df
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_b642c5b44d663af5" hs_bindgen_b642c5b44d663af5_base ::
+    CUChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+hs_bindgen_b642c5b44d663af5 :: CUChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+hs_bindgen_b642c5b44d663af5 = \x_0 -> fmap fromFFIType (hs_bindgen_b642c5b44d663af5_base (toFFIType x_0))
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_unsafe :: CUChar -> IO CInt
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_unsafe = hs_bindgen_b642c5b44d663af5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+foreign import ccall unsafe "hs_bindgen_27f5c806bf4593e7" hs_bindgen_27f5c806bf4593e7_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+hs_bindgen_27f5c806bf4593e7 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+hs_bindgen_27f5c806bf4593e7 = \x_0 -> fmap fromFFIType (hs_bindgen_27f5c806bf4593e7_base (toFFIType x_0))
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_unsafe :: CShort -> IO CInt
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_unsafe = hs_bindgen_27f5c806bf4593e7
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+foreign import ccall unsafe "hs_bindgen_e8c0eab09a235501" hs_bindgen_e8c0eab09a235501_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+hs_bindgen_e8c0eab09a235501 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+hs_bindgen_e8c0eab09a235501 = \x_0 -> fmap fromFFIType (hs_bindgen_e8c0eab09a235501_base (toFFIType x_0))
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_unsafe :: CShort -> IO CInt
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_unsafe = hs_bindgen_e8c0eab09a235501
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+foreign import ccall unsafe "hs_bindgen_7925bdb53e040792" hs_bindgen_7925bdb53e040792_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+hs_bindgen_7925bdb53e040792 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+hs_bindgen_7925bdb53e040792 = \x_0 -> fmap fromFFIType (hs_bindgen_7925bdb53e040792_base (toFFIType x_0))
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_unsafe :: CShort -> IO CInt
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_unsafe = hs_bindgen_7925bdb53e040792
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+foreign import ccall unsafe "hs_bindgen_e6eb4efed37c1708" hs_bindgen_e6eb4efed37c1708_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+hs_bindgen_e6eb4efed37c1708 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+hs_bindgen_e6eb4efed37c1708 = \x_0 -> fmap fromFFIType (hs_bindgen_e6eb4efed37c1708_base (toFFIType x_0))
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_unsafe :: CShort -> IO CInt
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_unsafe = hs_bindgen_e6eb4efed37c1708
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+foreign import ccall unsafe "hs_bindgen_21cc8ace7d7441bd" hs_bindgen_21cc8ace7d7441bd_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+hs_bindgen_21cc8ace7d7441bd :: CUShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+hs_bindgen_21cc8ace7d7441bd = \x_0 -> fmap fromFFIType (hs_bindgen_21cc8ace7d7441bd_base (toFFIType x_0))
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_unsafe :: CUShort -> IO CInt
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_unsafe = hs_bindgen_21cc8ace7d7441bd
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+foreign import ccall unsafe "hs_bindgen_ddca0323ddaaee35" hs_bindgen_ddca0323ddaaee35_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+hs_bindgen_ddca0323ddaaee35 :: CUShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+hs_bindgen_ddca0323ddaaee35 = \x_0 -> fmap fromFFIType (hs_bindgen_ddca0323ddaaee35_base (toFFIType x_0))
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_unsafe :: CUShort -> IO CInt
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_unsafe = hs_bindgen_ddca0323ddaaee35
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+foreign import ccall unsafe "hs_bindgen_d42a7635d5a1a314" hs_bindgen_d42a7635d5a1a314_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+hs_bindgen_d42a7635d5a1a314 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+hs_bindgen_d42a7635d5a1a314 = \x_0 -> fmap fromFFIType (hs_bindgen_d42a7635d5a1a314_base (toFFIType x_0))
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_unsafe = hs_bindgen_d42a7635d5a1a314
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+foreign import ccall unsafe "hs_bindgen_111c67845229b054" hs_bindgen_111c67845229b054_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+hs_bindgen_111c67845229b054 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+hs_bindgen_111c67845229b054 = \x_0 -> fmap fromFFIType (hs_bindgen_111c67845229b054_base (toFFIType x_0))
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_unsafe = hs_bindgen_111c67845229b054
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+foreign import ccall unsafe "hs_bindgen_6c05305fb77f1073" hs_bindgen_6c05305fb77f1073_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+hs_bindgen_6c05305fb77f1073 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+hs_bindgen_6c05305fb77f1073 = \x_0 -> fmap fromFFIType (hs_bindgen_6c05305fb77f1073_base (toFFIType x_0))
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_unsafe = hs_bindgen_6c05305fb77f1073
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+foreign import ccall unsafe "hs_bindgen_661a8e9409698789" hs_bindgen_661a8e9409698789_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+hs_bindgen_661a8e9409698789 :: CUInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+hs_bindgen_661a8e9409698789 = \x_0 -> fmap fromFFIType (hs_bindgen_661a8e9409698789_base (toFFIType x_0))
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_unsafe :: CUInt -> IO CInt
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_unsafe = hs_bindgen_661a8e9409698789
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+foreign import ccall unsafe "hs_bindgen_3bdf905c84cb8fb9" hs_bindgen_3bdf905c84cb8fb9_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+hs_bindgen_3bdf905c84cb8fb9 :: CUInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+hs_bindgen_3bdf905c84cb8fb9 = \x_0 -> fmap fromFFIType (hs_bindgen_3bdf905c84cb8fb9_base (toFFIType x_0))
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_unsafe :: CUInt -> IO CInt
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_unsafe = hs_bindgen_3bdf905c84cb8fb9
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+foreign import ccall unsafe "hs_bindgen_212883c913884d27" hs_bindgen_212883c913884d27_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+hs_bindgen_212883c913884d27 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+hs_bindgen_212883c913884d27 = \x_0 -> fmap fromFFIType (hs_bindgen_212883c913884d27_base (toFFIType x_0))
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_unsafe :: CLong -> IO CInt
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_unsafe = hs_bindgen_212883c913884d27
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+foreign import ccall unsafe "hs_bindgen_f72cafc33ec81360" hs_bindgen_f72cafc33ec81360_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+hs_bindgen_f72cafc33ec81360 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+hs_bindgen_f72cafc33ec81360 = \x_0 -> fmap fromFFIType (hs_bindgen_f72cafc33ec81360_base (toFFIType x_0))
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_unsafe :: CLong -> IO CInt
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_unsafe = hs_bindgen_f72cafc33ec81360
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+foreign import ccall unsafe "hs_bindgen_ea5f62444673cf16" hs_bindgen_ea5f62444673cf16_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+hs_bindgen_ea5f62444673cf16 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+hs_bindgen_ea5f62444673cf16 = \x_0 -> fmap fromFFIType (hs_bindgen_ea5f62444673cf16_base (toFFIType x_0))
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_unsafe :: CLong -> IO CInt
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_unsafe = hs_bindgen_ea5f62444673cf16
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+foreign import ccall unsafe "hs_bindgen_9f4e020f892b30cb" hs_bindgen_9f4e020f892b30cb_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+hs_bindgen_9f4e020f892b30cb :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+hs_bindgen_9f4e020f892b30cb = \x_0 -> fmap fromFFIType (hs_bindgen_9f4e020f892b30cb_base (toFFIType x_0))
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_unsafe :: CLong -> IO CInt
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_unsafe = hs_bindgen_9f4e020f892b30cb
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+foreign import ccall unsafe "hs_bindgen_47f005495bf88291" hs_bindgen_47f005495bf88291_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+hs_bindgen_47f005495bf88291 :: CULong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+hs_bindgen_47f005495bf88291 = \x_0 -> fmap fromFFIType (hs_bindgen_47f005495bf88291_base (toFFIType x_0))
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_unsafe :: CULong -> IO CInt
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_unsafe = hs_bindgen_47f005495bf88291
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+foreign import ccall unsafe "hs_bindgen_d02703a7ce8fade2" hs_bindgen_d02703a7ce8fade2_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+hs_bindgen_d02703a7ce8fade2 :: CULong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+hs_bindgen_d02703a7ce8fade2 = \x_0 -> fmap fromFFIType (hs_bindgen_d02703a7ce8fade2_base (toFFIType x_0))
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_unsafe :: CULong -> IO CInt
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_unsafe = hs_bindgen_d02703a7ce8fade2
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+foreign import ccall unsafe "hs_bindgen_9f98e2aafc8c5a95" hs_bindgen_9f98e2aafc8c5a95_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+hs_bindgen_9f98e2aafc8c5a95 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+hs_bindgen_9f98e2aafc8c5a95 = \x_0 -> fmap fromFFIType (hs_bindgen_9f98e2aafc8c5a95_base (toFFIType x_0))
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_unsafe :: CLLong -> IO CInt
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_unsafe = hs_bindgen_9f98e2aafc8c5a95
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+foreign import ccall unsafe "hs_bindgen_430da5f47172739a" hs_bindgen_430da5f47172739a_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+hs_bindgen_430da5f47172739a :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+hs_bindgen_430da5f47172739a = \x_0 -> fmap fromFFIType (hs_bindgen_430da5f47172739a_base (toFFIType x_0))
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_unsafe :: CLLong -> IO CInt
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_unsafe = hs_bindgen_430da5f47172739a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+foreign import ccall unsafe "hs_bindgen_bd83aa03a61a8a06" hs_bindgen_bd83aa03a61a8a06_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+hs_bindgen_bd83aa03a61a8a06 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+hs_bindgen_bd83aa03a61a8a06 = \x_0 -> fmap fromFFIType (hs_bindgen_bd83aa03a61a8a06_base (toFFIType x_0))
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_unsafe :: CLLong -> IO CInt
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_unsafe = hs_bindgen_bd83aa03a61a8a06
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+foreign import ccall unsafe "hs_bindgen_affcee7ffeebbac9" hs_bindgen_affcee7ffeebbac9_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+hs_bindgen_affcee7ffeebbac9 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+hs_bindgen_affcee7ffeebbac9 = \x_0 -> fmap fromFFIType (hs_bindgen_affcee7ffeebbac9_base (toFFIType x_0))
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_unsafe :: CLLong -> IO CInt
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_unsafe = hs_bindgen_affcee7ffeebbac9
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+foreign import ccall unsafe "hs_bindgen_b8a7fb0f9add23ab" hs_bindgen_b8a7fb0f9add23ab_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+hs_bindgen_b8a7fb0f9add23ab :: CULLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+hs_bindgen_b8a7fb0f9add23ab = \x_0 -> fmap fromFFIType (hs_bindgen_b8a7fb0f9add23ab_base (toFFIType x_0))
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_unsafe :: CULLong -> IO CInt
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_unsafe = hs_bindgen_b8a7fb0f9add23ab
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+foreign import ccall unsafe "hs_bindgen_377c3e6bd5b69285" hs_bindgen_377c3e6bd5b69285_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+hs_bindgen_377c3e6bd5b69285 :: CULLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+hs_bindgen_377c3e6bd5b69285 = \x_0 -> fmap fromFFIType (hs_bindgen_377c3e6bd5b69285_base (toFFIType x_0))
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_unsafe :: CULLong -> IO CInt
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_unsafe = hs_bindgen_377c3e6bd5b69285
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+foreign import ccall unsafe "hs_bindgen_b82bda1eaf8b02ba" hs_bindgen_b82bda1eaf8b02ba_base ::
+    CFloat
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+hs_bindgen_b82bda1eaf8b02ba :: CFloat -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+hs_bindgen_b82bda1eaf8b02ba = \x_0 -> fmap fromFFIType (hs_bindgen_b82bda1eaf8b02ba_base (toFFIType x_0))
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_unsafe :: CFloat -> IO CInt
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_unsafe = hs_bindgen_b82bda1eaf8b02ba
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+foreign import ccall unsafe "hs_bindgen_8d36f32587832dae" hs_bindgen_8d36f32587832dae_base ::
+    CDouble
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+hs_bindgen_8d36f32587832dae :: CDouble -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+hs_bindgen_8d36f32587832dae = \x_0 -> fmap fromFFIType (hs_bindgen_8d36f32587832dae_base (toFFIType x_0))
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_unsafe :: CDouble -> IO CInt
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_unsafe = hs_bindgen_8d36f32587832dae
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_1208d85624465c51" hs_bindgen_1208d85624465c51_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+hs_bindgen_1208d85624465c51 :: IO (FunPtr (CChar -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+hs_bindgen_1208d85624465c51 = fmap fromFFIType hs_bindgen_1208d85624465c51_base
+{-# NOINLINE f1_funptr #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_funptr :: FunPtr (CChar -> IO CInt)
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_funptr = unsafePerformIO hs_bindgen_1208d85624465c51
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_90bf738ed6e126cf" hs_bindgen_90bf738ed6e126cf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+hs_bindgen_90bf738ed6e126cf :: IO (FunPtr (CSChar -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+hs_bindgen_90bf738ed6e126cf = fmap fromFFIType hs_bindgen_90bf738ed6e126cf_base
+{-# NOINLINE f2_funptr #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_funptr :: FunPtr (CSChar -> IO CInt)
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_funptr = unsafePerformIO hs_bindgen_90bf738ed6e126cf
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_541fb107a8c068d0" hs_bindgen_541fb107a8c068d0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+hs_bindgen_541fb107a8c068d0 :: IO (FunPtr (CUChar -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+hs_bindgen_541fb107a8c068d0 = fmap fromFFIType hs_bindgen_541fb107a8c068d0_base
+{-# NOINLINE f3_funptr #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_funptr :: FunPtr (CUChar -> IO CInt)
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_funptr = unsafePerformIO hs_bindgen_541fb107a8c068d0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+foreign import ccall unsafe "hs_bindgen_695a21f5c624ca64" hs_bindgen_695a21f5c624ca64_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+hs_bindgen_695a21f5c624ca64 :: IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+hs_bindgen_695a21f5c624ca64 = fmap fromFFIType hs_bindgen_695a21f5c624ca64_base
+{-# NOINLINE f4_funptr #-}
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_funptr :: FunPtr (CShort -> IO CInt)
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_funptr = unsafePerformIO hs_bindgen_695a21f5c624ca64
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+foreign import ccall unsafe "hs_bindgen_43491bdffe43bbe1" hs_bindgen_43491bdffe43bbe1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+hs_bindgen_43491bdffe43bbe1 :: IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+hs_bindgen_43491bdffe43bbe1 = fmap fromFFIType hs_bindgen_43491bdffe43bbe1_base
+{-# NOINLINE f5_funptr #-}
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_funptr :: FunPtr (CShort -> IO CInt)
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_funptr = unsafePerformIO hs_bindgen_43491bdffe43bbe1
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+foreign import ccall unsafe "hs_bindgen_ffafdd943146661a" hs_bindgen_ffafdd943146661a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+hs_bindgen_ffafdd943146661a :: IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+hs_bindgen_ffafdd943146661a = fmap fromFFIType hs_bindgen_ffafdd943146661a_base
+{-# NOINLINE f6_funptr #-}
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_funptr :: FunPtr (CShort -> IO CInt)
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_funptr = unsafePerformIO hs_bindgen_ffafdd943146661a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+foreign import ccall unsafe "hs_bindgen_7c6250122a3c59a3" hs_bindgen_7c6250122a3c59a3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+hs_bindgen_7c6250122a3c59a3 :: IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+hs_bindgen_7c6250122a3c59a3 = fmap fromFFIType hs_bindgen_7c6250122a3c59a3_base
+{-# NOINLINE f7_funptr #-}
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_funptr :: FunPtr (CShort -> IO CInt)
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_funptr = unsafePerformIO hs_bindgen_7c6250122a3c59a3
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+foreign import ccall unsafe "hs_bindgen_60cbc6e072d14643" hs_bindgen_60cbc6e072d14643_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+hs_bindgen_60cbc6e072d14643 :: IO (FunPtr (CUShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+hs_bindgen_60cbc6e072d14643 = fmap fromFFIType hs_bindgen_60cbc6e072d14643_base
+{-# NOINLINE f8_funptr #-}
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_funptr :: FunPtr (CUShort -> IO CInt)
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_funptr = unsafePerformIO hs_bindgen_60cbc6e072d14643
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+foreign import ccall unsafe "hs_bindgen_fa356fa03c563829" hs_bindgen_fa356fa03c563829_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+hs_bindgen_fa356fa03c563829 :: IO (FunPtr (CUShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+hs_bindgen_fa356fa03c563829 = fmap fromFFIType hs_bindgen_fa356fa03c563829_base
+{-# NOINLINE f9_funptr #-}
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_funptr :: FunPtr (CUShort -> IO CInt)
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_funptr = unsafePerformIO hs_bindgen_fa356fa03c563829
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+foreign import ccall unsafe "hs_bindgen_6971f14ec2033453" hs_bindgen_6971f14ec2033453_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+hs_bindgen_6971f14ec2033453 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+hs_bindgen_6971f14ec2033453 = fmap fromFFIType hs_bindgen_6971f14ec2033453_base
+{-# NOINLINE f10_funptr #-}
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_funptr = unsafePerformIO hs_bindgen_6971f14ec2033453
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+foreign import ccall unsafe "hs_bindgen_18e46ae0dfd9dbe0" hs_bindgen_18e46ae0dfd9dbe0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+hs_bindgen_18e46ae0dfd9dbe0 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+hs_bindgen_18e46ae0dfd9dbe0 = fmap fromFFIType hs_bindgen_18e46ae0dfd9dbe0_base
+{-# NOINLINE f11_funptr #-}
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_funptr = unsafePerformIO hs_bindgen_18e46ae0dfd9dbe0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+foreign import ccall unsafe "hs_bindgen_0c1c36784fe71810" hs_bindgen_0c1c36784fe71810_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+hs_bindgen_0c1c36784fe71810 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+hs_bindgen_0c1c36784fe71810 = fmap fromFFIType hs_bindgen_0c1c36784fe71810_base
+{-# NOINLINE f12_funptr #-}
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_funptr = unsafePerformIO hs_bindgen_0c1c36784fe71810
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+foreign import ccall unsafe "hs_bindgen_8d9bec0d1944b558" hs_bindgen_8d9bec0d1944b558_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+hs_bindgen_8d9bec0d1944b558 :: IO (FunPtr (CUInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+hs_bindgen_8d9bec0d1944b558 = fmap fromFFIType hs_bindgen_8d9bec0d1944b558_base
+{-# NOINLINE f13_funptr #-}
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_funptr :: FunPtr (CUInt -> IO CInt)
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_funptr = unsafePerformIO hs_bindgen_8d9bec0d1944b558
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+foreign import ccall unsafe "hs_bindgen_796f92f5831916a6" hs_bindgen_796f92f5831916a6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+hs_bindgen_796f92f5831916a6 :: IO (FunPtr (CUInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+hs_bindgen_796f92f5831916a6 = fmap fromFFIType hs_bindgen_796f92f5831916a6_base
+{-# NOINLINE f14_funptr #-}
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_funptr :: FunPtr (CUInt -> IO CInt)
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_funptr = unsafePerformIO hs_bindgen_796f92f5831916a6
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+foreign import ccall unsafe "hs_bindgen_2cb6292b4cc8f420" hs_bindgen_2cb6292b4cc8f420_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+hs_bindgen_2cb6292b4cc8f420 :: IO (FunPtr (CLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+hs_bindgen_2cb6292b4cc8f420 = fmap fromFFIType hs_bindgen_2cb6292b4cc8f420_base
+{-# NOINLINE f15_funptr #-}
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_funptr :: FunPtr (CLong -> IO CInt)
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_funptr = unsafePerformIO hs_bindgen_2cb6292b4cc8f420
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+foreign import ccall unsafe "hs_bindgen_b7dd3e78d24cd30c" hs_bindgen_b7dd3e78d24cd30c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+hs_bindgen_b7dd3e78d24cd30c :: IO (FunPtr (CLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+hs_bindgen_b7dd3e78d24cd30c = fmap fromFFIType hs_bindgen_b7dd3e78d24cd30c_base
+{-# NOINLINE f16_funptr #-}
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_funptr :: FunPtr (CLong -> IO CInt)
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_funptr = unsafePerformIO hs_bindgen_b7dd3e78d24cd30c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+foreign import ccall unsafe "hs_bindgen_894ff9aa74f040d9" hs_bindgen_894ff9aa74f040d9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+hs_bindgen_894ff9aa74f040d9 :: IO (FunPtr (CLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+hs_bindgen_894ff9aa74f040d9 = fmap fromFFIType hs_bindgen_894ff9aa74f040d9_base
+{-# NOINLINE f17_funptr #-}
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_funptr :: FunPtr (CLong -> IO CInt)
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_funptr = unsafePerformIO hs_bindgen_894ff9aa74f040d9
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+foreign import ccall unsafe "hs_bindgen_57359ef6c14eb820" hs_bindgen_57359ef6c14eb820_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+hs_bindgen_57359ef6c14eb820 :: IO (FunPtr (CLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+hs_bindgen_57359ef6c14eb820 = fmap fromFFIType hs_bindgen_57359ef6c14eb820_base
+{-# NOINLINE f18_funptr #-}
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_funptr :: FunPtr (CLong -> IO CInt)
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_funptr = unsafePerformIO hs_bindgen_57359ef6c14eb820
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+foreign import ccall unsafe "hs_bindgen_2173cee7470d34a4" hs_bindgen_2173cee7470d34a4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+hs_bindgen_2173cee7470d34a4 :: IO (FunPtr (CULong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+hs_bindgen_2173cee7470d34a4 = fmap fromFFIType hs_bindgen_2173cee7470d34a4_base
+{-# NOINLINE f19_funptr #-}
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_funptr :: FunPtr (CULong -> IO CInt)
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_funptr = unsafePerformIO hs_bindgen_2173cee7470d34a4
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+foreign import ccall unsafe "hs_bindgen_85dc99217461b608" hs_bindgen_85dc99217461b608_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+hs_bindgen_85dc99217461b608 :: IO (FunPtr (CULong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+hs_bindgen_85dc99217461b608 = fmap fromFFIType hs_bindgen_85dc99217461b608_base
+{-# NOINLINE f20_funptr #-}
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_funptr :: FunPtr (CULong -> IO CInt)
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_funptr = unsafePerformIO hs_bindgen_85dc99217461b608
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+foreign import ccall unsafe "hs_bindgen_350486e538e7ca90" hs_bindgen_350486e538e7ca90_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+hs_bindgen_350486e538e7ca90 :: IO (FunPtr (CLLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+hs_bindgen_350486e538e7ca90 = fmap fromFFIType hs_bindgen_350486e538e7ca90_base
+{-# NOINLINE f21_funptr #-}
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_funptr :: FunPtr (CLLong -> IO CInt)
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_funptr = unsafePerformIO hs_bindgen_350486e538e7ca90
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+foreign import ccall unsafe "hs_bindgen_ad2c8dc646b29be0" hs_bindgen_ad2c8dc646b29be0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+hs_bindgen_ad2c8dc646b29be0 :: IO (FunPtr (CLLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+hs_bindgen_ad2c8dc646b29be0 = fmap fromFFIType hs_bindgen_ad2c8dc646b29be0_base
+{-# NOINLINE f22_funptr #-}
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_funptr :: FunPtr (CLLong -> IO CInt)
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_funptr = unsafePerformIO hs_bindgen_ad2c8dc646b29be0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+foreign import ccall unsafe "hs_bindgen_01837bab50ebbe4c" hs_bindgen_01837bab50ebbe4c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+hs_bindgen_01837bab50ebbe4c :: IO (FunPtr (CLLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+hs_bindgen_01837bab50ebbe4c = fmap fromFFIType hs_bindgen_01837bab50ebbe4c_base
+{-# NOINLINE f23_funptr #-}
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_funptr :: FunPtr (CLLong -> IO CInt)
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_funptr = unsafePerformIO hs_bindgen_01837bab50ebbe4c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+foreign import ccall unsafe "hs_bindgen_051d17dfd1125c86" hs_bindgen_051d17dfd1125c86_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+hs_bindgen_051d17dfd1125c86 :: IO (FunPtr (CLLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+hs_bindgen_051d17dfd1125c86 = fmap fromFFIType hs_bindgen_051d17dfd1125c86_base
+{-# NOINLINE f24_funptr #-}
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_funptr :: FunPtr (CLLong -> IO CInt)
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_funptr = unsafePerformIO hs_bindgen_051d17dfd1125c86
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+foreign import ccall unsafe "hs_bindgen_ba5dd3a36d6f2756" hs_bindgen_ba5dd3a36d6f2756_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+hs_bindgen_ba5dd3a36d6f2756 :: IO (FunPtr (CULLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+hs_bindgen_ba5dd3a36d6f2756 = fmap fromFFIType hs_bindgen_ba5dd3a36d6f2756_base
+{-# NOINLINE f25_funptr #-}
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_funptr :: FunPtr (CULLong -> IO CInt)
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_funptr = unsafePerformIO hs_bindgen_ba5dd3a36d6f2756
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+foreign import ccall unsafe "hs_bindgen_22f3b97563fd757f" hs_bindgen_22f3b97563fd757f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+hs_bindgen_22f3b97563fd757f :: IO (FunPtr (CULLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+hs_bindgen_22f3b97563fd757f = fmap fromFFIType hs_bindgen_22f3b97563fd757f_base
+{-# NOINLINE f26_funptr #-}
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_funptr :: FunPtr (CULLong -> IO CInt)
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_funptr = unsafePerformIO hs_bindgen_22f3b97563fd757f
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+foreign import ccall unsafe "hs_bindgen_fc81895dfae9b1e5" hs_bindgen_fc81895dfae9b1e5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+hs_bindgen_fc81895dfae9b1e5 :: IO (FunPtr (CFloat -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+hs_bindgen_fc81895dfae9b1e5 = fmap fromFFIType hs_bindgen_fc81895dfae9b1e5_base
+{-# NOINLINE f27_funptr #-}
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_funptr :: FunPtr (CFloat -> IO CInt)
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_funptr = unsafePerformIO hs_bindgen_fc81895dfae9b1e5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+foreign import ccall unsafe "hs_bindgen_f95062f509265011" hs_bindgen_f95062f509265011_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+hs_bindgen_f95062f509265011 :: IO (FunPtr (CDouble -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+hs_bindgen_f95062f509265011 = fmap fromFFIType hs_bindgen_f95062f509265011_base
+{-# NOINLINE f28_funptr #-}
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_funptr :: FunPtr (CDouble -> IO CInt)
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_funptr = unsafePerformIO hs_bindgen_f95062f509265011
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.a
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 16:9@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+a :: Macro.Raw String
+a = Macro.objectLike "A" ["int"]
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example/FunPtr.hs
@@ -0,0 +1,800 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f1
+    , Example.FunPtr.f2
+    , Example.FunPtr.f3
+    , Example.FunPtr.f4
+    , Example.FunPtr.f5
+    , Example.FunPtr.f6
+    , Example.FunPtr.f7
+    , Example.FunPtr.f8
+    , Example.FunPtr.f9
+    , Example.FunPtr.f10
+    , Example.FunPtr.f11
+    , Example.FunPtr.f12
+    , Example.FunPtr.f13
+    , Example.FunPtr.f14
+    , Example.FunPtr.f15
+    , Example.FunPtr.f16
+    , Example.FunPtr.f17
+    , Example.FunPtr.f18
+    , Example.FunPtr.f19
+    , Example.FunPtr.f20
+    , Example.FunPtr.f21
+    , Example.FunPtr.f22
+    , Example.FunPtr.f23
+    , Example.FunPtr.f24
+    , Example.FunPtr.f25
+    , Example.FunPtr.f26
+    , Example.FunPtr.f27
+    , Example.FunPtr.f28
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/arithmetic_types.h>"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_1208d85624465c51 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &f1;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f2 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_90bf738ed6e126cf (void)) ("
+  , "  signed char arg1"
+  , ")"
+  , "{"
+  , "  return &f2;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f3 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_541fb107a8c068d0 (void)) ("
+  , "  unsigned char arg1"
+  , ")"
+  , "{"
+  , "  return &f3;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f4 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_695a21f5c624ca64 (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f4;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f5 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_43491bdffe43bbe1 (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f5;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f6 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ffafdd943146661a (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f6;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f7 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_7c6250122a3c59a3 (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f7;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f8 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_60cbc6e072d14643 (void)) ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return &f8;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f9 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_fa356fa03c563829 (void)) ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return &f9;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f10 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_6971f14ec2033453 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f10;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f11 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_18e46ae0dfd9dbe0 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f11;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f12 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_0c1c36784fe71810 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f12;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f13 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_8d9bec0d1944b558 (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &f13;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f14 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_796f92f5831916a6 (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &f14;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f15 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2cb6292b4cc8f420 (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f15;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f16 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_b7dd3e78d24cd30c (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f16;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f17 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_894ff9aa74f040d9 (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f17;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f18 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_57359ef6c14eb820 (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f18;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f19 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2173cee7470d34a4 (void)) ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return &f19;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f20 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_85dc99217461b608 (void)) ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return &f20;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f21 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_350486e538e7ca90 (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f21;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f22 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ad2c8dc646b29be0 (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f22;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f23 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_01837bab50ebbe4c (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f23;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f24 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_051d17dfd1125c86 (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f24;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f25 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ba5dd3a36d6f2756 (void)) ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return &f25;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f26 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_22f3b97563fd757f (void)) ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return &f26;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f27 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_fc81895dfae9b1e5 (void)) ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return &f27;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f28 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_f95062f509265011 (void)) ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return &f28;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_1208d85624465c51" hs_bindgen_1208d85624465c51_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+hs_bindgen_1208d85624465c51 :: IO (BG.FunPtr (BG.CChar -> IO BG.CInt))
+hs_bindgen_1208d85624465c51 =
+  fmap BG.fromFFIType hs_bindgen_1208d85624465c51_base
+
+{-# NOINLINE f1 #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1 :: BG.FunPtr (BG.CChar -> IO BG.CInt)
+f1 = BG.unsafePerformIO hs_bindgen_1208d85624465c51
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_90bf738ed6e126cf" hs_bindgen_90bf738ed6e126cf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+hs_bindgen_90bf738ed6e126cf :: IO (BG.FunPtr (BG.CSChar -> IO BG.CInt))
+hs_bindgen_90bf738ed6e126cf =
+  fmap BG.fromFFIType hs_bindgen_90bf738ed6e126cf_base
+
+{-# NOINLINE f2 #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2 :: BG.FunPtr (BG.CSChar -> IO BG.CInt)
+f2 = BG.unsafePerformIO hs_bindgen_90bf738ed6e126cf
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_541fb107a8c068d0" hs_bindgen_541fb107a8c068d0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+hs_bindgen_541fb107a8c068d0 :: IO (BG.FunPtr (BG.CUChar -> IO BG.CInt))
+hs_bindgen_541fb107a8c068d0 =
+  fmap BG.fromFFIType hs_bindgen_541fb107a8c068d0_base
+
+{-# NOINLINE f3 #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3 :: BG.FunPtr (BG.CUChar -> IO BG.CInt)
+f3 = BG.unsafePerformIO hs_bindgen_541fb107a8c068d0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+foreign import ccall unsafe "hs_bindgen_695a21f5c624ca64" hs_bindgen_695a21f5c624ca64_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+hs_bindgen_695a21f5c624ca64 :: IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_695a21f5c624ca64 =
+  fmap BG.fromFFIType hs_bindgen_695a21f5c624ca64_base
+
+{-# NOINLINE f4 #-}
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4 :: BG.FunPtr (BG.CShort -> IO BG.CInt)
+f4 = BG.unsafePerformIO hs_bindgen_695a21f5c624ca64
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+foreign import ccall unsafe "hs_bindgen_43491bdffe43bbe1" hs_bindgen_43491bdffe43bbe1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+hs_bindgen_43491bdffe43bbe1 :: IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_43491bdffe43bbe1 =
+  fmap BG.fromFFIType hs_bindgen_43491bdffe43bbe1_base
+
+{-# NOINLINE f5 #-}
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5 :: BG.FunPtr (BG.CShort -> IO BG.CInt)
+f5 = BG.unsafePerformIO hs_bindgen_43491bdffe43bbe1
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+foreign import ccall unsafe "hs_bindgen_ffafdd943146661a" hs_bindgen_ffafdd943146661a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+hs_bindgen_ffafdd943146661a :: IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_ffafdd943146661a =
+  fmap BG.fromFFIType hs_bindgen_ffafdd943146661a_base
+
+{-# NOINLINE f6 #-}
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6 :: BG.FunPtr (BG.CShort -> IO BG.CInt)
+f6 = BG.unsafePerformIO hs_bindgen_ffafdd943146661a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+foreign import ccall unsafe "hs_bindgen_7c6250122a3c59a3" hs_bindgen_7c6250122a3c59a3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+hs_bindgen_7c6250122a3c59a3 :: IO (BG.FunPtr (BG.CShort -> IO BG.CInt))
+hs_bindgen_7c6250122a3c59a3 =
+  fmap BG.fromFFIType hs_bindgen_7c6250122a3c59a3_base
+
+{-# NOINLINE f7 #-}
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7 :: BG.FunPtr (BG.CShort -> IO BG.CInt)
+f7 = BG.unsafePerformIO hs_bindgen_7c6250122a3c59a3
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+foreign import ccall unsafe "hs_bindgen_60cbc6e072d14643" hs_bindgen_60cbc6e072d14643_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+hs_bindgen_60cbc6e072d14643 :: IO (BG.FunPtr (BG.CUShort -> IO BG.CInt))
+hs_bindgen_60cbc6e072d14643 =
+  fmap BG.fromFFIType hs_bindgen_60cbc6e072d14643_base
+
+{-# NOINLINE f8 #-}
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8 :: BG.FunPtr (BG.CUShort -> IO BG.CInt)
+f8 = BG.unsafePerformIO hs_bindgen_60cbc6e072d14643
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+foreign import ccall unsafe "hs_bindgen_fa356fa03c563829" hs_bindgen_fa356fa03c563829_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+hs_bindgen_fa356fa03c563829 :: IO (BG.FunPtr (BG.CUShort -> IO BG.CInt))
+hs_bindgen_fa356fa03c563829 =
+  fmap BG.fromFFIType hs_bindgen_fa356fa03c563829_base
+
+{-# NOINLINE f9 #-}
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9 :: BG.FunPtr (BG.CUShort -> IO BG.CInt)
+f9 = BG.unsafePerformIO hs_bindgen_fa356fa03c563829
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+foreign import ccall unsafe "hs_bindgen_6971f14ec2033453" hs_bindgen_6971f14ec2033453_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+hs_bindgen_6971f14ec2033453 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_6971f14ec2033453 =
+  fmap BG.fromFFIType hs_bindgen_6971f14ec2033453_base
+
+{-# NOINLINE f10 #-}
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+f10 = BG.unsafePerformIO hs_bindgen_6971f14ec2033453
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+foreign import ccall unsafe "hs_bindgen_18e46ae0dfd9dbe0" hs_bindgen_18e46ae0dfd9dbe0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+hs_bindgen_18e46ae0dfd9dbe0 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_18e46ae0dfd9dbe0 =
+  fmap BG.fromFFIType hs_bindgen_18e46ae0dfd9dbe0_base
+
+{-# NOINLINE f11 #-}
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+f11 = BG.unsafePerformIO hs_bindgen_18e46ae0dfd9dbe0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+foreign import ccall unsafe "hs_bindgen_0c1c36784fe71810" hs_bindgen_0c1c36784fe71810_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+hs_bindgen_0c1c36784fe71810 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_0c1c36784fe71810 =
+  fmap BG.fromFFIType hs_bindgen_0c1c36784fe71810_base
+
+{-# NOINLINE f12 #-}
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12 :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+f12 = BG.unsafePerformIO hs_bindgen_0c1c36784fe71810
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+foreign import ccall unsafe "hs_bindgen_8d9bec0d1944b558" hs_bindgen_8d9bec0d1944b558_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+hs_bindgen_8d9bec0d1944b558 :: IO (BG.FunPtr (BG.CUInt -> IO BG.CInt))
+hs_bindgen_8d9bec0d1944b558 =
+  fmap BG.fromFFIType hs_bindgen_8d9bec0d1944b558_base
+
+{-# NOINLINE f13 #-}
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13 :: BG.FunPtr (BG.CUInt -> IO BG.CInt)
+f13 = BG.unsafePerformIO hs_bindgen_8d9bec0d1944b558
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+foreign import ccall unsafe "hs_bindgen_796f92f5831916a6" hs_bindgen_796f92f5831916a6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+hs_bindgen_796f92f5831916a6 :: IO (BG.FunPtr (BG.CUInt -> IO BG.CInt))
+hs_bindgen_796f92f5831916a6 =
+  fmap BG.fromFFIType hs_bindgen_796f92f5831916a6_base
+
+{-# NOINLINE f14 #-}
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14 :: BG.FunPtr (BG.CUInt -> IO BG.CInt)
+f14 = BG.unsafePerformIO hs_bindgen_796f92f5831916a6
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+foreign import ccall unsafe "hs_bindgen_2cb6292b4cc8f420" hs_bindgen_2cb6292b4cc8f420_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+hs_bindgen_2cb6292b4cc8f420 :: IO (BG.FunPtr (BG.CLong -> IO BG.CInt))
+hs_bindgen_2cb6292b4cc8f420 =
+  fmap BG.fromFFIType hs_bindgen_2cb6292b4cc8f420_base
+
+{-# NOINLINE f15 #-}
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15 :: BG.FunPtr (BG.CLong -> IO BG.CInt)
+f15 = BG.unsafePerformIO hs_bindgen_2cb6292b4cc8f420
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+foreign import ccall unsafe "hs_bindgen_b7dd3e78d24cd30c" hs_bindgen_b7dd3e78d24cd30c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+hs_bindgen_b7dd3e78d24cd30c :: IO (BG.FunPtr (BG.CLong -> IO BG.CInt))
+hs_bindgen_b7dd3e78d24cd30c =
+  fmap BG.fromFFIType hs_bindgen_b7dd3e78d24cd30c_base
+
+{-# NOINLINE f16 #-}
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16 :: BG.FunPtr (BG.CLong -> IO BG.CInt)
+f16 = BG.unsafePerformIO hs_bindgen_b7dd3e78d24cd30c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+foreign import ccall unsafe "hs_bindgen_894ff9aa74f040d9" hs_bindgen_894ff9aa74f040d9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+hs_bindgen_894ff9aa74f040d9 :: IO (BG.FunPtr (BG.CLong -> IO BG.CInt))
+hs_bindgen_894ff9aa74f040d9 =
+  fmap BG.fromFFIType hs_bindgen_894ff9aa74f040d9_base
+
+{-# NOINLINE f17 #-}
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17 :: BG.FunPtr (BG.CLong -> IO BG.CInt)
+f17 = BG.unsafePerformIO hs_bindgen_894ff9aa74f040d9
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+foreign import ccall unsafe "hs_bindgen_57359ef6c14eb820" hs_bindgen_57359ef6c14eb820_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+hs_bindgen_57359ef6c14eb820 :: IO (BG.FunPtr (BG.CLong -> IO BG.CInt))
+hs_bindgen_57359ef6c14eb820 =
+  fmap BG.fromFFIType hs_bindgen_57359ef6c14eb820_base
+
+{-# NOINLINE f18 #-}
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18 :: BG.FunPtr (BG.CLong -> IO BG.CInt)
+f18 = BG.unsafePerformIO hs_bindgen_57359ef6c14eb820
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+foreign import ccall unsafe "hs_bindgen_2173cee7470d34a4" hs_bindgen_2173cee7470d34a4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+hs_bindgen_2173cee7470d34a4 :: IO (BG.FunPtr (BG.CULong -> IO BG.CInt))
+hs_bindgen_2173cee7470d34a4 =
+  fmap BG.fromFFIType hs_bindgen_2173cee7470d34a4_base
+
+{-# NOINLINE f19 #-}
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19 :: BG.FunPtr (BG.CULong -> IO BG.CInt)
+f19 = BG.unsafePerformIO hs_bindgen_2173cee7470d34a4
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+foreign import ccall unsafe "hs_bindgen_85dc99217461b608" hs_bindgen_85dc99217461b608_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+hs_bindgen_85dc99217461b608 :: IO (BG.FunPtr (BG.CULong -> IO BG.CInt))
+hs_bindgen_85dc99217461b608 =
+  fmap BG.fromFFIType hs_bindgen_85dc99217461b608_base
+
+{-# NOINLINE f20 #-}
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20 :: BG.FunPtr (BG.CULong -> IO BG.CInt)
+f20 = BG.unsafePerformIO hs_bindgen_85dc99217461b608
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+foreign import ccall unsafe "hs_bindgen_350486e538e7ca90" hs_bindgen_350486e538e7ca90_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+hs_bindgen_350486e538e7ca90 :: IO (BG.FunPtr (BG.CLLong -> IO BG.CInt))
+hs_bindgen_350486e538e7ca90 =
+  fmap BG.fromFFIType hs_bindgen_350486e538e7ca90_base
+
+{-# NOINLINE f21 #-}
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21 :: BG.FunPtr (BG.CLLong -> IO BG.CInt)
+f21 = BG.unsafePerformIO hs_bindgen_350486e538e7ca90
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+foreign import ccall unsafe "hs_bindgen_ad2c8dc646b29be0" hs_bindgen_ad2c8dc646b29be0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+hs_bindgen_ad2c8dc646b29be0 :: IO (BG.FunPtr (BG.CLLong -> IO BG.CInt))
+hs_bindgen_ad2c8dc646b29be0 =
+  fmap BG.fromFFIType hs_bindgen_ad2c8dc646b29be0_base
+
+{-# NOINLINE f22 #-}
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22 :: BG.FunPtr (BG.CLLong -> IO BG.CInt)
+f22 = BG.unsafePerformIO hs_bindgen_ad2c8dc646b29be0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+foreign import ccall unsafe "hs_bindgen_01837bab50ebbe4c" hs_bindgen_01837bab50ebbe4c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+hs_bindgen_01837bab50ebbe4c :: IO (BG.FunPtr (BG.CLLong -> IO BG.CInt))
+hs_bindgen_01837bab50ebbe4c =
+  fmap BG.fromFFIType hs_bindgen_01837bab50ebbe4c_base
+
+{-# NOINLINE f23 #-}
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23 :: BG.FunPtr (BG.CLLong -> IO BG.CInt)
+f23 = BG.unsafePerformIO hs_bindgen_01837bab50ebbe4c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+foreign import ccall unsafe "hs_bindgen_051d17dfd1125c86" hs_bindgen_051d17dfd1125c86_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+hs_bindgen_051d17dfd1125c86 :: IO (BG.FunPtr (BG.CLLong -> IO BG.CInt))
+hs_bindgen_051d17dfd1125c86 =
+  fmap BG.fromFFIType hs_bindgen_051d17dfd1125c86_base
+
+{-# NOINLINE f24 #-}
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24 :: BG.FunPtr (BG.CLLong -> IO BG.CInt)
+f24 = BG.unsafePerformIO hs_bindgen_051d17dfd1125c86
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+foreign import ccall unsafe "hs_bindgen_ba5dd3a36d6f2756" hs_bindgen_ba5dd3a36d6f2756_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+hs_bindgen_ba5dd3a36d6f2756 :: IO (BG.FunPtr (BG.CULLong -> IO BG.CInt))
+hs_bindgen_ba5dd3a36d6f2756 =
+  fmap BG.fromFFIType hs_bindgen_ba5dd3a36d6f2756_base
+
+{-# NOINLINE f25 #-}
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25 :: BG.FunPtr (BG.CULLong -> IO BG.CInt)
+f25 = BG.unsafePerformIO hs_bindgen_ba5dd3a36d6f2756
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+foreign import ccall unsafe "hs_bindgen_22f3b97563fd757f" hs_bindgen_22f3b97563fd757f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+hs_bindgen_22f3b97563fd757f :: IO (BG.FunPtr (BG.CULLong -> IO BG.CInt))
+hs_bindgen_22f3b97563fd757f =
+  fmap BG.fromFFIType hs_bindgen_22f3b97563fd757f_base
+
+{-# NOINLINE f26 #-}
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26 :: BG.FunPtr (BG.CULLong -> IO BG.CInt)
+f26 = BG.unsafePerformIO hs_bindgen_22f3b97563fd757f
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+foreign import ccall unsafe "hs_bindgen_fc81895dfae9b1e5" hs_bindgen_fc81895dfae9b1e5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+hs_bindgen_fc81895dfae9b1e5 :: IO (BG.FunPtr (BG.CFloat -> IO BG.CInt))
+hs_bindgen_fc81895dfae9b1e5 =
+  fmap BG.fromFFIType hs_bindgen_fc81895dfae9b1e5_base
+
+{-# NOINLINE f27 #-}
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27 :: BG.FunPtr (BG.CFloat -> IO BG.CInt)
+f27 = BG.unsafePerformIO hs_bindgen_fc81895dfae9b1e5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+foreign import ccall unsafe "hs_bindgen_f95062f509265011" hs_bindgen_f95062f509265011_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+hs_bindgen_f95062f509265011 :: IO (BG.FunPtr (BG.CDouble -> IO BG.CInt))
+hs_bindgen_f95062f509265011 =
+  fmap BG.fromFFIType hs_bindgen_f95062f509265011_base
+
+{-# NOINLINE f28 #-}
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28 :: BG.FunPtr (BG.CDouble -> IO BG.CInt)
+f28 = BG.unsafePerformIO hs_bindgen_f95062f509265011
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example/Safe.hs
@@ -0,0 +1,912 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f1
+    , Example.Safe.f2
+    , Example.Safe.f3
+    , Example.Safe.f4
+    , Example.Safe.f5
+    , Example.Safe.f6
+    , Example.Safe.f7
+    , Example.Safe.f8
+    , Example.Safe.f9
+    , Example.Safe.f10
+    , Example.Safe.f11
+    , Example.Safe.f12
+    , Example.Safe.f13
+    , Example.Safe.f14
+    , Example.Safe.f15
+    , Example.Safe.f16
+    , Example.Safe.f17
+    , Example.Safe.f18
+    , Example.Safe.f19
+    , Example.Safe.f20
+    , Example.Safe.f21
+    , Example.Safe.f22
+    , Example.Safe.f23
+    , Example.Safe.f24
+    , Example.Safe.f25
+    , Example.Safe.f26
+    , Example.Safe.f27
+    , Example.Safe.f28
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/arithmetic_types.h>"
+  , "signed int hs_bindgen_7e7e01d691b1fb2a ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return (f1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_91658d4948bcfe06 ("
+  , "  signed char arg1"
+  , ")"
+  , "{"
+  , "  return (f2)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_40fb57deec0c99d6 ("
+  , "  unsigned char arg1"
+  , ")"
+  , "{"
+  , "  return (f3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d454dc277e0cb86b ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f4)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_446e834618998df2 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f5)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_267cc7905b42c66c ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f6)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e9eef0af846987d5 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f7)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_926fbc7f9888d375 ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f8)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_ec8aef57bd8d53bc ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f9)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d0045e58c2a6f1c4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f10)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_928bc5a3801d9fba ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f11)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0efc218270b00ee6 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f12)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_403a8a02a230ce24 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f13)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_9371cd597ae3022d ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f14)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f07c6429182c10c0 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f15)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_6af229e466926ec5 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f16)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0bc846cbecfd41ba ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f17)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0985403200f5a9de ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f18)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_91ef2c8f3da40e3c ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f19)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_39b524909ca528b5 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f20)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_efa4b421b2928f1e ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f21)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_881c4734d1b436b5 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f22)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_0ed2a5cf6068b35a ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f23)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_157ff76d8f7857e2 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f24)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_6046e1b60a2bdbda ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f25)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_3f072797069fc217 ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f26)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4da0472b80930fbf ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return (f27)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_98b4d9dc27aecea0 ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (f28)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_7e7e01d691b1fb2a" hs_bindgen_7e7e01d691b1fb2a_base ::
+     BG.CChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+hs_bindgen_7e7e01d691b1fb2a ::
+     BG.CChar
+  -> IO BG.CInt
+hs_bindgen_7e7e01d691b1fb2a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7e7e01d691b1fb2a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f1 = hs_bindgen_7e7e01d691b1fb2a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_91658d4948bcfe06" hs_bindgen_91658d4948bcfe06_base ::
+     BG.CSChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+hs_bindgen_91658d4948bcfe06 ::
+     BG.CSChar
+  -> IO BG.CInt
+hs_bindgen_91658d4948bcfe06 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_91658d4948bcfe06_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2 ::
+     BG.CSChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f2 = hs_bindgen_91658d4948bcfe06
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_40fb57deec0c99d6" hs_bindgen_40fb57deec0c99d6_base ::
+     BG.CUChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+hs_bindgen_40fb57deec0c99d6 ::
+     BG.CUChar
+  -> IO BG.CInt
+hs_bindgen_40fb57deec0c99d6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_40fb57deec0c99d6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3 ::
+     BG.CUChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f3 = hs_bindgen_40fb57deec0c99d6
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+foreign import ccall safe "hs_bindgen_d454dc277e0cb86b" hs_bindgen_d454dc277e0cb86b_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+hs_bindgen_d454dc277e0cb86b ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_d454dc277e0cb86b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d454dc277e0cb86b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f4 = hs_bindgen_d454dc277e0cb86b
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+foreign import ccall safe "hs_bindgen_446e834618998df2" hs_bindgen_446e834618998df2_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+hs_bindgen_446e834618998df2 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_446e834618998df2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_446e834618998df2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f5 = hs_bindgen_446e834618998df2
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+foreign import ccall safe "hs_bindgen_267cc7905b42c66c" hs_bindgen_267cc7905b42c66c_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+hs_bindgen_267cc7905b42c66c ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_267cc7905b42c66c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_267cc7905b42c66c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f6 = hs_bindgen_267cc7905b42c66c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+foreign import ccall safe "hs_bindgen_e9eef0af846987d5" hs_bindgen_e9eef0af846987d5_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+hs_bindgen_e9eef0af846987d5 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_e9eef0af846987d5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e9eef0af846987d5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f7 = hs_bindgen_e9eef0af846987d5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+foreign import ccall safe "hs_bindgen_926fbc7f9888d375" hs_bindgen_926fbc7f9888d375_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+hs_bindgen_926fbc7f9888d375 ::
+     BG.CUShort
+  -> IO BG.CInt
+hs_bindgen_926fbc7f9888d375 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_926fbc7f9888d375_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f8 = hs_bindgen_926fbc7f9888d375
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+foreign import ccall safe "hs_bindgen_ec8aef57bd8d53bc" hs_bindgen_ec8aef57bd8d53bc_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+hs_bindgen_ec8aef57bd8d53bc ::
+     BG.CUShort
+  -> IO BG.CInt
+hs_bindgen_ec8aef57bd8d53bc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ec8aef57bd8d53bc_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f9 = hs_bindgen_ec8aef57bd8d53bc
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+foreign import ccall safe "hs_bindgen_d0045e58c2a6f1c4" hs_bindgen_d0045e58c2a6f1c4_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+hs_bindgen_d0045e58c2a6f1c4 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_d0045e58c2a6f1c4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d0045e58c2a6f1c4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f10 = hs_bindgen_d0045e58c2a6f1c4
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+foreign import ccall safe "hs_bindgen_928bc5a3801d9fba" hs_bindgen_928bc5a3801d9fba_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+hs_bindgen_928bc5a3801d9fba ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_928bc5a3801d9fba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_928bc5a3801d9fba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f11 = hs_bindgen_928bc5a3801d9fba
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+foreign import ccall safe "hs_bindgen_0efc218270b00ee6" hs_bindgen_0efc218270b00ee6_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+hs_bindgen_0efc218270b00ee6 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_0efc218270b00ee6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0efc218270b00ee6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f12 = hs_bindgen_0efc218270b00ee6
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+foreign import ccall safe "hs_bindgen_403a8a02a230ce24" hs_bindgen_403a8a02a230ce24_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+hs_bindgen_403a8a02a230ce24 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_403a8a02a230ce24 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_403a8a02a230ce24_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f13 = hs_bindgen_403a8a02a230ce24
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+foreign import ccall safe "hs_bindgen_9371cd597ae3022d" hs_bindgen_9371cd597ae3022d_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+hs_bindgen_9371cd597ae3022d ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_9371cd597ae3022d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9371cd597ae3022d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f14 = hs_bindgen_9371cd597ae3022d
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+foreign import ccall safe "hs_bindgen_f07c6429182c10c0" hs_bindgen_f07c6429182c10c0_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+hs_bindgen_f07c6429182c10c0 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_f07c6429182c10c0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f07c6429182c10c0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f15 = hs_bindgen_f07c6429182c10c0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+foreign import ccall safe "hs_bindgen_6af229e466926ec5" hs_bindgen_6af229e466926ec5_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+hs_bindgen_6af229e466926ec5 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_6af229e466926ec5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6af229e466926ec5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f16 = hs_bindgen_6af229e466926ec5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+foreign import ccall safe "hs_bindgen_0bc846cbecfd41ba" hs_bindgen_0bc846cbecfd41ba_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+hs_bindgen_0bc846cbecfd41ba ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_0bc846cbecfd41ba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0bc846cbecfd41ba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f17 = hs_bindgen_0bc846cbecfd41ba
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+foreign import ccall safe "hs_bindgen_0985403200f5a9de" hs_bindgen_0985403200f5a9de_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+hs_bindgen_0985403200f5a9de ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_0985403200f5a9de =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0985403200f5a9de_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f18 = hs_bindgen_0985403200f5a9de
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+foreign import ccall safe "hs_bindgen_91ef2c8f3da40e3c" hs_bindgen_91ef2c8f3da40e3c_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+hs_bindgen_91ef2c8f3da40e3c ::
+     BG.CULong
+  -> IO BG.CInt
+hs_bindgen_91ef2c8f3da40e3c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_91ef2c8f3da40e3c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f19 = hs_bindgen_91ef2c8f3da40e3c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+foreign import ccall safe "hs_bindgen_39b524909ca528b5" hs_bindgen_39b524909ca528b5_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+hs_bindgen_39b524909ca528b5 ::
+     BG.CULong
+  -> IO BG.CInt
+hs_bindgen_39b524909ca528b5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_39b524909ca528b5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f20 = hs_bindgen_39b524909ca528b5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+foreign import ccall safe "hs_bindgen_efa4b421b2928f1e" hs_bindgen_efa4b421b2928f1e_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+hs_bindgen_efa4b421b2928f1e ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_efa4b421b2928f1e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_efa4b421b2928f1e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f21 = hs_bindgen_efa4b421b2928f1e
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+foreign import ccall safe "hs_bindgen_881c4734d1b436b5" hs_bindgen_881c4734d1b436b5_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+hs_bindgen_881c4734d1b436b5 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_881c4734d1b436b5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_881c4734d1b436b5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f22 = hs_bindgen_881c4734d1b436b5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+foreign import ccall safe "hs_bindgen_0ed2a5cf6068b35a" hs_bindgen_0ed2a5cf6068b35a_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+hs_bindgen_0ed2a5cf6068b35a ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_0ed2a5cf6068b35a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0ed2a5cf6068b35a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f23 = hs_bindgen_0ed2a5cf6068b35a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+foreign import ccall safe "hs_bindgen_157ff76d8f7857e2" hs_bindgen_157ff76d8f7857e2_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+hs_bindgen_157ff76d8f7857e2 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_157ff76d8f7857e2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_157ff76d8f7857e2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f24 = hs_bindgen_157ff76d8f7857e2
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+foreign import ccall safe "hs_bindgen_6046e1b60a2bdbda" hs_bindgen_6046e1b60a2bdbda_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+hs_bindgen_6046e1b60a2bdbda ::
+     BG.CULLong
+  -> IO BG.CInt
+hs_bindgen_6046e1b60a2bdbda =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6046e1b60a2bdbda_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f25 = hs_bindgen_6046e1b60a2bdbda
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+foreign import ccall safe "hs_bindgen_3f072797069fc217" hs_bindgen_3f072797069fc217_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+hs_bindgen_3f072797069fc217 ::
+     BG.CULLong
+  -> IO BG.CInt
+hs_bindgen_3f072797069fc217 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3f072797069fc217_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f26 = hs_bindgen_3f072797069fc217
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+foreign import ccall safe "hs_bindgen_4da0472b80930fbf" hs_bindgen_4da0472b80930fbf_base ::
+     BG.CFloat
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+hs_bindgen_4da0472b80930fbf ::
+     BG.CFloat
+  -> IO BG.CInt
+hs_bindgen_4da0472b80930fbf =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4da0472b80930fbf_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f27 = hs_bindgen_4da0472b80930fbf
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+foreign import ccall safe "hs_bindgen_98b4d9dc27aecea0" hs_bindgen_98b4d9dc27aecea0_base ::
+     BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+hs_bindgen_98b4d9dc27aecea0 ::
+     BG.CDouble
+  -> IO BG.CInt
+hs_bindgen_98b4d9dc27aecea0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_98b4d9dc27aecea0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28 ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f28 = hs_bindgen_98b4d9dc27aecea0
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/Example/Unsafe.hs
@@ -0,0 +1,912 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f1
+    , Example.Unsafe.f2
+    , Example.Unsafe.f3
+    , Example.Unsafe.f4
+    , Example.Unsafe.f5
+    , Example.Unsafe.f6
+    , Example.Unsafe.f7
+    , Example.Unsafe.f8
+    , Example.Unsafe.f9
+    , Example.Unsafe.f10
+    , Example.Unsafe.f11
+    , Example.Unsafe.f12
+    , Example.Unsafe.f13
+    , Example.Unsafe.f14
+    , Example.Unsafe.f15
+    , Example.Unsafe.f16
+    , Example.Unsafe.f17
+    , Example.Unsafe.f18
+    , Example.Unsafe.f19
+    , Example.Unsafe.f20
+    , Example.Unsafe.f21
+    , Example.Unsafe.f22
+    , Example.Unsafe.f23
+    , Example.Unsafe.f24
+    , Example.Unsafe.f25
+    , Example.Unsafe.f26
+    , Example.Unsafe.f27
+    , Example.Unsafe.f28
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/arithmetic_types.h>"
+  , "signed int hs_bindgen_d6e3d8093d108780 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return (f1)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_dc34e6197f6f39df ("
+  , "  signed char arg1"
+  , ")"
+  , "{"
+  , "  return (f2)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b642c5b44d663af5 ("
+  , "  unsigned char arg1"
+  , ")"
+  , "{"
+  , "  return (f3)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_27f5c806bf4593e7 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f4)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e8c0eab09a235501 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f5)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_7925bdb53e040792 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f6)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e6eb4efed37c1708 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f7)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_21cc8ace7d7441bd ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f8)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_ddca0323ddaaee35 ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f9)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d42a7635d5a1a314 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f10)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_111c67845229b054 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f11)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_6c05305fb77f1073 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f12)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_661a8e9409698789 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f13)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_3bdf905c84cb8fb9 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f14)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_212883c913884d27 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f15)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_f72cafc33ec81360 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f16)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_ea5f62444673cf16 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f17)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_9f4e020f892b30cb ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f18)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_47f005495bf88291 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f19)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_d02703a7ce8fade2 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f20)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_9f98e2aafc8c5a95 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f21)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_430da5f47172739a ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f22)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_bd83aa03a61a8a06 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f23)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_affcee7ffeebbac9 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f24)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b8a7fb0f9add23ab ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f25)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_377c3e6bd5b69285 ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f26)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_b82bda1eaf8b02ba ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return (f27)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_8d36f32587832dae ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (f28)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_d6e3d8093d108780" hs_bindgen_d6e3d8093d108780_base ::
+     BG.CChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+hs_bindgen_d6e3d8093d108780 ::
+     BG.CChar
+  -> IO BG.CInt
+hs_bindgen_d6e3d8093d108780 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d6e3d8093d108780_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f1 = hs_bindgen_d6e3d8093d108780
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_dc34e6197f6f39df" hs_bindgen_dc34e6197f6f39df_base ::
+     BG.CSChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+hs_bindgen_dc34e6197f6f39df ::
+     BG.CSChar
+  -> IO BG.CInt
+hs_bindgen_dc34e6197f6f39df =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_dc34e6197f6f39df_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2 ::
+     BG.CSChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f2 = hs_bindgen_dc34e6197f6f39df
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_b642c5b44d663af5" hs_bindgen_b642c5b44d663af5_base ::
+     BG.CUChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+hs_bindgen_b642c5b44d663af5 ::
+     BG.CUChar
+  -> IO BG.CInt
+hs_bindgen_b642c5b44d663af5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b642c5b44d663af5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3 ::
+     BG.CUChar
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f3 = hs_bindgen_b642c5b44d663af5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+foreign import ccall unsafe "hs_bindgen_27f5c806bf4593e7" hs_bindgen_27f5c806bf4593e7_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+hs_bindgen_27f5c806bf4593e7 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_27f5c806bf4593e7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_27f5c806bf4593e7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f4 = hs_bindgen_27f5c806bf4593e7
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+foreign import ccall unsafe "hs_bindgen_e8c0eab09a235501" hs_bindgen_e8c0eab09a235501_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+hs_bindgen_e8c0eab09a235501 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_e8c0eab09a235501 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e8c0eab09a235501_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f5 = hs_bindgen_e8c0eab09a235501
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+foreign import ccall unsafe "hs_bindgen_7925bdb53e040792" hs_bindgen_7925bdb53e040792_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+hs_bindgen_7925bdb53e040792 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_7925bdb53e040792 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7925bdb53e040792_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f6 = hs_bindgen_7925bdb53e040792
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+foreign import ccall unsafe "hs_bindgen_e6eb4efed37c1708" hs_bindgen_e6eb4efed37c1708_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+hs_bindgen_e6eb4efed37c1708 ::
+     BG.CShort
+  -> IO BG.CInt
+hs_bindgen_e6eb4efed37c1708 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e6eb4efed37c1708_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f7 = hs_bindgen_e6eb4efed37c1708
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+foreign import ccall unsafe "hs_bindgen_21cc8ace7d7441bd" hs_bindgen_21cc8ace7d7441bd_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+hs_bindgen_21cc8ace7d7441bd ::
+     BG.CUShort
+  -> IO BG.CInt
+hs_bindgen_21cc8ace7d7441bd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_21cc8ace7d7441bd_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f8 = hs_bindgen_21cc8ace7d7441bd
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+foreign import ccall unsafe "hs_bindgen_ddca0323ddaaee35" hs_bindgen_ddca0323ddaaee35_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+hs_bindgen_ddca0323ddaaee35 ::
+     BG.CUShort
+  -> IO BG.CInt
+hs_bindgen_ddca0323ddaaee35 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ddca0323ddaaee35_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f9 = hs_bindgen_ddca0323ddaaee35
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+foreign import ccall unsafe "hs_bindgen_d42a7635d5a1a314" hs_bindgen_d42a7635d5a1a314_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+hs_bindgen_d42a7635d5a1a314 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_d42a7635d5a1a314 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d42a7635d5a1a314_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f10 = hs_bindgen_d42a7635d5a1a314
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+foreign import ccall unsafe "hs_bindgen_111c67845229b054" hs_bindgen_111c67845229b054_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+hs_bindgen_111c67845229b054 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_111c67845229b054 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_111c67845229b054_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f11 = hs_bindgen_111c67845229b054
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+foreign import ccall unsafe "hs_bindgen_6c05305fb77f1073" hs_bindgen_6c05305fb77f1073_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+hs_bindgen_6c05305fb77f1073 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_6c05305fb77f1073 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6c05305fb77f1073_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f12 = hs_bindgen_6c05305fb77f1073
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+foreign import ccall unsafe "hs_bindgen_661a8e9409698789" hs_bindgen_661a8e9409698789_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+hs_bindgen_661a8e9409698789 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_661a8e9409698789 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_661a8e9409698789_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f13 = hs_bindgen_661a8e9409698789
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+foreign import ccall unsafe "hs_bindgen_3bdf905c84cb8fb9" hs_bindgen_3bdf905c84cb8fb9_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+hs_bindgen_3bdf905c84cb8fb9 ::
+     BG.CUInt
+  -> IO BG.CInt
+hs_bindgen_3bdf905c84cb8fb9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3bdf905c84cb8fb9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f14 = hs_bindgen_3bdf905c84cb8fb9
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+foreign import ccall unsafe "hs_bindgen_212883c913884d27" hs_bindgen_212883c913884d27_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+hs_bindgen_212883c913884d27 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_212883c913884d27 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_212883c913884d27_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f15 = hs_bindgen_212883c913884d27
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+foreign import ccall unsafe "hs_bindgen_f72cafc33ec81360" hs_bindgen_f72cafc33ec81360_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+hs_bindgen_f72cafc33ec81360 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_f72cafc33ec81360 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f72cafc33ec81360_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f16 = hs_bindgen_f72cafc33ec81360
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+foreign import ccall unsafe "hs_bindgen_ea5f62444673cf16" hs_bindgen_ea5f62444673cf16_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+hs_bindgen_ea5f62444673cf16 ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_ea5f62444673cf16 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ea5f62444673cf16_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f17 = hs_bindgen_ea5f62444673cf16
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+foreign import ccall unsafe "hs_bindgen_9f4e020f892b30cb" hs_bindgen_9f4e020f892b30cb_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+hs_bindgen_9f4e020f892b30cb ::
+     BG.CLong
+  -> IO BG.CInt
+hs_bindgen_9f4e020f892b30cb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9f4e020f892b30cb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f18 = hs_bindgen_9f4e020f892b30cb
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+foreign import ccall unsafe "hs_bindgen_47f005495bf88291" hs_bindgen_47f005495bf88291_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+hs_bindgen_47f005495bf88291 ::
+     BG.CULong
+  -> IO BG.CInt
+hs_bindgen_47f005495bf88291 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_47f005495bf88291_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f19 = hs_bindgen_47f005495bf88291
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+foreign import ccall unsafe "hs_bindgen_d02703a7ce8fade2" hs_bindgen_d02703a7ce8fade2_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+hs_bindgen_d02703a7ce8fade2 ::
+     BG.CULong
+  -> IO BG.CInt
+hs_bindgen_d02703a7ce8fade2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d02703a7ce8fade2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f20 = hs_bindgen_d02703a7ce8fade2
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+foreign import ccall unsafe "hs_bindgen_9f98e2aafc8c5a95" hs_bindgen_9f98e2aafc8c5a95_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+hs_bindgen_9f98e2aafc8c5a95 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_9f98e2aafc8c5a95 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9f98e2aafc8c5a95_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f21 = hs_bindgen_9f98e2aafc8c5a95
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+foreign import ccall unsafe "hs_bindgen_430da5f47172739a" hs_bindgen_430da5f47172739a_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+hs_bindgen_430da5f47172739a ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_430da5f47172739a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_430da5f47172739a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f22 = hs_bindgen_430da5f47172739a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+foreign import ccall unsafe "hs_bindgen_bd83aa03a61a8a06" hs_bindgen_bd83aa03a61a8a06_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+hs_bindgen_bd83aa03a61a8a06 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_bd83aa03a61a8a06 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bd83aa03a61a8a06_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f23 = hs_bindgen_bd83aa03a61a8a06
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+foreign import ccall unsafe "hs_bindgen_affcee7ffeebbac9" hs_bindgen_affcee7ffeebbac9_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+hs_bindgen_affcee7ffeebbac9 ::
+     BG.CLLong
+  -> IO BG.CInt
+hs_bindgen_affcee7ffeebbac9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_affcee7ffeebbac9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f24 = hs_bindgen_affcee7ffeebbac9
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+foreign import ccall unsafe "hs_bindgen_b8a7fb0f9add23ab" hs_bindgen_b8a7fb0f9add23ab_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+hs_bindgen_b8a7fb0f9add23ab ::
+     BG.CULLong
+  -> IO BG.CInt
+hs_bindgen_b8a7fb0f9add23ab =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b8a7fb0f9add23ab_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f25 = hs_bindgen_b8a7fb0f9add23ab
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+foreign import ccall unsafe "hs_bindgen_377c3e6bd5b69285" hs_bindgen_377c3e6bd5b69285_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+hs_bindgen_377c3e6bd5b69285 ::
+     BG.CULLong
+  -> IO BG.CInt
+hs_bindgen_377c3e6bd5b69285 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_377c3e6bd5b69285_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f26 = hs_bindgen_377c3e6bd5b69285
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+foreign import ccall unsafe "hs_bindgen_b82bda1eaf8b02ba" hs_bindgen_b82bda1eaf8b02ba_base ::
+     BG.CFloat
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+hs_bindgen_b82bda1eaf8b02ba ::
+     BG.CFloat
+  -> IO BG.CInt
+hs_bindgen_b82bda1eaf8b02ba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b82bda1eaf8b02ba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f27 = hs_bindgen_b82bda1eaf8b02ba
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+foreign import ccall unsafe "hs_bindgen_8d36f32587832dae" hs_bindgen_8d36f32587832dae_base ::
+     BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+hs_bindgen_8d36f32587832dae ::
+     BG.CDouble
+  -> IO BG.CInt
+hs_bindgen_8d36f32587832dae =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8d36f32587832dae_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28 ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+f28 = hs_bindgen_8d36f32587832dae
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types.2.raw/th.txt
@@ -0,0 +1,2424 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/arithmetic_types.h
+-- #include <macros/reparse/arithmetic_types.h>
+-- signed int hs_bindgen_7e7e01d691b1fb2a (
+--   char arg1
+-- )
+-- {
+--   return (f1)(arg1);
+-- }
+-- signed int hs_bindgen_91658d4948bcfe06 (
+--   signed char arg1
+-- )
+-- {
+--   return (f2)(arg1);
+-- }
+-- signed int hs_bindgen_40fb57deec0c99d6 (
+--   unsigned char arg1
+-- )
+-- {
+--   return (f3)(arg1);
+-- }
+-- signed int hs_bindgen_d454dc277e0cb86b (
+--   signed short arg1
+-- )
+-- {
+--   return (f4)(arg1);
+-- }
+-- signed int hs_bindgen_446e834618998df2 (
+--   signed short arg1
+-- )
+-- {
+--   return (f5)(arg1);
+-- }
+-- signed int hs_bindgen_267cc7905b42c66c (
+--   signed short arg1
+-- )
+-- {
+--   return (f6)(arg1);
+-- }
+-- signed int hs_bindgen_e9eef0af846987d5 (
+--   signed short arg1
+-- )
+-- {
+--   return (f7)(arg1);
+-- }
+-- signed int hs_bindgen_926fbc7f9888d375 (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f8)(arg1);
+-- }
+-- signed int hs_bindgen_ec8aef57bd8d53bc (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f9)(arg1);
+-- }
+-- signed int hs_bindgen_d0045e58c2a6f1c4 (
+--   signed int arg1
+-- )
+-- {
+--   return (f10)(arg1);
+-- }
+-- signed int hs_bindgen_928bc5a3801d9fba (
+--   signed int arg1
+-- )
+-- {
+--   return (f11)(arg1);
+-- }
+-- signed int hs_bindgen_0efc218270b00ee6 (
+--   signed int arg1
+-- )
+-- {
+--   return (f12)(arg1);
+-- }
+-- signed int hs_bindgen_403a8a02a230ce24 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f13)(arg1);
+-- }
+-- signed int hs_bindgen_9371cd597ae3022d (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f14)(arg1);
+-- }
+-- signed int hs_bindgen_f07c6429182c10c0 (
+--   signed long arg1
+-- )
+-- {
+--   return (f15)(arg1);
+-- }
+-- signed int hs_bindgen_6af229e466926ec5 (
+--   signed long arg1
+-- )
+-- {
+--   return (f16)(arg1);
+-- }
+-- signed int hs_bindgen_0bc846cbecfd41ba (
+--   signed long arg1
+-- )
+-- {
+--   return (f17)(arg1);
+-- }
+-- signed int hs_bindgen_0985403200f5a9de (
+--   signed long arg1
+-- )
+-- {
+--   return (f18)(arg1);
+-- }
+-- signed int hs_bindgen_91ef2c8f3da40e3c (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f19)(arg1);
+-- }
+-- signed int hs_bindgen_39b524909ca528b5 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f20)(arg1);
+-- }
+-- signed int hs_bindgen_efa4b421b2928f1e (
+--   signed long long arg1
+-- )
+-- {
+--   return (f21)(arg1);
+-- }
+-- signed int hs_bindgen_881c4734d1b436b5 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f22)(arg1);
+-- }
+-- signed int hs_bindgen_0ed2a5cf6068b35a (
+--   signed long long arg1
+-- )
+-- {
+--   return (f23)(arg1);
+-- }
+-- signed int hs_bindgen_157ff76d8f7857e2 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f24)(arg1);
+-- }
+-- signed int hs_bindgen_6046e1b60a2bdbda (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f25)(arg1);
+-- }
+-- signed int hs_bindgen_3f072797069fc217 (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f26)(arg1);
+-- }
+-- signed int hs_bindgen_4da0472b80930fbf (
+--   float arg1
+-- )
+-- {
+--   return (f27)(arg1);
+-- }
+-- signed int hs_bindgen_98b4d9dc27aecea0 (
+--   double arg1
+-- )
+-- {
+--   return (f28)(arg1);
+-- }
+-- signed int hs_bindgen_d6e3d8093d108780 (
+--   char arg1
+-- )
+-- {
+--   return (f1)(arg1);
+-- }
+-- signed int hs_bindgen_dc34e6197f6f39df (
+--   signed char arg1
+-- )
+-- {
+--   return (f2)(arg1);
+-- }
+-- signed int hs_bindgen_b642c5b44d663af5 (
+--   unsigned char arg1
+-- )
+-- {
+--   return (f3)(arg1);
+-- }
+-- signed int hs_bindgen_27f5c806bf4593e7 (
+--   signed short arg1
+-- )
+-- {
+--   return (f4)(arg1);
+-- }
+-- signed int hs_bindgen_e8c0eab09a235501 (
+--   signed short arg1
+-- )
+-- {
+--   return (f5)(arg1);
+-- }
+-- signed int hs_bindgen_7925bdb53e040792 (
+--   signed short arg1
+-- )
+-- {
+--   return (f6)(arg1);
+-- }
+-- signed int hs_bindgen_e6eb4efed37c1708 (
+--   signed short arg1
+-- )
+-- {
+--   return (f7)(arg1);
+-- }
+-- signed int hs_bindgen_21cc8ace7d7441bd (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f8)(arg1);
+-- }
+-- signed int hs_bindgen_ddca0323ddaaee35 (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f9)(arg1);
+-- }
+-- signed int hs_bindgen_d42a7635d5a1a314 (
+--   signed int arg1
+-- )
+-- {
+--   return (f10)(arg1);
+-- }
+-- signed int hs_bindgen_111c67845229b054 (
+--   signed int arg1
+-- )
+-- {
+--   return (f11)(arg1);
+-- }
+-- signed int hs_bindgen_6c05305fb77f1073 (
+--   signed int arg1
+-- )
+-- {
+--   return (f12)(arg1);
+-- }
+-- signed int hs_bindgen_661a8e9409698789 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f13)(arg1);
+-- }
+-- signed int hs_bindgen_3bdf905c84cb8fb9 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f14)(arg1);
+-- }
+-- signed int hs_bindgen_212883c913884d27 (
+--   signed long arg1
+-- )
+-- {
+--   return (f15)(arg1);
+-- }
+-- signed int hs_bindgen_f72cafc33ec81360 (
+--   signed long arg1
+-- )
+-- {
+--   return (f16)(arg1);
+-- }
+-- signed int hs_bindgen_ea5f62444673cf16 (
+--   signed long arg1
+-- )
+-- {
+--   return (f17)(arg1);
+-- }
+-- signed int hs_bindgen_9f4e020f892b30cb (
+--   signed long arg1
+-- )
+-- {
+--   return (f18)(arg1);
+-- }
+-- signed int hs_bindgen_47f005495bf88291 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f19)(arg1);
+-- }
+-- signed int hs_bindgen_d02703a7ce8fade2 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f20)(arg1);
+-- }
+-- signed int hs_bindgen_9f98e2aafc8c5a95 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f21)(arg1);
+-- }
+-- signed int hs_bindgen_430da5f47172739a (
+--   signed long long arg1
+-- )
+-- {
+--   return (f22)(arg1);
+-- }
+-- signed int hs_bindgen_bd83aa03a61a8a06 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f23)(arg1);
+-- }
+-- signed int hs_bindgen_affcee7ffeebbac9 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f24)(arg1);
+-- }
+-- signed int hs_bindgen_b8a7fb0f9add23ab (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f25)(arg1);
+-- }
+-- signed int hs_bindgen_377c3e6bd5b69285 (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f26)(arg1);
+-- }
+-- signed int hs_bindgen_b82bda1eaf8b02ba (
+--   float arg1
+-- )
+-- {
+--   return (f27)(arg1);
+-- }
+-- signed int hs_bindgen_8d36f32587832dae (
+--   double arg1
+-- )
+-- {
+--   return (f28)(arg1);
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_1208d85624465c51 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &f1;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_90bf738ed6e126cf (void)) (
+--   signed char arg1
+-- )
+-- {
+--   return &f2;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f3 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_541fb107a8c068d0 (void)) (
+--   unsigned char arg1
+-- )
+-- {
+--   return &f3;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f4 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_695a21f5c624ca64 (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f4;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f5 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_43491bdffe43bbe1 (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f5;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f6 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ffafdd943146661a (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f6;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f7 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_7c6250122a3c59a3 (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f7;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f8 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_60cbc6e072d14643 (void)) (
+--   unsigned short arg1
+-- )
+-- {
+--   return &f8;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f9 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_fa356fa03c563829 (void)) (
+--   unsigned short arg1
+-- )
+-- {
+--   return &f9;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f10 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_6971f14ec2033453 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f10;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f11 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_18e46ae0dfd9dbe0 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f11;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f12 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_0c1c36784fe71810 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f12;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f13 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_8d9bec0d1944b558 (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &f13;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f14 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_796f92f5831916a6 (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &f14;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f15 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2cb6292b4cc8f420 (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f15;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f16 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_b7dd3e78d24cd30c (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f16;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f17 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_894ff9aa74f040d9 (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f17;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f18 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_57359ef6c14eb820 (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f18;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f19 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2173cee7470d34a4 (void)) (
+--   unsigned long arg1
+-- )
+-- {
+--   return &f19;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f20 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_85dc99217461b608 (void)) (
+--   unsigned long arg1
+-- )
+-- {
+--   return &f20;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f21 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_350486e538e7ca90 (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f21;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f22 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ad2c8dc646b29be0 (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f22;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f23 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_01837bab50ebbe4c (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f23;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f24 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_051d17dfd1125c86 (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f24;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f25 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ba5dd3a36d6f2756 (void)) (
+--   unsigned long long arg1
+-- )
+-- {
+--   return &f25;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f26 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_22f3b97563fd757f (void)) (
+--   unsigned long long arg1
+-- )
+-- {
+--   return &f26;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f27 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_fc81895dfae9b1e5 (void)) (
+--   float arg1
+-- )
+-- {
+--   return &f27;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f28 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_f95062f509265011 (void)) (
+--   double arg1
+-- )
+-- {
+--   return &f28;
+-- }
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 16:9@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+a :: Raw String
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 16:9@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+a = objectLike "A" ["int"]
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_7e7e01d691b1fb2a" hs_bindgen_7e7e01d691b1fb2a_base ::
+    CChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+hs_bindgen_7e7e01d691b1fb2a :: CChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+hs_bindgen_7e7e01d691b1fb2a = \x_0 -> fmap fromFFIType (hs_bindgen_7e7e01d691b1fb2a_base (toFFIType x_0))
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_safe :: CChar -> IO CInt
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_safe = hs_bindgen_7e7e01d691b1fb2a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_91658d4948bcfe06" hs_bindgen_91658d4948bcfe06_base ::
+    CSChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+hs_bindgen_91658d4948bcfe06 :: CSChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+hs_bindgen_91658d4948bcfe06 = \x_0 -> fmap fromFFIType (hs_bindgen_91658d4948bcfe06_base (toFFIType x_0))
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_safe :: CSChar -> IO CInt
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_safe = hs_bindgen_91658d4948bcfe06
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_40fb57deec0c99d6" hs_bindgen_40fb57deec0c99d6_base ::
+    CUChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+hs_bindgen_40fb57deec0c99d6 :: CUChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+hs_bindgen_40fb57deec0c99d6 = \x_0 -> fmap fromFFIType (hs_bindgen_40fb57deec0c99d6_base (toFFIType x_0))
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_safe :: CUChar -> IO CInt
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_safe = hs_bindgen_40fb57deec0c99d6
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+foreign import ccall safe "hs_bindgen_d454dc277e0cb86b" hs_bindgen_d454dc277e0cb86b_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+hs_bindgen_d454dc277e0cb86b :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+hs_bindgen_d454dc277e0cb86b = \x_0 -> fmap fromFFIType (hs_bindgen_d454dc277e0cb86b_base (toFFIType x_0))
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_safe :: CShort -> IO CInt
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_safe = hs_bindgen_d454dc277e0cb86b
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+foreign import ccall safe "hs_bindgen_446e834618998df2" hs_bindgen_446e834618998df2_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+hs_bindgen_446e834618998df2 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+hs_bindgen_446e834618998df2 = \x_0 -> fmap fromFFIType (hs_bindgen_446e834618998df2_base (toFFIType x_0))
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_safe :: CShort -> IO CInt
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_safe = hs_bindgen_446e834618998df2
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+foreign import ccall safe "hs_bindgen_267cc7905b42c66c" hs_bindgen_267cc7905b42c66c_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+hs_bindgen_267cc7905b42c66c :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+hs_bindgen_267cc7905b42c66c = \x_0 -> fmap fromFFIType (hs_bindgen_267cc7905b42c66c_base (toFFIType x_0))
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_safe :: CShort -> IO CInt
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_safe = hs_bindgen_267cc7905b42c66c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+foreign import ccall safe "hs_bindgen_e9eef0af846987d5" hs_bindgen_e9eef0af846987d5_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+hs_bindgen_e9eef0af846987d5 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+hs_bindgen_e9eef0af846987d5 = \x_0 -> fmap fromFFIType (hs_bindgen_e9eef0af846987d5_base (toFFIType x_0))
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_safe :: CShort -> IO CInt
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_safe = hs_bindgen_e9eef0af846987d5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+foreign import ccall safe "hs_bindgen_926fbc7f9888d375" hs_bindgen_926fbc7f9888d375_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+hs_bindgen_926fbc7f9888d375 :: CUShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+hs_bindgen_926fbc7f9888d375 = \x_0 -> fmap fromFFIType (hs_bindgen_926fbc7f9888d375_base (toFFIType x_0))
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_safe :: CUShort -> IO CInt
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_safe = hs_bindgen_926fbc7f9888d375
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+foreign import ccall safe "hs_bindgen_ec8aef57bd8d53bc" hs_bindgen_ec8aef57bd8d53bc_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+hs_bindgen_ec8aef57bd8d53bc :: CUShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+hs_bindgen_ec8aef57bd8d53bc = \x_0 -> fmap fromFFIType (hs_bindgen_ec8aef57bd8d53bc_base (toFFIType x_0))
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_safe :: CUShort -> IO CInt
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_safe = hs_bindgen_ec8aef57bd8d53bc
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+foreign import ccall safe "hs_bindgen_d0045e58c2a6f1c4" hs_bindgen_d0045e58c2a6f1c4_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+hs_bindgen_d0045e58c2a6f1c4 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+hs_bindgen_d0045e58c2a6f1c4 = \x_0 -> fmap fromFFIType (hs_bindgen_d0045e58c2a6f1c4_base (toFFIType x_0))
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_safe :: CInt -> IO CInt
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_safe = hs_bindgen_d0045e58c2a6f1c4
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+foreign import ccall safe "hs_bindgen_928bc5a3801d9fba" hs_bindgen_928bc5a3801d9fba_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+hs_bindgen_928bc5a3801d9fba :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+hs_bindgen_928bc5a3801d9fba = \x_0 -> fmap fromFFIType (hs_bindgen_928bc5a3801d9fba_base (toFFIType x_0))
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_safe :: CInt -> IO CInt
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_safe = hs_bindgen_928bc5a3801d9fba
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+foreign import ccall safe "hs_bindgen_0efc218270b00ee6" hs_bindgen_0efc218270b00ee6_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+hs_bindgen_0efc218270b00ee6 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+hs_bindgen_0efc218270b00ee6 = \x_0 -> fmap fromFFIType (hs_bindgen_0efc218270b00ee6_base (toFFIType x_0))
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_safe :: CInt -> IO CInt
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_safe = hs_bindgen_0efc218270b00ee6
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+foreign import ccall safe "hs_bindgen_403a8a02a230ce24" hs_bindgen_403a8a02a230ce24_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+hs_bindgen_403a8a02a230ce24 :: CUInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+hs_bindgen_403a8a02a230ce24 = \x_0 -> fmap fromFFIType (hs_bindgen_403a8a02a230ce24_base (toFFIType x_0))
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_safe :: CUInt -> IO CInt
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_safe = hs_bindgen_403a8a02a230ce24
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+foreign import ccall safe "hs_bindgen_9371cd597ae3022d" hs_bindgen_9371cd597ae3022d_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+hs_bindgen_9371cd597ae3022d :: CUInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+hs_bindgen_9371cd597ae3022d = \x_0 -> fmap fromFFIType (hs_bindgen_9371cd597ae3022d_base (toFFIType x_0))
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_safe :: CUInt -> IO CInt
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_safe = hs_bindgen_9371cd597ae3022d
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+foreign import ccall safe "hs_bindgen_f07c6429182c10c0" hs_bindgen_f07c6429182c10c0_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+hs_bindgen_f07c6429182c10c0 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+hs_bindgen_f07c6429182c10c0 = \x_0 -> fmap fromFFIType (hs_bindgen_f07c6429182c10c0_base (toFFIType x_0))
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_safe :: CLong -> IO CInt
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_safe = hs_bindgen_f07c6429182c10c0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+foreign import ccall safe "hs_bindgen_6af229e466926ec5" hs_bindgen_6af229e466926ec5_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+hs_bindgen_6af229e466926ec5 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+hs_bindgen_6af229e466926ec5 = \x_0 -> fmap fromFFIType (hs_bindgen_6af229e466926ec5_base (toFFIType x_0))
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_safe :: CLong -> IO CInt
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_safe = hs_bindgen_6af229e466926ec5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+foreign import ccall safe "hs_bindgen_0bc846cbecfd41ba" hs_bindgen_0bc846cbecfd41ba_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+hs_bindgen_0bc846cbecfd41ba :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+hs_bindgen_0bc846cbecfd41ba = \x_0 -> fmap fromFFIType (hs_bindgen_0bc846cbecfd41ba_base (toFFIType x_0))
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_safe :: CLong -> IO CInt
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_safe = hs_bindgen_0bc846cbecfd41ba
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+foreign import ccall safe "hs_bindgen_0985403200f5a9de" hs_bindgen_0985403200f5a9de_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+hs_bindgen_0985403200f5a9de :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+hs_bindgen_0985403200f5a9de = \x_0 -> fmap fromFFIType (hs_bindgen_0985403200f5a9de_base (toFFIType x_0))
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_safe :: CLong -> IO CInt
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_safe = hs_bindgen_0985403200f5a9de
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+foreign import ccall safe "hs_bindgen_91ef2c8f3da40e3c" hs_bindgen_91ef2c8f3da40e3c_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+hs_bindgen_91ef2c8f3da40e3c :: CULong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+hs_bindgen_91ef2c8f3da40e3c = \x_0 -> fmap fromFFIType (hs_bindgen_91ef2c8f3da40e3c_base (toFFIType x_0))
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_safe :: CULong -> IO CInt
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_safe = hs_bindgen_91ef2c8f3da40e3c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+foreign import ccall safe "hs_bindgen_39b524909ca528b5" hs_bindgen_39b524909ca528b5_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+hs_bindgen_39b524909ca528b5 :: CULong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+hs_bindgen_39b524909ca528b5 = \x_0 -> fmap fromFFIType (hs_bindgen_39b524909ca528b5_base (toFFIType x_0))
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_safe :: CULong -> IO CInt
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_safe = hs_bindgen_39b524909ca528b5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+foreign import ccall safe "hs_bindgen_efa4b421b2928f1e" hs_bindgen_efa4b421b2928f1e_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+hs_bindgen_efa4b421b2928f1e :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+hs_bindgen_efa4b421b2928f1e = \x_0 -> fmap fromFFIType (hs_bindgen_efa4b421b2928f1e_base (toFFIType x_0))
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_safe :: CLLong -> IO CInt
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_safe = hs_bindgen_efa4b421b2928f1e
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+foreign import ccall safe "hs_bindgen_881c4734d1b436b5" hs_bindgen_881c4734d1b436b5_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+hs_bindgen_881c4734d1b436b5 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+hs_bindgen_881c4734d1b436b5 = \x_0 -> fmap fromFFIType (hs_bindgen_881c4734d1b436b5_base (toFFIType x_0))
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_safe :: CLLong -> IO CInt
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_safe = hs_bindgen_881c4734d1b436b5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+foreign import ccall safe "hs_bindgen_0ed2a5cf6068b35a" hs_bindgen_0ed2a5cf6068b35a_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+hs_bindgen_0ed2a5cf6068b35a :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+hs_bindgen_0ed2a5cf6068b35a = \x_0 -> fmap fromFFIType (hs_bindgen_0ed2a5cf6068b35a_base (toFFIType x_0))
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_safe :: CLLong -> IO CInt
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_safe = hs_bindgen_0ed2a5cf6068b35a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+foreign import ccall safe "hs_bindgen_157ff76d8f7857e2" hs_bindgen_157ff76d8f7857e2_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+hs_bindgen_157ff76d8f7857e2 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+hs_bindgen_157ff76d8f7857e2 = \x_0 -> fmap fromFFIType (hs_bindgen_157ff76d8f7857e2_base (toFFIType x_0))
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_safe :: CLLong -> IO CInt
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_safe = hs_bindgen_157ff76d8f7857e2
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+foreign import ccall safe "hs_bindgen_6046e1b60a2bdbda" hs_bindgen_6046e1b60a2bdbda_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+hs_bindgen_6046e1b60a2bdbda :: CULLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+hs_bindgen_6046e1b60a2bdbda = \x_0 -> fmap fromFFIType (hs_bindgen_6046e1b60a2bdbda_base (toFFIType x_0))
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_safe :: CULLong -> IO CInt
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_safe = hs_bindgen_6046e1b60a2bdbda
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+foreign import ccall safe "hs_bindgen_3f072797069fc217" hs_bindgen_3f072797069fc217_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+hs_bindgen_3f072797069fc217 :: CULLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+hs_bindgen_3f072797069fc217 = \x_0 -> fmap fromFFIType (hs_bindgen_3f072797069fc217_base (toFFIType x_0))
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_safe :: CULLong -> IO CInt
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_safe = hs_bindgen_3f072797069fc217
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+foreign import ccall safe "hs_bindgen_4da0472b80930fbf" hs_bindgen_4da0472b80930fbf_base ::
+    CFloat
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+hs_bindgen_4da0472b80930fbf :: CFloat -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+hs_bindgen_4da0472b80930fbf = \x_0 -> fmap fromFFIType (hs_bindgen_4da0472b80930fbf_base (toFFIType x_0))
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_safe :: CFloat -> IO CInt
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_safe = hs_bindgen_4da0472b80930fbf
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+foreign import ccall safe "hs_bindgen_98b4d9dc27aecea0" hs_bindgen_98b4d9dc27aecea0_base ::
+    CDouble
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+hs_bindgen_98b4d9dc27aecea0 :: CDouble -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+hs_bindgen_98b4d9dc27aecea0 = \x_0 -> fmap fromFFIType (hs_bindgen_98b4d9dc27aecea0_base (toFFIType x_0))
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_safe :: CDouble -> IO CInt
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_safe = hs_bindgen_98b4d9dc27aecea0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_d6e3d8093d108780" hs_bindgen_d6e3d8093d108780_base ::
+    CChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+hs_bindgen_d6e3d8093d108780 :: CChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+hs_bindgen_d6e3d8093d108780 = \x_0 -> fmap fromFFIType (hs_bindgen_d6e3d8093d108780_base (toFFIType x_0))
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_unsafe :: CChar -> IO CInt
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_unsafe = hs_bindgen_d6e3d8093d108780
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_dc34e6197f6f39df" hs_bindgen_dc34e6197f6f39df_base ::
+    CSChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+hs_bindgen_dc34e6197f6f39df :: CSChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+hs_bindgen_dc34e6197f6f39df = \x_0 -> fmap fromFFIType (hs_bindgen_dc34e6197f6f39df_base (toFFIType x_0))
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_unsafe :: CSChar -> IO CInt
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_unsafe = hs_bindgen_dc34e6197f6f39df
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_b642c5b44d663af5" hs_bindgen_b642c5b44d663af5_base ::
+    CUChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+hs_bindgen_b642c5b44d663af5 :: CUChar -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+hs_bindgen_b642c5b44d663af5 = \x_0 -> fmap fromFFIType (hs_bindgen_b642c5b44d663af5_base (toFFIType x_0))
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_unsafe :: CUChar -> IO CInt
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_unsafe = hs_bindgen_b642c5b44d663af5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+foreign import ccall unsafe "hs_bindgen_27f5c806bf4593e7" hs_bindgen_27f5c806bf4593e7_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+hs_bindgen_27f5c806bf4593e7 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+hs_bindgen_27f5c806bf4593e7 = \x_0 -> fmap fromFFIType (hs_bindgen_27f5c806bf4593e7_base (toFFIType x_0))
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_unsafe :: CShort -> IO CInt
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_unsafe = hs_bindgen_27f5c806bf4593e7
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+foreign import ccall unsafe "hs_bindgen_e8c0eab09a235501" hs_bindgen_e8c0eab09a235501_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+hs_bindgen_e8c0eab09a235501 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+hs_bindgen_e8c0eab09a235501 = \x_0 -> fmap fromFFIType (hs_bindgen_e8c0eab09a235501_base (toFFIType x_0))
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_unsafe :: CShort -> IO CInt
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_unsafe = hs_bindgen_e8c0eab09a235501
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+foreign import ccall unsafe "hs_bindgen_7925bdb53e040792" hs_bindgen_7925bdb53e040792_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+hs_bindgen_7925bdb53e040792 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+hs_bindgen_7925bdb53e040792 = \x_0 -> fmap fromFFIType (hs_bindgen_7925bdb53e040792_base (toFFIType x_0))
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_unsafe :: CShort -> IO CInt
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_unsafe = hs_bindgen_7925bdb53e040792
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+foreign import ccall unsafe "hs_bindgen_e6eb4efed37c1708" hs_bindgen_e6eb4efed37c1708_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+hs_bindgen_e6eb4efed37c1708 :: CShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+hs_bindgen_e6eb4efed37c1708 = \x_0 -> fmap fromFFIType (hs_bindgen_e6eb4efed37c1708_base (toFFIType x_0))
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_unsafe :: CShort -> IO CInt
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_unsafe = hs_bindgen_e6eb4efed37c1708
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+foreign import ccall unsafe "hs_bindgen_21cc8ace7d7441bd" hs_bindgen_21cc8ace7d7441bd_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+hs_bindgen_21cc8ace7d7441bd :: CUShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+hs_bindgen_21cc8ace7d7441bd = \x_0 -> fmap fromFFIType (hs_bindgen_21cc8ace7d7441bd_base (toFFIType x_0))
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_unsafe :: CUShort -> IO CInt
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_unsafe = hs_bindgen_21cc8ace7d7441bd
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+foreign import ccall unsafe "hs_bindgen_ddca0323ddaaee35" hs_bindgen_ddca0323ddaaee35_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+hs_bindgen_ddca0323ddaaee35 :: CUShort -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+hs_bindgen_ddca0323ddaaee35 = \x_0 -> fmap fromFFIType (hs_bindgen_ddca0323ddaaee35_base (toFFIType x_0))
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_unsafe :: CUShort -> IO CInt
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_unsafe = hs_bindgen_ddca0323ddaaee35
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+foreign import ccall unsafe "hs_bindgen_d42a7635d5a1a314" hs_bindgen_d42a7635d5a1a314_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+hs_bindgen_d42a7635d5a1a314 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+hs_bindgen_d42a7635d5a1a314 = \x_0 -> fmap fromFFIType (hs_bindgen_d42a7635d5a1a314_base (toFFIType x_0))
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_unsafe = hs_bindgen_d42a7635d5a1a314
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+foreign import ccall unsafe "hs_bindgen_111c67845229b054" hs_bindgen_111c67845229b054_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+hs_bindgen_111c67845229b054 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+hs_bindgen_111c67845229b054 = \x_0 -> fmap fromFFIType (hs_bindgen_111c67845229b054_base (toFFIType x_0))
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_unsafe = hs_bindgen_111c67845229b054
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+foreign import ccall unsafe "hs_bindgen_6c05305fb77f1073" hs_bindgen_6c05305fb77f1073_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+hs_bindgen_6c05305fb77f1073 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+hs_bindgen_6c05305fb77f1073 = \x_0 -> fmap fromFFIType (hs_bindgen_6c05305fb77f1073_base (toFFIType x_0))
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_unsafe = hs_bindgen_6c05305fb77f1073
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+foreign import ccall unsafe "hs_bindgen_661a8e9409698789" hs_bindgen_661a8e9409698789_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+hs_bindgen_661a8e9409698789 :: CUInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+hs_bindgen_661a8e9409698789 = \x_0 -> fmap fromFFIType (hs_bindgen_661a8e9409698789_base (toFFIType x_0))
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_unsafe :: CUInt -> IO CInt
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_unsafe = hs_bindgen_661a8e9409698789
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+foreign import ccall unsafe "hs_bindgen_3bdf905c84cb8fb9" hs_bindgen_3bdf905c84cb8fb9_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+hs_bindgen_3bdf905c84cb8fb9 :: CUInt -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+hs_bindgen_3bdf905c84cb8fb9 = \x_0 -> fmap fromFFIType (hs_bindgen_3bdf905c84cb8fb9_base (toFFIType x_0))
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_unsafe :: CUInt -> IO CInt
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_unsafe = hs_bindgen_3bdf905c84cb8fb9
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+foreign import ccall unsafe "hs_bindgen_212883c913884d27" hs_bindgen_212883c913884d27_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+hs_bindgen_212883c913884d27 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+hs_bindgen_212883c913884d27 = \x_0 -> fmap fromFFIType (hs_bindgen_212883c913884d27_base (toFFIType x_0))
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_unsafe :: CLong -> IO CInt
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_unsafe = hs_bindgen_212883c913884d27
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+foreign import ccall unsafe "hs_bindgen_f72cafc33ec81360" hs_bindgen_f72cafc33ec81360_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+hs_bindgen_f72cafc33ec81360 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+hs_bindgen_f72cafc33ec81360 = \x_0 -> fmap fromFFIType (hs_bindgen_f72cafc33ec81360_base (toFFIType x_0))
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_unsafe :: CLong -> IO CInt
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_unsafe = hs_bindgen_f72cafc33ec81360
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+foreign import ccall unsafe "hs_bindgen_ea5f62444673cf16" hs_bindgen_ea5f62444673cf16_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+hs_bindgen_ea5f62444673cf16 :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+hs_bindgen_ea5f62444673cf16 = \x_0 -> fmap fromFFIType (hs_bindgen_ea5f62444673cf16_base (toFFIType x_0))
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_unsafe :: CLong -> IO CInt
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_unsafe = hs_bindgen_ea5f62444673cf16
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+foreign import ccall unsafe "hs_bindgen_9f4e020f892b30cb" hs_bindgen_9f4e020f892b30cb_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+hs_bindgen_9f4e020f892b30cb :: CLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+hs_bindgen_9f4e020f892b30cb = \x_0 -> fmap fromFFIType (hs_bindgen_9f4e020f892b30cb_base (toFFIType x_0))
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_unsafe :: CLong -> IO CInt
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_unsafe = hs_bindgen_9f4e020f892b30cb
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+foreign import ccall unsafe "hs_bindgen_47f005495bf88291" hs_bindgen_47f005495bf88291_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+hs_bindgen_47f005495bf88291 :: CULong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+hs_bindgen_47f005495bf88291 = \x_0 -> fmap fromFFIType (hs_bindgen_47f005495bf88291_base (toFFIType x_0))
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_unsafe :: CULong -> IO CInt
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_unsafe = hs_bindgen_47f005495bf88291
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+foreign import ccall unsafe "hs_bindgen_d02703a7ce8fade2" hs_bindgen_d02703a7ce8fade2_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+hs_bindgen_d02703a7ce8fade2 :: CULong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+hs_bindgen_d02703a7ce8fade2 = \x_0 -> fmap fromFFIType (hs_bindgen_d02703a7ce8fade2_base (toFFIType x_0))
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_unsafe :: CULong -> IO CInt
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_unsafe = hs_bindgen_d02703a7ce8fade2
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+foreign import ccall unsafe "hs_bindgen_9f98e2aafc8c5a95" hs_bindgen_9f98e2aafc8c5a95_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+hs_bindgen_9f98e2aafc8c5a95 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+hs_bindgen_9f98e2aafc8c5a95 = \x_0 -> fmap fromFFIType (hs_bindgen_9f98e2aafc8c5a95_base (toFFIType x_0))
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_unsafe :: CLLong -> IO CInt
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_unsafe = hs_bindgen_9f98e2aafc8c5a95
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+foreign import ccall unsafe "hs_bindgen_430da5f47172739a" hs_bindgen_430da5f47172739a_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+hs_bindgen_430da5f47172739a :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+hs_bindgen_430da5f47172739a = \x_0 -> fmap fromFFIType (hs_bindgen_430da5f47172739a_base (toFFIType x_0))
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_unsafe :: CLLong -> IO CInt
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_unsafe = hs_bindgen_430da5f47172739a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+foreign import ccall unsafe "hs_bindgen_bd83aa03a61a8a06" hs_bindgen_bd83aa03a61a8a06_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+hs_bindgen_bd83aa03a61a8a06 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+hs_bindgen_bd83aa03a61a8a06 = \x_0 -> fmap fromFFIType (hs_bindgen_bd83aa03a61a8a06_base (toFFIType x_0))
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_unsafe :: CLLong -> IO CInt
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_unsafe = hs_bindgen_bd83aa03a61a8a06
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+foreign import ccall unsafe "hs_bindgen_affcee7ffeebbac9" hs_bindgen_affcee7ffeebbac9_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+hs_bindgen_affcee7ffeebbac9 :: CLLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+hs_bindgen_affcee7ffeebbac9 = \x_0 -> fmap fromFFIType (hs_bindgen_affcee7ffeebbac9_base (toFFIType x_0))
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_unsafe :: CLLong -> IO CInt
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_unsafe = hs_bindgen_affcee7ffeebbac9
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+foreign import ccall unsafe "hs_bindgen_b8a7fb0f9add23ab" hs_bindgen_b8a7fb0f9add23ab_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+hs_bindgen_b8a7fb0f9add23ab :: CULLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+hs_bindgen_b8a7fb0f9add23ab = \x_0 -> fmap fromFFIType (hs_bindgen_b8a7fb0f9add23ab_base (toFFIType x_0))
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_unsafe :: CULLong -> IO CInt
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_unsafe = hs_bindgen_b8a7fb0f9add23ab
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+foreign import ccall unsafe "hs_bindgen_377c3e6bd5b69285" hs_bindgen_377c3e6bd5b69285_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+hs_bindgen_377c3e6bd5b69285 :: CULLong -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+hs_bindgen_377c3e6bd5b69285 = \x_0 -> fmap fromFFIType (hs_bindgen_377c3e6bd5b69285_base (toFFIType x_0))
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_unsafe :: CULLong -> IO CInt
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_unsafe = hs_bindgen_377c3e6bd5b69285
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+foreign import ccall unsafe "hs_bindgen_b82bda1eaf8b02ba" hs_bindgen_b82bda1eaf8b02ba_base ::
+    CFloat
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+hs_bindgen_b82bda1eaf8b02ba :: CFloat -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+hs_bindgen_b82bda1eaf8b02ba = \x_0 -> fmap fromFFIType (hs_bindgen_b82bda1eaf8b02ba_base (toFFIType x_0))
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_unsafe :: CFloat -> IO CInt
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_unsafe = hs_bindgen_b82bda1eaf8b02ba
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+foreign import ccall unsafe "hs_bindgen_8d36f32587832dae" hs_bindgen_8d36f32587832dae_base ::
+    CDouble
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+hs_bindgen_8d36f32587832dae :: CDouble -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+hs_bindgen_8d36f32587832dae = \x_0 -> fmap fromFFIType (hs_bindgen_8d36f32587832dae_base (toFFIType x_0))
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_unsafe :: CDouble -> IO CInt
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_unsafe = hs_bindgen_8d36f32587832dae
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_1208d85624465c51" hs_bindgen_1208d85624465c51_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+hs_bindgen_1208d85624465c51 :: IO (FunPtr (CChar -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+hs_bindgen_1208d85624465c51 = fmap fromFFIType hs_bindgen_1208d85624465c51_base
+{-# NOINLINE f1_funptr #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_funptr :: FunPtr (CChar -> IO CInt)
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_funptr = unsafePerformIO hs_bindgen_1208d85624465c51
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_90bf738ed6e126cf" hs_bindgen_90bf738ed6e126cf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+hs_bindgen_90bf738ed6e126cf :: IO (FunPtr (CSChar -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+hs_bindgen_90bf738ed6e126cf = fmap fromFFIType hs_bindgen_90bf738ed6e126cf_base
+{-# NOINLINE f2_funptr #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_funptr :: FunPtr (CSChar -> IO CInt)
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_funptr = unsafePerformIO hs_bindgen_90bf738ed6e126cf
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_541fb107a8c068d0" hs_bindgen_541fb107a8c068d0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+hs_bindgen_541fb107a8c068d0 :: IO (FunPtr (CUChar -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+hs_bindgen_541fb107a8c068d0 = fmap fromFFIType hs_bindgen_541fb107a8c068d0_base
+{-# NOINLINE f3_funptr #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_funptr :: FunPtr (CUChar -> IO CInt)
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_funptr = unsafePerformIO hs_bindgen_541fb107a8c068d0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+foreign import ccall unsafe "hs_bindgen_695a21f5c624ca64" hs_bindgen_695a21f5c624ca64_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+hs_bindgen_695a21f5c624ca64 :: IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+hs_bindgen_695a21f5c624ca64 = fmap fromFFIType hs_bindgen_695a21f5c624ca64_base
+{-# NOINLINE f4_funptr #-}
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_funptr :: FunPtr (CShort -> IO CInt)
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_funptr = unsafePerformIO hs_bindgen_695a21f5c624ca64
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+foreign import ccall unsafe "hs_bindgen_43491bdffe43bbe1" hs_bindgen_43491bdffe43bbe1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+hs_bindgen_43491bdffe43bbe1 :: IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+hs_bindgen_43491bdffe43bbe1 = fmap fromFFIType hs_bindgen_43491bdffe43bbe1_base
+{-# NOINLINE f5_funptr #-}
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_funptr :: FunPtr (CShort -> IO CInt)
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_funptr = unsafePerformIO hs_bindgen_43491bdffe43bbe1
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+foreign import ccall unsafe "hs_bindgen_ffafdd943146661a" hs_bindgen_ffafdd943146661a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+hs_bindgen_ffafdd943146661a :: IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+hs_bindgen_ffafdd943146661a = fmap fromFFIType hs_bindgen_ffafdd943146661a_base
+{-# NOINLINE f6_funptr #-}
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_funptr :: FunPtr (CShort -> IO CInt)
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_funptr = unsafePerformIO hs_bindgen_ffafdd943146661a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+foreign import ccall unsafe "hs_bindgen_7c6250122a3c59a3" hs_bindgen_7c6250122a3c59a3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+hs_bindgen_7c6250122a3c59a3 :: IO (FunPtr (CShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+hs_bindgen_7c6250122a3c59a3 = fmap fromFFIType hs_bindgen_7c6250122a3c59a3_base
+{-# NOINLINE f7_funptr #-}
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_funptr :: FunPtr (CShort -> IO CInt)
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_funptr = unsafePerformIO hs_bindgen_7c6250122a3c59a3
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+foreign import ccall unsafe "hs_bindgen_60cbc6e072d14643" hs_bindgen_60cbc6e072d14643_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+hs_bindgen_60cbc6e072d14643 :: IO (FunPtr (CUShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+hs_bindgen_60cbc6e072d14643 = fmap fromFFIType hs_bindgen_60cbc6e072d14643_base
+{-# NOINLINE f8_funptr #-}
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_funptr :: FunPtr (CUShort -> IO CInt)
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_funptr = unsafePerformIO hs_bindgen_60cbc6e072d14643
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+foreign import ccall unsafe "hs_bindgen_fa356fa03c563829" hs_bindgen_fa356fa03c563829_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+hs_bindgen_fa356fa03c563829 :: IO (FunPtr (CUShort -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+hs_bindgen_fa356fa03c563829 = fmap fromFFIType hs_bindgen_fa356fa03c563829_base
+{-# NOINLINE f9_funptr #-}
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_funptr :: FunPtr (CUShort -> IO CInt)
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_funptr = unsafePerformIO hs_bindgen_fa356fa03c563829
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+foreign import ccall unsafe "hs_bindgen_6971f14ec2033453" hs_bindgen_6971f14ec2033453_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+hs_bindgen_6971f14ec2033453 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+hs_bindgen_6971f14ec2033453 = fmap fromFFIType hs_bindgen_6971f14ec2033453_base
+{-# NOINLINE f10_funptr #-}
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_funptr = unsafePerformIO hs_bindgen_6971f14ec2033453
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+foreign import ccall unsafe "hs_bindgen_18e46ae0dfd9dbe0" hs_bindgen_18e46ae0dfd9dbe0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+hs_bindgen_18e46ae0dfd9dbe0 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+hs_bindgen_18e46ae0dfd9dbe0 = fmap fromFFIType hs_bindgen_18e46ae0dfd9dbe0_base
+{-# NOINLINE f11_funptr #-}
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_funptr = unsafePerformIO hs_bindgen_18e46ae0dfd9dbe0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+foreign import ccall unsafe "hs_bindgen_0c1c36784fe71810" hs_bindgen_0c1c36784fe71810_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+hs_bindgen_0c1c36784fe71810 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+hs_bindgen_0c1c36784fe71810 = fmap fromFFIType hs_bindgen_0c1c36784fe71810_base
+{-# NOINLINE f12_funptr #-}
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_funptr = unsafePerformIO hs_bindgen_0c1c36784fe71810
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+foreign import ccall unsafe "hs_bindgen_8d9bec0d1944b558" hs_bindgen_8d9bec0d1944b558_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+hs_bindgen_8d9bec0d1944b558 :: IO (FunPtr (CUInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+hs_bindgen_8d9bec0d1944b558 = fmap fromFFIType hs_bindgen_8d9bec0d1944b558_base
+{-# NOINLINE f13_funptr #-}
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_funptr :: FunPtr (CUInt -> IO CInt)
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_funptr = unsafePerformIO hs_bindgen_8d9bec0d1944b558
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+foreign import ccall unsafe "hs_bindgen_796f92f5831916a6" hs_bindgen_796f92f5831916a6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+hs_bindgen_796f92f5831916a6 :: IO (FunPtr (CUInt -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+hs_bindgen_796f92f5831916a6 = fmap fromFFIType hs_bindgen_796f92f5831916a6_base
+{-# NOINLINE f14_funptr #-}
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_funptr :: FunPtr (CUInt -> IO CInt)
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_funptr = unsafePerformIO hs_bindgen_796f92f5831916a6
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+foreign import ccall unsafe "hs_bindgen_2cb6292b4cc8f420" hs_bindgen_2cb6292b4cc8f420_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+hs_bindgen_2cb6292b4cc8f420 :: IO (FunPtr (CLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+hs_bindgen_2cb6292b4cc8f420 = fmap fromFFIType hs_bindgen_2cb6292b4cc8f420_base
+{-# NOINLINE f15_funptr #-}
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_funptr :: FunPtr (CLong -> IO CInt)
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_funptr = unsafePerformIO hs_bindgen_2cb6292b4cc8f420
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+foreign import ccall unsafe "hs_bindgen_b7dd3e78d24cd30c" hs_bindgen_b7dd3e78d24cd30c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+hs_bindgen_b7dd3e78d24cd30c :: IO (FunPtr (CLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+hs_bindgen_b7dd3e78d24cd30c = fmap fromFFIType hs_bindgen_b7dd3e78d24cd30c_base
+{-# NOINLINE f16_funptr #-}
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_funptr :: FunPtr (CLong -> IO CInt)
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_funptr = unsafePerformIO hs_bindgen_b7dd3e78d24cd30c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+foreign import ccall unsafe "hs_bindgen_894ff9aa74f040d9" hs_bindgen_894ff9aa74f040d9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+hs_bindgen_894ff9aa74f040d9 :: IO (FunPtr (CLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+hs_bindgen_894ff9aa74f040d9 = fmap fromFFIType hs_bindgen_894ff9aa74f040d9_base
+{-# NOINLINE f17_funptr #-}
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_funptr :: FunPtr (CLong -> IO CInt)
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_funptr = unsafePerformIO hs_bindgen_894ff9aa74f040d9
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+foreign import ccall unsafe "hs_bindgen_57359ef6c14eb820" hs_bindgen_57359ef6c14eb820_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+hs_bindgen_57359ef6c14eb820 :: IO (FunPtr (CLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+hs_bindgen_57359ef6c14eb820 = fmap fromFFIType hs_bindgen_57359ef6c14eb820_base
+{-# NOINLINE f18_funptr #-}
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_funptr :: FunPtr (CLong -> IO CInt)
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_funptr = unsafePerformIO hs_bindgen_57359ef6c14eb820
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+foreign import ccall unsafe "hs_bindgen_2173cee7470d34a4" hs_bindgen_2173cee7470d34a4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+hs_bindgen_2173cee7470d34a4 :: IO (FunPtr (CULong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+hs_bindgen_2173cee7470d34a4 = fmap fromFFIType hs_bindgen_2173cee7470d34a4_base
+{-# NOINLINE f19_funptr #-}
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_funptr :: FunPtr (CULong -> IO CInt)
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_funptr = unsafePerformIO hs_bindgen_2173cee7470d34a4
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+foreign import ccall unsafe "hs_bindgen_85dc99217461b608" hs_bindgen_85dc99217461b608_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+hs_bindgen_85dc99217461b608 :: IO (FunPtr (CULong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+hs_bindgen_85dc99217461b608 = fmap fromFFIType hs_bindgen_85dc99217461b608_base
+{-# NOINLINE f20_funptr #-}
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_funptr :: FunPtr (CULong -> IO CInt)
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_funptr = unsafePerformIO hs_bindgen_85dc99217461b608
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+foreign import ccall unsafe "hs_bindgen_350486e538e7ca90" hs_bindgen_350486e538e7ca90_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+hs_bindgen_350486e538e7ca90 :: IO (FunPtr (CLLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+hs_bindgen_350486e538e7ca90 = fmap fromFFIType hs_bindgen_350486e538e7ca90_base
+{-# NOINLINE f21_funptr #-}
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_funptr :: FunPtr (CLLong -> IO CInt)
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_funptr = unsafePerformIO hs_bindgen_350486e538e7ca90
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+foreign import ccall unsafe "hs_bindgen_ad2c8dc646b29be0" hs_bindgen_ad2c8dc646b29be0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+hs_bindgen_ad2c8dc646b29be0 :: IO (FunPtr (CLLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+hs_bindgen_ad2c8dc646b29be0 = fmap fromFFIType hs_bindgen_ad2c8dc646b29be0_base
+{-# NOINLINE f22_funptr #-}
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_funptr :: FunPtr (CLLong -> IO CInt)
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_funptr = unsafePerformIO hs_bindgen_ad2c8dc646b29be0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+foreign import ccall unsafe "hs_bindgen_01837bab50ebbe4c" hs_bindgen_01837bab50ebbe4c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+hs_bindgen_01837bab50ebbe4c :: IO (FunPtr (CLLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+hs_bindgen_01837bab50ebbe4c = fmap fromFFIType hs_bindgen_01837bab50ebbe4c_base
+{-# NOINLINE f23_funptr #-}
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_funptr :: FunPtr (CLLong -> IO CInt)
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_funptr = unsafePerformIO hs_bindgen_01837bab50ebbe4c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+foreign import ccall unsafe "hs_bindgen_051d17dfd1125c86" hs_bindgen_051d17dfd1125c86_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+hs_bindgen_051d17dfd1125c86 :: IO (FunPtr (CLLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+hs_bindgen_051d17dfd1125c86 = fmap fromFFIType hs_bindgen_051d17dfd1125c86_base
+{-# NOINLINE f24_funptr #-}
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_funptr :: FunPtr (CLLong -> IO CInt)
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_funptr = unsafePerformIO hs_bindgen_051d17dfd1125c86
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+foreign import ccall unsafe "hs_bindgen_ba5dd3a36d6f2756" hs_bindgen_ba5dd3a36d6f2756_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+hs_bindgen_ba5dd3a36d6f2756 :: IO (FunPtr (CULLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+hs_bindgen_ba5dd3a36d6f2756 = fmap fromFFIType hs_bindgen_ba5dd3a36d6f2756_base
+{-# NOINLINE f25_funptr #-}
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_funptr :: FunPtr (CULLong -> IO CInt)
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_funptr = unsafePerformIO hs_bindgen_ba5dd3a36d6f2756
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+foreign import ccall unsafe "hs_bindgen_22f3b97563fd757f" hs_bindgen_22f3b97563fd757f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+hs_bindgen_22f3b97563fd757f :: IO (FunPtr (CULLong -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+hs_bindgen_22f3b97563fd757f = fmap fromFFIType hs_bindgen_22f3b97563fd757f_base
+{-# NOINLINE f26_funptr #-}
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_funptr :: FunPtr (CULLong -> IO CInt)
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_funptr = unsafePerformIO hs_bindgen_22f3b97563fd757f
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+foreign import ccall unsafe "hs_bindgen_fc81895dfae9b1e5" hs_bindgen_fc81895dfae9b1e5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+hs_bindgen_fc81895dfae9b1e5 :: IO (FunPtr (CFloat -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+hs_bindgen_fc81895dfae9b1e5 = fmap fromFFIType hs_bindgen_fc81895dfae9b1e5_base
+{-# NOINLINE f27_funptr #-}
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_funptr :: FunPtr (CFloat -> IO CInt)
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_funptr = unsafePerformIO hs_bindgen_fc81895dfae9b1e5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+foreign import ccall unsafe "hs_bindgen_f95062f509265011" hs_bindgen_f95062f509265011_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+hs_bindgen_f95062f509265011 :: IO (FunPtr (CDouble -> IO CInt))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+hs_bindgen_f95062f509265011 = fmap fromFFIType hs_bindgen_f95062f509265011_base
+{-# NOINLINE f28_funptr #-}
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_funptr :: FunPtr (CDouble -> IO CInt)
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_funptr = unsafePerformIO hs_bindgen_f95062f509265011
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example.hs
@@ -0,0 +1,69 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 16:9@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+newtype A = A
+  { unwrapA :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example/FunPtr.hs
@@ -0,0 +1,801 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f1
+    , Example.FunPtr.f2
+    , Example.FunPtr.f3
+    , Example.FunPtr.f4
+    , Example.FunPtr.f5
+    , Example.FunPtr.f6
+    , Example.FunPtr.f7
+    , Example.FunPtr.f8
+    , Example.FunPtr.f9
+    , Example.FunPtr.f10
+    , Example.FunPtr.f11
+    , Example.FunPtr.f12
+    , Example.FunPtr.f13
+    , Example.FunPtr.f14
+    , Example.FunPtr.f15
+    , Example.FunPtr.f16
+    , Example.FunPtr.f17
+    , Example.FunPtr.f18
+    , Example.FunPtr.f19
+    , Example.FunPtr.f20
+    , Example.FunPtr.f21
+    , Example.FunPtr.f22
+    , Example.FunPtr.f23
+    , Example.FunPtr.f24
+    , Example.FunPtr.f25
+    , Example.FunPtr.f26
+    , Example.FunPtr.f27
+    , Example.FunPtr.f28
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/arithmetic_types.h>"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f1 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_1208d85624465c51 (void)) ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return &f1;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f2 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_90bf738ed6e126cf (void)) ("
+  , "  signed char arg1"
+  , ")"
+  , "{"
+  , "  return &f2;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f3 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_541fb107a8c068d0 (void)) ("
+  , "  unsigned char arg1"
+  , ")"
+  , "{"
+  , "  return &f3;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f4 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_695a21f5c624ca64 (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f4;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f5 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_43491bdffe43bbe1 (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f5;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f6 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_ffafdd943146661a (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f6;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f7 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_7c6250122a3c59a3 (void)) ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return &f7;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f8 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_60cbc6e072d14643 (void)) ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return &f8;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f9 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_fa356fa03c563829 (void)) ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return &f9;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f10 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_6971f14ec2033453 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f10;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f11 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_18e46ae0dfd9dbe0 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f11;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f12 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_0c1c36784fe71810 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f12;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f13 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_8d9bec0d1944b558 (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &f13;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f14 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_796f92f5831916a6 (void)) ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return &f14;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f15 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_2cb6292b4cc8f420 (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f15;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f16 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_b7dd3e78d24cd30c (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f16;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f17 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_894ff9aa74f040d9 (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f17;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f18 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_57359ef6c14eb820 (void)) ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return &f18;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f19 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_2173cee7470d34a4 (void)) ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return &f19;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f20 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_85dc99217461b608 (void)) ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return &f20;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f21 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_350486e538e7ca90 (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f21;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f22 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_ad2c8dc646b29be0 (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f22;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f23 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_01837bab50ebbe4c (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f23;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f24 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_051d17dfd1125c86 (void)) ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return &f24;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f25 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_ba5dd3a36d6f2756 (void)) ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return &f25;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f26 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_22f3b97563fd757f (void)) ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return &f26;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f27 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_fc81895dfae9b1e5 (void)) ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return &f27;"
+  , "}"
+  , "/* test_macrosreparsearithmetic_type_Example_get_f28 */"
+  , "__attribute__ ((const))"
+  , "A (*hs_bindgen_f95062f509265011 (void)) ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return &f28;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_1208d85624465c51" hs_bindgen_1208d85624465c51_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+hs_bindgen_1208d85624465c51 :: IO (BG.FunPtr (BG.CChar -> IO A))
+hs_bindgen_1208d85624465c51 =
+  fmap BG.fromFFIType hs_bindgen_1208d85624465c51_base
+
+{-# NOINLINE f1 #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1 :: BG.FunPtr (BG.CChar -> IO A)
+f1 = BG.unsafePerformIO hs_bindgen_1208d85624465c51
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_90bf738ed6e126cf" hs_bindgen_90bf738ed6e126cf_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+hs_bindgen_90bf738ed6e126cf :: IO (BG.FunPtr (BG.CSChar -> IO A))
+hs_bindgen_90bf738ed6e126cf =
+  fmap BG.fromFFIType hs_bindgen_90bf738ed6e126cf_base
+
+{-# NOINLINE f2 #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2 :: BG.FunPtr (BG.CSChar -> IO A)
+f2 = BG.unsafePerformIO hs_bindgen_90bf738ed6e126cf
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_541fb107a8c068d0" hs_bindgen_541fb107a8c068d0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+hs_bindgen_541fb107a8c068d0 :: IO (BG.FunPtr (BG.CUChar -> IO A))
+hs_bindgen_541fb107a8c068d0 =
+  fmap BG.fromFFIType hs_bindgen_541fb107a8c068d0_base
+
+{-# NOINLINE f3 #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3 :: BG.FunPtr (BG.CUChar -> IO A)
+f3 = BG.unsafePerformIO hs_bindgen_541fb107a8c068d0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+foreign import ccall unsafe "hs_bindgen_695a21f5c624ca64" hs_bindgen_695a21f5c624ca64_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+hs_bindgen_695a21f5c624ca64 :: IO (BG.FunPtr (BG.CShort -> IO A))
+hs_bindgen_695a21f5c624ca64 =
+  fmap BG.fromFFIType hs_bindgen_695a21f5c624ca64_base
+
+{-# NOINLINE f4 #-}
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4 :: BG.FunPtr (BG.CShort -> IO A)
+f4 = BG.unsafePerformIO hs_bindgen_695a21f5c624ca64
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+foreign import ccall unsafe "hs_bindgen_43491bdffe43bbe1" hs_bindgen_43491bdffe43bbe1_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+hs_bindgen_43491bdffe43bbe1 :: IO (BG.FunPtr (BG.CShort -> IO A))
+hs_bindgen_43491bdffe43bbe1 =
+  fmap BG.fromFFIType hs_bindgen_43491bdffe43bbe1_base
+
+{-# NOINLINE f5 #-}
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5 :: BG.FunPtr (BG.CShort -> IO A)
+f5 = BG.unsafePerformIO hs_bindgen_43491bdffe43bbe1
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+foreign import ccall unsafe "hs_bindgen_ffafdd943146661a" hs_bindgen_ffafdd943146661a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+hs_bindgen_ffafdd943146661a :: IO (BG.FunPtr (BG.CShort -> IO A))
+hs_bindgen_ffafdd943146661a =
+  fmap BG.fromFFIType hs_bindgen_ffafdd943146661a_base
+
+{-# NOINLINE f6 #-}
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6 :: BG.FunPtr (BG.CShort -> IO A)
+f6 = BG.unsafePerformIO hs_bindgen_ffafdd943146661a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+foreign import ccall unsafe "hs_bindgen_7c6250122a3c59a3" hs_bindgen_7c6250122a3c59a3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+hs_bindgen_7c6250122a3c59a3 :: IO (BG.FunPtr (BG.CShort -> IO A))
+hs_bindgen_7c6250122a3c59a3 =
+  fmap BG.fromFFIType hs_bindgen_7c6250122a3c59a3_base
+
+{-# NOINLINE f7 #-}
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7 :: BG.FunPtr (BG.CShort -> IO A)
+f7 = BG.unsafePerformIO hs_bindgen_7c6250122a3c59a3
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+foreign import ccall unsafe "hs_bindgen_60cbc6e072d14643" hs_bindgen_60cbc6e072d14643_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+hs_bindgen_60cbc6e072d14643 :: IO (BG.FunPtr (BG.CUShort -> IO A))
+hs_bindgen_60cbc6e072d14643 =
+  fmap BG.fromFFIType hs_bindgen_60cbc6e072d14643_base
+
+{-# NOINLINE f8 #-}
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8 :: BG.FunPtr (BG.CUShort -> IO A)
+f8 = BG.unsafePerformIO hs_bindgen_60cbc6e072d14643
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+foreign import ccall unsafe "hs_bindgen_fa356fa03c563829" hs_bindgen_fa356fa03c563829_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+hs_bindgen_fa356fa03c563829 :: IO (BG.FunPtr (BG.CUShort -> IO A))
+hs_bindgen_fa356fa03c563829 =
+  fmap BG.fromFFIType hs_bindgen_fa356fa03c563829_base
+
+{-# NOINLINE f9 #-}
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9 :: BG.FunPtr (BG.CUShort -> IO A)
+f9 = BG.unsafePerformIO hs_bindgen_fa356fa03c563829
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+foreign import ccall unsafe "hs_bindgen_6971f14ec2033453" hs_bindgen_6971f14ec2033453_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+hs_bindgen_6971f14ec2033453 :: IO (BG.FunPtr (BG.CInt -> IO A))
+hs_bindgen_6971f14ec2033453 =
+  fmap BG.fromFFIType hs_bindgen_6971f14ec2033453_base
+
+{-# NOINLINE f10 #-}
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10 :: BG.FunPtr (BG.CInt -> IO A)
+f10 = BG.unsafePerformIO hs_bindgen_6971f14ec2033453
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+foreign import ccall unsafe "hs_bindgen_18e46ae0dfd9dbe0" hs_bindgen_18e46ae0dfd9dbe0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+hs_bindgen_18e46ae0dfd9dbe0 :: IO (BG.FunPtr (BG.CInt -> IO A))
+hs_bindgen_18e46ae0dfd9dbe0 =
+  fmap BG.fromFFIType hs_bindgen_18e46ae0dfd9dbe0_base
+
+{-# NOINLINE f11 #-}
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11 :: BG.FunPtr (BG.CInt -> IO A)
+f11 = BG.unsafePerformIO hs_bindgen_18e46ae0dfd9dbe0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+foreign import ccall unsafe "hs_bindgen_0c1c36784fe71810" hs_bindgen_0c1c36784fe71810_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+hs_bindgen_0c1c36784fe71810 :: IO (BG.FunPtr (BG.CInt -> IO A))
+hs_bindgen_0c1c36784fe71810 =
+  fmap BG.fromFFIType hs_bindgen_0c1c36784fe71810_base
+
+{-# NOINLINE f12 #-}
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12 :: BG.FunPtr (BG.CInt -> IO A)
+f12 = BG.unsafePerformIO hs_bindgen_0c1c36784fe71810
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+foreign import ccall unsafe "hs_bindgen_8d9bec0d1944b558" hs_bindgen_8d9bec0d1944b558_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+hs_bindgen_8d9bec0d1944b558 :: IO (BG.FunPtr (BG.CUInt -> IO A))
+hs_bindgen_8d9bec0d1944b558 =
+  fmap BG.fromFFIType hs_bindgen_8d9bec0d1944b558_base
+
+{-# NOINLINE f13 #-}
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13 :: BG.FunPtr (BG.CUInt -> IO A)
+f13 = BG.unsafePerformIO hs_bindgen_8d9bec0d1944b558
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+foreign import ccall unsafe "hs_bindgen_796f92f5831916a6" hs_bindgen_796f92f5831916a6_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+hs_bindgen_796f92f5831916a6 :: IO (BG.FunPtr (BG.CUInt -> IO A))
+hs_bindgen_796f92f5831916a6 =
+  fmap BG.fromFFIType hs_bindgen_796f92f5831916a6_base
+
+{-# NOINLINE f14 #-}
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14 :: BG.FunPtr (BG.CUInt -> IO A)
+f14 = BG.unsafePerformIO hs_bindgen_796f92f5831916a6
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+foreign import ccall unsafe "hs_bindgen_2cb6292b4cc8f420" hs_bindgen_2cb6292b4cc8f420_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+hs_bindgen_2cb6292b4cc8f420 :: IO (BG.FunPtr (BG.CLong -> IO A))
+hs_bindgen_2cb6292b4cc8f420 =
+  fmap BG.fromFFIType hs_bindgen_2cb6292b4cc8f420_base
+
+{-# NOINLINE f15 #-}
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15 :: BG.FunPtr (BG.CLong -> IO A)
+f15 = BG.unsafePerformIO hs_bindgen_2cb6292b4cc8f420
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+foreign import ccall unsafe "hs_bindgen_b7dd3e78d24cd30c" hs_bindgen_b7dd3e78d24cd30c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+hs_bindgen_b7dd3e78d24cd30c :: IO (BG.FunPtr (BG.CLong -> IO A))
+hs_bindgen_b7dd3e78d24cd30c =
+  fmap BG.fromFFIType hs_bindgen_b7dd3e78d24cd30c_base
+
+{-# NOINLINE f16 #-}
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16 :: BG.FunPtr (BG.CLong -> IO A)
+f16 = BG.unsafePerformIO hs_bindgen_b7dd3e78d24cd30c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+foreign import ccall unsafe "hs_bindgen_894ff9aa74f040d9" hs_bindgen_894ff9aa74f040d9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+hs_bindgen_894ff9aa74f040d9 :: IO (BG.FunPtr (BG.CLong -> IO A))
+hs_bindgen_894ff9aa74f040d9 =
+  fmap BG.fromFFIType hs_bindgen_894ff9aa74f040d9_base
+
+{-# NOINLINE f17 #-}
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17 :: BG.FunPtr (BG.CLong -> IO A)
+f17 = BG.unsafePerformIO hs_bindgen_894ff9aa74f040d9
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+foreign import ccall unsafe "hs_bindgen_57359ef6c14eb820" hs_bindgen_57359ef6c14eb820_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+hs_bindgen_57359ef6c14eb820 :: IO (BG.FunPtr (BG.CLong -> IO A))
+hs_bindgen_57359ef6c14eb820 =
+  fmap BG.fromFFIType hs_bindgen_57359ef6c14eb820_base
+
+{-# NOINLINE f18 #-}
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18 :: BG.FunPtr (BG.CLong -> IO A)
+f18 = BG.unsafePerformIO hs_bindgen_57359ef6c14eb820
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+foreign import ccall unsafe "hs_bindgen_2173cee7470d34a4" hs_bindgen_2173cee7470d34a4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+hs_bindgen_2173cee7470d34a4 :: IO (BG.FunPtr (BG.CULong -> IO A))
+hs_bindgen_2173cee7470d34a4 =
+  fmap BG.fromFFIType hs_bindgen_2173cee7470d34a4_base
+
+{-# NOINLINE f19 #-}
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19 :: BG.FunPtr (BG.CULong -> IO A)
+f19 = BG.unsafePerformIO hs_bindgen_2173cee7470d34a4
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+foreign import ccall unsafe "hs_bindgen_85dc99217461b608" hs_bindgen_85dc99217461b608_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+hs_bindgen_85dc99217461b608 :: IO (BG.FunPtr (BG.CULong -> IO A))
+hs_bindgen_85dc99217461b608 =
+  fmap BG.fromFFIType hs_bindgen_85dc99217461b608_base
+
+{-# NOINLINE f20 #-}
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20 :: BG.FunPtr (BG.CULong -> IO A)
+f20 = BG.unsafePerformIO hs_bindgen_85dc99217461b608
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+foreign import ccall unsafe "hs_bindgen_350486e538e7ca90" hs_bindgen_350486e538e7ca90_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+hs_bindgen_350486e538e7ca90 :: IO (BG.FunPtr (BG.CLLong -> IO A))
+hs_bindgen_350486e538e7ca90 =
+  fmap BG.fromFFIType hs_bindgen_350486e538e7ca90_base
+
+{-# NOINLINE f21 #-}
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21 :: BG.FunPtr (BG.CLLong -> IO A)
+f21 = BG.unsafePerformIO hs_bindgen_350486e538e7ca90
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+foreign import ccall unsafe "hs_bindgen_ad2c8dc646b29be0" hs_bindgen_ad2c8dc646b29be0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+hs_bindgen_ad2c8dc646b29be0 :: IO (BG.FunPtr (BG.CLLong -> IO A))
+hs_bindgen_ad2c8dc646b29be0 =
+  fmap BG.fromFFIType hs_bindgen_ad2c8dc646b29be0_base
+
+{-# NOINLINE f22 #-}
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22 :: BG.FunPtr (BG.CLLong -> IO A)
+f22 = BG.unsafePerformIO hs_bindgen_ad2c8dc646b29be0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+foreign import ccall unsafe "hs_bindgen_01837bab50ebbe4c" hs_bindgen_01837bab50ebbe4c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+hs_bindgen_01837bab50ebbe4c :: IO (BG.FunPtr (BG.CLLong -> IO A))
+hs_bindgen_01837bab50ebbe4c =
+  fmap BG.fromFFIType hs_bindgen_01837bab50ebbe4c_base
+
+{-# NOINLINE f23 #-}
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23 :: BG.FunPtr (BG.CLLong -> IO A)
+f23 = BG.unsafePerformIO hs_bindgen_01837bab50ebbe4c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+foreign import ccall unsafe "hs_bindgen_051d17dfd1125c86" hs_bindgen_051d17dfd1125c86_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+hs_bindgen_051d17dfd1125c86 :: IO (BG.FunPtr (BG.CLLong -> IO A))
+hs_bindgen_051d17dfd1125c86 =
+  fmap BG.fromFFIType hs_bindgen_051d17dfd1125c86_base
+
+{-# NOINLINE f24 #-}
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24 :: BG.FunPtr (BG.CLLong -> IO A)
+f24 = BG.unsafePerformIO hs_bindgen_051d17dfd1125c86
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+foreign import ccall unsafe "hs_bindgen_ba5dd3a36d6f2756" hs_bindgen_ba5dd3a36d6f2756_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+hs_bindgen_ba5dd3a36d6f2756 :: IO (BG.FunPtr (BG.CULLong -> IO A))
+hs_bindgen_ba5dd3a36d6f2756 =
+  fmap BG.fromFFIType hs_bindgen_ba5dd3a36d6f2756_base
+
+{-# NOINLINE f25 #-}
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25 :: BG.FunPtr (BG.CULLong -> IO A)
+f25 = BG.unsafePerformIO hs_bindgen_ba5dd3a36d6f2756
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+foreign import ccall unsafe "hs_bindgen_22f3b97563fd757f" hs_bindgen_22f3b97563fd757f_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+hs_bindgen_22f3b97563fd757f :: IO (BG.FunPtr (BG.CULLong -> IO A))
+hs_bindgen_22f3b97563fd757f =
+  fmap BG.fromFFIType hs_bindgen_22f3b97563fd757f_base
+
+{-# NOINLINE f26 #-}
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26 :: BG.FunPtr (BG.CULLong -> IO A)
+f26 = BG.unsafePerformIO hs_bindgen_22f3b97563fd757f
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+foreign import ccall unsafe "hs_bindgen_fc81895dfae9b1e5" hs_bindgen_fc81895dfae9b1e5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+hs_bindgen_fc81895dfae9b1e5 :: IO (BG.FunPtr (BG.CFloat -> IO A))
+hs_bindgen_fc81895dfae9b1e5 =
+  fmap BG.fromFFIType hs_bindgen_fc81895dfae9b1e5_base
+
+{-# NOINLINE f27 #-}
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27 :: BG.FunPtr (BG.CFloat -> IO A)
+f27 = BG.unsafePerformIO hs_bindgen_fc81895dfae9b1e5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+foreign import ccall unsafe "hs_bindgen_f95062f509265011" hs_bindgen_f95062f509265011_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+hs_bindgen_f95062f509265011 :: IO (BG.FunPtr (BG.CDouble -> IO A))
+hs_bindgen_f95062f509265011 =
+  fmap BG.fromFFIType hs_bindgen_f95062f509265011_base
+
+{-# NOINLINE f28 #-}
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28 :: BG.FunPtr (BG.CDouble -> IO A)
+f28 = BG.unsafePerformIO hs_bindgen_f95062f509265011
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example/Safe.hs
@@ -0,0 +1,913 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f1
+    , Example.Safe.f2
+    , Example.Safe.f3
+    , Example.Safe.f4
+    , Example.Safe.f5
+    , Example.Safe.f6
+    , Example.Safe.f7
+    , Example.Safe.f8
+    , Example.Safe.f9
+    , Example.Safe.f10
+    , Example.Safe.f11
+    , Example.Safe.f12
+    , Example.Safe.f13
+    , Example.Safe.f14
+    , Example.Safe.f15
+    , Example.Safe.f16
+    , Example.Safe.f17
+    , Example.Safe.f18
+    , Example.Safe.f19
+    , Example.Safe.f20
+    , Example.Safe.f21
+    , Example.Safe.f22
+    , Example.Safe.f23
+    , Example.Safe.f24
+    , Example.Safe.f25
+    , Example.Safe.f26
+    , Example.Safe.f27
+    , Example.Safe.f28
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/arithmetic_types.h>"
+  , "A hs_bindgen_7e7e01d691b1fb2a ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return (f1)(arg1);"
+  , "}"
+  , "A hs_bindgen_91658d4948bcfe06 ("
+  , "  signed char arg1"
+  , ")"
+  , "{"
+  , "  return (f2)(arg1);"
+  , "}"
+  , "A hs_bindgen_40fb57deec0c99d6 ("
+  , "  unsigned char arg1"
+  , ")"
+  , "{"
+  , "  return (f3)(arg1);"
+  , "}"
+  , "A hs_bindgen_d454dc277e0cb86b ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f4)(arg1);"
+  , "}"
+  , "A hs_bindgen_446e834618998df2 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f5)(arg1);"
+  , "}"
+  , "A hs_bindgen_267cc7905b42c66c ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f6)(arg1);"
+  , "}"
+  , "A hs_bindgen_e9eef0af846987d5 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f7)(arg1);"
+  , "}"
+  , "A hs_bindgen_926fbc7f9888d375 ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f8)(arg1);"
+  , "}"
+  , "A hs_bindgen_ec8aef57bd8d53bc ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f9)(arg1);"
+  , "}"
+  , "A hs_bindgen_d0045e58c2a6f1c4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f10)(arg1);"
+  , "}"
+  , "A hs_bindgen_928bc5a3801d9fba ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f11)(arg1);"
+  , "}"
+  , "A hs_bindgen_0efc218270b00ee6 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f12)(arg1);"
+  , "}"
+  , "A hs_bindgen_403a8a02a230ce24 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f13)(arg1);"
+  , "}"
+  , "A hs_bindgen_9371cd597ae3022d ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f14)(arg1);"
+  , "}"
+  , "A hs_bindgen_f07c6429182c10c0 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f15)(arg1);"
+  , "}"
+  , "A hs_bindgen_6af229e466926ec5 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f16)(arg1);"
+  , "}"
+  , "A hs_bindgen_0bc846cbecfd41ba ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f17)(arg1);"
+  , "}"
+  , "A hs_bindgen_0985403200f5a9de ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f18)(arg1);"
+  , "}"
+  , "A hs_bindgen_91ef2c8f3da40e3c ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f19)(arg1);"
+  , "}"
+  , "A hs_bindgen_39b524909ca528b5 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f20)(arg1);"
+  , "}"
+  , "A hs_bindgen_efa4b421b2928f1e ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f21)(arg1);"
+  , "}"
+  , "A hs_bindgen_881c4734d1b436b5 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f22)(arg1);"
+  , "}"
+  , "A hs_bindgen_0ed2a5cf6068b35a ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f23)(arg1);"
+  , "}"
+  , "A hs_bindgen_157ff76d8f7857e2 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f24)(arg1);"
+  , "}"
+  , "A hs_bindgen_6046e1b60a2bdbda ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f25)(arg1);"
+  , "}"
+  , "A hs_bindgen_3f072797069fc217 ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f26)(arg1);"
+  , "}"
+  , "A hs_bindgen_4da0472b80930fbf ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return (f27)(arg1);"
+  , "}"
+  , "A hs_bindgen_98b4d9dc27aecea0 ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (f28)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_7e7e01d691b1fb2a" hs_bindgen_7e7e01d691b1fb2a_base ::
+     BG.CChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+hs_bindgen_7e7e01d691b1fb2a ::
+     BG.CChar
+  -> IO A
+hs_bindgen_7e7e01d691b1fb2a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7e7e01d691b1fb2a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f1 = hs_bindgen_7e7e01d691b1fb2a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_91658d4948bcfe06" hs_bindgen_91658d4948bcfe06_base ::
+     BG.CSChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+hs_bindgen_91658d4948bcfe06 ::
+     BG.CSChar
+  -> IO A
+hs_bindgen_91658d4948bcfe06 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_91658d4948bcfe06_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2 ::
+     BG.CSChar
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f2 = hs_bindgen_91658d4948bcfe06
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_40fb57deec0c99d6" hs_bindgen_40fb57deec0c99d6_base ::
+     BG.CUChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+hs_bindgen_40fb57deec0c99d6 ::
+     BG.CUChar
+  -> IO A
+hs_bindgen_40fb57deec0c99d6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_40fb57deec0c99d6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3 ::
+     BG.CUChar
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f3 = hs_bindgen_40fb57deec0c99d6
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+foreign import ccall safe "hs_bindgen_d454dc277e0cb86b" hs_bindgen_d454dc277e0cb86b_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+hs_bindgen_d454dc277e0cb86b ::
+     BG.CShort
+  -> IO A
+hs_bindgen_d454dc277e0cb86b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d454dc277e0cb86b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f4 = hs_bindgen_d454dc277e0cb86b
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+foreign import ccall safe "hs_bindgen_446e834618998df2" hs_bindgen_446e834618998df2_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+hs_bindgen_446e834618998df2 ::
+     BG.CShort
+  -> IO A
+hs_bindgen_446e834618998df2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_446e834618998df2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f5 = hs_bindgen_446e834618998df2
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+foreign import ccall safe "hs_bindgen_267cc7905b42c66c" hs_bindgen_267cc7905b42c66c_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+hs_bindgen_267cc7905b42c66c ::
+     BG.CShort
+  -> IO A
+hs_bindgen_267cc7905b42c66c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_267cc7905b42c66c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f6 = hs_bindgen_267cc7905b42c66c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+foreign import ccall safe "hs_bindgen_e9eef0af846987d5" hs_bindgen_e9eef0af846987d5_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+hs_bindgen_e9eef0af846987d5 ::
+     BG.CShort
+  -> IO A
+hs_bindgen_e9eef0af846987d5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e9eef0af846987d5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f7 = hs_bindgen_e9eef0af846987d5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+foreign import ccall safe "hs_bindgen_926fbc7f9888d375" hs_bindgen_926fbc7f9888d375_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+hs_bindgen_926fbc7f9888d375 ::
+     BG.CUShort
+  -> IO A
+hs_bindgen_926fbc7f9888d375 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_926fbc7f9888d375_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f8 = hs_bindgen_926fbc7f9888d375
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+foreign import ccall safe "hs_bindgen_ec8aef57bd8d53bc" hs_bindgen_ec8aef57bd8d53bc_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+hs_bindgen_ec8aef57bd8d53bc ::
+     BG.CUShort
+  -> IO A
+hs_bindgen_ec8aef57bd8d53bc =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ec8aef57bd8d53bc_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f9 = hs_bindgen_ec8aef57bd8d53bc
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+foreign import ccall safe "hs_bindgen_d0045e58c2a6f1c4" hs_bindgen_d0045e58c2a6f1c4_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+hs_bindgen_d0045e58c2a6f1c4 ::
+     BG.CInt
+  -> IO A
+hs_bindgen_d0045e58c2a6f1c4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d0045e58c2a6f1c4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f10 = hs_bindgen_d0045e58c2a6f1c4
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+foreign import ccall safe "hs_bindgen_928bc5a3801d9fba" hs_bindgen_928bc5a3801d9fba_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+hs_bindgen_928bc5a3801d9fba ::
+     BG.CInt
+  -> IO A
+hs_bindgen_928bc5a3801d9fba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_928bc5a3801d9fba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f11 = hs_bindgen_928bc5a3801d9fba
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+foreign import ccall safe "hs_bindgen_0efc218270b00ee6" hs_bindgen_0efc218270b00ee6_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+hs_bindgen_0efc218270b00ee6 ::
+     BG.CInt
+  -> IO A
+hs_bindgen_0efc218270b00ee6 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0efc218270b00ee6_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f12 = hs_bindgen_0efc218270b00ee6
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+foreign import ccall safe "hs_bindgen_403a8a02a230ce24" hs_bindgen_403a8a02a230ce24_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+hs_bindgen_403a8a02a230ce24 ::
+     BG.CUInt
+  -> IO A
+hs_bindgen_403a8a02a230ce24 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_403a8a02a230ce24_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f13 = hs_bindgen_403a8a02a230ce24
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+foreign import ccall safe "hs_bindgen_9371cd597ae3022d" hs_bindgen_9371cd597ae3022d_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+hs_bindgen_9371cd597ae3022d ::
+     BG.CUInt
+  -> IO A
+hs_bindgen_9371cd597ae3022d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9371cd597ae3022d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f14 = hs_bindgen_9371cd597ae3022d
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+foreign import ccall safe "hs_bindgen_f07c6429182c10c0" hs_bindgen_f07c6429182c10c0_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+hs_bindgen_f07c6429182c10c0 ::
+     BG.CLong
+  -> IO A
+hs_bindgen_f07c6429182c10c0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f07c6429182c10c0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f15 = hs_bindgen_f07c6429182c10c0
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+foreign import ccall safe "hs_bindgen_6af229e466926ec5" hs_bindgen_6af229e466926ec5_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+hs_bindgen_6af229e466926ec5 ::
+     BG.CLong
+  -> IO A
+hs_bindgen_6af229e466926ec5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6af229e466926ec5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f16 = hs_bindgen_6af229e466926ec5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+foreign import ccall safe "hs_bindgen_0bc846cbecfd41ba" hs_bindgen_0bc846cbecfd41ba_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+hs_bindgen_0bc846cbecfd41ba ::
+     BG.CLong
+  -> IO A
+hs_bindgen_0bc846cbecfd41ba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0bc846cbecfd41ba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f17 = hs_bindgen_0bc846cbecfd41ba
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+foreign import ccall safe "hs_bindgen_0985403200f5a9de" hs_bindgen_0985403200f5a9de_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+hs_bindgen_0985403200f5a9de ::
+     BG.CLong
+  -> IO A
+hs_bindgen_0985403200f5a9de =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0985403200f5a9de_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f18 = hs_bindgen_0985403200f5a9de
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+foreign import ccall safe "hs_bindgen_91ef2c8f3da40e3c" hs_bindgen_91ef2c8f3da40e3c_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+hs_bindgen_91ef2c8f3da40e3c ::
+     BG.CULong
+  -> IO A
+hs_bindgen_91ef2c8f3da40e3c =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_91ef2c8f3da40e3c_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f19 = hs_bindgen_91ef2c8f3da40e3c
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+foreign import ccall safe "hs_bindgen_39b524909ca528b5" hs_bindgen_39b524909ca528b5_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+hs_bindgen_39b524909ca528b5 ::
+     BG.CULong
+  -> IO A
+hs_bindgen_39b524909ca528b5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_39b524909ca528b5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f20 = hs_bindgen_39b524909ca528b5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+foreign import ccall safe "hs_bindgen_efa4b421b2928f1e" hs_bindgen_efa4b421b2928f1e_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+hs_bindgen_efa4b421b2928f1e ::
+     BG.CLLong
+  -> IO A
+hs_bindgen_efa4b421b2928f1e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_efa4b421b2928f1e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f21 = hs_bindgen_efa4b421b2928f1e
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+foreign import ccall safe "hs_bindgen_881c4734d1b436b5" hs_bindgen_881c4734d1b436b5_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+hs_bindgen_881c4734d1b436b5 ::
+     BG.CLLong
+  -> IO A
+hs_bindgen_881c4734d1b436b5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_881c4734d1b436b5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f22 = hs_bindgen_881c4734d1b436b5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+foreign import ccall safe "hs_bindgen_0ed2a5cf6068b35a" hs_bindgen_0ed2a5cf6068b35a_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+hs_bindgen_0ed2a5cf6068b35a ::
+     BG.CLLong
+  -> IO A
+hs_bindgen_0ed2a5cf6068b35a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0ed2a5cf6068b35a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f23 = hs_bindgen_0ed2a5cf6068b35a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+foreign import ccall safe "hs_bindgen_157ff76d8f7857e2" hs_bindgen_157ff76d8f7857e2_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+hs_bindgen_157ff76d8f7857e2 ::
+     BG.CLLong
+  -> IO A
+hs_bindgen_157ff76d8f7857e2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_157ff76d8f7857e2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f24 = hs_bindgen_157ff76d8f7857e2
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+foreign import ccall safe "hs_bindgen_6046e1b60a2bdbda" hs_bindgen_6046e1b60a2bdbda_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+hs_bindgen_6046e1b60a2bdbda ::
+     BG.CULLong
+  -> IO A
+hs_bindgen_6046e1b60a2bdbda =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6046e1b60a2bdbda_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f25 = hs_bindgen_6046e1b60a2bdbda
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+foreign import ccall safe "hs_bindgen_3f072797069fc217" hs_bindgen_3f072797069fc217_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+hs_bindgen_3f072797069fc217 ::
+     BG.CULLong
+  -> IO A
+hs_bindgen_3f072797069fc217 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3f072797069fc217_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f26 = hs_bindgen_3f072797069fc217
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+foreign import ccall safe "hs_bindgen_4da0472b80930fbf" hs_bindgen_4da0472b80930fbf_base ::
+     BG.CFloat
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+hs_bindgen_4da0472b80930fbf ::
+     BG.CFloat
+  -> IO A
+hs_bindgen_4da0472b80930fbf =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4da0472b80930fbf_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f27 = hs_bindgen_4da0472b80930fbf
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+foreign import ccall safe "hs_bindgen_98b4d9dc27aecea0" hs_bindgen_98b4d9dc27aecea0_base ::
+     BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+hs_bindgen_98b4d9dc27aecea0 ::
+     BG.CDouble
+  -> IO A
+hs_bindgen_98b4d9dc27aecea0 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_98b4d9dc27aecea0_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28 ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f28 = hs_bindgen_98b4d9dc27aecea0
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types/Example/Unsafe.hs
@@ -0,0 +1,913 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f1
+    , Example.Unsafe.f2
+    , Example.Unsafe.f3
+    , Example.Unsafe.f4
+    , Example.Unsafe.f5
+    , Example.Unsafe.f6
+    , Example.Unsafe.f7
+    , Example.Unsafe.f8
+    , Example.Unsafe.f9
+    , Example.Unsafe.f10
+    , Example.Unsafe.f11
+    , Example.Unsafe.f12
+    , Example.Unsafe.f13
+    , Example.Unsafe.f14
+    , Example.Unsafe.f15
+    , Example.Unsafe.f16
+    , Example.Unsafe.f17
+    , Example.Unsafe.f18
+    , Example.Unsafe.f19
+    , Example.Unsafe.f20
+    , Example.Unsafe.f21
+    , Example.Unsafe.f22
+    , Example.Unsafe.f23
+    , Example.Unsafe.f24
+    , Example.Unsafe.f25
+    , Example.Unsafe.f26
+    , Example.Unsafe.f27
+    , Example.Unsafe.f28
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/arithmetic_types.h>"
+  , "A hs_bindgen_d6e3d8093d108780 ("
+  , "  char arg1"
+  , ")"
+  , "{"
+  , "  return (f1)(arg1);"
+  , "}"
+  , "A hs_bindgen_dc34e6197f6f39df ("
+  , "  signed char arg1"
+  , ")"
+  , "{"
+  , "  return (f2)(arg1);"
+  , "}"
+  , "A hs_bindgen_b642c5b44d663af5 ("
+  , "  unsigned char arg1"
+  , ")"
+  , "{"
+  , "  return (f3)(arg1);"
+  , "}"
+  , "A hs_bindgen_27f5c806bf4593e7 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f4)(arg1);"
+  , "}"
+  , "A hs_bindgen_e8c0eab09a235501 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f5)(arg1);"
+  , "}"
+  , "A hs_bindgen_7925bdb53e040792 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f6)(arg1);"
+  , "}"
+  , "A hs_bindgen_e6eb4efed37c1708 ("
+  , "  signed short arg1"
+  , ")"
+  , "{"
+  , "  return (f7)(arg1);"
+  , "}"
+  , "A hs_bindgen_21cc8ace7d7441bd ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f8)(arg1);"
+  , "}"
+  , "A hs_bindgen_ddca0323ddaaee35 ("
+  , "  unsigned short arg1"
+  , ")"
+  , "{"
+  , "  return (f9)(arg1);"
+  , "}"
+  , "A hs_bindgen_d42a7635d5a1a314 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f10)(arg1);"
+  , "}"
+  , "A hs_bindgen_111c67845229b054 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f11)(arg1);"
+  , "}"
+  , "A hs_bindgen_6c05305fb77f1073 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f12)(arg1);"
+  , "}"
+  , "A hs_bindgen_661a8e9409698789 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f13)(arg1);"
+  , "}"
+  , "A hs_bindgen_3bdf905c84cb8fb9 ("
+  , "  unsigned int arg1"
+  , ")"
+  , "{"
+  , "  return (f14)(arg1);"
+  , "}"
+  , "A hs_bindgen_212883c913884d27 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f15)(arg1);"
+  , "}"
+  , "A hs_bindgen_f72cafc33ec81360 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f16)(arg1);"
+  , "}"
+  , "A hs_bindgen_ea5f62444673cf16 ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f17)(arg1);"
+  , "}"
+  , "A hs_bindgen_9f4e020f892b30cb ("
+  , "  signed long arg1"
+  , ")"
+  , "{"
+  , "  return (f18)(arg1);"
+  , "}"
+  , "A hs_bindgen_47f005495bf88291 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f19)(arg1);"
+  , "}"
+  , "A hs_bindgen_d02703a7ce8fade2 ("
+  , "  unsigned long arg1"
+  , ")"
+  , "{"
+  , "  return (f20)(arg1);"
+  , "}"
+  , "A hs_bindgen_9f98e2aafc8c5a95 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f21)(arg1);"
+  , "}"
+  , "A hs_bindgen_430da5f47172739a ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f22)(arg1);"
+  , "}"
+  , "A hs_bindgen_bd83aa03a61a8a06 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f23)(arg1);"
+  , "}"
+  , "A hs_bindgen_affcee7ffeebbac9 ("
+  , "  signed long long arg1"
+  , ")"
+  , "{"
+  , "  return (f24)(arg1);"
+  , "}"
+  , "A hs_bindgen_b8a7fb0f9add23ab ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f25)(arg1);"
+  , "}"
+  , "A hs_bindgen_377c3e6bd5b69285 ("
+  , "  unsigned long long arg1"
+  , ")"
+  , "{"
+  , "  return (f26)(arg1);"
+  , "}"
+  , "A hs_bindgen_b82bda1eaf8b02ba ("
+  , "  float arg1"
+  , ")"
+  , "{"
+  , "  return (f27)(arg1);"
+  , "}"
+  , "A hs_bindgen_8d36f32587832dae ("
+  , "  double arg1"
+  , ")"
+  , "{"
+  , "  return (f28)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_d6e3d8093d108780" hs_bindgen_d6e3d8093d108780_base ::
+     BG.CChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+hs_bindgen_d6e3d8093d108780 ::
+     BG.CChar
+  -> IO A
+hs_bindgen_d6e3d8093d108780 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d6e3d8093d108780_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1 ::
+     BG.CChar
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f1 = hs_bindgen_d6e3d8093d108780
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_dc34e6197f6f39df" hs_bindgen_dc34e6197f6f39df_base ::
+     BG.CSChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+hs_bindgen_dc34e6197f6f39df ::
+     BG.CSChar
+  -> IO A
+hs_bindgen_dc34e6197f6f39df =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_dc34e6197f6f39df_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2 ::
+     BG.CSChar
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f2 = hs_bindgen_dc34e6197f6f39df
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_b642c5b44d663af5" hs_bindgen_b642c5b44d663af5_base ::
+     BG.CUChar
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+hs_bindgen_b642c5b44d663af5 ::
+     BG.CUChar
+  -> IO A
+hs_bindgen_b642c5b44d663af5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b642c5b44d663af5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3 ::
+     BG.CUChar
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f3 = hs_bindgen_b642c5b44d663af5
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+foreign import ccall unsafe "hs_bindgen_27f5c806bf4593e7" hs_bindgen_27f5c806bf4593e7_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+hs_bindgen_27f5c806bf4593e7 ::
+     BG.CShort
+  -> IO A
+hs_bindgen_27f5c806bf4593e7 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_27f5c806bf4593e7_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f4 = hs_bindgen_27f5c806bf4593e7
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+foreign import ccall unsafe "hs_bindgen_e8c0eab09a235501" hs_bindgen_e8c0eab09a235501_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+hs_bindgen_e8c0eab09a235501 ::
+     BG.CShort
+  -> IO A
+hs_bindgen_e8c0eab09a235501 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e8c0eab09a235501_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f5 = hs_bindgen_e8c0eab09a235501
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+foreign import ccall unsafe "hs_bindgen_7925bdb53e040792" hs_bindgen_7925bdb53e040792_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+hs_bindgen_7925bdb53e040792 ::
+     BG.CShort
+  -> IO A
+hs_bindgen_7925bdb53e040792 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7925bdb53e040792_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f6 = hs_bindgen_7925bdb53e040792
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+foreign import ccall unsafe "hs_bindgen_e6eb4efed37c1708" hs_bindgen_e6eb4efed37c1708_base ::
+     BG.CShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+hs_bindgen_e6eb4efed37c1708 ::
+     BG.CShort
+  -> IO A
+hs_bindgen_e6eb4efed37c1708 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e6eb4efed37c1708_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7 ::
+     BG.CShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f7 = hs_bindgen_e6eb4efed37c1708
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+foreign import ccall unsafe "hs_bindgen_21cc8ace7d7441bd" hs_bindgen_21cc8ace7d7441bd_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+hs_bindgen_21cc8ace7d7441bd ::
+     BG.CUShort
+  -> IO A
+hs_bindgen_21cc8ace7d7441bd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_21cc8ace7d7441bd_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f8 = hs_bindgen_21cc8ace7d7441bd
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+foreign import ccall unsafe "hs_bindgen_ddca0323ddaaee35" hs_bindgen_ddca0323ddaaee35_base ::
+     BG.CUShort
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+hs_bindgen_ddca0323ddaaee35 ::
+     BG.CUShort
+  -> IO A
+hs_bindgen_ddca0323ddaaee35 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ddca0323ddaaee35_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9 ::
+     BG.CUShort
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f9 = hs_bindgen_ddca0323ddaaee35
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+foreign import ccall unsafe "hs_bindgen_d42a7635d5a1a314" hs_bindgen_d42a7635d5a1a314_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+hs_bindgen_d42a7635d5a1a314 ::
+     BG.CInt
+  -> IO A
+hs_bindgen_d42a7635d5a1a314 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d42a7635d5a1a314_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f10 = hs_bindgen_d42a7635d5a1a314
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+foreign import ccall unsafe "hs_bindgen_111c67845229b054" hs_bindgen_111c67845229b054_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+hs_bindgen_111c67845229b054 ::
+     BG.CInt
+  -> IO A
+hs_bindgen_111c67845229b054 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_111c67845229b054_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f11 = hs_bindgen_111c67845229b054
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+foreign import ccall unsafe "hs_bindgen_6c05305fb77f1073" hs_bindgen_6c05305fb77f1073_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+hs_bindgen_6c05305fb77f1073 ::
+     BG.CInt
+  -> IO A
+hs_bindgen_6c05305fb77f1073 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_6c05305fb77f1073_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f12 = hs_bindgen_6c05305fb77f1073
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+foreign import ccall unsafe "hs_bindgen_661a8e9409698789" hs_bindgen_661a8e9409698789_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+hs_bindgen_661a8e9409698789 ::
+     BG.CUInt
+  -> IO A
+hs_bindgen_661a8e9409698789 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_661a8e9409698789_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f13 = hs_bindgen_661a8e9409698789
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+foreign import ccall unsafe "hs_bindgen_3bdf905c84cb8fb9" hs_bindgen_3bdf905c84cb8fb9_base ::
+     BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+hs_bindgen_3bdf905c84cb8fb9 ::
+     BG.CUInt
+  -> IO A
+hs_bindgen_3bdf905c84cb8fb9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3bdf905c84cb8fb9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14 ::
+     BG.CUInt
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f14 = hs_bindgen_3bdf905c84cb8fb9
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+foreign import ccall unsafe "hs_bindgen_212883c913884d27" hs_bindgen_212883c913884d27_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+hs_bindgen_212883c913884d27 ::
+     BG.CLong
+  -> IO A
+hs_bindgen_212883c913884d27 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_212883c913884d27_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f15 = hs_bindgen_212883c913884d27
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+foreign import ccall unsafe "hs_bindgen_f72cafc33ec81360" hs_bindgen_f72cafc33ec81360_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+hs_bindgen_f72cafc33ec81360 ::
+     BG.CLong
+  -> IO A
+hs_bindgen_f72cafc33ec81360 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_f72cafc33ec81360_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f16 = hs_bindgen_f72cafc33ec81360
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+foreign import ccall unsafe "hs_bindgen_ea5f62444673cf16" hs_bindgen_ea5f62444673cf16_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+hs_bindgen_ea5f62444673cf16 ::
+     BG.CLong
+  -> IO A
+hs_bindgen_ea5f62444673cf16 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_ea5f62444673cf16_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f17 = hs_bindgen_ea5f62444673cf16
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+foreign import ccall unsafe "hs_bindgen_9f4e020f892b30cb" hs_bindgen_9f4e020f892b30cb_base ::
+     BG.CLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+hs_bindgen_9f4e020f892b30cb ::
+     BG.CLong
+  -> IO A
+hs_bindgen_9f4e020f892b30cb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9f4e020f892b30cb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18 ::
+     BG.CLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f18 = hs_bindgen_9f4e020f892b30cb
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+foreign import ccall unsafe "hs_bindgen_47f005495bf88291" hs_bindgen_47f005495bf88291_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+hs_bindgen_47f005495bf88291 ::
+     BG.CULong
+  -> IO A
+hs_bindgen_47f005495bf88291 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_47f005495bf88291_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f19 = hs_bindgen_47f005495bf88291
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+foreign import ccall unsafe "hs_bindgen_d02703a7ce8fade2" hs_bindgen_d02703a7ce8fade2_base ::
+     BG.CULong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+hs_bindgen_d02703a7ce8fade2 ::
+     BG.CULong
+  -> IO A
+hs_bindgen_d02703a7ce8fade2 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_d02703a7ce8fade2_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20 ::
+     BG.CULong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f20 = hs_bindgen_d02703a7ce8fade2
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+foreign import ccall unsafe "hs_bindgen_9f98e2aafc8c5a95" hs_bindgen_9f98e2aafc8c5a95_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+hs_bindgen_9f98e2aafc8c5a95 ::
+     BG.CLLong
+  -> IO A
+hs_bindgen_9f98e2aafc8c5a95 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_9f98e2aafc8c5a95_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f21 = hs_bindgen_9f98e2aafc8c5a95
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+foreign import ccall unsafe "hs_bindgen_430da5f47172739a" hs_bindgen_430da5f47172739a_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+hs_bindgen_430da5f47172739a ::
+     BG.CLLong
+  -> IO A
+hs_bindgen_430da5f47172739a =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_430da5f47172739a_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f22 = hs_bindgen_430da5f47172739a
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+foreign import ccall unsafe "hs_bindgen_bd83aa03a61a8a06" hs_bindgen_bd83aa03a61a8a06_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+hs_bindgen_bd83aa03a61a8a06 ::
+     BG.CLLong
+  -> IO A
+hs_bindgen_bd83aa03a61a8a06 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_bd83aa03a61a8a06_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f23 = hs_bindgen_bd83aa03a61a8a06
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+foreign import ccall unsafe "hs_bindgen_affcee7ffeebbac9" hs_bindgen_affcee7ffeebbac9_base ::
+     BG.CLLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+hs_bindgen_affcee7ffeebbac9 ::
+     BG.CLLong
+  -> IO A
+hs_bindgen_affcee7ffeebbac9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_affcee7ffeebbac9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24 ::
+     BG.CLLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f24 = hs_bindgen_affcee7ffeebbac9
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+foreign import ccall unsafe "hs_bindgen_b8a7fb0f9add23ab" hs_bindgen_b8a7fb0f9add23ab_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+hs_bindgen_b8a7fb0f9add23ab ::
+     BG.CULLong
+  -> IO A
+hs_bindgen_b8a7fb0f9add23ab =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b8a7fb0f9add23ab_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f25 = hs_bindgen_b8a7fb0f9add23ab
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+foreign import ccall unsafe "hs_bindgen_377c3e6bd5b69285" hs_bindgen_377c3e6bd5b69285_base ::
+     BG.CULLong
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+hs_bindgen_377c3e6bd5b69285 ::
+     BG.CULLong
+  -> IO A
+hs_bindgen_377c3e6bd5b69285 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_377c3e6bd5b69285_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26 ::
+     BG.CULLong
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f26 = hs_bindgen_377c3e6bd5b69285
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+foreign import ccall unsafe "hs_bindgen_b82bda1eaf8b02ba" hs_bindgen_b82bda1eaf8b02ba_base ::
+     BG.CFloat
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+hs_bindgen_b82bda1eaf8b02ba ::
+     BG.CFloat
+  -> IO A
+hs_bindgen_b82bda1eaf8b02ba =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_b82bda1eaf8b02ba_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27 ::
+     BG.CFloat
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f27 = hs_bindgen_b82bda1eaf8b02ba
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+foreign import ccall unsafe "hs_bindgen_8d36f32587832dae" hs_bindgen_8d36f32587832dae_base ::
+     BG.CDouble
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+hs_bindgen_8d36f32587832dae ::
+     BG.CDouble
+  -> IO A
+hs_bindgen_8d36f32587832dae =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_8d36f32587832dae_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28 ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> IO A
+f28 = hs_bindgen_8d36f32587832dae
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/arithmetic_types/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/arithmetic_types.h
+  cname: macro A
+  hsname: A
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/arithmetic_types/th.txt b/test-artefacts/fixtures/macros/reparse/arithmetic_types/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/arithmetic_types/th.txt
@@ -0,0 +1,2442 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/arithmetic_types.h
+-- #include <macros/reparse/arithmetic_types.h>
+-- A hs_bindgen_7e7e01d691b1fb2a (
+--   char arg1
+-- )
+-- {
+--   return (f1)(arg1);
+-- }
+-- A hs_bindgen_91658d4948bcfe06 (
+--   signed char arg1
+-- )
+-- {
+--   return (f2)(arg1);
+-- }
+-- A hs_bindgen_40fb57deec0c99d6 (
+--   unsigned char arg1
+-- )
+-- {
+--   return (f3)(arg1);
+-- }
+-- A hs_bindgen_d454dc277e0cb86b (
+--   signed short arg1
+-- )
+-- {
+--   return (f4)(arg1);
+-- }
+-- A hs_bindgen_446e834618998df2 (
+--   signed short arg1
+-- )
+-- {
+--   return (f5)(arg1);
+-- }
+-- A hs_bindgen_267cc7905b42c66c (
+--   signed short arg1
+-- )
+-- {
+--   return (f6)(arg1);
+-- }
+-- A hs_bindgen_e9eef0af846987d5 (
+--   signed short arg1
+-- )
+-- {
+--   return (f7)(arg1);
+-- }
+-- A hs_bindgen_926fbc7f9888d375 (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f8)(arg1);
+-- }
+-- A hs_bindgen_ec8aef57bd8d53bc (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f9)(arg1);
+-- }
+-- A hs_bindgen_d0045e58c2a6f1c4 (
+--   signed int arg1
+-- )
+-- {
+--   return (f10)(arg1);
+-- }
+-- A hs_bindgen_928bc5a3801d9fba (
+--   signed int arg1
+-- )
+-- {
+--   return (f11)(arg1);
+-- }
+-- A hs_bindgen_0efc218270b00ee6 (
+--   signed int arg1
+-- )
+-- {
+--   return (f12)(arg1);
+-- }
+-- A hs_bindgen_403a8a02a230ce24 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f13)(arg1);
+-- }
+-- A hs_bindgen_9371cd597ae3022d (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f14)(arg1);
+-- }
+-- A hs_bindgen_f07c6429182c10c0 (
+--   signed long arg1
+-- )
+-- {
+--   return (f15)(arg1);
+-- }
+-- A hs_bindgen_6af229e466926ec5 (
+--   signed long arg1
+-- )
+-- {
+--   return (f16)(arg1);
+-- }
+-- A hs_bindgen_0bc846cbecfd41ba (
+--   signed long arg1
+-- )
+-- {
+--   return (f17)(arg1);
+-- }
+-- A hs_bindgen_0985403200f5a9de (
+--   signed long arg1
+-- )
+-- {
+--   return (f18)(arg1);
+-- }
+-- A hs_bindgen_91ef2c8f3da40e3c (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f19)(arg1);
+-- }
+-- A hs_bindgen_39b524909ca528b5 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f20)(arg1);
+-- }
+-- A hs_bindgen_efa4b421b2928f1e (
+--   signed long long arg1
+-- )
+-- {
+--   return (f21)(arg1);
+-- }
+-- A hs_bindgen_881c4734d1b436b5 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f22)(arg1);
+-- }
+-- A hs_bindgen_0ed2a5cf6068b35a (
+--   signed long long arg1
+-- )
+-- {
+--   return (f23)(arg1);
+-- }
+-- A hs_bindgen_157ff76d8f7857e2 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f24)(arg1);
+-- }
+-- A hs_bindgen_6046e1b60a2bdbda (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f25)(arg1);
+-- }
+-- A hs_bindgen_3f072797069fc217 (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f26)(arg1);
+-- }
+-- A hs_bindgen_4da0472b80930fbf (
+--   float arg1
+-- )
+-- {
+--   return (f27)(arg1);
+-- }
+-- A hs_bindgen_98b4d9dc27aecea0 (
+--   double arg1
+-- )
+-- {
+--   return (f28)(arg1);
+-- }
+-- A hs_bindgen_d6e3d8093d108780 (
+--   char arg1
+-- )
+-- {
+--   return (f1)(arg1);
+-- }
+-- A hs_bindgen_dc34e6197f6f39df (
+--   signed char arg1
+-- )
+-- {
+--   return (f2)(arg1);
+-- }
+-- A hs_bindgen_b642c5b44d663af5 (
+--   unsigned char arg1
+-- )
+-- {
+--   return (f3)(arg1);
+-- }
+-- A hs_bindgen_27f5c806bf4593e7 (
+--   signed short arg1
+-- )
+-- {
+--   return (f4)(arg1);
+-- }
+-- A hs_bindgen_e8c0eab09a235501 (
+--   signed short arg1
+-- )
+-- {
+--   return (f5)(arg1);
+-- }
+-- A hs_bindgen_7925bdb53e040792 (
+--   signed short arg1
+-- )
+-- {
+--   return (f6)(arg1);
+-- }
+-- A hs_bindgen_e6eb4efed37c1708 (
+--   signed short arg1
+-- )
+-- {
+--   return (f7)(arg1);
+-- }
+-- A hs_bindgen_21cc8ace7d7441bd (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f8)(arg1);
+-- }
+-- A hs_bindgen_ddca0323ddaaee35 (
+--   unsigned short arg1
+-- )
+-- {
+--   return (f9)(arg1);
+-- }
+-- A hs_bindgen_d42a7635d5a1a314 (
+--   signed int arg1
+-- )
+-- {
+--   return (f10)(arg1);
+-- }
+-- A hs_bindgen_111c67845229b054 (
+--   signed int arg1
+-- )
+-- {
+--   return (f11)(arg1);
+-- }
+-- A hs_bindgen_6c05305fb77f1073 (
+--   signed int arg1
+-- )
+-- {
+--   return (f12)(arg1);
+-- }
+-- A hs_bindgen_661a8e9409698789 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f13)(arg1);
+-- }
+-- A hs_bindgen_3bdf905c84cb8fb9 (
+--   unsigned int arg1
+-- )
+-- {
+--   return (f14)(arg1);
+-- }
+-- A hs_bindgen_212883c913884d27 (
+--   signed long arg1
+-- )
+-- {
+--   return (f15)(arg1);
+-- }
+-- A hs_bindgen_f72cafc33ec81360 (
+--   signed long arg1
+-- )
+-- {
+--   return (f16)(arg1);
+-- }
+-- A hs_bindgen_ea5f62444673cf16 (
+--   signed long arg1
+-- )
+-- {
+--   return (f17)(arg1);
+-- }
+-- A hs_bindgen_9f4e020f892b30cb (
+--   signed long arg1
+-- )
+-- {
+--   return (f18)(arg1);
+-- }
+-- A hs_bindgen_47f005495bf88291 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f19)(arg1);
+-- }
+-- A hs_bindgen_d02703a7ce8fade2 (
+--   unsigned long arg1
+-- )
+-- {
+--   return (f20)(arg1);
+-- }
+-- A hs_bindgen_9f98e2aafc8c5a95 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f21)(arg1);
+-- }
+-- A hs_bindgen_430da5f47172739a (
+--   signed long long arg1
+-- )
+-- {
+--   return (f22)(arg1);
+-- }
+-- A hs_bindgen_bd83aa03a61a8a06 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f23)(arg1);
+-- }
+-- A hs_bindgen_affcee7ffeebbac9 (
+--   signed long long arg1
+-- )
+-- {
+--   return (f24)(arg1);
+-- }
+-- A hs_bindgen_b8a7fb0f9add23ab (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f25)(arg1);
+-- }
+-- A hs_bindgen_377c3e6bd5b69285 (
+--   unsigned long long arg1
+-- )
+-- {
+--   return (f26)(arg1);
+-- }
+-- A hs_bindgen_b82bda1eaf8b02ba (
+--   float arg1
+-- )
+-- {
+--   return (f27)(arg1);
+-- }
+-- A hs_bindgen_8d36f32587832dae (
+--   double arg1
+-- )
+-- {
+--   return (f28)(arg1);
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f1 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_1208d85624465c51 (void)) (
+--   char arg1
+-- )
+-- {
+--   return &f1;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f2 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_90bf738ed6e126cf (void)) (
+--   signed char arg1
+-- )
+-- {
+--   return &f2;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f3 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_541fb107a8c068d0 (void)) (
+--   unsigned char arg1
+-- )
+-- {
+--   return &f3;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f4 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_695a21f5c624ca64 (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f4;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f5 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_43491bdffe43bbe1 (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f5;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f6 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_ffafdd943146661a (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f6;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f7 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_7c6250122a3c59a3 (void)) (
+--   signed short arg1
+-- )
+-- {
+--   return &f7;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f8 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_60cbc6e072d14643 (void)) (
+--   unsigned short arg1
+-- )
+-- {
+--   return &f8;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f9 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_fa356fa03c563829 (void)) (
+--   unsigned short arg1
+-- )
+-- {
+--   return &f9;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f10 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_6971f14ec2033453 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f10;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f11 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_18e46ae0dfd9dbe0 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f11;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f12 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_0c1c36784fe71810 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f12;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f13 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_8d9bec0d1944b558 (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &f13;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f14 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_796f92f5831916a6 (void)) (
+--   unsigned int arg1
+-- )
+-- {
+--   return &f14;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f15 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_2cb6292b4cc8f420 (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f15;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f16 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_b7dd3e78d24cd30c (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f16;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f17 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_894ff9aa74f040d9 (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f17;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f18 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_57359ef6c14eb820 (void)) (
+--   signed long arg1
+-- )
+-- {
+--   return &f18;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f19 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_2173cee7470d34a4 (void)) (
+--   unsigned long arg1
+-- )
+-- {
+--   return &f19;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f20 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_85dc99217461b608 (void)) (
+--   unsigned long arg1
+-- )
+-- {
+--   return &f20;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f21 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_350486e538e7ca90 (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f21;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f22 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_ad2c8dc646b29be0 (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f22;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f23 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_01837bab50ebbe4c (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f23;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f24 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_051d17dfd1125c86 (void)) (
+--   signed long long arg1
+-- )
+-- {
+--   return &f24;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f25 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_ba5dd3a36d6f2756 (void)) (
+--   unsigned long long arg1
+-- )
+-- {
+--   return &f25;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f26 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_22f3b97563fd757f (void)) (
+--   unsigned long long arg1
+-- )
+-- {
+--   return &f26;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f27 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_fc81895dfae9b1e5 (void)) (
+--   float arg1
+-- )
+-- {
+--   return &f27;
+-- }
+-- /* test_macrosreparsearithmetic_type_Example_get_f28 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_f95062f509265011 (void)) (
+--   double arg1
+-- )
+-- {
+--   return &f28;
+-- }
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 16:9@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+newtype A
+    = A {unwrapA :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty CInt => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+foreign import ccall safe "hs_bindgen_7e7e01d691b1fb2a" hs_bindgen_7e7e01d691b1fb2a_base ::
+    CChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+hs_bindgen_7e7e01d691b1fb2a :: CChar -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f1@
+hs_bindgen_7e7e01d691b1fb2a = \x_0 -> fmap fromFFIType (hs_bindgen_7e7e01d691b1fb2a_base (toFFIType x_0))
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_safe :: CChar -> IO A
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_safe = hs_bindgen_7e7e01d691b1fb2a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+foreign import ccall safe "hs_bindgen_91658d4948bcfe06" hs_bindgen_91658d4948bcfe06_base ::
+    CSChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+hs_bindgen_91658d4948bcfe06 :: CSChar -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f2@
+hs_bindgen_91658d4948bcfe06 = \x_0 -> fmap fromFFIType (hs_bindgen_91658d4948bcfe06_base (toFFIType x_0))
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_safe :: CSChar -> IO A
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_safe = hs_bindgen_91658d4948bcfe06
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+foreign import ccall safe "hs_bindgen_40fb57deec0c99d6" hs_bindgen_40fb57deec0c99d6_base ::
+    CUChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+hs_bindgen_40fb57deec0c99d6 :: CUChar -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f3@
+hs_bindgen_40fb57deec0c99d6 = \x_0 -> fmap fromFFIType (hs_bindgen_40fb57deec0c99d6_base (toFFIType x_0))
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_safe :: CUChar -> IO A
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_safe = hs_bindgen_40fb57deec0c99d6
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+foreign import ccall safe "hs_bindgen_d454dc277e0cb86b" hs_bindgen_d454dc277e0cb86b_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+hs_bindgen_d454dc277e0cb86b :: CShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f4@
+hs_bindgen_d454dc277e0cb86b = \x_0 -> fmap fromFFIType (hs_bindgen_d454dc277e0cb86b_base (toFFIType x_0))
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_safe :: CShort -> IO A
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_safe = hs_bindgen_d454dc277e0cb86b
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+foreign import ccall safe "hs_bindgen_446e834618998df2" hs_bindgen_446e834618998df2_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+hs_bindgen_446e834618998df2 :: CShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f5@
+hs_bindgen_446e834618998df2 = \x_0 -> fmap fromFFIType (hs_bindgen_446e834618998df2_base (toFFIType x_0))
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_safe :: CShort -> IO A
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_safe = hs_bindgen_446e834618998df2
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+foreign import ccall safe "hs_bindgen_267cc7905b42c66c" hs_bindgen_267cc7905b42c66c_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+hs_bindgen_267cc7905b42c66c :: CShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f6@
+hs_bindgen_267cc7905b42c66c = \x_0 -> fmap fromFFIType (hs_bindgen_267cc7905b42c66c_base (toFFIType x_0))
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_safe :: CShort -> IO A
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_safe = hs_bindgen_267cc7905b42c66c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+foreign import ccall safe "hs_bindgen_e9eef0af846987d5" hs_bindgen_e9eef0af846987d5_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+hs_bindgen_e9eef0af846987d5 :: CShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f7@
+hs_bindgen_e9eef0af846987d5 = \x_0 -> fmap fromFFIType (hs_bindgen_e9eef0af846987d5_base (toFFIType x_0))
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_safe :: CShort -> IO A
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_safe = hs_bindgen_e9eef0af846987d5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+foreign import ccall safe "hs_bindgen_926fbc7f9888d375" hs_bindgen_926fbc7f9888d375_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+hs_bindgen_926fbc7f9888d375 :: CUShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f8@
+hs_bindgen_926fbc7f9888d375 = \x_0 -> fmap fromFFIType (hs_bindgen_926fbc7f9888d375_base (toFFIType x_0))
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_safe :: CUShort -> IO A
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_safe = hs_bindgen_926fbc7f9888d375
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+foreign import ccall safe "hs_bindgen_ec8aef57bd8d53bc" hs_bindgen_ec8aef57bd8d53bc_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+hs_bindgen_ec8aef57bd8d53bc :: CUShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f9@
+hs_bindgen_ec8aef57bd8d53bc = \x_0 -> fmap fromFFIType (hs_bindgen_ec8aef57bd8d53bc_base (toFFIType x_0))
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_safe :: CUShort -> IO A
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_safe = hs_bindgen_ec8aef57bd8d53bc
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+foreign import ccall safe "hs_bindgen_d0045e58c2a6f1c4" hs_bindgen_d0045e58c2a6f1c4_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+hs_bindgen_d0045e58c2a6f1c4 :: CInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f10@
+hs_bindgen_d0045e58c2a6f1c4 = \x_0 -> fmap fromFFIType (hs_bindgen_d0045e58c2a6f1c4_base (toFFIType x_0))
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_safe :: CInt -> IO A
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_safe = hs_bindgen_d0045e58c2a6f1c4
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+foreign import ccall safe "hs_bindgen_928bc5a3801d9fba" hs_bindgen_928bc5a3801d9fba_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+hs_bindgen_928bc5a3801d9fba :: CInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f11@
+hs_bindgen_928bc5a3801d9fba = \x_0 -> fmap fromFFIType (hs_bindgen_928bc5a3801d9fba_base (toFFIType x_0))
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_safe :: CInt -> IO A
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_safe = hs_bindgen_928bc5a3801d9fba
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+foreign import ccall safe "hs_bindgen_0efc218270b00ee6" hs_bindgen_0efc218270b00ee6_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+hs_bindgen_0efc218270b00ee6 :: CInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f12@
+hs_bindgen_0efc218270b00ee6 = \x_0 -> fmap fromFFIType (hs_bindgen_0efc218270b00ee6_base (toFFIType x_0))
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_safe :: CInt -> IO A
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_safe = hs_bindgen_0efc218270b00ee6
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+foreign import ccall safe "hs_bindgen_403a8a02a230ce24" hs_bindgen_403a8a02a230ce24_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+hs_bindgen_403a8a02a230ce24 :: CUInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f13@
+hs_bindgen_403a8a02a230ce24 = \x_0 -> fmap fromFFIType (hs_bindgen_403a8a02a230ce24_base (toFFIType x_0))
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_safe :: CUInt -> IO A
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_safe = hs_bindgen_403a8a02a230ce24
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+foreign import ccall safe "hs_bindgen_9371cd597ae3022d" hs_bindgen_9371cd597ae3022d_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+hs_bindgen_9371cd597ae3022d :: CUInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f14@
+hs_bindgen_9371cd597ae3022d = \x_0 -> fmap fromFFIType (hs_bindgen_9371cd597ae3022d_base (toFFIType x_0))
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_safe :: CUInt -> IO A
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_safe = hs_bindgen_9371cd597ae3022d
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+foreign import ccall safe "hs_bindgen_f07c6429182c10c0" hs_bindgen_f07c6429182c10c0_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+hs_bindgen_f07c6429182c10c0 :: CLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f15@
+hs_bindgen_f07c6429182c10c0 = \x_0 -> fmap fromFFIType (hs_bindgen_f07c6429182c10c0_base (toFFIType x_0))
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_safe :: CLong -> IO A
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_safe = hs_bindgen_f07c6429182c10c0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+foreign import ccall safe "hs_bindgen_6af229e466926ec5" hs_bindgen_6af229e466926ec5_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+hs_bindgen_6af229e466926ec5 :: CLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f16@
+hs_bindgen_6af229e466926ec5 = \x_0 -> fmap fromFFIType (hs_bindgen_6af229e466926ec5_base (toFFIType x_0))
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_safe :: CLong -> IO A
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_safe = hs_bindgen_6af229e466926ec5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+foreign import ccall safe "hs_bindgen_0bc846cbecfd41ba" hs_bindgen_0bc846cbecfd41ba_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+hs_bindgen_0bc846cbecfd41ba :: CLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f17@
+hs_bindgen_0bc846cbecfd41ba = \x_0 -> fmap fromFFIType (hs_bindgen_0bc846cbecfd41ba_base (toFFIType x_0))
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_safe :: CLong -> IO A
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_safe = hs_bindgen_0bc846cbecfd41ba
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+foreign import ccall safe "hs_bindgen_0985403200f5a9de" hs_bindgen_0985403200f5a9de_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+hs_bindgen_0985403200f5a9de :: CLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f18@
+hs_bindgen_0985403200f5a9de = \x_0 -> fmap fromFFIType (hs_bindgen_0985403200f5a9de_base (toFFIType x_0))
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_safe :: CLong -> IO A
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_safe = hs_bindgen_0985403200f5a9de
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+foreign import ccall safe "hs_bindgen_91ef2c8f3da40e3c" hs_bindgen_91ef2c8f3da40e3c_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+hs_bindgen_91ef2c8f3da40e3c :: CULong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f19@
+hs_bindgen_91ef2c8f3da40e3c = \x_0 -> fmap fromFFIType (hs_bindgen_91ef2c8f3da40e3c_base (toFFIType x_0))
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_safe :: CULong -> IO A
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_safe = hs_bindgen_91ef2c8f3da40e3c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+foreign import ccall safe "hs_bindgen_39b524909ca528b5" hs_bindgen_39b524909ca528b5_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+hs_bindgen_39b524909ca528b5 :: CULong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f20@
+hs_bindgen_39b524909ca528b5 = \x_0 -> fmap fromFFIType (hs_bindgen_39b524909ca528b5_base (toFFIType x_0))
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_safe :: CULong -> IO A
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_safe = hs_bindgen_39b524909ca528b5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+foreign import ccall safe "hs_bindgen_efa4b421b2928f1e" hs_bindgen_efa4b421b2928f1e_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+hs_bindgen_efa4b421b2928f1e :: CLLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f21@
+hs_bindgen_efa4b421b2928f1e = \x_0 -> fmap fromFFIType (hs_bindgen_efa4b421b2928f1e_base (toFFIType x_0))
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_safe :: CLLong -> IO A
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_safe = hs_bindgen_efa4b421b2928f1e
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+foreign import ccall safe "hs_bindgen_881c4734d1b436b5" hs_bindgen_881c4734d1b436b5_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+hs_bindgen_881c4734d1b436b5 :: CLLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f22@
+hs_bindgen_881c4734d1b436b5 = \x_0 -> fmap fromFFIType (hs_bindgen_881c4734d1b436b5_base (toFFIType x_0))
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_safe :: CLLong -> IO A
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_safe = hs_bindgen_881c4734d1b436b5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+foreign import ccall safe "hs_bindgen_0ed2a5cf6068b35a" hs_bindgen_0ed2a5cf6068b35a_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+hs_bindgen_0ed2a5cf6068b35a :: CLLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f23@
+hs_bindgen_0ed2a5cf6068b35a = \x_0 -> fmap fromFFIType (hs_bindgen_0ed2a5cf6068b35a_base (toFFIType x_0))
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_safe :: CLLong -> IO A
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_safe = hs_bindgen_0ed2a5cf6068b35a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+foreign import ccall safe "hs_bindgen_157ff76d8f7857e2" hs_bindgen_157ff76d8f7857e2_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+hs_bindgen_157ff76d8f7857e2 :: CLLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f24@
+hs_bindgen_157ff76d8f7857e2 = \x_0 -> fmap fromFFIType (hs_bindgen_157ff76d8f7857e2_base (toFFIType x_0))
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_safe :: CLLong -> IO A
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_safe = hs_bindgen_157ff76d8f7857e2
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+foreign import ccall safe "hs_bindgen_6046e1b60a2bdbda" hs_bindgen_6046e1b60a2bdbda_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+hs_bindgen_6046e1b60a2bdbda :: CULLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f25@
+hs_bindgen_6046e1b60a2bdbda = \x_0 -> fmap fromFFIType (hs_bindgen_6046e1b60a2bdbda_base (toFFIType x_0))
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_safe :: CULLong -> IO A
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_safe = hs_bindgen_6046e1b60a2bdbda
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+foreign import ccall safe "hs_bindgen_3f072797069fc217" hs_bindgen_3f072797069fc217_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+hs_bindgen_3f072797069fc217 :: CULLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f26@
+hs_bindgen_3f072797069fc217 = \x_0 -> fmap fromFFIType (hs_bindgen_3f072797069fc217_base (toFFIType x_0))
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_safe :: CULLong -> IO A
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_safe = hs_bindgen_3f072797069fc217
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+foreign import ccall safe "hs_bindgen_4da0472b80930fbf" hs_bindgen_4da0472b80930fbf_base ::
+    CFloat
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+hs_bindgen_4da0472b80930fbf :: CFloat -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f27@
+hs_bindgen_4da0472b80930fbf = \x_0 -> fmap fromFFIType (hs_bindgen_4da0472b80930fbf_base (toFFIType x_0))
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_safe :: CFloat -> IO A
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_safe = hs_bindgen_4da0472b80930fbf
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+foreign import ccall safe "hs_bindgen_98b4d9dc27aecea0" hs_bindgen_98b4d9dc27aecea0_base ::
+    CDouble
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+hs_bindgen_98b4d9dc27aecea0 :: CDouble -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Safe_f28@
+hs_bindgen_98b4d9dc27aecea0 = \x_0 -> fmap fromFFIType (hs_bindgen_98b4d9dc27aecea0_base (toFFIType x_0))
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_safe :: CDouble -> IO A
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_safe = hs_bindgen_98b4d9dc27aecea0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+foreign import ccall unsafe "hs_bindgen_d6e3d8093d108780" hs_bindgen_d6e3d8093d108780_base ::
+    CChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+hs_bindgen_d6e3d8093d108780 :: CChar -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f1@
+hs_bindgen_d6e3d8093d108780 = \x_0 -> fmap fromFFIType (hs_bindgen_d6e3d8093d108780_base (toFFIType x_0))
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_unsafe :: CChar -> IO A
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_unsafe = hs_bindgen_d6e3d8093d108780
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+foreign import ccall unsafe "hs_bindgen_dc34e6197f6f39df" hs_bindgen_dc34e6197f6f39df_base ::
+    CSChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+hs_bindgen_dc34e6197f6f39df :: CSChar -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f2@
+hs_bindgen_dc34e6197f6f39df = \x_0 -> fmap fromFFIType (hs_bindgen_dc34e6197f6f39df_base (toFFIType x_0))
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_unsafe :: CSChar -> IO A
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_unsafe = hs_bindgen_dc34e6197f6f39df
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+foreign import ccall unsafe "hs_bindgen_b642c5b44d663af5" hs_bindgen_b642c5b44d663af5_base ::
+    CUChar
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+hs_bindgen_b642c5b44d663af5 :: CUChar -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f3@
+hs_bindgen_b642c5b44d663af5 = \x_0 -> fmap fromFFIType (hs_bindgen_b642c5b44d663af5_base (toFFIType x_0))
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_unsafe :: CUChar -> IO A
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_unsafe = hs_bindgen_b642c5b44d663af5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+foreign import ccall unsafe "hs_bindgen_27f5c806bf4593e7" hs_bindgen_27f5c806bf4593e7_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+hs_bindgen_27f5c806bf4593e7 :: CShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f4@
+hs_bindgen_27f5c806bf4593e7 = \x_0 -> fmap fromFFIType (hs_bindgen_27f5c806bf4593e7_base (toFFIType x_0))
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_unsafe :: CShort -> IO A
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_unsafe = hs_bindgen_27f5c806bf4593e7
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+foreign import ccall unsafe "hs_bindgen_e8c0eab09a235501" hs_bindgen_e8c0eab09a235501_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+hs_bindgen_e8c0eab09a235501 :: CShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f5@
+hs_bindgen_e8c0eab09a235501 = \x_0 -> fmap fromFFIType (hs_bindgen_e8c0eab09a235501_base (toFFIType x_0))
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_unsafe :: CShort -> IO A
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_unsafe = hs_bindgen_e8c0eab09a235501
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+foreign import ccall unsafe "hs_bindgen_7925bdb53e040792" hs_bindgen_7925bdb53e040792_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+hs_bindgen_7925bdb53e040792 :: CShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f6@
+hs_bindgen_7925bdb53e040792 = \x_0 -> fmap fromFFIType (hs_bindgen_7925bdb53e040792_base (toFFIType x_0))
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_unsafe :: CShort -> IO A
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_unsafe = hs_bindgen_7925bdb53e040792
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+foreign import ccall unsafe "hs_bindgen_e6eb4efed37c1708" hs_bindgen_e6eb4efed37c1708_base ::
+    CShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+hs_bindgen_e6eb4efed37c1708 :: CShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f7@
+hs_bindgen_e6eb4efed37c1708 = \x_0 -> fmap fromFFIType (hs_bindgen_e6eb4efed37c1708_base (toFFIType x_0))
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_unsafe :: CShort -> IO A
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_unsafe = hs_bindgen_e6eb4efed37c1708
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+foreign import ccall unsafe "hs_bindgen_21cc8ace7d7441bd" hs_bindgen_21cc8ace7d7441bd_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+hs_bindgen_21cc8ace7d7441bd :: CUShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f8@
+hs_bindgen_21cc8ace7d7441bd = \x_0 -> fmap fromFFIType (hs_bindgen_21cc8ace7d7441bd_base (toFFIType x_0))
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_unsafe :: CUShort -> IO A
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_unsafe = hs_bindgen_21cc8ace7d7441bd
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+foreign import ccall unsafe "hs_bindgen_ddca0323ddaaee35" hs_bindgen_ddca0323ddaaee35_base ::
+    CUShort
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+hs_bindgen_ddca0323ddaaee35 :: CUShort -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f9@
+hs_bindgen_ddca0323ddaaee35 = \x_0 -> fmap fromFFIType (hs_bindgen_ddca0323ddaaee35_base (toFFIType x_0))
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_unsafe :: CUShort -> IO A
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_unsafe = hs_bindgen_ddca0323ddaaee35
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+foreign import ccall unsafe "hs_bindgen_d42a7635d5a1a314" hs_bindgen_d42a7635d5a1a314_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+hs_bindgen_d42a7635d5a1a314 :: CInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f10@
+hs_bindgen_d42a7635d5a1a314 = \x_0 -> fmap fromFFIType (hs_bindgen_d42a7635d5a1a314_base (toFFIType x_0))
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_unsafe :: CInt -> IO A
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_unsafe = hs_bindgen_d42a7635d5a1a314
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+foreign import ccall unsafe "hs_bindgen_111c67845229b054" hs_bindgen_111c67845229b054_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+hs_bindgen_111c67845229b054 :: CInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f11@
+hs_bindgen_111c67845229b054 = \x_0 -> fmap fromFFIType (hs_bindgen_111c67845229b054_base (toFFIType x_0))
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_unsafe :: CInt -> IO A
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_unsafe = hs_bindgen_111c67845229b054
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+foreign import ccall unsafe "hs_bindgen_6c05305fb77f1073" hs_bindgen_6c05305fb77f1073_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+hs_bindgen_6c05305fb77f1073 :: CInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f12@
+hs_bindgen_6c05305fb77f1073 = \x_0 -> fmap fromFFIType (hs_bindgen_6c05305fb77f1073_base (toFFIType x_0))
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_unsafe :: CInt -> IO A
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_unsafe = hs_bindgen_6c05305fb77f1073
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+foreign import ccall unsafe "hs_bindgen_661a8e9409698789" hs_bindgen_661a8e9409698789_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+hs_bindgen_661a8e9409698789 :: CUInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f13@
+hs_bindgen_661a8e9409698789 = \x_0 -> fmap fromFFIType (hs_bindgen_661a8e9409698789_base (toFFIType x_0))
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_unsafe :: CUInt -> IO A
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_unsafe = hs_bindgen_661a8e9409698789
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+foreign import ccall unsafe "hs_bindgen_3bdf905c84cb8fb9" hs_bindgen_3bdf905c84cb8fb9_base ::
+    CUInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+hs_bindgen_3bdf905c84cb8fb9 :: CUInt -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f14@
+hs_bindgen_3bdf905c84cb8fb9 = \x_0 -> fmap fromFFIType (hs_bindgen_3bdf905c84cb8fb9_base (toFFIType x_0))
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_unsafe :: CUInt -> IO A
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_unsafe = hs_bindgen_3bdf905c84cb8fb9
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+foreign import ccall unsafe "hs_bindgen_212883c913884d27" hs_bindgen_212883c913884d27_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+hs_bindgen_212883c913884d27 :: CLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f15@
+hs_bindgen_212883c913884d27 = \x_0 -> fmap fromFFIType (hs_bindgen_212883c913884d27_base (toFFIType x_0))
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_unsafe :: CLong -> IO A
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_unsafe = hs_bindgen_212883c913884d27
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+foreign import ccall unsafe "hs_bindgen_f72cafc33ec81360" hs_bindgen_f72cafc33ec81360_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+hs_bindgen_f72cafc33ec81360 :: CLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f16@
+hs_bindgen_f72cafc33ec81360 = \x_0 -> fmap fromFFIType (hs_bindgen_f72cafc33ec81360_base (toFFIType x_0))
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_unsafe :: CLong -> IO A
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_unsafe = hs_bindgen_f72cafc33ec81360
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+foreign import ccall unsafe "hs_bindgen_ea5f62444673cf16" hs_bindgen_ea5f62444673cf16_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+hs_bindgen_ea5f62444673cf16 :: CLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f17@
+hs_bindgen_ea5f62444673cf16 = \x_0 -> fmap fromFFIType (hs_bindgen_ea5f62444673cf16_base (toFFIType x_0))
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_unsafe :: CLong -> IO A
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_unsafe = hs_bindgen_ea5f62444673cf16
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+foreign import ccall unsafe "hs_bindgen_9f4e020f892b30cb" hs_bindgen_9f4e020f892b30cb_base ::
+    CLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+hs_bindgen_9f4e020f892b30cb :: CLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f18@
+hs_bindgen_9f4e020f892b30cb = \x_0 -> fmap fromFFIType (hs_bindgen_9f4e020f892b30cb_base (toFFIType x_0))
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_unsafe :: CLong -> IO A
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_unsafe = hs_bindgen_9f4e020f892b30cb
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+foreign import ccall unsafe "hs_bindgen_47f005495bf88291" hs_bindgen_47f005495bf88291_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+hs_bindgen_47f005495bf88291 :: CULong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f19@
+hs_bindgen_47f005495bf88291 = \x_0 -> fmap fromFFIType (hs_bindgen_47f005495bf88291_base (toFFIType x_0))
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_unsafe :: CULong -> IO A
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_unsafe = hs_bindgen_47f005495bf88291
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+foreign import ccall unsafe "hs_bindgen_d02703a7ce8fade2" hs_bindgen_d02703a7ce8fade2_base ::
+    CULong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+hs_bindgen_d02703a7ce8fade2 :: CULong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f20@
+hs_bindgen_d02703a7ce8fade2 = \x_0 -> fmap fromFFIType (hs_bindgen_d02703a7ce8fade2_base (toFFIType x_0))
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_unsafe :: CULong -> IO A
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_unsafe = hs_bindgen_d02703a7ce8fade2
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+foreign import ccall unsafe "hs_bindgen_9f98e2aafc8c5a95" hs_bindgen_9f98e2aafc8c5a95_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+hs_bindgen_9f98e2aafc8c5a95 :: CLLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f21@
+hs_bindgen_9f98e2aafc8c5a95 = \x_0 -> fmap fromFFIType (hs_bindgen_9f98e2aafc8c5a95_base (toFFIType x_0))
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_unsafe :: CLLong -> IO A
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_unsafe = hs_bindgen_9f98e2aafc8c5a95
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+foreign import ccall unsafe "hs_bindgen_430da5f47172739a" hs_bindgen_430da5f47172739a_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+hs_bindgen_430da5f47172739a :: CLLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f22@
+hs_bindgen_430da5f47172739a = \x_0 -> fmap fromFFIType (hs_bindgen_430da5f47172739a_base (toFFIType x_0))
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_unsafe :: CLLong -> IO A
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_unsafe = hs_bindgen_430da5f47172739a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+foreign import ccall unsafe "hs_bindgen_bd83aa03a61a8a06" hs_bindgen_bd83aa03a61a8a06_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+hs_bindgen_bd83aa03a61a8a06 :: CLLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f23@
+hs_bindgen_bd83aa03a61a8a06 = \x_0 -> fmap fromFFIType (hs_bindgen_bd83aa03a61a8a06_base (toFFIType x_0))
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_unsafe :: CLLong -> IO A
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_unsafe = hs_bindgen_bd83aa03a61a8a06
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+foreign import ccall unsafe "hs_bindgen_affcee7ffeebbac9" hs_bindgen_affcee7ffeebbac9_base ::
+    CLLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+hs_bindgen_affcee7ffeebbac9 :: CLLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f24@
+hs_bindgen_affcee7ffeebbac9 = \x_0 -> fmap fromFFIType (hs_bindgen_affcee7ffeebbac9_base (toFFIType x_0))
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_unsafe :: CLLong -> IO A
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_unsafe = hs_bindgen_affcee7ffeebbac9
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+foreign import ccall unsafe "hs_bindgen_b8a7fb0f9add23ab" hs_bindgen_b8a7fb0f9add23ab_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+hs_bindgen_b8a7fb0f9add23ab :: CULLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f25@
+hs_bindgen_b8a7fb0f9add23ab = \x_0 -> fmap fromFFIType (hs_bindgen_b8a7fb0f9add23ab_base (toFFIType x_0))
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_unsafe :: CULLong -> IO A
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_unsafe = hs_bindgen_b8a7fb0f9add23ab
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+foreign import ccall unsafe "hs_bindgen_377c3e6bd5b69285" hs_bindgen_377c3e6bd5b69285_base ::
+    CULLong
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+hs_bindgen_377c3e6bd5b69285 :: CULLong -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f26@
+hs_bindgen_377c3e6bd5b69285 = \x_0 -> fmap fromFFIType (hs_bindgen_377c3e6bd5b69285_base (toFFIType x_0))
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_unsafe :: CULLong -> IO A
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_unsafe = hs_bindgen_377c3e6bd5b69285
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+foreign import ccall unsafe "hs_bindgen_b82bda1eaf8b02ba" hs_bindgen_b82bda1eaf8b02ba_base ::
+    CFloat
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+hs_bindgen_b82bda1eaf8b02ba :: CFloat -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f27@
+hs_bindgen_b82bda1eaf8b02ba = \x_0 -> fmap fromFFIType (hs_bindgen_b82bda1eaf8b02ba_base (toFFIType x_0))
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_unsafe :: CFloat -> IO A
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_unsafe = hs_bindgen_b82bda1eaf8b02ba
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+foreign import ccall unsafe "hs_bindgen_8d36f32587832dae" hs_bindgen_8d36f32587832dae_base ::
+    CDouble
+ -> IO CInt
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+hs_bindgen_8d36f32587832dae :: CDouble -> IO A
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_Unsafe_f28@
+hs_bindgen_8d36f32587832dae = \x_0 -> fmap fromFFIType (hs_bindgen_8d36f32587832dae_base (toFFIType x_0))
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_unsafe :: CDouble -> IO A
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_unsafe = hs_bindgen_8d36f32587832dae
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+foreign import ccall unsafe "hs_bindgen_1208d85624465c51" hs_bindgen_1208d85624465c51_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+hs_bindgen_1208d85624465c51 :: IO (FunPtr (CChar -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f1@
+hs_bindgen_1208d85624465c51 = fmap fromFFIType hs_bindgen_1208d85624465c51_base
+{-# NOINLINE f1_funptr #-}
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_funptr :: FunPtr (CChar -> IO A)
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 21:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f1_funptr = unsafePerformIO hs_bindgen_1208d85624465c51
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+foreign import ccall unsafe "hs_bindgen_90bf738ed6e126cf" hs_bindgen_90bf738ed6e126cf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+hs_bindgen_90bf738ed6e126cf :: IO (FunPtr (CSChar -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f2@
+hs_bindgen_90bf738ed6e126cf = fmap fromFFIType hs_bindgen_90bf738ed6e126cf_base
+{-# NOINLINE f2_funptr #-}
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_funptr :: FunPtr (CSChar -> IO A)
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 22:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f2_funptr = unsafePerformIO hs_bindgen_90bf738ed6e126cf
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+foreign import ccall unsafe "hs_bindgen_541fb107a8c068d0" hs_bindgen_541fb107a8c068d0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+hs_bindgen_541fb107a8c068d0 :: IO (FunPtr (CUChar -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f3@
+hs_bindgen_541fb107a8c068d0 = fmap fromFFIType hs_bindgen_541fb107a8c068d0_base
+{-# NOINLINE f3_funptr #-}
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_funptr :: FunPtr (CUChar -> IO A)
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 23:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f3_funptr = unsafePerformIO hs_bindgen_541fb107a8c068d0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+foreign import ccall unsafe "hs_bindgen_695a21f5c624ca64" hs_bindgen_695a21f5c624ca64_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+hs_bindgen_695a21f5c624ca64 :: IO (FunPtr (CShort -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f4@
+hs_bindgen_695a21f5c624ca64 = fmap fromFFIType hs_bindgen_695a21f5c624ca64_base
+{-# NOINLINE f4_funptr #-}
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_funptr :: FunPtr (CShort -> IO A)
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 28:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f4_funptr = unsafePerformIO hs_bindgen_695a21f5c624ca64
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+foreign import ccall unsafe "hs_bindgen_43491bdffe43bbe1" hs_bindgen_43491bdffe43bbe1_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+hs_bindgen_43491bdffe43bbe1 :: IO (FunPtr (CShort -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f5@
+hs_bindgen_43491bdffe43bbe1 = fmap fromFFIType hs_bindgen_43491bdffe43bbe1_base
+{-# NOINLINE f5_funptr #-}
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_funptr :: FunPtr (CShort -> IO A)
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 29:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f5_funptr = unsafePerformIO hs_bindgen_43491bdffe43bbe1
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+foreign import ccall unsafe "hs_bindgen_ffafdd943146661a" hs_bindgen_ffafdd943146661a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+hs_bindgen_ffafdd943146661a :: IO (FunPtr (CShort -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f6@
+hs_bindgen_ffafdd943146661a = fmap fromFFIType hs_bindgen_ffafdd943146661a_base
+{-# NOINLINE f6_funptr #-}
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_funptr :: FunPtr (CShort -> IO A)
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 30:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f6_funptr = unsafePerformIO hs_bindgen_ffafdd943146661a
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+foreign import ccall unsafe "hs_bindgen_7c6250122a3c59a3" hs_bindgen_7c6250122a3c59a3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+hs_bindgen_7c6250122a3c59a3 :: IO (FunPtr (CShort -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f7@
+hs_bindgen_7c6250122a3c59a3 = fmap fromFFIType hs_bindgen_7c6250122a3c59a3_base
+{-# NOINLINE f7_funptr #-}
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_funptr :: FunPtr (CShort -> IO A)
+{-| __C declaration:__ @f7@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 31:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f7_funptr = unsafePerformIO hs_bindgen_7c6250122a3c59a3
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+foreign import ccall unsafe "hs_bindgen_60cbc6e072d14643" hs_bindgen_60cbc6e072d14643_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+hs_bindgen_60cbc6e072d14643 :: IO (FunPtr (CUShort -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f8@
+hs_bindgen_60cbc6e072d14643 = fmap fromFFIType hs_bindgen_60cbc6e072d14643_base
+{-# NOINLINE f8_funptr #-}
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_funptr :: FunPtr (CUShort -> IO A)
+{-| __C declaration:__ @f8@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 32:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f8_funptr = unsafePerformIO hs_bindgen_60cbc6e072d14643
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+foreign import ccall unsafe "hs_bindgen_fa356fa03c563829" hs_bindgen_fa356fa03c563829_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+hs_bindgen_fa356fa03c563829 :: IO (FunPtr (CUShort -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f9@
+hs_bindgen_fa356fa03c563829 = fmap fromFFIType hs_bindgen_fa356fa03c563829_base
+{-# NOINLINE f9_funptr #-}
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_funptr :: FunPtr (CUShort -> IO A)
+{-| __C declaration:__ @f9@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 33:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f9_funptr = unsafePerformIO hs_bindgen_fa356fa03c563829
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+foreign import ccall unsafe "hs_bindgen_6971f14ec2033453" hs_bindgen_6971f14ec2033453_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+hs_bindgen_6971f14ec2033453 :: IO (FunPtr (CInt -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f10@
+hs_bindgen_6971f14ec2033453 = fmap fromFFIType hs_bindgen_6971f14ec2033453_base
+{-# NOINLINE f10_funptr #-}
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_funptr :: FunPtr (CInt -> IO A)
+{-| __C declaration:__ @f10@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 35:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f10_funptr = unsafePerformIO hs_bindgen_6971f14ec2033453
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+foreign import ccall unsafe "hs_bindgen_18e46ae0dfd9dbe0" hs_bindgen_18e46ae0dfd9dbe0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+hs_bindgen_18e46ae0dfd9dbe0 :: IO (FunPtr (CInt -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f11@
+hs_bindgen_18e46ae0dfd9dbe0 = fmap fromFFIType hs_bindgen_18e46ae0dfd9dbe0_base
+{-# NOINLINE f11_funptr #-}
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_funptr :: FunPtr (CInt -> IO A)
+{-| __C declaration:__ @f11@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 36:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f11_funptr = unsafePerformIO hs_bindgen_18e46ae0dfd9dbe0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+foreign import ccall unsafe "hs_bindgen_0c1c36784fe71810" hs_bindgen_0c1c36784fe71810_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+hs_bindgen_0c1c36784fe71810 :: IO (FunPtr (CInt -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f12@
+hs_bindgen_0c1c36784fe71810 = fmap fromFFIType hs_bindgen_0c1c36784fe71810_base
+{-# NOINLINE f12_funptr #-}
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_funptr :: FunPtr (CInt -> IO A)
+{-| __C declaration:__ @f12@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 37:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f12_funptr = unsafePerformIO hs_bindgen_0c1c36784fe71810
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+foreign import ccall unsafe "hs_bindgen_8d9bec0d1944b558" hs_bindgen_8d9bec0d1944b558_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+hs_bindgen_8d9bec0d1944b558 :: IO (FunPtr (CUInt -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f13@
+hs_bindgen_8d9bec0d1944b558 = fmap fromFFIType hs_bindgen_8d9bec0d1944b558_base
+{-# NOINLINE f13_funptr #-}
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_funptr :: FunPtr (CUInt -> IO A)
+{-| __C declaration:__ @f13@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 38:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f13_funptr = unsafePerformIO hs_bindgen_8d9bec0d1944b558
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+foreign import ccall unsafe "hs_bindgen_796f92f5831916a6" hs_bindgen_796f92f5831916a6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+hs_bindgen_796f92f5831916a6 :: IO (FunPtr (CUInt -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f14@
+hs_bindgen_796f92f5831916a6 = fmap fromFFIType hs_bindgen_796f92f5831916a6_base
+{-# NOINLINE f14_funptr #-}
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_funptr :: FunPtr (CUInt -> IO A)
+{-| __C declaration:__ @f14@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 39:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f14_funptr = unsafePerformIO hs_bindgen_796f92f5831916a6
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+foreign import ccall unsafe "hs_bindgen_2cb6292b4cc8f420" hs_bindgen_2cb6292b4cc8f420_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+hs_bindgen_2cb6292b4cc8f420 :: IO (FunPtr (CLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f15@
+hs_bindgen_2cb6292b4cc8f420 = fmap fromFFIType hs_bindgen_2cb6292b4cc8f420_base
+{-# NOINLINE f15_funptr #-}
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_funptr :: FunPtr (CLong -> IO A)
+{-| __C declaration:__ @f15@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 41:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f15_funptr = unsafePerformIO hs_bindgen_2cb6292b4cc8f420
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+foreign import ccall unsafe "hs_bindgen_b7dd3e78d24cd30c" hs_bindgen_b7dd3e78d24cd30c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+hs_bindgen_b7dd3e78d24cd30c :: IO (FunPtr (CLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f16@
+hs_bindgen_b7dd3e78d24cd30c = fmap fromFFIType hs_bindgen_b7dd3e78d24cd30c_base
+{-# NOINLINE f16_funptr #-}
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_funptr :: FunPtr (CLong -> IO A)
+{-| __C declaration:__ @f16@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 42:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f16_funptr = unsafePerformIO hs_bindgen_b7dd3e78d24cd30c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+foreign import ccall unsafe "hs_bindgen_894ff9aa74f040d9" hs_bindgen_894ff9aa74f040d9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+hs_bindgen_894ff9aa74f040d9 :: IO (FunPtr (CLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f17@
+hs_bindgen_894ff9aa74f040d9 = fmap fromFFIType hs_bindgen_894ff9aa74f040d9_base
+{-# NOINLINE f17_funptr #-}
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_funptr :: FunPtr (CLong -> IO A)
+{-| __C declaration:__ @f17@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 43:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f17_funptr = unsafePerformIO hs_bindgen_894ff9aa74f040d9
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+foreign import ccall unsafe "hs_bindgen_57359ef6c14eb820" hs_bindgen_57359ef6c14eb820_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+hs_bindgen_57359ef6c14eb820 :: IO (FunPtr (CLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f18@
+hs_bindgen_57359ef6c14eb820 = fmap fromFFIType hs_bindgen_57359ef6c14eb820_base
+{-# NOINLINE f18_funptr #-}
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_funptr :: FunPtr (CLong -> IO A)
+{-| __C declaration:__ @f18@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 44:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f18_funptr = unsafePerformIO hs_bindgen_57359ef6c14eb820
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+foreign import ccall unsafe "hs_bindgen_2173cee7470d34a4" hs_bindgen_2173cee7470d34a4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+hs_bindgen_2173cee7470d34a4 :: IO (FunPtr (CULong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f19@
+hs_bindgen_2173cee7470d34a4 = fmap fromFFIType hs_bindgen_2173cee7470d34a4_base
+{-# NOINLINE f19_funptr #-}
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_funptr :: FunPtr (CULong -> IO A)
+{-| __C declaration:__ @f19@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 45:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f19_funptr = unsafePerformIO hs_bindgen_2173cee7470d34a4
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+foreign import ccall unsafe "hs_bindgen_85dc99217461b608" hs_bindgen_85dc99217461b608_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+hs_bindgen_85dc99217461b608 :: IO (FunPtr (CULong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f20@
+hs_bindgen_85dc99217461b608 = fmap fromFFIType hs_bindgen_85dc99217461b608_base
+{-# NOINLINE f20_funptr #-}
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_funptr :: FunPtr (CULong -> IO A)
+{-| __C declaration:__ @f20@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 46:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f20_funptr = unsafePerformIO hs_bindgen_85dc99217461b608
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+foreign import ccall unsafe "hs_bindgen_350486e538e7ca90" hs_bindgen_350486e538e7ca90_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+hs_bindgen_350486e538e7ca90 :: IO (FunPtr (CLLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f21@
+hs_bindgen_350486e538e7ca90 = fmap fromFFIType hs_bindgen_350486e538e7ca90_base
+{-# NOINLINE f21_funptr #-}
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_funptr :: FunPtr (CLLong -> IO A)
+{-| __C declaration:__ @f21@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 48:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f21_funptr = unsafePerformIO hs_bindgen_350486e538e7ca90
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+foreign import ccall unsafe "hs_bindgen_ad2c8dc646b29be0" hs_bindgen_ad2c8dc646b29be0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+hs_bindgen_ad2c8dc646b29be0 :: IO (FunPtr (CLLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f22@
+hs_bindgen_ad2c8dc646b29be0 = fmap fromFFIType hs_bindgen_ad2c8dc646b29be0_base
+{-# NOINLINE f22_funptr #-}
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_funptr :: FunPtr (CLLong -> IO A)
+{-| __C declaration:__ @f22@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 49:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f22_funptr = unsafePerformIO hs_bindgen_ad2c8dc646b29be0
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+foreign import ccall unsafe "hs_bindgen_01837bab50ebbe4c" hs_bindgen_01837bab50ebbe4c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+hs_bindgen_01837bab50ebbe4c :: IO (FunPtr (CLLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f23@
+hs_bindgen_01837bab50ebbe4c = fmap fromFFIType hs_bindgen_01837bab50ebbe4c_base
+{-# NOINLINE f23_funptr #-}
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_funptr :: FunPtr (CLLong -> IO A)
+{-| __C declaration:__ @f23@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 50:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f23_funptr = unsafePerformIO hs_bindgen_01837bab50ebbe4c
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+foreign import ccall unsafe "hs_bindgen_051d17dfd1125c86" hs_bindgen_051d17dfd1125c86_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+hs_bindgen_051d17dfd1125c86 :: IO (FunPtr (CLLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f24@
+hs_bindgen_051d17dfd1125c86 = fmap fromFFIType hs_bindgen_051d17dfd1125c86_base
+{-# NOINLINE f24_funptr #-}
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_funptr :: FunPtr (CLLong -> IO A)
+{-| __C declaration:__ @f24@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 51:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f24_funptr = unsafePerformIO hs_bindgen_051d17dfd1125c86
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+foreign import ccall unsafe "hs_bindgen_ba5dd3a36d6f2756" hs_bindgen_ba5dd3a36d6f2756_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+hs_bindgen_ba5dd3a36d6f2756 :: IO (FunPtr (CULLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f25@
+hs_bindgen_ba5dd3a36d6f2756 = fmap fromFFIType hs_bindgen_ba5dd3a36d6f2756_base
+{-# NOINLINE f25_funptr #-}
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_funptr :: FunPtr (CULLong -> IO A)
+{-| __C declaration:__ @f25@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 52:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f25_funptr = unsafePerformIO hs_bindgen_ba5dd3a36d6f2756
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+foreign import ccall unsafe "hs_bindgen_22f3b97563fd757f" hs_bindgen_22f3b97563fd757f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+hs_bindgen_22f3b97563fd757f :: IO (FunPtr (CULLong -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f26@
+hs_bindgen_22f3b97563fd757f = fmap fromFFIType hs_bindgen_22f3b97563fd757f_base
+{-# NOINLINE f26_funptr #-}
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_funptr :: FunPtr (CULLong -> IO A)
+{-| __C declaration:__ @f26@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 53:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f26_funptr = unsafePerformIO hs_bindgen_22f3b97563fd757f
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+foreign import ccall unsafe "hs_bindgen_fc81895dfae9b1e5" hs_bindgen_fc81895dfae9b1e5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+hs_bindgen_fc81895dfae9b1e5 :: IO (FunPtr (CFloat -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f27@
+hs_bindgen_fc81895dfae9b1e5 = fmap fromFFIType hs_bindgen_fc81895dfae9b1e5_base
+{-# NOINLINE f27_funptr #-}
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_funptr :: FunPtr (CFloat -> IO A)
+{-| __C declaration:__ @f27@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 58:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f27_funptr = unsafePerformIO hs_bindgen_fc81895dfae9b1e5
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+foreign import ccall unsafe "hs_bindgen_f95062f509265011" hs_bindgen_f95062f509265011_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+hs_bindgen_f95062f509265011 :: IO (FunPtr (CDouble -> IO A))
+-- __unique:__ @test_macrosreparsearithmetic_type_Example_get_f28@
+hs_bindgen_f95062f509265011 = fmap fromFFIType hs_bindgen_f95062f509265011_base
+{-# NOINLINE f28_funptr #-}
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_funptr :: FunPtr (CDouble -> IO A)
+{-| __C declaration:__ @f28@
+
+    __defined at:__ @macros\/reparse\/arithmetic_types.h 59:3@
+
+    __exported by:__ @macros\/reparse\/arithmetic_types.h@
+-}
+f28_funptr = unsafePerformIO hs_bindgen_f95062f509265011
diff --git a/test-artefacts/fixtures/macros/reparse/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/bindingspec.yaml
@@ -0,0 +1,1007 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse.h
+  cname: macro A
+  hsname: A
+- headers: macros/reparse.h
+  cname: struct some_struct
+  hsname: Some_struct
+- headers: macros/reparse.h
+  cname: union some_union
+  hsname: Some_union
+- headers: macros/reparse.h
+  cname: enum some_enum
+  hsname: Some_enum
+  enum: open
+- headers: macros/reparse.h
+  cname: arr_typedef1
+  hsname: Arr_typedef1
+- headers: macros/reparse.h
+  cname: arr_typedef2
+  hsname: Arr_typedef2
+- headers: macros/reparse.h
+  cname: arr_typedef3
+  hsname: Arr_typedef3
+- headers: macros/reparse.h
+  cname: arr_typedef4
+  hsname: Arr_typedef4
+- headers: macros/reparse.h
+  cname: typedef1
+  hsname: Typedef1
+- headers: macros/reparse.h
+  cname: typedef2
+  hsname: Typedef2
+- headers: macros/reparse.h
+  cname: typedef3
+  hsname: Typedef3
+- headers: macros/reparse.h
+  cname: funptr_typedef1
+  hsname: Funptr_typedef1
+- headers: macros/reparse.h
+  cname: funptr_typedef2
+  hsname: Funptr_typedef2
+- headers: macros/reparse.h
+  cname: funptr_typedef3
+  hsname: Funptr_typedef3
+- headers: macros/reparse.h
+  cname: funptr_typedef4
+  hsname: Funptr_typedef4
+- headers: macros/reparse.h
+  cname: funptr_typedef5
+  hsname: Funptr_typedef5
+- headers: macros/reparse.h
+  cname: comments2
+  hsname: Comments2
+- headers: macros/reparse.h
+  cname: struct example_struct
+  hsname: Example_struct
+- headers: macros/reparse.h
+  cname: const_typedef1
+  hsname: Const_typedef1
+- headers: macros/reparse.h
+  cname: const_typedef2
+  hsname: Const_typedef2
+- headers: macros/reparse.h
+  cname: const_typedef3
+  hsname: Const_typedef3
+- headers: macros/reparse.h
+  cname: const_typedef4
+  hsname: Const_typedef4
+- headers: macros/reparse.h
+  cname: const_typedef5
+  hsname: Const_typedef5
+- headers: macros/reparse.h
+  cname: const_typedef6
+  hsname: Const_typedef6
+- headers: macros/reparse.h
+  cname: const_typedef7
+  hsname: Const_typedef7
+- headers: macros/reparse.h
+  cname: struct example_struct_with_const
+  hsname: Example_struct_with_const
+- headers: macros/reparse.h
+  cname: const_funptr1
+  hsname: Const_funptr1
+- headers: macros/reparse.h
+  cname: const_funptr2
+  hsname: Const_funptr2
+- headers: macros/reparse.h
+  cname: const_funptr3
+  hsname: Const_funptr3
+- headers: macros/reparse.h
+  cname: const_funptr4
+  hsname: Const_funptr4
+- headers: macros/reparse.h
+  cname: const_funptr5
+  hsname: Const_funptr5
+- headers: macros/reparse.h
+  cname: const_funptr6
+  hsname: Const_funptr6
+- headers: macros/reparse.h
+  cname: const_funptr7
+  hsname: Const_funptr7
+- headers: macros/reparse.h
+  cname: macro BOOL
+  hsname: BOOL
+- headers: macros/reparse.h
+  cname: macro INT
+  hsname: INT
+- headers: macros/reparse.h
+  cname: macro INTP
+  hsname: INTP
+- headers: macros/reparse.h
+  cname: macro INTCP
+  hsname: INTCP
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Arr_typedef1
+  representation:
+    newtype:
+      constructor: Arr_typedef1
+      fields:
+      - unwrapArr_typedef1
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: Arr_typedef2
+  representation:
+    newtype:
+      constructor: Arr_typedef2
+      fields:
+      - unwrapArr_typedef2
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: Arr_typedef3
+  representation:
+    newtype:
+      constructor: Arr_typedef3
+      fields:
+      - unwrapArr_typedef3
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Arr_typedef4
+  representation:
+    newtype:
+      constructor: Arr_typedef4
+      fields:
+      - unwrapArr_typedef4
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: BOOL
+  representation:
+    newtype:
+      constructor: BOOL
+      fields:
+      - unwrapBOOL
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CBool
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Comments2
+  representation:
+    newtype:
+      constructor: Comments2
+      fields:
+      - unwrapComments2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr1
+  representation:
+    newtype:
+      constructor: Const_funptr1
+      fields:
+      - unwrapConst_funptr1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr2
+  representation:
+    newtype:
+      constructor: Const_funptr2
+      fields:
+      - unwrapConst_funptr2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr3
+  representation:
+    newtype:
+      constructor: Const_funptr3
+      fields:
+      - unwrapConst_funptr3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr4
+  representation:
+    newtype:
+      constructor: Const_funptr4
+      fields:
+      - unwrapConst_funptr4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr5
+  representation:
+    newtype:
+      constructor: Const_funptr5
+      fields:
+      - unwrapConst_funptr5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr6
+  representation:
+    newtype:
+      constructor: Const_funptr6
+      fields:
+      - unwrapConst_funptr6
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_funptr7
+  representation:
+    newtype:
+      constructor: Const_funptr7
+      fields:
+      - unwrapConst_funptr7
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef1
+  representation:
+    newtype:
+      constructor: Const_typedef1
+      fields:
+      - unwrapConst_typedef1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef2
+  representation:
+    newtype:
+      constructor: Const_typedef2
+      fields:
+      - unwrapConst_typedef2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef3
+  representation:
+    newtype:
+      constructor: Const_typedef3
+      fields:
+      - unwrapConst_typedef3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef4
+  representation:
+    newtype:
+      constructor: Const_typedef4
+      fields:
+      - unwrapConst_typedef4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef5
+  representation:
+    newtype:
+      constructor: Const_typedef5
+      fields:
+      - unwrapConst_typedef5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef6
+  representation:
+    newtype:
+      constructor: Const_typedef6
+      fields:
+      - unwrapConst_typedef6
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Const_typedef7
+  representation:
+    newtype:
+      constructor: Const_typedef7
+      fields:
+      - unwrapConst_typedef7
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Example_struct
+  representation:
+    record:
+      constructor: Example_struct
+      fields:
+      - example_struct_field1
+      - example_struct_field2
+      - example_struct_field3
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Example_struct_with_const
+  representation:
+    record:
+      constructor: Example_struct_with_const
+      fields:
+      - example_struct_with_const_const_field1
+      - example_struct_with_const_const_field2
+      - example_struct_with_const_const_field3
+      - example_struct_with_const_const_field4
+      - example_struct_with_const_const_field5
+      - example_struct_with_const_const_field6
+      - example_struct_with_const_const_field7
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef1
+  representation:
+    newtype:
+      constructor: Funptr_typedef1
+      fields:
+      - unwrapFunptr_typedef1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef2
+  representation:
+    newtype:
+      constructor: Funptr_typedef2
+      fields:
+      - unwrapFunptr_typedef2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef3
+  representation:
+    newtype:
+      constructor: Funptr_typedef3
+      fields:
+      - unwrapFunptr_typedef3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef4
+  representation:
+    newtype:
+      constructor: Funptr_typedef4
+      fields:
+      - unwrapFunptr_typedef4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Funptr_typedef5
+  representation:
+    newtype:
+      constructor: Funptr_typedef5
+      fields:
+      - unwrapFunptr_typedef5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: INT
+  representation:
+    newtype:
+      constructor: INT
+      fields:
+      - unwrapINT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: INTCP
+  representation:
+    newtype:
+      constructor: INTCP
+      fields:
+      - unwrapINTCP
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: INTP
+  representation:
+    newtype:
+      constructor: INTP
+      fields:
+      - unwrapINTP
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_enum
+  representation:
+    newtype:
+      constructor: Some_enum
+      fields:
+      - unwrapSome_enum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_struct
+  representation:
+    record:
+      constructor: Some_struct
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Some_union
+  representation:
+    newtype:
+      constructor: Some_union
+      fields:
+      - unwrapSome_union
+  instances:
+  - Generic
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef1
+  representation:
+    newtype:
+      constructor: Typedef1
+      fields:
+      - unwrapTypedef1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef2
+  representation:
+    newtype:
+      constructor: Typedef2
+      fields:
+      - unwrapTypedef2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef3
+  representation:
+    newtype:
+      constructor: Typedef3
+      fields:
+      - unwrapTypedef3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/Example/FunPtr.hs
@@ -0,0 +1,100 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    , Example.FunPtr.quux
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/cref_attributes.h>"
+  , "/* test_macrosreparsecref_attributes_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dfdc3c5362469496 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosreparsecref_attributes_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b44be06e46c9f5f3 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_macrosreparsecref_attributes_Example_get_quux */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f923b761933d67da (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &quux;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_dfdc3c5362469496" hs_bindgen_dfdc3c5362469496_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+hs_bindgen_dfdc3c5362469496 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_dfdc3c5362469496 =
+  fmap BG.fromFFIType hs_bindgen_dfdc3c5362469496_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_dfdc3c5362469496
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b44be06e46c9f5f3" hs_bindgen_b44be06e46c9f5f3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+hs_bindgen_b44be06e46c9f5f3 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_b44be06e46c9f5f3 =
+  fmap BG.fromFFIType hs_bindgen_b44be06e46c9f5f3_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar :: BG.FunPtr (BG.CInt -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_b44be06e46c9f5f3
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_f923b761933d67da" hs_bindgen_f923b761933d67da_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+hs_bindgen_f923b761933d67da :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_f923b761933d67da =
+  fmap BG.fromFFIType hs_bindgen_f923b761933d67da_base
+
+{-# NOINLINE quux #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux :: BG.FunPtr (BG.CInt -> IO ())
+quux = BG.unsafePerformIO hs_bindgen_f923b761933d67da
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/Example/Safe.hs
@@ -0,0 +1,109 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    , Example.Safe.quux
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/cref_attributes.h>"
+  , "void hs_bindgen_9f4b1c3748016429 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_183028e559c4eff2 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_e02b651508844cbb ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9f4b1c3748016429" hs_bindgen_9f4b1c3748016429_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+hs_bindgen_9f4b1c3748016429 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_9f4b1c3748016429 =
+  \x0 ->
+    hs_bindgen_9f4b1c3748016429_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo ::
+     BG.CInt
+  -> IO ()
+foo = hs_bindgen_9f4b1c3748016429
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_183028e559c4eff2" hs_bindgen_183028e559c4eff2_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+hs_bindgen_183028e559c4eff2 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_183028e559c4eff2 =
+  \x0 ->
+    hs_bindgen_183028e559c4eff2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar ::
+     BG.CInt
+  -> IO ()
+bar = hs_bindgen_183028e559c4eff2
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_e02b651508844cbb" hs_bindgen_e02b651508844cbb_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+hs_bindgen_e02b651508844cbb ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_e02b651508844cbb =
+  \x0 ->
+    hs_bindgen_e02b651508844cbb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux ::
+     BG.CInt
+  -> IO ()
+quux = hs_bindgen_e02b651508844cbb
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/Example/Unsafe.hs
@@ -0,0 +1,109 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    , Example.Unsafe.quux
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/cref_attributes.h>"
+  , "void hs_bindgen_bc0a3a9b7f66fcad ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_3e07344f1445a945 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_d67e55f386a01958 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_bc0a3a9b7f66fcad" hs_bindgen_bc0a3a9b7f66fcad_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+hs_bindgen_bc0a3a9b7f66fcad ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_bc0a3a9b7f66fcad =
+  \x0 ->
+    hs_bindgen_bc0a3a9b7f66fcad_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo ::
+     BG.CInt
+  -> IO ()
+foo = hs_bindgen_bc0a3a9b7f66fcad
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_3e07344f1445a945" hs_bindgen_3e07344f1445a945_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+hs_bindgen_3e07344f1445a945 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_3e07344f1445a945 =
+  \x0 ->
+    hs_bindgen_3e07344f1445a945_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar ::
+     BG.CInt
+  -> IO ()
+bar = hs_bindgen_3e07344f1445a945
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_d67e55f386a01958" hs_bindgen_d67e55f386a01958_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+hs_bindgen_d67e55f386a01958 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_d67e55f386a01958 =
+  \x0 ->
+    hs_bindgen_d67e55f386a01958_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux ::
+     BG.CInt
+  -> IO ()
+quux = hs_bindgen_d67e55f386a01958
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.1.empty/th.txt
@@ -0,0 +1,260 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/cref_attributes.h
+-- #include <macros/reparse/cref_attributes.h>
+-- void hs_bindgen_9f4b1c3748016429 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_183028e559c4eff2 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_e02b651508844cbb (
+--   signed int arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- void hs_bindgen_bc0a3a9b7f66fcad (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_3e07344f1445a945 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_d67e55f386a01958 (
+--   signed int arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- /* test_macrosreparsecref_attributes_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dfdc3c5362469496 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosreparsecref_attributes_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b44be06e46c9f5f3 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_macrosreparsecref_attributes_Example_get_quux */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f923b761933d67da (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &quux;
+-- }
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9f4b1c3748016429" hs_bindgen_9f4b1c3748016429_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+hs_bindgen_9f4b1c3748016429 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+hs_bindgen_9f4b1c3748016429 = \x_0 -> hs_bindgen_9f4b1c3748016429_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_safe = hs_bindgen_9f4b1c3748016429
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_183028e559c4eff2" hs_bindgen_183028e559c4eff2_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+hs_bindgen_183028e559c4eff2 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+hs_bindgen_183028e559c4eff2 = \x_0 -> hs_bindgen_183028e559c4eff2_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_safe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_safe = hs_bindgen_183028e559c4eff2
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_e02b651508844cbb" hs_bindgen_e02b651508844cbb_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+hs_bindgen_e02b651508844cbb :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+hs_bindgen_e02b651508844cbb = \x_0 -> hs_bindgen_e02b651508844cbb_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_safe :: CInt -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_safe = hs_bindgen_e02b651508844cbb
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_bc0a3a9b7f66fcad" hs_bindgen_bc0a3a9b7f66fcad_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+hs_bindgen_bc0a3a9b7f66fcad :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+hs_bindgen_bc0a3a9b7f66fcad = \x_0 -> hs_bindgen_bc0a3a9b7f66fcad_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_unsafe = hs_bindgen_bc0a3a9b7f66fcad
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_3e07344f1445a945" hs_bindgen_3e07344f1445a945_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+hs_bindgen_3e07344f1445a945 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+hs_bindgen_3e07344f1445a945 = \x_0 -> hs_bindgen_3e07344f1445a945_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_unsafe = hs_bindgen_3e07344f1445a945
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_d67e55f386a01958" hs_bindgen_d67e55f386a01958_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+hs_bindgen_d67e55f386a01958 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+hs_bindgen_d67e55f386a01958 = \x_0 -> hs_bindgen_d67e55f386a01958_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_unsafe = hs_bindgen_d67e55f386a01958
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_dfdc3c5362469496" hs_bindgen_dfdc3c5362469496_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+hs_bindgen_dfdc3c5362469496 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+hs_bindgen_dfdc3c5362469496 = fmap fromFFIType hs_bindgen_dfdc3c5362469496_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_dfdc3c5362469496
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b44be06e46c9f5f3" hs_bindgen_b44be06e46c9f5f3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+hs_bindgen_b44be06e46c9f5f3 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+hs_bindgen_b44be06e46c9f5f3 = fmap fromFFIType hs_bindgen_b44be06e46c9f5f3_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_b44be06e46c9f5f3
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_f923b761933d67da" hs_bindgen_f923b761933d67da_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+hs_bindgen_f923b761933d67da :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+hs_bindgen_f923b761933d67da = fmap fromFFIType hs_bindgen_f923b761933d67da_base
+{-# NOINLINE quux_funptr #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_funptr = unsafePerformIO hs_bindgen_f923b761933d67da
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.bOOL
+    , Example.eXPORT
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bOOL :: Macro.Raw String
+bOOL = Macro.objectLike "BOOL" ["int"]
+
+{-| __C declaration:__ @macro EXPORT@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 10:9@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+eXPORT :: Macro.Raw String
+eXPORT =
+  Macro.objectLike "EXPORT" ["[", "[", "gnu", "::", "visibility", "(", "\"default\"", ")", "]", "]"]
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example/FunPtr.hs
@@ -0,0 +1,100 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    , Example.FunPtr.quux
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/cref_attributes.h>"
+  , "/* test_macrosreparsecref_attributes_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dfdc3c5362469496 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosreparsecref_attributes_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b44be06e46c9f5f3 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_macrosreparsecref_attributes_Example_get_quux */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f923b761933d67da (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &quux;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_dfdc3c5362469496" hs_bindgen_dfdc3c5362469496_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+hs_bindgen_dfdc3c5362469496 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_dfdc3c5362469496 =
+  fmap BG.fromFFIType hs_bindgen_dfdc3c5362469496_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_dfdc3c5362469496
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b44be06e46c9f5f3" hs_bindgen_b44be06e46c9f5f3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+hs_bindgen_b44be06e46c9f5f3 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_b44be06e46c9f5f3 =
+  fmap BG.fromFFIType hs_bindgen_b44be06e46c9f5f3_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar :: BG.FunPtr (BG.CInt -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_b44be06e46c9f5f3
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_f923b761933d67da" hs_bindgen_f923b761933d67da_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+hs_bindgen_f923b761933d67da :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_f923b761933d67da =
+  fmap BG.fromFFIType hs_bindgen_f923b761933d67da_base
+
+{-# NOINLINE quux #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux :: BG.FunPtr (BG.CInt -> IO ())
+quux = BG.unsafePerformIO hs_bindgen_f923b761933d67da
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example/Safe.hs
@@ -0,0 +1,109 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    , Example.Safe.quux
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/cref_attributes.h>"
+  , "void hs_bindgen_9f4b1c3748016429 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_183028e559c4eff2 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_e02b651508844cbb ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9f4b1c3748016429" hs_bindgen_9f4b1c3748016429_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+hs_bindgen_9f4b1c3748016429 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_9f4b1c3748016429 =
+  \x0 ->
+    hs_bindgen_9f4b1c3748016429_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo ::
+     BG.CInt
+  -> IO ()
+foo = hs_bindgen_9f4b1c3748016429
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_183028e559c4eff2" hs_bindgen_183028e559c4eff2_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+hs_bindgen_183028e559c4eff2 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_183028e559c4eff2 =
+  \x0 ->
+    hs_bindgen_183028e559c4eff2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar ::
+     BG.CInt
+  -> IO ()
+bar = hs_bindgen_183028e559c4eff2
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_e02b651508844cbb" hs_bindgen_e02b651508844cbb_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+hs_bindgen_e02b651508844cbb ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_e02b651508844cbb =
+  \x0 ->
+    hs_bindgen_e02b651508844cbb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux ::
+     BG.CInt
+  -> IO ()
+quux = hs_bindgen_e02b651508844cbb
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/Example/Unsafe.hs
@@ -0,0 +1,109 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    , Example.Unsafe.quux
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/cref_attributes.h>"
+  , "void hs_bindgen_bc0a3a9b7f66fcad ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_3e07344f1445a945 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_d67e55f386a01958 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_bc0a3a9b7f66fcad" hs_bindgen_bc0a3a9b7f66fcad_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+hs_bindgen_bc0a3a9b7f66fcad ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_bc0a3a9b7f66fcad =
+  \x0 ->
+    hs_bindgen_bc0a3a9b7f66fcad_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo ::
+     BG.CInt
+  -> IO ()
+foo = hs_bindgen_bc0a3a9b7f66fcad
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_3e07344f1445a945" hs_bindgen_3e07344f1445a945_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+hs_bindgen_3e07344f1445a945 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_3e07344f1445a945 =
+  \x0 ->
+    hs_bindgen_3e07344f1445a945_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar ::
+     BG.CInt
+  -> IO ()
+bar = hs_bindgen_3e07344f1445a945
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_d67e55f386a01958" hs_bindgen_d67e55f386a01958_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+hs_bindgen_d67e55f386a01958 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_d67e55f386a01958 =
+  \x0 ->
+    hs_bindgen_d67e55f386a01958_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux ::
+     BG.CInt
+  -> IO ()
+quux = hs_bindgen_d67e55f386a01958
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes.2.raw/th.txt
@@ -0,0 +1,297 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/cref_attributes.h
+-- #include <macros/reparse/cref_attributes.h>
+-- void hs_bindgen_9f4b1c3748016429 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_183028e559c4eff2 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_e02b651508844cbb (
+--   signed int arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- void hs_bindgen_bc0a3a9b7f66fcad (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_3e07344f1445a945 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_d67e55f386a01958 (
+--   signed int arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- /* test_macrosreparsecref_attributes_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dfdc3c5362469496 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosreparsecref_attributes_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b44be06e46c9f5f3 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_macrosreparsecref_attributes_Example_get_quux */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f923b761933d67da (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &quux;
+-- }
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bOOL :: Raw String
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bOOL = objectLike "BOOL" ["int"]
+{-| __C declaration:__ @macro EXPORT@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 10:9@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+eXPORT :: Raw String
+{-| __C declaration:__ @macro EXPORT@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 10:9@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+eXPORT = objectLike "EXPORT" ["[",
+                              "[",
+                              "gnu",
+                              "::",
+                              "visibility",
+                              "(",
+                              "\"default\"",
+                              ")",
+                              "]",
+                              "]"]
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9f4b1c3748016429" hs_bindgen_9f4b1c3748016429_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+hs_bindgen_9f4b1c3748016429 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+hs_bindgen_9f4b1c3748016429 = \x_0 -> hs_bindgen_9f4b1c3748016429_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_safe = hs_bindgen_9f4b1c3748016429
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_183028e559c4eff2" hs_bindgen_183028e559c4eff2_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+hs_bindgen_183028e559c4eff2 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+hs_bindgen_183028e559c4eff2 = \x_0 -> hs_bindgen_183028e559c4eff2_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_safe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_safe = hs_bindgen_183028e559c4eff2
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_e02b651508844cbb" hs_bindgen_e02b651508844cbb_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+hs_bindgen_e02b651508844cbb :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+hs_bindgen_e02b651508844cbb = \x_0 -> hs_bindgen_e02b651508844cbb_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_safe :: CInt -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_safe = hs_bindgen_e02b651508844cbb
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_bc0a3a9b7f66fcad" hs_bindgen_bc0a3a9b7f66fcad_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+hs_bindgen_bc0a3a9b7f66fcad :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+hs_bindgen_bc0a3a9b7f66fcad = \x_0 -> hs_bindgen_bc0a3a9b7f66fcad_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_unsafe = hs_bindgen_bc0a3a9b7f66fcad
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_3e07344f1445a945" hs_bindgen_3e07344f1445a945_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+hs_bindgen_3e07344f1445a945 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+hs_bindgen_3e07344f1445a945 = \x_0 -> hs_bindgen_3e07344f1445a945_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_unsafe = hs_bindgen_3e07344f1445a945
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_d67e55f386a01958" hs_bindgen_d67e55f386a01958_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+hs_bindgen_d67e55f386a01958 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+hs_bindgen_d67e55f386a01958 = \x_0 -> hs_bindgen_d67e55f386a01958_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_unsafe = hs_bindgen_d67e55f386a01958
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_dfdc3c5362469496" hs_bindgen_dfdc3c5362469496_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+hs_bindgen_dfdc3c5362469496 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+hs_bindgen_dfdc3c5362469496 = fmap fromFFIType hs_bindgen_dfdc3c5362469496_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_dfdc3c5362469496
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b44be06e46c9f5f3" hs_bindgen_b44be06e46c9f5f3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+hs_bindgen_b44be06e46c9f5f3 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+hs_bindgen_b44be06e46c9f5f3 = fmap fromFFIType hs_bindgen_b44be06e46c9f5f3_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_b44be06e46c9f5f3
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_f923b761933d67da" hs_bindgen_f923b761933d67da_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+hs_bindgen_f923b761933d67da :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+hs_bindgen_f923b761933d67da = fmap fromFFIType hs_bindgen_f923b761933d67da_base
+{-# NOINLINE quux_funptr #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_funptr = unsafePerformIO hs_bindgen_f923b761933d67da
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes/Example.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes/Example.hs
@@ -0,0 +1,71 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.BOOL(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+newtype BOOL = BOOL
+  { unwrapBOOL :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapBOOL" BOOL ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BOOL {unwrapBOOL = y1}, BG.getField @"unwrapBOOL" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapBOOL" (BG.Ptr BOOL) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapBOOL")
+
+instance HasCField.HasCField BOOL "unwrapBOOL" where
+
+  type CFieldType BOOL "unwrapBOOL" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes/Example/FunPtr.hs
@@ -0,0 +1,101 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    , Example.FunPtr.quux
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/cref_attributes.h>"
+  , "/* test_macrosreparsecref_attributes_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_dfdc3c5362469496 (void)) ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosreparsecref_attributes_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b44be06e46c9f5f3 (void)) ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_macrosreparsecref_attributes_Example_get_quux */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_f923b761933d67da (void)) ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  return &quux;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_dfdc3c5362469496" hs_bindgen_dfdc3c5362469496_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+hs_bindgen_dfdc3c5362469496 :: IO (BG.FunPtr (BOOL -> IO ()))
+hs_bindgen_dfdc3c5362469496 =
+  fmap BG.fromFFIType hs_bindgen_dfdc3c5362469496_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo :: BG.FunPtr (BOOL -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_dfdc3c5362469496
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b44be06e46c9f5f3" hs_bindgen_b44be06e46c9f5f3_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+hs_bindgen_b44be06e46c9f5f3 :: IO (BG.FunPtr (BOOL -> IO ()))
+hs_bindgen_b44be06e46c9f5f3 =
+  fmap BG.fromFFIType hs_bindgen_b44be06e46c9f5f3_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar :: BG.FunPtr (BOOL -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_b44be06e46c9f5f3
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_f923b761933d67da" hs_bindgen_f923b761933d67da_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+hs_bindgen_f923b761933d67da :: IO (BG.FunPtr (BOOL -> IO ()))
+hs_bindgen_f923b761933d67da =
+  fmap BG.fromFFIType hs_bindgen_f923b761933d67da_base
+
+{-# NOINLINE quux #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux :: BG.FunPtr (BOOL -> IO ())
+quux = BG.unsafePerformIO hs_bindgen_f923b761933d67da
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes/Example/Safe.hs
@@ -0,0 +1,110 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    , Example.Safe.quux
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/cref_attributes.h>"
+  , "void hs_bindgen_9f4b1c3748016429 ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_183028e559c4eff2 ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_e02b651508844cbb ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9f4b1c3748016429" hs_bindgen_9f4b1c3748016429_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+hs_bindgen_9f4b1c3748016429 ::
+     BOOL
+  -> IO ()
+hs_bindgen_9f4b1c3748016429 =
+  \x0 ->
+    hs_bindgen_9f4b1c3748016429_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo ::
+     BOOL
+  -> IO ()
+foo = hs_bindgen_9f4b1c3748016429
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_183028e559c4eff2" hs_bindgen_183028e559c4eff2_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+hs_bindgen_183028e559c4eff2 ::
+     BOOL
+  -> IO ()
+hs_bindgen_183028e559c4eff2 =
+  \x0 ->
+    hs_bindgen_183028e559c4eff2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar ::
+     BOOL
+  -> IO ()
+bar = hs_bindgen_183028e559c4eff2
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_e02b651508844cbb" hs_bindgen_e02b651508844cbb_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+hs_bindgen_e02b651508844cbb ::
+     BOOL
+  -> IO ()
+hs_bindgen_e02b651508844cbb =
+  \x0 ->
+    hs_bindgen_e02b651508844cbb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux ::
+     BOOL
+  -> IO ()
+quux = hs_bindgen_e02b651508844cbb
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/cref_attributes/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes/Example/Unsafe.hs
@@ -0,0 +1,110 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    , Example.Unsafe.quux
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/cref_attributes.h>"
+  , "void hs_bindgen_bc0a3a9b7f66fcad ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_3e07344f1445a945 ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_d67e55f386a01958 ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_bc0a3a9b7f66fcad" hs_bindgen_bc0a3a9b7f66fcad_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+hs_bindgen_bc0a3a9b7f66fcad ::
+     BOOL
+  -> IO ()
+hs_bindgen_bc0a3a9b7f66fcad =
+  \x0 ->
+    hs_bindgen_bc0a3a9b7f66fcad_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo ::
+     BOOL
+  -> IO ()
+foo = hs_bindgen_bc0a3a9b7f66fcad
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_3e07344f1445a945" hs_bindgen_3e07344f1445a945_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+hs_bindgen_3e07344f1445a945 ::
+     BOOL
+  -> IO ()
+hs_bindgen_3e07344f1445a945 =
+  \x0 ->
+    hs_bindgen_3e07344f1445a945_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar ::
+     BOOL
+  -> IO ()
+bar = hs_bindgen_3e07344f1445a945
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_d67e55f386a01958" hs_bindgen_d67e55f386a01958_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+hs_bindgen_d67e55f386a01958 ::
+     BOOL
+  -> IO ()
+hs_bindgen_d67e55f386a01958 =
+  \x0 ->
+    hs_bindgen_d67e55f386a01958_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux ::
+     BOOL
+  -> IO ()
+quux = hs_bindgen_d67e55f386a01958
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/cref_attributes/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/cref_attributes.h
+  cname: macro BOOL
+  hsname: BOOL
+hstypes:
+- hsname: BOOL
+  representation:
+    newtype:
+      constructor: BOOL
+      fields:
+      - unwrapBOOL
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/cref_attributes/th.txt b/test-artefacts/fixtures/macros/reparse/cref_attributes/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/cref_attributes/th.txt
@@ -0,0 +1,292 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/cref_attributes.h
+-- #include <macros/reparse/cref_attributes.h>
+-- void hs_bindgen_9f4b1c3748016429 (
+--   BOOL arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_183028e559c4eff2 (
+--   BOOL arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_e02b651508844cbb (
+--   BOOL arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- void hs_bindgen_bc0a3a9b7f66fcad (
+--   BOOL arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_3e07344f1445a945 (
+--   BOOL arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_d67e55f386a01958 (
+--   BOOL arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- /* test_macrosreparsecref_attributes_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dfdc3c5362469496 (void)) (
+--   BOOL arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosreparsecref_attributes_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b44be06e46c9f5f3 (void)) (
+--   BOOL arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_macrosreparsecref_attributes_Example_get_quux */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f923b761933d67da (void)) (
+--   BOOL arg1
+-- )
+-- {
+--   return &quux;
+-- }
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+newtype BOOL
+    = BOOL {unwrapBOOL :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapBOOL" BOOL ty
+    where hasField = \x_0 -> (\y_1 -> BOOL{unwrapBOOL = y_1},
+                              getField @"unwrapBOOL" x_0)
+instance (~) ty CInt => HasField "unwrapBOOL" (Ptr BOOL) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBOOL")
+instance HasCField BOOL "unwrapBOOL"
+    where type CFieldType BOOL "unwrapBOOL" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9f4b1c3748016429" hs_bindgen_9f4b1c3748016429_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+hs_bindgen_9f4b1c3748016429 :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_foo@
+hs_bindgen_9f4b1c3748016429 = \x_0 -> hs_bindgen_9f4b1c3748016429_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_safe :: BOOL -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_safe = hs_bindgen_9f4b1c3748016429
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_183028e559c4eff2" hs_bindgen_183028e559c4eff2_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+hs_bindgen_183028e559c4eff2 :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_bar@
+hs_bindgen_183028e559c4eff2 = \x_0 -> hs_bindgen_183028e559c4eff2_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_safe :: BOOL -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_safe = hs_bindgen_183028e559c4eff2
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_e02b651508844cbb" hs_bindgen_e02b651508844cbb_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+hs_bindgen_e02b651508844cbb :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Safe_quux@
+hs_bindgen_e02b651508844cbb = \x_0 -> hs_bindgen_e02b651508844cbb_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_safe :: BOOL -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_safe = hs_bindgen_e02b651508844cbb
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_bc0a3a9b7f66fcad" hs_bindgen_bc0a3a9b7f66fcad_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+hs_bindgen_bc0a3a9b7f66fcad :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_foo@
+hs_bindgen_bc0a3a9b7f66fcad = \x_0 -> hs_bindgen_bc0a3a9b7f66fcad_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_unsafe :: BOOL -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_unsafe = hs_bindgen_bc0a3a9b7f66fcad
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_3e07344f1445a945" hs_bindgen_3e07344f1445a945_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+hs_bindgen_3e07344f1445a945 :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_bar@
+hs_bindgen_3e07344f1445a945 = \x_0 -> hs_bindgen_3e07344f1445a945_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_unsafe :: BOOL -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_unsafe = hs_bindgen_3e07344f1445a945
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_d67e55f386a01958" hs_bindgen_d67e55f386a01958_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+hs_bindgen_d67e55f386a01958 :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsecref_attributes_Example_Unsafe_quux@
+hs_bindgen_d67e55f386a01958 = \x_0 -> hs_bindgen_d67e55f386a01958_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_unsafe :: BOOL -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_unsafe = hs_bindgen_d67e55f386a01958
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_dfdc3c5362469496" hs_bindgen_dfdc3c5362469496_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+hs_bindgen_dfdc3c5362469496 :: IO (FunPtr (BOOL -> IO ()))
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_foo@
+hs_bindgen_dfdc3c5362469496 = fmap fromFFIType hs_bindgen_dfdc3c5362469496_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_funptr :: FunPtr (BOOL -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_dfdc3c5362469496
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b44be06e46c9f5f3" hs_bindgen_b44be06e46c9f5f3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+hs_bindgen_b44be06e46c9f5f3 :: IO (FunPtr (BOOL -> IO ()))
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_bar@
+hs_bindgen_b44be06e46c9f5f3 = fmap fromFFIType hs_bindgen_b44be06e46c9f5f3_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_funptr :: FunPtr (BOOL -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 6:37@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_b44be06e46c9f5f3
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_f923b761933d67da" hs_bindgen_f923b761933d67da_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+hs_bindgen_f923b761933d67da :: IO (FunPtr (BOOL -> IO ()))
+-- __unique:__ @test_macrosreparsecref_attributes_Example_get_quux@
+hs_bindgen_f923b761933d67da = fmap fromFFIType hs_bindgen_f923b761933d67da_base
+{-# NOINLINE quux_funptr #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_funptr :: FunPtr (BOOL -> IO ())
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/cref_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/cref_attributes.h@
+-}
+quux_funptr = unsafePerformIO hs_bindgen_f923b761933d67da
diff --git a/test-artefacts/fixtures/macros/reparse/defer_wrong.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/defer_wrong.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/defer_wrong.1.empty/Example.hs
@@ -0,0 +1,163 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    , Example.Foo(..)
+    , Example.Bar(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 11:8@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/defer_wrong.h 11:16@
+
+         __exported by:__ @macros\/reparse\/defer_wrong.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 11:16@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 15:11@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Foo = Foo
+  { unwrapFoo :: S
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ S) => BG.CompatHasField.HasField "unwrapFoo" Foo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo {unwrapFoo = y1}, BG.getField @"unwrapFoo" x0)
+
+instance (ty ~ S) => BG.HasField "unwrapFoo" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFoo")
+
+instance HasCField.HasCField Foo "unwrapFoo" where
+
+  type CFieldType Foo "unwrapFoo" = S
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 16:13@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Bar = Bar
+  { unwrapBar :: BG.Ptr S
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.Ptr S) => BG.CompatHasField.HasField "unwrapBar" Bar ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bar {unwrapBar = y1}, BG.getField @"unwrapBar" x0)
+
+instance ( ty ~ BG.Ptr S
+         ) => BG.HasField "unwrapBar" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapBar")
+
+instance HasCField.HasCField Bar "unwrapBar" where
+
+  type CFieldType Bar "unwrapBar" = BG.Ptr S
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/defer_wrong.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/defer_wrong.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/defer_wrong.1.empty/bindingspec.yaml
@@ -0,0 +1,75 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/defer_wrong.h
+  cname: struct S
+  hsname: S
+- headers: macros/reparse/defer_wrong.h
+  cname: foo
+  hsname: Foo
+- headers: macros/reparse/defer_wrong.h
+  cname: bar
+  hsname: Bar
+hstypes:
+- hsname: Bar
+  representation:
+    newtype:
+      constructor: Bar
+      fields:
+      - unwrapBar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    newtype:
+      constructor: Foo
+      fields:
+      - unwrapFoo
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/defer_wrong.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/defer_wrong.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/defer_wrong.1.empty/th.txt
@@ -0,0 +1,74 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/defer_wrong.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 11:8@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/reparse\/defer_wrong.h 11:16@
+
+              __exported by:__ @macros\/reparse\/defer_wrong.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 15:11@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Foo
+    = Foo {unwrapFoo :: S}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty S => HasField "unwrapFoo" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{unwrapFoo = y_1},
+                              getField @"unwrapFoo" x_0)
+instance (~) ty S => HasField "unwrapFoo" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo")
+instance HasCField Foo "unwrapFoo"
+    where type CFieldType Foo "unwrapFoo" = S
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 16:13@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Bar
+    = Bar {unwrapBar :: (Ptr S)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr S) => HasField "unwrapBar" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{unwrapBar = y_1},
+                              getField @"unwrapBar" x_0)
+instance (~) ty (Ptr S) => HasField "unwrapBar" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBar")
+instance HasCField Bar "unwrapBar"
+    where type CFieldType Bar "unwrapBar" = Ptr S
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/defer_wrong.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/defer_wrong.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/defer_wrong.2.raw/Example.hs
@@ -0,0 +1,174 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    , Example.t
+    , Example.Foo(..)
+    , Example.Bar(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Show, String, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 11:8@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/defer_wrong.h 11:16@
+
+         __exported by:__ @macros\/reparse\/defer_wrong.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 11:16@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 13:9@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+t :: Macro.Raw String
+t = Macro.objectLike "T" ["struct", "S"]
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 15:11@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Foo = Foo
+  { unwrapFoo :: S
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ S) => BG.CompatHasField.HasField "unwrapFoo" Foo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo {unwrapFoo = y1}, BG.getField @"unwrapFoo" x0)
+
+instance (ty ~ S) => BG.HasField "unwrapFoo" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFoo")
+
+instance HasCField.HasCField Foo "unwrapFoo" where
+
+  type CFieldType Foo "unwrapFoo" = S
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 16:13@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Bar = Bar
+  { unwrapBar :: BG.Ptr S
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.Ptr S) => BG.CompatHasField.HasField "unwrapBar" Bar ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bar {unwrapBar = y1}, BG.getField @"unwrapBar" x0)
+
+instance ( ty ~ BG.Ptr S
+         ) => BG.HasField "unwrapBar" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapBar")
+
+instance HasCField.HasCField Bar "unwrapBar" where
+
+  type CFieldType Bar "unwrapBar" = BG.Ptr S
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/defer_wrong.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/defer_wrong.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/defer_wrong.2.raw/bindingspec.yaml
@@ -0,0 +1,75 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/defer_wrong.h
+  cname: struct S
+  hsname: S
+- headers: macros/reparse/defer_wrong.h
+  cname: foo
+  hsname: Foo
+- headers: macros/reparse/defer_wrong.h
+  cname: bar
+  hsname: Bar
+hstypes:
+- hsname: Bar
+  representation:
+    newtype:
+      constructor: Bar
+      fields:
+      - unwrapBar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    newtype:
+      constructor: Foo
+      fields:
+      - unwrapFoo
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/defer_wrong.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/defer_wrong.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/defer_wrong.2.raw/th.txt
@@ -0,0 +1,88 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/defer_wrong.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 11:8@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/reparse\/defer_wrong.h 11:16@
+
+              __exported by:__ @macros\/reparse\/defer_wrong.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 13:9@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+t :: Raw String
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 13:9@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+t = objectLike "T" ["struct", "S"]
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 15:11@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Foo
+    = Foo {unwrapFoo :: S}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty S => HasField "unwrapFoo" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{unwrapFoo = y_1},
+                              getField @"unwrapFoo" x_0)
+instance (~) ty S => HasField "unwrapFoo" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo")
+instance HasCField Foo "unwrapFoo"
+    where type CFieldType Foo "unwrapFoo" = S
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 16:13@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Bar
+    = Bar {unwrapBar :: (Ptr S)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr S) => HasField "unwrapBar" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{unwrapBar = y_1},
+                              getField @"unwrapBar" x_0)
+instance (~) ty (Ptr S) => HasField "unwrapBar" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBar")
+instance HasCField Bar "unwrapBar"
+    where type CFieldType Bar "unwrapBar" = Ptr S
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/defer_wrong/Example.hs b/test-artefacts/fixtures/macros/reparse/defer_wrong/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/defer_wrong/Example.hs
@@ -0,0 +1,197 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    , Example.T(..)
+    , Example.Foo(..)
+    , Example.Bar(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 11:8@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+data S = S
+  { s_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/defer_wrong.h 11:16@
+
+         __exported by:__ @macros\/reparse\/defer_wrong.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 11:16@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 13:9@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype T = T
+  { unwrapT :: S
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ S) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ S) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = S
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 15:11@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Foo = Foo
+  { unwrapFoo :: T
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ T) => BG.CompatHasField.HasField "unwrapFoo" Foo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo {unwrapFoo = y1}, BG.getField @"unwrapFoo" x0)
+
+instance (ty ~ T) => BG.HasField "unwrapFoo" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFoo")
+
+instance HasCField.HasCField Foo "unwrapFoo" where
+
+  type CFieldType Foo "unwrapFoo" = T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 16:13@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Bar = Bar
+  { unwrapBar :: BG.Ptr T
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.Ptr T) => BG.CompatHasField.HasField "unwrapBar" Bar ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bar {unwrapBar = y1}, BG.getField @"unwrapBar" x0)
+
+instance ( ty ~ BG.Ptr T
+         ) => BG.HasField "unwrapBar" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapBar")
+
+instance HasCField.HasCField Bar "unwrapBar" where
+
+  type CFieldType Bar "unwrapBar" = BG.Ptr T
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/defer_wrong/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/defer_wrong/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/defer_wrong/bindingspec.yaml
@@ -0,0 +1,96 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/defer_wrong.h
+  cname: struct S
+  hsname: S
+- headers: macros/reparse/defer_wrong.h
+  cname: macro T
+  hsname: T
+- headers: macros/reparse/defer_wrong.h
+  cname: foo
+  hsname: Foo
+- headers: macros/reparse/defer_wrong.h
+  cname: bar
+  hsname: Bar
+hstypes:
+- hsname: Bar
+  representation:
+    newtype:
+      constructor: Bar
+      fields:
+      - unwrapBar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    newtype:
+      constructor: Foo
+      fields:
+      - unwrapFoo
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/defer_wrong/th.txt b/test-artefacts/fixtures/macros/reparse/defer_wrong/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/defer_wrong/th.txt
@@ -0,0 +1,92 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/defer_wrong.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 11:8@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+data S
+    = S {s_x :: CInt
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/reparse\/defer_wrong.h 11:16@
+
+              __exported by:__ @macros\/reparse\/defer_wrong.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CInt => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty CInt => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 13:9@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype T
+    = T {unwrapT :: S}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty S => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty S => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = S
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 15:11@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Foo
+    = Foo {unwrapFoo :: T}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty T => HasField "unwrapFoo" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{unwrapFoo = y_1},
+                              getField @"unwrapFoo" x_0)
+instance (~) ty T => HasField "unwrapFoo" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo")
+instance HasCField Foo "unwrapFoo"
+    where type CFieldType Foo "unwrapFoo" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/defer_wrong.h 16:13@
+
+    __exported by:__ @macros\/reparse\/defer_wrong.h@
+-}
+newtype Bar
+    = Bar {unwrapBar :: (Ptr T)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr T) => HasField "unwrapBar" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{unwrapBar = y_1},
+                              getField @"unwrapBar" x_0)
+instance (~) ty (Ptr T) => HasField "unwrapBar" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBar")
+instance HasCField Bar "unwrapBar"
+    where type CFieldType Bar "unwrapBar" = Ptr T
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example.hs
@@ -0,0 +1,133 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 15:11@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype A = A
+  { unwrapA :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:8@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+data S = S
+  { s_x :: CA.ConstantArray 3 BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:14@
+
+         __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:14@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f
+    , Example.FunPtr.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "/* test_macrosreparseend_in_macro_ar_Example_get_f */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_96f030fb3ea3d43d (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f;"
+  , "}"
+  , "/* test_macrosreparseend_in_macro_ar_Example_get_g */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_cd7b12aa8c3ceb75 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &g;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_96f030fb3ea3d43d" hs_bindgen_96f030fb3ea3d43d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+hs_bindgen_96f030fb3ea3d43d :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_96f030fb3ea3d43d =
+  fmap BG.fromFFIType hs_bindgen_96f030fb3ea3d43d_base
+
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+f = BG.unsafePerformIO hs_bindgen_96f030fb3ea3d43d
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_cd7b12aa8c3ceb75" hs_bindgen_cd7b12aa8c3ceb75_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+hs_bindgen_cd7b12aa8c3ceb75 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_cd7b12aa8c3ceb75 =
+  fmap BG.fromFFIType hs_bindgen_cd7b12aa8c3ceb75_base
+
+{-# NOINLINE g #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+g = BG.unsafePerformIO hs_bindgen_cd7b12aa8c3ceb75
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/Global.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.arr
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "/* test_macrosreparseend_in_macro_ar_Example_get_arr */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_fa8758c7fbcb4eb0 (void))[3]"
+  , "{"
+  , "  return &arr;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+foreign import ccall unsafe "hs_bindgen_fa8758c7fbcb4eb0" hs_bindgen_fa8758c7fbcb4eb0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+hs_bindgen_fa8758c7fbcb4eb0 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_fa8758c7fbcb4eb0 =
+  fmap BG.fromFFIType hs_bindgen_fa8758c7fbcb4eb0_base
+
+{-# NOINLINE arr #-}
+{-| __C declaration:__ @arr@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 23:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+arr :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr = BG.unsafePerformIO hs_bindgen_fa8758c7fbcb4eb0
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f
+    , Example.Safe.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "signed int hs_bindgen_32975406bf2752f4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_7b14389d4be48230 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (g)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_32975406bf2752f4" hs_bindgen_32975406bf2752f4_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+hs_bindgen_32975406bf2752f4 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_32975406bf2752f4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_32975406bf2752f4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+f = hs_bindgen_32975406bf2752f4
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+foreign import ccall safe "hs_bindgen_7b14389d4be48230" hs_bindgen_7b14389d4be48230_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+hs_bindgen_7b14389d4be48230 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_7b14389d4be48230 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7b14389d4be48230_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+g = hs_bindgen_7b14389d4be48230
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f
+    , Example.Unsafe.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "signed int hs_bindgen_5f3d395b37b2aea3 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4bdcd42db8457bfb ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (g)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_5f3d395b37b2aea3" hs_bindgen_5f3d395b37b2aea3_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+hs_bindgen_5f3d395b37b2aea3 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_5f3d395b37b2aea3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5f3d395b37b2aea3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+f = hs_bindgen_5f3d395b37b2aea3
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+foreign import ccall unsafe "hs_bindgen_4bdcd42db8457bfb" hs_bindgen_4bdcd42db8457bfb_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+hs_bindgen_4bdcd42db8457bfb ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_4bdcd42db8457bfb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4bdcd42db8457bfb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+g = hs_bindgen_4bdcd42db8457bfb
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/bindingspec.yaml
@@ -0,0 +1,50 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/end_in_macro_arg.h
+  cname: A
+  hsname: A
+- headers: macros/reparse/end_in_macro_arg.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.1.empty/th.txt
@@ -0,0 +1,255 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/end_in_macro_arg.h
+-- #include <macros/reparse/end_in_macro_arg.h>
+-- signed int hs_bindgen_32975406bf2752f4 (
+--   signed int arg1
+-- )
+-- {
+--   return (f)(arg1);
+-- }
+-- signed int hs_bindgen_7b14389d4be48230 (
+--   signed int arg1
+-- )
+-- {
+--   return (g)(arg1);
+-- }
+-- signed int hs_bindgen_5f3d395b37b2aea3 (
+--   signed int arg1
+-- )
+-- {
+--   return (f)(arg1);
+-- }
+-- signed int hs_bindgen_4bdcd42db8457bfb (
+--   signed int arg1
+-- )
+-- {
+--   return (g)(arg1);
+-- }
+-- /* test_macrosreparseend_in_macro_ar_Example_get_f */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_96f030fb3ea3d43d (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f;
+-- }
+-- /* test_macrosreparseend_in_macro_ar_Example_get_g */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_cd7b12aa8c3ceb75 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &g;
+-- }
+-- /* test_macrosreparseend_in_macro_ar_Example_get_arr */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_fa8758c7fbcb4eb0 (void))[3]
+-- {
+--   return &arr;
+-- }
+{-| __C declaration:__ @A@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 15:11@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype A
+    = A {unwrapA :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = ConstantArray 3 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:8@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+data S
+    = S {s_x :: (ConstantArray 3 CInt)
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:14@
+
+              __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty (ConstantArray 3 CInt) => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = ConstantArray 3 CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_32975406bf2752f4" hs_bindgen_32975406bf2752f4_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+hs_bindgen_32975406bf2752f4 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+hs_bindgen_32975406bf2752f4 = \x_0 -> fmap fromFFIType (hs_bindgen_32975406bf2752f4_base (toFFIType x_0))
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_safe :: CInt -> IO CInt
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_safe = hs_bindgen_32975406bf2752f4
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+foreign import ccall safe "hs_bindgen_7b14389d4be48230" hs_bindgen_7b14389d4be48230_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+hs_bindgen_7b14389d4be48230 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+hs_bindgen_7b14389d4be48230 = \x_0 -> fmap fromFFIType (hs_bindgen_7b14389d4be48230_base (toFFIType x_0))
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_safe :: CInt -> IO CInt
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_safe = hs_bindgen_7b14389d4be48230
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_5f3d395b37b2aea3" hs_bindgen_5f3d395b37b2aea3_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+hs_bindgen_5f3d395b37b2aea3 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+hs_bindgen_5f3d395b37b2aea3 = \x_0 -> fmap fromFFIType (hs_bindgen_5f3d395b37b2aea3_base (toFFIType x_0))
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_unsafe = hs_bindgen_5f3d395b37b2aea3
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+foreign import ccall unsafe "hs_bindgen_4bdcd42db8457bfb" hs_bindgen_4bdcd42db8457bfb_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+hs_bindgen_4bdcd42db8457bfb :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+hs_bindgen_4bdcd42db8457bfb = \x_0 -> fmap fromFFIType (hs_bindgen_4bdcd42db8457bfb_base (toFFIType x_0))
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_unsafe = hs_bindgen_4bdcd42db8457bfb
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_96f030fb3ea3d43d" hs_bindgen_96f030fb3ea3d43d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+hs_bindgen_96f030fb3ea3d43d :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+hs_bindgen_96f030fb3ea3d43d = fmap fromFFIType hs_bindgen_96f030fb3ea3d43d_base
+{-# NOINLINE f_funptr #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_funptr = unsafePerformIO hs_bindgen_96f030fb3ea3d43d
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_cd7b12aa8c3ceb75" hs_bindgen_cd7b12aa8c3ceb75_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+hs_bindgen_cd7b12aa8c3ceb75 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+hs_bindgen_cd7b12aa8c3ceb75 = fmap fromFFIType hs_bindgen_cd7b12aa8c3ceb75_base
+{-# NOINLINE g_funptr #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_funptr = unsafePerformIO hs_bindgen_cd7b12aa8c3ceb75
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+foreign import ccall unsafe "hs_bindgen_fa8758c7fbcb4eb0" hs_bindgen_fa8758c7fbcb4eb0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+hs_bindgen_fa8758c7fbcb4eb0 :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+hs_bindgen_fa8758c7fbcb4eb0 = fmap fromFFIType hs_bindgen_fa8758c7fbcb4eb0_base
+{-# NOINLINE arr #-}
+{-| __C declaration:__ @arr@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 23:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+arr :: Ptr (ConstantArray 3 CInt)
+{-| __C declaration:__ @arr@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 23:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+arr = unsafePerformIO hs_bindgen_fa8758c7fbcb4eb0
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example.hs
@@ -0,0 +1,175 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.t
+    , Example.u
+    , Example.pARAMS
+    , Example.iD
+    , Example.A(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 8:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+t :: Macro.Raw String
+t = Macro.objectLike "T" ["int"]
+
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 9:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+u :: Macro.Raw String
+u = Macro.objectLike "U" ["int"]
+
+{-| __C declaration:__ @macro PARAMS@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 10:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+pARAMS :: Macro.Raw String
+pARAMS =
+  Macro.functionLike "PARAMS" ["args"] ["args"]
+
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 11:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+iD :: Macro.Raw String
+iD = Macro.functionLike "ID" ["x"] ["x"]
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 15:11@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype A = A
+  { unwrapA :: CA.ConstantArray 3 BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" =
+    CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:8@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+data S = S
+  { s_x :: CA.ConstantArray 3 BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:14@
+
+         __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:14@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance ( ty ~ CA.ConstantArray 3 BG.CInt
+         ) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = CA.ConstantArray 3 BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/FunPtr.hs
@@ -0,0 +1,72 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f
+    , Example.FunPtr.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "/* test_macrosreparseend_in_macro_ar_Example_get_f */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_96f030fb3ea3d43d (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &f;"
+  , "}"
+  , "/* test_macrosreparseend_in_macro_ar_Example_get_g */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_cd7b12aa8c3ceb75 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &g;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_96f030fb3ea3d43d" hs_bindgen_96f030fb3ea3d43d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+hs_bindgen_96f030fb3ea3d43d :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_96f030fb3ea3d43d =
+  fmap BG.fromFFIType hs_bindgen_96f030fb3ea3d43d_base
+
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+f = BG.unsafePerformIO hs_bindgen_96f030fb3ea3d43d
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_cd7b12aa8c3ceb75" hs_bindgen_cd7b12aa8c3ceb75_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+hs_bindgen_cd7b12aa8c3ceb75 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_cd7b12aa8c3ceb75 =
+  fmap BG.fromFFIType hs_bindgen_cd7b12aa8c3ceb75_base
+
+{-# NOINLINE g #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+g = BG.unsafePerformIO hs_bindgen_cd7b12aa8c3ceb75
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/Global.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.arr
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "/* test_macrosreparseend_in_macro_ar_Example_get_arr */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_fa8758c7fbcb4eb0 (void))[3]"
+  , "{"
+  , "  return &arr;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+foreign import ccall unsafe "hs_bindgen_fa8758c7fbcb4eb0" hs_bindgen_fa8758c7fbcb4eb0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+hs_bindgen_fa8758c7fbcb4eb0 :: IO (BG.Ptr (CA.ConstantArray 3 BG.CInt))
+hs_bindgen_fa8758c7fbcb4eb0 =
+  fmap BG.fromFFIType hs_bindgen_fa8758c7fbcb4eb0_base
+
+{-# NOINLINE arr #-}
+{-| __C declaration:__ @arr@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 23:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+arr :: BG.Ptr (CA.ConstantArray 3 BG.CInt)
+arr = BG.unsafePerformIO hs_bindgen_fa8758c7fbcb4eb0
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/Safe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f
+    , Example.Safe.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "signed int hs_bindgen_32975406bf2752f4 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_7b14389d4be48230 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (g)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_32975406bf2752f4" hs_bindgen_32975406bf2752f4_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+hs_bindgen_32975406bf2752f4 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_32975406bf2752f4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_32975406bf2752f4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+f = hs_bindgen_32975406bf2752f4
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+foreign import ccall safe "hs_bindgen_7b14389d4be48230" hs_bindgen_7b14389d4be48230_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+hs_bindgen_7b14389d4be48230 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_7b14389d4be48230 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7b14389d4be48230_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+g = hs_bindgen_7b14389d4be48230
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/Example/Unsafe.hs
@@ -0,0 +1,80 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f
+    , Example.Unsafe.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "signed int hs_bindgen_5f3d395b37b2aea3 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (f)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4bdcd42db8457bfb ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (g)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_5f3d395b37b2aea3" hs_bindgen_5f3d395b37b2aea3_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+hs_bindgen_5f3d395b37b2aea3 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_5f3d395b37b2aea3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5f3d395b37b2aea3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+f = hs_bindgen_5f3d395b37b2aea3
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+foreign import ccall unsafe "hs_bindgen_4bdcd42db8457bfb" hs_bindgen_4bdcd42db8457bfb_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+hs_bindgen_4bdcd42db8457bfb ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_4bdcd42db8457bfb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4bdcd42db8457bfb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g ::
+     BG.CInt
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+g = hs_bindgen_4bdcd42db8457bfb
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/bindingspec.yaml
@@ -0,0 +1,50 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/end_in_macro_arg.h
+  cname: A
+  hsname: A
+- headers: macros/reparse/end_in_macro_arg.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg.2.raw/th.txt
@@ -0,0 +1,311 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/end_in_macro_arg.h
+-- #include <macros/reparse/end_in_macro_arg.h>
+-- signed int hs_bindgen_32975406bf2752f4 (
+--   signed int arg1
+-- )
+-- {
+--   return (f)(arg1);
+-- }
+-- signed int hs_bindgen_7b14389d4be48230 (
+--   signed int arg1
+-- )
+-- {
+--   return (g)(arg1);
+-- }
+-- signed int hs_bindgen_5f3d395b37b2aea3 (
+--   signed int arg1
+-- )
+-- {
+--   return (f)(arg1);
+-- }
+-- signed int hs_bindgen_4bdcd42db8457bfb (
+--   signed int arg1
+-- )
+-- {
+--   return (g)(arg1);
+-- }
+-- /* test_macrosreparseend_in_macro_ar_Example_get_f */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_96f030fb3ea3d43d (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &f;
+-- }
+-- /* test_macrosreparseend_in_macro_ar_Example_get_g */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_cd7b12aa8c3ceb75 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &g;
+-- }
+-- /* test_macrosreparseend_in_macro_ar_Example_get_arr */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_fa8758c7fbcb4eb0 (void))[3]
+-- {
+--   return &arr;
+-- }
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 8:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+t :: Raw String
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 8:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+t = objectLike "T" ["int"]
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 9:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+u :: Raw String
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 9:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+u = objectLike "U" ["int"]
+{-| __C declaration:__ @macro PARAMS@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 10:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+pARAMS :: Raw String
+{-| __C declaration:__ @macro PARAMS@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 10:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+pARAMS = functionLike "PARAMS" ["args"] ["args"]
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 11:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+iD :: Raw String
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 11:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+iD = functionLike "ID" ["x"] ["x"]
+{-| __C declaration:__ @A@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 15:11@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype A
+    = A {unwrapA :: (ConstantArray 3 CInt)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 CInt) => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = ConstantArray 3 CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:8@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+data S
+    = S {s_x :: (ConstantArray 3 CInt)
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:14@
+
+              __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty (ConstantArray 3 CInt) => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty (ConstantArray 3 CInt) =>
+         HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = ConstantArray 3 CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_32975406bf2752f4" hs_bindgen_32975406bf2752f4_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+hs_bindgen_32975406bf2752f4 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+hs_bindgen_32975406bf2752f4 = \x_0 -> fmap fromFFIType (hs_bindgen_32975406bf2752f4_base (toFFIType x_0))
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_safe :: CInt -> IO CInt
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_safe = hs_bindgen_32975406bf2752f4
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+foreign import ccall safe "hs_bindgen_7b14389d4be48230" hs_bindgen_7b14389d4be48230_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+hs_bindgen_7b14389d4be48230 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+hs_bindgen_7b14389d4be48230 = \x_0 -> fmap fromFFIType (hs_bindgen_7b14389d4be48230_base (toFFIType x_0))
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_safe :: CInt -> IO CInt
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_safe = hs_bindgen_7b14389d4be48230
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_5f3d395b37b2aea3" hs_bindgen_5f3d395b37b2aea3_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+hs_bindgen_5f3d395b37b2aea3 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+hs_bindgen_5f3d395b37b2aea3 = \x_0 -> fmap fromFFIType (hs_bindgen_5f3d395b37b2aea3_base (toFFIType x_0))
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_unsafe = hs_bindgen_5f3d395b37b2aea3
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+foreign import ccall unsafe "hs_bindgen_4bdcd42db8457bfb" hs_bindgen_4bdcd42db8457bfb_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+hs_bindgen_4bdcd42db8457bfb :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+hs_bindgen_4bdcd42db8457bfb = \x_0 -> fmap fromFFIType (hs_bindgen_4bdcd42db8457bfb_base (toFFIType x_0))
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_unsafe = hs_bindgen_4bdcd42db8457bfb
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_96f030fb3ea3d43d" hs_bindgen_96f030fb3ea3d43d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+hs_bindgen_96f030fb3ea3d43d :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+hs_bindgen_96f030fb3ea3d43d = fmap fromFFIType hs_bindgen_96f030fb3ea3d43d_base
+{-# NOINLINE f_funptr #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_funptr = unsafePerformIO hs_bindgen_96f030fb3ea3d43d
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_cd7b12aa8c3ceb75" hs_bindgen_cd7b12aa8c3ceb75_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+hs_bindgen_cd7b12aa8c3ceb75 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+hs_bindgen_cd7b12aa8c3ceb75 = fmap fromFFIType hs_bindgen_cd7b12aa8c3ceb75_base
+{-# NOINLINE g_funptr #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_funptr = unsafePerformIO hs_bindgen_cd7b12aa8c3ceb75
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+foreign import ccall unsafe "hs_bindgen_fa8758c7fbcb4eb0" hs_bindgen_fa8758c7fbcb4eb0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+hs_bindgen_fa8758c7fbcb4eb0 :: IO (Ptr (ConstantArray 3 CInt))
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+hs_bindgen_fa8758c7fbcb4eb0 = fmap fromFFIType hs_bindgen_fa8758c7fbcb4eb0_base
+{-# NOINLINE arr #-}
+{-| __C declaration:__ @arr@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 23:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+arr :: Ptr (ConstantArray 3 CInt)
+{-| __C declaration:__ @arr@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 23:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+arr = unsafePerformIO hs_bindgen_fa8758c7fbcb4eb0
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example.hs
@@ -0,0 +1,244 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , Example.U(..)
+    , Example.pARAMS
+    , Example.iD
+    , Example.A(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 8:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 9:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype U = U
+  { unwrapU :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapU" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> U {unwrapU = y1}, BG.getField @"unwrapU" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapU" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapU")
+
+instance HasCField.HasCField U "unwrapU" where
+
+  type CFieldType U "unwrapU" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro PARAMS@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 10:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+pARAMS :: forall a0. a0 -> a0
+pARAMS = \args0 -> args0
+
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 11:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+iD :: forall a0. a0 -> a0
+iD = \x0 -> x0
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 15:11@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype A = A
+  { unwrapA :: CA.ConstantArray 3 T
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 T
+         ) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance ( ty ~ CA.ConstantArray 3 T
+         ) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = CA.ConstantArray 3 T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:8@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+data S = S
+  { s_x :: CA.ConstantArray 3 T
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:14@
+
+         __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:14@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+instance ( ty ~ CA.ConstantArray 3 T
+         ) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_x = y1}, BG.getField @"s_x" x0)
+
+instance ( ty ~ CA.ConstantArray 3 T
+         ) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = CA.ConstantArray 3 T
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/FunPtr.hs
@@ -0,0 +1,73 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f
+    , Example.FunPtr.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "/* test_macrosreparseend_in_macro_ar_Example_get_f */"
+  , "__attribute__ ((const))"
+  , "T (*hs_bindgen_96f030fb3ea3d43d (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &f;"
+  , "}"
+  , "/* test_macrosreparseend_in_macro_ar_Example_get_g */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_cd7b12aa8c3ceb75 (void)) ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  return &g;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_96f030fb3ea3d43d" hs_bindgen_96f030fb3ea3d43d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+hs_bindgen_96f030fb3ea3d43d :: IO (BG.FunPtr (T -> IO T))
+hs_bindgen_96f030fb3ea3d43d =
+  fmap BG.fromFFIType hs_bindgen_96f030fb3ea3d43d_base
+
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f :: BG.FunPtr (T -> IO T)
+f = BG.unsafePerformIO hs_bindgen_96f030fb3ea3d43d
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_cd7b12aa8c3ceb75" hs_bindgen_cd7b12aa8c3ceb75_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+hs_bindgen_cd7b12aa8c3ceb75 :: IO (BG.FunPtr (U -> IO BG.CInt))
+hs_bindgen_cd7b12aa8c3ceb75 =
+  fmap BG.fromFFIType hs_bindgen_cd7b12aa8c3ceb75_base
+
+{-# NOINLINE g #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g :: BG.FunPtr (U -> IO BG.CInt)
+g = BG.unsafePerformIO hs_bindgen_cd7b12aa8c3ceb75
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/Global.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.arr
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "/* test_macrosreparseend_in_macro_ar_Example_get_arr */"
+  , "__attribute__ ((const))"
+  , "T (*hs_bindgen_fa8758c7fbcb4eb0 (void))[3]"
+  , "{"
+  , "  return &arr;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+foreign import ccall unsafe "hs_bindgen_fa8758c7fbcb4eb0" hs_bindgen_fa8758c7fbcb4eb0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+hs_bindgen_fa8758c7fbcb4eb0 :: IO (BG.Ptr (CA.ConstantArray 3 T))
+hs_bindgen_fa8758c7fbcb4eb0 =
+  fmap BG.fromFFIType hs_bindgen_fa8758c7fbcb4eb0_base
+
+{-# NOINLINE arr #-}
+{-| __C declaration:__ @arr@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 23:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+arr :: BG.Ptr (CA.ConstantArray 3 T)
+arr = BG.unsafePerformIO hs_bindgen_fa8758c7fbcb4eb0
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/Safe.hs
@@ -0,0 +1,81 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f
+    , Example.Safe.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "T hs_bindgen_32975406bf2752f4 ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return (f)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_7b14389d4be48230 ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  return (g)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_32975406bf2752f4" hs_bindgen_32975406bf2752f4_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+hs_bindgen_32975406bf2752f4 ::
+     T
+  -> IO T
+hs_bindgen_32975406bf2752f4 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_32975406bf2752f4_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f ::
+     T
+     -- ^ __C declaration:__ @a@
+  -> IO T
+f = hs_bindgen_32975406bf2752f4
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+foreign import ccall safe "hs_bindgen_7b14389d4be48230" hs_bindgen_7b14389d4be48230_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+hs_bindgen_7b14389d4be48230 ::
+     U
+  -> IO BG.CInt
+hs_bindgen_7b14389d4be48230 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_7b14389d4be48230_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g ::
+     U
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+g = hs_bindgen_7b14389d4be48230
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/Example/Unsafe.hs
@@ -0,0 +1,81 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f
+    , Example.Unsafe.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/end_in_macro_arg.h>"
+  , "T hs_bindgen_5f3d395b37b2aea3 ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return (f)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4bdcd42db8457bfb ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  return (g)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_5f3d395b37b2aea3" hs_bindgen_5f3d395b37b2aea3_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+hs_bindgen_5f3d395b37b2aea3 ::
+     T
+  -> IO T
+hs_bindgen_5f3d395b37b2aea3 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_5f3d395b37b2aea3_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f ::
+     T
+     -- ^ __C declaration:__ @a@
+  -> IO T
+f = hs_bindgen_5f3d395b37b2aea3
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+foreign import ccall unsafe "hs_bindgen_4bdcd42db8457bfb" hs_bindgen_4bdcd42db8457bfb_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+hs_bindgen_4bdcd42db8457bfb ::
+     U
+  -> IO BG.CInt
+hs_bindgen_4bdcd42db8457bfb =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4bdcd42db8457bfb_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g ::
+     U
+     -- ^ __C declaration:__ @a@
+  -> IO BG.CInt
+g = hs_bindgen_4bdcd42db8457bfb
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/bindingspec.yaml
@@ -0,0 +1,124 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/end_in_macro_arg.h
+  cname: macro T
+  hsname: T
+- headers: macros/reparse/end_in_macro_arg.h
+  cname: macro U
+  hsname: U
+- headers: macros/reparse/end_in_macro_arg.h
+  cname: A
+  hsname: A
+- headers: macros/reparse/end_in_macro_arg.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/th.txt b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/end_in_macro_arg/th.txt
@@ -0,0 +1,347 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/end_in_macro_arg.h
+-- #include <macros/reparse/end_in_macro_arg.h>
+-- T hs_bindgen_32975406bf2752f4 (
+--   T arg1
+-- )
+-- {
+--   return (f)(arg1);
+-- }
+-- signed int hs_bindgen_7b14389d4be48230 (
+--   U arg1
+-- )
+-- {
+--   return (g)(arg1);
+-- }
+-- T hs_bindgen_5f3d395b37b2aea3 (
+--   T arg1
+-- )
+-- {
+--   return (f)(arg1);
+-- }
+-- signed int hs_bindgen_4bdcd42db8457bfb (
+--   U arg1
+-- )
+-- {
+--   return (g)(arg1);
+-- }
+-- /* test_macrosreparseend_in_macro_ar_Example_get_f */
+-- __attribute__ ((const))
+-- T (*hs_bindgen_96f030fb3ea3d43d (void)) (
+--   T arg1
+-- )
+-- {
+--   return &f;
+-- }
+-- /* test_macrosreparseend_in_macro_ar_Example_get_g */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_cd7b12aa8c3ceb75 (void)) (
+--   U arg1
+-- )
+-- {
+--   return &g;
+-- }
+-- /* test_macrosreparseend_in_macro_ar_Example_get_arr */
+-- __attribute__ ((const))
+-- T (*hs_bindgen_fa8758c7fbcb4eb0 (void))[3]
+-- {
+--   return &arr;
+-- }
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 8:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype T
+    = T {unwrapT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 9:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype U
+    = U {unwrapU :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapU" U ty
+    where hasField = \x_0 -> (\y_1 -> U{unwrapU = y_1},
+                              getField @"unwrapU" x_0)
+instance (~) ty CInt => HasField "unwrapU" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapU")
+instance HasCField U "unwrapU"
+    where type CFieldType U "unwrapU" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro PARAMS@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 10:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+pARAMS :: forall a_0 . a_0 -> a_0
+{-| __C declaration:__ @macro PARAMS@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 10:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+pARAMS = \args_0 -> args_0
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 11:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+iD :: forall a_0 . a_0 -> a_0
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 11:9@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+iD = \x_0 -> x_0
+{-| __C declaration:__ @A@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 15:11@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+newtype A
+    = A {unwrapA :: (ConstantArray 3 T)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 T) => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty (ConstantArray 3 T) =>
+         HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = ConstantArray 3 T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:8@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+data S
+    = S {s_x :: (ConstantArray 3 T)
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @macros\/reparse\/end_in_macro_arg.h 17:14@
+
+              __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty (ConstantArray 3 T) => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1},
+                              getField @"s_x" x_0)
+instance (~) ty (ConstantArray 3 T) =>
+         HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = ConstantArray 3 T
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_32975406bf2752f4" hs_bindgen_32975406bf2752f4_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+hs_bindgen_32975406bf2752f4 :: T -> IO T
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_f@
+hs_bindgen_32975406bf2752f4 = \x_0 -> fmap fromFFIType (hs_bindgen_32975406bf2752f4_base (toFFIType x_0))
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_safe :: T -> IO T
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_safe = hs_bindgen_32975406bf2752f4
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+foreign import ccall safe "hs_bindgen_7b14389d4be48230" hs_bindgen_7b14389d4be48230_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+hs_bindgen_7b14389d4be48230 :: U -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Safe_g@
+hs_bindgen_7b14389d4be48230 = \x_0 -> fmap fromFFIType (hs_bindgen_7b14389d4be48230_base (toFFIType x_0))
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_safe :: U -> IO CInt
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_safe = hs_bindgen_7b14389d4be48230
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_5f3d395b37b2aea3" hs_bindgen_5f3d395b37b2aea3_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+hs_bindgen_5f3d395b37b2aea3 :: T -> IO T
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_f@
+hs_bindgen_5f3d395b37b2aea3 = \x_0 -> fmap fromFFIType (hs_bindgen_5f3d395b37b2aea3_base (toFFIType x_0))
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_unsafe :: T -> IO T
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_unsafe = hs_bindgen_5f3d395b37b2aea3
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+foreign import ccall unsafe "hs_bindgen_4bdcd42db8457bfb" hs_bindgen_4bdcd42db8457bfb_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+hs_bindgen_4bdcd42db8457bfb :: U -> IO CInt
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_Unsafe_g@
+hs_bindgen_4bdcd42db8457bfb = \x_0 -> fmap fromFFIType (hs_bindgen_4bdcd42db8457bfb_base (toFFIType x_0))
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_unsafe :: U -> IO CInt
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_unsafe = hs_bindgen_4bdcd42db8457bfb
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_96f030fb3ea3d43d" hs_bindgen_96f030fb3ea3d43d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+hs_bindgen_96f030fb3ea3d43d :: IO (FunPtr (T -> IO T))
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_f@
+hs_bindgen_96f030fb3ea3d43d = fmap fromFFIType hs_bindgen_96f030fb3ea3d43d_base
+{-# NOINLINE f_funptr #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_funptr :: FunPtr (T -> IO T)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 13:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+f_funptr = unsafePerformIO hs_bindgen_96f030fb3ea3d43d
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_cd7b12aa8c3ceb75" hs_bindgen_cd7b12aa8c3ceb75_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+hs_bindgen_cd7b12aa8c3ceb75 :: IO (FunPtr (U -> IO CInt))
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_g@
+hs_bindgen_cd7b12aa8c3ceb75 = fmap fromFFIType hs_bindgen_cd7b12aa8c3ceb75_base
+{-# NOINLINE g_funptr #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_funptr :: FunPtr (U -> IO CInt)
+{-| __C declaration:__ @g@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 20:5@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+g_funptr = unsafePerformIO hs_bindgen_cd7b12aa8c3ceb75
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+foreign import ccall unsafe "hs_bindgen_fa8758c7fbcb4eb0" hs_bindgen_fa8758c7fbcb4eb0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+hs_bindgen_fa8758c7fbcb4eb0 :: IO (Ptr (ConstantArray 3 T))
+-- __unique:__ @test_macrosreparseend_in_macro_ar_Example_get_arr@
+hs_bindgen_fa8758c7fbcb4eb0 = fmap fromFFIType hs_bindgen_fa8758c7fbcb4eb0_base
+{-# NOINLINE arr #-}
+{-| __C declaration:__ @arr@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 23:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+arr :: Ptr (ConstantArray 3 T)
+{-| __C declaration:__ @arr@
+
+    __defined at:__ @macros\/reparse\/end_in_macro_arg.h 23:3@
+
+    __exported by:__ @macros\/reparse\/end_in_macro_arg.h@
+-}
+arr = unsafePerformIO hs_bindgen_fa8758c7fbcb4eb0
diff --git a/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example.hs
@@ -0,0 +1,73 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.My_int_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @my_int_t@
+
+    __defined at:__ @macros\/reparse\/functions.h 19:16@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+newtype My_int_t = My_int_t
+  { unwrapMy_int_t :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMy_int_t" My_int_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         My_int_t {unwrapMy_int_t = y1}, BG.getField @"unwrapMy_int_t" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMy_int_t" (BG.Ptr My_int_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMy_int_t")
+
+instance HasCField.HasCField My_int_t "unwrapMy_int_t" where
+
+  type CFieldType My_int_t "unwrapMy_int_t" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example/FunPtr.hs
@@ -0,0 +1,100 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    , Example.FunPtr.baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/functions.h>"
+  , "/* test_macrosreparsefunctions_1_emp_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_44fe83b726d01723 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosreparsefunctions_1_emp_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_54a28d63fc0bcff0 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_macrosreparsefunctions_1_emp_Example_get_baz */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_ae839294fa23e037 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &baz;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_44fe83b726d01723" hs_bindgen_44fe83b726d01723_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_foo@
+hs_bindgen_44fe83b726d01723 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_44fe83b726d01723 =
+  fmap BG.fromFFIType hs_bindgen_44fe83b726d01723_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_44fe83b726d01723
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_54a28d63fc0bcff0" hs_bindgen_54a28d63fc0bcff0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_bar@
+hs_bindgen_54a28d63fc0bcff0 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_54a28d63fc0bcff0 =
+  fmap BG.fromFFIType hs_bindgen_54a28d63fc0bcff0_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+bar = BG.unsafePerformIO hs_bindgen_54a28d63fc0bcff0
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_ae839294fa23e037" hs_bindgen_ae839294fa23e037_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_baz@
+hs_bindgen_ae839294fa23e037 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_ae839294fa23e037 =
+  fmap BG.fromFFIType hs_bindgen_ae839294fa23e037_base
+
+{-# NOINLINE baz #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+baz = BG.unsafePerformIO hs_bindgen_ae839294fa23e037
diff --git a/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example/Safe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    , Example.Safe.baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/functions.h>"
+  , "void hs_bindgen_9b92d478f1b3a709 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_27c1a1b289182157 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_36638004661f2e8f ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (baz)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9b92d478f1b3a709" hs_bindgen_9b92d478f1b3a709_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_foo@
+hs_bindgen_9b92d478f1b3a709 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_9b92d478f1b3a709 =
+  \x0 ->
+    hs_bindgen_9b92d478f1b3a709_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_9b92d478f1b3a709
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_27c1a1b289182157" hs_bindgen_27c1a1b289182157_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_bar@
+hs_bindgen_27c1a1b289182157 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_27c1a1b289182157 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_27c1a1b289182157_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+bar = hs_bindgen_27c1a1b289182157
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_36638004661f2e8f" hs_bindgen_36638004661f2e8f_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_baz@
+hs_bindgen_36638004661f2e8f ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_36638004661f2e8f =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_36638004661f2e8f_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+baz = hs_bindgen_36638004661f2e8f
diff --git a/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.1.empty/Example/Unsafe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    , Example.Unsafe.baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/functions.h>"
+  , "void hs_bindgen_630c30830ae4c332 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_26fa4ddfc00fb318 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_c42f62cd14a1cefd ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (baz)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_630c30830ae4c332" hs_bindgen_630c30830ae4c332_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_foo@
+hs_bindgen_630c30830ae4c332 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_630c30830ae4c332 =
+  \x0 ->
+    hs_bindgen_630c30830ae4c332_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_630c30830ae4c332
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_26fa4ddfc00fb318" hs_bindgen_26fa4ddfc00fb318_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_bar@
+hs_bindgen_26fa4ddfc00fb318 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_26fa4ddfc00fb318 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_26fa4ddfc00fb318_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+bar = hs_bindgen_26fa4ddfc00fb318
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_c42f62cd14a1cefd" hs_bindgen_c42f62cd14a1cefd_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_baz@
+hs_bindgen_c42f62cd14a1cefd ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_c42f62cd14a1cefd =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_c42f62cd14a1cefd_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+baz = hs_bindgen_c42f62cd14a1cefd
diff --git a/test-artefacts/fixtures/macros/reparse/functions.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/functions.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.1.empty/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/functions.h
+  cname: my_int_t
+  hsname: My_int_t
+hstypes:
+- hsname: My_int_t
+  representation:
+    newtype:
+      constructor: My_int_t
+      fields:
+      - unwrapMy_int_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/functions.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/functions.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.1.empty/th.txt
@@ -0,0 +1,293 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/functions.h
+-- #include <macros/reparse/functions.h>
+-- void hs_bindgen_9b92d478f1b3a709 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- signed int hs_bindgen_27c1a1b289182157 (
+--   signed int arg1
+-- )
+-- {
+--   return (bar)(arg1);
+-- }
+-- signed int hs_bindgen_36638004661f2e8f (
+--   signed int arg1
+-- )
+-- {
+--   return (baz)(arg1);
+-- }
+-- void hs_bindgen_630c30830ae4c332 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- signed int hs_bindgen_26fa4ddfc00fb318 (
+--   signed int arg1
+-- )
+-- {
+--   return (bar)(arg1);
+-- }
+-- signed int hs_bindgen_c42f62cd14a1cefd (
+--   signed int arg1
+-- )
+-- {
+--   return (baz)(arg1);
+-- }
+-- /* test_macrosreparsefunctions_1_emp_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_44fe83b726d01723 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosreparsefunctions_1_emp_Example_get_bar */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_54a28d63fc0bcff0 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_macrosreparsefunctions_1_emp_Example_get_baz */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_ae839294fa23e037 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &baz;
+-- }
+{-| __C declaration:__ @my_int_t@
+
+    __defined at:__ @macros\/reparse\/functions.h 19:16@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+newtype My_int_t
+    = My_int_t {unwrapMy_int_t :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMy_int_t" My_int_t ty
+    where hasField = \x_0 -> (\y_1 -> My_int_t{unwrapMy_int_t = y_1},
+                              getField @"unwrapMy_int_t" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapMy_int_t" (Ptr My_int_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMy_int_t")
+instance HasCField My_int_t "unwrapMy_int_t"
+    where type CFieldType My_int_t "unwrapMy_int_t" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9b92d478f1b3a709" hs_bindgen_9b92d478f1b3a709_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_foo@
+hs_bindgen_9b92d478f1b3a709 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_foo@
+hs_bindgen_9b92d478f1b3a709 = \x_0 -> hs_bindgen_9b92d478f1b3a709_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_safe = hs_bindgen_9b92d478f1b3a709
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_27c1a1b289182157" hs_bindgen_27c1a1b289182157_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_bar@
+hs_bindgen_27c1a1b289182157 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_bar@
+hs_bindgen_27c1a1b289182157 = \x_0 -> fmap fromFFIType (hs_bindgen_27c1a1b289182157_base (toFFIType x_0))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_safe :: CInt -> IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_safe = hs_bindgen_27c1a1b289182157
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_36638004661f2e8f" hs_bindgen_36638004661f2e8f_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_baz@
+hs_bindgen_36638004661f2e8f :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Safe_baz@
+hs_bindgen_36638004661f2e8f = \x_0 -> fmap fromFFIType (hs_bindgen_36638004661f2e8f_base (toFFIType x_0))
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_safe :: CInt -> IO CInt
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_safe = hs_bindgen_36638004661f2e8f
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_630c30830ae4c332" hs_bindgen_630c30830ae4c332_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_foo@
+hs_bindgen_630c30830ae4c332 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_foo@
+hs_bindgen_630c30830ae4c332 = \x_0 -> hs_bindgen_630c30830ae4c332_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_unsafe = hs_bindgen_630c30830ae4c332
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_26fa4ddfc00fb318" hs_bindgen_26fa4ddfc00fb318_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_bar@
+hs_bindgen_26fa4ddfc00fb318 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_bar@
+hs_bindgen_26fa4ddfc00fb318 = \x_0 -> fmap fromFFIType (hs_bindgen_26fa4ddfc00fb318_base (toFFIType x_0))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_unsafe = hs_bindgen_26fa4ddfc00fb318
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_c42f62cd14a1cefd" hs_bindgen_c42f62cd14a1cefd_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_baz@
+hs_bindgen_c42f62cd14a1cefd :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_Unsafe_baz@
+hs_bindgen_c42f62cd14a1cefd = \x_0 -> fmap fromFFIType (hs_bindgen_c42f62cd14a1cefd_base (toFFIType x_0))
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_unsafe = hs_bindgen_c42f62cd14a1cefd
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_44fe83b726d01723" hs_bindgen_44fe83b726d01723_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_foo@
+hs_bindgen_44fe83b726d01723 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_foo@
+hs_bindgen_44fe83b726d01723 = fmap fromFFIType hs_bindgen_44fe83b726d01723_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_44fe83b726d01723
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_54a28d63fc0bcff0" hs_bindgen_54a28d63fc0bcff0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_bar@
+hs_bindgen_54a28d63fc0bcff0 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_bar@
+hs_bindgen_54a28d63fc0bcff0 = fmap fromFFIType hs_bindgen_54a28d63fc0bcff0_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_54a28d63fc0bcff0
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_ae839294fa23e037" hs_bindgen_ae839294fa23e037_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_baz@
+hs_bindgen_ae839294fa23e037 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsefunctions_1_emp_Example_get_baz@
+hs_bindgen_ae839294fa23e037 = fmap fromFFIType hs_bindgen_ae839294fa23e037_base
+{-# NOINLINE baz_funptr #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_funptr = unsafePerformIO hs_bindgen_ae839294fa23e037
diff --git a/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example.hs
@@ -0,0 +1,94 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.iD
+    , Example.mY_INT
+    , Example.My_int_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, String, type (~))
+
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/functions.h 1:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+iD :: Macro.Raw String
+iD = Macro.functionLike "ID" ["X"] ["(", "X", ")"]
+
+{-| __C declaration:__ @macro MY_INT@
+
+    __defined at:__ @macros\/reparse\/functions.h 2:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+mY_INT :: Macro.Raw String
+mY_INT = Macro.objectLike "MY_INT" ["int"]
+
+{-| __C declaration:__ @my_int_t@
+
+    __defined at:__ @macros\/reparse\/functions.h 19:16@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+newtype My_int_t = My_int_t
+  { unwrapMy_int_t :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMy_int_t" My_int_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         My_int_t {unwrapMy_int_t = y1}, BG.getField @"unwrapMy_int_t" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMy_int_t" (BG.Ptr My_int_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMy_int_t")
+
+instance HasCField.HasCField My_int_t "unwrapMy_int_t" where
+
+  type CFieldType My_int_t "unwrapMy_int_t" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example/FunPtr.hs
@@ -0,0 +1,100 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    , Example.FunPtr.baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/functions.h>"
+  , "/* test_macrosreparsefunctions_2_raw_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_612c1fc386c6917a (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosreparsefunctions_2_raw_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_2722454ee1491738 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_macrosreparsefunctions_2_raw_Example_get_baz */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_3787b7ae26f34a95 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &baz;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_612c1fc386c6917a" hs_bindgen_612c1fc386c6917a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_foo@
+hs_bindgen_612c1fc386c6917a :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_612c1fc386c6917a =
+  fmap BG.fromFFIType hs_bindgen_612c1fc386c6917a_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_612c1fc386c6917a
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_2722454ee1491738" hs_bindgen_2722454ee1491738_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_bar@
+hs_bindgen_2722454ee1491738 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_2722454ee1491738 =
+  fmap BG.fromFFIType hs_bindgen_2722454ee1491738_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+bar = BG.unsafePerformIO hs_bindgen_2722454ee1491738
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_3787b7ae26f34a95" hs_bindgen_3787b7ae26f34a95_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_baz@
+hs_bindgen_3787b7ae26f34a95 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_3787b7ae26f34a95 =
+  fmap BG.fromFFIType hs_bindgen_3787b7ae26f34a95_base
+
+{-# NOINLINE baz #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+baz = BG.unsafePerformIO hs_bindgen_3787b7ae26f34a95
diff --git a/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example/Safe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    , Example.Safe.baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/functions.h>"
+  , "void hs_bindgen_afd9c4a8467f5418 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_368818873d354fc5 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_61f10d22d53c81ac ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (baz)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_afd9c4a8467f5418" hs_bindgen_afd9c4a8467f5418_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_foo@
+hs_bindgen_afd9c4a8467f5418 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_afd9c4a8467f5418 =
+  \x0 ->
+    hs_bindgen_afd9c4a8467f5418_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_afd9c4a8467f5418
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_368818873d354fc5" hs_bindgen_368818873d354fc5_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_bar@
+hs_bindgen_368818873d354fc5 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_368818873d354fc5 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_368818873d354fc5_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+bar = hs_bindgen_368818873d354fc5
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_61f10d22d53c81ac" hs_bindgen_61f10d22d53c81ac_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_baz@
+hs_bindgen_61f10d22d53c81ac ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_61f10d22d53c81ac =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_61f10d22d53c81ac_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+baz = hs_bindgen_61f10d22d53c81ac
diff --git a/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.2.raw/Example/Unsafe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    , Example.Unsafe.baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/functions.h>"
+  , "void hs_bindgen_63386173f0facb31 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_2ffb271b09dfbbf9 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_3cf87e230ba213f9 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (baz)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_63386173f0facb31" hs_bindgen_63386173f0facb31_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_foo@
+hs_bindgen_63386173f0facb31 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_63386173f0facb31 =
+  \x0 ->
+    hs_bindgen_63386173f0facb31_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_63386173f0facb31
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_2ffb271b09dfbbf9" hs_bindgen_2ffb271b09dfbbf9_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_bar@
+hs_bindgen_2ffb271b09dfbbf9 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_2ffb271b09dfbbf9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_2ffb271b09dfbbf9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+bar = hs_bindgen_2ffb271b09dfbbf9
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_3cf87e230ba213f9" hs_bindgen_3cf87e230ba213f9_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_baz@
+hs_bindgen_3cf87e230ba213f9 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_3cf87e230ba213f9 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_3cf87e230ba213f9_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+baz = hs_bindgen_3cf87e230ba213f9
diff --git a/test-artefacts/fixtures/macros/reparse/functions.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/functions.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.2.raw/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/functions.h
+  cname: my_int_t
+  hsname: My_int_t
+hstypes:
+- hsname: My_int_t
+  representation:
+    newtype:
+      constructor: My_int_t
+      fields:
+      - unwrapMy_int_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/functions.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/functions.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions.2.raw/th.txt
@@ -0,0 +1,321 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/functions.h
+-- #include <macros/reparse/functions.h>
+-- void hs_bindgen_afd9c4a8467f5418 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- signed int hs_bindgen_368818873d354fc5 (
+--   signed int arg1
+-- )
+-- {
+--   return (bar)(arg1);
+-- }
+-- signed int hs_bindgen_61f10d22d53c81ac (
+--   signed int arg1
+-- )
+-- {
+--   return (baz)(arg1);
+-- }
+-- void hs_bindgen_63386173f0facb31 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- signed int hs_bindgen_2ffb271b09dfbbf9 (
+--   signed int arg1
+-- )
+-- {
+--   return (bar)(arg1);
+-- }
+-- signed int hs_bindgen_3cf87e230ba213f9 (
+--   signed int arg1
+-- )
+-- {
+--   return (baz)(arg1);
+-- }
+-- /* test_macrosreparsefunctions_2_raw_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_612c1fc386c6917a (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosreparsefunctions_2_raw_Example_get_bar */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_2722454ee1491738 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_macrosreparsefunctions_2_raw_Example_get_baz */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_3787b7ae26f34a95 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &baz;
+-- }
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/functions.h 1:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+iD :: Raw String
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/functions.h 1:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+iD = functionLike "ID" ["X"] ["(", "X", ")"]
+{-| __C declaration:__ @macro MY_INT@
+
+    __defined at:__ @macros\/reparse\/functions.h 2:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+mY_INT :: Raw String
+{-| __C declaration:__ @macro MY_INT@
+
+    __defined at:__ @macros\/reparse\/functions.h 2:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+mY_INT = objectLike "MY_INT" ["int"]
+{-| __C declaration:__ @my_int_t@
+
+    __defined at:__ @macros\/reparse\/functions.h 19:16@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+newtype My_int_t
+    = My_int_t {unwrapMy_int_t :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMy_int_t" My_int_t ty
+    where hasField = \x_0 -> (\y_1 -> My_int_t{unwrapMy_int_t = y_1},
+                              getField @"unwrapMy_int_t" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapMy_int_t" (Ptr My_int_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMy_int_t")
+instance HasCField My_int_t "unwrapMy_int_t"
+    where type CFieldType My_int_t "unwrapMy_int_t" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_afd9c4a8467f5418" hs_bindgen_afd9c4a8467f5418_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_foo@
+hs_bindgen_afd9c4a8467f5418 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_foo@
+hs_bindgen_afd9c4a8467f5418 = \x_0 -> hs_bindgen_afd9c4a8467f5418_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_safe = hs_bindgen_afd9c4a8467f5418
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_368818873d354fc5" hs_bindgen_368818873d354fc5_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_bar@
+hs_bindgen_368818873d354fc5 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_bar@
+hs_bindgen_368818873d354fc5 = \x_0 -> fmap fromFFIType (hs_bindgen_368818873d354fc5_base (toFFIType x_0))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_safe :: CInt -> IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_safe = hs_bindgen_368818873d354fc5
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_61f10d22d53c81ac" hs_bindgen_61f10d22d53c81ac_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_baz@
+hs_bindgen_61f10d22d53c81ac :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Safe_baz@
+hs_bindgen_61f10d22d53c81ac = \x_0 -> fmap fromFFIType (hs_bindgen_61f10d22d53c81ac_base (toFFIType x_0))
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_safe :: CInt -> IO CInt
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_safe = hs_bindgen_61f10d22d53c81ac
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_63386173f0facb31" hs_bindgen_63386173f0facb31_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_foo@
+hs_bindgen_63386173f0facb31 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_foo@
+hs_bindgen_63386173f0facb31 = \x_0 -> hs_bindgen_63386173f0facb31_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_unsafe = hs_bindgen_63386173f0facb31
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_2ffb271b09dfbbf9" hs_bindgen_2ffb271b09dfbbf9_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_bar@
+hs_bindgen_2ffb271b09dfbbf9 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_bar@
+hs_bindgen_2ffb271b09dfbbf9 = \x_0 -> fmap fromFFIType (hs_bindgen_2ffb271b09dfbbf9_base (toFFIType x_0))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_unsafe = hs_bindgen_2ffb271b09dfbbf9
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_3cf87e230ba213f9" hs_bindgen_3cf87e230ba213f9_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_baz@
+hs_bindgen_3cf87e230ba213f9 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_Unsafe_baz@
+hs_bindgen_3cf87e230ba213f9 = \x_0 -> fmap fromFFIType (hs_bindgen_3cf87e230ba213f9_base (toFFIType x_0))
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_unsafe = hs_bindgen_3cf87e230ba213f9
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_612c1fc386c6917a" hs_bindgen_612c1fc386c6917a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_foo@
+hs_bindgen_612c1fc386c6917a :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_foo@
+hs_bindgen_612c1fc386c6917a = fmap fromFFIType hs_bindgen_612c1fc386c6917a_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_612c1fc386c6917a
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_2722454ee1491738" hs_bindgen_2722454ee1491738_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_bar@
+hs_bindgen_2722454ee1491738 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_bar@
+hs_bindgen_2722454ee1491738 = fmap fromFFIType hs_bindgen_2722454ee1491738_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_2722454ee1491738
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_3787b7ae26f34a95" hs_bindgen_3787b7ae26f34a95_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_baz@
+hs_bindgen_3787b7ae26f34a95 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsefunctions_2_raw_Example_get_baz@
+hs_bindgen_3787b7ae26f34a95 = fmap fromFFIType hs_bindgen_3787b7ae26f34a95_base
+{-# NOINLINE baz_funptr #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_funptr = unsafePerformIO hs_bindgen_3787b7ae26f34a95
diff --git a/test-artefacts/fixtures/macros/reparse/functions/Example.hs b/test-artefacts/fixtures/macros/reparse/functions/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions/Example.hs
@@ -0,0 +1,133 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE ExplicitForAll #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.iD
+    , Example.MY_INT(..)
+    , Example.My_int_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/functions.h 1:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+iD :: forall a0. a0 -> a0
+iD = \x0 -> x0
+
+{-| __C declaration:__ @macro MY_INT@
+
+    __defined at:__ @macros\/reparse\/functions.h 2:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+newtype MY_INT = MY_INT
+  { unwrapMY_INT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMY_INT" MY_INT ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MY_INT {unwrapMY_INT = y1}, BG.getField @"unwrapMY_INT" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMY_INT" (BG.Ptr MY_INT) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMY_INT")
+
+instance HasCField.HasCField MY_INT "unwrapMY_INT" where
+
+  type CFieldType MY_INT "unwrapMY_INT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @my_int_t@
+
+    __defined at:__ @macros\/reparse\/functions.h 19:16@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+newtype My_int_t = My_int_t
+  { unwrapMy_int_t :: MY_INT
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ MY_INT
+         ) => BG.CompatHasField.HasField "unwrapMy_int_t" My_int_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         My_int_t {unwrapMy_int_t = y1}, BG.getField @"unwrapMy_int_t" x0)
+
+instance ( ty ~ MY_INT
+         ) => BG.HasField "unwrapMy_int_t" (BG.Ptr My_int_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMy_int_t")
+
+instance HasCField.HasCField My_int_t "unwrapMy_int_t" where
+
+  type CFieldType My_int_t "unwrapMy_int_t" = MY_INT
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/functions/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/functions/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions/Example/FunPtr.hs
@@ -0,0 +1,100 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    , Example.FunPtr.baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/functions.h>"
+  , "/* test_macrosreparsefunctions_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0ee6ccf5e9065e6c (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosreparsefunctions_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_8ec5846013c7fa41 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_macrosreparsefunctions_Example_get_baz */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_740f410e15c8820e (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &baz;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsefunctions_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_0ee6ccf5e9065e6c" hs_bindgen_0ee6ccf5e9065e6c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsefunctions_Example_get_foo@
+hs_bindgen_0ee6ccf5e9065e6c :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_0ee6ccf5e9065e6c =
+  fmap BG.fromFFIType hs_bindgen_0ee6ccf5e9065e6c_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_0ee6ccf5e9065e6c
+
+-- __unique:__ @test_macrosreparsefunctions_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_8ec5846013c7fa41" hs_bindgen_8ec5846013c7fa41_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsefunctions_Example_get_bar@
+hs_bindgen_8ec5846013c7fa41 :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_8ec5846013c7fa41 =
+  fmap BG.fromFFIType hs_bindgen_8ec5846013c7fa41_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+bar = BG.unsafePerformIO hs_bindgen_8ec5846013c7fa41
+
+-- __unique:__ @test_macrosreparsefunctions_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_740f410e15c8820e" hs_bindgen_740f410e15c8820e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsefunctions_Example_get_baz@
+hs_bindgen_740f410e15c8820e :: IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+hs_bindgen_740f410e15c8820e =
+  fmap BG.fromFFIType hs_bindgen_740f410e15c8820e_base
+
+{-# NOINLINE baz #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz :: BG.FunPtr (BG.CInt -> IO BG.CInt)
+baz = BG.unsafePerformIO hs_bindgen_740f410e15c8820e
diff --git a/test-artefacts/fixtures/macros/reparse/functions/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/functions/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions/Example/Safe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    , Example.Safe.baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/functions.h>"
+  , "void hs_bindgen_b6e9ae739486d53b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_e44e9d05eacbc37e ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_4566eba0a19c4890 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (baz)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_b6e9ae739486d53b" hs_bindgen_b6e9ae739486d53b_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_foo@
+hs_bindgen_b6e9ae739486d53b ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_b6e9ae739486d53b =
+  \x0 ->
+    hs_bindgen_b6e9ae739486d53b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_b6e9ae739486d53b
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_e44e9d05eacbc37e" hs_bindgen_e44e9d05eacbc37e_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_bar@
+hs_bindgen_e44e9d05eacbc37e ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_e44e9d05eacbc37e =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_e44e9d05eacbc37e_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+bar = hs_bindgen_e44e9d05eacbc37e
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_4566eba0a19c4890" hs_bindgen_4566eba0a19c4890_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_baz@
+hs_bindgen_4566eba0a19c4890 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_4566eba0a19c4890 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4566eba0a19c4890_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+baz = hs_bindgen_4566eba0a19c4890
diff --git a/test-artefacts/fixtures/macros/reparse/functions/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/functions/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions/Example/Unsafe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    , Example.Unsafe.baz
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/functions.h>"
+  , "void hs_bindgen_39eae3eb6460ea6a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_eb2d164aacb2e06d ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1);"
+  , "}"
+  , "signed int hs_bindgen_69a979a1e6a18eb1 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return (baz)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_39eae3eb6460ea6a" hs_bindgen_39eae3eb6460ea6a_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_foo@
+hs_bindgen_39eae3eb6460ea6a ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_39eae3eb6460ea6a =
+  \x0 ->
+    hs_bindgen_39eae3eb6460ea6a_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_39eae3eb6460ea6a
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_eb2d164aacb2e06d" hs_bindgen_eb2d164aacb2e06d_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_bar@
+hs_bindgen_eb2d164aacb2e06d ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_eb2d164aacb2e06d =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_eb2d164aacb2e06d_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+bar = hs_bindgen_eb2d164aacb2e06d
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_69a979a1e6a18eb1" hs_bindgen_69a979a1e6a18eb1_base ::
+     BG.CInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_baz@
+hs_bindgen_69a979a1e6a18eb1 ::
+     BG.CInt
+  -> IO BG.CInt
+hs_bindgen_69a979a1e6a18eb1 =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_69a979a1e6a18eb1_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+baz = hs_bindgen_69a979a1e6a18eb1
diff --git a/test-artefacts/fixtures/macros/reparse/functions/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/functions/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/functions.h
+  cname: macro MY_INT
+  hsname: MY_INT
+- headers: macros/reparse/functions.h
+  cname: my_int_t
+  hsname: My_int_t
+hstypes:
+- hsname: MY_INT
+  representation:
+    newtype:
+      constructor: MY_INT
+      fields:
+      - unwrapMY_INT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: My_int_t
+  representation:
+    newtype:
+      constructor: My_int_t
+      fields:
+      - unwrapMy_int_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/functions/th.txt b/test-artefacts/fixtures/macros/reparse/functions/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/functions/th.txt
@@ -0,0 +1,340 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/functions.h
+-- #include <macros/reparse/functions.h>
+-- void hs_bindgen_b6e9ae739486d53b (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- signed int hs_bindgen_e44e9d05eacbc37e (
+--   signed int arg1
+-- )
+-- {
+--   return (bar)(arg1);
+-- }
+-- signed int hs_bindgen_4566eba0a19c4890 (
+--   signed int arg1
+-- )
+-- {
+--   return (baz)(arg1);
+-- }
+-- void hs_bindgen_39eae3eb6460ea6a (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- signed int hs_bindgen_eb2d164aacb2e06d (
+--   signed int arg1
+-- )
+-- {
+--   return (bar)(arg1);
+-- }
+-- signed int hs_bindgen_69a979a1e6a18eb1 (
+--   signed int arg1
+-- )
+-- {
+--   return (baz)(arg1);
+-- }
+-- /* test_macrosreparsefunctions_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0ee6ccf5e9065e6c (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosreparsefunctions_Example_get_bar */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_8ec5846013c7fa41 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_macrosreparsefunctions_Example_get_baz */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_740f410e15c8820e (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &baz;
+-- }
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/functions.h 1:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+iD :: forall a_0 . a_0 -> a_0
+{-| __C declaration:__ @macro ID@
+
+    __defined at:__ @macros\/reparse\/functions.h 1:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+iD = \x_0 -> x_0
+{-| __C declaration:__ @macro MY_INT@
+
+    __defined at:__ @macros\/reparse\/functions.h 2:9@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+newtype MY_INT
+    = MY_INT {unwrapMY_INT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMY_INT" MY_INT ty
+    where hasField = \x_0 -> (\y_1 -> MY_INT{unwrapMY_INT = y_1},
+                              getField @"unwrapMY_INT" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapMY_INT" (Ptr MY_INT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMY_INT")
+instance HasCField MY_INT "unwrapMY_INT"
+    where type CFieldType MY_INT "unwrapMY_INT" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @my_int_t@
+
+    __defined at:__ @macros\/reparse\/functions.h 19:16@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+newtype My_int_t
+    = My_int_t {unwrapMy_int_t :: MY_INT}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty MY_INT => HasField "unwrapMy_int_t" My_int_t ty
+    where hasField = \x_0 -> (\y_1 -> My_int_t{unwrapMy_int_t = y_1},
+                              getField @"unwrapMy_int_t" x_0)
+instance (~) ty MY_INT =>
+         HasField "unwrapMy_int_t" (Ptr My_int_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMy_int_t")
+instance HasCField My_int_t "unwrapMy_int_t"
+    where type CFieldType My_int_t "unwrapMy_int_t" = MY_INT
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_b6e9ae739486d53b" hs_bindgen_b6e9ae739486d53b_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_foo@
+hs_bindgen_b6e9ae739486d53b :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_foo@
+hs_bindgen_b6e9ae739486d53b = \x_0 -> hs_bindgen_b6e9ae739486d53b_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_safe = hs_bindgen_b6e9ae739486d53b
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_e44e9d05eacbc37e" hs_bindgen_e44e9d05eacbc37e_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_bar@
+hs_bindgen_e44e9d05eacbc37e :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_bar@
+hs_bindgen_e44e9d05eacbc37e = \x_0 -> fmap fromFFIType (hs_bindgen_e44e9d05eacbc37e_base (toFFIType x_0))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_safe :: CInt -> IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_safe = hs_bindgen_e44e9d05eacbc37e
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_baz@
+foreign import ccall safe "hs_bindgen_4566eba0a19c4890" hs_bindgen_4566eba0a19c4890_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_baz@
+hs_bindgen_4566eba0a19c4890 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_Example_Safe_baz@
+hs_bindgen_4566eba0a19c4890 = \x_0 -> fmap fromFFIType (hs_bindgen_4566eba0a19c4890_base (toFFIType x_0))
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_safe :: CInt -> IO CInt
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_safe = hs_bindgen_4566eba0a19c4890
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_39eae3eb6460ea6a" hs_bindgen_39eae3eb6460ea6a_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_foo@
+hs_bindgen_39eae3eb6460ea6a :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_foo@
+hs_bindgen_39eae3eb6460ea6a = \x_0 -> hs_bindgen_39eae3eb6460ea6a_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_unsafe = hs_bindgen_39eae3eb6460ea6a
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_eb2d164aacb2e06d" hs_bindgen_eb2d164aacb2e06d_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_bar@
+hs_bindgen_eb2d164aacb2e06d :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_bar@
+hs_bindgen_eb2d164aacb2e06d = \x_0 -> fmap fromFFIType (hs_bindgen_eb2d164aacb2e06d_base (toFFIType x_0))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_unsafe = hs_bindgen_eb2d164aacb2e06d
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_baz@
+foreign import ccall unsafe "hs_bindgen_69a979a1e6a18eb1" hs_bindgen_69a979a1e6a18eb1_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_baz@
+hs_bindgen_69a979a1e6a18eb1 :: CInt -> IO CInt
+-- __unique:__ @test_macrosreparsefunctions_Example_Unsafe_baz@
+hs_bindgen_69a979a1e6a18eb1 = \x_0 -> fmap fromFFIType (hs_bindgen_69a979a1e6a18eb1_base (toFFIType x_0))
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_unsafe :: CInt -> IO CInt
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_unsafe = hs_bindgen_69a979a1e6a18eb1
+-- __unique:__ @test_macrosreparsefunctions_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_0ee6ccf5e9065e6c" hs_bindgen_0ee6ccf5e9065e6c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsefunctions_Example_get_foo@
+hs_bindgen_0ee6ccf5e9065e6c :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsefunctions_Example_get_foo@
+hs_bindgen_0ee6ccf5e9065e6c = fmap fromFFIType hs_bindgen_0ee6ccf5e9065e6c_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/functions.h 7:6@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_0ee6ccf5e9065e6c
+-- __unique:__ @test_macrosreparsefunctions_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_8ec5846013c7fa41" hs_bindgen_8ec5846013c7fa41_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsefunctions_Example_get_bar@
+hs_bindgen_8ec5846013c7fa41 :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsefunctions_Example_get_bar@
+hs_bindgen_8ec5846013c7fa41 = fmap fromFFIType hs_bindgen_8ec5846013c7fa41_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/functions.h 9:19@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_8ec5846013c7fa41
+-- __unique:__ @test_macrosreparsefunctions_Example_get_baz@
+foreign import ccall unsafe "hs_bindgen_740f410e15c8820e" hs_bindgen_740f410e15c8820e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsefunctions_Example_get_baz@
+hs_bindgen_740f410e15c8820e :: IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @test_macrosreparsefunctions_Example_get_baz@
+hs_bindgen_740f410e15c8820e = fmap fromFFIType hs_bindgen_740f410e15c8820e_base
+{-# NOINLINE baz_funptr #-}
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_funptr :: FunPtr (CInt -> IO CInt)
+{-| __C declaration:__ @baz@
+
+    __defined at:__ @macros\/reparse\/functions.h 14:12@
+
+    __exported by:__ @macros\/reparse\/functions.h@
+-}
+baz_funptr = unsafePerformIO hs_bindgen_740f410e15c8820e
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/Example/FunPtr.hs
@@ -0,0 +1,156 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    , Example.FunPtr.dash
+    , Example.FunPtr.quux
+    , Example.FunPtr.heq
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/gnu_attributes.h>"
+  , "/* test_macrosreparsegnu_attributes__Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0bb0e3098bde7e0b (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes__Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b1dbc650a21707a2 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes__Example_get_dash */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_edc10f73f46266b8 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &dash;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes__Example_get_quux */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_50fdcccdf0a43b92 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &quux;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes__Example_get_heq */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_110df13ac4d9dfc8 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &heq;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_0bb0e3098bde7e0b" hs_bindgen_0bb0e3098bde7e0b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+hs_bindgen_0bb0e3098bde7e0b :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_0bb0e3098bde7e0b =
+  fmap BG.fromFFIType hs_bindgen_0bb0e3098bde7e0b_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_0bb0e3098bde7e0b
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b1dbc650a21707a2" hs_bindgen_b1dbc650a21707a2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+hs_bindgen_b1dbc650a21707a2 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_b1dbc650a21707a2 =
+  fmap BG.fromFFIType hs_bindgen_b1dbc650a21707a2_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar :: BG.FunPtr (BG.CInt -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_b1dbc650a21707a2
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+foreign import ccall unsafe "hs_bindgen_edc10f73f46266b8" hs_bindgen_edc10f73f46266b8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+hs_bindgen_edc10f73f46266b8 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_edc10f73f46266b8 =
+  fmap BG.fromFFIType hs_bindgen_edc10f73f46266b8_base
+
+{-# NOINLINE dash #-}
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash :: BG.FunPtr (BG.CInt -> IO ())
+dash = BG.unsafePerformIO hs_bindgen_edc10f73f46266b8
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_50fdcccdf0a43b92" hs_bindgen_50fdcccdf0a43b92_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+hs_bindgen_50fdcccdf0a43b92 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_50fdcccdf0a43b92 =
+  fmap BG.fromFFIType hs_bindgen_50fdcccdf0a43b92_base
+
+{-# NOINLINE quux #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux :: BG.FunPtr (BG.CInt -> IO ())
+quux = BG.unsafePerformIO hs_bindgen_50fdcccdf0a43b92
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+foreign import ccall unsafe "hs_bindgen_110df13ac4d9dfc8" hs_bindgen_110df13ac4d9dfc8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+hs_bindgen_110df13ac4d9dfc8 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_110df13ac4d9dfc8 =
+  fmap BG.fromFFIType hs_bindgen_110df13ac4d9dfc8_base
+
+{-# NOINLINE heq #-}
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq :: BG.FunPtr (BG.CInt -> IO ())
+heq = BG.unsafePerformIO hs_bindgen_110df13ac4d9dfc8
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/Example/Safe.hs
@@ -0,0 +1,171 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    , Example.Safe.dash
+    , Example.Safe.quux
+    , Example.Safe.heq
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/gnu_attributes.h>"
+  , "void hs_bindgen_5e910042f66236ac ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_912eee72881dada9 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_90648744cbb16108 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (dash)(arg1);"
+  , "}"
+  , "void hs_bindgen_3bf2453c79c79342 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  , "void hs_bindgen_89e85ad8f7343241 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (heq)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_5e910042f66236ac" hs_bindgen_5e910042f66236ac_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+hs_bindgen_5e910042f66236ac ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_5e910042f66236ac =
+  \x0 ->
+    hs_bindgen_5e910042f66236ac_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo ::
+     BG.CInt
+  -> IO ()
+foo = hs_bindgen_5e910042f66236ac
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_912eee72881dada9" hs_bindgen_912eee72881dada9_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+hs_bindgen_912eee72881dada9 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_912eee72881dada9 =
+  \x0 ->
+    hs_bindgen_912eee72881dada9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar ::
+     BG.CInt
+  -> IO ()
+bar = hs_bindgen_912eee72881dada9
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+foreign import ccall safe "hs_bindgen_90648744cbb16108" hs_bindgen_90648744cbb16108_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+hs_bindgen_90648744cbb16108 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_90648744cbb16108 =
+  \x0 ->
+    hs_bindgen_90648744cbb16108_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash ::
+     BG.CInt
+  -> IO ()
+dash = hs_bindgen_90648744cbb16108
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_3bf2453c79c79342" hs_bindgen_3bf2453c79c79342_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+hs_bindgen_3bf2453c79c79342 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_3bf2453c79c79342 =
+  \x0 ->
+    hs_bindgen_3bf2453c79c79342_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux ::
+     BG.CInt
+  -> IO ()
+quux = hs_bindgen_3bf2453c79c79342
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+foreign import ccall safe "hs_bindgen_89e85ad8f7343241" hs_bindgen_89e85ad8f7343241_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+hs_bindgen_89e85ad8f7343241 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_89e85ad8f7343241 =
+  \x0 ->
+    hs_bindgen_89e85ad8f7343241_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq ::
+     BG.CInt
+  -> IO ()
+heq = hs_bindgen_89e85ad8f7343241
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/Example/Unsafe.hs
@@ -0,0 +1,171 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    , Example.Unsafe.dash
+    , Example.Unsafe.quux
+    , Example.Unsafe.heq
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/gnu_attributes.h>"
+  , "void hs_bindgen_2794b70af4ccd43b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_01135a4a8f379826 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_0d59701db0fc10c2 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (dash)(arg1);"
+  , "}"
+  , "void hs_bindgen_fc3ab959400ab9c8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  , "void hs_bindgen_fa747bfe2b529e61 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (heq)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_2794b70af4ccd43b" hs_bindgen_2794b70af4ccd43b_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+hs_bindgen_2794b70af4ccd43b ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_2794b70af4ccd43b =
+  \x0 ->
+    hs_bindgen_2794b70af4ccd43b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo ::
+     BG.CInt
+  -> IO ()
+foo = hs_bindgen_2794b70af4ccd43b
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_01135a4a8f379826" hs_bindgen_01135a4a8f379826_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+hs_bindgen_01135a4a8f379826 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_01135a4a8f379826 =
+  \x0 ->
+    hs_bindgen_01135a4a8f379826_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar ::
+     BG.CInt
+  -> IO ()
+bar = hs_bindgen_01135a4a8f379826
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+foreign import ccall unsafe "hs_bindgen_0d59701db0fc10c2" hs_bindgen_0d59701db0fc10c2_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+hs_bindgen_0d59701db0fc10c2 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_0d59701db0fc10c2 =
+  \x0 ->
+    hs_bindgen_0d59701db0fc10c2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash ::
+     BG.CInt
+  -> IO ()
+dash = hs_bindgen_0d59701db0fc10c2
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_fc3ab959400ab9c8" hs_bindgen_fc3ab959400ab9c8_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+hs_bindgen_fc3ab959400ab9c8 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_fc3ab959400ab9c8 =
+  \x0 ->
+    hs_bindgen_fc3ab959400ab9c8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux ::
+     BG.CInt
+  -> IO ()
+quux = hs_bindgen_fc3ab959400ab9c8
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+foreign import ccall unsafe "hs_bindgen_fa747bfe2b529e61" hs_bindgen_fa747bfe2b529e61_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+hs_bindgen_fa747bfe2b529e61 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_fa747bfe2b529e61 =
+  \x0 ->
+    hs_bindgen_fa747bfe2b529e61_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq ::
+     BG.CInt
+  -> IO ()
+heq = hs_bindgen_fa747bfe2b529e61
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.1.empty/th.txt
@@ -0,0 +1,432 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/gnu_attributes.h
+-- #include <macros/reparse/gnu_attributes.h>
+-- void hs_bindgen_5e910042f66236ac (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_912eee72881dada9 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_90648744cbb16108 (
+--   signed int arg1
+-- )
+-- {
+--   (dash)(arg1);
+-- }
+-- void hs_bindgen_3bf2453c79c79342 (
+--   signed int arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- void hs_bindgen_89e85ad8f7343241 (
+--   signed int arg1
+-- )
+-- {
+--   (heq)(arg1);
+-- }
+-- void hs_bindgen_2794b70af4ccd43b (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_01135a4a8f379826 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_0d59701db0fc10c2 (
+--   signed int arg1
+-- )
+-- {
+--   (dash)(arg1);
+-- }
+-- void hs_bindgen_fc3ab959400ab9c8 (
+--   signed int arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- void hs_bindgen_fa747bfe2b529e61 (
+--   signed int arg1
+-- )
+-- {
+--   (heq)(arg1);
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0bb0e3098bde7e0b (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b1dbc650a21707a2 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_dash */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_edc10f73f46266b8 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &dash;
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_quux */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_50fdcccdf0a43b92 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &quux;
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_heq */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_110df13ac4d9dfc8 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &heq;
+-- }
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_5e910042f66236ac" hs_bindgen_5e910042f66236ac_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+hs_bindgen_5e910042f66236ac :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+hs_bindgen_5e910042f66236ac = \x_0 -> hs_bindgen_5e910042f66236ac_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_safe = hs_bindgen_5e910042f66236ac
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_912eee72881dada9" hs_bindgen_912eee72881dada9_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+hs_bindgen_912eee72881dada9 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+hs_bindgen_912eee72881dada9 = \x_0 -> hs_bindgen_912eee72881dada9_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_safe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_safe = hs_bindgen_912eee72881dada9
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+foreign import ccall safe "hs_bindgen_90648744cbb16108" hs_bindgen_90648744cbb16108_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+hs_bindgen_90648744cbb16108 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+hs_bindgen_90648744cbb16108 = \x_0 -> hs_bindgen_90648744cbb16108_base (toFFIType x_0)
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_safe :: CInt -> IO ()
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_safe = hs_bindgen_90648744cbb16108
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_3bf2453c79c79342" hs_bindgen_3bf2453c79c79342_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+hs_bindgen_3bf2453c79c79342 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+hs_bindgen_3bf2453c79c79342 = \x_0 -> hs_bindgen_3bf2453c79c79342_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_safe :: CInt -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_safe = hs_bindgen_3bf2453c79c79342
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+foreign import ccall safe "hs_bindgen_89e85ad8f7343241" hs_bindgen_89e85ad8f7343241_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+hs_bindgen_89e85ad8f7343241 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+hs_bindgen_89e85ad8f7343241 = \x_0 -> hs_bindgen_89e85ad8f7343241_base (toFFIType x_0)
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_safe :: CInt -> IO ()
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_safe = hs_bindgen_89e85ad8f7343241
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_2794b70af4ccd43b" hs_bindgen_2794b70af4ccd43b_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+hs_bindgen_2794b70af4ccd43b :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+hs_bindgen_2794b70af4ccd43b = \x_0 -> hs_bindgen_2794b70af4ccd43b_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_unsafe = hs_bindgen_2794b70af4ccd43b
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_01135a4a8f379826" hs_bindgen_01135a4a8f379826_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+hs_bindgen_01135a4a8f379826 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+hs_bindgen_01135a4a8f379826 = \x_0 -> hs_bindgen_01135a4a8f379826_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_unsafe = hs_bindgen_01135a4a8f379826
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+foreign import ccall unsafe "hs_bindgen_0d59701db0fc10c2" hs_bindgen_0d59701db0fc10c2_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+hs_bindgen_0d59701db0fc10c2 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+hs_bindgen_0d59701db0fc10c2 = \x_0 -> hs_bindgen_0d59701db0fc10c2_base (toFFIType x_0)
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_unsafe = hs_bindgen_0d59701db0fc10c2
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_fc3ab959400ab9c8" hs_bindgen_fc3ab959400ab9c8_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+hs_bindgen_fc3ab959400ab9c8 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+hs_bindgen_fc3ab959400ab9c8 = \x_0 -> hs_bindgen_fc3ab959400ab9c8_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_unsafe = hs_bindgen_fc3ab959400ab9c8
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+foreign import ccall unsafe "hs_bindgen_fa747bfe2b529e61" hs_bindgen_fa747bfe2b529e61_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+hs_bindgen_fa747bfe2b529e61 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+hs_bindgen_fa747bfe2b529e61 = \x_0 -> hs_bindgen_fa747bfe2b529e61_base (toFFIType x_0)
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_unsafe = hs_bindgen_fa747bfe2b529e61
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_0bb0e3098bde7e0b" hs_bindgen_0bb0e3098bde7e0b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+hs_bindgen_0bb0e3098bde7e0b :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+hs_bindgen_0bb0e3098bde7e0b = fmap fromFFIType hs_bindgen_0bb0e3098bde7e0b_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_0bb0e3098bde7e0b
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b1dbc650a21707a2" hs_bindgen_b1dbc650a21707a2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+hs_bindgen_b1dbc650a21707a2 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+hs_bindgen_b1dbc650a21707a2 = fmap fromFFIType hs_bindgen_b1dbc650a21707a2_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_b1dbc650a21707a2
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+foreign import ccall unsafe "hs_bindgen_edc10f73f46266b8" hs_bindgen_edc10f73f46266b8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+hs_bindgen_edc10f73f46266b8 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+hs_bindgen_edc10f73f46266b8 = fmap fromFFIType hs_bindgen_edc10f73f46266b8_base
+{-# NOINLINE dash_funptr #-}
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_funptr = unsafePerformIO hs_bindgen_edc10f73f46266b8
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_50fdcccdf0a43b92" hs_bindgen_50fdcccdf0a43b92_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+hs_bindgen_50fdcccdf0a43b92 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+hs_bindgen_50fdcccdf0a43b92 = fmap fromFFIType hs_bindgen_50fdcccdf0a43b92_base
+{-# NOINLINE quux_funptr #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_funptr = unsafePerformIO hs_bindgen_50fdcccdf0a43b92
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+foreign import ccall unsafe "hs_bindgen_110df13ac4d9dfc8" hs_bindgen_110df13ac4d9dfc8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+hs_bindgen_110df13ac4d9dfc8 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+hs_bindgen_110df13ac4d9dfc8 = fmap fromFFIType hs_bindgen_110df13ac4d9dfc8_base
+{-# NOINLINE heq_funptr #-}
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_funptr = unsafePerformIO hs_bindgen_110df13ac4d9dfc8
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.bOOL
+    , Example.eXPORT
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bOOL :: Macro.Raw String
+bOOL = Macro.objectLike "BOOL" ["int"]
+
+{-| __C declaration:__ @macro EXPORT@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 10:9@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+eXPORT :: Macro.Raw String
+eXPORT =
+  Macro.objectLike "EXPORT" ["__attribute__", "(", "(", "visibility", "(", "\"default\"", ")", ")", ")"]
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example/FunPtr.hs
@@ -0,0 +1,156 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    , Example.FunPtr.dash
+    , Example.FunPtr.quux
+    , Example.FunPtr.heq
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/gnu_attributes.h>"
+  , "/* test_macrosreparsegnu_attributes__Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_0bb0e3098bde7e0b (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes__Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_b1dbc650a21707a2 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes__Example_get_dash */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_edc10f73f46266b8 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &dash;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes__Example_get_quux */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_50fdcccdf0a43b92 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &quux;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes__Example_get_heq */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_110df13ac4d9dfc8 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &heq;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_0bb0e3098bde7e0b" hs_bindgen_0bb0e3098bde7e0b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+hs_bindgen_0bb0e3098bde7e0b :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_0bb0e3098bde7e0b =
+  fmap BG.fromFFIType hs_bindgen_0bb0e3098bde7e0b_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_0bb0e3098bde7e0b
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b1dbc650a21707a2" hs_bindgen_b1dbc650a21707a2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+hs_bindgen_b1dbc650a21707a2 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_b1dbc650a21707a2 =
+  fmap BG.fromFFIType hs_bindgen_b1dbc650a21707a2_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar :: BG.FunPtr (BG.CInt -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_b1dbc650a21707a2
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+foreign import ccall unsafe "hs_bindgen_edc10f73f46266b8" hs_bindgen_edc10f73f46266b8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+hs_bindgen_edc10f73f46266b8 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_edc10f73f46266b8 =
+  fmap BG.fromFFIType hs_bindgen_edc10f73f46266b8_base
+
+{-# NOINLINE dash #-}
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash :: BG.FunPtr (BG.CInt -> IO ())
+dash = BG.unsafePerformIO hs_bindgen_edc10f73f46266b8
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_50fdcccdf0a43b92" hs_bindgen_50fdcccdf0a43b92_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+hs_bindgen_50fdcccdf0a43b92 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_50fdcccdf0a43b92 =
+  fmap BG.fromFFIType hs_bindgen_50fdcccdf0a43b92_base
+
+{-# NOINLINE quux #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux :: BG.FunPtr (BG.CInt -> IO ())
+quux = BG.unsafePerformIO hs_bindgen_50fdcccdf0a43b92
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+foreign import ccall unsafe "hs_bindgen_110df13ac4d9dfc8" hs_bindgen_110df13ac4d9dfc8_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+hs_bindgen_110df13ac4d9dfc8 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_110df13ac4d9dfc8 =
+  fmap BG.fromFFIType hs_bindgen_110df13ac4d9dfc8_base
+
+{-# NOINLINE heq #-}
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq :: BG.FunPtr (BG.CInt -> IO ())
+heq = BG.unsafePerformIO hs_bindgen_110df13ac4d9dfc8
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example/Safe.hs
@@ -0,0 +1,171 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    , Example.Safe.dash
+    , Example.Safe.quux
+    , Example.Safe.heq
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/gnu_attributes.h>"
+  , "void hs_bindgen_5e910042f66236ac ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_912eee72881dada9 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_90648744cbb16108 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (dash)(arg1);"
+  , "}"
+  , "void hs_bindgen_3bf2453c79c79342 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  , "void hs_bindgen_89e85ad8f7343241 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (heq)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_5e910042f66236ac" hs_bindgen_5e910042f66236ac_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+hs_bindgen_5e910042f66236ac ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_5e910042f66236ac =
+  \x0 ->
+    hs_bindgen_5e910042f66236ac_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo ::
+     BG.CInt
+  -> IO ()
+foo = hs_bindgen_5e910042f66236ac
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_912eee72881dada9" hs_bindgen_912eee72881dada9_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+hs_bindgen_912eee72881dada9 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_912eee72881dada9 =
+  \x0 ->
+    hs_bindgen_912eee72881dada9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar ::
+     BG.CInt
+  -> IO ()
+bar = hs_bindgen_912eee72881dada9
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+foreign import ccall safe "hs_bindgen_90648744cbb16108" hs_bindgen_90648744cbb16108_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+hs_bindgen_90648744cbb16108 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_90648744cbb16108 =
+  \x0 ->
+    hs_bindgen_90648744cbb16108_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash ::
+     BG.CInt
+  -> IO ()
+dash = hs_bindgen_90648744cbb16108
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_3bf2453c79c79342" hs_bindgen_3bf2453c79c79342_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+hs_bindgen_3bf2453c79c79342 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_3bf2453c79c79342 =
+  \x0 ->
+    hs_bindgen_3bf2453c79c79342_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux ::
+     BG.CInt
+  -> IO ()
+quux = hs_bindgen_3bf2453c79c79342
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+foreign import ccall safe "hs_bindgen_89e85ad8f7343241" hs_bindgen_89e85ad8f7343241_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+hs_bindgen_89e85ad8f7343241 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_89e85ad8f7343241 =
+  \x0 ->
+    hs_bindgen_89e85ad8f7343241_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq ::
+     BG.CInt
+  -> IO ()
+heq = hs_bindgen_89e85ad8f7343241
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/Example/Unsafe.hs
@@ -0,0 +1,171 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    , Example.Unsafe.dash
+    , Example.Unsafe.quux
+    , Example.Unsafe.heq
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/gnu_attributes.h>"
+  , "void hs_bindgen_2794b70af4ccd43b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_01135a4a8f379826 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_0d59701db0fc10c2 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (dash)(arg1);"
+  , "}"
+  , "void hs_bindgen_fc3ab959400ab9c8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  , "void hs_bindgen_fa747bfe2b529e61 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (heq)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_2794b70af4ccd43b" hs_bindgen_2794b70af4ccd43b_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+hs_bindgen_2794b70af4ccd43b ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_2794b70af4ccd43b =
+  \x0 ->
+    hs_bindgen_2794b70af4ccd43b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo ::
+     BG.CInt
+  -> IO ()
+foo = hs_bindgen_2794b70af4ccd43b
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_01135a4a8f379826" hs_bindgen_01135a4a8f379826_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+hs_bindgen_01135a4a8f379826 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_01135a4a8f379826 =
+  \x0 ->
+    hs_bindgen_01135a4a8f379826_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar ::
+     BG.CInt
+  -> IO ()
+bar = hs_bindgen_01135a4a8f379826
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+foreign import ccall unsafe "hs_bindgen_0d59701db0fc10c2" hs_bindgen_0d59701db0fc10c2_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+hs_bindgen_0d59701db0fc10c2 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_0d59701db0fc10c2 =
+  \x0 ->
+    hs_bindgen_0d59701db0fc10c2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash ::
+     BG.CInt
+  -> IO ()
+dash = hs_bindgen_0d59701db0fc10c2
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_fc3ab959400ab9c8" hs_bindgen_fc3ab959400ab9c8_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+hs_bindgen_fc3ab959400ab9c8 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_fc3ab959400ab9c8 =
+  \x0 ->
+    hs_bindgen_fc3ab959400ab9c8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux ::
+     BG.CInt
+  -> IO ()
+quux = hs_bindgen_fc3ab959400ab9c8
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+foreign import ccall unsafe "hs_bindgen_fa747bfe2b529e61" hs_bindgen_fa747bfe2b529e61_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+hs_bindgen_fa747bfe2b529e61 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_fa747bfe2b529e61 =
+  \x0 ->
+    hs_bindgen_fa747bfe2b529e61_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq ::
+     BG.CInt
+  -> IO ()
+heq = hs_bindgen_fa747bfe2b529e61
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes.2.raw/th.txt
@@ -0,0 +1,468 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/gnu_attributes.h
+-- #include <macros/reparse/gnu_attributes.h>
+-- void hs_bindgen_5e910042f66236ac (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_912eee72881dada9 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_90648744cbb16108 (
+--   signed int arg1
+-- )
+-- {
+--   (dash)(arg1);
+-- }
+-- void hs_bindgen_3bf2453c79c79342 (
+--   signed int arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- void hs_bindgen_89e85ad8f7343241 (
+--   signed int arg1
+-- )
+-- {
+--   (heq)(arg1);
+-- }
+-- void hs_bindgen_2794b70af4ccd43b (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_01135a4a8f379826 (
+--   signed int arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_0d59701db0fc10c2 (
+--   signed int arg1
+-- )
+-- {
+--   (dash)(arg1);
+-- }
+-- void hs_bindgen_fc3ab959400ab9c8 (
+--   signed int arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- void hs_bindgen_fa747bfe2b529e61 (
+--   signed int arg1
+-- )
+-- {
+--   (heq)(arg1);
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0bb0e3098bde7e0b (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b1dbc650a21707a2 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_dash */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_edc10f73f46266b8 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &dash;
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_quux */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_50fdcccdf0a43b92 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &quux;
+-- }
+-- /* test_macrosreparsegnu_attributes__Example_get_heq */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_110df13ac4d9dfc8 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &heq;
+-- }
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bOOL :: Raw String
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bOOL = objectLike "BOOL" ["int"]
+{-| __C declaration:__ @macro EXPORT@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 10:9@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+eXPORT :: Raw String
+{-| __C declaration:__ @macro EXPORT@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 10:9@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+eXPORT = objectLike "EXPORT" ["__attribute__",
+                              "(",
+                              "(",
+                              "visibility",
+                              "(",
+                              "\"default\"",
+                              ")",
+                              ")",
+                              ")"]
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_5e910042f66236ac" hs_bindgen_5e910042f66236ac_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+hs_bindgen_5e910042f66236ac :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_foo@
+hs_bindgen_5e910042f66236ac = \x_0 -> hs_bindgen_5e910042f66236ac_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_safe = hs_bindgen_5e910042f66236ac
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_912eee72881dada9" hs_bindgen_912eee72881dada9_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+hs_bindgen_912eee72881dada9 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_bar@
+hs_bindgen_912eee72881dada9 = \x_0 -> hs_bindgen_912eee72881dada9_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_safe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_safe = hs_bindgen_912eee72881dada9
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+foreign import ccall safe "hs_bindgen_90648744cbb16108" hs_bindgen_90648744cbb16108_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+hs_bindgen_90648744cbb16108 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_dash@
+hs_bindgen_90648744cbb16108 = \x_0 -> hs_bindgen_90648744cbb16108_base (toFFIType x_0)
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_safe :: CInt -> IO ()
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_safe = hs_bindgen_90648744cbb16108
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_3bf2453c79c79342" hs_bindgen_3bf2453c79c79342_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+hs_bindgen_3bf2453c79c79342 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_quux@
+hs_bindgen_3bf2453c79c79342 = \x_0 -> hs_bindgen_3bf2453c79c79342_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_safe :: CInt -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_safe = hs_bindgen_3bf2453c79c79342
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+foreign import ccall safe "hs_bindgen_89e85ad8f7343241" hs_bindgen_89e85ad8f7343241_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+hs_bindgen_89e85ad8f7343241 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Safe_heq@
+hs_bindgen_89e85ad8f7343241 = \x_0 -> hs_bindgen_89e85ad8f7343241_base (toFFIType x_0)
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_safe :: CInt -> IO ()
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_safe = hs_bindgen_89e85ad8f7343241
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_2794b70af4ccd43b" hs_bindgen_2794b70af4ccd43b_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+hs_bindgen_2794b70af4ccd43b :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_foo@
+hs_bindgen_2794b70af4ccd43b = \x_0 -> hs_bindgen_2794b70af4ccd43b_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_unsafe = hs_bindgen_2794b70af4ccd43b
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_01135a4a8f379826" hs_bindgen_01135a4a8f379826_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+hs_bindgen_01135a4a8f379826 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_bar@
+hs_bindgen_01135a4a8f379826 = \x_0 -> hs_bindgen_01135a4a8f379826_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_unsafe = hs_bindgen_01135a4a8f379826
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+foreign import ccall unsafe "hs_bindgen_0d59701db0fc10c2" hs_bindgen_0d59701db0fc10c2_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+hs_bindgen_0d59701db0fc10c2 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_dash@
+hs_bindgen_0d59701db0fc10c2 = \x_0 -> hs_bindgen_0d59701db0fc10c2_base (toFFIType x_0)
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_unsafe = hs_bindgen_0d59701db0fc10c2
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_fc3ab959400ab9c8" hs_bindgen_fc3ab959400ab9c8_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+hs_bindgen_fc3ab959400ab9c8 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_quux@
+hs_bindgen_fc3ab959400ab9c8 = \x_0 -> hs_bindgen_fc3ab959400ab9c8_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_unsafe = hs_bindgen_fc3ab959400ab9c8
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+foreign import ccall unsafe "hs_bindgen_fa747bfe2b529e61" hs_bindgen_fa747bfe2b529e61_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+hs_bindgen_fa747bfe2b529e61 :: CInt -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_Unsafe_heq@
+hs_bindgen_fa747bfe2b529e61 = \x_0 -> hs_bindgen_fa747bfe2b529e61_base (toFFIType x_0)
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_unsafe = hs_bindgen_fa747bfe2b529e61
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_0bb0e3098bde7e0b" hs_bindgen_0bb0e3098bde7e0b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+hs_bindgen_0bb0e3098bde7e0b :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_foo@
+hs_bindgen_0bb0e3098bde7e0b = fmap fromFFIType hs_bindgen_0bb0e3098bde7e0b_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_0bb0e3098bde7e0b
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_b1dbc650a21707a2" hs_bindgen_b1dbc650a21707a2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+hs_bindgen_b1dbc650a21707a2 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_bar@
+hs_bindgen_b1dbc650a21707a2 = fmap fromFFIType hs_bindgen_b1dbc650a21707a2_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_b1dbc650a21707a2
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+foreign import ccall unsafe "hs_bindgen_edc10f73f46266b8" hs_bindgen_edc10f73f46266b8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+hs_bindgen_edc10f73f46266b8 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_dash@
+hs_bindgen_edc10f73f46266b8 = fmap fromFFIType hs_bindgen_edc10f73f46266b8_base
+{-# NOINLINE dash_funptr #-}
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_funptr = unsafePerformIO hs_bindgen_edc10f73f46266b8
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_50fdcccdf0a43b92" hs_bindgen_50fdcccdf0a43b92_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+hs_bindgen_50fdcccdf0a43b92 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_quux@
+hs_bindgen_50fdcccdf0a43b92 = fmap fromFFIType hs_bindgen_50fdcccdf0a43b92_base
+{-# NOINLINE quux_funptr #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_funptr = unsafePerformIO hs_bindgen_50fdcccdf0a43b92
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+foreign import ccall unsafe "hs_bindgen_110df13ac4d9dfc8" hs_bindgen_110df13ac4d9dfc8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+hs_bindgen_110df13ac4d9dfc8 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes__Example_get_heq@
+hs_bindgen_110df13ac4d9dfc8 = fmap fromFFIType hs_bindgen_110df13ac4d9dfc8_base
+{-# NOINLINE heq_funptr #-}
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_funptr = unsafePerformIO hs_bindgen_110df13ac4d9dfc8
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example.hs
@@ -0,0 +1,71 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.BOOL(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+newtype BOOL = BOOL
+  { unwrapBOOL :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapBOOL" BOOL ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BOOL {unwrapBOOL = y1}, BG.getField @"unwrapBOOL" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapBOOL" (BG.Ptr BOOL) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapBOOL")
+
+instance HasCField.HasCField BOOL "unwrapBOOL" where
+
+  type CFieldType BOOL "unwrapBOOL" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example/FunPtr.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example/FunPtr.hs
@@ -0,0 +1,157 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    , Example.FunPtr.dash
+    , Example.FunPtr.quux
+    , Example.FunPtr.heq
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/gnu_attributes.h>"
+  , "/* test_macrosreparsegnu_attributes_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_82e23f370cc161df (void)) ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_30ffbacf53832dc4 (void)) ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes_Example_get_dash */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_3cc756628379222d (void)) ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  return &dash;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes_Example_get_quux */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c4a1e50d1013ab7d (void)) ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  return &quux;"
+  , "}"
+  , "/* test_macrosreparsegnu_attributes_Example_get_heq */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_646f1f9d97aa3318 (void)) ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  return &heq;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_82e23f370cc161df" hs_bindgen_82e23f370cc161df_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_foo@
+hs_bindgen_82e23f370cc161df :: IO (BG.FunPtr (BOOL -> IO ()))
+hs_bindgen_82e23f370cc161df =
+  fmap BG.fromFFIType hs_bindgen_82e23f370cc161df_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo :: BG.FunPtr (BOOL -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_82e23f370cc161df
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_30ffbacf53832dc4" hs_bindgen_30ffbacf53832dc4_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_bar@
+hs_bindgen_30ffbacf53832dc4 :: IO (BG.FunPtr (BOOL -> IO ()))
+hs_bindgen_30ffbacf53832dc4 =
+  fmap BG.fromFFIType hs_bindgen_30ffbacf53832dc4_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar :: BG.FunPtr (BOOL -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_30ffbacf53832dc4
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_dash@
+foreign import ccall unsafe "hs_bindgen_3cc756628379222d" hs_bindgen_3cc756628379222d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_dash@
+hs_bindgen_3cc756628379222d :: IO (BG.FunPtr (BOOL -> IO ()))
+hs_bindgen_3cc756628379222d =
+  fmap BG.fromFFIType hs_bindgen_3cc756628379222d_base
+
+{-# NOINLINE dash #-}
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash :: BG.FunPtr (BOOL -> IO ())
+dash = BG.unsafePerformIO hs_bindgen_3cc756628379222d
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_c4a1e50d1013ab7d" hs_bindgen_c4a1e50d1013ab7d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_quux@
+hs_bindgen_c4a1e50d1013ab7d :: IO (BG.FunPtr (BOOL -> IO ()))
+hs_bindgen_c4a1e50d1013ab7d =
+  fmap BG.fromFFIType hs_bindgen_c4a1e50d1013ab7d_base
+
+{-# NOINLINE quux #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux :: BG.FunPtr (BOOL -> IO ())
+quux = BG.unsafePerformIO hs_bindgen_c4a1e50d1013ab7d
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_heq@
+foreign import ccall unsafe "hs_bindgen_646f1f9d97aa3318" hs_bindgen_646f1f9d97aa3318_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_heq@
+hs_bindgen_646f1f9d97aa3318 :: IO (BG.FunPtr (BOOL -> IO ()))
+hs_bindgen_646f1f9d97aa3318 =
+  fmap BG.fromFFIType hs_bindgen_646f1f9d97aa3318_base
+
+{-# NOINLINE heq #-}
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq :: BG.FunPtr (BOOL -> IO ())
+heq = BG.unsafePerformIO hs_bindgen_646f1f9d97aa3318
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example/Safe.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example/Safe.hs
@@ -0,0 +1,172 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    , Example.Safe.dash
+    , Example.Safe.quux
+    , Example.Safe.heq
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/gnu_attributes.h>"
+  , "void hs_bindgen_702437d53bf7e32f ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_432c6480e8c1355b ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_b7cd534964204668 ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (dash)(arg1);"
+  , "}"
+  , "void hs_bindgen_24c242811e7f290b ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  , "void hs_bindgen_9bea1bb33c269bc2 ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (heq)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_702437d53bf7e32f" hs_bindgen_702437d53bf7e32f_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_foo@
+hs_bindgen_702437d53bf7e32f ::
+     BOOL
+  -> IO ()
+hs_bindgen_702437d53bf7e32f =
+  \x0 ->
+    hs_bindgen_702437d53bf7e32f_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo ::
+     BOOL
+  -> IO ()
+foo = hs_bindgen_702437d53bf7e32f
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_432c6480e8c1355b" hs_bindgen_432c6480e8c1355b_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_bar@
+hs_bindgen_432c6480e8c1355b ::
+     BOOL
+  -> IO ()
+hs_bindgen_432c6480e8c1355b =
+  \x0 ->
+    hs_bindgen_432c6480e8c1355b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar ::
+     BOOL
+  -> IO ()
+bar = hs_bindgen_432c6480e8c1355b
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_dash@
+foreign import ccall safe "hs_bindgen_b7cd534964204668" hs_bindgen_b7cd534964204668_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_dash@
+hs_bindgen_b7cd534964204668 ::
+     BOOL
+  -> IO ()
+hs_bindgen_b7cd534964204668 =
+  \x0 ->
+    hs_bindgen_b7cd534964204668_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash ::
+     BOOL
+  -> IO ()
+dash = hs_bindgen_b7cd534964204668
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_24c242811e7f290b" hs_bindgen_24c242811e7f290b_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_quux@
+hs_bindgen_24c242811e7f290b ::
+     BOOL
+  -> IO ()
+hs_bindgen_24c242811e7f290b =
+  \x0 ->
+    hs_bindgen_24c242811e7f290b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux ::
+     BOOL
+  -> IO ()
+quux = hs_bindgen_24c242811e7f290b
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_heq@
+foreign import ccall safe "hs_bindgen_9bea1bb33c269bc2" hs_bindgen_9bea1bb33c269bc2_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_heq@
+hs_bindgen_9bea1bb33c269bc2 ::
+     BOOL
+  -> IO ()
+hs_bindgen_9bea1bb33c269bc2 =
+  \x0 ->
+    hs_bindgen_9bea1bb33c269bc2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq ::
+     BOOL
+  -> IO ()
+heq = hs_bindgen_9bea1bb33c269bc2
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example/Unsafe.hs b/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes/Example/Unsafe.hs
@@ -0,0 +1,172 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    , Example.Unsafe.dash
+    , Example.Unsafe.quux
+    , Example.Unsafe.heq
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/gnu_attributes.h>"
+  , "void hs_bindgen_6716bcb05c1aff64 ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_04dc8fc0c78d4f3a ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  , "void hs_bindgen_8e06931d2ef7ccdb ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (dash)(arg1);"
+  , "}"
+  , "void hs_bindgen_ec7c3016706a46c2 ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (quux)(arg1);"
+  , "}"
+  , "void hs_bindgen_f6865acd1e6f7475 ("
+  , "  BOOL arg1"
+  , ")"
+  , "{"
+  , "  (heq)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_6716bcb05c1aff64" hs_bindgen_6716bcb05c1aff64_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_foo@
+hs_bindgen_6716bcb05c1aff64 ::
+     BOOL
+  -> IO ()
+hs_bindgen_6716bcb05c1aff64 =
+  \x0 ->
+    hs_bindgen_6716bcb05c1aff64_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo ::
+     BOOL
+  -> IO ()
+foo = hs_bindgen_6716bcb05c1aff64
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_04dc8fc0c78d4f3a" hs_bindgen_04dc8fc0c78d4f3a_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_bar@
+hs_bindgen_04dc8fc0c78d4f3a ::
+     BOOL
+  -> IO ()
+hs_bindgen_04dc8fc0c78d4f3a =
+  \x0 ->
+    hs_bindgen_04dc8fc0c78d4f3a_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar ::
+     BOOL
+  -> IO ()
+bar = hs_bindgen_04dc8fc0c78d4f3a
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_dash@
+foreign import ccall unsafe "hs_bindgen_8e06931d2ef7ccdb" hs_bindgen_8e06931d2ef7ccdb_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_dash@
+hs_bindgen_8e06931d2ef7ccdb ::
+     BOOL
+  -> IO ()
+hs_bindgen_8e06931d2ef7ccdb =
+  \x0 ->
+    hs_bindgen_8e06931d2ef7ccdb_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash ::
+     BOOL
+  -> IO ()
+dash = hs_bindgen_8e06931d2ef7ccdb
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_ec7c3016706a46c2" hs_bindgen_ec7c3016706a46c2_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_quux@
+hs_bindgen_ec7c3016706a46c2 ::
+     BOOL
+  -> IO ()
+hs_bindgen_ec7c3016706a46c2 =
+  \x0 ->
+    hs_bindgen_ec7c3016706a46c2_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux ::
+     BOOL
+  -> IO ()
+quux = hs_bindgen_ec7c3016706a46c2
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_heq@
+foreign import ccall unsafe "hs_bindgen_f6865acd1e6f7475" hs_bindgen_f6865acd1e6f7475_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_heq@
+hs_bindgen_f6865acd1e6f7475 ::
+     BOOL
+  -> IO ()
+hs_bindgen_f6865acd1e6f7475 =
+  \x0 ->
+    hs_bindgen_f6865acd1e6f7475_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq ::
+     BOOL
+  -> IO ()
+heq = hs_bindgen_f6865acd1e6f7475
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/gnu_attributes/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/gnu_attributes.h
+  cname: macro BOOL
+  hsname: BOOL
+hstypes:
+- hsname: BOOL
+  representation:
+    newtype:
+      constructor: BOOL
+      fields:
+      - unwrapBOOL
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/gnu_attributes/th.txt b/test-artefacts/fixtures/macros/reparse/gnu_attributes/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/gnu_attributes/th.txt
@@ -0,0 +1,464 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/gnu_attributes.h
+-- #include <macros/reparse/gnu_attributes.h>
+-- void hs_bindgen_702437d53bf7e32f (
+--   BOOL arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_432c6480e8c1355b (
+--   BOOL arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_b7cd534964204668 (
+--   BOOL arg1
+-- )
+-- {
+--   (dash)(arg1);
+-- }
+-- void hs_bindgen_24c242811e7f290b (
+--   BOOL arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- void hs_bindgen_9bea1bb33c269bc2 (
+--   BOOL arg1
+-- )
+-- {
+--   (heq)(arg1);
+-- }
+-- void hs_bindgen_6716bcb05c1aff64 (
+--   BOOL arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_04dc8fc0c78d4f3a (
+--   BOOL arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_8e06931d2ef7ccdb (
+--   BOOL arg1
+-- )
+-- {
+--   (dash)(arg1);
+-- }
+-- void hs_bindgen_ec7c3016706a46c2 (
+--   BOOL arg1
+-- )
+-- {
+--   (quux)(arg1);
+-- }
+-- void hs_bindgen_f6865acd1e6f7475 (
+--   BOOL arg1
+-- )
+-- {
+--   (heq)(arg1);
+-- }
+-- /* test_macrosreparsegnu_attributes_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_82e23f370cc161df (void)) (
+--   BOOL arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_macrosreparsegnu_attributes_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_30ffbacf53832dc4 (void)) (
+--   BOOL arg1
+-- )
+-- {
+--   return &bar;
+-- }
+-- /* test_macrosreparsegnu_attributes_Example_get_dash */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3cc756628379222d (void)) (
+--   BOOL arg1
+-- )
+-- {
+--   return &dash;
+-- }
+-- /* test_macrosreparsegnu_attributes_Example_get_quux */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c4a1e50d1013ab7d (void)) (
+--   BOOL arg1
+-- )
+-- {
+--   return &quux;
+-- }
+-- /* test_macrosreparsegnu_attributes_Example_get_heq */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_646f1f9d97aa3318 (void)) (
+--   BOOL arg1
+-- )
+-- {
+--   return &heq;
+-- }
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 2:9@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+newtype BOOL
+    = BOOL {unwrapBOOL :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapBOOL" BOOL ty
+    where hasField = \x_0 -> (\y_1 -> BOOL{unwrapBOOL = y_1},
+                              getField @"unwrapBOOL" x_0)
+instance (~) ty CInt => HasField "unwrapBOOL" (Ptr BOOL) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBOOL")
+instance HasCField BOOL "unwrapBOOL"
+    where type CFieldType BOOL "unwrapBOOL" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_702437d53bf7e32f" hs_bindgen_702437d53bf7e32f_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_foo@
+hs_bindgen_702437d53bf7e32f :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_foo@
+hs_bindgen_702437d53bf7e32f = \x_0 -> hs_bindgen_702437d53bf7e32f_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_safe :: BOOL -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_safe = hs_bindgen_702437d53bf7e32f
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_432c6480e8c1355b" hs_bindgen_432c6480e8c1355b_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_bar@
+hs_bindgen_432c6480e8c1355b :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_bar@
+hs_bindgen_432c6480e8c1355b = \x_0 -> hs_bindgen_432c6480e8c1355b_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_safe :: BOOL -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_safe = hs_bindgen_432c6480e8c1355b
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_dash@
+foreign import ccall safe "hs_bindgen_b7cd534964204668" hs_bindgen_b7cd534964204668_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_dash@
+hs_bindgen_b7cd534964204668 :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_dash@
+hs_bindgen_b7cd534964204668 = \x_0 -> hs_bindgen_b7cd534964204668_base (toFFIType x_0)
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_safe :: BOOL -> IO ()
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_safe = hs_bindgen_b7cd534964204668
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_quux@
+foreign import ccall safe "hs_bindgen_24c242811e7f290b" hs_bindgen_24c242811e7f290b_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_quux@
+hs_bindgen_24c242811e7f290b :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_quux@
+hs_bindgen_24c242811e7f290b = \x_0 -> hs_bindgen_24c242811e7f290b_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_safe :: BOOL -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_safe = hs_bindgen_24c242811e7f290b
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_heq@
+foreign import ccall safe "hs_bindgen_9bea1bb33c269bc2" hs_bindgen_9bea1bb33c269bc2_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_heq@
+hs_bindgen_9bea1bb33c269bc2 :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Safe_heq@
+hs_bindgen_9bea1bb33c269bc2 = \x_0 -> hs_bindgen_9bea1bb33c269bc2_base (toFFIType x_0)
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_safe :: BOOL -> IO ()
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_safe = hs_bindgen_9bea1bb33c269bc2
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_6716bcb05c1aff64" hs_bindgen_6716bcb05c1aff64_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_foo@
+hs_bindgen_6716bcb05c1aff64 :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_foo@
+hs_bindgen_6716bcb05c1aff64 = \x_0 -> hs_bindgen_6716bcb05c1aff64_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_unsafe :: BOOL -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_unsafe = hs_bindgen_6716bcb05c1aff64
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_04dc8fc0c78d4f3a" hs_bindgen_04dc8fc0c78d4f3a_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_bar@
+hs_bindgen_04dc8fc0c78d4f3a :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_bar@
+hs_bindgen_04dc8fc0c78d4f3a = \x_0 -> hs_bindgen_04dc8fc0c78d4f3a_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_unsafe :: BOOL -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_unsafe = hs_bindgen_04dc8fc0c78d4f3a
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_dash@
+foreign import ccall unsafe "hs_bindgen_8e06931d2ef7ccdb" hs_bindgen_8e06931d2ef7ccdb_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_dash@
+hs_bindgen_8e06931d2ef7ccdb :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_dash@
+hs_bindgen_8e06931d2ef7ccdb = \x_0 -> hs_bindgen_8e06931d2ef7ccdb_base (toFFIType x_0)
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_unsafe :: BOOL -> IO ()
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_unsafe = hs_bindgen_8e06931d2ef7ccdb
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_quux@
+foreign import ccall unsafe "hs_bindgen_ec7c3016706a46c2" hs_bindgen_ec7c3016706a46c2_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_quux@
+hs_bindgen_ec7c3016706a46c2 :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_quux@
+hs_bindgen_ec7c3016706a46c2 = \x_0 -> hs_bindgen_ec7c3016706a46c2_base (toFFIType x_0)
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_unsafe :: BOOL -> IO ()
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_unsafe = hs_bindgen_ec7c3016706a46c2
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_heq@
+foreign import ccall unsafe "hs_bindgen_f6865acd1e6f7475" hs_bindgen_f6865acd1e6f7475_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_heq@
+hs_bindgen_f6865acd1e6f7475 :: BOOL -> IO ()
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_Unsafe_heq@
+hs_bindgen_f6865acd1e6f7475 = \x_0 -> hs_bindgen_f6865acd1e6f7475_base (toFFIType x_0)
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_unsafe :: BOOL -> IO ()
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_unsafe = hs_bindgen_f6865acd1e6f7475
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_82e23f370cc161df" hs_bindgen_82e23f370cc161df_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_foo@
+hs_bindgen_82e23f370cc161df :: IO (FunPtr (BOOL -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_foo@
+hs_bindgen_82e23f370cc161df = fmap fromFFIType hs_bindgen_82e23f370cc161df_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_funptr :: FunPtr (BOOL -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 3:6@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_82e23f370cc161df
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_30ffbacf53832dc4" hs_bindgen_30ffbacf53832dc4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_bar@
+hs_bindgen_30ffbacf53832dc4 :: IO (FunPtr (BOOL -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_bar@
+hs_bindgen_30ffbacf53832dc4 = fmap fromFFIType hs_bindgen_30ffbacf53832dc4_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_funptr :: FunPtr (BOOL -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 6:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_30ffbacf53832dc4
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_dash@
+foreign import ccall unsafe "hs_bindgen_3cc756628379222d" hs_bindgen_3cc756628379222d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_dash@
+hs_bindgen_3cc756628379222d :: IO (FunPtr (BOOL -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_dash@
+hs_bindgen_3cc756628379222d = fmap fromFFIType hs_bindgen_3cc756628379222d_base
+{-# NOINLINE dash_funptr #-}
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_funptr :: FunPtr (BOOL -> IO ())
+{-| __C declaration:__ @dash@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 7:46@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+dash_funptr = unsafePerformIO hs_bindgen_3cc756628379222d
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_quux@
+foreign import ccall unsafe "hs_bindgen_c4a1e50d1013ab7d" hs_bindgen_c4a1e50d1013ab7d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_quux@
+hs_bindgen_c4a1e50d1013ab7d :: IO (FunPtr (BOOL -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_quux@
+hs_bindgen_c4a1e50d1013ab7d = fmap fromFFIType hs_bindgen_c4a1e50d1013ab7d_base
+{-# NOINLINE quux_funptr #-}
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_funptr :: FunPtr (BOOL -> IO ())
+{-| __C declaration:__ @quux@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 11:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+quux_funptr = unsafePerformIO hs_bindgen_c4a1e50d1013ab7d
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_heq@
+foreign import ccall unsafe "hs_bindgen_646f1f9d97aa3318" hs_bindgen_646f1f9d97aa3318_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_heq@
+hs_bindgen_646f1f9d97aa3318 :: IO (FunPtr (BOOL -> IO ()))
+-- __unique:__ @test_macrosreparsegnu_attributes_Example_get_heq@
+hs_bindgen_646f1f9d97aa3318 = fmap fromFFIType hs_bindgen_646f1f9d97aa3318_base
+{-# NOINLINE heq_funptr #-}
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_funptr :: FunPtr (BOOL -> IO ())
+{-| __C declaration:__ @heq@
+
+    __defined at:__ @macros\/reparse\/gnu_attributes.h 12:13@
+
+    __exported by:__ @macros\/reparse\/gnu_attributes.h@
+-}
+heq_funptr = unsafePerformIO hs_bindgen_646f1f9d97aa3318
diff --git a/test-artefacts/fixtures/macros/reparse/nesting.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting.1.empty/Example.hs
@@ -0,0 +1,223 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T2(..)
+    , Example.T3(..)
+    , Example.T4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct TS1@
+
+    __defined at:__ @macros\/reparse\/nesting.h 5:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T2 = T2
+  { t2_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting.h 5:28@
+
+         __exported by:__ @macros\/reparse\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2 where
+
+  readRaw =
+    \ptr0 ->
+          pure T2
+      <*> HasCField.readRaw (BG.Proxy @"t2_x") ptr0
+
+instance Marshal.WriteRaw T2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2 t2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x") ptr0 t2_x2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via Struct.IsStructViaReadRaw T2 instance Struct.IsStruct T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting.h 5:28@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2 {t2_x = y1}, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct TS3@
+
+    __defined at:__ @macros\/reparse\/nesting.h 6:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T3 = T3
+  { t3_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting.h 6:28@
+
+         __exported by:__ @macros\/reparse\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3 where
+
+  readRaw =
+    \ptr0 ->
+          pure T3
+      <*> HasCField.readRaw (BG.Proxy @"t3_x") ptr0
+
+instance Marshal.WriteRaw T3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3 t3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x") ptr0 t3_x2
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via Struct.IsStructViaReadRaw T3 instance Struct.IsStruct T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting.h 6:28@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3 {t3_x = y1}, BG.getField @"t3_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct T4@
+
+    __defined at:__ @macros\/reparse\/nesting.h 7:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T4 = T4
+  { t4_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting.h 7:28@
+
+         __exported by:__ @macros\/reparse\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T4 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T4 where
+
+  readRaw =
+    \ptr0 ->
+          pure T4
+      <*> HasCField.readRaw (BG.Proxy @"t4_x") ptr0
+
+instance Marshal.WriteRaw T4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T4 t4_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t4_x") ptr0 t4_x2
+
+deriving via Marshal.EquivStorable T4 instance BG.Storable T4
+
+deriving via Struct.IsStructViaReadRaw T4 instance Struct.IsStruct T4
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting.h 7:28@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t4_x" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T4 {t4_x = y1}, BG.getField @"t4_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t4_x" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t4_x")
+
+instance HasCField.HasCField T4 "t4_x" where
+
+  type CFieldType T4 "t4_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting.1.empty/bindingspec.yaml
@@ -0,0 +1,81 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting.h
+  cname: struct TS1
+  hsname: T2
+- headers: macros/reparse/nesting.h
+  cname: T2
+  hsname: T2
+- headers: macros/reparse/nesting.h
+  cname: struct TS3
+  hsname: T3
+- headers: macros/reparse/nesting.h
+  cname: T3
+  hsname: T3
+- headers: macros/reparse/nesting.h
+  cname: struct T4
+  hsname: T4
+- headers: macros/reparse/nesting.h
+  cname: T4
+  hsname: T4
+hstypes:
+- hsname: T2
+  representation:
+    record:
+      constructor: T2
+      fields:
+      - t2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    record:
+      constructor: T3
+      fields:
+      - t3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    record:
+      constructor: T4
+      fields:
+      - t4_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/nesting.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting.1.empty/th.txt
@@ -0,0 +1,100 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting.h
+{-| __C declaration:__ @struct TS1@
+
+    __defined at:__ @macros\/reparse\/nesting.h 5:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T2
+    = T2 {t2_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting.h 5:28@
+
+               __exported by:__ @macros\/reparse\/nesting.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2
+    where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
+instance WriteRaw T2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (IsStructViaReadRaw T2) instance IsStruct T2
+instance (~) ty CInt => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
+                              getField @"t2_x" x_0)
+instance (~) ty CInt => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct TS3@
+
+    __defined at:__ @macros\/reparse\/nesting.h 6:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T3
+    = T3 {t3_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting.h 6:28@
+
+               __exported by:__ @macros\/reparse\/nesting.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3
+    where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
+instance WriteRaw T3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (IsStructViaReadRaw T3) instance IsStruct T3
+instance (~) ty CInt => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
+                              getField @"t3_x" x_0)
+instance (~) ty CInt => HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct T4@
+
+    __defined at:__ @macros\/reparse\/nesting.h 7:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T4
+    = T4 {t4_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting.h 7:28@
+
+               __exported by:__ @macros\/reparse\/nesting.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T4
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T4
+    where readRaw = \ptr_0 -> pure T4 <*> readRaw (Proxy @"t4_x") ptr_0
+instance WriteRaw T4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T4 t4_x_2 -> writeRaw (Proxy @"t4_x") ptr_0 t4_x_2
+deriving via (EquivStorable T4) instance Storable T4
+deriving via (IsStructViaReadRaw T4) instance IsStruct T4
+instance (~) ty CInt => HasField "t4_x" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{t4_x = y_1},
+                              getField @"t4_x" x_0)
+instance (~) ty CInt => HasField "t4_x" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"t4_x")
+instance HasCField T4 "t4_x"
+    where type CFieldType T4 "t4_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting.2.raw/Example.hs
@@ -0,0 +1,234 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.myInt
+    , Example.T2(..)
+    , Example.T3(..)
+    , Example.T4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+myInt :: Macro.Raw String
+myInt = Macro.objectLike "MyInt" ["int"]
+
+{-| __C declaration:__ @struct TS1@
+
+    __defined at:__ @macros\/reparse\/nesting.h 5:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T2 = T2
+  { t2_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting.h 5:28@
+
+         __exported by:__ @macros\/reparse\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2 where
+
+  readRaw =
+    \ptr0 ->
+          pure T2
+      <*> HasCField.readRaw (BG.Proxy @"t2_x") ptr0
+
+instance Marshal.WriteRaw T2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2 t2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x") ptr0 t2_x2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via Struct.IsStructViaReadRaw T2 instance Struct.IsStruct T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting.h 5:28@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2 {t2_x = y1}, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct TS3@
+
+    __defined at:__ @macros\/reparse\/nesting.h 6:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T3 = T3
+  { t3_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting.h 6:28@
+
+         __exported by:__ @macros\/reparse\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3 where
+
+  readRaw =
+    \ptr0 ->
+          pure T3
+      <*> HasCField.readRaw (BG.Proxy @"t3_x") ptr0
+
+instance Marshal.WriteRaw T3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3 t3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x") ptr0 t3_x2
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via Struct.IsStructViaReadRaw T3 instance Struct.IsStruct T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting.h 6:28@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3 {t3_x = y1}, BG.getField @"t3_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct T4@
+
+    __defined at:__ @macros\/reparse\/nesting.h 7:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T4 = T4
+  { t4_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting.h 7:28@
+
+         __exported by:__ @macros\/reparse\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T4 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T4 where
+
+  readRaw =
+    \ptr0 ->
+          pure T4
+      <*> HasCField.readRaw (BG.Proxy @"t4_x") ptr0
+
+instance Marshal.WriteRaw T4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T4 t4_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t4_x") ptr0 t4_x2
+
+deriving via Marshal.EquivStorable T4 instance BG.Storable T4
+
+deriving via Struct.IsStructViaReadRaw T4 instance Struct.IsStruct T4
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting.h 7:28@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t4_x" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T4 {t4_x = y1}, BG.getField @"t4_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t4_x" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t4_x")
+
+instance HasCField.HasCField T4 "t4_x" where
+
+  type CFieldType T4 "t4_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting.2.raw/bindingspec.yaml
@@ -0,0 +1,81 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting.h
+  cname: struct TS1
+  hsname: T2
+- headers: macros/reparse/nesting.h
+  cname: T2
+  hsname: T2
+- headers: macros/reparse/nesting.h
+  cname: struct TS3
+  hsname: T3
+- headers: macros/reparse/nesting.h
+  cname: T3
+  hsname: T3
+- headers: macros/reparse/nesting.h
+  cname: struct T4
+  hsname: T4
+- headers: macros/reparse/nesting.h
+  cname: T4
+  hsname: T4
+hstypes:
+- hsname: T2
+  representation:
+    record:
+      constructor: T2
+      fields:
+      - t2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    record:
+      constructor: T3
+      fields:
+      - t3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    record:
+      constructor: T4
+      fields:
+      - t4_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/nesting.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting.2.raw/th.txt
@@ -0,0 +1,114 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting.h
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+myInt :: Raw String
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+myInt = objectLike "MyInt" ["int"]
+{-| __C declaration:__ @struct TS1@
+
+    __defined at:__ @macros\/reparse\/nesting.h 5:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T2
+    = T2 {t2_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting.h 5:28@
+
+               __exported by:__ @macros\/reparse\/nesting.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2
+    where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
+instance WriteRaw T2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (IsStructViaReadRaw T2) instance IsStruct T2
+instance (~) ty CInt => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
+                              getField @"t2_x" x_0)
+instance (~) ty CInt => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct TS3@
+
+    __defined at:__ @macros\/reparse\/nesting.h 6:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T3
+    = T3 {t3_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting.h 6:28@
+
+               __exported by:__ @macros\/reparse\/nesting.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3
+    where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
+instance WriteRaw T3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (IsStructViaReadRaw T3) instance IsStruct T3
+instance (~) ty CInt => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
+                              getField @"t3_x" x_0)
+instance (~) ty CInt => HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct T4@
+
+    __defined at:__ @macros\/reparse\/nesting.h 7:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T4
+    = T4 {t4_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting.h 7:28@
+
+               __exported by:__ @macros\/reparse\/nesting.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T4
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T4
+    where readRaw = \ptr_0 -> pure T4 <*> readRaw (Proxy @"t4_x") ptr_0
+instance WriteRaw T4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T4 t4_x_2 -> writeRaw (Proxy @"t4_x") ptr_0 t4_x_2
+deriving via (EquivStorable T4) instance Storable T4
+deriving via (IsStructViaReadRaw T4) instance IsStruct T4
+instance (~) ty CInt => HasField "t4_x" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{t4_x = y_1},
+                              getField @"t4_x" x_0)
+instance (~) ty CInt => HasField "t4_x" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"t4_x")
+instance HasCField T4 "t4_x"
+    where type CFieldType T4 "t4_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/Example.hs
@@ -0,0 +1,274 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.T2(..)
+    , Example.T3(..)
+    , Example.T4(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct TS1@
+
+    __defined at:__ @macros\/reparse\/nesting.h 5:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T2 = T2
+  { t2_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting.h 5:28@
+
+         __exported by:__ @macros\/reparse\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2 where
+
+  readRaw =
+    \ptr0 ->
+          pure T2
+      <*> HasCField.readRaw (BG.Proxy @"t2_x") ptr0
+
+instance Marshal.WriteRaw T2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2 t2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x") ptr0 t2_x2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via Struct.IsStructViaReadRaw T2 instance Struct.IsStruct T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting.h 5:28@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2 {t2_x = y1}, BG.getField @"t2_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct TS3@
+
+    __defined at:__ @macros\/reparse\/nesting.h 6:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T3 = T3
+  { t3_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting.h 6:28@
+
+         __exported by:__ @macros\/reparse\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3 where
+
+  readRaw =
+    \ptr0 ->
+          pure T3
+      <*> HasCField.readRaw (BG.Proxy @"t3_x") ptr0
+
+instance Marshal.WriteRaw T3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3 t3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x") ptr0 t3_x2
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via Struct.IsStructViaReadRaw T3 instance Struct.IsStruct T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting.h 6:28@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3 {t3_x = y1}, BG.getField @"t3_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct T4@
+
+    __defined at:__ @macros\/reparse\/nesting.h 7:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T4 = T4
+  { t4_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting.h 7:28@
+
+         __exported by:__ @macros\/reparse\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T4 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T4 where
+
+  readRaw =
+    \ptr0 ->
+          pure T4
+      <*> HasCField.readRaw (BG.Proxy @"t4_x") ptr0
+
+instance Marshal.WriteRaw T4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T4 t4_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t4_x") ptr0 t4_x2
+
+deriving via Marshal.EquivStorable T4 instance BG.Storable T4
+
+deriving via Struct.IsStructViaReadRaw T4 instance Struct.IsStruct T4
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting.h 7:28@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t4_x" T4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T4 {t4_x = y1}, BG.getField @"t4_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t4_x" (BG.Ptr T4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t4_x")
+
+instance HasCField.HasCField T4 "t4_x" where
+
+  type CFieldType T4 "t4_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/bindingspec.yaml
@@ -0,0 +1,118 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting.h
+  cname: macro MyInt
+  hsname: MyInt
+- headers: macros/reparse/nesting.h
+  cname: struct TS1
+  hsname: T2
+- headers: macros/reparse/nesting.h
+  cname: T2
+  hsname: T2
+- headers: macros/reparse/nesting.h
+  cname: struct TS3
+  hsname: T3
+- headers: macros/reparse/nesting.h
+  cname: T3
+  hsname: T3
+- headers: macros/reparse/nesting.h
+  cname: struct T4
+  hsname: T4
+- headers: macros/reparse/nesting.h
+  cname: T4
+  hsname: T4
+hstypes:
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    record:
+      constructor: T2
+      fields:
+      - t2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    record:
+      constructor: T3
+      fields:
+      - t3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T4
+  representation:
+    record:
+      constructor: T4
+      fields:
+      - t4_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/Example.hs
@@ -0,0 +1,423 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1_x = T1_x
+  { t1_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:25@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T1_x
+      <*> HasCField.readRaw (BG.Proxy @"t1_x_x") ptr0
+
+instance Marshal.WriteRaw T1_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1_x t1_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x_x") ptr0 t1_x_x2
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via Struct.IsStructViaReadRaw T1_x instance Struct.IsStruct T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:25@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1_x {t1_x_x = y1}, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1 = T1
+  { t1_x :: T1_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:33@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1 where
+
+  readRaw =
+    \ptr0 ->
+          pure T1
+      <*> HasCField.readRaw (BG.Proxy @"t1_x") ptr0
+
+instance Marshal.WriteRaw T1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1 t1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x") ptr0 t1_x2
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via Struct.IsStructViaReadRaw T1 instance Struct.IsStruct T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:33@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1 {t1_x = y1}, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2 = T2
+  { t2_x :: BG.Ptr T2_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:33@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T2 where
+
+  readRaw =
+    \ptr0 ->
+          pure T2
+      <*> HasCField.readRaw (BG.Proxy @"t2_x") ptr0
+
+instance Marshal.WriteRaw T2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2 t2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x") ptr0 t2_x2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via Struct.IsStructViaReadRaw T2 instance Struct.IsStruct T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:33@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2 {t2_x = y1}, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2_x = T2_x
+  { t2_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:25@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T2_x
+      <*> HasCField.readRaw (BG.Proxy @"t2_x_x") ptr0
+
+instance Marshal.WriteRaw T2_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2_x t2_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x_x") ptr0 t2_x_x2
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via Struct.IsStructViaReadRaw T2_x instance Struct.IsStruct T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:25@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2_x {t2_x_x = y1}, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3 = T3
+  { t3_x :: BG.Ptr (BG.Ptr T3_x)
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:33@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T3 where
+
+  readRaw =
+    \ptr0 ->
+          pure T3
+      <*> HasCField.readRaw (BG.Proxy @"t3_x") ptr0
+
+instance Marshal.WriteRaw T3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3 t3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x") ptr0 t3_x2
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via Struct.IsStructViaReadRaw T3 instance Struct.IsStruct T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:33@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3 {t3_x = y1}, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3_x = T3_x
+  { t3_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:25@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T3_x
+      <*> HasCField.readRaw (BG.Proxy @"t3_x_x") ptr0
+
+instance Marshal.WriteRaw T3_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3_x t3_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x_x") ptr0 t3_x_x2
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via Struct.IsStructViaReadRaw T3_x instance Struct.IsStruct T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:25@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3_x {t3_x_x = y1}, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/struct_in_struct.h>"
+  , "/* test_macrosreparsenestingstruct__Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_2ac02abef90be65b (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_ce4ed8cb010301fc (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_9d78eb12f80bd5a1 (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (BG.Ptr T1)
+hs_bindgen_2ac02abef90be65b =
+  fmap BG.fromFFIType hs_bindgen_2ac02abef90be65b_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_2ac02abef90be65b
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (BG.Ptr T2)
+hs_bindgen_ce4ed8cb010301fc =
+  fmap BG.fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (BG.Ptr T3)
+hs_bindgen_9d78eb12f80bd5a1 =
+  fmap BG.fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/bindingspec.yaml
@@ -0,0 +1,138 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T2
+  hsname: T2
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T3
+  hsname: T3
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: T1
+  representation:
+    record:
+      constructor: T1
+      fields:
+      - t1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    record:
+      constructor: T1_x
+      fields:
+      - t1_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    record:
+      constructor: T2
+      fields:
+      - t2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    record:
+      constructor: T2_x
+      fields:
+      - t2_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    record:
+      constructor: T3
+      fields:
+      - t3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    record:
+      constructor: T3_x
+      fields:
+      - t3_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.1.empty/th.txt
@@ -0,0 +1,285 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_struct.h
+-- #include <macros/reparse/nesting/struct_in_struct.h>
+-- /* test_macrosreparsenestingstruct__Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_2ac02abef90be65b (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_ce4ed8cb010301fc (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_9d78eb12f80bd5a1 (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1_x
+    = T1_x {t1_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:25@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1_x
+    where readRaw = \ptr_0 -> pure T1_x <*> readRaw (Proxy @"t1_x_x") ptr_0
+instance WriteRaw T1_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1_x t1_x_x_2 -> writeRaw (Proxy @"t1_x_x") ptr_0 t1_x_x_2
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (IsStructViaReadRaw T1_x) instance IsStruct T1_x
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> T1_x{t1_x_x = y_1},
+                              getField @"t1_x_x" x_0)
+instance (~) ty CInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1
+    = T1 {t1_x :: T1_x
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:33@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1
+    where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
+instance WriteRaw T1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (IsStructViaReadRaw T1) instance IsStruct T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2
+    = T2 {t2_x :: (Ptr T2_x)
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:33@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T2
+    where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
+instance WriteRaw T2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (IsStructViaReadRaw T2) instance IsStruct T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2_x
+    = T2_x {t2_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:25@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2_x
+    where readRaw = \ptr_0 -> pure T2_x <*> readRaw (Proxy @"t2_x_x") ptr_0
+instance WriteRaw T2_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2_x t2_x_x_2 -> writeRaw (Proxy @"t2_x_x") ptr_0 t2_x_x_2
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (IsStructViaReadRaw T2_x) instance IsStruct T2_x
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> T2_x{t2_x_x = y_1},
+                              getField @"t2_x_x" x_0)
+instance (~) ty CInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3
+    = T3 {t3_x :: (Ptr (Ptr T3_x))
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:33@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T3
+    where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
+instance WriteRaw T3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (IsStructViaReadRaw T3) instance IsStruct T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3_x
+    = T3_x {t3_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:25@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3_x
+    where readRaw = \ptr_0 -> pure T3_x <*> readRaw (Proxy @"t3_x_x") ptr_0
+instance WriteRaw T3_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3_x t3_x_x_2 -> writeRaw (Proxy @"t3_x_x") ptr_0 t3_x_x_2
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (IsStructViaReadRaw T3_x) instance IsStruct T3_x
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> T3_x{t3_x_x = y_1},
+                              getField @"t3_x_x" x_0)
+instance (~) ty CInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b = fmap fromFFIType hs_bindgen_2ac02abef90be65b_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t1 = unsafePerformIO hs_bindgen_2ac02abef90be65b
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc = fmap fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t2 = unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 = fmap fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t3 = unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/Example.hs
@@ -0,0 +1,434 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.myInt
+    , Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+myInt :: Macro.Raw String
+myInt = Macro.objectLike "MyInt" ["int"]
+
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1_x = T1_x
+  { t1_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:25@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T1_x
+      <*> HasCField.readRaw (BG.Proxy @"t1_x_x") ptr0
+
+instance Marshal.WriteRaw T1_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1_x t1_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x_x") ptr0 t1_x_x2
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via Struct.IsStructViaReadRaw T1_x instance Struct.IsStruct T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:25@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1_x {t1_x_x = y1}, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1 = T1
+  { t1_x :: T1_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:33@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1 where
+
+  readRaw =
+    \ptr0 ->
+          pure T1
+      <*> HasCField.readRaw (BG.Proxy @"t1_x") ptr0
+
+instance Marshal.WriteRaw T1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1 t1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x") ptr0 t1_x2
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via Struct.IsStructViaReadRaw T1 instance Struct.IsStruct T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:33@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1 {t1_x = y1}, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2 = T2
+  { t2_x :: BG.Ptr T2_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:33@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T2 where
+
+  readRaw =
+    \ptr0 ->
+          pure T2
+      <*> HasCField.readRaw (BG.Proxy @"t2_x") ptr0
+
+instance Marshal.WriteRaw T2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2 t2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x") ptr0 t2_x2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via Struct.IsStructViaReadRaw T2 instance Struct.IsStruct T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:33@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2 {t2_x = y1}, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2_x = T2_x
+  { t2_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:25@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T2_x
+      <*> HasCField.readRaw (BG.Proxy @"t2_x_x") ptr0
+
+instance Marshal.WriteRaw T2_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2_x t2_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x_x") ptr0 t2_x_x2
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via Struct.IsStructViaReadRaw T2_x instance Struct.IsStruct T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:25@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2_x {t2_x_x = y1}, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3 = T3
+  { t3_x :: BG.Ptr (BG.Ptr T3_x)
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:33@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T3 where
+
+  readRaw =
+    \ptr0 ->
+          pure T3
+      <*> HasCField.readRaw (BG.Proxy @"t3_x") ptr0
+
+instance Marshal.WriteRaw T3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3 t3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x") ptr0 t3_x2
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via Struct.IsStructViaReadRaw T3 instance Struct.IsStruct T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:33@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3 {t3_x = y1}, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3_x = T3_x
+  { t3_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:25@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T3_x
+      <*> HasCField.readRaw (BG.Proxy @"t3_x_x") ptr0
+
+instance Marshal.WriteRaw T3_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3_x t3_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x_x") ptr0 t3_x_x2
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via Struct.IsStructViaReadRaw T3_x instance Struct.IsStruct T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:25@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3_x {t3_x_x = y1}, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/struct_in_struct.h>"
+  , "/* test_macrosreparsenestingstruct__Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_2ac02abef90be65b (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_ce4ed8cb010301fc (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_9d78eb12f80bd5a1 (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (BG.Ptr T1)
+hs_bindgen_2ac02abef90be65b =
+  fmap BG.fromFFIType hs_bindgen_2ac02abef90be65b_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_2ac02abef90be65b
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (BG.Ptr T2)
+hs_bindgen_ce4ed8cb010301fc =
+  fmap BG.fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (BG.Ptr T3)
+hs_bindgen_9d78eb12f80bd5a1 =
+  fmap BG.fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/bindingspec.yaml
@@ -0,0 +1,138 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T2
+  hsname: T2
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T3
+  hsname: T3
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: T1
+  representation:
+    record:
+      constructor: T1
+      fields:
+      - t1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    record:
+      constructor: T1_x
+      fields:
+      - t1_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    record:
+      constructor: T2
+      fields:
+      - t2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    record:
+      constructor: T2_x
+      fields:
+      - t2_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    record:
+      constructor: T3
+      fields:
+      - t3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    record:
+      constructor: T3_x
+      fields:
+      - t3_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct.2.raw/th.txt
@@ -0,0 +1,299 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_struct.h
+-- #include <macros/reparse/nesting/struct_in_struct.h>
+-- /* test_macrosreparsenestingstruct__Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_2ac02abef90be65b (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_ce4ed8cb010301fc (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_9d78eb12f80bd5a1 (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+myInt :: Raw String
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+myInt = objectLike "MyInt" ["int"]
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1_x
+    = T1_x {t1_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:25@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1_x
+    where readRaw = \ptr_0 -> pure T1_x <*> readRaw (Proxy @"t1_x_x") ptr_0
+instance WriteRaw T1_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1_x t1_x_x_2 -> writeRaw (Proxy @"t1_x_x") ptr_0 t1_x_x_2
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (IsStructViaReadRaw T1_x) instance IsStruct T1_x
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> T1_x{t1_x_x = y_1},
+                              getField @"t1_x_x" x_0)
+instance (~) ty CInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1
+    = T1 {t1_x :: T1_x
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:33@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1
+    where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
+instance WriteRaw T1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (IsStructViaReadRaw T1) instance IsStruct T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2
+    = T2 {t2_x :: (Ptr T2_x)
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:33@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T2
+    where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
+instance WriteRaw T2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (IsStructViaReadRaw T2) instance IsStruct T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2_x
+    = T2_x {t2_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:25@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2_x
+    where readRaw = \ptr_0 -> pure T2_x <*> readRaw (Proxy @"t2_x_x") ptr_0
+instance WriteRaw T2_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2_x t2_x_x_2 -> writeRaw (Proxy @"t2_x_x") ptr_0 t2_x_x_2
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (IsStructViaReadRaw T2_x) instance IsStruct T2_x
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> T2_x{t2_x_x = y_1},
+                              getField @"t2_x_x" x_0)
+instance (~) ty CInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3
+    = T3 {t3_x :: (Ptr (Ptr T3_x))
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:33@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T3
+    where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
+instance WriteRaw T3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (IsStructViaReadRaw T3) instance IsStruct T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3_x
+    = T3_x {t3_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:25@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3_x
+    where readRaw = \ptr_0 -> pure T3_x <*> readRaw (Proxy @"t3_x_x") ptr_0
+instance WriteRaw T3_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3_x t3_x_x_2 -> writeRaw (Proxy @"t3_x_x") ptr_0 t3_x_x_2
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (IsStructViaReadRaw T3_x) instance IsStruct T3_x
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> T3_x{t3_x_x = y_1},
+                              getField @"t3_x_x" x_0)
+instance (~) ty CInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b = fmap fromFFIType hs_bindgen_2ac02abef90be65b_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t1 = unsafePerformIO hs_bindgen_2ac02abef90be65b
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc = fmap fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t2 = unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 = fmap fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t3 = unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/Example.hs
@@ -0,0 +1,474 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1_x = T1_x
+  { t1_x_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:25@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T1_x
+      <*> HasCField.readRaw (BG.Proxy @"t1_x_x") ptr0
+
+instance Marshal.WriteRaw T1_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1_x t1_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x_x") ptr0 t1_x_x2
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via Struct.IsStructViaReadRaw T1_x instance Struct.IsStruct T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:25@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1_x {t1_x_x = y1}, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1 = T1
+  { t1_x :: T1_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:33@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1 where
+
+  readRaw =
+    \ptr0 ->
+          pure T1
+      <*> HasCField.readRaw (BG.Proxy @"t1_x") ptr0
+
+instance Marshal.WriteRaw T1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1 t1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x") ptr0 t1_x2
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via Struct.IsStructViaReadRaw T1 instance Struct.IsStruct T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:33@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1 {t1_x = y1}, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2 = T2
+  { t2_x :: BG.Ptr T2_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:33@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T2 where
+
+  readRaw =
+    \ptr0 ->
+          pure T2
+      <*> HasCField.readRaw (BG.Proxy @"t2_x") ptr0
+
+instance Marshal.WriteRaw T2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2 t2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x") ptr0 t2_x2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via Struct.IsStructViaReadRaw T2 instance Struct.IsStruct T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:33@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2 {t2_x = y1}, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2_x = T2_x
+  { t2_x_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:25@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T2_x
+      <*> HasCField.readRaw (BG.Proxy @"t2_x_x") ptr0
+
+instance Marshal.WriteRaw T2_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2_x t2_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x_x") ptr0 t2_x_x2
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via Struct.IsStructViaReadRaw T2_x instance Struct.IsStruct T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:25@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2_x {t2_x_x = y1}, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3 = T3
+  { t3_x :: BG.Ptr (BG.Ptr T3_x)
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:33@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T3 where
+
+  readRaw =
+    \ptr0 ->
+          pure T3
+      <*> HasCField.readRaw (BG.Proxy @"t3_x") ptr0
+
+instance Marshal.WriteRaw T3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3 t3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x") ptr0 t3_x2
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via Struct.IsStructViaReadRaw T3 instance Struct.IsStruct T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:33@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3 {t3_x = y1}, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3_x = T3_x
+  { t3_x_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:25@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T3_x
+      <*> HasCField.readRaw (BG.Proxy @"t3_x_x") ptr0
+
+instance Marshal.WriteRaw T3_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3_x t3_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x_x") ptr0 t3_x_x2
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via Struct.IsStructViaReadRaw T3_x instance Struct.IsStruct T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:25@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3_x {t3_x_x = y1}, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/struct_in_struct.h>"
+  , "/* test_macrosreparsenestingstruct__Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_2ac02abef90be65b (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_ce4ed8cb010301fc (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_9d78eb12f80bd5a1 (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (BG.Ptr T1)
+hs_bindgen_2ac02abef90be65b =
+  fmap BG.fromFFIType hs_bindgen_2ac02abef90be65b_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_2ac02abef90be65b
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (BG.Ptr T2)
+hs_bindgen_ce4ed8cb010301fc =
+  fmap BG.fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (BG.Ptr T3)
+hs_bindgen_9d78eb12f80bd5a1 =
+  fmap BG.fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/bindingspec.yaml
@@ -0,0 +1,175 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: macro MyInt
+  hsname: MyInt
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T2
+  hsname: T2
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T3
+  hsname: T3
+- headers: macros/reparse/nesting/struct_in_struct.h
+  cname: struct @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1
+  representation:
+    record:
+      constructor: T1
+      fields:
+      - t1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    record:
+      constructor: T1_x
+      fields:
+      - t1_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    record:
+      constructor: T2
+      fields:
+      - t2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    record:
+      constructor: T2_x
+      fields:
+      - t2_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    record:
+      constructor: T3
+      fields:
+      - t3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    record:
+      constructor: T3_x
+      fields:
+      - t3_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_struct/th.txt
@@ -0,0 +1,317 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_struct.h
+-- #include <macros/reparse/nesting/struct_in_struct.h>
+-- /* test_macrosreparsenestingstruct__Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_2ac02abef90be65b (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_ce4ed8cb010301fc (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_9d78eb12f80bd5a1 (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1_x
+    = T1_x {t1_x_x :: MyInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:25@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1_x
+    where readRaw = \ptr_0 -> pure T1_x <*> readRaw (Proxy @"t1_x_x") ptr_0
+instance WriteRaw T1_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1_x t1_x_x_2 -> writeRaw (Proxy @"t1_x_x") ptr_0 t1_x_x_2
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (IsStructViaReadRaw T1_x) instance IsStruct T1_x
+instance (~) ty MyInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> T1_x{t1_x_x = y_1},
+                              getField @"t1_x_x" x_0)
+instance (~) ty MyInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T1
+    = T1 {t1_x :: T1_x
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:33@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1
+    where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
+instance WriteRaw T1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (IsStructViaReadRaw T1) instance IsStruct T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2
+    = T2 {t2_x :: (Ptr T2_x)
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:33@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T2
+    where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
+instance WriteRaw T2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (IsStructViaReadRaw T2) instance IsStruct T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T2_x
+    = T2_x {t2_x_x :: MyInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:25@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2_x
+    where readRaw = \ptr_0 -> pure T2_x <*> readRaw (Proxy @"t2_x_x") ptr_0
+instance WriteRaw T2_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2_x t2_x_x_2 -> writeRaw (Proxy @"t2_x_x") ptr_0 t2_x_x_2
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (IsStructViaReadRaw T2_x) instance IsStruct T2_x
+instance (~) ty MyInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> T2_x{t2_x_x = y_1},
+                              getField @"t2_x_x" x_0)
+instance (~) ty MyInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3
+    = T3 {t3_x :: (Ptr (Ptr T3_x))
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:33@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T3
+    where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
+instance WriteRaw T3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (IsStructViaReadRaw T3) instance IsStruct T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+data T3_x
+    = T3_x {t3_x_x :: MyInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:25@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3_x
+    where readRaw = \ptr_0 -> pure T3_x <*> readRaw (Proxy @"t3_x_x") ptr_0
+instance WriteRaw T3_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3_x t3_x_x_2 -> writeRaw (Proxy @"t3_x_x") ptr_0 t3_x_x_2
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (IsStructViaReadRaw T3_x) instance IsStruct T3_x
+instance (~) ty MyInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> T3_x{t3_x_x = y_1},
+                              getField @"t3_x_x" x_0)
+instance (~) ty MyInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b = fmap fromFFIType hs_bindgen_2ac02abef90be65b_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 3:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t1 = unsafePerformIO hs_bindgen_2ac02abef90be65b
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc = fmap fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 4:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t2 = unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 = fmap fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_struct.h 5:38@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_struct.h@
+-}
+t3 = unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.1.empty/Example.hs
@@ -0,0 +1,305 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T1(..)
+    , Example.T2_Aux(..)
+    , Example.T2(..)
+    , Example.T3_Aux(..)
+    , Example.T3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Show, pure, type (~))
+
+{-| __C declaration:__ @struct T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T1 = T1
+  { t1_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1 where
+
+  readRaw =
+    \ptr0 ->
+          pure T1
+      <*> HasCField.readRaw (BG.Proxy @"t1_x") ptr0
+
+instance Marshal.WriteRaw T1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1 t1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x") ptr0 t1_x2
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via Struct.IsStructViaReadRaw T1 instance Struct.IsStruct T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1 {t1_x = y1}, BG.getField @"t1_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T2_Aux = T2_Aux
+  { t2_Aux_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2_Aux where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure T2_Aux
+      <*> HasCField.readRaw (BG.Proxy @"t2_Aux_x") ptr0
+
+instance Marshal.WriteRaw T2_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2_Aux t2_Aux_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_Aux_x") ptr0 t2_Aux_x2
+
+deriving via Marshal.EquivStorable T2_Aux instance BG.Storable T2_Aux
+
+deriving via Struct.IsStructViaReadRaw T2_Aux instance Struct.IsStruct T2_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_Aux_x" T2_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2_Aux {t2_Aux_x = y1}, BG.getField @"t2_Aux_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "t2_Aux_x" (BG.Ptr T2_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_Aux_x")
+
+instance HasCField.HasCField T2_Aux "t2_Aux_x" where
+
+  type CFieldType T2_Aux "t2_Aux_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.Ptr T2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.Ptr T2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T3_Aux = T3_Aux
+  { t3_Aux_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3_Aux where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure T3_Aux
+      <*> HasCField.readRaw (BG.Proxy @"t3_Aux_x") ptr0
+
+instance Marshal.WriteRaw T3_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3_Aux t3_Aux_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_Aux_x") ptr0 t3_Aux_x2
+
+deriving via Marshal.EquivStorable T3_Aux instance BG.Storable T3_Aux
+
+deriving via Struct.IsStructViaReadRaw T3_Aux instance Struct.IsStruct T3_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_Aux_x" T3_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3_Aux {t3_Aux_x = y1}, BG.getField @"t3_Aux_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "t3_Aux_x" (BG.Ptr T3_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_Aux_x")
+
+instance HasCField.HasCField T3_Aux "t3_Aux_x" where
+
+  type CFieldType T3_Aux "t3_Aux_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.Ptr (BG.Ptr T3_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.CompatHasField.HasField "unwrapT3" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3 {unwrapT3 = y1}, BG.getField @"unwrapT3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.HasField "unwrapT3" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT3")
+
+instance HasCField.HasCField T3 "unwrapT3" where
+
+  type CFieldType T3 "unwrapT3" =
+    BG.Ptr (BG.Ptr T3_Aux)
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.1.empty/bindingspec.yaml
@@ -0,0 +1,127 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: struct T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: struct @T2_Aux
+  hsname: T2_Aux
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: T2
+  hsname: T2
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: struct @T3_Aux
+  hsname: T3_Aux
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: T3
+  hsname: T3
+hstypes:
+- hsname: T1
+  representation:
+    record:
+      constructor: T1
+      fields:
+      - t1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_Aux
+  representation:
+    record:
+      constructor: T2_Aux
+      fields:
+      - t2_Aux_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_Aux
+  representation:
+    record:
+      constructor: T3_Aux
+      fields:
+      - t3_Aux_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.1.empty/th.txt
@@ -0,0 +1,146 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_typedef.h
+{-| __C declaration:__ @struct T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T1
+    = T1 {t1_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:24@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1
+    where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
+instance WriteRaw T1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (IsStructViaReadRaw T1) instance IsStruct T1
+instance (~) ty CInt => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
+                              getField @"t1_x" x_0)
+instance (~) ty CInt => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T2_Aux
+    = T2_Aux {t2_Aux_x :: CInt
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:24@
+
+                   __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2_Aux
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2_Aux
+    where readRaw = \ptr_0 -> pure T2_Aux <*> readRaw (Proxy @"t2_Aux_x") ptr_0
+instance WriteRaw T2_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2_Aux t2_Aux_x_2 -> writeRaw (Proxy @"t2_Aux_x") ptr_0 t2_Aux_x_2
+deriving via (EquivStorable T2_Aux) instance Storable T2_Aux
+deriving via (IsStructViaReadRaw T2_Aux) instance IsStruct T2_Aux
+instance (~) ty CInt => HasField "t2_Aux_x" T2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T2_Aux{t2_Aux_x = y_1},
+                              getField @"t2_Aux_x" x_0)
+instance (~) ty CInt => HasField "t2_Aux_x" (Ptr T2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_Aux_x")
+instance HasCField T2_Aux "t2_Aux_x"
+    where type CFieldType T2_Aux "t2_Aux_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: (Ptr T2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr T2_Aux) => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty (Ptr T2_Aux) =>
+         HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = Ptr T2_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T3_Aux
+    = T3_Aux {t3_Aux_x :: CInt
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:24@
+
+                   __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3_Aux
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3_Aux
+    where readRaw = \ptr_0 -> pure T3_Aux <*> readRaw (Proxy @"t3_Aux_x") ptr_0
+instance WriteRaw T3_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3_Aux t3_Aux_x_2 -> writeRaw (Proxy @"t3_Aux_x") ptr_0 t3_Aux_x_2
+deriving via (EquivStorable T3_Aux) instance Storable T3_Aux
+deriving via (IsStructViaReadRaw T3_Aux) instance IsStruct T3_Aux
+instance (~) ty CInt => HasField "t3_Aux_x" T3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T3_Aux{t3_Aux_x = y_1},
+                              getField @"t3_Aux_x" x_0)
+instance (~) ty CInt => HasField "t3_Aux_x" (Ptr T3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_Aux_x")
+instance HasCField T3_Aux "t3_Aux_x"
+    where type CFieldType T3_Aux "t3_Aux_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T3
+    = T3 {unwrapT3 :: (Ptr (Ptr T3_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr T3_Aux)) => HasField "unwrapT3" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{unwrapT3 = y_1},
+                              getField @"unwrapT3" x_0)
+instance (~) ty (Ptr (Ptr T3_Aux)) =>
+         HasField "unwrapT3" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT3")
+instance HasCField T3 "unwrapT3"
+    where type CFieldType T3 "unwrapT3" = Ptr (Ptr T3_Aux)
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.2.raw/Example.hs
@@ -0,0 +1,316 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.myInt
+    , Example.T1(..)
+    , Example.T2_Aux(..)
+    , Example.T2(..)
+    , Example.T3_Aux(..)
+    , Example.T3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+myInt :: Macro.Raw String
+myInt = Macro.objectLike "MyInt" ["int"]
+
+{-| __C declaration:__ @struct T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T1 = T1
+  { t1_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1 where
+
+  readRaw =
+    \ptr0 ->
+          pure T1
+      <*> HasCField.readRaw (BG.Proxy @"t1_x") ptr0
+
+instance Marshal.WriteRaw T1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1 t1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x") ptr0 t1_x2
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via Struct.IsStructViaReadRaw T1 instance Struct.IsStruct T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1 {t1_x = y1}, BG.getField @"t1_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T2_Aux = T2_Aux
+  { t2_Aux_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2_Aux where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure T2_Aux
+      <*> HasCField.readRaw (BG.Proxy @"t2_Aux_x") ptr0
+
+instance Marshal.WriteRaw T2_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2_Aux t2_Aux_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_Aux_x") ptr0 t2_Aux_x2
+
+deriving via Marshal.EquivStorable T2_Aux instance BG.Storable T2_Aux
+
+deriving via Struct.IsStructViaReadRaw T2_Aux instance Struct.IsStruct T2_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_Aux_x" T2_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2_Aux {t2_Aux_x = y1}, BG.getField @"t2_Aux_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "t2_Aux_x" (BG.Ptr T2_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_Aux_x")
+
+instance HasCField.HasCField T2_Aux "t2_Aux_x" where
+
+  type CFieldType T2_Aux "t2_Aux_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.Ptr T2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.Ptr T2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T3_Aux = T3_Aux
+  { t3_Aux_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3_Aux where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure T3_Aux
+      <*> HasCField.readRaw (BG.Proxy @"t3_Aux_x") ptr0
+
+instance Marshal.WriteRaw T3_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3_Aux t3_Aux_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_Aux_x") ptr0 t3_Aux_x2
+
+deriving via Marshal.EquivStorable T3_Aux instance BG.Storable T3_Aux
+
+deriving via Struct.IsStructViaReadRaw T3_Aux instance Struct.IsStruct T3_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_Aux_x" T3_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3_Aux {t3_Aux_x = y1}, BG.getField @"t3_Aux_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "t3_Aux_x" (BG.Ptr T3_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_Aux_x")
+
+instance HasCField.HasCField T3_Aux "t3_Aux_x" where
+
+  type CFieldType T3_Aux "t3_Aux_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.Ptr (BG.Ptr T3_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.CompatHasField.HasField "unwrapT3" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3 {unwrapT3 = y1}, BG.getField @"unwrapT3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.HasField "unwrapT3" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT3")
+
+instance HasCField.HasCField T3 "unwrapT3" where
+
+  type CFieldType T3 "unwrapT3" =
+    BG.Ptr (BG.Ptr T3_Aux)
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.2.raw/bindingspec.yaml
@@ -0,0 +1,127 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: struct T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: struct @T2_Aux
+  hsname: T2_Aux
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: T2
+  hsname: T2
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: struct @T3_Aux
+  hsname: T3_Aux
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: T3
+  hsname: T3
+hstypes:
+- hsname: T1
+  representation:
+    record:
+      constructor: T1
+      fields:
+      - t1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_Aux
+  representation:
+    record:
+      constructor: T2_Aux
+      fields:
+      - t2_Aux_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_Aux
+  representation:
+    record:
+      constructor: T3_Aux
+      fields:
+      - t3_Aux_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef.2.raw/th.txt
@@ -0,0 +1,160 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_typedef.h
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+myInt :: Raw String
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+myInt = objectLike "MyInt" ["int"]
+{-| __C declaration:__ @struct T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T1
+    = T1 {t1_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:24@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1
+    where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
+instance WriteRaw T1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (IsStructViaReadRaw T1) instance IsStruct T1
+instance (~) ty CInt => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
+                              getField @"t1_x" x_0)
+instance (~) ty CInt => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T2_Aux
+    = T2_Aux {t2_Aux_x :: CInt
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:24@
+
+                   __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2_Aux
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2_Aux
+    where readRaw = \ptr_0 -> pure T2_Aux <*> readRaw (Proxy @"t2_Aux_x") ptr_0
+instance WriteRaw T2_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2_Aux t2_Aux_x_2 -> writeRaw (Proxy @"t2_Aux_x") ptr_0 t2_Aux_x_2
+deriving via (EquivStorable T2_Aux) instance Storable T2_Aux
+deriving via (IsStructViaReadRaw T2_Aux) instance IsStruct T2_Aux
+instance (~) ty CInt => HasField "t2_Aux_x" T2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T2_Aux{t2_Aux_x = y_1},
+                              getField @"t2_Aux_x" x_0)
+instance (~) ty CInt => HasField "t2_Aux_x" (Ptr T2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_Aux_x")
+instance HasCField T2_Aux "t2_Aux_x"
+    where type CFieldType T2_Aux "t2_Aux_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: (Ptr T2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr T2_Aux) => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty (Ptr T2_Aux) =>
+         HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = Ptr T2_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T3_Aux
+    = T3_Aux {t3_Aux_x :: CInt
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:24@
+
+                   __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3_Aux
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3_Aux
+    where readRaw = \ptr_0 -> pure T3_Aux <*> readRaw (Proxy @"t3_Aux_x") ptr_0
+instance WriteRaw T3_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3_Aux t3_Aux_x_2 -> writeRaw (Proxy @"t3_Aux_x") ptr_0 t3_Aux_x_2
+deriving via (EquivStorable T3_Aux) instance Storable T3_Aux
+deriving via (IsStructViaReadRaw T3_Aux) instance IsStruct T3_Aux
+instance (~) ty CInt => HasField "t3_Aux_x" T3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T3_Aux{t3_Aux_x = y_1},
+                              getField @"t3_Aux_x" x_0)
+instance (~) ty CInt => HasField "t3_Aux_x" (Ptr T3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_Aux_x")
+instance HasCField T3_Aux "t3_Aux_x"
+    where type CFieldType T3_Aux "t3_Aux_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T3
+    = T3 {unwrapT3 :: (Ptr (Ptr T3_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr T3_Aux)) => HasField "unwrapT3" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{unwrapT3 = y_1},
+                              getField @"unwrapT3" x_0)
+instance (~) ty (Ptr (Ptr T3_Aux)) =>
+         HasField "unwrapT3" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT3")
+instance HasCField T3 "unwrapT3"
+    where type CFieldType T3 "unwrapT3" = Ptr (Ptr T3_Aux)
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef/Example.hs
@@ -0,0 +1,355 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.T1(..)
+    , Example.T2_Aux(..)
+    , Example.T2(..)
+    , Example.T3_Aux(..)
+    , Example.T3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T1 = T1
+  { t1_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1 where
+
+  readRaw =
+    \ptr0 ->
+          pure T1
+      <*> HasCField.readRaw (BG.Proxy @"t1_x") ptr0
+
+instance Marshal.WriteRaw T1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1 t1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x") ptr0 t1_x2
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via Struct.IsStructViaReadRaw T1 instance Struct.IsStruct T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1 {t1_x = y1}, BG.getField @"t1_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T2_Aux = T2_Aux
+  { t2_Aux_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2_Aux where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure T2_Aux
+      <*> HasCField.readRaw (BG.Proxy @"t2_Aux_x") ptr0
+
+instance Marshal.WriteRaw T2_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2_Aux t2_Aux_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_Aux_x") ptr0 t2_Aux_x2
+
+deriving via Marshal.EquivStorable T2_Aux instance BG.Storable T2_Aux
+
+deriving via Struct.IsStructViaReadRaw T2_Aux instance Struct.IsStruct T2_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t2_Aux_x" T2_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2_Aux {t2_Aux_x = y1}, BG.getField @"t2_Aux_x" x0)
+
+instance ( ty ~ MyInt
+         ) => BG.HasField "t2_Aux_x" (BG.Ptr T2_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_Aux_x")
+
+instance HasCField.HasCField T2_Aux "t2_Aux_x" where
+
+  type CFieldType T2_Aux "t2_Aux_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.Ptr T2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.Ptr T2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T3_Aux = T3_Aux
+  { t3_Aux_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3_Aux where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure T3_Aux
+      <*> HasCField.readRaw (BG.Proxy @"t3_Aux_x") ptr0
+
+instance Marshal.WriteRaw T3_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3_Aux t3_Aux_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_Aux_x") ptr0 t3_Aux_x2
+
+deriving via Marshal.EquivStorable T3_Aux instance BG.Storable T3_Aux
+
+deriving via Struct.IsStructViaReadRaw T3_Aux instance Struct.IsStruct T3_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t3_Aux_x" T3_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3_Aux {t3_Aux_x = y1}, BG.getField @"t3_Aux_x" x0)
+
+instance ( ty ~ MyInt
+         ) => BG.HasField "t3_Aux_x" (BG.Ptr T3_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_Aux_x")
+
+instance HasCField.HasCField T3_Aux "t3_Aux_x" where
+
+  type CFieldType T3_Aux "t3_Aux_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.Ptr (BG.Ptr T3_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.CompatHasField.HasField "unwrapT3" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3 {unwrapT3 = y1}, BG.getField @"unwrapT3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.HasField "unwrapT3" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT3")
+
+instance HasCField.HasCField T3 "unwrapT3" where
+
+  type CFieldType T3 "unwrapT3" =
+    BG.Ptr (BG.Ptr T3_Aux)
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef/bindingspec.yaml
@@ -0,0 +1,164 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: macro MyInt
+  hsname: MyInt
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: struct T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: struct @T2_Aux
+  hsname: T2_Aux
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: T2
+  hsname: T2
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: struct @T3_Aux
+  hsname: T3_Aux
+- headers: macros/reparse/nesting/struct_in_typedef.h
+  cname: T3
+  hsname: T3
+hstypes:
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1
+  representation:
+    record:
+      constructor: T1
+      fields:
+      - t1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_Aux
+  representation:
+    record:
+      constructor: T2_Aux
+      fields:
+      - t2_Aux_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_Aux
+  representation:
+    record:
+      constructor: T3_Aux
+      fields:
+      - t3_Aux_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_typedef/th.txt
@@ -0,0 +1,178 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_typedef.h
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T1
+    = T1 {t1_x :: MyInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 3:24@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1
+    where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
+instance WriteRaw T1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (IsStructViaReadRaw T1) instance IsStruct T1
+instance (~) ty MyInt => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
+                              getField @"t1_x" x_0)
+instance (~) ty MyInt => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T2_Aux
+    = T2_Aux {t2_Aux_x :: MyInt
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:24@
+
+                   __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2_Aux
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2_Aux
+    where readRaw = \ptr_0 -> pure T2_Aux <*> readRaw (Proxy @"t2_Aux_x") ptr_0
+instance WriteRaw T2_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2_Aux t2_Aux_x_2 -> writeRaw (Proxy @"t2_Aux_x") ptr_0 t2_Aux_x_2
+deriving via (EquivStorable T2_Aux) instance Storable T2_Aux
+deriving via (IsStructViaReadRaw T2_Aux) instance IsStruct T2_Aux
+instance (~) ty MyInt => HasField "t2_Aux_x" T2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T2_Aux{t2_Aux_x = y_1},
+                              getField @"t2_Aux_x" x_0)
+instance (~) ty MyInt => HasField "t2_Aux_x" (Ptr T2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_Aux_x")
+instance HasCField T2_Aux "t2_Aux_x"
+    where type CFieldType T2_Aux "t2_Aux_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: (Ptr T2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr T2_Aux) => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty (Ptr T2_Aux) =>
+         HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = Ptr T2_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+data T3_Aux
+    = T3_Aux {t3_Aux_x :: MyInt
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:24@
+
+                   __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3_Aux
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3_Aux
+    where readRaw = \ptr_0 -> pure T3_Aux <*> readRaw (Proxy @"t3_Aux_x") ptr_0
+instance WriteRaw T3_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3_Aux t3_Aux_x_2 -> writeRaw (Proxy @"t3_Aux_x") ptr_0 t3_Aux_x_2
+deriving via (EquivStorable T3_Aux) instance Storable T3_Aux
+deriving via (IsStructViaReadRaw T3_Aux) instance IsStruct T3_Aux
+instance (~) ty MyInt => HasField "t3_Aux_x" T3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T3_Aux{t3_Aux_x = y_1},
+                              getField @"t3_Aux_x" x_0)
+instance (~) ty MyInt => HasField "t3_Aux_x" (Ptr T3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_Aux_x")
+instance HasCField T3_Aux "t3_Aux_x"
+    where type CFieldType T3_Aux "t3_Aux_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_typedef.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_typedef.h@
+-}
+newtype T3
+    = T3 {unwrapT3 :: (Ptr (Ptr T3_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr T3_Aux)) => HasField "unwrapT3" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{unwrapT3 = y_1},
+                              getField @"unwrapT3" x_0)
+instance (~) ty (Ptr (Ptr T3_Aux)) =>
+         HasField "unwrapT3" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT3")
+instance HasCField T3 "unwrapT3"
+    where type CFieldType T3 "unwrapT3" = Ptr (Ptr T3_Aux)
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/Example.hs
@@ -0,0 +1,391 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T1_x = T1_x
+  { t1_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T1_x
+      <*> HasCField.readRaw (BG.Proxy @"t1_x_x") ptr0
+
+instance Marshal.WriteRaw T1_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1_x t1_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x_x") ptr0 t1_x_x2
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via Struct.IsStructViaReadRaw T1_x instance Struct.IsStruct T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1_x {t1_x_x = y1}, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.HasField "t1_x" T1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" T2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T2_x = T2_x
+  { t2_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T2_x
+      <*> HasCField.readRaw (BG.Proxy @"t2_x_x") ptr0
+
+instance Marshal.WriteRaw T2_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2_x t2_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x_x") ptr0 t2_x_x2
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via Struct.IsStructViaReadRaw T2_x instance Struct.IsStruct T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2_x {t2_x_x = y1}, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T3
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.Ptr (BG.Ptr T3_x)) => BG.HasField "t3_x" T3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T3_x = T3_x
+  { t3_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T3_x
+      <*> HasCField.readRaw (BG.Proxy @"t3_x_x") ptr0
+
+instance Marshal.WriteRaw T3_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3_x t3_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x_x") ptr0 t3_x_x2
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via Struct.IsStructViaReadRaw T3_x instance Struct.IsStruct T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3_x {t3_x_x = y1}, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/struct_in_union.h>"
+  , "/* test_macrosreparsenestingstruct__Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_2ac02abef90be65b (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_ce4ed8cb010301fc (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_9d78eb12f80bd5a1 (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (BG.Ptr T1)
+hs_bindgen_2ac02abef90be65b =
+  fmap BG.fromFFIType hs_bindgen_2ac02abef90be65b_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_2ac02abef90be65b
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (BG.Ptr T2)
+hs_bindgen_ce4ed8cb010301fc =
+  fmap BG.fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (BG.Ptr T3)
+hs_bindgen_9d78eb12f80bd5a1 =
+  fmap BG.fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/bindingspec.yaml
@@ -0,0 +1,132 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: union @T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: struct @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: union @T2
+  hsname: T2
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: struct @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: union @T3
+  hsname: T3
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: struct @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    record:
+      constructor: T1_x
+      fields:
+      - t1_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    record:
+      constructor: T2_x
+      fields:
+      - t2_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    record:
+      constructor: T3_x
+      fields:
+      - t3_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.1.empty/th.txt
@@ -0,0 +1,252 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_union.h
+-- #include <macros/reparse/nesting/struct_in_union.h>
+-- /* test_macrosreparsenestingstruct__Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_2ac02abef90be65b (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_ce4ed8cb010301fc (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_9d78eb12f80bd5a1 (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T1_x
+    = T1_x {t1_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:24@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1_x
+    where readRaw = \ptr_0 -> pure T1_x <*> readRaw (Proxy @"t1_x_x") ptr_0
+instance WriteRaw T1_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1_x t1_x_x_2 -> writeRaw (Proxy @"t1_x_x") ptr_0 t1_x_x_2
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (IsStructViaReadRaw T1_x) instance IsStruct T1_x
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> T1_x{t1_x_x = y_1},
+                              getField @"t1_x_x" x_0)
+instance (~) ty CInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T1 = T1 {unwrapT1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1
+deriving via (SizedByteArray 4 4) instance ReadRaw T1
+deriving via (SizedByteArray 4 4) instance WriteRaw T1
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (SizedByteArray 4 4) instance IsUnion T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where getField = getUnionPayload
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T2 = T2 {unwrapT2 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T2
+deriving via (SizedByteArray 8 8) instance ReadRaw T2
+deriving via (SizedByteArray 8 8) instance WriteRaw T2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (SizedByteArray 8 8) instance IsUnion T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T2_x
+    = T2_x {t2_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:24@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2_x
+    where readRaw = \ptr_0 -> pure T2_x <*> readRaw (Proxy @"t2_x_x") ptr_0
+instance WriteRaw T2_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2_x t2_x_x_2 -> writeRaw (Proxy @"t2_x_x") ptr_0 t2_x_x_2
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (IsStructViaReadRaw T2_x) instance IsStruct T2_x
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> T2_x{t2_x_x = y_1},
+                              getField @"t2_x_x" x_0)
+instance (~) ty CInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T3 = T3 {unwrapT3 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T3
+deriving via (SizedByteArray 8 8) instance ReadRaw T3
+deriving via (SizedByteArray 8 8) instance WriteRaw T3
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (SizedByteArray 8 8) instance IsUnion T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T3_x
+    = T3_x {t3_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:24@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3_x
+    where readRaw = \ptr_0 -> pure T3_x <*> readRaw (Proxy @"t3_x_x") ptr_0
+instance WriteRaw T3_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3_x t3_x_x_2 -> writeRaw (Proxy @"t3_x_x") ptr_0 t3_x_x_2
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (IsStructViaReadRaw T3_x) instance IsStruct T3_x
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> T3_x{t3_x_x = y_1},
+                              getField @"t3_x_x" x_0)
+instance (~) ty CInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b = fmap fromFFIType hs_bindgen_2ac02abef90be65b_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t1 = unsafePerformIO hs_bindgen_2ac02abef90be65b
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc = fmap fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t2 = unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 = fmap fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t3 = unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/Example.hs
@@ -0,0 +1,402 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.myInt
+    , Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+myInt :: Macro.Raw String
+myInt = Macro.objectLike "MyInt" ["int"]
+
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T1_x = T1_x
+  { t1_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T1_x
+      <*> HasCField.readRaw (BG.Proxy @"t1_x_x") ptr0
+
+instance Marshal.WriteRaw T1_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1_x t1_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x_x") ptr0 t1_x_x2
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via Struct.IsStructViaReadRaw T1_x instance Struct.IsStruct T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1_x {t1_x_x = y1}, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.HasField "t1_x" T1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" T2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T2_x = T2_x
+  { t2_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T2_x
+      <*> HasCField.readRaw (BG.Proxy @"t2_x_x") ptr0
+
+instance Marshal.WriteRaw T2_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2_x t2_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x_x") ptr0 t2_x_x2
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via Struct.IsStructViaReadRaw T2_x instance Struct.IsStruct T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2_x {t2_x_x = y1}, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T3
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.Ptr (BG.Ptr T3_x)) => BG.HasField "t3_x" T3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T3_x = T3_x
+  { t3_x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T3_x
+      <*> HasCField.readRaw (BG.Proxy @"t3_x_x") ptr0
+
+instance Marshal.WriteRaw T3_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3_x t3_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x_x") ptr0 t3_x_x2
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via Struct.IsStructViaReadRaw T3_x instance Struct.IsStruct T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3_x {t3_x_x = y1}, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/struct_in_union.h>"
+  , "/* test_macrosreparsenestingstruct__Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_2ac02abef90be65b (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_ce4ed8cb010301fc (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_9d78eb12f80bd5a1 (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (BG.Ptr T1)
+hs_bindgen_2ac02abef90be65b =
+  fmap BG.fromFFIType hs_bindgen_2ac02abef90be65b_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_2ac02abef90be65b
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (BG.Ptr T2)
+hs_bindgen_ce4ed8cb010301fc =
+  fmap BG.fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (BG.Ptr T3)
+hs_bindgen_9d78eb12f80bd5a1 =
+  fmap BG.fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/bindingspec.yaml
@@ -0,0 +1,132 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: union @T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: struct @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: union @T2
+  hsname: T2
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: struct @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: union @T3
+  hsname: T3
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: struct @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    record:
+      constructor: T1_x
+      fields:
+      - t1_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    record:
+      constructor: T2_x
+      fields:
+      - t2_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    record:
+      constructor: T3_x
+      fields:
+      - t3_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union.2.raw/th.txt
@@ -0,0 +1,266 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_union.h
+-- #include <macros/reparse/nesting/struct_in_union.h>
+-- /* test_macrosreparsenestingstruct__Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_2ac02abef90be65b (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_ce4ed8cb010301fc (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_9d78eb12f80bd5a1 (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+myInt :: Raw String
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+myInt = objectLike "MyInt" ["int"]
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T1_x
+    = T1_x {t1_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:24@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1_x
+    where readRaw = \ptr_0 -> pure T1_x <*> readRaw (Proxy @"t1_x_x") ptr_0
+instance WriteRaw T1_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1_x t1_x_x_2 -> writeRaw (Proxy @"t1_x_x") ptr_0 t1_x_x_2
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (IsStructViaReadRaw T1_x) instance IsStruct T1_x
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> T1_x{t1_x_x = y_1},
+                              getField @"t1_x_x" x_0)
+instance (~) ty CInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T1 = T1 {unwrapT1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1
+deriving via (SizedByteArray 4 4) instance ReadRaw T1
+deriving via (SizedByteArray 4 4) instance WriteRaw T1
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (SizedByteArray 4 4) instance IsUnion T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where getField = getUnionPayload
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T2 = T2 {unwrapT2 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T2
+deriving via (SizedByteArray 8 8) instance ReadRaw T2
+deriving via (SizedByteArray 8 8) instance WriteRaw T2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (SizedByteArray 8 8) instance IsUnion T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T2_x
+    = T2_x {t2_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:24@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2_x
+    where readRaw = \ptr_0 -> pure T2_x <*> readRaw (Proxy @"t2_x_x") ptr_0
+instance WriteRaw T2_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2_x t2_x_x_2 -> writeRaw (Proxy @"t2_x_x") ptr_0 t2_x_x_2
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (IsStructViaReadRaw T2_x) instance IsStruct T2_x
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> T2_x{t2_x_x = y_1},
+                              getField @"t2_x_x" x_0)
+instance (~) ty CInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T3 = T3 {unwrapT3 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T3
+deriving via (SizedByteArray 8 8) instance ReadRaw T3
+deriving via (SizedByteArray 8 8) instance WriteRaw T3
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (SizedByteArray 8 8) instance IsUnion T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T3_x
+    = T3_x {t3_x_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:24@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3_x
+    where readRaw = \ptr_0 -> pure T3_x <*> readRaw (Proxy @"t3_x_x") ptr_0
+instance WriteRaw T3_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3_x t3_x_x_2 -> writeRaw (Proxy @"t3_x_x") ptr_0 t3_x_x_2
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (IsStructViaReadRaw T3_x) instance IsStruct T3_x
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> T3_x{t3_x_x = y_1},
+                              getField @"t3_x_x" x_0)
+instance (~) ty CInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b = fmap fromFFIType hs_bindgen_2ac02abef90be65b_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t1 = unsafePerformIO hs_bindgen_2ac02abef90be65b
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc = fmap fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t2 = unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 = fmap fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t3 = unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/Example.hs
@@ -0,0 +1,442 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T1_x = T1_x
+  { t1_x_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T1_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T1_x
+      <*> HasCField.readRaw (BG.Proxy @"t1_x_x") ptr0
+
+instance Marshal.WriteRaw T1_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1_x t1_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x_x") ptr0 t1_x_x2
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via Struct.IsStructViaReadRaw T1_x instance Struct.IsStruct T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1_x {t1_x_x = y1}, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.HasField "t1_x" T1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" T2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T2_x = T2_x
+  { t2_x_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T2_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T2_x
+      <*> HasCField.readRaw (BG.Proxy @"t2_x_x") ptr0
+
+instance Marshal.WriteRaw T2_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2_x t2_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x_x") ptr0 t2_x_x2
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via Struct.IsStructViaReadRaw T2_x instance Struct.IsStruct T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2_x {t2_x_x = y1}, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T3
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ BG.Ptr (BG.Ptr T3_x)) => BG.HasField "t3_x" T3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T3_x = T3_x
+  { t3_x_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:24@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T3_x where
+
+  readRaw =
+    \ptr0 ->
+          pure T3_x
+      <*> HasCField.readRaw (BG.Proxy @"t3_x_x") ptr0
+
+instance Marshal.WriteRaw T3_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3_x t3_x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x_x") ptr0 t3_x_x2
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via Struct.IsStructViaReadRaw T3_x instance Struct.IsStruct T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3_x {t3_x_x = y1}, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/struct_in_union.h>"
+  , "/* test_macrosreparsenestingstruct__Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_2ac02abef90be65b (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_ce4ed8cb010301fc (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_9d78eb12f80bd5a1 (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (BG.Ptr T1)
+hs_bindgen_2ac02abef90be65b =
+  fmap BG.fromFFIType hs_bindgen_2ac02abef90be65b_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_2ac02abef90be65b
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (BG.Ptr T2)
+hs_bindgen_ce4ed8cb010301fc =
+  fmap BG.fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (BG.Ptr T3)
+hs_bindgen_9d78eb12f80bd5a1 =
+  fmap BG.fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/bindingspec.yaml
@@ -0,0 +1,169 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: macro MyInt
+  hsname: MyInt
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: union @T1
+  hsname: T1
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: struct @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: union @T2
+  hsname: T2
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: struct @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: union @T3
+  hsname: T3
+- headers: macros/reparse/nesting/struct_in_union.h
+  cname: struct @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    record:
+      constructor: T1_x
+      fields:
+      - t1_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    record:
+      constructor: T2_x
+      fields:
+      - t2_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    record:
+      constructor: T3_x
+      fields:
+      - t3_x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_union/th.txt
@@ -0,0 +1,284 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_union.h
+-- #include <macros/reparse/nesting/struct_in_union.h>
+-- /* test_macrosreparsenestingstruct__Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_2ac02abef90be65b (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_ce4ed8cb010301fc (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_9d78eb12f80bd5a1 (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T1_x
+    = T1_x {t1_x_x :: MyInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:24@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T1_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1_x
+    where readRaw = \ptr_0 -> pure T1_x <*> readRaw (Proxy @"t1_x_x") ptr_0
+instance WriteRaw T1_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1_x t1_x_x_2 -> writeRaw (Proxy @"t1_x_x") ptr_0 t1_x_x_2
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (IsStructViaReadRaw T1_x) instance IsStruct T1_x
+instance (~) ty MyInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> T1_x{t1_x_x = y_1},
+                              getField @"t1_x_x" x_0)
+instance (~) ty MyInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T1 = T1 {unwrapT1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1
+deriving via (SizedByteArray 4 4) instance ReadRaw T1
+deriving via (SizedByteArray 4 4) instance WriteRaw T1
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (SizedByteArray 4 4) instance IsUnion T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where getField = getUnionPayload
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T2 = T2 {unwrapT2 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T2
+deriving via (SizedByteArray 8 8) instance ReadRaw T2
+deriving via (SizedByteArray 8 8) instance WriteRaw T2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (SizedByteArray 8 8) instance IsUnion T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T2_x
+    = T2_x {t2_x_x :: MyInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:24@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2_x
+    where readRaw = \ptr_0 -> pure T2_x <*> readRaw (Proxy @"t2_x_x") ptr_0
+instance WriteRaw T2_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2_x t2_x_x_2 -> writeRaw (Proxy @"t2_x_x") ptr_0 t2_x_x_2
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (IsStructViaReadRaw T2_x) instance IsStruct T2_x
+instance (~) ty MyInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> T2_x{t2_x_x = y_1},
+                              getField @"t2_x_x" x_0)
+instance (~) ty MyInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+newtype T3 = T3 {unwrapT3 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T3
+deriving via (SizedByteArray 8 8) instance ReadRaw T3
+deriving via (SizedByteArray 8 8) instance WriteRaw T3
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (SizedByteArray 8 8) instance IsUnion T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+data T3_x
+    = T3_x {t3_x_x :: MyInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:24@
+
+                 __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3_x
+    where readRaw = \ptr_0 -> pure T3_x <*> readRaw (Proxy @"t3_x_x") ptr_0
+instance WriteRaw T3_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3_x t3_x_x_2 -> writeRaw (Proxy @"t3_x_x") ptr_0 t3_x_x_2
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (IsStructViaReadRaw T3_x) instance IsStruct T3_x
+instance (~) ty MyInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> T3_x{t3_x_x = y_1},
+                              getField @"t3_x_x" x_0)
+instance (~) ty MyInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_2ac02abef90be65b" hs_bindgen_2ac02abef90be65b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T1@
+hs_bindgen_2ac02abef90be65b = fmap fromFFIType hs_bindgen_2ac02abef90be65b_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t1 = unsafePerformIO hs_bindgen_2ac02abef90be65b
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_ce4ed8cb010301fc" hs_bindgen_ce4ed8cb010301fc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T2@
+hs_bindgen_ce4ed8cb010301fc = fmap fromFFIType hs_bindgen_ce4ed8cb010301fc_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t2 = unsafePerformIO hs_bindgen_ce4ed8cb010301fc
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_9d78eb12f80bd5a1" hs_bindgen_9d78eb12f80bd5a1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_T3@
+hs_bindgen_9d78eb12f80bd5a1 = fmap fromFFIType hs_bindgen_9d78eb12f80bd5a1_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_union.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_union.h@
+-}
+t3 = unsafePerformIO hs_bindgen_9d78eb12f80bd5a1
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/Example.hs
@@ -0,0 +1,223 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.G1(..)
+    , Example.G2(..)
+    , Example.G3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G1 = G1
+  { g1_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:16@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw G1 where
+
+  readRaw =
+    \ptr0 ->
+          pure G1
+      <*> HasCField.readRaw (BG.Proxy @"g1_x") ptr0
+
+instance Marshal.WriteRaw G1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G1 g1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"g1_x") ptr0 g1_x2
+
+deriving via Marshal.EquivStorable G1 instance BG.Storable G1
+
+deriving via Struct.IsStructViaReadRaw G1 instance Struct.IsStruct G1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:16@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g1_x" G1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> G1 {g1_x = y1}, BG.getField @"g1_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g1_x" (BG.Ptr G1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g1_x")
+
+instance HasCField.HasCField G1 "g1_x" where
+
+  type CFieldType G1 "g1_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G2 = G2
+  { g2_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:16@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw G2 where
+
+  readRaw =
+    \ptr0 ->
+          pure G2
+      <*> HasCField.readRaw (BG.Proxy @"g2_x") ptr0
+
+instance Marshal.WriteRaw G2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G2 g2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"g2_x") ptr0 g2_x2
+
+deriving via Marshal.EquivStorable G2 instance BG.Storable G2
+
+deriving via Struct.IsStructViaReadRaw G2 instance Struct.IsStruct G2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:16@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g2_x" G2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> G2 {g2_x = y1}, BG.getField @"g2_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g2_x" (BG.Ptr G2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g2_x")
+
+instance HasCField.HasCField G2 "g2_x" where
+
+  type CFieldType G2 "g2_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G3 = G3
+  { g3_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:16@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G3 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw G3 where
+
+  readRaw =
+    \ptr0 ->
+          pure G3
+      <*> HasCField.readRaw (BG.Proxy @"g3_x") ptr0
+
+instance Marshal.WriteRaw G3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G3 g3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"g3_x") ptr0 g3_x2
+
+deriving via Marshal.EquivStorable G3 instance BG.Storable G3
+
+deriving via Struct.IsStructViaReadRaw G3 instance Struct.IsStruct G3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:16@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g3_x" G3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> G3 {g3_x = y1}, BG.getField @"g3_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g3_x" (BG.Ptr G3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g3_x")
+
+instance HasCField.HasCField G3 "g3_x" where
+
+  type CFieldType G3 "g3_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.g1
+    , Example.Global.g2
+    , Example.Global.g3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/struct_in_variable.h>"
+  , "/* test_macrosreparsenestingstruct__Example_get_G1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_7b488cf23d974403 (void)"
+  , "{"
+  , "  return &G1;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_G2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_be835215a4ac0819 (void)"
+  , "{"
+  , "  return &G2;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_G3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_dad785bf89d140bb (void)"
+  , "{"
+  , "  return &G3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_7b488cf23d974403" hs_bindgen_7b488cf23d974403_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+hs_bindgen_7b488cf23d974403 :: IO (BG.Ptr G1)
+hs_bindgen_7b488cf23d974403 =
+  fmap BG.fromFFIType hs_bindgen_7b488cf23d974403_base
+
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g1 :: BG.Ptr G1
+g1 = BG.unsafePerformIO hs_bindgen_7b488cf23d974403
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_be835215a4ac0819" hs_bindgen_be835215a4ac0819_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+hs_bindgen_be835215a4ac0819 :: IO (BG.Ptr (BG.Ptr G2))
+hs_bindgen_be835215a4ac0819 =
+  fmap BG.fromFFIType hs_bindgen_be835215a4ac0819_base
+
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g2 :: BG.Ptr (BG.Ptr G2)
+g2 = BG.unsafePerformIO hs_bindgen_be835215a4ac0819
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_dad785bf89d140bb" hs_bindgen_dad785bf89d140bb_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+hs_bindgen_dad785bf89d140bb :: IO (BG.Ptr (BG.Ptr (BG.Ptr G3)))
+hs_bindgen_dad785bf89d140bb =
+  fmap BG.fromFFIType hs_bindgen_dad785bf89d140bb_base
+
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g3 :: BG.Ptr (BG.Ptr (BG.Ptr G3))
+g3 = BG.unsafePerformIO hs_bindgen_dad785bf89d140bb
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/bindingspec.yaml
@@ -0,0 +1,72 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: struct @G1
+  hsname: G1
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: struct @G2
+  hsname: G2
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: struct @G3
+  hsname: G3
+hstypes:
+- hsname: G1
+  representation:
+    record:
+      constructor: G1
+      fields:
+      - g1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G2
+  representation:
+    record:
+      constructor: G2
+      fields:
+      - g2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G3
+  representation:
+    record:
+      constructor: G3
+      fields:
+      - g3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.1.empty/th.txt
@@ -0,0 +1,185 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_variable.h
+-- #include <macros/reparse/nesting/struct_in_variable.h>
+-- /* test_macrosreparsenestingstruct__Example_get_G1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_7b488cf23d974403 (void)
+-- {
+--   return &G1;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_G2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_be835215a4ac0819 (void)
+-- {
+--   return &G2;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_G3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_dad785bf89d140bb (void)
+-- {
+--   return &G3;
+-- }
+{-| __C declaration:__ @struct \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G1
+    = G1 {g1_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:16@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize G1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw G1
+    where readRaw = \ptr_0 -> pure G1 <*> readRaw (Proxy @"g1_x") ptr_0
+instance WriteRaw G1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G1 g1_x_2 -> writeRaw (Proxy @"g1_x") ptr_0 g1_x_2
+deriving via (EquivStorable G1) instance Storable G1
+deriving via (IsStructViaReadRaw G1) instance IsStruct G1
+instance (~) ty CInt => HasField "g1_x" G1 ty
+    where hasField = \x_0 -> (\y_1 -> G1{g1_x = y_1},
+                              getField @"g1_x" x_0)
+instance (~) ty CInt => HasField "g1_x" (Ptr G1) (Ptr ty)
+    where getField = fromPtr (Proxy @"g1_x")
+instance HasCField G1 "g1_x"
+    where type CFieldType G1 "g1_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G2
+    = G2 {g2_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:16@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize G2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw G2
+    where readRaw = \ptr_0 -> pure G2 <*> readRaw (Proxy @"g2_x") ptr_0
+instance WriteRaw G2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G2 g2_x_2 -> writeRaw (Proxy @"g2_x") ptr_0 g2_x_2
+deriving via (EquivStorable G2) instance Storable G2
+deriving via (IsStructViaReadRaw G2) instance IsStruct G2
+instance (~) ty CInt => HasField "g2_x" G2 ty
+    where hasField = \x_0 -> (\y_1 -> G2{g2_x = y_1},
+                              getField @"g2_x" x_0)
+instance (~) ty CInt => HasField "g2_x" (Ptr G2) (Ptr ty)
+    where getField = fromPtr (Proxy @"g2_x")
+instance HasCField G2 "g2_x"
+    where type CFieldType G2 "g2_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G3
+    = G3 {g3_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:16@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize G3
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw G3
+    where readRaw = \ptr_0 -> pure G3 <*> readRaw (Proxy @"g3_x") ptr_0
+instance WriteRaw G3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G3 g3_x_2 -> writeRaw (Proxy @"g3_x") ptr_0 g3_x_2
+deriving via (EquivStorable G3) instance Storable G3
+deriving via (IsStructViaReadRaw G3) instance IsStruct G3
+instance (~) ty CInt => HasField "g3_x" G3 ty
+    where hasField = \x_0 -> (\y_1 -> G3{g3_x = y_1},
+                              getField @"g3_x" x_0)
+instance (~) ty CInt => HasField "g3_x" (Ptr G3) (Ptr ty)
+    where getField = fromPtr (Proxy @"g3_x")
+instance HasCField G3 "g3_x"
+    where type CFieldType G3 "g3_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_7b488cf23d974403" hs_bindgen_7b488cf23d974403_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+hs_bindgen_7b488cf23d974403 :: IO (Ptr G1)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+hs_bindgen_7b488cf23d974403 = fmap fromFFIType hs_bindgen_7b488cf23d974403_base
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g1 :: Ptr G1
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g1 = unsafePerformIO hs_bindgen_7b488cf23d974403
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_be835215a4ac0819" hs_bindgen_be835215a4ac0819_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+hs_bindgen_be835215a4ac0819 :: IO (Ptr (Ptr G2))
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+hs_bindgen_be835215a4ac0819 = fmap fromFFIType hs_bindgen_be835215a4ac0819_base
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g2 :: Ptr (Ptr G2)
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g2 = unsafePerformIO hs_bindgen_be835215a4ac0819
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_dad785bf89d140bb" hs_bindgen_dad785bf89d140bb_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+hs_bindgen_dad785bf89d140bb :: IO (Ptr (Ptr (Ptr G3)))
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+hs_bindgen_dad785bf89d140bb = fmap fromFFIType hs_bindgen_dad785bf89d140bb_base
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g3 :: Ptr (Ptr (Ptr G3))
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g3 = unsafePerformIO hs_bindgen_dad785bf89d140bb
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/Example.hs
@@ -0,0 +1,234 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.myInt
+    , Example.G1(..)
+    , Example.G2(..)
+    , Example.G3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+myInt :: Macro.Raw String
+myInt = Macro.objectLike "MyInt" ["int"]
+
+{-| __C declaration:__ @struct \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G1 = G1
+  { g1_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:16@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw G1 where
+
+  readRaw =
+    \ptr0 ->
+          pure G1
+      <*> HasCField.readRaw (BG.Proxy @"g1_x") ptr0
+
+instance Marshal.WriteRaw G1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G1 g1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"g1_x") ptr0 g1_x2
+
+deriving via Marshal.EquivStorable G1 instance BG.Storable G1
+
+deriving via Struct.IsStructViaReadRaw G1 instance Struct.IsStruct G1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:16@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g1_x" G1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> G1 {g1_x = y1}, BG.getField @"g1_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g1_x" (BG.Ptr G1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g1_x")
+
+instance HasCField.HasCField G1 "g1_x" where
+
+  type CFieldType G1 "g1_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G2 = G2
+  { g2_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:16@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw G2 where
+
+  readRaw =
+    \ptr0 ->
+          pure G2
+      <*> HasCField.readRaw (BG.Proxy @"g2_x") ptr0
+
+instance Marshal.WriteRaw G2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G2 g2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"g2_x") ptr0 g2_x2
+
+deriving via Marshal.EquivStorable G2 instance BG.Storable G2
+
+deriving via Struct.IsStructViaReadRaw G2 instance Struct.IsStruct G2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:16@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g2_x" G2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> G2 {g2_x = y1}, BG.getField @"g2_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g2_x" (BG.Ptr G2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g2_x")
+
+instance HasCField.HasCField G2 "g2_x" where
+
+  type CFieldType G2 "g2_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G3 = G3
+  { g3_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:16@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G3 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw G3 where
+
+  readRaw =
+    \ptr0 ->
+          pure G3
+      <*> HasCField.readRaw (BG.Proxy @"g3_x") ptr0
+
+instance Marshal.WriteRaw G3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G3 g3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"g3_x") ptr0 g3_x2
+
+deriving via Marshal.EquivStorable G3 instance BG.Storable G3
+
+deriving via Struct.IsStructViaReadRaw G3 instance Struct.IsStruct G3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:16@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g3_x" G3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> G3 {g3_x = y1}, BG.getField @"g3_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g3_x" (BG.Ptr G3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g3_x")
+
+instance HasCField.HasCField G3 "g3_x" where
+
+  type CFieldType G3 "g3_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.g1
+    , Example.Global.g2
+    , Example.Global.g3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/struct_in_variable.h>"
+  , "/* test_macrosreparsenestingstruct__Example_get_G1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_7b488cf23d974403 (void)"
+  , "{"
+  , "  return &G1;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_G2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_be835215a4ac0819 (void)"
+  , "{"
+  , "  return &G2;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_G3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_dad785bf89d140bb (void)"
+  , "{"
+  , "  return &G3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_7b488cf23d974403" hs_bindgen_7b488cf23d974403_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+hs_bindgen_7b488cf23d974403 :: IO (BG.Ptr G1)
+hs_bindgen_7b488cf23d974403 =
+  fmap BG.fromFFIType hs_bindgen_7b488cf23d974403_base
+
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g1 :: BG.Ptr G1
+g1 = BG.unsafePerformIO hs_bindgen_7b488cf23d974403
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_be835215a4ac0819" hs_bindgen_be835215a4ac0819_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+hs_bindgen_be835215a4ac0819 :: IO (BG.Ptr (BG.Ptr G2))
+hs_bindgen_be835215a4ac0819 =
+  fmap BG.fromFFIType hs_bindgen_be835215a4ac0819_base
+
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g2 :: BG.Ptr (BG.Ptr G2)
+g2 = BG.unsafePerformIO hs_bindgen_be835215a4ac0819
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_dad785bf89d140bb" hs_bindgen_dad785bf89d140bb_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+hs_bindgen_dad785bf89d140bb :: IO (BG.Ptr (BG.Ptr (BG.Ptr G3)))
+hs_bindgen_dad785bf89d140bb =
+  fmap BG.fromFFIType hs_bindgen_dad785bf89d140bb_base
+
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g3 :: BG.Ptr (BG.Ptr (BG.Ptr G3))
+g3 = BG.unsafePerformIO hs_bindgen_dad785bf89d140bb
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/bindingspec.yaml
@@ -0,0 +1,72 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: struct @G1
+  hsname: G1
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: struct @G2
+  hsname: G2
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: struct @G3
+  hsname: G3
+hstypes:
+- hsname: G1
+  representation:
+    record:
+      constructor: G1
+      fields:
+      - g1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G2
+  representation:
+    record:
+      constructor: G2
+      fields:
+      - g2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G3
+  representation:
+    record:
+      constructor: G3
+      fields:
+      - g3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable.2.raw/th.txt
@@ -0,0 +1,199 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_variable.h
+-- #include <macros/reparse/nesting/struct_in_variable.h>
+-- /* test_macrosreparsenestingstruct__Example_get_G1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_7b488cf23d974403 (void)
+-- {
+--   return &G1;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_G2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_be835215a4ac0819 (void)
+-- {
+--   return &G2;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_G3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_dad785bf89d140bb (void)
+-- {
+--   return &G3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+myInt :: Raw String
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+myInt = objectLike "MyInt" ["int"]
+{-| __C declaration:__ @struct \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G1
+    = G1 {g1_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:16@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize G1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw G1
+    where readRaw = \ptr_0 -> pure G1 <*> readRaw (Proxy @"g1_x") ptr_0
+instance WriteRaw G1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G1 g1_x_2 -> writeRaw (Proxy @"g1_x") ptr_0 g1_x_2
+deriving via (EquivStorable G1) instance Storable G1
+deriving via (IsStructViaReadRaw G1) instance IsStruct G1
+instance (~) ty CInt => HasField "g1_x" G1 ty
+    where hasField = \x_0 -> (\y_1 -> G1{g1_x = y_1},
+                              getField @"g1_x" x_0)
+instance (~) ty CInt => HasField "g1_x" (Ptr G1) (Ptr ty)
+    where getField = fromPtr (Proxy @"g1_x")
+instance HasCField G1 "g1_x"
+    where type CFieldType G1 "g1_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G2
+    = G2 {g2_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:16@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize G2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw G2
+    where readRaw = \ptr_0 -> pure G2 <*> readRaw (Proxy @"g2_x") ptr_0
+instance WriteRaw G2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G2 g2_x_2 -> writeRaw (Proxy @"g2_x") ptr_0 g2_x_2
+deriving via (EquivStorable G2) instance Storable G2
+deriving via (IsStructViaReadRaw G2) instance IsStruct G2
+instance (~) ty CInt => HasField "g2_x" G2 ty
+    where hasField = \x_0 -> (\y_1 -> G2{g2_x = y_1},
+                              getField @"g2_x" x_0)
+instance (~) ty CInt => HasField "g2_x" (Ptr G2) (Ptr ty)
+    where getField = fromPtr (Proxy @"g2_x")
+instance HasCField G2 "g2_x"
+    where type CFieldType G2 "g2_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G3
+    = G3 {g3_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:16@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize G3
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw G3
+    where readRaw = \ptr_0 -> pure G3 <*> readRaw (Proxy @"g3_x") ptr_0
+instance WriteRaw G3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G3 g3_x_2 -> writeRaw (Proxy @"g3_x") ptr_0 g3_x_2
+deriving via (EquivStorable G3) instance Storable G3
+deriving via (IsStructViaReadRaw G3) instance IsStruct G3
+instance (~) ty CInt => HasField "g3_x" G3 ty
+    where hasField = \x_0 -> (\y_1 -> G3{g3_x = y_1},
+                              getField @"g3_x" x_0)
+instance (~) ty CInt => HasField "g3_x" (Ptr G3) (Ptr ty)
+    where getField = fromPtr (Proxy @"g3_x")
+instance HasCField G3 "g3_x"
+    where type CFieldType G3 "g3_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_7b488cf23d974403" hs_bindgen_7b488cf23d974403_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+hs_bindgen_7b488cf23d974403 :: IO (Ptr G1)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+hs_bindgen_7b488cf23d974403 = fmap fromFFIType hs_bindgen_7b488cf23d974403_base
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g1 :: Ptr G1
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g1 = unsafePerformIO hs_bindgen_7b488cf23d974403
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_be835215a4ac0819" hs_bindgen_be835215a4ac0819_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+hs_bindgen_be835215a4ac0819 :: IO (Ptr (Ptr G2))
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+hs_bindgen_be835215a4ac0819 = fmap fromFFIType hs_bindgen_be835215a4ac0819_base
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g2 :: Ptr (Ptr G2)
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g2 = unsafePerformIO hs_bindgen_be835215a4ac0819
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_dad785bf89d140bb" hs_bindgen_dad785bf89d140bb_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+hs_bindgen_dad785bf89d140bb :: IO (Ptr (Ptr (Ptr G3)))
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+hs_bindgen_dad785bf89d140bb = fmap fromFFIType hs_bindgen_dad785bf89d140bb_base
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g3 :: Ptr (Ptr (Ptr G3))
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g3 = unsafePerformIO hs_bindgen_dad785bf89d140bb
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/Example.hs
@@ -0,0 +1,274 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.G1(..)
+    , Example.G2(..)
+    , Example.G3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G1 = G1
+  { g1_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:16@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw G1 where
+
+  readRaw =
+    \ptr0 ->
+          pure G1
+      <*> HasCField.readRaw (BG.Proxy @"g1_x") ptr0
+
+instance Marshal.WriteRaw G1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G1 g1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"g1_x") ptr0 g1_x2
+
+deriving via Marshal.EquivStorable G1 instance BG.Storable G1
+
+deriving via Struct.IsStructViaReadRaw G1 instance Struct.IsStruct G1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:16@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "g1_x" G1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> G1 {g1_x = y1}, BG.getField @"g1_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "g1_x" (BG.Ptr G1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g1_x")
+
+instance HasCField.HasCField G1 "g1_x" where
+
+  type CFieldType G1 "g1_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G2 = G2
+  { g2_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:16@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw G2 where
+
+  readRaw =
+    \ptr0 ->
+          pure G2
+      <*> HasCField.readRaw (BG.Proxy @"g2_x") ptr0
+
+instance Marshal.WriteRaw G2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G2 g2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"g2_x") ptr0 g2_x2
+
+deriving via Marshal.EquivStorable G2 instance BG.Storable G2
+
+deriving via Struct.IsStructViaReadRaw G2 instance Struct.IsStruct G2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:16@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "g2_x" G2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> G2 {g2_x = y1}, BG.getField @"g2_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "g2_x" (BG.Ptr G2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g2_x")
+
+instance HasCField.HasCField G2 "g2_x" where
+
+  type CFieldType G2 "g2_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G3 = G3
+  { g3_x :: MyInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:16@
+
+         __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G3 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw G3 where
+
+  readRaw =
+    \ptr0 ->
+          pure G3
+      <*> HasCField.readRaw (BG.Proxy @"g3_x") ptr0
+
+instance Marshal.WriteRaw G3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G3 g3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"g3_x") ptr0 g3_x2
+
+deriving via Marshal.EquivStorable G3 instance BG.Storable G3
+
+deriving via Struct.IsStructViaReadRaw G3 instance Struct.IsStruct G3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:16@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "g3_x" G3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> G3 {g3_x = y1}, BG.getField @"g3_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "g3_x" (BG.Ptr G3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g3_x")
+
+instance HasCField.HasCField G3 "g3_x" where
+
+  type CFieldType G3 "g3_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.g1
+    , Example.Global.g2
+    , Example.Global.g3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/struct_in_variable.h>"
+  , "/* test_macrosreparsenestingstruct__Example_get_G1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_7b488cf23d974403 (void)"
+  , "{"
+  , "  return &G1;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_G2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_be835215a4ac0819 (void)"
+  , "{"
+  , "  return &G2;"
+  , "}"
+  , "/* test_macrosreparsenestingstruct__Example_get_G3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_dad785bf89d140bb (void)"
+  , "{"
+  , "  return &G3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_7b488cf23d974403" hs_bindgen_7b488cf23d974403_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+hs_bindgen_7b488cf23d974403 :: IO (BG.Ptr G1)
+hs_bindgen_7b488cf23d974403 =
+  fmap BG.fromFFIType hs_bindgen_7b488cf23d974403_base
+
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g1 :: BG.Ptr G1
+g1 = BG.unsafePerformIO hs_bindgen_7b488cf23d974403
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_be835215a4ac0819" hs_bindgen_be835215a4ac0819_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+hs_bindgen_be835215a4ac0819 :: IO (BG.Ptr (BG.Ptr G2))
+hs_bindgen_be835215a4ac0819 =
+  fmap BG.fromFFIType hs_bindgen_be835215a4ac0819_base
+
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g2 :: BG.Ptr (BG.Ptr G2)
+g2 = BG.unsafePerformIO hs_bindgen_be835215a4ac0819
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_dad785bf89d140bb" hs_bindgen_dad785bf89d140bb_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+hs_bindgen_dad785bf89d140bb :: IO (BG.Ptr (BG.Ptr (BG.Ptr G3)))
+hs_bindgen_dad785bf89d140bb =
+  fmap BG.fromFFIType hs_bindgen_dad785bf89d140bb_base
+
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g3 :: BG.Ptr (BG.Ptr (BG.Ptr G3))
+g3 = BG.unsafePerformIO hs_bindgen_dad785bf89d140bb
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/bindingspec.yaml
@@ -0,0 +1,109 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: macro MyInt
+  hsname: MyInt
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: struct @G1
+  hsname: G1
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: struct @G2
+  hsname: G2
+- headers: macros/reparse/nesting/struct_in_variable.h
+  cname: struct @G3
+  hsname: G3
+hstypes:
+- hsname: G1
+  representation:
+    record:
+      constructor: G1
+      fields:
+      - g1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G2
+  representation:
+    record:
+      constructor: G2
+      fields:
+      - g2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G3
+  representation:
+    record:
+      constructor: G3
+      fields:
+      - g3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/struct_in_variable/th.txt
@@ -0,0 +1,217 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/struct_in_variable.h
+-- #include <macros/reparse/nesting/struct_in_variable.h>
+-- /* test_macrosreparsenestingstruct__Example_get_G1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_7b488cf23d974403 (void)
+-- {
+--   return &G1;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_G2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_be835215a4ac0819 (void)
+-- {
+--   return &G2;
+-- }
+-- /* test_macrosreparsenestingstruct__Example_get_G3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_dad785bf89d140bb (void)
+-- {
+--   return &G3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G1
+    = G1 {g1_x :: MyInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:16@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize G1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw G1
+    where readRaw = \ptr_0 -> pure G1 <*> readRaw (Proxy @"g1_x") ptr_0
+instance WriteRaw G1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G1 g1_x_2 -> writeRaw (Proxy @"g1_x") ptr_0 g1_x_2
+deriving via (EquivStorable G1) instance Storable G1
+deriving via (IsStructViaReadRaw G1) instance IsStruct G1
+instance (~) ty MyInt => HasField "g1_x" G1 ty
+    where hasField = \x_0 -> (\y_1 -> G1{g1_x = y_1},
+                              getField @"g1_x" x_0)
+instance (~) ty MyInt => HasField "g1_x" (Ptr G1) (Ptr ty)
+    where getField = fromPtr (Proxy @"g1_x")
+instance HasCField G1 "g1_x"
+    where type CFieldType G1 "g1_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G2
+    = G2 {g2_x :: MyInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:16@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize G2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw G2
+    where readRaw = \ptr_0 -> pure G2 <*> readRaw (Proxy @"g2_x") ptr_0
+instance WriteRaw G2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G2 g2_x_2 -> writeRaw (Proxy @"g2_x") ptr_0 g2_x_2
+deriving via (EquivStorable G2) instance Storable G2
+deriving via (IsStructViaReadRaw G2) instance IsStruct G2
+instance (~) ty MyInt => HasField "g2_x" G2 ty
+    where hasField = \x_0 -> (\y_1 -> G2{g2_x = y_1},
+                              getField @"g2_x" x_0)
+instance (~) ty MyInt => HasField "g2_x" (Ptr G2) (Ptr ty)
+    where getField = fromPtr (Proxy @"g2_x")
+instance HasCField G2 "g2_x"
+    where type CFieldType G2 "g2_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+data G3
+    = G3 {g3_x :: MyInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:16@
+
+               __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize G3
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw G3
+    where readRaw = \ptr_0 -> pure G3 <*> readRaw (Proxy @"g3_x") ptr_0
+instance WriteRaw G3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G3 g3_x_2 -> writeRaw (Proxy @"g3_x") ptr_0 g3_x_2
+deriving via (EquivStorable G3) instance Storable G3
+deriving via (IsStructViaReadRaw G3) instance IsStruct G3
+instance (~) ty MyInt => HasField "g3_x" G3 ty
+    where hasField = \x_0 -> (\y_1 -> G3{g3_x = y_1},
+                              getField @"g3_x" x_0)
+instance (~) ty MyInt => HasField "g3_x" (Ptr G3) (Ptr ty)
+    where getField = fromPtr (Proxy @"g3_x")
+instance HasCField G3 "g3_x"
+    where type CFieldType G3 "g3_x" = MyInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_7b488cf23d974403" hs_bindgen_7b488cf23d974403_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+hs_bindgen_7b488cf23d974403 :: IO (Ptr G1)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G1@
+hs_bindgen_7b488cf23d974403 = fmap fromFFIType hs_bindgen_7b488cf23d974403_base
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g1 :: Ptr G1
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g1 = unsafePerformIO hs_bindgen_7b488cf23d974403
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_be835215a4ac0819" hs_bindgen_be835215a4ac0819_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+hs_bindgen_be835215a4ac0819 :: IO (Ptr (Ptr G2))
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G2@
+hs_bindgen_be835215a4ac0819 = fmap fromFFIType hs_bindgen_be835215a4ac0819_base
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g2 :: Ptr (Ptr G2)
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g2 = unsafePerformIO hs_bindgen_be835215a4ac0819
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_dad785bf89d140bb" hs_bindgen_dad785bf89d140bb_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+hs_bindgen_dad785bf89d140bb :: IO (Ptr (Ptr (Ptr G3)))
+-- __unique:__ @test_macrosreparsenestingstruct__Example_get_G3@
+hs_bindgen_dad785bf89d140bb = fmap fromFFIType hs_bindgen_dad785bf89d140bb_base
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g3 :: Ptr (Ptr (Ptr G3))
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/struct_in_variable.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/struct_in_variable.h@
+-}
+g3 = unsafePerformIO hs_bindgen_dad785bf89d140bb
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/th.txt
@@ -0,0 +1,132 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting.h
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct TS1@
+
+    __defined at:__ @macros\/reparse\/nesting.h 5:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T2
+    = T2 {t2_x :: MyInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting.h 5:28@
+
+               __exported by:__ @macros\/reparse\/nesting.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T2
+    where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
+instance WriteRaw T2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (IsStructViaReadRaw T2) instance IsStruct T2
+instance (~) ty MyInt => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
+                              getField @"t2_x" x_0)
+instance (~) ty MyInt => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct TS3@
+
+    __defined at:__ @macros\/reparse\/nesting.h 6:16@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T3
+    = T3 {t3_x :: MyInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting.h 6:28@
+
+               __exported by:__ @macros\/reparse\/nesting.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T3
+    where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
+instance WriteRaw T3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (IsStructViaReadRaw T3) instance IsStruct T3
+instance (~) ty MyInt => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
+                              getField @"t3_x" x_0)
+instance (~) ty MyInt => HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct T4@
+
+    __defined at:__ @macros\/reparse\/nesting.h 7:9@
+
+    __exported by:__ @macros\/reparse\/nesting.h@
+-}
+data T4
+    = T4 {t4_x :: MyInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting.h 7:28@
+
+               __exported by:__ @macros\/reparse\/nesting.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T4
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T4
+    where readRaw = \ptr_0 -> pure T4 <*> readRaw (Proxy @"t4_x") ptr_0
+instance WriteRaw T4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T4 t4_x_2 -> writeRaw (Proxy @"t4_x") ptr_0 t4_x_2
+deriving via (EquivStorable T4) instance Storable T4
+deriving via (IsStructViaReadRaw T4) instance IsStruct T4
+instance (~) ty MyInt => HasField "t4_x" T4 ty
+    where hasField = \x_0 -> (\y_1 -> T4{t4_x = y_1},
+                              getField @"t4_x" x_0)
+instance (~) ty MyInt => HasField "t4_x" (Ptr T4) (Ptr ty)
+    where getField = fromPtr (Proxy @"t4_x")
+instance HasCField T4 "t4_x"
+    where type CFieldType T4 "t4_x" = MyInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/Example.hs
@@ -0,0 +1,391 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T1_x = T1_x
+  { unwrapT1_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1_x
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" T1_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T1 = T1
+  { t1_x :: T1_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
+
+         __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize T1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1 where
+
+  readRaw =
+    \ptr0 ->
+          pure T1
+      <*> HasCField.readRaw (BG.Proxy @"t1_x") ptr0
+
+instance Marshal.WriteRaw T1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1 t1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x") ptr0 t1_x2
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via Struct.IsStructViaReadRaw T1 instance Struct.IsStruct T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1 {t1_x = y1}, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T2 = T2
+  { t2_x :: BG.Ptr T2_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
+
+         __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T2 where
+
+  readRaw =
+    \ptr0 ->
+          pure T2
+      <*> HasCField.readRaw (BG.Proxy @"t2_x") ptr0
+
+instance Marshal.WriteRaw T2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2 t2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x") ptr0 t2_x2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via Struct.IsStructViaReadRaw T2 instance Struct.IsStruct T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2 {t2_x = y1}, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T2_x = T2_x
+  { unwrapT2_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T2_x
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" T2_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T3 = T3
+  { t3_x :: BG.Ptr (BG.Ptr T3_x)
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
+
+         __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T3 where
+
+  readRaw =
+    \ptr0 ->
+          pure T3
+      <*> HasCField.readRaw (BG.Proxy @"t3_x") ptr0
+
+instance Marshal.WriteRaw T3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3 t3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x") ptr0 t3_x2
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via Struct.IsStructViaReadRaw T3 instance Struct.IsStruct T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3 {t3_x = y1}, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T3_x = T3_x
+  { unwrapT3_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T3_x
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" T3_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/union_in_struct.h>"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_44a1ef54c1044601 (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_915293812630a04d (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_e20a6c1bc9b97a9e (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (BG.Ptr T1)
+hs_bindgen_44a1ef54c1044601 =
+  fmap BG.fromFFIType hs_bindgen_44a1ef54c1044601_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_44a1ef54c1044601
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (BG.Ptr T2)
+hs_bindgen_915293812630a04d =
+  fmap BG.fromFFIType hs_bindgen_915293812630a04d_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_915293812630a04d
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (BG.Ptr T3)
+hs_bindgen_e20a6c1bc9b97a9e =
+  fmap BG.fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/bindingspec.yaml
@@ -0,0 +1,130 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: struct @T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: union @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: struct @T2
+  hsname: T2
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: union @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: struct @T3
+  hsname: T3
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: union @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: T1
+  representation:
+    record:
+      constructor: T1
+      fields:
+      - t1_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    newtype:
+      constructor: T1_x
+      fields:
+      - unwrapT1_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    record:
+      constructor: T2
+      fields:
+      - t2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    newtype:
+      constructor: T2_x
+      fields:
+      - unwrapT2_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    record:
+      constructor: T3
+      fields:
+      - t3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    newtype:
+      constructor: T3_x
+      fields:
+      - unwrapT3_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.1.empty/th.txt
@@ -0,0 +1,258 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_struct.h
+-- #include <macros/reparse/nesting/union_in_struct.h>
+-- /* test_macrosreparsenestingunion_i_Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_44a1ef54c1044601 (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_915293812630a04d (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_e20a6c1bc9b97a9e (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T1_x
+    = T1_x {unwrapT1_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T1_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T1_x
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (SizedByteArray 4 4) instance IsUnion T1_x
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x_x" x_0)
+instance (~) ty CInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T1
+    = T1 {t1_x :: T1_x
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
+
+               __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+          -}}
+    deriving stock Generic
+instance StaticSize T1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1
+    where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
+instance WriteRaw T1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (IsStructViaReadRaw T1) instance IsStruct T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T2
+    = T2 {t2_x :: (Ptr T2_x)
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
+
+               __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T2
+    where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
+instance WriteRaw T2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (IsStructViaReadRaw T2) instance IsStruct T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T2_x
+    = T2_x {unwrapT2_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T2_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T2_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T2_x
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (SizedByteArray 4 4) instance IsUnion T2_x
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x_x" x_0)
+instance (~) ty CInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T3
+    = T3 {t3_x :: (Ptr (Ptr T3_x))
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
+
+               __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T3
+    where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
+instance WriteRaw T3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (IsStructViaReadRaw T3) instance IsStruct T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T3_x
+    = T3_x {unwrapT3_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T3_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T3_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T3_x
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (SizedByteArray 4 4) instance IsUnion T3_x
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x_x" x_0)
+instance (~) ty CInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 = fmap fromFFIType hs_bindgen_44a1ef54c1044601_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t1 = unsafePerformIO hs_bindgen_44a1ef54c1044601
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d = fmap fromFFIType hs_bindgen_915293812630a04d_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t2 = unsafePerformIO hs_bindgen_915293812630a04d
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e = fmap fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t3 = unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/Example.hs
@@ -0,0 +1,402 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.myInt
+    , Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+myInt :: Macro.Raw String
+myInt = Macro.objectLike "MyInt" ["int"]
+
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T1_x = T1_x
+  { unwrapT1_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1_x
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" T1_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T1 = T1
+  { t1_x :: T1_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
+
+         __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize T1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1 where
+
+  readRaw =
+    \ptr0 ->
+          pure T1
+      <*> HasCField.readRaw (BG.Proxy @"t1_x") ptr0
+
+instance Marshal.WriteRaw T1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1 t1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x") ptr0 t1_x2
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via Struct.IsStructViaReadRaw T1 instance Struct.IsStruct T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1 {t1_x = y1}, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T2 = T2
+  { t2_x :: BG.Ptr T2_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
+
+         __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T2 where
+
+  readRaw =
+    \ptr0 ->
+          pure T2
+      <*> HasCField.readRaw (BG.Proxy @"t2_x") ptr0
+
+instance Marshal.WriteRaw T2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2 t2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x") ptr0 t2_x2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via Struct.IsStructViaReadRaw T2 instance Struct.IsStruct T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2 {t2_x = y1}, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T2_x = T2_x
+  { unwrapT2_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T2_x
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" T2_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T3 = T3
+  { t3_x :: BG.Ptr (BG.Ptr T3_x)
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
+
+         __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T3 where
+
+  readRaw =
+    \ptr0 ->
+          pure T3
+      <*> HasCField.readRaw (BG.Proxy @"t3_x") ptr0
+
+instance Marshal.WriteRaw T3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3 t3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x") ptr0 t3_x2
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via Struct.IsStructViaReadRaw T3 instance Struct.IsStruct T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3 {t3_x = y1}, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T3_x = T3_x
+  { unwrapT3_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T3_x
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" T3_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/union_in_struct.h>"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_44a1ef54c1044601 (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_915293812630a04d (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_e20a6c1bc9b97a9e (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (BG.Ptr T1)
+hs_bindgen_44a1ef54c1044601 =
+  fmap BG.fromFFIType hs_bindgen_44a1ef54c1044601_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_44a1ef54c1044601
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (BG.Ptr T2)
+hs_bindgen_915293812630a04d =
+  fmap BG.fromFFIType hs_bindgen_915293812630a04d_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_915293812630a04d
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (BG.Ptr T3)
+hs_bindgen_e20a6c1bc9b97a9e =
+  fmap BG.fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/bindingspec.yaml
@@ -0,0 +1,130 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: struct @T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: union @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: struct @T2
+  hsname: T2
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: union @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: struct @T3
+  hsname: T3
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: union @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: T1
+  representation:
+    record:
+      constructor: T1
+      fields:
+      - t1_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    newtype:
+      constructor: T1_x
+      fields:
+      - unwrapT1_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    record:
+      constructor: T2
+      fields:
+      - t2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    newtype:
+      constructor: T2_x
+      fields:
+      - unwrapT2_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    record:
+      constructor: T3
+      fields:
+      - t3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    newtype:
+      constructor: T3_x
+      fields:
+      - unwrapT3_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct.2.raw/th.txt
@@ -0,0 +1,272 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_struct.h
+-- #include <macros/reparse/nesting/union_in_struct.h>
+-- /* test_macrosreparsenestingunion_i_Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_44a1ef54c1044601 (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_915293812630a04d (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_e20a6c1bc9b97a9e (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+myInt :: Raw String
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+myInt = objectLike "MyInt" ["int"]
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T1_x
+    = T1_x {unwrapT1_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T1_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T1_x
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (SizedByteArray 4 4) instance IsUnion T1_x
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x_x" x_0)
+instance (~) ty CInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T1
+    = T1 {t1_x :: T1_x
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
+
+               __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+          -}}
+    deriving stock Generic
+instance StaticSize T1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1
+    where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
+instance WriteRaw T1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (IsStructViaReadRaw T1) instance IsStruct T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T2
+    = T2 {t2_x :: (Ptr T2_x)
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
+
+               __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T2
+    where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
+instance WriteRaw T2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (IsStructViaReadRaw T2) instance IsStruct T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T2_x
+    = T2_x {unwrapT2_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T2_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T2_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T2_x
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (SizedByteArray 4 4) instance IsUnion T2_x
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x_x" x_0)
+instance (~) ty CInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T3
+    = T3 {t3_x :: (Ptr (Ptr T3_x))
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
+
+               __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T3
+    where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
+instance WriteRaw T3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (IsStructViaReadRaw T3) instance IsStruct T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T3_x
+    = T3_x {unwrapT3_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T3_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T3_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T3_x
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (SizedByteArray 4 4) instance IsUnion T3_x
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x_x" x_0)
+instance (~) ty CInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 = fmap fromFFIType hs_bindgen_44a1ef54c1044601_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t1 = unsafePerformIO hs_bindgen_44a1ef54c1044601
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d = fmap fromFFIType hs_bindgen_915293812630a04d_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t2 = unsafePerformIO hs_bindgen_915293812630a04d
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e = fmap fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t3 = unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/Example.hs
@@ -0,0 +1,442 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T1_x = T1_x
+  { unwrapT1_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1_x
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "t1_x_x" T1_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T1 = T1
+  { t1_x :: T1_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
+
+         __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize T1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T1 where
+
+  readRaw =
+    \ptr0 ->
+          pure T1
+      <*> HasCField.readRaw (BG.Proxy @"t1_x") ptr0
+
+instance Marshal.WriteRaw T1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T1 t1_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t1_x") ptr0 t1_x2
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via Struct.IsStructViaReadRaw T1 instance Struct.IsStruct T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T1 {t1_x = y1}, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T2 = T2
+  { t2_x :: BG.Ptr T2_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
+
+         __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T2 where
+
+  readRaw =
+    \ptr0 ->
+          pure T2
+      <*> HasCField.readRaw (BG.Proxy @"t2_x") ptr0
+
+instance Marshal.WriteRaw T2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T2 t2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t2_x") ptr0 t2_x2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via Struct.IsStructViaReadRaw T2 instance Struct.IsStruct T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T2 {t2_x = y1}, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T2_x = T2_x
+  { unwrapT2_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T2_x
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "t2_x_x" T2_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T3 = T3
+  { t3_x :: BG.Ptr (BG.Ptr T3_x)
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
+
+         __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T3 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw T3 where
+
+  readRaw =
+    \ptr0 ->
+          pure T3
+      <*> HasCField.readRaw (BG.Proxy @"t3_x") ptr0
+
+instance Marshal.WriteRaw T3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T3 t3_x2 ->
+            HasCField.writeRaw (BG.Proxy @"t3_x") ptr0 t3_x2
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via Struct.IsStructViaReadRaw T3 instance Struct.IsStruct T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T3 {t3_x = y1}, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T3_x = T3_x
+  { unwrapT3_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T3_x
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "t3_x_x" T3_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:24@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/union_in_struct.h>"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_44a1ef54c1044601 (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_915293812630a04d (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_e20a6c1bc9b97a9e (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (BG.Ptr T1)
+hs_bindgen_44a1ef54c1044601 =
+  fmap BG.fromFFIType hs_bindgen_44a1ef54c1044601_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_44a1ef54c1044601
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (BG.Ptr T2)
+hs_bindgen_915293812630a04d =
+  fmap BG.fromFFIType hs_bindgen_915293812630a04d_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_915293812630a04d
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (BG.Ptr T3)
+hs_bindgen_e20a6c1bc9b97a9e =
+  fmap BG.fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/bindingspec.yaml
@@ -0,0 +1,167 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: macro MyInt
+  hsname: MyInt
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: struct @T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: union @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: struct @T2
+  hsname: T2
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: union @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: struct @T3
+  hsname: T3
+- headers: macros/reparse/nesting/union_in_struct.h
+  cname: union @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1
+  representation:
+    record:
+      constructor: T1
+      fields:
+      - t1_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    newtype:
+      constructor: T1_x
+      fields:
+      - unwrapT1_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    record:
+      constructor: T2
+      fields:
+      - t2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    newtype:
+      constructor: T2_x
+      fields:
+      - unwrapT2_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    record:
+      constructor: T3
+      fields:
+      - t3_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    newtype:
+      constructor: T3_x
+      fields:
+      - unwrapT3_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_struct/th.txt
@@ -0,0 +1,290 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_struct.h
+-- #include <macros/reparse/nesting/union_in_struct.h>
+-- /* test_macrosreparsenestingunion_i_Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_44a1ef54c1044601 (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_915293812630a04d (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_e20a6c1bc9b97a9e (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T1_x
+    = T1_x {unwrapT1_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T1_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T1_x
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (SizedByteArray 4 4) instance IsUnion T1_x
+instance (~) ty MyInt => HasField "t1_x_x" T1_x ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x_x" x_0)
+instance (~) ty MyInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T1
+    = T1 {t1_x :: T1_x
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:32@
+
+               __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+          -}}
+    deriving stock Generic
+instance StaticSize T1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T1
+    where readRaw = \ptr_0 -> pure T1 <*> readRaw (Proxy @"t1_x") ptr_0
+instance WriteRaw T1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T1 t1_x_2 -> writeRaw (Proxy @"t1_x") ptr_0 t1_x_2
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (IsStructViaReadRaw T1) instance IsStruct T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{t1_x = y_1},
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T2
+    = T2 {t2_x :: (Ptr T2_x)
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:32@
+
+               __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T2
+    where readRaw = \ptr_0 -> pure T2 <*> readRaw (Proxy @"t2_x") ptr_0
+instance WriteRaw T2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T2 t2_x_2 -> writeRaw (Proxy @"t2_x") ptr_0 t2_x_2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (IsStructViaReadRaw T2) instance IsStruct T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{t2_x = y_1},
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T2_x
+    = T2_x {unwrapT2_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T2_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T2_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T2_x
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (SizedByteArray 4 4) instance IsUnion T2_x
+instance (~) ty MyInt => HasField "t2_x_x" T2_x ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x_x" x_0)
+instance (~) ty MyInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+data T3
+    = T3 {t3_x :: (Ptr (Ptr T3_x))
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:32@
+
+               __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T3
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw T3
+    where readRaw = \ptr_0 -> pure T3 <*> readRaw (Proxy @"t3_x") ptr_0
+instance WriteRaw T3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T3 t3_x_2 -> writeRaw (Proxy @"t3_x") ptr_0 t3_x_2
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (IsStructViaReadRaw T3) instance IsStruct T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{t3_x = y_1},
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:10@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+newtype T3_x
+    = T3_x {unwrapT3_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T3_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T3_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T3_x
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (SizedByteArray 4 4) instance IsUnion T3_x
+instance (~) ty MyInt => HasField "t3_x_x" T3_x ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x_x" x_0)
+instance (~) ty MyInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 = fmap fromFFIType hs_bindgen_44a1ef54c1044601_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 3:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t1 = unsafePerformIO hs_bindgen_44a1ef54c1044601
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d = fmap fromFFIType hs_bindgen_915293812630a04d_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 4:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t2 = unsafePerformIO hs_bindgen_915293812630a04d
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e = fmap fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_struct.h 5:37@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_struct.h@
+-}
+t3 = unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.1.empty/Example.hs
@@ -0,0 +1,270 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T1(..)
+    , Example.T2_Aux(..)
+    , Example.T2(..)
+    , Example.T3_Aux(..)
+    , Example.T3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (Eq, Ord, Show, type (~))
+
+{-| __C declaration:__ @union T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t1_x" T1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2_Aux = T2_Aux
+  { unwrapT2_Aux :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T2_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T2_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T2_Aux
+
+deriving via Marshal.EquivStorable T2_Aux instance BG.Storable T2_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T2_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t2_Aux_x" T2_Aux ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_Aux_x" T2_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_Aux_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "t2_Aux_x" (BG.Ptr T2_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_Aux_x")
+
+instance HasCField.HasCField T2_Aux "t2_Aux_x" where
+
+  type CFieldType T2_Aux "t2_Aux_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.Ptr T2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.Ptr T2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3_Aux = T3_Aux
+  { unwrapT3_Aux :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T3_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T3_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T3_Aux
+
+deriving via Marshal.EquivStorable T3_Aux instance BG.Storable T3_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T3_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t3_Aux_x" T3_Aux ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_Aux_x" T3_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_Aux_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "t3_Aux_x" (BG.Ptr T3_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_Aux_x")
+
+instance HasCField.HasCField T3_Aux "t3_Aux_x" where
+
+  type CFieldType T3_Aux "t3_Aux_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.Ptr (BG.Ptr T3_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.CompatHasField.HasField "unwrapT3" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3 {unwrapT3 = y1}, BG.getField @"unwrapT3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.HasField "unwrapT3" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT3")
+
+instance HasCField.HasCField T3 "unwrapT3" where
+
+  type CFieldType T3 "unwrapT3" =
+    BG.Ptr (BG.Ptr T3_Aux)
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.1.empty/bindingspec.yaml
@@ -0,0 +1,121 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: union T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: union @T2_Aux
+  hsname: T2_Aux
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: T2
+  hsname: T2
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: union @T3_Aux
+  hsname: T3_Aux
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: T3
+  hsname: T3
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_Aux
+  representation:
+    newtype:
+      constructor: T2_Aux
+      fields:
+      - unwrapT2_Aux
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_Aux
+  representation:
+    newtype:
+      constructor: T3_Aux
+      fields:
+      - unwrapT3_Aux
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.1.empty/th.txt
@@ -0,0 +1,117 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_typedef.h
+{-| __C declaration:__ @union T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T1 = T1 {unwrapT1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1
+deriving via (SizedByteArray 4 4) instance ReadRaw T1
+deriving via (SizedByteArray 4 4) instance WriteRaw T1
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (SizedByteArray 4 4) instance IsUnion T1
+instance (~) ty CInt => HasField "t1_x" T1 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x" x_0)
+instance (~) ty CInt => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2_Aux
+    = T2_Aux {unwrapT2_Aux :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T2_Aux
+deriving via (SizedByteArray 4 4) instance ReadRaw T2_Aux
+deriving via (SizedByteArray 4 4) instance WriteRaw T2_Aux
+deriving via (EquivStorable T2_Aux) instance Storable T2_Aux
+deriving via (SizedByteArray 4 4) instance IsUnion T2_Aux
+instance (~) ty CInt => HasField "t2_Aux_x" T2_Aux ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t2_Aux_x" T2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_Aux_x" x_0)
+instance (~) ty CInt => HasField "t2_Aux_x" (Ptr T2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_Aux_x")
+instance HasCField T2_Aux "t2_Aux_x"
+    where type CFieldType T2_Aux "t2_Aux_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: (Ptr T2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr T2_Aux) => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty (Ptr T2_Aux) =>
+         HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = Ptr T2_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3_Aux
+    = T3_Aux {unwrapT3_Aux :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T3_Aux
+deriving via (SizedByteArray 4 4) instance ReadRaw T3_Aux
+deriving via (SizedByteArray 4 4) instance WriteRaw T3_Aux
+deriving via (EquivStorable T3_Aux) instance Storable T3_Aux
+deriving via (SizedByteArray 4 4) instance IsUnion T3_Aux
+instance (~) ty CInt => HasField "t3_Aux_x" T3_Aux ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t3_Aux_x" T3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_Aux_x" x_0)
+instance (~) ty CInt => HasField "t3_Aux_x" (Ptr T3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_Aux_x")
+instance HasCField T3_Aux "t3_Aux_x"
+    where type CFieldType T3_Aux "t3_Aux_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3
+    = T3 {unwrapT3 :: (Ptr (Ptr T3_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr T3_Aux)) => HasField "unwrapT3" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{unwrapT3 = y_1},
+                              getField @"unwrapT3" x_0)
+instance (~) ty (Ptr (Ptr T3_Aux)) =>
+         HasField "unwrapT3" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT3")
+instance HasCField T3 "unwrapT3"
+    where type CFieldType T3 "unwrapT3" = Ptr (Ptr T3_Aux)
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.2.raw/Example.hs
@@ -0,0 +1,281 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.myInt
+    , Example.T1(..)
+    , Example.T2_Aux(..)
+    , Example.T2(..)
+    , Example.T3_Aux(..)
+    , Example.T3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (Eq, Ord, Show, String, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+myInt :: Macro.Raw String
+myInt = Macro.objectLike "MyInt" ["int"]
+
+{-| __C declaration:__ @union T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t1_x" T1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2_Aux = T2_Aux
+  { unwrapT2_Aux :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T2_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T2_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T2_Aux
+
+deriving via Marshal.EquivStorable T2_Aux instance BG.Storable T2_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T2_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t2_Aux_x" T2_Aux ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_Aux_x" T2_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_Aux_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "t2_Aux_x" (BG.Ptr T2_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_Aux_x")
+
+instance HasCField.HasCField T2_Aux "t2_Aux_x" where
+
+  type CFieldType T2_Aux "t2_Aux_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.Ptr T2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.Ptr T2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3_Aux = T3_Aux
+  { unwrapT3_Aux :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T3_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T3_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T3_Aux
+
+deriving via Marshal.EquivStorable T3_Aux instance BG.Storable T3_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T3_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t3_Aux_x" T3_Aux ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_Aux_x" T3_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_Aux_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "t3_Aux_x" (BG.Ptr T3_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_Aux_x")
+
+instance HasCField.HasCField T3_Aux "t3_Aux_x" where
+
+  type CFieldType T3_Aux "t3_Aux_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.Ptr (BG.Ptr T3_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.CompatHasField.HasField "unwrapT3" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3 {unwrapT3 = y1}, BG.getField @"unwrapT3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.HasField "unwrapT3" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT3")
+
+instance HasCField.HasCField T3 "unwrapT3" where
+
+  type CFieldType T3 "unwrapT3" =
+    BG.Ptr (BG.Ptr T3_Aux)
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.2.raw/bindingspec.yaml
@@ -0,0 +1,121 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: union T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: union @T2_Aux
+  hsname: T2_Aux
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: T2
+  hsname: T2
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: union @T3_Aux
+  hsname: T3_Aux
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: T3
+  hsname: T3
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_Aux
+  representation:
+    newtype:
+      constructor: T2_Aux
+      fields:
+      - unwrapT2_Aux
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_Aux
+  representation:
+    newtype:
+      constructor: T3_Aux
+      fields:
+      - unwrapT3_Aux
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef.2.raw/th.txt
@@ -0,0 +1,131 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_typedef.h
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+myInt :: Raw String
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+myInt = objectLike "MyInt" ["int"]
+{-| __C declaration:__ @union T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T1 = T1 {unwrapT1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1
+deriving via (SizedByteArray 4 4) instance ReadRaw T1
+deriving via (SizedByteArray 4 4) instance WriteRaw T1
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (SizedByteArray 4 4) instance IsUnion T1
+instance (~) ty CInt => HasField "t1_x" T1 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x" x_0)
+instance (~) ty CInt => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2_Aux
+    = T2_Aux {unwrapT2_Aux :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T2_Aux
+deriving via (SizedByteArray 4 4) instance ReadRaw T2_Aux
+deriving via (SizedByteArray 4 4) instance WriteRaw T2_Aux
+deriving via (EquivStorable T2_Aux) instance Storable T2_Aux
+deriving via (SizedByteArray 4 4) instance IsUnion T2_Aux
+instance (~) ty CInt => HasField "t2_Aux_x" T2_Aux ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t2_Aux_x" T2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_Aux_x" x_0)
+instance (~) ty CInt => HasField "t2_Aux_x" (Ptr T2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_Aux_x")
+instance HasCField T2_Aux "t2_Aux_x"
+    where type CFieldType T2_Aux "t2_Aux_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: (Ptr T2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr T2_Aux) => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty (Ptr T2_Aux) =>
+         HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = Ptr T2_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3_Aux
+    = T3_Aux {unwrapT3_Aux :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T3_Aux
+deriving via (SizedByteArray 4 4) instance ReadRaw T3_Aux
+deriving via (SizedByteArray 4 4) instance WriteRaw T3_Aux
+deriving via (EquivStorable T3_Aux) instance Storable T3_Aux
+deriving via (SizedByteArray 4 4) instance IsUnion T3_Aux
+instance (~) ty CInt => HasField "t3_Aux_x" T3_Aux ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t3_Aux_x" T3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_Aux_x" x_0)
+instance (~) ty CInt => HasField "t3_Aux_x" (Ptr T3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_Aux_x")
+instance HasCField T3_Aux "t3_Aux_x"
+    where type CFieldType T3_Aux "t3_Aux_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3
+    = T3 {unwrapT3 :: (Ptr (Ptr T3_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr T3_Aux)) => HasField "unwrapT3" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{unwrapT3 = y_1},
+                              getField @"unwrapT3" x_0)
+instance (~) ty (Ptr (Ptr T3_Aux)) =>
+         HasField "unwrapT3" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT3")
+instance HasCField T3 "unwrapT3"
+    where type CFieldType T3 "unwrapT3" = Ptr (Ptr T3_Aux)
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef/Example.hs
@@ -0,0 +1,320 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.T1(..)
+    , Example.T2_Aux(..)
+    , Example.T2(..)
+    , Example.T3_Aux(..)
+    , Example.T3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "t1_x" T1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2_Aux = T2_Aux
+  { unwrapT2_Aux :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T2_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T2_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T2_Aux
+
+deriving via Marshal.EquivStorable T2_Aux instance BG.Storable T2_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T2_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "t2_Aux_x" T2_Aux ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t2_Aux_x" T2_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_Aux_x" x0)
+
+instance ( ty ~ MyInt
+         ) => BG.HasField "t2_Aux_x" (BG.Ptr T2_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_Aux_x")
+
+instance HasCField.HasCField T2_Aux "t2_Aux_x" where
+
+  type CFieldType T2_Aux "t2_Aux_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.Ptr T2_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance ( ty ~ BG.Ptr T2_Aux
+         ) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.Ptr T2_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3_Aux = T3_Aux
+  { unwrapT3_Aux :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T3_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T3_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T3_Aux
+
+deriving via Marshal.EquivStorable T3_Aux instance BG.Storable T3_Aux
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T3_Aux
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "t3_Aux_x" T3_Aux ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t3_Aux_x" T3_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_Aux_x" x0)
+
+instance ( ty ~ MyInt
+         ) => BG.HasField "t3_Aux_x" (BG.Ptr T3_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_Aux_x")
+
+instance HasCField.HasCField T3_Aux "t3_Aux_x" where
+
+  type CFieldType T3_Aux "t3_Aux_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.Ptr (BG.Ptr T3_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.CompatHasField.HasField "unwrapT3" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T3 {unwrapT3 = y1}, BG.getField @"unwrapT3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_Aux)
+         ) => BG.HasField "unwrapT3" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT3")
+
+instance HasCField.HasCField T3 "unwrapT3" where
+
+  type CFieldType T3 "unwrapT3" =
+    BG.Ptr (BG.Ptr T3_Aux)
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef/bindingspec.yaml
@@ -0,0 +1,158 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: macro MyInt
+  hsname: MyInt
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: union T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: union @T2_Aux
+  hsname: T2_Aux
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: T2
+  hsname: T2
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: union @T3_Aux
+  hsname: T3_Aux
+- headers: macros/reparse/nesting/union_in_typedef.h
+  cname: T3
+  hsname: T3
+hstypes:
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_Aux
+  representation:
+    newtype:
+      constructor: T2_Aux
+      fields:
+      - unwrapT2_Aux
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_Aux
+  representation:
+    newtype:
+      constructor: T3_Aux
+      fields:
+      - unwrapT3_Aux
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_typedef/th.txt
@@ -0,0 +1,149 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_typedef.h
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T1 = T1 {unwrapT1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1
+deriving via (SizedByteArray 4 4) instance ReadRaw T1
+deriving via (SizedByteArray 4 4) instance WriteRaw T1
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (SizedByteArray 4 4) instance IsUnion T1
+instance (~) ty MyInt => HasField "t1_x" T1 ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x" x_0)
+instance (~) ty MyInt => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2_Aux
+    = T2_Aux {unwrapT2_Aux :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T2_Aux
+deriving via (SizedByteArray 4 4) instance ReadRaw T2_Aux
+deriving via (SizedByteArray 4 4) instance WriteRaw T2_Aux
+deriving via (EquivStorable T2_Aux) instance Storable T2_Aux
+deriving via (SizedByteArray 4 4) instance IsUnion T2_Aux
+instance (~) ty MyInt => HasField "t2_Aux_x" T2_Aux ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "t2_Aux_x" T2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_Aux_x" x_0)
+instance (~) ty MyInt => HasField "t2_Aux_x" (Ptr T2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_Aux_x")
+instance HasCField T2_Aux "t2_Aux_x"
+    where type CFieldType T2_Aux "t2_Aux_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: (Ptr T2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr T2_Aux) => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty (Ptr T2_Aux) =>
+         HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = Ptr T2_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3_Aux@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3_Aux
+    = T3_Aux {unwrapT3_Aux :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T3_Aux
+deriving via (SizedByteArray 4 4) instance ReadRaw T3_Aux
+deriving via (SizedByteArray 4 4) instance WriteRaw T3_Aux
+deriving via (EquivStorable T3_Aux) instance Storable T3_Aux
+deriving via (SizedByteArray 4 4) instance IsUnion T3_Aux
+instance (~) ty MyInt => HasField "t3_Aux_x" T3_Aux ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "t3_Aux_x" T3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_Aux_x" x_0)
+instance (~) ty MyInt => HasField "t3_Aux_x" (Ptr T3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_Aux_x")
+instance HasCField T3_Aux "t3_Aux_x"
+    where type CFieldType T3_Aux "t3_Aux_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_typedef.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_typedef.h@
+-}
+newtype T3
+    = T3 {unwrapT3 :: (Ptr (Ptr T3_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr T3_Aux)) => HasField "unwrapT3" T3 ty
+    where hasField = \x_0 -> (\y_1 -> T3{unwrapT3 = y_1},
+                              getField @"unwrapT3" x_0)
+instance (~) ty (Ptr (Ptr T3_Aux)) =>
+         HasField "unwrapT3" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT3")
+instance HasCField T3 "unwrapT3"
+    where type CFieldType T3 "unwrapT3" = Ptr (Ptr T3_Aux)
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/Example.hs
@@ -0,0 +1,357 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (type (~))
+
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1_x = T1_x
+  { unwrapT1_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1_x
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" T1_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.HasField "t1_x" T1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" T2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2_x = T2_x
+  { unwrapT2_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T2_x
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" T2_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T3
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.Ptr (BG.Ptr T3_x)) => BG.HasField "t3_x" T3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3_x = T3_x
+  { unwrapT3_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T3_x
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" T3_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/union_in_union.h>"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_44a1ef54c1044601 (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_915293812630a04d (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_e20a6c1bc9b97a9e (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (BG.Ptr T1)
+hs_bindgen_44a1ef54c1044601 =
+  fmap BG.fromFFIType hs_bindgen_44a1ef54c1044601_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_44a1ef54c1044601
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (BG.Ptr T2)
+hs_bindgen_915293812630a04d =
+  fmap BG.fromFFIType hs_bindgen_915293812630a04d_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_915293812630a04d
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (BG.Ptr T3)
+hs_bindgen_e20a6c1bc9b97a9e =
+  fmap BG.fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/bindingspec.yaml
@@ -0,0 +1,126 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T2
+  hsname: T2
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T3
+  hsname: T3
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    newtype:
+      constructor: T1_x
+      fields:
+      - unwrapT1_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    newtype:
+      constructor: T2_x
+      fields:
+      - unwrapT2_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    newtype:
+      constructor: T3_x
+      fields:
+      - unwrapT3_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.1.empty/th.txt
@@ -0,0 +1,225 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_union.h
+-- #include <macros/reparse/nesting/union_in_union.h>
+-- /* test_macrosreparsenestingunion_i_Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_44a1ef54c1044601 (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_915293812630a04d (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_e20a6c1bc9b97a9e (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1_x
+    = T1_x {unwrapT1_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T1_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T1_x
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (SizedByteArray 4 4) instance IsUnion T1_x
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x_x" x_0)
+instance (~) ty CInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1 = T1 {unwrapT1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1
+deriving via (SizedByteArray 4 4) instance ReadRaw T1
+deriving via (SizedByteArray 4 4) instance WriteRaw T1
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (SizedByteArray 4 4) instance IsUnion T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where getField = getUnionPayload
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2 = T2 {unwrapT2 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T2
+deriving via (SizedByteArray 8 8) instance ReadRaw T2
+deriving via (SizedByteArray 8 8) instance WriteRaw T2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (SizedByteArray 8 8) instance IsUnion T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2_x
+    = T2_x {unwrapT2_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T2_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T2_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T2_x
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (SizedByteArray 4 4) instance IsUnion T2_x
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x_x" x_0)
+instance (~) ty CInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3 = T3 {unwrapT3 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T3
+deriving via (SizedByteArray 8 8) instance ReadRaw T3
+deriving via (SizedByteArray 8 8) instance WriteRaw T3
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (SizedByteArray 8 8) instance IsUnion T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3_x
+    = T3_x {unwrapT3_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T3_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T3_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T3_x
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (SizedByteArray 4 4) instance IsUnion T3_x
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x_x" x_0)
+instance (~) ty CInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 = fmap fromFFIType hs_bindgen_44a1ef54c1044601_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t1 = unsafePerformIO hs_bindgen_44a1ef54c1044601
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d = fmap fromFFIType hs_bindgen_915293812630a04d_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t2 = unsafePerformIO hs_bindgen_915293812630a04d
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e = fmap fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t3 = unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/Example.hs
@@ -0,0 +1,368 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.myInt
+    , Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (String, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+myInt :: Macro.Raw String
+myInt = Macro.objectLike "MyInt" ["int"]
+
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1_x = T1_x
+  { unwrapT1_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1_x
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" T1_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.HasField "t1_x" T1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" T2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2_x = T2_x
+  { unwrapT2_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T2_x
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" T2_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T3
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.Ptr (BG.Ptr T3_x)) => BG.HasField "t3_x" T3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3_x = T3_x
+  { unwrapT3_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T3_x
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" T3_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/union_in_union.h>"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_44a1ef54c1044601 (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_915293812630a04d (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_e20a6c1bc9b97a9e (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (BG.Ptr T1)
+hs_bindgen_44a1ef54c1044601 =
+  fmap BG.fromFFIType hs_bindgen_44a1ef54c1044601_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_44a1ef54c1044601
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (BG.Ptr T2)
+hs_bindgen_915293812630a04d =
+  fmap BG.fromFFIType hs_bindgen_915293812630a04d_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_915293812630a04d
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (BG.Ptr T3)
+hs_bindgen_e20a6c1bc9b97a9e =
+  fmap BG.fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/bindingspec.yaml
@@ -0,0 +1,126 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T2
+  hsname: T2
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T3
+  hsname: T3
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    newtype:
+      constructor: T1_x
+      fields:
+      - unwrapT1_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    newtype:
+      constructor: T2_x
+      fields:
+      - unwrapT2_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    newtype:
+      constructor: T3_x
+      fields:
+      - unwrapT3_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union.2.raw/th.txt
@@ -0,0 +1,239 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_union.h
+-- #include <macros/reparse/nesting/union_in_union.h>
+-- /* test_macrosreparsenestingunion_i_Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_44a1ef54c1044601 (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_915293812630a04d (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_e20a6c1bc9b97a9e (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+myInt :: Raw String
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+myInt = objectLike "MyInt" ["int"]
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1_x
+    = T1_x {unwrapT1_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T1_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T1_x
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (SizedByteArray 4 4) instance IsUnion T1_x
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x_x" x_0)
+instance (~) ty CInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1 = T1 {unwrapT1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1
+deriving via (SizedByteArray 4 4) instance ReadRaw T1
+deriving via (SizedByteArray 4 4) instance WriteRaw T1
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (SizedByteArray 4 4) instance IsUnion T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where getField = getUnionPayload
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2 = T2 {unwrapT2 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T2
+deriving via (SizedByteArray 8 8) instance ReadRaw T2
+deriving via (SizedByteArray 8 8) instance WriteRaw T2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (SizedByteArray 8 8) instance IsUnion T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2_x
+    = T2_x {unwrapT2_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T2_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T2_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T2_x
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (SizedByteArray 4 4) instance IsUnion T2_x
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x_x" x_0)
+instance (~) ty CInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3 = T3 {unwrapT3 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T3
+deriving via (SizedByteArray 8 8) instance ReadRaw T3
+deriving via (SizedByteArray 8 8) instance WriteRaw T3
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (SizedByteArray 8 8) instance IsUnion T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3_x
+    = T3_x {unwrapT3_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T3_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T3_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T3_x
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (SizedByteArray 4 4) instance IsUnion T3_x
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x_x" x_0)
+instance (~) ty CInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 = fmap fromFFIType hs_bindgen_44a1ef54c1044601_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t1 = unsafePerformIO hs_bindgen_44a1ef54c1044601
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d = fmap fromFFIType hs_bindgen_915293812630a04d_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t2 = unsafePerformIO hs_bindgen_915293812630a04d
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e = fmap fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t3 = unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/Example.hs
@@ -0,0 +1,408 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.T1_x(..)
+    , Example.T1(..)
+    , Example.T2(..)
+    , Example.T2_x(..)
+    , Example.T3(..)
+    , Example.T3_x(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1_x = T1_x
+  { unwrapT1_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1_x
+
+deriving via Marshal.EquivStorable T1_x instance BG.Storable T1_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "t1_x_x" T1_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t1_x_x" T1_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t1_x_x" (BG.Ptr T1_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x_x")
+
+instance HasCField.HasCField T1_x "t1_x_x" where
+
+  type CFieldType T1_x "t1_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T1
+
+deriving via Marshal.EquivStorable T1 instance BG.Storable T1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.HasField "t1_x" T1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ T1_x) => BG.CompatHasField.HasField "t1_x" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t1_x" x0)
+
+instance (ty ~ T1_x) => BG.HasField "t1_x" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t1_x")
+
+instance HasCField.HasCField T1 "t1_x" where
+
+  type CFieldType T1 "t1_x" = T1_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T2
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T2
+
+deriving via Marshal.EquivStorable T2 instance BG.Storable T2
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" T2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.Ptr T2_x) => BG.CompatHasField.HasField "t2_x" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x" x0)
+
+instance (ty ~ BG.Ptr T2_x) => BG.HasField "t2_x" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x")
+
+instance HasCField.HasCField T2 "t2_x" where
+
+  type CFieldType T2 "t2_x" = BG.Ptr T2_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2_x = T2_x
+  { unwrapT2_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T2_x
+
+deriving via Marshal.EquivStorable T2_x instance BG.Storable T2_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T2_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "t2_x_x" T2_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t2_x_x" T2_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t2_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t2_x_x" (BG.Ptr T2_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t2_x_x")
+
+instance HasCField.HasCField T2_x "t2_x_x" where
+
+  type CFieldType T2_x "t2_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3 = T3
+  { unwrapT3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw T3
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw T3
+
+deriving via Marshal.EquivStorable T3 instance BG.Storable T3
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion T3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ BG.Ptr (BG.Ptr T3_x)) => BG.HasField "t3_x" T3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:31@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.CompatHasField.HasField "t3_x" T3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr T3_x)
+         ) => BG.HasField "t3_x" (BG.Ptr T3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x")
+
+instance HasCField.HasCField T3 "t3_x" where
+
+  type CFieldType T3 "t3_x" = BG.Ptr (BG.Ptr T3_x)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3_x = T3_x
+  { unwrapT3_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T3_x
+
+deriving via Marshal.EquivStorable T3_x instance BG.Storable T3_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T3_x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "t3_x_x" T3_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "t3_x_x" T3_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t3_x_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "t3_x_x" (BG.Ptr T3_x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t3_x_x")
+
+instance HasCField.HasCField T3_x "t3_x_x" where
+
+  type CFieldType T3_x "t3_x_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.t1
+    , Example.Global.t2
+    , Example.Global.t3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/union_in_union.h>"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_44a1ef54c1044601 (void)"
+  , "{"
+  , "  return &T1;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_915293812630a04d (void)"
+  , "{"
+  , "  return &T2;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_T3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_e20a6c1bc9b97a9e (void)"
+  , "{"
+  , "  return &T3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (BG.Ptr T1)
+hs_bindgen_44a1ef54c1044601 =
+  fmap BG.fromFFIType hs_bindgen_44a1ef54c1044601_base
+
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t1 :: BG.Ptr T1
+t1 = BG.unsafePerformIO hs_bindgen_44a1ef54c1044601
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (BG.Ptr T2)
+hs_bindgen_915293812630a04d =
+  fmap BG.fromFFIType hs_bindgen_915293812630a04d_base
+
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t2 :: BG.Ptr T2
+t2 = BG.unsafePerformIO hs_bindgen_915293812630a04d
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (BG.Ptr T3)
+hs_bindgen_e20a6c1bc9b97a9e =
+  fmap BG.fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t3 :: BG.Ptr T3
+t3 = BG.unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/bindingspec.yaml
@@ -0,0 +1,163 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: macro MyInt
+  hsname: MyInt
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T1
+  hsname: T1
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T1_x
+  hsname: T1_x
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T2
+  hsname: T2
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T2_x
+  hsname: T2_x
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T3
+  hsname: T3
+- headers: macros/reparse/nesting/union_in_union.h
+  cname: union @T3_x
+  hsname: T3_x
+hstypes:
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1_x
+  representation:
+    newtype:
+      constructor: T1_x
+      fields:
+      - unwrapT1_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2_x
+  representation:
+    newtype:
+      constructor: T2_x
+      fields:
+      - unwrapT2_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3
+  representation:
+    newtype:
+      constructor: T3
+      fields:
+      - unwrapT3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T3_x
+  representation:
+    newtype:
+      constructor: T3_x
+      fields:
+      - unwrapT3_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_union/th.txt
@@ -0,0 +1,257 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_union.h
+-- #include <macros/reparse/nesting/union_in_union.h>
+-- /* test_macrosreparsenestingunion_i_Example_get_T1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_44a1ef54c1044601 (void)
+-- {
+--   return &T1;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_915293812630a04d (void)
+-- {
+--   return &T2;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_T3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_e20a6c1bc9b97a9e (void)
+-- {
+--   return &T3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T1_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1_x
+    = T1_x {unwrapT1_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T1_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T1_x
+deriving via (EquivStorable T1_x) instance Storable T1_x
+deriving via (SizedByteArray 4 4) instance IsUnion T1_x
+instance (~) ty MyInt => HasField "t1_x_x" T1_x ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "t1_x_x" T1_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x_x" x_0)
+instance (~) ty MyInt => HasField "t1_x_x" (Ptr T1_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x_x")
+instance HasCField T1_x "t1_x_x"
+    where type CFieldType T1_x "t1_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T1 = T1 {unwrapT1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T1
+deriving via (SizedByteArray 4 4) instance ReadRaw T1
+deriving via (SizedByteArray 4 4) instance WriteRaw T1
+deriving via (EquivStorable T1) instance Storable T1
+deriving via (SizedByteArray 4 4) instance IsUnion T1
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where getField = getUnionPayload
+instance (~) ty T1_x => HasField "t1_x" T1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t1_x" x_0)
+instance (~) ty T1_x => HasField "t1_x" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"t1_x")
+instance HasCField T1 "t1_x"
+    where type CFieldType T1 "t1_x" = T1_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2 = T2 {unwrapT2 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T2
+deriving via (SizedByteArray 8 8) instance ReadRaw T2
+deriving via (SizedByteArray 8 8) instance WriteRaw T2
+deriving via (EquivStorable T2) instance Storable T2
+deriving via (SizedByteArray 8 8) instance IsUnion T2
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr T2_x) => HasField "t2_x" T2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x" x_0)
+instance (~) ty (Ptr T2_x) => HasField "t2_x" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x")
+instance HasCField T2 "t2_x"
+    where type CFieldType T2 "t2_x" = Ptr T2_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T2_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T2_x
+    = T2_x {unwrapT2_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T2_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T2_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T2_x
+deriving via (EquivStorable T2_x) instance Storable T2_x
+deriving via (SizedByteArray 4 4) instance IsUnion T2_x
+instance (~) ty MyInt => HasField "t2_x_x" T2_x ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "t2_x_x" T2_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t2_x_x" x_0)
+instance (~) ty MyInt => HasField "t2_x_x" (Ptr T2_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t2_x_x")
+instance HasCField T2_x "t2_x_x"
+    where type CFieldType T2_x "t2_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3 = T3 {unwrapT3 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize T3
+deriving via (SizedByteArray 8 8) instance ReadRaw T3
+deriving via (SizedByteArray 8 8) instance WriteRaw T3
+deriving via (EquivStorable T3) instance Storable T3
+deriving via (SizedByteArray 8 8) instance IsUnion T3
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where getField = getUnionPayload
+instance (~) ty (Ptr (Ptr T3_x)) => HasField "t3_x" T3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x" x_0)
+instance (~) ty (Ptr (Ptr T3_x)) =>
+         HasField "t3_x" (Ptr T3) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x")
+instance HasCField T3 "t3_x"
+    where type CFieldType T3 "t3_x" = Ptr (Ptr T3_x)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@T3_x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+newtype T3_x
+    = T3_x {unwrapT3_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T3_x
+deriving via (SizedByteArray 4 4) instance ReadRaw T3_x
+deriving via (SizedByteArray 4 4) instance WriteRaw T3_x
+deriving via (EquivStorable T3_x) instance Storable T3_x
+deriving via (SizedByteArray 4 4) instance IsUnion T3_x
+instance (~) ty MyInt => HasField "t3_x_x" T3_x ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "t3_x_x" T3_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t3_x_x" x_0)
+instance (~) ty MyInt => HasField "t3_x_x" (Ptr T3_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"t3_x_x")
+instance HasCField T3_x "t3_x_x"
+    where type CFieldType T3_x "t3_x_x" = MyInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+foreign import ccall unsafe "hs_bindgen_44a1ef54c1044601" hs_bindgen_44a1ef54c1044601_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 :: IO (Ptr T1)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T1@
+hs_bindgen_44a1ef54c1044601 = fmap fromFFIType hs_bindgen_44a1ef54c1044601_base
+{-# NOINLINE t1 #-}
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t1 :: Ptr T1
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 3:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t1 = unsafePerformIO hs_bindgen_44a1ef54c1044601
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+foreign import ccall unsafe "hs_bindgen_915293812630a04d" hs_bindgen_915293812630a04d_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d :: IO (Ptr T2)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T2@
+hs_bindgen_915293812630a04d = fmap fromFFIType hs_bindgen_915293812630a04d_base
+{-# NOINLINE t2 #-}
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t2 :: Ptr T2
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 4:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t2 = unsafePerformIO hs_bindgen_915293812630a04d
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+foreign import ccall unsafe "hs_bindgen_e20a6c1bc9b97a9e" hs_bindgen_e20a6c1bc9b97a9e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e :: IO (Ptr T3)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_T3@
+hs_bindgen_e20a6c1bc9b97a9e = fmap fromFFIType hs_bindgen_e20a6c1bc9b97a9e_base
+{-# NOINLINE t3 #-}
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t3 :: Ptr T3
+{-| __C declaration:__ @T3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_union.h 5:36@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_union.h@
+-}
+t3 = unsafePerformIO hs_bindgen_e20a6c1bc9b97a9e
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/Example.hs
@@ -0,0 +1,190 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.G1(..)
+    , Example.G2(..)
+    , Example.G3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (type (~))
+
+{-| __C declaration:__ @union \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G1 = G1
+  { unwrapG1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize G1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw G1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw G1
+
+deriving via Marshal.EquivStorable G1 instance BG.Storable G1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion G1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "g1_x" G1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g1_x" G1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"g1_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g1_x" (BG.Ptr G1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g1_x")
+
+instance HasCField.HasCField G1 "g1_x" where
+
+  type CFieldType G1 "g1_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G2 = G2
+  { unwrapG2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize G2
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw G2
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw G2
+
+deriving via Marshal.EquivStorable G2 instance BG.Storable G2
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion G2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "g2_x" G2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g2_x" G2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"g2_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g2_x" (BG.Ptr G2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g2_x")
+
+instance HasCField.HasCField G2 "g2_x" where
+
+  type CFieldType G2 "g2_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G3 = G3
+  { unwrapG3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize G3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw G3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw G3
+
+deriving via Marshal.EquivStorable G3 instance BG.Storable G3
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion G3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "g3_x" G3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g3_x" G3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"g3_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g3_x" (BG.Ptr G3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g3_x")
+
+instance HasCField.HasCField G3 "g3_x" where
+
+  type CFieldType G3 "g3_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.g1
+    , Example.Global.g2
+    , Example.Global.g3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/union_in_variable.h>"
+  , "/* test_macrosreparsenestingunion_i_Example_get_G1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_4b01ee4d60407c60 (void)"
+  , "{"
+  , "  return &G1;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_G2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_2290f6729b2485e1 (void)"
+  , "{"
+  , "  return &G2;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_G3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_1be42b84691d63f3 (void)"
+  , "{"
+  , "  return &G3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_4b01ee4d60407c60" hs_bindgen_4b01ee4d60407c60_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+hs_bindgen_4b01ee4d60407c60 :: IO (BG.Ptr G1)
+hs_bindgen_4b01ee4d60407c60 =
+  fmap BG.fromFFIType hs_bindgen_4b01ee4d60407c60_base
+
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g1 :: BG.Ptr G1
+g1 = BG.unsafePerformIO hs_bindgen_4b01ee4d60407c60
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_2290f6729b2485e1" hs_bindgen_2290f6729b2485e1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+hs_bindgen_2290f6729b2485e1 :: IO (BG.Ptr (BG.Ptr G2))
+hs_bindgen_2290f6729b2485e1 =
+  fmap BG.fromFFIType hs_bindgen_2290f6729b2485e1_base
+
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g2 :: BG.Ptr (BG.Ptr G2)
+g2 = BG.unsafePerformIO hs_bindgen_2290f6729b2485e1
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_1be42b84691d63f3" hs_bindgen_1be42b84691d63f3_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+hs_bindgen_1be42b84691d63f3 :: IO (BG.Ptr (BG.Ptr (BG.Ptr G3)))
+hs_bindgen_1be42b84691d63f3 =
+  fmap BG.fromFFIType hs_bindgen_1be42b84691d63f3_base
+
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g3 :: BG.Ptr (BG.Ptr (BG.Ptr G3))
+g3 = BG.unsafePerformIO hs_bindgen_1be42b84691d63f3
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/bindingspec.yaml
@@ -0,0 +1,66 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: union @G1
+  hsname: G1
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: union @G2
+  hsname: G2
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: union @G3
+  hsname: G3
+hstypes:
+- hsname: G1
+  representation:
+    newtype:
+      constructor: G1
+      fields:
+      - unwrapG1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G2
+  representation:
+    newtype:
+      constructor: G2
+      fields:
+      - unwrapG2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G3
+  representation:
+    newtype:
+      constructor: G3
+      fields:
+      - unwrapG3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.1.empty/th.txt
@@ -0,0 +1,152 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_variable.h
+-- #include <macros/reparse/nesting/union_in_variable.h>
+-- /* test_macrosreparsenestingunion_i_Example_get_G1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_4b01ee4d60407c60 (void)
+-- {
+--   return &G1;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_G2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_2290f6729b2485e1 (void)
+-- {
+--   return &G2;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_G3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_1be42b84691d63f3 (void)
+-- {
+--   return &G3;
+-- }
+{-| __C declaration:__ @union \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G1 = G1 {unwrapG1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize G1
+deriving via (SizedByteArray 4 4) instance ReadRaw G1
+deriving via (SizedByteArray 4 4) instance WriteRaw G1
+deriving via (EquivStorable G1) instance Storable G1
+deriving via (SizedByteArray 4 4) instance IsUnion G1
+instance (~) ty CInt => HasField "g1_x" G1 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "g1_x" G1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"g1_x" x_0)
+instance (~) ty CInt => HasField "g1_x" (Ptr G1) (Ptr ty)
+    where getField = fromPtr (Proxy @"g1_x")
+instance HasCField G1 "g1_x"
+    where type CFieldType G1 "g1_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G2 = G2 {unwrapG2 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize G2
+deriving via (SizedByteArray 4 4) instance ReadRaw G2
+deriving via (SizedByteArray 4 4) instance WriteRaw G2
+deriving via (EquivStorable G2) instance Storable G2
+deriving via (SizedByteArray 4 4) instance IsUnion G2
+instance (~) ty CInt => HasField "g2_x" G2 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "g2_x" G2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"g2_x" x_0)
+instance (~) ty CInt => HasField "g2_x" (Ptr G2) (Ptr ty)
+    where getField = fromPtr (Proxy @"g2_x")
+instance HasCField G2 "g2_x"
+    where type CFieldType G2 "g2_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G3 = G3 {unwrapG3 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize G3
+deriving via (SizedByteArray 4 4) instance ReadRaw G3
+deriving via (SizedByteArray 4 4) instance WriteRaw G3
+deriving via (EquivStorable G3) instance Storable G3
+deriving via (SizedByteArray 4 4) instance IsUnion G3
+instance (~) ty CInt => HasField "g3_x" G3 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "g3_x" G3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"g3_x" x_0)
+instance (~) ty CInt => HasField "g3_x" (Ptr G3) (Ptr ty)
+    where getField = fromPtr (Proxy @"g3_x")
+instance HasCField G3 "g3_x"
+    where type CFieldType G3 "g3_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_4b01ee4d60407c60" hs_bindgen_4b01ee4d60407c60_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+hs_bindgen_4b01ee4d60407c60 :: IO (Ptr G1)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+hs_bindgen_4b01ee4d60407c60 = fmap fromFFIType hs_bindgen_4b01ee4d60407c60_base
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g1 :: Ptr G1
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g1 = unsafePerformIO hs_bindgen_4b01ee4d60407c60
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_2290f6729b2485e1" hs_bindgen_2290f6729b2485e1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+hs_bindgen_2290f6729b2485e1 :: IO (Ptr (Ptr G2))
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+hs_bindgen_2290f6729b2485e1 = fmap fromFFIType hs_bindgen_2290f6729b2485e1_base
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g2 :: Ptr (Ptr G2)
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g2 = unsafePerformIO hs_bindgen_2290f6729b2485e1
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_1be42b84691d63f3" hs_bindgen_1be42b84691d63f3_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+hs_bindgen_1be42b84691d63f3 :: IO (Ptr (Ptr (Ptr G3)))
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+hs_bindgen_1be42b84691d63f3 = fmap fromFFIType hs_bindgen_1be42b84691d63f3_base
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g3 :: Ptr (Ptr (Ptr G3))
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g3 = unsafePerformIO hs_bindgen_1be42b84691d63f3
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/Example.hs
@@ -0,0 +1,201 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.myInt
+    , Example.G1(..)
+    , Example.G2(..)
+    , Example.G3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (String, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+myInt :: Macro.Raw String
+myInt = Macro.objectLike "MyInt" ["int"]
+
+{-| __C declaration:__ @union \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G1 = G1
+  { unwrapG1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize G1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw G1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw G1
+
+deriving via Marshal.EquivStorable G1 instance BG.Storable G1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion G1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "g1_x" G1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g1_x" G1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"g1_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g1_x" (BG.Ptr G1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g1_x")
+
+instance HasCField.HasCField G1 "g1_x" where
+
+  type CFieldType G1 "g1_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G2 = G2
+  { unwrapG2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize G2
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw G2
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw G2
+
+deriving via Marshal.EquivStorable G2 instance BG.Storable G2
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion G2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "g2_x" G2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g2_x" G2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"g2_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g2_x" (BG.Ptr G2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g2_x")
+
+instance HasCField.HasCField G2 "g2_x" where
+
+  type CFieldType G2 "g2_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G3 = G3
+  { unwrapG3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize G3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw G3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw G3
+
+deriving via Marshal.EquivStorable G3 instance BG.Storable G3
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion G3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "g3_x" G3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "g3_x" G3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"g3_x" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "g3_x" (BG.Ptr G3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g3_x")
+
+instance HasCField.HasCField G3 "g3_x" where
+
+  type CFieldType G3 "g3_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.g1
+    , Example.Global.g2
+    , Example.Global.g3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/union_in_variable.h>"
+  , "/* test_macrosreparsenestingunion_i_Example_get_G1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_4b01ee4d60407c60 (void)"
+  , "{"
+  , "  return &G1;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_G2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_2290f6729b2485e1 (void)"
+  , "{"
+  , "  return &G2;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_G3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_1be42b84691d63f3 (void)"
+  , "{"
+  , "  return &G3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_4b01ee4d60407c60" hs_bindgen_4b01ee4d60407c60_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+hs_bindgen_4b01ee4d60407c60 :: IO (BG.Ptr G1)
+hs_bindgen_4b01ee4d60407c60 =
+  fmap BG.fromFFIType hs_bindgen_4b01ee4d60407c60_base
+
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g1 :: BG.Ptr G1
+g1 = BG.unsafePerformIO hs_bindgen_4b01ee4d60407c60
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_2290f6729b2485e1" hs_bindgen_2290f6729b2485e1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+hs_bindgen_2290f6729b2485e1 :: IO (BG.Ptr (BG.Ptr G2))
+hs_bindgen_2290f6729b2485e1 =
+  fmap BG.fromFFIType hs_bindgen_2290f6729b2485e1_base
+
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g2 :: BG.Ptr (BG.Ptr G2)
+g2 = BG.unsafePerformIO hs_bindgen_2290f6729b2485e1
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_1be42b84691d63f3" hs_bindgen_1be42b84691d63f3_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+hs_bindgen_1be42b84691d63f3 :: IO (BG.Ptr (BG.Ptr (BG.Ptr G3)))
+hs_bindgen_1be42b84691d63f3 =
+  fmap BG.fromFFIType hs_bindgen_1be42b84691d63f3_base
+
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g3 :: BG.Ptr (BG.Ptr (BG.Ptr G3))
+g3 = BG.unsafePerformIO hs_bindgen_1be42b84691d63f3
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/bindingspec.yaml
@@ -0,0 +1,66 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: union @G1
+  hsname: G1
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: union @G2
+  hsname: G2
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: union @G3
+  hsname: G3
+hstypes:
+- hsname: G1
+  representation:
+    newtype:
+      constructor: G1
+      fields:
+      - unwrapG1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G2
+  representation:
+    newtype:
+      constructor: G2
+      fields:
+      - unwrapG2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G3
+  representation:
+    newtype:
+      constructor: G3
+      fields:
+      - unwrapG3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable.2.raw/th.txt
@@ -0,0 +1,166 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_variable.h
+-- #include <macros/reparse/nesting/union_in_variable.h>
+-- /* test_macrosreparsenestingunion_i_Example_get_G1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_4b01ee4d60407c60 (void)
+-- {
+--   return &G1;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_G2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_2290f6729b2485e1 (void)
+-- {
+--   return &G2;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_G3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_1be42b84691d63f3 (void)
+-- {
+--   return &G3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+myInt :: Raw String
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+myInt = objectLike "MyInt" ["int"]
+{-| __C declaration:__ @union \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G1 = G1 {unwrapG1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize G1
+deriving via (SizedByteArray 4 4) instance ReadRaw G1
+deriving via (SizedByteArray 4 4) instance WriteRaw G1
+deriving via (EquivStorable G1) instance Storable G1
+deriving via (SizedByteArray 4 4) instance IsUnion G1
+instance (~) ty CInt => HasField "g1_x" G1 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "g1_x" G1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"g1_x" x_0)
+instance (~) ty CInt => HasField "g1_x" (Ptr G1) (Ptr ty)
+    where getField = fromPtr (Proxy @"g1_x")
+instance HasCField G1 "g1_x"
+    where type CFieldType G1 "g1_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G2 = G2 {unwrapG2 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize G2
+deriving via (SizedByteArray 4 4) instance ReadRaw G2
+deriving via (SizedByteArray 4 4) instance WriteRaw G2
+deriving via (EquivStorable G2) instance Storable G2
+deriving via (SizedByteArray 4 4) instance IsUnion G2
+instance (~) ty CInt => HasField "g2_x" G2 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "g2_x" G2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"g2_x" x_0)
+instance (~) ty CInt => HasField "g2_x" (Ptr G2) (Ptr ty)
+    where getField = fromPtr (Proxy @"g2_x")
+instance HasCField G2 "g2_x"
+    where type CFieldType G2 "g2_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G3 = G3 {unwrapG3 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize G3
+deriving via (SizedByteArray 4 4) instance ReadRaw G3
+deriving via (SizedByteArray 4 4) instance WriteRaw G3
+deriving via (EquivStorable G3) instance Storable G3
+deriving via (SizedByteArray 4 4) instance IsUnion G3
+instance (~) ty CInt => HasField "g3_x" G3 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "g3_x" G3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"g3_x" x_0)
+instance (~) ty CInt => HasField "g3_x" (Ptr G3) (Ptr ty)
+    where getField = fromPtr (Proxy @"g3_x")
+instance HasCField G3 "g3_x"
+    where type CFieldType G3 "g3_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_4b01ee4d60407c60" hs_bindgen_4b01ee4d60407c60_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+hs_bindgen_4b01ee4d60407c60 :: IO (Ptr G1)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+hs_bindgen_4b01ee4d60407c60 = fmap fromFFIType hs_bindgen_4b01ee4d60407c60_base
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g1 :: Ptr G1
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g1 = unsafePerformIO hs_bindgen_4b01ee4d60407c60
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_2290f6729b2485e1" hs_bindgen_2290f6729b2485e1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+hs_bindgen_2290f6729b2485e1 :: IO (Ptr (Ptr G2))
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+hs_bindgen_2290f6729b2485e1 = fmap fromFFIType hs_bindgen_2290f6729b2485e1_base
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g2 :: Ptr (Ptr G2)
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g2 = unsafePerformIO hs_bindgen_2290f6729b2485e1
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_1be42b84691d63f3" hs_bindgen_1be42b84691d63f3_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+hs_bindgen_1be42b84691d63f3 :: IO (Ptr (Ptr (Ptr G3)))
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+hs_bindgen_1be42b84691d63f3 = fmap fromFFIType hs_bindgen_1be42b84691d63f3_base
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g3 :: Ptr (Ptr (Ptr G3))
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g3 = unsafePerformIO hs_bindgen_1be42b84691d63f3
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/Example.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/Example.hs
@@ -0,0 +1,241 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.MyInt(..)
+    , Example.G1(..)
+    , Example.G2(..)
+    , Example.G3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G1 = G1
+  { unwrapG1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize G1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw G1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw G1
+
+deriving via Marshal.EquivStorable G1 instance BG.Storable G1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion G1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "g1_x" G1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "g1_x" G1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"g1_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "g1_x" (BG.Ptr G1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g1_x")
+
+instance HasCField.HasCField G1 "g1_x" where
+
+  type CFieldType G1 "g1_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G2 = G2
+  { unwrapG2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize G2
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw G2
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw G2
+
+deriving via Marshal.EquivStorable G2 instance BG.Storable G2
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion G2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "g2_x" G2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "g2_x" G2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"g2_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "g2_x" (BG.Ptr G2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g2_x")
+
+instance HasCField.HasCField G2 "g2_x" where
+
+  type CFieldType G2 "g2_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G3 = G3
+  { unwrapG3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize G3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw G3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw G3
+
+deriving via Marshal.EquivStorable G3 instance BG.Storable G3
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion G3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ MyInt) => BG.HasField "g3_x" G3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:15@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+instance (ty ~ MyInt) => BG.CompatHasField.HasField "g3_x" G3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"g3_x" x0)
+
+instance (ty ~ MyInt) => BG.HasField "g3_x" (BG.Ptr G3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"g3_x")
+
+instance HasCField.HasCField G3 "g3_x" where
+
+  type CFieldType G3 "g3_x" = MyInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/Example/Global.hs b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/Example/Global.hs
@@ -0,0 +1,95 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.g1
+    , Example.Global.g2
+    , Example.Global.g3
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/reparse/nesting/union_in_variable.h>"
+  , "/* test_macrosreparsenestingunion_i_Example_get_G1 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_4b01ee4d60407c60 (void)"
+  , "{"
+  , "  return &G1;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_G2 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_2290f6729b2485e1 (void)"
+  , "{"
+  , "  return &G2;"
+  , "}"
+  , "/* test_macrosreparsenestingunion_i_Example_get_G3 */"
+  , "__attribute__ ((const))"
+  , "void *hs_bindgen_1be42b84691d63f3 (void)"
+  , "{"
+  , "  return &G3;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_4b01ee4d60407c60" hs_bindgen_4b01ee4d60407c60_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+hs_bindgen_4b01ee4d60407c60 :: IO (BG.Ptr G1)
+hs_bindgen_4b01ee4d60407c60 =
+  fmap BG.fromFFIType hs_bindgen_4b01ee4d60407c60_base
+
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g1 :: BG.Ptr G1
+g1 = BG.unsafePerformIO hs_bindgen_4b01ee4d60407c60
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_2290f6729b2485e1" hs_bindgen_2290f6729b2485e1_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+hs_bindgen_2290f6729b2485e1 :: IO (BG.Ptr (BG.Ptr G2))
+hs_bindgen_2290f6729b2485e1 =
+  fmap BG.fromFFIType hs_bindgen_2290f6729b2485e1_base
+
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g2 :: BG.Ptr (BG.Ptr G2)
+g2 = BG.unsafePerformIO hs_bindgen_2290f6729b2485e1
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_1be42b84691d63f3" hs_bindgen_1be42b84691d63f3_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+hs_bindgen_1be42b84691d63f3 :: IO (BG.Ptr (BG.Ptr (BG.Ptr G3)))
+hs_bindgen_1be42b84691d63f3 =
+  fmap BG.fromFFIType hs_bindgen_1be42b84691d63f3_base
+
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g3 :: BG.Ptr (BG.Ptr (BG.Ptr G3))
+g3 = BG.unsafePerformIO hs_bindgen_1be42b84691d63f3
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/bindingspec.yaml b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/bindingspec.yaml
@@ -0,0 +1,103 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: macro MyInt
+  hsname: MyInt
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: union @G1
+  hsname: G1
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: union @G2
+  hsname: G2
+- headers: macros/reparse/nesting/union_in_variable.h
+  cname: union @G3
+  hsname: G3
+hstypes:
+- hsname: G1
+  representation:
+    newtype:
+      constructor: G1
+      fields:
+      - unwrapG1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G2
+  representation:
+    newtype:
+      constructor: G2
+      fields:
+      - unwrapG2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G3
+  representation:
+    newtype:
+      constructor: G3
+      fields:
+      - unwrapG3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/th.txt b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/nesting/union_in_variable/th.txt
@@ -0,0 +1,184 @@
+-- addDependentFile test-artefacts/headers/golden/macros/reparse/nesting/union_in_variable.h
+-- #include <macros/reparse/nesting/union_in_variable.h>
+-- /* test_macrosreparsenestingunion_i_Example_get_G1 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_4b01ee4d60407c60 (void)
+-- {
+--   return &G1;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_G2 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_2290f6729b2485e1 (void)
+-- {
+--   return &G2;
+-- }
+-- /* test_macrosreparsenestingunion_i_Example_get_G3 */
+-- __attribute__ ((const))
+-- void *hs_bindgen_1be42b84691d63f3 (void)
+-- {
+--   return &G3;
+-- }
+{-| __C declaration:__ @macro MyInt@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 1:9@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G1 = G1 {unwrapG1 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize G1
+deriving via (SizedByteArray 4 4) instance ReadRaw G1
+deriving via (SizedByteArray 4 4) instance WriteRaw G1
+deriving via (EquivStorable G1) instance Storable G1
+deriving via (SizedByteArray 4 4) instance IsUnion G1
+instance (~) ty MyInt => HasField "g1_x" G1 ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "g1_x" G1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"g1_x" x_0)
+instance (~) ty MyInt => HasField "g1_x" (Ptr G1) (Ptr ty)
+    where getField = fromPtr (Proxy @"g1_x")
+instance HasCField G1 "g1_x"
+    where type CFieldType G1 "g1_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G2 = G2 {unwrapG2 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize G2
+deriving via (SizedByteArray 4 4) instance ReadRaw G2
+deriving via (SizedByteArray 4 4) instance WriteRaw G2
+deriving via (EquivStorable G2) instance Storable G2
+deriving via (SizedByteArray 4 4) instance IsUnion G2
+instance (~) ty MyInt => HasField "g2_x" G2 ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "g2_x" G2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"g2_x" x_0)
+instance (~) ty MyInt => HasField "g2_x" (Ptr G2) (Ptr ty)
+    where getField = fromPtr (Proxy @"g2_x")
+instance HasCField G2 "g2_x"
+    where type CFieldType G2 "g2_x" = MyInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:1@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+newtype G3 = G3 {unwrapG3 :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize G3
+deriving via (SizedByteArray 4 4) instance ReadRaw G3
+deriving via (SizedByteArray 4 4) instance WriteRaw G3
+deriving via (EquivStorable G3) instance Storable G3
+deriving via (SizedByteArray 4 4) instance IsUnion G3
+instance (~) ty MyInt => HasField "g3_x" G3 ty
+    where getField = getUnionPayload
+instance (~) ty MyInt => HasField "g3_x" G3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"g3_x" x_0)
+instance (~) ty MyInt => HasField "g3_x" (Ptr G3) (Ptr ty)
+    where getField = fromPtr (Proxy @"g3_x")
+instance HasCField G3 "g3_x"
+    where type CFieldType G3 "g3_x" = MyInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+foreign import ccall unsafe "hs_bindgen_4b01ee4d60407c60" hs_bindgen_4b01ee4d60407c60_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+hs_bindgen_4b01ee4d60407c60 :: IO (Ptr G1)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G1@
+hs_bindgen_4b01ee4d60407c60 = fmap fromFFIType hs_bindgen_4b01ee4d60407c60_base
+{-# NOINLINE g1 #-}
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g1 :: Ptr G1
+{-| __C declaration:__ @G1@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 3:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g1 = unsafePerformIO hs_bindgen_4b01ee4d60407c60
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+foreign import ccall unsafe "hs_bindgen_2290f6729b2485e1" hs_bindgen_2290f6729b2485e1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+hs_bindgen_2290f6729b2485e1 :: IO (Ptr (Ptr G2))
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G2@
+hs_bindgen_2290f6729b2485e1 = fmap fromFFIType hs_bindgen_2290f6729b2485e1_base
+{-# NOINLINE g2 #-}
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g2 :: Ptr (Ptr G2)
+{-| __C declaration:__ @G2@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 4:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g2 = unsafePerformIO hs_bindgen_2290f6729b2485e1
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+foreign import ccall unsafe "hs_bindgen_1be42b84691d63f3" hs_bindgen_1be42b84691d63f3_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+hs_bindgen_1be42b84691d63f3 :: IO (Ptr (Ptr (Ptr G3)))
+-- __unique:__ @test_macrosreparsenestingunion_i_Example_get_G3@
+hs_bindgen_1be42b84691d63f3 = fmap fromFFIType hs_bindgen_1be42b84691d63f3_base
+{-# NOINLINE g3 #-}
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g3 :: Ptr (Ptr (Ptr G3))
+{-| __C declaration:__ @G3@
+
+    __defined at:__ @macros\/reparse\/nesting\/union_in_variable.h 5:23@
+
+    __exported by:__ @macros\/reparse\/nesting\/union_in_variable.h@
+-}
+g3 = unsafePerformIO hs_bindgen_1be42b84691d63f3
diff --git a/test-artefacts/fixtures/macros/reparse/th.txt b/test-artefacts/fixtures/macros/reparse/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/reparse/th.txt
@@ -0,0 +1,12149 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile test-artefacts/headers/golden/macros/reparse.h
+-- #include <macros/reparse.h>
+-- void hs_bindgen_f15610128336b06a (
+--   A arg1,
+--   char arg2
+-- )
+-- {
+--   (args_char1)(arg1, arg2);
+-- }
+-- void hs_bindgen_087f45ca0a284a03 (
+--   A arg1,
+--   signed char arg2
+-- )
+-- {
+--   (args_char2)(arg1, arg2);
+-- }
+-- void hs_bindgen_f6cb5c5a728c2404 (
+--   A arg1,
+--   unsigned char arg2
+-- )
+-- {
+--   (args_char3)(arg1, arg2);
+-- }
+-- void hs_bindgen_d485767e0caa1f7c (
+--   A arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short1)(arg1, arg2);
+-- }
+-- void hs_bindgen_833c96c437533e02 (
+--   A arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short2)(arg1, arg2);
+-- }
+-- void hs_bindgen_0e1eedc3fcbcea7a (
+--   A arg1,
+--   unsigned short arg2
+-- )
+-- {
+--   (args_short3)(arg1, arg2);
+-- }
+-- void hs_bindgen_906f0ac7dfd36ab8 (
+--   A arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int1)(arg1, arg2);
+-- }
+-- void hs_bindgen_0edbc9b995b2a589 (
+--   A arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int2)(arg1, arg2);
+-- }
+-- void hs_bindgen_a5c223f58a255115 (
+--   A arg1,
+--   unsigned int arg2
+-- )
+-- {
+--   (args_int3)(arg1, arg2);
+-- }
+-- void hs_bindgen_41d1229384b9a529 (
+--   A arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long1)(arg1, arg2);
+-- }
+-- void hs_bindgen_a9a4b09fd3bd83db (
+--   A arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long2)(arg1, arg2);
+-- }
+-- void hs_bindgen_31dc2e680b3f3eff (
+--   A arg1,
+--   unsigned long arg2
+-- )
+-- {
+--   (args_long3)(arg1, arg2);
+-- }
+-- void hs_bindgen_3d400757b5cbf4b7 (
+--   A arg1,
+--   float arg2
+-- )
+-- {
+--   (args_float)(arg1, arg2);
+-- }
+-- void hs_bindgen_70df07e39900487e (
+--   A arg1,
+--   double arg2
+-- )
+-- {
+--   (args_double)(arg1, arg2);
+-- }
+-- void hs_bindgen_0b7c534fe683f843 (
+--   A arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (args_bool1)(arg1, arg2);
+-- }
+-- void hs_bindgen_b20e084f7b7941b5 (
+--   A arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   (args_struct)(arg1, *arg2);
+-- }
+-- void hs_bindgen_23aff33f33b6bdd1 (
+--   A arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   (args_union)(arg1, *arg2);
+-- }
+-- void hs_bindgen_fdd58ae14ce15ed5 (
+--   A arg1,
+--   enum some_enum arg2
+-- )
+-- {
+--   (args_enum)(arg1, arg2);
+-- }
+-- void hs_bindgen_42ce2ec4fd2eda72 (
+--   A arg1,
+--   signed int *arg2
+-- )
+-- {
+--   (args_pointer1)(arg1, arg2);
+-- }
+-- void hs_bindgen_01b2f6502d340abe (
+--   A arg1,
+--   signed int **arg2
+-- )
+-- {
+--   (args_pointer2)(arg1, arg2);
+-- }
+-- void hs_bindgen_3e64133f9aaebbf1 (
+--   A arg1,
+--   void *arg2
+-- )
+-- {
+--   (args_pointer3)(arg1, arg2);
+-- }
+-- A hs_bindgen_c830401b459192fb (void)
+-- {
+--   return (ret_A)();
+-- }
+-- char hs_bindgen_18b24c6e67a5412e (
+--   A arg1
+-- )
+-- {
+--   return (ret_char1)(arg1);
+-- }
+-- signed char hs_bindgen_2da1160aeef9ff64 (
+--   A arg1
+-- )
+-- {
+--   return (ret_char2)(arg1);
+-- }
+-- unsigned char hs_bindgen_e3183f9de1b9f231 (
+--   A arg1
+-- )
+-- {
+--   return (ret_char3)(arg1);
+-- }
+-- signed short hs_bindgen_c313966d4478e3f4 (
+--   A arg1
+-- )
+-- {
+--   return (ret_short1)(arg1);
+-- }
+-- signed short hs_bindgen_737fbec310eb0719 (
+--   A arg1
+-- )
+-- {
+--   return (ret_short2)(arg1);
+-- }
+-- unsigned short hs_bindgen_b5bd9e111020db4e (
+--   A arg1
+-- )
+-- {
+--   return (ret_short3)(arg1);
+-- }
+-- signed int hs_bindgen_a30224259287f5f8 (
+--   A arg1
+-- )
+-- {
+--   return (ret_int1)(arg1);
+-- }
+-- signed int hs_bindgen_b5be09caf8cf5750 (
+--   A arg1
+-- )
+-- {
+--   return (ret_int2)(arg1);
+-- }
+-- unsigned int hs_bindgen_698e3f97470d83be (
+--   A arg1
+-- )
+-- {
+--   return (ret_int3)(arg1);
+-- }
+-- signed long hs_bindgen_c7e0705dd09be530 (
+--   A arg1
+-- )
+-- {
+--   return (ret_long1)(arg1);
+-- }
+-- signed long hs_bindgen_74b1f5b8c56ff22c (
+--   A arg1
+-- )
+-- {
+--   return (ret_long2)(arg1);
+-- }
+-- unsigned long hs_bindgen_c2d07eaaab82d408 (
+--   A arg1
+-- )
+-- {
+--   return (ret_long3)(arg1);
+-- }
+-- float hs_bindgen_0edfbc7067faa1f7 (
+--   A arg1
+-- )
+-- {
+--   return (ret_float)(arg1);
+-- }
+-- double hs_bindgen_786ca672396b33be (
+--   A arg1
+-- )
+-- {
+--   return (ret_double)(arg1);
+-- }
+-- _Bool hs_bindgen_2e99f19b59650996 (
+--   A arg1
+-- )
+-- {
+--   return (ret_bool1)(arg1);
+-- }
+-- void hs_bindgen_6c999121eed8178f (
+--   A arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   *arg2 = (ret_struct)(arg1);
+-- }
+-- void hs_bindgen_481ee5d2d9bd34db (
+--   A arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   *arg2 = (ret_union)(arg1);
+-- }
+-- enum some_enum hs_bindgen_8bb240ba453b700d (
+--   A arg1
+-- )
+-- {
+--   return (ret_enum)(arg1);
+-- }
+-- signed int *hs_bindgen_c346ed2cd20b9af1 (
+--   A arg1
+-- )
+-- {
+--   return (ret_pointer1)(arg1);
+-- }
+-- signed int **hs_bindgen_a21f618658151728 (
+--   A arg1
+-- )
+-- {
+--   return (ret_pointer2)(arg1);
+-- }
+-- void *hs_bindgen_2d8c6e2d2f395342 (
+--   A arg1
+-- )
+-- {
+--   return (ret_pointer3)(arg1);
+-- }
+-- signed int hs_bindgen_b030d02030ed80bc (
+--   A arg1
+-- )
+-- {
+--   return (body1)(arg1);
+-- }
+-- A hs_bindgen_be50427e6a63df54 (void)
+-- {
+--   return (body2)();
+-- }
+-- void hs_bindgen_627a52a5c7617083 (
+--   A arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   (args_complex_float)(arg1, *arg2);
+-- }
+-- void hs_bindgen_392babebc1d83503 (
+--   A arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   (args_complex_double)(arg1, *arg2);
+-- }
+-- void hs_bindgen_8958183ede73dea8 (
+--   A arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_float)(arg1);
+-- }
+-- void hs_bindgen_a95fabfd391a99aa (
+--   A arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_double)(arg1);
+-- }
+-- void hs_bindgen_ad9f8630dd04a203 (
+--   A arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (bespoke_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_4b34178a505131e2 (
+--   A arg1,
+--   size_t arg2
+-- )
+-- {
+--   (bespoke_args2)(arg1, arg2);
+-- }
+-- _Bool hs_bindgen_94b225a6394496c1 (
+--   A arg1
+-- )
+-- {
+--   return (bespoke_ret1)(arg1);
+-- }
+-- size_t hs_bindgen_7c9a1792426b84a1 (
+--   A arg1
+-- )
+-- {
+--   return (bespoke_ret2)(arg1);
+-- }
+-- void hs_bindgen_e20689fe39004225 (
+--   A *arg1
+-- )
+-- {
+--   (arr_args1)(arg1);
+-- }
+-- void hs_bindgen_084796e4bfd3f4cd (
+--   A **arg1
+-- )
+-- {
+--   (arr_args2)(arg1);
+-- }
+-- void hs_bindgen_a3d1560aaa4352df (
+--   A *arg1
+-- )
+-- {
+--   (arr_args3)(arg1);
+-- }
+-- void hs_bindgen_88659ccccc6c1f5f (
+--   A **arg1
+-- )
+-- {
+--   (arr_args4)(arg1);
+-- }
+-- void hs_bindgen_3448d03cfd41161a (
+--   A arg1,
+--   void (*arg2) (void)
+-- )
+-- {
+--   (funptr_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_92d7386f0a327d25 (
+--   A arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (funptr_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_2881f594f98043e6 (
+--   A arg1,
+--   void (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (funptr_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_1e85a05df4251f62 (
+--   A arg1,
+--   char (*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_ccf4db7511f0d6d6 (
+--   A arg1,
+--   signed int *(*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args5)(arg1, arg2);
+-- }
+-- void hs_bindgen_4c756db60673d221 (
+--   A arg1
+-- )
+-- {
+--   (comments1)(arg1);
+-- }
+-- void hs_bindgen_278568d7a2a3a4b6 (
+--   A arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_87ee56525e5ea20c (
+--   A arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_c0b99594235bd99e (
+--   A arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_d718b682f157fc18 (
+--   A arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_f2c5b3d5eca68433 (
+--   A arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_ae2d994e06667b23 (
+--   A arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_6940b58e7f4397a7 (
+--   A arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_00b6fe2282e779b1 (
+--   A arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_6517cc8d39aead93 (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_68c7661e95060488 (
+--   A arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_before4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_42b3b0bf73a7a51a (
+--   A arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_before5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_c4aabe9834aac12f (
+--   A arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_before6)(arg1, arg2);
+-- }
+-- void hs_bindgen_486090a7fb4e34d4 (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before7)(arg1, arg2);
+-- }
+-- void hs_bindgen_23fa742b614176dd (
+--   A arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_before8)(arg1, arg2);
+-- }
+-- void hs_bindgen_0aacd8a5d48f296d (
+--   A arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_16ec2102221485b7 (
+--   A arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_9aa934d44ec3790c (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_043d2869e29bedcf (
+--   A arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_after4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_b5f9bca1de9d69de (
+--   A arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_after5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_77d641d518b2504f (
+--   A arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_after6)(arg1, arg2);
+-- }
+-- void hs_bindgen_691b4f2909140b49 (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after7)(arg1, arg2);
+-- }
+-- void hs_bindgen_ae74c8dcdc2ec9eb (
+--   A arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_after8)(arg1, arg2);
+-- }
+-- void hs_bindgen_07606c41eadf9146 (
+--   A arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_3836769f3a3416ac (
+--   A arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_12f19ea593aefd3f (
+--   A arg1,
+--   signed int *const arg2
+-- )
+-- {
+--   (const_pointers_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_5a50e98897696d57 (
+--   A arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_666701f7cb61bd15 (
+--   A arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args5)(arg1, arg2);
+-- }
+-- signed int const *hs_bindgen_b94fbc3dfd285563 (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret1)(arg1);
+-- }
+-- signed int const *hs_bindgen_33e2960e26b79450 (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret2)(arg1);
+-- }
+-- signed int *const hs_bindgen_50c6e2fe4f3fb777 (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret3)(arg1);
+-- }
+-- signed int const *const hs_bindgen_edc014695d896c8d (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret4)(arg1);
+-- }
+-- signed int const *const hs_bindgen_6d3308cc5847f033 (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret5)(arg1);
+-- }
+-- void hs_bindgen_678576320923a4d1 (
+--   A const *arg1
+-- )
+-- {
+--   (const_array_elem1)(arg1);
+-- }
+-- void hs_bindgen_b317941dde4eeff2 (
+--   A const **arg1
+-- )
+-- {
+--   (const_array_elem2)(arg1);
+-- }
+-- void hs_bindgen_707e602e6beb1bb6 (
+--   A *const *arg1
+-- )
+-- {
+--   (const_array_elem3)(arg1);
+-- }
+-- A hs_bindgen_93fecb4eb766c262 (void)
+-- {
+--   return (noParams1)();
+-- }
+-- A hs_bindgen_4350965157c891f5 (void)
+-- {
+--   return (noParams2)();
+-- }
+-- void hs_bindgen_c4f59272a2b1c3b5 (
+--   A arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (noParams3)(arg1, arg2);
+-- }
+-- void (*hs_bindgen_387a04c01e23c320 (
+--   A arg1
+-- )) (void)
+-- {
+--   return (funptr_ret1)(arg1);
+-- }
+-- signed int (*hs_bindgen_6f0c14cd3478dc19 (
+--   A arg1
+-- )) (void)
+-- {
+--   return (funptr_ret2)(arg1);
+-- }
+-- void (*hs_bindgen_08e8661d277cf7be (
+--   A arg1
+-- )) (
+--   signed int arg1
+-- )
+-- {
+--   return (funptr_ret3)(arg1);
+-- }
+-- char (*hs_bindgen_609b5d953b68da92 (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret4)(arg1);
+-- }
+-- signed int *(*hs_bindgen_13e6ae43abf40aee (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret5)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_a4a3a86f28ca6299 (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret6)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_eae9dff04c88d00b (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret7)(arg1);
+-- }
+-- signed int *const (*hs_bindgen_894457d90a2fc8db (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret8)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_c893eb15ad9bc68c (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret9)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_d96c258298a44b28 (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret10)(arg1);
+-- }
+-- void hs_bindgen_c1716e300ba327c7 (
+--   A arg1,
+--   char arg2
+-- )
+-- {
+--   (args_char1)(arg1, arg2);
+-- }
+-- void hs_bindgen_3ef14607a6187aaa (
+--   A arg1,
+--   signed char arg2
+-- )
+-- {
+--   (args_char2)(arg1, arg2);
+-- }
+-- void hs_bindgen_5b0a626f64912f9d (
+--   A arg1,
+--   unsigned char arg2
+-- )
+-- {
+--   (args_char3)(arg1, arg2);
+-- }
+-- void hs_bindgen_36e4501239085bc1 (
+--   A arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short1)(arg1, arg2);
+-- }
+-- void hs_bindgen_a187e0233daeb237 (
+--   A arg1,
+--   signed short arg2
+-- )
+-- {
+--   (args_short2)(arg1, arg2);
+-- }
+-- void hs_bindgen_2460adeff61561ce (
+--   A arg1,
+--   unsigned short arg2
+-- )
+-- {
+--   (args_short3)(arg1, arg2);
+-- }
+-- void hs_bindgen_4f13ab06db79b7f2 (
+--   A arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int1)(arg1, arg2);
+-- }
+-- void hs_bindgen_f1657d18f6f8a1ed (
+--   A arg1,
+--   signed int arg2
+-- )
+-- {
+--   (args_int2)(arg1, arg2);
+-- }
+-- void hs_bindgen_9ac58b8eb806be42 (
+--   A arg1,
+--   unsigned int arg2
+-- )
+-- {
+--   (args_int3)(arg1, arg2);
+-- }
+-- void hs_bindgen_f73c59fe22a9870e (
+--   A arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long1)(arg1, arg2);
+-- }
+-- void hs_bindgen_84a824853fc83077 (
+--   A arg1,
+--   signed long arg2
+-- )
+-- {
+--   (args_long2)(arg1, arg2);
+-- }
+-- void hs_bindgen_c4c1a08ddf9cd5bc (
+--   A arg1,
+--   unsigned long arg2
+-- )
+-- {
+--   (args_long3)(arg1, arg2);
+-- }
+-- void hs_bindgen_58a6b5f118525c6c (
+--   A arg1,
+--   float arg2
+-- )
+-- {
+--   (args_float)(arg1, arg2);
+-- }
+-- void hs_bindgen_ffc58625c3a51d8f (
+--   A arg1,
+--   double arg2
+-- )
+-- {
+--   (args_double)(arg1, arg2);
+-- }
+-- void hs_bindgen_51fb2da1d100c9a7 (
+--   A arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (args_bool1)(arg1, arg2);
+-- }
+-- void hs_bindgen_b2d19f91a7b9f7d3 (
+--   A arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   (args_struct)(arg1, *arg2);
+-- }
+-- void hs_bindgen_bc74164a05d282c7 (
+--   A arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   (args_union)(arg1, *arg2);
+-- }
+-- void hs_bindgen_69f08c1d9f5e590e (
+--   A arg1,
+--   enum some_enum arg2
+-- )
+-- {
+--   (args_enum)(arg1, arg2);
+-- }
+-- void hs_bindgen_785b005f35d4d7ec (
+--   A arg1,
+--   signed int *arg2
+-- )
+-- {
+--   (args_pointer1)(arg1, arg2);
+-- }
+-- void hs_bindgen_edc45a1b9750dcd3 (
+--   A arg1,
+--   signed int **arg2
+-- )
+-- {
+--   (args_pointer2)(arg1, arg2);
+-- }
+-- void hs_bindgen_102895862f35ca35 (
+--   A arg1,
+--   void *arg2
+-- )
+-- {
+--   (args_pointer3)(arg1, arg2);
+-- }
+-- A hs_bindgen_78f9ea765accb501 (void)
+-- {
+--   return (ret_A)();
+-- }
+-- char hs_bindgen_e1e99ef9fc54a288 (
+--   A arg1
+-- )
+-- {
+--   return (ret_char1)(arg1);
+-- }
+-- signed char hs_bindgen_f6217639a7e142d3 (
+--   A arg1
+-- )
+-- {
+--   return (ret_char2)(arg1);
+-- }
+-- unsigned char hs_bindgen_759b6cec946323f4 (
+--   A arg1
+-- )
+-- {
+--   return (ret_char3)(arg1);
+-- }
+-- signed short hs_bindgen_bf062c8332405f82 (
+--   A arg1
+-- )
+-- {
+--   return (ret_short1)(arg1);
+-- }
+-- signed short hs_bindgen_3d9d5e4b8135169a (
+--   A arg1
+-- )
+-- {
+--   return (ret_short2)(arg1);
+-- }
+-- unsigned short hs_bindgen_63b44610868e424f (
+--   A arg1
+-- )
+-- {
+--   return (ret_short3)(arg1);
+-- }
+-- signed int hs_bindgen_1a8d68c887085fbf (
+--   A arg1
+-- )
+-- {
+--   return (ret_int1)(arg1);
+-- }
+-- signed int hs_bindgen_f64653c7b4576075 (
+--   A arg1
+-- )
+-- {
+--   return (ret_int2)(arg1);
+-- }
+-- unsigned int hs_bindgen_d2030910b711f1d8 (
+--   A arg1
+-- )
+-- {
+--   return (ret_int3)(arg1);
+-- }
+-- signed long hs_bindgen_2d6a30810e6b27e3 (
+--   A arg1
+-- )
+-- {
+--   return (ret_long1)(arg1);
+-- }
+-- signed long hs_bindgen_02885fe1cf2771da (
+--   A arg1
+-- )
+-- {
+--   return (ret_long2)(arg1);
+-- }
+-- unsigned long hs_bindgen_888c9704132541d5 (
+--   A arg1
+-- )
+-- {
+--   return (ret_long3)(arg1);
+-- }
+-- float hs_bindgen_2d2ce0d386f26293 (
+--   A arg1
+-- )
+-- {
+--   return (ret_float)(arg1);
+-- }
+-- double hs_bindgen_de353a737de53428 (
+--   A arg1
+-- )
+-- {
+--   return (ret_double)(arg1);
+-- }
+-- _Bool hs_bindgen_91e2ab77e68f0288 (
+--   A arg1
+-- )
+-- {
+--   return (ret_bool1)(arg1);
+-- }
+-- void hs_bindgen_9f29c7eee02f6d53 (
+--   A arg1,
+--   struct some_struct *arg2
+-- )
+-- {
+--   *arg2 = (ret_struct)(arg1);
+-- }
+-- void hs_bindgen_6844bf5f5a5f6681 (
+--   A arg1,
+--   union some_union *arg2
+-- )
+-- {
+--   *arg2 = (ret_union)(arg1);
+-- }
+-- enum some_enum hs_bindgen_f96c4bc30b6b17e8 (
+--   A arg1
+-- )
+-- {
+--   return (ret_enum)(arg1);
+-- }
+-- signed int *hs_bindgen_bfb6069e1423e7a5 (
+--   A arg1
+-- )
+-- {
+--   return (ret_pointer1)(arg1);
+-- }
+-- signed int **hs_bindgen_ffae633548386d89 (
+--   A arg1
+-- )
+-- {
+--   return (ret_pointer2)(arg1);
+-- }
+-- void *hs_bindgen_550cb4a23c6ab2ff (
+--   A arg1
+-- )
+-- {
+--   return (ret_pointer3)(arg1);
+-- }
+-- signed int hs_bindgen_f7a7a45a80ae39f7 (
+--   A arg1
+-- )
+-- {
+--   return (body1)(arg1);
+-- }
+-- A hs_bindgen_364e73b014d7d4df (void)
+-- {
+--   return (body2)();
+-- }
+-- void hs_bindgen_88b4cd11afc4f6c1 (
+--   A arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   (args_complex_float)(arg1, *arg2);
+-- }
+-- void hs_bindgen_0ddc53d8e91cb32a (
+--   A arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   (args_complex_double)(arg1, *arg2);
+-- }
+-- void hs_bindgen_eb82eb840e288900 (
+--   A arg1,
+--   float _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_float)(arg1);
+-- }
+-- void hs_bindgen_cbc25ea9cbdd2365 (
+--   A arg1,
+--   double _Complex *arg2
+-- )
+-- {
+--   *arg2 = (ret_complex_double)(arg1);
+-- }
+-- void hs_bindgen_3258de4ffd2c08af (
+--   A arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (bespoke_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_74b2cd1defdd5609 (
+--   A arg1,
+--   size_t arg2
+-- )
+-- {
+--   (bespoke_args2)(arg1, arg2);
+-- }
+-- _Bool hs_bindgen_5405c1e037d1e115 (
+--   A arg1
+-- )
+-- {
+--   return (bespoke_ret1)(arg1);
+-- }
+-- size_t hs_bindgen_a6a3e5a828532360 (
+--   A arg1
+-- )
+-- {
+--   return (bespoke_ret2)(arg1);
+-- }
+-- void hs_bindgen_4956a52bf5073b9f (
+--   A *arg1
+-- )
+-- {
+--   (arr_args1)(arg1);
+-- }
+-- void hs_bindgen_0fc8b091085a88e9 (
+--   A **arg1
+-- )
+-- {
+--   (arr_args2)(arg1);
+-- }
+-- void hs_bindgen_ca6f1bc1a29b85f8 (
+--   A *arg1
+-- )
+-- {
+--   (arr_args3)(arg1);
+-- }
+-- void hs_bindgen_a168ae0de206febe (
+--   A **arg1
+-- )
+-- {
+--   (arr_args4)(arg1);
+-- }
+-- void hs_bindgen_8e63f57f1f5d662e (
+--   A arg1,
+--   void (*arg2) (void)
+-- )
+-- {
+--   (funptr_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_927bd07f48d05d21 (
+--   A arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (funptr_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_c82e078d3c54a6bc (
+--   A arg1,
+--   void (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   (funptr_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_211ad1ac5399caec (
+--   A arg1,
+--   char (*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_9057c59d70e815d7 (
+--   A arg1,
+--   signed int *(*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   (funptr_args5)(arg1, arg2);
+-- }
+-- void hs_bindgen_153515e0ff74574f (
+--   A arg1
+-- )
+-- {
+--   (comments1)(arg1);
+-- }
+-- void hs_bindgen_8cc833db463cc95c (
+--   A arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_d767bbef00031d57 (
+--   A arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_a36dfeb811993297 (
+--   A arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_d7fa2440be24e954 (
+--   A arg1,
+--   char const arg2
+-- )
+-- {
+--   (const_prim_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_c169229f24baf752 (
+--   A arg1,
+--   signed char const arg2
+-- )
+-- {
+--   (const_prim_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_c0780f7624ed1d3e (
+--   A arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   (const_prim_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_fda903bc1139b1d6 (
+--   A arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_before1)(arg1, arg2);
+-- }
+-- void hs_bindgen_a5a70f3be654ea00 (
+--   A arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_before2)(arg1, arg2);
+-- }
+-- void hs_bindgen_b813910f6a632ce2 (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before3)(arg1, arg2);
+-- }
+-- void hs_bindgen_dc22b02b2f53aa5b (
+--   A arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_before4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_503736261279760d (
+--   A arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_before5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_ed0a8c0e15f5d2ce (
+--   A arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_before6)(arg1, arg2);
+-- }
+-- void hs_bindgen_4659c22d39cc1bb3 (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_before7)(arg1, arg2);
+-- }
+-- void hs_bindgen_530245b77093b08c (
+--   A arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_before8)(arg1, arg2);
+-- }
+-- void hs_bindgen_c31a804bd742193e (
+--   A arg1,
+--   float const arg2
+-- )
+-- {
+--   (const_withoutSign_after1)(arg1, arg2);
+-- }
+-- void hs_bindgen_53756fa3a68ab067 (
+--   A arg1,
+--   double const arg2
+-- )
+-- {
+--   (const_withoutSign_after2)(arg1, arg2);
+-- }
+-- void hs_bindgen_4134ad71149d6139 (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after3)(arg1, arg2);
+-- }
+-- void hs_bindgen_3de6157427334101 (
+--   A arg1,
+--   struct some_struct const *arg2
+-- )
+-- {
+--   (const_withoutSign_after4)(arg1, *arg2);
+-- }
+-- void hs_bindgen_fc4ef8c9107c1ae6 (
+--   A arg1,
+--   union some_union const *arg2
+-- )
+-- {
+--   (const_withoutSign_after5)(arg1, *arg2);
+-- }
+-- void hs_bindgen_5e20c60b725ae606 (
+--   A arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   (const_withoutSign_after6)(arg1, arg2);
+-- }
+-- void hs_bindgen_a0f20d4b9a07ff5b (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   (const_withoutSign_after7)(arg1, arg2);
+-- }
+-- void hs_bindgen_3a020035eb2fe7f8 (
+--   A arg1,
+--   size_t const arg2
+-- )
+-- {
+--   (const_withoutSign_after8)(arg1, arg2);
+-- }
+-- void hs_bindgen_17623ba5065bf95d (
+--   A arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args1)(arg1, arg2);
+-- }
+-- void hs_bindgen_02d08ccd5df88a98 (
+--   A arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   (const_pointers_args2)(arg1, arg2);
+-- }
+-- void hs_bindgen_50c423f2237cb6b5 (
+--   A arg1,
+--   signed int *const arg2
+-- )
+-- {
+--   (const_pointers_args3)(arg1, arg2);
+-- }
+-- void hs_bindgen_99c29c45d78348e9 (
+--   A arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args4)(arg1, arg2);
+-- }
+-- void hs_bindgen_6a92dbfae24b1bcd (
+--   A arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   (const_pointers_args5)(arg1, arg2);
+-- }
+-- signed int const *hs_bindgen_0c07f1e0256fd705 (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret1)(arg1);
+-- }
+-- signed int const *hs_bindgen_d12c8210ff3c3711 (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret2)(arg1);
+-- }
+-- signed int *const hs_bindgen_a58bc0be6f564801 (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret3)(arg1);
+-- }
+-- signed int const *const hs_bindgen_622bb8150470138b (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret4)(arg1);
+-- }
+-- signed int const *const hs_bindgen_d49bd331ad2077e5 (
+--   A arg1
+-- )
+-- {
+--   return (const_pointers_ret5)(arg1);
+-- }
+-- void hs_bindgen_224608f780bff5bd (
+--   A const *arg1
+-- )
+-- {
+--   (const_array_elem1)(arg1);
+-- }
+-- void hs_bindgen_9aa74ad89f2c1fba (
+--   A const **arg1
+-- )
+-- {
+--   (const_array_elem2)(arg1);
+-- }
+-- void hs_bindgen_6a328300c5ef0c9e (
+--   A *const *arg1
+-- )
+-- {
+--   (const_array_elem3)(arg1);
+-- }
+-- A hs_bindgen_13a7d78e11555d58 (void)
+-- {
+--   return (noParams1)();
+-- }
+-- A hs_bindgen_672f4691ee7a367c (void)
+-- {
+--   return (noParams2)();
+-- }
+-- void hs_bindgen_591f84e2163a5d18 (
+--   A arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   (noParams3)(arg1, arg2);
+-- }
+-- void (*hs_bindgen_8cdf7774adb0f0b4 (
+--   A arg1
+-- )) (void)
+-- {
+--   return (funptr_ret1)(arg1);
+-- }
+-- signed int (*hs_bindgen_a4e08267a9070ede (
+--   A arg1
+-- )) (void)
+-- {
+--   return (funptr_ret2)(arg1);
+-- }
+-- void (*hs_bindgen_65fa30510d244cbf (
+--   A arg1
+-- )) (
+--   signed int arg1
+-- )
+-- {
+--   return (funptr_ret3)(arg1);
+-- }
+-- char (*hs_bindgen_da12eaec295883aa (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret4)(arg1);
+-- }
+-- signed int *(*hs_bindgen_281c53214b1cdcb4 (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret5)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_16628c257aa64a76 (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret6)(arg1);
+-- }
+-- signed int const *(*hs_bindgen_79fb0c30f546a547 (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret7)(arg1);
+-- }
+-- signed int *const (*hs_bindgen_4668d2ff9d5bfc40 (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret8)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_c044d7074789febc (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret9)(arg1);
+-- }
+-- signed int const *const (*hs_bindgen_628ced6eccc7783a (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return (funptr_ret10)(arg1);
+-- }
+-- /* test_macrosreparse_Example_get_args_char1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ba0c80bfdbc677bd (void)) (
+--   A arg1,
+--   char arg2
+-- )
+-- {
+--   return &args_char1;
+-- }
+-- /* test_macrosreparse_Example_get_args_char2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b1e8a2d5e3935f61 (void)) (
+--   A arg1,
+--   signed char arg2
+-- )
+-- {
+--   return &args_char2;
+-- }
+-- /* test_macrosreparse_Example_get_args_char3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_deb136b9b9d89650 (void)) (
+--   A arg1,
+--   unsigned char arg2
+-- )
+-- {
+--   return &args_char3;
+-- }
+-- /* test_macrosreparse_Example_get_args_short1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7a71d1e1867636bf (void)) (
+--   A arg1,
+--   signed short arg2
+-- )
+-- {
+--   return &args_short1;
+-- }
+-- /* test_macrosreparse_Example_get_args_short2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ad7132b76947c638 (void)) (
+--   A arg1,
+--   signed short arg2
+-- )
+-- {
+--   return &args_short2;
+-- }
+-- /* test_macrosreparse_Example_get_args_short3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f4842ac12be0c136 (void)) (
+--   A arg1,
+--   unsigned short arg2
+-- )
+-- {
+--   return &args_short3;
+-- }
+-- /* test_macrosreparse_Example_get_args_int1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3dc6ae7bb850c676 (void)) (
+--   A arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &args_int1;
+-- }
+-- /* test_macrosreparse_Example_get_args_int2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a76cb45502a6ea40 (void)) (
+--   A arg1,
+--   signed int arg2
+-- )
+-- {
+--   return &args_int2;
+-- }
+-- /* test_macrosreparse_Example_get_args_int3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_99f48290fac28118 (void)) (
+--   A arg1,
+--   unsigned int arg2
+-- )
+-- {
+--   return &args_int3;
+-- }
+-- /* test_macrosreparse_Example_get_args_long1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_60a477b55893fa8e (void)) (
+--   A arg1,
+--   signed long arg2
+-- )
+-- {
+--   return &args_long1;
+-- }
+-- /* test_macrosreparse_Example_get_args_long2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9ba7a90039c212ea (void)) (
+--   A arg1,
+--   signed long arg2
+-- )
+-- {
+--   return &args_long2;
+-- }
+-- /* test_macrosreparse_Example_get_args_long3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b44cf380afb4d650 (void)) (
+--   A arg1,
+--   unsigned long arg2
+-- )
+-- {
+--   return &args_long3;
+-- }
+-- /* test_macrosreparse_Example_get_args_float */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b46cc7463fd36e1a (void)) (
+--   A arg1,
+--   float arg2
+-- )
+-- {
+--   return &args_float;
+-- }
+-- /* test_macrosreparse_Example_get_args_double */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_eb95876c1227b1d6 (void)) (
+--   A arg1,
+--   double arg2
+-- )
+-- {
+--   return &args_double;
+-- }
+-- /* test_macrosreparse_Example_get_args_bool1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_340ecf91e1edd759 (void)) (
+--   A arg1,
+--   _Bool arg2
+-- )
+-- {
+--   return &args_bool1;
+-- }
+-- /* test_macrosreparse_Example_get_args_struct */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_940fccf4ff28ad11 (void)) (
+--   A arg1,
+--   struct some_struct arg2
+-- )
+-- {
+--   return &args_struct;
+-- }
+-- /* test_macrosreparse_Example_get_args_union */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c0ae19f85578b58d (void)) (
+--   A arg1,
+--   union some_union arg2
+-- )
+-- {
+--   return &args_union;
+-- }
+-- /* test_macrosreparse_Example_get_args_enum */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_6f4ca5d36cd98d5e (void)) (
+--   A arg1,
+--   enum some_enum arg2
+-- )
+-- {
+--   return &args_enum;
+-- }
+-- /* test_macrosreparse_Example_get_args_pointer1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8f02d93a83f3e2f3 (void)) (
+--   A arg1,
+--   signed int *arg2
+-- )
+-- {
+--   return &args_pointer1;
+-- }
+-- /* test_macrosreparse_Example_get_args_pointer2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3217d3d95482b1ac (void)) (
+--   A arg1,
+--   signed int **arg2
+-- )
+-- {
+--   return &args_pointer2;
+-- }
+-- /* test_macrosreparse_Example_get_args_pointer3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_8e680c501eeba095 (void)) (
+--   A arg1,
+--   void *arg2
+-- )
+-- {
+--   return &args_pointer3;
+-- }
+-- /* test_macrosreparse_Example_get_ret_A */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_dfceb7c79cda3aab (void)) (void)
+-- {
+--   return &ret_A;
+-- }
+-- /* test_macrosreparse_Example_get_ret_char1 */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_d30074ed19081e69 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_char1;
+-- }
+-- /* test_macrosreparse_Example_get_ret_char2 */
+-- __attribute__ ((const))
+-- signed char (*hs_bindgen_c9a2d554e9d3e7e2 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_char2;
+-- }
+-- /* test_macrosreparse_Example_get_ret_char3 */
+-- __attribute__ ((const))
+-- unsigned char (*hs_bindgen_261f4f5dd5925788 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_char3;
+-- }
+-- /* test_macrosreparse_Example_get_ret_short1 */
+-- __attribute__ ((const))
+-- signed short (*hs_bindgen_8d5fba739ef413a8 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_short1;
+-- }
+-- /* test_macrosreparse_Example_get_ret_short2 */
+-- __attribute__ ((const))
+-- signed short (*hs_bindgen_5dbda022b4ddeeb7 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_short2;
+-- }
+-- /* test_macrosreparse_Example_get_ret_short3 */
+-- __attribute__ ((const))
+-- unsigned short (*hs_bindgen_8bfdaeda59194c69 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_short3;
+-- }
+-- /* test_macrosreparse_Example_get_ret_int1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_6b977384ffcfa7c6 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_int1;
+-- }
+-- /* test_macrosreparse_Example_get_ret_int2 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_cc47d3f794021505 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_int2;
+-- }
+-- /* test_macrosreparse_Example_get_ret_int3 */
+-- __attribute__ ((const))
+-- unsigned int (*hs_bindgen_488fbaf79c234569 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_int3;
+-- }
+-- /* test_macrosreparse_Example_get_ret_long1 */
+-- __attribute__ ((const))
+-- signed long (*hs_bindgen_8cf14a89b1268b17 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_long1;
+-- }
+-- /* test_macrosreparse_Example_get_ret_long2 */
+-- __attribute__ ((const))
+-- signed long (*hs_bindgen_617e98b076d9fd82 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_long2;
+-- }
+-- /* test_macrosreparse_Example_get_ret_long3 */
+-- __attribute__ ((const))
+-- unsigned long (*hs_bindgen_e1892d8eb6a27221 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_long3;
+-- }
+-- /* test_macrosreparse_Example_get_ret_float */
+-- __attribute__ ((const))
+-- float (*hs_bindgen_db7561d69f707657 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_float;
+-- }
+-- /* test_macrosreparse_Example_get_ret_double */
+-- __attribute__ ((const))
+-- double (*hs_bindgen_e37ad3e87e7cf4de (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_double;
+-- }
+-- /* test_macrosreparse_Example_get_ret_bool1 */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_07705133d0d853ee (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_bool1;
+-- }
+-- /* test_macrosreparse_Example_get_ret_struct */
+-- __attribute__ ((const))
+-- struct some_struct (*hs_bindgen_72cf2ef70b845850 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_struct;
+-- }
+-- /* test_macrosreparse_Example_get_ret_union */
+-- __attribute__ ((const))
+-- union some_union (*hs_bindgen_fe31acee84b319c8 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_union;
+-- }
+-- /* test_macrosreparse_Example_get_ret_enum */
+-- __attribute__ ((const))
+-- enum some_enum (*hs_bindgen_0ec7e00f11946277 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_enum;
+-- }
+-- /* test_macrosreparse_Example_get_ret_pointer1 */
+-- __attribute__ ((const))
+-- signed int *(*hs_bindgen_b09c0f340896fe06 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_pointer1;
+-- }
+-- /* test_macrosreparse_Example_get_ret_pointer2 */
+-- __attribute__ ((const))
+-- signed int **(*hs_bindgen_300fabb661902701 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_pointer2;
+-- }
+-- /* test_macrosreparse_Example_get_ret_pointer3 */
+-- __attribute__ ((const))
+-- void *(*hs_bindgen_12135a6384fcfda7 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_pointer3;
+-- }
+-- /* test_macrosreparse_Example_get_body1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_f6ce3e885e11b623 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &body1;
+-- }
+-- /* test_macrosreparse_Example_get_body2 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_a7010032c19e6947 (void)) (void)
+-- {
+--   return &body2;
+-- }
+-- /* test_macrosreparse_Example_get_args_complex_float */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b9a5de00354a54fe (void)) (
+--   A arg1,
+--   float _Complex arg2
+-- )
+-- {
+--   return &args_complex_float;
+-- }
+-- /* test_macrosreparse_Example_get_args_complex_double */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_824a00413581d46c (void)) (
+--   A arg1,
+--   double _Complex arg2
+-- )
+-- {
+--   return &args_complex_double;
+-- }
+-- /* test_macrosreparse_Example_get_ret_complex_float */
+-- __attribute__ ((const))
+-- float _Complex (*hs_bindgen_685d6c0a58e9b874 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_complex_float;
+-- }
+-- /* test_macrosreparse_Example_get_ret_complex_double */
+-- __attribute__ ((const))
+-- double _Complex (*hs_bindgen_0dea6be8e06122eb (void)) (
+--   A arg1
+-- )
+-- {
+--   return &ret_complex_double;
+-- }
+-- /* test_macrosreparse_Example_get_bespoke_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_cd799b883e59eadd (void)) (
+--   A arg1,
+--   _Bool arg2
+-- )
+-- {
+--   return &bespoke_args1;
+-- }
+-- /* test_macrosreparse_Example_get_bespoke_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_eabc3e2c716b0250 (void)) (
+--   A arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &bespoke_args2;
+-- }
+-- /* test_macrosreparse_Example_get_bespoke_ret1 */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_8a47565361a0290f (void)) (
+--   A arg1
+-- )
+-- {
+--   return &bespoke_ret1;
+-- }
+-- /* test_macrosreparse_Example_get_bespoke_ret2 */
+-- __attribute__ ((const))
+-- size_t (*hs_bindgen_384c8ceed3a4ca90 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &bespoke_ret2;
+-- }
+-- /* test_macrosreparse_Example_get_arr_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b38b526cf0817bf0 (void)) (
+--   A *arg1
+-- )
+-- {
+--   return &arr_args1;
+-- }
+-- /* test_macrosreparse_Example_get_arr_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2c0bca39b42ecbec (void)) (
+--   A **arg1
+-- )
+-- {
+--   return &arr_args2;
+-- }
+-- /* test_macrosreparse_Example_get_arr_args3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_82a8c15919ae3f33 (void)) (
+--   A *arg1
+-- )
+-- {
+--   return &arr_args3;
+-- }
+-- /* test_macrosreparse_Example_get_arr_args4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_db074918e0d38cb5 (void)) (
+--   A **arg1
+-- )
+-- {
+--   return &arr_args4;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_3fd6d1fbd060ffcf (void)) (
+--   A arg1,
+--   void (*arg2) (void)
+-- )
+-- {
+--   return &funptr_args1;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_300abb7b10649797 (void)) (
+--   A arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   return &funptr_args2;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_args3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_78d109e353e05225 (void)) (
+--   A arg1,
+--   void (*arg2) (
+--   signed int arg1
+-- )
+-- )
+-- {
+--   return &funptr_args3;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_args4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ee1815fa9e1c1131 (void)) (
+--   A arg1,
+--   char (*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   return &funptr_args4;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_args5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_146c4cb7cf7def11 (void)) (
+--   A arg1,
+--   signed int *(*arg2) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- )
+-- {
+--   return &funptr_args5;
+-- }
+-- /* test_macrosreparse_Example_get_comments1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7f647ffb81758d69 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &comments1;
+-- }
+-- /* test_macrosreparse_Example_get_const_prim_before1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ecf341da5dabe306 (void)) (
+--   A arg1,
+--   char const arg2
+-- )
+-- {
+--   return &const_prim_before1;
+-- }
+-- /* test_macrosreparse_Example_get_const_prim_before2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_a0276bc4dac995c4 (void)) (
+--   A arg1,
+--   signed char const arg2
+-- )
+-- {
+--   return &const_prim_before2;
+-- }
+-- /* test_macrosreparse_Example_get_const_prim_before3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_1555fc380f4c34ba (void)) (
+--   A arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   return &const_prim_before3;
+-- }
+-- /* test_macrosreparse_Example_get_const_prim_after1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e88405f039754f3c (void)) (
+--   A arg1,
+--   char const arg2
+-- )
+-- {
+--   return &const_prim_after1;
+-- }
+-- /* test_macrosreparse_Example_get_const_prim_after2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d267bc5333a36861 (void)) (
+--   A arg1,
+--   signed char const arg2
+-- )
+-- {
+--   return &const_prim_after2;
+-- }
+-- /* test_macrosreparse_Example_get_const_prim_after3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0e08cac4148d54cd (void)) (
+--   A arg1,
+--   unsigned char const arg2
+-- )
+-- {
+--   return &const_prim_after3;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_before1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d7140c03594ba60a (void)) (
+--   A arg1,
+--   float const arg2
+-- )
+-- {
+--   return &const_withoutSign_before1;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_before2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_92134abe381cef04 (void)) (
+--   A arg1,
+--   double const arg2
+-- )
+-- {
+--   return &const_withoutSign_before2;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_before3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_b80a2c12f1bdb050 (void)) (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_before3;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_before4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_aa0ffa330554de35 (void)) (
+--   A arg1,
+--   struct some_struct const arg2
+-- )
+-- {
+--   return &const_withoutSign_before4;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_before5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_f59abb8a7dffe11f (void)) (
+--   A arg1,
+--   union some_union const arg2
+-- )
+-- {
+--   return &const_withoutSign_before5;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_before6 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_0df28ff2ac7fa1e0 (void)) (
+--   A arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   return &const_withoutSign_before6;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_before7 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fa8c89b169233a6a (void)) (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_before7;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_before8 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e707228d3913a299 (void)) (
+--   A arg1,
+--   size_t const arg2
+-- )
+-- {
+--   return &const_withoutSign_before8;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_after1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7e7703a610cd6783 (void)) (
+--   A arg1,
+--   float const arg2
+-- )
+-- {
+--   return &const_withoutSign_after1;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_after2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_988863a241cb28f2 (void)) (
+--   A arg1,
+--   double const arg2
+-- )
+-- {
+--   return &const_withoutSign_after2;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_after3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c8182ee9a3467005 (void)) (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_after3;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_after4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_de1e4bbac808bcbc (void)) (
+--   A arg1,
+--   struct some_struct const arg2
+-- )
+-- {
+--   return &const_withoutSign_after4;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_after5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_746fb03c27f16031 (void)) (
+--   A arg1,
+--   union some_union const arg2
+-- )
+-- {
+--   return &const_withoutSign_after5;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_after6 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_dc174ac598e92a95 (void)) (
+--   A arg1,
+--   enum some_enum const arg2
+-- )
+-- {
+--   return &const_withoutSign_after6;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_after7 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_2c8ddc46cb100dd9 (void)) (
+--   A arg1,
+--   _Bool const arg2
+-- )
+-- {
+--   return &const_withoutSign_after7;
+-- }
+-- /* test_macrosreparse_Example_get_const_withoutSign_after8 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fdf87fbad31246de (void)) (
+--   A arg1,
+--   size_t const arg2
+-- )
+-- {
+--   return &const_withoutSign_after8;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_args1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_38808e8aa92d3bcb (void)) (
+--   A arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return &const_pointers_args1;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_args2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_4d37887fd82ab559 (void)) (
+--   A arg1,
+--   signed int const *arg2
+-- )
+-- {
+--   return &const_pointers_args2;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_args3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_fd675a45f1682dd5 (void)) (
+--   A arg1,
+--   signed int *const arg2
+-- )
+-- {
+--   return &const_pointers_args3;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_args4 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_824cb2084c63b803 (void)) (
+--   A arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   return &const_pointers_args4;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_args5 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_25bdd13aed8f26c4 (void)) (
+--   A arg1,
+--   signed int const *const arg2
+-- )
+-- {
+--   return &const_pointers_args5;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_ret1 */
+-- __attribute__ ((const))
+-- signed int const *(*hs_bindgen_f494124b53592961 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &const_pointers_ret1;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_ret2 */
+-- __attribute__ ((const))
+-- signed int const *(*hs_bindgen_32c4b858ef4f3bb8 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &const_pointers_ret2;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_ret3 */
+-- __attribute__ ((const))
+-- signed int *const (*hs_bindgen_110afe05c6d47b7c (void)) (
+--   A arg1
+-- )
+-- {
+--   return &const_pointers_ret3;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_ret4 */
+-- __attribute__ ((const))
+-- signed int const *const (*hs_bindgen_042a426acfeaa051 (void)) (
+--   A arg1
+-- )
+-- {
+--   return &const_pointers_ret4;
+-- }
+-- /* test_macrosreparse_Example_get_const_pointers_ret5 */
+-- __attribute__ ((const))
+-- signed int const *const (*hs_bindgen_bc3cdc03ae3274bd (void)) (
+--   A arg1
+-- )
+-- {
+--   return &const_pointers_ret5;
+-- }
+-- /* test_macrosreparse_Example_get_const_array_elem1 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_ae95c15a81eacd52 (void)) (
+--   A const *arg1
+-- )
+-- {
+--   return &const_array_elem1;
+-- }
+-- /* test_macrosreparse_Example_get_const_array_elem2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9dbbae3758752935 (void)) (
+--   A const **arg1
+-- )
+-- {
+--   return &const_array_elem2;
+-- }
+-- /* test_macrosreparse_Example_get_const_array_elem3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_9fdb904f0c0776ed (void)) (
+--   A *const *arg1
+-- )
+-- {
+--   return &const_array_elem3;
+-- }
+-- /* test_macrosreparse_Example_get_noParams1 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_cd9806a214acd0fa (void)) (void)
+-- {
+--   return &noParams1;
+-- }
+-- /* test_macrosreparse_Example_get_noParams2 */
+-- __attribute__ ((const))
+-- A (*hs_bindgen_7c7bf9b5a41ea4a9 (void)) (void)
+-- {
+--   return &noParams2;
+-- }
+-- /* test_macrosreparse_Example_get_noParams3 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7f154653725d104d (void)) (
+--   A arg1,
+--   signed int (*arg2) (void)
+-- )
+-- {
+--   return &noParams3;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret1 */
+-- __attribute__ ((const))
+-- void (*(*hs_bindgen_4460dd1d93c2df6f (void)) (
+--   A arg1
+-- )) (void)
+-- {
+--   return &funptr_ret1;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret2 */
+-- __attribute__ ((const))
+-- signed int (*(*hs_bindgen_2b8d04e0fe71178b (void)) (
+--   A arg1
+-- )) (void)
+-- {
+--   return &funptr_ret2;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret3 */
+-- __attribute__ ((const))
+-- void (*(*hs_bindgen_27d05f98fe1e869b (void)) (
+--   A arg1
+-- )) (
+--   signed int arg1
+-- )
+-- {
+--   return &funptr_ret3;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret4 */
+-- __attribute__ ((const))
+-- char (*(*hs_bindgen_f55fb889881240c6 (void)) (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret4;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret5 */
+-- __attribute__ ((const))
+-- signed int *(*(*hs_bindgen_e59cbfc52cec7177 (void)) (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret5;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret6 */
+-- __attribute__ ((const))
+-- signed int const *(*(*hs_bindgen_f94486b884c7cd44 (void)) (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret6;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret7 */
+-- __attribute__ ((const))
+-- signed int const *(*(*hs_bindgen_7810d75b42b3bed8 (void)) (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret7;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret8 */
+-- __attribute__ ((const))
+-- signed int *const (*(*hs_bindgen_fc12014317abd6b4 (void)) (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret8;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret9 */
+-- __attribute__ ((const))
+-- signed int const *const (*(*hs_bindgen_cf3bf1d8470acad4 (void)) (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret9;
+-- }
+-- /* test_macrosreparse_Example_get_funptr_ret10 */
+-- __attribute__ ((const))
+-- signed int const *const (*(*hs_bindgen_44a7eb47cf87f092 (void)) (
+--   A arg1
+-- )) (
+--   signed int arg1,
+--   double arg2
+-- )
+-- {
+--   return &funptr_ret10;
+-- }
+-- /* test_macrosreparse_Example_get_global1 */
+-- __attribute__ ((const))
+-- A *hs_bindgen_feda7c77651645fe (void)
+-- {
+--   return &global1;
+-- }
+-- /* test_macrosreparse_Example_get_global2 */
+-- __attribute__ ((const))
+-- A **hs_bindgen_61b4abc5e1afa043 (void)
+-- {
+--   return &global2;
+-- }
+-- /* test_macrosreparse_Example_get_global3 */
+-- __attribute__ ((const))
+-- A ***hs_bindgen_f9bcb9580741dbc1 (void)
+-- {
+--   return &global3;
+-- }
+-- /* test_macrosreparse_Example_get_const1 */
+-- __attribute__ ((const))
+-- A const *hs_bindgen_044004234e2019f6 (void)
+-- {
+--   return &const1;
+-- }
+-- /* test_macrosreparse_Example_get_const2 */
+-- __attribute__ ((const))
+-- A *const *hs_bindgen_6c69b6e35fe122c5 (void)
+-- {
+--   return &const2;
+-- }
+-- /* test_macrosreparse_Example_get_const3 */
+-- __attribute__ ((const))
+-- A **const *hs_bindgen_da21ad94b09d46ae (void)
+-- {
+--   return &const3;
+-- }
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @macros\/reparse.h 3:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype A
+    = A {unwrapA :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty CInt => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct some_struct@
+
+    __defined at:__ @macros\/reparse.h 7:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Some_struct
+    = Some_struct {}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Some_struct
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Some_struct
+    where readRaw = \ptr_0 -> pure Some_struct
+instance WriteRaw Some_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Some_struct -> pure ()
+deriving via (EquivStorable Some_struct) instance Storable Some_struct
+deriving via (IsStructViaReadRaw Some_struct) instance IsStruct Some_struct
+{-| __C declaration:__ @union some_union@
+
+    __defined at:__ @macros\/reparse.h 8:7@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_union
+    = Some_union {unwrapSome_union :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 0 1) instance StaticSize Some_union
+deriving via (SizedByteArray 0 1) instance ReadRaw Some_union
+deriving via (SizedByteArray 0 1) instance WriteRaw Some_union
+deriving via (EquivStorable Some_union) instance Storable Some_union
+deriving via (SizedByteArray 0 1) instance IsUnion Some_union
+{-| __C declaration:__ @enum some_enum@
+
+    __defined at:__ @macros\/reparse.h 9:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Some_enum
+    = Some_enum {unwrapSome_enum :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Some_enum
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Some_enum
+    where readRaw = \ptr_0 -> pure Some_enum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Some_enum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Some_enum unwrapSome_enum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapSome_enum_2
+deriving via (EquivStorable Some_enum) instance Storable Some_enum
+deriving via CUInt instance Prim Some_enum
+instance CEnum Some_enum
+    where type CEnumZ Some_enum = CUInt
+          toCEnum = Some_enum
+          fromCEnum = getField @"unwrapSome_enum"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "ENUM_A")]
+          showsUndeclared = showsWrappedUndeclared "Some_enum"
+          readPrecUndeclared = readPrecWrappedUndeclared "Some_enum"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Some_enum
+    where minDeclaredValue = ENUM_A
+          maxDeclaredValue = ENUM_A
+instance Show Some_enum
+    where showsPrec = shows
+instance Read Some_enum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapSome_enum" Some_enum ty
+    where hasField = \x_0 -> (\y_1 -> Some_enum{unwrapSome_enum = y_1},
+                              getField @"unwrapSome_enum" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapSome_enum" (Ptr Some_enum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSome_enum")
+instance HasCField Some_enum "unwrapSome_enum"
+    where type CFieldType Some_enum "unwrapSome_enum" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @ENUM_A@
+
+    __defined at:__ @macros\/reparse.h 9:18@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+pattern ENUM_A :: Some_enum
+pattern ENUM_A = Some_enum 0
+{-| __C declaration:__ @arr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 109:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef1
+    = Arr_typedef1 {unwrapArr_typedef1 :: (IncompleteArray A)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray A) =>
+         HasField "unwrapArr_typedef1" Arr_typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef1{unwrapArr_typedef1 = y_1},
+                              getField @"unwrapArr_typedef1" x_0)
+instance (~) ty (IncompleteArray A) =>
+         HasField "unwrapArr_typedef1" (Ptr Arr_typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef1")
+instance HasCField Arr_typedef1 "unwrapArr_typedef1"
+    where type CFieldType Arr_typedef1
+                          "unwrapArr_typedef1" = IncompleteArray A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @arr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 110:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef2
+    = Arr_typedef2 {unwrapArr_typedef2 :: (IncompleteArray (Ptr A))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray (Ptr A)) =>
+         HasField "unwrapArr_typedef2" Arr_typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef2{unwrapArr_typedef2 = y_1},
+                              getField @"unwrapArr_typedef2" x_0)
+instance (~) ty (IncompleteArray (Ptr A)) =>
+         HasField "unwrapArr_typedef2" (Ptr Arr_typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef2")
+instance HasCField Arr_typedef2 "unwrapArr_typedef2"
+    where type CFieldType Arr_typedef2
+                          "unwrapArr_typedef2" = IncompleteArray (Ptr A)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @arr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 111:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef3
+    = Arr_typedef3 {unwrapArr_typedef3 :: (ConstantArray 5 A)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 5 A) =>
+         HasField "unwrapArr_typedef3" Arr_typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef3{unwrapArr_typedef3 = y_1},
+                              getField @"unwrapArr_typedef3" x_0)
+instance (~) ty (ConstantArray 5 A) =>
+         HasField "unwrapArr_typedef3" (Ptr Arr_typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef3")
+instance HasCField Arr_typedef3 "unwrapArr_typedef3"
+    where type CFieldType Arr_typedef3
+                          "unwrapArr_typedef3" = ConstantArray 5 A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @arr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 112:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Arr_typedef4
+    = Arr_typedef4 {unwrapArr_typedef4 :: (ConstantArray 5 (Ptr A))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 5 (Ptr A)) =>
+         HasField "unwrapArr_typedef4" Arr_typedef4 ty
+    where hasField = \x_0 -> (\y_1 -> Arr_typedef4{unwrapArr_typedef4 = y_1},
+                              getField @"unwrapArr_typedef4" x_0)
+instance (~) ty (ConstantArray 5 (Ptr A)) =>
+         HasField "unwrapArr_typedef4" (Ptr Arr_typedef4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapArr_typedef4")
+instance HasCField Arr_typedef4 "unwrapArr_typedef4"
+    where type CFieldType Arr_typedef4
+                          "unwrapArr_typedef4" = ConstantArray 5 (Ptr A)
+          offset# = \_ -> \_ -> 0
+{-| Typedefs
+
+    __C declaration:__ @typedef1@
+
+    __defined at:__ @macros\/reparse.h 118:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef1
+    = Typedef1 {unwrapTypedef1 :: A}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty A => HasField "unwrapTypedef1" Typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Typedef1{unwrapTypedef1 = y_1},
+                              getField @"unwrapTypedef1" x_0)
+instance (~) ty A =>
+         HasField "unwrapTypedef1" (Ptr Typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypedef1")
+instance HasCField Typedef1 "unwrapTypedef1"
+    where type CFieldType Typedef1 "unwrapTypedef1" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @typedef2@
+
+    __defined at:__ @macros\/reparse.h 119:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef2
+    = Typedef2 {unwrapTypedef2 :: (Ptr A)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr A) => HasField "unwrapTypedef2" Typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Typedef2{unwrapTypedef2 = y_1},
+                              getField @"unwrapTypedef2" x_0)
+instance (~) ty (Ptr A) =>
+         HasField "unwrapTypedef2" (Ptr Typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypedef2")
+instance HasCField Typedef2 "unwrapTypedef2"
+    where type CFieldType Typedef2 "unwrapTypedef2" = Ptr A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @typedef3@
+
+    __defined at:__ @macros\/reparse.h 120:14@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Typedef3
+    = Typedef3 {unwrapTypedef3 :: (Ptr (Ptr A))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr A)) =>
+         HasField "unwrapTypedef3" Typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Typedef3{unwrapTypedef3 = y_1},
+                              getField @"unwrapTypedef3" x_0)
+instance (~) ty (Ptr (Ptr A)) =>
+         HasField "unwrapTypedef3" (Ptr Typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTypedef3")
+instance HasCField Typedef3 "unwrapTypedef3"
+    where type CFieldType Typedef3 "unwrapTypedef3" = Ptr (Ptr A)
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef1'
+
+    __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1_Aux
+    = Funptr_typedef1_Aux {unwrapFunptr_typedef1_Aux :: (IO A)}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c584d0f839fd43de_base ::
+    IO CInt
+ -> IO (FunPtr (IO CInt))
+-- __unique:__ @toFunptr_typedef1_Aux@
+hs_bindgen_c584d0f839fd43de :: Funptr_typedef1_Aux ->
+                               IO (FunPtr Funptr_typedef1_Aux)
+-- __unique:__ @toFunptr_typedef1_Aux@
+hs_bindgen_c584d0f839fd43de = \fun_0 -> fmap castFunPtr (hs_bindgen_c584d0f839fd43de_base (fmap toFFIType (getField @"unwrapFunptr_typedef1_Aux" fun_0)))
+-- __unique:__ @fromFunptr_typedef1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_806a46dc418a062c_base ::
+    FunPtr (IO CInt)
+ -> IO CInt
+-- __unique:__ @fromFunptr_typedef1_Aux@
+hs_bindgen_806a46dc418a062c :: FunPtr Funptr_typedef1_Aux ->
+                               Funptr_typedef1_Aux
+-- __unique:__ @fromFunptr_typedef1_Aux@
+hs_bindgen_806a46dc418a062c = \funPtr_0 -> Funptr_typedef1_Aux (fmap fromFFIType (hs_bindgen_806a46dc418a062c_base (castFunPtr funPtr_0)))
+instance ToFunPtr Funptr_typedef1_Aux
+    where toFunPtr = hs_bindgen_c584d0f839fd43de
+instance FromFunPtr Funptr_typedef1_Aux
+    where fromFunPtr = hs_bindgen_806a46dc418a062c
+instance (~) ty (IO A) =>
+         HasField "unwrapFunptr_typedef1_Aux" Funptr_typedef1_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef1_Aux{unwrapFunptr_typedef1_Aux = y_1},
+                              getField @"unwrapFunptr_typedef1_Aux" x_0)
+instance (~) ty (IO A) =>
+         HasField "unwrapFunptr_typedef1_Aux"
+                  (Ptr Funptr_typedef1_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef1_Aux")
+instance HasCField Funptr_typedef1_Aux "unwrapFunptr_typedef1_Aux"
+    where type CFieldType Funptr_typedef1_Aux
+                          "unwrapFunptr_typedef1_Aux" = IO A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef1@
+
+    __defined at:__ @macros\/reparse.h 132:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef1
+    = Funptr_typedef1 {unwrapFunptr_typedef1 :: (FunPtr Funptr_typedef1_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef1_Aux) =>
+         HasField "unwrapFunptr_typedef1" Funptr_typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef1{unwrapFunptr_typedef1 = y_1},
+                              getField @"unwrapFunptr_typedef1" x_0)
+instance (~) ty (FunPtr Funptr_typedef1_Aux) =>
+         HasField "unwrapFunptr_typedef1" (Ptr Funptr_typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef1")
+instance HasCField Funptr_typedef1 "unwrapFunptr_typedef1"
+    where type CFieldType Funptr_typedef1
+                          "unwrapFunptr_typedef1" = FunPtr Funptr_typedef1_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef2'
+
+    __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2_Aux
+    = Funptr_typedef2_Aux {unwrapFunptr_typedef2_Aux :: (IO (Ptr A))}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_f174457a161ac5a0_base ::
+    IO (Ptr Void)
+ -> IO (FunPtr (IO (Ptr Void)))
+-- __unique:__ @toFunptr_typedef2_Aux@
+hs_bindgen_f174457a161ac5a0 :: Funptr_typedef2_Aux ->
+                               IO (FunPtr Funptr_typedef2_Aux)
+-- __unique:__ @toFunptr_typedef2_Aux@
+hs_bindgen_f174457a161ac5a0 = \fun_0 -> fmap castFunPtr (hs_bindgen_f174457a161ac5a0_base (fmap toFFIType (getField @"unwrapFunptr_typedef2_Aux" fun_0)))
+-- __unique:__ @fromFunptr_typedef2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_323d07dff85b802c_base ::
+    FunPtr (IO (Ptr Void))
+ -> IO (Ptr Void)
+-- __unique:__ @fromFunptr_typedef2_Aux@
+hs_bindgen_323d07dff85b802c :: FunPtr Funptr_typedef2_Aux ->
+                               Funptr_typedef2_Aux
+-- __unique:__ @fromFunptr_typedef2_Aux@
+hs_bindgen_323d07dff85b802c = \funPtr_0 -> Funptr_typedef2_Aux (fmap fromFFIType (hs_bindgen_323d07dff85b802c_base (castFunPtr funPtr_0)))
+instance ToFunPtr Funptr_typedef2_Aux
+    where toFunPtr = hs_bindgen_f174457a161ac5a0
+instance FromFunPtr Funptr_typedef2_Aux
+    where fromFunPtr = hs_bindgen_323d07dff85b802c
+instance (~) ty (IO (Ptr A)) =>
+         HasField "unwrapFunptr_typedef2_Aux" Funptr_typedef2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef2_Aux{unwrapFunptr_typedef2_Aux = y_1},
+                              getField @"unwrapFunptr_typedef2_Aux" x_0)
+instance (~) ty (IO (Ptr A)) =>
+         HasField "unwrapFunptr_typedef2_Aux"
+                  (Ptr Funptr_typedef2_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef2_Aux")
+instance HasCField Funptr_typedef2_Aux "unwrapFunptr_typedef2_Aux"
+    where type CFieldType Funptr_typedef2_Aux
+                          "unwrapFunptr_typedef2_Aux" = IO (Ptr A)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef2@
+
+    __defined at:__ @macros\/reparse.h 133:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef2
+    = Funptr_typedef2 {unwrapFunptr_typedef2 :: (FunPtr Funptr_typedef2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef2_Aux) =>
+         HasField "unwrapFunptr_typedef2" Funptr_typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef2{unwrapFunptr_typedef2 = y_1},
+                              getField @"unwrapFunptr_typedef2" x_0)
+instance (~) ty (FunPtr Funptr_typedef2_Aux) =>
+         HasField "unwrapFunptr_typedef2" (Ptr Funptr_typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef2")
+instance HasCField Funptr_typedef2 "unwrapFunptr_typedef2"
+    where type CFieldType Funptr_typedef2
+                          "unwrapFunptr_typedef2" = FunPtr Funptr_typedef2_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef3'
+
+    __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3_Aux
+    = Funptr_typedef3_Aux {unwrapFunptr_typedef3_Aux :: (IO (Ptr (Ptr A)))}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_031d1a7decd790d8_base ::
+    IO (Ptr Void)
+ -> IO (FunPtr (IO (Ptr Void)))
+-- __unique:__ @toFunptr_typedef3_Aux@
+hs_bindgen_031d1a7decd790d8 :: Funptr_typedef3_Aux ->
+                               IO (FunPtr Funptr_typedef3_Aux)
+-- __unique:__ @toFunptr_typedef3_Aux@
+hs_bindgen_031d1a7decd790d8 = \fun_0 -> fmap castFunPtr (hs_bindgen_031d1a7decd790d8_base (fmap toFFIType (getField @"unwrapFunptr_typedef3_Aux" fun_0)))
+-- __unique:__ @fromFunptr_typedef3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_82dc7b932974117e_base ::
+    FunPtr (IO (Ptr Void))
+ -> IO (Ptr Void)
+-- __unique:__ @fromFunptr_typedef3_Aux@
+hs_bindgen_82dc7b932974117e :: FunPtr Funptr_typedef3_Aux ->
+                               Funptr_typedef3_Aux
+-- __unique:__ @fromFunptr_typedef3_Aux@
+hs_bindgen_82dc7b932974117e = \funPtr_0 -> Funptr_typedef3_Aux (fmap fromFFIType (hs_bindgen_82dc7b932974117e_base (castFunPtr funPtr_0)))
+instance ToFunPtr Funptr_typedef3_Aux
+    where toFunPtr = hs_bindgen_031d1a7decd790d8
+instance FromFunPtr Funptr_typedef3_Aux
+    where fromFunPtr = hs_bindgen_82dc7b932974117e
+instance (~) ty (IO (Ptr (Ptr A))) =>
+         HasField "unwrapFunptr_typedef3_Aux" Funptr_typedef3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef3_Aux{unwrapFunptr_typedef3_Aux = y_1},
+                              getField @"unwrapFunptr_typedef3_Aux" x_0)
+instance (~) ty (IO (Ptr (Ptr A))) =>
+         HasField "unwrapFunptr_typedef3_Aux"
+                  (Ptr Funptr_typedef3_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef3_Aux")
+instance HasCField Funptr_typedef3_Aux "unwrapFunptr_typedef3_Aux"
+    where type CFieldType Funptr_typedef3_Aux
+                          "unwrapFunptr_typedef3_Aux" = IO (Ptr (Ptr A))
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef3@
+
+    __defined at:__ @macros\/reparse.h 134:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef3
+    = Funptr_typedef3 {unwrapFunptr_typedef3 :: (FunPtr Funptr_typedef3_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef3_Aux) =>
+         HasField "unwrapFunptr_typedef3" Funptr_typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef3{unwrapFunptr_typedef3 = y_1},
+                              getField @"unwrapFunptr_typedef3" x_0)
+instance (~) ty (FunPtr Funptr_typedef3_Aux) =>
+         HasField "unwrapFunptr_typedef3" (Ptr Funptr_typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef3")
+instance HasCField Funptr_typedef3 "unwrapFunptr_typedef3"
+    where type CFieldType Funptr_typedef3
+                          "unwrapFunptr_typedef3" = FunPtr Funptr_typedef3_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef4'
+
+    __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4_Aux
+    = Funptr_typedef4_Aux {unwrapFunptr_typedef4_Aux :: (CInt ->
+                                                         CDouble -> IO A)}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_da2336d254667386_base ::
+    CInt -> CDouble -> IO CInt
+ -> IO (FunPtr (CInt -> CDouble -> IO CInt))
+-- __unique:__ @toFunptr_typedef4_Aux@
+hs_bindgen_da2336d254667386 :: Funptr_typedef4_Aux ->
+                               IO (FunPtr Funptr_typedef4_Aux)
+-- __unique:__ @toFunptr_typedef4_Aux@
+hs_bindgen_da2336d254667386 = \fun_0 -> fmap castFunPtr (hs_bindgen_da2336d254667386_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapFunptr_typedef4_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromFunptr_typedef4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_d4a97954476da161_base ::
+    FunPtr (CInt -> CDouble -> IO CInt)
+ -> CInt
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @fromFunptr_typedef4_Aux@
+hs_bindgen_d4a97954476da161 :: FunPtr Funptr_typedef4_Aux ->
+                               Funptr_typedef4_Aux
+-- __unique:__ @fromFunptr_typedef4_Aux@
+hs_bindgen_d4a97954476da161 = \funPtr_0 -> Funptr_typedef4_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_d4a97954476da161_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Funptr_typedef4_Aux
+    where toFunPtr = hs_bindgen_da2336d254667386
+instance FromFunPtr Funptr_typedef4_Aux
+    where fromFunPtr = hs_bindgen_d4a97954476da161
+instance (~) ty (CInt -> CDouble -> IO A) =>
+         HasField "unwrapFunptr_typedef4_Aux" Funptr_typedef4_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef4_Aux{unwrapFunptr_typedef4_Aux = y_1},
+                              getField @"unwrapFunptr_typedef4_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO A) =>
+         HasField "unwrapFunptr_typedef4_Aux"
+                  (Ptr Funptr_typedef4_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef4_Aux")
+instance HasCField Funptr_typedef4_Aux "unwrapFunptr_typedef4_Aux"
+    where type CFieldType Funptr_typedef4_Aux
+                          "unwrapFunptr_typedef4_Aux" = CInt -> CDouble -> IO A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef4@
+
+    __defined at:__ @macros\/reparse.h 135:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef4
+    = Funptr_typedef4 {unwrapFunptr_typedef4 :: (FunPtr Funptr_typedef4_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef4_Aux) =>
+         HasField "unwrapFunptr_typedef4" Funptr_typedef4 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef4{unwrapFunptr_typedef4 = y_1},
+                              getField @"unwrapFunptr_typedef4" x_0)
+instance (~) ty (FunPtr Funptr_typedef4_Aux) =>
+         HasField "unwrapFunptr_typedef4" (Ptr Funptr_typedef4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef4")
+instance HasCField Funptr_typedef4 "unwrapFunptr_typedef4"
+    where type CFieldType Funptr_typedef4
+                          "unwrapFunptr_typedef4" = FunPtr Funptr_typedef4_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Funptr_typedef5'
+
+    __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5_Aux
+    = Funptr_typedef5_Aux {unwrapFunptr_typedef5_Aux :: (CInt ->
+                                                         CDouble -> IO (Ptr A))}
+    deriving stock Generic
+-- __unique:__ @toFunptr_typedef5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_1f45632f07742a46_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toFunptr_typedef5_Aux@
+hs_bindgen_1f45632f07742a46 :: Funptr_typedef5_Aux ->
+                               IO (FunPtr Funptr_typedef5_Aux)
+-- __unique:__ @toFunptr_typedef5_Aux@
+hs_bindgen_1f45632f07742a46 = \fun_0 -> fmap castFunPtr (hs_bindgen_1f45632f07742a46_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapFunptr_typedef5_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromFunptr_typedef5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_0bd1877eaaba0d3e_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromFunptr_typedef5_Aux@
+hs_bindgen_0bd1877eaaba0d3e :: FunPtr Funptr_typedef5_Aux ->
+                               Funptr_typedef5_Aux
+-- __unique:__ @fromFunptr_typedef5_Aux@
+hs_bindgen_0bd1877eaaba0d3e = \funPtr_0 -> Funptr_typedef5_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_0bd1877eaaba0d3e_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Funptr_typedef5_Aux
+    where toFunPtr = hs_bindgen_1f45632f07742a46
+instance FromFunPtr Funptr_typedef5_Aux
+    where fromFunPtr = hs_bindgen_0bd1877eaaba0d3e
+instance (~) ty (CInt -> CDouble -> IO (Ptr A)) =>
+         HasField "unwrapFunptr_typedef5_Aux" Funptr_typedef5_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef5_Aux{unwrapFunptr_typedef5_Aux = y_1},
+                              getField @"unwrapFunptr_typedef5_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (Ptr A)) =>
+         HasField "unwrapFunptr_typedef5_Aux"
+                  (Ptr Funptr_typedef5_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef5_Aux")
+instance HasCField Funptr_typedef5_Aux "unwrapFunptr_typedef5_Aux"
+    where type CFieldType Funptr_typedef5_Aux
+                          "unwrapFunptr_typedef5_Aux" = CInt -> CDouble -> IO (Ptr A)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @funptr_typedef5@
+
+    __defined at:__ @macros\/reparse.h 136:16@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Funptr_typedef5
+    = Funptr_typedef5 {unwrapFunptr_typedef5 :: (FunPtr Funptr_typedef5_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Funptr_typedef5_Aux) =>
+         HasField "unwrapFunptr_typedef5" Funptr_typedef5 ty
+    where hasField = \x_0 -> (\y_1 -> Funptr_typedef5{unwrapFunptr_typedef5 = y_1},
+                              getField @"unwrapFunptr_typedef5" x_0)
+instance (~) ty (FunPtr Funptr_typedef5_Aux) =>
+         HasField "unwrapFunptr_typedef5" (Ptr Funptr_typedef5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunptr_typedef5")
+instance HasCField Funptr_typedef5 "unwrapFunptr_typedef5"
+    where type CFieldType Funptr_typedef5
+                          "unwrapFunptr_typedef5" = FunPtr Funptr_typedef5_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @comments2@
+
+    __defined at:__ @macros\/reparse.h 145:30@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Comments2
+    = Comments2 {unwrapComments2 :: A}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty A => HasField "unwrapComments2" Comments2 ty
+    where hasField = \x_0 -> (\y_1 -> Comments2{unwrapComments2 = y_1},
+                              getField @"unwrapComments2" x_0)
+instance (~) ty A =>
+         HasField "unwrapComments2" (Ptr Comments2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapComments2")
+instance HasCField Comments2 "unwrapComments2"
+    where type CFieldType Comments2 "unwrapComments2" = A
+          offset# = \_ -> \_ -> 0
+{-| Struct fields
+
+    __C declaration:__ @struct example_struct@
+
+    __defined at:__ @macros\/reparse.h 151:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct
+    = Example_struct {example_struct_field1 :: A
+                      {- ^ __C declaration:__ @field1@
+
+                           __defined at:__ @macros\/reparse.h 152:8@
+
+                           __exported by:__ @macros\/reparse.h@
+                      -},
+                      example_struct_field2 :: (Ptr A)
+                      {- ^ __C declaration:__ @field2@
+
+                           __defined at:__ @macros\/reparse.h 153:8@
+
+                           __exported by:__ @macros\/reparse.h@
+                      -},
+                      example_struct_field3 :: (Ptr (Ptr A))
+                      {- ^ __C declaration:__ @field3@
+
+                           __defined at:__ @macros\/reparse.h 154:8@
+
+                           __exported by:__ @macros\/reparse.h@
+                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Example_struct
+    where staticSizeOf = \_ -> 24 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Example_struct
+    where readRaw = \ptr_0 -> ((pure Example_struct <*> readRaw (Proxy @"example_struct_field1") ptr_0) <*> readRaw (Proxy @"example_struct_field2") ptr_0) <*> readRaw (Proxy @"example_struct_field3") ptr_0
+instance WriteRaw Example_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Example_struct example_struct_field1_2
+                                                      example_struct_field2_3
+                                                      example_struct_field3_4 -> writeRaw (Proxy @"example_struct_field1") ptr_0 example_struct_field1_2 >> (writeRaw (Proxy @"example_struct_field2") ptr_0 example_struct_field2_3 >> writeRaw (Proxy @"example_struct_field3") ptr_0 example_struct_field3_4)
+deriving via (EquivStorable Example_struct) instance Storable Example_struct
+deriving via (IsStructViaReadRaw Example_struct) instance IsStruct Example_struct
+instance (~) ty A =>
+         HasField "example_struct_field1" Example_struct ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct{example_struct_field1 = y_1,
+                                                     example_struct_field2 = getField @"example_struct_field2" x_0,
+                                                     example_struct_field3 = getField @"example_struct_field3" x_0},
+                              getField @"example_struct_field1" x_0)
+instance (~) ty A =>
+         HasField "example_struct_field1" (Ptr Example_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_field1")
+instance HasCField Example_struct "example_struct_field1"
+    where type CFieldType Example_struct "example_struct_field1" = A
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr A) =>
+         HasField "example_struct_field2" Example_struct ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct{example_struct_field2 = y_1,
+                                                     example_struct_field1 = getField @"example_struct_field1" x_0,
+                                                     example_struct_field3 = getField @"example_struct_field3" x_0},
+                              getField @"example_struct_field2" x_0)
+instance (~) ty (Ptr A) =>
+         HasField "example_struct_field2" (Ptr Example_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_field2")
+instance HasCField Example_struct "example_struct_field2"
+    where type CFieldType Example_struct
+                          "example_struct_field2" = Ptr A
+          offset# = \_ -> \_ -> 8
+instance (~) ty (Ptr (Ptr A)) =>
+         HasField "example_struct_field3" Example_struct ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct{example_struct_field3 = y_1,
+                                                     example_struct_field1 = getField @"example_struct_field1" x_0,
+                                                     example_struct_field2 = getField @"example_struct_field2" x_0},
+                              getField @"example_struct_field3" x_0)
+instance (~) ty (Ptr (Ptr A)) =>
+         HasField "example_struct_field3" (Ptr Example_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_field3")
+instance HasCField Example_struct "example_struct_field3"
+    where type CFieldType Example_struct
+                          "example_struct_field3" = Ptr (Ptr A)
+          offset# = \_ -> \_ -> 16
+{-| __C declaration:__ @const_typedef1@
+
+    __defined at:__ @macros\/reparse.h 218:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef1
+    = Const_typedef1 {unwrapConst_typedef1 :: A}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty A =>
+         HasField "unwrapConst_typedef1" Const_typedef1 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef1{unwrapConst_typedef1 = y_1},
+                              getField @"unwrapConst_typedef1" x_0)
+instance (~) ty A =>
+         HasField "unwrapConst_typedef1" (Ptr Const_typedef1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef1")
+instance HasCField Const_typedef1 "unwrapConst_typedef1"
+    where type CFieldType Const_typedef1 "unwrapConst_typedef1" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef2@
+
+    __defined at:__ @macros\/reparse.h 219:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef2
+    = Const_typedef2 {unwrapConst_typedef2 :: A}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty A =>
+         HasField "unwrapConst_typedef2" Const_typedef2 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef2{unwrapConst_typedef2 = y_1},
+                              getField @"unwrapConst_typedef2" x_0)
+instance (~) ty A =>
+         HasField "unwrapConst_typedef2" (Ptr Const_typedef2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef2")
+instance HasCField Const_typedef2 "unwrapConst_typedef2"
+    where type CFieldType Const_typedef2 "unwrapConst_typedef2" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef3@
+
+    __defined at:__ @macros\/reparse.h 220:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef3
+    = Const_typedef3 {unwrapConst_typedef3 :: (PtrConst A)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst A) =>
+         HasField "unwrapConst_typedef3" Const_typedef3 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef3{unwrapConst_typedef3 = y_1},
+                              getField @"unwrapConst_typedef3" x_0)
+instance (~) ty (PtrConst A) =>
+         HasField "unwrapConst_typedef3" (Ptr Const_typedef3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef3")
+instance HasCField Const_typedef3 "unwrapConst_typedef3"
+    where type CFieldType Const_typedef3
+                          "unwrapConst_typedef3" = PtrConst A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef4@
+
+    __defined at:__ @macros\/reparse.h 221:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef4
+    = Const_typedef4 {unwrapConst_typedef4 :: (PtrConst A)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst A) =>
+         HasField "unwrapConst_typedef4" Const_typedef4 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef4{unwrapConst_typedef4 = y_1},
+                              getField @"unwrapConst_typedef4" x_0)
+instance (~) ty (PtrConst A) =>
+         HasField "unwrapConst_typedef4" (Ptr Const_typedef4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef4")
+instance HasCField Const_typedef4 "unwrapConst_typedef4"
+    where type CFieldType Const_typedef4
+                          "unwrapConst_typedef4" = PtrConst A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef5@
+
+    __defined at:__ @macros\/reparse.h 222:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef5
+    = Const_typedef5 {unwrapConst_typedef5 :: (Ptr A)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr A) =>
+         HasField "unwrapConst_typedef5" Const_typedef5 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef5{unwrapConst_typedef5 = y_1},
+                              getField @"unwrapConst_typedef5" x_0)
+instance (~) ty (Ptr A) =>
+         HasField "unwrapConst_typedef5" (Ptr Const_typedef5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef5")
+instance HasCField Const_typedef5 "unwrapConst_typedef5"
+    where type CFieldType Const_typedef5 "unwrapConst_typedef5" = Ptr A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef6@
+
+    __defined at:__ @macros\/reparse.h 223:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef6
+    = Const_typedef6 {unwrapConst_typedef6 :: (PtrConst A)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst A) =>
+         HasField "unwrapConst_typedef6" Const_typedef6 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef6{unwrapConst_typedef6 = y_1},
+                              getField @"unwrapConst_typedef6" x_0)
+instance (~) ty (PtrConst A) =>
+         HasField "unwrapConst_typedef6" (Ptr Const_typedef6) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef6")
+instance HasCField Const_typedef6 "unwrapConst_typedef6"
+    where type CFieldType Const_typedef6
+                          "unwrapConst_typedef6" = PtrConst A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_typedef7@
+
+    __defined at:__ @macros\/reparse.h 224:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_typedef7
+    = Const_typedef7 {unwrapConst_typedef7 :: (PtrConst A)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst A) =>
+         HasField "unwrapConst_typedef7" Const_typedef7 ty
+    where hasField = \x_0 -> (\y_1 -> Const_typedef7{unwrapConst_typedef7 = y_1},
+                              getField @"unwrapConst_typedef7" x_0)
+instance (~) ty (PtrConst A) =>
+         HasField "unwrapConst_typedef7" (Ptr Const_typedef7) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_typedef7")
+instance HasCField Const_typedef7 "unwrapConst_typedef7"
+    where type CFieldType Const_typedef7
+                          "unwrapConst_typedef7" = PtrConst A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct example_struct_with_const@
+
+    __defined at:__ @macros\/reparse.h 226:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+data Example_struct_with_const
+    = Example_struct_with_const {example_struct_with_const_const_field1 :: A
+                                 {- ^ __C declaration:__ @const_field1@
+
+                                      __defined at:__ @macros\/reparse.h 227:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field2 :: A
+                                 {- ^ __C declaration:__ @const_field2@
+
+                                      __defined at:__ @macros\/reparse.h 228:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field3 :: (PtrConst A)
+                                 {- ^ __C declaration:__ @const_field3@
+
+                                      __defined at:__ @macros\/reparse.h 229:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field4 :: (PtrConst A)
+                                 {- ^ __C declaration:__ @const_field4@
+
+                                      __defined at:__ @macros\/reparse.h 230:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field5 :: (Ptr A)
+                                 {- ^ __C declaration:__ @const_field5@
+
+                                      __defined at:__ @macros\/reparse.h 231:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field6 :: (PtrConst A)
+                                 {- ^ __C declaration:__ @const_field6@
+
+                                      __defined at:__ @macros\/reparse.h 232:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -},
+                                 example_struct_with_const_const_field7 :: (PtrConst A)
+                                 {- ^ __C declaration:__ @const_field7@
+
+                                      __defined at:__ @macros\/reparse.h 233:19@
+
+                                      __exported by:__ @macros\/reparse.h@
+                                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Example_struct_with_const
+    where staticSizeOf = \_ -> 48 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Example_struct_with_const
+    where readRaw = \ptr_0 -> ((((((pure Example_struct_with_const <*> readRaw (Proxy @"example_struct_with_const_const_field1") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field2") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field3") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field4") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field5") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field6") ptr_0) <*> readRaw (Proxy @"example_struct_with_const_const_field7") ptr_0
+instance WriteRaw Example_struct_with_const
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Example_struct_with_const example_struct_with_const_const_field1_2
+                                                                 example_struct_with_const_const_field2_3
+                                                                 example_struct_with_const_const_field3_4
+                                                                 example_struct_with_const_const_field4_5
+                                                                 example_struct_with_const_const_field5_6
+                                                                 example_struct_with_const_const_field6_7
+                                                                 example_struct_with_const_const_field7_8 -> writeRaw (Proxy @"example_struct_with_const_const_field1") ptr_0 example_struct_with_const_const_field1_2 >> (writeRaw (Proxy @"example_struct_with_const_const_field2") ptr_0 example_struct_with_const_const_field2_3 >> (writeRaw (Proxy @"example_struct_with_const_const_field3") ptr_0 example_struct_with_const_const_field3_4 >> (writeRaw (Proxy @"example_struct_with_const_const_field4") ptr_0 example_struct_with_const_const_field4_5 >> (writeRaw (Proxy @"example_struct_with_const_const_field5") ptr_0 example_struct_with_const_const_field5_6 >> (writeRaw (Proxy @"example_struct_with_const_const_field6") ptr_0 example_struct_with_const_const_field6_7 >> writeRaw (Proxy @"example_struct_with_const_const_field7") ptr_0 example_struct_with_const_const_field7_8)))))
+deriving via (EquivStorable Example_struct_with_const) instance Storable Example_struct_with_const
+deriving via (IsStructViaReadRaw Example_struct_with_const) instance IsStruct Example_struct_with_const
+instance (~) ty A =>
+         HasField "example_struct_with_const_const_field1"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field1 = y_1,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field1" x_0)
+instance (~) ty A =>
+         HasField "example_struct_with_const_const_field1"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field1")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field1"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field1" = A
+          offset# = \_ -> \_ -> 0
+instance (~) ty A =>
+         HasField "example_struct_with_const_const_field2"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field2 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field2" x_0)
+instance (~) ty A =>
+         HasField "example_struct_with_const_const_field2"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field2")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field2"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field2" = A
+          offset# = \_ -> \_ -> 4
+instance (~) ty (PtrConst A) =>
+         HasField "example_struct_with_const_const_field3"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field3 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field3" x_0)
+instance (~) ty (PtrConst A) =>
+         HasField "example_struct_with_const_const_field3"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field3")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field3"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field3" = PtrConst A
+          offset# = \_ -> \_ -> 8
+instance (~) ty (PtrConst A) =>
+         HasField "example_struct_with_const_const_field4"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field4 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field4" x_0)
+instance (~) ty (PtrConst A) =>
+         HasField "example_struct_with_const_const_field4"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field4")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field4"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field4" = PtrConst A
+          offset# = \_ -> \_ -> 16
+instance (~) ty (Ptr A) =>
+         HasField "example_struct_with_const_const_field5"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field5 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field5" x_0)
+instance (~) ty (Ptr A) =>
+         HasField "example_struct_with_const_const_field5"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field5")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field5"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field5" = Ptr A
+          offset# = \_ -> \_ -> 24
+instance (~) ty (PtrConst A) =>
+         HasField "example_struct_with_const_const_field6"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field6 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field7 = getField @"example_struct_with_const_const_field7" x_0},
+                              getField @"example_struct_with_const_const_field6" x_0)
+instance (~) ty (PtrConst A) =>
+         HasField "example_struct_with_const_const_field6"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field6")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field6"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field6" = PtrConst A
+          offset# = \_ -> \_ -> 32
+instance (~) ty (PtrConst A) =>
+         HasField "example_struct_with_const_const_field7"
+                  Example_struct_with_const
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Example_struct_with_const{example_struct_with_const_const_field7 = y_1,
+                                                                example_struct_with_const_const_field1 = getField @"example_struct_with_const_const_field1" x_0,
+                                                                example_struct_with_const_const_field2 = getField @"example_struct_with_const_const_field2" x_0,
+                                                                example_struct_with_const_const_field3 = getField @"example_struct_with_const_const_field3" x_0,
+                                                                example_struct_with_const_const_field4 = getField @"example_struct_with_const_const_field4" x_0,
+                                                                example_struct_with_const_const_field5 = getField @"example_struct_with_const_const_field5" x_0,
+                                                                example_struct_with_const_const_field6 = getField @"example_struct_with_const_const_field6" x_0},
+                              getField @"example_struct_with_const_const_field7" x_0)
+instance (~) ty (PtrConst A) =>
+         HasField "example_struct_with_const_const_field7"
+                  (Ptr Example_struct_with_const)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"example_struct_with_const_const_field7")
+instance HasCField Example_struct_with_const
+                   "example_struct_with_const_const_field7"
+    where type CFieldType Example_struct_with_const
+                          "example_struct_with_const_const_field7" = PtrConst A
+          offset# = \_ -> \_ -> 40
+{-| Auxiliary type used by 'Const_funptr1'
+
+    __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1_Aux
+    = Const_funptr1_Aux {unwrapConst_funptr1_Aux :: (CInt ->
+                                                     CDouble -> IO A)}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7f125e20a9d4075b_base ::
+    CInt -> CDouble -> IO CInt
+ -> IO (FunPtr (CInt -> CDouble -> IO CInt))
+-- __unique:__ @toConst_funptr1_Aux@
+hs_bindgen_7f125e20a9d4075b :: Const_funptr1_Aux ->
+                               IO (FunPtr Const_funptr1_Aux)
+-- __unique:__ @toConst_funptr1_Aux@
+hs_bindgen_7f125e20a9d4075b = \fun_0 -> fmap castFunPtr (hs_bindgen_7f125e20a9d4075b_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr1_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ac4bd8d789bba94b_base ::
+    FunPtr (CInt -> CDouble -> IO CInt)
+ -> CInt
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @fromConst_funptr1_Aux@
+hs_bindgen_ac4bd8d789bba94b :: FunPtr Const_funptr1_Aux ->
+                               Const_funptr1_Aux
+-- __unique:__ @fromConst_funptr1_Aux@
+hs_bindgen_ac4bd8d789bba94b = \funPtr_0 -> Const_funptr1_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_ac4bd8d789bba94b_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr1_Aux
+    where toFunPtr = hs_bindgen_7f125e20a9d4075b
+instance FromFunPtr Const_funptr1_Aux
+    where fromFunPtr = hs_bindgen_ac4bd8d789bba94b
+instance (~) ty (CInt -> CDouble -> IO A) =>
+         HasField "unwrapConst_funptr1_Aux" Const_funptr1_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr1_Aux{unwrapConst_funptr1_Aux = y_1},
+                              getField @"unwrapConst_funptr1_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO A) =>
+         HasField "unwrapConst_funptr1_Aux" (Ptr Const_funptr1_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr1_Aux")
+instance HasCField Const_funptr1_Aux "unwrapConst_funptr1_Aux"
+    where type CFieldType Const_funptr1_Aux
+                          "unwrapConst_funptr1_Aux" = CInt -> CDouble -> IO A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr1@
+
+    __defined at:__ @macros\/reparse.h 236:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr1
+    = Const_funptr1 {unwrapConst_funptr1 :: (FunPtr Const_funptr1_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr1_Aux) =>
+         HasField "unwrapConst_funptr1" Const_funptr1 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr1{unwrapConst_funptr1 = y_1},
+                              getField @"unwrapConst_funptr1" x_0)
+instance (~) ty (FunPtr Const_funptr1_Aux) =>
+         HasField "unwrapConst_funptr1" (Ptr Const_funptr1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr1")
+instance HasCField Const_funptr1 "unwrapConst_funptr1"
+    where type CFieldType Const_funptr1
+                          "unwrapConst_funptr1" = FunPtr Const_funptr1_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr2'
+
+    __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2_Aux
+    = Const_funptr2_Aux {unwrapConst_funptr2_Aux :: (CInt ->
+                                                     CDouble -> IO A)}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c7b1e36d845634fb_base ::
+    CInt -> CDouble -> IO CInt
+ -> IO (FunPtr (CInt -> CDouble -> IO CInt))
+-- __unique:__ @toConst_funptr2_Aux@
+hs_bindgen_c7b1e36d845634fb :: Const_funptr2_Aux ->
+                               IO (FunPtr Const_funptr2_Aux)
+-- __unique:__ @toConst_funptr2_Aux@
+hs_bindgen_c7b1e36d845634fb = \fun_0 -> fmap castFunPtr (hs_bindgen_c7b1e36d845634fb_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr2_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_352cebf463125ca9_base ::
+    FunPtr (CInt -> CDouble -> IO CInt)
+ -> CInt
+ -> CDouble
+ -> IO CInt
+-- __unique:__ @fromConst_funptr2_Aux@
+hs_bindgen_352cebf463125ca9 :: FunPtr Const_funptr2_Aux ->
+                               Const_funptr2_Aux
+-- __unique:__ @fromConst_funptr2_Aux@
+hs_bindgen_352cebf463125ca9 = \funPtr_0 -> Const_funptr2_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_352cebf463125ca9_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr2_Aux
+    where toFunPtr = hs_bindgen_c7b1e36d845634fb
+instance FromFunPtr Const_funptr2_Aux
+    where fromFunPtr = hs_bindgen_352cebf463125ca9
+instance (~) ty (CInt -> CDouble -> IO A) =>
+         HasField "unwrapConst_funptr2_Aux" Const_funptr2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr2_Aux{unwrapConst_funptr2_Aux = y_1},
+                              getField @"unwrapConst_funptr2_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO A) =>
+         HasField "unwrapConst_funptr2_Aux" (Ptr Const_funptr2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr2_Aux")
+instance HasCField Const_funptr2_Aux "unwrapConst_funptr2_Aux"
+    where type CFieldType Const_funptr2_Aux
+                          "unwrapConst_funptr2_Aux" = CInt -> CDouble -> IO A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr2@
+
+    __defined at:__ @macros\/reparse.h 237:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr2
+    = Const_funptr2 {unwrapConst_funptr2 :: (FunPtr Const_funptr2_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr2_Aux) =>
+         HasField "unwrapConst_funptr2" Const_funptr2 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr2{unwrapConst_funptr2 = y_1},
+                              getField @"unwrapConst_funptr2" x_0)
+instance (~) ty (FunPtr Const_funptr2_Aux) =>
+         HasField "unwrapConst_funptr2" (Ptr Const_funptr2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr2")
+instance HasCField Const_funptr2 "unwrapConst_funptr2"
+    where type CFieldType Const_funptr2
+                          "unwrapConst_funptr2" = FunPtr Const_funptr2_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr3'
+
+    __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3_Aux
+    = Const_funptr3_Aux {unwrapConst_funptr3_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst A))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_2dcbfe1c2502178c_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr3_Aux@
+hs_bindgen_2dcbfe1c2502178c :: Const_funptr3_Aux ->
+                               IO (FunPtr Const_funptr3_Aux)
+-- __unique:__ @toConst_funptr3_Aux@
+hs_bindgen_2dcbfe1c2502178c = \fun_0 -> fmap castFunPtr (hs_bindgen_2dcbfe1c2502178c_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr3_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_86738dcfd7c9d33c_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr3_Aux@
+hs_bindgen_86738dcfd7c9d33c :: FunPtr Const_funptr3_Aux ->
+                               Const_funptr3_Aux
+-- __unique:__ @fromConst_funptr3_Aux@
+hs_bindgen_86738dcfd7c9d33c = \funPtr_0 -> Const_funptr3_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_86738dcfd7c9d33c_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr3_Aux
+    where toFunPtr = hs_bindgen_2dcbfe1c2502178c
+instance FromFunPtr Const_funptr3_Aux
+    where fromFunPtr = hs_bindgen_86738dcfd7c9d33c
+instance (~) ty (CInt -> CDouble -> IO (PtrConst A)) =>
+         HasField "unwrapConst_funptr3_Aux" Const_funptr3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr3_Aux{unwrapConst_funptr3_Aux = y_1},
+                              getField @"unwrapConst_funptr3_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst A)) =>
+         HasField "unwrapConst_funptr3_Aux" (Ptr Const_funptr3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr3_Aux")
+instance HasCField Const_funptr3_Aux "unwrapConst_funptr3_Aux"
+    where type CFieldType Const_funptr3_Aux
+                          "unwrapConst_funptr3_Aux" = CInt -> CDouble -> IO (PtrConst A)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr3@
+
+    __defined at:__ @macros\/reparse.h 238:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr3
+    = Const_funptr3 {unwrapConst_funptr3 :: (FunPtr Const_funptr3_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr3_Aux) =>
+         HasField "unwrapConst_funptr3" Const_funptr3 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr3{unwrapConst_funptr3 = y_1},
+                              getField @"unwrapConst_funptr3" x_0)
+instance (~) ty (FunPtr Const_funptr3_Aux) =>
+         HasField "unwrapConst_funptr3" (Ptr Const_funptr3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr3")
+instance HasCField Const_funptr3 "unwrapConst_funptr3"
+    where type CFieldType Const_funptr3
+                          "unwrapConst_funptr3" = FunPtr Const_funptr3_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr4'
+
+    __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4_Aux
+    = Const_funptr4_Aux {unwrapConst_funptr4_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst A))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5461deeda491de0b_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr4_Aux@
+hs_bindgen_5461deeda491de0b :: Const_funptr4_Aux ->
+                               IO (FunPtr Const_funptr4_Aux)
+-- __unique:__ @toConst_funptr4_Aux@
+hs_bindgen_5461deeda491de0b = \fun_0 -> fmap castFunPtr (hs_bindgen_5461deeda491de0b_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr4_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_de7846fca3bfd1b6_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr4_Aux@
+hs_bindgen_de7846fca3bfd1b6 :: FunPtr Const_funptr4_Aux ->
+                               Const_funptr4_Aux
+-- __unique:__ @fromConst_funptr4_Aux@
+hs_bindgen_de7846fca3bfd1b6 = \funPtr_0 -> Const_funptr4_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_de7846fca3bfd1b6_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr4_Aux
+    where toFunPtr = hs_bindgen_5461deeda491de0b
+instance FromFunPtr Const_funptr4_Aux
+    where fromFunPtr = hs_bindgen_de7846fca3bfd1b6
+instance (~) ty (CInt -> CDouble -> IO (PtrConst A)) =>
+         HasField "unwrapConst_funptr4_Aux" Const_funptr4_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr4_Aux{unwrapConst_funptr4_Aux = y_1},
+                              getField @"unwrapConst_funptr4_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst A)) =>
+         HasField "unwrapConst_funptr4_Aux" (Ptr Const_funptr4_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr4_Aux")
+instance HasCField Const_funptr4_Aux "unwrapConst_funptr4_Aux"
+    where type CFieldType Const_funptr4_Aux
+                          "unwrapConst_funptr4_Aux" = CInt -> CDouble -> IO (PtrConst A)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr4@
+
+    __defined at:__ @macros\/reparse.h 239:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr4
+    = Const_funptr4 {unwrapConst_funptr4 :: (FunPtr Const_funptr4_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr4_Aux) =>
+         HasField "unwrapConst_funptr4" Const_funptr4 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr4{unwrapConst_funptr4 = y_1},
+                              getField @"unwrapConst_funptr4" x_0)
+instance (~) ty (FunPtr Const_funptr4_Aux) =>
+         HasField "unwrapConst_funptr4" (Ptr Const_funptr4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr4")
+instance HasCField Const_funptr4 "unwrapConst_funptr4"
+    where type CFieldType Const_funptr4
+                          "unwrapConst_funptr4" = FunPtr Const_funptr4_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr5'
+
+    __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5_Aux
+    = Const_funptr5_Aux {unwrapConst_funptr5_Aux :: (CInt ->
+                                                     CDouble -> IO (Ptr A))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_7b0174fc978a1ce1_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr5_Aux@
+hs_bindgen_7b0174fc978a1ce1 :: Const_funptr5_Aux ->
+                               IO (FunPtr Const_funptr5_Aux)
+-- __unique:__ @toConst_funptr5_Aux@
+hs_bindgen_7b0174fc978a1ce1 = \fun_0 -> fmap castFunPtr (hs_bindgen_7b0174fc978a1ce1_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr5_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_38a21d84bb7115b5_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr5_Aux@
+hs_bindgen_38a21d84bb7115b5 :: FunPtr Const_funptr5_Aux ->
+                               Const_funptr5_Aux
+-- __unique:__ @fromConst_funptr5_Aux@
+hs_bindgen_38a21d84bb7115b5 = \funPtr_0 -> Const_funptr5_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_38a21d84bb7115b5_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr5_Aux
+    where toFunPtr = hs_bindgen_7b0174fc978a1ce1
+instance FromFunPtr Const_funptr5_Aux
+    where fromFunPtr = hs_bindgen_38a21d84bb7115b5
+instance (~) ty (CInt -> CDouble -> IO (Ptr A)) =>
+         HasField "unwrapConst_funptr5_Aux" Const_funptr5_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr5_Aux{unwrapConst_funptr5_Aux = y_1},
+                              getField @"unwrapConst_funptr5_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (Ptr A)) =>
+         HasField "unwrapConst_funptr5_Aux" (Ptr Const_funptr5_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr5_Aux")
+instance HasCField Const_funptr5_Aux "unwrapConst_funptr5_Aux"
+    where type CFieldType Const_funptr5_Aux
+                          "unwrapConst_funptr5_Aux" = CInt -> CDouble -> IO (Ptr A)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr5@
+
+    __defined at:__ @macros\/reparse.h 240:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr5
+    = Const_funptr5 {unwrapConst_funptr5 :: (FunPtr Const_funptr5_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr5_Aux) =>
+         HasField "unwrapConst_funptr5" Const_funptr5 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr5{unwrapConst_funptr5 = y_1},
+                              getField @"unwrapConst_funptr5" x_0)
+instance (~) ty (FunPtr Const_funptr5_Aux) =>
+         HasField "unwrapConst_funptr5" (Ptr Const_funptr5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr5")
+instance HasCField Const_funptr5 "unwrapConst_funptr5"
+    where type CFieldType Const_funptr5
+                          "unwrapConst_funptr5" = FunPtr Const_funptr5_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr6'
+
+    __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6_Aux
+    = Const_funptr6_Aux {unwrapConst_funptr6_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst A))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr6_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_4e32721222f4df9f_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr6_Aux@
+hs_bindgen_4e32721222f4df9f :: Const_funptr6_Aux ->
+                               IO (FunPtr Const_funptr6_Aux)
+-- __unique:__ @toConst_funptr6_Aux@
+hs_bindgen_4e32721222f4df9f = \fun_0 -> fmap castFunPtr (hs_bindgen_4e32721222f4df9f_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr6_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr6_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_45251216b04aa8b5_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr6_Aux@
+hs_bindgen_45251216b04aa8b5 :: FunPtr Const_funptr6_Aux ->
+                               Const_funptr6_Aux
+-- __unique:__ @fromConst_funptr6_Aux@
+hs_bindgen_45251216b04aa8b5 = \funPtr_0 -> Const_funptr6_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_45251216b04aa8b5_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr6_Aux
+    where toFunPtr = hs_bindgen_4e32721222f4df9f
+instance FromFunPtr Const_funptr6_Aux
+    where fromFunPtr = hs_bindgen_45251216b04aa8b5
+instance (~) ty (CInt -> CDouble -> IO (PtrConst A)) =>
+         HasField "unwrapConst_funptr6_Aux" Const_funptr6_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr6_Aux{unwrapConst_funptr6_Aux = y_1},
+                              getField @"unwrapConst_funptr6_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst A)) =>
+         HasField "unwrapConst_funptr6_Aux" (Ptr Const_funptr6_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr6_Aux")
+instance HasCField Const_funptr6_Aux "unwrapConst_funptr6_Aux"
+    where type CFieldType Const_funptr6_Aux
+                          "unwrapConst_funptr6_Aux" = CInt -> CDouble -> IO (PtrConst A)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr6@
+
+    __defined at:__ @macros\/reparse.h 241:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr6
+    = Const_funptr6 {unwrapConst_funptr6 :: (FunPtr Const_funptr6_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr6_Aux) =>
+         HasField "unwrapConst_funptr6" Const_funptr6 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr6{unwrapConst_funptr6 = y_1},
+                              getField @"unwrapConst_funptr6" x_0)
+instance (~) ty (FunPtr Const_funptr6_Aux) =>
+         HasField "unwrapConst_funptr6" (Ptr Const_funptr6) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr6")
+instance HasCField Const_funptr6 "unwrapConst_funptr6"
+    where type CFieldType Const_funptr6
+                          "unwrapConst_funptr6" = FunPtr Const_funptr6_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Const_funptr7'
+
+    __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7_Aux
+    = Const_funptr7_Aux {unwrapConst_funptr7_Aux :: (CInt ->
+                                                     CDouble -> IO (PtrConst A))}
+    deriving stock Generic
+-- __unique:__ @toConst_funptr7_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_0d04fc96ffb9de06_base ::
+    CInt -> CDouble -> IO (Ptr Void)
+ -> IO (FunPtr (CInt -> CDouble -> IO (Ptr Void)))
+-- __unique:__ @toConst_funptr7_Aux@
+hs_bindgen_0d04fc96ffb9de06 :: Const_funptr7_Aux ->
+                               IO (FunPtr Const_funptr7_Aux)
+-- __unique:__ @toConst_funptr7_Aux@
+hs_bindgen_0d04fc96ffb9de06 = \fun_0 -> fmap castFunPtr (hs_bindgen_0d04fc96ffb9de06_base (\x_1 -> \x_2 -> fmap toFFIType (getField @"unwrapConst_funptr7_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2))))
+-- __unique:__ @fromConst_funptr7_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_42fbcebf75a973ba_base ::
+    FunPtr (CInt -> CDouble -> IO (Ptr Void))
+ -> CInt
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @fromConst_funptr7_Aux@
+hs_bindgen_42fbcebf75a973ba :: FunPtr Const_funptr7_Aux ->
+                               Const_funptr7_Aux
+-- __unique:__ @fromConst_funptr7_Aux@
+hs_bindgen_42fbcebf75a973ba = \funPtr_0 -> Const_funptr7_Aux (\x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_42fbcebf75a973ba_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2)))
+instance ToFunPtr Const_funptr7_Aux
+    where toFunPtr = hs_bindgen_0d04fc96ffb9de06
+instance FromFunPtr Const_funptr7_Aux
+    where fromFunPtr = hs_bindgen_42fbcebf75a973ba
+instance (~) ty (CInt -> CDouble -> IO (PtrConst A)) =>
+         HasField "unwrapConst_funptr7_Aux" Const_funptr7_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr7_Aux{unwrapConst_funptr7_Aux = y_1},
+                              getField @"unwrapConst_funptr7_Aux" x_0)
+instance (~) ty (CInt -> CDouble -> IO (PtrConst A)) =>
+         HasField "unwrapConst_funptr7_Aux" (Ptr Const_funptr7_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr7_Aux")
+instance HasCField Const_funptr7_Aux "unwrapConst_funptr7_Aux"
+    where type CFieldType Const_funptr7_Aux
+                          "unwrapConst_funptr7_Aux" = CInt -> CDouble -> IO (PtrConst A)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @const_funptr7@
+
+    __defined at:__ @macros\/reparse.h 242:27@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype Const_funptr7
+    = Const_funptr7 {unwrapConst_funptr7 :: (FunPtr Const_funptr7_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Const_funptr7_Aux) =>
+         HasField "unwrapConst_funptr7" Const_funptr7 ty
+    where hasField = \x_0 -> (\y_1 -> Const_funptr7{unwrapConst_funptr7 = y_1},
+                              getField @"unwrapConst_funptr7" x_0)
+instance (~) ty (FunPtr Const_funptr7_Aux) =>
+         HasField "unwrapConst_funptr7" (Ptr Const_funptr7) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapConst_funptr7")
+instance HasCField Const_funptr7 "unwrapConst_funptr7"
+    where type CFieldType Const_funptr7
+                          "unwrapConst_funptr7" = FunPtr Const_funptr7_Aux
+          offset# = \_ -> \_ -> 0
+{-| Macro-defined types
+
+    __C declaration:__ @macro BOOL@
+
+    __defined at:__ @macros\/reparse.h 278:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype BOOL
+    = BOOL {unwrapBOOL :: CBool}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CBool => HasField "unwrapBOOL" BOOL ty
+    where hasField = \x_0 -> (\y_1 -> BOOL{unwrapBOOL = y_1},
+                              getField @"unwrapBOOL" x_0)
+instance (~) ty CBool => HasField "unwrapBOOL" (Ptr BOOL) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBOOL")
+instance HasCField BOOL "unwrapBOOL"
+    where type CFieldType BOOL "unwrapBOOL" = CBool
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro INT@
+
+    __defined at:__ @macros\/reparse.h 279:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype INT
+    = INT {unwrapINT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapINT" INT ty
+    where hasField = \x_0 -> (\y_1 -> INT{unwrapINT = y_1},
+                              getField @"unwrapINT" x_0)
+instance (~) ty CInt => HasField "unwrapINT" (Ptr INT) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapINT")
+instance HasCField INT "unwrapINT"
+    where type CFieldType INT "unwrapINT" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro INTP@
+
+    __defined at:__ @macros\/reparse.h 280:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype INTP
+    = INTP {unwrapINTP :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) => HasField "unwrapINTP" INTP ty
+    where hasField = \x_0 -> (\y_1 -> INTP{unwrapINTP = y_1},
+                              getField @"unwrapINTP" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapINTP" (Ptr INTP) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapINTP")
+instance HasCField INTP "unwrapINTP"
+    where type CFieldType INTP "unwrapINTP" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro INTCP@
+
+    __defined at:__ @macros\/reparse.h 281:9@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+newtype INTCP
+    = INTCP {unwrapINTCP :: (PtrConst CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (PtrConst CInt) => HasField "unwrapINTCP" INTCP ty
+    where hasField = \x_0 -> (\y_1 -> INTCP{unwrapINTCP = y_1},
+                              getField @"unwrapINTCP" x_0)
+instance (~) ty (PtrConst CInt) =>
+         HasField "unwrapINTCP" (Ptr INTCP) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapINTCP")
+instance HasCField INTCP "unwrapINTCP"
+    where type CFieldType INTCP "unwrapINTCP" = PtrConst CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char1@
+foreign import ccall safe "hs_bindgen_f15610128336b06a" hs_bindgen_f15610128336b06a_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char1@
+hs_bindgen_f15610128336b06a :: A -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char1@
+hs_bindgen_f15610128336b06a = \x_0 -> \x_1 -> hs_bindgen_f15610128336b06a_base (toFFIType x_0) (toFFIType x_1)
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_safe :: A -> CChar -> IO ()
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_safe = hs_bindgen_f15610128336b06a
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char2@
+foreign import ccall safe "hs_bindgen_087f45ca0a284a03" hs_bindgen_087f45ca0a284a03_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char2@
+hs_bindgen_087f45ca0a284a03 :: A -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char2@
+hs_bindgen_087f45ca0a284a03 = \x_0 -> \x_1 -> hs_bindgen_087f45ca0a284a03_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_safe :: A -> CSChar -> IO ()
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_safe = hs_bindgen_087f45ca0a284a03
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char3@
+foreign import ccall safe "hs_bindgen_f6cb5c5a728c2404" hs_bindgen_f6cb5c5a728c2404_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char3@
+hs_bindgen_f6cb5c5a728c2404 :: A -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_char3@
+hs_bindgen_f6cb5c5a728c2404 = \x_0 -> \x_1 -> hs_bindgen_f6cb5c5a728c2404_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_safe :: A -> CUChar -> IO ()
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_safe = hs_bindgen_f6cb5c5a728c2404
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short1@
+foreign import ccall safe "hs_bindgen_d485767e0caa1f7c" hs_bindgen_d485767e0caa1f7c_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short1@
+hs_bindgen_d485767e0caa1f7c :: A -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short1@
+hs_bindgen_d485767e0caa1f7c = \x_0 -> \x_1 -> hs_bindgen_d485767e0caa1f7c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_safe :: A -> CShort -> IO ()
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_safe = hs_bindgen_d485767e0caa1f7c
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short2@
+foreign import ccall safe "hs_bindgen_833c96c437533e02" hs_bindgen_833c96c437533e02_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short2@
+hs_bindgen_833c96c437533e02 :: A -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short2@
+hs_bindgen_833c96c437533e02 = \x_0 -> \x_1 -> hs_bindgen_833c96c437533e02_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_safe :: A -> CShort -> IO ()
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_safe = hs_bindgen_833c96c437533e02
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short3@
+foreign import ccall safe "hs_bindgen_0e1eedc3fcbcea7a" hs_bindgen_0e1eedc3fcbcea7a_base ::
+    CInt
+ -> CUShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short3@
+hs_bindgen_0e1eedc3fcbcea7a :: A -> CUShort -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_short3@
+hs_bindgen_0e1eedc3fcbcea7a = \x_0 -> \x_1 -> hs_bindgen_0e1eedc3fcbcea7a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_safe :: A -> CUShort -> IO ()
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_safe = hs_bindgen_0e1eedc3fcbcea7a
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int1@
+foreign import ccall safe "hs_bindgen_906f0ac7dfd36ab8" hs_bindgen_906f0ac7dfd36ab8_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int1@
+hs_bindgen_906f0ac7dfd36ab8 :: A -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int1@
+hs_bindgen_906f0ac7dfd36ab8 = \x_0 -> \x_1 -> hs_bindgen_906f0ac7dfd36ab8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_safe :: A -> CInt -> IO ()
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_safe = hs_bindgen_906f0ac7dfd36ab8
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int2@
+foreign import ccall safe "hs_bindgen_0edbc9b995b2a589" hs_bindgen_0edbc9b995b2a589_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int2@
+hs_bindgen_0edbc9b995b2a589 :: A -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int2@
+hs_bindgen_0edbc9b995b2a589 = \x_0 -> \x_1 -> hs_bindgen_0edbc9b995b2a589_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_safe :: A -> CInt -> IO ()
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_safe = hs_bindgen_0edbc9b995b2a589
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int3@
+foreign import ccall safe "hs_bindgen_a5c223f58a255115" hs_bindgen_a5c223f58a255115_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int3@
+hs_bindgen_a5c223f58a255115 :: A -> CUInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_int3@
+hs_bindgen_a5c223f58a255115 = \x_0 -> \x_1 -> hs_bindgen_a5c223f58a255115_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_safe :: A -> CUInt -> IO ()
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_safe = hs_bindgen_a5c223f58a255115
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long1@
+foreign import ccall safe "hs_bindgen_41d1229384b9a529" hs_bindgen_41d1229384b9a529_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long1@
+hs_bindgen_41d1229384b9a529 :: A -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long1@
+hs_bindgen_41d1229384b9a529 = \x_0 -> \x_1 -> hs_bindgen_41d1229384b9a529_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_safe :: A -> CLong -> IO ()
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_safe = hs_bindgen_41d1229384b9a529
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long2@
+foreign import ccall safe "hs_bindgen_a9a4b09fd3bd83db" hs_bindgen_a9a4b09fd3bd83db_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long2@
+hs_bindgen_a9a4b09fd3bd83db :: A -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long2@
+hs_bindgen_a9a4b09fd3bd83db = \x_0 -> \x_1 -> hs_bindgen_a9a4b09fd3bd83db_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_safe :: A -> CLong -> IO ()
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_safe = hs_bindgen_a9a4b09fd3bd83db
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long3@
+foreign import ccall safe "hs_bindgen_31dc2e680b3f3eff" hs_bindgen_31dc2e680b3f3eff_base ::
+    CInt
+ -> CULong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long3@
+hs_bindgen_31dc2e680b3f3eff :: A -> CULong -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_long3@
+hs_bindgen_31dc2e680b3f3eff = \x_0 -> \x_1 -> hs_bindgen_31dc2e680b3f3eff_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_safe :: A -> CULong -> IO ()
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_safe = hs_bindgen_31dc2e680b3f3eff
+-- __unique:__ @test_macrosreparse_Example_Safe_args_float@
+foreign import ccall safe "hs_bindgen_3d400757b5cbf4b7" hs_bindgen_3d400757b5cbf4b7_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_float@
+hs_bindgen_3d400757b5cbf4b7 :: A -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_float@
+hs_bindgen_3d400757b5cbf4b7 = \x_0 -> \x_1 -> hs_bindgen_3d400757b5cbf4b7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_safe :: A -> CFloat -> IO ()
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_safe = hs_bindgen_3d400757b5cbf4b7
+-- __unique:__ @test_macrosreparse_Example_Safe_args_double@
+foreign import ccall safe "hs_bindgen_70df07e39900487e" hs_bindgen_70df07e39900487e_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_double@
+hs_bindgen_70df07e39900487e :: A -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_double@
+hs_bindgen_70df07e39900487e = \x_0 -> \x_1 -> hs_bindgen_70df07e39900487e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_safe :: A -> CDouble -> IO ()
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_safe = hs_bindgen_70df07e39900487e
+-- __unique:__ @test_macrosreparse_Example_Safe_args_bool1@
+foreign import ccall safe "hs_bindgen_0b7c534fe683f843" hs_bindgen_0b7c534fe683f843_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_bool1@
+hs_bindgen_0b7c534fe683f843 :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_bool1@
+hs_bindgen_0b7c534fe683f843 = \x_0 -> \x_1 -> hs_bindgen_0b7c534fe683f843_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_safe :: A -> CBool -> IO ()
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_safe = hs_bindgen_0b7c534fe683f843
+-- __unique:__ @test_macrosreparse_Example_Safe_args_struct@
+foreign import ccall safe "hs_bindgen_b20e084f7b7941b5" hs_bindgen_b20e084f7b7941b5_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_struct@
+hs_bindgen_b20e084f7b7941b5 :: A -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_struct@
+hs_bindgen_b20e084f7b7941b5 = \x_0 -> \x_1 -> hs_bindgen_b20e084f7b7941b5_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_safe :: A -> Some_struct -> IO ()
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_b20e084f7b7941b5 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_Example_Safe_args_union@
+foreign import ccall safe "hs_bindgen_23aff33f33b6bdd1" hs_bindgen_23aff33f33b6bdd1_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_union@
+hs_bindgen_23aff33f33b6bdd1 :: A -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_union@
+hs_bindgen_23aff33f33b6bdd1 = \x_0 -> \x_1 -> hs_bindgen_23aff33f33b6bdd1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_safe :: A -> Some_union -> IO ()
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_23aff33f33b6bdd1 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_Example_Safe_args_enum@
+foreign import ccall safe "hs_bindgen_fdd58ae14ce15ed5" hs_bindgen_fdd58ae14ce15ed5_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_enum@
+hs_bindgen_fdd58ae14ce15ed5 :: A -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_enum@
+hs_bindgen_fdd58ae14ce15ed5 = \x_0 -> \x_1 -> hs_bindgen_fdd58ae14ce15ed5_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_safe :: A -> Some_enum -> IO ()
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_safe = hs_bindgen_fdd58ae14ce15ed5
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer1@
+foreign import ccall safe "hs_bindgen_42ce2ec4fd2eda72" hs_bindgen_42ce2ec4fd2eda72_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer1@
+hs_bindgen_42ce2ec4fd2eda72 :: A -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer1@
+hs_bindgen_42ce2ec4fd2eda72 = \x_0 -> \x_1 -> hs_bindgen_42ce2ec4fd2eda72_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_safe :: A -> Ptr CInt -> IO ()
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_safe = hs_bindgen_42ce2ec4fd2eda72
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer2@
+foreign import ccall safe "hs_bindgen_01b2f6502d340abe" hs_bindgen_01b2f6502d340abe_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer2@
+hs_bindgen_01b2f6502d340abe :: A -> Ptr (Ptr CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer2@
+hs_bindgen_01b2f6502d340abe = \x_0 -> \x_1 -> hs_bindgen_01b2f6502d340abe_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_safe :: A -> Ptr (Ptr CInt) -> IO ()
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_safe = hs_bindgen_01b2f6502d340abe
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer3@
+foreign import ccall safe "hs_bindgen_3e64133f9aaebbf1" hs_bindgen_3e64133f9aaebbf1_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer3@
+hs_bindgen_3e64133f9aaebbf1 :: A -> Ptr Void -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_pointer3@
+hs_bindgen_3e64133f9aaebbf1 = \x_0 -> \x_1 -> hs_bindgen_3e64133f9aaebbf1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_safe :: A -> Ptr Void -> IO ()
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_safe = hs_bindgen_3e64133f9aaebbf1
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_A@
+foreign import ccall safe "hs_bindgen_c830401b459192fb" hs_bindgen_c830401b459192fb_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_A@
+hs_bindgen_c830401b459192fb :: IO A
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_A@
+hs_bindgen_c830401b459192fb = fmap fromFFIType hs_bindgen_c830401b459192fb_base
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_safe :: IO A
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_safe = hs_bindgen_c830401b459192fb
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char1@
+foreign import ccall safe "hs_bindgen_18b24c6e67a5412e" hs_bindgen_18b24c6e67a5412e_base ::
+    CInt
+ -> IO CChar
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char1@
+hs_bindgen_18b24c6e67a5412e :: A -> IO CChar
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char1@
+hs_bindgen_18b24c6e67a5412e = \x_0 -> fmap fromFFIType (hs_bindgen_18b24c6e67a5412e_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_safe :: A -> IO CChar
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_safe = hs_bindgen_18b24c6e67a5412e
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char2@
+foreign import ccall safe "hs_bindgen_2da1160aeef9ff64" hs_bindgen_2da1160aeef9ff64_base ::
+    CInt
+ -> IO CSChar
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char2@
+hs_bindgen_2da1160aeef9ff64 :: A -> IO CSChar
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char2@
+hs_bindgen_2da1160aeef9ff64 = \x_0 -> fmap fromFFIType (hs_bindgen_2da1160aeef9ff64_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_safe :: A -> IO CSChar
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_safe = hs_bindgen_2da1160aeef9ff64
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char3@
+foreign import ccall safe "hs_bindgen_e3183f9de1b9f231" hs_bindgen_e3183f9de1b9f231_base ::
+    CInt
+ -> IO CUChar
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char3@
+hs_bindgen_e3183f9de1b9f231 :: A -> IO CUChar
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_char3@
+hs_bindgen_e3183f9de1b9f231 = \x_0 -> fmap fromFFIType (hs_bindgen_e3183f9de1b9f231_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_safe :: A -> IO CUChar
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_safe = hs_bindgen_e3183f9de1b9f231
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short1@
+foreign import ccall safe "hs_bindgen_c313966d4478e3f4" hs_bindgen_c313966d4478e3f4_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short1@
+hs_bindgen_c313966d4478e3f4 :: A -> IO CShort
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short1@
+hs_bindgen_c313966d4478e3f4 = \x_0 -> fmap fromFFIType (hs_bindgen_c313966d4478e3f4_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_safe :: A -> IO CShort
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_safe = hs_bindgen_c313966d4478e3f4
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short2@
+foreign import ccall safe "hs_bindgen_737fbec310eb0719" hs_bindgen_737fbec310eb0719_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short2@
+hs_bindgen_737fbec310eb0719 :: A -> IO CShort
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short2@
+hs_bindgen_737fbec310eb0719 = \x_0 -> fmap fromFFIType (hs_bindgen_737fbec310eb0719_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_safe :: A -> IO CShort
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_safe = hs_bindgen_737fbec310eb0719
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short3@
+foreign import ccall safe "hs_bindgen_b5bd9e111020db4e" hs_bindgen_b5bd9e111020db4e_base ::
+    CInt
+ -> IO CUShort
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short3@
+hs_bindgen_b5bd9e111020db4e :: A -> IO CUShort
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_short3@
+hs_bindgen_b5bd9e111020db4e = \x_0 -> fmap fromFFIType (hs_bindgen_b5bd9e111020db4e_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_safe :: A -> IO CUShort
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_safe = hs_bindgen_b5bd9e111020db4e
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int1@
+foreign import ccall safe "hs_bindgen_a30224259287f5f8" hs_bindgen_a30224259287f5f8_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int1@
+hs_bindgen_a30224259287f5f8 :: A -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int1@
+hs_bindgen_a30224259287f5f8 = \x_0 -> fmap fromFFIType (hs_bindgen_a30224259287f5f8_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_safe :: A -> IO CInt
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_safe = hs_bindgen_a30224259287f5f8
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int2@
+foreign import ccall safe "hs_bindgen_b5be09caf8cf5750" hs_bindgen_b5be09caf8cf5750_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int2@
+hs_bindgen_b5be09caf8cf5750 :: A -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int2@
+hs_bindgen_b5be09caf8cf5750 = \x_0 -> fmap fromFFIType (hs_bindgen_b5be09caf8cf5750_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_safe :: A -> IO CInt
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_safe = hs_bindgen_b5be09caf8cf5750
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int3@
+foreign import ccall safe "hs_bindgen_698e3f97470d83be" hs_bindgen_698e3f97470d83be_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int3@
+hs_bindgen_698e3f97470d83be :: A -> IO CUInt
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_int3@
+hs_bindgen_698e3f97470d83be = \x_0 -> fmap fromFFIType (hs_bindgen_698e3f97470d83be_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_safe :: A -> IO CUInt
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_safe = hs_bindgen_698e3f97470d83be
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long1@
+foreign import ccall safe "hs_bindgen_c7e0705dd09be530" hs_bindgen_c7e0705dd09be530_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long1@
+hs_bindgen_c7e0705dd09be530 :: A -> IO CLong
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long1@
+hs_bindgen_c7e0705dd09be530 = \x_0 -> fmap fromFFIType (hs_bindgen_c7e0705dd09be530_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_safe :: A -> IO CLong
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_safe = hs_bindgen_c7e0705dd09be530
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long2@
+foreign import ccall safe "hs_bindgen_74b1f5b8c56ff22c" hs_bindgen_74b1f5b8c56ff22c_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long2@
+hs_bindgen_74b1f5b8c56ff22c :: A -> IO CLong
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long2@
+hs_bindgen_74b1f5b8c56ff22c = \x_0 -> fmap fromFFIType (hs_bindgen_74b1f5b8c56ff22c_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_safe :: A -> IO CLong
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_safe = hs_bindgen_74b1f5b8c56ff22c
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long3@
+foreign import ccall safe "hs_bindgen_c2d07eaaab82d408" hs_bindgen_c2d07eaaab82d408_base ::
+    CInt
+ -> IO CULong
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long3@
+hs_bindgen_c2d07eaaab82d408 :: A -> IO CULong
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_long3@
+hs_bindgen_c2d07eaaab82d408 = \x_0 -> fmap fromFFIType (hs_bindgen_c2d07eaaab82d408_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_safe :: A -> IO CULong
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_safe = hs_bindgen_c2d07eaaab82d408
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_float@
+foreign import ccall safe "hs_bindgen_0edfbc7067faa1f7" hs_bindgen_0edfbc7067faa1f7_base ::
+    CInt
+ -> IO CFloat
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_float@
+hs_bindgen_0edfbc7067faa1f7 :: A -> IO CFloat
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_float@
+hs_bindgen_0edfbc7067faa1f7 = \x_0 -> fmap fromFFIType (hs_bindgen_0edfbc7067faa1f7_base (toFFIType x_0))
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_safe :: A -> IO CFloat
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_safe = hs_bindgen_0edfbc7067faa1f7
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_double@
+foreign import ccall safe "hs_bindgen_786ca672396b33be" hs_bindgen_786ca672396b33be_base ::
+    CInt
+ -> IO CDouble
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_double@
+hs_bindgen_786ca672396b33be :: A -> IO CDouble
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_double@
+hs_bindgen_786ca672396b33be = \x_0 -> fmap fromFFIType (hs_bindgen_786ca672396b33be_base (toFFIType x_0))
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_safe :: A -> IO CDouble
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_safe = hs_bindgen_786ca672396b33be
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_bool1@
+foreign import ccall safe "hs_bindgen_2e99f19b59650996" hs_bindgen_2e99f19b59650996_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_bool1@
+hs_bindgen_2e99f19b59650996 :: A -> IO CBool
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_bool1@
+hs_bindgen_2e99f19b59650996 = \x_0 -> fmap fromFFIType (hs_bindgen_2e99f19b59650996_base (toFFIType x_0))
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_safe :: A -> IO CBool
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_safe = hs_bindgen_2e99f19b59650996
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_struct@
+foreign import ccall safe "hs_bindgen_6c999121eed8178f" hs_bindgen_6c999121eed8178f_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_struct@
+hs_bindgen_6c999121eed8178f :: A -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_struct@
+hs_bindgen_6c999121eed8178f = \x_0 -> \x_1 -> hs_bindgen_6c999121eed8178f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_safe :: A -> IO Some_struct
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_6c999121eed8178f arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_union@
+foreign import ccall safe "hs_bindgen_481ee5d2d9bd34db" hs_bindgen_481ee5d2d9bd34db_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_union@
+hs_bindgen_481ee5d2d9bd34db :: A -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_union@
+hs_bindgen_481ee5d2d9bd34db = \x_0 -> \x_1 -> hs_bindgen_481ee5d2d9bd34db_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_safe :: A -> IO Some_union
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_481ee5d2d9bd34db arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_enum@
+foreign import ccall safe "hs_bindgen_8bb240ba453b700d" hs_bindgen_8bb240ba453b700d_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_enum@
+hs_bindgen_8bb240ba453b700d :: A -> IO Some_enum
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_enum@
+hs_bindgen_8bb240ba453b700d = \x_0 -> fmap fromFFIType (hs_bindgen_8bb240ba453b700d_base (toFFIType x_0))
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_safe :: A -> IO Some_enum
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_safe = hs_bindgen_8bb240ba453b700d
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer1@
+foreign import ccall safe "hs_bindgen_c346ed2cd20b9af1" hs_bindgen_c346ed2cd20b9af1_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer1@
+hs_bindgen_c346ed2cd20b9af1 :: A -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer1@
+hs_bindgen_c346ed2cd20b9af1 = \x_0 -> fmap fromFFIType (hs_bindgen_c346ed2cd20b9af1_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_safe :: A -> IO (Ptr CInt)
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_safe = hs_bindgen_c346ed2cd20b9af1
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer2@
+foreign import ccall safe "hs_bindgen_a21f618658151728" hs_bindgen_a21f618658151728_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer2@
+hs_bindgen_a21f618658151728 :: A -> IO (Ptr (Ptr CInt))
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer2@
+hs_bindgen_a21f618658151728 = \x_0 -> fmap fromFFIType (hs_bindgen_a21f618658151728_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_safe :: A -> IO (Ptr (Ptr CInt))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_safe = hs_bindgen_a21f618658151728
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer3@
+foreign import ccall safe "hs_bindgen_2d8c6e2d2f395342" hs_bindgen_2d8c6e2d2f395342_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer3@
+hs_bindgen_2d8c6e2d2f395342 :: A -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_pointer3@
+hs_bindgen_2d8c6e2d2f395342 = \x_0 -> fmap fromFFIType (hs_bindgen_2d8c6e2d2f395342_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_safe :: A -> IO (Ptr Void)
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_safe = hs_bindgen_2d8c6e2d2f395342
+-- __unique:__ @test_macrosreparse_Example_Safe_body1@
+foreign import ccall safe "hs_bindgen_b030d02030ed80bc" hs_bindgen_b030d02030ed80bc_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_body1@
+hs_bindgen_b030d02030ed80bc :: A -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_body1@
+hs_bindgen_b030d02030ed80bc = \x_0 -> fmap fromFFIType (hs_bindgen_b030d02030ed80bc_base (toFFIType x_0))
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_safe :: A -> IO CInt
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_safe = hs_bindgen_b030d02030ed80bc
+-- __unique:__ @test_macrosreparse_Example_Safe_body2@
+foreign import ccall safe "hs_bindgen_be50427e6a63df54" hs_bindgen_be50427e6a63df54_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_body2@
+hs_bindgen_be50427e6a63df54 :: IO A
+-- __unique:__ @test_macrosreparse_Example_Safe_body2@
+hs_bindgen_be50427e6a63df54 = fmap fromFFIType hs_bindgen_be50427e6a63df54_base
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_safe :: IO A
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_safe = hs_bindgen_be50427e6a63df54
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_float@
+foreign import ccall safe "hs_bindgen_627a52a5c7617083" hs_bindgen_627a52a5c7617083_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_float@
+hs_bindgen_627a52a5c7617083 :: A -> Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_float@
+hs_bindgen_627a52a5c7617083 = \x_0 -> \x_1 -> hs_bindgen_627a52a5c7617083_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_safe :: A -> Complex CFloat -> IO ()
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_627a52a5c7617083 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_double@
+foreign import ccall safe "hs_bindgen_392babebc1d83503" hs_bindgen_392babebc1d83503_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_double@
+hs_bindgen_392babebc1d83503 :: A -> Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_args_complex_double@
+hs_bindgen_392babebc1d83503 = \x_0 -> \x_1 -> hs_bindgen_392babebc1d83503_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_safe :: A -> Complex CDouble -> IO ()
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_392babebc1d83503 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_float@
+foreign import ccall safe "hs_bindgen_8958183ede73dea8" hs_bindgen_8958183ede73dea8_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_float@
+hs_bindgen_8958183ede73dea8 :: A -> Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_float@
+hs_bindgen_8958183ede73dea8 = \x_0 -> \x_1 -> hs_bindgen_8958183ede73dea8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_safe :: A -> IO (Complex CFloat)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_8958183ede73dea8 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_double@
+foreign import ccall safe "hs_bindgen_a95fabfd391a99aa" hs_bindgen_a95fabfd391a99aa_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_double@
+hs_bindgen_a95fabfd391a99aa :: A -> Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_ret_complex_double@
+hs_bindgen_a95fabfd391a99aa = \x_0 -> \x_1 -> hs_bindgen_a95fabfd391a99aa_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_safe :: A -> IO (Complex CDouble)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_safe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_a95fabfd391a99aa arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args1@
+foreign import ccall safe "hs_bindgen_ad9f8630dd04a203" hs_bindgen_ad9f8630dd04a203_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args1@
+hs_bindgen_ad9f8630dd04a203 :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args1@
+hs_bindgen_ad9f8630dd04a203 = \x_0 -> \x_1 -> hs_bindgen_ad9f8630dd04a203_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_safe :: A -> CBool -> IO ()
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_safe = hs_bindgen_ad9f8630dd04a203
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args2@
+foreign import ccall safe "hs_bindgen_4b34178a505131e2" hs_bindgen_4b34178a505131e2_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args2@
+hs_bindgen_4b34178a505131e2 :: A ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_args2@
+hs_bindgen_4b34178a505131e2 = \x_0 -> \x_1 -> hs_bindgen_4b34178a505131e2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_safe :: A -> HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_safe = hs_bindgen_4b34178a505131e2
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret1@
+foreign import ccall safe "hs_bindgen_94b225a6394496c1" hs_bindgen_94b225a6394496c1_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret1@
+hs_bindgen_94b225a6394496c1 :: A -> IO CBool
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret1@
+hs_bindgen_94b225a6394496c1 = \x_0 -> fmap fromFFIType (hs_bindgen_94b225a6394496c1_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_safe :: A -> IO CBool
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_safe = hs_bindgen_94b225a6394496c1
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret2@
+foreign import ccall safe "hs_bindgen_7c9a1792426b84a1" hs_bindgen_7c9a1792426b84a1_base ::
+    CInt
+ -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret2@
+hs_bindgen_7c9a1792426b84a1 :: A -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_Example_Safe_bespoke_ret2@
+hs_bindgen_7c9a1792426b84a1 = \x_0 -> fmap fromFFIType (hs_bindgen_7c9a1792426b84a1_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_safe :: A -> IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_safe = hs_bindgen_7c9a1792426b84a1
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args1@
+foreign import ccall safe "hs_bindgen_e20689fe39004225" hs_bindgen_e20689fe39004225_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args1@
+hs_bindgen_e20689fe39004225 :: Ptr (Elem (IncompleteArray A)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args1@
+hs_bindgen_e20689fe39004225 = \x_0 -> hs_bindgen_e20689fe39004225_base (toFFIType x_0)
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_safe :: Ptr (Elem (IncompleteArray A)) -> IO ()
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_safe = hs_bindgen_e20689fe39004225
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args2@
+foreign import ccall safe "hs_bindgen_084796e4bfd3f4cd" hs_bindgen_084796e4bfd3f4cd_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args2@
+hs_bindgen_084796e4bfd3f4cd :: Ptr (Elem (IncompleteArray (Ptr A))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args2@
+hs_bindgen_084796e4bfd3f4cd = \x_0 -> hs_bindgen_084796e4bfd3f4cd_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_safe :: Ptr (Elem (IncompleteArray (Ptr A))) -> IO ()
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_safe = hs_bindgen_084796e4bfd3f4cd
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args3@
+foreign import ccall safe "hs_bindgen_a3d1560aaa4352df" hs_bindgen_a3d1560aaa4352df_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args3@
+hs_bindgen_a3d1560aaa4352df :: Ptr (Elem (ConstantArray 5 A)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args3@
+hs_bindgen_a3d1560aaa4352df = \x_0 -> hs_bindgen_a3d1560aaa4352df_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_safe :: Ptr (Elem (ConstantArray 5 A)) -> IO ()
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_safe = hs_bindgen_a3d1560aaa4352df
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args4@
+foreign import ccall safe "hs_bindgen_88659ccccc6c1f5f" hs_bindgen_88659ccccc6c1f5f_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args4@
+hs_bindgen_88659ccccc6c1f5f :: Ptr (Elem (ConstantArray 5
+                                                        (Ptr A))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_arr_args4@
+hs_bindgen_88659ccccc6c1f5f = \x_0 -> hs_bindgen_88659ccccc6c1f5f_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_safe :: Ptr (Elem (ConstantArray 5 (Ptr A))) -> IO ()
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_safe = hs_bindgen_88659ccccc6c1f5f
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args1@
+foreign import ccall safe "hs_bindgen_3448d03cfd41161a" hs_bindgen_3448d03cfd41161a_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args1@
+hs_bindgen_3448d03cfd41161a :: A -> FunPtr (IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args1@
+hs_bindgen_3448d03cfd41161a = \x_0 -> \x_1 -> hs_bindgen_3448d03cfd41161a_base (toFFIType x_0) (toFFIType x_1)
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_safe :: A -> FunPtr (IO ()) -> IO ()
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_safe = hs_bindgen_3448d03cfd41161a
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args2@
+foreign import ccall safe "hs_bindgen_92d7386f0a327d25" hs_bindgen_92d7386f0a327d25_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args2@
+hs_bindgen_92d7386f0a327d25 :: A -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args2@
+hs_bindgen_92d7386f0a327d25 = \x_0 -> \x_1 -> hs_bindgen_92d7386f0a327d25_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_safe :: A -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_safe = hs_bindgen_92d7386f0a327d25
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args3@
+foreign import ccall safe "hs_bindgen_2881f594f98043e6" hs_bindgen_2881f594f98043e6_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args3@
+hs_bindgen_2881f594f98043e6 :: A -> FunPtr (CInt -> IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args3@
+hs_bindgen_2881f594f98043e6 = \x_0 -> \x_1 -> hs_bindgen_2881f594f98043e6_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_safe :: A -> FunPtr (CInt -> IO ()) -> IO ()
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_safe = hs_bindgen_2881f594f98043e6
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args4@
+foreign import ccall safe "hs_bindgen_1e85a05df4251f62" hs_bindgen_1e85a05df4251f62_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args4@
+hs_bindgen_1e85a05df4251f62 :: A ->
+                               FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args4@
+hs_bindgen_1e85a05df4251f62 = \x_0 -> \x_1 -> hs_bindgen_1e85a05df4251f62_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_safe :: A ->
+                     FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_safe = hs_bindgen_1e85a05df4251f62
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args5@
+foreign import ccall safe "hs_bindgen_ccf4db7511f0d6d6" hs_bindgen_ccf4db7511f0d6d6_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args5@
+hs_bindgen_ccf4db7511f0d6d6 :: A ->
+                               FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_args5@
+hs_bindgen_ccf4db7511f0d6d6 = \x_0 -> \x_1 -> hs_bindgen_ccf4db7511f0d6d6_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_safe :: A ->
+                     FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_safe = hs_bindgen_ccf4db7511f0d6d6
+-- __unique:__ @test_macrosreparse_Example_Safe_comments1@
+foreign import ccall safe "hs_bindgen_4c756db60673d221" hs_bindgen_4c756db60673d221_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_comments1@
+hs_bindgen_4c756db60673d221 :: A -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_comments1@
+hs_bindgen_4c756db60673d221 = \x_0 -> hs_bindgen_4c756db60673d221_base (toFFIType x_0)
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_safe :: A -> IO ()
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_safe = hs_bindgen_4c756db60673d221
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before1@
+foreign import ccall safe "hs_bindgen_278568d7a2a3a4b6" hs_bindgen_278568d7a2a3a4b6_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before1@
+hs_bindgen_278568d7a2a3a4b6 :: A -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before1@
+hs_bindgen_278568d7a2a3a4b6 = \x_0 -> \x_1 -> hs_bindgen_278568d7a2a3a4b6_base (toFFIType x_0) (toFFIType x_1)
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_safe :: A -> CChar -> IO ()
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_safe = hs_bindgen_278568d7a2a3a4b6
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before2@
+foreign import ccall safe "hs_bindgen_87ee56525e5ea20c" hs_bindgen_87ee56525e5ea20c_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before2@
+hs_bindgen_87ee56525e5ea20c :: A -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before2@
+hs_bindgen_87ee56525e5ea20c = \x_0 -> \x_1 -> hs_bindgen_87ee56525e5ea20c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_safe :: A -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_safe = hs_bindgen_87ee56525e5ea20c
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before3@
+foreign import ccall safe "hs_bindgen_c0b99594235bd99e" hs_bindgen_c0b99594235bd99e_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before3@
+hs_bindgen_c0b99594235bd99e :: A -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_before3@
+hs_bindgen_c0b99594235bd99e = \x_0 -> \x_1 -> hs_bindgen_c0b99594235bd99e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_safe :: A -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_safe = hs_bindgen_c0b99594235bd99e
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after1@
+foreign import ccall safe "hs_bindgen_d718b682f157fc18" hs_bindgen_d718b682f157fc18_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after1@
+hs_bindgen_d718b682f157fc18 :: A -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after1@
+hs_bindgen_d718b682f157fc18 = \x_0 -> \x_1 -> hs_bindgen_d718b682f157fc18_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_safe :: A -> CChar -> IO ()
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_safe = hs_bindgen_d718b682f157fc18
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after2@
+foreign import ccall safe "hs_bindgen_f2c5b3d5eca68433" hs_bindgen_f2c5b3d5eca68433_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after2@
+hs_bindgen_f2c5b3d5eca68433 :: A -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after2@
+hs_bindgen_f2c5b3d5eca68433 = \x_0 -> \x_1 -> hs_bindgen_f2c5b3d5eca68433_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_safe :: A -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_safe = hs_bindgen_f2c5b3d5eca68433
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after3@
+foreign import ccall safe "hs_bindgen_ae2d994e06667b23" hs_bindgen_ae2d994e06667b23_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after3@
+hs_bindgen_ae2d994e06667b23 :: A -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_prim_after3@
+hs_bindgen_ae2d994e06667b23 = \x_0 -> \x_1 -> hs_bindgen_ae2d994e06667b23_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_safe :: A -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_safe = hs_bindgen_ae2d994e06667b23
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before1@
+foreign import ccall safe "hs_bindgen_6940b58e7f4397a7" hs_bindgen_6940b58e7f4397a7_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before1@
+hs_bindgen_6940b58e7f4397a7 :: A -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before1@
+hs_bindgen_6940b58e7f4397a7 = \x_0 -> \x_1 -> hs_bindgen_6940b58e7f4397a7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_safe :: A -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_safe = hs_bindgen_6940b58e7f4397a7
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before2@
+foreign import ccall safe "hs_bindgen_00b6fe2282e779b1" hs_bindgen_00b6fe2282e779b1_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before2@
+hs_bindgen_00b6fe2282e779b1 :: A -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before2@
+hs_bindgen_00b6fe2282e779b1 = \x_0 -> \x_1 -> hs_bindgen_00b6fe2282e779b1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_safe :: A -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_safe = hs_bindgen_00b6fe2282e779b1
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before3@
+foreign import ccall safe "hs_bindgen_6517cc8d39aead93" hs_bindgen_6517cc8d39aead93_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before3@
+hs_bindgen_6517cc8d39aead93 :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before3@
+hs_bindgen_6517cc8d39aead93 = \x_0 -> \x_1 -> hs_bindgen_6517cc8d39aead93_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_safe :: A -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_safe = hs_bindgen_6517cc8d39aead93
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before4@
+foreign import ccall safe "hs_bindgen_68c7661e95060488" hs_bindgen_68c7661e95060488_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before4@
+hs_bindgen_68c7661e95060488 :: A -> PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before4@
+hs_bindgen_68c7661e95060488 = \x_0 -> \x_1 -> hs_bindgen_68c7661e95060488_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_safe :: A -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_68c7661e95060488 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before5@
+foreign import ccall safe "hs_bindgen_42b3b0bf73a7a51a" hs_bindgen_42b3b0bf73a7a51a_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before5@
+hs_bindgen_42b3b0bf73a7a51a :: A -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before5@
+hs_bindgen_42b3b0bf73a7a51a = \x_0 -> \x_1 -> hs_bindgen_42b3b0bf73a7a51a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_safe :: A -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_42b3b0bf73a7a51a arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before6@
+foreign import ccall safe "hs_bindgen_c4aabe9834aac12f" hs_bindgen_c4aabe9834aac12f_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before6@
+hs_bindgen_c4aabe9834aac12f :: A -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before6@
+hs_bindgen_c4aabe9834aac12f = \x_0 -> \x_1 -> hs_bindgen_c4aabe9834aac12f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_safe :: A -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_safe = hs_bindgen_c4aabe9834aac12f
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before7@
+foreign import ccall safe "hs_bindgen_486090a7fb4e34d4" hs_bindgen_486090a7fb4e34d4_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before7@
+hs_bindgen_486090a7fb4e34d4 :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before7@
+hs_bindgen_486090a7fb4e34d4 = \x_0 -> \x_1 -> hs_bindgen_486090a7fb4e34d4_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_safe :: A -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_safe = hs_bindgen_486090a7fb4e34d4
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before8@
+foreign import ccall safe "hs_bindgen_23fa742b614176dd" hs_bindgen_23fa742b614176dd_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before8@
+hs_bindgen_23fa742b614176dd :: A ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_before8@
+hs_bindgen_23fa742b614176dd = \x_0 -> \x_1 -> hs_bindgen_23fa742b614176dd_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_safe :: A ->
+                                  HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_safe = hs_bindgen_23fa742b614176dd
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after1@
+foreign import ccall safe "hs_bindgen_0aacd8a5d48f296d" hs_bindgen_0aacd8a5d48f296d_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after1@
+hs_bindgen_0aacd8a5d48f296d :: A -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after1@
+hs_bindgen_0aacd8a5d48f296d = \x_0 -> \x_1 -> hs_bindgen_0aacd8a5d48f296d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_safe :: A -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_safe = hs_bindgen_0aacd8a5d48f296d
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after2@
+foreign import ccall safe "hs_bindgen_16ec2102221485b7" hs_bindgen_16ec2102221485b7_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after2@
+hs_bindgen_16ec2102221485b7 :: A -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after2@
+hs_bindgen_16ec2102221485b7 = \x_0 -> \x_1 -> hs_bindgen_16ec2102221485b7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_safe :: A -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_safe = hs_bindgen_16ec2102221485b7
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after3@
+foreign import ccall safe "hs_bindgen_9aa934d44ec3790c" hs_bindgen_9aa934d44ec3790c_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after3@
+hs_bindgen_9aa934d44ec3790c :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after3@
+hs_bindgen_9aa934d44ec3790c = \x_0 -> \x_1 -> hs_bindgen_9aa934d44ec3790c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_safe :: A -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_safe = hs_bindgen_9aa934d44ec3790c
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after4@
+foreign import ccall safe "hs_bindgen_043d2869e29bedcf" hs_bindgen_043d2869e29bedcf_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after4@
+hs_bindgen_043d2869e29bedcf :: A -> PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after4@
+hs_bindgen_043d2869e29bedcf = \x_0 -> \x_1 -> hs_bindgen_043d2869e29bedcf_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_safe :: A -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_043d2869e29bedcf arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after5@
+foreign import ccall safe "hs_bindgen_b5f9bca1de9d69de" hs_bindgen_b5f9bca1de9d69de_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after5@
+hs_bindgen_b5f9bca1de9d69de :: A -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after5@
+hs_bindgen_b5f9bca1de9d69de = \x_0 -> \x_1 -> hs_bindgen_b5f9bca1de9d69de_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_safe :: A -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_safe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_b5f9bca1de9d69de arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after6@
+foreign import ccall safe "hs_bindgen_77d641d518b2504f" hs_bindgen_77d641d518b2504f_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after6@
+hs_bindgen_77d641d518b2504f :: A -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after6@
+hs_bindgen_77d641d518b2504f = \x_0 -> \x_1 -> hs_bindgen_77d641d518b2504f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_safe :: A -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_safe = hs_bindgen_77d641d518b2504f
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after7@
+foreign import ccall safe "hs_bindgen_691b4f2909140b49" hs_bindgen_691b4f2909140b49_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after7@
+hs_bindgen_691b4f2909140b49 :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after7@
+hs_bindgen_691b4f2909140b49 = \x_0 -> \x_1 -> hs_bindgen_691b4f2909140b49_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_safe :: A -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_safe = hs_bindgen_691b4f2909140b49
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after8@
+foreign import ccall safe "hs_bindgen_ae74c8dcdc2ec9eb" hs_bindgen_ae74c8dcdc2ec9eb_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after8@
+hs_bindgen_ae74c8dcdc2ec9eb :: A ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_withoutSign_after8@
+hs_bindgen_ae74c8dcdc2ec9eb = \x_0 -> \x_1 -> hs_bindgen_ae74c8dcdc2ec9eb_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_safe :: A ->
+                                 HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_safe = hs_bindgen_ae74c8dcdc2ec9eb
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args1@
+foreign import ccall safe "hs_bindgen_07606c41eadf9146" hs_bindgen_07606c41eadf9146_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args1@
+hs_bindgen_07606c41eadf9146 :: A -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args1@
+hs_bindgen_07606c41eadf9146 = \x_0 -> \x_1 -> hs_bindgen_07606c41eadf9146_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_safe :: A -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_safe = hs_bindgen_07606c41eadf9146
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args2@
+foreign import ccall safe "hs_bindgen_3836769f3a3416ac" hs_bindgen_3836769f3a3416ac_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args2@
+hs_bindgen_3836769f3a3416ac :: A -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args2@
+hs_bindgen_3836769f3a3416ac = \x_0 -> \x_1 -> hs_bindgen_3836769f3a3416ac_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_safe :: A -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_safe = hs_bindgen_3836769f3a3416ac
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args3@
+foreign import ccall safe "hs_bindgen_12f19ea593aefd3f" hs_bindgen_12f19ea593aefd3f_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args3@
+hs_bindgen_12f19ea593aefd3f :: A -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args3@
+hs_bindgen_12f19ea593aefd3f = \x_0 -> \x_1 -> hs_bindgen_12f19ea593aefd3f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_safe :: A -> Ptr CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_safe = hs_bindgen_12f19ea593aefd3f
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args4@
+foreign import ccall safe "hs_bindgen_5a50e98897696d57" hs_bindgen_5a50e98897696d57_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args4@
+hs_bindgen_5a50e98897696d57 :: A -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args4@
+hs_bindgen_5a50e98897696d57 = \x_0 -> \x_1 -> hs_bindgen_5a50e98897696d57_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_safe :: A -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_safe = hs_bindgen_5a50e98897696d57
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args5@
+foreign import ccall safe "hs_bindgen_666701f7cb61bd15" hs_bindgen_666701f7cb61bd15_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args5@
+hs_bindgen_666701f7cb61bd15 :: A -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_args5@
+hs_bindgen_666701f7cb61bd15 = \x_0 -> \x_1 -> hs_bindgen_666701f7cb61bd15_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_safe :: A -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_safe = hs_bindgen_666701f7cb61bd15
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret1@
+foreign import ccall safe "hs_bindgen_b94fbc3dfd285563" hs_bindgen_b94fbc3dfd285563_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret1@
+hs_bindgen_b94fbc3dfd285563 :: A -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret1@
+hs_bindgen_b94fbc3dfd285563 = \x_0 -> fmap fromFFIType (hs_bindgen_b94fbc3dfd285563_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_safe :: A -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_safe = hs_bindgen_b94fbc3dfd285563
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret2@
+foreign import ccall safe "hs_bindgen_33e2960e26b79450" hs_bindgen_33e2960e26b79450_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret2@
+hs_bindgen_33e2960e26b79450 :: A -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret2@
+hs_bindgen_33e2960e26b79450 = \x_0 -> fmap fromFFIType (hs_bindgen_33e2960e26b79450_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_safe :: A -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_safe = hs_bindgen_33e2960e26b79450
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret3@
+foreign import ccall safe "hs_bindgen_50c6e2fe4f3fb777" hs_bindgen_50c6e2fe4f3fb777_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret3@
+hs_bindgen_50c6e2fe4f3fb777 :: A -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret3@
+hs_bindgen_50c6e2fe4f3fb777 = \x_0 -> fmap fromFFIType (hs_bindgen_50c6e2fe4f3fb777_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_safe :: A -> IO (Ptr CInt)
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_safe = hs_bindgen_50c6e2fe4f3fb777
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret4@
+foreign import ccall safe "hs_bindgen_edc014695d896c8d" hs_bindgen_edc014695d896c8d_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret4@
+hs_bindgen_edc014695d896c8d :: A -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret4@
+hs_bindgen_edc014695d896c8d = \x_0 -> fmap fromFFIType (hs_bindgen_edc014695d896c8d_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_safe :: A -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_safe = hs_bindgen_edc014695d896c8d
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret5@
+foreign import ccall safe "hs_bindgen_6d3308cc5847f033" hs_bindgen_6d3308cc5847f033_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret5@
+hs_bindgen_6d3308cc5847f033 :: A -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_Example_Safe_const_pointers_ret5@
+hs_bindgen_6d3308cc5847f033 = \x_0 -> fmap fromFFIType (hs_bindgen_6d3308cc5847f033_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_safe :: A -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_safe = hs_bindgen_6d3308cc5847f033
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem1@
+foreign import ccall safe "hs_bindgen_678576320923a4d1" hs_bindgen_678576320923a4d1_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem1@
+hs_bindgen_678576320923a4d1 :: PtrConst (Elem (IncompleteArray A)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem1@
+hs_bindgen_678576320923a4d1 = \x_0 -> hs_bindgen_678576320923a4d1_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_safe :: PtrConst (Elem (IncompleteArray A)) ->
+                          IO ()
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_safe = hs_bindgen_678576320923a4d1
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem2@
+foreign import ccall safe "hs_bindgen_b317941dde4eeff2" hs_bindgen_b317941dde4eeff2_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem2@
+hs_bindgen_b317941dde4eeff2 :: Ptr (Elem (IncompleteArray (PtrConst A))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem2@
+hs_bindgen_b317941dde4eeff2 = \x_0 -> hs_bindgen_b317941dde4eeff2_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_safe :: Ptr (Elem (IncompleteArray (PtrConst A))) ->
+                          IO ()
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_safe = hs_bindgen_b317941dde4eeff2
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem3@
+foreign import ccall safe "hs_bindgen_707e602e6beb1bb6" hs_bindgen_707e602e6beb1bb6_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem3@
+hs_bindgen_707e602e6beb1bb6 :: PtrConst (Elem (IncompleteArray (Ptr A))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_const_array_elem3@
+hs_bindgen_707e602e6beb1bb6 = \x_0 -> hs_bindgen_707e602e6beb1bb6_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_safe :: PtrConst (Elem (IncompleteArray (Ptr A))) ->
+                          IO ()
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_safe = hs_bindgen_707e602e6beb1bb6
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams1@
+foreign import ccall safe "hs_bindgen_93fecb4eb766c262" hs_bindgen_93fecb4eb766c262_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams1@
+hs_bindgen_93fecb4eb766c262 :: IO A
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams1@
+hs_bindgen_93fecb4eb766c262 = fmap fromFFIType hs_bindgen_93fecb4eb766c262_base
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_safe :: IO A
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_safe = hs_bindgen_93fecb4eb766c262
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams2@
+foreign import ccall safe "hs_bindgen_4350965157c891f5" hs_bindgen_4350965157c891f5_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams2@
+hs_bindgen_4350965157c891f5 :: IO A
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams2@
+hs_bindgen_4350965157c891f5 = fmap fromFFIType hs_bindgen_4350965157c891f5_base
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_safe :: IO A
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_safe = hs_bindgen_4350965157c891f5
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams3@
+foreign import ccall safe "hs_bindgen_c4f59272a2b1c3b5" hs_bindgen_c4f59272a2b1c3b5_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams3@
+hs_bindgen_c4f59272a2b1c3b5 :: A -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Safe_noParams3@
+hs_bindgen_c4f59272a2b1c3b5 = \x_0 -> \x_1 -> hs_bindgen_c4f59272a2b1c3b5_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_safe :: A -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_safe = hs_bindgen_c4f59272a2b1c3b5
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret1@
+foreign import ccall safe "hs_bindgen_387a04c01e23c320" hs_bindgen_387a04c01e23c320_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret1@
+hs_bindgen_387a04c01e23c320 :: A -> IO (FunPtr (IO ()))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret1@
+hs_bindgen_387a04c01e23c320 = \x_0 -> fmap fromFFIType (hs_bindgen_387a04c01e23c320_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_safe :: A -> IO (FunPtr (IO ()))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_safe = hs_bindgen_387a04c01e23c320
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret2@
+foreign import ccall safe "hs_bindgen_6f0c14cd3478dc19" hs_bindgen_6f0c14cd3478dc19_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret2@
+hs_bindgen_6f0c14cd3478dc19 :: A -> IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret2@
+hs_bindgen_6f0c14cd3478dc19 = \x_0 -> fmap fromFFIType (hs_bindgen_6f0c14cd3478dc19_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_safe :: A -> IO (FunPtr (IO CInt))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_safe = hs_bindgen_6f0c14cd3478dc19
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret3@
+foreign import ccall safe "hs_bindgen_08e8661d277cf7be" hs_bindgen_08e8661d277cf7be_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret3@
+hs_bindgen_08e8661d277cf7be :: A -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret3@
+hs_bindgen_08e8661d277cf7be = \x_0 -> fmap fromFFIType (hs_bindgen_08e8661d277cf7be_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_safe :: A -> IO (FunPtr (CInt -> IO ()))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_safe = hs_bindgen_08e8661d277cf7be
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret4@
+foreign import ccall safe "hs_bindgen_609b5d953b68da92" hs_bindgen_609b5d953b68da92_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret4@
+hs_bindgen_609b5d953b68da92 :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO CChar))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret4@
+hs_bindgen_609b5d953b68da92 = \x_0 -> fmap fromFFIType (hs_bindgen_609b5d953b68da92_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_safe :: A -> IO (FunPtr (CInt -> CDouble -> IO CChar))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_safe = hs_bindgen_609b5d953b68da92
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret5@
+foreign import ccall safe "hs_bindgen_13e6ae43abf40aee" hs_bindgen_13e6ae43abf40aee_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret5@
+hs_bindgen_13e6ae43abf40aee :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret5@
+hs_bindgen_13e6ae43abf40aee = \x_0 -> fmap fromFFIType (hs_bindgen_13e6ae43abf40aee_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_safe :: A ->
+                    IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_safe = hs_bindgen_13e6ae43abf40aee
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret6@
+foreign import ccall safe "hs_bindgen_a4a3a86f28ca6299" hs_bindgen_a4a3a86f28ca6299_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret6@
+hs_bindgen_a4a3a86f28ca6299 :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret6@
+hs_bindgen_a4a3a86f28ca6299 = \x_0 -> fmap fromFFIType (hs_bindgen_a4a3a86f28ca6299_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_safe :: A ->
+                    IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_safe = hs_bindgen_a4a3a86f28ca6299
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret7@
+foreign import ccall safe "hs_bindgen_eae9dff04c88d00b" hs_bindgen_eae9dff04c88d00b_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret7@
+hs_bindgen_eae9dff04c88d00b :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret7@
+hs_bindgen_eae9dff04c88d00b = \x_0 -> fmap fromFFIType (hs_bindgen_eae9dff04c88d00b_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_safe :: A ->
+                    IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_safe = hs_bindgen_eae9dff04c88d00b
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret8@
+foreign import ccall safe "hs_bindgen_894457d90a2fc8db" hs_bindgen_894457d90a2fc8db_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret8@
+hs_bindgen_894457d90a2fc8db :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret8@
+hs_bindgen_894457d90a2fc8db = \x_0 -> fmap fromFFIType (hs_bindgen_894457d90a2fc8db_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_safe :: A ->
+                    IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_safe = hs_bindgen_894457d90a2fc8db
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret9@
+foreign import ccall safe "hs_bindgen_c893eb15ad9bc68c" hs_bindgen_c893eb15ad9bc68c_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret9@
+hs_bindgen_c893eb15ad9bc68c :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret9@
+hs_bindgen_c893eb15ad9bc68c = \x_0 -> fmap fromFFIType (hs_bindgen_c893eb15ad9bc68c_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_safe :: A ->
+                    IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_safe = hs_bindgen_c893eb15ad9bc68c
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret10@
+foreign import ccall safe "hs_bindgen_d96c258298a44b28" hs_bindgen_d96c258298a44b28_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret10@
+hs_bindgen_d96c258298a44b28 :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_Safe_funptr_ret10@
+hs_bindgen_d96c258298a44b28 = \x_0 -> fmap fromFFIType (hs_bindgen_d96c258298a44b28_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_safe :: A ->
+                     IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_safe = hs_bindgen_d96c258298a44b28
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char1@
+foreign import ccall unsafe "hs_bindgen_c1716e300ba327c7" hs_bindgen_c1716e300ba327c7_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char1@
+hs_bindgen_c1716e300ba327c7 :: A -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char1@
+hs_bindgen_c1716e300ba327c7 = \x_0 -> \x_1 -> hs_bindgen_c1716e300ba327c7_base (toFFIType x_0) (toFFIType x_1)
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_unsafe :: A -> CChar -> IO ()
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_unsafe = hs_bindgen_c1716e300ba327c7
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char2@
+foreign import ccall unsafe "hs_bindgen_3ef14607a6187aaa" hs_bindgen_3ef14607a6187aaa_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char2@
+hs_bindgen_3ef14607a6187aaa :: A -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char2@
+hs_bindgen_3ef14607a6187aaa = \x_0 -> \x_1 -> hs_bindgen_3ef14607a6187aaa_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_unsafe :: A -> CSChar -> IO ()
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_unsafe = hs_bindgen_3ef14607a6187aaa
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char3@
+foreign import ccall unsafe "hs_bindgen_5b0a626f64912f9d" hs_bindgen_5b0a626f64912f9d_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char3@
+hs_bindgen_5b0a626f64912f9d :: A -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_char3@
+hs_bindgen_5b0a626f64912f9d = \x_0 -> \x_1 -> hs_bindgen_5b0a626f64912f9d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_unsafe :: A -> CUChar -> IO ()
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_unsafe = hs_bindgen_5b0a626f64912f9d
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short1@
+foreign import ccall unsafe "hs_bindgen_36e4501239085bc1" hs_bindgen_36e4501239085bc1_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short1@
+hs_bindgen_36e4501239085bc1 :: A -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short1@
+hs_bindgen_36e4501239085bc1 = \x_0 -> \x_1 -> hs_bindgen_36e4501239085bc1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_unsafe :: A -> CShort -> IO ()
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_unsafe = hs_bindgen_36e4501239085bc1
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short2@
+foreign import ccall unsafe "hs_bindgen_a187e0233daeb237" hs_bindgen_a187e0233daeb237_base ::
+    CInt
+ -> CShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short2@
+hs_bindgen_a187e0233daeb237 :: A -> CShort -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short2@
+hs_bindgen_a187e0233daeb237 = \x_0 -> \x_1 -> hs_bindgen_a187e0233daeb237_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_unsafe :: A -> CShort -> IO ()
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_unsafe = hs_bindgen_a187e0233daeb237
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short3@
+foreign import ccall unsafe "hs_bindgen_2460adeff61561ce" hs_bindgen_2460adeff61561ce_base ::
+    CInt
+ -> CUShort
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short3@
+hs_bindgen_2460adeff61561ce :: A -> CUShort -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_short3@
+hs_bindgen_2460adeff61561ce = \x_0 -> \x_1 -> hs_bindgen_2460adeff61561ce_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_unsafe :: A -> CUShort -> IO ()
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_unsafe = hs_bindgen_2460adeff61561ce
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int1@
+foreign import ccall unsafe "hs_bindgen_4f13ab06db79b7f2" hs_bindgen_4f13ab06db79b7f2_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int1@
+hs_bindgen_4f13ab06db79b7f2 :: A -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int1@
+hs_bindgen_4f13ab06db79b7f2 = \x_0 -> \x_1 -> hs_bindgen_4f13ab06db79b7f2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_unsafe :: A -> CInt -> IO ()
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_unsafe = hs_bindgen_4f13ab06db79b7f2
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int2@
+foreign import ccall unsafe "hs_bindgen_f1657d18f6f8a1ed" hs_bindgen_f1657d18f6f8a1ed_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int2@
+hs_bindgen_f1657d18f6f8a1ed :: A -> CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int2@
+hs_bindgen_f1657d18f6f8a1ed = \x_0 -> \x_1 -> hs_bindgen_f1657d18f6f8a1ed_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_unsafe :: A -> CInt -> IO ()
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_unsafe = hs_bindgen_f1657d18f6f8a1ed
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int3@
+foreign import ccall unsafe "hs_bindgen_9ac58b8eb806be42" hs_bindgen_9ac58b8eb806be42_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int3@
+hs_bindgen_9ac58b8eb806be42 :: A -> CUInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_int3@
+hs_bindgen_9ac58b8eb806be42 = \x_0 -> \x_1 -> hs_bindgen_9ac58b8eb806be42_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_unsafe :: A -> CUInt -> IO ()
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_unsafe = hs_bindgen_9ac58b8eb806be42
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long1@
+foreign import ccall unsafe "hs_bindgen_f73c59fe22a9870e" hs_bindgen_f73c59fe22a9870e_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long1@
+hs_bindgen_f73c59fe22a9870e :: A -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long1@
+hs_bindgen_f73c59fe22a9870e = \x_0 -> \x_1 -> hs_bindgen_f73c59fe22a9870e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_unsafe :: A -> CLong -> IO ()
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_unsafe = hs_bindgen_f73c59fe22a9870e
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long2@
+foreign import ccall unsafe "hs_bindgen_84a824853fc83077" hs_bindgen_84a824853fc83077_base ::
+    CInt
+ -> CLong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long2@
+hs_bindgen_84a824853fc83077 :: A -> CLong -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long2@
+hs_bindgen_84a824853fc83077 = \x_0 -> \x_1 -> hs_bindgen_84a824853fc83077_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_unsafe :: A -> CLong -> IO ()
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_unsafe = hs_bindgen_84a824853fc83077
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long3@
+foreign import ccall unsafe "hs_bindgen_c4c1a08ddf9cd5bc" hs_bindgen_c4c1a08ddf9cd5bc_base ::
+    CInt
+ -> CULong
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long3@
+hs_bindgen_c4c1a08ddf9cd5bc :: A -> CULong -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_long3@
+hs_bindgen_c4c1a08ddf9cd5bc = \x_0 -> \x_1 -> hs_bindgen_c4c1a08ddf9cd5bc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_unsafe :: A -> CULong -> IO ()
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_unsafe = hs_bindgen_c4c1a08ddf9cd5bc
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_float@
+foreign import ccall unsafe "hs_bindgen_58a6b5f118525c6c" hs_bindgen_58a6b5f118525c6c_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_float@
+hs_bindgen_58a6b5f118525c6c :: A -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_float@
+hs_bindgen_58a6b5f118525c6c = \x_0 -> \x_1 -> hs_bindgen_58a6b5f118525c6c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_unsafe :: A -> CFloat -> IO ()
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_unsafe = hs_bindgen_58a6b5f118525c6c
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_double@
+foreign import ccall unsafe "hs_bindgen_ffc58625c3a51d8f" hs_bindgen_ffc58625c3a51d8f_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_double@
+hs_bindgen_ffc58625c3a51d8f :: A -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_double@
+hs_bindgen_ffc58625c3a51d8f = \x_0 -> \x_1 -> hs_bindgen_ffc58625c3a51d8f_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_unsafe :: A -> CDouble -> IO ()
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_unsafe = hs_bindgen_ffc58625c3a51d8f
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_bool1@
+foreign import ccall unsafe "hs_bindgen_51fb2da1d100c9a7" hs_bindgen_51fb2da1d100c9a7_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_bool1@
+hs_bindgen_51fb2da1d100c9a7 :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_bool1@
+hs_bindgen_51fb2da1d100c9a7 = \x_0 -> \x_1 -> hs_bindgen_51fb2da1d100c9a7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_unsafe :: A -> CBool -> IO ()
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_unsafe = hs_bindgen_51fb2da1d100c9a7
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_struct@
+foreign import ccall unsafe "hs_bindgen_b2d19f91a7b9f7d3" hs_bindgen_b2d19f91a7b9f7d3_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_struct@
+hs_bindgen_b2d19f91a7b9f7d3 :: A -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_struct@
+hs_bindgen_b2d19f91a7b9f7d3 = \x_0 -> \x_1 -> hs_bindgen_b2d19f91a7b9f7d3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_unsafe :: A -> Some_struct -> IO ()
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_b2d19f91a7b9f7d3 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_union@
+foreign import ccall unsafe "hs_bindgen_bc74164a05d282c7" hs_bindgen_bc74164a05d282c7_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_union@
+hs_bindgen_bc74164a05d282c7 :: A -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_union@
+hs_bindgen_bc74164a05d282c7 = \x_0 -> \x_1 -> hs_bindgen_bc74164a05d282c7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_unsafe :: A -> Some_union -> IO ()
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_bc74164a05d282c7 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_enum@
+foreign import ccall unsafe "hs_bindgen_69f08c1d9f5e590e" hs_bindgen_69f08c1d9f5e590e_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_enum@
+hs_bindgen_69f08c1d9f5e590e :: A -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_enum@
+hs_bindgen_69f08c1d9f5e590e = \x_0 -> \x_1 -> hs_bindgen_69f08c1d9f5e590e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_unsafe :: A -> Some_enum -> IO ()
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_unsafe = hs_bindgen_69f08c1d9f5e590e
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_785b005f35d4d7ec" hs_bindgen_785b005f35d4d7ec_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer1@
+hs_bindgen_785b005f35d4d7ec :: A -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer1@
+hs_bindgen_785b005f35d4d7ec = \x_0 -> \x_1 -> hs_bindgen_785b005f35d4d7ec_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_unsafe :: A -> Ptr CInt -> IO ()
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_unsafe = hs_bindgen_785b005f35d4d7ec
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_edc45a1b9750dcd3" hs_bindgen_edc45a1b9750dcd3_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer2@
+hs_bindgen_edc45a1b9750dcd3 :: A -> Ptr (Ptr CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer2@
+hs_bindgen_edc45a1b9750dcd3 = \x_0 -> \x_1 -> hs_bindgen_edc45a1b9750dcd3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_unsafe :: A -> Ptr (Ptr CInt) -> IO ()
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_unsafe = hs_bindgen_edc45a1b9750dcd3
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_102895862f35ca35" hs_bindgen_102895862f35ca35_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer3@
+hs_bindgen_102895862f35ca35 :: A -> Ptr Void -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_pointer3@
+hs_bindgen_102895862f35ca35 = \x_0 -> \x_1 -> hs_bindgen_102895862f35ca35_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_unsafe :: A -> Ptr Void -> IO ()
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_unsafe = hs_bindgen_102895862f35ca35
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_A@
+foreign import ccall unsafe "hs_bindgen_78f9ea765accb501" hs_bindgen_78f9ea765accb501_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_A@
+hs_bindgen_78f9ea765accb501 :: IO A
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_A@
+hs_bindgen_78f9ea765accb501 = fmap fromFFIType hs_bindgen_78f9ea765accb501_base
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_unsafe :: IO A
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_unsafe = hs_bindgen_78f9ea765accb501
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char1@
+foreign import ccall unsafe "hs_bindgen_e1e99ef9fc54a288" hs_bindgen_e1e99ef9fc54a288_base ::
+    CInt
+ -> IO CChar
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char1@
+hs_bindgen_e1e99ef9fc54a288 :: A -> IO CChar
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char1@
+hs_bindgen_e1e99ef9fc54a288 = \x_0 -> fmap fromFFIType (hs_bindgen_e1e99ef9fc54a288_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_unsafe :: A -> IO CChar
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_unsafe = hs_bindgen_e1e99ef9fc54a288
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char2@
+foreign import ccall unsafe "hs_bindgen_f6217639a7e142d3" hs_bindgen_f6217639a7e142d3_base ::
+    CInt
+ -> IO CSChar
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char2@
+hs_bindgen_f6217639a7e142d3 :: A -> IO CSChar
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char2@
+hs_bindgen_f6217639a7e142d3 = \x_0 -> fmap fromFFIType (hs_bindgen_f6217639a7e142d3_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_unsafe :: A -> IO CSChar
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_unsafe = hs_bindgen_f6217639a7e142d3
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char3@
+foreign import ccall unsafe "hs_bindgen_759b6cec946323f4" hs_bindgen_759b6cec946323f4_base ::
+    CInt
+ -> IO CUChar
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char3@
+hs_bindgen_759b6cec946323f4 :: A -> IO CUChar
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_char3@
+hs_bindgen_759b6cec946323f4 = \x_0 -> fmap fromFFIType (hs_bindgen_759b6cec946323f4_base (toFFIType x_0))
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_unsafe :: A -> IO CUChar
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_unsafe = hs_bindgen_759b6cec946323f4
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short1@
+foreign import ccall unsafe "hs_bindgen_bf062c8332405f82" hs_bindgen_bf062c8332405f82_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short1@
+hs_bindgen_bf062c8332405f82 :: A -> IO CShort
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short1@
+hs_bindgen_bf062c8332405f82 = \x_0 -> fmap fromFFIType (hs_bindgen_bf062c8332405f82_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_unsafe :: A -> IO CShort
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_unsafe = hs_bindgen_bf062c8332405f82
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short2@
+foreign import ccall unsafe "hs_bindgen_3d9d5e4b8135169a" hs_bindgen_3d9d5e4b8135169a_base ::
+    CInt
+ -> IO CShort
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short2@
+hs_bindgen_3d9d5e4b8135169a :: A -> IO CShort
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short2@
+hs_bindgen_3d9d5e4b8135169a = \x_0 -> fmap fromFFIType (hs_bindgen_3d9d5e4b8135169a_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_unsafe :: A -> IO CShort
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_unsafe = hs_bindgen_3d9d5e4b8135169a
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short3@
+foreign import ccall unsafe "hs_bindgen_63b44610868e424f" hs_bindgen_63b44610868e424f_base ::
+    CInt
+ -> IO CUShort
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short3@
+hs_bindgen_63b44610868e424f :: A -> IO CUShort
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_short3@
+hs_bindgen_63b44610868e424f = \x_0 -> fmap fromFFIType (hs_bindgen_63b44610868e424f_base (toFFIType x_0))
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_unsafe :: A -> IO CUShort
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_unsafe = hs_bindgen_63b44610868e424f
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int1@
+foreign import ccall unsafe "hs_bindgen_1a8d68c887085fbf" hs_bindgen_1a8d68c887085fbf_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int1@
+hs_bindgen_1a8d68c887085fbf :: A -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int1@
+hs_bindgen_1a8d68c887085fbf = \x_0 -> fmap fromFFIType (hs_bindgen_1a8d68c887085fbf_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_unsafe :: A -> IO CInt
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_unsafe = hs_bindgen_1a8d68c887085fbf
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int2@
+foreign import ccall unsafe "hs_bindgen_f64653c7b4576075" hs_bindgen_f64653c7b4576075_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int2@
+hs_bindgen_f64653c7b4576075 :: A -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int2@
+hs_bindgen_f64653c7b4576075 = \x_0 -> fmap fromFFIType (hs_bindgen_f64653c7b4576075_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_unsafe :: A -> IO CInt
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_unsafe = hs_bindgen_f64653c7b4576075
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int3@
+foreign import ccall unsafe "hs_bindgen_d2030910b711f1d8" hs_bindgen_d2030910b711f1d8_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int3@
+hs_bindgen_d2030910b711f1d8 :: A -> IO CUInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_int3@
+hs_bindgen_d2030910b711f1d8 = \x_0 -> fmap fromFFIType (hs_bindgen_d2030910b711f1d8_base (toFFIType x_0))
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_unsafe :: A -> IO CUInt
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_unsafe = hs_bindgen_d2030910b711f1d8
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long1@
+foreign import ccall unsafe "hs_bindgen_2d6a30810e6b27e3" hs_bindgen_2d6a30810e6b27e3_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long1@
+hs_bindgen_2d6a30810e6b27e3 :: A -> IO CLong
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long1@
+hs_bindgen_2d6a30810e6b27e3 = \x_0 -> fmap fromFFIType (hs_bindgen_2d6a30810e6b27e3_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_unsafe :: A -> IO CLong
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_unsafe = hs_bindgen_2d6a30810e6b27e3
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long2@
+foreign import ccall unsafe "hs_bindgen_02885fe1cf2771da" hs_bindgen_02885fe1cf2771da_base ::
+    CInt
+ -> IO CLong
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long2@
+hs_bindgen_02885fe1cf2771da :: A -> IO CLong
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long2@
+hs_bindgen_02885fe1cf2771da = \x_0 -> fmap fromFFIType (hs_bindgen_02885fe1cf2771da_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_unsafe :: A -> IO CLong
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_unsafe = hs_bindgen_02885fe1cf2771da
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long3@
+foreign import ccall unsafe "hs_bindgen_888c9704132541d5" hs_bindgen_888c9704132541d5_base ::
+    CInt
+ -> IO CULong
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long3@
+hs_bindgen_888c9704132541d5 :: A -> IO CULong
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_long3@
+hs_bindgen_888c9704132541d5 = \x_0 -> fmap fromFFIType (hs_bindgen_888c9704132541d5_base (toFFIType x_0))
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_unsafe :: A -> IO CULong
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_unsafe = hs_bindgen_888c9704132541d5
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_float@
+foreign import ccall unsafe "hs_bindgen_2d2ce0d386f26293" hs_bindgen_2d2ce0d386f26293_base ::
+    CInt
+ -> IO CFloat
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_float@
+hs_bindgen_2d2ce0d386f26293 :: A -> IO CFloat
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_float@
+hs_bindgen_2d2ce0d386f26293 = \x_0 -> fmap fromFFIType (hs_bindgen_2d2ce0d386f26293_base (toFFIType x_0))
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_unsafe :: A -> IO CFloat
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_unsafe = hs_bindgen_2d2ce0d386f26293
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_double@
+foreign import ccall unsafe "hs_bindgen_de353a737de53428" hs_bindgen_de353a737de53428_base ::
+    CInt
+ -> IO CDouble
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_double@
+hs_bindgen_de353a737de53428 :: A -> IO CDouble
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_double@
+hs_bindgen_de353a737de53428 = \x_0 -> fmap fromFFIType (hs_bindgen_de353a737de53428_base (toFFIType x_0))
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_unsafe :: A -> IO CDouble
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_unsafe = hs_bindgen_de353a737de53428
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_91e2ab77e68f0288" hs_bindgen_91e2ab77e68f0288_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_bool1@
+hs_bindgen_91e2ab77e68f0288 :: A -> IO CBool
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_bool1@
+hs_bindgen_91e2ab77e68f0288 = \x_0 -> fmap fromFFIType (hs_bindgen_91e2ab77e68f0288_base (toFFIType x_0))
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_unsafe :: A -> IO CBool
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_unsafe = hs_bindgen_91e2ab77e68f0288
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_struct@
+foreign import ccall unsafe "hs_bindgen_9f29c7eee02f6d53" hs_bindgen_9f29c7eee02f6d53_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_struct@
+hs_bindgen_9f29c7eee02f6d53 :: A -> Ptr Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_struct@
+hs_bindgen_9f29c7eee02f6d53 = \x_0 -> \x_1 -> hs_bindgen_9f29c7eee02f6d53_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_unsafe :: A -> IO Some_struct
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_9f29c7eee02f6d53 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_union@
+foreign import ccall unsafe "hs_bindgen_6844bf5f5a5f6681" hs_bindgen_6844bf5f5a5f6681_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_union@
+hs_bindgen_6844bf5f5a5f6681 :: A -> Ptr Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_union@
+hs_bindgen_6844bf5f5a5f6681 = \x_0 -> \x_1 -> hs_bindgen_6844bf5f5a5f6681_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_unsafe :: A -> IO Some_union
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_6844bf5f5a5f6681 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_enum@
+foreign import ccall unsafe "hs_bindgen_f96c4bc30b6b17e8" hs_bindgen_f96c4bc30b6b17e8_base ::
+    CInt
+ -> IO CUInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_enum@
+hs_bindgen_f96c4bc30b6b17e8 :: A -> IO Some_enum
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_enum@
+hs_bindgen_f96c4bc30b6b17e8 = \x_0 -> fmap fromFFIType (hs_bindgen_f96c4bc30b6b17e8_base (toFFIType x_0))
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_unsafe :: A -> IO Some_enum
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_unsafe = hs_bindgen_f96c4bc30b6b17e8
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_bfb6069e1423e7a5" hs_bindgen_bfb6069e1423e7a5_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer1@
+hs_bindgen_bfb6069e1423e7a5 :: A -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer1@
+hs_bindgen_bfb6069e1423e7a5 = \x_0 -> fmap fromFFIType (hs_bindgen_bfb6069e1423e7a5_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_unsafe :: A -> IO (Ptr CInt)
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_unsafe = hs_bindgen_bfb6069e1423e7a5
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_ffae633548386d89" hs_bindgen_ffae633548386d89_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer2@
+hs_bindgen_ffae633548386d89 :: A -> IO (Ptr (Ptr CInt))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer2@
+hs_bindgen_ffae633548386d89 = \x_0 -> fmap fromFFIType (hs_bindgen_ffae633548386d89_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_unsafe :: A -> IO (Ptr (Ptr CInt))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_unsafe = hs_bindgen_ffae633548386d89
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_550cb4a23c6ab2ff" hs_bindgen_550cb4a23c6ab2ff_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer3@
+hs_bindgen_550cb4a23c6ab2ff :: A -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_pointer3@
+hs_bindgen_550cb4a23c6ab2ff = \x_0 -> fmap fromFFIType (hs_bindgen_550cb4a23c6ab2ff_base (toFFIType x_0))
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_unsafe :: A -> IO (Ptr Void)
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_unsafe = hs_bindgen_550cb4a23c6ab2ff
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body1@
+foreign import ccall unsafe "hs_bindgen_f7a7a45a80ae39f7" hs_bindgen_f7a7a45a80ae39f7_base ::
+    CInt
+ -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body1@
+hs_bindgen_f7a7a45a80ae39f7 :: A -> IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body1@
+hs_bindgen_f7a7a45a80ae39f7 = \x_0 -> fmap fromFFIType (hs_bindgen_f7a7a45a80ae39f7_base (toFFIType x_0))
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_unsafe :: A -> IO CInt
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_unsafe = hs_bindgen_f7a7a45a80ae39f7
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body2@
+foreign import ccall unsafe "hs_bindgen_364e73b014d7d4df" hs_bindgen_364e73b014d7d4df_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body2@
+hs_bindgen_364e73b014d7d4df :: IO A
+-- __unique:__ @test_macrosreparse_Example_Unsafe_body2@
+hs_bindgen_364e73b014d7d4df = fmap fromFFIType hs_bindgen_364e73b014d7d4df_base
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_unsafe :: IO A
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_unsafe = hs_bindgen_364e73b014d7d4df
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_88b4cd11afc4f6c1" hs_bindgen_88b4cd11afc4f6c1_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_float@
+hs_bindgen_88b4cd11afc4f6c1 :: A -> Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_float@
+hs_bindgen_88b4cd11afc4f6c1 = \x_0 -> \x_1 -> hs_bindgen_88b4cd11afc4f6c1_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_unsafe :: A -> Complex CFloat -> IO ()
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_88b4cd11afc4f6c1 arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_0ddc53d8e91cb32a" hs_bindgen_0ddc53d8e91cb32a_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_double@
+hs_bindgen_0ddc53d8e91cb32a :: A -> Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_args_complex_double@
+hs_bindgen_0ddc53d8e91cb32a = \x_0 -> \x_1 -> hs_bindgen_0ddc53d8e91cb32a_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_unsafe :: A -> Complex CDouble -> IO ()
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_0ddc53d8e91cb32a arg1_0 arg2_2)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_eb82eb840e288900" hs_bindgen_eb82eb840e288900_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_float@
+hs_bindgen_eb82eb840e288900 :: A -> Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_float@
+hs_bindgen_eb82eb840e288900 = \x_0 -> \x_1 -> hs_bindgen_eb82eb840e288900_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_unsafe :: A -> IO (Complex CFloat)
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_eb82eb840e288900 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_cbc25ea9cbdd2365" hs_bindgen_cbc25ea9cbdd2365_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_double@
+hs_bindgen_cbc25ea9cbdd2365 :: A -> Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_ret_complex_double@
+hs_bindgen_cbc25ea9cbdd2365 = \x_0 -> \x_1 -> hs_bindgen_cbc25ea9cbdd2365_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_unsafe :: A -> IO (Complex CDouble)
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_unsafe = \arg1_0 -> allocaAndPeek (\res_1 -> hs_bindgen_cbc25ea9cbdd2365 arg1_0 res_1)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_3258de4ffd2c08af" hs_bindgen_3258de4ffd2c08af_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args1@
+hs_bindgen_3258de4ffd2c08af :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args1@
+hs_bindgen_3258de4ffd2c08af = \x_0 -> \x_1 -> hs_bindgen_3258de4ffd2c08af_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_unsafe :: A -> CBool -> IO ()
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_unsafe = hs_bindgen_3258de4ffd2c08af
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_74b2cd1defdd5609" hs_bindgen_74b2cd1defdd5609_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args2@
+hs_bindgen_74b2cd1defdd5609 :: A ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_args2@
+hs_bindgen_74b2cd1defdd5609 = \x_0 -> \x_1 -> hs_bindgen_74b2cd1defdd5609_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_unsafe :: A -> HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_unsafe = hs_bindgen_74b2cd1defdd5609
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_5405c1e037d1e115" hs_bindgen_5405c1e037d1e115_base ::
+    CInt
+ -> IO CBool
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret1@
+hs_bindgen_5405c1e037d1e115 :: A -> IO CBool
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret1@
+hs_bindgen_5405c1e037d1e115 = \x_0 -> fmap fromFFIType (hs_bindgen_5405c1e037d1e115_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_unsafe :: A -> IO CBool
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_unsafe = hs_bindgen_5405c1e037d1e115
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_a6a3e5a828532360" hs_bindgen_a6a3e5a828532360_base ::
+    CInt
+ -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret2@
+hs_bindgen_a6a3e5a828532360 :: A -> IO HsBindgen.Runtime.LibC.CSize
+-- __unique:__ @test_macrosreparse_Example_Unsafe_bespoke_ret2@
+hs_bindgen_a6a3e5a828532360 = \x_0 -> fmap fromFFIType (hs_bindgen_a6a3e5a828532360_base (toFFIType x_0))
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_unsafe :: A -> IO HsBindgen.Runtime.LibC.CSize
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_unsafe = hs_bindgen_a6a3e5a828532360
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args1@
+foreign import ccall unsafe "hs_bindgen_4956a52bf5073b9f" hs_bindgen_4956a52bf5073b9f_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args1@
+hs_bindgen_4956a52bf5073b9f :: Ptr (Elem (IncompleteArray A)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args1@
+hs_bindgen_4956a52bf5073b9f = \x_0 -> hs_bindgen_4956a52bf5073b9f_base (toFFIType x_0)
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_unsafe :: Ptr (Elem (IncompleteArray A)) -> IO ()
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_unsafe = hs_bindgen_4956a52bf5073b9f
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args2@
+foreign import ccall unsafe "hs_bindgen_0fc8b091085a88e9" hs_bindgen_0fc8b091085a88e9_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args2@
+hs_bindgen_0fc8b091085a88e9 :: Ptr (Elem (IncompleteArray (Ptr A))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args2@
+hs_bindgen_0fc8b091085a88e9 = \x_0 -> hs_bindgen_0fc8b091085a88e9_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_unsafe :: Ptr (Elem (IncompleteArray (Ptr A))) -> IO ()
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_unsafe = hs_bindgen_0fc8b091085a88e9
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args3@
+foreign import ccall unsafe "hs_bindgen_ca6f1bc1a29b85f8" hs_bindgen_ca6f1bc1a29b85f8_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args3@
+hs_bindgen_ca6f1bc1a29b85f8 :: Ptr (Elem (ConstantArray 5 A)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args3@
+hs_bindgen_ca6f1bc1a29b85f8 = \x_0 -> hs_bindgen_ca6f1bc1a29b85f8_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_unsafe :: Ptr (Elem (ConstantArray 5 A)) -> IO ()
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_unsafe = hs_bindgen_ca6f1bc1a29b85f8
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args4@
+foreign import ccall unsafe "hs_bindgen_a168ae0de206febe" hs_bindgen_a168ae0de206febe_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args4@
+hs_bindgen_a168ae0de206febe :: Ptr (Elem (ConstantArray 5
+                                                        (Ptr A))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_arr_args4@
+hs_bindgen_a168ae0de206febe = \x_0 -> hs_bindgen_a168ae0de206febe_base (toFFIType x_0)
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_unsafe :: Ptr (Elem (ConstantArray 5 (Ptr A))) -> IO ()
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_unsafe = hs_bindgen_a168ae0de206febe
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_8e63f57f1f5d662e" hs_bindgen_8e63f57f1f5d662e_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args1@
+hs_bindgen_8e63f57f1f5d662e :: A -> FunPtr (IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args1@
+hs_bindgen_8e63f57f1f5d662e = \x_0 -> \x_1 -> hs_bindgen_8e63f57f1f5d662e_base (toFFIType x_0) (toFFIType x_1)
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_unsafe :: A -> FunPtr (IO ()) -> IO ()
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_unsafe = hs_bindgen_8e63f57f1f5d662e
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_927bd07f48d05d21" hs_bindgen_927bd07f48d05d21_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args2@
+hs_bindgen_927bd07f48d05d21 :: A -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args2@
+hs_bindgen_927bd07f48d05d21 = \x_0 -> \x_1 -> hs_bindgen_927bd07f48d05d21_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_unsafe :: A -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_unsafe = hs_bindgen_927bd07f48d05d21
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_c82e078d3c54a6bc" hs_bindgen_c82e078d3c54a6bc_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args3@
+hs_bindgen_c82e078d3c54a6bc :: A -> FunPtr (CInt -> IO ()) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args3@
+hs_bindgen_c82e078d3c54a6bc = \x_0 -> \x_1 -> hs_bindgen_c82e078d3c54a6bc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_unsafe :: A -> FunPtr (CInt -> IO ()) -> IO ()
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_unsafe = hs_bindgen_c82e078d3c54a6bc
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_211ad1ac5399caec" hs_bindgen_211ad1ac5399caec_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args4@
+hs_bindgen_211ad1ac5399caec :: A ->
+                               FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args4@
+hs_bindgen_211ad1ac5399caec = \x_0 -> \x_1 -> hs_bindgen_211ad1ac5399caec_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_unsafe :: A ->
+                       FunPtr (CInt -> CDouble -> IO CChar) -> IO ()
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_unsafe = hs_bindgen_211ad1ac5399caec
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_9057c59d70e815d7" hs_bindgen_9057c59d70e815d7_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args5@
+hs_bindgen_9057c59d70e815d7 :: A ->
+                               FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_args5@
+hs_bindgen_9057c59d70e815d7 = \x_0 -> \x_1 -> hs_bindgen_9057c59d70e815d7_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_unsafe :: A ->
+                       FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_unsafe = hs_bindgen_9057c59d70e815d7
+-- __unique:__ @test_macrosreparse_Example_Unsafe_comments1@
+foreign import ccall unsafe "hs_bindgen_153515e0ff74574f" hs_bindgen_153515e0ff74574f_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_comments1@
+hs_bindgen_153515e0ff74574f :: A -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_comments1@
+hs_bindgen_153515e0ff74574f = \x_0 -> hs_bindgen_153515e0ff74574f_base (toFFIType x_0)
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_unsafe :: A -> IO ()
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_unsafe = hs_bindgen_153515e0ff74574f
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_8cc833db463cc95c" hs_bindgen_8cc833db463cc95c_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before1@
+hs_bindgen_8cc833db463cc95c :: A -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before1@
+hs_bindgen_8cc833db463cc95c = \x_0 -> \x_1 -> hs_bindgen_8cc833db463cc95c_base (toFFIType x_0) (toFFIType x_1)
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_unsafe :: A -> CChar -> IO ()
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_unsafe = hs_bindgen_8cc833db463cc95c
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_d767bbef00031d57" hs_bindgen_d767bbef00031d57_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before2@
+hs_bindgen_d767bbef00031d57 :: A -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before2@
+hs_bindgen_d767bbef00031d57 = \x_0 -> \x_1 -> hs_bindgen_d767bbef00031d57_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_unsafe :: A -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_unsafe = hs_bindgen_d767bbef00031d57
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_a36dfeb811993297" hs_bindgen_a36dfeb811993297_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before3@
+hs_bindgen_a36dfeb811993297 :: A -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_before3@
+hs_bindgen_a36dfeb811993297 = \x_0 -> \x_1 -> hs_bindgen_a36dfeb811993297_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_unsafe :: A -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_unsafe = hs_bindgen_a36dfeb811993297
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_d7fa2440be24e954" hs_bindgen_d7fa2440be24e954_base ::
+    CInt
+ -> CChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after1@
+hs_bindgen_d7fa2440be24e954 :: A -> CChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after1@
+hs_bindgen_d7fa2440be24e954 = \x_0 -> \x_1 -> hs_bindgen_d7fa2440be24e954_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_unsafe :: A -> CChar -> IO ()
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_unsafe = hs_bindgen_d7fa2440be24e954
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_c169229f24baf752" hs_bindgen_c169229f24baf752_base ::
+    CInt
+ -> CSChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after2@
+hs_bindgen_c169229f24baf752 :: A -> CSChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after2@
+hs_bindgen_c169229f24baf752 = \x_0 -> \x_1 -> hs_bindgen_c169229f24baf752_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_unsafe :: A -> CSChar -> IO ()
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_unsafe = hs_bindgen_c169229f24baf752
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_c0780f7624ed1d3e" hs_bindgen_c0780f7624ed1d3e_base ::
+    CInt
+ -> CUChar
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after3@
+hs_bindgen_c0780f7624ed1d3e :: A -> CUChar -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_prim_after3@
+hs_bindgen_c0780f7624ed1d3e = \x_0 -> \x_1 -> hs_bindgen_c0780f7624ed1d3e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_unsafe :: A -> CUChar -> IO ()
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_unsafe = hs_bindgen_c0780f7624ed1d3e
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_fda903bc1139b1d6" hs_bindgen_fda903bc1139b1d6_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before1@
+hs_bindgen_fda903bc1139b1d6 :: A -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before1@
+hs_bindgen_fda903bc1139b1d6 = \x_0 -> \x_1 -> hs_bindgen_fda903bc1139b1d6_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_unsafe :: A -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_unsafe = hs_bindgen_fda903bc1139b1d6
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_a5a70f3be654ea00" hs_bindgen_a5a70f3be654ea00_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before2@
+hs_bindgen_a5a70f3be654ea00 :: A -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before2@
+hs_bindgen_a5a70f3be654ea00 = \x_0 -> \x_1 -> hs_bindgen_a5a70f3be654ea00_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_unsafe :: A -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_unsafe = hs_bindgen_a5a70f3be654ea00
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_b813910f6a632ce2" hs_bindgen_b813910f6a632ce2_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before3@
+hs_bindgen_b813910f6a632ce2 :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before3@
+hs_bindgen_b813910f6a632ce2 = \x_0 -> \x_1 -> hs_bindgen_b813910f6a632ce2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_unsafe :: A -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_unsafe = hs_bindgen_b813910f6a632ce2
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_dc22b02b2f53aa5b" hs_bindgen_dc22b02b2f53aa5b_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before4@
+hs_bindgen_dc22b02b2f53aa5b :: A -> PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before4@
+hs_bindgen_dc22b02b2f53aa5b = \x_0 -> \x_1 -> hs_bindgen_dc22b02b2f53aa5b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_unsafe :: A -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_dc22b02b2f53aa5b arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_503736261279760d" hs_bindgen_503736261279760d_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before5@
+hs_bindgen_503736261279760d :: A -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before5@
+hs_bindgen_503736261279760d = \x_0 -> \x_1 -> hs_bindgen_503736261279760d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_unsafe :: A -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_503736261279760d arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_ed0a8c0e15f5d2ce" hs_bindgen_ed0a8c0e15f5d2ce_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before6@
+hs_bindgen_ed0a8c0e15f5d2ce :: A -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before6@
+hs_bindgen_ed0a8c0e15f5d2ce = \x_0 -> \x_1 -> hs_bindgen_ed0a8c0e15f5d2ce_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_unsafe :: A -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_unsafe = hs_bindgen_ed0a8c0e15f5d2ce
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_4659c22d39cc1bb3" hs_bindgen_4659c22d39cc1bb3_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before7@
+hs_bindgen_4659c22d39cc1bb3 :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before7@
+hs_bindgen_4659c22d39cc1bb3 = \x_0 -> \x_1 -> hs_bindgen_4659c22d39cc1bb3_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_unsafe :: A -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_unsafe = hs_bindgen_4659c22d39cc1bb3
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_530245b77093b08c" hs_bindgen_530245b77093b08c_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before8@
+hs_bindgen_530245b77093b08c :: A ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_before8@
+hs_bindgen_530245b77093b08c = \x_0 -> \x_1 -> hs_bindgen_530245b77093b08c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_unsafe :: A ->
+                                    HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_unsafe = hs_bindgen_530245b77093b08c
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_c31a804bd742193e" hs_bindgen_c31a804bd742193e_base ::
+    CInt
+ -> CFloat
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after1@
+hs_bindgen_c31a804bd742193e :: A -> CFloat -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after1@
+hs_bindgen_c31a804bd742193e = \x_0 -> \x_1 -> hs_bindgen_c31a804bd742193e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_unsafe :: A -> CFloat -> IO ()
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_unsafe = hs_bindgen_c31a804bd742193e
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_53756fa3a68ab067" hs_bindgen_53756fa3a68ab067_base ::
+    CInt
+ -> CDouble
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after2@
+hs_bindgen_53756fa3a68ab067 :: A -> CDouble -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after2@
+hs_bindgen_53756fa3a68ab067 = \x_0 -> \x_1 -> hs_bindgen_53756fa3a68ab067_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_unsafe :: A -> CDouble -> IO ()
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_unsafe = hs_bindgen_53756fa3a68ab067
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_4134ad71149d6139" hs_bindgen_4134ad71149d6139_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after3@
+hs_bindgen_4134ad71149d6139 :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after3@
+hs_bindgen_4134ad71149d6139 = \x_0 -> \x_1 -> hs_bindgen_4134ad71149d6139_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_unsafe :: A -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_unsafe = hs_bindgen_4134ad71149d6139
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_3de6157427334101" hs_bindgen_3de6157427334101_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after4@
+hs_bindgen_3de6157427334101 :: A -> PtrConst Some_struct -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after4@
+hs_bindgen_3de6157427334101 = \x_0 -> \x_1 -> hs_bindgen_3de6157427334101_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_unsafe :: A -> Some_struct -> IO ()
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_3de6157427334101 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_fc4ef8c9107c1ae6" hs_bindgen_fc4ef8c9107c1ae6_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after5@
+hs_bindgen_fc4ef8c9107c1ae6 :: A -> PtrConst Some_union -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after5@
+hs_bindgen_fc4ef8c9107c1ae6 = \x_0 -> \x_1 -> hs_bindgen_fc4ef8c9107c1ae6_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_unsafe :: A -> Some_union -> IO ()
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_unsafe = \arg1_0 -> \arg2_1 -> with arg2_1 (\arg2_2 -> hs_bindgen_fc4ef8c9107c1ae6 arg1_0 (unsafeFromPtr arg2_2))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_5e20c60b725ae606" hs_bindgen_5e20c60b725ae606_base ::
+    CInt
+ -> CUInt
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after6@
+hs_bindgen_5e20c60b725ae606 :: A -> Some_enum -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after6@
+hs_bindgen_5e20c60b725ae606 = \x_0 -> \x_1 -> hs_bindgen_5e20c60b725ae606_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_unsafe :: A -> Some_enum -> IO ()
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_unsafe = hs_bindgen_5e20c60b725ae606
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_a0f20d4b9a07ff5b" hs_bindgen_a0f20d4b9a07ff5b_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after7@
+hs_bindgen_a0f20d4b9a07ff5b :: A -> CBool -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after7@
+hs_bindgen_a0f20d4b9a07ff5b = \x_0 -> \x_1 -> hs_bindgen_a0f20d4b9a07ff5b_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_unsafe :: A -> CBool -> IO ()
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_unsafe = hs_bindgen_a0f20d4b9a07ff5b
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_3a020035eb2fe7f8" hs_bindgen_3a020035eb2fe7f8_base ::
+    CInt
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after8@
+hs_bindgen_3a020035eb2fe7f8 :: A ->
+                               HsBindgen.Runtime.LibC.CSize -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_withoutSign_after8@
+hs_bindgen_3a020035eb2fe7f8 = \x_0 -> \x_1 -> hs_bindgen_3a020035eb2fe7f8_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_unsafe :: A ->
+                                   HsBindgen.Runtime.LibC.CSize -> IO ()
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_unsafe = hs_bindgen_3a020035eb2fe7f8
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_17623ba5065bf95d" hs_bindgen_17623ba5065bf95d_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args1@
+hs_bindgen_17623ba5065bf95d :: A -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args1@
+hs_bindgen_17623ba5065bf95d = \x_0 -> \x_1 -> hs_bindgen_17623ba5065bf95d_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_unsafe :: A -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_unsafe = hs_bindgen_17623ba5065bf95d
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_02d08ccd5df88a98" hs_bindgen_02d08ccd5df88a98_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args2@
+hs_bindgen_02d08ccd5df88a98 :: A -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args2@
+hs_bindgen_02d08ccd5df88a98 = \x_0 -> \x_1 -> hs_bindgen_02d08ccd5df88a98_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_unsafe :: A -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_unsafe = hs_bindgen_02d08ccd5df88a98
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_50c423f2237cb6b5" hs_bindgen_50c423f2237cb6b5_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args3@
+hs_bindgen_50c423f2237cb6b5 :: A -> Ptr CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args3@
+hs_bindgen_50c423f2237cb6b5 = \x_0 -> \x_1 -> hs_bindgen_50c423f2237cb6b5_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_unsafe :: A -> Ptr CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_unsafe = hs_bindgen_50c423f2237cb6b5
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_99c29c45d78348e9" hs_bindgen_99c29c45d78348e9_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args4@
+hs_bindgen_99c29c45d78348e9 :: A -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args4@
+hs_bindgen_99c29c45d78348e9 = \x_0 -> \x_1 -> hs_bindgen_99c29c45d78348e9_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_unsafe :: A -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_unsafe = hs_bindgen_99c29c45d78348e9
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_6a92dbfae24b1bcd" hs_bindgen_6a92dbfae24b1bcd_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args5@
+hs_bindgen_6a92dbfae24b1bcd :: A -> PtrConst CInt -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_args5@
+hs_bindgen_6a92dbfae24b1bcd = \x_0 -> \x_1 -> hs_bindgen_6a92dbfae24b1bcd_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_unsafe :: A -> PtrConst CInt -> IO ()
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_unsafe = hs_bindgen_6a92dbfae24b1bcd
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_0c07f1e0256fd705" hs_bindgen_0c07f1e0256fd705_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret1@
+hs_bindgen_0c07f1e0256fd705 :: A -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret1@
+hs_bindgen_0c07f1e0256fd705 = \x_0 -> fmap fromFFIType (hs_bindgen_0c07f1e0256fd705_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_unsafe :: A -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_unsafe = hs_bindgen_0c07f1e0256fd705
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_d12c8210ff3c3711" hs_bindgen_d12c8210ff3c3711_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret2@
+hs_bindgen_d12c8210ff3c3711 :: A -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret2@
+hs_bindgen_d12c8210ff3c3711 = \x_0 -> fmap fromFFIType (hs_bindgen_d12c8210ff3c3711_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_unsafe :: A -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_unsafe = hs_bindgen_d12c8210ff3c3711
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_a58bc0be6f564801" hs_bindgen_a58bc0be6f564801_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret3@
+hs_bindgen_a58bc0be6f564801 :: A -> IO (Ptr CInt)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret3@
+hs_bindgen_a58bc0be6f564801 = \x_0 -> fmap fromFFIType (hs_bindgen_a58bc0be6f564801_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_unsafe :: A -> IO (Ptr CInt)
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_unsafe = hs_bindgen_a58bc0be6f564801
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_622bb8150470138b" hs_bindgen_622bb8150470138b_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret4@
+hs_bindgen_622bb8150470138b :: A -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret4@
+hs_bindgen_622bb8150470138b = \x_0 -> fmap fromFFIType (hs_bindgen_622bb8150470138b_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_unsafe :: A -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_unsafe = hs_bindgen_622bb8150470138b
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_d49bd331ad2077e5" hs_bindgen_d49bd331ad2077e5_base ::
+    CInt
+ -> IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret5@
+hs_bindgen_d49bd331ad2077e5 :: A -> IO (PtrConst CInt)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_pointers_ret5@
+hs_bindgen_d49bd331ad2077e5 = \x_0 -> fmap fromFFIType (hs_bindgen_d49bd331ad2077e5_base (toFFIType x_0))
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_unsafe :: A -> IO (PtrConst CInt)
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_unsafe = hs_bindgen_d49bd331ad2077e5
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_224608f780bff5bd" hs_bindgen_224608f780bff5bd_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem1@
+hs_bindgen_224608f780bff5bd :: PtrConst (Elem (IncompleteArray A)) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem1@
+hs_bindgen_224608f780bff5bd = \x_0 -> hs_bindgen_224608f780bff5bd_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_unsafe :: PtrConst (Elem (IncompleteArray A)) ->
+                            IO ()
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_unsafe = hs_bindgen_224608f780bff5bd
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_9aa74ad89f2c1fba" hs_bindgen_9aa74ad89f2c1fba_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem2@
+hs_bindgen_9aa74ad89f2c1fba :: Ptr (Elem (IncompleteArray (PtrConst A))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem2@
+hs_bindgen_9aa74ad89f2c1fba = \x_0 -> hs_bindgen_9aa74ad89f2c1fba_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_unsafe :: Ptr (Elem (IncompleteArray (PtrConst A))) ->
+                            IO ()
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_unsafe = hs_bindgen_9aa74ad89f2c1fba
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_6a328300c5ef0c9e" hs_bindgen_6a328300c5ef0c9e_base ::
+    Ptr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem3@
+hs_bindgen_6a328300c5ef0c9e :: PtrConst (Elem (IncompleteArray (Ptr A))) ->
+                               IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_const_array_elem3@
+hs_bindgen_6a328300c5ef0c9e = \x_0 -> hs_bindgen_6a328300c5ef0c9e_base (toFFIType x_0)
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_unsafe :: PtrConst (Elem (IncompleteArray (Ptr A))) ->
+                            IO ()
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_unsafe = hs_bindgen_6a328300c5ef0c9e
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams1@
+foreign import ccall unsafe "hs_bindgen_13a7d78e11555d58" hs_bindgen_13a7d78e11555d58_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams1@
+hs_bindgen_13a7d78e11555d58 :: IO A
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams1@
+hs_bindgen_13a7d78e11555d58 = fmap fromFFIType hs_bindgen_13a7d78e11555d58_base
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_unsafe :: IO A
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_unsafe = hs_bindgen_13a7d78e11555d58
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams2@
+foreign import ccall unsafe "hs_bindgen_672f4691ee7a367c" hs_bindgen_672f4691ee7a367c_base ::
+    IO CInt
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams2@
+hs_bindgen_672f4691ee7a367c :: IO A
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams2@
+hs_bindgen_672f4691ee7a367c = fmap fromFFIType hs_bindgen_672f4691ee7a367c_base
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_unsafe :: IO A
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_unsafe = hs_bindgen_672f4691ee7a367c
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams3@
+foreign import ccall unsafe "hs_bindgen_591f84e2163a5d18" hs_bindgen_591f84e2163a5d18_base ::
+    CInt
+ -> FunPtr Void
+ -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams3@
+hs_bindgen_591f84e2163a5d18 :: A -> FunPtr (IO CInt) -> IO ()
+-- __unique:__ @test_macrosreparse_Example_Unsafe_noParams3@
+hs_bindgen_591f84e2163a5d18 = \x_0 -> \x_1 -> hs_bindgen_591f84e2163a5d18_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_unsafe :: A -> FunPtr (IO CInt) -> IO ()
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_unsafe = hs_bindgen_591f84e2163a5d18
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_8cdf7774adb0f0b4" hs_bindgen_8cdf7774adb0f0b4_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret1@
+hs_bindgen_8cdf7774adb0f0b4 :: A -> IO (FunPtr (IO ()))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret1@
+hs_bindgen_8cdf7774adb0f0b4 = \x_0 -> fmap fromFFIType (hs_bindgen_8cdf7774adb0f0b4_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_unsafe :: A -> IO (FunPtr (IO ()))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_unsafe = hs_bindgen_8cdf7774adb0f0b4
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_a4e08267a9070ede" hs_bindgen_a4e08267a9070ede_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret2@
+hs_bindgen_a4e08267a9070ede :: A -> IO (FunPtr (IO CInt))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret2@
+hs_bindgen_a4e08267a9070ede = \x_0 -> fmap fromFFIType (hs_bindgen_a4e08267a9070ede_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_unsafe :: A -> IO (FunPtr (IO CInt))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_unsafe = hs_bindgen_a4e08267a9070ede
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_65fa30510d244cbf" hs_bindgen_65fa30510d244cbf_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret3@
+hs_bindgen_65fa30510d244cbf :: A -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret3@
+hs_bindgen_65fa30510d244cbf = \x_0 -> fmap fromFFIType (hs_bindgen_65fa30510d244cbf_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_unsafe :: A -> IO (FunPtr (CInt -> IO ()))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_unsafe = hs_bindgen_65fa30510d244cbf
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_da12eaec295883aa" hs_bindgen_da12eaec295883aa_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret4@
+hs_bindgen_da12eaec295883aa :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO CChar))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret4@
+hs_bindgen_da12eaec295883aa = \x_0 -> fmap fromFFIType (hs_bindgen_da12eaec295883aa_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_unsafe :: A ->
+                      IO (FunPtr (CInt -> CDouble -> IO CChar))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_unsafe = hs_bindgen_da12eaec295883aa
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_281c53214b1cdcb4" hs_bindgen_281c53214b1cdcb4_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret5@
+hs_bindgen_281c53214b1cdcb4 :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret5@
+hs_bindgen_281c53214b1cdcb4 = \x_0 -> fmap fromFFIType (hs_bindgen_281c53214b1cdcb4_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_unsafe :: A ->
+                      IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_unsafe = hs_bindgen_281c53214b1cdcb4
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_16628c257aa64a76" hs_bindgen_16628c257aa64a76_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret6@
+hs_bindgen_16628c257aa64a76 :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret6@
+hs_bindgen_16628c257aa64a76 = \x_0 -> fmap fromFFIType (hs_bindgen_16628c257aa64a76_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_unsafe :: A ->
+                      IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_unsafe = hs_bindgen_16628c257aa64a76
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_79fb0c30f546a547" hs_bindgen_79fb0c30f546a547_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret7@
+hs_bindgen_79fb0c30f546a547 :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret7@
+hs_bindgen_79fb0c30f546a547 = \x_0 -> fmap fromFFIType (hs_bindgen_79fb0c30f546a547_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_unsafe :: A ->
+                      IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_unsafe = hs_bindgen_79fb0c30f546a547
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_4668d2ff9d5bfc40" hs_bindgen_4668d2ff9d5bfc40_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret8@
+hs_bindgen_4668d2ff9d5bfc40 :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret8@
+hs_bindgen_4668d2ff9d5bfc40 = \x_0 -> fmap fromFFIType (hs_bindgen_4668d2ff9d5bfc40_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_unsafe :: A ->
+                      IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_unsafe = hs_bindgen_4668d2ff9d5bfc40
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_c044d7074789febc" hs_bindgen_c044d7074789febc_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret9@
+hs_bindgen_c044d7074789febc :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret9@
+hs_bindgen_c044d7074789febc = \x_0 -> fmap fromFFIType (hs_bindgen_c044d7074789febc_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_unsafe :: A ->
+                      IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_unsafe = hs_bindgen_c044d7074789febc
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_628ced6eccc7783a" hs_bindgen_628ced6eccc7783a_base ::
+    CInt
+ -> IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret10@
+hs_bindgen_628ced6eccc7783a :: A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_Unsafe_funptr_ret10@
+hs_bindgen_628ced6eccc7783a = \x_0 -> fmap fromFFIType (hs_bindgen_628ced6eccc7783a_base (toFFIType x_0))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_unsafe :: A ->
+                       IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_unsafe = hs_bindgen_628ced6eccc7783a
+-- __unique:__ @test_macrosreparse_Example_get_args_char1@
+foreign import ccall unsafe "hs_bindgen_ba0c80bfdbc677bd" hs_bindgen_ba0c80bfdbc677bd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_char1@
+hs_bindgen_ba0c80bfdbc677bd :: IO (FunPtr (A -> CChar -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_char1@
+hs_bindgen_ba0c80bfdbc677bd = fmap fromFFIType hs_bindgen_ba0c80bfdbc677bd_base
+{-# NOINLINE args_char1_funptr #-}
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_funptr :: FunPtr (A -> CChar -> IO ())
+{-| Function declarations
+
+    __C declaration:__ @args_char1@
+
+    __defined at:__ @macros\/reparse.h 17:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char1_funptr = unsafePerformIO hs_bindgen_ba0c80bfdbc677bd
+-- __unique:__ @test_macrosreparse_Example_get_args_char2@
+foreign import ccall unsafe "hs_bindgen_b1e8a2d5e3935f61" hs_bindgen_b1e8a2d5e3935f61_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_char2@
+hs_bindgen_b1e8a2d5e3935f61 :: IO (FunPtr (A -> CSChar -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_char2@
+hs_bindgen_b1e8a2d5e3935f61 = fmap fromFFIType hs_bindgen_b1e8a2d5e3935f61_base
+{-# NOINLINE args_char2_funptr #-}
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_funptr :: FunPtr (A -> CSChar -> IO ())
+{-| __C declaration:__ @args_char2@
+
+    __defined at:__ @macros\/reparse.h 18:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char2_funptr = unsafePerformIO hs_bindgen_b1e8a2d5e3935f61
+-- __unique:__ @test_macrosreparse_Example_get_args_char3@
+foreign import ccall unsafe "hs_bindgen_deb136b9b9d89650" hs_bindgen_deb136b9b9d89650_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_char3@
+hs_bindgen_deb136b9b9d89650 :: IO (FunPtr (A -> CUChar -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_char3@
+hs_bindgen_deb136b9b9d89650 = fmap fromFFIType hs_bindgen_deb136b9b9d89650_base
+{-# NOINLINE args_char3_funptr #-}
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_funptr :: FunPtr (A -> CUChar -> IO ())
+{-| __C declaration:__ @args_char3@
+
+    __defined at:__ @macros\/reparse.h 19:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_char3_funptr = unsafePerformIO hs_bindgen_deb136b9b9d89650
+-- __unique:__ @test_macrosreparse_Example_get_args_short1@
+foreign import ccall unsafe "hs_bindgen_7a71d1e1867636bf" hs_bindgen_7a71d1e1867636bf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_short1@
+hs_bindgen_7a71d1e1867636bf :: IO (FunPtr (A -> CShort -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_short1@
+hs_bindgen_7a71d1e1867636bf = fmap fromFFIType hs_bindgen_7a71d1e1867636bf_base
+{-# NOINLINE args_short1_funptr #-}
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_funptr :: FunPtr (A -> CShort -> IO ())
+{-| __C declaration:__ @args_short1@
+
+    __defined at:__ @macros\/reparse.h 21:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short1_funptr = unsafePerformIO hs_bindgen_7a71d1e1867636bf
+-- __unique:__ @test_macrosreparse_Example_get_args_short2@
+foreign import ccall unsafe "hs_bindgen_ad7132b76947c638" hs_bindgen_ad7132b76947c638_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_short2@
+hs_bindgen_ad7132b76947c638 :: IO (FunPtr (A -> CShort -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_short2@
+hs_bindgen_ad7132b76947c638 = fmap fromFFIType hs_bindgen_ad7132b76947c638_base
+{-# NOINLINE args_short2_funptr #-}
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_funptr :: FunPtr (A -> CShort -> IO ())
+{-| __C declaration:__ @args_short2@
+
+    __defined at:__ @macros\/reparse.h 22:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short2_funptr = unsafePerformIO hs_bindgen_ad7132b76947c638
+-- __unique:__ @test_macrosreparse_Example_get_args_short3@
+foreign import ccall unsafe "hs_bindgen_f4842ac12be0c136" hs_bindgen_f4842ac12be0c136_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_short3@
+hs_bindgen_f4842ac12be0c136 :: IO (FunPtr (A -> CUShort -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_short3@
+hs_bindgen_f4842ac12be0c136 = fmap fromFFIType hs_bindgen_f4842ac12be0c136_base
+{-# NOINLINE args_short3_funptr #-}
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_funptr :: FunPtr (A -> CUShort -> IO ())
+{-| __C declaration:__ @args_short3@
+
+    __defined at:__ @macros\/reparse.h 23:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_short3_funptr = unsafePerformIO hs_bindgen_f4842ac12be0c136
+-- __unique:__ @test_macrosreparse_Example_get_args_int1@
+foreign import ccall unsafe "hs_bindgen_3dc6ae7bb850c676" hs_bindgen_3dc6ae7bb850c676_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_int1@
+hs_bindgen_3dc6ae7bb850c676 :: IO (FunPtr (A -> CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_int1@
+hs_bindgen_3dc6ae7bb850c676 = fmap fromFFIType hs_bindgen_3dc6ae7bb850c676_base
+{-# NOINLINE args_int1_funptr #-}
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_funptr :: FunPtr (A -> CInt -> IO ())
+{-| __C declaration:__ @args_int1@
+
+    __defined at:__ @macros\/reparse.h 25:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int1_funptr = unsafePerformIO hs_bindgen_3dc6ae7bb850c676
+-- __unique:__ @test_macrosreparse_Example_get_args_int2@
+foreign import ccall unsafe "hs_bindgen_a76cb45502a6ea40" hs_bindgen_a76cb45502a6ea40_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_int2@
+hs_bindgen_a76cb45502a6ea40 :: IO (FunPtr (A -> CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_int2@
+hs_bindgen_a76cb45502a6ea40 = fmap fromFFIType hs_bindgen_a76cb45502a6ea40_base
+{-# NOINLINE args_int2_funptr #-}
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_funptr :: FunPtr (A -> CInt -> IO ())
+{-| __C declaration:__ @args_int2@
+
+    __defined at:__ @macros\/reparse.h 26:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int2_funptr = unsafePerformIO hs_bindgen_a76cb45502a6ea40
+-- __unique:__ @test_macrosreparse_Example_get_args_int3@
+foreign import ccall unsafe "hs_bindgen_99f48290fac28118" hs_bindgen_99f48290fac28118_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_int3@
+hs_bindgen_99f48290fac28118 :: IO (FunPtr (A -> CUInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_int3@
+hs_bindgen_99f48290fac28118 = fmap fromFFIType hs_bindgen_99f48290fac28118_base
+{-# NOINLINE args_int3_funptr #-}
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_funptr :: FunPtr (A -> CUInt -> IO ())
+{-| __C declaration:__ @args_int3@
+
+    __defined at:__ @macros\/reparse.h 27:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_int3_funptr = unsafePerformIO hs_bindgen_99f48290fac28118
+-- __unique:__ @test_macrosreparse_Example_get_args_long1@
+foreign import ccall unsafe "hs_bindgen_60a477b55893fa8e" hs_bindgen_60a477b55893fa8e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_long1@
+hs_bindgen_60a477b55893fa8e :: IO (FunPtr (A -> CLong -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_long1@
+hs_bindgen_60a477b55893fa8e = fmap fromFFIType hs_bindgen_60a477b55893fa8e_base
+{-# NOINLINE args_long1_funptr #-}
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_funptr :: FunPtr (A -> CLong -> IO ())
+{-| __C declaration:__ @args_long1@
+
+    __defined at:__ @macros\/reparse.h 29:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long1_funptr = unsafePerformIO hs_bindgen_60a477b55893fa8e
+-- __unique:__ @test_macrosreparse_Example_get_args_long2@
+foreign import ccall unsafe "hs_bindgen_9ba7a90039c212ea" hs_bindgen_9ba7a90039c212ea_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_long2@
+hs_bindgen_9ba7a90039c212ea :: IO (FunPtr (A -> CLong -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_long2@
+hs_bindgen_9ba7a90039c212ea = fmap fromFFIType hs_bindgen_9ba7a90039c212ea_base
+{-# NOINLINE args_long2_funptr #-}
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_funptr :: FunPtr (A -> CLong -> IO ())
+{-| __C declaration:__ @args_long2@
+
+    __defined at:__ @macros\/reparse.h 30:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long2_funptr = unsafePerformIO hs_bindgen_9ba7a90039c212ea
+-- __unique:__ @test_macrosreparse_Example_get_args_long3@
+foreign import ccall unsafe "hs_bindgen_b44cf380afb4d650" hs_bindgen_b44cf380afb4d650_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_long3@
+hs_bindgen_b44cf380afb4d650 :: IO (FunPtr (A -> CULong -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_long3@
+hs_bindgen_b44cf380afb4d650 = fmap fromFFIType hs_bindgen_b44cf380afb4d650_base
+{-# NOINLINE args_long3_funptr #-}
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_funptr :: FunPtr (A -> CULong -> IO ())
+{-| __C declaration:__ @args_long3@
+
+    __defined at:__ @macros\/reparse.h 31:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_long3_funptr = unsafePerformIO hs_bindgen_b44cf380afb4d650
+-- __unique:__ @test_macrosreparse_Example_get_args_float@
+foreign import ccall unsafe "hs_bindgen_b46cc7463fd36e1a" hs_bindgen_b46cc7463fd36e1a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_float@
+hs_bindgen_b46cc7463fd36e1a :: IO (FunPtr (A -> CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_float@
+hs_bindgen_b46cc7463fd36e1a = fmap fromFFIType hs_bindgen_b46cc7463fd36e1a_base
+{-# NOINLINE args_float_funptr #-}
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_funptr :: FunPtr (A -> CFloat -> IO ())
+{-| __C declaration:__ @args_float@
+
+    __defined at:__ @macros\/reparse.h 33:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_float_funptr = unsafePerformIO hs_bindgen_b46cc7463fd36e1a
+-- __unique:__ @test_macrosreparse_Example_get_args_double@
+foreign import ccall unsafe "hs_bindgen_eb95876c1227b1d6" hs_bindgen_eb95876c1227b1d6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_double@
+hs_bindgen_eb95876c1227b1d6 :: IO (FunPtr (A -> CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_double@
+hs_bindgen_eb95876c1227b1d6 = fmap fromFFIType hs_bindgen_eb95876c1227b1d6_base
+{-# NOINLINE args_double_funptr #-}
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_funptr :: FunPtr (A -> CDouble -> IO ())
+{-| __C declaration:__ @args_double@
+
+    __defined at:__ @macros\/reparse.h 34:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_double_funptr = unsafePerformIO hs_bindgen_eb95876c1227b1d6
+-- __unique:__ @test_macrosreparse_Example_get_args_bool1@
+foreign import ccall unsafe "hs_bindgen_340ecf91e1edd759" hs_bindgen_340ecf91e1edd759_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_bool1@
+hs_bindgen_340ecf91e1edd759 :: IO (FunPtr (A -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_bool1@
+hs_bindgen_340ecf91e1edd759 = fmap fromFFIType hs_bindgen_340ecf91e1edd759_base
+{-# NOINLINE args_bool1_funptr #-}
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_funptr :: FunPtr (A -> CBool -> IO ())
+{-| __C declaration:__ @args_bool1@
+
+    __defined at:__ @macros\/reparse.h 35:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_bool1_funptr = unsafePerformIO hs_bindgen_340ecf91e1edd759
+-- __unique:__ @test_macrosreparse_Example_get_args_struct@
+foreign import ccall unsafe "hs_bindgen_940fccf4ff28ad11" hs_bindgen_940fccf4ff28ad11_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_struct@
+hs_bindgen_940fccf4ff28ad11 :: IO (FunPtr (A ->
+                                           Some_struct -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_struct@
+hs_bindgen_940fccf4ff28ad11 = fmap fromFFIType hs_bindgen_940fccf4ff28ad11_base
+{-# NOINLINE args_struct_funptr #-}
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_funptr :: FunPtr (A -> Some_struct -> IO ())
+{-| __C declaration:__ @args_struct@
+
+    __defined at:__ @macros\/reparse.h 37:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_struct_funptr = unsafePerformIO hs_bindgen_940fccf4ff28ad11
+-- __unique:__ @test_macrosreparse_Example_get_args_union@
+foreign import ccall unsafe "hs_bindgen_c0ae19f85578b58d" hs_bindgen_c0ae19f85578b58d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_union@
+hs_bindgen_c0ae19f85578b58d :: IO (FunPtr (A ->
+                                           Some_union -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_union@
+hs_bindgen_c0ae19f85578b58d = fmap fromFFIType hs_bindgen_c0ae19f85578b58d_base
+{-# NOINLINE args_union_funptr #-}
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_funptr :: FunPtr (A -> Some_union -> IO ())
+{-| __C declaration:__ @args_union@
+
+    __defined at:__ @macros\/reparse.h 38:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_union_funptr = unsafePerformIO hs_bindgen_c0ae19f85578b58d
+-- __unique:__ @test_macrosreparse_Example_get_args_enum@
+foreign import ccall unsafe "hs_bindgen_6f4ca5d36cd98d5e" hs_bindgen_6f4ca5d36cd98d5e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_enum@
+hs_bindgen_6f4ca5d36cd98d5e :: IO (FunPtr (A ->
+                                           Some_enum -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_enum@
+hs_bindgen_6f4ca5d36cd98d5e = fmap fromFFIType hs_bindgen_6f4ca5d36cd98d5e_base
+{-# NOINLINE args_enum_funptr #-}
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_funptr :: FunPtr (A -> Some_enum -> IO ())
+{-| __C declaration:__ @args_enum@
+
+    __defined at:__ @macros\/reparse.h 39:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_enum_funptr = unsafePerformIO hs_bindgen_6f4ca5d36cd98d5e
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer1@
+foreign import ccall unsafe "hs_bindgen_8f02d93a83f3e2f3" hs_bindgen_8f02d93a83f3e2f3_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer1@
+hs_bindgen_8f02d93a83f3e2f3 :: IO (FunPtr (A -> Ptr CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer1@
+hs_bindgen_8f02d93a83f3e2f3 = fmap fromFFIType hs_bindgen_8f02d93a83f3e2f3_base
+{-# NOINLINE args_pointer1_funptr #-}
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_funptr :: FunPtr (A -> Ptr CInt -> IO ())
+{-| __C declaration:__ @args_pointer1@
+
+    __defined at:__ @macros\/reparse.h 41:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer1_funptr = unsafePerformIO hs_bindgen_8f02d93a83f3e2f3
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer2@
+foreign import ccall unsafe "hs_bindgen_3217d3d95482b1ac" hs_bindgen_3217d3d95482b1ac_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer2@
+hs_bindgen_3217d3d95482b1ac :: IO (FunPtr (A ->
+                                           Ptr (Ptr CInt) -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer2@
+hs_bindgen_3217d3d95482b1ac = fmap fromFFIType hs_bindgen_3217d3d95482b1ac_base
+{-# NOINLINE args_pointer2_funptr #-}
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_funptr :: FunPtr (A -> Ptr (Ptr CInt) -> IO ())
+{-| __C declaration:__ @args_pointer2@
+
+    __defined at:__ @macros\/reparse.h 42:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer2_funptr = unsafePerformIO hs_bindgen_3217d3d95482b1ac
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer3@
+foreign import ccall unsafe "hs_bindgen_8e680c501eeba095" hs_bindgen_8e680c501eeba095_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer3@
+hs_bindgen_8e680c501eeba095 :: IO (FunPtr (A -> Ptr Void -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_pointer3@
+hs_bindgen_8e680c501eeba095 = fmap fromFFIType hs_bindgen_8e680c501eeba095_base
+{-# NOINLINE args_pointer3_funptr #-}
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_funptr :: FunPtr (A -> Ptr Void -> IO ())
+{-| __C declaration:__ @args_pointer3@
+
+    __defined at:__ @macros\/reparse.h 43:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_pointer3_funptr = unsafePerformIO hs_bindgen_8e680c501eeba095
+-- __unique:__ @test_macrosreparse_Example_get_ret_A@
+foreign import ccall unsafe "hs_bindgen_dfceb7c79cda3aab" hs_bindgen_dfceb7c79cda3aab_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_A@
+hs_bindgen_dfceb7c79cda3aab :: IO (FunPtr (IO A))
+-- __unique:__ @test_macrosreparse_Example_get_ret_A@
+hs_bindgen_dfceb7c79cda3aab = fmap fromFFIType hs_bindgen_dfceb7c79cda3aab_base
+{-# NOINLINE ret_A_funptr #-}
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_funptr :: FunPtr (IO A)
+{-| __C declaration:__ @ret_A@
+
+    __defined at:__ @macros\/reparse.h 47:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_A_funptr = unsafePerformIO hs_bindgen_dfceb7c79cda3aab
+-- __unique:__ @test_macrosreparse_Example_get_ret_char1@
+foreign import ccall unsafe "hs_bindgen_d30074ed19081e69" hs_bindgen_d30074ed19081e69_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_char1@
+hs_bindgen_d30074ed19081e69 :: IO (FunPtr (A -> IO CChar))
+-- __unique:__ @test_macrosreparse_Example_get_ret_char1@
+hs_bindgen_d30074ed19081e69 = fmap fromFFIType hs_bindgen_d30074ed19081e69_base
+{-# NOINLINE ret_char1_funptr #-}
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_funptr :: FunPtr (A -> IO CChar)
+{-| __C declaration:__ @ret_char1@
+
+    __defined at:__ @macros\/reparse.h 49:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char1_funptr = unsafePerformIO hs_bindgen_d30074ed19081e69
+-- __unique:__ @test_macrosreparse_Example_get_ret_char2@
+foreign import ccall unsafe "hs_bindgen_c9a2d554e9d3e7e2" hs_bindgen_c9a2d554e9d3e7e2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_char2@
+hs_bindgen_c9a2d554e9d3e7e2 :: IO (FunPtr (A -> IO CSChar))
+-- __unique:__ @test_macrosreparse_Example_get_ret_char2@
+hs_bindgen_c9a2d554e9d3e7e2 = fmap fromFFIType hs_bindgen_c9a2d554e9d3e7e2_base
+{-# NOINLINE ret_char2_funptr #-}
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_funptr :: FunPtr (A -> IO CSChar)
+{-| __C declaration:__ @ret_char2@
+
+    __defined at:__ @macros\/reparse.h 50:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char2_funptr = unsafePerformIO hs_bindgen_c9a2d554e9d3e7e2
+-- __unique:__ @test_macrosreparse_Example_get_ret_char3@
+foreign import ccall unsafe "hs_bindgen_261f4f5dd5925788" hs_bindgen_261f4f5dd5925788_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_char3@
+hs_bindgen_261f4f5dd5925788 :: IO (FunPtr (A -> IO CUChar))
+-- __unique:__ @test_macrosreparse_Example_get_ret_char3@
+hs_bindgen_261f4f5dd5925788 = fmap fromFFIType hs_bindgen_261f4f5dd5925788_base
+{-# NOINLINE ret_char3_funptr #-}
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_funptr :: FunPtr (A -> IO CUChar)
+{-| __C declaration:__ @ret_char3@
+
+    __defined at:__ @macros\/reparse.h 51:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_char3_funptr = unsafePerformIO hs_bindgen_261f4f5dd5925788
+-- __unique:__ @test_macrosreparse_Example_get_ret_short1@
+foreign import ccall unsafe "hs_bindgen_8d5fba739ef413a8" hs_bindgen_8d5fba739ef413a8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_short1@
+hs_bindgen_8d5fba739ef413a8 :: IO (FunPtr (A -> IO CShort))
+-- __unique:__ @test_macrosreparse_Example_get_ret_short1@
+hs_bindgen_8d5fba739ef413a8 = fmap fromFFIType hs_bindgen_8d5fba739ef413a8_base
+{-# NOINLINE ret_short1_funptr #-}
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_funptr :: FunPtr (A -> IO CShort)
+{-| __C declaration:__ @ret_short1@
+
+    __defined at:__ @macros\/reparse.h 53:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short1_funptr = unsafePerformIO hs_bindgen_8d5fba739ef413a8
+-- __unique:__ @test_macrosreparse_Example_get_ret_short2@
+foreign import ccall unsafe "hs_bindgen_5dbda022b4ddeeb7" hs_bindgen_5dbda022b4ddeeb7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_short2@
+hs_bindgen_5dbda022b4ddeeb7 :: IO (FunPtr (A -> IO CShort))
+-- __unique:__ @test_macrosreparse_Example_get_ret_short2@
+hs_bindgen_5dbda022b4ddeeb7 = fmap fromFFIType hs_bindgen_5dbda022b4ddeeb7_base
+{-# NOINLINE ret_short2_funptr #-}
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_funptr :: FunPtr (A -> IO CShort)
+{-| __C declaration:__ @ret_short2@
+
+    __defined at:__ @macros\/reparse.h 54:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short2_funptr = unsafePerformIO hs_bindgen_5dbda022b4ddeeb7
+-- __unique:__ @test_macrosreparse_Example_get_ret_short3@
+foreign import ccall unsafe "hs_bindgen_8bfdaeda59194c69" hs_bindgen_8bfdaeda59194c69_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_short3@
+hs_bindgen_8bfdaeda59194c69 :: IO (FunPtr (A -> IO CUShort))
+-- __unique:__ @test_macrosreparse_Example_get_ret_short3@
+hs_bindgen_8bfdaeda59194c69 = fmap fromFFIType hs_bindgen_8bfdaeda59194c69_base
+{-# NOINLINE ret_short3_funptr #-}
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_funptr :: FunPtr (A -> IO CUShort)
+{-| __C declaration:__ @ret_short3@
+
+    __defined at:__ @macros\/reparse.h 55:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_short3_funptr = unsafePerformIO hs_bindgen_8bfdaeda59194c69
+-- __unique:__ @test_macrosreparse_Example_get_ret_int1@
+foreign import ccall unsafe "hs_bindgen_6b977384ffcfa7c6" hs_bindgen_6b977384ffcfa7c6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_int1@
+hs_bindgen_6b977384ffcfa7c6 :: IO (FunPtr (A -> IO CInt))
+-- __unique:__ @test_macrosreparse_Example_get_ret_int1@
+hs_bindgen_6b977384ffcfa7c6 = fmap fromFFIType hs_bindgen_6b977384ffcfa7c6_base
+{-# NOINLINE ret_int1_funptr #-}
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_funptr :: FunPtr (A -> IO CInt)
+{-| __C declaration:__ @ret_int1@
+
+    __defined at:__ @macros\/reparse.h 57:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int1_funptr = unsafePerformIO hs_bindgen_6b977384ffcfa7c6
+-- __unique:__ @test_macrosreparse_Example_get_ret_int2@
+foreign import ccall unsafe "hs_bindgen_cc47d3f794021505" hs_bindgen_cc47d3f794021505_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_int2@
+hs_bindgen_cc47d3f794021505 :: IO (FunPtr (A -> IO CInt))
+-- __unique:__ @test_macrosreparse_Example_get_ret_int2@
+hs_bindgen_cc47d3f794021505 = fmap fromFFIType hs_bindgen_cc47d3f794021505_base
+{-# NOINLINE ret_int2_funptr #-}
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_funptr :: FunPtr (A -> IO CInt)
+{-| __C declaration:__ @ret_int2@
+
+    __defined at:__ @macros\/reparse.h 58:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int2_funptr = unsafePerformIO hs_bindgen_cc47d3f794021505
+-- __unique:__ @test_macrosreparse_Example_get_ret_int3@
+foreign import ccall unsafe "hs_bindgen_488fbaf79c234569" hs_bindgen_488fbaf79c234569_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_int3@
+hs_bindgen_488fbaf79c234569 :: IO (FunPtr (A -> IO CUInt))
+-- __unique:__ @test_macrosreparse_Example_get_ret_int3@
+hs_bindgen_488fbaf79c234569 = fmap fromFFIType hs_bindgen_488fbaf79c234569_base
+{-# NOINLINE ret_int3_funptr #-}
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_funptr :: FunPtr (A -> IO CUInt)
+{-| __C declaration:__ @ret_int3@
+
+    __defined at:__ @macros\/reparse.h 59:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_int3_funptr = unsafePerformIO hs_bindgen_488fbaf79c234569
+-- __unique:__ @test_macrosreparse_Example_get_ret_long1@
+foreign import ccall unsafe "hs_bindgen_8cf14a89b1268b17" hs_bindgen_8cf14a89b1268b17_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_long1@
+hs_bindgen_8cf14a89b1268b17 :: IO (FunPtr (A -> IO CLong))
+-- __unique:__ @test_macrosreparse_Example_get_ret_long1@
+hs_bindgen_8cf14a89b1268b17 = fmap fromFFIType hs_bindgen_8cf14a89b1268b17_base
+{-# NOINLINE ret_long1_funptr #-}
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_funptr :: FunPtr (A -> IO CLong)
+{-| __C declaration:__ @ret_long1@
+
+    __defined at:__ @macros\/reparse.h 61:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long1_funptr = unsafePerformIO hs_bindgen_8cf14a89b1268b17
+-- __unique:__ @test_macrosreparse_Example_get_ret_long2@
+foreign import ccall unsafe "hs_bindgen_617e98b076d9fd82" hs_bindgen_617e98b076d9fd82_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_long2@
+hs_bindgen_617e98b076d9fd82 :: IO (FunPtr (A -> IO CLong))
+-- __unique:__ @test_macrosreparse_Example_get_ret_long2@
+hs_bindgen_617e98b076d9fd82 = fmap fromFFIType hs_bindgen_617e98b076d9fd82_base
+{-# NOINLINE ret_long2_funptr #-}
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_funptr :: FunPtr (A -> IO CLong)
+{-| __C declaration:__ @ret_long2@
+
+    __defined at:__ @macros\/reparse.h 62:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long2_funptr = unsafePerformIO hs_bindgen_617e98b076d9fd82
+-- __unique:__ @test_macrosreparse_Example_get_ret_long3@
+foreign import ccall unsafe "hs_bindgen_e1892d8eb6a27221" hs_bindgen_e1892d8eb6a27221_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_long3@
+hs_bindgen_e1892d8eb6a27221 :: IO (FunPtr (A -> IO CULong))
+-- __unique:__ @test_macrosreparse_Example_get_ret_long3@
+hs_bindgen_e1892d8eb6a27221 = fmap fromFFIType hs_bindgen_e1892d8eb6a27221_base
+{-# NOINLINE ret_long3_funptr #-}
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_funptr :: FunPtr (A -> IO CULong)
+{-| __C declaration:__ @ret_long3@
+
+    __defined at:__ @macros\/reparse.h 63:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_long3_funptr = unsafePerformIO hs_bindgen_e1892d8eb6a27221
+-- __unique:__ @test_macrosreparse_Example_get_ret_float@
+foreign import ccall unsafe "hs_bindgen_db7561d69f707657" hs_bindgen_db7561d69f707657_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_float@
+hs_bindgen_db7561d69f707657 :: IO (FunPtr (A -> IO CFloat))
+-- __unique:__ @test_macrosreparse_Example_get_ret_float@
+hs_bindgen_db7561d69f707657 = fmap fromFFIType hs_bindgen_db7561d69f707657_base
+{-# NOINLINE ret_float_funptr #-}
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_funptr :: FunPtr (A -> IO CFloat)
+{-| __C declaration:__ @ret_float@
+
+    __defined at:__ @macros\/reparse.h 65:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_float_funptr = unsafePerformIO hs_bindgen_db7561d69f707657
+-- __unique:__ @test_macrosreparse_Example_get_ret_double@
+foreign import ccall unsafe "hs_bindgen_e37ad3e87e7cf4de" hs_bindgen_e37ad3e87e7cf4de_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_double@
+hs_bindgen_e37ad3e87e7cf4de :: IO (FunPtr (A -> IO CDouble))
+-- __unique:__ @test_macrosreparse_Example_get_ret_double@
+hs_bindgen_e37ad3e87e7cf4de = fmap fromFFIType hs_bindgen_e37ad3e87e7cf4de_base
+{-# NOINLINE ret_double_funptr #-}
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_funptr :: FunPtr (A -> IO CDouble)
+{-| __C declaration:__ @ret_double@
+
+    __defined at:__ @macros\/reparse.h 66:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_double_funptr = unsafePerformIO hs_bindgen_e37ad3e87e7cf4de
+-- __unique:__ @test_macrosreparse_Example_get_ret_bool1@
+foreign import ccall unsafe "hs_bindgen_07705133d0d853ee" hs_bindgen_07705133d0d853ee_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_bool1@
+hs_bindgen_07705133d0d853ee :: IO (FunPtr (A -> IO CBool))
+-- __unique:__ @test_macrosreparse_Example_get_ret_bool1@
+hs_bindgen_07705133d0d853ee = fmap fromFFIType hs_bindgen_07705133d0d853ee_base
+{-# NOINLINE ret_bool1_funptr #-}
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_funptr :: FunPtr (A -> IO CBool)
+{-| __C declaration:__ @ret_bool1@
+
+    __defined at:__ @macros\/reparse.h 67:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_bool1_funptr = unsafePerformIO hs_bindgen_07705133d0d853ee
+-- __unique:__ @test_macrosreparse_Example_get_ret_struct@
+foreign import ccall unsafe "hs_bindgen_72cf2ef70b845850" hs_bindgen_72cf2ef70b845850_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_struct@
+hs_bindgen_72cf2ef70b845850 :: IO (FunPtr (A -> IO Some_struct))
+-- __unique:__ @test_macrosreparse_Example_get_ret_struct@
+hs_bindgen_72cf2ef70b845850 = fmap fromFFIType hs_bindgen_72cf2ef70b845850_base
+{-# NOINLINE ret_struct_funptr #-}
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_funptr :: FunPtr (A -> IO Some_struct)
+{-| __C declaration:__ @ret_struct@
+
+    __defined at:__ @macros\/reparse.h 69:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_struct_funptr = unsafePerformIO hs_bindgen_72cf2ef70b845850
+-- __unique:__ @test_macrosreparse_Example_get_ret_union@
+foreign import ccall unsafe "hs_bindgen_fe31acee84b319c8" hs_bindgen_fe31acee84b319c8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_union@
+hs_bindgen_fe31acee84b319c8 :: IO (FunPtr (A -> IO Some_union))
+-- __unique:__ @test_macrosreparse_Example_get_ret_union@
+hs_bindgen_fe31acee84b319c8 = fmap fromFFIType hs_bindgen_fe31acee84b319c8_base
+{-# NOINLINE ret_union_funptr #-}
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_funptr :: FunPtr (A -> IO Some_union)
+{-| __C declaration:__ @ret_union@
+
+    __defined at:__ @macros\/reparse.h 70:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_union_funptr = unsafePerformIO hs_bindgen_fe31acee84b319c8
+-- __unique:__ @test_macrosreparse_Example_get_ret_enum@
+foreign import ccall unsafe "hs_bindgen_0ec7e00f11946277" hs_bindgen_0ec7e00f11946277_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_enum@
+hs_bindgen_0ec7e00f11946277 :: IO (FunPtr (A -> IO Some_enum))
+-- __unique:__ @test_macrosreparse_Example_get_ret_enum@
+hs_bindgen_0ec7e00f11946277 = fmap fromFFIType hs_bindgen_0ec7e00f11946277_base
+{-# NOINLINE ret_enum_funptr #-}
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_funptr :: FunPtr (A -> IO Some_enum)
+{-| __C declaration:__ @ret_enum@
+
+    __defined at:__ @macros\/reparse.h 71:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_enum_funptr = unsafePerformIO hs_bindgen_0ec7e00f11946277
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer1@
+foreign import ccall unsafe "hs_bindgen_b09c0f340896fe06" hs_bindgen_b09c0f340896fe06_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer1@
+hs_bindgen_b09c0f340896fe06 :: IO (FunPtr (A -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer1@
+hs_bindgen_b09c0f340896fe06 = fmap fromFFIType hs_bindgen_b09c0f340896fe06_base
+{-# NOINLINE ret_pointer1_funptr #-}
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_funptr :: FunPtr (A -> IO (Ptr CInt))
+{-| __C declaration:__ @ret_pointer1@
+
+    __defined at:__ @macros\/reparse.h 73:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer1_funptr = unsafePerformIO hs_bindgen_b09c0f340896fe06
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer2@
+foreign import ccall unsafe "hs_bindgen_300fabb661902701" hs_bindgen_300fabb661902701_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer2@
+hs_bindgen_300fabb661902701 :: IO (FunPtr (A ->
+                                           IO (Ptr (Ptr CInt))))
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer2@
+hs_bindgen_300fabb661902701 = fmap fromFFIType hs_bindgen_300fabb661902701_base
+{-# NOINLINE ret_pointer2_funptr #-}
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_funptr :: FunPtr (A -> IO (Ptr (Ptr CInt)))
+{-| __C declaration:__ @ret_pointer2@
+
+    __defined at:__ @macros\/reparse.h 74:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer2_funptr = unsafePerformIO hs_bindgen_300fabb661902701
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer3@
+foreign import ccall unsafe "hs_bindgen_12135a6384fcfda7" hs_bindgen_12135a6384fcfda7_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer3@
+hs_bindgen_12135a6384fcfda7 :: IO (FunPtr (A -> IO (Ptr Void)))
+-- __unique:__ @test_macrosreparse_Example_get_ret_pointer3@
+hs_bindgen_12135a6384fcfda7 = fmap fromFFIType hs_bindgen_12135a6384fcfda7_base
+{-# NOINLINE ret_pointer3_funptr #-}
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_funptr :: FunPtr (A -> IO (Ptr Void))
+{-| __C declaration:__ @ret_pointer3@
+
+    __defined at:__ @macros\/reparse.h 75:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_pointer3_funptr = unsafePerformIO hs_bindgen_12135a6384fcfda7
+-- __unique:__ @test_macrosreparse_Example_get_body1@
+foreign import ccall unsafe "hs_bindgen_f6ce3e885e11b623" hs_bindgen_f6ce3e885e11b623_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_body1@
+hs_bindgen_f6ce3e885e11b623 :: IO (FunPtr (A -> IO CInt))
+-- __unique:__ @test_macrosreparse_Example_get_body1@
+hs_bindgen_f6ce3e885e11b623 = fmap fromFFIType hs_bindgen_f6ce3e885e11b623_base
+{-# NOINLINE body1_funptr #-}
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_funptr :: FunPtr (A -> IO CInt)
+{-| __C declaration:__ @body1@
+
+    __defined at:__ @macros\/reparse.h 79:5@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body1_funptr = unsafePerformIO hs_bindgen_f6ce3e885e11b623
+-- __unique:__ @test_macrosreparse_Example_get_body2@
+foreign import ccall unsafe "hs_bindgen_a7010032c19e6947" hs_bindgen_a7010032c19e6947_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_body2@
+hs_bindgen_a7010032c19e6947 :: IO (FunPtr (IO A))
+-- __unique:__ @test_macrosreparse_Example_get_body2@
+hs_bindgen_a7010032c19e6947 = fmap fromFFIType hs_bindgen_a7010032c19e6947_base
+{-# NOINLINE body2_funptr #-}
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_funptr :: FunPtr (IO A)
+{-| __C declaration:__ @body2@
+
+    __defined at:__ @macros\/reparse.h 80:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+body2_funptr = unsafePerformIO hs_bindgen_a7010032c19e6947
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_float@
+foreign import ccall unsafe "hs_bindgen_b9a5de00354a54fe" hs_bindgen_b9a5de00354a54fe_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_float@
+hs_bindgen_b9a5de00354a54fe :: IO (FunPtr (A ->
+                                           Complex CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_float@
+hs_bindgen_b9a5de00354a54fe = fmap fromFFIType hs_bindgen_b9a5de00354a54fe_base
+{-# NOINLINE args_complex_float_funptr #-}
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_funptr :: FunPtr (A -> Complex CFloat -> IO ())
+{-| __C declaration:__ @args_complex_float@
+
+    __defined at:__ @macros\/reparse.h 84:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_float_funptr = unsafePerformIO hs_bindgen_b9a5de00354a54fe
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_double@
+foreign import ccall unsafe "hs_bindgen_824a00413581d46c" hs_bindgen_824a00413581d46c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_double@
+hs_bindgen_824a00413581d46c :: IO (FunPtr (A ->
+                                           Complex CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_args_complex_double@
+hs_bindgen_824a00413581d46c = fmap fromFFIType hs_bindgen_824a00413581d46c_base
+{-# NOINLINE args_complex_double_funptr #-}
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_funptr :: FunPtr (A ->
+                                      Complex CDouble -> IO ())
+{-| __C declaration:__ @args_complex_double@
+
+    __defined at:__ @macros\/reparse.h 85:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+args_complex_double_funptr = unsafePerformIO hs_bindgen_824a00413581d46c
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_float@
+foreign import ccall unsafe "hs_bindgen_685d6c0a58e9b874" hs_bindgen_685d6c0a58e9b874_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_float@
+hs_bindgen_685d6c0a58e9b874 :: IO (FunPtr (A ->
+                                           IO (Complex CFloat)))
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_float@
+hs_bindgen_685d6c0a58e9b874 = fmap fromFFIType hs_bindgen_685d6c0a58e9b874_base
+{-# NOINLINE ret_complex_float_funptr #-}
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_funptr :: FunPtr (A -> IO (Complex CFloat))
+{-| __C declaration:__ @ret_complex_float@
+
+    __defined at:__ @macros\/reparse.h 86:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_float_funptr = unsafePerformIO hs_bindgen_685d6c0a58e9b874
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_double@
+foreign import ccall unsafe "hs_bindgen_0dea6be8e06122eb" hs_bindgen_0dea6be8e06122eb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_double@
+hs_bindgen_0dea6be8e06122eb :: IO (FunPtr (A ->
+                                           IO (Complex CDouble)))
+-- __unique:__ @test_macrosreparse_Example_get_ret_complex_double@
+hs_bindgen_0dea6be8e06122eb = fmap fromFFIType hs_bindgen_0dea6be8e06122eb_base
+{-# NOINLINE ret_complex_double_funptr #-}
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_funptr :: FunPtr (A -> IO (Complex CDouble))
+{-| __C declaration:__ @ret_complex_double@
+
+    __defined at:__ @macros\/reparse.h 87:17@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+ret_complex_double_funptr = unsafePerformIO hs_bindgen_0dea6be8e06122eb
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args1@
+foreign import ccall unsafe "hs_bindgen_cd799b883e59eadd" hs_bindgen_cd799b883e59eadd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args1@
+hs_bindgen_cd799b883e59eadd :: IO (FunPtr (A -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args1@
+hs_bindgen_cd799b883e59eadd = fmap fromFFIType hs_bindgen_cd799b883e59eadd_base
+{-# NOINLINE bespoke_args1_funptr #-}
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_funptr :: FunPtr (A -> CBool -> IO ())
+{-| __C declaration:__ @bespoke_args1@
+
+    __defined at:__ @macros\/reparse.h 94:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args1_funptr = unsafePerformIO hs_bindgen_cd799b883e59eadd
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args2@
+foreign import ccall unsafe "hs_bindgen_eabc3e2c716b0250" hs_bindgen_eabc3e2c716b0250_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args2@
+hs_bindgen_eabc3e2c716b0250 :: IO (FunPtr (A ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_args2@
+hs_bindgen_eabc3e2c716b0250 = fmap fromFFIType hs_bindgen_eabc3e2c716b0250_base
+{-# NOINLINE bespoke_args2_funptr #-}
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_funptr :: FunPtr (A ->
+                                HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| __C declaration:__ @bespoke_args2@
+
+    __defined at:__ @macros\/reparse.h 95:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_args2_funptr = unsafePerformIO hs_bindgen_eabc3e2c716b0250
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret1@
+foreign import ccall unsafe "hs_bindgen_8a47565361a0290f" hs_bindgen_8a47565361a0290f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret1@
+hs_bindgen_8a47565361a0290f :: IO (FunPtr (A -> IO CBool))
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret1@
+hs_bindgen_8a47565361a0290f = fmap fromFFIType hs_bindgen_8a47565361a0290f_base
+{-# NOINLINE bespoke_ret1_funptr #-}
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_funptr :: FunPtr (A -> IO CBool)
+{-| __C declaration:__ @bespoke_ret1@
+
+    __defined at:__ @macros\/reparse.h 97:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret1_funptr = unsafePerformIO hs_bindgen_8a47565361a0290f
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret2@
+foreign import ccall unsafe "hs_bindgen_384c8ceed3a4ca90" hs_bindgen_384c8ceed3a4ca90_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret2@
+hs_bindgen_384c8ceed3a4ca90 :: IO (FunPtr (A ->
+                                           IO HsBindgen.Runtime.LibC.CSize))
+-- __unique:__ @test_macrosreparse_Example_get_bespoke_ret2@
+hs_bindgen_384c8ceed3a4ca90 = fmap fromFFIType hs_bindgen_384c8ceed3a4ca90_base
+{-# NOINLINE bespoke_ret2_funptr #-}
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_funptr :: FunPtr (A ->
+                               IO HsBindgen.Runtime.LibC.CSize)
+{-| __C declaration:__ @bespoke_ret2@
+
+    __defined at:__ @macros\/reparse.h 98:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+bespoke_ret2_funptr = unsafePerformIO hs_bindgen_384c8ceed3a4ca90
+-- __unique:__ @test_macrosreparse_Example_get_arr_args1@
+foreign import ccall unsafe "hs_bindgen_b38b526cf0817bf0" hs_bindgen_b38b526cf0817bf0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_arr_args1@
+hs_bindgen_b38b526cf0817bf0 :: IO (FunPtr (Ptr (Elem (IncompleteArray A)) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_arr_args1@
+hs_bindgen_b38b526cf0817bf0 = fmap fromFFIType hs_bindgen_b38b526cf0817bf0_base
+{-# NOINLINE arr_args1_funptr #-}
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_funptr :: FunPtr (Ptr (Elem (IncompleteArray A)) ->
+                            IO ())
+{-| Arrays
+
+    __C declaration:__ @arr_args1@
+
+    __defined at:__ @macros\/reparse.h 104:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args1_funptr = unsafePerformIO hs_bindgen_b38b526cf0817bf0
+-- __unique:__ @test_macrosreparse_Example_get_arr_args2@
+foreign import ccall unsafe "hs_bindgen_2c0bca39b42ecbec" hs_bindgen_2c0bca39b42ecbec_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_arr_args2@
+hs_bindgen_2c0bca39b42ecbec :: IO (FunPtr (Ptr (Elem (IncompleteArray (Ptr A))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_arr_args2@
+hs_bindgen_2c0bca39b42ecbec = fmap fromFFIType hs_bindgen_2c0bca39b42ecbec_base
+{-# NOINLINE arr_args2_funptr #-}
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_funptr :: FunPtr (Ptr (Elem (IncompleteArray (Ptr A))) ->
+                            IO ())
+{-| __C declaration:__ @arr_args2@
+
+    __defined at:__ @macros\/reparse.h 105:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args2_funptr = unsafePerformIO hs_bindgen_2c0bca39b42ecbec
+-- __unique:__ @test_macrosreparse_Example_get_arr_args3@
+foreign import ccall unsafe "hs_bindgen_82a8c15919ae3f33" hs_bindgen_82a8c15919ae3f33_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_arr_args3@
+hs_bindgen_82a8c15919ae3f33 :: IO (FunPtr (Ptr (Elem (ConstantArray 5
+                                                                    A)) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_arr_args3@
+hs_bindgen_82a8c15919ae3f33 = fmap fromFFIType hs_bindgen_82a8c15919ae3f33_base
+{-# NOINLINE arr_args3_funptr #-}
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_funptr :: FunPtr (Ptr (Elem (ConstantArray 5 A)) ->
+                            IO ())
+{-| __C declaration:__ @arr_args3@
+
+    __defined at:__ @macros\/reparse.h 106:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args3_funptr = unsafePerformIO hs_bindgen_82a8c15919ae3f33
+-- __unique:__ @test_macrosreparse_Example_get_arr_args4@
+foreign import ccall unsafe "hs_bindgen_db074918e0d38cb5" hs_bindgen_db074918e0d38cb5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_arr_args4@
+hs_bindgen_db074918e0d38cb5 :: IO (FunPtr (Ptr (Elem (ConstantArray 5
+                                                                    (Ptr A))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_arr_args4@
+hs_bindgen_db074918e0d38cb5 = fmap fromFFIType hs_bindgen_db074918e0d38cb5_base
+{-# NOINLINE arr_args4_funptr #-}
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_funptr :: FunPtr (Ptr (Elem (ConstantArray 5 (Ptr A))) ->
+                            IO ())
+{-| __C declaration:__ @arr_args4@
+
+    __defined at:__ @macros\/reparse.h 107:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+arr_args4_funptr = unsafePerformIO hs_bindgen_db074918e0d38cb5
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args1@
+foreign import ccall unsafe "hs_bindgen_3fd6d1fbd060ffcf" hs_bindgen_3fd6d1fbd060ffcf_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args1@
+hs_bindgen_3fd6d1fbd060ffcf :: IO (FunPtr (A ->
+                                           FunPtr (IO ()) -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args1@
+hs_bindgen_3fd6d1fbd060ffcf = fmap fromFFIType hs_bindgen_3fd6d1fbd060ffcf_base
+{-# NOINLINE funptr_args1_funptr #-}
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_funptr :: FunPtr (A -> FunPtr (IO ()) -> IO ())
+{-| Function pointers
+
+    __C declaration:__ @funptr_args1@
+
+    __defined at:__ @macros\/reparse.h 126:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args1_funptr = unsafePerformIO hs_bindgen_3fd6d1fbd060ffcf
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args2@
+foreign import ccall unsafe "hs_bindgen_300abb7b10649797" hs_bindgen_300abb7b10649797_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args2@
+hs_bindgen_300abb7b10649797 :: IO (FunPtr (A ->
+                                           FunPtr (IO CInt) -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args2@
+hs_bindgen_300abb7b10649797 = fmap fromFFIType hs_bindgen_300abb7b10649797_base
+{-# NOINLINE funptr_args2_funptr #-}
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_funptr :: FunPtr (A -> FunPtr (IO CInt) -> IO ())
+{-| __C declaration:__ @funptr_args2@
+
+    __defined at:__ @macros\/reparse.h 127:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args2_funptr = unsafePerformIO hs_bindgen_300abb7b10649797
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args3@
+foreign import ccall unsafe "hs_bindgen_78d109e353e05225" hs_bindgen_78d109e353e05225_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args3@
+hs_bindgen_78d109e353e05225 :: IO (FunPtr (A ->
+                                           FunPtr (CInt -> IO ()) -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args3@
+hs_bindgen_78d109e353e05225 = fmap fromFFIType hs_bindgen_78d109e353e05225_base
+{-# NOINLINE funptr_args3_funptr #-}
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_funptr :: FunPtr (A ->
+                               FunPtr (CInt -> IO ()) -> IO ())
+{-| __C declaration:__ @funptr_args3@
+
+    __defined at:__ @macros\/reparse.h 128:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args3_funptr = unsafePerformIO hs_bindgen_78d109e353e05225
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args4@
+foreign import ccall unsafe "hs_bindgen_ee1815fa9e1c1131" hs_bindgen_ee1815fa9e1c1131_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args4@
+hs_bindgen_ee1815fa9e1c1131 :: IO (FunPtr (A ->
+                                           FunPtr (CInt -> CDouble -> IO CChar) -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args4@
+hs_bindgen_ee1815fa9e1c1131 = fmap fromFFIType hs_bindgen_ee1815fa9e1c1131_base
+{-# NOINLINE funptr_args4_funptr #-}
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_funptr :: FunPtr (A ->
+                               FunPtr (CInt -> CDouble -> IO CChar) -> IO ())
+{-| __C declaration:__ @funptr_args4@
+
+    __defined at:__ @macros\/reparse.h 129:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args4_funptr = unsafePerformIO hs_bindgen_ee1815fa9e1c1131
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args5@
+foreign import ccall unsafe "hs_bindgen_146c4cb7cf7def11" hs_bindgen_146c4cb7cf7def11_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args5@
+hs_bindgen_146c4cb7cf7def11 :: IO (FunPtr (A ->
+                                           FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_args5@
+hs_bindgen_146c4cb7cf7def11 = fmap fromFFIType hs_bindgen_146c4cb7cf7def11_base
+{-# NOINLINE funptr_args5_funptr #-}
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_funptr :: FunPtr (A ->
+                               FunPtr (CInt -> CDouble -> IO (Ptr CInt)) -> IO ())
+{-| __C declaration:__ @funptr_args5@
+
+    __defined at:__ @macros\/reparse.h 130:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_args5_funptr = unsafePerformIO hs_bindgen_146c4cb7cf7def11
+-- __unique:__ @test_macrosreparse_Example_get_comments1@
+foreign import ccall unsafe "hs_bindgen_7f647ffb81758d69" hs_bindgen_7f647ffb81758d69_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_comments1@
+hs_bindgen_7f647ffb81758d69 :: IO (FunPtr (A -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_comments1@
+hs_bindgen_7f647ffb81758d69 = fmap fromFFIType hs_bindgen_7f647ffb81758d69_base
+{-# NOINLINE comments1_funptr #-}
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_funptr :: FunPtr (A -> IO ())
+{-| Comments in awkward places
+
+    (Prior to language-c we failed to parse there.)
+
+    __C declaration:__ @comments1@
+
+    __defined at:__ @macros\/reparse.h 144:25@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+comments1_funptr = unsafePerformIO hs_bindgen_7f647ffb81758d69
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before1@
+foreign import ccall unsafe "hs_bindgen_ecf341da5dabe306" hs_bindgen_ecf341da5dabe306_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before1@
+hs_bindgen_ecf341da5dabe306 :: IO (FunPtr (A -> CChar -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before1@
+hs_bindgen_ecf341da5dabe306 = fmap fromFFIType hs_bindgen_ecf341da5dabe306_base
+{-# NOINLINE const_prim_before1_funptr #-}
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_funptr :: FunPtr (A -> CChar -> IO ())
+{-| @const@ qualifier
+
+    NOTE: These were not parsed correctly prior to the switch to language-c.
+
+    __C declaration:__ @const_prim_before1@
+
+    __defined at:__ @macros\/reparse.h 177:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before1_funptr = unsafePerformIO hs_bindgen_ecf341da5dabe306
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before2@
+foreign import ccall unsafe "hs_bindgen_a0276bc4dac995c4" hs_bindgen_a0276bc4dac995c4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before2@
+hs_bindgen_a0276bc4dac995c4 :: IO (FunPtr (A -> CSChar -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before2@
+hs_bindgen_a0276bc4dac995c4 = fmap fromFFIType hs_bindgen_a0276bc4dac995c4_base
+{-# NOINLINE const_prim_before2_funptr #-}
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_funptr :: FunPtr (A -> CSChar -> IO ())
+{-| __C declaration:__ @const_prim_before2@
+
+    __defined at:__ @macros\/reparse.h 178:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before2_funptr = unsafePerformIO hs_bindgen_a0276bc4dac995c4
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before3@
+foreign import ccall unsafe "hs_bindgen_1555fc380f4c34ba" hs_bindgen_1555fc380f4c34ba_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before3@
+hs_bindgen_1555fc380f4c34ba :: IO (FunPtr (A -> CUChar -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_before3@
+hs_bindgen_1555fc380f4c34ba = fmap fromFFIType hs_bindgen_1555fc380f4c34ba_base
+{-# NOINLINE const_prim_before3_funptr #-}
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_funptr :: FunPtr (A -> CUChar -> IO ())
+{-| __C declaration:__ @const_prim_before3@
+
+    __defined at:__ @macros\/reparse.h 179:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_before3_funptr = unsafePerformIO hs_bindgen_1555fc380f4c34ba
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after1@
+foreign import ccall unsafe "hs_bindgen_e88405f039754f3c" hs_bindgen_e88405f039754f3c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after1@
+hs_bindgen_e88405f039754f3c :: IO (FunPtr (A -> CChar -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after1@
+hs_bindgen_e88405f039754f3c = fmap fromFFIType hs_bindgen_e88405f039754f3c_base
+{-# NOINLINE const_prim_after1_funptr #-}
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_funptr :: FunPtr (A -> CChar -> IO ())
+{-| __C declaration:__ @const_prim_after1@
+
+    __defined at:__ @macros\/reparse.h 180:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after1_funptr = unsafePerformIO hs_bindgen_e88405f039754f3c
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after2@
+foreign import ccall unsafe "hs_bindgen_d267bc5333a36861" hs_bindgen_d267bc5333a36861_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after2@
+hs_bindgen_d267bc5333a36861 :: IO (FunPtr (A -> CSChar -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after2@
+hs_bindgen_d267bc5333a36861 = fmap fromFFIType hs_bindgen_d267bc5333a36861_base
+{-# NOINLINE const_prim_after2_funptr #-}
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_funptr :: FunPtr (A -> CSChar -> IO ())
+{-| __C declaration:__ @const_prim_after2@
+
+    __defined at:__ @macros\/reparse.h 181:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after2_funptr = unsafePerformIO hs_bindgen_d267bc5333a36861
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after3@
+foreign import ccall unsafe "hs_bindgen_0e08cac4148d54cd" hs_bindgen_0e08cac4148d54cd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after3@
+hs_bindgen_0e08cac4148d54cd :: IO (FunPtr (A -> CUChar -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_prim_after3@
+hs_bindgen_0e08cac4148d54cd = fmap fromFFIType hs_bindgen_0e08cac4148d54cd_base
+{-# NOINLINE const_prim_after3_funptr #-}
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_funptr :: FunPtr (A -> CUChar -> IO ())
+{-| __C declaration:__ @const_prim_after3@
+
+    __defined at:__ @macros\/reparse.h 182:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_prim_after3_funptr = unsafePerformIO hs_bindgen_0e08cac4148d54cd
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before1@
+foreign import ccall unsafe "hs_bindgen_d7140c03594ba60a" hs_bindgen_d7140c03594ba60a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before1@
+hs_bindgen_d7140c03594ba60a :: IO (FunPtr (A -> CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before1@
+hs_bindgen_d7140c03594ba60a = fmap fromFFIType hs_bindgen_d7140c03594ba60a_base
+{-# NOINLINE const_withoutSign_before1_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_funptr :: FunPtr (A -> CFloat -> IO ())
+{-| __C declaration:__ @const_withoutSign_before1@
+
+    __defined at:__ @macros\/reparse.h 186:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before1_funptr = unsafePerformIO hs_bindgen_d7140c03594ba60a
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before2@
+foreign import ccall unsafe "hs_bindgen_92134abe381cef04" hs_bindgen_92134abe381cef04_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before2@
+hs_bindgen_92134abe381cef04 :: IO (FunPtr (A -> CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before2@
+hs_bindgen_92134abe381cef04 = fmap fromFFIType hs_bindgen_92134abe381cef04_base
+{-# NOINLINE const_withoutSign_before2_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_funptr :: FunPtr (A -> CDouble -> IO ())
+{-| __C declaration:__ @const_withoutSign_before2@
+
+    __defined at:__ @macros\/reparse.h 187:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before2_funptr = unsafePerformIO hs_bindgen_92134abe381cef04
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before3@
+foreign import ccall unsafe "hs_bindgen_b80a2c12f1bdb050" hs_bindgen_b80a2c12f1bdb050_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before3@
+hs_bindgen_b80a2c12f1bdb050 :: IO (FunPtr (A -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before3@
+hs_bindgen_b80a2c12f1bdb050 = fmap fromFFIType hs_bindgen_b80a2c12f1bdb050_base
+{-# NOINLINE const_withoutSign_before3_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_funptr :: FunPtr (A -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_before3@
+
+    __defined at:__ @macros\/reparse.h 188:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before3_funptr = unsafePerformIO hs_bindgen_b80a2c12f1bdb050
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before4@
+foreign import ccall unsafe "hs_bindgen_aa0ffa330554de35" hs_bindgen_aa0ffa330554de35_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before4@
+hs_bindgen_aa0ffa330554de35 :: IO (FunPtr (A ->
+                                           Some_struct -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before4@
+hs_bindgen_aa0ffa330554de35 = fmap fromFFIType hs_bindgen_aa0ffa330554de35_base
+{-# NOINLINE const_withoutSign_before4_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_funptr :: FunPtr (A ->
+                                            Some_struct -> IO ())
+{-| __C declaration:__ @const_withoutSign_before4@
+
+    __defined at:__ @macros\/reparse.h 189:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before4_funptr = unsafePerformIO hs_bindgen_aa0ffa330554de35
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before5@
+foreign import ccall unsafe "hs_bindgen_f59abb8a7dffe11f" hs_bindgen_f59abb8a7dffe11f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before5@
+hs_bindgen_f59abb8a7dffe11f :: IO (FunPtr (A ->
+                                           Some_union -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before5@
+hs_bindgen_f59abb8a7dffe11f = fmap fromFFIType hs_bindgen_f59abb8a7dffe11f_base
+{-# NOINLINE const_withoutSign_before5_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_funptr :: FunPtr (A ->
+                                            Some_union -> IO ())
+{-| __C declaration:__ @const_withoutSign_before5@
+
+    __defined at:__ @macros\/reparse.h 190:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before5_funptr = unsafePerformIO hs_bindgen_f59abb8a7dffe11f
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before6@
+foreign import ccall unsafe "hs_bindgen_0df28ff2ac7fa1e0" hs_bindgen_0df28ff2ac7fa1e0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before6@
+hs_bindgen_0df28ff2ac7fa1e0 :: IO (FunPtr (A ->
+                                           Some_enum -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before6@
+hs_bindgen_0df28ff2ac7fa1e0 = fmap fromFFIType hs_bindgen_0df28ff2ac7fa1e0_base
+{-# NOINLINE const_withoutSign_before6_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_funptr :: FunPtr (A ->
+                                            Some_enum -> IO ())
+{-| __C declaration:__ @const_withoutSign_before6@
+
+    __defined at:__ @macros\/reparse.h 191:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before6_funptr = unsafePerformIO hs_bindgen_0df28ff2ac7fa1e0
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before7@
+foreign import ccall unsafe "hs_bindgen_fa8c89b169233a6a" hs_bindgen_fa8c89b169233a6a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before7@
+hs_bindgen_fa8c89b169233a6a :: IO (FunPtr (A -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before7@
+hs_bindgen_fa8c89b169233a6a = fmap fromFFIType hs_bindgen_fa8c89b169233a6a_base
+{-# NOINLINE const_withoutSign_before7_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_funptr :: FunPtr (A -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_before7@
+
+    __defined at:__ @macros\/reparse.h 192:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before7_funptr = unsafePerformIO hs_bindgen_fa8c89b169233a6a
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before8@
+foreign import ccall unsafe "hs_bindgen_e707228d3913a299" hs_bindgen_e707228d3913a299_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before8@
+hs_bindgen_e707228d3913a299 :: IO (FunPtr (A ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_before8@
+hs_bindgen_e707228d3913a299 = fmap fromFFIType hs_bindgen_e707228d3913a299_base
+{-# NOINLINE const_withoutSign_before8_funptr #-}
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_funptr :: FunPtr (A ->
+                                            HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| __C declaration:__ @const_withoutSign_before8@
+
+    __defined at:__ @macros\/reparse.h 193:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_before8_funptr = unsafePerformIO hs_bindgen_e707228d3913a299
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after1@
+foreign import ccall unsafe "hs_bindgen_7e7703a610cd6783" hs_bindgen_7e7703a610cd6783_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after1@
+hs_bindgen_7e7703a610cd6783 :: IO (FunPtr (A -> CFloat -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after1@
+hs_bindgen_7e7703a610cd6783 = fmap fromFFIType hs_bindgen_7e7703a610cd6783_base
+{-# NOINLINE const_withoutSign_after1_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_funptr :: FunPtr (A -> CFloat -> IO ())
+{-| __C declaration:__ @const_withoutSign_after1@
+
+    __defined at:__ @macros\/reparse.h 195:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after1_funptr = unsafePerformIO hs_bindgen_7e7703a610cd6783
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after2@
+foreign import ccall unsafe "hs_bindgen_988863a241cb28f2" hs_bindgen_988863a241cb28f2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after2@
+hs_bindgen_988863a241cb28f2 :: IO (FunPtr (A -> CDouble -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after2@
+hs_bindgen_988863a241cb28f2 = fmap fromFFIType hs_bindgen_988863a241cb28f2_base
+{-# NOINLINE const_withoutSign_after2_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_funptr :: FunPtr (A -> CDouble -> IO ())
+{-| __C declaration:__ @const_withoutSign_after2@
+
+    __defined at:__ @macros\/reparse.h 196:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after2_funptr = unsafePerformIO hs_bindgen_988863a241cb28f2
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after3@
+foreign import ccall unsafe "hs_bindgen_c8182ee9a3467005" hs_bindgen_c8182ee9a3467005_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after3@
+hs_bindgen_c8182ee9a3467005 :: IO (FunPtr (A -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after3@
+hs_bindgen_c8182ee9a3467005 = fmap fromFFIType hs_bindgen_c8182ee9a3467005_base
+{-# NOINLINE const_withoutSign_after3_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_funptr :: FunPtr (A -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_after3@
+
+    __defined at:__ @macros\/reparse.h 197:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after3_funptr = unsafePerformIO hs_bindgen_c8182ee9a3467005
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after4@
+foreign import ccall unsafe "hs_bindgen_de1e4bbac808bcbc" hs_bindgen_de1e4bbac808bcbc_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after4@
+hs_bindgen_de1e4bbac808bcbc :: IO (FunPtr (A ->
+                                           Some_struct -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after4@
+hs_bindgen_de1e4bbac808bcbc = fmap fromFFIType hs_bindgen_de1e4bbac808bcbc_base
+{-# NOINLINE const_withoutSign_after4_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_funptr :: FunPtr (A ->
+                                           Some_struct -> IO ())
+{-| __C declaration:__ @const_withoutSign_after4@
+
+    __defined at:__ @macros\/reparse.h 198:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after4_funptr = unsafePerformIO hs_bindgen_de1e4bbac808bcbc
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after5@
+foreign import ccall unsafe "hs_bindgen_746fb03c27f16031" hs_bindgen_746fb03c27f16031_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after5@
+hs_bindgen_746fb03c27f16031 :: IO (FunPtr (A ->
+                                           Some_union -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after5@
+hs_bindgen_746fb03c27f16031 = fmap fromFFIType hs_bindgen_746fb03c27f16031_base
+{-# NOINLINE const_withoutSign_after5_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_funptr :: FunPtr (A ->
+                                           Some_union -> IO ())
+{-| __C declaration:__ @const_withoutSign_after5@
+
+    __defined at:__ @macros\/reparse.h 199:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after5_funptr = unsafePerformIO hs_bindgen_746fb03c27f16031
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after6@
+foreign import ccall unsafe "hs_bindgen_dc174ac598e92a95" hs_bindgen_dc174ac598e92a95_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after6@
+hs_bindgen_dc174ac598e92a95 :: IO (FunPtr (A ->
+                                           Some_enum -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after6@
+hs_bindgen_dc174ac598e92a95 = fmap fromFFIType hs_bindgen_dc174ac598e92a95_base
+{-# NOINLINE const_withoutSign_after6_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_funptr :: FunPtr (A -> Some_enum -> IO ())
+{-| __C declaration:__ @const_withoutSign_after6@
+
+    __defined at:__ @macros\/reparse.h 200:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after6_funptr = unsafePerformIO hs_bindgen_dc174ac598e92a95
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after7@
+foreign import ccall unsafe "hs_bindgen_2c8ddc46cb100dd9" hs_bindgen_2c8ddc46cb100dd9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after7@
+hs_bindgen_2c8ddc46cb100dd9 :: IO (FunPtr (A -> CBool -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after7@
+hs_bindgen_2c8ddc46cb100dd9 = fmap fromFFIType hs_bindgen_2c8ddc46cb100dd9_base
+{-# NOINLINE const_withoutSign_after7_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_funptr :: FunPtr (A -> CBool -> IO ())
+{-| __C declaration:__ @const_withoutSign_after7@
+
+    __defined at:__ @macros\/reparse.h 201:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after7_funptr = unsafePerformIO hs_bindgen_2c8ddc46cb100dd9
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after8@
+foreign import ccall unsafe "hs_bindgen_fdf87fbad31246de" hs_bindgen_fdf87fbad31246de_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after8@
+hs_bindgen_fdf87fbad31246de :: IO (FunPtr (A ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_withoutSign_after8@
+hs_bindgen_fdf87fbad31246de = fmap fromFFIType hs_bindgen_fdf87fbad31246de_base
+{-# NOINLINE const_withoutSign_after8_funptr #-}
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_funptr :: FunPtr (A ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO ())
+{-| __C declaration:__ @const_withoutSign_after8@
+
+    __defined at:__ @macros\/reparse.h 202:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_withoutSign_after8_funptr = unsafePerformIO hs_bindgen_fdf87fbad31246de
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args1@
+foreign import ccall unsafe "hs_bindgen_38808e8aa92d3bcb" hs_bindgen_38808e8aa92d3bcb_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args1@
+hs_bindgen_38808e8aa92d3bcb :: IO (FunPtr (A ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args1@
+hs_bindgen_38808e8aa92d3bcb = fmap fromFFIType hs_bindgen_38808e8aa92d3bcb_base
+{-# NOINLINE const_pointers_args1_funptr #-}
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_funptr :: FunPtr (A -> PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args1@
+
+    __defined at:__ @macros\/reparse.h 206:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args1_funptr = unsafePerformIO hs_bindgen_38808e8aa92d3bcb
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args2@
+foreign import ccall unsafe "hs_bindgen_4d37887fd82ab559" hs_bindgen_4d37887fd82ab559_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args2@
+hs_bindgen_4d37887fd82ab559 :: IO (FunPtr (A ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args2@
+hs_bindgen_4d37887fd82ab559 = fmap fromFFIType hs_bindgen_4d37887fd82ab559_base
+{-# NOINLINE const_pointers_args2_funptr #-}
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_funptr :: FunPtr (A -> PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args2@
+
+    __defined at:__ @macros\/reparse.h 207:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args2_funptr = unsafePerformIO hs_bindgen_4d37887fd82ab559
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args3@
+foreign import ccall unsafe "hs_bindgen_fd675a45f1682dd5" hs_bindgen_fd675a45f1682dd5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args3@
+hs_bindgen_fd675a45f1682dd5 :: IO (FunPtr (A -> Ptr CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args3@
+hs_bindgen_fd675a45f1682dd5 = fmap fromFFIType hs_bindgen_fd675a45f1682dd5_base
+{-# NOINLINE const_pointers_args3_funptr #-}
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_funptr :: FunPtr (A -> Ptr CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args3@
+
+    __defined at:__ @macros\/reparse.h 208:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args3_funptr = unsafePerformIO hs_bindgen_fd675a45f1682dd5
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args4@
+foreign import ccall unsafe "hs_bindgen_824cb2084c63b803" hs_bindgen_824cb2084c63b803_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args4@
+hs_bindgen_824cb2084c63b803 :: IO (FunPtr (A ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args4@
+hs_bindgen_824cb2084c63b803 = fmap fromFFIType hs_bindgen_824cb2084c63b803_base
+{-# NOINLINE const_pointers_args4_funptr #-}
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_funptr :: FunPtr (A -> PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args4@
+
+    __defined at:__ @macros\/reparse.h 209:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args4_funptr = unsafePerformIO hs_bindgen_824cb2084c63b803
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args5@
+foreign import ccall unsafe "hs_bindgen_25bdd13aed8f26c4" hs_bindgen_25bdd13aed8f26c4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args5@
+hs_bindgen_25bdd13aed8f26c4 :: IO (FunPtr (A ->
+                                           PtrConst CInt -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_args5@
+hs_bindgen_25bdd13aed8f26c4 = fmap fromFFIType hs_bindgen_25bdd13aed8f26c4_base
+{-# NOINLINE const_pointers_args5_funptr #-}
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_funptr :: FunPtr (A -> PtrConst CInt -> IO ())
+{-| __C declaration:__ @const_pointers_args5@
+
+    __defined at:__ @macros\/reparse.h 210:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_args5_funptr = unsafePerformIO hs_bindgen_25bdd13aed8f26c4
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret1@
+foreign import ccall unsafe "hs_bindgen_f494124b53592961" hs_bindgen_f494124b53592961_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret1@
+hs_bindgen_f494124b53592961 :: IO (FunPtr (A ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret1@
+hs_bindgen_f494124b53592961 = fmap fromFFIType hs_bindgen_f494124b53592961_base
+{-# NOINLINE const_pointers_ret1_funptr #-}
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_funptr :: FunPtr (A -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret1@
+
+    __defined at:__ @macros\/reparse.h 212:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret1_funptr = unsafePerformIO hs_bindgen_f494124b53592961
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret2@
+foreign import ccall unsafe "hs_bindgen_32c4b858ef4f3bb8" hs_bindgen_32c4b858ef4f3bb8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret2@
+hs_bindgen_32c4b858ef4f3bb8 :: IO (FunPtr (A ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret2@
+hs_bindgen_32c4b858ef4f3bb8 = fmap fromFFIType hs_bindgen_32c4b858ef4f3bb8_base
+{-# NOINLINE const_pointers_ret2_funptr #-}
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_funptr :: FunPtr (A -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret2@
+
+    __defined at:__ @macros\/reparse.h 213:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret2_funptr = unsafePerformIO hs_bindgen_32c4b858ef4f3bb8
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret3@
+foreign import ccall unsafe "hs_bindgen_110afe05c6d47b7c" hs_bindgen_110afe05c6d47b7c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret3@
+hs_bindgen_110afe05c6d47b7c :: IO (FunPtr (A -> IO (Ptr CInt)))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret3@
+hs_bindgen_110afe05c6d47b7c = fmap fromFFIType hs_bindgen_110afe05c6d47b7c_base
+{-# NOINLINE const_pointers_ret3_funptr #-}
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_funptr :: FunPtr (A -> IO (Ptr CInt))
+{-| __C declaration:__ @const_pointers_ret3@
+
+    __defined at:__ @macros\/reparse.h 214:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret3_funptr = unsafePerformIO hs_bindgen_110afe05c6d47b7c
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret4@
+foreign import ccall unsafe "hs_bindgen_042a426acfeaa051" hs_bindgen_042a426acfeaa051_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret4@
+hs_bindgen_042a426acfeaa051 :: IO (FunPtr (A ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret4@
+hs_bindgen_042a426acfeaa051 = fmap fromFFIType hs_bindgen_042a426acfeaa051_base
+{-# NOINLINE const_pointers_ret4_funptr #-}
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_funptr :: FunPtr (A -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret4@
+
+    __defined at:__ @macros\/reparse.h 215:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret4_funptr = unsafePerformIO hs_bindgen_042a426acfeaa051
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret5@
+foreign import ccall unsafe "hs_bindgen_bc3cdc03ae3274bd" hs_bindgen_bc3cdc03ae3274bd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret5@
+hs_bindgen_bc3cdc03ae3274bd :: IO (FunPtr (A ->
+                                           IO (PtrConst CInt)))
+-- __unique:__ @test_macrosreparse_Example_get_const_pointers_ret5@
+hs_bindgen_bc3cdc03ae3274bd = fmap fromFFIType hs_bindgen_bc3cdc03ae3274bd_base
+{-# NOINLINE const_pointers_ret5_funptr #-}
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_funptr :: FunPtr (A -> IO (PtrConst CInt))
+{-| __C declaration:__ @const_pointers_ret5@
+
+    __defined at:__ @macros\/reparse.h 216:19@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_pointers_ret5_funptr = unsafePerformIO hs_bindgen_bc3cdc03ae3274bd
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem1@
+foreign import ccall unsafe "hs_bindgen_ae95c15a81eacd52" hs_bindgen_ae95c15a81eacd52_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem1@
+hs_bindgen_ae95c15a81eacd52 :: IO (FunPtr (PtrConst (Elem (IncompleteArray A)) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem1@
+hs_bindgen_ae95c15a81eacd52 = fmap fromFFIType hs_bindgen_ae95c15a81eacd52_base
+{-# NOINLINE const_array_elem1_funptr #-}
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_funptr :: FunPtr (PtrConst (Elem (IncompleteArray A)) ->
+                                    IO ())
+{-| __C declaration:__ @const_array_elem1@
+
+    __defined at:__ @macros\/reparse.h 244:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem1_funptr = unsafePerformIO hs_bindgen_ae95c15a81eacd52
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem2@
+foreign import ccall unsafe "hs_bindgen_9dbbae3758752935" hs_bindgen_9dbbae3758752935_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem2@
+hs_bindgen_9dbbae3758752935 :: IO (FunPtr (Ptr (Elem (IncompleteArray (PtrConst A))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem2@
+hs_bindgen_9dbbae3758752935 = fmap fromFFIType hs_bindgen_9dbbae3758752935_base
+{-# NOINLINE const_array_elem2_funptr #-}
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_funptr :: FunPtr (Ptr (Elem (IncompleteArray (PtrConst A))) ->
+                                    IO ())
+{-| __C declaration:__ @const_array_elem2@
+
+    __defined at:__ @macros\/reparse.h 245:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem2_funptr = unsafePerformIO hs_bindgen_9dbbae3758752935
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem3@
+foreign import ccall unsafe "hs_bindgen_9fdb904f0c0776ed" hs_bindgen_9fdb904f0c0776ed_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem3@
+hs_bindgen_9fdb904f0c0776ed :: IO (FunPtr (PtrConst (Elem (IncompleteArray (Ptr A))) ->
+                                           IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_const_array_elem3@
+hs_bindgen_9fdb904f0c0776ed = fmap fromFFIType hs_bindgen_9fdb904f0c0776ed_base
+{-# NOINLINE const_array_elem3_funptr #-}
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_funptr :: FunPtr (PtrConst (Elem (IncompleteArray (Ptr A))) ->
+                                    IO ())
+{-| __C declaration:__ @const_array_elem3@
+
+    __defined at:__ @macros\/reparse.h 246:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+const_array_elem3_funptr = unsafePerformIO hs_bindgen_9fdb904f0c0776ed
+-- __unique:__ @test_macrosreparse_Example_get_noParams1@
+foreign import ccall unsafe "hs_bindgen_cd9806a214acd0fa" hs_bindgen_cd9806a214acd0fa_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_noParams1@
+hs_bindgen_cd9806a214acd0fa :: IO (FunPtr (IO A))
+-- __unique:__ @test_macrosreparse_Example_get_noParams1@
+hs_bindgen_cd9806a214acd0fa = fmap fromFFIType hs_bindgen_cd9806a214acd0fa_base
+{-# NOINLINE noParams1_funptr #-}
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_funptr :: FunPtr (IO A)
+{-| Other examples we reparsed /incorrectly/ before language-c
+
+    __C declaration:__ @noParams1@
+
+    __defined at:__ @macros\/reparse.h 254:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams1_funptr = unsafePerformIO hs_bindgen_cd9806a214acd0fa
+-- __unique:__ @test_macrosreparse_Example_get_noParams2@
+foreign import ccall unsafe "hs_bindgen_7c7bf9b5a41ea4a9" hs_bindgen_7c7bf9b5a41ea4a9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_noParams2@
+hs_bindgen_7c7bf9b5a41ea4a9 :: IO (FunPtr (IO A))
+-- __unique:__ @test_macrosreparse_Example_get_noParams2@
+hs_bindgen_7c7bf9b5a41ea4a9 = fmap fromFFIType hs_bindgen_7c7bf9b5a41ea4a9_base
+{-# NOINLINE noParams2_funptr #-}
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_funptr :: FunPtr (IO A)
+{-| __C declaration:__ @noParams2@
+
+    __defined at:__ @macros\/reparse.h 255:3@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams2_funptr = unsafePerformIO hs_bindgen_7c7bf9b5a41ea4a9
+-- __unique:__ @test_macrosreparse_Example_get_noParams3@
+foreign import ccall unsafe "hs_bindgen_7f154653725d104d" hs_bindgen_7f154653725d104d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_noParams3@
+hs_bindgen_7f154653725d104d :: IO (FunPtr (A ->
+                                           FunPtr (IO CInt) -> IO ()))
+-- __unique:__ @test_macrosreparse_Example_get_noParams3@
+hs_bindgen_7f154653725d104d = fmap fromFFIType hs_bindgen_7f154653725d104d_base
+{-# NOINLINE noParams3_funptr #-}
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_funptr :: FunPtr (A -> FunPtr (IO CInt) -> IO ())
+{-| __C declaration:__ @noParams3@
+
+    __defined at:__ @macros\/reparse.h 256:6@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+noParams3_funptr = unsafePerformIO hs_bindgen_7f154653725d104d
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret1@
+foreign import ccall unsafe "hs_bindgen_4460dd1d93c2df6f" hs_bindgen_4460dd1d93c2df6f_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret1@
+hs_bindgen_4460dd1d93c2df6f :: IO (FunPtr (A ->
+                                           IO (FunPtr (IO ()))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret1@
+hs_bindgen_4460dd1d93c2df6f = fmap fromFFIType hs_bindgen_4460dd1d93c2df6f_base
+{-# NOINLINE funptr_ret1_funptr #-}
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_funptr :: FunPtr (A -> IO (FunPtr (IO ())))
+{-| __C declaration:__ @funptr_ret1@
+
+    __defined at:__ @macros\/reparse.h 260:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret1_funptr = unsafePerformIO hs_bindgen_4460dd1d93c2df6f
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret2@
+foreign import ccall unsafe "hs_bindgen_2b8d04e0fe71178b" hs_bindgen_2b8d04e0fe71178b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret2@
+hs_bindgen_2b8d04e0fe71178b :: IO (FunPtr (A ->
+                                           IO (FunPtr (IO CInt))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret2@
+hs_bindgen_2b8d04e0fe71178b = fmap fromFFIType hs_bindgen_2b8d04e0fe71178b_base
+{-# NOINLINE funptr_ret2_funptr #-}
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_funptr :: FunPtr (A -> IO (FunPtr (IO CInt)))
+{-| __C declaration:__ @funptr_ret2@
+
+    __defined at:__ @macros\/reparse.h 261:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret2_funptr = unsafePerformIO hs_bindgen_2b8d04e0fe71178b
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret3@
+foreign import ccall unsafe "hs_bindgen_27d05f98fe1e869b" hs_bindgen_27d05f98fe1e869b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret3@
+hs_bindgen_27d05f98fe1e869b :: IO (FunPtr (A ->
+                                           IO (FunPtr (CInt -> IO ()))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret3@
+hs_bindgen_27d05f98fe1e869b = fmap fromFFIType hs_bindgen_27d05f98fe1e869b_base
+{-# NOINLINE funptr_ret3_funptr #-}
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_funptr :: FunPtr (A -> IO (FunPtr (CInt -> IO ())))
+{-| __C declaration:__ @funptr_ret3@
+
+    __defined at:__ @macros\/reparse.h 262:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret3_funptr = unsafePerformIO hs_bindgen_27d05f98fe1e869b
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret4@
+foreign import ccall unsafe "hs_bindgen_f55fb889881240c6" hs_bindgen_f55fb889881240c6_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret4@
+hs_bindgen_f55fb889881240c6 :: IO (FunPtr (A ->
+                                           IO (FunPtr (CInt -> CDouble -> IO CChar))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret4@
+hs_bindgen_f55fb889881240c6 = fmap fromFFIType hs_bindgen_f55fb889881240c6_base
+{-# NOINLINE funptr_ret4_funptr #-}
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_funptr :: FunPtr (A ->
+                              IO (FunPtr (CInt -> CDouble -> IO CChar)))
+{-| __C declaration:__ @funptr_ret4@
+
+    __defined at:__ @macros\/reparse.h 263:8@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret4_funptr = unsafePerformIO hs_bindgen_f55fb889881240c6
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret5@
+foreign import ccall unsafe "hs_bindgen_e59cbfc52cec7177" hs_bindgen_e59cbfc52cec7177_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret5@
+hs_bindgen_e59cbfc52cec7177 :: IO (FunPtr (A ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret5@
+hs_bindgen_e59cbfc52cec7177 = fmap fromFFIType hs_bindgen_e59cbfc52cec7177_base
+{-# NOINLINE funptr_ret5_funptr #-}
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_funptr :: FunPtr (A ->
+                              IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt))))
+{-| __C declaration:__ @funptr_ret5@
+
+    __defined at:__ @macros\/reparse.h 267:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret5_funptr = unsafePerformIO hs_bindgen_e59cbfc52cec7177
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret6@
+foreign import ccall unsafe "hs_bindgen_f94486b884c7cd44" hs_bindgen_f94486b884c7cd44_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret6@
+hs_bindgen_f94486b884c7cd44 :: IO (FunPtr (A ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret6@
+hs_bindgen_f94486b884c7cd44 = fmap fromFFIType hs_bindgen_f94486b884c7cd44_base
+{-# NOINLINE funptr_ret6_funptr #-}
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_funptr :: FunPtr (A ->
+                              IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret6@
+
+    __defined at:__ @macros\/reparse.h 268:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret6_funptr = unsafePerformIO hs_bindgen_f94486b884c7cd44
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret7@
+foreign import ccall unsafe "hs_bindgen_7810d75b42b3bed8" hs_bindgen_7810d75b42b3bed8_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret7@
+hs_bindgen_7810d75b42b3bed8 :: IO (FunPtr (A ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret7@
+hs_bindgen_7810d75b42b3bed8 = fmap fromFFIType hs_bindgen_7810d75b42b3bed8_base
+{-# NOINLINE funptr_ret7_funptr #-}
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_funptr :: FunPtr (A ->
+                              IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret7@
+
+    __defined at:__ @macros\/reparse.h 269:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret7_funptr = unsafePerformIO hs_bindgen_7810d75b42b3bed8
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret8@
+foreign import ccall unsafe "hs_bindgen_fc12014317abd6b4" hs_bindgen_fc12014317abd6b4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret8@
+hs_bindgen_fc12014317abd6b4 :: IO (FunPtr (A ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt)))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret8@
+hs_bindgen_fc12014317abd6b4 = fmap fromFFIType hs_bindgen_fc12014317abd6b4_base
+{-# NOINLINE funptr_ret8_funptr #-}
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_funptr :: FunPtr (A ->
+                              IO (FunPtr (CInt -> CDouble -> IO (Ptr CInt))))
+{-| __C declaration:__ @funptr_ret8@
+
+    __defined at:__ @macros\/reparse.h 270:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret8_funptr = unsafePerformIO hs_bindgen_fc12014317abd6b4
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret9@
+foreign import ccall unsafe "hs_bindgen_cf3bf1d8470acad4" hs_bindgen_cf3bf1d8470acad4_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret9@
+hs_bindgen_cf3bf1d8470acad4 :: IO (FunPtr (A ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret9@
+hs_bindgen_cf3bf1d8470acad4 = fmap fromFFIType hs_bindgen_cf3bf1d8470acad4_base
+{-# NOINLINE funptr_ret9_funptr #-}
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_funptr :: FunPtr (A ->
+                              IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret9@
+
+    __defined at:__ @macros\/reparse.h 271:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret9_funptr = unsafePerformIO hs_bindgen_cf3bf1d8470acad4
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret10@
+foreign import ccall unsafe "hs_bindgen_44a7eb47cf87f092" hs_bindgen_44a7eb47cf87f092_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret10@
+hs_bindgen_44a7eb47cf87f092 :: IO (FunPtr (A ->
+                                           IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt)))))
+-- __unique:__ @test_macrosreparse_Example_get_funptr_ret10@
+hs_bindgen_44a7eb47cf87f092 = fmap fromFFIType hs_bindgen_44a7eb47cf87f092_base
+{-# NOINLINE funptr_ret10_funptr #-}
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_funptr :: FunPtr (A ->
+                               IO (FunPtr (CInt -> CDouble -> IO (PtrConst CInt))))
+{-| __C declaration:__ @funptr_ret10@
+
+    __defined at:__ @macros\/reparse.h 272:20@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+funptr_ret10_funptr = unsafePerformIO hs_bindgen_44a7eb47cf87f092
+-- __unique:__ @test_macrosreparse_Example_get_global1@
+foreign import ccall unsafe "hs_bindgen_feda7c77651645fe" hs_bindgen_feda7c77651645fe_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_get_global1@
+hs_bindgen_feda7c77651645fe :: IO (Ptr A)
+-- __unique:__ @test_macrosreparse_Example_get_global1@
+hs_bindgen_feda7c77651645fe = fmap fromFFIType hs_bindgen_feda7c77651645fe_base
+{-# NOINLINE global1 #-}
+{-| Globals and constants
+
+    __C declaration:__ @global1@
+
+    __defined at:__ @macros\/reparse.h 161:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global1 :: Ptr A
+{-| Globals and constants
+
+    __C declaration:__ @global1@
+
+    __defined at:__ @macros\/reparse.h 161:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global1 = unsafePerformIO hs_bindgen_feda7c77651645fe
+-- __unique:__ @test_macrosreparse_Example_get_global2@
+foreign import ccall unsafe "hs_bindgen_61b4abc5e1afa043" hs_bindgen_61b4abc5e1afa043_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_get_global2@
+hs_bindgen_61b4abc5e1afa043 :: IO (Ptr (Ptr A))
+-- __unique:__ @test_macrosreparse_Example_get_global2@
+hs_bindgen_61b4abc5e1afa043 = fmap fromFFIType hs_bindgen_61b4abc5e1afa043_base
+{-# NOINLINE global2 #-}
+{-| __C declaration:__ @global2@
+
+    __defined at:__ @macros\/reparse.h 162:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global2 :: Ptr (Ptr A)
+{-| __C declaration:__ @global2@
+
+    __defined at:__ @macros\/reparse.h 162:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global2 = unsafePerformIO hs_bindgen_61b4abc5e1afa043
+-- __unique:__ @test_macrosreparse_Example_get_global3@
+foreign import ccall unsafe "hs_bindgen_f9bcb9580741dbc1" hs_bindgen_f9bcb9580741dbc1_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_get_global3@
+hs_bindgen_f9bcb9580741dbc1 :: IO (Ptr (Ptr (Ptr A)))
+-- __unique:__ @test_macrosreparse_Example_get_global3@
+hs_bindgen_f9bcb9580741dbc1 = fmap fromFFIType hs_bindgen_f9bcb9580741dbc1_base
+{-# NOINLINE global3 #-}
+{-| __C declaration:__ @global3@
+
+    __defined at:__ @macros\/reparse.h 163:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global3 :: Ptr (Ptr (Ptr A))
+{-| __C declaration:__ @global3@
+
+    __defined at:__ @macros\/reparse.h 163:13@
+
+    __exported by:__ @macros\/reparse.h@
+-}
+global3 = unsafePerformIO hs_bindgen_f9bcb9580741dbc1
+-- __unique:__ @test_macrosreparse_Example_get_const1@
+foreign import ccall unsafe "hs_bindgen_044004234e2019f6" hs_bindgen_044004234e2019f6_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const1@
+hs_bindgen_044004234e2019f6 :: IO (PtrConst A)
+-- __unique:__ @test_macrosreparse_Example_get_const1@
+hs_bindgen_044004234e2019f6 = fmap fromFFIType hs_bindgen_044004234e2019f6_base
+{-# NOINLINE hs_bindgen_f883e611325aa029 #-}
+{-| __C declaration:__ @const1@
+
+    __defined at:__ @macros\/reparse.h 165:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_Example_const1@
+-}
+hs_bindgen_f883e611325aa029 :: PtrConst A
+{-| __C declaration:__ @const1@
+
+    __defined at:__ @macros\/reparse.h 165:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_Example_const1@
+-}
+hs_bindgen_f883e611325aa029 = unsafePerformIO hs_bindgen_044004234e2019f6
+{-# NOINLINE const1 #-}
+const1 :: A
+const1 = unsafePerformIO (peek hs_bindgen_f883e611325aa029)
+-- __unique:__ @test_macrosreparse_Example_get_const2@
+foreign import ccall unsafe "hs_bindgen_6c69b6e35fe122c5" hs_bindgen_6c69b6e35fe122c5_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const2@
+hs_bindgen_6c69b6e35fe122c5 :: IO (PtrConst (Ptr A))
+-- __unique:__ @test_macrosreparse_Example_get_const2@
+hs_bindgen_6c69b6e35fe122c5 = fmap fromFFIType hs_bindgen_6c69b6e35fe122c5_base
+{-# NOINLINE hs_bindgen_4a0e98a60a6414ee #-}
+{-| __C declaration:__ @const2@
+
+    __defined at:__ @macros\/reparse.h 166:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_Example_const2@
+-}
+hs_bindgen_4a0e98a60a6414ee :: PtrConst (Ptr A)
+{-| __C declaration:__ @const2@
+
+    __defined at:__ @macros\/reparse.h 166:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_Example_const2@
+-}
+hs_bindgen_4a0e98a60a6414ee = unsafePerformIO hs_bindgen_6c69b6e35fe122c5
+{-# NOINLINE const2 #-}
+const2 :: Ptr A
+const2 = unsafePerformIO (peek hs_bindgen_4a0e98a60a6414ee)
+-- __unique:__ @test_macrosreparse_Example_get_const3@
+foreign import ccall unsafe "hs_bindgen_da21ad94b09d46ae" hs_bindgen_da21ad94b09d46ae_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_macrosreparse_Example_get_const3@
+hs_bindgen_da21ad94b09d46ae :: IO (PtrConst (Ptr (Ptr A)))
+-- __unique:__ @test_macrosreparse_Example_get_const3@
+hs_bindgen_da21ad94b09d46ae = fmap fromFFIType hs_bindgen_da21ad94b09d46ae_base
+{-# NOINLINE hs_bindgen_0d6ba48ba79ada14 #-}
+{-| __C declaration:__ @const3@
+
+    __defined at:__ @macros\/reparse.h 167:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_Example_const3@
+-}
+hs_bindgen_0d6ba48ba79ada14 :: PtrConst (Ptr (Ptr A))
+{-| __C declaration:__ @const3@
+
+    __defined at:__ @macros\/reparse.h 167:19@
+
+    __exported by:__ @macros\/reparse.h@
+
+    __unique:__ @test_macrosreparse_Example_const3@
+-}
+hs_bindgen_0d6ba48ba79ada14 = unsafePerformIO hs_bindgen_da21ad94b09d46ae
+{-# NOINLINE const3 #-}
+const3 :: Ptr (Ptr A)
+const3 = unsafePerformIO (peek hs_bindgen_0d6ba48ba79ada14)
diff --git a/test-artefacts/fixtures/macros/undef.1.empty/Example/FunPtr.hs b/test-artefacts/fixtures/macros/undef.1.empty/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.1.empty/Example/FunPtr.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/undef.h>"
+  , "/* test_macrosundef_1_empty_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_517f6ccac933b5bc (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosundef_1_empty_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_517f6ccac933b5bc" hs_bindgen_517f6ccac933b5bc_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosundef_1_empty_Example_get_foo@
+hs_bindgen_517f6ccac933b5bc :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_517f6ccac933b5bc =
+  fmap BG.fromFFIType hs_bindgen_517f6ccac933b5bc_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_517f6ccac933b5bc
diff --git a/test-artefacts/fixtures/macros/undef.1.empty/Example/Safe.hs b/test-artefacts/fixtures/macros/undef.1.empty/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.1.empty/Example/Safe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/undef.h>"
+  , "void hs_bindgen_9537cfc61fc6a78a ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosundef_1_empty_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9537cfc61fc6a78a" hs_bindgen_9537cfc61fc6a78a_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosundef_1_empty_Example_Safe_foo@
+hs_bindgen_9537cfc61fc6a78a ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_9537cfc61fc6a78a =
+  \x0 ->
+    hs_bindgen_9537cfc61fc6a78a_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_9537cfc61fc6a78a
diff --git a/test-artefacts/fixtures/macros/undef.1.empty/Example/Unsafe.hs b/test-artefacts/fixtures/macros/undef.1.empty/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.1.empty/Example/Unsafe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/undef.h>"
+  , "void hs_bindgen_e7a8db67218e71f8 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosundef_1_empty_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_e7a8db67218e71f8" hs_bindgen_e7a8db67218e71f8_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosundef_1_empty_Example_Unsafe_foo@
+hs_bindgen_e7a8db67218e71f8 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_e7a8db67218e71f8 =
+  \x0 ->
+    hs_bindgen_e7a8db67218e71f8_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_e7a8db67218e71f8
diff --git a/test-artefacts/fixtures/macros/undef.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/undef.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.1.empty/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/undef.1.empty/th.txt b/test-artefacts/fixtures/macros/undef.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.1.empty/th.txt
@@ -0,0 +1,88 @@
+-- addDependentFile test-artefacts/headers/golden/macros/undef.h
+-- #include <macros/undef.h>
+-- void hs_bindgen_9537cfc61fc6a78a (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_e7a8db67218e71f8 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- /* test_macrosundef_1_empty_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_517f6ccac933b5bc (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- __unique:__ @test_macrosundef_1_empty_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_9537cfc61fc6a78a" hs_bindgen_9537cfc61fc6a78a_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosundef_1_empty_Example_Safe_foo@
+hs_bindgen_9537cfc61fc6a78a :: CInt -> IO ()
+-- __unique:__ @test_macrosundef_1_empty_Example_Safe_foo@
+hs_bindgen_9537cfc61fc6a78a = \x_0 -> hs_bindgen_9537cfc61fc6a78a_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_safe = hs_bindgen_9537cfc61fc6a78a
+-- __unique:__ @test_macrosundef_1_empty_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_e7a8db67218e71f8" hs_bindgen_e7a8db67218e71f8_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosundef_1_empty_Example_Unsafe_foo@
+hs_bindgen_e7a8db67218e71f8 :: CInt -> IO ()
+-- __unique:__ @test_macrosundef_1_empty_Example_Unsafe_foo@
+hs_bindgen_e7a8db67218e71f8 = \x_0 -> hs_bindgen_e7a8db67218e71f8_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_unsafe = hs_bindgen_e7a8db67218e71f8
+-- __unique:__ @test_macrosundef_1_empty_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_517f6ccac933b5bc" hs_bindgen_517f6ccac933b5bc_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosundef_1_empty_Example_get_foo@
+hs_bindgen_517f6ccac933b5bc :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosundef_1_empty_Example_get_foo@
+hs_bindgen_517f6ccac933b5bc = fmap fromFFIType hs_bindgen_517f6ccac933b5bc_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_517f6ccac933b5bc
diff --git a/test-artefacts/fixtures/macros/undef.2.raw/Example.hs b/test-artefacts/fixtures/macros/undef.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.2.raw/Example.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+module Example
+    ( Example.t
+    )
+  where
+
+import qualified HsBindgen.Runtime.Macro as Macro
+import Prelude (String)
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/undef.h 3:9@
+
+    __exported by:__ @macros\/undef.h@
+-}
+t :: Macro.Raw String
+t = Macro.objectLike "T" ["int"]
diff --git a/test-artefacts/fixtures/macros/undef.2.raw/Example/FunPtr.hs b/test-artefacts/fixtures/macros/undef.2.raw/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.2.raw/Example/FunPtr.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/undef.h>"
+  , "/* test_macrosundef_2_raw_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_df59e9a307a33580 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosundef_2_raw_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_df59e9a307a33580" hs_bindgen_df59e9a307a33580_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosundef_2_raw_Example_get_foo@
+hs_bindgen_df59e9a307a33580 :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_df59e9a307a33580 =
+  fmap BG.fromFFIType hs_bindgen_df59e9a307a33580_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo :: BG.FunPtr (BG.CInt -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_df59e9a307a33580
diff --git a/test-artefacts/fixtures/macros/undef.2.raw/Example/Safe.hs b/test-artefacts/fixtures/macros/undef.2.raw/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.2.raw/Example/Safe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/undef.h>"
+  , "void hs_bindgen_21a957e75025b18b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosundef_2_raw_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_21a957e75025b18b" hs_bindgen_21a957e75025b18b_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosundef_2_raw_Example_Safe_foo@
+hs_bindgen_21a957e75025b18b ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_21a957e75025b18b =
+  \x0 ->
+    hs_bindgen_21a957e75025b18b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_21a957e75025b18b
diff --git a/test-artefacts/fixtures/macros/undef.2.raw/Example/Unsafe.hs b/test-artefacts/fixtures/macros/undef.2.raw/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.2.raw/Example/Unsafe.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/undef.h>"
+  , "void hs_bindgen_03f5b7598cff52b9 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosundef_2_raw_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_03f5b7598cff52b9" hs_bindgen_03f5b7598cff52b9_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosundef_2_raw_Example_Unsafe_foo@
+hs_bindgen_03f5b7598cff52b9 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_03f5b7598cff52b9 =
+  \x0 ->
+    hs_bindgen_03f5b7598cff52b9_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_03f5b7598cff52b9
diff --git a/test-artefacts/fixtures/macros/undef.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/undef.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.2.raw/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/macros/undef.2.raw/th.txt b/test-artefacts/fixtures/macros/undef.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef.2.raw/th.txt
@@ -0,0 +1,102 @@
+-- addDependentFile test-artefacts/headers/golden/macros/undef.h
+-- #include <macros/undef.h>
+-- void hs_bindgen_21a957e75025b18b (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_03f5b7598cff52b9 (
+--   signed int arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- /* test_macrosundef_2_raw_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_df59e9a307a33580 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &foo;
+-- }
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/undef.h 3:9@
+
+    __exported by:__ @macros\/undef.h@
+-}
+t :: Raw String
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/undef.h 3:9@
+
+    __exported by:__ @macros\/undef.h@
+-}
+t = objectLike "T" ["int"]
+-- __unique:__ @test_macrosundef_2_raw_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_21a957e75025b18b" hs_bindgen_21a957e75025b18b_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosundef_2_raw_Example_Safe_foo@
+hs_bindgen_21a957e75025b18b :: CInt -> IO ()
+-- __unique:__ @test_macrosundef_2_raw_Example_Safe_foo@
+hs_bindgen_21a957e75025b18b = \x_0 -> hs_bindgen_21a957e75025b18b_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_safe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_safe = hs_bindgen_21a957e75025b18b
+-- __unique:__ @test_macrosundef_2_raw_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_03f5b7598cff52b9" hs_bindgen_03f5b7598cff52b9_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosundef_2_raw_Example_Unsafe_foo@
+hs_bindgen_03f5b7598cff52b9 :: CInt -> IO ()
+-- __unique:__ @test_macrosundef_2_raw_Example_Unsafe_foo@
+hs_bindgen_03f5b7598cff52b9 = \x_0 -> hs_bindgen_03f5b7598cff52b9_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_unsafe = hs_bindgen_03f5b7598cff52b9
+-- __unique:__ @test_macrosundef_2_raw_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_df59e9a307a33580" hs_bindgen_df59e9a307a33580_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosundef_2_raw_Example_get_foo@
+hs_bindgen_df59e9a307a33580 :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_macrosundef_2_raw_Example_get_foo@
+hs_bindgen_df59e9a307a33580 = fmap fromFFIType hs_bindgen_df59e9a307a33580_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_df59e9a307a33580
diff --git a/test-artefacts/fixtures/macros/undef/Example.hs b/test-artefacts/fixtures/macros/undef/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef/Example.hs
@@ -0,0 +1,69 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/undef.h 3:9@
+
+    __exported by:__ @macros\/undef.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/macros/undef/Example/FunPtr.hs b/test-artefacts/fixtures/macros/undef/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/undef.h>"
+  , "/* test_macrosundef_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_71864e8181a7e9dd (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosundef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_71864e8181a7e9dd" hs_bindgen_71864e8181a7e9dd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_macrosundef_Example_get_foo@
+hs_bindgen_71864e8181a7e9dd :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_71864e8181a7e9dd =
+  fmap BG.fromFFIType hs_bindgen_71864e8181a7e9dd_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo :: BG.FunPtr (T -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_71864e8181a7e9dd
diff --git a/test-artefacts/fixtures/macros/undef/Example/Safe.hs b/test-artefacts/fixtures/macros/undef/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef/Example/Safe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/undef.h>"
+  , "void hs_bindgen_2a245181e5fb1e1c ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosundef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_2a245181e5fb1e1c" hs_bindgen_2a245181e5fb1e1c_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosundef_Example_Safe_foo@
+hs_bindgen_2a245181e5fb1e1c ::
+     T
+  -> IO ()
+hs_bindgen_2a245181e5fb1e1c =
+  \x0 ->
+    hs_bindgen_2a245181e5fb1e1c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_2a245181e5fb1e1c
diff --git a/test-artefacts/fixtures/macros/undef/Example/Unsafe.hs b/test-artefacts/fixtures/macros/undef/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef/Example/Unsafe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <macros/undef.h>"
+  , "void hs_bindgen_d73ff9e79242e63c ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_macrosundef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_d73ff9e79242e63c" hs_bindgen_d73ff9e79242e63c_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_macrosundef_Example_Unsafe_foo@
+hs_bindgen_d73ff9e79242e63c ::
+     T
+  -> IO ()
+hs_bindgen_d73ff9e79242e63c =
+  \x0 ->
+    hs_bindgen_d73ff9e79242e63c_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_d73ff9e79242e63c
diff --git a/test-artefacts/fixtures/macros/undef/bindingspec.yaml b/test-artefacts/fixtures/macros/undef/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/undef.h
+  cname: macro T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/undef/th.txt b/test-artefacts/fixtures/macros/undef/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/undef/th.txt
@@ -0,0 +1,120 @@
+-- addDependentFile test-artefacts/headers/golden/macros/undef.h
+-- #include <macros/undef.h>
+-- void hs_bindgen_2a245181e5fb1e1c (
+--   T arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_d73ff9e79242e63c (
+--   T arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- /* test_macrosundef_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_71864e8181a7e9dd (void)) (
+--   T arg1
+-- )
+-- {
+--   return &foo;
+-- }
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macros\/undef.h 3:9@
+
+    __exported by:__ @macros\/undef.h@
+-}
+newtype T
+    = T {unwrapT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_macrosundef_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_2a245181e5fb1e1c" hs_bindgen_2a245181e5fb1e1c_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosundef_Example_Safe_foo@
+hs_bindgen_2a245181e5fb1e1c :: T -> IO ()
+-- __unique:__ @test_macrosundef_Example_Safe_foo@
+hs_bindgen_2a245181e5fb1e1c = \x_0 -> hs_bindgen_2a245181e5fb1e1c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_safe :: T -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_safe = hs_bindgen_2a245181e5fb1e1c
+-- __unique:__ @test_macrosundef_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_d73ff9e79242e63c" hs_bindgen_d73ff9e79242e63c_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_macrosundef_Example_Unsafe_foo@
+hs_bindgen_d73ff9e79242e63c :: T -> IO ()
+-- __unique:__ @test_macrosundef_Example_Unsafe_foo@
+hs_bindgen_d73ff9e79242e63c = \x_0 -> hs_bindgen_d73ff9e79242e63c_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_unsafe :: T -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_unsafe = hs_bindgen_d73ff9e79242e63c
+-- __unique:__ @test_macrosundef_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_71864e8181a7e9dd" hs_bindgen_71864e8181a7e9dd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_macrosundef_Example_get_foo@
+hs_bindgen_71864e8181a7e9dd :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_macrosundef_Example_get_foo@
+hs_bindgen_71864e8181a7e9dd = fmap fromFFIType hs_bindgen_71864e8181a7e9dd_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @macros\/undef.h 4:6@
+
+    __exported by:__ @macros\/undef.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_71864e8181a7e9dd
diff --git a/test-artefacts/fixtures/macros/wrong_source_location.1.empty/Example.hs b/test-artefacts/fixtures/macros/wrong_source_location.1.empty/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/wrong_source_location.1.empty/Example.hs
@@ -0,0 +1,801 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.UU1_fieldY(..)
+    , Example.UU1(..)
+    , Example.UU2_fieldY(..)
+    , Example.UU2(..)
+    , Example.VV1_fieldA(..)
+    , Example.VV1_fieldB(..)
+    , Example.VV1(..)
+    , Example.VV2_fieldA(..)
+    , Example.VV2_fieldB(..)
+    , Example.VV2(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@UU1_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1_fieldY = UU1_fieldY
+  { uU1_fieldY_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU1_fieldY where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU1_fieldY where
+
+  readRaw =
+    \ptr0 ->
+          pure UU1_fieldY
+      <*> HasCField.readRaw (BG.Proxy @"uU1_fieldY_fieldX") ptr0
+
+instance Marshal.WriteRaw UU1_fieldY where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU1_fieldY uU1_fieldY_fieldX2 ->
+            HasCField.writeRaw (BG.Proxy @"uU1_fieldY_fieldX") ptr0 uU1_fieldY_fieldX2
+
+deriving via Marshal.EquivStorable UU1_fieldY instance BG.Storable UU1_fieldY
+
+deriving via Struct.IsStructViaReadRaw UU1_fieldY instance Struct.IsStruct UU1_fieldY
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uU1_fieldY_fieldX" UU1_fieldY ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> UU1_fieldY {uU1_fieldY_fieldX = y1}
+      , BG.getField @"uU1_fieldY_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uU1_fieldY_fieldX" (BG.Ptr UU1_fieldY) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uU1_fieldY_fieldX")
+
+instance HasCField.HasCField UU1_fieldY "uU1_fieldY_fieldX" where
+
+  type CFieldType UU1_fieldY "uU1_fieldY_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct UU1@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1 = UU1
+  { uU1_fieldY :: UU1_fieldY
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU1 where
+
+  readRaw =
+    \ptr0 ->
+          pure UU1
+      <*> HasCField.readRaw (BG.Proxy @"uU1_fieldY") ptr0
+
+instance Marshal.WriteRaw UU1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU1 uU1_fieldY2 ->
+            HasCField.writeRaw (BG.Proxy @"uU1_fieldY") ptr0 uU1_fieldY2
+
+deriving via Marshal.EquivStorable UU1 instance BG.Storable UU1
+
+deriving via Struct.IsStructViaReadRaw UU1 instance Struct.IsStruct UU1
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ UU1_fieldY
+         ) => BG.CompatHasField.HasField "uU1_fieldY" UU1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         UU1 {uU1_fieldY = y1}, BG.getField @"uU1_fieldY" x0)
+
+instance ( ty ~ UU1_fieldY
+         ) => BG.HasField "uU1_fieldY" (BG.Ptr UU1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU1_fieldY")
+
+instance HasCField.HasCField UU1 "uU1_fieldY" where
+
+  type CFieldType UU1 "uU1_fieldY" = UU1_fieldY
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@UU2_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2_fieldY = UU2_fieldY
+  { uU2_fieldY_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU2_fieldY where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU2_fieldY where
+
+  readRaw =
+    \ptr0 ->
+          pure UU2_fieldY
+      <*> HasCField.readRaw (BG.Proxy @"uU2_fieldY_fieldX") ptr0
+
+instance Marshal.WriteRaw UU2_fieldY where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU2_fieldY uU2_fieldY_fieldX2 ->
+            HasCField.writeRaw (BG.Proxy @"uU2_fieldY_fieldX") ptr0 uU2_fieldY_fieldX2
+
+deriving via Marshal.EquivStorable UU2_fieldY instance BG.Storable UU2_fieldY
+
+deriving via Struct.IsStructViaReadRaw UU2_fieldY instance Struct.IsStruct UU2_fieldY
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uU2_fieldY_fieldX" UU2_fieldY ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> UU2_fieldY {uU2_fieldY_fieldX = y1}
+      , BG.getField @"uU2_fieldY_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uU2_fieldY_fieldX" (BG.Ptr UU2_fieldY) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uU2_fieldY_fieldX")
+
+instance HasCField.HasCField UU2_fieldY "uU2_fieldY_fieldX" where
+
+  type CFieldType UU2_fieldY "uU2_fieldY_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct UU2@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2 = UU2
+  { uU2_fieldY :: UU2_fieldY
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU2 where
+
+  readRaw =
+    \ptr0 ->
+          pure UU2
+      <*> HasCField.readRaw (BG.Proxy @"uU2_fieldY") ptr0
+
+instance Marshal.WriteRaw UU2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU2 uU2_fieldY2 ->
+            HasCField.writeRaw (BG.Proxy @"uU2_fieldY") ptr0 uU2_fieldY2
+
+deriving via Marshal.EquivStorable UU2 instance BG.Storable UU2
+
+deriving via Struct.IsStructViaReadRaw UU2 instance Struct.IsStruct UU2
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ UU2_fieldY
+         ) => BG.CompatHasField.HasField "uU2_fieldY" UU2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         UU2 {uU2_fieldY = y1}, BG.getField @"uU2_fieldY" x0)
+
+instance ( ty ~ UU2_fieldY
+         ) => BG.HasField "uU2_fieldY" (BG.Ptr UU2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU2_fieldY")
+
+instance HasCField.HasCField UU2 "uU2_fieldY" where
+
+  type CFieldType UU2 "uU2_fieldY" = UU2_fieldY
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@VV1_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldA = VV1_fieldA
+  { vV1_fieldA_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV1_fieldA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV1_fieldA where
+
+  readRaw =
+    \ptr0 ->
+          pure VV1_fieldA
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldA_a") ptr0
+
+instance Marshal.WriteRaw VV1_fieldA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV1_fieldA vV1_fieldA_a2 ->
+            HasCField.writeRaw (BG.Proxy @"vV1_fieldA_a") ptr0 vV1_fieldA_a2
+
+deriving via Marshal.EquivStorable VV1_fieldA instance BG.Storable VV1_fieldA
+
+deriving via Struct.IsStructViaReadRaw VV1_fieldA instance Struct.IsStruct VV1_fieldA
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV1_fieldA_a" VV1_fieldA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV1_fieldA {vV1_fieldA_a = y1}, BG.getField @"vV1_fieldA_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV1_fieldA_a" (BG.Ptr VV1_fieldA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV1_fieldA_a")
+
+instance HasCField.HasCField VV1_fieldA "vV1_fieldA_a" where
+
+  type CFieldType VV1_fieldA "vV1_fieldA_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@VV1_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldB = VV1_fieldB
+  { vV1_fieldB_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV1_fieldB where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV1_fieldB where
+
+  readRaw =
+    \ptr0 ->
+          pure VV1_fieldB
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldB_b") ptr0
+
+instance Marshal.WriteRaw VV1_fieldB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV1_fieldB vV1_fieldB_b2 ->
+            HasCField.writeRaw (BG.Proxy @"vV1_fieldB_b") ptr0 vV1_fieldB_b2
+
+deriving via Marshal.EquivStorable VV1_fieldB instance BG.Storable VV1_fieldB
+
+deriving via Struct.IsStructViaReadRaw VV1_fieldB instance Struct.IsStruct VV1_fieldB
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV1_fieldB_b" VV1_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV1_fieldB {vV1_fieldB_b = y1}, BG.getField @"vV1_fieldB_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV1_fieldB_b" (BG.Ptr VV1_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV1_fieldB_b")
+
+instance HasCField.HasCField VV1_fieldB "vV1_fieldB_b" where
+
+  type CFieldType VV1_fieldB "vV1_fieldB_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct VV1@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1 = VV1
+  { vV1_fieldA :: VV1_fieldA
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  , vV1_fieldB :: VV1_fieldB
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV1 where
+
+  readRaw =
+    \ptr0 ->
+          pure VV1
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldB") ptr0
+
+instance Marshal.WriteRaw VV1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV1 vV1_fieldA2 vV1_fieldB3 ->
+               HasCField.writeRaw (BG.Proxy @"vV1_fieldA") ptr0 vV1_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"vV1_fieldB") ptr0 vV1_fieldB3
+
+deriving via Marshal.EquivStorable VV1 instance BG.Storable VV1
+
+deriving via Struct.IsStructViaReadRaw VV1 instance Struct.IsStruct VV1
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV1_fieldA
+         ) => BG.CompatHasField.HasField "vV1_fieldA" VV1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV1 {vV1_fieldA = y1, vV1_fieldB = BG.getField @"vV1_fieldB" x0}
+      , BG.getField @"vV1_fieldA" x0
+      )
+
+instance ( ty ~ VV1_fieldA
+         ) => BG.HasField "vV1_fieldA" (BG.Ptr VV1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV1_fieldA")
+
+instance HasCField.HasCField VV1 "vV1_fieldA" where
+
+  type CFieldType VV1 "vV1_fieldA" = VV1_fieldA
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV1_fieldB
+         ) => BG.CompatHasField.HasField "vV1_fieldB" VV1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV1 {vV1_fieldB = y1, vV1_fieldA = BG.getField @"vV1_fieldA" x0}
+      , BG.getField @"vV1_fieldB" x0
+      )
+
+instance ( ty ~ VV1_fieldB
+         ) => BG.HasField "vV1_fieldB" (BG.Ptr VV1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV1_fieldB")
+
+instance HasCField.HasCField VV1 "vV1_fieldB" where
+
+  type CFieldType VV1 "vV1_fieldB" = VV1_fieldB
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@VV2_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldA = VV2_fieldA
+  { vV2_fieldA_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV2_fieldA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV2_fieldA where
+
+  readRaw =
+    \ptr0 ->
+          pure VV2_fieldA
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldA_a") ptr0
+
+instance Marshal.WriteRaw VV2_fieldA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV2_fieldA vV2_fieldA_a2 ->
+            HasCField.writeRaw (BG.Proxy @"vV2_fieldA_a") ptr0 vV2_fieldA_a2
+
+deriving via Marshal.EquivStorable VV2_fieldA instance BG.Storable VV2_fieldA
+
+deriving via Struct.IsStructViaReadRaw VV2_fieldA instance Struct.IsStruct VV2_fieldA
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV2_fieldA_a" VV2_fieldA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV2_fieldA {vV2_fieldA_a = y1}, BG.getField @"vV2_fieldA_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV2_fieldA_a" (BG.Ptr VV2_fieldA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV2_fieldA_a")
+
+instance HasCField.HasCField VV2_fieldA "vV2_fieldA_a" where
+
+  type CFieldType VV2_fieldA "vV2_fieldA_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@VV2_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldB = VV2_fieldB
+  { vV2_fieldB_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV2_fieldB where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV2_fieldB where
+
+  readRaw =
+    \ptr0 ->
+          pure VV2_fieldB
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldB_b") ptr0
+
+instance Marshal.WriteRaw VV2_fieldB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV2_fieldB vV2_fieldB_b2 ->
+            HasCField.writeRaw (BG.Proxy @"vV2_fieldB_b") ptr0 vV2_fieldB_b2
+
+deriving via Marshal.EquivStorable VV2_fieldB instance BG.Storable VV2_fieldB
+
+deriving via Struct.IsStructViaReadRaw VV2_fieldB instance Struct.IsStruct VV2_fieldB
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV2_fieldB_b" VV2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV2_fieldB {vV2_fieldB_b = y1}, BG.getField @"vV2_fieldB_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV2_fieldB_b" (BG.Ptr VV2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV2_fieldB_b")
+
+instance HasCField.HasCField VV2_fieldB "vV2_fieldB_b" where
+
+  type CFieldType VV2_fieldB "vV2_fieldB_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct VV2@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2 = VV2
+  { vV2_fieldA :: VV2_fieldA
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  , vV2_fieldB :: VV2_fieldB
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV2 where
+
+  readRaw =
+    \ptr0 ->
+          pure VV2
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldB") ptr0
+
+instance Marshal.WriteRaw VV2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV2 vV2_fieldA2 vV2_fieldB3 ->
+               HasCField.writeRaw (BG.Proxy @"vV2_fieldA") ptr0 vV2_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"vV2_fieldB") ptr0 vV2_fieldB3
+
+deriving via Marshal.EquivStorable VV2 instance BG.Storable VV2
+
+deriving via Struct.IsStructViaReadRaw VV2 instance Struct.IsStruct VV2
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV2_fieldA
+         ) => BG.CompatHasField.HasField "vV2_fieldA" VV2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV2 {vV2_fieldA = y1, vV2_fieldB = BG.getField @"vV2_fieldB" x0}
+      , BG.getField @"vV2_fieldA" x0
+      )
+
+instance ( ty ~ VV2_fieldA
+         ) => BG.HasField "vV2_fieldA" (BG.Ptr VV2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV2_fieldA")
+
+instance HasCField.HasCField VV2 "vV2_fieldA" where
+
+  type CFieldType VV2 "vV2_fieldA" = VV2_fieldA
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV2_fieldB
+         ) => BG.CompatHasField.HasField "vV2_fieldB" VV2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV2 {vV2_fieldB = y1, vV2_fieldA = BG.getField @"vV2_fieldA" x0}
+      , BG.getField @"vV2_fieldB" x0
+      )
+
+instance ( ty ~ VV2_fieldB
+         ) => BG.HasField "vV2_fieldB" (BG.Ptr VV2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV2_fieldB")
+
+instance HasCField.HasCField VV2 "vV2_fieldB" where
+
+  type CFieldType VV2 "vV2_fieldB" = VV2_fieldB
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/wrong_source_location.1.empty/bindingspec.yaml b/test-artefacts/fixtures/macros/wrong_source_location.1.empty/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/wrong_source_location.1.empty/bindingspec.yaml
@@ -0,0 +1,234 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/wrong_source_location.h
+  cname: UU1
+  hsname: UU1
+- headers: macros/wrong_source_location.h
+  cname: struct @UU1_fieldY
+  hsname: UU1_fieldY
+- headers: macros/wrong_source_location.h
+  cname: struct UU1
+  hsname: UU1
+- headers: macros/wrong_source_location.h
+  cname: UU2
+  hsname: UU2
+- headers: macros/wrong_source_location.h
+  cname: struct @UU2_fieldY
+  hsname: UU2_fieldY
+- headers: macros/wrong_source_location.h
+  cname: struct UU2
+  hsname: UU2
+- headers: macros/wrong_source_location.h
+  cname: struct @VV1_fieldA
+  hsname: VV1_fieldA
+- headers: macros/wrong_source_location.h
+  cname: struct @VV1_fieldB
+  hsname: VV1_fieldB
+- headers: macros/wrong_source_location.h
+  cname: struct VV1
+  hsname: VV1
+- headers: macros/wrong_source_location.h
+  cname: struct @VV2_fieldA
+  hsname: VV2_fieldA
+- headers: macros/wrong_source_location.h
+  cname: struct @VV2_fieldB
+  hsname: VV2_fieldB
+- headers: macros/wrong_source_location.h
+  cname: struct VV2
+  hsname: VV2
+hstypes:
+- hsname: UU1
+  representation:
+    record:
+      constructor: UU1
+      fields:
+      - uU1_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU1_fieldY
+  representation:
+    record:
+      constructor: UU1_fieldY
+      fields:
+      - uU1_fieldY_fieldX
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU2
+  representation:
+    record:
+      constructor: UU2
+      fields:
+      - uU2_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU2_fieldY
+  representation:
+    record:
+      constructor: UU2_fieldY
+      fields:
+      - uU2_fieldY_fieldX
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV1
+  representation:
+    record:
+      constructor: VV1
+      fields:
+      - vV1_fieldA
+      - vV1_fieldB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV1_fieldA
+  representation:
+    record:
+      constructor: VV1_fieldA
+      fields:
+      - vV1_fieldA_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV1_fieldB
+  representation:
+    record:
+      constructor: VV1_fieldB
+      fields:
+      - vV1_fieldB_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV2
+  representation:
+    record:
+      constructor: VV2
+      fields:
+      - vV2_fieldA
+      - vV2_fieldB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV2_fieldA
+  representation:
+    record:
+      constructor: VV2_fieldA
+      fields:
+      - vV2_fieldA_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV2_fieldB
+  representation:
+    record:
+      constructor: VV2_fieldB
+      fields:
+      - vV2_fieldB_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/wrong_source_location.1.empty/th.txt b/test-artefacts/fixtures/macros/wrong_source_location.1.empty/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/wrong_source_location.1.empty/th.txt
@@ -0,0 +1,379 @@
+-- addDependentFile test-artefacts/headers/golden/macros/wrong_source_location.h
+{-| __C declaration:__ @struct \@UU1_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1_fieldY
+    = UU1_fieldY {uU1_fieldY_fieldX :: CInt
+                  {- ^ __C declaration:__ @fieldX@
+
+                       __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU1_fieldY
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU1_fieldY
+    where readRaw = \ptr_0 -> pure UU1_fieldY <*> readRaw (Proxy @"uU1_fieldY_fieldX") ptr_0
+instance WriteRaw UU1_fieldY
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU1_fieldY uU1_fieldY_fieldX_2 -> writeRaw (Proxy @"uU1_fieldY_fieldX") ptr_0 uU1_fieldY_fieldX_2
+deriving via (EquivStorable UU1_fieldY) instance Storable UU1_fieldY
+deriving via (IsStructViaReadRaw UU1_fieldY) instance IsStruct UU1_fieldY
+instance (~) ty CInt => HasField "uU1_fieldY_fieldX" UU1_fieldY ty
+    where hasField = \x_0 -> (\y_1 -> UU1_fieldY{uU1_fieldY_fieldX = y_1},
+                              getField @"uU1_fieldY_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "uU1_fieldY_fieldX" (Ptr UU1_fieldY) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU1_fieldY_fieldX")
+instance HasCField UU1_fieldY "uU1_fieldY_fieldX"
+    where type CFieldType UU1_fieldY "uU1_fieldY_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct UU1@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1
+    = UU1 {uU1_fieldY :: UU1_fieldY
+           {- ^ __C declaration:__ @fieldY@
+
+                __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU1
+    where readRaw = \ptr_0 -> pure UU1 <*> readRaw (Proxy @"uU1_fieldY") ptr_0
+instance WriteRaw UU1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU1 uU1_fieldY_2 -> writeRaw (Proxy @"uU1_fieldY") ptr_0 uU1_fieldY_2
+deriving via (EquivStorable UU1) instance Storable UU1
+deriving via (IsStructViaReadRaw UU1) instance IsStruct UU1
+instance (~) ty UU1_fieldY => HasField "uU1_fieldY" UU1 ty
+    where hasField = \x_0 -> (\y_1 -> UU1{uU1_fieldY = y_1},
+                              getField @"uU1_fieldY" x_0)
+instance (~) ty UU1_fieldY =>
+         HasField "uU1_fieldY" (Ptr UU1) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU1_fieldY")
+instance HasCField UU1 "uU1_fieldY"
+    where type CFieldType UU1 "uU1_fieldY" = UU1_fieldY
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@UU2_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2_fieldY
+    = UU2_fieldY {uU2_fieldY_fieldX :: CInt
+                  {- ^ __C declaration:__ @fieldX@
+
+                       __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU2_fieldY
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU2_fieldY
+    where readRaw = \ptr_0 -> pure UU2_fieldY <*> readRaw (Proxy @"uU2_fieldY_fieldX") ptr_0
+instance WriteRaw UU2_fieldY
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU2_fieldY uU2_fieldY_fieldX_2 -> writeRaw (Proxy @"uU2_fieldY_fieldX") ptr_0 uU2_fieldY_fieldX_2
+deriving via (EquivStorable UU2_fieldY) instance Storable UU2_fieldY
+deriving via (IsStructViaReadRaw UU2_fieldY) instance IsStruct UU2_fieldY
+instance (~) ty CInt => HasField "uU2_fieldY_fieldX" UU2_fieldY ty
+    where hasField = \x_0 -> (\y_1 -> UU2_fieldY{uU2_fieldY_fieldX = y_1},
+                              getField @"uU2_fieldY_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "uU2_fieldY_fieldX" (Ptr UU2_fieldY) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU2_fieldY_fieldX")
+instance HasCField UU2_fieldY "uU2_fieldY_fieldX"
+    where type CFieldType UU2_fieldY "uU2_fieldY_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct UU2@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2
+    = UU2 {uU2_fieldY :: UU2_fieldY
+           {- ^ __C declaration:__ @fieldY@
+
+                __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU2
+    where readRaw = \ptr_0 -> pure UU2 <*> readRaw (Proxy @"uU2_fieldY") ptr_0
+instance WriteRaw UU2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU2 uU2_fieldY_2 -> writeRaw (Proxy @"uU2_fieldY") ptr_0 uU2_fieldY_2
+deriving via (EquivStorable UU2) instance Storable UU2
+deriving via (IsStructViaReadRaw UU2) instance IsStruct UU2
+instance (~) ty UU2_fieldY => HasField "uU2_fieldY" UU2 ty
+    where hasField = \x_0 -> (\y_1 -> UU2{uU2_fieldY = y_1},
+                              getField @"uU2_fieldY" x_0)
+instance (~) ty UU2_fieldY =>
+         HasField "uU2_fieldY" (Ptr UU2) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU2_fieldY")
+instance HasCField UU2 "uU2_fieldY"
+    where type CFieldType UU2 "uU2_fieldY" = UU2_fieldY
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@VV1_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldA
+    = VV1_fieldA {vV1_fieldA_a :: CInt
+                  {- ^ __C declaration:__ @a@
+
+                       __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV1_fieldA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV1_fieldA
+    where readRaw = \ptr_0 -> pure VV1_fieldA <*> readRaw (Proxy @"vV1_fieldA_a") ptr_0
+instance WriteRaw VV1_fieldA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV1_fieldA vV1_fieldA_a_2 -> writeRaw (Proxy @"vV1_fieldA_a") ptr_0 vV1_fieldA_a_2
+deriving via (EquivStorable VV1_fieldA) instance Storable VV1_fieldA
+deriving via (IsStructViaReadRaw VV1_fieldA) instance IsStruct VV1_fieldA
+instance (~) ty CInt => HasField "vV1_fieldA_a" VV1_fieldA ty
+    where hasField = \x_0 -> (\y_1 -> VV1_fieldA{vV1_fieldA_a = y_1},
+                              getField @"vV1_fieldA_a" x_0)
+instance (~) ty CInt =>
+         HasField "vV1_fieldA_a" (Ptr VV1_fieldA) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldA_a")
+instance HasCField VV1_fieldA "vV1_fieldA_a"
+    where type CFieldType VV1_fieldA "vV1_fieldA_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@VV1_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldB
+    = VV1_fieldB {vV1_fieldB_b :: CInt
+                  {- ^ __C declaration:__ @b@
+
+                       __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV1_fieldB
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV1_fieldB
+    where readRaw = \ptr_0 -> pure VV1_fieldB <*> readRaw (Proxy @"vV1_fieldB_b") ptr_0
+instance WriteRaw VV1_fieldB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV1_fieldB vV1_fieldB_b_2 -> writeRaw (Proxy @"vV1_fieldB_b") ptr_0 vV1_fieldB_b_2
+deriving via (EquivStorable VV1_fieldB) instance Storable VV1_fieldB
+deriving via (IsStructViaReadRaw VV1_fieldB) instance IsStruct VV1_fieldB
+instance (~) ty CInt => HasField "vV1_fieldB_b" VV1_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> VV1_fieldB{vV1_fieldB_b = y_1},
+                              getField @"vV1_fieldB_b" x_0)
+instance (~) ty CInt =>
+         HasField "vV1_fieldB_b" (Ptr VV1_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldB_b")
+instance HasCField VV1_fieldB "vV1_fieldB_b"
+    where type CFieldType VV1_fieldB "vV1_fieldB_b" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct VV1@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1
+    = VV1 {vV1_fieldA :: VV1_fieldA
+           {- ^ __C declaration:__ @fieldA@
+
+                __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -},
+           vV1_fieldB :: VV1_fieldB
+           {- ^ __C declaration:__ @fieldB@
+
+                __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV1
+    where readRaw = \ptr_0 -> (pure VV1 <*> readRaw (Proxy @"vV1_fieldA") ptr_0) <*> readRaw (Proxy @"vV1_fieldB") ptr_0
+instance WriteRaw VV1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV1 vV1_fieldA_2
+                                           vV1_fieldB_3 -> writeRaw (Proxy @"vV1_fieldA") ptr_0 vV1_fieldA_2 >> writeRaw (Proxy @"vV1_fieldB") ptr_0 vV1_fieldB_3
+deriving via (EquivStorable VV1) instance Storable VV1
+deriving via (IsStructViaReadRaw VV1) instance IsStruct VV1
+instance (~) ty VV1_fieldA => HasField "vV1_fieldA" VV1 ty
+    where hasField = \x_0 -> (\y_1 -> VV1{vV1_fieldA = y_1,
+                                          vV1_fieldB = getField @"vV1_fieldB" x_0},
+                              getField @"vV1_fieldA" x_0)
+instance (~) ty VV1_fieldA =>
+         HasField "vV1_fieldA" (Ptr VV1) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldA")
+instance HasCField VV1 "vV1_fieldA"
+    where type CFieldType VV1 "vV1_fieldA" = VV1_fieldA
+          offset# = \_ -> \_ -> 0
+instance (~) ty VV1_fieldB => HasField "vV1_fieldB" VV1 ty
+    where hasField = \x_0 -> (\y_1 -> VV1{vV1_fieldB = y_1,
+                                          vV1_fieldA = getField @"vV1_fieldA" x_0},
+                              getField @"vV1_fieldB" x_0)
+instance (~) ty VV1_fieldB =>
+         HasField "vV1_fieldB" (Ptr VV1) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldB")
+instance HasCField VV1 "vV1_fieldB"
+    where type CFieldType VV1 "vV1_fieldB" = VV1_fieldB
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@VV2_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldA
+    = VV2_fieldA {vV2_fieldA_a :: CInt
+                  {- ^ __C declaration:__ @a@
+
+                       __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV2_fieldA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV2_fieldA
+    where readRaw = \ptr_0 -> pure VV2_fieldA <*> readRaw (Proxy @"vV2_fieldA_a") ptr_0
+instance WriteRaw VV2_fieldA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV2_fieldA vV2_fieldA_a_2 -> writeRaw (Proxy @"vV2_fieldA_a") ptr_0 vV2_fieldA_a_2
+deriving via (EquivStorable VV2_fieldA) instance Storable VV2_fieldA
+deriving via (IsStructViaReadRaw VV2_fieldA) instance IsStruct VV2_fieldA
+instance (~) ty CInt => HasField "vV2_fieldA_a" VV2_fieldA ty
+    where hasField = \x_0 -> (\y_1 -> VV2_fieldA{vV2_fieldA_a = y_1},
+                              getField @"vV2_fieldA_a" x_0)
+instance (~) ty CInt =>
+         HasField "vV2_fieldA_a" (Ptr VV2_fieldA) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldA_a")
+instance HasCField VV2_fieldA "vV2_fieldA_a"
+    where type CFieldType VV2_fieldA "vV2_fieldA_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@VV2_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldB
+    = VV2_fieldB {vV2_fieldB_b :: CInt
+                  {- ^ __C declaration:__ @b@
+
+                       __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV2_fieldB
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV2_fieldB
+    where readRaw = \ptr_0 -> pure VV2_fieldB <*> readRaw (Proxy @"vV2_fieldB_b") ptr_0
+instance WriteRaw VV2_fieldB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV2_fieldB vV2_fieldB_b_2 -> writeRaw (Proxy @"vV2_fieldB_b") ptr_0 vV2_fieldB_b_2
+deriving via (EquivStorable VV2_fieldB) instance Storable VV2_fieldB
+deriving via (IsStructViaReadRaw VV2_fieldB) instance IsStruct VV2_fieldB
+instance (~) ty CInt => HasField "vV2_fieldB_b" VV2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> VV2_fieldB{vV2_fieldB_b = y_1},
+                              getField @"vV2_fieldB_b" x_0)
+instance (~) ty CInt =>
+         HasField "vV2_fieldB_b" (Ptr VV2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldB_b")
+instance HasCField VV2_fieldB "vV2_fieldB_b"
+    where type CFieldType VV2_fieldB "vV2_fieldB_b" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct VV2@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2
+    = VV2 {vV2_fieldA :: VV2_fieldA
+           {- ^ __C declaration:__ @fieldA@
+
+                __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -},
+           vV2_fieldB :: VV2_fieldB
+           {- ^ __C declaration:__ @fieldB@
+
+                __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV2
+    where readRaw = \ptr_0 -> (pure VV2 <*> readRaw (Proxy @"vV2_fieldA") ptr_0) <*> readRaw (Proxy @"vV2_fieldB") ptr_0
+instance WriteRaw VV2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV2 vV2_fieldA_2
+                                           vV2_fieldB_3 -> writeRaw (Proxy @"vV2_fieldA") ptr_0 vV2_fieldA_2 >> writeRaw (Proxy @"vV2_fieldB") ptr_0 vV2_fieldB_3
+deriving via (EquivStorable VV2) instance Storable VV2
+deriving via (IsStructViaReadRaw VV2) instance IsStruct VV2
+instance (~) ty VV2_fieldA => HasField "vV2_fieldA" VV2 ty
+    where hasField = \x_0 -> (\y_1 -> VV2{vV2_fieldA = y_1,
+                                          vV2_fieldB = getField @"vV2_fieldB" x_0},
+                              getField @"vV2_fieldA" x_0)
+instance (~) ty VV2_fieldA =>
+         HasField "vV2_fieldA" (Ptr VV2) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldA")
+instance HasCField VV2 "vV2_fieldA"
+    where type CFieldType VV2 "vV2_fieldA" = VV2_fieldA
+          offset# = \_ -> \_ -> 0
+instance (~) ty VV2_fieldB => HasField "vV2_fieldB" VV2 ty
+    where hasField = \x_0 -> (\y_1 -> VV2{vV2_fieldB = y_1,
+                                          vV2_fieldA = getField @"vV2_fieldA" x_0},
+                              getField @"vV2_fieldB" x_0)
+instance (~) ty VV2_fieldB =>
+         HasField "vV2_fieldB" (Ptr VV2) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldB")
+instance HasCField VV2 "vV2_fieldB"
+    where type CFieldType VV2 "vV2_fieldB" = VV2_fieldB
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/wrong_source_location.2.raw/Example.hs b/test-artefacts/fixtures/macros/wrong_source_location.2.raw/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/wrong_source_location.2.raw/Example.hs
@@ -0,0 +1,859 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.nestedUnnamed
+    , Example.UU1_fieldY(..)
+    , Example.UU1(..)
+    , Example.UU2_fieldY(..)
+    , Example.UU2(..)
+    , Example.twoUntaggedStructs
+    , Example.VV1_fieldA(..)
+    , Example.VV1_fieldB(..)
+    , Example.VV1(..)
+    , Example.VV2_fieldA(..)
+    , Example.VV2_fieldB(..)
+    , Example.VV2(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Macro as Macro
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, String, pure, type (~))
+
+{-| __C declaration:__ @macro NestedUnnamed@
+
+    __defined at:__ @macros\/wrong_source_location.h 12:9@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+nestedUnnamed :: Macro.Raw String
+nestedUnnamed =
+  Macro.functionLike "NestedUnnamed" ["t1", "n1", "t2"] [ "typedef"
+                                                        , "t1"
+                                                        , "{"
+                                                        , "t2"
+                                                        , "{"
+                                                        , "int"
+                                                        , "fieldX"
+                                                        , ";"
+                                                        , "}"
+                                                        , "fieldY"
+                                                        , ";"
+                                                        , "}"
+                                                        , "n1"
+                                                        , ";"
+                                                        ]
+
+{-| __C declaration:__ @struct \@UU1_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1_fieldY = UU1_fieldY
+  { uU1_fieldY_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU1_fieldY where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU1_fieldY where
+
+  readRaw =
+    \ptr0 ->
+          pure UU1_fieldY
+      <*> HasCField.readRaw (BG.Proxy @"uU1_fieldY_fieldX") ptr0
+
+instance Marshal.WriteRaw UU1_fieldY where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU1_fieldY uU1_fieldY_fieldX2 ->
+            HasCField.writeRaw (BG.Proxy @"uU1_fieldY_fieldX") ptr0 uU1_fieldY_fieldX2
+
+deriving via Marshal.EquivStorable UU1_fieldY instance BG.Storable UU1_fieldY
+
+deriving via Struct.IsStructViaReadRaw UU1_fieldY instance Struct.IsStruct UU1_fieldY
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uU1_fieldY_fieldX" UU1_fieldY ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> UU1_fieldY {uU1_fieldY_fieldX = y1}
+      , BG.getField @"uU1_fieldY_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uU1_fieldY_fieldX" (BG.Ptr UU1_fieldY) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uU1_fieldY_fieldX")
+
+instance HasCField.HasCField UU1_fieldY "uU1_fieldY_fieldX" where
+
+  type CFieldType UU1_fieldY "uU1_fieldY_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct UU1@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1 = UU1
+  { uU1_fieldY :: UU1_fieldY
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU1 where
+
+  readRaw =
+    \ptr0 ->
+          pure UU1
+      <*> HasCField.readRaw (BG.Proxy @"uU1_fieldY") ptr0
+
+instance Marshal.WriteRaw UU1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU1 uU1_fieldY2 ->
+            HasCField.writeRaw (BG.Proxy @"uU1_fieldY") ptr0 uU1_fieldY2
+
+deriving via Marshal.EquivStorable UU1 instance BG.Storable UU1
+
+deriving via Struct.IsStructViaReadRaw UU1 instance Struct.IsStruct UU1
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ UU1_fieldY
+         ) => BG.CompatHasField.HasField "uU1_fieldY" UU1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         UU1 {uU1_fieldY = y1}, BG.getField @"uU1_fieldY" x0)
+
+instance ( ty ~ UU1_fieldY
+         ) => BG.HasField "uU1_fieldY" (BG.Ptr UU1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU1_fieldY")
+
+instance HasCField.HasCField UU1 "uU1_fieldY" where
+
+  type CFieldType UU1 "uU1_fieldY" = UU1_fieldY
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@UU2_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2_fieldY = UU2_fieldY
+  { uU2_fieldY_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU2_fieldY where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU2_fieldY where
+
+  readRaw =
+    \ptr0 ->
+          pure UU2_fieldY
+      <*> HasCField.readRaw (BG.Proxy @"uU2_fieldY_fieldX") ptr0
+
+instance Marshal.WriteRaw UU2_fieldY where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU2_fieldY uU2_fieldY_fieldX2 ->
+            HasCField.writeRaw (BG.Proxy @"uU2_fieldY_fieldX") ptr0 uU2_fieldY_fieldX2
+
+deriving via Marshal.EquivStorable UU2_fieldY instance BG.Storable UU2_fieldY
+
+deriving via Struct.IsStructViaReadRaw UU2_fieldY instance Struct.IsStruct UU2_fieldY
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uU2_fieldY_fieldX" UU2_fieldY ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> UU2_fieldY {uU2_fieldY_fieldX = y1}
+      , BG.getField @"uU2_fieldY_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uU2_fieldY_fieldX" (BG.Ptr UU2_fieldY) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uU2_fieldY_fieldX")
+
+instance HasCField.HasCField UU2_fieldY "uU2_fieldY_fieldX" where
+
+  type CFieldType UU2_fieldY "uU2_fieldY_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct UU2@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2 = UU2
+  { uU2_fieldY :: UU2_fieldY
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU2 where
+
+  readRaw =
+    \ptr0 ->
+          pure UU2
+      <*> HasCField.readRaw (BG.Proxy @"uU2_fieldY") ptr0
+
+instance Marshal.WriteRaw UU2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU2 uU2_fieldY2 ->
+            HasCField.writeRaw (BG.Proxy @"uU2_fieldY") ptr0 uU2_fieldY2
+
+deriving via Marshal.EquivStorable UU2 instance BG.Storable UU2
+
+deriving via Struct.IsStructViaReadRaw UU2 instance Struct.IsStruct UU2
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ UU2_fieldY
+         ) => BG.CompatHasField.HasField "uU2_fieldY" UU2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         UU2 {uU2_fieldY = y1}, BG.getField @"uU2_fieldY" x0)
+
+instance ( ty ~ UU2_fieldY
+         ) => BG.HasField "uU2_fieldY" (BG.Ptr UU2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU2_fieldY")
+
+instance HasCField.HasCField UU2 "uU2_fieldY" where
+
+  type CFieldType UU2 "uU2_fieldY" = UU2_fieldY
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro TwoUntaggedStructs@
+
+    __defined at:__ @macros\/wrong_source_location.h 23:9@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+twoUntaggedStructs :: Macro.Raw String
+twoUntaggedStructs =
+  Macro.functionLike "TwoUntaggedStructs" ["name"] [ "struct"
+                                                   , "name"
+                                                   , "{"
+                                                   , "struct"
+                                                   , "{"
+                                                   , "int"
+                                                   , "a"
+                                                   , ";"
+                                                   , "}"
+                                                   , "fieldA"
+                                                   , ";"
+                                                   , "struct"
+                                                   , "{"
+                                                   , "int"
+                                                   , "b"
+                                                   , ";"
+                                                   , "}"
+                                                   , "fieldB"
+                                                   , ";"
+                                                   , "}"
+                                                   , ";"
+                                                   ]
+
+{-| __C declaration:__ @struct \@VV1_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldA = VV1_fieldA
+  { vV1_fieldA_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV1_fieldA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV1_fieldA where
+
+  readRaw =
+    \ptr0 ->
+          pure VV1_fieldA
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldA_a") ptr0
+
+instance Marshal.WriteRaw VV1_fieldA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV1_fieldA vV1_fieldA_a2 ->
+            HasCField.writeRaw (BG.Proxy @"vV1_fieldA_a") ptr0 vV1_fieldA_a2
+
+deriving via Marshal.EquivStorable VV1_fieldA instance BG.Storable VV1_fieldA
+
+deriving via Struct.IsStructViaReadRaw VV1_fieldA instance Struct.IsStruct VV1_fieldA
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV1_fieldA_a" VV1_fieldA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV1_fieldA {vV1_fieldA_a = y1}, BG.getField @"vV1_fieldA_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV1_fieldA_a" (BG.Ptr VV1_fieldA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV1_fieldA_a")
+
+instance HasCField.HasCField VV1_fieldA "vV1_fieldA_a" where
+
+  type CFieldType VV1_fieldA "vV1_fieldA_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@VV1_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldB = VV1_fieldB
+  { vV1_fieldB_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV1_fieldB where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV1_fieldB where
+
+  readRaw =
+    \ptr0 ->
+          pure VV1_fieldB
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldB_b") ptr0
+
+instance Marshal.WriteRaw VV1_fieldB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV1_fieldB vV1_fieldB_b2 ->
+            HasCField.writeRaw (BG.Proxy @"vV1_fieldB_b") ptr0 vV1_fieldB_b2
+
+deriving via Marshal.EquivStorable VV1_fieldB instance BG.Storable VV1_fieldB
+
+deriving via Struct.IsStructViaReadRaw VV1_fieldB instance Struct.IsStruct VV1_fieldB
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV1_fieldB_b" VV1_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV1_fieldB {vV1_fieldB_b = y1}, BG.getField @"vV1_fieldB_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV1_fieldB_b" (BG.Ptr VV1_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV1_fieldB_b")
+
+instance HasCField.HasCField VV1_fieldB "vV1_fieldB_b" where
+
+  type CFieldType VV1_fieldB "vV1_fieldB_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct VV1@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1 = VV1
+  { vV1_fieldA :: VV1_fieldA
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  , vV1_fieldB :: VV1_fieldB
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV1 where
+
+  readRaw =
+    \ptr0 ->
+          pure VV1
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldB") ptr0
+
+instance Marshal.WriteRaw VV1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV1 vV1_fieldA2 vV1_fieldB3 ->
+               HasCField.writeRaw (BG.Proxy @"vV1_fieldA") ptr0 vV1_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"vV1_fieldB") ptr0 vV1_fieldB3
+
+deriving via Marshal.EquivStorable VV1 instance BG.Storable VV1
+
+deriving via Struct.IsStructViaReadRaw VV1 instance Struct.IsStruct VV1
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV1_fieldA
+         ) => BG.CompatHasField.HasField "vV1_fieldA" VV1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV1 {vV1_fieldA = y1, vV1_fieldB = BG.getField @"vV1_fieldB" x0}
+      , BG.getField @"vV1_fieldA" x0
+      )
+
+instance ( ty ~ VV1_fieldA
+         ) => BG.HasField "vV1_fieldA" (BG.Ptr VV1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV1_fieldA")
+
+instance HasCField.HasCField VV1 "vV1_fieldA" where
+
+  type CFieldType VV1 "vV1_fieldA" = VV1_fieldA
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV1_fieldB
+         ) => BG.CompatHasField.HasField "vV1_fieldB" VV1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV1 {vV1_fieldB = y1, vV1_fieldA = BG.getField @"vV1_fieldA" x0}
+      , BG.getField @"vV1_fieldB" x0
+      )
+
+instance ( ty ~ VV1_fieldB
+         ) => BG.HasField "vV1_fieldB" (BG.Ptr VV1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV1_fieldB")
+
+instance HasCField.HasCField VV1 "vV1_fieldB" where
+
+  type CFieldType VV1 "vV1_fieldB" = VV1_fieldB
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@VV2_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldA = VV2_fieldA
+  { vV2_fieldA_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV2_fieldA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV2_fieldA where
+
+  readRaw =
+    \ptr0 ->
+          pure VV2_fieldA
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldA_a") ptr0
+
+instance Marshal.WriteRaw VV2_fieldA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV2_fieldA vV2_fieldA_a2 ->
+            HasCField.writeRaw (BG.Proxy @"vV2_fieldA_a") ptr0 vV2_fieldA_a2
+
+deriving via Marshal.EquivStorable VV2_fieldA instance BG.Storable VV2_fieldA
+
+deriving via Struct.IsStructViaReadRaw VV2_fieldA instance Struct.IsStruct VV2_fieldA
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV2_fieldA_a" VV2_fieldA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV2_fieldA {vV2_fieldA_a = y1}, BG.getField @"vV2_fieldA_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV2_fieldA_a" (BG.Ptr VV2_fieldA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV2_fieldA_a")
+
+instance HasCField.HasCField VV2_fieldA "vV2_fieldA_a" where
+
+  type CFieldType VV2_fieldA "vV2_fieldA_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@VV2_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldB = VV2_fieldB
+  { vV2_fieldB_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV2_fieldB where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV2_fieldB where
+
+  readRaw =
+    \ptr0 ->
+          pure VV2_fieldB
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldB_b") ptr0
+
+instance Marshal.WriteRaw VV2_fieldB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV2_fieldB vV2_fieldB_b2 ->
+            HasCField.writeRaw (BG.Proxy @"vV2_fieldB_b") ptr0 vV2_fieldB_b2
+
+deriving via Marshal.EquivStorable VV2_fieldB instance BG.Storable VV2_fieldB
+
+deriving via Struct.IsStructViaReadRaw VV2_fieldB instance Struct.IsStruct VV2_fieldB
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV2_fieldB_b" VV2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV2_fieldB {vV2_fieldB_b = y1}, BG.getField @"vV2_fieldB_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV2_fieldB_b" (BG.Ptr VV2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV2_fieldB_b")
+
+instance HasCField.HasCField VV2_fieldB "vV2_fieldB_b" where
+
+  type CFieldType VV2_fieldB "vV2_fieldB_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct VV2@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2 = VV2
+  { vV2_fieldA :: VV2_fieldA
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  , vV2_fieldB :: VV2_fieldB
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV2 where
+
+  readRaw =
+    \ptr0 ->
+          pure VV2
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldB") ptr0
+
+instance Marshal.WriteRaw VV2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV2 vV2_fieldA2 vV2_fieldB3 ->
+               HasCField.writeRaw (BG.Proxy @"vV2_fieldA") ptr0 vV2_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"vV2_fieldB") ptr0 vV2_fieldB3
+
+deriving via Marshal.EquivStorable VV2 instance BG.Storable VV2
+
+deriving via Struct.IsStructViaReadRaw VV2 instance Struct.IsStruct VV2
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV2_fieldA
+         ) => BG.CompatHasField.HasField "vV2_fieldA" VV2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV2 {vV2_fieldA = y1, vV2_fieldB = BG.getField @"vV2_fieldB" x0}
+      , BG.getField @"vV2_fieldA" x0
+      )
+
+instance ( ty ~ VV2_fieldA
+         ) => BG.HasField "vV2_fieldA" (BG.Ptr VV2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV2_fieldA")
+
+instance HasCField.HasCField VV2 "vV2_fieldA" where
+
+  type CFieldType VV2 "vV2_fieldA" = VV2_fieldA
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV2_fieldB
+         ) => BG.CompatHasField.HasField "vV2_fieldB" VV2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV2 {vV2_fieldB = y1, vV2_fieldA = BG.getField @"vV2_fieldA" x0}
+      , BG.getField @"vV2_fieldB" x0
+      )
+
+instance ( ty ~ VV2_fieldB
+         ) => BG.HasField "vV2_fieldB" (BG.Ptr VV2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV2_fieldB")
+
+instance HasCField.HasCField VV2 "vV2_fieldB" where
+
+  type CFieldType VV2 "vV2_fieldB" = VV2_fieldB
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/wrong_source_location.2.raw/bindingspec.yaml b/test-artefacts/fixtures/macros/wrong_source_location.2.raw/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/wrong_source_location.2.raw/bindingspec.yaml
@@ -0,0 +1,234 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/wrong_source_location.h
+  cname: UU1
+  hsname: UU1
+- headers: macros/wrong_source_location.h
+  cname: struct @UU1_fieldY
+  hsname: UU1_fieldY
+- headers: macros/wrong_source_location.h
+  cname: struct UU1
+  hsname: UU1
+- headers: macros/wrong_source_location.h
+  cname: UU2
+  hsname: UU2
+- headers: macros/wrong_source_location.h
+  cname: struct @UU2_fieldY
+  hsname: UU2_fieldY
+- headers: macros/wrong_source_location.h
+  cname: struct UU2
+  hsname: UU2
+- headers: macros/wrong_source_location.h
+  cname: struct @VV1_fieldA
+  hsname: VV1_fieldA
+- headers: macros/wrong_source_location.h
+  cname: struct @VV1_fieldB
+  hsname: VV1_fieldB
+- headers: macros/wrong_source_location.h
+  cname: struct VV1
+  hsname: VV1
+- headers: macros/wrong_source_location.h
+  cname: struct @VV2_fieldA
+  hsname: VV2_fieldA
+- headers: macros/wrong_source_location.h
+  cname: struct @VV2_fieldB
+  hsname: VV2_fieldB
+- headers: macros/wrong_source_location.h
+  cname: struct VV2
+  hsname: VV2
+hstypes:
+- hsname: UU1
+  representation:
+    record:
+      constructor: UU1
+      fields:
+      - uU1_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU1_fieldY
+  representation:
+    record:
+      constructor: UU1_fieldY
+      fields:
+      - uU1_fieldY_fieldX
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU2
+  representation:
+    record:
+      constructor: UU2
+      fields:
+      - uU2_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU2_fieldY
+  representation:
+    record:
+      constructor: UU2_fieldY
+      fields:
+      - uU2_fieldY_fieldX
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV1
+  representation:
+    record:
+      constructor: VV1
+      fields:
+      - vV1_fieldA
+      - vV1_fieldB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV1_fieldA
+  representation:
+    record:
+      constructor: VV1_fieldA
+      fields:
+      - vV1_fieldA_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV1_fieldB
+  representation:
+    record:
+      constructor: VV1_fieldB
+      fields:
+      - vV1_fieldB_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV2
+  representation:
+    record:
+      constructor: VV2
+      fields:
+      - vV2_fieldA
+      - vV2_fieldB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV2_fieldA
+  representation:
+    record:
+      constructor: VV2_fieldA
+      fields:
+      - vV2_fieldA_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV2_fieldB
+  representation:
+    record:
+      constructor: VV2_fieldB
+      fields:
+      - vV2_fieldB_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/wrong_source_location.2.raw/th.txt b/test-artefacts/fixtures/macros/wrong_source_location.2.raw/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/wrong_source_location.2.raw/th.txt
@@ -0,0 +1,442 @@
+-- addDependentFile test-artefacts/headers/golden/macros/wrong_source_location.h
+{-| __C declaration:__ @macro NestedUnnamed@
+
+    __defined at:__ @macros\/wrong_source_location.h 12:9@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+nestedUnnamed :: Raw String
+{-| __C declaration:__ @macro NestedUnnamed@
+
+    __defined at:__ @macros\/wrong_source_location.h 12:9@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+nestedUnnamed = functionLike "NestedUnnamed" ["t1",
+                                              "n1",
+                                              "t2"] ["typedef",
+                                                     "t1",
+                                                     "{",
+                                                     "t2",
+                                                     "{",
+                                                     "int",
+                                                     "fieldX",
+                                                     ";",
+                                                     "}",
+                                                     "fieldY",
+                                                     ";",
+                                                     "}",
+                                                     "n1",
+                                                     ";"]
+{-| __C declaration:__ @struct \@UU1_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1_fieldY
+    = UU1_fieldY {uU1_fieldY_fieldX :: CInt
+                  {- ^ __C declaration:__ @fieldX@
+
+                       __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU1_fieldY
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU1_fieldY
+    where readRaw = \ptr_0 -> pure UU1_fieldY <*> readRaw (Proxy @"uU1_fieldY_fieldX") ptr_0
+instance WriteRaw UU1_fieldY
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU1_fieldY uU1_fieldY_fieldX_2 -> writeRaw (Proxy @"uU1_fieldY_fieldX") ptr_0 uU1_fieldY_fieldX_2
+deriving via (EquivStorable UU1_fieldY) instance Storable UU1_fieldY
+deriving via (IsStructViaReadRaw UU1_fieldY) instance IsStruct UU1_fieldY
+instance (~) ty CInt => HasField "uU1_fieldY_fieldX" UU1_fieldY ty
+    where hasField = \x_0 -> (\y_1 -> UU1_fieldY{uU1_fieldY_fieldX = y_1},
+                              getField @"uU1_fieldY_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "uU1_fieldY_fieldX" (Ptr UU1_fieldY) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU1_fieldY_fieldX")
+instance HasCField UU1_fieldY "uU1_fieldY_fieldX"
+    where type CFieldType UU1_fieldY "uU1_fieldY_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct UU1@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1
+    = UU1 {uU1_fieldY :: UU1_fieldY
+           {- ^ __C declaration:__ @fieldY@
+
+                __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU1
+    where readRaw = \ptr_0 -> pure UU1 <*> readRaw (Proxy @"uU1_fieldY") ptr_0
+instance WriteRaw UU1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU1 uU1_fieldY_2 -> writeRaw (Proxy @"uU1_fieldY") ptr_0 uU1_fieldY_2
+deriving via (EquivStorable UU1) instance Storable UU1
+deriving via (IsStructViaReadRaw UU1) instance IsStruct UU1
+instance (~) ty UU1_fieldY => HasField "uU1_fieldY" UU1 ty
+    where hasField = \x_0 -> (\y_1 -> UU1{uU1_fieldY = y_1},
+                              getField @"uU1_fieldY" x_0)
+instance (~) ty UU1_fieldY =>
+         HasField "uU1_fieldY" (Ptr UU1) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU1_fieldY")
+instance HasCField UU1 "uU1_fieldY"
+    where type CFieldType UU1 "uU1_fieldY" = UU1_fieldY
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@UU2_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2_fieldY
+    = UU2_fieldY {uU2_fieldY_fieldX :: CInt
+                  {- ^ __C declaration:__ @fieldX@
+
+                       __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU2_fieldY
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU2_fieldY
+    where readRaw = \ptr_0 -> pure UU2_fieldY <*> readRaw (Proxy @"uU2_fieldY_fieldX") ptr_0
+instance WriteRaw UU2_fieldY
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU2_fieldY uU2_fieldY_fieldX_2 -> writeRaw (Proxy @"uU2_fieldY_fieldX") ptr_0 uU2_fieldY_fieldX_2
+deriving via (EquivStorable UU2_fieldY) instance Storable UU2_fieldY
+deriving via (IsStructViaReadRaw UU2_fieldY) instance IsStruct UU2_fieldY
+instance (~) ty CInt => HasField "uU2_fieldY_fieldX" UU2_fieldY ty
+    where hasField = \x_0 -> (\y_1 -> UU2_fieldY{uU2_fieldY_fieldX = y_1},
+                              getField @"uU2_fieldY_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "uU2_fieldY_fieldX" (Ptr UU2_fieldY) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU2_fieldY_fieldX")
+instance HasCField UU2_fieldY "uU2_fieldY_fieldX"
+    where type CFieldType UU2_fieldY "uU2_fieldY_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct UU2@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2
+    = UU2 {uU2_fieldY :: UU2_fieldY
+           {- ^ __C declaration:__ @fieldY@
+
+                __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU2
+    where readRaw = \ptr_0 -> pure UU2 <*> readRaw (Proxy @"uU2_fieldY") ptr_0
+instance WriteRaw UU2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU2 uU2_fieldY_2 -> writeRaw (Proxy @"uU2_fieldY") ptr_0 uU2_fieldY_2
+deriving via (EquivStorable UU2) instance Storable UU2
+deriving via (IsStructViaReadRaw UU2) instance IsStruct UU2
+instance (~) ty UU2_fieldY => HasField "uU2_fieldY" UU2 ty
+    where hasField = \x_0 -> (\y_1 -> UU2{uU2_fieldY = y_1},
+                              getField @"uU2_fieldY" x_0)
+instance (~) ty UU2_fieldY =>
+         HasField "uU2_fieldY" (Ptr UU2) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU2_fieldY")
+instance HasCField UU2 "uU2_fieldY"
+    where type CFieldType UU2 "uU2_fieldY" = UU2_fieldY
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro TwoUntaggedStructs@
+
+    __defined at:__ @macros\/wrong_source_location.h 23:9@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+twoUntaggedStructs :: Raw String
+{-| __C declaration:__ @macro TwoUntaggedStructs@
+
+    __defined at:__ @macros\/wrong_source_location.h 23:9@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+twoUntaggedStructs = functionLike "TwoUntaggedStructs" ["name"] ["struct",
+                                                                 "name",
+                                                                 "{",
+                                                                 "struct",
+                                                                 "{",
+                                                                 "int",
+                                                                 "a",
+                                                                 ";",
+                                                                 "}",
+                                                                 "fieldA",
+                                                                 ";",
+                                                                 "struct",
+                                                                 "{",
+                                                                 "int",
+                                                                 "b",
+                                                                 ";",
+                                                                 "}",
+                                                                 "fieldB",
+                                                                 ";",
+                                                                 "}",
+                                                                 ";"]
+{-| __C declaration:__ @struct \@VV1_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldA
+    = VV1_fieldA {vV1_fieldA_a :: CInt
+                  {- ^ __C declaration:__ @a@
+
+                       __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV1_fieldA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV1_fieldA
+    where readRaw = \ptr_0 -> pure VV1_fieldA <*> readRaw (Proxy @"vV1_fieldA_a") ptr_0
+instance WriteRaw VV1_fieldA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV1_fieldA vV1_fieldA_a_2 -> writeRaw (Proxy @"vV1_fieldA_a") ptr_0 vV1_fieldA_a_2
+deriving via (EquivStorable VV1_fieldA) instance Storable VV1_fieldA
+deriving via (IsStructViaReadRaw VV1_fieldA) instance IsStruct VV1_fieldA
+instance (~) ty CInt => HasField "vV1_fieldA_a" VV1_fieldA ty
+    where hasField = \x_0 -> (\y_1 -> VV1_fieldA{vV1_fieldA_a = y_1},
+                              getField @"vV1_fieldA_a" x_0)
+instance (~) ty CInt =>
+         HasField "vV1_fieldA_a" (Ptr VV1_fieldA) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldA_a")
+instance HasCField VV1_fieldA "vV1_fieldA_a"
+    where type CFieldType VV1_fieldA "vV1_fieldA_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@VV1_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldB
+    = VV1_fieldB {vV1_fieldB_b :: CInt
+                  {- ^ __C declaration:__ @b@
+
+                       __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV1_fieldB
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV1_fieldB
+    where readRaw = \ptr_0 -> pure VV1_fieldB <*> readRaw (Proxy @"vV1_fieldB_b") ptr_0
+instance WriteRaw VV1_fieldB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV1_fieldB vV1_fieldB_b_2 -> writeRaw (Proxy @"vV1_fieldB_b") ptr_0 vV1_fieldB_b_2
+deriving via (EquivStorable VV1_fieldB) instance Storable VV1_fieldB
+deriving via (IsStructViaReadRaw VV1_fieldB) instance IsStruct VV1_fieldB
+instance (~) ty CInt => HasField "vV1_fieldB_b" VV1_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> VV1_fieldB{vV1_fieldB_b = y_1},
+                              getField @"vV1_fieldB_b" x_0)
+instance (~) ty CInt =>
+         HasField "vV1_fieldB_b" (Ptr VV1_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldB_b")
+instance HasCField VV1_fieldB "vV1_fieldB_b"
+    where type CFieldType VV1_fieldB "vV1_fieldB_b" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct VV1@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1
+    = VV1 {vV1_fieldA :: VV1_fieldA
+           {- ^ __C declaration:__ @fieldA@
+
+                __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -},
+           vV1_fieldB :: VV1_fieldB
+           {- ^ __C declaration:__ @fieldB@
+
+                __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV1
+    where readRaw = \ptr_0 -> (pure VV1 <*> readRaw (Proxy @"vV1_fieldA") ptr_0) <*> readRaw (Proxy @"vV1_fieldB") ptr_0
+instance WriteRaw VV1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV1 vV1_fieldA_2
+                                           vV1_fieldB_3 -> writeRaw (Proxy @"vV1_fieldA") ptr_0 vV1_fieldA_2 >> writeRaw (Proxy @"vV1_fieldB") ptr_0 vV1_fieldB_3
+deriving via (EquivStorable VV1) instance Storable VV1
+deriving via (IsStructViaReadRaw VV1) instance IsStruct VV1
+instance (~) ty VV1_fieldA => HasField "vV1_fieldA" VV1 ty
+    where hasField = \x_0 -> (\y_1 -> VV1{vV1_fieldA = y_1,
+                                          vV1_fieldB = getField @"vV1_fieldB" x_0},
+                              getField @"vV1_fieldA" x_0)
+instance (~) ty VV1_fieldA =>
+         HasField "vV1_fieldA" (Ptr VV1) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldA")
+instance HasCField VV1 "vV1_fieldA"
+    where type CFieldType VV1 "vV1_fieldA" = VV1_fieldA
+          offset# = \_ -> \_ -> 0
+instance (~) ty VV1_fieldB => HasField "vV1_fieldB" VV1 ty
+    where hasField = \x_0 -> (\y_1 -> VV1{vV1_fieldB = y_1,
+                                          vV1_fieldA = getField @"vV1_fieldA" x_0},
+                              getField @"vV1_fieldB" x_0)
+instance (~) ty VV1_fieldB =>
+         HasField "vV1_fieldB" (Ptr VV1) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldB")
+instance HasCField VV1 "vV1_fieldB"
+    where type CFieldType VV1 "vV1_fieldB" = VV1_fieldB
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@VV2_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldA
+    = VV2_fieldA {vV2_fieldA_a :: CInt
+                  {- ^ __C declaration:__ @a@
+
+                       __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV2_fieldA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV2_fieldA
+    where readRaw = \ptr_0 -> pure VV2_fieldA <*> readRaw (Proxy @"vV2_fieldA_a") ptr_0
+instance WriteRaw VV2_fieldA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV2_fieldA vV2_fieldA_a_2 -> writeRaw (Proxy @"vV2_fieldA_a") ptr_0 vV2_fieldA_a_2
+deriving via (EquivStorable VV2_fieldA) instance Storable VV2_fieldA
+deriving via (IsStructViaReadRaw VV2_fieldA) instance IsStruct VV2_fieldA
+instance (~) ty CInt => HasField "vV2_fieldA_a" VV2_fieldA ty
+    where hasField = \x_0 -> (\y_1 -> VV2_fieldA{vV2_fieldA_a = y_1},
+                              getField @"vV2_fieldA_a" x_0)
+instance (~) ty CInt =>
+         HasField "vV2_fieldA_a" (Ptr VV2_fieldA) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldA_a")
+instance HasCField VV2_fieldA "vV2_fieldA_a"
+    where type CFieldType VV2_fieldA "vV2_fieldA_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@VV2_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldB
+    = VV2_fieldB {vV2_fieldB_b :: CInt
+                  {- ^ __C declaration:__ @b@
+
+                       __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV2_fieldB
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV2_fieldB
+    where readRaw = \ptr_0 -> pure VV2_fieldB <*> readRaw (Proxy @"vV2_fieldB_b") ptr_0
+instance WriteRaw VV2_fieldB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV2_fieldB vV2_fieldB_b_2 -> writeRaw (Proxy @"vV2_fieldB_b") ptr_0 vV2_fieldB_b_2
+deriving via (EquivStorable VV2_fieldB) instance Storable VV2_fieldB
+deriving via (IsStructViaReadRaw VV2_fieldB) instance IsStruct VV2_fieldB
+instance (~) ty CInt => HasField "vV2_fieldB_b" VV2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> VV2_fieldB{vV2_fieldB_b = y_1},
+                              getField @"vV2_fieldB_b" x_0)
+instance (~) ty CInt =>
+         HasField "vV2_fieldB_b" (Ptr VV2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldB_b")
+instance HasCField VV2_fieldB "vV2_fieldB_b"
+    where type CFieldType VV2_fieldB "vV2_fieldB_b" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct VV2@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2
+    = VV2 {vV2_fieldA :: VV2_fieldA
+           {- ^ __C declaration:__ @fieldA@
+
+                __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -},
+           vV2_fieldB :: VV2_fieldB
+           {- ^ __C declaration:__ @fieldB@
+
+                __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV2
+    where readRaw = \ptr_0 -> (pure VV2 <*> readRaw (Proxy @"vV2_fieldA") ptr_0) <*> readRaw (Proxy @"vV2_fieldB") ptr_0
+instance WriteRaw VV2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV2 vV2_fieldA_2
+                                           vV2_fieldB_3 -> writeRaw (Proxy @"vV2_fieldA") ptr_0 vV2_fieldA_2 >> writeRaw (Proxy @"vV2_fieldB") ptr_0 vV2_fieldB_3
+deriving via (EquivStorable VV2) instance Storable VV2
+deriving via (IsStructViaReadRaw VV2) instance IsStruct VV2
+instance (~) ty VV2_fieldA => HasField "vV2_fieldA" VV2 ty
+    where hasField = \x_0 -> (\y_1 -> VV2{vV2_fieldA = y_1,
+                                          vV2_fieldB = getField @"vV2_fieldB" x_0},
+                              getField @"vV2_fieldA" x_0)
+instance (~) ty VV2_fieldA =>
+         HasField "vV2_fieldA" (Ptr VV2) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldA")
+instance HasCField VV2 "vV2_fieldA"
+    where type CFieldType VV2 "vV2_fieldA" = VV2_fieldA
+          offset# = \_ -> \_ -> 0
+instance (~) ty VV2_fieldB => HasField "vV2_fieldB" VV2 ty
+    where hasField = \x_0 -> (\y_1 -> VV2{vV2_fieldB = y_1,
+                                          vV2_fieldA = getField @"vV2_fieldA" x_0},
+                              getField @"vV2_fieldB" x_0)
+instance (~) ty VV2_fieldB =>
+         HasField "vV2_fieldB" (Ptr VV2) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldB")
+instance HasCField VV2 "vV2_fieldB"
+    where type CFieldType VV2 "vV2_fieldB" = VV2_fieldB
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/wrong_source_location/Example.hs b/test-artefacts/fixtures/macros/wrong_source_location/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/wrong_source_location/Example.hs
@@ -0,0 +1,801 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.UU1_fieldY(..)
+    , Example.UU1(..)
+    , Example.UU2_fieldY(..)
+    , Example.UU2(..)
+    , Example.VV1_fieldA(..)
+    , Example.VV1_fieldB(..)
+    , Example.VV1(..)
+    , Example.VV2_fieldA(..)
+    , Example.VV2_fieldB(..)
+    , Example.VV2(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@UU1_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1_fieldY = UU1_fieldY
+  { uU1_fieldY_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU1_fieldY where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU1_fieldY where
+
+  readRaw =
+    \ptr0 ->
+          pure UU1_fieldY
+      <*> HasCField.readRaw (BG.Proxy @"uU1_fieldY_fieldX") ptr0
+
+instance Marshal.WriteRaw UU1_fieldY where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU1_fieldY uU1_fieldY_fieldX2 ->
+            HasCField.writeRaw (BG.Proxy @"uU1_fieldY_fieldX") ptr0 uU1_fieldY_fieldX2
+
+deriving via Marshal.EquivStorable UU1_fieldY instance BG.Storable UU1_fieldY
+
+deriving via Struct.IsStructViaReadRaw UU1_fieldY instance Struct.IsStruct UU1_fieldY
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uU1_fieldY_fieldX" UU1_fieldY ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> UU1_fieldY {uU1_fieldY_fieldX = y1}
+      , BG.getField @"uU1_fieldY_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uU1_fieldY_fieldX" (BG.Ptr UU1_fieldY) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uU1_fieldY_fieldX")
+
+instance HasCField.HasCField UU1_fieldY "uU1_fieldY_fieldX" where
+
+  type CFieldType UU1_fieldY "uU1_fieldY_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct UU1@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1 = UU1
+  { uU1_fieldY :: UU1_fieldY
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU1 where
+
+  readRaw =
+    \ptr0 ->
+          pure UU1
+      <*> HasCField.readRaw (BG.Proxy @"uU1_fieldY") ptr0
+
+instance Marshal.WriteRaw UU1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU1 uU1_fieldY2 ->
+            HasCField.writeRaw (BG.Proxy @"uU1_fieldY") ptr0 uU1_fieldY2
+
+deriving via Marshal.EquivStorable UU1 instance BG.Storable UU1
+
+deriving via Struct.IsStructViaReadRaw UU1 instance Struct.IsStruct UU1
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ UU1_fieldY
+         ) => BG.CompatHasField.HasField "uU1_fieldY" UU1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         UU1 {uU1_fieldY = y1}, BG.getField @"uU1_fieldY" x0)
+
+instance ( ty ~ UU1_fieldY
+         ) => BG.HasField "uU1_fieldY" (BG.Ptr UU1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU1_fieldY")
+
+instance HasCField.HasCField UU1 "uU1_fieldY" where
+
+  type CFieldType UU1 "uU1_fieldY" = UU1_fieldY
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@UU2_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2_fieldY = UU2_fieldY
+  { uU2_fieldY_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU2_fieldY where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU2_fieldY where
+
+  readRaw =
+    \ptr0 ->
+          pure UU2_fieldY
+      <*> HasCField.readRaw (BG.Proxy @"uU2_fieldY_fieldX") ptr0
+
+instance Marshal.WriteRaw UU2_fieldY where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU2_fieldY uU2_fieldY_fieldX2 ->
+            HasCField.writeRaw (BG.Proxy @"uU2_fieldY_fieldX") ptr0 uU2_fieldY_fieldX2
+
+deriving via Marshal.EquivStorable UU2_fieldY instance BG.Storable UU2_fieldY
+
+deriving via Struct.IsStructViaReadRaw UU2_fieldY instance Struct.IsStruct UU2_fieldY
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uU2_fieldY_fieldX" UU2_fieldY ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> UU2_fieldY {uU2_fieldY_fieldX = y1}
+      , BG.getField @"uU2_fieldY_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uU2_fieldY_fieldX" (BG.Ptr UU2_fieldY) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uU2_fieldY_fieldX")
+
+instance HasCField.HasCField UU2_fieldY "uU2_fieldY_fieldX" where
+
+  type CFieldType UU2_fieldY "uU2_fieldY_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct UU2@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2 = UU2
+  { uU2_fieldY :: UU2_fieldY
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UU2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UU2 where
+
+  readRaw =
+    \ptr0 ->
+          pure UU2
+      <*> HasCField.readRaw (BG.Proxy @"uU2_fieldY") ptr0
+
+instance Marshal.WriteRaw UU2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UU2 uU2_fieldY2 ->
+            HasCField.writeRaw (BG.Proxy @"uU2_fieldY") ptr0 uU2_fieldY2
+
+deriving via Marshal.EquivStorable UU2 instance BG.Storable UU2
+
+deriving via Struct.IsStructViaReadRaw UU2 instance Struct.IsStruct UU2
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ UU2_fieldY
+         ) => BG.CompatHasField.HasField "uU2_fieldY" UU2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         UU2 {uU2_fieldY = y1}, BG.getField @"uU2_fieldY" x0)
+
+instance ( ty ~ UU2_fieldY
+         ) => BG.HasField "uU2_fieldY" (BG.Ptr UU2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU2_fieldY")
+
+instance HasCField.HasCField UU2 "uU2_fieldY" where
+
+  type CFieldType UU2 "uU2_fieldY" = UU2_fieldY
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@VV1_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldA = VV1_fieldA
+  { vV1_fieldA_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV1_fieldA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV1_fieldA where
+
+  readRaw =
+    \ptr0 ->
+          pure VV1_fieldA
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldA_a") ptr0
+
+instance Marshal.WriteRaw VV1_fieldA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV1_fieldA vV1_fieldA_a2 ->
+            HasCField.writeRaw (BG.Proxy @"vV1_fieldA_a") ptr0 vV1_fieldA_a2
+
+deriving via Marshal.EquivStorable VV1_fieldA instance BG.Storable VV1_fieldA
+
+deriving via Struct.IsStructViaReadRaw VV1_fieldA instance Struct.IsStruct VV1_fieldA
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV1_fieldA_a" VV1_fieldA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV1_fieldA {vV1_fieldA_a = y1}, BG.getField @"vV1_fieldA_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV1_fieldA_a" (BG.Ptr VV1_fieldA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV1_fieldA_a")
+
+instance HasCField.HasCField VV1_fieldA "vV1_fieldA_a" where
+
+  type CFieldType VV1_fieldA "vV1_fieldA_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@VV1_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldB = VV1_fieldB
+  { vV1_fieldB_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV1_fieldB where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV1_fieldB where
+
+  readRaw =
+    \ptr0 ->
+          pure VV1_fieldB
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldB_b") ptr0
+
+instance Marshal.WriteRaw VV1_fieldB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV1_fieldB vV1_fieldB_b2 ->
+            HasCField.writeRaw (BG.Proxy @"vV1_fieldB_b") ptr0 vV1_fieldB_b2
+
+deriving via Marshal.EquivStorable VV1_fieldB instance BG.Storable VV1_fieldB
+
+deriving via Struct.IsStructViaReadRaw VV1_fieldB instance Struct.IsStruct VV1_fieldB
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV1_fieldB_b" VV1_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV1_fieldB {vV1_fieldB_b = y1}, BG.getField @"vV1_fieldB_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV1_fieldB_b" (BG.Ptr VV1_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV1_fieldB_b")
+
+instance HasCField.HasCField VV1_fieldB "vV1_fieldB_b" where
+
+  type CFieldType VV1_fieldB "vV1_fieldB_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct VV1@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1 = VV1
+  { vV1_fieldA :: VV1_fieldA
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  , vV1_fieldB :: VV1_fieldB
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV1 where
+
+  readRaw =
+    \ptr0 ->
+          pure VV1
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"vV1_fieldB") ptr0
+
+instance Marshal.WriteRaw VV1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV1 vV1_fieldA2 vV1_fieldB3 ->
+               HasCField.writeRaw (BG.Proxy @"vV1_fieldA") ptr0 vV1_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"vV1_fieldB") ptr0 vV1_fieldB3
+
+deriving via Marshal.EquivStorable VV1 instance BG.Storable VV1
+
+deriving via Struct.IsStructViaReadRaw VV1 instance Struct.IsStruct VV1
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV1_fieldA
+         ) => BG.CompatHasField.HasField "vV1_fieldA" VV1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV1 {vV1_fieldA = y1, vV1_fieldB = BG.getField @"vV1_fieldB" x0}
+      , BG.getField @"vV1_fieldA" x0
+      )
+
+instance ( ty ~ VV1_fieldA
+         ) => BG.HasField "vV1_fieldA" (BG.Ptr VV1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV1_fieldA")
+
+instance HasCField.HasCField VV1 "vV1_fieldA" where
+
+  type CFieldType VV1 "vV1_fieldA" = VV1_fieldA
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV1_fieldB
+         ) => BG.CompatHasField.HasField "vV1_fieldB" VV1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV1 {vV1_fieldB = y1, vV1_fieldA = BG.getField @"vV1_fieldA" x0}
+      , BG.getField @"vV1_fieldB" x0
+      )
+
+instance ( ty ~ VV1_fieldB
+         ) => BG.HasField "vV1_fieldB" (BG.Ptr VV1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV1_fieldB")
+
+instance HasCField.HasCField VV1 "vV1_fieldB" where
+
+  type CFieldType VV1 "vV1_fieldB" = VV1_fieldB
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@VV2_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldA = VV2_fieldA
+  { vV2_fieldA_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV2_fieldA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV2_fieldA where
+
+  readRaw =
+    \ptr0 ->
+          pure VV2_fieldA
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldA_a") ptr0
+
+instance Marshal.WriteRaw VV2_fieldA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV2_fieldA vV2_fieldA_a2 ->
+            HasCField.writeRaw (BG.Proxy @"vV2_fieldA_a") ptr0 vV2_fieldA_a2
+
+deriving via Marshal.EquivStorable VV2_fieldA instance BG.Storable VV2_fieldA
+
+deriving via Struct.IsStructViaReadRaw VV2_fieldA instance Struct.IsStruct VV2_fieldA
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV2_fieldA_a" VV2_fieldA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV2_fieldA {vV2_fieldA_a = y1}, BG.getField @"vV2_fieldA_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV2_fieldA_a" (BG.Ptr VV2_fieldA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV2_fieldA_a")
+
+instance HasCField.HasCField VV2_fieldA "vV2_fieldA_a" where
+
+  type CFieldType VV2_fieldA "vV2_fieldA_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@VV2_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldB = VV2_fieldB
+  { vV2_fieldB_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV2_fieldB where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV2_fieldB where
+
+  readRaw =
+    \ptr0 ->
+          pure VV2_fieldB
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldB_b") ptr0
+
+instance Marshal.WriteRaw VV2_fieldB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV2_fieldB vV2_fieldB_b2 ->
+            HasCField.writeRaw (BG.Proxy @"vV2_fieldB_b") ptr0 vV2_fieldB_b2
+
+deriving via Marshal.EquivStorable VV2_fieldB instance BG.Storable VV2_fieldB
+
+deriving via Struct.IsStructViaReadRaw VV2_fieldB instance Struct.IsStruct VV2_fieldB
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "vV2_fieldB_b" VV2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         VV2_fieldB {vV2_fieldB_b = y1}, BG.getField @"vV2_fieldB_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "vV2_fieldB_b" (BG.Ptr VV2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"vV2_fieldB_b")
+
+instance HasCField.HasCField VV2_fieldB "vV2_fieldB_b" where
+
+  type CFieldType VV2_fieldB "vV2_fieldB_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct VV2@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2 = VV2
+  { vV2_fieldA :: VV2_fieldA
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  , vV2_fieldB :: VV2_fieldB
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+         __exported by:__ @macros\/wrong_source_location.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize VV2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw VV2 where
+
+  readRaw =
+    \ptr0 ->
+          pure VV2
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"vV2_fieldB") ptr0
+
+instance Marshal.WriteRaw VV2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          VV2 vV2_fieldA2 vV2_fieldB3 ->
+               HasCField.writeRaw (BG.Proxy @"vV2_fieldA") ptr0 vV2_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"vV2_fieldB") ptr0 vV2_fieldB3
+
+deriving via Marshal.EquivStorable VV2 instance BG.Storable VV2
+
+deriving via Struct.IsStructViaReadRaw VV2 instance Struct.IsStruct VV2
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV2_fieldA
+         ) => BG.CompatHasField.HasField "vV2_fieldA" VV2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV2 {vV2_fieldA = y1, vV2_fieldB = BG.getField @"vV2_fieldB" x0}
+      , BG.getField @"vV2_fieldA" x0
+      )
+
+instance ( ty ~ VV2_fieldA
+         ) => BG.HasField "vV2_fieldA" (BG.Ptr VV2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV2_fieldA")
+
+instance HasCField.HasCField VV2 "vV2_fieldA" where
+
+  type CFieldType VV2 "vV2_fieldA" = VV2_fieldA
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+instance ( ty ~ VV2_fieldB
+         ) => BG.CompatHasField.HasField "vV2_fieldB" VV2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          VV2 {vV2_fieldB = y1, vV2_fieldA = BG.getField @"vV2_fieldA" x0}
+      , BG.getField @"vV2_fieldB" x0
+      )
+
+instance ( ty ~ VV2_fieldB
+         ) => BG.HasField "vV2_fieldB" (BG.Ptr VV2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vV2_fieldB")
+
+instance HasCField.HasCField VV2 "vV2_fieldB" where
+
+  type CFieldType VV2 "vV2_fieldB" = VV2_fieldB
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/macros/wrong_source_location/bindingspec.yaml b/test-artefacts/fixtures/macros/wrong_source_location/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/wrong_source_location/bindingspec.yaml
@@ -0,0 +1,234 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: macros/wrong_source_location.h
+  cname: UU1
+  hsname: UU1
+- headers: macros/wrong_source_location.h
+  cname: struct @UU1_fieldY
+  hsname: UU1_fieldY
+- headers: macros/wrong_source_location.h
+  cname: struct UU1
+  hsname: UU1
+- headers: macros/wrong_source_location.h
+  cname: UU2
+  hsname: UU2
+- headers: macros/wrong_source_location.h
+  cname: struct @UU2_fieldY
+  hsname: UU2_fieldY
+- headers: macros/wrong_source_location.h
+  cname: struct UU2
+  hsname: UU2
+- headers: macros/wrong_source_location.h
+  cname: struct @VV1_fieldA
+  hsname: VV1_fieldA
+- headers: macros/wrong_source_location.h
+  cname: struct @VV1_fieldB
+  hsname: VV1_fieldB
+- headers: macros/wrong_source_location.h
+  cname: struct VV1
+  hsname: VV1
+- headers: macros/wrong_source_location.h
+  cname: struct @VV2_fieldA
+  hsname: VV2_fieldA
+- headers: macros/wrong_source_location.h
+  cname: struct @VV2_fieldB
+  hsname: VV2_fieldB
+- headers: macros/wrong_source_location.h
+  cname: struct VV2
+  hsname: VV2
+hstypes:
+- hsname: UU1
+  representation:
+    record:
+      constructor: UU1
+      fields:
+      - uU1_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU1_fieldY
+  representation:
+    record:
+      constructor: UU1_fieldY
+      fields:
+      - uU1_fieldY_fieldX
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU2
+  representation:
+    record:
+      constructor: UU2
+      fields:
+      - uU2_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU2_fieldY
+  representation:
+    record:
+      constructor: UU2_fieldY
+      fields:
+      - uU2_fieldY_fieldX
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV1
+  representation:
+    record:
+      constructor: VV1
+      fields:
+      - vV1_fieldA
+      - vV1_fieldB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV1_fieldA
+  representation:
+    record:
+      constructor: VV1_fieldA
+      fields:
+      - vV1_fieldA_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV1_fieldB
+  representation:
+    record:
+      constructor: VV1_fieldB
+      fields:
+      - vV1_fieldB_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV2
+  representation:
+    record:
+      constructor: VV2
+      fields:
+      - vV2_fieldA
+      - vV2_fieldB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV2_fieldA
+  representation:
+    record:
+      constructor: VV2_fieldA
+      fields:
+      - vV2_fieldA_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: VV2_fieldB
+  representation:
+    record:
+      constructor: VV2_fieldB
+      fields:
+      - vV2_fieldB_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/macros/wrong_source_location/th.txt b/test-artefacts/fixtures/macros/wrong_source_location/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/macros/wrong_source_location/th.txt
@@ -0,0 +1,379 @@
+-- addDependentFile test-artefacts/headers/golden/macros/wrong_source_location.h
+{-| __C declaration:__ @struct \@UU1_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1_fieldY
+    = UU1_fieldY {uU1_fieldY_fieldX :: CInt
+                  {- ^ __C declaration:__ @fieldX@
+
+                       __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU1_fieldY
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU1_fieldY
+    where readRaw = \ptr_0 -> pure UU1_fieldY <*> readRaw (Proxy @"uU1_fieldY_fieldX") ptr_0
+instance WriteRaw UU1_fieldY
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU1_fieldY uU1_fieldY_fieldX_2 -> writeRaw (Proxy @"uU1_fieldY_fieldX") ptr_0 uU1_fieldY_fieldX_2
+deriving via (EquivStorable UU1_fieldY) instance Storable UU1_fieldY
+deriving via (IsStructViaReadRaw UU1_fieldY) instance IsStruct UU1_fieldY
+instance (~) ty CInt => HasField "uU1_fieldY_fieldX" UU1_fieldY ty
+    where hasField = \x_0 -> (\y_1 -> UU1_fieldY{uU1_fieldY_fieldX = y_1},
+                              getField @"uU1_fieldY_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "uU1_fieldY_fieldX" (Ptr UU1_fieldY) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU1_fieldY_fieldX")
+instance HasCField UU1_fieldY "uU1_fieldY_fieldX"
+    where type CFieldType UU1_fieldY "uU1_fieldY_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct UU1@
+
+    __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU1
+    = UU1 {uU1_fieldY :: UU1_fieldY
+           {- ^ __C declaration:__ @fieldY@
+
+                __defined at:__ @macros\/wrong_source_location.h 19:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU1
+    where readRaw = \ptr_0 -> pure UU1 <*> readRaw (Proxy @"uU1_fieldY") ptr_0
+instance WriteRaw UU1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU1 uU1_fieldY_2 -> writeRaw (Proxy @"uU1_fieldY") ptr_0 uU1_fieldY_2
+deriving via (EquivStorable UU1) instance Storable UU1
+deriving via (IsStructViaReadRaw UU1) instance IsStruct UU1
+instance (~) ty UU1_fieldY => HasField "uU1_fieldY" UU1 ty
+    where hasField = \x_0 -> (\y_1 -> UU1{uU1_fieldY = y_1},
+                              getField @"uU1_fieldY" x_0)
+instance (~) ty UU1_fieldY =>
+         HasField "uU1_fieldY" (Ptr UU1) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU1_fieldY")
+instance HasCField UU1 "uU1_fieldY"
+    where type CFieldType UU1 "uU1_fieldY" = UU1_fieldY
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@UU2_fieldY@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2_fieldY
+    = UU2_fieldY {uU2_fieldY_fieldX :: CInt
+                  {- ^ __C declaration:__ @fieldX@
+
+                       __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU2_fieldY
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU2_fieldY
+    where readRaw = \ptr_0 -> pure UU2_fieldY <*> readRaw (Proxy @"uU2_fieldY_fieldX") ptr_0
+instance WriteRaw UU2_fieldY
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU2_fieldY uU2_fieldY_fieldX_2 -> writeRaw (Proxy @"uU2_fieldY_fieldX") ptr_0 uU2_fieldY_fieldX_2
+deriving via (EquivStorable UU2_fieldY) instance Storable UU2_fieldY
+deriving via (IsStructViaReadRaw UU2_fieldY) instance IsStruct UU2_fieldY
+instance (~) ty CInt => HasField "uU2_fieldY_fieldX" UU2_fieldY ty
+    where hasField = \x_0 -> (\y_1 -> UU2_fieldY{uU2_fieldY_fieldX = y_1},
+                              getField @"uU2_fieldY_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "uU2_fieldY_fieldX" (Ptr UU2_fieldY) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU2_fieldY_fieldX")
+instance HasCField UU2_fieldY "uU2_fieldY_fieldX"
+    where type CFieldType UU2_fieldY "uU2_fieldY_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct UU2@
+
+    __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data UU2
+    = UU2 {uU2_fieldY :: UU2_fieldY
+           {- ^ __C declaration:__ @fieldY@
+
+                __defined at:__ @macros\/wrong_source_location.h 21:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UU2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UU2
+    where readRaw = \ptr_0 -> pure UU2 <*> readRaw (Proxy @"uU2_fieldY") ptr_0
+instance WriteRaw UU2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UU2 uU2_fieldY_2 -> writeRaw (Proxy @"uU2_fieldY") ptr_0 uU2_fieldY_2
+deriving via (EquivStorable UU2) instance Storable UU2
+deriving via (IsStructViaReadRaw UU2) instance IsStruct UU2
+instance (~) ty UU2_fieldY => HasField "uU2_fieldY" UU2 ty
+    where hasField = \x_0 -> (\y_1 -> UU2{uU2_fieldY = y_1},
+                              getField @"uU2_fieldY" x_0)
+instance (~) ty UU2_fieldY =>
+         HasField "uU2_fieldY" (Ptr UU2) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU2_fieldY")
+instance HasCField UU2 "uU2_fieldY"
+    where type CFieldType UU2 "uU2_fieldY" = UU2_fieldY
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@VV1_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldA
+    = VV1_fieldA {vV1_fieldA_a :: CInt
+                  {- ^ __C declaration:__ @a@
+
+                       __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV1_fieldA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV1_fieldA
+    where readRaw = \ptr_0 -> pure VV1_fieldA <*> readRaw (Proxy @"vV1_fieldA_a") ptr_0
+instance WriteRaw VV1_fieldA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV1_fieldA vV1_fieldA_a_2 -> writeRaw (Proxy @"vV1_fieldA_a") ptr_0 vV1_fieldA_a_2
+deriving via (EquivStorable VV1_fieldA) instance Storable VV1_fieldA
+deriving via (IsStructViaReadRaw VV1_fieldA) instance IsStruct VV1_fieldA
+instance (~) ty CInt => HasField "vV1_fieldA_a" VV1_fieldA ty
+    where hasField = \x_0 -> (\y_1 -> VV1_fieldA{vV1_fieldA_a = y_1},
+                              getField @"vV1_fieldA_a" x_0)
+instance (~) ty CInt =>
+         HasField "vV1_fieldA_a" (Ptr VV1_fieldA) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldA_a")
+instance HasCField VV1_fieldA "vV1_fieldA_a"
+    where type CFieldType VV1_fieldA "vV1_fieldA_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@VV1_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1_fieldB
+    = VV1_fieldB {vV1_fieldB_b :: CInt
+                  {- ^ __C declaration:__ @b@
+
+                       __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV1_fieldB
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV1_fieldB
+    where readRaw = \ptr_0 -> pure VV1_fieldB <*> readRaw (Proxy @"vV1_fieldB_b") ptr_0
+instance WriteRaw VV1_fieldB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV1_fieldB vV1_fieldB_b_2 -> writeRaw (Proxy @"vV1_fieldB_b") ptr_0 vV1_fieldB_b_2
+deriving via (EquivStorable VV1_fieldB) instance Storable VV1_fieldB
+deriving via (IsStructViaReadRaw VV1_fieldB) instance IsStruct VV1_fieldB
+instance (~) ty CInt => HasField "vV1_fieldB_b" VV1_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> VV1_fieldB{vV1_fieldB_b = y_1},
+                              getField @"vV1_fieldB_b" x_0)
+instance (~) ty CInt =>
+         HasField "vV1_fieldB_b" (Ptr VV1_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldB_b")
+instance HasCField VV1_fieldB "vV1_fieldB_b"
+    where type CFieldType VV1_fieldB "vV1_fieldB_b" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct VV1@
+
+    __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV1
+    = VV1 {vV1_fieldA :: VV1_fieldA
+           {- ^ __C declaration:__ @fieldA@
+
+                __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -},
+           vV1_fieldB :: VV1_fieldB
+           {- ^ __C declaration:__ @fieldB@
+
+                __defined at:__ @macros\/wrong_source_location.h 29:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV1
+    where readRaw = \ptr_0 -> (pure VV1 <*> readRaw (Proxy @"vV1_fieldA") ptr_0) <*> readRaw (Proxy @"vV1_fieldB") ptr_0
+instance WriteRaw VV1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV1 vV1_fieldA_2
+                                           vV1_fieldB_3 -> writeRaw (Proxy @"vV1_fieldA") ptr_0 vV1_fieldA_2 >> writeRaw (Proxy @"vV1_fieldB") ptr_0 vV1_fieldB_3
+deriving via (EquivStorable VV1) instance Storable VV1
+deriving via (IsStructViaReadRaw VV1) instance IsStruct VV1
+instance (~) ty VV1_fieldA => HasField "vV1_fieldA" VV1 ty
+    where hasField = \x_0 -> (\y_1 -> VV1{vV1_fieldA = y_1,
+                                          vV1_fieldB = getField @"vV1_fieldB" x_0},
+                              getField @"vV1_fieldA" x_0)
+instance (~) ty VV1_fieldA =>
+         HasField "vV1_fieldA" (Ptr VV1) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldA")
+instance HasCField VV1 "vV1_fieldA"
+    where type CFieldType VV1 "vV1_fieldA" = VV1_fieldA
+          offset# = \_ -> \_ -> 0
+instance (~) ty VV1_fieldB => HasField "vV1_fieldB" VV1 ty
+    where hasField = \x_0 -> (\y_1 -> VV1{vV1_fieldB = y_1,
+                                          vV1_fieldA = getField @"vV1_fieldA" x_0},
+                              getField @"vV1_fieldB" x_0)
+instance (~) ty VV1_fieldB =>
+         HasField "vV1_fieldB" (Ptr VV1) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV1_fieldB")
+instance HasCField VV1 "vV1_fieldB"
+    where type CFieldType VV1 "vV1_fieldB" = VV1_fieldB
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@VV2_fieldA@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldA
+    = VV2_fieldA {vV2_fieldA_a :: CInt
+                  {- ^ __C declaration:__ @a@
+
+                       __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV2_fieldA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV2_fieldA
+    where readRaw = \ptr_0 -> pure VV2_fieldA <*> readRaw (Proxy @"vV2_fieldA_a") ptr_0
+instance WriteRaw VV2_fieldA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV2_fieldA vV2_fieldA_a_2 -> writeRaw (Proxy @"vV2_fieldA_a") ptr_0 vV2_fieldA_a_2
+deriving via (EquivStorable VV2_fieldA) instance Storable VV2_fieldA
+deriving via (IsStructViaReadRaw VV2_fieldA) instance IsStruct VV2_fieldA
+instance (~) ty CInt => HasField "vV2_fieldA_a" VV2_fieldA ty
+    where hasField = \x_0 -> (\y_1 -> VV2_fieldA{vV2_fieldA_a = y_1},
+                              getField @"vV2_fieldA_a" x_0)
+instance (~) ty CInt =>
+         HasField "vV2_fieldA_a" (Ptr VV2_fieldA) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldA_a")
+instance HasCField VV2_fieldA "vV2_fieldA_a"
+    where type CFieldType VV2_fieldA "vV2_fieldA_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@VV2_fieldB@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2_fieldB
+    = VV2_fieldB {vV2_fieldB_b :: CInt
+                  {- ^ __C declaration:__ @b@
+
+                       __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                       __exported by:__ @macros\/wrong_source_location.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV2_fieldB
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV2_fieldB
+    where readRaw = \ptr_0 -> pure VV2_fieldB <*> readRaw (Proxy @"vV2_fieldB_b") ptr_0
+instance WriteRaw VV2_fieldB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV2_fieldB vV2_fieldB_b_2 -> writeRaw (Proxy @"vV2_fieldB_b") ptr_0 vV2_fieldB_b_2
+deriving via (EquivStorable VV2_fieldB) instance Storable VV2_fieldB
+deriving via (IsStructViaReadRaw VV2_fieldB) instance IsStruct VV2_fieldB
+instance (~) ty CInt => HasField "vV2_fieldB_b" VV2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> VV2_fieldB{vV2_fieldB_b = y_1},
+                              getField @"vV2_fieldB_b" x_0)
+instance (~) ty CInt =>
+         HasField "vV2_fieldB_b" (Ptr VV2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldB_b")
+instance HasCField VV2_fieldB "vV2_fieldB_b"
+    where type CFieldType VV2_fieldB "vV2_fieldB_b" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct VV2@
+
+    __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+    __exported by:__ @macros\/wrong_source_location.h@
+-}
+data VV2
+    = VV2 {vV2_fieldA :: VV2_fieldA
+           {- ^ __C declaration:__ @fieldA@
+
+                __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -},
+           vV2_fieldB :: VV2_fieldB
+           {- ^ __C declaration:__ @fieldB@
+
+                __defined at:__ @macros\/wrong_source_location.h 31:1@
+
+                __exported by:__ @macros\/wrong_source_location.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize VV2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw VV2
+    where readRaw = \ptr_0 -> (pure VV2 <*> readRaw (Proxy @"vV2_fieldA") ptr_0) <*> readRaw (Proxy @"vV2_fieldB") ptr_0
+instance WriteRaw VV2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       VV2 vV2_fieldA_2
+                                           vV2_fieldB_3 -> writeRaw (Proxy @"vV2_fieldA") ptr_0 vV2_fieldA_2 >> writeRaw (Proxy @"vV2_fieldB") ptr_0 vV2_fieldB_3
+deriving via (EquivStorable VV2) instance Storable VV2
+deriving via (IsStructViaReadRaw VV2) instance IsStruct VV2
+instance (~) ty VV2_fieldA => HasField "vV2_fieldA" VV2 ty
+    where hasField = \x_0 -> (\y_1 -> VV2{vV2_fieldA = y_1,
+                                          vV2_fieldB = getField @"vV2_fieldB" x_0},
+                              getField @"vV2_fieldA" x_0)
+instance (~) ty VV2_fieldA =>
+         HasField "vV2_fieldA" (Ptr VV2) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldA")
+instance HasCField VV2 "vV2_fieldA"
+    where type CFieldType VV2 "vV2_fieldA" = VV2_fieldA
+          offset# = \_ -> \_ -> 0
+instance (~) ty VV2_fieldB => HasField "vV2_fieldB" VV2 ty
+    where hasField = \x_0 -> (\y_1 -> VV2{vV2_fieldB = y_1,
+                                          vV2_fieldA = getField @"vV2_fieldA" x_0},
+                              getField @"vV2_fieldB" x_0)
+instance (~) ty VV2_fieldB =>
+         HasField "vV2_fieldB" (Ptr VV2) (Ptr ty)
+    where getField = fromPtr (Proxy @"vV2_fieldB")
+instance HasCField VV2 "vV2_fieldB"
+    where type CFieldType VV2 "vV2_fieldB" = VV2_fieldB
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/program-analysis/circular_includes/Example.hs b/test-artefacts/fixtures/program-analysis/circular_includes/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/circular_includes/Example.hs
@@ -0,0 +1,128 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.OUTER_BEFORE_CIRCULAR_INCLUDE(..)
+    , Example.OUTER_AFTER_CIRCULAR_INCLUDE(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @OUTER_BEFORE_CIRCULAR_INCLUDE@
+
+    __defined at:__ @program-analysis\/circular_includes.h 2:13@
+
+    __exported by:__ @program-analysis\/circular_includes.h@
+-}
+newtype OUTER_BEFORE_CIRCULAR_INCLUDE = OUTER_BEFORE_CIRCULAR_INCLUDE
+  { unwrapOUTER_BEFORE_CIRCULAR_INCLUDE :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapOUTER_BEFORE_CIRCULAR_INCLUDE" OUTER_BEFORE_CIRCULAR_INCLUDE ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          OUTER_BEFORE_CIRCULAR_INCLUDE {unwrapOUTER_BEFORE_CIRCULAR_INCLUDE = y1}
+      , BG.getField @"unwrapOUTER_BEFORE_CIRCULAR_INCLUDE" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapOUTER_BEFORE_CIRCULAR_INCLUDE" (BG.Ptr OUTER_BEFORE_CIRCULAR_INCLUDE) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapOUTER_BEFORE_CIRCULAR_INCLUDE")
+
+instance HasCField.HasCField OUTER_BEFORE_CIRCULAR_INCLUDE "unwrapOUTER_BEFORE_CIRCULAR_INCLUDE" where
+
+  type CFieldType OUTER_BEFORE_CIRCULAR_INCLUDE "unwrapOUTER_BEFORE_CIRCULAR_INCLUDE" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @OUTER_AFTER_CIRCULAR_INCLUDE@
+
+    __defined at:__ @program-analysis\/circular_includes.h 4:13@
+
+    __exported by:__ @program-analysis\/circular_includes.h@
+-}
+newtype OUTER_AFTER_CIRCULAR_INCLUDE = OUTER_AFTER_CIRCULAR_INCLUDE
+  { unwrapOUTER_AFTER_CIRCULAR_INCLUDE :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapOUTER_AFTER_CIRCULAR_INCLUDE" OUTER_AFTER_CIRCULAR_INCLUDE ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          OUTER_AFTER_CIRCULAR_INCLUDE {unwrapOUTER_AFTER_CIRCULAR_INCLUDE = y1}
+      , BG.getField @"unwrapOUTER_AFTER_CIRCULAR_INCLUDE" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapOUTER_AFTER_CIRCULAR_INCLUDE" (BG.Ptr OUTER_AFTER_CIRCULAR_INCLUDE) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapOUTER_AFTER_CIRCULAR_INCLUDE")
+
+instance HasCField.HasCField OUTER_AFTER_CIRCULAR_INCLUDE "unwrapOUTER_AFTER_CIRCULAR_INCLUDE" where
+
+  type CFieldType OUTER_AFTER_CIRCULAR_INCLUDE "unwrapOUTER_AFTER_CIRCULAR_INCLUDE" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/circular_includes/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/circular_includes/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/circular_includes/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/circular_includes.h
+  cname: OUTER_BEFORE_CIRCULAR_INCLUDE
+  hsname: OUTER_BEFORE_CIRCULAR_INCLUDE
+- headers: program-analysis/circular_includes.h
+  cname: OUTER_AFTER_CIRCULAR_INCLUDE
+  hsname: OUTER_AFTER_CIRCULAR_INCLUDE
+hstypes:
+- hsname: OUTER_AFTER_CIRCULAR_INCLUDE
+  representation:
+    newtype:
+      constructor: OUTER_AFTER_CIRCULAR_INCLUDE
+      fields:
+      - unwrapOUTER_AFTER_CIRCULAR_INCLUDE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: OUTER_BEFORE_CIRCULAR_INCLUDE
+  representation:
+    newtype:
+      constructor: OUTER_BEFORE_CIRCULAR_INCLUDE
+      fields:
+      - unwrapOUTER_BEFORE_CIRCULAR_INCLUDE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/circular_includes/th.txt b/test-artefacts/fixtures/program-analysis/circular_includes/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/circular_includes/th.txt
@@ -0,0 +1,82 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/circular_includes.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/circular_includes_inner.h
+{-| __C declaration:__ @OUTER_BEFORE_CIRCULAR_INCLUDE@
+
+    __defined at:__ @program-analysis\/circular_includes.h 2:13@
+
+    __exported by:__ @program-analysis\/circular_includes.h@
+-}
+newtype OUTER_BEFORE_CIRCULAR_INCLUDE
+    = OUTER_BEFORE_CIRCULAR_INCLUDE {unwrapOUTER_BEFORE_CIRCULAR_INCLUDE :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapOUTER_BEFORE_CIRCULAR_INCLUDE"
+                  OUTER_BEFORE_CIRCULAR_INCLUDE
+                  ty
+    where hasField = \x_0 -> (\y_1 -> OUTER_BEFORE_CIRCULAR_INCLUDE{unwrapOUTER_BEFORE_CIRCULAR_INCLUDE = y_1},
+                              getField @"unwrapOUTER_BEFORE_CIRCULAR_INCLUDE" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapOUTER_BEFORE_CIRCULAR_INCLUDE"
+                  (Ptr OUTER_BEFORE_CIRCULAR_INCLUDE)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapOUTER_BEFORE_CIRCULAR_INCLUDE")
+instance HasCField OUTER_BEFORE_CIRCULAR_INCLUDE
+                   "unwrapOUTER_BEFORE_CIRCULAR_INCLUDE"
+    where type CFieldType OUTER_BEFORE_CIRCULAR_INCLUDE
+                          "unwrapOUTER_BEFORE_CIRCULAR_INCLUDE" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @OUTER_AFTER_CIRCULAR_INCLUDE@
+
+    __defined at:__ @program-analysis\/circular_includes.h 4:13@
+
+    __exported by:__ @program-analysis\/circular_includes.h@
+-}
+newtype OUTER_AFTER_CIRCULAR_INCLUDE
+    = OUTER_AFTER_CIRCULAR_INCLUDE {unwrapOUTER_AFTER_CIRCULAR_INCLUDE :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapOUTER_AFTER_CIRCULAR_INCLUDE"
+                  OUTER_AFTER_CIRCULAR_INCLUDE
+                  ty
+    where hasField = \x_0 -> (\y_1 -> OUTER_AFTER_CIRCULAR_INCLUDE{unwrapOUTER_AFTER_CIRCULAR_INCLUDE = y_1},
+                              getField @"unwrapOUTER_AFTER_CIRCULAR_INCLUDE" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapOUTER_AFTER_CIRCULAR_INCLUDE"
+                  (Ptr OUTER_AFTER_CIRCULAR_INCLUDE)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapOUTER_AFTER_CIRCULAR_INCLUDE")
+instance HasCField OUTER_AFTER_CIRCULAR_INCLUDE
+                   "unwrapOUTER_AFTER_CIRCULAR_INCLUDE"
+    where type CFieldType OUTER_AFTER_CIRCULAR_INCLUDE
+                          "unwrapOUTER_AFTER_CIRCULAR_INCLUDE" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/circular_macro/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/circular_macro/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/circular_macro/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/program-analysis/circular_macro/th.txt b/test-artefacts/fixtures/program-analysis/circular_macro/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/circular_macro/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/circular_macro.h
diff --git a/test-artefacts/fixtures/program-analysis/delay_traces/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/delay_traces/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/delay_traces/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/program-analysis/delay_traces/th.txt b/test-artefacts/fixtures/program-analysis/delay_traces/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/delay_traces/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/delay_traces.h
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example.hs b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example.hs
@@ -0,0 +1,114 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , Example.U(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macro_selected_t.h 3:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 9:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+newtype U = U
+  { unwrapU :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapU" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> U {unwrapU = y1}, BG.getField @"unwrapU" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapU" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapU")
+
+instance HasCField.HasCField U "unwrapU" where
+
+  type CFieldType U "unwrapU" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example/FunPtr.hs b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example/FunPtr.hs
@@ -0,0 +1,73 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/macro_selected.h>"
+  , "/* test_programanalysisprogramslici_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7fa7d51da57eb497 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_programanalysisprogramslici_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e57577b970e09cca (void)) ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_7fa7d51da57eb497" hs_bindgen_7fa7d51da57eb497_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+hs_bindgen_7fa7d51da57eb497 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_7fa7d51da57eb497 =
+  fmap BG.fromFFIType hs_bindgen_7fa7d51da57eb497_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+foo :: BG.FunPtr (T -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_7fa7d51da57eb497
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_e57577b970e09cca" hs_bindgen_e57577b970e09cca_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca :: IO (BG.FunPtr (U -> IO ()))
+hs_bindgen_e57577b970e09cca =
+  fmap BG.fromFFIType hs_bindgen_e57577b970e09cca_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+bar :: BG.FunPtr (U -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_e57577b970e09cca
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example/Safe.hs b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example/Safe.hs
@@ -0,0 +1,81 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/macro_selected.h>"
+  , "void hs_bindgen_27fdf7030b0bb40d ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_ef8f97cf27661c20 ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_27fdf7030b0bb40d" hs_bindgen_27fdf7030b0bb40d_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+hs_bindgen_27fdf7030b0bb40d ::
+     T
+  -> IO ()
+hs_bindgen_27fdf7030b0bb40d =
+  \x0 ->
+    hs_bindgen_27fdf7030b0bb40d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+foo ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_27fdf7030b0bb40d
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_ef8f97cf27661c20" hs_bindgen_ef8f97cf27661c20_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 ::
+     U
+  -> IO ()
+hs_bindgen_ef8f97cf27661c20 =
+  \x0 ->
+    hs_bindgen_ef8f97cf27661c20_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+bar ::
+     U
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_ef8f97cf27661c20
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example/Unsafe.hs b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/Example/Unsafe.hs
@@ -0,0 +1,81 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/macro_selected.h>"
+  , "void hs_bindgen_72197c1a408e40ac ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_401f15168ffec8ae ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_72197c1a408e40ac" hs_bindgen_72197c1a408e40ac_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+hs_bindgen_72197c1a408e40ac ::
+     T
+  -> IO ()
+hs_bindgen_72197c1a408e40ac =
+  \x0 ->
+    hs_bindgen_72197c1a408e40ac_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+foo ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_72197c1a408e40ac
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_401f15168ffec8ae" hs_bindgen_401f15168ffec8ae_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae ::
+     U
+  -> IO ()
+hs_bindgen_401f15168ffec8ae =
+  \x0 ->
+    hs_bindgen_401f15168ffec8ae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+bar ::
+     U
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_401f15168ffec8ae
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/program-slicing/macro_selected.h
+  cname: macro T
+  hsname: T
+- headers: program-analysis/program-slicing/macro_selected.h
+  cname: macro U
+  hsname: U
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/th.txt b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_selected/th.txt
@@ -0,0 +1,239 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program-slicing/macro_selected_t.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program-slicing/macro_selected.h
+-- #include <program-analysis/program-slicing/macro_selected.h>
+-- void hs_bindgen_27fdf7030b0bb40d (
+--   T arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_ef8f97cf27661c20 (
+--   U arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_72197c1a408e40ac (
+--   T arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_401f15168ffec8ae (
+--   U arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_programanalysisprogramslici_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7fa7d51da57eb497 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_programanalysisprogramslici_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e57577b970e09cca (void)) (
+--   U arg1
+-- )
+-- {
+--   return &bar;
+-- }
+{-| __C declaration:__ @macro T@
+
+    __defined at:__ @macro_selected_t.h 3:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+newtype T
+    = T {unwrapT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 9:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+newtype U
+    = U {unwrapU :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapU" U ty
+    where hasField = \x_0 -> (\y_1 -> U{unwrapU = y_1},
+                              getField @"unwrapU" x_0)
+instance (~) ty CInt => HasField "unwrapU" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapU")
+instance HasCField U "unwrapU"
+    where type CFieldType U "unwrapU" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_27fdf7030b0bb40d" hs_bindgen_27fdf7030b0bb40d_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+hs_bindgen_27fdf7030b0bb40d :: T -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+hs_bindgen_27fdf7030b0bb40d = \x_0 -> hs_bindgen_27fdf7030b0bb40d_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+foo_safe :: T -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+foo_safe = hs_bindgen_27fdf7030b0bb40d
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_ef8f97cf27661c20" hs_bindgen_ef8f97cf27661c20_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 :: U -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 = \x_0 -> hs_bindgen_ef8f97cf27661c20_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+bar_safe :: U -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+bar_safe = hs_bindgen_ef8f97cf27661c20
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_72197c1a408e40ac" hs_bindgen_72197c1a408e40ac_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+hs_bindgen_72197c1a408e40ac :: T -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+hs_bindgen_72197c1a408e40ac = \x_0 -> hs_bindgen_72197c1a408e40ac_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+foo_unsafe :: T -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+foo_unsafe = hs_bindgen_72197c1a408e40ac
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_401f15168ffec8ae" hs_bindgen_401f15168ffec8ae_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae :: U -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae = \x_0 -> hs_bindgen_401f15168ffec8ae_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+bar_unsafe :: U -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+bar_unsafe = hs_bindgen_401f15168ffec8ae
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_7fa7d51da57eb497" hs_bindgen_7fa7d51da57eb497_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+hs_bindgen_7fa7d51da57eb497 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+hs_bindgen_7fa7d51da57eb497 = fmap fromFFIType hs_bindgen_7fa7d51da57eb497_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+foo_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_7fa7d51da57eb497
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_e57577b970e09cca" hs_bindgen_e57577b970e09cca_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca :: IO (FunPtr (U -> IO ()))
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca = fmap fromFFIType hs_bindgen_e57577b970e09cca_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+bar_funptr :: FunPtr (U -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_selected.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_e57577b970e09cca
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example.hs b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example.hs
@@ -0,0 +1,69 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.U(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 11:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+newtype U = U
+  { unwrapU :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapU" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> U {unwrapU = y1}, BG.getField @"unwrapU" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapU" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapU")
+
+instance HasCField.HasCField U "unwrapU" where
+
+  type CFieldType U "unwrapU" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example/FunPtr.hs b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/macro_unselected.h>"
+  , "/* test_programanalysisprogramslici_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e57577b970e09cca (void)) ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_e57577b970e09cca" hs_bindgen_e57577b970e09cca_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca :: IO (BG.FunPtr (U -> IO ()))
+hs_bindgen_e57577b970e09cca =
+  fmap BG.fromFFIType hs_bindgen_e57577b970e09cca_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+bar :: BG.FunPtr (U -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_e57577b970e09cca
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example/Safe.hs b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example/Safe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/macro_unselected.h>"
+  , "void hs_bindgen_ef8f97cf27661c20 ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_ef8f97cf27661c20" hs_bindgen_ef8f97cf27661c20_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 ::
+     U
+  -> IO ()
+hs_bindgen_ef8f97cf27661c20 =
+  \x0 ->
+    hs_bindgen_ef8f97cf27661c20_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+bar ::
+     U
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_ef8f97cf27661c20
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example/Unsafe.hs b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/Example/Unsafe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/macro_unselected.h>"
+  , "void hs_bindgen_401f15168ffec8ae ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_401f15168ffec8ae" hs_bindgen_401f15168ffec8ae_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae ::
+     U
+  -> IO ()
+hs_bindgen_401f15168ffec8ae =
+  \x0 ->
+    hs_bindgen_401f15168ffec8ae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+bar ::
+     U
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_401f15168ffec8ae
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/program-slicing/macro_unselected.h
+  cname: macro U
+  hsname: U
+hstypes:
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/th.txt b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/macro_unselected/th.txt
@@ -0,0 +1,121 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program-slicing/macro_unselected_t.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program-slicing/macro_unselected.h
+-- #include <program-analysis/program-slicing/macro_unselected.h>
+-- void hs_bindgen_ef8f97cf27661c20 (
+--   U arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_401f15168ffec8ae (
+--   U arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_programanalysisprogramslici_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e57577b970e09cca (void)) (
+--   U arg1
+-- )
+-- {
+--   return &bar;
+-- }
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 11:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+newtype U
+    = U {unwrapU :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapU" U ty
+    where hasField = \x_0 -> (\y_1 -> U{unwrapU = y_1},
+                              getField @"unwrapU" x_0)
+instance (~) ty CInt => HasField "unwrapU" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapU")
+instance HasCField U "unwrapU"
+    where type CFieldType U "unwrapU" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_ef8f97cf27661c20" hs_bindgen_ef8f97cf27661c20_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 :: U -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 = \x_0 -> hs_bindgen_ef8f97cf27661c20_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+bar_safe :: U -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+bar_safe = hs_bindgen_ef8f97cf27661c20
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_401f15168ffec8ae" hs_bindgen_401f15168ffec8ae_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae :: U -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae = \x_0 -> hs_bindgen_401f15168ffec8ae_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+bar_unsafe :: U -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+bar_unsafe = hs_bindgen_401f15168ffec8ae
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_e57577b970e09cca" hs_bindgen_e57577b970e09cca_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca :: IO (FunPtr (U -> IO ()))
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca = fmap fromFFIType hs_bindgen_e57577b970e09cca_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+bar_funptr :: FunPtr (U -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/macro_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/macro_unselected.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_e57577b970e09cca
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example.hs b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example.hs
@@ -0,0 +1,114 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , Example.U(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @typedef_selected_t.h 3:13@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 9:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+newtype U = U
+  { unwrapU :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapU" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> U {unwrapU = y1}, BG.getField @"unwrapU" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapU" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapU")
+
+instance HasCField.HasCField U "unwrapU" where
+
+  type CFieldType U "unwrapU" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example/FunPtr.hs b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example/FunPtr.hs
@@ -0,0 +1,73 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.foo
+    , Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/typedef_selected.h>"
+  , "/* test_programanalysisprogramslici_Example_get_foo */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_7fa7d51da57eb497 (void)) ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  return &foo;"
+  , "}"
+  , "/* test_programanalysisprogramslici_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e57577b970e09cca (void)) ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_7fa7d51da57eb497" hs_bindgen_7fa7d51da57eb497_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+hs_bindgen_7fa7d51da57eb497 :: IO (BG.FunPtr (T -> IO ()))
+hs_bindgen_7fa7d51da57eb497 =
+  fmap BG.fromFFIType hs_bindgen_7fa7d51da57eb497_base
+
+{-# NOINLINE foo #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+foo :: BG.FunPtr (T -> IO ())
+foo = BG.unsafePerformIO hs_bindgen_7fa7d51da57eb497
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_e57577b970e09cca" hs_bindgen_e57577b970e09cca_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca :: IO (BG.FunPtr (U -> IO ()))
+hs_bindgen_e57577b970e09cca =
+  fmap BG.fromFFIType hs_bindgen_e57577b970e09cca_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+bar :: BG.FunPtr (U -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_e57577b970e09cca
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example/Safe.hs b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example/Safe.hs
@@ -0,0 +1,81 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.foo
+    , Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/typedef_selected.h>"
+  , "void hs_bindgen_27fdf7030b0bb40d ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_ef8f97cf27661c20 ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_27fdf7030b0bb40d" hs_bindgen_27fdf7030b0bb40d_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+hs_bindgen_27fdf7030b0bb40d ::
+     T
+  -> IO ()
+hs_bindgen_27fdf7030b0bb40d =
+  \x0 ->
+    hs_bindgen_27fdf7030b0bb40d_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+foo ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_27fdf7030b0bb40d
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_ef8f97cf27661c20" hs_bindgen_ef8f97cf27661c20_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 ::
+     U
+  -> IO ()
+hs_bindgen_ef8f97cf27661c20 =
+  \x0 ->
+    hs_bindgen_ef8f97cf27661c20_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+bar ::
+     U
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_ef8f97cf27661c20
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example/Unsafe.hs b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/Example/Unsafe.hs
@@ -0,0 +1,81 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.foo
+    , Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/typedef_selected.h>"
+  , "void hs_bindgen_72197c1a408e40ac ("
+  , "  T arg1"
+  , ")"
+  , "{"
+  , "  (foo)(arg1);"
+  , "}"
+  , "void hs_bindgen_401f15168ffec8ae ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_72197c1a408e40ac" hs_bindgen_72197c1a408e40ac_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+hs_bindgen_72197c1a408e40ac ::
+     T
+  -> IO ()
+hs_bindgen_72197c1a408e40ac =
+  \x0 ->
+    hs_bindgen_72197c1a408e40ac_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+foo ::
+     T
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+foo = hs_bindgen_72197c1a408e40ac
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_401f15168ffec8ae" hs_bindgen_401f15168ffec8ae_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae ::
+     U
+  -> IO ()
+hs_bindgen_401f15168ffec8ae =
+  \x0 ->
+    hs_bindgen_401f15168ffec8ae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+bar ::
+     U
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_401f15168ffec8ae
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/program-slicing/typedef_selected.h
+  cname: T
+  hsname: T
+- headers: program-analysis/program-slicing/typedef_selected.h
+  cname: macro U
+  hsname: U
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/th.txt b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_selected/th.txt
@@ -0,0 +1,239 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program-slicing/typedef_selected_t.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program-slicing/typedef_selected.h
+-- #include <program-analysis/program-slicing/typedef_selected.h>
+-- void hs_bindgen_27fdf7030b0bb40d (
+--   T arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_ef8f97cf27661c20 (
+--   U arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_72197c1a408e40ac (
+--   T arg1
+-- )
+-- {
+--   (foo)(arg1);
+-- }
+-- void hs_bindgen_401f15168ffec8ae (
+--   U arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_programanalysisprogramslici_Example_get_foo */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_7fa7d51da57eb497 (void)) (
+--   T arg1
+-- )
+-- {
+--   return &foo;
+-- }
+-- /* test_programanalysisprogramslici_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e57577b970e09cca (void)) (
+--   U arg1
+-- )
+-- {
+--   return &bar;
+-- }
+{-| __C declaration:__ @T@
+
+    __defined at:__ @typedef_selected_t.h 3:13@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+newtype T
+    = T {unwrapT :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 9:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+newtype U
+    = U {unwrapU :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapU" U ty
+    where hasField = \x_0 -> (\y_1 -> U{unwrapU = y_1},
+                              getField @"unwrapU" x_0)
+instance (~) ty CInt => HasField "unwrapU" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapU")
+instance HasCField U "unwrapU"
+    where type CFieldType U "unwrapU" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+foreign import ccall safe "hs_bindgen_27fdf7030b0bb40d" hs_bindgen_27fdf7030b0bb40d_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+hs_bindgen_27fdf7030b0bb40d :: T -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_foo@
+hs_bindgen_27fdf7030b0bb40d = \x_0 -> hs_bindgen_27fdf7030b0bb40d_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+foo_safe :: T -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+foo_safe = hs_bindgen_27fdf7030b0bb40d
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_ef8f97cf27661c20" hs_bindgen_ef8f97cf27661c20_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 :: U -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 = \x_0 -> hs_bindgen_ef8f97cf27661c20_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+bar_safe :: U -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+bar_safe = hs_bindgen_ef8f97cf27661c20
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+foreign import ccall unsafe "hs_bindgen_72197c1a408e40ac" hs_bindgen_72197c1a408e40ac_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+hs_bindgen_72197c1a408e40ac :: T -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_foo@
+hs_bindgen_72197c1a408e40ac = \x_0 -> hs_bindgen_72197c1a408e40ac_base (toFFIType x_0)
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+foo_unsafe :: T -> IO ()
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+foo_unsafe = hs_bindgen_72197c1a408e40ac
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_401f15168ffec8ae" hs_bindgen_401f15168ffec8ae_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae :: U -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae = \x_0 -> hs_bindgen_401f15168ffec8ae_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+bar_unsafe :: U -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+bar_unsafe = hs_bindgen_401f15168ffec8ae
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+foreign import ccall unsafe "hs_bindgen_7fa7d51da57eb497" hs_bindgen_7fa7d51da57eb497_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+hs_bindgen_7fa7d51da57eb497 :: IO (FunPtr (T -> IO ()))
+-- __unique:__ @test_programanalysisprogramslici_Example_get_foo@
+hs_bindgen_7fa7d51da57eb497 = fmap fromFFIType hs_bindgen_7fa7d51da57eb497_base
+{-# NOINLINE foo_funptr #-}
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+foo_funptr :: FunPtr (T -> IO ())
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 5:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+foo_funptr = unsafePerformIO hs_bindgen_7fa7d51da57eb497
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_e57577b970e09cca" hs_bindgen_e57577b970e09cca_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca :: IO (FunPtr (U -> IO ()))
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca = fmap fromFFIType hs_bindgen_e57577b970e09cca_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+bar_funptr :: FunPtr (U -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_selected.h 10:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_selected.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_e57577b970e09cca
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example.hs b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example.hs
@@ -0,0 +1,69 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.U(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 11:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+newtype U = U
+  { unwrapU :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapU" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> U {unwrapU = y1}, BG.getField @"unwrapU" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapU" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapU")
+
+instance HasCField.HasCField U "unwrapU" where
+
+  type CFieldType U "unwrapU" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example/FunPtr.hs b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example/FunPtr.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/typedef_unselected.h>"
+  , "/* test_programanalysisprogramslici_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_e57577b970e09cca (void)) ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_e57577b970e09cca" hs_bindgen_e57577b970e09cca_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca :: IO (BG.FunPtr (U -> IO ()))
+hs_bindgen_e57577b970e09cca =
+  fmap BG.fromFFIType hs_bindgen_e57577b970e09cca_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+bar :: BG.FunPtr (U -> IO ())
+bar = BG.unsafePerformIO hs_bindgen_e57577b970e09cca
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example/Safe.hs b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example/Safe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/typedef_unselected.h>"
+  , "void hs_bindgen_ef8f97cf27661c20 ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_ef8f97cf27661c20" hs_bindgen_ef8f97cf27661c20_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 ::
+     U
+  -> IO ()
+hs_bindgen_ef8f97cf27661c20 =
+  \x0 ->
+    hs_bindgen_ef8f97cf27661c20_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+bar ::
+     U
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_ef8f97cf27661c20
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example/Unsafe.hs b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/Example/Unsafe.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.bar
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program-slicing/typedef_unselected.h>"
+  , "void hs_bindgen_401f15168ffec8ae ("
+  , "  U arg1"
+  , ")"
+  , "{"
+  , "  (bar)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_401f15168ffec8ae" hs_bindgen_401f15168ffec8ae_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae ::
+     U
+  -> IO ()
+hs_bindgen_401f15168ffec8ae =
+  \x0 ->
+    hs_bindgen_401f15168ffec8ae_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+bar ::
+     U
+     -- ^ __C declaration:__ @x@
+  -> IO ()
+bar = hs_bindgen_401f15168ffec8ae
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/program-slicing/typedef_unselected.h
+  cname: macro U
+  hsname: U
+hstypes:
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/th.txt b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program-slicing/typedef_unselected/th.txt
@@ -0,0 +1,121 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program-slicing/typedef_unselected_t.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program-slicing/typedef_unselected.h
+-- #include <program-analysis/program-slicing/typedef_unselected.h>
+-- void hs_bindgen_ef8f97cf27661c20 (
+--   U arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- void hs_bindgen_401f15168ffec8ae (
+--   U arg1
+-- )
+-- {
+--   (bar)(arg1);
+-- }
+-- /* test_programanalysisprogramslici_Example_get_bar */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_e57577b970e09cca (void)) (
+--   U arg1
+-- )
+-- {
+--   return &bar;
+-- }
+{-| __C declaration:__ @macro U@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 11:9@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+newtype U
+    = U {unwrapU :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapU" U ty
+    where hasField = \x_0 -> (\y_1 -> U{unwrapU = y_1},
+                              getField @"unwrapU" x_0)
+instance (~) ty CInt => HasField "unwrapU" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapU")
+instance HasCField U "unwrapU"
+    where type CFieldType U "unwrapU" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_ef8f97cf27661c20" hs_bindgen_ef8f97cf27661c20_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 :: U -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Safe_bar@
+hs_bindgen_ef8f97cf27661c20 = \x_0 -> hs_bindgen_ef8f97cf27661c20_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+bar_safe :: U -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+bar_safe = hs_bindgen_ef8f97cf27661c20
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_401f15168ffec8ae" hs_bindgen_401f15168ffec8ae_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae :: U -> IO ()
+-- __unique:__ @test_programanalysisprogramslici_Example_Unsafe_bar@
+hs_bindgen_401f15168ffec8ae = \x_0 -> hs_bindgen_401f15168ffec8ae_base (toFFIType x_0)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+bar_unsafe :: U -> IO ()
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+bar_unsafe = hs_bindgen_401f15168ffec8ae
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_e57577b970e09cca" hs_bindgen_e57577b970e09cca_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca :: IO (FunPtr (U -> IO ()))
+-- __unique:__ @test_programanalysisprogramslici_Example_get_bar@
+hs_bindgen_e57577b970e09cca = fmap fromFFIType hs_bindgen_e57577b970e09cca_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+bar_funptr :: FunPtr (U -> IO ())
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program-slicing\/typedef_unselected.h 12:6@
+
+    __exported by:__ @program-analysis\/program-slicing\/typedef_unselected.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_e57577b970e09cca
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example.hs b/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example.hs
@@ -0,0 +1,305 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.FileOperationStatus(..)
+    , pattern Example.SUCCESS
+    , pattern Example.NOT_FOUND
+    , pattern Example.PERMISSION_DENIED
+    , pattern Example.INVALID_ARGUMENT
+    , pattern Example.OUT_OF_MEMORY
+    , pattern Example.CUSTOM_ERROR_OTHER
+    , Example.FileOperationRecord(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum FileOperationStatus@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 7:6@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+newtype FileOperationStatus = FileOperationStatus
+  { unwrapFileOperationStatus :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize FileOperationStatus where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw FileOperationStatus where
+
+  readRaw =
+    \ptr0 ->
+          pure FileOperationStatus
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw FileOperationStatus where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          FileOperationStatus unwrapFileOperationStatus2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapFileOperationStatus2
+
+deriving via Marshal.EquivStorable FileOperationStatus instance BG.Storable FileOperationStatus
+
+deriving via BG.CInt instance BG.Prim FileOperationStatus
+
+instance CEnum.CEnum FileOperationStatus where
+
+  type CEnumZ FileOperationStatus = BG.CInt
+
+  toCEnum = FileOperationStatus
+
+  fromCEnum = BG.getField @"unwrapFileOperationStatus"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (-1, BG.singleton "CUSTOM_ERROR_OTHER")
+                                   , (0, BG.singleton "SUCCESS")
+                                   , (2, BG.singleton "NOT_FOUND")
+                                   , (12, BG.singleton "OUT_OF_MEMORY")
+                                   , (13, BG.singleton "PERMISSION_DENIED")
+                                   , (22, BG.singleton "INVALID_ARGUMENT")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "FileOperationStatus"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "FileOperationStatus"
+
+instance Show FileOperationStatus where
+
+  showsPrec = CEnum.shows
+
+instance Read FileOperationStatus where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapFileOperationStatus" FileOperationStatus ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FileOperationStatus {unwrapFileOperationStatus = y1}
+      , BG.getField @"unwrapFileOperationStatus" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapFileOperationStatus" (BG.Ptr FileOperationStatus) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFileOperationStatus")
+
+instance HasCField.HasCField FileOperationStatus "unwrapFileOperationStatus" where
+
+  type CFieldType FileOperationStatus "unwrapFileOperationStatus" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @SUCCESS@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 8:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern SUCCESS :: FileOperationStatus
+pattern SUCCESS = FileOperationStatus 0
+
+{-| __C declaration:__ @NOT_FOUND@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 9:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern NOT_FOUND :: FileOperationStatus
+pattern NOT_FOUND = FileOperationStatus 2
+
+{-| __C declaration:__ @PERMISSION_DENIED@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 10:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern PERMISSION_DENIED :: FileOperationStatus
+pattern PERMISSION_DENIED = FileOperationStatus 13
+
+{-| __C declaration:__ @INVALID_ARGUMENT@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 11:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern INVALID_ARGUMENT :: FileOperationStatus
+pattern INVALID_ARGUMENT = FileOperationStatus 22
+
+{-| __C declaration:__ @OUT_OF_MEMORY@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 12:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern OUT_OF_MEMORY :: FileOperationStatus
+pattern OUT_OF_MEMORY = FileOperationStatus 12
+
+{-| __C declaration:__ @CUSTOM_ERROR_OTHER@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 13:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern CUSTOM_ERROR_OTHER :: FileOperationStatus
+pattern CUSTOM_ERROR_OTHER = FileOperationStatus (-1)
+
+{-| __C declaration:__ @struct FileOperationRecord@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 16:8@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+data FileOperationRecord = FileOperationRecord
+  { fileOperationRecord_status :: FileOperationStatus
+    {- ^ __C declaration:__ @status@
+
+         __defined at:__ @program-analysis\/program_slicing_selection.h 17:28@
+
+         __exported by:__ @program-analysis\/program_slicing_selection.h@
+    -}
+  , fileOperationRecord_bytes_processed :: HsBindgen.Runtime.LibC.CSize
+    {- ^ __C declaration:__ @bytes_processed@
+
+         __defined at:__ @program-analysis\/program_slicing_selection.h 18:10@
+
+         __exported by:__ @program-analysis\/program_slicing_selection.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize FileOperationRecord where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw FileOperationRecord where
+
+  readRaw =
+    \ptr0 ->
+          pure FileOperationRecord
+      <*> HasCField.readRaw (BG.Proxy @"fileOperationRecord_status") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"fileOperationRecord_bytes_processed") ptr0
+
+instance Marshal.WriteRaw FileOperationRecord where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          FileOperationRecord
+            fileOperationRecord_status2
+            fileOperationRecord_bytes_processed3 ->
+                 HasCField.writeRaw (BG.Proxy @"fileOperationRecord_status") ptr0 fileOperationRecord_status2
+              >> HasCField.writeRaw (BG.Proxy @"fileOperationRecord_bytes_processed") ptr0 fileOperationRecord_bytes_processed3
+
+deriving via Marshal.EquivStorable FileOperationRecord instance BG.Storable FileOperationRecord
+
+deriving via Struct.IsStructViaReadRaw FileOperationRecord instance Struct.IsStruct FileOperationRecord
+
+{-| __C declaration:__ @status@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 17:28@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+instance ( ty ~ FileOperationStatus
+         ) => BG.CompatHasField.HasField "fileOperationRecord_status" FileOperationRecord ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FileOperationRecord { fileOperationRecord_status = y1
+                              , fileOperationRecord_bytes_processed = BG.getField @"fileOperationRecord_bytes_processed" x0
+                              }
+      , BG.getField @"fileOperationRecord_status" x0
+      )
+
+instance ( ty ~ FileOperationStatus
+         ) => BG.HasField "fileOperationRecord_status" (BG.Ptr FileOperationRecord) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"fileOperationRecord_status")
+
+instance HasCField.HasCField FileOperationRecord "fileOperationRecord_status" where
+
+  type CFieldType FileOperationRecord "fileOperationRecord_status" =
+    FileOperationStatus
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bytes_processed@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 18:10@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.CompatHasField.HasField "fileOperationRecord_bytes_processed" FileOperationRecord ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FileOperationRecord { fileOperationRecord_bytes_processed = y1
+                              , fileOperationRecord_status = BG.getField @"fileOperationRecord_status" x0
+                              }
+      , BG.getField @"fileOperationRecord_bytes_processed" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CSize
+         ) => BG.HasField "fileOperationRecord_bytes_processed" (BG.Ptr FileOperationRecord) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"fileOperationRecord_bytes_processed")
+
+instance HasCField.HasCField FileOperationRecord "fileOperationRecord_bytes_processed" where
+
+  type CFieldType FileOperationRecord "fileOperationRecord_bytes_processed" =
+    HsBindgen.Runtime.LibC.CSize
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example/FunPtr.hs b/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example/FunPtr.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.read_file_chunk
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program_slicing_selection.h>"
+  , "/* test_programanalysisprogram_slici_Example_get_read_file_chunk */"
+  , "__attribute__ ((const))"
+  , "enum FileOperationStatus (*hs_bindgen_6e12e70d71890a10 (void)) ("
+  , "  FILE *arg1,"
+  , "  void *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return &read_file_chunk;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_read_file_chunk@
+foreign import ccall unsafe "hs_bindgen_6e12e70d71890a10" hs_bindgen_6e12e70d71890a10_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_read_file_chunk@
+hs_bindgen_6e12e70d71890a10 :: IO (BG.FunPtr (BG.Ptr HsBindgen.Runtime.LibC.CFile -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.CSize -> IO FileOperationStatus))
+hs_bindgen_6e12e70d71890a10 =
+  fmap BG.fromFFIType hs_bindgen_6e12e70d71890a10_base
+
+{-# NOINLINE read_file_chunk #-}
+{-| __C declaration:__ @read_file_chunk@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 21:26@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+read_file_chunk :: BG.FunPtr (BG.Ptr HsBindgen.Runtime.LibC.CFile -> BG.Ptr BG.Void -> HsBindgen.Runtime.LibC.CSize -> IO FileOperationStatus)
+read_file_chunk =
+  BG.unsafePerformIO hs_bindgen_6e12e70d71890a10
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example/Safe.hs b/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example/Safe.hs
@@ -0,0 +1,62 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.read_file_chunk
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program_slicing_selection.h>"
+  , "enum FileOperationStatus hs_bindgen_b2a91b3b7edf2ad3 ("
+  , "  FILE *arg1,"
+  , "  void *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (read_file_chunk)(arg1, arg2, arg3);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_read_file_chunk@
+foreign import ccall safe "hs_bindgen_b2a91b3b7edf2ad3" hs_bindgen_b2a91b3b7edf2ad3_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_read_file_chunk@
+hs_bindgen_b2a91b3b7edf2ad3 ::
+     BG.Ptr HsBindgen.Runtime.LibC.CFile
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO FileOperationStatus
+hs_bindgen_b2a91b3b7edf2ad3 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_b2a91b3b7edf2ad3_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @read_file_chunk@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 21:26@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+read_file_chunk ::
+     BG.Ptr HsBindgen.Runtime.LibC.CFile
+     -- ^ __C declaration:__ @file_ptr@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @buffer@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @bytes_to_read@
+  -> IO FileOperationStatus
+read_file_chunk = hs_bindgen_b2a91b3b7edf2ad3
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example/Unsafe.hs b/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_selection/Example/Unsafe.hs
@@ -0,0 +1,62 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.read_file_chunk
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program_slicing_selection.h>"
+  , "enum FileOperationStatus hs_bindgen_654858ed6a5db417 ("
+  , "  FILE *arg1,"
+  , "  void *arg2,"
+  , "  size_t arg3"
+  , ")"
+  , "{"
+  , "  return (read_file_chunk)(arg1, arg2, arg3);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_read_file_chunk@
+foreign import ccall unsafe "hs_bindgen_654858ed6a5db417" hs_bindgen_654858ed6a5db417_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CInt
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_read_file_chunk@
+hs_bindgen_654858ed6a5db417 ::
+     BG.Ptr HsBindgen.Runtime.LibC.CFile
+  -> BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO FileOperationStatus
+hs_bindgen_654858ed6a5db417 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_654858ed6a5db417_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @read_file_chunk@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 21:26@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+read_file_chunk ::
+     BG.Ptr HsBindgen.Runtime.LibC.CFile
+     -- ^ __C declaration:__ @file_ptr@
+  -> BG.Ptr BG.Void
+     -- ^ __C declaration:__ @buffer@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @bytes_to_read@
+  -> IO FileOperationStatus
+read_file_chunk = hs_bindgen_654858ed6a5db417
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_selection/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/program_slicing_selection/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_selection/bindingspec.yaml
@@ -0,0 +1,59 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/program_slicing_selection.h
+  cname: enum FileOperationStatus
+  hsname: FileOperationStatus
+  enum: open
+- headers: program-analysis/program_slicing_selection.h
+  cname: struct FileOperationRecord
+  hsname: FileOperationRecord
+hstypes:
+- hsname: FileOperationRecord
+  representation:
+    record:
+      constructor: FileOperationRecord
+      fields:
+      - fileOperationRecord_status
+      - fileOperationRecord_bytes_processed
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: FileOperationStatus
+  representation:
+    newtype:
+      constructor: FileOperationStatus
+      fields:
+      - unwrapFileOperationStatus
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_selection/th.txt b/test-artefacts/fixtures/program-analysis/program_slicing_selection/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_selection/th.txt
@@ -0,0 +1,279 @@
+-- addDependentFile musl-include/x86_64/features.h
+-- addDependentFile musl-include/x86_64/bits/errno.h
+-- addDependentFile musl-include/x86_64/errno.h
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile musl-include/x86_64/stdio.h
+-- addDependentFile musl-include/x86_64/time.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program_slicing_selection.h
+-- #include <program-analysis/program_slicing_selection.h>
+-- enum FileOperationStatus hs_bindgen_b2a91b3b7edf2ad3 (
+--   FILE *arg1,
+--   void *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (read_file_chunk)(arg1, arg2, arg3);
+-- }
+-- enum FileOperationStatus hs_bindgen_654858ed6a5db417 (
+--   FILE *arg1,
+--   void *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return (read_file_chunk)(arg1, arg2, arg3);
+-- }
+-- /* test_programanalysisprogram_slici_Example_get_read_file_chunk */
+-- __attribute__ ((const))
+-- enum FileOperationStatus (*hs_bindgen_6e12e70d71890a10 (void)) (
+--   FILE *arg1,
+--   void *arg2,
+--   size_t arg3
+-- )
+-- {
+--   return &read_file_chunk;
+-- }
+{-| __C declaration:__ @enum FileOperationStatus@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 7:6@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+newtype FileOperationStatus
+    = FileOperationStatus {unwrapFileOperationStatus :: CInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize FileOperationStatus
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw FileOperationStatus
+    where readRaw = \ptr_0 -> pure FileOperationStatus <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw FileOperationStatus
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       FileOperationStatus unwrapFileOperationStatus_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapFileOperationStatus_2
+deriving via (EquivStorable FileOperationStatus) instance Storable FileOperationStatus
+deriving via CInt instance Prim FileOperationStatus
+instance CEnum FileOperationStatus
+    where type CEnumZ FileOperationStatus = CInt
+          toCEnum = FileOperationStatus
+          fromCEnum = getField @"unwrapFileOperationStatus"
+          declaredValues = \_ -> declaredValuesFromList [(-1,
+                                                          singleton "CUSTOM_ERROR_OTHER"),
+                                                         (0, singleton "SUCCESS"),
+                                                         (2, singleton "NOT_FOUND"),
+                                                         (12, singleton "OUT_OF_MEMORY"),
+                                                         (13, singleton "PERMISSION_DENIED"),
+                                                         (22, singleton "INVALID_ARGUMENT")]
+          showsUndeclared = showsWrappedUndeclared "FileOperationStatus"
+          readPrecUndeclared = readPrecWrappedUndeclared "FileOperationStatus"
+instance Show FileOperationStatus
+    where showsPrec = shows
+instance Read FileOperationStatus
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CInt =>
+         HasField "unwrapFileOperationStatus" FileOperationStatus ty
+    where hasField = \x_0 -> (\y_1 -> FileOperationStatus{unwrapFileOperationStatus = y_1},
+                              getField @"unwrapFileOperationStatus" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapFileOperationStatus"
+                  (Ptr FileOperationStatus)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFileOperationStatus")
+instance HasCField FileOperationStatus "unwrapFileOperationStatus"
+    where type CFieldType FileOperationStatus
+                          "unwrapFileOperationStatus" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @SUCCESS@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 8:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern SUCCESS :: FileOperationStatus
+pattern SUCCESS = FileOperationStatus 0
+{-| __C declaration:__ @NOT_FOUND@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 9:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern NOT_FOUND :: FileOperationStatus
+pattern NOT_FOUND = FileOperationStatus 2
+{-| __C declaration:__ @PERMISSION_DENIED@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 10:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern PERMISSION_DENIED :: FileOperationStatus
+pattern PERMISSION_DENIED = FileOperationStatus 13
+{-| __C declaration:__ @INVALID_ARGUMENT@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 11:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern INVALID_ARGUMENT :: FileOperationStatus
+pattern INVALID_ARGUMENT = FileOperationStatus 22
+{-| __C declaration:__ @OUT_OF_MEMORY@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 12:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern OUT_OF_MEMORY :: FileOperationStatus
+pattern OUT_OF_MEMORY = FileOperationStatus 12
+{-| __C declaration:__ @CUSTOM_ERROR_OTHER@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 13:3@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+pattern CUSTOM_ERROR_OTHER :: FileOperationStatus
+pattern CUSTOM_ERROR_OTHER = FileOperationStatus (-1)
+{-| __C declaration:__ @struct FileOperationRecord@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 16:8@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+data FileOperationRecord
+    = FileOperationRecord {fileOperationRecord_status :: FileOperationStatus
+                           {- ^ __C declaration:__ @status@
+
+                                __defined at:__ @program-analysis\/program_slicing_selection.h 17:28@
+
+                                __exported by:__ @program-analysis\/program_slicing_selection.h@
+                           -},
+                           fileOperationRecord_bytes_processed :: HsBindgen.Runtime.LibC.CSize
+                           {- ^ __C declaration:__ @bytes_processed@
+
+                                __defined at:__ @program-analysis\/program_slicing_selection.h 18:10@
+
+                                __exported by:__ @program-analysis\/program_slicing_selection.h@
+                           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize FileOperationRecord
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw FileOperationRecord
+    where readRaw = \ptr_0 -> (pure FileOperationRecord <*> readRaw (Proxy @"fileOperationRecord_status") ptr_0) <*> readRaw (Proxy @"fileOperationRecord_bytes_processed") ptr_0
+instance WriteRaw FileOperationRecord
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       FileOperationRecord fileOperationRecord_status_2
+                                                           fileOperationRecord_bytes_processed_3 -> writeRaw (Proxy @"fileOperationRecord_status") ptr_0 fileOperationRecord_status_2 >> writeRaw (Proxy @"fileOperationRecord_bytes_processed") ptr_0 fileOperationRecord_bytes_processed_3
+deriving via (EquivStorable FileOperationRecord) instance Storable FileOperationRecord
+deriving via (IsStructViaReadRaw FileOperationRecord) instance IsStruct FileOperationRecord
+instance (~) ty FileOperationStatus =>
+         HasField "fileOperationRecord_status" FileOperationRecord ty
+    where hasField = \x_0 -> (\y_1 -> FileOperationRecord{fileOperationRecord_status = y_1,
+                                                          fileOperationRecord_bytes_processed = getField @"fileOperationRecord_bytes_processed" x_0},
+                              getField @"fileOperationRecord_status" x_0)
+instance (~) ty FileOperationStatus =>
+         HasField "fileOperationRecord_status"
+                  (Ptr FileOperationRecord)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"fileOperationRecord_status")
+instance HasCField FileOperationRecord "fileOperationRecord_status"
+    where type CFieldType FileOperationRecord
+                          "fileOperationRecord_status" = FileOperationStatus
+          offset# = \_ -> \_ -> 0
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "fileOperationRecord_bytes_processed"
+                  FileOperationRecord
+                  ty
+    where hasField = \x_0 -> (\y_1 -> FileOperationRecord{fileOperationRecord_bytes_processed = y_1,
+                                                          fileOperationRecord_status = getField @"fileOperationRecord_status" x_0},
+                              getField @"fileOperationRecord_bytes_processed" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CSize =>
+         HasField "fileOperationRecord_bytes_processed"
+                  (Ptr FileOperationRecord)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"fileOperationRecord_bytes_processed")
+instance HasCField FileOperationRecord
+                   "fileOperationRecord_bytes_processed"
+    where type CFieldType FileOperationRecord
+                          "fileOperationRecord_bytes_processed" = HsBindgen.Runtime.LibC.CSize
+          offset# = \_ -> \_ -> 8
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_read_file_chunk@
+foreign import ccall safe "hs_bindgen_b2a91b3b7edf2ad3" hs_bindgen_b2a91b3b7edf2ad3_base ::
+    Ptr Void
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_read_file_chunk@
+hs_bindgen_b2a91b3b7edf2ad3 :: Ptr HsBindgen.Runtime.LibC.CFile ->
+                               Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO FileOperationStatus
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_read_file_chunk@
+hs_bindgen_b2a91b3b7edf2ad3 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_b2a91b3b7edf2ad3_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @read_file_chunk@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 21:26@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+read_file_chunk_safe :: Ptr HsBindgen.Runtime.LibC.CFile ->
+                        Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO FileOperationStatus
+{-| __C declaration:__ @read_file_chunk@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 21:26@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+read_file_chunk_safe = hs_bindgen_b2a91b3b7edf2ad3
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_read_file_chunk@
+foreign import ccall unsafe "hs_bindgen_654858ed6a5db417" hs_bindgen_654858ed6a5db417_base ::
+    Ptr Void
+ -> Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CInt
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_read_file_chunk@
+hs_bindgen_654858ed6a5db417 :: Ptr HsBindgen.Runtime.LibC.CFile ->
+                               Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO FileOperationStatus
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_read_file_chunk@
+hs_bindgen_654858ed6a5db417 = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_654858ed6a5db417_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @read_file_chunk@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 21:26@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+read_file_chunk_unsafe :: Ptr HsBindgen.Runtime.LibC.CFile ->
+                          Ptr Void -> HsBindgen.Runtime.LibC.CSize -> IO FileOperationStatus
+{-| __C declaration:__ @read_file_chunk@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 21:26@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+read_file_chunk_unsafe = hs_bindgen_654858ed6a5db417
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_read_file_chunk@
+foreign import ccall unsafe "hs_bindgen_6e12e70d71890a10" hs_bindgen_6e12e70d71890a10_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_read_file_chunk@
+hs_bindgen_6e12e70d71890a10 :: IO (FunPtr (Ptr HsBindgen.Runtime.LibC.CFile ->
+                                           Ptr Void ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO FileOperationStatus))
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_read_file_chunk@
+hs_bindgen_6e12e70d71890a10 = fmap fromFFIType hs_bindgen_6e12e70d71890a10_base
+{-# NOINLINE read_file_chunk_funptr #-}
+{-| __C declaration:__ @read_file_chunk@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 21:26@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+read_file_chunk_funptr :: FunPtr (Ptr HsBindgen.Runtime.LibC.CFile ->
+                                  Ptr Void ->
+                                  HsBindgen.Runtime.LibC.CSize -> IO FileOperationStatus)
+{-| __C declaration:__ @read_file_chunk@
+
+    __defined at:__ @program-analysis\/program_slicing_selection.h 21:26@
+
+    __exported by:__ @program-analysis\/program_slicing_selection.h@
+-}
+read_file_chunk_funptr = unsafePerformIO hs_bindgen_6e12e70d71890a10
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example.hs b/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example.hs
@@ -0,0 +1,176 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Uint32_t(..)
+    , Example.Foo(..)
+    )
+  where
+
+import qualified Foreign.C.Types
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @uint32_t@
+
+    __defined at:__ @bits\/alltypes.h 131:25@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+newtype Uint32_t = Uint32_t
+  { unwrapUint32_t :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapUint32_t" Uint32_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Uint32_t {unwrapUint32_t = y1}, BG.getField @"unwrapUint32_t" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapUint32_t" (BG.Ptr Uint32_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint32_t")
+
+instance HasCField.HasCField Uint32_t "unwrapUint32_t" where
+
+  type CFieldType Uint32_t "unwrapUint32_t" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 3:8@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+data Foo = Foo
+  { foo_sixty_four :: Foreign.C.Types.CULong
+    {- ^ __C declaration:__ @sixty_four@
+
+         __defined at:__ @program-analysis\/program_slicing_simple.h 4:12@
+
+         __exported by:__ @program-analysis\/program_slicing_simple.h@
+    -}
+  , foo_thirty_two :: Uint32_t
+    {- ^ __C declaration:__ @thirty_two@
+
+         __defined at:__ @program-analysis\/program_slicing_simple.h 5:12@
+
+         __exported by:__ @program-analysis\/program_slicing_simple.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance BG.Storable Foo where
+
+  sizeOf = \_ -> (16 :: Int)
+
+  alignment = \_ -> (8 :: Int)
+
+  peek =
+    \ptr0 ->
+          pure Foo
+      <*> HasCField.peek (BG.Proxy @"foo_sixty_four") ptr0
+      <*> HasCField.peek (BG.Proxy @"foo_thirty_two") ptr0
+
+  poke =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo foo_sixty_four2 foo_thirty_two3 ->
+               HasCField.poke (BG.Proxy @"foo_sixty_four") ptr0 foo_sixty_four2
+            >> HasCField.poke (BG.Proxy @"foo_thirty_two") ptr0 foo_thirty_two3
+
+{-| __C declaration:__ @sixty_four@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 4:12@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+instance ( ty ~ Foreign.C.Types.CULong
+         ) => BG.CompatHasField.HasField "foo_sixty_four" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_sixty_four = y1, foo_thirty_two = BG.getField @"foo_thirty_two" x0}
+      , BG.getField @"foo_sixty_four" x0
+      )
+
+instance ( ty ~ Foreign.C.Types.CULong
+         ) => BG.HasField "foo_sixty_four" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"foo_sixty_four")
+
+instance HasCField.HasCField Foo "foo_sixty_four" where
+
+  type CFieldType Foo "foo_sixty_four" =
+    Foreign.C.Types.CULong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @thirty_two@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 5:12@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+instance ( ty ~ Uint32_t
+         ) => BG.CompatHasField.HasField "foo_thirty_two" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_thirty_two = y1, foo_sixty_four = BG.getField @"foo_sixty_four" x0}
+      , BG.getField @"foo_thirty_two" x0
+      )
+
+instance ( ty ~ Uint32_t
+         ) => BG.HasField "foo_thirty_two" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"foo_thirty_two")
+
+instance HasCField.HasCField Foo "foo_thirty_two" where
+
+  type CFieldType Foo "foo_thirty_two" = Uint32_t
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example/FunPtr.hs b/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example/FunPtr.hs
@@ -0,0 +1,47 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.bar
+    )
+  where
+
+import qualified Foreign.C.Types
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program_slicing_simple.h>"
+  , "/* test_programanalysisprogram_slici_Example_get_bar */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_993162e0dadfa2c9 (void)) ("
+  , "  uint64_t arg1,"
+  , "  uint32_t arg2"
+  , ")"
+  , "{"
+  , "  return &bar;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_993162e0dadfa2c9" hs_bindgen_993162e0dadfa2c9_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_bar@
+hs_bindgen_993162e0dadfa2c9 :: IO (BG.FunPtr (Foreign.C.Types.CULong -> Uint32_t -> IO BG.CInt))
+hs_bindgen_993162e0dadfa2c9 =
+  fmap BG.fromFFIType hs_bindgen_993162e0dadfa2c9_base
+
+{-# NOINLINE bar #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 8:5@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+bar :: BG.FunPtr (Foreign.C.Types.CULong -> Uint32_t -> IO BG.CInt)
+bar = BG.unsafePerformIO hs_bindgen_993162e0dadfa2c9
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example/Safe.hs b/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example/Safe.hs
@@ -0,0 +1,56 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.bar
+    )
+  where
+
+import qualified Foreign.C.Types
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program_slicing_simple.h>"
+  , "signed int hs_bindgen_48dbbf4b09b5b3c1 ("
+  , "  uint64_t arg1,"
+  , "  uint32_t arg2"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_48dbbf4b09b5b3c1" hs_bindgen_48dbbf4b09b5b3c1_base ::
+     BG.CULong
+  -> BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_bar@
+hs_bindgen_48dbbf4b09b5b3c1 ::
+     Foreign.C.Types.CULong
+  -> Uint32_t
+  -> IO BG.CInt
+hs_bindgen_48dbbf4b09b5b3c1 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_48dbbf4b09b5b3c1_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 8:5@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+bar ::
+     Foreign.C.Types.CULong
+     -- ^ __C declaration:__ @x@
+  -> Uint32_t
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CInt
+bar = hs_bindgen_48dbbf4b09b5b3c1
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example/Unsafe.hs b/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_simple/Example/Unsafe.hs
@@ -0,0 +1,56 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.bar
+    )
+  where
+
+import qualified Foreign.C.Types
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/program_slicing_simple.h>"
+  , "signed int hs_bindgen_fe855d53295ba8ab ("
+  , "  uint64_t arg1,"
+  , "  uint32_t arg2"
+  , ")"
+  , "{"
+  , "  return (bar)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_fe855d53295ba8ab" hs_bindgen_fe855d53295ba8ab_base ::
+     BG.CULong
+  -> BG.CUInt
+  -> IO BG.CInt
+
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_bar@
+hs_bindgen_fe855d53295ba8ab ::
+     Foreign.C.Types.CULong
+  -> Uint32_t
+  -> IO BG.CInt
+hs_bindgen_fe855d53295ba8ab =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_fe855d53295ba8ab_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 8:5@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+bar ::
+     Foreign.C.Types.CULong
+     -- ^ __C declaration:__ @x@
+  -> Uint32_t
+     -- ^ __C declaration:__ @y@
+  -> IO BG.CInt
+bar = hs_bindgen_fe855d53295ba8ab
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_simple/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/program_slicing_simple/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_simple/bindingspec.yaml
@@ -0,0 +1,62 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/program_slicing_simple.h
+  cname: uint32_t
+  hsname: Uint32_t
+- headers: program-analysis/program_slicing_simple.h
+  cname: struct foo
+  hsname: Foo
+hstypes:
+- hsname: Foo
+  representation:
+    record:
+      constructor: Foo
+      fields:
+      - foo_sixty_four
+      - foo_thirty_two
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Show
+  - Storable
+- hsname: Uint32_t
+  representation:
+    newtype:
+      constructor: Uint32_t
+      fields:
+      - unwrapUint32_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/program_slicing_simple/th.txt b/test-artefacts/fixtures/program-analysis/program_slicing_simple/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/program_slicing_simple/th.txt
@@ -0,0 +1,183 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/program_slicing_simple.h
+-- #include <program-analysis/program_slicing_simple.h>
+-- signed int hs_bindgen_48dbbf4b09b5b3c1 (
+--   uint64_t arg1,
+--   uint32_t arg2
+-- )
+-- {
+--   return (bar)(arg1, arg2);
+-- }
+-- signed int hs_bindgen_fe855d53295ba8ab (
+--   uint64_t arg1,
+--   uint32_t arg2
+-- )
+-- {
+--   return (bar)(arg1, arg2);
+-- }
+-- /* test_programanalysisprogram_slici_Example_get_bar */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_993162e0dadfa2c9 (void)) (
+--   uint64_t arg1,
+--   uint32_t arg2
+-- )
+-- {
+--   return &bar;
+-- }
+{-| __C declaration:__ @uint32_t@
+
+    __defined at:__ @bits\/alltypes.h 131:25@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+newtype Uint32_t
+    = Uint32_t {unwrapUint32_t :: CUInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUInt => HasField "unwrapUint32_t" Uint32_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint32_t{unwrapUint32_t = y_1},
+                              getField @"unwrapUint32_t" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapUint32_t" (Ptr Uint32_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint32_t")
+instance HasCField Uint32_t "unwrapUint32_t"
+    where type CFieldType Uint32_t "unwrapUint32_t" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 3:8@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+data Foo
+    = Foo {foo_sixty_four :: Foreign.C.Types.CULong
+           {- ^ __C declaration:__ @sixty_four@
+
+                __defined at:__ @program-analysis\/program_slicing_simple.h 4:12@
+
+                __exported by:__ @program-analysis\/program_slicing_simple.h@
+           -},
+           foo_thirty_two :: Uint32_t
+           {- ^ __C declaration:__ @thirty_two@
+
+                __defined at:__ @program-analysis\/program_slicing_simple.h 5:12@
+
+                __exported by:__ @program-analysis\/program_slicing_simple.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance Storable Foo
+    where sizeOf = \_ -> 16 :: Int
+          alignment = \_ -> 8 :: Int
+          peek = \ptr_0 -> (pure Foo <*> peek (Proxy @"foo_sixty_four") ptr_0) <*> peek (Proxy @"foo_thirty_two") ptr_0
+          poke = \ptr_1 -> \s_2 -> case s_2 of
+                                   Foo foo_sixty_four_3
+                                       foo_thirty_two_4 -> poke (Proxy @"foo_sixty_four") ptr_1 foo_sixty_four_3 >> poke (Proxy @"foo_thirty_two") ptr_1 foo_thirty_two_4
+instance (~) ty Foreign.C.Types.CULong =>
+         HasField "foo_sixty_four" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_sixty_four = y_1,
+                                          foo_thirty_two = getField @"foo_thirty_two" x_0},
+                              getField @"foo_sixty_four" x_0)
+instance (~) ty Foreign.C.Types.CULong =>
+         HasField "foo_sixty_four" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_sixty_four")
+instance HasCField Foo "foo_sixty_four"
+    where type CFieldType Foo "foo_sixty_four" = Foreign.C.Types.CULong
+          offset# = \_ -> \_ -> 0
+instance (~) ty Uint32_t => HasField "foo_thirty_two" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_thirty_two = y_1,
+                                          foo_sixty_four = getField @"foo_sixty_four" x_0},
+                              getField @"foo_thirty_two" x_0)
+instance (~) ty Uint32_t =>
+         HasField "foo_thirty_two" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_thirty_two")
+instance HasCField Foo "foo_thirty_two"
+    where type CFieldType Foo "foo_thirty_two" = Uint32_t
+          offset# = \_ -> \_ -> 8
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_bar@
+foreign import ccall safe "hs_bindgen_48dbbf4b09b5b3c1" hs_bindgen_48dbbf4b09b5b3c1_base ::
+    CULong
+ -> CUInt
+ -> IO CInt
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_bar@
+hs_bindgen_48dbbf4b09b5b3c1 :: Foreign.C.Types.CULong ->
+                               Uint32_t -> IO CInt
+-- __unique:__ @test_programanalysisprogram_slici_Example_Safe_bar@
+hs_bindgen_48dbbf4b09b5b3c1 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_48dbbf4b09b5b3c1_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 8:5@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+bar_safe :: Foreign.C.Types.CULong -> Uint32_t -> IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 8:5@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+bar_safe = hs_bindgen_48dbbf4b09b5b3c1
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_bar@
+foreign import ccall unsafe "hs_bindgen_fe855d53295ba8ab" hs_bindgen_fe855d53295ba8ab_base ::
+    CULong
+ -> CUInt
+ -> IO CInt
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_bar@
+hs_bindgen_fe855d53295ba8ab :: Foreign.C.Types.CULong ->
+                               Uint32_t -> IO CInt
+-- __unique:__ @test_programanalysisprogram_slici_Example_Unsafe_bar@
+hs_bindgen_fe855d53295ba8ab = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_fe855d53295ba8ab_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 8:5@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+bar_unsafe :: Foreign.C.Types.CULong -> Uint32_t -> IO CInt
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 8:5@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+bar_unsafe = hs_bindgen_fe855d53295ba8ab
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_bar@
+foreign import ccall unsafe "hs_bindgen_993162e0dadfa2c9" hs_bindgen_993162e0dadfa2c9_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_bar@
+hs_bindgen_993162e0dadfa2c9 :: IO (FunPtr (Foreign.C.Types.CULong ->
+                                           Uint32_t -> IO CInt))
+-- __unique:__ @test_programanalysisprogram_slici_Example_get_bar@
+hs_bindgen_993162e0dadfa2c9 = fmap fromFFIType hs_bindgen_993162e0dadfa2c9_base
+{-# NOINLINE bar_funptr #-}
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 8:5@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+bar_funptr :: FunPtr (Foreign.C.Types.CULong ->
+                      Uint32_t -> IO CInt)
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/program_slicing_simple.h 8:5@
+
+    __exported by:__ @program-analysis\/program_slicing_simple.h@
+-}
+bar_funptr = unsafePerformIO hs_bindgen_993162e0dadfa2c9
diff --git a/test-artefacts/fixtures/program-analysis/selection_bad/Example.hs b/test-artefacts/fixtures/program-analysis/selection_bad/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_bad/Example.hs
@@ -0,0 +1,69 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @program-analysis\/selection_bad.h 3:9@
+
+    __exported by:__ @program-analysis\/selection_bad.h@
+-}
+newtype A = A
+  { unwrapA :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_bad/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_bad/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_bad/bindingspec.yaml
@@ -0,0 +1,43 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/selection_bad.h
+  cname: macro A
+  hsname: A
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/selection_bad/th.txt b/test-artefacts/fixtures/program-analysis/selection_bad/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_bad/th.txt
@@ -0,0 +1,34 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_bad_size_t.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_bad.h
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @program-analysis\/selection_bad.h 3:9@
+
+    __exported by:__ @program-analysis\/selection_bad.h@
+-}
+newtype A
+    = A {unwrapA :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty CInt => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail.1.deselect_failed/Example.hs b/test-artefacts/fixtures/program-analysis/selection_fail.1.deselect_failed/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail.1.deselect_failed/Example.hs
@@ -0,0 +1,163 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.OkBefore(..)
+    , Example.OkAfter(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct OkBefore@
+
+    __defined at:__ @program-analysis\/selection_fail.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkBefore = OkBefore
+  { okBefore_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+         __exported by:__ @program-analysis\/selection_fail.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize OkBefore where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw OkBefore where
+
+  readRaw =
+    \ptr0 ->
+          pure OkBefore
+      <*> HasCField.readRaw (BG.Proxy @"okBefore_x") ptr0
+
+instance Marshal.WriteRaw OkBefore where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          OkBefore okBefore_x2 ->
+            HasCField.writeRaw (BG.Proxy @"okBefore_x") ptr0 okBefore_x2
+
+deriving via Marshal.EquivStorable OkBefore instance BG.Storable OkBefore
+
+deriving via Struct.IsStructViaReadRaw OkBefore instance Struct.IsStruct OkBefore
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "okBefore_x" OkBefore ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         OkBefore {okBefore_x = y1}, BG.getField @"okBefore_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "okBefore_x" (BG.Ptr OkBefore) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"okBefore_x")
+
+instance HasCField.HasCField OkBefore "okBefore_x" where
+
+  type CFieldType OkBefore "okBefore_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct OkAfter@
+
+    __defined at:__ @program-analysis\/selection_fail.h 26:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkAfter = OkAfter
+  { okAfter_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/selection_fail.h 27:7@
+
+         __exported by:__ @program-analysis\/selection_fail.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize OkAfter where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw OkAfter where
+
+  readRaw =
+    \ptr0 ->
+          pure OkAfter
+      <*> HasCField.readRaw (BG.Proxy @"okAfter_x") ptr0
+
+instance Marshal.WriteRaw OkAfter where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          OkAfter okAfter_x2 ->
+            HasCField.writeRaw (BG.Proxy @"okAfter_x") ptr0 okAfter_x2
+
+deriving via Marshal.EquivStorable OkAfter instance BG.Storable OkAfter
+
+deriving via Struct.IsStructViaReadRaw OkAfter instance Struct.IsStruct OkAfter
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/selection_fail.h 27:7@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "okAfter_x" OkAfter ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         OkAfter {okAfter_x = y1}, BG.getField @"okAfter_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "okAfter_x" (BG.Ptr OkAfter) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"okAfter_x")
+
+instance HasCField.HasCField OkAfter "okAfter_x" where
+
+  type CFieldType OkAfter "okAfter_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail.1.deselect_failed/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_fail.1.deselect_failed/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail.1.deselect_failed/bindingspec.yaml
@@ -0,0 +1,50 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/selection_fail.h
+  cname: struct OkBefore
+  hsname: OkBefore
+- headers: program-analysis/selection_fail.h
+  cname: struct OkAfter
+  hsname: OkAfter
+hstypes:
+- hsname: OkAfter
+  representation:
+    record:
+      constructor: OkAfter
+      fields:
+      - okAfter_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: OkBefore
+  representation:
+    record:
+      constructor: OkBefore
+      fields:
+      - okBefore_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail.1.deselect_failed/th.txt b/test-artefacts/fixtures/program-analysis/selection_fail.1.deselect_failed/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail.1.deselect_failed/th.txt
@@ -0,0 +1,68 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_fail.h
+{-| __C declaration:__ @struct OkBefore@
+
+    __defined at:__ @program-analysis\/selection_fail.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkBefore
+    = OkBefore {okBefore_x :: CInt
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+                     __exported by:__ @program-analysis\/selection_fail.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize OkBefore
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw OkBefore
+    where readRaw = \ptr_0 -> pure OkBefore <*> readRaw (Proxy @"okBefore_x") ptr_0
+instance WriteRaw OkBefore
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       OkBefore okBefore_x_2 -> writeRaw (Proxy @"okBefore_x") ptr_0 okBefore_x_2
+deriving via (EquivStorable OkBefore) instance Storable OkBefore
+deriving via (IsStructViaReadRaw OkBefore) instance IsStruct OkBefore
+instance (~) ty CInt => HasField "okBefore_x" OkBefore ty
+    where hasField = \x_0 -> (\y_1 -> OkBefore{okBefore_x = y_1},
+                              getField @"okBefore_x" x_0)
+instance (~) ty CInt =>
+         HasField "okBefore_x" (Ptr OkBefore) (Ptr ty)
+    where getField = fromPtr (Proxy @"okBefore_x")
+instance HasCField OkBefore "okBefore_x"
+    where type CFieldType OkBefore "okBefore_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct OkAfter@
+
+    __defined at:__ @program-analysis\/selection_fail.h 26:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkAfter
+    = OkAfter {okAfter_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @program-analysis\/selection_fail.h 27:7@
+
+                    __exported by:__ @program-analysis\/selection_fail.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize OkAfter
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw OkAfter
+    where readRaw = \ptr_0 -> pure OkAfter <*> readRaw (Proxy @"okAfter_x") ptr_0
+instance WriteRaw OkAfter
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       OkAfter okAfter_x_2 -> writeRaw (Proxy @"okAfter_x") ptr_0 okAfter_x_2
+deriving via (EquivStorable OkAfter) instance Storable OkAfter
+deriving via (IsStructViaReadRaw OkAfter) instance IsStruct OkAfter
+instance (~) ty CInt => HasField "okAfter_x" OkAfter ty
+    where hasField = \x_0 -> (\y_1 -> OkAfter{okAfter_x = y_1},
+                              getField @"okAfter_x" x_0)
+instance (~) ty CInt => HasField "okAfter_x" (Ptr OkAfter) (Ptr ty)
+    where getField = fromPtr (Proxy @"okAfter_x")
+instance HasCField OkAfter "okAfter_x"
+    where type CFieldType OkAfter "okAfter_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail.2.program_slicing/Example.hs b/test-artefacts/fixtures/program-analysis/selection_fail.2.program_slicing/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail.2.program_slicing/Example.hs
@@ -0,0 +1,163 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.OkBefore(..)
+    , Example.OkAfter(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct OkBefore@
+
+    __defined at:__ @program-analysis\/selection_fail.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkBefore = OkBefore
+  { okBefore_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+         __exported by:__ @program-analysis\/selection_fail.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize OkBefore where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw OkBefore where
+
+  readRaw =
+    \ptr0 ->
+          pure OkBefore
+      <*> HasCField.readRaw (BG.Proxy @"okBefore_x") ptr0
+
+instance Marshal.WriteRaw OkBefore where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          OkBefore okBefore_x2 ->
+            HasCField.writeRaw (BG.Proxy @"okBefore_x") ptr0 okBefore_x2
+
+deriving via Marshal.EquivStorable OkBefore instance BG.Storable OkBefore
+
+deriving via Struct.IsStructViaReadRaw OkBefore instance Struct.IsStruct OkBefore
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "okBefore_x" OkBefore ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         OkBefore {okBefore_x = y1}, BG.getField @"okBefore_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "okBefore_x" (BG.Ptr OkBefore) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"okBefore_x")
+
+instance HasCField.HasCField OkBefore "okBefore_x" where
+
+  type CFieldType OkBefore "okBefore_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct OkAfter@
+
+    __defined at:__ @program-analysis\/selection_fail.h 26:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkAfter = OkAfter
+  { okAfter_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/selection_fail.h 27:7@
+
+         __exported by:__ @program-analysis\/selection_fail.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize OkAfter where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw OkAfter where
+
+  readRaw =
+    \ptr0 ->
+          pure OkAfter
+      <*> HasCField.readRaw (BG.Proxy @"okAfter_x") ptr0
+
+instance Marshal.WriteRaw OkAfter where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          OkAfter okAfter_x2 ->
+            HasCField.writeRaw (BG.Proxy @"okAfter_x") ptr0 okAfter_x2
+
+deriving via Marshal.EquivStorable OkAfter instance BG.Storable OkAfter
+
+deriving via Struct.IsStructViaReadRaw OkAfter instance Struct.IsStruct OkAfter
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/selection_fail.h 27:7@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "okAfter_x" OkAfter ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         OkAfter {okAfter_x = y1}, BG.getField @"okAfter_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "okAfter_x" (BG.Ptr OkAfter) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"okAfter_x")
+
+instance HasCField.HasCField OkAfter "okAfter_x" where
+
+  type CFieldType OkAfter "okAfter_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail.2.program_slicing/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_fail.2.program_slicing/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail.2.program_slicing/bindingspec.yaml
@@ -0,0 +1,50 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/selection_fail.h
+  cname: struct OkBefore
+  hsname: OkBefore
+- headers: program-analysis/selection_fail.h
+  cname: struct OkAfter
+  hsname: OkAfter
+hstypes:
+- hsname: OkAfter
+  representation:
+    record:
+      constructor: OkAfter
+      fields:
+      - okAfter_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: OkBefore
+  representation:
+    record:
+      constructor: OkBefore
+      fields:
+      - okBefore_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail.2.program_slicing/th.txt b/test-artefacts/fixtures/program-analysis/selection_fail.2.program_slicing/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail.2.program_slicing/th.txt
@@ -0,0 +1,68 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_fail.h
+{-| __C declaration:__ @struct OkBefore@
+
+    __defined at:__ @program-analysis\/selection_fail.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkBefore
+    = OkBefore {okBefore_x :: CInt
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+                     __exported by:__ @program-analysis\/selection_fail.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize OkBefore
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw OkBefore
+    where readRaw = \ptr_0 -> pure OkBefore <*> readRaw (Proxy @"okBefore_x") ptr_0
+instance WriteRaw OkBefore
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       OkBefore okBefore_x_2 -> writeRaw (Proxy @"okBefore_x") ptr_0 okBefore_x_2
+deriving via (EquivStorable OkBefore) instance Storable OkBefore
+deriving via (IsStructViaReadRaw OkBefore) instance IsStruct OkBefore
+instance (~) ty CInt => HasField "okBefore_x" OkBefore ty
+    where hasField = \x_0 -> (\y_1 -> OkBefore{okBefore_x = y_1},
+                              getField @"okBefore_x" x_0)
+instance (~) ty CInt =>
+         HasField "okBefore_x" (Ptr OkBefore) (Ptr ty)
+    where getField = fromPtr (Proxy @"okBefore_x")
+instance HasCField OkBefore "okBefore_x"
+    where type CFieldType OkBefore "okBefore_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct OkAfter@
+
+    __defined at:__ @program-analysis\/selection_fail.h 26:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkAfter
+    = OkAfter {okAfter_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @program-analysis\/selection_fail.h 27:7@
+
+                    __exported by:__ @program-analysis\/selection_fail.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize OkAfter
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw OkAfter
+    where readRaw = \ptr_0 -> pure OkAfter <*> readRaw (Proxy @"okAfter_x") ptr_0
+instance WriteRaw OkAfter
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       OkAfter okAfter_x_2 -> writeRaw (Proxy @"okAfter_x") ptr_0 okAfter_x_2
+deriving via (EquivStorable OkAfter) instance Storable OkAfter
+deriving via (IsStructViaReadRaw OkAfter) instance IsStruct OkAfter
+instance (~) ty CInt => HasField "okAfter_x" OkAfter ty
+    where hasField = \x_0 -> (\y_1 -> OkAfter{okAfter_x = y_1},
+                              getField @"okAfter_x" x_0)
+instance (~) ty CInt => HasField "okAfter_x" (Ptr OkAfter) (Ptr ty)
+    where getField = fromPtr (Proxy @"okAfter_x")
+instance HasCField OkAfter "okAfter_x"
+    where type CFieldType OkAfter "okAfter_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail.3.select_ok/Example.hs b/test-artefacts/fixtures/program-analysis/selection_fail.3.select_ok/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail.3.select_ok/Example.hs
@@ -0,0 +1,94 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.OkBefore(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct OkBefore@
+
+    __defined at:__ @program-analysis\/selection_fail.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkBefore = OkBefore
+  { okBefore_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+         __exported by:__ @program-analysis\/selection_fail.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize OkBefore where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw OkBefore where
+
+  readRaw =
+    \ptr0 ->
+          pure OkBefore
+      <*> HasCField.readRaw (BG.Proxy @"okBefore_x") ptr0
+
+instance Marshal.WriteRaw OkBefore where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          OkBefore okBefore_x2 ->
+            HasCField.writeRaw (BG.Proxy @"okBefore_x") ptr0 okBefore_x2
+
+deriving via Marshal.EquivStorable OkBefore instance BG.Storable OkBefore
+
+deriving via Struct.IsStructViaReadRaw OkBefore instance Struct.IsStruct OkBefore
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "okBefore_x" OkBefore ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         OkBefore {okBefore_x = y1}, BG.getField @"okBefore_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "okBefore_x" (BG.Ptr OkBefore) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"okBefore_x")
+
+instance HasCField.HasCField OkBefore "okBefore_x" where
+
+  type CFieldType OkBefore "okBefore_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail.3.select_ok/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_fail.3.select_ok/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail.3.select_ok/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/selection_fail.h
+  cname: struct OkBefore
+  hsname: OkBefore
+hstypes:
+- hsname: OkBefore
+  representation:
+    record:
+      constructor: OkBefore
+      fields:
+      - okBefore_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail.3.select_ok/th.txt b/test-artefacts/fixtures/program-analysis/selection_fail.3.select_ok/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail.3.select_ok/th.txt
@@ -0,0 +1,35 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_fail.h
+{-| __C declaration:__ @struct OkBefore@
+
+    __defined at:__ @program-analysis\/selection_fail.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkBefore
+    = OkBefore {okBefore_x :: CInt
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+                     __exported by:__ @program-analysis\/selection_fail.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize OkBefore
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw OkBefore
+    where readRaw = \ptr_0 -> pure OkBefore <*> readRaw (Proxy @"okBefore_x") ptr_0
+instance WriteRaw OkBefore
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       OkBefore okBefore_x_2 -> writeRaw (Proxy @"okBefore_x") ptr_0 okBefore_x_2
+deriving via (EquivStorable OkBefore) instance Storable OkBefore
+deriving via (IsStructViaReadRaw OkBefore) instance IsStruct OkBefore
+instance (~) ty CInt => HasField "okBefore_x" OkBefore ty
+    where hasField = \x_0 -> (\y_1 -> OkBefore{okBefore_x = y_1},
+                              getField @"okBefore_x" x_0)
+instance (~) ty CInt =>
+         HasField "okBefore_x" (Ptr OkBefore) (Ptr ty)
+    where getField = fromPtr (Proxy @"okBefore_x")
+instance HasCField OkBefore "okBefore_x"
+    where type CFieldType OkBefore "okBefore_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail/Example.hs b/test-artefacts/fixtures/program-analysis/selection_fail/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail/Example.hs
@@ -0,0 +1,163 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.OkBefore(..)
+    , Example.OkAfter(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct OkBefore@
+
+    __defined at:__ @program-analysis\/selection_fail.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkBefore = OkBefore
+  { okBefore_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+         __exported by:__ @program-analysis\/selection_fail.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize OkBefore where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw OkBefore where
+
+  readRaw =
+    \ptr0 ->
+          pure OkBefore
+      <*> HasCField.readRaw (BG.Proxy @"okBefore_x") ptr0
+
+instance Marshal.WriteRaw OkBefore where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          OkBefore okBefore_x2 ->
+            HasCField.writeRaw (BG.Proxy @"okBefore_x") ptr0 okBefore_x2
+
+deriving via Marshal.EquivStorable OkBefore instance BG.Storable OkBefore
+
+deriving via Struct.IsStructViaReadRaw OkBefore instance Struct.IsStruct OkBefore
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "okBefore_x" OkBefore ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         OkBefore {okBefore_x = y1}, BG.getField @"okBefore_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "okBefore_x" (BG.Ptr OkBefore) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"okBefore_x")
+
+instance HasCField.HasCField OkBefore "okBefore_x" where
+
+  type CFieldType OkBefore "okBefore_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct OkAfter@
+
+    __defined at:__ @program-analysis\/selection_fail.h 26:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkAfter = OkAfter
+  { okAfter_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/selection_fail.h 27:7@
+
+         __exported by:__ @program-analysis\/selection_fail.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize OkAfter where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw OkAfter where
+
+  readRaw =
+    \ptr0 ->
+          pure OkAfter
+      <*> HasCField.readRaw (BG.Proxy @"okAfter_x") ptr0
+
+instance Marshal.WriteRaw OkAfter where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          OkAfter okAfter_x2 ->
+            HasCField.writeRaw (BG.Proxy @"okAfter_x") ptr0 okAfter_x2
+
+deriving via Marshal.EquivStorable OkAfter instance BG.Storable OkAfter
+
+deriving via Struct.IsStructViaReadRaw OkAfter instance Struct.IsStruct OkAfter
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/selection_fail.h 27:7@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "okAfter_x" OkAfter ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         OkAfter {okAfter_x = y1}, BG.getField @"okAfter_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "okAfter_x" (BG.Ptr OkAfter) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"okAfter_x")
+
+instance HasCField.HasCField OkAfter "okAfter_x" where
+
+  type CFieldType OkAfter "okAfter_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_fail/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail/bindingspec.yaml
@@ -0,0 +1,50 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/selection_fail.h
+  cname: struct OkBefore
+  hsname: OkBefore
+- headers: program-analysis/selection_fail.h
+  cname: struct OkAfter
+  hsname: OkAfter
+hstypes:
+- hsname: OkAfter
+  representation:
+    record:
+      constructor: OkAfter
+      fields:
+      - okAfter_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: OkBefore
+  representation:
+    record:
+      constructor: OkBefore
+      fields:
+      - okBefore_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/selection_fail/th.txt b/test-artefacts/fixtures/program-analysis/selection_fail/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_fail/th.txt
@@ -0,0 +1,68 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_fail.h
+{-| __C declaration:__ @struct OkBefore@
+
+    __defined at:__ @program-analysis\/selection_fail.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkBefore
+    = OkBefore {okBefore_x :: CInt
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @program-analysis\/selection_fail.h 2:7@
+
+                     __exported by:__ @program-analysis\/selection_fail.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize OkBefore
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw OkBefore
+    where readRaw = \ptr_0 -> pure OkBefore <*> readRaw (Proxy @"okBefore_x") ptr_0
+instance WriteRaw OkBefore
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       OkBefore okBefore_x_2 -> writeRaw (Proxy @"okBefore_x") ptr_0 okBefore_x_2
+deriving via (EquivStorable OkBefore) instance Storable OkBefore
+deriving via (IsStructViaReadRaw OkBefore) instance IsStruct OkBefore
+instance (~) ty CInt => HasField "okBefore_x" OkBefore ty
+    where hasField = \x_0 -> (\y_1 -> OkBefore{okBefore_x = y_1},
+                              getField @"okBefore_x" x_0)
+instance (~) ty CInt =>
+         HasField "okBefore_x" (Ptr OkBefore) (Ptr ty)
+    where getField = fromPtr (Proxy @"okBefore_x")
+instance HasCField OkBefore "okBefore_x"
+    where type CFieldType OkBefore "okBefore_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct OkAfter@
+
+    __defined at:__ @program-analysis\/selection_fail.h 26:8@
+
+    __exported by:__ @program-analysis\/selection_fail.h@
+-}
+data OkAfter
+    = OkAfter {okAfter_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @program-analysis\/selection_fail.h 27:7@
+
+                    __exported by:__ @program-analysis\/selection_fail.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize OkAfter
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw OkAfter
+    where readRaw = \ptr_0 -> pure OkAfter <*> readRaw (Proxy @"okAfter_x") ptr_0
+instance WriteRaw OkAfter
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       OkAfter okAfter_x_2 -> writeRaw (Proxy @"okAfter_x") ptr_0 okAfter_x_2
+deriving via (EquivStorable OkAfter) instance Storable OkAfter
+deriving via (IsStructViaReadRaw OkAfter) instance IsStruct OkAfter
+instance (~) ty CInt => HasField "okAfter_x" OkAfter ty
+    where hasField = \x_0 -> (\y_1 -> OkAfter{okAfter_x = y_1},
+                              getField @"okAfter_x" x_0)
+instance (~) ty CInt => HasField "okAfter_x" (Ptr OkAfter) (Ptr ty)
+    where getField = fromPtr (Proxy @"okAfter_x")
+instance HasCField OkAfter "okAfter_x"
+    where type CFieldType OkAfter "okAfter_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_foo/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_foo/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_foo/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/program-analysis/selection_foo/th.txt b/test-artefacts/fixtures/program-analysis/selection_foo/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_foo/th.txt
@@ -0,0 +1,2 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_foo_t.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_foo.h
diff --git a/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example.hs b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example.hs
@@ -0,0 +1,94 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.NewName(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct StructWithAssignedHaskellNameByPrescriptiveBindingSpecs@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 7:8@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+data NewName = NewName
+  { newName_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/selection_matches_c_names.h 8:7@
+
+         __exported by:__ @program-analysis\/selection_matches_c_names.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize NewName where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw NewName where
+
+  readRaw =
+    \ptr0 ->
+          pure NewName
+      <*> HasCField.readRaw (BG.Proxy @"newName_x") ptr0
+
+instance Marshal.WriteRaw NewName where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          NewName newName_x2 ->
+            HasCField.writeRaw (BG.Proxy @"newName_x") ptr0 newName_x2
+
+deriving via Marshal.EquivStorable NewName instance BG.Storable NewName
+
+deriving via Struct.IsStructViaReadRaw NewName instance Struct.IsStruct NewName
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 8:7@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "newName_x" NewName ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         NewName {newName_x = y1}, BG.getField @"newName_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "newName_x" (BG.Ptr NewName) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"newName_x")
+
+instance HasCField.HasCField NewName "newName_x" where
+
+  type CFieldType NewName "newName_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example/FunPtr.hs b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example/FunPtr.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.functionWithAssignedHaskellNameByNameMangler
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/selection_matches_c_names.h>"
+  , "/* test_programanalysisselection_mat_Example_get_FunctionWithAssignedHaskellNameByNameMangler */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_1ccc97a484f823b2 (void)) (void)"
+  , "{"
+  , "  return &FunctionWithAssignedHaskellNameByNameMangler;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisselection_mat_Example_get_FunctionWithAssignedHaskellNameByNameMangler@
+foreign import ccall unsafe "hs_bindgen_1ccc97a484f823b2" hs_bindgen_1ccc97a484f823b2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_programanalysisselection_mat_Example_get_FunctionWithAssignedHaskellNameByNameMangler@
+hs_bindgen_1ccc97a484f823b2 :: IO (BG.FunPtr (IO BG.CInt))
+hs_bindgen_1ccc97a484f823b2 =
+  fmap BG.fromFFIType hs_bindgen_1ccc97a484f823b2_base
+
+{-# NOINLINE functionWithAssignedHaskellNameByNameMangler #-}
+{-| __C declaration:__ @FunctionWithAssignedHaskellNameByNameMangler@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 5:5@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+functionWithAssignedHaskellNameByNameMangler :: BG.FunPtr (IO BG.CInt)
+functionWithAssignedHaskellNameByNameMangler =
+  BG.unsafePerformIO hs_bindgen_1ccc97a484f823b2
diff --git a/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example/Safe.hs b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example/Safe.hs
@@ -0,0 +1,40 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.functionWithAssignedHaskellNameByNameMangler
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/selection_matches_c_names.h>"
+  , "signed int hs_bindgen_c9b1dc5577fd8ced (void)"
+  , "{"
+  , "  return (FunctionWithAssignedHaskellNameByNameMangler)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisselection_mat_Example_Safe_FunctionWithAssignedHaskellNameByNameMangler@
+foreign import ccall safe "hs_bindgen_c9b1dc5577fd8ced" hs_bindgen_c9b1dc5577fd8ced_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_programanalysisselection_mat_Example_Safe_FunctionWithAssignedHaskellNameByNameMangler@
+hs_bindgen_c9b1dc5577fd8ced :: IO BG.CInt
+hs_bindgen_c9b1dc5577fd8ced =
+  fmap BG.fromFFIType hs_bindgen_c9b1dc5577fd8ced_base
+
+{-| __C declaration:__ @FunctionWithAssignedHaskellNameByNameMangler@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 5:5@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+functionWithAssignedHaskellNameByNameMangler :: IO BG.CInt
+functionWithAssignedHaskellNameByNameMangler =
+  hs_bindgen_c9b1dc5577fd8ced
diff --git a/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example/Unsafe.hs b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/Example/Unsafe.hs
@@ -0,0 +1,40 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.functionWithAssignedHaskellNameByNameMangler
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <program-analysis/selection_matches_c_names.h>"
+  , "signed int hs_bindgen_9a13a53e6a2f2416 (void)"
+  , "{"
+  , "  return (FunctionWithAssignedHaskellNameByNameMangler)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_programanalysisselection_mat_Example_Unsafe_FunctionWithAssignedHaskellNameByNameMangler@
+foreign import ccall unsafe "hs_bindgen_9a13a53e6a2f2416" hs_bindgen_9a13a53e6a2f2416_base ::
+     IO BG.CInt
+
+-- __unique:__ @test_programanalysisselection_mat_Example_Unsafe_FunctionWithAssignedHaskellNameByNameMangler@
+hs_bindgen_9a13a53e6a2f2416 :: IO BG.CInt
+hs_bindgen_9a13a53e6a2f2416 =
+  fmap BG.fromFFIType hs_bindgen_9a13a53e6a2f2416_base
+
+{-| __C declaration:__ @FunctionWithAssignedHaskellNameByNameMangler@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 5:5@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+functionWithAssignedHaskellNameByNameMangler :: IO BG.CInt
+functionWithAssignedHaskellNameByNameMangler =
+  hs_bindgen_9a13a53e6a2f2416
diff --git a/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/selection_matches_c_names.h
+  cname: struct StructWithAssignedHaskellNameByPrescriptiveBindingSpecs
+  hsname: NewName
+hstypes:
+- hsname: NewName
+  representation:
+    record:
+      constructor: NewName
+      fields:
+      - newName_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/th.txt b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.1.positive_case/th.txt
@@ -0,0 +1,113 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_matches_c_names.h
+-- #include <program-analysis/selection_matches_c_names.h>
+-- signed int hs_bindgen_c9b1dc5577fd8ced (void)
+-- {
+--   return (FunctionWithAssignedHaskellNameByNameMangler)();
+-- }
+-- signed int hs_bindgen_9a13a53e6a2f2416 (void)
+-- {
+--   return (FunctionWithAssignedHaskellNameByNameMangler)();
+-- }
+-- /* test_programanalysisselection_mat_Example_get_FunctionWithAssignedHaskellNameByNameMangler */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_1ccc97a484f823b2 (void)) (void)
+-- {
+--   return &FunctionWithAssignedHaskellNameByNameMangler;
+-- }
+{-| __C declaration:__ @struct StructWithAssignedHaskellNameByPrescriptiveBindingSpecs@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 7:8@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+data NewName
+    = NewName {newName_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @program-analysis\/selection_matches_c_names.h 8:7@
+
+                    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize NewName
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw NewName
+    where readRaw = \ptr_0 -> pure NewName <*> readRaw (Proxy @"newName_x") ptr_0
+instance WriteRaw NewName
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       NewName newName_x_2 -> writeRaw (Proxy @"newName_x") ptr_0 newName_x_2
+deriving via (EquivStorable NewName) instance Storable NewName
+deriving via (IsStructViaReadRaw NewName) instance IsStruct NewName
+instance (~) ty CInt => HasField "newName_x" NewName ty
+    where hasField = \x_0 -> (\y_1 -> NewName{newName_x = y_1},
+                              getField @"newName_x" x_0)
+instance (~) ty CInt => HasField "newName_x" (Ptr NewName) (Ptr ty)
+    where getField = fromPtr (Proxy @"newName_x")
+instance HasCField NewName "newName_x"
+    where type CFieldType NewName "newName_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_programanalysisselection_mat_Example_Safe_FunctionWithAssignedHaskellNameByNameMangler@
+foreign import ccall safe "hs_bindgen_c9b1dc5577fd8ced" hs_bindgen_c9b1dc5577fd8ced_base ::
+    IO CInt
+-- __unique:__ @test_programanalysisselection_mat_Example_Safe_FunctionWithAssignedHaskellNameByNameMangler@
+hs_bindgen_c9b1dc5577fd8ced :: IO CInt
+-- __unique:__ @test_programanalysisselection_mat_Example_Safe_FunctionWithAssignedHaskellNameByNameMangler@
+hs_bindgen_c9b1dc5577fd8ced = fmap fromFFIType hs_bindgen_c9b1dc5577fd8ced_base
+{-| __C declaration:__ @FunctionWithAssignedHaskellNameByNameMangler@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 5:5@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+functionWithAssignedHaskellNameByNameMangler_safe :: IO CInt
+{-| __C declaration:__ @FunctionWithAssignedHaskellNameByNameMangler@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 5:5@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+functionWithAssignedHaskellNameByNameMangler_safe = hs_bindgen_c9b1dc5577fd8ced
+-- __unique:__ @test_programanalysisselection_mat_Example_Unsafe_FunctionWithAssignedHaskellNameByNameMangler@
+foreign import ccall unsafe "hs_bindgen_9a13a53e6a2f2416" hs_bindgen_9a13a53e6a2f2416_base ::
+    IO CInt
+-- __unique:__ @test_programanalysisselection_mat_Example_Unsafe_FunctionWithAssignedHaskellNameByNameMangler@
+hs_bindgen_9a13a53e6a2f2416 :: IO CInt
+-- __unique:__ @test_programanalysisselection_mat_Example_Unsafe_FunctionWithAssignedHaskellNameByNameMangler@
+hs_bindgen_9a13a53e6a2f2416 = fmap fromFFIType hs_bindgen_9a13a53e6a2f2416_base
+{-| __C declaration:__ @FunctionWithAssignedHaskellNameByNameMangler@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 5:5@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+functionWithAssignedHaskellNameByNameMangler_unsafe :: IO CInt
+{-| __C declaration:__ @FunctionWithAssignedHaskellNameByNameMangler@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 5:5@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+functionWithAssignedHaskellNameByNameMangler_unsafe = hs_bindgen_9a13a53e6a2f2416
+-- __unique:__ @test_programanalysisselection_mat_Example_get_FunctionWithAssignedHaskellNameByNameMangler@
+foreign import ccall unsafe "hs_bindgen_1ccc97a484f823b2" hs_bindgen_1ccc97a484f823b2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_programanalysisselection_mat_Example_get_FunctionWithAssignedHaskellNameByNameMangler@
+hs_bindgen_1ccc97a484f823b2 :: IO (FunPtr (IO CInt))
+-- __unique:__ @test_programanalysisselection_mat_Example_get_FunctionWithAssignedHaskellNameByNameMangler@
+hs_bindgen_1ccc97a484f823b2 = fmap fromFFIType hs_bindgen_1ccc97a484f823b2_base
+{-# NOINLINE functionWithAssignedHaskellNameByNameMangler_funptr #-}
+{-| __C declaration:__ @FunctionWithAssignedHaskellNameByNameMangler@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 5:5@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+functionWithAssignedHaskellNameByNameMangler_funptr :: FunPtr (IO CInt)
+{-| __C declaration:__ @FunctionWithAssignedHaskellNameByNameMangler@
+
+    __defined at:__ @program-analysis\/selection_matches_c_names.h 5:5@
+
+    __exported by:__ @program-analysis\/selection_matches_c_names.h@
+-}
+functionWithAssignedHaskellNameByNameMangler_funptr = unsafePerformIO hs_bindgen_1ccc97a484f823b2
diff --git a/test-artefacts/fixtures/program-analysis/selection_matches_c_names.2.negative_case/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.2.negative_case/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.2.negative_case/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/program-analysis/selection_matches_c_names.2.negative_case/th.txt b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.2.negative_case/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_matches_c_names.2.negative_case/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_matches_c_names.h
diff --git a/test-artefacts/fixtures/program-analysis/selection_merge_traces/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_merge_traces/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_merge_traces/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/program-analysis/selection_merge_traces/th.txt b/test-artefacts/fixtures/program-analysis/selection_merge_traces/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_merge_traces/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_merge_traces.h
diff --git a/test-artefacts/fixtures/program-analysis/selection_omit_external_a/Example.hs b/test-artefacts/fixtures/program-analysis/selection_omit_external_a/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_omit_external_a/Example.hs
@@ -0,0 +1,98 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.UnrelatedDeclaration(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct UnrelatedDeclaration@
+
+    __defined at:__ @program-analysis\/selection_omit_external_a.h 4:8@
+
+    __exported by:__ @program-analysis\/selection_omit_external_a.h@
+-}
+data UnrelatedDeclaration = UnrelatedDeclaration
+  { unrelatedDeclaration_m :: BG.CInt
+    {- ^ __C declaration:__ @m@
+
+         __defined at:__ @program-analysis\/selection_omit_external_a.h 5:7@
+
+         __exported by:__ @program-analysis\/selection_omit_external_a.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UnrelatedDeclaration where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UnrelatedDeclaration where
+
+  readRaw =
+    \ptr0 ->
+          pure UnrelatedDeclaration
+      <*> HasCField.readRaw (BG.Proxy @"unrelatedDeclaration_m") ptr0
+
+instance Marshal.WriteRaw UnrelatedDeclaration where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UnrelatedDeclaration unrelatedDeclaration_m2 ->
+            HasCField.writeRaw (BG.Proxy @"unrelatedDeclaration_m") ptr0 unrelatedDeclaration_m2
+
+deriving via Marshal.EquivStorable UnrelatedDeclaration instance BG.Storable UnrelatedDeclaration
+
+deriving via Struct.IsStructViaReadRaw UnrelatedDeclaration instance Struct.IsStruct UnrelatedDeclaration
+
+{-| __C declaration:__ @m@
+
+    __defined at:__ @program-analysis\/selection_omit_external_a.h 5:7@
+
+    __exported by:__ @program-analysis\/selection_omit_external_a.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unrelatedDeclaration_m" UnrelatedDeclaration ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UnrelatedDeclaration {unrelatedDeclaration_m = y1}
+      , BG.getField @"unrelatedDeclaration_m" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unrelatedDeclaration_m" (BG.Ptr UnrelatedDeclaration) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unrelatedDeclaration_m")
+
+instance HasCField.HasCField UnrelatedDeclaration "unrelatedDeclaration_m" where
+
+  type CFieldType UnrelatedDeclaration "unrelatedDeclaration_m" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_omit_external_a/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_omit_external_a/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_omit_external_a/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/selection_omit_external_a.h
+  cname: struct UnrelatedDeclaration
+  hsname: UnrelatedDeclaration
+hstypes:
+- hsname: UnrelatedDeclaration
+  representation:
+    record:
+      constructor: UnrelatedDeclaration
+      fields:
+      - unrelatedDeclaration_m
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/selection_omit_external_a/th.txt b/test-artefacts/fixtures/program-analysis/selection_omit_external_a/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_omit_external_a/th.txt
@@ -0,0 +1,40 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_omit_external_root.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_omit_external_a.h
+{-| __C declaration:__ @struct UnrelatedDeclaration@
+
+    __defined at:__ @program-analysis\/selection_omit_external_a.h 4:8@
+
+    __exported by:__ @program-analysis\/selection_omit_external_a.h@
+-}
+data UnrelatedDeclaration
+    = UnrelatedDeclaration {unrelatedDeclaration_m :: CInt
+                            {- ^ __C declaration:__ @m@
+
+                                 __defined at:__ @program-analysis\/selection_omit_external_a.h 5:7@
+
+                                 __exported by:__ @program-analysis\/selection_omit_external_a.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UnrelatedDeclaration
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UnrelatedDeclaration
+    where readRaw = \ptr_0 -> pure UnrelatedDeclaration <*> readRaw (Proxy @"unrelatedDeclaration_m") ptr_0
+instance WriteRaw UnrelatedDeclaration
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UnrelatedDeclaration unrelatedDeclaration_m_2 -> writeRaw (Proxy @"unrelatedDeclaration_m") ptr_0 unrelatedDeclaration_m_2
+deriving via (EquivStorable UnrelatedDeclaration) instance Storable UnrelatedDeclaration
+deriving via (IsStructViaReadRaw UnrelatedDeclaration) instance IsStruct UnrelatedDeclaration
+instance (~) ty CInt =>
+         HasField "unrelatedDeclaration_m" UnrelatedDeclaration ty
+    where hasField = \x_0 -> (\y_1 -> UnrelatedDeclaration{unrelatedDeclaration_m = y_1},
+                              getField @"unrelatedDeclaration_m" x_0)
+instance (~) ty CInt =>
+         HasField "unrelatedDeclaration_m"
+                  (Ptr UnrelatedDeclaration)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unrelatedDeclaration_m")
+instance HasCField UnrelatedDeclaration "unrelatedDeclaration_m"
+    where type CFieldType UnrelatedDeclaration
+                          "unrelatedDeclaration_m" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_omit_external_b/Example.hs b/test-artefacts/fixtures/program-analysis/selection_omit_external_b/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_omit_external_b/Example.hs
@@ -0,0 +1,240 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Omitted(..)
+    , Example.DirectlyDependsOnOmitted(..)
+    , Example.IndirectlyDependsOnOmitted(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct Omitted@
+
+    __defined at:__ @selection_omit_external_root.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+-}
+data Omitted = Omitted
+  { omitted_n :: BG.CInt
+    {- ^ __C declaration:__ @n@
+
+         __defined at:__ @selection_omit_external_root.h 2:7@
+
+         __exported by:__ @program-analysis\/selection_omit_external_b.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Omitted where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Omitted where
+
+  readRaw =
+    \ptr0 ->
+          pure Omitted
+      <*> HasCField.readRaw (BG.Proxy @"omitted_n") ptr0
+
+instance Marshal.WriteRaw Omitted where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Omitted omitted_n2 ->
+            HasCField.writeRaw (BG.Proxy @"omitted_n") ptr0 omitted_n2
+
+deriving via Marshal.EquivStorable Omitted instance BG.Storable Omitted
+
+deriving via Struct.IsStructViaReadRaw Omitted instance Struct.IsStruct Omitted
+
+{-| __C declaration:__ @n@
+
+    __defined at:__ @selection_omit_external_root.h 2:7@
+
+    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "omitted_n" Omitted ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Omitted {omitted_n = y1}, BG.getField @"omitted_n" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "omitted_n" (BG.Ptr Omitted) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"omitted_n")
+
+instance HasCField.HasCField Omitted "omitted_n" where
+
+  type CFieldType Omitted "omitted_n" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct DirectlyDependsOnOmitted@
+
+    __defined at:__ @program-analysis\/selection_omit_external_b.h 4:8@
+
+    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+-}
+data DirectlyDependsOnOmitted = DirectlyDependsOnOmitted
+  { directlyDependsOnOmitted_o :: Omitted
+    {- ^ __C declaration:__ @o@
+
+         __defined at:__ @program-analysis\/selection_omit_external_b.h 5:18@
+
+         __exported by:__ @program-analysis\/selection_omit_external_b.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize DirectlyDependsOnOmitted where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DirectlyDependsOnOmitted where
+
+  readRaw =
+    \ptr0 ->
+          pure DirectlyDependsOnOmitted
+      <*> HasCField.readRaw (BG.Proxy @"directlyDependsOnOmitted_o") ptr0
+
+instance Marshal.WriteRaw DirectlyDependsOnOmitted where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DirectlyDependsOnOmitted directlyDependsOnOmitted_o2 ->
+            HasCField.writeRaw (BG.Proxy @"directlyDependsOnOmitted_o") ptr0 directlyDependsOnOmitted_o2
+
+deriving via Marshal.EquivStorable DirectlyDependsOnOmitted instance BG.Storable DirectlyDependsOnOmitted
+
+deriving via Struct.IsStructViaReadRaw DirectlyDependsOnOmitted instance Struct.IsStruct DirectlyDependsOnOmitted
+
+{-| __C declaration:__ @o@
+
+    __defined at:__ @program-analysis\/selection_omit_external_b.h 5:18@
+
+    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+-}
+instance ( ty ~ Omitted
+         ) => BG.CompatHasField.HasField "directlyDependsOnOmitted_o" DirectlyDependsOnOmitted ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DirectlyDependsOnOmitted {directlyDependsOnOmitted_o = y1}
+      , BG.getField @"directlyDependsOnOmitted_o" x0
+      )
+
+instance ( ty ~ Omitted
+         ) => BG.HasField "directlyDependsOnOmitted_o" (BG.Ptr DirectlyDependsOnOmitted) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"directlyDependsOnOmitted_o")
+
+instance HasCField.HasCField DirectlyDependsOnOmitted "directlyDependsOnOmitted_o" where
+
+  type CFieldType DirectlyDependsOnOmitted "directlyDependsOnOmitted_o" =
+    Omitted
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct IndirectlyDependsOnOmitted@
+
+    __defined at:__ @program-analysis\/selection_omit_external_b.h 8:8@
+
+    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+-}
+data IndirectlyDependsOnOmitted = IndirectlyDependsOnOmitted
+  { indirectlyDependsOnOmitted_d :: DirectlyDependsOnOmitted
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @program-analysis\/selection_omit_external_b.h 9:35@
+
+         __exported by:__ @program-analysis\/selection_omit_external_b.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize IndirectlyDependsOnOmitted where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw IndirectlyDependsOnOmitted where
+
+  readRaw =
+    \ptr0 ->
+          pure IndirectlyDependsOnOmitted
+      <*> HasCField.readRaw (BG.Proxy @"indirectlyDependsOnOmitted_d") ptr0
+
+instance Marshal.WriteRaw IndirectlyDependsOnOmitted where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          IndirectlyDependsOnOmitted indirectlyDependsOnOmitted_d2 ->
+            HasCField.writeRaw (BG.Proxy @"indirectlyDependsOnOmitted_d") ptr0 indirectlyDependsOnOmitted_d2
+
+deriving via Marshal.EquivStorable IndirectlyDependsOnOmitted instance BG.Storable IndirectlyDependsOnOmitted
+
+deriving via Struct.IsStructViaReadRaw IndirectlyDependsOnOmitted instance Struct.IsStruct IndirectlyDependsOnOmitted
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @program-analysis\/selection_omit_external_b.h 9:35@
+
+    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+-}
+instance ( ty ~ DirectlyDependsOnOmitted
+         ) => BG.CompatHasField.HasField "indirectlyDependsOnOmitted_d" IndirectlyDependsOnOmitted ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          IndirectlyDependsOnOmitted {indirectlyDependsOnOmitted_d = y1}
+      , BG.getField @"indirectlyDependsOnOmitted_d" x0
+      )
+
+instance ( ty ~ DirectlyDependsOnOmitted
+         ) => BG.HasField "indirectlyDependsOnOmitted_d" (BG.Ptr IndirectlyDependsOnOmitted) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"indirectlyDependsOnOmitted_d")
+
+instance HasCField.HasCField IndirectlyDependsOnOmitted "indirectlyDependsOnOmitted_d" where
+
+  type CFieldType IndirectlyDependsOnOmitted "indirectlyDependsOnOmitted_d" =
+    DirectlyDependsOnOmitted
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_omit_external_b/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_omit_external_b/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_omit_external_b/bindingspec.yaml
@@ -0,0 +1,72 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/selection_omit_external_b.h
+  cname: struct Omitted
+  hsname: Omitted
+- headers: program-analysis/selection_omit_external_b.h
+  cname: struct DirectlyDependsOnOmitted
+  hsname: DirectlyDependsOnOmitted
+- headers: program-analysis/selection_omit_external_b.h
+  cname: struct IndirectlyDependsOnOmitted
+  hsname: IndirectlyDependsOnOmitted
+hstypes:
+- hsname: DirectlyDependsOnOmitted
+  representation:
+    record:
+      constructor: DirectlyDependsOnOmitted
+      fields:
+      - directlyDependsOnOmitted_o
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: IndirectlyDependsOnOmitted
+  representation:
+    record:
+      constructor: IndirectlyDependsOnOmitted
+      fields:
+      - indirectlyDependsOnOmitted_d
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Omitted
+  representation:
+    record:
+      constructor: Omitted
+      fields:
+      - omitted_n
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/selection_omit_external_b/th.txt b/test-artefacts/fixtures/program-analysis/selection_omit_external_b/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_omit_external_b/th.txt
@@ -0,0 +1,115 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_omit_external_root.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_omit_external_b.h
+{-| __C declaration:__ @struct Omitted@
+
+    __defined at:__ @selection_omit_external_root.h 1:8@
+
+    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+-}
+data Omitted
+    = Omitted {omitted_n :: CInt
+               {- ^ __C declaration:__ @n@
+
+                    __defined at:__ @selection_omit_external_root.h 2:7@
+
+                    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Omitted
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Omitted
+    where readRaw = \ptr_0 -> pure Omitted <*> readRaw (Proxy @"omitted_n") ptr_0
+instance WriteRaw Omitted
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Omitted omitted_n_2 -> writeRaw (Proxy @"omitted_n") ptr_0 omitted_n_2
+deriving via (EquivStorable Omitted) instance Storable Omitted
+deriving via (IsStructViaReadRaw Omitted) instance IsStruct Omitted
+instance (~) ty CInt => HasField "omitted_n" Omitted ty
+    where hasField = \x_0 -> (\y_1 -> Omitted{omitted_n = y_1},
+                              getField @"omitted_n" x_0)
+instance (~) ty CInt => HasField "omitted_n" (Ptr Omitted) (Ptr ty)
+    where getField = fromPtr (Proxy @"omitted_n")
+instance HasCField Omitted "omitted_n"
+    where type CFieldType Omitted "omitted_n" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct DirectlyDependsOnOmitted@
+
+    __defined at:__ @program-analysis\/selection_omit_external_b.h 4:8@
+
+    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+-}
+data DirectlyDependsOnOmitted
+    = DirectlyDependsOnOmitted {directlyDependsOnOmitted_o :: Omitted
+                                {- ^ __C declaration:__ @o@
+
+                                     __defined at:__ @program-analysis\/selection_omit_external_b.h 5:18@
+
+                                     __exported by:__ @program-analysis\/selection_omit_external_b.h@
+                                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize DirectlyDependsOnOmitted
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw DirectlyDependsOnOmitted
+    where readRaw = \ptr_0 -> pure DirectlyDependsOnOmitted <*> readRaw (Proxy @"directlyDependsOnOmitted_o") ptr_0
+instance WriteRaw DirectlyDependsOnOmitted
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       DirectlyDependsOnOmitted directlyDependsOnOmitted_o_2 -> writeRaw (Proxy @"directlyDependsOnOmitted_o") ptr_0 directlyDependsOnOmitted_o_2
+deriving via (EquivStorable DirectlyDependsOnOmitted) instance Storable DirectlyDependsOnOmitted
+deriving via (IsStructViaReadRaw DirectlyDependsOnOmitted) instance IsStruct DirectlyDependsOnOmitted
+instance (~) ty Omitted =>
+         HasField "directlyDependsOnOmitted_o" DirectlyDependsOnOmitted ty
+    where hasField = \x_0 -> (\y_1 -> DirectlyDependsOnOmitted{directlyDependsOnOmitted_o = y_1},
+                              getField @"directlyDependsOnOmitted_o" x_0)
+instance (~) ty Omitted =>
+         HasField "directlyDependsOnOmitted_o"
+                  (Ptr DirectlyDependsOnOmitted)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"directlyDependsOnOmitted_o")
+instance HasCField DirectlyDependsOnOmitted
+                   "directlyDependsOnOmitted_o"
+    where type CFieldType DirectlyDependsOnOmitted
+                          "directlyDependsOnOmitted_o" = Omitted
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct IndirectlyDependsOnOmitted@
+
+    __defined at:__ @program-analysis\/selection_omit_external_b.h 8:8@
+
+    __exported by:__ @program-analysis\/selection_omit_external_b.h@
+-}
+data IndirectlyDependsOnOmitted
+    = IndirectlyDependsOnOmitted {indirectlyDependsOnOmitted_d :: DirectlyDependsOnOmitted
+                                  {- ^ __C declaration:__ @d@
+
+                                       __defined at:__ @program-analysis\/selection_omit_external_b.h 9:35@
+
+                                       __exported by:__ @program-analysis\/selection_omit_external_b.h@
+                                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize IndirectlyDependsOnOmitted
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw IndirectlyDependsOnOmitted
+    where readRaw = \ptr_0 -> pure IndirectlyDependsOnOmitted <*> readRaw (Proxy @"indirectlyDependsOnOmitted_d") ptr_0
+instance WriteRaw IndirectlyDependsOnOmitted
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       IndirectlyDependsOnOmitted indirectlyDependsOnOmitted_d_2 -> writeRaw (Proxy @"indirectlyDependsOnOmitted_d") ptr_0 indirectlyDependsOnOmitted_d_2
+deriving via (EquivStorable IndirectlyDependsOnOmitted) instance Storable IndirectlyDependsOnOmitted
+deriving via (IsStructViaReadRaw IndirectlyDependsOnOmitted) instance IsStruct IndirectlyDependsOnOmitted
+instance (~) ty DirectlyDependsOnOmitted =>
+         HasField "indirectlyDependsOnOmitted_d"
+                  IndirectlyDependsOnOmitted
+                  ty
+    where hasField = \x_0 -> (\y_1 -> IndirectlyDependsOnOmitted{indirectlyDependsOnOmitted_d = y_1},
+                              getField @"indirectlyDependsOnOmitted_d" x_0)
+instance (~) ty DirectlyDependsOnOmitted =>
+         HasField "indirectlyDependsOnOmitted_d"
+                  (Ptr IndirectlyDependsOnOmitted)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"indirectlyDependsOnOmitted_d")
+instance HasCField IndirectlyDependsOnOmitted
+                   "indirectlyDependsOnOmitted_d"
+    where type CFieldType IndirectlyDependsOnOmitted
+                          "indirectlyDependsOnOmitted_d" = DirectlyDependsOnOmitted
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/selection_omit_prescriptive/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_omit_prescriptive/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_omit_prescriptive/bindingspec.yaml
@@ -0,0 +1,8 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- omit:
+    headers: program-analysis/selection_omit_prescriptive.h
+    cname: struct Omitted
diff --git a/test-artefacts/fixtures/program-analysis/selection_omit_prescriptive/th.txt b/test-artefacts/fixtures/program-analysis/selection_omit_prescriptive/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_omit_prescriptive/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_omit_prescriptive.h
diff --git a/test-artefacts/fixtures/program-analysis/selection_squash_typedef/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/selection_squash_typedef/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_squash_typedef/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/program-analysis/selection_squash_typedef/th.txt b/test-artefacts/fixtures/program-analysis/selection_squash_typedef/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/selection_squash_typedef/th.txt
@@ -0,0 +1,2 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_squash_struct.h
+-- addDependentFile test-artefacts/headers/golden/program-analysis/selection_squash_typedef.h
diff --git a/test-artefacts/fixtures/program-analysis/typedef_analysis/Example.hs b/test-artefacts/fixtures/program-analysis/typedef_analysis/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_analysis/Example.hs
@@ -0,0 +1,2722 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE EmptyDataDecls #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Struct1_t(..)
+    , Example.Struct2_t(..)
+    , Example.Struct3_t
+    , Example.Struct4_t
+    , Example.Struct5(..)
+    , Example.Struct5_t(..)
+    , Example.Struct6a_struct(..)
+    , Example.Struct6a(..)
+    , Example.Struct6b_struct(..)
+    , Example.Struct6b(..)
+    , Example.Struct7(..)
+    , Example.Struct7a(..)
+    , Example.Struct7b(..)
+    , Example.Struct8(..)
+    , Example.Struct8b(..)
+    , Example.Struct9(..)
+    , Example.Struct9_t(..)
+    , Example.Struct10_t(..)
+    , Example.Struct10_t_t(..)
+    , Example.Struct11_t(..)
+    , Example.Struct12_t(..)
+    , Example.Use_sites(..)
+    , Example.Foo_struct(..)
+    , Example.Foo_Aux(..)
+    , Example.Foo(..)
+    , Example.Bar_struct(..)
+    , Example.Bar_Aux(..)
+    , Example.Bar(..)
+    , Example.Struct15(..)
+    , Example.Struct16_struct(..)
+    , Example.Struct16(..)
+    , Example.Use_sites_qual(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, IO, Int, Ord, Show, pure, type (~))
+
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 41:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct1_t = Struct1_t
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct1_t where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct1_t where
+
+  readRaw = \ptr0 -> pure Struct1_t
+
+instance Marshal.WriteRaw Struct1_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct1_t -> pure ()
+
+deriving via Marshal.EquivStorable Struct1_t instance BG.Storable Struct1_t
+
+deriving via Struct.IsStructViaReadRaw Struct1_t instance Struct.IsStruct Struct1_t
+
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 45:16@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct2_t = Struct2_t
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct2_t where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct2_t where
+
+  readRaw = \ptr0 -> pure Struct2_t
+
+instance Marshal.WriteRaw Struct2_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct2_t -> pure ()
+
+deriving via Marshal.EquivStorable Struct2_t instance BG.Storable Struct2_t
+
+deriving via Struct.IsStructViaReadRaw Struct2_t instance Struct.IsStruct Struct2_t
+
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 49:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct3_t
+
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 53:16@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct4_t
+
+{-| __C declaration:__ @struct struct5@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 56:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct5 = Struct5
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct5 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct5 where
+
+  readRaw = \ptr0 -> pure Struct5
+
+instance Marshal.WriteRaw Struct5 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct5 -> pure ()
+
+deriving via Marshal.EquivStorable Struct5 instance BG.Storable Struct5
+
+deriving via Struct.IsStructViaReadRaw Struct5 instance Struct.IsStruct Struct5
+
+{-| __C declaration:__ @struct5_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 57:25@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct5_t = Struct5_t
+  { unwrapStruct5_t :: BG.Ptr Struct5
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr Struct5
+         ) => BG.CompatHasField.HasField "unwrapStruct5_t" Struct5_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct5_t {unwrapStruct5_t = y1}, BG.getField @"unwrapStruct5_t" x0)
+
+instance ( ty ~ BG.Ptr Struct5
+         ) => BG.HasField "unwrapStruct5_t" (BG.Ptr Struct5_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct5_t")
+
+instance HasCField.HasCField Struct5_t "unwrapStruct5_t" where
+
+  type CFieldType Struct5_t "unwrapStruct5_t" =
+    BG.Ptr Struct5
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct6a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 60:16@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct6a_struct = Struct6a_struct
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct6a_struct where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct6a_struct where
+
+  readRaw = \ptr0 -> pure Struct6a_struct
+
+instance Marshal.WriteRaw Struct6a_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct6a_struct -> pure ()
+
+deriving via Marshal.EquivStorable Struct6a_struct instance BG.Storable Struct6a_struct
+
+deriving via Struct.IsStructViaReadRaw Struct6a_struct instance Struct.IsStruct Struct6a_struct
+
+{-| __C declaration:__ @struct6a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 61:4@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct6a = Struct6a
+  { unwrapStruct6a :: BG.Ptr Struct6a_struct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr Struct6a_struct
+         ) => BG.CompatHasField.HasField "unwrapStruct6a" Struct6a ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct6a {unwrapStruct6a = y1}, BG.getField @"unwrapStruct6a" x0)
+
+instance ( ty ~ BG.Ptr Struct6a_struct
+         ) => BG.HasField "unwrapStruct6a" (BG.Ptr Struct6a) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct6a")
+
+instance HasCField.HasCField Struct6a "unwrapStruct6a" where
+
+  type CFieldType Struct6a "unwrapStruct6a" =
+    BG.Ptr Struct6a_struct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct6b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 68:16@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct6b_struct = Struct6b_struct
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct6b_struct where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct6b_struct where
+
+  readRaw = \ptr0 -> pure Struct6b_struct
+
+instance Marshal.WriteRaw Struct6b_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct6b_struct -> pure ()
+
+deriving via Marshal.EquivStorable Struct6b_struct instance BG.Storable Struct6b_struct
+
+deriving via Struct.IsStructViaReadRaw Struct6b_struct instance Struct.IsStruct Struct6b_struct
+
+{-| __C declaration:__ @struct6b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 69:3@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct6b = Struct6b
+  { unwrapStruct6b :: CA.ConstantArray 50 Struct6b_struct
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 50 Struct6b_struct
+         ) => BG.CompatHasField.HasField "unwrapStruct6b" Struct6b ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct6b {unwrapStruct6b = y1}, BG.getField @"unwrapStruct6b" x0)
+
+instance ( ty ~ CA.ConstantArray 50 Struct6b_struct
+         ) => BG.HasField "unwrapStruct6b" (BG.Ptr Struct6b) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct6b")
+
+instance HasCField.HasCField Struct6b "unwrapStruct6b" where
+
+  type CFieldType Struct6b "unwrapStruct6b" =
+    CA.ConstantArray 50 Struct6b_struct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct7@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 72:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct7 = Struct7
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct7 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct7 where
+
+  readRaw = \ptr0 -> pure Struct7
+
+instance Marshal.WriteRaw Struct7 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct7 -> pure ()
+
+deriving via Marshal.EquivStorable Struct7 instance BG.Storable Struct7
+
+deriving via Struct.IsStructViaReadRaw Struct7 instance Struct.IsStruct Struct7
+
+{-| __C declaration:__ @struct7a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 73:24@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct7a = Struct7a
+  { unwrapStruct7a :: Struct7
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Struct7
+         ) => BG.CompatHasField.HasField "unwrapStruct7a" Struct7a ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct7a {unwrapStruct7a = y1}, BG.getField @"unwrapStruct7a" x0)
+
+instance ( ty ~ Struct7
+         ) => BG.HasField "unwrapStruct7a" (BG.Ptr Struct7a) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct7a")
+
+instance HasCField.HasCField Struct7a "unwrapStruct7a" where
+
+  type CFieldType Struct7a "unwrapStruct7a" = Struct7
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct7b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 74:24@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct7b = Struct7b
+  { unwrapStruct7b :: Struct7
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Struct7
+         ) => BG.CompatHasField.HasField "unwrapStruct7b" Struct7b ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct7b {unwrapStruct7b = y1}, BG.getField @"unwrapStruct7b" x0)
+
+instance ( ty ~ Struct7
+         ) => BG.HasField "unwrapStruct7b" (BG.Ptr Struct7b) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct7b")
+
+instance HasCField.HasCField Struct7b "unwrapStruct7b" where
+
+  type CFieldType Struct7b "unwrapStruct7b" = Struct7
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct8@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 77:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct8 = Struct8
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct8 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct8 where
+
+  readRaw = \ptr0 -> pure Struct8
+
+instance Marshal.WriteRaw Struct8 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct8 -> pure ()
+
+deriving via Marshal.EquivStorable Struct8 instance BG.Storable Struct8
+
+deriving via Struct.IsStructViaReadRaw Struct8 instance Struct.IsStruct Struct8
+
+{-| __C declaration:__ @struct8b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 79:24@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct8b = Struct8b
+  { unwrapStruct8b :: Struct8
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Struct8
+         ) => BG.CompatHasField.HasField "unwrapStruct8b" Struct8b ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct8b {unwrapStruct8b = y1}, BG.getField @"unwrapStruct8b" x0)
+
+instance ( ty ~ Struct8
+         ) => BG.HasField "unwrapStruct8b" (BG.Ptr Struct8b) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct8b")
+
+instance HasCField.HasCField Struct8b "unwrapStruct8b" where
+
+  type CFieldType Struct8b "unwrapStruct8b" = Struct8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct9@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 82:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct9 = Struct9
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct9 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct9 where
+
+  readRaw = \ptr0 -> pure Struct9
+
+instance Marshal.WriteRaw Struct9 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct9 -> pure ()
+
+deriving via Marshal.EquivStorable Struct9 instance BG.Storable Struct9
+
+deriving via Struct.IsStructViaReadRaw Struct9 instance Struct.IsStruct Struct9
+
+{-| __C declaration:__ @struct9_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 84:17@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct9_t = Struct9_t
+  { unwrapStruct9_t :: Struct9
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Struct9
+         ) => BG.CompatHasField.HasField "unwrapStruct9_t" Struct9_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct9_t {unwrapStruct9_t = y1}, BG.getField @"unwrapStruct9_t" x0)
+
+instance ( ty ~ Struct9
+         ) => BG.HasField "unwrapStruct9_t" (BG.Ptr Struct9_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct9_t")
+
+instance HasCField.HasCField Struct9_t "unwrapStruct9_t" where
+
+  type CFieldType Struct9_t "unwrapStruct9_t" = Struct9
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct10@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 90:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct10_t = Struct10_t
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct10_t where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct10_t where
+
+  readRaw = \ptr0 -> pure Struct10_t
+
+instance Marshal.WriteRaw Struct10_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct10_t -> pure ()
+
+deriving via Marshal.EquivStorable Struct10_t instance BG.Storable Struct10_t
+
+deriving via Struct.IsStructViaReadRaw Struct10_t instance Struct.IsStruct Struct10_t
+
+{-| __C declaration:__ @struct10_t_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 92:20@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct10_t_t = Struct10_t_t
+  { unwrapStruct10_t_t :: Struct10_t
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ Struct10_t
+         ) => BG.CompatHasField.HasField "unwrapStruct10_t_t" Struct10_t_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Struct10_t_t {unwrapStruct10_t_t = y1}
+      , BG.getField @"unwrapStruct10_t_t" x0
+      )
+
+instance ( ty ~ Struct10_t
+         ) => BG.HasField "unwrapStruct10_t_t" (BG.Ptr Struct10_t_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct10_t_t")
+
+instance HasCField.HasCField Struct10_t_t "unwrapStruct10_t_t" where
+
+  type CFieldType Struct10_t_t "unwrapStruct10_t_t" =
+    Struct10_t
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct11@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 95:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct11_t = Struct11_t
+  { struct11_t_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 96:7@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , struct11_t_self :: BG.Ptr Struct11_t
+    {- ^ __C declaration:__ @self@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 97:20@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct11_t where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Struct11_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct11_t
+      <*> HasCField.readRaw (BG.Proxy @"struct11_t_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"struct11_t_self") ptr0
+
+instance Marshal.WriteRaw Struct11_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct11_t struct11_t_x2 struct11_t_self3 ->
+               HasCField.writeRaw (BG.Proxy @"struct11_t_x") ptr0 struct11_t_x2
+            >> HasCField.writeRaw (BG.Proxy @"struct11_t_self") ptr0 struct11_t_self3
+
+deriving via Marshal.EquivStorable Struct11_t instance BG.Storable Struct11_t
+
+deriving via Struct.IsStructViaReadRaw Struct11_t instance Struct.IsStruct Struct11_t
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 96:7@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct11_t_x" Struct11_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Struct11_t {struct11_t_x = y1, struct11_t_self = BG.getField @"struct11_t_self" x0}
+      , BG.getField @"struct11_t_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct11_t_x" (BG.Ptr Struct11_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"struct11_t_x")
+
+instance HasCField.HasCField Struct11_t "struct11_t_x" where
+
+  type CFieldType Struct11_t "struct11_t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @self@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 97:20@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.Ptr Struct11_t
+         ) => BG.CompatHasField.HasField "struct11_t_self" Struct11_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Struct11_t {struct11_t_self = y1, struct11_t_x = BG.getField @"struct11_t_x" x0}
+      , BG.getField @"struct11_t_self" x0
+      )
+
+instance ( ty ~ BG.Ptr Struct11_t
+         ) => BG.HasField "struct11_t_self" (BG.Ptr Struct11_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"struct11_t_self")
+
+instance HasCField.HasCField Struct11_t "struct11_t_self" where
+
+  type CFieldType Struct11_t "struct11_t_self" =
+    BG.Ptr Struct11_t
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct struct12@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 104:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct12_t = Struct12_t
+  { struct12_t_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 105:7@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , struct12_t_self :: BG.Ptr Struct12_t
+    {- ^ __C declaration:__ @self@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 106:15@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct12_t where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Struct12_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct12_t
+      <*> HasCField.readRaw (BG.Proxy @"struct12_t_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"struct12_t_self") ptr0
+
+instance Marshal.WriteRaw Struct12_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct12_t struct12_t_x2 struct12_t_self3 ->
+               HasCField.writeRaw (BG.Proxy @"struct12_t_x") ptr0 struct12_t_x2
+            >> HasCField.writeRaw (BG.Proxy @"struct12_t_self") ptr0 struct12_t_self3
+
+deriving via Marshal.EquivStorable Struct12_t instance BG.Storable Struct12_t
+
+deriving via Struct.IsStructViaReadRaw Struct12_t instance Struct.IsStruct Struct12_t
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 105:7@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct12_t_x" Struct12_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Struct12_t {struct12_t_x = y1, struct12_t_self = BG.getField @"struct12_t_self" x0}
+      , BG.getField @"struct12_t_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct12_t_x" (BG.Ptr Struct12_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"struct12_t_x")
+
+instance HasCField.HasCField Struct12_t "struct12_t_x" where
+
+  type CFieldType Struct12_t "struct12_t_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @self@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 106:15@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.Ptr Struct12_t
+         ) => BG.CompatHasField.HasField "struct12_t_self" Struct12_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Struct12_t {struct12_t_self = y1, struct12_t_x = BG.getField @"struct12_t_x" x0}
+      , BG.getField @"struct12_t_self" x0
+      )
+
+instance ( ty ~ BG.Ptr Struct12_t
+         ) => BG.HasField "struct12_t_self" (BG.Ptr Struct12_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"struct12_t_self")
+
+instance HasCField.HasCField Struct12_t "struct12_t_self" where
+
+  type CFieldType Struct12_t "struct12_t_self" =
+    BG.Ptr Struct12_t
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct use_sites@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 110:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Use_sites = Use_sites
+  { use_sites_useTypedef_struct1_t :: Struct1_t
+    {- ^ __C declaration:__ @useTypedef_struct1_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 112:13@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct2_t :: Struct2_t
+    {- ^ __C declaration:__ @useTypedef_struct2_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 115:13@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct3_t :: BG.Ptr Struct3_t
+    {- ^ __C declaration:__ @useTypedef_struct3_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 118:14@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct4_t :: BG.Ptr Struct4_t
+    {- ^ __C declaration:__ @useTypedef_struct4_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 119:14@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useStruct_struct5 :: Struct5
+    {- ^ __C declaration:__ @useStruct_struct5@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 122:18@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct5_t :: Struct5_t
+    {- ^ __C declaration:__ @useTypedef_struct5_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 123:13@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useStruct_struct6a :: Struct6a_struct
+    {- ^ __C declaration:__ @useStruct_struct6a@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 126:19@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct6a :: Struct6a
+    {- ^ __C declaration:__ @useTypedef_struct6a@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 127:12@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useStruct_struct6b :: Struct6b_struct
+    {- ^ __C declaration:__ @useStruct_struct6b@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 130:19@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct6b :: Struct6b
+    {- ^ __C declaration:__ @useTypedef_struct6b@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 131:12@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct7a :: Struct7a
+    {- ^ __C declaration:__ @useTypedef_struct7a@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 134:12@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct7b :: Struct7b
+    {- ^ __C declaration:__ @useTypedef_struct7b@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 135:12@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct8 :: Struct8
+    {- ^ __C declaration:__ @useTypedef_struct8@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 139:11@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct8b :: Struct8b
+    {- ^ __C declaration:__ @useTypedef_struct8b@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 140:12@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct9 :: Struct9
+    {- ^ __C declaration:__ @useTypedef_struct9@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 144:11@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct9_t :: Struct9_t
+    {- ^ __C declaration:__ @useTypedef_struct9_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 145:13@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct10_t :: Struct10_t
+    {- ^ __C declaration:__ @useTypedef_struct10_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 146:14@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct10_t_t :: Struct10_t_t
+    {- ^ __C declaration:__ @useTypedef_struct10_t_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 147:16@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct11_t :: Struct11_t
+    {- ^ __C declaration:__ @useTypedef_struct11_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 150:14@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_useTypedef_struct12_t :: Struct12_t
+    {- ^ __C declaration:__ @useTypedef_struct12_t@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 151:14@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Use_sites where
+
+  staticSizeOf = \_ -> (64 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Use_sites where
+
+  readRaw =
+    \ptr0 ->
+          pure Use_sites
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct1_t") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct2_t") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct3_t") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct4_t") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useStruct_struct5") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct5_t") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useStruct_struct6a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct6a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useStruct_struct6b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct6b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct7a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct7b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct8") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct8b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct9") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct9_t") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct10_t") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct10_t_t") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct11_t") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_useTypedef_struct12_t") ptr0
+
+instance Marshal.WriteRaw Use_sites where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Use_sites
+            use_sites_useTypedef_struct1_t2
+            use_sites_useTypedef_struct2_t3
+            use_sites_useTypedef_struct3_t4
+            use_sites_useTypedef_struct4_t5
+            use_sites_useStruct_struct56
+            use_sites_useTypedef_struct5_t7
+            use_sites_useStruct_struct6a8
+            use_sites_useTypedef_struct6a9
+            use_sites_useStruct_struct6b10
+            use_sites_useTypedef_struct6b11
+            use_sites_useTypedef_struct7a12
+            use_sites_useTypedef_struct7b13
+            use_sites_useTypedef_struct814
+            use_sites_useTypedef_struct8b15
+            use_sites_useTypedef_struct916
+            use_sites_useTypedef_struct9_t17
+            use_sites_useTypedef_struct10_t18
+            use_sites_useTypedef_struct10_t_t19
+            use_sites_useTypedef_struct11_t20
+            use_sites_useTypedef_struct12_t21 ->
+                 HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct1_t") ptr0 use_sites_useTypedef_struct1_t2
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct2_t") ptr0 use_sites_useTypedef_struct2_t3
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct3_t") ptr0 use_sites_useTypedef_struct3_t4
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct4_t") ptr0 use_sites_useTypedef_struct4_t5
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useStruct_struct5") ptr0 use_sites_useStruct_struct56
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct5_t") ptr0 use_sites_useTypedef_struct5_t7
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useStruct_struct6a") ptr0 use_sites_useStruct_struct6a8
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct6a") ptr0 use_sites_useTypedef_struct6a9
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useStruct_struct6b") ptr0 use_sites_useStruct_struct6b10
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct6b") ptr0 use_sites_useTypedef_struct6b11
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct7a") ptr0 use_sites_useTypedef_struct7a12
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct7b") ptr0 use_sites_useTypedef_struct7b13
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct8") ptr0 use_sites_useTypedef_struct814
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct8b") ptr0 use_sites_useTypedef_struct8b15
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct9") ptr0 use_sites_useTypedef_struct916
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct9_t") ptr0 use_sites_useTypedef_struct9_t17
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct10_t") ptr0 use_sites_useTypedef_struct10_t18
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct10_t_t") ptr0 use_sites_useTypedef_struct10_t_t19
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct11_t") ptr0 use_sites_useTypedef_struct11_t20
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_useTypedef_struct12_t") ptr0 use_sites_useTypedef_struct12_t21
+
+deriving via Marshal.EquivStorable Use_sites instance BG.Storable Use_sites
+
+deriving via Struct.IsStructViaReadRaw Use_sites instance Struct.IsStruct Use_sites
+
+{-| __C declaration:__ @useTypedef_struct1_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 112:13@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct1_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct1_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct1_t = y1
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct1_t" x0
+      )
+
+instance ( ty ~ Struct1_t
+         ) => BG.HasField "use_sites_useTypedef_struct1_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct1_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct1_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct1_t" =
+    Struct1_t
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @useTypedef_struct2_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 115:13@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct2_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct2_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct2_t = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct2_t" x0
+      )
+
+instance ( ty ~ Struct2_t
+         ) => BG.HasField "use_sites_useTypedef_struct2_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct2_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct2_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct2_t" =
+    Struct2_t
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @useTypedef_struct3_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 118:14@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.Ptr Struct3_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct3_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct3_t = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct3_t" x0
+      )
+
+instance ( ty ~ BG.Ptr Struct3_t
+         ) => BG.HasField "use_sites_useTypedef_struct3_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct3_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct3_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct3_t" =
+    BG.Ptr Struct3_t
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @useTypedef_struct4_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 119:14@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.Ptr Struct4_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct4_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct4_t = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct4_t" x0
+      )
+
+instance ( ty ~ BG.Ptr Struct4_t
+         ) => BG.HasField "use_sites_useTypedef_struct4_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct4_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct4_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct4_t" =
+    BG.Ptr Struct4_t
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @useStruct_struct5@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 122:18@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct5
+         ) => BG.CompatHasField.HasField "use_sites_useStruct_struct5" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useStruct_struct5 = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useStruct_struct5" x0
+      )
+
+instance ( ty ~ Struct5
+         ) => BG.HasField "use_sites_useStruct_struct5" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useStruct_struct5")
+
+instance HasCField.HasCField Use_sites "use_sites_useStruct_struct5" where
+
+  type CFieldType Use_sites "use_sites_useStruct_struct5" =
+    Struct5
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @useTypedef_struct5_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 123:13@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct5_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct5_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct5_t = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct5_t" x0
+      )
+
+instance ( ty ~ Struct5_t
+         ) => BG.HasField "use_sites_useTypedef_struct5_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct5_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct5_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct5_t" =
+    Struct5_t
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @useStruct_struct6a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 126:19@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct6a_struct
+         ) => BG.CompatHasField.HasField "use_sites_useStruct_struct6a" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useStruct_struct6a = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useStruct_struct6a" x0
+      )
+
+instance ( ty ~ Struct6a_struct
+         ) => BG.HasField "use_sites_useStruct_struct6a" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useStruct_struct6a")
+
+instance HasCField.HasCField Use_sites "use_sites_useStruct_struct6a" where
+
+  type CFieldType Use_sites "use_sites_useStruct_struct6a" =
+    Struct6a_struct
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @useTypedef_struct6a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 127:12@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct6a
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct6a" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct6a = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct6a" x0
+      )
+
+instance ( ty ~ Struct6a
+         ) => BG.HasField "use_sites_useTypedef_struct6a" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct6a")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct6a" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct6a" =
+    Struct6a
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @useStruct_struct6b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 130:19@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct6b_struct
+         ) => BG.CompatHasField.HasField "use_sites_useStruct_struct6b" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useStruct_struct6b = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useStruct_struct6b" x0
+      )
+
+instance ( ty ~ Struct6b_struct
+         ) => BG.HasField "use_sites_useStruct_struct6b" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useStruct_struct6b")
+
+instance HasCField.HasCField Use_sites "use_sites_useStruct_struct6b" where
+
+  type CFieldType Use_sites "use_sites_useStruct_struct6b" =
+    Struct6b_struct
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct6b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 131:12@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct6b
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct6b" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct6b = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct6b" x0
+      )
+
+instance ( ty ~ Struct6b
+         ) => BG.HasField "use_sites_useTypedef_struct6b" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct6b")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct6b" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct6b" =
+    Struct6b
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct7a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 134:12@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct7a
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct7a" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct7a = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct7a" x0
+      )
+
+instance ( ty ~ Struct7a
+         ) => BG.HasField "use_sites_useTypedef_struct7a" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct7a")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct7a" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct7a" =
+    Struct7a
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct7b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 135:12@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct7b
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct7b" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct7b = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct7b" x0
+      )
+
+instance ( ty ~ Struct7b
+         ) => BG.HasField "use_sites_useTypedef_struct7b" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct7b")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct7b" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct7b" =
+    Struct7b
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct8@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 139:11@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct8
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct8" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct8 = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct8" x0
+      )
+
+instance ( ty ~ Struct8
+         ) => BG.HasField "use_sites_useTypedef_struct8" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct8")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct8" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct8" =
+    Struct8
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct8b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 140:12@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct8b
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct8b" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct8b = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct8b" x0
+      )
+
+instance ( ty ~ Struct8b
+         ) => BG.HasField "use_sites_useTypedef_struct8b" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct8b")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct8b" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct8b" =
+    Struct8b
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct9@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 144:11@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct9
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct9" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct9 = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct9" x0
+      )
+
+instance ( ty ~ Struct9
+         ) => BG.HasField "use_sites_useTypedef_struct9" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct9")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct9" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct9" =
+    Struct9
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct9_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 145:13@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct9_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct9_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct9_t = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct9_t" x0
+      )
+
+instance ( ty ~ Struct9_t
+         ) => BG.HasField "use_sites_useTypedef_struct9_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct9_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct9_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct9_t" =
+    Struct9_t
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct10_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 146:14@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct10_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct10_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct10_t = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct10_t" x0
+      )
+
+instance ( ty ~ Struct10_t
+         ) => BG.HasField "use_sites_useTypedef_struct10_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct10_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct10_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct10_t" =
+    Struct10_t
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct10_t_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 147:16@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct10_t_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct10_t_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct10_t_t = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+      )
+
+instance ( ty ~ Struct10_t_t
+         ) => BG.HasField "use_sites_useTypedef_struct10_t_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct10_t_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct10_t_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct10_t_t" =
+    Struct10_t_t
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct11_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 150:14@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct11_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct11_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct11_t = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct12_t = BG.getField @"use_sites_useTypedef_struct12_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct11_t" x0
+      )
+
+instance ( ty ~ Struct11_t
+         ) => BG.HasField "use_sites_useTypedef_struct11_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct11_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct11_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct11_t" =
+    Struct11_t
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @useTypedef_struct12_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 151:14@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct12_t
+         ) => BG.CompatHasField.HasField "use_sites_useTypedef_struct12_t" Use_sites ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites { use_sites_useTypedef_struct12_t = y1
+                    , use_sites_useTypedef_struct1_t = BG.getField @"use_sites_useTypedef_struct1_t" x0
+                    , use_sites_useTypedef_struct2_t = BG.getField @"use_sites_useTypedef_struct2_t" x0
+                    , use_sites_useTypedef_struct3_t = BG.getField @"use_sites_useTypedef_struct3_t" x0
+                    , use_sites_useTypedef_struct4_t = BG.getField @"use_sites_useTypedef_struct4_t" x0
+                    , use_sites_useStruct_struct5 = BG.getField @"use_sites_useStruct_struct5" x0
+                    , use_sites_useTypedef_struct5_t = BG.getField @"use_sites_useTypedef_struct5_t" x0
+                    , use_sites_useStruct_struct6a = BG.getField @"use_sites_useStruct_struct6a" x0
+                    , use_sites_useTypedef_struct6a = BG.getField @"use_sites_useTypedef_struct6a" x0
+                    , use_sites_useStruct_struct6b = BG.getField @"use_sites_useStruct_struct6b" x0
+                    , use_sites_useTypedef_struct6b = BG.getField @"use_sites_useTypedef_struct6b" x0
+                    , use_sites_useTypedef_struct7a = BG.getField @"use_sites_useTypedef_struct7a" x0
+                    , use_sites_useTypedef_struct7b = BG.getField @"use_sites_useTypedef_struct7b" x0
+                    , use_sites_useTypedef_struct8 = BG.getField @"use_sites_useTypedef_struct8" x0
+                    , use_sites_useTypedef_struct8b = BG.getField @"use_sites_useTypedef_struct8b" x0
+                    , use_sites_useTypedef_struct9 = BG.getField @"use_sites_useTypedef_struct9" x0
+                    , use_sites_useTypedef_struct9_t = BG.getField @"use_sites_useTypedef_struct9_t" x0
+                    , use_sites_useTypedef_struct10_t = BG.getField @"use_sites_useTypedef_struct10_t" x0
+                    , use_sites_useTypedef_struct10_t_t = BG.getField @"use_sites_useTypedef_struct10_t_t" x0
+                    , use_sites_useTypedef_struct11_t = BG.getField @"use_sites_useTypedef_struct11_t" x0
+                    }
+      , BG.getField @"use_sites_useTypedef_struct12_t" x0
+      )
+
+instance ( ty ~ Struct12_t
+         ) => BG.HasField "use_sites_useTypedef_struct12_t" (BG.Ptr Use_sites) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_useTypedef_struct12_t")
+
+instance HasCField.HasCField Use_sites "use_sites_useTypedef_struct12_t" where
+
+  type CFieldType Use_sites "use_sites_useTypedef_struct12_t" =
+    Struct12_t
+
+  offset# = \_ -> \_ -> 48
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 163:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Foo_struct = Foo_struct
+  { foo_struct_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 164:7@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , foo_struct_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 165:7@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Foo_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo_struct
+      <*> HasCField.readRaw (BG.Proxy @"foo_struct_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"foo_struct_y") ptr0
+
+instance Marshal.WriteRaw Foo_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo_struct foo_struct_x2 foo_struct_y3 ->
+               HasCField.writeRaw (BG.Proxy @"foo_struct_x") ptr0 foo_struct_x2
+            >> HasCField.writeRaw (BG.Proxy @"foo_struct_y") ptr0 foo_struct_y3
+
+deriving via Marshal.EquivStorable Foo_struct instance BG.Storable Foo_struct
+
+deriving via Struct.IsStructViaReadRaw Foo_struct instance Struct.IsStruct Foo_struct
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 164:7@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_struct_x" Foo_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_struct {foo_struct_x = y1, foo_struct_y = BG.getField @"foo_struct_y" x0}
+      , BG.getField @"foo_struct_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_struct_x" (BG.Ptr Foo_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"foo_struct_x")
+
+instance HasCField.HasCField Foo_struct "foo_struct_x" where
+
+  type CFieldType Foo_struct "foo_struct_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 165:7@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_struct_y" Foo_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_struct {foo_struct_y = y1, foo_struct_x = BG.getField @"foo_struct_x" x0}
+      , BG.getField @"foo_struct_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_struct_y" (BG.Ptr Foo_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"foo_struct_y")
+
+instance HasCField.HasCField Foo_struct "foo_struct_y" where
+
+  type CFieldType Foo_struct "foo_struct_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| Auxiliary type used by 'Foo'
+
+    __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 167:22@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Foo_Aux = Foo_Aux
+  { unwrapFoo_Aux :: IO Foo_struct
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ IO Foo_struct
+         ) => BG.CompatHasField.HasField "unwrapFoo_Aux" Foo_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo_Aux {unwrapFoo_Aux = y1}, BG.getField @"unwrapFoo_Aux" x0)
+
+instance ( ty ~ IO Foo_struct
+         ) => BG.HasField "unwrapFoo_Aux" (BG.Ptr Foo_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFoo_Aux")
+
+instance HasCField.HasCField Foo_Aux "unwrapFoo_Aux" where
+
+  type CFieldType Foo_Aux "unwrapFoo_Aux" =
+    IO Foo_struct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 167:22@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Foo = Foo
+  { unwrapFoo :: BG.FunPtr Foo_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Foo_Aux
+         ) => BG.CompatHasField.HasField "unwrapFoo" Foo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo {unwrapFoo = y1}, BG.getField @"unwrapFoo" x0)
+
+instance ( ty ~ BG.FunPtr Foo_Aux
+         ) => BG.HasField "unwrapFoo" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapFoo")
+
+instance HasCField.HasCField Foo "unwrapFoo" where
+
+  type CFieldType Foo "unwrapFoo" = BG.FunPtr Foo_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 171:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Bar_struct = Bar_struct
+  { bar_struct_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 172:7@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , bar_struct_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 173:7@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bar_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_struct
+      <*> HasCField.readRaw (BG.Proxy @"bar_struct_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bar_struct_b") ptr0
+
+instance Marshal.WriteRaw Bar_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_struct bar_struct_a2 bar_struct_b3 ->
+               HasCField.writeRaw (BG.Proxy @"bar_struct_a") ptr0 bar_struct_a2
+            >> HasCField.writeRaw (BG.Proxy @"bar_struct_b") ptr0 bar_struct_b3
+
+deriving via Marshal.EquivStorable Bar_struct instance BG.Storable Bar_struct
+
+deriving via Struct.IsStructViaReadRaw Bar_struct instance Struct.IsStruct Bar_struct
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 172:7@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_struct_a" Bar_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_struct {bar_struct_a = y1, bar_struct_b = BG.getField @"bar_struct_b" x0}
+      , BG.getField @"bar_struct_a" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_struct_a" (BG.Ptr Bar_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"bar_struct_a")
+
+instance HasCField.HasCField Bar_struct "bar_struct_a" where
+
+  type CFieldType Bar_struct "bar_struct_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 173:7@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_struct_b" Bar_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_struct {bar_struct_b = y1, bar_struct_a = BG.getField @"bar_struct_a" x0}
+      , BG.getField @"bar_struct_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_struct_b" (BG.Ptr Bar_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"bar_struct_b")
+
+instance HasCField.HasCField Bar_struct "bar_struct_b" where
+
+  type CFieldType Bar_struct "bar_struct_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| Auxiliary type used by 'Bar'
+
+    __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 175:22@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Bar_Aux = Bar_Aux
+  { unwrapBar_Aux :: Bar_struct -> IO Foo_struct
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ (Bar_struct -> IO Foo_struct)
+         ) => BG.CompatHasField.HasField "unwrapBar_Aux" Bar_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bar_Aux {unwrapBar_Aux = y1}, BG.getField @"unwrapBar_Aux" x0)
+
+instance ( ty ~ (Bar_struct -> IO Foo_struct)
+         ) => BG.HasField "unwrapBar_Aux" (BG.Ptr Bar_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBar_Aux")
+
+instance HasCField.HasCField Bar_Aux "unwrapBar_Aux" where
+
+  type CFieldType Bar_Aux "unwrapBar_Aux" =
+    Bar_struct -> IO Foo_struct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 175:22@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Bar = Bar
+  { unwrapBar :: BG.FunPtr Bar_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr Bar_Aux
+         ) => BG.CompatHasField.HasField "unwrapBar" Bar ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bar {unwrapBar = y1}, BG.getField @"unwrapBar" x0)
+
+instance ( ty ~ BG.FunPtr Bar_Aux
+         ) => BG.HasField "unwrapBar" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapBar")
+
+instance HasCField.HasCField Bar "unwrapBar" where
+
+  type CFieldType Bar "unwrapBar" = BG.FunPtr Bar_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct struct15@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 182:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct15 = Struct15
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct15 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct15 where
+
+  readRaw = \ptr0 -> pure Struct15
+
+instance Marshal.WriteRaw Struct15 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct15 -> pure ()
+
+deriving via Marshal.EquivStorable Struct15 instance BG.Storable Struct15
+
+deriving via Struct.IsStructViaReadRaw Struct15 instance Struct.IsStruct Struct15
+
+{-| __C declaration:__ @struct struct16@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 191:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct16_struct = Struct16_struct
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct16_struct where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct16_struct where
+
+  readRaw = \ptr0 -> pure Struct16_struct
+
+instance Marshal.WriteRaw Struct16_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct16_struct -> pure ()
+
+deriving via Marshal.EquivStorable Struct16_struct instance BG.Storable Struct16_struct
+
+deriving via Struct.IsStructViaReadRaw Struct16_struct instance Struct.IsStruct Struct16_struct
+
+{-| __C declaration:__ @struct16@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 192:32@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct16 = Struct16
+  { unwrapStruct16 :: BG.Ptr Struct16_struct
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr Struct16_struct
+         ) => BG.CompatHasField.HasField "unwrapStruct16" Struct16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct16 {unwrapStruct16 = y1}, BG.getField @"unwrapStruct16" x0)
+
+instance ( ty ~ BG.Ptr Struct16_struct
+         ) => BG.HasField "unwrapStruct16" (BG.Ptr Struct16) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapStruct16")
+
+instance HasCField.HasCField Struct16 "unwrapStruct16" where
+
+  type CFieldType Struct16 "unwrapStruct16" =
+    BG.Ptr Struct16_struct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct use_sites_qual@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 195:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Use_sites_qual = Use_sites_qual
+  { use_sites_qual_useTypedef_struct15 :: Struct15
+    {- ^ __C declaration:__ @useTypedef_struct15@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 197:12@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_qual_useStruct_struct16 :: Struct16_struct
+    {- ^ __C declaration:__ @useStruct_struct16@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 200:19@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  , use_sites_qual_useTypedef_struct16 :: Struct16
+    {- ^ __C declaration:__ @useTypedef_struct16@
+
+         __defined at:__ @program-analysis\/typedef_analysis.h 201:12@
+
+         __exported by:__ @program-analysis\/typedef_analysis.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Use_sites_qual where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Use_sites_qual where
+
+  readRaw =
+    \ptr0 ->
+          pure Use_sites_qual
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_qual_useTypedef_struct15") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_qual_useStruct_struct16") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"use_sites_qual_useTypedef_struct16") ptr0
+
+instance Marshal.WriteRaw Use_sites_qual where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Use_sites_qual
+            use_sites_qual_useTypedef_struct152
+            use_sites_qual_useStruct_struct163
+            use_sites_qual_useTypedef_struct164 ->
+                 HasCField.writeRaw (BG.Proxy @"use_sites_qual_useTypedef_struct15") ptr0 use_sites_qual_useTypedef_struct152
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_qual_useStruct_struct16") ptr0 use_sites_qual_useStruct_struct163
+              >> HasCField.writeRaw (BG.Proxy @"use_sites_qual_useTypedef_struct16") ptr0 use_sites_qual_useTypedef_struct164
+
+deriving via Marshal.EquivStorable Use_sites_qual instance BG.Storable Use_sites_qual
+
+deriving via Struct.IsStructViaReadRaw Use_sites_qual instance Struct.IsStruct Use_sites_qual
+
+{-| __C declaration:__ @useTypedef_struct15@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 197:12@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct15
+         ) => BG.CompatHasField.HasField "use_sites_qual_useTypedef_struct15" Use_sites_qual ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites_qual { use_sites_qual_useTypedef_struct15 = y1
+                         , use_sites_qual_useStruct_struct16 = BG.getField @"use_sites_qual_useStruct_struct16" x0
+                         , use_sites_qual_useTypedef_struct16 = BG.getField @"use_sites_qual_useTypedef_struct16" x0
+                         }
+      , BG.getField @"use_sites_qual_useTypedef_struct15" x0
+      )
+
+instance ( ty ~ Struct15
+         ) => BG.HasField "use_sites_qual_useTypedef_struct15" (BG.Ptr Use_sites_qual) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_qual_useTypedef_struct15")
+
+instance HasCField.HasCField Use_sites_qual "use_sites_qual_useTypedef_struct15" where
+
+  type CFieldType Use_sites_qual "use_sites_qual_useTypedef_struct15" =
+    Struct15
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @useStruct_struct16@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 200:19@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct16_struct
+         ) => BG.CompatHasField.HasField "use_sites_qual_useStruct_struct16" Use_sites_qual ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites_qual { use_sites_qual_useStruct_struct16 = y1
+                         , use_sites_qual_useTypedef_struct15 = BG.getField @"use_sites_qual_useTypedef_struct15" x0
+                         , use_sites_qual_useTypedef_struct16 = BG.getField @"use_sites_qual_useTypedef_struct16" x0
+                         }
+      , BG.getField @"use_sites_qual_useStruct_struct16" x0
+      )
+
+instance ( ty ~ Struct16_struct
+         ) => BG.HasField "use_sites_qual_useStruct_struct16" (BG.Ptr Use_sites_qual) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_qual_useStruct_struct16")
+
+instance HasCField.HasCField Use_sites_qual "use_sites_qual_useStruct_struct16" where
+
+  type CFieldType Use_sites_qual "use_sites_qual_useStruct_struct16" =
+    Struct16_struct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @useTypedef_struct16@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 201:12@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+instance ( ty ~ Struct16
+         ) => BG.CompatHasField.HasField "use_sites_qual_useTypedef_struct16" Use_sites_qual ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Use_sites_qual { use_sites_qual_useTypedef_struct16 = y1
+                         , use_sites_qual_useTypedef_struct15 = BG.getField @"use_sites_qual_useTypedef_struct15" x0
+                         , use_sites_qual_useStruct_struct16 = BG.getField @"use_sites_qual_useStruct_struct16" x0
+                         }
+      , BG.getField @"use_sites_qual_useTypedef_struct16" x0
+      )
+
+instance ( ty ~ Struct16
+         ) => BG.HasField "use_sites_qual_useTypedef_struct16" (BG.Ptr Use_sites_qual) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"use_sites_qual_useTypedef_struct16")
+
+instance HasCField.HasCField Use_sites_qual "use_sites_qual_useTypedef_struct16" where
+
+  type CFieldType Use_sites_qual "use_sites_qual_useTypedef_struct16" =
+    Struct16
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/typedef_analysis/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/typedef_analysis/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_analysis/bindingspec.yaml
@@ -0,0 +1,647 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct1
+  hsname: Struct1_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct1_t
+  hsname: Struct1_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct2
+  hsname: Struct2_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct2_t
+  hsname: Struct2_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct3
+  hsname: Struct3_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct3_t
+  hsname: Struct3_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct4
+  hsname: Struct4_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct4_t
+  hsname: Struct4_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct5
+  hsname: Struct5
+- headers: program-analysis/typedef_analysis.h
+  cname: struct5_t
+  hsname: Struct5_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct6a
+  hsname: Struct6a_struct
+- headers: program-analysis/typedef_analysis.h
+  cname: struct6a
+  hsname: Struct6a
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct6b
+  hsname: Struct6b_struct
+- headers: program-analysis/typedef_analysis.h
+  cname: struct6b
+  hsname: Struct6b
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct7
+  hsname: Struct7
+- headers: program-analysis/typedef_analysis.h
+  cname: struct7a
+  hsname: Struct7a
+- headers: program-analysis/typedef_analysis.h
+  cname: struct7b
+  hsname: Struct7b
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct8
+  hsname: Struct8
+- headers: program-analysis/typedef_analysis.h
+  cname: struct8
+  hsname: Struct8
+- headers: program-analysis/typedef_analysis.h
+  cname: struct8b
+  hsname: Struct8b
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct9
+  hsname: Struct9
+- headers: program-analysis/typedef_analysis.h
+  cname: struct9
+  hsname: Struct9
+- headers: program-analysis/typedef_analysis.h
+  cname: struct9_t
+  hsname: Struct9_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct10
+  hsname: Struct10_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct10_t
+  hsname: Struct10_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct10_t_t
+  hsname: Struct10_t_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct11
+  hsname: Struct11_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct11_t
+  hsname: Struct11_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct12_t
+  hsname: Struct12_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct12
+  hsname: Struct12_t
+- headers: program-analysis/typedef_analysis.h
+  cname: struct use_sites
+  hsname: Use_sites
+- headers: program-analysis/typedef_analysis.h
+  cname: struct foo
+  hsname: Foo_struct
+- headers: program-analysis/typedef_analysis.h
+  cname: foo
+  hsname: Foo
+- headers: program-analysis/typedef_analysis.h
+  cname: struct bar
+  hsname: Bar_struct
+- headers: program-analysis/typedef_analysis.h
+  cname: bar
+  hsname: Bar
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct15
+  hsname: Struct15
+- headers: program-analysis/typedef_analysis.h
+  cname: struct15
+  hsname: Struct15
+- headers: program-analysis/typedef_analysis.h
+  cname: struct struct16
+  hsname: Struct16_struct
+- headers: program-analysis/typedef_analysis.h
+  cname: struct16
+  hsname: Struct16
+- headers: program-analysis/typedef_analysis.h
+  cname: struct use_sites_qual
+  hsname: Use_sites_qual
+hstypes:
+- hsname: Bar
+  representation:
+    newtype:
+      constructor: Bar
+      fields:
+      - unwrapBar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_struct
+  representation:
+    record:
+      constructor: Bar_struct
+      fields:
+      - bar_struct_a
+      - bar_struct_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    newtype:
+      constructor: Foo
+      fields:
+      - unwrapFoo
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_struct
+  representation:
+    record:
+      constructor: Foo_struct
+      fields:
+      - foo_struct_x
+      - foo_struct_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct10_t
+  representation:
+    record:
+      constructor: Struct10_t
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct10_t_t
+  representation:
+    newtype:
+      constructor: Struct10_t_t
+      fields:
+      - unwrapStruct10_t_t
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct11_t
+  representation:
+    record:
+      constructor: Struct11_t
+      fields:
+      - struct11_t_x
+      - struct11_t_self
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct12_t
+  representation:
+    record:
+      constructor: Struct12_t
+      fields:
+      - struct12_t_x
+      - struct12_t_self
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct15
+  representation:
+    record:
+      constructor: Struct15
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct16
+  representation:
+    newtype:
+      constructor: Struct16
+      fields:
+      - unwrapStruct16
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct16_struct
+  representation:
+    record:
+      constructor: Struct16_struct
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct1_t
+  representation:
+    record:
+      constructor: Struct1_t
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct2_t
+  representation:
+    record:
+      constructor: Struct2_t
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct3_t
+  representation: emptydata
+- hsname: Struct4_t
+  representation: emptydata
+- hsname: Struct5
+  representation:
+    record:
+      constructor: Struct5
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct5_t
+  representation:
+    newtype:
+      constructor: Struct5_t
+      fields:
+      - unwrapStruct5_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct6a
+  representation:
+    newtype:
+      constructor: Struct6a
+      fields:
+      - unwrapStruct6a
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct6a_struct
+  representation:
+    record:
+      constructor: Struct6a_struct
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct6b
+  representation:
+    newtype:
+      constructor: Struct6b
+      fields:
+      - unwrapStruct6b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct6b_struct
+  representation:
+    record:
+      constructor: Struct6b_struct
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct7
+  representation:
+    record:
+      constructor: Struct7
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct7a
+  representation:
+    newtype:
+      constructor: Struct7a
+      fields:
+      - unwrapStruct7a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct7b
+  representation:
+    newtype:
+      constructor: Struct7b
+      fields:
+      - unwrapStruct7b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct8
+  representation:
+    record:
+      constructor: Struct8
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct8b
+  representation:
+    newtype:
+      constructor: Struct8b
+      fields:
+      - unwrapStruct8b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct9
+  representation:
+    record:
+      constructor: Struct9
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct9_t
+  representation:
+    newtype:
+      constructor: Struct9_t
+      fields:
+      - unwrapStruct9_t
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Use_sites
+  representation:
+    record:
+      constructor: Use_sites
+      fields:
+      - use_sites_useTypedef_struct1_t
+      - use_sites_useTypedef_struct2_t
+      - use_sites_useTypedef_struct3_t
+      - use_sites_useTypedef_struct4_t
+      - use_sites_useStruct_struct5
+      - use_sites_useTypedef_struct5_t
+      - use_sites_useStruct_struct6a
+      - use_sites_useTypedef_struct6a
+      - use_sites_useStruct_struct6b
+      - use_sites_useTypedef_struct6b
+      - use_sites_useTypedef_struct7a
+      - use_sites_useTypedef_struct7b
+      - use_sites_useTypedef_struct8
+      - use_sites_useTypedef_struct8b
+      - use_sites_useTypedef_struct9
+      - use_sites_useTypedef_struct9_t
+      - use_sites_useTypedef_struct10_t
+      - use_sites_useTypedef_struct10_t_t
+      - use_sites_useTypedef_struct11_t
+      - use_sites_useTypedef_struct12_t
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Use_sites_qual
+  representation:
+    record:
+      constructor: Use_sites_qual
+      fields:
+      - use_sites_qual_useTypedef_struct15
+      - use_sites_qual_useStruct_struct16
+      - use_sites_qual_useTypedef_struct16
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/typedef_analysis/th.txt b/test-artefacts/fixtures/program-analysis/typedef_analysis/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_analysis/th.txt
@@ -0,0 +1,1571 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/typedef_analysis.h
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 41:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct1_t = Struct1_t {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct1_t
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct1_t
+    where readRaw = \ptr_0 -> pure Struct1_t
+instance WriteRaw Struct1_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct1_t -> pure ()
+deriving via (EquivStorable Struct1_t) instance Storable Struct1_t
+deriving via (IsStructViaReadRaw Struct1_t) instance IsStruct Struct1_t
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 45:16@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct2_t = Struct2_t {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct2_t
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct2_t
+    where readRaw = \ptr_0 -> pure Struct2_t
+instance WriteRaw Struct2_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct2_t -> pure ()
+deriving via (EquivStorable Struct2_t) instance Storable Struct2_t
+deriving via (IsStructViaReadRaw Struct2_t) instance IsStruct Struct2_t
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 49:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct3_t
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 53:16@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct4_t
+{-| __C declaration:__ @struct struct5@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 56:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct5 = Struct5 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct5
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct5
+    where readRaw = \ptr_0 -> pure Struct5
+instance WriteRaw Struct5
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct5 -> pure ()
+deriving via (EquivStorable Struct5) instance Storable Struct5
+deriving via (IsStructViaReadRaw Struct5) instance IsStruct Struct5
+{-| __C declaration:__ @struct5_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 57:25@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct5_t
+    = Struct5_t {unwrapStruct5_t :: (Ptr Struct5)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr Struct5) =>
+         HasField "unwrapStruct5_t" Struct5_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct5_t{unwrapStruct5_t = y_1},
+                              getField @"unwrapStruct5_t" x_0)
+instance (~) ty (Ptr Struct5) =>
+         HasField "unwrapStruct5_t" (Ptr Struct5_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct5_t")
+instance HasCField Struct5_t "unwrapStruct5_t"
+    where type CFieldType Struct5_t "unwrapStruct5_t" = Ptr Struct5
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct6a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 60:16@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct6a_struct
+    = Struct6a_struct {}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct6a_struct
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct6a_struct
+    where readRaw = \ptr_0 -> pure Struct6a_struct
+instance WriteRaw Struct6a_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct6a_struct -> pure ()
+deriving via (EquivStorable Struct6a_struct) instance Storable Struct6a_struct
+deriving via (IsStructViaReadRaw Struct6a_struct) instance IsStruct Struct6a_struct
+{-| __C declaration:__ @struct6a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 61:4@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct6a
+    = Struct6a {unwrapStruct6a :: (Ptr Struct6a_struct)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr Struct6a_struct) =>
+         HasField "unwrapStruct6a" Struct6a ty
+    where hasField = \x_0 -> (\y_1 -> Struct6a{unwrapStruct6a = y_1},
+                              getField @"unwrapStruct6a" x_0)
+instance (~) ty (Ptr Struct6a_struct) =>
+         HasField "unwrapStruct6a" (Ptr Struct6a) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct6a")
+instance HasCField Struct6a "unwrapStruct6a"
+    where type CFieldType Struct6a
+                          "unwrapStruct6a" = Ptr Struct6a_struct
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct6b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 68:16@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct6b_struct
+    = Struct6b_struct {}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct6b_struct
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct6b_struct
+    where readRaw = \ptr_0 -> pure Struct6b_struct
+instance WriteRaw Struct6b_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct6b_struct -> pure ()
+deriving via (EquivStorable Struct6b_struct) instance Storable Struct6b_struct
+deriving via (IsStructViaReadRaw Struct6b_struct) instance IsStruct Struct6b_struct
+{-| __C declaration:__ @struct6b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 69:3@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct6b
+    = Struct6b {unwrapStruct6b :: (ConstantArray 50 Struct6b_struct)}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 50 Struct6b_struct) =>
+         HasField "unwrapStruct6b" Struct6b ty
+    where hasField = \x_0 -> (\y_1 -> Struct6b{unwrapStruct6b = y_1},
+                              getField @"unwrapStruct6b" x_0)
+instance (~) ty (ConstantArray 50 Struct6b_struct) =>
+         HasField "unwrapStruct6b" (Ptr Struct6b) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct6b")
+instance HasCField Struct6b "unwrapStruct6b"
+    where type CFieldType Struct6b "unwrapStruct6b" = ConstantArray 50
+                                                                    Struct6b_struct
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct7@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 72:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct7 = Struct7 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct7
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct7
+    where readRaw = \ptr_0 -> pure Struct7
+instance WriteRaw Struct7
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct7 -> pure ()
+deriving via (EquivStorable Struct7) instance Storable Struct7
+deriving via (IsStructViaReadRaw Struct7) instance IsStruct Struct7
+{-| __C declaration:__ @struct7a@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 73:24@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct7a
+    = Struct7a {unwrapStruct7a :: Struct7}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty Struct7 => HasField "unwrapStruct7a" Struct7a ty
+    where hasField = \x_0 -> (\y_1 -> Struct7a{unwrapStruct7a = y_1},
+                              getField @"unwrapStruct7a" x_0)
+instance (~) ty Struct7 =>
+         HasField "unwrapStruct7a" (Ptr Struct7a) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct7a")
+instance HasCField Struct7a "unwrapStruct7a"
+    where type CFieldType Struct7a "unwrapStruct7a" = Struct7
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct7b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 74:24@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct7b
+    = Struct7b {unwrapStruct7b :: Struct7}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty Struct7 => HasField "unwrapStruct7b" Struct7b ty
+    where hasField = \x_0 -> (\y_1 -> Struct7b{unwrapStruct7b = y_1},
+                              getField @"unwrapStruct7b" x_0)
+instance (~) ty Struct7 =>
+         HasField "unwrapStruct7b" (Ptr Struct7b) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct7b")
+instance HasCField Struct7b "unwrapStruct7b"
+    where type CFieldType Struct7b "unwrapStruct7b" = Struct7
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct8@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 77:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct8 = Struct8 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct8
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct8
+    where readRaw = \ptr_0 -> pure Struct8
+instance WriteRaw Struct8
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct8 -> pure ()
+deriving via (EquivStorable Struct8) instance Storable Struct8
+deriving via (IsStructViaReadRaw Struct8) instance IsStruct Struct8
+{-| __C declaration:__ @struct8b@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 79:24@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct8b
+    = Struct8b {unwrapStruct8b :: Struct8}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty Struct8 => HasField "unwrapStruct8b" Struct8b ty
+    where hasField = \x_0 -> (\y_1 -> Struct8b{unwrapStruct8b = y_1},
+                              getField @"unwrapStruct8b" x_0)
+instance (~) ty Struct8 =>
+         HasField "unwrapStruct8b" (Ptr Struct8b) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct8b")
+instance HasCField Struct8b "unwrapStruct8b"
+    where type CFieldType Struct8b "unwrapStruct8b" = Struct8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct9@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 82:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct9 = Struct9 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct9
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct9
+    where readRaw = \ptr_0 -> pure Struct9
+instance WriteRaw Struct9
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct9 -> pure ()
+deriving via (EquivStorable Struct9) instance Storable Struct9
+deriving via (IsStructViaReadRaw Struct9) instance IsStruct Struct9
+{-| __C declaration:__ @struct9_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 84:17@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct9_t
+    = Struct9_t {unwrapStruct9_t :: Struct9}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty Struct9 => HasField "unwrapStruct9_t" Struct9_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct9_t{unwrapStruct9_t = y_1},
+                              getField @"unwrapStruct9_t" x_0)
+instance (~) ty Struct9 =>
+         HasField "unwrapStruct9_t" (Ptr Struct9_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct9_t")
+instance HasCField Struct9_t "unwrapStruct9_t"
+    where type CFieldType Struct9_t "unwrapStruct9_t" = Struct9
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct10@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 90:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct10_t = Struct10_t {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct10_t
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct10_t
+    where readRaw = \ptr_0 -> pure Struct10_t
+instance WriteRaw Struct10_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct10_t -> pure ()
+deriving via (EquivStorable Struct10_t) instance Storable Struct10_t
+deriving via (IsStructViaReadRaw Struct10_t) instance IsStruct Struct10_t
+{-| __C declaration:__ @struct10_t_t@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 92:20@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct10_t_t
+    = Struct10_t_t {unwrapStruct10_t_t :: Struct10_t}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty Struct10_t =>
+         HasField "unwrapStruct10_t_t" Struct10_t_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct10_t_t{unwrapStruct10_t_t = y_1},
+                              getField @"unwrapStruct10_t_t" x_0)
+instance (~) ty Struct10_t =>
+         HasField "unwrapStruct10_t_t" (Ptr Struct10_t_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct10_t_t")
+instance HasCField Struct10_t_t "unwrapStruct10_t_t"
+    where type CFieldType Struct10_t_t
+                          "unwrapStruct10_t_t" = Struct10_t
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct11@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 95:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct11_t
+    = Struct11_t {struct11_t_x :: CInt
+                  {- ^ __C declaration:__ @x@
+
+                       __defined at:__ @program-analysis\/typedef_analysis.h 96:7@
+
+                       __exported by:__ @program-analysis\/typedef_analysis.h@
+                  -},
+                  struct11_t_self :: (Ptr Struct11_t)
+                  {- ^ __C declaration:__ @self@
+
+                       __defined at:__ @program-analysis\/typedef_analysis.h 97:20@
+
+                       __exported by:__ @program-analysis\/typedef_analysis.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct11_t
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Struct11_t
+    where readRaw = \ptr_0 -> (pure Struct11_t <*> readRaw (Proxy @"struct11_t_x") ptr_0) <*> readRaw (Proxy @"struct11_t_self") ptr_0
+instance WriteRaw Struct11_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct11_t struct11_t_x_2
+                                                  struct11_t_self_3 -> writeRaw (Proxy @"struct11_t_x") ptr_0 struct11_t_x_2 >> writeRaw (Proxy @"struct11_t_self") ptr_0 struct11_t_self_3
+deriving via (EquivStorable Struct11_t) instance Storable Struct11_t
+deriving via (IsStructViaReadRaw Struct11_t) instance IsStruct Struct11_t
+instance (~) ty CInt => HasField "struct11_t_x" Struct11_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct11_t{struct11_t_x = y_1,
+                                                 struct11_t_self = getField @"struct11_t_self" x_0},
+                              getField @"struct11_t_x" x_0)
+instance (~) ty CInt =>
+         HasField "struct11_t_x" (Ptr Struct11_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct11_t_x")
+instance HasCField Struct11_t "struct11_t_x"
+    where type CFieldType Struct11_t "struct11_t_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Struct11_t) =>
+         HasField "struct11_t_self" Struct11_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct11_t{struct11_t_self = y_1,
+                                                 struct11_t_x = getField @"struct11_t_x" x_0},
+                              getField @"struct11_t_self" x_0)
+instance (~) ty (Ptr Struct11_t) =>
+         HasField "struct11_t_self" (Ptr Struct11_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct11_t_self")
+instance HasCField Struct11_t "struct11_t_self"
+    where type CFieldType Struct11_t "struct11_t_self" = Ptr Struct11_t
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct struct12@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 104:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct12_t
+    = Struct12_t {struct12_t_x :: CInt
+                  {- ^ __C declaration:__ @x@
+
+                       __defined at:__ @program-analysis\/typedef_analysis.h 105:7@
+
+                       __exported by:__ @program-analysis\/typedef_analysis.h@
+                  -},
+                  struct12_t_self :: (Ptr Struct12_t)
+                  {- ^ __C declaration:__ @self@
+
+                       __defined at:__ @program-analysis\/typedef_analysis.h 106:15@
+
+                       __exported by:__ @program-analysis\/typedef_analysis.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct12_t
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Struct12_t
+    where readRaw = \ptr_0 -> (pure Struct12_t <*> readRaw (Proxy @"struct12_t_x") ptr_0) <*> readRaw (Proxy @"struct12_t_self") ptr_0
+instance WriteRaw Struct12_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct12_t struct12_t_x_2
+                                                  struct12_t_self_3 -> writeRaw (Proxy @"struct12_t_x") ptr_0 struct12_t_x_2 >> writeRaw (Proxy @"struct12_t_self") ptr_0 struct12_t_self_3
+deriving via (EquivStorable Struct12_t) instance Storable Struct12_t
+deriving via (IsStructViaReadRaw Struct12_t) instance IsStruct Struct12_t
+instance (~) ty CInt => HasField "struct12_t_x" Struct12_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct12_t{struct12_t_x = y_1,
+                                                 struct12_t_self = getField @"struct12_t_self" x_0},
+                              getField @"struct12_t_x" x_0)
+instance (~) ty CInt =>
+         HasField "struct12_t_x" (Ptr Struct12_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct12_t_x")
+instance HasCField Struct12_t "struct12_t_x"
+    where type CFieldType Struct12_t "struct12_t_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Struct12_t) =>
+         HasField "struct12_t_self" Struct12_t ty
+    where hasField = \x_0 -> (\y_1 -> Struct12_t{struct12_t_self = y_1,
+                                                 struct12_t_x = getField @"struct12_t_x" x_0},
+                              getField @"struct12_t_self" x_0)
+instance (~) ty (Ptr Struct12_t) =>
+         HasField "struct12_t_self" (Ptr Struct12_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct12_t_self")
+instance HasCField Struct12_t "struct12_t_self"
+    where type CFieldType Struct12_t "struct12_t_self" = Ptr Struct12_t
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct use_sites@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 110:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Use_sites
+    = Use_sites {use_sites_useTypedef_struct1_t :: Struct1_t
+                 {- ^ __C declaration:__ @useTypedef_struct1_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 112:13@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct2_t :: Struct2_t
+                 {- ^ __C declaration:__ @useTypedef_struct2_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 115:13@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct3_t :: (Ptr Struct3_t)
+                 {- ^ __C declaration:__ @useTypedef_struct3_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 118:14@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct4_t :: (Ptr Struct4_t)
+                 {- ^ __C declaration:__ @useTypedef_struct4_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 119:14@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useStruct_struct5 :: Struct5
+                 {- ^ __C declaration:__ @useStruct_struct5@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 122:18@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct5_t :: Struct5_t
+                 {- ^ __C declaration:__ @useTypedef_struct5_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 123:13@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useStruct_struct6a :: Struct6a_struct
+                 {- ^ __C declaration:__ @useStruct_struct6a@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 126:19@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct6a :: Struct6a
+                 {- ^ __C declaration:__ @useTypedef_struct6a@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 127:12@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useStruct_struct6b :: Struct6b_struct
+                 {- ^ __C declaration:__ @useStruct_struct6b@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 130:19@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct6b :: Struct6b
+                 {- ^ __C declaration:__ @useTypedef_struct6b@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 131:12@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct7a :: Struct7a
+                 {- ^ __C declaration:__ @useTypedef_struct7a@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 134:12@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct7b :: Struct7b
+                 {- ^ __C declaration:__ @useTypedef_struct7b@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 135:12@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct8 :: Struct8
+                 {- ^ __C declaration:__ @useTypedef_struct8@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 139:11@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct8b :: Struct8b
+                 {- ^ __C declaration:__ @useTypedef_struct8b@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 140:12@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct9 :: Struct9
+                 {- ^ __C declaration:__ @useTypedef_struct9@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 144:11@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct9_t :: Struct9_t
+                 {- ^ __C declaration:__ @useTypedef_struct9_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 145:13@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct10_t :: Struct10_t
+                 {- ^ __C declaration:__ @useTypedef_struct10_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 146:14@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct10_t_t :: Struct10_t_t
+                 {- ^ __C declaration:__ @useTypedef_struct10_t_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 147:16@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct11_t :: Struct11_t
+                 {- ^ __C declaration:__ @useTypedef_struct11_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 150:14@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -},
+                 use_sites_useTypedef_struct12_t :: Struct12_t
+                 {- ^ __C declaration:__ @useTypedef_struct12_t@
+
+                      __defined at:__ @program-analysis\/typedef_analysis.h 151:14@
+
+                      __exported by:__ @program-analysis\/typedef_analysis.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Use_sites
+    where staticSizeOf = \_ -> 64 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Use_sites
+    where readRaw = \ptr_0 -> (((((((((((((((((((pure Use_sites <*> readRaw (Proxy @"use_sites_useTypedef_struct1_t") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct2_t") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct3_t") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct4_t") ptr_0) <*> readRaw (Proxy @"use_sites_useStruct_struct5") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct5_t") ptr_0) <*> readRaw (Proxy @"use_sites_useStruct_struct6a") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct6a") ptr_0) <*> readRaw (Proxy @"use_sites_useStruct_struct6b") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct6b") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct7a") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct7b") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct8") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct8b") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct9") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct9_t") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct10_t") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct10_t_t") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct11_t") ptr_0) <*> readRaw (Proxy @"use_sites_useTypedef_struct12_t") ptr_0
+instance WriteRaw Use_sites
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Use_sites use_sites_useTypedef_struct1_t_2
+                                                 use_sites_useTypedef_struct2_t_3
+                                                 use_sites_useTypedef_struct3_t_4
+                                                 use_sites_useTypedef_struct4_t_5
+                                                 use_sites_useStruct_struct5_6
+                                                 use_sites_useTypedef_struct5_t_7
+                                                 use_sites_useStruct_struct6a_8
+                                                 use_sites_useTypedef_struct6a_9
+                                                 use_sites_useStruct_struct6b_10
+                                                 use_sites_useTypedef_struct6b_11
+                                                 use_sites_useTypedef_struct7a_12
+                                                 use_sites_useTypedef_struct7b_13
+                                                 use_sites_useTypedef_struct8_14
+                                                 use_sites_useTypedef_struct8b_15
+                                                 use_sites_useTypedef_struct9_16
+                                                 use_sites_useTypedef_struct9_t_17
+                                                 use_sites_useTypedef_struct10_t_18
+                                                 use_sites_useTypedef_struct10_t_t_19
+                                                 use_sites_useTypedef_struct11_t_20
+                                                 use_sites_useTypedef_struct12_t_21 -> writeRaw (Proxy @"use_sites_useTypedef_struct1_t") ptr_0 use_sites_useTypedef_struct1_t_2 >> (writeRaw (Proxy @"use_sites_useTypedef_struct2_t") ptr_0 use_sites_useTypedef_struct2_t_3 >> (writeRaw (Proxy @"use_sites_useTypedef_struct3_t") ptr_0 use_sites_useTypedef_struct3_t_4 >> (writeRaw (Proxy @"use_sites_useTypedef_struct4_t") ptr_0 use_sites_useTypedef_struct4_t_5 >> (writeRaw (Proxy @"use_sites_useStruct_struct5") ptr_0 use_sites_useStruct_struct5_6 >> (writeRaw (Proxy @"use_sites_useTypedef_struct5_t") ptr_0 use_sites_useTypedef_struct5_t_7 >> (writeRaw (Proxy @"use_sites_useStruct_struct6a") ptr_0 use_sites_useStruct_struct6a_8 >> (writeRaw (Proxy @"use_sites_useTypedef_struct6a") ptr_0 use_sites_useTypedef_struct6a_9 >> (writeRaw (Proxy @"use_sites_useStruct_struct6b") ptr_0 use_sites_useStruct_struct6b_10 >> (writeRaw (Proxy @"use_sites_useTypedef_struct6b") ptr_0 use_sites_useTypedef_struct6b_11 >> (writeRaw (Proxy @"use_sites_useTypedef_struct7a") ptr_0 use_sites_useTypedef_struct7a_12 >> (writeRaw (Proxy @"use_sites_useTypedef_struct7b") ptr_0 use_sites_useTypedef_struct7b_13 >> (writeRaw (Proxy @"use_sites_useTypedef_struct8") ptr_0 use_sites_useTypedef_struct8_14 >> (writeRaw (Proxy @"use_sites_useTypedef_struct8b") ptr_0 use_sites_useTypedef_struct8b_15 >> (writeRaw (Proxy @"use_sites_useTypedef_struct9") ptr_0 use_sites_useTypedef_struct9_16 >> (writeRaw (Proxy @"use_sites_useTypedef_struct9_t") ptr_0 use_sites_useTypedef_struct9_t_17 >> (writeRaw (Proxy @"use_sites_useTypedef_struct10_t") ptr_0 use_sites_useTypedef_struct10_t_18 >> (writeRaw (Proxy @"use_sites_useTypedef_struct10_t_t") ptr_0 use_sites_useTypedef_struct10_t_t_19 >> (writeRaw (Proxy @"use_sites_useTypedef_struct11_t") ptr_0 use_sites_useTypedef_struct11_t_20 >> writeRaw (Proxy @"use_sites_useTypedef_struct12_t") ptr_0 use_sites_useTypedef_struct12_t_21))))))))))))))))))
+deriving via (EquivStorable Use_sites) instance Storable Use_sites
+deriving via (IsStructViaReadRaw Use_sites) instance IsStruct Use_sites
+instance (~) ty Struct1_t =>
+         HasField "use_sites_useTypedef_struct1_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct1_t = y_1,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct1_t" x_0)
+instance (~) ty Struct1_t =>
+         HasField "use_sites_useTypedef_struct1_t" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct1_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct1_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct1_t" = Struct1_t
+          offset# = \_ -> \_ -> 0
+instance (~) ty Struct2_t =>
+         HasField "use_sites_useTypedef_struct2_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct2_t = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct2_t" x_0)
+instance (~) ty Struct2_t =>
+         HasField "use_sites_useTypedef_struct2_t" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct2_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct2_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct2_t" = Struct2_t
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Struct3_t) =>
+         HasField "use_sites_useTypedef_struct3_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct3_t = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct3_t" x_0)
+instance (~) ty (Ptr Struct3_t) =>
+         HasField "use_sites_useTypedef_struct3_t" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct3_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct3_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct3_t" = Ptr Struct3_t
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Struct4_t) =>
+         HasField "use_sites_useTypedef_struct4_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct4_t = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct4_t" x_0)
+instance (~) ty (Ptr Struct4_t) =>
+         HasField "use_sites_useTypedef_struct4_t" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct4_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct4_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct4_t" = Ptr Struct4_t
+          offset# = \_ -> \_ -> 8
+instance (~) ty Struct5 =>
+         HasField "use_sites_useStruct_struct5" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useStruct_struct5 = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useStruct_struct5" x_0)
+instance (~) ty Struct5 =>
+         HasField "use_sites_useStruct_struct5" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useStruct_struct5")
+instance HasCField Use_sites "use_sites_useStruct_struct5"
+    where type CFieldType Use_sites
+                          "use_sites_useStruct_struct5" = Struct5
+          offset# = \_ -> \_ -> 16
+instance (~) ty Struct5_t =>
+         HasField "use_sites_useTypedef_struct5_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct5_t = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct5_t" x_0)
+instance (~) ty Struct5_t =>
+         HasField "use_sites_useTypedef_struct5_t" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct5_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct5_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct5_t" = Struct5_t
+          offset# = \_ -> \_ -> 16
+instance (~) ty Struct6a_struct =>
+         HasField "use_sites_useStruct_struct6a" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useStruct_struct6a = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useStruct_struct6a" x_0)
+instance (~) ty Struct6a_struct =>
+         HasField "use_sites_useStruct_struct6a" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useStruct_struct6a")
+instance HasCField Use_sites "use_sites_useStruct_struct6a"
+    where type CFieldType Use_sites
+                          "use_sites_useStruct_struct6a" = Struct6a_struct
+          offset# = \_ -> \_ -> 24
+instance (~) ty Struct6a =>
+         HasField "use_sites_useTypedef_struct6a" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct6a = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct6a" x_0)
+instance (~) ty Struct6a =>
+         HasField "use_sites_useTypedef_struct6a" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct6a")
+instance HasCField Use_sites "use_sites_useTypedef_struct6a"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct6a" = Struct6a
+          offset# = \_ -> \_ -> 24
+instance (~) ty Struct6b_struct =>
+         HasField "use_sites_useStruct_struct6b" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useStruct_struct6b = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useStruct_struct6b" x_0)
+instance (~) ty Struct6b_struct =>
+         HasField "use_sites_useStruct_struct6b" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useStruct_struct6b")
+instance HasCField Use_sites "use_sites_useStruct_struct6b"
+    where type CFieldType Use_sites
+                          "use_sites_useStruct_struct6b" = Struct6b_struct
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct6b =>
+         HasField "use_sites_useTypedef_struct6b" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct6b = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct6b" x_0)
+instance (~) ty Struct6b =>
+         HasField "use_sites_useTypedef_struct6b" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct6b")
+instance HasCField Use_sites "use_sites_useTypedef_struct6b"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct6b" = Struct6b
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct7a =>
+         HasField "use_sites_useTypedef_struct7a" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct7a = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct7a" x_0)
+instance (~) ty Struct7a =>
+         HasField "use_sites_useTypedef_struct7a" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct7a")
+instance HasCField Use_sites "use_sites_useTypedef_struct7a"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct7a" = Struct7a
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct7b =>
+         HasField "use_sites_useTypedef_struct7b" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct7b = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct7b" x_0)
+instance (~) ty Struct7b =>
+         HasField "use_sites_useTypedef_struct7b" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct7b")
+instance HasCField Use_sites "use_sites_useTypedef_struct7b"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct7b" = Struct7b
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct8 =>
+         HasField "use_sites_useTypedef_struct8" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct8 = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct8" x_0)
+instance (~) ty Struct8 =>
+         HasField "use_sites_useTypedef_struct8" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct8")
+instance HasCField Use_sites "use_sites_useTypedef_struct8"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct8" = Struct8
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct8b =>
+         HasField "use_sites_useTypedef_struct8b" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct8b = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct8b" x_0)
+instance (~) ty Struct8b =>
+         HasField "use_sites_useTypedef_struct8b" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct8b")
+instance HasCField Use_sites "use_sites_useTypedef_struct8b"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct8b" = Struct8b
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct9 =>
+         HasField "use_sites_useTypedef_struct9" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct9 = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct9" x_0)
+instance (~) ty Struct9 =>
+         HasField "use_sites_useTypedef_struct9" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct9")
+instance HasCField Use_sites "use_sites_useTypedef_struct9"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct9" = Struct9
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct9_t =>
+         HasField "use_sites_useTypedef_struct9_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct9_t = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct9_t" x_0)
+instance (~) ty Struct9_t =>
+         HasField "use_sites_useTypedef_struct9_t" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct9_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct9_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct9_t" = Struct9_t
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct10_t =>
+         HasField "use_sites_useTypedef_struct10_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct10_t = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct10_t" x_0)
+instance (~) ty Struct10_t =>
+         HasField "use_sites_useTypedef_struct10_t" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct10_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct10_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct10_t" = Struct10_t
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct10_t_t =>
+         HasField "use_sites_useTypedef_struct10_t_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct10_t_t = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct10_t_t" x_0)
+instance (~) ty Struct10_t_t =>
+         HasField "use_sites_useTypedef_struct10_t_t"
+                  (Ptr Use_sites)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct10_t_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct10_t_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct10_t_t" = Struct10_t_t
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct11_t =>
+         HasField "use_sites_useTypedef_struct11_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct11_t = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct12_t = getField @"use_sites_useTypedef_struct12_t" x_0},
+                              getField @"use_sites_useTypedef_struct11_t" x_0)
+instance (~) ty Struct11_t =>
+         HasField "use_sites_useTypedef_struct11_t" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct11_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct11_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct11_t" = Struct11_t
+          offset# = \_ -> \_ -> 32
+instance (~) ty Struct12_t =>
+         HasField "use_sites_useTypedef_struct12_t" Use_sites ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites{use_sites_useTypedef_struct12_t = y_1,
+                                                use_sites_useTypedef_struct1_t = getField @"use_sites_useTypedef_struct1_t" x_0,
+                                                use_sites_useTypedef_struct2_t = getField @"use_sites_useTypedef_struct2_t" x_0,
+                                                use_sites_useTypedef_struct3_t = getField @"use_sites_useTypedef_struct3_t" x_0,
+                                                use_sites_useTypedef_struct4_t = getField @"use_sites_useTypedef_struct4_t" x_0,
+                                                use_sites_useStruct_struct5 = getField @"use_sites_useStruct_struct5" x_0,
+                                                use_sites_useTypedef_struct5_t = getField @"use_sites_useTypedef_struct5_t" x_0,
+                                                use_sites_useStruct_struct6a = getField @"use_sites_useStruct_struct6a" x_0,
+                                                use_sites_useTypedef_struct6a = getField @"use_sites_useTypedef_struct6a" x_0,
+                                                use_sites_useStruct_struct6b = getField @"use_sites_useStruct_struct6b" x_0,
+                                                use_sites_useTypedef_struct6b = getField @"use_sites_useTypedef_struct6b" x_0,
+                                                use_sites_useTypedef_struct7a = getField @"use_sites_useTypedef_struct7a" x_0,
+                                                use_sites_useTypedef_struct7b = getField @"use_sites_useTypedef_struct7b" x_0,
+                                                use_sites_useTypedef_struct8 = getField @"use_sites_useTypedef_struct8" x_0,
+                                                use_sites_useTypedef_struct8b = getField @"use_sites_useTypedef_struct8b" x_0,
+                                                use_sites_useTypedef_struct9 = getField @"use_sites_useTypedef_struct9" x_0,
+                                                use_sites_useTypedef_struct9_t = getField @"use_sites_useTypedef_struct9_t" x_0,
+                                                use_sites_useTypedef_struct10_t = getField @"use_sites_useTypedef_struct10_t" x_0,
+                                                use_sites_useTypedef_struct10_t_t = getField @"use_sites_useTypedef_struct10_t_t" x_0,
+                                                use_sites_useTypedef_struct11_t = getField @"use_sites_useTypedef_struct11_t" x_0},
+                              getField @"use_sites_useTypedef_struct12_t" x_0)
+instance (~) ty Struct12_t =>
+         HasField "use_sites_useTypedef_struct12_t" (Ptr Use_sites) (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_useTypedef_struct12_t")
+instance HasCField Use_sites "use_sites_useTypedef_struct12_t"
+    where type CFieldType Use_sites
+                          "use_sites_useTypedef_struct12_t" = Struct12_t
+          offset# = \_ -> \_ -> 48
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 163:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Foo_struct
+    = Foo_struct {foo_struct_x :: CInt
+                  {- ^ __C declaration:__ @x@
+
+                       __defined at:__ @program-analysis\/typedef_analysis.h 164:7@
+
+                       __exported by:__ @program-analysis\/typedef_analysis.h@
+                  -},
+                  foo_struct_y :: CInt
+                  {- ^ __C declaration:__ @y@
+
+                       __defined at:__ @program-analysis\/typedef_analysis.h 165:7@
+
+                       __exported by:__ @program-analysis\/typedef_analysis.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Foo_struct
+    where readRaw = \ptr_0 -> (pure Foo_struct <*> readRaw (Proxy @"foo_struct_x") ptr_0) <*> readRaw (Proxy @"foo_struct_y") ptr_0
+instance WriteRaw Foo_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo_struct foo_struct_x_2
+                                                  foo_struct_y_3 -> writeRaw (Proxy @"foo_struct_x") ptr_0 foo_struct_x_2 >> writeRaw (Proxy @"foo_struct_y") ptr_0 foo_struct_y_3
+deriving via (EquivStorable Foo_struct) instance Storable Foo_struct
+deriving via (IsStructViaReadRaw Foo_struct) instance IsStruct Foo_struct
+instance (~) ty CInt => HasField "foo_struct_x" Foo_struct ty
+    where hasField = \x_0 -> (\y_1 -> Foo_struct{foo_struct_x = y_1,
+                                                 foo_struct_y = getField @"foo_struct_y" x_0},
+                              getField @"foo_struct_x" x_0)
+instance (~) ty CInt =>
+         HasField "foo_struct_x" (Ptr Foo_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_struct_x")
+instance HasCField Foo_struct "foo_struct_x"
+    where type CFieldType Foo_struct "foo_struct_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "foo_struct_y" Foo_struct ty
+    where hasField = \x_0 -> (\y_1 -> Foo_struct{foo_struct_y = y_1,
+                                                 foo_struct_x = getField @"foo_struct_x" x_0},
+                              getField @"foo_struct_y" x_0)
+instance (~) ty CInt =>
+         HasField "foo_struct_y" (Ptr Foo_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_struct_y")
+instance HasCField Foo_struct "foo_struct_y"
+    where type CFieldType Foo_struct "foo_struct_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| Auxiliary type used by 'Foo'
+
+    __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 167:22@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Foo_Aux
+    = Foo_Aux {unwrapFoo_Aux :: (IO Foo_struct)}
+    deriving stock Generic
+instance (~) ty (IO Foo_struct) =>
+         HasField "unwrapFoo_Aux" Foo_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Foo_Aux{unwrapFoo_Aux = y_1},
+                              getField @"unwrapFoo_Aux" x_0)
+instance (~) ty (IO Foo_struct) =>
+         HasField "unwrapFoo_Aux" (Ptr Foo_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo_Aux")
+instance HasCField Foo_Aux "unwrapFoo_Aux"
+    where type CFieldType Foo_Aux "unwrapFoo_Aux" = IO Foo_struct
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 167:22@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Foo
+    = Foo {unwrapFoo :: (FunPtr Foo_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Foo_Aux) => HasField "unwrapFoo" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{unwrapFoo = y_1},
+                              getField @"unwrapFoo" x_0)
+instance (~) ty (FunPtr Foo_Aux) =>
+         HasField "unwrapFoo" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo")
+instance HasCField Foo "unwrapFoo"
+    where type CFieldType Foo "unwrapFoo" = FunPtr Foo_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 171:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Bar_struct
+    = Bar_struct {bar_struct_a :: CInt
+                  {- ^ __C declaration:__ @a@
+
+                       __defined at:__ @program-analysis\/typedef_analysis.h 172:7@
+
+                       __exported by:__ @program-analysis\/typedef_analysis.h@
+                  -},
+                  bar_struct_b :: CInt
+                  {- ^ __C declaration:__ @b@
+
+                       __defined at:__ @program-analysis\/typedef_analysis.h 173:7@
+
+                       __exported by:__ @program-analysis\/typedef_analysis.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bar_struct
+    where readRaw = \ptr_0 -> (pure Bar_struct <*> readRaw (Proxy @"bar_struct_a") ptr_0) <*> readRaw (Proxy @"bar_struct_b") ptr_0
+instance WriteRaw Bar_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_struct bar_struct_a_2
+                                                  bar_struct_b_3 -> writeRaw (Proxy @"bar_struct_a") ptr_0 bar_struct_a_2 >> writeRaw (Proxy @"bar_struct_b") ptr_0 bar_struct_b_3
+deriving via (EquivStorable Bar_struct) instance Storable Bar_struct
+deriving via (IsStructViaReadRaw Bar_struct) instance IsStruct Bar_struct
+instance (~) ty CInt => HasField "bar_struct_a" Bar_struct ty
+    where hasField = \x_0 -> (\y_1 -> Bar_struct{bar_struct_a = y_1,
+                                                 bar_struct_b = getField @"bar_struct_b" x_0},
+                              getField @"bar_struct_a" x_0)
+instance (~) ty CInt =>
+         HasField "bar_struct_a" (Ptr Bar_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_struct_a")
+instance HasCField Bar_struct "bar_struct_a"
+    where type CFieldType Bar_struct "bar_struct_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "bar_struct_b" Bar_struct ty
+    where hasField = \x_0 -> (\y_1 -> Bar_struct{bar_struct_b = y_1,
+                                                 bar_struct_a = getField @"bar_struct_a" x_0},
+                              getField @"bar_struct_b" x_0)
+instance (~) ty CInt =>
+         HasField "bar_struct_b" (Ptr Bar_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_struct_b")
+instance HasCField Bar_struct "bar_struct_b"
+    where type CFieldType Bar_struct "bar_struct_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| Auxiliary type used by 'Bar'
+
+    __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 175:22@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Bar_Aux
+    = Bar_Aux {unwrapBar_Aux :: (Bar_struct -> IO Foo_struct)}
+    deriving stock Generic
+instance (~) ty (Bar_struct -> IO Foo_struct) =>
+         HasField "unwrapBar_Aux" Bar_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Bar_Aux{unwrapBar_Aux = y_1},
+                              getField @"unwrapBar_Aux" x_0)
+instance (~) ty (Bar_struct -> IO Foo_struct) =>
+         HasField "unwrapBar_Aux" (Ptr Bar_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBar_Aux")
+instance HasCField Bar_Aux "unwrapBar_Aux"
+    where type CFieldType Bar_Aux "unwrapBar_Aux" = Bar_struct ->
+                                                    IO Foo_struct
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @bar@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 175:22@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Bar
+    = Bar {unwrapBar :: (FunPtr Bar_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr Bar_Aux) => HasField "unwrapBar" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{unwrapBar = y_1},
+                              getField @"unwrapBar" x_0)
+instance (~) ty (FunPtr Bar_Aux) =>
+         HasField "unwrapBar" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBar")
+instance HasCField Bar "unwrapBar"
+    where type CFieldType Bar "unwrapBar" = FunPtr Bar_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct struct15@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 182:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct15 = Struct15 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct15
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct15
+    where readRaw = \ptr_0 -> pure Struct15
+instance WriteRaw Struct15
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct15 -> pure ()
+deriving via (EquivStorable Struct15) instance Storable Struct15
+deriving via (IsStructViaReadRaw Struct15) instance IsStruct Struct15
+{-| __C declaration:__ @struct struct16@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 191:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Struct16_struct
+    = Struct16_struct {}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct16_struct
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct16_struct
+    where readRaw = \ptr_0 -> pure Struct16_struct
+instance WriteRaw Struct16_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct16_struct -> pure ()
+deriving via (EquivStorable Struct16_struct) instance Storable Struct16_struct
+deriving via (IsStructViaReadRaw Struct16_struct) instance IsStruct Struct16_struct
+{-| __C declaration:__ @struct16@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 192:32@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+newtype Struct16
+    = Struct16 {unwrapStruct16 :: (Ptr Struct16_struct)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr Struct16_struct) =>
+         HasField "unwrapStruct16" Struct16 ty
+    where hasField = \x_0 -> (\y_1 -> Struct16{unwrapStruct16 = y_1},
+                              getField @"unwrapStruct16" x_0)
+instance (~) ty (Ptr Struct16_struct) =>
+         HasField "unwrapStruct16" (Ptr Struct16) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapStruct16")
+instance HasCField Struct16 "unwrapStruct16"
+    where type CFieldType Struct16
+                          "unwrapStruct16" = Ptr Struct16_struct
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct use_sites_qual@
+
+    __defined at:__ @program-analysis\/typedef_analysis.h 195:8@
+
+    __exported by:__ @program-analysis\/typedef_analysis.h@
+-}
+data Use_sites_qual
+    = Use_sites_qual {use_sites_qual_useTypedef_struct15 :: Struct15
+                      {- ^ __C declaration:__ @useTypedef_struct15@
+
+                           __defined at:__ @program-analysis\/typedef_analysis.h 197:12@
+
+                           __exported by:__ @program-analysis\/typedef_analysis.h@
+                      -},
+                      use_sites_qual_useStruct_struct16 :: Struct16_struct
+                      {- ^ __C declaration:__ @useStruct_struct16@
+
+                           __defined at:__ @program-analysis\/typedef_analysis.h 200:19@
+
+                           __exported by:__ @program-analysis\/typedef_analysis.h@
+                      -},
+                      use_sites_qual_useTypedef_struct16 :: Struct16
+                      {- ^ __C declaration:__ @useTypedef_struct16@
+
+                           __defined at:__ @program-analysis\/typedef_analysis.h 201:12@
+
+                           __exported by:__ @program-analysis\/typedef_analysis.h@
+                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Use_sites_qual
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Use_sites_qual
+    where readRaw = \ptr_0 -> ((pure Use_sites_qual <*> readRaw (Proxy @"use_sites_qual_useTypedef_struct15") ptr_0) <*> readRaw (Proxy @"use_sites_qual_useStruct_struct16") ptr_0) <*> readRaw (Proxy @"use_sites_qual_useTypedef_struct16") ptr_0
+instance WriteRaw Use_sites_qual
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Use_sites_qual use_sites_qual_useTypedef_struct15_2
+                                                      use_sites_qual_useStruct_struct16_3
+                                                      use_sites_qual_useTypedef_struct16_4 -> writeRaw (Proxy @"use_sites_qual_useTypedef_struct15") ptr_0 use_sites_qual_useTypedef_struct15_2 >> (writeRaw (Proxy @"use_sites_qual_useStruct_struct16") ptr_0 use_sites_qual_useStruct_struct16_3 >> writeRaw (Proxy @"use_sites_qual_useTypedef_struct16") ptr_0 use_sites_qual_useTypedef_struct16_4)
+deriving via (EquivStorable Use_sites_qual) instance Storable Use_sites_qual
+deriving via (IsStructViaReadRaw Use_sites_qual) instance IsStruct Use_sites_qual
+instance (~) ty Struct15 =>
+         HasField "use_sites_qual_useTypedef_struct15" Use_sites_qual ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites_qual{use_sites_qual_useTypedef_struct15 = y_1,
+                                                     use_sites_qual_useStruct_struct16 = getField @"use_sites_qual_useStruct_struct16" x_0,
+                                                     use_sites_qual_useTypedef_struct16 = getField @"use_sites_qual_useTypedef_struct16" x_0},
+                              getField @"use_sites_qual_useTypedef_struct15" x_0)
+instance (~) ty Struct15 =>
+         HasField "use_sites_qual_useTypedef_struct15"
+                  (Ptr Use_sites_qual)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_qual_useTypedef_struct15")
+instance HasCField Use_sites_qual
+                   "use_sites_qual_useTypedef_struct15"
+    where type CFieldType Use_sites_qual
+                          "use_sites_qual_useTypedef_struct15" = Struct15
+          offset# = \_ -> \_ -> 0
+instance (~) ty Struct16_struct =>
+         HasField "use_sites_qual_useStruct_struct16" Use_sites_qual ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites_qual{use_sites_qual_useStruct_struct16 = y_1,
+                                                     use_sites_qual_useTypedef_struct15 = getField @"use_sites_qual_useTypedef_struct15" x_0,
+                                                     use_sites_qual_useTypedef_struct16 = getField @"use_sites_qual_useTypedef_struct16" x_0},
+                              getField @"use_sites_qual_useStruct_struct16" x_0)
+instance (~) ty Struct16_struct =>
+         HasField "use_sites_qual_useStruct_struct16"
+                  (Ptr Use_sites_qual)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_qual_useStruct_struct16")
+instance HasCField Use_sites_qual
+                   "use_sites_qual_useStruct_struct16"
+    where type CFieldType Use_sites_qual
+                          "use_sites_qual_useStruct_struct16" = Struct16_struct
+          offset# = \_ -> \_ -> 0
+instance (~) ty Struct16 =>
+         HasField "use_sites_qual_useTypedef_struct16" Use_sites_qual ty
+    where hasField = \x_0 -> (\y_1 -> Use_sites_qual{use_sites_qual_useTypedef_struct16 = y_1,
+                                                     use_sites_qual_useTypedef_struct15 = getField @"use_sites_qual_useTypedef_struct15" x_0,
+                                                     use_sites_qual_useStruct_struct16 = getField @"use_sites_qual_useStruct_struct16" x_0},
+                              getField @"use_sites_qual_useTypedef_struct16" x_0)
+instance (~) ty Struct16 =>
+         HasField "use_sites_qual_useTypedef_struct16"
+                  (Ptr Use_sites_qual)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"use_sites_qual_useTypedef_struct16")
+instance HasCField Use_sites_qual
+                   "use_sites_qual_useTypedef_struct16"
+    where type CFieldType Use_sites_qual
+                          "use_sites_qual_useTypedef_struct16" = Struct16
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/typedef_block/Example.hs b/test-artefacts/fixtures/program-analysis/typedef_block/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_block/Example.hs
@@ -0,0 +1,306 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Blk_struct(..)
+    , Example.Blk_Aux(..)
+    , Example.Blk(..)
+    , Example.Blkarg_struct(..)
+    , Example.Blkarg_Aux(..)
+    , Example.Blkarg(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.Block as Block
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, IO, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct blk@
+
+    __defined at:__ @program-analysis\/typedef_block.h 13:8@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+data Blk_struct = Blk_struct
+  { blk_struct_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @program-analysis\/typedef_block.h 13:18@
+
+         __exported by:__ @program-analysis\/typedef_block.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Blk_struct where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Blk_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Blk_struct
+      <*> HasCField.readRaw (BG.Proxy @"blk_struct_x") ptr0
+
+instance Marshal.WriteRaw Blk_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Blk_struct blk_struct_x2 ->
+            HasCField.writeRaw (BG.Proxy @"blk_struct_x") ptr0 blk_struct_x2
+
+deriving via Marshal.EquivStorable Blk_struct instance BG.Storable Blk_struct
+
+deriving via Struct.IsStructViaReadRaw Blk_struct instance Struct.IsStruct Blk_struct
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @program-analysis\/typedef_block.h 13:18@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "blk_struct_x" Blk_struct ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Blk_struct {blk_struct_x = y1}, BG.getField @"blk_struct_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "blk_struct_x" (BG.Ptr Blk_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"blk_struct_x")
+
+instance HasCField.HasCField Blk_struct "blk_struct_x" where
+
+  type CFieldType Blk_struct "blk_struct_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Blk'
+
+    __C declaration:__ @blk@
+
+    __defined at:__ @program-analysis\/typedef_block.h 14:22@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+newtype Blk_Aux = Blk_Aux
+  { unwrapBlk_Aux :: IO Blk_struct
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ IO Blk_struct
+         ) => BG.CompatHasField.HasField "unwrapBlk_Aux" Blk_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Blk_Aux {unwrapBlk_Aux = y1}, BG.getField @"unwrapBlk_Aux" x0)
+
+instance ( ty ~ IO Blk_struct
+         ) => BG.HasField "unwrapBlk_Aux" (BG.Ptr Blk_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBlk_Aux")
+
+instance HasCField.HasCField Blk_Aux "unwrapBlk_Aux" where
+
+  type CFieldType Blk_Aux "unwrapBlk_Aux" =
+    IO Blk_struct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @blk@
+
+    __defined at:__ @program-analysis\/typedef_block.h 14:22@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+newtype Blk = Blk
+  { unwrapBlk :: Block.Block Blk_Aux
+  }
+  deriving stock (BG.Generic)
+  deriving newtype (BG.HasFFIType)
+
+instance ( ty ~ Block.Block Blk_Aux
+         ) => BG.CompatHasField.HasField "unwrapBlk" Blk ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Blk {unwrapBlk = y1}, BG.getField @"unwrapBlk" x0)
+
+instance ( ty ~ Block.Block Blk_Aux
+         ) => BG.HasField "unwrapBlk" (BG.Ptr Blk) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapBlk")
+
+instance HasCField.HasCField Blk "unwrapBlk" where
+
+  type CFieldType Blk "unwrapBlk" = Block.Block Blk_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct blkarg@
+
+    __defined at:__ @program-analysis\/typedef_block.h 17:8@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+data Blkarg_struct = Blkarg_struct
+  { blkarg_struct_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @program-analysis\/typedef_block.h 17:21@
+
+         __exported by:__ @program-analysis\/typedef_block.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Blkarg_struct where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Blkarg_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Blkarg_struct
+      <*> HasCField.readRaw (BG.Proxy @"blkarg_struct_y") ptr0
+
+instance Marshal.WriteRaw Blkarg_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Blkarg_struct blkarg_struct_y2 ->
+            HasCField.writeRaw (BG.Proxy @"blkarg_struct_y") ptr0 blkarg_struct_y2
+
+deriving via Marshal.EquivStorable Blkarg_struct instance BG.Storable Blkarg_struct
+
+deriving via Struct.IsStructViaReadRaw Blkarg_struct instance Struct.IsStruct Blkarg_struct
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @program-analysis\/typedef_block.h 17:21@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "blkarg_struct_y" Blkarg_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Blkarg_struct {blkarg_struct_y = y1}
+      , BG.getField @"blkarg_struct_y" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "blkarg_struct_y" (BG.Ptr Blkarg_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"blkarg_struct_y")
+
+instance HasCField.HasCField Blkarg_struct "blkarg_struct_y" where
+
+  type CFieldType Blkarg_struct "blkarg_struct_y" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'Blkarg'
+
+    __C declaration:__ @blkarg@
+
+    __defined at:__ @program-analysis\/typedef_block.h 18:15@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+newtype Blkarg_Aux = Blkarg_Aux
+  { unwrapBlkarg_Aux :: Blkarg_struct -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+instance ( ty ~ (Blkarg_struct -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapBlkarg_Aux" Blkarg_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Blkarg_Aux {unwrapBlkarg_Aux = y1}
+      , BG.getField @"unwrapBlkarg_Aux" x0
+      )
+
+instance ( ty ~ (Blkarg_struct -> IO BG.CInt)
+         ) => BG.HasField "unwrapBlkarg_Aux" (BG.Ptr Blkarg_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBlkarg_Aux")
+
+instance HasCField.HasCField Blkarg_Aux "unwrapBlkarg_Aux" where
+
+  type CFieldType Blkarg_Aux "unwrapBlkarg_Aux" =
+    Blkarg_struct -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @blkarg@
+
+    __defined at:__ @program-analysis\/typedef_block.h 18:15@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+newtype Blkarg = Blkarg
+  { unwrapBlkarg :: Block.Block Blkarg_Aux
+  }
+  deriving stock (BG.Generic)
+  deriving newtype (BG.HasFFIType)
+
+instance ( ty ~ Block.Block Blkarg_Aux
+         ) => BG.CompatHasField.HasField "unwrapBlkarg" Blkarg ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Blkarg {unwrapBlkarg = y1}, BG.getField @"unwrapBlkarg" x0)
+
+instance ( ty ~ Block.Block Blkarg_Aux
+         ) => BG.HasField "unwrapBlkarg" (BG.Ptr Blkarg) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBlkarg")
+
+instance HasCField.HasCField Blkarg "unwrapBlkarg" where
+
+  type CFieldType Blkarg "unwrapBlkarg" =
+    Block.Block Blkarg_Aux
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/typedef_block/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/typedef_block/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_block/bindingspec.yaml
@@ -0,0 +1,88 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/typedef_block.h
+  cname: struct blk
+  hsname: Blk_struct
+- headers: program-analysis/typedef_block.h
+  cname: blk
+  hsname: Blk
+- headers: program-analysis/typedef_block.h
+  cname: struct blkarg
+  hsname: Blkarg_struct
+- headers: program-analysis/typedef_block.h
+  cname: blkarg
+  hsname: Blkarg
+hstypes:
+- hsname: Blk
+  representation:
+    newtype:
+      constructor: Blk
+      fields:
+      - unwrapBlk
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Blk_struct
+  representation:
+    record:
+      constructor: Blk_struct
+      fields:
+      - blk_struct_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Blkarg
+  representation:
+    newtype:
+      constructor: Blkarg
+      fields:
+      - unwrapBlkarg
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: Blkarg_struct
+  representation:
+    record:
+      constructor: Blkarg_struct
+      fields:
+      - blkarg_struct_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/program-analysis/typedef_block/th.txt b/test-artefacts/fixtures/program-analysis/typedef_block/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_block/th.txt
@@ -0,0 +1,151 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/typedef_block.h
+{-| __C declaration:__ @struct blk@
+
+    __defined at:__ @program-analysis\/typedef_block.h 13:8@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+data Blk_struct
+    = Blk_struct {blk_struct_x :: CInt
+                  {- ^ __C declaration:__ @x@
+
+                       __defined at:__ @program-analysis\/typedef_block.h 13:18@
+
+                       __exported by:__ @program-analysis\/typedef_block.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Blk_struct
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Blk_struct
+    where readRaw = \ptr_0 -> pure Blk_struct <*> readRaw (Proxy @"blk_struct_x") ptr_0
+instance WriteRaw Blk_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Blk_struct blk_struct_x_2 -> writeRaw (Proxy @"blk_struct_x") ptr_0 blk_struct_x_2
+deriving via (EquivStorable Blk_struct) instance Storable Blk_struct
+deriving via (IsStructViaReadRaw Blk_struct) instance IsStruct Blk_struct
+instance (~) ty CInt => HasField "blk_struct_x" Blk_struct ty
+    where hasField = \x_0 -> (\y_1 -> Blk_struct{blk_struct_x = y_1},
+                              getField @"blk_struct_x" x_0)
+instance (~) ty CInt =>
+         HasField "blk_struct_x" (Ptr Blk_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"blk_struct_x")
+instance HasCField Blk_struct "blk_struct_x"
+    where type CFieldType Blk_struct "blk_struct_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Blk'
+
+    __C declaration:__ @blk@
+
+    __defined at:__ @program-analysis\/typedef_block.h 14:22@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+newtype Blk_Aux
+    = Blk_Aux {unwrapBlk_Aux :: (IO Blk_struct)}
+    deriving stock Generic
+instance (~) ty (IO Blk_struct) =>
+         HasField "unwrapBlk_Aux" Blk_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Blk_Aux{unwrapBlk_Aux = y_1},
+                              getField @"unwrapBlk_Aux" x_0)
+instance (~) ty (IO Blk_struct) =>
+         HasField "unwrapBlk_Aux" (Ptr Blk_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBlk_Aux")
+instance HasCField Blk_Aux "unwrapBlk_Aux"
+    where type CFieldType Blk_Aux "unwrapBlk_Aux" = IO Blk_struct
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @blk@
+
+    __defined at:__ @program-analysis\/typedef_block.h 14:22@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+newtype Blk
+    = Blk {unwrapBlk :: (Block Blk_Aux)}
+    deriving stock Generic
+    deriving newtype HasFFIType
+instance (~) ty (Block Blk_Aux) => HasField "unwrapBlk" Blk ty
+    where hasField = \x_0 -> (\y_1 -> Blk{unwrapBlk = y_1},
+                              getField @"unwrapBlk" x_0)
+instance (~) ty (Block Blk_Aux) =>
+         HasField "unwrapBlk" (Ptr Blk) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBlk")
+instance HasCField Blk "unwrapBlk"
+    where type CFieldType Blk "unwrapBlk" = Block Blk_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct blkarg@
+
+    __defined at:__ @program-analysis\/typedef_block.h 17:8@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+data Blkarg_struct
+    = Blkarg_struct {blkarg_struct_y :: CInt
+                     {- ^ __C declaration:__ @y@
+
+                          __defined at:__ @program-analysis\/typedef_block.h 17:21@
+
+                          __exported by:__ @program-analysis\/typedef_block.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Blkarg_struct
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Blkarg_struct
+    where readRaw = \ptr_0 -> pure Blkarg_struct <*> readRaw (Proxy @"blkarg_struct_y") ptr_0
+instance WriteRaw Blkarg_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Blkarg_struct blkarg_struct_y_2 -> writeRaw (Proxy @"blkarg_struct_y") ptr_0 blkarg_struct_y_2
+deriving via (EquivStorable Blkarg_struct) instance Storable Blkarg_struct
+deriving via (IsStructViaReadRaw Blkarg_struct) instance IsStruct Blkarg_struct
+instance (~) ty CInt => HasField "blkarg_struct_y" Blkarg_struct ty
+    where hasField = \x_0 -> (\y_1 -> Blkarg_struct{blkarg_struct_y = y_1},
+                              getField @"blkarg_struct_y" x_0)
+instance (~) ty CInt =>
+         HasField "blkarg_struct_y" (Ptr Blkarg_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"blkarg_struct_y")
+instance HasCField Blkarg_struct "blkarg_struct_y"
+    where type CFieldType Blkarg_struct "blkarg_struct_y" = CInt
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'Blkarg'
+
+    __C declaration:__ @blkarg@
+
+    __defined at:__ @program-analysis\/typedef_block.h 18:15@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+newtype Blkarg_Aux
+    = Blkarg_Aux {unwrapBlkarg_Aux :: (Blkarg_struct -> IO CInt)}
+    deriving stock Generic
+instance (~) ty (Blkarg_struct -> IO CInt) =>
+         HasField "unwrapBlkarg_Aux" Blkarg_Aux ty
+    where hasField = \x_0 -> (\y_1 -> Blkarg_Aux{unwrapBlkarg_Aux = y_1},
+                              getField @"unwrapBlkarg_Aux" x_0)
+instance (~) ty (Blkarg_struct -> IO CInt) =>
+         HasField "unwrapBlkarg_Aux" (Ptr Blkarg_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBlkarg_Aux")
+instance HasCField Blkarg_Aux "unwrapBlkarg_Aux"
+    where type CFieldType Blkarg_Aux
+                          "unwrapBlkarg_Aux" = Blkarg_struct -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @blkarg@
+
+    __defined at:__ @program-analysis\/typedef_block.h 18:15@
+
+    __exported by:__ @program-analysis\/typedef_block.h@
+-}
+newtype Blkarg
+    = Blkarg {unwrapBlkarg :: (Block Blkarg_Aux)}
+    deriving stock Generic
+    deriving newtype HasFFIType
+instance (~) ty (Block Blkarg_Aux) =>
+         HasField "unwrapBlkarg" Blkarg ty
+    where hasField = \x_0 -> (\y_1 -> Blkarg{unwrapBlkarg = y_1},
+                              getField @"unwrapBlkarg" x_0)
+instance (~) ty (Block Blkarg_Aux) =>
+         HasField "unwrapBlkarg" (Ptr Blkarg) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBlkarg")
+instance HasCField Blkarg "unwrapBlkarg"
+    where type CFieldType Blkarg "unwrapBlkarg" = Block Blkarg_Aux
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/program-analysis/typedef_name_clash/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/typedef_name_clash/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_name_clash/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/program-analysis/typedef_name_clash/th.txt b/test-artefacts/fixtures/program-analysis/typedef_name_clash/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_name_clash/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/typedef_name_clash.h
diff --git a/test-artefacts/fixtures/program-analysis/typedef_suffix_clash/bindingspec.yaml b/test-artefacts/fixtures/program-analysis/typedef_suffix_clash/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_suffix_clash/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/program-analysis/typedef_suffix_clash/th.txt b/test-artefacts/fixtures/program-analysis/typedef_suffix_clash/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/program-analysis/typedef_suffix_clash/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/program-analysis/typedef_suffix_clash.h
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/anon_in_nonanon/Example.hs b/test-artefacts/fixtures/types/anonymous/edge-cases/anon_in_nonanon/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/anon_in_nonanon/Example.hs
@@ -0,0 +1,267 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S_y_anon'x(..)
+    , Example.S_y(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@S_y_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 15:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+data S_y_anon'x = S_y_anon'x
+  { s_y_anon'x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 16:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_y_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_y_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_y_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_y_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_y_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_y_anon'x s_y_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_y_anon'x_x") ptr0 s_y_anon'x_x2
+
+deriving via Marshal.EquivStorable S_y_anon'x instance BG.Storable S_y_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_y_anon'x instance Struct.IsStruct S_y_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 16:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s_y_anon'x_x" S_y_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_y_anon'x {s_y_anon'x_x = y1}, BG.getField @"s_y_anon'x_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s_y_anon'x_x" (BG.Ptr S_y_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_y_anon'x_x")
+
+instance HasCField.HasCField S_y_anon'x "s_y_anon'x_x" where
+
+  type CFieldType S_y_anon'x "s_y_anon'x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 14:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+data S_y = S_y
+  { s_y_anon'x :: S_y_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 15:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_y where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_y where
+
+  readRaw =
+    \ptr0 ->
+          pure S_y
+      <*> HasCField.readRaw (BG.Proxy @"s_y_anon'x") ptr0
+
+instance Marshal.WriteRaw S_y where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_y s_y_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_y_anon'x") ptr0 s_y_anon'x2
+
+deriving via Marshal.EquivStorable S_y instance BG.Storable S_y
+
+deriving via Struct.IsStructViaReadRaw S_y instance Struct.IsStruct S_y
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 15:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+instance ( ty ~ S_y_anon'x
+         ) => BG.CompatHasField.HasField "s_y_anon'x" S_y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_y {s_y_anon'x = y1}, BG.getField @"s_y_anon'x" x0)
+
+instance ( ty ~ S_y_anon'x
+         ) => BG.HasField "s_y_anon'x" (BG.Ptr S_y) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_y_anon'x")
+
+instance HasCField.HasCField S_y "s_y_anon'x" where
+
+  type CFieldType S_y "s_y_anon'x" = S_y_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 16:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "s_y_x" S_y ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_y_anon'x_x" (BG.getField @"s_y_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 16:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_y_x" S_y ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_y_anon'x" x0 (\z2 ->
+                                                            BG.CompatHasField.setField @"s_y_anon'x_x" z2 y1)
+      , BG.getField @"s_y_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s_y_x" (BG.Ptr S_y) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_y_x")
+
+instance HasCField.HasCField S_y "s_y_x" where
+
+  type CFieldType S_y "s_y_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 13:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+data S = S
+  { s_y :: S_y
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 18:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_y") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_y2 ->
+            HasCField.writeRaw (BG.Proxy @"s_y") ptr0 s_y2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 18:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+instance (ty ~ S_y) => BG.CompatHasField.HasField "s_y" S ty where
+
+  hasField =
+    \x0 -> (\y1 -> S {s_y = y1}, BG.getField @"s_y" x0)
+
+instance (ty ~ S_y) => BG.HasField "s_y" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_y")
+
+instance HasCField.HasCField S "s_y" where
+
+  type CFieldType S "s_y" = S_y
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/anon_in_nonanon/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/anon_in_nonanon/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/anon_in_nonanon/bindingspec.yaml
@@ -0,0 +1,72 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/edge-cases/anon_in_nonanon.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/edge-cases/anon_in_nonanon.h
+  cname: struct @S_y
+  hsname: S_y
+- headers: types/anonymous/edge-cases/anon_in_nonanon.h
+  cname: struct @S_y_anon'x
+  hsname: S_y_anon'x
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_y
+  representation:
+    record:
+      constructor: S_y
+      fields:
+      - s_y_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_y_anon'x
+  representation:
+    record:
+      constructor: S_y_anon'x
+      fields:
+      - s_y_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/anon_in_nonanon/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/anon_in_nonanon/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/anon_in_nonanon/th.txt
@@ -0,0 +1,112 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/anon_in_nonanon.h
+{-| __C declaration:__ @struct \@S_y_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 15:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+data S_y_anon'x
+    = S_y_anon'x {s_y_anon'x_x :: CInt
+                  {- ^ __C declaration:__ @x@
+
+                       __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 16:11@
+
+                       __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_y_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_y_anon'x
+    where readRaw = \ptr_0 -> pure S_y_anon'x <*> readRaw (Proxy @"s_y_anon'x_x") ptr_0
+instance WriteRaw S_y_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_y_anon'x s_y_anon'x_x_2 -> writeRaw (Proxy @"s_y_anon'x_x") ptr_0 s_y_anon'x_x_2
+deriving via (EquivStorable S_y_anon'x) instance Storable S_y_anon'x
+deriving via (IsStructViaReadRaw S_y_anon'x) instance IsStruct S_y_anon'x
+instance (~) ty CInt => HasField "s_y_anon'x_x" S_y_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_y_anon'x{s_y_anon'x_x = y_1},
+                              getField @"s_y_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "s_y_anon'x_x" (Ptr S_y_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y_anon'x_x")
+instance HasCField S_y_anon'x "s_y_anon'x_x"
+    where type CFieldType S_y_anon'x "s_y_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 14:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+data S_y
+    = S_y {s_y_anon'x :: S_y_anon'x
+           {- ^ __C declaration:__ @anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 15:5@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_y
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_y
+    where readRaw = \ptr_0 -> pure S_y <*> readRaw (Proxy @"s_y_anon'x") ptr_0
+instance WriteRaw S_y
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_y s_y_anon'x_2 -> writeRaw (Proxy @"s_y_anon'x") ptr_0 s_y_anon'x_2
+deriving via (EquivStorable S_y) instance Storable S_y
+deriving via (IsStructViaReadRaw S_y) instance IsStruct S_y
+instance (~) ty S_y_anon'x => HasField "s_y_anon'x" S_y ty
+    where hasField = \x_0 -> (\y_1 -> S_y{s_y_anon'x = y_1},
+                              getField @"s_y_anon'x" x_0)
+instance (~) ty S_y_anon'x =>
+         HasField "s_y_anon'x" (Ptr S_y) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y_anon'x")
+instance HasCField S_y "s_y_anon'x"
+    where type CFieldType S_y "s_y_anon'x" = S_y_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s_y_x" S_y ty
+    where getField = \x_0 -> getField @"s_y_anon'x_x" (getField @"s_y_anon'x" x_0)
+instance (~) ty CInt => HasField "s_y_x" S_y ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_y_anon'x" x_0 (\z_2 -> setField @"s_y_anon'x_x" z_2 y_1),
+                              getField @"s_y_x" x_0)
+instance (~) ty CInt => HasField "s_y_x" (Ptr S_y) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y_x")
+instance HasCField S_y "s_y_x"
+    where type CFieldType S_y "s_y_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 13:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+-}
+data S
+    = S {s_y :: S_y
+         {- ^ __C declaration:__ @y@
+
+              __defined at:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h 18:5@
+
+              __exported by:__ @types\/anonymous\/edge-cases\/anon_in_nonanon.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_y") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_y_2 -> writeRaw (Proxy @"s_y") ptr_0 s_y_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_y => HasField "s_y" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_y = y_1},
+                              getField @"s_y" x_0)
+instance (~) ty S_y => HasField "s_y" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y")
+instance HasCField S "s_y"
+    where type CFieldType S "s_y" = S_y
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/bitfield/Example.hs b/test-artefacts/fixtures/types/anonymous/edge-cases/bitfield/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/bitfield/Example.hs
@@ -0,0 +1,620 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S1_anon'y(..)
+    , Example.S1(..)
+    , Example.S2_anon'anon'y_anon'y(..)
+    , Example.S2_anon'anon'y(..)
+    , Example.S2(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.BitfieldPtr as BitfieldPtr
+import qualified HsBindgen.Runtime.HasCBitfield as HasCBitfield
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@S1_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 13:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S1_anon'y = S1_anon'y
+  { s1_anon'y_y :: BG.CChar
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 14:10@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S1_anon'y where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw S1_anon'y where
+
+  readRaw =
+    \ptr0 ->
+          pure S1_anon'y
+      <*> HasCBitfield.peek (BG.Proxy @"s1_anon'y_y") ptr0
+
+instance Marshal.WriteRaw S1_anon'y where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S1_anon'y s1_anon'y_y2 ->
+            HasCBitfield.poke (BG.Proxy @"s1_anon'y_y") ptr0 s1_anon'y_y2
+
+deriving via Marshal.EquivStorable S1_anon'y instance BG.Storable S1_anon'y
+
+deriving via Struct.IsStructViaReadRaw S1_anon'y instance Struct.IsStruct S1_anon'y
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 14:10@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "s1_anon'y_y" S1_anon'y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S1_anon'y {s1_anon'y_y = y1}, BG.getField @"s1_anon'y_y" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "s1_anon'y_y" (BG.Ptr S1_anon'y) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"s1_anon'y_y")
+
+instance HasCBitfield.HasCBitfield S1_anon'y "s1_anon'y_y" where
+
+  type CBitfieldType S1_anon'y "s1_anon'y_y" = BG.CChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 12:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S1 = S1
+  { s1_anon'y :: S1_anon'y
+    {- ^ __C declaration:__ @anon\'y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 13:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+    -}
+  , s1_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 16:7@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S1 where
+
+  readRaw =
+    \ptr0 ->
+          pure S1
+      <*> HasCField.readRaw (BG.Proxy @"s1_anon'y") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s1_x") ptr0
+
+instance Marshal.WriteRaw S1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S1 s1_anon'y2 s1_x3 ->
+               HasCField.writeRaw (BG.Proxy @"s1_anon'y") ptr0 s1_anon'y2
+            >> HasCField.writeRaw (BG.Proxy @"s1_x") ptr0 s1_x3
+
+deriving via Marshal.EquivStorable S1 instance BG.Storable S1
+
+deriving via Struct.IsStructViaReadRaw S1 instance Struct.IsStruct S1
+
+{-| __C declaration:__ @anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 13:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance (ty ~ S1_anon'y) => BG.CompatHasField.HasField "s1_anon'y" S1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1 {s1_anon'y = y1, s1_x = BG.getField @"s1_x" x0}
+      , BG.getField @"s1_anon'y" x0
+      )
+
+instance ( ty ~ S1_anon'y
+         ) => BG.HasField "s1_anon'y" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_anon'y")
+
+instance HasCField.HasCField S1 "s1_anon'y" where
+
+  type CFieldType S1 "s1_anon'y" = S1_anon'y
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 14:10@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "s1_y" S1 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s1_anon'y_y" (BG.getField @"s1_anon'y" x0)
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 14:10@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s1_y" S1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s1_anon'y" x0 (\z2 ->
+                                                           BG.CompatHasField.setField @"s1_anon'y_y" z2 y1)
+      , BG.getField @"s1_y" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s1_y" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_y")
+
+instance HasCField.HasCField S1 "s1_y" where
+
+  type CFieldType S1 "s1_y" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 16:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s1_x" S1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1 {s1_x = y1, s1_anon'y = BG.getField @"s1_anon'y" x0}
+      , BG.getField @"s1_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s1_x" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_x")
+
+instance HasCField.HasCField S1 "s1_x" where
+
+  type CFieldType S1 "s1_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@S2_anon\'anon\'y_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 21:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S2_anon'anon'y_anon'y = S2_anon'anon'y_anon'y
+  { s2_anon'anon'y_anon'y_y :: BG.CChar
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 22:12@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2_anon'anon'y_anon'y where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw S2_anon'anon'y_anon'y where
+
+  readRaw =
+    \ptr0 ->
+          pure S2_anon'anon'y_anon'y
+      <*> HasCBitfield.peek (BG.Proxy @"s2_anon'anon'y_anon'y_y") ptr0
+
+instance Marshal.WriteRaw S2_anon'anon'y_anon'y where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2_anon'anon'y_anon'y s2_anon'anon'y_anon'y_y2 ->
+            HasCBitfield.poke (BG.Proxy @"s2_anon'anon'y_anon'y_y") ptr0 s2_anon'anon'y_anon'y_y2
+
+deriving via Marshal.EquivStorable S2_anon'anon'y_anon'y instance BG.Storable S2_anon'anon'y_anon'y
+
+deriving via Struct.IsStructViaReadRaw S2_anon'anon'y_anon'y instance Struct.IsStruct S2_anon'anon'y_anon'y
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 22:12@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "s2_anon'anon'y_anon'y_y" S2_anon'anon'y_anon'y ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_anon'anon'y_anon'y {s2_anon'anon'y_anon'y_y = y1}
+      , BG.getField @"s2_anon'anon'y_anon'y_y" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "s2_anon'anon'y_anon'y_y" (BG.Ptr S2_anon'anon'y_anon'y) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"s2_anon'anon'y_anon'y_y")
+
+instance HasCBitfield.HasCBitfield S2_anon'anon'y_anon'y "s2_anon'anon'y_anon'y_y" where
+
+  type CBitfieldType S2_anon'anon'y_anon'y "s2_anon'anon'y_anon'y_y" =
+    BG.CChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @struct \@S2_anon\'anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 20:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S2_anon'anon'y = S2_anon'anon'y
+  { s2_anon'anon'y_anon'y :: S2_anon'anon'y_anon'y
+    {- ^ __C declaration:__ @anon\'y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 21:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+    -}
+  , s2_anon'anon'y_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 24:9@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2_anon'anon'y where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S2_anon'anon'y where
+
+  readRaw =
+    \ptr0 ->
+          pure S2_anon'anon'y
+      <*> HasCField.readRaw (BG.Proxy @"s2_anon'anon'y_anon'y") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s2_anon'anon'y_x") ptr0
+
+instance Marshal.WriteRaw S2_anon'anon'y where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2_anon'anon'y s2_anon'anon'y_anon'y2 s2_anon'anon'y_x3 ->
+               HasCField.writeRaw (BG.Proxy @"s2_anon'anon'y_anon'y") ptr0 s2_anon'anon'y_anon'y2
+            >> HasCField.writeRaw (BG.Proxy @"s2_anon'anon'y_x") ptr0 s2_anon'anon'y_x3
+
+deriving via Marshal.EquivStorable S2_anon'anon'y instance BG.Storable S2_anon'anon'y
+
+deriving via Struct.IsStructViaReadRaw S2_anon'anon'y instance Struct.IsStruct S2_anon'anon'y
+
+{-| __C declaration:__ @anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 21:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance ( ty ~ S2_anon'anon'y_anon'y
+         ) => BG.CompatHasField.HasField "s2_anon'anon'y_anon'y" S2_anon'anon'y ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_anon'anon'y { s2_anon'anon'y_anon'y = y1
+                         , s2_anon'anon'y_x = BG.getField @"s2_anon'anon'y_x" x0
+                         }
+      , BG.getField @"s2_anon'anon'y_anon'y" x0
+      )
+
+instance ( ty ~ S2_anon'anon'y_anon'y
+         ) => BG.HasField "s2_anon'anon'y_anon'y" (BG.Ptr S2_anon'anon'y) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s2_anon'anon'y_anon'y")
+
+instance HasCField.HasCField S2_anon'anon'y "s2_anon'anon'y_anon'y" where
+
+  type CFieldType S2_anon'anon'y "s2_anon'anon'y_anon'y" =
+    S2_anon'anon'y_anon'y
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 22:12@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "s2_anon'anon'y_y" S2_anon'anon'y ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s2_anon'anon'y_anon'y_y" (BG.getField @"s2_anon'anon'y_anon'y" x0)
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 22:12@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "s2_anon'anon'y_y" S2_anon'anon'y ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s2_anon'anon'y_anon'y" x0 (\z2 ->
+                                                                       BG.CompatHasField.setField @"s2_anon'anon'y_anon'y_y" z2 y1)
+      , BG.getField @"s2_anon'anon'y_y" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "s2_anon'anon'y_y" (BG.Ptr S2_anon'anon'y) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s2_anon'anon'y_y")
+
+instance HasCField.HasCField S2_anon'anon'y "s2_anon'anon'y_y" where
+
+  type CFieldType S2_anon'anon'y "s2_anon'anon'y_y" =
+    BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 24:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s2_anon'anon'y_x" S2_anon'anon'y ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_anon'anon'y { s2_anon'anon'y_x = y1
+                         , s2_anon'anon'y_anon'y = BG.getField @"s2_anon'anon'y_anon'y" x0
+                         }
+      , BG.getField @"s2_anon'anon'y_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s2_anon'anon'y_x" (BG.Ptr S2_anon'anon'y) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s2_anon'anon'y_x")
+
+instance HasCField.HasCField S2_anon'anon'y "s2_anon'anon'y_x" where
+
+  type CFieldType S2_anon'anon'y "s2_anon'anon'y_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 19:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S2 = S2
+  { s2_anon'anon'y :: S2_anon'anon'y
+    {- ^ __C declaration:__ @anon\'anon\'y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 20:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S2 where
+
+  readRaw =
+    \ptr0 ->
+          pure S2
+      <*> HasCField.readRaw (BG.Proxy @"s2_anon'anon'y") ptr0
+
+instance Marshal.WriteRaw S2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2 s2_anon'anon'y2 ->
+            HasCField.writeRaw (BG.Proxy @"s2_anon'anon'y") ptr0 s2_anon'anon'y2
+
+deriving via Marshal.EquivStorable S2 instance BG.Storable S2
+
+deriving via Struct.IsStructViaReadRaw S2 instance Struct.IsStruct S2
+
+{-| __C declaration:__ @anon\'anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 20:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance ( ty ~ S2_anon'anon'y
+         ) => BG.CompatHasField.HasField "s2_anon'anon'y" S2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S2 {s2_anon'anon'y = y1}, BG.getField @"s2_anon'anon'y" x0)
+
+instance ( ty ~ S2_anon'anon'y
+         ) => BG.HasField "s2_anon'anon'y" (BG.Ptr S2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s2_anon'anon'y")
+
+instance HasCField.HasCField S2 "s2_anon'anon'y" where
+
+  type CFieldType S2 "s2_anon'anon'y" = S2_anon'anon'y
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 22:12@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "s2_y" S2 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s2_anon'anon'y_y" (BG.getField @"s2_anon'anon'y" x0)
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 22:12@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s2_y" S2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s2_anon'anon'y" x0 (\z2 ->
+                                                                BG.CompatHasField.setField @"s2_anon'anon'y_y" z2 y1)
+      , BG.getField @"s2_y" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s2_y" (BG.Ptr S2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_y")
+
+instance HasCField.HasCField S2 "s2_y" where
+
+  type CFieldType S2 "s2_y" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 24:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "s2_x" S2 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s2_anon'anon'y_x" (BG.getField @"s2_anon'anon'y" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 24:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s2_x" S2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s2_anon'anon'y" x0 (\z2 ->
+                                                                BG.CompatHasField.setField @"s2_anon'anon'y_x" z2 y1)
+      , BG.getField @"s2_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s2_x" (BG.Ptr S2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_x")
+
+instance HasCField.HasCField S2 "s2_x" where
+
+  type CFieldType S2 "s2_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/bitfield/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/bitfield/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/bitfield/bindingspec.yaml
@@ -0,0 +1,118 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/edge-cases/bitfield.h
+  cname: struct S1
+  hsname: S1
+- headers: types/anonymous/edge-cases/bitfield.h
+  cname: struct @S1_anon'y
+  hsname: S1_anon'y
+- headers: types/anonymous/edge-cases/bitfield.h
+  cname: struct S2
+  hsname: S2
+- headers: types/anonymous/edge-cases/bitfield.h
+  cname: struct @S2_anon'anon'y
+  hsname: S2_anon'anon'y
+- headers: types/anonymous/edge-cases/bitfield.h
+  cname: struct @S2_anon'anon'y_anon'y
+  hsname: S2_anon'anon'y_anon'y
+hstypes:
+- hsname: S1
+  representation:
+    record:
+      constructor: S1
+      fields:
+      - s1_anon'y
+      - s1_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S1_anon'y
+  representation:
+    record:
+      constructor: S1_anon'y
+      fields:
+      - s1_anon'y_y
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2
+  representation:
+    record:
+      constructor: S2
+      fields:
+      - s2_anon'anon'y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2_anon'anon'y
+  representation:
+    record:
+      constructor: S2_anon'anon'y
+      fields:
+      - s2_anon'anon'y_anon'y
+      - s2_anon'anon'y_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2_anon'anon'y_anon'y
+  representation:
+    record:
+      constructor: S2_anon'anon'y_anon'y
+      fields:
+      - s2_anon'anon'y_anon'y_y
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/bitfield/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/bitfield/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/bitfield/th.txt
@@ -0,0 +1,260 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/bitfield.h
+{-| __C declaration:__ @struct \@S1_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 13:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S1_anon'y
+    = S1_anon'y {s1_anon'y_y :: CChar
+                 {- ^ __C declaration:__ @y@
+
+                      __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 14:10@
+
+                      __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S1_anon'y
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw S1_anon'y
+    where readRaw = \ptr_0 -> pure S1_anon'y <*> peek (Proxy @"s1_anon'y_y") ptr_0
+instance WriteRaw S1_anon'y
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S1_anon'y s1_anon'y_y_2 -> poke (Proxy @"s1_anon'y_y") ptr_0 s1_anon'y_y_2
+deriving via (EquivStorable S1_anon'y) instance Storable S1_anon'y
+deriving via (IsStructViaReadRaw S1_anon'y) instance IsStruct S1_anon'y
+instance (~) ty CChar => HasField "s1_anon'y_y" S1_anon'y ty
+    where hasField = \x_0 -> (\y_1 -> S1_anon'y{s1_anon'y_y = y_1},
+                              getField @"s1_anon'y_y" x_0)
+instance (~) ty CChar =>
+         HasField "s1_anon'y_y" (Ptr S1_anon'y) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"s1_anon'y_y")
+instance HasCBitfield S1_anon'y "s1_anon'y_y"
+    where type CBitfieldType S1_anon'y "s1_anon'y_y" = CChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 12:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S1
+    = S1 {s1_anon'y :: S1_anon'y
+          {- ^ __C declaration:__ @anon\'y@
+
+               __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 13:3@
+
+               __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+          -},
+          s1_x :: CInt
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 16:7@
+
+               __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S1
+    where readRaw = \ptr_0 -> (pure S1 <*> readRaw (Proxy @"s1_anon'y") ptr_0) <*> readRaw (Proxy @"s1_x") ptr_0
+instance WriteRaw S1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S1 s1_anon'y_2
+                                          s1_x_3 -> writeRaw (Proxy @"s1_anon'y") ptr_0 s1_anon'y_2 >> writeRaw (Proxy @"s1_x") ptr_0 s1_x_3
+deriving via (EquivStorable S1) instance Storable S1
+deriving via (IsStructViaReadRaw S1) instance IsStruct S1
+instance (~) ty S1_anon'y => HasField "s1_anon'y" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{s1_anon'y = y_1,
+                                         s1_x = getField @"s1_x" x_0},
+                              getField @"s1_anon'y" x_0)
+instance (~) ty S1_anon'y => HasField "s1_anon'y" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_anon'y")
+instance HasCField S1 "s1_anon'y"
+    where type CFieldType S1 "s1_anon'y" = S1_anon'y
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar => HasField "s1_y" S1 ty
+    where getField = \x_0 -> getField @"s1_anon'y_y" (getField @"s1_anon'y" x_0)
+instance (~) ty CChar => HasField "s1_y" S1 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s1_anon'y" x_0 (\z_2 -> setField @"s1_anon'y_y" z_2 y_1),
+                              getField @"s1_y" x_0)
+instance (~) ty CChar => HasField "s1_y" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_y")
+instance HasCField S1 "s1_y"
+    where type CFieldType S1 "s1_y" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s1_x" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{s1_x = y_1,
+                                         s1_anon'y = getField @"s1_anon'y" x_0},
+                              getField @"s1_x" x_0)
+instance (~) ty CInt => HasField "s1_x" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_x")
+instance HasCField S1 "s1_x"
+    where type CFieldType S1 "s1_x" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@S2_anon\'anon\'y_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 21:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S2_anon'anon'y_anon'y
+    = S2_anon'anon'y_anon'y {s2_anon'anon'y_anon'y_y :: CChar
+                             {- ^ __C declaration:__ @y@
+
+                                  __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 22:12@
+
+                                  __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+                             -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2_anon'anon'y_anon'y
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw S2_anon'anon'y_anon'y
+    where readRaw = \ptr_0 -> pure S2_anon'anon'y_anon'y <*> peek (Proxy @"s2_anon'anon'y_anon'y_y") ptr_0
+instance WriteRaw S2_anon'anon'y_anon'y
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2_anon'anon'y_anon'y s2_anon'anon'y_anon'y_y_2 -> poke (Proxy @"s2_anon'anon'y_anon'y_y") ptr_0 s2_anon'anon'y_anon'y_y_2
+deriving via (EquivStorable S2_anon'anon'y_anon'y) instance Storable S2_anon'anon'y_anon'y
+deriving via (IsStructViaReadRaw S2_anon'anon'y_anon'y) instance IsStruct S2_anon'anon'y_anon'y
+instance (~) ty CChar =>
+         HasField "s2_anon'anon'y_anon'y_y" S2_anon'anon'y_anon'y ty
+    where hasField = \x_0 -> (\y_1 -> S2_anon'anon'y_anon'y{s2_anon'anon'y_anon'y_y = y_1},
+                              getField @"s2_anon'anon'y_anon'y_y" x_0)
+instance (~) ty CChar =>
+         HasField "s2_anon'anon'y_anon'y_y"
+                  (Ptr S2_anon'anon'y_anon'y)
+                  (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"s2_anon'anon'y_anon'y_y")
+instance HasCBitfield S2_anon'anon'y_anon'y
+                      "s2_anon'anon'y_anon'y_y"
+    where type CBitfieldType S2_anon'anon'y_anon'y
+                             "s2_anon'anon'y_anon'y_y" = CChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+{-| __C declaration:__ @struct \@S2_anon\'anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 20:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S2_anon'anon'y
+    = S2_anon'anon'y {s2_anon'anon'y_anon'y :: S2_anon'anon'y_anon'y
+                      {- ^ __C declaration:__ @anon\'y@
+
+                           __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 21:5@
+
+                           __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+                      -},
+                      s2_anon'anon'y_x :: CInt
+                      {- ^ __C declaration:__ @x@
+
+                           __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 24:9@
+
+                           __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2_anon'anon'y
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S2_anon'anon'y
+    where readRaw = \ptr_0 -> (pure S2_anon'anon'y <*> readRaw (Proxy @"s2_anon'anon'y_anon'y") ptr_0) <*> readRaw (Proxy @"s2_anon'anon'y_x") ptr_0
+instance WriteRaw S2_anon'anon'y
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2_anon'anon'y s2_anon'anon'y_anon'y_2
+                                                      s2_anon'anon'y_x_3 -> writeRaw (Proxy @"s2_anon'anon'y_anon'y") ptr_0 s2_anon'anon'y_anon'y_2 >> writeRaw (Proxy @"s2_anon'anon'y_x") ptr_0 s2_anon'anon'y_x_3
+deriving via (EquivStorable S2_anon'anon'y) instance Storable S2_anon'anon'y
+deriving via (IsStructViaReadRaw S2_anon'anon'y) instance IsStruct S2_anon'anon'y
+instance (~) ty S2_anon'anon'y_anon'y =>
+         HasField "s2_anon'anon'y_anon'y" S2_anon'anon'y ty
+    where hasField = \x_0 -> (\y_1 -> S2_anon'anon'y{s2_anon'anon'y_anon'y = y_1,
+                                                     s2_anon'anon'y_x = getField @"s2_anon'anon'y_x" x_0},
+                              getField @"s2_anon'anon'y_anon'y" x_0)
+instance (~) ty S2_anon'anon'y_anon'y =>
+         HasField "s2_anon'anon'y_anon'y" (Ptr S2_anon'anon'y) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_anon'anon'y_anon'y")
+instance HasCField S2_anon'anon'y "s2_anon'anon'y_anon'y"
+    where type CFieldType S2_anon'anon'y
+                          "s2_anon'anon'y_anon'y" = S2_anon'anon'y_anon'y
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar =>
+         HasField "s2_anon'anon'y_y" S2_anon'anon'y ty
+    where getField = \x_0 -> getField @"s2_anon'anon'y_anon'y_y" (getField @"s2_anon'anon'y_anon'y" x_0)
+instance (~) ty CChar =>
+         HasField "s2_anon'anon'y_y" S2_anon'anon'y ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s2_anon'anon'y_anon'y" x_0 (\z_2 -> setField @"s2_anon'anon'y_anon'y_y" z_2 y_1),
+                              getField @"s2_anon'anon'y_y" x_0)
+instance (~) ty CChar =>
+         HasField "s2_anon'anon'y_y" (Ptr S2_anon'anon'y) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_anon'anon'y_y")
+instance HasCField S2_anon'anon'y "s2_anon'anon'y_y"
+    where type CFieldType S2_anon'anon'y "s2_anon'anon'y_y" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "s2_anon'anon'y_x" S2_anon'anon'y ty
+    where hasField = \x_0 -> (\y_1 -> S2_anon'anon'y{s2_anon'anon'y_x = y_1,
+                                                     s2_anon'anon'y_anon'y = getField @"s2_anon'anon'y_anon'y" x_0},
+                              getField @"s2_anon'anon'y_x" x_0)
+instance (~) ty CInt =>
+         HasField "s2_anon'anon'y_x" (Ptr S2_anon'anon'y) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_anon'anon'y_x")
+instance HasCField S2_anon'anon'y "s2_anon'anon'y_x"
+    where type CFieldType S2_anon'anon'y "s2_anon'anon'y_x" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 19:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+-}
+data S2
+    = S2 {s2_anon'anon'y :: S2_anon'anon'y
+          {- ^ __C declaration:__ @anon\'anon\'y@
+
+               __defined at:__ @types\/anonymous\/edge-cases\/bitfield.h 20:3@
+
+               __exported by:__ @types\/anonymous\/edge-cases\/bitfield.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S2
+    where readRaw = \ptr_0 -> pure S2 <*> readRaw (Proxy @"s2_anon'anon'y") ptr_0
+instance WriteRaw S2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2 s2_anon'anon'y_2 -> writeRaw (Proxy @"s2_anon'anon'y") ptr_0 s2_anon'anon'y_2
+deriving via (EquivStorable S2) instance Storable S2
+deriving via (IsStructViaReadRaw S2) instance IsStruct S2
+instance (~) ty S2_anon'anon'y => HasField "s2_anon'anon'y" S2 ty
+    where hasField = \x_0 -> (\y_1 -> S2{s2_anon'anon'y = y_1},
+                              getField @"s2_anon'anon'y" x_0)
+instance (~) ty S2_anon'anon'y =>
+         HasField "s2_anon'anon'y" (Ptr S2) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_anon'anon'y")
+instance HasCField S2 "s2_anon'anon'y"
+    where type CFieldType S2 "s2_anon'anon'y" = S2_anon'anon'y
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar => HasField "s2_y" S2 ty
+    where getField = \x_0 -> getField @"s2_anon'anon'y_y" (getField @"s2_anon'anon'y" x_0)
+instance (~) ty CChar => HasField "s2_y" S2 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s2_anon'anon'y" x_0 (\z_2 -> setField @"s2_anon'anon'y_y" z_2 y_1),
+                              getField @"s2_y" x_0)
+instance (~) ty CChar => HasField "s2_y" (Ptr S2) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_y")
+instance HasCField S2 "s2_y"
+    where type CFieldType S2 "s2_y" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s2_x" S2 ty
+    where getField = \x_0 -> getField @"s2_anon'anon'y_x" (getField @"s2_anon'anon'y" x_0)
+instance (~) ty CInt => HasField "s2_x" S2 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s2_anon'anon'y" x_0 (\z_2 -> setField @"s2_anon'anon'y_x" z_2 y_1),
+                              getField @"s2_x" x_0)
+instance (~) ty CInt => HasField "s2_x" (Ptr S2) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_x")
+instance HasCField S2 "s2_x"
+    where type CFieldType S2 "s2_x" = CInt
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_1/Example.hs b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_1/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_1/Example.hs
@@ -0,0 +1,247 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S_anon'anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified OtherExample
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 4:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+data S_anon'anon'x = S_anon'anon'x
+  { s_anon'anon'x_anon'x :: OtherExample.Point2D
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 5:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+    -}
+  , s_anon'anon'x_z :: BG.CInt
+    {- ^ __C declaration:__ @z@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 9:9@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_z") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x s_anon'anon'x_anon'x2 s_anon'anon'x_z3 ->
+               HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0 s_anon'anon'x_anon'x2
+            >> HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_z") ptr0 s_anon'anon'x_z3
+
+deriving via Marshal.EquivStorable S_anon'anon'x instance BG.Storable S_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x instance Struct.IsStruct S_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 5:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+instance ( ty ~ OtherExample.Point2D
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x {s_anon'anon'x_anon'x = y1, s_anon'anon'x_z = BG.getField @"s_anon'anon'x_z" x0}
+      , BG.getField @"s_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ OtherExample.Point2D
+         ) => BG.HasField "s_anon'anon'x_anon'x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_anon'x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_anon'x" =
+    OtherExample.Point2D
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 9:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_z" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x { s_anon'anon'x_z = y1
+                        , s_anon'anon'x_anon'x = BG.getField @"s_anon'anon'x_anon'x" x0
+                        }
+      , BG.getField @"s_anon'anon'x_z" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s_anon'anon'x_z" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_z")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_z" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_z" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 3:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+data S = S
+  { s_anon'anon'x :: S_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 4:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x") ptr0 s_anon'anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 4:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+instance ( ty ~ S_anon'anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'anon'x = y1}, BG.getField @"s_anon'anon'x" x0)
+
+instance ( ty ~ S_anon'anon'x
+         ) => BG.HasField "s_anon'anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x")
+
+instance HasCField.HasCField S "s_anon'anon'x" where
+
+  type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 9:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "s_z" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_z" (BG.getField @"s_anon'anon'x" x0)
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 9:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_z" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x" x0 (\z2 ->
+                                                               BG.CompatHasField.setField @"s_anon'anon'x_z" z2 y1)
+      , BG.getField @"s_z" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s_z" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_z")
+
+instance HasCField.HasCField S "s_z" where
+
+  type CFieldType S "s_z" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_1/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_1/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_1/bindingspec.yaml
@@ -0,0 +1,51 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/edge-cases/drop_indirect_fields.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/edge-cases/drop_indirect_fields.h
+  cname: struct @S_anon'anon'x
+  hsname: S_anon'anon'x
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x
+      fields:
+      - s_anon'anon'x_anon'x
+      - s_anon'anon'x_z
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_1/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_1/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_1/th.txt
@@ -0,0 +1,100 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields.h
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 4:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+data S_anon'anon'x
+    = S_anon'anon'x {s_anon'anon'x_anon'x :: OtherExample.Point2D
+                     {- ^ __C declaration:__ @anon\'x@
+
+                          __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 5:5@
+
+                          __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+                     -},
+                     s_anon'anon'x_z :: CInt
+                     {- ^ __C declaration:__ @z@
+
+                          __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 9:9@
+
+                          __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x
+    where readRaw = \ptr_0 -> (pure S_anon'anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0) <*> readRaw (Proxy @"s_anon'anon'x_z") ptr_0
+instance WriteRaw S_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x s_anon'anon'x_anon'x_2
+                                                     s_anon'anon'x_z_3 -> writeRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0 s_anon'anon'x_anon'x_2 >> writeRaw (Proxy @"s_anon'anon'x_z") ptr_0 s_anon'anon'x_z_3
+deriving via (EquivStorable S_anon'anon'x) instance Storable S_anon'anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x) instance IsStruct S_anon'anon'x
+instance (~) ty OtherExample.Point2D =>
+         HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_anon'x = y_1,
+                                                    s_anon'anon'x_z = getField @"s_anon'anon'x_z" x_0},
+                              getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty OtherExample.Point2D =>
+         HasField "s_anon'anon'x_anon'x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_anon'x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_anon'x" = OtherExample.Point2D
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s_anon'anon'x_z" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_z = y_1,
+                                                    s_anon'anon'x_anon'x = getField @"s_anon'anon'x_anon'x" x_0},
+                              getField @"s_anon'anon'x_z" x_0)
+instance (~) ty CInt =>
+         HasField "s_anon'anon'x_z" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_z")
+instance HasCField S_anon'anon'x "s_anon'anon'x_z"
+    where type CFieldType S_anon'anon'x "s_anon'anon'x_z" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 3:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+data S
+    = S {s_anon'anon'x :: S_anon'anon'x
+         {- ^ __C declaration:__ @anon\'anon\'x@
+
+              __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 4:3@
+
+              __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x") ptr_0 s_anon'anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'anon'x => HasField "s_anon'anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'anon'x = y_1},
+                              getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x =>
+         HasField "s_anon'anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x")
+instance HasCField S "s_anon'anon'x"
+    where type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s_z" S ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_z" (getField @"s_anon'anon'x" x_0)
+instance (~) ty CInt => HasField "s_z" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_z" z_2 y_1),
+                              getField @"s_z" x_0)
+instance (~) ty CInt => HasField "s_z" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_z")
+instance HasCField S "s_z"
+    where type CFieldType S "s_z" = CInt
+          offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_2/Example.hs b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_2/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_2/Example.hs
@@ -0,0 +1,97 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified OtherExample
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 3:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+data S = S
+  { s_anon'anon'x :: OtherExample.Point3D
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 4:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x") ptr0 s_anon'anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 4:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+instance ( ty ~ OtherExample.Point3D
+         ) => BG.CompatHasField.HasField "s_anon'anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'anon'x = y1}, BG.getField @"s_anon'anon'x" x0)
+
+instance ( ty ~ OtherExample.Point3D
+         ) => BG.HasField "s_anon'anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x")
+
+instance HasCField.HasCField S "s_anon'anon'x" where
+
+  type CFieldType S "s_anon'anon'x" =
+    OtherExample.Point3D
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_2/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_2/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_2/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/edge-cases/drop_indirect_fields.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_2/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_2/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/drop_indirect_fields_2/th.txt
@@ -0,0 +1,36 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields.h
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 3:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+-}
+data S
+    = S {s_anon'anon'x :: OtherExample.Point3D
+         {- ^ __C declaration:__ @anon\'anon\'x@
+
+              __defined at:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h 4:3@
+
+              __exported by:__ @types\/anonymous\/edge-cases\/drop_indirect_fields.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x") ptr_0 s_anon'anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty OtherExample.Point3D =>
+         HasField "s_anon'anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'anon'x = y_1},
+                              getField @"s_anon'anon'x" x_0)
+instance (~) ty OtherExample.Point3D =>
+         HasField "s_anon'anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x")
+instance HasCField S "s_anon'anon'x"
+    where type CFieldType S "s_anon'anon'x" = OtherExample.Point3D
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/duplicate_field_names/Example.hs b/test-artefacts/fixtures/types/anonymous/edge-cases/duplicate_field_names/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/duplicate_field_names/Example.hs
@@ -0,0 +1,301 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S_y_anon'x(..)
+    , Example.S_y(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@S_y_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 16:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+data S_y_anon'x = S_y_anon'x
+  { s_y_anon'x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 17:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_y_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_y_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_y_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_y_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_y_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_y_anon'x s_y_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_y_anon'x_x") ptr0 s_y_anon'x_x2
+
+deriving via Marshal.EquivStorable S_y_anon'x instance BG.Storable S_y_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_y_anon'x instance Struct.IsStruct S_y_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 17:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s_y_anon'x_x" S_y_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_y_anon'x {s_y_anon'x_x = y1}, BG.getField @"s_y_anon'x_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s_y_anon'x_x" (BG.Ptr S_y_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_y_anon'x_x")
+
+instance HasCField.HasCField S_y_anon'x "s_y_anon'x_x" where
+
+  type CFieldType S_y_anon'x "s_y_anon'x_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 15:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+data S_y = S_y
+  { s_y_anon'x :: S_y_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 16:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_y where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_y where
+
+  readRaw =
+    \ptr0 ->
+          pure S_y
+      <*> HasCField.readRaw (BG.Proxy @"s_y_anon'x") ptr0
+
+instance Marshal.WriteRaw S_y where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_y s_y_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_y_anon'x") ptr0 s_y_anon'x2
+
+deriving via Marshal.EquivStorable S_y instance BG.Storable S_y
+
+deriving via Struct.IsStructViaReadRaw S_y instance Struct.IsStruct S_y
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 16:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+instance ( ty ~ S_y_anon'x
+         ) => BG.CompatHasField.HasField "s_y_anon'x" S_y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_y {s_y_anon'x = y1}, BG.getField @"s_y_anon'x" x0)
+
+instance ( ty ~ S_y_anon'x
+         ) => BG.HasField "s_y_anon'x" (BG.Ptr S_y) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_y_anon'x")
+
+instance HasCField.HasCField S_y "s_y_anon'x" where
+
+  type CFieldType S_y "s_y_anon'x" = S_y_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 17:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "s_y_x" S_y ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_y_anon'x_x" (BG.getField @"s_y_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 17:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s_y_x" S_y ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_y_anon'x" x0 (\z2 ->
+                                                            BG.CompatHasField.setField @"s_y_anon'x_x" z2 y1)
+      , BG.getField @"s_y_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s_y_x" (BG.Ptr S_y) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_y_x")
+
+instance HasCField.HasCField S_y "s_y_x" where
+
+  type CFieldType S_y "s_y_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 13:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+data S = S
+  { s_x :: BG.CULLong
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 14:22@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+    -}
+  , s_y :: S_y
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 19:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s_y") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_x2 s_y3 ->
+               HasCField.writeRaw (BG.Proxy @"s_x") ptr0 s_x2
+            >> HasCField.writeRaw (BG.Proxy @"s_y") ptr0 s_y3
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 14:22@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+instance (ty ~ BG.CULLong) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_x = y1, s_y = BG.getField @"s_y" x0}, BG.getField @"s_x" x0)
+
+instance (ty ~ BG.CULLong) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = BG.CULLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 19:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+instance (ty ~ S_y) => BG.CompatHasField.HasField "s_y" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_y = y1, s_x = BG.getField @"s_x" x0}, BG.getField @"s_y" x0)
+
+instance (ty ~ S_y) => BG.HasField "s_y" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_y")
+
+instance HasCField.HasCField S "s_y" where
+
+  type CFieldType S "s_y" = S_y
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/duplicate_field_names/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/duplicate_field_names/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/duplicate_field_names/bindingspec.yaml
@@ -0,0 +1,73 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/edge-cases/duplicate_field_names.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/edge-cases/duplicate_field_names.h
+  cname: struct @S_y
+  hsname: S_y
+- headers: types/anonymous/edge-cases/duplicate_field_names.h
+  cname: struct @S_y_anon'x
+  hsname: S_y_anon'x
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_x
+      - s_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_y
+  representation:
+    record:
+      constructor: S_y
+      fields:
+      - s_y_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_y_anon'x
+  representation:
+    record:
+      constructor: S_y_anon'x
+      fields:
+      - s_y_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/duplicate_field_names/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/duplicate_field_names/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/duplicate_field_names/th.txt
@@ -0,0 +1,130 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/duplicate_field_names.h
+{-| __C declaration:__ @struct \@S_y_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 16:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+data S_y_anon'x
+    = S_y_anon'x {s_y_anon'x_x :: CInt
+                  {- ^ __C declaration:__ @x@
+
+                       __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 17:11@
+
+                       __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_y_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_y_anon'x
+    where readRaw = \ptr_0 -> pure S_y_anon'x <*> readRaw (Proxy @"s_y_anon'x_x") ptr_0
+instance WriteRaw S_y_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_y_anon'x s_y_anon'x_x_2 -> writeRaw (Proxy @"s_y_anon'x_x") ptr_0 s_y_anon'x_x_2
+deriving via (EquivStorable S_y_anon'x) instance Storable S_y_anon'x
+deriving via (IsStructViaReadRaw S_y_anon'x) instance IsStruct S_y_anon'x
+instance (~) ty CInt => HasField "s_y_anon'x_x" S_y_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_y_anon'x{s_y_anon'x_x = y_1},
+                              getField @"s_y_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "s_y_anon'x_x" (Ptr S_y_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y_anon'x_x")
+instance HasCField S_y_anon'x "s_y_anon'x_x"
+    where type CFieldType S_y_anon'x "s_y_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 15:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+data S_y
+    = S_y {s_y_anon'x :: S_y_anon'x
+           {- ^ __C declaration:__ @anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 16:5@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_y
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_y
+    where readRaw = \ptr_0 -> pure S_y <*> readRaw (Proxy @"s_y_anon'x") ptr_0
+instance WriteRaw S_y
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_y s_y_anon'x_2 -> writeRaw (Proxy @"s_y_anon'x") ptr_0 s_y_anon'x_2
+deriving via (EquivStorable S_y) instance Storable S_y
+deriving via (IsStructViaReadRaw S_y) instance IsStruct S_y
+instance (~) ty S_y_anon'x => HasField "s_y_anon'x" S_y ty
+    where hasField = \x_0 -> (\y_1 -> S_y{s_y_anon'x = y_1},
+                              getField @"s_y_anon'x" x_0)
+instance (~) ty S_y_anon'x =>
+         HasField "s_y_anon'x" (Ptr S_y) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y_anon'x")
+instance HasCField S_y "s_y_anon'x"
+    where type CFieldType S_y "s_y_anon'x" = S_y_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s_y_x" S_y ty
+    where getField = \x_0 -> getField @"s_y_anon'x_x" (getField @"s_y_anon'x" x_0)
+instance (~) ty CInt => HasField "s_y_x" S_y ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_y_anon'x" x_0 (\z_2 -> setField @"s_y_anon'x_x" z_2 y_1),
+                              getField @"s_y_x" x_0)
+instance (~) ty CInt => HasField "s_y_x" (Ptr S_y) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y_x")
+instance HasCField S_y "s_y_x"
+    where type CFieldType S_y "s_y_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 13:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+-}
+data S
+    = S {s_x :: CULLong
+         {- ^ __C declaration:__ @x@
+
+              __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 14:22@
+
+              __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+         -},
+         s_y :: S_y
+         {- ^ __C declaration:__ @y@
+
+              __defined at:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h 19:5@
+
+              __exported by:__ @types\/anonymous\/edge-cases\/duplicate_field_names.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> (pure S <*> readRaw (Proxy @"s_x") ptr_0) <*> readRaw (Proxy @"s_y") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_x_2
+                                         s_y_3 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2 >> writeRaw (Proxy @"s_y") ptr_0 s_y_3
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty CULLong => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_x = y_1,
+                                        s_y = getField @"s_y" x_0},
+                              getField @"s_x" x_0)
+instance (~) ty CULLong => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = CULLong
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_y => HasField "s_y" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_y = y_1,
+                                        s_x = getField @"s_x" x_0},
+                              getField @"s_y" x_0)
+instance (~) ty S_y => HasField "s_y" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y")
+instance HasCField S "s_y"
+    where type CFieldType S "s_y" = S_y
+          offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/empty_anon/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/empty_anon/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/empty_anon/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/empty_anon/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/empty_anon/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/empty_anon/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/empty_anon.h
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting.omit_field_prefixes/Example.hs b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting.omit_field_prefixes/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting.omit_field_prefixes/Example.hs
@@ -0,0 +1,2176 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.SSS_anon'anon'x_anon'x(..)
+    , Example.SSS_anon'anon'x(..)
+    , Example.SSS(..)
+    , Example.USS_anon'anon'x_anon'x(..)
+    , Example.USS_anon'anon'x(..)
+    , Example.USS(..)
+    , Example.SUS_anon'anon'x_anon'x(..)
+    , Example.SUS_anon'anon'x(..)
+    , Example.SUS(..)
+    , Example.UUS_anon'anon'x_anon'x(..)
+    , Example.UUS_anon'anon'x(..)
+    , Example.UUS(..)
+    , Example.SSU_anon'anon'x_anon'x(..)
+    , Example.SSU_anon'anon'x(..)
+    , Example.SSU(..)
+    , Example.USU_anon'anon'x_anon'x(..)
+    , Example.USU_anon'anon'x(..)
+    , Example.USU(..)
+    , Example.SUU_anon'anon'x_anon'x(..)
+    , Example.SUU_anon'anon'x(..)
+    , Example.SUU(..)
+    , Example.UUU_anon'anon'x_anon'x(..)
+    , Example.UUU_anon'anon'x(..)
+    , Example.UUU(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@SSS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS_anon'anon'x_anon'x = SSS_anon'anon'x_anon'x
+  { x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SSS_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSS_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure SSS_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"x") ptr0
+
+instance Marshal.WriteRaw SSS_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSS_anon'anon'x_anon'x x2 ->
+            HasCField.writeRaw (BG.Proxy @"x") ptr0 x2
+
+deriving via Marshal.EquivStorable SSS_anon'anon'x_anon'x instance BG.Storable SSS_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw SSS_anon'anon'x_anon'x instance Struct.IsStruct SSS_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" SSS_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SSS_anon'anon'x_anon'x {x = y1}, BG.getField @"x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr SSS_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SSS_anon'anon'x_anon'x "x" where
+
+  type CFieldType SSS_anon'anon'x_anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@SSS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS_anon'anon'x = SSS_anon'anon'x
+  { anon'x :: SSS_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SSS_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSS_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure SSS_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"anon'x") ptr0
+
+instance Marshal.WriteRaw SSS_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSS_anon'anon'x anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"anon'x") ptr0 anon'x2
+
+deriving via Marshal.EquivStorable SSS_anon'anon'x instance BG.Storable SSS_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw SSS_anon'anon'x instance Struct.IsStruct SSS_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SSS_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "anon'x" SSS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SSS_anon'anon'x {anon'x = y1}, BG.getField @"anon'x" x0)
+
+instance ( ty ~ SSS_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" (BG.Ptr SSS_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"anon'x")
+
+instance HasCField.HasCField SSS_anon'anon'x "anon'x" where
+
+  type CFieldType SSS_anon'anon'x "anon'x" =
+    SSS_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SSS_anon'anon'x ty where
+
+  getField =
+    \x0 -> BG.getField @"x" (BG.getField @"anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" SSS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'x" x0 (\z2 ->
+                                                        BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr SSS_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SSS_anon'anon'x "x" where
+
+  type CFieldType SSS_anon'anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct SSS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 15:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS = SSS
+  { anon'anon'x :: SSS_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SSS where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSS where
+
+  readRaw =
+    \ptr0 ->
+          pure SSS
+      <*> HasCField.readRaw (BG.Proxy @"anon'anon'x") ptr0
+
+instance Marshal.WriteRaw SSS where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSS anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"anon'anon'x") ptr0 anon'anon'x2
+
+deriving via Marshal.EquivStorable SSS instance BG.Storable SSS
+
+deriving via Struct.IsStructViaReadRaw SSS instance Struct.IsStruct SSS
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SSS_anon'anon'x
+         ) => BG.CompatHasField.HasField "anon'anon'x" SSS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SSS {anon'anon'x = y1}, BG.getField @"anon'anon'x" x0)
+
+instance ( ty ~ SSS_anon'anon'x
+         ) => BG.HasField "anon'anon'x" (BG.Ptr SSS) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"anon'anon'x")
+
+instance HasCField.HasCField SSS "anon'anon'x" where
+
+  type CFieldType SSS "anon'anon'x" = SSS_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SSS ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"x" (BG.getField @"anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" SSS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'anon'x" x0 (\z2 ->
+                                                             BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr SSS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SSS "x" where
+
+  type CFieldType SSS "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@USS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USS_anon'anon'x_anon'x = USS_anon'anon'x_anon'x
+  { x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize USS_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw USS_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure USS_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"x") ptr0
+
+instance Marshal.WriteRaw USS_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          USS_anon'anon'x_anon'x x2 ->
+            HasCField.writeRaw (BG.Proxy @"x") ptr0 x2
+
+deriving via Marshal.EquivStorable USS_anon'anon'x_anon'x instance BG.Storable USS_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw USS_anon'anon'x_anon'x instance Struct.IsStruct USS_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" USS_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         USS_anon'anon'x_anon'x {x = y1}, BG.getField @"x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr USS_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField USS_anon'anon'x_anon'x "x" where
+
+  type CFieldType USS_anon'anon'x_anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@USS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USS_anon'anon'x = USS_anon'anon'x
+  { anon'x :: USS_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize USS_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw USS_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure USS_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"anon'x") ptr0
+
+instance Marshal.WriteRaw USS_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          USS_anon'anon'x anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"anon'x") ptr0 anon'x2
+
+deriving via Marshal.EquivStorable USS_anon'anon'x instance BG.Storable USS_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw USS_anon'anon'x instance Struct.IsStruct USS_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ USS_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "anon'x" USS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         USS_anon'anon'x {anon'x = y1}, BG.getField @"anon'x" x0)
+
+instance ( ty ~ USS_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" (BG.Ptr USS_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"anon'x")
+
+instance HasCField.HasCField USS_anon'anon'x "anon'x" where
+
+  type CFieldType USS_anon'anon'x "anon'x" =
+    USS_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" USS_anon'anon'x ty where
+
+  getField =
+    \x0 -> BG.getField @"x" (BG.getField @"anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" USS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'x" x0 (\z2 ->
+                                                        BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr USS_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField USS_anon'anon'x "x" where
+
+  type CFieldType USS_anon'anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union USS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 23:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USS = USS
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize USS
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw USS
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw USS
+
+deriving via Marshal.EquivStorable USS instance BG.Storable USS
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion USS
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ USS_anon'anon'x) => BG.HasField "anon'anon'x" USS ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ USS_anon'anon'x
+         ) => BG.CompatHasField.HasField "anon'anon'x" USS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"anon'anon'x" x0)
+
+instance ( ty ~ USS_anon'anon'x
+         ) => BG.HasField "anon'anon'x" (BG.Ptr USS) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"anon'anon'x")
+
+instance HasCField.HasCField USS "anon'anon'x" where
+
+  type CFieldType USS "anon'anon'x" = USS_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" USS ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"x" (BG.getField @"anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" USS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'anon'x" x0 (\z2 ->
+                                                             BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr USS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField USS "x" where
+
+  type CFieldType USS "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@SUS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 33:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUS_anon'anon'x_anon'x = SUS_anon'anon'x_anon'x
+  { x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SUS_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SUS_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure SUS_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"x") ptr0
+
+instance Marshal.WriteRaw SUS_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SUS_anon'anon'x_anon'x x2 ->
+            HasCField.writeRaw (BG.Proxy @"x") ptr0 x2
+
+deriving via Marshal.EquivStorable SUS_anon'anon'x_anon'x instance BG.Storable SUS_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw SUS_anon'anon'x_anon'x instance Struct.IsStruct SUS_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" SUS_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SUS_anon'anon'x_anon'x {x = y1}, BG.getField @"x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr SUS_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SUS_anon'anon'x_anon'x "x" where
+
+  type CFieldType SUS_anon'anon'x_anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@SUS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUS_anon'anon'x = SUS_anon'anon'x
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize SUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw SUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw SUS_anon'anon'x
+
+deriving via Marshal.EquivStorable SUS_anon'anon'x instance BG.Storable SUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion SUS_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 33:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUS_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" SUS_anon'anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 33:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUS_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "anon'x" SUS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"anon'x" x0)
+
+instance ( ty ~ SUS_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" (BG.Ptr SUS_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"anon'x")
+
+instance HasCField.HasCField SUS_anon'anon'x "anon'x" where
+
+  type CFieldType SUS_anon'anon'x "anon'x" =
+    SUS_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SUS_anon'anon'x ty where
+
+  getField =
+    \x0 -> BG.getField @"x" (BG.getField @"anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" SUS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'x" x0 (\z2 ->
+                                                        BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr SUS_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SUS_anon'anon'x "x" where
+
+  type CFieldType SUS_anon'anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct SUS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 31:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUS = SUS
+  { anon'anon'x :: SUS_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize SUS where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SUS where
+
+  readRaw =
+    \ptr0 ->
+          pure SUS
+      <*> HasCField.readRaw (BG.Proxy @"anon'anon'x") ptr0
+
+instance Marshal.WriteRaw SUS where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SUS anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"anon'anon'x") ptr0 anon'anon'x2
+
+deriving via Marshal.EquivStorable SUS instance BG.Storable SUS
+
+deriving via Struct.IsStructViaReadRaw SUS instance Struct.IsStruct SUS
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUS_anon'anon'x
+         ) => BG.CompatHasField.HasField "anon'anon'x" SUS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SUS {anon'anon'x = y1}, BG.getField @"anon'anon'x" x0)
+
+instance ( ty ~ SUS_anon'anon'x
+         ) => BG.HasField "anon'anon'x" (BG.Ptr SUS) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"anon'anon'x")
+
+instance HasCField.HasCField SUS "anon'anon'x" where
+
+  type CFieldType SUS "anon'anon'x" = SUS_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SUS ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"x" (BG.getField @"anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" SUS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'anon'x" x0 (\z2 ->
+                                                             BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr SUS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SUS "x" where
+
+  type CFieldType SUS "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@UUS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 41:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data UUS_anon'anon'x_anon'x = UUS_anon'anon'x_anon'x
+  { x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UUS_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UUS_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure UUS_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"x") ptr0
+
+instance Marshal.WriteRaw UUS_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UUS_anon'anon'x_anon'x x2 ->
+            HasCField.writeRaw (BG.Proxy @"x") ptr0 x2
+
+deriving via Marshal.EquivStorable UUS_anon'anon'x_anon'x instance BG.Storable UUS_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw UUS_anon'anon'x_anon'x instance Struct.IsStruct UUS_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" UUS_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         UUS_anon'anon'x_anon'x {x = y1}, BG.getField @"x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr UUS_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField UUS_anon'anon'x_anon'x "x" where
+
+  type CFieldType UUS_anon'anon'x_anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@UUS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 40:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUS_anon'anon'x = UUS_anon'anon'x
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUS_anon'anon'x
+
+deriving via Marshal.EquivStorable UUS_anon'anon'x instance BG.Storable UUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUS_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 41:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUS_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" UUS_anon'anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 41:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUS_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "anon'x" UUS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"anon'x" x0)
+
+instance ( ty ~ UUS_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" (BG.Ptr UUS_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"anon'x")
+
+instance HasCField.HasCField UUS_anon'anon'x "anon'x" where
+
+  type CFieldType UUS_anon'anon'x "anon'x" =
+    UUS_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" UUS_anon'anon'x ty where
+
+  getField =
+    \x0 -> BG.getField @"x" (BG.getField @"anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" UUS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'x" x0 (\z2 ->
+                                                        BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr UUS_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField UUS_anon'anon'x "x" where
+
+  type CFieldType UUS_anon'anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union UUS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 39:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUS = UUS
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUS
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUS
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUS
+
+deriving via Marshal.EquivStorable UUS instance BG.Storable UUS
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUS
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 40:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ UUS_anon'anon'x) => BG.HasField "anon'anon'x" UUS ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 40:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUS_anon'anon'x
+         ) => BG.CompatHasField.HasField "anon'anon'x" UUS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"anon'anon'x" x0)
+
+instance ( ty ~ UUS_anon'anon'x
+         ) => BG.HasField "anon'anon'x" (BG.Ptr UUS) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"anon'anon'x")
+
+instance HasCField.HasCField UUS "anon'anon'x" where
+
+  type CFieldType UUS "anon'anon'x" = UUS_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" UUS ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"x" (BG.getField @"anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" UUS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'anon'x" x0 (\z2 ->
+                                                             BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr UUS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField UUS "x" where
+
+  type CFieldType UUS "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@SSU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SSU_anon'anon'x_anon'x = SSU_anon'anon'x_anon'x
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize SSU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw SSU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw SSU_anon'anon'x_anon'x
+
+deriving via Marshal.EquivStorable SSU_anon'anon'x_anon'x instance BG.Storable SSU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion SSU_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SSU_anon'anon'x_anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" SSU_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr SSU_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SSU_anon'anon'x_anon'x "x" where
+
+  type CFieldType SSU_anon'anon'x_anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@SSU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSU_anon'anon'x = SSU_anon'anon'x
+  { anon'x :: SSU_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize SSU_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSU_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure SSU_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"anon'x") ptr0
+
+instance Marshal.WriteRaw SSU_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSU_anon'anon'x anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"anon'x") ptr0 anon'x2
+
+deriving via Marshal.EquivStorable SSU_anon'anon'x instance BG.Storable SSU_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw SSU_anon'anon'x instance Struct.IsStruct SSU_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SSU_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "anon'x" SSU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SSU_anon'anon'x {anon'x = y1}, BG.getField @"anon'x" x0)
+
+instance ( ty ~ SSU_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" (BG.Ptr SSU_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"anon'x")
+
+instance HasCField.HasCField SSU_anon'anon'x "anon'x" where
+
+  type CFieldType SSU_anon'anon'x "anon'x" =
+    SSU_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SSU_anon'anon'x ty where
+
+  getField =
+    \x0 -> BG.getField @"x" (BG.getField @"anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" SSU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'x" x0 (\z2 ->
+                                                        BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr SSU_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SSU_anon'anon'x "x" where
+
+  type CFieldType SSU_anon'anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct SSU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 47:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSU = SSU
+  { anon'anon'x :: SSU_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize SSU where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSU where
+
+  readRaw =
+    \ptr0 ->
+          pure SSU
+      <*> HasCField.readRaw (BG.Proxy @"anon'anon'x") ptr0
+
+instance Marshal.WriteRaw SSU where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSU anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"anon'anon'x") ptr0 anon'anon'x2
+
+deriving via Marshal.EquivStorable SSU instance BG.Storable SSU
+
+deriving via Struct.IsStructViaReadRaw SSU instance Struct.IsStruct SSU
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SSU_anon'anon'x
+         ) => BG.CompatHasField.HasField "anon'anon'x" SSU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SSU {anon'anon'x = y1}, BG.getField @"anon'anon'x" x0)
+
+instance ( ty ~ SSU_anon'anon'x
+         ) => BG.HasField "anon'anon'x" (BG.Ptr SSU) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"anon'anon'x")
+
+instance HasCField.HasCField SSU "anon'anon'x" where
+
+  type CFieldType SSU "anon'anon'x" = SSU_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SSU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"x" (BG.getField @"anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" SSU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'anon'x" x0 (\z2 ->
+                                                             BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr SSU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SSU "x" where
+
+  type CFieldType SSU "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@USU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USU_anon'anon'x_anon'x = USU_anon'anon'x_anon'x
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize USU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw USU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw USU_anon'anon'x_anon'x
+
+deriving via Marshal.EquivStorable USU_anon'anon'x_anon'x instance BG.Storable USU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion USU_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" USU_anon'anon'x_anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" USU_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr USU_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField USU_anon'anon'x_anon'x "x" where
+
+  type CFieldType USU_anon'anon'x_anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@USU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 56:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USU_anon'anon'x = USU_anon'anon'x
+  { anon'x :: USU_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize USU_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw USU_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure USU_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"anon'x") ptr0
+
+instance Marshal.WriteRaw USU_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          USU_anon'anon'x anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"anon'x") ptr0 anon'x2
+
+deriving via Marshal.EquivStorable USU_anon'anon'x instance BG.Storable USU_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw USU_anon'anon'x instance Struct.IsStruct USU_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ USU_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "anon'x" USU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         USU_anon'anon'x {anon'x = y1}, BG.getField @"anon'x" x0)
+
+instance ( ty ~ USU_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" (BG.Ptr USU_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"anon'x")
+
+instance HasCField.HasCField USU_anon'anon'x "anon'x" where
+
+  type CFieldType USU_anon'anon'x "anon'x" =
+    USU_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" USU_anon'anon'x ty where
+
+  getField =
+    \x0 -> BG.getField @"x" (BG.getField @"anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" USU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'x" x0 (\z2 ->
+                                                        BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr USU_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField USU_anon'anon'x "x" where
+
+  type CFieldType USU_anon'anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union USU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 55:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USU = USU
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize USU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw USU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw USU
+
+deriving via Marshal.EquivStorable USU instance BG.Storable USU
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion USU
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 56:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ USU_anon'anon'x) => BG.HasField "anon'anon'x" USU ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 56:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ USU_anon'anon'x
+         ) => BG.CompatHasField.HasField "anon'anon'x" USU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"anon'anon'x" x0)
+
+instance ( ty ~ USU_anon'anon'x
+         ) => BG.HasField "anon'anon'x" (BG.Ptr USU) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"anon'anon'x")
+
+instance HasCField.HasCField USU "anon'anon'x" where
+
+  type CFieldType USU "anon'anon'x" = USU_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" USU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"x" (BG.getField @"anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" USU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'anon'x" x0 (\z2 ->
+                                                             BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr USU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField USU "x" where
+
+  type CFieldType USU "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@SUU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 65:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUU_anon'anon'x_anon'x = SUU_anon'anon'x_anon'x
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize SUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw SUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw SUU_anon'anon'x_anon'x
+
+deriving via Marshal.EquivStorable SUU_anon'anon'x_anon'x instance BG.Storable SUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion SUU_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SUU_anon'anon'x_anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" SUU_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr SUU_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SUU_anon'anon'x_anon'x "x" where
+
+  type CFieldType SUU_anon'anon'x_anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@SUU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUU_anon'anon'x = SUU_anon'anon'x
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize SUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw SUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw SUU_anon'anon'x
+
+deriving via Marshal.EquivStorable SUU_anon'anon'x instance BG.Storable SUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion SUU_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 65:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUU_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" SUU_anon'anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 65:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUU_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "anon'x" SUU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"anon'x" x0)
+
+instance ( ty ~ SUU_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" (BG.Ptr SUU_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"anon'x")
+
+instance HasCField.HasCField SUU_anon'anon'x "anon'x" where
+
+  type CFieldType SUU_anon'anon'x "anon'x" =
+    SUU_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SUU_anon'anon'x ty where
+
+  getField =
+    \x0 -> BG.getField @"x" (BG.getField @"anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" SUU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'x" x0 (\z2 ->
+                                                        BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr SUU_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SUU_anon'anon'x "x" where
+
+  type CFieldType SUU_anon'anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct SUU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 63:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUU = SUU
+  { anon'anon'x :: SUU_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize SUU where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SUU where
+
+  readRaw =
+    \ptr0 ->
+          pure SUU
+      <*> HasCField.readRaw (BG.Proxy @"anon'anon'x") ptr0
+
+instance Marshal.WriteRaw SUU where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SUU anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"anon'anon'x") ptr0 anon'anon'x2
+
+deriving via Marshal.EquivStorable SUU instance BG.Storable SUU
+
+deriving via Struct.IsStructViaReadRaw SUU instance Struct.IsStruct SUU
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUU_anon'anon'x
+         ) => BG.CompatHasField.HasField "anon'anon'x" SUU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SUU {anon'anon'x = y1}, BG.getField @"anon'anon'x" x0)
+
+instance ( ty ~ SUU_anon'anon'x
+         ) => BG.HasField "anon'anon'x" (BG.Ptr SUU) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"anon'anon'x")
+
+instance HasCField.HasCField SUU "anon'anon'x" where
+
+  type CFieldType SUU "anon'anon'x" = SUU_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" SUU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"x" (BG.getField @"anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" SUU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'anon'x" x0 (\z2 ->
+                                                             BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr SUU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField SUU "x" where
+
+  type CFieldType SUU "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@UUU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 73:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU_anon'anon'x_anon'x = UUU_anon'anon'x_anon'x
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUU_anon'anon'x_anon'x
+
+deriving via Marshal.EquivStorable UUU_anon'anon'x_anon'x instance BG.Storable UUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUU_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" UUU_anon'anon'x_anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" UUU_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr UUU_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField UUU_anon'anon'x_anon'x "x" where
+
+  type CFieldType UUU_anon'anon'x_anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@UUU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 72:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU_anon'anon'x = UUU_anon'anon'x
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUU_anon'anon'x
+
+deriving via Marshal.EquivStorable UUU_anon'anon'x instance BG.Storable UUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUU_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 73:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUU_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" UUU_anon'anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 73:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUU_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "anon'x" UUU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"anon'x" x0)
+
+instance ( ty ~ UUU_anon'anon'x_anon'x
+         ) => BG.HasField "anon'x" (BG.Ptr UUU_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"anon'x")
+
+instance HasCField.HasCField UUU_anon'anon'x "anon'x" where
+
+  type CFieldType UUU_anon'anon'x "anon'x" =
+    UUU_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" UUU_anon'anon'x ty where
+
+  getField =
+    \x0 -> BG.getField @"x" (BG.getField @"anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "x" UUU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'x" x0 (\z2 ->
+                                                        BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "x" (BG.Ptr UUU_anon'anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField UUU_anon'anon'x "x" where
+
+  type CFieldType UUU_anon'anon'x "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union UUU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 71:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU = UUU
+  { unwrap :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUU
+
+deriving via Marshal.EquivStorable UUU instance BG.Storable UUU
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUU
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 72:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ UUU_anon'anon'x) => BG.HasField "anon'anon'x" UUU ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 72:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUU_anon'anon'x
+         ) => BG.CompatHasField.HasField "anon'anon'x" UUU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"anon'anon'x" x0)
+
+instance ( ty ~ UUU_anon'anon'x
+         ) => BG.HasField "anon'anon'x" (BG.Ptr UUU) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"anon'anon'x")
+
+instance HasCField.HasCField UUU "anon'anon'x" where
+
+  type CFieldType UUU "anon'anon'x" = UUU_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "x" UUU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"x" (BG.getField @"anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" UUU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"anon'anon'x" x0 (\z2 ->
+                                                             BG.CompatHasField.setField @"x" z2 y1)
+      , BG.getField @"x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr UUU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"x")
+
+instance HasCField.HasCField UUU "x" where
+
+  type CFieldType UUU "x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting.omit_field_prefixes/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting.omit_field_prefixes/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting.omit_field_prefixes/bindingspec.yaml
@@ -0,0 +1,500 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct SSS
+  hsname: SSS
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @SSS_anon'anon'x
+  hsname: SSS_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @SSS_anon'anon'x_anon'x
+  hsname: SSS_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union USS
+  hsname: USS
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @USS_anon'anon'x
+  hsname: USS_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @USS_anon'anon'x_anon'x
+  hsname: USS_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct SUS
+  hsname: SUS
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @SUS_anon'anon'x
+  hsname: SUS_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @SUS_anon'anon'x_anon'x
+  hsname: SUS_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union UUS
+  hsname: UUS
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @UUS_anon'anon'x
+  hsname: UUS_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @UUS_anon'anon'x_anon'x
+  hsname: UUS_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct SSU
+  hsname: SSU
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @SSU_anon'anon'x
+  hsname: SSU_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @SSU_anon'anon'x_anon'x
+  hsname: SSU_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union USU
+  hsname: USU
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @USU_anon'anon'x
+  hsname: USU_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @USU_anon'anon'x_anon'x
+  hsname: USU_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct SUU
+  hsname: SUU
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @SUU_anon'anon'x
+  hsname: SUU_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @SUU_anon'anon'x_anon'x
+  hsname: SUU_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union UUU
+  hsname: UUU
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @UUU_anon'anon'x
+  hsname: UUU_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @UUU_anon'anon'x_anon'x
+  hsname: UUU_anon'anon'x_anon'x
+hstypes:
+- hsname: SSS
+  representation:
+    record:
+      constructor: SSS
+      fields:
+      - anon'anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSS_anon'anon'x
+  representation:
+    record:
+      constructor: SSS_anon'anon'x
+      fields:
+      - anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSS_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: SSS_anon'anon'x_anon'x
+      fields:
+      - x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSU
+  representation:
+    record:
+      constructor: SSU
+      fields:
+      - anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSU_anon'anon'x
+  representation:
+    record:
+      constructor: SSU_anon'anon'x
+      fields:
+      - anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSU_anon'anon'x_anon'x
+  representation:
+    newtype:
+      constructor: SSU_anon'anon'x_anon'x
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUS
+  representation:
+    record:
+      constructor: SUS
+      fields:
+      - anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUS_anon'anon'x
+  representation:
+    newtype:
+      constructor: SUS_anon'anon'x
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUS_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: SUS_anon'anon'x_anon'x
+      fields:
+      - x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUU
+  representation:
+    record:
+      constructor: SUU
+      fields:
+      - anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUU_anon'anon'x
+  representation:
+    newtype:
+      constructor: SUU_anon'anon'x
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUU_anon'anon'x_anon'x
+  representation:
+    newtype:
+      constructor: SUU_anon'anon'x_anon'x
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USS
+  representation:
+    newtype:
+      constructor: USS
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USS_anon'anon'x
+  representation:
+    record:
+      constructor: USS_anon'anon'x
+      fields:
+      - anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USS_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: USS_anon'anon'x_anon'x
+      fields:
+      - x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USU
+  representation:
+    newtype:
+      constructor: USU
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USU_anon'anon'x
+  representation:
+    record:
+      constructor: USU_anon'anon'x
+      fields:
+      - anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USU_anon'anon'x_anon'x
+  representation:
+    newtype:
+      constructor: USU_anon'anon'x_anon'x
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUS
+  representation:
+    newtype:
+      constructor: UUS
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUS_anon'anon'x
+  representation:
+    newtype:
+      constructor: UUS_anon'anon'x
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUS_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: UUS_anon'anon'x_anon'x
+      fields:
+      - x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUU
+  representation:
+    newtype:
+      constructor: UUU
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUU_anon'anon'x
+  representation:
+    newtype:
+      constructor: UUU_anon'anon'x
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUU_anon'anon'x_anon'x
+  representation:
+    newtype:
+      constructor: UUU_anon'anon'x_anon'x
+      fields:
+      - unwrap
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting.omit_field_prefixes/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting.omit_field_prefixes/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting.omit_field_prefixes/th.txt
@@ -0,0 +1,901 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/multi_nesting.h
+{-| __C declaration:__ @struct \@SSS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS_anon'anon'x_anon'x
+    = SSS_anon'anon'x_anon'x {x :: CInt
+                              {- ^ __C declaration:__ @x@
+
+                                   __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+                                   __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SSS_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSS_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure SSS_anon'anon'x_anon'x <*> readRaw (Proxy @"x") ptr_0
+instance WriteRaw SSS_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSS_anon'anon'x_anon'x x_2 -> writeRaw (Proxy @"x") ptr_0 x_2
+deriving via (EquivStorable SSS_anon'anon'x_anon'x) instance Storable SSS_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw SSS_anon'anon'x_anon'x) instance IsStruct SSS_anon'anon'x_anon'x
+instance (~) ty CInt => HasField "x" SSS_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> SSS_anon'anon'x_anon'x{x = y_1},
+                              getField @"x" x_0)
+instance (~) ty CInt =>
+         HasField "x" (Ptr SSS_anon'anon'x_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SSS_anon'anon'x_anon'x "x"
+    where type CFieldType SSS_anon'anon'x_anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@SSS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS_anon'anon'x
+    = SSS_anon'anon'x {anon'x :: SSS_anon'anon'x_anon'x
+                       {- ^ __C declaration:__ @anon\'x@
+
+                            __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+                            __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SSS_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSS_anon'anon'x
+    where readRaw = \ptr_0 -> pure SSS_anon'anon'x <*> readRaw (Proxy @"anon'x") ptr_0
+instance WriteRaw SSS_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSS_anon'anon'x anon'x_2 -> writeRaw (Proxy @"anon'x") ptr_0 anon'x_2
+deriving via (EquivStorable SSS_anon'anon'x) instance Storable SSS_anon'anon'x
+deriving via (IsStructViaReadRaw SSS_anon'anon'x) instance IsStruct SSS_anon'anon'x
+instance (~) ty SSS_anon'anon'x_anon'x =>
+         HasField "anon'x" SSS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> SSS_anon'anon'x{anon'x = y_1},
+                              getField @"anon'x" x_0)
+instance (~) ty SSS_anon'anon'x_anon'x =>
+         HasField "anon'x" (Ptr SSS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'x")
+instance HasCField SSS_anon'anon'x "anon'x"
+    where type CFieldType SSS_anon'anon'x
+                          "anon'x" = SSS_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" SSS_anon'anon'x ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'x" x_0)
+instance (~) ty CInt => HasField "x" SSS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr SSS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SSS_anon'anon'x "x"
+    where type CFieldType SSS_anon'anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct SSS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 15:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS
+    = SSS {anon'anon'x :: SSS_anon'anon'x
+           {- ^ __C declaration:__ @anon\'anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SSS
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSS
+    where readRaw = \ptr_0 -> pure SSS <*> readRaw (Proxy @"anon'anon'x") ptr_0
+instance WriteRaw SSS
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSS anon'anon'x_2 -> writeRaw (Proxy @"anon'anon'x") ptr_0 anon'anon'x_2
+deriving via (EquivStorable SSS) instance Storable SSS
+deriving via (IsStructViaReadRaw SSS) instance IsStruct SSS
+instance (~) ty SSS_anon'anon'x => HasField "anon'anon'x" SSS ty
+    where hasField = \x_0 -> (\y_1 -> SSS{anon'anon'x = y_1},
+                              getField @"anon'anon'x" x_0)
+instance (~) ty SSS_anon'anon'x =>
+         HasField "anon'anon'x" (Ptr SSS) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'anon'x")
+instance HasCField SSS "anon'anon'x"
+    where type CFieldType SSS "anon'anon'x" = SSS_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" SSS ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'anon'x" x_0)
+instance (~) ty CInt => HasField "x" SSS ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr SSS) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SSS "x"
+    where type CFieldType SSS "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@USS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USS_anon'anon'x_anon'x
+    = USS_anon'anon'x_anon'x {x :: CInt
+                              {- ^ __C declaration:__ @x@
+
+                                   __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+                                   __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize USS_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw USS_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure USS_anon'anon'x_anon'x <*> readRaw (Proxy @"x") ptr_0
+instance WriteRaw USS_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       USS_anon'anon'x_anon'x x_2 -> writeRaw (Proxy @"x") ptr_0 x_2
+deriving via (EquivStorable USS_anon'anon'x_anon'x) instance Storable USS_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw USS_anon'anon'x_anon'x) instance IsStruct USS_anon'anon'x_anon'x
+instance (~) ty CInt => HasField "x" USS_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> USS_anon'anon'x_anon'x{x = y_1},
+                              getField @"x" x_0)
+instance (~) ty CInt =>
+         HasField "x" (Ptr USS_anon'anon'x_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField USS_anon'anon'x_anon'x "x"
+    where type CFieldType USS_anon'anon'x_anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@USS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USS_anon'anon'x
+    = USS_anon'anon'x {anon'x :: USS_anon'anon'x_anon'x
+                       {- ^ __C declaration:__ @anon\'x@
+
+                            __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+                            __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize USS_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw USS_anon'anon'x
+    where readRaw = \ptr_0 -> pure USS_anon'anon'x <*> readRaw (Proxy @"anon'x") ptr_0
+instance WriteRaw USS_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       USS_anon'anon'x anon'x_2 -> writeRaw (Proxy @"anon'x") ptr_0 anon'x_2
+deriving via (EquivStorable USS_anon'anon'x) instance Storable USS_anon'anon'x
+deriving via (IsStructViaReadRaw USS_anon'anon'x) instance IsStruct USS_anon'anon'x
+instance (~) ty USS_anon'anon'x_anon'x =>
+         HasField "anon'x" USS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> USS_anon'anon'x{anon'x = y_1},
+                              getField @"anon'x" x_0)
+instance (~) ty USS_anon'anon'x_anon'x =>
+         HasField "anon'x" (Ptr USS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'x")
+instance HasCField USS_anon'anon'x "anon'x"
+    where type CFieldType USS_anon'anon'x
+                          "anon'x" = USS_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" USS_anon'anon'x ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'x" x_0)
+instance (~) ty CInt => HasField "x" USS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr USS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField USS_anon'anon'x "x"
+    where type CFieldType USS_anon'anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union USS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 23:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USS = USS {unwrap :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize USS
+deriving via (SizedByteArray 4 4) instance ReadRaw USS
+deriving via (SizedByteArray 4 4) instance WriteRaw USS
+deriving via (EquivStorable USS) instance Storable USS
+deriving via (SizedByteArray 4 4) instance IsUnion USS
+instance (~) ty USS_anon'anon'x => HasField "anon'anon'x" USS ty
+    where getField = getUnionPayload
+instance (~) ty USS_anon'anon'x => HasField "anon'anon'x" USS ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"anon'anon'x" x_0)
+instance (~) ty USS_anon'anon'x =>
+         HasField "anon'anon'x" (Ptr USS) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'anon'x")
+instance HasCField USS "anon'anon'x"
+    where type CFieldType USS "anon'anon'x" = USS_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" USS ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'anon'x" x_0)
+instance (~) ty CInt => HasField "x" USS ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr USS) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField USS "x"
+    where type CFieldType USS "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@SUS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 33:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUS_anon'anon'x_anon'x
+    = SUS_anon'anon'x_anon'x {x :: CInt
+                              {- ^ __C declaration:__ @x@
+
+                                   __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+                                   __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SUS_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SUS_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure SUS_anon'anon'x_anon'x <*> readRaw (Proxy @"x") ptr_0
+instance WriteRaw SUS_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SUS_anon'anon'x_anon'x x_2 -> writeRaw (Proxy @"x") ptr_0 x_2
+deriving via (EquivStorable SUS_anon'anon'x_anon'x) instance Storable SUS_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw SUS_anon'anon'x_anon'x) instance IsStruct SUS_anon'anon'x_anon'x
+instance (~) ty CInt => HasField "x" SUS_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> SUS_anon'anon'x_anon'x{x = y_1},
+                              getField @"x" x_0)
+instance (~) ty CInt =>
+         HasField "x" (Ptr SUS_anon'anon'x_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SUS_anon'anon'x_anon'x "x"
+    where type CFieldType SUS_anon'anon'x_anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@SUS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUS_anon'anon'x
+    = SUS_anon'anon'x {unwrap :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize SUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance ReadRaw SUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance WriteRaw SUS_anon'anon'x
+deriving via (EquivStorable SUS_anon'anon'x) instance Storable SUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance IsUnion SUS_anon'anon'x
+instance (~) ty SUS_anon'anon'x_anon'x =>
+         HasField "anon'x" SUS_anon'anon'x ty
+    where getField = getUnionPayload
+instance (~) ty SUS_anon'anon'x_anon'x =>
+         HasField "anon'x" SUS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"anon'x" x_0)
+instance (~) ty SUS_anon'anon'x_anon'x =>
+         HasField "anon'x" (Ptr SUS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'x")
+instance HasCField SUS_anon'anon'x "anon'x"
+    where type CFieldType SUS_anon'anon'x
+                          "anon'x" = SUS_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" SUS_anon'anon'x ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'x" x_0)
+instance (~) ty CInt => HasField "x" SUS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr SUS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SUS_anon'anon'x "x"
+    where type CFieldType SUS_anon'anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct SUS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 31:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUS
+    = SUS {anon'anon'x :: SUS_anon'anon'x
+           {- ^ __C declaration:__ @anon\'anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+           -}}
+    deriving stock Generic
+instance StaticSize SUS
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SUS
+    where readRaw = \ptr_0 -> pure SUS <*> readRaw (Proxy @"anon'anon'x") ptr_0
+instance WriteRaw SUS
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SUS anon'anon'x_2 -> writeRaw (Proxy @"anon'anon'x") ptr_0 anon'anon'x_2
+deriving via (EquivStorable SUS) instance Storable SUS
+deriving via (IsStructViaReadRaw SUS) instance IsStruct SUS
+instance (~) ty SUS_anon'anon'x => HasField "anon'anon'x" SUS ty
+    where hasField = \x_0 -> (\y_1 -> SUS{anon'anon'x = y_1},
+                              getField @"anon'anon'x" x_0)
+instance (~) ty SUS_anon'anon'x =>
+         HasField "anon'anon'x" (Ptr SUS) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'anon'x")
+instance HasCField SUS "anon'anon'x"
+    where type CFieldType SUS "anon'anon'x" = SUS_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" SUS ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'anon'x" x_0)
+instance (~) ty CInt => HasField "x" SUS ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr SUS) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SUS "x"
+    where type CFieldType SUS "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@UUS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 41:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data UUS_anon'anon'x_anon'x
+    = UUS_anon'anon'x_anon'x {x :: CInt
+                              {- ^ __C declaration:__ @x@
+
+                                   __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+                                   __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UUS_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UUS_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure UUS_anon'anon'x_anon'x <*> readRaw (Proxy @"x") ptr_0
+instance WriteRaw UUS_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UUS_anon'anon'x_anon'x x_2 -> writeRaw (Proxy @"x") ptr_0 x_2
+deriving via (EquivStorable UUS_anon'anon'x_anon'x) instance Storable UUS_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw UUS_anon'anon'x_anon'x) instance IsStruct UUS_anon'anon'x_anon'x
+instance (~) ty CInt => HasField "x" UUS_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> UUS_anon'anon'x_anon'x{x = y_1},
+                              getField @"x" x_0)
+instance (~) ty CInt =>
+         HasField "x" (Ptr UUS_anon'anon'x_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField UUS_anon'anon'x_anon'x "x"
+    where type CFieldType UUS_anon'anon'x_anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@UUS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 40:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUS_anon'anon'x
+    = UUS_anon'anon'x {unwrap :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize UUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance ReadRaw UUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance WriteRaw UUS_anon'anon'x
+deriving via (EquivStorable UUS_anon'anon'x) instance Storable UUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance IsUnion UUS_anon'anon'x
+instance (~) ty UUS_anon'anon'x_anon'x =>
+         HasField "anon'x" UUS_anon'anon'x ty
+    where getField = getUnionPayload
+instance (~) ty UUS_anon'anon'x_anon'x =>
+         HasField "anon'x" UUS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"anon'x" x_0)
+instance (~) ty UUS_anon'anon'x_anon'x =>
+         HasField "anon'x" (Ptr UUS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'x")
+instance HasCField UUS_anon'anon'x "anon'x"
+    where type CFieldType UUS_anon'anon'x
+                          "anon'x" = UUS_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" UUS_anon'anon'x ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'x" x_0)
+instance (~) ty CInt => HasField "x" UUS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr UUS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField UUS_anon'anon'x "x"
+    where type CFieldType UUS_anon'anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union UUS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 39:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUS = UUS {unwrap :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize UUS
+deriving via (SizedByteArray 4 4) instance ReadRaw UUS
+deriving via (SizedByteArray 4 4) instance WriteRaw UUS
+deriving via (EquivStorable UUS) instance Storable UUS
+deriving via (SizedByteArray 4 4) instance IsUnion UUS
+instance (~) ty UUS_anon'anon'x => HasField "anon'anon'x" UUS ty
+    where getField = getUnionPayload
+instance (~) ty UUS_anon'anon'x => HasField "anon'anon'x" UUS ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"anon'anon'x" x_0)
+instance (~) ty UUS_anon'anon'x =>
+         HasField "anon'anon'x" (Ptr UUS) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'anon'x")
+instance HasCField UUS "anon'anon'x"
+    where type CFieldType UUS "anon'anon'x" = UUS_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" UUS ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'anon'x" x_0)
+instance (~) ty CInt => HasField "x" UUS ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr UUS) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField UUS "x"
+    where type CFieldType UUS "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@SSU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SSU_anon'anon'x_anon'x
+    = SSU_anon'anon'x_anon'x {unwrap :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize SSU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw SSU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw SSU_anon'anon'x_anon'x
+deriving via (EquivStorable SSU_anon'anon'x_anon'x) instance Storable SSU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance IsUnion SSU_anon'anon'x_anon'x
+instance (~) ty CInt => HasField "x" SSU_anon'anon'x_anon'x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "x" SSU_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"x" x_0)
+instance (~) ty CInt =>
+         HasField "x" (Ptr SSU_anon'anon'x_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SSU_anon'anon'x_anon'x "x"
+    where type CFieldType SSU_anon'anon'x_anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@SSU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSU_anon'anon'x
+    = SSU_anon'anon'x {anon'x :: SSU_anon'anon'x_anon'x
+                       {- ^ __C declaration:__ @anon\'x@
+
+                            __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+                            __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                       -}}
+    deriving stock Generic
+instance StaticSize SSU_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSU_anon'anon'x
+    where readRaw = \ptr_0 -> pure SSU_anon'anon'x <*> readRaw (Proxy @"anon'x") ptr_0
+instance WriteRaw SSU_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSU_anon'anon'x anon'x_2 -> writeRaw (Proxy @"anon'x") ptr_0 anon'x_2
+deriving via (EquivStorable SSU_anon'anon'x) instance Storable SSU_anon'anon'x
+deriving via (IsStructViaReadRaw SSU_anon'anon'x) instance IsStruct SSU_anon'anon'x
+instance (~) ty SSU_anon'anon'x_anon'x =>
+         HasField "anon'x" SSU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> SSU_anon'anon'x{anon'x = y_1},
+                              getField @"anon'x" x_0)
+instance (~) ty SSU_anon'anon'x_anon'x =>
+         HasField "anon'x" (Ptr SSU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'x")
+instance HasCField SSU_anon'anon'x "anon'x"
+    where type CFieldType SSU_anon'anon'x
+                          "anon'x" = SSU_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" SSU_anon'anon'x ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'x" x_0)
+instance (~) ty CInt => HasField "x" SSU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr SSU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SSU_anon'anon'x "x"
+    where type CFieldType SSU_anon'anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct SSU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 47:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSU
+    = SSU {anon'anon'x :: SSU_anon'anon'x
+           {- ^ __C declaration:__ @anon\'anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+           -}}
+    deriving stock Generic
+instance StaticSize SSU
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSU
+    where readRaw = \ptr_0 -> pure SSU <*> readRaw (Proxy @"anon'anon'x") ptr_0
+instance WriteRaw SSU
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSU anon'anon'x_2 -> writeRaw (Proxy @"anon'anon'x") ptr_0 anon'anon'x_2
+deriving via (EquivStorable SSU) instance Storable SSU
+deriving via (IsStructViaReadRaw SSU) instance IsStruct SSU
+instance (~) ty SSU_anon'anon'x => HasField "anon'anon'x" SSU ty
+    where hasField = \x_0 -> (\y_1 -> SSU{anon'anon'x = y_1},
+                              getField @"anon'anon'x" x_0)
+instance (~) ty SSU_anon'anon'x =>
+         HasField "anon'anon'x" (Ptr SSU) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'anon'x")
+instance HasCField SSU "anon'anon'x"
+    where type CFieldType SSU "anon'anon'x" = SSU_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" SSU ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'anon'x" x_0)
+instance (~) ty CInt => HasField "x" SSU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr SSU) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SSU "x"
+    where type CFieldType SSU "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@USU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USU_anon'anon'x_anon'x
+    = USU_anon'anon'x_anon'x {unwrap :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize USU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw USU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw USU_anon'anon'x_anon'x
+deriving via (EquivStorable USU_anon'anon'x_anon'x) instance Storable USU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance IsUnion USU_anon'anon'x_anon'x
+instance (~) ty CInt => HasField "x" USU_anon'anon'x_anon'x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "x" USU_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"x" x_0)
+instance (~) ty CInt =>
+         HasField "x" (Ptr USU_anon'anon'x_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField USU_anon'anon'x_anon'x "x"
+    where type CFieldType USU_anon'anon'x_anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@USU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 56:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USU_anon'anon'x
+    = USU_anon'anon'x {anon'x :: USU_anon'anon'x_anon'x
+                       {- ^ __C declaration:__ @anon\'x@
+
+                            __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+                            __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                       -}}
+    deriving stock Generic
+instance StaticSize USU_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw USU_anon'anon'x
+    where readRaw = \ptr_0 -> pure USU_anon'anon'x <*> readRaw (Proxy @"anon'x") ptr_0
+instance WriteRaw USU_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       USU_anon'anon'x anon'x_2 -> writeRaw (Proxy @"anon'x") ptr_0 anon'x_2
+deriving via (EquivStorable USU_anon'anon'x) instance Storable USU_anon'anon'x
+deriving via (IsStructViaReadRaw USU_anon'anon'x) instance IsStruct USU_anon'anon'x
+instance (~) ty USU_anon'anon'x_anon'x =>
+         HasField "anon'x" USU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> USU_anon'anon'x{anon'x = y_1},
+                              getField @"anon'x" x_0)
+instance (~) ty USU_anon'anon'x_anon'x =>
+         HasField "anon'x" (Ptr USU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'x")
+instance HasCField USU_anon'anon'x "anon'x"
+    where type CFieldType USU_anon'anon'x
+                          "anon'x" = USU_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" USU_anon'anon'x ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'x" x_0)
+instance (~) ty CInt => HasField "x" USU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr USU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField USU_anon'anon'x "x"
+    where type CFieldType USU_anon'anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union USU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 55:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USU = USU {unwrap :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize USU
+deriving via (SizedByteArray 4 4) instance ReadRaw USU
+deriving via (SizedByteArray 4 4) instance WriteRaw USU
+deriving via (EquivStorable USU) instance Storable USU
+deriving via (SizedByteArray 4 4) instance IsUnion USU
+instance (~) ty USU_anon'anon'x => HasField "anon'anon'x" USU ty
+    where getField = getUnionPayload
+instance (~) ty USU_anon'anon'x => HasField "anon'anon'x" USU ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"anon'anon'x" x_0)
+instance (~) ty USU_anon'anon'x =>
+         HasField "anon'anon'x" (Ptr USU) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'anon'x")
+instance HasCField USU "anon'anon'x"
+    where type CFieldType USU "anon'anon'x" = USU_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" USU ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'anon'x" x_0)
+instance (~) ty CInt => HasField "x" USU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr USU) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField USU "x"
+    where type CFieldType USU "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@SUU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 65:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUU_anon'anon'x_anon'x
+    = SUU_anon'anon'x_anon'x {unwrap :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize SUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw SUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw SUU_anon'anon'x_anon'x
+deriving via (EquivStorable SUU_anon'anon'x_anon'x) instance Storable SUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance IsUnion SUU_anon'anon'x_anon'x
+instance (~) ty CInt => HasField "x" SUU_anon'anon'x_anon'x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "x" SUU_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"x" x_0)
+instance (~) ty CInt =>
+         HasField "x" (Ptr SUU_anon'anon'x_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SUU_anon'anon'x_anon'x "x"
+    where type CFieldType SUU_anon'anon'x_anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@SUU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUU_anon'anon'x
+    = SUU_anon'anon'x {unwrap :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize SUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance ReadRaw SUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance WriteRaw SUU_anon'anon'x
+deriving via (EquivStorable SUU_anon'anon'x) instance Storable SUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance IsUnion SUU_anon'anon'x
+instance (~) ty SUU_anon'anon'x_anon'x =>
+         HasField "anon'x" SUU_anon'anon'x ty
+    where getField = getUnionPayload
+instance (~) ty SUU_anon'anon'x_anon'x =>
+         HasField "anon'x" SUU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"anon'x" x_0)
+instance (~) ty SUU_anon'anon'x_anon'x =>
+         HasField "anon'x" (Ptr SUU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'x")
+instance HasCField SUU_anon'anon'x "anon'x"
+    where type CFieldType SUU_anon'anon'x
+                          "anon'x" = SUU_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" SUU_anon'anon'x ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'x" x_0)
+instance (~) ty CInt => HasField "x" SUU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr SUU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SUU_anon'anon'x "x"
+    where type CFieldType SUU_anon'anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct SUU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 63:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUU
+    = SUU {anon'anon'x :: SUU_anon'anon'x
+           {- ^ __C declaration:__ @anon\'anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+           -}}
+    deriving stock Generic
+instance StaticSize SUU
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SUU
+    where readRaw = \ptr_0 -> pure SUU <*> readRaw (Proxy @"anon'anon'x") ptr_0
+instance WriteRaw SUU
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SUU anon'anon'x_2 -> writeRaw (Proxy @"anon'anon'x") ptr_0 anon'anon'x_2
+deriving via (EquivStorable SUU) instance Storable SUU
+deriving via (IsStructViaReadRaw SUU) instance IsStruct SUU
+instance (~) ty SUU_anon'anon'x => HasField "anon'anon'x" SUU ty
+    where hasField = \x_0 -> (\y_1 -> SUU{anon'anon'x = y_1},
+                              getField @"anon'anon'x" x_0)
+instance (~) ty SUU_anon'anon'x =>
+         HasField "anon'anon'x" (Ptr SUU) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'anon'x")
+instance HasCField SUU "anon'anon'x"
+    where type CFieldType SUU "anon'anon'x" = SUU_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" SUU ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'anon'x" x_0)
+instance (~) ty CInt => HasField "x" SUU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr SUU) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField SUU "x"
+    where type CFieldType SUU "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@UUU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 73:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU_anon'anon'x_anon'x
+    = UUU_anon'anon'x_anon'x {unwrap :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize UUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw UUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw UUU_anon'anon'x_anon'x
+deriving via (EquivStorable UUU_anon'anon'x_anon'x) instance Storable UUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance IsUnion UUU_anon'anon'x_anon'x
+instance (~) ty CInt => HasField "x" UUU_anon'anon'x_anon'x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "x" UUU_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"x" x_0)
+instance (~) ty CInt =>
+         HasField "x" (Ptr UUU_anon'anon'x_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField UUU_anon'anon'x_anon'x "x"
+    where type CFieldType UUU_anon'anon'x_anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@UUU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 72:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU_anon'anon'x
+    = UUU_anon'anon'x {unwrap :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize UUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance ReadRaw UUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance WriteRaw UUU_anon'anon'x
+deriving via (EquivStorable UUU_anon'anon'x) instance Storable UUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance IsUnion UUU_anon'anon'x
+instance (~) ty UUU_anon'anon'x_anon'x =>
+         HasField "anon'x" UUU_anon'anon'x ty
+    where getField = getUnionPayload
+instance (~) ty UUU_anon'anon'x_anon'x =>
+         HasField "anon'x" UUU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"anon'x" x_0)
+instance (~) ty UUU_anon'anon'x_anon'x =>
+         HasField "anon'x" (Ptr UUU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'x")
+instance HasCField UUU_anon'anon'x "anon'x"
+    where type CFieldType UUU_anon'anon'x
+                          "anon'x" = UUU_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" UUU_anon'anon'x ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'x" x_0)
+instance (~) ty CInt => HasField "x" UUU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr UUU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField UUU_anon'anon'x "x"
+    where type CFieldType UUU_anon'anon'x "x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union UUU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 71:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU = UUU {unwrap :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize UUU
+deriving via (SizedByteArray 4 4) instance ReadRaw UUU
+deriving via (SizedByteArray 4 4) instance WriteRaw UUU
+deriving via (EquivStorable UUU) instance Storable UUU
+deriving via (SizedByteArray 4 4) instance IsUnion UUU
+instance (~) ty UUU_anon'anon'x => HasField "anon'anon'x" UUU ty
+    where getField = getUnionPayload
+instance (~) ty UUU_anon'anon'x => HasField "anon'anon'x" UUU ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"anon'anon'x" x_0)
+instance (~) ty UUU_anon'anon'x =>
+         HasField "anon'anon'x" (Ptr UUU) (Ptr ty)
+    where getField = fromPtr (Proxy @"anon'anon'x")
+instance HasCField UUU "anon'anon'x"
+    where type CFieldType UUU "anon'anon'x" = UUU_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "x" UUU ty
+    where getField = \x_0 -> getField @"x" (getField @"anon'anon'x" x_0)
+instance (~) ty CInt => HasField "x" UUU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"anon'anon'x" x_0 (\z_2 -> setField @"x" z_2 y_1),
+                              getField @"x" x_0)
+instance (~) ty CInt => HasField "x" (Ptr UUU) (Ptr ty)
+    where getField = fromPtr (Proxy @"x")
+instance HasCField UUU "x"
+    where type CFieldType UUU "x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting/Example.hs b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting/Example.hs
@@ -0,0 +1,2258 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.SSS_anon'anon'x_anon'x(..)
+    , Example.SSS_anon'anon'x(..)
+    , Example.SSS(..)
+    , Example.USS_anon'anon'x_anon'x(..)
+    , Example.USS_anon'anon'x(..)
+    , Example.USS(..)
+    , Example.SUS_anon'anon'x_anon'x(..)
+    , Example.SUS_anon'anon'x(..)
+    , Example.SUS(..)
+    , Example.UUS_anon'anon'x_anon'x(..)
+    , Example.UUS_anon'anon'x(..)
+    , Example.UUS(..)
+    , Example.SSU_anon'anon'x_anon'x(..)
+    , Example.SSU_anon'anon'x(..)
+    , Example.SSU(..)
+    , Example.USU_anon'anon'x_anon'x(..)
+    , Example.USU_anon'anon'x(..)
+    , Example.USU(..)
+    , Example.SUU_anon'anon'x_anon'x(..)
+    , Example.SUU_anon'anon'x(..)
+    , Example.SUU(..)
+    , Example.UUU_anon'anon'x_anon'x(..)
+    , Example.UUU_anon'anon'x(..)
+    , Example.UUU(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@SSS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS_anon'anon'x_anon'x = SSS_anon'anon'x_anon'x
+  { sSS_anon'anon'x_anon'x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SSS_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSS_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure SSS_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"sSS_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw SSS_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSS_anon'anon'x_anon'x sSS_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"sSS_anon'anon'x_anon'x_x") ptr0 sSS_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable SSS_anon'anon'x_anon'x instance BG.Storable SSS_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw SSS_anon'anon'x_anon'x instance Struct.IsStruct SSS_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sSS_anon'anon'x_anon'x_x" SSS_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SSS_anon'anon'x_anon'x {sSS_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"sSS_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sSS_anon'anon'x_anon'x_x" (BG.Ptr SSS_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sSS_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField SSS_anon'anon'x_anon'x "sSS_anon'anon'x_anon'x_x" where
+
+  type CFieldType SSS_anon'anon'x_anon'x "sSS_anon'anon'x_anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@SSS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS_anon'anon'x = SSS_anon'anon'x
+  { sSS_anon'anon'x_anon'x :: SSS_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SSS_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSS_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure SSS_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"sSS_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw SSS_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSS_anon'anon'x sSS_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"sSS_anon'anon'x_anon'x") ptr0 sSS_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable SSS_anon'anon'x instance BG.Storable SSS_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw SSS_anon'anon'x instance Struct.IsStruct SSS_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SSS_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "sSS_anon'anon'x_anon'x" SSS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SSS_anon'anon'x {sSS_anon'anon'x_anon'x = y1}
+      , BG.getField @"sSS_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ SSS_anon'anon'x_anon'x
+         ) => BG.HasField "sSS_anon'anon'x_anon'x" (BG.Ptr SSS_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sSS_anon'anon'x_anon'x")
+
+instance HasCField.HasCField SSS_anon'anon'x "sSS_anon'anon'x_anon'x" where
+
+  type CFieldType SSS_anon'anon'x "sSS_anon'anon'x_anon'x" =
+    SSS_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sSS_anon'anon'x_x" SSS_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sSS_anon'anon'x_anon'x_x" (BG.getField @"sSS_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sSS_anon'anon'x_x" SSS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sSS_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                        BG.CompatHasField.setField @"sSS_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"sSS_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sSS_anon'anon'x_x" (BG.Ptr SSS_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sSS_anon'anon'x_x")
+
+instance HasCField.HasCField SSS_anon'anon'x "sSS_anon'anon'x_x" where
+
+  type CFieldType SSS_anon'anon'x "sSS_anon'anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct SSS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 15:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS = SSS
+  { sSS_anon'anon'x :: SSS_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SSS where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSS where
+
+  readRaw =
+    \ptr0 ->
+          pure SSS
+      <*> HasCField.readRaw (BG.Proxy @"sSS_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw SSS where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSS sSS_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"sSS_anon'anon'x") ptr0 sSS_anon'anon'x2
+
+deriving via Marshal.EquivStorable SSS instance BG.Storable SSS
+
+deriving via Struct.IsStructViaReadRaw SSS instance Struct.IsStruct SSS
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SSS_anon'anon'x
+         ) => BG.CompatHasField.HasField "sSS_anon'anon'x" SSS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SSS {sSS_anon'anon'x = y1}, BG.getField @"sSS_anon'anon'x" x0)
+
+instance ( ty ~ SSS_anon'anon'x
+         ) => BG.HasField "sSS_anon'anon'x" (BG.Ptr SSS) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sSS_anon'anon'x")
+
+instance HasCField.HasCField SSS "sSS_anon'anon'x" where
+
+  type CFieldType SSS "sSS_anon'anon'x" =
+    SSS_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "sSS_x" SSS ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sSS_anon'anon'x_x" (BG.getField @"sSS_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "sSS_x" SSS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sSS_anon'anon'x" x0 (\z2 ->
+                                                                 BG.CompatHasField.setField @"sSS_anon'anon'x_x" z2 y1)
+      , BG.getField @"sSS_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "sSS_x" (BG.Ptr SSS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sSS_x")
+
+instance HasCField.HasCField SSS "sSS_x" where
+
+  type CFieldType SSS "sSS_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@USS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USS_anon'anon'x_anon'x = USS_anon'anon'x_anon'x
+  { uSS_anon'anon'x_anon'x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize USS_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw USS_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure USS_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"uSS_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw USS_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          USS_anon'anon'x_anon'x uSS_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"uSS_anon'anon'x_anon'x_x") ptr0 uSS_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable USS_anon'anon'x_anon'x instance BG.Storable USS_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw USS_anon'anon'x_anon'x instance Struct.IsStruct USS_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uSS_anon'anon'x_anon'x_x" USS_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          USS_anon'anon'x_anon'x {uSS_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"uSS_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uSS_anon'anon'x_anon'x_x" (BG.Ptr USS_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uSS_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField USS_anon'anon'x_anon'x "uSS_anon'anon'x_anon'x_x" where
+
+  type CFieldType USS_anon'anon'x_anon'x "uSS_anon'anon'x_anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@USS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USS_anon'anon'x = USS_anon'anon'x
+  { uSS_anon'anon'x_anon'x :: USS_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize USS_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw USS_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure USS_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"uSS_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw USS_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          USS_anon'anon'x uSS_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"uSS_anon'anon'x_anon'x") ptr0 uSS_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable USS_anon'anon'x instance BG.Storable USS_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw USS_anon'anon'x instance Struct.IsStruct USS_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ USS_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "uSS_anon'anon'x_anon'x" USS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          USS_anon'anon'x {uSS_anon'anon'x_anon'x = y1}
+      , BG.getField @"uSS_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ USS_anon'anon'x_anon'x
+         ) => BG.HasField "uSS_anon'anon'x_anon'x" (BG.Ptr USS_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uSS_anon'anon'x_anon'x")
+
+instance HasCField.HasCField USS_anon'anon'x "uSS_anon'anon'x_anon'x" where
+
+  type CFieldType USS_anon'anon'x "uSS_anon'anon'x_anon'x" =
+    USS_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uSS_anon'anon'x_x" USS_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uSS_anon'anon'x_anon'x_x" (BG.getField @"uSS_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uSS_anon'anon'x_x" USS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uSS_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                        BG.CompatHasField.setField @"uSS_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"uSS_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uSS_anon'anon'x_x" (BG.Ptr USS_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uSS_anon'anon'x_x")
+
+instance HasCField.HasCField USS_anon'anon'x "uSS_anon'anon'x_x" where
+
+  type CFieldType USS_anon'anon'x "uSS_anon'anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union USS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 23:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USS = USS
+  { unwrapUSS :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize USS
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw USS
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw USS
+
+deriving via Marshal.EquivStorable USS instance BG.Storable USS
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion USS
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ USS_anon'anon'x) => BG.HasField "uSS_anon'anon'x" USS ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ USS_anon'anon'x
+         ) => BG.CompatHasField.HasField "uSS_anon'anon'x" USS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uSS_anon'anon'x" x0)
+
+instance ( ty ~ USS_anon'anon'x
+         ) => BG.HasField "uSS_anon'anon'x" (BG.Ptr USS) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uSS_anon'anon'x")
+
+instance HasCField.HasCField USS "uSS_anon'anon'x" where
+
+  type CFieldType USS "uSS_anon'anon'x" =
+    USS_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "uSS_x" USS ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uSS_anon'anon'x_x" (BG.getField @"uSS_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "uSS_x" USS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uSS_anon'anon'x" x0 (\z2 ->
+                                                                 BG.CompatHasField.setField @"uSS_anon'anon'x_x" z2 y1)
+      , BG.getField @"uSS_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "uSS_x" (BG.Ptr USS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uSS_x")
+
+instance HasCField.HasCField USS "uSS_x" where
+
+  type CFieldType USS "uSS_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@SUS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 33:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUS_anon'anon'x_anon'x = SUS_anon'anon'x_anon'x
+  { sUS_anon'anon'x_anon'x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SUS_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SUS_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure SUS_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"sUS_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw SUS_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SUS_anon'anon'x_anon'x sUS_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"sUS_anon'anon'x_anon'x_x") ptr0 sUS_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable SUS_anon'anon'x_anon'x instance BG.Storable SUS_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw SUS_anon'anon'x_anon'x instance Struct.IsStruct SUS_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sUS_anon'anon'x_anon'x_x" SUS_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SUS_anon'anon'x_anon'x {sUS_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"sUS_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sUS_anon'anon'x_anon'x_x" (BG.Ptr SUS_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sUS_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField SUS_anon'anon'x_anon'x "sUS_anon'anon'x_anon'x_x" where
+
+  type CFieldType SUS_anon'anon'x_anon'x "sUS_anon'anon'x_anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@SUS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUS_anon'anon'x = SUS_anon'anon'x
+  { unwrapSUS_anon'anon'x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize SUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw SUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw SUS_anon'anon'x
+
+deriving via Marshal.EquivStorable SUS_anon'anon'x instance BG.Storable SUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion SUS_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 33:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUS_anon'anon'x_anon'x
+         ) => BG.HasField "sUS_anon'anon'x_anon'x" SUS_anon'anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 33:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUS_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "sUS_anon'anon'x_anon'x" SUS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"sUS_anon'anon'x_anon'x" x0)
+
+instance ( ty ~ SUS_anon'anon'x_anon'x
+         ) => BG.HasField "sUS_anon'anon'x_anon'x" (BG.Ptr SUS_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sUS_anon'anon'x_anon'x")
+
+instance HasCField.HasCField SUS_anon'anon'x "sUS_anon'anon'x_anon'x" where
+
+  type CFieldType SUS_anon'anon'x "sUS_anon'anon'x_anon'x" =
+    SUS_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sUS_anon'anon'x_x" SUS_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sUS_anon'anon'x_anon'x_x" (BG.getField @"sUS_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sUS_anon'anon'x_x" SUS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sUS_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                        BG.CompatHasField.setField @"sUS_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"sUS_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sUS_anon'anon'x_x" (BG.Ptr SUS_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sUS_anon'anon'x_x")
+
+instance HasCField.HasCField SUS_anon'anon'x "sUS_anon'anon'x_x" where
+
+  type CFieldType SUS_anon'anon'x "sUS_anon'anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct SUS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 31:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUS = SUS
+  { sUS_anon'anon'x :: SUS_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize SUS where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SUS where
+
+  readRaw =
+    \ptr0 ->
+          pure SUS
+      <*> HasCField.readRaw (BG.Proxy @"sUS_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw SUS where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SUS sUS_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"sUS_anon'anon'x") ptr0 sUS_anon'anon'x2
+
+deriving via Marshal.EquivStorable SUS instance BG.Storable SUS
+
+deriving via Struct.IsStructViaReadRaw SUS instance Struct.IsStruct SUS
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUS_anon'anon'x
+         ) => BG.CompatHasField.HasField "sUS_anon'anon'x" SUS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SUS {sUS_anon'anon'x = y1}, BG.getField @"sUS_anon'anon'x" x0)
+
+instance ( ty ~ SUS_anon'anon'x
+         ) => BG.HasField "sUS_anon'anon'x" (BG.Ptr SUS) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sUS_anon'anon'x")
+
+instance HasCField.HasCField SUS "sUS_anon'anon'x" where
+
+  type CFieldType SUS "sUS_anon'anon'x" =
+    SUS_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "sUS_x" SUS ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sUS_anon'anon'x_x" (BG.getField @"sUS_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "sUS_x" SUS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sUS_anon'anon'x" x0 (\z2 ->
+                                                                 BG.CompatHasField.setField @"sUS_anon'anon'x_x" z2 y1)
+      , BG.getField @"sUS_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "sUS_x" (BG.Ptr SUS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sUS_x")
+
+instance HasCField.HasCField SUS "sUS_x" where
+
+  type CFieldType SUS "sUS_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@UUS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 41:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data UUS_anon'anon'x_anon'x = UUS_anon'anon'x_anon'x
+  { uUS_anon'anon'x_anon'x_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UUS_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw UUS_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure UUS_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"uUS_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw UUS_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UUS_anon'anon'x_anon'x uUS_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"uUS_anon'anon'x_anon'x_x") ptr0 uUS_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable UUS_anon'anon'x_anon'x instance BG.Storable UUS_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw UUS_anon'anon'x_anon'x instance Struct.IsStruct UUS_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uUS_anon'anon'x_anon'x_x" UUS_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UUS_anon'anon'x_anon'x {uUS_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"uUS_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uUS_anon'anon'x_anon'x_x" (BG.Ptr UUS_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uUS_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField UUS_anon'anon'x_anon'x "uUS_anon'anon'x_anon'x_x" where
+
+  type CFieldType UUS_anon'anon'x_anon'x "uUS_anon'anon'x_anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@UUS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 40:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUS_anon'anon'x = UUS_anon'anon'x
+  { unwrapUUS_anon'anon'x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUS_anon'anon'x
+
+deriving via Marshal.EquivStorable UUS_anon'anon'x instance BG.Storable UUS_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUS_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 41:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUS_anon'anon'x_anon'x
+         ) => BG.HasField "uUS_anon'anon'x_anon'x" UUS_anon'anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 41:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUS_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "uUS_anon'anon'x_anon'x" UUS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uUS_anon'anon'x_anon'x" x0)
+
+instance ( ty ~ UUS_anon'anon'x_anon'x
+         ) => BG.HasField "uUS_anon'anon'x_anon'x" (BG.Ptr UUS_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uUS_anon'anon'x_anon'x")
+
+instance HasCField.HasCField UUS_anon'anon'x "uUS_anon'anon'x_anon'x" where
+
+  type CFieldType UUS_anon'anon'x "uUS_anon'anon'x_anon'x" =
+    UUS_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uUS_anon'anon'x_x" UUS_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uUS_anon'anon'x_anon'x_x" (BG.getField @"uUS_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uUS_anon'anon'x_x" UUS_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uUS_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                        BG.CompatHasField.setField @"uUS_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"uUS_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uUS_anon'anon'x_x" (BG.Ptr UUS_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uUS_anon'anon'x_x")
+
+instance HasCField.HasCField UUS_anon'anon'x "uUS_anon'anon'x_x" where
+
+  type CFieldType UUS_anon'anon'x "uUS_anon'anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union UUS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 39:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUS = UUS
+  { unwrapUUS :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUS
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUS
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUS
+
+deriving via Marshal.EquivStorable UUS instance BG.Storable UUS
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUS
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 40:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ UUS_anon'anon'x) => BG.HasField "uUS_anon'anon'x" UUS ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 40:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUS_anon'anon'x
+         ) => BG.CompatHasField.HasField "uUS_anon'anon'x" UUS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uUS_anon'anon'x" x0)
+
+instance ( ty ~ UUS_anon'anon'x
+         ) => BG.HasField "uUS_anon'anon'x" (BG.Ptr UUS) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uUS_anon'anon'x")
+
+instance HasCField.HasCField UUS "uUS_anon'anon'x" where
+
+  type CFieldType UUS "uUS_anon'anon'x" =
+    UUS_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "uUS_x" UUS ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uUS_anon'anon'x_x" (BG.getField @"uUS_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "uUS_x" UUS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uUS_anon'anon'x" x0 (\z2 ->
+                                                                 BG.CompatHasField.setField @"uUS_anon'anon'x_x" z2 y1)
+      , BG.getField @"uUS_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "uUS_x" (BG.Ptr UUS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uUS_x")
+
+instance HasCField.HasCField UUS "uUS_x" where
+
+  type CFieldType UUS "uUS_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@SSU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SSU_anon'anon'x_anon'x = SSU_anon'anon'x_anon'x
+  { unwrapSSU_anon'anon'x_anon'x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize SSU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw SSU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw SSU_anon'anon'x_anon'x
+
+deriving via Marshal.EquivStorable SSU_anon'anon'x_anon'x instance BG.Storable SSU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion SSU_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sSU_anon'anon'x_anon'x_x" SSU_anon'anon'x_anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sSU_anon'anon'x_anon'x_x" SSU_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"sSU_anon'anon'x_anon'x_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sSU_anon'anon'x_anon'x_x" (BG.Ptr SSU_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sSU_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField SSU_anon'anon'x_anon'x "sSU_anon'anon'x_anon'x_x" where
+
+  type CFieldType SSU_anon'anon'x_anon'x "sSU_anon'anon'x_anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@SSU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSU_anon'anon'x = SSU_anon'anon'x
+  { sSU_anon'anon'x_anon'x :: SSU_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize SSU_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSU_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure SSU_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"sSU_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw SSU_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSU_anon'anon'x sSU_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"sSU_anon'anon'x_anon'x") ptr0 sSU_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable SSU_anon'anon'x instance BG.Storable SSU_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw SSU_anon'anon'x instance Struct.IsStruct SSU_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SSU_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "sSU_anon'anon'x_anon'x" SSU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SSU_anon'anon'x {sSU_anon'anon'x_anon'x = y1}
+      , BG.getField @"sSU_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ SSU_anon'anon'x_anon'x
+         ) => BG.HasField "sSU_anon'anon'x_anon'x" (BG.Ptr SSU_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sSU_anon'anon'x_anon'x")
+
+instance HasCField.HasCField SSU_anon'anon'x "sSU_anon'anon'x_anon'x" where
+
+  type CFieldType SSU_anon'anon'x "sSU_anon'anon'x_anon'x" =
+    SSU_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sSU_anon'anon'x_x" SSU_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sSU_anon'anon'x_anon'x_x" (BG.getField @"sSU_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sSU_anon'anon'x_x" SSU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sSU_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                        BG.CompatHasField.setField @"sSU_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"sSU_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sSU_anon'anon'x_x" (BG.Ptr SSU_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sSU_anon'anon'x_x")
+
+instance HasCField.HasCField SSU_anon'anon'x "sSU_anon'anon'x_x" where
+
+  type CFieldType SSU_anon'anon'x "sSU_anon'anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct SSU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 47:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSU = SSU
+  { sSU_anon'anon'x :: SSU_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize SSU where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SSU where
+
+  readRaw =
+    \ptr0 ->
+          pure SSU
+      <*> HasCField.readRaw (BG.Proxy @"sSU_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw SSU where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SSU sSU_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"sSU_anon'anon'x") ptr0 sSU_anon'anon'x2
+
+deriving via Marshal.EquivStorable SSU instance BG.Storable SSU
+
+deriving via Struct.IsStructViaReadRaw SSU instance Struct.IsStruct SSU
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SSU_anon'anon'x
+         ) => BG.CompatHasField.HasField "sSU_anon'anon'x" SSU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SSU {sSU_anon'anon'x = y1}, BG.getField @"sSU_anon'anon'x" x0)
+
+instance ( ty ~ SSU_anon'anon'x
+         ) => BG.HasField "sSU_anon'anon'x" (BG.Ptr SSU) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sSU_anon'anon'x")
+
+instance HasCField.HasCField SSU "sSU_anon'anon'x" where
+
+  type CFieldType SSU "sSU_anon'anon'x" =
+    SSU_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "sSU_x" SSU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sSU_anon'anon'x_x" (BG.getField @"sSU_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 50:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "sSU_x" SSU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sSU_anon'anon'x" x0 (\z2 ->
+                                                                 BG.CompatHasField.setField @"sSU_anon'anon'x_x" z2 y1)
+      , BG.getField @"sSU_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "sSU_x" (BG.Ptr SSU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sSU_x")
+
+instance HasCField.HasCField SSU "sSU_x" where
+
+  type CFieldType SSU "sSU_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@USU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USU_anon'anon'x_anon'x = USU_anon'anon'x_anon'x
+  { unwrapUSU_anon'anon'x_anon'x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize USU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw USU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw USU_anon'anon'x_anon'x
+
+deriving via Marshal.EquivStorable USU_anon'anon'x_anon'x instance BG.Storable USU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion USU_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uSU_anon'anon'x_anon'x_x" USU_anon'anon'x_anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uSU_anon'anon'x_anon'x_x" USU_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uSU_anon'anon'x_anon'x_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uSU_anon'anon'x_anon'x_x" (BG.Ptr USU_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uSU_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField USU_anon'anon'x_anon'x "uSU_anon'anon'x_anon'x_x" where
+
+  type CFieldType USU_anon'anon'x_anon'x "uSU_anon'anon'x_anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@USU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 56:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USU_anon'anon'x = USU_anon'anon'x
+  { uSU_anon'anon'x_anon'x :: USU_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize USU_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw USU_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure USU_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"uSU_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw USU_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          USU_anon'anon'x uSU_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"uSU_anon'anon'x_anon'x") ptr0 uSU_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable USU_anon'anon'x instance BG.Storable USU_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw USU_anon'anon'x instance Struct.IsStruct USU_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ USU_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "uSU_anon'anon'x_anon'x" USU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          USU_anon'anon'x {uSU_anon'anon'x_anon'x = y1}
+      , BG.getField @"uSU_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ USU_anon'anon'x_anon'x
+         ) => BG.HasField "uSU_anon'anon'x_anon'x" (BG.Ptr USU_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uSU_anon'anon'x_anon'x")
+
+instance HasCField.HasCField USU_anon'anon'x "uSU_anon'anon'x_anon'x" where
+
+  type CFieldType USU_anon'anon'x "uSU_anon'anon'x_anon'x" =
+    USU_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uSU_anon'anon'x_x" USU_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uSU_anon'anon'x_anon'x_x" (BG.getField @"uSU_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uSU_anon'anon'x_x" USU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uSU_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                        BG.CompatHasField.setField @"uSU_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"uSU_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uSU_anon'anon'x_x" (BG.Ptr USU_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uSU_anon'anon'x_x")
+
+instance HasCField.HasCField USU_anon'anon'x "uSU_anon'anon'x_x" where
+
+  type CFieldType USU_anon'anon'x "uSU_anon'anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union USU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 55:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USU = USU
+  { unwrapUSU :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize USU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw USU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw USU
+
+deriving via Marshal.EquivStorable USU instance BG.Storable USU
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion USU
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 56:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ USU_anon'anon'x) => BG.HasField "uSU_anon'anon'x" USU ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 56:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ USU_anon'anon'x
+         ) => BG.CompatHasField.HasField "uSU_anon'anon'x" USU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uSU_anon'anon'x" x0)
+
+instance ( ty ~ USU_anon'anon'x
+         ) => BG.HasField "uSU_anon'anon'x" (BG.Ptr USU) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uSU_anon'anon'x")
+
+instance HasCField.HasCField USU "uSU_anon'anon'x" where
+
+  type CFieldType USU "uSU_anon'anon'x" =
+    USU_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "uSU_x" USU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uSU_anon'anon'x_x" (BG.getField @"uSU_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 58:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "uSU_x" USU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uSU_anon'anon'x" x0 (\z2 ->
+                                                                 BG.CompatHasField.setField @"uSU_anon'anon'x_x" z2 y1)
+      , BG.getField @"uSU_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "uSU_x" (BG.Ptr USU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uSU_x")
+
+instance HasCField.HasCField USU "uSU_x" where
+
+  type CFieldType USU "uSU_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@SUU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 65:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUU_anon'anon'x_anon'x = SUU_anon'anon'x_anon'x
+  { unwrapSUU_anon'anon'x_anon'x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize SUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw SUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw SUU_anon'anon'x_anon'x
+
+deriving via Marshal.EquivStorable SUU_anon'anon'x_anon'x instance BG.Storable SUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion SUU_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sUU_anon'anon'x_anon'x_x" SUU_anon'anon'x_anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sUU_anon'anon'x_anon'x_x" SUU_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"sUU_anon'anon'x_anon'x_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sUU_anon'anon'x_anon'x_x" (BG.Ptr SUU_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sUU_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField SUU_anon'anon'x_anon'x "sUU_anon'anon'x_anon'x_x" where
+
+  type CFieldType SUU_anon'anon'x_anon'x "sUU_anon'anon'x_anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@SUU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUU_anon'anon'x = SUU_anon'anon'x
+  { unwrapSUU_anon'anon'x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize SUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw SUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw SUU_anon'anon'x
+
+deriving via Marshal.EquivStorable SUU_anon'anon'x instance BG.Storable SUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion SUU_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 65:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUU_anon'anon'x_anon'x
+         ) => BG.HasField "sUU_anon'anon'x_anon'x" SUU_anon'anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 65:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUU_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "sUU_anon'anon'x_anon'x" SUU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"sUU_anon'anon'x_anon'x" x0)
+
+instance ( ty ~ SUU_anon'anon'x_anon'x
+         ) => BG.HasField "sUU_anon'anon'x_anon'x" (BG.Ptr SUU_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sUU_anon'anon'x_anon'x")
+
+instance HasCField.HasCField SUU_anon'anon'x "sUU_anon'anon'x_anon'x" where
+
+  type CFieldType SUU_anon'anon'x "sUU_anon'anon'x_anon'x" =
+    SUU_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sUU_anon'anon'x_x" SUU_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sUU_anon'anon'x_anon'x_x" (BG.getField @"sUU_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sUU_anon'anon'x_x" SUU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sUU_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                        BG.CompatHasField.setField @"sUU_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"sUU_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sUU_anon'anon'x_x" (BG.Ptr SUU_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sUU_anon'anon'x_x")
+
+instance HasCField.HasCField SUU_anon'anon'x "sUU_anon'anon'x_x" where
+
+  type CFieldType SUU_anon'anon'x "sUU_anon'anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct SUU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 63:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUU = SUU
+  { sUU_anon'anon'x :: SUU_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize SUU where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SUU where
+
+  readRaw =
+    \ptr0 ->
+          pure SUU
+      <*> HasCField.readRaw (BG.Proxy @"sUU_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw SUU where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SUU sUU_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"sUU_anon'anon'x") ptr0 sUU_anon'anon'x2
+
+deriving via Marshal.EquivStorable SUU instance BG.Storable SUU
+
+deriving via Struct.IsStructViaReadRaw SUU instance Struct.IsStruct SUU
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ SUU_anon'anon'x
+         ) => BG.CompatHasField.HasField "sUU_anon'anon'x" SUU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SUU {sUU_anon'anon'x = y1}, BG.getField @"sUU_anon'anon'x" x0)
+
+instance ( ty ~ SUU_anon'anon'x
+         ) => BG.HasField "sUU_anon'anon'x" (BG.Ptr SUU) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sUU_anon'anon'x")
+
+instance HasCField.HasCField SUU "sUU_anon'anon'x" where
+
+  type CFieldType SUU "sUU_anon'anon'x" =
+    SUU_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "sUU_x" SUU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sUU_anon'anon'x_x" (BG.getField @"sUU_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 66:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "sUU_x" SUU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sUU_anon'anon'x" x0 (\z2 ->
+                                                                 BG.CompatHasField.setField @"sUU_anon'anon'x_x" z2 y1)
+      , BG.getField @"sUU_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "sUU_x" (BG.Ptr SUU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sUU_x")
+
+instance HasCField.HasCField SUU "sUU_x" where
+
+  type CFieldType SUU "sUU_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@UUU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 73:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU_anon'anon'x_anon'x = UUU_anon'anon'x_anon'x
+  { unwrapUUU_anon'anon'x_anon'x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUU_anon'anon'x_anon'x
+
+deriving via Marshal.EquivStorable UUU_anon'anon'x_anon'x instance BG.Storable UUU_anon'anon'x_anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUU_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uUU_anon'anon'x_anon'x_x" UUU_anon'anon'x_anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uUU_anon'anon'x_anon'x_x" UUU_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uUU_anon'anon'x_anon'x_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uUU_anon'anon'x_anon'x_x" (BG.Ptr UUU_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uUU_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField UUU_anon'anon'x_anon'x "uUU_anon'anon'x_anon'x_x" where
+
+  type CFieldType UUU_anon'anon'x_anon'x "uUU_anon'anon'x_anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@UUU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 72:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU_anon'anon'x = UUU_anon'anon'x
+  { unwrapUUU_anon'anon'x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUU_anon'anon'x
+
+deriving via Marshal.EquivStorable UUU_anon'anon'x instance BG.Storable UUU_anon'anon'x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUU_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 73:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUU_anon'anon'x_anon'x
+         ) => BG.HasField "uUU_anon'anon'x_anon'x" UUU_anon'anon'x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 73:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUU_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "uUU_anon'anon'x_anon'x" UUU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uUU_anon'anon'x_anon'x" x0)
+
+instance ( ty ~ UUU_anon'anon'x_anon'x
+         ) => BG.HasField "uUU_anon'anon'x_anon'x" (BG.Ptr UUU_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uUU_anon'anon'x_anon'x")
+
+instance HasCField.HasCField UUU_anon'anon'x "uUU_anon'anon'x_anon'x" where
+
+  type CFieldType UUU_anon'anon'x "uUU_anon'anon'x_anon'x" =
+    UUU_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uUU_anon'anon'x_x" UUU_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uUU_anon'anon'x_anon'x_x" (BG.getField @"uUU_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uUU_anon'anon'x_x" UUU_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uUU_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                        BG.CompatHasField.setField @"uUU_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"uUU_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uUU_anon'anon'x_x" (BG.Ptr UUU_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uUU_anon'anon'x_x")
+
+instance HasCField.HasCField UUU_anon'anon'x "uUU_anon'anon'x_x" where
+
+  type CFieldType UUU_anon'anon'x "uUU_anon'anon'x_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union UUU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 71:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU = UUU
+  { unwrapUUU :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UUU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UUU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UUU
+
+deriving via Marshal.EquivStorable UUU instance BG.Storable UUU
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UUU
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 72:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ UUU_anon'anon'x) => BG.HasField "uUU_anon'anon'x" UUU ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 72:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance ( ty ~ UUU_anon'anon'x
+         ) => BG.CompatHasField.HasField "uUU_anon'anon'x" UUU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uUU_anon'anon'x" x0)
+
+instance ( ty ~ UUU_anon'anon'x
+         ) => BG.HasField "uUU_anon'anon'x" (BG.Ptr UUU) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uUU_anon'anon'x")
+
+instance HasCField.HasCField UUU "uUU_anon'anon'x" where
+
+  type CFieldType UUU "uUU_anon'anon'x" =
+    UUU_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "uUU_x" UUU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uUU_anon'anon'x_x" (BG.getField @"uUU_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 74:11@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "uUU_x" UUU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uUU_anon'anon'x" x0 (\z2 ->
+                                                                 BG.CompatHasField.setField @"uUU_anon'anon'x_x" z2 y1)
+      , BG.getField @"uUU_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "uUU_x" (BG.Ptr UUU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uUU_x")
+
+instance HasCField.HasCField UUU "uUU_x" where
+
+  type CFieldType UUU "uUU_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting/bindingspec.yaml
@@ -0,0 +1,500 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct SSS
+  hsname: SSS
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @SSS_anon'anon'x
+  hsname: SSS_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @SSS_anon'anon'x_anon'x
+  hsname: SSS_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union USS
+  hsname: USS
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @USS_anon'anon'x
+  hsname: USS_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @USS_anon'anon'x_anon'x
+  hsname: USS_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct SUS
+  hsname: SUS
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @SUS_anon'anon'x
+  hsname: SUS_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @SUS_anon'anon'x_anon'x
+  hsname: SUS_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union UUS
+  hsname: UUS
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @UUS_anon'anon'x
+  hsname: UUS_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @UUS_anon'anon'x_anon'x
+  hsname: UUS_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct SSU
+  hsname: SSU
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @SSU_anon'anon'x
+  hsname: SSU_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @SSU_anon'anon'x_anon'x
+  hsname: SSU_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union USU
+  hsname: USU
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct @USU_anon'anon'x
+  hsname: USU_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @USU_anon'anon'x_anon'x
+  hsname: USU_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: struct SUU
+  hsname: SUU
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @SUU_anon'anon'x
+  hsname: SUU_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @SUU_anon'anon'x_anon'x
+  hsname: SUU_anon'anon'x_anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union UUU
+  hsname: UUU
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @UUU_anon'anon'x
+  hsname: UUU_anon'anon'x
+- headers: types/anonymous/edge-cases/multi_nesting.h
+  cname: union @UUU_anon'anon'x_anon'x
+  hsname: UUU_anon'anon'x_anon'x
+hstypes:
+- hsname: SSS
+  representation:
+    record:
+      constructor: SSS
+      fields:
+      - sSS_anon'anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSS_anon'anon'x
+  representation:
+    record:
+      constructor: SSS_anon'anon'x
+      fields:
+      - sSS_anon'anon'x_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSS_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: SSS_anon'anon'x_anon'x
+      fields:
+      - sSS_anon'anon'x_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSU
+  representation:
+    record:
+      constructor: SSU
+      fields:
+      - sSU_anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSU_anon'anon'x
+  representation:
+    record:
+      constructor: SSU_anon'anon'x
+      fields:
+      - sSU_anon'anon'x_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SSU_anon'anon'x_anon'x
+  representation:
+    newtype:
+      constructor: SSU_anon'anon'x_anon'x
+      fields:
+      - unwrapSSU_anon'anon'x_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUS
+  representation:
+    record:
+      constructor: SUS
+      fields:
+      - sUS_anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUS_anon'anon'x
+  representation:
+    newtype:
+      constructor: SUS_anon'anon'x
+      fields:
+      - unwrapSUS_anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUS_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: SUS_anon'anon'x_anon'x
+      fields:
+      - sUS_anon'anon'x_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUU
+  representation:
+    record:
+      constructor: SUU
+      fields:
+      - sUU_anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUU_anon'anon'x
+  representation:
+    newtype:
+      constructor: SUU_anon'anon'x
+      fields:
+      - unwrapSUU_anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SUU_anon'anon'x_anon'x
+  representation:
+    newtype:
+      constructor: SUU_anon'anon'x_anon'x
+      fields:
+      - unwrapSUU_anon'anon'x_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USS
+  representation:
+    newtype:
+      constructor: USS
+      fields:
+      - unwrapUSS
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USS_anon'anon'x
+  representation:
+    record:
+      constructor: USS_anon'anon'x
+      fields:
+      - uSS_anon'anon'x_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USS_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: USS_anon'anon'x_anon'x
+      fields:
+      - uSS_anon'anon'x_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USU
+  representation:
+    newtype:
+      constructor: USU
+      fields:
+      - unwrapUSU
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USU_anon'anon'x
+  representation:
+    record:
+      constructor: USU_anon'anon'x
+      fields:
+      - uSU_anon'anon'x_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: USU_anon'anon'x_anon'x
+  representation:
+    newtype:
+      constructor: USU_anon'anon'x_anon'x
+      fields:
+      - unwrapUSU_anon'anon'x_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUS
+  representation:
+    newtype:
+      constructor: UUS
+      fields:
+      - unwrapUUS
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUS_anon'anon'x
+  representation:
+    newtype:
+      constructor: UUS_anon'anon'x
+      fields:
+      - unwrapUUS_anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUS_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: UUS_anon'anon'x_anon'x
+      fields:
+      - uUS_anon'anon'x_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUU
+  representation:
+    newtype:
+      constructor: UUU
+      fields:
+      - unwrapUUU
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUU_anon'anon'x
+  representation:
+    newtype:
+      constructor: UUU_anon'anon'x
+      fields:
+      - unwrapUUU_anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UUU_anon'anon'x_anon'x
+  representation:
+    newtype:
+      constructor: UUU_anon'anon'x_anon'x
+      fields:
+      - unwrapUUU_anon'anon'x_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/multi_nesting/th.txt
@@ -0,0 +1,981 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/multi_nesting.h
+{-| __C declaration:__ @struct \@SSS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS_anon'anon'x_anon'x
+    = SSS_anon'anon'x_anon'x {sSS_anon'anon'x_anon'x_x :: CInt
+                              {- ^ __C declaration:__ @x@
+
+                                   __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 18:11@
+
+                                   __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SSS_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSS_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure SSS_anon'anon'x_anon'x <*> readRaw (Proxy @"sSS_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw SSS_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSS_anon'anon'x_anon'x sSS_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"sSS_anon'anon'x_anon'x_x") ptr_0 sSS_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable SSS_anon'anon'x_anon'x) instance Storable SSS_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw SSS_anon'anon'x_anon'x) instance IsStruct SSS_anon'anon'x_anon'x
+instance (~) ty CInt =>
+         HasField "sSS_anon'anon'x_anon'x_x" SSS_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> SSS_anon'anon'x_anon'x{sSS_anon'anon'x_anon'x_x = y_1},
+                              getField @"sSS_anon'anon'x_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "sSS_anon'anon'x_anon'x_x"
+                  (Ptr SSS_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"sSS_anon'anon'x_anon'x_x")
+instance HasCField SSS_anon'anon'x_anon'x
+                   "sSS_anon'anon'x_anon'x_x"
+    where type CFieldType SSS_anon'anon'x_anon'x
+                          "sSS_anon'anon'x_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@SSS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS_anon'anon'x
+    = SSS_anon'anon'x {sSS_anon'anon'x_anon'x :: SSS_anon'anon'x_anon'x
+                       {- ^ __C declaration:__ @anon\'x@
+
+                            __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 17:5@
+
+                            __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SSS_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSS_anon'anon'x
+    where readRaw = \ptr_0 -> pure SSS_anon'anon'x <*> readRaw (Proxy @"sSS_anon'anon'x_anon'x") ptr_0
+instance WriteRaw SSS_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSS_anon'anon'x sSS_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"sSS_anon'anon'x_anon'x") ptr_0 sSS_anon'anon'x_anon'x_2
+deriving via (EquivStorable SSS_anon'anon'x) instance Storable SSS_anon'anon'x
+deriving via (IsStructViaReadRaw SSS_anon'anon'x) instance IsStruct SSS_anon'anon'x
+instance (~) ty SSS_anon'anon'x_anon'x =>
+         HasField "sSS_anon'anon'x_anon'x" SSS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> SSS_anon'anon'x{sSS_anon'anon'x_anon'x = y_1},
+                              getField @"sSS_anon'anon'x_anon'x" x_0)
+instance (~) ty SSS_anon'anon'x_anon'x =>
+         HasField "sSS_anon'anon'x_anon'x" (Ptr SSS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"sSS_anon'anon'x_anon'x")
+instance HasCField SSS_anon'anon'x "sSS_anon'anon'x_anon'x"
+    where type CFieldType SSS_anon'anon'x
+                          "sSS_anon'anon'x_anon'x" = SSS_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "sSS_anon'anon'x_x" SSS_anon'anon'x ty
+    where getField = \x_0 -> getField @"sSS_anon'anon'x_anon'x_x" (getField @"sSS_anon'anon'x_anon'x" x_0)
+instance (~) ty CInt =>
+         HasField "sSS_anon'anon'x_x" SSS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sSS_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"sSS_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"sSS_anon'anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "sSS_anon'anon'x_x" (Ptr SSS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"sSS_anon'anon'x_x")
+instance HasCField SSS_anon'anon'x "sSS_anon'anon'x_x"
+    where type CFieldType SSS_anon'anon'x "sSS_anon'anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct SSS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 15:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSS
+    = SSS {sSS_anon'anon'x :: SSS_anon'anon'x
+           {- ^ __C declaration:__ @anon\'anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 16:3@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SSS
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSS
+    where readRaw = \ptr_0 -> pure SSS <*> readRaw (Proxy @"sSS_anon'anon'x") ptr_0
+instance WriteRaw SSS
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSS sSS_anon'anon'x_2 -> writeRaw (Proxy @"sSS_anon'anon'x") ptr_0 sSS_anon'anon'x_2
+deriving via (EquivStorable SSS) instance Storable SSS
+deriving via (IsStructViaReadRaw SSS) instance IsStruct SSS
+instance (~) ty SSS_anon'anon'x =>
+         HasField "sSS_anon'anon'x" SSS ty
+    where hasField = \x_0 -> (\y_1 -> SSS{sSS_anon'anon'x = y_1},
+                              getField @"sSS_anon'anon'x" x_0)
+instance (~) ty SSS_anon'anon'x =>
+         HasField "sSS_anon'anon'x" (Ptr SSS) (Ptr ty)
+    where getField = fromPtr (Proxy @"sSS_anon'anon'x")
+instance HasCField SSS "sSS_anon'anon'x"
+    where type CFieldType SSS "sSS_anon'anon'x" = SSS_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "sSS_x" SSS ty
+    where getField = \x_0 -> getField @"sSS_anon'anon'x_x" (getField @"sSS_anon'anon'x" x_0)
+instance (~) ty CInt => HasField "sSS_x" SSS ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sSS_anon'anon'x" x_0 (\z_2 -> setField @"sSS_anon'anon'x_x" z_2 y_1),
+                              getField @"sSS_x" x_0)
+instance (~) ty CInt => HasField "sSS_x" (Ptr SSS) (Ptr ty)
+    where getField = fromPtr (Proxy @"sSS_x")
+instance HasCField SSS "sSS_x"
+    where type CFieldType SSS "sSS_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@USS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USS_anon'anon'x_anon'x
+    = USS_anon'anon'x_anon'x {uSS_anon'anon'x_anon'x_x :: CInt
+                              {- ^ __C declaration:__ @x@
+
+                                   __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 26:11@
+
+                                   __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize USS_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw USS_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure USS_anon'anon'x_anon'x <*> readRaw (Proxy @"uSS_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw USS_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       USS_anon'anon'x_anon'x uSS_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"uSS_anon'anon'x_anon'x_x") ptr_0 uSS_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable USS_anon'anon'x_anon'x) instance Storable USS_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw USS_anon'anon'x_anon'x) instance IsStruct USS_anon'anon'x_anon'x
+instance (~) ty CInt =>
+         HasField "uSS_anon'anon'x_anon'x_x" USS_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> USS_anon'anon'x_anon'x{uSS_anon'anon'x_anon'x_x = y_1},
+                              getField @"uSS_anon'anon'x_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "uSS_anon'anon'x_anon'x_x"
+                  (Ptr USS_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"uSS_anon'anon'x_anon'x_x")
+instance HasCField USS_anon'anon'x_anon'x
+                   "uSS_anon'anon'x_anon'x_x"
+    where type CFieldType USS_anon'anon'x_anon'x
+                          "uSS_anon'anon'x_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@USS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USS_anon'anon'x
+    = USS_anon'anon'x {uSS_anon'anon'x_anon'x :: USS_anon'anon'x_anon'x
+                       {- ^ __C declaration:__ @anon\'x@
+
+                            __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 25:5@
+
+                            __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize USS_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw USS_anon'anon'x
+    where readRaw = \ptr_0 -> pure USS_anon'anon'x <*> readRaw (Proxy @"uSS_anon'anon'x_anon'x") ptr_0
+instance WriteRaw USS_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       USS_anon'anon'x uSS_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"uSS_anon'anon'x_anon'x") ptr_0 uSS_anon'anon'x_anon'x_2
+deriving via (EquivStorable USS_anon'anon'x) instance Storable USS_anon'anon'x
+deriving via (IsStructViaReadRaw USS_anon'anon'x) instance IsStruct USS_anon'anon'x
+instance (~) ty USS_anon'anon'x_anon'x =>
+         HasField "uSS_anon'anon'x_anon'x" USS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> USS_anon'anon'x{uSS_anon'anon'x_anon'x = y_1},
+                              getField @"uSS_anon'anon'x_anon'x" x_0)
+instance (~) ty USS_anon'anon'x_anon'x =>
+         HasField "uSS_anon'anon'x_anon'x" (Ptr USS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"uSS_anon'anon'x_anon'x")
+instance HasCField USS_anon'anon'x "uSS_anon'anon'x_anon'x"
+    where type CFieldType USS_anon'anon'x
+                          "uSS_anon'anon'x_anon'x" = USS_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "uSS_anon'anon'x_x" USS_anon'anon'x ty
+    where getField = \x_0 -> getField @"uSS_anon'anon'x_anon'x_x" (getField @"uSS_anon'anon'x_anon'x" x_0)
+instance (~) ty CInt =>
+         HasField "uSS_anon'anon'x_x" USS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uSS_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"uSS_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"uSS_anon'anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "uSS_anon'anon'x_x" (Ptr USS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"uSS_anon'anon'x_x")
+instance HasCField USS_anon'anon'x "uSS_anon'anon'x_x"
+    where type CFieldType USS_anon'anon'x "uSS_anon'anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union USS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 23:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USS = USS {unwrapUSS :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize USS
+deriving via (SizedByteArray 4 4) instance ReadRaw USS
+deriving via (SizedByteArray 4 4) instance WriteRaw USS
+deriving via (EquivStorable USS) instance Storable USS
+deriving via (SizedByteArray 4 4) instance IsUnion USS
+instance (~) ty USS_anon'anon'x =>
+         HasField "uSS_anon'anon'x" USS ty
+    where getField = getUnionPayload
+instance (~) ty USS_anon'anon'x =>
+         HasField "uSS_anon'anon'x" USS ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uSS_anon'anon'x" x_0)
+instance (~) ty USS_anon'anon'x =>
+         HasField "uSS_anon'anon'x" (Ptr USS) (Ptr ty)
+    where getField = fromPtr (Proxy @"uSS_anon'anon'x")
+instance HasCField USS "uSS_anon'anon'x"
+    where type CFieldType USS "uSS_anon'anon'x" = USS_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "uSS_x" USS ty
+    where getField = \x_0 -> getField @"uSS_anon'anon'x_x" (getField @"uSS_anon'anon'x" x_0)
+instance (~) ty CInt => HasField "uSS_x" USS ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uSS_anon'anon'x" x_0 (\z_2 -> setField @"uSS_anon'anon'x_x" z_2 y_1),
+                              getField @"uSS_x" x_0)
+instance (~) ty CInt => HasField "uSS_x" (Ptr USS) (Ptr ty)
+    where getField = fromPtr (Proxy @"uSS_x")
+instance HasCField USS "uSS_x"
+    where type CFieldType USS "uSS_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@SUS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 33:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUS_anon'anon'x_anon'x
+    = SUS_anon'anon'x_anon'x {sUS_anon'anon'x_anon'x_x :: CInt
+                              {- ^ __C declaration:__ @x@
+
+                                   __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 34:11@
+
+                                   __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SUS_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SUS_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure SUS_anon'anon'x_anon'x <*> readRaw (Proxy @"sUS_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw SUS_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SUS_anon'anon'x_anon'x sUS_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"sUS_anon'anon'x_anon'x_x") ptr_0 sUS_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable SUS_anon'anon'x_anon'x) instance Storable SUS_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw SUS_anon'anon'x_anon'x) instance IsStruct SUS_anon'anon'x_anon'x
+instance (~) ty CInt =>
+         HasField "sUS_anon'anon'x_anon'x_x" SUS_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> SUS_anon'anon'x_anon'x{sUS_anon'anon'x_anon'x_x = y_1},
+                              getField @"sUS_anon'anon'x_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "sUS_anon'anon'x_anon'x_x"
+                  (Ptr SUS_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"sUS_anon'anon'x_anon'x_x")
+instance HasCField SUS_anon'anon'x_anon'x
+                   "sUS_anon'anon'x_anon'x_x"
+    where type CFieldType SUS_anon'anon'x_anon'x
+                          "sUS_anon'anon'x_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@SUS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUS_anon'anon'x
+    = SUS_anon'anon'x {unwrapSUS_anon'anon'x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize SUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance ReadRaw SUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance WriteRaw SUS_anon'anon'x
+deriving via (EquivStorable SUS_anon'anon'x) instance Storable SUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance IsUnion SUS_anon'anon'x
+instance (~) ty SUS_anon'anon'x_anon'x =>
+         HasField "sUS_anon'anon'x_anon'x" SUS_anon'anon'x ty
+    where getField = getUnionPayload
+instance (~) ty SUS_anon'anon'x_anon'x =>
+         HasField "sUS_anon'anon'x_anon'x" SUS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"sUS_anon'anon'x_anon'x" x_0)
+instance (~) ty SUS_anon'anon'x_anon'x =>
+         HasField "sUS_anon'anon'x_anon'x" (Ptr SUS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"sUS_anon'anon'x_anon'x")
+instance HasCField SUS_anon'anon'x "sUS_anon'anon'x_anon'x"
+    where type CFieldType SUS_anon'anon'x
+                          "sUS_anon'anon'x_anon'x" = SUS_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "sUS_anon'anon'x_x" SUS_anon'anon'x ty
+    where getField = \x_0 -> getField @"sUS_anon'anon'x_anon'x_x" (getField @"sUS_anon'anon'x_anon'x" x_0)
+instance (~) ty CInt =>
+         HasField "sUS_anon'anon'x_x" SUS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sUS_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"sUS_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"sUS_anon'anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "sUS_anon'anon'x_x" (Ptr SUS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"sUS_anon'anon'x_x")
+instance HasCField SUS_anon'anon'x "sUS_anon'anon'x_x"
+    where type CFieldType SUS_anon'anon'x "sUS_anon'anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct SUS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 31:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUS
+    = SUS {sUS_anon'anon'x :: SUS_anon'anon'x
+           {- ^ __C declaration:__ @anon\'anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 32:3@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+           -}}
+    deriving stock Generic
+instance StaticSize SUS
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SUS
+    where readRaw = \ptr_0 -> pure SUS <*> readRaw (Proxy @"sUS_anon'anon'x") ptr_0
+instance WriteRaw SUS
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SUS sUS_anon'anon'x_2 -> writeRaw (Proxy @"sUS_anon'anon'x") ptr_0 sUS_anon'anon'x_2
+deriving via (EquivStorable SUS) instance Storable SUS
+deriving via (IsStructViaReadRaw SUS) instance IsStruct SUS
+instance (~) ty SUS_anon'anon'x =>
+         HasField "sUS_anon'anon'x" SUS ty
+    where hasField = \x_0 -> (\y_1 -> SUS{sUS_anon'anon'x = y_1},
+                              getField @"sUS_anon'anon'x" x_0)
+instance (~) ty SUS_anon'anon'x =>
+         HasField "sUS_anon'anon'x" (Ptr SUS) (Ptr ty)
+    where getField = fromPtr (Proxy @"sUS_anon'anon'x")
+instance HasCField SUS "sUS_anon'anon'x"
+    where type CFieldType SUS "sUS_anon'anon'x" = SUS_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "sUS_x" SUS ty
+    where getField = \x_0 -> getField @"sUS_anon'anon'x_x" (getField @"sUS_anon'anon'x" x_0)
+instance (~) ty CInt => HasField "sUS_x" SUS ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sUS_anon'anon'x" x_0 (\z_2 -> setField @"sUS_anon'anon'x_x" z_2 y_1),
+                              getField @"sUS_x" x_0)
+instance (~) ty CInt => HasField "sUS_x" (Ptr SUS) (Ptr ty)
+    where getField = fromPtr (Proxy @"sUS_x")
+instance HasCField SUS "sUS_x"
+    where type CFieldType SUS "sUS_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@UUS_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 41:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data UUS_anon'anon'x_anon'x
+    = UUS_anon'anon'x_anon'x {uUS_anon'anon'x_anon'x_x :: CInt
+                              {- ^ __C declaration:__ @x@
+
+                                   __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 42:11@
+
+                                   __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UUS_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw UUS_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure UUS_anon'anon'x_anon'x <*> readRaw (Proxy @"uUS_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw UUS_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UUS_anon'anon'x_anon'x uUS_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"uUS_anon'anon'x_anon'x_x") ptr_0 uUS_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable UUS_anon'anon'x_anon'x) instance Storable UUS_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw UUS_anon'anon'x_anon'x) instance IsStruct UUS_anon'anon'x_anon'x
+instance (~) ty CInt =>
+         HasField "uUS_anon'anon'x_anon'x_x" UUS_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> UUS_anon'anon'x_anon'x{uUS_anon'anon'x_anon'x_x = y_1},
+                              getField @"uUS_anon'anon'x_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "uUS_anon'anon'x_anon'x_x"
+                  (Ptr UUS_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"uUS_anon'anon'x_anon'x_x")
+instance HasCField UUS_anon'anon'x_anon'x
+                   "uUS_anon'anon'x_anon'x_x"
+    where type CFieldType UUS_anon'anon'x_anon'x
+                          "uUS_anon'anon'x_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@UUS_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 40:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUS_anon'anon'x
+    = UUS_anon'anon'x {unwrapUUS_anon'anon'x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize UUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance ReadRaw UUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance WriteRaw UUS_anon'anon'x
+deriving via (EquivStorable UUS_anon'anon'x) instance Storable UUS_anon'anon'x
+deriving via (SizedByteArray 4 4) instance IsUnion UUS_anon'anon'x
+instance (~) ty UUS_anon'anon'x_anon'x =>
+         HasField "uUS_anon'anon'x_anon'x" UUS_anon'anon'x ty
+    where getField = getUnionPayload
+instance (~) ty UUS_anon'anon'x_anon'x =>
+         HasField "uUS_anon'anon'x_anon'x" UUS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uUS_anon'anon'x_anon'x" x_0)
+instance (~) ty UUS_anon'anon'x_anon'x =>
+         HasField "uUS_anon'anon'x_anon'x" (Ptr UUS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"uUS_anon'anon'x_anon'x")
+instance HasCField UUS_anon'anon'x "uUS_anon'anon'x_anon'x"
+    where type CFieldType UUS_anon'anon'x
+                          "uUS_anon'anon'x_anon'x" = UUS_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "uUS_anon'anon'x_x" UUS_anon'anon'x ty
+    where getField = \x_0 -> getField @"uUS_anon'anon'x_anon'x_x" (getField @"uUS_anon'anon'x_anon'x" x_0)
+instance (~) ty CInt =>
+         HasField "uUS_anon'anon'x_x" UUS_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uUS_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"uUS_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"uUS_anon'anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "uUS_anon'anon'x_x" (Ptr UUS_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"uUS_anon'anon'x_x")
+instance HasCField UUS_anon'anon'x "uUS_anon'anon'x_x"
+    where type CFieldType UUS_anon'anon'x "uUS_anon'anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union UUS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 39:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUS = UUS {unwrapUUS :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize UUS
+deriving via (SizedByteArray 4 4) instance ReadRaw UUS
+deriving via (SizedByteArray 4 4) instance WriteRaw UUS
+deriving via (EquivStorable UUS) instance Storable UUS
+deriving via (SizedByteArray 4 4) instance IsUnion UUS
+instance (~) ty UUS_anon'anon'x =>
+         HasField "uUS_anon'anon'x" UUS ty
+    where getField = getUnionPayload
+instance (~) ty UUS_anon'anon'x =>
+         HasField "uUS_anon'anon'x" UUS ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uUS_anon'anon'x" x_0)
+instance (~) ty UUS_anon'anon'x =>
+         HasField "uUS_anon'anon'x" (Ptr UUS) (Ptr ty)
+    where getField = fromPtr (Proxy @"uUS_anon'anon'x")
+instance HasCField UUS "uUS_anon'anon'x"
+    where type CFieldType UUS "uUS_anon'anon'x" = UUS_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "uUS_x" UUS ty
+    where getField = \x_0 -> getField @"uUS_anon'anon'x_x" (getField @"uUS_anon'anon'x" x_0)
+instance (~) ty CInt => HasField "uUS_x" UUS ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uUS_anon'anon'x" x_0 (\z_2 -> setField @"uUS_anon'anon'x_x" z_2 y_1),
+                              getField @"uUS_x" x_0)
+instance (~) ty CInt => HasField "uUS_x" (Ptr UUS) (Ptr ty)
+    where getField = fromPtr (Proxy @"uUS_x")
+instance HasCField UUS "uUS_x"
+    where type CFieldType UUS "uUS_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@SSU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SSU_anon'anon'x_anon'x
+    = SSU_anon'anon'x_anon'x {unwrapSSU_anon'anon'x_anon'x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize SSU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw SSU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw SSU_anon'anon'x_anon'x
+deriving via (EquivStorable SSU_anon'anon'x_anon'x) instance Storable SSU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance IsUnion SSU_anon'anon'x_anon'x
+instance (~) ty CInt =>
+         HasField "sSU_anon'anon'x_anon'x_x" SSU_anon'anon'x_anon'x ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "sSU_anon'anon'x_anon'x_x" SSU_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"sSU_anon'anon'x_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "sSU_anon'anon'x_anon'x_x"
+                  (Ptr SSU_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"sSU_anon'anon'x_anon'x_x")
+instance HasCField SSU_anon'anon'x_anon'x
+                   "sSU_anon'anon'x_anon'x_x"
+    where type CFieldType SSU_anon'anon'x_anon'x
+                          "sSU_anon'anon'x_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@SSU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSU_anon'anon'x
+    = SSU_anon'anon'x {sSU_anon'anon'x_anon'x :: SSU_anon'anon'x_anon'x
+                       {- ^ __C declaration:__ @anon\'x@
+
+                            __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 49:5@
+
+                            __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                       -}}
+    deriving stock Generic
+instance StaticSize SSU_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSU_anon'anon'x
+    where readRaw = \ptr_0 -> pure SSU_anon'anon'x <*> readRaw (Proxy @"sSU_anon'anon'x_anon'x") ptr_0
+instance WriteRaw SSU_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSU_anon'anon'x sSU_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"sSU_anon'anon'x_anon'x") ptr_0 sSU_anon'anon'x_anon'x_2
+deriving via (EquivStorable SSU_anon'anon'x) instance Storable SSU_anon'anon'x
+deriving via (IsStructViaReadRaw SSU_anon'anon'x) instance IsStruct SSU_anon'anon'x
+instance (~) ty SSU_anon'anon'x_anon'x =>
+         HasField "sSU_anon'anon'x_anon'x" SSU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> SSU_anon'anon'x{sSU_anon'anon'x_anon'x = y_1},
+                              getField @"sSU_anon'anon'x_anon'x" x_0)
+instance (~) ty SSU_anon'anon'x_anon'x =>
+         HasField "sSU_anon'anon'x_anon'x" (Ptr SSU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"sSU_anon'anon'x_anon'x")
+instance HasCField SSU_anon'anon'x "sSU_anon'anon'x_anon'x"
+    where type CFieldType SSU_anon'anon'x
+                          "sSU_anon'anon'x_anon'x" = SSU_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "sSU_anon'anon'x_x" SSU_anon'anon'x ty
+    where getField = \x_0 -> getField @"sSU_anon'anon'x_anon'x_x" (getField @"sSU_anon'anon'x_anon'x" x_0)
+instance (~) ty CInt =>
+         HasField "sSU_anon'anon'x_x" SSU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sSU_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"sSU_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"sSU_anon'anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "sSU_anon'anon'x_x" (Ptr SSU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"sSU_anon'anon'x_x")
+instance HasCField SSU_anon'anon'x "sSU_anon'anon'x_x"
+    where type CFieldType SSU_anon'anon'x "sSU_anon'anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct SSU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 47:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SSU
+    = SSU {sSU_anon'anon'x :: SSU_anon'anon'x
+           {- ^ __C declaration:__ @anon\'anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 48:3@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+           -}}
+    deriving stock Generic
+instance StaticSize SSU
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SSU
+    where readRaw = \ptr_0 -> pure SSU <*> readRaw (Proxy @"sSU_anon'anon'x") ptr_0
+instance WriteRaw SSU
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SSU sSU_anon'anon'x_2 -> writeRaw (Proxy @"sSU_anon'anon'x") ptr_0 sSU_anon'anon'x_2
+deriving via (EquivStorable SSU) instance Storable SSU
+deriving via (IsStructViaReadRaw SSU) instance IsStruct SSU
+instance (~) ty SSU_anon'anon'x =>
+         HasField "sSU_anon'anon'x" SSU ty
+    where hasField = \x_0 -> (\y_1 -> SSU{sSU_anon'anon'x = y_1},
+                              getField @"sSU_anon'anon'x" x_0)
+instance (~) ty SSU_anon'anon'x =>
+         HasField "sSU_anon'anon'x" (Ptr SSU) (Ptr ty)
+    where getField = fromPtr (Proxy @"sSU_anon'anon'x")
+instance HasCField SSU "sSU_anon'anon'x"
+    where type CFieldType SSU "sSU_anon'anon'x" = SSU_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "sSU_x" SSU ty
+    where getField = \x_0 -> getField @"sSU_anon'anon'x_x" (getField @"sSU_anon'anon'x" x_0)
+instance (~) ty CInt => HasField "sSU_x" SSU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sSU_anon'anon'x" x_0 (\z_2 -> setField @"sSU_anon'anon'x_x" z_2 y_1),
+                              getField @"sSU_x" x_0)
+instance (~) ty CInt => HasField "sSU_x" (Ptr SSU) (Ptr ty)
+    where getField = fromPtr (Proxy @"sSU_x")
+instance HasCField SSU "sSU_x"
+    where type CFieldType SSU "sSU_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@USU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USU_anon'anon'x_anon'x
+    = USU_anon'anon'x_anon'x {unwrapUSU_anon'anon'x_anon'x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize USU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw USU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw USU_anon'anon'x_anon'x
+deriving via (EquivStorable USU_anon'anon'x_anon'x) instance Storable USU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance IsUnion USU_anon'anon'x_anon'x
+instance (~) ty CInt =>
+         HasField "uSU_anon'anon'x_anon'x_x" USU_anon'anon'x_anon'x ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "uSU_anon'anon'x_anon'x_x" USU_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uSU_anon'anon'x_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "uSU_anon'anon'x_anon'x_x"
+                  (Ptr USU_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"uSU_anon'anon'x_anon'x_x")
+instance HasCField USU_anon'anon'x_anon'x
+                   "uSU_anon'anon'x_anon'x_x"
+    where type CFieldType USU_anon'anon'x_anon'x
+                          "uSU_anon'anon'x_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@USU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 56:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data USU_anon'anon'x
+    = USU_anon'anon'x {uSU_anon'anon'x_anon'x :: USU_anon'anon'x_anon'x
+                       {- ^ __C declaration:__ @anon\'x@
+
+                            __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 57:5@
+
+                            __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+                       -}}
+    deriving stock Generic
+instance StaticSize USU_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw USU_anon'anon'x
+    where readRaw = \ptr_0 -> pure USU_anon'anon'x <*> readRaw (Proxy @"uSU_anon'anon'x_anon'x") ptr_0
+instance WriteRaw USU_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       USU_anon'anon'x uSU_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"uSU_anon'anon'x_anon'x") ptr_0 uSU_anon'anon'x_anon'x_2
+deriving via (EquivStorable USU_anon'anon'x) instance Storable USU_anon'anon'x
+deriving via (IsStructViaReadRaw USU_anon'anon'x) instance IsStruct USU_anon'anon'x
+instance (~) ty USU_anon'anon'x_anon'x =>
+         HasField "uSU_anon'anon'x_anon'x" USU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> USU_anon'anon'x{uSU_anon'anon'x_anon'x = y_1},
+                              getField @"uSU_anon'anon'x_anon'x" x_0)
+instance (~) ty USU_anon'anon'x_anon'x =>
+         HasField "uSU_anon'anon'x_anon'x" (Ptr USU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"uSU_anon'anon'x_anon'x")
+instance HasCField USU_anon'anon'x "uSU_anon'anon'x_anon'x"
+    where type CFieldType USU_anon'anon'x
+                          "uSU_anon'anon'x_anon'x" = USU_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "uSU_anon'anon'x_x" USU_anon'anon'x ty
+    where getField = \x_0 -> getField @"uSU_anon'anon'x_anon'x_x" (getField @"uSU_anon'anon'x_anon'x" x_0)
+instance (~) ty CInt =>
+         HasField "uSU_anon'anon'x_x" USU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uSU_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"uSU_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"uSU_anon'anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "uSU_anon'anon'x_x" (Ptr USU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"uSU_anon'anon'x_x")
+instance HasCField USU_anon'anon'x "uSU_anon'anon'x_x"
+    where type CFieldType USU_anon'anon'x "uSU_anon'anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union USU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 55:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype USU = USU {unwrapUSU :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize USU
+deriving via (SizedByteArray 4 4) instance ReadRaw USU
+deriving via (SizedByteArray 4 4) instance WriteRaw USU
+deriving via (EquivStorable USU) instance Storable USU
+deriving via (SizedByteArray 4 4) instance IsUnion USU
+instance (~) ty USU_anon'anon'x =>
+         HasField "uSU_anon'anon'x" USU ty
+    where getField = getUnionPayload
+instance (~) ty USU_anon'anon'x =>
+         HasField "uSU_anon'anon'x" USU ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uSU_anon'anon'x" x_0)
+instance (~) ty USU_anon'anon'x =>
+         HasField "uSU_anon'anon'x" (Ptr USU) (Ptr ty)
+    where getField = fromPtr (Proxy @"uSU_anon'anon'x")
+instance HasCField USU "uSU_anon'anon'x"
+    where type CFieldType USU "uSU_anon'anon'x" = USU_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "uSU_x" USU ty
+    where getField = \x_0 -> getField @"uSU_anon'anon'x_x" (getField @"uSU_anon'anon'x" x_0)
+instance (~) ty CInt => HasField "uSU_x" USU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uSU_anon'anon'x" x_0 (\z_2 -> setField @"uSU_anon'anon'x_x" z_2 y_1),
+                              getField @"uSU_x" x_0)
+instance (~) ty CInt => HasField "uSU_x" (Ptr USU) (Ptr ty)
+    where getField = fromPtr (Proxy @"uSU_x")
+instance HasCField USU "uSU_x"
+    where type CFieldType USU "uSU_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@SUU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 65:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUU_anon'anon'x_anon'x
+    = SUU_anon'anon'x_anon'x {unwrapSUU_anon'anon'x_anon'x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize SUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw SUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw SUU_anon'anon'x_anon'x
+deriving via (EquivStorable SUU_anon'anon'x_anon'x) instance Storable SUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance IsUnion SUU_anon'anon'x_anon'x
+instance (~) ty CInt =>
+         HasField "sUU_anon'anon'x_anon'x_x" SUU_anon'anon'x_anon'x ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "sUU_anon'anon'x_anon'x_x" SUU_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"sUU_anon'anon'x_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "sUU_anon'anon'x_anon'x_x"
+                  (Ptr SUU_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"sUU_anon'anon'x_anon'x_x")
+instance HasCField SUU_anon'anon'x_anon'x
+                   "sUU_anon'anon'x_anon'x_x"
+    where type CFieldType SUU_anon'anon'x_anon'x
+                          "sUU_anon'anon'x_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@SUU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype SUU_anon'anon'x
+    = SUU_anon'anon'x {unwrapSUU_anon'anon'x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize SUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance ReadRaw SUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance WriteRaw SUU_anon'anon'x
+deriving via (EquivStorable SUU_anon'anon'x) instance Storable SUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance IsUnion SUU_anon'anon'x
+instance (~) ty SUU_anon'anon'x_anon'x =>
+         HasField "sUU_anon'anon'x_anon'x" SUU_anon'anon'x ty
+    where getField = getUnionPayload
+instance (~) ty SUU_anon'anon'x_anon'x =>
+         HasField "sUU_anon'anon'x_anon'x" SUU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"sUU_anon'anon'x_anon'x" x_0)
+instance (~) ty SUU_anon'anon'x_anon'x =>
+         HasField "sUU_anon'anon'x_anon'x" (Ptr SUU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"sUU_anon'anon'x_anon'x")
+instance HasCField SUU_anon'anon'x "sUU_anon'anon'x_anon'x"
+    where type CFieldType SUU_anon'anon'x
+                          "sUU_anon'anon'x_anon'x" = SUU_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "sUU_anon'anon'x_x" SUU_anon'anon'x ty
+    where getField = \x_0 -> getField @"sUU_anon'anon'x_anon'x_x" (getField @"sUU_anon'anon'x_anon'x" x_0)
+instance (~) ty CInt =>
+         HasField "sUU_anon'anon'x_x" SUU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sUU_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"sUU_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"sUU_anon'anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "sUU_anon'anon'x_x" (Ptr SUU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"sUU_anon'anon'x_x")
+instance HasCField SUU_anon'anon'x "sUU_anon'anon'x_x"
+    where type CFieldType SUU_anon'anon'x "sUU_anon'anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct SUU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 63:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+data SUU
+    = SUU {sUU_anon'anon'x :: SUU_anon'anon'x
+           {- ^ __C declaration:__ @anon\'anon\'x@
+
+                __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 64:3@
+
+                __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+           -}}
+    deriving stock Generic
+instance StaticSize SUU
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SUU
+    where readRaw = \ptr_0 -> pure SUU <*> readRaw (Proxy @"sUU_anon'anon'x") ptr_0
+instance WriteRaw SUU
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SUU sUU_anon'anon'x_2 -> writeRaw (Proxy @"sUU_anon'anon'x") ptr_0 sUU_anon'anon'x_2
+deriving via (EquivStorable SUU) instance Storable SUU
+deriving via (IsStructViaReadRaw SUU) instance IsStruct SUU
+instance (~) ty SUU_anon'anon'x =>
+         HasField "sUU_anon'anon'x" SUU ty
+    where hasField = \x_0 -> (\y_1 -> SUU{sUU_anon'anon'x = y_1},
+                              getField @"sUU_anon'anon'x" x_0)
+instance (~) ty SUU_anon'anon'x =>
+         HasField "sUU_anon'anon'x" (Ptr SUU) (Ptr ty)
+    where getField = fromPtr (Proxy @"sUU_anon'anon'x")
+instance HasCField SUU "sUU_anon'anon'x"
+    where type CFieldType SUU "sUU_anon'anon'x" = SUU_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "sUU_x" SUU ty
+    where getField = \x_0 -> getField @"sUU_anon'anon'x_x" (getField @"sUU_anon'anon'x" x_0)
+instance (~) ty CInt => HasField "sUU_x" SUU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sUU_anon'anon'x" x_0 (\z_2 -> setField @"sUU_anon'anon'x_x" z_2 y_1),
+                              getField @"sUU_x" x_0)
+instance (~) ty CInt => HasField "sUU_x" (Ptr SUU) (Ptr ty)
+    where getField = fromPtr (Proxy @"sUU_x")
+instance HasCField SUU "sUU_x"
+    where type CFieldType SUU "sUU_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@UUU_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 73:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU_anon'anon'x_anon'x
+    = UUU_anon'anon'x_anon'x {unwrapUUU_anon'anon'x_anon'x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize UUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw UUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw UUU_anon'anon'x_anon'x
+deriving via (EquivStorable UUU_anon'anon'x_anon'x) instance Storable UUU_anon'anon'x_anon'x
+deriving via (SizedByteArray 4
+                             4) instance IsUnion UUU_anon'anon'x_anon'x
+instance (~) ty CInt =>
+         HasField "uUU_anon'anon'x_anon'x_x" UUU_anon'anon'x_anon'x ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "uUU_anon'anon'x_anon'x_x" UUU_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uUU_anon'anon'x_anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "uUU_anon'anon'x_anon'x_x"
+                  (Ptr UUU_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"uUU_anon'anon'x_anon'x_x")
+instance HasCField UUU_anon'anon'x_anon'x
+                   "uUU_anon'anon'x_anon'x_x"
+    where type CFieldType UUU_anon'anon'x_anon'x
+                          "uUU_anon'anon'x_anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@UUU_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 72:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU_anon'anon'x
+    = UUU_anon'anon'x {unwrapUUU_anon'anon'x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize UUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance ReadRaw UUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance WriteRaw UUU_anon'anon'x
+deriving via (EquivStorable UUU_anon'anon'x) instance Storable UUU_anon'anon'x
+deriving via (SizedByteArray 4 4) instance IsUnion UUU_anon'anon'x
+instance (~) ty UUU_anon'anon'x_anon'x =>
+         HasField "uUU_anon'anon'x_anon'x" UUU_anon'anon'x ty
+    where getField = getUnionPayload
+instance (~) ty UUU_anon'anon'x_anon'x =>
+         HasField "uUU_anon'anon'x_anon'x" UUU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uUU_anon'anon'x_anon'x" x_0)
+instance (~) ty UUU_anon'anon'x_anon'x =>
+         HasField "uUU_anon'anon'x_anon'x" (Ptr UUU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"uUU_anon'anon'x_anon'x")
+instance HasCField UUU_anon'anon'x "uUU_anon'anon'x_anon'x"
+    where type CFieldType UUU_anon'anon'x
+                          "uUU_anon'anon'x_anon'x" = UUU_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "uUU_anon'anon'x_x" UUU_anon'anon'x ty
+    where getField = \x_0 -> getField @"uUU_anon'anon'x_anon'x_x" (getField @"uUU_anon'anon'x_anon'x" x_0)
+instance (~) ty CInt =>
+         HasField "uUU_anon'anon'x_x" UUU_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uUU_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"uUU_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"uUU_anon'anon'x_x" x_0)
+instance (~) ty CInt =>
+         HasField "uUU_anon'anon'x_x" (Ptr UUU_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"uUU_anon'anon'x_x")
+instance HasCField UUU_anon'anon'x "uUU_anon'anon'x_x"
+    where type CFieldType UUU_anon'anon'x "uUU_anon'anon'x_x" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union UUU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/multi_nesting.h 71:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/multi_nesting.h@
+-}
+newtype UUU = UUU {unwrapUUU :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize UUU
+deriving via (SizedByteArray 4 4) instance ReadRaw UUU
+deriving via (SizedByteArray 4 4) instance WriteRaw UUU
+deriving via (EquivStorable UUU) instance Storable UUU
+deriving via (SizedByteArray 4 4) instance IsUnion UUU
+instance (~) ty UUU_anon'anon'x =>
+         HasField "uUU_anon'anon'x" UUU ty
+    where getField = getUnionPayload
+instance (~) ty UUU_anon'anon'x =>
+         HasField "uUU_anon'anon'x" UUU ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uUU_anon'anon'x" x_0)
+instance (~) ty UUU_anon'anon'x =>
+         HasField "uUU_anon'anon'x" (Ptr UUU) (Ptr ty)
+    where getField = fromPtr (Proxy @"uUU_anon'anon'x")
+instance HasCField UUU "uUU_anon'anon'x"
+    where type CFieldType UUU "uUU_anon'anon'x" = UUU_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "uUU_x" UUU ty
+    where getField = \x_0 -> getField @"uUU_anon'anon'x_x" (getField @"uUU_anon'anon'x" x_0)
+instance (~) ty CInt => HasField "uUU_x" UUU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uUU_anon'anon'x" x_0 (\z_2 -> setField @"uUU_anon'anon'x_x" z_2 y_1),
+                              getField @"uUU_x" x_0)
+instance (~) ty CInt => HasField "uUU_x" (Ptr UUU) (Ptr ty)
+    where getField = fromPtr (Proxy @"uUU_x")
+instance HasCField UUU "uUU_x"
+    where type CFieldType UUU "uUU_x" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/padding/Example.hs b/test-artefacts/fixtures/types/anonymous/edge-cases/padding/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/padding/Example.hs
@@ -0,0 +1,966 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.SS_anon'y(..)
+    , Example.SS(..)
+    , Example.SU_anon'y(..)
+    , Example.SU(..)
+    , Example.US_anon'y(..)
+    , Example.US(..)
+    , Example.UU_anon'y(..)
+    , Example.UU(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@SS_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 15:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+data SS_anon'y = SS_anon'y
+  { sS_anon'y_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/padding.h 17:9@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SS_anon'y where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SS_anon'y where
+
+  readRaw =
+    \ptr0 ->
+          pure SS_anon'y
+      <*> HasCField.readRaw (BG.Proxy @"sS_anon'y_y") ptr0
+
+instance Marshal.WriteRaw SS_anon'y where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SS_anon'y sS_anon'y_y2 ->
+            HasCField.writeRaw (BG.Proxy @"sS_anon'y_y") ptr0 sS_anon'y_y2
+
+deriving via Marshal.EquivStorable SS_anon'y instance BG.Storable SS_anon'y
+
+deriving via Struct.IsStructViaReadRaw SS_anon'y instance Struct.IsStruct SS_anon'y
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 17:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sS_anon'y_y" SS_anon'y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         SS_anon'y {sS_anon'y_y = y1}, BG.getField @"sS_anon'y_y" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sS_anon'y_y" (BG.Ptr SS_anon'y) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sS_anon'y_y")
+
+instance HasCField.HasCField SS_anon'y "sS_anon'y_y" where
+
+  type CFieldType SS_anon'y "sS_anon'y_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct SS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 13:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+data SS = SS
+  { sS_x :: BG.CChar
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/padding.h 14:8@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+    -}
+  , sS_anon'y :: SS_anon'y
+    {- ^ __C declaration:__ @anon\'y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/padding.h 15:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+    -}
+  , sS_z :: BG.CInt
+    {- ^ __C declaration:__ @z@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/padding.h 19:7@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize SS where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SS where
+
+  readRaw =
+    \ptr0 ->
+          pure SS
+      <*> HasCField.readRaw (BG.Proxy @"sS_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"sS_anon'y") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"sS_z") ptr0
+
+instance Marshal.WriteRaw SS where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SS sS_x2 sS_anon'y3 sS_z4 ->
+               HasCField.writeRaw (BG.Proxy @"sS_x") ptr0 sS_x2
+            >> HasCField.writeRaw (BG.Proxy @"sS_anon'y") ptr0 sS_anon'y3
+            >> HasCField.writeRaw (BG.Proxy @"sS_z") ptr0 sS_z4
+
+deriving via Marshal.EquivStorable SS instance BG.Storable SS
+
+deriving via Struct.IsStructViaReadRaw SS instance Struct.IsStruct SS
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 14:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "sS_x" SS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SS { sS_x = y1
+             , sS_anon'y = BG.getField @"sS_anon'y" x0
+             , sS_z = BG.getField @"sS_z" x0
+             }
+      , BG.getField @"sS_x" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "sS_x" (BG.Ptr SS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sS_x")
+
+instance HasCField.HasCField SS "sS_x" where
+
+  type CFieldType SS "sS_x" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 15:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ SS_anon'y) => BG.CompatHasField.HasField "sS_anon'y" SS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SS {sS_anon'y = y1, sS_x = BG.getField @"sS_x" x0, sS_z = BG.getField @"sS_z" x0}
+      , BG.getField @"sS_anon'y" x0
+      )
+
+instance ( ty ~ SS_anon'y
+         ) => BG.HasField "sS_anon'y" (BG.Ptr SS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sS_anon'y")
+
+instance HasCField.HasCField SS "sS_anon'y" where
+
+  type CFieldType SS "sS_anon'y" = SS_anon'y
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 17:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "sS_y" SS ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sS_anon'y_y" (BG.getField @"sS_anon'y" x0)
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 17:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "sS_y" SS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sS_anon'y" x0 (\z2 ->
+                                                           BG.CompatHasField.setField @"sS_anon'y_y" z2 y1)
+      , BG.getField @"sS_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "sS_y" (BG.Ptr SS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sS_y")
+
+instance HasCField.HasCField SS "sS_y" where
+
+  type CFieldType SS "sS_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 19:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "sS_z" SS ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SS { sS_z = y1
+             , sS_x = BG.getField @"sS_x" x0
+             , sS_anon'y = BG.getField @"sS_anon'y" x0
+             }
+      , BG.getField @"sS_z" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "sS_z" (BG.Ptr SS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sS_z")
+
+instance HasCField.HasCField SS "sS_z" where
+
+  type CFieldType SS "sS_z" = BG.CInt
+
+  offset# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @union \@SU_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+newtype SU_anon'y = SU_anon'y
+  { unwrapSU_anon'y :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize SU_anon'y
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw SU_anon'y
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw SU_anon'y
+
+deriving via Marshal.EquivStorable SU_anon'y instance BG.Storable SU_anon'y
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion SU_anon'y
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 26:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "sU_anon'y_y" SU_anon'y ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 26:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "sU_anon'y_y" SU_anon'y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"sU_anon'y_y" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "sU_anon'y_y" (BG.Ptr SU_anon'y) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"sU_anon'y_y")
+
+instance HasCField.HasCField SU_anon'y "sU_anon'y_y" where
+
+  type CFieldType SU_anon'y "sU_anon'y_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct SU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 22:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+data SU = SU
+  { sU_x :: BG.CChar
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/padding.h 23:8@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+    -}
+  , sU_anon'y :: SU_anon'y
+    {- ^ __C declaration:__ @anon\'y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/padding.h 24:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+    -}
+  , sU_z :: BG.CInt
+    {- ^ __C declaration:__ @z@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/padding.h 28:7@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize SU where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw SU where
+
+  readRaw =
+    \ptr0 ->
+          pure SU
+      <*> HasCField.readRaw (BG.Proxy @"sU_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"sU_anon'y") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"sU_z") ptr0
+
+instance Marshal.WriteRaw SU where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          SU sU_x2 sU_anon'y3 sU_z4 ->
+               HasCField.writeRaw (BG.Proxy @"sU_x") ptr0 sU_x2
+            >> HasCField.writeRaw (BG.Proxy @"sU_anon'y") ptr0 sU_anon'y3
+            >> HasCField.writeRaw (BG.Proxy @"sU_z") ptr0 sU_z4
+
+deriving via Marshal.EquivStorable SU instance BG.Storable SU
+
+deriving via Struct.IsStructViaReadRaw SU instance Struct.IsStruct SU
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 23:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "sU_x" SU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SU { sU_x = y1
+             , sU_anon'y = BG.getField @"sU_anon'y" x0
+             , sU_z = BG.getField @"sU_z" x0
+             }
+      , BG.getField @"sU_x" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "sU_x" (BG.Ptr SU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sU_x")
+
+instance HasCField.HasCField SU "sU_x" where
+
+  type CFieldType SU "sU_x" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ SU_anon'y) => BG.CompatHasField.HasField "sU_anon'y" SU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SU {sU_anon'y = y1, sU_x = BG.getField @"sU_x" x0, sU_z = BG.getField @"sU_z" x0}
+      , BG.getField @"sU_anon'y" x0
+      )
+
+instance ( ty ~ SU_anon'y
+         ) => BG.HasField "sU_anon'y" (BG.Ptr SU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sU_anon'y")
+
+instance HasCField.HasCField SU "sU_anon'y" where
+
+  type CFieldType SU "sU_anon'y" = SU_anon'y
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 26:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "sU_y" SU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"sU_anon'y_y" (BG.getField @"sU_anon'y" x0)
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 26:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "sU_y" SU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"sU_anon'y" x0 (\z2 ->
+                                                           BG.CompatHasField.setField @"sU_anon'y_y" z2 y1)
+      , BG.getField @"sU_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "sU_y" (BG.Ptr SU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sU_y")
+
+instance HasCField.HasCField SU "sU_y" where
+
+  type CFieldType SU "sU_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 28:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "sU_z" SU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          SU { sU_z = y1
+             , sU_x = BG.getField @"sU_x" x0
+             , sU_anon'y = BG.getField @"sU_anon'y" x0
+             }
+      , BG.getField @"sU_z" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "sU_z" (BG.Ptr SU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"sU_z")
+
+instance HasCField.HasCField SU "sU_z" where
+
+  type CFieldType SU "sU_z" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct \@US_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 33:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+data US_anon'y = US_anon'y
+  { uS_anon'y_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/padding.h 35:9@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize US_anon'y where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw US_anon'y where
+
+  readRaw =
+    \ptr0 ->
+          pure US_anon'y
+      <*> HasCField.readRaw (BG.Proxy @"uS_anon'y_y") ptr0
+
+instance Marshal.WriteRaw US_anon'y where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          US_anon'y uS_anon'y_y2 ->
+            HasCField.writeRaw (BG.Proxy @"uS_anon'y_y") ptr0 uS_anon'y_y2
+
+deriving via Marshal.EquivStorable US_anon'y instance BG.Storable US_anon'y
+
+deriving via Struct.IsStructViaReadRaw US_anon'y instance Struct.IsStruct US_anon'y
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 35:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uS_anon'y_y" US_anon'y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         US_anon'y {uS_anon'y_y = y1}, BG.getField @"uS_anon'y_y" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uS_anon'y_y" (BG.Ptr US_anon'y) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uS_anon'y_y")
+
+instance HasCField.HasCField US_anon'y "uS_anon'y_y" where
+
+  type CFieldType US_anon'y "uS_anon'y_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union US@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 31:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+newtype US = US
+  { unwrapUS :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.StaticSize US
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.ReadRaw US
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.WriteRaw US
+
+deriving via Marshal.EquivStorable US instance BG.Storable US
+
+deriving via BG.SizedByteArray 8 4 instance Union.IsUnion US
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 32:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "uS_x" US ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 32:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "uS_x" US ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uS_x" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "uS_x" (BG.Ptr US) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uS_x")
+
+instance HasCField.HasCField US "uS_x" where
+
+  type CFieldType US "uS_x" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 33:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ US_anon'y) => BG.HasField "uS_anon'y" US ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 33:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ US_anon'y) => BG.CompatHasField.HasField "uS_anon'y" US ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uS_anon'y" x0)
+
+instance ( ty ~ US_anon'y
+         ) => BG.HasField "uS_anon'y" (BG.Ptr US) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uS_anon'y")
+
+instance HasCField.HasCField US "uS_anon'y" where
+
+  type CFieldType US "uS_anon'y" = US_anon'y
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 35:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "uS_y" US ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uS_anon'y_y" (BG.getField @"uS_anon'y" x0)
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 35:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "uS_y" US ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uS_anon'y" x0 (\z2 ->
+                                                           BG.CompatHasField.setField @"uS_anon'y_y" z2 y1)
+      , BG.getField @"uS_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "uS_y" (BG.Ptr US) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uS_y")
+
+instance HasCField.HasCField US "uS_y" where
+
+  type CFieldType US "uS_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 37:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "uS_z" US ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 37:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "uS_z" US ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uS_z" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "uS_z" (BG.Ptr US) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uS_z")
+
+instance HasCField.HasCField US "uS_z" where
+
+  type CFieldType US "uS_z" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@UU_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 42:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+newtype UU_anon'y = UU_anon'y
+  { unwrapUU_anon'y :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UU_anon'y
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UU_anon'y
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UU_anon'y
+
+deriving via Marshal.EquivStorable UU_anon'y instance BG.Storable UU_anon'y
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UU_anon'y
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 44:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "uU_anon'y_y" UU_anon'y ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 44:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "uU_anon'y_y" UU_anon'y ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uU_anon'y_y" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "uU_anon'y_y" (BG.Ptr UU_anon'y) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"uU_anon'y_y")
+
+instance HasCField.HasCField UU_anon'y "uU_anon'y_y" where
+
+  type CFieldType UU_anon'y "uU_anon'y_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union UU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 40:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+newtype UU = UU
+  { unwrapUU :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UU
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UU
+
+deriving via Marshal.EquivStorable UU instance BG.Storable UU
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UU
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 41:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "uU_x" UU ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 41:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "uU_x" UU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uU_x" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "uU_x" (BG.Ptr UU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU_x")
+
+instance HasCField.HasCField UU "uU_x" where
+
+  type CFieldType UU "uU_x" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 42:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ UU_anon'y) => BG.HasField "uU_anon'y" UU ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 42:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ UU_anon'y) => BG.CompatHasField.HasField "uU_anon'y" UU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uU_anon'y" x0)
+
+instance ( ty ~ UU_anon'y
+         ) => BG.HasField "uU_anon'y" (BG.Ptr UU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU_anon'y")
+
+instance HasCField.HasCField UU "uU_anon'y" where
+
+  type CFieldType UU "uU_anon'y" = UU_anon'y
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 44:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "uU_y" UU ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"uU_anon'y_y" (BG.getField @"uU_anon'y" x0)
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 44:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "uU_y" UU ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"uU_anon'y" x0 (\z2 ->
+                                                           BG.CompatHasField.setField @"uU_anon'y_y" z2 y1)
+      , BG.getField @"uU_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "uU_y" (BG.Ptr UU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU_y")
+
+instance HasCField.HasCField UU "uU_y" where
+
+  type CFieldType UU "uU_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 46:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "uU_z" UU ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 46:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "uU_z" UU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"uU_z" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "uU_z" (BG.Ptr UU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"uU_z")
+
+instance HasCField.HasCField UU "uU_z" where
+
+  type CFieldType UU "uU_z" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/padding/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/padding/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/padding/bindingspec.yaml
@@ -0,0 +1,176 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/edge-cases/padding.h
+  cname: struct SS
+  hsname: SS
+- headers: types/anonymous/edge-cases/padding.h
+  cname: struct @SS_anon'y
+  hsname: SS_anon'y
+- headers: types/anonymous/edge-cases/padding.h
+  cname: struct SU
+  hsname: SU
+- headers: types/anonymous/edge-cases/padding.h
+  cname: union @SU_anon'y
+  hsname: SU_anon'y
+- headers: types/anonymous/edge-cases/padding.h
+  cname: union US
+  hsname: US
+- headers: types/anonymous/edge-cases/padding.h
+  cname: struct @US_anon'y
+  hsname: US_anon'y
+- headers: types/anonymous/edge-cases/padding.h
+  cname: union UU
+  hsname: UU
+- headers: types/anonymous/edge-cases/padding.h
+  cname: union @UU_anon'y
+  hsname: UU_anon'y
+hstypes:
+- hsname: SS
+  representation:
+    record:
+      constructor: SS
+      fields:
+      - sS_x
+      - sS_anon'y
+      - sS_z
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SS_anon'y
+  representation:
+    record:
+      constructor: SS_anon'y
+      fields:
+      - sS_anon'y_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SU
+  representation:
+    record:
+      constructor: SU
+      fields:
+      - sU_x
+      - sU_anon'y
+      - sU_z
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: SU_anon'y
+  representation:
+    newtype:
+      constructor: SU_anon'y
+      fields:
+      - unwrapSU_anon'y
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: US
+  representation:
+    newtype:
+      constructor: US
+      fields:
+      - unwrapUS
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: US_anon'y
+  representation:
+    record:
+      constructor: US_anon'y
+      fields:
+      - uS_anon'y_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU
+  representation:
+    newtype:
+      constructor: UU
+      fields:
+      - unwrapUU
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UU_anon'y
+  representation:
+    newtype:
+      constructor: UU_anon'y
+      fields:
+      - unwrapUU_anon'y
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/padding/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/padding/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/padding/th.txt
@@ -0,0 +1,385 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/padding.h
+{-| __C declaration:__ @struct \@SS_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 15:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+data SS_anon'y
+    = SS_anon'y {sS_anon'y_y :: CInt
+                 {- ^ __C declaration:__ @y@
+
+                      __defined at:__ @types\/anonymous\/edge-cases\/padding.h 17:9@
+
+                      __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SS_anon'y
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SS_anon'y
+    where readRaw = \ptr_0 -> pure SS_anon'y <*> readRaw (Proxy @"sS_anon'y_y") ptr_0
+instance WriteRaw SS_anon'y
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SS_anon'y sS_anon'y_y_2 -> writeRaw (Proxy @"sS_anon'y_y") ptr_0 sS_anon'y_y_2
+deriving via (EquivStorable SS_anon'y) instance Storable SS_anon'y
+deriving via (IsStructViaReadRaw SS_anon'y) instance IsStruct SS_anon'y
+instance (~) ty CInt => HasField "sS_anon'y_y" SS_anon'y ty
+    where hasField = \x_0 -> (\y_1 -> SS_anon'y{sS_anon'y_y = y_1},
+                              getField @"sS_anon'y_y" x_0)
+instance (~) ty CInt =>
+         HasField "sS_anon'y_y" (Ptr SS_anon'y) (Ptr ty)
+    where getField = fromPtr (Proxy @"sS_anon'y_y")
+instance HasCField SS_anon'y "sS_anon'y_y"
+    where type CFieldType SS_anon'y "sS_anon'y_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct SS@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 13:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+data SS
+    = SS {sS_x :: CChar
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @types\/anonymous\/edge-cases\/padding.h 14:8@
+
+               __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+          -},
+          sS_anon'y :: SS_anon'y
+          {- ^ __C declaration:__ @anon\'y@
+
+               __defined at:__ @types\/anonymous\/edge-cases\/padding.h 15:3@
+
+               __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+          -},
+          sS_z :: CInt
+          {- ^ __C declaration:__ @z@
+
+               __defined at:__ @types\/anonymous\/edge-cases\/padding.h 19:7@
+
+               __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize SS
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SS
+    where readRaw = \ptr_0 -> ((pure SS <*> readRaw (Proxy @"sS_x") ptr_0) <*> readRaw (Proxy @"sS_anon'y") ptr_0) <*> readRaw (Proxy @"sS_z") ptr_0
+instance WriteRaw SS
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SS sS_x_2
+                                          sS_anon'y_3
+                                          sS_z_4 -> writeRaw (Proxy @"sS_x") ptr_0 sS_x_2 >> (writeRaw (Proxy @"sS_anon'y") ptr_0 sS_anon'y_3 >> writeRaw (Proxy @"sS_z") ptr_0 sS_z_4)
+deriving via (EquivStorable SS) instance Storable SS
+deriving via (IsStructViaReadRaw SS) instance IsStruct SS
+instance (~) ty CChar => HasField "sS_x" SS ty
+    where hasField = \x_0 -> (\y_1 -> SS{sS_x = y_1,
+                                         sS_anon'y = getField @"sS_anon'y" x_0,
+                                         sS_z = getField @"sS_z" x_0},
+                              getField @"sS_x" x_0)
+instance (~) ty CChar => HasField "sS_x" (Ptr SS) (Ptr ty)
+    where getField = fromPtr (Proxy @"sS_x")
+instance HasCField SS "sS_x"
+    where type CFieldType SS "sS_x" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty SS_anon'y => HasField "sS_anon'y" SS ty
+    where hasField = \x_0 -> (\y_1 -> SS{sS_anon'y = y_1,
+                                         sS_x = getField @"sS_x" x_0,
+                                         sS_z = getField @"sS_z" x_0},
+                              getField @"sS_anon'y" x_0)
+instance (~) ty SS_anon'y => HasField "sS_anon'y" (Ptr SS) (Ptr ty)
+    where getField = fromPtr (Proxy @"sS_anon'y")
+instance HasCField SS "sS_anon'y"
+    where type CFieldType SS "sS_anon'y" = SS_anon'y
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "sS_y" SS ty
+    where getField = \x_0 -> getField @"sS_anon'y_y" (getField @"sS_anon'y" x_0)
+instance (~) ty CInt => HasField "sS_y" SS ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sS_anon'y" x_0 (\z_2 -> setField @"sS_anon'y_y" z_2 y_1),
+                              getField @"sS_y" x_0)
+instance (~) ty CInt => HasField "sS_y" (Ptr SS) (Ptr ty)
+    where getField = fromPtr (Proxy @"sS_y")
+instance HasCField SS "sS_y"
+    where type CFieldType SS "sS_y" = CInt
+          offset# = \_ -> \_ -> 8
+instance (~) ty CInt => HasField "sS_z" SS ty
+    where hasField = \x_0 -> (\y_1 -> SS{sS_z = y_1,
+                                         sS_x = getField @"sS_x" x_0,
+                                         sS_anon'y = getField @"sS_anon'y" x_0},
+                              getField @"sS_z" x_0)
+instance (~) ty CInt => HasField "sS_z" (Ptr SS) (Ptr ty)
+    where getField = fromPtr (Proxy @"sS_z")
+instance HasCField SS "sS_z"
+    where type CFieldType SS "sS_z" = CInt
+          offset# = \_ -> \_ -> 12
+{-| __C declaration:__ @union \@SU_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 24:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+newtype SU_anon'y
+    = SU_anon'y {unwrapSU_anon'y :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize SU_anon'y
+deriving via (SizedByteArray 4 4) instance ReadRaw SU_anon'y
+deriving via (SizedByteArray 4 4) instance WriteRaw SU_anon'y
+deriving via (EquivStorable SU_anon'y) instance Storable SU_anon'y
+deriving via (SizedByteArray 4 4) instance IsUnion SU_anon'y
+instance (~) ty CInt => HasField "sU_anon'y_y" SU_anon'y ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "sU_anon'y_y" SU_anon'y ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"sU_anon'y_y" x_0)
+instance (~) ty CInt =>
+         HasField "sU_anon'y_y" (Ptr SU_anon'y) (Ptr ty)
+    where getField = fromPtr (Proxy @"sU_anon'y_y")
+instance HasCField SU_anon'y "sU_anon'y_y"
+    where type CFieldType SU_anon'y "sU_anon'y_y" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct SU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 22:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+data SU
+    = SU {sU_x :: CChar
+          {- ^ __C declaration:__ @x@
+
+               __defined at:__ @types\/anonymous\/edge-cases\/padding.h 23:8@
+
+               __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+          -},
+          sU_anon'y :: SU_anon'y
+          {- ^ __C declaration:__ @anon\'y@
+
+               __defined at:__ @types\/anonymous\/edge-cases\/padding.h 24:3@
+
+               __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+          -},
+          sU_z :: CInt
+          {- ^ __C declaration:__ @z@
+
+               __defined at:__ @types\/anonymous\/edge-cases\/padding.h 28:7@
+
+               __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+          -}}
+    deriving stock Generic
+instance StaticSize SU
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw SU
+    where readRaw = \ptr_0 -> ((pure SU <*> readRaw (Proxy @"sU_x") ptr_0) <*> readRaw (Proxy @"sU_anon'y") ptr_0) <*> readRaw (Proxy @"sU_z") ptr_0
+instance WriteRaw SU
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       SU sU_x_2
+                                          sU_anon'y_3
+                                          sU_z_4 -> writeRaw (Proxy @"sU_x") ptr_0 sU_x_2 >> (writeRaw (Proxy @"sU_anon'y") ptr_0 sU_anon'y_3 >> writeRaw (Proxy @"sU_z") ptr_0 sU_z_4)
+deriving via (EquivStorable SU) instance Storable SU
+deriving via (IsStructViaReadRaw SU) instance IsStruct SU
+instance (~) ty CChar => HasField "sU_x" SU ty
+    where hasField = \x_0 -> (\y_1 -> SU{sU_x = y_1,
+                                         sU_anon'y = getField @"sU_anon'y" x_0,
+                                         sU_z = getField @"sU_z" x_0},
+                              getField @"sU_x" x_0)
+instance (~) ty CChar => HasField "sU_x" (Ptr SU) (Ptr ty)
+    where getField = fromPtr (Proxy @"sU_x")
+instance HasCField SU "sU_x"
+    where type CFieldType SU "sU_x" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty SU_anon'y => HasField "sU_anon'y" SU ty
+    where hasField = \x_0 -> (\y_1 -> SU{sU_anon'y = y_1,
+                                         sU_x = getField @"sU_x" x_0,
+                                         sU_z = getField @"sU_z" x_0},
+                              getField @"sU_anon'y" x_0)
+instance (~) ty SU_anon'y => HasField "sU_anon'y" (Ptr SU) (Ptr ty)
+    where getField = fromPtr (Proxy @"sU_anon'y")
+instance HasCField SU "sU_anon'y"
+    where type CFieldType SU "sU_anon'y" = SU_anon'y
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "sU_y" SU ty
+    where getField = \x_0 -> getField @"sU_anon'y_y" (getField @"sU_anon'y" x_0)
+instance (~) ty CInt => HasField "sU_y" SU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"sU_anon'y" x_0 (\z_2 -> setField @"sU_anon'y_y" z_2 y_1),
+                              getField @"sU_y" x_0)
+instance (~) ty CInt => HasField "sU_y" (Ptr SU) (Ptr ty)
+    where getField = fromPtr (Proxy @"sU_y")
+instance HasCField SU "sU_y"
+    where type CFieldType SU "sU_y" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "sU_z" SU ty
+    where hasField = \x_0 -> (\y_1 -> SU{sU_z = y_1,
+                                         sU_x = getField @"sU_x" x_0,
+                                         sU_anon'y = getField @"sU_anon'y" x_0},
+                              getField @"sU_z" x_0)
+instance (~) ty CInt => HasField "sU_z" (Ptr SU) (Ptr ty)
+    where getField = fromPtr (Proxy @"sU_z")
+instance HasCField SU "sU_z"
+    where type CFieldType SU "sU_z" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct \@US_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 33:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+data US_anon'y
+    = US_anon'y {uS_anon'y_y :: CInt
+                 {- ^ __C declaration:__ @y@
+
+                      __defined at:__ @types\/anonymous\/edge-cases\/padding.h 35:9@
+
+                      __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize US_anon'y
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw US_anon'y
+    where readRaw = \ptr_0 -> pure US_anon'y <*> readRaw (Proxy @"uS_anon'y_y") ptr_0
+instance WriteRaw US_anon'y
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       US_anon'y uS_anon'y_y_2 -> writeRaw (Proxy @"uS_anon'y_y") ptr_0 uS_anon'y_y_2
+deriving via (EquivStorable US_anon'y) instance Storable US_anon'y
+deriving via (IsStructViaReadRaw US_anon'y) instance IsStruct US_anon'y
+instance (~) ty CInt => HasField "uS_anon'y_y" US_anon'y ty
+    where hasField = \x_0 -> (\y_1 -> US_anon'y{uS_anon'y_y = y_1},
+                              getField @"uS_anon'y_y" x_0)
+instance (~) ty CInt =>
+         HasField "uS_anon'y_y" (Ptr US_anon'y) (Ptr ty)
+    where getField = fromPtr (Proxy @"uS_anon'y_y")
+instance HasCField US_anon'y "uS_anon'y_y"
+    where type CFieldType US_anon'y "uS_anon'y_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @union US@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 31:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+newtype US = US {unwrapUS :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 8 4) instance StaticSize US
+deriving via (SizedByteArray 8 4) instance ReadRaw US
+deriving via (SizedByteArray 8 4) instance WriteRaw US
+deriving via (EquivStorable US) instance Storable US
+deriving via (SizedByteArray 8 4) instance IsUnion US
+instance (~) ty CChar => HasField "uS_x" US ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "uS_x" US ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uS_x" x_0)
+instance (~) ty CChar => HasField "uS_x" (Ptr US) (Ptr ty)
+    where getField = fromPtr (Proxy @"uS_x")
+instance HasCField US "uS_x"
+    where type CFieldType US "uS_x" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty US_anon'y => HasField "uS_anon'y" US ty
+    where getField = getUnionPayload
+instance (~) ty US_anon'y => HasField "uS_anon'y" US ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uS_anon'y" x_0)
+instance (~) ty US_anon'y => HasField "uS_anon'y" (Ptr US) (Ptr ty)
+    where getField = fromPtr (Proxy @"uS_anon'y")
+instance HasCField US "uS_anon'y"
+    where type CFieldType US "uS_anon'y" = US_anon'y
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "uS_y" US ty
+    where getField = \x_0 -> getField @"uS_anon'y_y" (getField @"uS_anon'y" x_0)
+instance (~) ty CInt => HasField "uS_y" US ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uS_anon'y" x_0 (\z_2 -> setField @"uS_anon'y_y" z_2 y_1),
+                              getField @"uS_y" x_0)
+instance (~) ty CInt => HasField "uS_y" (Ptr US) (Ptr ty)
+    where getField = fromPtr (Proxy @"uS_y")
+instance HasCField US "uS_y"
+    where type CFieldType US "uS_y" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "uS_z" US ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "uS_z" US ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uS_z" x_0)
+instance (~) ty CInt => HasField "uS_z" (Ptr US) (Ptr ty)
+    where getField = fromPtr (Proxy @"uS_z")
+instance HasCField US "uS_z"
+    where type CFieldType US "uS_z" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@UU_anon\'y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 42:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+newtype UU_anon'y
+    = UU_anon'y {unwrapUU_anon'y :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize UU_anon'y
+deriving via (SizedByteArray 4 4) instance ReadRaw UU_anon'y
+deriving via (SizedByteArray 4 4) instance WriteRaw UU_anon'y
+deriving via (EquivStorable UU_anon'y) instance Storable UU_anon'y
+deriving via (SizedByteArray 4 4) instance IsUnion UU_anon'y
+instance (~) ty CInt => HasField "uU_anon'y_y" UU_anon'y ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "uU_anon'y_y" UU_anon'y ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uU_anon'y_y" x_0)
+instance (~) ty CInt =>
+         HasField "uU_anon'y_y" (Ptr UU_anon'y) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU_anon'y_y")
+instance HasCField UU_anon'y "uU_anon'y_y"
+    where type CFieldType UU_anon'y "uU_anon'y_y" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union UU@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/padding.h 40:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/padding.h@
+-}
+newtype UU = UU {unwrapUU :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize UU
+deriving via (SizedByteArray 4 4) instance ReadRaw UU
+deriving via (SizedByteArray 4 4) instance WriteRaw UU
+deriving via (EquivStorable UU) instance Storable UU
+deriving via (SizedByteArray 4 4) instance IsUnion UU
+instance (~) ty CChar => HasField "uU_x" UU ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "uU_x" UU ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uU_x" x_0)
+instance (~) ty CChar => HasField "uU_x" (Ptr UU) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU_x")
+instance HasCField UU "uU_x"
+    where type CFieldType UU "uU_x" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty UU_anon'y => HasField "uU_anon'y" UU ty
+    where getField = getUnionPayload
+instance (~) ty UU_anon'y => HasField "uU_anon'y" UU ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uU_anon'y" x_0)
+instance (~) ty UU_anon'y => HasField "uU_anon'y" (Ptr UU) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU_anon'y")
+instance HasCField UU "uU_anon'y"
+    where type CFieldType UU "uU_anon'y" = UU_anon'y
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "uU_y" UU ty
+    where getField = \x_0 -> getField @"uU_anon'y_y" (getField @"uU_anon'y" x_0)
+instance (~) ty CInt => HasField "uU_y" UU ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"uU_anon'y" x_0 (\z_2 -> setField @"uU_anon'y_y" z_2 y_1),
+                              getField @"uU_y" x_0)
+instance (~) ty CInt => HasField "uU_y" (Ptr UU) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU_y")
+instance HasCField UU "uU_y"
+    where type CFieldType UU "uU_y" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "uU_z" UU ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "uU_z" UU ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"uU_z" x_0)
+instance (~) ty CInt => HasField "uU_z" (Ptr UU) (Ptr ty)
+    where getField = fromPtr (Proxy @"uU_z")
+instance HasCField UU "uU_z"
+    where type CFieldType UU "uU_z" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/reparse/Example.hs b/test-artefacts/fixtures/types/anonymous/edge-cases/reparse/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/reparse/Example.hs
@@ -0,0 +1,489 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    , Example.B(..)
+    , Example.S_anon'anon'x_anon'x(..)
+    , Example.S_anon'anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 3:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+newtype A = A
+  { unwrapA :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 4:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+newtype B = B
+  { unwrapB :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "unwrapB" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {unwrapB = y1}, BG.getField @"unwrapB" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "unwrapB" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapB")
+
+instance HasCField.HasCField B "unwrapB" where
+
+  type CFieldType B "unwrapB" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 8:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+data S_anon'anon'x_anon'x = S_anon'anon'x_anon'x
+  { s_anon'anon'x_anon'x_x :: A
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 9:9@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0 s_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x instance BG.Storable S_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x_anon'x instance Struct.IsStruct S_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 9:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance ( ty ~ A
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ A
+         ) => BG.HasField "s_anon'anon'x_anon'x_x" (BG.Ptr S_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" where
+
+  type CFieldType S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" =
+    A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 7:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+data S_anon'anon'x = S_anon'anon'x
+  { s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 8:5@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+    -}
+  , s_anon'anon'x_y :: B
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 11:7@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_y") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x s_anon'anon'x_anon'x2 s_anon'anon'x_y3 ->
+               HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0 s_anon'anon'x_anon'x2
+            >> HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_y") ptr0 s_anon'anon'x_y3
+
+deriving via Marshal.EquivStorable S_anon'anon'x instance BG.Storable S_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x instance Struct.IsStruct S_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 8:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x {s_anon'anon'x_anon'x = y1, s_anon'anon'x_y = BG.getField @"s_anon'anon'x_y" x0}
+      , BG.getField @"s_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.HasField "s_anon'anon'x_anon'x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_anon'x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_anon'x" =
+    S_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 9:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance (ty ~ A) => BG.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_anon'x_x" (BG.getField @"s_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 9:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance ( ty ~ A
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                      BG.CompatHasField.setField @"s_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"s_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ A
+         ) => BG.HasField "s_anon'anon'x_x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_x" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 11:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance ( ty ~ B
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_y" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x { s_anon'anon'x_y = y1
+                        , s_anon'anon'x_anon'x = BG.getField @"s_anon'anon'x_anon'x" x0
+                        }
+      , BG.getField @"s_anon'anon'x_y" x0
+      )
+
+instance ( ty ~ B
+         ) => BG.HasField "s_anon'anon'x_y" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_y")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_y" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_y" = B
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 6:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+data S = S
+  { s_anon'anon'x :: S_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 7:3@
+
+         __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x") ptr0 s_anon'anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 7:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance ( ty ~ S_anon'anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'anon'x = y1}, BG.getField @"s_anon'anon'x" x0)
+
+instance ( ty ~ S_anon'anon'x
+         ) => BG.HasField "s_anon'anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x")
+
+instance HasCField.HasCField S "s_anon'anon'x" where
+
+  type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 9:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance (ty ~ A) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_x" (BG.getField @"s_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 9:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance (ty ~ A) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x" x0 (\z2 ->
+                                                               BG.CompatHasField.setField @"s_anon'anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ A) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 11:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance (ty ~ B) => BG.HasField "s_y" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_y" (BG.getField @"s_anon'anon'x" x0)
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 11:7@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+instance (ty ~ B) => BG.CompatHasField.HasField "s_y" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x" x0 (\z2 ->
+                                                               BG.CompatHasField.setField @"s_anon'anon'x_y" z2 y1)
+      , BG.getField @"s_y" x0
+      )
+
+instance (ty ~ B) => BG.HasField "s_y" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_y")
+
+instance HasCField.HasCField S "s_y" where
+
+  type CFieldType S "s_y" = B
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/reparse/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/edge-cases/reparse/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/reparse/bindingspec.yaml
@@ -0,0 +1,147 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/edge-cases/reparse.h
+  cname: macro A
+  hsname: A
+- headers: types/anonymous/edge-cases/reparse.h
+  cname: macro B
+  hsname: B
+- headers: types/anonymous/edge-cases/reparse.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/edge-cases/reparse.h
+  cname: struct @S_anon'anon'x
+  hsname: S_anon'anon'x
+- headers: types/anonymous/edge-cases/reparse.h
+  cname: struct @S_anon'anon'x_anon'x
+  hsname: S_anon'anon'x_anon'x
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x
+      fields:
+      - s_anon'anon'x_anon'x
+      - s_anon'anon'x_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x_anon'x
+      fields:
+      - s_anon'anon'x_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/edge-cases/reparse/th.txt b/test-artefacts/fixtures/types/anonymous/edge-cases/reparse/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/edge-cases/reparse/th.txt
@@ -0,0 +1,223 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/edge-cases/reparse.h
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 3:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+newtype A
+    = A {unwrapA :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty CInt => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro B@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 4:9@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+newtype B
+    = B {unwrapB :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapB" B ty
+    where hasField = \x_0 -> (\y_1 -> B{unwrapB = y_1},
+                              getField @"unwrapB" x_0)
+instance (~) ty CChar => HasField "unwrapB" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapB")
+instance HasCField B "unwrapB"
+    where type CFieldType B "unwrapB" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 8:5@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+data S_anon'anon'x_anon'x
+    = S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x :: A
+                            {- ^ __C declaration:__ @x@
+
+                                 __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 9:9@
+
+                                 __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x_anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw S_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0 s_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable S_anon'anon'x_anon'x) instance Storable S_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x_anon'x) instance IsStruct S_anon'anon'x_anon'x
+instance (~) ty A =>
+         HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x_anon'x{s_anon'anon'x_anon'x_x = y_1},
+                              getField @"s_anon'anon'x_anon'x_x" x_0)
+instance (~) ty A =>
+         HasField "s_anon'anon'x_anon'x_x"
+                  (Ptr S_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x_x")
+instance HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x"
+    where type CFieldType S_anon'anon'x_anon'x
+                          "s_anon'anon'x_anon'x_x" = A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 7:3@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+data S_anon'anon'x
+    = S_anon'anon'x {s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+                     {- ^ __C declaration:__ @anon\'x@
+
+                          __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 8:5@
+
+                          __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+                     -},
+                     s_anon'anon'x_y :: B
+                     {- ^ __C declaration:__ @y@
+
+                          __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 11:7@
+
+                          __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x
+    where readRaw = \ptr_0 -> (pure S_anon'anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0) <*> readRaw (Proxy @"s_anon'anon'x_y") ptr_0
+instance WriteRaw S_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x s_anon'anon'x_anon'x_2
+                                                     s_anon'anon'x_y_3 -> writeRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0 s_anon'anon'x_anon'x_2 >> writeRaw (Proxy @"s_anon'anon'x_y") ptr_0 s_anon'anon'x_y_3
+deriving via (EquivStorable S_anon'anon'x) instance Storable S_anon'anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x) instance IsStruct S_anon'anon'x
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_anon'x = y_1,
+                                                    s_anon'anon'x_y = getField @"s_anon'anon'x_y" x_0},
+                              getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_anon'x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_anon'x" = S_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty A => HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_anon'x_x" (getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty A => HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"s_anon'anon'x_x" x_0)
+instance (~) ty A =>
+         HasField "s_anon'anon'x_x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_x"
+    where type CFieldType S_anon'anon'x "s_anon'anon'x_x" = A
+          offset# = \_ -> \_ -> 0
+instance (~) ty B => HasField "s_anon'anon'x_y" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_y = y_1,
+                                                    s_anon'anon'x_anon'x = getField @"s_anon'anon'x_anon'x" x_0},
+                              getField @"s_anon'anon'x_y" x_0)
+instance (~) ty B =>
+         HasField "s_anon'anon'x_y" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_y")
+instance HasCField S_anon'anon'x "s_anon'anon'x_y"
+    where type CFieldType S_anon'anon'x "s_anon'anon'x_y" = B
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 6:8@
+
+    __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+-}
+data S
+    = S {s_anon'anon'x :: S_anon'anon'x
+         {- ^ __C declaration:__ @anon\'anon\'x@
+
+              __defined at:__ @types\/anonymous\/edge-cases\/reparse.h 7:3@
+
+              __exported by:__ @types\/anonymous\/edge-cases\/reparse.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x") ptr_0 s_anon'anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'anon'x => HasField "s_anon'anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'anon'x = y_1},
+                              getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x =>
+         HasField "s_anon'anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x")
+instance HasCField S "s_anon'anon'x"
+    where type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty A => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_x" (getField @"s_anon'anon'x" x_0)
+instance (~) ty A => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty A => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = A
+          offset# = \_ -> \_ -> 0
+instance (~) ty B => HasField "s_y" S ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_y" (getField @"s_anon'anon'x" x_0)
+instance (~) ty B => HasField "s_y" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_y" z_2 y_1),
+                              getField @"s_y" x_0)
+instance (~) ty B => HasField "s_y" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_y")
+instance HasCField S "s_y"
+    where type CFieldType S "s_y" = B
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_tagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_tagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_tagged/Example.hs
@@ -0,0 +1,427 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , pattern Example.A
+    , Example.S_anon'anon'x_anon'x(..)
+    , Example.S_anon'anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T unwrapT2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapT2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via BG.CUInt instance BG.Prim T
+
+instance CEnum.CEnum T where
+
+  type CEnumZ T = BG.CUInt
+
+  toCEnum = T
+
+  fromCEnum = BG.getField @"unwrapT"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "A")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "T"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "T"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum T where
+
+  minDeclaredValue = A
+
+  maxDeclaredValue = A
+
+instance Show T where
+
+  showsPrec = CEnum.shows
+
+instance Read T where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+pattern A :: T
+pattern A = T 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+data S_anon'anon'x_anon'x = S_anon'anon'x_anon'x
+  { s_anon'anon'x_anon'x_x :: T
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0 s_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x instance BG.Storable S_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x_anon'x instance Struct.IsStruct S_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+instance ( ty ~ T
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ T
+         ) => BG.HasField "s_anon'anon'x_anon'x_x" (BG.Ptr S_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" where
+
+  type CFieldType S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" =
+    T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+data S_anon'anon'x = S_anon'anon'x
+  { s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x s_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0 s_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x instance BG.Storable S_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x instance Struct.IsStruct S_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> S_anon'anon'x {s_anon'anon'x_anon'x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.HasField "s_anon'anon'x_anon'x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_anon'x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_anon'x" =
+    S_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+instance (ty ~ T) => BG.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_anon'x_x" (BG.getField @"s_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+instance ( ty ~ T
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                      BG.CompatHasField.setField @"s_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"s_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ T
+         ) => BG.HasField "s_anon'anon'x_x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_x" = T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+data S = S
+  { s_anon'anon'x :: S_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x") ptr0 s_anon'anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+instance ( ty ~ S_anon'anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'anon'x = y1}, BG.getField @"s_anon'anon'x" x0)
+
+instance ( ty ~ S_anon'anon'x
+         ) => BG.HasField "s_anon'anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x")
+
+instance HasCField.HasCField S "s_anon'anon'x" where
+
+  type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+instance (ty ~ T) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_x" (BG.getField @"s_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x" x0 (\z2 ->
+                                                               BG.CompatHasField.setField @"s_anon'anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ T) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = T
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_tagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_tagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_tagged/bindingspec.yaml
@@ -0,0 +1,103 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/multi_nesting_enum_tagged.h
+  cname: enum T
+  hsname: T
+  enum: open
+- headers: types/anonymous/indirect-fields/multi_nesting_enum_tagged.h
+  cname: struct @S_anon'anon'x
+  hsname: S_anon'anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_enum_tagged.h
+  cname: struct @S_anon'anon'x_anon'x
+  hsname: S_anon'anon'x_anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_enum_tagged.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x
+      fields:
+      - s_anon'anon'x_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x_anon'x
+      fields:
+      - s_anon'anon'x_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_tagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_tagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_tagged/th.txt
@@ -0,0 +1,185 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_enum_tagged.h
+{-| __C declaration:__ @enum T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+newtype T
+    = T {unwrapT :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T unwrapT_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapT_2
+deriving via (EquivStorable T) instance Storable T
+deriving via CUInt instance Prim T
+instance CEnum T
+    where type CEnumZ T = CUInt
+          toCEnum = T
+          fromCEnum = getField @"unwrapT"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "A")]
+          showsUndeclared = showsWrappedUndeclared "T"
+          readPrecUndeclared = readPrecWrappedUndeclared "T"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum T
+    where minDeclaredValue = A
+          maxDeclaredValue = A
+instance Show T
+    where showsPrec = shows
+instance Read T
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CUInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+pattern A :: T
+pattern A = T 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+data S_anon'anon'x_anon'x
+    = S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x :: T
+                            {- ^ __C declaration:__ @x@
+
+                                 __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+                                 __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x_anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw S_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0 s_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable S_anon'anon'x_anon'x) instance Storable S_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x_anon'x) instance IsStruct S_anon'anon'x_anon'x
+instance (~) ty T =>
+         HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x_anon'x{s_anon'anon'x_anon'x_x = y_1},
+                              getField @"s_anon'anon'x_anon'x_x" x_0)
+instance (~) ty T =>
+         HasField "s_anon'anon'x_anon'x_x"
+                  (Ptr S_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x_x")
+instance HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x"
+    where type CFieldType S_anon'anon'x_anon'x
+                          "s_anon'anon'x_anon'x_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+data S_anon'anon'x
+    = S_anon'anon'x {s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+                     {- ^ __C declaration:__ @anon\'x@
+
+                          __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+                          __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0
+instance WriteRaw S_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x s_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0 s_anon'anon'x_anon'x_2
+deriving via (EquivStorable S_anon'anon'x) instance Storable S_anon'anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x) instance IsStruct S_anon'anon'x
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_anon'x = y_1},
+                              getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_anon'x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_anon'x" = S_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty T => HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_anon'x_x" (getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty T => HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"s_anon'anon'x_x" x_0)
+instance (~) ty T =>
+         HasField "s_anon'anon'x_x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_x"
+    where type CFieldType S_anon'anon'x "s_anon'anon'x_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+-}
+data S
+    = S {s_anon'anon'x :: S_anon'anon'x
+         {- ^ __C declaration:__ @anon\'anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_tagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x") ptr_0 s_anon'anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'anon'x => HasField "s_anon'anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'anon'x = y_1},
+                              getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x =>
+         HasField "s_anon'anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x")
+instance HasCField S "s_anon'anon'x"
+    where type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty T => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_x" (getField @"s_anon'anon'x" x_0)
+instance (~) ty T => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty T => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = T
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_untagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_untagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_untagged/Example.hs
@@ -0,0 +1,440 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S_anon'anon'x_anon'x_x(..)
+    , pattern Example.A
+    , Example.S_anon'anon'x_anon'x(..)
+    , Example.S_anon'anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum \@S_anon\'anon\'x_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+newtype S_anon'anon'x_anon'x_x = S_anon'anon'x_anon'x_x
+  { unwrapS_anon'anon'x_anon'x_x :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize S_anon'anon'x_anon'x_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x_anon'x_x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x_anon'x_x
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw S_anon'anon'x_anon'x_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x_anon'x_x unwrapS_anon'anon'x_anon'x_x2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapS_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x_x instance BG.Storable S_anon'anon'x_anon'x_x
+
+deriving via BG.CUInt instance BG.Prim S_anon'anon'x_anon'x_x
+
+instance CEnum.CEnum S_anon'anon'x_anon'x_x where
+
+  type CEnumZ S_anon'anon'x_anon'x_x = BG.CUInt
+
+  toCEnum = S_anon'anon'x_anon'x_x
+
+  fromCEnum =
+    BG.getField @"unwrapS_anon'anon'x_anon'x_x"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "A")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "S_anon'anon'x_anon'x_x"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "S_anon'anon'x_anon'x_x"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum S_anon'anon'x_anon'x_x where
+
+  minDeclaredValue = A
+
+  maxDeclaredValue = A
+
+instance Show S_anon'anon'x_anon'x_x where
+
+  showsPrec = CEnum.shows
+
+instance Read S_anon'anon'x_anon'x_x where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapS_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x_x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x_anon'x_x {unwrapS_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"unwrapS_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapS_anon'anon'x_anon'x_x" (BG.Ptr S_anon'anon'x_anon'x_x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapS_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x_x "unwrapS_anon'anon'x_anon'x_x" where
+
+  type CFieldType S_anon'anon'x_anon'x_x "unwrapS_anon'anon'x_anon'x_x" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+pattern A :: S_anon'anon'x_anon'x_x
+pattern A = S_anon'anon'x_anon'x_x 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+data S_anon'anon'x_anon'x = S_anon'anon'x_anon'x
+  { s_anon'anon'x_anon'x_x :: S_anon'anon'x_anon'x_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0 s_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x instance BG.Storable S_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x_anon'x instance Struct.IsStruct S_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_anon'anon'x_anon'x_x" (BG.Ptr S_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" where
+
+  type CFieldType S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" =
+    S_anon'anon'x_anon'x_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+data S_anon'anon'x = S_anon'anon'x
+  { s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x s_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0 s_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x instance BG.Storable S_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x instance Struct.IsStruct S_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> S_anon'anon'x {s_anon'anon'x_anon'x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.HasField "s_anon'anon'x_anon'x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_anon'x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_anon'x" =
+    S_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_anon'x_x" (BG.getField @"s_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                      BG.CompatHasField.setField @"s_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"s_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_anon'anon'x_x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_x" =
+    S_anon'anon'x_anon'x_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+data S = S
+  { s_anon'anon'x :: S_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x") ptr0 s_anon'anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'anon'x = y1}, BG.getField @"s_anon'anon'x" x0)
+
+instance ( ty ~ S_anon'anon'x
+         ) => BG.HasField "s_anon'anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x")
+
+instance HasCField.HasCField S "s_anon'anon'x" where
+
+  type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+instance (ty ~ S_anon'anon'x_anon'x_x) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_x" (BG.getField @"s_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x" x0 (\z2 ->
+                                                               BG.CompatHasField.setField @"s_anon'anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = S_anon'anon'x_anon'x_x
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_untagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_untagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_untagged/bindingspec.yaml
@@ -0,0 +1,103 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/multi_nesting_enum_untagged.h
+  cname: enum @S_anon'anon'x_anon'x_x
+  hsname: S_anon'anon'x_anon'x_x
+  enum: open
+- headers: types/anonymous/indirect-fields/multi_nesting_enum_untagged.h
+  cname: struct @S_anon'anon'x
+  hsname: S_anon'anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_enum_untagged.h
+  cname: struct @S_anon'anon'x_anon'x
+  hsname: S_anon'anon'x_anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_enum_untagged.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x
+      fields:
+      - s_anon'anon'x_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x_anon'x
+      fields:
+      - s_anon'anon'x_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x_x
+  representation:
+    newtype:
+      constructor: S_anon'anon'x_anon'x_x
+      fields:
+      - unwrapS_anon'anon'x_anon'x_x
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_untagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_untagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_enum_untagged/th.txt
@@ -0,0 +1,195 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_enum_untagged.h
+{-| __C declaration:__ @enum \@S_anon\'anon\'x_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+newtype S_anon'anon'x_anon'x_x
+    = S_anon'anon'x_anon'x_x {unwrapS_anon'anon'x_anon'x_x :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize S_anon'anon'x_anon'x_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x_anon'x_x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x_anon'x_x <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw S_anon'anon'x_anon'x_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x_anon'x_x unwrapS_anon'anon'x_anon'x_x_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapS_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable S_anon'anon'x_anon'x_x) instance Storable S_anon'anon'x_anon'x_x
+deriving via CUInt instance Prim S_anon'anon'x_anon'x_x
+instance CEnum S_anon'anon'x_anon'x_x
+    where type CEnumZ S_anon'anon'x_anon'x_x = CUInt
+          toCEnum = S_anon'anon'x_anon'x_x
+          fromCEnum = getField @"unwrapS_anon'anon'x_anon'x_x"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "A")]
+          showsUndeclared = showsWrappedUndeclared "S_anon'anon'x_anon'x_x"
+          readPrecUndeclared = readPrecWrappedUndeclared "S_anon'anon'x_anon'x_x"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum S_anon'anon'x_anon'x_x
+    where minDeclaredValue = A
+          maxDeclaredValue = A
+instance Show S_anon'anon'x_anon'x_x
+    where showsPrec = shows
+instance Read S_anon'anon'x_anon'x_x
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt =>
+         HasField "unwrapS_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x_x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x_anon'x_x{unwrapS_anon'anon'x_anon'x_x = y_1},
+                              getField @"unwrapS_anon'anon'x_anon'x_x" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapS_anon'anon'x_anon'x_x"
+                  (Ptr S_anon'anon'x_anon'x_x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapS_anon'anon'x_anon'x_x")
+instance HasCField S_anon'anon'x_anon'x_x
+                   "unwrapS_anon'anon'x_anon'x_x"
+    where type CFieldType S_anon'anon'x_anon'x_x
+                          "unwrapS_anon'anon'x_anon'x_x" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+pattern A :: S_anon'anon'x_anon'x_x
+pattern A = S_anon'anon'x_anon'x_x 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+data S_anon'anon'x_anon'x
+    = S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x :: S_anon'anon'x_anon'x_x
+                            {- ^ __C declaration:__ @x@
+
+                                 __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+                                 __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x_anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw S_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0 s_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable S_anon'anon'x_anon'x) instance Storable S_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x_anon'x) instance IsStruct S_anon'anon'x_anon'x
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x_anon'x{s_anon'anon'x_anon'x_x = y_1},
+                              getField @"s_anon'anon'x_anon'x_x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_anon'x_x"
+                  (Ptr S_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x_x")
+instance HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x"
+    where type CFieldType S_anon'anon'x_anon'x
+                          "s_anon'anon'x_anon'x_x" = S_anon'anon'x_anon'x_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+data S_anon'anon'x
+    = S_anon'anon'x {s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+                     {- ^ __C declaration:__ @anon\'x@
+
+                          __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+                          __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0
+instance WriteRaw S_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x s_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0 s_anon'anon'x_anon'x_2
+deriving via (EquivStorable S_anon'anon'x) instance Storable S_anon'anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x) instance IsStruct S_anon'anon'x
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_anon'x = y_1},
+                              getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_anon'x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_anon'x" = S_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_anon'x_x" (getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"s_anon'anon'x_x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_x" = S_anon'anon'x_anon'x_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+-}
+data S
+    = S {s_anon'anon'x :: S_anon'anon'x
+         {- ^ __C declaration:__ @anon\'anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_enum_untagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x") ptr_0 s_anon'anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'anon'x => HasField "s_anon'anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'anon'x = y_1},
+                              getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x =>
+         HasField "s_anon'anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x")
+instance HasCField S "s_anon'anon'x"
+    where type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_anon'anon'x_anon'x_x => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_x" (getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = S_anon'anon'x_anon'x_x
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_tagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_tagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_tagged/Example.hs
@@ -0,0 +1,384 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , Example.S_anon'anon'x_anon'x(..)
+    , Example.S_anon'anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+data T = T
+  { t_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> HasCField.readRaw (BG.Proxy @"t_a") ptr0
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T t_a2 ->
+            HasCField.writeRaw (BG.Proxy @"t_a") ptr0 t_a2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via Struct.IsStructViaReadRaw T instance Struct.IsStruct T
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_a" T ty where
+
+  hasField =
+    \x0 -> (\y1 -> T {t_a = y1}, BG.getField @"t_a" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_a" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_a")
+
+instance HasCField.HasCField T "t_a" where
+
+  type CFieldType T "t_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+data S_anon'anon'x_anon'x = S_anon'anon'x_anon'x
+  { s_anon'anon'x_anon'x_x :: T
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0 s_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x instance BG.Storable S_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x_anon'x instance Struct.IsStruct S_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+instance ( ty ~ T
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ T
+         ) => BG.HasField "s_anon'anon'x_anon'x_x" (BG.Ptr S_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" where
+
+  type CFieldType S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" =
+    T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+data S_anon'anon'x = S_anon'anon'x
+  { s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x s_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0 s_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x instance BG.Storable S_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x instance Struct.IsStruct S_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> S_anon'anon'x {s_anon'anon'x_anon'x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.HasField "s_anon'anon'x_anon'x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_anon'x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_anon'x" =
+    S_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+instance (ty ~ T) => BG.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_anon'x_x" (BG.getField @"s_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+instance ( ty ~ T
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                      BG.CompatHasField.setField @"s_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"s_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ T
+         ) => BG.HasField "s_anon'anon'x_x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_x" = T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+data S = S
+  { s_anon'anon'x :: S_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x") ptr0 s_anon'anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+instance ( ty ~ S_anon'anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'anon'x = y1}, BG.getField @"s_anon'anon'x" x0)
+
+instance ( ty ~ S_anon'anon'x
+         ) => BG.HasField "s_anon'anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x")
+
+instance HasCField.HasCField S "s_anon'anon'x" where
+
+  type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+instance (ty ~ T) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_x" (BG.getField @"s_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x" x0 (\z2 ->
+                                                               BG.CompatHasField.setField @"s_anon'anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ T) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = T
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_tagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_tagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_tagged/bindingspec.yaml
@@ -0,0 +1,94 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/multi_nesting_struct_tagged.h
+  cname: struct @S_anon'anon'x
+  hsname: S_anon'anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_struct_tagged.h
+  cname: struct @S_anon'anon'x_anon'x
+  hsname: S_anon'anon'x_anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_struct_tagged.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/indirect-fields/multi_nesting_struct_tagged.h
+  cname: struct T
+  hsname: T
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x
+      fields:
+      - s_anon'anon'x_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x_anon'x
+      fields:
+      - s_anon'anon'x_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    record:
+      constructor: T
+      fields:
+      - t_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_tagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_tagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_tagged/th.txt
@@ -0,0 +1,164 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_struct_tagged.h
+{-| __C declaration:__ @struct T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+data T
+    = T {t_a :: CInt
+         {- ^ __C declaration:__ @a@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRaw (Proxy @"t_a") ptr_0
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T t_a_2 -> writeRaw (Proxy @"t_a") ptr_0 t_a_2
+deriving via (EquivStorable T) instance Storable T
+deriving via (IsStructViaReadRaw T) instance IsStruct T
+instance (~) ty CInt => HasField "t_a" T ty
+    where hasField = \x_0 -> (\y_1 -> T{t_a = y_1},
+                              getField @"t_a" x_0)
+instance (~) ty CInt => HasField "t_a" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_a")
+instance HasCField T "t_a"
+    where type CFieldType T "t_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+data S_anon'anon'x_anon'x
+    = S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x :: T
+                            {- ^ __C declaration:__ @x@
+
+                                 __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+                                 __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x_anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw S_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0 s_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable S_anon'anon'x_anon'x) instance Storable S_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x_anon'x) instance IsStruct S_anon'anon'x_anon'x
+instance (~) ty T =>
+         HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x_anon'x{s_anon'anon'x_anon'x_x = y_1},
+                              getField @"s_anon'anon'x_anon'x_x" x_0)
+instance (~) ty T =>
+         HasField "s_anon'anon'x_anon'x_x"
+                  (Ptr S_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x_x")
+instance HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x"
+    where type CFieldType S_anon'anon'x_anon'x
+                          "s_anon'anon'x_anon'x_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+data S_anon'anon'x
+    = S_anon'anon'x {s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+                     {- ^ __C declaration:__ @anon\'x@
+
+                          __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+                          __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0
+instance WriteRaw S_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x s_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0 s_anon'anon'x_anon'x_2
+deriving via (EquivStorable S_anon'anon'x) instance Storable S_anon'anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x) instance IsStruct S_anon'anon'x
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_anon'x = y_1},
+                              getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_anon'x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_anon'x" = S_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty T => HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_anon'x_x" (getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty T => HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"s_anon'anon'x_x" x_0)
+instance (~) ty T =>
+         HasField "s_anon'anon'x_x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_x"
+    where type CFieldType S_anon'anon'x "s_anon'anon'x_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+-}
+data S
+    = S {s_anon'anon'x :: S_anon'anon'x
+         {- ^ __C declaration:__ @anon\'anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_tagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x") ptr_0 s_anon'anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'anon'x => HasField "s_anon'anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'anon'x = y_1},
+                              getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x =>
+         HasField "s_anon'anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x")
+instance HasCField S "s_anon'anon'x"
+    where type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty T => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_x" (getField @"s_anon'anon'x" x_0)
+instance (~) ty T => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty T => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = T
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_untagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_untagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_untagged/Example.hs
@@ -0,0 +1,396 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S_anon'anon'x_anon'x_x(..)
+    , Example.S_anon'anon'x_anon'x(..)
+    , Example.S_anon'anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+data S_anon'anon'x_anon'x_x = S_anon'anon'x_anon'x_x
+  { s_anon'anon'x_anon'x_x_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x_anon'x_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x_anon'x_x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x_anon'x_x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x_x_a") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x_anon'x_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x_anon'x_x s_anon'anon'x_anon'x_x_a2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x_x_a") ptr0 s_anon'anon'x_anon'x_x_a2
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x_x instance BG.Storable S_anon'anon'x_anon'x_x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x_anon'x_x instance Struct.IsStruct S_anon'anon'x_anon'x_x
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x_x_a" S_anon'anon'x_anon'x_x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x_anon'x_x {s_anon'anon'x_anon'x_x_a = y1}
+      , BG.getField @"s_anon'anon'x_anon'x_x_a" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s_anon'anon'x_anon'x_x_a" (BG.Ptr S_anon'anon'x_anon'x_x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x_x_a")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x_x "s_anon'anon'x_anon'x_x_a" where
+
+  type CFieldType S_anon'anon'x_anon'x_x "s_anon'anon'x_anon'x_x_a" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+data S_anon'anon'x_anon'x = S_anon'anon'x_anon'x
+  { s_anon'anon'x_anon'x_x :: S_anon'anon'x_anon'x_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0 s_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x instance BG.Storable S_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x_anon'x instance Struct.IsStruct S_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_anon'anon'x_anon'x_x" (BG.Ptr S_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" where
+
+  type CFieldType S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" =
+    S_anon'anon'x_anon'x_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+data S_anon'anon'x = S_anon'anon'x
+  { s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x s_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0 s_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x instance BG.Storable S_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x instance Struct.IsStruct S_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> S_anon'anon'x {s_anon'anon'x_anon'x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.HasField "s_anon'anon'x_anon'x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_anon'x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_anon'x" =
+    S_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_anon'x_x" (BG.getField @"s_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                      BG.CompatHasField.setField @"s_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"s_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_anon'anon'x_x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_x" =
+    S_anon'anon'x_anon'x_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+data S = S
+  { s_anon'anon'x :: S_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x") ptr0 s_anon'anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'anon'x = y1}, BG.getField @"s_anon'anon'x" x0)
+
+instance ( ty ~ S_anon'anon'x
+         ) => BG.HasField "s_anon'anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x")
+
+instance HasCField.HasCField S "s_anon'anon'x" where
+
+  type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+instance (ty ~ S_anon'anon'x_anon'x_x) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_x" (BG.getField @"s_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x" x0 (\z2 ->
+                                                               BG.CompatHasField.setField @"s_anon'anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = S_anon'anon'x_anon'x_x
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_untagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_untagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_untagged/bindingspec.yaml
@@ -0,0 +1,94 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/multi_nesting_struct_untagged.h
+  cname: struct @S_anon'anon'x
+  hsname: S_anon'anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_struct_untagged.h
+  cname: struct @S_anon'anon'x_anon'x
+  hsname: S_anon'anon'x_anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_struct_untagged.h
+  cname: struct @S_anon'anon'x_anon'x_x
+  hsname: S_anon'anon'x_anon'x_x
+- headers: types/anonymous/indirect-fields/multi_nesting_struct_untagged.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x
+      fields:
+      - s_anon'anon'x_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x_anon'x
+      fields:
+      - s_anon'anon'x_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x_x
+  representation:
+    record:
+      constructor: S_anon'anon'x_anon'x_x
+      fields:
+      - s_anon'anon'x_anon'x_x_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_untagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_untagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_struct_untagged/th.txt
@@ -0,0 +1,174 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_struct_untagged.h
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+data S_anon'anon'x_anon'x_x
+    = S_anon'anon'x_anon'x_x {s_anon'anon'x_anon'x_x_a :: CInt
+                              {- ^ __C declaration:__ @a@
+
+                                   __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+                                   __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+                              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x_anon'x_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x_anon'x_x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x_anon'x_x <*> readRaw (Proxy @"s_anon'anon'x_anon'x_x_a") ptr_0
+instance WriteRaw S_anon'anon'x_anon'x_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x_anon'x_x s_anon'anon'x_anon'x_x_a_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x_x_a") ptr_0 s_anon'anon'x_anon'x_x_a_2
+deriving via (EquivStorable S_anon'anon'x_anon'x_x) instance Storable S_anon'anon'x_anon'x_x
+deriving via (IsStructViaReadRaw S_anon'anon'x_anon'x_x) instance IsStruct S_anon'anon'x_anon'x_x
+instance (~) ty CInt =>
+         HasField "s_anon'anon'x_anon'x_x_a" S_anon'anon'x_anon'x_x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x_anon'x_x{s_anon'anon'x_anon'x_x_a = y_1},
+                              getField @"s_anon'anon'x_anon'x_x_a" x_0)
+instance (~) ty CInt =>
+         HasField "s_anon'anon'x_anon'x_x_a"
+                  (Ptr S_anon'anon'x_anon'x_x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x_x_a")
+instance HasCField S_anon'anon'x_anon'x_x
+                   "s_anon'anon'x_anon'x_x_a"
+    where type CFieldType S_anon'anon'x_anon'x_x
+                          "s_anon'anon'x_anon'x_x_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+data S_anon'anon'x_anon'x
+    = S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x :: S_anon'anon'x_anon'x_x
+                            {- ^ __C declaration:__ @x@
+
+                                 __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+                                 __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+                            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x_anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw S_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0 s_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable S_anon'anon'x_anon'x) instance Storable S_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x_anon'x) instance IsStruct S_anon'anon'x_anon'x
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x_anon'x{s_anon'anon'x_anon'x_x = y_1},
+                              getField @"s_anon'anon'x_anon'x_x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_anon'x_x"
+                  (Ptr S_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x_x")
+instance HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x"
+    where type CFieldType S_anon'anon'x_anon'x
+                          "s_anon'anon'x_anon'x_x" = S_anon'anon'x_anon'x_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+data S_anon'anon'x
+    = S_anon'anon'x {s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+                     {- ^ __C declaration:__ @anon\'x@
+
+                          __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+                          __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0
+instance WriteRaw S_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x s_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0 s_anon'anon'x_anon'x_2
+deriving via (EquivStorable S_anon'anon'x) instance Storable S_anon'anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x) instance IsStruct S_anon'anon'x
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_anon'x = y_1},
+                              getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_anon'x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_anon'x" = S_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_anon'x_x" (getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"s_anon'anon'x_x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_x" = S_anon'anon'x_anon'x_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+-}
+data S
+    = S {s_anon'anon'x :: S_anon'anon'x
+         {- ^ __C declaration:__ @anon\'anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_struct_untagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x") ptr_0 s_anon'anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'anon'x => HasField "s_anon'anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'anon'x = y_1},
+                              getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x =>
+         HasField "s_anon'anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x")
+instance HasCField S "s_anon'anon'x"
+    where type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_anon'anon'x_anon'x_x => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_x" (getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = S_anon'anon'x_anon'x_x
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_tagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_tagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_tagged/Example.hs
@@ -0,0 +1,375 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , Example.S_anon'anon'x_anon'x(..)
+    , Example.S_anon'anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Int, pure, type (~))
+
+{-| __C declaration:__ @union T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+newtype T = T
+  { unwrapT :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t_a" T ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_a" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t_a" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_a" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_a")
+
+instance HasCField.HasCField T "t_a" where
+
+  type CFieldType T "t_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+data S_anon'anon'x_anon'x = S_anon'anon'x_anon'x
+  { s_anon'anon'x_anon'x_x :: T
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0 s_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x instance BG.Storable S_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x_anon'x instance Struct.IsStruct S_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+instance ( ty ~ T
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ T
+         ) => BG.HasField "s_anon'anon'x_anon'x_x" (BG.Ptr S_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" where
+
+  type CFieldType S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" =
+    T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+data S_anon'anon'x = S_anon'anon'x
+  { s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x s_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0 s_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x instance BG.Storable S_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x instance Struct.IsStruct S_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> S_anon'anon'x {s_anon'anon'x_anon'x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.HasField "s_anon'anon'x_anon'x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_anon'x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_anon'x" =
+    S_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+instance (ty ~ T) => BG.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_anon'x_x" (BG.getField @"s_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+instance ( ty ~ T
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                      BG.CompatHasField.setField @"s_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"s_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ T
+         ) => BG.HasField "s_anon'anon'x_x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_x" = T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+data S = S
+  { s_anon'anon'x :: S_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x") ptr0 s_anon'anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+instance ( ty ~ S_anon'anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'anon'x = y1}, BG.getField @"s_anon'anon'x" x0)
+
+instance ( ty ~ S_anon'anon'x
+         ) => BG.HasField "s_anon'anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x")
+
+instance HasCField.HasCField S "s_anon'anon'x" where
+
+  type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+instance (ty ~ T) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_x" (BG.getField @"s_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x" x0 (\z2 ->
+                                                               BG.CompatHasField.setField @"s_anon'anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ T) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = T
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_tagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_tagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_tagged/bindingspec.yaml
@@ -0,0 +1,86 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/multi_nesting_union_tagged.h
+  cname: struct @S_anon'anon'x
+  hsname: S_anon'anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_union_tagged.h
+  cname: struct @S_anon'anon'x_anon'x
+  hsname: S_anon'anon'x_anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_union_tagged.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/indirect-fields/multi_nesting_union_tagged.h
+  cname: union T
+  hsname: T
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x
+      fields:
+      - s_anon'anon'x_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x_anon'x
+      fields:
+      - s_anon'anon'x_anon'x_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_tagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_tagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_tagged/th.txt
@@ -0,0 +1,153 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_union_tagged.h
+{-| __C declaration:__ @union T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+newtype T = T {unwrapT :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T
+deriving via (SizedByteArray 4 4) instance ReadRaw T
+deriving via (SizedByteArray 4 4) instance WriteRaw T
+deriving via (EquivStorable T) instance Storable T
+deriving via (SizedByteArray 4 4) instance IsUnion T
+instance (~) ty CInt => HasField "t_a" T ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t_a" T ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t_a" x_0)
+instance (~) ty CInt => HasField "t_a" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_a")
+instance HasCField T "t_a"
+    where type CFieldType T "t_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+data S_anon'anon'x_anon'x
+    = S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x :: T
+                            {- ^ __C declaration:__ @x@
+
+                                 __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+                                 __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+                            -}}
+    deriving stock Generic
+instance StaticSize S_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x_anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw S_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0 s_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable S_anon'anon'x_anon'x) instance Storable S_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x_anon'x) instance IsStruct S_anon'anon'x_anon'x
+instance (~) ty T =>
+         HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x_anon'x{s_anon'anon'x_anon'x_x = y_1},
+                              getField @"s_anon'anon'x_anon'x_x" x_0)
+instance (~) ty T =>
+         HasField "s_anon'anon'x_anon'x_x"
+                  (Ptr S_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x_x")
+instance HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x"
+    where type CFieldType S_anon'anon'x_anon'x
+                          "s_anon'anon'x_anon'x_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+data S_anon'anon'x
+    = S_anon'anon'x {s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+                     {- ^ __C declaration:__ @anon\'x@
+
+                          __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+                          __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+                     -}}
+    deriving stock Generic
+instance StaticSize S_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0
+instance WriteRaw S_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x s_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0 s_anon'anon'x_anon'x_2
+deriving via (EquivStorable S_anon'anon'x) instance Storable S_anon'anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x) instance IsStruct S_anon'anon'x
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_anon'x = y_1},
+                              getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_anon'x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_anon'x" = S_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty T => HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_anon'x_x" (getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty T => HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"s_anon'anon'x_x" x_0)
+instance (~) ty T =>
+         HasField "s_anon'anon'x_x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_x"
+    where type CFieldType S_anon'anon'x "s_anon'anon'x_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+-}
+data S
+    = S {s_anon'anon'x :: S_anon'anon'x
+         {- ^ __C declaration:__ @anon\'anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_tagged.h@
+         -}}
+    deriving stock Generic
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x") ptr_0 s_anon'anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'anon'x => HasField "s_anon'anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'anon'x = y_1},
+                              getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x =>
+         HasField "s_anon'anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x")
+instance HasCField S "s_anon'anon'x"
+    where type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty T => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_x" (getField @"s_anon'anon'x" x_0)
+instance (~) ty T => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty T => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = T
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_untagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_untagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_untagged/Example.hs
@@ -0,0 +1,384 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S_anon'anon'x_anon'x_x(..)
+    , Example.S_anon'anon'x_anon'x(..)
+    , Example.S_anon'anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Int, pure, type (~))
+
+{-| __C declaration:__ @union \@S_anon\'anon\'x_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+newtype S_anon'anon'x_anon'x_x = S_anon'anon'x_anon'x_x
+  { unwrapS_anon'anon'x_anon'x_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize S_anon'anon'x_anon'x_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw S_anon'anon'x_anon'x_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw S_anon'anon'x_anon'x_x
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x_x instance BG.Storable S_anon'anon'x_anon'x_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion S_anon'anon'x_anon'x_x
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s_anon'anon'x_anon'x_x_a" S_anon'anon'x_anon'x_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x_x_a" S_anon'anon'x_anon'x_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"s_anon'anon'x_anon'x_x_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s_anon'anon'x_anon'x_x_a" (BG.Ptr S_anon'anon'x_anon'x_x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x_x_a")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x_x "s_anon'anon'x_anon'x_x_a" where
+
+  type CFieldType S_anon'anon'x_anon'x_x "s_anon'anon'x_anon'x_x_a" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+data S_anon'anon'x_anon'x = S_anon'anon'x_anon'x
+  { s_anon'anon'x_anon'x_x :: S_anon'anon'x_anon'x_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S_anon'anon'x_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x_x") ptr0 s_anon'anon'x_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x_anon'x instance BG.Storable S_anon'anon'x_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x_anon'x instance Struct.IsStruct S_anon'anon'x_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x_x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_anon'anon'x_anon'x_x" (BG.Ptr S_anon'anon'x_anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" where
+
+  type CFieldType S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x" =
+    S_anon'anon'x_anon'x_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+data S_anon'anon'x = S_anon'anon'x
+  { s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S_anon'anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0
+
+instance Marshal.WriteRaw S_anon'anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'anon'x s_anon'anon'x_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x_anon'x") ptr0 s_anon'anon'x_anon'x2
+
+deriving via Marshal.EquivStorable S_anon'anon'x instance BG.Storable S_anon'anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'anon'x instance Struct.IsStruct S_anon'anon'x
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> S_anon'anon'x {s_anon'anon'x_anon'x = y1}
+      , BG.getField @"s_anon'anon'x_anon'x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x
+         ) => BG.HasField "s_anon'anon'x_anon'x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_anon'x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_anon'x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_anon'x" =
+    S_anon'anon'x_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_anon'x_x" (BG.getField @"s_anon'anon'x_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x_x" S_anon'anon'x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x_anon'x" x0 (\z2 ->
+                                                                      BG.CompatHasField.setField @"s_anon'anon'x_anon'x_x" z2 y1)
+      , BG.getField @"s_anon'anon'x_x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_anon'anon'x_x" (BG.Ptr S_anon'anon'x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x_x")
+
+instance HasCField.HasCField S_anon'anon'x "s_anon'anon'x_x" where
+
+  type CFieldType S_anon'anon'x "s_anon'anon'x_x" =
+    S_anon'anon'x_anon'x_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+data S = S
+  { s_anon'anon'x :: S_anon'anon'x
+    {- ^ __C declaration:__ @anon\'anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'anon'x") ptr0 s_anon'anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x
+         ) => BG.CompatHasField.HasField "s_anon'anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'anon'x = y1}, BG.getField @"s_anon'anon'x" x0)
+
+instance ( ty ~ S_anon'anon'x
+         ) => BG.HasField "s_anon'anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'anon'x")
+
+instance HasCField.HasCField S "s_anon'anon'x" where
+
+  type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+instance (ty ~ S_anon'anon'x_anon'x_x) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'anon'x_x" (BG.getField @"s_anon'anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'anon'x" x0 (\z2 ->
+                                                               BG.CompatHasField.setField @"s_anon'anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance ( ty ~ S_anon'anon'x_anon'x_x
+         ) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = S_anon'anon'x_anon'x_x
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_untagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_untagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_untagged/bindingspec.yaml
@@ -0,0 +1,86 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/multi_nesting_union_untagged.h
+  cname: struct @S_anon'anon'x
+  hsname: S_anon'anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_union_untagged.h
+  cname: struct @S_anon'anon'x_anon'x
+  hsname: S_anon'anon'x_anon'x
+- headers: types/anonymous/indirect-fields/multi_nesting_union_untagged.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/indirect-fields/multi_nesting_union_untagged.h
+  cname: union @S_anon'anon'x_anon'x_x
+  hsname: S_anon'anon'x_anon'x_x
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x
+      fields:
+      - s_anon'anon'x_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x
+  representation:
+    record:
+      constructor: S_anon'anon'x_anon'x
+      fields:
+      - s_anon'anon'x_anon'x_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'anon'x_anon'x_x
+  representation:
+    newtype:
+      constructor: S_anon'anon'x_anon'x_x
+      fields:
+      - unwrapS_anon'anon'x_anon'x_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_untagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_untagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/multi_nesting_union_untagged/th.txt
@@ -0,0 +1,170 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_union_untagged.h
+{-| __C declaration:__ @union \@S_anon\'anon\'x_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+newtype S_anon'anon'x_anon'x_x
+    = S_anon'anon'x_anon'x_x {unwrapS_anon'anon'x_anon'x_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize S_anon'anon'x_anon'x_x
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw S_anon'anon'x_anon'x_x
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw S_anon'anon'x_anon'x_x
+deriving via (EquivStorable S_anon'anon'x_anon'x_x) instance Storable S_anon'anon'x_anon'x_x
+deriving via (SizedByteArray 4
+                             4) instance IsUnion S_anon'anon'x_anon'x_x
+instance (~) ty CInt =>
+         HasField "s_anon'anon'x_anon'x_x_a" S_anon'anon'x_anon'x_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "s_anon'anon'x_anon'x_x_a" S_anon'anon'x_anon'x_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"s_anon'anon'x_anon'x_x_a" x_0)
+instance (~) ty CInt =>
+         HasField "s_anon'anon'x_anon'x_x_a"
+                  (Ptr S_anon'anon'x_anon'x_x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x_x_a")
+instance HasCField S_anon'anon'x_anon'x_x
+                   "s_anon'anon'x_anon'x_x_a"
+    where type CFieldType S_anon'anon'x_anon'x_x
+                          "s_anon'anon'x_anon'x_x_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+data S_anon'anon'x_anon'x
+    = S_anon'anon'x_anon'x {s_anon'anon'x_anon'x_x :: S_anon'anon'x_anon'x_x
+                            {- ^ __C declaration:__ @x@
+
+                                 __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+                                 __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+                            -}}
+    deriving stock Generic
+instance StaticSize S_anon'anon'x_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x_anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0
+instance WriteRaw S_anon'anon'x_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x_anon'x s_anon'anon'x_anon'x_x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x_x") ptr_0 s_anon'anon'x_anon'x_x_2
+deriving via (EquivStorable S_anon'anon'x_anon'x) instance Storable S_anon'anon'x_anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x_anon'x) instance IsStruct S_anon'anon'x_anon'x
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_anon'x_x" S_anon'anon'x_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x_anon'x{s_anon'anon'x_anon'x_x = y_1},
+                              getField @"s_anon'anon'x_anon'x_x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_anon'x_x"
+                  (Ptr S_anon'anon'x_anon'x)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x_x")
+instance HasCField S_anon'anon'x_anon'x "s_anon'anon'x_anon'x_x"
+    where type CFieldType S_anon'anon'x_anon'x
+                          "s_anon'anon'x_anon'x_x" = S_anon'anon'x_anon'x_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+data S_anon'anon'x
+    = S_anon'anon'x {s_anon'anon'x_anon'x :: S_anon'anon'x_anon'x
+                     {- ^ __C declaration:__ @anon\'x@
+
+                          __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+                          __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+                     -}}
+    deriving stock Generic
+instance StaticSize S_anon'anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'anon'x
+    where readRaw = \ptr_0 -> pure S_anon'anon'x <*> readRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0
+instance WriteRaw S_anon'anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'anon'x s_anon'anon'x_anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x_anon'x") ptr_0 s_anon'anon'x_anon'x_2
+deriving via (EquivStorable S_anon'anon'x) instance Storable S_anon'anon'x
+deriving via (IsStructViaReadRaw S_anon'anon'x) instance IsStruct S_anon'anon'x
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'anon'x{s_anon'anon'x_anon'x = y_1},
+                              getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x =>
+         HasField "s_anon'anon'x_anon'x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_anon'x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_anon'x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_anon'x" = S_anon'anon'x_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_anon'x_x" (getField @"s_anon'anon'x_anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_x" S_anon'anon'x ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x_anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_anon'x_x" z_2 y_1),
+                              getField @"s_anon'anon'x_x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_anon'anon'x_x" (Ptr S_anon'anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x_x")
+instance HasCField S_anon'anon'x "s_anon'anon'x_x"
+    where type CFieldType S_anon'anon'x
+                          "s_anon'anon'x_x" = S_anon'anon'x_anon'x_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+-}
+data S
+    = S {s_anon'anon'x :: S_anon'anon'x
+         {- ^ __C declaration:__ @anon\'anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/multi_nesting_union_untagged.h@
+         -}}
+    deriving stock Generic
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'anon'x_2 -> writeRaw (Proxy @"s_anon'anon'x") ptr_0 s_anon'anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'anon'x => HasField "s_anon'anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'anon'x = y_1},
+                              getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x =>
+         HasField "s_anon'anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'anon'x")
+instance HasCField S "s_anon'anon'x"
+    where type CFieldType S "s_anon'anon'x" = S_anon'anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_anon'anon'x_anon'x_x => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'anon'x_x" (getField @"s_anon'anon'x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'anon'x" x_0 (\z_2 -> setField @"s_anon'anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty S_anon'anon'x_anon'x_x =>
+         HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = S_anon'anon'x_anon'x_x
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_tagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_tagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_tagged/Example.hs
@@ -0,0 +1,306 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , pattern Example.A
+    , Example.S_anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T unwrapT2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapT2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via BG.CUInt instance BG.Prim T
+
+instance CEnum.CEnum T where
+
+  type CEnumZ T = BG.CUInt
+
+  toCEnum = T
+
+  fromCEnum = BG.getField @"unwrapT"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "A")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "T"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "T"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum T where
+
+  minDeclaredValue = A
+
+  maxDeclaredValue = A
+
+instance Show T where
+
+  showsPrec = CEnum.shows
+
+instance Read T where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+pattern A :: T
+pattern A = T 0
+
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+data S_anon'x = S_anon'x
+  { s_anon'x_x :: T
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'x s_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x_x") ptr0 s_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'x instance BG.Storable S_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'x instance Struct.IsStruct S_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_anon'x_x" S_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_anon'x {s_anon'x_x = y1}, BG.getField @"s_anon'x_x" x0)
+
+instance ( ty ~ T
+         ) => BG.HasField "s_anon'x_x" (BG.Ptr S_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x_x")
+
+instance HasCField.HasCField S_anon'x "s_anon'x_x" where
+
+  type CFieldType S_anon'x "s_anon'x_x" = T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+data S = S
+  { s_anon'x :: S_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x") ptr0 s_anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+instance (ty ~ S_anon'x) => BG.CompatHasField.HasField "s_anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'x = y1}, BG.getField @"s_anon'x" x0)
+
+instance (ty ~ S_anon'x) => BG.HasField "s_anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x")
+
+instance HasCField.HasCField S "s_anon'x" where
+
+  type CFieldType S "s_anon'x" = S_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+instance (ty ~ T) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'x_x" (BG.getField @"s_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'x" x0 (\z2 ->
+                                                          BG.CompatHasField.setField @"s_anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ T) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = T
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_tagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_tagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_tagged/bindingspec.yaml
@@ -0,0 +1,81 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/single_nesting_enum_tagged.h
+  cname: enum T
+  hsname: T
+  enum: open
+- headers: types/anonymous/indirect-fields/single_nesting_enum_tagged.h
+  cname: struct @S_anon'x
+  hsname: S_anon'x
+- headers: types/anonymous/indirect-fields/single_nesting_enum_tagged.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'x
+  representation:
+    record:
+      constructor: S_anon'x
+      fields:
+      - s_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_tagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_tagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_tagged/th.txt
@@ -0,0 +1,132 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_enum_tagged.h
+{-| __C declaration:__ @enum T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+newtype T
+    = T {unwrapT :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T unwrapT_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapT_2
+deriving via (EquivStorable T) instance Storable T
+deriving via CUInt instance Prim T
+instance CEnum T
+    where type CEnumZ T = CUInt
+          toCEnum = T
+          fromCEnum = getField @"unwrapT"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "A")]
+          showsUndeclared = showsWrappedUndeclared "T"
+          readPrecUndeclared = readPrecWrappedUndeclared "T"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum T
+    where minDeclaredValue = A
+          maxDeclaredValue = A
+instance Show T
+    where showsPrec = shows
+instance Read T
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty CUInt => HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+pattern A :: T
+pattern A = T 0
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+data S_anon'x
+    = S_anon'x {s_anon'x_x :: T
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+                     __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'x <*> readRaw (Proxy @"s_anon'x_x") ptr_0
+instance WriteRaw S_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'x s_anon'x_x_2 -> writeRaw (Proxy @"s_anon'x_x") ptr_0 s_anon'x_x_2
+deriving via (EquivStorable S_anon'x) instance Storable S_anon'x
+deriving via (IsStructViaReadRaw S_anon'x) instance IsStruct S_anon'x
+instance (~) ty T => HasField "s_anon'x_x" S_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'x{s_anon'x_x = y_1},
+                              getField @"s_anon'x_x" x_0)
+instance (~) ty T => HasField "s_anon'x_x" (Ptr S_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x_x")
+instance HasCField S_anon'x "s_anon'x_x"
+    where type CFieldType S_anon'x "s_anon'x_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+-}
+data S
+    = S {s_anon'x :: S_anon'x
+         {- ^ __C declaration:__ @anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_tagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'x_2 -> writeRaw (Proxy @"s_anon'x") ptr_0 s_anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'x => HasField "s_anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'x = y_1},
+                              getField @"s_anon'x" x_0)
+instance (~) ty S_anon'x => HasField "s_anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x")
+instance HasCField S "s_anon'x"
+    where type CFieldType S "s_anon'x" = S_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty T => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'x_x" (getField @"s_anon'x" x_0)
+instance (~) ty T => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'x" x_0 (\z_2 -> setField @"s_anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty T => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = T
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_untagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_untagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_untagged/Example.hs
@@ -0,0 +1,314 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S_anon'x_x(..)
+    , pattern Example.A
+    , Example.S_anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum \@S_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+newtype S_anon'x_x = S_anon'x_x
+  { unwrapS_anon'x_x :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize S_anon'x_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'x_x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'x_x
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw S_anon'x_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'x_x unwrapS_anon'x_x2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapS_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'x_x instance BG.Storable S_anon'x_x
+
+deriving via BG.CUInt instance BG.Prim S_anon'x_x
+
+instance CEnum.CEnum S_anon'x_x where
+
+  type CEnumZ S_anon'x_x = BG.CUInt
+
+  toCEnum = S_anon'x_x
+
+  fromCEnum = BG.getField @"unwrapS_anon'x_x"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "A")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "S_anon'x_x"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "S_anon'x_x"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum S_anon'x_x where
+
+  minDeclaredValue = A
+
+  maxDeclaredValue = A
+
+instance Show S_anon'x_x where
+
+  showsPrec = CEnum.shows
+
+instance Read S_anon'x_x where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapS_anon'x_x" S_anon'x_x ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> S_anon'x_x {unwrapS_anon'x_x = y1}
+      , BG.getField @"unwrapS_anon'x_x" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapS_anon'x_x" (BG.Ptr S_anon'x_x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapS_anon'x_x")
+
+instance HasCField.HasCField S_anon'x_x "unwrapS_anon'x_x" where
+
+  type CFieldType S_anon'x_x "unwrapS_anon'x_x" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+pattern A :: S_anon'x_x
+pattern A = S_anon'x_x 0
+
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+data S_anon'x = S_anon'x
+  { s_anon'x_x :: S_anon'x_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'x s_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x_x") ptr0 s_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'x instance BG.Storable S_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'x instance Struct.IsStruct S_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+instance ( ty ~ S_anon'x_x
+         ) => BG.CompatHasField.HasField "s_anon'x_x" S_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_anon'x {s_anon'x_x = y1}, BG.getField @"s_anon'x_x" x0)
+
+instance ( ty ~ S_anon'x_x
+         ) => BG.HasField "s_anon'x_x" (BG.Ptr S_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x_x")
+
+instance HasCField.HasCField S_anon'x "s_anon'x_x" where
+
+  type CFieldType S_anon'x "s_anon'x_x" = S_anon'x_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+data S = S
+  { s_anon'x :: S_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x") ptr0 s_anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+instance (ty ~ S_anon'x) => BG.CompatHasField.HasField "s_anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'x = y1}, BG.getField @"s_anon'x" x0)
+
+instance (ty ~ S_anon'x) => BG.HasField "s_anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x")
+
+instance HasCField.HasCField S "s_anon'x" where
+
+  type CFieldType S "s_anon'x" = S_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+instance (ty ~ S_anon'x_x) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'x_x" (BG.getField @"s_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+instance (ty ~ S_anon'x_x) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'x" x0 (\z2 ->
+                                                          BG.CompatHasField.setField @"s_anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ S_anon'x_x) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = S_anon'x_x
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_untagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_untagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_untagged/bindingspec.yaml
@@ -0,0 +1,81 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/single_nesting_enum_untagged.h
+  cname: enum @S_anon'x_x
+  hsname: S_anon'x_x
+  enum: open
+- headers: types/anonymous/indirect-fields/single_nesting_enum_untagged.h
+  cname: struct @S_anon'x
+  hsname: S_anon'x
+- headers: types/anonymous/indirect-fields/single_nesting_enum_untagged.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'x
+  representation:
+    record:
+      constructor: S_anon'x
+      fields:
+      - s_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'x_x
+  representation:
+    newtype:
+      constructor: S_anon'x_x
+      fields:
+      - unwrapS_anon'x_x
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_untagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_untagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_enum_untagged/th.txt
@@ -0,0 +1,134 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_enum_untagged.h
+{-| __C declaration:__ @enum \@S_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+newtype S_anon'x_x
+    = S_anon'x_x {unwrapS_anon'x_x :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize S_anon'x_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'x_x
+    where readRaw = \ptr_0 -> pure S_anon'x_x <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw S_anon'x_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'x_x unwrapS_anon'x_x_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapS_anon'x_x_2
+deriving via (EquivStorable S_anon'x_x) instance Storable S_anon'x_x
+deriving via CUInt instance Prim S_anon'x_x
+instance CEnum S_anon'x_x
+    where type CEnumZ S_anon'x_x = CUInt
+          toCEnum = S_anon'x_x
+          fromCEnum = getField @"unwrapS_anon'x_x"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "A")]
+          showsUndeclared = showsWrappedUndeclared "S_anon'x_x"
+          readPrecUndeclared = readPrecWrappedUndeclared "S_anon'x_x"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum S_anon'x_x
+    where minDeclaredValue = A
+          maxDeclaredValue = A
+instance Show S_anon'x_x
+    where showsPrec = shows
+instance Read S_anon'x_x
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapS_anon'x_x" S_anon'x_x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'x_x{unwrapS_anon'x_x = y_1},
+                              getField @"unwrapS_anon'x_x" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapS_anon'x_x" (Ptr S_anon'x_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapS_anon'x_x")
+instance HasCField S_anon'x_x "unwrapS_anon'x_x"
+    where type CFieldType S_anon'x_x "unwrapS_anon'x_x" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+pattern A :: S_anon'x_x
+pattern A = S_anon'x_x 0
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+data S_anon'x
+    = S_anon'x {s_anon'x_x :: S_anon'x_x
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+                     __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'x <*> readRaw (Proxy @"s_anon'x_x") ptr_0
+instance WriteRaw S_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'x s_anon'x_x_2 -> writeRaw (Proxy @"s_anon'x_x") ptr_0 s_anon'x_x_2
+deriving via (EquivStorable S_anon'x) instance Storable S_anon'x
+deriving via (IsStructViaReadRaw S_anon'x) instance IsStruct S_anon'x
+instance (~) ty S_anon'x_x => HasField "s_anon'x_x" S_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'x{s_anon'x_x = y_1},
+                              getField @"s_anon'x_x" x_0)
+instance (~) ty S_anon'x_x =>
+         HasField "s_anon'x_x" (Ptr S_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x_x")
+instance HasCField S_anon'x "s_anon'x_x"
+    where type CFieldType S_anon'x "s_anon'x_x" = S_anon'x_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+-}
+data S
+    = S {s_anon'x :: S_anon'x
+         {- ^ __C declaration:__ @anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_enum_untagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'x_2 -> writeRaw (Proxy @"s_anon'x") ptr_0 s_anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'x => HasField "s_anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'x = y_1},
+                              getField @"s_anon'x" x_0)
+instance (~) ty S_anon'x => HasField "s_anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x")
+instance HasCField S "s_anon'x"
+    where type CFieldType S "s_anon'x" = S_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_anon'x_x => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'x_x" (getField @"s_anon'x" x_0)
+instance (~) ty S_anon'x_x => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'x" x_0 (\z_2 -> setField @"s_anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty S_anon'x_x => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = S_anon'x_x
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_tagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_tagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_tagged/Example.hs
@@ -0,0 +1,263 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , Example.S_anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+data T = T
+  { t_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize T where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw T where
+
+  readRaw =
+    \ptr0 ->
+          pure T
+      <*> HasCField.readRaw (BG.Proxy @"t_a") ptr0
+
+instance Marshal.WriteRaw T where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          T t_a2 ->
+            HasCField.writeRaw (BG.Proxy @"t_a") ptr0 t_a2
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via Struct.IsStructViaReadRaw T instance Struct.IsStruct T
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_a" T ty where
+
+  hasField =
+    \x0 -> (\y1 -> T {t_a = y1}, BG.getField @"t_a" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_a" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_a")
+
+instance HasCField.HasCField T "t_a" where
+
+  type CFieldType T "t_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+data S_anon'x = S_anon'x
+  { s_anon'x_x :: T
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'x s_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x_x") ptr0 s_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'x instance BG.Storable S_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'x instance Struct.IsStruct S_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_anon'x_x" S_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_anon'x {s_anon'x_x = y1}, BG.getField @"s_anon'x_x" x0)
+
+instance ( ty ~ T
+         ) => BG.HasField "s_anon'x_x" (BG.Ptr S_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x_x")
+
+instance HasCField.HasCField S_anon'x "s_anon'x_x" where
+
+  type CFieldType S_anon'x "s_anon'x_x" = T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+data S = S
+  { s_anon'x :: S_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x") ptr0 s_anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+instance (ty ~ S_anon'x) => BG.CompatHasField.HasField "s_anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'x = y1}, BG.getField @"s_anon'x" x0)
+
+instance (ty ~ S_anon'x) => BG.HasField "s_anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x")
+
+instance HasCField.HasCField S "s_anon'x" where
+
+  type CFieldType S "s_anon'x" = S_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+instance (ty ~ T) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'x_x" (BG.getField @"s_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'x" x0 (\z2 ->
+                                                          BG.CompatHasField.setField @"s_anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ T) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = T
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_tagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_tagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_tagged/bindingspec.yaml
@@ -0,0 +1,72 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/single_nesting_struct_tagged.h
+  cname: struct @S_anon'x
+  hsname: S_anon'x
+- headers: types/anonymous/indirect-fields/single_nesting_struct_tagged.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/indirect-fields/single_nesting_struct_tagged.h
+  cname: struct T
+  hsname: T
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'x
+  representation:
+    record:
+      constructor: S_anon'x
+      fields:
+      - s_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    record:
+      constructor: T
+      fields:
+      - t_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_tagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_tagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_tagged/th.txt
@@ -0,0 +1,111 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_struct_tagged.h
+{-| __C declaration:__ @struct T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+data T
+    = T {t_a :: CInt
+         {- ^ __C declaration:__ @a@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize T
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw T
+    where readRaw = \ptr_0 -> pure T <*> readRaw (Proxy @"t_a") ptr_0
+instance WriteRaw T
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       T t_a_2 -> writeRaw (Proxy @"t_a") ptr_0 t_a_2
+deriving via (EquivStorable T) instance Storable T
+deriving via (IsStructViaReadRaw T) instance IsStruct T
+instance (~) ty CInt => HasField "t_a" T ty
+    where hasField = \x_0 -> (\y_1 -> T{t_a = y_1},
+                              getField @"t_a" x_0)
+instance (~) ty CInt => HasField "t_a" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_a")
+instance HasCField T "t_a"
+    where type CFieldType T "t_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+data S_anon'x
+    = S_anon'x {s_anon'x_x :: T
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+                     __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'x <*> readRaw (Proxy @"s_anon'x_x") ptr_0
+instance WriteRaw S_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'x s_anon'x_x_2 -> writeRaw (Proxy @"s_anon'x_x") ptr_0 s_anon'x_x_2
+deriving via (EquivStorable S_anon'x) instance Storable S_anon'x
+deriving via (IsStructViaReadRaw S_anon'x) instance IsStruct S_anon'x
+instance (~) ty T => HasField "s_anon'x_x" S_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'x{s_anon'x_x = y_1},
+                              getField @"s_anon'x_x" x_0)
+instance (~) ty T => HasField "s_anon'x_x" (Ptr S_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x_x")
+instance HasCField S_anon'x "s_anon'x_x"
+    where type CFieldType S_anon'x "s_anon'x_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+-}
+data S
+    = S {s_anon'x :: S_anon'x
+         {- ^ __C declaration:__ @anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_tagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'x_2 -> writeRaw (Proxy @"s_anon'x") ptr_0 s_anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'x => HasField "s_anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'x = y_1},
+                              getField @"s_anon'x" x_0)
+instance (~) ty S_anon'x => HasField "s_anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x")
+instance HasCField S "s_anon'x"
+    where type CFieldType S "s_anon'x" = S_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty T => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'x_x" (getField @"s_anon'x" x_0)
+instance (~) ty T => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'x" x_0 (\z_2 -> setField @"s_anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty T => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = T
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_untagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_untagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_untagged/Example.hs
@@ -0,0 +1,269 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S_anon'x_x(..)
+    , Example.S_anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@S_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+data S_anon'x_x = S_anon'x_x
+  { s_anon'x_x_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'x_x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'x_x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'x_x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x_x_a") ptr0
+
+instance Marshal.WriteRaw S_anon'x_x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'x_x s_anon'x_x_a2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x_x_a") ptr0 s_anon'x_x_a2
+
+deriving via Marshal.EquivStorable S_anon'x_x instance BG.Storable S_anon'x_x
+
+deriving via Struct.IsStructViaReadRaw S_anon'x_x instance Struct.IsStruct S_anon'x_x
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s_anon'x_x_a" S_anon'x_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_anon'x_x {s_anon'x_x_a = y1}, BG.getField @"s_anon'x_x_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s_anon'x_x_a" (BG.Ptr S_anon'x_x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'x_x_a")
+
+instance HasCField.HasCField S_anon'x_x "s_anon'x_x_a" where
+
+  type CFieldType S_anon'x_x "s_anon'x_x_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+data S_anon'x = S_anon'x
+  { s_anon'x_x :: S_anon'x_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'x s_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x_x") ptr0 s_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'x instance BG.Storable S_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'x instance Struct.IsStruct S_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+instance ( ty ~ S_anon'x_x
+         ) => BG.CompatHasField.HasField "s_anon'x_x" S_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_anon'x {s_anon'x_x = y1}, BG.getField @"s_anon'x_x" x0)
+
+instance ( ty ~ S_anon'x_x
+         ) => BG.HasField "s_anon'x_x" (BG.Ptr S_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x_x")
+
+instance HasCField.HasCField S_anon'x "s_anon'x_x" where
+
+  type CFieldType S_anon'x "s_anon'x_x" = S_anon'x_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+data S = S
+  { s_anon'x :: S_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x") ptr0 s_anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+instance (ty ~ S_anon'x) => BG.CompatHasField.HasField "s_anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'x = y1}, BG.getField @"s_anon'x" x0)
+
+instance (ty ~ S_anon'x) => BG.HasField "s_anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x")
+
+instance HasCField.HasCField S "s_anon'x" where
+
+  type CFieldType S "s_anon'x" = S_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+instance (ty ~ S_anon'x_x) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'x_x" (BG.getField @"s_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+instance (ty ~ S_anon'x_x) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'x" x0 (\z2 ->
+                                                          BG.CompatHasField.setField @"s_anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ S_anon'x_x) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = S_anon'x_x
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_untagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_untagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_untagged/bindingspec.yaml
@@ -0,0 +1,72 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/single_nesting_struct_untagged.h
+  cname: struct @S_anon'x
+  hsname: S_anon'x
+- headers: types/anonymous/indirect-fields/single_nesting_struct_untagged.h
+  cname: struct @S_anon'x_x
+  hsname: S_anon'x_x
+- headers: types/anonymous/indirect-fields/single_nesting_struct_untagged.h
+  cname: struct S
+  hsname: S
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'x
+  representation:
+    record:
+      constructor: S_anon'x
+      fields:
+      - s_anon'x_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'x_x
+  representation:
+    record:
+      constructor: S_anon'x_x
+      fields:
+      - s_anon'x_x_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_untagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_untagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_struct_untagged/th.txt
@@ -0,0 +1,113 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_struct_untagged.h
+{-| __C declaration:__ @struct \@S_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+data S_anon'x_x
+    = S_anon'x_x {s_anon'x_x_a :: CInt
+                  {- ^ __C declaration:__ @a@
+
+                       __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+                       __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+                  -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'x_x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'x_x
+    where readRaw = \ptr_0 -> pure S_anon'x_x <*> readRaw (Proxy @"s_anon'x_x_a") ptr_0
+instance WriteRaw S_anon'x_x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'x_x s_anon'x_x_a_2 -> writeRaw (Proxy @"s_anon'x_x_a") ptr_0 s_anon'x_x_a_2
+deriving via (EquivStorable S_anon'x_x) instance Storable S_anon'x_x
+deriving via (IsStructViaReadRaw S_anon'x_x) instance IsStruct S_anon'x_x
+instance (~) ty CInt => HasField "s_anon'x_x_a" S_anon'x_x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'x_x{s_anon'x_x_a = y_1},
+                              getField @"s_anon'x_x_a" x_0)
+instance (~) ty CInt =>
+         HasField "s_anon'x_x_a" (Ptr S_anon'x_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x_x_a")
+instance HasCField S_anon'x_x "s_anon'x_x_a"
+    where type CFieldType S_anon'x_x "s_anon'x_x_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+data S_anon'x
+    = S_anon'x {s_anon'x_x :: S_anon'x_x
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+                     __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'x <*> readRaw (Proxy @"s_anon'x_x") ptr_0
+instance WriteRaw S_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'x s_anon'x_x_2 -> writeRaw (Proxy @"s_anon'x_x") ptr_0 s_anon'x_x_2
+deriving via (EquivStorable S_anon'x) instance Storable S_anon'x
+deriving via (IsStructViaReadRaw S_anon'x) instance IsStruct S_anon'x
+instance (~) ty S_anon'x_x => HasField "s_anon'x_x" S_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'x{s_anon'x_x = y_1},
+                              getField @"s_anon'x_x" x_0)
+instance (~) ty S_anon'x_x =>
+         HasField "s_anon'x_x" (Ptr S_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x_x")
+instance HasCField S_anon'x "s_anon'x_x"
+    where type CFieldType S_anon'x "s_anon'x_x" = S_anon'x_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+-}
+data S
+    = S {s_anon'x :: S_anon'x
+         {- ^ __C declaration:__ @anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_struct_untagged.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'x_2 -> writeRaw (Proxy @"s_anon'x") ptr_0 s_anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'x => HasField "s_anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'x = y_1},
+                              getField @"s_anon'x" x_0)
+instance (~) ty S_anon'x => HasField "s_anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x")
+instance HasCField S "s_anon'x"
+    where type CFieldType S "s_anon'x" = S_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_anon'x_x => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'x_x" (getField @"s_anon'x" x_0)
+instance (~) ty S_anon'x_x => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'x" x_0 (\z_2 -> setField @"s_anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty S_anon'x_x => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = S_anon'x_x
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_tagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_tagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_tagged/Example.hs
@@ -0,0 +1,254 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    , Example.S_anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Int, pure, type (~))
+
+{-| __C declaration:__ @union T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+newtype T = T
+  { unwrapT :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw T
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw T
+
+deriving via Marshal.EquivStorable T instance BG.Storable T
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion T
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "t_a" T ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "t_a" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"t_a" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "t_a" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"t_a")
+
+instance HasCField.HasCField T "t_a" where
+
+  type CFieldType T "t_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+data S_anon'x = S_anon'x
+  { s_anon'x_x :: T
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'x s_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x_x") ptr0 s_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'x instance BG.Storable S_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'x instance Struct.IsStruct S_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_anon'x_x" S_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_anon'x {s_anon'x_x = y1}, BG.getField @"s_anon'x_x" x0)
+
+instance ( ty ~ T
+         ) => BG.HasField "s_anon'x_x" (BG.Ptr S_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x_x")
+
+instance HasCField.HasCField S_anon'x "s_anon'x_x" where
+
+  type CFieldType S_anon'x "s_anon'x_x" = T
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+data S = S
+  { s_anon'x :: S_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x") ptr0 s_anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+instance (ty ~ S_anon'x) => BG.CompatHasField.HasField "s_anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'x = y1}, BG.getField @"s_anon'x" x0)
+
+instance (ty ~ S_anon'x) => BG.HasField "s_anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x")
+
+instance HasCField.HasCField S "s_anon'x" where
+
+  type CFieldType S "s_anon'x" = S_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+instance (ty ~ T) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'x_x" (BG.getField @"s_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+instance (ty ~ T) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'x" x0 (\z2 ->
+                                                          BG.CompatHasField.setField @"s_anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ T) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = T
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_tagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_tagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_tagged/bindingspec.yaml
@@ -0,0 +1,66 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/single_nesting_union_tagged.h
+  cname: struct @S_anon'x
+  hsname: S_anon'x
+- headers: types/anonymous/indirect-fields/single_nesting_union_tagged.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/indirect-fields/single_nesting_union_tagged.h
+  cname: union T
+  hsname: T
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'x
+  representation:
+    record:
+      constructor: S_anon'x
+      fields:
+      - s_anon'x_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_tagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_tagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_tagged/th.txt
@@ -0,0 +1,100 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_union_tagged.h
+{-| __C declaration:__ @union T@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+newtype T = T {unwrapT :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize T
+deriving via (SizedByteArray 4 4) instance ReadRaw T
+deriving via (SizedByteArray 4 4) instance WriteRaw T
+deriving via (EquivStorable T) instance Storable T
+deriving via (SizedByteArray 4 4) instance IsUnion T
+instance (~) ty CInt => HasField "t_a" T ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "t_a" T ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"t_a" x_0)
+instance (~) ty CInt => HasField "t_a" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"t_a")
+instance HasCField T "t_a"
+    where type CFieldType T "t_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+data S_anon'x
+    = S_anon'x {s_anon'x_x :: T
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+                     __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+                -}}
+    deriving stock Generic
+instance StaticSize S_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'x <*> readRaw (Proxy @"s_anon'x_x") ptr_0
+instance WriteRaw S_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'x s_anon'x_x_2 -> writeRaw (Proxy @"s_anon'x_x") ptr_0 s_anon'x_x_2
+deriving via (EquivStorable S_anon'x) instance Storable S_anon'x
+deriving via (IsStructViaReadRaw S_anon'x) instance IsStruct S_anon'x
+instance (~) ty T => HasField "s_anon'x_x" S_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'x{s_anon'x_x = y_1},
+                              getField @"s_anon'x_x" x_0)
+instance (~) ty T => HasField "s_anon'x_x" (Ptr S_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x_x")
+instance HasCField S_anon'x "s_anon'x_x"
+    where type CFieldType S_anon'x "s_anon'x_x" = T
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+-}
+data S
+    = S {s_anon'x :: S_anon'x
+         {- ^ __C declaration:__ @anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_tagged.h@
+         -}}
+    deriving stock Generic
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'x_2 -> writeRaw (Proxy @"s_anon'x") ptr_0 s_anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'x => HasField "s_anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'x = y_1},
+                              getField @"s_anon'x" x_0)
+instance (~) ty S_anon'x => HasField "s_anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x")
+instance HasCField S "s_anon'x"
+    where type CFieldType S "s_anon'x" = S_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty T => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'x_x" (getField @"s_anon'x" x_0)
+instance (~) ty T => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'x" x_0 (\z_2 -> setField @"s_anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty T => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = T
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_untagged/Example.hs b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_untagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_untagged/Example.hs
@@ -0,0 +1,258 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S_anon'x_x(..)
+    , Example.S_anon'x(..)
+    , Example.S(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Int, pure, type (~))
+
+{-| __C declaration:__ @union \@S_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+newtype S_anon'x_x = S_anon'x_x
+  { unwrapS_anon'x_x :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize S_anon'x_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw S_anon'x_x
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw S_anon'x_x
+
+deriving via Marshal.EquivStorable S_anon'x_x instance BG.Storable S_anon'x_x
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion S_anon'x_x
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "s_anon'x_x_a" S_anon'x_x ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s_anon'x_x_a" S_anon'x_x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"s_anon'x_x_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s_anon'x_x_a" (BG.Ptr S_anon'x_x) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s_anon'x_x_a")
+
+instance HasCField.HasCField S_anon'x_x "s_anon'x_x_a" where
+
+  type CFieldType S_anon'x_x "s_anon'x_x_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+data S_anon'x = S_anon'x
+  { s_anon'x_x :: S_anon'x_x
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S_anon'x where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S_anon'x where
+
+  readRaw =
+    \ptr0 ->
+          pure S_anon'x
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x_x") ptr0
+
+instance Marshal.WriteRaw S_anon'x where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S_anon'x s_anon'x_x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x_x") ptr0 s_anon'x_x2
+
+deriving via Marshal.EquivStorable S_anon'x instance BG.Storable S_anon'x
+
+deriving via Struct.IsStructViaReadRaw S_anon'x instance Struct.IsStruct S_anon'x
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+instance ( ty ~ S_anon'x_x
+         ) => BG.CompatHasField.HasField "s_anon'x_x" S_anon'x ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S_anon'x {s_anon'x_x = y1}, BG.getField @"s_anon'x_x" x0)
+
+instance ( ty ~ S_anon'x_x
+         ) => BG.HasField "s_anon'x_x" (BG.Ptr S_anon'x) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x_x")
+
+instance HasCField.HasCField S_anon'x "s_anon'x_x" where
+
+  type CFieldType S_anon'x "s_anon'x_x" = S_anon'x_x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+data S = S
+  { s_anon'x :: S_anon'x
+    {- ^ __C declaration:__ @anon\'x@
+
+         __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+         __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw =
+    \ptr0 ->
+          pure S
+      <*> HasCField.readRaw (BG.Proxy @"s_anon'x") ptr0
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S s_anon'x2 ->
+            HasCField.writeRaw (BG.Proxy @"s_anon'x") ptr0 s_anon'x2
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+instance (ty ~ S_anon'x) => BG.CompatHasField.HasField "s_anon'x" S ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S {s_anon'x = y1}, BG.getField @"s_anon'x" x0)
+
+instance (ty ~ S_anon'x) => BG.HasField "s_anon'x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_anon'x")
+
+instance HasCField.HasCField S "s_anon'x" where
+
+  type CFieldType S "s_anon'x" = S_anon'x
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+instance (ty ~ S_anon'x_x) => BG.HasField "s_x" S ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"s_anon'x_x" (BG.getField @"s_anon'x" x0)
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+instance (ty ~ S_anon'x_x) => BG.CompatHasField.HasField "s_x" S ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"s_anon'x" x0 (\z2 ->
+                                                          BG.CompatHasField.setField @"s_anon'x_x" z2 y1)
+      , BG.getField @"s_x" x0
+      )
+
+instance (ty ~ S_anon'x_x) => BG.HasField "s_x" (BG.Ptr S) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s_x")
+
+instance HasCField.HasCField S "s_x" where
+
+  type CFieldType S "s_x" = S_anon'x_x
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_untagged/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_untagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_untagged/bindingspec.yaml
@@ -0,0 +1,66 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/indirect-fields/single_nesting_union_untagged.h
+  cname: struct @S_anon'x
+  hsname: S_anon'x
+- headers: types/anonymous/indirect-fields/single_nesting_union_untagged.h
+  cname: struct S
+  hsname: S
+- headers: types/anonymous/indirect-fields/single_nesting_union_untagged.h
+  cname: union @S_anon'x_x
+  hsname: S_anon'x_x
+hstypes:
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields:
+      - s_anon'x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'x
+  representation:
+    record:
+      constructor: S_anon'x
+      fields:
+      - s_anon'x_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S_anon'x_x
+  representation:
+    newtype:
+      constructor: S_anon'x_x
+      fields:
+      - unwrapS_anon'x_x
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_untagged/th.txt b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_untagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/indirect-fields/single_nesting_union_untagged/th.txt
@@ -0,0 +1,104 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_union_untagged.h
+{-| __C declaration:__ @union \@S_anon\'x_x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+newtype S_anon'x_x
+    = S_anon'x_x {unwrapS_anon'x_x :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize S_anon'x_x
+deriving via (SizedByteArray 4 4) instance ReadRaw S_anon'x_x
+deriving via (SizedByteArray 4 4) instance WriteRaw S_anon'x_x
+deriving via (EquivStorable S_anon'x_x) instance Storable S_anon'x_x
+deriving via (SizedByteArray 4 4) instance IsUnion S_anon'x_x
+instance (~) ty CInt => HasField "s_anon'x_x_a" S_anon'x_x ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "s_anon'x_x_a" S_anon'x_x ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"s_anon'x_x_a" x_0)
+instance (~) ty CInt =>
+         HasField "s_anon'x_x_a" (Ptr S_anon'x_x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x_x_a")
+instance HasCField S_anon'x_x "s_anon'x_x_a"
+    where type CFieldType S_anon'x_x "s_anon'x_x_a" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S_anon\'x@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+data S_anon'x
+    = S_anon'x {s_anon'x_x :: S_anon'x_x
+                {- ^ __C declaration:__ @x@
+
+                     __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+                     __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+                -}}
+    deriving stock Generic
+instance StaticSize S_anon'x
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S_anon'x
+    where readRaw = \ptr_0 -> pure S_anon'x <*> readRaw (Proxy @"s_anon'x_x") ptr_0
+instance WriteRaw S_anon'x
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S_anon'x s_anon'x_x_2 -> writeRaw (Proxy @"s_anon'x_x") ptr_0 s_anon'x_x_2
+deriving via (EquivStorable S_anon'x) instance Storable S_anon'x
+deriving via (IsStructViaReadRaw S_anon'x) instance IsStruct S_anon'x
+instance (~) ty S_anon'x_x => HasField "s_anon'x_x" S_anon'x ty
+    where hasField = \x_0 -> (\y_1 -> S_anon'x{s_anon'x_x = y_1},
+                              getField @"s_anon'x_x" x_0)
+instance (~) ty S_anon'x_x =>
+         HasField "s_anon'x_x" (Ptr S_anon'x) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x_x")
+instance HasCField S_anon'x "s_anon'x_x"
+    where type CFieldType S_anon'x "s_anon'x_x" = S_anon'x_x
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+    __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+-}
+data S
+    = S {s_anon'x :: S_anon'x
+         {- ^ __C declaration:__ @anon\'x@
+
+              __defined at:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h 3:1@
+
+              __exported by:__ @types\/anonymous\/indirect-fields\/single_nesting_union_untagged.h@
+         -}}
+    deriving stock Generic
+instance StaticSize S
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_anon'x") ptr_0
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S s_anon'x_2 -> writeRaw (Proxy @"s_anon'x") ptr_0 s_anon'x_2
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+instance (~) ty S_anon'x => HasField "s_anon'x" S ty
+    where hasField = \x_0 -> (\y_1 -> S{s_anon'x = y_1},
+                              getField @"s_anon'x" x_0)
+instance (~) ty S_anon'x => HasField "s_anon'x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_anon'x")
+instance HasCField S "s_anon'x"
+    where type CFieldType S "s_anon'x" = S_anon'x
+          offset# = \_ -> \_ -> 0
+instance (~) ty S_anon'x_x => HasField "s_x" S ty
+    where getField = \x_0 -> getField @"s_anon'x_x" (getField @"s_anon'x" x_0)
+instance (~) ty S_anon'x_x => HasField "s_x" S ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"s_anon'x" x_0 (\z_2 -> setField @"s_anon'x_x" z_2 y_1),
+                              getField @"s_x" x_0)
+instance (~) ty S_anon'x_x => HasField "s_x" (Ptr S) (Ptr ty)
+    where getField = fromPtr (Proxy @"s_x")
+instance HasCField S "s_x"
+    where type CFieldType S "s_x" = S_anon'x_x
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/struct/Example.hs b/test-artefacts/fixtures/types/anonymous/struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/struct/Example.hs
@@ -0,0 +1,923 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Has_implicit_fields_anon'x2_1(..)
+    , Example.Has_implicit_fields_anon'x4_1(..)
+    , Example.Has_implicit_fields_anon'x5_1(..)
+    , Example.Has_implicit_fields(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@has_implicit_fields_anon\'x2_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 7:3@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+data Has_implicit_fields_anon'x2_1 = Has_implicit_fields_anon'x2_1
+  { has_implicit_fields_anon'x2_1_x2_1 :: BG.CInt
+    {- ^ __C declaration:__ @x2_1@
+
+         __defined at:__ @types\/anonymous\/struct.h 8:9@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  , has_implicit_fields_anon'x2_1_x2_2 :: BG.CInt
+    {- ^ __C declaration:__ @x2_2@
+
+         __defined at:__ @types\/anonymous\/struct.h 9:9@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Has_implicit_fields_anon'x2_1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Has_implicit_fields_anon'x2_1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Has_implicit_fields_anon'x2_1
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_2") ptr0
+
+instance Marshal.WriteRaw Has_implicit_fields_anon'x2_1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Has_implicit_fields_anon'x2_1
+            has_implicit_fields_anon'x2_1_x2_12
+            has_implicit_fields_anon'x2_1_x2_23 ->
+                 HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_1") ptr0 has_implicit_fields_anon'x2_1_x2_12
+              >> HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_2") ptr0 has_implicit_fields_anon'x2_1_x2_23
+
+deriving via Marshal.EquivStorable Has_implicit_fields_anon'x2_1 instance BG.Storable Has_implicit_fields_anon'x2_1
+
+deriving via Struct.IsStructViaReadRaw Has_implicit_fields_anon'x2_1 instance Struct.IsStruct Has_implicit_fields_anon'x2_1
+
+{-| __C declaration:__ @x2_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 8:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x2_1_x2_1" Has_implicit_fields_anon'x2_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields_anon'x2_1 { has_implicit_fields_anon'x2_1_x2_1 = y1
+                                        , has_implicit_fields_anon'x2_1_x2_2 = BG.getField @"has_implicit_fields_anon'x2_1_x2_2" x0
+                                        }
+      , BG.getField @"has_implicit_fields_anon'x2_1_x2_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x2_1_x2_1" (BG.Ptr Has_implicit_fields_anon'x2_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_1")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x2_1 "has_implicit_fields_anon'x2_1_x2_1" where
+
+  type CFieldType Has_implicit_fields_anon'x2_1 "has_implicit_fields_anon'x2_1_x2_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x2_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x2_1_x2_2" Has_implicit_fields_anon'x2_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields_anon'x2_1 { has_implicit_fields_anon'x2_1_x2_2 = y1
+                                        , has_implicit_fields_anon'x2_1_x2_1 = BG.getField @"has_implicit_fields_anon'x2_1_x2_1" x0
+                                        }
+      , BG.getField @"has_implicit_fields_anon'x2_1_x2_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x2_1_x2_2" (BG.Ptr Has_implicit_fields_anon'x2_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_2")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x2_1 "has_implicit_fields_anon'x2_1_x2_2" where
+
+  type CFieldType Has_implicit_fields_anon'x2_1 "has_implicit_fields_anon'x2_1_x2_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@has_implicit_fields_anon\'x4_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 12:3@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+data Has_implicit_fields_anon'x4_1 = Has_implicit_fields_anon'x4_1
+  { has_implicit_fields_anon'x4_1_x4_1 :: BG.CInt
+    {- ^ __C declaration:__ @x4_1@
+
+         __defined at:__ @types\/anonymous\/struct.h 13:9@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  , has_implicit_fields_anon'x4_1_x4_2 :: BG.CInt
+    {- ^ __C declaration:__ @x4_2@
+
+         __defined at:__ @types\/anonymous\/struct.h 14:9@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Has_implicit_fields_anon'x4_1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Has_implicit_fields_anon'x4_1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Has_implicit_fields_anon'x4_1
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_2") ptr0
+
+instance Marshal.WriteRaw Has_implicit_fields_anon'x4_1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Has_implicit_fields_anon'x4_1
+            has_implicit_fields_anon'x4_1_x4_12
+            has_implicit_fields_anon'x4_1_x4_23 ->
+                 HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_1") ptr0 has_implicit_fields_anon'x4_1_x4_12
+              >> HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_2") ptr0 has_implicit_fields_anon'x4_1_x4_23
+
+deriving via Marshal.EquivStorable Has_implicit_fields_anon'x4_1 instance BG.Storable Has_implicit_fields_anon'x4_1
+
+deriving via Struct.IsStructViaReadRaw Has_implicit_fields_anon'x4_1 instance Struct.IsStruct Has_implicit_fields_anon'x4_1
+
+{-| __C declaration:__ @x4_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 13:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x4_1_x4_1" Has_implicit_fields_anon'x4_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields_anon'x4_1 { has_implicit_fields_anon'x4_1_x4_1 = y1
+                                        , has_implicit_fields_anon'x4_1_x4_2 = BG.getField @"has_implicit_fields_anon'x4_1_x4_2" x0
+                                        }
+      , BG.getField @"has_implicit_fields_anon'x4_1_x4_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x4_1_x4_1" (BG.Ptr Has_implicit_fields_anon'x4_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_1")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x4_1 "has_implicit_fields_anon'x4_1_x4_1" where
+
+  type CFieldType Has_implicit_fields_anon'x4_1 "has_implicit_fields_anon'x4_1_x4_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x4_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 14:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x4_1_x4_2" Has_implicit_fields_anon'x4_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields_anon'x4_1 { has_implicit_fields_anon'x4_1_x4_2 = y1
+                                        , has_implicit_fields_anon'x4_1_x4_1 = BG.getField @"has_implicit_fields_anon'x4_1_x4_1" x0
+                                        }
+      , BG.getField @"has_implicit_fields_anon'x4_1_x4_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x4_1_x4_2" (BG.Ptr Has_implicit_fields_anon'x4_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_2")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x4_1 "has_implicit_fields_anon'x4_1_x4_2" where
+
+  type CFieldType Has_implicit_fields_anon'x4_1 "has_implicit_fields_anon'x4_1_x4_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union \@has_implicit_fields_anon\'x5_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 16:3@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+newtype Has_implicit_fields_anon'x5_1 = Has_implicit_fields_anon'x5_1
+  { unwrapHas_implicit_fields_anon'x5_1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Has_implicit_fields_anon'x5_1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Has_implicit_fields_anon'x5_1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Has_implicit_fields_anon'x5_1
+
+deriving via Marshal.EquivStorable Has_implicit_fields_anon'x5_1 instance BG.Storable Has_implicit_fields_anon'x5_1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Has_implicit_fields_anon'x5_1
+
+{-| __C declaration:__ @x5_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 17:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x5_1_x5_1" Has_implicit_fields_anon'x5_1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x5_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 17:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x5_1_x5_1" Has_implicit_fields_anon'x5_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"has_implicit_fields_anon'x5_1_x5_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x5_1_x5_1" (BG.Ptr Has_implicit_fields_anon'x5_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x5_1_x5_1")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x5_1 "has_implicit_fields_anon'x5_1_x5_1" where
+
+  type CFieldType Has_implicit_fields_anon'x5_1 "has_implicit_fields_anon'x5_1_x5_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x5_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 18:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x5_1_x5_2" Has_implicit_fields_anon'x5_1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x5_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 18:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x5_1_x5_2" Has_implicit_fields_anon'x5_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"has_implicit_fields_anon'x5_1_x5_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x5_1_x5_2" (BG.Ptr Has_implicit_fields_anon'x5_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x5_1_x5_2")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x5_1 "has_implicit_fields_anon'x5_1_x5_2" where
+
+  type CFieldType Has_implicit_fields_anon'x5_1 "has_implicit_fields_anon'x5_1_x5_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct has_implicit_fields@
+
+    __defined at:__ @types\/anonymous\/struct.h 5:8@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+data Has_implicit_fields = Has_implicit_fields
+  { has_implicit_fields_x1 :: BG.CInt
+    {- ^ __C declaration:__ @x1@
+
+         __defined at:__ @types\/anonymous\/struct.h 6:7@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  , has_implicit_fields_anon'x2_1 :: Has_implicit_fields_anon'x2_1
+    {- ^ __C declaration:__ @anon\'x2_1@
+
+         __defined at:__ @types\/anonymous\/struct.h 7:3@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  , has_implicit_fields_x3 :: BG.CInt
+    {- ^ __C declaration:__ @x3@
+
+         __defined at:__ @types\/anonymous\/struct.h 11:7@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  , has_implicit_fields_anon'x4_1 :: Has_implicit_fields_anon'x4_1
+    {- ^ __C declaration:__ @anon\'x4_1@
+
+         __defined at:__ @types\/anonymous\/struct.h 12:3@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  , has_implicit_fields_anon'x5_1 :: Has_implicit_fields_anon'x5_1
+    {- ^ __C declaration:__ @anon\'x5_1@
+
+         __defined at:__ @types\/anonymous\/struct.h 16:3@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  , has_implicit_fields_x5 :: BG.CInt
+    {- ^ __C declaration:__ @x5@
+
+         __defined at:__ @types\/anonymous\/struct.h 20:7@
+
+         __exported by:__ @types\/anonymous\/struct.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize Has_implicit_fields where
+
+  staticSizeOf = \_ -> (32 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Has_implicit_fields where
+
+  readRaw =
+    \ptr0 ->
+          pure Has_implicit_fields
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_x1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x2_1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_x3") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x4_1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x5_1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_x5") ptr0
+
+instance Marshal.WriteRaw Has_implicit_fields where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Has_implicit_fields
+            has_implicit_fields_x12
+            has_implicit_fields_anon'x2_13
+            has_implicit_fields_x34
+            has_implicit_fields_anon'x4_15
+            has_implicit_fields_anon'x5_16
+            has_implicit_fields_x57 ->
+                 HasCField.writeRaw (BG.Proxy @"has_implicit_fields_x1") ptr0 has_implicit_fields_x12
+              >> HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x2_1") ptr0 has_implicit_fields_anon'x2_13
+              >> HasCField.writeRaw (BG.Proxy @"has_implicit_fields_x3") ptr0 has_implicit_fields_x34
+              >> HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x4_1") ptr0 has_implicit_fields_anon'x4_15
+              >> HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x5_1") ptr0 has_implicit_fields_anon'x5_16
+              >> HasCField.writeRaw (BG.Proxy @"has_implicit_fields_x5") ptr0 has_implicit_fields_x57
+
+deriving via Marshal.EquivStorable Has_implicit_fields instance BG.Storable Has_implicit_fields
+
+deriving via Struct.IsStructViaReadRaw Has_implicit_fields instance Struct.IsStruct Has_implicit_fields
+
+{-| __C declaration:__ @x1@
+
+    __defined at:__ @types\/anonymous\/struct.h 6:7@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields { has_implicit_fields_x1 = y1
+                              , has_implicit_fields_anon'x2_1 = BG.getField @"has_implicit_fields_anon'x2_1" x0
+                              , has_implicit_fields_x3 = BG.getField @"has_implicit_fields_x3" x0
+                              , has_implicit_fields_anon'x4_1 = BG.getField @"has_implicit_fields_anon'x4_1" x0
+                              , has_implicit_fields_anon'x5_1 = BG.getField @"has_implicit_fields_anon'x5_1" x0
+                              , has_implicit_fields_x5 = BG.getField @"has_implicit_fields_x5" x0
+                              }
+      , BG.getField @"has_implicit_fields_x1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'x2_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 7:3@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ Has_implicit_fields_anon'x2_1
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x2_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields { has_implicit_fields_anon'x2_1 = y1
+                              , has_implicit_fields_x1 = BG.getField @"has_implicit_fields_x1" x0
+                              , has_implicit_fields_x3 = BG.getField @"has_implicit_fields_x3" x0
+                              , has_implicit_fields_anon'x4_1 = BG.getField @"has_implicit_fields_anon'x4_1" x0
+                              , has_implicit_fields_anon'x5_1 = BG.getField @"has_implicit_fields_anon'x5_1" x0
+                              , has_implicit_fields_x5 = BG.getField @"has_implicit_fields_x5" x0
+                              }
+      , BG.getField @"has_implicit_fields_anon'x2_1" x0
+      )
+
+instance ( ty ~ Has_implicit_fields_anon'x2_1
+         ) => BG.HasField "has_implicit_fields_anon'x2_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x2_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_anon'x2_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_anon'x2_1" =
+    Has_implicit_fields_anon'x2_1
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @x2_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 8:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x2_1" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x2_1_x2_1" (BG.getField @"has_implicit_fields_anon'x2_1" x0)
+
+{-| __C declaration:__ @x2_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 8:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x2_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x2_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x2_1_x2_1" z2 y1)
+      , BG.getField @"has_implicit_fields_x2_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x2_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x2_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x2_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x2_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @x2_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x2_2" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x2_1_x2_2" (BG.getField @"has_implicit_fields_anon'x2_1" x0)
+
+{-| __C declaration:__ @x2_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x2_2" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x2_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x2_1_x2_2" z2 y1)
+      , BG.getField @"has_implicit_fields_x2_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x2_2" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x2_2")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x2_2" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x2_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @x3@
+
+    __defined at:__ @types\/anonymous\/struct.h 11:7@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x3" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields { has_implicit_fields_x3 = y1
+                              , has_implicit_fields_x1 = BG.getField @"has_implicit_fields_x1" x0
+                              , has_implicit_fields_anon'x2_1 = BG.getField @"has_implicit_fields_anon'x2_1" x0
+                              , has_implicit_fields_anon'x4_1 = BG.getField @"has_implicit_fields_anon'x4_1" x0
+                              , has_implicit_fields_anon'x5_1 = BG.getField @"has_implicit_fields_anon'x5_1" x0
+                              , has_implicit_fields_x5 = BG.getField @"has_implicit_fields_x5" x0
+                              }
+      , BG.getField @"has_implicit_fields_x3" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x3" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x3")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x3" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x3" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @anon\'x4_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 12:3@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ Has_implicit_fields_anon'x4_1
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x4_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields { has_implicit_fields_anon'x4_1 = y1
+                              , has_implicit_fields_x1 = BG.getField @"has_implicit_fields_x1" x0
+                              , has_implicit_fields_anon'x2_1 = BG.getField @"has_implicit_fields_anon'x2_1" x0
+                              , has_implicit_fields_x3 = BG.getField @"has_implicit_fields_x3" x0
+                              , has_implicit_fields_anon'x5_1 = BG.getField @"has_implicit_fields_anon'x5_1" x0
+                              , has_implicit_fields_x5 = BG.getField @"has_implicit_fields_x5" x0
+                              }
+      , BG.getField @"has_implicit_fields_anon'x4_1" x0
+      )
+
+instance ( ty ~ Has_implicit_fields_anon'x4_1
+         ) => BG.HasField "has_implicit_fields_anon'x4_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x4_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_anon'x4_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_anon'x4_1" =
+    Has_implicit_fields_anon'x4_1
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @x4_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 13:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x4_1" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x4_1_x4_1" (BG.getField @"has_implicit_fields_anon'x4_1" x0)
+
+{-| __C declaration:__ @x4_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 13:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x4_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x4_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x4_1_x4_1" z2 y1)
+      , BG.getField @"has_implicit_fields_x4_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x4_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x4_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x4_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x4_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @x4_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 14:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x4_2" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x4_1_x4_2" (BG.getField @"has_implicit_fields_anon'x4_1" x0)
+
+{-| __C declaration:__ @x4_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 14:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x4_2" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x4_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x4_1_x4_2" z2 y1)
+      , BG.getField @"has_implicit_fields_x4_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x4_2" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x4_2")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x4_2" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x4_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 20
+
+{-| __C declaration:__ @anon\'x5_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 16:3@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ Has_implicit_fields_anon'x5_1
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x5_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields { has_implicit_fields_anon'x5_1 = y1
+                              , has_implicit_fields_x1 = BG.getField @"has_implicit_fields_x1" x0
+                              , has_implicit_fields_anon'x2_1 = BG.getField @"has_implicit_fields_anon'x2_1" x0
+                              , has_implicit_fields_x3 = BG.getField @"has_implicit_fields_x3" x0
+                              , has_implicit_fields_anon'x4_1 = BG.getField @"has_implicit_fields_anon'x4_1" x0
+                              , has_implicit_fields_x5 = BG.getField @"has_implicit_fields_x5" x0
+                              }
+      , BG.getField @"has_implicit_fields_anon'x5_1" x0
+      )
+
+instance ( ty ~ Has_implicit_fields_anon'x5_1
+         ) => BG.HasField "has_implicit_fields_anon'x5_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x5_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_anon'x5_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_anon'x5_1" =
+    Has_implicit_fields_anon'x5_1
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @x5_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 17:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5_1" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x5_1_x5_1" (BG.getField @"has_implicit_fields_anon'x5_1" x0)
+
+{-| __C declaration:__ @x5_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 17:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x5_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x5_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x5_1_x5_1" z2 y1)
+      , BG.getField @"has_implicit_fields_x5_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x5_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x5_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x5_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @x5_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 18:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5_2" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x5_1_x5_2" (BG.getField @"has_implicit_fields_anon'x5_1" x0)
+
+{-| __C declaration:__ @x5_2@
+
+    __defined at:__ @types\/anonymous\/struct.h 18:9@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x5_2" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x5_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x5_1_x5_2" z2 y1)
+      , BG.getField @"has_implicit_fields_x5_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5_2" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x5_2")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x5_2" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x5_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @x5@
+
+    __defined at:__ @types\/anonymous\/struct.h 20:7@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x5" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields { has_implicit_fields_x5 = y1
+                              , has_implicit_fields_x1 = BG.getField @"has_implicit_fields_x1" x0
+                              , has_implicit_fields_anon'x2_1 = BG.getField @"has_implicit_fields_anon'x2_1" x0
+                              , has_implicit_fields_x3 = BG.getField @"has_implicit_fields_x3" x0
+                              , has_implicit_fields_anon'x4_1 = BG.getField @"has_implicit_fields_anon'x4_1" x0
+                              , has_implicit_fields_anon'x5_1 = BG.getField @"has_implicit_fields_anon'x5_1" x0
+                              }
+      , BG.getField @"has_implicit_fields_x5" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x5")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x5" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x5" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 28
diff --git a/test-artefacts/fixtures/types/anonymous/struct/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/struct/bindingspec.yaml
@@ -0,0 +1,97 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/struct.h
+  cname: struct has_implicit_fields
+  hsname: Has_implicit_fields
+- headers: types/anonymous/struct.h
+  cname: struct @has_implicit_fields_anon'x2_1
+  hsname: Has_implicit_fields_anon'x2_1
+- headers: types/anonymous/struct.h
+  cname: struct @has_implicit_fields_anon'x4_1
+  hsname: Has_implicit_fields_anon'x4_1
+- headers: types/anonymous/struct.h
+  cname: union @has_implicit_fields_anon'x5_1
+  hsname: Has_implicit_fields_anon'x5_1
+hstypes:
+- hsname: Has_implicit_fields
+  representation:
+    record:
+      constructor: Has_implicit_fields
+      fields:
+      - has_implicit_fields_x1
+      - has_implicit_fields_anon'x2_1
+      - has_implicit_fields_x3
+      - has_implicit_fields_anon'x4_1
+      - has_implicit_fields_anon'x5_1
+      - has_implicit_fields_x5
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Has_implicit_fields_anon'x2_1
+  representation:
+    record:
+      constructor: Has_implicit_fields_anon'x2_1
+      fields:
+      - has_implicit_fields_anon'x2_1_x2_1
+      - has_implicit_fields_anon'x2_1_x2_2
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Has_implicit_fields_anon'x4_1
+  representation:
+    record:
+      constructor: Has_implicit_fields_anon'x4_1
+      fields:
+      - has_implicit_fields_anon'x4_1_x4_1
+      - has_implicit_fields_anon'x4_1_x4_2
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Has_implicit_fields_anon'x5_1
+  representation:
+    newtype:
+      constructor: Has_implicit_fields_anon'x5_1
+      fields:
+      - unwrapHas_implicit_fields_anon'x5_1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/struct/th.txt b/test-artefacts/fixtures/types/anonymous/struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/struct/th.txt
@@ -0,0 +1,467 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/struct.h
+{-| __C declaration:__ @struct \@has_implicit_fields_anon\'x2_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 7:3@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+data Has_implicit_fields_anon'x2_1
+    = Has_implicit_fields_anon'x2_1 {has_implicit_fields_anon'x2_1_x2_1 :: CInt
+                                     {- ^ __C declaration:__ @x2_1@
+
+                                          __defined at:__ @types\/anonymous\/struct.h 8:9@
+
+                                          __exported by:__ @types\/anonymous\/struct.h@
+                                     -},
+                                     has_implicit_fields_anon'x2_1_x2_2 :: CInt
+                                     {- ^ __C declaration:__ @x2_2@
+
+                                          __defined at:__ @types\/anonymous\/struct.h 9:9@
+
+                                          __exported by:__ @types\/anonymous\/struct.h@
+                                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Has_implicit_fields_anon'x2_1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Has_implicit_fields_anon'x2_1
+    where readRaw = \ptr_0 -> (pure Has_implicit_fields_anon'x2_1 <*> readRaw (Proxy @"has_implicit_fields_anon'x2_1_x2_1") ptr_0) <*> readRaw (Proxy @"has_implicit_fields_anon'x2_1_x2_2") ptr_0
+instance WriteRaw Has_implicit_fields_anon'x2_1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Has_implicit_fields_anon'x2_1 has_implicit_fields_anon'x2_1_x2_1_2
+                                                                     has_implicit_fields_anon'x2_1_x2_2_3 -> writeRaw (Proxy @"has_implicit_fields_anon'x2_1_x2_1") ptr_0 has_implicit_fields_anon'x2_1_x2_1_2 >> writeRaw (Proxy @"has_implicit_fields_anon'x2_1_x2_2") ptr_0 has_implicit_fields_anon'x2_1_x2_2_3
+deriving via (EquivStorable Has_implicit_fields_anon'x2_1) instance Storable Has_implicit_fields_anon'x2_1
+deriving via (IsStructViaReadRaw Has_implicit_fields_anon'x2_1) instance IsStruct Has_implicit_fields_anon'x2_1
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x2_1_x2_1"
+                  Has_implicit_fields_anon'x2_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields_anon'x2_1{has_implicit_fields_anon'x2_1_x2_1 = y_1,
+                                                                    has_implicit_fields_anon'x2_1_x2_2 = getField @"has_implicit_fields_anon'x2_1_x2_2" x_0},
+                              getField @"has_implicit_fields_anon'x2_1_x2_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x2_1_x2_1"
+                  (Ptr Has_implicit_fields_anon'x2_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x2_1_x2_1")
+instance HasCField Has_implicit_fields_anon'x2_1
+                   "has_implicit_fields_anon'x2_1_x2_1"
+    where type CFieldType Has_implicit_fields_anon'x2_1
+                          "has_implicit_fields_anon'x2_1_x2_1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x2_1_x2_2"
+                  Has_implicit_fields_anon'x2_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields_anon'x2_1{has_implicit_fields_anon'x2_1_x2_2 = y_1,
+                                                                    has_implicit_fields_anon'x2_1_x2_1 = getField @"has_implicit_fields_anon'x2_1_x2_1" x_0},
+                              getField @"has_implicit_fields_anon'x2_1_x2_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x2_1_x2_2"
+                  (Ptr Has_implicit_fields_anon'x2_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x2_1_x2_2")
+instance HasCField Has_implicit_fields_anon'x2_1
+                   "has_implicit_fields_anon'x2_1_x2_2"
+    where type CFieldType Has_implicit_fields_anon'x2_1
+                          "has_implicit_fields_anon'x2_1_x2_2" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@has_implicit_fields_anon\'x4_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 12:3@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+data Has_implicit_fields_anon'x4_1
+    = Has_implicit_fields_anon'x4_1 {has_implicit_fields_anon'x4_1_x4_1 :: CInt
+                                     {- ^ __C declaration:__ @x4_1@
+
+                                          __defined at:__ @types\/anonymous\/struct.h 13:9@
+
+                                          __exported by:__ @types\/anonymous\/struct.h@
+                                     -},
+                                     has_implicit_fields_anon'x4_1_x4_2 :: CInt
+                                     {- ^ __C declaration:__ @x4_2@
+
+                                          __defined at:__ @types\/anonymous\/struct.h 14:9@
+
+                                          __exported by:__ @types\/anonymous\/struct.h@
+                                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Has_implicit_fields_anon'x4_1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Has_implicit_fields_anon'x4_1
+    where readRaw = \ptr_0 -> (pure Has_implicit_fields_anon'x4_1 <*> readRaw (Proxy @"has_implicit_fields_anon'x4_1_x4_1") ptr_0) <*> readRaw (Proxy @"has_implicit_fields_anon'x4_1_x4_2") ptr_0
+instance WriteRaw Has_implicit_fields_anon'x4_1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Has_implicit_fields_anon'x4_1 has_implicit_fields_anon'x4_1_x4_1_2
+                                                                     has_implicit_fields_anon'x4_1_x4_2_3 -> writeRaw (Proxy @"has_implicit_fields_anon'x4_1_x4_1") ptr_0 has_implicit_fields_anon'x4_1_x4_1_2 >> writeRaw (Proxy @"has_implicit_fields_anon'x4_1_x4_2") ptr_0 has_implicit_fields_anon'x4_1_x4_2_3
+deriving via (EquivStorable Has_implicit_fields_anon'x4_1) instance Storable Has_implicit_fields_anon'x4_1
+deriving via (IsStructViaReadRaw Has_implicit_fields_anon'x4_1) instance IsStruct Has_implicit_fields_anon'x4_1
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x4_1_x4_1"
+                  Has_implicit_fields_anon'x4_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields_anon'x4_1{has_implicit_fields_anon'x4_1_x4_1 = y_1,
+                                                                    has_implicit_fields_anon'x4_1_x4_2 = getField @"has_implicit_fields_anon'x4_1_x4_2" x_0},
+                              getField @"has_implicit_fields_anon'x4_1_x4_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x4_1_x4_1"
+                  (Ptr Has_implicit_fields_anon'x4_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x4_1_x4_1")
+instance HasCField Has_implicit_fields_anon'x4_1
+                   "has_implicit_fields_anon'x4_1_x4_1"
+    where type CFieldType Has_implicit_fields_anon'x4_1
+                          "has_implicit_fields_anon'x4_1_x4_1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x4_1_x4_2"
+                  Has_implicit_fields_anon'x4_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields_anon'x4_1{has_implicit_fields_anon'x4_1_x4_2 = y_1,
+                                                                    has_implicit_fields_anon'x4_1_x4_1 = getField @"has_implicit_fields_anon'x4_1_x4_1" x_0},
+                              getField @"has_implicit_fields_anon'x4_1_x4_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x4_1_x4_2"
+                  (Ptr Has_implicit_fields_anon'x4_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x4_1_x4_2")
+instance HasCField Has_implicit_fields_anon'x4_1
+                   "has_implicit_fields_anon'x4_1_x4_2"
+    where type CFieldType Has_implicit_fields_anon'x4_1
+                          "has_implicit_fields_anon'x4_1_x4_2" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @union \@has_implicit_fields_anon\'x5_1@
+
+    __defined at:__ @types\/anonymous\/struct.h 16:3@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+newtype Has_implicit_fields_anon'x5_1
+    = Has_implicit_fields_anon'x5_1 {unwrapHas_implicit_fields_anon'x5_1 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize Has_implicit_fields_anon'x5_1
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw Has_implicit_fields_anon'x5_1
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw Has_implicit_fields_anon'x5_1
+deriving via (EquivStorable Has_implicit_fields_anon'x5_1) instance Storable Has_implicit_fields_anon'x5_1
+deriving via (SizedByteArray 4
+                             4) instance IsUnion Has_implicit_fields_anon'x5_1
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_1"
+                  Has_implicit_fields_anon'x5_1
+                  ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_1"
+                  Has_implicit_fields_anon'x5_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_anon'x5_1_x5_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_1"
+                  (Ptr Has_implicit_fields_anon'x5_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x5_1_x5_1")
+instance HasCField Has_implicit_fields_anon'x5_1
+                   "has_implicit_fields_anon'x5_1_x5_1"
+    where type CFieldType Has_implicit_fields_anon'x5_1
+                          "has_implicit_fields_anon'x5_1_x5_1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_2"
+                  Has_implicit_fields_anon'x5_1
+                  ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_2"
+                  Has_implicit_fields_anon'x5_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_anon'x5_1_x5_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_2"
+                  (Ptr Has_implicit_fields_anon'x5_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x5_1_x5_2")
+instance HasCField Has_implicit_fields_anon'x5_1
+                   "has_implicit_fields_anon'x5_1_x5_2"
+    where type CFieldType Has_implicit_fields_anon'x5_1
+                          "has_implicit_fields_anon'x5_1_x5_2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct has_implicit_fields@
+
+    __defined at:__ @types\/anonymous\/struct.h 5:8@
+
+    __exported by:__ @types\/anonymous\/struct.h@
+-}
+data Has_implicit_fields
+    = Has_implicit_fields {has_implicit_fields_x1 :: CInt
+                           {- ^ __C declaration:__ @x1@
+
+                                __defined at:__ @types\/anonymous\/struct.h 6:7@
+
+                                __exported by:__ @types\/anonymous\/struct.h@
+                           -},
+                           has_implicit_fields_anon'x2_1 :: Has_implicit_fields_anon'x2_1
+                           {- ^ __C declaration:__ @anon\'x2_1@
+
+                                __defined at:__ @types\/anonymous\/struct.h 7:3@
+
+                                __exported by:__ @types\/anonymous\/struct.h@
+                           -},
+                           has_implicit_fields_x3 :: CInt
+                           {- ^ __C declaration:__ @x3@
+
+                                __defined at:__ @types\/anonymous\/struct.h 11:7@
+
+                                __exported by:__ @types\/anonymous\/struct.h@
+                           -},
+                           has_implicit_fields_anon'x4_1 :: Has_implicit_fields_anon'x4_1
+                           {- ^ __C declaration:__ @anon\'x4_1@
+
+                                __defined at:__ @types\/anonymous\/struct.h 12:3@
+
+                                __exported by:__ @types\/anonymous\/struct.h@
+                           -},
+                           has_implicit_fields_anon'x5_1 :: Has_implicit_fields_anon'x5_1
+                           {- ^ __C declaration:__ @anon\'x5_1@
+
+                                __defined at:__ @types\/anonymous\/struct.h 16:3@
+
+                                __exported by:__ @types\/anonymous\/struct.h@
+                           -},
+                           has_implicit_fields_x5 :: CInt
+                           {- ^ __C declaration:__ @x5@
+
+                                __defined at:__ @types\/anonymous\/struct.h 20:7@
+
+                                __exported by:__ @types\/anonymous\/struct.h@
+                           -}}
+    deriving stock Generic
+instance StaticSize Has_implicit_fields
+    where staticSizeOf = \_ -> 32 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Has_implicit_fields
+    where readRaw = \ptr_0 -> (((((pure Has_implicit_fields <*> readRaw (Proxy @"has_implicit_fields_x1") ptr_0) <*> readRaw (Proxy @"has_implicit_fields_anon'x2_1") ptr_0) <*> readRaw (Proxy @"has_implicit_fields_x3") ptr_0) <*> readRaw (Proxy @"has_implicit_fields_anon'x4_1") ptr_0) <*> readRaw (Proxy @"has_implicit_fields_anon'x5_1") ptr_0) <*> readRaw (Proxy @"has_implicit_fields_x5") ptr_0
+instance WriteRaw Has_implicit_fields
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Has_implicit_fields has_implicit_fields_x1_2
+                                                           has_implicit_fields_anon'x2_1_3
+                                                           has_implicit_fields_x3_4
+                                                           has_implicit_fields_anon'x4_1_5
+                                                           has_implicit_fields_anon'x5_1_6
+                                                           has_implicit_fields_x5_7 -> writeRaw (Proxy @"has_implicit_fields_x1") ptr_0 has_implicit_fields_x1_2 >> (writeRaw (Proxy @"has_implicit_fields_anon'x2_1") ptr_0 has_implicit_fields_anon'x2_1_3 >> (writeRaw (Proxy @"has_implicit_fields_x3") ptr_0 has_implicit_fields_x3_4 >> (writeRaw (Proxy @"has_implicit_fields_anon'x4_1") ptr_0 has_implicit_fields_anon'x4_1_5 >> (writeRaw (Proxy @"has_implicit_fields_anon'x5_1") ptr_0 has_implicit_fields_anon'x5_1_6 >> writeRaw (Proxy @"has_implicit_fields_x5") ptr_0 has_implicit_fields_x5_7))))
+deriving via (EquivStorable Has_implicit_fields) instance Storable Has_implicit_fields
+deriving via (IsStructViaReadRaw Has_implicit_fields) instance IsStruct Has_implicit_fields
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields{has_implicit_fields_x1 = y_1,
+                                                          has_implicit_fields_anon'x2_1 = getField @"has_implicit_fields_anon'x2_1" x_0,
+                                                          has_implicit_fields_x3 = getField @"has_implicit_fields_x3" x_0,
+                                                          has_implicit_fields_anon'x4_1 = getField @"has_implicit_fields_anon'x4_1" x_0,
+                                                          has_implicit_fields_anon'x5_1 = getField @"has_implicit_fields_anon'x5_1" x_0,
+                                                          has_implicit_fields_x5 = getField @"has_implicit_fields_x5" x_0},
+                              getField @"has_implicit_fields_x1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x1")
+instance HasCField Has_implicit_fields "has_implicit_fields_x1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty Has_implicit_fields_anon'x2_1 =>
+         HasField "has_implicit_fields_anon'x2_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields{has_implicit_fields_anon'x2_1 = y_1,
+                                                          has_implicit_fields_x1 = getField @"has_implicit_fields_x1" x_0,
+                                                          has_implicit_fields_x3 = getField @"has_implicit_fields_x3" x_0,
+                                                          has_implicit_fields_anon'x4_1 = getField @"has_implicit_fields_anon'x4_1" x_0,
+                                                          has_implicit_fields_anon'x5_1 = getField @"has_implicit_fields_anon'x5_1" x_0,
+                                                          has_implicit_fields_x5 = getField @"has_implicit_fields_x5" x_0},
+                              getField @"has_implicit_fields_anon'x2_1" x_0)
+instance (~) ty Has_implicit_fields_anon'x2_1 =>
+         HasField "has_implicit_fields_anon'x2_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x2_1")
+instance HasCField Has_implicit_fields
+                   "has_implicit_fields_anon'x2_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_anon'x2_1" = Has_implicit_fields_anon'x2_1
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_1" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x2_1_x2_1" (getField @"has_implicit_fields_anon'x2_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x2_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x2_1_x2_1" z_2 y_1),
+                              getField @"has_implicit_fields_x2_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x2_1")
+instance HasCField Has_implicit_fields "has_implicit_fields_x2_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x2_1" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_2" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x2_1_x2_2" (getField @"has_implicit_fields_anon'x2_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_2" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x2_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x2_1_x2_2" z_2 y_1),
+                              getField @"has_implicit_fields_x2_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_2"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x2_2")
+instance HasCField Has_implicit_fields "has_implicit_fields_x2_2"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x2_2" = CInt
+          offset# = \_ -> \_ -> 8
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x3" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields{has_implicit_fields_x3 = y_1,
+                                                          has_implicit_fields_x1 = getField @"has_implicit_fields_x1" x_0,
+                                                          has_implicit_fields_anon'x2_1 = getField @"has_implicit_fields_anon'x2_1" x_0,
+                                                          has_implicit_fields_anon'x4_1 = getField @"has_implicit_fields_anon'x4_1" x_0,
+                                                          has_implicit_fields_anon'x5_1 = getField @"has_implicit_fields_anon'x5_1" x_0,
+                                                          has_implicit_fields_x5 = getField @"has_implicit_fields_x5" x_0},
+                              getField @"has_implicit_fields_x3" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x3"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x3")
+instance HasCField Has_implicit_fields "has_implicit_fields_x3"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x3" = CInt
+          offset# = \_ -> \_ -> 12
+instance (~) ty Has_implicit_fields_anon'x4_1 =>
+         HasField "has_implicit_fields_anon'x4_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields{has_implicit_fields_anon'x4_1 = y_1,
+                                                          has_implicit_fields_x1 = getField @"has_implicit_fields_x1" x_0,
+                                                          has_implicit_fields_anon'x2_1 = getField @"has_implicit_fields_anon'x2_1" x_0,
+                                                          has_implicit_fields_x3 = getField @"has_implicit_fields_x3" x_0,
+                                                          has_implicit_fields_anon'x5_1 = getField @"has_implicit_fields_anon'x5_1" x_0,
+                                                          has_implicit_fields_x5 = getField @"has_implicit_fields_x5" x_0},
+                              getField @"has_implicit_fields_anon'x4_1" x_0)
+instance (~) ty Has_implicit_fields_anon'x4_1 =>
+         HasField "has_implicit_fields_anon'x4_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x4_1")
+instance HasCField Has_implicit_fields
+                   "has_implicit_fields_anon'x4_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_anon'x4_1" = Has_implicit_fields_anon'x4_1
+          offset# = \_ -> \_ -> 16
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_1" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x4_1_x4_1" (getField @"has_implicit_fields_anon'x4_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x4_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x4_1_x4_1" z_2 y_1),
+                              getField @"has_implicit_fields_x4_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x4_1")
+instance HasCField Has_implicit_fields "has_implicit_fields_x4_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x4_1" = CInt
+          offset# = \_ -> \_ -> 16
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_2" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x4_1_x4_2" (getField @"has_implicit_fields_anon'x4_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_2" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x4_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x4_1_x4_2" z_2 y_1),
+                              getField @"has_implicit_fields_x4_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_2"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x4_2")
+instance HasCField Has_implicit_fields "has_implicit_fields_x4_2"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x4_2" = CInt
+          offset# = \_ -> \_ -> 20
+instance (~) ty Has_implicit_fields_anon'x5_1 =>
+         HasField "has_implicit_fields_anon'x5_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields{has_implicit_fields_anon'x5_1 = y_1,
+                                                          has_implicit_fields_x1 = getField @"has_implicit_fields_x1" x_0,
+                                                          has_implicit_fields_anon'x2_1 = getField @"has_implicit_fields_anon'x2_1" x_0,
+                                                          has_implicit_fields_x3 = getField @"has_implicit_fields_x3" x_0,
+                                                          has_implicit_fields_anon'x4_1 = getField @"has_implicit_fields_anon'x4_1" x_0,
+                                                          has_implicit_fields_x5 = getField @"has_implicit_fields_x5" x_0},
+                              getField @"has_implicit_fields_anon'x5_1" x_0)
+instance (~) ty Has_implicit_fields_anon'x5_1 =>
+         HasField "has_implicit_fields_anon'x5_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x5_1")
+instance HasCField Has_implicit_fields
+                   "has_implicit_fields_anon'x5_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_anon'x5_1" = Has_implicit_fields_anon'x5_1
+          offset# = \_ -> \_ -> 24
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_1" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x5_1_x5_1" (getField @"has_implicit_fields_anon'x5_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x5_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x5_1_x5_1" z_2 y_1),
+                              getField @"has_implicit_fields_x5_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x5_1")
+instance HasCField Has_implicit_fields "has_implicit_fields_x5_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x5_1" = CInt
+          offset# = \_ -> \_ -> 24
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_2" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x5_1_x5_2" (getField @"has_implicit_fields_anon'x5_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_2" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x5_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x5_1_x5_2" z_2 y_1),
+                              getField @"has_implicit_fields_x5_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_2"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x5_2")
+instance HasCField Has_implicit_fields "has_implicit_fields_x5_2"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x5_2" = CInt
+          offset# = \_ -> \_ -> 24
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields{has_implicit_fields_x5 = y_1,
+                                                          has_implicit_fields_x1 = getField @"has_implicit_fields_x1" x_0,
+                                                          has_implicit_fields_anon'x2_1 = getField @"has_implicit_fields_anon'x2_1" x_0,
+                                                          has_implicit_fields_x3 = getField @"has_implicit_fields_x3" x_0,
+                                                          has_implicit_fields_anon'x4_1 = getField @"has_implicit_fields_anon'x4_1" x_0,
+                                                          has_implicit_fields_anon'x5_1 = getField @"has_implicit_fields_anon'x5_1" x_0},
+                              getField @"has_implicit_fields_x5" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x5")
+instance HasCField Has_implicit_fields "has_implicit_fields_x5"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x5" = CInt
+          offset# = \_ -> \_ -> 28
diff --git a/test-artefacts/fixtures/types/anonymous/struct_in_struct/Example.hs b/test-artefacts/fixtures/types/anonymous/struct_in_struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/struct_in_struct/Example.hs
@@ -0,0 +1,913 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Outer1_anon'fieldX(..)
+    , Example.Outer1(..)
+    , Example.Outer2_fieldB(..)
+    , Example.Outer2(..)
+    , Example.Inner3(..)
+    , Example.Outer3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@outer1_anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 8:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer1_anon'fieldX = Outer1_anon'fieldX
+  { outer1_anon'fieldX_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 9:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  , outer1_anon'fieldX_fieldY :: BG.CInt
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 10:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Outer1_anon'fieldX where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer1_anon'fieldX where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer1_anon'fieldX
+      <*> HasCField.readRaw (BG.Proxy @"outer1_anon'fieldX_fieldX") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer1_anon'fieldX_fieldY") ptr0
+
+instance Marshal.WriteRaw Outer1_anon'fieldX where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer1_anon'fieldX outer1_anon'fieldX_fieldX2 outer1_anon'fieldX_fieldY3 ->
+               HasCField.writeRaw (BG.Proxy @"outer1_anon'fieldX_fieldX") ptr0 outer1_anon'fieldX_fieldX2
+            >> HasCField.writeRaw (BG.Proxy @"outer1_anon'fieldX_fieldY") ptr0 outer1_anon'fieldX_fieldY3
+
+deriving via Marshal.EquivStorable Outer1_anon'fieldX instance BG.Storable Outer1_anon'fieldX
+
+deriving via Struct.IsStructViaReadRaw Outer1_anon'fieldX instance Struct.IsStruct Outer1_anon'fieldX
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1_anon'fieldX { outer1_anon'fieldX_fieldX = y1
+                             , outer1_anon'fieldX_fieldY = BG.getField @"outer1_anon'fieldX_fieldY" x0
+                             }
+      , BG.getField @"outer1_anon'fieldX_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldX" (BG.Ptr Outer1_anon'fieldX) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX_fieldX")
+
+instance HasCField.HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldX" where
+
+  type CFieldType Outer1_anon'fieldX "outer1_anon'fieldX_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 10:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1_anon'fieldX { outer1_anon'fieldX_fieldY = y1
+                             , outer1_anon'fieldX_fieldX = BG.getField @"outer1_anon'fieldX_fieldX" x0
+                             }
+      , BG.getField @"outer1_anon'fieldX_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldY" (BG.Ptr Outer1_anon'fieldX) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX_fieldY")
+
+instance HasCField.HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldY" where
+
+  type CFieldType Outer1_anon'fieldX "outer1_anon'fieldX_fieldY" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct outer1@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 6:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer1 = Outer1
+  { outer1_fieldA :: BG.CChar
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 7:8@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  , outer1_anon'fieldX :: Outer1_anon'fieldX
+    {- ^ __C declaration:__ @anon\'fieldX@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 8:3@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  , outer1_fieldC :: BG.CInt
+    {- ^ __C declaration:__ @fieldC@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 12:7@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Outer1 where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer1
+      <*> HasCField.readRaw (BG.Proxy @"outer1_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer1_anon'fieldX") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer1_fieldC") ptr0
+
+instance Marshal.WriteRaw Outer1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer1 outer1_fieldA2 outer1_anon'fieldX3 outer1_fieldC4 ->
+               HasCField.writeRaw (BG.Proxy @"outer1_fieldA") ptr0 outer1_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"outer1_anon'fieldX") ptr0 outer1_anon'fieldX3
+            >> HasCField.writeRaw (BG.Proxy @"outer1_fieldC") ptr0 outer1_fieldC4
+
+deriving via Marshal.EquivStorable Outer1 instance BG.Storable Outer1
+
+deriving via Struct.IsStructViaReadRaw Outer1 instance Struct.IsStruct Outer1
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 7:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer1_fieldA" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1 { outer1_fieldA = y1
+                 , outer1_anon'fieldX = BG.getField @"outer1_anon'fieldX" x0
+                 , outer1_fieldC = BG.getField @"outer1_fieldC" x0
+                 }
+      , BG.getField @"outer1_fieldA" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer1_fieldA" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldA")
+
+instance HasCField.HasCField Outer1 "outer1_fieldA" where
+
+  type CFieldType Outer1 "outer1_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 8:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1 { outer1_anon'fieldX = y1
+                 , outer1_fieldA = BG.getField @"outer1_fieldA" x0
+                 , outer1_fieldC = BG.getField @"outer1_fieldC" x0
+                 }
+      , BG.getField @"outer1_anon'fieldX" x0
+      )
+
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.HasField "outer1_anon'fieldX" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX")
+
+instance HasCField.HasCField Outer1 "outer1_anon'fieldX" where
+
+  type CFieldType Outer1 "outer1_anon'fieldX" =
+    Outer1_anon'fieldX
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldX" Outer1 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"outer1_anon'fieldX_fieldX" (BG.getField @"outer1_anon'fieldX" x0)
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldX" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"outer1_anon'fieldX" x0 (\z2 ->
+                                                                    BG.CompatHasField.setField @"outer1_anon'fieldX_fieldX" z2 y1)
+      , BG.getField @"outer1_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldX" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldX")
+
+instance HasCField.HasCField Outer1 "outer1_fieldX" where
+
+  type CFieldType Outer1 "outer1_fieldX" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 10:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldY" Outer1 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"outer1_anon'fieldX_fieldY" (BG.getField @"outer1_anon'fieldX" x0)
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 10:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldY" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"outer1_anon'fieldX" x0 (\z2 ->
+                                                                    BG.CompatHasField.setField @"outer1_anon'fieldX_fieldY" z2 y1)
+      , BG.getField @"outer1_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldY" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldY")
+
+instance HasCField.HasCField Outer1 "outer1_fieldY" where
+
+  type CFieldType Outer1 "outer1_fieldY" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 12:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldC" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1 { outer1_fieldC = y1
+                 , outer1_fieldA = BG.getField @"outer1_fieldA" x0
+                 , outer1_anon'fieldX = BG.getField @"outer1_anon'fieldX" x0
+                 }
+      , BG.getField @"outer1_fieldC" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldC" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldC")
+
+instance HasCField.HasCField Outer1 "outer1_fieldC" where
+
+  type CFieldType Outer1 "outer1_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @struct \@outer2_fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 17:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer2_fieldB = Outer2_fieldB
+  { outer2_fieldB_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 18:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  , outer2_fieldB_fieldY :: BG.CInt
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 19:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Outer2_fieldB where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer2_fieldB where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer2_fieldB
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldB_fieldX") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldB_fieldY") ptr0
+
+instance Marshal.WriteRaw Outer2_fieldB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer2_fieldB outer2_fieldB_fieldX2 outer2_fieldB_fieldY3 ->
+               HasCField.writeRaw (BG.Proxy @"outer2_fieldB_fieldX") ptr0 outer2_fieldB_fieldX2
+            >> HasCField.writeRaw (BG.Proxy @"outer2_fieldB_fieldY") ptr0 outer2_fieldB_fieldY3
+
+deriving via Marshal.EquivStorable Outer2_fieldB instance BG.Storable Outer2_fieldB
+
+deriving via Struct.IsStructViaReadRaw Outer2_fieldB instance Struct.IsStruct Outer2_fieldB
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 18:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldB_fieldX" Outer2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2_fieldB { outer2_fieldB_fieldX = y1
+                        , outer2_fieldB_fieldY = BG.getField @"outer2_fieldB_fieldY" x0
+                        }
+      , BG.getField @"outer2_fieldB_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldX" (BG.Ptr Outer2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB_fieldX")
+
+instance HasCField.HasCField Outer2_fieldB "outer2_fieldB_fieldX" where
+
+  type CFieldType Outer2_fieldB "outer2_fieldB_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 19:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldB_fieldY" Outer2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2_fieldB { outer2_fieldB_fieldY = y1
+                        , outer2_fieldB_fieldX = BG.getField @"outer2_fieldB_fieldX" x0
+                        }
+      , BG.getField @"outer2_fieldB_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldY" (BG.Ptr Outer2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB_fieldY")
+
+instance HasCField.HasCField Outer2_fieldB "outer2_fieldB_fieldY" where
+
+  type CFieldType Outer2_fieldB "outer2_fieldB_fieldY" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct outer2@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 15:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer2 = Outer2
+  { outer2_fieldA :: BG.CChar
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 16:8@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  , outer2_fieldB :: Outer2_fieldB
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 20:5@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  , outer2_fieldC :: BG.CInt
+    {- ^ __C declaration:__ @fieldC@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 21:7@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Outer2 where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer2 where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer2
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldB") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldC") ptr0
+
+instance Marshal.WriteRaw Outer2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer2 outer2_fieldA2 outer2_fieldB3 outer2_fieldC4 ->
+               HasCField.writeRaw (BG.Proxy @"outer2_fieldA") ptr0 outer2_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"outer2_fieldB") ptr0 outer2_fieldB3
+            >> HasCField.writeRaw (BG.Proxy @"outer2_fieldC") ptr0 outer2_fieldC4
+
+deriving via Marshal.EquivStorable Outer2 instance BG.Storable Outer2
+
+deriving via Struct.IsStructViaReadRaw Outer2 instance Struct.IsStruct Outer2
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 16:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer2_fieldA" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2 { outer2_fieldA = y1
+                 , outer2_fieldB = BG.getField @"outer2_fieldB" x0
+                 , outer2_fieldC = BG.getField @"outer2_fieldC" x0
+                 }
+      , BG.getField @"outer2_fieldA" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer2_fieldA" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldA")
+
+instance HasCField.HasCField Outer2 "outer2_fieldA" where
+
+  type CFieldType Outer2 "outer2_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 20:5@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ Outer2_fieldB
+         ) => BG.CompatHasField.HasField "outer2_fieldB" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2 { outer2_fieldB = y1
+                 , outer2_fieldA = BG.getField @"outer2_fieldA" x0
+                 , outer2_fieldC = BG.getField @"outer2_fieldC" x0
+                 }
+      , BG.getField @"outer2_fieldB" x0
+      )
+
+instance ( ty ~ Outer2_fieldB
+         ) => BG.HasField "outer2_fieldB" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB")
+
+instance HasCField.HasCField Outer2 "outer2_fieldB" where
+
+  type CFieldType Outer2 "outer2_fieldB" =
+    Outer2_fieldB
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 21:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldC" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2 { outer2_fieldC = y1
+                 , outer2_fieldA = BG.getField @"outer2_fieldA" x0
+                 , outer2_fieldB = BG.getField @"outer2_fieldB" x0
+                 }
+      , BG.getField @"outer2_fieldC" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldC" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldC")
+
+instance HasCField.HasCField Outer2 "outer2_fieldC" where
+
+  type CFieldType Outer2 "outer2_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @struct inner3@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 26:10@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Inner3 = Inner3
+  { inner3_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 27:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  , inner3_fieldY :: BG.CInt
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 28:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Inner3 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Inner3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Inner3
+      <*> HasCField.readRaw (BG.Proxy @"inner3_fieldX") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"inner3_fieldY") ptr0
+
+instance Marshal.WriteRaw Inner3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Inner3 inner3_fieldX2 inner3_fieldY3 ->
+               HasCField.writeRaw (BG.Proxy @"inner3_fieldX") ptr0 inner3_fieldX2
+            >> HasCField.writeRaw (BG.Proxy @"inner3_fieldY") ptr0 inner3_fieldY3
+
+deriving via Marshal.EquivStorable Inner3 instance BG.Storable Inner3
+
+deriving via Struct.IsStructViaReadRaw Inner3 instance Struct.IsStruct Inner3
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 27:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inner3_fieldX" Inner3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Inner3 {inner3_fieldX = y1, inner3_fieldY = BG.getField @"inner3_fieldY" x0}
+      , BG.getField @"inner3_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inner3_fieldX" (BG.Ptr Inner3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inner3_fieldX")
+
+instance HasCField.HasCField Inner3 "inner3_fieldX" where
+
+  type CFieldType Inner3 "inner3_fieldX" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 28:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inner3_fieldY" Inner3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Inner3 {inner3_fieldY = y1, inner3_fieldX = BG.getField @"inner3_fieldX" x0}
+      , BG.getField @"inner3_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inner3_fieldY" (BG.Ptr Inner3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inner3_fieldY")
+
+instance HasCField.HasCField Inner3 "inner3_fieldY" where
+
+  type CFieldType Inner3 "inner3_fieldY" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct outer3@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 24:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer3 = Outer3
+  { outer3_fieldA :: BG.CChar
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 25:8@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  , outer3_fieldB :: Inner3
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 29:5@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  , outer3_fieldC :: BG.CInt
+    {- ^ __C declaration:__ @fieldC@
+
+         __defined at:__ @types\/anonymous\/struct_in_struct.h 30:7@
+
+         __exported by:__ @types\/anonymous\/struct_in_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Outer3 where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer3
+      <*> HasCField.readRaw (BG.Proxy @"outer3_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer3_fieldB") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer3_fieldC") ptr0
+
+instance Marshal.WriteRaw Outer3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer3 outer3_fieldA2 outer3_fieldB3 outer3_fieldC4 ->
+               HasCField.writeRaw (BG.Proxy @"outer3_fieldA") ptr0 outer3_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"outer3_fieldB") ptr0 outer3_fieldB3
+            >> HasCField.writeRaw (BG.Proxy @"outer3_fieldC") ptr0 outer3_fieldC4
+
+deriving via Marshal.EquivStorable Outer3 instance BG.Storable Outer3
+
+deriving via Struct.IsStructViaReadRaw Outer3 instance Struct.IsStruct Outer3
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 25:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer3_fieldA" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer3 { outer3_fieldA = y1
+                 , outer3_fieldB = BG.getField @"outer3_fieldB" x0
+                 , outer3_fieldC = BG.getField @"outer3_fieldC" x0
+                 }
+      , BG.getField @"outer3_fieldA" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer3_fieldA" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldA")
+
+instance HasCField.HasCField Outer3 "outer3_fieldA" where
+
+  type CFieldType Outer3 "outer3_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 29:5@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ Inner3
+         ) => BG.CompatHasField.HasField "outer3_fieldB" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer3 { outer3_fieldB = y1
+                 , outer3_fieldA = BG.getField @"outer3_fieldA" x0
+                 , outer3_fieldC = BG.getField @"outer3_fieldC" x0
+                 }
+      , BG.getField @"outer3_fieldB" x0
+      )
+
+instance ( ty ~ Inner3
+         ) => BG.HasField "outer3_fieldB" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldB")
+
+instance HasCField.HasCField Outer3 "outer3_fieldB" where
+
+  type CFieldType Outer3 "outer3_fieldB" = Inner3
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 30:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer3_fieldC" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer3 { outer3_fieldC = y1
+                 , outer3_fieldA = BG.getField @"outer3_fieldA" x0
+                 , outer3_fieldB = BG.getField @"outer3_fieldB" x0
+                 }
+      , BG.getField @"outer3_fieldC" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer3_fieldC" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldC")
+
+instance HasCField.HasCField Outer3 "outer3_fieldC" where
+
+  type CFieldType Outer3 "outer3_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 12
diff --git a/test-artefacts/fixtures/types/anonymous/struct_in_struct/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/struct_in_struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/struct_in_struct/bindingspec.yaml
@@ -0,0 +1,147 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/struct_in_struct.h
+  cname: struct outer1
+  hsname: Outer1
+- headers: types/anonymous/struct_in_struct.h
+  cname: struct @outer1_anon'fieldX
+  hsname: Outer1_anon'fieldX
+- headers: types/anonymous/struct_in_struct.h
+  cname: struct outer2
+  hsname: Outer2
+- headers: types/anonymous/struct_in_struct.h
+  cname: struct @outer2_fieldB
+  hsname: Outer2_fieldB
+- headers: types/anonymous/struct_in_struct.h
+  cname: struct outer3
+  hsname: Outer3
+- headers: types/anonymous/struct_in_struct.h
+  cname: struct inner3
+  hsname: Inner3
+hstypes:
+- hsname: Inner3
+  representation:
+    record:
+      constructor: Inner3
+      fields:
+      - inner3_fieldX
+      - inner3_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer1
+  representation:
+    record:
+      constructor: Outer1
+      fields:
+      - outer1_fieldA
+      - outer1_anon'fieldX
+      - outer1_fieldC
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer1_anon'fieldX
+  representation:
+    record:
+      constructor: Outer1_anon'fieldX
+      fields:
+      - outer1_anon'fieldX_fieldX
+      - outer1_anon'fieldX_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer2
+  representation:
+    record:
+      constructor: Outer2
+      fields:
+      - outer2_fieldA
+      - outer2_fieldB
+      - outer2_fieldC
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer2_fieldB
+  representation:
+    record:
+      constructor: Outer2_fieldB
+      fields:
+      - outer2_fieldB_fieldX
+      - outer2_fieldB_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer3
+  representation:
+    record:
+      constructor: Outer3
+      fields:
+      - outer3_fieldA
+      - outer3_fieldB
+      - outer3_fieldC
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/struct_in_struct/th.txt b/test-artefacts/fixtures/types/anonymous/struct_in_struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/struct_in_struct/th.txt
@@ -0,0 +1,416 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/struct_in_struct.h
+{-| __C declaration:__ @struct \@outer1_anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 8:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer1_anon'fieldX
+    = Outer1_anon'fieldX {outer1_anon'fieldX_fieldX :: CInt
+                          {- ^ __C declaration:__ @fieldX@
+
+                               __defined at:__ @types\/anonymous\/struct_in_struct.h 9:9@
+
+                               __exported by:__ @types\/anonymous\/struct_in_struct.h@
+                          -},
+                          outer1_anon'fieldX_fieldY :: CInt
+                          {- ^ __C declaration:__ @fieldY@
+
+                               __defined at:__ @types\/anonymous\/struct_in_struct.h 10:9@
+
+                               __exported by:__ @types\/anonymous\/struct_in_struct.h@
+                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Outer1_anon'fieldX
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer1_anon'fieldX
+    where readRaw = \ptr_0 -> (pure Outer1_anon'fieldX <*> readRaw (Proxy @"outer1_anon'fieldX_fieldX") ptr_0) <*> readRaw (Proxy @"outer1_anon'fieldX_fieldY") ptr_0
+instance WriteRaw Outer1_anon'fieldX
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer1_anon'fieldX outer1_anon'fieldX_fieldX_2
+                                                          outer1_anon'fieldX_fieldY_3 -> writeRaw (Proxy @"outer1_anon'fieldX_fieldX") ptr_0 outer1_anon'fieldX_fieldX_2 >> writeRaw (Proxy @"outer1_anon'fieldX_fieldY") ptr_0 outer1_anon'fieldX_fieldY_3
+deriving via (EquivStorable Outer1_anon'fieldX) instance Storable Outer1_anon'fieldX
+deriving via (IsStructViaReadRaw Outer1_anon'fieldX) instance IsStruct Outer1_anon'fieldX
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty
+    where hasField = \x_0 -> (\y_1 -> Outer1_anon'fieldX{outer1_anon'fieldX_fieldX = y_1,
+                                                         outer1_anon'fieldX_fieldY = getField @"outer1_anon'fieldX_fieldY" x_0},
+                              getField @"outer1_anon'fieldX_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX"
+                  (Ptr Outer1_anon'fieldX)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX_fieldX")
+instance HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldX"
+    where type CFieldType Outer1_anon'fieldX
+                          "outer1_anon'fieldX_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty
+    where hasField = \x_0 -> (\y_1 -> Outer1_anon'fieldX{outer1_anon'fieldX_fieldY = y_1,
+                                                         outer1_anon'fieldX_fieldX = getField @"outer1_anon'fieldX_fieldX" x_0},
+                              getField @"outer1_anon'fieldX_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY"
+                  (Ptr Outer1_anon'fieldX)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX_fieldY")
+instance HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldY"
+    where type CFieldType Outer1_anon'fieldX
+                          "outer1_anon'fieldX_fieldY" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct outer1@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 6:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer1
+    = Outer1 {outer1_fieldA :: CChar
+              {- ^ __C declaration:__ @fieldA@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 7:8@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -},
+              outer1_anon'fieldX :: Outer1_anon'fieldX
+              {- ^ __C declaration:__ @anon\'fieldX@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 8:3@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -},
+              outer1_fieldC :: CInt
+              {- ^ __C declaration:__ @fieldC@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 12:7@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Outer1
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer1
+    where readRaw = \ptr_0 -> ((pure Outer1 <*> readRaw (Proxy @"outer1_fieldA") ptr_0) <*> readRaw (Proxy @"outer1_anon'fieldX") ptr_0) <*> readRaw (Proxy @"outer1_fieldC") ptr_0
+instance WriteRaw Outer1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer1 outer1_fieldA_2
+                                              outer1_anon'fieldX_3
+                                              outer1_fieldC_4 -> writeRaw (Proxy @"outer1_fieldA") ptr_0 outer1_fieldA_2 >> (writeRaw (Proxy @"outer1_anon'fieldX") ptr_0 outer1_anon'fieldX_3 >> writeRaw (Proxy @"outer1_fieldC") ptr_0 outer1_fieldC_4)
+deriving via (EquivStorable Outer1) instance Storable Outer1
+deriving via (IsStructViaReadRaw Outer1) instance IsStruct Outer1
+instance (~) ty CChar => HasField "outer1_fieldA" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> Outer1{outer1_fieldA = y_1,
+                                             outer1_anon'fieldX = getField @"outer1_anon'fieldX" x_0,
+                                             outer1_fieldC = getField @"outer1_fieldC" x_0},
+                              getField @"outer1_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer1_fieldA" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldA")
+instance HasCField Outer1 "outer1_fieldA"
+    where type CFieldType Outer1 "outer1_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> Outer1{outer1_anon'fieldX = y_1,
+                                             outer1_fieldA = getField @"outer1_fieldA" x_0,
+                                             outer1_fieldC = getField @"outer1_fieldC" x_0},
+                              getField @"outer1_anon'fieldX" x_0)
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX")
+instance HasCField Outer1 "outer1_anon'fieldX"
+    where type CFieldType Outer1
+                          "outer1_anon'fieldX" = Outer1_anon'fieldX
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer1_fieldX" Outer1 ty
+    where getField = \x_0 -> getField @"outer1_anon'fieldX_fieldX" (getField @"outer1_anon'fieldX" x_0)
+instance (~) ty CInt => HasField "outer1_fieldX" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"outer1_anon'fieldX" x_0 (\z_2 -> setField @"outer1_anon'fieldX_fieldX" z_2 y_1),
+                              getField @"outer1_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldX" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldX")
+instance HasCField Outer1 "outer1_fieldX"
+    where type CFieldType Outer1 "outer1_fieldX" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer1_fieldY" Outer1 ty
+    where getField = \x_0 -> getField @"outer1_anon'fieldX_fieldY" (getField @"outer1_anon'fieldX" x_0)
+instance (~) ty CInt => HasField "outer1_fieldY" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"outer1_anon'fieldX" x_0 (\z_2 -> setField @"outer1_anon'fieldX_fieldY" z_2 y_1),
+                              getField @"outer1_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldY" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldY")
+instance HasCField Outer1 "outer1_fieldY"
+    where type CFieldType Outer1 "outer1_fieldY" = CInt
+          offset# = \_ -> \_ -> 8
+instance (~) ty CInt => HasField "outer1_fieldC" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> Outer1{outer1_fieldC = y_1,
+                                             outer1_fieldA = getField @"outer1_fieldA" x_0,
+                                             outer1_anon'fieldX = getField @"outer1_anon'fieldX" x_0},
+                              getField @"outer1_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldC" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldC")
+instance HasCField Outer1 "outer1_fieldC"
+    where type CFieldType Outer1 "outer1_fieldC" = CInt
+          offset# = \_ -> \_ -> 12
+{-| __C declaration:__ @struct \@outer2_fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 17:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer2_fieldB
+    = Outer2_fieldB {outer2_fieldB_fieldX :: CInt
+                     {- ^ __C declaration:__ @fieldX@
+
+                          __defined at:__ @types\/anonymous\/struct_in_struct.h 18:9@
+
+                          __exported by:__ @types\/anonymous\/struct_in_struct.h@
+                     -},
+                     outer2_fieldB_fieldY :: CInt
+                     {- ^ __C declaration:__ @fieldY@
+
+                          __defined at:__ @types\/anonymous\/struct_in_struct.h 19:9@
+
+                          __exported by:__ @types\/anonymous\/struct_in_struct.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Outer2_fieldB
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer2_fieldB
+    where readRaw = \ptr_0 -> (pure Outer2_fieldB <*> readRaw (Proxy @"outer2_fieldB_fieldX") ptr_0) <*> readRaw (Proxy @"outer2_fieldB_fieldY") ptr_0
+instance WriteRaw Outer2_fieldB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer2_fieldB outer2_fieldB_fieldX_2
+                                                     outer2_fieldB_fieldY_3 -> writeRaw (Proxy @"outer2_fieldB_fieldX") ptr_0 outer2_fieldB_fieldX_2 >> writeRaw (Proxy @"outer2_fieldB_fieldY") ptr_0 outer2_fieldB_fieldY_3
+deriving via (EquivStorable Outer2_fieldB) instance Storable Outer2_fieldB
+deriving via (IsStructViaReadRaw Outer2_fieldB) instance IsStruct Outer2_fieldB
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" Outer2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> Outer2_fieldB{outer2_fieldB_fieldX = y_1,
+                                                    outer2_fieldB_fieldY = getField @"outer2_fieldB_fieldY" x_0},
+                              getField @"outer2_fieldB_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" (Ptr Outer2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB_fieldX")
+instance HasCField Outer2_fieldB "outer2_fieldB_fieldX"
+    where type CFieldType Outer2_fieldB "outer2_fieldB_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" Outer2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> Outer2_fieldB{outer2_fieldB_fieldY = y_1,
+                                                    outer2_fieldB_fieldX = getField @"outer2_fieldB_fieldX" x_0},
+                              getField @"outer2_fieldB_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" (Ptr Outer2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB_fieldY")
+instance HasCField Outer2_fieldB "outer2_fieldB_fieldY"
+    where type CFieldType Outer2_fieldB "outer2_fieldB_fieldY" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct outer2@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 15:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer2
+    = Outer2 {outer2_fieldA :: CChar
+              {- ^ __C declaration:__ @fieldA@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 16:8@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -},
+              outer2_fieldB :: Outer2_fieldB
+              {- ^ __C declaration:__ @fieldB@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 20:5@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -},
+              outer2_fieldC :: CInt
+              {- ^ __C declaration:__ @fieldC@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 21:7@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Outer2
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer2
+    where readRaw = \ptr_0 -> ((pure Outer2 <*> readRaw (Proxy @"outer2_fieldA") ptr_0) <*> readRaw (Proxy @"outer2_fieldB") ptr_0) <*> readRaw (Proxy @"outer2_fieldC") ptr_0
+instance WriteRaw Outer2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer2 outer2_fieldA_2
+                                              outer2_fieldB_3
+                                              outer2_fieldC_4 -> writeRaw (Proxy @"outer2_fieldA") ptr_0 outer2_fieldA_2 >> (writeRaw (Proxy @"outer2_fieldB") ptr_0 outer2_fieldB_3 >> writeRaw (Proxy @"outer2_fieldC") ptr_0 outer2_fieldC_4)
+deriving via (EquivStorable Outer2) instance Storable Outer2
+deriving via (IsStructViaReadRaw Outer2) instance IsStruct Outer2
+instance (~) ty CChar => HasField "outer2_fieldA" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> Outer2{outer2_fieldA = y_1,
+                                             outer2_fieldB = getField @"outer2_fieldB" x_0,
+                                             outer2_fieldC = getField @"outer2_fieldC" x_0},
+                              getField @"outer2_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer2_fieldA" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldA")
+instance HasCField Outer2 "outer2_fieldA"
+    where type CFieldType Outer2 "outer2_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Outer2_fieldB => HasField "outer2_fieldB" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> Outer2{outer2_fieldB = y_1,
+                                             outer2_fieldA = getField @"outer2_fieldA" x_0,
+                                             outer2_fieldC = getField @"outer2_fieldC" x_0},
+                              getField @"outer2_fieldB" x_0)
+instance (~) ty Outer2_fieldB =>
+         HasField "outer2_fieldB" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB")
+instance HasCField Outer2 "outer2_fieldB"
+    where type CFieldType Outer2 "outer2_fieldB" = Outer2_fieldB
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer2_fieldC" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> Outer2{outer2_fieldC = y_1,
+                                             outer2_fieldA = getField @"outer2_fieldA" x_0,
+                                             outer2_fieldB = getField @"outer2_fieldB" x_0},
+                              getField @"outer2_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldC" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldC")
+instance HasCField Outer2 "outer2_fieldC"
+    where type CFieldType Outer2 "outer2_fieldC" = CInt
+          offset# = \_ -> \_ -> 12
+{-| __C declaration:__ @struct inner3@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 26:10@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Inner3
+    = Inner3 {inner3_fieldX :: CInt
+              {- ^ __C declaration:__ @fieldX@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 27:9@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -},
+              inner3_fieldY :: CInt
+              {- ^ __C declaration:__ @fieldY@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 28:9@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Inner3
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Inner3
+    where readRaw = \ptr_0 -> (pure Inner3 <*> readRaw (Proxy @"inner3_fieldX") ptr_0) <*> readRaw (Proxy @"inner3_fieldY") ptr_0
+instance WriteRaw Inner3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Inner3 inner3_fieldX_2
+                                              inner3_fieldY_3 -> writeRaw (Proxy @"inner3_fieldX") ptr_0 inner3_fieldX_2 >> writeRaw (Proxy @"inner3_fieldY") ptr_0 inner3_fieldY_3
+deriving via (EquivStorable Inner3) instance Storable Inner3
+deriving via (IsStructViaReadRaw Inner3) instance IsStruct Inner3
+instance (~) ty CInt => HasField "inner3_fieldX" Inner3 ty
+    where hasField = \x_0 -> (\y_1 -> Inner3{inner3_fieldX = y_1,
+                                             inner3_fieldY = getField @"inner3_fieldY" x_0},
+                              getField @"inner3_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "inner3_fieldX" (Ptr Inner3) (Ptr ty)
+    where getField = fromPtr (Proxy @"inner3_fieldX")
+instance HasCField Inner3 "inner3_fieldX"
+    where type CFieldType Inner3 "inner3_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "inner3_fieldY" Inner3 ty
+    where hasField = \x_0 -> (\y_1 -> Inner3{inner3_fieldY = y_1,
+                                             inner3_fieldX = getField @"inner3_fieldX" x_0},
+                              getField @"inner3_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "inner3_fieldY" (Ptr Inner3) (Ptr ty)
+    where getField = fromPtr (Proxy @"inner3_fieldY")
+instance HasCField Inner3 "inner3_fieldY"
+    where type CFieldType Inner3 "inner3_fieldY" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct outer3@
+
+    __defined at:__ @types\/anonymous\/struct_in_struct.h 24:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_struct.h@
+-}
+data Outer3
+    = Outer3 {outer3_fieldA :: CChar
+              {- ^ __C declaration:__ @fieldA@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 25:8@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -},
+              outer3_fieldB :: Inner3
+              {- ^ __C declaration:__ @fieldB@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 29:5@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -},
+              outer3_fieldC :: CInt
+              {- ^ __C declaration:__ @fieldC@
+
+                   __defined at:__ @types\/anonymous\/struct_in_struct.h 30:7@
+
+                   __exported by:__ @types\/anonymous\/struct_in_struct.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Outer3
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer3
+    where readRaw = \ptr_0 -> ((pure Outer3 <*> readRaw (Proxy @"outer3_fieldA") ptr_0) <*> readRaw (Proxy @"outer3_fieldB") ptr_0) <*> readRaw (Proxy @"outer3_fieldC") ptr_0
+instance WriteRaw Outer3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer3 outer3_fieldA_2
+                                              outer3_fieldB_3
+                                              outer3_fieldC_4 -> writeRaw (Proxy @"outer3_fieldA") ptr_0 outer3_fieldA_2 >> (writeRaw (Proxy @"outer3_fieldB") ptr_0 outer3_fieldB_3 >> writeRaw (Proxy @"outer3_fieldC") ptr_0 outer3_fieldC_4)
+deriving via (EquivStorable Outer3) instance Storable Outer3
+deriving via (IsStructViaReadRaw Outer3) instance IsStruct Outer3
+instance (~) ty CChar => HasField "outer3_fieldA" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> Outer3{outer3_fieldA = y_1,
+                                             outer3_fieldB = getField @"outer3_fieldB" x_0,
+                                             outer3_fieldC = getField @"outer3_fieldC" x_0},
+                              getField @"outer3_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer3_fieldA" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldA")
+instance HasCField Outer3 "outer3_fieldA"
+    where type CFieldType Outer3 "outer3_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Inner3 => HasField "outer3_fieldB" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> Outer3{outer3_fieldB = y_1,
+                                             outer3_fieldA = getField @"outer3_fieldA" x_0,
+                                             outer3_fieldC = getField @"outer3_fieldC" x_0},
+                              getField @"outer3_fieldB" x_0)
+instance (~) ty Inner3 =>
+         HasField "outer3_fieldB" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldB")
+instance HasCField Outer3 "outer3_fieldB"
+    where type CFieldType Outer3 "outer3_fieldB" = Inner3
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer3_fieldC" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> Outer3{outer3_fieldC = y_1,
+                                             outer3_fieldA = getField @"outer3_fieldA" x_0,
+                                             outer3_fieldB = getField @"outer3_fieldB" x_0},
+                              getField @"outer3_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer3_fieldC" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldC")
+instance HasCField Outer3 "outer3_fieldC"
+    where type CFieldType Outer3 "outer3_fieldC" = CInt
+          offset# = \_ -> \_ -> 12
diff --git a/test-artefacts/fixtures/types/anonymous/struct_in_union/Example.hs b/test-artefacts/fixtures/types/anonymous/struct_in_union/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/struct_in_union/Example.hs
@@ -0,0 +1,840 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Outer1_anon'fieldX(..)
+    , Example.Outer1(..)
+    , Example.Outer2_fieldB(..)
+    , Example.Outer2(..)
+    , Example.Inner3(..)
+    , Example.Outer3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@outer1_anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 8:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+data Outer1_anon'fieldX = Outer1_anon'fieldX
+  { outer1_anon'fieldX_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @types\/anonymous\/struct_in_union.h 9:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_union.h@
+    -}
+  , outer1_anon'fieldX_fieldY :: BG.CInt
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @types\/anonymous\/struct_in_union.h 10:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Outer1_anon'fieldX where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer1_anon'fieldX where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer1_anon'fieldX
+      <*> HasCField.readRaw (BG.Proxy @"outer1_anon'fieldX_fieldX") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer1_anon'fieldX_fieldY") ptr0
+
+instance Marshal.WriteRaw Outer1_anon'fieldX where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer1_anon'fieldX outer1_anon'fieldX_fieldX2 outer1_anon'fieldX_fieldY3 ->
+               HasCField.writeRaw (BG.Proxy @"outer1_anon'fieldX_fieldX") ptr0 outer1_anon'fieldX_fieldX2
+            >> HasCField.writeRaw (BG.Proxy @"outer1_anon'fieldX_fieldY") ptr0 outer1_anon'fieldX_fieldY3
+
+deriving via Marshal.EquivStorable Outer1_anon'fieldX instance BG.Storable Outer1_anon'fieldX
+
+deriving via Struct.IsStructViaReadRaw Outer1_anon'fieldX instance Struct.IsStruct Outer1_anon'fieldX
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 9:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1_anon'fieldX { outer1_anon'fieldX_fieldX = y1
+                             , outer1_anon'fieldX_fieldY = BG.getField @"outer1_anon'fieldX_fieldY" x0
+                             }
+      , BG.getField @"outer1_anon'fieldX_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldX" (BG.Ptr Outer1_anon'fieldX) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX_fieldX")
+
+instance HasCField.HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldX" where
+
+  type CFieldType Outer1_anon'fieldX "outer1_anon'fieldX_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 10:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1_anon'fieldX { outer1_anon'fieldX_fieldY = y1
+                             , outer1_anon'fieldX_fieldX = BG.getField @"outer1_anon'fieldX_fieldX" x0
+                             }
+      , BG.getField @"outer1_anon'fieldX_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldY" (BG.Ptr Outer1_anon'fieldX) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX_fieldY")
+
+instance HasCField.HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldY" where
+
+  type CFieldType Outer1_anon'fieldX "outer1_anon'fieldX_fieldY" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union outer1@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 6:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+newtype Outer1 = Outer1
+  { unwrapOuter1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.StaticSize Outer1
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.ReadRaw Outer1
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.WriteRaw Outer1
+
+deriving via Marshal.EquivStorable Outer1 instance BG.Storable Outer1
+
+deriving via BG.SizedByteArray 8 4 instance Union.IsUnion Outer1
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 7:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "outer1_fieldA" Outer1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 7:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer1_fieldA" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer1_fieldA" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer1_fieldA" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldA")
+
+instance HasCField.HasCField Outer1 "outer1_fieldA" where
+
+  type CFieldType Outer1 "outer1_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 8:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.HasField "outer1_anon'fieldX" Outer1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 8:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer1_anon'fieldX" x0)
+
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.HasField "outer1_anon'fieldX" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX")
+
+instance HasCField.HasCField Outer1 "outer1_anon'fieldX" where
+
+  type CFieldType Outer1 "outer1_anon'fieldX" =
+    Outer1_anon'fieldX
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 9:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldX" Outer1 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"outer1_anon'fieldX_fieldX" (BG.getField @"outer1_anon'fieldX" x0)
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 9:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldX" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"outer1_anon'fieldX" x0 (\z2 ->
+                                                                    BG.CompatHasField.setField @"outer1_anon'fieldX_fieldX" z2 y1)
+      , BG.getField @"outer1_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldX" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldX")
+
+instance HasCField.HasCField Outer1 "outer1_fieldX" where
+
+  type CFieldType Outer1 "outer1_fieldX" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 10:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldY" Outer1 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"outer1_anon'fieldX_fieldY" (BG.getField @"outer1_anon'fieldX" x0)
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 10:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldY" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"outer1_anon'fieldX" x0 (\z2 ->
+                                                                    BG.CompatHasField.setField @"outer1_anon'fieldX_fieldY" z2 y1)
+      , BG.getField @"outer1_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldY" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldY")
+
+instance HasCField.HasCField Outer1 "outer1_fieldY" where
+
+  type CFieldType Outer1 "outer1_fieldY" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 12:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldC" Outer1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 12:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldC" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer1_fieldC" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldC" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldC")
+
+instance HasCField.HasCField Outer1 "outer1_fieldC" where
+
+  type CFieldType Outer1 "outer1_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@outer2_fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 17:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+data Outer2_fieldB = Outer2_fieldB
+  { outer2_fieldB_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @types\/anonymous\/struct_in_union.h 18:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_union.h@
+    -}
+  , outer2_fieldB_fieldY :: BG.CInt
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @types\/anonymous\/struct_in_union.h 19:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Outer2_fieldB where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer2_fieldB where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer2_fieldB
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldB_fieldX") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldB_fieldY") ptr0
+
+instance Marshal.WriteRaw Outer2_fieldB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer2_fieldB outer2_fieldB_fieldX2 outer2_fieldB_fieldY3 ->
+               HasCField.writeRaw (BG.Proxy @"outer2_fieldB_fieldX") ptr0 outer2_fieldB_fieldX2
+            >> HasCField.writeRaw (BG.Proxy @"outer2_fieldB_fieldY") ptr0 outer2_fieldB_fieldY3
+
+deriving via Marshal.EquivStorable Outer2_fieldB instance BG.Storable Outer2_fieldB
+
+deriving via Struct.IsStructViaReadRaw Outer2_fieldB instance Struct.IsStruct Outer2_fieldB
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 18:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldB_fieldX" Outer2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2_fieldB { outer2_fieldB_fieldX = y1
+                        , outer2_fieldB_fieldY = BG.getField @"outer2_fieldB_fieldY" x0
+                        }
+      , BG.getField @"outer2_fieldB_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldX" (BG.Ptr Outer2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB_fieldX")
+
+instance HasCField.HasCField Outer2_fieldB "outer2_fieldB_fieldX" where
+
+  type CFieldType Outer2_fieldB "outer2_fieldB_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 19:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldB_fieldY" Outer2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2_fieldB { outer2_fieldB_fieldY = y1
+                        , outer2_fieldB_fieldX = BG.getField @"outer2_fieldB_fieldX" x0
+                        }
+      , BG.getField @"outer2_fieldB_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldY" (BG.Ptr Outer2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB_fieldY")
+
+instance HasCField.HasCField Outer2_fieldB "outer2_fieldB_fieldY" where
+
+  type CFieldType Outer2_fieldB "outer2_fieldB_fieldY" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union outer2@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 15:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+newtype Outer2 = Outer2
+  { unwrapOuter2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.StaticSize Outer2
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.ReadRaw Outer2
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.WriteRaw Outer2
+
+deriving via Marshal.EquivStorable Outer2 instance BG.Storable Outer2
+
+deriving via BG.SizedByteArray 8 4 instance Union.IsUnion Outer2
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 16:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "outer2_fieldA" Outer2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 16:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer2_fieldA" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldA" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer2_fieldA" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldA")
+
+instance HasCField.HasCField Outer2 "outer2_fieldA" where
+
+  type CFieldType Outer2 "outer2_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 20:5@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ Outer2_fieldB) => BG.HasField "outer2_fieldB" Outer2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 20:5@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ Outer2_fieldB
+         ) => BG.CompatHasField.HasField "outer2_fieldB" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldB" x0)
+
+instance ( ty ~ Outer2_fieldB
+         ) => BG.HasField "outer2_fieldB" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB")
+
+instance HasCField.HasCField Outer2 "outer2_fieldB" where
+
+  type CFieldType Outer2 "outer2_fieldB" =
+    Outer2_fieldB
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 21:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer2_fieldC" Outer2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 21:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldC" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldC" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldC" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldC")
+
+instance HasCField.HasCField Outer2 "outer2_fieldC" where
+
+  type CFieldType Outer2 "outer2_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct inner3@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 26:10@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+data Inner3 = Inner3
+  { inner3_fieldX :: BG.CInt
+    {- ^ __C declaration:__ @fieldX@
+
+         __defined at:__ @types\/anonymous\/struct_in_union.h 27:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_union.h@
+    -}
+  , inner3_fieldY :: BG.CInt
+    {- ^ __C declaration:__ @fieldY@
+
+         __defined at:__ @types\/anonymous\/struct_in_union.h 28:9@
+
+         __exported by:__ @types\/anonymous\/struct_in_union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Inner3 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Inner3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Inner3
+      <*> HasCField.readRaw (BG.Proxy @"inner3_fieldX") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"inner3_fieldY") ptr0
+
+instance Marshal.WriteRaw Inner3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Inner3 inner3_fieldX2 inner3_fieldY3 ->
+               HasCField.writeRaw (BG.Proxy @"inner3_fieldX") ptr0 inner3_fieldX2
+            >> HasCField.writeRaw (BG.Proxy @"inner3_fieldY") ptr0 inner3_fieldY3
+
+deriving via Marshal.EquivStorable Inner3 instance BG.Storable Inner3
+
+deriving via Struct.IsStructViaReadRaw Inner3 instance Struct.IsStruct Inner3
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 27:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inner3_fieldX" Inner3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Inner3 {inner3_fieldX = y1, inner3_fieldY = BG.getField @"inner3_fieldY" x0}
+      , BG.getField @"inner3_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inner3_fieldX" (BG.Ptr Inner3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inner3_fieldX")
+
+instance HasCField.HasCField Inner3 "inner3_fieldX" where
+
+  type CFieldType Inner3 "inner3_fieldX" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 28:9@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inner3_fieldY" Inner3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Inner3 {inner3_fieldY = y1, inner3_fieldX = BG.getField @"inner3_fieldX" x0}
+      , BG.getField @"inner3_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inner3_fieldY" (BG.Ptr Inner3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inner3_fieldY")
+
+instance HasCField.HasCField Inner3 "inner3_fieldY" where
+
+  type CFieldType Inner3 "inner3_fieldY" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union outer3@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 24:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+newtype Outer3 = Outer3
+  { unwrapOuter3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.StaticSize Outer3
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.ReadRaw Outer3
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.WriteRaw Outer3
+
+deriving via Marshal.EquivStorable Outer3 instance BG.Storable Outer3
+
+deriving via BG.SizedByteArray 8 4 instance Union.IsUnion Outer3
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 25:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "outer3_fieldA" Outer3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 25:8@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer3_fieldA" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer3_fieldA" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer3_fieldA" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldA")
+
+instance HasCField.HasCField Outer3 "outer3_fieldA" where
+
+  type CFieldType Outer3 "outer3_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 29:5@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ Inner3) => BG.HasField "outer3_fieldB" Outer3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 29:5@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ Inner3
+         ) => BG.CompatHasField.HasField "outer3_fieldB" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer3_fieldB" x0)
+
+instance ( ty ~ Inner3
+         ) => BG.HasField "outer3_fieldB" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldB")
+
+instance HasCField.HasCField Outer3 "outer3_fieldB" where
+
+  type CFieldType Outer3 "outer3_fieldB" = Inner3
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 30:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer3_fieldC" Outer3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 30:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer3_fieldC" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer3_fieldC" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer3_fieldC" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldC")
+
+instance HasCField.HasCField Outer3 "outer3_fieldC" where
+
+  type CFieldType Outer3 "outer3_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/struct_in_union/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/struct_in_union/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/struct_in_union/bindingspec.yaml
@@ -0,0 +1,135 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/struct_in_union.h
+  cname: union outer1
+  hsname: Outer1
+- headers: types/anonymous/struct_in_union.h
+  cname: struct @outer1_anon'fieldX
+  hsname: Outer1_anon'fieldX
+- headers: types/anonymous/struct_in_union.h
+  cname: union outer2
+  hsname: Outer2
+- headers: types/anonymous/struct_in_union.h
+  cname: struct @outer2_fieldB
+  hsname: Outer2_fieldB
+- headers: types/anonymous/struct_in_union.h
+  cname: union outer3
+  hsname: Outer3
+- headers: types/anonymous/struct_in_union.h
+  cname: struct inner3
+  hsname: Inner3
+hstypes:
+- hsname: Inner3
+  representation:
+    record:
+      constructor: Inner3
+      fields:
+      - inner3_fieldX
+      - inner3_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer1
+  representation:
+    newtype:
+      constructor: Outer1
+      fields:
+      - unwrapOuter1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer1_anon'fieldX
+  representation:
+    record:
+      constructor: Outer1_anon'fieldX
+      fields:
+      - outer1_anon'fieldX_fieldX
+      - outer1_anon'fieldX_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer2
+  representation:
+    newtype:
+      constructor: Outer2
+      fields:
+      - unwrapOuter2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer2_fieldB
+  representation:
+    record:
+      constructor: Outer2_fieldB
+      fields:
+      - outer2_fieldB_fieldX
+      - outer2_fieldB_fieldY
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer3
+  representation:
+    newtype:
+      constructor: Outer3
+      fields:
+      - unwrapOuter3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/struct_in_union/th.txt b/test-artefacts/fixtures/types/anonymous/struct_in_union/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/struct_in_union/th.txt
@@ -0,0 +1,336 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/struct_in_union.h
+{-| __C declaration:__ @struct \@outer1_anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 8:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+data Outer1_anon'fieldX
+    = Outer1_anon'fieldX {outer1_anon'fieldX_fieldX :: CInt
+                          {- ^ __C declaration:__ @fieldX@
+
+                               __defined at:__ @types\/anonymous\/struct_in_union.h 9:9@
+
+                               __exported by:__ @types\/anonymous\/struct_in_union.h@
+                          -},
+                          outer1_anon'fieldX_fieldY :: CInt
+                          {- ^ __C declaration:__ @fieldY@
+
+                               __defined at:__ @types\/anonymous\/struct_in_union.h 10:9@
+
+                               __exported by:__ @types\/anonymous\/struct_in_union.h@
+                          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Outer1_anon'fieldX
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer1_anon'fieldX
+    where readRaw = \ptr_0 -> (pure Outer1_anon'fieldX <*> readRaw (Proxy @"outer1_anon'fieldX_fieldX") ptr_0) <*> readRaw (Proxy @"outer1_anon'fieldX_fieldY") ptr_0
+instance WriteRaw Outer1_anon'fieldX
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer1_anon'fieldX outer1_anon'fieldX_fieldX_2
+                                                          outer1_anon'fieldX_fieldY_3 -> writeRaw (Proxy @"outer1_anon'fieldX_fieldX") ptr_0 outer1_anon'fieldX_fieldX_2 >> writeRaw (Proxy @"outer1_anon'fieldX_fieldY") ptr_0 outer1_anon'fieldX_fieldY_3
+deriving via (EquivStorable Outer1_anon'fieldX) instance Storable Outer1_anon'fieldX
+deriving via (IsStructViaReadRaw Outer1_anon'fieldX) instance IsStruct Outer1_anon'fieldX
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty
+    where hasField = \x_0 -> (\y_1 -> Outer1_anon'fieldX{outer1_anon'fieldX_fieldX = y_1,
+                                                         outer1_anon'fieldX_fieldY = getField @"outer1_anon'fieldX_fieldY" x_0},
+                              getField @"outer1_anon'fieldX_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX"
+                  (Ptr Outer1_anon'fieldX)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX_fieldX")
+instance HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldX"
+    where type CFieldType Outer1_anon'fieldX
+                          "outer1_anon'fieldX_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty
+    where hasField = \x_0 -> (\y_1 -> Outer1_anon'fieldX{outer1_anon'fieldX_fieldY = y_1,
+                                                         outer1_anon'fieldX_fieldX = getField @"outer1_anon'fieldX_fieldX" x_0},
+                              getField @"outer1_anon'fieldX_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY"
+                  (Ptr Outer1_anon'fieldX)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX_fieldY")
+instance HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldY"
+    where type CFieldType Outer1_anon'fieldX
+                          "outer1_anon'fieldX_fieldY" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @union outer1@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 6:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+newtype Outer1
+    = Outer1 {unwrapOuter1 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8 4) instance StaticSize Outer1
+deriving via (SizedByteArray 8 4) instance ReadRaw Outer1
+deriving via (SizedByteArray 8 4) instance WriteRaw Outer1
+deriving via (EquivStorable Outer1) instance Storable Outer1
+deriving via (SizedByteArray 8 4) instance IsUnion Outer1
+instance (~) ty CChar => HasField "outer1_fieldA" Outer1 ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "outer1_fieldA" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer1_fieldA" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldA")
+instance HasCField Outer1 "outer1_fieldA"
+    where type CFieldType Outer1 "outer1_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" Outer1 ty
+    where getField = getUnionPayload
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_anon'fieldX" x_0)
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX")
+instance HasCField Outer1 "outer1_anon'fieldX"
+    where type CFieldType Outer1
+                          "outer1_anon'fieldX" = Outer1_anon'fieldX
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outer1_fieldX" Outer1 ty
+    where getField = \x_0 -> getField @"outer1_anon'fieldX_fieldX" (getField @"outer1_anon'fieldX" x_0)
+instance (~) ty CInt => HasField "outer1_fieldX" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"outer1_anon'fieldX" x_0 (\z_2 -> setField @"outer1_anon'fieldX_fieldX" z_2 y_1),
+                              getField @"outer1_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldX" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldX")
+instance HasCField Outer1 "outer1_fieldX"
+    where type CFieldType Outer1 "outer1_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outer1_fieldY" Outer1 ty
+    where getField = \x_0 -> getField @"outer1_anon'fieldX_fieldY" (getField @"outer1_anon'fieldX" x_0)
+instance (~) ty CInt => HasField "outer1_fieldY" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"outer1_anon'fieldX" x_0 (\z_2 -> setField @"outer1_anon'fieldX_fieldY" z_2 y_1),
+                              getField @"outer1_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldY" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldY")
+instance HasCField Outer1 "outer1_fieldY"
+    where type CFieldType Outer1 "outer1_fieldY" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer1_fieldC" Outer1 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "outer1_fieldC" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldC" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldC")
+instance HasCField Outer1 "outer1_fieldC"
+    where type CFieldType Outer1 "outer1_fieldC" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@outer2_fieldB@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 17:3@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+data Outer2_fieldB
+    = Outer2_fieldB {outer2_fieldB_fieldX :: CInt
+                     {- ^ __C declaration:__ @fieldX@
+
+                          __defined at:__ @types\/anonymous\/struct_in_union.h 18:9@
+
+                          __exported by:__ @types\/anonymous\/struct_in_union.h@
+                     -},
+                     outer2_fieldB_fieldY :: CInt
+                     {- ^ __C declaration:__ @fieldY@
+
+                          __defined at:__ @types\/anonymous\/struct_in_union.h 19:9@
+
+                          __exported by:__ @types\/anonymous\/struct_in_union.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Outer2_fieldB
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer2_fieldB
+    where readRaw = \ptr_0 -> (pure Outer2_fieldB <*> readRaw (Proxy @"outer2_fieldB_fieldX") ptr_0) <*> readRaw (Proxy @"outer2_fieldB_fieldY") ptr_0
+instance WriteRaw Outer2_fieldB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer2_fieldB outer2_fieldB_fieldX_2
+                                                     outer2_fieldB_fieldY_3 -> writeRaw (Proxy @"outer2_fieldB_fieldX") ptr_0 outer2_fieldB_fieldX_2 >> writeRaw (Proxy @"outer2_fieldB_fieldY") ptr_0 outer2_fieldB_fieldY_3
+deriving via (EquivStorable Outer2_fieldB) instance Storable Outer2_fieldB
+deriving via (IsStructViaReadRaw Outer2_fieldB) instance IsStruct Outer2_fieldB
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" Outer2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> Outer2_fieldB{outer2_fieldB_fieldX = y_1,
+                                                    outer2_fieldB_fieldY = getField @"outer2_fieldB_fieldY" x_0},
+                              getField @"outer2_fieldB_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" (Ptr Outer2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB_fieldX")
+instance HasCField Outer2_fieldB "outer2_fieldB_fieldX"
+    where type CFieldType Outer2_fieldB "outer2_fieldB_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" Outer2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> Outer2_fieldB{outer2_fieldB_fieldY = y_1,
+                                                    outer2_fieldB_fieldX = getField @"outer2_fieldB_fieldX" x_0},
+                              getField @"outer2_fieldB_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" (Ptr Outer2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB_fieldY")
+instance HasCField Outer2_fieldB "outer2_fieldB_fieldY"
+    where type CFieldType Outer2_fieldB "outer2_fieldB_fieldY" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @union outer2@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 15:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+newtype Outer2
+    = Outer2 {unwrapOuter2 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8 4) instance StaticSize Outer2
+deriving via (SizedByteArray 8 4) instance ReadRaw Outer2
+deriving via (SizedByteArray 8 4) instance WriteRaw Outer2
+deriving via (EquivStorable Outer2) instance Storable Outer2
+deriving via (SizedByteArray 8 4) instance IsUnion Outer2
+instance (~) ty CChar => HasField "outer2_fieldA" Outer2 ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "outer2_fieldA" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer2_fieldA" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldA")
+instance HasCField Outer2 "outer2_fieldA"
+    where type CFieldType Outer2 "outer2_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Outer2_fieldB => HasField "outer2_fieldB" Outer2 ty
+    where getField = getUnionPayload
+instance (~) ty Outer2_fieldB => HasField "outer2_fieldB" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldB" x_0)
+instance (~) ty Outer2_fieldB =>
+         HasField "outer2_fieldB" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB")
+instance HasCField Outer2 "outer2_fieldB"
+    where type CFieldType Outer2 "outer2_fieldB" = Outer2_fieldB
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outer2_fieldC" Outer2 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "outer2_fieldC" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldC" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldC")
+instance HasCField Outer2 "outer2_fieldC"
+    where type CFieldType Outer2 "outer2_fieldC" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct inner3@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 26:10@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+data Inner3
+    = Inner3 {inner3_fieldX :: CInt
+              {- ^ __C declaration:__ @fieldX@
+
+                   __defined at:__ @types\/anonymous\/struct_in_union.h 27:9@
+
+                   __exported by:__ @types\/anonymous\/struct_in_union.h@
+              -},
+              inner3_fieldY :: CInt
+              {- ^ __C declaration:__ @fieldY@
+
+                   __defined at:__ @types\/anonymous\/struct_in_union.h 28:9@
+
+                   __exported by:__ @types\/anonymous\/struct_in_union.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Inner3
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Inner3
+    where readRaw = \ptr_0 -> (pure Inner3 <*> readRaw (Proxy @"inner3_fieldX") ptr_0) <*> readRaw (Proxy @"inner3_fieldY") ptr_0
+instance WriteRaw Inner3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Inner3 inner3_fieldX_2
+                                              inner3_fieldY_3 -> writeRaw (Proxy @"inner3_fieldX") ptr_0 inner3_fieldX_2 >> writeRaw (Proxy @"inner3_fieldY") ptr_0 inner3_fieldY_3
+deriving via (EquivStorable Inner3) instance Storable Inner3
+deriving via (IsStructViaReadRaw Inner3) instance IsStruct Inner3
+instance (~) ty CInt => HasField "inner3_fieldX" Inner3 ty
+    where hasField = \x_0 -> (\y_1 -> Inner3{inner3_fieldX = y_1,
+                                             inner3_fieldY = getField @"inner3_fieldY" x_0},
+                              getField @"inner3_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "inner3_fieldX" (Ptr Inner3) (Ptr ty)
+    where getField = fromPtr (Proxy @"inner3_fieldX")
+instance HasCField Inner3 "inner3_fieldX"
+    where type CFieldType Inner3 "inner3_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "inner3_fieldY" Inner3 ty
+    where hasField = \x_0 -> (\y_1 -> Inner3{inner3_fieldY = y_1,
+                                             inner3_fieldX = getField @"inner3_fieldX" x_0},
+                              getField @"inner3_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "inner3_fieldY" (Ptr Inner3) (Ptr ty)
+    where getField = fromPtr (Proxy @"inner3_fieldY")
+instance HasCField Inner3 "inner3_fieldY"
+    where type CFieldType Inner3 "inner3_fieldY" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @union outer3@
+
+    __defined at:__ @types\/anonymous\/struct_in_union.h 24:7@
+
+    __exported by:__ @types\/anonymous\/struct_in_union.h@
+-}
+newtype Outer3
+    = Outer3 {unwrapOuter3 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8 4) instance StaticSize Outer3
+deriving via (SizedByteArray 8 4) instance ReadRaw Outer3
+deriving via (SizedByteArray 8 4) instance WriteRaw Outer3
+deriving via (EquivStorable Outer3) instance Storable Outer3
+deriving via (SizedByteArray 8 4) instance IsUnion Outer3
+instance (~) ty CChar => HasField "outer3_fieldA" Outer3 ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "outer3_fieldA" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer3_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer3_fieldA" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldA")
+instance HasCField Outer3 "outer3_fieldA"
+    where type CFieldType Outer3 "outer3_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Inner3 => HasField "outer3_fieldB" Outer3 ty
+    where getField = getUnionPayload
+instance (~) ty Inner3 => HasField "outer3_fieldB" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer3_fieldB" x_0)
+instance (~) ty Inner3 =>
+         HasField "outer3_fieldB" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldB")
+instance HasCField Outer3 "outer3_fieldB"
+    where type CFieldType Outer3 "outer3_fieldB" = Inner3
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outer3_fieldC" Outer3 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "outer3_fieldC" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer3_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer3_fieldC" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldC")
+instance HasCField Outer3 "outer3_fieldC"
+    where type CFieldType Outer3 "outer3_fieldC" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/union/Example.hs b/test-artefacts/fixtures/types/anonymous/union/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/union/Example.hs
@@ -0,0 +1,871 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Has_implicit_fields_anon'x2_1(..)
+    , Example.Has_implicit_fields_anon'x4_1(..)
+    , Example.Has_implicit_fields_anon'x5_1(..)
+    , Example.Has_implicit_fields(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@has_implicit_fields_anon\'x2_1@
+
+    __defined at:__ @types\/anonymous\/union.h 5:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+data Has_implicit_fields_anon'x2_1 = Has_implicit_fields_anon'x2_1
+  { has_implicit_fields_anon'x2_1_x2_1 :: BG.CInt
+    {- ^ __C declaration:__ @x2_1@
+
+         __defined at:__ @types\/anonymous\/union.h 6:9@
+
+         __exported by:__ @types\/anonymous\/union.h@
+    -}
+  , has_implicit_fields_anon'x2_1_x2_2 :: BG.CInt
+    {- ^ __C declaration:__ @x2_2@
+
+         __defined at:__ @types\/anonymous\/union.h 7:9@
+
+         __exported by:__ @types\/anonymous\/union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Has_implicit_fields_anon'x2_1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Has_implicit_fields_anon'x2_1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Has_implicit_fields_anon'x2_1
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_2") ptr0
+
+instance Marshal.WriteRaw Has_implicit_fields_anon'x2_1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Has_implicit_fields_anon'x2_1
+            has_implicit_fields_anon'x2_1_x2_12
+            has_implicit_fields_anon'x2_1_x2_23 ->
+                 HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_1") ptr0 has_implicit_fields_anon'x2_1_x2_12
+              >> HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_2") ptr0 has_implicit_fields_anon'x2_1_x2_23
+
+deriving via Marshal.EquivStorable Has_implicit_fields_anon'x2_1 instance BG.Storable Has_implicit_fields_anon'x2_1
+
+deriving via Struct.IsStructViaReadRaw Has_implicit_fields_anon'x2_1 instance Struct.IsStruct Has_implicit_fields_anon'x2_1
+
+{-| __C declaration:__ @x2_1@
+
+    __defined at:__ @types\/anonymous\/union.h 6:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x2_1_x2_1" Has_implicit_fields_anon'x2_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields_anon'x2_1 { has_implicit_fields_anon'x2_1_x2_1 = y1
+                                        , has_implicit_fields_anon'x2_1_x2_2 = BG.getField @"has_implicit_fields_anon'x2_1_x2_2" x0
+                                        }
+      , BG.getField @"has_implicit_fields_anon'x2_1_x2_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x2_1_x2_1" (BG.Ptr Has_implicit_fields_anon'x2_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_1")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x2_1 "has_implicit_fields_anon'x2_1_x2_1" where
+
+  type CFieldType Has_implicit_fields_anon'x2_1 "has_implicit_fields_anon'x2_1_x2_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x2_2@
+
+    __defined at:__ @types\/anonymous\/union.h 7:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x2_1_x2_2" Has_implicit_fields_anon'x2_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields_anon'x2_1 { has_implicit_fields_anon'x2_1_x2_2 = y1
+                                        , has_implicit_fields_anon'x2_1_x2_1 = BG.getField @"has_implicit_fields_anon'x2_1_x2_1" x0
+                                        }
+      , BG.getField @"has_implicit_fields_anon'x2_1_x2_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x2_1_x2_2" (BG.Ptr Has_implicit_fields_anon'x2_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x2_1_x2_2")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x2_1 "has_implicit_fields_anon'x2_1_x2_2" where
+
+  type CFieldType Has_implicit_fields_anon'x2_1 "has_implicit_fields_anon'x2_1_x2_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@has_implicit_fields_anon\'x4_1@
+
+    __defined at:__ @types\/anonymous\/union.h 10:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+data Has_implicit_fields_anon'x4_1 = Has_implicit_fields_anon'x4_1
+  { has_implicit_fields_anon'x4_1_x4_1 :: BG.CInt
+    {- ^ __C declaration:__ @x4_1@
+
+         __defined at:__ @types\/anonymous\/union.h 11:9@
+
+         __exported by:__ @types\/anonymous\/union.h@
+    -}
+  , has_implicit_fields_anon'x4_1_x4_2 :: BG.CInt
+    {- ^ __C declaration:__ @x4_2@
+
+         __defined at:__ @types\/anonymous\/union.h 12:9@
+
+         __exported by:__ @types\/anonymous\/union.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Has_implicit_fields_anon'x4_1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Has_implicit_fields_anon'x4_1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Has_implicit_fields_anon'x4_1
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_2") ptr0
+
+instance Marshal.WriteRaw Has_implicit_fields_anon'x4_1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Has_implicit_fields_anon'x4_1
+            has_implicit_fields_anon'x4_1_x4_12
+            has_implicit_fields_anon'x4_1_x4_23 ->
+                 HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_1") ptr0 has_implicit_fields_anon'x4_1_x4_12
+              >> HasCField.writeRaw (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_2") ptr0 has_implicit_fields_anon'x4_1_x4_23
+
+deriving via Marshal.EquivStorable Has_implicit_fields_anon'x4_1 instance BG.Storable Has_implicit_fields_anon'x4_1
+
+deriving via Struct.IsStructViaReadRaw Has_implicit_fields_anon'x4_1 instance Struct.IsStruct Has_implicit_fields_anon'x4_1
+
+{-| __C declaration:__ @x4_1@
+
+    __defined at:__ @types\/anonymous\/union.h 11:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x4_1_x4_1" Has_implicit_fields_anon'x4_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields_anon'x4_1 { has_implicit_fields_anon'x4_1_x4_1 = y1
+                                        , has_implicit_fields_anon'x4_1_x4_2 = BG.getField @"has_implicit_fields_anon'x4_1_x4_2" x0
+                                        }
+      , BG.getField @"has_implicit_fields_anon'x4_1_x4_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x4_1_x4_1" (BG.Ptr Has_implicit_fields_anon'x4_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_1")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x4_1 "has_implicit_fields_anon'x4_1_x4_1" where
+
+  type CFieldType Has_implicit_fields_anon'x4_1 "has_implicit_fields_anon'x4_1_x4_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x4_2@
+
+    __defined at:__ @types\/anonymous\/union.h 12:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x4_1_x4_2" Has_implicit_fields_anon'x4_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Has_implicit_fields_anon'x4_1 { has_implicit_fields_anon'x4_1_x4_2 = y1
+                                        , has_implicit_fields_anon'x4_1_x4_1 = BG.getField @"has_implicit_fields_anon'x4_1_x4_1" x0
+                                        }
+      , BG.getField @"has_implicit_fields_anon'x4_1_x4_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x4_1_x4_2" (BG.Ptr Has_implicit_fields_anon'x4_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x4_1_x4_2")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x4_1 "has_implicit_fields_anon'x4_1_x4_2" where
+
+  type CFieldType Has_implicit_fields_anon'x4_1 "has_implicit_fields_anon'x4_1_x4_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union \@has_implicit_fields_anon\'x5_1@
+
+    __defined at:__ @types\/anonymous\/union.h 14:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+newtype Has_implicit_fields_anon'x5_1 = Has_implicit_fields_anon'x5_1
+  { unwrapHas_implicit_fields_anon'x5_1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Has_implicit_fields_anon'x5_1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Has_implicit_fields_anon'x5_1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Has_implicit_fields_anon'x5_1
+
+deriving via Marshal.EquivStorable Has_implicit_fields_anon'x5_1 instance BG.Storable Has_implicit_fields_anon'x5_1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Has_implicit_fields_anon'x5_1
+
+{-| __C declaration:__ @x5_1@
+
+    __defined at:__ @types\/anonymous\/union.h 15:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x5_1_x5_1" Has_implicit_fields_anon'x5_1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x5_1@
+
+    __defined at:__ @types\/anonymous\/union.h 15:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x5_1_x5_1" Has_implicit_fields_anon'x5_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"has_implicit_fields_anon'x5_1_x5_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x5_1_x5_1" (BG.Ptr Has_implicit_fields_anon'x5_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x5_1_x5_1")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x5_1 "has_implicit_fields_anon'x5_1_x5_1" where
+
+  type CFieldType Has_implicit_fields_anon'x5_1 "has_implicit_fields_anon'x5_1_x5_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x5_2@
+
+    __defined at:__ @types\/anonymous\/union.h 16:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x5_1_x5_2" Has_implicit_fields_anon'x5_1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x5_2@
+
+    __defined at:__ @types\/anonymous\/union.h 16:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x5_1_x5_2" Has_implicit_fields_anon'x5_1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"has_implicit_fields_anon'x5_1_x5_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_anon'x5_1_x5_2" (BG.Ptr Has_implicit_fields_anon'x5_1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x5_1_x5_2")
+
+instance HasCField.HasCField Has_implicit_fields_anon'x5_1 "has_implicit_fields_anon'x5_1_x5_2" where
+
+  type CFieldType Has_implicit_fields_anon'x5_1 "has_implicit_fields_anon'x5_1_x5_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union has_implicit_fields@
+
+    __defined at:__ @types\/anonymous\/union.h 3:7@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+newtype Has_implicit_fields = Has_implicit_fields
+  { unwrapHas_implicit_fields :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.StaticSize Has_implicit_fields
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.ReadRaw Has_implicit_fields
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.WriteRaw Has_implicit_fields
+
+deriving via Marshal.EquivStorable Has_implicit_fields instance BG.Storable Has_implicit_fields
+
+deriving via BG.SizedByteArray 8 4 instance Union.IsUnion Has_implicit_fields
+
+{-| __C declaration:__ @x1@
+
+    __defined at:__ @types\/anonymous\/union.h 4:7@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x1" Has_implicit_fields ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x1@
+
+    __defined at:__ @types\/anonymous\/union.h 4:7@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"has_implicit_fields_x1" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'x2_1@
+
+    __defined at:__ @types\/anonymous\/union.h 5:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ Has_implicit_fields_anon'x2_1
+         ) => BG.HasField "has_implicit_fields_anon'x2_1" Has_implicit_fields ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x2_1@
+
+    __defined at:__ @types\/anonymous\/union.h 5:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ Has_implicit_fields_anon'x2_1
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x2_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"has_implicit_fields_anon'x2_1" x0
+      )
+
+instance ( ty ~ Has_implicit_fields_anon'x2_1
+         ) => BG.HasField "has_implicit_fields_anon'x2_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x2_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_anon'x2_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_anon'x2_1" =
+    Has_implicit_fields_anon'x2_1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x2_1@
+
+    __defined at:__ @types\/anonymous\/union.h 6:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x2_1" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x2_1_x2_1" (BG.getField @"has_implicit_fields_anon'x2_1" x0)
+
+{-| __C declaration:__ @x2_1@
+
+    __defined at:__ @types\/anonymous\/union.h 6:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x2_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x2_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x2_1_x2_1" z2 y1)
+      , BG.getField @"has_implicit_fields_x2_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x2_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x2_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x2_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x2_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x2_2@
+
+    __defined at:__ @types\/anonymous\/union.h 7:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x2_2" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x2_1_x2_2" (BG.getField @"has_implicit_fields_anon'x2_1" x0)
+
+{-| __C declaration:__ @x2_2@
+
+    __defined at:__ @types\/anonymous\/union.h 7:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x2_2" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x2_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x2_1_x2_2" z2 y1)
+      , BG.getField @"has_implicit_fields_x2_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x2_2" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x2_2")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x2_2" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x2_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @x3@
+
+    __defined at:__ @types\/anonymous\/union.h 9:7@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x3" Has_implicit_fields ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x3@
+
+    __defined at:__ @types\/anonymous\/union.h 9:7@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x3" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"has_implicit_fields_x3" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x3" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x3")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x3" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x3" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'x4_1@
+
+    __defined at:__ @types\/anonymous\/union.h 10:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ Has_implicit_fields_anon'x4_1
+         ) => BG.HasField "has_implicit_fields_anon'x4_1" Has_implicit_fields ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x4_1@
+
+    __defined at:__ @types\/anonymous\/union.h 10:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ Has_implicit_fields_anon'x4_1
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x4_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"has_implicit_fields_anon'x4_1" x0
+      )
+
+instance ( ty ~ Has_implicit_fields_anon'x4_1
+         ) => BG.HasField "has_implicit_fields_anon'x4_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x4_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_anon'x4_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_anon'x4_1" =
+    Has_implicit_fields_anon'x4_1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x4_1@
+
+    __defined at:__ @types\/anonymous\/union.h 11:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x4_1" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x4_1_x4_1" (BG.getField @"has_implicit_fields_anon'x4_1" x0)
+
+{-| __C declaration:__ @x4_1@
+
+    __defined at:__ @types\/anonymous\/union.h 11:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x4_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x4_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x4_1_x4_1" z2 y1)
+      , BG.getField @"has_implicit_fields_x4_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x4_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x4_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x4_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x4_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x4_2@
+
+    __defined at:__ @types\/anonymous\/union.h 12:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x4_2" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x4_1_x4_2" (BG.getField @"has_implicit_fields_anon'x4_1" x0)
+
+{-| __C declaration:__ @x4_2@
+
+    __defined at:__ @types\/anonymous\/union.h 12:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x4_2" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x4_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x4_1_x4_2" z2 y1)
+      , BG.getField @"has_implicit_fields_x4_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x4_2" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x4_2")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x4_2" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x4_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @anon\'x5_1@
+
+    __defined at:__ @types\/anonymous\/union.h 14:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ Has_implicit_fields_anon'x5_1
+         ) => BG.HasField "has_implicit_fields_anon'x5_1" Has_implicit_fields ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'x5_1@
+
+    __defined at:__ @types\/anonymous\/union.h 14:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ Has_implicit_fields_anon'x5_1
+         ) => BG.CompatHasField.HasField "has_implicit_fields_anon'x5_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"has_implicit_fields_anon'x5_1" x0
+      )
+
+instance ( ty ~ Has_implicit_fields_anon'x5_1
+         ) => BG.HasField "has_implicit_fields_anon'x5_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_anon'x5_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_anon'x5_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_anon'x5_1" =
+    Has_implicit_fields_anon'x5_1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x5_1@
+
+    __defined at:__ @types\/anonymous\/union.h 15:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5_1" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x5_1_x5_1" (BG.getField @"has_implicit_fields_anon'x5_1" x0)
+
+{-| __C declaration:__ @x5_1@
+
+    __defined at:__ @types\/anonymous\/union.h 15:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x5_1" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x5_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x5_1_x5_1" z2 y1)
+      , BG.getField @"has_implicit_fields_x5_1" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5_1" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x5_1")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x5_1" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x5_1" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x5_2@
+
+    __defined at:__ @types\/anonymous\/union.h 16:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5_2" Has_implicit_fields ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"has_implicit_fields_anon'x5_1_x5_2" (BG.getField @"has_implicit_fields_anon'x5_1" x0)
+
+{-| __C declaration:__ @x5_2@
+
+    __defined at:__ @types\/anonymous\/union.h 16:9@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x5_2" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"has_implicit_fields_anon'x5_1" x0 (\z2 ->
+                                                                               BG.CompatHasField.setField @"has_implicit_fields_anon'x5_1_x5_2" z2 y1)
+      , BG.getField @"has_implicit_fields_x5_2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5_2" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x5_2")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x5_2" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x5_2" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @x5@
+
+    __defined at:__ @types\/anonymous\/union.h 18:7@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5" Has_implicit_fields ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @x5@
+
+    __defined at:__ @types\/anonymous\/union.h 18:7@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "has_implicit_fields_x5" Has_implicit_fields ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"has_implicit_fields_x5" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "has_implicit_fields_x5" (BG.Ptr Has_implicit_fields) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"has_implicit_fields_x5")
+
+instance HasCField.HasCField Has_implicit_fields "has_implicit_fields_x5" where
+
+  type CFieldType Has_implicit_fields "has_implicit_fields_x5" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/union/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/union/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/union/bindingspec.yaml
@@ -0,0 +1,92 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/union.h
+  cname: union has_implicit_fields
+  hsname: Has_implicit_fields
+- headers: types/anonymous/union.h
+  cname: struct @has_implicit_fields_anon'x2_1
+  hsname: Has_implicit_fields_anon'x2_1
+- headers: types/anonymous/union.h
+  cname: struct @has_implicit_fields_anon'x4_1
+  hsname: Has_implicit_fields_anon'x4_1
+- headers: types/anonymous/union.h
+  cname: union @has_implicit_fields_anon'x5_1
+  hsname: Has_implicit_fields_anon'x5_1
+hstypes:
+- hsname: Has_implicit_fields
+  representation:
+    newtype:
+      constructor: Has_implicit_fields
+      fields:
+      - unwrapHas_implicit_fields
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Has_implicit_fields_anon'x2_1
+  representation:
+    record:
+      constructor: Has_implicit_fields_anon'x2_1
+      fields:
+      - has_implicit_fields_anon'x2_1_x2_1
+      - has_implicit_fields_anon'x2_1_x2_2
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Has_implicit_fields_anon'x4_1
+  representation:
+    record:
+      constructor: Has_implicit_fields_anon'x4_1
+      fields:
+      - has_implicit_fields_anon'x4_1_x4_1
+      - has_implicit_fields_anon'x4_1_x4_2
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Has_implicit_fields_anon'x5_1
+  representation:
+    newtype:
+      constructor: Has_implicit_fields_anon'x5_1
+      fields:
+      - unwrapHas_implicit_fields_anon'x5_1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/union/th.txt b/test-artefacts/fixtures/types/anonymous/union/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/union/th.txt
@@ -0,0 +1,408 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/union.h
+{-| __C declaration:__ @struct \@has_implicit_fields_anon\'x2_1@
+
+    __defined at:__ @types\/anonymous\/union.h 5:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+data Has_implicit_fields_anon'x2_1
+    = Has_implicit_fields_anon'x2_1 {has_implicit_fields_anon'x2_1_x2_1 :: CInt
+                                     {- ^ __C declaration:__ @x2_1@
+
+                                          __defined at:__ @types\/anonymous\/union.h 6:9@
+
+                                          __exported by:__ @types\/anonymous\/union.h@
+                                     -},
+                                     has_implicit_fields_anon'x2_1_x2_2 :: CInt
+                                     {- ^ __C declaration:__ @x2_2@
+
+                                          __defined at:__ @types\/anonymous\/union.h 7:9@
+
+                                          __exported by:__ @types\/anonymous\/union.h@
+                                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Has_implicit_fields_anon'x2_1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Has_implicit_fields_anon'x2_1
+    where readRaw = \ptr_0 -> (pure Has_implicit_fields_anon'x2_1 <*> readRaw (Proxy @"has_implicit_fields_anon'x2_1_x2_1") ptr_0) <*> readRaw (Proxy @"has_implicit_fields_anon'x2_1_x2_2") ptr_0
+instance WriteRaw Has_implicit_fields_anon'x2_1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Has_implicit_fields_anon'x2_1 has_implicit_fields_anon'x2_1_x2_1_2
+                                                                     has_implicit_fields_anon'x2_1_x2_2_3 -> writeRaw (Proxy @"has_implicit_fields_anon'x2_1_x2_1") ptr_0 has_implicit_fields_anon'x2_1_x2_1_2 >> writeRaw (Proxy @"has_implicit_fields_anon'x2_1_x2_2") ptr_0 has_implicit_fields_anon'x2_1_x2_2_3
+deriving via (EquivStorable Has_implicit_fields_anon'x2_1) instance Storable Has_implicit_fields_anon'x2_1
+deriving via (IsStructViaReadRaw Has_implicit_fields_anon'x2_1) instance IsStruct Has_implicit_fields_anon'x2_1
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x2_1_x2_1"
+                  Has_implicit_fields_anon'x2_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields_anon'x2_1{has_implicit_fields_anon'x2_1_x2_1 = y_1,
+                                                                    has_implicit_fields_anon'x2_1_x2_2 = getField @"has_implicit_fields_anon'x2_1_x2_2" x_0},
+                              getField @"has_implicit_fields_anon'x2_1_x2_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x2_1_x2_1"
+                  (Ptr Has_implicit_fields_anon'x2_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x2_1_x2_1")
+instance HasCField Has_implicit_fields_anon'x2_1
+                   "has_implicit_fields_anon'x2_1_x2_1"
+    where type CFieldType Has_implicit_fields_anon'x2_1
+                          "has_implicit_fields_anon'x2_1_x2_1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x2_1_x2_2"
+                  Has_implicit_fields_anon'x2_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields_anon'x2_1{has_implicit_fields_anon'x2_1_x2_2 = y_1,
+                                                                    has_implicit_fields_anon'x2_1_x2_1 = getField @"has_implicit_fields_anon'x2_1_x2_1" x_0},
+                              getField @"has_implicit_fields_anon'x2_1_x2_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x2_1_x2_2"
+                  (Ptr Has_implicit_fields_anon'x2_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x2_1_x2_2")
+instance HasCField Has_implicit_fields_anon'x2_1
+                   "has_implicit_fields_anon'x2_1_x2_2"
+    where type CFieldType Has_implicit_fields_anon'x2_1
+                          "has_implicit_fields_anon'x2_1_x2_2" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@has_implicit_fields_anon\'x4_1@
+
+    __defined at:__ @types\/anonymous\/union.h 10:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+data Has_implicit_fields_anon'x4_1
+    = Has_implicit_fields_anon'x4_1 {has_implicit_fields_anon'x4_1_x4_1 :: CInt
+                                     {- ^ __C declaration:__ @x4_1@
+
+                                          __defined at:__ @types\/anonymous\/union.h 11:9@
+
+                                          __exported by:__ @types\/anonymous\/union.h@
+                                     -},
+                                     has_implicit_fields_anon'x4_1_x4_2 :: CInt
+                                     {- ^ __C declaration:__ @x4_2@
+
+                                          __defined at:__ @types\/anonymous\/union.h 12:9@
+
+                                          __exported by:__ @types\/anonymous\/union.h@
+                                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Has_implicit_fields_anon'x4_1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Has_implicit_fields_anon'x4_1
+    where readRaw = \ptr_0 -> (pure Has_implicit_fields_anon'x4_1 <*> readRaw (Proxy @"has_implicit_fields_anon'x4_1_x4_1") ptr_0) <*> readRaw (Proxy @"has_implicit_fields_anon'x4_1_x4_2") ptr_0
+instance WriteRaw Has_implicit_fields_anon'x4_1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Has_implicit_fields_anon'x4_1 has_implicit_fields_anon'x4_1_x4_1_2
+                                                                     has_implicit_fields_anon'x4_1_x4_2_3 -> writeRaw (Proxy @"has_implicit_fields_anon'x4_1_x4_1") ptr_0 has_implicit_fields_anon'x4_1_x4_1_2 >> writeRaw (Proxy @"has_implicit_fields_anon'x4_1_x4_2") ptr_0 has_implicit_fields_anon'x4_1_x4_2_3
+deriving via (EquivStorable Has_implicit_fields_anon'x4_1) instance Storable Has_implicit_fields_anon'x4_1
+deriving via (IsStructViaReadRaw Has_implicit_fields_anon'x4_1) instance IsStruct Has_implicit_fields_anon'x4_1
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x4_1_x4_1"
+                  Has_implicit_fields_anon'x4_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields_anon'x4_1{has_implicit_fields_anon'x4_1_x4_1 = y_1,
+                                                                    has_implicit_fields_anon'x4_1_x4_2 = getField @"has_implicit_fields_anon'x4_1_x4_2" x_0},
+                              getField @"has_implicit_fields_anon'x4_1_x4_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x4_1_x4_1"
+                  (Ptr Has_implicit_fields_anon'x4_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x4_1_x4_1")
+instance HasCField Has_implicit_fields_anon'x4_1
+                   "has_implicit_fields_anon'x4_1_x4_1"
+    where type CFieldType Has_implicit_fields_anon'x4_1
+                          "has_implicit_fields_anon'x4_1_x4_1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x4_1_x4_2"
+                  Has_implicit_fields_anon'x4_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> Has_implicit_fields_anon'x4_1{has_implicit_fields_anon'x4_1_x4_2 = y_1,
+                                                                    has_implicit_fields_anon'x4_1_x4_1 = getField @"has_implicit_fields_anon'x4_1_x4_1" x_0},
+                              getField @"has_implicit_fields_anon'x4_1_x4_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x4_1_x4_2"
+                  (Ptr Has_implicit_fields_anon'x4_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x4_1_x4_2")
+instance HasCField Has_implicit_fields_anon'x4_1
+                   "has_implicit_fields_anon'x4_1_x4_2"
+    where type CFieldType Has_implicit_fields_anon'x4_1
+                          "has_implicit_fields_anon'x4_1_x4_2" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @union \@has_implicit_fields_anon\'x5_1@
+
+    __defined at:__ @types\/anonymous\/union.h 14:3@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+newtype Has_implicit_fields_anon'x5_1
+    = Has_implicit_fields_anon'x5_1 {unwrapHas_implicit_fields_anon'x5_1 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize Has_implicit_fields_anon'x5_1
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw Has_implicit_fields_anon'x5_1
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw Has_implicit_fields_anon'x5_1
+deriving via (EquivStorable Has_implicit_fields_anon'x5_1) instance Storable Has_implicit_fields_anon'x5_1
+deriving via (SizedByteArray 4
+                             4) instance IsUnion Has_implicit_fields_anon'x5_1
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_1"
+                  Has_implicit_fields_anon'x5_1
+                  ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_1"
+                  Has_implicit_fields_anon'x5_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_anon'x5_1_x5_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_1"
+                  (Ptr Has_implicit_fields_anon'x5_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x5_1_x5_1")
+instance HasCField Has_implicit_fields_anon'x5_1
+                   "has_implicit_fields_anon'x5_1_x5_1"
+    where type CFieldType Has_implicit_fields_anon'x5_1
+                          "has_implicit_fields_anon'x5_1_x5_1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_2"
+                  Has_implicit_fields_anon'x5_1
+                  ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_2"
+                  Has_implicit_fields_anon'x5_1
+                  ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_anon'x5_1_x5_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_anon'x5_1_x5_2"
+                  (Ptr Has_implicit_fields_anon'x5_1)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x5_1_x5_2")
+instance HasCField Has_implicit_fields_anon'x5_1
+                   "has_implicit_fields_anon'x5_1_x5_2"
+    where type CFieldType Has_implicit_fields_anon'x5_1
+                          "has_implicit_fields_anon'x5_1_x5_2" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union has_implicit_fields@
+
+    __defined at:__ @types\/anonymous\/union.h 3:7@
+
+    __exported by:__ @types\/anonymous\/union.h@
+-}
+newtype Has_implicit_fields
+    = Has_implicit_fields {unwrapHas_implicit_fields :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8
+                             4) instance StaticSize Has_implicit_fields
+deriving via (SizedByteArray 8
+                             4) instance ReadRaw Has_implicit_fields
+deriving via (SizedByteArray 8
+                             4) instance WriteRaw Has_implicit_fields
+deriving via (EquivStorable Has_implicit_fields) instance Storable Has_implicit_fields
+deriving via (SizedByteArray 8
+                             4) instance IsUnion Has_implicit_fields
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x1" Has_implicit_fields ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_x1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x1")
+instance HasCField Has_implicit_fields "has_implicit_fields_x1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty Has_implicit_fields_anon'x2_1 =>
+         HasField "has_implicit_fields_anon'x2_1" Has_implicit_fields ty
+    where getField = getUnionPayload
+instance (~) ty Has_implicit_fields_anon'x2_1 =>
+         HasField "has_implicit_fields_anon'x2_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_anon'x2_1" x_0)
+instance (~) ty Has_implicit_fields_anon'x2_1 =>
+         HasField "has_implicit_fields_anon'x2_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x2_1")
+instance HasCField Has_implicit_fields
+                   "has_implicit_fields_anon'x2_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_anon'x2_1" = Has_implicit_fields_anon'x2_1
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_1" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x2_1_x2_1" (getField @"has_implicit_fields_anon'x2_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x2_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x2_1_x2_1" z_2 y_1),
+                              getField @"has_implicit_fields_x2_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x2_1")
+instance HasCField Has_implicit_fields "has_implicit_fields_x2_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x2_1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_2" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x2_1_x2_2" (getField @"has_implicit_fields_anon'x2_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_2" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x2_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x2_1_x2_2" z_2 y_1),
+                              getField @"has_implicit_fields_x2_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x2_2"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x2_2")
+instance HasCField Has_implicit_fields "has_implicit_fields_x2_2"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x2_2" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x3" Has_implicit_fields ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x3" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_x3" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x3"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x3")
+instance HasCField Has_implicit_fields "has_implicit_fields_x3"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x3" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty Has_implicit_fields_anon'x4_1 =>
+         HasField "has_implicit_fields_anon'x4_1" Has_implicit_fields ty
+    where getField = getUnionPayload
+instance (~) ty Has_implicit_fields_anon'x4_1 =>
+         HasField "has_implicit_fields_anon'x4_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_anon'x4_1" x_0)
+instance (~) ty Has_implicit_fields_anon'x4_1 =>
+         HasField "has_implicit_fields_anon'x4_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x4_1")
+instance HasCField Has_implicit_fields
+                   "has_implicit_fields_anon'x4_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_anon'x4_1" = Has_implicit_fields_anon'x4_1
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_1" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x4_1_x4_1" (getField @"has_implicit_fields_anon'x4_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x4_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x4_1_x4_1" z_2 y_1),
+                              getField @"has_implicit_fields_x4_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x4_1")
+instance HasCField Has_implicit_fields "has_implicit_fields_x4_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x4_1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_2" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x4_1_x4_2" (getField @"has_implicit_fields_anon'x4_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_2" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x4_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x4_1_x4_2" z_2 y_1),
+                              getField @"has_implicit_fields_x4_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x4_2"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x4_2")
+instance HasCField Has_implicit_fields "has_implicit_fields_x4_2"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x4_2" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty Has_implicit_fields_anon'x5_1 =>
+         HasField "has_implicit_fields_anon'x5_1" Has_implicit_fields ty
+    where getField = getUnionPayload
+instance (~) ty Has_implicit_fields_anon'x5_1 =>
+         HasField "has_implicit_fields_anon'x5_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_anon'x5_1" x_0)
+instance (~) ty Has_implicit_fields_anon'x5_1 =>
+         HasField "has_implicit_fields_anon'x5_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_anon'x5_1")
+instance HasCField Has_implicit_fields
+                   "has_implicit_fields_anon'x5_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_anon'x5_1" = Has_implicit_fields_anon'x5_1
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_1" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x5_1_x5_1" (getField @"has_implicit_fields_anon'x5_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_1" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x5_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x5_1_x5_1" z_2 y_1),
+                              getField @"has_implicit_fields_x5_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_1"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x5_1")
+instance HasCField Has_implicit_fields "has_implicit_fields_x5_1"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x5_1" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_2" Has_implicit_fields ty
+    where getField = \x_0 -> getField @"has_implicit_fields_anon'x5_1_x5_2" (getField @"has_implicit_fields_anon'x5_1" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_2" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"has_implicit_fields_anon'x5_1" x_0 (\z_2 -> setField @"has_implicit_fields_anon'x5_1_x5_2" z_2 y_1),
+                              getField @"has_implicit_fields_x5_2" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5_2"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x5_2")
+instance HasCField Has_implicit_fields "has_implicit_fields_x5_2"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x5_2" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5" Has_implicit_fields ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5" Has_implicit_fields ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"has_implicit_fields_x5" x_0)
+instance (~) ty CInt =>
+         HasField "has_implicit_fields_x5"
+                  (Ptr Has_implicit_fields)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"has_implicit_fields_x5")
+instance HasCField Has_implicit_fields "has_implicit_fields_x5"
+    where type CFieldType Has_implicit_fields
+                          "has_implicit_fields_x5" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/union_in_struct/Example.hs b/test-artefacts/fixtures/types/anonymous/union_in_struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/union_in_struct/Example.hs
@@ -0,0 +1,867 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Outer1_anon'fieldX(..)
+    , Example.Outer1(..)
+    , Example.Outer2_fieldB(..)
+    , Example.Outer2(..)
+    , Example.Inner3(..)
+    , Example.Outer3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Int, pure, type (~))
+
+{-| __C declaration:__ @union \@outer1_anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 8:3@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+newtype Outer1_anon'fieldX = Outer1_anon'fieldX
+  { unwrapOuter1_anon'fieldX :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Outer1_anon'fieldX
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Outer1_anon'fieldX
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Outer1_anon'fieldX
+
+deriving via Marshal.EquivStorable Outer1_anon'fieldX instance BG.Storable Outer1_anon'fieldX
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Outer1_anon'fieldX
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"outer1_anon'fieldX_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldX" (BG.Ptr Outer1_anon'fieldX) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX_fieldX")
+
+instance HasCField.HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldX" where
+
+  type CFieldType Outer1_anon'fieldX "outer1_anon'fieldX_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 10:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 10:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"outer1_anon'fieldX_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldY" (BG.Ptr Outer1_anon'fieldX) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX_fieldY")
+
+instance HasCField.HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldY" where
+
+  type CFieldType Outer1_anon'fieldX "outer1_anon'fieldX_fieldY" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct outer1@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 6:8@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+data Outer1 = Outer1
+  { outer1_fieldA :: BG.CChar
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @types\/anonymous\/union_in_struct.h 7:8@
+
+         __exported by:__ @types\/anonymous\/union_in_struct.h@
+    -}
+  , outer1_anon'fieldX :: Outer1_anon'fieldX
+    {- ^ __C declaration:__ @anon\'fieldX@
+
+         __defined at:__ @types\/anonymous\/union_in_struct.h 8:3@
+
+         __exported by:__ @types\/anonymous\/union_in_struct.h@
+    -}
+  , outer1_fieldC :: BG.CInt
+    {- ^ __C declaration:__ @fieldC@
+
+         __defined at:__ @types\/anonymous\/union_in_struct.h 12:7@
+
+         __exported by:__ @types\/anonymous\/union_in_struct.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize Outer1 where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer1
+      <*> HasCField.readRaw (BG.Proxy @"outer1_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer1_anon'fieldX") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer1_fieldC") ptr0
+
+instance Marshal.WriteRaw Outer1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer1 outer1_fieldA2 outer1_anon'fieldX3 outer1_fieldC4 ->
+               HasCField.writeRaw (BG.Proxy @"outer1_fieldA") ptr0 outer1_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"outer1_anon'fieldX") ptr0 outer1_anon'fieldX3
+            >> HasCField.writeRaw (BG.Proxy @"outer1_fieldC") ptr0 outer1_fieldC4
+
+deriving via Marshal.EquivStorable Outer1 instance BG.Storable Outer1
+
+deriving via Struct.IsStructViaReadRaw Outer1 instance Struct.IsStruct Outer1
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 7:8@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer1_fieldA" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1 { outer1_fieldA = y1
+                 , outer1_anon'fieldX = BG.getField @"outer1_anon'fieldX" x0
+                 , outer1_fieldC = BG.getField @"outer1_fieldC" x0
+                 }
+      , BG.getField @"outer1_fieldA" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer1_fieldA" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldA")
+
+instance HasCField.HasCField Outer1 "outer1_fieldA" where
+
+  type CFieldType Outer1 "outer1_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 8:3@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1 { outer1_anon'fieldX = y1
+                 , outer1_fieldA = BG.getField @"outer1_fieldA" x0
+                 , outer1_fieldC = BG.getField @"outer1_fieldC" x0
+                 }
+      , BG.getField @"outer1_anon'fieldX" x0
+      )
+
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.HasField "outer1_anon'fieldX" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX")
+
+instance HasCField.HasCField Outer1 "outer1_anon'fieldX" where
+
+  type CFieldType Outer1 "outer1_anon'fieldX" =
+    Outer1_anon'fieldX
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldX" Outer1 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"outer1_anon'fieldX_fieldX" (BG.getField @"outer1_anon'fieldX" x0)
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 9:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldX" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"outer1_anon'fieldX" x0 (\z2 ->
+                                                                    BG.CompatHasField.setField @"outer1_anon'fieldX_fieldX" z2 y1)
+      , BG.getField @"outer1_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldX" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldX")
+
+instance HasCField.HasCField Outer1 "outer1_fieldX" where
+
+  type CFieldType Outer1 "outer1_fieldX" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 10:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldY" Outer1 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"outer1_anon'fieldX_fieldY" (BG.getField @"outer1_anon'fieldX" x0)
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 10:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldY" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"outer1_anon'fieldX" x0 (\z2 ->
+                                                                    BG.CompatHasField.setField @"outer1_anon'fieldX_fieldY" z2 y1)
+      , BG.getField @"outer1_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldY" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldY")
+
+instance HasCField.HasCField Outer1 "outer1_fieldY" where
+
+  type CFieldType Outer1 "outer1_fieldY" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 12:7@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldC" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer1 { outer1_fieldC = y1
+                 , outer1_fieldA = BG.getField @"outer1_fieldA" x0
+                 , outer1_anon'fieldX = BG.getField @"outer1_anon'fieldX" x0
+                 }
+      , BG.getField @"outer1_fieldC" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldC" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldC")
+
+instance HasCField.HasCField Outer1 "outer1_fieldC" where
+
+  type CFieldType Outer1 "outer1_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @union \@outer2_fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 17:3@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+newtype Outer2_fieldB = Outer2_fieldB
+  { unwrapOuter2_fieldB :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Outer2_fieldB
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Outer2_fieldB
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Outer2_fieldB
+
+deriving via Marshal.EquivStorable Outer2_fieldB instance BG.Storable Outer2_fieldB
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Outer2_fieldB
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 18:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldX" Outer2_fieldB ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 18:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldB_fieldX" Outer2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldB_fieldX" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldX" (BG.Ptr Outer2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB_fieldX")
+
+instance HasCField.HasCField Outer2_fieldB "outer2_fieldB_fieldX" where
+
+  type CFieldType Outer2_fieldB "outer2_fieldB_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 19:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldY" Outer2_fieldB ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 19:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldB_fieldY" Outer2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldB_fieldY" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldY" (BG.Ptr Outer2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB_fieldY")
+
+instance HasCField.HasCField Outer2_fieldB "outer2_fieldB_fieldY" where
+
+  type CFieldType Outer2_fieldB "outer2_fieldB_fieldY" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct outer2@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 15:8@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+data Outer2 = Outer2
+  { outer2_fieldA :: BG.CChar
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @types\/anonymous\/union_in_struct.h 16:8@
+
+         __exported by:__ @types\/anonymous\/union_in_struct.h@
+    -}
+  , outer2_fieldB :: Outer2_fieldB
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @types\/anonymous\/union_in_struct.h 20:5@
+
+         __exported by:__ @types\/anonymous\/union_in_struct.h@
+    -}
+  , outer2_fieldC :: BG.CInt
+    {- ^ __C declaration:__ @fieldC@
+
+         __defined at:__ @types\/anonymous\/union_in_struct.h 21:7@
+
+         __exported by:__ @types\/anonymous\/union_in_struct.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize Outer2 where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer2 where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer2
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldB") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer2_fieldC") ptr0
+
+instance Marshal.WriteRaw Outer2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer2 outer2_fieldA2 outer2_fieldB3 outer2_fieldC4 ->
+               HasCField.writeRaw (BG.Proxy @"outer2_fieldA") ptr0 outer2_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"outer2_fieldB") ptr0 outer2_fieldB3
+            >> HasCField.writeRaw (BG.Proxy @"outer2_fieldC") ptr0 outer2_fieldC4
+
+deriving via Marshal.EquivStorable Outer2 instance BG.Storable Outer2
+
+deriving via Struct.IsStructViaReadRaw Outer2 instance Struct.IsStruct Outer2
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 16:8@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer2_fieldA" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2 { outer2_fieldA = y1
+                 , outer2_fieldB = BG.getField @"outer2_fieldB" x0
+                 , outer2_fieldC = BG.getField @"outer2_fieldC" x0
+                 }
+      , BG.getField @"outer2_fieldA" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer2_fieldA" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldA")
+
+instance HasCField.HasCField Outer2 "outer2_fieldA" where
+
+  type CFieldType Outer2 "outer2_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 20:5@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ Outer2_fieldB
+         ) => BG.CompatHasField.HasField "outer2_fieldB" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2 { outer2_fieldB = y1
+                 , outer2_fieldA = BG.getField @"outer2_fieldA" x0
+                 , outer2_fieldC = BG.getField @"outer2_fieldC" x0
+                 }
+      , BG.getField @"outer2_fieldB" x0
+      )
+
+instance ( ty ~ Outer2_fieldB
+         ) => BG.HasField "outer2_fieldB" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB")
+
+instance HasCField.HasCField Outer2 "outer2_fieldB" where
+
+  type CFieldType Outer2 "outer2_fieldB" =
+    Outer2_fieldB
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 21:7@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldC" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer2 { outer2_fieldC = y1
+                 , outer2_fieldA = BG.getField @"outer2_fieldA" x0
+                 , outer2_fieldB = BG.getField @"outer2_fieldB" x0
+                 }
+      , BG.getField @"outer2_fieldC" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldC" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldC")
+
+instance HasCField.HasCField Outer2 "outer2_fieldC" where
+
+  type CFieldType Outer2 "outer2_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @union inner3@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 26:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+newtype Inner3 = Inner3
+  { unwrapInner3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Inner3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Inner3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Inner3
+
+deriving via Marshal.EquivStorable Inner3 instance BG.Storable Inner3
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Inner3
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 27:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "inner3_fieldX" Inner3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 27:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inner3_fieldX" Inner3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"inner3_fieldX" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inner3_fieldX" (BG.Ptr Inner3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inner3_fieldX")
+
+instance HasCField.HasCField Inner3 "inner3_fieldX" where
+
+  type CFieldType Inner3 "inner3_fieldX" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 28:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "inner3_fieldY" Inner3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 28:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inner3_fieldY" Inner3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"inner3_fieldY" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inner3_fieldY" (BG.Ptr Inner3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inner3_fieldY")
+
+instance HasCField.HasCField Inner3 "inner3_fieldY" where
+
+  type CFieldType Inner3 "inner3_fieldY" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct outer3@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 24:8@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+data Outer3 = Outer3
+  { outer3_fieldA :: BG.CChar
+    {- ^ __C declaration:__ @fieldA@
+
+         __defined at:__ @types\/anonymous\/union_in_struct.h 25:8@
+
+         __exported by:__ @types\/anonymous\/union_in_struct.h@
+    -}
+  , outer3_fieldB :: Inner3
+    {- ^ __C declaration:__ @fieldB@
+
+         __defined at:__ @types\/anonymous\/union_in_struct.h 29:5@
+
+         __exported by:__ @types\/anonymous\/union_in_struct.h@
+    -}
+  , outer3_fieldC :: BG.CInt
+    {- ^ __C declaration:__ @fieldC@
+
+         __defined at:__ @types\/anonymous\/union_in_struct.h 30:7@
+
+         __exported by:__ @types\/anonymous\/union_in_struct.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize Outer3 where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Outer3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Outer3
+      <*> HasCField.readRaw (BG.Proxy @"outer3_fieldA") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer3_fieldB") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"outer3_fieldC") ptr0
+
+instance Marshal.WriteRaw Outer3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Outer3 outer3_fieldA2 outer3_fieldB3 outer3_fieldC4 ->
+               HasCField.writeRaw (BG.Proxy @"outer3_fieldA") ptr0 outer3_fieldA2
+            >> HasCField.writeRaw (BG.Proxy @"outer3_fieldB") ptr0 outer3_fieldB3
+            >> HasCField.writeRaw (BG.Proxy @"outer3_fieldC") ptr0 outer3_fieldC4
+
+deriving via Marshal.EquivStorable Outer3 instance BG.Storable Outer3
+
+deriving via Struct.IsStructViaReadRaw Outer3 instance Struct.IsStruct Outer3
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 25:8@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer3_fieldA" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer3 { outer3_fieldA = y1
+                 , outer3_fieldB = BG.getField @"outer3_fieldB" x0
+                 , outer3_fieldC = BG.getField @"outer3_fieldC" x0
+                 }
+      , BG.getField @"outer3_fieldA" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer3_fieldA" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldA")
+
+instance HasCField.HasCField Outer3 "outer3_fieldA" where
+
+  type CFieldType Outer3 "outer3_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 29:5@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ Inner3
+         ) => BG.CompatHasField.HasField "outer3_fieldB" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer3 { outer3_fieldB = y1
+                 , outer3_fieldA = BG.getField @"outer3_fieldA" x0
+                 , outer3_fieldC = BG.getField @"outer3_fieldC" x0
+                 }
+      , BG.getField @"outer3_fieldB" x0
+      )
+
+instance ( ty ~ Inner3
+         ) => BG.HasField "outer3_fieldB" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldB")
+
+instance HasCField.HasCField Outer3 "outer3_fieldB" where
+
+  type CFieldType Outer3 "outer3_fieldB" = Inner3
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 30:7@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer3_fieldC" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Outer3 { outer3_fieldC = y1
+                 , outer3_fieldA = BG.getField @"outer3_fieldA" x0
+                 , outer3_fieldB = BG.getField @"outer3_fieldB" x0
+                 }
+      , BG.getField @"outer3_fieldC" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer3_fieldC" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldC")
+
+instance HasCField.HasCField Outer3 "outer3_fieldC" where
+
+  type CFieldType Outer3 "outer3_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/anonymous/union_in_struct/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/union_in_struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/union_in_struct/bindingspec.yaml
@@ -0,0 +1,132 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/union_in_struct.h
+  cname: struct outer1
+  hsname: Outer1
+- headers: types/anonymous/union_in_struct.h
+  cname: union @outer1_anon'fieldX
+  hsname: Outer1_anon'fieldX
+- headers: types/anonymous/union_in_struct.h
+  cname: struct outer2
+  hsname: Outer2
+- headers: types/anonymous/union_in_struct.h
+  cname: union @outer2_fieldB
+  hsname: Outer2_fieldB
+- headers: types/anonymous/union_in_struct.h
+  cname: struct outer3
+  hsname: Outer3
+- headers: types/anonymous/union_in_struct.h
+  cname: union inner3
+  hsname: Inner3
+hstypes:
+- hsname: Inner3
+  representation:
+    newtype:
+      constructor: Inner3
+      fields:
+      - unwrapInner3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer1
+  representation:
+    record:
+      constructor: Outer1
+      fields:
+      - outer1_fieldA
+      - outer1_anon'fieldX
+      - outer1_fieldC
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer1_anon'fieldX
+  representation:
+    newtype:
+      constructor: Outer1_anon'fieldX
+      fields:
+      - unwrapOuter1_anon'fieldX
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer2
+  representation:
+    record:
+      constructor: Outer2
+      fields:
+      - outer2_fieldA
+      - outer2_fieldB
+      - outer2_fieldC
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer2_fieldB
+  representation:
+    newtype:
+      constructor: Outer2_fieldB
+      fields:
+      - unwrapOuter2_fieldB
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer3
+  representation:
+    record:
+      constructor: Outer3
+      fields:
+      - outer3_fieldA
+      - outer3_fieldB
+      - outer3_fieldC
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/union_in_struct/th.txt b/test-artefacts/fixtures/types/anonymous/union_in_struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/union_in_struct/th.txt
@@ -0,0 +1,373 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/union_in_struct.h
+{-| __C declaration:__ @union \@outer1_anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 8:3@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+newtype Outer1_anon'fieldX
+    = Outer1_anon'fieldX {unwrapOuter1_anon'fieldX :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize Outer1_anon'fieldX
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw Outer1_anon'fieldX
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw Outer1_anon'fieldX
+deriving via (EquivStorable Outer1_anon'fieldX) instance Storable Outer1_anon'fieldX
+deriving via (SizedByteArray 4
+                             4) instance IsUnion Outer1_anon'fieldX
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_anon'fieldX_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX"
+                  (Ptr Outer1_anon'fieldX)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX_fieldX")
+instance HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldX"
+    where type CFieldType Outer1_anon'fieldX
+                          "outer1_anon'fieldX_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_anon'fieldX_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY"
+                  (Ptr Outer1_anon'fieldX)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX_fieldY")
+instance HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldY"
+    where type CFieldType Outer1_anon'fieldX
+                          "outer1_anon'fieldX_fieldY" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct outer1@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 6:8@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+data Outer1
+    = Outer1 {outer1_fieldA :: CChar
+              {- ^ __C declaration:__ @fieldA@
+
+                   __defined at:__ @types\/anonymous\/union_in_struct.h 7:8@
+
+                   __exported by:__ @types\/anonymous\/union_in_struct.h@
+              -},
+              outer1_anon'fieldX :: Outer1_anon'fieldX
+              {- ^ __C declaration:__ @anon\'fieldX@
+
+                   __defined at:__ @types\/anonymous\/union_in_struct.h 8:3@
+
+                   __exported by:__ @types\/anonymous\/union_in_struct.h@
+              -},
+              outer1_fieldC :: CInt
+              {- ^ __C declaration:__ @fieldC@
+
+                   __defined at:__ @types\/anonymous\/union_in_struct.h 12:7@
+
+                   __exported by:__ @types\/anonymous\/union_in_struct.h@
+              -}}
+    deriving stock Generic
+instance StaticSize Outer1
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer1
+    where readRaw = \ptr_0 -> ((pure Outer1 <*> readRaw (Proxy @"outer1_fieldA") ptr_0) <*> readRaw (Proxy @"outer1_anon'fieldX") ptr_0) <*> readRaw (Proxy @"outer1_fieldC") ptr_0
+instance WriteRaw Outer1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer1 outer1_fieldA_2
+                                              outer1_anon'fieldX_3
+                                              outer1_fieldC_4 -> writeRaw (Proxy @"outer1_fieldA") ptr_0 outer1_fieldA_2 >> (writeRaw (Proxy @"outer1_anon'fieldX") ptr_0 outer1_anon'fieldX_3 >> writeRaw (Proxy @"outer1_fieldC") ptr_0 outer1_fieldC_4)
+deriving via (EquivStorable Outer1) instance Storable Outer1
+deriving via (IsStructViaReadRaw Outer1) instance IsStruct Outer1
+instance (~) ty CChar => HasField "outer1_fieldA" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> Outer1{outer1_fieldA = y_1,
+                                             outer1_anon'fieldX = getField @"outer1_anon'fieldX" x_0,
+                                             outer1_fieldC = getField @"outer1_fieldC" x_0},
+                              getField @"outer1_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer1_fieldA" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldA")
+instance HasCField Outer1 "outer1_fieldA"
+    where type CFieldType Outer1 "outer1_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> Outer1{outer1_anon'fieldX = y_1,
+                                             outer1_fieldA = getField @"outer1_fieldA" x_0,
+                                             outer1_fieldC = getField @"outer1_fieldC" x_0},
+                              getField @"outer1_anon'fieldX" x_0)
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX")
+instance HasCField Outer1 "outer1_anon'fieldX"
+    where type CFieldType Outer1
+                          "outer1_anon'fieldX" = Outer1_anon'fieldX
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer1_fieldX" Outer1 ty
+    where getField = \x_0 -> getField @"outer1_anon'fieldX_fieldX" (getField @"outer1_anon'fieldX" x_0)
+instance (~) ty CInt => HasField "outer1_fieldX" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"outer1_anon'fieldX" x_0 (\z_2 -> setField @"outer1_anon'fieldX_fieldX" z_2 y_1),
+                              getField @"outer1_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldX" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldX")
+instance HasCField Outer1 "outer1_fieldX"
+    where type CFieldType Outer1 "outer1_fieldX" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer1_fieldY" Outer1 ty
+    where getField = \x_0 -> getField @"outer1_anon'fieldX_fieldY" (getField @"outer1_anon'fieldX" x_0)
+instance (~) ty CInt => HasField "outer1_fieldY" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"outer1_anon'fieldX" x_0 (\z_2 -> setField @"outer1_anon'fieldX_fieldY" z_2 y_1),
+                              getField @"outer1_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldY" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldY")
+instance HasCField Outer1 "outer1_fieldY"
+    where type CFieldType Outer1 "outer1_fieldY" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer1_fieldC" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> Outer1{outer1_fieldC = y_1,
+                                             outer1_fieldA = getField @"outer1_fieldA" x_0,
+                                             outer1_anon'fieldX = getField @"outer1_anon'fieldX" x_0},
+                              getField @"outer1_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldC" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldC")
+instance HasCField Outer1 "outer1_fieldC"
+    where type CFieldType Outer1 "outer1_fieldC" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @union \@outer2_fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 17:3@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+newtype Outer2_fieldB
+    = Outer2_fieldB {unwrapOuter2_fieldB :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Outer2_fieldB
+deriving via (SizedByteArray 4 4) instance ReadRaw Outer2_fieldB
+deriving via (SizedByteArray 4 4) instance WriteRaw Outer2_fieldB
+deriving via (EquivStorable Outer2_fieldB) instance Storable Outer2_fieldB
+deriving via (SizedByteArray 4 4) instance IsUnion Outer2_fieldB
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" Outer2_fieldB ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" Outer2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldB_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" (Ptr Outer2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB_fieldX")
+instance HasCField Outer2_fieldB "outer2_fieldB_fieldX"
+    where type CFieldType Outer2_fieldB "outer2_fieldB_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" Outer2_fieldB ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" Outer2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldB_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" (Ptr Outer2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB_fieldY")
+instance HasCField Outer2_fieldB "outer2_fieldB_fieldY"
+    where type CFieldType Outer2_fieldB "outer2_fieldB_fieldY" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct outer2@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 15:8@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+data Outer2
+    = Outer2 {outer2_fieldA :: CChar
+              {- ^ __C declaration:__ @fieldA@
+
+                   __defined at:__ @types\/anonymous\/union_in_struct.h 16:8@
+
+                   __exported by:__ @types\/anonymous\/union_in_struct.h@
+              -},
+              outer2_fieldB :: Outer2_fieldB
+              {- ^ __C declaration:__ @fieldB@
+
+                   __defined at:__ @types\/anonymous\/union_in_struct.h 20:5@
+
+                   __exported by:__ @types\/anonymous\/union_in_struct.h@
+              -},
+              outer2_fieldC :: CInt
+              {- ^ __C declaration:__ @fieldC@
+
+                   __defined at:__ @types\/anonymous\/union_in_struct.h 21:7@
+
+                   __exported by:__ @types\/anonymous\/union_in_struct.h@
+              -}}
+    deriving stock Generic
+instance StaticSize Outer2
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer2
+    where readRaw = \ptr_0 -> ((pure Outer2 <*> readRaw (Proxy @"outer2_fieldA") ptr_0) <*> readRaw (Proxy @"outer2_fieldB") ptr_0) <*> readRaw (Proxy @"outer2_fieldC") ptr_0
+instance WriteRaw Outer2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer2 outer2_fieldA_2
+                                              outer2_fieldB_3
+                                              outer2_fieldC_4 -> writeRaw (Proxy @"outer2_fieldA") ptr_0 outer2_fieldA_2 >> (writeRaw (Proxy @"outer2_fieldB") ptr_0 outer2_fieldB_3 >> writeRaw (Proxy @"outer2_fieldC") ptr_0 outer2_fieldC_4)
+deriving via (EquivStorable Outer2) instance Storable Outer2
+deriving via (IsStructViaReadRaw Outer2) instance IsStruct Outer2
+instance (~) ty CChar => HasField "outer2_fieldA" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> Outer2{outer2_fieldA = y_1,
+                                             outer2_fieldB = getField @"outer2_fieldB" x_0,
+                                             outer2_fieldC = getField @"outer2_fieldC" x_0},
+                              getField @"outer2_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer2_fieldA" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldA")
+instance HasCField Outer2 "outer2_fieldA"
+    where type CFieldType Outer2 "outer2_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Outer2_fieldB => HasField "outer2_fieldB" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> Outer2{outer2_fieldB = y_1,
+                                             outer2_fieldA = getField @"outer2_fieldA" x_0,
+                                             outer2_fieldC = getField @"outer2_fieldC" x_0},
+                              getField @"outer2_fieldB" x_0)
+instance (~) ty Outer2_fieldB =>
+         HasField "outer2_fieldB" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB")
+instance HasCField Outer2 "outer2_fieldB"
+    where type CFieldType Outer2 "outer2_fieldB" = Outer2_fieldB
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer2_fieldC" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> Outer2{outer2_fieldC = y_1,
+                                             outer2_fieldA = getField @"outer2_fieldA" x_0,
+                                             outer2_fieldB = getField @"outer2_fieldB" x_0},
+                              getField @"outer2_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldC" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldC")
+instance HasCField Outer2 "outer2_fieldC"
+    where type CFieldType Outer2 "outer2_fieldC" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @union inner3@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 26:9@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+newtype Inner3
+    = Inner3 {unwrapInner3 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Inner3
+deriving via (SizedByteArray 4 4) instance ReadRaw Inner3
+deriving via (SizedByteArray 4 4) instance WriteRaw Inner3
+deriving via (EquivStorable Inner3) instance Storable Inner3
+deriving via (SizedByteArray 4 4) instance IsUnion Inner3
+instance (~) ty CInt => HasField "inner3_fieldX" Inner3 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "inner3_fieldX" Inner3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"inner3_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "inner3_fieldX" (Ptr Inner3) (Ptr ty)
+    where getField = fromPtr (Proxy @"inner3_fieldX")
+instance HasCField Inner3 "inner3_fieldX"
+    where type CFieldType Inner3 "inner3_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "inner3_fieldY" Inner3 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "inner3_fieldY" Inner3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"inner3_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "inner3_fieldY" (Ptr Inner3) (Ptr ty)
+    where getField = fromPtr (Proxy @"inner3_fieldY")
+instance HasCField Inner3 "inner3_fieldY"
+    where type CFieldType Inner3 "inner3_fieldY" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct outer3@
+
+    __defined at:__ @types\/anonymous\/union_in_struct.h 24:8@
+
+    __exported by:__ @types\/anonymous\/union_in_struct.h@
+-}
+data Outer3
+    = Outer3 {outer3_fieldA :: CChar
+              {- ^ __C declaration:__ @fieldA@
+
+                   __defined at:__ @types\/anonymous\/union_in_struct.h 25:8@
+
+                   __exported by:__ @types\/anonymous\/union_in_struct.h@
+              -},
+              outer3_fieldB :: Inner3
+              {- ^ __C declaration:__ @fieldB@
+
+                   __defined at:__ @types\/anonymous\/union_in_struct.h 29:5@
+
+                   __exported by:__ @types\/anonymous\/union_in_struct.h@
+              -},
+              outer3_fieldC :: CInt
+              {- ^ __C declaration:__ @fieldC@
+
+                   __defined at:__ @types\/anonymous\/union_in_struct.h 30:7@
+
+                   __exported by:__ @types\/anonymous\/union_in_struct.h@
+              -}}
+    deriving stock Generic
+instance StaticSize Outer3
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Outer3
+    where readRaw = \ptr_0 -> ((pure Outer3 <*> readRaw (Proxy @"outer3_fieldA") ptr_0) <*> readRaw (Proxy @"outer3_fieldB") ptr_0) <*> readRaw (Proxy @"outer3_fieldC") ptr_0
+instance WriteRaw Outer3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Outer3 outer3_fieldA_2
+                                              outer3_fieldB_3
+                                              outer3_fieldC_4 -> writeRaw (Proxy @"outer3_fieldA") ptr_0 outer3_fieldA_2 >> (writeRaw (Proxy @"outer3_fieldB") ptr_0 outer3_fieldB_3 >> writeRaw (Proxy @"outer3_fieldC") ptr_0 outer3_fieldC_4)
+deriving via (EquivStorable Outer3) instance Storable Outer3
+deriving via (IsStructViaReadRaw Outer3) instance IsStruct Outer3
+instance (~) ty CChar => HasField "outer3_fieldA" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> Outer3{outer3_fieldA = y_1,
+                                             outer3_fieldB = getField @"outer3_fieldB" x_0,
+                                             outer3_fieldC = getField @"outer3_fieldC" x_0},
+                              getField @"outer3_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer3_fieldA" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldA")
+instance HasCField Outer3 "outer3_fieldA"
+    where type CFieldType Outer3 "outer3_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Inner3 => HasField "outer3_fieldB" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> Outer3{outer3_fieldB = y_1,
+                                             outer3_fieldA = getField @"outer3_fieldA" x_0,
+                                             outer3_fieldC = getField @"outer3_fieldC" x_0},
+                              getField @"outer3_fieldB" x_0)
+instance (~) ty Inner3 =>
+         HasField "outer3_fieldB" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldB")
+instance HasCField Outer3 "outer3_fieldB"
+    where type CFieldType Outer3 "outer3_fieldB" = Inner3
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "outer3_fieldC" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> Outer3{outer3_fieldC = y_1,
+                                             outer3_fieldA = getField @"outer3_fieldA" x_0,
+                                             outer3_fieldB = getField @"outer3_fieldB" x_0},
+                              getField @"outer3_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer3_fieldC" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldC")
+instance HasCField Outer3 "outer3_fieldC"
+    where type CFieldType Outer3 "outer3_fieldC" = CInt
+          offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/anonymous/union_in_union/Example.hs b/test-artefacts/fixtures/types/anonymous/union_in_union/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/union_in_union/Example.hs
@@ -0,0 +1,792 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Outer1_anon'fieldX(..)
+    , Example.Outer1(..)
+    , Example.Outer2_fieldB(..)
+    , Example.Outer2(..)
+    , Example.Inner3(..)
+    , Example.Outer3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (type (~))
+
+{-| __C declaration:__ @union \@outer1_anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 8:3@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer1_anon'fieldX = Outer1_anon'fieldX
+  { unwrapOuter1_anon'fieldX :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Outer1_anon'fieldX
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Outer1_anon'fieldX
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Outer1_anon'fieldX
+
+deriving via Marshal.EquivStorable Outer1_anon'fieldX instance BG.Storable Outer1_anon'fieldX
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Outer1_anon'fieldX
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 9:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 9:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"outer1_anon'fieldX_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldX" (BG.Ptr Outer1_anon'fieldX) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX_fieldX")
+
+instance HasCField.HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldX" where
+
+  type CFieldType Outer1_anon'fieldX "outer1_anon'fieldX_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 10:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 10:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> BG.setUnionPayload y1 x0
+      , BG.getField @"outer1_anon'fieldX_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_anon'fieldX_fieldY" (BG.Ptr Outer1_anon'fieldX) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX_fieldY")
+
+instance HasCField.HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldY" where
+
+  type CFieldType Outer1_anon'fieldX "outer1_anon'fieldX_fieldY" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union outer1@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 6:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer1 = Outer1
+  { unwrapOuter1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Outer1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Outer1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Outer1
+
+deriving via Marshal.EquivStorable Outer1 instance BG.Storable Outer1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Outer1
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 7:8@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "outer1_fieldA" Outer1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 7:8@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer1_fieldA" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer1_fieldA" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer1_fieldA" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldA")
+
+instance HasCField.HasCField Outer1 "outer1_fieldA" where
+
+  type CFieldType Outer1 "outer1_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 8:3@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.HasField "outer1_anon'fieldX" Outer1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 8:3@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.CompatHasField.HasField "outer1_anon'fieldX" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer1_anon'fieldX" x0)
+
+instance ( ty ~ Outer1_anon'fieldX
+         ) => BG.HasField "outer1_anon'fieldX" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_anon'fieldX")
+
+instance HasCField.HasCField Outer1 "outer1_anon'fieldX" where
+
+  type CFieldType Outer1 "outer1_anon'fieldX" =
+    Outer1_anon'fieldX
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 9:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldX" Outer1 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"outer1_anon'fieldX_fieldX" (BG.getField @"outer1_anon'fieldX" x0)
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 9:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldX" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"outer1_anon'fieldX" x0 (\z2 ->
+                                                                    BG.CompatHasField.setField @"outer1_anon'fieldX_fieldX" z2 y1)
+      , BG.getField @"outer1_fieldX" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldX" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldX")
+
+instance HasCField.HasCField Outer1 "outer1_fieldX" where
+
+  type CFieldType Outer1 "outer1_fieldX" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 10:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldY" Outer1 ty where
+
+  getField =
+    \x0 ->
+      BG.getField @"outer1_anon'fieldX_fieldY" (BG.getField @"outer1_anon'fieldX" x0)
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 10:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldY" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          BG.CompatHasField.modifyField @"outer1_anon'fieldX" x0 (\z2 ->
+                                                                    BG.CompatHasField.setField @"outer1_anon'fieldX_fieldY" z2 y1)
+      , BG.getField @"outer1_fieldY" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldY" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldY")
+
+instance HasCField.HasCField Outer1 "outer1_fieldY" where
+
+  type CFieldType Outer1 "outer1_fieldY" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 12:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer1_fieldC" Outer1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 12:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer1_fieldC" Outer1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer1_fieldC" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer1_fieldC" (BG.Ptr Outer1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer1_fieldC")
+
+instance HasCField.HasCField Outer1 "outer1_fieldC" where
+
+  type CFieldType Outer1 "outer1_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@outer2_fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 17:3@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer2_fieldB = Outer2_fieldB
+  { unwrapOuter2_fieldB :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Outer2_fieldB
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Outer2_fieldB
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Outer2_fieldB
+
+deriving via Marshal.EquivStorable Outer2_fieldB instance BG.Storable Outer2_fieldB
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Outer2_fieldB
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 18:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldX" Outer2_fieldB ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 18:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldB_fieldX" Outer2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldB_fieldX" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldX" (BG.Ptr Outer2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB_fieldX")
+
+instance HasCField.HasCField Outer2_fieldB "outer2_fieldB_fieldX" where
+
+  type CFieldType Outer2_fieldB "outer2_fieldB_fieldX" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 19:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldY" Outer2_fieldB ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 19:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldB_fieldY" Outer2_fieldB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldB_fieldY" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldB_fieldY" (BG.Ptr Outer2_fieldB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB_fieldY")
+
+instance HasCField.HasCField Outer2_fieldB "outer2_fieldB_fieldY" where
+
+  type CFieldType Outer2_fieldB "outer2_fieldB_fieldY" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union outer2@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 15:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer2 = Outer2
+  { unwrapOuter2 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Outer2
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Outer2
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Outer2
+
+deriving via Marshal.EquivStorable Outer2 instance BG.Storable Outer2
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Outer2
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 16:8@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "outer2_fieldA" Outer2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 16:8@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer2_fieldA" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldA" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer2_fieldA" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldA")
+
+instance HasCField.HasCField Outer2 "outer2_fieldA" where
+
+  type CFieldType Outer2 "outer2_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 20:5@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ Outer2_fieldB) => BG.HasField "outer2_fieldB" Outer2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 20:5@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ Outer2_fieldB
+         ) => BG.CompatHasField.HasField "outer2_fieldB" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldB" x0)
+
+instance ( ty ~ Outer2_fieldB
+         ) => BG.HasField "outer2_fieldB" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldB")
+
+instance HasCField.HasCField Outer2 "outer2_fieldB" where
+
+  type CFieldType Outer2 "outer2_fieldB" =
+    Outer2_fieldB
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 21:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer2_fieldC" Outer2 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 21:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer2_fieldC" Outer2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer2_fieldC" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer2_fieldC" (BG.Ptr Outer2) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer2_fieldC")
+
+instance HasCField.HasCField Outer2 "outer2_fieldC" where
+
+  type CFieldType Outer2 "outer2_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union inner3@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 26:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Inner3 = Inner3
+  { unwrapInner3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Inner3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Inner3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Inner3
+
+deriving via Marshal.EquivStorable Inner3 instance BG.Storable Inner3
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Inner3
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 27:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "inner3_fieldX" Inner3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 27:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inner3_fieldX" Inner3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"inner3_fieldX" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inner3_fieldX" (BG.Ptr Inner3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inner3_fieldX")
+
+instance HasCField.HasCField Inner3 "inner3_fieldX" where
+
+  type CFieldType Inner3 "inner3_fieldX" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 28:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "inner3_fieldY" Inner3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldY@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 28:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "inner3_fieldY" Inner3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"inner3_fieldY" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "inner3_fieldY" (BG.Ptr Inner3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"inner3_fieldY")
+
+instance HasCField.HasCField Inner3 "inner3_fieldY" where
+
+  type CFieldType Inner3 "inner3_fieldY" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union outer3@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 24:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer3 = Outer3
+  { unwrapOuter3 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Outer3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Outer3
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Outer3
+
+deriving via Marshal.EquivStorable Outer3 instance BG.Storable Outer3
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Outer3
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 25:8@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "outer3_fieldA" Outer3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldA@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 25:8@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "outer3_fieldA" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer3_fieldA" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "outer3_fieldA" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldA")
+
+instance HasCField.HasCField Outer3 "outer3_fieldA" where
+
+  type CFieldType Outer3 "outer3_fieldA" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 29:5@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ Inner3) => BG.HasField "outer3_fieldB" Outer3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 29:5@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ Inner3
+         ) => BG.CompatHasField.HasField "outer3_fieldB" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer3_fieldB" x0)
+
+instance ( ty ~ Inner3
+         ) => BG.HasField "outer3_fieldB" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldB")
+
+instance HasCField.HasCField Outer3 "outer3_fieldB" where
+
+  type CFieldType Outer3 "outer3_fieldB" = Inner3
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 30:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "outer3_fieldC" Outer3 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @fieldC@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 30:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "outer3_fieldC" Outer3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"outer3_fieldC" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "outer3_fieldC" (BG.Ptr Outer3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"outer3_fieldC")
+
+instance HasCField.HasCField Outer3 "outer3_fieldC" where
+
+  type CFieldType Outer3 "outer3_fieldC" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/anonymous/union_in_union/bindingspec.yaml b/test-artefacts/fixtures/types/anonymous/union_in_union/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/union_in_union/bindingspec.yaml
@@ -0,0 +1,126 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/anonymous/union_in_union.h
+  cname: union outer1
+  hsname: Outer1
+- headers: types/anonymous/union_in_union.h
+  cname: union @outer1_anon'fieldX
+  hsname: Outer1_anon'fieldX
+- headers: types/anonymous/union_in_union.h
+  cname: union outer2
+  hsname: Outer2
+- headers: types/anonymous/union_in_union.h
+  cname: union @outer2_fieldB
+  hsname: Outer2_fieldB
+- headers: types/anonymous/union_in_union.h
+  cname: union outer3
+  hsname: Outer3
+- headers: types/anonymous/union_in_union.h
+  cname: union inner3
+  hsname: Inner3
+hstypes:
+- hsname: Inner3
+  representation:
+    newtype:
+      constructor: Inner3
+      fields:
+      - unwrapInner3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer1
+  representation:
+    newtype:
+      constructor: Outer1
+      fields:
+      - unwrapOuter1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer1_anon'fieldX
+  representation:
+    newtype:
+      constructor: Outer1_anon'fieldX
+      fields:
+      - unwrapOuter1_anon'fieldX
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer2
+  representation:
+    newtype:
+      constructor: Outer2
+      fields:
+      - unwrapOuter2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer2_fieldB
+  representation:
+    newtype:
+      constructor: Outer2_fieldB
+      fields:
+      - unwrapOuter2_fieldB
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Outer3
+  representation:
+    newtype:
+      constructor: Outer3
+      fields:
+      - unwrapOuter3
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/anonymous/union_in_union/th.txt b/test-artefacts/fixtures/types/anonymous/union_in_union/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/anonymous/union_in_union/th.txt
@@ -0,0 +1,293 @@
+-- addDependentFile test-artefacts/headers/golden/types/anonymous/union_in_union.h
+{-| __C declaration:__ @union \@outer1_anon\'fieldX@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 8:3@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer1_anon'fieldX
+    = Outer1_anon'fieldX {unwrapOuter1_anon'fieldX :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4
+                             4) instance StaticSize Outer1_anon'fieldX
+deriving via (SizedByteArray 4
+                             4) instance ReadRaw Outer1_anon'fieldX
+deriving via (SizedByteArray 4
+                             4) instance WriteRaw Outer1_anon'fieldX
+deriving via (EquivStorable Outer1_anon'fieldX) instance Storable Outer1_anon'fieldX
+deriving via (SizedByteArray 4
+                             4) instance IsUnion Outer1_anon'fieldX
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX" Outer1_anon'fieldX ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_anon'fieldX_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldX"
+                  (Ptr Outer1_anon'fieldX)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX_fieldX")
+instance HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldX"
+    where type CFieldType Outer1_anon'fieldX
+                          "outer1_anon'fieldX_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY" Outer1_anon'fieldX ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_anon'fieldX_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_anon'fieldX_fieldY"
+                  (Ptr Outer1_anon'fieldX)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX_fieldY")
+instance HasCField Outer1_anon'fieldX "outer1_anon'fieldX_fieldY"
+    where type CFieldType Outer1_anon'fieldX
+                          "outer1_anon'fieldX_fieldY" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union outer1@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 6:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer1
+    = Outer1 {unwrapOuter1 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Outer1
+deriving via (SizedByteArray 4 4) instance ReadRaw Outer1
+deriving via (SizedByteArray 4 4) instance WriteRaw Outer1
+deriving via (EquivStorable Outer1) instance Storable Outer1
+deriving via (SizedByteArray 4 4) instance IsUnion Outer1
+instance (~) ty CChar => HasField "outer1_fieldA" Outer1 ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "outer1_fieldA" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer1_fieldA" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldA")
+instance HasCField Outer1 "outer1_fieldA"
+    where type CFieldType Outer1 "outer1_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" Outer1 ty
+    where getField = getUnionPayload
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_anon'fieldX" x_0)
+instance (~) ty Outer1_anon'fieldX =>
+         HasField "outer1_anon'fieldX" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_anon'fieldX")
+instance HasCField Outer1 "outer1_anon'fieldX"
+    where type CFieldType Outer1
+                          "outer1_anon'fieldX" = Outer1_anon'fieldX
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outer1_fieldX" Outer1 ty
+    where getField = \x_0 -> getField @"outer1_anon'fieldX_fieldX" (getField @"outer1_anon'fieldX" x_0)
+instance (~) ty CInt => HasField "outer1_fieldX" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"outer1_anon'fieldX" x_0 (\z_2 -> setField @"outer1_anon'fieldX_fieldX" z_2 y_1),
+                              getField @"outer1_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldX" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldX")
+instance HasCField Outer1 "outer1_fieldX"
+    where type CFieldType Outer1 "outer1_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outer1_fieldY" Outer1 ty
+    where getField = \x_0 -> getField @"outer1_anon'fieldX_fieldY" (getField @"outer1_anon'fieldX" x_0)
+instance (~) ty CInt => HasField "outer1_fieldY" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> modifyField @"outer1_anon'fieldX" x_0 (\z_2 -> setField @"outer1_anon'fieldX_fieldY" z_2 y_1),
+                              getField @"outer1_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldY" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldY")
+instance HasCField Outer1 "outer1_fieldY"
+    where type CFieldType Outer1 "outer1_fieldY" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outer1_fieldC" Outer1 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "outer1_fieldC" Outer1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer1_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer1_fieldC" (Ptr Outer1) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer1_fieldC")
+instance HasCField Outer1 "outer1_fieldC"
+    where type CFieldType Outer1 "outer1_fieldC" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@outer2_fieldB@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 17:3@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer2_fieldB
+    = Outer2_fieldB {unwrapOuter2_fieldB :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Outer2_fieldB
+deriving via (SizedByteArray 4 4) instance ReadRaw Outer2_fieldB
+deriving via (SizedByteArray 4 4) instance WriteRaw Outer2_fieldB
+deriving via (EquivStorable Outer2_fieldB) instance Storable Outer2_fieldB
+deriving via (SizedByteArray 4 4) instance IsUnion Outer2_fieldB
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" Outer2_fieldB ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" Outer2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldB_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldX" (Ptr Outer2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB_fieldX")
+instance HasCField Outer2_fieldB "outer2_fieldB_fieldX"
+    where type CFieldType Outer2_fieldB "outer2_fieldB_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" Outer2_fieldB ty
+    where getField = getUnionPayload
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" Outer2_fieldB ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldB_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldB_fieldY" (Ptr Outer2_fieldB) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB_fieldY")
+instance HasCField Outer2_fieldB "outer2_fieldB_fieldY"
+    where type CFieldType Outer2_fieldB "outer2_fieldB_fieldY" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union outer2@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 15:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer2
+    = Outer2 {unwrapOuter2 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Outer2
+deriving via (SizedByteArray 4 4) instance ReadRaw Outer2
+deriving via (SizedByteArray 4 4) instance WriteRaw Outer2
+deriving via (EquivStorable Outer2) instance Storable Outer2
+deriving via (SizedByteArray 4 4) instance IsUnion Outer2
+instance (~) ty CChar => HasField "outer2_fieldA" Outer2 ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "outer2_fieldA" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer2_fieldA" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldA")
+instance HasCField Outer2 "outer2_fieldA"
+    where type CFieldType Outer2 "outer2_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Outer2_fieldB => HasField "outer2_fieldB" Outer2 ty
+    where getField = getUnionPayload
+instance (~) ty Outer2_fieldB => HasField "outer2_fieldB" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldB" x_0)
+instance (~) ty Outer2_fieldB =>
+         HasField "outer2_fieldB" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldB")
+instance HasCField Outer2 "outer2_fieldB"
+    where type CFieldType Outer2 "outer2_fieldB" = Outer2_fieldB
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outer2_fieldC" Outer2 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "outer2_fieldC" Outer2 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer2_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer2_fieldC" (Ptr Outer2) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer2_fieldC")
+instance HasCField Outer2 "outer2_fieldC"
+    where type CFieldType Outer2 "outer2_fieldC" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union inner3@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 26:9@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Inner3
+    = Inner3 {unwrapInner3 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Inner3
+deriving via (SizedByteArray 4 4) instance ReadRaw Inner3
+deriving via (SizedByteArray 4 4) instance WriteRaw Inner3
+deriving via (EquivStorable Inner3) instance Storable Inner3
+deriving via (SizedByteArray 4 4) instance IsUnion Inner3
+instance (~) ty CInt => HasField "inner3_fieldX" Inner3 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "inner3_fieldX" Inner3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"inner3_fieldX" x_0)
+instance (~) ty CInt =>
+         HasField "inner3_fieldX" (Ptr Inner3) (Ptr ty)
+    where getField = fromPtr (Proxy @"inner3_fieldX")
+instance HasCField Inner3 "inner3_fieldX"
+    where type CFieldType Inner3 "inner3_fieldX" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "inner3_fieldY" Inner3 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "inner3_fieldY" Inner3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"inner3_fieldY" x_0)
+instance (~) ty CInt =>
+         HasField "inner3_fieldY" (Ptr Inner3) (Ptr ty)
+    where getField = fromPtr (Proxy @"inner3_fieldY")
+instance HasCField Inner3 "inner3_fieldY"
+    where type CFieldType Inner3 "inner3_fieldY" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union outer3@
+
+    __defined at:__ @types\/anonymous\/union_in_union.h 24:7@
+
+    __exported by:__ @types\/anonymous\/union_in_union.h@
+-}
+newtype Outer3
+    = Outer3 {unwrapOuter3 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Outer3
+deriving via (SizedByteArray 4 4) instance ReadRaw Outer3
+deriving via (SizedByteArray 4 4) instance WriteRaw Outer3
+deriving via (EquivStorable Outer3) instance Storable Outer3
+deriving via (SizedByteArray 4 4) instance IsUnion Outer3
+instance (~) ty CChar => HasField "outer3_fieldA" Outer3 ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "outer3_fieldA" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer3_fieldA" x_0)
+instance (~) ty CChar =>
+         HasField "outer3_fieldA" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldA")
+instance HasCField Outer3 "outer3_fieldA"
+    where type CFieldType Outer3 "outer3_fieldA" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty Inner3 => HasField "outer3_fieldB" Outer3 ty
+    where getField = getUnionPayload
+instance (~) ty Inner3 => HasField "outer3_fieldB" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer3_fieldB" x_0)
+instance (~) ty Inner3 =>
+         HasField "outer3_fieldB" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldB")
+instance HasCField Outer3 "outer3_fieldB"
+    where type CFieldType Outer3 "outer3_fieldB" = Inner3
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "outer3_fieldC" Outer3 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "outer3_fieldC" Outer3 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"outer3_fieldC" x_0)
+instance (~) ty CInt =>
+         HasField "outer3_fieldC" (Ptr Outer3) (Ptr ty)
+    where getField = fromPtr (Proxy @"outer3_fieldC")
+instance HasCField Outer3 "outer3_fieldC"
+    where type CFieldType Outer3 "outer3_fieldC" = CInt
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/complex/complex_non_float_test/Example/Global.hs b/test-artefacts/fixtures/types/complex/complex_non_float_test/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/complex_non_float_test/Example/Global.hs
@@ -0,0 +1,151 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.global_complex_unsigned_short
+    , Example.Global.global_complex_short
+    , Example.Global.global_complex_unsigned_int
+    , Example.Global.global_complex_int
+    , Example.Global.global_complex_char
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/complex/complex_non_float_test.h>"
+  , "/* test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_short */"
+  , "__attribute__ ((const))"
+  , "unsigned short _Complex *hs_bindgen_f3018b1e87470bdd (void)"
+  , "{"
+  , "  return &global_complex_unsigned_short;"
+  , "}"
+  , "/* test_typescomplexcomplex_non_floa_Example_get_global_complex_short */"
+  , "__attribute__ ((const))"
+  , "signed short _Complex *hs_bindgen_a553be84170a3efa (void)"
+  , "{"
+  , "  return &global_complex_short;"
+  , "}"
+  , "/* test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_int */"
+  , "__attribute__ ((const))"
+  , "unsigned int _Complex *hs_bindgen_072fc08ef6d9395a (void)"
+  , "{"
+  , "  return &global_complex_unsigned_int;"
+  , "}"
+  , "/* test_typescomplexcomplex_non_floa_Example_get_global_complex_int */"
+  , "__attribute__ ((const))"
+  , "signed int _Complex *hs_bindgen_1199a9d54fe334cb (void)"
+  , "{"
+  , "  return &global_complex_int;"
+  , "}"
+  , "/* test_typescomplexcomplex_non_floa_Example_get_global_complex_char */"
+  , "__attribute__ ((const))"
+  , "char _Complex *hs_bindgen_7c8cb41a7febc6fc (void)"
+  , "{"
+  , "  return &global_complex_char;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_short@
+foreign import ccall unsafe "hs_bindgen_f3018b1e87470bdd" hs_bindgen_f3018b1e87470bdd_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_short@
+hs_bindgen_f3018b1e87470bdd :: IO (BG.Ptr (BG.Complex BG.CUShort))
+hs_bindgen_f3018b1e87470bdd =
+  fmap BG.fromFFIType hs_bindgen_f3018b1e87470bdd_base
+
+{-# NOINLINE global_complex_unsigned_short #-}
+{-| __C declaration:__ @global_complex_unsigned_short@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 3:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_unsigned_short :: BG.Ptr (BG.Complex BG.CUShort)
+global_complex_unsigned_short =
+  BG.unsafePerformIO hs_bindgen_f3018b1e87470bdd
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_short@
+foreign import ccall unsafe "hs_bindgen_a553be84170a3efa" hs_bindgen_a553be84170a3efa_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_short@
+hs_bindgen_a553be84170a3efa :: IO (BG.Ptr (BG.Complex BG.CShort))
+hs_bindgen_a553be84170a3efa =
+  fmap BG.fromFFIType hs_bindgen_a553be84170a3efa_base
+
+{-# NOINLINE global_complex_short #-}
+{-| __C declaration:__ @global_complex_short@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 4:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_short :: BG.Ptr (BG.Complex BG.CShort)
+global_complex_short =
+  BG.unsafePerformIO hs_bindgen_a553be84170a3efa
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_int@
+foreign import ccall unsafe "hs_bindgen_072fc08ef6d9395a" hs_bindgen_072fc08ef6d9395a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_int@
+hs_bindgen_072fc08ef6d9395a :: IO (BG.Ptr (BG.Complex BG.CUInt))
+hs_bindgen_072fc08ef6d9395a =
+  fmap BG.fromFFIType hs_bindgen_072fc08ef6d9395a_base
+
+{-# NOINLINE global_complex_unsigned_int #-}
+{-| __C declaration:__ @global_complex_unsigned_int@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 5:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_unsigned_int :: BG.Ptr (BG.Complex BG.CUInt)
+global_complex_unsigned_int =
+  BG.unsafePerformIO hs_bindgen_072fc08ef6d9395a
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_int@
+foreign import ccall unsafe "hs_bindgen_1199a9d54fe334cb" hs_bindgen_1199a9d54fe334cb_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_int@
+hs_bindgen_1199a9d54fe334cb :: IO (BG.Ptr (BG.Complex BG.CInt))
+hs_bindgen_1199a9d54fe334cb =
+  fmap BG.fromFFIType hs_bindgen_1199a9d54fe334cb_base
+
+{-# NOINLINE global_complex_int #-}
+{-| __C declaration:__ @global_complex_int@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 6:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_int :: BG.Ptr (BG.Complex BG.CInt)
+global_complex_int =
+  BG.unsafePerformIO hs_bindgen_1199a9d54fe334cb
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_char@
+foreign import ccall unsafe "hs_bindgen_7c8cb41a7febc6fc" hs_bindgen_7c8cb41a7febc6fc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_char@
+hs_bindgen_7c8cb41a7febc6fc :: IO (BG.Ptr (BG.Complex BG.CChar))
+hs_bindgen_7c8cb41a7febc6fc =
+  fmap BG.fromFFIType hs_bindgen_7c8cb41a7febc6fc_base
+
+{-# NOINLINE global_complex_char #-}
+{-| __C declaration:__ @global_complex_char@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 7:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_char :: BG.Ptr (BG.Complex BG.CChar)
+global_complex_char =
+  BG.unsafePerformIO hs_bindgen_7c8cb41a7febc6fc
diff --git a/test-artefacts/fixtures/types/complex/complex_non_float_test/bindingspec.yaml b/test-artefacts/fixtures/types/complex/complex_non_float_test/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/complex_non_float_test/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/types/complex/complex_non_float_test/th.txt b/test-artefacts/fixtures/types/complex/complex_non_float_test/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/complex_non_float_test/th.txt
@@ -0,0 +1,143 @@
+-- addDependentFile musl-include/x86_64/complex.h
+-- addDependentFile test-artefacts/headers/golden/types/complex/complex_non_float_test.h
+-- #include <types/complex/complex_non_float_test.h>
+-- /* test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_short */
+-- __attribute__ ((const))
+-- unsigned short _Complex *hs_bindgen_f3018b1e87470bdd (void)
+-- {
+--   return &global_complex_unsigned_short;
+-- }
+-- /* test_typescomplexcomplex_non_floa_Example_get_global_complex_short */
+-- __attribute__ ((const))
+-- signed short _Complex *hs_bindgen_a553be84170a3efa (void)
+-- {
+--   return &global_complex_short;
+-- }
+-- /* test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_int */
+-- __attribute__ ((const))
+-- unsigned int _Complex *hs_bindgen_072fc08ef6d9395a (void)
+-- {
+--   return &global_complex_unsigned_int;
+-- }
+-- /* test_typescomplexcomplex_non_floa_Example_get_global_complex_int */
+-- __attribute__ ((const))
+-- signed int _Complex *hs_bindgen_1199a9d54fe334cb (void)
+-- {
+--   return &global_complex_int;
+-- }
+-- /* test_typescomplexcomplex_non_floa_Example_get_global_complex_char */
+-- __attribute__ ((const))
+-- char _Complex *hs_bindgen_7c8cb41a7febc6fc (void)
+-- {
+--   return &global_complex_char;
+-- }
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_short@
+foreign import ccall unsafe "hs_bindgen_f3018b1e87470bdd" hs_bindgen_f3018b1e87470bdd_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_short@
+hs_bindgen_f3018b1e87470bdd :: IO (Ptr (Complex CUShort))
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_short@
+hs_bindgen_f3018b1e87470bdd = fmap fromFFIType hs_bindgen_f3018b1e87470bdd_base
+{-# NOINLINE global_complex_unsigned_short #-}
+{-| __C declaration:__ @global_complex_unsigned_short@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 3:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_unsigned_short :: Ptr (Complex CUShort)
+{-| __C declaration:__ @global_complex_unsigned_short@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 3:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_unsigned_short = unsafePerformIO hs_bindgen_f3018b1e87470bdd
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_short@
+foreign import ccall unsafe "hs_bindgen_a553be84170a3efa" hs_bindgen_a553be84170a3efa_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_short@
+hs_bindgen_a553be84170a3efa :: IO (Ptr (Complex CShort))
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_short@
+hs_bindgen_a553be84170a3efa = fmap fromFFIType hs_bindgen_a553be84170a3efa_base
+{-# NOINLINE global_complex_short #-}
+{-| __C declaration:__ @global_complex_short@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 4:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_short :: Ptr (Complex CShort)
+{-| __C declaration:__ @global_complex_short@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 4:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_short = unsafePerformIO hs_bindgen_a553be84170a3efa
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_int@
+foreign import ccall unsafe "hs_bindgen_072fc08ef6d9395a" hs_bindgen_072fc08ef6d9395a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_int@
+hs_bindgen_072fc08ef6d9395a :: IO (Ptr (Complex CUInt))
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_unsigned_int@
+hs_bindgen_072fc08ef6d9395a = fmap fromFFIType hs_bindgen_072fc08ef6d9395a_base
+{-# NOINLINE global_complex_unsigned_int #-}
+{-| __C declaration:__ @global_complex_unsigned_int@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 5:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_unsigned_int :: Ptr (Complex CUInt)
+{-| __C declaration:__ @global_complex_unsigned_int@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 5:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_unsigned_int = unsafePerformIO hs_bindgen_072fc08ef6d9395a
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_int@
+foreign import ccall unsafe "hs_bindgen_1199a9d54fe334cb" hs_bindgen_1199a9d54fe334cb_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_int@
+hs_bindgen_1199a9d54fe334cb :: IO (Ptr (Complex CInt))
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_int@
+hs_bindgen_1199a9d54fe334cb = fmap fromFFIType hs_bindgen_1199a9d54fe334cb_base
+{-# NOINLINE global_complex_int #-}
+{-| __C declaration:__ @global_complex_int@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 6:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_int :: Ptr (Complex CInt)
+{-| __C declaration:__ @global_complex_int@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 6:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_int = unsafePerformIO hs_bindgen_1199a9d54fe334cb
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_char@
+foreign import ccall unsafe "hs_bindgen_7c8cb41a7febc6fc" hs_bindgen_7c8cb41a7febc6fc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_char@
+hs_bindgen_7c8cb41a7febc6fc :: IO (Ptr (Complex CChar))
+-- __unique:__ @test_typescomplexcomplex_non_floa_Example_get_global_complex_char@
+hs_bindgen_7c8cb41a7febc6fc = fmap fromFFIType hs_bindgen_7c8cb41a7febc6fc_base
+{-# NOINLINE global_complex_char #-}
+{-| __C declaration:__ @global_complex_char@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 7:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_char :: Ptr (Complex CChar)
+{-| __C declaration:__ @global_complex_char@
+
+    __defined at:__ @types\/complex\/complex_non_float_test.h 7:32@
+
+    __exported by:__ @types\/complex\/complex_non_float_test.h@
+-}
+global_complex_char = unsafePerformIO hs_bindgen_7c8cb41a7febc6fc
diff --git a/test-artefacts/fixtures/types/complex/hsb_complex_test/Example.hs b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example.hs
@@ -0,0 +1,186 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Complex_object_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct complex_object_t@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 24:9@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+data Complex_object_t = Complex_object_t
+  { complex_object_t_velocity :: BG.Complex BG.CFloat
+    {- ^ __C declaration:__ @velocity@
+
+         __defined at:__ @types\/complex\/hsb_complex_test.h 25:20@
+
+         __exported by:__ @types\/complex\/hsb_complex_test.h@
+    -}
+  , complex_object_t_position :: BG.Complex BG.CDouble
+    {- ^ __C declaration:__ @position@
+
+         __defined at:__ @types\/complex\/hsb_complex_test.h 26:20@
+
+         __exported by:__ @types\/complex\/hsb_complex_test.h@
+    -}
+  , complex_object_t_id :: BG.CInt
+    {- ^ __C declaration:__ @id@
+
+         __defined at:__ @types\/complex\/hsb_complex_test.h 27:9@
+
+         __exported by:__ @types\/complex\/hsb_complex_test.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Complex_object_t where
+
+  staticSizeOf = \_ -> (32 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Complex_object_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Complex_object_t
+      <*> HasCField.readRaw (BG.Proxy @"complex_object_t_velocity") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"complex_object_t_position") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"complex_object_t_id") ptr0
+
+instance Marshal.WriteRaw Complex_object_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Complex_object_t
+            complex_object_t_velocity2
+            complex_object_t_position3
+            complex_object_t_id4 ->
+                 HasCField.writeRaw (BG.Proxy @"complex_object_t_velocity") ptr0 complex_object_t_velocity2
+              >> HasCField.writeRaw (BG.Proxy @"complex_object_t_position") ptr0 complex_object_t_position3
+              >> HasCField.writeRaw (BG.Proxy @"complex_object_t_id") ptr0 complex_object_t_id4
+
+deriving via Marshal.EquivStorable Complex_object_t instance BG.Storable Complex_object_t
+
+deriving via Struct.IsStructViaReadRaw Complex_object_t instance Struct.IsStruct Complex_object_t
+
+{-| __C declaration:__ @velocity@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 25:20@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+instance ( ty ~ BG.Complex BG.CFloat
+         ) => BG.CompatHasField.HasField "complex_object_t_velocity" Complex_object_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Complex_object_t { complex_object_t_velocity = y1
+                           , complex_object_t_position = BG.getField @"complex_object_t_position" x0
+                           , complex_object_t_id = BG.getField @"complex_object_t_id" x0
+                           }
+      , BG.getField @"complex_object_t_velocity" x0
+      )
+
+instance ( ty ~ BG.Complex BG.CFloat
+         ) => BG.HasField "complex_object_t_velocity" (BG.Ptr Complex_object_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"complex_object_t_velocity")
+
+instance HasCField.HasCField Complex_object_t "complex_object_t_velocity" where
+
+  type CFieldType Complex_object_t "complex_object_t_velocity" =
+    BG.Complex BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @position@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 26:20@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+instance ( ty ~ BG.Complex BG.CDouble
+         ) => BG.CompatHasField.HasField "complex_object_t_position" Complex_object_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Complex_object_t { complex_object_t_position = y1
+                           , complex_object_t_velocity = BG.getField @"complex_object_t_velocity" x0
+                           , complex_object_t_id = BG.getField @"complex_object_t_id" x0
+                           }
+      , BG.getField @"complex_object_t_position" x0
+      )
+
+instance ( ty ~ BG.Complex BG.CDouble
+         ) => BG.HasField "complex_object_t_position" (BG.Ptr Complex_object_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"complex_object_t_position")
+
+instance HasCField.HasCField Complex_object_t "complex_object_t_position" where
+
+  type CFieldType Complex_object_t "complex_object_t_position" =
+    BG.Complex BG.CDouble
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @id@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 27:9@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "complex_object_t_id" Complex_object_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Complex_object_t { complex_object_t_id = y1
+                           , complex_object_t_velocity = BG.getField @"complex_object_t_velocity" x0
+                           , complex_object_t_position = BG.getField @"complex_object_t_position" x0
+                           }
+      , BG.getField @"complex_object_t_id" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "complex_object_t_id" (BG.Ptr Complex_object_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"complex_object_t_id")
+
+instance HasCField.HasCField Complex_object_t "complex_object_t_id" where
+
+  type CFieldType Complex_object_t "complex_object_t_id" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 24
diff --git a/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/FunPtr.hs b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/FunPtr.hs
@@ -0,0 +1,76 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.multiply_complex_f
+    , Example.FunPtr.add_complex
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/complex/hsb_complex_test.h>"
+  , "/* test_typescomplexhsb_complex_test_Example_get_multiply_complex_f */"
+  , "__attribute__ ((const))"
+  , "float _Complex (*hs_bindgen_29b4fea741132943 (void)) ("
+  , "  float _Complex arg1,"
+  , "  float _Complex arg2"
+  , ")"
+  , "{"
+  , "  return &multiply_complex_f;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_add_complex */"
+  , "__attribute__ ((const))"
+  , "double _Complex (*hs_bindgen_b53577d6ad8dd36c (void)) ("
+  , "  double _Complex arg1,"
+  , "  double _Complex arg2"
+  , ")"
+  , "{"
+  , "  return &add_complex;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_multiply_complex_f@
+foreign import ccall unsafe "hs_bindgen_29b4fea741132943" hs_bindgen_29b4fea741132943_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_multiply_complex_f@
+hs_bindgen_29b4fea741132943 :: IO (BG.FunPtr (BG.Complex BG.CFloat -> BG.Complex BG.CFloat -> IO (BG.Complex BG.CFloat)))
+hs_bindgen_29b4fea741132943 =
+  fmap BG.fromFFIType hs_bindgen_29b4fea741132943_base
+
+{-# NOINLINE multiply_complex_f #-}
+{-| __C declaration:__ @multiply_complex_f@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 21:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+multiply_complex_f :: BG.FunPtr (BG.Complex BG.CFloat -> BG.Complex BG.CFloat -> IO (BG.Complex BG.CFloat))
+multiply_complex_f =
+  BG.unsafePerformIO hs_bindgen_29b4fea741132943
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_add_complex@
+foreign import ccall unsafe "hs_bindgen_b53577d6ad8dd36c" hs_bindgen_b53577d6ad8dd36c_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_add_complex@
+hs_bindgen_b53577d6ad8dd36c :: IO (BG.FunPtr (BG.Complex BG.CDouble -> BG.Complex BG.CDouble -> IO (BG.Complex BG.CDouble)))
+hs_bindgen_b53577d6ad8dd36c =
+  fmap BG.fromFFIType hs_bindgen_b53577d6ad8dd36c_base
+
+{-# NOINLINE add_complex #-}
+{-| __C declaration:__ @add_complex@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 22:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+add_complex :: BG.FunPtr (BG.Complex BG.CDouble -> BG.Complex BG.CDouble -> IO (BG.Complex BG.CDouble))
+add_complex =
+  BG.unsafePerformIO hs_bindgen_b53577d6ad8dd36c
diff --git a/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/Global.hs b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/Global.hs
@@ -0,0 +1,411 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.global_complex_float
+    , Example.Global.global_complex_double
+    , Example.Global.global_complex_float_flipped
+    , Example.Global.global_complex_double_flipped
+    , Example.Global.global_Complex_float
+    , Example.Global.global_Complex_double
+    , Example.Global.global_Complex_float_flipped
+    , Example.Global.global_Complex_double_flipped
+    , Example.Global.const_complex_float
+    , Example.Global.const_complex_double
+    , Example.Global.volatile_complex_float
+    , Example.Global.volatile_complex_double
+    , Example.Global.complex_float_array
+    , Example.Global.complex_double_array
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/complex/hsb_complex_test.h>"
+  , "/* test_typescomplexhsb_complex_test_Example_get_global_complex_float */"
+  , "__attribute__ ((const))"
+  , "float _Complex *hs_bindgen_209e61216da37381 (void)"
+  , "{"
+  , "  return &global_complex_float;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_global_complex_double */"
+  , "__attribute__ ((const))"
+  , "double _Complex *hs_bindgen_4d0950cebe4897a7 (void)"
+  , "{"
+  , "  return &global_complex_double;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_global_complex_float_flipped */"
+  , "__attribute__ ((const))"
+  , "float _Complex *hs_bindgen_7e9edc1d187b0799 (void)"
+  , "{"
+  , "  return &global_complex_float_flipped;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_global_complex_double_flipped */"
+  , "__attribute__ ((const))"
+  , "double _Complex *hs_bindgen_fe8783b71a4e1d3c (void)"
+  , "{"
+  , "  return &global_complex_double_flipped;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_global_Complex_float */"
+  , "__attribute__ ((const))"
+  , "float _Complex *hs_bindgen_0aa0098565c13195 (void)"
+  , "{"
+  , "  return &global_Complex_float;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_global_Complex_double */"
+  , "__attribute__ ((const))"
+  , "double _Complex *hs_bindgen_5f43cb32dc9ef6af (void)"
+  , "{"
+  , "  return &global_Complex_double;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_global_Complex_float_flipped */"
+  , "__attribute__ ((const))"
+  , "float _Complex *hs_bindgen_40d5347e1c2ae46a (void)"
+  , "{"
+  , "  return &global_Complex_float_flipped;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_global_Complex_double_flipped */"
+  , "__attribute__ ((const))"
+  , "double _Complex *hs_bindgen_0e377cedb96a3ba4 (void)"
+  , "{"
+  , "  return &global_Complex_double_flipped;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_const_complex_float */"
+  , "__attribute__ ((const))"
+  , "float _Complex const *hs_bindgen_d94307879b0a380f (void)"
+  , "{"
+  , "  return &const_complex_float;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_const_complex_double */"
+  , "__attribute__ ((const))"
+  , "double _Complex const *hs_bindgen_de1422a11860ada5 (void)"
+  , "{"
+  , "  return &const_complex_double;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_volatile_complex_float */"
+  , "__attribute__ ((const))"
+  , "float _Complex *hs_bindgen_569a907813a0dadd (void)"
+  , "{"
+  , "  return &volatile_complex_float;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_volatile_complex_double */"
+  , "__attribute__ ((const))"
+  , "double _Complex *hs_bindgen_e86c9014eb507c96 (void)"
+  , "{"
+  , "  return &volatile_complex_double;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_complex_float_array */"
+  , "__attribute__ ((const))"
+  , "float _Complex (*hs_bindgen_b548dda6b5993793 (void))[10]"
+  , "{"
+  , "  return &complex_float_array;"
+  , "}"
+  , "/* test_typescomplexhsb_complex_test_Example_get_complex_double_array */"
+  , "__attribute__ ((const))"
+  , "double _Complex (*hs_bindgen_c56913da40952669 (void))[10]"
+  , "{"
+  , "  return &complex_double_array;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float@
+foreign import ccall unsafe "hs_bindgen_209e61216da37381" hs_bindgen_209e61216da37381_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float@
+hs_bindgen_209e61216da37381 :: IO (BG.Ptr (BG.Complex BG.CFloat))
+hs_bindgen_209e61216da37381 =
+  fmap BG.fromFFIType hs_bindgen_209e61216da37381_base
+
+{-# NOINLINE global_complex_float #-}
+{-| __C declaration:__ @global_complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 3:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_float :: BG.Ptr (BG.Complex BG.CFloat)
+global_complex_float =
+  BG.unsafePerformIO hs_bindgen_209e61216da37381
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double@
+foreign import ccall unsafe "hs_bindgen_4d0950cebe4897a7" hs_bindgen_4d0950cebe4897a7_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double@
+hs_bindgen_4d0950cebe4897a7 :: IO (BG.Ptr (BG.Complex BG.CDouble))
+hs_bindgen_4d0950cebe4897a7 =
+  fmap BG.fromFFIType hs_bindgen_4d0950cebe4897a7_base
+
+{-# NOINLINE global_complex_double #-}
+{-| __C declaration:__ @global_complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 4:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_double :: BG.Ptr (BG.Complex BG.CDouble)
+global_complex_double =
+  BG.unsafePerformIO hs_bindgen_4d0950cebe4897a7
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float_flipped@
+foreign import ccall unsafe "hs_bindgen_7e9edc1d187b0799" hs_bindgen_7e9edc1d187b0799_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float_flipped@
+hs_bindgen_7e9edc1d187b0799 :: IO (BG.Ptr (BG.Complex BG.CFloat))
+hs_bindgen_7e9edc1d187b0799 =
+  fmap BG.fromFFIType hs_bindgen_7e9edc1d187b0799_base
+
+{-# NOINLINE global_complex_float_flipped #-}
+{-| __C declaration:__ @global_complex_float_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 6:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_float_flipped :: BG.Ptr (BG.Complex BG.CFloat)
+global_complex_float_flipped =
+  BG.unsafePerformIO hs_bindgen_7e9edc1d187b0799
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double_flipped@
+foreign import ccall unsafe "hs_bindgen_fe8783b71a4e1d3c" hs_bindgen_fe8783b71a4e1d3c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double_flipped@
+hs_bindgen_fe8783b71a4e1d3c :: IO (BG.Ptr (BG.Complex BG.CDouble))
+hs_bindgen_fe8783b71a4e1d3c =
+  fmap BG.fromFFIType hs_bindgen_fe8783b71a4e1d3c_base
+
+{-# NOINLINE global_complex_double_flipped #-}
+{-| __C declaration:__ @global_complex_double_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 7:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_double_flipped :: BG.Ptr (BG.Complex BG.CDouble)
+global_complex_double_flipped =
+  BG.unsafePerformIO hs_bindgen_fe8783b71a4e1d3c
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float@
+foreign import ccall unsafe "hs_bindgen_0aa0098565c13195" hs_bindgen_0aa0098565c13195_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float@
+hs_bindgen_0aa0098565c13195 :: IO (BG.Ptr (BG.Complex BG.CFloat))
+hs_bindgen_0aa0098565c13195 =
+  fmap BG.fromFFIType hs_bindgen_0aa0098565c13195_base
+
+{-# NOINLINE global_Complex_float #-}
+{-| __C declaration:__ @global_Complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 9:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_float :: BG.Ptr (BG.Complex BG.CFloat)
+global_Complex_float =
+  BG.unsafePerformIO hs_bindgen_0aa0098565c13195
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double@
+foreign import ccall unsafe "hs_bindgen_5f43cb32dc9ef6af" hs_bindgen_5f43cb32dc9ef6af_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double@
+hs_bindgen_5f43cb32dc9ef6af :: IO (BG.Ptr (BG.Complex BG.CDouble))
+hs_bindgen_5f43cb32dc9ef6af =
+  fmap BG.fromFFIType hs_bindgen_5f43cb32dc9ef6af_base
+
+{-# NOINLINE global_Complex_double #-}
+{-| __C declaration:__ @global_Complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 10:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_double :: BG.Ptr (BG.Complex BG.CDouble)
+global_Complex_double =
+  BG.unsafePerformIO hs_bindgen_5f43cb32dc9ef6af
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float_flipped@
+foreign import ccall unsafe "hs_bindgen_40d5347e1c2ae46a" hs_bindgen_40d5347e1c2ae46a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float_flipped@
+hs_bindgen_40d5347e1c2ae46a :: IO (BG.Ptr (BG.Complex BG.CFloat))
+hs_bindgen_40d5347e1c2ae46a =
+  fmap BG.fromFFIType hs_bindgen_40d5347e1c2ae46a_base
+
+{-# NOINLINE global_Complex_float_flipped #-}
+{-| __C declaration:__ @global_Complex_float_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 12:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_float_flipped :: BG.Ptr (BG.Complex BG.CFloat)
+global_Complex_float_flipped =
+  BG.unsafePerformIO hs_bindgen_40d5347e1c2ae46a
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double_flipped@
+foreign import ccall unsafe "hs_bindgen_0e377cedb96a3ba4" hs_bindgen_0e377cedb96a3ba4_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double_flipped@
+hs_bindgen_0e377cedb96a3ba4 :: IO (BG.Ptr (BG.Complex BG.CDouble))
+hs_bindgen_0e377cedb96a3ba4 =
+  fmap BG.fromFFIType hs_bindgen_0e377cedb96a3ba4_base
+
+{-# NOINLINE global_Complex_double_flipped #-}
+{-| __C declaration:__ @global_Complex_double_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 13:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_double_flipped :: BG.Ptr (BG.Complex BG.CDouble)
+global_Complex_double_flipped =
+  BG.unsafePerformIO hs_bindgen_0e377cedb96a3ba4
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_float@
+foreign import ccall unsafe "hs_bindgen_d94307879b0a380f" hs_bindgen_d94307879b0a380f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_float@
+hs_bindgen_d94307879b0a380f :: IO (PtrConst.PtrConst (BG.Complex BG.CFloat))
+hs_bindgen_d94307879b0a380f =
+  fmap BG.fromFFIType hs_bindgen_d94307879b0a380f_base
+
+{-# NOINLINE hs_bindgen_554ede1a618d726f #-}
+{-| __C declaration:__ @const_complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 15:29@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+
+    __unique:__ @test_typescomplexhsb_complex_test_Example_const_complex_float@
+-}
+hs_bindgen_554ede1a618d726f :: PtrConst.PtrConst (BG.Complex BG.CFloat)
+hs_bindgen_554ede1a618d726f =
+  BG.unsafePerformIO hs_bindgen_d94307879b0a380f
+
+{-# NOINLINE const_complex_float #-}
+const_complex_float :: BG.Complex BG.CFloat
+const_complex_float =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_554ede1a618d726f)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_double@
+foreign import ccall unsafe "hs_bindgen_de1422a11860ada5" hs_bindgen_de1422a11860ada5_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_double@
+hs_bindgen_de1422a11860ada5 :: IO (PtrConst.PtrConst (BG.Complex BG.CDouble))
+hs_bindgen_de1422a11860ada5 =
+  fmap BG.fromFFIType hs_bindgen_de1422a11860ada5_base
+
+{-# NOINLINE hs_bindgen_cf751023874b527f #-}
+{-| __C declaration:__ @const_complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 16:29@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+
+    __unique:__ @test_typescomplexhsb_complex_test_Example_const_complex_double@
+-}
+hs_bindgen_cf751023874b527f :: PtrConst.PtrConst (BG.Complex BG.CDouble)
+hs_bindgen_cf751023874b527f =
+  BG.unsafePerformIO hs_bindgen_de1422a11860ada5
+
+{-# NOINLINE const_complex_double #-}
+const_complex_double :: BG.Complex BG.CDouble
+const_complex_double =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_cf751023874b527f)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_float@
+foreign import ccall unsafe "hs_bindgen_569a907813a0dadd" hs_bindgen_569a907813a0dadd_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_float@
+hs_bindgen_569a907813a0dadd :: IO (BG.Ptr (BG.Complex BG.CFloat))
+hs_bindgen_569a907813a0dadd =
+  fmap BG.fromFFIType hs_bindgen_569a907813a0dadd_base
+
+{-# NOINLINE volatile_complex_float #-}
+{-| __C declaration:__ @volatile_complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 18:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+volatile_complex_float :: BG.Ptr (BG.Complex BG.CFloat)
+volatile_complex_float =
+  BG.unsafePerformIO hs_bindgen_569a907813a0dadd
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_double@
+foreign import ccall unsafe "hs_bindgen_e86c9014eb507c96" hs_bindgen_e86c9014eb507c96_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_double@
+hs_bindgen_e86c9014eb507c96 :: IO (BG.Ptr (BG.Complex BG.CDouble))
+hs_bindgen_e86c9014eb507c96 =
+  fmap BG.fromFFIType hs_bindgen_e86c9014eb507c96_base
+
+{-# NOINLINE volatile_complex_double #-}
+{-| __C declaration:__ @volatile_complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 19:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+volatile_complex_double :: BG.Ptr (BG.Complex BG.CDouble)
+volatile_complex_double =
+  BG.unsafePerformIO hs_bindgen_e86c9014eb507c96
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_float_array@
+foreign import ccall unsafe "hs_bindgen_b548dda6b5993793" hs_bindgen_b548dda6b5993793_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_float_array@
+hs_bindgen_b548dda6b5993793 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Complex BG.CFloat)))
+hs_bindgen_b548dda6b5993793 =
+  fmap BG.fromFFIType hs_bindgen_b548dda6b5993793_base
+
+{-# NOINLINE complex_float_array #-}
+{-| __C declaration:__ @complex_float_array@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 30:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+complex_float_array :: BG.Ptr (CA.ConstantArray 10 (BG.Complex BG.CFloat))
+complex_float_array =
+  BG.unsafePerformIO hs_bindgen_b548dda6b5993793
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_double_array@
+foreign import ccall unsafe "hs_bindgen_c56913da40952669" hs_bindgen_c56913da40952669_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_double_array@
+hs_bindgen_c56913da40952669 :: IO (BG.Ptr (CA.ConstantArray 10 (BG.Complex BG.CDouble)))
+hs_bindgen_c56913da40952669 =
+  fmap BG.fromFFIType hs_bindgen_c56913da40952669_base
+
+{-# NOINLINE complex_double_array #-}
+{-| __C declaration:__ @complex_double_array@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 31:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+complex_double_array :: BG.Ptr (CA.ConstantArray 10 (BG.Complex BG.CDouble))
+complex_double_array =
+  BG.unsafePerformIO hs_bindgen_c56913da40952669
diff --git a/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/Safe.hs b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/Safe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.multiply_complex_f
+    , Example.Safe.add_complex
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/complex/hsb_complex_test.h>"
+  , "void hs_bindgen_687af703c95fba0e ("
+  , "  float _Complex *arg1,"
+  , "  float _Complex *arg2,"
+  , "  float _Complex *arg3"
+  , ")"
+  , "{"
+  , "  *arg3 = (multiply_complex_f)(*arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_3ff14ee8c5914fc6 ("
+  , "  double _Complex *arg1,"
+  , "  double _Complex *arg2,"
+  , "  double _Complex *arg3"
+  , ")"
+  , "{"
+  , "  *arg3 = (add_complex)(*arg1, *arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_multiply_complex_f@
+foreign import ccall safe "hs_bindgen_687af703c95fba0e" hs_bindgen_687af703c95fba0e_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_multiply_complex_f@
+hs_bindgen_687af703c95fba0e ::
+     BG.Ptr (BG.Complex BG.CFloat)
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_687af703c95fba0e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_687af703c95fba0e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| __C declaration:__ @multiply_complex_f@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 21:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+multiply_complex_f ::
+     BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @a@
+  -> BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Complex BG.CFloat)
+multiply_complex_f =
+  \a0 ->
+    \b1 ->
+      BG.with a0 (\a2 ->
+                    BG.with b1 (\b3 ->
+                                  BG.allocaAndPeek (\res4 ->
+                                                      hs_bindgen_687af703c95fba0e a2 b3 res4)))
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_add_complex@
+foreign import ccall safe "hs_bindgen_3ff14ee8c5914fc6" hs_bindgen_3ff14ee8c5914fc6_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_add_complex@
+hs_bindgen_3ff14ee8c5914fc6 ::
+     BG.Ptr (BG.Complex BG.CDouble)
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_3ff14ee8c5914fc6 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_3ff14ee8c5914fc6_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| __C declaration:__ @add_complex@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 22:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+add_complex ::
+     BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @a@
+  -> BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Complex BG.CDouble)
+add_complex =
+  \a0 ->
+    \b1 ->
+      BG.with a0 (\a2 ->
+                    BG.with b1 (\b3 ->
+                                  BG.allocaAndPeek (\res4 ->
+                                                      hs_bindgen_3ff14ee8c5914fc6 a2 b3 res4)))
diff --git a/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/Unsafe.hs b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/hsb_complex_test/Example/Unsafe.hs
@@ -0,0 +1,112 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.multiply_complex_f
+    , Example.Unsafe.add_complex
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/complex/hsb_complex_test.h>"
+  , "void hs_bindgen_e5e3172c2163672b ("
+  , "  float _Complex *arg1,"
+  , "  float _Complex *arg2,"
+  , "  float _Complex *arg3"
+  , ")"
+  , "{"
+  , "  *arg3 = (multiply_complex_f)(*arg1, *arg2);"
+  , "}"
+  , "void hs_bindgen_28f2705e917973ab ("
+  , "  double _Complex *arg1,"
+  , "  double _Complex *arg2,"
+  , "  double _Complex *arg3"
+  , ")"
+  , "{"
+  , "  *arg3 = (add_complex)(*arg1, *arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_multiply_complex_f@
+foreign import ccall unsafe "hs_bindgen_e5e3172c2163672b" hs_bindgen_e5e3172c2163672b_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_multiply_complex_f@
+hs_bindgen_e5e3172c2163672b ::
+     BG.Ptr (BG.Complex BG.CFloat)
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> BG.Ptr (BG.Complex BG.CFloat)
+  -> IO ()
+hs_bindgen_e5e3172c2163672b =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_e5e3172c2163672b_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| __C declaration:__ @multiply_complex_f@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 21:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+multiply_complex_f ::
+     BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @a@
+  -> BG.Complex BG.CFloat
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Complex BG.CFloat)
+multiply_complex_f =
+  \a0 ->
+    \b1 ->
+      BG.with a0 (\a2 ->
+                    BG.with b1 (\b3 ->
+                                  BG.allocaAndPeek (\res4 ->
+                                                      hs_bindgen_e5e3172c2163672b a2 b3 res4)))
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_add_complex@
+foreign import ccall unsafe "hs_bindgen_28f2705e917973ab" hs_bindgen_28f2705e917973ab_base ::
+     BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_add_complex@
+hs_bindgen_28f2705e917973ab ::
+     BG.Ptr (BG.Complex BG.CDouble)
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> BG.Ptr (BG.Complex BG.CDouble)
+  -> IO ()
+hs_bindgen_28f2705e917973ab =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        hs_bindgen_28f2705e917973ab_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2)
+
+{-| __C declaration:__ @add_complex@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 22:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+add_complex ::
+     BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @a@
+  -> BG.Complex BG.CDouble
+     -- ^ __C declaration:__ @b@
+  -> IO (BG.Complex BG.CDouble)
+add_complex =
+  \a0 ->
+    \b1 ->
+      BG.with a0 (\a2 ->
+                    BG.with b1 (\b3 ->
+                                  BG.allocaAndPeek (\res4 ->
+                                                      hs_bindgen_28f2705e917973ab a2 b3 res4)))
diff --git a/test-artefacts/fixtures/types/complex/hsb_complex_test/bindingspec.yaml b/test-artefacts/fixtures/types/complex/hsb_complex_test/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/hsb_complex_test/bindingspec.yaml
@@ -0,0 +1,33 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/complex/hsb_complex_test.h
+  cname: struct complex_object_t
+  hsname: Complex_object_t
+- headers: types/complex/hsb_complex_test.h
+  cname: complex_object_t
+  hsname: Complex_object_t
+hstypes:
+- hsname: Complex_object_t
+  representation:
+    record:
+      constructor: Complex_object_t
+      fields:
+      - complex_object_t_velocity
+      - complex_object_t_position
+      - complex_object_t_id
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/complex/hsb_complex_test/th.txt b/test-artefacts/fixtures/types/complex/hsb_complex_test/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/hsb_complex_test/th.txt
@@ -0,0 +1,696 @@
+-- addDependentFile musl-include/x86_64/complex.h
+-- addDependentFile test-artefacts/headers/golden/types/complex/hsb_complex_test.h
+-- #include <types/complex/hsb_complex_test.h>
+-- void hs_bindgen_687af703c95fba0e (
+--   float _Complex *arg1,
+--   float _Complex *arg2,
+--   float _Complex *arg3
+-- )
+-- {
+--   *arg3 = (multiply_complex_f)(*arg1, *arg2);
+-- }
+-- void hs_bindgen_3ff14ee8c5914fc6 (
+--   double _Complex *arg1,
+--   double _Complex *arg2,
+--   double _Complex *arg3
+-- )
+-- {
+--   *arg3 = (add_complex)(*arg1, *arg2);
+-- }
+-- void hs_bindgen_e5e3172c2163672b (
+--   float _Complex *arg1,
+--   float _Complex *arg2,
+--   float _Complex *arg3
+-- )
+-- {
+--   *arg3 = (multiply_complex_f)(*arg1, *arg2);
+-- }
+-- void hs_bindgen_28f2705e917973ab (
+--   double _Complex *arg1,
+--   double _Complex *arg2,
+--   double _Complex *arg3
+-- )
+-- {
+--   *arg3 = (add_complex)(*arg1, *arg2);
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_multiply_complex_f */
+-- __attribute__ ((const))
+-- float _Complex (*hs_bindgen_29b4fea741132943 (void)) (
+--   float _Complex arg1,
+--   float _Complex arg2
+-- )
+-- {
+--   return &multiply_complex_f;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_add_complex */
+-- __attribute__ ((const))
+-- double _Complex (*hs_bindgen_b53577d6ad8dd36c (void)) (
+--   double _Complex arg1,
+--   double _Complex arg2
+-- )
+-- {
+--   return &add_complex;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_global_complex_float */
+-- __attribute__ ((const))
+-- float _Complex *hs_bindgen_209e61216da37381 (void)
+-- {
+--   return &global_complex_float;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_global_complex_double */
+-- __attribute__ ((const))
+-- double _Complex *hs_bindgen_4d0950cebe4897a7 (void)
+-- {
+--   return &global_complex_double;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_global_complex_float_flipped */
+-- __attribute__ ((const))
+-- float _Complex *hs_bindgen_7e9edc1d187b0799 (void)
+-- {
+--   return &global_complex_float_flipped;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_global_complex_double_flipped */
+-- __attribute__ ((const))
+-- double _Complex *hs_bindgen_fe8783b71a4e1d3c (void)
+-- {
+--   return &global_complex_double_flipped;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_global_Complex_float */
+-- __attribute__ ((const))
+-- float _Complex *hs_bindgen_0aa0098565c13195 (void)
+-- {
+--   return &global_Complex_float;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_global_Complex_double */
+-- __attribute__ ((const))
+-- double _Complex *hs_bindgen_5f43cb32dc9ef6af (void)
+-- {
+--   return &global_Complex_double;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_global_Complex_float_flipped */
+-- __attribute__ ((const))
+-- float _Complex *hs_bindgen_40d5347e1c2ae46a (void)
+-- {
+--   return &global_Complex_float_flipped;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_global_Complex_double_flipped */
+-- __attribute__ ((const))
+-- double _Complex *hs_bindgen_0e377cedb96a3ba4 (void)
+-- {
+--   return &global_Complex_double_flipped;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_const_complex_float */
+-- __attribute__ ((const))
+-- float _Complex const *hs_bindgen_d94307879b0a380f (void)
+-- {
+--   return &const_complex_float;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_const_complex_double */
+-- __attribute__ ((const))
+-- double _Complex const *hs_bindgen_de1422a11860ada5 (void)
+-- {
+--   return &const_complex_double;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_volatile_complex_float */
+-- __attribute__ ((const))
+-- float _Complex *hs_bindgen_569a907813a0dadd (void)
+-- {
+--   return &volatile_complex_float;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_volatile_complex_double */
+-- __attribute__ ((const))
+-- double _Complex *hs_bindgen_e86c9014eb507c96 (void)
+-- {
+--   return &volatile_complex_double;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_complex_float_array */
+-- __attribute__ ((const))
+-- float _Complex (*hs_bindgen_b548dda6b5993793 (void))[10]
+-- {
+--   return &complex_float_array;
+-- }
+-- /* test_typescomplexhsb_complex_test_Example_get_complex_double_array */
+-- __attribute__ ((const))
+-- double _Complex (*hs_bindgen_c56913da40952669 (void))[10]
+-- {
+--   return &complex_double_array;
+-- }
+{-| __C declaration:__ @struct complex_object_t@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 24:9@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+data Complex_object_t
+    = Complex_object_t {complex_object_t_velocity :: (Complex CFloat)
+                        {- ^ __C declaration:__ @velocity@
+
+                             __defined at:__ @types\/complex\/hsb_complex_test.h 25:20@
+
+                             __exported by:__ @types\/complex\/hsb_complex_test.h@
+                        -},
+                        complex_object_t_position :: (Complex CDouble)
+                        {- ^ __C declaration:__ @position@
+
+                             __defined at:__ @types\/complex\/hsb_complex_test.h 26:20@
+
+                             __exported by:__ @types\/complex\/hsb_complex_test.h@
+                        -},
+                        complex_object_t_id :: CInt
+                        {- ^ __C declaration:__ @id@
+
+                             __defined at:__ @types\/complex\/hsb_complex_test.h 27:9@
+
+                             __exported by:__ @types\/complex\/hsb_complex_test.h@
+                        -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Complex_object_t
+    where staticSizeOf = \_ -> 32 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Complex_object_t
+    where readRaw = \ptr_0 -> ((pure Complex_object_t <*> readRaw (Proxy @"complex_object_t_velocity") ptr_0) <*> readRaw (Proxy @"complex_object_t_position") ptr_0) <*> readRaw (Proxy @"complex_object_t_id") ptr_0
+instance WriteRaw Complex_object_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Complex_object_t complex_object_t_velocity_2
+                                                        complex_object_t_position_3
+                                                        complex_object_t_id_4 -> writeRaw (Proxy @"complex_object_t_velocity") ptr_0 complex_object_t_velocity_2 >> (writeRaw (Proxy @"complex_object_t_position") ptr_0 complex_object_t_position_3 >> writeRaw (Proxy @"complex_object_t_id") ptr_0 complex_object_t_id_4)
+deriving via (EquivStorable Complex_object_t) instance Storable Complex_object_t
+deriving via (IsStructViaReadRaw Complex_object_t) instance IsStruct Complex_object_t
+instance (~) ty (Complex CFloat) =>
+         HasField "complex_object_t_velocity" Complex_object_t ty
+    where hasField = \x_0 -> (\y_1 -> Complex_object_t{complex_object_t_velocity = y_1,
+                                                       complex_object_t_position = getField @"complex_object_t_position" x_0,
+                                                       complex_object_t_id = getField @"complex_object_t_id" x_0},
+                              getField @"complex_object_t_velocity" x_0)
+instance (~) ty (Complex CFloat) =>
+         HasField "complex_object_t_velocity"
+                  (Ptr Complex_object_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"complex_object_t_velocity")
+instance HasCField Complex_object_t "complex_object_t_velocity"
+    where type CFieldType Complex_object_t
+                          "complex_object_t_velocity" = Complex CFloat
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Complex CDouble) =>
+         HasField "complex_object_t_position" Complex_object_t ty
+    where hasField = \x_0 -> (\y_1 -> Complex_object_t{complex_object_t_position = y_1,
+                                                       complex_object_t_velocity = getField @"complex_object_t_velocity" x_0,
+                                                       complex_object_t_id = getField @"complex_object_t_id" x_0},
+                              getField @"complex_object_t_position" x_0)
+instance (~) ty (Complex CDouble) =>
+         HasField "complex_object_t_position"
+                  (Ptr Complex_object_t)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"complex_object_t_position")
+instance HasCField Complex_object_t "complex_object_t_position"
+    where type CFieldType Complex_object_t
+                          "complex_object_t_position" = Complex CDouble
+          offset# = \_ -> \_ -> 8
+instance (~) ty CInt =>
+         HasField "complex_object_t_id" Complex_object_t ty
+    where hasField = \x_0 -> (\y_1 -> Complex_object_t{complex_object_t_id = y_1,
+                                                       complex_object_t_velocity = getField @"complex_object_t_velocity" x_0,
+                                                       complex_object_t_position = getField @"complex_object_t_position" x_0},
+                              getField @"complex_object_t_id" x_0)
+instance (~) ty CInt =>
+         HasField "complex_object_t_id" (Ptr Complex_object_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"complex_object_t_id")
+instance HasCField Complex_object_t "complex_object_t_id"
+    where type CFieldType Complex_object_t "complex_object_t_id" = CInt
+          offset# = \_ -> \_ -> 24
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_multiply_complex_f@
+foreign import ccall safe "hs_bindgen_687af703c95fba0e" hs_bindgen_687af703c95fba0e_base ::
+    Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_multiply_complex_f@
+hs_bindgen_687af703c95fba0e :: Ptr (Complex CFloat) ->
+                               Ptr (Complex CFloat) -> Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_multiply_complex_f@
+hs_bindgen_687af703c95fba0e = \x_0 -> \x_1 -> \x_2 -> hs_bindgen_687af703c95fba0e_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2)
+{-| __C declaration:__ @multiply_complex_f@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 21:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+multiply_complex_f_safe :: Complex CFloat ->
+                           Complex CFloat -> IO (Complex CFloat)
+{-| __C declaration:__ @multiply_complex_f@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 21:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+multiply_complex_f_safe = \a_0 -> \b_1 -> with a_0 (\a_2 -> with b_1 (\b_3 -> allocaAndPeek (\res_4 -> hs_bindgen_687af703c95fba0e a_2 b_3 res_4)))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_add_complex@
+foreign import ccall safe "hs_bindgen_3ff14ee8c5914fc6" hs_bindgen_3ff14ee8c5914fc6_base ::
+    Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_add_complex@
+hs_bindgen_3ff14ee8c5914fc6 :: Ptr (Complex CDouble) ->
+                               Ptr (Complex CDouble) -> Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Safe_add_complex@
+hs_bindgen_3ff14ee8c5914fc6 = \x_0 -> \x_1 -> \x_2 -> hs_bindgen_3ff14ee8c5914fc6_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2)
+{-| __C declaration:__ @add_complex@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 22:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+add_complex_safe :: Complex CDouble ->
+                    Complex CDouble -> IO (Complex CDouble)
+{-| __C declaration:__ @add_complex@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 22:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+add_complex_safe = \a_0 -> \b_1 -> with a_0 (\a_2 -> with b_1 (\b_3 -> allocaAndPeek (\res_4 -> hs_bindgen_3ff14ee8c5914fc6 a_2 b_3 res_4)))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_multiply_complex_f@
+foreign import ccall unsafe "hs_bindgen_e5e3172c2163672b" hs_bindgen_e5e3172c2163672b_base ::
+    Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_multiply_complex_f@
+hs_bindgen_e5e3172c2163672b :: Ptr (Complex CFloat) ->
+                               Ptr (Complex CFloat) -> Ptr (Complex CFloat) -> IO ()
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_multiply_complex_f@
+hs_bindgen_e5e3172c2163672b = \x_0 -> \x_1 -> \x_2 -> hs_bindgen_e5e3172c2163672b_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2)
+{-| __C declaration:__ @multiply_complex_f@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 21:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+multiply_complex_f_unsafe :: Complex CFloat ->
+                             Complex CFloat -> IO (Complex CFloat)
+{-| __C declaration:__ @multiply_complex_f@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 21:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+multiply_complex_f_unsafe = \a_0 -> \b_1 -> with a_0 (\a_2 -> with b_1 (\b_3 -> allocaAndPeek (\res_4 -> hs_bindgen_e5e3172c2163672b a_2 b_3 res_4)))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_add_complex@
+foreign import ccall unsafe "hs_bindgen_28f2705e917973ab" hs_bindgen_28f2705e917973ab_base ::
+    Ptr Void
+ -> Ptr Void
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_add_complex@
+hs_bindgen_28f2705e917973ab :: Ptr (Complex CDouble) ->
+                               Ptr (Complex CDouble) -> Ptr (Complex CDouble) -> IO ()
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_Unsafe_add_complex@
+hs_bindgen_28f2705e917973ab = \x_0 -> \x_1 -> \x_2 -> hs_bindgen_28f2705e917973ab_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2)
+{-| __C declaration:__ @add_complex@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 22:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+add_complex_unsafe :: Complex CDouble ->
+                      Complex CDouble -> IO (Complex CDouble)
+{-| __C declaration:__ @add_complex@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 22:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+add_complex_unsafe = \a_0 -> \b_1 -> with a_0 (\a_2 -> with b_1 (\b_3 -> allocaAndPeek (\res_4 -> hs_bindgen_28f2705e917973ab a_2 b_3 res_4)))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_multiply_complex_f@
+foreign import ccall unsafe "hs_bindgen_29b4fea741132943" hs_bindgen_29b4fea741132943_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_multiply_complex_f@
+hs_bindgen_29b4fea741132943 :: IO (FunPtr (Complex CFloat ->
+                                           Complex CFloat -> IO (Complex CFloat)))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_multiply_complex_f@
+hs_bindgen_29b4fea741132943 = fmap fromFFIType hs_bindgen_29b4fea741132943_base
+{-# NOINLINE multiply_complex_f_funptr #-}
+{-| __C declaration:__ @multiply_complex_f@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 21:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+multiply_complex_f_funptr :: FunPtr (Complex CFloat ->
+                                     Complex CFloat -> IO (Complex CFloat))
+{-| __C declaration:__ @multiply_complex_f@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 21:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+multiply_complex_f_funptr = unsafePerformIO hs_bindgen_29b4fea741132943
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_add_complex@
+foreign import ccall unsafe "hs_bindgen_b53577d6ad8dd36c" hs_bindgen_b53577d6ad8dd36c_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_add_complex@
+hs_bindgen_b53577d6ad8dd36c :: IO (FunPtr (Complex CDouble ->
+                                           Complex CDouble -> IO (Complex CDouble)))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_add_complex@
+hs_bindgen_b53577d6ad8dd36c = fmap fromFFIType hs_bindgen_b53577d6ad8dd36c_base
+{-# NOINLINE add_complex_funptr #-}
+{-| __C declaration:__ @add_complex@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 22:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+add_complex_funptr :: FunPtr (Complex CDouble ->
+                              Complex CDouble -> IO (Complex CDouble))
+{-| __C declaration:__ @add_complex@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 22:16@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+add_complex_funptr = unsafePerformIO hs_bindgen_b53577d6ad8dd36c
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float@
+foreign import ccall unsafe "hs_bindgen_209e61216da37381" hs_bindgen_209e61216da37381_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float@
+hs_bindgen_209e61216da37381 :: IO (Ptr (Complex CFloat))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float@
+hs_bindgen_209e61216da37381 = fmap fromFFIType hs_bindgen_209e61216da37381_base
+{-# NOINLINE global_complex_float #-}
+{-| __C declaration:__ @global_complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 3:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_float :: Ptr (Complex CFloat)
+{-| __C declaration:__ @global_complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 3:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_float = unsafePerformIO hs_bindgen_209e61216da37381
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double@
+foreign import ccall unsafe "hs_bindgen_4d0950cebe4897a7" hs_bindgen_4d0950cebe4897a7_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double@
+hs_bindgen_4d0950cebe4897a7 :: IO (Ptr (Complex CDouble))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double@
+hs_bindgen_4d0950cebe4897a7 = fmap fromFFIType hs_bindgen_4d0950cebe4897a7_base
+{-# NOINLINE global_complex_double #-}
+{-| __C declaration:__ @global_complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 4:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_double :: Ptr (Complex CDouble)
+{-| __C declaration:__ @global_complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 4:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_double = unsafePerformIO hs_bindgen_4d0950cebe4897a7
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float_flipped@
+foreign import ccall unsafe "hs_bindgen_7e9edc1d187b0799" hs_bindgen_7e9edc1d187b0799_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float_flipped@
+hs_bindgen_7e9edc1d187b0799 :: IO (Ptr (Complex CFloat))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_float_flipped@
+hs_bindgen_7e9edc1d187b0799 = fmap fromFFIType hs_bindgen_7e9edc1d187b0799_base
+{-# NOINLINE global_complex_float_flipped #-}
+{-| __C declaration:__ @global_complex_float_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 6:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_float_flipped :: Ptr (Complex CFloat)
+{-| __C declaration:__ @global_complex_float_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 6:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_float_flipped = unsafePerformIO hs_bindgen_7e9edc1d187b0799
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double_flipped@
+foreign import ccall unsafe "hs_bindgen_fe8783b71a4e1d3c" hs_bindgen_fe8783b71a4e1d3c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double_flipped@
+hs_bindgen_fe8783b71a4e1d3c :: IO (Ptr (Complex CDouble))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_complex_double_flipped@
+hs_bindgen_fe8783b71a4e1d3c = fmap fromFFIType hs_bindgen_fe8783b71a4e1d3c_base
+{-# NOINLINE global_complex_double_flipped #-}
+{-| __C declaration:__ @global_complex_double_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 7:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_double_flipped :: Ptr (Complex CDouble)
+{-| __C declaration:__ @global_complex_double_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 7:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_complex_double_flipped = unsafePerformIO hs_bindgen_fe8783b71a4e1d3c
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float@
+foreign import ccall unsafe "hs_bindgen_0aa0098565c13195" hs_bindgen_0aa0098565c13195_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float@
+hs_bindgen_0aa0098565c13195 :: IO (Ptr (Complex CFloat))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float@
+hs_bindgen_0aa0098565c13195 = fmap fromFFIType hs_bindgen_0aa0098565c13195_base
+{-# NOINLINE global_Complex_float #-}
+{-| __C declaration:__ @global_Complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 9:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_float :: Ptr (Complex CFloat)
+{-| __C declaration:__ @global_Complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 9:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_float = unsafePerformIO hs_bindgen_0aa0098565c13195
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double@
+foreign import ccall unsafe "hs_bindgen_5f43cb32dc9ef6af" hs_bindgen_5f43cb32dc9ef6af_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double@
+hs_bindgen_5f43cb32dc9ef6af :: IO (Ptr (Complex CDouble))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double@
+hs_bindgen_5f43cb32dc9ef6af = fmap fromFFIType hs_bindgen_5f43cb32dc9ef6af_base
+{-# NOINLINE global_Complex_double #-}
+{-| __C declaration:__ @global_Complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 10:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_double :: Ptr (Complex CDouble)
+{-| __C declaration:__ @global_Complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 10:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_double = unsafePerformIO hs_bindgen_5f43cb32dc9ef6af
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float_flipped@
+foreign import ccall unsafe "hs_bindgen_40d5347e1c2ae46a" hs_bindgen_40d5347e1c2ae46a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float_flipped@
+hs_bindgen_40d5347e1c2ae46a :: IO (Ptr (Complex CFloat))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_float_flipped@
+hs_bindgen_40d5347e1c2ae46a = fmap fromFFIType hs_bindgen_40d5347e1c2ae46a_base
+{-# NOINLINE global_Complex_float_flipped #-}
+{-| __C declaration:__ @global_Complex_float_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 12:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_float_flipped :: Ptr (Complex CFloat)
+{-| __C declaration:__ @global_Complex_float_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 12:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_float_flipped = unsafePerformIO hs_bindgen_40d5347e1c2ae46a
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double_flipped@
+foreign import ccall unsafe "hs_bindgen_0e377cedb96a3ba4" hs_bindgen_0e377cedb96a3ba4_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double_flipped@
+hs_bindgen_0e377cedb96a3ba4 :: IO (Ptr (Complex CDouble))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_global_Complex_double_flipped@
+hs_bindgen_0e377cedb96a3ba4 = fmap fromFFIType hs_bindgen_0e377cedb96a3ba4_base
+{-# NOINLINE global_Complex_double_flipped #-}
+{-| __C declaration:__ @global_Complex_double_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 13:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_double_flipped :: Ptr (Complex CDouble)
+{-| __C declaration:__ @global_Complex_double_flipped@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 13:24@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+global_Complex_double_flipped = unsafePerformIO hs_bindgen_0e377cedb96a3ba4
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_float@
+foreign import ccall unsafe "hs_bindgen_d94307879b0a380f" hs_bindgen_d94307879b0a380f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_float@
+hs_bindgen_d94307879b0a380f :: IO (PtrConst (Complex CFloat))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_float@
+hs_bindgen_d94307879b0a380f = fmap fromFFIType hs_bindgen_d94307879b0a380f_base
+{-# NOINLINE hs_bindgen_554ede1a618d726f #-}
+{-| __C declaration:__ @const_complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 15:29@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+
+    __unique:__ @test_typescomplexhsb_complex_test_Example_const_complex_float@
+-}
+hs_bindgen_554ede1a618d726f :: PtrConst (Complex CFloat)
+{-| __C declaration:__ @const_complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 15:29@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+
+    __unique:__ @test_typescomplexhsb_complex_test_Example_const_complex_float@
+-}
+hs_bindgen_554ede1a618d726f = unsafePerformIO hs_bindgen_d94307879b0a380f
+{-# NOINLINE const_complex_float #-}
+const_complex_float :: Complex CFloat
+const_complex_float = unsafePerformIO (peek hs_bindgen_554ede1a618d726f)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_double@
+foreign import ccall unsafe "hs_bindgen_de1422a11860ada5" hs_bindgen_de1422a11860ada5_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_double@
+hs_bindgen_de1422a11860ada5 :: IO (PtrConst (Complex CDouble))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_const_complex_double@
+hs_bindgen_de1422a11860ada5 = fmap fromFFIType hs_bindgen_de1422a11860ada5_base
+{-# NOINLINE hs_bindgen_cf751023874b527f #-}
+{-| __C declaration:__ @const_complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 16:29@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+
+    __unique:__ @test_typescomplexhsb_complex_test_Example_const_complex_double@
+-}
+hs_bindgen_cf751023874b527f :: PtrConst (Complex CDouble)
+{-| __C declaration:__ @const_complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 16:29@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+
+    __unique:__ @test_typescomplexhsb_complex_test_Example_const_complex_double@
+-}
+hs_bindgen_cf751023874b527f = unsafePerformIO hs_bindgen_de1422a11860ada5
+{-# NOINLINE const_complex_double #-}
+const_complex_double :: Complex CDouble
+const_complex_double = unsafePerformIO (peek hs_bindgen_cf751023874b527f)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_float@
+foreign import ccall unsafe "hs_bindgen_569a907813a0dadd" hs_bindgen_569a907813a0dadd_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_float@
+hs_bindgen_569a907813a0dadd :: IO (Ptr (Complex CFloat))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_float@
+hs_bindgen_569a907813a0dadd = fmap fromFFIType hs_bindgen_569a907813a0dadd_base
+{-# NOINLINE volatile_complex_float #-}
+{-| __C declaration:__ @volatile_complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 18:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+volatile_complex_float :: Ptr (Complex CFloat)
+{-| __C declaration:__ @volatile_complex_float@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 18:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+volatile_complex_float = unsafePerformIO hs_bindgen_569a907813a0dadd
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_double@
+foreign import ccall unsafe "hs_bindgen_e86c9014eb507c96" hs_bindgen_e86c9014eb507c96_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_double@
+hs_bindgen_e86c9014eb507c96 :: IO (Ptr (Complex CDouble))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_volatile_complex_double@
+hs_bindgen_e86c9014eb507c96 = fmap fromFFIType hs_bindgen_e86c9014eb507c96_base
+{-# NOINLINE volatile_complex_double #-}
+{-| __C declaration:__ @volatile_complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 19:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+volatile_complex_double :: Ptr (Complex CDouble)
+{-| __C declaration:__ @volatile_complex_double@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 19:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+volatile_complex_double = unsafePerformIO hs_bindgen_e86c9014eb507c96
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_float_array@
+foreign import ccall unsafe "hs_bindgen_b548dda6b5993793" hs_bindgen_b548dda6b5993793_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_float_array@
+hs_bindgen_b548dda6b5993793 :: IO (Ptr (ConstantArray 10
+                                                      (Complex CFloat)))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_float_array@
+hs_bindgen_b548dda6b5993793 = fmap fromFFIType hs_bindgen_b548dda6b5993793_base
+{-# NOINLINE complex_float_array #-}
+{-| __C declaration:__ @complex_float_array@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 30:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+complex_float_array :: Ptr (ConstantArray 10 (Complex CFloat))
+{-| __C declaration:__ @complex_float_array@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 30:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+complex_float_array = unsafePerformIO hs_bindgen_b548dda6b5993793
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_double_array@
+foreign import ccall unsafe "hs_bindgen_c56913da40952669" hs_bindgen_c56913da40952669_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_double_array@
+hs_bindgen_c56913da40952669 :: IO (Ptr (ConstantArray 10
+                                                      (Complex CDouble)))
+-- __unique:__ @test_typescomplexhsb_complex_test_Example_get_complex_double_array@
+hs_bindgen_c56913da40952669 = fmap fromFFIType hs_bindgen_c56913da40952669_base
+{-# NOINLINE complex_double_array #-}
+{-| __C declaration:__ @complex_double_array@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 31:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+complex_double_array :: Ptr (ConstantArray 10 (Complex CDouble))
+{-| __C declaration:__ @complex_double_array@
+
+    __defined at:__ @types\/complex\/hsb_complex_test.h 31:23@
+
+    __exported by:__ @types\/complex\/hsb_complex_test.h@
+-}
+complex_double_array = unsafePerformIO hs_bindgen_c56913da40952669
diff --git a/test-artefacts/fixtures/types/complex/vector_test/Example.hs b/test-artefacts/fixtures/types/complex/vector_test/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/vector_test/Example.hs
@@ -0,0 +1,132 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Vector(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 1:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+data Vector = Vector
+  { vector_x :: BG.CDouble
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/complex\/vector_test.h 2:12@
+
+         __exported by:__ @types\/complex\/vector_test.h@
+    -}
+  , vector_y :: BG.CDouble
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/complex\/vector_test.h 3:12@
+
+         __exported by:__ @types\/complex\/vector_test.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Vector where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Vector where
+
+  readRaw =
+    \ptr0 ->
+          pure Vector
+      <*> HasCField.readRaw (BG.Proxy @"vector_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"vector_y") ptr0
+
+instance Marshal.WriteRaw Vector where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Vector vector_x2 vector_y3 ->
+               HasCField.writeRaw (BG.Proxy @"vector_x") ptr0 vector_x2
+            >> HasCField.writeRaw (BG.Proxy @"vector_y") ptr0 vector_y3
+
+deriving via Marshal.EquivStorable Vector instance BG.Storable Vector
+
+deriving via Struct.IsStructViaReadRaw Vector instance Struct.IsStruct Vector
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/complex\/vector_test.h 2:12@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "vector_x" Vector ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Vector {vector_x = y1, vector_y = BG.getField @"vector_y" x0}
+      , BG.getField @"vector_x" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "vector_x" (BG.Ptr Vector) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vector_x")
+
+instance HasCField.HasCField Vector "vector_x" where
+
+  type CFieldType Vector "vector_x" = BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/complex\/vector_test.h 3:12@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "vector_y" Vector ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Vector {vector_y = y1, vector_x = BG.getField @"vector_x" x0}
+      , BG.getField @"vector_y" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "vector_y" (BG.Ptr Vector) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"vector_y")
+
+instance HasCField.HasCField Vector "vector_y" where
+
+  type CFieldType Vector "vector_y" = BG.CDouble
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/complex/vector_test/Example/FunPtr.hs b/test-artefacts/fixtures/types/complex/vector_test/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/vector_test/Example/FunPtr.hs
@@ -0,0 +1,47 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.new_vector
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/complex/vector_test.h>"
+  , "/* test_typescomplexvector_test_Example_get_new_vector */"
+  , "__attribute__ ((const))"
+  , "vector *(*hs_bindgen_cb36cf0957839e33 (void)) ("
+  , "  double arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return &new_vector;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typescomplexvector_test_Example_get_new_vector@
+foreign import ccall unsafe "hs_bindgen_cb36cf0957839e33" hs_bindgen_cb36cf0957839e33_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typescomplexvector_test_Example_get_new_vector@
+hs_bindgen_cb36cf0957839e33 :: IO (BG.FunPtr (BG.CDouble -> BG.CDouble -> IO (BG.Ptr Vector)))
+hs_bindgen_cb36cf0957839e33 =
+  fmap BG.fromFFIType hs_bindgen_cb36cf0957839e33_base
+
+{-# NOINLINE new_vector #-}
+{-| __C declaration:__ @new_vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 6:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+new_vector :: BG.FunPtr (BG.CDouble -> BG.CDouble -> IO (BG.Ptr Vector))
+new_vector =
+  BG.unsafePerformIO hs_bindgen_cb36cf0957839e33
diff --git a/test-artefacts/fixtures/types/complex/vector_test/Example/Safe.hs b/test-artefacts/fixtures/types/complex/vector_test/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/vector_test/Example/Safe.hs
@@ -0,0 +1,55 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.new_vector
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/complex/vector_test.h>"
+  , "vector *hs_bindgen_cd5f566bc96dcba0 ("
+  , "  double arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (new_vector)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typescomplexvector_test_Example_Safe_new_vector@
+foreign import ccall safe "hs_bindgen_cd5f566bc96dcba0" hs_bindgen_cd5f566bc96dcba0_base ::
+     BG.CDouble
+  -> BG.CDouble
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexvector_test_Example_Safe_new_vector@
+hs_bindgen_cd5f566bc96dcba0 ::
+     BG.CDouble
+  -> BG.CDouble
+  -> IO (BG.Ptr Vector)
+hs_bindgen_cd5f566bc96dcba0 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_cd5f566bc96dcba0_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @new_vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 6:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+new_vector ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr Vector)
+new_vector = hs_bindgen_cd5f566bc96dcba0
diff --git a/test-artefacts/fixtures/types/complex/vector_test/Example/Unsafe.hs b/test-artefacts/fixtures/types/complex/vector_test/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/vector_test/Example/Unsafe.hs
@@ -0,0 +1,55 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.new_vector
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/complex/vector_test.h>"
+  , "vector *hs_bindgen_1af353788955c7a2 ("
+  , "  double arg1,"
+  , "  double arg2"
+  , ")"
+  , "{"
+  , "  return (new_vector)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typescomplexvector_test_Example_Unsafe_new_vector@
+foreign import ccall unsafe "hs_bindgen_1af353788955c7a2" hs_bindgen_1af353788955c7a2_base ::
+     BG.CDouble
+  -> BG.CDouble
+  -> IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typescomplexvector_test_Example_Unsafe_new_vector@
+hs_bindgen_1af353788955c7a2 ::
+     BG.CDouble
+  -> BG.CDouble
+  -> IO (BG.Ptr Vector)
+hs_bindgen_1af353788955c7a2 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_1af353788955c7a2_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @new_vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 6:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+new_vector ::
+     BG.CDouble
+     -- ^ __C declaration:__ @x@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @y@
+  -> IO (BG.Ptr Vector)
+new_vector = hs_bindgen_1af353788955c7a2
diff --git a/test-artefacts/fixtures/types/complex/vector_test/bindingspec.yaml b/test-artefacts/fixtures/types/complex/vector_test/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/vector_test/bindingspec.yaml
@@ -0,0 +1,32 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/complex/vector_test.h
+  cname: struct vector
+  hsname: Vector
+- headers: types/complex/vector_test.h
+  cname: vector
+  hsname: Vector
+hstypes:
+- hsname: Vector
+  representation:
+    record:
+      constructor: Vector
+      fields:
+      - vector_x
+      - vector_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/complex/vector_test/th.txt b/test-artefacts/fixtures/types/complex/vector_test/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/complex/vector_test/th.txt
@@ -0,0 +1,149 @@
+-- addDependentFile test-artefacts/headers/golden/types/complex/vector_test.h
+-- #include <types/complex/vector_test.h>
+-- vector *hs_bindgen_cd5f566bc96dcba0 (
+--   double arg1,
+--   double arg2
+-- )
+-- {
+--   return (new_vector)(arg1, arg2);
+-- }
+-- vector *hs_bindgen_1af353788955c7a2 (
+--   double arg1,
+--   double arg2
+-- )
+-- {
+--   return (new_vector)(arg1, arg2);
+-- }
+-- /* test_typescomplexvector_test_Example_get_new_vector */
+-- __attribute__ ((const))
+-- vector *(*hs_bindgen_cb36cf0957839e33 (void)) (
+--   double arg1,
+--   double arg2
+-- )
+-- {
+--   return &new_vector;
+-- }
+{-| __C declaration:__ @struct vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 1:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+data Vector
+    = Vector {vector_x :: CDouble
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @types\/complex\/vector_test.h 2:12@
+
+                   __exported by:__ @types\/complex\/vector_test.h@
+              -},
+              vector_y :: CDouble
+              {- ^ __C declaration:__ @y@
+
+                   __defined at:__ @types\/complex\/vector_test.h 3:12@
+
+                   __exported by:__ @types\/complex\/vector_test.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Vector
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Vector
+    where readRaw = \ptr_0 -> (pure Vector <*> readRaw (Proxy @"vector_x") ptr_0) <*> readRaw (Proxy @"vector_y") ptr_0
+instance WriteRaw Vector
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Vector vector_x_2
+                                              vector_y_3 -> writeRaw (Proxy @"vector_x") ptr_0 vector_x_2 >> writeRaw (Proxy @"vector_y") ptr_0 vector_y_3
+deriving via (EquivStorable Vector) instance Storable Vector
+deriving via (IsStructViaReadRaw Vector) instance IsStruct Vector
+instance (~) ty CDouble => HasField "vector_x" Vector ty
+    where hasField = \x_0 -> (\y_1 -> Vector{vector_x = y_1,
+                                             vector_y = getField @"vector_y" x_0},
+                              getField @"vector_x" x_0)
+instance (~) ty CDouble =>
+         HasField "vector_x" (Ptr Vector) (Ptr ty)
+    where getField = fromPtr (Proxy @"vector_x")
+instance HasCField Vector "vector_x"
+    where type CFieldType Vector "vector_x" = CDouble
+          offset# = \_ -> \_ -> 0
+instance (~) ty CDouble => HasField "vector_y" Vector ty
+    where hasField = \x_0 -> (\y_1 -> Vector{vector_y = y_1,
+                                             vector_x = getField @"vector_x" x_0},
+                              getField @"vector_y" x_0)
+instance (~) ty CDouble =>
+         HasField "vector_y" (Ptr Vector) (Ptr ty)
+    where getField = fromPtr (Proxy @"vector_y")
+instance HasCField Vector "vector_y"
+    where type CFieldType Vector "vector_y" = CDouble
+          offset# = \_ -> \_ -> 8
+-- __unique:__ @test_typescomplexvector_test_Example_Safe_new_vector@
+foreign import ccall safe "hs_bindgen_cd5f566bc96dcba0" hs_bindgen_cd5f566bc96dcba0_base ::
+    CDouble
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @test_typescomplexvector_test_Example_Safe_new_vector@
+hs_bindgen_cd5f566bc96dcba0 :: CDouble ->
+                               CDouble -> IO (Ptr Vector)
+-- __unique:__ @test_typescomplexvector_test_Example_Safe_new_vector@
+hs_bindgen_cd5f566bc96dcba0 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_cd5f566bc96dcba0_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @new_vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 6:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+new_vector_safe :: CDouble -> CDouble -> IO (Ptr Vector)
+{-| __C declaration:__ @new_vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 6:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+new_vector_safe = hs_bindgen_cd5f566bc96dcba0
+-- __unique:__ @test_typescomplexvector_test_Example_Unsafe_new_vector@
+foreign import ccall unsafe "hs_bindgen_1af353788955c7a2" hs_bindgen_1af353788955c7a2_base ::
+    CDouble
+ -> CDouble
+ -> IO (Ptr Void)
+-- __unique:__ @test_typescomplexvector_test_Example_Unsafe_new_vector@
+hs_bindgen_1af353788955c7a2 :: CDouble ->
+                               CDouble -> IO (Ptr Vector)
+-- __unique:__ @test_typescomplexvector_test_Example_Unsafe_new_vector@
+hs_bindgen_1af353788955c7a2 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_1af353788955c7a2_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @new_vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 6:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+new_vector_unsafe :: CDouble -> CDouble -> IO (Ptr Vector)
+{-| __C declaration:__ @new_vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 6:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+new_vector_unsafe = hs_bindgen_1af353788955c7a2
+-- __unique:__ @test_typescomplexvector_test_Example_get_new_vector@
+foreign import ccall unsafe "hs_bindgen_cb36cf0957839e33" hs_bindgen_cb36cf0957839e33_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typescomplexvector_test_Example_get_new_vector@
+hs_bindgen_cb36cf0957839e33 :: IO (FunPtr (CDouble ->
+                                           CDouble -> IO (Ptr Vector)))
+-- __unique:__ @test_typescomplexvector_test_Example_get_new_vector@
+hs_bindgen_cb36cf0957839e33 = fmap fromFFIType hs_bindgen_cb36cf0957839e33_base
+{-# NOINLINE new_vector_funptr #-}
+{-| __C declaration:__ @new_vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 6:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+new_vector_funptr :: FunPtr (CDouble -> CDouble -> IO (Ptr Vector))
+{-| __C declaration:__ @new_vector@
+
+    __defined at:__ @types\/complex\/vector_test.h 6:9@
+
+    __exported by:__ @types\/complex\/vector_test.h@
+-}
+new_vector_funptr = unsafePerformIO hs_bindgen_cb36cf0957839e33
diff --git a/test-artefacts/fixtures/types/enums/enum_cpp_syntax/Example.hs b/test-artefacts/fixtures/types/enums/enum_cpp_syntax/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/enum_cpp_syntax/Example.hs
@@ -0,0 +1,159 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo_enum(..)
+    , pattern Example.A
+    , pattern Example.B
+    , pattern Example.C
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum foo_enum@
+
+    __defined at:__ @types\/enums\/enum_cpp_syntax.h 4:9@
+
+    __exported by:__ @types\/enums\/enum_cpp_syntax.h@
+-}
+newtype Foo_enum = Foo_enum
+  { unwrapFoo_enum :: HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Foo_enum where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Foo_enum where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo_enum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Foo_enum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo_enum unwrapFoo_enum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapFoo_enum2
+
+deriving via Marshal.EquivStorable Foo_enum instance BG.Storable Foo_enum
+
+deriving via HsBindgen.Runtime.LibC.Word32 instance BG.Prim Foo_enum
+
+instance CEnum.CEnum Foo_enum where
+
+  type CEnumZ Foo_enum = HsBindgen.Runtime.LibC.Word32
+
+  toCEnum = Foo_enum
+
+  fromCEnum = BG.getField @"unwrapFoo_enum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "A"), (1, BG.singleton "B"), (2, BG.singleton "C")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Foo_enum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Foo_enum"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Foo_enum where
+
+  minDeclaredValue = A
+
+  maxDeclaredValue = C
+
+instance Show Foo_enum where
+
+  showsPrec = CEnum.shows
+
+instance Read Foo_enum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "unwrapFoo_enum" Foo_enum ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Foo_enum {unwrapFoo_enum = y1}, BG.getField @"unwrapFoo_enum" x0)
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "unwrapFoo_enum" (BG.Ptr Foo_enum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFoo_enum")
+
+instance HasCField.HasCField Foo_enum "unwrapFoo_enum" where
+
+  type CFieldType Foo_enum "unwrapFoo_enum" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @A@
+
+    __defined at:__ @types\/enums\/enum_cpp_syntax.h 4:27@
+
+    __exported by:__ @types\/enums\/enum_cpp_syntax.h@
+-}
+pattern A :: Foo_enum
+pattern A = Foo_enum 0
+
+{-| __C declaration:__ @B@
+
+    __defined at:__ @types\/enums\/enum_cpp_syntax.h 4:30@
+
+    __exported by:__ @types\/enums\/enum_cpp_syntax.h@
+-}
+pattern B :: Foo_enum
+pattern B = Foo_enum 1
+
+{-| __C declaration:__ @C@
+
+    __defined at:__ @types\/enums\/enum_cpp_syntax.h 4:33@
+
+    __exported by:__ @types\/enums\/enum_cpp_syntax.h@
+-}
+pattern C :: Foo_enum
+pattern C = Foo_enum 2
diff --git a/test-artefacts/fixtures/types/enums/enum_cpp_syntax/bindingspec.yaml b/test-artefacts/fixtures/types/enums/enum_cpp_syntax/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/enum_cpp_syntax/bindingspec.yaml
@@ -0,0 +1,40 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/enums/enum_cpp_syntax.h
+  cname: enum foo_enum
+  hsname: Foo_enum
+  enum: open
+- headers: types/enums/enum_cpp_syntax.h
+  cname: foo_enum
+  hsname: Foo_enum
+hstypes:
+- hsname: Foo_enum
+  representation:
+    newtype:
+      constructor: Foo_enum
+      fields:
+      - unwrapFoo_enum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word32
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/enums/enum_cpp_syntax/th.txt b/test-artefacts/fixtures/types/enums/enum_cpp_syntax/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/enum_cpp_syntax/th.txt
@@ -0,0 +1,79 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile test-artefacts/headers/golden/types/enums/enum_cpp_syntax.h
+{-| __C declaration:__ @enum foo_enum@
+
+    __defined at:__ @types\/enums\/enum_cpp_syntax.h 4:9@
+
+    __exported by:__ @types\/enums\/enum_cpp_syntax.h@
+-}
+newtype Foo_enum
+    = Foo_enum {unwrapFoo_enum :: HsBindgen.Runtime.LibC.Word32}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Foo_enum
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Foo_enum
+    where readRaw = \ptr_0 -> pure Foo_enum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Foo_enum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo_enum unwrapFoo_enum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapFoo_enum_2
+deriving via (EquivStorable Foo_enum) instance Storable Foo_enum
+deriving via HsBindgen.Runtime.LibC.Word32 instance Prim Foo_enum
+instance CEnum Foo_enum
+    where type CEnumZ Foo_enum = HsBindgen.Runtime.LibC.Word32
+          toCEnum = Foo_enum
+          fromCEnum = getField @"unwrapFoo_enum"
+          declaredValues = \_ -> declaredValuesFromList [(0, singleton "A"),
+                                                         (1, singleton "B"),
+                                                         (2, singleton "C")]
+          showsUndeclared = showsWrappedUndeclared "Foo_enum"
+          readPrecUndeclared = readPrecWrappedUndeclared "Foo_enum"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Foo_enum
+    where minDeclaredValue = A
+          maxDeclaredValue = C
+instance Show Foo_enum
+    where showsPrec = shows
+instance Read Foo_enum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapFoo_enum" Foo_enum ty
+    where hasField = \x_0 -> (\y_1 -> Foo_enum{unwrapFoo_enum = y_1},
+                              getField @"unwrapFoo_enum" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapFoo_enum" (Ptr Foo_enum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFoo_enum")
+instance HasCField Foo_enum "unwrapFoo_enum"
+    where type CFieldType Foo_enum
+                          "unwrapFoo_enum" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @A@
+
+    __defined at:__ @types\/enums\/enum_cpp_syntax.h 4:27@
+
+    __exported by:__ @types\/enums\/enum_cpp_syntax.h@
+-}
+pattern A :: Foo_enum
+pattern A = Foo_enum 0
+{-| __C declaration:__ @B@
+
+    __defined at:__ @types\/enums\/enum_cpp_syntax.h 4:30@
+
+    __exported by:__ @types\/enums\/enum_cpp_syntax.h@
+-}
+pattern B :: Foo_enum
+pattern B = Foo_enum 1
+{-| __C declaration:__ @C@
+
+    __defined at:__ @types\/enums\/enum_cpp_syntax.h 4:33@
+
+    __exported by:__ @types\/enums\/enum_cpp_syntax.h@
+-}
+pattern C :: Foo_enum
+pattern C = Foo_enum 2
diff --git a/test-artefacts/fixtures/types/enums/enum_unsigned_values/Example.hs b/test-artefacts/fixtures/types/enums/enum_unsigned_values/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/enum_unsigned_values/Example.hs
@@ -0,0 +1,164 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Uint8_enum(..)
+    , pattern Example.U8_ZERO
+    , pattern Example.U8_127
+    , pattern Example.U8_128
+    , pattern Example.U8_255
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum uint8_enum@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 4:9@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+newtype Uint8_enum = Uint8_enum
+  { unwrapUint8_enum :: HsBindgen.Runtime.LibC.Word8
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Uint8_enum where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Uint8_enum where
+
+  readRaw =
+    \ptr0 ->
+          pure Uint8_enum
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Uint8_enum where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Uint8_enum unwrapUint8_enum2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapUint8_enum2
+
+deriving via Marshal.EquivStorable Uint8_enum instance BG.Storable Uint8_enum
+
+deriving via HsBindgen.Runtime.LibC.Word8 instance BG.Prim Uint8_enum
+
+instance CEnum.CEnum Uint8_enum where
+
+  type CEnumZ Uint8_enum = HsBindgen.Runtime.LibC.Word8
+
+  toCEnum = Uint8_enum
+
+  fromCEnum = BG.getField @"unwrapUint8_enum"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "U8_ZERO")
+                                   , (127, BG.singleton "U8_127")
+                                   , (128, BG.singleton "U8_128")
+                                   , (255, BG.singleton "U8_255")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Uint8_enum"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Uint8_enum"
+
+instance Show Uint8_enum where
+
+  showsPrec = CEnum.shows
+
+instance Read Uint8_enum where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "unwrapUint8_enum" Uint8_enum ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Uint8_enum {unwrapUint8_enum = y1}
+      , BG.getField @"unwrapUint8_enum" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "unwrapUint8_enum" (BG.Ptr Uint8_enum) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint8_enum")
+
+instance HasCField.HasCField Uint8_enum "unwrapUint8_enum" where
+
+  type CFieldType Uint8_enum "unwrapUint8_enum" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @U8_ZERO@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 5:3@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+pattern U8_ZERO :: Uint8_enum
+pattern U8_ZERO = Uint8_enum 0
+
+{-| __C declaration:__ @U8_127@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 6:3@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+pattern U8_127 :: Uint8_enum
+pattern U8_127 = Uint8_enum 127
+
+{-| __C declaration:__ @U8_128@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 7:3@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+pattern U8_128 :: Uint8_enum
+pattern U8_128 = Uint8_enum 128
+
+{-| __C declaration:__ @U8_255@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 8:3@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+pattern U8_255 :: Uint8_enum
+pattern U8_255 = Uint8_enum 255
diff --git a/test-artefacts/fixtures/types/enums/enum_unsigned_values/bindingspec.yaml b/test-artefacts/fixtures/types/enums/enum_unsigned_values/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/enum_unsigned_values/bindingspec.yaml
@@ -0,0 +1,39 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/enums/enum_unsigned_values.h
+  cname: enum uint8_enum
+  hsname: Uint8_enum
+  enum: open
+- headers: types/enums/enum_unsigned_values.h
+  cname: uint8_enum
+  hsname: Uint8_enum
+hstypes:
+- hsname: Uint8_enum
+  representation:
+    newtype:
+      constructor: Uint8_enum
+      fields:
+      - unwrapUint8_enum
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word8
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/enums/enum_unsigned_values/th.txt b/test-artefacts/fixtures/types/enums/enum_unsigned_values/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/enum_unsigned_values/th.txt
@@ -0,0 +1,84 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile test-artefacts/headers/golden/types/enums/enum_unsigned_values.h
+{-| __C declaration:__ @enum uint8_enum@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 4:9@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+newtype Uint8_enum
+    = Uint8_enum {unwrapUint8_enum :: HsBindgen.Runtime.LibC.Word8}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Uint8_enum
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Uint8_enum
+    where readRaw = \ptr_0 -> pure Uint8_enum <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Uint8_enum
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Uint8_enum unwrapUint8_enum_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapUint8_enum_2
+deriving via (EquivStorable Uint8_enum) instance Storable Uint8_enum
+deriving via HsBindgen.Runtime.LibC.Word8 instance Prim Uint8_enum
+instance CEnum Uint8_enum
+    where type CEnumZ Uint8_enum = HsBindgen.Runtime.LibC.Word8
+          toCEnum = Uint8_enum
+          fromCEnum = getField @"unwrapUint8_enum"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "U8_ZERO"),
+                                                         (127, singleton "U8_127"),
+                                                         (128, singleton "U8_128"),
+                                                         (255, singleton "U8_255")]
+          showsUndeclared = showsWrappedUndeclared "Uint8_enum"
+          readPrecUndeclared = readPrecWrappedUndeclared "Uint8_enum"
+instance Show Uint8_enum
+    where showsPrec = shows
+instance Read Uint8_enum
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapUint8_enum" Uint8_enum ty
+    where hasField = \x_0 -> (\y_1 -> Uint8_enum{unwrapUint8_enum = y_1},
+                              getField @"unwrapUint8_enum" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapUint8_enum" (Ptr Uint8_enum) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint8_enum")
+instance HasCField Uint8_enum "unwrapUint8_enum"
+    where type CFieldType Uint8_enum
+                          "unwrapUint8_enum" = HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @U8_ZERO@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 5:3@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+pattern U8_ZERO :: Uint8_enum
+pattern U8_ZERO = Uint8_enum 0
+{-| __C declaration:__ @U8_127@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 6:3@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+pattern U8_127 :: Uint8_enum
+pattern U8_127 = Uint8_enum 127
+{-| __C declaration:__ @U8_128@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 7:3@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+pattern U8_128 :: Uint8_enum
+pattern U8_128 = Uint8_enum 128
+{-| __C declaration:__ @U8_255@
+
+    __defined at:__ @types\/enums\/enum_unsigned_values.h 8:3@
+
+    __exported by:__ @types\/enums\/enum_unsigned_values.h@
+-}
+pattern U8_255 :: Uint8_enum
+pattern U8_255 = Uint8_enum 255
diff --git a/test-artefacts/fixtures/types/enums/enums/Example.hs b/test-artefacts/fixtures/types/enums/enums/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/enums/Example.hs
@@ -0,0 +1,1126 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.First(..)
+    , pattern Example.FIRST1
+    , pattern Example.FIRST2
+    , Example.Second(..)
+    , pattern Example.SECOND_A
+    , pattern Example.SECOND_B
+    , pattern Example.SECOND_C
+    , Example.Same(..)
+    , pattern Example.SAME_A
+    , pattern Example.SAME_B
+    , Example.Nonseq(..)
+    , pattern Example.NONSEQ_A
+    , pattern Example.NONSEQ_B
+    , pattern Example.NONSEQ_C
+    , Example.Packed(..)
+    , pattern Example.PACKED_A
+    , pattern Example.PACKED_B
+    , pattern Example.PACKED_C
+    , Example.EnumA(..)
+    , pattern Example.A_FOO
+    , pattern Example.A_BAR
+    , Example.EnumB(..)
+    , pattern Example.B_FOO
+    , pattern Example.B_BAR
+    , Example.EnumC(..)
+    , pattern Example.C_FOO
+    , pattern Example.C_BAR
+    , Example.EnumD_t(..)
+    , pattern Example.D_FOO
+    , pattern Example.D_BAR
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum first@
+
+    __defined at:__ @types\/enums\/enums.h 4:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype First = First
+  { unwrapFirst :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize First where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw First where
+
+  readRaw =
+    \ptr0 ->
+          pure First
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw First where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          First unwrapFirst2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapFirst2
+
+deriving via Marshal.EquivStorable First instance BG.Storable First
+
+deriving via BG.CUInt instance BG.Prim First
+
+instance CEnum.CEnum First where
+
+  type CEnumZ First = BG.CUInt
+
+  toCEnum = First
+
+  fromCEnum = BG.getField @"unwrapFirst"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "FIRST1"), (1, BG.singleton "FIRST2")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "First"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "First"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum First where
+
+  minDeclaredValue = FIRST1
+
+  maxDeclaredValue = FIRST2
+
+instance Show First where
+
+  showsPrec = CEnum.shows
+
+instance Read First where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapFirst" First ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         First {unwrapFirst = y1}, BG.getField @"unwrapFirst" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapFirst" (BG.Ptr First) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFirst")
+
+instance HasCField.HasCField First "unwrapFirst" where
+
+  type CFieldType First "unwrapFirst" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @FIRST1@
+
+    __defined at:__ @types\/enums\/enums.h 5:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern FIRST1 :: First
+pattern FIRST1 = First 0
+
+{-| __C declaration:__ @FIRST2@
+
+    __defined at:__ @types\/enums\/enums.h 6:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern FIRST2 :: First
+pattern FIRST2 = First 1
+
+{-| __C declaration:__ @enum second@
+
+    __defined at:__ @types\/enums\/enums.h 9:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype Second = Second
+  { unwrapSecond :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Second where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Second where
+
+  readRaw =
+    \ptr0 ->
+          pure Second
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Second where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Second unwrapSecond2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapSecond2
+
+deriving via Marshal.EquivStorable Second instance BG.Storable Second
+
+deriving via BG.CInt instance BG.Prim Second
+
+instance CEnum.CEnum Second where
+
+  type CEnumZ Second = BG.CInt
+
+  toCEnum = Second
+
+  fromCEnum = BG.getField @"unwrapSecond"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (-1, BG.singleton "SECOND_A")
+                                   , (0, BG.singleton "SECOND_B")
+                                   , (1, BG.singleton "SECOND_C")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Second"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Second"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Second where
+
+  minDeclaredValue = SECOND_A
+
+  maxDeclaredValue = SECOND_C
+
+instance Show Second where
+
+  showsPrec = CEnum.shows
+
+instance Read Second where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapSecond" Second ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Second {unwrapSecond = y1}, BG.getField @"unwrapSecond" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapSecond" (BG.Ptr Second) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapSecond")
+
+instance HasCField.HasCField Second "unwrapSecond" where
+
+  type CFieldType Second "unwrapSecond" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @SECOND_A@
+
+    __defined at:__ @types\/enums\/enums.h 10:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SECOND_A :: Second
+pattern SECOND_A = Second (-1)
+
+{-| __C declaration:__ @SECOND_B@
+
+    __defined at:__ @types\/enums\/enums.h 11:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SECOND_B :: Second
+pattern SECOND_B = Second 0
+
+{-| __C declaration:__ @SECOND_C@
+
+    __defined at:__ @types\/enums\/enums.h 12:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SECOND_C :: Second
+pattern SECOND_C = Second 1
+
+{-| __C declaration:__ @enum same@
+
+    __defined at:__ @types\/enums\/enums.h 15:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype Same = Same
+  { unwrapSame :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Same where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Same where
+
+  readRaw =
+    \ptr0 ->
+          pure Same
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Same where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Same unwrapSame2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapSame2
+
+deriving via Marshal.EquivStorable Same instance BG.Storable Same
+
+deriving via BG.CUInt instance BG.Prim Same
+
+instance CEnum.CEnum Same where
+
+  type CEnumZ Same = BG.CUInt
+
+  toCEnum = Same
+
+  fromCEnum = BG.getField @"unwrapSame"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(1, ("SAME_A" BG.:| ["SAME_B"]))]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "Same"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Same"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Same where
+
+  minDeclaredValue = SAME_A
+
+  maxDeclaredValue = SAME_A
+
+instance Show Same where
+
+  showsPrec = CEnum.shows
+
+instance Read Same where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapSame" Same ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Same {unwrapSame = y1}, BG.getField @"unwrapSame" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapSame" (BG.Ptr Same) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapSame")
+
+instance HasCField.HasCField Same "unwrapSame" where
+
+  type CFieldType Same "unwrapSame" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @SAME_A@
+
+    __defined at:__ @types\/enums\/enums.h 16:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SAME_A :: Same
+pattern SAME_A = Same 1
+
+{-| __C declaration:__ @SAME_B@
+
+    __defined at:__ @types\/enums\/enums.h 17:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SAME_B :: Same
+pattern SAME_B = Same 1
+
+{-| __C declaration:__ @enum nonseq@
+
+    __defined at:__ @types\/enums\/enums.h 20:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype Nonseq = Nonseq
+  { unwrapNonseq :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Nonseq where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Nonseq where
+
+  readRaw =
+    \ptr0 ->
+          pure Nonseq
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Nonseq where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Nonseq unwrapNonseq2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapNonseq2
+
+deriving via Marshal.EquivStorable Nonseq instance BG.Storable Nonseq
+
+deriving via BG.CUInt instance BG.Prim Nonseq
+
+instance CEnum.CEnum Nonseq where
+
+  type CEnumZ Nonseq = BG.CUInt
+
+  toCEnum = Nonseq
+
+  fromCEnum = BG.getField @"unwrapNonseq"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (200, BG.singleton "NONSEQ_A")
+                                   , (301, BG.singleton "NONSEQ_B")
+                                   , (404, BG.singleton "NONSEQ_C")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Nonseq"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Nonseq"
+
+instance Show Nonseq where
+
+  showsPrec = CEnum.shows
+
+instance Read Nonseq where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapNonseq" Nonseq ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Nonseq {unwrapNonseq = y1}, BG.getField @"unwrapNonseq" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapNonseq" (BG.Ptr Nonseq) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapNonseq")
+
+instance HasCField.HasCField Nonseq "unwrapNonseq" where
+
+  type CFieldType Nonseq "unwrapNonseq" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @NONSEQ_A@
+
+    __defined at:__ @types\/enums\/enums.h 21:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern NONSEQ_A :: Nonseq
+pattern NONSEQ_A = Nonseq 200
+
+{-| __C declaration:__ @NONSEQ_B@
+
+    __defined at:__ @types\/enums\/enums.h 22:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern NONSEQ_B :: Nonseq
+pattern NONSEQ_B = Nonseq 301
+
+{-| __C declaration:__ @NONSEQ_C@
+
+    __defined at:__ @types\/enums\/enums.h 23:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern NONSEQ_C :: Nonseq
+pattern NONSEQ_C = Nonseq 404
+
+{-| __C declaration:__ @enum packed@
+
+    __defined at:__ @types\/enums\/enums.h 26:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype Packed = Packed
+  { unwrapPacked :: BG.CUChar
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize Packed where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Packed where
+
+  readRaw =
+    \ptr0 ->
+          pure Packed
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw Packed where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Packed unwrapPacked2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapPacked2
+
+deriving via Marshal.EquivStorable Packed instance BG.Storable Packed
+
+deriving via BG.CUChar instance BG.Prim Packed
+
+instance CEnum.CEnum Packed where
+
+  type CEnumZ Packed = BG.CUChar
+
+  toCEnum = Packed
+
+  fromCEnum = BG.getField @"unwrapPacked"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [ (0, BG.singleton "PACKED_A")
+                                   , (1, BG.singleton "PACKED_B")
+                                   , (2, BG.singleton "PACKED_C")
+                                   ]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "Packed"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "Packed"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum Packed where
+
+  minDeclaredValue = PACKED_A
+
+  maxDeclaredValue = PACKED_C
+
+instance Show Packed where
+
+  showsPrec = CEnum.shows
+
+instance Read Packed where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUChar
+         ) => BG.CompatHasField.HasField "unwrapPacked" Packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Packed {unwrapPacked = y1}, BG.getField @"unwrapPacked" x0)
+
+instance ( ty ~ BG.CUChar
+         ) => BG.HasField "unwrapPacked" (BG.Ptr Packed) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPacked")
+
+instance HasCField.HasCField Packed "unwrapPacked" where
+
+  type CFieldType Packed "unwrapPacked" = BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @PACKED_A@
+
+    __defined at:__ @types\/enums\/enums.h 27:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern PACKED_A :: Packed
+pattern PACKED_A = Packed 0
+
+{-| __C declaration:__ @PACKED_B@
+
+    __defined at:__ @types\/enums\/enums.h 27:15@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern PACKED_B :: Packed
+pattern PACKED_B = Packed 1
+
+{-| __C declaration:__ @PACKED_C@
+
+    __defined at:__ @types\/enums\/enums.h 27:25@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern PACKED_C :: Packed
+pattern PACKED_C = Packed 2
+
+{-| __C declaration:__ @enum enumA@
+
+    __defined at:__ @types\/enums\/enums.h 30:9@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype EnumA = EnumA
+  { unwrapEnumA :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize EnumA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw EnumA where
+
+  readRaw =
+    \ptr0 ->
+          pure EnumA
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw EnumA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          EnumA unwrapEnumA2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapEnumA2
+
+deriving via Marshal.EquivStorable EnumA instance BG.Storable EnumA
+
+deriving via BG.CUInt instance BG.Prim EnumA
+
+instance CEnum.CEnum EnumA where
+
+  type CEnumZ EnumA = BG.CUInt
+
+  toCEnum = EnumA
+
+  fromCEnum = BG.getField @"unwrapEnumA"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "A_FOO"), (1, BG.singleton "A_BAR")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "EnumA"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "EnumA"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum EnumA where
+
+  minDeclaredValue = A_FOO
+
+  maxDeclaredValue = A_BAR
+
+instance Show EnumA where
+
+  showsPrec = CEnum.shows
+
+instance Read EnumA where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapEnumA" EnumA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         EnumA {unwrapEnumA = y1}, BG.getField @"unwrapEnumA" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapEnumA" (BG.Ptr EnumA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapEnumA")
+
+instance HasCField.HasCField EnumA "unwrapEnumA" where
+
+  type CFieldType EnumA "unwrapEnumA" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @A_FOO@
+
+    __defined at:__ @types\/enums\/enums.h 30:16@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern A_FOO :: EnumA
+pattern A_FOO = EnumA 0
+
+{-| __C declaration:__ @A_BAR@
+
+    __defined at:__ @types\/enums\/enums.h 30:23@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern A_BAR :: EnumA
+pattern A_BAR = EnumA 1
+
+{-| __C declaration:__ @enum enumB@
+
+    __defined at:__ @types\/enums\/enums.h 32:14@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype EnumB = EnumB
+  { unwrapEnumB :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize EnumB where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw EnumB where
+
+  readRaw =
+    \ptr0 ->
+          pure EnumB
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw EnumB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          EnumB unwrapEnumB2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapEnumB2
+
+deriving via Marshal.EquivStorable EnumB instance BG.Storable EnumB
+
+deriving via BG.CUInt instance BG.Prim EnumB
+
+instance CEnum.CEnum EnumB where
+
+  type CEnumZ EnumB = BG.CUInt
+
+  toCEnum = EnumB
+
+  fromCEnum = BG.getField @"unwrapEnumB"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "B_FOO"), (1, BG.singleton "B_BAR")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "EnumB"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "EnumB"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum EnumB where
+
+  minDeclaredValue = B_FOO
+
+  maxDeclaredValue = B_BAR
+
+instance Show EnumB where
+
+  showsPrec = CEnum.shows
+
+instance Read EnumB where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapEnumB" EnumB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         EnumB {unwrapEnumB = y1}, BG.getField @"unwrapEnumB" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapEnumB" (BG.Ptr EnumB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapEnumB")
+
+instance HasCField.HasCField EnumB "unwrapEnumB" where
+
+  type CFieldType EnumB "unwrapEnumB" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @B_FOO@
+
+    __defined at:__ @types\/enums\/enums.h 32:22@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern B_FOO :: EnumB
+pattern B_FOO = EnumB 0
+
+{-| __C declaration:__ @B_BAR@
+
+    __defined at:__ @types\/enums\/enums.h 32:29@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern B_BAR :: EnumB
+pattern B_BAR = EnumB 1
+
+{-| __C declaration:__ @enum enumC@
+
+    __defined at:__ @types\/enums\/enums.h 34:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype EnumC = EnumC
+  { unwrapEnumC :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize EnumC where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw EnumC where
+
+  readRaw =
+    \ptr0 ->
+          pure EnumC
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw EnumC where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          EnumC unwrapEnumC2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapEnumC2
+
+deriving via Marshal.EquivStorable EnumC instance BG.Storable EnumC
+
+deriving via BG.CUInt instance BG.Prim EnumC
+
+instance CEnum.CEnum EnumC where
+
+  type CEnumZ EnumC = BG.CUInt
+
+  toCEnum = EnumC
+
+  fromCEnum = BG.getField @"unwrapEnumC"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "C_FOO"), (1, BG.singleton "C_BAR")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "EnumC"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "EnumC"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum EnumC where
+
+  minDeclaredValue = C_FOO
+
+  maxDeclaredValue = C_BAR
+
+instance Show EnumC where
+
+  showsPrec = CEnum.shows
+
+instance Read EnumC where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapEnumC" EnumC ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         EnumC {unwrapEnumC = y1}, BG.getField @"unwrapEnumC" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapEnumC" (BG.Ptr EnumC) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapEnumC")
+
+instance HasCField.HasCField EnumC "unwrapEnumC" where
+
+  type CFieldType EnumC "unwrapEnumC" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @C_FOO@
+
+    __defined at:__ @types\/enums\/enums.h 34:14@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern C_FOO :: EnumC
+pattern C_FOO = EnumC 0
+
+{-| __C declaration:__ @C_BAR@
+
+    __defined at:__ @types\/enums\/enums.h 34:21@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern C_BAR :: EnumC
+pattern C_BAR = EnumC 1
+
+{-| __C declaration:__ @enum enumD@
+
+    __defined at:__ @types\/enums\/enums.h 37:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype EnumD_t = EnumD_t
+  { unwrapEnumD_t :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize EnumD_t where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw EnumD_t where
+
+  readRaw =
+    \ptr0 ->
+          pure EnumD_t
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw EnumD_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          EnumD_t unwrapEnumD_t2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapEnumD_t2
+
+deriving via Marshal.EquivStorable EnumD_t instance BG.Storable EnumD_t
+
+deriving via BG.CUInt instance BG.Prim EnumD_t
+
+instance CEnum.CEnum EnumD_t where
+
+  type CEnumZ EnumD_t = BG.CUInt
+
+  toCEnum = EnumD_t
+
+  fromCEnum = BG.getField @"unwrapEnumD_t"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "D_FOO"), (1, BG.singleton "D_BAR")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "EnumD_t"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "EnumD_t"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum EnumD_t where
+
+  minDeclaredValue = D_FOO
+
+  maxDeclaredValue = D_BAR
+
+instance Show EnumD_t where
+
+  showsPrec = CEnum.shows
+
+instance Read EnumD_t where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapEnumD_t" EnumD_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         EnumD_t {unwrapEnumD_t = y1}, BG.getField @"unwrapEnumD_t" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapEnumD_t" (BG.Ptr EnumD_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapEnumD_t")
+
+instance HasCField.HasCField EnumD_t "unwrapEnumD_t" where
+
+  type CFieldType EnumD_t "unwrapEnumD_t" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @D_FOO@
+
+    __defined at:__ @types\/enums\/enums.h 37:14@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern D_FOO :: EnumD_t
+pattern D_FOO = EnumD_t 0
+
+{-| __C declaration:__ @D_BAR@
+
+    __defined at:__ @types\/enums\/enums.h 37:21@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern D_BAR :: EnumD_t
+pattern D_BAR = EnumD_t 1
diff --git a/test-artefacts/fixtures/types/enums/enums/bindingspec.yaml b/test-artefacts/fixtures/types/enums/enums/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/enums/bindingspec.yaml
@@ -0,0 +1,296 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/enums/enums.h
+  cname: enum first
+  hsname: First
+  enum: open
+- headers: types/enums/enums.h
+  cname: enum second
+  hsname: Second
+  enum: open
+- headers: types/enums/enums.h
+  cname: enum same
+  hsname: Same
+  enum: open
+- headers: types/enums/enums.h
+  cname: enum nonseq
+  hsname: Nonseq
+  enum: open
+- headers: types/enums/enums.h
+  cname: enum packed
+  hsname: Packed
+  enum: open
+- headers: types/enums/enums.h
+  cname: enum enumA
+  hsname: EnumA
+  enum: open
+- headers: types/enums/enums.h
+  cname: enumA
+  hsname: EnumA
+- headers: types/enums/enums.h
+  cname: enum enumB
+  hsname: EnumB
+  enum: open
+- headers: types/enums/enums.h
+  cname: enumB
+  hsname: EnumB
+- headers: types/enums/enums.h
+  cname: enum enumC
+  hsname: EnumC
+  enum: open
+- headers: types/enums/enums.h
+  cname: enumC
+  hsname: EnumC
+- headers: types/enums/enums.h
+  cname: enum enumD
+  hsname: EnumD_t
+  enum: open
+- headers: types/enums/enums.h
+  cname: enumD_t
+  hsname: EnumD_t
+hstypes:
+- hsname: EnumA
+  representation:
+    newtype:
+      constructor: EnumA
+      fields:
+      - unwrapEnumA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: EnumB
+  representation:
+    newtype:
+      constructor: EnumB
+      fields:
+      - unwrapEnumB
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: EnumC
+  representation:
+    newtype:
+      constructor: EnumC
+      fields:
+      - unwrapEnumC
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: EnumD_t
+  representation:
+    newtype:
+      constructor: EnumD_t
+      fields:
+      - unwrapEnumD_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: First
+  representation:
+    newtype:
+      constructor: First
+      fields:
+      - unwrapFirst
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Nonseq
+  representation:
+    newtype:
+      constructor: Nonseq
+      fields:
+      - unwrapNonseq
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Packed
+  representation:
+    newtype:
+      constructor: Packed
+      fields:
+      - unwrapPacked
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUChar
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Same
+  representation:
+    newtype:
+      constructor: Same
+      fields:
+      - unwrapSame
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Second
+  representation:
+    newtype:
+      constructor: Second
+      fields:
+      - unwrapSecond
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/enums/enums/th.txt b/test-artefacts/fixtures/types/enums/enums/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/enums/th.txt
@@ -0,0 +1,606 @@
+-- addDependentFile test-artefacts/headers/golden/types/enums/enums.h
+{-| __C declaration:__ @enum first@
+
+    __defined at:__ @types\/enums\/enums.h 4:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype First
+    = First {unwrapFirst :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize First
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw First
+    where readRaw = \ptr_0 -> pure First <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw First
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       First unwrapFirst_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapFirst_2
+deriving via (EquivStorable First) instance Storable First
+deriving via CUInt instance Prim First
+instance CEnum First
+    where type CEnumZ First = CUInt
+          toCEnum = First
+          fromCEnum = getField @"unwrapFirst"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "FIRST1"),
+                                                         (1, singleton "FIRST2")]
+          showsUndeclared = showsWrappedUndeclared "First"
+          readPrecUndeclared = readPrecWrappedUndeclared "First"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum First
+    where minDeclaredValue = FIRST1
+          maxDeclaredValue = FIRST2
+instance Show First
+    where showsPrec = shows
+instance Read First
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapFirst" First ty
+    where hasField = \x_0 -> (\y_1 -> First{unwrapFirst = y_1},
+                              getField @"unwrapFirst" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapFirst" (Ptr First) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFirst")
+instance HasCField First "unwrapFirst"
+    where type CFieldType First "unwrapFirst" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @FIRST1@
+
+    __defined at:__ @types\/enums\/enums.h 5:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern FIRST1 :: First
+pattern FIRST1 = First 0
+{-| __C declaration:__ @FIRST2@
+
+    __defined at:__ @types\/enums\/enums.h 6:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern FIRST2 :: First
+pattern FIRST2 = First 1
+{-| __C declaration:__ @enum second@
+
+    __defined at:__ @types\/enums\/enums.h 9:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype Second
+    = Second {unwrapSecond :: CInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Second
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Second
+    where readRaw = \ptr_0 -> pure Second <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Second
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Second unwrapSecond_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapSecond_2
+deriving via (EquivStorable Second) instance Storable Second
+deriving via CInt instance Prim Second
+instance CEnum Second
+    where type CEnumZ Second = CInt
+          toCEnum = Second
+          fromCEnum = getField @"unwrapSecond"
+          declaredValues = \_ -> declaredValuesFromList [(-1,
+                                                          singleton "SECOND_A"),
+                                                         (0, singleton "SECOND_B"),
+                                                         (1, singleton "SECOND_C")]
+          showsUndeclared = showsWrappedUndeclared "Second"
+          readPrecUndeclared = readPrecWrappedUndeclared "Second"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Second
+    where minDeclaredValue = SECOND_A
+          maxDeclaredValue = SECOND_C
+instance Show Second
+    where showsPrec = shows
+instance Read Second
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CInt => HasField "unwrapSecond" Second ty
+    where hasField = \x_0 -> (\y_1 -> Second{unwrapSecond = y_1},
+                              getField @"unwrapSecond" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapSecond" (Ptr Second) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSecond")
+instance HasCField Second "unwrapSecond"
+    where type CFieldType Second "unwrapSecond" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @SECOND_A@
+
+    __defined at:__ @types\/enums\/enums.h 10:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SECOND_A :: Second
+pattern SECOND_A = Second (-1)
+{-| __C declaration:__ @SECOND_B@
+
+    __defined at:__ @types\/enums\/enums.h 11:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SECOND_B :: Second
+pattern SECOND_B = Second 0
+{-| __C declaration:__ @SECOND_C@
+
+    __defined at:__ @types\/enums\/enums.h 12:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SECOND_C :: Second
+pattern SECOND_C = Second 1
+{-| __C declaration:__ @enum same@
+
+    __defined at:__ @types\/enums\/enums.h 15:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype Same
+    = Same {unwrapSame :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Same
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Same
+    where readRaw = \ptr_0 -> pure Same <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Same
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Same unwrapSame_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapSame_2
+deriving via (EquivStorable Same) instance Storable Same
+deriving via CUInt instance Prim Same
+instance CEnum Same
+    where type CEnumZ Same = CUInt
+          toCEnum = Same
+          fromCEnum = getField @"unwrapSame"
+          declaredValues = \_ -> declaredValuesFromList [(1,
+                                                          "SAME_A" :| ["SAME_B"])]
+          showsUndeclared = showsWrappedUndeclared "Same"
+          readPrecUndeclared = readPrecWrappedUndeclared "Same"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Same
+    where minDeclaredValue = SAME_A
+          maxDeclaredValue = SAME_A
+instance Show Same
+    where showsPrec = shows
+instance Read Same
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapSame" Same ty
+    where hasField = \x_0 -> (\y_1 -> Same{unwrapSame = y_1},
+                              getField @"unwrapSame" x_0)
+instance (~) ty CUInt => HasField "unwrapSame" (Ptr Same) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapSame")
+instance HasCField Same "unwrapSame"
+    where type CFieldType Same "unwrapSame" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @SAME_A@
+
+    __defined at:__ @types\/enums\/enums.h 16:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SAME_A :: Same
+pattern SAME_A = Same 1
+{-| __C declaration:__ @SAME_B@
+
+    __defined at:__ @types\/enums\/enums.h 17:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern SAME_B :: Same
+pattern SAME_B = Same 1
+{-| __C declaration:__ @enum nonseq@
+
+    __defined at:__ @types\/enums\/enums.h 20:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype Nonseq
+    = Nonseq {unwrapNonseq :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Nonseq
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Nonseq
+    where readRaw = \ptr_0 -> pure Nonseq <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Nonseq
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Nonseq unwrapNonseq_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapNonseq_2
+deriving via (EquivStorable Nonseq) instance Storable Nonseq
+deriving via CUInt instance Prim Nonseq
+instance CEnum Nonseq
+    where type CEnumZ Nonseq = CUInt
+          toCEnum = Nonseq
+          fromCEnum = getField @"unwrapNonseq"
+          declaredValues = \_ -> declaredValuesFromList [(200,
+                                                          singleton "NONSEQ_A"),
+                                                         (301, singleton "NONSEQ_B"),
+                                                         (404, singleton "NONSEQ_C")]
+          showsUndeclared = showsWrappedUndeclared "Nonseq"
+          readPrecUndeclared = readPrecWrappedUndeclared "Nonseq"
+instance Show Nonseq
+    where showsPrec = shows
+instance Read Nonseq
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapNonseq" Nonseq ty
+    where hasField = \x_0 -> (\y_1 -> Nonseq{unwrapNonseq = y_1},
+                              getField @"unwrapNonseq" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapNonseq" (Ptr Nonseq) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapNonseq")
+instance HasCField Nonseq "unwrapNonseq"
+    where type CFieldType Nonseq "unwrapNonseq" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @NONSEQ_A@
+
+    __defined at:__ @types\/enums\/enums.h 21:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern NONSEQ_A :: Nonseq
+pattern NONSEQ_A = Nonseq 200
+{-| __C declaration:__ @NONSEQ_B@
+
+    __defined at:__ @types\/enums\/enums.h 22:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern NONSEQ_B :: Nonseq
+pattern NONSEQ_B = Nonseq 301
+{-| __C declaration:__ @NONSEQ_C@
+
+    __defined at:__ @types\/enums\/enums.h 23:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern NONSEQ_C :: Nonseq
+pattern NONSEQ_C = Nonseq 404
+{-| __C declaration:__ @enum packed@
+
+    __defined at:__ @types\/enums\/enums.h 26:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype Packed
+    = Packed {unwrapPacked :: CUChar}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize Packed
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Packed
+    where readRaw = \ptr_0 -> pure Packed <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw Packed
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Packed unwrapPacked_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapPacked_2
+deriving via (EquivStorable Packed) instance Storable Packed
+deriving via CUChar instance Prim Packed
+instance CEnum Packed
+    where type CEnumZ Packed = CUChar
+          toCEnum = Packed
+          fromCEnum = getField @"unwrapPacked"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "PACKED_A"),
+                                                         (1, singleton "PACKED_B"),
+                                                         (2, singleton "PACKED_C")]
+          showsUndeclared = showsWrappedUndeclared "Packed"
+          readPrecUndeclared = readPrecWrappedUndeclared "Packed"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum Packed
+    where minDeclaredValue = PACKED_A
+          maxDeclaredValue = PACKED_C
+instance Show Packed
+    where showsPrec = shows
+instance Read Packed
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUChar => HasField "unwrapPacked" Packed ty
+    where hasField = \x_0 -> (\y_1 -> Packed{unwrapPacked = y_1},
+                              getField @"unwrapPacked" x_0)
+instance (~) ty CUChar =>
+         HasField "unwrapPacked" (Ptr Packed) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPacked")
+instance HasCField Packed "unwrapPacked"
+    where type CFieldType Packed "unwrapPacked" = CUChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @PACKED_A@
+
+    __defined at:__ @types\/enums\/enums.h 27:5@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern PACKED_A :: Packed
+pattern PACKED_A = Packed 0
+{-| __C declaration:__ @PACKED_B@
+
+    __defined at:__ @types\/enums\/enums.h 27:15@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern PACKED_B :: Packed
+pattern PACKED_B = Packed 1
+{-| __C declaration:__ @PACKED_C@
+
+    __defined at:__ @types\/enums\/enums.h 27:25@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern PACKED_C :: Packed
+pattern PACKED_C = Packed 2
+{-| __C declaration:__ @enum enumA@
+
+    __defined at:__ @types\/enums\/enums.h 30:9@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype EnumA
+    = EnumA {unwrapEnumA :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize EnumA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw EnumA
+    where readRaw = \ptr_0 -> pure EnumA <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw EnumA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       EnumA unwrapEnumA_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapEnumA_2
+deriving via (EquivStorable EnumA) instance Storable EnumA
+deriving via CUInt instance Prim EnumA
+instance CEnum EnumA
+    where type CEnumZ EnumA = CUInt
+          toCEnum = EnumA
+          fromCEnum = getField @"unwrapEnumA"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "A_FOO"),
+                                                         (1, singleton "A_BAR")]
+          showsUndeclared = showsWrappedUndeclared "EnumA"
+          readPrecUndeclared = readPrecWrappedUndeclared "EnumA"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum EnumA
+    where minDeclaredValue = A_FOO
+          maxDeclaredValue = A_BAR
+instance Show EnumA
+    where showsPrec = shows
+instance Read EnumA
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapEnumA" EnumA ty
+    where hasField = \x_0 -> (\y_1 -> EnumA{unwrapEnumA = y_1},
+                              getField @"unwrapEnumA" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapEnumA" (Ptr EnumA) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapEnumA")
+instance HasCField EnumA "unwrapEnumA"
+    where type CFieldType EnumA "unwrapEnumA" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @A_FOO@
+
+    __defined at:__ @types\/enums\/enums.h 30:16@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern A_FOO :: EnumA
+pattern A_FOO = EnumA 0
+{-| __C declaration:__ @A_BAR@
+
+    __defined at:__ @types\/enums\/enums.h 30:23@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern A_BAR :: EnumA
+pattern A_BAR = EnumA 1
+{-| __C declaration:__ @enum enumB@
+
+    __defined at:__ @types\/enums\/enums.h 32:14@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype EnumB
+    = EnumB {unwrapEnumB :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize EnumB
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw EnumB
+    where readRaw = \ptr_0 -> pure EnumB <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw EnumB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       EnumB unwrapEnumB_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapEnumB_2
+deriving via (EquivStorable EnumB) instance Storable EnumB
+deriving via CUInt instance Prim EnumB
+instance CEnum EnumB
+    where type CEnumZ EnumB = CUInt
+          toCEnum = EnumB
+          fromCEnum = getField @"unwrapEnumB"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "B_FOO"),
+                                                         (1, singleton "B_BAR")]
+          showsUndeclared = showsWrappedUndeclared "EnumB"
+          readPrecUndeclared = readPrecWrappedUndeclared "EnumB"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum EnumB
+    where minDeclaredValue = B_FOO
+          maxDeclaredValue = B_BAR
+instance Show EnumB
+    where showsPrec = shows
+instance Read EnumB
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapEnumB" EnumB ty
+    where hasField = \x_0 -> (\y_1 -> EnumB{unwrapEnumB = y_1},
+                              getField @"unwrapEnumB" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapEnumB" (Ptr EnumB) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapEnumB")
+instance HasCField EnumB "unwrapEnumB"
+    where type CFieldType EnumB "unwrapEnumB" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @B_FOO@
+
+    __defined at:__ @types\/enums\/enums.h 32:22@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern B_FOO :: EnumB
+pattern B_FOO = EnumB 0
+{-| __C declaration:__ @B_BAR@
+
+    __defined at:__ @types\/enums\/enums.h 32:29@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern B_BAR :: EnumB
+pattern B_BAR = EnumB 1
+{-| __C declaration:__ @enum enumC@
+
+    __defined at:__ @types\/enums\/enums.h 34:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype EnumC
+    = EnumC {unwrapEnumC :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize EnumC
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw EnumC
+    where readRaw = \ptr_0 -> pure EnumC <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw EnumC
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       EnumC unwrapEnumC_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapEnumC_2
+deriving via (EquivStorable EnumC) instance Storable EnumC
+deriving via CUInt instance Prim EnumC
+instance CEnum EnumC
+    where type CEnumZ EnumC = CUInt
+          toCEnum = EnumC
+          fromCEnum = getField @"unwrapEnumC"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "C_FOO"),
+                                                         (1, singleton "C_BAR")]
+          showsUndeclared = showsWrappedUndeclared "EnumC"
+          readPrecUndeclared = readPrecWrappedUndeclared "EnumC"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum EnumC
+    where minDeclaredValue = C_FOO
+          maxDeclaredValue = C_BAR
+instance Show EnumC
+    where showsPrec = shows
+instance Read EnumC
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapEnumC" EnumC ty
+    where hasField = \x_0 -> (\y_1 -> EnumC{unwrapEnumC = y_1},
+                              getField @"unwrapEnumC" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapEnumC" (Ptr EnumC) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapEnumC")
+instance HasCField EnumC "unwrapEnumC"
+    where type CFieldType EnumC "unwrapEnumC" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @C_FOO@
+
+    __defined at:__ @types\/enums\/enums.h 34:14@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern C_FOO :: EnumC
+pattern C_FOO = EnumC 0
+{-| __C declaration:__ @C_BAR@
+
+    __defined at:__ @types\/enums\/enums.h 34:21@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern C_BAR :: EnumC
+pattern C_BAR = EnumC 1
+{-| __C declaration:__ @enum enumD@
+
+    __defined at:__ @types\/enums\/enums.h 37:6@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+newtype EnumD_t
+    = EnumD_t {unwrapEnumD_t :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize EnumD_t
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw EnumD_t
+    where readRaw = \ptr_0 -> pure EnumD_t <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw EnumD_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       EnumD_t unwrapEnumD_t_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapEnumD_t_2
+deriving via (EquivStorable EnumD_t) instance Storable EnumD_t
+deriving via CUInt instance Prim EnumD_t
+instance CEnum EnumD_t
+    where type CEnumZ EnumD_t = CUInt
+          toCEnum = EnumD_t
+          fromCEnum = getField @"unwrapEnumD_t"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "D_FOO"),
+                                                         (1, singleton "D_BAR")]
+          showsUndeclared = showsWrappedUndeclared "EnumD_t"
+          readPrecUndeclared = readPrecWrappedUndeclared "EnumD_t"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum EnumD_t
+    where minDeclaredValue = D_FOO
+          maxDeclaredValue = D_BAR
+instance Show EnumD_t
+    where showsPrec = shows
+instance Read EnumD_t
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapEnumD_t" EnumD_t ty
+    where hasField = \x_0 -> (\y_1 -> EnumD_t{unwrapEnumD_t = y_1},
+                              getField @"unwrapEnumD_t" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapEnumD_t" (Ptr EnumD_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapEnumD_t")
+instance HasCField EnumD_t "unwrapEnumD_t"
+    where type CFieldType EnumD_t "unwrapEnumD_t" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @D_FOO@
+
+    __defined at:__ @types\/enums\/enums.h 37:14@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern D_FOO :: EnumD_t
+pattern D_FOO = EnumD_t 0
+{-| __C declaration:__ @D_BAR@
+
+    __defined at:__ @types\/enums\/enums.h 37:21@
+
+    __exported by:__ @types\/enums\/enums.h@
+-}
+pattern D_BAR :: EnumD_t
+pattern D_BAR = EnumD_t 1
diff --git a/test-artefacts/fixtures/types/enums/nested_enums/Example.hs b/test-artefacts/fixtures/types/enums/nested_enums/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/nested_enums/Example.hs
@@ -0,0 +1,408 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.EnumA(..)
+    , pattern Example.VALA_1
+    , pattern Example.VALA_2
+    , Example.ExA(..)
+    , Example.ExB_fieldB1(..)
+    , pattern Example.VALB_1
+    , pattern Example.VALB_2
+    , Example.ExB(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Ord, Read, Show, pure, type (~))
+
+{-| __C declaration:__ @enum enumA@
+
+    __defined at:__ @types\/enums\/nested_enums.h 2:14@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+newtype EnumA = EnumA
+  { unwrapEnumA :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize EnumA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw EnumA where
+
+  readRaw =
+    \ptr0 ->
+          pure EnumA
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw EnumA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          EnumA unwrapEnumA2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapEnumA2
+
+deriving via Marshal.EquivStorable EnumA instance BG.Storable EnumA
+
+deriving via BG.CUInt instance BG.Prim EnumA
+
+instance CEnum.CEnum EnumA where
+
+  type CEnumZ EnumA = BG.CUInt
+
+  toCEnum = EnumA
+
+  fromCEnum = BG.getField @"unwrapEnumA"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "VALA_1"), (1, BG.singleton "VALA_2")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "EnumA"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "EnumA"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum EnumA where
+
+  minDeclaredValue = VALA_1
+
+  maxDeclaredValue = VALA_2
+
+instance Show EnumA where
+
+  showsPrec = CEnum.shows
+
+instance Read EnumA where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapEnumA" EnumA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         EnumA {unwrapEnumA = y1}, BG.getField @"unwrapEnumA" x0)
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapEnumA" (BG.Ptr EnumA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapEnumA")
+
+instance HasCField.HasCField EnumA "unwrapEnumA" where
+
+  type CFieldType EnumA "unwrapEnumA" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @VALA_1@
+
+    __defined at:__ @types\/enums\/nested_enums.h 3:17@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+pattern VALA_1 :: EnumA
+pattern VALA_1 = EnumA 0
+
+{-| __C declaration:__ @VALA_2@
+
+    __defined at:__ @types\/enums\/nested_enums.h 4:17@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+pattern VALA_2 :: EnumA
+pattern VALA_2 = EnumA 1
+
+{-| __C declaration:__ @struct exA@
+
+    __defined at:__ @types\/enums\/nested_enums.h 1:8@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+data ExA = ExA
+  { exA_fieldA1 :: EnumA
+    {- ^ __C declaration:__ @fieldA1@
+
+         __defined at:__ @types\/enums\/nested_enums.h 5:11@
+
+         __exported by:__ @types\/enums\/nested_enums.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize ExA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw ExA where
+
+  readRaw =
+    \ptr0 ->
+          pure ExA
+      <*> HasCField.readRaw (BG.Proxy @"exA_fieldA1") ptr0
+
+instance Marshal.WriteRaw ExA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ExA exA_fieldA12 ->
+            HasCField.writeRaw (BG.Proxy @"exA_fieldA1") ptr0 exA_fieldA12
+
+deriving via Marshal.EquivStorable ExA instance BG.Storable ExA
+
+deriving via Struct.IsStructViaReadRaw ExA instance Struct.IsStruct ExA
+
+{-| __C declaration:__ @fieldA1@
+
+    __defined at:__ @types\/enums\/nested_enums.h 5:11@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+instance (ty ~ EnumA) => BG.CompatHasField.HasField "exA_fieldA1" ExA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         ExA {exA_fieldA1 = y1}, BG.getField @"exA_fieldA1" x0)
+
+instance ( ty ~ EnumA
+         ) => BG.HasField "exA_fieldA1" (BG.Ptr ExA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exA_fieldA1")
+
+instance HasCField.HasCField ExA "exA_fieldA1" where
+
+  type CFieldType ExA "exA_fieldA1" = EnumA
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @enum \@exB_fieldB1@
+
+    __defined at:__ @types\/enums\/nested_enums.h 9:9@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+newtype ExB_fieldB1 = ExB_fieldB1
+  { unwrapExB_fieldB1 :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize ExB_fieldB1 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw ExB_fieldB1 where
+
+  readRaw =
+    \ptr0 ->
+          pure ExB_fieldB1
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw ExB_fieldB1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ExB_fieldB1 unwrapExB_fieldB12 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapExB_fieldB12
+
+deriving via Marshal.EquivStorable ExB_fieldB1 instance BG.Storable ExB_fieldB1
+
+deriving via BG.CUInt instance BG.Prim ExB_fieldB1
+
+instance CEnum.CEnum ExB_fieldB1 where
+
+  type CEnumZ ExB_fieldB1 = BG.CUInt
+
+  toCEnum = ExB_fieldB1
+
+  fromCEnum = BG.getField @"unwrapExB_fieldB1"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "VALB_1"), (1, BG.singleton "VALB_2")]
+
+  showsUndeclared =
+    CEnum.showsWrappedUndeclared "ExB_fieldB1"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "ExB_fieldB1"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum ExB_fieldB1 where
+
+  minDeclaredValue = VALB_1
+
+  maxDeclaredValue = VALB_2
+
+instance Show ExB_fieldB1 where
+
+  showsPrec = CEnum.shows
+
+instance Read ExB_fieldB1 where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapExB_fieldB1" ExB_fieldB1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> ExB_fieldB1 {unwrapExB_fieldB1 = y1}
+      , BG.getField @"unwrapExB_fieldB1" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapExB_fieldB1" (BG.Ptr ExB_fieldB1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapExB_fieldB1")
+
+instance HasCField.HasCField ExB_fieldB1 "unwrapExB_fieldB1" where
+
+  type CFieldType ExB_fieldB1 "unwrapExB_fieldB1" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @VALB_1@
+
+    __defined at:__ @types\/enums\/nested_enums.h 10:17@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+pattern VALB_1 :: ExB_fieldB1
+pattern VALB_1 = ExB_fieldB1 0
+
+{-| __C declaration:__ @VALB_2@
+
+    __defined at:__ @types\/enums\/nested_enums.h 11:17@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+pattern VALB_2 :: ExB_fieldB1
+pattern VALB_2 = ExB_fieldB1 1
+
+{-| __C declaration:__ @struct exB@
+
+    __defined at:__ @types\/enums\/nested_enums.h 8:8@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+data ExB = ExB
+  { exB_fieldB1 :: ExB_fieldB1
+    {- ^ __C declaration:__ @fieldB1@
+
+         __defined at:__ @types\/enums\/nested_enums.h 12:11@
+
+         __exported by:__ @types\/enums\/nested_enums.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize ExB where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw ExB where
+
+  readRaw =
+    \ptr0 ->
+          pure ExB
+      <*> HasCField.readRaw (BG.Proxy @"exB_fieldB1") ptr0
+
+instance Marshal.WriteRaw ExB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ExB exB_fieldB12 ->
+            HasCField.writeRaw (BG.Proxy @"exB_fieldB1") ptr0 exB_fieldB12
+
+deriving via Marshal.EquivStorable ExB instance BG.Storable ExB
+
+deriving via Struct.IsStructViaReadRaw ExB instance Struct.IsStruct ExB
+
+{-| __C declaration:__ @fieldB1@
+
+    __defined at:__ @types\/enums\/nested_enums.h 12:11@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+instance ( ty ~ ExB_fieldB1
+         ) => BG.CompatHasField.HasField "exB_fieldB1" ExB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         ExB {exB_fieldB1 = y1}, BG.getField @"exB_fieldB1" x0)
+
+instance ( ty ~ ExB_fieldB1
+         ) => BG.HasField "exB_fieldB1" (BG.Ptr ExB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exB_fieldB1")
+
+instance HasCField.HasCField ExB "exB_fieldB1" where
+
+  type CFieldType ExB "exB_fieldB1" = ExB_fieldB1
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/enums/nested_enums/bindingspec.yaml b/test-artefacts/fixtures/types/enums/nested_enums/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/nested_enums/bindingspec.yaml
@@ -0,0 +1,112 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/enums/nested_enums.h
+  cname: struct exA
+  hsname: ExA
+- headers: types/enums/nested_enums.h
+  cname: enum enumA
+  hsname: EnumA
+  enum: open
+- headers: types/enums/nested_enums.h
+  cname: struct exB
+  hsname: ExB
+- headers: types/enums/nested_enums.h
+  cname: enum @exB_fieldB1
+  hsname: ExB_fieldB1
+  enum: open
+hstypes:
+- hsname: EnumA
+  representation:
+    newtype:
+      constructor: EnumA
+      fields:
+      - unwrapEnumA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: ExA
+  representation:
+    record:
+      constructor: ExA
+      fields:
+      - exA_fieldA1
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: ExB
+  representation:
+    record:
+      constructor: ExB
+      fields:
+      - exB_fieldB1
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: ExB_fieldB1
+  representation:
+    newtype:
+      constructor: ExB_fieldB1
+      fields:
+      - unwrapExB_fieldB1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/enums/nested_enums/th.txt b/test-artefacts/fixtures/types/enums/nested_enums/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/nested_enums/th.txt
@@ -0,0 +1,199 @@
+-- addDependentFile test-artefacts/headers/golden/types/enums/nested_enums.h
+{-| __C declaration:__ @enum enumA@
+
+    __defined at:__ @types\/enums\/nested_enums.h 2:14@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+newtype EnumA
+    = EnumA {unwrapEnumA :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize EnumA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw EnumA
+    where readRaw = \ptr_0 -> pure EnumA <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw EnumA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       EnumA unwrapEnumA_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapEnumA_2
+deriving via (EquivStorable EnumA) instance Storable EnumA
+deriving via CUInt instance Prim EnumA
+instance CEnum EnumA
+    where type CEnumZ EnumA = CUInt
+          toCEnum = EnumA
+          fromCEnum = getField @"unwrapEnumA"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "VALA_1"),
+                                                         (1, singleton "VALA_2")]
+          showsUndeclared = showsWrappedUndeclared "EnumA"
+          readPrecUndeclared = readPrecWrappedUndeclared "EnumA"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum EnumA
+    where minDeclaredValue = VALA_1
+          maxDeclaredValue = VALA_2
+instance Show EnumA
+    where showsPrec = shows
+instance Read EnumA
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapEnumA" EnumA ty
+    where hasField = \x_0 -> (\y_1 -> EnumA{unwrapEnumA = y_1},
+                              getField @"unwrapEnumA" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapEnumA" (Ptr EnumA) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapEnumA")
+instance HasCField EnumA "unwrapEnumA"
+    where type CFieldType EnumA "unwrapEnumA" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @VALA_1@
+
+    __defined at:__ @types\/enums\/nested_enums.h 3:17@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+pattern VALA_1 :: EnumA
+pattern VALA_1 = EnumA 0
+{-| __C declaration:__ @VALA_2@
+
+    __defined at:__ @types\/enums\/nested_enums.h 4:17@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+pattern VALA_2 :: EnumA
+pattern VALA_2 = EnumA 1
+{-| __C declaration:__ @struct exA@
+
+    __defined at:__ @types\/enums\/nested_enums.h 1:8@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+data ExA
+    = ExA {exA_fieldA1 :: EnumA
+           {- ^ __C declaration:__ @fieldA1@
+
+                __defined at:__ @types\/enums\/nested_enums.h 5:11@
+
+                __exported by:__ @types\/enums\/nested_enums.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize ExA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw ExA
+    where readRaw = \ptr_0 -> pure ExA <*> readRaw (Proxy @"exA_fieldA1") ptr_0
+instance WriteRaw ExA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       ExA exA_fieldA1_2 -> writeRaw (Proxy @"exA_fieldA1") ptr_0 exA_fieldA1_2
+deriving via (EquivStorable ExA) instance Storable ExA
+deriving via (IsStructViaReadRaw ExA) instance IsStruct ExA
+instance (~) ty EnumA => HasField "exA_fieldA1" ExA ty
+    where hasField = \x_0 -> (\y_1 -> ExA{exA_fieldA1 = y_1},
+                              getField @"exA_fieldA1" x_0)
+instance (~) ty EnumA => HasField "exA_fieldA1" (Ptr ExA) (Ptr ty)
+    where getField = fromPtr (Proxy @"exA_fieldA1")
+instance HasCField ExA "exA_fieldA1"
+    where type CFieldType ExA "exA_fieldA1" = EnumA
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @enum \@exB_fieldB1@
+
+    __defined at:__ @types\/enums\/nested_enums.h 9:9@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+newtype ExB_fieldB1
+    = ExB_fieldB1 {unwrapExB_fieldB1 :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize ExB_fieldB1
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw ExB_fieldB1
+    where readRaw = \ptr_0 -> pure ExB_fieldB1 <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw ExB_fieldB1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       ExB_fieldB1 unwrapExB_fieldB1_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapExB_fieldB1_2
+deriving via (EquivStorable ExB_fieldB1) instance Storable ExB_fieldB1
+deriving via CUInt instance Prim ExB_fieldB1
+instance CEnum ExB_fieldB1
+    where type CEnumZ ExB_fieldB1 = CUInt
+          toCEnum = ExB_fieldB1
+          fromCEnum = getField @"unwrapExB_fieldB1"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "VALB_1"),
+                                                         (1, singleton "VALB_2")]
+          showsUndeclared = showsWrappedUndeclared "ExB_fieldB1"
+          readPrecUndeclared = readPrecWrappedUndeclared "ExB_fieldB1"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum ExB_fieldB1
+    where minDeclaredValue = VALB_1
+          maxDeclaredValue = VALB_2
+instance Show ExB_fieldB1
+    where showsPrec = shows
+instance Read ExB_fieldB1
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt =>
+         HasField "unwrapExB_fieldB1" ExB_fieldB1 ty
+    where hasField = \x_0 -> (\y_1 -> ExB_fieldB1{unwrapExB_fieldB1 = y_1},
+                              getField @"unwrapExB_fieldB1" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapExB_fieldB1" (Ptr ExB_fieldB1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapExB_fieldB1")
+instance HasCField ExB_fieldB1 "unwrapExB_fieldB1"
+    where type CFieldType ExB_fieldB1 "unwrapExB_fieldB1" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @VALB_1@
+
+    __defined at:__ @types\/enums\/nested_enums.h 10:17@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+pattern VALB_1 :: ExB_fieldB1
+pattern VALB_1 = ExB_fieldB1 0
+{-| __C declaration:__ @VALB_2@
+
+    __defined at:__ @types\/enums\/nested_enums.h 11:17@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+pattern VALB_2 :: ExB_fieldB1
+pattern VALB_2 = ExB_fieldB1 1
+{-| __C declaration:__ @struct exB@
+
+    __defined at:__ @types\/enums\/nested_enums.h 8:8@
+
+    __exported by:__ @types\/enums\/nested_enums.h@
+-}
+data ExB
+    = ExB {exB_fieldB1 :: ExB_fieldB1
+           {- ^ __C declaration:__ @fieldB1@
+
+                __defined at:__ @types\/enums\/nested_enums.h 12:11@
+
+                __exported by:__ @types\/enums\/nested_enums.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize ExB
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw ExB
+    where readRaw = \ptr_0 -> pure ExB <*> readRaw (Proxy @"exB_fieldB1") ptr_0
+instance WriteRaw ExB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       ExB exB_fieldB1_2 -> writeRaw (Proxy @"exB_fieldB1") ptr_0 exB_fieldB1_2
+deriving via (EquivStorable ExB) instance Storable ExB
+deriving via (IsStructViaReadRaw ExB) instance IsStruct ExB
+instance (~) ty ExB_fieldB1 => HasField "exB_fieldB1" ExB ty
+    where hasField = \x_0 -> (\y_1 -> ExB{exB_fieldB1 = y_1},
+                              getField @"exB_fieldB1" x_0)
+instance (~) ty ExB_fieldB1 =>
+         HasField "exB_fieldB1" (Ptr ExB) (Ptr ty)
+    where getField = fromPtr (Proxy @"exB_fieldB1")
+instance HasCField ExB "exB_fieldB1"
+    where type CFieldType ExB "exB_fieldB1" = ExB_fieldB1
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/enums/untagged_enum_toplevel/Example.hs b/test-artefacts/fixtures/types/enums/untagged_enum_toplevel/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/untagged_enum_toplevel/Example.hs
@@ -0,0 +1,38 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+
+module Example
+    ( pattern Example.TOPLEVEL_UNTAGGED_A
+    , pattern Example.TOPLEVEL_UNTAGGED_B
+    , pattern Example.TOPLEVEL_UNTAGGED_C
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+
+{-| __C declaration:__ @TOPLEVEL_UNTAGGED_A@
+
+    __defined at:__ @types\/enums\/untagged_enum_toplevel.h 5:1@
+
+    __exported by:__ @types\/enums\/untagged_enum_toplevel.h@
+-}
+pattern TOPLEVEL_UNTAGGED_A :: BG.CUInt
+pattern TOPLEVEL_UNTAGGED_A = 0
+
+{-| __C declaration:__ @TOPLEVEL_UNTAGGED_B@
+
+    __defined at:__ @types\/enums\/untagged_enum_toplevel.h 5:1@
+
+    __exported by:__ @types\/enums\/untagged_enum_toplevel.h@
+-}
+pattern TOPLEVEL_UNTAGGED_B :: BG.CUInt
+pattern TOPLEVEL_UNTAGGED_B = 1
+
+{-| __C declaration:__ @TOPLEVEL_UNTAGGED_C@
+
+    __defined at:__ @types\/enums\/untagged_enum_toplevel.h 5:1@
+
+    __exported by:__ @types\/enums\/untagged_enum_toplevel.h@
+-}
+pattern TOPLEVEL_UNTAGGED_C :: BG.CUInt
+pattern TOPLEVEL_UNTAGGED_C = 100
diff --git a/test-artefacts/fixtures/types/enums/untagged_enum_toplevel/bindingspec.yaml b/test-artefacts/fixtures/types/enums/untagged_enum_toplevel/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/untagged_enum_toplevel/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/types/enums/untagged_enum_toplevel/th.txt b/test-artefacts/fixtures/types/enums/untagged_enum_toplevel/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/enums/untagged_enum_toplevel/th.txt
@@ -0,0 +1,25 @@
+-- addDependentFile test-artefacts/headers/golden/types/enums/untagged_enum_toplevel.h
+{-| __C declaration:__ @TOPLEVEL_UNTAGGED_A@
+
+    __defined at:__ @types\/enums\/untagged_enum_toplevel.h 5:1@
+
+    __exported by:__ @types\/enums\/untagged_enum_toplevel.h@
+-}
+pattern TOPLEVEL_UNTAGGED_A :: CUInt
+pattern TOPLEVEL_UNTAGGED_A = 0
+{-| __C declaration:__ @TOPLEVEL_UNTAGGED_B@
+
+    __defined at:__ @types\/enums\/untagged_enum_toplevel.h 5:1@
+
+    __exported by:__ @types\/enums\/untagged_enum_toplevel.h@
+-}
+pattern TOPLEVEL_UNTAGGED_B :: CUInt
+pattern TOPLEVEL_UNTAGGED_B = 1
+{-| __C declaration:__ @TOPLEVEL_UNTAGGED_C@
+
+    __defined at:__ @types\/enums\/untagged_enum_toplevel.h 5:1@
+
+    __exported by:__ @types\/enums\/untagged_enum_toplevel.h@
+-}
+pattern TOPLEVEL_UNTAGGED_C :: CUInt
+pattern TOPLEVEL_UNTAGGED_C = 100
diff --git a/test-artefacts/fixtures/types/nested/nested_types/Example.hs b/test-artefacts/fixtures/types/nested/nested_types/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/nested/nested_types/Example.hs
@@ -0,0 +1,674 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo(..)
+    , Example.Bar(..)
+    , Example.Ex3_ex3_struct(..)
+    , Example.Ex3(..)
+    , Example.Ex4_odd(..)
+    , Example.Ex4_even(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @types\/nested\/nested_types.h 1:8@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Foo = Foo
+  { foo_i :: BG.CInt
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @types\/nested\/nested_types.h 2:9@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  , foo_c :: BG.CChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/nested\/nested_types.h 3:10@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Foo where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo
+      <*> HasCField.readRaw (BG.Proxy @"foo_i") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"foo_c") ptr0
+
+instance Marshal.WriteRaw Foo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo foo_i2 foo_c3 ->
+               HasCField.writeRaw (BG.Proxy @"foo_i") ptr0 foo_i2
+            >> HasCField.writeRaw (BG.Proxy @"foo_c") ptr0 foo_c3
+
+deriving via Marshal.EquivStorable Foo instance BG.Storable Foo
+
+deriving via Struct.IsStructViaReadRaw Foo instance Struct.IsStruct Foo
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @types\/nested\/nested_types.h 2:9@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_i" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_i = y1, foo_c = BG.getField @"foo_c" x0}
+      , BG.getField @"foo_i" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "foo_i" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_i")
+
+instance HasCField.HasCField Foo "foo_i" where
+
+  type CFieldType Foo "foo_i" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/nested\/nested_types.h 3:10@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "foo_c" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_c = y1, foo_i = BG.getField @"foo_i" x0}
+      , BG.getField @"foo_c" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "foo_c" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_c")
+
+instance HasCField.HasCField Foo "foo_c" where
+
+  type CFieldType Foo "foo_c" = BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @types\/nested\/nested_types.h 6:8@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Bar = Bar
+  { bar_foo1 :: Foo
+    {- ^ __C declaration:__ @foo1@
+
+         __defined at:__ @types\/nested\/nested_types.h 7:16@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  , bar_foo2 :: Foo
+    {- ^ __C declaration:__ @foo2@
+
+         __defined at:__ @types\/nested\/nested_types.h 8:16@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bar where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar
+      <*> HasCField.readRaw (BG.Proxy @"bar_foo1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bar_foo2") ptr0
+
+instance Marshal.WriteRaw Bar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar bar_foo12 bar_foo23 ->
+               HasCField.writeRaw (BG.Proxy @"bar_foo1") ptr0 bar_foo12
+            >> HasCField.writeRaw (BG.Proxy @"bar_foo2") ptr0 bar_foo23
+
+deriving via Marshal.EquivStorable Bar instance BG.Storable Bar
+
+deriving via Struct.IsStructViaReadRaw Bar instance Struct.IsStruct Bar
+
+{-| __C declaration:__ @foo1@
+
+    __defined at:__ @types\/nested\/nested_types.h 7:16@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance (ty ~ Foo) => BG.CompatHasField.HasField "bar_foo1" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_foo1 = y1, bar_foo2 = BG.getField @"bar_foo2" x0}
+      , BG.getField @"bar_foo1" x0
+      )
+
+instance (ty ~ Foo) => BG.HasField "bar_foo1" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_foo1")
+
+instance HasCField.HasCField Bar "bar_foo1" where
+
+  type CFieldType Bar "bar_foo1" = Foo
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @foo2@
+
+    __defined at:__ @types\/nested\/nested_types.h 8:16@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance (ty ~ Foo) => BG.CompatHasField.HasField "bar_foo2" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_foo2 = y1, bar_foo1 = BG.getField @"bar_foo1" x0}
+      , BG.getField @"bar_foo2" x0
+      )
+
+instance (ty ~ Foo) => BG.HasField "bar_foo2" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_foo2")
+
+instance HasCField.HasCField Bar "bar_foo2" where
+
+  type CFieldType Bar "bar_foo2" = Foo
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct \@ex3_ex3_struct@
+
+    __defined at:__ @types\/nested\/nested_types.h 12:5@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Ex3_ex3_struct = Ex3_ex3_struct
+  { ex3_ex3_struct_ex3_a :: BG.CInt
+    {- ^ __C declaration:__ @ex3_a@
+
+         __defined at:__ @types\/nested\/nested_types.h 13:13@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  , ex3_ex3_struct_ex3_b :: BG.CChar
+    {- ^ __C declaration:__ @ex3_b@
+
+         __defined at:__ @types\/nested\/nested_types.h 14:14@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ex3_ex3_struct where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Ex3_ex3_struct where
+
+  readRaw =
+    \ptr0 ->
+          pure Ex3_ex3_struct
+      <*> HasCField.readRaw (BG.Proxy @"ex3_ex3_struct_ex3_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"ex3_ex3_struct_ex3_b") ptr0
+
+instance Marshal.WriteRaw Ex3_ex3_struct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ex3_ex3_struct ex3_ex3_struct_ex3_a2 ex3_ex3_struct_ex3_b3 ->
+               HasCField.writeRaw (BG.Proxy @"ex3_ex3_struct_ex3_a") ptr0 ex3_ex3_struct_ex3_a2
+            >> HasCField.writeRaw (BG.Proxy @"ex3_ex3_struct_ex3_b") ptr0 ex3_ex3_struct_ex3_b3
+
+deriving via Marshal.EquivStorable Ex3_ex3_struct instance BG.Storable Ex3_ex3_struct
+
+deriving via Struct.IsStructViaReadRaw Ex3_ex3_struct instance Struct.IsStruct Ex3_ex3_struct
+
+{-| __C declaration:__ @ex3_a@
+
+    __defined at:__ @types\/nested\/nested_types.h 13:13@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "ex3_ex3_struct_ex3_a" Ex3_ex3_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ex3_ex3_struct { ex3_ex3_struct_ex3_a = y1
+                         , ex3_ex3_struct_ex3_b = BG.getField @"ex3_ex3_struct_ex3_b" x0
+                         }
+      , BG.getField @"ex3_ex3_struct_ex3_a" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "ex3_ex3_struct_ex3_a" (BG.Ptr Ex3_ex3_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ex3_ex3_struct_ex3_a")
+
+instance HasCField.HasCField Ex3_ex3_struct "ex3_ex3_struct_ex3_a" where
+
+  type CFieldType Ex3_ex3_struct "ex3_ex3_struct_ex3_a" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @ex3_b@
+
+    __defined at:__ @types\/nested\/nested_types.h 14:14@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "ex3_ex3_struct_ex3_b" Ex3_ex3_struct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ex3_ex3_struct { ex3_ex3_struct_ex3_b = y1
+                         , ex3_ex3_struct_ex3_a = BG.getField @"ex3_ex3_struct_ex3_a" x0
+                         }
+      , BG.getField @"ex3_ex3_struct_ex3_b" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "ex3_ex3_struct_ex3_b" (BG.Ptr Ex3_ex3_struct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ex3_ex3_struct_ex3_b")
+
+instance HasCField.HasCField Ex3_ex3_struct "ex3_ex3_struct_ex3_b" where
+
+  type CFieldType Ex3_ex3_struct "ex3_ex3_struct_ex3_b" =
+    BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct ex3@
+
+    __defined at:__ @types\/nested\/nested_types.h 11:8@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Ex3 = Ex3
+  { ex3_ex3_struct :: Ex3_ex3_struct
+    {- ^ __C declaration:__ @ex3_struct@
+
+         __defined at:__ @types\/nested\/nested_types.h 15:7@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  , ex3_ex3_c :: BG.CFloat
+    {- ^ __C declaration:__ @ex3_c@
+
+         __defined at:__ @types\/nested\/nested_types.h 16:11@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ex3 where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Ex3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Ex3
+      <*> HasCField.readRaw (BG.Proxy @"ex3_ex3_struct") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"ex3_ex3_c") ptr0
+
+instance Marshal.WriteRaw Ex3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ex3 ex3_ex3_struct2 ex3_ex3_c3 ->
+               HasCField.writeRaw (BG.Proxy @"ex3_ex3_struct") ptr0 ex3_ex3_struct2
+            >> HasCField.writeRaw (BG.Proxy @"ex3_ex3_c") ptr0 ex3_ex3_c3
+
+deriving via Marshal.EquivStorable Ex3 instance BG.Storable Ex3
+
+deriving via Struct.IsStructViaReadRaw Ex3 instance Struct.IsStruct Ex3
+
+{-| __C declaration:__ @ex3_struct@
+
+    __defined at:__ @types\/nested\/nested_types.h 15:7@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance ( ty ~ Ex3_ex3_struct
+         ) => BG.CompatHasField.HasField "ex3_ex3_struct" Ex3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ex3 {ex3_ex3_struct = y1, ex3_ex3_c = BG.getField @"ex3_ex3_c" x0}
+      , BG.getField @"ex3_ex3_struct" x0
+      )
+
+instance ( ty ~ Ex3_ex3_struct
+         ) => BG.HasField "ex3_ex3_struct" (BG.Ptr Ex3) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ex3_ex3_struct")
+
+instance HasCField.HasCField Ex3 "ex3_ex3_struct" where
+
+  type CFieldType Ex3 "ex3_ex3_struct" = Ex3_ex3_struct
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @ex3_c@
+
+    __defined at:__ @types\/nested\/nested_types.h 16:11@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "ex3_ex3_c" Ex3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ex3 {ex3_ex3_c = y1, ex3_ex3_struct = BG.getField @"ex3_ex3_struct" x0}
+      , BG.getField @"ex3_ex3_c" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "ex3_ex3_c" (BG.Ptr Ex3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"ex3_ex3_c")
+
+instance HasCField.HasCField Ex3 "ex3_ex3_c" where
+
+  type CFieldType Ex3 "ex3_ex3_c" = BG.CFloat
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct ex4_odd@
+
+    __defined at:__ @types\/nested\/nested_types.h 22:8@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Ex4_odd = Ex4_odd
+  { ex4_odd_value :: BG.CInt
+    {- ^ __C declaration:__ @value@
+
+         __defined at:__ @types\/nested\/nested_types.h 23:9@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  , ex4_odd_next :: BG.Ptr Ex4_even
+    {- ^ __C declaration:__ @next@
+
+         __defined at:__ @types\/nested\/nested_types.h 27:8@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ex4_odd where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ex4_odd where
+
+  readRaw =
+    \ptr0 ->
+          pure Ex4_odd
+      <*> HasCField.readRaw (BG.Proxy @"ex4_odd_value") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"ex4_odd_next") ptr0
+
+instance Marshal.WriteRaw Ex4_odd where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ex4_odd ex4_odd_value2 ex4_odd_next3 ->
+               HasCField.writeRaw (BG.Proxy @"ex4_odd_value") ptr0 ex4_odd_value2
+            >> HasCField.writeRaw (BG.Proxy @"ex4_odd_next") ptr0 ex4_odd_next3
+
+deriving via Marshal.EquivStorable Ex4_odd instance BG.Storable Ex4_odd
+
+deriving via Struct.IsStructViaReadRaw Ex4_odd instance Struct.IsStruct Ex4_odd
+
+{-| __C declaration:__ @value@
+
+    __defined at:__ @types\/nested\/nested_types.h 23:9@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "ex4_odd_value" Ex4_odd ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ex4_odd {ex4_odd_value = y1, ex4_odd_next = BG.getField @"ex4_odd_next" x0}
+      , BG.getField @"ex4_odd_value" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "ex4_odd_value" (BG.Ptr Ex4_odd) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ex4_odd_value")
+
+instance HasCField.HasCField Ex4_odd "ex4_odd_value" where
+
+  type CFieldType Ex4_odd "ex4_odd_value" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @next@
+
+    __defined at:__ @types\/nested\/nested_types.h 27:8@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance ( ty ~ BG.Ptr Ex4_even
+         ) => BG.CompatHasField.HasField "ex4_odd_next" Ex4_odd ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ex4_odd {ex4_odd_next = y1, ex4_odd_value = BG.getField @"ex4_odd_value" x0}
+      , BG.getField @"ex4_odd_next" x0
+      )
+
+instance ( ty ~ BG.Ptr Ex4_even
+         ) => BG.HasField "ex4_odd_next" (BG.Ptr Ex4_odd) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ex4_odd_next")
+
+instance HasCField.HasCField Ex4_odd "ex4_odd_next" where
+
+  type CFieldType Ex4_odd "ex4_odd_next" =
+    BG.Ptr Ex4_even
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct ex4_even@
+
+    __defined at:__ @types\/nested\/nested_types.h 24:12@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Ex4_even = Ex4_even
+  { ex4_even_value :: BG.CDouble
+    {- ^ __C declaration:__ @value@
+
+         __defined at:__ @types\/nested\/nested_types.h 25:16@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  , ex4_even_next :: BG.Ptr Ex4_odd
+    {- ^ __C declaration:__ @next@
+
+         __defined at:__ @types\/nested\/nested_types.h 26:25@
+
+         __exported by:__ @types\/nested\/nested_types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Ex4_even where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Ex4_even where
+
+  readRaw =
+    \ptr0 ->
+          pure Ex4_even
+      <*> HasCField.readRaw (BG.Proxy @"ex4_even_value") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"ex4_even_next") ptr0
+
+instance Marshal.WriteRaw Ex4_even where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Ex4_even ex4_even_value2 ex4_even_next3 ->
+               HasCField.writeRaw (BG.Proxy @"ex4_even_value") ptr0 ex4_even_value2
+            >> HasCField.writeRaw (BG.Proxy @"ex4_even_next") ptr0 ex4_even_next3
+
+deriving via Marshal.EquivStorable Ex4_even instance BG.Storable Ex4_even
+
+deriving via Struct.IsStructViaReadRaw Ex4_even instance Struct.IsStruct Ex4_even
+
+{-| __C declaration:__ @value@
+
+    __defined at:__ @types\/nested\/nested_types.h 25:16@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "ex4_even_value" Ex4_even ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ex4_even {ex4_even_value = y1, ex4_even_next = BG.getField @"ex4_even_next" x0}
+      , BG.getField @"ex4_even_value" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "ex4_even_value" (BG.Ptr Ex4_even) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ex4_even_value")
+
+instance HasCField.HasCField Ex4_even "ex4_even_value" where
+
+  type CFieldType Ex4_even "ex4_even_value" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @next@
+
+    __defined at:__ @types\/nested\/nested_types.h 26:25@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+instance ( ty ~ BG.Ptr Ex4_odd
+         ) => BG.CompatHasField.HasField "ex4_even_next" Ex4_even ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Ex4_even {ex4_even_next = y1, ex4_even_value = BG.getField @"ex4_even_value" x0}
+      , BG.getField @"ex4_even_next" x0
+      )
+
+instance ( ty ~ BG.Ptr Ex4_odd
+         ) => BG.HasField "ex4_even_next" (BG.Ptr Ex4_even) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"ex4_even_next")
+
+instance HasCField.HasCField Ex4_even "ex4_even_next" where
+
+  type CFieldType Ex4_even "ex4_even_next" =
+    BG.Ptr Ex4_odd
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/nested/nested_types/bindingspec.yaml b/test-artefacts/fixtures/types/nested/nested_types/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/nested/nested_types/bindingspec.yaml
@@ -0,0 +1,144 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/nested/nested_types.h
+  cname: struct foo
+  hsname: Foo
+- headers: types/nested/nested_types.h
+  cname: struct bar
+  hsname: Bar
+- headers: types/nested/nested_types.h
+  cname: struct ex3
+  hsname: Ex3
+- headers: types/nested/nested_types.h
+  cname: struct @ex3_ex3_struct
+  hsname: Ex3_ex3_struct
+- headers: types/nested/nested_types.h
+  cname: struct ex4_odd
+  hsname: Ex4_odd
+- headers: types/nested/nested_types.h
+  cname: struct ex4_even
+  hsname: Ex4_even
+hstypes:
+- hsname: Bar
+  representation:
+    record:
+      constructor: Bar
+      fields:
+      - bar_foo1
+      - bar_foo2
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ex3
+  representation:
+    record:
+      constructor: Ex3
+      fields:
+      - ex3_ex3_struct
+      - ex3_ex3_c
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ex3_ex3_struct
+  representation:
+    record:
+      constructor: Ex3_ex3_struct
+      fields:
+      - ex3_ex3_struct_ex3_a
+      - ex3_ex3_struct_ex3_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ex4_even
+  representation:
+    record:
+      constructor: Ex4_even
+      fields:
+      - ex4_even_value
+      - ex4_even_next
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Ex4_odd
+  representation:
+    record:
+      constructor: Ex4_odd
+      fields:
+      - ex4_odd_value
+      - ex4_odd_next
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    record:
+      constructor: Foo
+      fields:
+      - foo_i
+      - foo_c
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/nested/nested_types/th.txt b/test-artefacts/fixtures/types/nested/nested_types/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/nested/nested_types/th.txt
@@ -0,0 +1,318 @@
+-- addDependentFile test-artefacts/headers/golden/types/nested/nested_types.h
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @types\/nested\/nested_types.h 1:8@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Foo
+    = Foo {foo_i :: CInt
+           {- ^ __C declaration:__ @i@
+
+                __defined at:__ @types\/nested\/nested_types.h 2:9@
+
+                __exported by:__ @types\/nested\/nested_types.h@
+           -},
+           foo_c :: CChar
+           {- ^ __C declaration:__ @c@
+
+                __defined at:__ @types\/nested\/nested_types.h 3:10@
+
+                __exported by:__ @types\/nested\/nested_types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Foo
+    where readRaw = \ptr_0 -> (pure Foo <*> readRaw (Proxy @"foo_i") ptr_0) <*> readRaw (Proxy @"foo_c") ptr_0
+instance WriteRaw Foo
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo foo_i_2
+                                           foo_c_3 -> writeRaw (Proxy @"foo_i") ptr_0 foo_i_2 >> writeRaw (Proxy @"foo_c") ptr_0 foo_c_3
+deriving via (EquivStorable Foo) instance Storable Foo
+deriving via (IsStructViaReadRaw Foo) instance IsStruct Foo
+instance (~) ty CInt => HasField "foo_i" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_i = y_1,
+                                          foo_c = getField @"foo_c" x_0},
+                              getField @"foo_i" x_0)
+instance (~) ty CInt => HasField "foo_i" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_i")
+instance HasCField Foo "foo_i"
+    where type CFieldType Foo "foo_i" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar => HasField "foo_c" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_c = y_1,
+                                          foo_i = getField @"foo_i" x_0},
+                              getField @"foo_c" x_0)
+instance (~) ty CChar => HasField "foo_c" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_c")
+instance HasCField Foo "foo_c"
+    where type CFieldType Foo "foo_c" = CChar
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @types\/nested\/nested_types.h 6:8@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Bar
+    = Bar {bar_foo1 :: Foo
+           {- ^ __C declaration:__ @foo1@
+
+                __defined at:__ @types\/nested\/nested_types.h 7:16@
+
+                __exported by:__ @types\/nested\/nested_types.h@
+           -},
+           bar_foo2 :: Foo
+           {- ^ __C declaration:__ @foo2@
+
+                __defined at:__ @types\/nested\/nested_types.h 8:16@
+
+                __exported by:__ @types\/nested\/nested_types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bar
+    where readRaw = \ptr_0 -> (pure Bar <*> readRaw (Proxy @"bar_foo1") ptr_0) <*> readRaw (Proxy @"bar_foo2") ptr_0
+instance WriteRaw Bar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar bar_foo1_2
+                                           bar_foo2_3 -> writeRaw (Proxy @"bar_foo1") ptr_0 bar_foo1_2 >> writeRaw (Proxy @"bar_foo2") ptr_0 bar_foo2_3
+deriving via (EquivStorable Bar) instance Storable Bar
+deriving via (IsStructViaReadRaw Bar) instance IsStruct Bar
+instance (~) ty Foo => HasField "bar_foo1" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_foo1 = y_1,
+                                          bar_foo2 = getField @"bar_foo2" x_0},
+                              getField @"bar_foo1" x_0)
+instance (~) ty Foo => HasField "bar_foo1" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_foo1")
+instance HasCField Bar "bar_foo1"
+    where type CFieldType Bar "bar_foo1" = Foo
+          offset# = \_ -> \_ -> 0
+instance (~) ty Foo => HasField "bar_foo2" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_foo2 = y_1,
+                                          bar_foo1 = getField @"bar_foo1" x_0},
+                              getField @"bar_foo2" x_0)
+instance (~) ty Foo => HasField "bar_foo2" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_foo2")
+instance HasCField Bar "bar_foo2"
+    where type CFieldType Bar "bar_foo2" = Foo
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct \@ex3_ex3_struct@
+
+    __defined at:__ @types\/nested\/nested_types.h 12:5@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Ex3_ex3_struct
+    = Ex3_ex3_struct {ex3_ex3_struct_ex3_a :: CInt
+                      {- ^ __C declaration:__ @ex3_a@
+
+                           __defined at:__ @types\/nested\/nested_types.h 13:13@
+
+                           __exported by:__ @types\/nested\/nested_types.h@
+                      -},
+                      ex3_ex3_struct_ex3_b :: CChar
+                      {- ^ __C declaration:__ @ex3_b@
+
+                           __defined at:__ @types\/nested\/nested_types.h 14:14@
+
+                           __exported by:__ @types\/nested\/nested_types.h@
+                      -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ex3_ex3_struct
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Ex3_ex3_struct
+    where readRaw = \ptr_0 -> (pure Ex3_ex3_struct <*> readRaw (Proxy @"ex3_ex3_struct_ex3_a") ptr_0) <*> readRaw (Proxy @"ex3_ex3_struct_ex3_b") ptr_0
+instance WriteRaw Ex3_ex3_struct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ex3_ex3_struct ex3_ex3_struct_ex3_a_2
+                                                      ex3_ex3_struct_ex3_b_3 -> writeRaw (Proxy @"ex3_ex3_struct_ex3_a") ptr_0 ex3_ex3_struct_ex3_a_2 >> writeRaw (Proxy @"ex3_ex3_struct_ex3_b") ptr_0 ex3_ex3_struct_ex3_b_3
+deriving via (EquivStorable Ex3_ex3_struct) instance Storable Ex3_ex3_struct
+deriving via (IsStructViaReadRaw Ex3_ex3_struct) instance IsStruct Ex3_ex3_struct
+instance (~) ty CInt =>
+         HasField "ex3_ex3_struct_ex3_a" Ex3_ex3_struct ty
+    where hasField = \x_0 -> (\y_1 -> Ex3_ex3_struct{ex3_ex3_struct_ex3_a = y_1,
+                                                     ex3_ex3_struct_ex3_b = getField @"ex3_ex3_struct_ex3_b" x_0},
+                              getField @"ex3_ex3_struct_ex3_a" x_0)
+instance (~) ty CInt =>
+         HasField "ex3_ex3_struct_ex3_a" (Ptr Ex3_ex3_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"ex3_ex3_struct_ex3_a")
+instance HasCField Ex3_ex3_struct "ex3_ex3_struct_ex3_a"
+    where type CFieldType Ex3_ex3_struct "ex3_ex3_struct_ex3_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar =>
+         HasField "ex3_ex3_struct_ex3_b" Ex3_ex3_struct ty
+    where hasField = \x_0 -> (\y_1 -> Ex3_ex3_struct{ex3_ex3_struct_ex3_b = y_1,
+                                                     ex3_ex3_struct_ex3_a = getField @"ex3_ex3_struct_ex3_a" x_0},
+                              getField @"ex3_ex3_struct_ex3_b" x_0)
+instance (~) ty CChar =>
+         HasField "ex3_ex3_struct_ex3_b" (Ptr Ex3_ex3_struct) (Ptr ty)
+    where getField = fromPtr (Proxy @"ex3_ex3_struct_ex3_b")
+instance HasCField Ex3_ex3_struct "ex3_ex3_struct_ex3_b"
+    where type CFieldType Ex3_ex3_struct "ex3_ex3_struct_ex3_b" = CChar
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct ex3@
+
+    __defined at:__ @types\/nested\/nested_types.h 11:8@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Ex3
+    = Ex3 {ex3_ex3_struct :: Ex3_ex3_struct
+           {- ^ __C declaration:__ @ex3_struct@
+
+                __defined at:__ @types\/nested\/nested_types.h 15:7@
+
+                __exported by:__ @types\/nested\/nested_types.h@
+           -},
+           ex3_ex3_c :: CFloat
+           {- ^ __C declaration:__ @ex3_c@
+
+                __defined at:__ @types\/nested\/nested_types.h 16:11@
+
+                __exported by:__ @types\/nested\/nested_types.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ex3
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Ex3
+    where readRaw = \ptr_0 -> (pure Ex3 <*> readRaw (Proxy @"ex3_ex3_struct") ptr_0) <*> readRaw (Proxy @"ex3_ex3_c") ptr_0
+instance WriteRaw Ex3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ex3 ex3_ex3_struct_2
+                                           ex3_ex3_c_3 -> writeRaw (Proxy @"ex3_ex3_struct") ptr_0 ex3_ex3_struct_2 >> writeRaw (Proxy @"ex3_ex3_c") ptr_0 ex3_ex3_c_3
+deriving via (EquivStorable Ex3) instance Storable Ex3
+deriving via (IsStructViaReadRaw Ex3) instance IsStruct Ex3
+instance (~) ty Ex3_ex3_struct => HasField "ex3_ex3_struct" Ex3 ty
+    where hasField = \x_0 -> (\y_1 -> Ex3{ex3_ex3_struct = y_1,
+                                          ex3_ex3_c = getField @"ex3_ex3_c" x_0},
+                              getField @"ex3_ex3_struct" x_0)
+instance (~) ty Ex3_ex3_struct =>
+         HasField "ex3_ex3_struct" (Ptr Ex3) (Ptr ty)
+    where getField = fromPtr (Proxy @"ex3_ex3_struct")
+instance HasCField Ex3 "ex3_ex3_struct"
+    where type CFieldType Ex3 "ex3_ex3_struct" = Ex3_ex3_struct
+          offset# = \_ -> \_ -> 0
+instance (~) ty CFloat => HasField "ex3_ex3_c" Ex3 ty
+    where hasField = \x_0 -> (\y_1 -> Ex3{ex3_ex3_c = y_1,
+                                          ex3_ex3_struct = getField @"ex3_ex3_struct" x_0},
+                              getField @"ex3_ex3_c" x_0)
+instance (~) ty CFloat => HasField "ex3_ex3_c" (Ptr Ex3) (Ptr ty)
+    where getField = fromPtr (Proxy @"ex3_ex3_c")
+instance HasCField Ex3 "ex3_ex3_c"
+    where type CFieldType Ex3 "ex3_ex3_c" = CFloat
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct ex4_odd@
+
+    __defined at:__ @types\/nested\/nested_types.h 22:8@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Ex4_odd
+    = Ex4_odd {ex4_odd_value :: CInt
+               {- ^ __C declaration:__ @value@
+
+                    __defined at:__ @types\/nested\/nested_types.h 23:9@
+
+                    __exported by:__ @types\/nested\/nested_types.h@
+               -},
+               ex4_odd_next :: (Ptr Ex4_even)
+               {- ^ __C declaration:__ @next@
+
+                    __defined at:__ @types\/nested\/nested_types.h 27:8@
+
+                    __exported by:__ @types\/nested\/nested_types.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ex4_odd
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ex4_odd
+    where readRaw = \ptr_0 -> (pure Ex4_odd <*> readRaw (Proxy @"ex4_odd_value") ptr_0) <*> readRaw (Proxy @"ex4_odd_next") ptr_0
+instance WriteRaw Ex4_odd
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ex4_odd ex4_odd_value_2
+                                               ex4_odd_next_3 -> writeRaw (Proxy @"ex4_odd_value") ptr_0 ex4_odd_value_2 >> writeRaw (Proxy @"ex4_odd_next") ptr_0 ex4_odd_next_3
+deriving via (EquivStorable Ex4_odd) instance Storable Ex4_odd
+deriving via (IsStructViaReadRaw Ex4_odd) instance IsStruct Ex4_odd
+instance (~) ty CInt => HasField "ex4_odd_value" Ex4_odd ty
+    where hasField = \x_0 -> (\y_1 -> Ex4_odd{ex4_odd_value = y_1,
+                                              ex4_odd_next = getField @"ex4_odd_next" x_0},
+                              getField @"ex4_odd_value" x_0)
+instance (~) ty CInt =>
+         HasField "ex4_odd_value" (Ptr Ex4_odd) (Ptr ty)
+    where getField = fromPtr (Proxy @"ex4_odd_value")
+instance HasCField Ex4_odd "ex4_odd_value"
+    where type CFieldType Ex4_odd "ex4_odd_value" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Ex4_even) =>
+         HasField "ex4_odd_next" Ex4_odd ty
+    where hasField = \x_0 -> (\y_1 -> Ex4_odd{ex4_odd_next = y_1,
+                                              ex4_odd_value = getField @"ex4_odd_value" x_0},
+                              getField @"ex4_odd_next" x_0)
+instance (~) ty (Ptr Ex4_even) =>
+         HasField "ex4_odd_next" (Ptr Ex4_odd) (Ptr ty)
+    where getField = fromPtr (Proxy @"ex4_odd_next")
+instance HasCField Ex4_odd "ex4_odd_next"
+    where type CFieldType Ex4_odd "ex4_odd_next" = Ptr Ex4_even
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct ex4_even@
+
+    __defined at:__ @types\/nested\/nested_types.h 24:12@
+
+    __exported by:__ @types\/nested\/nested_types.h@
+-}
+data Ex4_even
+    = Ex4_even {ex4_even_value :: CDouble
+                {- ^ __C declaration:__ @value@
+
+                     __defined at:__ @types\/nested\/nested_types.h 25:16@
+
+                     __exported by:__ @types\/nested\/nested_types.h@
+                -},
+                ex4_even_next :: (Ptr Ex4_odd)
+                {- ^ __C declaration:__ @next@
+
+                     __defined at:__ @types\/nested\/nested_types.h 26:25@
+
+                     __exported by:__ @types\/nested\/nested_types.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Ex4_even
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Ex4_even
+    where readRaw = \ptr_0 -> (pure Ex4_even <*> readRaw (Proxy @"ex4_even_value") ptr_0) <*> readRaw (Proxy @"ex4_even_next") ptr_0
+instance WriteRaw Ex4_even
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Ex4_even ex4_even_value_2
+                                                ex4_even_next_3 -> writeRaw (Proxy @"ex4_even_value") ptr_0 ex4_even_value_2 >> writeRaw (Proxy @"ex4_even_next") ptr_0 ex4_even_next_3
+deriving via (EquivStorable Ex4_even) instance Storable Ex4_even
+deriving via (IsStructViaReadRaw Ex4_even) instance IsStruct Ex4_even
+instance (~) ty CDouble => HasField "ex4_even_value" Ex4_even ty
+    where hasField = \x_0 -> (\y_1 -> Ex4_even{ex4_even_value = y_1,
+                                               ex4_even_next = getField @"ex4_even_next" x_0},
+                              getField @"ex4_even_value" x_0)
+instance (~) ty CDouble =>
+         HasField "ex4_even_value" (Ptr Ex4_even) (Ptr ty)
+    where getField = fromPtr (Proxy @"ex4_even_value")
+instance HasCField Ex4_even "ex4_even_value"
+    where type CFieldType Ex4_even "ex4_even_value" = CDouble
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Ex4_odd) =>
+         HasField "ex4_even_next" Ex4_even ty
+    where hasField = \x_0 -> (\y_1 -> Ex4_even{ex4_even_next = y_1,
+                                               ex4_even_value = getField @"ex4_even_value" x_0},
+                              getField @"ex4_even_next" x_0)
+instance (~) ty (Ptr Ex4_odd) =>
+         HasField "ex4_even_next" (Ptr Ex4_even) (Ptr ty)
+    where getField = fromPtr (Proxy @"ex4_even_next")
+instance HasCField Ex4_even "ex4_even_next"
+    where type CFieldType Ex4_even "ex4_even_next" = Ptr Ex4_odd
+          offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/primitives/bool/Example.hs b/test-artefacts/fixtures/types/primitives/bool/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool/Example.hs
@@ -0,0 +1,392 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Bools1(..)
+    , Example.Bools2(..)
+    , Example.BOOL(..)
+    , Example.Bools3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @struct bools1@
+
+    __defined at:__ @types\/primitives\/bool.h 1:8@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+data Bools1 = Bools1
+  { bools1_x :: BG.CBool
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/primitives\/bool.h 2:11@
+
+         __exported by:__ @types\/primitives\/bool.h@
+    -}
+  , bools1_y :: BG.CBool
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/primitives\/bool.h 3:11@
+
+         __exported by:__ @types\/primitives\/bool.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bools1 where
+
+  staticSizeOf = \_ -> (2 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bools1 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bools1
+      <*> HasCField.readRaw (BG.Proxy @"bools1_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bools1_y") ptr0
+
+instance Marshal.WriteRaw Bools1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bools1 bools1_x2 bools1_y3 ->
+               HasCField.writeRaw (BG.Proxy @"bools1_x") ptr0 bools1_x2
+            >> HasCField.writeRaw (BG.Proxy @"bools1_y") ptr0 bools1_y3
+
+deriving via Marshal.EquivStorable Bools1 instance BG.Storable Bools1
+
+deriving via Struct.IsStructViaReadRaw Bools1 instance Struct.IsStruct Bools1
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/primitives\/bool.h 2:11@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "bools1_x" Bools1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bools1 {bools1_x = y1, bools1_y = BG.getField @"bools1_y" x0}
+      , BG.getField @"bools1_x" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "bools1_x" (BG.Ptr Bools1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bools1_x")
+
+instance HasCField.HasCField Bools1 "bools1_x" where
+
+  type CFieldType Bools1 "bools1_x" = BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/primitives\/bool.h 3:11@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "bools1_y" Bools1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bools1 {bools1_y = y1, bools1_x = BG.getField @"bools1_x" x0}
+      , BG.getField @"bools1_y" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "bools1_y" (BG.Ptr Bools1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bools1_y")
+
+instance HasCField.HasCField Bools1 "bools1_y" where
+
+  type CFieldType Bools1 "bools1_y" = BG.CBool
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @struct bools2@
+
+    __defined at:__ @types\/primitives\/bool.h 8:8@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+data Bools2 = Bools2
+  { bools2_x :: BG.CBool
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/primitives\/bool.h 9:10@
+
+         __exported by:__ @types\/primitives\/bool.h@
+    -}
+  , bools2_y :: BG.CBool
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/primitives\/bool.h 10:10@
+
+         __exported by:__ @types\/primitives\/bool.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bools2 where
+
+  staticSizeOf = \_ -> (2 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bools2 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bools2
+      <*> HasCField.readRaw (BG.Proxy @"bools2_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bools2_y") ptr0
+
+instance Marshal.WriteRaw Bools2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bools2 bools2_x2 bools2_y3 ->
+               HasCField.writeRaw (BG.Proxy @"bools2_x") ptr0 bools2_x2
+            >> HasCField.writeRaw (BG.Proxy @"bools2_y") ptr0 bools2_y3
+
+deriving via Marshal.EquivStorable Bools2 instance BG.Storable Bools2
+
+deriving via Struct.IsStructViaReadRaw Bools2 instance Struct.IsStruct Bools2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/primitives\/bool.h 9:10@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "bools2_x" Bools2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bools2 {bools2_x = y1, bools2_y = BG.getField @"bools2_y" x0}
+      , BG.getField @"bools2_x" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "bools2_x" (BG.Ptr Bools2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bools2_x")
+
+instance HasCField.HasCField Bools2 "bools2_x" where
+
+  type CFieldType Bools2 "bools2_x" = BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/primitives\/bool.h 10:10@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "bools2_y" Bools2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bools2 {bools2_y = y1, bools2_x = BG.getField @"bools2_x" x0}
+      , BG.getField @"bools2_y" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "bools2_y" (BG.Ptr Bools2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bools2_y")
+
+instance HasCField.HasCField Bools2 "bools2_y" where
+
+  type CFieldType Bools2 "bools2_y" = BG.CBool
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @types\/primitives\/bool.h 13:9@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+newtype BOOL = BOOL
+  { unwrapBOOL :: BG.CBool
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "unwrapBOOL" BOOL ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BOOL {unwrapBOOL = y1}, BG.getField @"unwrapBOOL" x0)
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "unwrapBOOL" (BG.Ptr BOOL) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapBOOL")
+
+instance HasCField.HasCField BOOL "unwrapBOOL" where
+
+  type CFieldType BOOL "unwrapBOOL" = BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct bools3@
+
+    __defined at:__ @types\/primitives\/bool.h 15:8@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+data Bools3 = Bools3
+  { bools3_x :: BOOL
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/primitives\/bool.h 16:10@
+
+         __exported by:__ @types\/primitives\/bool.h@
+    -}
+  , bools3_y :: BOOL
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/primitives\/bool.h 17:10@
+
+         __exported by:__ @types\/primitives\/bool.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bools3 where
+
+  staticSizeOf = \_ -> (2 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bools3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bools3
+      <*> HasCField.readRaw (BG.Proxy @"bools3_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"bools3_y") ptr0
+
+instance Marshal.WriteRaw Bools3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bools3 bools3_x2 bools3_y3 ->
+               HasCField.writeRaw (BG.Proxy @"bools3_x") ptr0 bools3_x2
+            >> HasCField.writeRaw (BG.Proxy @"bools3_y") ptr0 bools3_y3
+
+deriving via Marshal.EquivStorable Bools3 instance BG.Storable Bools3
+
+deriving via Struct.IsStructViaReadRaw Bools3 instance Struct.IsStruct Bools3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/primitives\/bool.h 16:10@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+instance (ty ~ BOOL) => BG.CompatHasField.HasField "bools3_x" Bools3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bools3 {bools3_x = y1, bools3_y = BG.getField @"bools3_y" x0}
+      , BG.getField @"bools3_x" x0
+      )
+
+instance (ty ~ BOOL) => BG.HasField "bools3_x" (BG.Ptr Bools3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bools3_x")
+
+instance HasCField.HasCField Bools3 "bools3_x" where
+
+  type CFieldType Bools3 "bools3_x" = BOOL
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/primitives\/bool.h 17:10@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+instance (ty ~ BOOL) => BG.CompatHasField.HasField "bools3_y" Bools3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bools3 {bools3_y = y1, bools3_x = BG.getField @"bools3_x" x0}
+      , BG.getField @"bools3_y" x0
+      )
+
+instance (ty ~ BOOL) => BG.HasField "bools3_y" (BG.Ptr Bools3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bools3_y")
+
+instance HasCField.HasCField Bools3 "bools3_y" where
+
+  type CFieldType Bools3 "bools3_y" = BOOL
+
+  offset# = \_ -> \_ -> 1
diff --git a/test-artefacts/fixtures/types/primitives/bool/bindingspec.yaml b/test-artefacts/fixtures/types/primitives/bool/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool/bindingspec.yaml
@@ -0,0 +1,112 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/primitives/bool.h
+  cname: struct bools1
+  hsname: Bools1
+- headers: types/primitives/bool.h
+  cname: struct bools2
+  hsname: Bools2
+- headers: types/primitives/bool.h
+  cname: macro BOOL
+  hsname: BOOL
+- headers: types/primitives/bool.h
+  cname: struct bools3
+  hsname: Bools3
+hstypes:
+- hsname: BOOL
+  representation:
+    newtype:
+      constructor: BOOL
+      fields:
+      - unwrapBOOL
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CBool
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bools1
+  representation:
+    record:
+      constructor: Bools1
+      fields:
+      - bools1_x
+      - bools1_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bools2
+  representation:
+    record:
+      constructor: Bools2
+      fields:
+      - bools2_x
+      - bools2_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bools3
+  representation:
+    record:
+      constructor: Bools3
+      fields:
+      - bools3_x
+      - bools3_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/primitives/bool/th.txt b/test-artefacts/fixtures/types/primitives/bool/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool/th.txt
@@ -0,0 +1,187 @@
+-- addDependentFile musl-include/x86_64/stdbool.h
+-- addDependentFile test-artefacts/headers/golden/types/primitives/bool.h
+{-| __C declaration:__ @struct bools1@
+
+    __defined at:__ @types\/primitives\/bool.h 1:8@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+data Bools1
+    = Bools1 {bools1_x :: CBool
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @types\/primitives\/bool.h 2:11@
+
+                   __exported by:__ @types\/primitives\/bool.h@
+              -},
+              bools1_y :: CBool
+              {- ^ __C declaration:__ @y@
+
+                   __defined at:__ @types\/primitives\/bool.h 3:11@
+
+                   __exported by:__ @types\/primitives\/bool.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bools1
+    where staticSizeOf = \_ -> 2 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bools1
+    where readRaw = \ptr_0 -> (pure Bools1 <*> readRaw (Proxy @"bools1_x") ptr_0) <*> readRaw (Proxy @"bools1_y") ptr_0
+instance WriteRaw Bools1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bools1 bools1_x_2
+                                              bools1_y_3 -> writeRaw (Proxy @"bools1_x") ptr_0 bools1_x_2 >> writeRaw (Proxy @"bools1_y") ptr_0 bools1_y_3
+deriving via (EquivStorable Bools1) instance Storable Bools1
+deriving via (IsStructViaReadRaw Bools1) instance IsStruct Bools1
+instance (~) ty CBool => HasField "bools1_x" Bools1 ty
+    where hasField = \x_0 -> (\y_1 -> Bools1{bools1_x = y_1,
+                                             bools1_y = getField @"bools1_y" x_0},
+                              getField @"bools1_x" x_0)
+instance (~) ty CBool => HasField "bools1_x" (Ptr Bools1) (Ptr ty)
+    where getField = fromPtr (Proxy @"bools1_x")
+instance HasCField Bools1 "bools1_x"
+    where type CFieldType Bools1 "bools1_x" = CBool
+          offset# = \_ -> \_ -> 0
+instance (~) ty CBool => HasField "bools1_y" Bools1 ty
+    where hasField = \x_0 -> (\y_1 -> Bools1{bools1_y = y_1,
+                                             bools1_x = getField @"bools1_x" x_0},
+                              getField @"bools1_y" x_0)
+instance (~) ty CBool => HasField "bools1_y" (Ptr Bools1) (Ptr ty)
+    where getField = fromPtr (Proxy @"bools1_y")
+instance HasCField Bools1 "bools1_y"
+    where type CFieldType Bools1 "bools1_y" = CBool
+          offset# = \_ -> \_ -> 1
+{-| __C declaration:__ @struct bools2@
+
+    __defined at:__ @types\/primitives\/bool.h 8:8@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+data Bools2
+    = Bools2 {bools2_x :: CBool
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @types\/primitives\/bool.h 9:10@
+
+                   __exported by:__ @types\/primitives\/bool.h@
+              -},
+              bools2_y :: CBool
+              {- ^ __C declaration:__ @y@
+
+                   __defined at:__ @types\/primitives\/bool.h 10:10@
+
+                   __exported by:__ @types\/primitives\/bool.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bools2
+    where staticSizeOf = \_ -> 2 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bools2
+    where readRaw = \ptr_0 -> (pure Bools2 <*> readRaw (Proxy @"bools2_x") ptr_0) <*> readRaw (Proxy @"bools2_y") ptr_0
+instance WriteRaw Bools2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bools2 bools2_x_2
+                                              bools2_y_3 -> writeRaw (Proxy @"bools2_x") ptr_0 bools2_x_2 >> writeRaw (Proxy @"bools2_y") ptr_0 bools2_y_3
+deriving via (EquivStorable Bools2) instance Storable Bools2
+deriving via (IsStructViaReadRaw Bools2) instance IsStruct Bools2
+instance (~) ty CBool => HasField "bools2_x" Bools2 ty
+    where hasField = \x_0 -> (\y_1 -> Bools2{bools2_x = y_1,
+                                             bools2_y = getField @"bools2_y" x_0},
+                              getField @"bools2_x" x_0)
+instance (~) ty CBool => HasField "bools2_x" (Ptr Bools2) (Ptr ty)
+    where getField = fromPtr (Proxy @"bools2_x")
+instance HasCField Bools2 "bools2_x"
+    where type CFieldType Bools2 "bools2_x" = CBool
+          offset# = \_ -> \_ -> 0
+instance (~) ty CBool => HasField "bools2_y" Bools2 ty
+    where hasField = \x_0 -> (\y_1 -> Bools2{bools2_y = y_1,
+                                             bools2_x = getField @"bools2_x" x_0},
+                              getField @"bools2_y" x_0)
+instance (~) ty CBool => HasField "bools2_y" (Ptr Bools2) (Ptr ty)
+    where getField = fromPtr (Proxy @"bools2_y")
+instance HasCField Bools2 "bools2_y"
+    where type CFieldType Bools2 "bools2_y" = CBool
+          offset# = \_ -> \_ -> 1
+{-| __C declaration:__ @macro BOOL@
+
+    __defined at:__ @types\/primitives\/bool.h 13:9@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+newtype BOOL
+    = BOOL {unwrapBOOL :: CBool}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CBool => HasField "unwrapBOOL" BOOL ty
+    where hasField = \x_0 -> (\y_1 -> BOOL{unwrapBOOL = y_1},
+                              getField @"unwrapBOOL" x_0)
+instance (~) ty CBool => HasField "unwrapBOOL" (Ptr BOOL) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBOOL")
+instance HasCField BOOL "unwrapBOOL"
+    where type CFieldType BOOL "unwrapBOOL" = CBool
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct bools3@
+
+    __defined at:__ @types\/primitives\/bool.h 15:8@
+
+    __exported by:__ @types\/primitives\/bool.h@
+-}
+data Bools3
+    = Bools3 {bools3_x :: BOOL
+              {- ^ __C declaration:__ @x@
+
+                   __defined at:__ @types\/primitives\/bool.h 16:10@
+
+                   __exported by:__ @types\/primitives\/bool.h@
+              -},
+              bools3_y :: BOOL
+              {- ^ __C declaration:__ @y@
+
+                   __defined at:__ @types\/primitives\/bool.h 17:10@
+
+                   __exported by:__ @types\/primitives\/bool.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bools3
+    where staticSizeOf = \_ -> 2 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bools3
+    where readRaw = \ptr_0 -> (pure Bools3 <*> readRaw (Proxy @"bools3_x") ptr_0) <*> readRaw (Proxy @"bools3_y") ptr_0
+instance WriteRaw Bools3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bools3 bools3_x_2
+                                              bools3_y_3 -> writeRaw (Proxy @"bools3_x") ptr_0 bools3_x_2 >> writeRaw (Proxy @"bools3_y") ptr_0 bools3_y_3
+deriving via (EquivStorable Bools3) instance Storable Bools3
+deriving via (IsStructViaReadRaw Bools3) instance IsStruct Bools3
+instance (~) ty BOOL => HasField "bools3_x" Bools3 ty
+    where hasField = \x_0 -> (\y_1 -> Bools3{bools3_x = y_1,
+                                             bools3_y = getField @"bools3_y" x_0},
+                              getField @"bools3_x" x_0)
+instance (~) ty BOOL => HasField "bools3_x" (Ptr Bools3) (Ptr ty)
+    where getField = fromPtr (Proxy @"bools3_x")
+instance HasCField Bools3 "bools3_x"
+    where type CFieldType Bools3 "bools3_x" = BOOL
+          offset# = \_ -> \_ -> 0
+instance (~) ty BOOL => HasField "bools3_y" Bools3 ty
+    where hasField = \x_0 -> (\y_1 -> Bools3{bools3_y = y_1,
+                                             bools3_x = getField @"bools3_x" x_0},
+                              getField @"bools3_y" x_0)
+instance (~) ty BOOL => HasField "bools3_y" (Ptr Bools3) (Ptr ty)
+    where getField = fromPtr (Proxy @"bools3_y")
+instance HasCField Bools3 "bools3_y"
+    where type CFieldType Bools3 "bools3_y" = BOOL
+          offset# = \_ -> \_ -> 1
diff --git a/test-artefacts/fixtures/types/primitives/bool_c23/Example/Global.hs b/test-artefacts/fixtures/types/primitives/bool_c23/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_c23/Example/Global.hs
@@ -0,0 +1,42 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/bool_c23.h>"
+  , "/* test_typesprimitivesbool_c23_Example_get_b */"
+  , "__attribute__ ((const))"
+  , "_Bool *hs_bindgen_31e1e443379b061b (void)"
+  , "{"
+  , "  return &b;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesbool_c23_Example_get_b@
+foreign import ccall unsafe "hs_bindgen_31e1e443379b061b" hs_bindgen_31e1e443379b061b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesprimitivesbool_c23_Example_get_b@
+hs_bindgen_31e1e443379b061b :: IO (BG.Ptr BG.CBool)
+hs_bindgen_31e1e443379b061b =
+  fmap BG.fromFFIType hs_bindgen_31e1e443379b061b_base
+
+{-# NOINLINE b #-}
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/primitives\/bool_c23.h 3:13@
+
+    __exported by:__ @types\/primitives\/bool_c23.h@
+-}
+b :: BG.Ptr BG.CBool
+b = BG.unsafePerformIO hs_bindgen_31e1e443379b061b
diff --git a/test-artefacts/fixtures/types/primitives/bool_c23/bindingspec.yaml b/test-artefacts/fixtures/types/primitives/bool_c23/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_c23/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/types/primitives/bool_c23/th.txt b/test-artefacts/fixtures/types/primitives/bool_c23/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_c23/th.txt
@@ -0,0 +1,30 @@
+-- addDependentFile test-artefacts/headers/golden/types/primitives/bool_c23.h
+-- #include <types/primitives/bool_c23.h>
+-- /* test_typesprimitivesbool_c23_Example_get_b */
+-- __attribute__ ((const))
+-- _Bool *hs_bindgen_31e1e443379b061b (void)
+-- {
+--   return &b;
+-- }
+-- __unique:__ @test_typesprimitivesbool_c23_Example_get_b@
+foreign import ccall unsafe "hs_bindgen_31e1e443379b061b" hs_bindgen_31e1e443379b061b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesprimitivesbool_c23_Example_get_b@
+hs_bindgen_31e1e443379b061b :: IO (Ptr CBool)
+-- __unique:__ @test_typesprimitivesbool_c23_Example_get_b@
+hs_bindgen_31e1e443379b061b = fmap fromFFIType hs_bindgen_31e1e443379b061b_base
+{-# NOINLINE b #-}
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/primitives\/bool_c23.h 3:13@
+
+    __exported by:__ @types\/primitives\/bool_c23.h@
+-}
+b :: Ptr CBool
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/primitives\/bool_c23.h 3:13@
+
+    __exported by:__ @types\/primitives\/bool_c23.h@
+-}
+b = unsafePerformIO hs_bindgen_31e1e443379b061b
diff --git a/test-artefacts/fixtures/types/primitives/bool_macro_override/Example.hs b/test-artefacts/fixtures/types/primitives/bool_macro_override/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_macro_override/Example.hs
@@ -0,0 +1,118 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    , Example.Bool'(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 9:9@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+newtype A = A
+  { unwrapA :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro bool@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 12:9@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+newtype Bool' = Bool'
+  { unwrapBool' :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapBool'" Bool' ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bool' {unwrapBool' = y1}, BG.getField @"unwrapBool'" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapBool'" (BG.Ptr Bool') (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBool'")
+
+instance HasCField.HasCField Bool' "unwrapBool'" where
+
+  type CFieldType Bool' "unwrapBool'" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/primitives/bool_macro_override/Example/FunPtr.hs b/test-artefacts/fixtures/types/primitives/bool_macro_override/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_macro_override/Example/FunPtr.hs
@@ -0,0 +1,75 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f
+    , Example.FunPtr.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/bool_macro_override.h>"
+  , "/* test_typesprimitivesbool_macro_ov_Example_get_f */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_aa1f6a0351ab44da (void)) ("
+  , "  A arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  return &f;"
+  , "}"
+  , "/* test_typesprimitivesbool_macro_ov_Example_get_g */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_c0944c7d91c77d18 (void)) ("
+  , "  A arg1,"
+  , "  bool arg2"
+  , ")"
+  , "{"
+  , "  return &g;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_aa1f6a0351ab44da" hs_bindgen_aa1f6a0351ab44da_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_f@
+hs_bindgen_aa1f6a0351ab44da :: IO (BG.FunPtr (A -> BG.CBool -> IO ()))
+hs_bindgen_aa1f6a0351ab44da =
+  fmap BG.fromFFIType hs_bindgen_aa1f6a0351ab44da_base
+
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 10:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+f :: BG.FunPtr (A -> BG.CBool -> IO ())
+f = BG.unsafePerformIO hs_bindgen_aa1f6a0351ab44da
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_c0944c7d91c77d18" hs_bindgen_c0944c7d91c77d18_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_g@
+hs_bindgen_c0944c7d91c77d18 :: IO (BG.FunPtr (A -> Bool' -> IO ()))
+hs_bindgen_c0944c7d91c77d18 =
+  fmap BG.fromFFIType hs_bindgen_c0944c7d91c77d18_base
+
+{-# NOINLINE g #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 13:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+g :: BG.FunPtr (A -> Bool' -> IO ())
+g = BG.unsafePerformIO hs_bindgen_c0944c7d91c77d18
diff --git a/test-artefacts/fixtures/types/primitives/bool_macro_override/Example/Safe.hs b/test-artefacts/fixtures/types/primitives/bool_macro_override/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_macro_override/Example/Safe.hs
@@ -0,0 +1,93 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f
+    , Example.Safe.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/bool_macro_override.h>"
+  , "void hs_bindgen_fc2c0275afbb3c2e ("
+  , "  A arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (f)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_d07d93e6b7330d03 ("
+  , "  A arg1,"
+  , "  bool arg2"
+  , ")"
+  , "{"
+  , "  (g)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_fc2c0275afbb3c2e" hs_bindgen_fc2c0275afbb3c2e_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_f@
+hs_bindgen_fc2c0275afbb3c2e ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_fc2c0275afbb3c2e =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_fc2c0275afbb3c2e_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 10:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+f ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> BG.CBool
+     -- ^ __C declaration:__ @y@
+  -> IO ()
+f = hs_bindgen_fc2c0275afbb3c2e
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_g@
+foreign import ccall safe "hs_bindgen_d07d93e6b7330d03" hs_bindgen_d07d93e6b7330d03_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_g@
+hs_bindgen_d07d93e6b7330d03 ::
+     A
+  -> Bool'
+  -> IO ()
+hs_bindgen_d07d93e6b7330d03 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_d07d93e6b7330d03_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 13:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+g ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> Bool'
+     -- ^ __C declaration:__ @y@
+  -> IO ()
+g = hs_bindgen_d07d93e6b7330d03
diff --git a/test-artefacts/fixtures/types/primitives/bool_macro_override/Example/Unsafe.hs b/test-artefacts/fixtures/types/primitives/bool_macro_override/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_macro_override/Example/Unsafe.hs
@@ -0,0 +1,93 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f
+    , Example.Unsafe.g
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/bool_macro_override.h>"
+  , "void hs_bindgen_c170f90cc5412c59 ("
+  , "  A arg1,"
+  , "  _Bool arg2"
+  , ")"
+  , "{"
+  , "  (f)(arg1, arg2);"
+  , "}"
+  , "void hs_bindgen_18fbcf94c0b76854 ("
+  , "  A arg1,"
+  , "  bool arg2"
+  , ")"
+  , "{"
+  , "  (g)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_c170f90cc5412c59" hs_bindgen_c170f90cc5412c59_base ::
+     BG.CInt
+  -> BG.CBool
+  -> IO ()
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_f@
+hs_bindgen_c170f90cc5412c59 ::
+     A
+  -> BG.CBool
+  -> IO ()
+hs_bindgen_c170f90cc5412c59 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c170f90cc5412c59_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 10:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+f ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> BG.CBool
+     -- ^ __C declaration:__ @y@
+  -> IO ()
+f = hs_bindgen_c170f90cc5412c59
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_g@
+foreign import ccall unsafe "hs_bindgen_18fbcf94c0b76854" hs_bindgen_18fbcf94c0b76854_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_g@
+hs_bindgen_18fbcf94c0b76854 ::
+     A
+  -> Bool'
+  -> IO ()
+hs_bindgen_18fbcf94c0b76854 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_18fbcf94c0b76854_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 13:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+g ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> Bool'
+     -- ^ __C declaration:__ @y@
+  -> IO ()
+g = hs_bindgen_18fbcf94c0b76854
diff --git a/test-artefacts/fixtures/types/primitives/bool_macro_override/bindingspec.yaml b/test-artefacts/fixtures/types/primitives/bool_macro_override/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_macro_override/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/primitives/bool_macro_override.h
+  cname: macro A
+  hsname: A
+- headers: types/primitives/bool_macro_override.h
+  cname: macro bool
+  hsname: Bool'
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bool'
+  representation:
+    newtype:
+      constructor: Bool'
+      fields:
+      - unwrapBool'
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/primitives/bool_macro_override/th.txt b/test-artefacts/fixtures/types/primitives/bool_macro_override/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_macro_override/th.txt
@@ -0,0 +1,248 @@
+-- addDependentFile test-artefacts/headers/golden/types/primitives/bool_macro_override.h
+-- #include <types/primitives/bool_macro_override.h>
+-- void hs_bindgen_fc2c0275afbb3c2e (
+--   A arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (f)(arg1, arg2);
+-- }
+-- void hs_bindgen_d07d93e6b7330d03 (
+--   A arg1,
+--   bool arg2
+-- )
+-- {
+--   (g)(arg1, arg2);
+-- }
+-- void hs_bindgen_c170f90cc5412c59 (
+--   A arg1,
+--   _Bool arg2
+-- )
+-- {
+--   (f)(arg1, arg2);
+-- }
+-- void hs_bindgen_18fbcf94c0b76854 (
+--   A arg1,
+--   bool arg2
+-- )
+-- {
+--   (g)(arg1, arg2);
+-- }
+-- /* test_typesprimitivesbool_macro_ov_Example_get_f */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_aa1f6a0351ab44da (void)) (
+--   A arg1,
+--   _Bool arg2
+-- )
+-- {
+--   return &f;
+-- }
+-- /* test_typesprimitivesbool_macro_ov_Example_get_g */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_c0944c7d91c77d18 (void)) (
+--   A arg1,
+--   bool arg2
+-- )
+-- {
+--   return &g;
+-- }
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 9:9@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+newtype A
+    = A {unwrapA :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty CInt => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro bool@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 12:9@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+newtype Bool'
+    = Bool' {unwrapBool' :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapBool'" Bool' ty
+    where hasField = \x_0 -> (\y_1 -> Bool'{unwrapBool' = y_1},
+                              getField @"unwrapBool'" x_0)
+instance (~) ty CInt => HasField "unwrapBool'" (Ptr Bool') (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBool'")
+instance HasCField Bool' "unwrapBool'"
+    where type CFieldType Bool' "unwrapBool'" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_f@
+foreign import ccall safe "hs_bindgen_fc2c0275afbb3c2e" hs_bindgen_fc2c0275afbb3c2e_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_f@
+hs_bindgen_fc2c0275afbb3c2e :: A -> CBool -> IO ()
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_f@
+hs_bindgen_fc2c0275afbb3c2e = \x_0 -> \x_1 -> hs_bindgen_fc2c0275afbb3c2e_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 10:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+f_safe :: A -> CBool -> IO ()
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 10:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+f_safe = hs_bindgen_fc2c0275afbb3c2e
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_g@
+foreign import ccall safe "hs_bindgen_d07d93e6b7330d03" hs_bindgen_d07d93e6b7330d03_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_g@
+hs_bindgen_d07d93e6b7330d03 :: A -> Bool' -> IO ()
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Safe_g@
+hs_bindgen_d07d93e6b7330d03 = \x_0 -> \x_1 -> hs_bindgen_d07d93e6b7330d03_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 13:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+g_safe :: A -> Bool' -> IO ()
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 13:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+g_safe = hs_bindgen_d07d93e6b7330d03
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_c170f90cc5412c59" hs_bindgen_c170f90cc5412c59_base ::
+    CInt
+ -> CBool
+ -> IO ()
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_f@
+hs_bindgen_c170f90cc5412c59 :: A -> CBool -> IO ()
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_f@
+hs_bindgen_c170f90cc5412c59 = \x_0 -> \x_1 -> hs_bindgen_c170f90cc5412c59_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 10:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+f_unsafe :: A -> CBool -> IO ()
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 10:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+f_unsafe = hs_bindgen_c170f90cc5412c59
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_g@
+foreign import ccall unsafe "hs_bindgen_18fbcf94c0b76854" hs_bindgen_18fbcf94c0b76854_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_g@
+hs_bindgen_18fbcf94c0b76854 :: A -> Bool' -> IO ()
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_Unsafe_g@
+hs_bindgen_18fbcf94c0b76854 = \x_0 -> \x_1 -> hs_bindgen_18fbcf94c0b76854_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 13:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+g_unsafe :: A -> Bool' -> IO ()
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 13:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+g_unsafe = hs_bindgen_18fbcf94c0b76854
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_aa1f6a0351ab44da" hs_bindgen_aa1f6a0351ab44da_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_f@
+hs_bindgen_aa1f6a0351ab44da :: IO (FunPtr (A -> CBool -> IO ()))
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_f@
+hs_bindgen_aa1f6a0351ab44da = fmap fromFFIType hs_bindgen_aa1f6a0351ab44da_base
+{-# NOINLINE f_funptr #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 10:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+f_funptr :: FunPtr (A -> CBool -> IO ())
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 10:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+f_funptr = unsafePerformIO hs_bindgen_aa1f6a0351ab44da
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_c0944c7d91c77d18" hs_bindgen_c0944c7d91c77d18_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_g@
+hs_bindgen_c0944c7d91c77d18 :: IO (FunPtr (A -> Bool' -> IO ()))
+-- __unique:__ @test_typesprimitivesbool_macro_ov_Example_get_g@
+hs_bindgen_c0944c7d91c77d18 = fmap fromFFIType hs_bindgen_c0944c7d91c77d18_base
+{-# NOINLINE g_funptr #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 13:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+g_funptr :: FunPtr (A -> Bool' -> IO ())
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/primitives\/bool_macro_override.h 13:6@
+
+    __exported by:__ @types\/primitives\/bool_macro_override.h@
+-}
+g_funptr = unsafePerformIO hs_bindgen_c0944c7d91c77d18
diff --git a/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example.hs b/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example.hs
@@ -0,0 +1,118 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.A(..)
+    , Example.Bool'(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 4:9@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+newtype A = A
+  { unwrapA :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapA" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {unwrapA = y1}, BG.getField @"unwrapA" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapA" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapA")
+
+instance HasCField.HasCField A "unwrapA" where
+
+  type CFieldType A "unwrapA" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @bool@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 5:13@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+newtype Bool' = Bool'
+  { unwrapBool' :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapBool'" Bool' ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bool' {unwrapBool' = y1}, BG.getField @"unwrapBool'" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapBool'" (BG.Ptr Bool') (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapBool'")
+
+instance HasCField.HasCField Bool' "unwrapBool'" where
+
+  type CFieldType Bool' "unwrapBool'" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example/FunPtr.hs b/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example/FunPtr.hs
@@ -0,0 +1,46 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.f
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/bool_typedef_override.h>"
+  , "/* test_typesprimitivesbool_typedef__Example_get_f */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_54e8e1ffb47ff670 (void)) ("
+  , "  A arg1,"
+  , "  bool arg2"
+  , ")"
+  , "{"
+  , "  return &f;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_get_f@
+foreign import ccall unsafe "hs_bindgen_54e8e1ffb47ff670" hs_bindgen_54e8e1ffb47ff670_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_get_f@
+hs_bindgen_54e8e1ffb47ff670 :: IO (BG.FunPtr (A -> Bool' -> IO ()))
+hs_bindgen_54e8e1ffb47ff670 =
+  fmap BG.fromFFIType hs_bindgen_54e8e1ffb47ff670_base
+
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 6:6@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+f :: BG.FunPtr (A -> Bool' -> IO ())
+f = BG.unsafePerformIO hs_bindgen_54e8e1ffb47ff670
diff --git a/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example/Safe.hs b/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example/Safe.hs
@@ -0,0 +1,55 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.f
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/bool_typedef_override.h>"
+  , "void hs_bindgen_ea0e9b7fd1e9560c ("
+  , "  A arg1,"
+  , "  bool arg2"
+  , ")"
+  , "{"
+  , "  (f)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Safe_f@
+foreign import ccall safe "hs_bindgen_ea0e9b7fd1e9560c" hs_bindgen_ea0e9b7fd1e9560c_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Safe_f@
+hs_bindgen_ea0e9b7fd1e9560c ::
+     A
+  -> Bool'
+  -> IO ()
+hs_bindgen_ea0e9b7fd1e9560c =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_ea0e9b7fd1e9560c_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 6:6@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+f ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> Bool'
+     -- ^ __C declaration:__ @y@
+  -> IO ()
+f = hs_bindgen_ea0e9b7fd1e9560c
diff --git a/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example/Unsafe.hs b/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_typedef_override/Example/Unsafe.hs
@@ -0,0 +1,55 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.f
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/bool_typedef_override.h>"
+  , "void hs_bindgen_1ab53e827ec0c8e2 ("
+  , "  A arg1,"
+  , "  bool arg2"
+  , ")"
+  , "{"
+  , "  (f)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_1ab53e827ec0c8e2" hs_bindgen_1ab53e827ec0c8e2_base ::
+     BG.CInt
+  -> BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Unsafe_f@
+hs_bindgen_1ab53e827ec0c8e2 ::
+     A
+  -> Bool'
+  -> IO ()
+hs_bindgen_1ab53e827ec0c8e2 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_1ab53e827ec0c8e2_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 6:6@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+f ::
+     A
+     -- ^ __C declaration:__ @x@
+  -> Bool'
+     -- ^ __C declaration:__ @y@
+  -> IO ()
+f = hs_bindgen_1ab53e827ec0c8e2
diff --git a/test-artefacts/fixtures/types/primitives/bool_typedef_override/bindingspec.yaml b/test-artefacts/fixtures/types/primitives/bool_typedef_override/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_typedef_override/bindingspec.yaml
@@ -0,0 +1,80 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/primitives/bool_typedef_override.h
+  cname: macro A
+  hsname: A
+- headers: types/primitives/bool_typedef_override.h
+  cname: bool
+  hsname: Bool'
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bool'
+  representation:
+    newtype:
+      constructor: Bool'
+      fields:
+      - unwrapBool'
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/primitives/bool_typedef_override/th.txt b/test-artefacts/fixtures/types/primitives/bool_typedef_override/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/bool_typedef_override/th.txt
@@ -0,0 +1,157 @@
+-- addDependentFile test-artefacts/headers/golden/types/primitives/bool_typedef_override.h
+-- #include <types/primitives/bool_typedef_override.h>
+-- void hs_bindgen_ea0e9b7fd1e9560c (
+--   A arg1,
+--   bool arg2
+-- )
+-- {
+--   (f)(arg1, arg2);
+-- }
+-- void hs_bindgen_1ab53e827ec0c8e2 (
+--   A arg1,
+--   bool arg2
+-- )
+-- {
+--   (f)(arg1, arg2);
+-- }
+-- /* test_typesprimitivesbool_typedef__Example_get_f */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_54e8e1ffb47ff670 (void)) (
+--   A arg1,
+--   bool arg2
+-- )
+-- {
+--   return &f;
+-- }
+{-| __C declaration:__ @macro A@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 4:9@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+newtype A
+    = A {unwrapA :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapA" A ty
+    where hasField = \x_0 -> (\y_1 -> A{unwrapA = y_1},
+                              getField @"unwrapA" x_0)
+instance (~) ty CInt => HasField "unwrapA" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapA")
+instance HasCField A "unwrapA"
+    where type CFieldType A "unwrapA" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @bool@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 5:13@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+newtype Bool'
+    = Bool' {unwrapBool' :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapBool'" Bool' ty
+    where hasField = \x_0 -> (\y_1 -> Bool'{unwrapBool' = y_1},
+                              getField @"unwrapBool'" x_0)
+instance (~) ty CInt => HasField "unwrapBool'" (Ptr Bool') (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapBool'")
+instance HasCField Bool' "unwrapBool'"
+    where type CFieldType Bool' "unwrapBool'" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Safe_f@
+foreign import ccall safe "hs_bindgen_ea0e9b7fd1e9560c" hs_bindgen_ea0e9b7fd1e9560c_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Safe_f@
+hs_bindgen_ea0e9b7fd1e9560c :: A -> Bool' -> IO ()
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Safe_f@
+hs_bindgen_ea0e9b7fd1e9560c = \x_0 -> \x_1 -> hs_bindgen_ea0e9b7fd1e9560c_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 6:6@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+f_safe :: A -> Bool' -> IO ()
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 6:6@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+f_safe = hs_bindgen_ea0e9b7fd1e9560c
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Unsafe_f@
+foreign import ccall unsafe "hs_bindgen_1ab53e827ec0c8e2" hs_bindgen_1ab53e827ec0c8e2_base ::
+    CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Unsafe_f@
+hs_bindgen_1ab53e827ec0c8e2 :: A -> Bool' -> IO ()
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_Unsafe_f@
+hs_bindgen_1ab53e827ec0c8e2 = \x_0 -> \x_1 -> hs_bindgen_1ab53e827ec0c8e2_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 6:6@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+f_unsafe :: A -> Bool' -> IO ()
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 6:6@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+f_unsafe = hs_bindgen_1ab53e827ec0c8e2
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_get_f@
+foreign import ccall unsafe "hs_bindgen_54e8e1ffb47ff670" hs_bindgen_54e8e1ffb47ff670_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_get_f@
+hs_bindgen_54e8e1ffb47ff670 :: IO (FunPtr (A -> Bool' -> IO ()))
+-- __unique:__ @test_typesprimitivesbool_typedef__Example_get_f@
+hs_bindgen_54e8e1ffb47ff670 = fmap fromFFIType hs_bindgen_54e8e1ffb47ff670_base
+{-# NOINLINE f_funptr #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 6:6@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+f_funptr :: FunPtr (A -> Bool' -> IO ())
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/bool_typedef_override.h 6:6@
+
+    __exported by:__ @types\/primitives\/bool_typedef_override.h@
+-}
+f_funptr = unsafePerformIO hs_bindgen_54e8e1ffb47ff670
diff --git a/test-artefacts/fixtures/types/primitives/fixedwidth/Example.hs b/test-artefacts/fixtures/types/primitives/fixedwidth/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/fixedwidth/Example.hs
@@ -0,0 +1,137 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @types\/primitives\/fixedwidth.h 3:8@
+
+    __exported by:__ @types\/primitives\/fixedwidth.h@
+-}
+data Foo = Foo
+  { foo_sixty_four :: HsBindgen.Runtime.LibC.Word64
+    {- ^ __C declaration:__ @sixty_four@
+
+         __defined at:__ @types\/primitives\/fixedwidth.h 4:11@
+
+         __exported by:__ @types\/primitives\/fixedwidth.h@
+    -}
+  , foo_thirty_two :: HsBindgen.Runtime.LibC.Word32
+    {- ^ __C declaration:__ @thirty_two@
+
+         __defined at:__ @types\/primitives\/fixedwidth.h 5:11@
+
+         __exported by:__ @types\/primitives\/fixedwidth.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Foo where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo
+      <*> HasCField.readRaw (BG.Proxy @"foo_sixty_four") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"foo_thirty_two") ptr0
+
+instance Marshal.WriteRaw Foo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo foo_sixty_four2 foo_thirty_two3 ->
+               HasCField.writeRaw (BG.Proxy @"foo_sixty_four") ptr0 foo_sixty_four2
+            >> HasCField.writeRaw (BG.Proxy @"foo_thirty_two") ptr0 foo_thirty_two3
+
+deriving via Marshal.EquivStorable Foo instance BG.Storable Foo
+
+deriving via Struct.IsStructViaReadRaw Foo instance Struct.IsStruct Foo
+
+{-| __C declaration:__ @sixty_four@
+
+    __defined at:__ @types\/primitives\/fixedwidth.h 4:11@
+
+    __exported by:__ @types\/primitives\/fixedwidth.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "foo_sixty_four" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_sixty_four = y1, foo_thirty_two = BG.getField @"foo_thirty_two" x0}
+      , BG.getField @"foo_sixty_four" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "foo_sixty_four" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"foo_sixty_four")
+
+instance HasCField.HasCField Foo "foo_sixty_four" where
+
+  type CFieldType Foo "foo_sixty_four" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @thirty_two@
+
+    __defined at:__ @types\/primitives\/fixedwidth.h 5:11@
+
+    __exported by:__ @types\/primitives\/fixedwidth.h@
+-}
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "foo_thirty_two" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_thirty_two = y1, foo_sixty_four = BG.getField @"foo_sixty_four" x0}
+      , BG.getField @"foo_thirty_two" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "foo_thirty_two" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"foo_thirty_two")
+
+instance HasCField.HasCField Foo "foo_thirty_two" where
+
+  type CFieldType Foo "foo_thirty_two" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/primitives/fixedwidth/bindingspec.yaml b/test-artefacts/fixtures/types/primitives/fixedwidth/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/fixedwidth/bindingspec.yaml
@@ -0,0 +1,29 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/primitives/fixedwidth.h
+  cname: struct foo
+  hsname: Foo
+hstypes:
+- hsname: Foo
+  representation:
+    record:
+      constructor: Foo
+      fields:
+      - foo_sixty_four
+      - foo_thirty_two
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/primitives/fixedwidth/th.txt b/test-artefacts/fixtures/types/primitives/fixedwidth/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/fixedwidth/th.txt
@@ -0,0 +1,61 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile test-artefacts/headers/golden/types/primitives/fixedwidth.h
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @types\/primitives\/fixedwidth.h 3:8@
+
+    __exported by:__ @types\/primitives\/fixedwidth.h@
+-}
+data Foo
+    = Foo {foo_sixty_four :: HsBindgen.Runtime.LibC.Word64
+           {- ^ __C declaration:__ @sixty_four@
+
+                __defined at:__ @types\/primitives\/fixedwidth.h 4:11@
+
+                __exported by:__ @types\/primitives\/fixedwidth.h@
+           -},
+           foo_thirty_two :: HsBindgen.Runtime.LibC.Word32
+           {- ^ __C declaration:__ @thirty_two@
+
+                __defined at:__ @types\/primitives\/fixedwidth.h 5:11@
+
+                __exported by:__ @types\/primitives\/fixedwidth.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Foo
+    where readRaw = \ptr_0 -> (pure Foo <*> readRaw (Proxy @"foo_sixty_four") ptr_0) <*> readRaw (Proxy @"foo_thirty_two") ptr_0
+instance WriteRaw Foo
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo foo_sixty_four_2
+                                           foo_thirty_two_3 -> writeRaw (Proxy @"foo_sixty_four") ptr_0 foo_sixty_four_2 >> writeRaw (Proxy @"foo_thirty_two") ptr_0 foo_thirty_two_3
+deriving via (EquivStorable Foo) instance Storable Foo
+deriving via (IsStructViaReadRaw Foo) instance IsStruct Foo
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "foo_sixty_four" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_sixty_four = y_1,
+                                          foo_thirty_two = getField @"foo_thirty_two" x_0},
+                              getField @"foo_sixty_four" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "foo_sixty_four" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_sixty_four")
+instance HasCField Foo "foo_sixty_four"
+    where type CFieldType Foo
+                          "foo_sixty_four" = HsBindgen.Runtime.LibC.Word64
+          offset# = \_ -> \_ -> 0
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "foo_thirty_two" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_thirty_two = y_1,
+                                          foo_sixty_four = getField @"foo_sixty_four" x_0},
+                              getField @"foo_thirty_two" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "foo_thirty_two" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_thirty_two")
+instance HasCField Foo "foo_thirty_two"
+    where type CFieldType Foo
+                          "foo_thirty_two" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/primitives/least_fast/Example.hs b/test-artefacts/fixtures/types/primitives/least_fast/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/least_fast/Example.hs
@@ -0,0 +1,841 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Int_fast16_t(..)
+    , Example.Int_fast32_t(..)
+    , Example.Uint_fast16_t(..)
+    , Example.Uint_fast32_t(..)
+    , Example.Int_fast8_t(..)
+    , Example.Int_fast64_t(..)
+    , Example.Int_least8_t(..)
+    , Example.Int_least16_t(..)
+    , Example.Int_least32_t(..)
+    , Example.Int_least64_t(..)
+    , Example.Uint_fast8_t(..)
+    , Example.Uint_fast64_t(..)
+    , Example.Uint_least8_t(..)
+    , Example.Uint_least16_t(..)
+    , Example.Uint_least32_t(..)
+    , Example.Uint_least64_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Integral, Num, Ord, Read, Real, Show, type (~))
+
+{-| __C declaration:__ @int_fast16_t@
+
+    __defined at:__ @bits\/stdint.h 1:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_fast16_t = Int_fast16_t
+  { unwrapInt_fast16_t :: HsBindgen.Runtime.LibC.Int32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "unwrapInt_fast16_t" Int_fast16_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Int_fast16_t {unwrapInt_fast16_t = y1}
+      , BG.getField @"unwrapInt_fast16_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "unwrapInt_fast16_t" (BG.Ptr Int_fast16_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt_fast16_t")
+
+instance HasCField.HasCField Int_fast16_t "unwrapInt_fast16_t" where
+
+  type CFieldType Int_fast16_t "unwrapInt_fast16_t" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int_fast32_t@
+
+    __defined at:__ @bits\/stdint.h 2:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_fast32_t = Int_fast32_t
+  { unwrapInt_fast32_t :: HsBindgen.Runtime.LibC.Int32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "unwrapInt_fast32_t" Int_fast32_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Int_fast32_t {unwrapInt_fast32_t = y1}
+      , BG.getField @"unwrapInt_fast32_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "unwrapInt_fast32_t" (BG.Ptr Int_fast32_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt_fast32_t")
+
+instance HasCField.HasCField Int_fast32_t "unwrapInt_fast32_t" where
+
+  type CFieldType Int_fast32_t "unwrapInt_fast32_t" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @uint_fast16_t@
+
+    __defined at:__ @bits\/stdint.h 3:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_fast16_t = Uint_fast16_t
+  { unwrapUint_fast16_t :: HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "unwrapUint_fast16_t" Uint_fast16_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Uint_fast16_t {unwrapUint_fast16_t = y1}
+      , BG.getField @"unwrapUint_fast16_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "unwrapUint_fast16_t" (BG.Ptr Uint_fast16_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint_fast16_t")
+
+instance HasCField.HasCField Uint_fast16_t "unwrapUint_fast16_t" where
+
+  type CFieldType Uint_fast16_t "unwrapUint_fast16_t" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @uint_fast32_t@
+
+    __defined at:__ @bits\/stdint.h 4:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_fast32_t = Uint_fast32_t
+  { unwrapUint_fast32_t :: HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "unwrapUint_fast32_t" Uint_fast32_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Uint_fast32_t {unwrapUint_fast32_t = y1}
+      , BG.getField @"unwrapUint_fast32_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "unwrapUint_fast32_t" (BG.Ptr Uint_fast32_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint_fast32_t")
+
+instance HasCField.HasCField Uint_fast32_t "unwrapUint_fast32_t" where
+
+  type CFieldType Uint_fast32_t "unwrapUint_fast32_t" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int_fast8_t@
+
+    __defined at:__ @stdint.h 22:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_fast8_t = Int_fast8_t
+  { unwrapInt_fast8_t :: HsBindgen.Runtime.LibC.Int8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "unwrapInt_fast8_t" Int_fast8_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Int_fast8_t {unwrapInt_fast8_t = y1}
+      , BG.getField @"unwrapInt_fast8_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "unwrapInt_fast8_t" (BG.Ptr Int_fast8_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt_fast8_t")
+
+instance HasCField.HasCField Int_fast8_t "unwrapInt_fast8_t" where
+
+  type CFieldType Int_fast8_t "unwrapInt_fast8_t" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int_fast64_t@
+
+    __defined at:__ @stdint.h 23:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_fast64_t = Int_fast64_t
+  { unwrapInt_fast64_t :: HsBindgen.Runtime.LibC.Int64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "unwrapInt_fast64_t" Int_fast64_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Int_fast64_t {unwrapInt_fast64_t = y1}
+      , BG.getField @"unwrapInt_fast64_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "unwrapInt_fast64_t" (BG.Ptr Int_fast64_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt_fast64_t")
+
+instance HasCField.HasCField Int_fast64_t "unwrapInt_fast64_t" where
+
+  type CFieldType Int_fast64_t "unwrapInt_fast64_t" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int_least8_t@
+
+    __defined at:__ @stdint.h 25:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_least8_t = Int_least8_t
+  { unwrapInt_least8_t :: HsBindgen.Runtime.LibC.Int8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "unwrapInt_least8_t" Int_least8_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Int_least8_t {unwrapInt_least8_t = y1}
+      , BG.getField @"unwrapInt_least8_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "unwrapInt_least8_t" (BG.Ptr Int_least8_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt_least8_t")
+
+instance HasCField.HasCField Int_least8_t "unwrapInt_least8_t" where
+
+  type CFieldType Int_least8_t "unwrapInt_least8_t" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int_least16_t@
+
+    __defined at:__ @stdint.h 26:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_least16_t = Int_least16_t
+  { unwrapInt_least16_t :: HsBindgen.Runtime.LibC.Int16
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int16
+         ) => BG.CompatHasField.HasField "unwrapInt_least16_t" Int_least16_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Int_least16_t {unwrapInt_least16_t = y1}
+      , BG.getField @"unwrapInt_least16_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int16
+         ) => BG.HasField "unwrapInt_least16_t" (BG.Ptr Int_least16_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt_least16_t")
+
+instance HasCField.HasCField Int_least16_t "unwrapInt_least16_t" where
+
+  type CFieldType Int_least16_t "unwrapInt_least16_t" =
+    HsBindgen.Runtime.LibC.Int16
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int_least32_t@
+
+    __defined at:__ @stdint.h 27:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_least32_t = Int_least32_t
+  { unwrapInt_least32_t :: HsBindgen.Runtime.LibC.Int32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "unwrapInt_least32_t" Int_least32_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Int_least32_t {unwrapInt_least32_t = y1}
+      , BG.getField @"unwrapInt_least32_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "unwrapInt_least32_t" (BG.Ptr Int_least32_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt_least32_t")
+
+instance HasCField.HasCField Int_least32_t "unwrapInt_least32_t" where
+
+  type CFieldType Int_least32_t "unwrapInt_least32_t" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int_least64_t@
+
+    __defined at:__ @stdint.h 28:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_least64_t = Int_least64_t
+  { unwrapInt_least64_t :: HsBindgen.Runtime.LibC.Int64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "unwrapInt_least64_t" Int_least64_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Int_least64_t {unwrapInt_least64_t = y1}
+      , BG.getField @"unwrapInt_least64_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "unwrapInt_least64_t" (BG.Ptr Int_least64_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt_least64_t")
+
+instance HasCField.HasCField Int_least64_t "unwrapInt_least64_t" where
+
+  type CFieldType Int_least64_t "unwrapInt_least64_t" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @uint_fast8_t@
+
+    __defined at:__ @stdint.h 30:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_fast8_t = Uint_fast8_t
+  { unwrapUint_fast8_t :: HsBindgen.Runtime.LibC.Word8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "unwrapUint_fast8_t" Uint_fast8_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Uint_fast8_t {unwrapUint_fast8_t = y1}
+      , BG.getField @"unwrapUint_fast8_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "unwrapUint_fast8_t" (BG.Ptr Uint_fast8_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint_fast8_t")
+
+instance HasCField.HasCField Uint_fast8_t "unwrapUint_fast8_t" where
+
+  type CFieldType Uint_fast8_t "unwrapUint_fast8_t" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @uint_fast64_t@
+
+    __defined at:__ @stdint.h 31:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_fast64_t = Uint_fast64_t
+  { unwrapUint_fast64_t :: HsBindgen.Runtime.LibC.Word64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "unwrapUint_fast64_t" Uint_fast64_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Uint_fast64_t {unwrapUint_fast64_t = y1}
+      , BG.getField @"unwrapUint_fast64_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "unwrapUint_fast64_t" (BG.Ptr Uint_fast64_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint_fast64_t")
+
+instance HasCField.HasCField Uint_fast64_t "unwrapUint_fast64_t" where
+
+  type CFieldType Uint_fast64_t "unwrapUint_fast64_t" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @uint_least8_t@
+
+    __defined at:__ @stdint.h 33:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_least8_t = Uint_least8_t
+  { unwrapUint_least8_t :: HsBindgen.Runtime.LibC.Word8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "unwrapUint_least8_t" Uint_least8_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Uint_least8_t {unwrapUint_least8_t = y1}
+      , BG.getField @"unwrapUint_least8_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "unwrapUint_least8_t" (BG.Ptr Uint_least8_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint_least8_t")
+
+instance HasCField.HasCField Uint_least8_t "unwrapUint_least8_t" where
+
+  type CFieldType Uint_least8_t "unwrapUint_least8_t" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @uint_least16_t@
+
+    __defined at:__ @stdint.h 34:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_least16_t = Uint_least16_t
+  { unwrapUint_least16_t :: HsBindgen.Runtime.LibC.Word16
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.CompatHasField.HasField "unwrapUint_least16_t" Uint_least16_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Uint_least16_t {unwrapUint_least16_t = y1}
+      , BG.getField @"unwrapUint_least16_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.HasField "unwrapUint_least16_t" (BG.Ptr Uint_least16_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint_least16_t")
+
+instance HasCField.HasCField Uint_least16_t "unwrapUint_least16_t" where
+
+  type CFieldType Uint_least16_t "unwrapUint_least16_t" =
+    HsBindgen.Runtime.LibC.Word16
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @uint_least32_t@
+
+    __defined at:__ @stdint.h 35:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_least32_t = Uint_least32_t
+  { unwrapUint_least32_t :: HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "unwrapUint_least32_t" Uint_least32_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Uint_least32_t {unwrapUint_least32_t = y1}
+      , BG.getField @"unwrapUint_least32_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "unwrapUint_least32_t" (BG.Ptr Uint_least32_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint_least32_t")
+
+instance HasCField.HasCField Uint_least32_t "unwrapUint_least32_t" where
+
+  type CFieldType Uint_least32_t "unwrapUint_least32_t" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @uint_least64_t@
+
+    __defined at:__ @stdint.h 36:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_least64_t = Uint_least64_t
+  { unwrapUint_least64_t :: HsBindgen.Runtime.LibC.Word64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "unwrapUint_least64_t" Uint_least64_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Uint_least64_t {unwrapUint_least64_t = y1}
+      , BG.getField @"unwrapUint_least64_t" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "unwrapUint_least64_t" (BG.Ptr Uint_least64_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint_least64_t")
+
+instance HasCField.HasCField Uint_least64_t "unwrapUint_least64_t" where
+
+  type CFieldType Uint_least64_t "unwrapUint_least64_t" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/primitives/least_fast/Example/FunPtr.hs b/test-artefacts/fixtures/types/primitives/least_fast/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/least_fast/Example/FunPtr.hs
@@ -0,0 +1,449 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.int_least8_t_fun
+    , Example.FunPtr.int_least16_t_fun
+    , Example.FunPtr.int_least32_t_fun
+    , Example.FunPtr.int_least64_t_fun
+    , Example.FunPtr.uint_least8_t_fun
+    , Example.FunPtr.uint_least16_t_fun
+    , Example.FunPtr.uint_least32_t_fun
+    , Example.FunPtr.uint_least64_t_fun
+    , Example.FunPtr.int_fast8_t_fun
+    , Example.FunPtr.int_fast16_t_fun
+    , Example.FunPtr.int_fast32_t_fun
+    , Example.FunPtr.int_fast64_t_fun
+    , Example.FunPtr.uint_fast8_t_fun
+    , Example.FunPtr.uint_fast16_t_fun
+    , Example.FunPtr.uint_fast32_t_fun
+    , Example.FunPtr.uint_fast64_t_fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/least_fast.h>"
+  , "/* test_typesprimitivesleast_fast_Example_get_int_least8_t_fun */"
+  , "__attribute__ ((const))"
+  , "int_least8_t (*hs_bindgen_0391876bad2745ce (void)) (void)"
+  , "{"
+  , "  return &int_least8_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_int_least16_t_fun */"
+  , "__attribute__ ((const))"
+  , "int_least16_t (*hs_bindgen_0af5d61729271291 (void)) (void)"
+  , "{"
+  , "  return &int_least16_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_int_least32_t_fun */"
+  , "__attribute__ ((const))"
+  , "int_least32_t (*hs_bindgen_335ec637d8d81f56 (void)) (void)"
+  , "{"
+  , "  return &int_least32_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_int_least64_t_fun */"
+  , "__attribute__ ((const))"
+  , "int_least64_t (*hs_bindgen_eedbb79d8eb0ca67 (void)) (void)"
+  , "{"
+  , "  return &int_least64_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_uint_least8_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint_least8_t (*hs_bindgen_cae759b263e9dcdd (void)) (void)"
+  , "{"
+  , "  return &uint_least8_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_uint_least16_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint_least16_t (*hs_bindgen_66a8cb9486f831fe (void)) (void)"
+  , "{"
+  , "  return &uint_least16_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_uint_least32_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint_least32_t (*hs_bindgen_bfc0feef86d3e7d0 (void)) (void)"
+  , "{"
+  , "  return &uint_least32_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_uint_least64_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint_least64_t (*hs_bindgen_1886bff0b6836087 (void)) (void)"
+  , "{"
+  , "  return &uint_least64_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_int_fast8_t_fun */"
+  , "__attribute__ ((const))"
+  , "int_fast8_t (*hs_bindgen_08f27d79a8ef226d (void)) (void)"
+  , "{"
+  , "  return &int_fast8_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_int_fast16_t_fun */"
+  , "__attribute__ ((const))"
+  , "int_fast16_t (*hs_bindgen_1bff6fbb3c56abd5 (void)) (void)"
+  , "{"
+  , "  return &int_fast16_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_int_fast32_t_fun */"
+  , "__attribute__ ((const))"
+  , "int_fast32_t (*hs_bindgen_8a1d629866650da2 (void)) (void)"
+  , "{"
+  , "  return &int_fast32_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_int_fast64_t_fun */"
+  , "__attribute__ ((const))"
+  , "int_fast64_t (*hs_bindgen_c112b0dedac2cffa (void)) (void)"
+  , "{"
+  , "  return &int_fast64_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_uint_fast8_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint_fast8_t (*hs_bindgen_c20e96bd69bdb439 (void)) (void)"
+  , "{"
+  , "  return &uint_fast8_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_uint_fast16_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint_fast16_t (*hs_bindgen_c4f607ba753f0616 (void)) (void)"
+  , "{"
+  , "  return &uint_fast16_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_uint_fast32_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint_fast32_t (*hs_bindgen_c22f26851616c098 (void)) (void)"
+  , "{"
+  , "  return &uint_fast32_t_fun;"
+  , "}"
+  , "/* test_typesprimitivesleast_fast_Example_get_uint_fast64_t_fun */"
+  , "__attribute__ ((const))"
+  , "uint_fast64_t (*hs_bindgen_3ee59d750d0d2d2a (void)) (void)"
+  , "{"
+  , "  return &uint_fast64_t_fun;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least8_t_fun@
+foreign import ccall unsafe "hs_bindgen_0391876bad2745ce" hs_bindgen_0391876bad2745ce_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least8_t_fun@
+hs_bindgen_0391876bad2745ce :: IO (BG.FunPtr (IO Int_least8_t))
+hs_bindgen_0391876bad2745ce =
+  fmap BG.fromFFIType hs_bindgen_0391876bad2745ce_base
+
+{-# NOINLINE int_least8_t_fun #-}
+{-| __C declaration:__ @int_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 7:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least8_t_fun :: BG.FunPtr (IO Int_least8_t)
+int_least8_t_fun =
+  BG.unsafePerformIO hs_bindgen_0391876bad2745ce
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least16_t_fun@
+foreign import ccall unsafe "hs_bindgen_0af5d61729271291" hs_bindgen_0af5d61729271291_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least16_t_fun@
+hs_bindgen_0af5d61729271291 :: IO (BG.FunPtr (IO Int_least16_t))
+hs_bindgen_0af5d61729271291 =
+  fmap BG.fromFFIType hs_bindgen_0af5d61729271291_base
+
+{-# NOINLINE int_least16_t_fun #-}
+{-| __C declaration:__ @int_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 8:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least16_t_fun :: BG.FunPtr (IO Int_least16_t)
+int_least16_t_fun =
+  BG.unsafePerformIO hs_bindgen_0af5d61729271291
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least32_t_fun@
+foreign import ccall unsafe "hs_bindgen_335ec637d8d81f56" hs_bindgen_335ec637d8d81f56_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least32_t_fun@
+hs_bindgen_335ec637d8d81f56 :: IO (BG.FunPtr (IO Int_least32_t))
+hs_bindgen_335ec637d8d81f56 =
+  fmap BG.fromFFIType hs_bindgen_335ec637d8d81f56_base
+
+{-# NOINLINE int_least32_t_fun #-}
+{-| __C declaration:__ @int_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 9:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least32_t_fun :: BG.FunPtr (IO Int_least32_t)
+int_least32_t_fun =
+  BG.unsafePerformIO hs_bindgen_335ec637d8d81f56
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least64_t_fun@
+foreign import ccall unsafe "hs_bindgen_eedbb79d8eb0ca67" hs_bindgen_eedbb79d8eb0ca67_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least64_t_fun@
+hs_bindgen_eedbb79d8eb0ca67 :: IO (BG.FunPtr (IO Int_least64_t))
+hs_bindgen_eedbb79d8eb0ca67 =
+  fmap BG.fromFFIType hs_bindgen_eedbb79d8eb0ca67_base
+
+{-# NOINLINE int_least64_t_fun #-}
+{-| __C declaration:__ @int_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 10:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least64_t_fun :: BG.FunPtr (IO Int_least64_t)
+int_least64_t_fun =
+  BG.unsafePerformIO hs_bindgen_eedbb79d8eb0ca67
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least8_t_fun@
+foreign import ccall unsafe "hs_bindgen_cae759b263e9dcdd" hs_bindgen_cae759b263e9dcdd_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least8_t_fun@
+hs_bindgen_cae759b263e9dcdd :: IO (BG.FunPtr (IO Uint_least8_t))
+hs_bindgen_cae759b263e9dcdd =
+  fmap BG.fromFFIType hs_bindgen_cae759b263e9dcdd_base
+
+{-# NOINLINE uint_least8_t_fun #-}
+{-| __C declaration:__ @uint_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 12:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least8_t_fun :: BG.FunPtr (IO Uint_least8_t)
+uint_least8_t_fun =
+  BG.unsafePerformIO hs_bindgen_cae759b263e9dcdd
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least16_t_fun@
+foreign import ccall unsafe "hs_bindgen_66a8cb9486f831fe" hs_bindgen_66a8cb9486f831fe_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least16_t_fun@
+hs_bindgen_66a8cb9486f831fe :: IO (BG.FunPtr (IO Uint_least16_t))
+hs_bindgen_66a8cb9486f831fe =
+  fmap BG.fromFFIType hs_bindgen_66a8cb9486f831fe_base
+
+{-# NOINLINE uint_least16_t_fun #-}
+{-| __C declaration:__ @uint_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 13:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least16_t_fun :: BG.FunPtr (IO Uint_least16_t)
+uint_least16_t_fun =
+  BG.unsafePerformIO hs_bindgen_66a8cb9486f831fe
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least32_t_fun@
+foreign import ccall unsafe "hs_bindgen_bfc0feef86d3e7d0" hs_bindgen_bfc0feef86d3e7d0_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least32_t_fun@
+hs_bindgen_bfc0feef86d3e7d0 :: IO (BG.FunPtr (IO Uint_least32_t))
+hs_bindgen_bfc0feef86d3e7d0 =
+  fmap BG.fromFFIType hs_bindgen_bfc0feef86d3e7d0_base
+
+{-# NOINLINE uint_least32_t_fun #-}
+{-| __C declaration:__ @uint_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 14:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least32_t_fun :: BG.FunPtr (IO Uint_least32_t)
+uint_least32_t_fun =
+  BG.unsafePerformIO hs_bindgen_bfc0feef86d3e7d0
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least64_t_fun@
+foreign import ccall unsafe "hs_bindgen_1886bff0b6836087" hs_bindgen_1886bff0b6836087_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least64_t_fun@
+hs_bindgen_1886bff0b6836087 :: IO (BG.FunPtr (IO Uint_least64_t))
+hs_bindgen_1886bff0b6836087 =
+  fmap BG.fromFFIType hs_bindgen_1886bff0b6836087_base
+
+{-# NOINLINE uint_least64_t_fun #-}
+{-| __C declaration:__ @uint_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 15:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least64_t_fun :: BG.FunPtr (IO Uint_least64_t)
+uint_least64_t_fun =
+  BG.unsafePerformIO hs_bindgen_1886bff0b6836087
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast8_t_fun@
+foreign import ccall unsafe "hs_bindgen_08f27d79a8ef226d" hs_bindgen_08f27d79a8ef226d_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast8_t_fun@
+hs_bindgen_08f27d79a8ef226d :: IO (BG.FunPtr (IO Int_fast8_t))
+hs_bindgen_08f27d79a8ef226d =
+  fmap BG.fromFFIType hs_bindgen_08f27d79a8ef226d_base
+
+{-# NOINLINE int_fast8_t_fun #-}
+{-| __C declaration:__ @int_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 17:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast8_t_fun :: BG.FunPtr (IO Int_fast8_t)
+int_fast8_t_fun =
+  BG.unsafePerformIO hs_bindgen_08f27d79a8ef226d
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast16_t_fun@
+foreign import ccall unsafe "hs_bindgen_1bff6fbb3c56abd5" hs_bindgen_1bff6fbb3c56abd5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast16_t_fun@
+hs_bindgen_1bff6fbb3c56abd5 :: IO (BG.FunPtr (IO Int_fast16_t))
+hs_bindgen_1bff6fbb3c56abd5 =
+  fmap BG.fromFFIType hs_bindgen_1bff6fbb3c56abd5_base
+
+{-# NOINLINE int_fast16_t_fun #-}
+{-| __C declaration:__ @int_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 18:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast16_t_fun :: BG.FunPtr (IO Int_fast16_t)
+int_fast16_t_fun =
+  BG.unsafePerformIO hs_bindgen_1bff6fbb3c56abd5
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast32_t_fun@
+foreign import ccall unsafe "hs_bindgen_8a1d629866650da2" hs_bindgen_8a1d629866650da2_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast32_t_fun@
+hs_bindgen_8a1d629866650da2 :: IO (BG.FunPtr (IO Int_fast32_t))
+hs_bindgen_8a1d629866650da2 =
+  fmap BG.fromFFIType hs_bindgen_8a1d629866650da2_base
+
+{-# NOINLINE int_fast32_t_fun #-}
+{-| __C declaration:__ @int_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 19:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast32_t_fun :: BG.FunPtr (IO Int_fast32_t)
+int_fast32_t_fun =
+  BG.unsafePerformIO hs_bindgen_8a1d629866650da2
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast64_t_fun@
+foreign import ccall unsafe "hs_bindgen_c112b0dedac2cffa" hs_bindgen_c112b0dedac2cffa_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast64_t_fun@
+hs_bindgen_c112b0dedac2cffa :: IO (BG.FunPtr (IO Int_fast64_t))
+hs_bindgen_c112b0dedac2cffa =
+  fmap BG.fromFFIType hs_bindgen_c112b0dedac2cffa_base
+
+{-# NOINLINE int_fast64_t_fun #-}
+{-| __C declaration:__ @int_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 20:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast64_t_fun :: BG.FunPtr (IO Int_fast64_t)
+int_fast64_t_fun =
+  BG.unsafePerformIO hs_bindgen_c112b0dedac2cffa
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast8_t_fun@
+foreign import ccall unsafe "hs_bindgen_c20e96bd69bdb439" hs_bindgen_c20e96bd69bdb439_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast8_t_fun@
+hs_bindgen_c20e96bd69bdb439 :: IO (BG.FunPtr (IO Uint_fast8_t))
+hs_bindgen_c20e96bd69bdb439 =
+  fmap BG.fromFFIType hs_bindgen_c20e96bd69bdb439_base
+
+{-# NOINLINE uint_fast8_t_fun #-}
+{-| __C declaration:__ @uint_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 22:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast8_t_fun :: BG.FunPtr (IO Uint_fast8_t)
+uint_fast8_t_fun =
+  BG.unsafePerformIO hs_bindgen_c20e96bd69bdb439
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast16_t_fun@
+foreign import ccall unsafe "hs_bindgen_c4f607ba753f0616" hs_bindgen_c4f607ba753f0616_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast16_t_fun@
+hs_bindgen_c4f607ba753f0616 :: IO (BG.FunPtr (IO Uint_fast16_t))
+hs_bindgen_c4f607ba753f0616 =
+  fmap BG.fromFFIType hs_bindgen_c4f607ba753f0616_base
+
+{-# NOINLINE uint_fast16_t_fun #-}
+{-| __C declaration:__ @uint_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 23:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast16_t_fun :: BG.FunPtr (IO Uint_fast16_t)
+uint_fast16_t_fun =
+  BG.unsafePerformIO hs_bindgen_c4f607ba753f0616
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast32_t_fun@
+foreign import ccall unsafe "hs_bindgen_c22f26851616c098" hs_bindgen_c22f26851616c098_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast32_t_fun@
+hs_bindgen_c22f26851616c098 :: IO (BG.FunPtr (IO Uint_fast32_t))
+hs_bindgen_c22f26851616c098 =
+  fmap BG.fromFFIType hs_bindgen_c22f26851616c098_base
+
+{-# NOINLINE uint_fast32_t_fun #-}
+{-| __C declaration:__ @uint_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 24:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast32_t_fun :: BG.FunPtr (IO Uint_fast32_t)
+uint_fast32_t_fun =
+  BG.unsafePerformIO hs_bindgen_c22f26851616c098
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast64_t_fun@
+foreign import ccall unsafe "hs_bindgen_3ee59d750d0d2d2a" hs_bindgen_3ee59d750d0d2d2a_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast64_t_fun@
+hs_bindgen_3ee59d750d0d2d2a :: IO (BG.FunPtr (IO Uint_fast64_t))
+hs_bindgen_3ee59d750d0d2d2a =
+  fmap BG.fromFFIType hs_bindgen_3ee59d750d0d2d2a_base
+
+{-# NOINLINE uint_fast64_t_fun #-}
+{-| __C declaration:__ @uint_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 25:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast64_t_fun :: BG.FunPtr (IO Uint_fast64_t)
+uint_fast64_t_fun =
+  BG.unsafePerformIO hs_bindgen_3ee59d750d0d2d2a
diff --git a/test-artefacts/fixtures/types/primitives/least_fast/Example/Safe.hs b/test-artefacts/fixtures/types/primitives/least_fast/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/least_fast/Example/Safe.hs
@@ -0,0 +1,386 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.int_least8_t_fun
+    , Example.Safe.int_least16_t_fun
+    , Example.Safe.int_least32_t_fun
+    , Example.Safe.int_least64_t_fun
+    , Example.Safe.uint_least8_t_fun
+    , Example.Safe.uint_least16_t_fun
+    , Example.Safe.uint_least32_t_fun
+    , Example.Safe.uint_least64_t_fun
+    , Example.Safe.int_fast8_t_fun
+    , Example.Safe.int_fast16_t_fun
+    , Example.Safe.int_fast32_t_fun
+    , Example.Safe.int_fast64_t_fun
+    , Example.Safe.uint_fast8_t_fun
+    , Example.Safe.uint_fast16_t_fun
+    , Example.Safe.uint_fast32_t_fun
+    , Example.Safe.uint_fast64_t_fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/least_fast.h>"
+  , "int_least8_t hs_bindgen_ad6572fbf5eadb77 (void)"
+  , "{"
+  , "  return (int_least8_t_fun)();"
+  , "}"
+  , "int_least16_t hs_bindgen_1b76f016106283f9 (void)"
+  , "{"
+  , "  return (int_least16_t_fun)();"
+  , "}"
+  , "int_least32_t hs_bindgen_6ed0daff627b4e5c (void)"
+  , "{"
+  , "  return (int_least32_t_fun)();"
+  , "}"
+  , "int_least64_t hs_bindgen_3973a552158e924e (void)"
+  , "{"
+  , "  return (int_least64_t_fun)();"
+  , "}"
+  , "uint_least8_t hs_bindgen_8444813dd4e79f7f (void)"
+  , "{"
+  , "  return (uint_least8_t_fun)();"
+  , "}"
+  , "uint_least16_t hs_bindgen_1b71c9bb2bf1881f (void)"
+  , "{"
+  , "  return (uint_least16_t_fun)();"
+  , "}"
+  , "uint_least32_t hs_bindgen_24abaf3275c0126f (void)"
+  , "{"
+  , "  return (uint_least32_t_fun)();"
+  , "}"
+  , "uint_least64_t hs_bindgen_45be86cc87258955 (void)"
+  , "{"
+  , "  return (uint_least64_t_fun)();"
+  , "}"
+  , "int_fast8_t hs_bindgen_223fd78a0ee18a9d (void)"
+  , "{"
+  , "  return (int_fast8_t_fun)();"
+  , "}"
+  , "int_fast16_t hs_bindgen_097db32b72dabc72 (void)"
+  , "{"
+  , "  return (int_fast16_t_fun)();"
+  , "}"
+  , "int_fast32_t hs_bindgen_a406174bb602d355 (void)"
+  , "{"
+  , "  return (int_fast32_t_fun)();"
+  , "}"
+  , "int_fast64_t hs_bindgen_eeb2cb113fbc86ce (void)"
+  , "{"
+  , "  return (int_fast64_t_fun)();"
+  , "}"
+  , "uint_fast8_t hs_bindgen_32aa304dae0c8a3d (void)"
+  , "{"
+  , "  return (uint_fast8_t_fun)();"
+  , "}"
+  , "uint_fast16_t hs_bindgen_81ec605d32f0724d (void)"
+  , "{"
+  , "  return (uint_fast16_t_fun)();"
+  , "}"
+  , "uint_fast32_t hs_bindgen_f20ac50dff139544 (void)"
+  , "{"
+  , "  return (uint_fast32_t_fun)();"
+  , "}"
+  , "uint_fast64_t hs_bindgen_9d5a9bc3a5b3b294 (void)"
+  , "{"
+  , "  return (uint_fast64_t_fun)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least8_t_fun@
+foreign import ccall safe "hs_bindgen_ad6572fbf5eadb77" hs_bindgen_ad6572fbf5eadb77_base ::
+     IO HsBindgen.Runtime.LibC.Int8
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least8_t_fun@
+hs_bindgen_ad6572fbf5eadb77 :: IO Int_least8_t
+hs_bindgen_ad6572fbf5eadb77 =
+  fmap BG.fromFFIType hs_bindgen_ad6572fbf5eadb77_base
+
+{-| __C declaration:__ @int_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 7:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least8_t_fun :: IO Int_least8_t
+int_least8_t_fun = hs_bindgen_ad6572fbf5eadb77
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least16_t_fun@
+foreign import ccall safe "hs_bindgen_1b76f016106283f9" hs_bindgen_1b76f016106283f9_base ::
+     IO HsBindgen.Runtime.LibC.Int16
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least16_t_fun@
+hs_bindgen_1b76f016106283f9 :: IO Int_least16_t
+hs_bindgen_1b76f016106283f9 =
+  fmap BG.fromFFIType hs_bindgen_1b76f016106283f9_base
+
+{-| __C declaration:__ @int_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 8:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least16_t_fun :: IO Int_least16_t
+int_least16_t_fun = hs_bindgen_1b76f016106283f9
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least32_t_fun@
+foreign import ccall safe "hs_bindgen_6ed0daff627b4e5c" hs_bindgen_6ed0daff627b4e5c_base ::
+     IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least32_t_fun@
+hs_bindgen_6ed0daff627b4e5c :: IO Int_least32_t
+hs_bindgen_6ed0daff627b4e5c =
+  fmap BG.fromFFIType hs_bindgen_6ed0daff627b4e5c_base
+
+{-| __C declaration:__ @int_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 9:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least32_t_fun :: IO Int_least32_t
+int_least32_t_fun = hs_bindgen_6ed0daff627b4e5c
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least64_t_fun@
+foreign import ccall safe "hs_bindgen_3973a552158e924e" hs_bindgen_3973a552158e924e_base ::
+     IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least64_t_fun@
+hs_bindgen_3973a552158e924e :: IO Int_least64_t
+hs_bindgen_3973a552158e924e =
+  fmap BG.fromFFIType hs_bindgen_3973a552158e924e_base
+
+{-| __C declaration:__ @int_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 10:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least64_t_fun :: IO Int_least64_t
+int_least64_t_fun = hs_bindgen_3973a552158e924e
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least8_t_fun@
+foreign import ccall safe "hs_bindgen_8444813dd4e79f7f" hs_bindgen_8444813dd4e79f7f_base ::
+     IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least8_t_fun@
+hs_bindgen_8444813dd4e79f7f :: IO Uint_least8_t
+hs_bindgen_8444813dd4e79f7f =
+  fmap BG.fromFFIType hs_bindgen_8444813dd4e79f7f_base
+
+{-| __C declaration:__ @uint_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 12:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least8_t_fun :: IO Uint_least8_t
+uint_least8_t_fun = hs_bindgen_8444813dd4e79f7f
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least16_t_fun@
+foreign import ccall safe "hs_bindgen_1b71c9bb2bf1881f" hs_bindgen_1b71c9bb2bf1881f_base ::
+     IO HsBindgen.Runtime.LibC.Word16
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least16_t_fun@
+hs_bindgen_1b71c9bb2bf1881f :: IO Uint_least16_t
+hs_bindgen_1b71c9bb2bf1881f =
+  fmap BG.fromFFIType hs_bindgen_1b71c9bb2bf1881f_base
+
+{-| __C declaration:__ @uint_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 13:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least16_t_fun :: IO Uint_least16_t
+uint_least16_t_fun = hs_bindgen_1b71c9bb2bf1881f
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least32_t_fun@
+foreign import ccall safe "hs_bindgen_24abaf3275c0126f" hs_bindgen_24abaf3275c0126f_base ::
+     IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least32_t_fun@
+hs_bindgen_24abaf3275c0126f :: IO Uint_least32_t
+hs_bindgen_24abaf3275c0126f =
+  fmap BG.fromFFIType hs_bindgen_24abaf3275c0126f_base
+
+{-| __C declaration:__ @uint_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 14:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least32_t_fun :: IO Uint_least32_t
+uint_least32_t_fun = hs_bindgen_24abaf3275c0126f
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least64_t_fun@
+foreign import ccall safe "hs_bindgen_45be86cc87258955" hs_bindgen_45be86cc87258955_base ::
+     IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least64_t_fun@
+hs_bindgen_45be86cc87258955 :: IO Uint_least64_t
+hs_bindgen_45be86cc87258955 =
+  fmap BG.fromFFIType hs_bindgen_45be86cc87258955_base
+
+{-| __C declaration:__ @uint_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 15:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least64_t_fun :: IO Uint_least64_t
+uint_least64_t_fun = hs_bindgen_45be86cc87258955
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast8_t_fun@
+foreign import ccall safe "hs_bindgen_223fd78a0ee18a9d" hs_bindgen_223fd78a0ee18a9d_base ::
+     IO HsBindgen.Runtime.LibC.Int8
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast8_t_fun@
+hs_bindgen_223fd78a0ee18a9d :: IO Int_fast8_t
+hs_bindgen_223fd78a0ee18a9d =
+  fmap BG.fromFFIType hs_bindgen_223fd78a0ee18a9d_base
+
+{-| __C declaration:__ @int_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 17:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast8_t_fun :: IO Int_fast8_t
+int_fast8_t_fun = hs_bindgen_223fd78a0ee18a9d
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast16_t_fun@
+foreign import ccall safe "hs_bindgen_097db32b72dabc72" hs_bindgen_097db32b72dabc72_base ::
+     IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast16_t_fun@
+hs_bindgen_097db32b72dabc72 :: IO Int_fast16_t
+hs_bindgen_097db32b72dabc72 =
+  fmap BG.fromFFIType hs_bindgen_097db32b72dabc72_base
+
+{-| __C declaration:__ @int_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 18:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast16_t_fun :: IO Int_fast16_t
+int_fast16_t_fun = hs_bindgen_097db32b72dabc72
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast32_t_fun@
+foreign import ccall safe "hs_bindgen_a406174bb602d355" hs_bindgen_a406174bb602d355_base ::
+     IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast32_t_fun@
+hs_bindgen_a406174bb602d355 :: IO Int_fast32_t
+hs_bindgen_a406174bb602d355 =
+  fmap BG.fromFFIType hs_bindgen_a406174bb602d355_base
+
+{-| __C declaration:__ @int_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 19:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast32_t_fun :: IO Int_fast32_t
+int_fast32_t_fun = hs_bindgen_a406174bb602d355
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast64_t_fun@
+foreign import ccall safe "hs_bindgen_eeb2cb113fbc86ce" hs_bindgen_eeb2cb113fbc86ce_base ::
+     IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast64_t_fun@
+hs_bindgen_eeb2cb113fbc86ce :: IO Int_fast64_t
+hs_bindgen_eeb2cb113fbc86ce =
+  fmap BG.fromFFIType hs_bindgen_eeb2cb113fbc86ce_base
+
+{-| __C declaration:__ @int_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 20:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast64_t_fun :: IO Int_fast64_t
+int_fast64_t_fun = hs_bindgen_eeb2cb113fbc86ce
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast8_t_fun@
+foreign import ccall safe "hs_bindgen_32aa304dae0c8a3d" hs_bindgen_32aa304dae0c8a3d_base ::
+     IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast8_t_fun@
+hs_bindgen_32aa304dae0c8a3d :: IO Uint_fast8_t
+hs_bindgen_32aa304dae0c8a3d =
+  fmap BG.fromFFIType hs_bindgen_32aa304dae0c8a3d_base
+
+{-| __C declaration:__ @uint_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 22:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast8_t_fun :: IO Uint_fast8_t
+uint_fast8_t_fun = hs_bindgen_32aa304dae0c8a3d
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast16_t_fun@
+foreign import ccall safe "hs_bindgen_81ec605d32f0724d" hs_bindgen_81ec605d32f0724d_base ::
+     IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast16_t_fun@
+hs_bindgen_81ec605d32f0724d :: IO Uint_fast16_t
+hs_bindgen_81ec605d32f0724d =
+  fmap BG.fromFFIType hs_bindgen_81ec605d32f0724d_base
+
+{-| __C declaration:__ @uint_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 23:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast16_t_fun :: IO Uint_fast16_t
+uint_fast16_t_fun = hs_bindgen_81ec605d32f0724d
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast32_t_fun@
+foreign import ccall safe "hs_bindgen_f20ac50dff139544" hs_bindgen_f20ac50dff139544_base ::
+     IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast32_t_fun@
+hs_bindgen_f20ac50dff139544 :: IO Uint_fast32_t
+hs_bindgen_f20ac50dff139544 =
+  fmap BG.fromFFIType hs_bindgen_f20ac50dff139544_base
+
+{-| __C declaration:__ @uint_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 24:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast32_t_fun :: IO Uint_fast32_t
+uint_fast32_t_fun = hs_bindgen_f20ac50dff139544
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast64_t_fun@
+foreign import ccall safe "hs_bindgen_9d5a9bc3a5b3b294" hs_bindgen_9d5a9bc3a5b3b294_base ::
+     IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast64_t_fun@
+hs_bindgen_9d5a9bc3a5b3b294 :: IO Uint_fast64_t
+hs_bindgen_9d5a9bc3a5b3b294 =
+  fmap BG.fromFFIType hs_bindgen_9d5a9bc3a5b3b294_base
+
+{-| __C declaration:__ @uint_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 25:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast64_t_fun :: IO Uint_fast64_t
+uint_fast64_t_fun = hs_bindgen_9d5a9bc3a5b3b294
diff --git a/test-artefacts/fixtures/types/primitives/least_fast/Example/Unsafe.hs b/test-artefacts/fixtures/types/primitives/least_fast/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/least_fast/Example/Unsafe.hs
@@ -0,0 +1,386 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.int_least8_t_fun
+    , Example.Unsafe.int_least16_t_fun
+    , Example.Unsafe.int_least32_t_fun
+    , Example.Unsafe.int_least64_t_fun
+    , Example.Unsafe.uint_least8_t_fun
+    , Example.Unsafe.uint_least16_t_fun
+    , Example.Unsafe.uint_least32_t_fun
+    , Example.Unsafe.uint_least64_t_fun
+    , Example.Unsafe.int_fast8_t_fun
+    , Example.Unsafe.int_fast16_t_fun
+    , Example.Unsafe.int_fast32_t_fun
+    , Example.Unsafe.int_fast64_t_fun
+    , Example.Unsafe.uint_fast8_t_fun
+    , Example.Unsafe.uint_fast16_t_fun
+    , Example.Unsafe.uint_fast32_t_fun
+    , Example.Unsafe.uint_fast64_t_fun
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/primitives/least_fast.h>"
+  , "int_least8_t hs_bindgen_57bd94cbb0575f53 (void)"
+  , "{"
+  , "  return (int_least8_t_fun)();"
+  , "}"
+  , "int_least16_t hs_bindgen_f02c70143a88af90 (void)"
+  , "{"
+  , "  return (int_least16_t_fun)();"
+  , "}"
+  , "int_least32_t hs_bindgen_f5bbad7b8ac35f06 (void)"
+  , "{"
+  , "  return (int_least32_t_fun)();"
+  , "}"
+  , "int_least64_t hs_bindgen_b2036b95960e2751 (void)"
+  , "{"
+  , "  return (int_least64_t_fun)();"
+  , "}"
+  , "uint_least8_t hs_bindgen_d893fc1d41730120 (void)"
+  , "{"
+  , "  return (uint_least8_t_fun)();"
+  , "}"
+  , "uint_least16_t hs_bindgen_eaf2d3e09a41513e (void)"
+  , "{"
+  , "  return (uint_least16_t_fun)();"
+  , "}"
+  , "uint_least32_t hs_bindgen_dfdb9c77b9f2e16d (void)"
+  , "{"
+  , "  return (uint_least32_t_fun)();"
+  , "}"
+  , "uint_least64_t hs_bindgen_35c7ddf6def5281e (void)"
+  , "{"
+  , "  return (uint_least64_t_fun)();"
+  , "}"
+  , "int_fast8_t hs_bindgen_5144ac530f23abd8 (void)"
+  , "{"
+  , "  return (int_fast8_t_fun)();"
+  , "}"
+  , "int_fast16_t hs_bindgen_a102db8605e0b669 (void)"
+  , "{"
+  , "  return (int_fast16_t_fun)();"
+  , "}"
+  , "int_fast32_t hs_bindgen_97faff4568d5bc6a (void)"
+  , "{"
+  , "  return (int_fast32_t_fun)();"
+  , "}"
+  , "int_fast64_t hs_bindgen_ce1a64e61a9f9432 (void)"
+  , "{"
+  , "  return (int_fast64_t_fun)();"
+  , "}"
+  , "uint_fast8_t hs_bindgen_653d74ee9fd982e2 (void)"
+  , "{"
+  , "  return (uint_fast8_t_fun)();"
+  , "}"
+  , "uint_fast16_t hs_bindgen_31bf7eba8a098bae (void)"
+  , "{"
+  , "  return (uint_fast16_t_fun)();"
+  , "}"
+  , "uint_fast32_t hs_bindgen_fb324d72364e5685 (void)"
+  , "{"
+  , "  return (uint_fast32_t_fun)();"
+  , "}"
+  , "uint_fast64_t hs_bindgen_a2995f3603c68c65 (void)"
+  , "{"
+  , "  return (uint_fast64_t_fun)();"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least8_t_fun@
+foreign import ccall unsafe "hs_bindgen_57bd94cbb0575f53" hs_bindgen_57bd94cbb0575f53_base ::
+     IO HsBindgen.Runtime.LibC.Int8
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least8_t_fun@
+hs_bindgen_57bd94cbb0575f53 :: IO Int_least8_t
+hs_bindgen_57bd94cbb0575f53 =
+  fmap BG.fromFFIType hs_bindgen_57bd94cbb0575f53_base
+
+{-| __C declaration:__ @int_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 7:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least8_t_fun :: IO Int_least8_t
+int_least8_t_fun = hs_bindgen_57bd94cbb0575f53
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least16_t_fun@
+foreign import ccall unsafe "hs_bindgen_f02c70143a88af90" hs_bindgen_f02c70143a88af90_base ::
+     IO HsBindgen.Runtime.LibC.Int16
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least16_t_fun@
+hs_bindgen_f02c70143a88af90 :: IO Int_least16_t
+hs_bindgen_f02c70143a88af90 =
+  fmap BG.fromFFIType hs_bindgen_f02c70143a88af90_base
+
+{-| __C declaration:__ @int_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 8:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least16_t_fun :: IO Int_least16_t
+int_least16_t_fun = hs_bindgen_f02c70143a88af90
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least32_t_fun@
+foreign import ccall unsafe "hs_bindgen_f5bbad7b8ac35f06" hs_bindgen_f5bbad7b8ac35f06_base ::
+     IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least32_t_fun@
+hs_bindgen_f5bbad7b8ac35f06 :: IO Int_least32_t
+hs_bindgen_f5bbad7b8ac35f06 =
+  fmap BG.fromFFIType hs_bindgen_f5bbad7b8ac35f06_base
+
+{-| __C declaration:__ @int_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 9:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least32_t_fun :: IO Int_least32_t
+int_least32_t_fun = hs_bindgen_f5bbad7b8ac35f06
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least64_t_fun@
+foreign import ccall unsafe "hs_bindgen_b2036b95960e2751" hs_bindgen_b2036b95960e2751_base ::
+     IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least64_t_fun@
+hs_bindgen_b2036b95960e2751 :: IO Int_least64_t
+hs_bindgen_b2036b95960e2751 =
+  fmap BG.fromFFIType hs_bindgen_b2036b95960e2751_base
+
+{-| __C declaration:__ @int_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 10:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least64_t_fun :: IO Int_least64_t
+int_least64_t_fun = hs_bindgen_b2036b95960e2751
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least8_t_fun@
+foreign import ccall unsafe "hs_bindgen_d893fc1d41730120" hs_bindgen_d893fc1d41730120_base ::
+     IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least8_t_fun@
+hs_bindgen_d893fc1d41730120 :: IO Uint_least8_t
+hs_bindgen_d893fc1d41730120 =
+  fmap BG.fromFFIType hs_bindgen_d893fc1d41730120_base
+
+{-| __C declaration:__ @uint_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 12:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least8_t_fun :: IO Uint_least8_t
+uint_least8_t_fun = hs_bindgen_d893fc1d41730120
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least16_t_fun@
+foreign import ccall unsafe "hs_bindgen_eaf2d3e09a41513e" hs_bindgen_eaf2d3e09a41513e_base ::
+     IO HsBindgen.Runtime.LibC.Word16
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least16_t_fun@
+hs_bindgen_eaf2d3e09a41513e :: IO Uint_least16_t
+hs_bindgen_eaf2d3e09a41513e =
+  fmap BG.fromFFIType hs_bindgen_eaf2d3e09a41513e_base
+
+{-| __C declaration:__ @uint_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 13:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least16_t_fun :: IO Uint_least16_t
+uint_least16_t_fun = hs_bindgen_eaf2d3e09a41513e
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least32_t_fun@
+foreign import ccall unsafe "hs_bindgen_dfdb9c77b9f2e16d" hs_bindgen_dfdb9c77b9f2e16d_base ::
+     IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least32_t_fun@
+hs_bindgen_dfdb9c77b9f2e16d :: IO Uint_least32_t
+hs_bindgen_dfdb9c77b9f2e16d =
+  fmap BG.fromFFIType hs_bindgen_dfdb9c77b9f2e16d_base
+
+{-| __C declaration:__ @uint_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 14:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least32_t_fun :: IO Uint_least32_t
+uint_least32_t_fun = hs_bindgen_dfdb9c77b9f2e16d
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least64_t_fun@
+foreign import ccall unsafe "hs_bindgen_35c7ddf6def5281e" hs_bindgen_35c7ddf6def5281e_base ::
+     IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least64_t_fun@
+hs_bindgen_35c7ddf6def5281e :: IO Uint_least64_t
+hs_bindgen_35c7ddf6def5281e =
+  fmap BG.fromFFIType hs_bindgen_35c7ddf6def5281e_base
+
+{-| __C declaration:__ @uint_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 15:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least64_t_fun :: IO Uint_least64_t
+uint_least64_t_fun = hs_bindgen_35c7ddf6def5281e
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast8_t_fun@
+foreign import ccall unsafe "hs_bindgen_5144ac530f23abd8" hs_bindgen_5144ac530f23abd8_base ::
+     IO HsBindgen.Runtime.LibC.Int8
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast8_t_fun@
+hs_bindgen_5144ac530f23abd8 :: IO Int_fast8_t
+hs_bindgen_5144ac530f23abd8 =
+  fmap BG.fromFFIType hs_bindgen_5144ac530f23abd8_base
+
+{-| __C declaration:__ @int_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 17:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast8_t_fun :: IO Int_fast8_t
+int_fast8_t_fun = hs_bindgen_5144ac530f23abd8
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast16_t_fun@
+foreign import ccall unsafe "hs_bindgen_a102db8605e0b669" hs_bindgen_a102db8605e0b669_base ::
+     IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast16_t_fun@
+hs_bindgen_a102db8605e0b669 :: IO Int_fast16_t
+hs_bindgen_a102db8605e0b669 =
+  fmap BG.fromFFIType hs_bindgen_a102db8605e0b669_base
+
+{-| __C declaration:__ @int_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 18:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast16_t_fun :: IO Int_fast16_t
+int_fast16_t_fun = hs_bindgen_a102db8605e0b669
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast32_t_fun@
+foreign import ccall unsafe "hs_bindgen_97faff4568d5bc6a" hs_bindgen_97faff4568d5bc6a_base ::
+     IO HsBindgen.Runtime.LibC.Int32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast32_t_fun@
+hs_bindgen_97faff4568d5bc6a :: IO Int_fast32_t
+hs_bindgen_97faff4568d5bc6a =
+  fmap BG.fromFFIType hs_bindgen_97faff4568d5bc6a_base
+
+{-| __C declaration:__ @int_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 19:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast32_t_fun :: IO Int_fast32_t
+int_fast32_t_fun = hs_bindgen_97faff4568d5bc6a
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast64_t_fun@
+foreign import ccall unsafe "hs_bindgen_ce1a64e61a9f9432" hs_bindgen_ce1a64e61a9f9432_base ::
+     IO HsBindgen.Runtime.LibC.Int64
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast64_t_fun@
+hs_bindgen_ce1a64e61a9f9432 :: IO Int_fast64_t
+hs_bindgen_ce1a64e61a9f9432 =
+  fmap BG.fromFFIType hs_bindgen_ce1a64e61a9f9432_base
+
+{-| __C declaration:__ @int_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 20:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast64_t_fun :: IO Int_fast64_t
+int_fast64_t_fun = hs_bindgen_ce1a64e61a9f9432
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast8_t_fun@
+foreign import ccall unsafe "hs_bindgen_653d74ee9fd982e2" hs_bindgen_653d74ee9fd982e2_base ::
+     IO HsBindgen.Runtime.LibC.Word8
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast8_t_fun@
+hs_bindgen_653d74ee9fd982e2 :: IO Uint_fast8_t
+hs_bindgen_653d74ee9fd982e2 =
+  fmap BG.fromFFIType hs_bindgen_653d74ee9fd982e2_base
+
+{-| __C declaration:__ @uint_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 22:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast8_t_fun :: IO Uint_fast8_t
+uint_fast8_t_fun = hs_bindgen_653d74ee9fd982e2
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast16_t_fun@
+foreign import ccall unsafe "hs_bindgen_31bf7eba8a098bae" hs_bindgen_31bf7eba8a098bae_base ::
+     IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast16_t_fun@
+hs_bindgen_31bf7eba8a098bae :: IO Uint_fast16_t
+hs_bindgen_31bf7eba8a098bae =
+  fmap BG.fromFFIType hs_bindgen_31bf7eba8a098bae_base
+
+{-| __C declaration:__ @uint_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 23:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast16_t_fun :: IO Uint_fast16_t
+uint_fast16_t_fun = hs_bindgen_31bf7eba8a098bae
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast32_t_fun@
+foreign import ccall unsafe "hs_bindgen_fb324d72364e5685" hs_bindgen_fb324d72364e5685_base ::
+     IO HsBindgen.Runtime.LibC.Word32
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast32_t_fun@
+hs_bindgen_fb324d72364e5685 :: IO Uint_fast32_t
+hs_bindgen_fb324d72364e5685 =
+  fmap BG.fromFFIType hs_bindgen_fb324d72364e5685_base
+
+{-| __C declaration:__ @uint_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 24:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast32_t_fun :: IO Uint_fast32_t
+uint_fast32_t_fun = hs_bindgen_fb324d72364e5685
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast64_t_fun@
+foreign import ccall unsafe "hs_bindgen_a2995f3603c68c65" hs_bindgen_a2995f3603c68c65_base ::
+     IO HsBindgen.Runtime.LibC.Word64
+
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast64_t_fun@
+hs_bindgen_a2995f3603c68c65 :: IO Uint_fast64_t
+hs_bindgen_a2995f3603c68c65 =
+  fmap BG.fromFFIType hs_bindgen_a2995f3603c68c65_base
+
+{-| __C declaration:__ @uint_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 25:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast64_t_fun :: IO Uint_fast64_t
+uint_fast64_t_fun = hs_bindgen_a2995f3603c68c65
diff --git a/test-artefacts/fixtures/types/primitives/least_fast/bindingspec.yaml b/test-artefacts/fixtures/types/primitives/least_fast/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/least_fast/bindingspec.yaml
@@ -0,0 +1,598 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/primitives/least_fast.h
+  cname: int_fast16_t
+  hsname: Int_fast16_t
+- headers: types/primitives/least_fast.h
+  cname: int_fast32_t
+  hsname: Int_fast32_t
+- headers: types/primitives/least_fast.h
+  cname: uint_fast16_t
+  hsname: Uint_fast16_t
+- headers: types/primitives/least_fast.h
+  cname: uint_fast32_t
+  hsname: Uint_fast32_t
+- headers: types/primitives/least_fast.h
+  cname: int_fast8_t
+  hsname: Int_fast8_t
+- headers: types/primitives/least_fast.h
+  cname: int_fast64_t
+  hsname: Int_fast64_t
+- headers: types/primitives/least_fast.h
+  cname: int_least8_t
+  hsname: Int_least8_t
+- headers: types/primitives/least_fast.h
+  cname: int_least16_t
+  hsname: Int_least16_t
+- headers: types/primitives/least_fast.h
+  cname: int_least32_t
+  hsname: Int_least32_t
+- headers: types/primitives/least_fast.h
+  cname: int_least64_t
+  hsname: Int_least64_t
+- headers: types/primitives/least_fast.h
+  cname: uint_fast8_t
+  hsname: Uint_fast8_t
+- headers: types/primitives/least_fast.h
+  cname: uint_fast64_t
+  hsname: Uint_fast64_t
+- headers: types/primitives/least_fast.h
+  cname: uint_least8_t
+  hsname: Uint_least8_t
+- headers: types/primitives/least_fast.h
+  cname: uint_least16_t
+  hsname: Uint_least16_t
+- headers: types/primitives/least_fast.h
+  cname: uint_least32_t
+  hsname: Uint_least32_t
+- headers: types/primitives/least_fast.h
+  cname: uint_least64_t
+  hsname: Uint_least64_t
+hstypes:
+- hsname: Int_fast16_t
+  representation:
+    newtype:
+      constructor: Int_fast16_t
+      fields:
+      - unwrapInt_fast16_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int_fast32_t
+  representation:
+    newtype:
+      constructor: Int_fast32_t
+      fields:
+      - unwrapInt_fast32_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int_fast64_t
+  representation:
+    newtype:
+      constructor: Int_fast64_t
+      fields:
+      - unwrapInt_fast64_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int_fast8_t
+  representation:
+    newtype:
+      constructor: Int_fast8_t
+      fields:
+      - unwrapInt_fast8_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int_least16_t
+  representation:
+    newtype:
+      constructor: Int_least16_t
+      fields:
+      - unwrapInt_least16_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int16
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int_least32_t
+  representation:
+    newtype:
+      constructor: Int_least32_t
+      fields:
+      - unwrapInt_least32_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int_least64_t
+  representation:
+    newtype:
+      constructor: Int_least64_t
+      fields:
+      - unwrapInt_least64_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int_least8_t
+  representation:
+    newtype:
+      constructor: Int_least8_t
+      fields:
+      - unwrapInt_least8_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint_fast16_t
+  representation:
+    newtype:
+      constructor: Uint_fast16_t
+      fields:
+      - unwrapUint_fast16_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint_fast32_t
+  representation:
+    newtype:
+      constructor: Uint_fast32_t
+      fields:
+      - unwrapUint_fast32_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint_fast64_t
+  representation:
+    newtype:
+      constructor: Uint_fast64_t
+      fields:
+      - unwrapUint_fast64_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint_fast8_t
+  representation:
+    newtype:
+      constructor: Uint_fast8_t
+      fields:
+      - unwrapUint_fast8_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint_least16_t
+  representation:
+    newtype:
+      constructor: Uint_least16_t
+      fields:
+      - unwrapUint_least16_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word16
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint_least32_t
+  representation:
+    newtype:
+      constructor: Uint_least32_t
+      fields:
+      - unwrapUint_least32_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint_least64_t
+  representation:
+    newtype:
+      constructor: Uint_least64_t
+      fields:
+      - unwrapUint_least64_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint_least8_t
+  representation:
+    newtype:
+      constructor: Uint_least8_t
+      fields:
+      - unwrapUint_least8_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/primitives/least_fast/th.txt b/test-artefacts/fixtures/types/primitives/least_fast/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/least_fast/th.txt
@@ -0,0 +1,1813 @@
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile test-artefacts/headers/golden/types/primitives/least_fast.h
+-- #include <types/primitives/least_fast.h>
+-- int_least8_t hs_bindgen_ad6572fbf5eadb77 (void)
+-- {
+--   return (int_least8_t_fun)();
+-- }
+-- int_least16_t hs_bindgen_1b76f016106283f9 (void)
+-- {
+--   return (int_least16_t_fun)();
+-- }
+-- int_least32_t hs_bindgen_6ed0daff627b4e5c (void)
+-- {
+--   return (int_least32_t_fun)();
+-- }
+-- int_least64_t hs_bindgen_3973a552158e924e (void)
+-- {
+--   return (int_least64_t_fun)();
+-- }
+-- uint_least8_t hs_bindgen_8444813dd4e79f7f (void)
+-- {
+--   return (uint_least8_t_fun)();
+-- }
+-- uint_least16_t hs_bindgen_1b71c9bb2bf1881f (void)
+-- {
+--   return (uint_least16_t_fun)();
+-- }
+-- uint_least32_t hs_bindgen_24abaf3275c0126f (void)
+-- {
+--   return (uint_least32_t_fun)();
+-- }
+-- uint_least64_t hs_bindgen_45be86cc87258955 (void)
+-- {
+--   return (uint_least64_t_fun)();
+-- }
+-- int_fast8_t hs_bindgen_223fd78a0ee18a9d (void)
+-- {
+--   return (int_fast8_t_fun)();
+-- }
+-- int_fast16_t hs_bindgen_097db32b72dabc72 (void)
+-- {
+--   return (int_fast16_t_fun)();
+-- }
+-- int_fast32_t hs_bindgen_a406174bb602d355 (void)
+-- {
+--   return (int_fast32_t_fun)();
+-- }
+-- int_fast64_t hs_bindgen_eeb2cb113fbc86ce (void)
+-- {
+--   return (int_fast64_t_fun)();
+-- }
+-- uint_fast8_t hs_bindgen_32aa304dae0c8a3d (void)
+-- {
+--   return (uint_fast8_t_fun)();
+-- }
+-- uint_fast16_t hs_bindgen_81ec605d32f0724d (void)
+-- {
+--   return (uint_fast16_t_fun)();
+-- }
+-- uint_fast32_t hs_bindgen_f20ac50dff139544 (void)
+-- {
+--   return (uint_fast32_t_fun)();
+-- }
+-- uint_fast64_t hs_bindgen_9d5a9bc3a5b3b294 (void)
+-- {
+--   return (uint_fast64_t_fun)();
+-- }
+-- int_least8_t hs_bindgen_57bd94cbb0575f53 (void)
+-- {
+--   return (int_least8_t_fun)();
+-- }
+-- int_least16_t hs_bindgen_f02c70143a88af90 (void)
+-- {
+--   return (int_least16_t_fun)();
+-- }
+-- int_least32_t hs_bindgen_f5bbad7b8ac35f06 (void)
+-- {
+--   return (int_least32_t_fun)();
+-- }
+-- int_least64_t hs_bindgen_b2036b95960e2751 (void)
+-- {
+--   return (int_least64_t_fun)();
+-- }
+-- uint_least8_t hs_bindgen_d893fc1d41730120 (void)
+-- {
+--   return (uint_least8_t_fun)();
+-- }
+-- uint_least16_t hs_bindgen_eaf2d3e09a41513e (void)
+-- {
+--   return (uint_least16_t_fun)();
+-- }
+-- uint_least32_t hs_bindgen_dfdb9c77b9f2e16d (void)
+-- {
+--   return (uint_least32_t_fun)();
+-- }
+-- uint_least64_t hs_bindgen_35c7ddf6def5281e (void)
+-- {
+--   return (uint_least64_t_fun)();
+-- }
+-- int_fast8_t hs_bindgen_5144ac530f23abd8 (void)
+-- {
+--   return (int_fast8_t_fun)();
+-- }
+-- int_fast16_t hs_bindgen_a102db8605e0b669 (void)
+-- {
+--   return (int_fast16_t_fun)();
+-- }
+-- int_fast32_t hs_bindgen_97faff4568d5bc6a (void)
+-- {
+--   return (int_fast32_t_fun)();
+-- }
+-- int_fast64_t hs_bindgen_ce1a64e61a9f9432 (void)
+-- {
+--   return (int_fast64_t_fun)();
+-- }
+-- uint_fast8_t hs_bindgen_653d74ee9fd982e2 (void)
+-- {
+--   return (uint_fast8_t_fun)();
+-- }
+-- uint_fast16_t hs_bindgen_31bf7eba8a098bae (void)
+-- {
+--   return (uint_fast16_t_fun)();
+-- }
+-- uint_fast32_t hs_bindgen_fb324d72364e5685 (void)
+-- {
+--   return (uint_fast32_t_fun)();
+-- }
+-- uint_fast64_t hs_bindgen_a2995f3603c68c65 (void)
+-- {
+--   return (uint_fast64_t_fun)();
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_int_least8_t_fun */
+-- __attribute__ ((const))
+-- int_least8_t (*hs_bindgen_0391876bad2745ce (void)) (void)
+-- {
+--   return &int_least8_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_int_least16_t_fun */
+-- __attribute__ ((const))
+-- int_least16_t (*hs_bindgen_0af5d61729271291 (void)) (void)
+-- {
+--   return &int_least16_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_int_least32_t_fun */
+-- __attribute__ ((const))
+-- int_least32_t (*hs_bindgen_335ec637d8d81f56 (void)) (void)
+-- {
+--   return &int_least32_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_int_least64_t_fun */
+-- __attribute__ ((const))
+-- int_least64_t (*hs_bindgen_eedbb79d8eb0ca67 (void)) (void)
+-- {
+--   return &int_least64_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_uint_least8_t_fun */
+-- __attribute__ ((const))
+-- uint_least8_t (*hs_bindgen_cae759b263e9dcdd (void)) (void)
+-- {
+--   return &uint_least8_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_uint_least16_t_fun */
+-- __attribute__ ((const))
+-- uint_least16_t (*hs_bindgen_66a8cb9486f831fe (void)) (void)
+-- {
+--   return &uint_least16_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_uint_least32_t_fun */
+-- __attribute__ ((const))
+-- uint_least32_t (*hs_bindgen_bfc0feef86d3e7d0 (void)) (void)
+-- {
+--   return &uint_least32_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_uint_least64_t_fun */
+-- __attribute__ ((const))
+-- uint_least64_t (*hs_bindgen_1886bff0b6836087 (void)) (void)
+-- {
+--   return &uint_least64_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_int_fast8_t_fun */
+-- __attribute__ ((const))
+-- int_fast8_t (*hs_bindgen_08f27d79a8ef226d (void)) (void)
+-- {
+--   return &int_fast8_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_int_fast16_t_fun */
+-- __attribute__ ((const))
+-- int_fast16_t (*hs_bindgen_1bff6fbb3c56abd5 (void)) (void)
+-- {
+--   return &int_fast16_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_int_fast32_t_fun */
+-- __attribute__ ((const))
+-- int_fast32_t (*hs_bindgen_8a1d629866650da2 (void)) (void)
+-- {
+--   return &int_fast32_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_int_fast64_t_fun */
+-- __attribute__ ((const))
+-- int_fast64_t (*hs_bindgen_c112b0dedac2cffa (void)) (void)
+-- {
+--   return &int_fast64_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_uint_fast8_t_fun */
+-- __attribute__ ((const))
+-- uint_fast8_t (*hs_bindgen_c20e96bd69bdb439 (void)) (void)
+-- {
+--   return &uint_fast8_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_uint_fast16_t_fun */
+-- __attribute__ ((const))
+-- uint_fast16_t (*hs_bindgen_c4f607ba753f0616 (void)) (void)
+-- {
+--   return &uint_fast16_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_uint_fast32_t_fun */
+-- __attribute__ ((const))
+-- uint_fast32_t (*hs_bindgen_c22f26851616c098 (void)) (void)
+-- {
+--   return &uint_fast32_t_fun;
+-- }
+-- /* test_typesprimitivesleast_fast_Example_get_uint_fast64_t_fun */
+-- __attribute__ ((const))
+-- uint_fast64_t (*hs_bindgen_3ee59d750d0d2d2a (void)) (void)
+-- {
+--   return &uint_fast64_t_fun;
+-- }
+{-| __C declaration:__ @int_fast16_t@
+
+    __defined at:__ @bits\/stdint.h 1:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_fast16_t
+    = Int_fast16_t {unwrapInt_fast16_t :: HsBindgen.Runtime.LibC.Int32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapInt_fast16_t" Int_fast16_t ty
+    where hasField = \x_0 -> (\y_1 -> Int_fast16_t{unwrapInt_fast16_t = y_1},
+                              getField @"unwrapInt_fast16_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapInt_fast16_t" (Ptr Int_fast16_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt_fast16_t")
+instance HasCField Int_fast16_t "unwrapInt_fast16_t"
+    where type CFieldType Int_fast16_t
+                          "unwrapInt_fast16_t" = HsBindgen.Runtime.LibC.Int32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int_fast32_t@
+
+    __defined at:__ @bits\/stdint.h 2:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_fast32_t
+    = Int_fast32_t {unwrapInt_fast32_t :: HsBindgen.Runtime.LibC.Int32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapInt_fast32_t" Int_fast32_t ty
+    where hasField = \x_0 -> (\y_1 -> Int_fast32_t{unwrapInt_fast32_t = y_1},
+                              getField @"unwrapInt_fast32_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapInt_fast32_t" (Ptr Int_fast32_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt_fast32_t")
+instance HasCField Int_fast32_t "unwrapInt_fast32_t"
+    where type CFieldType Int_fast32_t
+                          "unwrapInt_fast32_t" = HsBindgen.Runtime.LibC.Int32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @uint_fast16_t@
+
+    __defined at:__ @bits\/stdint.h 3:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_fast16_t
+    = Uint_fast16_t {unwrapUint_fast16_t :: HsBindgen.Runtime.LibC.Word32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapUint_fast16_t" Uint_fast16_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint_fast16_t{unwrapUint_fast16_t = y_1},
+                              getField @"unwrapUint_fast16_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapUint_fast16_t" (Ptr Uint_fast16_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint_fast16_t")
+instance HasCField Uint_fast16_t "unwrapUint_fast16_t"
+    where type CFieldType Uint_fast16_t
+                          "unwrapUint_fast16_t" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @uint_fast32_t@
+
+    __defined at:__ @bits\/stdint.h 4:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_fast32_t
+    = Uint_fast32_t {unwrapUint_fast32_t :: HsBindgen.Runtime.LibC.Word32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapUint_fast32_t" Uint_fast32_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint_fast32_t{unwrapUint_fast32_t = y_1},
+                              getField @"unwrapUint_fast32_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapUint_fast32_t" (Ptr Uint_fast32_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint_fast32_t")
+instance HasCField Uint_fast32_t "unwrapUint_fast32_t"
+    where type CFieldType Uint_fast32_t
+                          "unwrapUint_fast32_t" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int_fast8_t@
+
+    __defined at:__ @stdint.h 22:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_fast8_t
+    = Int_fast8_t {unwrapInt_fast8_t :: HsBindgen.Runtime.LibC.Int8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapInt_fast8_t" Int_fast8_t ty
+    where hasField = \x_0 -> (\y_1 -> Int_fast8_t{unwrapInt_fast8_t = y_1},
+                              getField @"unwrapInt_fast8_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapInt_fast8_t" (Ptr Int_fast8_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt_fast8_t")
+instance HasCField Int_fast8_t "unwrapInt_fast8_t"
+    where type CFieldType Int_fast8_t
+                          "unwrapInt_fast8_t" = HsBindgen.Runtime.LibC.Int8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int_fast64_t@
+
+    __defined at:__ @stdint.h 23:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_fast64_t
+    = Int_fast64_t {unwrapInt_fast64_t :: HsBindgen.Runtime.LibC.Int64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapInt_fast64_t" Int_fast64_t ty
+    where hasField = \x_0 -> (\y_1 -> Int_fast64_t{unwrapInt_fast64_t = y_1},
+                              getField @"unwrapInt_fast64_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapInt_fast64_t" (Ptr Int_fast64_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt_fast64_t")
+instance HasCField Int_fast64_t "unwrapInt_fast64_t"
+    where type CFieldType Int_fast64_t
+                          "unwrapInt_fast64_t" = HsBindgen.Runtime.LibC.Int64
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int_least8_t@
+
+    __defined at:__ @stdint.h 25:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_least8_t
+    = Int_least8_t {unwrapInt_least8_t :: HsBindgen.Runtime.LibC.Int8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapInt_least8_t" Int_least8_t ty
+    where hasField = \x_0 -> (\y_1 -> Int_least8_t{unwrapInt_least8_t = y_1},
+                              getField @"unwrapInt_least8_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapInt_least8_t" (Ptr Int_least8_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt_least8_t")
+instance HasCField Int_least8_t "unwrapInt_least8_t"
+    where type CFieldType Int_least8_t
+                          "unwrapInt_least8_t" = HsBindgen.Runtime.LibC.Int8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int_least16_t@
+
+    __defined at:__ @stdint.h 26:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_least16_t
+    = Int_least16_t {unwrapInt_least16_t :: HsBindgen.Runtime.LibC.Int16}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int16 =>
+         HasField "unwrapInt_least16_t" Int_least16_t ty
+    where hasField = \x_0 -> (\y_1 -> Int_least16_t{unwrapInt_least16_t = y_1},
+                              getField @"unwrapInt_least16_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int16 =>
+         HasField "unwrapInt_least16_t" (Ptr Int_least16_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt_least16_t")
+instance HasCField Int_least16_t "unwrapInt_least16_t"
+    where type CFieldType Int_least16_t
+                          "unwrapInt_least16_t" = HsBindgen.Runtime.LibC.Int16
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int_least32_t@
+
+    __defined at:__ @stdint.h 27:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_least32_t
+    = Int_least32_t {unwrapInt_least32_t :: HsBindgen.Runtime.LibC.Int32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapInt_least32_t" Int_least32_t ty
+    where hasField = \x_0 -> (\y_1 -> Int_least32_t{unwrapInt_least32_t = y_1},
+                              getField @"unwrapInt_least32_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapInt_least32_t" (Ptr Int_least32_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt_least32_t")
+instance HasCField Int_least32_t "unwrapInt_least32_t"
+    where type CFieldType Int_least32_t
+                          "unwrapInt_least32_t" = HsBindgen.Runtime.LibC.Int32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int_least64_t@
+
+    __defined at:__ @stdint.h 28:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Int_least64_t
+    = Int_least64_t {unwrapInt_least64_t :: HsBindgen.Runtime.LibC.Int64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapInt_least64_t" Int_least64_t ty
+    where hasField = \x_0 -> (\y_1 -> Int_least64_t{unwrapInt_least64_t = y_1},
+                              getField @"unwrapInt_least64_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapInt_least64_t" (Ptr Int_least64_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt_least64_t")
+instance HasCField Int_least64_t "unwrapInt_least64_t"
+    where type CFieldType Int_least64_t
+                          "unwrapInt_least64_t" = HsBindgen.Runtime.LibC.Int64
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @uint_fast8_t@
+
+    __defined at:__ @stdint.h 30:17@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_fast8_t
+    = Uint_fast8_t {unwrapUint_fast8_t :: HsBindgen.Runtime.LibC.Word8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapUint_fast8_t" Uint_fast8_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint_fast8_t{unwrapUint_fast8_t = y_1},
+                              getField @"unwrapUint_fast8_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapUint_fast8_t" (Ptr Uint_fast8_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint_fast8_t")
+instance HasCField Uint_fast8_t "unwrapUint_fast8_t"
+    where type CFieldType Uint_fast8_t
+                          "unwrapUint_fast8_t" = HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @uint_fast64_t@
+
+    __defined at:__ @stdint.h 31:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_fast64_t
+    = Uint_fast64_t {unwrapUint_fast64_t :: HsBindgen.Runtime.LibC.Word64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapUint_fast64_t" Uint_fast64_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint_fast64_t{unwrapUint_fast64_t = y_1},
+                              getField @"unwrapUint_fast64_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapUint_fast64_t" (Ptr Uint_fast64_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint_fast64_t")
+instance HasCField Uint_fast64_t "unwrapUint_fast64_t"
+    where type CFieldType Uint_fast64_t
+                          "unwrapUint_fast64_t" = HsBindgen.Runtime.LibC.Word64
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @uint_least8_t@
+
+    __defined at:__ @stdint.h 33:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_least8_t
+    = Uint_least8_t {unwrapUint_least8_t :: HsBindgen.Runtime.LibC.Word8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapUint_least8_t" Uint_least8_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint_least8_t{unwrapUint_least8_t = y_1},
+                              getField @"unwrapUint_least8_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapUint_least8_t" (Ptr Uint_least8_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint_least8_t")
+instance HasCField Uint_least8_t "unwrapUint_least8_t"
+    where type CFieldType Uint_least8_t
+                          "unwrapUint_least8_t" = HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @uint_least16_t@
+
+    __defined at:__ @stdint.h 34:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_least16_t
+    = Uint_least16_t {unwrapUint_least16_t :: HsBindgen.Runtime.LibC.Word16}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "unwrapUint_least16_t" Uint_least16_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint_least16_t{unwrapUint_least16_t = y_1},
+                              getField @"unwrapUint_least16_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "unwrapUint_least16_t" (Ptr Uint_least16_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint_least16_t")
+instance HasCField Uint_least16_t "unwrapUint_least16_t"
+    where type CFieldType Uint_least16_t
+                          "unwrapUint_least16_t" = HsBindgen.Runtime.LibC.Word16
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @uint_least32_t@
+
+    __defined at:__ @stdint.h 35:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_least32_t
+    = Uint_least32_t {unwrapUint_least32_t :: HsBindgen.Runtime.LibC.Word32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapUint_least32_t" Uint_least32_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint_least32_t{unwrapUint_least32_t = y_1},
+                              getField @"unwrapUint_least32_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapUint_least32_t" (Ptr Uint_least32_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint_least32_t")
+instance HasCField Uint_least32_t "unwrapUint_least32_t"
+    where type CFieldType Uint_least32_t
+                          "unwrapUint_least32_t" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @uint_least64_t@
+
+    __defined at:__ @stdint.h 36:18@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+newtype Uint_least64_t
+    = Uint_least64_t {unwrapUint_least64_t :: HsBindgen.Runtime.LibC.Word64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapUint_least64_t" Uint_least64_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint_least64_t{unwrapUint_least64_t = y_1},
+                              getField @"unwrapUint_least64_t" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapUint_least64_t" (Ptr Uint_least64_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint_least64_t")
+instance HasCField Uint_least64_t "unwrapUint_least64_t"
+    where type CFieldType Uint_least64_t
+                          "unwrapUint_least64_t" = HsBindgen.Runtime.LibC.Word64
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least8_t_fun@
+foreign import ccall safe "hs_bindgen_ad6572fbf5eadb77" hs_bindgen_ad6572fbf5eadb77_base ::
+    IO HsBindgen.Runtime.LibC.Int8
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least8_t_fun@
+hs_bindgen_ad6572fbf5eadb77 :: IO Int_least8_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least8_t_fun@
+hs_bindgen_ad6572fbf5eadb77 = fmap fromFFIType hs_bindgen_ad6572fbf5eadb77_base
+{-| __C declaration:__ @int_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 7:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least8_t_fun_safe :: IO Int_least8_t
+{-| __C declaration:__ @int_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 7:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least8_t_fun_safe = hs_bindgen_ad6572fbf5eadb77
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least16_t_fun@
+foreign import ccall safe "hs_bindgen_1b76f016106283f9" hs_bindgen_1b76f016106283f9_base ::
+    IO HsBindgen.Runtime.LibC.Int16
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least16_t_fun@
+hs_bindgen_1b76f016106283f9 :: IO Int_least16_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least16_t_fun@
+hs_bindgen_1b76f016106283f9 = fmap fromFFIType hs_bindgen_1b76f016106283f9_base
+{-| __C declaration:__ @int_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 8:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least16_t_fun_safe :: IO Int_least16_t
+{-| __C declaration:__ @int_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 8:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least16_t_fun_safe = hs_bindgen_1b76f016106283f9
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least32_t_fun@
+foreign import ccall safe "hs_bindgen_6ed0daff627b4e5c" hs_bindgen_6ed0daff627b4e5c_base ::
+    IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least32_t_fun@
+hs_bindgen_6ed0daff627b4e5c :: IO Int_least32_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least32_t_fun@
+hs_bindgen_6ed0daff627b4e5c = fmap fromFFIType hs_bindgen_6ed0daff627b4e5c_base
+{-| __C declaration:__ @int_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 9:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least32_t_fun_safe :: IO Int_least32_t
+{-| __C declaration:__ @int_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 9:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least32_t_fun_safe = hs_bindgen_6ed0daff627b4e5c
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least64_t_fun@
+foreign import ccall safe "hs_bindgen_3973a552158e924e" hs_bindgen_3973a552158e924e_base ::
+    IO HsBindgen.Runtime.LibC.Int64
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least64_t_fun@
+hs_bindgen_3973a552158e924e :: IO Int_least64_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_least64_t_fun@
+hs_bindgen_3973a552158e924e = fmap fromFFIType hs_bindgen_3973a552158e924e_base
+{-| __C declaration:__ @int_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 10:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least64_t_fun_safe :: IO Int_least64_t
+{-| __C declaration:__ @int_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 10:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least64_t_fun_safe = hs_bindgen_3973a552158e924e
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least8_t_fun@
+foreign import ccall safe "hs_bindgen_8444813dd4e79f7f" hs_bindgen_8444813dd4e79f7f_base ::
+    IO HsBindgen.Runtime.LibC.Word8
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least8_t_fun@
+hs_bindgen_8444813dd4e79f7f :: IO Uint_least8_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least8_t_fun@
+hs_bindgen_8444813dd4e79f7f = fmap fromFFIType hs_bindgen_8444813dd4e79f7f_base
+{-| __C declaration:__ @uint_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 12:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least8_t_fun_safe :: IO Uint_least8_t
+{-| __C declaration:__ @uint_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 12:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least8_t_fun_safe = hs_bindgen_8444813dd4e79f7f
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least16_t_fun@
+foreign import ccall safe "hs_bindgen_1b71c9bb2bf1881f" hs_bindgen_1b71c9bb2bf1881f_base ::
+    IO HsBindgen.Runtime.LibC.Word16
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least16_t_fun@
+hs_bindgen_1b71c9bb2bf1881f :: IO Uint_least16_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least16_t_fun@
+hs_bindgen_1b71c9bb2bf1881f = fmap fromFFIType hs_bindgen_1b71c9bb2bf1881f_base
+{-| __C declaration:__ @uint_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 13:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least16_t_fun_safe :: IO Uint_least16_t
+{-| __C declaration:__ @uint_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 13:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least16_t_fun_safe = hs_bindgen_1b71c9bb2bf1881f
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least32_t_fun@
+foreign import ccall safe "hs_bindgen_24abaf3275c0126f" hs_bindgen_24abaf3275c0126f_base ::
+    IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least32_t_fun@
+hs_bindgen_24abaf3275c0126f :: IO Uint_least32_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least32_t_fun@
+hs_bindgen_24abaf3275c0126f = fmap fromFFIType hs_bindgen_24abaf3275c0126f_base
+{-| __C declaration:__ @uint_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 14:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least32_t_fun_safe :: IO Uint_least32_t
+{-| __C declaration:__ @uint_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 14:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least32_t_fun_safe = hs_bindgen_24abaf3275c0126f
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least64_t_fun@
+foreign import ccall safe "hs_bindgen_45be86cc87258955" hs_bindgen_45be86cc87258955_base ::
+    IO HsBindgen.Runtime.LibC.Word64
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least64_t_fun@
+hs_bindgen_45be86cc87258955 :: IO Uint_least64_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_least64_t_fun@
+hs_bindgen_45be86cc87258955 = fmap fromFFIType hs_bindgen_45be86cc87258955_base
+{-| __C declaration:__ @uint_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 15:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least64_t_fun_safe :: IO Uint_least64_t
+{-| __C declaration:__ @uint_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 15:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least64_t_fun_safe = hs_bindgen_45be86cc87258955
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast8_t_fun@
+foreign import ccall safe "hs_bindgen_223fd78a0ee18a9d" hs_bindgen_223fd78a0ee18a9d_base ::
+    IO HsBindgen.Runtime.LibC.Int8
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast8_t_fun@
+hs_bindgen_223fd78a0ee18a9d :: IO Int_fast8_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast8_t_fun@
+hs_bindgen_223fd78a0ee18a9d = fmap fromFFIType hs_bindgen_223fd78a0ee18a9d_base
+{-| __C declaration:__ @int_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 17:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast8_t_fun_safe :: IO Int_fast8_t
+{-| __C declaration:__ @int_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 17:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast8_t_fun_safe = hs_bindgen_223fd78a0ee18a9d
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast16_t_fun@
+foreign import ccall safe "hs_bindgen_097db32b72dabc72" hs_bindgen_097db32b72dabc72_base ::
+    IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast16_t_fun@
+hs_bindgen_097db32b72dabc72 :: IO Int_fast16_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast16_t_fun@
+hs_bindgen_097db32b72dabc72 = fmap fromFFIType hs_bindgen_097db32b72dabc72_base
+{-| __C declaration:__ @int_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 18:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast16_t_fun_safe :: IO Int_fast16_t
+{-| __C declaration:__ @int_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 18:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast16_t_fun_safe = hs_bindgen_097db32b72dabc72
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast32_t_fun@
+foreign import ccall safe "hs_bindgen_a406174bb602d355" hs_bindgen_a406174bb602d355_base ::
+    IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast32_t_fun@
+hs_bindgen_a406174bb602d355 :: IO Int_fast32_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast32_t_fun@
+hs_bindgen_a406174bb602d355 = fmap fromFFIType hs_bindgen_a406174bb602d355_base
+{-| __C declaration:__ @int_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 19:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast32_t_fun_safe :: IO Int_fast32_t
+{-| __C declaration:__ @int_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 19:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast32_t_fun_safe = hs_bindgen_a406174bb602d355
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast64_t_fun@
+foreign import ccall safe "hs_bindgen_eeb2cb113fbc86ce" hs_bindgen_eeb2cb113fbc86ce_base ::
+    IO HsBindgen.Runtime.LibC.Int64
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast64_t_fun@
+hs_bindgen_eeb2cb113fbc86ce :: IO Int_fast64_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_int_fast64_t_fun@
+hs_bindgen_eeb2cb113fbc86ce = fmap fromFFIType hs_bindgen_eeb2cb113fbc86ce_base
+{-| __C declaration:__ @int_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 20:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast64_t_fun_safe :: IO Int_fast64_t
+{-| __C declaration:__ @int_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 20:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast64_t_fun_safe = hs_bindgen_eeb2cb113fbc86ce
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast8_t_fun@
+foreign import ccall safe "hs_bindgen_32aa304dae0c8a3d" hs_bindgen_32aa304dae0c8a3d_base ::
+    IO HsBindgen.Runtime.LibC.Word8
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast8_t_fun@
+hs_bindgen_32aa304dae0c8a3d :: IO Uint_fast8_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast8_t_fun@
+hs_bindgen_32aa304dae0c8a3d = fmap fromFFIType hs_bindgen_32aa304dae0c8a3d_base
+{-| __C declaration:__ @uint_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 22:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast8_t_fun_safe :: IO Uint_fast8_t
+{-| __C declaration:__ @uint_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 22:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast8_t_fun_safe = hs_bindgen_32aa304dae0c8a3d
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast16_t_fun@
+foreign import ccall safe "hs_bindgen_81ec605d32f0724d" hs_bindgen_81ec605d32f0724d_base ::
+    IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast16_t_fun@
+hs_bindgen_81ec605d32f0724d :: IO Uint_fast16_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast16_t_fun@
+hs_bindgen_81ec605d32f0724d = fmap fromFFIType hs_bindgen_81ec605d32f0724d_base
+{-| __C declaration:__ @uint_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 23:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast16_t_fun_safe :: IO Uint_fast16_t
+{-| __C declaration:__ @uint_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 23:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast16_t_fun_safe = hs_bindgen_81ec605d32f0724d
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast32_t_fun@
+foreign import ccall safe "hs_bindgen_f20ac50dff139544" hs_bindgen_f20ac50dff139544_base ::
+    IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast32_t_fun@
+hs_bindgen_f20ac50dff139544 :: IO Uint_fast32_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast32_t_fun@
+hs_bindgen_f20ac50dff139544 = fmap fromFFIType hs_bindgen_f20ac50dff139544_base
+{-| __C declaration:__ @uint_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 24:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast32_t_fun_safe :: IO Uint_fast32_t
+{-| __C declaration:__ @uint_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 24:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast32_t_fun_safe = hs_bindgen_f20ac50dff139544
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast64_t_fun@
+foreign import ccall safe "hs_bindgen_9d5a9bc3a5b3b294" hs_bindgen_9d5a9bc3a5b3b294_base ::
+    IO HsBindgen.Runtime.LibC.Word64
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast64_t_fun@
+hs_bindgen_9d5a9bc3a5b3b294 :: IO Uint_fast64_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Safe_uint_fast64_t_fun@
+hs_bindgen_9d5a9bc3a5b3b294 = fmap fromFFIType hs_bindgen_9d5a9bc3a5b3b294_base
+{-| __C declaration:__ @uint_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 25:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast64_t_fun_safe :: IO Uint_fast64_t
+{-| __C declaration:__ @uint_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 25:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast64_t_fun_safe = hs_bindgen_9d5a9bc3a5b3b294
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least8_t_fun@
+foreign import ccall unsafe "hs_bindgen_57bd94cbb0575f53" hs_bindgen_57bd94cbb0575f53_base ::
+    IO HsBindgen.Runtime.LibC.Int8
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least8_t_fun@
+hs_bindgen_57bd94cbb0575f53 :: IO Int_least8_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least8_t_fun@
+hs_bindgen_57bd94cbb0575f53 = fmap fromFFIType hs_bindgen_57bd94cbb0575f53_base
+{-| __C declaration:__ @int_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 7:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least8_t_fun_unsafe :: IO Int_least8_t
+{-| __C declaration:__ @int_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 7:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least8_t_fun_unsafe = hs_bindgen_57bd94cbb0575f53
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least16_t_fun@
+foreign import ccall unsafe "hs_bindgen_f02c70143a88af90" hs_bindgen_f02c70143a88af90_base ::
+    IO HsBindgen.Runtime.LibC.Int16
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least16_t_fun@
+hs_bindgen_f02c70143a88af90 :: IO Int_least16_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least16_t_fun@
+hs_bindgen_f02c70143a88af90 = fmap fromFFIType hs_bindgen_f02c70143a88af90_base
+{-| __C declaration:__ @int_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 8:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least16_t_fun_unsafe :: IO Int_least16_t
+{-| __C declaration:__ @int_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 8:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least16_t_fun_unsafe = hs_bindgen_f02c70143a88af90
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least32_t_fun@
+foreign import ccall unsafe "hs_bindgen_f5bbad7b8ac35f06" hs_bindgen_f5bbad7b8ac35f06_base ::
+    IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least32_t_fun@
+hs_bindgen_f5bbad7b8ac35f06 :: IO Int_least32_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least32_t_fun@
+hs_bindgen_f5bbad7b8ac35f06 = fmap fromFFIType hs_bindgen_f5bbad7b8ac35f06_base
+{-| __C declaration:__ @int_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 9:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least32_t_fun_unsafe :: IO Int_least32_t
+{-| __C declaration:__ @int_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 9:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least32_t_fun_unsafe = hs_bindgen_f5bbad7b8ac35f06
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least64_t_fun@
+foreign import ccall unsafe "hs_bindgen_b2036b95960e2751" hs_bindgen_b2036b95960e2751_base ::
+    IO HsBindgen.Runtime.LibC.Int64
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least64_t_fun@
+hs_bindgen_b2036b95960e2751 :: IO Int_least64_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_least64_t_fun@
+hs_bindgen_b2036b95960e2751 = fmap fromFFIType hs_bindgen_b2036b95960e2751_base
+{-| __C declaration:__ @int_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 10:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least64_t_fun_unsafe :: IO Int_least64_t
+{-| __C declaration:__ @int_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 10:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least64_t_fun_unsafe = hs_bindgen_b2036b95960e2751
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least8_t_fun@
+foreign import ccall unsafe "hs_bindgen_d893fc1d41730120" hs_bindgen_d893fc1d41730120_base ::
+    IO HsBindgen.Runtime.LibC.Word8
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least8_t_fun@
+hs_bindgen_d893fc1d41730120 :: IO Uint_least8_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least8_t_fun@
+hs_bindgen_d893fc1d41730120 = fmap fromFFIType hs_bindgen_d893fc1d41730120_base
+{-| __C declaration:__ @uint_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 12:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least8_t_fun_unsafe :: IO Uint_least8_t
+{-| __C declaration:__ @uint_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 12:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least8_t_fun_unsafe = hs_bindgen_d893fc1d41730120
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least16_t_fun@
+foreign import ccall unsafe "hs_bindgen_eaf2d3e09a41513e" hs_bindgen_eaf2d3e09a41513e_base ::
+    IO HsBindgen.Runtime.LibC.Word16
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least16_t_fun@
+hs_bindgen_eaf2d3e09a41513e :: IO Uint_least16_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least16_t_fun@
+hs_bindgen_eaf2d3e09a41513e = fmap fromFFIType hs_bindgen_eaf2d3e09a41513e_base
+{-| __C declaration:__ @uint_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 13:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least16_t_fun_unsafe :: IO Uint_least16_t
+{-| __C declaration:__ @uint_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 13:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least16_t_fun_unsafe = hs_bindgen_eaf2d3e09a41513e
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least32_t_fun@
+foreign import ccall unsafe "hs_bindgen_dfdb9c77b9f2e16d" hs_bindgen_dfdb9c77b9f2e16d_base ::
+    IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least32_t_fun@
+hs_bindgen_dfdb9c77b9f2e16d :: IO Uint_least32_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least32_t_fun@
+hs_bindgen_dfdb9c77b9f2e16d = fmap fromFFIType hs_bindgen_dfdb9c77b9f2e16d_base
+{-| __C declaration:__ @uint_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 14:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least32_t_fun_unsafe :: IO Uint_least32_t
+{-| __C declaration:__ @uint_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 14:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least32_t_fun_unsafe = hs_bindgen_dfdb9c77b9f2e16d
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least64_t_fun@
+foreign import ccall unsafe "hs_bindgen_35c7ddf6def5281e" hs_bindgen_35c7ddf6def5281e_base ::
+    IO HsBindgen.Runtime.LibC.Word64
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least64_t_fun@
+hs_bindgen_35c7ddf6def5281e :: IO Uint_least64_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_least64_t_fun@
+hs_bindgen_35c7ddf6def5281e = fmap fromFFIType hs_bindgen_35c7ddf6def5281e_base
+{-| __C declaration:__ @uint_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 15:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least64_t_fun_unsafe :: IO Uint_least64_t
+{-| __C declaration:__ @uint_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 15:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least64_t_fun_unsafe = hs_bindgen_35c7ddf6def5281e
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast8_t_fun@
+foreign import ccall unsafe "hs_bindgen_5144ac530f23abd8" hs_bindgen_5144ac530f23abd8_base ::
+    IO HsBindgen.Runtime.LibC.Int8
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast8_t_fun@
+hs_bindgen_5144ac530f23abd8 :: IO Int_fast8_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast8_t_fun@
+hs_bindgen_5144ac530f23abd8 = fmap fromFFIType hs_bindgen_5144ac530f23abd8_base
+{-| __C declaration:__ @int_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 17:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast8_t_fun_unsafe :: IO Int_fast8_t
+{-| __C declaration:__ @int_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 17:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast8_t_fun_unsafe = hs_bindgen_5144ac530f23abd8
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast16_t_fun@
+foreign import ccall unsafe "hs_bindgen_a102db8605e0b669" hs_bindgen_a102db8605e0b669_base ::
+    IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast16_t_fun@
+hs_bindgen_a102db8605e0b669 :: IO Int_fast16_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast16_t_fun@
+hs_bindgen_a102db8605e0b669 = fmap fromFFIType hs_bindgen_a102db8605e0b669_base
+{-| __C declaration:__ @int_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 18:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast16_t_fun_unsafe :: IO Int_fast16_t
+{-| __C declaration:__ @int_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 18:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast16_t_fun_unsafe = hs_bindgen_a102db8605e0b669
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast32_t_fun@
+foreign import ccall unsafe "hs_bindgen_97faff4568d5bc6a" hs_bindgen_97faff4568d5bc6a_base ::
+    IO HsBindgen.Runtime.LibC.Int32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast32_t_fun@
+hs_bindgen_97faff4568d5bc6a :: IO Int_fast32_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast32_t_fun@
+hs_bindgen_97faff4568d5bc6a = fmap fromFFIType hs_bindgen_97faff4568d5bc6a_base
+{-| __C declaration:__ @int_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 19:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast32_t_fun_unsafe :: IO Int_fast32_t
+{-| __C declaration:__ @int_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 19:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast32_t_fun_unsafe = hs_bindgen_97faff4568d5bc6a
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast64_t_fun@
+foreign import ccall unsafe "hs_bindgen_ce1a64e61a9f9432" hs_bindgen_ce1a64e61a9f9432_base ::
+    IO HsBindgen.Runtime.LibC.Int64
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast64_t_fun@
+hs_bindgen_ce1a64e61a9f9432 :: IO Int_fast64_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_int_fast64_t_fun@
+hs_bindgen_ce1a64e61a9f9432 = fmap fromFFIType hs_bindgen_ce1a64e61a9f9432_base
+{-| __C declaration:__ @int_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 20:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast64_t_fun_unsafe :: IO Int_fast64_t
+{-| __C declaration:__ @int_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 20:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast64_t_fun_unsafe = hs_bindgen_ce1a64e61a9f9432
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast8_t_fun@
+foreign import ccall unsafe "hs_bindgen_653d74ee9fd982e2" hs_bindgen_653d74ee9fd982e2_base ::
+    IO HsBindgen.Runtime.LibC.Word8
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast8_t_fun@
+hs_bindgen_653d74ee9fd982e2 :: IO Uint_fast8_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast8_t_fun@
+hs_bindgen_653d74ee9fd982e2 = fmap fromFFIType hs_bindgen_653d74ee9fd982e2_base
+{-| __C declaration:__ @uint_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 22:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast8_t_fun_unsafe :: IO Uint_fast8_t
+{-| __C declaration:__ @uint_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 22:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast8_t_fun_unsafe = hs_bindgen_653d74ee9fd982e2
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast16_t_fun@
+foreign import ccall unsafe "hs_bindgen_31bf7eba8a098bae" hs_bindgen_31bf7eba8a098bae_base ::
+    IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast16_t_fun@
+hs_bindgen_31bf7eba8a098bae :: IO Uint_fast16_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast16_t_fun@
+hs_bindgen_31bf7eba8a098bae = fmap fromFFIType hs_bindgen_31bf7eba8a098bae_base
+{-| __C declaration:__ @uint_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 23:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast16_t_fun_unsafe :: IO Uint_fast16_t
+{-| __C declaration:__ @uint_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 23:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast16_t_fun_unsafe = hs_bindgen_31bf7eba8a098bae
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast32_t_fun@
+foreign import ccall unsafe "hs_bindgen_fb324d72364e5685" hs_bindgen_fb324d72364e5685_base ::
+    IO HsBindgen.Runtime.LibC.Word32
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast32_t_fun@
+hs_bindgen_fb324d72364e5685 :: IO Uint_fast32_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast32_t_fun@
+hs_bindgen_fb324d72364e5685 = fmap fromFFIType hs_bindgen_fb324d72364e5685_base
+{-| __C declaration:__ @uint_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 24:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast32_t_fun_unsafe :: IO Uint_fast32_t
+{-| __C declaration:__ @uint_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 24:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast32_t_fun_unsafe = hs_bindgen_fb324d72364e5685
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast64_t_fun@
+foreign import ccall unsafe "hs_bindgen_a2995f3603c68c65" hs_bindgen_a2995f3603c68c65_base ::
+    IO HsBindgen.Runtime.LibC.Word64
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast64_t_fun@
+hs_bindgen_a2995f3603c68c65 :: IO Uint_fast64_t
+-- __unique:__ @test_typesprimitivesleast_fast_Example_Unsafe_uint_fast64_t_fun@
+hs_bindgen_a2995f3603c68c65 = fmap fromFFIType hs_bindgen_a2995f3603c68c65_base
+{-| __C declaration:__ @uint_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 25:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast64_t_fun_unsafe :: IO Uint_fast64_t
+{-| __C declaration:__ @uint_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 25:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast64_t_fun_unsafe = hs_bindgen_a2995f3603c68c65
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least8_t_fun@
+foreign import ccall unsafe "hs_bindgen_0391876bad2745ce" hs_bindgen_0391876bad2745ce_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least8_t_fun@
+hs_bindgen_0391876bad2745ce :: IO (FunPtr (IO Int_least8_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least8_t_fun@
+hs_bindgen_0391876bad2745ce = fmap fromFFIType hs_bindgen_0391876bad2745ce_base
+{-# NOINLINE int_least8_t_fun_funptr #-}
+{-| __C declaration:__ @int_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 7:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least8_t_fun_funptr :: FunPtr (IO Int_least8_t)
+{-| __C declaration:__ @int_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 7:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least8_t_fun_funptr = unsafePerformIO hs_bindgen_0391876bad2745ce
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least16_t_fun@
+foreign import ccall unsafe "hs_bindgen_0af5d61729271291" hs_bindgen_0af5d61729271291_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least16_t_fun@
+hs_bindgen_0af5d61729271291 :: IO (FunPtr (IO Int_least16_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least16_t_fun@
+hs_bindgen_0af5d61729271291 = fmap fromFFIType hs_bindgen_0af5d61729271291_base
+{-# NOINLINE int_least16_t_fun_funptr #-}
+{-| __C declaration:__ @int_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 8:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least16_t_fun_funptr :: FunPtr (IO Int_least16_t)
+{-| __C declaration:__ @int_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 8:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least16_t_fun_funptr = unsafePerformIO hs_bindgen_0af5d61729271291
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least32_t_fun@
+foreign import ccall unsafe "hs_bindgen_335ec637d8d81f56" hs_bindgen_335ec637d8d81f56_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least32_t_fun@
+hs_bindgen_335ec637d8d81f56 :: IO (FunPtr (IO Int_least32_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least32_t_fun@
+hs_bindgen_335ec637d8d81f56 = fmap fromFFIType hs_bindgen_335ec637d8d81f56_base
+{-# NOINLINE int_least32_t_fun_funptr #-}
+{-| __C declaration:__ @int_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 9:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least32_t_fun_funptr :: FunPtr (IO Int_least32_t)
+{-| __C declaration:__ @int_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 9:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least32_t_fun_funptr = unsafePerformIO hs_bindgen_335ec637d8d81f56
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least64_t_fun@
+foreign import ccall unsafe "hs_bindgen_eedbb79d8eb0ca67" hs_bindgen_eedbb79d8eb0ca67_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least64_t_fun@
+hs_bindgen_eedbb79d8eb0ca67 :: IO (FunPtr (IO Int_least64_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_least64_t_fun@
+hs_bindgen_eedbb79d8eb0ca67 = fmap fromFFIType hs_bindgen_eedbb79d8eb0ca67_base
+{-# NOINLINE int_least64_t_fun_funptr #-}
+{-| __C declaration:__ @int_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 10:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least64_t_fun_funptr :: FunPtr (IO Int_least64_t)
+{-| __C declaration:__ @int_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 10:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_least64_t_fun_funptr = unsafePerformIO hs_bindgen_eedbb79d8eb0ca67
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least8_t_fun@
+foreign import ccall unsafe "hs_bindgen_cae759b263e9dcdd" hs_bindgen_cae759b263e9dcdd_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least8_t_fun@
+hs_bindgen_cae759b263e9dcdd :: IO (FunPtr (IO Uint_least8_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least8_t_fun@
+hs_bindgen_cae759b263e9dcdd = fmap fromFFIType hs_bindgen_cae759b263e9dcdd_base
+{-# NOINLINE uint_least8_t_fun_funptr #-}
+{-| __C declaration:__ @uint_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 12:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least8_t_fun_funptr :: FunPtr (IO Uint_least8_t)
+{-| __C declaration:__ @uint_least8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 12:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least8_t_fun_funptr = unsafePerformIO hs_bindgen_cae759b263e9dcdd
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least16_t_fun@
+foreign import ccall unsafe "hs_bindgen_66a8cb9486f831fe" hs_bindgen_66a8cb9486f831fe_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least16_t_fun@
+hs_bindgen_66a8cb9486f831fe :: IO (FunPtr (IO Uint_least16_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least16_t_fun@
+hs_bindgen_66a8cb9486f831fe = fmap fromFFIType hs_bindgen_66a8cb9486f831fe_base
+{-# NOINLINE uint_least16_t_fun_funptr #-}
+{-| __C declaration:__ @uint_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 13:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least16_t_fun_funptr :: FunPtr (IO Uint_least16_t)
+{-| __C declaration:__ @uint_least16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 13:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least16_t_fun_funptr = unsafePerformIO hs_bindgen_66a8cb9486f831fe
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least32_t_fun@
+foreign import ccall unsafe "hs_bindgen_bfc0feef86d3e7d0" hs_bindgen_bfc0feef86d3e7d0_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least32_t_fun@
+hs_bindgen_bfc0feef86d3e7d0 :: IO (FunPtr (IO Uint_least32_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least32_t_fun@
+hs_bindgen_bfc0feef86d3e7d0 = fmap fromFFIType hs_bindgen_bfc0feef86d3e7d0_base
+{-# NOINLINE uint_least32_t_fun_funptr #-}
+{-| __C declaration:__ @uint_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 14:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least32_t_fun_funptr :: FunPtr (IO Uint_least32_t)
+{-| __C declaration:__ @uint_least32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 14:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least32_t_fun_funptr = unsafePerformIO hs_bindgen_bfc0feef86d3e7d0
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least64_t_fun@
+foreign import ccall unsafe "hs_bindgen_1886bff0b6836087" hs_bindgen_1886bff0b6836087_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least64_t_fun@
+hs_bindgen_1886bff0b6836087 :: IO (FunPtr (IO Uint_least64_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_least64_t_fun@
+hs_bindgen_1886bff0b6836087 = fmap fromFFIType hs_bindgen_1886bff0b6836087_base
+{-# NOINLINE uint_least64_t_fun_funptr #-}
+{-| __C declaration:__ @uint_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 15:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least64_t_fun_funptr :: FunPtr (IO Uint_least64_t)
+{-| __C declaration:__ @uint_least64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 15:16@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_least64_t_fun_funptr = unsafePerformIO hs_bindgen_1886bff0b6836087
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast8_t_fun@
+foreign import ccall unsafe "hs_bindgen_08f27d79a8ef226d" hs_bindgen_08f27d79a8ef226d_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast8_t_fun@
+hs_bindgen_08f27d79a8ef226d :: IO (FunPtr (IO Int_fast8_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast8_t_fun@
+hs_bindgen_08f27d79a8ef226d = fmap fromFFIType hs_bindgen_08f27d79a8ef226d_base
+{-# NOINLINE int_fast8_t_fun_funptr #-}
+{-| __C declaration:__ @int_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 17:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast8_t_fun_funptr :: FunPtr (IO Int_fast8_t)
+{-| __C declaration:__ @int_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 17:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast8_t_fun_funptr = unsafePerformIO hs_bindgen_08f27d79a8ef226d
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast16_t_fun@
+foreign import ccall unsafe "hs_bindgen_1bff6fbb3c56abd5" hs_bindgen_1bff6fbb3c56abd5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast16_t_fun@
+hs_bindgen_1bff6fbb3c56abd5 :: IO (FunPtr (IO Int_fast16_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast16_t_fun@
+hs_bindgen_1bff6fbb3c56abd5 = fmap fromFFIType hs_bindgen_1bff6fbb3c56abd5_base
+{-# NOINLINE int_fast16_t_fun_funptr #-}
+{-| __C declaration:__ @int_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 18:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast16_t_fun_funptr :: FunPtr (IO Int_fast16_t)
+{-| __C declaration:__ @int_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 18:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast16_t_fun_funptr = unsafePerformIO hs_bindgen_1bff6fbb3c56abd5
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast32_t_fun@
+foreign import ccall unsafe "hs_bindgen_8a1d629866650da2" hs_bindgen_8a1d629866650da2_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast32_t_fun@
+hs_bindgen_8a1d629866650da2 :: IO (FunPtr (IO Int_fast32_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast32_t_fun@
+hs_bindgen_8a1d629866650da2 = fmap fromFFIType hs_bindgen_8a1d629866650da2_base
+{-# NOINLINE int_fast32_t_fun_funptr #-}
+{-| __C declaration:__ @int_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 19:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast32_t_fun_funptr :: FunPtr (IO Int_fast32_t)
+{-| __C declaration:__ @int_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 19:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast32_t_fun_funptr = unsafePerformIO hs_bindgen_8a1d629866650da2
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast64_t_fun@
+foreign import ccall unsafe "hs_bindgen_c112b0dedac2cffa" hs_bindgen_c112b0dedac2cffa_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast64_t_fun@
+hs_bindgen_c112b0dedac2cffa :: IO (FunPtr (IO Int_fast64_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_int_fast64_t_fun@
+hs_bindgen_c112b0dedac2cffa = fmap fromFFIType hs_bindgen_c112b0dedac2cffa_base
+{-# NOINLINE int_fast64_t_fun_funptr #-}
+{-| __C declaration:__ @int_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 20:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast64_t_fun_funptr :: FunPtr (IO Int_fast64_t)
+{-| __C declaration:__ @int_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 20:14@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+int_fast64_t_fun_funptr = unsafePerformIO hs_bindgen_c112b0dedac2cffa
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast8_t_fun@
+foreign import ccall unsafe "hs_bindgen_c20e96bd69bdb439" hs_bindgen_c20e96bd69bdb439_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast8_t_fun@
+hs_bindgen_c20e96bd69bdb439 :: IO (FunPtr (IO Uint_fast8_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast8_t_fun@
+hs_bindgen_c20e96bd69bdb439 = fmap fromFFIType hs_bindgen_c20e96bd69bdb439_base
+{-# NOINLINE uint_fast8_t_fun_funptr #-}
+{-| __C declaration:__ @uint_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 22:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast8_t_fun_funptr :: FunPtr (IO Uint_fast8_t)
+{-| __C declaration:__ @uint_fast8_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 22:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast8_t_fun_funptr = unsafePerformIO hs_bindgen_c20e96bd69bdb439
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast16_t_fun@
+foreign import ccall unsafe "hs_bindgen_c4f607ba753f0616" hs_bindgen_c4f607ba753f0616_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast16_t_fun@
+hs_bindgen_c4f607ba753f0616 :: IO (FunPtr (IO Uint_fast16_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast16_t_fun@
+hs_bindgen_c4f607ba753f0616 = fmap fromFFIType hs_bindgen_c4f607ba753f0616_base
+{-# NOINLINE uint_fast16_t_fun_funptr #-}
+{-| __C declaration:__ @uint_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 23:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast16_t_fun_funptr :: FunPtr (IO Uint_fast16_t)
+{-| __C declaration:__ @uint_fast16_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 23:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast16_t_fun_funptr = unsafePerformIO hs_bindgen_c4f607ba753f0616
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast32_t_fun@
+foreign import ccall unsafe "hs_bindgen_c22f26851616c098" hs_bindgen_c22f26851616c098_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast32_t_fun@
+hs_bindgen_c22f26851616c098 :: IO (FunPtr (IO Uint_fast32_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast32_t_fun@
+hs_bindgen_c22f26851616c098 = fmap fromFFIType hs_bindgen_c22f26851616c098_base
+{-# NOINLINE uint_fast32_t_fun_funptr #-}
+{-| __C declaration:__ @uint_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 24:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast32_t_fun_funptr :: FunPtr (IO Uint_fast32_t)
+{-| __C declaration:__ @uint_fast32_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 24:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast32_t_fun_funptr = unsafePerformIO hs_bindgen_c22f26851616c098
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast64_t_fun@
+foreign import ccall unsafe "hs_bindgen_3ee59d750d0d2d2a" hs_bindgen_3ee59d750d0d2d2a_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast64_t_fun@
+hs_bindgen_3ee59d750d0d2d2a :: IO (FunPtr (IO Uint_fast64_t))
+-- __unique:__ @test_typesprimitivesleast_fast_Example_get_uint_fast64_t_fun@
+hs_bindgen_3ee59d750d0d2d2a = fmap fromFFIType hs_bindgen_3ee59d750d0d2d2a_base
+{-# NOINLINE uint_fast64_t_fun_funptr #-}
+{-| __C declaration:__ @uint_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 25:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast64_t_fun_funptr :: FunPtr (IO Uint_fast64_t)
+{-| __C declaration:__ @uint_fast64_t_fun@
+
+    __defined at:__ @types\/primitives\/least_fast.h 25:15@
+
+    __exported by:__ @types\/primitives\/least_fast.h@
+-}
+uint_fast64_t_fun_funptr = unsafePerformIO hs_bindgen_3ee59d750d0d2d2a
diff --git a/test-artefacts/fixtures/types/primitives/primitive_insts/Example.hs b/test-artefacts/fixtures/types/primitives/primitive_insts/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/primitive_insts/Example.hs
@@ -0,0 +1,1215 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Prim_HsPrimCPtrdiff(..)
+    , Example.Prim_HsPrimInt8(..)
+    , Example.Prim_HsPrimInt16(..)
+    , Example.Prim_HsPrimInt32(..)
+    , Example.Prim_HsPrimInt64(..)
+    , Example.Prim_HsPrimWord8(..)
+    , Example.Prim_HsPrimWord16(..)
+    , Example.Prim_HsPrimWord32(..)
+    , Example.Prim_HsPrimWord64(..)
+    , Example.Prim_HsPrimCChar(..)
+    , Example.Prim_HsPrimCSChar(..)
+    , Example.Prim_HsPrimCUChar(..)
+    , Example.Prim_HsPrimCShort(..)
+    , Example.Prim_HsPrimCUShort(..)
+    , Example.Prim_HsPrimCInt(..)
+    , Example.Prim_HsPrimCUInt(..)
+    , Example.Prim_HsPrimCLong(..)
+    , Example.Prim_HsPrimCULong(..)
+    , Example.Prim_HsPrimCLLong(..)
+    , Example.Prim_HsPrimCULLong(..)
+    , Example.Prim_HsPrimCBool(..)
+    , Example.Prim_HsPrimCFloat(..)
+    , Example.Prim_HsPrimCDouble(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, Floating, Fractional, Integral, Num, Ord, Read, Real, RealFloat, RealFrac, Show, type (~))
+
+{-| __C declaration:__ @prim_HsPrimCPtrdiff@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 13:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCPtrdiff = Prim_HsPrimCPtrdiff
+  { unwrapPrim_HsPrimCPtrdiff :: HsBindgen.Runtime.LibC.CPtrdiff
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CPtrdiff
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCPtrdiff" Prim_HsPrimCPtrdiff ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCPtrdiff {unwrapPrim_HsPrimCPtrdiff = y1}
+      , BG.getField @"unwrapPrim_HsPrimCPtrdiff" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.CPtrdiff
+         ) => BG.HasField "unwrapPrim_HsPrimCPtrdiff" (BG.Ptr Prim_HsPrimCPtrdiff) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCPtrdiff")
+
+instance HasCField.HasCField Prim_HsPrimCPtrdiff "unwrapPrim_HsPrimCPtrdiff" where
+
+  type CFieldType Prim_HsPrimCPtrdiff "unwrapPrim_HsPrimCPtrdiff" =
+    HsBindgen.Runtime.LibC.CPtrdiff
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimInt8@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 19:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimInt8 = Prim_HsPrimInt8
+  { unwrapPrim_HsPrimInt8 :: HsBindgen.Runtime.LibC.Int8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimInt8" Prim_HsPrimInt8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Prim_HsPrimInt8 {unwrapPrim_HsPrimInt8 = y1}
+      , BG.getField @"unwrapPrim_HsPrimInt8" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int8
+         ) => BG.HasField "unwrapPrim_HsPrimInt8" (BG.Ptr Prim_HsPrimInt8) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimInt8")
+
+instance HasCField.HasCField Prim_HsPrimInt8 "unwrapPrim_HsPrimInt8" where
+
+  type CFieldType Prim_HsPrimInt8 "unwrapPrim_HsPrimInt8" =
+    HsBindgen.Runtime.LibC.Int8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimInt16@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 20:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimInt16 = Prim_HsPrimInt16
+  { unwrapPrim_HsPrimInt16 :: HsBindgen.Runtime.LibC.Int16
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int16
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimInt16" Prim_HsPrimInt16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimInt16 {unwrapPrim_HsPrimInt16 = y1}
+      , BG.getField @"unwrapPrim_HsPrimInt16" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int16
+         ) => BG.HasField "unwrapPrim_HsPrimInt16" (BG.Ptr Prim_HsPrimInt16) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimInt16")
+
+instance HasCField.HasCField Prim_HsPrimInt16 "unwrapPrim_HsPrimInt16" where
+
+  type CFieldType Prim_HsPrimInt16 "unwrapPrim_HsPrimInt16" =
+    HsBindgen.Runtime.LibC.Int16
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimInt32@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 21:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimInt32 = Prim_HsPrimInt32
+  { unwrapPrim_HsPrimInt32 :: HsBindgen.Runtime.LibC.Int32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimInt32" Prim_HsPrimInt32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimInt32 {unwrapPrim_HsPrimInt32 = y1}
+      , BG.getField @"unwrapPrim_HsPrimInt32" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int32
+         ) => BG.HasField "unwrapPrim_HsPrimInt32" (BG.Ptr Prim_HsPrimInt32) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimInt32")
+
+instance HasCField.HasCField Prim_HsPrimInt32 "unwrapPrim_HsPrimInt32" where
+
+  type CFieldType Prim_HsPrimInt32 "unwrapPrim_HsPrimInt32" =
+    HsBindgen.Runtime.LibC.Int32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimInt64@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 22:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimInt64 = Prim_HsPrimInt64
+  { unwrapPrim_HsPrimInt64 :: HsBindgen.Runtime.LibC.Int64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimInt64" Prim_HsPrimInt64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimInt64 {unwrapPrim_HsPrimInt64 = y1}
+      , BG.getField @"unwrapPrim_HsPrimInt64" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Int64
+         ) => BG.HasField "unwrapPrim_HsPrimInt64" (BG.Ptr Prim_HsPrimInt64) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimInt64")
+
+instance HasCField.HasCField Prim_HsPrimInt64 "unwrapPrim_HsPrimInt64" where
+
+  type CFieldType Prim_HsPrimInt64 "unwrapPrim_HsPrimInt64" =
+    HsBindgen.Runtime.LibC.Int64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimWord8@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 24:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimWord8 = Prim_HsPrimWord8
+  { unwrapPrim_HsPrimWord8 :: HsBindgen.Runtime.LibC.Word8
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimWord8" Prim_HsPrimWord8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimWord8 {unwrapPrim_HsPrimWord8 = y1}
+      , BG.getField @"unwrapPrim_HsPrimWord8" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word8
+         ) => BG.HasField "unwrapPrim_HsPrimWord8" (BG.Ptr Prim_HsPrimWord8) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimWord8")
+
+instance HasCField.HasCField Prim_HsPrimWord8 "unwrapPrim_HsPrimWord8" where
+
+  type CFieldType Prim_HsPrimWord8 "unwrapPrim_HsPrimWord8" =
+    HsBindgen.Runtime.LibC.Word8
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimWord16@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 25:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimWord16 = Prim_HsPrimWord16
+  { unwrapPrim_HsPrimWord16 :: HsBindgen.Runtime.LibC.Word16
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimWord16" Prim_HsPrimWord16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimWord16 {unwrapPrim_HsPrimWord16 = y1}
+      , BG.getField @"unwrapPrim_HsPrimWord16" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word16
+         ) => BG.HasField "unwrapPrim_HsPrimWord16" (BG.Ptr Prim_HsPrimWord16) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimWord16")
+
+instance HasCField.HasCField Prim_HsPrimWord16 "unwrapPrim_HsPrimWord16" where
+
+  type CFieldType Prim_HsPrimWord16 "unwrapPrim_HsPrimWord16" =
+    HsBindgen.Runtime.LibC.Word16
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimWord32@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 26:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimWord32 = Prim_HsPrimWord32
+  { unwrapPrim_HsPrimWord32 :: HsBindgen.Runtime.LibC.Word32
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimWord32" Prim_HsPrimWord32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimWord32 {unwrapPrim_HsPrimWord32 = y1}
+      , BG.getField @"unwrapPrim_HsPrimWord32" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word32
+         ) => BG.HasField "unwrapPrim_HsPrimWord32" (BG.Ptr Prim_HsPrimWord32) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimWord32")
+
+instance HasCField.HasCField Prim_HsPrimWord32 "unwrapPrim_HsPrimWord32" where
+
+  type CFieldType Prim_HsPrimWord32 "unwrapPrim_HsPrimWord32" =
+    HsBindgen.Runtime.LibC.Word32
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimWord64@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 27:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimWord64 = Prim_HsPrimWord64
+  { unwrapPrim_HsPrimWord64 :: HsBindgen.Runtime.LibC.Word64
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimWord64" Prim_HsPrimWord64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimWord64 {unwrapPrim_HsPrimWord64 = y1}
+      , BG.getField @"unwrapPrim_HsPrimWord64" x0
+      )
+
+instance ( ty ~ HsBindgen.Runtime.LibC.Word64
+         ) => BG.HasField "unwrapPrim_HsPrimWord64" (BG.Ptr Prim_HsPrimWord64) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimWord64")
+
+instance HasCField.HasCField Prim_HsPrimWord64 "unwrapPrim_HsPrimWord64" where
+
+  type CFieldType Prim_HsPrimWord64 "unwrapPrim_HsPrimWord64" =
+    HsBindgen.Runtime.LibC.Word64
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCChar@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 28:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCChar = Prim_HsPrimCChar
+  { unwrapPrim_HsPrimCChar :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCChar" Prim_HsPrimCChar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCChar {unwrapPrim_HsPrimCChar = y1}
+      , BG.getField @"unwrapPrim_HsPrimCChar" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "unwrapPrim_HsPrimCChar" (BG.Ptr Prim_HsPrimCChar) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCChar")
+
+instance HasCField.HasCField Prim_HsPrimCChar "unwrapPrim_HsPrimCChar" where
+
+  type CFieldType Prim_HsPrimCChar "unwrapPrim_HsPrimCChar" =
+    BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCSChar@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 29:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCSChar = Prim_HsPrimCSChar
+  { unwrapPrim_HsPrimCSChar :: BG.CSChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCSChar" Prim_HsPrimCSChar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCSChar {unwrapPrim_HsPrimCSChar = y1}
+      , BG.getField @"unwrapPrim_HsPrimCSChar" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "unwrapPrim_HsPrimCSChar" (BG.Ptr Prim_HsPrimCSChar) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCSChar")
+
+instance HasCField.HasCField Prim_HsPrimCSChar "unwrapPrim_HsPrimCSChar" where
+
+  type CFieldType Prim_HsPrimCSChar "unwrapPrim_HsPrimCSChar" =
+    BG.CSChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCUChar@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 30:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCUChar = Prim_HsPrimCUChar
+  { unwrapPrim_HsPrimCUChar :: BG.CUChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CUChar
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCUChar" Prim_HsPrimCUChar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCUChar {unwrapPrim_HsPrimCUChar = y1}
+      , BG.getField @"unwrapPrim_HsPrimCUChar" x0
+      )
+
+instance ( ty ~ BG.CUChar
+         ) => BG.HasField "unwrapPrim_HsPrimCUChar" (BG.Ptr Prim_HsPrimCUChar) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCUChar")
+
+instance HasCField.HasCField Prim_HsPrimCUChar "unwrapPrim_HsPrimCUChar" where
+
+  type CFieldType Prim_HsPrimCUChar "unwrapPrim_HsPrimCUChar" =
+    BG.CUChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCShort@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 31:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCShort = Prim_HsPrimCShort
+  { unwrapPrim_HsPrimCShort :: BG.CShort
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCShort" Prim_HsPrimCShort ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCShort {unwrapPrim_HsPrimCShort = y1}
+      , BG.getField @"unwrapPrim_HsPrimCShort" x0
+      )
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "unwrapPrim_HsPrimCShort" (BG.Ptr Prim_HsPrimCShort) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCShort")
+
+instance HasCField.HasCField Prim_HsPrimCShort "unwrapPrim_HsPrimCShort" where
+
+  type CFieldType Prim_HsPrimCShort "unwrapPrim_HsPrimCShort" =
+    BG.CShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCUShort@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 32:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCUShort = Prim_HsPrimCUShort
+  { unwrapPrim_HsPrimCUShort :: BG.CUShort
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CUShort
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCUShort" Prim_HsPrimCUShort ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCUShort {unwrapPrim_HsPrimCUShort = y1}
+      , BG.getField @"unwrapPrim_HsPrimCUShort" x0
+      )
+
+instance ( ty ~ BG.CUShort
+         ) => BG.HasField "unwrapPrim_HsPrimCUShort" (BG.Ptr Prim_HsPrimCUShort) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCUShort")
+
+instance HasCField.HasCField Prim_HsPrimCUShort "unwrapPrim_HsPrimCUShort" where
+
+  type CFieldType Prim_HsPrimCUShort "unwrapPrim_HsPrimCUShort" =
+    BG.CUShort
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCInt@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 33:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCInt = Prim_HsPrimCInt
+  { unwrapPrim_HsPrimCInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCInt" Prim_HsPrimCInt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> Prim_HsPrimCInt {unwrapPrim_HsPrimCInt = y1}
+      , BG.getField @"unwrapPrim_HsPrimCInt" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapPrim_HsPrimCInt" (BG.Ptr Prim_HsPrimCInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCInt")
+
+instance HasCField.HasCField Prim_HsPrimCInt "unwrapPrim_HsPrimCInt" where
+
+  type CFieldType Prim_HsPrimCInt "unwrapPrim_HsPrimCInt" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCUInt@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 34:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCUInt = Prim_HsPrimCUInt
+  { unwrapPrim_HsPrimCUInt :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCUInt" Prim_HsPrimCUInt ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCUInt {unwrapPrim_HsPrimCUInt = y1}
+      , BG.getField @"unwrapPrim_HsPrimCUInt" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "unwrapPrim_HsPrimCUInt" (BG.Ptr Prim_HsPrimCUInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCUInt")
+
+instance HasCField.HasCField Prim_HsPrimCUInt "unwrapPrim_HsPrimCUInt" where
+
+  type CFieldType Prim_HsPrimCUInt "unwrapPrim_HsPrimCUInt" =
+    BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCLong@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 35:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCLong = Prim_HsPrimCLong
+  { unwrapPrim_HsPrimCLong :: BG.CLong
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCLong" Prim_HsPrimCLong ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCLong {unwrapPrim_HsPrimCLong = y1}
+      , BG.getField @"unwrapPrim_HsPrimCLong" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "unwrapPrim_HsPrimCLong" (BG.Ptr Prim_HsPrimCLong) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCLong")
+
+instance HasCField.HasCField Prim_HsPrimCLong "unwrapPrim_HsPrimCLong" where
+
+  type CFieldType Prim_HsPrimCLong "unwrapPrim_HsPrimCLong" =
+    BG.CLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCULong@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 36:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCULong = Prim_HsPrimCULong
+  { unwrapPrim_HsPrimCULong :: BG.CULong
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CULong
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCULong" Prim_HsPrimCULong ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCULong {unwrapPrim_HsPrimCULong = y1}
+      , BG.getField @"unwrapPrim_HsPrimCULong" x0
+      )
+
+instance ( ty ~ BG.CULong
+         ) => BG.HasField "unwrapPrim_HsPrimCULong" (BG.Ptr Prim_HsPrimCULong) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCULong")
+
+instance HasCField.HasCField Prim_HsPrimCULong "unwrapPrim_HsPrimCULong" where
+
+  type CFieldType Prim_HsPrimCULong "unwrapPrim_HsPrimCULong" =
+    BG.CULong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCLLong@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 37:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCLLong = Prim_HsPrimCLLong
+  { unwrapPrim_HsPrimCLLong :: BG.CLLong
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCLLong" Prim_HsPrimCLLong ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCLLong {unwrapPrim_HsPrimCLLong = y1}
+      , BG.getField @"unwrapPrim_HsPrimCLLong" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "unwrapPrim_HsPrimCLLong" (BG.Ptr Prim_HsPrimCLLong) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCLLong")
+
+instance HasCField.HasCField Prim_HsPrimCLLong "unwrapPrim_HsPrimCLLong" where
+
+  type CFieldType Prim_HsPrimCLLong "unwrapPrim_HsPrimCLLong" =
+    BG.CLLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCULLong@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 38:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCULLong = Prim_HsPrimCULLong
+  { unwrapPrim_HsPrimCULLong :: BG.CULLong
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CULLong
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCULLong" Prim_HsPrimCULLong ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCULLong {unwrapPrim_HsPrimCULLong = y1}
+      , BG.getField @"unwrapPrim_HsPrimCULLong" x0
+      )
+
+instance ( ty ~ BG.CULLong
+         ) => BG.HasField "unwrapPrim_HsPrimCULLong" (BG.Ptr Prim_HsPrimCULLong) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCULLong")
+
+instance HasCField.HasCField Prim_HsPrimCULLong "unwrapPrim_HsPrimCULLong" where
+
+  type CFieldType Prim_HsPrimCULLong "unwrapPrim_HsPrimCULLong" =
+    BG.CULLong
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCBool@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 39:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCBool = Prim_HsPrimCBool
+  { unwrapPrim_HsPrimCBool :: BG.CBool
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CBool
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCBool" Prim_HsPrimCBool ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCBool {unwrapPrim_HsPrimCBool = y1}
+      , BG.getField @"unwrapPrim_HsPrimCBool" x0
+      )
+
+instance ( ty ~ BG.CBool
+         ) => BG.HasField "unwrapPrim_HsPrimCBool" (BG.Ptr Prim_HsPrimCBool) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCBool")
+
+instance HasCField.HasCField Prim_HsPrimCBool "unwrapPrim_HsPrimCBool" where
+
+  type CFieldType Prim_HsPrimCBool "unwrapPrim_HsPrimCBool" =
+    BG.CBool
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCFloat@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 40:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCFloat = Prim_HsPrimCFloat
+  { unwrapPrim_HsPrimCFloat :: BG.CFloat
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCFloat" Prim_HsPrimCFloat ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCFloat {unwrapPrim_HsPrimCFloat = y1}
+      , BG.getField @"unwrapPrim_HsPrimCFloat" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "unwrapPrim_HsPrimCFloat" (BG.Ptr Prim_HsPrimCFloat) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCFloat")
+
+instance HasCField.HasCField Prim_HsPrimCFloat "unwrapPrim_HsPrimCFloat" where
+
+  type CFieldType Prim_HsPrimCFloat "unwrapPrim_HsPrimCFloat" =
+    BG.CFloat
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @prim_HsPrimCDouble@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 41:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCDouble = Prim_HsPrimCDouble
+  { unwrapPrim_HsPrimCDouble :: BG.CDouble
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( Enum
+    , Floating
+    , Fractional
+    , BG.HasFFIType
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , RealFloat
+    , RealFrac
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "unwrapPrim_HsPrimCDouble" Prim_HsPrimCDouble ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Prim_HsPrimCDouble {unwrapPrim_HsPrimCDouble = y1}
+      , BG.getField @"unwrapPrim_HsPrimCDouble" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "unwrapPrim_HsPrimCDouble" (BG.Ptr Prim_HsPrimCDouble) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapPrim_HsPrimCDouble")
+
+instance HasCField.HasCField Prim_HsPrimCDouble "unwrapPrim_HsPrimCDouble" where
+
+  type CFieldType Prim_HsPrimCDouble "unwrapPrim_HsPrimCDouble" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/primitives/primitive_insts/bindingspec.yaml b/test-artefacts/fixtures/types/primitives/primitive_insts/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/primitive_insts/bindingspec.yaml
@@ -0,0 +1,853 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCPtrdiff
+  hsname: Prim_HsPrimCPtrdiff
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimInt8
+  hsname: Prim_HsPrimInt8
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimInt16
+  hsname: Prim_HsPrimInt16
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimInt32
+  hsname: Prim_HsPrimInt32
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimInt64
+  hsname: Prim_HsPrimInt64
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimWord8
+  hsname: Prim_HsPrimWord8
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimWord16
+  hsname: Prim_HsPrimWord16
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimWord32
+  hsname: Prim_HsPrimWord32
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimWord64
+  hsname: Prim_HsPrimWord64
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCChar
+  hsname: Prim_HsPrimCChar
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCSChar
+  hsname: Prim_HsPrimCSChar
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCUChar
+  hsname: Prim_HsPrimCUChar
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCShort
+  hsname: Prim_HsPrimCShort
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCUShort
+  hsname: Prim_HsPrimCUShort
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCInt
+  hsname: Prim_HsPrimCInt
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCUInt
+  hsname: Prim_HsPrimCUInt
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCLong
+  hsname: Prim_HsPrimCLong
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCULong
+  hsname: Prim_HsPrimCULong
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCLLong
+  hsname: Prim_HsPrimCLLong
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCULLong
+  hsname: Prim_HsPrimCULLong
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCBool
+  hsname: Prim_HsPrimCBool
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCFloat
+  hsname: Prim_HsPrimCFloat
+- headers: types/primitives/primitive_insts.h
+  cname: prim_HsPrimCDouble
+  hsname: Prim_HsPrimCDouble
+hstypes:
+- hsname: Prim_HsPrimCBool
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCBool
+      fields:
+      - unwrapPrim_HsPrimCBool
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CBool
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCChar
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCChar
+      fields:
+      - unwrapPrim_HsPrimCChar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCDouble
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCDouble
+      fields:
+      - unwrapPrim_HsPrimCDouble
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CDouble
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCFloat
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCFloat
+      fields:
+      - unwrapPrim_HsPrimCFloat
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CFloat
+  instances:
+  - Enum
+  - Eq
+  - Floating
+  - Fractional
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - RealFloat
+  - RealFrac
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCInt
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCInt
+      fields:
+      - unwrapPrim_HsPrimCInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCLLong
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCLLong
+      fields:
+      - unwrapPrim_HsPrimCLLong
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CLLong
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCLong
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCLong
+      fields:
+      - unwrapPrim_HsPrimCLong
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CLong
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCPtrdiff
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCPtrdiff
+      fields:
+      - unwrapPrim_HsPrimCPtrdiff
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: CPtrdiff
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCSChar
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCSChar
+      fields:
+      - unwrapPrim_HsPrimCSChar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CSChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCShort
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCShort
+      fields:
+      - unwrapPrim_HsPrimCShort
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CShort
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCUChar
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCUChar
+      fields:
+      - unwrapPrim_HsPrimCUChar
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCUInt
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCUInt
+      fields:
+      - unwrapPrim_HsPrimCUInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCULLong
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCULLong
+      fields:
+      - unwrapPrim_HsPrimCULLong
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CULLong
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCULong
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCULong
+      fields:
+      - unwrapPrim_HsPrimCULong
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CULong
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimCUShort
+  representation:
+    newtype:
+      constructor: Prim_HsPrimCUShort
+      fields:
+      - unwrapPrim_HsPrimCUShort
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUShort
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimInt16
+  representation:
+    newtype:
+      constructor: Prim_HsPrimInt16
+      fields:
+      - unwrapPrim_HsPrimInt16
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int16
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimInt32
+  representation:
+    newtype:
+      constructor: Prim_HsPrimInt32
+      fields:
+      - unwrapPrim_HsPrimInt32
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimInt64
+  representation:
+    newtype:
+      constructor: Prim_HsPrimInt64
+      fields:
+      - unwrapPrim_HsPrimInt64
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimInt8
+  representation:
+    newtype:
+      constructor: Prim_HsPrimInt8
+      fields:
+      - unwrapPrim_HsPrimInt8
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Int8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimWord16
+  representation:
+    newtype:
+      constructor: Prim_HsPrimWord16
+      fields:
+      - unwrapPrim_HsPrimWord16
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word16
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimWord32
+  representation:
+    newtype:
+      constructor: Prim_HsPrimWord32
+      fields:
+      - unwrapPrim_HsPrimWord32
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word32
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimWord64
+  representation:
+    newtype:
+      constructor: Prim_HsPrimWord64
+      fields:
+      - unwrapPrim_HsPrimWord64
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word64
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Prim_HsPrimWord8
+  representation:
+    newtype:
+      constructor: Prim_HsPrimWord8
+      fields:
+      - unwrapPrim_HsPrimWord8
+      ffitype:
+        hsmodule: HsBindgen.Runtime.LibC
+        hsname: Word8
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/primitives/primitive_insts/th.txt b/test-artefacts/fixtures/types/primitives/primitive_insts/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/primitive_insts/th.txt
@@ -0,0 +1,815 @@
+-- addDependentFile musl-include/x86_64/stdbool.h
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile musl-include/x86_64/bits/stdint.h
+-- addDependentFile musl-include/x86_64/stdint.h
+-- addDependentFile test-artefacts/headers/golden/types/primitives/primitive_insts.h
+{-| __C declaration:__ @prim_HsPrimCPtrdiff@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 13:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCPtrdiff
+    = Prim_HsPrimCPtrdiff {unwrapPrim_HsPrimCPtrdiff :: HsBindgen.Runtime.LibC.CPtrdiff}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.CPtrdiff =>
+         HasField "unwrapPrim_HsPrimCPtrdiff" Prim_HsPrimCPtrdiff ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCPtrdiff{unwrapPrim_HsPrimCPtrdiff = y_1},
+                              getField @"unwrapPrim_HsPrimCPtrdiff" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.CPtrdiff =>
+         HasField "unwrapPrim_HsPrimCPtrdiff"
+                  (Ptr Prim_HsPrimCPtrdiff)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCPtrdiff")
+instance HasCField Prim_HsPrimCPtrdiff "unwrapPrim_HsPrimCPtrdiff"
+    where type CFieldType Prim_HsPrimCPtrdiff
+                          "unwrapPrim_HsPrimCPtrdiff" = HsBindgen.Runtime.LibC.CPtrdiff
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimInt8@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 19:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimInt8
+    = Prim_HsPrimInt8 {unwrapPrim_HsPrimInt8 :: HsBindgen.Runtime.LibC.Int8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapPrim_HsPrimInt8" Prim_HsPrimInt8 ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimInt8{unwrapPrim_HsPrimInt8 = y_1},
+                              getField @"unwrapPrim_HsPrimInt8" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int8 =>
+         HasField "unwrapPrim_HsPrimInt8" (Ptr Prim_HsPrimInt8) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimInt8")
+instance HasCField Prim_HsPrimInt8 "unwrapPrim_HsPrimInt8"
+    where type CFieldType Prim_HsPrimInt8
+                          "unwrapPrim_HsPrimInt8" = HsBindgen.Runtime.LibC.Int8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimInt16@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 20:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimInt16
+    = Prim_HsPrimInt16 {unwrapPrim_HsPrimInt16 :: HsBindgen.Runtime.LibC.Int16}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int16 =>
+         HasField "unwrapPrim_HsPrimInt16" Prim_HsPrimInt16 ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimInt16{unwrapPrim_HsPrimInt16 = y_1},
+                              getField @"unwrapPrim_HsPrimInt16" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int16 =>
+         HasField "unwrapPrim_HsPrimInt16" (Ptr Prim_HsPrimInt16) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimInt16")
+instance HasCField Prim_HsPrimInt16 "unwrapPrim_HsPrimInt16"
+    where type CFieldType Prim_HsPrimInt16
+                          "unwrapPrim_HsPrimInt16" = HsBindgen.Runtime.LibC.Int16
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimInt32@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 21:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimInt32
+    = Prim_HsPrimInt32 {unwrapPrim_HsPrimInt32 :: HsBindgen.Runtime.LibC.Int32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapPrim_HsPrimInt32" Prim_HsPrimInt32 ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimInt32{unwrapPrim_HsPrimInt32 = y_1},
+                              getField @"unwrapPrim_HsPrimInt32" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int32 =>
+         HasField "unwrapPrim_HsPrimInt32" (Ptr Prim_HsPrimInt32) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimInt32")
+instance HasCField Prim_HsPrimInt32 "unwrapPrim_HsPrimInt32"
+    where type CFieldType Prim_HsPrimInt32
+                          "unwrapPrim_HsPrimInt32" = HsBindgen.Runtime.LibC.Int32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimInt64@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 22:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimInt64
+    = Prim_HsPrimInt64 {unwrapPrim_HsPrimInt64 :: HsBindgen.Runtime.LibC.Int64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapPrim_HsPrimInt64" Prim_HsPrimInt64 ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimInt64{unwrapPrim_HsPrimInt64 = y_1},
+                              getField @"unwrapPrim_HsPrimInt64" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Int64 =>
+         HasField "unwrapPrim_HsPrimInt64" (Ptr Prim_HsPrimInt64) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimInt64")
+instance HasCField Prim_HsPrimInt64 "unwrapPrim_HsPrimInt64"
+    where type CFieldType Prim_HsPrimInt64
+                          "unwrapPrim_HsPrimInt64" = HsBindgen.Runtime.LibC.Int64
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimWord8@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 24:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimWord8
+    = Prim_HsPrimWord8 {unwrapPrim_HsPrimWord8 :: HsBindgen.Runtime.LibC.Word8}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapPrim_HsPrimWord8" Prim_HsPrimWord8 ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimWord8{unwrapPrim_HsPrimWord8 = y_1},
+                              getField @"unwrapPrim_HsPrimWord8" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word8 =>
+         HasField "unwrapPrim_HsPrimWord8" (Ptr Prim_HsPrimWord8) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimWord8")
+instance HasCField Prim_HsPrimWord8 "unwrapPrim_HsPrimWord8"
+    where type CFieldType Prim_HsPrimWord8
+                          "unwrapPrim_HsPrimWord8" = HsBindgen.Runtime.LibC.Word8
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimWord16@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 25:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimWord16
+    = Prim_HsPrimWord16 {unwrapPrim_HsPrimWord16 :: HsBindgen.Runtime.LibC.Word16}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "unwrapPrim_HsPrimWord16" Prim_HsPrimWord16 ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimWord16{unwrapPrim_HsPrimWord16 = y_1},
+                              getField @"unwrapPrim_HsPrimWord16" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word16 =>
+         HasField "unwrapPrim_HsPrimWord16" (Ptr Prim_HsPrimWord16) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimWord16")
+instance HasCField Prim_HsPrimWord16 "unwrapPrim_HsPrimWord16"
+    where type CFieldType Prim_HsPrimWord16
+                          "unwrapPrim_HsPrimWord16" = HsBindgen.Runtime.LibC.Word16
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimWord32@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 26:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimWord32
+    = Prim_HsPrimWord32 {unwrapPrim_HsPrimWord32 :: HsBindgen.Runtime.LibC.Word32}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapPrim_HsPrimWord32" Prim_HsPrimWord32 ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimWord32{unwrapPrim_HsPrimWord32 = y_1},
+                              getField @"unwrapPrim_HsPrimWord32" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word32 =>
+         HasField "unwrapPrim_HsPrimWord32" (Ptr Prim_HsPrimWord32) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimWord32")
+instance HasCField Prim_HsPrimWord32 "unwrapPrim_HsPrimWord32"
+    where type CFieldType Prim_HsPrimWord32
+                          "unwrapPrim_HsPrimWord32" = HsBindgen.Runtime.LibC.Word32
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimWord64@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 27:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimWord64
+    = Prim_HsPrimWord64 {unwrapPrim_HsPrimWord64 :: HsBindgen.Runtime.LibC.Word64}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapPrim_HsPrimWord64" Prim_HsPrimWord64 ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimWord64{unwrapPrim_HsPrimWord64 = y_1},
+                              getField @"unwrapPrim_HsPrimWord64" x_0)
+instance (~) ty HsBindgen.Runtime.LibC.Word64 =>
+         HasField "unwrapPrim_HsPrimWord64" (Ptr Prim_HsPrimWord64) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimWord64")
+instance HasCField Prim_HsPrimWord64 "unwrapPrim_HsPrimWord64"
+    where type CFieldType Prim_HsPrimWord64
+                          "unwrapPrim_HsPrimWord64" = HsBindgen.Runtime.LibC.Word64
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCChar@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 28:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCChar
+    = Prim_HsPrimCChar {unwrapPrim_HsPrimCChar :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar =>
+         HasField "unwrapPrim_HsPrimCChar" Prim_HsPrimCChar ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCChar{unwrapPrim_HsPrimCChar = y_1},
+                              getField @"unwrapPrim_HsPrimCChar" x_0)
+instance (~) ty CChar =>
+         HasField "unwrapPrim_HsPrimCChar" (Ptr Prim_HsPrimCChar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCChar")
+instance HasCField Prim_HsPrimCChar "unwrapPrim_HsPrimCChar"
+    where type CFieldType Prim_HsPrimCChar
+                          "unwrapPrim_HsPrimCChar" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCSChar@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 29:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCSChar
+    = Prim_HsPrimCSChar {unwrapPrim_HsPrimCSChar :: CSChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CSChar =>
+         HasField "unwrapPrim_HsPrimCSChar" Prim_HsPrimCSChar ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCSChar{unwrapPrim_HsPrimCSChar = y_1},
+                              getField @"unwrapPrim_HsPrimCSChar" x_0)
+instance (~) ty CSChar =>
+         HasField "unwrapPrim_HsPrimCSChar" (Ptr Prim_HsPrimCSChar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCSChar")
+instance HasCField Prim_HsPrimCSChar "unwrapPrim_HsPrimCSChar"
+    where type CFieldType Prim_HsPrimCSChar
+                          "unwrapPrim_HsPrimCSChar" = CSChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCUChar@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 30:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCUChar
+    = Prim_HsPrimCUChar {unwrapPrim_HsPrimCUChar :: CUChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUChar =>
+         HasField "unwrapPrim_HsPrimCUChar" Prim_HsPrimCUChar ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCUChar{unwrapPrim_HsPrimCUChar = y_1},
+                              getField @"unwrapPrim_HsPrimCUChar" x_0)
+instance (~) ty CUChar =>
+         HasField "unwrapPrim_HsPrimCUChar" (Ptr Prim_HsPrimCUChar) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCUChar")
+instance HasCField Prim_HsPrimCUChar "unwrapPrim_HsPrimCUChar"
+    where type CFieldType Prim_HsPrimCUChar
+                          "unwrapPrim_HsPrimCUChar" = CUChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCShort@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 31:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCShort
+    = Prim_HsPrimCShort {unwrapPrim_HsPrimCShort :: CShort}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CShort =>
+         HasField "unwrapPrim_HsPrimCShort" Prim_HsPrimCShort ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCShort{unwrapPrim_HsPrimCShort = y_1},
+                              getField @"unwrapPrim_HsPrimCShort" x_0)
+instance (~) ty CShort =>
+         HasField "unwrapPrim_HsPrimCShort" (Ptr Prim_HsPrimCShort) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCShort")
+instance HasCField Prim_HsPrimCShort "unwrapPrim_HsPrimCShort"
+    where type CFieldType Prim_HsPrimCShort
+                          "unwrapPrim_HsPrimCShort" = CShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCUShort@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 32:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCUShort
+    = Prim_HsPrimCUShort {unwrapPrim_HsPrimCUShort :: CUShort}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUShort =>
+         HasField "unwrapPrim_HsPrimCUShort" Prim_HsPrimCUShort ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCUShort{unwrapPrim_HsPrimCUShort = y_1},
+                              getField @"unwrapPrim_HsPrimCUShort" x_0)
+instance (~) ty CUShort =>
+         HasField "unwrapPrim_HsPrimCUShort"
+                  (Ptr Prim_HsPrimCUShort)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCUShort")
+instance HasCField Prim_HsPrimCUShort "unwrapPrim_HsPrimCUShort"
+    where type CFieldType Prim_HsPrimCUShort
+                          "unwrapPrim_HsPrimCUShort" = CUShort
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCInt@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 33:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCInt
+    = Prim_HsPrimCInt {unwrapPrim_HsPrimCInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt =>
+         HasField "unwrapPrim_HsPrimCInt" Prim_HsPrimCInt ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCInt{unwrapPrim_HsPrimCInt = y_1},
+                              getField @"unwrapPrim_HsPrimCInt" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapPrim_HsPrimCInt" (Ptr Prim_HsPrimCInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCInt")
+instance HasCField Prim_HsPrimCInt "unwrapPrim_HsPrimCInt"
+    where type CFieldType Prim_HsPrimCInt
+                          "unwrapPrim_HsPrimCInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCUInt@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 34:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCUInt
+    = Prim_HsPrimCUInt {unwrapPrim_HsPrimCUInt :: CUInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CUInt =>
+         HasField "unwrapPrim_HsPrimCUInt" Prim_HsPrimCUInt ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCUInt{unwrapPrim_HsPrimCUInt = y_1},
+                              getField @"unwrapPrim_HsPrimCUInt" x_0)
+instance (~) ty CUInt =>
+         HasField "unwrapPrim_HsPrimCUInt" (Ptr Prim_HsPrimCUInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCUInt")
+instance HasCField Prim_HsPrimCUInt "unwrapPrim_HsPrimCUInt"
+    where type CFieldType Prim_HsPrimCUInt
+                          "unwrapPrim_HsPrimCUInt" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCLong@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 35:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCLong
+    = Prim_HsPrimCLong {unwrapPrim_HsPrimCLong :: CLong}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CLong =>
+         HasField "unwrapPrim_HsPrimCLong" Prim_HsPrimCLong ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCLong{unwrapPrim_HsPrimCLong = y_1},
+                              getField @"unwrapPrim_HsPrimCLong" x_0)
+instance (~) ty CLong =>
+         HasField "unwrapPrim_HsPrimCLong" (Ptr Prim_HsPrimCLong) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCLong")
+instance HasCField Prim_HsPrimCLong "unwrapPrim_HsPrimCLong"
+    where type CFieldType Prim_HsPrimCLong
+                          "unwrapPrim_HsPrimCLong" = CLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCULong@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 36:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCULong
+    = Prim_HsPrimCULong {unwrapPrim_HsPrimCULong :: CULong}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CULong =>
+         HasField "unwrapPrim_HsPrimCULong" Prim_HsPrimCULong ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCULong{unwrapPrim_HsPrimCULong = y_1},
+                              getField @"unwrapPrim_HsPrimCULong" x_0)
+instance (~) ty CULong =>
+         HasField "unwrapPrim_HsPrimCULong" (Ptr Prim_HsPrimCULong) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCULong")
+instance HasCField Prim_HsPrimCULong "unwrapPrim_HsPrimCULong"
+    where type CFieldType Prim_HsPrimCULong
+                          "unwrapPrim_HsPrimCULong" = CULong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCLLong@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 37:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCLLong
+    = Prim_HsPrimCLLong {unwrapPrim_HsPrimCLLong :: CLLong}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CLLong =>
+         HasField "unwrapPrim_HsPrimCLLong" Prim_HsPrimCLLong ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCLLong{unwrapPrim_HsPrimCLLong = y_1},
+                              getField @"unwrapPrim_HsPrimCLLong" x_0)
+instance (~) ty CLLong =>
+         HasField "unwrapPrim_HsPrimCLLong" (Ptr Prim_HsPrimCLLong) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCLLong")
+instance HasCField Prim_HsPrimCLLong "unwrapPrim_HsPrimCLLong"
+    where type CFieldType Prim_HsPrimCLLong
+                          "unwrapPrim_HsPrimCLLong" = CLLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCULLong@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 38:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCULLong
+    = Prim_HsPrimCULLong {unwrapPrim_HsPrimCULLong :: CULLong}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CULLong =>
+         HasField "unwrapPrim_HsPrimCULLong" Prim_HsPrimCULLong ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCULLong{unwrapPrim_HsPrimCULLong = y_1},
+                              getField @"unwrapPrim_HsPrimCULLong" x_0)
+instance (~) ty CULLong =>
+         HasField "unwrapPrim_HsPrimCULLong"
+                  (Ptr Prim_HsPrimCULLong)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCULLong")
+instance HasCField Prim_HsPrimCULLong "unwrapPrim_HsPrimCULLong"
+    where type CFieldType Prim_HsPrimCULLong
+                          "unwrapPrim_HsPrimCULLong" = CULLong
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCBool@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 39:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCBool
+    = Prim_HsPrimCBool {unwrapPrim_HsPrimCBool :: CBool}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CBool =>
+         HasField "unwrapPrim_HsPrimCBool" Prim_HsPrimCBool ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCBool{unwrapPrim_HsPrimCBool = y_1},
+                              getField @"unwrapPrim_HsPrimCBool" x_0)
+instance (~) ty CBool =>
+         HasField "unwrapPrim_HsPrimCBool" (Ptr Prim_HsPrimCBool) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCBool")
+instance HasCField Prim_HsPrimCBool "unwrapPrim_HsPrimCBool"
+    where type CFieldType Prim_HsPrimCBool
+                          "unwrapPrim_HsPrimCBool" = CBool
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCFloat@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 40:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCFloat
+    = Prim_HsPrimCFloat {unwrapPrim_HsPrimCFloat :: CFloat}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CFloat =>
+         HasField "unwrapPrim_HsPrimCFloat" Prim_HsPrimCFloat ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCFloat{unwrapPrim_HsPrimCFloat = y_1},
+                              getField @"unwrapPrim_HsPrimCFloat" x_0)
+instance (~) ty CFloat =>
+         HasField "unwrapPrim_HsPrimCFloat" (Ptr Prim_HsPrimCFloat) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCFloat")
+instance HasCField Prim_HsPrimCFloat "unwrapPrim_HsPrimCFloat"
+    where type CFieldType Prim_HsPrimCFloat
+                          "unwrapPrim_HsPrimCFloat" = CFloat
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @prim_HsPrimCDouble@
+
+    __defined at:__ @types\/primitives\/primitive_insts.h 41:28@
+
+    __exported by:__ @types\/primitives\/primitive_insts.h@
+-}
+newtype Prim_HsPrimCDouble
+    = Prim_HsPrimCDouble {unwrapPrim_HsPrimCDouble :: CDouble}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Enum,
+                      Floating,
+                      Fractional,
+                      HasFFIType,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      RealFloat,
+                      RealFrac,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CDouble =>
+         HasField "unwrapPrim_HsPrimCDouble" Prim_HsPrimCDouble ty
+    where hasField = \x_0 -> (\y_1 -> Prim_HsPrimCDouble{unwrapPrim_HsPrimCDouble = y_1},
+                              getField @"unwrapPrim_HsPrimCDouble" x_0)
+instance (~) ty CDouble =>
+         HasField "unwrapPrim_HsPrimCDouble"
+                  (Ptr Prim_HsPrimCDouble)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapPrim_HsPrimCDouble")
+instance HasCField Prim_HsPrimCDouble "unwrapPrim_HsPrimCDouble"
+    where type CFieldType Prim_HsPrimCDouble
+                          "unwrapPrim_HsPrimCDouble" = CDouble
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/primitives/primitive_types/Example.hs b/test-artefacts/fixtures/types/primitives/primitive_types/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/primitive_types/Example.hs
@@ -0,0 +1,1912 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Primitive(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct primitive@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 1:8@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+data Primitive = Primitive
+  { primitive_c :: BG.CChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 2:10@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_sc :: BG.CSChar
+    {- ^ __C declaration:__ @sc@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 3:17@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_uc :: BG.CUChar
+    {- ^ __C declaration:__ @uc@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 4:19@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_s :: BG.CShort
+    {- ^ __C declaration:__ @s@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 6:11@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_si :: BG.CShort
+    {- ^ __C declaration:__ @si@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 7:15@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_ss :: BG.CShort
+    {- ^ __C declaration:__ @ss@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 8:18@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_ssi :: BG.CShort
+    {- ^ __C declaration:__ @ssi@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 9:22@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_us :: BG.CUShort
+    {- ^ __C declaration:__ @us@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 11:20@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_usi :: BG.CUShort
+    {- ^ __C declaration:__ @usi@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 12:24@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_i :: BG.CInt
+    {- ^ __C declaration:__ @i@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 14:9@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_s2 :: BG.CInt
+    {- ^ __C declaration:__ @s2@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 15:12@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_si2 :: BG.CInt
+    {- ^ __C declaration:__ @si2@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 16:16@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_u :: BG.CUInt
+    {- ^ __C declaration:__ @u@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 18:14@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_ui :: BG.CUInt
+    {- ^ __C declaration:__ @ui@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 19:18@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_l :: BG.CLong
+    {- ^ __C declaration:__ @l@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 21:10@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_li :: BG.CLong
+    {- ^ __C declaration:__ @li@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 22:14@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_sl :: BG.CLong
+    {- ^ __C declaration:__ @sl@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 23:17@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_sli :: BG.CLong
+    {- ^ __C declaration:__ @sli@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 24:21@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_ul :: BG.CULong
+    {- ^ __C declaration:__ @ul@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 26:19@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_uli :: BG.CULong
+    {- ^ __C declaration:__ @uli@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 27:23@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_ll :: BG.CLLong
+    {- ^ __C declaration:__ @ll@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 29:15@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_lli :: BG.CLLong
+    {- ^ __C declaration:__ @lli@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 30:19@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_sll :: BG.CLLong
+    {- ^ __C declaration:__ @sll@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 31:22@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_slli :: BG.CLLong
+    {- ^ __C declaration:__ @slli@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 32:26@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_ull :: BG.CULLong
+    {- ^ __C declaration:__ @ull@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 34:24@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_ulli :: BG.CULLong
+    {- ^ __C declaration:__ @ulli@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 35:28@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_f :: BG.CFloat
+    {- ^ __C declaration:__ @f@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 37:11@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  , primitive_d :: BG.CDouble
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @types\/primitives\/primitive_types.h 38:12@
+
+         __exported by:__ @types\/primitives\/primitive_types.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Primitive where
+
+  staticSizeOf = \_ -> (152 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Primitive where
+
+  readRaw =
+    \ptr0 ->
+          pure Primitive
+      <*> HasCField.readRaw (BG.Proxy @"primitive_c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_sc") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_uc") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_s") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_si") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_ss") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_ssi") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_us") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_usi") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_i") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_s2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_si2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_u") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_ui") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_l") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_li") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_sl") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_sli") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_ul") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_uli") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_ll") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_lli") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_sll") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_slli") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_ull") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_ulli") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_f") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"primitive_d") ptr0
+
+instance Marshal.WriteRaw Primitive where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Primitive
+            primitive_c2
+            primitive_sc3
+            primitive_uc4
+            primitive_s5
+            primitive_si6
+            primitive_ss7
+            primitive_ssi8
+            primitive_us9
+            primitive_usi10
+            primitive_i11
+            primitive_s212
+            primitive_si213
+            primitive_u14
+            primitive_ui15
+            primitive_l16
+            primitive_li17
+            primitive_sl18
+            primitive_sli19
+            primitive_ul20
+            primitive_uli21
+            primitive_ll22
+            primitive_lli23
+            primitive_sll24
+            primitive_slli25
+            primitive_ull26
+            primitive_ulli27
+            primitive_f28
+            primitive_d29 ->
+                 HasCField.writeRaw (BG.Proxy @"primitive_c") ptr0 primitive_c2
+              >> HasCField.writeRaw (BG.Proxy @"primitive_sc") ptr0 primitive_sc3
+              >> HasCField.writeRaw (BG.Proxy @"primitive_uc") ptr0 primitive_uc4
+              >> HasCField.writeRaw (BG.Proxy @"primitive_s") ptr0 primitive_s5
+              >> HasCField.writeRaw (BG.Proxy @"primitive_si") ptr0 primitive_si6
+              >> HasCField.writeRaw (BG.Proxy @"primitive_ss") ptr0 primitive_ss7
+              >> HasCField.writeRaw (BG.Proxy @"primitive_ssi") ptr0 primitive_ssi8
+              >> HasCField.writeRaw (BG.Proxy @"primitive_us") ptr0 primitive_us9
+              >> HasCField.writeRaw (BG.Proxy @"primitive_usi") ptr0 primitive_usi10
+              >> HasCField.writeRaw (BG.Proxy @"primitive_i") ptr0 primitive_i11
+              >> HasCField.writeRaw (BG.Proxy @"primitive_s2") ptr0 primitive_s212
+              >> HasCField.writeRaw (BG.Proxy @"primitive_si2") ptr0 primitive_si213
+              >> HasCField.writeRaw (BG.Proxy @"primitive_u") ptr0 primitive_u14
+              >> HasCField.writeRaw (BG.Proxy @"primitive_ui") ptr0 primitive_ui15
+              >> HasCField.writeRaw (BG.Proxy @"primitive_l") ptr0 primitive_l16
+              >> HasCField.writeRaw (BG.Proxy @"primitive_li") ptr0 primitive_li17
+              >> HasCField.writeRaw (BG.Proxy @"primitive_sl") ptr0 primitive_sl18
+              >> HasCField.writeRaw (BG.Proxy @"primitive_sli") ptr0 primitive_sli19
+              >> HasCField.writeRaw (BG.Proxy @"primitive_ul") ptr0 primitive_ul20
+              >> HasCField.writeRaw (BG.Proxy @"primitive_uli") ptr0 primitive_uli21
+              >> HasCField.writeRaw (BG.Proxy @"primitive_ll") ptr0 primitive_ll22
+              >> HasCField.writeRaw (BG.Proxy @"primitive_lli") ptr0 primitive_lli23
+              >> HasCField.writeRaw (BG.Proxy @"primitive_sll") ptr0 primitive_sll24
+              >> HasCField.writeRaw (BG.Proxy @"primitive_slli") ptr0 primitive_slli25
+              >> HasCField.writeRaw (BG.Proxy @"primitive_ull") ptr0 primitive_ull26
+              >> HasCField.writeRaw (BG.Proxy @"primitive_ulli") ptr0 primitive_ulli27
+              >> HasCField.writeRaw (BG.Proxy @"primitive_f") ptr0 primitive_f28
+              >> HasCField.writeRaw (BG.Proxy @"primitive_d") ptr0 primitive_d29
+
+deriving via Marshal.EquivStorable Primitive instance BG.Storable Primitive
+
+deriving via Struct.IsStructViaReadRaw Primitive instance Struct.IsStruct Primitive
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 2:10@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "primitive_c" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_c = y1
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_c" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "primitive_c" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_c")
+
+instance HasCField.HasCField Primitive "primitive_c" where
+
+  type CFieldType Primitive "primitive_c" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @sc@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 3:17@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "primitive_sc" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_sc = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_sc" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "primitive_sc" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_sc")
+
+instance HasCField.HasCField Primitive "primitive_sc" where
+
+  type CFieldType Primitive "primitive_sc" = BG.CSChar
+
+  offset# = \_ -> \_ -> 1
+
+{-| __C declaration:__ @uc@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 4:19@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CUChar
+         ) => BG.CompatHasField.HasField "primitive_uc" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_uc = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_uc" x0
+      )
+
+instance ( ty ~ BG.CUChar
+         ) => BG.HasField "primitive_uc" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_uc")
+
+instance HasCField.HasCField Primitive "primitive_uc" where
+
+  type CFieldType Primitive "primitive_uc" = BG.CUChar
+
+  offset# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @s@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 6:11@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "primitive_s" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_s = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_s" x0
+      )
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "primitive_s" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_s")
+
+instance HasCField.HasCField Primitive "primitive_s" where
+
+  type CFieldType Primitive "primitive_s" = BG.CShort
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @si@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 7:15@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "primitive_si" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_si = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_si" x0
+      )
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "primitive_si" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_si")
+
+instance HasCField.HasCField Primitive "primitive_si" where
+
+  type CFieldType Primitive "primitive_si" = BG.CShort
+
+  offset# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @ss@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 8:18@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "primitive_ss" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_ss = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_ss" x0
+      )
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "primitive_ss" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_ss")
+
+instance HasCField.HasCField Primitive "primitive_ss" where
+
+  type CFieldType Primitive "primitive_ss" = BG.CShort
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @ssi@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 9:22@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CShort
+         ) => BG.CompatHasField.HasField "primitive_ssi" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_ssi = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_ssi" x0
+      )
+
+instance ( ty ~ BG.CShort
+         ) => BG.HasField "primitive_ssi" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_ssi")
+
+instance HasCField.HasCField Primitive "primitive_ssi" where
+
+  type CFieldType Primitive "primitive_ssi" = BG.CShort
+
+  offset# = \_ -> \_ -> 10
+
+{-| __C declaration:__ @us@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 11:20@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CUShort
+         ) => BG.CompatHasField.HasField "primitive_us" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_us = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_us" x0
+      )
+
+instance ( ty ~ BG.CUShort
+         ) => BG.HasField "primitive_us" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_us")
+
+instance HasCField.HasCField Primitive "primitive_us" where
+
+  type CFieldType Primitive "primitive_us" = BG.CUShort
+
+  offset# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @usi@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 12:24@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CUShort
+         ) => BG.CompatHasField.HasField "primitive_usi" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_usi = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_usi" x0
+      )
+
+instance ( ty ~ BG.CUShort
+         ) => BG.HasField "primitive_usi" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_usi")
+
+instance HasCField.HasCField Primitive "primitive_usi" where
+
+  type CFieldType Primitive "primitive_usi" =
+    BG.CUShort
+
+  offset# = \_ -> \_ -> 14
+
+{-| __C declaration:__ @i@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 14:9@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "primitive_i" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_i = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_i" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "primitive_i" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_i")
+
+instance HasCField.HasCField Primitive "primitive_i" where
+
+  type CFieldType Primitive "primitive_i" = BG.CInt
+
+  offset# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @s2@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 15:12@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "primitive_s2" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_s2 = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_s2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "primitive_s2" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_s2")
+
+instance HasCField.HasCField Primitive "primitive_s2" where
+
+  type CFieldType Primitive "primitive_s2" = BG.CInt
+
+  offset# = \_ -> \_ -> 20
+
+{-| __C declaration:__ @si2@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 16:16@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "primitive_si2" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_si2 = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_si2" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "primitive_si2" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_si2")
+
+instance HasCField.HasCField Primitive "primitive_si2" where
+
+  type CFieldType Primitive "primitive_si2" = BG.CInt
+
+  offset# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @u@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 18:14@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "primitive_u" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_u = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_u" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "primitive_u" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_u")
+
+instance HasCField.HasCField Primitive "primitive_u" where
+
+  type CFieldType Primitive "primitive_u" = BG.CUInt
+
+  offset# = \_ -> \_ -> 28
+
+{-| __C declaration:__ @ui@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 19:18@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CUInt
+         ) => BG.CompatHasField.HasField "primitive_ui" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_ui = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_ui" x0
+      )
+
+instance ( ty ~ BG.CUInt
+         ) => BG.HasField "primitive_ui" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_ui")
+
+instance HasCField.HasCField Primitive "primitive_ui" where
+
+  type CFieldType Primitive "primitive_ui" = BG.CUInt
+
+  offset# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @l@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 21:10@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "primitive_l" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_l = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_l" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "primitive_l" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_l")
+
+instance HasCField.HasCField Primitive "primitive_l" where
+
+  type CFieldType Primitive "primitive_l" = BG.CLong
+
+  offset# = \_ -> \_ -> 40
+
+{-| __C declaration:__ @li@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 22:14@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "primitive_li" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_li = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_li" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "primitive_li" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_li")
+
+instance HasCField.HasCField Primitive "primitive_li" where
+
+  type CFieldType Primitive "primitive_li" = BG.CLong
+
+  offset# = \_ -> \_ -> 48
+
+{-| __C declaration:__ @sl@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 23:17@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "primitive_sl" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_sl = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_sl" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "primitive_sl" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_sl")
+
+instance HasCField.HasCField Primitive "primitive_sl" where
+
+  type CFieldType Primitive "primitive_sl" = BG.CLong
+
+  offset# = \_ -> \_ -> 56
+
+{-| __C declaration:__ @sli@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 24:21@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "primitive_sli" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_sli = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_sli" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "primitive_sli" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_sli")
+
+instance HasCField.HasCField Primitive "primitive_sli" where
+
+  type CFieldType Primitive "primitive_sli" = BG.CLong
+
+  offset# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @ul@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 26:19@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CULong
+         ) => BG.CompatHasField.HasField "primitive_ul" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_ul = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_ul" x0
+      )
+
+instance ( ty ~ BG.CULong
+         ) => BG.HasField "primitive_ul" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_ul")
+
+instance HasCField.HasCField Primitive "primitive_ul" where
+
+  type CFieldType Primitive "primitive_ul" = BG.CULong
+
+  offset# = \_ -> \_ -> 72
+
+{-| __C declaration:__ @uli@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 27:23@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CULong
+         ) => BG.CompatHasField.HasField "primitive_uli" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_uli = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_uli" x0
+      )
+
+instance ( ty ~ BG.CULong
+         ) => BG.HasField "primitive_uli" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_uli")
+
+instance HasCField.HasCField Primitive "primitive_uli" where
+
+  type CFieldType Primitive "primitive_uli" = BG.CULong
+
+  offset# = \_ -> \_ -> 80
+
+{-| __C declaration:__ @ll@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 29:15@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "primitive_ll" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_ll = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_ll" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "primitive_ll" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_ll")
+
+instance HasCField.HasCField Primitive "primitive_ll" where
+
+  type CFieldType Primitive "primitive_ll" = BG.CLLong
+
+  offset# = \_ -> \_ -> 88
+
+{-| __C declaration:__ @lli@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 30:19@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "primitive_lli" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_lli = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_lli" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "primitive_lli" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_lli")
+
+instance HasCField.HasCField Primitive "primitive_lli" where
+
+  type CFieldType Primitive "primitive_lli" = BG.CLLong
+
+  offset# = \_ -> \_ -> 96
+
+{-| __C declaration:__ @sll@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 31:22@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "primitive_sll" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_sll = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_sll" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "primitive_sll" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_sll")
+
+instance HasCField.HasCField Primitive "primitive_sll" where
+
+  type CFieldType Primitive "primitive_sll" = BG.CLLong
+
+  offset# = \_ -> \_ -> 104
+
+{-| __C declaration:__ @slli@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 32:26@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "primitive_slli" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_slli = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_slli" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "primitive_slli" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_slli")
+
+instance HasCField.HasCField Primitive "primitive_slli" where
+
+  type CFieldType Primitive "primitive_slli" =
+    BG.CLLong
+
+  offset# = \_ -> \_ -> 112
+
+{-| __C declaration:__ @ull@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 34:24@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CULLong
+         ) => BG.CompatHasField.HasField "primitive_ull" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_ull = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_ull" x0
+      )
+
+instance ( ty ~ BG.CULLong
+         ) => BG.HasField "primitive_ull" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_ull")
+
+instance HasCField.HasCField Primitive "primitive_ull" where
+
+  type CFieldType Primitive "primitive_ull" =
+    BG.CULLong
+
+  offset# = \_ -> \_ -> 120
+
+{-| __C declaration:__ @ulli@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 35:28@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CULLong
+         ) => BG.CompatHasField.HasField "primitive_ulli" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_ulli = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_ulli" x0
+      )
+
+instance ( ty ~ BG.CULLong
+         ) => BG.HasField "primitive_ulli" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_ulli")
+
+instance HasCField.HasCField Primitive "primitive_ulli" where
+
+  type CFieldType Primitive "primitive_ulli" =
+    BG.CULLong
+
+  offset# = \_ -> \_ -> 128
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 37:11@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CFloat
+         ) => BG.CompatHasField.HasField "primitive_f" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_f = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_d = BG.getField @"primitive_d" x0
+                    }
+      , BG.getField @"primitive_f" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "primitive_f" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_f")
+
+instance HasCField.HasCField Primitive "primitive_f" where
+
+  type CFieldType Primitive "primitive_f" = BG.CFloat
+
+  offset# = \_ -> \_ -> 136
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 38:12@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "primitive_d" Primitive ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Primitive { primitive_d = y1
+                    , primitive_c = BG.getField @"primitive_c" x0
+                    , primitive_sc = BG.getField @"primitive_sc" x0
+                    , primitive_uc = BG.getField @"primitive_uc" x0
+                    , primitive_s = BG.getField @"primitive_s" x0
+                    , primitive_si = BG.getField @"primitive_si" x0
+                    , primitive_ss = BG.getField @"primitive_ss" x0
+                    , primitive_ssi = BG.getField @"primitive_ssi" x0
+                    , primitive_us = BG.getField @"primitive_us" x0
+                    , primitive_usi = BG.getField @"primitive_usi" x0
+                    , primitive_i = BG.getField @"primitive_i" x0
+                    , primitive_s2 = BG.getField @"primitive_s2" x0
+                    , primitive_si2 = BG.getField @"primitive_si2" x0
+                    , primitive_u = BG.getField @"primitive_u" x0
+                    , primitive_ui = BG.getField @"primitive_ui" x0
+                    , primitive_l = BG.getField @"primitive_l" x0
+                    , primitive_li = BG.getField @"primitive_li" x0
+                    , primitive_sl = BG.getField @"primitive_sl" x0
+                    , primitive_sli = BG.getField @"primitive_sli" x0
+                    , primitive_ul = BG.getField @"primitive_ul" x0
+                    , primitive_uli = BG.getField @"primitive_uli" x0
+                    , primitive_ll = BG.getField @"primitive_ll" x0
+                    , primitive_lli = BG.getField @"primitive_lli" x0
+                    , primitive_sll = BG.getField @"primitive_sll" x0
+                    , primitive_slli = BG.getField @"primitive_slli" x0
+                    , primitive_ull = BG.getField @"primitive_ull" x0
+                    , primitive_ulli = BG.getField @"primitive_ulli" x0
+                    , primitive_f = BG.getField @"primitive_f" x0
+                    }
+      , BG.getField @"primitive_d" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "primitive_d" (BG.Ptr Primitive) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"primitive_d")
+
+instance HasCField.HasCField Primitive "primitive_d" where
+
+  type CFieldType Primitive "primitive_d" = BG.CDouble
+
+  offset# = \_ -> \_ -> 144
diff --git a/test-artefacts/fixtures/types/primitives/primitive_types/bindingspec.yaml b/test-artefacts/fixtures/types/primitives/primitive_types/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/primitive_types/bindingspec.yaml
@@ -0,0 +1,55 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/primitives/primitive_types.h
+  cname: struct primitive
+  hsname: Primitive
+hstypes:
+- hsname: Primitive
+  representation:
+    record:
+      constructor: Primitive
+      fields:
+      - primitive_c
+      - primitive_sc
+      - primitive_uc
+      - primitive_s
+      - primitive_si
+      - primitive_ss
+      - primitive_ssi
+      - primitive_us
+      - primitive_usi
+      - primitive_i
+      - primitive_s2
+      - primitive_si2
+      - primitive_u
+      - primitive_ui
+      - primitive_l
+      - primitive_li
+      - primitive_sl
+      - primitive_sli
+      - primitive_ul
+      - primitive_uli
+      - primitive_ll
+      - primitive_lli
+      - primitive_sll
+      - primitive_slli
+      - primitive_ull
+      - primitive_ulli
+      - primitive_f
+      - primitive_d
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/primitives/primitive_types/th.txt b/test-artefacts/fixtures/types/primitives/primitive_types/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/primitives/primitive_types/th.txt
@@ -0,0 +1,1250 @@
+-- addDependentFile test-artefacts/headers/golden/types/primitives/primitive_types.h
+{-| __C declaration:__ @struct primitive@
+
+    __defined at:__ @types\/primitives\/primitive_types.h 1:8@
+
+    __exported by:__ @types\/primitives\/primitive_types.h@
+-}
+data Primitive
+    = Primitive {primitive_c :: CChar
+                 {- ^ __C declaration:__ @c@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 2:10@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_sc :: CSChar
+                 {- ^ __C declaration:__ @sc@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 3:17@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_uc :: CUChar
+                 {- ^ __C declaration:__ @uc@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 4:19@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_s :: CShort
+                 {- ^ __C declaration:__ @s@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 6:11@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_si :: CShort
+                 {- ^ __C declaration:__ @si@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 7:15@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_ss :: CShort
+                 {- ^ __C declaration:__ @ss@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 8:18@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_ssi :: CShort
+                 {- ^ __C declaration:__ @ssi@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 9:22@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_us :: CUShort
+                 {- ^ __C declaration:__ @us@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 11:20@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_usi :: CUShort
+                 {- ^ __C declaration:__ @usi@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 12:24@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_i :: CInt
+                 {- ^ __C declaration:__ @i@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 14:9@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_s2 :: CInt
+                 {- ^ __C declaration:__ @s2@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 15:12@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_si2 :: CInt
+                 {- ^ __C declaration:__ @si2@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 16:16@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_u :: CUInt
+                 {- ^ __C declaration:__ @u@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 18:14@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_ui :: CUInt
+                 {- ^ __C declaration:__ @ui@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 19:18@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_l :: CLong
+                 {- ^ __C declaration:__ @l@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 21:10@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_li :: CLong
+                 {- ^ __C declaration:__ @li@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 22:14@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_sl :: CLong
+                 {- ^ __C declaration:__ @sl@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 23:17@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_sli :: CLong
+                 {- ^ __C declaration:__ @sli@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 24:21@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_ul :: CULong
+                 {- ^ __C declaration:__ @ul@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 26:19@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_uli :: CULong
+                 {- ^ __C declaration:__ @uli@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 27:23@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_ll :: CLLong
+                 {- ^ __C declaration:__ @ll@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 29:15@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_lli :: CLLong
+                 {- ^ __C declaration:__ @lli@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 30:19@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_sll :: CLLong
+                 {- ^ __C declaration:__ @sll@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 31:22@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_slli :: CLLong
+                 {- ^ __C declaration:__ @slli@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 32:26@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_ull :: CULLong
+                 {- ^ __C declaration:__ @ull@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 34:24@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_ulli :: CULLong
+                 {- ^ __C declaration:__ @ulli@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 35:28@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_f :: CFloat
+                 {- ^ __C declaration:__ @f@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 37:11@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -},
+                 primitive_d :: CDouble
+                 {- ^ __C declaration:__ @d@
+
+                      __defined at:__ @types\/primitives\/primitive_types.h 38:12@
+
+                      __exported by:__ @types\/primitives\/primitive_types.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Primitive
+    where staticSizeOf = \_ -> 152 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Primitive
+    where readRaw = \ptr_0 -> (((((((((((((((((((((((((((pure Primitive <*> readRaw (Proxy @"primitive_c") ptr_0) <*> readRaw (Proxy @"primitive_sc") ptr_0) <*> readRaw (Proxy @"primitive_uc") ptr_0) <*> readRaw (Proxy @"primitive_s") ptr_0) <*> readRaw (Proxy @"primitive_si") ptr_0) <*> readRaw (Proxy @"primitive_ss") ptr_0) <*> readRaw (Proxy @"primitive_ssi") ptr_0) <*> readRaw (Proxy @"primitive_us") ptr_0) <*> readRaw (Proxy @"primitive_usi") ptr_0) <*> readRaw (Proxy @"primitive_i") ptr_0) <*> readRaw (Proxy @"primitive_s2") ptr_0) <*> readRaw (Proxy @"primitive_si2") ptr_0) <*> readRaw (Proxy @"primitive_u") ptr_0) <*> readRaw (Proxy @"primitive_ui") ptr_0) <*> readRaw (Proxy @"primitive_l") ptr_0) <*> readRaw (Proxy @"primitive_li") ptr_0) <*> readRaw (Proxy @"primitive_sl") ptr_0) <*> readRaw (Proxy @"primitive_sli") ptr_0) <*> readRaw (Proxy @"primitive_ul") ptr_0) <*> readRaw (Proxy @"primitive_uli") ptr_0) <*> readRaw (Proxy @"primitive_ll") ptr_0) <*> readRaw (Proxy @"primitive_lli") ptr_0) <*> readRaw (Proxy @"primitive_sll") ptr_0) <*> readRaw (Proxy @"primitive_slli") ptr_0) <*> readRaw (Proxy @"primitive_ull") ptr_0) <*> readRaw (Proxy @"primitive_ulli") ptr_0) <*> readRaw (Proxy @"primitive_f") ptr_0) <*> readRaw (Proxy @"primitive_d") ptr_0
+instance WriteRaw Primitive
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Primitive primitive_c_2
+                                                 primitive_sc_3
+                                                 primitive_uc_4
+                                                 primitive_s_5
+                                                 primitive_si_6
+                                                 primitive_ss_7
+                                                 primitive_ssi_8
+                                                 primitive_us_9
+                                                 primitive_usi_10
+                                                 primitive_i_11
+                                                 primitive_s2_12
+                                                 primitive_si2_13
+                                                 primitive_u_14
+                                                 primitive_ui_15
+                                                 primitive_l_16
+                                                 primitive_li_17
+                                                 primitive_sl_18
+                                                 primitive_sli_19
+                                                 primitive_ul_20
+                                                 primitive_uli_21
+                                                 primitive_ll_22
+                                                 primitive_lli_23
+                                                 primitive_sll_24
+                                                 primitive_slli_25
+                                                 primitive_ull_26
+                                                 primitive_ulli_27
+                                                 primitive_f_28
+                                                 primitive_d_29 -> writeRaw (Proxy @"primitive_c") ptr_0 primitive_c_2 >> (writeRaw (Proxy @"primitive_sc") ptr_0 primitive_sc_3 >> (writeRaw (Proxy @"primitive_uc") ptr_0 primitive_uc_4 >> (writeRaw (Proxy @"primitive_s") ptr_0 primitive_s_5 >> (writeRaw (Proxy @"primitive_si") ptr_0 primitive_si_6 >> (writeRaw (Proxy @"primitive_ss") ptr_0 primitive_ss_7 >> (writeRaw (Proxy @"primitive_ssi") ptr_0 primitive_ssi_8 >> (writeRaw (Proxy @"primitive_us") ptr_0 primitive_us_9 >> (writeRaw (Proxy @"primitive_usi") ptr_0 primitive_usi_10 >> (writeRaw (Proxy @"primitive_i") ptr_0 primitive_i_11 >> (writeRaw (Proxy @"primitive_s2") ptr_0 primitive_s2_12 >> (writeRaw (Proxy @"primitive_si2") ptr_0 primitive_si2_13 >> (writeRaw (Proxy @"primitive_u") ptr_0 primitive_u_14 >> (writeRaw (Proxy @"primitive_ui") ptr_0 primitive_ui_15 >> (writeRaw (Proxy @"primitive_l") ptr_0 primitive_l_16 >> (writeRaw (Proxy @"primitive_li") ptr_0 primitive_li_17 >> (writeRaw (Proxy @"primitive_sl") ptr_0 primitive_sl_18 >> (writeRaw (Proxy @"primitive_sli") ptr_0 primitive_sli_19 >> (writeRaw (Proxy @"primitive_ul") ptr_0 primitive_ul_20 >> (writeRaw (Proxy @"primitive_uli") ptr_0 primitive_uli_21 >> (writeRaw (Proxy @"primitive_ll") ptr_0 primitive_ll_22 >> (writeRaw (Proxy @"primitive_lli") ptr_0 primitive_lli_23 >> (writeRaw (Proxy @"primitive_sll") ptr_0 primitive_sll_24 >> (writeRaw (Proxy @"primitive_slli") ptr_0 primitive_slli_25 >> (writeRaw (Proxy @"primitive_ull") ptr_0 primitive_ull_26 >> (writeRaw (Proxy @"primitive_ulli") ptr_0 primitive_ulli_27 >> (writeRaw (Proxy @"primitive_f") ptr_0 primitive_f_28 >> writeRaw (Proxy @"primitive_d") ptr_0 primitive_d_29))))))))))))))))))))))))))
+deriving via (EquivStorable Primitive) instance Storable Primitive
+deriving via (IsStructViaReadRaw Primitive) instance IsStruct Primitive
+instance (~) ty CChar => HasField "primitive_c" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_c = y_1,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_c" x_0)
+instance (~) ty CChar =>
+         HasField "primitive_c" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_c")
+instance HasCField Primitive "primitive_c"
+    where type CFieldType Primitive "primitive_c" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CSChar => HasField "primitive_sc" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_sc = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_sc" x_0)
+instance (~) ty CSChar =>
+         HasField "primitive_sc" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_sc")
+instance HasCField Primitive "primitive_sc"
+    where type CFieldType Primitive "primitive_sc" = CSChar
+          offset# = \_ -> \_ -> 1
+instance (~) ty CUChar => HasField "primitive_uc" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_uc = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_uc" x_0)
+instance (~) ty CUChar =>
+         HasField "primitive_uc" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_uc")
+instance HasCField Primitive "primitive_uc"
+    where type CFieldType Primitive "primitive_uc" = CUChar
+          offset# = \_ -> \_ -> 2
+instance (~) ty CShort => HasField "primitive_s" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_s = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_s" x_0)
+instance (~) ty CShort =>
+         HasField "primitive_s" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_s")
+instance HasCField Primitive "primitive_s"
+    where type CFieldType Primitive "primitive_s" = CShort
+          offset# = \_ -> \_ -> 4
+instance (~) ty CShort => HasField "primitive_si" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_si = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_si" x_0)
+instance (~) ty CShort =>
+         HasField "primitive_si" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_si")
+instance HasCField Primitive "primitive_si"
+    where type CFieldType Primitive "primitive_si" = CShort
+          offset# = \_ -> \_ -> 6
+instance (~) ty CShort => HasField "primitive_ss" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_ss = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_ss" x_0)
+instance (~) ty CShort =>
+         HasField "primitive_ss" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_ss")
+instance HasCField Primitive "primitive_ss"
+    where type CFieldType Primitive "primitive_ss" = CShort
+          offset# = \_ -> \_ -> 8
+instance (~) ty CShort => HasField "primitive_ssi" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_ssi = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_ssi" x_0)
+instance (~) ty CShort =>
+         HasField "primitive_ssi" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_ssi")
+instance HasCField Primitive "primitive_ssi"
+    where type CFieldType Primitive "primitive_ssi" = CShort
+          offset# = \_ -> \_ -> 10
+instance (~) ty CUShort => HasField "primitive_us" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_us = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_us" x_0)
+instance (~) ty CUShort =>
+         HasField "primitive_us" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_us")
+instance HasCField Primitive "primitive_us"
+    where type CFieldType Primitive "primitive_us" = CUShort
+          offset# = \_ -> \_ -> 12
+instance (~) ty CUShort => HasField "primitive_usi" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_usi = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_usi" x_0)
+instance (~) ty CUShort =>
+         HasField "primitive_usi" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_usi")
+instance HasCField Primitive "primitive_usi"
+    where type CFieldType Primitive "primitive_usi" = CUShort
+          offset# = \_ -> \_ -> 14
+instance (~) ty CInt => HasField "primitive_i" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_i = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_i" x_0)
+instance (~) ty CInt =>
+         HasField "primitive_i" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_i")
+instance HasCField Primitive "primitive_i"
+    where type CFieldType Primitive "primitive_i" = CInt
+          offset# = \_ -> \_ -> 16
+instance (~) ty CInt => HasField "primitive_s2" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_s2 = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_s2" x_0)
+instance (~) ty CInt =>
+         HasField "primitive_s2" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_s2")
+instance HasCField Primitive "primitive_s2"
+    where type CFieldType Primitive "primitive_s2" = CInt
+          offset# = \_ -> \_ -> 20
+instance (~) ty CInt => HasField "primitive_si2" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_si2 = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_si2" x_0)
+instance (~) ty CInt =>
+         HasField "primitive_si2" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_si2")
+instance HasCField Primitive "primitive_si2"
+    where type CFieldType Primitive "primitive_si2" = CInt
+          offset# = \_ -> \_ -> 24
+instance (~) ty CUInt => HasField "primitive_u" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_u = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_u" x_0)
+instance (~) ty CUInt =>
+         HasField "primitive_u" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_u")
+instance HasCField Primitive "primitive_u"
+    where type CFieldType Primitive "primitive_u" = CUInt
+          offset# = \_ -> \_ -> 28
+instance (~) ty CUInt => HasField "primitive_ui" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_ui = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_ui" x_0)
+instance (~) ty CUInt =>
+         HasField "primitive_ui" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_ui")
+instance HasCField Primitive "primitive_ui"
+    where type CFieldType Primitive "primitive_ui" = CUInt
+          offset# = \_ -> \_ -> 32
+instance (~) ty CLong => HasField "primitive_l" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_l = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_l" x_0)
+instance (~) ty CLong =>
+         HasField "primitive_l" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_l")
+instance HasCField Primitive "primitive_l"
+    where type CFieldType Primitive "primitive_l" = CLong
+          offset# = \_ -> \_ -> 40
+instance (~) ty CLong => HasField "primitive_li" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_li = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_li" x_0)
+instance (~) ty CLong =>
+         HasField "primitive_li" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_li")
+instance HasCField Primitive "primitive_li"
+    where type CFieldType Primitive "primitive_li" = CLong
+          offset# = \_ -> \_ -> 48
+instance (~) ty CLong => HasField "primitive_sl" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_sl = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_sl" x_0)
+instance (~) ty CLong =>
+         HasField "primitive_sl" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_sl")
+instance HasCField Primitive "primitive_sl"
+    where type CFieldType Primitive "primitive_sl" = CLong
+          offset# = \_ -> \_ -> 56
+instance (~) ty CLong => HasField "primitive_sli" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_sli = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_sli" x_0)
+instance (~) ty CLong =>
+         HasField "primitive_sli" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_sli")
+instance HasCField Primitive "primitive_sli"
+    where type CFieldType Primitive "primitive_sli" = CLong
+          offset# = \_ -> \_ -> 64
+instance (~) ty CULong => HasField "primitive_ul" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_ul = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_ul" x_0)
+instance (~) ty CULong =>
+         HasField "primitive_ul" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_ul")
+instance HasCField Primitive "primitive_ul"
+    where type CFieldType Primitive "primitive_ul" = CULong
+          offset# = \_ -> \_ -> 72
+instance (~) ty CULong => HasField "primitive_uli" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_uli = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_uli" x_0)
+instance (~) ty CULong =>
+         HasField "primitive_uli" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_uli")
+instance HasCField Primitive "primitive_uli"
+    where type CFieldType Primitive "primitive_uli" = CULong
+          offset# = \_ -> \_ -> 80
+instance (~) ty CLLong => HasField "primitive_ll" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_ll = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_ll" x_0)
+instance (~) ty CLLong =>
+         HasField "primitive_ll" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_ll")
+instance HasCField Primitive "primitive_ll"
+    where type CFieldType Primitive "primitive_ll" = CLLong
+          offset# = \_ -> \_ -> 88
+instance (~) ty CLLong => HasField "primitive_lli" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_lli = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_lli" x_0)
+instance (~) ty CLLong =>
+         HasField "primitive_lli" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_lli")
+instance HasCField Primitive "primitive_lli"
+    where type CFieldType Primitive "primitive_lli" = CLLong
+          offset# = \_ -> \_ -> 96
+instance (~) ty CLLong => HasField "primitive_sll" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_sll = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_sll" x_0)
+instance (~) ty CLLong =>
+         HasField "primitive_sll" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_sll")
+instance HasCField Primitive "primitive_sll"
+    where type CFieldType Primitive "primitive_sll" = CLLong
+          offset# = \_ -> \_ -> 104
+instance (~) ty CLLong => HasField "primitive_slli" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_slli = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_slli" x_0)
+instance (~) ty CLLong =>
+         HasField "primitive_slli" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_slli")
+instance HasCField Primitive "primitive_slli"
+    where type CFieldType Primitive "primitive_slli" = CLLong
+          offset# = \_ -> \_ -> 112
+instance (~) ty CULLong => HasField "primitive_ull" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_ull = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_ull" x_0)
+instance (~) ty CULLong =>
+         HasField "primitive_ull" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_ull")
+instance HasCField Primitive "primitive_ull"
+    where type CFieldType Primitive "primitive_ull" = CULLong
+          offset# = \_ -> \_ -> 120
+instance (~) ty CULLong => HasField "primitive_ulli" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_ulli = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_f = getField @"primitive_f" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_ulli" x_0)
+instance (~) ty CULLong =>
+         HasField "primitive_ulli" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_ulli")
+instance HasCField Primitive "primitive_ulli"
+    where type CFieldType Primitive "primitive_ulli" = CULLong
+          offset# = \_ -> \_ -> 128
+instance (~) ty CFloat => HasField "primitive_f" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_f = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_d = getField @"primitive_d" x_0},
+                              getField @"primitive_f" x_0)
+instance (~) ty CFloat =>
+         HasField "primitive_f" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_f")
+instance HasCField Primitive "primitive_f"
+    where type CFieldType Primitive "primitive_f" = CFloat
+          offset# = \_ -> \_ -> 136
+instance (~) ty CDouble => HasField "primitive_d" Primitive ty
+    where hasField = \x_0 -> (\y_1 -> Primitive{primitive_d = y_1,
+                                                primitive_c = getField @"primitive_c" x_0,
+                                                primitive_sc = getField @"primitive_sc" x_0,
+                                                primitive_uc = getField @"primitive_uc" x_0,
+                                                primitive_s = getField @"primitive_s" x_0,
+                                                primitive_si = getField @"primitive_si" x_0,
+                                                primitive_ss = getField @"primitive_ss" x_0,
+                                                primitive_ssi = getField @"primitive_ssi" x_0,
+                                                primitive_us = getField @"primitive_us" x_0,
+                                                primitive_usi = getField @"primitive_usi" x_0,
+                                                primitive_i = getField @"primitive_i" x_0,
+                                                primitive_s2 = getField @"primitive_s2" x_0,
+                                                primitive_si2 = getField @"primitive_si2" x_0,
+                                                primitive_u = getField @"primitive_u" x_0,
+                                                primitive_ui = getField @"primitive_ui" x_0,
+                                                primitive_l = getField @"primitive_l" x_0,
+                                                primitive_li = getField @"primitive_li" x_0,
+                                                primitive_sl = getField @"primitive_sl" x_0,
+                                                primitive_sli = getField @"primitive_sli" x_0,
+                                                primitive_ul = getField @"primitive_ul" x_0,
+                                                primitive_uli = getField @"primitive_uli" x_0,
+                                                primitive_ll = getField @"primitive_ll" x_0,
+                                                primitive_lli = getField @"primitive_lli" x_0,
+                                                primitive_sll = getField @"primitive_sll" x_0,
+                                                primitive_slli = getField @"primitive_slli" x_0,
+                                                primitive_ull = getField @"primitive_ull" x_0,
+                                                primitive_ulli = getField @"primitive_ulli" x_0,
+                                                primitive_f = getField @"primitive_f" x_0},
+                              getField @"primitive_d" x_0)
+instance (~) ty CDouble =>
+         HasField "primitive_d" (Ptr Primitive) (Ptr ty)
+    where getField = fromPtr (Proxy @"primitive_d")
+instance HasCField Primitive "primitive_d"
+    where type CFieldType Primitive "primitive_d" = CDouble
+          offset# = \_ -> \_ -> 144
diff --git a/test-artefacts/fixtures/types/qualifiers/const_typedefs/Example.hs b/test-artefacts/fixtures/types/qualifiers/const_typedefs/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/const_typedefs/Example.hs
@@ -0,0 +1,540 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.I(..)
+    , Example.S(..)
+    , Example.U(..)
+    , Example.E(..)
+    , pattern Example.Foo
+    , Example.TI(..)
+    , Example.TS(..)
+    , Example.TU(..)
+    , Example.TE(..)
+    , Example.TTI(..)
+    , Example.TTS(..)
+    , Example.TTU(..)
+    , Example.TTE(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.CEnum as CEnum
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @I@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 10:13@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype I = I
+  { unwrapI :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapI" I ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> I {unwrapI = y1}, BG.getField @"unwrapI" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapI" (BG.Ptr I) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapI")
+
+instance HasCField.HasCField I "unwrapI" where
+
+  type CFieldType I "unwrapI" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 11:8@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+data S = S
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw S where
+
+  readRaw = \ptr0 -> pure S
+
+instance Marshal.WriteRaw S where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S -> pure ()
+
+deriving via Marshal.EquivStorable S instance BG.Storable S
+
+deriving via Struct.IsStructViaReadRaw S instance Struct.IsStruct S
+
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 12:7@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype U = U
+  { unwrapU :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.StaticSize U
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.ReadRaw U
+
+deriving via BG.SizedByteArray 0 1 instance Marshal.WriteRaw U
+
+deriving via Marshal.EquivStorable U instance BG.Storable U
+
+deriving via BG.SizedByteArray 0 1 instance Union.IsUnion U
+
+{-| __C declaration:__ @enum E@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 13:6@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype E = E
+  { unwrapE :: BG.CUInt
+  }
+  deriving stock (Eq, BG.Generic, Ord)
+  deriving newtype (BG.HasFFIType)
+
+instance Marshal.StaticSize E where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw E where
+
+  readRaw =
+    \ptr0 ->
+          pure E
+      <*> Marshal.readRawByteOff ptr0 (0 :: Int)
+
+instance Marshal.WriteRaw E where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E unwrapE2 ->
+            Marshal.writeRawByteOff ptr0 (0 :: Int) unwrapE2
+
+deriving via Marshal.EquivStorable E instance BG.Storable E
+
+deriving via BG.CUInt instance BG.Prim E
+
+instance CEnum.CEnum E where
+
+  type CEnumZ E = BG.CUInt
+
+  toCEnum = E
+
+  fromCEnum = BG.getField @"unwrapE"
+
+  declaredValues =
+    \_ ->
+      CEnum.declaredValuesFromList [(0, BG.singleton "Foo")]
+
+  showsUndeclared = CEnum.showsWrappedUndeclared "E"
+
+  readPrecUndeclared =
+    CEnum.readPrecWrappedUndeclared "E"
+
+  isDeclared = CEnum.seqIsDeclared
+
+  mkDeclared = CEnum.seqMkDeclared
+
+instance CEnum.SequentialCEnum E where
+
+  minDeclaredValue = Foo
+
+  maxDeclaredValue = Foo
+
+instance Show E where
+
+  showsPrec = CEnum.shows
+
+instance Read E where
+
+  readPrec = CEnum.readPrec
+
+  readList = BG.readListDefault
+
+  readListPrec = BG.readListPrecDefault
+
+instance (ty ~ BG.CUInt) => BG.CompatHasField.HasField "unwrapE" E ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> E {unwrapE = y1}, BG.getField @"unwrapE" x0)
+
+instance (ty ~ BG.CUInt) => BG.HasField "unwrapE" (BG.Ptr E) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapE")
+
+instance HasCField.HasCField E "unwrapE" where
+
+  type CFieldType E "unwrapE" = BG.CUInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 13:9@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+pattern Foo :: E
+pattern Foo = E 0
+
+{-| __C declaration:__ @TI@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 20:17@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TI = TI
+  { unwrapTI :: I
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ I) => BG.CompatHasField.HasField "unwrapTI" TI ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TI {unwrapTI = y1}, BG.getField @"unwrapTI" x0)
+
+instance (ty ~ I) => BG.HasField "unwrapTI" (BG.Ptr TI) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTI")
+
+instance HasCField.HasCField TI "unwrapTI" where
+
+  type CFieldType TI "unwrapTI" = I
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @TS@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 21:24@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TS = TS
+  { unwrapTS :: S
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ S) => BG.CompatHasField.HasField "unwrapTS" TS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TS {unwrapTS = y1}, BG.getField @"unwrapTS" x0)
+
+instance (ty ~ S) => BG.HasField "unwrapTS" (BG.Ptr TS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTS")
+
+instance HasCField.HasCField TS "unwrapTS" where
+
+  type CFieldType TS "unwrapTS" = S
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @TU@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 22:23@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TU = TU
+  { unwrapTU :: U
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ U) => BG.CompatHasField.HasField "unwrapTU" TU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TU {unwrapTU = y1}, BG.getField @"unwrapTU" x0)
+
+instance (ty ~ U) => BG.HasField "unwrapTU" (BG.Ptr TU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTU")
+
+instance HasCField.HasCField TU "unwrapTU" where
+
+  type CFieldType TU "unwrapTU" = U
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @TE@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 23:22@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TE = TE
+  { unwrapTE :: E
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ E) => BG.CompatHasField.HasField "unwrapTE" TE ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TE {unwrapTE = y1}, BG.getField @"unwrapTE" x0)
+
+instance (ty ~ E) => BG.HasField "unwrapTE" (BG.Ptr TE) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTE")
+
+instance HasCField.HasCField TE "unwrapTE" where
+
+  type CFieldType TE "unwrapTE" = E
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @TTI@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 30:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TTI = TTI
+  { unwrapTTI :: TI
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ TI) => BG.CompatHasField.HasField "unwrapTTI" TTI ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TTI {unwrapTTI = y1}, BG.getField @"unwrapTTI" x0)
+
+instance (ty ~ TI) => BG.HasField "unwrapTTI" (BG.Ptr TTI) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTTI")
+
+instance HasCField.HasCField TTI "unwrapTTI" where
+
+  type CFieldType TTI "unwrapTTI" = TI
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @TTS@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 31:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TTS = TTS
+  { unwrapTTS :: TS
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ TS) => BG.CompatHasField.HasField "unwrapTTS" TTS ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TTS {unwrapTTS = y1}, BG.getField @"unwrapTTS" x0)
+
+instance (ty ~ TS) => BG.HasField "unwrapTTS" (BG.Ptr TTS) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTTS")
+
+instance HasCField.HasCField TTS "unwrapTTS" where
+
+  type CFieldType TTS "unwrapTTS" = TS
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @TTU@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 32:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TTU = TTU
+  { unwrapTTU :: TU
+  }
+  deriving stock (BG.Generic)
+  deriving newtype
+    ( Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ TU) => BG.CompatHasField.HasField "unwrapTTU" TTU ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TTU {unwrapTTU = y1}, BG.getField @"unwrapTTU" x0)
+
+instance (ty ~ TU) => BG.HasField "unwrapTTU" (BG.Ptr TTU) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTTU")
+
+instance HasCField.HasCField TTU "unwrapTTU" where
+
+  type CFieldType TTU "unwrapTTU" = TU
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @TTE@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 33:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TTE = TTE
+  { unwrapTTE :: TE
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ TE) => BG.CompatHasField.HasField "unwrapTTE" TTE ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         TTE {unwrapTTE = y1}, BG.getField @"unwrapTTE" x0)
+
+instance (ty ~ TE) => BG.HasField "unwrapTTE" (BG.Ptr TTE) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapTTE")
+
+instance HasCField.HasCField TTE "unwrapTTE" where
+
+  type CFieldType TTE "unwrapTTE" = TE
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/qualifiers/const_typedefs/Example/Global.hs b/test-artefacts/fixtures/types/qualifiers/const_typedefs/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/const_typedefs/Example/Global.hs
@@ -0,0 +1,426 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.i
+    , Example.Global.s
+    , Example.Global.u
+    , Example.Global.e
+    , Example.Global.ti
+    , Example.Global.ts
+    , Example.Global.tu
+    , Example.Global.te
+    , Example.Global.tti
+    , Example.Global.tts
+    , Example.Global.ttu
+    , Example.Global.tte
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/qualifiers/const_typedefs.h>"
+  , "/* test_typesqualifiersconst_typedef_Example_get_i */"
+  , "__attribute__ ((const))"
+  , "I const *hs_bindgen_bb40525ba9109d7a (void)"
+  , "{"
+  , "  return &i;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_s */"
+  , "__attribute__ ((const))"
+  , "struct S const *hs_bindgen_e02c667254de325e (void)"
+  , "{"
+  , "  return &s;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_u */"
+  , "__attribute__ ((const))"
+  , "union U const *hs_bindgen_db442d4a677f346c (void)"
+  , "{"
+  , "  return &u;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_e */"
+  , "__attribute__ ((const))"
+  , "enum E const *hs_bindgen_f8e0ac7d2c94db95 (void)"
+  , "{"
+  , "  return &e;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_ti */"
+  , "__attribute__ ((const))"
+  , "TI *hs_bindgen_da8e11a66011da3a (void)"
+  , "{"
+  , "  return &ti;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_ts */"
+  , "__attribute__ ((const))"
+  , "TS *hs_bindgen_10a3457a0f6b2036 (void)"
+  , "{"
+  , "  return &ts;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_tu */"
+  , "__attribute__ ((const))"
+  , "TU *hs_bindgen_ded2bbcd5f7b0513 (void)"
+  , "{"
+  , "  return &tu;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_te */"
+  , "__attribute__ ((const))"
+  , "TE *hs_bindgen_1b4b0fa82bacf9cc (void)"
+  , "{"
+  , "  return &te;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_tti */"
+  , "__attribute__ ((const))"
+  , "TTI *hs_bindgen_b8067bbfe8dc188e (void)"
+  , "{"
+  , "  return &tti;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_tts */"
+  , "__attribute__ ((const))"
+  , "TTS *hs_bindgen_6ce6ca09ed64a420 (void)"
+  , "{"
+  , "  return &tts;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_ttu */"
+  , "__attribute__ ((const))"
+  , "TTU *hs_bindgen_5d4569e6c5a642c0 (void)"
+  , "{"
+  , "  return &ttu;"
+  , "}"
+  , "/* test_typesqualifiersconst_typedef_Example_get_tte */"
+  , "__attribute__ ((const))"
+  , "TTE *hs_bindgen_cb44d6db796abc21 (void)"
+  , "{"
+  , "  return &tte;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_i@
+foreign import ccall unsafe "hs_bindgen_bb40525ba9109d7a" hs_bindgen_bb40525ba9109d7a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_i@
+hs_bindgen_bb40525ba9109d7a :: IO (PtrConst.PtrConst I)
+hs_bindgen_bb40525ba9109d7a =
+  fmap BG.fromFFIType hs_bindgen_bb40525ba9109d7a_base
+
+{-# NOINLINE hs_bindgen_8bf2d89ca41997fb #-}
+{-| __C declaration:__ @i@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 15:16@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_i@
+-}
+hs_bindgen_8bf2d89ca41997fb :: PtrConst.PtrConst I
+hs_bindgen_8bf2d89ca41997fb =
+  BG.unsafePerformIO hs_bindgen_bb40525ba9109d7a
+
+{-# NOINLINE i #-}
+i :: I
+i =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_8bf2d89ca41997fb)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_s@
+foreign import ccall unsafe "hs_bindgen_e02c667254de325e" hs_bindgen_e02c667254de325e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_s@
+hs_bindgen_e02c667254de325e :: IO (PtrConst.PtrConst S)
+hs_bindgen_e02c667254de325e =
+  fmap BG.fromFFIType hs_bindgen_e02c667254de325e_base
+
+{-# NOINLINE hs_bindgen_0e876abf0fe9e3b2 #-}
+{-| __C declaration:__ @s@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 16:23@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_s@
+-}
+hs_bindgen_0e876abf0fe9e3b2 :: PtrConst.PtrConst S
+hs_bindgen_0e876abf0fe9e3b2 =
+  BG.unsafePerformIO hs_bindgen_e02c667254de325e
+
+{-# NOINLINE s #-}
+s :: S
+s =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_0e876abf0fe9e3b2)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_u@
+foreign import ccall unsafe "hs_bindgen_db442d4a677f346c" hs_bindgen_db442d4a677f346c_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_u@
+hs_bindgen_db442d4a677f346c :: IO (PtrConst.PtrConst U)
+hs_bindgen_db442d4a677f346c =
+  fmap BG.fromFFIType hs_bindgen_db442d4a677f346c_base
+
+{-# NOINLINE hs_bindgen_b7bdf87ddb6b9a5b #-}
+{-| __C declaration:__ @u@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 17:22@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_u@
+-}
+hs_bindgen_b7bdf87ddb6b9a5b :: PtrConst.PtrConst U
+hs_bindgen_b7bdf87ddb6b9a5b =
+  BG.unsafePerformIO hs_bindgen_db442d4a677f346c
+
+{-# NOINLINE u #-}
+u :: U
+u =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_b7bdf87ddb6b9a5b)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_e@
+foreign import ccall unsafe "hs_bindgen_f8e0ac7d2c94db95" hs_bindgen_f8e0ac7d2c94db95_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_e@
+hs_bindgen_f8e0ac7d2c94db95 :: IO (PtrConst.PtrConst E)
+hs_bindgen_f8e0ac7d2c94db95 =
+  fmap BG.fromFFIType hs_bindgen_f8e0ac7d2c94db95_base
+
+{-# NOINLINE hs_bindgen_fa2424d094d91a33 #-}
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 18:21@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_e@
+-}
+hs_bindgen_fa2424d094d91a33 :: PtrConst.PtrConst E
+hs_bindgen_fa2424d094d91a33 =
+  BG.unsafePerformIO hs_bindgen_f8e0ac7d2c94db95
+
+{-# NOINLINE e #-}
+e :: E
+e =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_fa2424d094d91a33)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ti@
+foreign import ccall unsafe "hs_bindgen_da8e11a66011da3a" hs_bindgen_da8e11a66011da3a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ti@
+hs_bindgen_da8e11a66011da3a :: IO (PtrConst.PtrConst TI)
+hs_bindgen_da8e11a66011da3a =
+  fmap BG.fromFFIType hs_bindgen_da8e11a66011da3a_base
+
+{-# NOINLINE hs_bindgen_d7dd4362406f73a6 #-}
+{-| __C declaration:__ @ti@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 25:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_ti@
+-}
+hs_bindgen_d7dd4362406f73a6 :: PtrConst.PtrConst TI
+hs_bindgen_d7dd4362406f73a6 =
+  BG.unsafePerformIO hs_bindgen_da8e11a66011da3a
+
+{-# NOINLINE ti #-}
+ti :: TI
+ti =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_d7dd4362406f73a6)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ts@
+foreign import ccall unsafe "hs_bindgen_10a3457a0f6b2036" hs_bindgen_10a3457a0f6b2036_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ts@
+hs_bindgen_10a3457a0f6b2036 :: IO (PtrConst.PtrConst TS)
+hs_bindgen_10a3457a0f6b2036 =
+  fmap BG.fromFFIType hs_bindgen_10a3457a0f6b2036_base
+
+{-# NOINLINE hs_bindgen_cd3e2d14ae82b6fc #-}
+{-| __C declaration:__ @ts@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 26:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_ts@
+-}
+hs_bindgen_cd3e2d14ae82b6fc :: PtrConst.PtrConst TS
+hs_bindgen_cd3e2d14ae82b6fc =
+  BG.unsafePerformIO hs_bindgen_10a3457a0f6b2036
+
+{-# NOINLINE ts #-}
+ts :: TS
+ts =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_cd3e2d14ae82b6fc)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tu@
+foreign import ccall unsafe "hs_bindgen_ded2bbcd5f7b0513" hs_bindgen_ded2bbcd5f7b0513_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tu@
+hs_bindgen_ded2bbcd5f7b0513 :: IO (PtrConst.PtrConst TU)
+hs_bindgen_ded2bbcd5f7b0513 =
+  fmap BG.fromFFIType hs_bindgen_ded2bbcd5f7b0513_base
+
+{-# NOINLINE hs_bindgen_2d9684fc851b0766 #-}
+{-| __C declaration:__ @tu@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 27:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tu@
+-}
+hs_bindgen_2d9684fc851b0766 :: PtrConst.PtrConst TU
+hs_bindgen_2d9684fc851b0766 =
+  BG.unsafePerformIO hs_bindgen_ded2bbcd5f7b0513
+
+{-# NOINLINE tu #-}
+tu :: TU
+tu =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_2d9684fc851b0766)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_te@
+foreign import ccall unsafe "hs_bindgen_1b4b0fa82bacf9cc" hs_bindgen_1b4b0fa82bacf9cc_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_te@
+hs_bindgen_1b4b0fa82bacf9cc :: IO (PtrConst.PtrConst TE)
+hs_bindgen_1b4b0fa82bacf9cc =
+  fmap BG.fromFFIType hs_bindgen_1b4b0fa82bacf9cc_base
+
+{-# NOINLINE hs_bindgen_200eaed7c3fb420d #-}
+{-| __C declaration:__ @te@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 28:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_te@
+-}
+hs_bindgen_200eaed7c3fb420d :: PtrConst.PtrConst TE
+hs_bindgen_200eaed7c3fb420d =
+  BG.unsafePerformIO hs_bindgen_1b4b0fa82bacf9cc
+
+{-# NOINLINE te #-}
+te :: TE
+te =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_200eaed7c3fb420d)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tti@
+foreign import ccall unsafe "hs_bindgen_b8067bbfe8dc188e" hs_bindgen_b8067bbfe8dc188e_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tti@
+hs_bindgen_b8067bbfe8dc188e :: IO (PtrConst.PtrConst TTI)
+hs_bindgen_b8067bbfe8dc188e =
+  fmap BG.fromFFIType hs_bindgen_b8067bbfe8dc188e_base
+
+{-# NOINLINE hs_bindgen_1fbea465b2793d07 #-}
+{-| __C declaration:__ @tti@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 35:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tti@
+-}
+hs_bindgen_1fbea465b2793d07 :: PtrConst.PtrConst TTI
+hs_bindgen_1fbea465b2793d07 =
+  BG.unsafePerformIO hs_bindgen_b8067bbfe8dc188e
+
+{-# NOINLINE tti #-}
+tti :: TTI
+tti =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_1fbea465b2793d07)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tts@
+foreign import ccall unsafe "hs_bindgen_6ce6ca09ed64a420" hs_bindgen_6ce6ca09ed64a420_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tts@
+hs_bindgen_6ce6ca09ed64a420 :: IO (PtrConst.PtrConst TTS)
+hs_bindgen_6ce6ca09ed64a420 =
+  fmap BG.fromFFIType hs_bindgen_6ce6ca09ed64a420_base
+
+{-# NOINLINE hs_bindgen_f23f17df17b3fe36 #-}
+{-| __C declaration:__ @tts@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 36:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tts@
+-}
+hs_bindgen_f23f17df17b3fe36 :: PtrConst.PtrConst TTS
+hs_bindgen_f23f17df17b3fe36 =
+  BG.unsafePerformIO hs_bindgen_6ce6ca09ed64a420
+
+{-# NOINLINE tts #-}
+tts :: TTS
+tts =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_f23f17df17b3fe36)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ttu@
+foreign import ccall unsafe "hs_bindgen_5d4569e6c5a642c0" hs_bindgen_5d4569e6c5a642c0_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ttu@
+hs_bindgen_5d4569e6c5a642c0 :: IO (PtrConst.PtrConst TTU)
+hs_bindgen_5d4569e6c5a642c0 =
+  fmap BG.fromFFIType hs_bindgen_5d4569e6c5a642c0_base
+
+{-# NOINLINE hs_bindgen_45ab2258853f641d #-}
+{-| __C declaration:__ @ttu@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 37:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_ttu@
+-}
+hs_bindgen_45ab2258853f641d :: PtrConst.PtrConst TTU
+hs_bindgen_45ab2258853f641d =
+  BG.unsafePerformIO hs_bindgen_5d4569e6c5a642c0
+
+{-# NOINLINE ttu #-}
+ttu :: TTU
+ttu =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_45ab2258853f641d)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tte@
+foreign import ccall unsafe "hs_bindgen_cb44d6db796abc21" hs_bindgen_cb44d6db796abc21_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tte@
+hs_bindgen_cb44d6db796abc21 :: IO (PtrConst.PtrConst TTE)
+hs_bindgen_cb44d6db796abc21 =
+  fmap BG.fromFFIType hs_bindgen_cb44d6db796abc21_base
+
+{-# NOINLINE hs_bindgen_0956779e634e3dd5 #-}
+{-| __C declaration:__ @tte@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 38:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tte@
+-}
+hs_bindgen_0956779e634e3dd5 :: PtrConst.PtrConst TTE
+hs_bindgen_0956779e634e3dd5 =
+  BG.unsafePerformIO hs_bindgen_cb44d6db796abc21
+
+{-# NOINLINE tte #-}
+tte :: TTE
+tte =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_0956779e634e3dd5)
diff --git a/test-artefacts/fixtures/types/qualifiers/const_typedefs/bindingspec.yaml b/test-artefacts/fixtures/types/qualifiers/const_typedefs/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/const_typedefs/bindingspec.yaml
@@ -0,0 +1,317 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/qualifiers/const_typedefs.h
+  cname: I
+  hsname: I
+- headers: types/qualifiers/const_typedefs.h
+  cname: struct S
+  hsname: S
+- headers: types/qualifiers/const_typedefs.h
+  cname: union U
+  hsname: U
+- headers: types/qualifiers/const_typedefs.h
+  cname: enum E
+  hsname: E
+  enum: open
+- headers: types/qualifiers/const_typedefs.h
+  cname: TI
+  hsname: TI
+- headers: types/qualifiers/const_typedefs.h
+  cname: TS
+  hsname: TS
+- headers: types/qualifiers/const_typedefs.h
+  cname: TU
+  hsname: TU
+- headers: types/qualifiers/const_typedefs.h
+  cname: TE
+  hsname: TE
+- headers: types/qualifiers/const_typedefs.h
+  cname: TTI
+  hsname: TTI
+- headers: types/qualifiers/const_typedefs.h
+  cname: TTS
+  hsname: TTS
+- headers: types/qualifiers/const_typedefs.h
+  cname: TTU
+  hsname: TTU
+- headers: types/qualifiers/const_typedefs.h
+  cname: TTE
+  hsname: TTE
+hstypes:
+- hsname: E
+  representation:
+    newtype:
+      constructor: E
+      fields:
+      - unwrapE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - CEnum
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - SequentialCEnum
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: I
+  representation:
+    newtype:
+      constructor: I
+      fields:
+      - unwrapI
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S
+  representation:
+    record:
+      constructor: S
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TE
+  representation:
+    newtype:
+      constructor: TE
+      fields:
+      - unwrapTE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TI
+  representation:
+    newtype:
+      constructor: TI
+      fields:
+      - unwrapTI
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TS
+  representation:
+    newtype:
+      constructor: TS
+      fields:
+      - unwrapTS
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TTE
+  representation:
+    newtype:
+      constructor: TTE
+      fields:
+      - unwrapTTE
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CUInt
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TTI
+  representation:
+    newtype:
+      constructor: TTI
+      fields:
+      - unwrapTTI
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TTS
+  representation:
+    newtype:
+      constructor: TTS
+      fields:
+      - unwrapTTS
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TTU
+  representation:
+    newtype:
+      constructor: TTU
+      fields:
+      - unwrapTTU
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: TU
+  representation:
+    newtype:
+      constructor: TU
+      fields:
+      - unwrapTU
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+  instances:
+  - Generic
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/qualifiers/const_typedefs/th.txt b/test-artefacts/fixtures/types/qualifiers/const_typedefs/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/const_typedefs/th.txt
@@ -0,0 +1,720 @@
+-- addDependentFile test-artefacts/headers/golden/types/qualifiers/const_typedefs.h
+-- #include <types/qualifiers/const_typedefs.h>
+-- /* test_typesqualifiersconst_typedef_Example_get_i */
+-- __attribute__ ((const))
+-- I const *hs_bindgen_bb40525ba9109d7a (void)
+-- {
+--   return &i;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_s */
+-- __attribute__ ((const))
+-- struct S const *hs_bindgen_e02c667254de325e (void)
+-- {
+--   return &s;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_u */
+-- __attribute__ ((const))
+-- union U const *hs_bindgen_db442d4a677f346c (void)
+-- {
+--   return &u;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_e */
+-- __attribute__ ((const))
+-- enum E const *hs_bindgen_f8e0ac7d2c94db95 (void)
+-- {
+--   return &e;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_ti */
+-- __attribute__ ((const))
+-- TI *hs_bindgen_da8e11a66011da3a (void)
+-- {
+--   return &ti;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_ts */
+-- __attribute__ ((const))
+-- TS *hs_bindgen_10a3457a0f6b2036 (void)
+-- {
+--   return &ts;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_tu */
+-- __attribute__ ((const))
+-- TU *hs_bindgen_ded2bbcd5f7b0513 (void)
+-- {
+--   return &tu;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_te */
+-- __attribute__ ((const))
+-- TE *hs_bindgen_1b4b0fa82bacf9cc (void)
+-- {
+--   return &te;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_tti */
+-- __attribute__ ((const))
+-- TTI *hs_bindgen_b8067bbfe8dc188e (void)
+-- {
+--   return &tti;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_tts */
+-- __attribute__ ((const))
+-- TTS *hs_bindgen_6ce6ca09ed64a420 (void)
+-- {
+--   return &tts;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_ttu */
+-- __attribute__ ((const))
+-- TTU *hs_bindgen_5d4569e6c5a642c0 (void)
+-- {
+--   return &ttu;
+-- }
+-- /* test_typesqualifiersconst_typedef_Example_get_tte */
+-- __attribute__ ((const))
+-- TTE *hs_bindgen_cb44d6db796abc21 (void)
+-- {
+--   return &tte;
+-- }
+{-| __C declaration:__ @I@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 10:13@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype I
+    = I {unwrapI :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapI" I ty
+    where hasField = \x_0 -> (\y_1 -> I{unwrapI = y_1},
+                              getField @"unwrapI" x_0)
+instance (~) ty CInt => HasField "unwrapI" (Ptr I) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapI")
+instance HasCField I "unwrapI"
+    where type CFieldType I "unwrapI" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 11:8@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+data S = S {} deriving stock (Eq, Generic, Show)
+instance StaticSize S
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw S
+    where readRaw = \ptr_0 -> pure S
+instance WriteRaw S
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S -> pure ()
+deriving via (EquivStorable S) instance Storable S
+deriving via (IsStructViaReadRaw S) instance IsStruct S
+{-| __C declaration:__ @union U@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 12:7@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype U = U {unwrapU :: ByteArray} deriving stock Generic
+deriving via (SizedByteArray 0 1) instance StaticSize U
+deriving via (SizedByteArray 0 1) instance ReadRaw U
+deriving via (SizedByteArray 0 1) instance WriteRaw U
+deriving via (EquivStorable U) instance Storable U
+deriving via (SizedByteArray 0 1) instance IsUnion U
+{-| __C declaration:__ @enum E@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 13:6@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype E
+    = E {unwrapE :: CUInt}
+    deriving stock (Eq, Generic, Ord)
+    deriving newtype HasFFIType
+instance StaticSize E
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw E
+    where readRaw = \ptr_0 -> pure E <*> readRawByteOff ptr_0 (0 :: Int)
+instance WriteRaw E
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E unwrapE_2 -> writeRawByteOff ptr_0 (0 :: Int) unwrapE_2
+deriving via (EquivStorable E) instance Storable E
+deriving via CUInt instance Prim E
+instance CEnum E
+    where type CEnumZ E = CUInt
+          toCEnum = E
+          fromCEnum = getField @"unwrapE"
+          declaredValues = \_ -> declaredValuesFromList [(0,
+                                                          singleton "Foo")]
+          showsUndeclared = showsWrappedUndeclared "E"
+          readPrecUndeclared = readPrecWrappedUndeclared "E"
+          isDeclared = seqIsDeclared
+          mkDeclared = seqMkDeclared
+instance SequentialCEnum E
+    where minDeclaredValue = Foo
+          maxDeclaredValue = Foo
+instance Show E
+    where showsPrec = shows
+instance Read E
+    where readPrec = readPrec
+          readList = readListDefault
+          readListPrec = readListPrecDefault
+instance (~) ty CUInt => HasField "unwrapE" E ty
+    where hasField = \x_0 -> (\y_1 -> E{unwrapE = y_1},
+                              getField @"unwrapE" x_0)
+instance (~) ty CUInt => HasField "unwrapE" (Ptr E) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapE")
+instance HasCField E "unwrapE"
+    where type CFieldType E "unwrapE" = CUInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @foo@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 13:9@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+pattern Foo :: E
+pattern Foo = E 0
+{-| __C declaration:__ @TI@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 20:17@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TI
+    = TI {unwrapTI :: I}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty I => HasField "unwrapTI" TI ty
+    where hasField = \x_0 -> (\y_1 -> TI{unwrapTI = y_1},
+                              getField @"unwrapTI" x_0)
+instance (~) ty I => HasField "unwrapTI" (Ptr TI) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTI")
+instance HasCField TI "unwrapTI"
+    where type CFieldType TI "unwrapTI" = I
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @TS@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 21:24@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TS
+    = TS {unwrapTS :: S}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty S => HasField "unwrapTS" TS ty
+    where hasField = \x_0 -> (\y_1 -> TS{unwrapTS = y_1},
+                              getField @"unwrapTS" x_0)
+instance (~) ty S => HasField "unwrapTS" (Ptr TS) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTS")
+instance HasCField TS "unwrapTS"
+    where type CFieldType TS "unwrapTS" = S
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @TU@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 22:23@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TU
+    = TU {unwrapTU :: U}
+    deriving stock Generic
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty U => HasField "unwrapTU" TU ty
+    where hasField = \x_0 -> (\y_1 -> TU{unwrapTU = y_1},
+                              getField @"unwrapTU" x_0)
+instance (~) ty U => HasField "unwrapTU" (Ptr TU) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTU")
+instance HasCField TU "unwrapTU"
+    where type CFieldType TU "unwrapTU" = U
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @TE@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 23:22@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TE
+    = TE {unwrapTE :: E}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty E => HasField "unwrapTE" TE ty
+    where hasField = \x_0 -> (\y_1 -> TE{unwrapTE = y_1},
+                              getField @"unwrapTE" x_0)
+instance (~) ty E => HasField "unwrapTE" (Ptr TE) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTE")
+instance HasCField TE "unwrapTE"
+    where type CFieldType TE "unwrapTE" = E
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @TTI@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 30:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TTI
+    = TTI {unwrapTTI :: TI}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty TI => HasField "unwrapTTI" TTI ty
+    where hasField = \x_0 -> (\y_1 -> TTI{unwrapTTI = y_1},
+                              getField @"unwrapTTI" x_0)
+instance (~) ty TI => HasField "unwrapTTI" (Ptr TTI) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTTI")
+instance HasCField TTI "unwrapTTI"
+    where type CFieldType TTI "unwrapTTI" = TI
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @TTS@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 31:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TTS
+    = TTS {unwrapTTS :: TS}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty TS => HasField "unwrapTTS" TTS ty
+    where hasField = \x_0 -> (\y_1 -> TTS{unwrapTTS = y_1},
+                              getField @"unwrapTTS" x_0)
+instance (~) ty TS => HasField "unwrapTTS" (Ptr TTS) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTTS")
+instance HasCField TTS "unwrapTTS"
+    where type CFieldType TTS "unwrapTTS" = TS
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @TTU@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 32:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TTU
+    = TTU {unwrapTTU :: TU}
+    deriving stock Generic
+    deriving newtype (ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty TU => HasField "unwrapTTU" TTU ty
+    where hasField = \x_0 -> (\y_1 -> TTU{unwrapTTU = y_1},
+                              getField @"unwrapTTU" x_0)
+instance (~) ty TU => HasField "unwrapTTU" (Ptr TTU) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTTU")
+instance HasCField TTU "unwrapTTU"
+    where type CFieldType TTU "unwrapTTU" = TU
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @TTE@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 33:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+-}
+newtype TTE
+    = TTE {unwrapTTE :: TE}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (HasFFIType,
+                      Prim,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty TE => HasField "unwrapTTE" TTE ty
+    where hasField = \x_0 -> (\y_1 -> TTE{unwrapTTE = y_1},
+                              getField @"unwrapTTE" x_0)
+instance (~) ty TE => HasField "unwrapTTE" (Ptr TTE) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapTTE")
+instance HasCField TTE "unwrapTTE"
+    where type CFieldType TTE "unwrapTTE" = TE
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_i@
+foreign import ccall unsafe "hs_bindgen_bb40525ba9109d7a" hs_bindgen_bb40525ba9109d7a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_i@
+hs_bindgen_bb40525ba9109d7a :: IO (PtrConst I)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_i@
+hs_bindgen_bb40525ba9109d7a = fmap fromFFIType hs_bindgen_bb40525ba9109d7a_base
+{-# NOINLINE hs_bindgen_8bf2d89ca41997fb #-}
+{-| __C declaration:__ @i@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 15:16@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_i@
+-}
+hs_bindgen_8bf2d89ca41997fb :: PtrConst I
+{-| __C declaration:__ @i@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 15:16@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_i@
+-}
+hs_bindgen_8bf2d89ca41997fb = unsafePerformIO hs_bindgen_bb40525ba9109d7a
+{-# NOINLINE i #-}
+i :: I
+i = unsafePerformIO (peek hs_bindgen_8bf2d89ca41997fb)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_s@
+foreign import ccall unsafe "hs_bindgen_e02c667254de325e" hs_bindgen_e02c667254de325e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_s@
+hs_bindgen_e02c667254de325e :: IO (PtrConst S)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_s@
+hs_bindgen_e02c667254de325e = fmap fromFFIType hs_bindgen_e02c667254de325e_base
+{-# NOINLINE hs_bindgen_0e876abf0fe9e3b2 #-}
+{-| __C declaration:__ @s@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 16:23@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_s@
+-}
+hs_bindgen_0e876abf0fe9e3b2 :: PtrConst S
+{-| __C declaration:__ @s@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 16:23@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_s@
+-}
+hs_bindgen_0e876abf0fe9e3b2 = unsafePerformIO hs_bindgen_e02c667254de325e
+{-# NOINLINE s #-}
+s :: S
+s = unsafePerformIO (peek hs_bindgen_0e876abf0fe9e3b2)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_u@
+foreign import ccall unsafe "hs_bindgen_db442d4a677f346c" hs_bindgen_db442d4a677f346c_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_u@
+hs_bindgen_db442d4a677f346c :: IO (PtrConst U)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_u@
+hs_bindgen_db442d4a677f346c = fmap fromFFIType hs_bindgen_db442d4a677f346c_base
+{-# NOINLINE hs_bindgen_b7bdf87ddb6b9a5b #-}
+{-| __C declaration:__ @u@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 17:22@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_u@
+-}
+hs_bindgen_b7bdf87ddb6b9a5b :: PtrConst U
+{-| __C declaration:__ @u@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 17:22@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_u@
+-}
+hs_bindgen_b7bdf87ddb6b9a5b = unsafePerformIO hs_bindgen_db442d4a677f346c
+{-# NOINLINE u #-}
+u :: U
+u = unsafePerformIO (peek hs_bindgen_b7bdf87ddb6b9a5b)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_e@
+foreign import ccall unsafe "hs_bindgen_f8e0ac7d2c94db95" hs_bindgen_f8e0ac7d2c94db95_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_e@
+hs_bindgen_f8e0ac7d2c94db95 :: IO (PtrConst E)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_e@
+hs_bindgen_f8e0ac7d2c94db95 = fmap fromFFIType hs_bindgen_f8e0ac7d2c94db95_base
+{-# NOINLINE hs_bindgen_fa2424d094d91a33 #-}
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 18:21@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_e@
+-}
+hs_bindgen_fa2424d094d91a33 :: PtrConst E
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 18:21@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_e@
+-}
+hs_bindgen_fa2424d094d91a33 = unsafePerformIO hs_bindgen_f8e0ac7d2c94db95
+{-# NOINLINE e #-}
+e :: E
+e = unsafePerformIO (peek hs_bindgen_fa2424d094d91a33)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ti@
+foreign import ccall unsafe "hs_bindgen_da8e11a66011da3a" hs_bindgen_da8e11a66011da3a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ti@
+hs_bindgen_da8e11a66011da3a :: IO (PtrConst TI)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ti@
+hs_bindgen_da8e11a66011da3a = fmap fromFFIType hs_bindgen_da8e11a66011da3a_base
+{-# NOINLINE hs_bindgen_d7dd4362406f73a6 #-}
+{-| __C declaration:__ @ti@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 25:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_ti@
+-}
+hs_bindgen_d7dd4362406f73a6 :: PtrConst TI
+{-| __C declaration:__ @ti@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 25:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_ti@
+-}
+hs_bindgen_d7dd4362406f73a6 = unsafePerformIO hs_bindgen_da8e11a66011da3a
+{-# NOINLINE ti #-}
+ti :: TI
+ti = unsafePerformIO (peek hs_bindgen_d7dd4362406f73a6)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ts@
+foreign import ccall unsafe "hs_bindgen_10a3457a0f6b2036" hs_bindgen_10a3457a0f6b2036_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ts@
+hs_bindgen_10a3457a0f6b2036 :: IO (PtrConst TS)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ts@
+hs_bindgen_10a3457a0f6b2036 = fmap fromFFIType hs_bindgen_10a3457a0f6b2036_base
+{-# NOINLINE hs_bindgen_cd3e2d14ae82b6fc #-}
+{-| __C declaration:__ @ts@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 26:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_ts@
+-}
+hs_bindgen_cd3e2d14ae82b6fc :: PtrConst TS
+{-| __C declaration:__ @ts@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 26:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_ts@
+-}
+hs_bindgen_cd3e2d14ae82b6fc = unsafePerformIO hs_bindgen_10a3457a0f6b2036
+{-# NOINLINE ts #-}
+ts :: TS
+ts = unsafePerformIO (peek hs_bindgen_cd3e2d14ae82b6fc)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tu@
+foreign import ccall unsafe "hs_bindgen_ded2bbcd5f7b0513" hs_bindgen_ded2bbcd5f7b0513_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tu@
+hs_bindgen_ded2bbcd5f7b0513 :: IO (PtrConst TU)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tu@
+hs_bindgen_ded2bbcd5f7b0513 = fmap fromFFIType hs_bindgen_ded2bbcd5f7b0513_base
+{-# NOINLINE hs_bindgen_2d9684fc851b0766 #-}
+{-| __C declaration:__ @tu@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 27:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tu@
+-}
+hs_bindgen_2d9684fc851b0766 :: PtrConst TU
+{-| __C declaration:__ @tu@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 27:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tu@
+-}
+hs_bindgen_2d9684fc851b0766 = unsafePerformIO hs_bindgen_ded2bbcd5f7b0513
+{-# NOINLINE tu #-}
+tu :: TU
+tu = unsafePerformIO (peek hs_bindgen_2d9684fc851b0766)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_te@
+foreign import ccall unsafe "hs_bindgen_1b4b0fa82bacf9cc" hs_bindgen_1b4b0fa82bacf9cc_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_te@
+hs_bindgen_1b4b0fa82bacf9cc :: IO (PtrConst TE)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_te@
+hs_bindgen_1b4b0fa82bacf9cc = fmap fromFFIType hs_bindgen_1b4b0fa82bacf9cc_base
+{-# NOINLINE hs_bindgen_200eaed7c3fb420d #-}
+{-| __C declaration:__ @te@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 28:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_te@
+-}
+hs_bindgen_200eaed7c3fb420d :: PtrConst TE
+{-| __C declaration:__ @te@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 28:11@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_te@
+-}
+hs_bindgen_200eaed7c3fb420d = unsafePerformIO hs_bindgen_1b4b0fa82bacf9cc
+{-# NOINLINE te #-}
+te :: TE
+te = unsafePerformIO (peek hs_bindgen_200eaed7c3fb420d)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tti@
+foreign import ccall unsafe "hs_bindgen_b8067bbfe8dc188e" hs_bindgen_b8067bbfe8dc188e_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tti@
+hs_bindgen_b8067bbfe8dc188e :: IO (PtrConst TTI)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tti@
+hs_bindgen_b8067bbfe8dc188e = fmap fromFFIType hs_bindgen_b8067bbfe8dc188e_base
+{-# NOINLINE hs_bindgen_1fbea465b2793d07 #-}
+{-| __C declaration:__ @tti@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 35:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tti@
+-}
+hs_bindgen_1fbea465b2793d07 :: PtrConst TTI
+{-| __C declaration:__ @tti@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 35:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tti@
+-}
+hs_bindgen_1fbea465b2793d07 = unsafePerformIO hs_bindgen_b8067bbfe8dc188e
+{-# NOINLINE tti #-}
+tti :: TTI
+tti = unsafePerformIO (peek hs_bindgen_1fbea465b2793d07)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tts@
+foreign import ccall unsafe "hs_bindgen_6ce6ca09ed64a420" hs_bindgen_6ce6ca09ed64a420_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tts@
+hs_bindgen_6ce6ca09ed64a420 :: IO (PtrConst TTS)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tts@
+hs_bindgen_6ce6ca09ed64a420 = fmap fromFFIType hs_bindgen_6ce6ca09ed64a420_base
+{-# NOINLINE hs_bindgen_f23f17df17b3fe36 #-}
+{-| __C declaration:__ @tts@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 36:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tts@
+-}
+hs_bindgen_f23f17df17b3fe36 :: PtrConst TTS
+{-| __C declaration:__ @tts@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 36:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tts@
+-}
+hs_bindgen_f23f17df17b3fe36 = unsafePerformIO hs_bindgen_6ce6ca09ed64a420
+{-# NOINLINE tts #-}
+tts :: TTS
+tts = unsafePerformIO (peek hs_bindgen_f23f17df17b3fe36)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ttu@
+foreign import ccall unsafe "hs_bindgen_5d4569e6c5a642c0" hs_bindgen_5d4569e6c5a642c0_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ttu@
+hs_bindgen_5d4569e6c5a642c0 :: IO (PtrConst TTU)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_ttu@
+hs_bindgen_5d4569e6c5a642c0 = fmap fromFFIType hs_bindgen_5d4569e6c5a642c0_base
+{-# NOINLINE hs_bindgen_45ab2258853f641d #-}
+{-| __C declaration:__ @ttu@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 37:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_ttu@
+-}
+hs_bindgen_45ab2258853f641d :: PtrConst TTU
+{-| __C declaration:__ @ttu@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 37:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_ttu@
+-}
+hs_bindgen_45ab2258853f641d = unsafePerformIO hs_bindgen_5d4569e6c5a642c0
+{-# NOINLINE ttu #-}
+ttu :: TTU
+ttu = unsafePerformIO (peek hs_bindgen_45ab2258853f641d)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tte@
+foreign import ccall unsafe "hs_bindgen_cb44d6db796abc21" hs_bindgen_cb44d6db796abc21_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tte@
+hs_bindgen_cb44d6db796abc21 :: IO (PtrConst TTE)
+-- __unique:__ @test_typesqualifiersconst_typedef_Example_get_tte@
+hs_bindgen_cb44d6db796abc21 = fmap fromFFIType hs_bindgen_cb44d6db796abc21_base
+{-# NOINLINE hs_bindgen_0956779e634e3dd5 #-}
+{-| __C declaration:__ @tte@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 38:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tte@
+-}
+hs_bindgen_0956779e634e3dd5 :: PtrConst TTE
+{-| __C declaration:__ @tte@
+
+    __defined at:__ @types\/qualifiers\/const_typedefs.h 38:12@
+
+    __exported by:__ @types\/qualifiers\/const_typedefs.h@
+
+    __unique:__ @test_typesqualifiersconst_typedef_Example_tte@
+-}
+hs_bindgen_0956779e634e3dd5 = unsafePerformIO hs_bindgen_cb44d6db796abc21
+{-# NOINLINE tte #-}
+tte :: TTE
+tte = unsafePerformIO (peek hs_bindgen_0956779e634e3dd5)
diff --git a/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/FunPtr.hs b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/FunPtr.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.list_example
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/qualifiers/type_qualifiers.h>"
+  , "/* test_typesqualifierstype_qualifie_Example_get_list_example */"
+  , "__attribute__ ((const))"
+  , "_Bool (*hs_bindgen_a19bc138e7f2759b (void)) ("
+  , "  char const **arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return &list_example;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_list_example@
+foreign import ccall unsafe "hs_bindgen_a19bc138e7f2759b" hs_bindgen_a19bc138e7f2759b_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_list_example@
+hs_bindgen_a19bc138e7f2759b :: IO (BG.FunPtr (BG.Ptr (PtrConst.PtrConst BG.CChar) -> HsBindgen.Runtime.LibC.CSize -> IO BG.CBool))
+hs_bindgen_a19bc138e7f2759b =
+  fmap BG.fromFFIType hs_bindgen_a19bc138e7f2759b_base
+
+{-# NOINLINE list_example #-}
+{-| __C declaration:__ @list_example@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 14:6@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+list_example :: BG.FunPtr (BG.Ptr (PtrConst.PtrConst BG.CChar) -> HsBindgen.Runtime.LibC.CSize -> IO BG.CBool)
+list_example =
+  BG.unsafePerformIO hs_bindgen_a19bc138e7f2759b
diff --git a/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/Global.hs b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/Global.hs
@@ -0,0 +1,309 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.a
+    , Example.Global.b
+    , Example.Global.c
+    , Example.Global.d
+    , Example.Global.e
+    , Example.Global.f
+    , Example.Global.g
+    , Example.Global.h
+    , Example.Global.i
+    , Example.Global.j
+    )
+  where
+
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/qualifiers/type_qualifiers.h>"
+  , "/* test_typesqualifierstype_qualifie_Example_get_a */"
+  , "__attribute__ ((const))"
+  , "signed int const *hs_bindgen_b9f6c3995e03a64f (void)"
+  , "{"
+  , "  return &a;"
+  , "}"
+  , "/* test_typesqualifierstype_qualifie_Example_get_b */"
+  , "__attribute__ ((const))"
+  , "signed int const **hs_bindgen_2a09e45ccb76e4da (void)"
+  , "{"
+  , "  return &b;"
+  , "}"
+  , "/* test_typesqualifierstype_qualifie_Example_get_c */"
+  , "__attribute__ ((const))"
+  , "signed int *const *hs_bindgen_9cef5885d51a5077 (void)"
+  , "{"
+  , "  return &c;"
+  , "}"
+  , "/* test_typesqualifierstype_qualifie_Example_get_d */"
+  , "__attribute__ ((const))"
+  , "signed int const *const *hs_bindgen_039fc3584df4cf95 (void)"
+  , "{"
+  , "  return &d;"
+  , "}"
+  , "/* test_typesqualifierstype_qualifie_Example_get_e */"
+  , "__attribute__ ((const))"
+  , "signed int const *const **hs_bindgen_cdf2cbe09fc53047 (void)"
+  , "{"
+  , "  return &e;"
+  , "}"
+  , "/* test_typesqualifierstype_qualifie_Example_get_f */"
+  , "__attribute__ ((const))"
+  , "signed int const *const ***hs_bindgen_93ddb0dbf8706068 (void)"
+  , "{"
+  , "  return &f;"
+  , "}"
+  , "/* test_typesqualifierstype_qualifie_Example_get_g */"
+  , "__attribute__ ((const))"
+  , "signed int const **const **hs_bindgen_e6c23ab326a206a8 (void)"
+  , "{"
+  , "  return &g;"
+  , "}"
+  , "/* test_typesqualifierstype_qualifie_Example_get_h */"
+  , "__attribute__ ((const))"
+  , "signed int const *const *const *const *hs_bindgen_f23087f72d34068b (void)"
+  , "{"
+  , "  return &h;"
+  , "}"
+  , "/* test_typesqualifierstype_qualifie_Example_get_i */"
+  , "__attribute__ ((const))"
+  , "signed int *const **const **hs_bindgen_ed73ead5c58fe94a (void)"
+  , "{"
+  , "  return &i;"
+  , "}"
+  , "/* test_typesqualifierstype_qualifie_Example_get_j */"
+  , "__attribute__ ((const))"
+  , "signed int const *const *const ***hs_bindgen_92d2adc70d4b87ee (void)"
+  , "{"
+  , "  return &j;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_a@
+foreign import ccall unsafe "hs_bindgen_b9f6c3995e03a64f" hs_bindgen_b9f6c3995e03a64f_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_a@
+hs_bindgen_b9f6c3995e03a64f :: IO (PtrConst.PtrConst BG.CInt)
+hs_bindgen_b9f6c3995e03a64f =
+  fmap BG.fromFFIType hs_bindgen_b9f6c3995e03a64f_base
+
+{-# NOINLINE hs_bindgen_568187d7e5f899e0 #-}
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 5:18@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_a@
+-}
+hs_bindgen_568187d7e5f899e0 :: PtrConst.PtrConst BG.CInt
+hs_bindgen_568187d7e5f899e0 =
+  BG.unsafePerformIO hs_bindgen_b9f6c3995e03a64f
+
+{-# NOINLINE a #-}
+a :: BG.CInt
+a =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_568187d7e5f899e0)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_b@
+foreign import ccall unsafe "hs_bindgen_2a09e45ccb76e4da" hs_bindgen_2a09e45ccb76e4da_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_b@
+hs_bindgen_2a09e45ccb76e4da :: IO (BG.Ptr (PtrConst.PtrConst BG.CInt))
+hs_bindgen_2a09e45ccb76e4da =
+  fmap BG.fromFFIType hs_bindgen_2a09e45ccb76e4da_base
+
+{-# NOINLINE b #-}
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 7:19@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+b :: BG.Ptr (PtrConst.PtrConst BG.CInt)
+b = BG.unsafePerformIO hs_bindgen_2a09e45ccb76e4da
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_c@
+foreign import ccall unsafe "hs_bindgen_9cef5885d51a5077" hs_bindgen_9cef5885d51a5077_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_c@
+hs_bindgen_9cef5885d51a5077 :: IO (PtrConst.PtrConst (BG.Ptr BG.CInt))
+hs_bindgen_9cef5885d51a5077 =
+  fmap BG.fromFFIType hs_bindgen_9cef5885d51a5077_base
+
+{-# NOINLINE hs_bindgen_86ab1f1ce8db256e #-}
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 9:19@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_c@
+-}
+hs_bindgen_86ab1f1ce8db256e :: PtrConst.PtrConst (BG.Ptr BG.CInt)
+hs_bindgen_86ab1f1ce8db256e =
+  BG.unsafePerformIO hs_bindgen_9cef5885d51a5077
+
+{-# NOINLINE c #-}
+c :: BG.Ptr BG.CInt
+c =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_86ab1f1ce8db256e)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_d@
+foreign import ccall unsafe "hs_bindgen_039fc3584df4cf95" hs_bindgen_039fc3584df4cf95_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_d@
+hs_bindgen_039fc3584df4cf95 :: IO (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt))
+hs_bindgen_039fc3584df4cf95 =
+  fmap BG.fromFFIType hs_bindgen_039fc3584df4cf95_base
+
+{-# NOINLINE hs_bindgen_f5892dac29d00ba8 #-}
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 11:25@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_d@
+-}
+hs_bindgen_f5892dac29d00ba8 :: PtrConst.PtrConst (PtrConst.PtrConst BG.CInt)
+hs_bindgen_f5892dac29d00ba8 =
+  BG.unsafePerformIO hs_bindgen_039fc3584df4cf95
+
+{-# NOINLINE d #-}
+d :: PtrConst.PtrConst BG.CInt
+d =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_f5892dac29d00ba8)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_e@
+foreign import ccall unsafe "hs_bindgen_cdf2cbe09fc53047" hs_bindgen_cdf2cbe09fc53047_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_e@
+hs_bindgen_cdf2cbe09fc53047 :: IO (BG.Ptr (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_cdf2cbe09fc53047 =
+  fmap BG.fromFFIType hs_bindgen_cdf2cbe09fc53047_base
+
+{-# NOINLINE e #-}
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 18:26@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+e :: BG.Ptr (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt))
+e = BG.unsafePerformIO hs_bindgen_cdf2cbe09fc53047
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_93ddb0dbf8706068" hs_bindgen_93ddb0dbf8706068_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_f@
+hs_bindgen_93ddb0dbf8706068 :: IO (BG.Ptr (BG.Ptr (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt))))
+hs_bindgen_93ddb0dbf8706068 =
+  fmap BG.fromFFIType hs_bindgen_93ddb0dbf8706068_base
+
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 20:27@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+f :: BG.Ptr (BG.Ptr (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt)))
+f = BG.unsafePerformIO hs_bindgen_93ddb0dbf8706068
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_e6c23ab326a206a8" hs_bindgen_e6c23ab326a206a8_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_g@
+hs_bindgen_e6c23ab326a206a8 :: IO (BG.Ptr (PtrConst.PtrConst (BG.Ptr (PtrConst.PtrConst BG.CInt))))
+hs_bindgen_e6c23ab326a206a8 =
+  fmap BG.fromFFIType hs_bindgen_e6c23ab326a206a8_base
+
+{-# NOINLINE g #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 22:27@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+g :: BG.Ptr (PtrConst.PtrConst (BG.Ptr (PtrConst.PtrConst BG.CInt)))
+g = BG.unsafePerformIO hs_bindgen_e6c23ab326a206a8
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_h@
+foreign import ccall unsafe "hs_bindgen_f23087f72d34068b" hs_bindgen_f23087f72d34068b_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_h@
+hs_bindgen_f23087f72d34068b :: IO (PtrConst.PtrConst (PtrConst.PtrConst (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt))))
+hs_bindgen_f23087f72d34068b =
+  fmap BG.fromFFIType hs_bindgen_f23087f72d34068b_base
+
+{-# NOINLINE hs_bindgen_2461912a034924cf #-}
+{-| __C declaration:__ @h@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 24:39@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_h@
+-}
+hs_bindgen_2461912a034924cf :: PtrConst.PtrConst (PtrConst.PtrConst (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt)))
+hs_bindgen_2461912a034924cf =
+  BG.unsafePerformIO hs_bindgen_f23087f72d34068b
+
+{-# NOINLINE h #-}
+h :: PtrConst.PtrConst (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt))
+h =
+  BG.unsafePerformIO (PtrConst.peek hs_bindgen_2461912a034924cf)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_i@
+foreign import ccall unsafe "hs_bindgen_ed73ead5c58fe94a" hs_bindgen_ed73ead5c58fe94a_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_i@
+hs_bindgen_ed73ead5c58fe94a :: IO (BG.Ptr (PtrConst.PtrConst (BG.Ptr (PtrConst.PtrConst (BG.Ptr BG.CInt)))))
+hs_bindgen_ed73ead5c58fe94a =
+  fmap BG.fromFFIType hs_bindgen_ed73ead5c58fe94a_base
+
+{-# NOINLINE i #-}
+{-| __C declaration:__ @i@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 26:28@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+i :: BG.Ptr (PtrConst.PtrConst (BG.Ptr (PtrConst.PtrConst (BG.Ptr BG.CInt))))
+i = BG.unsafePerformIO hs_bindgen_ed73ead5c58fe94a
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_j@
+foreign import ccall unsafe "hs_bindgen_92d2adc70d4b87ee" hs_bindgen_92d2adc70d4b87ee_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_j@
+hs_bindgen_92d2adc70d4b87ee :: IO (BG.Ptr (BG.Ptr (PtrConst.PtrConst (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt)))))
+hs_bindgen_92d2adc70d4b87ee =
+  fmap BG.fromFFIType hs_bindgen_92d2adc70d4b87ee_base
+
+{-# NOINLINE j #-}
+{-| __C declaration:__ @j@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 28:34@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+j :: BG.Ptr (BG.Ptr (PtrConst.PtrConst (PtrConst.PtrConst (PtrConst.PtrConst BG.CInt))))
+j = BG.unsafePerformIO hs_bindgen_92d2adc70d4b87ee
diff --git a/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/Safe.hs b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/Safe.hs
@@ -0,0 +1,56 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.list_example
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/qualifiers/type_qualifiers.h>"
+  , "_Bool hs_bindgen_32187cc02676ee72 ("
+  , "  char const **arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (list_example)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Safe_list_example@
+foreign import ccall safe "hs_bindgen_32187cc02676ee72" hs_bindgen_32187cc02676ee72_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CBool
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Safe_list_example@
+hs_bindgen_32187cc02676ee72 ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CBool
+hs_bindgen_32187cc02676ee72 =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_32187cc02676ee72_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @list_example@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 14:6@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+list_example ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+     -- ^ __C declaration:__ @items@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @count@
+  -> IO BG.CBool
+list_example = hs_bindgen_32187cc02676ee72
diff --git a/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/Unsafe.hs b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/Example/Unsafe.hs
@@ -0,0 +1,56 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.list_example
+    )
+  where
+
+import qualified HsBindgen.Runtime.LibC
+import qualified HsBindgen.Runtime.PtrConst as PtrConst
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/qualifiers/type_qualifiers.h>"
+  , "_Bool hs_bindgen_360934a08f19eaab ("
+  , "  char const **arg1,"
+  , "  size_t arg2"
+  , ")"
+  , "{"
+  , "  return (list_example)(arg1, arg2);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Unsafe_list_example@
+foreign import ccall unsafe "hs_bindgen_360934a08f19eaab" hs_bindgen_360934a08f19eaab_base ::
+     BG.Ptr BG.Void
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CBool
+
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Unsafe_list_example@
+hs_bindgen_360934a08f19eaab ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+  -> HsBindgen.Runtime.LibC.CSize
+  -> IO BG.CBool
+hs_bindgen_360934a08f19eaab =
+  \x0 ->
+    \x1 ->
+      fmap BG.fromFFIType (hs_bindgen_360934a08f19eaab_base (BG.toFFIType x0) (BG.toFFIType x1))
+
+{-| __C declaration:__ @list_example@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 14:6@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+list_example ::
+     BG.Ptr (PtrConst.PtrConst BG.CChar)
+     -- ^ __C declaration:__ @items@
+  -> HsBindgen.Runtime.LibC.CSize
+     -- ^ __C declaration:__ @count@
+  -> IO BG.CBool
+list_example = hs_bindgen_360934a08f19eaab
diff --git a/test-artefacts/fixtures/types/qualifiers/type_qualifiers/bindingspec.yaml b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/types/qualifiers/type_qualifiers/th.txt b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/qualifiers/type_qualifiers/th.txt
@@ -0,0 +1,410 @@
+-- addDependentFile musl-include/x86_64/stdbool.h
+-- addDependentFile musl-include/x86_64/bits/alltypes.h
+-- addDependentFile musl-include/x86_64/stddef.h
+-- addDependentFile test-artefacts/headers/golden/types/qualifiers/type_qualifiers.h
+-- #include <types/qualifiers/type_qualifiers.h>
+-- _Bool hs_bindgen_32187cc02676ee72 (
+--   char const **arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (list_example)(arg1, arg2);
+-- }
+-- _Bool hs_bindgen_360934a08f19eaab (
+--   char const **arg1,
+--   size_t arg2
+-- )
+-- {
+--   return (list_example)(arg1, arg2);
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_list_example */
+-- __attribute__ ((const))
+-- _Bool (*hs_bindgen_a19bc138e7f2759b (void)) (
+--   char const **arg1,
+--   size_t arg2
+-- )
+-- {
+--   return &list_example;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_a */
+-- __attribute__ ((const))
+-- signed int const *hs_bindgen_b9f6c3995e03a64f (void)
+-- {
+--   return &a;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_b */
+-- __attribute__ ((const))
+-- signed int const **hs_bindgen_2a09e45ccb76e4da (void)
+-- {
+--   return &b;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_c */
+-- __attribute__ ((const))
+-- signed int *const *hs_bindgen_9cef5885d51a5077 (void)
+-- {
+--   return &c;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_d */
+-- __attribute__ ((const))
+-- signed int const *const *hs_bindgen_039fc3584df4cf95 (void)
+-- {
+--   return &d;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_e */
+-- __attribute__ ((const))
+-- signed int const *const **hs_bindgen_cdf2cbe09fc53047 (void)
+-- {
+--   return &e;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_f */
+-- __attribute__ ((const))
+-- signed int const *const ***hs_bindgen_93ddb0dbf8706068 (void)
+-- {
+--   return &f;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_g */
+-- __attribute__ ((const))
+-- signed int const **const **hs_bindgen_e6c23ab326a206a8 (void)
+-- {
+--   return &g;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_h */
+-- __attribute__ ((const))
+-- signed int const *const *const *const *hs_bindgen_f23087f72d34068b (void)
+-- {
+--   return &h;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_i */
+-- __attribute__ ((const))
+-- signed int *const **const **hs_bindgen_ed73ead5c58fe94a (void)
+-- {
+--   return &i;
+-- }
+-- /* test_typesqualifierstype_qualifie_Example_get_j */
+-- __attribute__ ((const))
+-- signed int const *const *const ***hs_bindgen_92d2adc70d4b87ee (void)
+-- {
+--   return &j;
+-- }
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Safe_list_example@
+foreign import ccall safe "hs_bindgen_32187cc02676ee72" hs_bindgen_32187cc02676ee72_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CBool
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Safe_list_example@
+hs_bindgen_32187cc02676ee72 :: Ptr (PtrConst CChar) ->
+                               HsBindgen.Runtime.LibC.CSize -> IO CBool
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Safe_list_example@
+hs_bindgen_32187cc02676ee72 = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_32187cc02676ee72_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @list_example@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 14:6@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+list_example_safe :: Ptr (PtrConst CChar) ->
+                     HsBindgen.Runtime.LibC.CSize -> IO CBool
+{-| __C declaration:__ @list_example@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 14:6@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+list_example_safe = hs_bindgen_32187cc02676ee72
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Unsafe_list_example@
+foreign import ccall unsafe "hs_bindgen_360934a08f19eaab" hs_bindgen_360934a08f19eaab_base ::
+    Ptr Void
+ -> HsBindgen.Runtime.LibC.CSize
+ -> IO CBool
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Unsafe_list_example@
+hs_bindgen_360934a08f19eaab :: Ptr (PtrConst CChar) ->
+                               HsBindgen.Runtime.LibC.CSize -> IO CBool
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_Unsafe_list_example@
+hs_bindgen_360934a08f19eaab = \x_0 -> \x_1 -> fmap fromFFIType (hs_bindgen_360934a08f19eaab_base (toFFIType x_0) (toFFIType x_1))
+{-| __C declaration:__ @list_example@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 14:6@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+list_example_unsafe :: Ptr (PtrConst CChar) ->
+                       HsBindgen.Runtime.LibC.CSize -> IO CBool
+{-| __C declaration:__ @list_example@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 14:6@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+list_example_unsafe = hs_bindgen_360934a08f19eaab
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_list_example@
+foreign import ccall unsafe "hs_bindgen_a19bc138e7f2759b" hs_bindgen_a19bc138e7f2759b_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_list_example@
+hs_bindgen_a19bc138e7f2759b :: IO (FunPtr (Ptr (PtrConst CChar) ->
+                                           HsBindgen.Runtime.LibC.CSize -> IO CBool))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_list_example@
+hs_bindgen_a19bc138e7f2759b = fmap fromFFIType hs_bindgen_a19bc138e7f2759b_base
+{-# NOINLINE list_example_funptr #-}
+{-| __C declaration:__ @list_example@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 14:6@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+list_example_funptr :: FunPtr (Ptr (PtrConst CChar) ->
+                               HsBindgen.Runtime.LibC.CSize -> IO CBool)
+{-| __C declaration:__ @list_example@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 14:6@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+list_example_funptr = unsafePerformIO hs_bindgen_a19bc138e7f2759b
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_a@
+foreign import ccall unsafe "hs_bindgen_b9f6c3995e03a64f" hs_bindgen_b9f6c3995e03a64f_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_a@
+hs_bindgen_b9f6c3995e03a64f :: IO (PtrConst CInt)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_a@
+hs_bindgen_b9f6c3995e03a64f = fmap fromFFIType hs_bindgen_b9f6c3995e03a64f_base
+{-# NOINLINE hs_bindgen_568187d7e5f899e0 #-}
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 5:18@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_a@
+-}
+hs_bindgen_568187d7e5f899e0 :: PtrConst CInt
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 5:18@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_a@
+-}
+hs_bindgen_568187d7e5f899e0 = unsafePerformIO hs_bindgen_b9f6c3995e03a64f
+{-# NOINLINE a #-}
+a :: CInt
+a = unsafePerformIO (peek hs_bindgen_568187d7e5f899e0)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_b@
+foreign import ccall unsafe "hs_bindgen_2a09e45ccb76e4da" hs_bindgen_2a09e45ccb76e4da_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_b@
+hs_bindgen_2a09e45ccb76e4da :: IO (Ptr (PtrConst CInt))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_b@
+hs_bindgen_2a09e45ccb76e4da = fmap fromFFIType hs_bindgen_2a09e45ccb76e4da_base
+{-# NOINLINE b #-}
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 7:19@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+b :: Ptr (PtrConst CInt)
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 7:19@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+b = unsafePerformIO hs_bindgen_2a09e45ccb76e4da
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_c@
+foreign import ccall unsafe "hs_bindgen_9cef5885d51a5077" hs_bindgen_9cef5885d51a5077_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_c@
+hs_bindgen_9cef5885d51a5077 :: IO (PtrConst (Ptr CInt))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_c@
+hs_bindgen_9cef5885d51a5077 = fmap fromFFIType hs_bindgen_9cef5885d51a5077_base
+{-# NOINLINE hs_bindgen_86ab1f1ce8db256e #-}
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 9:19@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_c@
+-}
+hs_bindgen_86ab1f1ce8db256e :: PtrConst (Ptr CInt)
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 9:19@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_c@
+-}
+hs_bindgen_86ab1f1ce8db256e = unsafePerformIO hs_bindgen_9cef5885d51a5077
+{-# NOINLINE c #-}
+c :: Ptr CInt
+c = unsafePerformIO (peek hs_bindgen_86ab1f1ce8db256e)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_d@
+foreign import ccall unsafe "hs_bindgen_039fc3584df4cf95" hs_bindgen_039fc3584df4cf95_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_d@
+hs_bindgen_039fc3584df4cf95 :: IO (PtrConst (PtrConst CInt))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_d@
+hs_bindgen_039fc3584df4cf95 = fmap fromFFIType hs_bindgen_039fc3584df4cf95_base
+{-# NOINLINE hs_bindgen_f5892dac29d00ba8 #-}
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 11:25@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_d@
+-}
+hs_bindgen_f5892dac29d00ba8 :: PtrConst (PtrConst CInt)
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 11:25@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_d@
+-}
+hs_bindgen_f5892dac29d00ba8 = unsafePerformIO hs_bindgen_039fc3584df4cf95
+{-# NOINLINE d #-}
+d :: PtrConst CInt
+d = unsafePerformIO (peek hs_bindgen_f5892dac29d00ba8)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_e@
+foreign import ccall unsafe "hs_bindgen_cdf2cbe09fc53047" hs_bindgen_cdf2cbe09fc53047_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_e@
+hs_bindgen_cdf2cbe09fc53047 :: IO (Ptr (PtrConst (PtrConst CInt)))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_e@
+hs_bindgen_cdf2cbe09fc53047 = fmap fromFFIType hs_bindgen_cdf2cbe09fc53047_base
+{-# NOINLINE e #-}
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 18:26@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+e :: Ptr (PtrConst (PtrConst CInt))
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 18:26@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+e = unsafePerformIO hs_bindgen_cdf2cbe09fc53047
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_f@
+foreign import ccall unsafe "hs_bindgen_93ddb0dbf8706068" hs_bindgen_93ddb0dbf8706068_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_f@
+hs_bindgen_93ddb0dbf8706068 :: IO (Ptr (Ptr (PtrConst (PtrConst CInt))))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_f@
+hs_bindgen_93ddb0dbf8706068 = fmap fromFFIType hs_bindgen_93ddb0dbf8706068_base
+{-# NOINLINE f #-}
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 20:27@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+f :: Ptr (Ptr (PtrConst (PtrConst CInt)))
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 20:27@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+f = unsafePerformIO hs_bindgen_93ddb0dbf8706068
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_g@
+foreign import ccall unsafe "hs_bindgen_e6c23ab326a206a8" hs_bindgen_e6c23ab326a206a8_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_g@
+hs_bindgen_e6c23ab326a206a8 :: IO (Ptr (PtrConst (Ptr (PtrConst CInt))))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_g@
+hs_bindgen_e6c23ab326a206a8 = fmap fromFFIType hs_bindgen_e6c23ab326a206a8_base
+{-# NOINLINE g #-}
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 22:27@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+g :: Ptr (PtrConst (Ptr (PtrConst CInt)))
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 22:27@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+g = unsafePerformIO hs_bindgen_e6c23ab326a206a8
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_h@
+foreign import ccall unsafe "hs_bindgen_f23087f72d34068b" hs_bindgen_f23087f72d34068b_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_h@
+hs_bindgen_f23087f72d34068b :: IO (PtrConst (PtrConst (PtrConst (PtrConst CInt))))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_h@
+hs_bindgen_f23087f72d34068b = fmap fromFFIType hs_bindgen_f23087f72d34068b_base
+{-# NOINLINE hs_bindgen_2461912a034924cf #-}
+{-| __C declaration:__ @h@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 24:39@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_h@
+-}
+hs_bindgen_2461912a034924cf :: PtrConst (PtrConst (PtrConst (PtrConst CInt)))
+{-| __C declaration:__ @h@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 24:39@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+
+    __unique:__ @test_typesqualifierstype_qualifie_Example_h@
+-}
+hs_bindgen_2461912a034924cf = unsafePerformIO hs_bindgen_f23087f72d34068b
+{-# NOINLINE h #-}
+h :: PtrConst (PtrConst (PtrConst CInt))
+h = unsafePerformIO (peek hs_bindgen_2461912a034924cf)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_i@
+foreign import ccall unsafe "hs_bindgen_ed73ead5c58fe94a" hs_bindgen_ed73ead5c58fe94a_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_i@
+hs_bindgen_ed73ead5c58fe94a :: IO (Ptr (PtrConst (Ptr (PtrConst (Ptr CInt)))))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_i@
+hs_bindgen_ed73ead5c58fe94a = fmap fromFFIType hs_bindgen_ed73ead5c58fe94a_base
+{-# NOINLINE i #-}
+{-| __C declaration:__ @i@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 26:28@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+i :: Ptr (PtrConst (Ptr (PtrConst (Ptr CInt))))
+{-| __C declaration:__ @i@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 26:28@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+i = unsafePerformIO hs_bindgen_ed73ead5c58fe94a
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_j@
+foreign import ccall unsafe "hs_bindgen_92d2adc70d4b87ee" hs_bindgen_92d2adc70d4b87ee_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_j@
+hs_bindgen_92d2adc70d4b87ee :: IO (Ptr (Ptr (PtrConst (PtrConst (PtrConst CInt)))))
+-- __unique:__ @test_typesqualifierstype_qualifie_Example_get_j@
+hs_bindgen_92d2adc70d4b87ee = fmap fromFFIType hs_bindgen_92d2adc70d4b87ee_base
+{-# NOINLINE j #-}
+{-| __C declaration:__ @j@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 28:34@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+j :: Ptr (Ptr (PtrConst (PtrConst (PtrConst CInt))))
+{-| __C declaration:__ @j@
+
+    __defined at:__ @types\/qualifiers\/type_qualifiers.h 28:34@
+
+    __exported by:__ @types\/qualifiers\/type_qualifiers.h@
+-}
+j = unsafePerformIO hs_bindgen_92d2adc70d4b87ee
diff --git a/test-artefacts/fixtures/types/scoping/deep_nesting/Example.hs b/test-artefacts/fixtures/types/scoping/deep_nesting/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/deep_nesting/Example.hs
@@ -0,0 +1,93 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Baz(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct baz@
+
+    __defined at:__ @types\/scoping\/deep_nesting.h 18:12@
+
+    __exported by:__ @types\/scoping\/deep_nesting.h@
+-}
+data Baz = Baz
+  { baz_x1_2_1 :: BG.CInt
+    {- ^ __C declaration:__ @x1_2_1@
+
+         __defined at:__ @types\/scoping\/deep_nesting.h 19:11@
+
+         __exported by:__ @types\/scoping\/deep_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Baz where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Baz where
+
+  readRaw =
+    \ptr0 ->
+          pure Baz
+      <*> HasCField.readRaw (BG.Proxy @"baz_x1_2_1") ptr0
+
+instance Marshal.WriteRaw Baz where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Baz baz_x1_2_12 ->
+            HasCField.writeRaw (BG.Proxy @"baz_x1_2_1") ptr0 baz_x1_2_12
+
+deriving via Marshal.EquivStorable Baz instance BG.Storable Baz
+
+deriving via Struct.IsStructViaReadRaw Baz instance Struct.IsStruct Baz
+
+{-| __C declaration:__ @x1_2_1@
+
+    __defined at:__ @types\/scoping\/deep_nesting.h 19:11@
+
+    __exported by:__ @types\/scoping\/deep_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "baz_x1_2_1" Baz ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Baz {baz_x1_2_1 = y1}, BG.getField @"baz_x1_2_1" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "baz_x1_2_1" (BG.Ptr Baz) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"baz_x1_2_1")
+
+instance HasCField.HasCField Baz "baz_x1_2_1" where
+
+  type CFieldType Baz "baz_x1_2_1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/scoping/deep_nesting/Example/Global.hs b/test-artefacts/fixtures/types/scoping/deep_nesting/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/deep_nesting/Example/Global.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.x
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/scoping/deep_nesting.h>"
+  , "/* test_typesscopingdeep_nesting_Example_get_X */"
+  , "__attribute__ ((const))"
+  , "struct baz *hs_bindgen_d6029a840689b228 (void)"
+  , "{"
+  , "  return &X;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesscopingdeep_nesting_Example_get_X@
+foreign import ccall unsafe "hs_bindgen_d6029a840689b228" hs_bindgen_d6029a840689b228_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesscopingdeep_nesting_Example_get_X@
+hs_bindgen_d6029a840689b228 :: IO (BG.Ptr Baz)
+hs_bindgen_d6029a840689b228 =
+  fmap BG.fromFFIType hs_bindgen_d6029a840689b228_base
+
+{-# NOINLINE x #-}
+{-| __C declaration:__ @X@
+
+    __defined at:__ @types\/scoping\/deep_nesting.h 25:19@
+
+    __exported by:__ @types\/scoping\/deep_nesting.h@
+-}
+x :: BG.Ptr Baz
+x = BG.unsafePerformIO hs_bindgen_d6029a840689b228
diff --git a/test-artefacts/fixtures/types/scoping/deep_nesting/bindingspec.yaml b/test-artefacts/fixtures/types/scoping/deep_nesting/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/deep_nesting/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/scoping/deep_nesting.h
+  cname: struct baz
+  hsname: Baz
+hstypes:
+- hsname: Baz
+  representation:
+    record:
+      constructor: Baz
+      fields:
+      - baz_x1_2_1
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/scoping/deep_nesting/th.txt b/test-artefacts/fixtures/types/scoping/deep_nesting/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/deep_nesting/th.txt
@@ -0,0 +1,63 @@
+-- addDependentFile test-artefacts/headers/golden/types/scoping/deep_nesting.h
+-- #include <types/scoping/deep_nesting.h>
+-- /* test_typesscopingdeep_nesting_Example_get_X */
+-- __attribute__ ((const))
+-- struct baz *hs_bindgen_d6029a840689b228 (void)
+-- {
+--   return &X;
+-- }
+{-| __C declaration:__ @struct baz@
+
+    __defined at:__ @types\/scoping\/deep_nesting.h 18:12@
+
+    __exported by:__ @types\/scoping\/deep_nesting.h@
+-}
+data Baz
+    = Baz {baz_x1_2_1 :: CInt
+           {- ^ __C declaration:__ @x1_2_1@
+
+                __defined at:__ @types\/scoping\/deep_nesting.h 19:11@
+
+                __exported by:__ @types\/scoping\/deep_nesting.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Baz
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Baz
+    where readRaw = \ptr_0 -> pure Baz <*> readRaw (Proxy @"baz_x1_2_1") ptr_0
+instance WriteRaw Baz
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Baz baz_x1_2_1_2 -> writeRaw (Proxy @"baz_x1_2_1") ptr_0 baz_x1_2_1_2
+deriving via (EquivStorable Baz) instance Storable Baz
+deriving via (IsStructViaReadRaw Baz) instance IsStruct Baz
+instance (~) ty CInt => HasField "baz_x1_2_1" Baz ty
+    where hasField = \x_0 -> (\y_1 -> Baz{baz_x1_2_1 = y_1},
+                              getField @"baz_x1_2_1" x_0)
+instance (~) ty CInt => HasField "baz_x1_2_1" (Ptr Baz) (Ptr ty)
+    where getField = fromPtr (Proxy @"baz_x1_2_1")
+instance HasCField Baz "baz_x1_2_1"
+    where type CFieldType Baz "baz_x1_2_1" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_typesscopingdeep_nesting_Example_get_X@
+foreign import ccall unsafe "hs_bindgen_d6029a840689b228" hs_bindgen_d6029a840689b228_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesscopingdeep_nesting_Example_get_X@
+hs_bindgen_d6029a840689b228 :: IO (Ptr Baz)
+-- __unique:__ @test_typesscopingdeep_nesting_Example_get_X@
+hs_bindgen_d6029a840689b228 = fmap fromFFIType hs_bindgen_d6029a840689b228_base
+{-# NOINLINE x #-}
+{-| __C declaration:__ @X@
+
+    __defined at:__ @types\/scoping\/deep_nesting.h 25:19@
+
+    __exported by:__ @types\/scoping\/deep_nesting.h@
+-}
+x :: Ptr Baz
+{-| __C declaration:__ @X@
+
+    __defined at:__ @types\/scoping\/deep_nesting.h 25:19@
+
+    __exported by:__ @types\/scoping\/deep_nesting.h@
+-}
+x = unsafePerformIO hs_bindgen_d6029a840689b228
diff --git a/test-artefacts/fixtures/types/scoping/nesting/Example.hs b/test-artefacts/fixtures/types/scoping/nesting/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/nesting/Example.hs
@@ -0,0 +1,100 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Bar(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @types\/scoping\/nesting.h 14:10@
+
+    __exported by:__ @types\/scoping\/nesting.h@
+-}
+data Bar = Bar
+  { bar_x1_1 :: BG.CInt
+    {- ^ Comment attached to @foo::bar::x1_1@ .
+
+         This comment must be preserved, even though the enclosing declaration uses an unsupported feature.
+
+         __C declaration:__ @x1_1@
+
+         __defined at:__ @types\/scoping\/nesting.h 21:9@
+
+         __exported by:__ @types\/scoping\/nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Bar where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar
+      <*> HasCField.readRaw (BG.Proxy @"bar_x1_1") ptr0
+
+instance Marshal.WriteRaw Bar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar bar_x1_12 ->
+            HasCField.writeRaw (BG.Proxy @"bar_x1_1") ptr0 bar_x1_12
+
+deriving via Marshal.EquivStorable Bar instance BG.Storable Bar
+
+deriving via Struct.IsStructViaReadRaw Bar instance Struct.IsStruct Bar
+
+{-| Comment attached to @foo::bar::x1_1@ .
+
+    This comment must be preserved, even though the enclosing declaration uses an unsupported feature.
+
+    __C declaration:__ @x1_1@
+
+    __defined at:__ @types\/scoping\/nesting.h 21:9@
+
+    __exported by:__ @types\/scoping\/nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "bar_x1_1" Bar ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Bar {bar_x1_1 = y1}, BG.getField @"bar_x1_1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "bar_x1_1" (BG.Ptr Bar) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"bar_x1_1")
+
+instance HasCField.HasCField Bar "bar_x1_1" where
+
+  type CFieldType Bar "bar_x1_1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/scoping/nesting/Example/Global.hs b/test-artefacts/fixtures/types/scoping/nesting/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/nesting/Example/Global.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.x
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/scoping/nesting.h>"
+  , "/* test_typesscopingnesting_Example_get_X */"
+  , "__attribute__ ((const))"
+  , "struct bar *hs_bindgen_7640032abd722ca9 (void)"
+  , "{"
+  , "  return &X;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesscopingnesting_Example_get_X@
+foreign import ccall unsafe "hs_bindgen_7640032abd722ca9" hs_bindgen_7640032abd722ca9_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesscopingnesting_Example_get_X@
+hs_bindgen_7640032abd722ca9 :: IO (BG.Ptr Bar)
+hs_bindgen_7640032abd722ca9 =
+  fmap BG.fromFFIType hs_bindgen_7640032abd722ca9_base
+
+{-# NOINLINE x #-}
+{-| __C declaration:__ @X@
+
+    __defined at:__ @types\/scoping\/nesting.h 26:19@
+
+    __exported by:__ @types\/scoping\/nesting.h@
+-}
+x :: BG.Ptr Bar
+x = BG.unsafePerformIO hs_bindgen_7640032abd722ca9
diff --git a/test-artefacts/fixtures/types/scoping/nesting/bindingspec.yaml b/test-artefacts/fixtures/types/scoping/nesting/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/nesting/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/scoping/nesting.h
+  cname: struct bar
+  hsname: Bar
+hstypes:
+- hsname: Bar
+  representation:
+    record:
+      constructor: Bar
+      fields:
+      - bar_x1_1
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/scoping/nesting/th.txt b/test-artefacts/fixtures/types/scoping/nesting/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/nesting/th.txt
@@ -0,0 +1,67 @@
+-- addDependentFile test-artefacts/headers/golden/types/scoping/nesting.h
+-- #include <types/scoping/nesting.h>
+-- /* test_typesscopingnesting_Example_get_X */
+-- __attribute__ ((const))
+-- struct bar *hs_bindgen_7640032abd722ca9 (void)
+-- {
+--   return &X;
+-- }
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @types\/scoping\/nesting.h 14:10@
+
+    __exported by:__ @types\/scoping\/nesting.h@
+-}
+data Bar
+    = Bar {bar_x1_1 :: CInt
+           {- ^ Comment attached to @foo::bar::x1_1@ .
+
+                This comment must be preserved, even though the enclosing declaration uses an unsupported feature.
+
+                __C declaration:__ @x1_1@
+
+                __defined at:__ @types\/scoping\/nesting.h 21:9@
+
+                __exported by:__ @types\/scoping\/nesting.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Bar
+    where readRaw = \ptr_0 -> pure Bar <*> readRaw (Proxy @"bar_x1_1") ptr_0
+instance WriteRaw Bar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar bar_x1_1_2 -> writeRaw (Proxy @"bar_x1_1") ptr_0 bar_x1_1_2
+deriving via (EquivStorable Bar) instance Storable Bar
+deriving via (IsStructViaReadRaw Bar) instance IsStruct Bar
+instance (~) ty CInt => HasField "bar_x1_1" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_x1_1 = y_1},
+                              getField @"bar_x1_1" x_0)
+instance (~) ty CInt => HasField "bar_x1_1" (Ptr Bar) (Ptr ty)
+    where getField = fromPtr (Proxy @"bar_x1_1")
+instance HasCField Bar "bar_x1_1"
+    where type CFieldType Bar "bar_x1_1" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_typesscopingnesting_Example_get_X@
+foreign import ccall unsafe "hs_bindgen_7640032abd722ca9" hs_bindgen_7640032abd722ca9_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesscopingnesting_Example_get_X@
+hs_bindgen_7640032abd722ca9 :: IO (Ptr Bar)
+-- __unique:__ @test_typesscopingnesting_Example_get_X@
+hs_bindgen_7640032abd722ca9 = fmap fromFFIType hs_bindgen_7640032abd722ca9_base
+{-# NOINLINE x #-}
+{-| __C declaration:__ @X@
+
+    __defined at:__ @types\/scoping\/nesting.h 26:19@
+
+    __exported by:__ @types\/scoping\/nesting.h@
+-}
+x :: Ptr Bar
+{-| __C declaration:__ @X@
+
+    __defined at:__ @types\/scoping\/nesting.h 26:19@
+
+    __exported by:__ @types\/scoping\/nesting.h@
+-}
+x = unsafePerformIO hs_bindgen_7640032abd722ca9
diff --git a/test-artefacts/fixtures/types/scoping/wide_nesting/Example.hs b/test-artefacts/fixtures/types/scoping/wide_nesting/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/wide_nesting/Example.hs
@@ -0,0 +1,92 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Baz(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct baz@
+
+    __defined at:__ @types\/scoping\/wide_nesting.h 21:10@
+
+    __exported by:__ @types\/scoping\/wide_nesting.h@
+-}
+data Baz = Baz
+  { baz_x3_1 :: BG.CInt
+    {- ^ __C declaration:__ @x3_1@
+
+         __defined at:__ @types\/scoping\/wide_nesting.h 22:9@
+
+         __exported by:__ @types\/scoping\/wide_nesting.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Baz where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Baz where
+
+  readRaw =
+    \ptr0 ->
+          pure Baz
+      <*> HasCField.readRaw (BG.Proxy @"baz_x3_1") ptr0
+
+instance Marshal.WriteRaw Baz where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Baz baz_x3_12 ->
+            HasCField.writeRaw (BG.Proxy @"baz_x3_1") ptr0 baz_x3_12
+
+deriving via Marshal.EquivStorable Baz instance BG.Storable Baz
+
+deriving via Struct.IsStructViaReadRaw Baz instance Struct.IsStruct Baz
+
+{-| __C declaration:__ @x3_1@
+
+    __defined at:__ @types\/scoping\/wide_nesting.h 22:9@
+
+    __exported by:__ @types\/scoping\/wide_nesting.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "baz_x3_1" Baz ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Baz {baz_x3_1 = y1}, BG.getField @"baz_x3_1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "baz_x3_1" (BG.Ptr Baz) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"baz_x3_1")
+
+instance HasCField.HasCField Baz "baz_x3_1" where
+
+  type CFieldType Baz "baz_x3_1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/scoping/wide_nesting/Example/Global.hs b/test-artefacts/fixtures/types/scoping/wide_nesting/Example/Global.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/wide_nesting/Example/Global.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Global
+    ( Example.Global.x
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/scoping/wide_nesting.h>"
+  , "/* test_typesscopingwide_nesting_Example_get_X */"
+  , "__attribute__ ((const))"
+  , "struct baz *hs_bindgen_a295757aed8ccce9 (void)"
+  , "{"
+  , "  return &X;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesscopingwide_nesting_Example_get_X@
+foreign import ccall unsafe "hs_bindgen_a295757aed8ccce9" hs_bindgen_a295757aed8ccce9_base ::
+     IO (BG.Ptr BG.Void)
+
+-- __unique:__ @test_typesscopingwide_nesting_Example_get_X@
+hs_bindgen_a295757aed8ccce9 :: IO (BG.Ptr Baz)
+hs_bindgen_a295757aed8ccce9 =
+  fmap BG.fromFFIType hs_bindgen_a295757aed8ccce9_base
+
+{-# NOINLINE x #-}
+{-| __C declaration:__ @X@
+
+    __defined at:__ @types\/scoping\/wide_nesting.h 26:19@
+
+    __exported by:__ @types\/scoping\/wide_nesting.h@
+-}
+x :: BG.Ptr Baz
+x = BG.unsafePerformIO hs_bindgen_a295757aed8ccce9
diff --git a/test-artefacts/fixtures/types/scoping/wide_nesting/bindingspec.yaml b/test-artefacts/fixtures/types/scoping/wide_nesting/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/wide_nesting/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/scoping/wide_nesting.h
+  cname: struct baz
+  hsname: Baz
+hstypes:
+- hsname: Baz
+  representation:
+    record:
+      constructor: Baz
+      fields:
+      - baz_x3_1
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/scoping/wide_nesting/th.txt b/test-artefacts/fixtures/types/scoping/wide_nesting/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/scoping/wide_nesting/th.txt
@@ -0,0 +1,63 @@
+-- addDependentFile test-artefacts/headers/golden/types/scoping/wide_nesting.h
+-- #include <types/scoping/wide_nesting.h>
+-- /* test_typesscopingwide_nesting_Example_get_X */
+-- __attribute__ ((const))
+-- struct baz *hs_bindgen_a295757aed8ccce9 (void)
+-- {
+--   return &X;
+-- }
+{-| __C declaration:__ @struct baz@
+
+    __defined at:__ @types\/scoping\/wide_nesting.h 21:10@
+
+    __exported by:__ @types\/scoping\/wide_nesting.h@
+-}
+data Baz
+    = Baz {baz_x3_1 :: CInt
+           {- ^ __C declaration:__ @x3_1@
+
+                __defined at:__ @types\/scoping\/wide_nesting.h 22:9@
+
+                __exported by:__ @types\/scoping\/wide_nesting.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Baz
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Baz
+    where readRaw = \ptr_0 -> pure Baz <*> readRaw (Proxy @"baz_x3_1") ptr_0
+instance WriteRaw Baz
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Baz baz_x3_1_2 -> writeRaw (Proxy @"baz_x3_1") ptr_0 baz_x3_1_2
+deriving via (EquivStorable Baz) instance Storable Baz
+deriving via (IsStructViaReadRaw Baz) instance IsStruct Baz
+instance (~) ty CInt => HasField "baz_x3_1" Baz ty
+    where hasField = \x_0 -> (\y_1 -> Baz{baz_x3_1 = y_1},
+                              getField @"baz_x3_1" x_0)
+instance (~) ty CInt => HasField "baz_x3_1" (Ptr Baz) (Ptr ty)
+    where getField = fromPtr (Proxy @"baz_x3_1")
+instance HasCField Baz "baz_x3_1"
+    where type CFieldType Baz "baz_x3_1" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_typesscopingwide_nesting_Example_get_X@
+foreign import ccall unsafe "hs_bindgen_a295757aed8ccce9" hs_bindgen_a295757aed8ccce9_base ::
+    IO (Ptr Void)
+-- __unique:__ @test_typesscopingwide_nesting_Example_get_X@
+hs_bindgen_a295757aed8ccce9 :: IO (Ptr Baz)
+-- __unique:__ @test_typesscopingwide_nesting_Example_get_X@
+hs_bindgen_a295757aed8ccce9 = fmap fromFFIType hs_bindgen_a295757aed8ccce9_base
+{-# NOINLINE x #-}
+{-| __C declaration:__ @X@
+
+    __defined at:__ @types\/scoping\/wide_nesting.h 26:19@
+
+    __exported by:__ @types\/scoping\/wide_nesting.h@
+-}
+x :: Ptr Baz
+{-| __C declaration:__ @X@
+
+    __defined at:__ @types\/scoping\/wide_nesting.h 26:19@
+
+    __exported by:__ @types\/scoping\/wide_nesting.h@
+-}
+x = unsafePerformIO hs_bindgen_a295757aed8ccce9
diff --git a/test-artefacts/fixtures/types/special/long_double/bindingspec.yaml b/test-artefacts/fixtures/types/special/long_double/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/long_double/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/types/special/long_double/th.txt b/test-artefacts/fixtures/types/special/long_double/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/long_double/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/types/special/long_double.h
diff --git a/test-artefacts/fixtures/types/special/parse_failure_long_double/Example.hs b/test-artefacts/fixtures/types/special/parse_failure_long_double/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/parse_failure_long_double/Example.hs
@@ -0,0 +1,94 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Struct2(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 13:8@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+data Struct2 = Struct2
+  { struct2_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/special\/parse_failure_long_double.h 14:7@
+
+         __exported by:__ @types\/special\/parse_failure_long_double.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct2 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Struct2 where
+
+  readRaw =
+    \ptr0 ->
+          pure Struct2
+      <*> HasCField.readRaw (BG.Proxy @"struct2_x") ptr0
+
+instance Marshal.WriteRaw Struct2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct2 struct2_x2 ->
+            HasCField.writeRaw (BG.Proxy @"struct2_x") ptr0 struct2_x2
+
+deriving via Marshal.EquivStorable Struct2 instance BG.Storable Struct2
+
+deriving via Struct.IsStructViaReadRaw Struct2 instance Struct.IsStruct Struct2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 14:7@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "struct2_x" Struct2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Struct2 {struct2_x = y1}, BG.getField @"struct2_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "struct2_x" (BG.Ptr Struct2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"struct2_x")
+
+instance HasCField.HasCField Struct2 "struct2_x" where
+
+  type CFieldType Struct2 "struct2_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/special/parse_failure_long_double/Example/FunPtr.hs b/test-artefacts/fixtures/types/special/parse_failure_long_double/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/parse_failure_long_double/Example/FunPtr.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.fun2
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/special/parse_failure_long_double.h>"
+  , "/* test_typesspecialparse_failure_lo_Example_get_fun2 */"
+  , "__attribute__ ((const))"
+  , "void (*hs_bindgen_d61a16f2d29260ed (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &fun2;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_get_fun2@
+foreign import ccall unsafe "hs_bindgen_d61a16f2d29260ed" hs_bindgen_d61a16f2d29260ed_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_get_fun2@
+hs_bindgen_d61a16f2d29260ed :: IO (BG.FunPtr (BG.CInt -> IO ()))
+hs_bindgen_d61a16f2d29260ed =
+  fmap BG.fromFFIType hs_bindgen_d61a16f2d29260ed_base
+
+{-# NOINLINE fun2 #-}
+{-| __C declaration:__ @fun2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 7:6@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+fun2 :: BG.FunPtr (BG.CInt -> IO ())
+fun2 = BG.unsafePerformIO hs_bindgen_d61a16f2d29260ed
diff --git a/test-artefacts/fixtures/types/special/parse_failure_long_double/Example/Safe.hs b/test-artefacts/fixtures/types/special/parse_failure_long_double/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/parse_failure_long_double/Example/Safe.hs
@@ -0,0 +1,47 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.fun2
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/special/parse_failure_long_double.h>"
+  , "void hs_bindgen_a1252a3becef09a6 ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (fun2)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Safe_fun2@
+foreign import ccall safe "hs_bindgen_a1252a3becef09a6" hs_bindgen_a1252a3becef09a6_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Safe_fun2@
+hs_bindgen_a1252a3becef09a6 ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_a1252a3becef09a6 =
+  \x0 ->
+    hs_bindgen_a1252a3becef09a6_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fun2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 7:6@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+fun2 ::
+     BG.CInt
+  -> IO ()
+fun2 = hs_bindgen_a1252a3becef09a6
diff --git a/test-artefacts/fixtures/types/special/parse_failure_long_double/Example/Unsafe.hs b/test-artefacts/fixtures/types/special/parse_failure_long_double/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/parse_failure_long_double/Example/Unsafe.hs
@@ -0,0 +1,47 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.fun2
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Prelude (IO)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/special/parse_failure_long_double.h>"
+  , "void hs_bindgen_61793546aa44e36b ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  (fun2)(arg1);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Unsafe_fun2@
+foreign import ccall unsafe "hs_bindgen_61793546aa44e36b" hs_bindgen_61793546aa44e36b_base ::
+     BG.CInt
+  -> IO ()
+
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Unsafe_fun2@
+hs_bindgen_61793546aa44e36b ::
+     BG.CInt
+  -> IO ()
+hs_bindgen_61793546aa44e36b =
+  \x0 ->
+    hs_bindgen_61793546aa44e36b_base (BG.toFFIType x0)
+
+{-| __C declaration:__ @fun2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 7:6@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+fun2 ::
+     BG.CInt
+  -> IO ()
+fun2 = hs_bindgen_61793546aa44e36b
diff --git a/test-artefacts/fixtures/types/special/parse_failure_long_double/bindingspec.yaml b/test-artefacts/fixtures/types/special/parse_failure_long_double/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/parse_failure_long_double/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/special/parse_failure_long_double.h
+  cname: struct struct2
+  hsname: Struct2
+hstypes:
+- hsname: Struct2
+  representation:
+    record:
+      constructor: Struct2
+      fields:
+      - struct2_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/special/parse_failure_long_double/th.txt b/test-artefacts/fixtures/types/special/parse_failure_long_double/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/parse_failure_long_double/th.txt
@@ -0,0 +1,121 @@
+-- addDependentFile test-artefacts/headers/golden/types/special/parse_failure_long_double.h
+-- #include <types/special/parse_failure_long_double.h>
+-- void hs_bindgen_a1252a3becef09a6 (
+--   signed int arg1
+-- )
+-- {
+--   (fun2)(arg1);
+-- }
+-- void hs_bindgen_61793546aa44e36b (
+--   signed int arg1
+-- )
+-- {
+--   (fun2)(arg1);
+-- }
+-- /* test_typesspecialparse_failure_lo_Example_get_fun2 */
+-- __attribute__ ((const))
+-- void (*hs_bindgen_d61a16f2d29260ed (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &fun2;
+-- }
+{-| __C declaration:__ @struct struct2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 13:8@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+data Struct2
+    = Struct2 {struct2_x :: CInt
+               {- ^ __C declaration:__ @x@
+
+                    __defined at:__ @types\/special\/parse_failure_long_double.h 14:7@
+
+                    __exported by:__ @types\/special\/parse_failure_long_double.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Struct2
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Struct2
+    where readRaw = \ptr_0 -> pure Struct2 <*> readRaw (Proxy @"struct2_x") ptr_0
+instance WriteRaw Struct2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct2 struct2_x_2 -> writeRaw (Proxy @"struct2_x") ptr_0 struct2_x_2
+deriving via (EquivStorable Struct2) instance Storable Struct2
+deriving via (IsStructViaReadRaw Struct2) instance IsStruct Struct2
+instance (~) ty CInt => HasField "struct2_x" Struct2 ty
+    where hasField = \x_0 -> (\y_1 -> Struct2{struct2_x = y_1},
+                              getField @"struct2_x" x_0)
+instance (~) ty CInt => HasField "struct2_x" (Ptr Struct2) (Ptr ty)
+    where getField = fromPtr (Proxy @"struct2_x")
+instance HasCField Struct2 "struct2_x"
+    where type CFieldType Struct2 "struct2_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Safe_fun2@
+foreign import ccall safe "hs_bindgen_a1252a3becef09a6" hs_bindgen_a1252a3becef09a6_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Safe_fun2@
+hs_bindgen_a1252a3becef09a6 :: CInt -> IO ()
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Safe_fun2@
+hs_bindgen_a1252a3becef09a6 = \x_0 -> hs_bindgen_a1252a3becef09a6_base (toFFIType x_0)
+{-| __C declaration:__ @fun2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 7:6@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+fun2_safe :: CInt -> IO ()
+{-| __C declaration:__ @fun2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 7:6@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+fun2_safe = hs_bindgen_a1252a3becef09a6
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Unsafe_fun2@
+foreign import ccall unsafe "hs_bindgen_61793546aa44e36b" hs_bindgen_61793546aa44e36b_base ::
+    CInt
+ -> IO ()
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Unsafe_fun2@
+hs_bindgen_61793546aa44e36b :: CInt -> IO ()
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_Unsafe_fun2@
+hs_bindgen_61793546aa44e36b = \x_0 -> hs_bindgen_61793546aa44e36b_base (toFFIType x_0)
+{-| __C declaration:__ @fun2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 7:6@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+fun2_unsafe :: CInt -> IO ()
+{-| __C declaration:__ @fun2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 7:6@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+fun2_unsafe = hs_bindgen_61793546aa44e36b
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_get_fun2@
+foreign import ccall unsafe "hs_bindgen_d61a16f2d29260ed" hs_bindgen_d61a16f2d29260ed_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_get_fun2@
+hs_bindgen_d61a16f2d29260ed :: IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @test_typesspecialparse_failure_lo_Example_get_fun2@
+hs_bindgen_d61a16f2d29260ed = fmap fromFFIType hs_bindgen_d61a16f2d29260ed_base
+{-# NOINLINE fun2_funptr #-}
+{-| __C declaration:__ @fun2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 7:6@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+fun2_funptr :: FunPtr (CInt -> IO ())
+{-| __C declaration:__ @fun2@
+
+    __defined at:__ @types\/special\/parse_failure_long_double.h 7:6@
+
+    __exported by:__ @types\/special\/parse_failure_long_double.h@
+-}
+fun2_funptr = unsafePerformIO hs_bindgen_d61a16f2d29260ed
diff --git a/test-artefacts/fixtures/types/special/small_floats/bindingspec.yaml b/test-artefacts/fixtures/types/special/small_floats/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/small_floats/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/types/special/small_floats/th.txt b/test-artefacts/fixtures/types/special/small_floats/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/special/small_floats/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/types/special/small_floats.h
diff --git a/test-artefacts/fixtures/types/structs/bitfields/Example.hs b/test-artefacts/fixtures/types/structs/bitfields/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/bitfields/Example.hs
@@ -0,0 +1,2294 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo_8(..)
+    , Example.Foo_16(..)
+    , Example.Foo_32(..)
+    , Example.Foo_64(..)
+    , Example.Bar_8_8(..)
+    , Example.Bar_8_16(..)
+    , Example.Bar_8_32(..)
+    , Example.Bar_8_64(..)
+    , Example.Bar_16_16(..)
+    , Example.Bar_16_32(..)
+    , Example.Bar_16_64(..)
+    , Example.Bar_32_32(..)
+    , Example.Bar_32_64(..)
+    , Example.Bar_64_64(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.BitfieldPtr as BitfieldPtr
+import qualified HsBindgen.Runtime.HasCBitfield as HasCBitfield
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct foo_8@
+
+    __defined at:__ @types\/structs\/bitfields.h 5:8@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Foo_8 = Foo_8
+  { foo_8_a :: BG.CSChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 6:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_8_b :: BG.CSChar
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 7:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_8_c :: BG.CSChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/bitfields.h 8:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_8_d :: BG.CSChar
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @types\/structs\/bitfields.h 9:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_8_e :: BG.CSChar
+    {- ^ __C declaration:__ @e@
+
+         __defined at:__ @types\/structs\/bitfields.h 10:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_8_f :: BG.CSChar
+    {- ^ __C declaration:__ @f@
+
+         __defined at:__ @types\/structs\/bitfields.h 11:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo_8 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Foo_8 where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo_8
+      <*> HasCBitfield.peek (BG.Proxy @"foo_8_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_8_b") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_8_c") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_8_d") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_8_e") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_8_f") ptr0
+
+instance Marshal.WriteRaw Foo_8 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo_8 foo_8_a2 foo_8_b3 foo_8_c4 foo_8_d5 foo_8_e6 foo_8_f7 ->
+               HasCBitfield.poke (BG.Proxy @"foo_8_a") ptr0 foo_8_a2
+            >> HasCBitfield.poke (BG.Proxy @"foo_8_b") ptr0 foo_8_b3
+            >> HasCBitfield.poke (BG.Proxy @"foo_8_c") ptr0 foo_8_c4
+            >> HasCBitfield.poke (BG.Proxy @"foo_8_d") ptr0 foo_8_d5
+            >> HasCBitfield.poke (BG.Proxy @"foo_8_e") ptr0 foo_8_e6
+            >> HasCBitfield.poke (BG.Proxy @"foo_8_f") ptr0 foo_8_f7
+
+deriving via Marshal.EquivStorable Foo_8 instance BG.Storable Foo_8
+
+deriving via Struct.IsStructViaReadRaw Foo_8 instance Struct.IsStruct Foo_8
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 6:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_a" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_8 { foo_8_a = y1
+                , foo_8_b = BG.getField @"foo_8_b" x0
+                , foo_8_c = BG.getField @"foo_8_c" x0
+                , foo_8_d = BG.getField @"foo_8_d" x0
+                , foo_8_e = BG.getField @"foo_8_e" x0
+                , foo_8_f = BG.getField @"foo_8_f" x0
+                }
+      , BG.getField @"foo_8_a" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_a" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_a")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_a" where
+
+  type CBitfieldType Foo_8 "foo_8_a" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 7:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_b" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_8 { foo_8_b = y1
+                , foo_8_a = BG.getField @"foo_8_a" x0
+                , foo_8_c = BG.getField @"foo_8_c" x0
+                , foo_8_d = BG.getField @"foo_8_d" x0
+                , foo_8_e = BG.getField @"foo_8_e" x0
+                , foo_8_f = BG.getField @"foo_8_f" x0
+                }
+      , BG.getField @"foo_8_b" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_b" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_b")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_b" where
+
+  type CBitfieldType Foo_8 "foo_8_b" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 3
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/bitfields.h 8:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_c" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_8 { foo_8_c = y1
+                , foo_8_a = BG.getField @"foo_8_a" x0
+                , foo_8_b = BG.getField @"foo_8_b" x0
+                , foo_8_d = BG.getField @"foo_8_d" x0
+                , foo_8_e = BG.getField @"foo_8_e" x0
+                , foo_8_f = BG.getField @"foo_8_f" x0
+                }
+      , BG.getField @"foo_8_c" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_c" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_c")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_c" where
+
+  type CBitfieldType Foo_8 "foo_8_c" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 6
+
+  bitfieldWidth# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/structs\/bitfields.h 9:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_d" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_8 { foo_8_d = y1
+                , foo_8_a = BG.getField @"foo_8_a" x0
+                , foo_8_b = BG.getField @"foo_8_b" x0
+                , foo_8_c = BG.getField @"foo_8_c" x0
+                , foo_8_e = BG.getField @"foo_8_e" x0
+                , foo_8_f = BG.getField @"foo_8_f" x0
+                }
+      , BG.getField @"foo_8_d" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_d" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_d")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_d" where
+
+  type CBitfieldType Foo_8 "foo_8_d" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 8
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/structs\/bitfields.h 10:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_e" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_8 { foo_8_e = y1
+                , foo_8_a = BG.getField @"foo_8_a" x0
+                , foo_8_b = BG.getField @"foo_8_b" x0
+                , foo_8_c = BG.getField @"foo_8_c" x0
+                , foo_8_d = BG.getField @"foo_8_d" x0
+                , foo_8_f = BG.getField @"foo_8_f" x0
+                }
+      , BG.getField @"foo_8_e" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_e" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_e")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_e" where
+
+  type CBitfieldType Foo_8 "foo_8_e" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 16
+
+  bitfieldWidth# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/structs\/bitfields.h 11:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_f" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_8 { foo_8_f = y1
+                , foo_8_a = BG.getField @"foo_8_a" x0
+                , foo_8_b = BG.getField @"foo_8_b" x0
+                , foo_8_c = BG.getField @"foo_8_c" x0
+                , foo_8_d = BG.getField @"foo_8_d" x0
+                , foo_8_e = BG.getField @"foo_8_e" x0
+                }
+      , BG.getField @"foo_8_f" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_f" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_f")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_f" where
+
+  type CBitfieldType Foo_8 "foo_8_f" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 24
+
+  bitfieldWidth# = \_ -> \_ -> 5
+
+{-| __C declaration:__ @struct foo_16@
+
+    __defined at:__ @types\/structs\/bitfields.h 15:8@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Foo_16 = Foo_16
+  { foo_16_a :: BG.CSChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 16:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_16_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 17:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_16_c :: BG.CInt
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/bitfields.h 18:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_16_d :: BG.CInt
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @types\/structs\/bitfields.h 19:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_16_e :: BG.CInt
+    {- ^ __C declaration:__ @e@
+
+         __defined at:__ @types\/structs\/bitfields.h 20:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_16_f :: BG.CInt
+    {- ^ __C declaration:__ @f@
+
+         __defined at:__ @types\/structs\/bitfields.h 21:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo_16 where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Foo_16 where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo_16
+      <*> HasCBitfield.peek (BG.Proxy @"foo_16_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_16_b") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_16_c") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_16_d") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_16_e") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_16_f") ptr0
+
+instance Marshal.WriteRaw Foo_16 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo_16 foo_16_a2 foo_16_b3 foo_16_c4 foo_16_d5 foo_16_e6 foo_16_f7 ->
+               HasCBitfield.poke (BG.Proxy @"foo_16_a") ptr0 foo_16_a2
+            >> HasCBitfield.poke (BG.Proxy @"foo_16_b") ptr0 foo_16_b3
+            >> HasCBitfield.poke (BG.Proxy @"foo_16_c") ptr0 foo_16_c4
+            >> HasCBitfield.poke (BG.Proxy @"foo_16_d") ptr0 foo_16_d5
+            >> HasCBitfield.poke (BG.Proxy @"foo_16_e") ptr0 foo_16_e6
+            >> HasCBitfield.poke (BG.Proxy @"foo_16_f") ptr0 foo_16_f7
+
+deriving via Marshal.EquivStorable Foo_16 instance BG.Storable Foo_16
+
+deriving via Struct.IsStructViaReadRaw Foo_16 instance Struct.IsStruct Foo_16
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 16:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_16_a" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_16 { foo_16_a = y1
+                 , foo_16_b = BG.getField @"foo_16_b" x0
+                 , foo_16_c = BG.getField @"foo_16_c" x0
+                 , foo_16_d = BG.getField @"foo_16_d" x0
+                 , foo_16_e = BG.getField @"foo_16_e" x0
+                 , foo_16_f = BG.getField @"foo_16_f" x0
+                 }
+      , BG.getField @"foo_16_a" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_16_a" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_a")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_a" where
+
+  type CBitfieldType Foo_16 "foo_16_a" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 17:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_b" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_16 { foo_16_b = y1
+                 , foo_16_a = BG.getField @"foo_16_a" x0
+                 , foo_16_c = BG.getField @"foo_16_c" x0
+                 , foo_16_d = BG.getField @"foo_16_d" x0
+                 , foo_16_e = BG.getField @"foo_16_e" x0
+                 , foo_16_f = BG.getField @"foo_16_f" x0
+                 }
+      , BG.getField @"foo_16_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_b" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_b")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_b" where
+
+  type CBitfieldType Foo_16 "foo_16_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 6
+
+  bitfieldWidth# = \_ -> \_ -> 10
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/bitfields.h 18:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_c" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_16 { foo_16_c = y1
+                 , foo_16_a = BG.getField @"foo_16_a" x0
+                 , foo_16_b = BG.getField @"foo_16_b" x0
+                 , foo_16_d = BG.getField @"foo_16_d" x0
+                 , foo_16_e = BG.getField @"foo_16_e" x0
+                 , foo_16_f = BG.getField @"foo_16_f" x0
+                 }
+      , BG.getField @"foo_16_c" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_c" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_c")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_c" where
+
+  type CBitfieldType Foo_16 "foo_16_c" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 16
+
+  bitfieldWidth# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/structs\/bitfields.h 19:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_d" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_16 { foo_16_d = y1
+                 , foo_16_a = BG.getField @"foo_16_a" x0
+                 , foo_16_b = BG.getField @"foo_16_b" x0
+                 , foo_16_c = BG.getField @"foo_16_c" x0
+                 , foo_16_e = BG.getField @"foo_16_e" x0
+                 , foo_16_f = BG.getField @"foo_16_f" x0
+                 }
+      , BG.getField @"foo_16_d" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_d" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_d")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_d" where
+
+  type CBitfieldType Foo_16 "foo_16_d" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 32
+
+  bitfieldWidth# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/structs\/bitfields.h 20:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_e" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_16 { foo_16_e = y1
+                 , foo_16_a = BG.getField @"foo_16_a" x0
+                 , foo_16_b = BG.getField @"foo_16_b" x0
+                 , foo_16_c = BG.getField @"foo_16_c" x0
+                 , foo_16_d = BG.getField @"foo_16_d" x0
+                 , foo_16_f = BG.getField @"foo_16_f" x0
+                 }
+      , BG.getField @"foo_16_e" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_e" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_e")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_e" where
+
+  type CBitfieldType Foo_16 "foo_16_e" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 48
+
+  bitfieldWidth# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/structs\/bitfields.h 21:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_f" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_16 { foo_16_f = y1
+                 , foo_16_a = BG.getField @"foo_16_a" x0
+                 , foo_16_b = BG.getField @"foo_16_b" x0
+                 , foo_16_c = BG.getField @"foo_16_c" x0
+                 , foo_16_d = BG.getField @"foo_16_d" x0
+                 , foo_16_e = BG.getField @"foo_16_e" x0
+                 }
+      , BG.getField @"foo_16_f" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_f" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_f")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_f" where
+
+  type CBitfieldType Foo_16 "foo_16_f" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 64
+
+  bitfieldWidth# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @struct foo_32@
+
+    __defined at:__ @types\/structs\/bitfields.h 25:8@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Foo_32 = Foo_32
+  { foo_32_a :: BG.CSChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 26:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_32_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 27:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_32_c :: BG.CInt
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/bitfields.h 28:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_32_d :: BG.CInt
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @types\/structs\/bitfields.h 29:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_32_e :: BG.CLong
+    {- ^ __C declaration:__ @e@
+
+         __defined at:__ @types\/structs\/bitfields.h 30:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_32_f :: BG.CInt
+    {- ^ __C declaration:__ @f@
+
+         __defined at:__ @types\/structs\/bitfields.h 31:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_32_g :: BG.CLong
+    {- ^ __C declaration:__ @g@
+
+         __defined at:__ @types\/structs\/bitfields.h 32:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo_32 where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Foo_32 where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo_32
+      <*> HasCBitfield.peek (BG.Proxy @"foo_32_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_32_b") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_32_c") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_32_d") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_32_e") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_32_f") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_32_g") ptr0
+
+instance Marshal.WriteRaw Foo_32 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo_32 foo_32_a2 foo_32_b3 foo_32_c4 foo_32_d5 foo_32_e6 foo_32_f7 foo_32_g8 ->
+               HasCBitfield.poke (BG.Proxy @"foo_32_a") ptr0 foo_32_a2
+            >> HasCBitfield.poke (BG.Proxy @"foo_32_b") ptr0 foo_32_b3
+            >> HasCBitfield.poke (BG.Proxy @"foo_32_c") ptr0 foo_32_c4
+            >> HasCBitfield.poke (BG.Proxy @"foo_32_d") ptr0 foo_32_d5
+            >> HasCBitfield.poke (BG.Proxy @"foo_32_e") ptr0 foo_32_e6
+            >> HasCBitfield.poke (BG.Proxy @"foo_32_f") ptr0 foo_32_f7
+            >> HasCBitfield.poke (BG.Proxy @"foo_32_g") ptr0 foo_32_g8
+
+deriving via Marshal.EquivStorable Foo_32 instance BG.Storable Foo_32
+
+deriving via Struct.IsStructViaReadRaw Foo_32 instance Struct.IsStruct Foo_32
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 26:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_32_a" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_32 { foo_32_a = y1
+                 , foo_32_b = BG.getField @"foo_32_b" x0
+                 , foo_32_c = BG.getField @"foo_32_c" x0
+                 , foo_32_d = BG.getField @"foo_32_d" x0
+                 , foo_32_e = BG.getField @"foo_32_e" x0
+                 , foo_32_f = BG.getField @"foo_32_f" x0
+                 , foo_32_g = BG.getField @"foo_32_g" x0
+                 }
+      , BG.getField @"foo_32_a" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_32_a" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_a")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_a" where
+
+  type CBitfieldType Foo_32 "foo_32_a" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 27:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_32_b" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_32 { foo_32_b = y1
+                 , foo_32_a = BG.getField @"foo_32_a" x0
+                 , foo_32_c = BG.getField @"foo_32_c" x0
+                 , foo_32_d = BG.getField @"foo_32_d" x0
+                 , foo_32_e = BG.getField @"foo_32_e" x0
+                 , foo_32_f = BG.getField @"foo_32_f" x0
+                 , foo_32_g = BG.getField @"foo_32_g" x0
+                 }
+      , BG.getField @"foo_32_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_b" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_b")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_b" where
+
+  type CBitfieldType Foo_32 "foo_32_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 6
+
+  bitfieldWidth# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/bitfields.h 28:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_32_c" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_32 { foo_32_c = y1
+                 , foo_32_a = BG.getField @"foo_32_a" x0
+                 , foo_32_b = BG.getField @"foo_32_b" x0
+                 , foo_32_d = BG.getField @"foo_32_d" x0
+                 , foo_32_e = BG.getField @"foo_32_e" x0
+                 , foo_32_f = BG.getField @"foo_32_f" x0
+                 , foo_32_g = BG.getField @"foo_32_g" x0
+                 }
+      , BG.getField @"foo_32_c" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_c" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_c")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_c" where
+
+  type CBitfieldType Foo_32 "foo_32_c" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 18
+
+  bitfieldWidth# = \_ -> \_ -> 14
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/structs\/bitfields.h 29:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_32_d" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_32 { foo_32_d = y1
+                 , foo_32_a = BG.getField @"foo_32_a" x0
+                 , foo_32_b = BG.getField @"foo_32_b" x0
+                 , foo_32_c = BG.getField @"foo_32_c" x0
+                 , foo_32_e = BG.getField @"foo_32_e" x0
+                 , foo_32_f = BG.getField @"foo_32_f" x0
+                 , foo_32_g = BG.getField @"foo_32_g" x0
+                 }
+      , BG.getField @"foo_32_d" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_d" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_d")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_d" where
+
+  type CBitfieldType Foo_32 "foo_32_d" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 32
+
+  bitfieldWidth# = \_ -> \_ -> 10
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/structs\/bitfields.h 30:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "foo_32_e" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_32 { foo_32_e = y1
+                 , foo_32_a = BG.getField @"foo_32_a" x0
+                 , foo_32_b = BG.getField @"foo_32_b" x0
+                 , foo_32_c = BG.getField @"foo_32_c" x0
+                 , foo_32_d = BG.getField @"foo_32_d" x0
+                 , foo_32_f = BG.getField @"foo_32_f" x0
+                 , foo_32_g = BG.getField @"foo_32_g" x0
+                 }
+      , BG.getField @"foo_32_e" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "foo_32_e" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_e")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_e" where
+
+  type CBitfieldType Foo_32 "foo_32_e" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 64
+
+  bitfieldWidth# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/structs\/bitfields.h 31:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_32_f" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_32 { foo_32_f = y1
+                 , foo_32_a = BG.getField @"foo_32_a" x0
+                 , foo_32_b = BG.getField @"foo_32_b" x0
+                 , foo_32_c = BG.getField @"foo_32_c" x0
+                 , foo_32_d = BG.getField @"foo_32_d" x0
+                 , foo_32_e = BG.getField @"foo_32_e" x0
+                 , foo_32_g = BG.getField @"foo_32_g" x0
+                 }
+      , BG.getField @"foo_32_f" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_f" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_f")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_f" where
+
+  type CBitfieldType Foo_32 "foo_32_f" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 96
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/structs\/bitfields.h 32:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "foo_32_g" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_32 { foo_32_g = y1
+                 , foo_32_a = BG.getField @"foo_32_a" x0
+                 , foo_32_b = BG.getField @"foo_32_b" x0
+                 , foo_32_c = BG.getField @"foo_32_c" x0
+                 , foo_32_d = BG.getField @"foo_32_d" x0
+                 , foo_32_e = BG.getField @"foo_32_e" x0
+                 , foo_32_f = BG.getField @"foo_32_f" x0
+                 }
+      , BG.getField @"foo_32_g" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "foo_32_g" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_g")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_g" where
+
+  type CBitfieldType Foo_32 "foo_32_g" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 102
+
+  bitfieldWidth# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @struct foo_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 36:8@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Foo_64 = Foo_64
+  { foo_64_a :: BG.CLong
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 37:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_64_b :: BG.CLLong
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 38:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_64_c :: BG.CLLong
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/bitfields.h 39:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , foo_64_d :: BG.CLLong
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @types\/structs\/bitfields.h 40:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo_64 where
+
+  staticSizeOf = \_ -> (24 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Foo_64 where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo_64
+      <*> HasCBitfield.peek (BG.Proxy @"foo_64_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_64_b") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_64_c") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_64_d") ptr0
+
+instance Marshal.WriteRaw Foo_64 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo_64 foo_64_a2 foo_64_b3 foo_64_c4 foo_64_d5 ->
+               HasCBitfield.poke (BG.Proxy @"foo_64_a") ptr0 foo_64_a2
+            >> HasCBitfield.poke (BG.Proxy @"foo_64_b") ptr0 foo_64_b3
+            >> HasCBitfield.poke (BG.Proxy @"foo_64_c") ptr0 foo_64_c4
+            >> HasCBitfield.poke (BG.Proxy @"foo_64_d") ptr0 foo_64_d5
+
+deriving via Marshal.EquivStorable Foo_64 instance BG.Storable Foo_64
+
+deriving via Struct.IsStructViaReadRaw Foo_64 instance Struct.IsStruct Foo_64
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 37:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "foo_64_a" Foo_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_64 { foo_64_a = y1
+                 , foo_64_b = BG.getField @"foo_64_b" x0
+                 , foo_64_c = BG.getField @"foo_64_c" x0
+                 , foo_64_d = BG.getField @"foo_64_d" x0
+                 }
+      , BG.getField @"foo_64_a" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "foo_64_a" (BG.Ptr Foo_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_64_a")
+
+instance HasCBitfield.HasCBitfield Foo_64 "foo_64_a" where
+
+  type CBitfieldType Foo_64 "foo_64_a" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 38:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "foo_64_b" Foo_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_64 { foo_64_b = y1
+                 , foo_64_a = BG.getField @"foo_64_a" x0
+                 , foo_64_c = BG.getField @"foo_64_c" x0
+                 , foo_64_d = BG.getField @"foo_64_d" x0
+                 }
+      , BG.getField @"foo_64_b" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_b" (BG.Ptr Foo_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_64_b")
+
+instance HasCBitfield.HasCBitfield Foo_64 "foo_64_b" where
+
+  type CBitfieldType Foo_64 "foo_64_b" = BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 24
+
+  bitfieldWidth# = \_ -> \_ -> 40
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/bitfields.h 39:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "foo_64_c" Foo_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_64 { foo_64_c = y1
+                 , foo_64_a = BG.getField @"foo_64_a" x0
+                 , foo_64_b = BG.getField @"foo_64_b" x0
+                 , foo_64_d = BG.getField @"foo_64_d" x0
+                 }
+      , BG.getField @"foo_64_c" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_c" (BG.Ptr Foo_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_64_c")
+
+instance HasCBitfield.HasCBitfield Foo_64 "foo_64_c" where
+
+  type CBitfieldType Foo_64 "foo_64_c" = BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 64
+
+  bitfieldWidth# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/structs\/bitfields.h 40:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "foo_64_d" Foo_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo_64 { foo_64_d = y1
+                 , foo_64_a = BG.getField @"foo_64_a" x0
+                 , foo_64_b = BG.getField @"foo_64_b" x0
+                 , foo_64_c = BG.getField @"foo_64_c" x0
+                 }
+      , BG.getField @"foo_64_d" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_d" (BG.Ptr Foo_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_64_d")
+
+instance HasCBitfield.HasCBitfield Foo_64 "foo_64_d" where
+
+  type CBitfieldType Foo_64 "foo_64_d" = BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 128
+
+  bitfieldWidth# = \_ -> \_ -> 36
+
+{-| __C declaration:__ @struct bar_8_8@
+
+    __defined at:__ @types\/structs\/bitfields.h 44:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_8_8 = Bar_8_8
+  { bar_8_8_a :: BG.CSChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 45:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_8_8_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 46:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_8_8 where
+
+  staticSizeOf = \_ -> (2 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_8_8 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_8_8
+      <*> HasCBitfield.peek (BG.Proxy @"bar_8_8_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_8_8_b") ptr0
+
+instance Marshal.WriteRaw Bar_8_8 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_8_8 bar_8_8_a2 bar_8_8_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_8_8_a") ptr0 bar_8_8_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_8_8_b") ptr0 bar_8_8_b3
+
+deriving via Marshal.EquivStorable Bar_8_8 instance BG.Storable Bar_8_8
+
+deriving via Struct.IsStructViaReadRaw Bar_8_8 instance Struct.IsStruct Bar_8_8
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 45:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "bar_8_8_a" Bar_8_8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_8_8 {bar_8_8_a = y1, bar_8_8_b = BG.getField @"bar_8_8_b" x0}
+      , BG.getField @"bar_8_8_a" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "bar_8_8_a" (BG.Ptr Bar_8_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"bar_8_8_a")
+
+instance HasCBitfield.HasCBitfield Bar_8_8 "bar_8_8_a" where
+
+  type CBitfieldType Bar_8_8 "bar_8_8_a" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 46:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_8_8_b" Bar_8_8 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_8_8 {bar_8_8_b = y1, bar_8_8_a = BG.getField @"bar_8_8_a" x0}
+      , BG.getField @"bar_8_8_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_8_8_b" (BG.Ptr Bar_8_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"bar_8_8_b")
+
+instance HasCBitfield.HasCBitfield Bar_8_8 "bar_8_8_b" where
+
+  type CBitfieldType Bar_8_8 "bar_8_8_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 6
+
+  bitfieldWidth# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct bar_8_16@
+
+    __defined at:__ @types\/structs\/bitfields.h 50:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_8_16 = Bar_8_16
+  { bar_8_16_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 51:14@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_8_16_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 52:14@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_8_16 where
+
+  staticSizeOf = \_ -> (3 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_8_16 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_8_16
+      <*> HasCBitfield.peek (BG.Proxy @"bar_8_16_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_8_16_b") ptr0
+
+instance Marshal.WriteRaw Bar_8_16 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_8_16 bar_8_16_a2 bar_8_16_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_8_16_a") ptr0 bar_8_16_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_8_16_b") ptr0 bar_8_16_b3
+
+deriving via Marshal.EquivStorable Bar_8_16 instance BG.Storable Bar_8_16
+
+deriving via Struct.IsStructViaReadRaw Bar_8_16 instance Struct.IsStruct Bar_8_16
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 51:14@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_8_16_a" Bar_8_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_8_16 {bar_8_16_a = y1, bar_8_16_b = BG.getField @"bar_8_16_b" x0}
+      , BG.getField @"bar_8_16_a" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_8_16_a" (BG.Ptr Bar_8_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_8_16_a")
+
+instance HasCBitfield.HasCBitfield Bar_8_16 "bar_8_16_a" where
+
+  type CBitfieldType Bar_8_16 "bar_8_16_a" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 14
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 52:14@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_8_16_b" Bar_8_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_8_16 {bar_8_16_b = y1, bar_8_16_a = BG.getField @"bar_8_16_a" x0}
+      , BG.getField @"bar_8_16_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_8_16_b" (BG.Ptr Bar_8_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_8_16_b")
+
+instance HasCBitfield.HasCBitfield Bar_8_16 "bar_8_16_b" where
+
+  type CBitfieldType Bar_8_16 "bar_8_16_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 14
+
+  bitfieldWidth# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct bar_8_32@
+
+    __defined at:__ @types\/structs\/bitfields.h 56:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_8_32 = Bar_8_32
+  { bar_8_32_a :: BG.CLong
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 57:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_8_32_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 58:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_8_32 where
+
+  staticSizeOf = \_ -> (5 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_8_32 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_8_32
+      <*> HasCBitfield.peek (BG.Proxy @"bar_8_32_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_8_32_b") ptr0
+
+instance Marshal.WriteRaw Bar_8_32 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_8_32 bar_8_32_a2 bar_8_32_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_8_32_a") ptr0 bar_8_32_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_8_32_b") ptr0 bar_8_32_b3
+
+deriving via Marshal.EquivStorable Bar_8_32 instance BG.Storable Bar_8_32
+
+deriving via Struct.IsStructViaReadRaw Bar_8_32 instance Struct.IsStruct Bar_8_32
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 57:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "bar_8_32_a" Bar_8_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_8_32 {bar_8_32_a = y1, bar_8_32_b = BG.getField @"bar_8_32_b" x0}
+      , BG.getField @"bar_8_32_a" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "bar_8_32_a" (BG.Ptr Bar_8_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_8_32_a")
+
+instance HasCBitfield.HasCBitfield Bar_8_32 "bar_8_32_a" where
+
+  type CBitfieldType Bar_8_32 "bar_8_32_a" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 30
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 58:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_8_32_b" Bar_8_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_8_32 {bar_8_32_b = y1, bar_8_32_a = BG.getField @"bar_8_32_a" x0}
+      , BG.getField @"bar_8_32_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_8_32_b" (BG.Ptr Bar_8_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_8_32_b")
+
+instance HasCBitfield.HasCBitfield Bar_8_32 "bar_8_32_b" where
+
+  type CBitfieldType Bar_8_32 "bar_8_32_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 30
+
+  bitfieldWidth# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct bar_8_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 62:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_8_64 = Bar_8_64
+  { bar_8_64_a :: BG.CLLong
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 63:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_8_64_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 64:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_8_64 where
+
+  staticSizeOf = \_ -> (9 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_8_64 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_8_64
+      <*> HasCBitfield.peek (BG.Proxy @"bar_8_64_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_8_64_b") ptr0
+
+instance Marshal.WriteRaw Bar_8_64 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_8_64 bar_8_64_a2 bar_8_64_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_8_64_a") ptr0 bar_8_64_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_8_64_b") ptr0 bar_8_64_b3
+
+deriving via Marshal.EquivStorable Bar_8_64 instance BG.Storable Bar_8_64
+
+deriving via Struct.IsStructViaReadRaw Bar_8_64 instance Struct.IsStruct Bar_8_64
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 63:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "bar_8_64_a" Bar_8_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_8_64 {bar_8_64_a = y1, bar_8_64_b = BG.getField @"bar_8_64_b" x0}
+      , BG.getField @"bar_8_64_a" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "bar_8_64_a" (BG.Ptr Bar_8_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_8_64_a")
+
+instance HasCBitfield.HasCBitfield Bar_8_64 "bar_8_64_a" where
+
+  type CBitfieldType Bar_8_64 "bar_8_64_a" = BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 62
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 64:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_8_64_b" Bar_8_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_8_64 {bar_8_64_b = y1, bar_8_64_a = BG.getField @"bar_8_64_a" x0}
+      , BG.getField @"bar_8_64_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_8_64_b" (BG.Ptr Bar_8_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_8_64_b")
+
+instance HasCBitfield.HasCBitfield Bar_8_64 "bar_8_64_b" where
+
+  type CBitfieldType Bar_8_64 "bar_8_64_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 62
+
+  bitfieldWidth# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct bar_16_16@
+
+    __defined at:__ @types\/structs\/bitfields.h 68:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_16_16 = Bar_16_16
+  { bar_16_16_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 69:14@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_16_16_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 70:14@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_16_16 where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_16_16 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_16_16
+      <*> HasCBitfield.peek (BG.Proxy @"bar_16_16_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_16_16_b") ptr0
+
+instance Marshal.WriteRaw Bar_16_16 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_16_16 bar_16_16_a2 bar_16_16_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_16_16_a") ptr0 bar_16_16_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_16_16_b") ptr0 bar_16_16_b3
+
+deriving via Marshal.EquivStorable Bar_16_16 instance BG.Storable Bar_16_16
+
+deriving via Struct.IsStructViaReadRaw Bar_16_16 instance Struct.IsStruct Bar_16_16
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 69:14@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_16_16_a" Bar_16_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_16_16 {bar_16_16_a = y1, bar_16_16_b = BG.getField @"bar_16_16_b" x0}
+      , BG.getField @"bar_16_16_a" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_16_16_a" (BG.Ptr Bar_16_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_16_16_a")
+
+instance HasCBitfield.HasCBitfield Bar_16_16 "bar_16_16_a" where
+
+  type CBitfieldType Bar_16_16 "bar_16_16_a" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 14
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 70:14@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_16_16_b" Bar_16_16 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_16_16 {bar_16_16_b = y1, bar_16_16_a = BG.getField @"bar_16_16_a" x0}
+      , BG.getField @"bar_16_16_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_16_16_b" (BG.Ptr Bar_16_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_16_16_b")
+
+instance HasCBitfield.HasCBitfield Bar_16_16 "bar_16_16_b" where
+
+  type CBitfieldType Bar_16_16 "bar_16_16_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 14
+
+  bitfieldWidth# = \_ -> \_ -> 14
+
+{-| __C declaration:__ @struct bar_16_32@
+
+    __defined at:__ @types\/structs\/bitfields.h 74:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_16_32 = Bar_16_32
+  { bar_16_32_a :: BG.CLong
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 75:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_16_32_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 76:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_16_32 where
+
+  staticSizeOf = \_ -> (5 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_16_32 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_16_32
+      <*> HasCBitfield.peek (BG.Proxy @"bar_16_32_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_16_32_b") ptr0
+
+instance Marshal.WriteRaw Bar_16_32 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_16_32 bar_16_32_a2 bar_16_32_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_16_32_a") ptr0 bar_16_32_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_16_32_b") ptr0 bar_16_32_b3
+
+deriving via Marshal.EquivStorable Bar_16_32 instance BG.Storable Bar_16_32
+
+deriving via Struct.IsStructViaReadRaw Bar_16_32 instance Struct.IsStruct Bar_16_32
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 75:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "bar_16_32_a" Bar_16_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_16_32 {bar_16_32_a = y1, bar_16_32_b = BG.getField @"bar_16_32_b" x0}
+      , BG.getField @"bar_16_32_a" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "bar_16_32_a" (BG.Ptr Bar_16_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_16_32_a")
+
+instance HasCBitfield.HasCBitfield Bar_16_32 "bar_16_32_a" where
+
+  type CBitfieldType Bar_16_32 "bar_16_32_a" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 76:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_16_32_b" Bar_16_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_16_32 {bar_16_32_b = y1, bar_16_32_a = BG.getField @"bar_16_32_a" x0}
+      , BG.getField @"bar_16_32_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_16_32_b" (BG.Ptr Bar_16_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_16_32_b")
+
+instance HasCBitfield.HasCBitfield Bar_16_32 "bar_16_32_b" where
+
+  type CBitfieldType Bar_16_32 "bar_16_32_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 24
+
+  bitfieldWidth# = \_ -> \_ -> 14
+
+{-| __C declaration:__ @struct bar_16_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 80:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_16_64 = Bar_16_64
+  { bar_16_64_a :: BG.CLLong
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 81:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_16_64_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 82:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_16_64 where
+
+  staticSizeOf = \_ -> (9 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_16_64 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_16_64
+      <*> HasCBitfield.peek (BG.Proxy @"bar_16_64_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_16_64_b") ptr0
+
+instance Marshal.WriteRaw Bar_16_64 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_16_64 bar_16_64_a2 bar_16_64_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_16_64_a") ptr0 bar_16_64_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_16_64_b") ptr0 bar_16_64_b3
+
+deriving via Marshal.EquivStorable Bar_16_64 instance BG.Storable Bar_16_64
+
+deriving via Struct.IsStructViaReadRaw Bar_16_64 instance Struct.IsStruct Bar_16_64
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 81:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "bar_16_64_a" Bar_16_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_16_64 {bar_16_64_a = y1, bar_16_64_b = BG.getField @"bar_16_64_b" x0}
+      , BG.getField @"bar_16_64_a" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "bar_16_64_a" (BG.Ptr Bar_16_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_16_64_a")
+
+instance HasCBitfield.HasCBitfield Bar_16_64 "bar_16_64_a" where
+
+  type CBitfieldType Bar_16_64 "bar_16_64_a" =
+    BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 56
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 82:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "bar_16_64_b" Bar_16_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_16_64 {bar_16_64_b = y1, bar_16_64_a = BG.getField @"bar_16_64_a" x0}
+      , BG.getField @"bar_16_64_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "bar_16_64_b" (BG.Ptr Bar_16_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_16_64_b")
+
+instance HasCBitfield.HasCBitfield Bar_16_64 "bar_16_64_b" where
+
+  type CBitfieldType Bar_16_64 "bar_16_64_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 56
+
+  bitfieldWidth# = \_ -> \_ -> 14
+
+{-| __C declaration:__ @struct bar_32_32@
+
+    __defined at:__ @types\/structs\/bitfields.h 86:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_32_32 = Bar_32_32
+  { bar_32_32_a :: BG.CLong
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 87:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_32_32_b :: BG.CLong
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 88:15@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_32_32 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_32_32 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_32_32
+      <*> HasCBitfield.peek (BG.Proxy @"bar_32_32_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_32_32_b") ptr0
+
+instance Marshal.WriteRaw Bar_32_32 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_32_32 bar_32_32_a2 bar_32_32_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_32_32_a") ptr0 bar_32_32_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_32_32_b") ptr0 bar_32_32_b3
+
+deriving via Marshal.EquivStorable Bar_32_32 instance BG.Storable Bar_32_32
+
+deriving via Struct.IsStructViaReadRaw Bar_32_32 instance Struct.IsStruct Bar_32_32
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 87:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "bar_32_32_a" Bar_32_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_32_32 {bar_32_32_a = y1, bar_32_32_b = BG.getField @"bar_32_32_b" x0}
+      , BG.getField @"bar_32_32_a" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "bar_32_32_a" (BG.Ptr Bar_32_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_32_32_a")
+
+instance HasCBitfield.HasCBitfield Bar_32_32 "bar_32_32_a" where
+
+  type CBitfieldType Bar_32_32 "bar_32_32_a" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 30
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 88:15@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "bar_32_32_b" Bar_32_32 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_32_32 {bar_32_32_b = y1, bar_32_32_a = BG.getField @"bar_32_32_a" x0}
+      , BG.getField @"bar_32_32_b" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "bar_32_32_b" (BG.Ptr Bar_32_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_32_32_b")
+
+instance HasCBitfield.HasCBitfield Bar_32_32 "bar_32_32_b" where
+
+  type CBitfieldType Bar_32_32 "bar_32_32_b" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 30
+
+  bitfieldWidth# = \_ -> \_ -> 30
+
+{-| __C declaration:__ @struct bar_32_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 92:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_32_64 = Bar_32_64
+  { bar_32_64_a :: BG.CLLong
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 93:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_32_64_b :: BG.CLong
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 94:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_32_64 where
+
+  staticSizeOf = \_ -> (11 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_32_64 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_32_64
+      <*> HasCBitfield.peek (BG.Proxy @"bar_32_64_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_32_64_b") ptr0
+
+instance Marshal.WriteRaw Bar_32_64 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_32_64 bar_32_64_a2 bar_32_64_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_32_64_a") ptr0 bar_32_64_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_32_64_b") ptr0 bar_32_64_b3
+
+deriving via Marshal.EquivStorable Bar_32_64 instance BG.Storable Bar_32_64
+
+deriving via Struct.IsStructViaReadRaw Bar_32_64 instance Struct.IsStruct Bar_32_64
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 93:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "bar_32_64_a" Bar_32_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_32_64 {bar_32_64_a = y1, bar_32_64_b = BG.getField @"bar_32_64_b" x0}
+      , BG.getField @"bar_32_64_a" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "bar_32_64_a" (BG.Ptr Bar_32_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_32_64_a")
+
+instance HasCBitfield.HasCBitfield Bar_32_64 "bar_32_64_a" where
+
+  type CBitfieldType Bar_32_64 "bar_32_64_a" =
+    BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 56
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 94:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "bar_32_64_b" Bar_32_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_32_64 {bar_32_64_b = y1, bar_32_64_a = BG.getField @"bar_32_64_a" x0}
+      , BG.getField @"bar_32_64_b" x0
+      )
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "bar_32_64_b" (BG.Ptr Bar_32_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_32_64_b")
+
+instance HasCBitfield.HasCBitfield Bar_32_64 "bar_32_64_b" where
+
+  type CBitfieldType Bar_32_64 "bar_32_64_b" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 56
+
+  bitfieldWidth# = \_ -> \_ -> 30
+
+{-| __C declaration:__ @struct bar_64_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 98:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_64_64 = Bar_64_64
+  { bar_64_64_a :: BG.CLLong
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/bitfields.h 99:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  , bar_64_64_b :: BG.CLLong
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/bitfields.h 100:20@
+
+         __exported by:__ @types\/structs\/bitfields.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar_64_64 where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar_64_64 where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar_64_64
+      <*> HasCBitfield.peek (BG.Proxy @"bar_64_64_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_64_64_b") ptr0
+
+instance Marshal.WriteRaw Bar_64_64 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar_64_64 bar_64_64_a2 bar_64_64_b3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_64_64_a") ptr0 bar_64_64_a2
+            >> HasCBitfield.poke (BG.Proxy @"bar_64_64_b") ptr0 bar_64_64_b3
+
+deriving via Marshal.EquivStorable Bar_64_64 instance BG.Storable Bar_64_64
+
+deriving via Struct.IsStructViaReadRaw Bar_64_64 instance Struct.IsStruct Bar_64_64
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/bitfields.h 99:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "bar_64_64_a" Bar_64_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_64_64 {bar_64_64_a = y1, bar_64_64_b = BG.getField @"bar_64_64_b" x0}
+      , BG.getField @"bar_64_64_a" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "bar_64_64_a" (BG.Ptr Bar_64_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_64_64_a")
+
+instance HasCBitfield.HasCBitfield Bar_64_64 "bar_64_64_a" where
+
+  type CBitfieldType Bar_64_64 "bar_64_64_a" =
+    BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 56
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/bitfields.h 100:20@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "bar_64_64_b" Bar_64_64 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar_64_64 {bar_64_64_b = y1, bar_64_64_a = BG.getField @"bar_64_64_a" x0}
+      , BG.getField @"bar_64_64_b" x0
+      )
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "bar_64_64_b" (BG.Ptr Bar_64_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"bar_64_64_b")
+
+instance HasCBitfield.HasCBitfield Bar_64_64 "bar_64_64_b" where
+
+  type CBitfieldType Bar_64_64 "bar_64_64_b" =
+    BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 56
+
+  bitfieldWidth# = \_ -> \_ -> 40
diff --git a/test-artefacts/fixtures/types/structs/bitfields/bindingspec.yaml b/test-artefacts/fixtures/types/structs/bitfields/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/bitfields/bindingspec.yaml
@@ -0,0 +1,343 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/bitfields.h
+  cname: struct foo_8
+  hsname: Foo_8
+- headers: types/structs/bitfields.h
+  cname: struct foo_16
+  hsname: Foo_16
+- headers: types/structs/bitfields.h
+  cname: struct foo_32
+  hsname: Foo_32
+- headers: types/structs/bitfields.h
+  cname: struct foo_64
+  hsname: Foo_64
+- headers: types/structs/bitfields.h
+  cname: struct bar_8_8
+  hsname: Bar_8_8
+- headers: types/structs/bitfields.h
+  cname: struct bar_8_16
+  hsname: Bar_8_16
+- headers: types/structs/bitfields.h
+  cname: struct bar_8_32
+  hsname: Bar_8_32
+- headers: types/structs/bitfields.h
+  cname: struct bar_8_64
+  hsname: Bar_8_64
+- headers: types/structs/bitfields.h
+  cname: struct bar_16_16
+  hsname: Bar_16_16
+- headers: types/structs/bitfields.h
+  cname: struct bar_16_32
+  hsname: Bar_16_32
+- headers: types/structs/bitfields.h
+  cname: struct bar_16_64
+  hsname: Bar_16_64
+- headers: types/structs/bitfields.h
+  cname: struct bar_32_32
+  hsname: Bar_32_32
+- headers: types/structs/bitfields.h
+  cname: struct bar_32_64
+  hsname: Bar_32_64
+- headers: types/structs/bitfields.h
+  cname: struct bar_64_64
+  hsname: Bar_64_64
+hstypes:
+- hsname: Bar_16_16
+  representation:
+    record:
+      constructor: Bar_16_16
+      fields:
+      - bar_16_16_a
+      - bar_16_16_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_16_32
+  representation:
+    record:
+      constructor: Bar_16_32
+      fields:
+      - bar_16_32_a
+      - bar_16_32_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_16_64
+  representation:
+    record:
+      constructor: Bar_16_64
+      fields:
+      - bar_16_64_a
+      - bar_16_64_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_32_32
+  representation:
+    record:
+      constructor: Bar_32_32
+      fields:
+      - bar_32_32_a
+      - bar_32_32_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_32_64
+  representation:
+    record:
+      constructor: Bar_32_64
+      fields:
+      - bar_32_64_a
+      - bar_32_64_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_64_64
+  representation:
+    record:
+      constructor: Bar_64_64
+      fields:
+      - bar_64_64_a
+      - bar_64_64_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_8_16
+  representation:
+    record:
+      constructor: Bar_8_16
+      fields:
+      - bar_8_16_a
+      - bar_8_16_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_8_32
+  representation:
+    record:
+      constructor: Bar_8_32
+      fields:
+      - bar_8_32_a
+      - bar_8_32_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_8_64
+  representation:
+    record:
+      constructor: Bar_8_64
+      fields:
+      - bar_8_64_a
+      - bar_8_64_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Bar_8_8
+  representation:
+    record:
+      constructor: Bar_8_8
+      fields:
+      - bar_8_8_a
+      - bar_8_8_b
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_16
+  representation:
+    record:
+      constructor: Foo_16
+      fields:
+      - foo_16_a
+      - foo_16_b
+      - foo_16_c
+      - foo_16_d
+      - foo_16_e
+      - foo_16_f
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_32
+  representation:
+    record:
+      constructor: Foo_32
+      fields:
+      - foo_32_a
+      - foo_32_b
+      - foo_32_c
+      - foo_32_d
+      - foo_32_e
+      - foo_32_f
+      - foo_32_g
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_64
+  representation:
+    record:
+      constructor: Foo_64
+      fields:
+      - foo_64_a
+      - foo_64_b
+      - foo_64_c
+      - foo_64_d
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_8
+  representation:
+    record:
+      constructor: Foo_8
+      fields:
+      - foo_8_a
+      - foo_8_b
+      - foo_8_c
+      - foo_8_d
+      - foo_8_e
+      - foo_8_f
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/bitfields/th.txt b/test-artefacts/fixtures/types/structs/bitfields/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/bitfields/th.txt
@@ -0,0 +1,1147 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/bitfields.h
+{-| __C declaration:__ @struct foo_8@
+
+    __defined at:__ @types\/structs\/bitfields.h 5:8@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Foo_8
+    = Foo_8 {foo_8_a :: CSChar
+             {- ^ __C declaration:__ @a@
+
+                  __defined at:__ @types\/structs\/bitfields.h 6:15@
+
+                  __exported by:__ @types\/structs\/bitfields.h@
+             -},
+             foo_8_b :: CSChar
+             {- ^ __C declaration:__ @b@
+
+                  __defined at:__ @types\/structs\/bitfields.h 7:15@
+
+                  __exported by:__ @types\/structs\/bitfields.h@
+             -},
+             foo_8_c :: CSChar
+             {- ^ __C declaration:__ @c@
+
+                  __defined at:__ @types\/structs\/bitfields.h 8:15@
+
+                  __exported by:__ @types\/structs\/bitfields.h@
+             -},
+             foo_8_d :: CSChar
+             {- ^ __C declaration:__ @d@
+
+                  __defined at:__ @types\/structs\/bitfields.h 9:15@
+
+                  __exported by:__ @types\/structs\/bitfields.h@
+             -},
+             foo_8_e :: CSChar
+             {- ^ __C declaration:__ @e@
+
+                  __defined at:__ @types\/structs\/bitfields.h 10:15@
+
+                  __exported by:__ @types\/structs\/bitfields.h@
+             -},
+             foo_8_f :: CSChar
+             {- ^ __C declaration:__ @f@
+
+                  __defined at:__ @types\/structs\/bitfields.h 11:15@
+
+                  __exported by:__ @types\/structs\/bitfields.h@
+             -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo_8
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Foo_8
+    where readRaw = \ptr_0 -> (((((pure Foo_8 <*> peek (Proxy @"foo_8_a") ptr_0) <*> peek (Proxy @"foo_8_b") ptr_0) <*> peek (Proxy @"foo_8_c") ptr_0) <*> peek (Proxy @"foo_8_d") ptr_0) <*> peek (Proxy @"foo_8_e") ptr_0) <*> peek (Proxy @"foo_8_f") ptr_0
+instance WriteRaw Foo_8
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo_8 foo_8_a_2
+                                             foo_8_b_3
+                                             foo_8_c_4
+                                             foo_8_d_5
+                                             foo_8_e_6
+                                             foo_8_f_7 -> poke (Proxy @"foo_8_a") ptr_0 foo_8_a_2 >> (poke (Proxy @"foo_8_b") ptr_0 foo_8_b_3 >> (poke (Proxy @"foo_8_c") ptr_0 foo_8_c_4 >> (poke (Proxy @"foo_8_d") ptr_0 foo_8_d_5 >> (poke (Proxy @"foo_8_e") ptr_0 foo_8_e_6 >> poke (Proxy @"foo_8_f") ptr_0 foo_8_f_7))))
+deriving via (EquivStorable Foo_8) instance Storable Foo_8
+deriving via (IsStructViaReadRaw Foo_8) instance IsStruct Foo_8
+instance (~) ty CSChar => HasField "foo_8_a" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_8{foo_8_a = y_1,
+                                            foo_8_b = getField @"foo_8_b" x_0,
+                                            foo_8_c = getField @"foo_8_c" x_0,
+                                            foo_8_d = getField @"foo_8_d" x_0,
+                                            foo_8_e = getField @"foo_8_e" x_0,
+                                            foo_8_f = getField @"foo_8_f" x_0},
+                              getField @"foo_8_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_a" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_a")
+instance HasCBitfield Foo_8 "foo_8_a"
+    where type CBitfieldType Foo_8 "foo_8_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_8_b" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_8{foo_8_b = y_1,
+                                            foo_8_a = getField @"foo_8_a" x_0,
+                                            foo_8_c = getField @"foo_8_c" x_0,
+                                            foo_8_d = getField @"foo_8_d" x_0,
+                                            foo_8_e = getField @"foo_8_e" x_0,
+                                            foo_8_f = getField @"foo_8_f" x_0},
+                              getField @"foo_8_b" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_b" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_b")
+instance HasCBitfield Foo_8 "foo_8_b"
+    where type CBitfieldType Foo_8 "foo_8_b" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 3
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_8_c" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_8{foo_8_c = y_1,
+                                            foo_8_a = getField @"foo_8_a" x_0,
+                                            foo_8_b = getField @"foo_8_b" x_0,
+                                            foo_8_d = getField @"foo_8_d" x_0,
+                                            foo_8_e = getField @"foo_8_e" x_0,
+                                            foo_8_f = getField @"foo_8_f" x_0},
+                              getField @"foo_8_c" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_c" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_c")
+instance HasCBitfield Foo_8 "foo_8_c"
+    where type CBitfieldType Foo_8 "foo_8_c" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 6
+          bitfieldWidth# = \_ -> \_ -> 2
+instance (~) ty CSChar => HasField "foo_8_d" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_8{foo_8_d = y_1,
+                                            foo_8_a = getField @"foo_8_a" x_0,
+                                            foo_8_b = getField @"foo_8_b" x_0,
+                                            foo_8_c = getField @"foo_8_c" x_0,
+                                            foo_8_e = getField @"foo_8_e" x_0,
+                                            foo_8_f = getField @"foo_8_f" x_0},
+                              getField @"foo_8_d" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_d" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_d")
+instance HasCBitfield Foo_8 "foo_8_d"
+    where type CBitfieldType Foo_8 "foo_8_d" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 8
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_8_e" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_8{foo_8_e = y_1,
+                                            foo_8_a = getField @"foo_8_a" x_0,
+                                            foo_8_b = getField @"foo_8_b" x_0,
+                                            foo_8_c = getField @"foo_8_c" x_0,
+                                            foo_8_d = getField @"foo_8_d" x_0,
+                                            foo_8_f = getField @"foo_8_f" x_0},
+                              getField @"foo_8_e" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_e" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_e")
+instance HasCBitfield Foo_8 "foo_8_e"
+    where type CBitfieldType Foo_8 "foo_8_e" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 16
+          bitfieldWidth# = \_ -> \_ -> 8
+instance (~) ty CSChar => HasField "foo_8_f" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_8{foo_8_f = y_1,
+                                            foo_8_a = getField @"foo_8_a" x_0,
+                                            foo_8_b = getField @"foo_8_b" x_0,
+                                            foo_8_c = getField @"foo_8_c" x_0,
+                                            foo_8_d = getField @"foo_8_d" x_0,
+                                            foo_8_e = getField @"foo_8_e" x_0},
+                              getField @"foo_8_f" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_f" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_f")
+instance HasCBitfield Foo_8 "foo_8_f"
+    where type CBitfieldType Foo_8 "foo_8_f" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 24
+          bitfieldWidth# = \_ -> \_ -> 5
+{-| __C declaration:__ @struct foo_16@
+
+    __defined at:__ @types\/structs\/bitfields.h 15:8@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Foo_16
+    = Foo_16 {foo_16_a :: CSChar
+              {- ^ __C declaration:__ @a@
+
+                   __defined at:__ @types\/structs\/bitfields.h 16:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_16_b :: CInt
+              {- ^ __C declaration:__ @b@
+
+                   __defined at:__ @types\/structs\/bitfields.h 17:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_16_c :: CInt
+              {- ^ __C declaration:__ @c@
+
+                   __defined at:__ @types\/structs\/bitfields.h 18:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_16_d :: CInt
+              {- ^ __C declaration:__ @d@
+
+                   __defined at:__ @types\/structs\/bitfields.h 19:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_16_e :: CInt
+              {- ^ __C declaration:__ @e@
+
+                   __defined at:__ @types\/structs\/bitfields.h 20:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_16_f :: CInt
+              {- ^ __C declaration:__ @f@
+
+                   __defined at:__ @types\/structs\/bitfields.h 21:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo_16
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Foo_16
+    where readRaw = \ptr_0 -> (((((pure Foo_16 <*> peek (Proxy @"foo_16_a") ptr_0) <*> peek (Proxy @"foo_16_b") ptr_0) <*> peek (Proxy @"foo_16_c") ptr_0) <*> peek (Proxy @"foo_16_d") ptr_0) <*> peek (Proxy @"foo_16_e") ptr_0) <*> peek (Proxy @"foo_16_f") ptr_0
+instance WriteRaw Foo_16
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo_16 foo_16_a_2
+                                              foo_16_b_3
+                                              foo_16_c_4
+                                              foo_16_d_5
+                                              foo_16_e_6
+                                              foo_16_f_7 -> poke (Proxy @"foo_16_a") ptr_0 foo_16_a_2 >> (poke (Proxy @"foo_16_b") ptr_0 foo_16_b_3 >> (poke (Proxy @"foo_16_c") ptr_0 foo_16_c_4 >> (poke (Proxy @"foo_16_d") ptr_0 foo_16_d_5 >> (poke (Proxy @"foo_16_e") ptr_0 foo_16_e_6 >> poke (Proxy @"foo_16_f") ptr_0 foo_16_f_7))))
+deriving via (EquivStorable Foo_16) instance Storable Foo_16
+deriving via (IsStructViaReadRaw Foo_16) instance IsStruct Foo_16
+instance (~) ty CSChar => HasField "foo_16_a" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_16{foo_16_a = y_1,
+                                             foo_16_b = getField @"foo_16_b" x_0,
+                                             foo_16_c = getField @"foo_16_c" x_0,
+                                             foo_16_d = getField @"foo_16_d" x_0,
+                                             foo_16_e = getField @"foo_16_e" x_0,
+                                             foo_16_f = getField @"foo_16_f" x_0},
+                              getField @"foo_16_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_16_a" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_a")
+instance HasCBitfield Foo_16 "foo_16_a"
+    where type CBitfieldType Foo_16 "foo_16_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CInt => HasField "foo_16_b" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_16{foo_16_b = y_1,
+                                             foo_16_a = getField @"foo_16_a" x_0,
+                                             foo_16_c = getField @"foo_16_c" x_0,
+                                             foo_16_d = getField @"foo_16_d" x_0,
+                                             foo_16_e = getField @"foo_16_e" x_0,
+                                             foo_16_f = getField @"foo_16_f" x_0},
+                              getField @"foo_16_b" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_b" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_b")
+instance HasCBitfield Foo_16 "foo_16_b"
+    where type CBitfieldType Foo_16 "foo_16_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 6
+          bitfieldWidth# = \_ -> \_ -> 10
+instance (~) ty CInt => HasField "foo_16_c" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_16{foo_16_c = y_1,
+                                             foo_16_a = getField @"foo_16_a" x_0,
+                                             foo_16_b = getField @"foo_16_b" x_0,
+                                             foo_16_d = getField @"foo_16_d" x_0,
+                                             foo_16_e = getField @"foo_16_e" x_0,
+                                             foo_16_f = getField @"foo_16_f" x_0},
+                              getField @"foo_16_c" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_c" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_c")
+instance HasCBitfield Foo_16 "foo_16_c"
+    where type CBitfieldType Foo_16 "foo_16_c" = CInt
+          bitfieldOffset# = \_ -> \_ -> 16
+          bitfieldWidth# = \_ -> \_ -> 16
+instance (~) ty CInt => HasField "foo_16_d" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_16{foo_16_d = y_1,
+                                             foo_16_a = getField @"foo_16_a" x_0,
+                                             foo_16_b = getField @"foo_16_b" x_0,
+                                             foo_16_c = getField @"foo_16_c" x_0,
+                                             foo_16_e = getField @"foo_16_e" x_0,
+                                             foo_16_f = getField @"foo_16_f" x_0},
+                              getField @"foo_16_d" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_d" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_d")
+instance HasCBitfield Foo_16 "foo_16_d"
+    where type CBitfieldType Foo_16 "foo_16_d" = CInt
+          bitfieldOffset# = \_ -> \_ -> 32
+          bitfieldWidth# = \_ -> \_ -> 16
+instance (~) ty CInt => HasField "foo_16_e" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_16{foo_16_e = y_1,
+                                             foo_16_a = getField @"foo_16_a" x_0,
+                                             foo_16_b = getField @"foo_16_b" x_0,
+                                             foo_16_c = getField @"foo_16_c" x_0,
+                                             foo_16_d = getField @"foo_16_d" x_0,
+                                             foo_16_f = getField @"foo_16_f" x_0},
+                              getField @"foo_16_e" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_e" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_e")
+instance HasCBitfield Foo_16 "foo_16_e"
+    where type CBitfieldType Foo_16 "foo_16_e" = CInt
+          bitfieldOffset# = \_ -> \_ -> 48
+          bitfieldWidth# = \_ -> \_ -> 12
+instance (~) ty CInt => HasField "foo_16_f" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_16{foo_16_f = y_1,
+                                             foo_16_a = getField @"foo_16_a" x_0,
+                                             foo_16_b = getField @"foo_16_b" x_0,
+                                             foo_16_c = getField @"foo_16_c" x_0,
+                                             foo_16_d = getField @"foo_16_d" x_0,
+                                             foo_16_e = getField @"foo_16_e" x_0},
+                              getField @"foo_16_f" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_f" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_f")
+instance HasCBitfield Foo_16 "foo_16_f"
+    where type CBitfieldType Foo_16 "foo_16_f" = CInt
+          bitfieldOffset# = \_ -> \_ -> 64
+          bitfieldWidth# = \_ -> \_ -> 12
+{-| __C declaration:__ @struct foo_32@
+
+    __defined at:__ @types\/structs\/bitfields.h 25:8@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Foo_32
+    = Foo_32 {foo_32_a :: CSChar
+              {- ^ __C declaration:__ @a@
+
+                   __defined at:__ @types\/structs\/bitfields.h 26:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_32_b :: CInt
+              {- ^ __C declaration:__ @b@
+
+                   __defined at:__ @types\/structs\/bitfields.h 27:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_32_c :: CInt
+              {- ^ __C declaration:__ @c@
+
+                   __defined at:__ @types\/structs\/bitfields.h 28:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_32_d :: CInt
+              {- ^ __C declaration:__ @d@
+
+                   __defined at:__ @types\/structs\/bitfields.h 29:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_32_e :: CLong
+              {- ^ __C declaration:__ @e@
+
+                   __defined at:__ @types\/structs\/bitfields.h 30:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_32_f :: CInt
+              {- ^ __C declaration:__ @f@
+
+                   __defined at:__ @types\/structs\/bitfields.h 31:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_32_g :: CLong
+              {- ^ __C declaration:__ @g@
+
+                   __defined at:__ @types\/structs\/bitfields.h 32:15@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo_32
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Foo_32
+    where readRaw = \ptr_0 -> ((((((pure Foo_32 <*> peek (Proxy @"foo_32_a") ptr_0) <*> peek (Proxy @"foo_32_b") ptr_0) <*> peek (Proxy @"foo_32_c") ptr_0) <*> peek (Proxy @"foo_32_d") ptr_0) <*> peek (Proxy @"foo_32_e") ptr_0) <*> peek (Proxy @"foo_32_f") ptr_0) <*> peek (Proxy @"foo_32_g") ptr_0
+instance WriteRaw Foo_32
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo_32 foo_32_a_2
+                                              foo_32_b_3
+                                              foo_32_c_4
+                                              foo_32_d_5
+                                              foo_32_e_6
+                                              foo_32_f_7
+                                              foo_32_g_8 -> poke (Proxy @"foo_32_a") ptr_0 foo_32_a_2 >> (poke (Proxy @"foo_32_b") ptr_0 foo_32_b_3 >> (poke (Proxy @"foo_32_c") ptr_0 foo_32_c_4 >> (poke (Proxy @"foo_32_d") ptr_0 foo_32_d_5 >> (poke (Proxy @"foo_32_e") ptr_0 foo_32_e_6 >> (poke (Proxy @"foo_32_f") ptr_0 foo_32_f_7 >> poke (Proxy @"foo_32_g") ptr_0 foo_32_g_8)))))
+deriving via (EquivStorable Foo_32) instance Storable Foo_32
+deriving via (IsStructViaReadRaw Foo_32) instance IsStruct Foo_32
+instance (~) ty CSChar => HasField "foo_32_a" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_32{foo_32_a = y_1,
+                                             foo_32_b = getField @"foo_32_b" x_0,
+                                             foo_32_c = getField @"foo_32_c" x_0,
+                                             foo_32_d = getField @"foo_32_d" x_0,
+                                             foo_32_e = getField @"foo_32_e" x_0,
+                                             foo_32_f = getField @"foo_32_f" x_0,
+                                             foo_32_g = getField @"foo_32_g" x_0},
+                              getField @"foo_32_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_32_a" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_a")
+instance HasCBitfield Foo_32 "foo_32_a"
+    where type CBitfieldType Foo_32 "foo_32_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CInt => HasField "foo_32_b" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_32{foo_32_b = y_1,
+                                             foo_32_a = getField @"foo_32_a" x_0,
+                                             foo_32_c = getField @"foo_32_c" x_0,
+                                             foo_32_d = getField @"foo_32_d" x_0,
+                                             foo_32_e = getField @"foo_32_e" x_0,
+                                             foo_32_f = getField @"foo_32_f" x_0,
+                                             foo_32_g = getField @"foo_32_g" x_0},
+                              getField @"foo_32_b" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_b" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_b")
+instance HasCBitfield Foo_32 "foo_32_b"
+    where type CBitfieldType Foo_32 "foo_32_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 6
+          bitfieldWidth# = \_ -> \_ -> 12
+instance (~) ty CInt => HasField "foo_32_c" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_32{foo_32_c = y_1,
+                                             foo_32_a = getField @"foo_32_a" x_0,
+                                             foo_32_b = getField @"foo_32_b" x_0,
+                                             foo_32_d = getField @"foo_32_d" x_0,
+                                             foo_32_e = getField @"foo_32_e" x_0,
+                                             foo_32_f = getField @"foo_32_f" x_0,
+                                             foo_32_g = getField @"foo_32_g" x_0},
+                              getField @"foo_32_c" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_c" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_c")
+instance HasCBitfield Foo_32 "foo_32_c"
+    where type CBitfieldType Foo_32 "foo_32_c" = CInt
+          bitfieldOffset# = \_ -> \_ -> 18
+          bitfieldWidth# = \_ -> \_ -> 14
+instance (~) ty CInt => HasField "foo_32_d" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_32{foo_32_d = y_1,
+                                             foo_32_a = getField @"foo_32_a" x_0,
+                                             foo_32_b = getField @"foo_32_b" x_0,
+                                             foo_32_c = getField @"foo_32_c" x_0,
+                                             foo_32_e = getField @"foo_32_e" x_0,
+                                             foo_32_f = getField @"foo_32_f" x_0,
+                                             foo_32_g = getField @"foo_32_g" x_0},
+                              getField @"foo_32_d" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_d" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_d")
+instance HasCBitfield Foo_32 "foo_32_d"
+    where type CBitfieldType Foo_32 "foo_32_d" = CInt
+          bitfieldOffset# = \_ -> \_ -> 32
+          bitfieldWidth# = \_ -> \_ -> 10
+instance (~) ty CLong => HasField "foo_32_e" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_32{foo_32_e = y_1,
+                                             foo_32_a = getField @"foo_32_a" x_0,
+                                             foo_32_b = getField @"foo_32_b" x_0,
+                                             foo_32_c = getField @"foo_32_c" x_0,
+                                             foo_32_d = getField @"foo_32_d" x_0,
+                                             foo_32_f = getField @"foo_32_f" x_0,
+                                             foo_32_g = getField @"foo_32_g" x_0},
+                              getField @"foo_32_e" x_0)
+instance (~) ty CLong =>
+         HasField "foo_32_e" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_e")
+instance HasCBitfield Foo_32 "foo_32_e"
+    where type CBitfieldType Foo_32 "foo_32_e" = CLong
+          bitfieldOffset# = \_ -> \_ -> 64
+          bitfieldWidth# = \_ -> \_ -> 32
+instance (~) ty CInt => HasField "foo_32_f" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_32{foo_32_f = y_1,
+                                             foo_32_a = getField @"foo_32_a" x_0,
+                                             foo_32_b = getField @"foo_32_b" x_0,
+                                             foo_32_c = getField @"foo_32_c" x_0,
+                                             foo_32_d = getField @"foo_32_d" x_0,
+                                             foo_32_e = getField @"foo_32_e" x_0,
+                                             foo_32_g = getField @"foo_32_g" x_0},
+                              getField @"foo_32_f" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_f" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_f")
+instance HasCBitfield Foo_32 "foo_32_f"
+    where type CBitfieldType Foo_32 "foo_32_f" = CInt
+          bitfieldOffset# = \_ -> \_ -> 96
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CLong => HasField "foo_32_g" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_32{foo_32_g = y_1,
+                                             foo_32_a = getField @"foo_32_a" x_0,
+                                             foo_32_b = getField @"foo_32_b" x_0,
+                                             foo_32_c = getField @"foo_32_c" x_0,
+                                             foo_32_d = getField @"foo_32_d" x_0,
+                                             foo_32_e = getField @"foo_32_e" x_0,
+                                             foo_32_f = getField @"foo_32_f" x_0},
+                              getField @"foo_32_g" x_0)
+instance (~) ty CLong =>
+         HasField "foo_32_g" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_g")
+instance HasCBitfield Foo_32 "foo_32_g"
+    where type CBitfieldType Foo_32 "foo_32_g" = CLong
+          bitfieldOffset# = \_ -> \_ -> 102
+          bitfieldWidth# = \_ -> \_ -> 24
+{-| __C declaration:__ @struct foo_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 36:8@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Foo_64
+    = Foo_64 {foo_64_a :: CLong
+              {- ^ __C declaration:__ @a@
+
+                   __defined at:__ @types\/structs\/bitfields.h 37:20@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_64_b :: CLLong
+              {- ^ __C declaration:__ @b@
+
+                   __defined at:__ @types\/structs\/bitfields.h 38:20@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_64_c :: CLLong
+              {- ^ __C declaration:__ @c@
+
+                   __defined at:__ @types\/structs\/bitfields.h 39:20@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -},
+              foo_64_d :: CLLong
+              {- ^ __C declaration:__ @d@
+
+                   __defined at:__ @types\/structs\/bitfields.h 40:20@
+
+                   __exported by:__ @types\/structs\/bitfields.h@
+              -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo_64
+    where staticSizeOf = \_ -> 24 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Foo_64
+    where readRaw = \ptr_0 -> (((pure Foo_64 <*> peek (Proxy @"foo_64_a") ptr_0) <*> peek (Proxy @"foo_64_b") ptr_0) <*> peek (Proxy @"foo_64_c") ptr_0) <*> peek (Proxy @"foo_64_d") ptr_0
+instance WriteRaw Foo_64
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo_64 foo_64_a_2
+                                              foo_64_b_3
+                                              foo_64_c_4
+                                              foo_64_d_5 -> poke (Proxy @"foo_64_a") ptr_0 foo_64_a_2 >> (poke (Proxy @"foo_64_b") ptr_0 foo_64_b_3 >> (poke (Proxy @"foo_64_c") ptr_0 foo_64_c_4 >> poke (Proxy @"foo_64_d") ptr_0 foo_64_d_5))
+deriving via (EquivStorable Foo_64) instance Storable Foo_64
+deriving via (IsStructViaReadRaw Foo_64) instance IsStruct Foo_64
+instance (~) ty CLong => HasField "foo_64_a" Foo_64 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_64{foo_64_a = y_1,
+                                             foo_64_b = getField @"foo_64_b" x_0,
+                                             foo_64_c = getField @"foo_64_c" x_0,
+                                             foo_64_d = getField @"foo_64_d" x_0},
+                              getField @"foo_64_a" x_0)
+instance (~) ty CLong =>
+         HasField "foo_64_a" (Ptr Foo_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_a")
+instance HasCBitfield Foo_64 "foo_64_a"
+    where type CBitfieldType Foo_64 "foo_64_a" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 24
+instance (~) ty CLLong => HasField "foo_64_b" Foo_64 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_64{foo_64_b = y_1,
+                                             foo_64_a = getField @"foo_64_a" x_0,
+                                             foo_64_c = getField @"foo_64_c" x_0,
+                                             foo_64_d = getField @"foo_64_d" x_0},
+                              getField @"foo_64_b" x_0)
+instance (~) ty CLLong =>
+         HasField "foo_64_b" (Ptr Foo_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_b")
+instance HasCBitfield Foo_64 "foo_64_b"
+    where type CBitfieldType Foo_64 "foo_64_b" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 24
+          bitfieldWidth# = \_ -> \_ -> 40
+instance (~) ty CLLong => HasField "foo_64_c" Foo_64 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_64{foo_64_c = y_1,
+                                             foo_64_a = getField @"foo_64_a" x_0,
+                                             foo_64_b = getField @"foo_64_b" x_0,
+                                             foo_64_d = getField @"foo_64_d" x_0},
+                              getField @"foo_64_c" x_0)
+instance (~) ty CLLong =>
+         HasField "foo_64_c" (Ptr Foo_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_c")
+instance HasCBitfield Foo_64 "foo_64_c"
+    where type CBitfieldType Foo_64 "foo_64_c" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 64
+          bitfieldWidth# = \_ -> \_ -> 64
+instance (~) ty CLLong => HasField "foo_64_d" Foo_64 ty
+    where hasField = \x_0 -> (\y_1 -> Foo_64{foo_64_d = y_1,
+                                             foo_64_a = getField @"foo_64_a" x_0,
+                                             foo_64_b = getField @"foo_64_b" x_0,
+                                             foo_64_c = getField @"foo_64_c" x_0},
+                              getField @"foo_64_d" x_0)
+instance (~) ty CLLong =>
+         HasField "foo_64_d" (Ptr Foo_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_d")
+instance HasCBitfield Foo_64 "foo_64_d"
+    where type CBitfieldType Foo_64 "foo_64_d" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 128
+          bitfieldWidth# = \_ -> \_ -> 36
+{-| __C declaration:__ @struct bar_8_8@
+
+    __defined at:__ @types\/structs\/bitfields.h 44:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_8_8
+    = Bar_8_8 {bar_8_8_a :: CSChar
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @types\/structs\/bitfields.h 45:15@
+
+                    __exported by:__ @types\/structs\/bitfields.h@
+               -},
+               bar_8_8_b :: CInt
+               {- ^ __C declaration:__ @b@
+
+                    __defined at:__ @types\/structs\/bitfields.h 46:15@
+
+                    __exported by:__ @types\/structs\/bitfields.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_8_8
+    where staticSizeOf = \_ -> 2 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_8_8
+    where readRaw = \ptr_0 -> (pure Bar_8_8 <*> peek (Proxy @"bar_8_8_a") ptr_0) <*> peek (Proxy @"bar_8_8_b") ptr_0
+instance WriteRaw Bar_8_8
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_8_8 bar_8_8_a_2
+                                               bar_8_8_b_3 -> poke (Proxy @"bar_8_8_a") ptr_0 bar_8_8_a_2 >> poke (Proxy @"bar_8_8_b") ptr_0 bar_8_8_b_3
+deriving via (EquivStorable Bar_8_8) instance Storable Bar_8_8
+deriving via (IsStructViaReadRaw Bar_8_8) instance IsStruct Bar_8_8
+instance (~) ty CSChar => HasField "bar_8_8_a" Bar_8_8 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_8_8{bar_8_8_a = y_1,
+                                              bar_8_8_b = getField @"bar_8_8_b" x_0},
+                              getField @"bar_8_8_a" x_0)
+instance (~) ty CSChar =>
+         HasField "bar_8_8_a" (Ptr Bar_8_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_8_8_a")
+instance HasCBitfield Bar_8_8 "bar_8_8_a"
+    where type CBitfieldType Bar_8_8 "bar_8_8_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CInt => HasField "bar_8_8_b" Bar_8_8 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_8_8{bar_8_8_b = y_1,
+                                              bar_8_8_a = getField @"bar_8_8_a" x_0},
+                              getField @"bar_8_8_b" x_0)
+instance (~) ty CInt =>
+         HasField "bar_8_8_b" (Ptr Bar_8_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_8_8_b")
+instance HasCBitfield Bar_8_8 "bar_8_8_b"
+    where type CBitfieldType Bar_8_8 "bar_8_8_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 6
+          bitfieldWidth# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct bar_8_16@
+
+    __defined at:__ @types\/structs\/bitfields.h 50:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_8_16
+    = Bar_8_16 {bar_8_16_a :: CInt
+                {- ^ __C declaration:__ @a@
+
+                     __defined at:__ @types\/structs\/bitfields.h 51:14@
+
+                     __exported by:__ @types\/structs\/bitfields.h@
+                -},
+                bar_8_16_b :: CInt
+                {- ^ __C declaration:__ @b@
+
+                     __defined at:__ @types\/structs\/bitfields.h 52:14@
+
+                     __exported by:__ @types\/structs\/bitfields.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_8_16
+    where staticSizeOf = \_ -> 3 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_8_16
+    where readRaw = \ptr_0 -> (pure Bar_8_16 <*> peek (Proxy @"bar_8_16_a") ptr_0) <*> peek (Proxy @"bar_8_16_b") ptr_0
+instance WriteRaw Bar_8_16
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_8_16 bar_8_16_a_2
+                                                bar_8_16_b_3 -> poke (Proxy @"bar_8_16_a") ptr_0 bar_8_16_a_2 >> poke (Proxy @"bar_8_16_b") ptr_0 bar_8_16_b_3
+deriving via (EquivStorable Bar_8_16) instance Storable Bar_8_16
+deriving via (IsStructViaReadRaw Bar_8_16) instance IsStruct Bar_8_16
+instance (~) ty CInt => HasField "bar_8_16_a" Bar_8_16 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_8_16{bar_8_16_a = y_1,
+                                               bar_8_16_b = getField @"bar_8_16_b" x_0},
+                              getField @"bar_8_16_a" x_0)
+instance (~) ty CInt =>
+         HasField "bar_8_16_a" (Ptr Bar_8_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_8_16_a")
+instance HasCBitfield Bar_8_16 "bar_8_16_a"
+    where type CBitfieldType Bar_8_16 "bar_8_16_a" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 14
+instance (~) ty CInt => HasField "bar_8_16_b" Bar_8_16 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_8_16{bar_8_16_b = y_1,
+                                               bar_8_16_a = getField @"bar_8_16_a" x_0},
+                              getField @"bar_8_16_b" x_0)
+instance (~) ty CInt =>
+         HasField "bar_8_16_b" (Ptr Bar_8_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_8_16_b")
+instance HasCBitfield Bar_8_16 "bar_8_16_b"
+    where type CBitfieldType Bar_8_16 "bar_8_16_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 14
+          bitfieldWidth# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct bar_8_32@
+
+    __defined at:__ @types\/structs\/bitfields.h 56:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_8_32
+    = Bar_8_32 {bar_8_32_a :: CLong
+                {- ^ __C declaration:__ @a@
+
+                     __defined at:__ @types\/structs\/bitfields.h 57:15@
+
+                     __exported by:__ @types\/structs\/bitfields.h@
+                -},
+                bar_8_32_b :: CInt
+                {- ^ __C declaration:__ @b@
+
+                     __defined at:__ @types\/structs\/bitfields.h 58:15@
+
+                     __exported by:__ @types\/structs\/bitfields.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_8_32
+    where staticSizeOf = \_ -> 5 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_8_32
+    where readRaw = \ptr_0 -> (pure Bar_8_32 <*> peek (Proxy @"bar_8_32_a") ptr_0) <*> peek (Proxy @"bar_8_32_b") ptr_0
+instance WriteRaw Bar_8_32
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_8_32 bar_8_32_a_2
+                                                bar_8_32_b_3 -> poke (Proxy @"bar_8_32_a") ptr_0 bar_8_32_a_2 >> poke (Proxy @"bar_8_32_b") ptr_0 bar_8_32_b_3
+deriving via (EquivStorable Bar_8_32) instance Storable Bar_8_32
+deriving via (IsStructViaReadRaw Bar_8_32) instance IsStruct Bar_8_32
+instance (~) ty CLong => HasField "bar_8_32_a" Bar_8_32 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_8_32{bar_8_32_a = y_1,
+                                               bar_8_32_b = getField @"bar_8_32_b" x_0},
+                              getField @"bar_8_32_a" x_0)
+instance (~) ty CLong =>
+         HasField "bar_8_32_a" (Ptr Bar_8_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_8_32_a")
+instance HasCBitfield Bar_8_32 "bar_8_32_a"
+    where type CBitfieldType Bar_8_32 "bar_8_32_a" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 30
+instance (~) ty CInt => HasField "bar_8_32_b" Bar_8_32 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_8_32{bar_8_32_b = y_1,
+                                               bar_8_32_a = getField @"bar_8_32_a" x_0},
+                              getField @"bar_8_32_b" x_0)
+instance (~) ty CInt =>
+         HasField "bar_8_32_b" (Ptr Bar_8_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_8_32_b")
+instance HasCBitfield Bar_8_32 "bar_8_32_b"
+    where type CBitfieldType Bar_8_32 "bar_8_32_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 30
+          bitfieldWidth# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct bar_8_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 62:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_8_64
+    = Bar_8_64 {bar_8_64_a :: CLLong
+                {- ^ __C declaration:__ @a@
+
+                     __defined at:__ @types\/structs\/bitfields.h 63:20@
+
+                     __exported by:__ @types\/structs\/bitfields.h@
+                -},
+                bar_8_64_b :: CInt
+                {- ^ __C declaration:__ @b@
+
+                     __defined at:__ @types\/structs\/bitfields.h 64:20@
+
+                     __exported by:__ @types\/structs\/bitfields.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_8_64
+    where staticSizeOf = \_ -> 9 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_8_64
+    where readRaw = \ptr_0 -> (pure Bar_8_64 <*> peek (Proxy @"bar_8_64_a") ptr_0) <*> peek (Proxy @"bar_8_64_b") ptr_0
+instance WriteRaw Bar_8_64
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_8_64 bar_8_64_a_2
+                                                bar_8_64_b_3 -> poke (Proxy @"bar_8_64_a") ptr_0 bar_8_64_a_2 >> poke (Proxy @"bar_8_64_b") ptr_0 bar_8_64_b_3
+deriving via (EquivStorable Bar_8_64) instance Storable Bar_8_64
+deriving via (IsStructViaReadRaw Bar_8_64) instance IsStruct Bar_8_64
+instance (~) ty CLLong => HasField "bar_8_64_a" Bar_8_64 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_8_64{bar_8_64_a = y_1,
+                                               bar_8_64_b = getField @"bar_8_64_b" x_0},
+                              getField @"bar_8_64_a" x_0)
+instance (~) ty CLLong =>
+         HasField "bar_8_64_a" (Ptr Bar_8_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_8_64_a")
+instance HasCBitfield Bar_8_64 "bar_8_64_a"
+    where type CBitfieldType Bar_8_64 "bar_8_64_a" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 62
+instance (~) ty CInt => HasField "bar_8_64_b" Bar_8_64 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_8_64{bar_8_64_b = y_1,
+                                               bar_8_64_a = getField @"bar_8_64_a" x_0},
+                              getField @"bar_8_64_b" x_0)
+instance (~) ty CInt =>
+         HasField "bar_8_64_b" (Ptr Bar_8_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_8_64_b")
+instance HasCBitfield Bar_8_64 "bar_8_64_b"
+    where type CBitfieldType Bar_8_64 "bar_8_64_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 62
+          bitfieldWidth# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct bar_16_16@
+
+    __defined at:__ @types\/structs\/bitfields.h 68:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_16_16
+    = Bar_16_16 {bar_16_16_a :: CInt
+                 {- ^ __C declaration:__ @a@
+
+                      __defined at:__ @types\/structs\/bitfields.h 69:14@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -},
+                 bar_16_16_b :: CInt
+                 {- ^ __C declaration:__ @b@
+
+                      __defined at:__ @types\/structs\/bitfields.h 70:14@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_16_16
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_16_16
+    where readRaw = \ptr_0 -> (pure Bar_16_16 <*> peek (Proxy @"bar_16_16_a") ptr_0) <*> peek (Proxy @"bar_16_16_b") ptr_0
+instance WriteRaw Bar_16_16
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_16_16 bar_16_16_a_2
+                                                 bar_16_16_b_3 -> poke (Proxy @"bar_16_16_a") ptr_0 bar_16_16_a_2 >> poke (Proxy @"bar_16_16_b") ptr_0 bar_16_16_b_3
+deriving via (EquivStorable Bar_16_16) instance Storable Bar_16_16
+deriving via (IsStructViaReadRaw Bar_16_16) instance IsStruct Bar_16_16
+instance (~) ty CInt => HasField "bar_16_16_a" Bar_16_16 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_16_16{bar_16_16_a = y_1,
+                                                bar_16_16_b = getField @"bar_16_16_b" x_0},
+                              getField @"bar_16_16_a" x_0)
+instance (~) ty CInt =>
+         HasField "bar_16_16_a" (Ptr Bar_16_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_16_16_a")
+instance HasCBitfield Bar_16_16 "bar_16_16_a"
+    where type CBitfieldType Bar_16_16 "bar_16_16_a" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 14
+instance (~) ty CInt => HasField "bar_16_16_b" Bar_16_16 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_16_16{bar_16_16_b = y_1,
+                                                bar_16_16_a = getField @"bar_16_16_a" x_0},
+                              getField @"bar_16_16_b" x_0)
+instance (~) ty CInt =>
+         HasField "bar_16_16_b" (Ptr Bar_16_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_16_16_b")
+instance HasCBitfield Bar_16_16 "bar_16_16_b"
+    where type CBitfieldType Bar_16_16 "bar_16_16_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 14
+          bitfieldWidth# = \_ -> \_ -> 14
+{-| __C declaration:__ @struct bar_16_32@
+
+    __defined at:__ @types\/structs\/bitfields.h 74:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_16_32
+    = Bar_16_32 {bar_16_32_a :: CLong
+                 {- ^ __C declaration:__ @a@
+
+                      __defined at:__ @types\/structs\/bitfields.h 75:15@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -},
+                 bar_16_32_b :: CInt
+                 {- ^ __C declaration:__ @b@
+
+                      __defined at:__ @types\/structs\/bitfields.h 76:15@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_16_32
+    where staticSizeOf = \_ -> 5 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_16_32
+    where readRaw = \ptr_0 -> (pure Bar_16_32 <*> peek (Proxy @"bar_16_32_a") ptr_0) <*> peek (Proxy @"bar_16_32_b") ptr_0
+instance WriteRaw Bar_16_32
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_16_32 bar_16_32_a_2
+                                                 bar_16_32_b_3 -> poke (Proxy @"bar_16_32_a") ptr_0 bar_16_32_a_2 >> poke (Proxy @"bar_16_32_b") ptr_0 bar_16_32_b_3
+deriving via (EquivStorable Bar_16_32) instance Storable Bar_16_32
+deriving via (IsStructViaReadRaw Bar_16_32) instance IsStruct Bar_16_32
+instance (~) ty CLong => HasField "bar_16_32_a" Bar_16_32 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_16_32{bar_16_32_a = y_1,
+                                                bar_16_32_b = getField @"bar_16_32_b" x_0},
+                              getField @"bar_16_32_a" x_0)
+instance (~) ty CLong =>
+         HasField "bar_16_32_a" (Ptr Bar_16_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_16_32_a")
+instance HasCBitfield Bar_16_32 "bar_16_32_a"
+    where type CBitfieldType Bar_16_32 "bar_16_32_a" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 24
+instance (~) ty CInt => HasField "bar_16_32_b" Bar_16_32 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_16_32{bar_16_32_b = y_1,
+                                                bar_16_32_a = getField @"bar_16_32_a" x_0},
+                              getField @"bar_16_32_b" x_0)
+instance (~) ty CInt =>
+         HasField "bar_16_32_b" (Ptr Bar_16_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_16_32_b")
+instance HasCBitfield Bar_16_32 "bar_16_32_b"
+    where type CBitfieldType Bar_16_32 "bar_16_32_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 24
+          bitfieldWidth# = \_ -> \_ -> 14
+{-| __C declaration:__ @struct bar_16_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 80:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_16_64
+    = Bar_16_64 {bar_16_64_a :: CLLong
+                 {- ^ __C declaration:__ @a@
+
+                      __defined at:__ @types\/structs\/bitfields.h 81:20@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -},
+                 bar_16_64_b :: CInt
+                 {- ^ __C declaration:__ @b@
+
+                      __defined at:__ @types\/structs\/bitfields.h 82:20@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_16_64
+    where staticSizeOf = \_ -> 9 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_16_64
+    where readRaw = \ptr_0 -> (pure Bar_16_64 <*> peek (Proxy @"bar_16_64_a") ptr_0) <*> peek (Proxy @"bar_16_64_b") ptr_0
+instance WriteRaw Bar_16_64
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_16_64 bar_16_64_a_2
+                                                 bar_16_64_b_3 -> poke (Proxy @"bar_16_64_a") ptr_0 bar_16_64_a_2 >> poke (Proxy @"bar_16_64_b") ptr_0 bar_16_64_b_3
+deriving via (EquivStorable Bar_16_64) instance Storable Bar_16_64
+deriving via (IsStructViaReadRaw Bar_16_64) instance IsStruct Bar_16_64
+instance (~) ty CLLong => HasField "bar_16_64_a" Bar_16_64 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_16_64{bar_16_64_a = y_1,
+                                                bar_16_64_b = getField @"bar_16_64_b" x_0},
+                              getField @"bar_16_64_a" x_0)
+instance (~) ty CLLong =>
+         HasField "bar_16_64_a" (Ptr Bar_16_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_16_64_a")
+instance HasCBitfield Bar_16_64 "bar_16_64_a"
+    where type CBitfieldType Bar_16_64 "bar_16_64_a" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 56
+instance (~) ty CInt => HasField "bar_16_64_b" Bar_16_64 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_16_64{bar_16_64_b = y_1,
+                                                bar_16_64_a = getField @"bar_16_64_a" x_0},
+                              getField @"bar_16_64_b" x_0)
+instance (~) ty CInt =>
+         HasField "bar_16_64_b" (Ptr Bar_16_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_16_64_b")
+instance HasCBitfield Bar_16_64 "bar_16_64_b"
+    where type CBitfieldType Bar_16_64 "bar_16_64_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 56
+          bitfieldWidth# = \_ -> \_ -> 14
+{-| __C declaration:__ @struct bar_32_32@
+
+    __defined at:__ @types\/structs\/bitfields.h 86:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_32_32
+    = Bar_32_32 {bar_32_32_a :: CLong
+                 {- ^ __C declaration:__ @a@
+
+                      __defined at:__ @types\/structs\/bitfields.h 87:15@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -},
+                 bar_32_32_b :: CLong
+                 {- ^ __C declaration:__ @b@
+
+                      __defined at:__ @types\/structs\/bitfields.h 88:15@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_32_32
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_32_32
+    where readRaw = \ptr_0 -> (pure Bar_32_32 <*> peek (Proxy @"bar_32_32_a") ptr_0) <*> peek (Proxy @"bar_32_32_b") ptr_0
+instance WriteRaw Bar_32_32
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_32_32 bar_32_32_a_2
+                                                 bar_32_32_b_3 -> poke (Proxy @"bar_32_32_a") ptr_0 bar_32_32_a_2 >> poke (Proxy @"bar_32_32_b") ptr_0 bar_32_32_b_3
+deriving via (EquivStorable Bar_32_32) instance Storable Bar_32_32
+deriving via (IsStructViaReadRaw Bar_32_32) instance IsStruct Bar_32_32
+instance (~) ty CLong => HasField "bar_32_32_a" Bar_32_32 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_32_32{bar_32_32_a = y_1,
+                                                bar_32_32_b = getField @"bar_32_32_b" x_0},
+                              getField @"bar_32_32_a" x_0)
+instance (~) ty CLong =>
+         HasField "bar_32_32_a" (Ptr Bar_32_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_32_32_a")
+instance HasCBitfield Bar_32_32 "bar_32_32_a"
+    where type CBitfieldType Bar_32_32 "bar_32_32_a" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 30
+instance (~) ty CLong => HasField "bar_32_32_b" Bar_32_32 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_32_32{bar_32_32_b = y_1,
+                                                bar_32_32_a = getField @"bar_32_32_a" x_0},
+                              getField @"bar_32_32_b" x_0)
+instance (~) ty CLong =>
+         HasField "bar_32_32_b" (Ptr Bar_32_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_32_32_b")
+instance HasCBitfield Bar_32_32 "bar_32_32_b"
+    where type CBitfieldType Bar_32_32 "bar_32_32_b" = CLong
+          bitfieldOffset# = \_ -> \_ -> 30
+          bitfieldWidth# = \_ -> \_ -> 30
+{-| __C declaration:__ @struct bar_32_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 92:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_32_64
+    = Bar_32_64 {bar_32_64_a :: CLLong
+                 {- ^ __C declaration:__ @a@
+
+                      __defined at:__ @types\/structs\/bitfields.h 93:20@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -},
+                 bar_32_64_b :: CLong
+                 {- ^ __C declaration:__ @b@
+
+                      __defined at:__ @types\/structs\/bitfields.h 94:20@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_32_64
+    where staticSizeOf = \_ -> 11 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_32_64
+    where readRaw = \ptr_0 -> (pure Bar_32_64 <*> peek (Proxy @"bar_32_64_a") ptr_0) <*> peek (Proxy @"bar_32_64_b") ptr_0
+instance WriteRaw Bar_32_64
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_32_64 bar_32_64_a_2
+                                                 bar_32_64_b_3 -> poke (Proxy @"bar_32_64_a") ptr_0 bar_32_64_a_2 >> poke (Proxy @"bar_32_64_b") ptr_0 bar_32_64_b_3
+deriving via (EquivStorable Bar_32_64) instance Storable Bar_32_64
+deriving via (IsStructViaReadRaw Bar_32_64) instance IsStruct Bar_32_64
+instance (~) ty CLLong => HasField "bar_32_64_a" Bar_32_64 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_32_64{bar_32_64_a = y_1,
+                                                bar_32_64_b = getField @"bar_32_64_b" x_0},
+                              getField @"bar_32_64_a" x_0)
+instance (~) ty CLLong =>
+         HasField "bar_32_64_a" (Ptr Bar_32_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_32_64_a")
+instance HasCBitfield Bar_32_64 "bar_32_64_a"
+    where type CBitfieldType Bar_32_64 "bar_32_64_a" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 56
+instance (~) ty CLong => HasField "bar_32_64_b" Bar_32_64 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_32_64{bar_32_64_b = y_1,
+                                                bar_32_64_a = getField @"bar_32_64_a" x_0},
+                              getField @"bar_32_64_b" x_0)
+instance (~) ty CLong =>
+         HasField "bar_32_64_b" (Ptr Bar_32_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_32_64_b")
+instance HasCBitfield Bar_32_64 "bar_32_64_b"
+    where type CBitfieldType Bar_32_64 "bar_32_64_b" = CLong
+          bitfieldOffset# = \_ -> \_ -> 56
+          bitfieldWidth# = \_ -> \_ -> 30
+{-| __C declaration:__ @struct bar_64_64@
+
+    __defined at:__ @types\/structs\/bitfields.h 98:32@
+
+    __exported by:__ @types\/structs\/bitfields.h@
+-}
+data Bar_64_64
+    = Bar_64_64 {bar_64_64_a :: CLLong
+                 {- ^ __C declaration:__ @a@
+
+                      __defined at:__ @types\/structs\/bitfields.h 99:20@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -},
+                 bar_64_64_b :: CLLong
+                 {- ^ __C declaration:__ @b@
+
+                      __defined at:__ @types\/structs\/bitfields.h 100:20@
+
+                      __exported by:__ @types\/structs\/bitfields.h@
+                 -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar_64_64
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar_64_64
+    where readRaw = \ptr_0 -> (pure Bar_64_64 <*> peek (Proxy @"bar_64_64_a") ptr_0) <*> peek (Proxy @"bar_64_64_b") ptr_0
+instance WriteRaw Bar_64_64
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar_64_64 bar_64_64_a_2
+                                                 bar_64_64_b_3 -> poke (Proxy @"bar_64_64_a") ptr_0 bar_64_64_a_2 >> poke (Proxy @"bar_64_64_b") ptr_0 bar_64_64_b_3
+deriving via (EquivStorable Bar_64_64) instance Storable Bar_64_64
+deriving via (IsStructViaReadRaw Bar_64_64) instance IsStruct Bar_64_64
+instance (~) ty CLLong => HasField "bar_64_64_a" Bar_64_64 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_64_64{bar_64_64_a = y_1,
+                                                bar_64_64_b = getField @"bar_64_64_b" x_0},
+                              getField @"bar_64_64_a" x_0)
+instance (~) ty CLLong =>
+         HasField "bar_64_64_a" (Ptr Bar_64_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_64_64_a")
+instance HasCBitfield Bar_64_64 "bar_64_64_a"
+    where type CBitfieldType Bar_64_64 "bar_64_64_a" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 56
+instance (~) ty CLLong => HasField "bar_64_64_b" Bar_64_64 ty
+    where hasField = \x_0 -> (\y_1 -> Bar_64_64{bar_64_64_b = y_1,
+                                                bar_64_64_a = getField @"bar_64_64_a" x_0},
+                              getField @"bar_64_64_b" x_0)
+instance (~) ty CLLong =>
+         HasField "bar_64_64_b" (Ptr Bar_64_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_64_64_b")
+instance HasCBitfield Bar_64_64 "bar_64_64_b"
+    where type CBitfieldType Bar_64_64 "bar_64_64_b" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 56
+          bitfieldWidth# = \_ -> \_ -> 40
diff --git a/test-artefacts/fixtures/types/structs/circular_dependency_struct/Example.hs b/test-artefacts/fixtures/types/structs/circular_dependency_struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/circular_dependency_struct/Example.hs
@@ -0,0 +1,157 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.B(..)
+    , Example.A(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct b@
+
+    __defined at:__ @types\/structs\/circular_dependency_struct.h 3:8@
+
+    __exported by:__ @types\/structs\/circular_dependency_struct.h@
+-}
+data B = B
+  { b_toA :: BG.Ptr A
+    {- ^ __C declaration:__ @toA@
+
+         __defined at:__ @types\/structs\/circular_dependency_struct.h 4:13@
+
+         __exported by:__ @types\/structs\/circular_dependency_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize B where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw B where
+
+  readRaw =
+    \ptr0 ->
+          pure B
+      <*> HasCField.readRaw (BG.Proxy @"b_toA") ptr0
+
+instance Marshal.WriteRaw B where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          B b_toA2 ->
+            HasCField.writeRaw (BG.Proxy @"b_toA") ptr0 b_toA2
+
+deriving via Marshal.EquivStorable B instance BG.Storable B
+
+deriving via Struct.IsStructViaReadRaw B instance Struct.IsStruct B
+
+{-| __C declaration:__ @toA@
+
+    __defined at:__ @types\/structs\/circular_dependency_struct.h 4:13@
+
+    __exported by:__ @types\/structs\/circular_dependency_struct.h@
+-}
+instance (ty ~ BG.Ptr A) => BG.CompatHasField.HasField "b_toA" B ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> B {b_toA = y1}, BG.getField @"b_toA" x0)
+
+instance (ty ~ BG.Ptr A) => BG.HasField "b_toA" (BG.Ptr B) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b_toA")
+
+instance HasCField.HasCField B "b_toA" where
+
+  type CFieldType B "b_toA" = BG.Ptr A
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct a@
+
+    __defined at:__ @types\/structs\/circular_dependency_struct.h 7:8@
+
+    __exported by:__ @types\/structs\/circular_dependency_struct.h@
+-}
+data A = A
+  { a_toB :: B
+    {- ^ __C declaration:__ @toB@
+
+         __defined at:__ @types\/structs\/circular_dependency_struct.h 8:12@
+
+         __exported by:__ @types\/structs\/circular_dependency_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize A where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw A where
+
+  readRaw =
+    \ptr0 ->
+          pure A
+      <*> HasCField.readRaw (BG.Proxy @"a_toB") ptr0
+
+instance Marshal.WriteRaw A where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          A a_toB2 ->
+            HasCField.writeRaw (BG.Proxy @"a_toB") ptr0 a_toB2
+
+deriving via Marshal.EquivStorable A instance BG.Storable A
+
+deriving via Struct.IsStructViaReadRaw A instance Struct.IsStruct A
+
+{-| __C declaration:__ @toB@
+
+    __defined at:__ @types\/structs\/circular_dependency_struct.h 8:12@
+
+    __exported by:__ @types\/structs\/circular_dependency_struct.h@
+-}
+instance (ty ~ B) => BG.CompatHasField.HasField "a_toB" A ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> A {a_toB = y1}, BG.getField @"a_toB" x0)
+
+instance (ty ~ B) => BG.HasField "a_toB" (BG.Ptr A) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a_toB")
+
+instance HasCField.HasCField A "a_toB" where
+
+  type CFieldType A "a_toB" = B
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/structs/circular_dependency_struct/bindingspec.yaml b/test-artefacts/fixtures/types/structs/circular_dependency_struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/circular_dependency_struct/bindingspec.yaml
@@ -0,0 +1,50 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/circular_dependency_struct.h
+  cname: struct b
+  hsname: B
+- headers: types/structs/circular_dependency_struct.h
+  cname: struct a
+  hsname: A
+hstypes:
+- hsname: A
+  representation:
+    record:
+      constructor: A
+      fields:
+      - a_toB
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B
+  representation:
+    record:
+      constructor: B
+      fields:
+      - b_toA
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/circular_dependency_struct/th.txt b/test-artefacts/fixtures/types/structs/circular_dependency_struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/circular_dependency_struct/th.txt
@@ -0,0 +1,67 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/circular_dependency_struct.h
+{-| __C declaration:__ @struct b@
+
+    __defined at:__ @types\/structs\/circular_dependency_struct.h 3:8@
+
+    __exported by:__ @types\/structs\/circular_dependency_struct.h@
+-}
+data B
+    = B {b_toA :: (Ptr A)
+         {- ^ __C declaration:__ @toA@
+
+              __defined at:__ @types\/structs\/circular_dependency_struct.h 4:13@
+
+              __exported by:__ @types\/structs\/circular_dependency_struct.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize B
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw B
+    where readRaw = \ptr_0 -> pure B <*> readRaw (Proxy @"b_toA") ptr_0
+instance WriteRaw B
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       B b_toA_2 -> writeRaw (Proxy @"b_toA") ptr_0 b_toA_2
+deriving via (EquivStorable B) instance Storable B
+deriving via (IsStructViaReadRaw B) instance IsStruct B
+instance (~) ty (Ptr A) => HasField "b_toA" B ty
+    where hasField = \x_0 -> (\y_1 -> B{b_toA = y_1},
+                              getField @"b_toA" x_0)
+instance (~) ty (Ptr A) => HasField "b_toA" (Ptr B) (Ptr ty)
+    where getField = fromPtr (Proxy @"b_toA")
+instance HasCField B "b_toA"
+    where type CFieldType B "b_toA" = Ptr A
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct a@
+
+    __defined at:__ @types\/structs\/circular_dependency_struct.h 7:8@
+
+    __exported by:__ @types\/structs\/circular_dependency_struct.h@
+-}
+data A
+    = A {a_toB :: B
+         {- ^ __C declaration:__ @toB@
+
+              __defined at:__ @types\/structs\/circular_dependency_struct.h 8:12@
+
+              __exported by:__ @types\/structs\/circular_dependency_struct.h@
+         -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize A
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw A
+    where readRaw = \ptr_0 -> pure A <*> readRaw (Proxy @"a_toB") ptr_0
+instance WriteRaw A
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       A a_toB_2 -> writeRaw (Proxy @"a_toB") ptr_0 a_toB_2
+deriving via (EquivStorable A) instance Storable A
+deriving via (IsStructViaReadRaw A) instance IsStruct A
+instance (~) ty B => HasField "a_toB" A ty
+    where hasField = \x_0 -> (\y_1 -> A{a_toB = y_1},
+                              getField @"a_toB" x_0)
+instance (~) ty B => HasField "a_toB" (Ptr A) (Ptr ty)
+    where getField = fromPtr (Proxy @"a_toB")
+instance HasCField A "a_toB"
+    where type CFieldType A "a_toB" = B
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/structs/padding/Example.hs b/test-artefacts/fixtures/types/structs/padding/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/padding/Example.hs
@@ -0,0 +1,281 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo(..)
+    , Example.Bar(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.BitfieldPtr as BitfieldPtr
+import qualified HsBindgen.Runtime.HasCBitfield as HasCBitfield
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @types\/structs\/padding.h 1:8@
+
+    __exported by:__ @types\/structs\/padding.h@
+-}
+data Foo = Foo
+  { foo_a :: BG.CSChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/padding.h 2:15@
+
+         __exported by:__ @types\/structs\/padding.h@
+    -}
+  , foo_b :: BG.CSChar
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/padding.h 3:15@
+
+         __exported by:__ @types\/structs\/padding.h@
+    -}
+  , foo_c :: BG.CSChar
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/padding.h 5:15@
+
+         __exported by:__ @types\/structs\/padding.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo where
+
+  staticSizeOf = \_ -> (2 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Foo where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo
+      <*> HasCBitfield.peek (BG.Proxy @"foo_a") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_b") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"foo_c") ptr0
+
+instance Marshal.WriteRaw Foo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo foo_a2 foo_b3 foo_c4 ->
+               HasCBitfield.poke (BG.Proxy @"foo_a") ptr0 foo_a2
+            >> HasCBitfield.poke (BG.Proxy @"foo_b") ptr0 foo_b3
+            >> HasCBitfield.poke (BG.Proxy @"foo_c") ptr0 foo_c4
+
+deriving via Marshal.EquivStorable Foo instance BG.Storable Foo
+
+deriving via Struct.IsStructViaReadRaw Foo instance Struct.IsStruct Foo
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/padding.h 2:15@
+
+    __exported by:__ @types\/structs\/padding.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_a" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_a = y1, foo_b = BG.getField @"foo_b" x0, foo_c = BG.getField @"foo_c" x0}
+      , BG.getField @"foo_a" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_a" (BG.Ptr Foo) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_a")
+
+instance HasCBitfield.HasCBitfield Foo "foo_a" where
+
+  type CBitfieldType Foo "foo_a" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/padding.h 3:15@
+
+    __exported by:__ @types\/structs\/padding.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_b" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_b = y1, foo_a = BG.getField @"foo_a" x0, foo_c = BG.getField @"foo_c" x0}
+      , BG.getField @"foo_b" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_b" (BG.Ptr Foo) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_b")
+
+instance HasCBitfield.HasCBitfield Foo "foo_b" where
+
+  type CBitfieldType Foo "foo_b" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 3
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/padding.h 5:15@
+
+    __exported by:__ @types\/structs\/padding.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_c" Foo ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Foo {foo_c = y1, foo_a = BG.getField @"foo_a" x0, foo_b = BG.getField @"foo_b" x0}
+      , BG.getField @"foo_c" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_c" (BG.Ptr Foo) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_c")
+
+instance HasCBitfield.HasCBitfield Foo "foo_c" where
+
+  type CBitfieldType Foo "foo_c" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 8
+
+  bitfieldWidth# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @types\/structs\/padding.h 8:8@
+
+    __exported by:__ @types\/structs\/padding.h@
+-}
+data Bar = Bar
+  { bar_x :: BG.CSChar
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/structs\/padding.h 9:15@
+
+         __exported by:__ @types\/structs\/padding.h@
+    -}
+  , bar_y :: BG.CSChar
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/structs\/padding.h 11:15@
+
+         __exported by:__ @types\/structs\/padding.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Bar where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Bar where
+
+  readRaw =
+    \ptr0 ->
+          pure Bar
+      <*> HasCBitfield.peek (BG.Proxy @"bar_x") ptr0
+      <*> HasCBitfield.peek (BG.Proxy @"bar_y") ptr0
+
+instance Marshal.WriteRaw Bar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Bar bar_x2 bar_y3 ->
+               HasCBitfield.poke (BG.Proxy @"bar_x") ptr0 bar_x2
+            >> HasCBitfield.poke (BG.Proxy @"bar_y") ptr0 bar_y3
+
+deriving via Marshal.EquivStorable Bar instance BG.Storable Bar
+
+deriving via Struct.IsStructViaReadRaw Bar instance Struct.IsStruct Bar
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/structs\/padding.h 9:15@
+
+    __exported by:__ @types\/structs\/padding.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "bar_x" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_x = y1, bar_y = BG.getField @"bar_y" x0}
+      , BG.getField @"bar_x" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "bar_x" (BG.Ptr Bar) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"bar_x")
+
+instance HasCBitfield.HasCBitfield Bar "bar_x" where
+
+  type CBitfieldType Bar "bar_x" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/structs\/padding.h 11:15@
+
+    __exported by:__ @types\/structs\/padding.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "bar_y" Bar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Bar {bar_y = y1, bar_x = BG.getField @"bar_x" x0}
+      , BG.getField @"bar_y" x0
+      )
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "bar_y" (BG.Ptr Bar) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"bar_y")
+
+instance HasCBitfield.HasCBitfield Bar "bar_y" where
+
+  type CBitfieldType Bar "bar_y" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 6
+
+  bitfieldWidth# = \_ -> \_ -> 2
diff --git a/test-artefacts/fixtures/types/structs/padding/bindingspec.yaml b/test-artefacts/fixtures/types/structs/padding/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/padding/bindingspec.yaml
@@ -0,0 +1,53 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/padding.h
+  cname: struct foo
+  hsname: Foo
+- headers: types/structs/padding.h
+  cname: struct bar
+  hsname: Bar
+hstypes:
+- hsname: Bar
+  representation:
+    record:
+      constructor: Bar
+      fields:
+      - bar_x
+      - bar_y
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    record:
+      constructor: Foo
+      fields:
+      - foo_a
+      - foo_b
+      - foo_c
+  instances:
+  - Eq
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/padding/th.txt b/test-artefacts/fixtures/types/structs/padding/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/padding/th.txt
@@ -0,0 +1,133 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/padding.h
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @types\/structs\/padding.h 1:8@
+
+    __exported by:__ @types\/structs\/padding.h@
+-}
+data Foo
+    = Foo {foo_a :: CSChar
+           {- ^ __C declaration:__ @a@
+
+                __defined at:__ @types\/structs\/padding.h 2:15@
+
+                __exported by:__ @types\/structs\/padding.h@
+           -},
+           foo_b :: CSChar
+           {- ^ __C declaration:__ @b@
+
+                __defined at:__ @types\/structs\/padding.h 3:15@
+
+                __exported by:__ @types\/structs\/padding.h@
+           -},
+           foo_c :: CSChar
+           {- ^ __C declaration:__ @c@
+
+                __defined at:__ @types\/structs\/padding.h 5:15@
+
+                __exported by:__ @types\/structs\/padding.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo
+    where staticSizeOf = \_ -> 2 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Foo
+    where readRaw = \ptr_0 -> ((pure Foo <*> peek (Proxy @"foo_a") ptr_0) <*> peek (Proxy @"foo_b") ptr_0) <*> peek (Proxy @"foo_c") ptr_0
+instance WriteRaw Foo
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo foo_a_2
+                                           foo_b_3
+                                           foo_c_4 -> poke (Proxy @"foo_a") ptr_0 foo_a_2 >> (poke (Proxy @"foo_b") ptr_0 foo_b_3 >> poke (Proxy @"foo_c") ptr_0 foo_c_4)
+deriving via (EquivStorable Foo) instance Storable Foo
+deriving via (IsStructViaReadRaw Foo) instance IsStruct Foo
+instance (~) ty CSChar => HasField "foo_a" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_a = y_1,
+                                          foo_b = getField @"foo_b" x_0,
+                                          foo_c = getField @"foo_c" x_0},
+                              getField @"foo_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_a" (Ptr Foo) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_a")
+instance HasCBitfield Foo "foo_a"
+    where type CBitfieldType Foo "foo_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_b" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_b = y_1,
+                                          foo_a = getField @"foo_a" x_0,
+                                          foo_c = getField @"foo_c" x_0},
+                              getField @"foo_b" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_b" (Ptr Foo) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_b")
+instance HasCBitfield Foo "foo_b"
+    where type CBitfieldType Foo "foo_b" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 3
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_c" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_c = y_1,
+                                          foo_a = getField @"foo_a" x_0,
+                                          foo_b = getField @"foo_b" x_0},
+                              getField @"foo_c" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_c" (Ptr Foo) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_c")
+instance HasCBitfield Foo "foo_c"
+    where type CBitfieldType Foo "foo_c" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 8
+          bitfieldWidth# = \_ -> \_ -> 2
+{-| __C declaration:__ @struct bar@
+
+    __defined at:__ @types\/structs\/padding.h 8:8@
+
+    __exported by:__ @types\/structs\/padding.h@
+-}
+data Bar
+    = Bar {bar_x :: CSChar
+           {- ^ __C declaration:__ @x@
+
+                __defined at:__ @types\/structs\/padding.h 9:15@
+
+                __exported by:__ @types\/structs\/padding.h@
+           -},
+           bar_y :: CSChar
+           {- ^ __C declaration:__ @y@
+
+                __defined at:__ @types\/structs\/padding.h 11:15@
+
+                __exported by:__ @types\/structs\/padding.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Bar
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Bar
+    where readRaw = \ptr_0 -> (pure Bar <*> peek (Proxy @"bar_x") ptr_0) <*> peek (Proxy @"bar_y") ptr_0
+instance WriteRaw Bar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Bar bar_x_2
+                                           bar_y_3 -> poke (Proxy @"bar_x") ptr_0 bar_x_2 >> poke (Proxy @"bar_y") ptr_0 bar_y_3
+deriving via (EquivStorable Bar) instance Storable Bar
+deriving via (IsStructViaReadRaw Bar) instance IsStruct Bar
+instance (~) ty CSChar => HasField "bar_x" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_x = y_1,
+                                          bar_y = getField @"bar_y" x_0},
+                              getField @"bar_x" x_0)
+instance (~) ty CSChar =>
+         HasField "bar_x" (Ptr Bar) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_x")
+instance HasCBitfield Bar "bar_x"
+    where type CBitfieldType Bar "bar_x" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "bar_y" Bar ty
+    where hasField = \x_0 -> (\y_1 -> Bar{bar_y = y_1,
+                                          bar_x = getField @"bar_x" x_0},
+                              getField @"bar_y" x_0)
+instance (~) ty CSChar =>
+         HasField "bar_y" (Ptr Bar) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"bar_y")
+instance HasCBitfield Bar "bar_y"
+    where type CBitfieldType Bar "bar_y" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 6
+          bitfieldWidth# = \_ -> \_ -> 2
diff --git a/test-artefacts/fixtures/types/structs/recursive_struct/Example.hs b/test-artefacts/fixtures/types/structs/recursive_struct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/recursive_struct/Example.hs
@@ -0,0 +1,255 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Linked_list_A_t(..)
+    , Example.Linked_list_B_t(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct linked_list_A_s@
+
+    __defined at:__ @types\/structs\/recursive_struct.h 1:16@
+
+    __exported by:__ @types\/structs\/recursive_struct.h@
+-}
+data Linked_list_A_t = Linked_list_A_t
+  { linked_list_A_t_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/structs\/recursive_struct.h 2:7@
+
+         __exported by:__ @types\/structs\/recursive_struct.h@
+    -}
+  , linked_list_A_t_next :: BG.Ptr Linked_list_A_t
+    {- ^ __C declaration:__ @next@
+
+         __defined at:__ @types\/structs\/recursive_struct.h 3:27@
+
+         __exported by:__ @types\/structs\/recursive_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Linked_list_A_t where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Linked_list_A_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Linked_list_A_t
+      <*> HasCField.readRaw (BG.Proxy @"linked_list_A_t_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"linked_list_A_t_next") ptr0
+
+instance Marshal.WriteRaw Linked_list_A_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Linked_list_A_t linked_list_A_t_x2 linked_list_A_t_next3 ->
+               HasCField.writeRaw (BG.Proxy @"linked_list_A_t_x") ptr0 linked_list_A_t_x2
+            >> HasCField.writeRaw (BG.Proxy @"linked_list_A_t_next") ptr0 linked_list_A_t_next3
+
+deriving via Marshal.EquivStorable Linked_list_A_t instance BG.Storable Linked_list_A_t
+
+deriving via Struct.IsStructViaReadRaw Linked_list_A_t instance Struct.IsStruct Linked_list_A_t
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/structs\/recursive_struct.h 2:7@
+
+    __exported by:__ @types\/structs\/recursive_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "linked_list_A_t_x" Linked_list_A_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Linked_list_A_t { linked_list_A_t_x = y1
+                          , linked_list_A_t_next = BG.getField @"linked_list_A_t_next" x0
+                          }
+      , BG.getField @"linked_list_A_t_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "linked_list_A_t_x" (BG.Ptr Linked_list_A_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"linked_list_A_t_x")
+
+instance HasCField.HasCField Linked_list_A_t "linked_list_A_t_x" where
+
+  type CFieldType Linked_list_A_t "linked_list_A_t_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @next@
+
+    __defined at:__ @types\/structs\/recursive_struct.h 3:27@
+
+    __exported by:__ @types\/structs\/recursive_struct.h@
+-}
+instance ( ty ~ BG.Ptr Linked_list_A_t
+         ) => BG.CompatHasField.HasField "linked_list_A_t_next" Linked_list_A_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Linked_list_A_t { linked_list_A_t_next = y1
+                          , linked_list_A_t_x = BG.getField @"linked_list_A_t_x" x0
+                          }
+      , BG.getField @"linked_list_A_t_next" x0
+      )
+
+instance ( ty ~ BG.Ptr Linked_list_A_t
+         ) => BG.HasField "linked_list_A_t_next" (BG.Ptr Linked_list_A_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"linked_list_A_t_next")
+
+instance HasCField.HasCField Linked_list_A_t "linked_list_A_t_next" where
+
+  type CFieldType Linked_list_A_t "linked_list_A_t_next" =
+    BG.Ptr Linked_list_A_t
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct linked_list_B_t@
+
+    __defined at:__ @types\/structs\/recursive_struct.h 9:8@
+
+    __exported by:__ @types\/structs\/recursive_struct.h@
+-}
+data Linked_list_B_t = Linked_list_B_t
+  { linked_list_B_t_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/structs\/recursive_struct.h 10:7@
+
+         __exported by:__ @types\/structs\/recursive_struct.h@
+    -}
+  , linked_list_B_t_next :: BG.Ptr Linked_list_B_t
+    {- ^ __C declaration:__ @next@
+
+         __defined at:__ @types\/structs\/recursive_struct.h 11:20@
+
+         __exported by:__ @types\/structs\/recursive_struct.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Linked_list_B_t where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Linked_list_B_t where
+
+  readRaw =
+    \ptr0 ->
+          pure Linked_list_B_t
+      <*> HasCField.readRaw (BG.Proxy @"linked_list_B_t_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"linked_list_B_t_next") ptr0
+
+instance Marshal.WriteRaw Linked_list_B_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Linked_list_B_t linked_list_B_t_x2 linked_list_B_t_next3 ->
+               HasCField.writeRaw (BG.Proxy @"linked_list_B_t_x") ptr0 linked_list_B_t_x2
+            >> HasCField.writeRaw (BG.Proxy @"linked_list_B_t_next") ptr0 linked_list_B_t_next3
+
+deriving via Marshal.EquivStorable Linked_list_B_t instance BG.Storable Linked_list_B_t
+
+deriving via Struct.IsStructViaReadRaw Linked_list_B_t instance Struct.IsStruct Linked_list_B_t
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/structs\/recursive_struct.h 10:7@
+
+    __exported by:__ @types\/structs\/recursive_struct.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "linked_list_B_t_x" Linked_list_B_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Linked_list_B_t { linked_list_B_t_x = y1
+                          , linked_list_B_t_next = BG.getField @"linked_list_B_t_next" x0
+                          }
+      , BG.getField @"linked_list_B_t_x" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "linked_list_B_t_x" (BG.Ptr Linked_list_B_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"linked_list_B_t_x")
+
+instance HasCField.HasCField Linked_list_B_t "linked_list_B_t_x" where
+
+  type CFieldType Linked_list_B_t "linked_list_B_t_x" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @next@
+
+    __defined at:__ @types\/structs\/recursive_struct.h 11:20@
+
+    __exported by:__ @types\/structs\/recursive_struct.h@
+-}
+instance ( ty ~ BG.Ptr Linked_list_B_t
+         ) => BG.CompatHasField.HasField "linked_list_B_t_next" Linked_list_B_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Linked_list_B_t { linked_list_B_t_next = y1
+                          , linked_list_B_t_x = BG.getField @"linked_list_B_t_x" x0
+                          }
+      , BG.getField @"linked_list_B_t_next" x0
+      )
+
+instance ( ty ~ BG.Ptr Linked_list_B_t
+         ) => BG.HasField "linked_list_B_t_next" (BG.Ptr Linked_list_B_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"linked_list_B_t_next")
+
+instance HasCField.HasCField Linked_list_B_t "linked_list_B_t_next" where
+
+  type CFieldType Linked_list_B_t "linked_list_B_t_next" =
+    BG.Ptr Linked_list_B_t
+
+  offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/structs/recursive_struct/bindingspec.yaml b/test-artefacts/fixtures/types/structs/recursive_struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/recursive_struct/bindingspec.yaml
@@ -0,0 +1,58 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/recursive_struct.h
+  cname: struct linked_list_A_s
+  hsname: Linked_list_A_t
+- headers: types/structs/recursive_struct.h
+  cname: linked_list_A_t
+  hsname: Linked_list_A_t
+- headers: types/structs/recursive_struct.h
+  cname: linked_list_B_t
+  hsname: Linked_list_B_t
+- headers: types/structs/recursive_struct.h
+  cname: struct linked_list_B_t
+  hsname: Linked_list_B_t
+hstypes:
+- hsname: Linked_list_A_t
+  representation:
+    record:
+      constructor: Linked_list_A_t
+      fields:
+      - linked_list_A_t_x
+      - linked_list_A_t_next
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Linked_list_B_t
+  representation:
+    record:
+      constructor: Linked_list_B_t
+      fields:
+      - linked_list_B_t_x
+      - linked_list_B_t_next
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/recursive_struct/th.txt b/test-artefacts/fixtures/types/structs/recursive_struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/recursive_struct/th.txt
@@ -0,0 +1,113 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/recursive_struct.h
+{-| __C declaration:__ @struct linked_list_A_s@
+
+    __defined at:__ @types\/structs\/recursive_struct.h 1:16@
+
+    __exported by:__ @types\/structs\/recursive_struct.h@
+-}
+data Linked_list_A_t
+    = Linked_list_A_t {linked_list_A_t_x :: CInt
+                       {- ^ __C declaration:__ @x@
+
+                            __defined at:__ @types\/structs\/recursive_struct.h 2:7@
+
+                            __exported by:__ @types\/structs\/recursive_struct.h@
+                       -},
+                       linked_list_A_t_next :: (Ptr Linked_list_A_t)
+                       {- ^ __C declaration:__ @next@
+
+                            __defined at:__ @types\/structs\/recursive_struct.h 3:27@
+
+                            __exported by:__ @types\/structs\/recursive_struct.h@
+                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Linked_list_A_t
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Linked_list_A_t
+    where readRaw = \ptr_0 -> (pure Linked_list_A_t <*> readRaw (Proxy @"linked_list_A_t_x") ptr_0) <*> readRaw (Proxy @"linked_list_A_t_next") ptr_0
+instance WriteRaw Linked_list_A_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Linked_list_A_t linked_list_A_t_x_2
+                                                       linked_list_A_t_next_3 -> writeRaw (Proxy @"linked_list_A_t_x") ptr_0 linked_list_A_t_x_2 >> writeRaw (Proxy @"linked_list_A_t_next") ptr_0 linked_list_A_t_next_3
+deriving via (EquivStorable Linked_list_A_t) instance Storable Linked_list_A_t
+deriving via (IsStructViaReadRaw Linked_list_A_t) instance IsStruct Linked_list_A_t
+instance (~) ty CInt =>
+         HasField "linked_list_A_t_x" Linked_list_A_t ty
+    where hasField = \x_0 -> (\y_1 -> Linked_list_A_t{linked_list_A_t_x = y_1,
+                                                      linked_list_A_t_next = getField @"linked_list_A_t_next" x_0},
+                              getField @"linked_list_A_t_x" x_0)
+instance (~) ty CInt =>
+         HasField "linked_list_A_t_x" (Ptr Linked_list_A_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"linked_list_A_t_x")
+instance HasCField Linked_list_A_t "linked_list_A_t_x"
+    where type CFieldType Linked_list_A_t "linked_list_A_t_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Linked_list_A_t) =>
+         HasField "linked_list_A_t_next" Linked_list_A_t ty
+    where hasField = \x_0 -> (\y_1 -> Linked_list_A_t{linked_list_A_t_next = y_1,
+                                                      linked_list_A_t_x = getField @"linked_list_A_t_x" x_0},
+                              getField @"linked_list_A_t_next" x_0)
+instance (~) ty (Ptr Linked_list_A_t) =>
+         HasField "linked_list_A_t_next" (Ptr Linked_list_A_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"linked_list_A_t_next")
+instance HasCField Linked_list_A_t "linked_list_A_t_next"
+    where type CFieldType Linked_list_A_t
+                          "linked_list_A_t_next" = Ptr Linked_list_A_t
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct linked_list_B_t@
+
+    __defined at:__ @types\/structs\/recursive_struct.h 9:8@
+
+    __exported by:__ @types\/structs\/recursive_struct.h@
+-}
+data Linked_list_B_t
+    = Linked_list_B_t {linked_list_B_t_x :: CInt
+                       {- ^ __C declaration:__ @x@
+
+                            __defined at:__ @types\/structs\/recursive_struct.h 10:7@
+
+                            __exported by:__ @types\/structs\/recursive_struct.h@
+                       -},
+                       linked_list_B_t_next :: (Ptr Linked_list_B_t)
+                       {- ^ __C declaration:__ @next@
+
+                            __defined at:__ @types\/structs\/recursive_struct.h 11:20@
+
+                            __exported by:__ @types\/structs\/recursive_struct.h@
+                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Linked_list_B_t
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Linked_list_B_t
+    where readRaw = \ptr_0 -> (pure Linked_list_B_t <*> readRaw (Proxy @"linked_list_B_t_x") ptr_0) <*> readRaw (Proxy @"linked_list_B_t_next") ptr_0
+instance WriteRaw Linked_list_B_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Linked_list_B_t linked_list_B_t_x_2
+                                                       linked_list_B_t_next_3 -> writeRaw (Proxy @"linked_list_B_t_x") ptr_0 linked_list_B_t_x_2 >> writeRaw (Proxy @"linked_list_B_t_next") ptr_0 linked_list_B_t_next_3
+deriving via (EquivStorable Linked_list_B_t) instance Storable Linked_list_B_t
+deriving via (IsStructViaReadRaw Linked_list_B_t) instance IsStruct Linked_list_B_t
+instance (~) ty CInt =>
+         HasField "linked_list_B_t_x" Linked_list_B_t ty
+    where hasField = \x_0 -> (\y_1 -> Linked_list_B_t{linked_list_B_t_x = y_1,
+                                                      linked_list_B_t_next = getField @"linked_list_B_t_next" x_0},
+                              getField @"linked_list_B_t_x" x_0)
+instance (~) ty CInt =>
+         HasField "linked_list_B_t_x" (Ptr Linked_list_B_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"linked_list_B_t_x")
+instance HasCField Linked_list_B_t "linked_list_B_t_x"
+    where type CFieldType Linked_list_B_t "linked_list_B_t_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty (Ptr Linked_list_B_t) =>
+         HasField "linked_list_B_t_next" Linked_list_B_t ty
+    where hasField = \x_0 -> (\y_1 -> Linked_list_B_t{linked_list_B_t_next = y_1,
+                                                      linked_list_B_t_x = getField @"linked_list_B_t_x" x_0},
+                              getField @"linked_list_B_t_next" x_0)
+instance (~) ty (Ptr Linked_list_B_t) =>
+         HasField "linked_list_B_t_next" (Ptr Linked_list_B_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"linked_list_B_t_next")
+instance HasCField Linked_list_B_t "linked_list_B_t_next"
+    where type CFieldType Linked_list_B_t
+                          "linked_list_B_t_next" = Ptr Linked_list_B_t
+          offset# = \_ -> \_ -> 8
diff --git a/test-artefacts/fixtures/types/structs/simple_structs.omit_field_prefixes/Example.hs b/test-artefacts/fixtures/types/structs/simple_structs.omit_field_prefixes/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/simple_structs.omit_field_prefixes/Example.hs
@@ -0,0 +1,936 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoFieldSelectors #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S1(..)
+    , Example.S2_t(..)
+    , Example.S3_t(..)
+    , Example.S4(..)
+    , Example.S5(..)
+    , Example.S6(..)
+    , Example.S7a_Aux(..)
+    , Example.S7a(..)
+    , Example.S7b_Aux(..)
+    , Example.S7b(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Ord, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/structs\/simple_structs.h 2:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S1 = S1
+  { a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 3:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , b :: BG.CChar
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 4:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S1 where
+
+  readRaw =
+    \ptr0 ->
+          pure S1
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"b") ptr0
+
+instance Marshal.WriteRaw S1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S1 a2 b3 ->
+               HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+            >> HasCField.writeRaw (BG.Proxy @"b") ptr0 b3
+
+deriving via Marshal.EquivStorable S1 instance BG.Storable S1
+
+deriving via Struct.IsStructViaReadRaw S1 instance Struct.IsStruct S1
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 3:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "a" S1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S1 {a = y1, b = BG.getField @"b" x0}, BG.getField @"a" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "a" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField S1 "a" where
+
+  type CFieldType S1 "a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 4:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "b" S1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S1 {b = y1, a = BG.getField @"a" x0}, BG.getField @"b" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "b" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b")
+
+instance HasCField.HasCField S1 "b" where
+
+  type CFieldType S1 "b" = BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/structs\/simple_structs.h 8:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S2_t = S2_t
+  { a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 9:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 10:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , c :: BG.CFloat
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/simple_structs.h 11:11@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2_t where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S2_t where
+
+  readRaw =
+    \ptr0 ->
+          pure S2_t
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"c") ptr0
+
+instance Marshal.WriteRaw S2_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2_t a2 b3 c4 ->
+               HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+            >> HasCField.writeRaw (BG.Proxy @"b") ptr0 b3
+            >> HasCField.writeRaw (BG.Proxy @"c") ptr0 c4
+
+deriving via Marshal.EquivStorable S2_t instance BG.Storable S2_t
+
+deriving via Struct.IsStructViaReadRaw S2_t instance Struct.IsStruct S2_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 9:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "a" S2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_t {a = y1, b = BG.getField @"b" x0, c = BG.getField @"c" x0}
+      , BG.getField @"a" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "a" (BG.Ptr S2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField S2_t "a" where
+
+  type CFieldType S2_t "a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 10:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "b" S2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_t {b = y1, a = BG.getField @"a" x0, c = BG.getField @"c" x0}
+      , BG.getField @"b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "b" (BG.Ptr S2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b")
+
+instance HasCField.HasCField S2_t "b" where
+
+  type CFieldType S2_t "b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/simple_structs.h 11:11@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "c" S2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_t {c = y1, a = BG.getField @"a" x0, b = BG.getField @"b" x0}
+      , BG.getField @"c" x0
+      )
+
+instance (ty ~ BG.CFloat) => BG.HasField "c" (BG.Ptr S2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"c")
+
+instance HasCField.HasCField S2_t "c" where
+
+  type CFieldType S2_t "c" = BG.CFloat
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct S3_t@
+
+    __defined at:__ @types\/structs\/simple_structs.h 15:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S3_t = S3_t
+  { a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 16:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S3_t where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw S3_t where
+
+  readRaw =
+    \ptr0 ->
+          pure S3_t
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+
+instance Marshal.WriteRaw S3_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S3_t a2 -> HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+
+deriving via Marshal.EquivStorable S3_t instance BG.Storable S3_t
+
+deriving via Struct.IsStructViaReadRaw S3_t instance Struct.IsStruct S3_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 16:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "a" S3_t ty where
+
+  hasField =
+    \x0 -> (\y1 -> S3_t {a = y1}, BG.getField @"a" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "a" (BG.Ptr S3_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField S3_t "a" where
+
+  type CFieldType S3_t "a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S4@
+
+    __defined at:__ @types\/structs\/simple_structs.h 19:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S4 = S4
+  { b :: BG.CChar
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 20:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 21:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , c :: BG.Ptr BG.CInt
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/simple_structs.h 22:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S4 where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw S4 where
+
+  readRaw =
+    \ptr0 ->
+          pure S4
+      <*> HasCField.readRaw (BG.Proxy @"b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"c") ptr0
+
+instance Marshal.WriteRaw S4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S4 b2 a3 c4 ->
+               HasCField.writeRaw (BG.Proxy @"b") ptr0 b2
+            >> HasCField.writeRaw (BG.Proxy @"a") ptr0 a3
+            >> HasCField.writeRaw (BG.Proxy @"c") ptr0 c4
+
+deriving via Marshal.EquivStorable S4 instance BG.Storable S4
+
+deriving via Struct.IsStructViaReadRaw S4 instance Struct.IsStruct S4
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 20:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "b" S4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S4 {b = y1, a = BG.getField @"a" x0, c = BG.getField @"c" x0}
+      , BG.getField @"b" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "b" (BG.Ptr S4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b")
+
+instance HasCField.HasCField S4 "b" where
+
+  type CFieldType S4 "b" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 21:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "a" S4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S4 {a = y1, b = BG.getField @"b" x0, c = BG.getField @"c" x0}
+      , BG.getField @"a" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "a" (BG.Ptr S4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField S4 "a" where
+
+  type CFieldType S4 "a" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/simple_structs.h 22:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.Ptr BG.CInt) => BG.CompatHasField.HasField "c" S4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S4 {c = y1, b = BG.getField @"b" x0, a = BG.getField @"a" x0}
+      , BG.getField @"c" x0
+      )
+
+instance (ty ~ BG.Ptr BG.CInt) => BG.HasField "c" (BG.Ptr S4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"c")
+
+instance HasCField.HasCField S4 "c" where
+
+  type CFieldType S4 "c" = BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct S5@
+
+    __defined at:__ @types\/structs\/simple_structs.h 26:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S5 = S5
+  { a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 27:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 28:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S5 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S5 where
+
+  readRaw =
+    \ptr0 ->
+          pure S5
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"b") ptr0
+
+instance Marshal.WriteRaw S5 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S5 a2 b3 ->
+               HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+            >> HasCField.writeRaw (BG.Proxy @"b") ptr0 b3
+
+deriving via Marshal.EquivStorable S5 instance BG.Storable S5
+
+deriving via Struct.IsStructViaReadRaw S5 instance Struct.IsStruct S5
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 27:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "a" S5 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S5 {a = y1, b = BG.getField @"b" x0}, BG.getField @"a" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "a" (BG.Ptr S5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField S5 "a" where
+
+  type CFieldType S5 "a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 28:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "b" S5 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S5 {b = y1, a = BG.getField @"a" x0}, BG.getField @"b" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "b" (BG.Ptr S5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b")
+
+instance HasCField.HasCField S5 "b" where
+
+  type CFieldType S5 "b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S6@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S6 = S6
+  { a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 31:18@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 31:25@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S6 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S6 where
+
+  readRaw =
+    \ptr0 ->
+          pure S6
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"b") ptr0
+
+instance Marshal.WriteRaw S6 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S6 a2 b3 ->
+               HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+            >> HasCField.writeRaw (BG.Proxy @"b") ptr0 b3
+
+deriving via Marshal.EquivStorable S6 instance BG.Storable S6
+
+deriving via Struct.IsStructViaReadRaw S6 instance Struct.IsStruct S6
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:18@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "a" S6 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S6 {a = y1, b = BG.getField @"b" x0}, BG.getField @"a" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "a" (BG.Ptr S6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField S6 "a" where
+
+  type CFieldType S6 "a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:25@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "b" S6 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S6 {b = y1, a = BG.getField @"a" x0}, BG.getField @"b" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "b" (BG.Ptr S6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b")
+
+instance HasCField.HasCField S6 "b" where
+
+  type CFieldType S6 "b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@S7a_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7a_Aux = S7a_Aux
+  { a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 34:23@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 34:30@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S7a_Aux where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S7a_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure S7a_Aux
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"b") ptr0
+
+instance Marshal.WriteRaw S7a_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S7a_Aux a2 b3 ->
+               HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+            >> HasCField.writeRaw (BG.Proxy @"b") ptr0 b3
+
+deriving via Marshal.EquivStorable S7a_Aux instance BG.Storable S7a_Aux
+
+deriving via Struct.IsStructViaReadRaw S7a_Aux instance Struct.IsStruct S7a_Aux
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:23@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "a" S7a_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S7a_Aux {a = y1, b = BG.getField @"b" x0}, BG.getField @"a" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "a" (BG.Ptr S7a_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField S7a_Aux "a" where
+
+  type CFieldType S7a_Aux "a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:30@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "b" S7a_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S7a_Aux {b = y1, a = BG.getField @"a" x0}, BG.getField @"b" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "b" (BG.Ptr S7a_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b")
+
+instance HasCField.HasCField S7a_Aux "b" where
+
+  type CFieldType S7a_Aux "b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @S7a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:36@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7a = S7a
+  { unwrap :: BG.Ptr S7a_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr S7a_Aux
+         ) => BG.CompatHasField.HasField "unwrap" S7a ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S7a {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr S7a_Aux
+         ) => BG.HasField "unwrap" (BG.Ptr S7a) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField S7a "unwrap" where
+
+  type CFieldType S7a "unwrap" = BG.Ptr S7a_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S7b_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7b_Aux = S7b_Aux
+  { a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 35:23@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 35:30@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S7b_Aux where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S7b_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure S7b_Aux
+      <*> HasCField.readRaw (BG.Proxy @"a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"b") ptr0
+
+instance Marshal.WriteRaw S7b_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S7b_Aux a2 b3 ->
+               HasCField.writeRaw (BG.Proxy @"a") ptr0 a2
+            >> HasCField.writeRaw (BG.Proxy @"b") ptr0 b3
+
+deriving via Marshal.EquivStorable S7b_Aux instance BG.Storable S7b_Aux
+
+deriving via Struct.IsStructViaReadRaw S7b_Aux instance Struct.IsStruct S7b_Aux
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:23@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "a" S7b_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S7b_Aux {a = y1, b = BG.getField @"b" x0}, BG.getField @"a" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "a" (BG.Ptr S7b_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"a")
+
+instance HasCField.HasCField S7b_Aux "a" where
+
+  type CFieldType S7b_Aux "a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:30@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "b" S7b_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S7b_Aux {b = y1, a = BG.getField @"a" x0}, BG.getField @"b" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "b" (BG.Ptr S7b_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"b")
+
+instance HasCField.HasCField S7b_Aux "b" where
+
+  type CFieldType S7b_Aux "b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @S7b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:38@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7b = S7b
+  { unwrap :: BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+         ) => BG.CompatHasField.HasField "unwrap" S7b ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S7b {unwrap = y1}, BG.getField @"unwrap" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+         ) => BG.HasField "unwrap" (BG.Ptr S7b) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrap")
+
+instance HasCField.HasCField S7b "unwrap" where
+
+  type CFieldType S7b "unwrap" =
+    BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/structs/simple_structs.omit_field_prefixes/bindingspec.yaml b/test-artefacts/fixtures/types/structs/simple_structs.omit_field_prefixes/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/simple_structs.omit_field_prefixes/bindingspec.yaml
@@ -0,0 +1,255 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/simple_structs.h
+  cname: struct S1
+  hsname: S1
+- headers: types/structs/simple_structs.h
+  cname: struct S2
+  hsname: S2_t
+- headers: types/structs/simple_structs.h
+  cname: S2_t
+  hsname: S2_t
+- headers: types/structs/simple_structs.h
+  cname: struct S3_t
+  hsname: S3_t
+- headers: types/structs/simple_structs.h
+  cname: S3_t
+  hsname: S3_t
+- headers: types/structs/simple_structs.h
+  cname: struct S4
+  hsname: S4
+- headers: types/structs/simple_structs.h
+  cname: struct S5
+  hsname: S5
+- headers: types/structs/simple_structs.h
+  cname: S5
+  hsname: S5
+- headers: types/structs/simple_structs.h
+  cname: struct S6
+  hsname: S6
+- headers: types/structs/simple_structs.h
+  cname: S6
+  hsname: S6
+- headers: types/structs/simple_structs.h
+  cname: struct @S7a_Aux
+  hsname: S7a_Aux
+- headers: types/structs/simple_structs.h
+  cname: S7a
+  hsname: S7a
+- headers: types/structs/simple_structs.h
+  cname: struct @S7b_Aux
+  hsname: S7b_Aux
+- headers: types/structs/simple_structs.h
+  cname: S7b
+  hsname: S7b
+hstypes:
+- hsname: S1
+  representation:
+    record:
+      constructor: S1
+      fields:
+      - a
+      - b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2_t
+  representation:
+    record:
+      constructor: S2_t
+      fields:
+      - a
+      - b
+      - c
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S3_t
+  representation:
+    record:
+      constructor: S3_t
+      fields:
+      - a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S4
+  representation:
+    record:
+      constructor: S4
+      fields:
+      - b
+      - a
+      - c
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S5
+  representation:
+    record:
+      constructor: S5
+      fields:
+      - a
+      - b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S6
+  representation:
+    record:
+      constructor: S6
+      fields:
+      - a
+      - b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7a
+  representation:
+    newtype:
+      constructor: S7a
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7a_Aux
+  representation:
+    record:
+      constructor: S7a_Aux
+      fields:
+      - a
+      - b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7b
+  representation:
+    newtype:
+      constructor: S7b
+      fields:
+      - unwrap
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7b_Aux
+  representation:
+    record:
+      constructor: S7b_Aux
+      fields:
+      - a
+      - b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/simple_structs.omit_field_prefixes/th.txt b/test-artefacts/fixtures/types/structs/simple_structs.omit_field_prefixes/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/simple_structs.omit_field_prefixes/th.txt
@@ -0,0 +1,477 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/simple_structs.h
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/structs\/simple_structs.h 2:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S1
+    = S1 {a :: CInt
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 3:9@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          b :: CChar
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 4:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S1
+    where readRaw = \ptr_0 -> (pure S1 <*> readRaw (Proxy @"a") ptr_0) <*> readRaw (Proxy @"b") ptr_0
+instance WriteRaw S1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S1 a_2
+                                          b_3 -> writeRaw (Proxy @"a") ptr_0 a_2 >> writeRaw (Proxy @"b") ptr_0 b_3
+deriving via (EquivStorable S1) instance Storable S1
+deriving via (IsStructViaReadRaw S1) instance IsStruct S1
+instance (~) ty CInt => HasField "a" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{a = y_1,
+                                         b = getField @"b" x_0},
+                              getField @"a" x_0)
+instance (~) ty CInt => HasField "a" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField S1 "a"
+    where type CFieldType S1 "a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar => HasField "b" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{b = y_1,
+                                         a = getField @"a" x_0},
+                              getField @"b" x_0)
+instance (~) ty CChar => HasField "b" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"b")
+instance HasCField S1 "b"
+    where type CFieldType S1 "b" = CChar
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/structs\/simple_structs.h 8:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S2_t
+    = S2_t {a :: CChar
+            {- ^ __C declaration:__ @a@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 9:10@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -},
+            b :: CInt
+            {- ^ __C declaration:__ @b@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 10:9@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -},
+            c :: CFloat
+            {- ^ __C declaration:__ @c@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 11:11@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2_t
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S2_t
+    where readRaw = \ptr_0 -> ((pure S2_t <*> readRaw (Proxy @"a") ptr_0) <*> readRaw (Proxy @"b") ptr_0) <*> readRaw (Proxy @"c") ptr_0
+instance WriteRaw S2_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2_t a_2
+                                            b_3
+                                            c_4 -> writeRaw (Proxy @"a") ptr_0 a_2 >> (writeRaw (Proxy @"b") ptr_0 b_3 >> writeRaw (Proxy @"c") ptr_0 c_4)
+deriving via (EquivStorable S2_t) instance Storable S2_t
+deriving via (IsStructViaReadRaw S2_t) instance IsStruct S2_t
+instance (~) ty CChar => HasField "a" S2_t ty
+    where hasField = \x_0 -> (\y_1 -> S2_t{a = y_1,
+                                           b = getField @"b" x_0,
+                                           c = getField @"c" x_0},
+                              getField @"a" x_0)
+instance (~) ty CChar => HasField "a" (Ptr S2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField S2_t "a"
+    where type CFieldType S2_t "a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "b" S2_t ty
+    where hasField = \x_0 -> (\y_1 -> S2_t{b = y_1,
+                                           a = getField @"a" x_0,
+                                           c = getField @"c" x_0},
+                              getField @"b" x_0)
+instance (~) ty CInt => HasField "b" (Ptr S2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"b")
+instance HasCField S2_t "b"
+    where type CFieldType S2_t "b" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CFloat => HasField "c" S2_t ty
+    where hasField = \x_0 -> (\y_1 -> S2_t{c = y_1,
+                                           a = getField @"a" x_0,
+                                           b = getField @"b" x_0},
+                              getField @"c" x_0)
+instance (~) ty CFloat => HasField "c" (Ptr S2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"c")
+instance HasCField S2_t "c"
+    where type CFieldType S2_t "c" = CFloat
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct S3_t@
+
+    __defined at:__ @types\/structs\/simple_structs.h 15:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S3_t
+    = S3_t {a :: CChar
+            {- ^ __C declaration:__ @a@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 16:10@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S3_t
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw S3_t
+    where readRaw = \ptr_0 -> pure S3_t <*> readRaw (Proxy @"a") ptr_0
+instance WriteRaw S3_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S3_t a_2 -> writeRaw (Proxy @"a") ptr_0 a_2
+deriving via (EquivStorable S3_t) instance Storable S3_t
+deriving via (IsStructViaReadRaw S3_t) instance IsStruct S3_t
+instance (~) ty CChar => HasField "a" S3_t ty
+    where hasField = \x_0 -> (\y_1 -> S3_t{a = y_1}, getField @"a" x_0)
+instance (~) ty CChar => HasField "a" (Ptr S3_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField S3_t "a"
+    where type CFieldType S3_t "a" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S4@
+
+    __defined at:__ @types\/structs\/simple_structs.h 19:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S4
+    = S4 {b :: CChar
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 20:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          a :: CInt
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 21:9@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          c :: (Ptr CInt)
+          {- ^ __C declaration:__ @c@
+
+               __defined at:__ @types\/structs\/simple_structs.h 22:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S4
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw S4
+    where readRaw = \ptr_0 -> ((pure S4 <*> readRaw (Proxy @"b") ptr_0) <*> readRaw (Proxy @"a") ptr_0) <*> readRaw (Proxy @"c") ptr_0
+instance WriteRaw S4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S4 b_2
+                                          a_3
+                                          c_4 -> writeRaw (Proxy @"b") ptr_0 b_2 >> (writeRaw (Proxy @"a") ptr_0 a_3 >> writeRaw (Proxy @"c") ptr_0 c_4)
+deriving via (EquivStorable S4) instance Storable S4
+deriving via (IsStructViaReadRaw S4) instance IsStruct S4
+instance (~) ty CChar => HasField "b" S4 ty
+    where hasField = \x_0 -> (\y_1 -> S4{b = y_1,
+                                         a = getField @"a" x_0,
+                                         c = getField @"c" x_0},
+                              getField @"b" x_0)
+instance (~) ty CChar => HasField "b" (Ptr S4) (Ptr ty)
+    where getField = fromPtr (Proxy @"b")
+instance HasCField S4 "b"
+    where type CFieldType S4 "b" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "a" S4 ty
+    where hasField = \x_0 -> (\y_1 -> S4{a = y_1,
+                                         b = getField @"b" x_0,
+                                         c = getField @"c" x_0},
+                              getField @"a" x_0)
+instance (~) ty CInt => HasField "a" (Ptr S4) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField S4 "a"
+    where type CFieldType S4 "a" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty (Ptr CInt) => HasField "c" S4 ty
+    where hasField = \x_0 -> (\y_1 -> S4{c = y_1,
+                                         b = getField @"b" x_0,
+                                         a = getField @"a" x_0},
+                              getField @"c" x_0)
+instance (~) ty (Ptr CInt) => HasField "c" (Ptr S4) (Ptr ty)
+    where getField = fromPtr (Proxy @"c")
+instance HasCField S4 "c"
+    where type CFieldType S4 "c" = Ptr CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct S5@
+
+    __defined at:__ @types\/structs\/simple_structs.h 26:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S5
+    = S5 {a :: CChar
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 27:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          b :: CInt
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 28:9@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S5
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S5
+    where readRaw = \ptr_0 -> (pure S5 <*> readRaw (Proxy @"a") ptr_0) <*> readRaw (Proxy @"b") ptr_0
+instance WriteRaw S5
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S5 a_2
+                                          b_3 -> writeRaw (Proxy @"a") ptr_0 a_2 >> writeRaw (Proxy @"b") ptr_0 b_3
+deriving via (EquivStorable S5) instance Storable S5
+deriving via (IsStructViaReadRaw S5) instance IsStruct S5
+instance (~) ty CChar => HasField "a" S5 ty
+    where hasField = \x_0 -> (\y_1 -> S5{a = y_1,
+                                         b = getField @"b" x_0},
+                              getField @"a" x_0)
+instance (~) ty CChar => HasField "a" (Ptr S5) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField S5 "a"
+    where type CFieldType S5 "a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "b" S5 ty
+    where hasField = \x_0 -> (\y_1 -> S5{b = y_1,
+                                         a = getField @"a" x_0},
+                              getField @"b" x_0)
+instance (~) ty CInt => HasField "b" (Ptr S5) (Ptr ty)
+    where getField = fromPtr (Proxy @"b")
+instance HasCField S5 "b"
+    where type CFieldType S5 "b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S6@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S6
+    = S6 {a :: CChar
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 31:18@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          b :: CInt
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 31:25@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S6
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S6
+    where readRaw = \ptr_0 -> (pure S6 <*> readRaw (Proxy @"a") ptr_0) <*> readRaw (Proxy @"b") ptr_0
+instance WriteRaw S6
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S6 a_2
+                                          b_3 -> writeRaw (Proxy @"a") ptr_0 a_2 >> writeRaw (Proxy @"b") ptr_0 b_3
+deriving via (EquivStorable S6) instance Storable S6
+deriving via (IsStructViaReadRaw S6) instance IsStruct S6
+instance (~) ty CChar => HasField "a" S6 ty
+    where hasField = \x_0 -> (\y_1 -> S6{a = y_1,
+                                         b = getField @"b" x_0},
+                              getField @"a" x_0)
+instance (~) ty CChar => HasField "a" (Ptr S6) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField S6 "a"
+    where type CFieldType S6 "a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "b" S6 ty
+    where hasField = \x_0 -> (\y_1 -> S6{b = y_1,
+                                         a = getField @"a" x_0},
+                              getField @"b" x_0)
+instance (~) ty CInt => HasField "b" (Ptr S6) (Ptr ty)
+    where getField = fromPtr (Proxy @"b")
+instance HasCField S6 "b"
+    where type CFieldType S6 "b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@S7a_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7a_Aux
+    = S7a_Aux {a :: CChar
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 34:23@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -},
+               b :: CInt
+               {- ^ __C declaration:__ @b@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 34:30@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S7a_Aux
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S7a_Aux
+    where readRaw = \ptr_0 -> (pure S7a_Aux <*> readRaw (Proxy @"a") ptr_0) <*> readRaw (Proxy @"b") ptr_0
+instance WriteRaw S7a_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S7a_Aux a_2
+                                               b_3 -> writeRaw (Proxy @"a") ptr_0 a_2 >> writeRaw (Proxy @"b") ptr_0 b_3
+deriving via (EquivStorable S7a_Aux) instance Storable S7a_Aux
+deriving via (IsStructViaReadRaw S7a_Aux) instance IsStruct S7a_Aux
+instance (~) ty CChar => HasField "a" S7a_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7a_Aux{a = y_1,
+                                              b = getField @"b" x_0},
+                              getField @"a" x_0)
+instance (~) ty CChar => HasField "a" (Ptr S7a_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField S7a_Aux "a"
+    where type CFieldType S7a_Aux "a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "b" S7a_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7a_Aux{b = y_1,
+                                              a = getField @"a" x_0},
+                              getField @"b" x_0)
+instance (~) ty CInt => HasField "b" (Ptr S7a_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"b")
+instance HasCField S7a_Aux "b"
+    where type CFieldType S7a_Aux "b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @S7a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:36@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7a
+    = S7a {unwrap :: (Ptr S7a_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr S7a_Aux) => HasField "unwrap" S7a ty
+    where hasField = \x_0 -> (\y_1 -> S7a{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty (Ptr S7a_Aux) =>
+         HasField "unwrap" (Ptr S7a) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField S7a "unwrap"
+    where type CFieldType S7a "unwrap" = Ptr S7a_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S7b_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7b_Aux
+    = S7b_Aux {a :: CChar
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 35:23@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -},
+               b :: CInt
+               {- ^ __C declaration:__ @b@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 35:30@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S7b_Aux
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S7b_Aux
+    where readRaw = \ptr_0 -> (pure S7b_Aux <*> readRaw (Proxy @"a") ptr_0) <*> readRaw (Proxy @"b") ptr_0
+instance WriteRaw S7b_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S7b_Aux a_2
+                                               b_3 -> writeRaw (Proxy @"a") ptr_0 a_2 >> writeRaw (Proxy @"b") ptr_0 b_3
+deriving via (EquivStorable S7b_Aux) instance Storable S7b_Aux
+deriving via (IsStructViaReadRaw S7b_Aux) instance IsStruct S7b_Aux
+instance (~) ty CChar => HasField "a" S7b_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7b_Aux{a = y_1,
+                                              b = getField @"b" x_0},
+                              getField @"a" x_0)
+instance (~) ty CChar => HasField "a" (Ptr S7b_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"a")
+instance HasCField S7b_Aux "a"
+    where type CFieldType S7b_Aux "a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "b" S7b_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7b_Aux{b = y_1,
+                                              a = getField @"a" x_0},
+                              getField @"b" x_0)
+instance (~) ty CInt => HasField "b" (Ptr S7b_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"b")
+instance HasCField S7b_Aux "b"
+    where type CFieldType S7b_Aux "b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @S7b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:38@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7b
+    = S7b {unwrap :: (Ptr (Ptr (Ptr S7b_Aux)))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr (Ptr S7b_Aux))) =>
+         HasField "unwrap" S7b ty
+    where hasField = \x_0 -> (\y_1 -> S7b{unwrap = y_1},
+                              getField @"unwrap" x_0)
+instance (~) ty (Ptr (Ptr (Ptr S7b_Aux))) =>
+         HasField "unwrap" (Ptr S7b) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrap")
+instance HasCField S7b "unwrap"
+    where type CFieldType S7b "unwrap" = Ptr (Ptr (Ptr S7b_Aux))
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/structs/simple_structs.post_qualified/Example.hs b/test-artefacts/fixtures/types/structs/simple_structs.post_qualified/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/simple_structs.post_qualified/Example.hs
@@ -0,0 +1,978 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE ImportQualifiedPost #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S1(..)
+    , Example.S2_t(..)
+    , Example.S3_t(..)
+    , Example.S4(..)
+    , Example.S5(..)
+    , Example.S6(..)
+    , Example.S7a_Aux(..)
+    , Example.S7a(..)
+    , Example.S7b_Aux(..)
+    , Example.S7b(..)
+    )
+  where
+
+import HsBindgen.Runtime.HasCField qualified as HasCField
+import HsBindgen.Runtime.Marshal qualified as Marshal
+import HsBindgen.Runtime.Struct qualified as Struct
+import HsBindgen.Runtime.Support qualified as BG
+import HsBindgen.Runtime.Support.CompatHasField qualified as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Ord, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/structs\/simple_structs.h 2:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S1 = S1
+  { s1_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 3:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s1_b :: BG.CChar
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 4:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S1 where
+
+  readRaw =
+    \ptr0 ->
+          pure S1
+      <*> HasCField.readRaw (BG.Proxy @"s1_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s1_b") ptr0
+
+instance Marshal.WriteRaw S1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S1 s1_a2 s1_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s1_a") ptr0 s1_a2
+            >> HasCField.writeRaw (BG.Proxy @"s1_b") ptr0 s1_b3
+
+deriving via Marshal.EquivStorable S1 instance BG.Storable S1
+
+deriving via Struct.IsStructViaReadRaw S1 instance Struct.IsStruct S1
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 3:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s1_a" S1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1 {s1_a = y1, s1_b = BG.getField @"s1_b" x0}
+      , BG.getField @"s1_a" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s1_a" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_a")
+
+instance HasCField.HasCField S1 "s1_a" where
+
+  type CFieldType S1 "s1_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 4:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s1_b" S1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1 {s1_b = y1, s1_a = BG.getField @"s1_a" x0}
+      , BG.getField @"s1_b" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s1_b" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_b")
+
+instance HasCField.HasCField S1 "s1_b" where
+
+  type CFieldType S1 "s1_b" = BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/structs\/simple_structs.h 8:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S2_t = S2_t
+  { s2_t_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 9:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s2_t_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 10:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s2_t_c :: BG.CFloat
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/simple_structs.h 11:11@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2_t where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S2_t where
+
+  readRaw =
+    \ptr0 ->
+          pure S2_t
+      <*> HasCField.readRaw (BG.Proxy @"s2_t_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s2_t_b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s2_t_c") ptr0
+
+instance Marshal.WriteRaw S2_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2_t s2_t_a2 s2_t_b3 s2_t_c4 ->
+               HasCField.writeRaw (BG.Proxy @"s2_t_a") ptr0 s2_t_a2
+            >> HasCField.writeRaw (BG.Proxy @"s2_t_b") ptr0 s2_t_b3
+            >> HasCField.writeRaw (BG.Proxy @"s2_t_c") ptr0 s2_t_c4
+
+deriving via Marshal.EquivStorable S2_t instance BG.Storable S2_t
+
+deriving via Struct.IsStructViaReadRaw S2_t instance Struct.IsStruct S2_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 9:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s2_t_a" S2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_t { s2_t_a = y1
+               , s2_t_b = BG.getField @"s2_t_b" x0
+               , s2_t_c = BG.getField @"s2_t_c" x0
+               }
+      , BG.getField @"s2_t_a" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s2_t_a" (BG.Ptr S2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_t_a")
+
+instance HasCField.HasCField S2_t "s2_t_a" where
+
+  type CFieldType S2_t "s2_t_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 10:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s2_t_b" S2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_t { s2_t_b = y1
+               , s2_t_a = BG.getField @"s2_t_a" x0
+               , s2_t_c = BG.getField @"s2_t_c" x0
+               }
+      , BG.getField @"s2_t_b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s2_t_b" (BG.Ptr S2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_t_b")
+
+instance HasCField.HasCField S2_t "s2_t_b" where
+
+  type CFieldType S2_t "s2_t_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/simple_structs.h 11:11@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "s2_t_c" S2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_t { s2_t_c = y1
+               , s2_t_a = BG.getField @"s2_t_a" x0
+               , s2_t_b = BG.getField @"s2_t_b" x0
+               }
+      , BG.getField @"s2_t_c" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "s2_t_c" (BG.Ptr S2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_t_c")
+
+instance HasCField.HasCField S2_t "s2_t_c" where
+
+  type CFieldType S2_t "s2_t_c" = BG.CFloat
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct S3_t@
+
+    __defined at:__ @types\/structs\/simple_structs.h 15:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S3_t = S3_t
+  { s3_t_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 16:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S3_t where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw S3_t where
+
+  readRaw =
+    \ptr0 ->
+          pure S3_t
+      <*> HasCField.readRaw (BG.Proxy @"s3_t_a") ptr0
+
+instance Marshal.WriteRaw S3_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S3_t s3_t_a2 ->
+            HasCField.writeRaw (BG.Proxy @"s3_t_a") ptr0 s3_t_a2
+
+deriving via Marshal.EquivStorable S3_t instance BG.Storable S3_t
+
+deriving via Struct.IsStructViaReadRaw S3_t instance Struct.IsStruct S3_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 16:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s3_t_a" S3_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S3_t {s3_t_a = y1}, BG.getField @"s3_t_a" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "s3_t_a" (BG.Ptr S3_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s3_t_a")
+
+instance HasCField.HasCField S3_t "s3_t_a" where
+
+  type CFieldType S3_t "s3_t_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S4@
+
+    __defined at:__ @types\/structs\/simple_structs.h 19:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S4 = S4
+  { s4_b :: BG.CChar
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 20:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s4_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 21:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s4_c :: BG.Ptr BG.CInt
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/simple_structs.h 22:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S4 where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw S4 where
+
+  readRaw =
+    \ptr0 ->
+          pure S4
+      <*> HasCField.readRaw (BG.Proxy @"s4_b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s4_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s4_c") ptr0
+
+instance Marshal.WriteRaw S4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S4 s4_b2 s4_a3 s4_c4 ->
+               HasCField.writeRaw (BG.Proxy @"s4_b") ptr0 s4_b2
+            >> HasCField.writeRaw (BG.Proxy @"s4_a") ptr0 s4_a3
+            >> HasCField.writeRaw (BG.Proxy @"s4_c") ptr0 s4_c4
+
+deriving via Marshal.EquivStorable S4 instance BG.Storable S4
+
+deriving via Struct.IsStructViaReadRaw S4 instance Struct.IsStruct S4
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 20:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s4_b" S4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S4 {s4_b = y1, s4_a = BG.getField @"s4_a" x0, s4_c = BG.getField @"s4_c" x0}
+      , BG.getField @"s4_b" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s4_b" (BG.Ptr S4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s4_b")
+
+instance HasCField.HasCField S4 "s4_b" where
+
+  type CFieldType S4 "s4_b" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 21:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s4_a" S4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S4 {s4_a = y1, s4_b = BG.getField @"s4_b" x0, s4_c = BG.getField @"s4_c" x0}
+      , BG.getField @"s4_a" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s4_a" (BG.Ptr S4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s4_a")
+
+instance HasCField.HasCField S4 "s4_a" where
+
+  type CFieldType S4 "s4_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/simple_structs.h 22:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.Ptr BG.CInt) => BG.CompatHasField.HasField "s4_c" S4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S4 {s4_c = y1, s4_b = BG.getField @"s4_b" x0, s4_a = BG.getField @"s4_a" x0}
+      , BG.getField @"s4_c" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "s4_c" (BG.Ptr S4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s4_c")
+
+instance HasCField.HasCField S4 "s4_c" where
+
+  type CFieldType S4 "s4_c" = BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct S5@
+
+    __defined at:__ @types\/structs\/simple_structs.h 26:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S5 = S5
+  { s5_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 27:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s5_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 28:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S5 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S5 where
+
+  readRaw =
+    \ptr0 ->
+          pure S5
+      <*> HasCField.readRaw (BG.Proxy @"s5_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s5_b") ptr0
+
+instance Marshal.WriteRaw S5 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S5 s5_a2 s5_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s5_a") ptr0 s5_a2
+            >> HasCField.writeRaw (BG.Proxy @"s5_b") ptr0 s5_b3
+
+deriving via Marshal.EquivStorable S5 instance BG.Storable S5
+
+deriving via Struct.IsStructViaReadRaw S5 instance Struct.IsStruct S5
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 27:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s5_a" S5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S5 {s5_a = y1, s5_b = BG.getField @"s5_b" x0}
+      , BG.getField @"s5_a" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s5_a" (BG.Ptr S5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s5_a")
+
+instance HasCField.HasCField S5 "s5_a" where
+
+  type CFieldType S5 "s5_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 28:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s5_b" S5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S5 {s5_b = y1, s5_a = BG.getField @"s5_a" x0}
+      , BG.getField @"s5_b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s5_b" (BG.Ptr S5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s5_b")
+
+instance HasCField.HasCField S5 "s5_b" where
+
+  type CFieldType S5 "s5_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S6@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S6 = S6
+  { s6_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 31:18@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s6_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 31:25@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S6 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S6 where
+
+  readRaw =
+    \ptr0 ->
+          pure S6
+      <*> HasCField.readRaw (BG.Proxy @"s6_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s6_b") ptr0
+
+instance Marshal.WriteRaw S6 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S6 s6_a2 s6_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s6_a") ptr0 s6_a2
+            >> HasCField.writeRaw (BG.Proxy @"s6_b") ptr0 s6_b3
+
+deriving via Marshal.EquivStorable S6 instance BG.Storable S6
+
+deriving via Struct.IsStructViaReadRaw S6 instance Struct.IsStruct S6
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:18@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s6_a" S6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S6 {s6_a = y1, s6_b = BG.getField @"s6_b" x0}
+      , BG.getField @"s6_a" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s6_a" (BG.Ptr S6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s6_a")
+
+instance HasCField.HasCField S6 "s6_a" where
+
+  type CFieldType S6 "s6_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:25@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s6_b" S6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S6 {s6_b = y1, s6_a = BG.getField @"s6_a" x0}
+      , BG.getField @"s6_b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s6_b" (BG.Ptr S6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s6_b")
+
+instance HasCField.HasCField S6 "s6_b" where
+
+  type CFieldType S6 "s6_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@S7a_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7a_Aux = S7a_Aux
+  { s7a_Aux_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 34:23@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s7a_Aux_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 34:30@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S7a_Aux where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S7a_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure S7a_Aux
+      <*> HasCField.readRaw (BG.Proxy @"s7a_Aux_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s7a_Aux_b") ptr0
+
+instance Marshal.WriteRaw S7a_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S7a_Aux s7a_Aux_a2 s7a_Aux_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s7a_Aux_a") ptr0 s7a_Aux_a2
+            >> HasCField.writeRaw (BG.Proxy @"s7a_Aux_b") ptr0 s7a_Aux_b3
+
+deriving via Marshal.EquivStorable S7a_Aux instance BG.Storable S7a_Aux
+
+deriving via Struct.IsStructViaReadRaw S7a_Aux instance Struct.IsStruct S7a_Aux
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:23@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "s7a_Aux_a" S7a_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S7a_Aux {s7a_Aux_a = y1, s7a_Aux_b = BG.getField @"s7a_Aux_b" x0}
+      , BG.getField @"s7a_Aux_a" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "s7a_Aux_a" (BG.Ptr S7a_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s7a_Aux_a")
+
+instance HasCField.HasCField S7a_Aux "s7a_Aux_a" where
+
+  type CFieldType S7a_Aux "s7a_Aux_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:30@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s7a_Aux_b" S7a_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S7a_Aux {s7a_Aux_b = y1, s7a_Aux_a = BG.getField @"s7a_Aux_a" x0}
+      , BG.getField @"s7a_Aux_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s7a_Aux_b" (BG.Ptr S7a_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s7a_Aux_b")
+
+instance HasCField.HasCField S7a_Aux "s7a_Aux_b" where
+
+  type CFieldType S7a_Aux "s7a_Aux_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @S7a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:36@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7a = S7a
+  { unwrapS7a :: BG.Ptr S7a_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr S7a_Aux
+         ) => BG.CompatHasField.HasField "unwrapS7a" S7a ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S7a {unwrapS7a = y1}, BG.getField @"unwrapS7a" x0)
+
+instance ( ty ~ BG.Ptr S7a_Aux
+         ) => BG.HasField "unwrapS7a" (BG.Ptr S7a) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapS7a")
+
+instance HasCField.HasCField S7a "unwrapS7a" where
+
+  type CFieldType S7a "unwrapS7a" = BG.Ptr S7a_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S7b_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7b_Aux = S7b_Aux
+  { s7b_Aux_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 35:23@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s7b_Aux_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 35:30@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S7b_Aux where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S7b_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure S7b_Aux
+      <*> HasCField.readRaw (BG.Proxy @"s7b_Aux_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s7b_Aux_b") ptr0
+
+instance Marshal.WriteRaw S7b_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S7b_Aux s7b_Aux_a2 s7b_Aux_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s7b_Aux_a") ptr0 s7b_Aux_a2
+            >> HasCField.writeRaw (BG.Proxy @"s7b_Aux_b") ptr0 s7b_Aux_b3
+
+deriving via Marshal.EquivStorable S7b_Aux instance BG.Storable S7b_Aux
+
+deriving via Struct.IsStructViaReadRaw S7b_Aux instance Struct.IsStruct S7b_Aux
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:23@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "s7b_Aux_a" S7b_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S7b_Aux {s7b_Aux_a = y1, s7b_Aux_b = BG.getField @"s7b_Aux_b" x0}
+      , BG.getField @"s7b_Aux_a" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "s7b_Aux_a" (BG.Ptr S7b_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s7b_Aux_a")
+
+instance HasCField.HasCField S7b_Aux "s7b_Aux_a" where
+
+  type CFieldType S7b_Aux "s7b_Aux_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:30@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s7b_Aux_b" S7b_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S7b_Aux {s7b_Aux_b = y1, s7b_Aux_a = BG.getField @"s7b_Aux_a" x0}
+      , BG.getField @"s7b_Aux_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s7b_Aux_b" (BG.Ptr S7b_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s7b_Aux_b")
+
+instance HasCField.HasCField S7b_Aux "s7b_Aux_b" where
+
+  type CFieldType S7b_Aux "s7b_Aux_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @S7b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:38@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7b = S7b
+  { unwrapS7b :: BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+         ) => BG.CompatHasField.HasField "unwrapS7b" S7b ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S7b {unwrapS7b = y1}, BG.getField @"unwrapS7b" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+         ) => BG.HasField "unwrapS7b" (BG.Ptr S7b) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapS7b")
+
+instance HasCField.HasCField S7b "unwrapS7b" where
+
+  type CFieldType S7b "unwrapS7b" =
+    BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/structs/simple_structs.post_qualified/bindingspec.yaml b/test-artefacts/fixtures/types/structs/simple_structs.post_qualified/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/simple_structs.post_qualified/bindingspec.yaml
@@ -0,0 +1,255 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/simple_structs.h
+  cname: struct S1
+  hsname: S1
+- headers: types/structs/simple_structs.h
+  cname: struct S2
+  hsname: S2_t
+- headers: types/structs/simple_structs.h
+  cname: S2_t
+  hsname: S2_t
+- headers: types/structs/simple_structs.h
+  cname: struct S3_t
+  hsname: S3_t
+- headers: types/structs/simple_structs.h
+  cname: S3_t
+  hsname: S3_t
+- headers: types/structs/simple_structs.h
+  cname: struct S4
+  hsname: S4
+- headers: types/structs/simple_structs.h
+  cname: struct S5
+  hsname: S5
+- headers: types/structs/simple_structs.h
+  cname: S5
+  hsname: S5
+- headers: types/structs/simple_structs.h
+  cname: struct S6
+  hsname: S6
+- headers: types/structs/simple_structs.h
+  cname: S6
+  hsname: S6
+- headers: types/structs/simple_structs.h
+  cname: struct @S7a_Aux
+  hsname: S7a_Aux
+- headers: types/structs/simple_structs.h
+  cname: S7a
+  hsname: S7a
+- headers: types/structs/simple_structs.h
+  cname: struct @S7b_Aux
+  hsname: S7b_Aux
+- headers: types/structs/simple_structs.h
+  cname: S7b
+  hsname: S7b
+hstypes:
+- hsname: S1
+  representation:
+    record:
+      constructor: S1
+      fields:
+      - s1_a
+      - s1_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2_t
+  representation:
+    record:
+      constructor: S2_t
+      fields:
+      - s2_t_a
+      - s2_t_b
+      - s2_t_c
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S3_t
+  representation:
+    record:
+      constructor: S3_t
+      fields:
+      - s3_t_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S4
+  representation:
+    record:
+      constructor: S4
+      fields:
+      - s4_b
+      - s4_a
+      - s4_c
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S5
+  representation:
+    record:
+      constructor: S5
+      fields:
+      - s5_a
+      - s5_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S6
+  representation:
+    record:
+      constructor: S6
+      fields:
+      - s6_a
+      - s6_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7a
+  representation:
+    newtype:
+      constructor: S7a
+      fields:
+      - unwrapS7a
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7a_Aux
+  representation:
+    record:
+      constructor: S7a_Aux
+      fields:
+      - s7a_Aux_a
+      - s7a_Aux_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7b
+  representation:
+    newtype:
+      constructor: S7b
+      fields:
+      - unwrapS7b
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7b_Aux
+  representation:
+    record:
+      constructor: S7b_Aux
+      fields:
+      - s7b_Aux_a
+      - s7b_Aux_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/simple_structs.post_qualified/th.txt b/test-artefacts/fixtures/types/structs/simple_structs.post_qualified/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/simple_structs.post_qualified/th.txt
@@ -0,0 +1,480 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/simple_structs.h
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/structs\/simple_structs.h 2:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S1
+    = S1 {s1_a :: CInt
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 3:9@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s1_b :: CChar
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 4:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S1
+    where readRaw = \ptr_0 -> (pure S1 <*> readRaw (Proxy @"s1_a") ptr_0) <*> readRaw (Proxy @"s1_b") ptr_0
+instance WriteRaw S1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S1 s1_a_2
+                                          s1_b_3 -> writeRaw (Proxy @"s1_a") ptr_0 s1_a_2 >> writeRaw (Proxy @"s1_b") ptr_0 s1_b_3
+deriving via (EquivStorable S1) instance Storable S1
+deriving via (IsStructViaReadRaw S1) instance IsStruct S1
+instance (~) ty CInt => HasField "s1_a" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{s1_a = y_1,
+                                         s1_b = getField @"s1_b" x_0},
+                              getField @"s1_a" x_0)
+instance (~) ty CInt => HasField "s1_a" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_a")
+instance HasCField S1 "s1_a"
+    where type CFieldType S1 "s1_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar => HasField "s1_b" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{s1_b = y_1,
+                                         s1_a = getField @"s1_a" x_0},
+                              getField @"s1_b" x_0)
+instance (~) ty CChar => HasField "s1_b" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_b")
+instance HasCField S1 "s1_b"
+    where type CFieldType S1 "s1_b" = CChar
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/structs\/simple_structs.h 8:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S2_t
+    = S2_t {s2_t_a :: CChar
+            {- ^ __C declaration:__ @a@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 9:10@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -},
+            s2_t_b :: CInt
+            {- ^ __C declaration:__ @b@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 10:9@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -},
+            s2_t_c :: CFloat
+            {- ^ __C declaration:__ @c@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 11:11@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2_t
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S2_t
+    where readRaw = \ptr_0 -> ((pure S2_t <*> readRaw (Proxy @"s2_t_a") ptr_0) <*> readRaw (Proxy @"s2_t_b") ptr_0) <*> readRaw (Proxy @"s2_t_c") ptr_0
+instance WriteRaw S2_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2_t s2_t_a_2
+                                            s2_t_b_3
+                                            s2_t_c_4 -> writeRaw (Proxy @"s2_t_a") ptr_0 s2_t_a_2 >> (writeRaw (Proxy @"s2_t_b") ptr_0 s2_t_b_3 >> writeRaw (Proxy @"s2_t_c") ptr_0 s2_t_c_4)
+deriving via (EquivStorable S2_t) instance Storable S2_t
+deriving via (IsStructViaReadRaw S2_t) instance IsStruct S2_t
+instance (~) ty CChar => HasField "s2_t_a" S2_t ty
+    where hasField = \x_0 -> (\y_1 -> S2_t{s2_t_a = y_1,
+                                           s2_t_b = getField @"s2_t_b" x_0,
+                                           s2_t_c = getField @"s2_t_c" x_0},
+                              getField @"s2_t_a" x_0)
+instance (~) ty CChar => HasField "s2_t_a" (Ptr S2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_t_a")
+instance HasCField S2_t "s2_t_a"
+    where type CFieldType S2_t "s2_t_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s2_t_b" S2_t ty
+    where hasField = \x_0 -> (\y_1 -> S2_t{s2_t_b = y_1,
+                                           s2_t_a = getField @"s2_t_a" x_0,
+                                           s2_t_c = getField @"s2_t_c" x_0},
+                              getField @"s2_t_b" x_0)
+instance (~) ty CInt => HasField "s2_t_b" (Ptr S2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_t_b")
+instance HasCField S2_t "s2_t_b"
+    where type CFieldType S2_t "s2_t_b" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CFloat => HasField "s2_t_c" S2_t ty
+    where hasField = \x_0 -> (\y_1 -> S2_t{s2_t_c = y_1,
+                                           s2_t_a = getField @"s2_t_a" x_0,
+                                           s2_t_b = getField @"s2_t_b" x_0},
+                              getField @"s2_t_c" x_0)
+instance (~) ty CFloat => HasField "s2_t_c" (Ptr S2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_t_c")
+instance HasCField S2_t "s2_t_c"
+    where type CFieldType S2_t "s2_t_c" = CFloat
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct S3_t@
+
+    __defined at:__ @types\/structs\/simple_structs.h 15:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S3_t
+    = S3_t {s3_t_a :: CChar
+            {- ^ __C declaration:__ @a@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 16:10@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S3_t
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw S3_t
+    where readRaw = \ptr_0 -> pure S3_t <*> readRaw (Proxy @"s3_t_a") ptr_0
+instance WriteRaw S3_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S3_t s3_t_a_2 -> writeRaw (Proxy @"s3_t_a") ptr_0 s3_t_a_2
+deriving via (EquivStorable S3_t) instance Storable S3_t
+deriving via (IsStructViaReadRaw S3_t) instance IsStruct S3_t
+instance (~) ty CChar => HasField "s3_t_a" S3_t ty
+    where hasField = \x_0 -> (\y_1 -> S3_t{s3_t_a = y_1},
+                              getField @"s3_t_a" x_0)
+instance (~) ty CChar => HasField "s3_t_a" (Ptr S3_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"s3_t_a")
+instance HasCField S3_t "s3_t_a"
+    where type CFieldType S3_t "s3_t_a" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S4@
+
+    __defined at:__ @types\/structs\/simple_structs.h 19:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S4
+    = S4 {s4_b :: CChar
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 20:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s4_a :: CInt
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 21:9@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s4_c :: (Ptr CInt)
+          {- ^ __C declaration:__ @c@
+
+               __defined at:__ @types\/structs\/simple_structs.h 22:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S4
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw S4
+    where readRaw = \ptr_0 -> ((pure S4 <*> readRaw (Proxy @"s4_b") ptr_0) <*> readRaw (Proxy @"s4_a") ptr_0) <*> readRaw (Proxy @"s4_c") ptr_0
+instance WriteRaw S4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S4 s4_b_2
+                                          s4_a_3
+                                          s4_c_4 -> writeRaw (Proxy @"s4_b") ptr_0 s4_b_2 >> (writeRaw (Proxy @"s4_a") ptr_0 s4_a_3 >> writeRaw (Proxy @"s4_c") ptr_0 s4_c_4)
+deriving via (EquivStorable S4) instance Storable S4
+deriving via (IsStructViaReadRaw S4) instance IsStruct S4
+instance (~) ty CChar => HasField "s4_b" S4 ty
+    where hasField = \x_0 -> (\y_1 -> S4{s4_b = y_1,
+                                         s4_a = getField @"s4_a" x_0,
+                                         s4_c = getField @"s4_c" x_0},
+                              getField @"s4_b" x_0)
+instance (~) ty CChar => HasField "s4_b" (Ptr S4) (Ptr ty)
+    where getField = fromPtr (Proxy @"s4_b")
+instance HasCField S4 "s4_b"
+    where type CFieldType S4 "s4_b" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s4_a" S4 ty
+    where hasField = \x_0 -> (\y_1 -> S4{s4_a = y_1,
+                                         s4_b = getField @"s4_b" x_0,
+                                         s4_c = getField @"s4_c" x_0},
+                              getField @"s4_a" x_0)
+instance (~) ty CInt => HasField "s4_a" (Ptr S4) (Ptr ty)
+    where getField = fromPtr (Proxy @"s4_a")
+instance HasCField S4 "s4_a"
+    where type CFieldType S4 "s4_a" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty (Ptr CInt) => HasField "s4_c" S4 ty
+    where hasField = \x_0 -> (\y_1 -> S4{s4_c = y_1,
+                                         s4_b = getField @"s4_b" x_0,
+                                         s4_a = getField @"s4_a" x_0},
+                              getField @"s4_c" x_0)
+instance (~) ty (Ptr CInt) => HasField "s4_c" (Ptr S4) (Ptr ty)
+    where getField = fromPtr (Proxy @"s4_c")
+instance HasCField S4 "s4_c"
+    where type CFieldType S4 "s4_c" = Ptr CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct S5@
+
+    __defined at:__ @types\/structs\/simple_structs.h 26:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S5
+    = S5 {s5_a :: CChar
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 27:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s5_b :: CInt
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 28:9@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S5
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S5
+    where readRaw = \ptr_0 -> (pure S5 <*> readRaw (Proxy @"s5_a") ptr_0) <*> readRaw (Proxy @"s5_b") ptr_0
+instance WriteRaw S5
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S5 s5_a_2
+                                          s5_b_3 -> writeRaw (Proxy @"s5_a") ptr_0 s5_a_2 >> writeRaw (Proxy @"s5_b") ptr_0 s5_b_3
+deriving via (EquivStorable S5) instance Storable S5
+deriving via (IsStructViaReadRaw S5) instance IsStruct S5
+instance (~) ty CChar => HasField "s5_a" S5 ty
+    where hasField = \x_0 -> (\y_1 -> S5{s5_a = y_1,
+                                         s5_b = getField @"s5_b" x_0},
+                              getField @"s5_a" x_0)
+instance (~) ty CChar => HasField "s5_a" (Ptr S5) (Ptr ty)
+    where getField = fromPtr (Proxy @"s5_a")
+instance HasCField S5 "s5_a"
+    where type CFieldType S5 "s5_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s5_b" S5 ty
+    where hasField = \x_0 -> (\y_1 -> S5{s5_b = y_1,
+                                         s5_a = getField @"s5_a" x_0},
+                              getField @"s5_b" x_0)
+instance (~) ty CInt => HasField "s5_b" (Ptr S5) (Ptr ty)
+    where getField = fromPtr (Proxy @"s5_b")
+instance HasCField S5 "s5_b"
+    where type CFieldType S5 "s5_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S6@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S6
+    = S6 {s6_a :: CChar
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 31:18@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s6_b :: CInt
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 31:25@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S6
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S6
+    where readRaw = \ptr_0 -> (pure S6 <*> readRaw (Proxy @"s6_a") ptr_0) <*> readRaw (Proxy @"s6_b") ptr_0
+instance WriteRaw S6
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S6 s6_a_2
+                                          s6_b_3 -> writeRaw (Proxy @"s6_a") ptr_0 s6_a_2 >> writeRaw (Proxy @"s6_b") ptr_0 s6_b_3
+deriving via (EquivStorable S6) instance Storable S6
+deriving via (IsStructViaReadRaw S6) instance IsStruct S6
+instance (~) ty CChar => HasField "s6_a" S6 ty
+    where hasField = \x_0 -> (\y_1 -> S6{s6_a = y_1,
+                                         s6_b = getField @"s6_b" x_0},
+                              getField @"s6_a" x_0)
+instance (~) ty CChar => HasField "s6_a" (Ptr S6) (Ptr ty)
+    where getField = fromPtr (Proxy @"s6_a")
+instance HasCField S6 "s6_a"
+    where type CFieldType S6 "s6_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s6_b" S6 ty
+    where hasField = \x_0 -> (\y_1 -> S6{s6_b = y_1,
+                                         s6_a = getField @"s6_a" x_0},
+                              getField @"s6_b" x_0)
+instance (~) ty CInt => HasField "s6_b" (Ptr S6) (Ptr ty)
+    where getField = fromPtr (Proxy @"s6_b")
+instance HasCField S6 "s6_b"
+    where type CFieldType S6 "s6_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@S7a_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7a_Aux
+    = S7a_Aux {s7a_Aux_a :: CChar
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 34:23@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -},
+               s7a_Aux_b :: CInt
+               {- ^ __C declaration:__ @b@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 34:30@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S7a_Aux
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S7a_Aux
+    where readRaw = \ptr_0 -> (pure S7a_Aux <*> readRaw (Proxy @"s7a_Aux_a") ptr_0) <*> readRaw (Proxy @"s7a_Aux_b") ptr_0
+instance WriteRaw S7a_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S7a_Aux s7a_Aux_a_2
+                                               s7a_Aux_b_3 -> writeRaw (Proxy @"s7a_Aux_a") ptr_0 s7a_Aux_a_2 >> writeRaw (Proxy @"s7a_Aux_b") ptr_0 s7a_Aux_b_3
+deriving via (EquivStorable S7a_Aux) instance Storable S7a_Aux
+deriving via (IsStructViaReadRaw S7a_Aux) instance IsStruct S7a_Aux
+instance (~) ty CChar => HasField "s7a_Aux_a" S7a_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7a_Aux{s7a_Aux_a = y_1,
+                                              s7a_Aux_b = getField @"s7a_Aux_b" x_0},
+                              getField @"s7a_Aux_a" x_0)
+instance (~) ty CChar =>
+         HasField "s7a_Aux_a" (Ptr S7a_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"s7a_Aux_a")
+instance HasCField S7a_Aux "s7a_Aux_a"
+    where type CFieldType S7a_Aux "s7a_Aux_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s7a_Aux_b" S7a_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7a_Aux{s7a_Aux_b = y_1,
+                                              s7a_Aux_a = getField @"s7a_Aux_a" x_0},
+                              getField @"s7a_Aux_b" x_0)
+instance (~) ty CInt => HasField "s7a_Aux_b" (Ptr S7a_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"s7a_Aux_b")
+instance HasCField S7a_Aux "s7a_Aux_b"
+    where type CFieldType S7a_Aux "s7a_Aux_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @S7a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:36@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7a
+    = S7a {unwrapS7a :: (Ptr S7a_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr S7a_Aux) => HasField "unwrapS7a" S7a ty
+    where hasField = \x_0 -> (\y_1 -> S7a{unwrapS7a = y_1},
+                              getField @"unwrapS7a" x_0)
+instance (~) ty (Ptr S7a_Aux) =>
+         HasField "unwrapS7a" (Ptr S7a) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapS7a")
+instance HasCField S7a "unwrapS7a"
+    where type CFieldType S7a "unwrapS7a" = Ptr S7a_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S7b_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7b_Aux
+    = S7b_Aux {s7b_Aux_a :: CChar
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 35:23@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -},
+               s7b_Aux_b :: CInt
+               {- ^ __C declaration:__ @b@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 35:30@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S7b_Aux
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S7b_Aux
+    where readRaw = \ptr_0 -> (pure S7b_Aux <*> readRaw (Proxy @"s7b_Aux_a") ptr_0) <*> readRaw (Proxy @"s7b_Aux_b") ptr_0
+instance WriteRaw S7b_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S7b_Aux s7b_Aux_a_2
+                                               s7b_Aux_b_3 -> writeRaw (Proxy @"s7b_Aux_a") ptr_0 s7b_Aux_a_2 >> writeRaw (Proxy @"s7b_Aux_b") ptr_0 s7b_Aux_b_3
+deriving via (EquivStorable S7b_Aux) instance Storable S7b_Aux
+deriving via (IsStructViaReadRaw S7b_Aux) instance IsStruct S7b_Aux
+instance (~) ty CChar => HasField "s7b_Aux_a" S7b_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7b_Aux{s7b_Aux_a = y_1,
+                                              s7b_Aux_b = getField @"s7b_Aux_b" x_0},
+                              getField @"s7b_Aux_a" x_0)
+instance (~) ty CChar =>
+         HasField "s7b_Aux_a" (Ptr S7b_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"s7b_Aux_a")
+instance HasCField S7b_Aux "s7b_Aux_a"
+    where type CFieldType S7b_Aux "s7b_Aux_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s7b_Aux_b" S7b_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7b_Aux{s7b_Aux_b = y_1,
+                                              s7b_Aux_a = getField @"s7b_Aux_a" x_0},
+                              getField @"s7b_Aux_b" x_0)
+instance (~) ty CInt => HasField "s7b_Aux_b" (Ptr S7b_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"s7b_Aux_b")
+instance HasCField S7b_Aux "s7b_Aux_b"
+    where type CFieldType S7b_Aux "s7b_Aux_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @S7b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:38@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7b
+    = S7b {unwrapS7b :: (Ptr (Ptr (Ptr S7b_Aux)))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr (Ptr S7b_Aux))) =>
+         HasField "unwrapS7b" S7b ty
+    where hasField = \x_0 -> (\y_1 -> S7b{unwrapS7b = y_1},
+                              getField @"unwrapS7b" x_0)
+instance (~) ty (Ptr (Ptr (Ptr S7b_Aux))) =>
+         HasField "unwrapS7b" (Ptr S7b) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapS7b")
+instance HasCField S7b "unwrapS7b"
+    where type CFieldType S7b "unwrapS7b" = Ptr (Ptr (Ptr S7b_Aux))
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/structs/simple_structs/Example.hs b/test-artefacts/fixtures/types/structs/simple_structs/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/simple_structs/Example.hs
@@ -0,0 +1,977 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S1(..)
+    , Example.S2_t(..)
+    , Example.S3_t(..)
+    , Example.S4(..)
+    , Example.S5(..)
+    , Example.S6(..)
+    , Example.S7a_Aux(..)
+    , Example.S7a(..)
+    , Example.S7b_Aux(..)
+    , Example.S7b(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Ord, Show, pure, type (~))
+
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/structs\/simple_structs.h 2:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S1 = S1
+  { s1_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 3:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s1_b :: BG.CChar
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 4:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S1 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S1 where
+
+  readRaw =
+    \ptr0 ->
+          pure S1
+      <*> HasCField.readRaw (BG.Proxy @"s1_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s1_b") ptr0
+
+instance Marshal.WriteRaw S1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S1 s1_a2 s1_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s1_a") ptr0 s1_a2
+            >> HasCField.writeRaw (BG.Proxy @"s1_b") ptr0 s1_b3
+
+deriving via Marshal.EquivStorable S1 instance BG.Storable S1
+
+deriving via Struct.IsStructViaReadRaw S1 instance Struct.IsStruct S1
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 3:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s1_a" S1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1 {s1_a = y1, s1_b = BG.getField @"s1_b" x0}
+      , BG.getField @"s1_a" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s1_a" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_a")
+
+instance HasCField.HasCField S1 "s1_a" where
+
+  type CFieldType S1 "s1_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 4:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s1_b" S1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1 {s1_b = y1, s1_a = BG.getField @"s1_a" x0}
+      , BG.getField @"s1_b" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s1_b" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_b")
+
+instance HasCField.HasCField S1 "s1_b" where
+
+  type CFieldType S1 "s1_b" = BG.CChar
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/structs\/simple_structs.h 8:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S2_t = S2_t
+  { s2_t_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 9:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s2_t_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 10:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s2_t_c :: BG.CFloat
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/simple_structs.h 11:11@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2_t where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S2_t where
+
+  readRaw =
+    \ptr0 ->
+          pure S2_t
+      <*> HasCField.readRaw (BG.Proxy @"s2_t_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s2_t_b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s2_t_c") ptr0
+
+instance Marshal.WriteRaw S2_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2_t s2_t_a2 s2_t_b3 s2_t_c4 ->
+               HasCField.writeRaw (BG.Proxy @"s2_t_a") ptr0 s2_t_a2
+            >> HasCField.writeRaw (BG.Proxy @"s2_t_b") ptr0 s2_t_b3
+            >> HasCField.writeRaw (BG.Proxy @"s2_t_c") ptr0 s2_t_c4
+
+deriving via Marshal.EquivStorable S2_t instance BG.Storable S2_t
+
+deriving via Struct.IsStructViaReadRaw S2_t instance Struct.IsStruct S2_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 9:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s2_t_a" S2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_t { s2_t_a = y1
+               , s2_t_b = BG.getField @"s2_t_b" x0
+               , s2_t_c = BG.getField @"s2_t_c" x0
+               }
+      , BG.getField @"s2_t_a" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s2_t_a" (BG.Ptr S2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_t_a")
+
+instance HasCField.HasCField S2_t "s2_t_a" where
+
+  type CFieldType S2_t "s2_t_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 10:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s2_t_b" S2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_t { s2_t_b = y1
+               , s2_t_a = BG.getField @"s2_t_a" x0
+               , s2_t_c = BG.getField @"s2_t_c" x0
+               }
+      , BG.getField @"s2_t_b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s2_t_b" (BG.Ptr S2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_t_b")
+
+instance HasCField.HasCField S2_t "s2_t_b" where
+
+  type CFieldType S2_t "s2_t_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/simple_structs.h 11:11@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "s2_t_c" S2_t ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_t { s2_t_c = y1
+               , s2_t_a = BG.getField @"s2_t_a" x0
+               , s2_t_b = BG.getField @"s2_t_b" x0
+               }
+      , BG.getField @"s2_t_c" x0
+      )
+
+instance ( ty ~ BG.CFloat
+         ) => BG.HasField "s2_t_c" (BG.Ptr S2_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_t_c")
+
+instance HasCField.HasCField S2_t "s2_t_c" where
+
+  type CFieldType S2_t "s2_t_c" = BG.CFloat
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct S3_t@
+
+    __defined at:__ @types\/structs\/simple_structs.h 15:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S3_t = S3_t
+  { s3_t_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 16:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S3_t where
+
+  staticSizeOf = \_ -> (1 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw S3_t where
+
+  readRaw =
+    \ptr0 ->
+          pure S3_t
+      <*> HasCField.readRaw (BG.Proxy @"s3_t_a") ptr0
+
+instance Marshal.WriteRaw S3_t where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S3_t s3_t_a2 ->
+            HasCField.writeRaw (BG.Proxy @"s3_t_a") ptr0 s3_t_a2
+
+deriving via Marshal.EquivStorable S3_t instance BG.Storable S3_t
+
+deriving via Struct.IsStructViaReadRaw S3_t instance Struct.IsStruct S3_t
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 16:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s3_t_a" S3_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> S3_t {s3_t_a = y1}, BG.getField @"s3_t_a" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "s3_t_a" (BG.Ptr S3_t) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s3_t_a")
+
+instance HasCField.HasCField S3_t "s3_t_a" where
+
+  type CFieldType S3_t "s3_t_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct S4@
+
+    __defined at:__ @types\/structs\/simple_structs.h 19:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S4 = S4
+  { s4_b :: BG.CChar
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 20:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s4_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 21:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s4_c :: BG.Ptr BG.CInt
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/simple_structs.h 22:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S4 where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw S4 where
+
+  readRaw =
+    \ptr0 ->
+          pure S4
+      <*> HasCField.readRaw (BG.Proxy @"s4_b") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s4_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s4_c") ptr0
+
+instance Marshal.WriteRaw S4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S4 s4_b2 s4_a3 s4_c4 ->
+               HasCField.writeRaw (BG.Proxy @"s4_b") ptr0 s4_b2
+            >> HasCField.writeRaw (BG.Proxy @"s4_a") ptr0 s4_a3
+            >> HasCField.writeRaw (BG.Proxy @"s4_c") ptr0 s4_c4
+
+deriving via Marshal.EquivStorable S4 instance BG.Storable S4
+
+deriving via Struct.IsStructViaReadRaw S4 instance Struct.IsStruct S4
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 20:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s4_b" S4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S4 {s4_b = y1, s4_a = BG.getField @"s4_a" x0, s4_c = BG.getField @"s4_c" x0}
+      , BG.getField @"s4_b" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s4_b" (BG.Ptr S4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s4_b")
+
+instance HasCField.HasCField S4 "s4_b" where
+
+  type CFieldType S4 "s4_b" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 21:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s4_a" S4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S4 {s4_a = y1, s4_b = BG.getField @"s4_b" x0, s4_c = BG.getField @"s4_c" x0}
+      , BG.getField @"s4_a" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s4_a" (BG.Ptr S4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s4_a")
+
+instance HasCField.HasCField S4 "s4_a" where
+
+  type CFieldType S4 "s4_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/simple_structs.h 22:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.Ptr BG.CInt) => BG.CompatHasField.HasField "s4_c" S4 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S4 {s4_c = y1, s4_b = BG.getField @"s4_b" x0, s4_a = BG.getField @"s4_a" x0}
+      , BG.getField @"s4_c" x0
+      )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "s4_c" (BG.Ptr S4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s4_c")
+
+instance HasCField.HasCField S4 "s4_c" where
+
+  type CFieldType S4 "s4_c" = BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct S5@
+
+    __defined at:__ @types\/structs\/simple_structs.h 26:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S5 = S5
+  { s5_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 27:10@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s5_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 28:9@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S5 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S5 where
+
+  readRaw =
+    \ptr0 ->
+          pure S5
+      <*> HasCField.readRaw (BG.Proxy @"s5_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s5_b") ptr0
+
+instance Marshal.WriteRaw S5 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S5 s5_a2 s5_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s5_a") ptr0 s5_a2
+            >> HasCField.writeRaw (BG.Proxy @"s5_b") ptr0 s5_b3
+
+deriving via Marshal.EquivStorable S5 instance BG.Storable S5
+
+deriving via Struct.IsStructViaReadRaw S5 instance Struct.IsStruct S5
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 27:10@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s5_a" S5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S5 {s5_a = y1, s5_b = BG.getField @"s5_b" x0}
+      , BG.getField @"s5_a" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s5_a" (BG.Ptr S5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s5_a")
+
+instance HasCField.HasCField S5 "s5_a" where
+
+  type CFieldType S5 "s5_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 28:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s5_b" S5 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S5 {s5_b = y1, s5_a = BG.getField @"s5_a" x0}
+      , BG.getField @"s5_b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s5_b" (BG.Ptr S5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s5_b")
+
+instance HasCField.HasCField S5 "s5_b" where
+
+  type CFieldType S5 "s5_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S6@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S6 = S6
+  { s6_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 31:18@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s6_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 31:25@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S6 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S6 where
+
+  readRaw =
+    \ptr0 ->
+          pure S6
+      <*> HasCField.readRaw (BG.Proxy @"s6_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s6_b") ptr0
+
+instance Marshal.WriteRaw S6 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S6 s6_a2 s6_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s6_a") ptr0 s6_a2
+            >> HasCField.writeRaw (BG.Proxy @"s6_b") ptr0 s6_b3
+
+deriving via Marshal.EquivStorable S6 instance BG.Storable S6
+
+deriving via Struct.IsStructViaReadRaw S6 instance Struct.IsStruct S6
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:18@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "s6_a" S6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S6 {s6_a = y1, s6_b = BG.getField @"s6_b" x0}
+      , BG.getField @"s6_a" x0
+      )
+
+instance (ty ~ BG.CChar) => BG.HasField "s6_a" (BG.Ptr S6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s6_a")
+
+instance HasCField.HasCField S6 "s6_a" where
+
+  type CFieldType S6 "s6_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:25@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s6_b" S6 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S6 {s6_b = y1, s6_a = BG.getField @"s6_a" x0}
+      , BG.getField @"s6_b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s6_b" (BG.Ptr S6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s6_b")
+
+instance HasCField.HasCField S6 "s6_b" where
+
+  type CFieldType S6 "s6_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@S7a_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7a_Aux = S7a_Aux
+  { s7a_Aux_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 34:23@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s7a_Aux_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 34:30@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S7a_Aux where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S7a_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure S7a_Aux
+      <*> HasCField.readRaw (BG.Proxy @"s7a_Aux_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s7a_Aux_b") ptr0
+
+instance Marshal.WriteRaw S7a_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S7a_Aux s7a_Aux_a2 s7a_Aux_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s7a_Aux_a") ptr0 s7a_Aux_a2
+            >> HasCField.writeRaw (BG.Proxy @"s7a_Aux_b") ptr0 s7a_Aux_b3
+
+deriving via Marshal.EquivStorable S7a_Aux instance BG.Storable S7a_Aux
+
+deriving via Struct.IsStructViaReadRaw S7a_Aux instance Struct.IsStruct S7a_Aux
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:23@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "s7a_Aux_a" S7a_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S7a_Aux {s7a_Aux_a = y1, s7a_Aux_b = BG.getField @"s7a_Aux_b" x0}
+      , BG.getField @"s7a_Aux_a" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "s7a_Aux_a" (BG.Ptr S7a_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s7a_Aux_a")
+
+instance HasCField.HasCField S7a_Aux "s7a_Aux_a" where
+
+  type CFieldType S7a_Aux "s7a_Aux_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:30@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s7a_Aux_b" S7a_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S7a_Aux {s7a_Aux_b = y1, s7a_Aux_a = BG.getField @"s7a_Aux_a" x0}
+      , BG.getField @"s7a_Aux_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s7a_Aux_b" (BG.Ptr S7a_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s7a_Aux_b")
+
+instance HasCField.HasCField S7a_Aux "s7a_Aux_b" where
+
+  type CFieldType S7a_Aux "s7a_Aux_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @S7a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:36@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7a = S7a
+  { unwrapS7a :: BG.Ptr S7a_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr S7a_Aux
+         ) => BG.CompatHasField.HasField "unwrapS7a" S7a ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S7a {unwrapS7a = y1}, BG.getField @"unwrapS7a" x0)
+
+instance ( ty ~ BG.Ptr S7a_Aux
+         ) => BG.HasField "unwrapS7a" (BG.Ptr S7a) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapS7a")
+
+instance HasCField.HasCField S7a "unwrapS7a" where
+
+  type CFieldType S7a "unwrapS7a" = BG.Ptr S7a_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S7b_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7b_Aux = S7b_Aux
+  { s7b_Aux_a :: BG.CChar
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/simple_structs.h 35:23@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  , s7b_Aux_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/simple_structs.h 35:30@
+
+         __exported by:__ @types\/structs\/simple_structs.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S7b_Aux where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S7b_Aux where
+
+  readRaw =
+    \ptr0 ->
+          pure S7b_Aux
+      <*> HasCField.readRaw (BG.Proxy @"s7b_Aux_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s7b_Aux_b") ptr0
+
+instance Marshal.WriteRaw S7b_Aux where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S7b_Aux s7b_Aux_a2 s7b_Aux_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s7b_Aux_a") ptr0 s7b_Aux_a2
+            >> HasCField.writeRaw (BG.Proxy @"s7b_Aux_b") ptr0 s7b_Aux_b3
+
+deriving via Marshal.EquivStorable S7b_Aux instance BG.Storable S7b_Aux
+
+deriving via Struct.IsStructViaReadRaw S7b_Aux instance Struct.IsStruct S7b_Aux
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:23@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "s7b_Aux_a" S7b_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S7b_Aux {s7b_Aux_a = y1, s7b_Aux_b = BG.getField @"s7b_Aux_b" x0}
+      , BG.getField @"s7b_Aux_a" x0
+      )
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "s7b_Aux_a" (BG.Ptr S7b_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s7b_Aux_a")
+
+instance HasCField.HasCField S7b_Aux "s7b_Aux_a" where
+
+  type CFieldType S7b_Aux "s7b_Aux_a" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:30@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s7b_Aux_b" S7b_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S7b_Aux {s7b_Aux_b = y1, s7b_Aux_a = BG.getField @"s7b_Aux_a" x0}
+      , BG.getField @"s7b_Aux_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s7b_Aux_b" (BG.Ptr S7b_Aux) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s7b_Aux_b")
+
+instance HasCField.HasCField S7b_Aux "s7b_Aux_b" where
+
+  type CFieldType S7b_Aux "s7b_Aux_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @S7b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:38@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7b = S7b
+  { unwrapS7b :: BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+         ) => BG.CompatHasField.HasField "unwrapS7b" S7b ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         S7b {unwrapS7b = y1}, BG.getField @"unwrapS7b" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+         ) => BG.HasField "unwrapS7b" (BG.Ptr S7b) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapS7b")
+
+instance HasCField.HasCField S7b "unwrapS7b" where
+
+  type CFieldType S7b "unwrapS7b" =
+    BG.Ptr (BG.Ptr (BG.Ptr S7b_Aux))
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/structs/simple_structs/bindingspec.yaml b/test-artefacts/fixtures/types/structs/simple_structs/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/simple_structs/bindingspec.yaml
@@ -0,0 +1,255 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/simple_structs.h
+  cname: struct S1
+  hsname: S1
+- headers: types/structs/simple_structs.h
+  cname: struct S2
+  hsname: S2_t
+- headers: types/structs/simple_structs.h
+  cname: S2_t
+  hsname: S2_t
+- headers: types/structs/simple_structs.h
+  cname: struct S3_t
+  hsname: S3_t
+- headers: types/structs/simple_structs.h
+  cname: S3_t
+  hsname: S3_t
+- headers: types/structs/simple_structs.h
+  cname: struct S4
+  hsname: S4
+- headers: types/structs/simple_structs.h
+  cname: struct S5
+  hsname: S5
+- headers: types/structs/simple_structs.h
+  cname: S5
+  hsname: S5
+- headers: types/structs/simple_structs.h
+  cname: struct S6
+  hsname: S6
+- headers: types/structs/simple_structs.h
+  cname: S6
+  hsname: S6
+- headers: types/structs/simple_structs.h
+  cname: struct @S7a_Aux
+  hsname: S7a_Aux
+- headers: types/structs/simple_structs.h
+  cname: S7a
+  hsname: S7a
+- headers: types/structs/simple_structs.h
+  cname: struct @S7b_Aux
+  hsname: S7b_Aux
+- headers: types/structs/simple_structs.h
+  cname: S7b
+  hsname: S7b
+hstypes:
+- hsname: S1
+  representation:
+    record:
+      constructor: S1
+      fields:
+      - s1_a
+      - s1_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2_t
+  representation:
+    record:
+      constructor: S2_t
+      fields:
+      - s2_t_a
+      - s2_t_b
+      - s2_t_c
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S3_t
+  representation:
+    record:
+      constructor: S3_t
+      fields:
+      - s3_t_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S4
+  representation:
+    record:
+      constructor: S4
+      fields:
+      - s4_b
+      - s4_a
+      - s4_c
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S5
+  representation:
+    record:
+      constructor: S5
+      fields:
+      - s5_a
+      - s5_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S6
+  representation:
+    record:
+      constructor: S6
+      fields:
+      - s6_a
+      - s6_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7a
+  representation:
+    newtype:
+      constructor: S7a
+      fields:
+      - unwrapS7a
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7a_Aux
+  representation:
+    record:
+      constructor: S7a_Aux
+      fields:
+      - s7a_Aux_a
+      - s7a_Aux_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7b
+  representation:
+    newtype:
+      constructor: S7b
+      fields:
+      - unwrapS7b
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S7b_Aux
+  representation:
+    record:
+      constructor: S7b_Aux
+      fields:
+      - s7b_Aux_a
+      - s7b_Aux_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/simple_structs/th.txt b/test-artefacts/fixtures/types/structs/simple_structs/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/simple_structs/th.txt
@@ -0,0 +1,480 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/simple_structs.h
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/structs\/simple_structs.h 2:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S1
+    = S1 {s1_a :: CInt
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 3:9@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s1_b :: CChar
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 4:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S1
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S1
+    where readRaw = \ptr_0 -> (pure S1 <*> readRaw (Proxy @"s1_a") ptr_0) <*> readRaw (Proxy @"s1_b") ptr_0
+instance WriteRaw S1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S1 s1_a_2
+                                          s1_b_3 -> writeRaw (Proxy @"s1_a") ptr_0 s1_a_2 >> writeRaw (Proxy @"s1_b") ptr_0 s1_b_3
+deriving via (EquivStorable S1) instance Storable S1
+deriving via (IsStructViaReadRaw S1) instance IsStruct S1
+instance (~) ty CInt => HasField "s1_a" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{s1_a = y_1,
+                                         s1_b = getField @"s1_b" x_0},
+                              getField @"s1_a" x_0)
+instance (~) ty CInt => HasField "s1_a" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_a")
+instance HasCField S1 "s1_a"
+    where type CFieldType S1 "s1_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar => HasField "s1_b" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{s1_b = y_1,
+                                         s1_a = getField @"s1_a" x_0},
+                              getField @"s1_b" x_0)
+instance (~) ty CChar => HasField "s1_b" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_b")
+instance HasCField S1 "s1_b"
+    where type CFieldType S1 "s1_b" = CChar
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/structs\/simple_structs.h 8:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S2_t
+    = S2_t {s2_t_a :: CChar
+            {- ^ __C declaration:__ @a@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 9:10@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -},
+            s2_t_b :: CInt
+            {- ^ __C declaration:__ @b@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 10:9@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -},
+            s2_t_c :: CFloat
+            {- ^ __C declaration:__ @c@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 11:11@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2_t
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S2_t
+    where readRaw = \ptr_0 -> ((pure S2_t <*> readRaw (Proxy @"s2_t_a") ptr_0) <*> readRaw (Proxy @"s2_t_b") ptr_0) <*> readRaw (Proxy @"s2_t_c") ptr_0
+instance WriteRaw S2_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2_t s2_t_a_2
+                                            s2_t_b_3
+                                            s2_t_c_4 -> writeRaw (Proxy @"s2_t_a") ptr_0 s2_t_a_2 >> (writeRaw (Proxy @"s2_t_b") ptr_0 s2_t_b_3 >> writeRaw (Proxy @"s2_t_c") ptr_0 s2_t_c_4)
+deriving via (EquivStorable S2_t) instance Storable S2_t
+deriving via (IsStructViaReadRaw S2_t) instance IsStruct S2_t
+instance (~) ty CChar => HasField "s2_t_a" S2_t ty
+    where hasField = \x_0 -> (\y_1 -> S2_t{s2_t_a = y_1,
+                                           s2_t_b = getField @"s2_t_b" x_0,
+                                           s2_t_c = getField @"s2_t_c" x_0},
+                              getField @"s2_t_a" x_0)
+instance (~) ty CChar => HasField "s2_t_a" (Ptr S2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_t_a")
+instance HasCField S2_t "s2_t_a"
+    where type CFieldType S2_t "s2_t_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s2_t_b" S2_t ty
+    where hasField = \x_0 -> (\y_1 -> S2_t{s2_t_b = y_1,
+                                           s2_t_a = getField @"s2_t_a" x_0,
+                                           s2_t_c = getField @"s2_t_c" x_0},
+                              getField @"s2_t_b" x_0)
+instance (~) ty CInt => HasField "s2_t_b" (Ptr S2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_t_b")
+instance HasCField S2_t "s2_t_b"
+    where type CFieldType S2_t "s2_t_b" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CFloat => HasField "s2_t_c" S2_t ty
+    where hasField = \x_0 -> (\y_1 -> S2_t{s2_t_c = y_1,
+                                           s2_t_a = getField @"s2_t_a" x_0,
+                                           s2_t_b = getField @"s2_t_b" x_0},
+                              getField @"s2_t_c" x_0)
+instance (~) ty CFloat => HasField "s2_t_c" (Ptr S2_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_t_c")
+instance HasCField S2_t "s2_t_c"
+    where type CFieldType S2_t "s2_t_c" = CFloat
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct S3_t@
+
+    __defined at:__ @types\/structs\/simple_structs.h 15:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S3_t
+    = S3_t {s3_t_a :: CChar
+            {- ^ __C declaration:__ @a@
+
+                 __defined at:__ @types\/structs\/simple_structs.h 16:10@
+
+                 __exported by:__ @types\/structs\/simple_structs.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S3_t
+    where staticSizeOf = \_ -> 1 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw S3_t
+    where readRaw = \ptr_0 -> pure S3_t <*> readRaw (Proxy @"s3_t_a") ptr_0
+instance WriteRaw S3_t
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S3_t s3_t_a_2 -> writeRaw (Proxy @"s3_t_a") ptr_0 s3_t_a_2
+deriving via (EquivStorable S3_t) instance Storable S3_t
+deriving via (IsStructViaReadRaw S3_t) instance IsStruct S3_t
+instance (~) ty CChar => HasField "s3_t_a" S3_t ty
+    where hasField = \x_0 -> (\y_1 -> S3_t{s3_t_a = y_1},
+                              getField @"s3_t_a" x_0)
+instance (~) ty CChar => HasField "s3_t_a" (Ptr S3_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"s3_t_a")
+instance HasCField S3_t "s3_t_a"
+    where type CFieldType S3_t "s3_t_a" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct S4@
+
+    __defined at:__ @types\/structs\/simple_structs.h 19:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S4
+    = S4 {s4_b :: CChar
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 20:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s4_a :: CInt
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 21:9@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s4_c :: (Ptr CInt)
+          {- ^ __C declaration:__ @c@
+
+               __defined at:__ @types\/structs\/simple_structs.h 22:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S4
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw S4
+    where readRaw = \ptr_0 -> ((pure S4 <*> readRaw (Proxy @"s4_b") ptr_0) <*> readRaw (Proxy @"s4_a") ptr_0) <*> readRaw (Proxy @"s4_c") ptr_0
+instance WriteRaw S4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S4 s4_b_2
+                                          s4_a_3
+                                          s4_c_4 -> writeRaw (Proxy @"s4_b") ptr_0 s4_b_2 >> (writeRaw (Proxy @"s4_a") ptr_0 s4_a_3 >> writeRaw (Proxy @"s4_c") ptr_0 s4_c_4)
+deriving via (EquivStorable S4) instance Storable S4
+deriving via (IsStructViaReadRaw S4) instance IsStruct S4
+instance (~) ty CChar => HasField "s4_b" S4 ty
+    where hasField = \x_0 -> (\y_1 -> S4{s4_b = y_1,
+                                         s4_a = getField @"s4_a" x_0,
+                                         s4_c = getField @"s4_c" x_0},
+                              getField @"s4_b" x_0)
+instance (~) ty CChar => HasField "s4_b" (Ptr S4) (Ptr ty)
+    where getField = fromPtr (Proxy @"s4_b")
+instance HasCField S4 "s4_b"
+    where type CFieldType S4 "s4_b" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s4_a" S4 ty
+    where hasField = \x_0 -> (\y_1 -> S4{s4_a = y_1,
+                                         s4_b = getField @"s4_b" x_0,
+                                         s4_c = getField @"s4_c" x_0},
+                              getField @"s4_a" x_0)
+instance (~) ty CInt => HasField "s4_a" (Ptr S4) (Ptr ty)
+    where getField = fromPtr (Proxy @"s4_a")
+instance HasCField S4 "s4_a"
+    where type CFieldType S4 "s4_a" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty (Ptr CInt) => HasField "s4_c" S4 ty
+    where hasField = \x_0 -> (\y_1 -> S4{s4_c = y_1,
+                                         s4_b = getField @"s4_b" x_0,
+                                         s4_a = getField @"s4_a" x_0},
+                              getField @"s4_c" x_0)
+instance (~) ty (Ptr CInt) => HasField "s4_c" (Ptr S4) (Ptr ty)
+    where getField = fromPtr (Proxy @"s4_c")
+instance HasCField S4 "s4_c"
+    where type CFieldType S4 "s4_c" = Ptr CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct S5@
+
+    __defined at:__ @types\/structs\/simple_structs.h 26:16@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S5
+    = S5 {s5_a :: CChar
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 27:10@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s5_b :: CInt
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 28:9@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S5
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S5
+    where readRaw = \ptr_0 -> (pure S5 <*> readRaw (Proxy @"s5_a") ptr_0) <*> readRaw (Proxy @"s5_b") ptr_0
+instance WriteRaw S5
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S5 s5_a_2
+                                          s5_b_3 -> writeRaw (Proxy @"s5_a") ptr_0 s5_a_2 >> writeRaw (Proxy @"s5_b") ptr_0 s5_b_3
+deriving via (EquivStorable S5) instance Storable S5
+deriving via (IsStructViaReadRaw S5) instance IsStruct S5
+instance (~) ty CChar => HasField "s5_a" S5 ty
+    where hasField = \x_0 -> (\y_1 -> S5{s5_a = y_1,
+                                         s5_b = getField @"s5_b" x_0},
+                              getField @"s5_a" x_0)
+instance (~) ty CChar => HasField "s5_a" (Ptr S5) (Ptr ty)
+    where getField = fromPtr (Proxy @"s5_a")
+instance HasCField S5 "s5_a"
+    where type CFieldType S5 "s5_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s5_b" S5 ty
+    where hasField = \x_0 -> (\y_1 -> S5{s5_b = y_1,
+                                         s5_a = getField @"s5_a" x_0},
+                              getField @"s5_b" x_0)
+instance (~) ty CInt => HasField "s5_b" (Ptr S5) (Ptr ty)
+    where getField = fromPtr (Proxy @"s5_b")
+instance HasCField S5 "s5_b"
+    where type CFieldType S5 "s5_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S6@
+
+    __defined at:__ @types\/structs\/simple_structs.h 31:8@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S6
+    = S6 {s6_a :: CChar
+          {- ^ __C declaration:__ @a@
+
+               __defined at:__ @types\/structs\/simple_structs.h 31:18@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -},
+          s6_b :: CInt
+          {- ^ __C declaration:__ @b@
+
+               __defined at:__ @types\/structs\/simple_structs.h 31:25@
+
+               __exported by:__ @types\/structs\/simple_structs.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S6
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S6
+    where readRaw = \ptr_0 -> (pure S6 <*> readRaw (Proxy @"s6_a") ptr_0) <*> readRaw (Proxy @"s6_b") ptr_0
+instance WriteRaw S6
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S6 s6_a_2
+                                          s6_b_3 -> writeRaw (Proxy @"s6_a") ptr_0 s6_a_2 >> writeRaw (Proxy @"s6_b") ptr_0 s6_b_3
+deriving via (EquivStorable S6) instance Storable S6
+deriving via (IsStructViaReadRaw S6) instance IsStruct S6
+instance (~) ty CChar => HasField "s6_a" S6 ty
+    where hasField = \x_0 -> (\y_1 -> S6{s6_a = y_1,
+                                         s6_b = getField @"s6_b" x_0},
+                              getField @"s6_a" x_0)
+instance (~) ty CChar => HasField "s6_a" (Ptr S6) (Ptr ty)
+    where getField = fromPtr (Proxy @"s6_a")
+instance HasCField S6 "s6_a"
+    where type CFieldType S6 "s6_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s6_b" S6 ty
+    where hasField = \x_0 -> (\y_1 -> S6{s6_b = y_1,
+                                         s6_a = getField @"s6_a" x_0},
+                              getField @"s6_b" x_0)
+instance (~) ty CInt => HasField "s6_b" (Ptr S6) (Ptr ty)
+    where getField = fromPtr (Proxy @"s6_b")
+instance HasCField S6 "s6_b"
+    where type CFieldType S6 "s6_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@S7a_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7a_Aux
+    = S7a_Aux {s7a_Aux_a :: CChar
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 34:23@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -},
+               s7a_Aux_b :: CInt
+               {- ^ __C declaration:__ @b@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 34:30@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S7a_Aux
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S7a_Aux
+    where readRaw = \ptr_0 -> (pure S7a_Aux <*> readRaw (Proxy @"s7a_Aux_a") ptr_0) <*> readRaw (Proxy @"s7a_Aux_b") ptr_0
+instance WriteRaw S7a_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S7a_Aux s7a_Aux_a_2
+                                               s7a_Aux_b_3 -> writeRaw (Proxy @"s7a_Aux_a") ptr_0 s7a_Aux_a_2 >> writeRaw (Proxy @"s7a_Aux_b") ptr_0 s7a_Aux_b_3
+deriving via (EquivStorable S7a_Aux) instance Storable S7a_Aux
+deriving via (IsStructViaReadRaw S7a_Aux) instance IsStruct S7a_Aux
+instance (~) ty CChar => HasField "s7a_Aux_a" S7a_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7a_Aux{s7a_Aux_a = y_1,
+                                              s7a_Aux_b = getField @"s7a_Aux_b" x_0},
+                              getField @"s7a_Aux_a" x_0)
+instance (~) ty CChar =>
+         HasField "s7a_Aux_a" (Ptr S7a_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"s7a_Aux_a")
+instance HasCField S7a_Aux "s7a_Aux_a"
+    where type CFieldType S7a_Aux "s7a_Aux_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s7a_Aux_b" S7a_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7a_Aux{s7a_Aux_b = y_1,
+                                              s7a_Aux_a = getField @"s7a_Aux_a" x_0},
+                              getField @"s7a_Aux_b" x_0)
+instance (~) ty CInt => HasField "s7a_Aux_b" (Ptr S7a_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"s7a_Aux_b")
+instance HasCField S7a_Aux "s7a_Aux_b"
+    where type CFieldType S7a_Aux "s7a_Aux_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @S7a@
+
+    __defined at:__ @types\/structs\/simple_structs.h 34:36@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7a
+    = S7a {unwrapS7a :: (Ptr S7a_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr S7a_Aux) => HasField "unwrapS7a" S7a ty
+    where hasField = \x_0 -> (\y_1 -> S7a{unwrapS7a = y_1},
+                              getField @"unwrapS7a" x_0)
+instance (~) ty (Ptr S7a_Aux) =>
+         HasField "unwrapS7a" (Ptr S7a) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapS7a")
+instance HasCField S7a "unwrapS7a"
+    where type CFieldType S7a "unwrapS7a" = Ptr S7a_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S7b_Aux@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:9@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+data S7b_Aux
+    = S7b_Aux {s7b_Aux_a :: CChar
+               {- ^ __C declaration:__ @a@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 35:23@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -},
+               s7b_Aux_b :: CInt
+               {- ^ __C declaration:__ @b@
+
+                    __defined at:__ @types\/structs\/simple_structs.h 35:30@
+
+                    __exported by:__ @types\/structs\/simple_structs.h@
+               -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S7b_Aux
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S7b_Aux
+    where readRaw = \ptr_0 -> (pure S7b_Aux <*> readRaw (Proxy @"s7b_Aux_a") ptr_0) <*> readRaw (Proxy @"s7b_Aux_b") ptr_0
+instance WriteRaw S7b_Aux
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S7b_Aux s7b_Aux_a_2
+                                               s7b_Aux_b_3 -> writeRaw (Proxy @"s7b_Aux_a") ptr_0 s7b_Aux_a_2 >> writeRaw (Proxy @"s7b_Aux_b") ptr_0 s7b_Aux_b_3
+deriving via (EquivStorable S7b_Aux) instance Storable S7b_Aux
+deriving via (IsStructViaReadRaw S7b_Aux) instance IsStruct S7b_Aux
+instance (~) ty CChar => HasField "s7b_Aux_a" S7b_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7b_Aux{s7b_Aux_a = y_1,
+                                              s7b_Aux_b = getField @"s7b_Aux_b" x_0},
+                              getField @"s7b_Aux_a" x_0)
+instance (~) ty CChar =>
+         HasField "s7b_Aux_a" (Ptr S7b_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"s7b_Aux_a")
+instance HasCField S7b_Aux "s7b_Aux_a"
+    where type CFieldType S7b_Aux "s7b_Aux_a" = CChar
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s7b_Aux_b" S7b_Aux ty
+    where hasField = \x_0 -> (\y_1 -> S7b_Aux{s7b_Aux_b = y_1,
+                                              s7b_Aux_a = getField @"s7b_Aux_a" x_0},
+                              getField @"s7b_Aux_b" x_0)
+instance (~) ty CInt => HasField "s7b_Aux_b" (Ptr S7b_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"s7b_Aux_b")
+instance HasCField S7b_Aux "s7b_Aux_b"
+    where type CFieldType S7b_Aux "s7b_Aux_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @S7b@
+
+    __defined at:__ @types\/structs\/simple_structs.h 35:38@
+
+    __exported by:__ @types\/structs\/simple_structs.h@
+-}
+newtype S7b
+    = S7b {unwrapS7b :: (Ptr (Ptr (Ptr S7b_Aux)))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr (Ptr S7b_Aux))) =>
+         HasField "unwrapS7b" S7b ty
+    where hasField = \x_0 -> (\y_1 -> S7b{unwrapS7b = y_1},
+                              getField @"unwrapS7b" x_0)
+instance (~) ty (Ptr (Ptr (Ptr S7b_Aux))) =>
+         HasField "unwrapS7b" (Ptr S7b) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapS7b")
+instance HasCField S7b "unwrapS7b"
+    where type CFieldType S7b "unwrapS7b" = Ptr (Ptr (Ptr S7b_Aux))
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/structs/struct_arg/Example.hs b/test-artefacts/fixtures/types/structs/struct_arg/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/struct_arg/Example.hs
@@ -0,0 +1,93 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Thing(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct thing@
+
+    __defined at:__ @types\/structs\/struct_arg.h 2:8@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+data Thing = Thing
+  { thing_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/structs\/struct_arg.h 3:9@
+
+         __exported by:__ @types\/structs\/struct_arg.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Thing where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Thing where
+
+  readRaw =
+    \ptr0 ->
+          pure Thing
+      <*> HasCField.readRaw (BG.Proxy @"thing_x") ptr0
+
+instance Marshal.WriteRaw Thing where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Thing thing_x2 ->
+            HasCField.writeRaw (BG.Proxy @"thing_x") ptr0 thing_x2
+
+deriving via Marshal.EquivStorable Thing instance BG.Storable Thing
+
+deriving via Struct.IsStructViaReadRaw Thing instance Struct.IsStruct Thing
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/structs\/struct_arg.h 3:9@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "thing_x" Thing ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Thing {thing_x = y1}, BG.getField @"thing_x" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "thing_x" (BG.Ptr Thing) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"thing_x")
+
+instance HasCField.HasCField Thing "thing_x" where
+
+  type CFieldType Thing "thing_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/structs/struct_arg/Example/FunPtr.hs b/test-artefacts/fixtures/types/structs/struct_arg/Example/FunPtr.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/struct_arg/Example/FunPtr.hs
@@ -0,0 +1,137 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.FunPtr
+    ( Example.FunPtr.thing_fun_1
+    , Example.FunPtr.thing_fun_2
+    , Example.FunPtr.thing_fun_3a
+    , Example.FunPtr.thing_fun_3b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/structs/struct_arg.h>"
+  , "/* test_typesstructsstruct_arg_Example_get_thing_fun_1 */"
+  , "__attribute__ ((const))"
+  , "signed int (*hs_bindgen_17a14e7ffaa1e2e5 (void)) ("
+  , "  struct thing arg1"
+  , ")"
+  , "{"
+  , "  return &thing_fun_1;"
+  , "}"
+  , "/* test_typesstructsstruct_arg_Example_get_thing_fun_2 */"
+  , "__attribute__ ((const))"
+  , "struct thing (*hs_bindgen_91748ffd57eae163 (void)) ("
+  , "  signed int arg1"
+  , ")"
+  , "{"
+  , "  return &thing_fun_2;"
+  , "}"
+  , "/* test_typesstructsstruct_arg_Example_get_thing_fun_3a */"
+  , "__attribute__ ((const))"
+  , "struct thing (*hs_bindgen_84d98a03314ff518 (void)) ("
+  , "  signed int arg1,"
+  , "  struct thing arg2,"
+  , "  double arg3"
+  , ")"
+  , "{"
+  , "  return &thing_fun_3a;"
+  , "}"
+  , "/* test_typesstructsstruct_arg_Example_get_thing_fun_3b */"
+  , "__attribute__ ((const))"
+  , "char (*hs_bindgen_855ae9088b15005e (void)) ("
+  , "  signed int arg1,"
+  , "  struct thing arg2,"
+  , "  double arg3"
+  , ")"
+  , "{"
+  , "  return &thing_fun_3b;"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_1@
+foreign import ccall unsafe "hs_bindgen_17a14e7ffaa1e2e5" hs_bindgen_17a14e7ffaa1e2e5_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_1@
+hs_bindgen_17a14e7ffaa1e2e5 :: IO (BG.FunPtr (Thing -> IO BG.CInt))
+hs_bindgen_17a14e7ffaa1e2e5 =
+  fmap BG.fromFFIType hs_bindgen_17a14e7ffaa1e2e5_base
+
+{-# NOINLINE thing_fun_1 #-}
+{-| __C declaration:__ @thing_fun_1@
+
+    __defined at:__ @types\/structs\/struct_arg.h 6:5@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_1 :: BG.FunPtr (Thing -> IO BG.CInt)
+thing_fun_1 =
+  BG.unsafePerformIO hs_bindgen_17a14e7ffaa1e2e5
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_2@
+foreign import ccall unsafe "hs_bindgen_91748ffd57eae163" hs_bindgen_91748ffd57eae163_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_2@
+hs_bindgen_91748ffd57eae163 :: IO (BG.FunPtr (BG.CInt -> IO Thing))
+hs_bindgen_91748ffd57eae163 =
+  fmap BG.fromFFIType hs_bindgen_91748ffd57eae163_base
+
+{-# NOINLINE thing_fun_2 #-}
+{-| __C declaration:__ @thing_fun_2@
+
+    __defined at:__ @types\/structs\/struct_arg.h 7:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_2 :: BG.FunPtr (BG.CInt -> IO Thing)
+thing_fun_2 =
+  BG.unsafePerformIO hs_bindgen_91748ffd57eae163
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3a@
+foreign import ccall unsafe "hs_bindgen_84d98a03314ff518" hs_bindgen_84d98a03314ff518_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3a@
+hs_bindgen_84d98a03314ff518 :: IO (BG.FunPtr (BG.CInt -> Thing -> BG.CDouble -> IO Thing))
+hs_bindgen_84d98a03314ff518 =
+  fmap BG.fromFFIType hs_bindgen_84d98a03314ff518_base
+
+{-# NOINLINE thing_fun_3a #-}
+{-| __C declaration:__ @thing_fun_3a@
+
+    __defined at:__ @types\/structs\/struct_arg.h 9:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3a :: BG.FunPtr (BG.CInt -> Thing -> BG.CDouble -> IO Thing)
+thing_fun_3a =
+  BG.unsafePerformIO hs_bindgen_84d98a03314ff518
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3b@
+foreign import ccall unsafe "hs_bindgen_855ae9088b15005e" hs_bindgen_855ae9088b15005e_base ::
+     IO (BG.FunPtr BG.Void)
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3b@
+hs_bindgen_855ae9088b15005e :: IO (BG.FunPtr (BG.CInt -> Thing -> BG.CDouble -> IO BG.CChar))
+hs_bindgen_855ae9088b15005e =
+  fmap BG.fromFFIType hs_bindgen_855ae9088b15005e_base
+
+{-# NOINLINE thing_fun_3b #-}
+{-| __C declaration:__ @thing_fun_3b@
+
+    __defined at:__ @types\/structs\/struct_arg.h 10:6@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3b :: BG.FunPtr (BG.CInt -> Thing -> BG.CDouble -> IO BG.CChar)
+thing_fun_3b =
+  BG.unsafePerformIO hs_bindgen_855ae9088b15005e
diff --git a/test-artefacts/fixtures/types/structs/struct_arg/Example/Safe.hs b/test-artefacts/fixtures/types/structs/struct_arg/Example/Safe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/struct_arg/Example/Safe.hs
@@ -0,0 +1,193 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Safe
+    ( Example.Safe.thing_fun_1
+    , Example.Safe.thing_fun_2
+    , Example.Safe.thing_fun_3a
+    , Example.Safe.thing_fun_3b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/structs/struct_arg.h>"
+  , "signed int hs_bindgen_4ad25504590fdd2b ("
+  , "  struct thing *arg1"
+  , ")"
+  , "{"
+  , "  return (thing_fun_1)(*arg1);"
+  , "}"
+  , "void hs_bindgen_04a435522bf64978 ("
+  , "  signed int arg1,"
+  , "  struct thing *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (thing_fun_2)(arg1);"
+  , "}"
+  , "void hs_bindgen_5e3271324df7ced2 ("
+  , "  signed int arg1,"
+  , "  struct thing *arg2,"
+  , "  double arg3,"
+  , "  struct thing *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (thing_fun_3a)(arg1, *arg2, arg3);"
+  , "}"
+  , "char hs_bindgen_3525c7d1c72f2fae ("
+  , "  signed int arg1,"
+  , "  struct thing *arg2,"
+  , "  double arg3"
+  , ")"
+  , "{"
+  , "  return (thing_fun_3b)(arg1, *arg2, arg3);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_1@
+foreign import ccall safe "hs_bindgen_4ad25504590fdd2b" hs_bindgen_4ad25504590fdd2b_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_1@
+hs_bindgen_4ad25504590fdd2b ::
+     BG.Ptr Thing
+  -> IO BG.CInt
+hs_bindgen_4ad25504590fdd2b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_4ad25504590fdd2b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @thing_fun_1@
+
+    __defined at:__ @types\/structs\/struct_arg.h 6:5@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_1 ::
+     Thing
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+thing_fun_1 =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_4ad25504590fdd2b x1)
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_2@
+foreign import ccall safe "hs_bindgen_04a435522bf64978" hs_bindgen_04a435522bf64978_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_2@
+hs_bindgen_04a435522bf64978 ::
+     BG.CInt
+  -> BG.Ptr Thing
+  -> IO ()
+hs_bindgen_04a435522bf64978 =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_04a435522bf64978_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @thing_fun_2@
+
+    __defined at:__ @types\/structs\/struct_arg.h 7:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO Thing
+thing_fun_2 =
+  \x0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_04a435522bf64978 x0 res1)
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3a@
+foreign import ccall safe "hs_bindgen_5e3271324df7ced2" hs_bindgen_5e3271324df7ced2_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.CDouble
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3a@
+hs_bindgen_5e3271324df7ced2 ::
+     BG.CInt
+  -> BG.Ptr Thing
+  -> BG.CDouble
+  -> BG.Ptr Thing
+  -> IO ()
+hs_bindgen_5e3271324df7ced2 =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_5e3271324df7ced2_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __C declaration:__ @thing_fun_3a@
+
+    __defined at:__ @types\/structs\/struct_arg.h 9:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3a ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> Thing
+     -- ^ __C declaration:__ @y@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @z@
+  -> IO Thing
+thing_fun_3a =
+  \x0 ->
+    \y1 ->
+      \z2 ->
+        BG.with y1 (\y3 ->
+                      BG.allocaAndPeek (\res4 ->
+                                          hs_bindgen_5e3271324df7ced2 x0 y3 z2 res4))
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3b@
+foreign import ccall safe "hs_bindgen_3525c7d1c72f2fae" hs_bindgen_3525c7d1c72f2fae_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.CDouble
+  -> IO BG.CChar
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3b@
+hs_bindgen_3525c7d1c72f2fae ::
+     BG.CInt
+  -> BG.Ptr Thing
+  -> BG.CDouble
+  -> IO BG.CChar
+hs_bindgen_3525c7d1c72f2fae =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_3525c7d1c72f2fae_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @thing_fun_3b@
+
+    __defined at:__ @types\/structs\/struct_arg.h 10:6@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3b ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> Thing
+     -- ^ __C declaration:__ @y@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @z@
+  -> IO BG.CChar
+thing_fun_3b =
+  \x0 ->
+    \y1 ->
+      \z2 ->
+        BG.with y1 (\y3 ->
+                      hs_bindgen_3525c7d1c72f2fae x0 y3 z2)
diff --git a/test-artefacts/fixtures/types/structs/struct_arg/Example/Unsafe.hs b/test-artefacts/fixtures/types/structs/struct_arg/Example/Unsafe.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/struct_arg/Example/Unsafe.hs
@@ -0,0 +1,193 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_HADDOCK prune #-}
+
+module Example.Unsafe
+    ( Example.Unsafe.thing_fun_1
+    , Example.Unsafe.thing_fun_2
+    , Example.Unsafe.thing_fun_3a
+    , Example.Unsafe.thing_fun_3b
+    )
+  where
+
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CAPI
+import Example
+import Prelude (IO, fmap)
+
+$(HsBindgen.Runtime.Support.CAPI.addCSource (HsBindgen.Runtime.Support.CAPI.unlines
+  [ "#include <types/structs/struct_arg.h>"
+  , "signed int hs_bindgen_0bdddf60550fc97b ("
+  , "  struct thing *arg1"
+  , ")"
+  , "{"
+  , "  return (thing_fun_1)(*arg1);"
+  , "}"
+  , "void hs_bindgen_c293d866e22be6fc ("
+  , "  signed int arg1,"
+  , "  struct thing *arg2"
+  , ")"
+  , "{"
+  , "  *arg2 = (thing_fun_2)(arg1);"
+  , "}"
+  , "void hs_bindgen_cfd51a9e490a997c ("
+  , "  signed int arg1,"
+  , "  struct thing *arg2,"
+  , "  double arg3,"
+  , "  struct thing *arg4"
+  , ")"
+  , "{"
+  , "  *arg4 = (thing_fun_3a)(arg1, *arg2, arg3);"
+  , "}"
+  , "char hs_bindgen_23fac8ee5044da6e ("
+  , "  signed int arg1,"
+  , "  struct thing *arg2,"
+  , "  double arg3"
+  , ")"
+  , "{"
+  , "  return (thing_fun_3b)(arg1, *arg2, arg3);"
+  , "}"
+  ]))
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_1@
+foreign import ccall unsafe "hs_bindgen_0bdddf60550fc97b" hs_bindgen_0bdddf60550fc97b_base ::
+     BG.Ptr BG.Void
+  -> IO BG.CInt
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_1@
+hs_bindgen_0bdddf60550fc97b ::
+     BG.Ptr Thing
+  -> IO BG.CInt
+hs_bindgen_0bdddf60550fc97b =
+  \x0 ->
+    fmap BG.fromFFIType (hs_bindgen_0bdddf60550fc97b_base (BG.toFFIType x0))
+
+{-| __C declaration:__ @thing_fun_1@
+
+    __defined at:__ @types\/structs\/struct_arg.h 6:5@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_1 ::
+     Thing
+     -- ^ __C declaration:__ @x@
+  -> IO BG.CInt
+thing_fun_1 =
+  \x0 ->
+    BG.with x0 (\x1 -> hs_bindgen_0bdddf60550fc97b x1)
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_2@
+foreign import ccall unsafe "hs_bindgen_c293d866e22be6fc" hs_bindgen_c293d866e22be6fc_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_2@
+hs_bindgen_c293d866e22be6fc ::
+     BG.CInt
+  -> BG.Ptr Thing
+  -> IO ()
+hs_bindgen_c293d866e22be6fc =
+  \x0 ->
+    \x1 ->
+      hs_bindgen_c293d866e22be6fc_base (BG.toFFIType x0) (BG.toFFIType x1)
+
+{-| __C declaration:__ @thing_fun_2@
+
+    __defined at:__ @types\/structs\/struct_arg.h 7:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_2 ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> IO Thing
+thing_fun_2 =
+  \x0 ->
+    BG.allocaAndPeek (\res1 ->
+                        hs_bindgen_c293d866e22be6fc x0 res1)
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3a@
+foreign import ccall unsafe "hs_bindgen_cfd51a9e490a997c" hs_bindgen_cfd51a9e490a997c_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.CDouble
+  -> BG.Ptr BG.Void
+  -> IO ()
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3a@
+hs_bindgen_cfd51a9e490a997c ::
+     BG.CInt
+  -> BG.Ptr Thing
+  -> BG.CDouble
+  -> BG.Ptr Thing
+  -> IO ()
+hs_bindgen_cfd51a9e490a997c =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        \x3 ->
+          hs_bindgen_cfd51a9e490a997c_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2) (BG.toFFIType x3)
+
+{-| __C declaration:__ @thing_fun_3a@
+
+    __defined at:__ @types\/structs\/struct_arg.h 9:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3a ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> Thing
+     -- ^ __C declaration:__ @y@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @z@
+  -> IO Thing
+thing_fun_3a =
+  \x0 ->
+    \y1 ->
+      \z2 ->
+        BG.with y1 (\y3 ->
+                      BG.allocaAndPeek (\res4 ->
+                                          hs_bindgen_cfd51a9e490a997c x0 y3 z2 res4))
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3b@
+foreign import ccall unsafe "hs_bindgen_23fac8ee5044da6e" hs_bindgen_23fac8ee5044da6e_base ::
+     BG.CInt
+  -> BG.Ptr BG.Void
+  -> BG.CDouble
+  -> IO BG.CChar
+
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3b@
+hs_bindgen_23fac8ee5044da6e ::
+     BG.CInt
+  -> BG.Ptr Thing
+  -> BG.CDouble
+  -> IO BG.CChar
+hs_bindgen_23fac8ee5044da6e =
+  \x0 ->
+    \x1 ->
+      \x2 ->
+        fmap BG.fromFFIType (hs_bindgen_23fac8ee5044da6e_base (BG.toFFIType x0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+{-| __C declaration:__ @thing_fun_3b@
+
+    __defined at:__ @types\/structs\/struct_arg.h 10:6@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3b ::
+     BG.CInt
+     -- ^ __C declaration:__ @x@
+  -> Thing
+     -- ^ __C declaration:__ @y@
+  -> BG.CDouble
+     -- ^ __C declaration:__ @z@
+  -> IO BG.CChar
+thing_fun_3b =
+  \x0 ->
+    \y1 ->
+      \z2 ->
+        BG.with y1 (\y3 ->
+                      hs_bindgen_23fac8ee5044da6e x0 y3 z2)
diff --git a/test-artefacts/fixtures/types/structs/struct_arg/bindingspec.yaml b/test-artefacts/fixtures/types/structs/struct_arg/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/struct_arg/bindingspec.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/struct_arg.h
+  cname: struct thing
+  hsname: Thing
+hstypes:
+- hsname: Thing
+  representation:
+    record:
+      constructor: Thing
+      fields:
+      - thing_x
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/struct_arg/th.txt b/test-artefacts/fixtures/types/structs/struct_arg/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/struct_arg/th.txt
@@ -0,0 +1,415 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/struct_arg.h
+-- #include <types/structs/struct_arg.h>
+-- signed int hs_bindgen_4ad25504590fdd2b (
+--   struct thing *arg1
+-- )
+-- {
+--   return (thing_fun_1)(*arg1);
+-- }
+-- void hs_bindgen_04a435522bf64978 (
+--   signed int arg1,
+--   struct thing *arg2
+-- )
+-- {
+--   *arg2 = (thing_fun_2)(arg1);
+-- }
+-- void hs_bindgen_5e3271324df7ced2 (
+--   signed int arg1,
+--   struct thing *arg2,
+--   double arg3,
+--   struct thing *arg4
+-- )
+-- {
+--   *arg4 = (thing_fun_3a)(arg1, *arg2, arg3);
+-- }
+-- char hs_bindgen_3525c7d1c72f2fae (
+--   signed int arg1,
+--   struct thing *arg2,
+--   double arg3
+-- )
+-- {
+--   return (thing_fun_3b)(arg1, *arg2, arg3);
+-- }
+-- signed int hs_bindgen_0bdddf60550fc97b (
+--   struct thing *arg1
+-- )
+-- {
+--   return (thing_fun_1)(*arg1);
+-- }
+-- void hs_bindgen_c293d866e22be6fc (
+--   signed int arg1,
+--   struct thing *arg2
+-- )
+-- {
+--   *arg2 = (thing_fun_2)(arg1);
+-- }
+-- void hs_bindgen_cfd51a9e490a997c (
+--   signed int arg1,
+--   struct thing *arg2,
+--   double arg3,
+--   struct thing *arg4
+-- )
+-- {
+--   *arg4 = (thing_fun_3a)(arg1, *arg2, arg3);
+-- }
+-- char hs_bindgen_23fac8ee5044da6e (
+--   signed int arg1,
+--   struct thing *arg2,
+--   double arg3
+-- )
+-- {
+--   return (thing_fun_3b)(arg1, *arg2, arg3);
+-- }
+-- /* test_typesstructsstruct_arg_Example_get_thing_fun_1 */
+-- __attribute__ ((const))
+-- signed int (*hs_bindgen_17a14e7ffaa1e2e5 (void)) (
+--   struct thing arg1
+-- )
+-- {
+--   return &thing_fun_1;
+-- }
+-- /* test_typesstructsstruct_arg_Example_get_thing_fun_2 */
+-- __attribute__ ((const))
+-- struct thing (*hs_bindgen_91748ffd57eae163 (void)) (
+--   signed int arg1
+-- )
+-- {
+--   return &thing_fun_2;
+-- }
+-- /* test_typesstructsstruct_arg_Example_get_thing_fun_3a */
+-- __attribute__ ((const))
+-- struct thing (*hs_bindgen_84d98a03314ff518 (void)) (
+--   signed int arg1,
+--   struct thing arg2,
+--   double arg3
+-- )
+-- {
+--   return &thing_fun_3a;
+-- }
+-- /* test_typesstructsstruct_arg_Example_get_thing_fun_3b */
+-- __attribute__ ((const))
+-- char (*hs_bindgen_855ae9088b15005e (void)) (
+--   signed int arg1,
+--   struct thing arg2,
+--   double arg3
+-- )
+-- {
+--   return &thing_fun_3b;
+-- }
+{-| __C declaration:__ @struct thing@
+
+    __defined at:__ @types\/structs\/struct_arg.h 2:8@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+data Thing
+    = Thing {thing_x :: CInt
+             {- ^ __C declaration:__ @x@
+
+                  __defined at:__ @types\/structs\/struct_arg.h 3:9@
+
+                  __exported by:__ @types\/structs\/struct_arg.h@
+             -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Thing
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Thing
+    where readRaw = \ptr_0 -> pure Thing <*> readRaw (Proxy @"thing_x") ptr_0
+instance WriteRaw Thing
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Thing thing_x_2 -> writeRaw (Proxy @"thing_x") ptr_0 thing_x_2
+deriving via (EquivStorable Thing) instance Storable Thing
+deriving via (IsStructViaReadRaw Thing) instance IsStruct Thing
+instance (~) ty CInt => HasField "thing_x" Thing ty
+    where hasField = \x_0 -> (\y_1 -> Thing{thing_x = y_1},
+                              getField @"thing_x" x_0)
+instance (~) ty CInt => HasField "thing_x" (Ptr Thing) (Ptr ty)
+    where getField = fromPtr (Proxy @"thing_x")
+instance HasCField Thing "thing_x"
+    where type CFieldType Thing "thing_x" = CInt
+          offset# = \_ -> \_ -> 0
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_1@
+foreign import ccall safe "hs_bindgen_4ad25504590fdd2b" hs_bindgen_4ad25504590fdd2b_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_1@
+hs_bindgen_4ad25504590fdd2b :: Ptr Thing -> IO CInt
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_1@
+hs_bindgen_4ad25504590fdd2b = \x_0 -> fmap fromFFIType (hs_bindgen_4ad25504590fdd2b_base (toFFIType x_0))
+{-| __C declaration:__ @thing_fun_1@
+
+    __defined at:__ @types\/structs\/struct_arg.h 6:5@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_1_safe :: Thing -> IO CInt
+{-| __C declaration:__ @thing_fun_1@
+
+    __defined at:__ @types\/structs\/struct_arg.h 6:5@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_1_safe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_4ad25504590fdd2b x_1)
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_2@
+foreign import ccall safe "hs_bindgen_04a435522bf64978" hs_bindgen_04a435522bf64978_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_2@
+hs_bindgen_04a435522bf64978 :: CInt -> Ptr Thing -> IO ()
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_2@
+hs_bindgen_04a435522bf64978 = \x_0 -> \x_1 -> hs_bindgen_04a435522bf64978_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @thing_fun_2@
+
+    __defined at:__ @types\/structs\/struct_arg.h 7:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_2_safe :: CInt -> IO Thing
+{-| __C declaration:__ @thing_fun_2@
+
+    __defined at:__ @types\/structs\/struct_arg.h 7:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_2_safe = \x_0 -> allocaAndPeek (\res_1 -> hs_bindgen_04a435522bf64978 x_0 res_1)
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3a@
+foreign import ccall safe "hs_bindgen_5e3271324df7ced2" hs_bindgen_5e3271324df7ced2_base ::
+    CInt
+ -> Ptr Void
+ -> CDouble
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3a@
+hs_bindgen_5e3271324df7ced2 :: CInt ->
+                               Ptr Thing -> CDouble -> Ptr Thing -> IO ()
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3a@
+hs_bindgen_5e3271324df7ced2 = \x_0 -> \x_1 -> \x_2 -> \x_3 -> hs_bindgen_5e3271324df7ced2_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3)
+{-| __C declaration:__ @thing_fun_3a@
+
+    __defined at:__ @types\/structs\/struct_arg.h 9:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3a_safe :: CInt -> Thing -> CDouble -> IO Thing
+{-| __C declaration:__ @thing_fun_3a@
+
+    __defined at:__ @types\/structs\/struct_arg.h 9:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3a_safe = \x_0 -> \y_1 -> \z_2 -> with y_1 (\y_3 -> allocaAndPeek (\res_4 -> hs_bindgen_5e3271324df7ced2 x_0 y_3 z_2 res_4))
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3b@
+foreign import ccall safe "hs_bindgen_3525c7d1c72f2fae" hs_bindgen_3525c7d1c72f2fae_base ::
+    CInt
+ -> Ptr Void
+ -> CDouble
+ -> IO CChar
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3b@
+hs_bindgen_3525c7d1c72f2fae :: CInt ->
+                               Ptr Thing -> CDouble -> IO CChar
+-- __unique:__ @test_typesstructsstruct_arg_Example_Safe_thing_fun_3b@
+hs_bindgen_3525c7d1c72f2fae = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_3525c7d1c72f2fae_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @thing_fun_3b@
+
+    __defined at:__ @types\/structs\/struct_arg.h 10:6@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3b_safe :: CInt -> Thing -> CDouble -> IO CChar
+{-| __C declaration:__ @thing_fun_3b@
+
+    __defined at:__ @types\/structs\/struct_arg.h 10:6@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3b_safe = \x_0 -> \y_1 -> \z_2 -> with y_1 (\y_3 -> hs_bindgen_3525c7d1c72f2fae x_0 y_3 z_2)
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_1@
+foreign import ccall unsafe "hs_bindgen_0bdddf60550fc97b" hs_bindgen_0bdddf60550fc97b_base ::
+    Ptr Void
+ -> IO CInt
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_1@
+hs_bindgen_0bdddf60550fc97b :: Ptr Thing -> IO CInt
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_1@
+hs_bindgen_0bdddf60550fc97b = \x_0 -> fmap fromFFIType (hs_bindgen_0bdddf60550fc97b_base (toFFIType x_0))
+{-| __C declaration:__ @thing_fun_1@
+
+    __defined at:__ @types\/structs\/struct_arg.h 6:5@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_1_unsafe :: Thing -> IO CInt
+{-| __C declaration:__ @thing_fun_1@
+
+    __defined at:__ @types\/structs\/struct_arg.h 6:5@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_1_unsafe = \x_0 -> with x_0 (\x_1 -> hs_bindgen_0bdddf60550fc97b x_1)
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_2@
+foreign import ccall unsafe "hs_bindgen_c293d866e22be6fc" hs_bindgen_c293d866e22be6fc_base ::
+    CInt
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_2@
+hs_bindgen_c293d866e22be6fc :: CInt -> Ptr Thing -> IO ()
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_2@
+hs_bindgen_c293d866e22be6fc = \x_0 -> \x_1 -> hs_bindgen_c293d866e22be6fc_base (toFFIType x_0) (toFFIType x_1)
+{-| __C declaration:__ @thing_fun_2@
+
+    __defined at:__ @types\/structs\/struct_arg.h 7:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_2_unsafe :: CInt -> IO Thing
+{-| __C declaration:__ @thing_fun_2@
+
+    __defined at:__ @types\/structs\/struct_arg.h 7:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_2_unsafe = \x_0 -> allocaAndPeek (\res_1 -> hs_bindgen_c293d866e22be6fc x_0 res_1)
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3a@
+foreign import ccall unsafe "hs_bindgen_cfd51a9e490a997c" hs_bindgen_cfd51a9e490a997c_base ::
+    CInt
+ -> Ptr Void
+ -> CDouble
+ -> Ptr Void
+ -> IO ()
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3a@
+hs_bindgen_cfd51a9e490a997c :: CInt ->
+                               Ptr Thing -> CDouble -> Ptr Thing -> IO ()
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3a@
+hs_bindgen_cfd51a9e490a997c = \x_0 -> \x_1 -> \x_2 -> \x_3 -> hs_bindgen_cfd51a9e490a997c_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2) (toFFIType x_3)
+{-| __C declaration:__ @thing_fun_3a@
+
+    __defined at:__ @types\/structs\/struct_arg.h 9:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3a_unsafe :: CInt -> Thing -> CDouble -> IO Thing
+{-| __C declaration:__ @thing_fun_3a@
+
+    __defined at:__ @types\/structs\/struct_arg.h 9:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3a_unsafe = \x_0 -> \y_1 -> \z_2 -> with y_1 (\y_3 -> allocaAndPeek (\res_4 -> hs_bindgen_cfd51a9e490a997c x_0 y_3 z_2 res_4))
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3b@
+foreign import ccall unsafe "hs_bindgen_23fac8ee5044da6e" hs_bindgen_23fac8ee5044da6e_base ::
+    CInt
+ -> Ptr Void
+ -> CDouble
+ -> IO CChar
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3b@
+hs_bindgen_23fac8ee5044da6e :: CInt ->
+                               Ptr Thing -> CDouble -> IO CChar
+-- __unique:__ @test_typesstructsstruct_arg_Example_Unsafe_thing_fun_3b@
+hs_bindgen_23fac8ee5044da6e = \x_0 -> \x_1 -> \x_2 -> fmap fromFFIType (hs_bindgen_23fac8ee5044da6e_base (toFFIType x_0) (toFFIType x_1) (toFFIType x_2))
+{-| __C declaration:__ @thing_fun_3b@
+
+    __defined at:__ @types\/structs\/struct_arg.h 10:6@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3b_unsafe :: CInt -> Thing -> CDouble -> IO CChar
+{-| __C declaration:__ @thing_fun_3b@
+
+    __defined at:__ @types\/structs\/struct_arg.h 10:6@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3b_unsafe = \x_0 -> \y_1 -> \z_2 -> with y_1 (\y_3 -> hs_bindgen_23fac8ee5044da6e x_0 y_3 z_2)
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_1@
+foreign import ccall unsafe "hs_bindgen_17a14e7ffaa1e2e5" hs_bindgen_17a14e7ffaa1e2e5_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_1@
+hs_bindgen_17a14e7ffaa1e2e5 :: IO (FunPtr (Thing -> IO CInt))
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_1@
+hs_bindgen_17a14e7ffaa1e2e5 = fmap fromFFIType hs_bindgen_17a14e7ffaa1e2e5_base
+{-# NOINLINE thing_fun_1_funptr #-}
+{-| __C declaration:__ @thing_fun_1@
+
+    __defined at:__ @types\/structs\/struct_arg.h 6:5@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_1_funptr :: FunPtr (Thing -> IO CInt)
+{-| __C declaration:__ @thing_fun_1@
+
+    __defined at:__ @types\/structs\/struct_arg.h 6:5@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_1_funptr = unsafePerformIO hs_bindgen_17a14e7ffaa1e2e5
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_2@
+foreign import ccall unsafe "hs_bindgen_91748ffd57eae163" hs_bindgen_91748ffd57eae163_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_2@
+hs_bindgen_91748ffd57eae163 :: IO (FunPtr (CInt -> IO Thing))
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_2@
+hs_bindgen_91748ffd57eae163 = fmap fromFFIType hs_bindgen_91748ffd57eae163_base
+{-# NOINLINE thing_fun_2_funptr #-}
+{-| __C declaration:__ @thing_fun_2@
+
+    __defined at:__ @types\/structs\/struct_arg.h 7:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_2_funptr :: FunPtr (CInt -> IO Thing)
+{-| __C declaration:__ @thing_fun_2@
+
+    __defined at:__ @types\/structs\/struct_arg.h 7:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_2_funptr = unsafePerformIO hs_bindgen_91748ffd57eae163
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3a@
+foreign import ccall unsafe "hs_bindgen_84d98a03314ff518" hs_bindgen_84d98a03314ff518_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3a@
+hs_bindgen_84d98a03314ff518 :: IO (FunPtr (CInt ->
+                                           Thing -> CDouble -> IO Thing))
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3a@
+hs_bindgen_84d98a03314ff518 = fmap fromFFIType hs_bindgen_84d98a03314ff518_base
+{-# NOINLINE thing_fun_3a_funptr #-}
+{-| __C declaration:__ @thing_fun_3a@
+
+    __defined at:__ @types\/structs\/struct_arg.h 9:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3a_funptr :: FunPtr (CInt ->
+                               Thing -> CDouble -> IO Thing)
+{-| __C declaration:__ @thing_fun_3a@
+
+    __defined at:__ @types\/structs\/struct_arg.h 9:14@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3a_funptr = unsafePerformIO hs_bindgen_84d98a03314ff518
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3b@
+foreign import ccall unsafe "hs_bindgen_855ae9088b15005e" hs_bindgen_855ae9088b15005e_base ::
+    IO (FunPtr Void)
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3b@
+hs_bindgen_855ae9088b15005e :: IO (FunPtr (CInt ->
+                                           Thing -> CDouble -> IO CChar))
+-- __unique:__ @test_typesstructsstruct_arg_Example_get_thing_fun_3b@
+hs_bindgen_855ae9088b15005e = fmap fromFFIType hs_bindgen_855ae9088b15005e_base
+{-# NOINLINE thing_fun_3b_funptr #-}
+{-| __C declaration:__ @thing_fun_3b@
+
+    __defined at:__ @types\/structs\/struct_arg.h 10:6@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3b_funptr :: FunPtr (CInt ->
+                               Thing -> CDouble -> IO CChar)
+{-| __C declaration:__ @thing_fun_3b@
+
+    __defined at:__ @types\/structs\/struct_arg.h 10:6@
+
+    __exported by:__ @types\/structs\/struct_arg.h@
+-}
+thing_fun_3b_funptr = unsafePerformIO hs_bindgen_855ae9088b15005e
diff --git a/test-artefacts/fixtures/types/structs/tagged_vs_untagged/Example.hs b/test-artefacts/fixtures/types/structs/tagged_vs_untagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/tagged_vs_untagged/Example.hs
@@ -0,0 +1,542 @@
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+
+module Example
+    ( Example.A(..)
+    , Example.Struct1(..)
+    , Example.B_s(..)
+    , Example.Struct2_s(..)
+    , Example.C(..)
+    , Example.Struct3(..)
+    , Example.D(..)
+    , Example.Struct4(..)
+    , Example.E_s(..)
+    , Example.Struct5_s(..)
+    , Example.F(..)
+    , Example.Typedef1(..)
+    , Example.G(..)
+    , Example.Typedef2(..)
+    , Example.H(..)
+    , Example.Typedef3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import Prelude (Eq, Int, Show, pure)
+
+{-| __C declaration:__ @struct a@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 15:8@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data A = A
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize A where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw A where
+
+  readRaw = \ptr0 -> pure A
+
+instance Marshal.WriteRaw A where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          A -> pure ()
+
+deriving via Marshal.EquivStorable A instance BG.Storable A
+
+deriving via Struct.IsStructViaReadRaw A instance Struct.IsStruct A
+
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 16:8@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct1 = Struct1
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct1 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct1 where
+
+  readRaw = \ptr0 -> pure Struct1
+
+instance Marshal.WriteRaw Struct1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct1 -> pure ()
+
+deriving via Marshal.EquivStorable Struct1 instance BG.Storable Struct1
+
+deriving via Struct.IsStructViaReadRaw Struct1 instance Struct.IsStruct Struct1
+
+{-| __C declaration:__ @struct b_s@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 19:8@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data B_s = B_s
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize B_s where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw B_s where
+
+  readRaw = \ptr0 -> pure B_s
+
+instance Marshal.WriteRaw B_s where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          B_s -> pure ()
+
+deriving via Marshal.EquivStorable B_s instance BG.Storable B_s
+
+deriving via Struct.IsStructViaReadRaw B_s instance Struct.IsStruct B_s
+
+{-| __C declaration:__ @struct struct2_s@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 20:8@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct2_s = Struct2_s
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct2_s where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct2_s where
+
+  readRaw = \ptr0 -> pure Struct2_s
+
+instance Marshal.WriteRaw Struct2_s where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct2_s -> pure ()
+
+deriving via Marshal.EquivStorable Struct2_s instance BG.Storable Struct2_s
+
+deriving via Struct.IsStructViaReadRaw Struct2_s instance Struct.IsStruct Struct2_s
+
+{-| __C declaration:__ @struct c@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 23:36@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data C = C
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize C where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw C where
+
+  readRaw = \ptr0 -> pure C
+
+instance Marshal.WriteRaw C where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          C -> pure ()
+
+deriving via Marshal.EquivStorable C instance BG.Storable C
+
+deriving via Struct.IsStructViaReadRaw C instance Struct.IsStruct C
+
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 24:36@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct3 = Struct3
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct3 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct3 where
+
+  readRaw = \ptr0 -> pure Struct3
+
+instance Marshal.WriteRaw Struct3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct3 -> pure ()
+
+deriving via Marshal.EquivStorable Struct3 instance BG.Storable Struct3
+
+deriving via Struct.IsStructViaReadRaw Struct3 instance Struct.IsStruct Struct3
+
+{-| __C declaration:__ @struct d@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 27:15@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data D = D
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize D where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw D where
+
+  readRaw = \ptr0 -> pure D
+
+instance Marshal.WriteRaw D where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          D -> pure ()
+
+deriving via Marshal.EquivStorable D instance BG.Storable D
+
+deriving via Struct.IsStructViaReadRaw D instance Struct.IsStruct D
+
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 28:15@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct4 = Struct4
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct4 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct4 where
+
+  readRaw = \ptr0 -> pure Struct4
+
+instance Marshal.WriteRaw Struct4 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct4 -> pure ()
+
+deriving via Marshal.EquivStorable Struct4 instance BG.Storable Struct4
+
+deriving via Struct.IsStructViaReadRaw Struct4 instance Struct.IsStruct Struct4
+
+{-| __C declaration:__ @struct e_s@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 31:15@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data E_s = E_s
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize E_s where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw E_s where
+
+  readRaw = \ptr0 -> pure E_s
+
+instance Marshal.WriteRaw E_s where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          E_s -> pure ()
+
+deriving via Marshal.EquivStorable E_s instance BG.Storable E_s
+
+deriving via Struct.IsStructViaReadRaw E_s instance Struct.IsStruct E_s
+
+{-| __C declaration:__ @struct struct5_s@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 32:15@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct5_s = Struct5_s
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Struct5_s where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Struct5_s where
+
+  readRaw = \ptr0 -> pure Struct5_s
+
+instance Marshal.WriteRaw Struct5_s where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Struct5_s -> pure ()
+
+deriving via Marshal.EquivStorable Struct5_s instance BG.Storable Struct5_s
+
+deriving via Struct.IsStructViaReadRaw Struct5_s instance Struct.IsStruct Struct5_s
+
+{-| __C declaration:__ @struct f@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 35:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data F = F
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize F where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw F where
+
+  readRaw = \ptr0 -> pure F
+
+instance Marshal.WriteRaw F where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          F -> pure ()
+
+deriving via Marshal.EquivStorable F instance BG.Storable F
+
+deriving via Struct.IsStructViaReadRaw F instance Struct.IsStruct F
+
+{-| __C declaration:__ @struct typedef1@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 36:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Typedef1 = Typedef1
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Typedef1 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Typedef1 where
+
+  readRaw = \ptr0 -> pure Typedef1
+
+instance Marshal.WriteRaw Typedef1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Typedef1 -> pure ()
+
+deriving via Marshal.EquivStorable Typedef1 instance BG.Storable Typedef1
+
+deriving via Struct.IsStructViaReadRaw Typedef1 instance Struct.IsStruct Typedef1
+
+{-| __C declaration:__ @struct g@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 39:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data G = G
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize G where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw G where
+
+  readRaw = \ptr0 -> pure G
+
+instance Marshal.WriteRaw G where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          G -> pure ()
+
+deriving via Marshal.EquivStorable G instance BG.Storable G
+
+deriving via Struct.IsStructViaReadRaw G instance Struct.IsStruct G
+
+{-| __C declaration:__ @struct typedef2@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 40:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Typedef2 = Typedef2
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Typedef2 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Typedef2 where
+
+  readRaw = \ptr0 -> pure Typedef2
+
+instance Marshal.WriteRaw Typedef2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Typedef2 -> pure ()
+
+deriving via Marshal.EquivStorable Typedef2 instance BG.Storable Typedef2
+
+deriving via Struct.IsStructViaReadRaw Typedef2 instance Struct.IsStruct Typedef2
+
+{-| __C declaration:__ @struct h@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 43:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data H = H
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize H where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw H where
+
+  readRaw = \ptr0 -> pure H
+
+instance Marshal.WriteRaw H where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          H -> pure ()
+
+deriving via Marshal.EquivStorable H instance BG.Storable H
+
+deriving via Struct.IsStructViaReadRaw H instance Struct.IsStruct H
+
+{-| __C declaration:__ @struct typedef3@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 44:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Typedef3 = Typedef3
+  {}
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Typedef3 where
+
+  staticSizeOf = \_ -> (0 :: Int)
+
+  staticAlignment = \_ -> (1 :: Int)
+
+instance Marshal.ReadRaw Typedef3 where
+
+  readRaw = \ptr0 -> pure Typedef3
+
+instance Marshal.WriteRaw Typedef3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Typedef3 -> pure ()
+
+deriving via Marshal.EquivStorable Typedef3 instance BG.Storable Typedef3
+
+deriving via Struct.IsStructViaReadRaw Typedef3 instance Struct.IsStruct Typedef3
diff --git a/test-artefacts/fixtures/types/structs/tagged_vs_untagged/bindingspec.yaml b/test-artefacts/fixtures/types/structs/tagged_vs_untagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/tagged_vs_untagged/bindingspec.yaml
@@ -0,0 +1,296 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct a
+  hsname: A
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct struct1
+  hsname: Struct1
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct b_s
+  hsname: B_s
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct struct2_s
+  hsname: Struct2_s
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct c
+  hsname: C
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct struct3
+  hsname: Struct3
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct d
+  hsname: D
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct struct4
+  hsname: Struct4
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct e_s
+  hsname: E_s
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct struct5_s
+  hsname: Struct5_s
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct f
+  hsname: F
+- headers: types/structs/tagged_vs_untagged.h
+  cname: f
+  hsname: F
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct typedef1
+  hsname: Typedef1
+- headers: types/structs/tagged_vs_untagged.h
+  cname: typedef1
+  hsname: Typedef1
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct g
+  hsname: G
+- headers: types/structs/tagged_vs_untagged.h
+  cname: g
+  hsname: G
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct typedef2
+  hsname: Typedef2
+- headers: types/structs/tagged_vs_untagged.h
+  cname: typedef2
+  hsname: Typedef2
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct h
+  hsname: H
+- headers: types/structs/tagged_vs_untagged.h
+  cname: h
+  hsname: H
+- headers: types/structs/tagged_vs_untagged.h
+  cname: struct typedef3
+  hsname: Typedef3
+- headers: types/structs/tagged_vs_untagged.h
+  cname: typedef3
+  hsname: Typedef3
+hstypes:
+- hsname: A
+  representation:
+    record:
+      constructor: A
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: B_s
+  representation:
+    record:
+      constructor: B_s
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: C
+  representation:
+    record:
+      constructor: C
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: D
+  representation:
+    record:
+      constructor: D
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: E_s
+  representation:
+    record:
+      constructor: E_s
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: F
+  representation:
+    record:
+      constructor: F
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G
+  representation:
+    record:
+      constructor: G
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: H
+  representation:
+    record:
+      constructor: H
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct1
+  representation:
+    record:
+      constructor: Struct1
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct2_s
+  representation:
+    record:
+      constructor: Struct2_s
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct3
+  representation:
+    record:
+      constructor: Struct3
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct4
+  representation:
+    record:
+      constructor: Struct4
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Struct5_s
+  representation:
+    record:
+      constructor: Struct5_s
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef1
+  representation:
+    record:
+      constructor: Typedef1
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef2
+  representation:
+    record:
+      constructor: Typedef2
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Typedef3
+  representation:
+    record:
+      constructor: Typedef3
+      fields: []
+  instances:
+  - Eq
+  - Generic
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/tagged_vs_untagged/th.txt b/test-artefacts/fixtures/types/structs/tagged_vs_untagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/tagged_vs_untagged/th.txt
@@ -0,0 +1,273 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/tagged_vs_untagged.h
+{-| __C declaration:__ @struct a@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 15:8@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data A = A {} deriving stock (Eq, Generic, Show)
+instance StaticSize A
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw A
+    where readRaw = \ptr_0 -> pure A
+instance WriteRaw A
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       A -> pure ()
+deriving via (EquivStorable A) instance Storable A
+deriving via (IsStructViaReadRaw A) instance IsStruct A
+{-| __C declaration:__ @struct struct1@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 16:8@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct1 = Struct1 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct1
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct1
+    where readRaw = \ptr_0 -> pure Struct1
+instance WriteRaw Struct1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct1 -> pure ()
+deriving via (EquivStorable Struct1) instance Storable Struct1
+deriving via (IsStructViaReadRaw Struct1) instance IsStruct Struct1
+{-| __C declaration:__ @struct b_s@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 19:8@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data B_s = B_s {} deriving stock (Eq, Generic, Show)
+instance StaticSize B_s
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw B_s
+    where readRaw = \ptr_0 -> pure B_s
+instance WriteRaw B_s
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       B_s -> pure ()
+deriving via (EquivStorable B_s) instance Storable B_s
+deriving via (IsStructViaReadRaw B_s) instance IsStruct B_s
+{-| __C declaration:__ @struct struct2_s@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 20:8@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct2_s = Struct2_s {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct2_s
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct2_s
+    where readRaw = \ptr_0 -> pure Struct2_s
+instance WriteRaw Struct2_s
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct2_s -> pure ()
+deriving via (EquivStorable Struct2_s) instance Storable Struct2_s
+deriving via (IsStructViaReadRaw Struct2_s) instance IsStruct Struct2_s
+{-| __C declaration:__ @struct c@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 23:36@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data C = C {} deriving stock (Eq, Generic, Show)
+instance StaticSize C
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw C
+    where readRaw = \ptr_0 -> pure C
+instance WriteRaw C
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       C -> pure ()
+deriving via (EquivStorable C) instance Storable C
+deriving via (IsStructViaReadRaw C) instance IsStruct C
+{-| __C declaration:__ @struct struct3@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 24:36@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct3 = Struct3 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct3
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct3
+    where readRaw = \ptr_0 -> pure Struct3
+instance WriteRaw Struct3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct3 -> pure ()
+deriving via (EquivStorable Struct3) instance Storable Struct3
+deriving via (IsStructViaReadRaw Struct3) instance IsStruct Struct3
+{-| __C declaration:__ @struct d@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 27:15@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data D = D {} deriving stock (Eq, Generic, Show)
+instance StaticSize D
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw D
+    where readRaw = \ptr_0 -> pure D
+instance WriteRaw D
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       D -> pure ()
+deriving via (EquivStorable D) instance Storable D
+deriving via (IsStructViaReadRaw D) instance IsStruct D
+{-| __C declaration:__ @struct struct4@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 28:15@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct4 = Struct4 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct4
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct4
+    where readRaw = \ptr_0 -> pure Struct4
+instance WriteRaw Struct4
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct4 -> pure ()
+deriving via (EquivStorable Struct4) instance Storable Struct4
+deriving via (IsStructViaReadRaw Struct4) instance IsStruct Struct4
+{-| __C declaration:__ @struct e_s@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 31:15@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data E_s = E_s {} deriving stock (Eq, Generic, Show)
+instance StaticSize E_s
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw E_s
+    where readRaw = \ptr_0 -> pure E_s
+instance WriteRaw E_s
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       E_s -> pure ()
+deriving via (EquivStorable E_s) instance Storable E_s
+deriving via (IsStructViaReadRaw E_s) instance IsStruct E_s
+{-| __C declaration:__ @struct struct5_s@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 32:15@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Struct5_s = Struct5_s {} deriving stock (Eq, Generic, Show)
+instance StaticSize Struct5_s
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Struct5_s
+    where readRaw = \ptr_0 -> pure Struct5_s
+instance WriteRaw Struct5_s
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Struct5_s -> pure ()
+deriving via (EquivStorable Struct5_s) instance Storable Struct5_s
+deriving via (IsStructViaReadRaw Struct5_s) instance IsStruct Struct5_s
+{-| __C declaration:__ @struct f@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 35:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data F = F {} deriving stock (Eq, Generic, Show)
+instance StaticSize F
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw F
+    where readRaw = \ptr_0 -> pure F
+instance WriteRaw F
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       F -> pure ()
+deriving via (EquivStorable F) instance Storable F
+deriving via (IsStructViaReadRaw F) instance IsStruct F
+{-| __C declaration:__ @struct typedef1@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 36:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Typedef1 = Typedef1 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Typedef1
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Typedef1
+    where readRaw = \ptr_0 -> pure Typedef1
+instance WriteRaw Typedef1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Typedef1 -> pure ()
+deriving via (EquivStorable Typedef1) instance Storable Typedef1
+deriving via (IsStructViaReadRaw Typedef1) instance IsStruct Typedef1
+{-| __C declaration:__ @struct g@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 39:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data G = G {} deriving stock (Eq, Generic, Show)
+instance StaticSize G
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw G
+    where readRaw = \ptr_0 -> pure G
+instance WriteRaw G
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       G -> pure ()
+deriving via (EquivStorable G) instance Storable G
+deriving via (IsStructViaReadRaw G) instance IsStruct G
+{-| __C declaration:__ @struct typedef2@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 40:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Typedef2 = Typedef2 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Typedef2
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Typedef2
+    where readRaw = \ptr_0 -> pure Typedef2
+instance WriteRaw Typedef2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Typedef2 -> pure ()
+deriving via (EquivStorable Typedef2) instance Storable Typedef2
+deriving via (IsStructViaReadRaw Typedef2) instance IsStruct Typedef2
+{-| __C declaration:__ @struct h@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 43:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data H = H {} deriving stock (Eq, Generic, Show)
+instance StaticSize H
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw H
+    where readRaw = \ptr_0 -> pure H
+instance WriteRaw H
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       H -> pure ()
+deriving via (EquivStorable H) instance Storable H
+deriving via (IsStructViaReadRaw H) instance IsStruct H
+{-| __C declaration:__ @struct typedef3@
+
+    __defined at:__ @types\/structs\/tagged_vs_untagged.h 44:9@
+
+    __exported by:__ @types\/structs\/tagged_vs_untagged.h@
+-}
+data Typedef3 = Typedef3 {} deriving stock (Eq, Generic, Show)
+instance StaticSize Typedef3
+    where staticSizeOf = \_ -> 0 :: Int
+          staticAlignment = \_ -> 1 :: Int
+instance ReadRaw Typedef3
+    where readRaw = \ptr_0 -> pure Typedef3
+instance WriteRaw Typedef3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Typedef3 -> pure ()
+deriving via (EquivStorable Typedef3) instance Storable Typedef3
+deriving via (IsStructViaReadRaw Typedef3) instance IsStruct Typedef3
diff --git a/test-artefacts/fixtures/types/structs/untagged/Example.hs b/test-artefacts/fixtures/types/structs/untagged/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/untagged/Example.hs
@@ -0,0 +1,723 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.S1_c(..)
+    , Example.S1(..)
+    , Example.S2_inner_deep(..)
+    , Example.S2_inner(..)
+    , Example.S2(..)
+    , Example.S3(..)
+    , Example.S3_c(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct \@S1_c@
+
+    __defined at:__ @types\/structs\/untagged.h 3:3@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S1_c = S1_c
+  { s1_c_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/untagged.h 4:9@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  , s1_c_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/untagged.h 5:9@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S1_c where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S1_c where
+
+  readRaw =
+    \ptr0 ->
+          pure S1_c
+      <*> HasCField.readRaw (BG.Proxy @"s1_c_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s1_c_b") ptr0
+
+instance Marshal.WriteRaw S1_c where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S1_c s1_c_a2 s1_c_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s1_c_a") ptr0 s1_c_a2
+            >> HasCField.writeRaw (BG.Proxy @"s1_c_b") ptr0 s1_c_b3
+
+deriving via Marshal.EquivStorable S1_c instance BG.Storable S1_c
+
+deriving via Struct.IsStructViaReadRaw S1_c instance Struct.IsStruct S1_c
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/untagged.h 4:9@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s1_c_a" S1_c ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1_c {s1_c_a = y1, s1_c_b = BG.getField @"s1_c_b" x0}
+      , BG.getField @"s1_c_a" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s1_c_a" (BG.Ptr S1_c) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_c_a")
+
+instance HasCField.HasCField S1_c "s1_c_a" where
+
+  type CFieldType S1_c "s1_c_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/untagged.h 5:9@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s1_c_b" S1_c ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1_c {s1_c_b = y1, s1_c_a = BG.getField @"s1_c_a" x0}
+      , BG.getField @"s1_c_b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s1_c_b" (BG.Ptr S1_c) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_c_b")
+
+instance HasCField.HasCField S1_c "s1_c_b" where
+
+  type CFieldType S1_c "s1_c_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/structs\/untagged.h 2:8@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S1 = S1
+  { s1_c :: S1_c
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/untagged.h 6:5@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  , s1_d :: BG.CInt
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @types\/structs\/untagged.h 8:7@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S1 where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S1 where
+
+  readRaw =
+    \ptr0 ->
+          pure S1
+      <*> HasCField.readRaw (BG.Proxy @"s1_c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s1_d") ptr0
+
+instance Marshal.WriteRaw S1 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S1 s1_c2 s1_d3 ->
+               HasCField.writeRaw (BG.Proxy @"s1_c") ptr0 s1_c2
+            >> HasCField.writeRaw (BG.Proxy @"s1_d") ptr0 s1_d3
+
+deriving via Marshal.EquivStorable S1 instance BG.Storable S1
+
+deriving via Struct.IsStructViaReadRaw S1 instance Struct.IsStruct S1
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/untagged.h 6:5@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance (ty ~ S1_c) => BG.CompatHasField.HasField "s1_c" S1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1 {s1_c = y1, s1_d = BG.getField @"s1_d" x0}
+      , BG.getField @"s1_c" x0
+      )
+
+instance (ty ~ S1_c) => BG.HasField "s1_c" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_c")
+
+instance HasCField.HasCField S1 "s1_c" where
+
+  type CFieldType S1 "s1_c" = S1_c
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/structs\/untagged.h 8:7@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s1_d" S1 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S1 {s1_d = y1, s1_c = BG.getField @"s1_c" x0}
+      , BG.getField @"s1_d" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s1_d" (BG.Ptr S1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s1_d")
+
+instance HasCField.HasCField S1 "s1_d" where
+
+  type CFieldType S1 "s1_d" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct \@S2_inner_deep@
+
+    __defined at:__ @types\/structs\/untagged.h 15:5@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S2_inner_deep = S2_inner_deep
+  { s2_inner_deep_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/untagged.h 16:11@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2_inner_deep where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S2_inner_deep where
+
+  readRaw =
+    \ptr0 ->
+          pure S2_inner_deep
+      <*> HasCField.readRaw (BG.Proxy @"s2_inner_deep_b") ptr0
+
+instance Marshal.WriteRaw S2_inner_deep where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2_inner_deep s2_inner_deep_b2 ->
+            HasCField.writeRaw (BG.Proxy @"s2_inner_deep_b") ptr0 s2_inner_deep_b2
+
+deriving via Marshal.EquivStorable S2_inner_deep instance BG.Storable S2_inner_deep
+
+deriving via Struct.IsStructViaReadRaw S2_inner_deep instance Struct.IsStruct S2_inner_deep
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/untagged.h 16:11@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s2_inner_deep_b" S2_inner_deep ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 -> S2_inner_deep {s2_inner_deep_b = y1}
+      , BG.getField @"s2_inner_deep_b" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s2_inner_deep_b" (BG.Ptr S2_inner_deep) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s2_inner_deep_b")
+
+instance HasCField.HasCField S2_inner_deep "s2_inner_deep_b" where
+
+  type CFieldType S2_inner_deep "s2_inner_deep_b" =
+    BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct \@S2_inner@
+
+    __defined at:__ @types\/structs\/untagged.h 13:3@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S2_inner = S2_inner
+  { s2_inner_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/untagged.h 14:9@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  , s2_inner_deep :: S2_inner_deep
+    {- ^ __C declaration:__ @deep@
+
+         __defined at:__ @types\/structs\/untagged.h 17:7@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2_inner where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S2_inner where
+
+  readRaw =
+    \ptr0 ->
+          pure S2_inner
+      <*> HasCField.readRaw (BG.Proxy @"s2_inner_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s2_inner_deep") ptr0
+
+instance Marshal.WriteRaw S2_inner where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2_inner s2_inner_a2 s2_inner_deep3 ->
+               HasCField.writeRaw (BG.Proxy @"s2_inner_a") ptr0 s2_inner_a2
+            >> HasCField.writeRaw (BG.Proxy @"s2_inner_deep") ptr0 s2_inner_deep3
+
+deriving via Marshal.EquivStorable S2_inner instance BG.Storable S2_inner
+
+deriving via Struct.IsStructViaReadRaw S2_inner instance Struct.IsStruct S2_inner
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/untagged.h 14:9@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "s2_inner_a" S2_inner ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_inner {s2_inner_a = y1, s2_inner_deep = BG.getField @"s2_inner_deep" x0}
+      , BG.getField @"s2_inner_a" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "s2_inner_a" (BG.Ptr S2_inner) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_inner_a")
+
+instance HasCField.HasCField S2_inner "s2_inner_a" where
+
+  type CFieldType S2_inner "s2_inner_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @deep@
+
+    __defined at:__ @types\/structs\/untagged.h 17:7@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance ( ty ~ S2_inner_deep
+         ) => BG.CompatHasField.HasField "s2_inner_deep" S2_inner ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2_inner {s2_inner_deep = y1, s2_inner_a = BG.getField @"s2_inner_a" x0}
+      , BG.getField @"s2_inner_deep" x0
+      )
+
+instance ( ty ~ S2_inner_deep
+         ) => BG.HasField "s2_inner_deep" (BG.Ptr S2_inner) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"s2_inner_deep")
+
+instance HasCField.HasCField S2_inner "s2_inner_deep" where
+
+  type CFieldType S2_inner "s2_inner_deep" =
+    S2_inner_deep
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/structs\/untagged.h 12:8@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S2 = S2
+  { s2_inner :: S2_inner
+    {- ^ __C declaration:__ @inner@
+
+         __defined at:__ @types\/structs\/untagged.h 18:5@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  , s2_d :: BG.CInt
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @types\/structs\/untagged.h 20:7@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S2 where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S2 where
+
+  readRaw =
+    \ptr0 ->
+          pure S2
+      <*> HasCField.readRaw (BG.Proxy @"s2_inner") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s2_d") ptr0
+
+instance Marshal.WriteRaw S2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S2 s2_inner2 s2_d3 ->
+               HasCField.writeRaw (BG.Proxy @"s2_inner") ptr0 s2_inner2
+            >> HasCField.writeRaw (BG.Proxy @"s2_d") ptr0 s2_d3
+
+deriving via Marshal.EquivStorable S2 instance BG.Storable S2
+
+deriving via Struct.IsStructViaReadRaw S2 instance Struct.IsStruct S2
+
+{-| __C declaration:__ @inner@
+
+    __defined at:__ @types\/structs\/untagged.h 18:5@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance (ty ~ S2_inner) => BG.CompatHasField.HasField "s2_inner" S2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2 {s2_inner = y1, s2_d = BG.getField @"s2_d" x0}
+      , BG.getField @"s2_inner" x0
+      )
+
+instance (ty ~ S2_inner) => BG.HasField "s2_inner" (BG.Ptr S2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_inner")
+
+instance HasCField.HasCField S2 "s2_inner" where
+
+  type CFieldType S2 "s2_inner" = S2_inner
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/structs\/untagged.h 20:7@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s2_d" S2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S2 {s2_d = y1, s2_inner = BG.getField @"s2_inner" x0}
+      , BG.getField @"s2_d" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s2_d" (BG.Ptr S2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s2_d")
+
+instance HasCField.HasCField S2 "s2_d" where
+
+  type CFieldType S2 "s2_d" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct S3@
+
+    __defined at:__ @types\/structs\/untagged.h 24:8@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S3 = S3
+  { s3_c :: BG.Ptr (BG.Ptr S3_c)
+    {- ^ __C declaration:__ @c@
+
+         __defined at:__ @types\/structs\/untagged.h 28:7@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  , s3_d :: BG.CInt
+    {- ^ __C declaration:__ @d@
+
+         __defined at:__ @types\/structs\/untagged.h 30:7@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S3 where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw S3 where
+
+  readRaw =
+    \ptr0 ->
+          pure S3
+      <*> HasCField.readRaw (BG.Proxy @"s3_c") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s3_d") ptr0
+
+instance Marshal.WriteRaw S3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S3 s3_c2 s3_d3 ->
+               HasCField.writeRaw (BG.Proxy @"s3_c") ptr0 s3_c2
+            >> HasCField.writeRaw (BG.Proxy @"s3_d") ptr0 s3_d3
+
+deriving via Marshal.EquivStorable S3 instance BG.Storable S3
+
+deriving via Struct.IsStructViaReadRaw S3 instance Struct.IsStruct S3
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/structs\/untagged.h 28:7@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance ( ty ~ BG.Ptr (BG.Ptr S3_c)
+         ) => BG.CompatHasField.HasField "s3_c" S3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S3 {s3_c = y1, s3_d = BG.getField @"s3_d" x0}
+      , BG.getField @"s3_c" x0
+      )
+
+instance ( ty ~ BG.Ptr (BG.Ptr S3_c)
+         ) => BG.HasField "s3_c" (BG.Ptr S3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s3_c")
+
+instance HasCField.HasCField S3 "s3_c" where
+
+  type CFieldType S3 "s3_c" = BG.Ptr (BG.Ptr S3_c)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/structs\/untagged.h 30:7@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s3_d" S3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S3 {s3_d = y1, s3_c = BG.getField @"s3_c" x0}
+      , BG.getField @"s3_d" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s3_d" (BG.Ptr S3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s3_d")
+
+instance HasCField.HasCField S3 "s3_d" where
+
+  type CFieldType S3 "s3_d" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct \@S3_c@
+
+    __defined at:__ @types\/structs\/untagged.h 25:3@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S3_c = S3_c
+  { s3_c_a :: BG.CInt
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/structs\/untagged.h 26:9@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  , s3_c_b :: BG.CInt
+    {- ^ __C declaration:__ @b@
+
+         __defined at:__ @types\/structs\/untagged.h 27:9@
+
+         __exported by:__ @types\/structs\/untagged.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize S3_c where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw S3_c where
+
+  readRaw =
+    \ptr0 ->
+          pure S3_c
+      <*> HasCField.readRaw (BG.Proxy @"s3_c_a") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"s3_c_b") ptr0
+
+instance Marshal.WriteRaw S3_c where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          S3_c s3_c_a2 s3_c_b3 ->
+               HasCField.writeRaw (BG.Proxy @"s3_c_a") ptr0 s3_c_a2
+            >> HasCField.writeRaw (BG.Proxy @"s3_c_b") ptr0 s3_c_b3
+
+deriving via Marshal.EquivStorable S3_c instance BG.Storable S3_c
+
+deriving via Struct.IsStructViaReadRaw S3_c instance Struct.IsStruct S3_c
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/structs\/untagged.h 26:9@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s3_c_a" S3_c ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S3_c {s3_c_a = y1, s3_c_b = BG.getField @"s3_c_b" x0}
+      , BG.getField @"s3_c_a" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s3_c_a" (BG.Ptr S3_c) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s3_c_a")
+
+instance HasCField.HasCField S3_c "s3_c_a" where
+
+  type CFieldType S3_c "s3_c_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/structs\/untagged.h 27:9@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "s3_c_b" S3_c ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          S3_c {s3_c_b = y1, s3_c_a = BG.getField @"s3_c_a" x0}
+      , BG.getField @"s3_c_b" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "s3_c_b" (BG.Ptr S3_c) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"s3_c_b")
+
+instance HasCField.HasCField S3_c "s3_c_b" where
+
+  type CFieldType S3_c "s3_c_b" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/types/structs/untagged/bindingspec.yaml b/test-artefacts/fixtures/types/structs/untagged/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/untagged/bindingspec.yaml
@@ -0,0 +1,166 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/structs/untagged.h
+  cname: struct S1
+  hsname: S1
+- headers: types/structs/untagged.h
+  cname: struct @S1_c
+  hsname: S1_c
+- headers: types/structs/untagged.h
+  cname: struct S2
+  hsname: S2
+- headers: types/structs/untagged.h
+  cname: struct @S2_inner
+  hsname: S2_inner
+- headers: types/structs/untagged.h
+  cname: struct @S2_inner_deep
+  hsname: S2_inner_deep
+- headers: types/structs/untagged.h
+  cname: struct S3
+  hsname: S3
+- headers: types/structs/untagged.h
+  cname: struct @S3_c
+  hsname: S3_c
+hstypes:
+- hsname: S1
+  representation:
+    record:
+      constructor: S1
+      fields:
+      - s1_c
+      - s1_d
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S1_c
+  representation:
+    record:
+      constructor: S1_c
+      fields:
+      - s1_c_a
+      - s1_c_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2
+  representation:
+    record:
+      constructor: S2
+      fields:
+      - s2_inner
+      - s2_d
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2_inner
+  representation:
+    record:
+      constructor: S2_inner
+      fields:
+      - s2_inner_a
+      - s2_inner_deep
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S2_inner_deep
+  representation:
+    record:
+      constructor: S2_inner_deep
+      fields:
+      - s2_inner_deep_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S3
+  representation:
+    record:
+      constructor: S3
+      fields:
+      - s3_c
+      - s3_d
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: S3_c
+  representation:
+    record:
+      constructor: S3_c
+      fields:
+      - s3_c_a
+      - s3_c_b
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/structs/untagged/th.txt b/test-artefacts/fixtures/types/structs/untagged/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/untagged/th.txt
@@ -0,0 +1,345 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/untagged.h
+{-| __C declaration:__ @struct \@S1_c@
+
+    __defined at:__ @types\/structs\/untagged.h 3:3@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S1_c
+    = S1_c {s1_c_a :: CInt
+            {- ^ __C declaration:__ @a@
+
+                 __defined at:__ @types\/structs\/untagged.h 4:9@
+
+                 __exported by:__ @types\/structs\/untagged.h@
+            -},
+            s1_c_b :: CInt
+            {- ^ __C declaration:__ @b@
+
+                 __defined at:__ @types\/structs\/untagged.h 5:9@
+
+                 __exported by:__ @types\/structs\/untagged.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S1_c
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S1_c
+    where readRaw = \ptr_0 -> (pure S1_c <*> readRaw (Proxy @"s1_c_a") ptr_0) <*> readRaw (Proxy @"s1_c_b") ptr_0
+instance WriteRaw S1_c
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S1_c s1_c_a_2
+                                            s1_c_b_3 -> writeRaw (Proxy @"s1_c_a") ptr_0 s1_c_a_2 >> writeRaw (Proxy @"s1_c_b") ptr_0 s1_c_b_3
+deriving via (EquivStorable S1_c) instance Storable S1_c
+deriving via (IsStructViaReadRaw S1_c) instance IsStruct S1_c
+instance (~) ty CInt => HasField "s1_c_a" S1_c ty
+    where hasField = \x_0 -> (\y_1 -> S1_c{s1_c_a = y_1,
+                                           s1_c_b = getField @"s1_c_b" x_0},
+                              getField @"s1_c_a" x_0)
+instance (~) ty CInt => HasField "s1_c_a" (Ptr S1_c) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_c_a")
+instance HasCField S1_c "s1_c_a"
+    where type CFieldType S1_c "s1_c_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s1_c_b" S1_c ty
+    where hasField = \x_0 -> (\y_1 -> S1_c{s1_c_b = y_1,
+                                           s1_c_a = getField @"s1_c_a" x_0},
+                              getField @"s1_c_b" x_0)
+instance (~) ty CInt => HasField "s1_c_b" (Ptr S1_c) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_c_b")
+instance HasCField S1_c "s1_c_b"
+    where type CFieldType S1_c "s1_c_b" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S1@
+
+    __defined at:__ @types\/structs\/untagged.h 2:8@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S1
+    = S1 {s1_c :: S1_c
+          {- ^ __C declaration:__ @c@
+
+               __defined at:__ @types\/structs\/untagged.h 6:5@
+
+               __exported by:__ @types\/structs\/untagged.h@
+          -},
+          s1_d :: CInt
+          {- ^ __C declaration:__ @d@
+
+               __defined at:__ @types\/structs\/untagged.h 8:7@
+
+               __exported by:__ @types\/structs\/untagged.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S1
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S1
+    where readRaw = \ptr_0 -> (pure S1 <*> readRaw (Proxy @"s1_c") ptr_0) <*> readRaw (Proxy @"s1_d") ptr_0
+instance WriteRaw S1
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S1 s1_c_2
+                                          s1_d_3 -> writeRaw (Proxy @"s1_c") ptr_0 s1_c_2 >> writeRaw (Proxy @"s1_d") ptr_0 s1_d_3
+deriving via (EquivStorable S1) instance Storable S1
+deriving via (IsStructViaReadRaw S1) instance IsStruct S1
+instance (~) ty S1_c => HasField "s1_c" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{s1_c = y_1,
+                                         s1_d = getField @"s1_d" x_0},
+                              getField @"s1_c" x_0)
+instance (~) ty S1_c => HasField "s1_c" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_c")
+instance HasCField S1 "s1_c"
+    where type CFieldType S1 "s1_c" = S1_c
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s1_d" S1 ty
+    where hasField = \x_0 -> (\y_1 -> S1{s1_d = y_1,
+                                         s1_c = getField @"s1_c" x_0},
+                              getField @"s1_d" x_0)
+instance (~) ty CInt => HasField "s1_d" (Ptr S1) (Ptr ty)
+    where getField = fromPtr (Proxy @"s1_d")
+instance HasCField S1 "s1_d"
+    where type CFieldType S1 "s1_d" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct \@S2_inner_deep@
+
+    __defined at:__ @types\/structs\/untagged.h 15:5@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S2_inner_deep
+    = S2_inner_deep {s2_inner_deep_b :: CInt
+                     {- ^ __C declaration:__ @b@
+
+                          __defined at:__ @types\/structs\/untagged.h 16:11@
+
+                          __exported by:__ @types\/structs\/untagged.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2_inner_deep
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S2_inner_deep
+    where readRaw = \ptr_0 -> pure S2_inner_deep <*> readRaw (Proxy @"s2_inner_deep_b") ptr_0
+instance WriteRaw S2_inner_deep
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2_inner_deep s2_inner_deep_b_2 -> writeRaw (Proxy @"s2_inner_deep_b") ptr_0 s2_inner_deep_b_2
+deriving via (EquivStorable S2_inner_deep) instance Storable S2_inner_deep
+deriving via (IsStructViaReadRaw S2_inner_deep) instance IsStruct S2_inner_deep
+instance (~) ty CInt => HasField "s2_inner_deep_b" S2_inner_deep ty
+    where hasField = \x_0 -> (\y_1 -> S2_inner_deep{s2_inner_deep_b = y_1},
+                              getField @"s2_inner_deep_b" x_0)
+instance (~) ty CInt =>
+         HasField "s2_inner_deep_b" (Ptr S2_inner_deep) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_inner_deep_b")
+instance HasCField S2_inner_deep "s2_inner_deep_b"
+    where type CFieldType S2_inner_deep "s2_inner_deep_b" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct \@S2_inner@
+
+    __defined at:__ @types\/structs\/untagged.h 13:3@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S2_inner
+    = S2_inner {s2_inner_a :: CInt
+                {- ^ __C declaration:__ @a@
+
+                     __defined at:__ @types\/structs\/untagged.h 14:9@
+
+                     __exported by:__ @types\/structs\/untagged.h@
+                -},
+                s2_inner_deep :: S2_inner_deep
+                {- ^ __C declaration:__ @deep@
+
+                     __defined at:__ @types\/structs\/untagged.h 17:7@
+
+                     __exported by:__ @types\/structs\/untagged.h@
+                -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2_inner
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S2_inner
+    where readRaw = \ptr_0 -> (pure S2_inner <*> readRaw (Proxy @"s2_inner_a") ptr_0) <*> readRaw (Proxy @"s2_inner_deep") ptr_0
+instance WriteRaw S2_inner
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2_inner s2_inner_a_2
+                                                s2_inner_deep_3 -> writeRaw (Proxy @"s2_inner_a") ptr_0 s2_inner_a_2 >> writeRaw (Proxy @"s2_inner_deep") ptr_0 s2_inner_deep_3
+deriving via (EquivStorable S2_inner) instance Storable S2_inner
+deriving via (IsStructViaReadRaw S2_inner) instance IsStruct S2_inner
+instance (~) ty CInt => HasField "s2_inner_a" S2_inner ty
+    where hasField = \x_0 -> (\y_1 -> S2_inner{s2_inner_a = y_1,
+                                               s2_inner_deep = getField @"s2_inner_deep" x_0},
+                              getField @"s2_inner_a" x_0)
+instance (~) ty CInt =>
+         HasField "s2_inner_a" (Ptr S2_inner) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_inner_a")
+instance HasCField S2_inner "s2_inner_a"
+    where type CFieldType S2_inner "s2_inner_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty S2_inner_deep =>
+         HasField "s2_inner_deep" S2_inner ty
+    where hasField = \x_0 -> (\y_1 -> S2_inner{s2_inner_deep = y_1,
+                                               s2_inner_a = getField @"s2_inner_a" x_0},
+                              getField @"s2_inner_deep" x_0)
+instance (~) ty S2_inner_deep =>
+         HasField "s2_inner_deep" (Ptr S2_inner) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_inner_deep")
+instance HasCField S2_inner "s2_inner_deep"
+    where type CFieldType S2_inner "s2_inner_deep" = S2_inner_deep
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct S2@
+
+    __defined at:__ @types\/structs\/untagged.h 12:8@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S2
+    = S2 {s2_inner :: S2_inner
+          {- ^ __C declaration:__ @inner@
+
+               __defined at:__ @types\/structs\/untagged.h 18:5@
+
+               __exported by:__ @types\/structs\/untagged.h@
+          -},
+          s2_d :: CInt
+          {- ^ __C declaration:__ @d@
+
+               __defined at:__ @types\/structs\/untagged.h 20:7@
+
+               __exported by:__ @types\/structs\/untagged.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S2
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S2
+    where readRaw = \ptr_0 -> (pure S2 <*> readRaw (Proxy @"s2_inner") ptr_0) <*> readRaw (Proxy @"s2_d") ptr_0
+instance WriteRaw S2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S2 s2_inner_2
+                                          s2_d_3 -> writeRaw (Proxy @"s2_inner") ptr_0 s2_inner_2 >> writeRaw (Proxy @"s2_d") ptr_0 s2_d_3
+deriving via (EquivStorable S2) instance Storable S2
+deriving via (IsStructViaReadRaw S2) instance IsStruct S2
+instance (~) ty S2_inner => HasField "s2_inner" S2 ty
+    where hasField = \x_0 -> (\y_1 -> S2{s2_inner = y_1,
+                                         s2_d = getField @"s2_d" x_0},
+                              getField @"s2_inner" x_0)
+instance (~) ty S2_inner => HasField "s2_inner" (Ptr S2) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_inner")
+instance HasCField S2 "s2_inner"
+    where type CFieldType S2 "s2_inner" = S2_inner
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s2_d" S2 ty
+    where hasField = \x_0 -> (\y_1 -> S2{s2_d = y_1,
+                                         s2_inner = getField @"s2_inner" x_0},
+                              getField @"s2_d" x_0)
+instance (~) ty CInt => HasField "s2_d" (Ptr S2) (Ptr ty)
+    where getField = fromPtr (Proxy @"s2_d")
+instance HasCField S2 "s2_d"
+    where type CFieldType S2 "s2_d" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct S3@
+
+    __defined at:__ @types\/structs\/untagged.h 24:8@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S3
+    = S3 {s3_c :: (Ptr (Ptr S3_c))
+          {- ^ __C declaration:__ @c@
+
+               __defined at:__ @types\/structs\/untagged.h 28:7@
+
+               __exported by:__ @types\/structs\/untagged.h@
+          -},
+          s3_d :: CInt
+          {- ^ __C declaration:__ @d@
+
+               __defined at:__ @types\/structs\/untagged.h 30:7@
+
+               __exported by:__ @types\/structs\/untagged.h@
+          -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S3
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw S3
+    where readRaw = \ptr_0 -> (pure S3 <*> readRaw (Proxy @"s3_c") ptr_0) <*> readRaw (Proxy @"s3_d") ptr_0
+instance WriteRaw S3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S3 s3_c_2
+                                          s3_d_3 -> writeRaw (Proxy @"s3_c") ptr_0 s3_c_2 >> writeRaw (Proxy @"s3_d") ptr_0 s3_d_3
+deriving via (EquivStorable S3) instance Storable S3
+deriving via (IsStructViaReadRaw S3) instance IsStruct S3
+instance (~) ty (Ptr (Ptr S3_c)) => HasField "s3_c" S3 ty
+    where hasField = \x_0 -> (\y_1 -> S3{s3_c = y_1,
+                                         s3_d = getField @"s3_d" x_0},
+                              getField @"s3_c" x_0)
+instance (~) ty (Ptr (Ptr S3_c)) =>
+         HasField "s3_c" (Ptr S3) (Ptr ty)
+    where getField = fromPtr (Proxy @"s3_c")
+instance HasCField S3 "s3_c"
+    where type CFieldType S3 "s3_c" = Ptr (Ptr S3_c)
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s3_d" S3 ty
+    where hasField = \x_0 -> (\y_1 -> S3{s3_d = y_1,
+                                         s3_c = getField @"s3_c" x_0},
+                              getField @"s3_d" x_0)
+instance (~) ty CInt => HasField "s3_d" (Ptr S3) (Ptr ty)
+    where getField = fromPtr (Proxy @"s3_d")
+instance HasCField S3 "s3_d"
+    where type CFieldType S3 "s3_d" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct \@S3_c@
+
+    __defined at:__ @types\/structs\/untagged.h 25:3@
+
+    __exported by:__ @types\/structs\/untagged.h@
+-}
+data S3_c
+    = S3_c {s3_c_a :: CInt
+            {- ^ __C declaration:__ @a@
+
+                 __defined at:__ @types\/structs\/untagged.h 26:9@
+
+                 __exported by:__ @types\/structs\/untagged.h@
+            -},
+            s3_c_b :: CInt
+            {- ^ __C declaration:__ @b@
+
+                 __defined at:__ @types\/structs\/untagged.h 27:9@
+
+                 __exported by:__ @types\/structs\/untagged.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize S3_c
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw S3_c
+    where readRaw = \ptr_0 -> (pure S3_c <*> readRaw (Proxy @"s3_c_a") ptr_0) <*> readRaw (Proxy @"s3_c_b") ptr_0
+instance WriteRaw S3_c
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       S3_c s3_c_a_2
+                                            s3_c_b_3 -> writeRaw (Proxy @"s3_c_a") ptr_0 s3_c_a_2 >> writeRaw (Proxy @"s3_c_b") ptr_0 s3_c_b_3
+deriving via (EquivStorable S3_c) instance Storable S3_c
+deriving via (IsStructViaReadRaw S3_c) instance IsStruct S3_c
+instance (~) ty CInt => HasField "s3_c_a" S3_c ty
+    where hasField = \x_0 -> (\y_1 -> S3_c{s3_c_a = y_1,
+                                           s3_c_b = getField @"s3_c_b" x_0},
+                              getField @"s3_c_a" x_0)
+instance (~) ty CInt => HasField "s3_c_a" (Ptr S3_c) (Ptr ty)
+    where getField = fromPtr (Proxy @"s3_c_a")
+instance HasCField S3_c "s3_c_a"
+    where type CFieldType S3_c "s3_c_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "s3_c_b" S3_c ty
+    where hasField = \x_0 -> (\y_1 -> S3_c{s3_c_b = y_1,
+                                           s3_c_a = getField @"s3_c_a" x_0},
+                              getField @"s3_c_b" x_0)
+instance (~) ty CInt => HasField "s3_c_b" (Ptr S3_c) (Ptr ty)
+    where getField = fromPtr (Proxy @"s3_c_b")
+instance HasCField S3_c "s3_c_b"
+    where type CFieldType S3_c "s3_c_b" = CInt
+          offset# = \_ -> \_ -> 4
diff --git a/test-artefacts/fixtures/types/structs/untagged_struct/bindingspec.yaml b/test-artefacts/fixtures/types/structs/untagged_struct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/untagged_struct/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/types/structs/untagged_struct/th.txt b/test-artefacts/fixtures/types/structs/untagged_struct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/structs/untagged_struct/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/types/structs/untagged_struct.h
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/array/Example.hs b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/array/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/array/Example.hs
@@ -0,0 +1,239 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T_Aux(..)
+    , Example.T(..)
+    , Example.U_Aux(..)
+    , Example.U(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.ConstantArray as CA
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.IncompleteArray as IA
+import qualified HsBindgen.Runtime.IsArray as IsA
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Eq, IO, Show, fmap, type (~))
+
+{-| Auxiliary type used by 'T'
+
+    __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h@
+-}
+newtype T_Aux = T_Aux
+  { unwrapT_Aux :: BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toT_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5927fedc3abfa99c_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c ::
+     T_Aux
+  -> IO (BG.FunPtr T_Aux)
+hs_bindgen_5927fedc3abfa99c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_5927fedc3abfa99c_base (\x1 ->
+                                                            BG.getField @"unwrapT_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromT_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_281617c90fa9307a_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a ::
+     BG.FunPtr T_Aux
+  -> T_Aux
+hs_bindgen_281617c90fa9307a =
+  \funPtr0 ->
+    T_Aux (\x1 ->
+             hs_bindgen_281617c90fa9307a_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr T_Aux where
+
+  toFunPtr = hs_bindgen_5927fedc3abfa99c
+
+instance BG.FromFunPtr T_Aux where
+
+  fromFunPtr = hs_bindgen_281617c90fa9307a
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapT_Aux" T_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T_Aux {unwrapT_Aux = y1}, BG.getField @"unwrapT_Aux" x0)
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.HasField "unwrapT_Aux" (BG.Ptr T_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapT_Aux")
+
+instance HasCField.HasCField T_Aux "unwrapT_Aux" where
+
+  type CFieldType T_Aux "unwrapT_Aux" =
+    BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h@
+-}
+newtype T = T
+  { unwrapT :: IA.IncompleteArray (BG.FunPtr T_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype (IsA.IsArray)
+
+instance ( ty ~ IA.IncompleteArray (BG.FunPtr T_Aux)
+         ) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance ( ty ~ IA.IncompleteArray (BG.FunPtr T_Aux)
+         ) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" =
+    IA.IncompleteArray (BG.FunPtr T_Aux)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'U'
+
+    __C declaration:__ @U@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h 2:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h@
+-}
+newtype U_Aux = U_Aux
+  { unwrapU_Aux :: BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toU_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_a78147e446a66171_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @toU_Aux@
+hs_bindgen_a78147e446a66171 ::
+     U_Aux
+  -> IO (BG.FunPtr U_Aux)
+hs_bindgen_a78147e446a66171 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_a78147e446a66171_base (\x1 ->
+                                                            BG.getField @"unwrapU_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromU_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_abb428b050bb7646_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @fromU_Aux@
+hs_bindgen_abb428b050bb7646 ::
+     BG.FunPtr U_Aux
+  -> U_Aux
+hs_bindgen_abb428b050bb7646 =
+  \funPtr0 ->
+    U_Aux (\x1 ->
+             hs_bindgen_abb428b050bb7646_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr U_Aux where
+
+  toFunPtr = hs_bindgen_a78147e446a66171
+
+instance BG.FromFunPtr U_Aux where
+
+  fromFunPtr = hs_bindgen_abb428b050bb7646
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapU_Aux" U_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         U_Aux {unwrapU_Aux = y1}, BG.getField @"unwrapU_Aux" x0)
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.HasField "unwrapU_Aux" (BG.Ptr U_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapU_Aux")
+
+instance HasCField.HasCField U_Aux "unwrapU_Aux" where
+
+  type CFieldType U_Aux "unwrapU_Aux" =
+    BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @U@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h 2:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h@
+-}
+newtype U = U
+  { unwrapU :: CA.ConstantArray 3 (BG.FunPtr U_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Show)
+  deriving newtype
+    ( IsA.IsArray
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ CA.ConstantArray 3 (BG.FunPtr U_Aux)
+         ) => BG.CompatHasField.HasField "unwrapU" U ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> U {unwrapU = y1}, BG.getField @"unwrapU" x0)
+
+instance ( ty ~ CA.ConstantArray 3 (BG.FunPtr U_Aux)
+         ) => BG.HasField "unwrapU" (BG.Ptr U) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapU")
+
+instance HasCField.HasCField U "unwrapU" where
+
+  type CFieldType U "unwrapU" =
+    CA.ConstantArray 3 (BG.FunPtr U_Aux)
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/array/bindingspec.yaml b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/array/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/array/bindingspec.yaml
@@ -0,0 +1,46 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/typedefs/auxiliary/function-pointer/array.h
+  cname: T
+  hsname: T
+- headers: types/typedefs/auxiliary/function-pointer/array.h
+  cname: U
+  hsname: U
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - Show
+- hsname: U
+  representation:
+    newtype:
+      constructor: U
+      fields:
+      - unwrapU
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsArray
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/array/th.txt b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/array/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/array/th.txt
@@ -0,0 +1,123 @@
+-- addDependentFile test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/array.h
+{-| Auxiliary type used by 'T'
+
+    __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h@
+-}
+newtype T_Aux
+    = T_Aux {unwrapT_Aux :: (CInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toT_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5927fedc3abfa99c_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c :: T_Aux -> IO (FunPtr T_Aux)
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c = \fun_0 -> fmap castFunPtr (hs_bindgen_5927fedc3abfa99c_base (\x_1 -> getField @"unwrapT_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromT_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_281617c90fa9307a_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a :: FunPtr T_Aux -> T_Aux
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a = \funPtr_0 -> T_Aux (\x_1 -> hs_bindgen_281617c90fa9307a_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr T_Aux
+    where toFunPtr = hs_bindgen_5927fedc3abfa99c
+instance FromFunPtr T_Aux
+    where fromFunPtr = hs_bindgen_281617c90fa9307a
+instance (~) ty (CInt -> IO ()) => HasField "unwrapT_Aux" T_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T_Aux{unwrapT_Aux = y_1},
+                              getField @"unwrapT_Aux" x_0)
+instance (~) ty (CInt -> IO ()) =>
+         HasField "unwrapT_Aux" (Ptr T_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT_Aux")
+instance HasCField T_Aux "unwrapT_Aux"
+    where type CFieldType T_Aux "unwrapT_Aux" = CInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h@
+-}
+newtype T
+    = T {unwrapT :: (IncompleteArray (FunPtr T_Aux))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype IsArray
+instance (~) ty (IncompleteArray (FunPtr T_Aux)) =>
+         HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty (IncompleteArray (FunPtr T_Aux)) =>
+         HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = IncompleteArray (FunPtr T_Aux)
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'U'
+
+    __C declaration:__ @U@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h 2:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h@
+-}
+newtype U_Aux
+    = U_Aux {unwrapU_Aux :: (CInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toU_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_a78147e446a66171_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @toU_Aux@
+hs_bindgen_a78147e446a66171 :: U_Aux -> IO (FunPtr U_Aux)
+-- __unique:__ @toU_Aux@
+hs_bindgen_a78147e446a66171 = \fun_0 -> fmap castFunPtr (hs_bindgen_a78147e446a66171_base (\x_1 -> getField @"unwrapU_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromU_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_abb428b050bb7646_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromU_Aux@
+hs_bindgen_abb428b050bb7646 :: FunPtr U_Aux -> U_Aux
+-- __unique:__ @fromU_Aux@
+hs_bindgen_abb428b050bb7646 = \funPtr_0 -> U_Aux (\x_1 -> hs_bindgen_abb428b050bb7646_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr U_Aux
+    where toFunPtr = hs_bindgen_a78147e446a66171
+instance FromFunPtr U_Aux
+    where fromFunPtr = hs_bindgen_abb428b050bb7646
+instance (~) ty (CInt -> IO ()) => HasField "unwrapU_Aux" U_Aux ty
+    where hasField = \x_0 -> (\y_1 -> U_Aux{unwrapU_Aux = y_1},
+                              getField @"unwrapU_Aux" x_0)
+instance (~) ty (CInt -> IO ()) =>
+         HasField "unwrapU_Aux" (Ptr U_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapU_Aux")
+instance HasCField U_Aux "unwrapU_Aux"
+    where type CFieldType U_Aux "unwrapU_Aux" = CInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @U@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h 2:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/array.h@
+-}
+newtype U
+    = U {unwrapU :: (ConstantArray 3 (FunPtr U_Aux))}
+    deriving stock (Eq, Generic, Show)
+    deriving newtype (IsArray, ReadRaw, StaticSize, Storable, WriteRaw)
+instance (~) ty (ConstantArray 3 (FunPtr U_Aux)) =>
+         HasField "unwrapU" U ty
+    where hasField = \x_0 -> (\y_1 -> U{unwrapU = y_1},
+                              getField @"unwrapU" x_0)
+instance (~) ty (ConstantArray 3 (FunPtr U_Aux)) =>
+         HasField "unwrapU" (Ptr U) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapU")
+instance HasCField U "unwrapU"
+    where type CFieldType U "unwrapU" = ConstantArray 3 (FunPtr U_Aux)
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/block/Example.hs b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/block/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/block/Example.hs
@@ -0,0 +1,126 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T_Aux(..)
+    , Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.Block as Block
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (IO, fmap, type (~))
+
+{-| Auxiliary type used by 'T'
+
+    __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/block.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/block.h@
+-}
+newtype T_Aux = T_Aux
+  { unwrapT_Aux :: BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toT_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5927fedc3abfa99c_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c ::
+     T_Aux
+  -> IO (BG.FunPtr T_Aux)
+hs_bindgen_5927fedc3abfa99c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_5927fedc3abfa99c_base (\x1 ->
+                                                            BG.getField @"unwrapT_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromT_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_281617c90fa9307a_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a ::
+     BG.FunPtr T_Aux
+  -> T_Aux
+hs_bindgen_281617c90fa9307a =
+  \funPtr0 ->
+    T_Aux (\x1 ->
+             hs_bindgen_281617c90fa9307a_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr T_Aux where
+
+  toFunPtr = hs_bindgen_5927fedc3abfa99c
+
+instance BG.FromFunPtr T_Aux where
+
+  fromFunPtr = hs_bindgen_281617c90fa9307a
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapT_Aux" T_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T_Aux {unwrapT_Aux = y1}, BG.getField @"unwrapT_Aux" x0)
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.HasField "unwrapT_Aux" (BG.Ptr T_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapT_Aux")
+
+instance HasCField.HasCField T_Aux "unwrapT_Aux" where
+
+  type CFieldType T_Aux "unwrapT_Aux" =
+    BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/block.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/block.h@
+-}
+newtype T = T
+  { unwrapT :: Block.Block T_Aux
+  }
+  deriving stock (BG.Generic)
+  deriving newtype (BG.HasFFIType)
+
+instance ( ty ~ Block.Block T_Aux
+         ) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance ( ty ~ Block.Block T_Aux
+         ) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = Block.Block T_Aux
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/block/bindingspec.yaml b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/block/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/block/bindingspec.yaml
@@ -0,0 +1,25 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/typedefs/auxiliary/function-pointer/block.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/block/th.txt b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/block/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/block/th.txt
@@ -0,0 +1,61 @@
+-- addDependentFile test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/block.h
+{-| Auxiliary type used by 'T'
+
+    __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/block.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/block.h@
+-}
+newtype T_Aux
+    = T_Aux {unwrapT_Aux :: (CInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toT_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5927fedc3abfa99c_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c :: T_Aux -> IO (FunPtr T_Aux)
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c = \fun_0 -> fmap castFunPtr (hs_bindgen_5927fedc3abfa99c_base (\x_1 -> getField @"unwrapT_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromT_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_281617c90fa9307a_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a :: FunPtr T_Aux -> T_Aux
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a = \funPtr_0 -> T_Aux (\x_1 -> hs_bindgen_281617c90fa9307a_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr T_Aux
+    where toFunPtr = hs_bindgen_5927fedc3abfa99c
+instance FromFunPtr T_Aux
+    where fromFunPtr = hs_bindgen_281617c90fa9307a
+instance (~) ty (CInt -> IO ()) => HasField "unwrapT_Aux" T_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T_Aux{unwrapT_Aux = y_1},
+                              getField @"unwrapT_Aux" x_0)
+instance (~) ty (CInt -> IO ()) =>
+         HasField "unwrapT_Aux" (Ptr T_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT_Aux")
+instance HasCField T_Aux "unwrapT_Aux"
+    where type CFieldType T_Aux "unwrapT_Aux" = CInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/block.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/block.h@
+-}
+newtype T
+    = T {unwrapT :: (Block T_Aux)}
+    deriving stock Generic
+    deriving newtype HasFFIType
+instance (~) ty (Block T_Aux) => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty (Block T_Aux) =>
+         HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = Block T_Aux
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/direct/Example.hs b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/direct/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/direct/Example.hs
@@ -0,0 +1,88 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (IO, fmap, type (~))
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/direct.h 1:14@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/direct.h@
+-}
+newtype T = T
+  { unwrapT :: BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toT@
+foreign import ccall safe "wrapper" hs_bindgen_b8534912f6256492_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @toT@
+hs_bindgen_b8534912f6256492 ::
+     T
+  -> IO (BG.FunPtr T)
+hs_bindgen_b8534912f6256492 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b8534912f6256492_base (\x1 ->
+                                                            BG.getField @"unwrapT" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromT@
+foreign import ccall safe "dynamic" hs_bindgen_8f830eadb43a6fe4_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @fromT@
+hs_bindgen_8f830eadb43a6fe4 ::
+     BG.FunPtr T
+  -> T
+hs_bindgen_8f830eadb43a6fe4 =
+  \funPtr0 ->
+    T (\x1 ->
+         hs_bindgen_8f830eadb43a6fe4_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr T where
+
+  toFunPtr = hs_bindgen_b8534912f6256492
+
+instance BG.FromFunPtr T where
+
+  fromFunPtr = hs_bindgen_8f830eadb43a6fe4
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/direct/bindingspec.yaml b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/direct/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/direct/bindingspec.yaml
@@ -0,0 +1,23 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/typedefs/auxiliary/function-pointer/direct.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+  instances:
+  - FromFunPtr
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ToFunPtr
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/direct/th.txt b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/direct/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/direct/th.txt
@@ -0,0 +1,38 @@
+-- addDependentFile test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/direct.h
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/direct.h 1:14@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/direct.h@
+-}
+newtype T = T {unwrapT :: (CInt -> IO ())} deriving stock Generic
+-- __unique:__ @toT@
+foreign import ccall safe "wrapper" hs_bindgen_b8534912f6256492_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @toT@
+hs_bindgen_b8534912f6256492 :: T -> IO (FunPtr T)
+-- __unique:__ @toT@
+hs_bindgen_b8534912f6256492 = \fun_0 -> fmap castFunPtr (hs_bindgen_b8534912f6256492_base (\x_1 -> getField @"unwrapT" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromT@
+foreign import ccall safe "dynamic" hs_bindgen_8f830eadb43a6fe4_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromT@
+hs_bindgen_8f830eadb43a6fe4 :: FunPtr T -> T
+-- __unique:__ @fromT@
+hs_bindgen_8f830eadb43a6fe4 = \funPtr_0 -> T (\x_1 -> hs_bindgen_8f830eadb43a6fe4_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr T
+    where toFunPtr = hs_bindgen_b8534912f6256492
+instance FromFunPtr T
+    where fromFunPtr = hs_bindgen_8f830eadb43a6fe4
+instance (~) ty (CInt -> IO ()) => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty (CInt -> IO ()) =>
+         HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = CInt -> IO ()
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/multi_level/Example.hs b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/multi_level/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/multi_level/Example.hs
@@ -0,0 +1,733 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.F1_Aux(..)
+    , Example.F1(..)
+    , Example.F2_Aux(..)
+    , Example.F2(..)
+    , Example.F3_Aux(..)
+    , Example.F3(..)
+    , Example.F4_Aux(..)
+    , Example.F4(..)
+    , Example.F5_Aux(..)
+    , Example.F5(..)
+    , Example.MyInt(..)
+    , Example.F6_Aux(..)
+    , Example.F6(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, IO, Integral, Num, Ord, Read, Real, Show, fmap, type (~))
+
+{-| Auxiliary type used by 'F1'
+
+    __C declaration:__ @f1@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 7:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F1_Aux = F1_Aux
+  { unwrapF1_Aux :: BG.CInt -> BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toF1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_00d16e666202ed6c_base ::
+     (BG.CInt -> BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO ()))
+
+-- __unique:__ @toF1_Aux@
+hs_bindgen_00d16e666202ed6c ::
+     F1_Aux
+  -> IO (BG.FunPtr F1_Aux)
+hs_bindgen_00d16e666202ed6c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_00d16e666202ed6c_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrapF1_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromF1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ddeb5206e8192425_base ::
+     BG.FunPtr (BG.CInt -> BG.CInt -> IO ())
+  -> BG.CInt -> BG.CInt -> IO ()
+
+-- __unique:__ @fromF1_Aux@
+hs_bindgen_ddeb5206e8192425 ::
+     BG.FunPtr F1_Aux
+  -> F1_Aux
+hs_bindgen_ddeb5206e8192425 =
+  \funPtr0 ->
+    F1_Aux (\x1 ->
+              \x2 ->
+                hs_bindgen_ddeb5206e8192425_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr F1_Aux where
+
+  toFunPtr = hs_bindgen_00d16e666202ed6c
+
+instance BG.FromFunPtr F1_Aux where
+
+  fromFunPtr = hs_bindgen_ddeb5206e8192425
+
+instance ( ty ~ (BG.CInt -> BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapF1_Aux" F1_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F1_Aux {unwrapF1_Aux = y1}, BG.getField @"unwrapF1_Aux" x0)
+
+instance ( ty ~ (BG.CInt -> BG.CInt -> IO ())
+         ) => BG.HasField "unwrapF1_Aux" (BG.Ptr F1_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapF1_Aux")
+
+instance HasCField.HasCField F1_Aux "unwrapF1_Aux" where
+
+  type CFieldType F1_Aux "unwrapF1_Aux" =
+    BG.CInt -> BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 7:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F1 = F1
+  { unwrapF1 :: BG.FunPtr F1_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr F1_Aux
+         ) => BG.CompatHasField.HasField "unwrapF1" F1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F1 {unwrapF1 = y1}, BG.getField @"unwrapF1" x0)
+
+instance ( ty ~ BG.FunPtr F1_Aux
+         ) => BG.HasField "unwrapF1" (BG.Ptr F1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapF1")
+
+instance HasCField.HasCField F1 "unwrapF1" where
+
+  type CFieldType F1 "unwrapF1" = BG.FunPtr F1_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'F2'
+
+    __C declaration:__ @f2@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 10:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F2_Aux = F2_Aux
+  { unwrapF2_Aux :: BG.CInt -> BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toF2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c39d7524b75b54e8_base ::
+     (BG.CInt -> BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO ()))
+
+-- __unique:__ @toF2_Aux@
+hs_bindgen_c39d7524b75b54e8 ::
+     F2_Aux
+  -> IO (BG.FunPtr F2_Aux)
+hs_bindgen_c39d7524b75b54e8 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c39d7524b75b54e8_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrapF2_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromF2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_e15bcd26f1ed1df7_base ::
+     BG.FunPtr (BG.CInt -> BG.CInt -> IO ())
+  -> BG.CInt -> BG.CInt -> IO ()
+
+-- __unique:__ @fromF2_Aux@
+hs_bindgen_e15bcd26f1ed1df7 ::
+     BG.FunPtr F2_Aux
+  -> F2_Aux
+hs_bindgen_e15bcd26f1ed1df7 =
+  \funPtr0 ->
+    F2_Aux (\x1 ->
+              \x2 ->
+                hs_bindgen_e15bcd26f1ed1df7_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr F2_Aux where
+
+  toFunPtr = hs_bindgen_c39d7524b75b54e8
+
+instance BG.FromFunPtr F2_Aux where
+
+  fromFunPtr = hs_bindgen_e15bcd26f1ed1df7
+
+instance ( ty ~ (BG.CInt -> BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapF2_Aux" F2_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F2_Aux {unwrapF2_Aux = y1}, BG.getField @"unwrapF2_Aux" x0)
+
+instance ( ty ~ (BG.CInt -> BG.CInt -> IO ())
+         ) => BG.HasField "unwrapF2_Aux" (BG.Ptr F2_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapF2_Aux")
+
+instance HasCField.HasCField F2_Aux "unwrapF2_Aux" where
+
+  type CFieldType F2_Aux "unwrapF2_Aux" =
+    BG.CInt -> BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 10:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F2 = F2
+  { unwrapF2 :: BG.Ptr (BG.FunPtr F2_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.FunPtr F2_Aux)
+         ) => BG.CompatHasField.HasField "unwrapF2" F2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F2 {unwrapF2 = y1}, BG.getField @"unwrapF2" x0)
+
+instance ( ty ~ BG.Ptr (BG.FunPtr F2_Aux)
+         ) => BG.HasField "unwrapF2" (BG.Ptr F2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapF2")
+
+instance HasCField.HasCField F2 "unwrapF2" where
+
+  type CFieldType F2 "unwrapF2" =
+    BG.Ptr (BG.FunPtr F2_Aux)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'F3'
+
+    __C declaration:__ @f3@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 13:18@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F3_Aux = F3_Aux
+  { unwrapF3_Aux :: BG.CInt -> BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toF3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_4a960721e7d1dcef_base ::
+     (BG.CInt -> BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> BG.CInt -> IO ()))
+
+-- __unique:__ @toF3_Aux@
+hs_bindgen_4a960721e7d1dcef ::
+     F3_Aux
+  -> IO (BG.FunPtr F3_Aux)
+hs_bindgen_4a960721e7d1dcef =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_4a960721e7d1dcef_base (\x1 ->
+                                                            \x2 ->
+                                                              BG.getField @"unwrapF3_Aux" fun0 (BG.fromFFIType x1) (BG.fromFFIType x2)))
+
+-- __unique:__ @fromF3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_66460422a7197535_base ::
+     BG.FunPtr (BG.CInt -> BG.CInt -> IO ())
+  -> BG.CInt -> BG.CInt -> IO ()
+
+-- __unique:__ @fromF3_Aux@
+hs_bindgen_66460422a7197535 ::
+     BG.FunPtr F3_Aux
+  -> F3_Aux
+hs_bindgen_66460422a7197535 =
+  \funPtr0 ->
+    F3_Aux (\x1 ->
+              \x2 ->
+                hs_bindgen_66460422a7197535_base (BG.castFunPtr funPtr0) (BG.toFFIType x1) (BG.toFFIType x2))
+
+instance BG.ToFunPtr F3_Aux where
+
+  toFunPtr = hs_bindgen_4a960721e7d1dcef
+
+instance BG.FromFunPtr F3_Aux where
+
+  fromFunPtr = hs_bindgen_66460422a7197535
+
+instance ( ty ~ (BG.CInt -> BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapF3_Aux" F3_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F3_Aux {unwrapF3_Aux = y1}, BG.getField @"unwrapF3_Aux" x0)
+
+instance ( ty ~ (BG.CInt -> BG.CInt -> IO ())
+         ) => BG.HasField "unwrapF3_Aux" (BG.Ptr F3_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapF3_Aux")
+
+instance HasCField.HasCField F3_Aux "unwrapF3_Aux" where
+
+  type CFieldType F3_Aux "unwrapF3_Aux" =
+    BG.CInt -> BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 13:18@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F3 = F3
+  { unwrapF3 :: BG.Ptr (BG.Ptr (BG.FunPtr F3_Aux))
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.Ptr (BG.FunPtr F3_Aux))
+         ) => BG.CompatHasField.HasField "unwrapF3" F3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F3 {unwrapF3 = y1}, BG.getField @"unwrapF3" x0)
+
+instance ( ty ~ BG.Ptr (BG.Ptr (BG.FunPtr F3_Aux))
+         ) => BG.HasField "unwrapF3" (BG.Ptr F3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapF3")
+
+instance HasCField.HasCField F3 "unwrapF3" where
+
+  type CFieldType F3 "unwrapF3" =
+    BG.Ptr (BG.Ptr (BG.FunPtr F3_Aux))
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'F4'
+
+    __C declaration:__ @f4@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 16:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F4_Aux = F4_Aux
+  { unwrapF4_Aux :: IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toF4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_83bcff023b3bc648_base ::
+     IO BG.CInt
+  -> IO (BG.FunPtr (IO BG.CInt))
+
+-- __unique:__ @toF4_Aux@
+hs_bindgen_83bcff023b3bc648 ::
+     F4_Aux
+  -> IO (BG.FunPtr F4_Aux)
+hs_bindgen_83bcff023b3bc648 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_83bcff023b3bc648_base (fmap BG.toFFIType (BG.getField @"unwrapF4_Aux" fun0)))
+
+-- __unique:__ @fromF4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_40f9a8d432b9eb97_base ::
+     BG.FunPtr (IO BG.CInt)
+  -> IO BG.CInt
+
+-- __unique:__ @fromF4_Aux@
+hs_bindgen_40f9a8d432b9eb97 ::
+     BG.FunPtr F4_Aux
+  -> F4_Aux
+hs_bindgen_40f9a8d432b9eb97 =
+  \funPtr0 ->
+    F4_Aux (fmap BG.fromFFIType (hs_bindgen_40f9a8d432b9eb97_base (BG.castFunPtr funPtr0)))
+
+instance BG.ToFunPtr F4_Aux where
+
+  toFunPtr = hs_bindgen_83bcff023b3bc648
+
+instance BG.FromFunPtr F4_Aux where
+
+  fromFunPtr = hs_bindgen_40f9a8d432b9eb97
+
+instance ( ty ~ IO BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapF4_Aux" F4_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F4_Aux {unwrapF4_Aux = y1}, BG.getField @"unwrapF4_Aux" x0)
+
+instance ( ty ~ IO BG.CInt
+         ) => BG.HasField "unwrapF4_Aux" (BG.Ptr F4_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapF4_Aux")
+
+instance HasCField.HasCField F4_Aux "unwrapF4_Aux" where
+
+  type CFieldType F4_Aux "unwrapF4_Aux" = IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 16:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F4 = F4
+  { unwrapF4 :: BG.Ptr (BG.FunPtr F4_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.FunPtr F4_Aux)
+         ) => BG.CompatHasField.HasField "unwrapF4" F4 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F4 {unwrapF4 = y1}, BG.getField @"unwrapF4" x0)
+
+instance ( ty ~ BG.Ptr (BG.FunPtr F4_Aux)
+         ) => BG.HasField "unwrapF4" (BG.Ptr F4) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapF4")
+
+instance HasCField.HasCField F4 "unwrapF4" where
+
+  type CFieldType F4 "unwrapF4" =
+    BG.Ptr (BG.FunPtr F4_Aux)
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'F5'
+
+    __C declaration:__ @f5@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 19:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F5_Aux = F5_Aux
+  { unwrapF5_Aux :: IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toF5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_6891cbd81d6f42b9_base ::
+     IO ()
+  -> IO (BG.FunPtr (IO ()))
+
+-- __unique:__ @toF5_Aux@
+hs_bindgen_6891cbd81d6f42b9 ::
+     F5_Aux
+  -> IO (BG.FunPtr F5_Aux)
+hs_bindgen_6891cbd81d6f42b9 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_6891cbd81d6f42b9_base (BG.getField @"unwrapF5_Aux" fun0))
+
+-- __unique:__ @fromF5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_586f6635c057975f_base ::
+     BG.FunPtr (IO ())
+  -> IO ()
+
+-- __unique:__ @fromF5_Aux@
+hs_bindgen_586f6635c057975f ::
+     BG.FunPtr F5_Aux
+  -> F5_Aux
+hs_bindgen_586f6635c057975f =
+  \funPtr0 ->
+    F5_Aux (hs_bindgen_586f6635c057975f_base (BG.castFunPtr funPtr0))
+
+instance BG.ToFunPtr F5_Aux where
+
+  toFunPtr = hs_bindgen_6891cbd81d6f42b9
+
+instance BG.FromFunPtr F5_Aux where
+
+  fromFunPtr = hs_bindgen_586f6635c057975f
+
+instance ( ty ~ IO ()
+         ) => BG.CompatHasField.HasField "unwrapF5_Aux" F5_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F5_Aux {unwrapF5_Aux = y1}, BG.getField @"unwrapF5_Aux" x0)
+
+instance ( ty ~ IO ()
+         ) => BG.HasField "unwrapF5_Aux" (BG.Ptr F5_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapF5_Aux")
+
+instance HasCField.HasCField F5_Aux "unwrapF5_Aux" where
+
+  type CFieldType F5_Aux "unwrapF5_Aux" = IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 19:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F5 = F5
+  { unwrapF5 :: BG.Ptr (BG.FunPtr F5_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.FunPtr F5_Aux)
+         ) => BG.CompatHasField.HasField "unwrapF5" F5 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F5 {unwrapF5 = y1}, BG.getField @"unwrapF5" x0)
+
+instance ( ty ~ BG.Ptr (BG.FunPtr F5_Aux)
+         ) => BG.HasField "unwrapF5" (BG.Ptr F5) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapF5")
+
+instance HasCField.HasCField F5 "unwrapF5" where
+
+  type CFieldType F5 "unwrapF5" =
+    BG.Ptr (BG.FunPtr F5_Aux)
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @MyInt@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 22:13@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype MyInt = MyInt
+  { unwrapMyInt :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyInt" MyInt ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         MyInt {unwrapMyInt = y1}, BG.getField @"unwrapMyInt" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyInt" (BG.Ptr MyInt) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyInt")
+
+instance HasCField.HasCField MyInt "unwrapMyInt" where
+
+  type CFieldType MyInt "unwrapMyInt" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'F6'
+
+    __C declaration:__ @f6@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 23:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F6_Aux = F6_Aux
+  { unwrapF6_Aux :: MyInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toF6_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c1baf73f98614f45_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @toF6_Aux@
+hs_bindgen_c1baf73f98614f45 ::
+     F6_Aux
+  -> IO (BG.FunPtr F6_Aux)
+hs_bindgen_c1baf73f98614f45 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_c1baf73f98614f45_base (\x1 ->
+                                                            BG.getField @"unwrapF6_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromF6_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_a887947b26e58f0c_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @fromF6_Aux@
+hs_bindgen_a887947b26e58f0c ::
+     BG.FunPtr F6_Aux
+  -> F6_Aux
+hs_bindgen_a887947b26e58f0c =
+  \funPtr0 ->
+    F6_Aux (\x1 ->
+              hs_bindgen_a887947b26e58f0c_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr F6_Aux where
+
+  toFunPtr = hs_bindgen_c1baf73f98614f45
+
+instance BG.FromFunPtr F6_Aux where
+
+  fromFunPtr = hs_bindgen_a887947b26e58f0c
+
+instance ( ty ~ (MyInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapF6_Aux" F6_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F6_Aux {unwrapF6_Aux = y1}, BG.getField @"unwrapF6_Aux" x0)
+
+instance ( ty ~ (MyInt -> IO ())
+         ) => BG.HasField "unwrapF6_Aux" (BG.Ptr F6_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapF6_Aux")
+
+instance HasCField.HasCField F6_Aux "unwrapF6_Aux" where
+
+  type CFieldType F6_Aux "unwrapF6_Aux" =
+    MyInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 23:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F6 = F6
+  { unwrapF6 :: BG.Ptr (BG.FunPtr F6_Aux)
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr (BG.FunPtr F6_Aux)
+         ) => BG.CompatHasField.HasField "unwrapF6" F6 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F6 {unwrapF6 = y1}, BG.getField @"unwrapF6" x0)
+
+instance ( ty ~ BG.Ptr (BG.FunPtr F6_Aux)
+         ) => BG.HasField "unwrapF6" (BG.Ptr F6) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapF6")
+
+instance HasCField.HasCField F6 "unwrapF6" where
+
+  type CFieldType F6 "unwrapF6" =
+    BG.Ptr (BG.FunPtr F6_Aux)
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/multi_level/bindingspec.yaml b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/multi_level/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/multi_level/bindingspec.yaml
@@ -0,0 +1,199 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/typedefs/auxiliary/function-pointer/multi_level.h
+  cname: f1
+  hsname: F1
+- headers: types/typedefs/auxiliary/function-pointer/multi_level.h
+  cname: f2
+  hsname: F2
+- headers: types/typedefs/auxiliary/function-pointer/multi_level.h
+  cname: f3
+  hsname: F3
+- headers: types/typedefs/auxiliary/function-pointer/multi_level.h
+  cname: f4
+  hsname: F4
+- headers: types/typedefs/auxiliary/function-pointer/multi_level.h
+  cname: f5
+  hsname: F5
+- headers: types/typedefs/auxiliary/function-pointer/multi_level.h
+  cname: MyInt
+  hsname: MyInt
+- headers: types/typedefs/auxiliary/function-pointer/multi_level.h
+  cname: f6
+  hsname: F6
+hstypes:
+- hsname: F1
+  representation:
+    newtype:
+      constructor: F1
+      fields:
+      - unwrapF1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: F2
+  representation:
+    newtype:
+      constructor: F2
+      fields:
+      - unwrapF2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: F3
+  representation:
+    newtype:
+      constructor: F3
+      fields:
+      - unwrapF3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: F4
+  representation:
+    newtype:
+      constructor: F4
+      fields:
+      - unwrapF4
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: F5
+  representation:
+    newtype:
+      constructor: F5
+      fields:
+      - unwrapF5
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: F6
+  representation:
+    newtype:
+      constructor: F6
+      fields:
+      - unwrapF6
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: MyInt
+  representation:
+    newtype:
+      constructor: MyInt
+      fields:
+      - unwrapMyInt
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/multi_level/th.txt b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/multi_level/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/multi_level/th.txt
@@ -0,0 +1,423 @@
+-- addDependentFile test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/multi_level.h
+{-| Auxiliary type used by 'F1'
+
+    __C declaration:__ @f1@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 7:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F1_Aux
+    = F1_Aux {unwrapF1_Aux :: (CInt -> CInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toF1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_00d16e666202ed6c_base ::
+    CInt -> CInt -> IO ()
+ -> IO (FunPtr (CInt -> CInt -> IO ()))
+-- __unique:__ @toF1_Aux@
+hs_bindgen_00d16e666202ed6c :: F1_Aux -> IO (FunPtr F1_Aux)
+-- __unique:__ @toF1_Aux@
+hs_bindgen_00d16e666202ed6c = \fun_0 -> fmap castFunPtr (hs_bindgen_00d16e666202ed6c_base (\x_1 -> \x_2 -> getField @"unwrapF1_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2)))
+-- __unique:__ @fromF1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ddeb5206e8192425_base ::
+    FunPtr (CInt -> CInt -> IO ())
+ -> CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromF1_Aux@
+hs_bindgen_ddeb5206e8192425 :: FunPtr F1_Aux -> F1_Aux
+-- __unique:__ @fromF1_Aux@
+hs_bindgen_ddeb5206e8192425 = \funPtr_0 -> F1_Aux (\x_1 -> \x_2 -> hs_bindgen_ddeb5206e8192425_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2))
+instance ToFunPtr F1_Aux
+    where toFunPtr = hs_bindgen_00d16e666202ed6c
+instance FromFunPtr F1_Aux
+    where fromFunPtr = hs_bindgen_ddeb5206e8192425
+instance (~) ty (CInt -> CInt -> IO ()) =>
+         HasField "unwrapF1_Aux" F1_Aux ty
+    where hasField = \x_0 -> (\y_1 -> F1_Aux{unwrapF1_Aux = y_1},
+                              getField @"unwrapF1_Aux" x_0)
+instance (~) ty (CInt -> CInt -> IO ()) =>
+         HasField "unwrapF1_Aux" (Ptr F1_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF1_Aux")
+instance HasCField F1_Aux "unwrapF1_Aux"
+    where type CFieldType F1_Aux "unwrapF1_Aux" = CInt -> CInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 7:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F1
+    = F1 {unwrapF1 :: (FunPtr F1_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr F1_Aux) => HasField "unwrapF1" F1 ty
+    where hasField = \x_0 -> (\y_1 -> F1{unwrapF1 = y_1},
+                              getField @"unwrapF1" x_0)
+instance (~) ty (FunPtr F1_Aux) =>
+         HasField "unwrapF1" (Ptr F1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF1")
+instance HasCField F1 "unwrapF1"
+    where type CFieldType F1 "unwrapF1" = FunPtr F1_Aux
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'F2'
+
+    __C declaration:__ @f2@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 10:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F2_Aux
+    = F2_Aux {unwrapF2_Aux :: (CInt -> CInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toF2_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c39d7524b75b54e8_base ::
+    CInt -> CInt -> IO ()
+ -> IO (FunPtr (CInt -> CInt -> IO ()))
+-- __unique:__ @toF2_Aux@
+hs_bindgen_c39d7524b75b54e8 :: F2_Aux -> IO (FunPtr F2_Aux)
+-- __unique:__ @toF2_Aux@
+hs_bindgen_c39d7524b75b54e8 = \fun_0 -> fmap castFunPtr (hs_bindgen_c39d7524b75b54e8_base (\x_1 -> \x_2 -> getField @"unwrapF2_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2)))
+-- __unique:__ @fromF2_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_e15bcd26f1ed1df7_base ::
+    FunPtr (CInt -> CInt -> IO ())
+ -> CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromF2_Aux@
+hs_bindgen_e15bcd26f1ed1df7 :: FunPtr F2_Aux -> F2_Aux
+-- __unique:__ @fromF2_Aux@
+hs_bindgen_e15bcd26f1ed1df7 = \funPtr_0 -> F2_Aux (\x_1 -> \x_2 -> hs_bindgen_e15bcd26f1ed1df7_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2))
+instance ToFunPtr F2_Aux
+    where toFunPtr = hs_bindgen_c39d7524b75b54e8
+instance FromFunPtr F2_Aux
+    where fromFunPtr = hs_bindgen_e15bcd26f1ed1df7
+instance (~) ty (CInt -> CInt -> IO ()) =>
+         HasField "unwrapF2_Aux" F2_Aux ty
+    where hasField = \x_0 -> (\y_1 -> F2_Aux{unwrapF2_Aux = y_1},
+                              getField @"unwrapF2_Aux" x_0)
+instance (~) ty (CInt -> CInt -> IO ()) =>
+         HasField "unwrapF2_Aux" (Ptr F2_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF2_Aux")
+instance HasCField F2_Aux "unwrapF2_Aux"
+    where type CFieldType F2_Aux "unwrapF2_Aux" = CInt -> CInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @f2@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 10:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F2
+    = F2 {unwrapF2 :: (Ptr (FunPtr F2_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (FunPtr F2_Aux)) => HasField "unwrapF2" F2 ty
+    where hasField = \x_0 -> (\y_1 -> F2{unwrapF2 = y_1},
+                              getField @"unwrapF2" x_0)
+instance (~) ty (Ptr (FunPtr F2_Aux)) =>
+         HasField "unwrapF2" (Ptr F2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF2")
+instance HasCField F2 "unwrapF2"
+    where type CFieldType F2 "unwrapF2" = Ptr (FunPtr F2_Aux)
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'F3'
+
+    __C declaration:__ @f3@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 13:18@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F3_Aux
+    = F3_Aux {unwrapF3_Aux :: (CInt -> CInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toF3_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_4a960721e7d1dcef_base ::
+    CInt -> CInt -> IO ()
+ -> IO (FunPtr (CInt -> CInt -> IO ()))
+-- __unique:__ @toF3_Aux@
+hs_bindgen_4a960721e7d1dcef :: F3_Aux -> IO (FunPtr F3_Aux)
+-- __unique:__ @toF3_Aux@
+hs_bindgen_4a960721e7d1dcef = \fun_0 -> fmap castFunPtr (hs_bindgen_4a960721e7d1dcef_base (\x_1 -> \x_2 -> getField @"unwrapF3_Aux" fun_0 (fromFFIType x_1) (fromFFIType x_2)))
+-- __unique:__ @fromF3_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_66460422a7197535_base ::
+    FunPtr (CInt -> CInt -> IO ())
+ -> CInt
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromF3_Aux@
+hs_bindgen_66460422a7197535 :: FunPtr F3_Aux -> F3_Aux
+-- __unique:__ @fromF3_Aux@
+hs_bindgen_66460422a7197535 = \funPtr_0 -> F3_Aux (\x_1 -> \x_2 -> hs_bindgen_66460422a7197535_base (castFunPtr funPtr_0) (toFFIType x_1) (toFFIType x_2))
+instance ToFunPtr F3_Aux
+    where toFunPtr = hs_bindgen_4a960721e7d1dcef
+instance FromFunPtr F3_Aux
+    where fromFunPtr = hs_bindgen_66460422a7197535
+instance (~) ty (CInt -> CInt -> IO ()) =>
+         HasField "unwrapF3_Aux" F3_Aux ty
+    where hasField = \x_0 -> (\y_1 -> F3_Aux{unwrapF3_Aux = y_1},
+                              getField @"unwrapF3_Aux" x_0)
+instance (~) ty (CInt -> CInt -> IO ()) =>
+         HasField "unwrapF3_Aux" (Ptr F3_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF3_Aux")
+instance HasCField F3_Aux "unwrapF3_Aux"
+    where type CFieldType F3_Aux "unwrapF3_Aux" = CInt -> CInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @f3@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 13:18@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F3
+    = F3 {unwrapF3 :: (Ptr (Ptr (FunPtr F3_Aux)))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (Ptr (FunPtr F3_Aux))) =>
+         HasField "unwrapF3" F3 ty
+    where hasField = \x_0 -> (\y_1 -> F3{unwrapF3 = y_1},
+                              getField @"unwrapF3" x_0)
+instance (~) ty (Ptr (Ptr (FunPtr F3_Aux))) =>
+         HasField "unwrapF3" (Ptr F3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF3")
+instance HasCField F3 "unwrapF3"
+    where type CFieldType F3 "unwrapF3" = Ptr (Ptr (FunPtr F3_Aux))
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'F4'
+
+    __C declaration:__ @f4@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 16:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F4_Aux
+    = F4_Aux {unwrapF4_Aux :: (IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toF4_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_83bcff023b3bc648_base ::
+    IO CInt
+ -> IO (FunPtr (IO CInt))
+-- __unique:__ @toF4_Aux@
+hs_bindgen_83bcff023b3bc648 :: F4_Aux -> IO (FunPtr F4_Aux)
+-- __unique:__ @toF4_Aux@
+hs_bindgen_83bcff023b3bc648 = \fun_0 -> fmap castFunPtr (hs_bindgen_83bcff023b3bc648_base (fmap toFFIType (getField @"unwrapF4_Aux" fun_0)))
+-- __unique:__ @fromF4_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_40f9a8d432b9eb97_base ::
+    FunPtr (IO CInt)
+ -> IO CInt
+-- __unique:__ @fromF4_Aux@
+hs_bindgen_40f9a8d432b9eb97 :: FunPtr F4_Aux -> F4_Aux
+-- __unique:__ @fromF4_Aux@
+hs_bindgen_40f9a8d432b9eb97 = \funPtr_0 -> F4_Aux (fmap fromFFIType (hs_bindgen_40f9a8d432b9eb97_base (castFunPtr funPtr_0)))
+instance ToFunPtr F4_Aux
+    where toFunPtr = hs_bindgen_83bcff023b3bc648
+instance FromFunPtr F4_Aux
+    where fromFunPtr = hs_bindgen_40f9a8d432b9eb97
+instance (~) ty (IO CInt) => HasField "unwrapF4_Aux" F4_Aux ty
+    where hasField = \x_0 -> (\y_1 -> F4_Aux{unwrapF4_Aux = y_1},
+                              getField @"unwrapF4_Aux" x_0)
+instance (~) ty (IO CInt) =>
+         HasField "unwrapF4_Aux" (Ptr F4_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF4_Aux")
+instance HasCField F4_Aux "unwrapF4_Aux"
+    where type CFieldType F4_Aux "unwrapF4_Aux" = IO CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @f4@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 16:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F4
+    = F4 {unwrapF4 :: (Ptr (FunPtr F4_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (FunPtr F4_Aux)) => HasField "unwrapF4" F4 ty
+    where hasField = \x_0 -> (\y_1 -> F4{unwrapF4 = y_1},
+                              getField @"unwrapF4" x_0)
+instance (~) ty (Ptr (FunPtr F4_Aux)) =>
+         HasField "unwrapF4" (Ptr F4) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF4")
+instance HasCField F4 "unwrapF4"
+    where type CFieldType F4 "unwrapF4" = Ptr (FunPtr F4_Aux)
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'F5'
+
+    __C declaration:__ @f5@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 19:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F5_Aux
+    = F5_Aux {unwrapF5_Aux :: (IO ())}
+    deriving stock Generic
+-- __unique:__ @toF5_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_6891cbd81d6f42b9_base ::
+    IO ()
+ -> IO (FunPtr (IO ()))
+-- __unique:__ @toF5_Aux@
+hs_bindgen_6891cbd81d6f42b9 :: F5_Aux -> IO (FunPtr F5_Aux)
+-- __unique:__ @toF5_Aux@
+hs_bindgen_6891cbd81d6f42b9 = \fun_0 -> fmap castFunPtr (hs_bindgen_6891cbd81d6f42b9_base (getField @"unwrapF5_Aux" fun_0))
+-- __unique:__ @fromF5_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_586f6635c057975f_base ::
+    FunPtr (IO ())
+ -> IO ()
+-- __unique:__ @fromF5_Aux@
+hs_bindgen_586f6635c057975f :: FunPtr F5_Aux -> F5_Aux
+-- __unique:__ @fromF5_Aux@
+hs_bindgen_586f6635c057975f = \funPtr_0 -> F5_Aux (hs_bindgen_586f6635c057975f_base (castFunPtr funPtr_0))
+instance ToFunPtr F5_Aux
+    where toFunPtr = hs_bindgen_6891cbd81d6f42b9
+instance FromFunPtr F5_Aux
+    where fromFunPtr = hs_bindgen_586f6635c057975f
+instance (~) ty (IO ()) => HasField "unwrapF5_Aux" F5_Aux ty
+    where hasField = \x_0 -> (\y_1 -> F5_Aux{unwrapF5_Aux = y_1},
+                              getField @"unwrapF5_Aux" x_0)
+instance (~) ty (IO ()) =>
+         HasField "unwrapF5_Aux" (Ptr F5_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF5_Aux")
+instance HasCField F5_Aux "unwrapF5_Aux"
+    where type CFieldType F5_Aux "unwrapF5_Aux" = IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @f5@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 19:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F5
+    = F5 {unwrapF5 :: (Ptr (FunPtr F5_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (FunPtr F5_Aux)) => HasField "unwrapF5" F5 ty
+    where hasField = \x_0 -> (\y_1 -> F5{unwrapF5 = y_1},
+                              getField @"unwrapF5" x_0)
+instance (~) ty (Ptr (FunPtr F5_Aux)) =>
+         HasField "unwrapF5" (Ptr F5) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF5")
+instance HasCField F5 "unwrapF5"
+    where type CFieldType F5 "unwrapF5" = Ptr (FunPtr F5_Aux)
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @MyInt@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 22:13@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype MyInt
+    = MyInt {unwrapMyInt :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyInt" MyInt ty
+    where hasField = \x_0 -> (\y_1 -> MyInt{unwrapMyInt = y_1},
+                              getField @"unwrapMyInt" x_0)
+instance (~) ty CInt => HasField "unwrapMyInt" (Ptr MyInt) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyInt")
+instance HasCField MyInt "unwrapMyInt"
+    where type CFieldType MyInt "unwrapMyInt" = CInt
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'F6'
+
+    __C declaration:__ @f6@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 23:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F6_Aux
+    = F6_Aux {unwrapF6_Aux :: (MyInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toF6_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_c1baf73f98614f45_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @toF6_Aux@
+hs_bindgen_c1baf73f98614f45 :: F6_Aux -> IO (FunPtr F6_Aux)
+-- __unique:__ @toF6_Aux@
+hs_bindgen_c1baf73f98614f45 = \fun_0 -> fmap castFunPtr (hs_bindgen_c1baf73f98614f45_base (\x_1 -> getField @"unwrapF6_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromF6_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_a887947b26e58f0c_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromF6_Aux@
+hs_bindgen_a887947b26e58f0c :: FunPtr F6_Aux -> F6_Aux
+-- __unique:__ @fromF6_Aux@
+hs_bindgen_a887947b26e58f0c = \funPtr_0 -> F6_Aux (\x_1 -> hs_bindgen_a887947b26e58f0c_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr F6_Aux
+    where toFunPtr = hs_bindgen_c1baf73f98614f45
+instance FromFunPtr F6_Aux
+    where fromFunPtr = hs_bindgen_a887947b26e58f0c
+instance (~) ty (MyInt -> IO ()) =>
+         HasField "unwrapF6_Aux" F6_Aux ty
+    where hasField = \x_0 -> (\y_1 -> F6_Aux{unwrapF6_Aux = y_1},
+                              getField @"unwrapF6_Aux" x_0)
+instance (~) ty (MyInt -> IO ()) =>
+         HasField "unwrapF6_Aux" (Ptr F6_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF6_Aux")
+instance HasCField F6_Aux "unwrapF6_Aux"
+    where type CFieldType F6_Aux "unwrapF6_Aux" = MyInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @f6@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h 23:17@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/multi_level.h@
+-}
+newtype F6
+    = F6 {unwrapF6 :: (Ptr (FunPtr F6_Aux))}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr (FunPtr F6_Aux)) => HasField "unwrapF6" F6 ty
+    where hasField = \x_0 -> (\y_1 -> F6{unwrapF6 = y_1},
+                              getField @"unwrapF6" x_0)
+instance (~) ty (Ptr (FunPtr F6_Aux)) =>
+         HasField "unwrapF6" (Ptr F6) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF6")
+instance HasCField F6 "unwrapF6"
+    where type CFieldType F6 "unwrapF6" = Ptr (FunPtr F6_Aux)
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/pointer/Example.hs b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/pointer/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/pointer/Example.hs
@@ -0,0 +1,132 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T_Aux(..)
+    , Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Eq, IO, Ord, Show, fmap, type (~))
+
+{-| Auxiliary type used by 'T'
+
+    __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/pointer.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/pointer.h@
+-}
+newtype T_Aux = T_Aux
+  { unwrapT_Aux :: BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toT_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5927fedc3abfa99c_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c ::
+     T_Aux
+  -> IO (BG.FunPtr T_Aux)
+hs_bindgen_5927fedc3abfa99c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_5927fedc3abfa99c_base (\x1 ->
+                                                            BG.getField @"unwrapT_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromT_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_281617c90fa9307a_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a ::
+     BG.FunPtr T_Aux
+  -> T_Aux
+hs_bindgen_281617c90fa9307a =
+  \funPtr0 ->
+    T_Aux (\x1 ->
+             hs_bindgen_281617c90fa9307a_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr T_Aux where
+
+  toFunPtr = hs_bindgen_5927fedc3abfa99c
+
+instance BG.FromFunPtr T_Aux where
+
+  fromFunPtr = hs_bindgen_281617c90fa9307a
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapT_Aux" T_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T_Aux {unwrapT_Aux = y1}, BG.getField @"unwrapT_Aux" x0)
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.HasField "unwrapT_Aux" (BG.Ptr T_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapT_Aux")
+
+instance HasCField.HasCField T_Aux "unwrapT_Aux" where
+
+  type CFieldType T_Aux "unwrapT_Aux" =
+    BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/pointer.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/pointer.h@
+-}
+newtype T = T
+  { unwrapT :: BG.FunPtr T_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr T_Aux
+         ) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance ( ty ~ BG.FunPtr T_Aux
+         ) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.FunPtr T_Aux
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/pointer/bindingspec.yaml b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/pointer/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/pointer/bindingspec.yaml
@@ -0,0 +1,32 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/typedefs/auxiliary/function-pointer/pointer.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/pointer/th.txt b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/pointer/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/pointer/th.txt
@@ -0,0 +1,65 @@
+-- addDependentFile test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/pointer.h
+{-| Auxiliary type used by 'T'
+
+    __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/pointer.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/pointer.h@
+-}
+newtype T_Aux
+    = T_Aux {unwrapT_Aux :: (CInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toT_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5927fedc3abfa99c_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c :: T_Aux -> IO (FunPtr T_Aux)
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c = \fun_0 -> fmap castFunPtr (hs_bindgen_5927fedc3abfa99c_base (\x_1 -> getField @"unwrapT_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromT_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_281617c90fa9307a_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a :: FunPtr T_Aux -> T_Aux
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a = \funPtr_0 -> T_Aux (\x_1 -> hs_bindgen_281617c90fa9307a_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr T_Aux
+    where toFunPtr = hs_bindgen_5927fedc3abfa99c
+instance FromFunPtr T_Aux
+    where fromFunPtr = hs_bindgen_281617c90fa9307a
+instance (~) ty (CInt -> IO ()) => HasField "unwrapT_Aux" T_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T_Aux{unwrapT_Aux = y_1},
+                              getField @"unwrapT_Aux" x_0)
+instance (~) ty (CInt -> IO ()) =>
+         HasField "unwrapT_Aux" (Ptr T_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT_Aux")
+instance HasCField T_Aux "unwrapT_Aux"
+    where type CFieldType T_Aux "unwrapT_Aux" = CInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/pointer.h 1:16@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/pointer.h@
+-}
+newtype T
+    = T {unwrapT :: (FunPtr T_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr T_Aux) => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty (FunPtr T_Aux) =>
+         HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = FunPtr T_Aux
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/qual/Example.hs b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/qual/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/qual/Example.hs
@@ -0,0 +1,132 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T_Aux(..)
+    , Example.T(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Eq, IO, Ord, Show, fmap, type (~))
+
+{-| Auxiliary type used by 'T'
+
+    __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/qual.h 1:23@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/qual.h@
+-}
+newtype T_Aux = T_Aux
+  { unwrapT_Aux :: BG.CInt -> IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toT_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5927fedc3abfa99c_base ::
+     (BG.CInt -> IO ())
+  -> IO (BG.FunPtr (BG.CInt -> IO ()))
+
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c ::
+     T_Aux
+  -> IO (BG.FunPtr T_Aux)
+hs_bindgen_5927fedc3abfa99c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_5927fedc3abfa99c_base (\x1 ->
+                                                            BG.getField @"unwrapT_Aux" fun0 (BG.fromFFIType x1)))
+
+-- __unique:__ @fromT_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_281617c90fa9307a_base ::
+     BG.FunPtr (BG.CInt -> IO ())
+  -> BG.CInt -> IO ()
+
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a ::
+     BG.FunPtr T_Aux
+  -> T_Aux
+hs_bindgen_281617c90fa9307a =
+  \funPtr0 ->
+    T_Aux (\x1 ->
+             hs_bindgen_281617c90fa9307a_base (BG.castFunPtr funPtr0) (BG.toFFIType x1))
+
+instance BG.ToFunPtr T_Aux where
+
+  toFunPtr = hs_bindgen_5927fedc3abfa99c
+
+instance BG.FromFunPtr T_Aux where
+
+  fromFunPtr = hs_bindgen_281617c90fa9307a
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.CompatHasField.HasField "unwrapT_Aux" T_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T_Aux {unwrapT_Aux = y1}, BG.getField @"unwrapT_Aux" x0)
+
+instance ( ty ~ (BG.CInt -> IO ())
+         ) => BG.HasField "unwrapT_Aux" (BG.Ptr T_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapT_Aux")
+
+instance HasCField.HasCField T_Aux "unwrapT_Aux" where
+
+  type CFieldType T_Aux "unwrapT_Aux" =
+    BG.CInt -> IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/qual.h 1:23@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/qual.h@
+-}
+newtype T = T
+  { unwrapT :: BG.FunPtr T_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr T_Aux
+         ) => BG.CompatHasField.HasField "unwrapT" T ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> T {unwrapT = y1}, BG.getField @"unwrapT" x0)
+
+instance ( ty ~ BG.FunPtr T_Aux
+         ) => BG.HasField "unwrapT" (BG.Ptr T) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT")
+
+instance HasCField.HasCField T "unwrapT" where
+
+  type CFieldType T "unwrapT" = BG.FunPtr T_Aux
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/qual/bindingspec.yaml b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/qual/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/qual/bindingspec.yaml
@@ -0,0 +1,32 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/typedefs/auxiliary/function-pointer/qual.h
+  cname: T
+  hsname: T
+hstypes:
+- hsname: T
+  representation:
+    newtype:
+      constructor: T
+      fields:
+      - unwrapT
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/qual/th.txt b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/qual/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/auxiliary/function-pointer/qual/th.txt
@@ -0,0 +1,65 @@
+-- addDependentFile test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/qual.h
+{-| Auxiliary type used by 'T'
+
+    __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/qual.h 1:23@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/qual.h@
+-}
+newtype T_Aux
+    = T_Aux {unwrapT_Aux :: (CInt -> IO ())}
+    deriving stock Generic
+-- __unique:__ @toT_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_5927fedc3abfa99c_base ::
+    CInt -> IO ()
+ -> IO (FunPtr (CInt -> IO ()))
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c :: T_Aux -> IO (FunPtr T_Aux)
+-- __unique:__ @toT_Aux@
+hs_bindgen_5927fedc3abfa99c = \fun_0 -> fmap castFunPtr (hs_bindgen_5927fedc3abfa99c_base (\x_1 -> getField @"unwrapT_Aux" fun_0 (fromFFIType x_1)))
+-- __unique:__ @fromT_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_281617c90fa9307a_base ::
+    FunPtr (CInt -> IO ())
+ -> CInt
+ -> IO ()
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a :: FunPtr T_Aux -> T_Aux
+-- __unique:__ @fromT_Aux@
+hs_bindgen_281617c90fa9307a = \funPtr_0 -> T_Aux (\x_1 -> hs_bindgen_281617c90fa9307a_base (castFunPtr funPtr_0) (toFFIType x_1))
+instance ToFunPtr T_Aux
+    where toFunPtr = hs_bindgen_5927fedc3abfa99c
+instance FromFunPtr T_Aux
+    where fromFunPtr = hs_bindgen_281617c90fa9307a
+instance (~) ty (CInt -> IO ()) => HasField "unwrapT_Aux" T_Aux ty
+    where hasField = \x_0 -> (\y_1 -> T_Aux{unwrapT_Aux = y_1},
+                              getField @"unwrapT_Aux" x_0)
+instance (~) ty (CInt -> IO ()) =>
+         HasField "unwrapT_Aux" (Ptr T_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT_Aux")
+instance HasCField T_Aux "unwrapT_Aux"
+    where type CFieldType T_Aux "unwrapT_Aux" = CInt -> IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T@
+
+    __defined at:__ @types\/typedefs\/auxiliary\/function-pointer\/qual.h 1:23@
+
+    __exported by:__ @types\/typedefs\/auxiliary\/function-pointer\/qual.h@
+-}
+newtype T
+    = T {unwrapT :: (FunPtr T_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr T_Aux) => HasField "unwrapT" T ty
+    where hasField = \x_0 -> (\y_1 -> T{unwrapT = y_1},
+                              getField @"unwrapT" x_0)
+instance (~) ty (FunPtr T_Aux) =>
+         HasField "unwrapT" (Ptr T) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT")
+instance HasCField T "unwrapT"
+    where type CFieldType T "unwrapT" = FunPtr T_Aux
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/typedef_vs_macro/Example.hs b/test-artefacts/fixtures/types/typedefs/typedef_vs_macro/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/typedef_vs_macro/Example.hs
@@ -0,0 +1,569 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.T1(..)
+    , Example.T2(..)
+    , Example.M1(..)
+    , Example.M2(..)
+    , Example.M3(..)
+    , Example.ExampleStruct(..)
+    , Example.Uint64_t(..)
+    , Example.Foo(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude ((<*>), (>>), Bounded, Enum, Eq, Int, Integral, Num, Ord, Read, Real, Show, pure, type (~))
+
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 1:13@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype T1 = T1
+  { unwrapT1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapT1" T1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T1 {unwrapT1 = y1}, BG.getField @"unwrapT1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapT1" (BG.Ptr T1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT1")
+
+instance HasCField.HasCField T1 "unwrapT1" where
+
+  type CFieldType T1 "unwrapT1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 2:14@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype T2 = T2
+  { unwrapT2 :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "unwrapT2" T2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         T2 {unwrapT2 = y1}, BG.getField @"unwrapT2" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "unwrapT2" (BG.Ptr T2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapT2")
+
+instance HasCField.HasCField T2 "unwrapT2" where
+
+  type CFieldType T2 "unwrapT2" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 4:9@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype M1 = M1
+  { unwrapM1 :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unwrapM1" M1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M1 {unwrapM1 = y1}, BG.getField @"unwrapM1" x0)
+
+instance (ty ~ BG.CInt) => BG.HasField "unwrapM1" (BG.Ptr M1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM1")
+
+instance HasCField.HasCField M1 "unwrapM1" where
+
+  type CFieldType M1 "unwrapM1" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M2@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 5:9@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype M2 = M2
+  { unwrapM2 :: BG.CChar
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance (ty ~ BG.CChar) => BG.CompatHasField.HasField "unwrapM2" M2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M2 {unwrapM2 = y1}, BG.getField @"unwrapM2" x0)
+
+instance (ty ~ BG.CChar) => BG.HasField "unwrapM2" (BG.Ptr M2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM2")
+
+instance HasCField.HasCField M2 "unwrapM2" where
+
+  type CFieldType M2 "unwrapM2" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 6:9@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype M3 = M3
+  { unwrapM3 :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapM3" M3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         M3 {unwrapM3 = y1}, BG.getField @"unwrapM3" x0)
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrapM3" (BG.Ptr M3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapM3")
+
+instance HasCField.HasCField M3 "unwrapM3" where
+
+  type CFieldType M3 "unwrapM3" = BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct ExampleStruct@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 8:8@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+data ExampleStruct = ExampleStruct
+  { exampleStruct_t1 :: T1
+    {- ^ __C declaration:__ @t1@
+
+         __defined at:__ @types\/typedefs\/typedef_vs_macro.h 9:6@
+
+         __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+    -}
+  , exampleStruct_t2 :: T2
+    {- ^ __C declaration:__ @t2@
+
+         __defined at:__ @types\/typedefs\/typedef_vs_macro.h 10:6@
+
+         __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+    -}
+  , exampleStruct_m1 :: M1
+    {- ^ __C declaration:__ @m1@
+
+         __defined at:__ @types\/typedefs\/typedef_vs_macro.h 11:6@
+
+         __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+    -}
+  , exampleStruct_m2 :: M2
+    {- ^ __C declaration:__ @m2@
+
+         __defined at:__ @types\/typedefs\/typedef_vs_macro.h 12:6@
+
+         __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize ExampleStruct where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw ExampleStruct where
+
+  readRaw =
+    \ptr0 ->
+          pure ExampleStruct
+      <*> HasCField.readRaw (BG.Proxy @"exampleStruct_t1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"exampleStruct_t2") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"exampleStruct_m1") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"exampleStruct_m2") ptr0
+
+instance Marshal.WriteRaw ExampleStruct where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ExampleStruct
+            exampleStruct_t12
+            exampleStruct_t23
+            exampleStruct_m14
+            exampleStruct_m25 ->
+                 HasCField.writeRaw (BG.Proxy @"exampleStruct_t1") ptr0 exampleStruct_t12
+              >> HasCField.writeRaw (BG.Proxy @"exampleStruct_t2") ptr0 exampleStruct_t23
+              >> HasCField.writeRaw (BG.Proxy @"exampleStruct_m1") ptr0 exampleStruct_m14
+              >> HasCField.writeRaw (BG.Proxy @"exampleStruct_m2") ptr0 exampleStruct_m25
+
+deriving via Marshal.EquivStorable ExampleStruct instance BG.Storable ExampleStruct
+
+deriving via Struct.IsStructViaReadRaw ExampleStruct instance Struct.IsStruct ExampleStruct
+
+{-| __C declaration:__ @t1@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 9:6@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+instance ( ty ~ T1
+         ) => BG.CompatHasField.HasField "exampleStruct_t1" ExampleStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ExampleStruct { exampleStruct_t1 = y1
+                        , exampleStruct_t2 = BG.getField @"exampleStruct_t2" x0
+                        , exampleStruct_m1 = BG.getField @"exampleStruct_m1" x0
+                        , exampleStruct_m2 = BG.getField @"exampleStruct_m2" x0
+                        }
+      , BG.getField @"exampleStruct_t1" x0
+      )
+
+instance ( ty ~ T1
+         ) => BG.HasField "exampleStruct_t1" (BG.Ptr ExampleStruct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exampleStruct_t1")
+
+instance HasCField.HasCField ExampleStruct "exampleStruct_t1" where
+
+  type CFieldType ExampleStruct "exampleStruct_t1" = T1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @t2@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 10:6@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+instance ( ty ~ T2
+         ) => BG.CompatHasField.HasField "exampleStruct_t2" ExampleStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ExampleStruct { exampleStruct_t2 = y1
+                        , exampleStruct_t1 = BG.getField @"exampleStruct_t1" x0
+                        , exampleStruct_m1 = BG.getField @"exampleStruct_m1" x0
+                        , exampleStruct_m2 = BG.getField @"exampleStruct_m2" x0
+                        }
+      , BG.getField @"exampleStruct_t2" x0
+      )
+
+instance ( ty ~ T2
+         ) => BG.HasField "exampleStruct_t2" (BG.Ptr ExampleStruct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exampleStruct_t2")
+
+instance HasCField.HasCField ExampleStruct "exampleStruct_t2" where
+
+  type CFieldType ExampleStruct "exampleStruct_t2" = T2
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @m1@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 11:6@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+instance ( ty ~ M1
+         ) => BG.CompatHasField.HasField "exampleStruct_m1" ExampleStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ExampleStruct { exampleStruct_m1 = y1
+                        , exampleStruct_t1 = BG.getField @"exampleStruct_t1" x0
+                        , exampleStruct_t2 = BG.getField @"exampleStruct_t2" x0
+                        , exampleStruct_m2 = BG.getField @"exampleStruct_m2" x0
+                        }
+      , BG.getField @"exampleStruct_m1" x0
+      )
+
+instance ( ty ~ M1
+         ) => BG.HasField "exampleStruct_m1" (BG.Ptr ExampleStruct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exampleStruct_m1")
+
+instance HasCField.HasCField ExampleStruct "exampleStruct_m1" where
+
+  type CFieldType ExampleStruct "exampleStruct_m1" = M1
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @m2@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 12:6@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+instance ( ty ~ M2
+         ) => BG.CompatHasField.HasField "exampleStruct_m2" ExampleStruct ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          ExampleStruct { exampleStruct_m2 = y1
+                        , exampleStruct_t1 = BG.getField @"exampleStruct_t1" x0
+                        , exampleStruct_t2 = BG.getField @"exampleStruct_t2" x0
+                        , exampleStruct_m1 = BG.getField @"exampleStruct_m1" x0
+                        }
+      , BG.getField @"exampleStruct_m2" x0
+      )
+
+instance ( ty ~ M2
+         ) => BG.HasField "exampleStruct_m2" (BG.Ptr ExampleStruct) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exampleStruct_m2")
+
+instance HasCField.HasCField ExampleStruct "exampleStruct_m2" where
+
+  type CFieldType ExampleStruct "exampleStruct_m2" = M2
+
+  offset# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @macro uint64_t@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 15:9@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype Uint64_t = Uint64_t
+  { unwrapUint64_t :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapUint64_t" Uint64_t ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Uint64_t {unwrapUint64_t = y1}, BG.getField @"unwrapUint64_t" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapUint64_t" (BG.Ptr Uint64_t) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapUint64_t")
+
+instance HasCField.HasCField Uint64_t "unwrapUint64_t" where
+
+  type CFieldType Uint64_t "unwrapUint64_t" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 17:8@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+data Foo = Foo
+  { foo_a :: BG.Ptr Uint64_t
+    {- ^ __C declaration:__ @a@
+
+         __defined at:__ @types\/typedefs\/typedef_vs_macro.h 18:13@
+
+         __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Foo where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw Foo where
+
+  readRaw =
+    \ptr0 ->
+          pure Foo
+      <*> HasCField.readRaw (BG.Proxy @"foo_a") ptr0
+
+instance Marshal.WriteRaw Foo where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Foo foo_a2 ->
+            HasCField.writeRaw (BG.Proxy @"foo_a") ptr0 foo_a2
+
+deriving via Marshal.EquivStorable Foo instance BG.Storable Foo
+
+deriving via Struct.IsStructViaReadRaw Foo instance Struct.IsStruct Foo
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 18:13@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+instance ( ty ~ BG.Ptr Uint64_t
+         ) => BG.CompatHasField.HasField "foo_a" Foo ty where
+
+  hasField =
+    \x0 ->
+      (\y1 -> Foo {foo_a = y1}, BG.getField @"foo_a" x0)
+
+instance ( ty ~ BG.Ptr Uint64_t
+         ) => BG.HasField "foo_a" (BG.Ptr Foo) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"foo_a")
+
+instance HasCField.HasCField Foo "foo_a" where
+
+  type CFieldType Foo "foo_a" = BG.Ptr Uint64_t
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/typedef_vs_macro/bindingspec.yaml b/test-artefacts/fixtures/types/typedefs/typedef_vs_macro/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/typedef_vs_macro/bindingspec.yaml
@@ -0,0 +1,264 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/typedefs/typedef_vs_macro.h
+  cname: T1
+  hsname: T1
+- headers: types/typedefs/typedef_vs_macro.h
+  cname: T2
+  hsname: T2
+- headers: types/typedefs/typedef_vs_macro.h
+  cname: macro M1
+  hsname: M1
+- headers: types/typedefs/typedef_vs_macro.h
+  cname: macro M2
+  hsname: M2
+- headers: types/typedefs/typedef_vs_macro.h
+  cname: macro M3
+  hsname: M3
+- headers: types/typedefs/typedef_vs_macro.h
+  cname: struct ExampleStruct
+  hsname: ExampleStruct
+- headers: types/typedefs/typedef_vs_macro.h
+  cname: macro uint64_t
+  hsname: Uint64_t
+- headers: types/typedefs/typedef_vs_macro.h
+  cname: struct foo
+  hsname: Foo
+hstypes:
+- hsname: ExampleStruct
+  representation:
+    record:
+      constructor: ExampleStruct
+      fields:
+      - exampleStruct_t1
+      - exampleStruct_t2
+      - exampleStruct_m1
+      - exampleStruct_m2
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo
+  representation:
+    record:
+      constructor: Foo
+      fields:
+      - foo_a
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: M1
+  representation:
+    newtype:
+      constructor: M1
+      fields:
+      - unwrapM1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: M2
+  representation:
+    newtype:
+      constructor: M2
+      fields:
+      - unwrapM2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: M3
+  representation:
+    newtype:
+      constructor: M3
+      fields:
+      - unwrapM3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T1
+  representation:
+    newtype:
+      constructor: T1
+      fields:
+      - unwrapT1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: T2
+  representation:
+    newtype:
+      constructor: T2
+      fields:
+      - unwrapT2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CChar
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Uint64_t
+  representation:
+    newtype:
+      constructor: Uint64_t
+      fields:
+      - unwrapUint64_t
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/typedefs/typedef_vs_macro/th.txt b/test-artefacts/fixtures/types/typedefs/typedef_vs_macro/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/typedef_vs_macro/th.txt
@@ -0,0 +1,315 @@
+-- addDependentFile test-artefacts/headers/golden/types/typedefs/typedef_vs_macro.h
+{-| __C declaration:__ @T1@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 1:13@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype T1
+    = T1 {unwrapT1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapT1" T1 ty
+    where hasField = \x_0 -> (\y_1 -> T1{unwrapT1 = y_1},
+                              getField @"unwrapT1" x_0)
+instance (~) ty CInt => HasField "unwrapT1" (Ptr T1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT1")
+instance HasCField T1 "unwrapT1"
+    where type CFieldType T1 "unwrapT1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @T2@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 2:14@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype T2
+    = T2 {unwrapT2 :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapT2" T2 ty
+    where hasField = \x_0 -> (\y_1 -> T2{unwrapT2 = y_1},
+                              getField @"unwrapT2" x_0)
+instance (~) ty CChar => HasField "unwrapT2" (Ptr T2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapT2")
+instance HasCField T2 "unwrapT2"
+    where type CFieldType T2 "unwrapT2" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M1@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 4:9@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype M1
+    = M1 {unwrapM1 :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapM1" M1 ty
+    where hasField = \x_0 -> (\y_1 -> M1{unwrapM1 = y_1},
+                              getField @"unwrapM1" x_0)
+instance (~) ty CInt => HasField "unwrapM1" (Ptr M1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM1")
+instance HasCField M1 "unwrapM1"
+    where type CFieldType M1 "unwrapM1" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M2@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 5:9@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype M2
+    = M2 {unwrapM2 :: CChar}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CChar => HasField "unwrapM2" M2 ty
+    where hasField = \x_0 -> (\y_1 -> M2{unwrapM2 = y_1},
+                              getField @"unwrapM2" x_0)
+instance (~) ty CChar => HasField "unwrapM2" (Ptr M2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM2")
+instance HasCField M2 "unwrapM2"
+    where type CFieldType M2 "unwrapM2" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @macro M3@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 6:9@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype M3
+    = M3 {unwrapM3 :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) => HasField "unwrapM3" M3 ty
+    where hasField = \x_0 -> (\y_1 -> M3{unwrapM3 = y_1},
+                              getField @"unwrapM3" x_0)
+instance (~) ty (Ptr CInt) => HasField "unwrapM3" (Ptr M3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapM3")
+instance HasCField M3 "unwrapM3"
+    where type CFieldType M3 "unwrapM3" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct ExampleStruct@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 8:8@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+data ExampleStruct
+    = ExampleStruct {exampleStruct_t1 :: T1
+                     {- ^ __C declaration:__ @t1@
+
+                          __defined at:__ @types\/typedefs\/typedef_vs_macro.h 9:6@
+
+                          __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+                     -},
+                     exampleStruct_t2 :: T2
+                     {- ^ __C declaration:__ @t2@
+
+                          __defined at:__ @types\/typedefs\/typedef_vs_macro.h 10:6@
+
+                          __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+                     -},
+                     exampleStruct_m1 :: M1
+                     {- ^ __C declaration:__ @m1@
+
+                          __defined at:__ @types\/typedefs\/typedef_vs_macro.h 11:6@
+
+                          __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+                     -},
+                     exampleStruct_m2 :: M2
+                     {- ^ __C declaration:__ @m2@
+
+                          __defined at:__ @types\/typedefs\/typedef_vs_macro.h 12:6@
+
+                          __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+                     -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize ExampleStruct
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw ExampleStruct
+    where readRaw = \ptr_0 -> (((pure ExampleStruct <*> readRaw (Proxy @"exampleStruct_t1") ptr_0) <*> readRaw (Proxy @"exampleStruct_t2") ptr_0) <*> readRaw (Proxy @"exampleStruct_m1") ptr_0) <*> readRaw (Proxy @"exampleStruct_m2") ptr_0
+instance WriteRaw ExampleStruct
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       ExampleStruct exampleStruct_t1_2
+                                                     exampleStruct_t2_3
+                                                     exampleStruct_m1_4
+                                                     exampleStruct_m2_5 -> writeRaw (Proxy @"exampleStruct_t1") ptr_0 exampleStruct_t1_2 >> (writeRaw (Proxy @"exampleStruct_t2") ptr_0 exampleStruct_t2_3 >> (writeRaw (Proxy @"exampleStruct_m1") ptr_0 exampleStruct_m1_4 >> writeRaw (Proxy @"exampleStruct_m2") ptr_0 exampleStruct_m2_5))
+deriving via (EquivStorable ExampleStruct) instance Storable ExampleStruct
+deriving via (IsStructViaReadRaw ExampleStruct) instance IsStruct ExampleStruct
+instance (~) ty T1 => HasField "exampleStruct_t1" ExampleStruct ty
+    where hasField = \x_0 -> (\y_1 -> ExampleStruct{exampleStruct_t1 = y_1,
+                                                    exampleStruct_t2 = getField @"exampleStruct_t2" x_0,
+                                                    exampleStruct_m1 = getField @"exampleStruct_m1" x_0,
+                                                    exampleStruct_m2 = getField @"exampleStruct_m2" x_0},
+                              getField @"exampleStruct_t1" x_0)
+instance (~) ty T1 =>
+         HasField "exampleStruct_t1" (Ptr ExampleStruct) (Ptr ty)
+    where getField = fromPtr (Proxy @"exampleStruct_t1")
+instance HasCField ExampleStruct "exampleStruct_t1"
+    where type CFieldType ExampleStruct "exampleStruct_t1" = T1
+          offset# = \_ -> \_ -> 0
+instance (~) ty T2 => HasField "exampleStruct_t2" ExampleStruct ty
+    where hasField = \x_0 -> (\y_1 -> ExampleStruct{exampleStruct_t2 = y_1,
+                                                    exampleStruct_t1 = getField @"exampleStruct_t1" x_0,
+                                                    exampleStruct_m1 = getField @"exampleStruct_m1" x_0,
+                                                    exampleStruct_m2 = getField @"exampleStruct_m2" x_0},
+                              getField @"exampleStruct_t2" x_0)
+instance (~) ty T2 =>
+         HasField "exampleStruct_t2" (Ptr ExampleStruct) (Ptr ty)
+    where getField = fromPtr (Proxy @"exampleStruct_t2")
+instance HasCField ExampleStruct "exampleStruct_t2"
+    where type CFieldType ExampleStruct "exampleStruct_t2" = T2
+          offset# = \_ -> \_ -> 4
+instance (~) ty M1 => HasField "exampleStruct_m1" ExampleStruct ty
+    where hasField = \x_0 -> (\y_1 -> ExampleStruct{exampleStruct_m1 = y_1,
+                                                    exampleStruct_t1 = getField @"exampleStruct_t1" x_0,
+                                                    exampleStruct_t2 = getField @"exampleStruct_t2" x_0,
+                                                    exampleStruct_m2 = getField @"exampleStruct_m2" x_0},
+                              getField @"exampleStruct_m1" x_0)
+instance (~) ty M1 =>
+         HasField "exampleStruct_m1" (Ptr ExampleStruct) (Ptr ty)
+    where getField = fromPtr (Proxy @"exampleStruct_m1")
+instance HasCField ExampleStruct "exampleStruct_m1"
+    where type CFieldType ExampleStruct "exampleStruct_m1" = M1
+          offset# = \_ -> \_ -> 8
+instance (~) ty M2 => HasField "exampleStruct_m2" ExampleStruct ty
+    where hasField = \x_0 -> (\y_1 -> ExampleStruct{exampleStruct_m2 = y_1,
+                                                    exampleStruct_t1 = getField @"exampleStruct_t1" x_0,
+                                                    exampleStruct_t2 = getField @"exampleStruct_t2" x_0,
+                                                    exampleStruct_m1 = getField @"exampleStruct_m1" x_0},
+                              getField @"exampleStruct_m2" x_0)
+instance (~) ty M2 =>
+         HasField "exampleStruct_m2" (Ptr ExampleStruct) (Ptr ty)
+    where getField = fromPtr (Proxy @"exampleStruct_m2")
+instance HasCField ExampleStruct "exampleStruct_m2"
+    where type CFieldType ExampleStruct "exampleStruct_m2" = M2
+          offset# = \_ -> \_ -> 12
+{-| __C declaration:__ @macro uint64_t@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 15:9@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+newtype Uint64_t
+    = Uint64_t {unwrapUint64_t :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapUint64_t" Uint64_t ty
+    where hasField = \x_0 -> (\y_1 -> Uint64_t{unwrapUint64_t = y_1},
+                              getField @"unwrapUint64_t" x_0)
+instance (~) ty CInt =>
+         HasField "unwrapUint64_t" (Ptr Uint64_t) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapUint64_t")
+instance HasCField Uint64_t "unwrapUint64_t"
+    where type CFieldType Uint64_t "unwrapUint64_t" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct foo@
+
+    __defined at:__ @types\/typedefs\/typedef_vs_macro.h 17:8@
+
+    __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+-}
+data Foo
+    = Foo {foo_a :: (Ptr Uint64_t)
+           {- ^ __C declaration:__ @a@
+
+                __defined at:__ @types\/typedefs\/typedef_vs_macro.h 18:13@
+
+                __exported by:__ @types\/typedefs\/typedef_vs_macro.h@
+           -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Foo
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw Foo
+    where readRaw = \ptr_0 -> pure Foo <*> readRaw (Proxy @"foo_a") ptr_0
+instance WriteRaw Foo
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Foo foo_a_2 -> writeRaw (Proxy @"foo_a") ptr_0 foo_a_2
+deriving via (EquivStorable Foo) instance Storable Foo
+deriving via (IsStructViaReadRaw Foo) instance IsStruct Foo
+instance (~) ty (Ptr Uint64_t) => HasField "foo_a" Foo ty
+    where hasField = \x_0 -> (\y_1 -> Foo{foo_a = y_1},
+                              getField @"foo_a" x_0)
+instance (~) ty (Ptr Uint64_t) =>
+         HasField "foo_a" (Ptr Foo) (Ptr ty)
+    where getField = fromPtr (Proxy @"foo_a")
+instance HasCField Foo "foo_a"
+    where type CFieldType Foo "foo_a" = Ptr Uint64_t
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/typedefs/Example.hs b/test-artefacts/fixtures/types/typedefs/typedefs/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/typedefs/Example.hs
@@ -0,0 +1,704 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Myint(..)
+    , Example.Intptr(..)
+    , Example.Int2int(..)
+    , Example.FunctionPointer_Function_Aux(..)
+    , Example.FunctionPointer_Function(..)
+    , Example.NonFunctionPointer_Function(..)
+    , Example.F1_Aux(..)
+    , Example.F1(..)
+    , Example.G1(..)
+    , Example.G2(..)
+    , Example.H1(..)
+    , Example.H2(..)
+    , Example.H3(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import Prelude (Bounded, Enum, Eq, IO, Integral, Num, Ord, Read, Real, Show, fmap, type (~))
+
+{-| __C declaration:__ @myint@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 1:13@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype Myint = Myint
+  { unwrapMyint :: BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Read, Show)
+  deriving newtype
+    ( BG.Bitfield
+    , BG.Bits
+    , Bounded
+    , Enum
+    , BG.FiniteBits
+    , BG.HasFFIType
+    , Integral
+    , BG.Ix
+    , Num
+    , BG.Prim
+    , Marshal.ReadRaw
+    , Real
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapMyint" Myint ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Myint {unwrapMyint = y1}, BG.getField @"unwrapMyint" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unwrapMyint" (BG.Ptr Myint) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapMyint")
+
+instance HasCField.HasCField Myint "unwrapMyint" where
+
+  type CFieldType Myint "unwrapMyint" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @intptr@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 2:15@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype Intptr = Intptr
+  { unwrapIntptr :: BG.Ptr BG.CInt
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.CompatHasField.HasField "unwrapIntptr" Intptr ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Intptr {unwrapIntptr = y1}, BG.getField @"unwrapIntptr" x0)
+
+instance ( ty ~ BG.Ptr BG.CInt
+         ) => BG.HasField "unwrapIntptr" (BG.Ptr Intptr) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapIntptr")
+
+instance HasCField.HasCField Intptr "unwrapIntptr" where
+
+  type CFieldType Intptr "unwrapIntptr" =
+    BG.Ptr BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @int2int@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 5:13@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype Int2int = Int2int
+  { unwrapInt2int :: BG.CInt -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toInt2int@
+foreign import ccall safe "wrapper" hs_bindgen_a6c7dd49f5b9d470_base ::
+     (BG.CInt -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+
+-- __unique:__ @toInt2int@
+hs_bindgen_a6c7dd49f5b9d470 ::
+     Int2int
+  -> IO (BG.FunPtr Int2int)
+hs_bindgen_a6c7dd49f5b9d470 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_a6c7dd49f5b9d470_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrapInt2int" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromInt2int@
+foreign import ccall safe "dynamic" hs_bindgen_65378a8a3cf640ad_base ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> BG.CInt -> IO BG.CInt
+
+-- __unique:__ @fromInt2int@
+hs_bindgen_65378a8a3cf640ad ::
+     BG.FunPtr Int2int
+  -> Int2int
+hs_bindgen_65378a8a3cf640ad =
+  \funPtr0 ->
+    Int2int (\x1 ->
+               fmap BG.fromFFIType (hs_bindgen_65378a8a3cf640ad_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr Int2int where
+
+  toFunPtr = hs_bindgen_a6c7dd49f5b9d470
+
+instance BG.FromFunPtr Int2int where
+
+  fromFunPtr = hs_bindgen_65378a8a3cf640ad
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapInt2int" Int2int ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         Int2int {unwrapInt2int = y1}, BG.getField @"unwrapInt2int" x0)
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "unwrapInt2int" (BG.Ptr Int2int) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapInt2int")
+
+instance HasCField.HasCField Int2int "unwrapInt2int" where
+
+  type CFieldType Int2int "unwrapInt2int" =
+    BG.CInt -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'FunctionPointer_Function'
+
+    __C declaration:__ @FunctionPointer_Function@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 8:16@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype FunctionPointer_Function_Aux = FunctionPointer_Function_Aux
+  { unwrapFunctionPointer_Function_Aux :: IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toFunctionPointer_Function_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b171c028cdc0781d_base ::
+     IO ()
+  -> IO (BG.FunPtr (IO ()))
+
+-- __unique:__ @toFunctionPointer_Function_Aux@
+hs_bindgen_b171c028cdc0781d ::
+     FunctionPointer_Function_Aux
+  -> IO (BG.FunPtr FunctionPointer_Function_Aux)
+hs_bindgen_b171c028cdc0781d =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_b171c028cdc0781d_base (BG.getField @"unwrapFunctionPointer_Function_Aux" fun0))
+
+-- __unique:__ @fromFunctionPointer_Function_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_4c3da8240a31e036_base ::
+     BG.FunPtr (IO ())
+  -> IO ()
+
+-- __unique:__ @fromFunctionPointer_Function_Aux@
+hs_bindgen_4c3da8240a31e036 ::
+     BG.FunPtr FunctionPointer_Function_Aux
+  -> FunctionPointer_Function_Aux
+hs_bindgen_4c3da8240a31e036 =
+  \funPtr0 ->
+    FunctionPointer_Function_Aux (hs_bindgen_4c3da8240a31e036_base (BG.castFunPtr funPtr0))
+
+instance BG.ToFunPtr FunctionPointer_Function_Aux where
+
+  toFunPtr = hs_bindgen_b171c028cdc0781d
+
+instance BG.FromFunPtr FunctionPointer_Function_Aux where
+
+  fromFunPtr = hs_bindgen_4c3da8240a31e036
+
+instance ( ty ~ IO ()
+         ) => BG.CompatHasField.HasField "unwrapFunctionPointer_Function_Aux" FunctionPointer_Function_Aux ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FunctionPointer_Function_Aux {unwrapFunctionPointer_Function_Aux = y1}
+      , BG.getField @"unwrapFunctionPointer_Function_Aux" x0
+      )
+
+instance ( ty ~ IO ()
+         ) => BG.HasField "unwrapFunctionPointer_Function_Aux" (BG.Ptr FunctionPointer_Function_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunctionPointer_Function_Aux")
+
+instance HasCField.HasCField FunctionPointer_Function_Aux "unwrapFunctionPointer_Function_Aux" where
+
+  type CFieldType FunctionPointer_Function_Aux "unwrapFunctionPointer_Function_Aux" =
+    IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @FunctionPointer_Function@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 8:16@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype FunctionPointer_Function = FunctionPointer_Function
+  { unwrapFunctionPointer_Function :: BG.FunPtr FunctionPointer_Function_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr FunctionPointer_Function_Aux
+         ) => BG.CompatHasField.HasField "unwrapFunctionPointer_Function" FunctionPointer_Function ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          FunctionPointer_Function {unwrapFunctionPointer_Function = y1}
+      , BG.getField @"unwrapFunctionPointer_Function" x0
+      )
+
+instance ( ty ~ BG.FunPtr FunctionPointer_Function_Aux
+         ) => BG.HasField "unwrapFunctionPointer_Function" (BG.Ptr FunctionPointer_Function) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapFunctionPointer_Function")
+
+instance HasCField.HasCField FunctionPointer_Function "unwrapFunctionPointer_Function" where
+
+  type CFieldType FunctionPointer_Function "unwrapFunctionPointer_Function" =
+    BG.FunPtr FunctionPointer_Function_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @NonFunctionPointer_Function@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 9:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype NonFunctionPointer_Function = NonFunctionPointer_Function
+  { unwrapNonFunctionPointer_Function :: BG.CInt -> IO BG.CInt
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toNonFunctionPointer_Function@
+foreign import ccall safe "wrapper" hs_bindgen_766ae751d60365e9_base ::
+     (BG.CInt -> IO BG.CInt)
+  -> IO (BG.FunPtr (BG.CInt -> IO BG.CInt))
+
+-- __unique:__ @toNonFunctionPointer_Function@
+hs_bindgen_766ae751d60365e9 ::
+     NonFunctionPointer_Function
+  -> IO (BG.FunPtr NonFunctionPointer_Function)
+hs_bindgen_766ae751d60365e9 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_766ae751d60365e9_base (\x1 ->
+                                                            fmap BG.toFFIType (BG.getField @"unwrapNonFunctionPointer_Function" fun0 (BG.fromFFIType x1))))
+
+-- __unique:__ @fromNonFunctionPointer_Function@
+foreign import ccall safe "dynamic" hs_bindgen_36c7108d046bcbc3_base ::
+     BG.FunPtr (BG.CInt -> IO BG.CInt)
+  -> BG.CInt -> IO BG.CInt
+
+-- __unique:__ @fromNonFunctionPointer_Function@
+hs_bindgen_36c7108d046bcbc3 ::
+     BG.FunPtr NonFunctionPointer_Function
+  -> NonFunctionPointer_Function
+hs_bindgen_36c7108d046bcbc3 =
+  \funPtr0 ->
+    NonFunctionPointer_Function (\x1 ->
+                                   fmap BG.fromFFIType (hs_bindgen_36c7108d046bcbc3_base (BG.castFunPtr funPtr0) (BG.toFFIType x1)))
+
+instance BG.ToFunPtr NonFunctionPointer_Function where
+
+  toFunPtr = hs_bindgen_766ae751d60365e9
+
+instance BG.FromFunPtr NonFunctionPointer_Function where
+
+  fromFunPtr = hs_bindgen_36c7108d046bcbc3
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.CompatHasField.HasField "unwrapNonFunctionPointer_Function" NonFunctionPointer_Function ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          NonFunctionPointer_Function {unwrapNonFunctionPointer_Function = y1}
+      , BG.getField @"unwrapNonFunctionPointer_Function" x0
+      )
+
+instance ( ty ~ (BG.CInt -> IO BG.CInt)
+         ) => BG.HasField "unwrapNonFunctionPointer_Function" (BG.Ptr NonFunctionPointer_Function) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapNonFunctionPointer_Function")
+
+instance HasCField.HasCField NonFunctionPointer_Function "unwrapNonFunctionPointer_Function" where
+
+  type CFieldType NonFunctionPointer_Function "unwrapNonFunctionPointer_Function" =
+    BG.CInt -> IO BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| Auxiliary type used by 'F1'
+
+    __C declaration:__ @f1@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 11:16@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype F1_Aux = F1_Aux
+  { unwrapF1_Aux :: IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toF1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_00d16e666202ed6c_base ::
+     IO ()
+  -> IO (BG.FunPtr (IO ()))
+
+-- __unique:__ @toF1_Aux@
+hs_bindgen_00d16e666202ed6c ::
+     F1_Aux
+  -> IO (BG.FunPtr F1_Aux)
+hs_bindgen_00d16e666202ed6c =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_00d16e666202ed6c_base (BG.getField @"unwrapF1_Aux" fun0))
+
+-- __unique:__ @fromF1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ddeb5206e8192425_base ::
+     BG.FunPtr (IO ())
+  -> IO ()
+
+-- __unique:__ @fromF1_Aux@
+hs_bindgen_ddeb5206e8192425 ::
+     BG.FunPtr F1_Aux
+  -> F1_Aux
+hs_bindgen_ddeb5206e8192425 =
+  \funPtr0 ->
+    F1_Aux (hs_bindgen_ddeb5206e8192425_base (BG.castFunPtr funPtr0))
+
+instance BG.ToFunPtr F1_Aux where
+
+  toFunPtr = hs_bindgen_00d16e666202ed6c
+
+instance BG.FromFunPtr F1_Aux where
+
+  fromFunPtr = hs_bindgen_ddeb5206e8192425
+
+instance ( ty ~ IO ()
+         ) => BG.CompatHasField.HasField "unwrapF1_Aux" F1_Aux ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F1_Aux {unwrapF1_Aux = y1}, BG.getField @"unwrapF1_Aux" x0)
+
+instance ( ty ~ IO ()
+         ) => BG.HasField "unwrapF1_Aux" (BG.Ptr F1_Aux) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"unwrapF1_Aux")
+
+instance HasCField.HasCField F1_Aux "unwrapF1_Aux" where
+
+  type CFieldType F1_Aux "unwrapF1_Aux" = IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 11:16@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype F1 = F1
+  { unwrapF1 :: BG.FunPtr F1_Aux
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr F1_Aux
+         ) => BG.CompatHasField.HasField "unwrapF1" F1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         F1 {unwrapF1 = y1}, BG.getField @"unwrapF1" x0)
+
+instance ( ty ~ BG.FunPtr F1_Aux
+         ) => BG.HasField "unwrapF1" (BG.Ptr F1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapF1")
+
+instance HasCField.HasCField F1 "unwrapF1" where
+
+  type CFieldType F1 "unwrapF1" = BG.FunPtr F1_Aux
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @g1@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 13:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype G1 = G1
+  { unwrapG1 :: IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toG1@
+foreign import ccall safe "wrapper" hs_bindgen_fa5806570b682579_base ::
+     IO ()
+  -> IO (BG.FunPtr (IO ()))
+
+-- __unique:__ @toG1@
+hs_bindgen_fa5806570b682579 ::
+     G1
+  -> IO (BG.FunPtr G1)
+hs_bindgen_fa5806570b682579 =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_fa5806570b682579_base (BG.getField @"unwrapG1" fun0))
+
+-- __unique:__ @fromG1@
+foreign import ccall safe "dynamic" hs_bindgen_8405c8e75aa78be5_base ::
+     BG.FunPtr (IO ())
+  -> IO ()
+
+-- __unique:__ @fromG1@
+hs_bindgen_8405c8e75aa78be5 ::
+     BG.FunPtr G1
+  -> G1
+hs_bindgen_8405c8e75aa78be5 =
+  \funPtr0 ->
+    G1 (hs_bindgen_8405c8e75aa78be5_base (BG.castFunPtr funPtr0))
+
+instance BG.ToFunPtr G1 where
+
+  toFunPtr = hs_bindgen_fa5806570b682579
+
+instance BG.FromFunPtr G1 where
+
+  fromFunPtr = hs_bindgen_8405c8e75aa78be5
+
+instance (ty ~ IO ()) => BG.CompatHasField.HasField "unwrapG1" G1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         G1 {unwrapG1 = y1}, BG.getField @"unwrapG1" x0)
+
+instance (ty ~ IO ()) => BG.HasField "unwrapG1" (BG.Ptr G1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapG1")
+
+instance HasCField.HasCField G1 "unwrapG1" where
+
+  type CFieldType G1 "unwrapG1" = IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @g2@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 14:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype G2 = G2
+  { unwrapG2 :: BG.FunPtr G1
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr G1
+         ) => BG.CompatHasField.HasField "unwrapG2" G2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         G2 {unwrapG2 = y1}, BG.getField @"unwrapG2" x0)
+
+instance ( ty ~ BG.FunPtr G1
+         ) => BG.HasField "unwrapG2" (BG.Ptr G2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapG2")
+
+instance HasCField.HasCField G2 "unwrapG2" where
+
+  type CFieldType G2 "unwrapG2" = BG.FunPtr G1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @h1@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 16:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype H1 = H1
+  { unwrapH1 :: IO ()
+  }
+  deriving stock (BG.Generic)
+
+-- __unique:__ @toH1@
+foreign import ccall safe "wrapper" hs_bindgen_ffae0d1234ed018f_base ::
+     IO ()
+  -> IO (BG.FunPtr (IO ()))
+
+-- __unique:__ @toH1@
+hs_bindgen_ffae0d1234ed018f ::
+     H1
+  -> IO (BG.FunPtr H1)
+hs_bindgen_ffae0d1234ed018f =
+  \fun0 ->
+    fmap BG.castFunPtr (hs_bindgen_ffae0d1234ed018f_base (BG.getField @"unwrapH1" fun0))
+
+-- __unique:__ @fromH1@
+foreign import ccall safe "dynamic" hs_bindgen_1a33688324e1924f_base ::
+     BG.FunPtr (IO ())
+  -> IO ()
+
+-- __unique:__ @fromH1@
+hs_bindgen_1a33688324e1924f ::
+     BG.FunPtr H1
+  -> H1
+hs_bindgen_1a33688324e1924f =
+  \funPtr0 ->
+    H1 (hs_bindgen_1a33688324e1924f_base (BG.castFunPtr funPtr0))
+
+instance BG.ToFunPtr H1 where
+
+  toFunPtr = hs_bindgen_ffae0d1234ed018f
+
+instance BG.FromFunPtr H1 where
+
+  fromFunPtr = hs_bindgen_1a33688324e1924f
+
+instance (ty ~ IO ()) => BG.CompatHasField.HasField "unwrapH1" H1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         H1 {unwrapH1 = y1}, BG.getField @"unwrapH1" x0)
+
+instance (ty ~ IO ()) => BG.HasField "unwrapH1" (BG.Ptr H1) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapH1")
+
+instance HasCField.HasCField H1 "unwrapH1" where
+
+  type CFieldType H1 "unwrapH1" = IO ()
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @h2@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 17:12@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype H2 = H2
+  { unwrapH2 :: H1
+  }
+  deriving stock (BG.Generic)
+
+instance (ty ~ H1) => BG.CompatHasField.HasField "unwrapH2" H2 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         H2 {unwrapH2 = y1}, BG.getField @"unwrapH2" x0)
+
+instance (ty ~ H1) => BG.HasField "unwrapH2" (BG.Ptr H2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapH2")
+
+instance HasCField.HasCField H2 "unwrapH2" where
+
+  type CFieldType H2 "unwrapH2" = H1
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @h3@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 18:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype H3 = H3
+  { unwrapH3 :: BG.FunPtr H2
+  }
+  deriving stock (Eq, BG.Generic, Ord, Show)
+  deriving newtype
+    ( BG.HasFFIType
+    , Marshal.ReadRaw
+    , Marshal.StaticSize
+    , BG.Storable
+    , Marshal.WriteRaw
+    )
+
+instance ( ty ~ BG.FunPtr H2
+         ) => BG.CompatHasField.HasField "unwrapH3" H3 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         H3 {unwrapH3 = y1}, BG.getField @"unwrapH3" x0)
+
+instance ( ty ~ BG.FunPtr H2
+         ) => BG.HasField "unwrapH3" (BG.Ptr H3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unwrapH3")
+
+instance HasCField.HasCField H3 "unwrapH3" where
+
+  type CFieldType H3 "unwrapH3" = BG.FunPtr H2
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/typedefs/bindingspec.yaml b/test-artefacts/fixtures/types/typedefs/typedefs/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/typedefs/bindingspec.yaml
@@ -0,0 +1,256 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/typedefs/typedefs.h
+  cname: myint
+  hsname: Myint
+- headers: types/typedefs/typedefs.h
+  cname: intptr
+  hsname: Intptr
+- headers: types/typedefs/typedefs.h
+  cname: int2int
+  hsname: Int2int
+- headers: types/typedefs/typedefs.h
+  cname: FunctionPointer_Function
+  hsname: FunctionPointer_Function
+- headers: types/typedefs/typedefs.h
+  cname: NonFunctionPointer_Function
+  hsname: NonFunctionPointer_Function
+- headers: types/typedefs/typedefs.h
+  cname: f1
+  hsname: F1
+- headers: types/typedefs/typedefs.h
+  cname: g1
+  hsname: G1
+- headers: types/typedefs/typedefs.h
+  cname: g2
+  hsname: G2
+- headers: types/typedefs/typedefs.h
+  cname: h1
+  hsname: H1
+- headers: types/typedefs/typedefs.h
+  cname: h2
+  hsname: H2
+- headers: types/typedefs/typedefs.h
+  cname: h3
+  hsname: H3
+hstypes:
+- hsname: F1
+  representation:
+    newtype:
+      constructor: F1
+      fields:
+      - unwrapF1
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: FunctionPointer_Function
+  representation:
+    newtype:
+      constructor: FunctionPointer_Function
+      fields:
+      - unwrapFunctionPointer_Function
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: G1
+  representation:
+    newtype:
+      constructor: G1
+      fields:
+      - unwrapG1
+  instances:
+  - FromFunPtr
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ToFunPtr
+- hsname: G2
+  representation:
+    newtype:
+      constructor: G2
+      fields:
+      - unwrapG2
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: H1
+  representation:
+    newtype:
+      constructor: H1
+      fields:
+      - unwrapH1
+  instances:
+  - FromFunPtr
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ToFunPtr
+- hsname: H2
+  representation:
+    newtype:
+      constructor: H2
+      fields:
+      - unwrapH2
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+- hsname: H3
+  representation:
+    newtype:
+      constructor: H3
+      fields:
+      - unwrapH3
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: FunPtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Int2int
+  representation:
+    newtype:
+      constructor: Int2int
+      fields:
+      - unwrapInt2int
+  instances:
+  - FromFunPtr
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ToFunPtr
+- hsname: Intptr
+  representation:
+    newtype:
+      constructor: Intptr
+      fields:
+      - unwrapIntptr
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: PtrVoid
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Ord
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Myint
+  representation:
+    newtype:
+      constructor: Myint
+      fields:
+      - unwrapMyint
+      ffitype:
+        hsmodule: HsBindgen.Runtime.Support
+        hsname: CInt
+  instances:
+  - Bitfield
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Generic
+  - HasCField
+  - HasFFIType
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Prim
+  - Read
+  - ReadRaw
+  - Real
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: NonFunctionPointer_Function
+  representation:
+    newtype:
+      constructor: NonFunctionPointer_Function
+      fields:
+      - unwrapNonFunctionPointer_Function
+  instances:
+  - FromFunPtr
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ToFunPtr
diff --git a/test-artefacts/fixtures/types/typedefs/typedefs/th.txt b/test-artefacts/fixtures/types/typedefs/typedefs/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/typedefs/th.txt
@@ -0,0 +1,418 @@
+-- addDependentFile test-artefacts/headers/golden/types/typedefs/typedefs.h
+{-| __C declaration:__ @myint@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 1:13@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype Myint
+    = Myint {unwrapMyint :: CInt}
+    deriving stock (Eq, Generic, Ord, Read, Show)
+    deriving newtype (Bitfield,
+                      Bits,
+                      Bounded,
+                      Enum,
+                      FiniteBits,
+                      HasFFIType,
+                      Integral,
+                      Ix,
+                      Num,
+                      Prim,
+                      ReadRaw,
+                      Real,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty CInt => HasField "unwrapMyint" Myint ty
+    where hasField = \x_0 -> (\y_1 -> Myint{unwrapMyint = y_1},
+                              getField @"unwrapMyint" x_0)
+instance (~) ty CInt => HasField "unwrapMyint" (Ptr Myint) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapMyint")
+instance HasCField Myint "unwrapMyint"
+    where type CFieldType Myint "unwrapMyint" = CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @intptr@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 2:15@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype Intptr
+    = Intptr {unwrapIntptr :: (Ptr CInt)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (Ptr CInt) => HasField "unwrapIntptr" Intptr ty
+    where hasField = \x_0 -> (\y_1 -> Intptr{unwrapIntptr = y_1},
+                              getField @"unwrapIntptr" x_0)
+instance (~) ty (Ptr CInt) =>
+         HasField "unwrapIntptr" (Ptr Intptr) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapIntptr")
+instance HasCField Intptr "unwrapIntptr"
+    where type CFieldType Intptr "unwrapIntptr" = Ptr CInt
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @int2int@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 5:13@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype Int2int
+    = Int2int {unwrapInt2int :: (CInt -> IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toInt2int@
+foreign import ccall safe "wrapper" hs_bindgen_a6c7dd49f5b9d470_base ::
+    CInt -> IO CInt
+ -> IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @toInt2int@
+hs_bindgen_a6c7dd49f5b9d470 :: Int2int -> IO (FunPtr Int2int)
+-- __unique:__ @toInt2int@
+hs_bindgen_a6c7dd49f5b9d470 = \fun_0 -> fmap castFunPtr (hs_bindgen_a6c7dd49f5b9d470_base (\x_1 -> fmap toFFIType (getField @"unwrapInt2int" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromInt2int@
+foreign import ccall safe "dynamic" hs_bindgen_65378a8a3cf640ad_base ::
+    FunPtr (CInt -> IO CInt)
+ -> CInt
+ -> IO CInt
+-- __unique:__ @fromInt2int@
+hs_bindgen_65378a8a3cf640ad :: FunPtr Int2int -> Int2int
+-- __unique:__ @fromInt2int@
+hs_bindgen_65378a8a3cf640ad = \funPtr_0 -> Int2int (\x_1 -> fmap fromFFIType (hs_bindgen_65378a8a3cf640ad_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr Int2int
+    where toFunPtr = hs_bindgen_a6c7dd49f5b9d470
+instance FromFunPtr Int2int
+    where fromFunPtr = hs_bindgen_65378a8a3cf640ad
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapInt2int" Int2int ty
+    where hasField = \x_0 -> (\y_1 -> Int2int{unwrapInt2int = y_1},
+                              getField @"unwrapInt2int" x_0)
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapInt2int" (Ptr Int2int) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapInt2int")
+instance HasCField Int2int "unwrapInt2int"
+    where type CFieldType Int2int "unwrapInt2int" = CInt -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'FunctionPointer_Function'
+
+    __C declaration:__ @FunctionPointer_Function@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 8:16@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype FunctionPointer_Function_Aux
+    = FunctionPointer_Function_Aux {unwrapFunctionPointer_Function_Aux :: (IO ())}
+    deriving stock Generic
+-- __unique:__ @toFunctionPointer_Function_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_b171c028cdc0781d_base ::
+    IO ()
+ -> IO (FunPtr (IO ()))
+-- __unique:__ @toFunctionPointer_Function_Aux@
+hs_bindgen_b171c028cdc0781d :: FunctionPointer_Function_Aux ->
+                               IO (FunPtr FunctionPointer_Function_Aux)
+-- __unique:__ @toFunctionPointer_Function_Aux@
+hs_bindgen_b171c028cdc0781d = \fun_0 -> fmap castFunPtr (hs_bindgen_b171c028cdc0781d_base (getField @"unwrapFunctionPointer_Function_Aux" fun_0))
+-- __unique:__ @fromFunctionPointer_Function_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_4c3da8240a31e036_base ::
+    FunPtr (IO ())
+ -> IO ()
+-- __unique:__ @fromFunctionPointer_Function_Aux@
+hs_bindgen_4c3da8240a31e036 :: FunPtr FunctionPointer_Function_Aux ->
+                               FunctionPointer_Function_Aux
+-- __unique:__ @fromFunctionPointer_Function_Aux@
+hs_bindgen_4c3da8240a31e036 = \funPtr_0 -> FunctionPointer_Function_Aux (hs_bindgen_4c3da8240a31e036_base (castFunPtr funPtr_0))
+instance ToFunPtr FunctionPointer_Function_Aux
+    where toFunPtr = hs_bindgen_b171c028cdc0781d
+instance FromFunPtr FunctionPointer_Function_Aux
+    where fromFunPtr = hs_bindgen_4c3da8240a31e036
+instance (~) ty (IO ()) =>
+         HasField "unwrapFunctionPointer_Function_Aux"
+                  FunctionPointer_Function_Aux
+                  ty
+    where hasField = \x_0 -> (\y_1 -> FunctionPointer_Function_Aux{unwrapFunctionPointer_Function_Aux = y_1},
+                              getField @"unwrapFunctionPointer_Function_Aux" x_0)
+instance (~) ty (IO ()) =>
+         HasField "unwrapFunctionPointer_Function_Aux"
+                  (Ptr FunctionPointer_Function_Aux)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunctionPointer_Function_Aux")
+instance HasCField FunctionPointer_Function_Aux
+                   "unwrapFunctionPointer_Function_Aux"
+    where type CFieldType FunctionPointer_Function_Aux
+                          "unwrapFunctionPointer_Function_Aux" = IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @FunctionPointer_Function@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 8:16@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype FunctionPointer_Function
+    = FunctionPointer_Function {unwrapFunctionPointer_Function :: (FunPtr FunctionPointer_Function_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr FunctionPointer_Function_Aux) =>
+         HasField "unwrapFunctionPointer_Function"
+                  FunctionPointer_Function
+                  ty
+    where hasField = \x_0 -> (\y_1 -> FunctionPointer_Function{unwrapFunctionPointer_Function = y_1},
+                              getField @"unwrapFunctionPointer_Function" x_0)
+instance (~) ty (FunPtr FunctionPointer_Function_Aux) =>
+         HasField "unwrapFunctionPointer_Function"
+                  (Ptr FunctionPointer_Function)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapFunctionPointer_Function")
+instance HasCField FunctionPointer_Function
+                   "unwrapFunctionPointer_Function"
+    where type CFieldType FunctionPointer_Function
+                          "unwrapFunctionPointer_Function" = FunPtr FunctionPointer_Function_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @NonFunctionPointer_Function@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 9:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype NonFunctionPointer_Function
+    = NonFunctionPointer_Function {unwrapNonFunctionPointer_Function :: (CInt ->
+                                                                         IO CInt)}
+    deriving stock Generic
+-- __unique:__ @toNonFunctionPointer_Function@
+foreign import ccall safe "wrapper" hs_bindgen_766ae751d60365e9_base ::
+    CInt -> IO CInt
+ -> IO (FunPtr (CInt -> IO CInt))
+-- __unique:__ @toNonFunctionPointer_Function@
+hs_bindgen_766ae751d60365e9 :: NonFunctionPointer_Function ->
+                               IO (FunPtr NonFunctionPointer_Function)
+-- __unique:__ @toNonFunctionPointer_Function@
+hs_bindgen_766ae751d60365e9 = \fun_0 -> fmap castFunPtr (hs_bindgen_766ae751d60365e9_base (\x_1 -> fmap toFFIType (getField @"unwrapNonFunctionPointer_Function" fun_0 (fromFFIType x_1))))
+-- __unique:__ @fromNonFunctionPointer_Function@
+foreign import ccall safe "dynamic" hs_bindgen_36c7108d046bcbc3_base ::
+    FunPtr (CInt -> IO CInt)
+ -> CInt
+ -> IO CInt
+-- __unique:__ @fromNonFunctionPointer_Function@
+hs_bindgen_36c7108d046bcbc3 :: FunPtr NonFunctionPointer_Function ->
+                               NonFunctionPointer_Function
+-- __unique:__ @fromNonFunctionPointer_Function@
+hs_bindgen_36c7108d046bcbc3 = \funPtr_0 -> NonFunctionPointer_Function (\x_1 -> fmap fromFFIType (hs_bindgen_36c7108d046bcbc3_base (castFunPtr funPtr_0) (toFFIType x_1)))
+instance ToFunPtr NonFunctionPointer_Function
+    where toFunPtr = hs_bindgen_766ae751d60365e9
+instance FromFunPtr NonFunctionPointer_Function
+    where fromFunPtr = hs_bindgen_36c7108d046bcbc3
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapNonFunctionPointer_Function"
+                  NonFunctionPointer_Function
+                  ty
+    where hasField = \x_0 -> (\y_1 -> NonFunctionPointer_Function{unwrapNonFunctionPointer_Function = y_1},
+                              getField @"unwrapNonFunctionPointer_Function" x_0)
+instance (~) ty (CInt -> IO CInt) =>
+         HasField "unwrapNonFunctionPointer_Function"
+                  (Ptr NonFunctionPointer_Function)
+                  (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapNonFunctionPointer_Function")
+instance HasCField NonFunctionPointer_Function
+                   "unwrapNonFunctionPointer_Function"
+    where type CFieldType NonFunctionPointer_Function
+                          "unwrapNonFunctionPointer_Function" = CInt -> IO CInt
+          offset# = \_ -> \_ -> 0
+{-| Auxiliary type used by 'F1'
+
+    __C declaration:__ @f1@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 11:16@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype F1_Aux
+    = F1_Aux {unwrapF1_Aux :: (IO ())}
+    deriving stock Generic
+-- __unique:__ @toF1_Aux@
+foreign import ccall safe "wrapper" hs_bindgen_00d16e666202ed6c_base ::
+    IO ()
+ -> IO (FunPtr (IO ()))
+-- __unique:__ @toF1_Aux@
+hs_bindgen_00d16e666202ed6c :: F1_Aux -> IO (FunPtr F1_Aux)
+-- __unique:__ @toF1_Aux@
+hs_bindgen_00d16e666202ed6c = \fun_0 -> fmap castFunPtr (hs_bindgen_00d16e666202ed6c_base (getField @"unwrapF1_Aux" fun_0))
+-- __unique:__ @fromF1_Aux@
+foreign import ccall safe "dynamic" hs_bindgen_ddeb5206e8192425_base ::
+    FunPtr (IO ())
+ -> IO ()
+-- __unique:__ @fromF1_Aux@
+hs_bindgen_ddeb5206e8192425 :: FunPtr F1_Aux -> F1_Aux
+-- __unique:__ @fromF1_Aux@
+hs_bindgen_ddeb5206e8192425 = \funPtr_0 -> F1_Aux (hs_bindgen_ddeb5206e8192425_base (castFunPtr funPtr_0))
+instance ToFunPtr F1_Aux
+    where toFunPtr = hs_bindgen_00d16e666202ed6c
+instance FromFunPtr F1_Aux
+    where fromFunPtr = hs_bindgen_ddeb5206e8192425
+instance (~) ty (IO ()) => HasField "unwrapF1_Aux" F1_Aux ty
+    where hasField = \x_0 -> (\y_1 -> F1_Aux{unwrapF1_Aux = y_1},
+                              getField @"unwrapF1_Aux" x_0)
+instance (~) ty (IO ()) =>
+         HasField "unwrapF1_Aux" (Ptr F1_Aux) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF1_Aux")
+instance HasCField F1_Aux "unwrapF1_Aux"
+    where type CFieldType F1_Aux "unwrapF1_Aux" = IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @f1@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 11:16@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype F1
+    = F1 {unwrapF1 :: (FunPtr F1_Aux)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr F1_Aux) => HasField "unwrapF1" F1 ty
+    where hasField = \x_0 -> (\y_1 -> F1{unwrapF1 = y_1},
+                              getField @"unwrapF1" x_0)
+instance (~) ty (FunPtr F1_Aux) =>
+         HasField "unwrapF1" (Ptr F1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapF1")
+instance HasCField F1 "unwrapF1"
+    where type CFieldType F1 "unwrapF1" = FunPtr F1_Aux
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @g1@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 13:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype G1 = G1 {unwrapG1 :: (IO ())} deriving stock Generic
+-- __unique:__ @toG1@
+foreign import ccall safe "wrapper" hs_bindgen_fa5806570b682579_base ::
+    IO ()
+ -> IO (FunPtr (IO ()))
+-- __unique:__ @toG1@
+hs_bindgen_fa5806570b682579 :: G1 -> IO (FunPtr G1)
+-- __unique:__ @toG1@
+hs_bindgen_fa5806570b682579 = \fun_0 -> fmap castFunPtr (hs_bindgen_fa5806570b682579_base (getField @"unwrapG1" fun_0))
+-- __unique:__ @fromG1@
+foreign import ccall safe "dynamic" hs_bindgen_8405c8e75aa78be5_base ::
+    FunPtr (IO ())
+ -> IO ()
+-- __unique:__ @fromG1@
+hs_bindgen_8405c8e75aa78be5 :: FunPtr G1 -> G1
+-- __unique:__ @fromG1@
+hs_bindgen_8405c8e75aa78be5 = \funPtr_0 -> G1 (hs_bindgen_8405c8e75aa78be5_base (castFunPtr funPtr_0))
+instance ToFunPtr G1
+    where toFunPtr = hs_bindgen_fa5806570b682579
+instance FromFunPtr G1
+    where fromFunPtr = hs_bindgen_8405c8e75aa78be5
+instance (~) ty (IO ()) => HasField "unwrapG1" G1 ty
+    where hasField = \x_0 -> (\y_1 -> G1{unwrapG1 = y_1},
+                              getField @"unwrapG1" x_0)
+instance (~) ty (IO ()) => HasField "unwrapG1" (Ptr G1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapG1")
+instance HasCField G1 "unwrapG1"
+    where type CFieldType G1 "unwrapG1" = IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @g2@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 14:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype G2
+    = G2 {unwrapG2 :: (FunPtr G1)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr G1) => HasField "unwrapG2" G2 ty
+    where hasField = \x_0 -> (\y_1 -> G2{unwrapG2 = y_1},
+                              getField @"unwrapG2" x_0)
+instance (~) ty (FunPtr G1) =>
+         HasField "unwrapG2" (Ptr G2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapG2")
+instance HasCField G2 "unwrapG2"
+    where type CFieldType G2 "unwrapG2" = FunPtr G1
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @h1@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 16:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype H1 = H1 {unwrapH1 :: (IO ())} deriving stock Generic
+-- __unique:__ @toH1@
+foreign import ccall safe "wrapper" hs_bindgen_ffae0d1234ed018f_base ::
+    IO ()
+ -> IO (FunPtr (IO ()))
+-- __unique:__ @toH1@
+hs_bindgen_ffae0d1234ed018f :: H1 -> IO (FunPtr H1)
+-- __unique:__ @toH1@
+hs_bindgen_ffae0d1234ed018f = \fun_0 -> fmap castFunPtr (hs_bindgen_ffae0d1234ed018f_base (getField @"unwrapH1" fun_0))
+-- __unique:__ @fromH1@
+foreign import ccall safe "dynamic" hs_bindgen_1a33688324e1924f_base ::
+    FunPtr (IO ())
+ -> IO ()
+-- __unique:__ @fromH1@
+hs_bindgen_1a33688324e1924f :: FunPtr H1 -> H1
+-- __unique:__ @fromH1@
+hs_bindgen_1a33688324e1924f = \funPtr_0 -> H1 (hs_bindgen_1a33688324e1924f_base (castFunPtr funPtr_0))
+instance ToFunPtr H1
+    where toFunPtr = hs_bindgen_ffae0d1234ed018f
+instance FromFunPtr H1
+    where fromFunPtr = hs_bindgen_1a33688324e1924f
+instance (~) ty (IO ()) => HasField "unwrapH1" H1 ty
+    where hasField = \x_0 -> (\y_1 -> H1{unwrapH1 = y_1},
+                              getField @"unwrapH1" x_0)
+instance (~) ty (IO ()) => HasField "unwrapH1" (Ptr H1) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapH1")
+instance HasCField H1 "unwrapH1"
+    where type CFieldType H1 "unwrapH1" = IO ()
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @h2@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 17:12@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype H2 = H2 {unwrapH2 :: H1} deriving stock Generic
+instance (~) ty H1 => HasField "unwrapH2" H2 ty
+    where hasField = \x_0 -> (\y_1 -> H2{unwrapH2 = y_1},
+                              getField @"unwrapH2" x_0)
+instance (~) ty H1 => HasField "unwrapH2" (Ptr H2) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapH2")
+instance HasCField H2 "unwrapH2"
+    where type CFieldType H2 "unwrapH2" = H1
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @h3@
+
+    __defined at:__ @types\/typedefs\/typedefs.h 18:14@
+
+    __exported by:__ @types\/typedefs\/typedefs.h@
+-}
+newtype H3
+    = H3 {unwrapH3 :: (FunPtr H2)}
+    deriving stock (Eq, Generic, Ord, Show)
+    deriving newtype (HasFFIType,
+                      ReadRaw,
+                      StaticSize,
+                      Storable,
+                      WriteRaw)
+instance (~) ty (FunPtr H2) => HasField "unwrapH3" H3 ty
+    where hasField = \x_0 -> (\y_1 -> H3{unwrapH3 = y_1},
+                              getField @"unwrapH3" x_0)
+instance (~) ty (FunPtr H2) =>
+         HasField "unwrapH3" (Ptr H3) (Ptr ty)
+    where getField = fromPtr (Proxy @"unwrapH3")
+instance HasCField H3 "unwrapH3"
+    where type CFieldType H3 "unwrapH3" = FunPtr H2
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/typedefs/typenames/bindingspec.yaml b/test-artefacts/fixtures/types/typedefs/typenames/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/typenames/bindingspec.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/fixtures/types/typedefs/typenames/th.txt b/test-artefacts/fixtures/types/typedefs/typenames/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/typedefs/typenames/th.txt
@@ -0,0 +1,1 @@
+-- addDependentFile test-artefacts/headers/golden/types/typedefs/typenames.h
diff --git a/test-artefacts/fixtures/types/unions/bitfields/Example.hs b/test-artefacts/fixtures/types/unions/bitfields/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/unions/bitfields/Example.hs
@@ -0,0 +1,1940 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Foo_8(..)
+    , Example.Foo_16(..)
+    , Example.Foo_32(..)
+    , Example.Foo_64(..)
+    , Example.Foo_8_packed(..)
+    , Example.Foo_16_packed(..)
+    , Example.Foo_32_packed(..)
+    , Example.Foo_64_packed(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.BitfieldPtr as BitfieldPtr
+import qualified HsBindgen.Runtime.HasCBitfield as HasCBitfield
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude (type (~))
+
+{-| __C declaration:__ @union foo_8@
+
+    __defined at:__ @types\/unions\/bitfields.h 4:7@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_8 = Foo_8
+  { unwrapFoo_8 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 1 1 instance Marshal.StaticSize Foo_8
+
+deriving via BG.SizedByteArray 1 1 instance Marshal.ReadRaw Foo_8
+
+deriving via BG.SizedByteArray 1 1 instance Marshal.WriteRaw Foo_8
+
+deriving via Marshal.EquivStorable Foo_8 instance BG.Storable Foo_8
+
+deriving via BG.SizedByteArray 1 1 instance Union.IsUnion Foo_8
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 5:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_a" Foo_8 ty where
+
+  getField = BG.getUnionPayloadBits 0 3
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 5:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_a" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 3 y1 x0, BG.getField @"foo_8_a" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_a" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_a")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_a" where
+
+  type CBitfieldType Foo_8 "foo_8_a" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 6:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_b" Foo_8 ty where
+
+  getField = BG.getUnionPayloadBits 0 3
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 6:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_b" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 3 y1 x0, BG.getField @"foo_8_b" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_b" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_b")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_b" where
+
+  type CBitfieldType Foo_8 "foo_8_b" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 7:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_c" Foo_8 ty where
+
+  getField = BG.getUnionPayloadBits 0 2
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 7:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_c" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 2 y1 x0, BG.getField @"foo_8_c" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_c" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_c")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_c" where
+
+  type CBitfieldType Foo_8 "foo_8_c" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 8:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_d" Foo_8 ty where
+
+  getField = BG.getUnionPayloadBits 0 3
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 8:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_d" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 3 y1 x0, BG.getField @"foo_8_d" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_d" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_d")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_d" where
+
+  type CBitfieldType Foo_8 "foo_8_d" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 9:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_e" Foo_8 ty where
+
+  getField = BG.getUnionPayloadBits 0 8
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 9:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_e" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 8 y1 x0, BG.getField @"foo_8_e" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_e" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_e")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_e" where
+
+  type CBitfieldType Foo_8 "foo_8_e" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 10:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_f" Foo_8 ty where
+
+  getField = BG.getUnionPayloadBits 0 5
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 10:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.CompatHasField.HasField "foo_8_f" Foo_8 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 5 y1 x0, BG.getField @"foo_8_f" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_f" (BG.Ptr Foo_8) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_8_f")
+
+instance HasCBitfield.HasCBitfield Foo_8 "foo_8_f" where
+
+  type CBitfieldType Foo_8 "foo_8_f" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 5
+
+{-| __C declaration:__ @union foo_16@
+
+    __defined at:__ @types\/unions\/bitfields.h 14:7@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_16 = Foo_16
+  { unwrapFoo_16 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize Foo_16
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw Foo_16
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw Foo_16
+
+deriving via Marshal.EquivStorable Foo_16 instance BG.Storable Foo_16
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion Foo_16
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 15:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_16_a" Foo_16 ty where
+
+  getField = BG.getUnionPayloadBits 0 6
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 15:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_16_a" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 6 y1 x0, BG.getField @"foo_16_a" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_16_a" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_a")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_a" where
+
+  type CBitfieldType Foo_16 "foo_16_a" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 16:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_b" Foo_16 ty where
+
+  getField = BG.getUnionPayloadBits 0 10
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 16:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_b" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 10 y1 x0, BG.getField @"foo_16_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_b" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_b")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_b" where
+
+  type CBitfieldType Foo_16 "foo_16_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 10
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 17:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_c" Foo_16 ty where
+
+  getField = BG.getUnionPayloadBits 0 16
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 17:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_c" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 16 y1 x0, BG.getField @"foo_16_c" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_c" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_c")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_c" where
+
+  type CBitfieldType Foo_16 "foo_16_c" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 18:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_d" Foo_16 ty where
+
+  getField = BG.getUnionPayloadBits 0 16
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 18:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_d" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 16 y1 x0, BG.getField @"foo_16_d" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_d" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_d")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_d" where
+
+  type CBitfieldType Foo_16 "foo_16_d" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 19:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_e" Foo_16 ty where
+
+  getField = BG.getUnionPayloadBits 0 12
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 19:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_e" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 12 y1 x0, BG.getField @"foo_16_e" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_e" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_e")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_e" where
+
+  type CBitfieldType Foo_16 "foo_16_e" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 20:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_f" Foo_16 ty where
+
+  getField = BG.getUnionPayloadBits 0 12
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 20:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_16_f" Foo_16 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 12 y1 x0, BG.getField @"foo_16_f" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_f" (BG.Ptr Foo_16) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_16_f")
+
+instance HasCBitfield.HasCBitfield Foo_16 "foo_16_f" where
+
+  type CBitfieldType Foo_16 "foo_16_f" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @union foo_32@
+
+    __defined at:__ @types\/unions\/bitfields.h 24:7@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_32 = Foo_32
+  { unwrapFoo_32 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize Foo_32
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw Foo_32
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw Foo_32
+
+deriving via Marshal.EquivStorable Foo_32 instance BG.Storable Foo_32
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion Foo_32
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 25:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_32_a" Foo_32 ty where
+
+  getField = BG.getUnionPayloadBits 0 6
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 25:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_32_a" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 6 y1 x0, BG.getField @"foo_32_a" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_32_a" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_a")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_a" where
+
+  type CBitfieldType Foo_32 "foo_32_a" = BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 26:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_32_b" Foo_32 ty where
+
+  getField = BG.getUnionPayloadBits 0 12
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 26:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_32_b" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 12 y1 x0, BG.getField @"foo_32_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_b" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_b")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_b" where
+
+  type CBitfieldType Foo_32 "foo_32_b" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 27:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_32_c" Foo_32 ty where
+
+  getField = BG.getUnionPayloadBits 0 14
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 27:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_32_c" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 14 y1 x0, BG.getField @"foo_32_c" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_c" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_c")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_c" where
+
+  type CBitfieldType Foo_32 "foo_32_c" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 14
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 28:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_32_d" Foo_32 ty where
+
+  getField = BG.getUnionPayloadBits 0 10
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 28:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_32_d" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 10 y1 x0, BG.getField @"foo_32_d" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_d" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_d")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_d" where
+
+  type CBitfieldType Foo_32 "foo_32_d" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 10
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 29:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CLong) => BG.HasField "foo_32_e" Foo_32 ty where
+
+  getField = BG.getUnionPayloadBits 0 32
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 29:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "foo_32_e" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 32 y1 x0, BG.getField @"foo_32_e" x0)
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "foo_32_e" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_e")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_e" where
+
+  type CBitfieldType Foo_32 "foo_32_e" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 30:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_32_f" Foo_32 ty where
+
+  getField = BG.getUnionPayloadBits 0 6
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 30:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "foo_32_f" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 6 y1 x0, BG.getField @"foo_32_f" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_f" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_f")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_f" where
+
+  type CBitfieldType Foo_32 "foo_32_f" = BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/unions\/bitfields.h 31:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CLong) => BG.HasField "foo_32_g" Foo_32 ty where
+
+  getField = BG.getUnionPayloadBits 0 24
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/unions\/bitfields.h 31:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "foo_32_g" Foo_32 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 24 y1 x0, BG.getField @"foo_32_g" x0)
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "foo_32_g" (BG.Ptr Foo_32) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_32_g")
+
+instance HasCBitfield.HasCBitfield Foo_32 "foo_32_g" where
+
+  type CBitfieldType Foo_32 "foo_32_g" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @union foo_64@
+
+    __defined at:__ @types\/unions\/bitfields.h 35:7@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_64 = Foo_64
+  { unwrapFoo_64 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.StaticSize Foo_64
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.ReadRaw Foo_64
+
+deriving via BG.SizedByteArray 8 8 instance Marshal.WriteRaw Foo_64
+
+deriving via Marshal.EquivStorable Foo_64 instance BG.Storable Foo_64
+
+deriving via BG.SizedByteArray 8 8 instance Union.IsUnion Foo_64
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 36:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CLong) => BG.HasField "foo_64_a" Foo_64 ty where
+
+  getField = BG.getUnionPayloadBits 0 24
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 36:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "foo_64_a" Foo_64 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 24 y1 x0, BG.getField @"foo_64_a" x0)
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "foo_64_a" (BG.Ptr Foo_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_64_a")
+
+instance HasCBitfield.HasCBitfield Foo_64 "foo_64_a" where
+
+  type CBitfieldType Foo_64 "foo_64_a" = BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 37:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CLLong) => BG.HasField "foo_64_b" Foo_64 ty where
+
+  getField = BG.getUnionPayloadBits 0 40
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 37:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "foo_64_b" Foo_64 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 40 y1 x0, BG.getField @"foo_64_b" x0)
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_b" (BG.Ptr Foo_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_64_b")
+
+instance HasCBitfield.HasCBitfield Foo_64 "foo_64_b" where
+
+  type CBitfieldType Foo_64 "foo_64_b" = BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 40
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 38:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CLLong) => BG.HasField "foo_64_c" Foo_64 ty where
+
+  getField = BG.getUnionPayloadBits 0 64
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 38:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "foo_64_c" Foo_64 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 64 y1 x0, BG.getField @"foo_64_c" x0)
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_c" (BG.Ptr Foo_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_64_c")
+
+instance HasCBitfield.HasCBitfield Foo_64 "foo_64_c" where
+
+  type CBitfieldType Foo_64 "foo_64_c" = BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 39:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CLLong) => BG.HasField "foo_64_d" Foo_64 ty where
+
+  getField = BG.getUnionPayloadBits 0 36
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 39:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "foo_64_d" Foo_64 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 36 y1 x0, BG.getField @"foo_64_d" x0)
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_d" (BG.Ptr Foo_64) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField = HasCBitfield.toPtr (BG.Proxy @"foo_64_d")
+
+instance HasCBitfield.HasCBitfield Foo_64 "foo_64_d" where
+
+  type CBitfieldType Foo_64 "foo_64_d" = BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 36
+
+{-| __C declaration:__ @union foo_8_packed@
+
+    __defined at:__ @types\/unions\/bitfields.h 43:31@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_8_packed = Foo_8_packed
+  { unwrapFoo_8_packed :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 1 1 instance Marshal.StaticSize Foo_8_packed
+
+deriving via BG.SizedByteArray 1 1 instance Marshal.ReadRaw Foo_8_packed
+
+deriving via BG.SizedByteArray 1 1 instance Marshal.WriteRaw Foo_8_packed
+
+deriving via Marshal.EquivStorable Foo_8_packed instance BG.Storable Foo_8_packed
+
+deriving via BG.SizedByteArray 1 1 instance Union.IsUnion Foo_8_packed
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 44:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_packed_a" Foo_8_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 3
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 44:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_8_packed_a" Foo_8_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 3 y1 x0, BG.getField @"foo_8_packed_a" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_packed_a" (BG.Ptr Foo_8_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_8_packed_a")
+
+instance HasCBitfield.HasCBitfield Foo_8_packed "foo_8_packed_a" where
+
+  type CBitfieldType Foo_8_packed "foo_8_packed_a" =
+    BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 45:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_packed_b" Foo_8_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 3
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 45:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_8_packed_b" Foo_8_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 3 y1 x0, BG.getField @"foo_8_packed_b" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_packed_b" (BG.Ptr Foo_8_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_8_packed_b")
+
+instance HasCBitfield.HasCBitfield Foo_8_packed "foo_8_packed_b" where
+
+  type CBitfieldType Foo_8_packed "foo_8_packed_b" =
+    BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 46:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_packed_c" Foo_8_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 2
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 46:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_8_packed_c" Foo_8_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 2 y1 x0, BG.getField @"foo_8_packed_c" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_packed_c" (BG.Ptr Foo_8_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_8_packed_c")
+
+instance HasCBitfield.HasCBitfield Foo_8_packed "foo_8_packed_c" where
+
+  type CBitfieldType Foo_8_packed "foo_8_packed_c" =
+    BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 2
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 47:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_packed_d" Foo_8_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 3
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 47:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_8_packed_d" Foo_8_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 3 y1 x0, BG.getField @"foo_8_packed_d" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_packed_d" (BG.Ptr Foo_8_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_8_packed_d")
+
+instance HasCBitfield.HasCBitfield Foo_8_packed "foo_8_packed_d" where
+
+  type CBitfieldType Foo_8_packed "foo_8_packed_d" =
+    BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 3
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 48:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_packed_e" Foo_8_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 8
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 48:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_8_packed_e" Foo_8_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 8 y1 x0, BG.getField @"foo_8_packed_e" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_packed_e" (BG.Ptr Foo_8_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_8_packed_e")
+
+instance HasCBitfield.HasCBitfield Foo_8_packed "foo_8_packed_e" where
+
+  type CBitfieldType Foo_8_packed "foo_8_packed_e" =
+    BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 49:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CSChar) => BG.HasField "foo_8_packed_f" Foo_8_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 5
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 49:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_8_packed_f" Foo_8_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 5 y1 x0, BG.getField @"foo_8_packed_f" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_8_packed_f" (BG.Ptr Foo_8_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_8_packed_f")
+
+instance HasCBitfield.HasCBitfield Foo_8_packed "foo_8_packed_f" where
+
+  type CBitfieldType Foo_8_packed "foo_8_packed_f" =
+    BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 5
+
+{-| __C declaration:__ @union foo_16_packed@
+
+    __defined at:__ @types\/unions\/bitfields.h 53:31@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_16_packed = Foo_16_packed
+  { unwrapFoo_16_packed :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 2 1 instance Marshal.StaticSize Foo_16_packed
+
+deriving via BG.SizedByteArray 2 1 instance Marshal.ReadRaw Foo_16_packed
+
+deriving via BG.SizedByteArray 2 1 instance Marshal.WriteRaw Foo_16_packed
+
+deriving via Marshal.EquivStorable Foo_16_packed instance BG.Storable Foo_16_packed
+
+deriving via BG.SizedByteArray 2 1 instance Union.IsUnion Foo_16_packed
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 54:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_16_packed_a" Foo_16_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 6
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 54:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_16_packed_a" Foo_16_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 6 y1 x0, BG.getField @"foo_16_packed_a" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_16_packed_a" (BG.Ptr Foo_16_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_16_packed_a")
+
+instance HasCBitfield.HasCBitfield Foo_16_packed "foo_16_packed_a" where
+
+  type CBitfieldType Foo_16_packed "foo_16_packed_a" =
+    BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 55:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_packed_b" Foo_16_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 10
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 55:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_16_packed_b" Foo_16_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 10 y1 x0, BG.getField @"foo_16_packed_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_packed_b" (BG.Ptr Foo_16_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_16_packed_b")
+
+instance HasCBitfield.HasCBitfield Foo_16_packed "foo_16_packed_b" where
+
+  type CBitfieldType Foo_16_packed "foo_16_packed_b" =
+    BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 10
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 56:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_packed_c" Foo_16_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 16
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 56:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_16_packed_c" Foo_16_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 16 y1 x0, BG.getField @"foo_16_packed_c" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_packed_c" (BG.Ptr Foo_16_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_16_packed_c")
+
+instance HasCBitfield.HasCBitfield Foo_16_packed "foo_16_packed_c" where
+
+  type CBitfieldType Foo_16_packed "foo_16_packed_c" =
+    BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 57:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_packed_d" Foo_16_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 16
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 57:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_16_packed_d" Foo_16_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 16 y1 x0, BG.getField @"foo_16_packed_d" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_packed_d" (BG.Ptr Foo_16_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_16_packed_d")
+
+instance HasCBitfield.HasCBitfield Foo_16_packed "foo_16_packed_d" where
+
+  type CBitfieldType Foo_16_packed "foo_16_packed_d" =
+    BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 16
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 58:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_packed_e" Foo_16_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 12
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 58:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_16_packed_e" Foo_16_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 12 y1 x0, BG.getField @"foo_16_packed_e" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_packed_e" (BG.Ptr Foo_16_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_16_packed_e")
+
+instance HasCBitfield.HasCBitfield Foo_16_packed "foo_16_packed_e" where
+
+  type CBitfieldType Foo_16_packed "foo_16_packed_e" =
+    BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 59:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_16_packed_f" Foo_16_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 12
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 59:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_16_packed_f" Foo_16_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 12 y1 x0, BG.getField @"foo_16_packed_f" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_16_packed_f" (BG.Ptr Foo_16_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_16_packed_f")
+
+instance HasCBitfield.HasCBitfield Foo_16_packed "foo_16_packed_f" where
+
+  type CBitfieldType Foo_16_packed "foo_16_packed_f" =
+    BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @union foo_32_packed@
+
+    __defined at:__ @types\/unions\/bitfields.h 63:31@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_32_packed = Foo_32_packed
+  { unwrapFoo_32_packed :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 1 instance Marshal.StaticSize Foo_32_packed
+
+deriving via BG.SizedByteArray 4 1 instance Marshal.ReadRaw Foo_32_packed
+
+deriving via BG.SizedByteArray 4 1 instance Marshal.WriteRaw Foo_32_packed
+
+deriving via Marshal.EquivStorable Foo_32_packed instance BG.Storable Foo_32_packed
+
+deriving via BG.SizedByteArray 4 1 instance Union.IsUnion Foo_32_packed
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 64:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_32_packed_a" Foo_32_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 6
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 64:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CSChar
+         ) => BG.CompatHasField.HasField "foo_32_packed_a" Foo_32_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 6 y1 x0, BG.getField @"foo_32_packed_a" x0)
+
+instance ( ty ~ BG.CSChar
+         ) => BG.HasField "foo_32_packed_a" (BG.Ptr Foo_32_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_32_packed_a")
+
+instance HasCBitfield.HasCBitfield Foo_32_packed "foo_32_packed_a" where
+
+  type CBitfieldType Foo_32_packed "foo_32_packed_a" =
+    BG.CSChar
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 65:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_32_packed_b" Foo_32_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 12
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 65:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_32_packed_b" Foo_32_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 12 y1 x0, BG.getField @"foo_32_packed_b" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_packed_b" (BG.Ptr Foo_32_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_32_packed_b")
+
+instance HasCBitfield.HasCBitfield Foo_32_packed "foo_32_packed_b" where
+
+  type CBitfieldType Foo_32_packed "foo_32_packed_b" =
+    BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 12
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 66:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_32_packed_c" Foo_32_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 14
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 66:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_32_packed_c" Foo_32_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 14 y1 x0, BG.getField @"foo_32_packed_c" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_packed_c" (BG.Ptr Foo_32_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_32_packed_c")
+
+instance HasCBitfield.HasCBitfield Foo_32_packed "foo_32_packed_c" where
+
+  type CBitfieldType Foo_32_packed "foo_32_packed_c" =
+    BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 14
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 67:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_32_packed_d" Foo_32_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 10
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 67:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_32_packed_d" Foo_32_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 10 y1 x0, BG.getField @"foo_32_packed_d" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_packed_d" (BG.Ptr Foo_32_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_32_packed_d")
+
+instance HasCBitfield.HasCBitfield Foo_32_packed "foo_32_packed_d" where
+
+  type CBitfieldType Foo_32_packed "foo_32_packed_d" =
+    BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 10
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 68:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CLong) => BG.HasField "foo_32_packed_e" Foo_32_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 32
+
+{-| __C declaration:__ @e@
+
+    __defined at:__ @types\/unions\/bitfields.h 68:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "foo_32_packed_e" Foo_32_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 32 y1 x0, BG.getField @"foo_32_packed_e" x0)
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "foo_32_packed_e" (BG.Ptr Foo_32_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_32_packed_e")
+
+instance HasCBitfield.HasCBitfield Foo_32_packed "foo_32_packed_e" where
+
+  type CBitfieldType Foo_32_packed "foo_32_packed_e" =
+    BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 32
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 69:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "foo_32_packed_f" Foo_32_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 6
+
+{-| __C declaration:__ @f@
+
+    __defined at:__ @types\/unions\/bitfields.h 69:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "foo_32_packed_f" Foo_32_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 6 y1 x0, BG.getField @"foo_32_packed_f" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "foo_32_packed_f" (BG.Ptr Foo_32_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_32_packed_f")
+
+instance HasCBitfield.HasCBitfield Foo_32_packed "foo_32_packed_f" where
+
+  type CBitfieldType Foo_32_packed "foo_32_packed_f" =
+    BG.CInt
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 6
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/unions\/bitfields.h 70:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CLong) => BG.HasField "foo_32_packed_g" Foo_32_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 24
+
+{-| __C declaration:__ @g@
+
+    __defined at:__ @types\/unions\/bitfields.h 70:15@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "foo_32_packed_g" Foo_32_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 24 y1 x0, BG.getField @"foo_32_packed_g" x0)
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "foo_32_packed_g" (BG.Ptr Foo_32_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_32_packed_g")
+
+instance HasCBitfield.HasCBitfield Foo_32_packed "foo_32_packed_g" where
+
+  type CBitfieldType Foo_32_packed "foo_32_packed_g" =
+    BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @union foo_64_packed@
+
+    __defined at:__ @types\/unions\/bitfields.h 74:31@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_64_packed = Foo_64_packed
+  { unwrapFoo_64_packed :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 1 instance Marshal.StaticSize Foo_64_packed
+
+deriving via BG.SizedByteArray 8 1 instance Marshal.ReadRaw Foo_64_packed
+
+deriving via BG.SizedByteArray 8 1 instance Marshal.WriteRaw Foo_64_packed
+
+deriving via Marshal.EquivStorable Foo_64_packed instance BG.Storable Foo_64_packed
+
+deriving via BG.SizedByteArray 8 1 instance Union.IsUnion Foo_64_packed
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 75:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance (ty ~ BG.CLong) => BG.HasField "foo_64_packed_a" Foo_64_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 24
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/bitfields.h 75:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLong
+         ) => BG.CompatHasField.HasField "foo_64_packed_a" Foo_64_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 24 y1 x0, BG.getField @"foo_64_packed_a" x0)
+
+instance ( ty ~ BG.CLong
+         ) => BG.HasField "foo_64_packed_a" (BG.Ptr Foo_64_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_64_packed_a")
+
+instance HasCBitfield.HasCBitfield Foo_64_packed "foo_64_packed_a" where
+
+  type CBitfieldType Foo_64_packed "foo_64_packed_a" =
+    BG.CLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 24
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 76:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_packed_b" Foo_64_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 40
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/bitfields.h 76:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "foo_64_packed_b" Foo_64_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 40 y1 x0, BG.getField @"foo_64_packed_b" x0)
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_packed_b" (BG.Ptr Foo_64_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_64_packed_b")
+
+instance HasCBitfield.HasCBitfield Foo_64_packed "foo_64_packed_b" where
+
+  type CBitfieldType Foo_64_packed "foo_64_packed_b" =
+    BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 40
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 77:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_packed_c" Foo_64_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 64
+
+{-| __C declaration:__ @c@
+
+    __defined at:__ @types\/unions\/bitfields.h 77:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "foo_64_packed_c" Foo_64_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 64 y1 x0, BG.getField @"foo_64_packed_c" x0)
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_packed_c" (BG.Ptr Foo_64_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_64_packed_c")
+
+instance HasCBitfield.HasCBitfield Foo_64_packed "foo_64_packed_c" where
+
+  type CBitfieldType Foo_64_packed "foo_64_packed_c" =
+    BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 64
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 78:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_packed_d" Foo_64_packed ty where
+
+  getField = BG.getUnionPayloadBits 0 36
+
+{-| __C declaration:__ @d@
+
+    __defined at:__ @types\/unions\/bitfields.h 78:20@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+instance ( ty ~ BG.CLLong
+         ) => BG.CompatHasField.HasField "foo_64_packed_d" Foo_64_packed ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayloadBits 0 36 y1 x0, BG.getField @"foo_64_packed_d" x0)
+
+instance ( ty ~ BG.CLLong
+         ) => BG.HasField "foo_64_packed_d" (BG.Ptr Foo_64_packed) (BitfieldPtr.BitfieldPtr ty) where
+
+  getField =
+    HasCBitfield.toPtr (BG.Proxy @"foo_64_packed_d")
+
+instance HasCBitfield.HasCBitfield Foo_64_packed "foo_64_packed_d" where
+
+  type CBitfieldType Foo_64_packed "foo_64_packed_d" =
+    BG.CLLong
+
+  bitfieldOffset# = \_ -> \_ -> 0
+
+  bitfieldWidth# = \_ -> \_ -> 36
diff --git a/test-artefacts/fixtures/types/unions/bitfields/bindingspec.yaml b/test-artefacts/fixtures/types/unions/bitfields/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/unions/bitfields/bindingspec.yaml
@@ -0,0 +1,166 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/unions/bitfields.h
+  cname: union foo_8
+  hsname: Foo_8
+- headers: types/unions/bitfields.h
+  cname: union foo_16
+  hsname: Foo_16
+- headers: types/unions/bitfields.h
+  cname: union foo_32
+  hsname: Foo_32
+- headers: types/unions/bitfields.h
+  cname: union foo_64
+  hsname: Foo_64
+- headers: types/unions/bitfields.h
+  cname: union foo_8_packed
+  hsname: Foo_8_packed
+- headers: types/unions/bitfields.h
+  cname: union foo_16_packed
+  hsname: Foo_16_packed
+- headers: types/unions/bitfields.h
+  cname: union foo_32_packed
+  hsname: Foo_32_packed
+- headers: types/unions/bitfields.h
+  cname: union foo_64_packed
+  hsname: Foo_64_packed
+hstypes:
+- hsname: Foo_16
+  representation:
+    newtype:
+      constructor: Foo_16
+      fields:
+      - unwrapFoo_16
+  instances:
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_16_packed
+  representation:
+    newtype:
+      constructor: Foo_16_packed
+      fields:
+      - unwrapFoo_16_packed
+  instances:
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_32
+  representation:
+    newtype:
+      constructor: Foo_32
+      fields:
+      - unwrapFoo_32
+  instances:
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_32_packed
+  representation:
+    newtype:
+      constructor: Foo_32_packed
+      fields:
+      - unwrapFoo_32_packed
+  instances:
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_64
+  representation:
+    newtype:
+      constructor: Foo_64
+      fields:
+      - unwrapFoo_64
+  instances:
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_64_packed
+  representation:
+    newtype:
+      constructor: Foo_64_packed
+      fields:
+      - unwrapFoo_64_packed
+  instances:
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_8
+  representation:
+    newtype:
+      constructor: Foo_8
+      fields:
+      - unwrapFoo_8
+  instances:
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Foo_8_packed
+  representation:
+    newtype:
+      constructor: Foo_8_packed
+      fields:
+      - unwrapFoo_8_packed
+  instances:
+  - Generic
+  - HasCBitfield
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/unions/bitfields/th.txt b/test-artefacts/fixtures/types/unions/bitfields/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/unions/bitfields/th.txt
@@ -0,0 +1,681 @@
+-- addDependentFile test-artefacts/headers/golden/types/unions/bitfields.h
+{-| __C declaration:__ @union foo_8@
+
+    __defined at:__ @types\/unions\/bitfields.h 4:7@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_8
+    = Foo_8 {unwrapFoo_8 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 1 1) instance StaticSize Foo_8
+deriving via (SizedByteArray 1 1) instance ReadRaw Foo_8
+deriving via (SizedByteArray 1 1) instance WriteRaw Foo_8
+deriving via (EquivStorable Foo_8) instance Storable Foo_8
+deriving via (SizedByteArray 1 1) instance IsUnion Foo_8
+instance (~) ty CSChar => HasField "foo_8_a" Foo_8 ty
+    where getField = getUnionPayloadBits 0 3
+instance (~) ty CSChar => HasField "foo_8_a" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 3 y_1 x_0,
+                              getField @"foo_8_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_a" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_a")
+instance HasCBitfield Foo_8 "foo_8_a"
+    where type CBitfieldType Foo_8 "foo_8_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_8_b" Foo_8 ty
+    where getField = getUnionPayloadBits 0 3
+instance (~) ty CSChar => HasField "foo_8_b" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 3 y_1 x_0,
+                              getField @"foo_8_b" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_b" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_b")
+instance HasCBitfield Foo_8 "foo_8_b"
+    where type CBitfieldType Foo_8 "foo_8_b" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_8_c" Foo_8 ty
+    where getField = getUnionPayloadBits 0 2
+instance (~) ty CSChar => HasField "foo_8_c" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 2 y_1 x_0,
+                              getField @"foo_8_c" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_c" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_c")
+instance HasCBitfield Foo_8 "foo_8_c"
+    where type CBitfieldType Foo_8 "foo_8_c" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 2
+instance (~) ty CSChar => HasField "foo_8_d" Foo_8 ty
+    where getField = getUnionPayloadBits 0 3
+instance (~) ty CSChar => HasField "foo_8_d" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 3 y_1 x_0,
+                              getField @"foo_8_d" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_d" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_d")
+instance HasCBitfield Foo_8 "foo_8_d"
+    where type CBitfieldType Foo_8 "foo_8_d" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_8_e" Foo_8 ty
+    where getField = getUnionPayloadBits 0 8
+instance (~) ty CSChar => HasField "foo_8_e" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 8 y_1 x_0,
+                              getField @"foo_8_e" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_e" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_e")
+instance HasCBitfield Foo_8 "foo_8_e"
+    where type CBitfieldType Foo_8 "foo_8_e" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 8
+instance (~) ty CSChar => HasField "foo_8_f" Foo_8 ty
+    where getField = getUnionPayloadBits 0 5
+instance (~) ty CSChar => HasField "foo_8_f" Foo_8 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 5 y_1 x_0,
+                              getField @"foo_8_f" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_f" (Ptr Foo_8) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_f")
+instance HasCBitfield Foo_8 "foo_8_f"
+    where type CBitfieldType Foo_8 "foo_8_f" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 5
+{-| __C declaration:__ @union foo_16@
+
+    __defined at:__ @types\/unions\/bitfields.h 14:7@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_16
+    = Foo_16 {unwrapFoo_16 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize Foo_16
+deriving via (SizedByteArray 4 4) instance ReadRaw Foo_16
+deriving via (SizedByteArray 4 4) instance WriteRaw Foo_16
+deriving via (EquivStorable Foo_16) instance Storable Foo_16
+deriving via (SizedByteArray 4 4) instance IsUnion Foo_16
+instance (~) ty CSChar => HasField "foo_16_a" Foo_16 ty
+    where getField = getUnionPayloadBits 0 6
+instance (~) ty CSChar => HasField "foo_16_a" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 6 y_1 x_0,
+                              getField @"foo_16_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_16_a" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_a")
+instance HasCBitfield Foo_16 "foo_16_a"
+    where type CBitfieldType Foo_16 "foo_16_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CInt => HasField "foo_16_b" Foo_16 ty
+    where getField = getUnionPayloadBits 0 10
+instance (~) ty CInt => HasField "foo_16_b" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 10 y_1 x_0,
+                              getField @"foo_16_b" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_b" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_b")
+instance HasCBitfield Foo_16 "foo_16_b"
+    where type CBitfieldType Foo_16 "foo_16_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 10
+instance (~) ty CInt => HasField "foo_16_c" Foo_16 ty
+    where getField = getUnionPayloadBits 0 16
+instance (~) ty CInt => HasField "foo_16_c" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 16 y_1 x_0,
+                              getField @"foo_16_c" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_c" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_c")
+instance HasCBitfield Foo_16 "foo_16_c"
+    where type CBitfieldType Foo_16 "foo_16_c" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 16
+instance (~) ty CInt => HasField "foo_16_d" Foo_16 ty
+    where getField = getUnionPayloadBits 0 16
+instance (~) ty CInt => HasField "foo_16_d" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 16 y_1 x_0,
+                              getField @"foo_16_d" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_d" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_d")
+instance HasCBitfield Foo_16 "foo_16_d"
+    where type CBitfieldType Foo_16 "foo_16_d" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 16
+instance (~) ty CInt => HasField "foo_16_e" Foo_16 ty
+    where getField = getUnionPayloadBits 0 12
+instance (~) ty CInt => HasField "foo_16_e" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 12 y_1 x_0,
+                              getField @"foo_16_e" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_e" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_e")
+instance HasCBitfield Foo_16 "foo_16_e"
+    where type CBitfieldType Foo_16 "foo_16_e" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 12
+instance (~) ty CInt => HasField "foo_16_f" Foo_16 ty
+    where getField = getUnionPayloadBits 0 12
+instance (~) ty CInt => HasField "foo_16_f" Foo_16 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 12 y_1 x_0,
+                              getField @"foo_16_f" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_f" (Ptr Foo_16) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_f")
+instance HasCBitfield Foo_16 "foo_16_f"
+    where type CBitfieldType Foo_16 "foo_16_f" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 12
+{-| __C declaration:__ @union foo_32@
+
+    __defined at:__ @types\/unions\/bitfields.h 24:7@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_32
+    = Foo_32 {unwrapFoo_32 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize Foo_32
+deriving via (SizedByteArray 8 8) instance ReadRaw Foo_32
+deriving via (SizedByteArray 8 8) instance WriteRaw Foo_32
+deriving via (EquivStorable Foo_32) instance Storable Foo_32
+deriving via (SizedByteArray 8 8) instance IsUnion Foo_32
+instance (~) ty CSChar => HasField "foo_32_a" Foo_32 ty
+    where getField = getUnionPayloadBits 0 6
+instance (~) ty CSChar => HasField "foo_32_a" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 6 y_1 x_0,
+                              getField @"foo_32_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_32_a" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_a")
+instance HasCBitfield Foo_32 "foo_32_a"
+    where type CBitfieldType Foo_32 "foo_32_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CInt => HasField "foo_32_b" Foo_32 ty
+    where getField = getUnionPayloadBits 0 12
+instance (~) ty CInt => HasField "foo_32_b" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 12 y_1 x_0,
+                              getField @"foo_32_b" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_b" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_b")
+instance HasCBitfield Foo_32 "foo_32_b"
+    where type CBitfieldType Foo_32 "foo_32_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 12
+instance (~) ty CInt => HasField "foo_32_c" Foo_32 ty
+    where getField = getUnionPayloadBits 0 14
+instance (~) ty CInt => HasField "foo_32_c" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 14 y_1 x_0,
+                              getField @"foo_32_c" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_c" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_c")
+instance HasCBitfield Foo_32 "foo_32_c"
+    where type CBitfieldType Foo_32 "foo_32_c" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 14
+instance (~) ty CInt => HasField "foo_32_d" Foo_32 ty
+    where getField = getUnionPayloadBits 0 10
+instance (~) ty CInt => HasField "foo_32_d" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 10 y_1 x_0,
+                              getField @"foo_32_d" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_d" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_d")
+instance HasCBitfield Foo_32 "foo_32_d"
+    where type CBitfieldType Foo_32 "foo_32_d" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 10
+instance (~) ty CLong => HasField "foo_32_e" Foo_32 ty
+    where getField = getUnionPayloadBits 0 32
+instance (~) ty CLong => HasField "foo_32_e" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 32 y_1 x_0,
+                              getField @"foo_32_e" x_0)
+instance (~) ty CLong =>
+         HasField "foo_32_e" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_e")
+instance HasCBitfield Foo_32 "foo_32_e"
+    where type CBitfieldType Foo_32 "foo_32_e" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 32
+instance (~) ty CInt => HasField "foo_32_f" Foo_32 ty
+    where getField = getUnionPayloadBits 0 6
+instance (~) ty CInt => HasField "foo_32_f" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 6 y_1 x_0,
+                              getField @"foo_32_f" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_f" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_f")
+instance HasCBitfield Foo_32 "foo_32_f"
+    where type CBitfieldType Foo_32 "foo_32_f" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CLong => HasField "foo_32_g" Foo_32 ty
+    where getField = getUnionPayloadBits 0 24
+instance (~) ty CLong => HasField "foo_32_g" Foo_32 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 24 y_1 x_0,
+                              getField @"foo_32_g" x_0)
+instance (~) ty CLong =>
+         HasField "foo_32_g" (Ptr Foo_32) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_g")
+instance HasCBitfield Foo_32 "foo_32_g"
+    where type CBitfieldType Foo_32 "foo_32_g" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 24
+{-| __C declaration:__ @union foo_64@
+
+    __defined at:__ @types\/unions\/bitfields.h 35:7@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_64
+    = Foo_64 {unwrapFoo_64 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8 8) instance StaticSize Foo_64
+deriving via (SizedByteArray 8 8) instance ReadRaw Foo_64
+deriving via (SizedByteArray 8 8) instance WriteRaw Foo_64
+deriving via (EquivStorable Foo_64) instance Storable Foo_64
+deriving via (SizedByteArray 8 8) instance IsUnion Foo_64
+instance (~) ty CLong => HasField "foo_64_a" Foo_64 ty
+    where getField = getUnionPayloadBits 0 24
+instance (~) ty CLong => HasField "foo_64_a" Foo_64 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 24 y_1 x_0,
+                              getField @"foo_64_a" x_0)
+instance (~) ty CLong =>
+         HasField "foo_64_a" (Ptr Foo_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_a")
+instance HasCBitfield Foo_64 "foo_64_a"
+    where type CBitfieldType Foo_64 "foo_64_a" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 24
+instance (~) ty CLLong => HasField "foo_64_b" Foo_64 ty
+    where getField = getUnionPayloadBits 0 40
+instance (~) ty CLLong => HasField "foo_64_b" Foo_64 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 40 y_1 x_0,
+                              getField @"foo_64_b" x_0)
+instance (~) ty CLLong =>
+         HasField "foo_64_b" (Ptr Foo_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_b")
+instance HasCBitfield Foo_64 "foo_64_b"
+    where type CBitfieldType Foo_64 "foo_64_b" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 40
+instance (~) ty CLLong => HasField "foo_64_c" Foo_64 ty
+    where getField = getUnionPayloadBits 0 64
+instance (~) ty CLLong => HasField "foo_64_c" Foo_64 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 64 y_1 x_0,
+                              getField @"foo_64_c" x_0)
+instance (~) ty CLLong =>
+         HasField "foo_64_c" (Ptr Foo_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_c")
+instance HasCBitfield Foo_64 "foo_64_c"
+    where type CBitfieldType Foo_64 "foo_64_c" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 64
+instance (~) ty CLLong => HasField "foo_64_d" Foo_64 ty
+    where getField = getUnionPayloadBits 0 36
+instance (~) ty CLLong => HasField "foo_64_d" Foo_64 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 36 y_1 x_0,
+                              getField @"foo_64_d" x_0)
+instance (~) ty CLLong =>
+         HasField "foo_64_d" (Ptr Foo_64) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_d")
+instance HasCBitfield Foo_64 "foo_64_d"
+    where type CBitfieldType Foo_64 "foo_64_d" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 36
+{-| __C declaration:__ @union foo_8_packed@
+
+    __defined at:__ @types\/unions\/bitfields.h 43:31@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_8_packed
+    = Foo_8_packed {unwrapFoo_8_packed :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 1 1) instance StaticSize Foo_8_packed
+deriving via (SizedByteArray 1 1) instance ReadRaw Foo_8_packed
+deriving via (SizedByteArray 1 1) instance WriteRaw Foo_8_packed
+deriving via (EquivStorable Foo_8_packed) instance Storable Foo_8_packed
+deriving via (SizedByteArray 1 1) instance IsUnion Foo_8_packed
+instance (~) ty CSChar => HasField "foo_8_packed_a" Foo_8_packed ty
+    where getField = getUnionPayloadBits 0 3
+instance (~) ty CSChar => HasField "foo_8_packed_a" Foo_8_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 3 y_1 x_0,
+                              getField @"foo_8_packed_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_packed_a" (Ptr Foo_8_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_packed_a")
+instance HasCBitfield Foo_8_packed "foo_8_packed_a"
+    where type CBitfieldType Foo_8_packed "foo_8_packed_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_8_packed_b" Foo_8_packed ty
+    where getField = getUnionPayloadBits 0 3
+instance (~) ty CSChar => HasField "foo_8_packed_b" Foo_8_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 3 y_1 x_0,
+                              getField @"foo_8_packed_b" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_packed_b" (Ptr Foo_8_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_packed_b")
+instance HasCBitfield Foo_8_packed "foo_8_packed_b"
+    where type CBitfieldType Foo_8_packed "foo_8_packed_b" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_8_packed_c" Foo_8_packed ty
+    where getField = getUnionPayloadBits 0 2
+instance (~) ty CSChar => HasField "foo_8_packed_c" Foo_8_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 2 y_1 x_0,
+                              getField @"foo_8_packed_c" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_packed_c" (Ptr Foo_8_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_packed_c")
+instance HasCBitfield Foo_8_packed "foo_8_packed_c"
+    where type CBitfieldType Foo_8_packed "foo_8_packed_c" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 2
+instance (~) ty CSChar => HasField "foo_8_packed_d" Foo_8_packed ty
+    where getField = getUnionPayloadBits 0 3
+instance (~) ty CSChar => HasField "foo_8_packed_d" Foo_8_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 3 y_1 x_0,
+                              getField @"foo_8_packed_d" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_packed_d" (Ptr Foo_8_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_packed_d")
+instance HasCBitfield Foo_8_packed "foo_8_packed_d"
+    where type CBitfieldType Foo_8_packed "foo_8_packed_d" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 3
+instance (~) ty CSChar => HasField "foo_8_packed_e" Foo_8_packed ty
+    where getField = getUnionPayloadBits 0 8
+instance (~) ty CSChar => HasField "foo_8_packed_e" Foo_8_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 8 y_1 x_0,
+                              getField @"foo_8_packed_e" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_packed_e" (Ptr Foo_8_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_packed_e")
+instance HasCBitfield Foo_8_packed "foo_8_packed_e"
+    where type CBitfieldType Foo_8_packed "foo_8_packed_e" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 8
+instance (~) ty CSChar => HasField "foo_8_packed_f" Foo_8_packed ty
+    where getField = getUnionPayloadBits 0 5
+instance (~) ty CSChar => HasField "foo_8_packed_f" Foo_8_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 5 y_1 x_0,
+                              getField @"foo_8_packed_f" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_8_packed_f" (Ptr Foo_8_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_8_packed_f")
+instance HasCBitfield Foo_8_packed "foo_8_packed_f"
+    where type CBitfieldType Foo_8_packed "foo_8_packed_f" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 5
+{-| __C declaration:__ @union foo_16_packed@
+
+    __defined at:__ @types\/unions\/bitfields.h 53:31@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_16_packed
+    = Foo_16_packed {unwrapFoo_16_packed :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 2 1) instance StaticSize Foo_16_packed
+deriving via (SizedByteArray 2 1) instance ReadRaw Foo_16_packed
+deriving via (SizedByteArray 2 1) instance WriteRaw Foo_16_packed
+deriving via (EquivStorable Foo_16_packed) instance Storable Foo_16_packed
+deriving via (SizedByteArray 2 1) instance IsUnion Foo_16_packed
+instance (~) ty CSChar =>
+         HasField "foo_16_packed_a" Foo_16_packed ty
+    where getField = getUnionPayloadBits 0 6
+instance (~) ty CSChar =>
+         HasField "foo_16_packed_a" Foo_16_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 6 y_1 x_0,
+                              getField @"foo_16_packed_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_16_packed_a" (Ptr Foo_16_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_packed_a")
+instance HasCBitfield Foo_16_packed "foo_16_packed_a"
+    where type CBitfieldType Foo_16_packed "foo_16_packed_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CInt => HasField "foo_16_packed_b" Foo_16_packed ty
+    where getField = getUnionPayloadBits 0 10
+instance (~) ty CInt => HasField "foo_16_packed_b" Foo_16_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 10 y_1 x_0,
+                              getField @"foo_16_packed_b" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_packed_b" (Ptr Foo_16_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_packed_b")
+instance HasCBitfield Foo_16_packed "foo_16_packed_b"
+    where type CBitfieldType Foo_16_packed "foo_16_packed_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 10
+instance (~) ty CInt => HasField "foo_16_packed_c" Foo_16_packed ty
+    where getField = getUnionPayloadBits 0 16
+instance (~) ty CInt => HasField "foo_16_packed_c" Foo_16_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 16 y_1 x_0,
+                              getField @"foo_16_packed_c" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_packed_c" (Ptr Foo_16_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_packed_c")
+instance HasCBitfield Foo_16_packed "foo_16_packed_c"
+    where type CBitfieldType Foo_16_packed "foo_16_packed_c" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 16
+instance (~) ty CInt => HasField "foo_16_packed_d" Foo_16_packed ty
+    where getField = getUnionPayloadBits 0 16
+instance (~) ty CInt => HasField "foo_16_packed_d" Foo_16_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 16 y_1 x_0,
+                              getField @"foo_16_packed_d" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_packed_d" (Ptr Foo_16_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_packed_d")
+instance HasCBitfield Foo_16_packed "foo_16_packed_d"
+    where type CBitfieldType Foo_16_packed "foo_16_packed_d" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 16
+instance (~) ty CInt => HasField "foo_16_packed_e" Foo_16_packed ty
+    where getField = getUnionPayloadBits 0 12
+instance (~) ty CInt => HasField "foo_16_packed_e" Foo_16_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 12 y_1 x_0,
+                              getField @"foo_16_packed_e" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_packed_e" (Ptr Foo_16_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_packed_e")
+instance HasCBitfield Foo_16_packed "foo_16_packed_e"
+    where type CBitfieldType Foo_16_packed "foo_16_packed_e" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 12
+instance (~) ty CInt => HasField "foo_16_packed_f" Foo_16_packed ty
+    where getField = getUnionPayloadBits 0 12
+instance (~) ty CInt => HasField "foo_16_packed_f" Foo_16_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 12 y_1 x_0,
+                              getField @"foo_16_packed_f" x_0)
+instance (~) ty CInt =>
+         HasField "foo_16_packed_f" (Ptr Foo_16_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_16_packed_f")
+instance HasCBitfield Foo_16_packed "foo_16_packed_f"
+    where type CBitfieldType Foo_16_packed "foo_16_packed_f" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 12
+{-| __C declaration:__ @union foo_32_packed@
+
+    __defined at:__ @types\/unions\/bitfields.h 63:31@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_32_packed
+    = Foo_32_packed {unwrapFoo_32_packed :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 1) instance StaticSize Foo_32_packed
+deriving via (SizedByteArray 4 1) instance ReadRaw Foo_32_packed
+deriving via (SizedByteArray 4 1) instance WriteRaw Foo_32_packed
+deriving via (EquivStorable Foo_32_packed) instance Storable Foo_32_packed
+deriving via (SizedByteArray 4 1) instance IsUnion Foo_32_packed
+instance (~) ty CSChar =>
+         HasField "foo_32_packed_a" Foo_32_packed ty
+    where getField = getUnionPayloadBits 0 6
+instance (~) ty CSChar =>
+         HasField "foo_32_packed_a" Foo_32_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 6 y_1 x_0,
+                              getField @"foo_32_packed_a" x_0)
+instance (~) ty CSChar =>
+         HasField "foo_32_packed_a" (Ptr Foo_32_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_packed_a")
+instance HasCBitfield Foo_32_packed "foo_32_packed_a"
+    where type CBitfieldType Foo_32_packed "foo_32_packed_a" = CSChar
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CInt => HasField "foo_32_packed_b" Foo_32_packed ty
+    where getField = getUnionPayloadBits 0 12
+instance (~) ty CInt => HasField "foo_32_packed_b" Foo_32_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 12 y_1 x_0,
+                              getField @"foo_32_packed_b" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_packed_b" (Ptr Foo_32_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_packed_b")
+instance HasCBitfield Foo_32_packed "foo_32_packed_b"
+    where type CBitfieldType Foo_32_packed "foo_32_packed_b" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 12
+instance (~) ty CInt => HasField "foo_32_packed_c" Foo_32_packed ty
+    where getField = getUnionPayloadBits 0 14
+instance (~) ty CInt => HasField "foo_32_packed_c" Foo_32_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 14 y_1 x_0,
+                              getField @"foo_32_packed_c" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_packed_c" (Ptr Foo_32_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_packed_c")
+instance HasCBitfield Foo_32_packed "foo_32_packed_c"
+    where type CBitfieldType Foo_32_packed "foo_32_packed_c" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 14
+instance (~) ty CInt => HasField "foo_32_packed_d" Foo_32_packed ty
+    where getField = getUnionPayloadBits 0 10
+instance (~) ty CInt => HasField "foo_32_packed_d" Foo_32_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 10 y_1 x_0,
+                              getField @"foo_32_packed_d" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_packed_d" (Ptr Foo_32_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_packed_d")
+instance HasCBitfield Foo_32_packed "foo_32_packed_d"
+    where type CBitfieldType Foo_32_packed "foo_32_packed_d" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 10
+instance (~) ty CLong =>
+         HasField "foo_32_packed_e" Foo_32_packed ty
+    where getField = getUnionPayloadBits 0 32
+instance (~) ty CLong =>
+         HasField "foo_32_packed_e" Foo_32_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 32 y_1 x_0,
+                              getField @"foo_32_packed_e" x_0)
+instance (~) ty CLong =>
+         HasField "foo_32_packed_e" (Ptr Foo_32_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_packed_e")
+instance HasCBitfield Foo_32_packed "foo_32_packed_e"
+    where type CBitfieldType Foo_32_packed "foo_32_packed_e" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 32
+instance (~) ty CInt => HasField "foo_32_packed_f" Foo_32_packed ty
+    where getField = getUnionPayloadBits 0 6
+instance (~) ty CInt => HasField "foo_32_packed_f" Foo_32_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 6 y_1 x_0,
+                              getField @"foo_32_packed_f" x_0)
+instance (~) ty CInt =>
+         HasField "foo_32_packed_f" (Ptr Foo_32_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_packed_f")
+instance HasCBitfield Foo_32_packed "foo_32_packed_f"
+    where type CBitfieldType Foo_32_packed "foo_32_packed_f" = CInt
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 6
+instance (~) ty CLong =>
+         HasField "foo_32_packed_g" Foo_32_packed ty
+    where getField = getUnionPayloadBits 0 24
+instance (~) ty CLong =>
+         HasField "foo_32_packed_g" Foo_32_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 24 y_1 x_0,
+                              getField @"foo_32_packed_g" x_0)
+instance (~) ty CLong =>
+         HasField "foo_32_packed_g" (Ptr Foo_32_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_32_packed_g")
+instance HasCBitfield Foo_32_packed "foo_32_packed_g"
+    where type CBitfieldType Foo_32_packed "foo_32_packed_g" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 24
+{-| __C declaration:__ @union foo_64_packed@
+
+    __defined at:__ @types\/unions\/bitfields.h 74:31@
+
+    __exported by:__ @types\/unions\/bitfields.h@
+-}
+newtype Foo_64_packed
+    = Foo_64_packed {unwrapFoo_64_packed :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8 1) instance StaticSize Foo_64_packed
+deriving via (SizedByteArray 8 1) instance ReadRaw Foo_64_packed
+deriving via (SizedByteArray 8 1) instance WriteRaw Foo_64_packed
+deriving via (EquivStorable Foo_64_packed) instance Storable Foo_64_packed
+deriving via (SizedByteArray 8 1) instance IsUnion Foo_64_packed
+instance (~) ty CLong =>
+         HasField "foo_64_packed_a" Foo_64_packed ty
+    where getField = getUnionPayloadBits 0 24
+instance (~) ty CLong =>
+         HasField "foo_64_packed_a" Foo_64_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 24 y_1 x_0,
+                              getField @"foo_64_packed_a" x_0)
+instance (~) ty CLong =>
+         HasField "foo_64_packed_a" (Ptr Foo_64_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_packed_a")
+instance HasCBitfield Foo_64_packed "foo_64_packed_a"
+    where type CBitfieldType Foo_64_packed "foo_64_packed_a" = CLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 24
+instance (~) ty CLLong =>
+         HasField "foo_64_packed_b" Foo_64_packed ty
+    where getField = getUnionPayloadBits 0 40
+instance (~) ty CLLong =>
+         HasField "foo_64_packed_b" Foo_64_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 40 y_1 x_0,
+                              getField @"foo_64_packed_b" x_0)
+instance (~) ty CLLong =>
+         HasField "foo_64_packed_b" (Ptr Foo_64_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_packed_b")
+instance HasCBitfield Foo_64_packed "foo_64_packed_b"
+    where type CBitfieldType Foo_64_packed "foo_64_packed_b" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 40
+instance (~) ty CLLong =>
+         HasField "foo_64_packed_c" Foo_64_packed ty
+    where getField = getUnionPayloadBits 0 64
+instance (~) ty CLLong =>
+         HasField "foo_64_packed_c" Foo_64_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 64 y_1 x_0,
+                              getField @"foo_64_packed_c" x_0)
+instance (~) ty CLLong =>
+         HasField "foo_64_packed_c" (Ptr Foo_64_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_packed_c")
+instance HasCBitfield Foo_64_packed "foo_64_packed_c"
+    where type CBitfieldType Foo_64_packed "foo_64_packed_c" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 64
+instance (~) ty CLLong =>
+         HasField "foo_64_packed_d" Foo_64_packed ty
+    where getField = getUnionPayloadBits 0 36
+instance (~) ty CLLong =>
+         HasField "foo_64_packed_d" Foo_64_packed ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayloadBits 0 36 y_1 x_0,
+                              getField @"foo_64_packed_d" x_0)
+instance (~) ty CLLong =>
+         HasField "foo_64_packed_d" (Ptr Foo_64_packed) (BitfieldPtr ty)
+    where getField = toPtr (Proxy @"foo_64_packed_d")
+instance HasCBitfield Foo_64_packed "foo_64_packed_d"
+    where type CBitfieldType Foo_64_packed "foo_64_packed_d" = CLLong
+          bitfieldOffset# = \_ -> \_ -> 0
+          bitfieldWidth# = \_ -> \_ -> 36
diff --git a/test-artefacts/fixtures/types/unions/nested_unions/Example.hs b/test-artefacts/fixtures/types/unions/nested_unions/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/unions/nested_unions/Example.hs
@@ -0,0 +1,351 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.UnionA(..)
+    , Example.ExA(..)
+    , Example.ExB_fieldB1(..)
+    , Example.ExB(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), Int, pure, type (~))
+
+{-| __C declaration:__ @union unionA@
+
+    __defined at:__ @types\/unions\/nested_unions.h 2:15@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+newtype UnionA = UnionA
+  { unwrapUnionA :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize UnionA
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw UnionA
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw UnionA
+
+deriving via Marshal.EquivStorable UnionA instance BG.Storable UnionA
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion UnionA
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/nested_unions.h 3:21@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "unionA_a" UnionA ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/nested_unions.h 3:21@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "unionA_a" UnionA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"unionA_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "unionA_a" (BG.Ptr UnionA) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unionA_a")
+
+instance HasCField.HasCField UnionA "unionA_a" where
+
+  type CFieldType UnionA "unionA_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/nested_unions.h 4:22@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "unionA_b" UnionA ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/nested_unions.h 4:22@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "unionA_b" UnionA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"unionA_b" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "unionA_b" (BG.Ptr UnionA) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"unionA_b")
+
+instance HasCField.HasCField UnionA "unionA_b" where
+
+  type CFieldType UnionA "unionA_b" = BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct exA@
+
+    __defined at:__ @types\/unions\/nested_unions.h 1:8@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+data ExA = ExA
+  { exA_fieldA1 :: UnionA
+    {- ^ __C declaration:__ @fieldA1@
+
+         __defined at:__ @types\/unions\/nested_unions.h 5:11@
+
+         __exported by:__ @types\/unions\/nested_unions.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize ExA where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw ExA where
+
+  readRaw =
+    \ptr0 ->
+          pure ExA
+      <*> HasCField.readRaw (BG.Proxy @"exA_fieldA1") ptr0
+
+instance Marshal.WriteRaw ExA where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ExA exA_fieldA12 ->
+            HasCField.writeRaw (BG.Proxy @"exA_fieldA1") ptr0 exA_fieldA12
+
+deriving via Marshal.EquivStorable ExA instance BG.Storable ExA
+
+deriving via Struct.IsStructViaReadRaw ExA instance Struct.IsStruct ExA
+
+{-| __C declaration:__ @fieldA1@
+
+    __defined at:__ @types\/unions\/nested_unions.h 5:11@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance (ty ~ UnionA) => BG.CompatHasField.HasField "exA_fieldA1" ExA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         ExA {exA_fieldA1 = y1}, BG.getField @"exA_fieldA1" x0)
+
+instance ( ty ~ UnionA
+         ) => BG.HasField "exA_fieldA1" (BG.Ptr ExA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exA_fieldA1")
+
+instance HasCField.HasCField ExA "exA_fieldA1" where
+
+  type CFieldType ExA "exA_fieldA1" = UnionA
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @union \@exB_fieldB1@
+
+    __defined at:__ @types\/unions\/nested_unions.h 9:9@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+newtype ExB_fieldB1 = ExB_fieldB1
+  { unwrapExB_fieldB1 :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.StaticSize ExB_fieldB1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.ReadRaw ExB_fieldB1
+
+deriving via BG.SizedByteArray 4 4 instance Marshal.WriteRaw ExB_fieldB1
+
+deriving via Marshal.EquivStorable ExB_fieldB1 instance BG.Storable ExB_fieldB1
+
+deriving via BG.SizedByteArray 4 4 instance Union.IsUnion ExB_fieldB1
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/nested_unions.h 10:21@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.HasField "exB_fieldB1_a" ExB_fieldB1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @a@
+
+    __defined at:__ @types\/unions\/nested_unions.h 10:21@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance ( ty ~ BG.CInt
+         ) => BG.CompatHasField.HasField "exB_fieldB1_a" ExB_fieldB1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"exB_fieldB1_a" x0)
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "exB_fieldB1_a" (BG.Ptr ExB_fieldB1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exB_fieldB1_a")
+
+instance HasCField.HasCField ExB_fieldB1 "exB_fieldB1_a" where
+
+  type CFieldType ExB_fieldB1 "exB_fieldB1_a" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/nested_unions.h 11:22@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance (ty ~ BG.CChar) => BG.HasField "exB_fieldB1_b" ExB_fieldB1 ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @b@
+
+    __defined at:__ @types\/unions\/nested_unions.h 11:22@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance ( ty ~ BG.CChar
+         ) => BG.CompatHasField.HasField "exB_fieldB1_b" ExB_fieldB1 ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"exB_fieldB1_b" x0)
+
+instance ( ty ~ BG.CChar
+         ) => BG.HasField "exB_fieldB1_b" (BG.Ptr ExB_fieldB1) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exB_fieldB1_b")
+
+instance HasCField.HasCField ExB_fieldB1 "exB_fieldB1_b" where
+
+  type CFieldType ExB_fieldB1 "exB_fieldB1_b" =
+    BG.CChar
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct exB@
+
+    __defined at:__ @types\/unions\/nested_unions.h 8:8@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+data ExB = ExB
+  { exB_fieldB1 :: ExB_fieldB1
+    {- ^ __C declaration:__ @fieldB1@
+
+         __defined at:__ @types\/unions\/nested_unions.h 12:11@
+
+         __exported by:__ @types\/unions\/nested_unions.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize ExB where
+
+  staticSizeOf = \_ -> (4 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw ExB where
+
+  readRaw =
+    \ptr0 ->
+          pure ExB
+      <*> HasCField.readRaw (BG.Proxy @"exB_fieldB1") ptr0
+
+instance Marshal.WriteRaw ExB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          ExB exB_fieldB12 ->
+            HasCField.writeRaw (BG.Proxy @"exB_fieldB1") ptr0 exB_fieldB12
+
+deriving via Marshal.EquivStorable ExB instance BG.Storable ExB
+
+deriving via Struct.IsStructViaReadRaw ExB instance Struct.IsStruct ExB
+
+{-| __C declaration:__ @fieldB1@
+
+    __defined at:__ @types\/unions\/nested_unions.h 12:11@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+instance ( ty ~ ExB_fieldB1
+         ) => BG.CompatHasField.HasField "exB_fieldB1" ExB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         ExB {exB_fieldB1 = y1}, BG.getField @"exB_fieldB1" x0)
+
+instance ( ty ~ ExB_fieldB1
+         ) => BG.HasField "exB_fieldB1" (BG.Ptr ExB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"exB_fieldB1")
+
+instance HasCField.HasCField ExB "exB_fieldB1" where
+
+  type CFieldType ExB "exB_fieldB1" = ExB_fieldB1
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/unions/nested_unions/bindingspec.yaml b/test-artefacts/fixtures/types/unions/nested_unions/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/unions/nested_unions/bindingspec.yaml
@@ -0,0 +1,86 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/unions/nested_unions.h
+  cname: struct exA
+  hsname: ExA
+- headers: types/unions/nested_unions.h
+  cname: union unionA
+  hsname: UnionA
+- headers: types/unions/nested_unions.h
+  cname: struct exB
+  hsname: ExB
+- headers: types/unions/nested_unions.h
+  cname: union @exB_fieldB1
+  hsname: ExB_fieldB1
+hstypes:
+- hsname: ExA
+  representation:
+    record:
+      constructor: ExA
+      fields:
+      - exA_fieldA1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: ExB
+  representation:
+    record:
+      constructor: ExB
+      fields:
+      - exB_fieldB1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: ExB_fieldB1
+  representation:
+    newtype:
+      constructor: ExB_fieldB1
+      fields:
+      - unwrapExB_fieldB1
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UnionA
+  representation:
+    newtype:
+      constructor: UnionA
+      fields:
+      - unwrapUnionA
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/unions/nested_unions/th.txt b/test-artefacts/fixtures/types/unions/nested_unions/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/unions/nested_unions/th.txt
@@ -0,0 +1,138 @@
+-- addDependentFile test-artefacts/headers/golden/types/unions/nested_unions.h
+{-| __C declaration:__ @union unionA@
+
+    __defined at:__ @types\/unions\/nested_unions.h 2:15@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+newtype UnionA
+    = UnionA {unwrapUnionA :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize UnionA
+deriving via (SizedByteArray 4 4) instance ReadRaw UnionA
+deriving via (SizedByteArray 4 4) instance WriteRaw UnionA
+deriving via (EquivStorable UnionA) instance Storable UnionA
+deriving via (SizedByteArray 4 4) instance IsUnion UnionA
+instance (~) ty CInt => HasField "unionA_a" UnionA ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "unionA_a" UnionA ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"unionA_a" x_0)
+instance (~) ty CInt => HasField "unionA_a" (Ptr UnionA) (Ptr ty)
+    where getField = fromPtr (Proxy @"unionA_a")
+instance HasCField UnionA "unionA_a"
+    where type CFieldType UnionA "unionA_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar => HasField "unionA_b" UnionA ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "unionA_b" UnionA ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"unionA_b" x_0)
+instance (~) ty CChar => HasField "unionA_b" (Ptr UnionA) (Ptr ty)
+    where getField = fromPtr (Proxy @"unionA_b")
+instance HasCField UnionA "unionA_b"
+    where type CFieldType UnionA "unionA_b" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct exA@
+
+    __defined at:__ @types\/unions\/nested_unions.h 1:8@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+data ExA
+    = ExA {exA_fieldA1 :: UnionA
+           {- ^ __C declaration:__ @fieldA1@
+
+                __defined at:__ @types\/unions\/nested_unions.h 5:11@
+
+                __exported by:__ @types\/unions\/nested_unions.h@
+           -}}
+    deriving stock Generic
+instance StaticSize ExA
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw ExA
+    where readRaw = \ptr_0 -> pure ExA <*> readRaw (Proxy @"exA_fieldA1") ptr_0
+instance WriteRaw ExA
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       ExA exA_fieldA1_2 -> writeRaw (Proxy @"exA_fieldA1") ptr_0 exA_fieldA1_2
+deriving via (EquivStorable ExA) instance Storable ExA
+deriving via (IsStructViaReadRaw ExA) instance IsStruct ExA
+instance (~) ty UnionA => HasField "exA_fieldA1" ExA ty
+    where hasField = \x_0 -> (\y_1 -> ExA{exA_fieldA1 = y_1},
+                              getField @"exA_fieldA1" x_0)
+instance (~) ty UnionA => HasField "exA_fieldA1" (Ptr ExA) (Ptr ty)
+    where getField = fromPtr (Proxy @"exA_fieldA1")
+instance HasCField ExA "exA_fieldA1"
+    where type CFieldType ExA "exA_fieldA1" = UnionA
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @union \@exB_fieldB1@
+
+    __defined at:__ @types\/unions\/nested_unions.h 9:9@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+newtype ExB_fieldB1
+    = ExB_fieldB1 {unwrapExB_fieldB1 :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 4 4) instance StaticSize ExB_fieldB1
+deriving via (SizedByteArray 4 4) instance ReadRaw ExB_fieldB1
+deriving via (SizedByteArray 4 4) instance WriteRaw ExB_fieldB1
+deriving via (EquivStorable ExB_fieldB1) instance Storable ExB_fieldB1
+deriving via (SizedByteArray 4 4) instance IsUnion ExB_fieldB1
+instance (~) ty CInt => HasField "exB_fieldB1_a" ExB_fieldB1 ty
+    where getField = getUnionPayload
+instance (~) ty CInt => HasField "exB_fieldB1_a" ExB_fieldB1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"exB_fieldB1_a" x_0)
+instance (~) ty CInt =>
+         HasField "exB_fieldB1_a" (Ptr ExB_fieldB1) (Ptr ty)
+    where getField = fromPtr (Proxy @"exB_fieldB1_a")
+instance HasCField ExB_fieldB1 "exB_fieldB1_a"
+    where type CFieldType ExB_fieldB1 "exB_fieldB1_a" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CChar => HasField "exB_fieldB1_b" ExB_fieldB1 ty
+    where getField = getUnionPayload
+instance (~) ty CChar => HasField "exB_fieldB1_b" ExB_fieldB1 ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"exB_fieldB1_b" x_0)
+instance (~) ty CChar =>
+         HasField "exB_fieldB1_b" (Ptr ExB_fieldB1) (Ptr ty)
+    where getField = fromPtr (Proxy @"exB_fieldB1_b")
+instance HasCField ExB_fieldB1 "exB_fieldB1_b"
+    where type CFieldType ExB_fieldB1 "exB_fieldB1_b" = CChar
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct exB@
+
+    __defined at:__ @types\/unions\/nested_unions.h 8:8@
+
+    __exported by:__ @types\/unions\/nested_unions.h@
+-}
+data ExB
+    = ExB {exB_fieldB1 :: ExB_fieldB1
+           {- ^ __C declaration:__ @fieldB1@
+
+                __defined at:__ @types\/unions\/nested_unions.h 12:11@
+
+                __exported by:__ @types\/unions\/nested_unions.h@
+           -}}
+    deriving stock Generic
+instance StaticSize ExB
+    where staticSizeOf = \_ -> 4 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw ExB
+    where readRaw = \ptr_0 -> pure ExB <*> readRaw (Proxy @"exB_fieldB1") ptr_0
+instance WriteRaw ExB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       ExB exB_fieldB1_2 -> writeRaw (Proxy @"exB_fieldB1") ptr_0 exB_fieldB1_2
+deriving via (EquivStorable ExB) instance Storable ExB
+deriving via (IsStructViaReadRaw ExB) instance IsStruct ExB
+instance (~) ty ExB_fieldB1 => HasField "exB_fieldB1" ExB ty
+    where hasField = \x_0 -> (\y_1 -> ExB{exB_fieldB1 = y_1},
+                              getField @"exB_fieldB1" x_0)
+instance (~) ty ExB_fieldB1 =>
+         HasField "exB_fieldB1" (Ptr ExB) (Ptr ty)
+    where getField = fromPtr (Proxy @"exB_fieldB1")
+instance HasCField ExB "exB_fieldB1"
+    where type CFieldType ExB "exB_fieldB1" = ExB_fieldB1
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/unions/unions/Example.hs b/test-artefacts/fixtures/types/unions/unions/Example.hs
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/unions/unions/Example.hs
@@ -0,0 +1,999 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Example
+    ( Example.Dim2(..)
+    , Example.Dim3(..)
+    , Example.DimPayload(..)
+    , Example.Dim(..)
+    , Example.DimPayloadB(..)
+    , Example.DimB(..)
+    , Example.UntaggedA_xy(..)
+    , Example.UntaggedA_polar(..)
+    , Example.UntaggedA(..)
+    )
+  where
+
+import qualified HsBindgen.Runtime.HasCField as HasCField
+import qualified HsBindgen.Runtime.Marshal as Marshal
+import qualified HsBindgen.Runtime.Struct as Struct
+import qualified HsBindgen.Runtime.Support as BG
+import qualified HsBindgen.Runtime.Support.CompatHasField as BG.CompatHasField
+import qualified HsBindgen.Runtime.Union as Union
+import Prelude ((<*>), (>>), Eq, Int, Show, pure, type (~))
+
+{-| __C declaration:__ @struct Dim2@
+
+    __defined at:__ @types\/unions\/unions.h 1:8@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data Dim2 = Dim2
+  { dim2_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/unions\/unions.h 2:9@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  , dim2_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/unions\/unions.h 3:9@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Dim2 where
+
+  staticSizeOf = \_ -> (8 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Dim2 where
+
+  readRaw =
+    \ptr0 ->
+          pure Dim2
+      <*> HasCField.readRaw (BG.Proxy @"dim2_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dim2_y") ptr0
+
+instance Marshal.WriteRaw Dim2 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Dim2 dim2_x2 dim2_y3 ->
+               HasCField.writeRaw (BG.Proxy @"dim2_x") ptr0 dim2_x2
+            >> HasCField.writeRaw (BG.Proxy @"dim2_y") ptr0 dim2_y3
+
+deriving via Marshal.EquivStorable Dim2 instance BG.Storable Dim2
+
+deriving via Struct.IsStructViaReadRaw Dim2 instance Struct.IsStruct Dim2
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/unions\/unions.h 2:9@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "dim2_x" Dim2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dim2 {dim2_x = y1, dim2_y = BG.getField @"dim2_y" x0}
+      , BG.getField @"dim2_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "dim2_x" (BG.Ptr Dim2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dim2_x")
+
+instance HasCField.HasCField Dim2 "dim2_x" where
+
+  type CFieldType Dim2 "dim2_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/unions\/unions.h 3:9@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "dim2_y" Dim2 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dim2 {dim2_y = y1, dim2_x = BG.getField @"dim2_x" x0}
+      , BG.getField @"dim2_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "dim2_y" (BG.Ptr Dim2) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dim2_y")
+
+instance HasCField.HasCField Dim2 "dim2_y" where
+
+  type CFieldType Dim2 "dim2_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct Dim3@
+
+    __defined at:__ @types\/unions\/unions.h 6:8@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data Dim3 = Dim3
+  { dim3_x :: BG.CInt
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/unions\/unions.h 7:9@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  , dim3_y :: BG.CInt
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/unions\/unions.h 8:9@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  , dim3_z :: BG.CInt
+    {- ^ __C declaration:__ @z@
+
+         __defined at:__ @types\/unions\/unions.h 9:9@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize Dim3 where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Dim3 where
+
+  readRaw =
+    \ptr0 ->
+          pure Dim3
+      <*> HasCField.readRaw (BG.Proxy @"dim3_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dim3_y") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dim3_z") ptr0
+
+instance Marshal.WriteRaw Dim3 where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Dim3 dim3_x2 dim3_y3 dim3_z4 ->
+               HasCField.writeRaw (BG.Proxy @"dim3_x") ptr0 dim3_x2
+            >> HasCField.writeRaw (BG.Proxy @"dim3_y") ptr0 dim3_y3
+            >> HasCField.writeRaw (BG.Proxy @"dim3_z") ptr0 dim3_z4
+
+deriving via Marshal.EquivStorable Dim3 instance BG.Storable Dim3
+
+deriving via Struct.IsStructViaReadRaw Dim3 instance Struct.IsStruct Dim3
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/unions\/unions.h 7:9@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "dim3_x" Dim3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dim3 { dim3_x = y1
+               , dim3_y = BG.getField @"dim3_y" x0
+               , dim3_z = BG.getField @"dim3_z" x0
+               }
+      , BG.getField @"dim3_x" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "dim3_x" (BG.Ptr Dim3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dim3_x")
+
+instance HasCField.HasCField Dim3 "dim3_x" where
+
+  type CFieldType Dim3 "dim3_x" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/unions\/unions.h 8:9@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "dim3_y" Dim3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dim3 { dim3_y = y1
+               , dim3_x = BG.getField @"dim3_x" x0
+               , dim3_z = BG.getField @"dim3_z" x0
+               }
+      , BG.getField @"dim3_y" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "dim3_y" (BG.Ptr Dim3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dim3_y")
+
+instance HasCField.HasCField Dim3 "dim3_y" where
+
+  type CFieldType Dim3 "dim3_y" = BG.CInt
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @z@
+
+    __defined at:__ @types\/unions\/unions.h 9:9@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "dim3_z" Dim3 ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dim3 { dim3_z = y1
+               , dim3_x = BG.getField @"dim3_x" x0
+               , dim3_y = BG.getField @"dim3_y" x0
+               }
+      , BG.getField @"dim3_z" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "dim3_z" (BG.Ptr Dim3) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dim3_z")
+
+instance HasCField.HasCField Dim3 "dim3_z" where
+
+  type CFieldType Dim3 "dim3_z" = BG.CInt
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @union DimPayload@
+
+    __defined at:__ @types\/unions\/unions.h 12:7@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+newtype DimPayload = DimPayload
+  { unwrapDimPayload :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.StaticSize DimPayload
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.ReadRaw DimPayload
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.WriteRaw DimPayload
+
+deriving via Marshal.EquivStorable DimPayload instance BG.Storable DimPayload
+
+deriving via BG.SizedByteArray 8 4 instance Union.IsUnion DimPayload
+
+{-| __C declaration:__ @dim2@
+
+    __defined at:__ @types\/unions\/unions.h 13:17@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ Dim2) => BG.HasField "dimPayload_dim2" DimPayload ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @dim2@
+
+    __defined at:__ @types\/unions\/unions.h 13:17@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ Dim2
+         ) => BG.CompatHasField.HasField "dimPayload_dim2" DimPayload ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"dimPayload_dim2" x0)
+
+instance ( ty ~ Dim2
+         ) => BG.HasField "dimPayload_dim2" (BG.Ptr DimPayload) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dimPayload_dim2")
+
+instance HasCField.HasCField DimPayload "dimPayload_dim2" where
+
+  type CFieldType DimPayload "dimPayload_dim2" = Dim2
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @dim3@
+
+    __defined at:__ @types\/unions\/unions.h 14:17@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ Dim2) => BG.HasField "dimPayload_dim3" DimPayload ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @dim3@
+
+    __defined at:__ @types\/unions\/unions.h 14:17@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ Dim2
+         ) => BG.CompatHasField.HasField "dimPayload_dim3" DimPayload ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"dimPayload_dim3" x0)
+
+instance ( ty ~ Dim2
+         ) => BG.HasField "dimPayload_dim3" (BG.Ptr DimPayload) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dimPayload_dim3")
+
+instance HasCField.HasCField DimPayload "dimPayload_dim3" where
+
+  type CFieldType DimPayload "dimPayload_dim3" = Dim2
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct Dim@
+
+    __defined at:__ @types\/unions\/unions.h 17:8@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data Dim = Dim
+  { dim_tag :: BG.CInt
+    {- ^ __C declaration:__ @tag@
+
+         __defined at:__ @types\/unions\/unions.h 18:9@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  , dim_payload :: DimPayload
+    {- ^ __C declaration:__ @payload@
+
+         __defined at:__ @types\/unions\/unions.h 19:22@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize Dim where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw Dim where
+
+  readRaw =
+    \ptr0 ->
+          pure Dim
+      <*> HasCField.readRaw (BG.Proxy @"dim_tag") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dim_payload") ptr0
+
+instance Marshal.WriteRaw Dim where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          Dim dim_tag2 dim_payload3 ->
+               HasCField.writeRaw (BG.Proxy @"dim_tag") ptr0 dim_tag2
+            >> HasCField.writeRaw (BG.Proxy @"dim_payload") ptr0 dim_payload3
+
+deriving via Marshal.EquivStorable Dim instance BG.Storable Dim
+
+deriving via Struct.IsStructViaReadRaw Dim instance Struct.IsStruct Dim
+
+{-| __C declaration:__ @tag@
+
+    __defined at:__ @types\/unions\/unions.h 18:9@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "dim_tag" Dim ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dim {dim_tag = y1, dim_payload = BG.getField @"dim_payload" x0}
+      , BG.getField @"dim_tag" x0
+      )
+
+instance (ty ~ BG.CInt) => BG.HasField "dim_tag" (BG.Ptr Dim) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dim_tag")
+
+instance HasCField.HasCField Dim "dim_tag" where
+
+  type CFieldType Dim "dim_tag" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @payload@
+
+    __defined at:__ @types\/unions\/unions.h 19:22@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ DimPayload
+         ) => BG.CompatHasField.HasField "dim_payload" Dim ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          Dim {dim_payload = y1, dim_tag = BG.getField @"dim_tag" x0}
+      , BG.getField @"dim_payload" x0
+      )
+
+instance ( ty ~ DimPayload
+         ) => BG.HasField "dim_payload" (BG.Ptr Dim) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dim_payload")
+
+instance HasCField.HasCField Dim "dim_payload" where
+
+  type CFieldType Dim "dim_payload" = DimPayload
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @union DimPayloadB@
+
+    __defined at:__ @types\/unions\/unions.h 23:15@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+newtype DimPayloadB = DimPayloadB
+  { unwrapDimPayloadB :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.StaticSize DimPayloadB
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.ReadRaw DimPayloadB
+
+deriving via BG.SizedByteArray 8 4 instance Marshal.WriteRaw DimPayloadB
+
+deriving via Marshal.EquivStorable DimPayloadB instance BG.Storable DimPayloadB
+
+deriving via BG.SizedByteArray 8 4 instance Union.IsUnion DimPayloadB
+
+{-| __C declaration:__ @dim2@
+
+    __defined at:__ @types\/unions\/unions.h 24:17@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ Dim2) => BG.HasField "dimPayloadB_dim2" DimPayloadB ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @dim2@
+
+    __defined at:__ @types\/unions\/unions.h 24:17@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ Dim2
+         ) => BG.CompatHasField.HasField "dimPayloadB_dim2" DimPayloadB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"dimPayloadB_dim2" x0)
+
+instance ( ty ~ Dim2
+         ) => BG.HasField "dimPayloadB_dim2" (BG.Ptr DimPayloadB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dimPayloadB_dim2")
+
+instance HasCField.HasCField DimPayloadB "dimPayloadB_dim2" where
+
+  type CFieldType DimPayloadB "dimPayloadB_dim2" = Dim2
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @dim3@
+
+    __defined at:__ @types\/unions\/unions.h 25:17@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ Dim2) => BG.HasField "dimPayloadB_dim3" DimPayloadB ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @dim3@
+
+    __defined at:__ @types\/unions\/unions.h 25:17@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ Dim2
+         ) => BG.CompatHasField.HasField "dimPayloadB_dim3" DimPayloadB ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"dimPayloadB_dim3" x0)
+
+instance ( ty ~ Dim2
+         ) => BG.HasField "dimPayloadB_dim3" (BG.Ptr DimPayloadB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dimPayloadB_dim3")
+
+instance HasCField.HasCField DimPayloadB "dimPayloadB_dim3" where
+
+  type CFieldType DimPayloadB "dimPayloadB_dim3" = Dim2
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @struct DimB@
+
+    __defined at:__ @types\/unions\/unions.h 28:8@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data DimB = DimB
+  { dimB_tag :: BG.CInt
+    {- ^ __C declaration:__ @tag@
+
+         __defined at:__ @types\/unions\/unions.h 29:9@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  , dimB_payload :: DimPayloadB
+    {- ^ __C declaration:__ @payload@
+
+         __defined at:__ @types\/unions\/unions.h 30:17@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  }
+  deriving stock (BG.Generic)
+
+instance Marshal.StaticSize DimB where
+
+  staticSizeOf = \_ -> (12 :: Int)
+
+  staticAlignment = \_ -> (4 :: Int)
+
+instance Marshal.ReadRaw DimB where
+
+  readRaw =
+    \ptr0 ->
+          pure DimB
+      <*> HasCField.readRaw (BG.Proxy @"dimB_tag") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"dimB_payload") ptr0
+
+instance Marshal.WriteRaw DimB where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          DimB dimB_tag2 dimB_payload3 ->
+               HasCField.writeRaw (BG.Proxy @"dimB_tag") ptr0 dimB_tag2
+            >> HasCField.writeRaw (BG.Proxy @"dimB_payload") ptr0 dimB_payload3
+
+deriving via Marshal.EquivStorable DimB instance BG.Storable DimB
+
+deriving via Struct.IsStructViaReadRaw DimB instance Struct.IsStruct DimB
+
+{-| __C declaration:__ @tag@
+
+    __defined at:__ @types\/unions\/unions.h 29:9@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "dimB_tag" DimB ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DimB {dimB_tag = y1, dimB_payload = BG.getField @"dimB_payload" x0}
+      , BG.getField @"dimB_tag" x0
+      )
+
+instance ( ty ~ BG.CInt
+         ) => BG.HasField "dimB_tag" (BG.Ptr DimB) (BG.Ptr ty) where
+
+  getField = HasCField.fromPtr (BG.Proxy @"dimB_tag")
+
+instance HasCField.HasCField DimB "dimB_tag" where
+
+  type CFieldType DimB "dimB_tag" = BG.CInt
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @payload@
+
+    __defined at:__ @types\/unions\/unions.h 30:17@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ DimPayloadB
+         ) => BG.CompatHasField.HasField "dimB_payload" DimB ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          DimB {dimB_payload = y1, dimB_tag = BG.getField @"dimB_tag" x0}
+      , BG.getField @"dimB_payload" x0
+      )
+
+instance ( ty ~ DimPayloadB
+         ) => BG.HasField "dimB_payload" (BG.Ptr DimB) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"dimB_payload")
+
+instance HasCField.HasCField DimB "dimB_payload" where
+
+  type CFieldType DimB "dimB_payload" = DimPayloadB
+
+  offset# = \_ -> \_ -> 4
+
+{-| __C declaration:__ @struct \@UntaggedA_xy@
+
+    __defined at:__ @types\/unions\/unions.h 35:5@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data UntaggedA_xy = UntaggedA_xy
+  { untaggedA_xy_x :: BG.CDouble
+    {- ^ __C declaration:__ @x@
+
+         __defined at:__ @types\/unions\/unions.h 35:21@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  , untaggedA_xy_y :: BG.CDouble
+    {- ^ __C declaration:__ @y@
+
+         __defined at:__ @types\/unions\/unions.h 35:31@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UntaggedA_xy where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw UntaggedA_xy where
+
+  readRaw =
+    \ptr0 ->
+          pure UntaggedA_xy
+      <*> HasCField.readRaw (BG.Proxy @"untaggedA_xy_x") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"untaggedA_xy_y") ptr0
+
+instance Marshal.WriteRaw UntaggedA_xy where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UntaggedA_xy untaggedA_xy_x2 untaggedA_xy_y3 ->
+               HasCField.writeRaw (BG.Proxy @"untaggedA_xy_x") ptr0 untaggedA_xy_x2
+            >> HasCField.writeRaw (BG.Proxy @"untaggedA_xy_y") ptr0 untaggedA_xy_y3
+
+deriving via Marshal.EquivStorable UntaggedA_xy instance BG.Storable UntaggedA_xy
+
+deriving via Struct.IsStructViaReadRaw UntaggedA_xy instance Struct.IsStruct UntaggedA_xy
+
+{-| __C declaration:__ @x@
+
+    __defined at:__ @types\/unions\/unions.h 35:21@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "untaggedA_xy_x" UntaggedA_xy ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UntaggedA_xy {untaggedA_xy_x = y1, untaggedA_xy_y = BG.getField @"untaggedA_xy_y" x0}
+      , BG.getField @"untaggedA_xy_x" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "untaggedA_xy_x" (BG.Ptr UntaggedA_xy) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedA_xy_x")
+
+instance HasCField.HasCField UntaggedA_xy "untaggedA_xy_x" where
+
+  type CFieldType UntaggedA_xy "untaggedA_xy_x" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @y@
+
+    __defined at:__ @types\/unions\/unions.h 35:31@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "untaggedA_xy_y" UntaggedA_xy ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UntaggedA_xy {untaggedA_xy_y = y1, untaggedA_xy_x = BG.getField @"untaggedA_xy_x" x0}
+      , BG.getField @"untaggedA_xy_y" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "untaggedA_xy_y" (BG.Ptr UntaggedA_xy) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedA_xy_y")
+
+instance HasCField.HasCField UntaggedA_xy "untaggedA_xy_y" where
+
+  type CFieldType UntaggedA_xy "untaggedA_xy_y" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @struct \@UntaggedA_polar@
+
+    __defined at:__ @types\/unions\/unions.h 36:5@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data UntaggedA_polar = UntaggedA_polar
+  { untaggedA_polar_r :: BG.CDouble
+    {- ^ __C declaration:__ @r@
+
+         __defined at:__ @types\/unions\/unions.h 36:21@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  , untaggedA_polar_p :: BG.CDouble
+    {- ^ __C declaration:__ @p@
+
+         __defined at:__ @types\/unions\/unions.h 36:31@
+
+         __exported by:__ @types\/unions\/unions.h@
+    -}
+  }
+  deriving stock (Eq, BG.Generic, Show)
+
+instance Marshal.StaticSize UntaggedA_polar where
+
+  staticSizeOf = \_ -> (16 :: Int)
+
+  staticAlignment = \_ -> (8 :: Int)
+
+instance Marshal.ReadRaw UntaggedA_polar where
+
+  readRaw =
+    \ptr0 ->
+          pure UntaggedA_polar
+      <*> HasCField.readRaw (BG.Proxy @"untaggedA_polar_r") ptr0
+      <*> HasCField.readRaw (BG.Proxy @"untaggedA_polar_p") ptr0
+
+instance Marshal.WriteRaw UntaggedA_polar where
+
+  writeRaw =
+    \ptr0 ->
+      \s1 ->
+        case s1 of
+          UntaggedA_polar untaggedA_polar_r2 untaggedA_polar_p3 ->
+               HasCField.writeRaw (BG.Proxy @"untaggedA_polar_r") ptr0 untaggedA_polar_r2
+            >> HasCField.writeRaw (BG.Proxy @"untaggedA_polar_p") ptr0 untaggedA_polar_p3
+
+deriving via Marshal.EquivStorable UntaggedA_polar instance BG.Storable UntaggedA_polar
+
+deriving via Struct.IsStructViaReadRaw UntaggedA_polar instance Struct.IsStruct UntaggedA_polar
+
+{-| __C declaration:__ @r@
+
+    __defined at:__ @types\/unions\/unions.h 36:21@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "untaggedA_polar_r" UntaggedA_polar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UntaggedA_polar { untaggedA_polar_r = y1
+                          , untaggedA_polar_p = BG.getField @"untaggedA_polar_p" x0
+                          }
+      , BG.getField @"untaggedA_polar_r" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "untaggedA_polar_r" (BG.Ptr UntaggedA_polar) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedA_polar_r")
+
+instance HasCField.HasCField UntaggedA_polar "untaggedA_polar_r" where
+
+  type CFieldType UntaggedA_polar "untaggedA_polar_r" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @p@
+
+    __defined at:__ @types\/unions\/unions.h 36:31@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ BG.CDouble
+         ) => BG.CompatHasField.HasField "untaggedA_polar_p" UntaggedA_polar ty where
+
+  hasField =
+    \x0 ->
+      ( \y1 ->
+          UntaggedA_polar { untaggedA_polar_p = y1
+                          , untaggedA_polar_r = BG.getField @"untaggedA_polar_r" x0
+                          }
+      , BG.getField @"untaggedA_polar_p" x0
+      )
+
+instance ( ty ~ BG.CDouble
+         ) => BG.HasField "untaggedA_polar_p" (BG.Ptr UntaggedA_polar) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedA_polar_p")
+
+instance HasCField.HasCField UntaggedA_polar "untaggedA_polar_p" where
+
+  type CFieldType UntaggedA_polar "untaggedA_polar_p" =
+    BG.CDouble
+
+  offset# = \_ -> \_ -> 8
+
+{-| __C declaration:__ @union UntaggedA@
+
+    __defined at:__ @types\/unions\/unions.h 34:7@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+newtype UntaggedA = UntaggedA
+  { unwrapUntaggedA :: BG.ByteArray
+  }
+  deriving stock (BG.Generic)
+
+deriving via BG.SizedByteArray 16 8 instance Marshal.StaticSize UntaggedA
+
+deriving via BG.SizedByteArray 16 8 instance Marshal.ReadRaw UntaggedA
+
+deriving via BG.SizedByteArray 16 8 instance Marshal.WriteRaw UntaggedA
+
+deriving via Marshal.EquivStorable UntaggedA instance BG.Storable UntaggedA
+
+deriving via BG.SizedByteArray 16 8 instance Union.IsUnion UntaggedA
+
+{-| __C declaration:__ @xy@
+
+    __defined at:__ @types\/unions\/unions.h 35:36@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance (ty ~ UntaggedA_xy) => BG.HasField "untaggedA_xy" UntaggedA ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @xy@
+
+    __defined at:__ @types\/unions\/unions.h 35:36@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ UntaggedA_xy
+         ) => BG.CompatHasField.HasField "untaggedA_xy" UntaggedA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"untaggedA_xy" x0)
+
+instance ( ty ~ UntaggedA_xy
+         ) => BG.HasField "untaggedA_xy" (BG.Ptr UntaggedA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedA_xy")
+
+instance HasCField.HasCField UntaggedA "untaggedA_xy" where
+
+  type CFieldType UntaggedA "untaggedA_xy" =
+    UntaggedA_xy
+
+  offset# = \_ -> \_ -> 0
+
+{-| __C declaration:__ @polar@
+
+    __defined at:__ @types\/unions\/unions.h 36:36@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ UntaggedA_polar
+         ) => BG.HasField "untaggedA_polar" UntaggedA ty where
+
+  getField = BG.getUnionPayload
+
+{-| __C declaration:__ @polar@
+
+    __defined at:__ @types\/unions\/unions.h 36:36@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+instance ( ty ~ UntaggedA_polar
+         ) => BG.CompatHasField.HasField "untaggedA_polar" UntaggedA ty where
+
+  hasField =
+    \x0 ->
+      (\y1 ->
+         BG.setUnionPayload y1 x0, BG.getField @"untaggedA_polar" x0)
+
+instance ( ty ~ UntaggedA_polar
+         ) => BG.HasField "untaggedA_polar" (BG.Ptr UntaggedA) (BG.Ptr ty) where
+
+  getField =
+    HasCField.fromPtr (BG.Proxy @"untaggedA_polar")
+
+instance HasCField.HasCField UntaggedA "untaggedA_polar" where
+
+  type CFieldType UntaggedA "untaggedA_polar" =
+    UntaggedA_polar
+
+  offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/fixtures/types/unions/unions/bindingspec.yaml b/test-artefacts/fixtures/types/unions/unions/bindingspec.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/unions/unions/bindingspec.yaml
@@ -0,0 +1,204 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: types/unions/unions.h
+  cname: struct Dim2
+  hsname: Dim2
+- headers: types/unions/unions.h
+  cname: struct Dim3
+  hsname: Dim3
+- headers: types/unions/unions.h
+  cname: union DimPayload
+  hsname: DimPayload
+- headers: types/unions/unions.h
+  cname: struct Dim
+  hsname: Dim
+- headers: types/unions/unions.h
+  cname: union DimPayloadB
+  hsname: DimPayloadB
+- headers: types/unions/unions.h
+  cname: DimPayloadB
+  hsname: DimPayloadB
+- headers: types/unions/unions.h
+  cname: struct DimB
+  hsname: DimB
+- headers: types/unions/unions.h
+  cname: union UntaggedA
+  hsname: UntaggedA
+- headers: types/unions/unions.h
+  cname: struct @UntaggedA_xy
+  hsname: UntaggedA_xy
+- headers: types/unions/unions.h
+  cname: struct @UntaggedA_polar
+  hsname: UntaggedA_polar
+hstypes:
+- hsname: Dim
+  representation:
+    record:
+      constructor: Dim
+      fields:
+      - dim_tag
+      - dim_payload
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Dim2
+  representation:
+    record:
+      constructor: Dim2
+      fields:
+      - dim2_x
+      - dim2_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: Dim3
+  representation:
+    record:
+      constructor: Dim3
+      fields:
+      - dim3_x
+      - dim3_y
+      - dim3_z
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: DimB
+  representation:
+    record:
+      constructor: DimB
+      fields:
+      - dimB_tag
+      - dimB_payload
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: DimPayload
+  representation:
+    newtype:
+      constructor: DimPayload
+      fields:
+      - unwrapDimPayload
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: DimPayloadB
+  representation:
+    newtype:
+      constructor: DimPayloadB
+      fields:
+      - unwrapDimPayloadB
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UntaggedA
+  representation:
+    newtype:
+      constructor: UntaggedA
+      fields:
+      - unwrapUntaggedA
+  instances:
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsUnion
+  - ReadRaw
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UntaggedA_polar
+  representation:
+    record:
+      constructor: UntaggedA_polar
+      fields:
+      - untaggedA_polar_r
+      - untaggedA_polar_p
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
+- hsname: UntaggedA_xy
+  representation:
+    record:
+      constructor: UntaggedA_xy
+      fields:
+      - untaggedA_xy_x
+      - untaggedA_xy_y
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - IsStruct
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/fixtures/types/unions/unions/th.txt b/test-artefacts/fixtures/types/unions/unions/th.txt
new file mode 100644
--- /dev/null
+++ b/test-artefacts/fixtures/types/unions/unions/th.txt
@@ -0,0 +1,449 @@
+-- addDependentFile test-artefacts/headers/golden/types/unions/unions.h
+{-| __C declaration:__ @struct Dim2@
+
+    __defined at:__ @types\/unions\/unions.h 1:8@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data Dim2
+    = Dim2 {dim2_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @types\/unions\/unions.h 2:9@
+
+                 __exported by:__ @types\/unions\/unions.h@
+            -},
+            dim2_y :: CInt
+            {- ^ __C declaration:__ @y@
+
+                 __defined at:__ @types\/unions\/unions.h 3:9@
+
+                 __exported by:__ @types\/unions\/unions.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Dim2
+    where staticSizeOf = \_ -> 8 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Dim2
+    where readRaw = \ptr_0 -> (pure Dim2 <*> readRaw (Proxy @"dim2_x") ptr_0) <*> readRaw (Proxy @"dim2_y") ptr_0
+instance WriteRaw Dim2
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Dim2 dim2_x_2
+                                            dim2_y_3 -> writeRaw (Proxy @"dim2_x") ptr_0 dim2_x_2 >> writeRaw (Proxy @"dim2_y") ptr_0 dim2_y_3
+deriving via (EquivStorable Dim2) instance Storable Dim2
+deriving via (IsStructViaReadRaw Dim2) instance IsStruct Dim2
+instance (~) ty CInt => HasField "dim2_x" Dim2 ty
+    where hasField = \x_0 -> (\y_1 -> Dim2{dim2_x = y_1,
+                                           dim2_y = getField @"dim2_y" x_0},
+                              getField @"dim2_x" x_0)
+instance (~) ty CInt => HasField "dim2_x" (Ptr Dim2) (Ptr ty)
+    where getField = fromPtr (Proxy @"dim2_x")
+instance HasCField Dim2 "dim2_x"
+    where type CFieldType Dim2 "dim2_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "dim2_y" Dim2 ty
+    where hasField = \x_0 -> (\y_1 -> Dim2{dim2_y = y_1,
+                                           dim2_x = getField @"dim2_x" x_0},
+                              getField @"dim2_y" x_0)
+instance (~) ty CInt => HasField "dim2_y" (Ptr Dim2) (Ptr ty)
+    where getField = fromPtr (Proxy @"dim2_y")
+instance HasCField Dim2 "dim2_y"
+    where type CFieldType Dim2 "dim2_y" = CInt
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct Dim3@
+
+    __defined at:__ @types\/unions\/unions.h 6:8@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data Dim3
+    = Dim3 {dim3_x :: CInt
+            {- ^ __C declaration:__ @x@
+
+                 __defined at:__ @types\/unions\/unions.h 7:9@
+
+                 __exported by:__ @types\/unions\/unions.h@
+            -},
+            dim3_y :: CInt
+            {- ^ __C declaration:__ @y@
+
+                 __defined at:__ @types\/unions\/unions.h 8:9@
+
+                 __exported by:__ @types\/unions\/unions.h@
+            -},
+            dim3_z :: CInt
+            {- ^ __C declaration:__ @z@
+
+                 __defined at:__ @types\/unions\/unions.h 9:9@
+
+                 __exported by:__ @types\/unions\/unions.h@
+            -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize Dim3
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Dim3
+    where readRaw = \ptr_0 -> ((pure Dim3 <*> readRaw (Proxy @"dim3_x") ptr_0) <*> readRaw (Proxy @"dim3_y") ptr_0) <*> readRaw (Proxy @"dim3_z") ptr_0
+instance WriteRaw Dim3
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Dim3 dim3_x_2
+                                            dim3_y_3
+                                            dim3_z_4 -> writeRaw (Proxy @"dim3_x") ptr_0 dim3_x_2 >> (writeRaw (Proxy @"dim3_y") ptr_0 dim3_y_3 >> writeRaw (Proxy @"dim3_z") ptr_0 dim3_z_4)
+deriving via (EquivStorable Dim3) instance Storable Dim3
+deriving via (IsStructViaReadRaw Dim3) instance IsStruct Dim3
+instance (~) ty CInt => HasField "dim3_x" Dim3 ty
+    where hasField = \x_0 -> (\y_1 -> Dim3{dim3_x = y_1,
+                                           dim3_y = getField @"dim3_y" x_0,
+                                           dim3_z = getField @"dim3_z" x_0},
+                              getField @"dim3_x" x_0)
+instance (~) ty CInt => HasField "dim3_x" (Ptr Dim3) (Ptr ty)
+    where getField = fromPtr (Proxy @"dim3_x")
+instance HasCField Dim3 "dim3_x"
+    where type CFieldType Dim3 "dim3_x" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty CInt => HasField "dim3_y" Dim3 ty
+    where hasField = \x_0 -> (\y_1 -> Dim3{dim3_y = y_1,
+                                           dim3_x = getField @"dim3_x" x_0,
+                                           dim3_z = getField @"dim3_z" x_0},
+                              getField @"dim3_y" x_0)
+instance (~) ty CInt => HasField "dim3_y" (Ptr Dim3) (Ptr ty)
+    where getField = fromPtr (Proxy @"dim3_y")
+instance HasCField Dim3 "dim3_y"
+    where type CFieldType Dim3 "dim3_y" = CInt
+          offset# = \_ -> \_ -> 4
+instance (~) ty CInt => HasField "dim3_z" Dim3 ty
+    where hasField = \x_0 -> (\y_1 -> Dim3{dim3_z = y_1,
+                                           dim3_x = getField @"dim3_x" x_0,
+                                           dim3_y = getField @"dim3_y" x_0},
+                              getField @"dim3_z" x_0)
+instance (~) ty CInt => HasField "dim3_z" (Ptr Dim3) (Ptr ty)
+    where getField = fromPtr (Proxy @"dim3_z")
+instance HasCField Dim3 "dim3_z"
+    where type CFieldType Dim3 "dim3_z" = CInt
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @union DimPayload@
+
+    __defined at:__ @types\/unions\/unions.h 12:7@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+newtype DimPayload
+    = DimPayload {unwrapDimPayload :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8 4) instance StaticSize DimPayload
+deriving via (SizedByteArray 8 4) instance ReadRaw DimPayload
+deriving via (SizedByteArray 8 4) instance WriteRaw DimPayload
+deriving via (EquivStorable DimPayload) instance Storable DimPayload
+deriving via (SizedByteArray 8 4) instance IsUnion DimPayload
+instance (~) ty Dim2 => HasField "dimPayload_dim2" DimPayload ty
+    where getField = getUnionPayload
+instance (~) ty Dim2 => HasField "dimPayload_dim2" DimPayload ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"dimPayload_dim2" x_0)
+instance (~) ty Dim2 =>
+         HasField "dimPayload_dim2" (Ptr DimPayload) (Ptr ty)
+    where getField = fromPtr (Proxy @"dimPayload_dim2")
+instance HasCField DimPayload "dimPayload_dim2"
+    where type CFieldType DimPayload "dimPayload_dim2" = Dim2
+          offset# = \_ -> \_ -> 0
+instance (~) ty Dim2 => HasField "dimPayload_dim3" DimPayload ty
+    where getField = getUnionPayload
+instance (~) ty Dim2 => HasField "dimPayload_dim3" DimPayload ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"dimPayload_dim3" x_0)
+instance (~) ty Dim2 =>
+         HasField "dimPayload_dim3" (Ptr DimPayload) (Ptr ty)
+    where getField = fromPtr (Proxy @"dimPayload_dim3")
+instance HasCField DimPayload "dimPayload_dim3"
+    where type CFieldType DimPayload "dimPayload_dim3" = Dim2
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct Dim@
+
+    __defined at:__ @types\/unions\/unions.h 17:8@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data Dim
+    = Dim {dim_tag :: CInt
+           {- ^ __C declaration:__ @tag@
+
+                __defined at:__ @types\/unions\/unions.h 18:9@
+
+                __exported by:__ @types\/unions\/unions.h@
+           -},
+           dim_payload :: DimPayload
+           {- ^ __C declaration:__ @payload@
+
+                __defined at:__ @types\/unions\/unions.h 19:22@
+
+                __exported by:__ @types\/unions\/unions.h@
+           -}}
+    deriving stock Generic
+instance StaticSize Dim
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw Dim
+    where readRaw = \ptr_0 -> (pure Dim <*> readRaw (Proxy @"dim_tag") ptr_0) <*> readRaw (Proxy @"dim_payload") ptr_0
+instance WriteRaw Dim
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       Dim dim_tag_2
+                                           dim_payload_3 -> writeRaw (Proxy @"dim_tag") ptr_0 dim_tag_2 >> writeRaw (Proxy @"dim_payload") ptr_0 dim_payload_3
+deriving via (EquivStorable Dim) instance Storable Dim
+deriving via (IsStructViaReadRaw Dim) instance IsStruct Dim
+instance (~) ty CInt => HasField "dim_tag" Dim ty
+    where hasField = \x_0 -> (\y_1 -> Dim{dim_tag = y_1,
+                                          dim_payload = getField @"dim_payload" x_0},
+                              getField @"dim_tag" x_0)
+instance (~) ty CInt => HasField "dim_tag" (Ptr Dim) (Ptr ty)
+    where getField = fromPtr (Proxy @"dim_tag")
+instance HasCField Dim "dim_tag"
+    where type CFieldType Dim "dim_tag" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty DimPayload => HasField "dim_payload" Dim ty
+    where hasField = \x_0 -> (\y_1 -> Dim{dim_payload = y_1,
+                                          dim_tag = getField @"dim_tag" x_0},
+                              getField @"dim_payload" x_0)
+instance (~) ty DimPayload =>
+         HasField "dim_payload" (Ptr Dim) (Ptr ty)
+    where getField = fromPtr (Proxy @"dim_payload")
+instance HasCField Dim "dim_payload"
+    where type CFieldType Dim "dim_payload" = DimPayload
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @union DimPayloadB@
+
+    __defined at:__ @types\/unions\/unions.h 23:15@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+newtype DimPayloadB
+    = DimPayloadB {unwrapDimPayloadB :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 8 4) instance StaticSize DimPayloadB
+deriving via (SizedByteArray 8 4) instance ReadRaw DimPayloadB
+deriving via (SizedByteArray 8 4) instance WriteRaw DimPayloadB
+deriving via (EquivStorable DimPayloadB) instance Storable DimPayloadB
+deriving via (SizedByteArray 8 4) instance IsUnion DimPayloadB
+instance (~) ty Dim2 => HasField "dimPayloadB_dim2" DimPayloadB ty
+    where getField = getUnionPayload
+instance (~) ty Dim2 => HasField "dimPayloadB_dim2" DimPayloadB ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"dimPayloadB_dim2" x_0)
+instance (~) ty Dim2 =>
+         HasField "dimPayloadB_dim2" (Ptr DimPayloadB) (Ptr ty)
+    where getField = fromPtr (Proxy @"dimPayloadB_dim2")
+instance HasCField DimPayloadB "dimPayloadB_dim2"
+    where type CFieldType DimPayloadB "dimPayloadB_dim2" = Dim2
+          offset# = \_ -> \_ -> 0
+instance (~) ty Dim2 => HasField "dimPayloadB_dim3" DimPayloadB ty
+    where getField = getUnionPayload
+instance (~) ty Dim2 => HasField "dimPayloadB_dim3" DimPayloadB ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"dimPayloadB_dim3" x_0)
+instance (~) ty Dim2 =>
+         HasField "dimPayloadB_dim3" (Ptr DimPayloadB) (Ptr ty)
+    where getField = fromPtr (Proxy @"dimPayloadB_dim3")
+instance HasCField DimPayloadB "dimPayloadB_dim3"
+    where type CFieldType DimPayloadB "dimPayloadB_dim3" = Dim2
+          offset# = \_ -> \_ -> 0
+{-| __C declaration:__ @struct DimB@
+
+    __defined at:__ @types\/unions\/unions.h 28:8@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data DimB
+    = DimB {dimB_tag :: CInt
+            {- ^ __C declaration:__ @tag@
+
+                 __defined at:__ @types\/unions\/unions.h 29:9@
+
+                 __exported by:__ @types\/unions\/unions.h@
+            -},
+            dimB_payload :: DimPayloadB
+            {- ^ __C declaration:__ @payload@
+
+                 __defined at:__ @types\/unions\/unions.h 30:17@
+
+                 __exported by:__ @types\/unions\/unions.h@
+            -}}
+    deriving stock Generic
+instance StaticSize DimB
+    where staticSizeOf = \_ -> 12 :: Int
+          staticAlignment = \_ -> 4 :: Int
+instance ReadRaw DimB
+    where readRaw = \ptr_0 -> (pure DimB <*> readRaw (Proxy @"dimB_tag") ptr_0) <*> readRaw (Proxy @"dimB_payload") ptr_0
+instance WriteRaw DimB
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       DimB dimB_tag_2
+                                            dimB_payload_3 -> writeRaw (Proxy @"dimB_tag") ptr_0 dimB_tag_2 >> writeRaw (Proxy @"dimB_payload") ptr_0 dimB_payload_3
+deriving via (EquivStorable DimB) instance Storable DimB
+deriving via (IsStructViaReadRaw DimB) instance IsStruct DimB
+instance (~) ty CInt => HasField "dimB_tag" DimB ty
+    where hasField = \x_0 -> (\y_1 -> DimB{dimB_tag = y_1,
+                                           dimB_payload = getField @"dimB_payload" x_0},
+                              getField @"dimB_tag" x_0)
+instance (~) ty CInt => HasField "dimB_tag" (Ptr DimB) (Ptr ty)
+    where getField = fromPtr (Proxy @"dimB_tag")
+instance HasCField DimB "dimB_tag"
+    where type CFieldType DimB "dimB_tag" = CInt
+          offset# = \_ -> \_ -> 0
+instance (~) ty DimPayloadB => HasField "dimB_payload" DimB ty
+    where hasField = \x_0 -> (\y_1 -> DimB{dimB_payload = y_1,
+                                           dimB_tag = getField @"dimB_tag" x_0},
+                              getField @"dimB_payload" x_0)
+instance (~) ty DimPayloadB =>
+         HasField "dimB_payload" (Ptr DimB) (Ptr ty)
+    where getField = fromPtr (Proxy @"dimB_payload")
+instance HasCField DimB "dimB_payload"
+    where type CFieldType DimB "dimB_payload" = DimPayloadB
+          offset# = \_ -> \_ -> 4
+{-| __C declaration:__ @struct \@UntaggedA_xy@
+
+    __defined at:__ @types\/unions\/unions.h 35:5@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data UntaggedA_xy
+    = UntaggedA_xy {untaggedA_xy_x :: CDouble
+                    {- ^ __C declaration:__ @x@
+
+                         __defined at:__ @types\/unions\/unions.h 35:21@
+
+                         __exported by:__ @types\/unions\/unions.h@
+                    -},
+                    untaggedA_xy_y :: CDouble
+                    {- ^ __C declaration:__ @y@
+
+                         __defined at:__ @types\/unions\/unions.h 35:31@
+
+                         __exported by:__ @types\/unions\/unions.h@
+                    -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UntaggedA_xy
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw UntaggedA_xy
+    where readRaw = \ptr_0 -> (pure UntaggedA_xy <*> readRaw (Proxy @"untaggedA_xy_x") ptr_0) <*> readRaw (Proxy @"untaggedA_xy_y") ptr_0
+instance WriteRaw UntaggedA_xy
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UntaggedA_xy untaggedA_xy_x_2
+                                                    untaggedA_xy_y_3 -> writeRaw (Proxy @"untaggedA_xy_x") ptr_0 untaggedA_xy_x_2 >> writeRaw (Proxy @"untaggedA_xy_y") ptr_0 untaggedA_xy_y_3
+deriving via (EquivStorable UntaggedA_xy) instance Storable UntaggedA_xy
+deriving via (IsStructViaReadRaw UntaggedA_xy) instance IsStruct UntaggedA_xy
+instance (~) ty CDouble =>
+         HasField "untaggedA_xy_x" UntaggedA_xy ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedA_xy{untaggedA_xy_x = y_1,
+                                                   untaggedA_xy_y = getField @"untaggedA_xy_y" x_0},
+                              getField @"untaggedA_xy_x" x_0)
+instance (~) ty CDouble =>
+         HasField "untaggedA_xy_x" (Ptr UntaggedA_xy) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedA_xy_x")
+instance HasCField UntaggedA_xy "untaggedA_xy_x"
+    where type CFieldType UntaggedA_xy "untaggedA_xy_x" = CDouble
+          offset# = \_ -> \_ -> 0
+instance (~) ty CDouble =>
+         HasField "untaggedA_xy_y" UntaggedA_xy ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedA_xy{untaggedA_xy_y = y_1,
+                                                   untaggedA_xy_x = getField @"untaggedA_xy_x" x_0},
+                              getField @"untaggedA_xy_y" x_0)
+instance (~) ty CDouble =>
+         HasField "untaggedA_xy_y" (Ptr UntaggedA_xy) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedA_xy_y")
+instance HasCField UntaggedA_xy "untaggedA_xy_y"
+    where type CFieldType UntaggedA_xy "untaggedA_xy_y" = CDouble
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @struct \@UntaggedA_polar@
+
+    __defined at:__ @types\/unions\/unions.h 36:5@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+data UntaggedA_polar
+    = UntaggedA_polar {untaggedA_polar_r :: CDouble
+                       {- ^ __C declaration:__ @r@
+
+                            __defined at:__ @types\/unions\/unions.h 36:21@
+
+                            __exported by:__ @types\/unions\/unions.h@
+                       -},
+                       untaggedA_polar_p :: CDouble
+                       {- ^ __C declaration:__ @p@
+
+                            __defined at:__ @types\/unions\/unions.h 36:31@
+
+                            __exported by:__ @types\/unions\/unions.h@
+                       -}}
+    deriving stock (Eq, Generic, Show)
+instance StaticSize UntaggedA_polar
+    where staticSizeOf = \_ -> 16 :: Int
+          staticAlignment = \_ -> 8 :: Int
+instance ReadRaw UntaggedA_polar
+    where readRaw = \ptr_0 -> (pure UntaggedA_polar <*> readRaw (Proxy @"untaggedA_polar_r") ptr_0) <*> readRaw (Proxy @"untaggedA_polar_p") ptr_0
+instance WriteRaw UntaggedA_polar
+    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
+                                       UntaggedA_polar untaggedA_polar_r_2
+                                                       untaggedA_polar_p_3 -> writeRaw (Proxy @"untaggedA_polar_r") ptr_0 untaggedA_polar_r_2 >> writeRaw (Proxy @"untaggedA_polar_p") ptr_0 untaggedA_polar_p_3
+deriving via (EquivStorable UntaggedA_polar) instance Storable UntaggedA_polar
+deriving via (IsStructViaReadRaw UntaggedA_polar) instance IsStruct UntaggedA_polar
+instance (~) ty CDouble =>
+         HasField "untaggedA_polar_r" UntaggedA_polar ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedA_polar{untaggedA_polar_r = y_1,
+                                                      untaggedA_polar_p = getField @"untaggedA_polar_p" x_0},
+                              getField @"untaggedA_polar_r" x_0)
+instance (~) ty CDouble =>
+         HasField "untaggedA_polar_r" (Ptr UntaggedA_polar) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedA_polar_r")
+instance HasCField UntaggedA_polar "untaggedA_polar_r"
+    where type CFieldType UntaggedA_polar "untaggedA_polar_r" = CDouble
+          offset# = \_ -> \_ -> 0
+instance (~) ty CDouble =>
+         HasField "untaggedA_polar_p" UntaggedA_polar ty
+    where hasField = \x_0 -> (\y_1 -> UntaggedA_polar{untaggedA_polar_p = y_1,
+                                                      untaggedA_polar_r = getField @"untaggedA_polar_r" x_0},
+                              getField @"untaggedA_polar_p" x_0)
+instance (~) ty CDouble =>
+         HasField "untaggedA_polar_p" (Ptr UntaggedA_polar) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedA_polar_p")
+instance HasCField UntaggedA_polar "untaggedA_polar_p"
+    where type CFieldType UntaggedA_polar "untaggedA_polar_p" = CDouble
+          offset# = \_ -> \_ -> 8
+{-| __C declaration:__ @union UntaggedA@
+
+    __defined at:__ @types\/unions\/unions.h 34:7@
+
+    __exported by:__ @types\/unions\/unions.h@
+-}
+newtype UntaggedA
+    = UntaggedA {unwrapUntaggedA :: ByteArray}
+    deriving stock Generic
+deriving via (SizedByteArray 16 8) instance StaticSize UntaggedA
+deriving via (SizedByteArray 16 8) instance ReadRaw UntaggedA
+deriving via (SizedByteArray 16 8) instance WriteRaw UntaggedA
+deriving via (EquivStorable UntaggedA) instance Storable UntaggedA
+deriving via (SizedByteArray 16 8) instance IsUnion UntaggedA
+instance (~) ty UntaggedA_xy =>
+         HasField "untaggedA_xy" UntaggedA ty
+    where getField = getUnionPayload
+instance (~) ty UntaggedA_xy =>
+         HasField "untaggedA_xy" UntaggedA ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"untaggedA_xy" x_0)
+instance (~) ty UntaggedA_xy =>
+         HasField "untaggedA_xy" (Ptr UntaggedA) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedA_xy")
+instance HasCField UntaggedA "untaggedA_xy"
+    where type CFieldType UntaggedA "untaggedA_xy" = UntaggedA_xy
+          offset# = \_ -> \_ -> 0
+instance (~) ty UntaggedA_polar =>
+         HasField "untaggedA_polar" UntaggedA ty
+    where getField = getUnionPayload
+instance (~) ty UntaggedA_polar =>
+         HasField "untaggedA_polar" UntaggedA ty
+    where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
+                              getField @"untaggedA_polar" x_0)
+instance (~) ty UntaggedA_polar =>
+         HasField "untaggedA_polar" (Ptr UntaggedA) (Ptr ty)
+    where getField = fromPtr (Proxy @"untaggedA_polar")
+instance HasCField UntaggedA "untaggedA_polar"
+    where type CFieldType UntaggedA "untaggedA_polar" = UntaggedA_polar
+          offset# = \_ -> \_ -> 0
diff --git a/test-artefacts/headers/comments.h b/test-artefacts/headers/comments.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/comments.h
@@ -0,0 +1,18 @@
+/**
+ * A struct with a Doxygen comment
+ */
+struct S4 {
+    /**
+     * A field preceded by a Doxygen comment
+     */
+    char a;
+
+    int b; /**< A field followed by a Doxygen comment */
+
+    /**
+     * A field that refers to another field
+     *
+     * See also @ref S4::a
+     */
+    float c;
+};
diff --git a/test-artefacts/headers/duplicate_record_field.h b/test-artefacts/headers/duplicate_record_field.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/duplicate_record_field.h
@@ -0,0 +1,7 @@
+struct A {
+  int dup;
+};
+
+struct B {
+  int dup;
+};
diff --git a/test-artefacts/headers/golden/arrays/array.h b/test-artefacts/headers/golden/arrays/array.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/array.h
@@ -0,0 +1,209 @@
+/* Arrays
+ *
+ * See https://en.cppreference.com/w/c/language/array.html
+ */
+
+/*
+ * Storage class
+ */
+
+//! Global, complete, not initialised
+int arr0[3];
+
+//! Global, complete, initialised
+int arr1[] = {1, 2, 3};
+
+//! Global, extern, complete, not initialised
+extern int arr2[3];
+
+//! Global, extern, complete, initialised
+extern int arr3[] = {2, 3, 4};
+
+//! Global, static, complete, not initialised
+static int arr4[3];
+
+//! Global, static, complete, initialised
+static int arr5[] = {3, 4, 5};
+
+//! Global, incomplete
+int arr6[];
+
+//! Global, extern, incomplete
+extern int arr7[];
+
+//! Global, static, incomplete
+static int arr8[3];
+
+/*
+ * Types
+ */
+
+typedef int triplet[3];
+
+typedef int list[];
+
+typedef int matrix[4][3];
+
+typedef int tripletlist[][3];
+
+struct Example {
+    int triple[3];
+    int sudoku[3][3];
+};
+
+//! Typedef-in-typedef
+typedef triplet sudoku[3];
+
+/*
+ * Globals
+ */
+
+//! Array of known size
+extern int arr_1[3];
+
+//! Array of known size, typedef
+extern triplet arr_2;
+
+//! Array of unknown size
+extern int arr_3[];
+
+//! Array of unknown size, typedef
+extern list arr_4;
+
+//! Multi-dimensional array of known size
+extern int arr_5[4][3];
+
+//! Multi-dimensional array of known size, typedef
+extern matrix arr_6;
+
+//! Multi-dimensional array of unknown size
+extern int arr_7[][3];
+
+//! Multi-dimensional array of unknown size, typedef
+extern tripletlist arr_8;
+
+/*
+ * Globals: const
+ */
+
+ //! Array of known size
+extern const int arr_1_const[3];
+
+//! Array of known size, typedef
+extern const triplet arr_2_const;
+
+//! Array of unknown size
+extern const int arr_3_const[];
+
+//! Array of unknown size, typedef
+extern const list arr_4_const;
+
+//! Multi-dimensional array of known size
+extern const int arr_5_const[4][3];
+
+//! Multi-dimensional array of known size, typedef
+extern const matrix arr_6_const;
+
+//! Multi-dimensional array of unknown size
+extern const int arr_7_const[][3];
+
+//! Multi-dimensional array of unknown size, typedef
+extern const tripletlist arr_8_const;
+
+/*
+ * Function arguments
+ */
+
+//! Array of known size
+int fun_1(int x, int xs[3]);
+
+//! Array of known size, typedef
+int fun_2(triplet xs);
+
+//! Array of unknown size
+int fun_3(int xs[]);
+
+//! Array of unknown size, typedef
+int fun_4(list xs);
+
+//! Multi-dimensional array of known size
+int fun_5(int xss[4][3]);
+
+//! Multi-dimensional array of known size, typedef
+int fun_6(matrix xss);
+
+//! Multi-dimensional array of unknown size
+int fun_7(int xss[][3]);
+
+//! Multi-dimensional array of unknown size, typedef
+int fun_8(tripletlist xss);
+
+//! Typedef-in-typedef
+int isSolved(sudoku xss);
+
+/*
+ * Function arguments: const
+ */
+
+//! Array of known size
+int fun_1_const(int x, int xs[3], const int ys[3]);
+
+//! Array of known size, typedef
+int fun_2_const (triplet xs, const triplet ys);
+
+//! Array of unknown size
+int fun_3_const (int xs[], const int ys[]);
+
+//! Array of unknown size, typedef
+int fun_4_const (list xs, const list ys);
+
+//! Multi-dimensional array of known size
+int fun_5_const (int xss[4][3], const int yss[4][3]);
+
+//! Multi-dimensional array of known size, typedef
+int fun_6_const (matrix xss, const matrix yss);
+
+//! Multi-dimensional array of unknown size
+int fun_7_const (int xss[][3], const int yss[][3]);
+
+//! Multi-dimensional array of unknown size, typedef
+int fun_8_const (tripletlist xss, const tripletlist yss);
+
+//! Typedef-in-typedef
+int isSolved_const (sudoku xss, const sudoku yss);
+
+/*
+ * Function results
+ *
+ * NOTE: an array can not be returned directly from a function, so we return a
+ * pointer to the array instead. Note that it is atypical for C code to return
+ * pointers to arrays from functions, but for completeness we include these
+ * examples here anyway.
+ */
+
+//! Array of known size
+int (*fun_9(void))[3];
+
+//! Array of known size, typedef
+triplet *fun_10(void);
+
+//! Array of unknown size
+int (*fun_11(void))[];
+
+//! Array of unknown size, typedef
+list *fun_12(void);
+
+//! Multi-dimensional array of known size
+int (*fun_13(void))[4][3];
+
+//! Multi-dimensional array of known size, typedef
+matrix *fun_14(void);
+
+//! Multi-dimensional array of unknown size
+int (*fun_15(void))[][3];
+
+//! Multi-dimensional array of unknown size, typedef
+tripletlist *fun_16(void);
+
+//! Typedef-in-typedef
+sudoku * solve(void);
diff --git a/test-artefacts/headers/golden/arrays/const_qualifier.h b/test-artefacts/headers/golden/arrays/const_qualifier.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/const_qualifier.h
@@ -0,0 +1,34 @@
+/* Const-qualified arrays */
+
+/* of unknown size */
+
+void foo  (const int x[]);
+
+typedef const int S[];
+typedef       int T[];
+
+void fooA (      S x);
+void fooB (const S x);
+void fooC (const T x);
+
+/* of known size */
+
+void bar  (const int x[3]);
+
+typedef const int U[3];
+typedef       int V[3];
+
+void barA (      U x);
+void barB (const U x);
+void barC (const V x);
+
+/* in a pointer */
+
+void baz  (const int (*x)[3]);
+
+typedef const int W[3];
+typedef       int X[3];
+
+void bazA (      W * x);
+void bazB (const W * x);
+void bazC (const X * x);
diff --git a/test-artefacts/headers/golden/arrays/failing/array_res_1.h b/test-artefacts/headers/golden/arrays/failing/array_res_1.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/array_res_1.h
@@ -0,0 +1,2 @@
+//! An array (of known size) can not be the return type of a function
+int fun_1(int x)[3];
diff --git a/test-artefacts/headers/golden/arrays/failing/array_res_2.h b/test-artefacts/headers/golden/arrays/failing/array_res_2.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/array_res_2.h
@@ -0,0 +1,3 @@
+typedef int triplet[3];
+//! An array (of known size) can not be the return type of a function
+triplet fun_2(int x);
diff --git a/test-artefacts/headers/golden/arrays/failing/array_res_3.h b/test-artefacts/headers/golden/arrays/failing/array_res_3.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/array_res_3.h
@@ -0,0 +1,2 @@
+//! An array (of unknown size) can not be the return type of a function
+int fun_3(int x)[];
diff --git a/test-artefacts/headers/golden/arrays/failing/array_res_4.h b/test-artefacts/headers/golden/arrays/failing/array_res_4.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/array_res_4.h
@@ -0,0 +1,3 @@
+typedef int list[];
+//! An array (of unknown size) can not be the return type of a function
+list fun_4(int x);
diff --git a/test-artefacts/headers/golden/arrays/failing/array_res_5.h b/test-artefacts/headers/golden/arrays/failing/array_res_5.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/array_res_5.h
@@ -0,0 +1,2 @@
+//! A (multi-dimensional) array (of known size) can not be the return type of a function
+int fun_5(int x)[4][3];
diff --git a/test-artefacts/headers/golden/arrays/failing/array_res_6.h b/test-artefacts/headers/golden/arrays/failing/array_res_6.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/array_res_6.h
@@ -0,0 +1,3 @@
+typedef int matrix[4][3];
+//! A (multi-dimensional) array (of known size) can not be the return type of a function
+matrix fun_6(int x);
diff --git a/test-artefacts/headers/golden/arrays/failing/array_res_7.h b/test-artefacts/headers/golden/arrays/failing/array_res_7.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/array_res_7.h
@@ -0,0 +1,2 @@
+//! A (multi-dimensional) array (of unknown size) can not be the return type of a function
+int fun_7(int x)[][3];
diff --git a/test-artefacts/headers/golden/arrays/failing/array_res_8.h b/test-artefacts/headers/golden/arrays/failing/array_res_8.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/array_res_8.h
@@ -0,0 +1,3 @@
+typedef int tripletlist[][3];
+//! A (multi-dimensional) array (of unknown size) can not be the return type of a function
+tripletlist fun_8(int x);
diff --git a/test-artefacts/headers/golden/arrays/failing/selection_bad.h b/test-artefacts/headers/golden/arrays/failing/selection_bad.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/selection_bad.h
@@ -0,0 +1,6 @@
+#include <selection_bad_size_t.h>
+
+#define A int
+
+// Use of macro here, so must be reparsed
+void f(A x, size_t y);
diff --git a/test-artefacts/headers/golden/arrays/failing/selection_bad_size_t.h b/test-artefacts/headers/golden/arrays/failing/selection_bad_size_t.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/failing/selection_bad_size_t.h
@@ -0,0 +1,2 @@
+// Bad programmer, bad
+typedef char *size_t;
diff --git a/test-artefacts/headers/golden/arrays/multi_dim.h b/test-artefacts/headers/golden/arrays/multi_dim.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/arrays/multi_dim.h
@@ -0,0 +1,19 @@
+/* multi-dimensional arrays */
+
+// array of known size of array of known size
+int foo (int xss[3][4]);
+int foo_const (const int xss[3][4]);
+
+// array of unknown size of array of known size
+int bar (int xss[][2]);
+int bar_const (const int xss[][2]);
+
+// typedef of array of known size of array of known size
+typedef int matrix[4][3];
+int baz (matrix xss);
+int baz_const (const matrix xss);
+
+// typedef of array of unknown size of array of known size
+typedef int triplets[][3];
+int quuz (triplets xss);
+int quuz_const (const triplets xss);
diff --git a/test-artefacts/headers/golden/attributes/asm.h b/test-artefacts/headers/golden/attributes/asm.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/attributes/asm.h
@@ -0,0 +1,4 @@
+// We should ignore assembler labels.
+extern int asm_labeled_variable asm("my_variable_label");
+
+int asm_labeled_function(int x, int y) asm("my_function_label");
diff --git a/test-artefacts/headers/golden/attributes/attributes.h b/test-artefacts/headers/golden/attributes/attributes.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/attributes/attributes.h
@@ -0,0 +1,38 @@
+/** @file
+ * Attributes
+ *
+ * See https://clang.llvm.org/docs/AttributeReference.html
+ */
+
+#define PACKED __attribute__((__packed__))
+
+// named struct with attribute
+struct __attribute__((__packed__)) foo {
+    char c;
+    int  i;
+};
+
+// named struct with macro attribute
+struct PACKED bar {
+    char c;
+    int  i;
+};
+
+// untagged struct with attribute
+typedef struct __attribute__((__packed__)) {
+    char c;
+    int  i;
+} baz;
+
+// untagged struct with macro attribute
+typedef struct PACKED {
+    char c;
+    int  i;
+} qux;
+
+// Extract from _stdio.h on OSX
+typedef struct __sFILE {
+    int _r;
+    int _w;
+    int	(* _Nullable _close)(void *);
+} FILE;
diff --git a/test-artefacts/headers/golden/attributes/deprecated.h b/test-artefacts/headers/golden/attributes/deprecated.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/attributes/deprecated.h
@@ -0,0 +1,4 @@
+
+// deprecated
+void deprecated_function(void)
+  __attribute__((deprecated("This function is deprecated. There is no replacement for this function")));
diff --git a/test-artefacts/headers/golden/attributes/type_attributes.h b/test-artefacts/headers/golden/attributes/type_attributes.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/attributes/type_attributes.h
@@ -0,0 +1,35 @@
+/*
+ * Attributes on types
+ *
+ * These examples all come from the gcc manual.
+ * https://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Type-Attributes.html
+ */
+
+struct S { short f[3]; } __attribute__ ((aligned (8)));
+typedef int more_aligned_int __attribute__ ((aligned (8)));
+
+struct S2 { short f[3]; } __attribute__ ((aligned));
+
+struct my_unpacked_struct
+{
+  char c;
+  int i;
+};
+
+struct __attribute__ ((__packed__)) my_packed_struct
+{
+   char c;
+   int  i;
+   struct my_unpacked_struct s;
+};
+
+typedef union
+{
+  int *__ip;
+  union wait *__up;
+} wait_status_ptr_t __attribute__ ((__transparent_union__));
+
+typedef int T1 __attribute__ ((deprecated));
+
+typedef short __attribute__((__may_alias__)) short_a;
+
diff --git a/test-artefacts/headers/golden/attributes/visibility/edge-cases/nested_types.h b/test-artefacts/headers/golden/attributes/visibility/edge-cases/nested_types.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/attributes/visibility/edge-cases/nested_types.h
@@ -0,0 +1,6 @@
+
+struct __attribute__ ((visibility ("default"))) S {
+  union __attribute__ ((visibility ("hidden"))) U {
+    int x;
+  } y;
+};
diff --git a/test-artefacts/headers/golden/attributes/visibility/functions.h b/test-artefacts/headers/golden/attributes/visibility/functions.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/attributes/visibility/functions.h
@@ -0,0 +1,54 @@
+/*
+ * Visibility attributes on function declarations
+ *
+ * https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-visibility
+ *
+ * The example declarations are themselves not terribly interesting.
+ * Nonetheless, they are intended to be extensive enough to cover most (if not
+ * all) interactions between visibility attributes and other aspects that modify
+ * function declarations, such as: linkage, storage class, function definitions,
+ * etc.
+ */
+
+// implicit extern
+void                                                   f0 (void);
+void        __attribute__ ((visibility ("default")))   f1 (void);
+void        __attribute__ ((visibility ("hidden")))    f2 (void);
+void        __attribute__ ((visibility ("internal")))  f3 (void);
+void        __attribute__ ((visibility ("protected"))) f4 (void);
+
+// implicit extern, definition included
+void                                                   f5 (void) {return;};
+void        __attribute__ ((visibility ("default")))   f6 (void) {return;};
+void        __attribute__ ((visibility ("hidden")))    f7 (void) {return;};
+void        __attribute__ ((visibility ("internal")))  f8 (void) {return;};
+void        __attribute__ ((visibility ("protected"))) f9 (void) {return;};
+
+// extern
+extern void                                            f10 (void);
+extern void __attribute__ ((visibility ("default")))   f11 (void);
+extern void __attribute__ ((visibility ("hidden")))    f12 (void);
+extern void __attribute__ ((visibility ("internal")))  f13 (void);
+extern void __attribute__ ((visibility ("protected"))) f14 (void);
+
+// extern, definition included
+extern void                                            f15 (void) {return;};
+extern void __attribute__ ((visibility ("default")))   f16 (void) {return;};
+extern void __attribute__ ((visibility ("hidden")))    f17 (void) {return;};
+extern void __attribute__ ((visibility ("internal")))  f18 (void) {return;};
+extern void __attribute__ ((visibility ("protected"))) f19 (void) {return;};
+
+// static
+static void                                            f20 (void);
+static void __attribute__ ((visibility ("default")))   f21 (void);
+static void __attribute__ ((visibility ("hidden")))    f22 (void);
+static void __attribute__ ((visibility ("internal")))  f23 (void);
+static void __attribute__ ((visibility ("protected"))) f24 (void);
+
+// static, definition included
+static void                                            f25 (void) {return;};
+static void __attribute__ ((visibility ("default")))   f26 (void) {return;};
+static void __attribute__ ((visibility ("hidden")))    f27 (void) {return;};
+static void __attribute__ ((visibility ("internal")))  f28 (void) {return;};
+static void __attribute__ ((visibility ("protected"))) f29 (void) {return;};
+
diff --git a/test-artefacts/headers/golden/attributes/visibility/types.h b/test-artefacts/headers/golden/attributes/visibility/types.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/attributes/visibility/types.h
@@ -0,0 +1,130 @@
+/*
+ * Visibility attributes on type declarations
+ *
+ * https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-visibility
+ *
+ * The example declarations are themselves not terribly interesting.
+ * Nonetheless, they are intended to be extensive enough to cover most (if not
+ * all) interactions between visibility attributes and the differents ways of
+ * declaring struct/union/enum types.
+ */
+
+// opaque struct declaration
+struct                                            S0;
+struct __attribute__ ((visibility ("default")))   S1;
+struct __attribute__ ((visibility ("hidden")))    S2;
+struct __attribute__ ((visibility ("internal")))  S3;
+struct __attribute__ ((visibility ("protected"))) S4;
+
+// struct definition
+struct                                            S5 { int x; };
+struct __attribute__ ((visibility ("default")))   S6 { int x; };
+struct __attribute__ ((visibility ("hidden")))    S7 { int x; };
+struct __attribute__ ((visibility ("internal")))  S8 { int x; };
+struct __attribute__ ((visibility ("protected"))) S9 { int x; };
+
+// forward declaration with attribute, then a struct definition
+struct                                            S10;
+struct __attribute__ ((visibility ("default")))   S11;
+struct __attribute__ ((visibility ("hidden")))    S12;
+struct __attribute__ ((visibility ("internal")))  S13;
+struct __attribute__ ((visibility ("protected"))) S14;
+
+struct                                            S10 { int x; };
+struct                                            S11 { int x; };
+struct                                            S12 { int x; };
+struct                                            S13 { int x; };
+struct                                            S14 { int x; };
+
+// forward declaration, then a struct definition with attribute
+struct                                            S15;
+struct                                            S16;
+struct                                            S17;
+struct                                            S18;
+struct                                            S19;
+
+struct                                            S15 { int x; };
+struct __attribute__ ((visibility ("default")))   S16 { int x; };
+struct __attribute__ ((visibility ("hidden")))    S17 { int x; };
+struct __attribute__ ((visibility ("internal")))  S18 { int x; };
+struct __attribute__ ((visibility ("protected"))) S19 { int x; };
+
+// opaque union declaration
+union                                            U0;
+union __attribute__ ((visibility ("default")))   U1;
+union __attribute__ ((visibility ("hidden")))    U2;
+union __attribute__ ((visibility ("internal")))  U3;
+union __attribute__ ((visibility ("protected"))) U4;
+
+// union definition
+union                                            U5 { int x; };
+union __attribute__ ((visibility ("default")))   U6 { int x; };
+union __attribute__ ((visibility ("hidden")))    U7 { int x; };
+union __attribute__ ((visibility ("internal")))  U8 { int x; };
+union __attribute__ ((visibility ("protected"))) U9 { int x; };
+
+// forward declaration with attribute, then a union definition
+union                                            U10;
+union __attribute__ ((visibility ("default")))   U11;
+union __attribute__ ((visibility ("hidden")))    U12;
+union __attribute__ ((visibility ("internal")))  U13;
+union __attribute__ ((visibility ("protected"))) U14;
+
+union                                            U10 { int x; };
+union                                            U11 { int x; };
+union                                            U12 { int x; };
+union                                            U13 { int x; };
+union                                            U14 { int x; };
+
+// forward declaration, then a union definition with attribute
+union                                            U15;
+union                                            U16;
+union                                            U17;
+union                                            U18;
+union                                            U19;
+
+union                                            U15 { int x; };
+union __attribute__ ((visibility ("default")))   U16 { int x; };
+union __attribute__ ((visibility ("hidden")))    U17 { int x; };
+union __attribute__ ((visibility ("internal")))  U18 { int x; };
+union __attribute__ ((visibility ("protected"))) U19 { int x; };
+
+// opaque enum declaration
+enum                                            E0;
+enum __attribute__ ((visibility ("default")))   E1;
+enum __attribute__ ((visibility ("hidden")))    E2;
+enum __attribute__ ((visibility ("internal")))  E3;
+enum __attribute__ ((visibility ("protected"))) E4;
+
+// enum definition
+enum                                            E5 { x5 };
+enum __attribute__ ((visibility ("default")))   E6 { x6 };
+enum __attribute__ ((visibility ("hidden")))    E7 { x7 };
+enum __attribute__ ((visibility ("internal")))  E8 { x8 };
+enum __attribute__ ((visibility ("protected"))) E9 { x9 };
+
+// forward declaration with attribute, then an enum definition
+enum                                            E10;
+enum __attribute__ ((visibility ("default")))   E11;
+enum __attribute__ ((visibility ("hidden")))    E12;
+enum __attribute__ ((visibility ("internal")))  E13;
+enum __attribute__ ((visibility ("protected"))) E14;
+
+enum                                            E10 { x10 };
+enum                                            E11 { x11 };
+enum                                            E12 { x12 };
+enum                                            E13 { x13 };
+enum                                            E14 { x14 };
+
+// forward declaration, then an enum definition with attribute
+enum                                            E15;
+enum                                            E16;
+enum                                            E17;
+enum                                            E18;
+enum                                            E19;
+
+enum                                            E15 { x15 };
+enum __attribute__ ((visibility ("default")))   E16 { x16 };
+enum __attribute__ ((visibility ("hidden")))    E17 { x17 };
+enum __attribute__ ((visibility ("internal")))  E18 { x18 };
+enum __attribute__ ((visibility ("protected"))) E19 { x19 };
diff --git a/test-artefacts/headers/golden/attributes/visibility/variables.h b/test-artefacts/headers/golden/attributes/visibility/variables.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/attributes/visibility/variables.h
@@ -0,0 +1,53 @@
+/*
+ * Visibility attributes on variable declarations
+ *
+ * https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-visibility
+ *
+ * The example declarations are themselves not terribly interesting.
+ * Nonetheless, they are intended to be extensive enough to cover most (if not
+ * all) interactions between visibility attributes and other aspects that modify
+ * variable declarations, such as: linkage, storage class, variable
+ * initialisers, tenative definitions, etc.
+ */
+
+// non-extern, non-static, tentative definition
+int                                            i0;
+int __attribute__ ((visibility ("default")))   i1;
+int __attribute__ ((visibility ("hidden")))    i2;
+int __attribute__ ((visibility ("internal")))  i3;
+int __attribute__ ((visibility ("protected"))) i4;
+
+// non-extern, non-static, definition included
+int                                            i5 = 5;
+int __attribute__ ((visibility ("default")))   i6 = 6;
+int __attribute__ ((visibility ("hidden")))    i7 = 7;
+int __attribute__ ((visibility ("internal")))  i8 = 8;
+int __attribute__ ((visibility ("protected"))) i9 = 9;
+
+// extern
+extern int                                            i10;
+extern int __attribute__ ((visibility ("default")))   i11;
+extern int __attribute__ ((visibility ("hidden")))    i12;
+extern int __attribute__ ((visibility ("internal")))  i13;
+extern int __attribute__ ((visibility ("protected"))) i14;
+
+// extern, definition included
+extern int                                            i15 = 15;
+extern int __attribute__ ((visibility ("default")))   i16 = 16;
+extern int __attribute__ ((visibility ("hidden")))    i17 = 17;
+extern int __attribute__ ((visibility ("internal")))  i18 = 18;
+extern int __attribute__ ((visibility ("protected"))) i19 = 19;
+
+// static, tentative definition
+static int                                            i20;
+static int __attribute__ ((visibility ("default")))   i21;
+static int __attribute__ ((visibility ("hidden")))    i22;
+static int __attribute__ ((visibility ("internal")))  i23;
+static int __attribute__ ((visibility ("protected"))) i24;
+
+// static, definition included
+static int                                            i25 = 25;
+static int __attribute__ ((visibility ("default")))   i26 = 26;
+static int __attribute__ ((visibility ("hidden")))    i27 = 27;
+static int __attribute__ ((visibility ("internal")))  i28 = 28;
+static int __attribute__ ((visibility ("protected"))) i29 = 29;
diff --git a/test-artefacts/headers/golden/binding-specs/bs_pre_target_mismatch.h b/test-artefacts/headers/golden/binding-specs/bs_pre_target_mismatch.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/bs_pre_target_mismatch.h
@@ -0,0 +1,1 @@
+typedef char sym;
diff --git a/test-artefacts/headers/golden/binding-specs/bs_pre_target_mismatch_p.yaml b/test-artefacts/headers/golden/binding-specs/bs_pre_target_mismatch_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/bs_pre_target_mismatch_p.yaml
@@ -0,0 +1,4 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
diff --git a/test-artefacts/headers/golden/binding-specs/enum/closed.h b/test-artefacts/headers/golden/binding-specs/enum/closed.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/enum/closed.h
@@ -0,0 +1,26 @@
+// The corresponding COMPLETE pragma fits on one line.
+enum foo {
+  bar,
+  baz
+};
+
+// The corresponding COMPLETE pragma does not fit on one line.
+enum elementary_particle_type {
+  quark_up,
+  quark_down,
+  quark_charm,
+  quark_strange,
+  quark_top,
+  quark_bottom,
+  lepton_electron,
+  lepton_electron_neutrino,
+  lepton_muon,
+  lepton_muon_neutrino,
+  lepton_tau,
+  lepton_tau_neutrino,
+  boson_gluon,
+  boson_photon,
+  boson_z,
+  boson_w,
+  boson_higgs
+};
diff --git a/test-artefacts/headers/golden/binding-specs/enum/closed_p.yaml b/test-artefacts/headers/golden/binding-specs/enum/closed_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/enum/closed_p.yaml
@@ -0,0 +1,14 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+
+hsmodule: Example
+
+ctypes:
+  - headers: binding-specs/enum/closed.h
+    cname: enum foo
+    enum: closed
+  - headers: binding-specs/enum/closed.h
+    cname: enum elementary_particle_type
+    hsname: ElementaryParticleType
+    enum: closed
diff --git a/test-artefacts/headers/golden/binding-specs/enum/mismatch.h b/test-artefacts/headers/golden/binding-specs/enum/mismatch.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/enum/mismatch.h
@@ -0,0 +1,1 @@
+struct pt { double x, y; };
diff --git a/test-artefacts/headers/golden/binding-specs/enum/mismatch_p.yaml b/test-artefacts/headers/golden/binding-specs/enum/mismatch_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/enum/mismatch_p.yaml
@@ -0,0 +1,10 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+
+hsmodule: Example
+
+ctypes:
+  - headers: binding-specs/enum/mismatch.h
+    cname: struct pt
+    enum: closed
diff --git a/test-artefacts/headers/golden/binding-specs/enum/open.h b/test-artefacts/headers/golden/binding-specs/enum/open.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/enum/open.h
@@ -0,0 +1,4 @@
+enum foo {
+  bar,
+  baz
+};
diff --git a/test-artefacts/headers/golden/binding-specs/enum/open_p.yaml b/test-artefacts/headers/golden/binding-specs/enum/open_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/enum/open_p.yaml
@@ -0,0 +1,10 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+
+hsmodule: Example
+
+ctypes:
+  - headers: binding-specs/enum/open.h
+    cname: enum foo
+    enum: open
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array.h b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array.h
@@ -0,0 +1,35 @@
+/* Macros of arrays of unknown size */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+// Not replaced by external binding specs
+typedef int MyArray[];
+void foo(MyArray x);
+
+// Not replaced by external binding specs
+#define A MyArray
+#define B A
+
+void fooA(A x);
+void fooB(B x);
+
+// Test transitive dependencies of macros replaced by external binding
+// specifications
+
+// _X, _Y and _Z are intentionally distinct macros from A and B. We want C, D,
+// and E to refer to unselected macros.
+
+// Not selected
+typedef int _X[];
+#define _Y _X
+#define _Z _Y
+
+// Replaced by external binding specs
+#define C _Z
+#define D C
+
+// Not replaced by external binding spec
+#define E C
+
+void fooC(C x);
+void fooD(D x);
+void fooE(E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/macro/array.h
+  cname: macro C
+  hsname: C
+- headers: binding-specs/fun_arg/macro/array.h
+  cname: macro D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array_known_size.h b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array_known_size.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array_known_size.h
@@ -0,0 +1,35 @@
+/* Macros of arrays of known size */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+// Not replaced by external binding specs
+typedef int MyArray[3];
+void foo(MyArray x);
+
+// Not replaced by external binding specs
+#define A MyArray
+#define B A
+
+void fooA(A x);
+void fooB(B x);
+
+// Test transitive dependencies of macros replaced by external binding
+// specifications
+
+// _X, _Y and _Z are intentionally distinct macros from A and B. We want C, D,
+// and E to refer to unselected macros.
+
+// Not selected
+typedef int _X[3];
+#define _Y _X
+#define _Z _Y
+
+// Replaced by external binding specs
+#define C _Z
+#define D C
+
+// Not replaced by external binding spec
+#define E C
+
+void fooC(C x);
+void fooD(D x);
+void fooE(E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array_known_size.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array_known_size.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/array_known_size.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/macro/array_known_size.h
+  cname: macro C
+  hsname: C
+- headers: binding-specs/fun_arg/macro/array_known_size.h
+  cname: macro D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/enum.h b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/enum.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/enum.h
@@ -0,0 +1,35 @@
+/* Macros of enums */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+// Not replaced by external binding specs
+enum MyEnum {x};
+void foo(enum MyEnum x);
+
+// Not replaced by external binding specs
+#define A enum MyEnum
+#define B A
+
+void fooA(A x);
+void fooB(B x);
+
+// Test transitive dependencies of macros replaced by external binding
+// specifications
+
+// _X, _Y and _Z are intentionally distinct macros from A and B. We want C, D,
+// and E to refer to unselected macros.
+
+// Not selected
+enum _X {y};
+#define _Y enum _X
+#define _Z _Y
+
+// Replaced by external binding specs
+#define C _Z
+#define D C
+
+// Not replaced by external binding spec
+#define E C
+
+void fooC(C x);
+void fooD(D x);
+void fooE(E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/enum.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/enum.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/enum.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/macro/enum.h
+  cname: macro C
+  hsname: C
+- headers: binding-specs/fun_arg/macro/enum.h
+  cname: macro D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function.h b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function.h
@@ -0,0 +1,47 @@
+/* Macros of functions */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+// Not replaced by external binding specs
+typedef int MyFunction (int);
+void foo(MyFunction x);
+
+// Not replaced by external binding specs
+#define A MyFunction
+#define B A
+
+void fooA(A x);
+void fooB(B x);
+
+// Test transitive dependencies of macros replaced by external binding
+// specifications
+
+// _X, _Y and _Z are intentionally distinct macros from A and B. We want C, D,
+// and E to refer to unselected macros.
+
+// Not selected
+typedef int _X(int);
+#define _Y _X
+#define _Z _Y
+
+// Replaced by external binding specs
+#define C _Z
+#define D C
+
+// Not replaced by external binding spec
+#define E C
+
+void fooC(C x);
+void fooD(D x);
+void fooE(E x);
+
+// foo* and bar* style functions are equivalent, but we add them both for
+// completeness.
+
+void bar(int (*x) (int));
+
+void barA(A * x);
+void barB(B * x);
+
+void barC(C * x);
+void barD(D * x);
+void barE(E * x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/macro/function.h
+  cname: macro C
+  hsname: C
+- headers: binding-specs/fun_arg/macro/function.h
+  cname: macro D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function_pointer.h b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function_pointer.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function_pointer.h
@@ -0,0 +1,35 @@
+/* Macros of function pointers */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+// Not replaced by external binding specs
+typedef int (*MyFunctionPointer) (int);
+void foo(MyFunctionPointer x);
+
+// Not replaced by external binding specs
+#define A MyFunctionPointer
+#define B A
+
+void fooA(A x);
+void fooB(B x);
+
+// Test transitive dependencies of macros replaced by external binding
+// specifications
+
+// _X, _Y and _Z are intentionally distinct macros from A and B. We want C, D,
+// and E to refer to unselected macros.
+
+// Not selected
+typedef int (*_X)(int);
+#define _Y _X
+#define _Z _Y
+
+// Replaced by external binding specs
+#define C _Z
+#define D C
+
+// Not replaced by external binding spec
+#define E C
+
+void fooC(C x);
+void fooD(D x);
+void fooE(E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function_pointer.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function_pointer.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/function_pointer.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/macro/function_pointer.h
+  cname: macro C
+  hsname: C
+- headers: binding-specs/fun_arg/macro/function_pointer.h
+  cname: macro D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/struct.h b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/struct.h
@@ -0,0 +1,39 @@
+/* Macros of structs */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+// Not replaced by external binding specs
+struct MyStruct {
+  int x;
+};
+void foo(struct MyStruct x);
+
+// Not replaced by external binding specs
+#define A struct MyStruct
+#define B A
+
+void fooA(A x);
+void fooB(B x);
+
+// Test transitive dependencies of macros replaced by external binding
+// specifications
+
+// _X, _Y and _Z are intentionally distinct macros from A and B. We want C, D,
+// and E to refer to unselected macros.
+
+// Not selected
+struct _X {
+  int x;
+};
+#define _Y struct _X
+#define _Z _Y
+
+// Replaced by external binding specs
+#define C _Z
+#define D C
+
+// Not replaced by external binding spec
+#define E C
+
+void fooC(C x);
+void fooD(D x);
+void fooE(E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/struct.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/struct.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/struct.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/macro/struct.h
+  cname: macro C
+  hsname: C
+- headers: binding-specs/fun_arg/macro/struct.h
+  cname: macro D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/union.h b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/union.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/union.h
@@ -0,0 +1,35 @@
+/* Macros of unions */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+// Not replaced by external binding specs
+union MyUnion { int x; };
+void foo(union MyUnion x);
+
+// Not replaced by external binding specs
+#define A union MyUnion
+#define B A
+
+void fooA(A x);
+void fooB(B x);
+
+// Test transitive dependencies of macros replaced by external binding
+// specifications
+
+// _X, _Y and _Z are intentionally distinct macros from A and B. We want C, D,
+// and E to refer to unselected macros.
+
+// Not selected
+union _X { int x; };
+#define _Y union _X
+#define _Z _Y
+
+// Replaced by external binding specs
+#define C _Z
+#define D C
+
+// Not replaced by external binding spec
+#define E C
+
+void fooC(C x);
+void fooD(D x);
+void fooE(E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/macro/union.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/union.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/macro/union.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/macro/union.h
+  cname: macro C
+  hsname: C
+- headers: binding-specs/fun_arg/macro/union.h
+  cname: macro D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array.h b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array.h
@@ -0,0 +1,23 @@
+/* Typedefs of arrays of unkown size */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+void foo  (int x[]);
+
+typedef int A[]; // no binding spec
+typedef A B; // no binding spec
+
+void fooA (A x);
+void fooB (B x);
+
+// _Y and _Z are intentionally distinct typedefs from A and B. We want C, D, and
+// E to refer to unselected typedefs.
+
+typedef int _Y[]; // unselected
+typedef _Y _Z; // unselected
+typedef _Z C; // binding spec
+typedef C D; // binding spec
+typedef C E; // no binding spec
+
+void fooC (C x);
+void fooD (D x);
+void fooE (E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/typedef/array.h
+  cname: C
+  hsname: C
+- headers: binding-specs/fun_arg/typedef/array.h
+  cname: D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array_known_size.h b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array_known_size.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array_known_size.h
@@ -0,0 +1,23 @@
+/* Typedefs of arrays of known size */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+void foo  (int x[3]);
+
+typedef int A[3]; // no binding spec
+typedef A B; // no binding spec
+
+void fooA (A x);
+void fooB (B x);
+
+// _Y and _Z are intentionally distinct typedefs from A and B. We want C, D, and
+// E to refer to unselected typedefs.
+
+typedef int _Y[3]; // unselected
+typedef _Y _Z; // unselected
+typedef _Z C; // binding spec
+typedef C D; // binding spec
+typedef C E; // no binding spec
+
+void fooC (C x);
+void fooD (D x);
+void fooE (E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array_known_size.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array_known_size.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/array_known_size.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/typedef/array_known_size.h
+  cname: C
+  hsname: C
+- headers: binding-specs/fun_arg/typedef/array_known_size.h
+  cname: D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/enum.h b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/enum.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/enum.h
@@ -0,0 +1,25 @@
+/* Typedefs of enums */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+enum MyEnum {x}; // no binding spec
+void foo  (enum MyEnum x);
+
+typedef enum MyEnum A; // no binding spec
+typedef A B; // no binding spec
+
+void fooA (A x);
+void fooB (B x);
+
+// _X, _Y and _Z are intentionally distinct typedefs from A and B. We want C, D,
+// and E to refer to unselected typedefs.
+
+enum _X {y}; // unselected
+typedef enum _X _Y; // unselected
+typedef _Y _Z; // unselected
+typedef _Z C; // binding spec
+typedef C D; // binding spec
+typedef C E; // no binding spec
+
+void fooC (C x);
+void fooD (D x);
+void fooE (E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/enum.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/enum.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/enum.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/typedef/enum.h
+  cname: C
+  hsname: C
+- headers: binding-specs/fun_arg/typedef/enum.h
+  cname: D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+  instances:
+  - HasFFIType
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
+  instances:
+  - HasFFIType
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function.h b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function.h
@@ -0,0 +1,35 @@
+/* Typedefs of functions */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+void foo  (int x (int));
+
+typedef int A(int); // no binding spec
+typedef A B; // no binding spec
+
+void fooA (A x);
+void fooB (B x);
+
+// _Y and _Z are intentionally distinct typedefs from A and B. We want C, D,
+// and E to refer to unselected typedefs.
+
+typedef int _Y(int); // unselected
+typedef _Y _Z; // unselected
+typedef _Z C; // binding spec
+typedef C D; // binding spec
+typedef C E; // no binding spec
+
+void fooC (C x);
+void fooD (D x);
+void fooE (E x);
+
+// foo* and bar* style functions are equivalent, but we add them both for
+// completeness.
+
+void bar  (int (*x) (int));
+
+void barA (A * x);
+void barB (B * x);
+
+void barC (C * x);
+void barD (D * x);
+void barE (E * x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/typedef/function.h
+  cname: C
+  hsname: C
+- headers: binding-specs/fun_arg/typedef/function.h
+  cname: D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function_pointer.h b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function_pointer.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function_pointer.h
@@ -0,0 +1,23 @@
+/* Typedefs of function pointers */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+void foo  (int (*x) (int));
+
+typedef int (*A)(int); // no binding spec
+typedef A B; // no binding spec
+
+void fooA (A x);
+void fooB (B x);
+
+// _Y and _Z are intentionally distinct typedefs from A and B. We want C, D,
+// and E to refer to unselected typedefs.
+
+typedef int (*_Y)(int); // unselected
+typedef _Y _Z; // unselected
+typedef _Z C; // binding spec
+typedef C D; // binding spec
+typedef C E; // no binding spec
+
+void fooC (C x);
+void fooD (D x);
+void fooE (E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function_pointer.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function_pointer.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/function_pointer.yaml
@@ -0,0 +1,28 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/typedef/function_pointer.h
+  cname: C
+  hsname: C
+- headers: binding-specs/fun_arg/typedef/function_pointer.h
+  cname: D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+  instances:
+  - HasFFIType
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
+  instances:
+  - HasFFIType
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/struct.h b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/struct.h
@@ -0,0 +1,25 @@
+/* Typedefs of structs */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+struct MyStruct { int x; }; // no binding spec
+void foo  (struct MyStruct x);
+
+typedef struct MyStruct A; // no binding spec
+typedef A B; // no binding spec
+
+void fooA (A x);
+void fooB (B x);
+
+// _X, _Y and _Z are intentionally distinct typedefs from A and B. We want C, D,
+// and E to refer to unselected typedefs.
+
+struct _X { int x; }; // unselected
+typedef struct _X _Y; // unselected
+typedef _Y _Z; // unselected
+typedef _Z C; // binding spec
+typedef C D; // binding spec
+typedef C E; // no binding spec
+
+void fooC (C x);
+void fooD (D x);
+void fooE (E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/struct.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/struct.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/struct.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/typedef/struct.h
+  cname: C
+  hsname: C
+- headers: binding-specs/fun_arg/typedef/struct.h
+  cname: D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/union.h b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/union.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/union.h
@@ -0,0 +1,25 @@
+/* Typedefs of enums */
+// NOTE: all declarations are selected, unless otherwise specified.
+
+union MyUnion { int x; }; // no binding spec
+void foo  (union MyUnion x);
+
+typedef union MyUnion A; // no binding spec
+typedef A B; // no binding spec
+
+void fooA (A x);
+void fooB (B x);
+
+// _X, _Y and _Z are intentionally distinct typedefs from A and B. We want C, D,
+// and E to refer to unselected typedefs.
+
+union _X { int x; }; // unselected
+typedef union _X _Y; // unselected
+typedef _Y _Z; // unselected
+typedef _Z C; // binding spec
+typedef C D; // binding spec
+typedef C E; // no binding spec
+
+void fooC (C x);
+void fooD (D x);
+void fooE (E x);
diff --git a/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/union.yaml b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/union.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/fun_arg/typedef/union.yaml
@@ -0,0 +1,24 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/fun_arg/typedef/union.h
+  cname: C
+  hsname: C
+- headers: binding-specs/fun_arg/typedef/union.h
+  cname: D
+  hsname: D
+hstypes:
+- hsname: C
+  representation:
+    newtype:
+      constructor: C
+      fields:
+      - unwrapC
+- hsname: D
+  representation:
+    newtype:
+      constructor: D
+      fields:
+      - unwrapD
diff --git a/test-artefacts/headers/golden/binding-specs/name/squash_both.h b/test-artefacts/headers/golden/binding-specs/name/squash_both.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/name/squash_both.h
@@ -0,0 +1,1 @@
+typedef struct foo { int x, y; } bar;
diff --git a/test-artefacts/headers/golden/binding-specs/name/squash_both_p.yaml b/test-artefacts/headers/golden/binding-specs/name/squash_both_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/name/squash_both_p.yaml
@@ -0,0 +1,13 @@
+# Naming a squashed type, specifying the name for both the struct and typedef
+
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/name/squash_both.h
+  cname: struct foo
+  hsname: Hoge
+- headers: binding-specs/name/squash_both.h
+  cname: bar
+  hsname: Hoge
diff --git a/test-artefacts/headers/golden/binding-specs/name/squash_struct.h b/test-artefacts/headers/golden/binding-specs/name/squash_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/name/squash_struct.h
@@ -0,0 +1,1 @@
+typedef struct foo { int x, y; } bar;
diff --git a/test-artefacts/headers/golden/binding-specs/name/squash_struct_p.yaml b/test-artefacts/headers/golden/binding-specs/name/squash_struct_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/name/squash_struct_p.yaml
@@ -0,0 +1,10 @@
+# Naming a squashed type, specifying the name for the struct
+
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/name/squash_struct.h
+  cname: struct foo
+  hsname: Hoge
diff --git a/test-artefacts/headers/golden/binding-specs/name/squash_typedef.h b/test-artefacts/headers/golden/binding-specs/name/squash_typedef.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/name/squash_typedef.h
@@ -0,0 +1,1 @@
+typedef struct foo { int x, y; } bar;
diff --git a/test-artefacts/headers/golden/binding-specs/name/squash_typedef_p.yaml b/test-artefacts/headers/golden/binding-specs/name/squash_typedef_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/name/squash_typedef_p.yaml
@@ -0,0 +1,10 @@
+# Naming a squashed type, specifying the name for the typedef
+
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/name/squash_typedef.h
+  cname: bar
+  hsname: Piyo
diff --git a/test-artefacts/headers/golden/binding-specs/name/type.h b/test-artefacts/headers/golden/binding-specs/name/type.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/name/type.h
@@ -0,0 +1,1 @@
+typedef char sym;
diff --git a/test-artefacts/headers/golden/binding-specs/name/type_p.yaml b/test-artefacts/headers/golden/binding-specs/name/type_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/name/type_p.yaml
@@ -0,0 +1,10 @@
+# Naming a type
+
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/name/type.h
+  cname: sym
+  hsname: MySym
diff --git a/test-artefacts/headers/golden/binding-specs/omit_type.h b/test-artefacts/headers/golden/binding-specs/omit_type.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/omit_type.h
@@ -0,0 +1,6 @@
+typedef char sym;
+
+struct pt {
+  double x;
+  double y;
+};
diff --git a/test-artefacts/headers/golden/binding-specs/omit_type_p.yaml b/test-artefacts/headers/golden/binding-specs/omit_type_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/omit_type_p.yaml
@@ -0,0 +1,8 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- omit:
+    headers: binding-specs/omit_type.h
+    cname: struct pt
diff --git a/test-artefacts/headers/golden/binding-specs/relative_include/core.h b/test-artefacts/headers/golden/binding-specs/relative_include/core.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/relative_include/core.h
@@ -0,0 +1,5 @@
+typedef int widget_id_t;
+
+struct widget_t {
+  widget_id_t id;
+};
diff --git a/test-artefacts/headers/golden/binding-specs/relative_include/sub/consumer.h b/test-artefacts/headers/golden/binding-specs/relative_include/sub/consumer.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/relative_include/sub/consumer.h
@@ -0,0 +1,21 @@
+/*
+ * Regression test for #2236: external binding spec resolution with
+ * different #include spellings.
+ *
+ * This header reaches core.h via a relative path ("../core.h"), but the
+ * external binding spec (consumer.yaml) references it as
+ * "binding-specs/relative_include/core.h".  Before the RealPath switch
+ * these two spellings would not match, so widget_t's external binding
+ * would fail to resolve and widget_legacy_t would lose its external
+ * representation.
+ *
+ * The generated Haskell code imports module M (from the binding spec),
+ * which does not exist in this test fixture, since the test only checks that
+ * the golden output matches, not that it compiles.
+ */
+
+#include "../core.h"
+
+typedef struct widget_t widget_legacy_t;
+
+void use_widget(widget_legacy_t *w);
diff --git a/test-artefacts/headers/golden/binding-specs/relative_include/sub/consumer.yaml b/test-artefacts/headers/golden/binding-specs/relative_include/sub/consumer.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/relative_include/sub/consumer.yaml
@@ -0,0 +1,35 @@
+# Hand-written external binding spec for core.h's types.
+#
+# Simulates having already generated bindings for core.h into module M.
+# An auto-generated spec (via --gen-binding-spec) would differ in naming
+# (Widget_t, Widget_id_t) and would include the full instance list; this
+# trimmed version is enough for the test.
+#
+# The key detail: "headers" uses the root-relative path
+# binding-specs/relative_include/core.h, while consumer.h includes the
+# same file as "../core.h".  The test verifies that RealPath
+# canonicalization makes the match work.
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/relative_include/core.h
+  cname: struct widget_t
+  hsname: WidgetT
+- headers: binding-specs/relative_include/core.h
+  cname: widget_id_t
+  hsname: WidgetIdT
+hstypes:
+- hsname: WidgetT
+  representation:
+    newtype:
+      constructor: WidgetT
+      fields:
+      - unwrapWidgetT
+- hsname: WidgetIdT
+  representation:
+    newtype:
+      constructor: WidgetIdT
+      fields:
+      - unwrapWidgetIdT
diff --git a/test-artefacts/headers/golden/binding-specs/rep/emptydata/pt.h b/test-artefacts/headers/golden/binding-specs/rep/emptydata/pt.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/rep/emptydata/pt.h
@@ -0,0 +1,1 @@
+struct pt { double x, y; };
diff --git a/test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize.h b/test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize.h
@@ -0,0 +1,27 @@
+#include "staticsize_deps.h"
+
+// Every type below is given the emptydata representation in staticsize_p.yaml.
+// A StaticSize instance is generated whenever the underlying C type has a known
+// size and alignment.
+
+// --- Complete C types: struct, union, and enum carry their layout directly. ---
+
+struct point2d { int x; int y; };
+
+union value { int i; double d; };
+
+enum color { RED, GREEN, BLUE };
+
+// --- Typedefs: resolved to their underlying complete type. ---
+
+typedef struct pt   td_struct;   // typedef -> struct
+typedef pt_alias    td_chain;    // typedef -> typedef -> struct
+typedef union shape td_union;    // typedef -> union
+
+// --- No size available at this pass: no StaticSize instance is generated. ---
+
+typedef int counter;             // typedef -> primitive
+
+struct opaque_fwd;               // opaque (forward declaration)
+
+#define macro_ptr int *          // macro -> pointer
diff --git a/test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize_deps.h b/test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize_deps.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize_deps.h
@@ -0,0 +1,9 @@
+#include "pt.h"
+
+// Underlying types named (only) by typedefs that are given the emptydata
+// representation in staticsize.h.  They live in a separate header so program
+// slicing keeps them out of the generated output.
+
+typedef struct pt pt_alias;
+
+union shape { int tag; double value; };
diff --git a/test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize_p.yaml b/test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize_p.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize_p.yaml
@@ -0,0 +1,51 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: struct point2d
+  hsname: Point2d
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: union value
+  hsname: Value
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: enum color
+  hsname: Color
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: td_struct
+  hsname: TdStruct
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: td_chain
+  hsname: TdChain
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: td_union
+  hsname: TdUnion
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: counter
+  hsname: Counter
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: struct opaque_fwd
+  hsname: OpaqueFwd
+- headers: binding-specs/rep/emptydata/staticsize.h
+  cname: macro macro_ptr
+  hsname: MacroPtr
+hstypes:
+- hsname: Point2d
+  representation: emptydata
+- hsname: Value
+  representation: emptydata
+- hsname: Color
+  representation: emptydata
+- hsname: TdStruct
+  representation: emptydata
+- hsname: TdChain
+  representation: emptydata
+- hsname: TdUnion
+  representation: emptydata
+- hsname: Counter
+  representation: emptydata
+- hsname: OpaqueFwd
+  representation: emptydata
+- hsname: MacroPtr
+  representation: emptydata
diff --git a/test-artefacts/headers/golden/binding-specs/stdlib/bool.h b/test-artefacts/headers/golden/binding-specs/stdlib/bool.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/stdlib/bool.h
@@ -0,0 +1,1 @@
+typedef bool stdlib_CBool;
diff --git a/test-artefacts/headers/golden/binding-specs/stdlib/instances.h b/test-artefacts/headers/golden/binding-specs/stdlib/instances.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/stdlib/instances.h
@@ -0,0 +1,64 @@
+// This test declares typedefs around stdlib types.  The resulting Haskell
+// module derives the instances that are configured for each stdlib type, and
+// compiling the module tests that all of those instances exist.
+
+#include <fenv.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <time.h>
+#include <uchar.h>
+#include <wchar.h>
+#include <wctype.h>
+
+// Boolean types
+typedef bool stdlib_CBool;
+
+// Integral types
+typedef int8_t    stdlib_Int8;
+typedef int16_t   stdlib_Int16;
+typedef int32_t   stdlib_Int32;
+typedef int64_t   stdlib_Int64;
+typedef uint8_t   stdlib_Word8;
+typedef uint16_t  stdlib_Word16;
+typedef uint32_t  stdlib_Word32;
+typedef uint64_t  stdlib_Word64;
+typedef intmax_t  stdlib_CIntMax;
+typedef uintmax_t stdlib_CUIntMax;
+typedef intptr_t  stdlib_CIntPtr;
+typedef uintptr_t stdlib_CUIntPtr;
+
+// Floating types
+typedef fenv_t    stdlib_CFenvT;
+typedef fexcept_t stdlib_CFexceptT;
+
+// Standard types
+typedef size_t    stdlib_CSize;
+typedef ptrdiff_t stdlib_CPtrdiff;
+
+// Non-local jump types
+typedef jmp_buf stdlib_CJmpBuf;
+
+// Wide character types
+typedef wchar_t   stdlib_CWchar;
+typedef wint_t    stdlib_CWintT;
+typedef mbstate_t stdlib_CMbstateT;
+typedef wctrans_t stdlib_CWctransT;
+typedef wctype_t  stdlib_CWctypeT;
+typedef char16_t  stdlib_CChar16T;
+typedef char32_t  stdlib_CChar32T;
+
+// Time types
+typedef time_t    stdlib_CTime;
+typedef clock_t   stdlib_CClock;
+typedef struct tm stdlib_CTm;
+
+// File types
+typedef FILE   stdlib_CFile;
+typedef fpos_t stdlib_CFpos;
+
+// Signal types
+typedef sig_atomic_t stdlib_CSigAtomic;
diff --git a/test-artefacts/headers/golden/binding-specs/stdlib/return_values.h b/test-artefacts/headers/golden/binding-specs/stdlib/return_values.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/stdlib/return_values.h
@@ -0,0 +1,68 @@
+// This test declares functions that return stdlib types.  Compiling the
+// resulting Haskell module tests that the types have consistent representation
+// (as well as ReadRaw instances).
+//
+// TODO Automatic test: https://github.com/well-typed/hs-bindgen/issues/1690
+
+#include <fenv.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <time.h>
+#include <uchar.h>
+#include <wchar.h>
+#include <wctype.h>
+
+// Boolean types
+bool bool_fun();
+
+// Integral types
+int8_t    int8_t_fun();
+int16_t   int16_t_fun();
+int32_t   int32_t_fun();
+int64_t   int64_t_fun();
+uint8_t   uint8_t_fun();
+uint16_t  uint16_t_fun();
+uint32_t  uint32_t_fun();
+uint64_t  uint64_t_fun();
+intmax_t  intmax_t_fun();
+uintmax_t uintmax_t_fun();
+intptr_t  intptr_t_fun();
+uintptr_t uintptr_t_fun();
+
+// Floating types
+fenv_t    *fenv_t_fun();
+fexcept_t *fexcept_t_fun();
+
+// Standard types
+size_t    size_t_fun();
+ptrdiff_t ptrdiff_t_fun();
+
+// Non-local jump types
+// Functions cannot return array types, so we use a value for jmp_buf.
+extern jmp_buf jmp_buf_val;
+
+// Wide character types
+wchar_t   wchar_t_fun();
+wint_t    wint_t_fun();
+mbstate_t *mbstate_t_fun();
+wctrans_t wctrans_t_fun();
+wctype_t  wctype_t_fun();
+char16_t  char16_t_fun();
+char32_t  char32_t_fun();
+
+// Time types
+time_t  time_t_fun();
+clock_t clock_t_fun();
+// TODO https://github.com/well-typed/hs-bindgen/issues/786
+// struct tm struct_tm_fun();
+
+// File types
+FILE   *FILE_fun();
+fpos_t *fpos_t_fun();
+
+// Signal types
+sig_atomic_t sig_atomic_t_fun();
diff --git a/test-artefacts/headers/golden/binding-specs/trans_dep/macro_trans_dep_missing.h b/test-artefacts/headers/golden/binding-specs/trans_dep/macro_trans_dep_missing.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/trans_dep/macro_trans_dep_missing.h
@@ -0,0 +1,7 @@
+// Unselected
+typedef int A;
+
+// Replaced by external binding specifications
+#define B A
+
+void foo(B x);
diff --git a/test-artefacts/headers/golden/binding-specs/trans_dep/macro_trans_dep_missing.yaml b/test-artefacts/headers/golden/binding-specs/trans_dep/macro_trans_dep_missing.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/trans_dep/macro_trans_dep_missing.yaml
@@ -0,0 +1,15 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/trans_dep/macro_trans_dep_missing.h
+  cname: macro B
+  hsname: B
+hstypes:
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
diff --git a/test-artefacts/headers/golden/binding-specs/trans_dep/typedef_trans_dep_missing.h b/test-artefacts/headers/golden/binding-specs/trans_dep/typedef_trans_dep_missing.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/trans_dep/typedef_trans_dep_missing.h
@@ -0,0 +1,9 @@
+// Unselected
+typedef int A;
+
+// Replaced by external binding specifications
+typedef A B;
+
+// foo :: Ptr B -> ... or foo :: FunPtr B -> ... ?
+// (depends on B = A = int, therefore Ptr)
+void foo(B *x);
diff --git a/test-artefacts/headers/golden/binding-specs/trans_dep/typedef_trans_dep_missing.yaml b/test-artefacts/headers/golden/binding-specs/trans_dep/typedef_trans_dep_missing.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/binding-specs/trans_dep/typedef_trans_dep_missing.yaml
@@ -0,0 +1,15 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: binding-specs/trans_dep/typedef_trans_dep_missing.h
+  cname: B
+  hsname: B
+hstypes:
+- hsname: B
+  representation:
+    newtype:
+      constructor: B
+      fields:
+      - unwrapB
diff --git a/test-artefacts/headers/golden/comprehensive/c2hsc.h b/test-artefacts/headers/golden/comprehensive/c2hsc.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/comprehensive/c2hsc.h
@@ -0,0 +1,367 @@
+/** @file
+ * Examples from the c2hsc test suite
+ *
+ * https://github.com/jwiegley/c2hsc/blob/master/test/main.hs
+ */
+
+/**
+ * Issues
+ */
+
+// typedef const is seen as const rather than typedef (#38)
+typedef const char* an_pchar;
+
+// incorrect code generated for char x[8][255" (#25)
+typedef struct {
+    char listOfNames[8][255];
+} MyCoolStruct;
+
+// Export function pointers as callbacks rather than just synonyms (#17)
+typedef int (*foo)(int);
+
+// function pointer arrays
+//
+// NOTE: This test is commented out in the original test suite.
+// NOTE: Modified it to be 'extern' (to make the incomplete array possible).
+extern int (*my_array[])(int);
+
+// function pointer structure members
+//
+// NOTE: This test is commented out in the original test suite.
+struct foo_t {
+    int (*foo_member)(int);
+};
+
+// function pointer function arguments
+//
+// NOTE: This test is commented out in the original test suite.
+void foo_function(int (*foo)(int)) {}
+
+// Enum type names are sometimes handled incorrectly (#10)
+//
+// NOTE: Test suite refers to #15 here, but I think that's a mistake.
+// NOTE: Renamed to avoid conflicts.
+typedef struct Foo_10_ Foo_10;
+typedef enum Bar_10_ { BAR } Bar_10;
+
+// Non-typedefed structs, unions, and enums are not correctly translated (#12)
+struct st {
+  int i;
+};
+
+enum e {
+  CONST
+};
+
+union u {
+  char c;
+};
+
+// Duplicate opaque_t struct (#15)
+struct MyTypeImpl;
+typedef struct MyTypeImpl* MyType;
+
+typedef struct MyStruct {
+  int x;
+} MyStructType;
+
+typedef struct MyStructEmpty MyStructEmptyType;
+
+// "unsigned" as a type is being translated to unit (#33)
+//
+// NOTE: Renamed to avoid conflicts.
+unsigned foo_33_1(unsigned);
+unsigned __attribute__ ((visibility ("default"))) foo_33_2(unsigned);
+long long __attribute__ ((visibility ("default"))) foo_33_3(long long);
+
+/**
+ * Primitive types
+ *
+ * NOTE: Here and elsewhere the original test suite has some references to `long
+ * double`, some commented out, and some---confusingly---not, with an
+ * expectation of a translation to `CDouble`; the latter I think is a bug in the
+ * original test suite. Here we leave all of these test cases in; we emit an
+ * "unsupported" message for these and omit the declaration in the generated
+ * bindings.
+ */
+
+float              ordinary_float;
+double             ordinary_double;
+long double        ordinary_long_double;
+
+char               ordinary_char;
+signed char        signed_char;
+unsigned char      unsigned_char;
+
+short              ordinary_signed_short;
+signed short       explicit_signed_short;
+unsigned short     unsigned_short;
+
+int                ordinary_signed_int;
+signed int         explicit_signed_int;
+unsigned int       unsigned_int;
+
+long               ordinary_signed_long;
+signed long        explicit_signed_long;
+unsigned long      unsigned_long;
+
+long long          ordinary_signed_long_long;
+signed long long   explicit_signed_long_long;
+unsigned long long unsigned_long_long;
+
+/**
+ * Pointers: primitive types which cannot be signed
+ */
+
+void*               ordinary_void_pointer;
+
+float*              ordinary_float_pointer;
+double*             ordinary_double_pointer;
+long double*        ordinary_long_double_pointer;
+
+char*               ordinary_char_pointer;
+signed char*        signed_char_pointer;
+unsigned char*      unsigned_char_pointer;
+
+short*              ordinary_signed_short_pointer;
+signed short*       explicit_signed_short_pointer;
+unsigned short*     unsigned_short_pointer;
+
+int*                ordinary_signed_int_pointer;
+signed int*         explicit_signed_int_pointer;
+unsigned int*       unsigned_int_pointer;
+
+long*               ordinary_signed_long_pointer;
+signed long*        explicit_signed_long_pointer;
+unsigned long*      unsigned_long_pointer;
+
+long long*          ordinary_signed_long_long_pointer;
+signed long long*   explicit_signed_long_long_pointer;
+unsigned long long* unsigned_long_long_pointer;
+
+/**
+ * Arrays: primitive types which cannot be signed
+ */
+
+float              ordinary_float_array[10];
+double             ordinary_double_array[10];
+long double        ordinary_long_double_array[10];
+
+char               ordinary_signed_char_array[10];
+signed char        explicit_signed_char_array[10];
+unsigned char      unsigned_char_array[10];
+
+short              ordinary_signed_short_array[10];
+signed short       explicit_signed_short_array[10];
+unsigned short     unsigned_short_array[10];
+
+int                ordinary_signed_int_array[10];
+signed int         explicit_signed_int_array[10];
+unsigned int       unsigned_int_array[10];
+
+long               ordinary_signed_long_array[10];
+signed long        explicit_signed_long_array[10];
+unsigned long      unsigned_long_array[10];
+
+long long          ordinary_signed_long_long_array[10];
+signed long long   explicit_signed_long_long_array[10];
+unsigned long long unsigned_long_long_array[10];
+
+/**
+ * Arrays of pointers
+ */
+
+void*               ordinary_void_pointer_array[10];
+
+float*              ordinary_float_pointer_array[10];
+double*             ordinary_double_pointer_array[10];
+long double*        ordinary_long_double_pointer_array[10];
+
+char*               ordinary_signed_char_pointer_array[10];
+signed char*        explicit_signed_char_pointer_array[10];
+unsigned char*      unsigned_char_pointer_array[10];
+
+short*              ordinary_signed_short_pointer_array[10];
+signed short*       explicit_signed_short_pointer_array[10];
+unsigned short*     unsigned_short_pointer_array[10];
+
+int*                ordinary_signed_int_pointer_array[10];
+signed int*         explicit_signed_int_pointer_array[10];
+unsigned int*       unsigned_int_pointer_array[10];
+
+long*               ordinary_signed_long_pointer_array[10];
+signed long*        explicit_signed_long_pointer_array[10];
+unsigned long*      unsigned_long_pointer_array[10];
+
+long long*          ordinary_signed_long_long_pointer_array[10];
+signed long long*   explicit_signed_long_long_pointer_array[10];
+unsigned long long* unsigned_long_long_pointer_array[10];
+
+/**
+ * Structs: primitive types
+ */
+
+struct ordinary_float_struct            { float              ordinary_float_member;            };
+struct ordinary_double_struct           { double             ordinary_double_member;           };
+struct ordinary_long_double_struct      { long double        ordinary_long_double_member;      };
+
+struct ordinary_signed_char_struct      { char               ordinary_signed_char_member;      };
+struct explicit_signed_char_struct      { signed char        explicit_signed_char_member;      };
+struct unsigned_char_struct             { unsigned char      unsigned_char_member;             };
+
+struct ordinary_signed_short_struct     { short              ordinary_signed_short_member;     };
+struct explicit_signed_short_struct     { signed short       explicit_signed_short_member;     };
+struct unsigned_short_struct            { unsigned short     unsigned_short_member;            };
+
+struct ordinary_signed_int_struct       { int                ordinary_signed_int_member;       };
+struct explicit_signed_int_struct       { signed int         explicit_signed_int_member;       };
+struct unsigned_int_struct              { unsigned int       unsigned_int_member;              };
+
+struct ordinary_signed_long_struct      { long               ordinary_signed_long_member;      };
+struct explicit_signed_long_struct      { signed long        explicit_signed_long_member;      };
+struct unsigned_long_struct             { unsigned long      unsigned_long_member;             };
+
+struct ordinary_signed_long_long_struct { long long          ordinary_signed_long_long_member; };
+struct explicit_signed_long_long_struct { signed long long   explicit_signed_long_long_member; };
+struct unsigned_long_long_struct        { unsigned long long unsigned_long_long_member;        };
+
+/**
+ * Structs: pointers
+ *
+ * NOTE: `ordinary_signed_char_pointer_struct` is commented out in the original
+ * test suite, unclear why (no reason is given).
+ */
+
+struct ordinary_void_pointer_struct             { void*               ordinary_void_pointer_member;             };
+
+struct ordinary_float_pointer_struct            { float*              ordinary_float_pointer_member;            };
+struct ordinary_double_pointer_struct           { double*             ordinary_double_pointer_member;           };
+struct ordinary_long_double_pointer_struct      { long double*        ordinary_long_double_pointer_member;      };
+
+struct ordinary_signed_char_pointer_struct      { char*               ordinary_signed_char_pointer_member;      };
+struct explicit_signed_char_pointer_struct      { signed char*        explicit_signed_char_pointer_member;      };
+struct unsigned_char_pointer_struct             { unsigned char*      unsigned_char_pointer_member;             };
+
+struct ordinary_signed_short_pointer_struct     { short*              ordinary_signed_short_pointer_member;     };
+struct explicit_signed_short_pointer_struct     { signed short*       explicit_signed_short_pointer_member;     };
+struct unsigned_short_pointer_struct            { unsigned short*     unsigned_short_pointer_member;            };
+
+struct ordinary_signed_int_pointer_struct       { int*                ordinary_signed_int_pointer_member;       };
+struct explicit_signed_int_pointer_struct       { signed int*         explicit_signed_int_pointer_member;       };
+struct unsigned_int_pointer_struct              { unsigned int*       unsigned_int_pointer_member;              };
+
+struct ordinary_signed_long_pointer_struct      { long*               ordinary_signed_long_pointer_member;      };
+struct explicit_signed_long_pointer_struct      { signed long*        explicit_signed_long_pointer_member;      };
+struct unsigned_long_pointer_struct             { unsigned long*      unsigned_long_pointer_member;             };
+
+struct ordinary_signed_long_long_pointer_struct { long long*          ordinary_signed_long_long_pointer_member; };
+struct explicit_signed_long_long_pointer_struct { signed long long*   explicit_signed_long_long_pointer_member; };
+struct unsigned_long_long_pointer_struct        { unsigned long long* unsigned_long_long_pointer_member;        };
+
+/**
+ * Structs: arrays
+ */
+
+struct ordinary_float_array_struct            { float              ordinary_float_array_member[10];            };
+struct ordinary_double_array_struct           { double             ordinary_double_array_member[10];           };
+struct ordinary_long_double_array_struct      { long double        ordinary_long_double_array_member[10];      };
+
+struct ordinary_signed_char_array_struct      { char               ordinary_signed_char_array_member[10];      };
+struct explicit_signed_char_array_struct      { signed char        explicit_signed_char_array_member[10];      };
+struct unsigned_char_array_struct             { unsigned char      unsigned_char_array_member[10];             };
+
+struct ordinary_signed_short_array_struct     { short              ordinary_signed_short_array_member[10];     };
+struct explicit_signed_short_array_struct     { signed short       explicit_signed_short_array_member[10];     };
+struct unsigned_short_array_struct            { unsigned short     unsigned_short_array_member[10];            };
+
+struct ordinary_signed_int_array_struct       { int                ordinary_signed_int_array_member[10];       };
+struct explicit_signed_int_array_struct       { signed int         explicit_signed_int_array_member[10];       };
+struct unsigned_int_array_struct              { unsigned int       unsigned_int_array_member[10];              };
+
+struct ordinary_signed_long_array_struct      { long               ordinary_signed_long_array_member[10];      };
+struct explicit_signed_long_array_struct      { signed long        explicit_signed_long_array_member[10];      };
+struct unsigned_long_array_struct             { unsigned long      unsigned_long_array_member[10];             };
+
+struct ordinary_signed_long_long_array_struct { long long          ordinary_signed_long_long_array_member[10]; };
+struct explicit_signed_long_long_array_struct { signed long long   explicit_signed_long_long_array_member[10]; };
+struct unsigned_long_long_array_struct        { unsigned long long unsigned_long_long_array_member[10];        };
+
+/**
+ * Structs: arrays of pointers
+ *
+ * NOTE: Here too `ordinary_signed_char_pointer_array_struct` was commented out
+ * in the original test suite, with no reason given.
+ */
+
+struct ordinary_void_pointer_array_struct             { void*               ordinary_void_pointer_array_member[10];             };
+
+struct ordinary_float_pointer_array_struct            { float*              ordinary_float_pointer_array_member[10];            };
+struct ordinary_double_pointer_array_struct           { double*             ordinary_double_pointer_array_member[10];           };
+struct ordinary_long_double_pointer_array_struct      { long double*        ordinary_long_double_pointer_array_member[10];      };
+
+struct ordinary_signed_char_pointer_array_struct      { char*               ordinary_signed_char_pointer_array_member[10];      };
+struct explicit_signed_char_pointer_array_struct      { signed char*        explicit_signed_char_pointer_array_member[10];      };
+struct unsigned_char_pointer_array_struct             { unsigned char*      unsigned_char_pointer_array_member[10];             };
+
+struct ordinary_signed_short_pointer_array_struct     { short*              ordinary_signed_short_pointer_array_member[10];     };
+struct explicit_signed_short_pointer_array_struct     { signed short*       explicit_signed_short_pointer_array_member[10];     };
+struct unsigned_short_pointer_array_struct            { unsigned short*     unsigned_short_pointer_array_member[10];            };
+
+struct ordinary_signed_int_pointer_array_struct       { int*                ordinary_signed_int_pointer_array_member[10];       };
+struct explicit_signed_int_pointer_array_struct       { signed int*         explicit_signed_int_pointer_array_member[10];       };
+struct unsigned_int_pointer_array_struct              { unsigned int*       unsigned_int_pointer_array_member[10];              };
+
+struct ordinary_signed_long_pointer_array_struct      { long*               ordinary_signed_long_pointer_array_member[10];      };
+struct explicit_signed_long_pointer_array_struct      { signed long*        explicit_signed_long_pointer_array_member[10];      };
+struct unsigned_long_pointer_array_struct             { unsigned long*      unsigned_long_pointer_array_member[10];             };
+
+struct ordinary_signed_long_long_pointer_array_struct { long long*          ordinary_signed_long_long_pointer_array_member[10]; };
+struct explicit_signed_long_long_pointer_array_struct { signed long long*   explicit_signed_long_long_pointer_array_member[10]; };
+struct unsigned_long_long_pointer_array_struct        { unsigned long long* unsigned_long_long_pointer_array_member[10];        };
+
+/**
+ * Sanity checks
+ *
+ * NOTE: The `smoke.h` test is moved to a separate header.
+ */
+
+// maps a typedef
+typedef int an_int;
+
+/**
+ * Issues without test cases in the original test suite
+ *
+ * These are examples from open issues on the c2hsc repository, that don't (yet)
+ * have corresponding test cases in the c2hsc test suite.
+ */
+
+// Arrays of untagged structs need a generated name (#21)
+struct cal_table {
+    int size;
+    struct {
+        int raw; int val;
+    } table[32];
+};
+
+// Untagged unions within structs seem to not work (#23)
+typedef struct {
+  unsigned char d_tag[4];   /* entry tag value */
+  union {
+    unsigned char d_val[4];
+    unsigned char d_ptr[4];
+  } d_un;
+} Elf32_External_Dyn;
+
+// pointer typedef generates incorrect type (#24)
+//
+// NOTE: Changed the type in the second example to avoid dependencies.
+typedef int * bug_24;
+typedef const int  *bug_24_2;
+
+// support top-level array typedefs (#27)
+//
+// NOTE: Renamed to avoid conflicts.
+typedef int MyArray_27[20];
+typedef struct {
+  MyArray_27 x;
+} MyStruct_27;
diff --git a/test-artefacts/headers/golden/comprehensive/smoke.h b/test-artefacts/headers/golden/comprehensive/smoke.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/comprehensive/smoke.h
@@ -0,0 +1,83 @@
+/** @file
+ * This is a test case in the c2hsc test suite
+ *
+ * https://github.com/jwiegley/c2hsc/blob/master/test/main.hs
+ */
+
+typedef unsigned int uint;
+typedef unsigned long size_t;
+
+void    foo1(void);
+void    foo2(int);
+void    foo3(int, int);
+int     foo4(void);
+char    foo5(int);
+char *  foo6(int, int);
+char *  foo7(char *);
+char *  foo8(char * b);
+char *  foo9(char * (*b)(void));
+char *  foo10(char * (*b)(int));
+void *  foo11(void * (*b)(void));
+void *  foo12(void * (*b)(int));
+char *  foo13(char []);
+char *  foo14(char b[]);
+char *  foo15(char b[5]);
+char *  foo16(int);
+int     foo17(char ***);
+int     foo18(unsigned);
+int     foo19(unsigned int);
+int     foo20(uint);
+int     foo21(int (*)(int));
+int     foo22(int *(*)(int));
+int     foo23(int **(*)(int));
+int     foo24(int ***(*)(int));
+int *   foo25(int);
+int **  foo26(int);
+int *** foo27(int);
+int *** foo28(size_t);
+
+struct bar1_t {
+  void *  a;
+  int     b;
+  char    c;
+  char *  d;
+  char *  (*e)(void);
+  void    (*f)(void *);
+  int *   (*g)(void *);
+  int **  (*h)(void *);
+  int *** (*i)(void *);
+  char    j[2];
+
+  struct bar1_t * k;
+};
+
+typedef struct bar2_t {
+  int a;
+} bar2_t;
+
+typedef struct {
+  int a;
+} bar3_t;
+
+enum {
+  BAZ1 = 1
+};
+
+typedef enum {
+  BAZ2 = 1
+} baz2_t;
+
+enum baz3_t {
+  BAZ3 = 1
+};
+
+typedef enum baz4_t {
+  BAZ4 = 1
+} baz4_t;
+
+extern int global;
+
+inline int inline_foo(int a, int * b, const int c, const int * d,
+                      const int ** e, const int * const * f, size_t g) {
+  return 10;
+}
diff --git a/test-artefacts/headers/golden/declarations/declaration_unselected_a.h b/test-artefacts/headers/golden/declarations/declaration_unselected_a.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/declaration_unselected_a.h
@@ -0,0 +1,1 @@
+struct unselected;
diff --git a/test-artefacts/headers/golden/declarations/declaration_unselected_b.h b/test-artefacts/headers/golden/declarations/declaration_unselected_b.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/declaration_unselected_b.h
@@ -0,0 +1,3 @@
+#include "declaration_unselected_a.h"
+
+void f(struct unselected *p);
diff --git a/test-artefacts/headers/golden/declarations/declarations_required_for_scoping.h b/test-artefacts/headers/golden/declarations/declarations_required_for_scoping.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/declarations_required_for_scoping.h
@@ -0,0 +1,7 @@
+#include <stddef.h>
+
+// We expect that parsing the macro succeeds because `size_t` is a
+// `typedef` which we always parse.
+#define A size_t
+
+void f(A x);
diff --git a/test-artefacts/headers/golden/declarations/definitions.h b/test-artefacts/headers/golden/declarations/definitions.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/definitions.h
@@ -0,0 +1,26 @@
+
+/*
+ * A definition is a declaration that provides all information about the identifiers it declares.
+ *
+ * Every declaration of an enum or a typedef is a definition.
+ *
+ * <https://en.cppreference.com/w/c/language/declarations.html#Definitions>
+ */
+
+// For functions, a declaration that includes the function body is a function definition:
+
+int foo(double); // declaration
+int foo(double x) { return x; } // definition
+
+// For objects, a declaration that allocates storage (automatic or static, but not extern) is a definition, while a declaration that does not allocate storage (external declaration) is not.
+
+extern int n; // declaration
+int n = 10; // definition
+
+// For structs and unions, declarations that specify the list of members are definitions:
+
+struct X; // declaration
+struct X { int n; }; // definition
+
+union Y; // declaration
+union Y { int m; int o; }; // definition
diff --git a/test-artefacts/headers/golden/declarations/duplicate_field_name_omit.h b/test-artefacts/headers/golden/declarations/duplicate_field_name_omit.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/duplicate_field_name_omit.h
@@ -0,0 +1,1 @@
+struct S { int Bar; int bar; };
diff --git a/test-artefacts/headers/golden/declarations/failing/tentative_definitions_linkage.h b/test-artefacts/headers/golden/declarations/failing/tentative_definitions_linkage.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/failing/tentative_definitions_linkage.h
@@ -0,0 +1,20 @@
+/*
+ * Tentative definitions
+ *
+ * <https://en.cppreference.com/w/c/language/extern.html#Tentative_definitions>
+ */
+
+/* Unlike the extern declarations, which don't change the linkage of an
+ * identifier if a previous declaration established it, tentative definitions
+ * may disagree in linkage with another declaration of the same identifier. If
+ * two declarations for the same identifier are in scope and have different
+ * linkage, the behavior is undefined:
+ */
+
+static int i4 = 2; // definition, internal linkage
+int i4;            // Undefined behavior: linkage disagreement with previous line
+extern int i4;     // declaration, refers to the internal linkage definition
+
+static int i5; // tentative definition, internal linkage
+int i5;        // Undefined behavior: linkage disagreement with previous line
+extern int i5; // refers to previous, whose linkage is internal
diff --git a/test-artefacts/headers/golden/declarations/field_name_reuse_omit.h b/test-artefacts/headers/golden/declarations/field_name_reuse_omit.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/field_name_reuse_omit.h
@@ -0,0 +1,28 @@
+/** @file
+ * Field-selector names reused by non-field declarations, under OmitFieldPrefixes.
+ *
+ * Under OmitFieldPrefixes the generated module enables both
+ * DuplicateRecordFields and NoFieldSelectors.  Because no top-level field
+ * selector is generated, an unprefixed field name can freely coincide with a
+ * non-field declaration of the same name; fields are reached through HasField
+ * (record-dot) instead.  None of the declarations below collide, and all are
+ * generated.
+ *
+ * (Two records merely sharing a field name -- DuplicateRecordFields -- is
+ * exercised elsewhere; here the point is field-vs-non-field.)
+ *
+ *   Case  Description                          Shared Haskell variable name
+ *   ---------------------------------------------------------------------------
+ *   a     Field selector and global variable   struct S.foo and global foo
+ *   b     Field selector and function          struct T.bar and function bar
+ */
+
+// (a) The field 'foo' of 'struct S' and the global variable 'foo' share the
+// Haskell variable name 'foo'; with NoFieldSelectors there is no clash.
+struct S { int foo; };
+extern int foo;
+
+// (b) The field 'bar' of 'struct T' and the function 'bar' share the Haskell
+// variable name 'bar'; again no clash.
+struct T { int bar; };
+void bar(void);
diff --git a/test-artefacts/headers/golden/declarations/forward_declaration.h b/test-artefacts/headers/golden/declarations/forward_declaration.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/forward_declaration.h
@@ -0,0 +1,11 @@
+typedef struct S1 S1_t;
+
+struct S1 {
+  int a;
+};
+
+struct S2;
+
+struct S2 {
+  int a;
+};
diff --git a/test-artefacts/headers/golden/declarations/name_collision.h b/test-artefacts/headers/golden/declarations/name_collision.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/name_collision.h
@@ -0,0 +1,23 @@
+/* Cross-declaration collision: the C identifiers `y` and `Y` lead to a single
+   colliding Haskell identifier `Y`. */
+union y;
+union Y {
+  int m;
+  int o;
+};
+
+/* Intra-declaration collision: the enum tag `Color` and its enumerator `Color`
+   both yield the Haskell name `Color` in the data-constructor namespace (the
+   newtype data constructor and the enumerator's pattern synonym). */
+enum Color { Color };
+
+/* Intra-declaration collision via case mangling: the enum tag `A` yields the
+   newtype data constructor `A`, while the lowercase enumerator `a` is mangled up
+   to the pattern synonym `A`, so both collide in the data-constructor namespace.
+   See https://github.com/well-typed/hs-bindgen/issues/2020. */
+enum A { a };
+
+/* Cross-declaration field/function collision: the struct field selector `s_x`
+   (from `struct S`) collides with the function `S_x` (also mangled to `s_x`). */
+struct S { int x; };
+void S_x(void);
diff --git a/test-artefacts/headers/golden/declarations/name_collision_aux.h b/test-artefacts/headers/golden/declarations/name_collision_aux.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/name_collision_aux.h
@@ -0,0 +1,10 @@
+/* Sweep-2 collision: struct foo generates the auxiliary type Foo_Aux (for its
+   flexible array member), which clashes with the top-level declaration foo_Aux
+   that also mangles to Foo_Aux. */
+struct foo { int len; char data[]; };
+typedef int foo_Aux;
+
+/* Sweep-2 collision: function-pointer typedef bar generates the auxiliary type
+   Bar_Aux, which clashes with the top-level declaration bar_Aux. */
+typedef void (*bar)(int x);
+typedef int bar_Aux;
diff --git a/test-artefacts/headers/golden/declarations/opaque_declaration.h b/test-artefacts/headers/golden/declarations/opaque_declaration.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/opaque_declaration.h
@@ -0,0 +1,13 @@
+struct foo; /* opaque, no members, no size */
+struct foo; /* second declration, still opaque */
+
+struct bar {
+    struct foo *ptrA;
+    struct bar *ptrB;
+};
+
+struct baz {}; /* not opaque */
+
+enum quu;
+
+union opaque_union;
diff --git a/test-artefacts/headers/golden/declarations/redeclaration.h b/test-artefacts/headers/golden/declarations/redeclaration.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/redeclaration.h
@@ -0,0 +1,33 @@
+/*
+ * A declaration cannot introduce an identifier if another declaration for the
+ * same identifier in the same scope appears earlier, except that:
+ *
+ *
+ */
+
+// - Declarations of objects with linkage (external or internal) can be repeated:
+
+extern int x;
+int x = 10; // OK
+extern int x; // OK
+
+static int n;
+static int n = 10; // OK
+static int n; // OK
+
+// - Non-VLA typedef can be repeated as long as it names the same type:
+
+typedef int int_t;
+typedef int int_t; // OK
+
+// - struct and union declarations can be repeated:
+
+struct X;
+struct X { int n; };
+struct X;
+
+union Y;
+union Y { int m; int o; };
+union Y;
+
+// These rules simplify the use of header files.
diff --git a/test-artefacts/headers/golden/declarations/redeclaration_main_header.h b/test-artefacts/headers/golden/declarations/redeclaration_main_header.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/redeclaration_main_header.h
@@ -0,0 +1,5 @@
+// f is declared in an included header and again in this main header. The
+// declaration in the main header is kept, so the default selection predicate
+// selects f.
+#include "redeclaration_main_header_inner.h"
+int f(int x);
diff --git a/test-artefacts/headers/golden/declarations/redeclaration_main_header_inner.h b/test-artefacts/headers/golden/declarations/redeclaration_main_header_inner.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/redeclaration_main_header_inner.h
@@ -0,0 +1,2 @@
+// Not a main header; see redeclaration_main_header.h.
+int f(int x);
diff --git a/test-artefacts/headers/golden/declarations/select_scoping.h b/test-artefacts/headers/golden/declarations/select_scoping.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/select_scoping.h
@@ -0,0 +1,14 @@
+// The header contains a type definition which we will parse, but should not
+// select!
+#include "select_scoping_header.h"
+
+// This declaration is parsed _and_ selected.
+typedef int ParsedAndSelected1;
+
+// This declaration is parsed _and_ selected. The dependency is parsed but not
+// selected.
+typedef ParsedAndNotSelected ParsedAndSelected2;
+
+// This declaration is parsed _and_ selected. However, a recursive transitive
+// dependency is unusable.
+typedef ParsedAndSelected2 ParsedAndSelected3;
diff --git a/test-artefacts/headers/golden/declarations/select_scoping_header.h b/test-artefacts/headers/golden/declarations/select_scoping_header.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/select_scoping_header.h
@@ -0,0 +1,3 @@
+// This type definition will be parsed (because it is required for scoping), but
+// should not be selected!
+typedef int ParsedAndNotSelected;
diff --git a/test-artefacts/headers/golden/declarations/tentative_definitions.h b/test-artefacts/headers/golden/declarations/tentative_definitions.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/declarations/tentative_definitions.h
@@ -0,0 +1,33 @@
+/*
+ * Tentative definitions
+ *
+ * <https://en.cppreference.com/w/c/language/extern.html#Tentative_definitions>
+ */
+
+/*
+ * A tentative definition is an external declaration without an initializer, and
+ * either without a storage-class specifier or with the specifier static.
+ *
+ * A tentative definition is a declaration that may or may not act as a
+ * definition. If an actual external definition is found earlier or later in the
+ * same translation unit, then the tentative definition just acts as a
+ * declaration.
+ */
+
+int i1 = 1;     // definition, external linkage
+int i1;         // tentative definition, acts as declaration because i1 is defined
+extern int i1;  // declaration, refers to the earlier definition
+
+extern int i2 = 3; // definition, external linkage
+int i2;            // tentative definition, acts as declaration because i2 is defined
+extern int i2;     // declaration, refers to the external linkage definition
+
+/*
+ * If there are no definitions in the same translation unit, then the tentative
+ * definition acts as an actual definition that empty-initializes the object.
+ */
+
+int i3;        // tentative definition, external linkage
+int i3;        // tentative definition, external linkage
+extern int i3; // declaration, external linkage
+ // in this translation unit, i3 is defined as if by "int i3 = 0;"
diff --git a/test-artefacts/headers/golden/documentation/data_kind_pragma.h b/test-artefacts/headers/golden/documentation/data_kind_pragma.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/documentation/data_kind_pragma.h
@@ -0,0 +1,3 @@
+// Test that we correctly detect type extension of newtype fields. In this case,
+// we need `DataKinds` for the type literal `3` of constant arrays.
+typedef int triplet[3];
diff --git a/test-artefacts/headers/golden/documentation/doxygen_docs.h b/test-artefacts/headers/golden/documentation/doxygen_docs.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/documentation/doxygen_docs.h
@@ -0,0 +1,664 @@
+/**
+ * @file doxygen_docs.h
+ * @brief Comprehensive test file for Doxygen documentation features
+ * @author Test Author
+ * @version 1.0
+ * @date 2025-01-15
+ * @copyright Copyright (c) 2025 Test Company
+ * @mainpage Doxygen Test Documentation
+ *
+ * This file demonstrates all possible locations where Doxygen documentation can appear.
+ *
+ * @section intro_sec Introduction
+ * This is a comprehensive test of Doxygen features.
+ *
+ * @section features_sec Features
+ * - Complete C syntax coverage
+ * - All Doxygen commands
+ * - Documentation in every possible location
+ */
+
+#ifndef DOXYGEN_DOCS_H
+#define DOXYGEN_DOCS_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+/**
+ * @defgroup core_types Core Data Types
+ * @brief Fundamental data types and structures
+ * @{
+ */
+
+/**
+ * @def MAX_NAME_LENGTH
+ * @brief Maximum length for name strings
+ *
+ */
+#define MAX_NAME_LENGTH 64
+
+/**
+ * @def MIN(a, b)
+ * @brief Returns the minimum of two values
+ * @param a First value
+ * @param b Second value
+ * @return The smaller value
+ */
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+/**
+ * @typedef size_type
+ * @brief Size type for this library
+ *
+ * This is the comment @b title
+ */
+typedef size_t size_type;
+
+/**
+ * @var extern int global_counter
+ * @brief Global counter variable
+ * @details This variable tracks the number of operations performed.
+ */
+extern int global_counter;
+
+/**
+ * @var extern const char* version_string
+ * @brief Version string constant
+ */
+extern const char* version_string;
+
+/**
+ * @brief Opaque struct
+ *
+ * This is the comment @c title
+ */
+struct opaque_struct;
+
+/**
+ * @brief Opaque union
+ */
+union opaque_union;
+
+/**
+ * @enum color_enum
+ * @brief Color enumeration without typedef
+ */
+enum color_enum {
+    COLOR_RED,   /**< Red color */
+    COLOR_GREEN, /**< Green color */
+    COLOR_BLUE   /**< Blue color */
+};
+
+/** @} */ /* end core_types */
+
+/**
+ * @defgroup functions Function Definitions
+ * @brief All function definitions
+ * @{
+ */
+
+/**
+ * @brief Function with detailed parameter documentation
+ *
+ * This function shows different parameter directions and types.
+ *
+ * @param[in] input_data Input data buffer
+ * @param[out] output_data Output data buffer
+ * @param[in,out] size Size of data, updated on return
+ * @return Status code (0 = success, -1 = error)
+ */
+int process_data(const uint8_t* input_data, uint8_t* output_data, size_t* size);
+
+/**
+ * @brief Function with inline commands and formatting
+ *
+ * This function uses @c inline @c code formatting and @b bold text.
+ * It also demonstrates @e emphasized text.
+ *
+ * @param filename The @c char* filename to process
+ * @return @c true if successful, @c false otherwise
+ */
+bool process_file(const char* filename);
+
+/**
+ * @brief Function with verbatim code blocks
+ *
+ * Example usage:
+ * @code
+ * int result = calculate_value(10, 20);
+ * printf("Result: %d\n", result);
+ * @endcode
+ *
+ * @param base Base value
+ * @param multiplier Multiplier value
+ * @return Calculated result
+ */
+int calculate_value(int base, int multiplier);
+
+/**
+ * @brief Function with HTML formatting
+ *
+ * This function demonstrates <b>HTML bold</b> and <i>italic</i> text.
+ * It also shows <code>HTML code</code> formatting.
+ *
+ * <table>
+ * <tr><th>Input</th><th>Output</th></tr>
+ * <tr><td>0</td><td>false</td></tr>
+ * <tr><td>1</td><td>true</td></tr>
+ * </table>
+ *
+ * @param value Input value
+ * @return Boolean result
+ */
+bool html_example(int value);
+
+/**
+ * @brief Function with lists and special formatting
+ *
+ * This function demonstrates:
+ * - Bullet point lists
+ *   * Nested list item 1
+ *   * Nested list item 2
+ * - Multiple items
+ * - Nested formatting
+ *
+ * Numbered list:
+ * 1. First @c item 1. item
+ * 2. Second @b item
+ * 3. Third item
+ *
+ * Other numbered list:
+ * -# A
+ * -# B
+ * -# C
+ *
+ * @param items Array of items
+ * @param count Number of items
+ * @return Success status
+ */
+bool list_example(const char** items, size_t count);
+
+/**
+ * @brief Function with warnings and notes
+ *
+ * @warning This function may cause side effects
+ * @note Use with caution in multithreaded environments
+ * @see related_function() for similar functionality
+ *
+ * @param ptr Pointer to data
+ * @return Modified pointer
+ */
+void* dangerous_function(void* ptr);
+
+/**
+ * @brief Function with return value details
+ *
+ * @param input Input string
+ * @retval 0 Success
+ * @retval -1 Invalid input
+ * @retval -2 Memory allocation failed
+ * @retval -3 Processing error
+ */
+int detailed_return_codes(const char* input);
+
+/**
+ * @brief Function with deprecated annotation
+ *
+ * @deprecated Use new_function() instead
+ * @param old_param Legacy parameter
+ * @return Legacy result
+ */
+int old_function(int old_param);
+
+/**
+ * @brief Function with version information
+ *
+ * @since 1.0
+ * @version 1.2
+ * @param data Input data
+ * @return Processed data
+ */
+int versioned_function(int data);
+
+/**
+ * @brief Callback function type
+ *
+ * @param event_type Type of event
+ * @param user_data User-provided data
+ * @return Handling result
+ */
+typedef int (*event_callback_t)(int event_type, void* user_data);
+
+/**
+ * @brief Structure with documented fields
+ *
+ * This structure demonstrates field documentation.
+ */
+typedef struct {
+    /** @brief Unique identifier */
+    uint32_t id;
+
+    /** @brief Human-readable name */
+    char name[64];
+
+    /** @brief Configuration flags */
+    uint32_t flags;
+
+    /** @brief Optional callback function
+     *
+     * See also: \ref event_callback_t
+     *
+     * */
+    event_callback_t callback;
+
+    /** @brief User data for callback */
+    void* user_data;
+} /** Configuration struct */ config_t;
+
+/**
+ * @brief Enumeration with documented values
+ *
+ * This enum shows different status codes.
+ */
+typedef enum {
+    /** @brief Operation successful */
+    STATUS_OK = 0,
+
+    /** @brief Invalid parameter provided */
+    STATUS_INVALID_PARAM = -1,
+
+    /** @brief Memory allocation failed */
+    STATUS_NO_MEMORY = -2,
+
+    /** @brief Operation timed out */
+    STATUS_TIMEOUT = -3,
+
+    /** @brief Generic error */
+    STATUS_ERROR = -99
+} /** Status Code */ status_code_t;
+
+/**
+ * @union data_union_t
+ * @brief Union with documented fields
+ *
+ * This union demonstrates different data representations.
+ */
+typedef union {
+    int32_t as_int;    /**< @brief Integer representation */
+    float as_float;    /**< @brief Float representation */
+    uint8_t as_bytes[4]; /**< @brief Byte array representation */
+
+    /**
+     * @brief Structured representation
+     * @details Allows access to high and low parts separately
+     */
+    struct {
+        uint16_t low;  /**< @brief Low 16 bits */
+        uint16_t high; /**< @brief High 16 bits */
+    } /** As Parts Struct */ as_parts;
+} /** Union Struct */ data_union_t;
+
+/**
+ * @struct bitfield_t
+ * @brief Bit field structure
+ *
+ * Demonstrates bit field documentation.
+ */
+typedef struct {
+    unsigned flag1 : 1;     /**< @brief First flag (1 bit) */
+    unsigned flag2 : 1;     /**< @brief Second flag (1 bit) */
+    unsigned counter : 6;   /**< @brief Counter value (6 bits) */
+    unsigned reserved : 24; /**< @brief Reserved bits (24 bits) */
+} bitfield_t;
+
+/**
+ * @typedef processor_fn_t
+ * @brief Function pointer typedef
+ *
+ * @param input Input value
+ * @param context Context pointer
+ * @return Processed value
+ */
+typedef int (*processor_fn_t)(int input, void* context);
+
+/**
+ * @typedef filename_t
+ * @brief Array typedef with size
+ */
+typedef char filename_t[256];
+
+/**
+ * @brief Static array parameter
+ *
+ * @param buffer Buffer with minimum size
+ * @param size Actual buffer size
+ * @return Number of bytes written
+ */
+int process_buffer(char buffer[static 64], size_t size);
+
+/**
+ * @brief Function with restrict pointers
+ *
+ * @param dest Destination buffer (restrict)
+ * @param src Source buffer (restrict)
+ * @param n Number of bytes
+ * @return Destination pointer
+ */
+void* my_memcpy(void* restrict dest, const void* restrict src, size_t n);
+
+/**
+ * @brief Inline function
+ *
+ * @param x Input value
+ * @return Doubled value
+ */
+static inline int double_value(int x) {
+    return x * 2;
+}
+
+/**
+ * @brief Structure with flexible array member
+ *
+ * Used for variable-length data buffers.
+ */
+struct flexible_array {
+    size_t count;      /**< @brief Number of elements */
+    int data[];        /**< @brief Flexible array member */
+};
+
+/**
+ * @defgroup io_helpers I/O Helpers
+ * @ingroup functions
+ * @brief Functions dealing with I/O buffers
+ * @{
+ */
+
+/**
+ * @brief Read a chunk of bytes into the provided buffer
+ *
+ * Demonstrates a section nested inside @c functions.
+ *
+ * @param fd File descriptor
+ * @param buf Output buffer
+ * @param count Number of bytes to read
+ * @return Number of bytes read
+ */
+int read_chunk(int fd, void* buf, size_t count);
+
+/**
+ * @brief Write a chunk of bytes from the provided buffer
+ *
+ * @param fd File descriptor
+ * @param buf Input buffer
+ * @param count Number of bytes to write
+ * @return Number of bytes written
+ */
+int write_chunk(int fd, const void* buf, size_t count);
+
+/** @} */ /* end io_helpers */
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup advanced_features Advanced Features
+ * @brief Advanced C and Doxygen features
+ * @{
+ */
+
+/**
+ * @brief Function with complex documentation
+ *
+ * This function demonstrates multiple documentation features:
+ *
+ * @par Description:
+ * Performs complex data processing with multiple steps.
+ *
+ * @par Algorithm:
+ * 10. Validate input parameters
+ * 200. Allocate temporary buffers
+ * 3000. Process data in chunks
+ * 41235. Clean up resources
+ *
+ * @par Algorithm2:
+ * @li Validate input parameters
+ * @li Allocate temporary buffers
+ * @li Process data in chunks
+ * @li Clean up resources
+ *
+ * @par Example:
+ * @code
+ * config_t cfg = {
+ *     .id = 1,
+ *     .name = "test",
+ *     .flags = 0,
+ *     .callback = my_callback,
+ *     .user_data = NULL
+ * };
+ *
+ * status_code_t result = complex_function(&cfg, data, size);
+ * if (result != STATUS_OK) {
+ *     handle_error(result);
+ * }
+ * @endcode
+ *
+ * @param config Configuration structure (see \ref config_t)
+ * @param data Input data buffer
+ * @param size Size of input data
+ * @return Status code indicating success or failure
+ *
+ * @pre config must not be NULL
+ * @pre data must not be NULL if size > 0
+ * @post Output data is written to config->user_data
+ *
+ * @warning May return NULL if memory allocation fails
+ * @warning Sets errno to EINVAL if parameters are invalid
+ */
+status_code_t complex_function(config_t* config, const uint8_t* data, size_t size);
+
+// Function attributes: const and pure
+
+int hash (char * s) __attribute__ ((pure));
+
+int square (int x) __attribute__ ((const));
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup extra_coverage Extra Doxygen Coverage
+ * @brief Additional Doxygen features for test coverage
+ * @{
+ */
+
+/**
+ * Auto-brief function without explicit @@brief tag.
+ *
+ * This tests that the first sentence is used as the brief description
+ * when no explicit @@brief is present.
+ *
+ * @param x The input value
+ * @return The negated value
+ */
+int auto_brief_func(int x);
+
+/**
+ * @brief Multi-paragraph details
+ *
+ * First paragraph of the detailed description. This explains the basic
+ * purpose of the function.
+ *
+ * Second paragraph with more context. This includes information about
+ * the algorithm and its complexity, which is O(n) in the input size.
+ *
+ * Third paragraph with usage notes. Callers should ensure that the
+ * buffer is large enough before calling this function.
+ *
+ * @param buf Output buffer
+ * @param len Buffer length
+ */
+void multi_paragraph_details(char* buf, size_t len);
+
+/**
+ * @brief Function with @@todo and @@remark
+ *
+ * @todo Optimize this function for large inputs
+ * @todo Add support for negative values
+ * @remark This function is thread-safe
+ * @attention The caller must free the returned pointer
+ *
+ * @param n Input count
+ * @return Allocated array
+ */
+int* todo_remark_attention(int n);
+
+/**
+ * @brief Struct with invariant
+ *
+ * @invariant capacity >= size at all times
+ */
+typedef struct {
+    int* data;           /**< @brief Pointer to data */
+    size_t size;         /**< @brief Current number of elements */
+    size_t capacity;     /**< @brief Allocated capacity */
+} dyn_array_t;
+
+/**
+ * @brief HTML entities: &amp; means AND, &lt;tag&gt; is a tag
+ *
+ * Handles values &lt; 0 and values &gt; 100 differently.
+ * Copyright &copy; 2025.
+ *
+ * @param x Input (&gt; 0 required)
+ * @return Result code
+ */
+int html_entities_func(int x);
+
+/**
+ * @brief Nested inline: @b bold, @c code, @b @c bold_code, @e @b emph_bold
+ *
+ * @param x Input value
+ */
+void nested_inline_format(int x);
+
+/**
+ * @brief Language-tagged code block
+ *
+ * Example usage:
+ * @code{.c}
+ * int result = tagged_code_example(42);
+ * printf("Result: %d\n", result);
+ * @endcode
+ *
+ * @param x Input value
+ * @return Processed value
+ */
+int tagged_code_example(int x);
+
+/**
+ * \brief Function documented with backslash syntax
+ *
+ * \details This function uses backslash commands instead of @@ commands
+ * to verify both syntaxes are handled equivalently.
+ *
+ * \param input The input string
+ * \param output The output buffer
+ * \return Number of bytes written
+ *
+ * \see auto_brief_func
+ * \since 2.0
+ */
+int backslash_syntax(const char* input, char* output);
+
+/**
+ * @brief Struct with multiple untagged inner structs
+ *
+ * Tests that doxygen comment enrichment correctly associates field comments
+ * with untagged inner structs at multiple nesting levels.
+ */
+typedef struct {
+    /**
+     * @brief Position in 2D space
+     */
+    struct {
+        float x;  /**< @brief X coordinate */
+        float y;  /**< @brief Y coordinate */
+    } /** Position fields */ pos;
+
+    /**
+     * @brief Dimensions
+     */
+    struct {
+        float w;  /**< @brief Width */
+        float h;  /**< @brief Height */
+    } /** Dimension fields */ dim;
+} multi_untagged_t;
+
+/**
+ * @brief Struct with a named inner struct
+ *
+ * Tests that doxygen comment enrichment uses the qualified name
+ * "named_outer::named_inner" for lookups.
+ */
+struct named_outer {
+    /** Named inner struct */
+    struct named_inner {
+        /** Inner field nx */
+        int nx;
+        /** Inner field ny */
+        int ny;
+    } inner_field;
+    /** Outer field nz */
+    int nz;
+};
+
+/**
+ * @brief Deeply nested mix of tagged and untagged structs
+ *
+ * Tests the full genealogy walk through mixed tagged/untagged nesting.
+ */
+struct deep_outer {
+    /** The named mid-level struct */
+    struct deep_mid {
+        /** Mid-level field */
+        int m;
+        /** Untagged struct inside named mid */
+        struct {
+            /** Deep field */
+            int deep_a;
+        } untagged_field;
+    } mid_field;
+    /** Outer-only field */
+    int o;
+};
+
+/**
+ * @brief Struct with anonymous struct
+ *
+ * Tests the case where the inner struct is anonymous: no struct tag and no field name.
+ * The inner fields are flattened directly into the parent.
+ */
+typedef struct {
+    /** Before field */
+    int before;
+    struct {
+        /** Unnamed inner a */
+        int ua;
+        /** Unnamed inner b */
+        int ub;
+    };
+    /** After field */
+    int after;
+} unnamed_field_t;
+
+/** @} */ /* end extra_coverage */
+
+/**
+ * @brief API version number (not in any group).
+ */
+typedef int api_version_t;
+
+#endif /* DOXYGEN_DOCS_H */
diff --git a/test-artefacts/headers/golden/documentation/javadoc_banner.h b/test-artefacts/headers/golden/documentation/javadoc_banner.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/documentation/javadoc_banner.h
@@ -0,0 +1,29 @@
+/** @file
+ * Test case for Javadoc banner-style comments (issue #1846)
+ */
+
+/******************************************************************************
+ * A function documented with a Javadoc banner-style comment.
+ *
+ * The decorative asterisks should be stripped by doxygen, producing clean
+ * documentation without any '*' noise.
+ *
+ * @param x The input value
+ * @return The doubled value
+ *****************************************************************************/
+int banner_double(int x);
+
+/******************************************************************************
+ * A struct documented with a Javadoc banner comment.
+ *****************************************************************************/
+struct banner_point {
+    /****
+     * X coordinate
+     ****/
+    int x;
+
+    /****
+     * Y coordinate
+     ****/
+    int y;
+};
diff --git a/test-artefacts/headers/golden/edge-cases/adios.h b/test-artefacts/headers/golden/edge-cases/adios.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/adios.h
@@ -0,0 +1,36 @@
+//
+// Adios and other awkward names
+//
+
+// Name with a character that fails the Haskell `isAlphaNum` test
+// NOTE: This is not in NFC (it contains a combining diacritical mark).
+typedef int adiós;
+
+// We explicitly also test for non-NFC characters in function names, and that we
+// can compile the generated Haskell code. See
+// https://github.com/well-typed/hs-bindgen/issues/569.
+int adiós_fun();
+
+// Type name which starts with a character which
+// * is not uppercase
+// * cannot be made uppercase
+typedef int 数字;
+
+// Function name which starts with a character which
+// * is uppercase
+// * cannot be made lowercase
+// These delightful characters are very rare!
+void ϒ(void);
+
+// Like the function ϒ, but now a global variable.
+extern int ϒϒ;
+
+// Like the function ϒ, but now a global constant.
+extern const int ϒϒϒ;
+
+// Variable name which is valid in both C and Haskell as-is
+void 拜拜(void);
+
+// Function name which is contains only "Haskell-valid" characters but starts
+// with an uppercase letter
+void Say拜拜(void);
diff --git a/test-artefacts/headers/golden/edge-cases/aux_funptr_newtypes.h b/test-artefacts/headers/golden/edge-cases/aux_funptr_newtypes.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/aux_funptr_newtypes.h
@@ -0,0 +1,11 @@
+// See issue #1694. Auxiliary newtypes for function pointer typedefs used to be
+// processed before their dependencies. Fixed in PR #1724.
+
+struct foo;
+
+typedef void (*FunPtr)(struct foo x);
+
+struct foo {
+  int x;
+  int y;
+};
diff --git a/test-artefacts/headers/golden/edge-cases/clang_generated_collision.h b/test-artefacts/headers/golden/edge-cases/clang_generated_collision.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/clang_generated_collision.h
@@ -0,0 +1,7 @@
+// `clang-16` and up assign the name `foo` to the untagged struct (older
+// versions return an empty string), resulting in name clashes unless we squash
+// that second struct, leaving only `struct foo` (the first struct) and `foo`
+// (the typedef). For consistency we replicate this behaviour for older `clang`.
+// See also https://github.com/well-typed/hs-bindgen/issues/1307.
+struct foo { char a; char b; };
+typedef struct { double x; double y; } foo;
diff --git a/test-artefacts/headers/golden/edge-cases/distilled_lib_1.h b/test-artefacts/headers/golden/edge-cases/distilled_lib_1.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/distilled_lib_1.h
@@ -0,0 +1,91 @@
+/** @file
+ * Distillation of some test cases from a proprietary C library
+ */
+
+/* amendmends */
+#include <stdbool.h>
+#include <stdint.h>
+
+typedef struct { int foo; char bar; } another_typedef_struct_t;
+typedef enum { FOO, BAR } another_typedef_enum_e;
+#define A 5
+#define B 3
+#define SOME_DEFINED_CONSTANT 4
+typedef int a_type_t;
+typedef int var_t;
+
+#ifdef __GNUC__
+#define PACK_START     _Pragma("pack(1)")
+#define PACK_FINISH    _Pragma("pack()")
+#else
+#define PACK_START
+#define PACK_FINISH
+#endif
+
+#ifdef __GNUC__
+#define PACK_ENUM __attribute__((packed))
+#else
+#define PACK_ENUM
+#endif
+
+// Structs
+
+/* Some comment*/
+PACK_START
+typedef struct a_typedef_struct
+{
+    bool                      field_0;    /* field 0 comment */
+    uint8_t                   field_1;    /* field 1 comment */
+    uint16_t                  field_2;    /* field 2 comment */
+    uint32_t                  field_3;    /* field 3 comment */
+    another_typedef_struct_t  field_4;    /* struct field */
+    another_typedef_struct_t *field_5;    /* struct pointer */
+    void                     *field_6;    /* void pointer */
+    uint32_t                  field_7[7]; /* an array field */
+    another_typedef_enum_e    field_8;    /* an enum field */
+    another_typedef_enum_e    field_9[SOME_DEFINED_CONSTANT]; /* an enum array field */
+    another_typedef_enum_e    field_10[A][B]; /* multi-dim array field */
+} a_typedef_struct_t;
+PACK_FINISH
+
+// Defines
+
+#define A_DEFINE_0 0x00 /* a comment */
+#define A_DEFINE_1 (0x5050U)
+#define A_DEFINE_2 2
+#define TWO_ARGS   0x3456, 0x789A
+
+// Enums
+
+/* A comment */
+typedef enum
+{
+  ENUM_CASE_0 = 0,
+  ENUM_CASE_1 = 1u,
+  ENUM_CASE_2 = 2U,
+  ENUM_CASE_3 = 0x3,
+} PACK_ENUM a_typedef_enum_e;
+
+// Functions
+
+/* some comment */
+int32_t some_fun(a_type_t *i, uint32_t j, uint8_t k[]);
+
+// Callbacks
+
+/* a comment */
+typedef uint32_t(*callback_t)(void *p, uint32_t k);
+
+// Global variables
+//
+// Perhaps this variable is declared in a .c file somewhere as:
+//
+// ```
+// var_t v =
+//   { .field1 = {.nested_field = 0},
+//     .field2 = false,
+//     .field3 = {0, 0, 0, 0},
+//   };
+// ```
+
+extern var_t v;
diff --git a/test-artefacts/headers/golden/edge-cases/duplicate.h b/test-artefacts/headers/golden/edge-cases/duplicate.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/duplicate.h
@@ -0,0 +1,3 @@
+#include "duplicate_macro.h"
+
+void function(duplicate x);
diff --git a/test-artefacts/headers/golden/edge-cases/duplicate_macro.h b/test-artefacts/headers/golden/edge-cases/duplicate_macro.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/duplicate_macro.h
@@ -0,0 +1,2 @@
+typedef int duplicate;
+#define duplicate duplicate
diff --git a/test-artefacts/headers/golden/edge-cases/duplicate_record_field.h b/test-artefacts/headers/golden/edge-cases/duplicate_record_field.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/duplicate_record_field.h
@@ -0,0 +1,7 @@
+struct A {
+  int dup;
+};
+
+struct B {
+  int dup;
+};
diff --git a/test-artefacts/headers/golden/edge-cases/enum_as_array_size.h b/test-artefacts/headers/golden/edge-cases/enum_as_array_size.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/enum_as_array_size.h
@@ -0,0 +1,8 @@
+// https://github.com/well-typed/hs-bindgen/issues/1415
+
+enum test {
+  test_a = 0,
+  test_count
+};
+
+extern const char test_array[test_count];
diff --git a/test-artefacts/headers/golden/edge-cases/flam.h b/test-artefacts/headers/golden/edge-cases/flam.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/flam.h
@@ -0,0 +1,29 @@
+// flexible array members
+struct pascal {
+    int len;
+    char data[];
+};
+
+// untagged struct as flam
+struct foo {
+	int len;
+	struct {
+		int x;
+		int y;
+	} bar[];
+};
+
+// offset and sizeof not the same
+struct diff {
+	long first;
+	char second;
+	char flam[];
+};
+
+//! The flexible array member is a multi-dimensional array of unknown size. In
+//! particular, it is a is an array of unknown size, where each element is of
+//! type length-3-array-of-int.
+struct triplets {
+  int len;
+  int flam[][3];
+};
diff --git a/test-artefacts/headers/golden/edge-cases/flam_functions.h b/test-artefacts/headers/golden/edge-cases/flam_functions.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/flam_functions.h
@@ -0,0 +1,10 @@
+struct Vector {
+  int length;
+  long numbers[];
+};
+
+struct Vector *vector_alloc(int n);
+
+void vector_free(struct Vector *v);
+
+void vector_reverse(struct Vector *v);
diff --git a/test-artefacts/headers/golden/edge-cases/headers.h b/test-artefacts/headers/golden/edge-cases/headers.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/headers.h
@@ -0,0 +1,1 @@
+#include <stddef.h>
diff --git a/test-artefacts/headers/golden/edge-cases/include_macro_child.h b/test-artefacts/headers/golden/edge-cases/include_macro_child.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/include_macro_child.h
@@ -0,0 +1,1 @@
+typedef struct { double x, y; } pt;
diff --git a/test-artefacts/headers/golden/edge-cases/include_macro_parent.h b/test-artefacts/headers/golden/edge-cases/include_macro_parent.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/include_macro_parent.h
@@ -0,0 +1,7 @@
+// Include directives may have macro arguments.  See all of section 6.10
+// (Proprocessing directives) in the C99 specification for details.
+
+#define CHILD_HEADER "include_macro_child.h"
+#include CHILD_HEADER
+
+struct rect { pt tl, br; };
diff --git a/test-artefacts/headers/golden/edge-cases/iterator.h b/test-artefacts/headers/golden/edge-cases/iterator.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/iterator.h
@@ -0,0 +1,20 @@
+// Toggle between true and false
+
+typedef bool (^Toggle)();
+Toggle makeToggle(bool start);
+bool toggleNext(Toggle block);
+void releaseToggle(Toggle block);
+
+// Simple counter, fixed increment
+
+typedef int(^Counter)();
+Counter makeCounter(int start, int increment);
+int counterNext(Counter block);
+void releaseCounter(Counter block);
+
+// Counter with variable increment
+
+typedef int(^VarCounter)(int increment);
+VarCounter makeVarCounter(int start);
+int varCounterNext(VarCounter block, int increment);
+void releaseVarCounter(VarCounter block);
diff --git a/test-artefacts/headers/golden/edge-cases/mangle_fun_param_names.h b/test-artefacts/headers/golden/edge-cases/mangle_fun_param_names.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/mangle_fun_param_names.h
@@ -0,0 +1,12 @@
+/* We must mangle function parameter names */
+
+struct S {
+  int x;
+};
+
+typedef struct S T;
+
+void param_underscore(T _);
+void param_uppercase(T Type);
+void param_undersore_capital(T _T);
+void param_haskell_reserved_name(T type);
diff --git a/test-artefacts/headers/golden/edge-cases/names.h b/test-artefacts/headers/golden/edge-cases/names.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/names.h
@@ -0,0 +1,29 @@
+// Names we expect to be escaped (`ghcExtensionKeywords`)
+// NOTE: `static` is (also) a C keyword and so cannot appear here.
+void by(void);
+void forall(void);
+void mdo(void);
+void pattern(void);
+void proc(void);
+void rec(void);
+void using(void);
+
+// Names we expect _not_ to be escaped (`ghcNonReservedKeywords`)
+void anyclass(void);
+void capi(void);
+void cases(void);
+void ccall(void);
+void dynamic(void);
+void export(void);
+void family(void);
+void group(void);
+void interruptible(void);
+void javascript(void);
+void label(void);
+void prim(void);
+void role(void);
+void safe(void);
+void stdcall(void);
+void stock(void);
+void unsafe(void);
+void via(void);
diff --git a/test-artefacts/headers/golden/edge-cases/ordinary_unnamed_decl_child.h b/test-artefacts/headers/golden/edge-cases/ordinary_unnamed_decl_child.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/ordinary_unnamed_decl_child.h
@@ -0,0 +1,4 @@
+// Empty lines in this file are significant!
+// https://github.com/well-typed/hs-bindgen/issues/1220
+
+__MATHCALL_VEC;
diff --git a/test-artefacts/headers/golden/edge-cases/ordinary_unnamed_decl_parent.h b/test-artefacts/headers/golden/edge-cases/ordinary_unnamed_decl_parent.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/ordinary_unnamed_decl_parent.h
@@ -0,0 +1,3 @@
+#define __MATHCALL_VEC extern double _ ## acos (double x)
+
+#include "ordinary_unnamed_decl_child.h"
diff --git a/test-artefacts/headers/golden/edge-cases/prelude_names.h b/test-artefacts/headers/golden/edge-cases/prelude_names.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/prelude_names.h
@@ -0,0 +1,31 @@
+// Names we expect to be escaped: generated modules import them unqualified
+// from the Prelude (`hsBindgenReservedNames`)
+struct string { int x; };
+typedef int Show;
+int fmap(int x);
+
+// Names we expect to be escaped: they name types and constructors of
+// Foreign.C.Types (`sanityReservedNames`)
+struct CChar { int x; };
+enum c_types { CInt };
+
+// Names we expect _not_ to be escaped: generated modules import them from the
+// Prelude only in another namespace, or not at all
+enum constants { Eq, Int, True };
+enum ordering { LT, EQ, GT };
+typedef int Maybe;
+struct Word { int x; };
+int reverse(int x);
+extern int length;
+
+#define maximum 3
+#define twice_maximum (2 * maximum)
+
+// Names we expect _not_ to be escaped: generated modules import them qualified,
+// and bind them only as methods of `Read` and `Show` instances
+#define readList 1
+#define showsPrec (2 * readList)
+
+// Names we expect _not_ to be escaped: generated modules import them qualified
+struct Void { int x; };
+void *identity(void *ptr);
diff --git a/test-artefacts/headers/golden/edge-cases/select_no_match.h b/test-artefacts/headers/golden/edge-cases/select_no_match.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/select_no_match.h
@@ -0,0 +1,10 @@
+// Test case for SelectNoDeclarationsMatched warning
+//
+// This file contains declarations that won't match the predicate
+
+void some_function(void);
+
+struct SomeStruct {
+    int x;
+    int y;
+};
diff --git a/test-artefacts/headers/golden/edge-cases/spec_examples.h b/test-artefacts/headers/golden/edge-cases/spec_examples.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/spec_examples.h
@@ -0,0 +1,37 @@
+/** @file
+ * Examples from the initial specification
+ */
+
+// Preliminaries to make the examples typecheck
+//
+// Some of these definitions are taken from
+// https://github.com/analogdevicesinc/MathWorks_tools/blob/master/targeting_models/ADSB/linux_app/rtwtypes.h
+
+typedef short int16_T;
+typedef int int32_T;
+typedef long long int64_T;
+
+typedef struct {
+  int16_T re;
+  int16_T im;
+} cint16_T;
+
+struct B {};
+
+// Examples themselves
+
+struct A {
+  double x;
+  char* label;
+  char samples[128];
+  struct B b;
+  struct C* c;
+};
+
+void resample(
+  int32_T *res_m_num_valid_samples,
+  cint16_T res_m_iq_int[30720000],
+  int64_T res_m_old_rate,
+  int64_T res_m_new_rate,
+  cint16_T res_m_iq_resampled_int[30720000]
+);
diff --git a/test-artefacts/headers/golden/edge-cases/thread_local.h b/test-artefacts/headers/golden/edge-cases/thread_local.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/thread_local.h
@@ -0,0 +1,10 @@
+/**
+ * Thread local global variables
+ *
+ * By default we generate a pointer for global variables, but that may not be
+ * safe for thread-local variables. We therefore do not generate any bindings
+ * for these currently (https://github.com/well-typed/hs-bindgen/issues/828).
+ *
+ * NOTE: This is a C23 feature, and requires llvm >= 16.
+ */
+thread_local extern int threadLocal;
diff --git a/test-artefacts/headers/golden/edge-cases/typedef_bitfield.h b/test-artefacts/headers/golden/edge-cases/typedef_bitfield.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/typedef_bitfield.h
@@ -0,0 +1,10 @@
+// Test for issue #1289: typedef bitfield should get Bitfield instance
+typedef int myInt;
+typedef unsigned int myUInt;
+typedef long myLong;
+
+struct myStruct {
+  myInt x : 2;
+  myUInt y : 4;
+  myLong z : 3;
+};
diff --git a/test-artefacts/headers/golden/edge-cases/typedef_void.h b/test-artefacts/headers/golden/edge-cases/typedef_void.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/typedef_void.h
@@ -0,0 +1,4 @@
+// strange, but not impossible
+// https://softwareengineering.stackexchange.com/questions/323992/is-there-any-technical-reason-to-typedef-void
+// https://github.com/well-typed/hs-bindgen/issues/1419
+typedef void foo;
diff --git a/test-artefacts/headers/golden/edge-cases/unnamed_type_multiple_fields.h b/test-artefacts/headers/golden/edge-cases/unnamed_type_multiple_fields.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/unnamed_type_multiple_fields.h
@@ -0,0 +1,6 @@
+// Multiple uses of unnnamed decl by declaring multiple struct fields
+// https://github.com/well-typed/hs-bindgen/issues/1418
+
+struct some_struct {
+  struct { int x; int y; } field1, field2, field3;
+};
diff --git a/test-artefacts/headers/golden/edge-cases/unnamed_type_multiple_typedefs.h b/test-artefacts/headers/golden/edge-cases/unnamed_type_multiple_typedefs.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/unnamed_type_multiple_typedefs.h
@@ -0,0 +1,16 @@
+// Multiple uses of unnamed decl by declaring multiple typedefs
+// https://github.com/well-typed/hs-bindgen/issues/1430
+
+// Case 1: Both direct typedefs
+typedef struct { int x; int y; } point1a, point1b;
+
+// Case 2: One direct, one pointer
+typedef struct { int x; int y; } point2a, *point2b;
+
+// Case 3: Both pointers
+typedef struct { int x; int y; } *point3a, *point3b;
+
+// Verify that point2a and point2b are compatible types
+void test(point2a x, point2b y) {
+    *y = x;
+}
diff --git a/test-artefacts/headers/golden/edge-cases/unsupported_builtin.h b/test-artefacts/headers/golden/edge-cases/unsupported_builtin.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/unsupported_builtin.h
@@ -0,0 +1,1 @@
+typedef __builtin_va_list va_list;
diff --git a/test-artefacts/headers/golden/edge-cases/uses_utf8.h b/test-artefacts/headers/golden/edge-cases/uses_utf8.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/edge-cases/uses_utf8.h
@@ -0,0 +1,9 @@
+#ifndef USES_UTF8_H
+#define USES_UTF8_H
+
+enum MyEnum {
+        Say你好,
+        Say拜拜
+};
+
+#endif 
diff --git a/test-artefacts/headers/golden/functions/callbacks.h b/test-artefacts/headers/golden/functions/callbacks.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/callbacks.h
@@ -0,0 +1,125 @@
+// ----------------------------------------------------------------------------
+// Basic Callbacks - Direct function pointers (no typedef)
+// ----------------------------------------------------------------------------
+int readFileWithProcessor(void (*processLine)(int lineNumber), int fileId);
+void watchTemperature(void (*onTempChange)(int degrees), int sensorId);
+
+// ----------------------------------------------------------------------------
+// Simple Callback Types - Using typedef for clarity
+// ----------------------------------------------------------------------------
+typedef void (*FileOpenedNotification)(void);
+typedef void (*ProgressUpdate)(int percentComplete);
+typedef int (*DataValidator)(int value);
+
+void onFileOpened(FileOpenedNotification notify);
+void onProgressChanged(ProgressUpdate update);
+int validateInput(DataValidator validator, int rawValue);
+
+// ----------------------------------------------------------------------------
+// Callbacks with Structs - Processing structured data
+// ----------------------------------------------------------------------------
+struct Measurement {
+  double value;
+  double timestamp;
+};
+
+typedef void (*MeasurementReceived)(struct Measurement *data);
+void onNewMeasurement(MeasurementReceived handler);
+
+typedef void (*MeasurementReceived2)(struct Measurement data);
+void onNewMeasurement2(MeasurementReceived2 handler);
+
+typedef void (*SampleBufferFull)(int samples[10]);
+void onBufferReady(SampleBufferFull handler);
+
+// ----------------------------------------------------------------------------
+// Higher-Order Callbacks - Functions taking function pointers as arguments
+// ----------------------------------------------------------------------------
+void transformMeasurement(
+    struct Measurement *data,
+    void (*transformer)(struct Measurement *m, double (*scale)(double, int), int factor)
+);
+
+void processWithCallbacks(
+    void (*handler)(struct Measurement *m, FileOpenedNotification notify, int priority)
+);
+
+// ----------------------------------------------------------------------------
+// Structs with Function Pointers - Handler registration pattern
+// ----------------------------------------------------------------------------
+struct MeasurementHandler {
+  void (*onReceived)(struct Measurement *data);
+  int (*validate)(struct Measurement *data);
+  void (*onError)(int errorCode);
+};
+
+void registerHandler(struct MeasurementHandler *handler);
+
+struct DataPipeline {
+  void (*preProcess)(struct Measurement *m, DataValidator validator);
+  void (*process)(struct Measurement *m);
+  void (*postProcess)(struct Measurement *m, ProgressUpdate update);
+};
+
+void executePipeline(struct Measurement *data, struct DataPipeline *pipeline);
+
+// ----------------------------------------------------------------------------
+// Union with Function Pointers - Mode-based callback selection
+// ----------------------------------------------------------------------------
+union ProcessorCallback {
+  void (*simple)(struct Measurement *data);
+  void (*withValidator)(struct Measurement *data, DataValidator validator);
+  void (*withProgress)(struct Measurement *data, ProgressUpdate progress);
+};
+
+struct Processor {
+  enum { MODE_SIMPLE, MODE_VALIDATED, MODE_PROGRESS } mode;
+  union ProcessorCallback callback;
+};
+
+void runProcessor(struct Measurement *data, struct Processor *processor);
+
+// ----------------------------------------------------------------------------
+// Third-Order Function - Deeply nested callback chain
+// ----------------------------------------------------------------------------
+void processMeasurementWithValidation(
+    struct Measurement *data,
+    void (*processor)(
+        struct Measurement *m,
+        void (*transformer)(struct Measurement *m, DataValidator validator, int threshold),
+        DataValidator validator
+    )
+);
+
+typedef int foo;
+typedef int foo2;
+void f(void (*callback)(foo x));
+void f2(void (*handler)(const foo2 x));
+
+// ----------------------------------------------------------------------------
+// Callbacks in a global variable
+// ----------------------------------------------------------------------------
+typedef int A;
+extern void (*globalVar[3])(A);
+
+// ----------------------------------------------------------------------------
+// Callbacks in a struct field
+// ----------------------------------------------------------------------------
+typedef int B;
+struct S {
+  void (* const fn)(B);
+};
+
+// ----------------------------------------------------------------------------
+// Callbacks in a union field
+// ----------------------------------------------------------------------------
+typedef int C;
+union U {
+  void (*fn[3])(C);
+};
+
+// ----------------------------------------------------------------------------
+// Nested callback in a typedef
+// ----------------------------------------------------------------------------
+typedef int D;
+typedef void (T)(void(*callback)(D));
diff --git a/test-artefacts/headers/golden/functions/circular_dependency_fun.h b/test-artefacts/headers/golden/functions/circular_dependency_fun.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/circular_dependency_fun.h
@@ -0,0 +1,7 @@
+struct forward_declaration;
+
+typedef void (*fun_ptr)(struct forward_declaration *s);
+
+struct forward_declaration {
+  fun_ptr f;
+};
diff --git a/test-artefacts/headers/golden/functions/decls_in_signature.h b/test-artefacts/headers/golden/functions/decls_in_signature.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/decls_in_signature.h
@@ -0,0 +1,34 @@
+// regular use of structs in function signatures
+struct opaque;
+struct outside {
+  int x;
+  int y;
+};
+void normal(struct opaque* ptr_to_opaque, struct outside* ptr_to_defined, struct outside by_value);
+
+/**
+ * Error cases
+ *
+ * See 'UnexpectedUnnamedInSignature' for discussion (of both these error cases
+ * and the edge cases below).
+ */
+
+// named struct declared inline
+void f1(struct named_struct { int x; int y; } arg);
+
+// named union
+void f2(union named_union { int x; char y; } arg);
+
+/**
+ * Edge cases: these result in warnings from clang, but in principle we can
+ * generate bindings for these.
+ */
+
+// Untagged struct declared inline
+void f3(struct { int x; int y; } arg);
+
+// _multiple_ untagged structs declared inline
+void f4(struct { int x; int y; } p1, struct { int x; int y; } p2);
+
+// untagged union
+void f5(union { int x; char y; } arg);
diff --git a/test-artefacts/headers/golden/functions/fun_attributes.h b/test-artefacts/headers/golden/functions/fun_attributes.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/fun_attributes.h
@@ -0,0 +1,148 @@
+/** @file
+ * Attributes on functions
+ *
+ * Examples from https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
+ */
+
+typedef struct {} FILE;
+typedef int size_t;
+
+// access (access-mode, ref-index)
+// access (access-mode, ref-index, size-index)
+// SKIPPED (unsupported by clang)
+
+// alias ("target")
+
+static void __f1 () {
+  return;
+}
+void f1 () __attribute__ ((weak, alias ("__f1")));
+
+// alloc_align (position)
+
+void* my_memalign (size_t, size_t) __attribute__ ((alloc_align (1)));
+
+// alloc_size (position)
+// alloc_size (position-1, position-2)
+
+void* my_calloc (size_t, size_t) __attribute__ ((alloc_size (1, 2)));
+void* my_realloc (void*, size_t) __attribute__ ((alloc_size (2)));
+
+// assume_aligned (alignment)
+// assume_aligned (alignment, offset)
+
+void* my_alloc1 (size_t) __attribute__((assume_aligned (16)));
+void* my_alloc2 (size_t) __attribute__((assume_aligned (32, 8)));
+
+// const
+
+int square (int) __attribute__ ((const));
+
+// copy
+// copy (function)
+// SKIPPED (unsupported by clang)
+
+// deprecated
+// deprecated (msg)
+
+int old_fn_deprecated () __attribute__ ((deprecated("Use new_function instead")));
+
+// unavailable
+// unavailable (msg)
+
+int old_fn_unavailable () __attribute__((unavailable("Use new_function instead")));
+
+// format (archetype, string-index, first-to-check)
+
+extern int
+my_printf (void *my_object, const char *my_format, ...)
+      __attribute__ ((format (printf, 2, 3)));
+
+// format_arg (string-index)
+
+extern char *
+my_dgettext (char *my_domain, const char *my_format)
+      __attribute__ ((format_arg (2)));
+
+// SKIPPED: ifunc ("resolver")
+
+// malloc
+// malloc (deallocator)
+// malloc (deallocator, ptr-index)
+// SKIPPED: only "malloc" with no arguments is supported by clang.
+
+__attribute__ ((malloc))
+  FILE* fdopen (int, const char*);
+
+// no_sanitize ("sanitize_option")
+
+void __attribute__ ((no_sanitize ("alignment", "object-size"))) f2 ();
+
+// nonnull
+// nonnull (arg-index, …)
+
+extern void *
+my_memcpy (void *dest, const void *src, size_t len)
+        __attribute__((nonnull (1, 2)));
+
+extern void *
+my_memcpy (void *dest, const void *src, size_t len)
+        __attribute__((nonnull));
+
+// nonnull_if_nonzero
+// nonnull_if_nonzero (arg-index, arg2-index)
+// nonnull_if_nonzero (arg-index, arg2-index, arg3-index)
+// SKIPPED: unsupported by clang
+
+// noplt
+// SKIPPED: unsupported by clang
+
+// noreturn
+
+void fatal () __attribute__ ((noreturn));
+
+// null_terminated_string_arg
+// null_terminated_string_arg (N)
+// SKIPPED: unsupported by clang
+
+// pure
+
+int hash (char *) __attribute__ ((pure));
+
+// returns_nonnull
+
+extern void *
+mymalloc (size_t len) __attribute__((returns_nonnull));
+
+// section ("section-name")
+
+extern void foobar (void) __attribute__ ((section ("bar")));
+
+// symver ("name2@nodename") ¶
+// SKIPPED: unsupported by clang
+
+// target (string, …)
+
+int core2_func (void) __attribute__ ((__target__ ("arch=core2")));
+int sse3_func (void) __attribute__ ((__target__ ("sse3")));
+
+// visibility ("visibility_type")
+
+void __attribute__ ((visibility ("protected"))) f3 ();
+int i __attribute__ ((visibility ("hidden")));
+
+// warn_unused_result
+
+int fn () __attribute__ ((warn_unused_result));
+
+// weakref
+// weakref ("target")
+
+/* Given the declaration: */
+extern int y (void);
+
+/* the following... */
+static int z1 (void) __attribute__ ((weakref ("y")));
+
+/* is equivalent to... */
+static int z2 (void) __attribute__ ((weakref, alias ("y")));
diff --git a/test-artefacts/headers/golden/functions/fun_attributes_conflict.h b/test-artefacts/headers/golden/functions/fun_attributes_conflict.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/fun_attributes_conflict.h
@@ -0,0 +1,15 @@
+/** @file
+ * Conflicting attributes on functions for llvm/clang versions 18 and up
+ *
+ * Examples from https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
+ */
+
+// const and pure conflict
+
+int square_cp (int x) __attribute__ ((const, pure));
+
+int square_pc (int x) __attribute__ ((pure, const));
+
+int square_cc (int x) __attribute__ ((const, const));
+
+int square_pp (int x) __attribute__ ((pure, pure));
diff --git a/test-artefacts/headers/golden/functions/hash_defines.h b/test-artefacts/headers/golden/functions/hash_defines.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/hash_defines.h
@@ -0,0 +1,21 @@
+/* Root '#define' directives must reach binding generation stage and binding
+   compilation stage: the header `libclang` parses at generation time, and the
+   CAPI wrapper source GHC compiles. */
+
+#if MY_FEATURE
+/* Needs the replacement list to be '1', not empty: '#if' on a macro with an
+   empty replacement list is an error.  Without the define reaching the
+   compilation stage, the wrapper body calls an undeclared function. */
+int hash_defines_feature(int x);
+#endif
+
+/* Without the define reaching the compilation stage, the header itself does not
+   preprocess there. */
+struct hash_defines_buffer {
+  char data[MY_SIZE];
+};
+
+/* Pins the '#define MY_EMPTY' (empty replacement list) rendering. */
+#ifdef MY_EMPTY
+int hash_defines_empty(void);
+#endif
diff --git a/test-artefacts/headers/golden/functions/heap_types/struct.h b/test-artefacts/headers/golden/functions/heap_types/struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/heap_types/struct.h
@@ -0,0 +1,15 @@
+// See issue #1490
+
+struct S {
+  int x;
+};
+
+typedef struct S T;
+
+T fun(T x);
+
+/* We must mangle function parameter names */
+void param_underscore(T _);
+void param_uppercase(T Type);
+void param_undersore_capital(T _T);
+void param_haskell_reserved_name(T type);
diff --git a/test-artefacts/headers/golden/functions/heap_types/struct_const.h b/test-artefacts/headers/golden/functions/heap_types/struct_const.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/heap_types/struct_const.h
@@ -0,0 +1,9 @@
+// See issue #1490
+
+struct S {
+  int x;
+};
+
+typedef struct S T;
+
+const T fun (const T x);
diff --git a/test-artefacts/headers/golden/functions/heap_types/struct_const_member.h b/test-artefacts/headers/golden/functions/heap_types/struct_const_member.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/heap_types/struct_const_member.h
@@ -0,0 +1,9 @@
+// See issue #1490
+
+struct S {
+  const int x;
+};
+
+typedef struct S T;
+
+T fun (T x);
diff --git a/test-artefacts/headers/golden/functions/heap_types/struct_const_typedef.h b/test-artefacts/headers/golden/functions/heap_types/struct_const_typedef.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/heap_types/struct_const_typedef.h
@@ -0,0 +1,9 @@
+// See issue #1490
+
+struct S {
+  int x;
+};
+
+typedef const struct S T;
+
+T fun (T x);
diff --git a/test-artefacts/headers/golden/functions/heap_types/union.h b/test-artefacts/headers/golden/functions/heap_types/union.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/heap_types/union.h
@@ -0,0 +1,9 @@
+// See issue #1490
+
+union U {
+  int x;
+};
+
+typedef union U T;
+
+T fun (T x);
diff --git a/test-artefacts/headers/golden/functions/heap_types/union_const.h b/test-artefacts/headers/golden/functions/heap_types/union_const.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/heap_types/union_const.h
@@ -0,0 +1,9 @@
+// See issue #1490
+
+union U {
+  int x;
+};
+
+typedef union U T;
+
+const T fun (const T x);
diff --git a/test-artefacts/headers/golden/functions/heap_types/union_const_member.h b/test-artefacts/headers/golden/functions/heap_types/union_const_member.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/heap_types/union_const_member.h
@@ -0,0 +1,9 @@
+// See issue #1490
+
+union U {
+  const int x;
+};
+
+typedef union U T;
+
+T fun (T x);
diff --git a/test-artefacts/headers/golden/functions/heap_types/union_const_typedef.h b/test-artefacts/headers/golden/functions/heap_types/union_const_typedef.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/heap_types/union_const_typedef.h
@@ -0,0 +1,9 @@
+// See issue #1490
+
+union U {
+  int x;
+};
+
+typedef const union U T;
+
+T fun (T x);
diff --git a/test-artefacts/headers/golden/functions/libc_builtins.h b/test-artefacts/headers/golden/functions/libc_builtins.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/libc_builtins.h
@@ -0,0 +1,11 @@
+// Clang treats malloc and strlen as builtins. From LLVM/Clang 22 on, their
+// size_t argument and result have the type __size_t. We bind them with the
+// underlying unsigned long, as with LLVM/Clang 21 and earlier.
+
+#include <stddef.h>
+
+void *malloc(size_t size);
+size_t strlen(const char *s);
+
+// Not a builtin, so size_t stays a typedef
+size_t my_strlen(const char *s);
diff --git a/test-artefacts/headers/golden/functions/not_visible_decl.h b/test-artefacts/headers/golden/functions/not_visible_decl.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/not_visible_decl.h
@@ -0,0 +1,8 @@
+// struct with no prior file-scope declaration — prototype-scoped forward ref
+void f(struct foo* arg);
+
+// named struct defined inline in prototype — not visible outside
+void g(struct foo {int x; char c;}* arg);
+
+// untagged struct defined inline in prototype — not visible outside
+void h(struct {int x; char c;}* arg);
diff --git a/test-artefacts/headers/golden/functions/simple_func.h b/test-artefacts/headers/golden/functions/simple_func.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/simple_func.h
@@ -0,0 +1,11 @@
+double erf(double arg);
+
+static inline double bad_fma(double x, double y, double z) {
+    return (x * y) + z;
+}
+
+void no_args(void);
+
+void no_args_no_void();
+
+int fun(char x, double y);
diff --git a/test-artefacts/headers/golden/functions/typedef_funptr.h b/test-artefacts/headers/golden/functions/typedef_funptr.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/typedef_funptr.h
@@ -0,0 +1,22 @@
+// Regression test for issue #1650: avoid duplicate FromFunPtr/ToFunPtr instances
+//
+// When a typedef function pointer is used in a struct field, only the _Aux
+// newtype instance should be generated, not a duplicate instance for the bare
+// function type.
+
+// Typedef function pointer used in a struct field.
+// Should generate: FromFunPtr/ToFunPtr for RunDriver_Aux only.
+// Should NOT generate: FromFunPtr/ToFunPtr for (Ptr Driver -> IO CInt).
+//
+struct Driver;
+typedef int (*RunDriver)(struct Driver *self);
+struct Driver {
+  RunDriver run;
+};
+
+// Bare function pointer in a struct field (no typedef).
+// Should generate: FromFunPtr/ToFunPtr for the bare function type.
+//
+struct Bare {
+  void (*callback)(int x);
+};
diff --git a/test-artefacts/headers/golden/functions/varargs.h b/test-artefacts/headers/golden/functions/varargs.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/functions/varargs.h
@@ -0,0 +1,8 @@
+// Test that we do not try to produce any bindings for variadic functions (but
+// do continue to generate bindings for the other functions).
+
+#include <stdarg.h>
+
+void f(const char* fmt, ...);
+void g(const char* fmt, va_list args);
+void h();
diff --git a/test-artefacts/headers/golden/globals/globals.h b/test-artefacts/headers/golden/globals/globals.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/globals/globals.h
@@ -0,0 +1,436 @@
+#include <complex.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+/** @file
+ * Global variables
+ */
+
+// Simple global variable
+extern int simpleGlobal;
+
+// Global variable of compound type
+struct config {
+  int x;
+  int y;
+};
+extern struct config compoundGlobal1;
+
+// Similar, but with inline declaration of struct
+extern struct inline_struct { int x; int y; } compoundGlobal2;
+
+/**
+ * Non-extern non-static global variables
+ *
+ * These kinds of variables need to be treated with care, to avoid duplicate
+ * symbols, but do exist in the wild.
+ *
+ * We test with various kinds of initializers as we must explicitly ignore them
+ * in our parser. The list here roughly follows the definition of `CXCursor`
+ * [1], starting at `CXCursor_IntegerLiteral`; see also definition of 'varDecl'
+ * in `HsBindgen.Frontend.Pass.Parse.Decl`.
+ *
+ * [1]: https://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d470913f9ef0013
+ */
+
+int            nesInteger     = 1;
+float          nesFloating    = 1.2f;
+double complex nesImaginary   = 1.0i;
+char*          nesString1     = "hi";
+char           nesString2[]   = "hi";
+char           nesCharacter   = 'a';
+int            nesParen       = (1);
+int            nesUnary       = +5;
+int            nesBinary      = 1 + 2;
+int            nesConditional = 1 ? 2 : 3;
+float          nesCast        = (float) 1;
+int*           nesCompound    = (int []){2, 4, 6};
+uint8_t        nesInitList[]  = {0x00, 0x01, 0x02, 0x04};
+bool           nesBool        = true;
+
+/**
+ * Additional examples of global variables, abstracted from real examples
+ *
+ * The `streamBinary`/`streamBinary_len` example comes from [1], and is an
+ * example of a non-extern non-static global (indeed, the header does not even
+ * use @pragma once@ or similar).
+ *
+ * [1]: https://github.com/analogdevicesinc/no-OS/blob/855c4b3c34f2297865e448661ba4fcc0931bf430/drivers/rf-transceiver/talise/firmware/talise_stream_binary.h#L322-L325
+ */
+
+uint8_t streamBinary[] = {
+	0x00, 0x02, 0x00, 0x20, 0x10, 0x02, 0x00, 0x20, 0x32, 0x00, 0x00, 0x10,
+	0x11, 0x02, 0x00, 0x00, 0xa0, 0x03, 0x00, 0x20, 0x90, 0x05, 0x00, 0x20,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x03, 0x00, 0x20,
+	0x94, 0x05, 0x00, 0x20, 0xbc, 0x03, 0x00, 0x20, 0xc8, 0x05, 0x00, 0x20,
+	0xe4, 0x03, 0x00, 0x20, 0x34, 0x06, 0x00, 0x20, 0xfc, 0x03, 0x00, 0x20,
+	0x68, 0x06, 0x00, 0x20, 0x24, 0x04, 0x00, 0x20, 0xd4, 0x06, 0x00, 0x20,
+	0x50, 0x04, 0x00, 0x20, 0x44, 0x07, 0x00, 0x20, 0x7c, 0x04, 0x00, 0x20,
+	0xb4, 0x07, 0x00, 0x20, 0x94, 0x04, 0x00, 0x20, 0xec, 0x07, 0x00, 0x20,
+	0xa4, 0x04, 0x00, 0x20, 0x14, 0x08, 0x00, 0x20, 0xbc, 0x04, 0x00, 0x20,
+	0x4c, 0x08, 0x00, 0x20, 0xcc, 0x04, 0x00, 0x20, 0x74, 0x08, 0x00, 0x20,
+	0xe4, 0x04, 0x00, 0x20, 0xb0, 0x08, 0x00, 0x20, 0xfc, 0x04, 0x00, 0x20,
+	0xec, 0x08, 0x00, 0x20, 0x0c, 0x05, 0x00, 0x20, 0x10, 0x09, 0x00, 0x20,
+	0x1c, 0x05, 0x00, 0x20, 0x34, 0x09, 0x00, 0x20, 0x2c, 0x05, 0x00, 0x20,
+	0x58, 0x09, 0x00, 0x20, 0x3c, 0x05, 0x00, 0x20, 0x7c, 0x09, 0x00, 0x20,
+	0x40, 0x05, 0x00, 0x20, 0x80, 0x09, 0x00, 0x20, 0x48, 0x05, 0x00, 0x20,
+	0x8c, 0x09, 0x00, 0x20, 0x4c, 0x05, 0x00, 0x20, 0x94, 0x09, 0x00, 0x20,
+	0x50, 0x05, 0x00, 0x20, 0x9c, 0x09, 0x00, 0x20, 0x54, 0x05, 0x00, 0x20,
+	0xa4, 0x09, 0x00, 0x20, 0x58, 0x05, 0x00, 0x20, 0xac, 0x09, 0x00, 0x20,
+	0x60, 0x05, 0x00, 0x20, 0xbc, 0x09, 0x00, 0x20, 0x68, 0x05, 0x00, 0x20,
+	0xcc, 0x09, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x05, 0x00, 0x20,
+	0xd4, 0x09, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xcf, 0xc6, 0x00,
+	0xce, 0xd0, 0xc1, 0xc1, 0xcf, 0xc0, 0xc0, 0xc0, 0xcd, 0xc0, 0xc0, 0xcd,
+	0xc0, 0xc0, 0xcd, 0xc0, 0xc0, 0xc1, 0xcf, 0xd1, 0xc6, 0x00, 0x00, 0x00,
+	0xce, 0xd0, 0xc1, 0xc1, 0xc1, 0xcf, 0xc0, 0xc0, 0xcd, 0xc1, 0xc1, 0xcd,
+	0x98, 0x48, 0x98, 0x48, 0xc0, 0xc1, 0x98, 0x51, 0x89, 0x48, 0xc0, 0xc0,
+	0xc0, 0xc0, 0xcd, 0xc1, 0xc1, 0xc0, 0xcd, 0xc0, 0xcd, 0xc0, 0xc1, 0xc1,
+	0xc1, 0xcf, 0xd1, 0xc6, 0xce, 0xd0, 0xc1, 0xc1, 0xcf, 0xc0, 0xc0, 0xc0,
+	0xcd, 0xc0, 0xc0, 0xcd, 0xc0, 0xc0, 0xcd, 0xc0, 0xc0, 0xc1, 0xcf, 0xd1,
+	0xc6, 0x00, 0x00, 0x00, 0xce, 0xd0, 0xc1, 0xc1, 0xc1, 0xcf, 0xc0, 0xc0,
+	0xcd, 0xc1, 0xc1, 0xcd, 0x98, 0x48, 0x98, 0x48, 0xc0, 0xc1, 0x98, 0x51,
+	0x89, 0x48, 0xc0, 0xc0, 0xc0, 0xc0, 0xcd, 0xc1, 0xc1, 0xc0, 0xcd, 0xc0,
+	0xcd, 0xc0, 0xc1, 0xc1, 0xc1, 0xcf, 0xd1, 0xc6, 0xce, 0xd0, 0xc1, 0xc1,
+	0xc1, 0xcf, 0xc0, 0x98, 0x48, 0xc0, 0xc1, 0xc1, 0xcd, 0xc1, 0xc1, 0xc1,
+	0x98, 0x51, 0x89, 0x48, 0xc0, 0xc0, 0xc0, 0xc0, 0x98, 0x48, 0x98, 0x48,
+	0xc0, 0xcd, 0xc1, 0xc1, 0xc0, 0xc1, 0xc0, 0xcd, 0xc1, 0xc1, 0xcf, 0xd1,
+	0xc6, 0x00, 0x00, 0x00, 0xce, 0xd0, 0xc1, 0xc1, 0xc1, 0xcf, 0xc0, 0xc0,
+	0xc1, 0xc1, 0x98, 0x48, 0xcd, 0xc1, 0xc1, 0xc1, 0x98, 0x51, 0x89, 0x48,
+	0xc0, 0xc0, 0xc0, 0xc0, 0x98, 0x48, 0x98, 0x48, 0xc0, 0xcd, 0xc1, 0xc1,
+	0xc0, 0xc1, 0xc0, 0xcd, 0xc1, 0xc1, 0xcf, 0xd1, 0xc6, 0x00, 0x00, 0x00,
+	0xce, 0xd0, 0xc1, 0xcf, 0xc0, 0xc0, 0xcd, 0xc0, 0xcd, 0xc0, 0xcd, 0xc0,
+	0xc0, 0xcd, 0xc0, 0xc0, 0xc0, 0xc1, 0xc1, 0xcf, 0xd1, 0xc6, 0x00, 0x00,
+	0xce, 0xd0, 0xc1, 0xcf, 0xc0, 0xc0, 0xc0, 0xc0, 0xcd, 0xc0, 0xc1, 0xc1,
+	0xc1, 0xcf, 0xd1, 0xc6, 0xce, 0xd0, 0xc1, 0xcf, 0xc0, 0xc0, 0xcd, 0xc0,
+	0xcd, 0xc0, 0xcd, 0xc0, 0xc0, 0xcd, 0xc0, 0xc0, 0xc0, 0xc1, 0xc1, 0xcf,
+	0xd1, 0xc6, 0x00, 0x00, 0xce, 0xd0, 0xc1, 0xcf, 0xc0, 0xc0, 0xc0, 0xc0,
+	0xcd, 0xc0, 0xc1, 0xc1, 0xc1, 0xcf, 0xd1, 0xc6, 0xce, 0xd0, 0xc1, 0xcf,
+	0xc1, 0xc0, 0x98, 0x48, 0x98, 0x48, 0xc0, 0xcd, 0xc1, 0xc0, 0xc0, 0xcd,
+	0xc0, 0xc1, 0xc1, 0xc1, 0xcf, 0xd1, 0xc6, 0x00, 0xce, 0xd0, 0xc1, 0xcf,
+	0xc1, 0xc0, 0x98, 0x48, 0x98, 0x48, 0xc0, 0xcd, 0xc1, 0xc0, 0xc0, 0xcd,
+	0xc0, 0xc1, 0xc1, 0xc1, 0xcf, 0xd1, 0xc6, 0x00, 0xce, 0xd0, 0xc1, 0xc1,
+	0xcf, 0xc0, 0xc0, 0xc1, 0xc0, 0xc0, 0xc1, 0xcf, 0xd1, 0xc6, 0x00, 0x00,
+	0xce, 0xd0, 0xc1, 0xc1, 0xcf, 0xc0, 0xc0, 0xcd, 0xc0, 0xc0, 0xc1, 0xcf,
+	0xd1, 0xc6, 0x00, 0x00, 0xce, 0xd0, 0xc1, 0xcf, 0xc1, 0xc0, 0xc0, 0xc1,
+	0xcd, 0xc1, 0xc1, 0xcf, 0xd1, 0xc6, 0x00, 0x00, 0xce, 0xd0, 0xc1, 0xcf,
+	0xc1, 0xc0, 0xc0, 0xc1, 0xcd, 0xc1, 0xc1, 0xcf, 0xd1, 0xc6, 0x00, 0x00,
+	0xce, 0xc6, 0x00, 0x00, 0xce, 0xc1, 0xcd, 0xc1, 0xc6, 0x00, 0x00, 0x00,
+	0xce, 0xc1, 0xc6, 0x00, 0xce, 0xc1, 0xc6, 0x00, 0xce, 0x98, 0xc0, 0xc6,
+	0xce, 0xc1, 0xc6, 0x00, 0xce, 0xc1, 0xcd, 0xc1, 0xc1, 0xc6, 0x00, 0x00,
+	0xce, 0xc1, 0xcd, 0xc1, 0xc1, 0xc6, 0x00, 0x00, 0xce, 0x98, 0xc0, 0xc6,
+	0xce, 0x50, 0x91, 0xae, 0x98, 0x81, 0xaf, 0x98, 0x86, 0x8f, 0x48, 0xa1,
+	0xc8, 0xa9, 0x50, 0x91, 0xae, 0xa7, 0xc8, 0x55, 0x95, 0x81, 0xaf, 0x98,
+	0x55, 0x95, 0x87, 0xaf, 0x98, 0x86, 0x8f, 0x48, 0xc6, 0x00, 0x00, 0x00,
+	0xf8, 0x14, 0x33, 0x04, 0x05, 0x00, 0x00, 0x85, 0xfc, 0x14, 0x40, 0x40,
+	0xfb, 0x14, 0x40, 0x40, 0x01, 0x87, 0x02, 0x02, 0x07, 0x03, 0x00, 0x09,
+	0x03, 0x39, 0x50, 0x00, 0x56, 0x0f, 0x00, 0x09, 0x03, 0x29, 0x08, 0x00,
+	0x09, 0x03, 0x21, 0x92, 0x0e, 0x01, 0x50, 0x00, 0x87, 0x02, 0x03, 0x28,
+	0x16, 0x00, 0xfc, 0x14, 0x00, 0x40, 0x02, 0x00, 0x10, 0x00, 0x00, 0x86,
+	0xfc, 0x14, 0x01, 0x01, 0xfb, 0x14, 0x01, 0x01, 0x5a, 0x15, 0x40, 0x40,
+	0x01, 0x05, 0x03, 0x08, 0x85, 0x02, 0x00, 0x08, 0x00, 0x86, 0x02, 0x00,
+	0x16, 0x04, 0x03, 0x40, 0x40, 0xf0, 0x00, 0xfa, 0x14, 0x02, 0x01, 0xf9,
+	0x14, 0x09, 0x08, 0x80, 0x08, 0x30, 0x44, 0x08, 0x00, 0x33, 0xf6, 0x14,
+	0x77, 0x00, 0x0b, 0x03, 0xdb, 0x07, 0x00, 0x03, 0x03, 0x60, 0x05, 0x03,
+	0x00, 0x89, 0x02, 0x00, 0x02, 0x00, 0x81, 0x07, 0x00, 0x21, 0xc2, 0x16,
+	0x00, 0x03, 0x85, 0x02, 0x08, 0x08, 0x00, 0x85, 0x02, 0x09, 0x01, 0x00,
+	0x8c, 0x02, 0x00, 0x32, 0x15, 0x00, 0x40, 0x45, 0x0a, 0x40, 0x40, 0xfc,
+	0x14, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x87,
+	0xfc, 0x14, 0x80, 0x80, 0xfb, 0x14, 0x80, 0x80, 0x01, 0x88, 0x02, 0x02,
+	0x08, 0x03, 0x00, 0x0a, 0x03, 0x39, 0x50, 0x00, 0x57, 0x0f, 0x00, 0x0a,
+	0x03, 0x29, 0x08, 0x00, 0x0a, 0x03, 0x21, 0x93, 0x0e, 0x01, 0x50, 0x00,
+	0x88, 0x02, 0x03, 0x29, 0x16, 0x00, 0xfc, 0x14, 0x00, 0x80, 0x02, 0x00,
+	0x10, 0x00, 0x00, 0x88, 0xfc, 0x14, 0x02, 0x02, 0xfb, 0x14, 0x02, 0x02,
+	0x5a, 0x15, 0x40, 0x40, 0x01, 0x06, 0x03, 0x08, 0x86, 0x02, 0x00, 0x08,
+	0x00, 0x85, 0x02, 0x00, 0x16, 0x03, 0x03, 0x40, 0x40, 0xf0, 0x00, 0xfa,
+	0x14, 0x02, 0x01, 0xf9, 0x14, 0x0a, 0x08, 0x80, 0x08, 0x30, 0x44, 0x08,
+	0x00, 0x33, 0xf6, 0x14, 0x77, 0x00, 0x0b, 0x03, 0xdb, 0x07, 0x00, 0x04,
+	0x03, 0x60, 0x06, 0x03, 0x00, 0x89, 0x02, 0x00, 0x02, 0x00, 0x81, 0x07,
+	0x00, 0x21, 0xc2, 0x16, 0x00, 0x03, 0x86, 0x02, 0x08, 0x08, 0x00, 0x86,
+	0x02, 0x09, 0x01, 0x00, 0x8d, 0x02, 0x00, 0x32, 0x15, 0x00, 0x40, 0x45,
+	0x0a, 0x80, 0x80, 0xfc, 0x14, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,
+	0x10, 0x00, 0x00, 0x89, 0xfc, 0x14, 0x04, 0x04, 0xfb, 0x14, 0x04, 0x04,
+	0x32, 0x15, 0x40, 0x40, 0x01, 0x05, 0x03, 0x08, 0xf9, 0x14, 0x09, 0x08,
+	0x85, 0x02, 0x00, 0x86, 0x02, 0x00, 0x14, 0x04, 0x03, 0x40, 0x40, 0x02,
+	0x80, 0x80, 0x08, 0x00, 0x05, 0x44, 0x08, 0x00, 0x03, 0x85, 0x0a, 0x40,
+	0x40, 0xf6, 0x14, 0x77, 0x00, 0x0b, 0x03, 0xdb, 0x07, 0x00, 0x03, 0x03,
+	0x50, 0x05, 0x03, 0x00, 0x89, 0x02, 0x01, 0xed, 0x14, 0x81, 0x0c, 0xee,
+	0x14, 0x82, 0x0c, 0x85, 0x02, 0x08, 0x08, 0x00, 0x81, 0x07, 0x00, 0x21,
+	0xc2, 0x16, 0x00, 0x03, 0x85, 0x02, 0x0a, 0x82, 0x0c, 0x00, 0x40, 0x8c,
+	0x02, 0x00, 0x80, 0x00, 0x5a, 0x15, 0x00, 0x40, 0xfc, 0x14, 0x00, 0x04,
+	0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x8a, 0xfc, 0x14, 0x08, 0x08,
+	0xfb, 0x14, 0x08, 0x08, 0x32, 0x15, 0x40, 0x40, 0x01, 0x06, 0x03, 0x08,
+	0x86, 0x02, 0x00, 0x85, 0x02, 0x00, 0x14, 0x03, 0x03, 0x40, 0x40, 0xf9,
+	0x14, 0x0a, 0x08, 0x02, 0x80, 0x80, 0x08, 0x00, 0x0a, 0x44, 0x08, 0x00,
+	0x30, 0x85, 0x0a, 0x80, 0x80, 0xf6, 0x14, 0x77, 0x00, 0x0b, 0x03, 0xdb,
+	0x07, 0x00, 0x04, 0x03, 0x50, 0x06, 0x03, 0x00, 0x89, 0x02, 0x01, 0xef,
+	0x14, 0x84, 0x0c, 0xf0, 0x14, 0x85, 0x0c, 0x86, 0x02, 0x08, 0x08, 0x00,
+	0x81, 0x07, 0x00, 0x21, 0xc2, 0x16, 0x00, 0x03, 0x86, 0x02, 0x0a, 0x85,
+	0x0c, 0x00, 0x40, 0x8d, 0x02, 0x00, 0x80, 0x00, 0x5a, 0x15, 0x00, 0x40,
+	0xfc, 0x14, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x8b,
+	0xfc, 0x14, 0x40, 0x40, 0x01, 0x87, 0x02, 0x02, 0x28, 0x16, 0x03, 0x30,
+	0x00, 0x92, 0x0e, 0x02, 0x50, 0x00, 0x09, 0x03, 0x29, 0x0a, 0x00, 0x09,
+	0x03, 0x39, 0x56, 0x0f, 0xee, 0x02, 0x00, 0x09, 0x03, 0x3f, 0x07, 0x03,
+	0x07, 0x87, 0x02, 0x00, 0xfb, 0x14, 0x00, 0x40, 0xfc, 0x14, 0x00, 0x40,
+	0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x8c, 0xfc, 0x14, 0x01, 0x01,
+	0x01, 0x8c, 0x02, 0x03, 0x85, 0x02, 0x08, 0x03, 0x03, 0x77, 0x05, 0x03,
+	0x5d, 0x40, 0x00, 0x85, 0x02, 0x00, 0x45, 0x0a, 0x00, 0x40, 0xfb, 0x14,
+	0x00, 0x01, 0xfc, 0x14, 0x00, 0x01, 0x02, 0x00, 0x05, 0x00, 0x00, 0x8d,
+	0xfc, 0x14, 0x80, 0x80, 0x01, 0x88, 0x02, 0x02, 0x29, 0x16, 0x03, 0x30,
+	0x00, 0x93, 0x0e, 0x02, 0x50, 0x00, 0x0a, 0x03, 0x29, 0x0a, 0x00, 0x0a,
+	0x03, 0x39, 0x57, 0x0f, 0xee, 0x02, 0x00, 0x0a, 0x03, 0x3f, 0x08, 0x03,
+	0x07, 0x88, 0x02, 0x00, 0xfb, 0x14, 0x00, 0x80, 0xfc, 0x14, 0x00, 0x80,
+	0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x8e, 0xfc, 0x14, 0x02, 0x02,
+	0x01, 0x8d, 0x02, 0x03, 0x86, 0x02, 0x08, 0x04, 0x03, 0x77, 0x06, 0x03,
+	0x5d, 0x40, 0x00, 0x86, 0x02, 0x00, 0x45, 0x0a, 0x00, 0x80, 0xfb, 0x14,
+	0x00, 0x02, 0xfc, 0x14, 0x00, 0x02, 0x02, 0x00, 0x05, 0x00, 0x00, 0x8f,
+	0xfc, 0x14, 0x04, 0x04, 0x01, 0x80, 0x08, 0x00, 0x05, 0x8c, 0x02, 0x03,
+	0xe9, 0x14, 0x81, 0x0c, 0xea, 0x14, 0x82, 0x0c, 0x85, 0x02, 0x08, 0x02,
+	0x00, 0x82, 0x0c, 0x00, 0x40, 0x03, 0x03, 0x77, 0x05, 0x03, 0x1d, 0x40,
+	0x00, 0x85, 0x02, 0x00, 0x85, 0x0a, 0x00, 0x40, 0xfb, 0x14, 0x00, 0x04,
+	0xfc, 0x14, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x90,
+	0xfc, 0x14, 0x08, 0x08, 0x01, 0x80, 0x08, 0x00, 0x0a, 0x8d, 0x02, 0x03,
+	0xeb, 0x14, 0x84, 0x0c, 0xec, 0x14, 0x85, 0x0c, 0x86, 0x02, 0x08, 0x02,
+	0x00, 0x85, 0x0c, 0x00, 0x40, 0x04, 0x03, 0x77, 0x06, 0x03, 0x1d, 0x40,
+	0x00, 0x86, 0x02, 0x00, 0x85, 0x0a, 0x00, 0x80, 0xfb, 0x14, 0x00, 0x08,
+	0xfc, 0x14, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x91,
+	0xfc, 0x14, 0x10, 0x10, 0xfb, 0x14, 0x10, 0x10, 0x01, 0x89, 0x02, 0x02,
+	0x05, 0x03, 0x00, 0x44, 0x08, 0x01, 0x01, 0x85, 0x02, 0x14, 0x03, 0x03,
+	0x30, 0xfc, 0x14, 0x00, 0x10, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x93,
+	0xfc, 0x14, 0x20, 0x20, 0xfb, 0x14, 0x20, 0x20, 0x01, 0x89, 0x02, 0x02,
+	0x06, 0x03, 0x00, 0x02, 0x00, 0x86, 0x02, 0x14, 0x04, 0x03, 0x30, 0xfc,
+	0x14, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x93,
+	0xfc, 0x14, 0x10, 0x10, 0x01, 0x44, 0x08, 0x00, 0x03, 0x03, 0x03, 0x70,
+	0x85, 0x02, 0x00, 0x44, 0x08, 0x00, 0x03, 0x20, 0x00, 0xfb, 0x14, 0x00,
+	0x10, 0xfc, 0x14, 0x00, 0x10, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x94,
+	0xfc, 0x14, 0x20, 0x20, 0x01, 0x44, 0x08, 0x00, 0x30, 0x03, 0x03, 0x70,
+	0x86, 0x02, 0x00, 0x44, 0x08, 0x00, 0x30, 0x20, 0x00, 0xfb, 0x14, 0x00,
+	0x20, 0xfc, 0x14, 0x00, 0x20, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+	0x05, 0x00, 0xc1, 0x05, 0x10, 0x13, 0x04, 0x00, 0xc1, 0x05, 0x00, 0x13,
+	0x05, 0x00, 0xd0, 0x05, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0xe0, 0x05,
+	0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0xd5, 0x14, 0xd5, 0x14, 0x0c, 0x00,
+	0x05, 0x00, 0xc1, 0x05, 0x03, 0x03, 0x00, 0x00, 0x05, 0x00, 0xc1, 0x05,
+	0x04, 0x04, 0x02, 0x00, 0xd0, 0x05, 0x02, 0x03, 0xc1, 0x05, 0x00, 0x04,
+	0x05, 0x00, 0xc1, 0x05, 0x08, 0x08, 0x02, 0x00, 0xe0, 0x05, 0x02, 0x03,
+	0xc1, 0x05, 0x00, 0x08, 0x05, 0x00, 0xd5, 0x14, 0xd5, 0x14, 0x00, 0x00,
+	0x05, 0x00, 0xff, 0x00, 0xf1, 0x14, 0x80, 0x08, 0x80, 0x08, 0x01, 0xff,
+	0x00, 0x01, 0xff, 0x00, 0xf6, 0x14, 0xf7, 0x00, 0x0b, 0x03, 0x0b, 0x03,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0x20, 0xf7, 0x13, 0x63
+};
+uint32_t streamBinary_len = 4096;
+
+typedef struct
+{
+  uint8_t  major;
+  uint16_t minor;
+  uint8_t  patch;
+} version_t;
+
+typedef struct
+{
+  uint16_t  x;
+  bool      y;
+  version_t version;
+} struct1_t;
+
+typedef struct
+{
+  struct1_t field1;
+} struct2_t;
+
+struct2_t some_global_struct = {
+  .field1 = {
+     .x       = 0,
+     .y       = false,
+     .version = {
+        .major = 8,
+        .minor = 0,
+        .patch = 1
+        },
+     }
+  };
diff --git a/test-artefacts/headers/golden/globals/untagged.h b/test-artefacts/headers/golden/globals/untagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/globals/untagged.h
@@ -0,0 +1,30 @@
+/* -------------------------------------------------------------------------- */
+/* global variables that reference untagged/struct/enum/union types */
+
+// hs-bindgen generates getter C functions for global variables. This getter
+// needs special handling if a global variable's type references an untagged
+// struct/union/enum: we can't pretty-print such C types because there is no tag
+// to refer to. In such cases we pretty-print void* instead.
+
+/* -------------------------------------------------------------------------- */
+/* basic examples */
+
+struct { int x; int y; } untaggedPoint;
+// with initializer
+struct { int a; int b; } untaggedPair = { 1, 2 };
+
+enum { VAL_A = 0, VAL_B = 1 } untaggedEnum;
+// with initializer
+enum { X = 10, Y = 20, Z = 30 } untaggedEnumCoords = { X };
+
+/* -------------------------------------------------------------------------- */
+/* examples with indirections */
+
+// array-of-untagged-enum
+enum { a1 } A[17];
+
+// const-untagged-union
+const union { int x; } B;
+
+// pointer-to-array-of-const-pointer-to-untagged-struct
+struct { int x; } * const (*C)[];
diff --git a/test-artefacts/headers/golden/macros/command_line/redefined.h b/test-artefacts/headers/golden/macros/command_line/redefined.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/command_line/redefined.h
@@ -0,0 +1,11 @@
+/*
+ * Redefinition of a macro defined by a -D option after using it
+ *
+ * The test defines T on the command line.
+ *
+ * See <https://github.com/well-typed/hs-bindgen/issues/2280>.
+ */
+
+struct S { T x; };
+
+#define T long
diff --git a/test-artefacts/headers/golden/macros/command_line/uses.h b/test-artefacts/headers/golden/macros/command_line/uses.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/command_line/uses.h
@@ -0,0 +1,9 @@
+/*
+ * Uses of macros defined by -D options
+ *
+ * The test defines T, V and F on the command line.
+ */
+
+struct S { T x; };
+
+#define W F(V)
diff --git a/test-artefacts/headers/golden/macros/empty_body.h b/test-artefacts/headers/golden/macros/empty_body.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/empty_body.h
@@ -0,0 +1,12 @@
+// A macro body may be empty: `#define FOO` defines FOO as the empty token
+// sequence (C23 6.10.5), the form every include guard uses. See issue 2246.
+//
+// Such a macro only reaches the macro language with `--parse-empty-macros`;
+// it is then up to the language whether it can be translated: the `CExpr`
+// language has no expression to translate and declines these macros, while
+// `Raw` reproduces them verbatim.
+
+#define EMPTY_OBJECT
+#define EMPTY_FUNCTION()
+#define EMPTY_FUNCTION_PARAMS(x, y)
+#define EMPTY_FUNCTION_VARIADIC(x, ...)
diff --git a/test-artefacts/headers/golden/macros/gnu_variadic.h b/test-artefacts/headers/golden/macros/gnu_variadic.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/gnu_variadic.h
@@ -0,0 +1,13 @@
+// A variadic parameter list comes in two forms, and they are different macros:
+// in the C99 form the trailing arguments are __VA_ARGS__, in the GNU form the
+// name before the ... stands for them. Rendering GNU_VARIADIC as
+// `#define GNU_VARIADIC(fmt, ...) args` would pass only fmt on.
+//
+// `c-expr` parses neither form, so only the `Raw` macro language produces
+// bindings here.
+
+#define C99_VARIADIC(fmt, ...) fmt
+
+#define GNU_VARIADIC(fmt, args...) args
+
+#define GNU_VARIADIC_ONLY(args...) args
diff --git a/test-artefacts/headers/golden/macros/issue_890.h b/test-artefacts/headers/golden/macros/issue_890.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/issue_890.h
@@ -0,0 +1,5 @@
+#define A 0
+#define B(x) (x + 1)
+#define C B(0)
+#define D B(A)
+#define E B(1)
diff --git a/test-artefacts/headers/golden/macros/keyword_params.h b/test-artefacts/headers/golden/macros/keyword_params.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/keyword_params.h
@@ -0,0 +1,11 @@
+/* A formal parameter may be spelled like a keyword.
+
+   The preprocessor sees pp-tokens, which know no keywords, so within the
+   replacement list the parameter shadows every other meaning of its spelling.
+   Which spellings libclang reports as keywords depends on the C standard in
+   force, and the parse must not.
+*/
+
+#define ID_INT(int) int
+#define ADD_SIZEOF(sizeof, x) sizeof + x
+#define FST_CONST(const, volatile) const
diff --git a/test-artefacts/headers/golden/macros/macro_comma.h b/test-artefacts/headers/golden/macros/macro_comma.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_comma.h
@@ -0,0 +1,15 @@
+// A comma in a macro body denotes a tuple, not the C comma operator.
+//
+// C assigns no meaning to macro bodies, so we are free to pick the most useful
+// interpretation. Tuples support the argument-list idiom (`#define ARGS 1, 2`
+// used as `f(ARGS)`); the comma operator is pointless here, since the
+// expressions we can express have no side effects. See issue 2182.
+
+#define OBJ            (1, 2)
+#define OBJ_NO_PARENS  1, 2
+#define FUN(x, y)      (x, y)
+#define FUN_THREE(x, y, z) ((x), (y), (z))
+
+// Consequence of the tuple interpretation: a comma expression does not compose
+// with arithmetic, so this macro fails to parse.
+#define ARITH          ((1, 2) + 3)
diff --git a/test-artefacts/headers/golden/macros/macro_ext_binding_dep.h b/test-artefacts/headers/golden/macros/macro_ext_binding_dep.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_ext_binding_dep.h
@@ -0,0 +1,8 @@
+// A typedef that is replaced by an external binding spec
+typedef int A;
+
+// A type-macro whose body references A. Its var slot should resolve to
+// Left ext after ResolveBindingSpecs runs.
+#define B A
+
+void use_b(B x);
diff --git a/test-artefacts/headers/golden/macros/macro_ext_binding_dep.yaml b/test-artefacts/headers/golden/macros/macro_ext_binding_dep.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_ext_binding_dep.yaml
@@ -0,0 +1,15 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: M
+ctypes:
+- headers: macros/macro_ext_binding_dep.h
+  cname: A
+  hsname: A
+hstypes:
+- hsname: A
+  representation:
+    newtype:
+      constructor: A
+      fields:
+      - unwrapA
diff --git a/test-artefacts/headers/golden/macros/macro_functions.h b/test-artefacts/headers/golden/macros/macro_functions.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_functions.h
@@ -0,0 +1,21 @@
+#define INCR(x) x + 1
+#define ADD(x, y) x + y
+
+#define ID(X) X
+#define CONST(X,Y) X
+#define CONST_3(X,Y,Z) X
+
+#define CMP(X,Y) X < Y
+#define FUN1(X,Y) X + 12ull * Y
+#define FUN2(X,Y) X << ( 3ull * Y )
+
+#define G(X,Y) CONST(INCR(Y),ID(X))
+#define G_3(X,Y,Z) CONST_3(INCR(Y),ID(X),ID(Z))
+
+#define DIV1(X,Y) X / ( Y + 12u )
+#define DIV2(X,Y) 10.0f * X / Y
+
+
+// Tests for #793
+#define SWAP32(w) (((w)>>24)&0xff) | (((w)<<8)&0xff0000)
+#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
diff --git a/test-artefacts/headers/golden/macros/macro_in_fundecl.h b/test-artefacts/headers/golden/macros/macro_in_fundecl.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_in_fundecl.h
@@ -0,0 +1,53 @@
+// Reparsing function declarations
+
+// clang -Xclang -ast-dump file.c
+
+#define I int
+#define C char
+#define F float
+#define L long
+#define S short
+
+// very basic
+char quux(F x, char y) { return 0; }
+C *wam(float x, C *y) { return 0; }
+
+// basic
+char* foo1(float x, int (*g)(int)) { return 0; }
+char* foo2(F x, int (*g)(int)) { return 0; }
+C* foo3(float x, int (*g)(int)) { return 0; }
+
+// return function pointer
+int (*bar1(long x))(short) { return 0; }
+int (*bar2(L x))(short) { return 0; }
+int (*bar3(long x))(S) { return 0; }
+I (*bar4(long x))(short) { return 0; }
+
+// return array
+int (*baz1(const int i))[2][3] {
+    static int arr[2][3] = {
+        {1, 2, 3},
+        {11, 12, 13}
+    };
+    arr[1][1] = i;
+    return &arr;
+}
+int (*baz2(const I i))[2][3] {
+    static int arr[2][3] = {
+        {1, 2, 3},
+        {11, 12, 13}
+    };
+    arr[1][1] = i;
+    return &arr;
+}
+I (*baz3(const int i))[2][3] {
+    static int arr[2][3] = {
+        {1, 2, 3},
+        {11, 12, 13}
+    };
+    arr[1][1] = i;
+    return &arr;
+}
+
+// neither arguments nor keyword void
+I no_args_no_void();
diff --git a/test-artefacts/headers/golden/macros/macro_in_fundecl_vs_typedef.h b/test-artefacts/headers/golden/macros/macro_in_fundecl_vs_typedef.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_in_fundecl_vs_typedef.h
@@ -0,0 +1,29 @@
+// Variations on the examples in macro_in_fundecl, with typedef'd args
+// TODO: Test the other variants in `macro_in_fundecl`.
+
+#define MC char
+typedef char TC;
+
+// very basic
+char quux1(MC x, TC y) { return 0; }
+TC quux2(MC x, char y) { return 0; }
+MC *wam1(float x, TC *y) { return 0; }
+TC *wam2(float x, MC *y) { return 0; }
+
+// structs
+// 1. tag, no typedef
+// 2. no tag, typedef
+// 3. tag and typedef, but different
+// 4. tag and typedef, identical
+        struct struct1 { int a; };
+typedef struct         { int a; } struct2;
+typedef struct struct3 { int a; } struct3_t;
+typedef struct struct4 { int a; } struct4;
+
+void struct_typedef1(struct2   *s, MC x);
+void struct_typedef2(struct3_t *s, MC x);
+void struct_typedef3(struct4   *s, MC x);
+
+void struct_name1(struct struct1 *s, MC x);
+void struct_name2(struct struct3 *s, MC x);
+void struct_name3(struct struct4 *s, MC x);
diff --git a/test-artefacts/headers/golden/macros/macro_redefines_global.h b/test-artefacts/headers/golden/macros/macro_redefines_global.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_redefines_global.h
@@ -0,0 +1,15 @@
+/*
+ * Declaration of a macro of the same name as an existing global variable
+ *
+ * Found this case in the wild in <stdio.h>
+ */
+
+typedef int FILE;
+
+extern FILE *const stdin;
+extern FILE *const stdout;
+extern FILE *const stderr;
+
+#define stdin  (stdin)
+#define stdout (stdout)
+#define stderr (stderr)
diff --git a/test-artefacts/headers/golden/macros/macro_resolution_log_level.h b/test-artefacts/headers/golden/macros/macro_resolution_log_level.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_resolution_log_level.h
@@ -0,0 +1,7 @@
+// See https://github.com/well-typed/hs-bindgen/issues/2147.
+//
+// A macro naming an undeclared tagged type fails name resolution. Such failures
+// are common in real headers (e.g. preprocessor-only builtin operators), so
+// they are reported at Info level by default; EnableMacroWarnings raises them
+// to Warning.
+#define UNRESOLVED_MACRO struct DoesNotExist
diff --git a/test-artefacts/headers/golden/macros/macro_strings.h b/test-artefacts/headers/golden/macros/macro_strings.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_strings.h
@@ -0,0 +1,37 @@
+// -------------------------------
+
+// Character literals
+#define C1 'a'
+#define C2 '"'
+#define C3 '\t'
+#define C4 '\0'
+#define C5 '\''
+#define C6 '\?'
+#define C7 '\123' // S
+#define C8 '\x53' // S
+
+#define D '\777'
+
+#define J1 'あ'
+#define J2 '\u3042'
+#define J3 '\xE3\x81\x82'
+
+// String literals
+#define S1 "a"
+#define S2 "'"
+#define S3 "\t"
+#define S4 "\0"
+#define S5 "\'"
+#define S6 "\?"
+#define S7 "\123" // S
+#define S8 "\x53" // S
+
+#define T1 "あ"
+#define T2 "\u3042"
+#define T3 "\xE3\x81\x82"
+
+#define U "\777\777\777\777"
+#define V "\1\2\3\4\5\6"
+
+#define W1 "hij\0"
+#define W2 "abc\0def\0g"
diff --git a/test-artefacts/headers/golden/macros/macro_type_ptr_qualifiers.h b/test-artefacts/headers/golden/macros/macro_type_ptr_qualifiers.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_type_ptr_qualifiers.h
@@ -0,0 +1,17 @@
+// Pointer-to-void is a valid macro type (even though bare void is not)
+#define PtrToVoid void *
+
+// const void * is also valid (pointer to const void)
+#define PtrToConstVoidL const void *
+
+// void const * is also valid (pointer to const void)
+#define PtrToConstVoidR void const *
+
+// Pointer to const int (const qualifies the pointee)
+#define PtrToConstIntL const int *
+
+// Pointer to const int (const qualifies the pointee)
+#define PtrToConstIntR int const *
+
+// Const pointer to int (const qualifies the pointer itself)
+#define ConstPtrToInt int *const
diff --git a/test-artefacts/headers/golden/macros/macro_type_unresolved_tagged.h b/test-artefacts/headers/golden/macros/macro_type_unresolved_tagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_type_unresolved_tagged.h
@@ -0,0 +1,12 @@
+// Struct whose parse fails because of an unsupported field type (long double).
+// As a result it is absent from the declaration environment, so the macros
+// below trigger name resolution errors.
+struct Unparsable {
+  long double x;
+};
+
+#define PTR_UNPARSABLE struct Unparsable *
+
+#define PTR_DOES_NOT_EXIST struct DoesNotExist *
+
+#define DOES_NOT_EXIST struct DoesNotExist
diff --git a/test-artefacts/headers/golden/macros/macro_type_void.h b/test-artefacts/headers/golden/macros/macro_type_void.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_type_void.h
@@ -0,0 +1,3 @@
+// We should ignore this macro 
+// (`void` does not make sense as a top-level type)
+#define MyVoid void
diff --git a/test-artefacts/headers/golden/macros/macro_typedef_struct.h b/test-artefacts/headers/golden/macros/macro_typedef_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_typedef_struct.h
@@ -0,0 +1,6 @@
+#define MY_TYPE int
+
+typedef struct {
+  int x;
+  MY_TYPE y;
+} bar;
diff --git a/test-artefacts/headers/golden/macros/macro_types.h b/test-artefacts/headers/golden/macros/macro_types.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macro_types.h
@@ -0,0 +1,16 @@
+// Ptr CInt
+#define PtrInt int*
+#define ShortInt short int
+#define SignedShortInt signed short int
+#define UnsignedShortInt unsigned short int
+
+// Ptr (Ptr CChar)
+#define PtrPtrChar char**
+
+// Reparsing typedefs
+#define MTy float
+typedef MTy tty;
+
+#define UINT8_T unsigned char
+#define BOOLEAN_T UINT8_T
+typedef BOOLEAN_T boolean_T;
diff --git a/test-artefacts/headers/golden/macros/macros.h b/test-artefacts/headers/golden/macros/macros.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/macros.h
@@ -0,0 +1,50 @@
+#define OBJECTLIKE1 1
+#define OBJECTLIKE2 ( 2 )
+#define OBJECTLIKE3 3 + 3
+#define OBJECTLIKE4 ( 4 + 4 )
+
+#define MEANING_OF_LIFE1 42
+#define MEANING_OF_LIFE2 052
+#define MEANING_OF_LIFE3 0x2a
+#define MEANING_OF_LIFE4 0X2A
+#define MEANING_OF_LIFE5 0b101010
+
+#define LONG_INT_TOKEN1 18446744073709550592ull
+#define LONG_INT_TOKEN2 18'446'744'073'709'550'592llu
+#define LONG_INT_TOKEN3 1844'6744'0737'0955'0592uLL
+#define LONG_INT_TOKEN4 184467'440737'0'95505'92LLU
+
+#define TUPLE1 ( 1 , 2 )
+#define TUPLE2 3 , 4
+#define TUPLE3 5, 6
+
+// ---
+// https://en.cppreference.com/w/cpp/language/floating_literal
+// (1)
+#define FLT1_1 11e4
+#define FLT1_2 12E-3
+#define FLT1_3 13e-03f
+// (2)
+#define FLT2_1 21.
+#define FLT2_2 22.e2
+#define FLT2_3 23.f
+// (3)
+#define FLT3_1 31.0
+#define FLT3_2 .32
+#define FLT3_3 .33e2
+#define FLT3_4 .34e-2f
+// (4)
+#define FLT4_1 0x41p4
+#define FLT4_2 0x42P-3
+#define FLT4_3 0x43p-03f
+// (5)
+#define FLT5_1 0x51.p0
+#define FLT5_2 0x52.P0f
+// (6)
+#define FLT6_1 0x61.0P2
+#define FLT6_2 0x.62p2
+#define FLT6_3 0x.63p-2f
+// ---
+
+#define BAD1 0.1 + 1
+#define BAD2 2l * 2ul
diff --git a/test-artefacts/headers/golden/macros/object_like_as_function_like.h b/test-artefacts/headers/golden/macros/object_like_as_function_like.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/object_like_as_function_like.h
@@ -0,0 +1,14 @@
+// F is a function-like macro definition while G is an object-like macro
+// definition. The difference is in the whitespace between the identifier and
+// the opening parenthesis. hs-bindgen used to treat F and G both as
+// function-like macro definitions, which was wrong. Now only F is considered
+// function-like. See issue #1903:
+// <https://github.com/well-typed/hs-bindgen/issues/1903>
+//
+// <https://en.cppreference.com/w/cpp/preprocessor/replace.html>
+
+#define F(x, y) x + y
+#define G (x, y) x + y
+
+int a = F(3, 5);
+// int b = G(4, 2); // does not work!
diff --git a/test-artefacts/headers/golden/macros/parse/elaborate.h b/test-artefacts/headers/golden/macros/parse/elaborate.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/elaborate.h
@@ -0,0 +1,13 @@
+// Elaborate version.
+
+// Test that macros defined in outer header are visible in inner header which is
+// included _after_ the macro was defined in the outer header. See issue
+// https://github.com/well-typed/hs-bindgen/issues/1699.
+
+#define OUTER_A 1
+typedef int outer_int;
+
+#include "elaborate_inner.h"
+
+#define OUTER_B INNER_A
+#define OUTER_C INNER_B
diff --git a/test-artefacts/headers/golden/macros/parse/elaborate_inner.h b/test-artefacts/headers/golden/macros/parse/elaborate_inner.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/elaborate_inner.h
@@ -0,0 +1,3 @@
+#define INNER_A OUTER_A
+#define INNER_B 2
+typedef outer_int inner_int;
diff --git a/test-artefacts/headers/golden/macros/parse/first_parse_then_typecheck.h b/test-artefacts/headers/golden/macros/parse/first_parse_then_typecheck.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/first_parse_then_typecheck.h
@@ -0,0 +1,10 @@
+// These macros are defined in the "wrong" order. We have to sort them before we
+// can type check them.
+
+// This simple test checks that we first parse macro types and expressions, sort
+// them, and then type check macros later.
+#define ValueB ValueA
+#define ValueA 1
+
+#define TypeB TypeA
+#define TypeA int
diff --git a/test-artefacts/headers/golden/macros/parse/intermittent_include.h b/test-artefacts/headers/golden/macros/parse/intermittent_include.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/intermittent_include.h
@@ -0,0 +1,19 @@
+// Test that we sort macros into source order even with intermittent includes.
+
+// (At the moment, we do not perform any output sorting, and the generated
+// bindings are in dependency order, with inner includes sorted before other
+// declarations).
+
+#define M1 T1
+
+typedef int T1;
+
+#define M2 T1
+
+#include "intermittent_include_inner.h"
+
+#define M3 T2
+
+typedef int T2;
+
+#define M4 T2
diff --git a/test-artefacts/headers/golden/macros/parse/intermittent_include_conditional.h b/test-artefacts/headers/golden/macros/parse/intermittent_include_conditional.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/intermittent_include_conditional.h
@@ -0,0 +1,11 @@
+typedef int T1;
+
+#define FOO 1
+#include "intermittent_include_conditional_inner.h"
+
+typedef int T3;
+
+#define FOO 2
+#include "intermittent_include_conditional_inner.h"
+
+typedef int T5;
diff --git a/test-artefacts/headers/golden/macros/parse/intermittent_include_conditional_inner.h b/test-artefacts/headers/golden/macros/parse/intermittent_include_conditional_inner.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/intermittent_include_conditional_inner.h
@@ -0,0 +1,7 @@
+#if FOO == 1
+typedef float T2;
+#endif
+
+#if FOO == 2
+typedef double T4;
+#endif
diff --git a/test-artefacts/headers/golden/macros/parse/intermittent_include_inner.h b/test-artefacts/headers/golden/macros/parse/intermittent_include_inner.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/intermittent_include_inner.h
@@ -0,0 +1,3 @@
+#define Ma Ta
+
+typedef int Ta;
diff --git a/test-artefacts/headers/golden/macros/parse/macro_typedef_scope.h b/test-artefacts/headers/golden/macros/parse/macro_typedef_scope.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/macro_typedef_scope.h
@@ -0,0 +1,7 @@
+// Check that the appropriate typedefs are in scope as we parse macros. This
+// depends on processing macros in source order (rather than all at the start).
+
+#define M1 int
+typedef M1 T2;
+#define M3 T2
+typedef M3 T4;
diff --git a/test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple.h b/test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple.h
@@ -0,0 +1,37 @@
+// Macro and typedef scope example (M1 M3 T2 T4) in two files.
+
+// This test checks that the declarations of multiple includes in one file are
+// sorted in the correct order.
+
+// Declarations of "inner1.h" need to be sorted before declarations of
+// "inner2.h". If this is not the case, reparse of `T2` fails, and we create
+// wrong (albeit functional) bindings. The detailed reasons are:
+//
+// Header "inner1.h" defines
+//
+// #define M1 int
+// typedef M1 T2;
+//
+// Header "inner2.h" defines
+//
+// #define M3 T2
+// typedef M3 T4;
+//
+// 1. We parse the declaration and the order of parse results is: M1 M3 T2 T4.
+//
+// 2. When we construct the use-decl graph, we sort the declarations according
+// to our "order map" obtained from the include graph. In an older revision, the
+// order map sorted sibling includes in reverse order (i.e., "inner2.h" before
+// "inner1.h"): M3 T4 M1 T2.
+//
+// 3. We detect a dependency of M3 on T2, moving T2 before M3: T2 M3 T4 M1.
+//
+// 4. We fail to reparse T2, because it depends on M1, a fact that we _can not
+// detect_ before reparse.
+//
+// After fixing `topSort'`, the order after 2. is M1 T2 M3 T4, and the test
+// passes.
+
+#include "macro_typedef_scope_multiple_inner1.h"
+
+#include "macro_typedef_scope_multiple_inner2.h"
diff --git a/test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner1.h b/test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner1.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner1.h
@@ -0,0 +1,2 @@
+#define M1 int
+typedef M1 T2;
diff --git a/test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner2.h b/test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner2.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/macro_typedef_scope_multiple_inner2.h
@@ -0,0 +1,2 @@
+#define M3 T2
+typedef M3 T4;
diff --git a/test-artefacts/headers/golden/macros/parse/simple.h b/test-artefacts/headers/golden/macros/parse/simple.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/simple.h
@@ -0,0 +1,9 @@
+// Simple version.
+
+// Test that macros defined in outer header are visible in inner header which is
+// included _after_ the macro was defined in the outer header. See issue
+// https://github.com/well-typed/hs-bindgen/issues/1699.
+
+#define OUTER_A 1
+
+#include "simple_inner.h"
diff --git a/test-artefacts/headers/golden/macros/parse/simple_inner.h b/test-artefacts/headers/golden/macros/parse/simple_inner.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/parse/simple_inner.h
@@ -0,0 +1,1 @@
+#define INNER_A OUTER_A
diff --git a/test-artefacts/headers/golden/macros/redeclaration/def_undef_def.h b/test-artefacts/headers/golden/macros/redeclaration/def_undef_def.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/def_undef_def.h
@@ -0,0 +1,7 @@
+// Two _different_ declarations of the same macro T, but with an undef in
+// between.
+#define T int
+void foo (T x);
+#undef T
+#define T char
+void bar (T x);
diff --git a/test-artefacts/headers/golden/macros/redeclaration/different.h b/test-artefacts/headers/golden/macros/redeclaration/different.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/different.h
@@ -0,0 +1,5 @@
+// Two _different_ declarations of the same macro T.
+#define T int
+void foo (T x);
+#define T char
+void bar (T x);
diff --git a/test-artefacts/headers/golden/macros/redeclaration/different_value.h b/test-artefacts/headers/golden/macros/redeclaration/different_value.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/different_value.h
@@ -0,0 +1,4 @@
+// Two _different_ declarations of the same macro
+// This should result in a warning
+#define A 1
+#define A 2
diff --git a/test-artefacts/headers/golden/macros/redeclaration/identical_semantics.h b/test-artefacts/headers/golden/macros/redeclaration/identical_semantics.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/identical_semantics.h
@@ -0,0 +1,5 @@
+// Two _semantically_ identical declarations of the same macro.
+#define T int
+void foo (T x);
+#define T int
+void bar (T x);
diff --git a/test-artefacts/headers/golden/macros/redeclaration/identical_syntax.h b/test-artefacts/headers/golden/macros/redeclaration/identical_syntax.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/identical_syntax.h
@@ -0,0 +1,10 @@
+// Two _syntactically_ identical declarations of the same macro T. Both
+// definitions expand to macro A, but macro A has a different definition in the
+// two cases.
+#define A int
+#define T A
+void foo (T x);
+#undef A
+#define A char
+#define T A
+void bar (T x);
diff --git a/test-artefacts/headers/golden/macros/redeclaration/identical_value.h b/test-artefacts/headers/golden/macros/redeclaration/identical_value.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/identical_value.h
@@ -0,0 +1,4 @@
+// Two identical declarations of the same macro
+// This should _NOT_ result in any error or warnings.
+#define A 5
+#define A 5
diff --git a/test-artefacts/headers/golden/macros/redeclaration/main_header.h b/test-artefacts/headers/golden/macros/redeclaration/main_header.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/main_header.h
@@ -0,0 +1,5 @@
+// V is defined identically in an included header and in this main header. The
+// definition in the main header is kept, so the default selection predicate
+// selects V.
+#include "main_header_inner.h"
+#define V 3
diff --git a/test-artefacts/headers/golden/macros/redeclaration/main_header_inner.h b/test-artefacts/headers/golden/macros/redeclaration/main_header_inner.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/main_header_inner.h
@@ -0,0 +1,2 @@
+// Not a main header; see main_header.h.
+#define V 3
diff --git a/test-artefacts/headers/golden/macros/redeclaration/noguard.h b/test-artefacts/headers/golden/macros/redeclaration/noguard.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/noguard.h
@@ -0,0 +1,4 @@
+// A header without include guard, included twice. Both definitions of G come
+// from the same line; they are identical, so G is a benign redefinition.
+#include "noguard_inner.h"
+#include "noguard_inner.h"
diff --git a/test-artefacts/headers/golden/macros/redeclaration/noguard_inner.h b/test-artefacts/headers/golden/macros/redeclaration/noguard_inner.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/noguard_inner.h
@@ -0,0 +1,2 @@
+// No include guard; see noguard.h.
+#define G 9
diff --git a/test-artefacts/headers/golden/macros/redeclaration/same_line_tag_field.h b/test-artefacts/headers/golden/macros/redeclaration/same_line_tag_field.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/same_line_tag_field.h
@@ -0,0 +1,16 @@
+// Regression test: a macro expansion in the struct *tag* must not be
+// mis-attributed to a *field* that happens to be on the same source line.
+//
+// `A` is defined twice (differently, with an `#undef` in between, which
+// hs-bindgen does not see) and expands to the struct tag `S`; `B` expands to
+// the field type `int`. Both expansions sit on the same line. Reparse info is
+// attached to the field, not the struct, so only `B` should be recorded for the
+// field. Previously `SourceRangeMap` keyed lookups by line only, so the field
+// also picked up the ambiguous `A`, producing a spurious "expansion not unique"
+// warning and an "unknown type of expanded macro A" error. With column-precise
+// attribution the field sees only `B`.
+#define A R
+#undef A
+#define A S
+#define B int
+struct A {B x;};
diff --git a/test-artefacts/headers/golden/macros/redeclaration/variadic.h b/test-artefacts/headers/golden/macros/redeclaration/variadic.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/redeclaration/variadic.h
@@ -0,0 +1,7 @@
+// `A` is ambiguous (the `#undef` is invisible to hs-bindgen). In `ID`, `A` is a
+// parameter, so the expansion of `ID` does not depend on the macro `A`.
+#define A int
+#undef A
+#define A char
+#define ID(A, ...) A __VA_ARGS__
+typedef ID(const, int) T;
diff --git a/test-artefacts/headers/golden/macros/reparse.h b/test-artefacts/headers/golden/macros/reparse.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse.h
@@ -0,0 +1,281 @@
+#include <stddef.h>
+
+#define A int
+
+// Preliminaries
+
+struct some_struct {};
+union some_union {};
+enum some_enum { ENUM_A };
+
+/**
+ * Function declarations
+ */
+
+// Arguments
+
+void args_char1    (A arg1,          char arg2);
+void args_char2    (A arg1,   signed char arg2);
+void args_char3    (A arg1, unsigned char arg2);
+
+void args_short1   (A arg1,          short arg2);
+void args_short2   (A arg1,   signed short arg2);
+void args_short3   (A arg1, unsigned short arg2);
+
+void args_int1     (A arg1,          int arg2);
+void args_int2     (A arg1,   signed int arg2);
+void args_int3     (A arg1, unsigned int arg2);
+
+void args_long1    (A arg1,          long arg2);
+void args_long2    (A arg1,   signed long arg2);
+void args_long3    (A arg1, unsigned long arg2);
+
+void args_float    (A arg1, float  arg2);
+void args_double   (A arg1, double arg2);
+void args_bool1    (A arg1, _Bool  arg2);
+
+void args_struct   (A arg1, struct some_struct arg2);
+void args_union    (A arg1, union  some_union  arg2);
+void args_enum     (A arg1, enum   some_enum   arg2);
+
+void args_pointer1 (A arg1, int  *  arg2);
+void args_pointer2 (A arg1, int  ** arg2);
+void args_pointer3 (A arg1, void *  arg3);
+
+// Different return types
+
+A ret_A();
+
+         char      ret_char1    (A arg1);
+  signed char      ret_char2    (A arg1);
+unsigned char      ret_char3    (A arg1);
+
+         short     ret_short1   (A arg1);
+  signed short     ret_short2   (A arg1);
+unsigned short     ret_short3   (A arg1);
+
+         int       ret_int1     (A arg1);
+  signed int       ret_int2     (A arg1);
+unsigned int       ret_int3     (A arg1);
+
+         long      ret_long1    (A arg1);
+  signed long      ret_long2    (A arg1);
+unsigned long      ret_long3    (A arg1);
+
+float              ret_float    (A arg1);
+double             ret_double   (A arg1);
+_Bool              ret_bool1    (A arg1);
+
+struct some_struct ret_struct   (A arg1);
+union  some_union  ret_union    (A arg1);
+enum   some_enum   ret_enum     (A arg1);
+
+int  *             ret_pointer1 (A arg1);
+int  **            ret_pointer2 (A arg1);
+void *             ret_pointer3 (A arg1);
+
+// With function body
+
+int body1(A arg1) { return arg1; }
+A body2() { return 0; }
+
+// Complex numbers
+
+void args_complex_float  (A arg1, float  _Complex arg2);
+void args_complex_double (A arg1, double _Complex arg2);
+float  _Complex ret_complex_float  (A arg1);
+double _Complex ret_complex_double (A arg1);
+
+// Bespoke types
+//
+// These are types that the language_c parser does not recognize; we add them
+// as explicit entries into the type environment.
+
+void bespoke_args1 (A arg1, bool   arg2);
+void bespoke_args2 (A arg1, size_t arg2);
+
+bool   bespoke_ret1 (A arg1);
+size_t bespoke_ret2 (A arg1);
+
+/**
+ * Arrays
+ */
+
+void arr_args1(A  arg1[]);
+void arr_args2(A* arg1[]);
+void arr_args3(A  arg1[5]);
+void arr_args4(A* arg1[5]);
+
+typedef A   arr_typedef1[];
+typedef A*  arr_typedef2[];
+typedef A   arr_typedef3[5];
+typedef A*  arr_typedef4[5];
+
+/**
+ * Typedefs
+ */
+
+typedef A    typedef1;
+typedef A *  typedef2;
+typedef A ** typedef3;
+
+/**
+ * Function pointers
+ */
+
+void funptr_args1 (A arg1,  void (*arg2)());
+void funptr_args2 (A arg1,  int  (*arg2)());
+void funptr_args3 (A arg1,  void (*arg2)(int));
+void funptr_args4 (A arg1,  char (*arg2)(int, double));
+void funptr_args5 (A arg1,  int* (*arg2)(int, double));
+
+typedef A    (*funptr_typedef1)();
+typedef A *  (*funptr_typedef2)();
+typedef A ** (*funptr_typedef3)();
+typedef A    (*funptr_typedef4)(int, double);
+typedef A *  (*funptr_typedef5)(int, double);
+
+/**
+ * Comments in awkward places
+ *
+ * (Prior to language-c we failed to parse there.)
+ */
+
+void /* some comment */ comments1(A arg1);
+typedef A /* some comment */ comments2;
+
+/**
+ * Struct fields
+ */
+
+struct example_struct {
+  A    field1;
+  A *  field2;
+  A ** field3;
+};
+
+/**
+ * Globals and constants
+ */
+
+extern A    global1;
+extern A *  global2;
+extern A ** global3;
+
+extern A    const const1;
+extern A *  const const2;
+extern A ** const const3;
+
+/**
+ * `const` qualifier
+ *
+ * NOTE: These were not parsed correctly prior to the switch to language-c.
+ */
+
+// Types with a sign
+
+void const_prim_before1 (A arg1, const          char arg2);
+void const_prim_before2 (A arg1, const   signed char arg2);
+void const_prim_before3 (A arg1, const unsigned char arg2);
+void const_prim_after1  (A arg1,          char const arg2);
+void const_prim_after2  (A arg1,   signed char const arg2);
+void const_prim_after3  (A arg1, unsigned char const arg2);
+
+// Types without a sign
+
+void const_withoutSign_before1 (A arg1, const float              arg2);
+void const_withoutSign_before2 (A arg1, const double             arg2);
+void const_withoutSign_before3 (A arg1, const _Bool              arg2);
+void const_withoutSign_before4 (A arg1, const struct some_struct arg2);
+void const_withoutSign_before5 (A arg1, const union  some_union  arg2);
+void const_withoutSign_before6 (A arg1, const enum   some_enum   arg2);
+void const_withoutSign_before7 (A arg1, const bool               arg2);
+void const_withoutSign_before8 (A arg1, const size_t             arg2);
+
+void const_withoutSign_after1 (A arg1, float              const arg2);
+void const_withoutSign_after2 (A arg1, double             const arg2);
+void const_withoutSign_after3 (A arg1, _Bool              const arg2);
+void const_withoutSign_after4 (A arg1, struct some_struct const arg2);
+void const_withoutSign_after5 (A arg1, union  some_union  const arg2);
+void const_withoutSign_after6 (A arg1, enum   some_enum   const arg2);
+void const_withoutSign_after7 (A arg1, bool               const arg2);
+void const_withoutSign_after8 (A arg1, size_t             const arg2);
+
+// Pointers
+
+void const_pointers_args1 (A arg1, const int * arg2);
+void const_pointers_args2 (A arg1, int const * arg2);
+void const_pointers_args3 (A arg1, int * const arg2);
+void const_pointers_args4 (A arg1, const int * const arg2);
+void const_pointers_args5 (A arg1, int const * const arg2);
+
+const int *       const_pointers_ret1 (A arg1);
+int const *       const_pointers_ret2 (A arg1);
+int * const       const_pointers_ret3 (A arg1);
+const int * const const_pointers_ret4 (A arg1);
+int const * const const_pointers_ret5 (A arg1);
+
+typedef const A         const_typedef1;
+typedef A const         const_typedef2;
+typedef const A *       const_typedef3;
+typedef A const *       const_typedef4;
+typedef A * const       const_typedef5;
+typedef const A * const const_typedef6;
+typedef A const * const const_typedef7;
+
+struct example_struct_with_const {
+  const A         const_field1;
+  A const         const_field2;
+  const A *       const_field3;
+  A const *       const_field4;
+  A * const       const_field5;
+  const A * const const_field6;
+  A const * const const_field7;
+};
+
+typedef const A         (*const_funptr1)(int, double);
+typedef A const         (*const_funptr2)(int, double);
+typedef const A *       (*const_funptr3)(int, double);
+typedef A const *       (*const_funptr4)(int, double);
+typedef A * const       (*const_funptr5)(int, double);
+typedef const A * const (*const_funptr6)(int, double);
+typedef A const * const (*const_funptr7)(int, double);
+
+void const_array_elem1(A const   arg1[]);
+void const_array_elem2(A const * arg1[]);
+void const_array_elem3(A * const arg1[]);
+
+/**
+ * Other examples we reparsed /incorrectly/ before language-c
+ */
+
+// Explicitly empty parameter list
+
+A noParams1(void);
+A noParams2(void) { return 0; }
+void noParams3(A arg1, int (*arg2)(void));
+
+// Returning function pointers
+
+void (*funptr_ret1(A arg1)) ();
+int  (*funptr_ret2(A arg1)) ();
+void (*funptr_ret3(A arg1)) (int);
+char (*funptr_ret4(A arg1)) (int, double);
+
+// Returning function pointers to functions that themselves return pointers
+
+int*             (*funptr_ret5(A arg1))  (int, double);
+const int*       (*funptr_ret6(A arg1))  (int, double);
+int const*       (*funptr_ret7(A arg1))  (int, double);
+int* const       (*funptr_ret8(A arg1))  (int, double);
+const int* const (*funptr_ret9(A arg1))  (int, double);
+int const* const (*funptr_ret10(A arg1)) (int, double);
+
+/**
+ * Macro-defined types
+ */
+
+#define BOOL  _Bool
+#define INT   int
+#define INTP  int*
+#define INTCP const int* const
diff --git a/test-artefacts/headers/golden/macros/reparse/arithmetic_types.h b/test-artefacts/headers/golden/macros/reparse/arithmetic_types.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/arithmetic_types.h
@@ -0,0 +1,60 @@
+// The goal of this test is to test that the reparse pass parses primitive type
+// (arithmetic types in the C reference) correctly. The reparser is triggered by
+// the use of the A macro in the functions below, which should produce function
+// types for f1 up to and include f29 that went through the reparser.
+//
+// Previously, the reparser was producing the wrong types (see issue #1685) in
+// some come cases. This test should guard against reintroducing that bug in the
+// future.
+//
+// <https://github.com/well-typed/hs-bindgen/issues/1685>
+
+
+/* -------------------------------------------------------------------------- */
+/* Macro */
+
+#define A int
+
+/* -------------------------------------------------------------------------- */
+/* Character types */
+
+A f1(char x);
+A f2(signed char x);
+A f3(unsigned char x);
+
+/* -------------------------------------------------------------------------- */
+/* Integer types */
+
+A f4(short x);
+A f5(short int x);
+A f6(signed short x);
+A f7(signed short int x);
+A f8(unsigned short x);
+A f9(unsigned short int x);
+
+A f10(int x);
+A f11(signed x);
+A f12(signed int x);
+A f13(unsigned x);
+A f14(unsigned int x);
+
+A f15(long x);
+A f16(long int x);
+A f17(signed long x);
+A f18(signed long int x);
+A f19(unsigned long x);
+A f20(unsigned long int x);
+
+A f21(long long x);
+A f22(long long int x);
+A f23(signed long long x);
+A f24(signed long long int x);
+A f25(unsigned long long x);
+A f26(unsigned long long int x);
+
+/* -------------------------------------------------------------------------- */
+/* Real floating types */
+
+A f27(float x);
+A f28(double x);
+A f29(long double x);
diff --git a/test-artefacts/headers/golden/macros/reparse/cref_attributes.h b/test-artefacts/headers/golden/macros/reparse/cref_attributes.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/cref_attributes.h
@@ -0,0 +1,12 @@
+// simple case
+#define BOOL int
+void foo(BOOL);
+
+// attributes using C reference syntax
+[[gnu::visibility("default")]] void bar(BOOL);
+// void [[gnu::visibility("default")]] dash(BOOL); // not allowed!
+
+// attributes using C reference syntax in a macro definition
+#define EXPORT [[gnu::visibility("default")]]
+EXPORT void quux (BOOL);
+// void EXPORT heq(BOOL); // not allowed!
diff --git a/test-artefacts/headers/golden/macros/reparse/defer_wrong.h b/test-artefacts/headers/golden/macros/reparse/defer_wrong.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/defer_wrong.h
@@ -0,0 +1,16 @@
+/*
+In case a typedef references another type, we defer reparsing to the referenced
+type. This was done to resolve issue #707. However, it now turns out that this
+introduced a new bug. A typedef may reference a struct indirectly via a macro
+type, in which case we need to reparse the typedef to insert a referene to the
+macro type.
+
+<https://github.com/well-typed/hs-bindgen/issues/707>
+*/
+
+struct S { int x; }; // CORRECT: data S = ...
+
+#define T struct S // CORRECT: newtype T = T S
+
+typedef T foo; // WRONG: newtype Foo = Foo S
+typedef T * bar; // CORRECT: newtype Bar = Bar (Ptr T)
diff --git a/test-artefacts/headers/golden/macros/reparse/end_in_macro_arg.h b/test-artefacts/headers/golden/macros/reparse/end_in_macro_arg.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/end_in_macro_arg.h
@@ -0,0 +1,23 @@
+/*
+ * Declarations ending in a macro argument
+ *
+ * The expansion location of the last token of each declaration is the start of
+ * the macro invocation; reparsing has to tokenise up to its end.
+ */
+
+#define T int
+#define U int
+#define PARAMS(args) args
+#define ID(x) x
+
+T f PARAMS((T a));
+
+typedef T A ID([3]);
+
+struct S { T x ID([3]); };
+
+/* The only use of U is in the argument */
+int g PARAMS((U a));
+
+/* Ends right before an invocation, not in it */
+T arr[3]ID(;)
diff --git a/test-artefacts/headers/golden/macros/reparse/functions.h b/test-artefacts/headers/golden/macros/reparse/functions.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/functions.h
@@ -0,0 +1,19 @@
+#define ID(X) (X)
+#define MY_INT int
+
+// We fail to reparse `foo`:
+//
+// The symbol `x' does not fit here.
+void foo(int ID(x));
+
+static inline int bar(int x) {
+  int y = 10;
+  return ID(y);
+}
+
+extern int baz(int x) {
+  int y = 10;
+  return ID(y);
+}
+
+typedef MY_INT my_int_t;
diff --git a/test-artefacts/headers/golden/macros/reparse/gnu_attributes.h b/test-artefacts/headers/golden/macros/reparse/gnu_attributes.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/gnu_attributes.h
@@ -0,0 +1,12 @@
+// simple case
+#define BOOL int
+void foo(BOOL);
+
+// attributes using GNU syntax
+__attribute__ ((visibility("default"))) void bar(BOOL);
+void __attribute__ ((visibility("default"))) dash(BOOL);
+
+// attributes using GNU syntax in a macro definition
+#define EXPORT __attribute__ ((visibility("default")))
+EXPORT void quux(BOOL);
+void EXPORT heq(BOOL);
diff --git a/test-artefacts/headers/golden/macros/reparse/nesting.h b/test-artefacts/headers/golden/macros/reparse/nesting.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/nesting.h
@@ -0,0 +1,7 @@
+#define MyInt int
+
+// reparsing works the same regardless of whether the nested declaration is
+// named or unnamed
+typedef struct TS1 { MyInt x; } T2;
+typedef struct TS3 { MyInt x; } T3;
+typedef struct     { MyInt x; } T4;
diff --git a/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_struct.h b/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_struct.h
@@ -0,0 +1,5 @@
+#define MyInt int
+
+struct { struct { MyInt x; }    x; } T1;
+struct { struct { MyInt x; } *  x; } T2;
+struct { struct { MyInt x; } ** x; } T3;
diff --git a/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_typedef.h b/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_typedef.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_typedef.h
@@ -0,0 +1,5 @@
+#define MyInt int
+
+typedef struct { MyInt x; }    T1;
+typedef struct { MyInt x; } *  T2;
+typedef struct { MyInt x; } ** T3;
diff --git a/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_union.h b/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_union.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_union.h
@@ -0,0 +1,5 @@
+#define MyInt int
+
+union { struct { MyInt x; }    x; } T1;
+union { struct { MyInt x; } *  x; } T2;
+union { struct { MyInt x; } ** x; } T3;
diff --git a/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_variable.h b/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_variable.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/nesting/struct_in_variable.h
@@ -0,0 +1,5 @@
+#define MyInt int
+
+struct { MyInt x; }    G1;
+struct { MyInt x; } *  G2;
+struct { MyInt x; } ** G3;
diff --git a/test-artefacts/headers/golden/macros/reparse/nesting/union_in_struct.h b/test-artefacts/headers/golden/macros/reparse/nesting/union_in_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/nesting/union_in_struct.h
@@ -0,0 +1,5 @@
+#define MyInt int
+
+struct { union { MyInt x; }    x; } T1;
+struct { union { MyInt x; } *  x; } T2;
+struct { union { MyInt x; } ** x; } T3;
diff --git a/test-artefacts/headers/golden/macros/reparse/nesting/union_in_typedef.h b/test-artefacts/headers/golden/macros/reparse/nesting/union_in_typedef.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/nesting/union_in_typedef.h
@@ -0,0 +1,5 @@
+#define MyInt int
+
+typedef union { MyInt x; }    T1;
+typedef union { MyInt x; } *  T2;
+typedef union { MyInt x; } ** T3;
diff --git a/test-artefacts/headers/golden/macros/reparse/nesting/union_in_union.h b/test-artefacts/headers/golden/macros/reparse/nesting/union_in_union.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/nesting/union_in_union.h
@@ -0,0 +1,5 @@
+#define MyInt int
+
+union { union { MyInt x; }    x; } T1;
+union { union { MyInt x; } *  x; } T2;
+union { union { MyInt x; } ** x; } T3;
diff --git a/test-artefacts/headers/golden/macros/reparse/nesting/union_in_variable.h b/test-artefacts/headers/golden/macros/reparse/nesting/union_in_variable.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/reparse/nesting/union_in_variable.h
@@ -0,0 +1,5 @@
+#define MyInt int
+
+union { MyInt x; }    G1;
+union { MyInt x; } *  G2;
+union { MyInt x; } ** G3;
diff --git a/test-artefacts/headers/golden/macros/undef.h b/test-artefacts/headers/golden/macros/undef.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/undef.h
@@ -0,0 +1,5 @@
+// TODO <https://github.com/well-typed/hs-bindgen/issues/1956>: generated
+// bindings for undef-ed macros fail to compile
+#define T int
+void foo (T x);
+#undef T
diff --git a/test-artefacts/headers/golden/macros/wrong_source_location.h b/test-artefacts/headers/golden/macros/wrong_source_location.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/macros/wrong_source_location.h
@@ -0,0 +1,31 @@
+/* Regression test for issue #1860.
+ *
+ * `NestedUnnamed` (from the ticket) and `TwoUntaggedStructs` each expand to
+ * multiple unnamed declarations from a single macro invocation. libclang
+ * reports the same expansion location for all of them, so without spelling
+ * locations they would collide on the same UnnamedId.
+ *
+ * `NestedUnnamed` only collides on clang < 16 (newer clangs implicitly name
+ * the typedef'd outer struct). `TwoUntaggedStructs` collides on every clang
+ * version, since both inner structs are genuinely untagged.
+ */
+#define NestedUnnamed(t1, n1, t2) \
+  typedef t1 {                    \
+    t2 {                          \
+      int fieldX;                 \
+    } fieldY;                     \
+  } n1;
+
+NestedUnnamed(struct, UU1, struct)
+
+NestedUnnamed(struct, UU2, struct)
+
+#define TwoUntaggedStructs(name)         \
+  struct name {                     \
+    struct { int a; } fieldA;       \
+    struct { int b; } fieldB;       \
+  };
+
+TwoUntaggedStructs(VV1)
+
+TwoUntaggedStructs(VV2)
diff --git a/test-artefacts/headers/golden/manual/zero_copy.h b/test-artefacts/headers/golden/manual/zero_copy.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/manual/zero_copy.h
@@ -0,0 +1,85 @@
+#pragma once
+
+#include <stdint.h>
+
+/*
+ * Zero-copy bindings
+ */
+
+/* -------------------------------------------------------------------------- */
+/* Structs */
+
+struct point {
+  int x;
+  int y;
+};
+
+struct rectangle {
+  struct point topleft;
+  struct point bottomright;
+};
+
+struct circle {
+  struct point midpoint;
+  int radius;
+};
+
+/* -------------------------------------------------------------------------- */
+/* Unions */
+
+union shape {
+  struct rectangle rectangle;
+  struct circle circle;
+};
+
+/* -------------------------------------------------------------------------- */
+/* Bit-fields */
+
+// These bit-widths are completely arbitrarily chosen for illustratory purposes
+struct colour {
+  unsigned int opacity : 2;
+  unsigned int brightness : 3;
+  unsigned int red : 8;
+  unsigned int green : 8;
+  unsigned int blue : 8;
+};
+
+/* -------------------------------------------------------------------------- */
+/* Typedefs */
+
+typedef int myInt;
+
+/* -------------------------------------------------------------------------- */
+/* Pointers */
+
+typedef struct drawing {
+  union shape* shape;
+  struct colour* colour;
+} drawing;
+
+/* -------------------------------------------------------------------------- */
+/* Arrays */
+
+typedef struct tic_tac_toe {
+  int row1[3];
+  int row2[3];
+  int row3[3];
+} tic_tac_toe;
+
+/* -------------------------------------------------------------------------- */
+/* FLAM */
+
+struct vector {
+  int len;
+  char data[];
+};
+
+int reverse (const struct vector * input, struct vector * output);
+
+/* -------------------------------------------------------------------------- */
+/* Multi-dimensional arrays (and typedefs) */
+
+typedef int triplet[3];
+typedef triplet matrix[3];
+
+void transpose (const matrix input, matrix output);
diff --git a/test-artefacts/headers/golden/program-analysis/circular_includes.h b/test-artefacts/headers/golden/program-analysis/circular_includes.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/circular_includes.h
@@ -0,0 +1,5 @@
+#ifndef INNER_H
+typedef int OUTER_BEFORE_CIRCULAR_INCLUDE;
+#include "circular_includes_inner.h"
+typedef int OUTER_AFTER_CIRCULAR_INCLUDE;
+#endif
diff --git a/test-artefacts/headers/golden/program-analysis/circular_includes_inner.h b/test-artefacts/headers/golden/program-analysis/circular_includes_inner.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/circular_includes_inner.h
@@ -0,0 +1,8 @@
+typedef int INNER_BEFORE_IFNDEF;
+#ifndef INNER_H
+#define INNER_H
+typedef int INNER_BEFORE_CIRCULAR_INCLUDE;
+#include "circular_includes.h"
+typedef int INNER_AFTER_CIRCULAR_INCLUDE;
+#endif
+typedef int INNER_AFTER_IFNDEF;
diff --git a/test-artefacts/headers/golden/program-analysis/circular_macro.h b/test-artefacts/headers/golden/program-analysis/circular_macro.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/circular_macro.h
@@ -0,0 +1,2 @@
+#define A B
+#define B A
diff --git a/test-artefacts/headers/golden/program-analysis/delay_traces.h b/test-artefacts/headers/golden/program-analysis/delay_traces.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/delay_traces.h
@@ -0,0 +1,26 @@
+// The following declarations are skipped when parsed, and, if selected, lead to
+// warnings.
+void long_double_function(long double);
+void var_arg_function(const char *fmt, ...);
+
+struct long_double_s {
+  long double x;
+  double y;
+};
+
+struct nested_long_double_s {
+  struct {
+    long double inner_int_member;
+  } inner_s_member;
+};
+
+struct nested_long_double_u {
+  union {
+    long double inner_int_member;
+  } inner_u_member;
+};
+
+// In the tests, we do not select these. No traces should be emitted.
+long double long_double_var1;
+long double long_double_var2;
+void long_double_fun(long double);
diff --git a/test-artefacts/headers/golden/program-analysis/program-slicing/macro_selected.h b/test-artefacts/headers/golden/program-analysis/program-slicing/macro_selected.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program-slicing/macro_selected.h
@@ -0,0 +1,10 @@
+#include "macro_selected_t.h"
+
+// T (see macro_selected_t.h) is selected as a transitive dependency of foo with program
+// slicing enabled
+void foo(T x);
+
+// We would expect that we generate bindings for foo and T in the same way as
+// generate them for U and bar
+#define U int
+void bar (U x);
diff --git a/test-artefacts/headers/golden/program-analysis/program-slicing/macro_selected_t.h b/test-artefacts/headers/golden/program-analysis/program-slicing/macro_selected_t.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program-slicing/macro_selected_t.h
@@ -0,0 +1,3 @@
+// T is selected as a transitive dependency of foo (see macro_selected.h) with program
+// slicing enabled
+#define T int
diff --git a/test-artefacts/headers/golden/program-analysis/program-slicing/macro_unselected.h b/test-artefacts/headers/golden/program-analysis/program-slicing/macro_unselected.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program-slicing/macro_unselected.h
@@ -0,0 +1,12 @@
+#include "macro_unselected_t.h"
+
+// T (see macro_t.h) is NOT selected as a transitive dependency of foo because
+// program slicing is disabled
+//
+// A warning message should also be printed that T is not selected due to a
+// missing transitive dependency on T
+void foo(T x);
+
+// We would expect that we generate bindings only for U and bar, not for T and foo
+#define U int
+void bar (U x);
diff --git a/test-artefacts/headers/golden/program-analysis/program-slicing/macro_unselected_t.h b/test-artefacts/headers/golden/program-analysis/program-slicing/macro_unselected_t.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program-slicing/macro_unselected_t.h
@@ -0,0 +1,3 @@
+// T is NOT selected, even though it is a transitive dependency of foo (see
+// macro_unselected.h) because program slicing is disabled
+#define T int
diff --git a/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_selected.h b/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_selected.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_selected.h
@@ -0,0 +1,10 @@
+#include "typedef_selected_t.h"
+
+// T (see typedef_selected_t.h) is selected as a transitive dependency of foo
+// with program slicing enabled
+void foo(T x);
+
+// We would expect that we generate bindings for foo and T in the same way as
+// generate them for U and bar
+#define U int
+void bar (U x);
diff --git a/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_selected_t.h b/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_selected_t.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_selected_t.h
@@ -0,0 +1,3 @@
+// T is selected as a transitive dependency of foo (see typedef_selected.h) with
+// program slicing enabled
+typedef int T;
diff --git a/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_unselected.h b/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_unselected.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_unselected.h
@@ -0,0 +1,12 @@
+#include "typedef_unselected_t.h"
+
+// T (see typedef_unselected_t.h) is NOT selected as a transitive dependency of foo because
+// program slicing is disabled
+//
+// A warning message should also be printed that T is not selected due to a
+// missing transitive dependency on T
+void foo(T x);
+
+// We would expect that we generate bindings only for U and bar, not for T and foo
+#define U int
+void bar (U x);
diff --git a/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_unselected_t.h b/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_unselected_t.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program-slicing/typedef_unselected_t.h
@@ -0,0 +1,3 @@
+// T is NOT selected, even though it is a transitive dependency of foo (see
+// typedef_unselected.h) because program slicing is disabled
+typedef int T;
diff --git a/test-artefacts/headers/golden/program-analysis/program_slicing_selection.h b/test-artefacts/headers/golden/program-analysis/program_slicing_selection.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program_slicing_selection.h
@@ -0,0 +1,26 @@
+#include <errno.h>  /* ENOENT, EACCES, ... */
+#include <stddef.h> /* size_t */
+#include <stdint.h> /* uint32_t, uint64_t */
+#include <stdio.h>  /* FILE */
+#include <time.h>   /* time_t */
+
+enum FileOperationStatus {
+  SUCCESS = 0,
+  NOT_FOUND = ENOENT,
+  PERMISSION_DENIED = EACCES,
+  INVALID_ARGUMENT = EINVAL,
+  OUT_OF_MEMORY = ENOMEM,
+  CUSTOM_ERROR_OTHER = -1
+};
+
+struct FileOperationRecord {
+  enum FileOperationStatus status;
+  size_t bytes_processed;
+};
+
+enum FileOperationStatus read_file_chunk(FILE *file_ptr, void *buffer,
+                                         size_t bytes_to_read);
+
+struct UnselectedStruct {
+  time_t time_t_should_not_be_in_fixtures;
+};
diff --git a/test-artefacts/headers/golden/program-analysis/program_slicing_simple.h b/test-artefacts/headers/golden/program-analysis/program_slicing_simple.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program_slicing_simple.h
@@ -0,0 +1,8 @@
+#include <stdint.h>
+
+struct foo {
+  uint64_t sixty_four;
+  uint32_t thirty_two;
+};
+
+int bar (uint64_t x, uint32_t y);
diff --git a/test-artefacts/headers/golden/program-analysis/program_slicing_simple.yaml b/test-artefacts/headers/golden/program-analysis/program_slicing_simple.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/program_slicing_simple.yaml
@@ -0,0 +1,26 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Foreign.C.Types
+ctypes:
+- headers: program-analysis/program_slicing_simple.h
+  cname: uint64_t
+  hsname: CULong
+hstypes:
+- hsname: CULong
+  representation: newtype
+  instances:
+  - Bits
+  - Bounded
+  - Enum
+  - Eq
+  - FiniteBits
+  - Integral
+  - Ix
+  - Num
+  - Ord
+  - Read
+  - Real
+  - Show
+  - Storable
+  - HasFFIType
diff --git a/test-artefacts/headers/golden/program-analysis/selection_bad.h b/test-artefacts/headers/golden/program-analysis/selection_bad.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_bad.h
@@ -0,0 +1,6 @@
+#include "selection_bad_size_t.h"
+
+#define A int
+
+// Use of macro here, so must be reparsed
+void f(A x, size_t y);
diff --git a/test-artefacts/headers/golden/program-analysis/selection_bad_size_t.h b/test-artefacts/headers/golden/program-analysis/selection_bad_size_t.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_bad_size_t.h
@@ -0,0 +1,2 @@
+// Bad programmer, bad
+typedef char *size_t;
diff --git a/test-artefacts/headers/golden/program-analysis/selection_fail.h b/test-artefacts/headers/golden/program-analysis/selection_fail.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_fail.h
@@ -0,0 +1,28 @@
+struct OkBefore {
+  int x;
+};
+
+// `struct Fail` can not be translated because it contains a `long double`.
+struct Fail {
+  long double x;
+  // We are not aware that `struct Fail` depends on `struct OkBefore`, but that
+  // is not a problem, because we can not generate bindings for `struct Fail`
+  // anyways.
+  struct OkBefore y;
+};
+
+// Depend on `struct Fail` by value. We can not directly detect that a
+// dependency is missing.
+struct DependOnFailByValue {
+  struct Fail x;
+};
+
+// Depend on `struct Fail` by reference. We can not directly detect that a
+// dependency is missing.
+struct DependOnFailByReference {
+  struct Fail *x;
+};
+
+struct OkAfter {
+  int x;
+};
diff --git a/test-artefacts/headers/golden/program-analysis/selection_foo.h b/test-artefacts/headers/golden/program-analysis/selection_foo.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_foo.h
@@ -0,0 +1,5 @@
+#include "selection_foo_t.h"
+
+#define A foo_t
+
+A f();
diff --git a/test-artefacts/headers/golden/program-analysis/selection_foo_t.h b/test-artefacts/headers/golden/program-analysis/selection_foo_t.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_foo_t.h
@@ -0,0 +1,1 @@
+typedef long double foo_t;
diff --git a/test-artefacts/headers/golden/program-analysis/selection_matches_c_names.h b/test-artefacts/headers/golden/program-analysis/selection_matches_c_names.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_matches_c_names.h
@@ -0,0 +1,9 @@
+// Specifically  test that  selection predicates  match  against C  names, and
+// not against Haskell names  assigned by a prescriptive  binding specification.
+// See https://github.com/well-typed/hs-bindgen/issues/1518.
+
+int FunctionWithAssignedHaskellNameByNameMangler();
+
+struct StructWithAssignedHaskellNameByPrescriptiveBindingSpecs {
+  int x;
+};
diff --git a/test-artefacts/headers/golden/program-analysis/selection_matches_c_names.yaml b/test-artefacts/headers/golden/program-analysis/selection_matches_c_names.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_matches_c_names.yaml
@@ -0,0 +1,20 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- headers: program-analysis/selection_matches_c_names.h
+  cname: struct StructWithAssignedHaskellNameByPrescriptiveBindingSpecs
+  hsname: NewName
+hstypes:
+- hsname: NewName
+  representation:
+    record:
+      constructor: NewName
+      fields:
+      - newName_x
+  instances:
+  - Eq
+  - Prim
+  - Show
+  - Storable
diff --git a/test-artefacts/headers/golden/program-analysis/selection_merge_traces.h b/test-artefacts/headers/golden/program-analysis/selection_merge_traces.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_merge_traces.h
@@ -0,0 +1,11 @@
+struct X {
+  int x;
+};
+
+struct Y {
+  int y;
+};
+
+/* If we do not select X and Y, we want to get a _single_ trace: Could not
+   select `f` because ... (in contrast to getting two traces) */
+void dependsOnXAndY(struct X sx, struct Y sy);
diff --git a/test-artefacts/headers/golden/program-analysis/selection_omit_external.yaml b/test-artefacts/headers/golden/program-analysis/selection_omit_external.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_omit_external.yaml
@@ -0,0 +1,8 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- omit:
+    headers: program-analysis/selection_omit_external_root.h
+    cname: struct Omitted
diff --git a/test-artefacts/headers/golden/program-analysis/selection_omit_external_a.h b/test-artefacts/headers/golden/program-analysis/selection_omit_external_a.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_omit_external_a.h
@@ -0,0 +1,6 @@
+// Includes the root header, but does not use the omitted declaration.
+#include "selection_omit_external_root.h"
+
+struct UnrelatedDeclaration {
+  int m;
+};
diff --git a/test-artefacts/headers/golden/program-analysis/selection_omit_external_b.h b/test-artefacts/headers/golden/program-analysis/selection_omit_external_b.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_omit_external_b.h
@@ -0,0 +1,10 @@
+// Includes the root header, and uses the omitted declaration.
+#include "selection_omit_external_root.h"
+
+struct DirectlyDependsOnOmitted {
+  struct Omitted o;
+};
+
+struct IndirectlyDependsOnOmitted {
+  struct DirectlyDependsOnOmitted d;
+};
diff --git a/test-artefacts/headers/golden/program-analysis/selection_omit_external_root.h b/test-artefacts/headers/golden/program-analysis/selection_omit_external_root.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_omit_external_root.h
@@ -0,0 +1,3 @@
+struct Omitted {
+  int n;
+};
diff --git a/test-artefacts/headers/golden/program-analysis/selection_omit_prescriptive.h b/test-artefacts/headers/golden/program-analysis/selection_omit_prescriptive.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_omit_prescriptive.h
@@ -0,0 +1,11 @@
+struct Omitted {
+  int n;
+};
+
+struct DirectlyDependsOnOmitted {
+  struct Omitted o;
+};
+
+struct IndirectlyDependsOnOmitted {
+  struct DirectlyDependsOnOmitted d;
+};
diff --git a/test-artefacts/headers/golden/program-analysis/selection_omit_prescriptive.yaml b/test-artefacts/headers/golden/program-analysis/selection_omit_prescriptive.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_omit_prescriptive.yaml
@@ -0,0 +1,8 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: Example
+ctypes:
+- omit:
+    headers: program-analysis/selection_omit_prescriptive.h
+    cname: struct Omitted
diff --git a/test-artefacts/headers/golden/program-analysis/selection_squash_struct.h b/test-artefacts/headers/golden/program-analysis/selection_squash_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_squash_struct.h
@@ -0,0 +1,3 @@
+struct a {
+  int x;
+};
diff --git a/test-artefacts/headers/golden/program-analysis/selection_squash_typedef.h b/test-artefacts/headers/golden/program-analysis/selection_squash_typedef.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/selection_squash_typedef.h
@@ -0,0 +1,3 @@
+#include "selection_squash_struct.h"
+
+typedef struct a typedef_to_struct_a;
diff --git a/test-artefacts/headers/golden/program-analysis/typedef_analysis.h b/test-artefacts/headers/golden/program-analysis/typedef_analysis.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/typedef_analysis.h
@@ -0,0 +1,202 @@
+
+/** @file
+ * Examples for the various cases in `HsBindgen.Frontend.Analysis.Typedefs`
+ *
+ * A C typedef and a tagged type (struct/union/enum) can share a name because
+ * they live in different C namespaces, but they collide in Haskell. The typedef
+ * analysis resolves this locally -- using only a single declaration's own name
+ * and type structure -- and so can only act on clashes that are visible from
+ * the typedef itself. Clashes that are not locally visible are detected and
+ * reported as failures by the name mangler instead (see the companion fixture
+ * for those).
+ *
+ *   Form of clash                                     Example  Conclusion
+ *   -------------------------------------------------------------------------
+ *   Typedef is a direct alias, sole use               1,3,4,10 squash
+ *   Typedef is a direct alias, declared together      2        squash
+ *   Typedef is a direct alias, same name              8,9      squash
+ *   Typedef is a direct alias, self-referential       11,12    squash
+ *   Direct alias (const-qualified), same name         15       squash
+ *   Direct alias used by more than one typedef        7        keep both
+ *   Indirection, name mismatch                        5        keep both
+ *   Eponymous tag via pointer                         6a       suffix tag
+ *   Eponymous tag via array                           6b       suffix tag
+ *   Eponymous tag via function return type            13       suffix tag
+ *   Eponymous tag via function argument type          14       suffix tag
+ *   Eponymous tag via const pointer                   16       suffix tag
+ *   Eponymous tag via block return type               blk*     suffix tag
+ *   Eponymous tag via block argument type             blkarg*  suffix tag
+ *
+ * (*) Block examples are in typedef_block.h (requires -fblocks).
+ *
+ * A type qualifier (`const`) is transparent for this analysis: it changes
+ * neither the Haskell representation nor the mangled name, so the tagged type
+ * underneath it keeps its directness (examples 15 and 16).
+ *
+ * The suffix added to a tagged type mirrors its C tag keyword: `_struct`,
+ * `_union`, or `_enum`.
+ */
+
+// Example 1: struct only used in typedef
+struct struct1 {};
+typedef struct struct1 struct1_t;
+
+// Example 2: like example 1, but declared together
+typedef struct struct2 {
+} struct2_t;
+
+// Example 3: like example1, but opaque struct
+struct struct3;
+typedef struct struct3 struct3_t;
+
+// Example 4: like example2, but opaque struct
+typedef struct struct4 struct4_t;
+
+// Example 5: intervening pointer
+struct struct5 {};
+typedef struct struct5 *struct5_t;
+
+// Example 6a: typedef pointer to eponymous struct
+typedef struct struct6a {
+} *struct6a;
+
+// Example 6b: like example 6a, but an array rather than a pointer
+//
+// See <https://github.com/well-typed/hs-bindgen/issues/1445>: as with the
+// pointer case, the eponymous struct must be assigned a new name (suffixed)
+// rather than clashing with the typedef.
+typedef struct struct6b {
+} struct6b[50];
+
+// Example 7: struct used in more than one typedef
+struct struct7 {};
+typedef struct struct7 struct7a;
+typedef struct struct7 struct7b;
+
+// Example 8: used in more than one typedef, but one has same name
+struct struct8 {};
+typedef struct struct8 struct8;
+typedef struct struct8 struct8b;
+
+// Example 9: typedef of a typedef, first typedef eliminated (same name)
+struct struct9 {};
+typedef struct struct9 struct9;
+typedef struct9 struct9_t;
+
+// Example 10: like example9, but typedef eliminated because only use of struct
+//
+// This example shows that we are interested in /direct/ uses of a struct in
+// in order to determine whether or not to eliminate the typedef.
+struct struct10 {};
+typedef struct struct10 struct10_t;
+typedef struct10_t struct10_t_t;
+
+// Example 11: struct only used by /itself/ and a typedef
+struct struct11 {
+  int x;
+  struct struct11 *self;
+};
+typedef struct struct11 struct11_t;
+
+// Example 12: like example 11, but with forward declaration
+struct struct12;
+typedef struct struct12 struct12_t;
+struct struct12 {
+  int x;
+  struct12_t *self;
+};
+
+// Use sites (to verify that these are also handlded correctly)
+struct use_sites {
+  // no use of struct1 (otherwise the heuristic would no longer apply)
+  struct1_t useTypedef_struct1_t;
+
+  // similarly for struct2
+  struct2_t useTypedef_struct2_t;
+
+  // similarly for struct3 and struct4, but must be pointers (opaque types)
+  struct3_t *useTypedef_struct3_t;
+  struct4_t *useTypedef_struct4_t;
+
+  // for struct5 both types continue to exist
+  struct struct5 useStruct_struct5;
+  struct5_t useTypedef_struct5_t;
+
+  // similarly for struct6a, except here the Haskell type is assigned a new name
+  struct struct6a useStruct_struct6a;
+  struct6a useTypedef_struct6a;
+
+  // similarly for struct6b (array typedef): the struct gets a new name
+  struct struct6b useStruct_struct6b;
+  struct6b useTypedef_struct6b;
+
+  // for struct7a and struct7b there are multiple typedefs, so not squashed
+  struct7a useTypedef_struct7a;
+  struct7b useTypedef_struct7b;
+
+  // for struct8 and struct8a, one has the same name so is squashed, the other
+  // is kept
+  struct8 useTypedef_struct8;
+  struct8b useTypedef_struct8b;
+
+  // for struct9 and struct10, the typedef is squashed, but the typedef /of/
+  // the typedef is not
+  struct9 useTypedef_struct9;
+  struct9_t useTypedef_struct9_t;
+  struct10_t useTypedef_struct10_t;
+  struct10_t_t useTypedef_struct10_t_t;
+
+  // For struct11 and struct12 the typedef is squashed (despite self reference)
+  struct11_t useTypedef_struct11_t;
+  struct12_t useTypedef_struct12_t;
+};
+
+// Mind bending self-referential definitions.
+//
+// A typedef and a tagged type can share a name (they live in different C
+// namespaces), but they clash in Haskell. We can resolve such a clash locally
+// (suffixing the tagged type) precisely when the typedef's own type references
+// the eponymous tagged type, regardless of /where/ in the type it appears.
+
+// Example 13: the typedef references the eponymous struct in its return type;
+// 'struct foo' is suffixed.
+struct foo {
+  int x;
+  int y;
+};
+typedef struct foo (*foo)(void);
+
+// Example 14: the typedef references the eponymous struct in an argument type;
+// 'struct bar' is suffixed.
+struct bar {
+  int a;
+  int b;
+};
+typedef struct foo (*bar)(struct bar arg);
+
+// Example 15: const-qualified direct alias with the same name as its tag.
+//
+// The qualifier sits at the head of the type (a 'TypeQual'), but it is
+// transparent: 'struct struct15' is still reached /directly/, so -- exactly as
+// in the unqualified same-name case (example 8) -- the typedef is squashed.
+struct struct15 {};
+typedef const struct struct15 struct15;
+
+// Example 16: eponymous tag reached through a const pointer.
+//
+// Here the head of the type is a qualifier wrapping a pointer
+// ('const' applies to the pointer itself). We must recurse /through/ the
+// qualifier to discover 'struct struct16' behind the indirection; because it is
+// no longer direct and clashes with the typedef name, the tag is suffixed.
+struct struct16 {};
+typedef struct struct16 *const struct16;
+
+// Use sites for the qualified examples.
+struct use_sites_qual {
+  // struct15 is squashed, so only the typedef name survives
+  struct15 useTypedef_struct15;
+
+  // for struct16 both types continue to exist (the tag is suffixed)
+  struct struct16 useStruct_struct16;
+  struct16 useTypedef_struct16;
+};
diff --git a/test-artefacts/headers/golden/program-analysis/typedef_block.h b/test-artefacts/headers/golden/program-analysis/typedef_block.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/typedef_block.h
@@ -0,0 +1,18 @@
+
+/** @file
+ * Block-typedef cases for typedef name-clash analysis
+ *
+ * Kept separate from typedef_analysis.h because this header requires -fblocks.
+ *
+ * The two cases mirror examples 13 and 14 from typedef_analysis.h: a tagged
+ * type reached through a block type (rather than a function-pointer type) and
+ * sharing its name with the surrounding typedef should be suffixed.
+ */
+
+// Block returning the eponymous struct: 'struct blk' is suffixed.
+struct blk { int x; };
+typedef struct blk (^blk)(void);
+
+// Block taking the eponymous struct as an argument: 'struct blkarg' suffixed.
+struct blkarg { int y; };
+typedef int (^blkarg)(struct blkarg arg);
diff --git a/test-artefacts/headers/golden/program-analysis/typedef_name_clash.h b/test-artefacts/headers/golden/program-analysis/typedef_name_clash.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/typedef_name_clash.h
@@ -0,0 +1,47 @@
+/** @file
+ * Fixtures for typedef-vs-tag name clashes that hs-bindgen deliberately does
+ * NOT resolve locally; they are reported as 'DetectClashesCollision' failures.
+ *
+ * The typedef analysis resolves clashes only when the typedef's own type
+ * /syntactically references/ the eponymous tagged type (see typedef_analysis.h
+ * for those cases).  Clashes that are not locally visible fall through to the
+ * name-mangler's collision check, which deselects all involved declarations.
+ *
+ *   Case  Description                                    Collision
+ *   ------------------------------------------------------------------
+ *   a     Typedef type unrelated to eponymous tag         a_unrelated (struct) vs a_unrelated (typedef)
+ *   a'    Function-pointer typedef, no eponymous ref      a_fun (struct) vs a_fun (typedef)
+ *   b     Typedef aliases a different tag; squashing      b_clash (struct) vs b_other (struct renamed B_clash)
+ *         renames that tag to the colliding name
+ *
+ * Note on case (c): a typedef chain such as
+ *
+ *   struct c_chain { int x; };
+ *   typedef struct c_chain c_chain_t;
+ *   typedef c_chain_t c_chain;
+ *
+ * does not produce a collision in practice: because c_chain_t is the sole
+ * direct typedef of struct c_chain, squashing renames the struct to C_chain_t,
+ * leaving C_chain free for the outer typedef.  It is therefore omitted here.
+ */
+
+// (a) Unrelated typedef sharing a tag's name: the typedef's type ('int') does
+// not reference 'struct a_unrelated' at all.  Both declarations mangle to
+// 'A_unrelated' and are deselected.
+struct a_unrelated { int x; };
+typedef int a_unrelated;
+
+// (a') Function-pointer typedef not referencing the eponymous tag: the
+// function type contains no reference to 'struct a_fun'.  Both declarations
+// mangle to 'A_fun' and are deselected.
+struct a_fun { int x; };
+typedef void (*a_fun)(void);
+
+// (b) Typedef aliasing a different tag ('struct b_other'), whose name collides
+// with 'struct b_clash'.  The typedef analysis squashes b_clash → struct
+// b_other (sole direct typedef, sole use), renaming b_other to 'B_clash'.
+// This clashes with the independently existing 'struct b_clash'.  Both structs
+// and the typedef are deselected.
+struct b_clash { int x; };
+struct b_other { int y; };
+typedef struct b_other b_clash;
diff --git a/test-artefacts/headers/golden/program-analysis/typedef_suffix_clash.h b/test-artefacts/headers/golden/program-analysis/typedef_suffix_clash.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/program-analysis/typedef_suffix_clash.h
@@ -0,0 +1,28 @@
+/** @file
+ * The deterministic tag suffix (`_struct`/`_union`/`_enum`; see
+ * typedef_analysis.h) is never counter-disambiguated, so it can collide with an
+ * independently-named declaration. When it does, the name-mangler deselects
+ * /both/ colliding declarations rather than inventing a `_struct2`.
+ */
+
+// (sfx) 'struct sfx' is reached through a pointer by the eponymous typedef
+// 'sfx', so it is suffixed to 'Sfx_struct'.  A real 'struct sfx_struct' also
+// mangles to 'Sfx_struct'.  Both structs are deselected; the typedef 'sfx'
+// then loses its (now dropped) dependency.
+struct sfx {
+  int x;
+};
+typedef struct sfx *sfx;
+struct sfx_struct {
+  int y;
+};
+
+// (u) The same, one namespace over: 'union u' is suffixed to 'U_union', which
+// collides with a real 'struct u_union'.
+union u {
+  int a;
+};
+typedef union u *u;
+struct u_union {
+  int b;
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/anon_in_nonanon.h b/test-artefacts/headers/golden/types/anonymous/edge-cases/anon_in_nonanon.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/anon_in_nonanon.h
@@ -0,0 +1,20 @@
+#pragma once
+
+// x is an indirect field of the untagged struct at field S.y, but it is not an
+// indirect field of struct S.
+//
+// This edge case was not properly handled by implicit field detection in the
+// past, so we include this as an edge case regression test.
+//
+// Note: implicit field detection works (nearly fully) the same for both unions
+// and structs in any order of nesting. Testing the struct-only case should be
+// sufficient to cover those examples as well.
+
+struct S {
+  struct {
+    struct {
+      int x;
+    };
+  } y;
+};
+
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/bitfield.h b/test-artefacts/headers/golden/types/anonymous/edge-cases/bitfield.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/bitfield.h
@@ -0,0 +1,26 @@
+#pragma once
+
+// Implicit field detection works the same if any of the indirect fields are
+// bit-fields.
+//
+// Note: implicit field detection works the same for both unions and structs in
+// any order of nesting, so testing the struct-only case should be sufficient to
+// cover those examples as well.
+
+// With S1 we test one level of nesting, with S2 we test two levels of nesting.
+
+struct S1 {
+  struct {
+    char y : 3;
+  };
+  int x;
+};
+
+struct S2 {
+  struct {
+    struct {
+      char y : 3;
+    };
+    int x;
+  };
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields.h b/test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields.h
@@ -0,0 +1,12 @@
+#pragma once
+
+struct S {
+  struct { // Point3D
+    struct { // Point2D
+      int x; // X coordinate
+      int y; // Y coordinate
+    };
+    int z; // Z coordinate
+  };
+};
+
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields_1.ext.yaml b/test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields_1.ext.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields_1.ext.yaml
@@ -0,0 +1,22 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: OtherExample
+ctypes:
+- headers: types/anonymous/edge-cases/drop_indirect_fields.h
+  cname: struct @S_anon'anon'x_anon'x
+  hsname: Point2D
+hstypes:
+- hsname: Point2D
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields_2.ext.yaml b/test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields_2.ext.yaml
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/drop_indirect_fields_2.ext.yaml
@@ -0,0 +1,22 @@
+version:
+  hs_bindgen: 1.0.0.0
+  binding_specification: '1.0'
+hsmodule: OtherExample
+ctypes:
+- headers: types/anonymous/edge-cases/drop_indirect_fields.h
+  cname: struct @S_anon'anon'x
+  hsname: Point3D
+hstypes:
+- hsname: Point3D
+  instances:
+  - Eq
+  - Generic
+  - HasCField
+  - HasField
+  - HasFieldCompat
+  - HasFieldPtr
+  - ReadRaw
+  - Show
+  - StaticSize
+  - Storable
+  - WriteRaw
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/duplicate_field_names.h b/test-artefacts/headers/golden/types/anonymous/edge-cases/duplicate_field_names.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/duplicate_field_names.h
@@ -0,0 +1,21 @@
+#pragma once
+
+// x occurs as a field name in S, but also in the untagged struct at field S.y.
+// They are still separate fields, regardless of the duplicate name.
+//
+// This edge case was not properly handled by implicit field detection in the
+// past, so we include this as an edge case regression test.
+//
+// Note: implicit field detection works the same for both unions and structs in
+// any order of nesting, so testing the struct-only case should be sufficient to
+// cover those examples as well.
+
+struct S {
+  unsigned long long x;
+  struct {
+    struct {
+      int x;
+    };
+  } y;
+};
+
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/empty_anon.h b/test-artefacts/headers/golden/types/anonymous/edge-cases/empty_anon.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/empty_anon.h
@@ -0,0 +1,41 @@
+#pragma once
+
+// Anonymous structs and unions were added to C11. Since C11, the behavior of
+// the program is undefined if a struct or union is defined without any named
+// members (including those obtained via anonymous nested structs or unions).
+// From C2y onwards, the behaviour will probably be implementation-defined.
+//
+// <https://en.cppreference.com/w/c/language/struct.html>
+// <https://en.cppreference.com/w/c/language/union.html>
+//
+// We need at least one named (bit-)field in an anonymous struct or union to
+// determine the offset of that anonymous object within an enclosing object. In
+// other words, anonymous structs and unions should be "non-empty". A struct or
+// union with only unnamed bit-fields, used to specify padding, is also
+// considered "empty". The parser should not generate any bindings for empty
+// structs or unions, and emit a message instead. Moreover, if a nested struct
+// or union fails to parse, for example because it is empty, then the enclosing
+// struct or union should also fail to parse.
+//
+// This edge case was not properly handled by implicit field detection in the
+// past, so we include this as an edge case regression test.
+//
+// Note: implicit field detection works the same for both unions and structs in
+// any order of nesting, so testing the struct-only case should be sufficient to
+// cover those examples as well.
+
+// With S1 we test one level of nesting, with S2 we test two levels of nesting.
+
+struct S1 {
+  struct {};
+  int x;
+};
+
+struct S2 {
+  struct {
+    struct {
+      char : 3; // unnamed bit-field specifies padding
+    };
+    int x;
+  };
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/multi_nesting.h b/test-artefacts/headers/golden/types/anonymous/edge-cases/multi_nesting.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/multi_nesting.h
@@ -0,0 +1,77 @@
+#pragma once
+
+/* -------------------------------------------------------------------------- */
+/* >1 levels of nesting of anonymous objects */
+
+// When detecting implicit fields for an object X, it is important to consider
+// that any anonymous objects declared inside X can themselves can also have
+// implicit fields. Examples of this multi-level nesting of anonymous objects
+// are included in this header file.
+
+// Naming: the types in this header are named after the order in which objects
+// are nested. For example, USS means "union containing struct containing
+// struct", or equivalently, "struct in struct in union".
+
+struct SSS {
+  struct {
+    struct {
+      int x;
+    };
+  };
+};
+
+union USS {
+  struct {
+    struct {
+      int x;
+    };
+  };
+};
+
+struct SUS {
+  union {
+    struct {
+      int x;
+    };
+  };
+};
+
+union UUS {
+  union {
+    struct {
+      int x;
+    };
+  };
+};
+
+struct SSU {
+  struct {
+    union {
+      int x;
+    };
+  };
+};
+
+union USU {
+  struct {
+    union {
+      int x;
+    };
+  };
+};
+
+struct SUU {
+  union {
+    union {
+      int x;
+    };
+  };
+};
+
+union UUU {
+  union {
+    union {
+      int x;
+    };
+  };
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/padding.h b/test-artefacts/headers/golden/types/anonymous/edge-cases/padding.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/padding.h
@@ -0,0 +1,47 @@
+#pragma once
+
+// We can compute offsets for implicit fields even if the anonymous struct or
+// union starts with padding (specified by an unnamed bit-field).
+//
+// This edge case was not properly handled by implicit field detection in the
+// past, so we include this as an edge case regression test.
+
+// Naming: the types in this header are named after the order in which objects
+// are nested. For example, US means "union containing struct", or equivalently,
+// "struct in union".
+
+struct SS {
+  char x;
+  struct {
+    char : 3;
+    int y;
+  };
+  int z;
+};
+
+struct SU {
+  char x;
+  union {
+    char : 3;
+    int y;
+  };
+  int z;
+};
+
+union US {
+  char x;
+  struct {
+    char : 3;
+    int y;
+  };
+  int z;
+};
+
+union UU {
+  char x;
+  union {
+    char : 3;
+    int y;
+  };
+  int z;
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/edge-cases/reparse.h b/test-artefacts/headers/golden/types/anonymous/edge-cases/reparse.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/edge-cases/reparse.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#define A int
+#define B char
+
+struct S {
+  struct {
+    struct {
+      A x;
+    };
+    B y;
+  };
+};
+
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/_internal_macros.h
@@ -0,0 +1,23 @@
+#pragma once
+
+/* -------------------------------------------------------------------------- */
+/* macros for testing indirect fields */
+
+// This header is not intended to be a test itself. We use it to generate types
+// in headers that are tested (see other headers in this directory).
+
+#define MkSingleNested(t1, t2, f) \
+  t1 { t2 { f; }; };
+
+#define MkMultiNested(t1, t2, t3, f) \
+  t1 { t2 { t3 { f; }; }; };
+
+// NOTE: indirect fields are handled the same for structs as for unions, so it
+// does not matter whether we nest structs or unions or a combination of them.
+// We arbitrarily decided to use structs in our test headers here.
+
+#define MkSingleNestedS(f) \
+  MkSingleNested(struct S, struct, f)
+
+#define MkMultiNestedS(f) \
+  MkMultiNested (struct S, struct, struct, f)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_enum_tagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_enum_tagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_enum_tagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkMultiNestedS(enum T { a } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_enum_untagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_enum_untagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_enum_untagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkMultiNestedS(enum { a } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_struct_tagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_struct_tagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_struct_tagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkMultiNestedS(struct T { int a; } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_struct_untagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_struct_untagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_struct_untagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkMultiNestedS(struct { int a; } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_union_tagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_union_tagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_union_tagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkMultiNestedS(union T { int a; } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_union_untagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_union_untagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/multi_nesting_union_untagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkMultiNestedS(union { int a; } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_enum_tagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_enum_tagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_enum_tagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkSingleNestedS(enum T { a } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_enum_untagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_enum_untagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_enum_untagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkSingleNestedS(enum { a } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_struct_tagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_struct_tagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_struct_tagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkSingleNestedS(struct T { int a; } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_struct_untagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_struct_untagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_struct_untagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkSingleNestedS(struct { int a; } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_union_tagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_union_tagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_union_tagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkSingleNestedS(union T { int a; } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_union_untagged.h b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_union_untagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/indirect-fields/single_nesting_union_untagged.h
@@ -0,0 +1,3 @@
+#include "_internal_macros.h"
+
+MkSingleNestedS(union { int a; } x)
diff --git a/test-artefacts/headers/golden/types/anonymous/struct.h b/test-artefacts/headers/golden/types/anonymous/struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/struct.h
@@ -0,0 +1,21 @@
+// Struct with implicit fields
+//
+// The order is relevant in the case that we compute offsets (as opposed to ask
+// clang for offsets) if we flatten the struct.
+struct has_implicit_fields {
+  int x1;
+  struct {
+    int x2_1;
+    int x2_2;
+  }; // implicit field x2
+  int x3;
+  struct {
+    int x4_1;
+    int x4_2;
+  }; // implicit field x4
+  union {
+    int x5_1;
+    int x5_2;
+  }; // implicit field x5
+  int x5;
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/struct_in_struct.h b/test-artefacts/headers/golden/types/anonymous/struct_in_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/struct_in_struct.h
@@ -0,0 +1,31 @@
+#pragma once
+
+/* -------------------------------------------------------------------------- */
+/* struct in struct */
+
+struct outer1 {
+  char fieldA;
+  struct {
+    int fieldX;
+    int fieldY;
+  }; // <-- an anonymous struct: an untagged struct with an unnamed field
+  int fieldC;
+};
+
+struct outer2 {
+  char fieldA;
+  struct {
+    int fieldX;
+    int fieldY;
+  } fieldB; // <-- an untagged struct with a named field
+  int fieldC;
+};
+
+struct outer3 {
+  char fieldA;
+  struct inner3 {
+    int fieldX;
+    int fieldY;
+  } fieldB; // <-- a named struct with a named field
+  int fieldC;
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/struct_in_union.h b/test-artefacts/headers/golden/types/anonymous/struct_in_union.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/struct_in_union.h
@@ -0,0 +1,31 @@
+#pragma once
+
+/* -------------------------------------------------------------------------- */
+/* struct in union */
+
+union outer1 {
+  char fieldA;
+  struct {
+    int fieldX;
+    int fieldY;
+  }; // <-- an anonymous struct: an untagged struct with an unnamed field
+  int fieldC;
+};
+
+union outer2 {
+  char fieldA;
+  struct {
+    int fieldX;
+    int fieldY;
+  } fieldB; // <-- an untagged struct with a named field
+  int fieldC;
+};
+
+union outer3 {
+  char fieldA;
+  struct inner3 {
+    int fieldX;
+    int fieldY;
+  } fieldB; // <-- a named struct with a named field
+  int fieldC;
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/union.h b/test-artefacts/headers/golden/types/anonymous/union.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/union.h
@@ -0,0 +1,19 @@
+// Union with implicit fields
+//
+union has_implicit_fields {
+  int x1;
+  struct {
+    int x2_1;
+    int x2_2;
+  }; // implicit field x2
+  int x3;
+  struct {
+    int x4_1;
+    int x4_2;
+  }; // implicit field x4
+  union {
+    int x5_1;
+    int x5_2;
+  }; // implicit field x5
+  int x5;
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/union_in_struct.h b/test-artefacts/headers/golden/types/anonymous/union_in_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/union_in_struct.h
@@ -0,0 +1,31 @@
+#pragma once
+
+/* -------------------------------------------------------------------------- */
+/* union in struct */
+
+struct outer1 {
+  char fieldA;
+  union {
+    int fieldX;
+    int fieldY;
+  }; // <-- an anonymous union: an untagged union with an unnamed field
+  int fieldC;
+};
+
+struct outer2 {
+  char fieldA;
+  union {
+    int fieldX;
+    int fieldY;
+  } fieldB; // <-- an untagged union with a named field
+  int fieldC;
+};
+
+struct outer3 {
+  char fieldA;
+  union inner3 {
+    int fieldX;
+    int fieldY;
+  } fieldB; // <-- a named union with a named field
+  int fieldC;
+};
diff --git a/test-artefacts/headers/golden/types/anonymous/union_in_union.h b/test-artefacts/headers/golden/types/anonymous/union_in_union.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/anonymous/union_in_union.h
@@ -0,0 +1,31 @@
+#pragma once
+
+/* -------------------------------------------------------------------------- */
+/* union in union */
+
+union outer1 {
+  char fieldA;
+  union {
+    int fieldX;
+    int fieldY;
+  }; // <-- an anonymous union: an untagged union with an unnamed field
+  int fieldC;
+};
+
+union outer2 {
+  char fieldA;
+  union {
+    int fieldX;
+    int fieldY;
+  } fieldB; // <-- an untagged union with a named field
+  int fieldC;
+};
+
+union outer3 {
+  char fieldA;
+  union inner3 {
+    int fieldX;
+    int fieldY;
+  } fieldB; // <-- a named union with a named field
+  int fieldC;
+};
diff --git a/test-artefacts/headers/golden/types/complex/complex_non_float_test.h b/test-artefacts/headers/golden/types/complex/complex_non_float_test.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/complex/complex_non_float_test.h
@@ -0,0 +1,7 @@
+#include <complex.h>
+
+extern unsigned short  complex global_complex_unsigned_short;
+extern          short  complex global_complex_short;
+extern unsigned int    complex global_complex_unsigned_int;
+extern          int    complex global_complex_int;
+extern          char   complex global_complex_char;
diff --git a/test-artefacts/headers/golden/types/complex/hsb_complex_test.h b/test-artefacts/headers/golden/types/complex/hsb_complex_test.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/complex/hsb_complex_test.h
@@ -0,0 +1,31 @@
+#include <complex.h>
+
+extern float  complex global_complex_float;
+extern double complex global_complex_double;
+
+extern complex float  global_complex_float_flipped;
+extern complex double global_complex_double_flipped;
+
+extern float  _Complex global_Complex_float;
+extern double _Complex global_Complex_double;
+
+extern _Complex float  global_Complex_float_flipped;
+extern _Complex double global_Complex_double_flipped;
+
+extern const float  complex const_complex_float;
+extern const double complex const_complex_double;
+
+extern float  complex volatile_complex_float;
+extern double complex volatile_complex_double;
+
+float  complex multiply_complex_f(float complex a, float complex b);
+double complex add_complex(double complex a, double complex b);
+
+typedef struct {
+    float  complex velocity;
+    double complex position;
+    int id;
+} complex_object_t;
+
+extern float  complex complex_float_array[10];
+extern double complex complex_double_array[10];
diff --git a/test-artefacts/headers/golden/types/complex/vector_test.h b/test-artefacts/headers/golden/types/complex/vector_test.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/complex/vector_test.h
@@ -0,0 +1,6 @@
+typedef struct {
+    double x;
+    double y;
+} vector;
+
+vector* new_vector(double x, double y);
diff --git a/test-artefacts/headers/golden/types/enums/enum_cpp_syntax.h b/test-artefacts/headers/golden/types/enums/enum_cpp_syntax.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/enums/enum_cpp_syntax.h
@@ -0,0 +1,5 @@
+#include <stdint.h>
+
+// C++ syntax for enums, allowing to override the underlying type.
+typedef enum : uint32_t { A, B, C } foo_enum;
+
diff --git a/test-artefacts/headers/golden/types/enums/enum_unsigned_values.h b/test-artefacts/headers/golden/types/enums/enum_unsigned_values.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/enums/enum_unsigned_values.h
@@ -0,0 +1,9 @@
+#include <stdint.h>
+
+// Unsigned enum with values crossing the signed boundary
+typedef enum : uint8_t {
+  U8_ZERO  = 0,
+  U8_127   = 127,
+  U8_128   = 128,
+  U8_255   = 255
+} uint8_enum;
diff --git a/test-artefacts/headers/golden/types/enums/enums.h b/test-artefacts/headers/golden/types/enums/enums.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/enums/enums.h
@@ -0,0 +1,40 @@
+#ifndef ENUMS_H
+#define ENUMS_H
+
+enum first {
+    FIRST1,
+    FIRST2
+};
+
+enum second {
+    SECOND_A = -1,
+    SECOND_B,
+    SECOND_C
+};
+
+enum same {
+    SAME_A = 1,
+    SAME_B = 1,
+};
+
+enum nonseq {
+    NONSEQ_A = 200,
+    NONSEQ_B = 301,
+    NONSEQ_C = 404
+};
+
+enum packed {
+    PACKED_A, PACKED_B, PACKED_C
+} __attribute__((packed));
+
+typedef enum { A_FOO, A_BAR } enumA;
+
+typedef enum enumB { B_FOO, B_BAR } enumB;
+
+enum enumC { C_FOO, C_BAR };
+typedef enum enumC enumC;
+
+enum enumD { D_FOO, D_BAR };
+typedef enum enumD enumD_t;
+
+#endif /* ENUMS_H */
diff --git a/test-artefacts/headers/golden/types/enums/nested_enums.h b/test-artefacts/headers/golden/types/enums/nested_enums.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/enums/nested_enums.h
@@ -0,0 +1,13 @@
+struct exA {
+        enum enumA {
+                VALA_1,
+                VALA_2
+        } fieldA1;
+};     
+
+struct exB {
+        enum {
+                VALB_1,
+                VALB_2
+        } fieldB1;
+};      
diff --git a/test-artefacts/headers/golden/types/enums/untagged_enum_toplevel.h b/test-artefacts/headers/golden/types/enums/untagged_enum_toplevel.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/enums/untagged_enum_toplevel.h
@@ -0,0 +1,11 @@
+#ifndef UNTAGGED_ENUM_TOPLEVEL_H
+#define UNTAGGED_ENUM_TOPLEVEL_H
+
+// Top-level untagged enum (no tag, no typedef)
+enum {
+    TOPLEVEL_UNTAGGED_A,
+    TOPLEVEL_UNTAGGED_B,
+    TOPLEVEL_UNTAGGED_C = 100
+};
+
+#endif /* UNTAGGED_ENUM_TOPLEVEL_H */
diff --git a/test-artefacts/headers/golden/types/nested/nested_types.h b/test-artefacts/headers/golden/types/nested/nested_types.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/nested/nested_types.h
@@ -0,0 +1,28 @@
+struct foo {
+    int i;
+    char c;
+};
+
+struct bar {
+    struct foo foo1;
+    struct foo foo2;
+};
+
+struct ex3 {
+    struct {
+        int ex3_a;
+        char ex3_b;
+    } ex3_struct;
+    float ex3_c;
+};
+
+// struct with inline struct which reference itself.
+// linked list where odd values are ints, and even values are doubles
+// by writing this way, we don't need forward declarations.
+struct ex4_odd {
+    int value;
+    struct ex4_even {
+        double value;
+        struct ex4_odd *next;
+    } *next;
+};
diff --git a/test-artefacts/headers/golden/types/primitives/bool.h b/test-artefacts/headers/golden/types/primitives/bool.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/primitives/bool.h
@@ -0,0 +1,18 @@
+struct bools1 {
+    _Bool x;
+    _Bool y;
+};
+
+#include <stdbool.h>
+
+struct bools2 {
+    bool x;
+    bool y;
+};
+
+#define BOOL _Bool
+
+struct bools3 {
+    BOOL x;
+    BOOL y;
+};
diff --git a/test-artefacts/headers/golden/types/primitives/bool_c23.h b/test-artefacts/headers/golden/types/primitives/bool_c23.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/primitives/bool_c23.h
@@ -0,0 +1,3 @@
+// In C23 `bool` because a primitive type, no #include necessary
+// This only works correctly in clang >= 15
+extern bool b;
diff --git a/test-artefacts/headers/golden/types/primitives/bool_macro_override.h b/test-artefacts/headers/golden/types/primitives/bool_macro_override.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/primitives/bool_macro_override.h
@@ -0,0 +1,13 @@
+// Test that when bool is given a definition (via #define), it is NOT parsed as
+// PrimBool by language-c. In C23, bool is a keyword, but a macro definition
+// should take precedence.
+
+// This also requires _scoped macro types_. During reparse, we must only use
+// macros that are currently in scope. In particular, `f` uses standard `bool`
+// while `g` uses the macro `bool` which expands to `int` in this test case.
+
+#define A int
+void f(A x, bool y);
+
+#define bool int
+void g(A x, bool y);
diff --git a/test-artefacts/headers/golden/types/primitives/bool_typedef_override.h b/test-artefacts/headers/golden/types/primitives/bool_typedef_override.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/primitives/bool_typedef_override.h
@@ -0,0 +1,6 @@
+// Test that when bool is given a definition (via typedef), it is NOT parsed as
+// PrimBool by language-c.
+
+#define A int
+typedef int bool;
+void f(A x, bool y);
diff --git a/test-artefacts/headers/golden/types/primitives/fixedwidth.h b/test-artefacts/headers/golden/types/primitives/fixedwidth.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/primitives/fixedwidth.h
@@ -0,0 +1,6 @@
+#include <stdint.h>
+
+struct foo {
+	uint64_t sixty_four;
+	uint32_t thirty_two;
+};
diff --git a/test-artefacts/headers/golden/types/primitives/least_fast.h b/test-artefacts/headers/golden/types/primitives/least_fast.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/primitives/least_fast.h
@@ -0,0 +1,25 @@
+// These types differ across libc implementation, not just platform.  We are
+// therefore unable to provide Haskell types for them in the hs-bindgen
+// standard library.
+
+#include <stdint.h>
+
+int_least8_t  int_least8_t_fun();
+int_least16_t int_least16_t_fun();
+int_least32_t int_least32_t_fun();
+int_least64_t int_least64_t_fun();
+
+uint_least8_t  uint_least8_t_fun();
+uint_least16_t uint_least16_t_fun();
+uint_least32_t uint_least32_t_fun();
+uint_least64_t uint_least64_t_fun();
+
+int_fast8_t  int_fast8_t_fun();
+int_fast16_t int_fast16_t_fun();
+int_fast32_t int_fast32_t_fun();
+int_fast64_t int_fast64_t_fun();
+
+uint_fast8_t  uint_fast8_t_fun();
+uint_fast16_t uint_fast16_t_fun();
+uint_fast32_t uint_fast32_t_fun();
+uint_fast64_t uint_fast64_t_fun();
diff --git a/test-artefacts/headers/golden/types/primitives/primitive_insts.h b/test-artefacts/headers/golden/types/primitives/primitive_insts.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/primitives/primitive_insts.h
@@ -0,0 +1,41 @@
+// This test declares typedefs around types that are translated to HsPrimType
+// primitive types.  The resulting Haskell module derives the instances that are
+// configured for each primitive type, and compiling the module tests that all
+// of those instances exist.
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+// Nothing translates to HsPrimVoid
+// Nothing translates to HsPrimUnit
+// Nothing translates to HsPrimCStringLen
+typedef ptrdiff_t          prim_HsPrimCPtrdiff;
+// Nothing translates to HsPrimChar
+// Nothing translates to HsPrimInt
+// Nothing translates to HsPrimDouble
+// Nothing translates to HsPrimFloat
+// Nothing translates to HsPrimBool
+typedef int8_t             prim_HsPrimInt8;
+typedef int16_t            prim_HsPrimInt16;
+typedef int32_t            prim_HsPrimInt32;
+typedef int64_t            prim_HsPrimInt64;
+// Nothing translates to HsPrimWord
+typedef uint8_t            prim_HsPrimWord8;
+typedef uint16_t           prim_HsPrimWord16;
+typedef uint32_t           prim_HsPrimWord32;
+typedef uint64_t           prim_HsPrimWord64;
+typedef char               prim_HsPrimCChar;
+typedef signed char        prim_HsPrimCSChar;
+typedef unsigned char      prim_HsPrimCUChar;
+typedef short              prim_HsPrimCShort;
+typedef unsigned short     prim_HsPrimCUShort;
+typedef int                prim_HsPrimCInt;
+typedef unsigned int       prim_HsPrimCUInt;
+typedef long               prim_HsPrimCLong;
+typedef unsigned long      prim_HsPrimCULong;
+typedef long long          prim_HsPrimCLLong;
+typedef unsigned long long prim_HsPrimCULLong;
+typedef bool               prim_HsPrimCBool;
+typedef float              prim_HsPrimCFloat;
+typedef double             prim_HsPrimCDouble;
diff --git a/test-artefacts/headers/golden/types/primitives/primitive_types.h b/test-artefacts/headers/golden/types/primitives/primitive_types.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/primitives/primitive_types.h
@@ -0,0 +1,40 @@
+struct primitive {
+    char c;
+    signed char sc;
+    unsigned char uc;
+
+    short s;
+    short int si;
+    signed short ss;
+    signed short int ssi;
+
+    unsigned short us;
+    unsigned short int usi;
+
+    int i;
+    signed s2;
+    signed int si2;
+
+    unsigned u;
+    unsigned int ui;
+
+    long l;
+    long int li;
+    signed long sl;
+    signed long int sli;
+
+    unsigned long ul;
+    unsigned long int uli;
+
+    long long ll;
+    long long int lli;
+    signed long long sll;
+    signed long long int slli;
+
+    unsigned long long ull;
+    unsigned long long int ulli;
+
+    float f;
+    double d;
+    // long double ld; #349 long double not supported
+};
diff --git a/test-artefacts/headers/golden/types/qualifiers/const_typedefs.h b/test-artefacts/headers/golden/types/qualifiers/const_typedefs.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/qualifiers/const_typedefs.h
@@ -0,0 +1,38 @@
+// For all the global variables below we should generate a pure Haskell binding
+// that simply returns the value, since all global variables are (indirectly
+// through a typedef) const-qualified.
+//
+// In the past, we had a bug where the const qualifier was lost in the typedef
+// examples if the typedef wrapped a const-qualified struct, union or enum (but
+// not basic types like int), see PR #1488. This golden test should hopefully
+// help us catch regressions were they to appear in the future.
+
+typedef int I;
+struct S {};
+union U {};
+enum E {foo};
+
+extern const I i;
+extern const struct S s;
+extern const union U u;
+extern const enum E e;
+
+typedef const I TI;
+typedef const struct S TS;
+typedef const union U TU;
+typedef const enum E TE;
+
+extern TI ti;
+extern TS ts;
+extern TU tu;
+extern TE te;
+
+typedef TI TTI;
+typedef TS TTS;
+typedef TU TTU;
+typedef TE TTE;
+
+extern TTI tti;
+extern TTS tts;
+extern TTU ttu;
+extern TTE tte;
diff --git a/test-artefacts/headers/golden/types/qualifiers/type_qualifiers.h b/test-artefacts/headers/golden/types/qualifiers/type_qualifiers.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/qualifiers/type_qualifiers.h
@@ -0,0 +1,28 @@
+#include <stdbool.h>
+#include <stddef.h>
+
+// Outermost const; type is const-int.
+extern const int a;
+// No outermost const; type is pointer-to-const-int.
+extern const int *b;
+// Outermost const; type is const-pointer-to-int.
+extern int *const c;
+// Outermost const; type is const-pointer-to-const-int.
+extern const int *const d;
+
+// Type qualifier in function argument.
+bool list_example(const char **items, size_t count);
+
+// Multiple pointer levels with const qualifiers interleaved at various positions
+// Type: pointer-to-const-pointer-to-const-int (const at two levels)
+extern const int *const *e;
+// Type: pointer-to-pointer-to-const-pointer-to-const-int (3 levels, const at innermost two)
+extern const int *const **f;
+// Type: pointer-to-const-pointer-to-pointer-to-const-int (3 levels, const at outer and inner)
+extern const int **const *g;
+// Type: const-pointer-to-const-pointer-to-const-pointer-to-const-int (4 levels, all const)
+extern const int *const *const *const h;
+// Type: pointer-to-const-pointer-to-pointer-to-const-pointer-to-int (4 levels, alternating const)
+extern int *const **const *i;
+// Type: pointer-to-pointer-to-const-pointer-to-const-pointer-to-const-int (5 levels, const at inner three)
+extern const int *const *const **j;
diff --git a/test-artefacts/headers/golden/types/scoping/deep_nesting.h b/test-artefacts/headers/golden/types/scoping/deep_nesting.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/scoping/deep_nesting.h
@@ -0,0 +1,26 @@
+// Variant of nesting.h with recursive nesting, hence the name deep nesting.
+//
+// baz parses successfully, but foo and bar do not because long double is not
+// supported. baz has file scope because it inherits the scope from bar and
+// recursively from foo, so we should still generate bindings for baz even if we
+// don't generate bindings for foo and bar.
+//
+// Info on scoping:
+// <https://en.cppreference.com/w/c/language/scope.html#Notes>
+//
+// NOTE: hs-bindgen handles nesting the same regardless of whether using
+// structs, unions, or any combination of them, in any order. So it should be
+// sufficient to only test with structs.
+
+struct foo {
+  struct bar {
+    long double x1_1;
+    struct baz {
+      int x1_2_1;
+    } x1_2;
+  } x1;
+  long double x2;
+};
+
+extern struct baz X;
+
diff --git a/test-artefacts/headers/golden/types/scoping/nesting.h b/test-artefacts/headers/golden/types/scoping/nesting.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/scoping/nesting.h
@@ -0,0 +1,26 @@
+// bar parses successfully, but foo does not because long double is not
+// supported. bar has file scope because it inherits the scope from foo, so we
+// should still generate bindings for bar even if we don't generate bindings for
+// foo.
+//
+// Info on scoping:
+// <https://en.cppreference.com/w/c/language/scope.html#Notes>
+//
+// NOTE: hs-bindgen handles nesting the same regardless of whether using
+// structs, unions, or any combination of them, in any order. So it should be
+// sufficient to only test with structs.
+
+struct foo {
+  struct bar {
+    //!
+    //! Comment attached to foo::bar::x1_1.
+    //!
+    //! This comment must be preserved, even though the enclosing declaration
+    //! uses an unsupported feature.
+    //!
+    int x1_1;
+  } x1;
+  long double x2;
+};
+
+extern struct bar X;
diff --git a/test-artefacts/headers/golden/types/scoping/wide_nesting.h b/test-artefacts/headers/golden/types/scoping/wide_nesting.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/scoping/wide_nesting.h
@@ -0,0 +1,27 @@
+// Variant of nesting.h with multiple nested structs side by side, hence the
+// name wide nesting.
+//
+// baz parses successfully, but foo and bar do not because long double is not
+// supported. baz has file scope because it inherits the scope from foo, so we
+// should still generate bindings for baz even if we don't generate bindings for
+// foo and bar.
+//
+// Info on scoping:
+// <https://en.cppreference.com/w/c/language/scope.html#Notes>
+//
+// NOTE: hs-bindgen handles nesting the same regardless of whether using
+// structs, unions, or any combination of them, in any order. So it should be
+// sufficient to only test with structs.
+
+struct foo {
+  struct bar {
+    long double x1_1;
+  } x1;
+  long double x2;
+  struct baz {
+    int x3_1;
+  } x3;
+};
+
+extern struct baz X;
+
diff --git a/test-artefacts/headers/golden/types/special/long_double.h b/test-artefacts/headers/golden/types/special/long_double.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/special/long_double.h
@@ -0,0 +1,1 @@
+long double foo(int x);
diff --git a/test-artefacts/headers/golden/types/special/parse_failure_long_double.h b/test-artefacts/headers/golden/types/special/parse_failure_long_double.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/special/parse_failure_long_double.h
@@ -0,0 +1,15 @@
+/*
+ * Test that we can skip over declarations with unsupported features.
+ */
+
+// unsupported type in function signature
+void fun1(long double);
+void fun2(int);
+
+// unsupported type in struct field
+struct struct1 {
+  long double x;
+};
+struct struct2 {
+  int x;
+};
diff --git a/test-artefacts/headers/golden/types/special/small_floats.h b/test-artefacts/headers/golden/types/special/small_floats.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/special/small_floats.h
@@ -0,0 +1,16 @@
+/*
+ * Small floating-point types are not supported; we warn about them.
+ *
+ * __ibm128 is only available on PowerPC targets, and __bf16 is exposed
+ * differently depending on the target, so neither is tested here.
+ */
+
+typedef _Float16 float16_t;
+typedef __fp16 fp16_t;
+
+struct small_floats {
+  _Float16 f16;
+  __fp16 fp16;
+};
+
+_Float16 fun(int x);
diff --git a/test-artefacts/headers/golden/types/structs/bitfields.h b/test-artefacts/headers/golden/types/structs/bitfields.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/structs/bitfields.h
@@ -0,0 +1,103 @@
+#ifndef TEST_BITFIELDS_H
+#define TEST_BITFIELDS_H
+
+/* not packed, <=8-bit fields */
+struct foo_8 {
+  signed char a : 3;
+  signed char b : 3;
+  signed char c : 2;  // First byte fully packed
+  signed char d : 3;  // Middle byte has padding
+  signed char e : 8;  // 8-bit field
+  signed char f : 5;  // Last byte has padding
+};
+
+/* not packed, <=16-bit fields */
+struct foo_16 {
+  signed char a :  6;
+  signed int  b : 10;  // First two bytes fully packed
+  signed int  c : 16;  // 16-bit field
+  signed int  d : 16;
+  signed int  e : 12;  // Middle byte has padding
+  signed int  f : 12;  // Padding at end
+};
+
+/* not packed, <=32-bit fields */
+struct foo_32 {
+  signed char a :  6;
+  signed int  b : 12;
+  signed int  c : 14;  // First four bytes fully packed
+  signed int  d : 10;  // Middle byte has padding
+  signed long e : 32;  // 32-bit field
+  signed int  f :  6;
+  signed long g : 24;  // Padding at end
+};
+
+/* not packed, <=64-bit fields */
+struct foo_64 {
+  signed long      a : 24;
+  signed long long b : 40;  // First eight bytes fully packed
+  signed long long c : 64;  // 64-bit field
+  signed long long d : 36;  // Padding at end
+};
+
+/* packed, <=8-bit field crosses 8-bit word boundary */
+struct __attribute__((packed)) bar_8_8 {
+  signed char a : 6;
+  signed int  b : 4;  // Crosses 8-bit word boundary
+};
+
+/* packed, <=8-bit field crosses 16-bit word boundary */
+struct __attribute__((packed)) bar_8_16 {
+  signed int a : 14;
+  signed int b :  4;  // Crosses 16-bit word boundary
+};
+
+/* packed, <=8-bit field crosses 32-bit word boundary */
+struct __attribute__((packed)) bar_8_32 {
+  signed long a : 30;
+  signed int  b :  4;  // Crosses 32-bit word boundary
+};
+
+/* packed, <=8-bit field crosses 64-bit word boundary */
+struct __attribute__((packed)) bar_8_64 {
+  signed long long a : 62;
+  signed int       b :  4;  // Crosses 64-bit word boundary
+};
+
+/* packed, <=16-bit field crosses 16-bit word boundary */
+struct __attribute__((packed)) bar_16_16 {
+  signed int a : 14;
+  signed int b : 14;  // Crosses 16-bit word boundary
+};
+
+/* packed, <=16-bit field crosses 32-bit word boundary */
+struct __attribute__((packed)) bar_16_32 {
+  signed long a : 24;
+  signed int  b : 14;  // Crosses 32-bit word boundary
+};
+
+/* packed, <=16-bit field crosses 64-bit word boundary */
+struct __attribute__((packed)) bar_16_64 {
+  signed long long a : 56;
+  signed int       b : 14;  // Crosses 64-bit word boundary
+};
+
+/* packed, <=32-bit field crosses 32-bit word boundary */
+struct __attribute__((packed)) bar_32_32 {
+  signed long a : 30;
+  signed long b : 30;  // Crosses 32-bit word boundary
+};
+
+/* packed, <=32-bit field crosses 64-bit word boundary */
+struct __attribute__((packed)) bar_32_64 {
+  signed long long a : 56;
+  signed long      b : 30;  // Crosses 64-bit word boundary
+};
+
+/* packed, <=64-bit field crosses 64-bit word boundary */
+struct __attribute__((packed)) bar_64_64 {
+  signed long long a : 56;
+  signed long long b : 40;  // Crosses 64-bit word boundary
+};
+
+#endif // TEST_BITFIELDS_H
diff --git a/test-artefacts/headers/golden/types/structs/circular_dependency_struct.h b/test-artefacts/headers/golden/types/structs/circular_dependency_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/structs/circular_dependency_struct.h
@@ -0,0 +1,9 @@
+struct a;
+
+struct b {
+  struct a *toA;
+};
+
+struct a {
+  struct b toB;
+};
diff --git a/test-artefacts/headers/golden/types/structs/padding.h b/test-artefacts/headers/golden/types/structs/padding.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/structs/padding.h
@@ -0,0 +1,12 @@
+struct foo {
+  signed char a : 3;
+  signed char b : 3;
+  signed char   : 0;  // Next field must be in next storage unit
+  signed char c : 2;
+};
+
+struct bar {
+  signed char x : 3;
+  signed char   : 3;  // Explicit padding
+  signed char y : 2;
+};
diff --git a/test-artefacts/headers/golden/types/structs/recursive_struct.h b/test-artefacts/headers/golden/types/structs/recursive_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/structs/recursive_struct.h
@@ -0,0 +1,12 @@
+typedef struct linked_list_A_s {
+  int x;
+  struct linked_list_A_s* next;
+} linked_list_A_t;
+
+// forward declaration, to avoid two names
+struct linked_list_B_t;
+typedef struct linked_list_B_t linked_list_B_t;
+struct linked_list_B_t {
+  int x;
+  linked_list_B_t* next;
+};
diff --git a/test-artefacts/headers/golden/types/structs/simple_structs.h b/test-artefacts/headers/golden/types/structs/simple_structs.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/structs/simple_structs.h
@@ -0,0 +1,35 @@
+// struct without typedef
+struct S1 {
+    int a;
+    char b;
+};
+
+// struct with typedef
+typedef struct S2 {
+    char a;
+    int b;
+    float c;
+} S2_t;
+
+// untagged struct with typedef
+typedef struct {
+    char a;
+} S3_t;
+
+struct S4 {
+    char b;
+    int a;
+    int *c;
+};
+
+// matching tags
+typedef struct S5 {
+    char a;
+    int b;
+} S5;
+
+struct S6 { char a; int b; };
+typedef struct S6 S6;
+
+typedef struct { char a; int b; } *S7a;
+typedef struct { char a; int b; } ***S7b;
diff --git a/test-artefacts/headers/golden/types/structs/struct_arg.h b/test-artefacts/headers/golden/types/structs/struct_arg.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/structs/struct_arg.h
@@ -0,0 +1,10 @@
+
+struct thing {
+    int x;
+};
+
+int thing_fun_1(struct thing x);
+struct thing thing_fun_2(int x);
+
+struct thing thing_fun_3a(int x, struct thing y, double z);
+char thing_fun_3b(int x, struct thing y, double z);
diff --git a/test-artefacts/headers/golden/types/structs/tagged_vs_untagged.h b/test-artefacts/headers/golden/types/structs/tagged_vs_untagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/structs/tagged_vs_untagged.h
@@ -0,0 +1,44 @@
+/** @file
+ * Test that we correctly distinguish between named and unnamed declarations
+ *
+ * For some reason clang gives us different results for short names (3
+ * characters or less) and longer names (4 more), it's unclear why. We test both
+ * in each category.
+ *
+ * NOTE: We can only successfully generate code for this with clang >= 19.1.0.
+ */
+
+#define STRUCT(name) name##_s
+#define PACKED __attribute__((__packed__))
+
+// simple name
+struct a {};
+struct struct1 {};
+
+// name using macro
+struct STRUCT(b) {};
+struct STRUCT(struct2) {};
+
+// simple name, simple attribute
+struct __attribute__((__packed__)) c {};
+struct __attribute__((__packed__)) struct3 {};
+
+// simple name, attribute using macro
+struct PACKED d {};
+struct PACKED struct4 {};
+
+// name using macro, attribute using macro
+struct PACKED STRUCT(e) {};
+struct PACKED STRUCT(struct5) {};
+
+// untagged
+typedef struct {} f;
+typedef struct {} typedef1;
+
+// untagged, simple attribute
+typedef struct __attribute__((__packed__)) {} g;
+typedef struct __attribute__((__packed__)) {} typedef2;
+
+// untagged, attribute using macro
+typedef struct PACKED {} h;
+typedef struct PACKED {} typedef3;
diff --git a/test-artefacts/headers/golden/types/structs/untagged.h b/test-artefacts/headers/golden/types/structs/untagged.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/structs/untagged.h
@@ -0,0 +1,31 @@
+// Struct containing an untagged inner struct
+struct S1 {
+  struct {
+    int a;
+    int b;
+  } c;
+
+  int d;
+};
+
+// Struct containing nested untagged structs
+struct S2 {
+  struct {
+    int a;
+    struct {
+      int b;
+    } deep;
+  } inner;
+
+  int d;
+};
+
+// Struct containing a _pointer to_ an untagged inner struct
+struct S3 {
+  struct {
+    int a;
+    int b;
+  } **c;
+
+  int d;
+};
diff --git a/test-artefacts/headers/golden/types/structs/untagged_struct.h b/test-artefacts/headers/golden/types/structs/untagged_struct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/structs/untagged_struct.h
@@ -0,0 +1,4 @@
+struct {
+    int foo;
+    int bar;
+};
diff --git a/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/array.h b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/array.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/array.h
@@ -0,0 +1,2 @@
+typedef void (*T[]) (int);
+typedef void (*U[3]) (int);
diff --git a/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/block.h b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/block.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/block.h
@@ -0,0 +1,1 @@
+typedef void (^T) (int);
diff --git a/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/direct.h b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/direct.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/direct.h
@@ -0,0 +1,1 @@
+typedef void T (int);
diff --git a/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/multi_level.h b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/multi_level.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/multi_level.h
@@ -0,0 +1,23 @@
+/*
+ * Multi-level function pointer typedefs
+ *
+ */
+
+/* Single level (regression test - should still work) */
+typedef void (*f1)(int x, int y);
+
+/* Double pointer */
+typedef void (**f2)(int x, int y);
+
+/* Triple pointer */
+typedef void (***f3)(int x, int y);
+
+/* Different return type */
+typedef int (**f4)(void);
+
+/* No arguments */
+typedef void (**f5)(void);
+
+/* With typedef'd types */
+typedef int MyInt;
+typedef void (**f6)(MyInt x);
diff --git a/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/pointer.h b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/pointer.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/pointer.h
@@ -0,0 +1,1 @@
+typedef void (*T) (int);
diff --git a/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/qual.h b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/qual.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/typedefs/auxiliary/function-pointer/qual.h
@@ -0,0 +1,1 @@
+typedef void (* const T) (int);
diff --git a/test-artefacts/headers/golden/types/typedefs/typedef_vs_macro.h b/test-artefacts/headers/golden/types/typedefs/typedef_vs_macro.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/typedefs/typedef_vs_macro.h
@@ -0,0 +1,19 @@
+typedef int T1;
+typedef char T2;
+
+#define M1 int
+#define M2 char
+#define M3 int*
+
+struct ExampleStruct {
+  T1 t1;
+  T2 t2;
+  M1 m1;
+  M2 m2;
+};
+
+#define uint64_t int
+
+struct foo {
+  uint64_t* a;
+};
diff --git a/test-artefacts/headers/golden/types/typedefs/typedefs.h b/test-artefacts/headers/golden/types/typedefs/typedefs.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/typedefs/typedefs.h
@@ -0,0 +1,18 @@
+typedef int myint;
+typedef int * intptr;
+
+// Unsupported function with a typedef type. See issue #1034.
+typedef int int2int(int);
+extern int2int foo;
+
+typedef void (*FunctionPointer_Function)(void);
+typedef int (NonFunctionPointer_Function)(int value);
+
+typedef void (*f1)(void);
+
+typedef void g1(void);
+typedef g1 * g2;
+
+typedef void h1(void);
+typedef h1 h2;
+typedef h2 * h3;
diff --git a/test-artefacts/headers/golden/types/typedefs/typenames.h b/test-artefacts/headers/golden/types/typedefs/typenames.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/typedefs/typenames.h
@@ -0,0 +1,26 @@
+/* note: we cannot also have struct foo, clang and gcc say:
+
+ - use of 'foo' with tag type that does not match previous declaration
+ - ‘foo’ defined as wrong kind of tag
+
+ respectively.
+
+struct foo {
+	int x;
+	int y;
+};
+*/
+
+enum foo {
+	FOO1,
+	FOO2
+};
+
+typedef double foo;
+
+/* we use enum foo as an example, as here Rust bindgen defines the same type twice:
+
+pub type foo = ::std::os::raw::c_uint;
+pub type foo = f64;
+
+*/
diff --git a/test-artefacts/headers/golden/types/unions/bitfields.h b/test-artefacts/headers/golden/types/unions/bitfields.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/unions/bitfields.h
@@ -0,0 +1,80 @@
+#pragma once
+
+/* not packed, <=8-bit fields */
+union foo_8 {
+  signed char a : 3;
+  signed char b : 3;
+  signed char c : 2;
+  signed char d : 3;
+  signed char e : 8;
+  signed char f : 5;
+};
+
+/* not packed, <=16-bit fields */
+union foo_16 {
+  signed char a :  6;
+  signed int  b : 10;
+  signed int  c : 16;
+  signed int  d : 16;
+  signed int  e : 12;
+  signed int  f : 12;
+};
+
+/* not packed, <=32-bit fields */
+union foo_32 {
+  signed char a :  6;
+  signed int  b : 12;
+  signed int  c : 14;
+  signed int  d : 10;
+  signed long e : 32;
+  signed int  f :  6;
+  signed long g : 24;
+};
+
+/* not packed, <=64-bit fields */
+union foo_64 {
+  signed long      a : 24;
+  signed long long b : 40;
+  signed long long c : 64;
+  signed long long d : 36;
+};
+
+/* packed, <=8-bit fields */
+union __attribute__((packed)) foo_8_packed {
+  signed char a : 3;
+  signed char b : 3;
+  signed char c : 2;
+  signed char d : 3;
+  signed char e : 8;
+  signed char f : 5;
+};
+
+/* packed, <=16-bit fields */
+union __attribute__((packed)) foo_16_packed {
+  signed char a :  6;
+  signed int  b : 10;
+  signed int  c : 16;
+  signed int  d : 16;
+  signed int  e : 12;
+  signed int  f : 12;
+};
+
+/* packed, <=32-bit fields */
+union __attribute__((packed)) foo_32_packed {
+  signed char a :  6;
+  signed int  b : 12;
+  signed int  c : 14;
+  signed int  d : 10;
+  signed long e : 32;
+  signed int  f :  6;
+  signed long g : 24;
+};
+
+/* packed, <=64-bit fields */
+union __attribute__((packed)) foo_64_packed {
+  signed long      a : 24;
+  signed long long b : 40;
+  signed long long c : 64;
+  signed long long d : 36;
+};
+
diff --git a/test-artefacts/headers/golden/types/unions/nested_unions.h b/test-artefacts/headers/golden/types/unions/nested_unions.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/unions/nested_unions.h
@@ -0,0 +1,14 @@
+struct exA {
+        union unionA {
+                int a;
+                char b; 
+        } fieldA1;
+};     
+
+struct exB {
+        union {
+                int a;
+                char b; 
+        } fieldB1;
+};      
+
diff --git a/test-artefacts/headers/golden/types/unions/unions.h b/test-artefacts/headers/golden/types/unions/unions.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/golden/types/unions/unions.h
@@ -0,0 +1,37 @@
+struct Dim2 {
+    int x;
+    int y;
+};
+
+struct Dim3 {
+    int x;
+    int y;
+    int z;
+};
+
+union DimPayload {
+    struct Dim2 dim2;
+    struct Dim2 dim3;
+};
+
+struct Dim {
+    int tag;
+    union DimPayload payload;
+};
+
+// typedef name matches union tag
+typedef union DimPayloadB {
+    struct Dim2 dim2;
+    struct Dim2 dim3;
+} DimPayloadB;
+
+struct DimB {
+    int tag;
+    DimPayloadB payload;
+};
+
+// union with untagged struct fields
+union UntaggedA {
+    struct { double x; double y; } xy;
+    struct { double r; double p; } polar;
+};
diff --git a/test-artefacts/headers/invalid_standard_types.h b/test-artefacts/headers/invalid_standard_types.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/invalid_standard_types.h
@@ -0,0 +1,9 @@
+#ifndef STANDARD_TYPES_H
+#define STANDARD_TYPES_H
+
+struct ContainsStandardTypes {
+        uint64_t field_uint64_t;
+        clock_t field_clock_t;
+};
+
+#endif
diff --git a/test-artefacts/headers/minimal.h b/test-artefacts/headers/minimal.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/minimal.h
@@ -0,0 +1,1 @@
+typedef char sym;
diff --git a/test-artefacts/headers/standard_types.h b/test-artefacts/headers/standard_types.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/standard_types.h
@@ -0,0 +1,12 @@
+#ifndef STANDARD_TYPES_H
+#define STANDARD_TYPES_H
+
+#include <time.h>
+#include <stdint.h>
+
+struct ContainsStandardTypes {
+        uint64_t field_uint64_t;
+        clock_t field_clock_t;
+};
+
+#endif
diff --git a/test-artefacts/headers/static_counter.h b/test-artefacts/headers/static_counter.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/static_counter.h
@@ -0,0 +1,14 @@
+#ifndef STATIC_COUNTER_H
+#define STATIC_COUNTER_H
+
+static int counter = 0;
+
+static int count(void) {
+  return counter++;
+}
+
+static void reset(void) {
+  counter = 0;
+}
+
+#endif
diff --git a/test-artefacts/headers/test_01.h b/test-artefacts/headers/test_01.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/test_01.h
@@ -0,0 +1,431 @@
+/* This example header contains various definitions
+ * to smoke test hs-bindgen code generation end-to-end.
+ * See test-th and test-pp tests.
+ */
+
+/**
+ * @file test_01.h
+ *
+ * @brief Example header containing various definitions to smoke test hs-bindgen code generation end-to-end.
+ * @details This file demonstrates various Doxygen documentation features
+ *          including commands, lists, code examples, and more.
+ *
+ * @note This is a test file for documentation generation
+ * @warning Do not use in production without review
+ */
+
+#ifndef TEST_01_H
+#define TEST_01_H
+
+/* Standard headers. */
+#include <stdlib.h>
+
+/**
+ * @struct StructBasic
+ * @brief Basic structure with two fields.
+ * @details This structure demonstrates simple field documentation
+ *          with inline comments.
+ *
+ * Example usage:
+ *
+ * @code
+ * struct StructBasic sb;
+ * sb.field1 = 42;
+ * sb.field2 = 'A';
+ * @endcode
+ *
+ * @invariant field1 should be positive in normal usage
+ * @since 1.0
+ */
+struct StructBasic {
+    int field1;  /**< Integer field. @note Usually positive */
+    char field2; /**< Character field. Valid range: @b A-Z */
+};
+
+/**
+ * @struct StructFixedSizeArray
+ * @brief Structure containing a fixed size array.
+ *
+ * @attention The array size is fixed at compile time
+ *
+ * Memory layout:
+ * - 4 bytes for integer x
+ * - 5 bytes for character array
+ * - Padding may be added by compiler
+ */
+struct StructFixedSizeArray {
+    int x;       /**< Integer value. @sa StructBasic::field1 */
+    char ys[5];  /**< Fixed size character array of length 5
+                      @warning Not null-terminated by default */
+};
+
+/**
+ * @def PLUS(x,y)
+ * @brief Macro that adds two values and adds 1L to the result.
+ * @details This macro demonstrates parameter documentation and
+ *          potential issues with macro expansion.
+ *
+ * @param[in] x First operand (should be parenthesized)
+ * @param[in] y Second operand (should be parenthesized)
+ * @return The result of x + y + 1L
+ *
+ * @warning This macro doesn't parenthesize arguments, so be careful with:
+ * @code
+ * PLUS(a & b, c | d)  // Probably not what you want!
+ * @endcode
+ *
+ * @todo Add parentheses for safety
+ */
+#define PLUS(x,y) x + y + 1L
+
+/**
+ * @struct StructBitfield
+ * @brief Structure with bitfield definitions.
+ * @details Demonstrates various bitfield sizes and their documentation.
+ *
+ * Total size considerations:
+ * -# Regular int field: 32 bits
+ * -# Bitfields packed together: 7 bits total
+ * -# Compiler may add padding
+ *
+ * @par Thread Safety:
+ * Bitfield access is not atomic. Use appropriate synchronization.
+ */
+struct StructBitfield {
+    int a;               /**< Integer field (full width) */
+    unsigned int b : 1;  /**< 1-bit flag. @c 0 = false, @c 1 = true */
+    unsigned int c : 1;  /**< 1-bit flag. Values: {0, 1} */
+    int d : 5;          /**< 5-bit signed field. Range: [-16, 15] */
+};
+
+/**
+ * @brief Multiply and add function (fused multiply-add).
+ * @details Computes @f$ result = x \times y + z @f$
+ *
+ * This function demonstrates:
+ * - Parameter direction documentation
+ * - Mathematical formulas
+ * - Example code
+ *
+ * @param[in] x First multiplier
+ * @param[in] y Second multiplier
+ * @param[in] z Addend
+ * @return The result of (x * y) + z
+ *
+ * @par Example:
+ * @code
+ * int result = my_fma(3, 4, 5);  // Returns 17
+ * @endcode
+ *
+ * @note No overflow checking is performed
+ * @see https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation
+ */
+static inline int my_fma(int x, int y, int z) {
+    return x * y + z;
+}
+
+/**
+ * @struct StructFLAM
+ * @brief Structure with a flexible array member.
+ * @details Contains a length field and a flexible array of long integers.
+ *          This is a C99 feature.
+ *
+ * @par Memory Management:
+ * Must be allocated dynamically with extra space for the array:
+ * @code
+ * size_t size = sizeof(struct StructFLAM) + n * sizeof(long);
+ * struct StructFLAM *p = malloc(size);
+ * @endcode
+ *
+ * @remark Flexible array members must be the last member
+ * @since C99
+ */
+struct StructFLAM {
+    int length;     /**< Number of elements in the flexible array
+                         @invariant length >= 0 */
+    long numbers[]; /**< Flexible array member of long integers
+                         @warning Must not be accessed beyond length */
+};
+
+/**
+ * @brief Allocate a StructFLAM with space for n elements.
+ * @details Initializes the numbers array with values from 0 to n-1.
+ *          This demonstrates proper allocation of flexible array members.
+ *
+ * Algorithm:
+ * -# Allocate memory for structure plus array
+ * -# Set length field
+ * -# Initialize array elements sequentially
+ *
+ * @param[in] n Number of elements to allocate in the flexible array
+ * @pre n >= 0
+ * @return Pointer to the allocated StructFLAM, or NULL if allocation fails
+ * @retval NULL if allocation fails or n < 0
+ * @retval non-NULL pointer to initialized structure
+ *
+ * @par Error Handling:
+ * Check return value for NULL before use.
+ *
+ * @b Example:
+ * @code
+ * struct StructFLAM *arr = flam_alloc(10);
+ * if (arr) {
+ *     // Use arr
+ *     flam_free(arr);
+ * }
+ * @endcode
+ *
+ * @sa flam_free()
+ */
+static inline struct StructFLAM *flam_alloc(int n) {
+    struct StructFLAM *ptr = malloc(sizeof(struct StructFLAM) + sizeof(long) * n);
+    if (ptr) {
+        ptr->length = n;
+        for (int i = 0; i < n; ++i) {
+            ptr->numbers[i] = i; /**< Initialize each element with its index */
+        }
+    }
+    return ptr;
+}
+
+/**
+ * @brief Free a previously allocated StructFLAM.
+ *
+ * @param[in,out] ptr Pointer to the StructFLAM to free
+ * @pre ptr must be either NULL or a valid pointer returned by flam_alloc()
+ * @post ptr is no longer valid after this call
+ *
+ * @note Safe to call with NULL pointer
+ * @sa flam_alloc()
+ */
+static inline void flam_free(struct StructFLAM *ptr) {
+    free(ptr);
+}
+
+/**
+ * @brief Reverses the elements in the flexible array member in place.
+ *
+ * @param s Pointer to the structure containing the numbers to reverse.
+ *          If @p s is NULL or @c s->length < 2, the function returns immediately.
+ */
+static inline void reverse(struct StructFLAM *s) {
+    if (!s || s->length < 2) return;
+
+    for (int i = 0, j = s->length - 1; i < j; i++, j--) {
+        long temp = s->numbers[i];
+        s->numbers[i] = s->numbers[j];
+        s->numbers[j] = temp;
+    }
+}
+
+/**
+ * @union longDouble
+ * @brief Union representing a value as either a long long or a double.
+ * @details This union demonstrates type punning capabilities.
+ *
+ * @warning Type punning through unions may have undefined behavior
+ *          in some cases. Use with caution.
+ *
+ * Size: @c sizeof(double) or @c sizeof(long long), whichever is larger
+ */
+union longLongOrDouble {
+    long long l; /**< Value interpreted as long long (typically 64 bits) */
+    double d;    /**< Value interpreted as double (IEEE 754 double precision) */
+};
+
+/**
+ * @defgroup enumerations Enumeration Types
+ * @brief Various enumeration examples
+ * @details These enumerations demonstrate different patterns and documentation styles.
+ * @{
+ */
+
+/**
+ * @enum EnumBasic
+ * @brief Basic enumeration with sequential values starting at 0.
+ *
+ * This enumeration uses default values:
+ * - First element starts at 0
+ * - Subsequent elements increment by 1
+ */
+enum EnumBasic {
+    ENUM_BASIC_A, /**< First value (implicitly 0) */
+    ENUM_BASIC_B, /**< Second value (implicitly 1) */
+    ENUM_BASIC_C  /**< Third value (implicitly 2) */
+};
+
+/**
+ * @enum EnumNeg
+ * @brief Enumeration starting with a negative value.
+ *
+ * Demonstrates that enums can have negative values.
+ *
+ */
+enum EnumNeg {
+    ENUM_NEG_A = -1, /**< Negative starting value */
+    ENUM_NEG_B,      /**< Zero (incremented from -1) */
+    ENUM_NEG_C       /**< Positive value */
+};
+
+/**
+ * @enum EnumNonSeq
+ * @brief Enumeration with non-sequential values.
+ * @details Used for status codes or magic numbers.
+ *
+ * Common uses:
+ * - HTTP status codes
+ * - Error codes
+ * - Protocol constants
+ */
+enum EnumNonSeq {
+    ENUM_NON_SEQ_A = 200, /**< @brief OK status
+                               @details Similar to HTTP 200 */
+    ENUM_NON_SEQ_B = 301, /**< @brief Redirect status
+                               @details Similar to HTTP 301 */
+    ENUM_NON_SEQ_C = 404  /**< @brief Not found status
+                               @details Similar to HTTP 404 */
+};
+
+/**
+ * @enum EnumSame
+ * @brief Enumeration with multiple constants sharing the same value.
+ * @warning Be careful when switching on these values
+ *
+ * @deprecated Consider using unique values to avoid confusion
+ */
+enum EnumSame {
+    ENUM_SAME_A = 0,   /**< Initial state */
+    ENUM_SAME_B = 100, /**< State B */
+    ENUM_SAME_C = 100, /**< State C @warning Same value as ENUM_SAME_B */
+    ENUM_SAME_D = 200  /**< Final state */
+};
+
+/** @} */ // end of enumerations group
+
+/**
+ * @struct thing
+ * @brief Simple structure with a single integer field.
+ * @details This structure is used to demonstrate function parameters
+ *          and return values with structures.
+ *
+ * @par Design Rationale:
+ * Kept simple to test structure passing mechanisms.
+ */
+struct thing {
+    int x; /**< Integer field. Can be negative. */
+};
+
+/**
+ * @brief Returns the integer field of a thing.
+ * @details Simple accessor function.
+ *
+ * @param[in] x A struct thing (passed by value)
+ * @return The value of x.x
+ *
+ * @par Performance Note:
+ * Structure is passed by value, which may be inefficient for larger structures.
+ */
+static inline int thing_fun_1(struct thing x) {
+    return x.x;
+}
+
+/**
+ * @brief Creates a struct thing initialized with the given integer.
+ *
+ * @param[in] x Integer to initialize the thing's field
+ * @return A struct thing with field x set to the parameter
+ *
+ * @code
+ * struct thing t = thing_fun_2(42);
+ * assert(t.x == 42);
+ * @endcode
+ */
+static inline struct thing thing_fun_2(int x) {
+    struct thing res = { .x = x };
+    return res;
+}
+
+/**
+ * @brief Returns a struct thing with the field doubled.
+ * @details Demonstrates structure transformation.
+ *
+ * @param[in] x A struct thing
+ * @return A struct thing with field x equal to input x.x multiplied by 2
+ *
+ * @note May overflow if x.x > INT_MAX/2
+ *
+ * @par Example Chain:
+ * @code
+ * struct thing t1 = thing_fun_2(10);
+ * struct thing t2 = thing_fun_3(t1);  // t2.x == 20
+ * struct thing t3 = thing_fun_3(t2);  // t3.x == 40
+ * @endcode
+ */
+static inline struct thing thing_fun_3(struct thing x) {
+    struct thing res = { .x = x.x * 2 };
+    return res;
+}
+
+/**
+ * @brief Sums an integer and the elements of a fixed-size array of length 3.
+ * @details The first element of the array is doubled before summing.
+ *
+ * @param[in] x Integer value
+ * @param[in,out] xs Array of 3 integers (first element modified!)
+ * @return Sum of x and the modified array elements
+ *
+ * @warning This function modifies the input array!
+ *
+ * @par Side Effects:
+ * - @c xs[0] is multiplied by 2
+ * - Other array elements unchanged
+ *
+ * @code
+ * int arr[3] = {1, 2, 3};
+ * int result = sum3(10, arr);
+ * // result == 10 + 2 + 2 + 3 == 17
+ * // arr is now {2, 2, 3}
+ * @endcode
+ */
+static inline int sum3(int x, const int xs[3]) {
+    const int x0 = xs[0] * 2;
+    return x + x0 + xs[1] + xs[2];
+}
+
+/**
+ * @typedef triple
+ * @brief Type alias for an array of 3 integers.
+ * @details Demonstrates typedef with arrays.
+ *
+ * @note Array parameters decay to pointers in C
+ *
+ * Usage patterns:
+ * -# Stack allocation: @c triple t = {1, 2, 3};
+ * -# Initialization: @c triple t = {0}; // All zeros
+ * -# Parameter passing: Decays to @c int*
+ */
+typedef int triple[3];
+
+/**
+ * @brief Sums an integer and the elements of a triple array.
+ * @details The first element of the array is tripled before summing.
+ *
+ * Comparison with sum3():
+ * - sum3: multiplies first element by 2
+ * - sum3b: multiplies first element by 3
+ *
+ * @param[in] x Integer value
+ * @param[in,out] xs Triple array of integers
+ * @return Sum of x and the modified array elements
+ *
+ * @pre xs must point to at least 3 integers
+ * @post xs[0] = original xs[0] * 3
+ *
+ * @see sum3()
+ */
+static inline int sum3b(int x, const triple xs) {
+    int x0 = xs[0] * 3;
+    return x + x0 + xs[1] + xs[2];
+}
+
+#endif /* TEST_01_H */
diff --git a/test-artefacts/headers/test_02.h b/test-artefacts/headers/test_02.h
new file mode 100644
--- /dev/null
+++ b/test-artefacts/headers/test_02.h
@@ -0,0 +1,17 @@
+/* This test header contains types from the standard library that may use
+ * external bindings.  See the test-pp and test-th tests.
+ */
+
+#ifndef TEST_02_H
+#define TEST_02_H
+
+#include <stdint.h>
+#include <time.h>
+
+struct event {
+    uint64_t id;  // external binding in base
+    char *name;
+    time_t time;  // external binding in base
+};
+
+#endif // TEST_02_H
diff --git a/test/common/Test/Common/HsBindgen/Trace.hs b/test/common/Test/Common/HsBindgen/Trace.hs
new file mode 100644
--- /dev/null
+++ b/test/common/Test/Common/HsBindgen/Trace.hs
@@ -0,0 +1,19 @@
+module Test.Common.HsBindgen.Trace (
+  reportTrace
+  ) where
+
+import Text.SimplePrettyPrint (CtxDoc, (><))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Util.Tracer
+
+-- Seeing both, the pretty trace and the 'Show' instance greatly simplifies test
+-- design and debugging.
+reportTrace :: forall a l. (IsTrace l a, Show a) => a -> CtxDoc
+reportTrace trace = PP.vcat $ [
+      "[" >< ppTraceId >< "][pretty] " >< prettyForTrace trace
+    , "[" >< ppTraceId >< "][show  ] " >< PP.show trace
+    , ""
+    ]
+  where
+    ppTraceId = PP.string (getTraceId trace).id
diff --git a/test/common/Test/Common/HsBindgen/Trace/Patterns.hs b/test/common/Test/Common/HsBindgen/Trace/Patterns.hs
new file mode 100644
--- /dev/null
+++ b/test/common/Test/Common/HsBindgen/Trace/Patterns.hs
@@ -0,0 +1,238 @@
+-- | Pattern synonyms for working with traces
+module Test.Common.HsBindgen.Trace.Patterns (
+    -- * Clang
+    pattern MatchDiagnosticOption
+  , pattern MatchDiagnosticCategory
+  , matchDiagnosticSpelling
+    -- * Parse
+  , pattern MatchImmediate
+  , pattern MatchDelayed
+  , pattern MatchDelayedImplicitField
+    -- * Doxygen
+  , pattern MatchDoxygen
+    -- * PrepareReparse
+  , pattern MatchImmediatePrepareReparse
+  , pattern MatchDelayedPrepareReparse
+    -- * ReparseMacroExpansions
+  , pattern MatchImmediateReparseMacroExpansions
+  , pattern MatchDelayedReparseMacroExpansions
+    -- * ResolveBindingSpecs
+  , pattern MatchBindingSpec
+  , pattern MatchResolveBindingSpecs
+    -- * MangleNames
+  , pattern MatchMangle
+    -- * TranslateTypes
+  , pattern MatchImmediateTranslateTypes
+  , pattern MatchDelayedTranslateTypes
+    -- * Select
+  , pattern MatchNoDeclarations
+  , pattern MatchMacrosDropped
+  , pattern MatchSelect
+  , pattern MatchUnusable
+  , pattern MatchTransMissing
+  , pattern MatchTransNotSelected
+  , pattern MatchTransUnusable
+  ) where
+
+import Data.Text qualified as Text
+
+import HsBindgen.Doxygen (DoxygenMsg)
+import HsBindgen.Frontend.Analysis.DeclIndex
+import HsBindgen.Frontend.Pass.Parse.Msg (ParseImplicitFieldsMsg)
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg (DelayedPrepareReparseMsg,
+                                                          PrepareReparseMsg)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass (ReparseMacroExpansions)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.Msg (DelayedReparseMacroExpansionsMsg)
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Pass.TranslateTypes.IsPass.Msg (DelayedTranslateTypesMsg,
+                                                          TranslateTypesMsg)
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass.Msg (PassMsg (Msg))
+import HsBindgen.TraceMsg
+
+{-------------------------------------------------------------------------------
+  Clang
+-------------------------------------------------------------------------------}
+
+pattern MatchDiagnosticOption :: Text -> TraceMsg
+pattern MatchDiagnosticOption x <- TraceFrontend (
+      FrontendClang (
+          ClangDiagnostic Diagnostic{diagnosticOption = Just x}
+        )
+    )
+
+pattern MatchDiagnosticCategory :: Text -> TraceMsg
+pattern MatchDiagnosticCategory x <- TraceFrontend (
+      FrontendClang (
+          ClangDiagnostic (diagnosticCategoryText -> x)
+        )
+    )
+
+matchDiagnosticSpelling :: Text -> TraceMsg -> Maybe Text
+matchDiagnosticSpelling text = \case
+    TraceFrontend (
+        FrontendClang (
+            ClangDiagnostic diag
+          )
+      ) ->
+      if text `Text.isInfixOf` diag.diagnosticSpelling
+        then Just diag.diagnosticSpelling
+        else Nothing
+    _otherwise ->
+      Nothing
+
+{-------------------------------------------------------------------------------
+  Parse
+-------------------------------------------------------------------------------}
+
+pattern MatchImmediate :: C.DeclName -> ImmediateParseMsg -> TraceMsg
+pattern MatchImmediate name x <- TraceFrontend (
+      FrontendParse C.WithLocationInfo{
+          loc = C.locationInfoName -> Just name
+        , msg = x
+        }
+    )
+
+pattern MatchDelayed :: C.DeclName -> DelayedParseMsg -> TraceMsg
+pattern MatchDelayed name x <- MatchSelect name (matchDelayed -> Just x)
+
+pattern MatchDelayedImplicitField ::
+     C.DeclName
+  -> ParseImplicitFieldsMsg
+  -> TraceMsg
+pattern MatchDelayedImplicitField name x <- MatchDelayed name (ParseImplicitFieldFailed x)
+
+{-------------------------------------------------------------------------------
+  Doxygen
+-------------------------------------------------------------------------------}
+
+pattern MatchDoxygen :: DoxygenMsg -> TraceMsg
+pattern MatchDoxygen x <- TraceFrontend (FrontendDoxygen x)
+
+{-------------------------------------------------------------------------------
+  PrepareReparse
+-------------------------------------------------------------------------------}
+
+pattern MatchImmediatePrepareReparse :: PrepareReparseMsg -> TraceMsg
+pattern MatchImmediatePrepareReparse x <- TraceFrontend (
+      FrontendPrepareReparse x
+    )
+
+pattern MatchDelayedPrepareReparse ::
+     C.DeclName
+  -> DelayedPrepareReparseMsg
+  -> TraceMsg
+pattern MatchDelayedPrepareReparse name x <- MatchSelect name (matchDelayedPrepareReparse -> Just x)
+
+matchDelayedPrepareReparse :: SelectMsg -> Maybe DelayedPrepareReparseMsg
+matchDelayedPrepareReparse = \case
+    SelectDelayedPrepareReparseMsg x -> Just x
+    _otherwise -> Nothing
+
+{-------------------------------------------------------------------------------
+  ReparseMacroExpansions
+-------------------------------------------------------------------------------}
+
+pattern MatchImmediateReparseMacroExpansions :: Msg ReparseMacroExpansions -> TraceMsg
+pattern MatchImmediateReparseMacroExpansions x <- TraceFrontend (
+      FrontendReparseMacroExpansions x
+    )
+
+pattern MatchDelayedReparseMacroExpansions ::
+     C.DeclName
+  -> DelayedReparseMacroExpansionsMsg
+  -> TraceMsg
+pattern MatchDelayedReparseMacroExpansions name x <- MatchSelect name (matchDelayedReparseMacroExpansions -> Just x)
+
+matchDelayedReparseMacroExpansions :: SelectMsg -> Maybe DelayedReparseMacroExpansionsMsg
+matchDelayedReparseMacroExpansions = \case
+    SelectDelayedReparseMacroExpansionsMsg x -> Just x
+    _otherwise -> Nothing
+
+{-------------------------------------------------------------------------------
+  ResolveBindingSpecs
+-------------------------------------------------------------------------------}
+
+pattern MatchBindingSpec :: BindingSpecMsg -> TraceMsg
+pattern MatchBindingSpec x <- TraceBoot (
+      BootBindingSpec x
+    )
+
+pattern MatchResolveBindingSpecs :: ResolveBindingSpecsMsg -> TraceMsg
+pattern MatchResolveBindingSpecs x <- TraceFrontend (
+      FrontendResolveBindingSpecs x
+    )
+
+{-------------------------------------------------------------------------------
+  MangleNames
+-------------------------------------------------------------------------------}
+
+pattern MatchMangle :: C.DeclName -> MangleNamesMsg -> TraceMsg
+pattern MatchMangle name x <- TraceFrontend (
+      FrontendMangleNames C.WithLocationInfo{
+           loc = C.locationInfoName -> Just name
+         , msg = x
+        }
+    )
+
+{-------------------------------------------------------------------------------
+  TranslateTypes
+-------------------------------------------------------------------------------}
+
+pattern MatchImmediateTranslateTypes :: TranslateTypesMsg -> TraceMsg
+pattern MatchImmediateTranslateTypes x <- TraceFrontend (FrontendTranslateTypes x)
+
+pattern MatchDelayedTranslateTypes :: C.DeclName -> DelayedTranslateTypesMsg -> TraceMsg
+pattern MatchDelayedTranslateTypes name x <- MatchSelect name (SelectDelayedTranslateTypesMsg x)
+
+{-------------------------------------------------------------------------------
+  Select
+-------------------------------------------------------------------------------}
+
+pattern MatchNoDeclarations :: TraceMsg
+pattern MatchNoDeclarations <- TraceFrontend (
+      FrontendSelect C.WithLocationInfo{
+          msg = SelectNoDeclarationsMatched
+        }
+    )
+
+pattern MatchMacrosDropped :: Int -> TraceMsg
+pattern MatchMacrosDropped n <- TraceFrontend (
+      FrontendSelect C.WithLocationInfo{
+          msg = SelectMacrosDropped n
+        }
+    )
+
+pattern MatchSelect :: C.DeclName -> SelectMsg -> TraceMsg
+pattern MatchSelect name x <- TraceFrontend (
+      FrontendSelect C.WithLocationInfo{
+          loc = C.locationInfoName -> Just name
+        , msg = x
+        }
+    )
+
+pattern MatchUnusable :: C.DeclName -> UnusableReason -> TraceMsg
+pattern MatchUnusable name x <- MatchSelect name (SelectUnusable x)
+
+-- | Transitive dependencies of a declaration are missing
+pattern MatchTransMissing :: [TransitiveDependencyMissing] -> SelectMsg
+pattern MatchTransMissing xs <- TransitiveDependenciesMissing _ xs
+
+-- | A single transitive dependency of a declaration was not selected
+pattern MatchTransNotSelected :: TransitiveDependencyMissing
+pattern MatchTransNotSelected <- TransitiveDependencyNotSelected _ _
+
+-- | A single transitive dependency of a declaration is unusable
+pattern MatchTransUnusable :: UnusableEntry -> TransitiveDependencyMissing
+pattern MatchTransUnusable x <- TransitiveDependencyUnusable _ x
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary
+-------------------------------------------------------------------------------}
+
+matchDelayed :: SelectMsg -> Maybe DelayedParseMsg
+matchDelayed = \case
+    SelectDelayedParseMsg x                 -> Just x
+    SelectUnusable (UnusableParseFailure x) -> Just x
+    _otherwise                              -> Nothing
diff --git a/test/common/Test/Common/HsBindgen/Trace/Predicate.hs b/test/common/Test/Common/HsBindgen/Trace/Predicate.hs
new file mode 100644
--- /dev/null
+++ b/test/common/Test/Common/HsBindgen/Trace/Predicate.hs
@@ -0,0 +1,366 @@
+-- | Predicates on trace messages
+--
+-- Intended for unqualified import.
+module Test.Common.HsBindgen.Trace.Predicate (
+    -- * Predicate
+    TraceExpectation (..)
+  , TracePredicate -- opaque
+  , RenderLabel(..)
+  , GotExpectedTrace(..)
+  , GotTraceLabelled(..)
+  , defaultTracePredicate
+  , tolerateAll
+  , singleTracePredicate
+  , multiTracePredicate
+  , multiTracePredicateCustomLogLevel
+  , TraceExpectationException
+    -- * Tracer
+  , quietTracerConfig
+  , withTracePredicate
+  , withTraceConfigPredicate
+  ) where
+
+import Control.Exception (Exception (..), catch, throwIO)
+import Control.Monad.Except (Except, runExcept, throwError)
+import Data.Foldable qualified as Foldable
+import Data.IORef (modifyIORef', newIORef, readIORef)
+import Data.Map.Strict (Map)
+import Data.Map.Strict qualified as Map
+import Data.Maybe (fromMaybe)
+import Data.String
+import Data.Text (Text)
+import Data.Text qualified as Text
+import Data.Typeable (Typeable)
+import Text.SimplePrettyPrint (CtxDoc)
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Clang
+import HsBindgen.Errors
+import HsBindgen.Imports (Default (def))
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Util.Tracer
+
+import Test.Common.HsBindgen.Trace
+
+{-------------------------------------------------------------------------------
+  Trace predicates
+-------------------------------------------------------------------------------}
+
+data TraceExpectation b = Expected b | Tolerated | Unexpected
+  deriving stock (Show, Eq, Ord, Functor)
+
+data TracePredicate l a = TracePredicate {
+    _customLogLevel :: CustomLogLevel l a
+  , _tracePredicate :: [a] -> Except (TraceExpectationException a) ()
+  }
+
+-- | By default, we do not expect any warnings, nor errors ('Unexpected'). Info
+-- and debug messages are 'Tolerate'd.
+defaultTracePredicate :: IsTrace Level a => TracePredicate Level a
+defaultTracePredicate =
+    customTracePredicateAux @GotExpectedTrace mempty [] (const Nothing)
+
+-- | Tolerate /all/ traces
+--
+-- Useful for tests where we don't care about the trace messages, and want to
+-- look at test output only.
+tolerateAll :: IsTrace Level a => TracePredicate Level a
+tolerateAll =
+    customTracePredicateAux @GotExpectedTrace mempty [] (const $ Just Tolerated)
+
+-- | Expect a trace with given name exactly one time.
+singleTracePredicate ::
+     IsTrace Level a
+  => (a -> Maybe (TraceExpectation ()))
+  -> TracePredicate Level a
+singleTracePredicate predicate =
+    customTracePredicateAux
+      mempty
+      [GotExpectedTrace]
+      (fmap (fmap (\() -> GotExpectedTrace)) . predicate)
+
+multiTracePredicate :: forall b a.
+     (IsTrace Level a, Show a, Ord b, RenderLabel b)
+  => [b]
+  -- ^ Names/identifiers of expected traces. If a trace is expected N times, add
+  -- the name/identifier N times to the list.
+  -> (a -> Maybe (TraceExpectation b))
+  -- ^ 'Nothing' defaults to 'defaultTracePredicate'.
+  -> TracePredicate Level a
+multiTracePredicate expected predicate =
+    customTracePredicateAux
+       mempty
+       (map GotTraceLabelled expected)
+       (fmap (fmap GotTraceLabelled) . predicate)
+
+-- | Like 'multiTracePredicate' but allows for a custom log level.
+multiTracePredicateCustomLogLevel :: forall b a.
+     (IsTrace Level a, Show a, Ord b, RenderLabel b)
+  => CustomLogLevel Level a
+  -> [b]
+  -> (a -> Maybe (TraceExpectation b))
+  -> TracePredicate Level a
+multiTracePredicateCustomLogLevel customLogLevel expected predicate =
+    customTracePredicateAux
+       customLogLevel
+       (map GotTraceLabelled expected)
+       (fmap (fmap GotTraceLabelled) . predicate)
+
+-- | Internal generalization
+customTracePredicateAux :: forall b a.
+     (IsTrace Level a, Ord b, WrongCountMsg a b)
+  => CustomLogLevel Level a
+  -> [b]
+  -> (a -> Maybe (TraceExpectation b))
+  -> TracePredicate Level a
+customTracePredicateAux customLogLevel names mpredicate =
+    TracePredicate customLogLevel $ \traces -> do
+      let (unexpected, actualCounts) =
+            Foldable.foldl' checkTrace ([], Map.empty) traces
+          checkTrace (ts, counts) trace = case predicate trace of
+            Expected name -> (ts        , Map.insertWith (<>) name [trace] counts)
+            Tolerated     -> (ts        , counts            )
+            Unexpected    -> (trace : ts, counts            )
+      if null unexpected && expectedCounts == Map.map length actualCounts
+        then pure ()
+        else
+          let additionalCounts = actualCounts `Map.difference` expectedCounts
+              additionalWrongCounts = [ wrongCount name 0 (length actual) actual
+                                      | (name, actual) <- Map.toList additionalCounts
+                                      ]
+              wrongCounts = [ wrongCount name expected (length actual) actual
+                            | (name, expected) <- Map.toList expectedCounts
+                            , let actual = fromMaybe [] (name `Map.lookup` actualCounts)
+                            , length actual /= expected
+                            ]
+           in throwError $ TraceExpectationException {
+                  unexpectedTraces = unexpected
+                , wrongCounts      = wrongCounts ++ additionalWrongCounts
+                }
+  where
+    getLogLevel :: a -> Level
+    getLogLevel x = applyCustomLogLevel customLogLevel x (getDefaultLogLevel x)
+
+    defaultTracePredicateSimple :: a -> TraceExpectation b
+    defaultTracePredicateSimple x = case getLogLevel x of
+        Error        -> Unexpected
+        Bug          -> Unexpected
+        Warning      -> Unexpected
+        Notice       -> Tolerated
+        Info         -> Tolerated
+        Debug        -> Tolerated
+
+    predicate :: a -> TraceExpectation b
+    predicate trace = fromMaybe (defaultTracePredicateSimple $ trace) (mpredicate trace)
+
+    expectedCounts :: Counter b
+    expectedCounts = count names
+
+{-------------------------------------------------------------------------------
+  Tracer
+-------------------------------------------------------------------------------}
+
+quietTracerConfig :: TracerConfig l a
+quietTracerConfig = def {
+      outputConfig = OutputConfigCustom OutputCustom{
+          report    = noOutput
+        , ansiColor = DisableAnsiColor
+        }
+    }
+  where
+    noOutput _lvl _trace _traceStr = pure ()
+
+-- | Run an action with a tracer that collects all trace messages.
+--
+-- Use a t'TracePredicate' to decide whether traces are expected, or unexpected.
+withTracePredicate ::
+     (Typeable a, IsTrace Level a, Show a)
+  => (String -> IO ())
+  -> TracePredicate Level a
+  -> (Tracer a -> IO b)
+  -> IO b
+withTracePredicate report predicate action =
+    withTraceConfigPredicate report predicate $ \traceConfig ->
+      withTracerUnsafe traceConfig (\t _ -> action t)
+
+-- | Run an action with a tracer configuration that collects all trace messages.
+--
+-- Use a t'TracePredicate' to decide whether traces are expected, or unexpected.
+withTraceConfigPredicate ::
+     forall a b l. (Typeable a, IsTrace l a, Show a)
+  => (String -> IO ())
+  -> TracePredicate l a
+  -> (TracerConfig l a -> IO b)
+  -> IO b
+withTraceConfigPredicate report (TracePredicate customLogLevel predicate) action = do
+    tracesRef <- newIORef []
+
+    let writer :: Report a
+        writer _ trace _ = modifyIORef' tracesRef ((:) trace)
+
+        tracerConfig :: TracerConfig l a
+        tracerConfig = def {
+            customLogLevel = customLogLevel
+            -- The verbosity is @Debug@ so that trace predicates can match on
+            -- trace messages of /every/ log level.
+          , verbosity      = Verbosity Debug
+          , outputConfig   = OutputConfigCustom OutputCustom{
+                report    = writer
+              , ansiColor = DisableAnsiColor
+              }
+          }
+
+        reportTraces :: IO ()
+        reportTraces = do
+          traces <- readIORef tracesRef
+          mapM_ (report . show . prettyForTrace) traces
+
+
+        checkTraces :: IO ()
+        checkTraces = do
+          traces <- readIORef tracesRef
+          case runExcept (predicate traces) of
+            Left  e -> throwIO e
+            Right _ -> pure ()
+
+    (action tracerConfig <* reportTraces <* checkTraces) `catch` \e ->
+      case fromException e of
+        Just (_ :: LibclangException) -> reportTraces >> throwIO e
+        _                             -> throwIO e
+
+{-------------------------------------------------------------------------------
+  Trace exception
+-------------------------------------------------------------------------------}
+
+data TraceExpectationException a = TraceExpectationException {
+      unexpectedTraces :: [a]
+    , wrongCounts      :: [CtxDoc]
+    }
+
+instance (IsTrace l a, Show a) => Show (TraceExpectationException a) where
+  show e = show $
+      PP.vcat $
+           ( if null e.unexpectedTraces
+               then []
+               else "Unexpected traces:"
+                  : map reportTrace e.unexpectedTraces
+                  ++ ["\n"]
+           )
+        ++ ( if null e.wrongCounts
+               then []
+               else "Expected traces with wrong counts:"
+                  : e.wrongCounts
+                  ++ ["\n"]
+           )
+
+
+instance (Typeable a, IsTrace l a, Show a)
+  => Exception (TraceExpectationException a)
+
+{-------------------------------------------------------------------------------
+  Wrong counts
+-------------------------------------------------------------------------------}
+
+-- | Emit message about unexpected traces
+--
+-- Given a particular type of trace message (say, @a = TraceMsg@), we typically
+-- distill some info from this message (say, @b = C.DeclName@), and then compare
+-- that info against a list of expected info. There are then two main cases
+-- (that is, main choses for @b@):
+--
+-- * t'GotExpectedTrace': we either expect the trace message, or we don't; we
+--   don't expect to get more than one.
+-- * t'GotTraceLabelled': we expect multiple traces for this case, and label each
+--   one. In this case, we show specific counts.
+--
+-- This is an internal class (not exported).
+class WrongCountMsg a b where
+  wrongCount ::
+       b    -- ^ Name
+    -> Int  -- ^ Expected count
+    -> Int  -- ^ Actual count
+    -> [a]  -- ^ List of traces
+    -> CtxDoc
+
+-- | See 'WrongCountMsg' for discussion
+data GotExpectedTrace = GotExpectedTrace
+  deriving stock (Show, Eq, Ord)
+
+-- | See 'WrongCountMsg' for discussion
+newtype GotTraceLabelled b = GotTraceLabelled b
+  deriving stock (Show, Eq, Ord)
+  deriving newtype (IsString)
+
+-- | The most common case: traces with just one outcome
+instance IsTrace l a => WrongCountMsg a GotExpectedTrace where
+  wrongCount _ 1 n _ =
+      case compare n 1 of
+        LT -> "Expected a single trace but no trace was emitted"
+        EQ -> panicPure "Received correct count"
+        GT -> "Expected a single trace but more traces were emitted"
+  wrongCount _ i _ _ =
+      panicPure $ "Unexpected \"expected count\": " ++ show i
+
+-- | The general case, with user-defined labels as documents
+instance (IsTrace l a, Show a, RenderLabel b)
+      => WrongCountMsg a (GotTraceLabelled b) where
+  wrongCount (GotTraceLabelled label) expectedCount actualCount traces =
+      PP.hangs' intro 2 $ map reportTrace traces
+    where
+      intro = PP.hcat
+        [ "Name: ",             renderLabel label
+        , ", expected count: ", PP.show expectedCount
+        , ", actual count: "  , PP.show actualCount
+        ]
+
+{-------------------------------------------------------------------------------
+  Auxiliary to 'GotTraceLabelled': render labels
+-------------------------------------------------------------------------------}
+
+class RenderLabel b where
+  renderLabel :: b -> CtxDoc
+
+  default renderLabel :: PrettyForTrace b => b -> CtxDoc
+  renderLabel = prettyForTrace
+
+instance RenderLabel CtxDoc where renderLabel = id
+instance RenderLabel String where renderLabel = PP.string
+instance RenderLabel Text   where renderLabel = PP.string . Text.unpack
+
+instance RenderLabel C.DeclName
+instance RenderLabel C.ScopedName
+
+instance RenderLabel a => RenderLabel (Maybe a) where
+  renderLabel Nothing  = ""
+  renderLabel (Just x) = renderLabel x
+
+instance RenderLabel () where
+  renderLabel () = "()"
+instance ( RenderLabel a
+         , RenderLabel b
+         ) => RenderLabel (a, b) where
+  renderLabel (x, y) = PP.parens $ PP.hlist "(" ")" [
+        renderLabel x
+      , renderLabel y
+      ]
+instance ( RenderLabel a
+         , RenderLabel b
+         , RenderLabel c
+         ) => RenderLabel (a, b, c) where
+  renderLabel (x, y, z) = PP.parens $ PP.hlist "(" ")" [
+        renderLabel x
+      , renderLabel y
+      , renderLabel z
+      ]
+
+{-------------------------------------------------------------------------------
+  Counter
+-------------------------------------------------------------------------------}
+
+type Counter a = Map a Int
+
+addN :: (Ord a) => Int -> Counter a -> a -> Counter a
+addN n m k = Map.insertWith (const (+ n)) k n m
+
+count :: (Foldable f, Ord a) => f a -> Counter a
+count = Foldable.foldl' (addN 1) Map.empty
diff --git a/test/common/Test/Common/Util/AnsiDiff.hs b/test/common/Test/Common/Util/AnsiDiff.hs
new file mode 100644
--- /dev/null
+++ b/test/common/Test/Common/Util/AnsiDiff.hs
@@ -0,0 +1,282 @@
+-- | Pretty ANSI-colourful diffs
+module Test.Common.Util.AnsiDiff (
+    ansidiff,
+) where
+
+import Control.Monad (forM_)
+import Control.Monad.ST (ST)
+import Control.Monad.Trans.State.Strict qualified as S
+import Data.Algorithm.Diff qualified as Diff
+import Data.Primitive.Array qualified as P
+import Data.Primitive.PrimArray qualified as P
+import Data.Primitive.Types (Prim)
+import System.Console.ANSI qualified as ANSI
+import Text.EditDistance qualified as ED
+
+ansidiff :: String -> String -> String
+ansidiff old new = runStringWriter $ do
+    writeStr ansiReset
+    let linesDiff = Diff.getDiff (lines old) (lines new)
+    forM_ (chunks linesDiff) $ \case
+        Same xs _  -> forM_ xs $ \x -> writeStrLn $ ' ' : x
+        Diff xs ys -> ansiDiff' xs ys
+
+ansiDiff' :: [String] -> [String] -> StringWriter ()
+ansiDiff' old new = do
+    -- removed
+    forM_ diffs $ \case
+        Del x  -> writeStrLn $ ansiRed ++ '-' : x ++ ansiReset
+        Ins _  -> return ()
+        Swp ds -> removedLine ds
+
+    -- added
+    forM_ diffs $ \case
+        Del _  -> return ()
+        Ins y  -> writeStrLn $ ansiGreen ++ '+' : y ++ ansiReset
+        Swp ds -> addedLine ds
+
+  where
+    diffs :: [D Char Char]
+    diffs = alignment old new
+
+-- empasise line diffs only if there are similar enough.
+-- this is different from 'metric'
+--   we emphasise a line when there are over half of shorter line is preserved.
+predicate :: Double -> Bool
+predicate d = d < 0.2
+
+-------------------------------------------------------------------------------
+-- Alignment
+-------------------------------------------------------------------------------
+
+alignment :: forall a b. (a ~ Char, b ~ Char) => [String] -> [String] -> [D Char Char]
+alignment xs' ys' = do
+    reverse $ walk xn yn
+  where
+    xs :: P.Array [a]
+    xs = P.arrayFromList xs'
+
+    ys :: P.Array [b]
+    ys = P.arrayFromList ys'
+
+    xn :: Int
+    xn = length xs
+
+    yn :: Int
+    yn = length ys
+
+    diffs :: P.PrimArray Double
+    diffs = createPrimArray (xn * yn) $ \arr -> do
+        forM_ [0..xn-1] $ \i -> forM_ [0..yn-1] $ \j -> do
+            let xc = P.indexArray xs i
+            let yc = P.indexArray ys j
+            let xm = length xc
+            let ym = length yc
+            let mi = min xm ym
+            let ma = max xm ym
+
+            let r :: Double
+                !r | ma == 0 = 0
+                   | mi == 0 = 1
+
+                    -- a lower bound of edit-distance,
+                    -- if it's not satisfying a predicate for inter-line diff,
+                    -- just use it instead of calculating proper edit-distance
+                    -- (see tests)
+                   | let lb = fromIntegral (ma - mi) / fromIntegral ma
+                   , not (predicate lb) = lb
+
+                    -- here we use edit-distance, because all the strings we are comparing are different,
+                    -- potentially a lot. Thus we care about worse case performance i.e. O (nm) is the same as O(nd).
+                   | otherwise = fromIntegral (ED.levenshteinDistance ED.defaultEditCosts xc yc) / fromIntegral ma
+
+            P.writePrimArray arr (i + j * xn) r
+
+    indexDiff :: Int -> Int -> Double
+    indexDiff i j = P.indexPrimArray diffs (i + j * xn)
+    {-# INLINE indexDiff #-}
+
+    distances :: P.PrimArray Double
+    distances = createPrimArray ((xn + 1) * (yn + 1)) $ \arr -> do
+        forM_ [0..xn] $ \i -> do
+            P.writePrimArray arr i (fromIntegral i)
+
+        forM_ [1..yn] $ \j -> do
+            P.writePrimArray arr (j * (xn + 1)) (fromIntegral j)
+
+            forM_ [1..xn] $ \i -> do
+                let r = indexDiff (i - 1) (j - 1)
+
+                if r == 0
+                then do
+                    !z <- P.readPrimArray arr ((i - 1) + (j - 1) * (xn + 1))
+                    P.writePrimArray arr (i + j * (xn + 1)) z
+                else do
+                    !x <- P.readPrimArray arr ((i    ) + (j - 1) * (xn + 1))
+                    !y <- P.readPrimArray arr ((i - 1) + (j    ) * (xn + 1))
+                    !z <- P.readPrimArray arr ((i - 1) + (j - 1) * (xn + 1))
+
+                    P.writePrimArray arr (i + j * (xn + 1)) $!
+                        min (r + z) $ min (x + 1) (y + 1)
+
+    indexDistance :: Int -> Int -> Double
+    indexDistance i j = P.indexPrimArray distances (i + j * (xn + 1))
+    {-# INLINE indexDistance #-}
+
+    -- trace back walk
+    walk :: Int -> Int -> [D a b]
+    walk i j
+        | i == 0, j == 0
+        = []
+
+        | i == 0
+        = Ins (P.indexArray ys (j - 1)) : walk i (j - 1)
+
+        | j == 0
+        = Del (P.indexArray xs (i - 1)) : walk (i - 1) j
+
+        | otherwise
+        = do
+            let !x = indexDistance (i    ) (j - 1)
+            let !y = indexDistance (i - 1) (j    )
+            let !z = indexDistance (i - 1) (j - 1)
+
+            if z <= x
+                then
+                    if z <= y
+                    -- z is smallest
+                    then do
+                        let xc = P.indexArray xs (i - 1)
+                        let yc = P.indexArray ys (j - 1)
+                        let !r = indexDiff (i - 1) (j - 1)
+                        if predicate r
+                        then do
+                            let !d = Diff.getDiff xc yc
+                            Swp (chunks d) : walk (i - 1) (j - 1)
+                        else
+                            Del xc : Ins yc : walk (i - 1) (j - 1)
+
+                    -- y is smallest
+                    else Del (P.indexArray xs (i - 1)) : walk (i - 1) j
+
+                else
+                    if y <= x
+
+                    -- y is smallest
+                    then Del (P.indexArray xs (i - 1)) : walk (i - 1) j
+
+                    -- x is smallest
+                    else Ins (P.indexArray ys (j - 1)) : walk i (j - 1)
+
+data D a b
+    = Del [a]
+    | Ins [b]
+    | Swp [Chunk a b]
+  deriving Show
+
+-------------------------------------------------------------------------------
+-- primitive extras
+-------------------------------------------------------------------------------
+
+createPrimArray :: Prim a => Int -> (forall s. P.MutablePrimArray s a -> ST s ()) -> P.PrimArray a
+createPrimArray n action = P.runPrimArray $ do
+    arr <- P.newPrimArray n
+    action arr
+    return arr
+
+-------------------------------------------------------------------------------
+-- Printing
+-------------------------------------------------------------------------------
+
+removedLine :: [Chunk Char Char] -> StringWriter ()
+removedLine ds = do
+    writeStr ansiRed
+    writeChar '-'
+
+    forM_ ds $ \case
+        Diff s _ -> do
+            writeStr ansiRED
+            writeStr s
+            writeStr ansiReset
+        Same s _ -> do
+            writeStr ansiRed
+            writeStr s
+            writeStr ansiReset
+
+    writeChar '\n'
+
+addedLine :: [Chunk Char Char] -> StringWriter ()
+addedLine ds = do
+    writeStr ansiGreen
+    writeChar '+'
+
+    forM_ ds $ \case
+        Diff _ s -> do
+            writeStr ansiGREEN
+            writeStr s
+            writeStr ansiReset
+        Same _ s -> do
+            writeStr ansiGreen
+            writeStr s
+            writeStr ansiReset
+
+    writeChar '\n'
+
+-------------------------------------------------------------------------------
+-- String Writer
+-------------------------------------------------------------------------------
+
+type StringWriter = S.State ShowS
+
+runStringWriter :: StringWriter () -> String
+runStringWriter m = S.execState m id ""
+
+writeChar :: Char -> StringWriter ()
+writeChar c = S.modify' $ \s -> s . (c :)
+
+writeStr :: String -> StringWriter ()
+writeStr str = S.modify' $ \s -> s . (str ++)
+
+writeStrLn :: String -> StringWriter ()
+writeStrLn str = S.modify' $ \s -> s . (str ++) . ('\n' :)
+
+-------------------------------------------------------------------------------
+-- Chunks
+-------------------------------------------------------------------------------
+
+-- | Diff chunks
+data Chunk a b
+    = Same [a] [b]
+    | Diff [a] [b]
+  deriving Show
+
+chunks :: [Diff.PolyDiff a b] -> [Chunk a b]
+chunks [] = []
+chunks (Diff.Both x y : ds) = consS (chunks ds) where
+    consS (Same xs ys : ds') = Same (x : xs) (y : ys) : ds'
+    consS ds'                = Same [x] [y] : ds'
+chunks (Diff.First x  : ds) = consL (chunks ds) where
+    consL (Diff xs ys : ds') = Diff (x : xs) ys : ds'
+    consL ds'                = Diff [x] [] : ds'
+chunks (Diff.Second y : ds) = consR (chunks ds) where
+    consR (Diff xs ys : ds') = Diff xs (y : ys) : ds'
+    consR ds'                = Diff [] [y] : ds'
+
+-------------------------------------------------------------------------------
+-- ANSI helpers
+-------------------------------------------------------------------------------
+
+ansiRed :: String
+ansiRed = ANSI.setSGRCode [ANSI.SetColor ANSI.Foreground ANSI.Vivid ANSI.Red]
+
+ansiRED :: String
+ansiRED = ANSI.setSGRCode [ANSI.SetColor ANSI.Background ANSI.Dull ANSI.Red]
+
+ansiGreen :: String
+ansiGreen = ANSI.setSGRCode [ANSI.SetColor ANSI.Foreground ANSI.Vivid ANSI.Green]
+
+ansiGREEN :: String
+ansiGREEN = ANSI.setSGRCode [ANSI.SetColor ANSI.Background ANSI.Dull ANSI.Green]
+
+ansiReset :: String
+ansiReset = ANSI.setSGRCode [ANSI.Reset]
diff --git a/test/common/Test/Common/Util/Cabal.hs b/test/common/Test/Common/Util/Cabal.hs
new file mode 100644
--- /dev/null
+++ b/test/common/Test/Common/Util/Cabal.hs
@@ -0,0 +1,35 @@
+-- | Utilities for working with @cabal@
+--
+-- Intended for unqualified import.
+module Test.Common.Util.Cabal (
+    -- * Directories
+    findPackageDirectory
+  ) where
+
+import System.Directory
+import System.FilePath
+
+{-------------------------------------------------------------------------------
+  Directories
+-------------------------------------------------------------------------------}
+
+-- | In multi-package projects @cabal run test-suite@ will run the test-suite
+-- from your current working directory (e.g. project root), which is often
+-- not the package directory.
+--
+-- However, many tests are written so they assume that are run from
+-- *package* directory.
+findPackageDirectory :: String -> IO FilePath
+findPackageDirectory pkgname = do
+    here <- doesFileExist (pkgname -<.> ".cabal")
+    if here
+    then getCurrentDirectory
+    else do
+        there <- doesFileExist (pkgname </> pkgname -<.> ".cabal")
+        if there
+        then do
+            setCurrentDirectory pkgname
+            getCurrentDirectory
+        -- do not try too hard, if not in the package directory, nor project root: abort
+        else fail $ "Cannot find package directory for " ++ pkgname
+
diff --git a/test/common/Test/Common/Util/Tasty.hs b/test/common/Test/Common/Util/Tasty.hs
new file mode 100644
--- /dev/null
+++ b/test/common/Test/Common/Util/Tasty.hs
@@ -0,0 +1,62 @@
+-- | Utilities for writing @tasty@ tests
+--
+-- Intended for unqualified import.
+module Test.Common.Util.Tasty (
+    -- * Assertions
+    assertException
+    -- * Golden tests
+  , goldenAnsiDiff
+  ) where
+
+import Control.Exception
+import Control.Monad
+import Data.ByteString qualified as BS
+import Data.ByteString.UTF8 qualified as UTF8
+import Data.Either (isRight)
+import Data.Proxy
+import System.Directory (removeFile)
+import Test.Tasty
+import Test.Tasty.HUnit
+
+import Test.Common.Util.AnsiDiff (ansidiff)
+import Test.Common.Util.Tasty.Golden
+
+{-------------------------------------------------------------------------------
+  Assertions
+-------------------------------------------------------------------------------}
+
+assertException :: forall e a.
+     Exception e
+  => String -> Proxy e -> IO a -> Assertion
+assertException msg _ action = do
+   result <- tryJust (\x -> fromException x :: Maybe e) action
+   when (isRight result) $ assertFailure msg
+
+{-------------------------------------------------------------------------------
+  Golden tests
+-------------------------------------------------------------------------------}
+
+-- | Golden test using 'ansidiff'
+goldenAnsiDiff ::
+     TestName
+  -> FilePath
+  -> ((String -> IO ()) -> IO (ActualValue String))
+  -> TestTree
+goldenAnsiDiff name fp actual =
+    goldenTestSteps name correct actual cmp update remove
+  where
+    correct :: IO String
+    correct = do
+        contents <- BS.readFile fp
+        return $ UTF8.toString contents
+
+    cmp :: String -> String -> IO (Maybe String)
+    cmp xss yss
+        | xss == yss = return Nothing
+        | otherwise  = return $ Just $ ansidiff xss yss
+
+    update :: String -> IO ()
+    update s = BS.writeFile fp (UTF8.fromString s)
+
+    remove :: IO ()
+    remove = removeFile fp
diff --git a/test/common/Test/Common/Util/Tasty/Golden.hs b/test/common/Test/Common/Util/Tasty/Golden.hs
new file mode 100644
--- /dev/null
+++ b/test/common/Test/Common/Util/Tasty/Golden.hs
@@ -0,0 +1,241 @@
+-- | A fork of @tasty-golden" with additional features
+--
+-- New features:
+--
+-- * Report progress
+-- * Skip tests
+--
+-- Intended for unqualified import.
+module Test.Common.Util.Tasty.Golden (
+    ActualValue(..)
+  , goldenTestSteps
+  , RunMode(..)
+
+    -- * Options
+  , Debug(..)
+  ) where
+
+import Control.DeepSeq (rnf)
+import Control.Exception
+import Control.Monad (when)
+import Data.Functor ((<&>))
+import Data.IORef
+import Data.Proxy
+import System.IO.Error (isDoesNotExistError)
+import Test.Tasty.Options
+import Test.Tasty.Providers
+
+{-------------------------------------------------------------------------------
+  Public API
+-------------------------------------------------------------------------------}
+
+data ActualValue a =
+    -- | The value we want to test against the golden reference
+    ActualValue a
+
+    -- | Sometimes we test for the absence of an output value
+  | ActualNoOutput
+
+    -- | We failed to create the actual value
+    --
+    -- This is a test failure.
+  | ActualFailed String
+
+    -- | Skip this test
+    --
+    -- In some cases we are unable to construct an actual value, without it
+    -- being a test failure.
+  | ActualSkipped String
+  deriving stock (Show, Functor)
+
+-- | A very general testing function.
+goldenTestSteps ::
+     TestName
+     -- ^ Test name
+  -> IO a
+     -- ^ Get the golden correct value
+     --
+     -- Note that this action may be followed by the update function call.
+     -- Therefore, this action should avoid reading the file lazily; otherwise,
+     -- the file may remain half-open and the update action will fail.
+  -> ((String -> IO ()) -> IO (ActualValue a))
+     -- ^ Get the tested value, given a callback for reporting progress
+  -> (a -> a -> IO (Maybe String))
+     -- ^ Comparison function
+     --
+     -- If two values are the same, it should return 'Nothing'. If they are
+     -- different, it should return an error that will be printed to the user.
+     -- First argument is the golden value.
+     --
+     -- The function may use 'IO', for example, to launch an external @diff@
+     -- command.
+  -> (a -> IO ())
+     -- ^ Update the golden file
+  -> IO ()
+     -- ^ Remove the golden file
+  -> TestTree
+goldenTestSteps t getGolden getActual comparison updateGolden removeGolden =
+    singleTest t $ GoldenTest GoldenSteps{
+        getGolden    = getGolden
+      , getActual    = getActual
+      , comparison   = comparison
+      , updateGolden = updateGolden
+      , removeGolden = removeGolden
+      }
+
+{-------------------------------------------------------------------------------
+  Test options
+-------------------------------------------------------------------------------}
+
+-- | This option, when set to 'True', specifies that we should run in the
+-- «accept tests» mode
+newtype AcceptTests = AcceptTests Bool
+  deriving (Eq, Ord)
+
+-- | Print trace messages.
+-- «accept tests» mode
+newtype Debug = Debug Bool
+  deriving (Eq, Ord)
+
+instance IsOption AcceptTests where
+    defaultValue = AcceptTests False
+    parseValue = fmap AcceptTests . safeReadBool
+    optionName = return "accept"
+    optionHelp = return "Accept current results of golden tests"
+    optionCLParser = flagCLParser (Just 'a') (AcceptTests True)
+
+instance IsOption Debug where
+    defaultValue = Debug False
+    parseValue = fmap Debug . safeReadBool
+    optionName = return "debug"
+    optionHelp = return "Print all trace messages"
+    optionCLParser = flagCLParser (Just 'v') (Debug True)
+
+-- | Test run mode: 'Full' runs all tests, 'Fast' skips slow tests.
+data RunMode = Fast | Full
+  deriving (Eq, Ord)
+
+instance IsOption RunMode where
+    defaultValue = Full
+    parseValue s = case safeReadBool s of
+        Just True  -> Just Fast
+        Just False -> Just Full
+        Nothing    -> Nothing
+    optionName = return "fast"
+    optionHelp = return "Skip slow tests (TH fixtures, Unsafe golden tests)"
+    optionCLParser = flagCLParser (Just 'f') Fast
+
+{-------------------------------------------------------------------------------
+  Internals
+-------------------------------------------------------------------------------}
+
+data GoldenTest = forall a. GoldenTest (GoldenSteps a)
+
+data GoldenSteps a = GoldenSteps {
+      getGolden    :: IO a
+    , getActual    :: (String -> IO ()) -> IO (ActualValue a)
+    , comparison   :: a -> a -> IO (Maybe String)
+    , updateGolden :: a -> IO ()
+    , removeGolden :: IO ()
+    }
+
+instance IsTest GoldenTest where
+    run opts (GoldenTest steps) progress =
+        runGoldenSteps steps progress opts
+
+    testOptions = return [
+          Option (Proxy :: Proxy AcceptTests)
+        , Option (Proxy :: Proxy Debug)
+        , Option (Proxy :: Proxy RunMode)
+        ]
+
+runGoldenSteps :: GoldenSteps a -> (Progress -> IO ()) -> OptionSet -> IO Result
+runGoldenSteps steps progress opts = do
+    msgsRef <- newIORef []
+    let stepFn :: String -> IO ()
+        stepFn msg = do
+           when debug $ do
+             progress (Progress msg 0)
+             atomicModifyIORef msgsRef (\msgs -> (msg:msgs, ()))
+
+    -- get actual value
+    mbNew :: Either SomeException (ActualValue a) <-
+      try $ steps.getActual stepFn
+    msgs :: [String] <-
+      readIORef msgsRef <&> reverse
+
+    let testPassedWith, testFailedWith :: String -> IO Result
+        testPassedWith descr = return $ testPassed $ unlines (descr : msgs)
+        testFailedWith descr = return $ testFailed $ unlines (descr : msgs)
+
+    case mbNew of
+      Left e ->
+        case fromException @AsyncException e of
+          Just e' -> throwIO e'
+          Nothing -> return $ testFailed $ concat [
+              displayException e
+            , unlines msgs
+            ]
+
+      Right (ActualSkipped reason) ->
+        testPassedWith $ "skipped: " ++ reason
+
+      Right (ActualFailed err) ->
+        testFailedWith err
+
+      Right ActualNoOutput -> do
+        mbRef <- try steps.getGolden
+        case mbRef of
+         Left e
+           | Just e' <- fromException e, isDoesNotExistError e' ->
+             pure $ testPassed $ unlines msgs
+           | otherwise ->
+             throwIO e
+         Right _ -> do
+           if accept then do
+             steps.removeGolden
+             testPassedWith "Golden file existed but test has no output; removed"
+           else do
+             testFailedWith "Test had no output, but golden file exists"
+
+      Right (ActualValue new) -> do
+        mbRef <- try steps.getGolden
+        case mbRef of
+          Left e
+            | Just e' <- fromException e, isDoesNotExistError e' ->
+                if accept then do
+                  steps.updateGolden new
+                  testPassedWith "Golden file did not exist; created"
+                else do
+                  testFailedWith "Golden file does not exist"
+            | Just _ <- fromException @AsyncException e ->
+                throwIO e
+            | Just _ <- fromException @IOError e ->
+                throwIO e
+            | otherwise -> do
+                -- Other types of exceptions may be due to failing to decode the
+                -- golden file. In that case, it makes sense to replace a broken
+                -- golden file with the current version.
+                steps.updateGolden new
+                testPassedWith $ concat [
+                    "Accepted the new version. Was failing with exception: "
+                  , displayException e
+                  ]
+
+          Right ref -> do
+              result <- steps.comparison ref new
+              case result of
+                Nothing ->
+                  pure $ testPassed $ unlines msgs
+                Just _reason | accept -> do
+                  -- test failed; accept the new version
+                  steps.updateGolden new
+                  testPassedWith "Accepted the new version"
+                Just reason -> do
+                  -- Make sure that the result is fully evaluated and doesn't
+                  -- depend on yet un-read lazy input
+                  evaluate . rnf $ reason
+                  testFailedWith reason
+  where
+    AcceptTests accept = lookupOption opts
+    Debug debug        = lookupOption opts
diff --git a/test/hs-bindgen/Test/HsBindgen/Clang.hs b/test/hs-bindgen/Test/HsBindgen/Clang.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Clang.hs
@@ -0,0 +1,139 @@
+-- | Running @libclang@ over header text held in a string
+--
+-- There is no file on disk and no golden file: the header is handed to
+-- @libclang@ as an unsaved file, so a test can write the C it needs inline.
+module Test.HsBindgen.Clang (
+    -- * Calling clang
+    ClangError (..)
+  , withClang
+  , withClang'
+    -- * Tokenization
+  , tokenize
+  , collectMacroTokens
+  ) where
+
+import Control.Exception (Exception, throwIO)
+import Data.Text (Text)
+import Data.Text qualified as Text
+
+import Clang.Args (ClangArgs)
+import Clang.Enum.Bitfield (BitfieldEnum, bitfieldEnum)
+import Clang.Enum.Simple (SimpleEnum, fromSimpleEnum)
+import Clang.HighLevel qualified as HighLevel
+import Clang.HighLevel.Types (Diagnostic, Fold, SourcePath, Token,
+                              TokenSpelling, diagnosticIsError, foldContinue,
+                              foldContinueWith, simpleFold)
+import Clang.LowLevel.Core (CXCursorKind (CXCursor_MacroDefinition),
+                            CXErrorCode, CXIndex, CXTranslationUnit,
+                            CXTranslationUnit_Flags (CXTranslationUnit_DetailedPreprocessingRecord),
+                            CXUnsavedFile,
+                            DisplayDiagnostics (DontDisplayDiagnostics),
+                            clang_Location_isFromMainFile, clang_getCursorKind,
+                            clang_getCursorLocation, clang_getCursorSpelling,
+                            clang_getTranslationUnitCursor)
+import Clang.LowLevel.Core qualified as Core
+import Clang.Paths (SourcePath (SourcePath))
+
+{-------------------------------------------------------------------------------
+  Calling clang
+-------------------------------------------------------------------------------}
+
+data ClangError =
+    ClangErrorDiagnostics [Diagnostic]
+  | ClangErrorCode ErrorCode
+  deriving stock (Show, Eq)
+  deriving anyclass Exception
+
+type ErrorCode = SimpleEnum CXErrorCode
+
+-- | Parse the given header contents, throwing 'ClangError' on failure
+--
+-- The preprocessing record is always requested, so macro definitions are
+-- visible in the translation unit.
+withClang :: forall a.
+     ClangArgs
+  -> String
+  -> (CXTranslationUnit -> IO a)
+  -> IO a
+withClang args contents k = do
+    mRes <- withClang' args contents $ \unit -> do
+      diags <- HighLevel.clang_getDiagnostics unit Nothing
+      if any diagnosticIsError diags
+      then throwIO $ ClangErrorDiagnostics diags
+      else k unit
+    case mRes of
+      Left e    -> throwIO $ ClangErrorCode e
+      Right res -> pure res
+
+-- | Variant of 'withClang' that reports the error code rather than throwing,
+-- and that does not inspect the diagnostics
+withClang' :: forall a.
+     ClangArgs
+  -> String
+  -> (CXTranslationUnit -> IO a)
+  -> IO (Either ErrorCode a)
+withClang' args contents k =
+    HighLevel.withIndex DontDisplayDiagnostics $ \index ->
+    HighLevel.withUnsavedFile path contents $ \file  ->
+      withUnit index file
+  where
+    flags :: BitfieldEnum CXTranslationUnit_Flags
+    flags = bitfieldEnum [CXTranslationUnit_DetailedPreprocessingRecord]
+
+    path :: FilePath
+    path = "virtual.h"
+
+    onErrorCode :: ErrorCode -> IO (Either ErrorCode a)
+    onErrorCode err = pure $ Left err
+
+    withUnit :: CXIndex -> CXUnsavedFile -> IO (Either ErrorCode a)
+    withUnit index unsaved =
+      HighLevel.withTranslationUnit2
+        index
+        (Just $ SourcePath $ Text.pack path)
+        args
+        [unsaved]
+        flags
+        onErrorCode
+        (fmap Right . k)
+
+{-------------------------------------------------------------------------------
+  Tokenization
+-------------------------------------------------------------------------------}
+
+-- | Tokenize the whole header
+--
+-- To tokenize individual declarations instead, visit the children of the
+-- translation unit cursor; 'collectMacroTokens' does that for macros.
+tokenize :: ClangArgs -> String -> IO [Token SourcePath TokenSpelling]
+tokenize args contents = withClang args contents $ \unit -> do
+    root <- clang_getTranslationUnitCursor unit
+    HighLevel.clang_tokenize unit =<< Core.clang_getCursorExtent root
+
+-- | The name and tokens of every @#define@ in the header, in source order
+--
+-- The tokens are those of the macro definition cursor, which start at the macro
+-- name: the @#define@ itself is not part of them. This is the same token stream
+-- that the @Parse@ pass feeds to 'HsBindgen.Macro.Syntax.splitMacro'.
+collectMacroTokens ::
+     ClangArgs
+  -> String
+  -> IO [(Text, [Token SourcePath TokenSpelling])]
+collectMacroTokens args contents = withClang args contents $ \unit -> do
+    root <- clang_getTranslationUnitCursor unit
+    HighLevel.clang_visitChildren root (macroFold unit)
+
+macroFold ::
+     CXTranslationUnit
+  -> Fold IO (Text, [Token SourcePath TokenSpelling])
+macroFold unit = simpleFold $ \cursor -> do
+    loc    <- clang_getCursorLocation cursor
+    inMain <- clang_Location_isFromMainFile loc
+    kind   <- fromSimpleEnum <$> clang_getCursorKind cursor
+    case kind of
+      Right CXCursor_MacroDefinition | inMain -> do
+        name   <- clang_getCursorSpelling cursor
+        tokens <- HighLevel.clang_tokenize unit =<< Core.clang_getCursorExtent cursor
+        foldContinueWith (name, tokens)
+      _otherwise ->
+        foldContinue
diff --git a/test/hs-bindgen/Test/HsBindgen/Fixtures/Haddock.hs b/test/hs-bindgen/Test/HsBindgen/Fixtures/Haddock.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Fixtures/Haddock.hs
@@ -0,0 +1,67 @@
+-- | Haddock index page generation for fixture documentation
+--
+module Test.HsBindgen.Fixtures.Haddock (
+    generateHaddockIndex
+  ) where
+
+import System.Directory (createDirectoryIfMissing)
+import System.FilePath ((</>))
+
+import Test.HsBindgen.Fixtures.Utils (sanitizeLibName)
+
+{-------------------------------------------------------------------------------
+  Index page generation
+-------------------------------------------------------------------------------}
+
+-- | Generate an HTML index page for browsing fixture haddock documentation
+generateHaddockIndex ::
+     String   -- ^ Library name prefix (e.g. @\"fixture-\"@)
+  -> FilePath -- ^ Haddock output directory
+  -> [String] -- ^ Compiled fixture names
+  -> Int      -- ^ Number of skipped fixtures
+  -> IO ()
+generateHaddockIndex prefix haddockDir compiled skippedCount = do
+    createDirectoryIfMissing True haddockDir
+    writeFile (haddockDir </> "index.html") $ unlines $
+      [ "<!DOCTYPE html>"
+      , "<html><head>"
+      , "<meta charset=\"UTF-8\">"
+      , "<title>Fixture Haddock Documentation</title>"
+      , "<style>"
+      , "body { font-family: sans-serif; max-width: 1200px;"
+      , "       margin: 40px auto; padding: 0 20px; }"
+      , "h1 { border-bottom: 3px solid #3498db; padding-bottom: 10px; }"
+      , ".stats { background: #ecf0f1; padding: 15px; border-radius: 5px; }"
+      , ".fixture-list { display: grid;"
+      , "  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));"
+      , "  gap: 15px; margin: 20px 0; }"
+      , ".fixture-item { background: #fff; border: 1px solid #ddd;"
+      , "  border-radius: 5px; padding: 15px; }"
+      , ".fixture-item a { color: #3498db; text-decoration: none; }"
+      , "footer { margin-top: 40px; border-top: 1px solid #ddd;"
+      , "  padding-top: 20px; color: #7f8c8d; font-size: 0.9em; }"
+      , "</style></head><body>"
+      , "<h1>Fixture Haddock Documentation</h1>"
+      , "<div class=\"stats\">"
+      , "<strong>Statistics:</strong><br>"
+      , "Total fixtures: " ++ show totalCount ++ "<br>"
+      , "Processed: " ++ show (length compiled) ++ "<br>"
+      , "Skipped: " ++ show skippedCount
+      , "</div>"
+      , "<h2>Fixture Documentation</h2>"
+      , "<div class=\"fixture-list\">"
+      ]
+      ++ map fixtureLink compiled ++
+      [ "</div>"
+      , "<footer>Generated by Test.HsBindgen.Fixtures.Haddock</footer>"
+      , "</body></html>"
+      ]
+  where
+    totalCount = length compiled + skippedCount
+
+    fixtureLink :: String -> String
+    fixtureLink name =
+      let libName = prefix ++ sanitizeLibName name
+      in  "<div class=\"fixture-item\">"
+          ++ "<a href=\"" ++ libName ++ "/index.html\">" ++ name ++ "</a>"
+          ++ "</div>"
diff --git a/test/hs-bindgen/Test/HsBindgen/Fixtures/TestCases.hs b/test/hs-bindgen/Test/HsBindgen/Fixtures/TestCases.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Fixtures/TestCases.hs
@@ -0,0 +1,251 @@
+{-# LANGUAGE OverloadedRecordDot #-}
+
+-- | Shared fixture compilation status and skip logic
+--
+-- This module provides the common 'FixtureStatus' type and shared skip
+-- reasons used by both 'Test.HsBindgen.THFixtures.TestCases' and
+-- 'Test.HsBindgen.PPFixtures.TestCases'.
+--
+-- To add a new skip reason that applies to /both/ TH and PP fixture
+-- compilation, add it to 'commonFixtureStatus'. For mode-specific skips,
+-- add them in the respective @determineTHStatus@ or @determinePPStatus@.
+--
+module Test.HsBindgen.Fixtures.TestCases (
+    FixtureStatus(..)
+  , isCompile
+  , commonFixtureStatus
+    -- * Shared skip lists
+  , commonKnownEmpty
+    -- * Tasty options
+  , HaddockMode(..)
+  , haddockOutputDir
+    -- * Tasty test helpers
+  , SimpleTest(..)
+  , mkFixtureTest
+  , passedResult
+  , skippedResult
+    -- * Helpers
+  , isSuccess
+  , isVariantTest
+  ) where
+
+import Data.List (isPrefixOf)
+import Data.Map.Strict qualified as Map
+import Data.Proxy (Proxy (..))
+import System.FilePath ((</>))
+import Test.Tasty
+import Test.Tasty.Options (IsOption (..), OptionDescription (Option),
+                           flagCLParser, safeReadBool)
+import Test.Tasty.Providers (IsTest (..), singleTest, testFailed)
+import Test.Tasty.Providers.ConsoleFormat (noResultDetails)
+import Test.Tasty.Runners (Result (..))
+import Test.Tasty.Runners qualified as Tasty
+
+import Test.HsBindgen.Fixtures.Utils (sanitizeLibName)
+import Test.HsBindgen.Golden.Infra.TestCase
+
+{-------------------------------------------------------------------------------
+  Fixture status
+-------------------------------------------------------------------------------}
+
+-- | Compilation status for a fixture
+data FixtureStatus
+    = FixtureCompile
+      -- ^ Compile this fixture (with @-optc-Werror@ where applicable)
+    | FixtureCompileNoOptcWerror
+      -- ^ Compile without @-optc-Werror@ (PP only; TH treats as 'FixtureCompile')
+    | FixtureSkip String
+      -- ^ Skip with reason
+  deriving stock (Eq, Show)
+
+-- | Does this status indicate compilation?
+isCompile :: FixtureStatus -> Bool
+isCompile FixtureCompile             = True
+isCompile FixtureCompileNoOptcWerror = True
+isCompile FixtureSkip{}              = False
+
+{-------------------------------------------------------------------------------
+  Common skip logic
+-------------------------------------------------------------------------------}
+
+-- | Determine fixture status based on skip reasons common to both TH and PP
+--
+-- Returns @Just status@ if a common rule applies, @Nothing@ if mode-specific
+-- logic should decide.
+--
+commonFixtureStatus :: TestCase -> Maybe FixtureStatus
+commonFixtureStatus tc
+  -- Expected failure tests produce no valid output
+  | not (isSuccess tc.outcome)
+      = Just $ FixtureSkip "Expected failure test"
+  -- Tests with external binding specs not yet supported
+  | "binding-specs/fun_arg/" `isPrefixOf` tc.name
+    || "macros/macro_ext_binding_dep" `isPrefixOf` tc.name
+    || "types/anonymous/edge-cases/drop_indirect_fields" `isPrefixOf` tc.name
+      = Just $ FixtureSkip "External binding specs not yet supported (issue #1495)"
+  -- Trans-dep and relative-include fixtures deliberately reference a
+  -- missing module to exercise external binding spec resolution; they
+  -- are not meant to compile.
+  | "binding-specs/trans_dep/" `isPrefixOf` tc.name
+    || "binding-specs/relative_include/" `isPrefixOf` tc.name
+      = Just $ FixtureSkip "Generated bindings reference intentionally-missing module"
+  -- Apple block extension requires clang
+  | tc.name == "edge-cases/iterator"
+      = Just $ FixtureSkip "Apple block extension requires clang (issue #913)"
+  -- Unusable struct
+  | tc.name == "functions/decls_in_signature"
+      = Just $ FixtureSkip "Unusable struct (issue #1128)"
+  -- Issue #1490
+  | tc.name `elem` issue1490
+      = Just $ FixtureSkip "Issue #1490"
+  -- Issue #1679
+  | tc.name `elem` issue1679
+      = Just $ FixtureSkip "Issue #1679"
+  -- Issue #1956
+  | tc.name == "macros/undef"
+      = Just $ FixtureSkip "Issue #1956"
+  -- @typedef int bool@ / @#define bool int@ is invalid in C23
+  | tc.name == "types/primitives/bool_typedef_override"
+ || tc.name == "types/primitives/bool_macro_override"
+      = Just $ FixtureSkip "bool override is invalid in C23"
+  -- Empty output fixtures (shared between TH and PP)
+  | tc.name `elem` commonKnownEmpty
+      = Just $ FixtureSkip "Empty fixture (no bindings generated)"
+  | otherwise
+      = Nothing
+  where
+    issue1490 :: [String]
+    issue1490 = [
+        "functions/heap_types/struct_const_member"
+      , "functions/heap_types/struct_const_typedef"
+      , "functions/heap_types/struct_const"
+      , "functions/heap_types/union_const_member"
+      , "functions/heap_types/union_const_typedef"
+      , "functions/heap_types/union_const"
+      ]
+
+    issue1679 :: [String]
+    issue1679 = [
+        "program-analysis/program-slicing/macro_selected"
+      , "program-analysis/program-slicing/macro_unselected"
+      ]
+
+{-------------------------------------------------------------------------------
+  Shared skip lists
+-------------------------------------------------------------------------------}
+
+-- | Empty output fixtures shared between TH and PP
+--
+commonKnownEmpty :: [String]
+commonKnownEmpty = [
+    "declarations/declaration_unselected_b"
+  , "declarations/name_collision"
+  , "edge-cases/clang_generated_collision"
+  , "edge-cases/duplicate"
+  , "edge-cases/headers"
+  , "edge-cases/select_no_match"
+  , "edge-cases/thread_local"
+  , "edge-cases/unsupported_builtin"
+  , "functions/not_visible_decl"
+  , "macros/macro_type_void"
+  , "macros/redeclaration/different_value"
+  , "program-analysis/delay_traces"
+  , "program-analysis/selection_foo"
+  , "program-analysis/selection_merge_traces"
+  , "program-analysis/selection_omit_prescriptive"
+  , "program-analysis/selection_squash_typedef"
+  , "types/anonymous/edge-cases/empty_anon"
+  , "types/anonymous/edge-cases/unnamed_bitfield"
+  , "types/special/long_double"
+  , "types/structs/untagged_struct"
+  , "types/typedefs/typenames"
+  ]
+
+{-------------------------------------------------------------------------------
+  Tasty options
+-------------------------------------------------------------------------------}
+
+-- | Whether to generate Haddock documentation for fixtures
+data HaddockMode = NoHaddock | WithHaddock
+  deriving stock (Eq, Ord)
+
+instance IsOption HaddockMode where
+    defaultValue = NoHaddock
+    parseValue s = case safeReadBool s of
+        Just True  -> Just WithHaddock
+        Just False -> Just NoHaddock
+        Nothing    -> Nothing
+    optionName = return "haddock"
+    optionHelp = return "Generate Haddock documentation for fixtures"
+    optionCLParser = flagCLParser Nothing WithHaddock
+
+-- | Convert 'HaddockMode' to an optional output directory
+haddockOutputDir :: HaddockMode -> FilePath -> Maybe FilePath
+haddockOutputDir NoHaddock   _        = Nothing
+haddockOutputDir WithHaddock buildDir = Just $ buildDir </> "haddock-fixtures"
+
+{-------------------------------------------------------------------------------
+  Tasty test helpers
+-------------------------------------------------------------------------------}
+
+-- | A simple test that runs an IO action returning a 'Result'
+newtype SimpleTest = SimpleTest (IO Result)
+
+instance IsTest SimpleTest where
+    run _ (SimpleTest action) _ = action
+    testOptions = return [Option (Proxy :: Proxy HaddockMode)]
+
+-- | Create a test tree entry for a single fixture
+--
+-- Skipped fixtures show their reason; compiled fixtures look up their
+-- result in the shared batch-build results map.
+mkFixtureTest ::
+     String                              -- ^ Library name prefix (e.g. @\"fixture-\"@)
+  -> String                              -- ^ Label (e.g. @\"PP compilation\"@)
+  -> (TestCase -> FixtureStatus)         -- ^ Status function
+  -> IO (Map.Map String (Either String ()))  -- ^ Batch build results
+  -> TestCase
+  -> TestTree
+mkFixtureTest prefix label determineStatus getResults tc =
+    case determineStatus tc of
+      FixtureSkip reason ->
+          singleTest tc.name $
+            SimpleTest $ return $ skippedResult reason
+      _ ->
+          singleTest tc.name $ SimpleTest $ do
+              results <- getResults
+              let libName = prefix ++ sanitizeLibName tc.name
+              case Map.lookup libName results of
+                  Just (Right ()) -> return $ passedResult $
+                      label ++ " succeeded"
+                  Just (Left err) -> return $ testFailed $
+                      label ++ " failed:\n" ++ err
+                  Nothing -> return $ testFailed
+                      "Library not found in batch build results"
+
+passedResult :: String -> Result
+passedResult msg = Result Tasty.Success msg "OK" 0 noResultDetails
+
+skippedResult :: String -> Result
+skippedResult reason = Result Tasty.Success ("Skipped: " ++ reason) ("Skipped: " ++ reason) 0 noResultDetails
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+-- | Check if an outcome is 'Success'
+isSuccess :: Outcome -> Bool
+isSuccess Success = True
+isSuccess _       = False
+
+-- | Check if a test name is a variant test (e.g., "foo.1.bar")
+isVariantTest :: String -> Bool
+isVariantTest name = any isVariantSuffix (suffixes name)
+  where
+    suffixes :: String -> [String]
+    suffixes []     = []
+    suffixes (_:xs) = xs : suffixes xs
+
+    isVariantSuffix :: String -> Bool
+    isVariantSuffix ('.':c:_) = c `elem` ['0'..'9']
+    isVariantSuffix _         = False
diff --git a/test/hs-bindgen/Test/HsBindgen/Fixtures/Utils.hs b/test/hs-bindgen/Test/HsBindgen/Fixtures/Utils.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Fixtures/Utils.hs
@@ -0,0 +1,301 @@
+-- | Shared utilities for fixture compilation
+--
+-- Fixtures are compiled directly via @ghc@ (or @haddock --ghc@).
+--
+-- The GHC environment file is generated by @cabal build@ (via
+-- @write-ghc-environment-files: always@ in @cabal.project@) and lists all
+-- package databases and visible packages from the main project build.
+-- Individual fixtures are then compiled in parallel.
+--
+-- The compiler binary is selected from the env file's version suffix (e.g.
+-- @ghc-9.10.3@ from @.ghc.environment.x86_64-linux-9.10.3@), so fixture
+-- compilation uses the same GHC that cabal built the test suite with even
+-- when @with-compiler@ differs from the system default on @PATH@.
+--
+module Test.HsBindgen.Fixtures.Utils (
+    -- * Name sanitization
+    sanitizeLibName
+    -- * Fixture environment setup
+  , setupFixtureEnv
+    -- * GHC options
+  , sharedGhcOptions
+    -- * Direct GHC compilation
+  , runDirectGhcBuild
+  ) where
+
+import Control.Concurrent.Async (forConcurrently)
+import Control.Concurrent.QSem (newQSem, signalQSem, waitQSem)
+import Control.Exception (bracket_)
+import Control.Monad (filterM)
+import Data.List (intercalate, isPrefixOf, stripPrefix)
+import Data.Map.Strict (Map)
+import Data.Map.Strict qualified as Map
+import Data.Maybe (listToMaybe)
+import Data.Version (Version, makeVersion, parseVersion, showVersion,
+                     versionBranch)
+import GHC.Conc (getNumProcessors)
+import System.Directory (createDirectoryIfMissing, doesPathExist,
+                         findExecutable, listDirectory)
+import System.Environment (getEnvironment)
+import System.Exit (ExitCode (..))
+import System.FilePath (isAbsolute, pathSeparator, takeDirectory, takeFileName,
+                        (<.>), (</>))
+import System.IO (readFile')
+import System.Process (CreateProcess (..), proc, readCreateProcessWithExitCode)
+import Text.ParserCombinators.ReadP (readP_to_S)
+
+{-------------------------------------------------------------------------------
+  Name sanitization
+-------------------------------------------------------------------------------}
+
+-- | Sanitize test name for use as a library name
+--
+-- Sanitization logic:
+--
+-- * @.DIGIT@ -> @vDIGIT@  (avoids version-like segments)
+-- * @_DIGIT@ -> @nDIGIT@  (avoids version-like segments)
+-- * Remaining @/@, @_@, @.@ -> @-@
+--
+sanitizeLibName :: String -> String
+sanitizeLibName = go
+  where
+    go [] = []
+    go ('.':c:rest)
+      | c `elem` ['0'..'9'] = 'v' : c : go rest
+    go ('_':c:rest)
+      | c `elem` ['0'..'9'] = 'n' : c : go rest
+    go ('/':rest) = '-' : go rest
+    go ('_':rest) = '-' : go rest
+    go ('.':rest) = '-' : go rest
+    go (c:rest) = c : go rest
+
+{-------------------------------------------------------------------------------
+  Fixture environment setup
+-------------------------------------------------------------------------------}
+
+-- | Obtain the GHC environment for fixture compilation
+--
+-- Finds the @.ghc.environment.*@ file generated by @cabal build@ in the repo
+-- root.  This file is created because @cabal.project@ contains
+-- @write-ghc-environment-files: always@.  It lists all package databases and
+-- visible packages from the main project build, so no extra @cabal build@ or
+-- @cabal exec@ is needed.
+--
+-- Returns include directories and path to the GHC environment file.
+setupFixtureEnv ::
+     FilePath  -- ^ Repo root
+  -> IO ([FilePath], FilePath)
+     -- ^ (include directories, GHC environment file)
+setupFixtureEnv repoRoot = do
+    let hsBindgenDir = repoRoot </> "hs-bindgen"
+        includeDirs  =
+          [ hsBindgenDir </> "test-artefacts" </> "headers"
+          , hsBindgenDir </> "test-artefacts" </> "headers" </> "golden"
+          , hsBindgenDir </> "musl-include" </> "x86_64"
+          ]
+
+    envFile <- discoverGhcEnvFile repoRoot
+    return (includeDirs, envFile)
+
+{-------------------------------------------------------------------------------
+  GHC options
+-------------------------------------------------------------------------------}
+
+-- | GHC warning and C compiler options shared across all fixture compilations
+sharedGhcOptions :: [String]
+sharedGhcOptions =
+    [ "-Wall"
+    , "-Wincomplete-uni-patterns"
+    , "-Wincomplete-record-updates"
+    , "-Wmissing-exported-signatures"
+    , "-Widentities"
+    , "-Wredundant-constraints"
+    , "-Wpartial-fields"
+    , "-Wcpp-undef"
+    , "-Wno-unused-matches"
+    , "-optc-std=gnu2x"
+    , "-optc-Wno-deprecated-declarations"
+    , "-optc-Wno-attributes"
+    ]
+
+{-------------------------------------------------------------------------------
+  Direct GHC / haddock compilation
+-------------------------------------------------------------------------------}
+
+-- | Compile fixture modules directly via @ghc@ or @haddock@, bypassing
+-- cabal's internal library machinery
+--
+-- Each invocation returns its own exit code and stderr, so per-fixture error
+-- attribution is trivial (no stderr parsing needed).
+--
+-- When @haddockDir@ is 'Nothing', uses @ghc --make -no-link@ (compile only).
+-- When @haddockDir@ is @'Just' dir@, uses @haddock --ghc --html@ to compile
+-- and generate browsable Haddock documentation.
+runDirectGhcBuild ::
+     FilePath
+     -- ^ Working directory (temp dir for output isolation)
+  -> FilePath
+     -- ^ GHC environment file (from 'setupFixtureEnv')
+  -> [String]
+     -- ^ GHC options (warnings, @-optc@ flags, extensions)
+  -> [String]
+     -- ^ Include directories (for @-I@ flags)
+  -> Maybe FilePath
+     -- ^ Haddock output directory, or 'Nothing' for compile-only
+  -> [(String, FilePath, [String], [String])]
+     -- ^ (library name, source directory, module names, extra GHC args)
+  -> IO (Map String (Either String ()))
+runDirectGhcBuild workDir envFile ghcOpts includeDirs mHaddockDir jobs = do
+    -- Set up environment with GHC_ENVIRONMENT pointing to the env file
+    baseEnv <- getEnvironment
+    let compileEnv = ("GHC_ENVIRONMENT", envFile)
+                   -- We have to filter the GHC_ENVIRONMENT file that the test
+                   -- suite generates, which doesn't have all the packages TH
+                   -- and PP compilation needs.
+                   : filter ((/= "GHC_ENVIRONMENT") . fst) baseEnv
+
+    -- Resolve the compiler binary that matches the env file's GHC version,
+    -- so we don't pick up a different system @ghc@ on @PATH@ when the user
+    -- has configured @with-compiler@.
+    let mGhcVersion = parseGhcVersionFromEnvFile envFile
+    cmd <- case mHaddockDir of
+      Nothing -> resolveVersionedExe "ghc"         "ghc"     mGhcVersion
+      Just _  -> resolveVersionedExe "haddock-ghc" "haddock" mGhcVersion
+
+    -- Compile each fixture in parallel, bounded by available cores
+    caps <- max 1 <$> getNumProcessors
+    sem <- newQSem caps
+    results <- forConcurrently jobs $
+      \(libName, srcDir, moduleNames, extraArgs) ->
+        bracket_ (waitQSem sem) (signalQSem sem) $ do
+          let outDir = workDir </> "out" </> libName
+          createDirectoryIfMissing True outDir
+          let allGhcOpts = ["-XHaskell2010"]
+                        ++ ghcOpts
+                        ++ extraArgs
+                        ++ ["-I" ++ dir | dir <- includeDirs]
+                        ++ ["-i" ++ srcDir]
+                        ++ ["-odir", outDir, "-hidir", outDir]
+                        ++ ["-stubdir", outDir]
+              args = case mHaddockDir of
+                Nothing ->
+                  -- ghc --make: pass module names
+                  ["--make", "-no-link"] ++ allGhcOpts ++ moduleNames
+                Just haddockDir ->
+                  -- haddock --ghc: pass source file paths
+                  let haddockOutDir = haddockDir </> libName
+                      sources = map (moduleToSrc srcDir) moduleNames
+                  in  ["--ghc", "--html", "-o", haddockOutDir]
+                   ++ map ("--optghc=" ++) allGhcOpts
+                   ++ sources
+              compileProc = (proc cmd args)
+                            { cwd = Just workDir
+                            , env = Just compileEnv
+                            }
+          (exitCode, _stdout, stderr) <-
+            readCreateProcessWithExitCode compileProc ""
+          let result = case exitCode of
+                ExitSuccess -> Right ()
+                _           -> Left stderr
+          return (libName, result)
+
+    return $ Map.fromList results
+
+-- | Convert a module name to a source file path
+--
+-- @Example.Safe@ -> @\<srcDir\>\/Example\/Safe.hs@
+moduleToSrc :: FilePath -> String -> FilePath
+moduleToSrc srcDir modName = srcDir </> map dotToSep modName <.> "hs"
+  where
+    dotToSep '.' = pathSeparator
+    dotToSep c   = c
+
+-- | Find the @.ghc.environment.*@ file in the given directory
+--
+-- Generated by cabal when @write-ghc-environment-files: always@ is set in
+-- @cabal.project@.  Env files reference package DBs under the shared cabal
+-- store; if the store has been cleaned since the file was written, the
+-- referenced paths no longer exist and @ghc@ will fail with cryptic linker
+-- errors.  We detect that case here and direct the user to rerun the build.
+discoverGhcEnvFile :: FilePath -> IO FilePath
+discoverGhcEnvFile dir = do
+    entries <- listDirectory dir
+    envFile <- case filter (".ghc.environment." `isPrefixOf`) entries of
+      [f] -> return (dir </> f)
+      []  -> fail $ "No .ghc.environment file found in " ++ dir
+                 ++ ". Ensure cabal.project has: write-ghc-environment-files: always"
+      fs  -> fail $ "Multiple .ghc.environment files in " ++ dir
+                 ++ ": " ++ show fs
+    checkPackageDbsExist envFile
+    return envFile
+
+-- | Extract the GHC version from a @.ghc.environment.*@ file name
+--
+-- Cabal names env files @.ghc.environment.\<arch\>-\<os\>-\<version\>@, e.g.
+-- @.ghc.environment.x86_64-linux-9.10.3@.  Splits off the suffix after the
+-- last @-@ and parses it with 'parseVersion'.  Returns 'Nothing' if the
+-- suffix is absent or not a valid version.
+parseGhcVersionFromEnvFile :: FilePath -> Maybe Version
+parseGhcVersionFromEnvFile envFile = do
+    suffix <- case break (== '-') (reverse (takeFileName envFile)) of
+      (revVer, '-':_) | not (null revVer) -> Just (reverse revVer)
+      _                                   -> Nothing
+    listToMaybe [ v | (v, "") <- readP_to_S parseVersion suffix ]
+
+-- | Locate a version-specific variant of an executable, falling back to a
+-- name without the version suffix
+--
+-- Given e.g. @versionedBase = "ghc"@, @fallback = "ghc"@, and version
+-- @9.10.3@, tries @ghc-9.10.3@, then @ghc-9.10@ (ghcup-style short alias),
+-- then @ghc@.  For haddock: @versionedBase = "haddock-ghc"@,
+-- @fallback = "haddock"@, since the GHC distribution names its haddock binary
+-- @haddock-ghc-X.Y.Z@.  Used to ensure fixture compilation invokes the same
+-- compiler cabal used to build the test suite, even when the system @ghc@ on
+-- @PATH@ is a different version.
+resolveVersionedExe :: String -> String -> Maybe Version -> IO FilePath
+resolveVersionedExe versionedBase fallback mVersion = do
+    let candidates = case mVersion of
+          Just v  -> map ((versionedBase ++ "-") ++) (versionVariants v)
+                  ++ [fallback]
+          Nothing -> [fallback]
+    found <- firstJustM findExecutable candidates
+    case found of
+      Just p  -> return p
+      Nothing -> fail $ "Could not find any of "
+                     ++ intercalate ", " candidates ++ " on PATH"
+  where
+    -- 9.10.3 -> ["9.10.3", "9.10"]; 9.10 -> ["9.10"]; 9 -> ["9"].
+    versionVariants :: Version -> [String]
+    versionVariants v = case versionBranch v of
+      branch@(_:_:_:_) -> [showVersion v, showVersion (makeVersion (take 2 branch))]
+      _                -> [showVersion v]
+
+    firstJustM :: Monad m => (a -> m (Maybe b)) -> [a] -> m (Maybe b)
+    firstJustM _ []     = return Nothing
+    firstJustM f (x:xs) = f x >>= maybe (firstJustM f xs) (return . Just)
+
+-- | Verify that every @package-db@ path referenced by an env file exists
+--
+-- Fails with a clear message when any path is missing (typically because the
+-- cabal store was cleaned after the env file was written).
+checkPackageDbsExist :: FilePath -> IO ()
+checkPackageDbsExist envFile = do
+    contents <- readFile' envFile
+    -- Paths in an env file are resolved relative to the env file's directory
+    -- (the project root), not the process CWD.
+    let envDir = takeDirectory envFile
+        resolve p = if isAbsolute p then p else envDir </> p
+        dbPaths = [ resolve p | line <- lines contents
+                              , Just p <- [stripPrefix "package-db " line]
+                              ]
+    missing <- filterM (fmap not . doesPathExist) dbPaths
+    case missing of
+      [] -> return ()
+      _  -> fail $ unlines $
+        [ "Stale GHC environment file: " ++ envFile
+        , "The following package-db paths no longer exist:"
+        ] ++ map ("  " ++) missing ++
+        [ ""
+        , "This usually means the cabal store was cleaned after the env"
+        , "file was written.  Rerun `cabal build all` to regenerate it."
+        ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Frontend/LanguageC.hs b/test/hs-bindgen/Test/HsBindgen/Frontend/LanguageC.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Frontend/LanguageC.hs
@@ -0,0 +1,496 @@
+{-# LANGUAGE RoleAnnotations #-}
+
+module Test.HsBindgen.Frontend.LanguageC (
+    tests
+    -- * Properties (exported for haddocks)
+  , prop_reparseGlobal_type_roundtripCanonical
+  , prop_reparseGlobal_primType_roundtripCanonical
+  , prop_reparseGlobal_complexType_roundtripCanonical
+  , prop_reparseGlobal_type_nonCanonicalToCanonical
+  , prop_reparseGlobal_primType_nonCanonicalToCanonical
+  , prop_reparseGlobal_complexType_nonCanonicalToCanonical
+  , prop_reparseGlobal_longDouble
+  ) where
+
+import Data.Bifunctor (Bifunctor (first))
+import Data.Default (Default (def))
+import Data.List qualified as List
+import Data.Map.Lazy qualified as Map
+import Data.Set qualified as Set
+import GHC.Show (appPrec, showSpace)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.QuickCheck (Arbitrary (arbitrary), Property, conjoin,
+                              counterexample, elements, ioProperty, once, oneof,
+                              tabulate, testProperty, (===))
+
+import Clang.HighLevel.Types (MultiLoc, Range (rangeStart), SourcePath,
+                              Token (tokenExtent, tokenSpelling),
+                              TokenSpelling (getTokenSpelling))
+
+import HsBindgen.Errors (panicPure)
+import HsBindgen.Frontend.LanguageC qualified as LanC
+import HsBindgen.Frontend.Pass.PrepareReparse.Flatten (flattenDefault)
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass (FlatTokens (FlatTokens, flatten, locStart),
+                                                      PrepareReparse)
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.LanC (LanC)
+import HsBindgen.IR.C qualified as C
+import HsBindgen.IR.Pass
+import HsBindgen.Language.C qualified as C
+
+import Test.HsBindgen.Clang (tokenize)
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Frontend.LanguageC" [
+      testProperty "prop_reparseGlobal_type_roundtripCanonical"
+        prop_reparseGlobal_type_roundtripCanonical
+    , testProperty "prop_reparseGlobal_primType_roundtripCanonical"
+        prop_reparseGlobal_primType_roundtripCanonical
+    , testProperty "prop_reparseGlobal_complexType_roundtripCanonical"
+        prop_reparseGlobal_complexType_roundtripCanonical
+    , testProperty "prop_reparseGlobal_type_nonCanonicalToCanonical"
+        prop_reparseGlobal_type_nonCanonicalToCanonical
+    , testProperty "prop_reparseGlobal_primType_nonCanonicalToCanonical"
+        prop_reparseGlobal_primType_nonCanonicalToCanonical
+    , testProperty "prop_reparseGlobal_complexType_nonCanonicalToCanonical"
+        prop_reparseGlobal_complexType_nonCanonicalToCanonical
+    , testProperty "prop_reparseGlobal_longDouble"
+        prop_reparseGlobal_longDouble
+    ]
+
+{-------------------------------------------------------------------------------
+  Properties: canonical types
+-------------------------------------------------------------------------------}
+
+-- |
+--
+-- 'prop_reparseGlobal_type_roundtripCanonical' \(\tau\) is a property that
+-- checks that a canonical C type \(\tau\) that we put into the reparser is the
+-- C type that we get out of the reparser. In other words, it should
+-- /roundtrip/:
+--
+-- \[
+--  \forall \tau. \text{reparseGlobal} ~ (\tau ~ \texttt{x;}) = \tau
+-- \]
+--
+prop_reparseGlobal_type_roundtripCanonical :: CanonicalType -> Property
+prop_reparseGlobal_type_roundtripCanonical ty =
+    prop_reparseGlobal
+      (\var -> C.showsVariableType (showString var) ty.unwrap)
+      (Right (coercePass ty.unwrap))
+
+-- | Variant of 'prop_reparseGlobal_type_roundtripCanonical' for /primitive/ C
+-- types
+prop_reparseGlobal_primType_roundtripCanonical :: CanonicalPrimType -> Property
+prop_reparseGlobal_primType_roundtripCanonical ty =
+    prop_reparseGlobal_type_roundtripCanonical $
+      CanonicalType (C.TypePrim ty.unwrap)
+
+-- | Variant of 'prop_reparseGlobal_type_roundtripCanonical' for /complex/ C
+-- types
+prop_reparseGlobal_complexType_roundtripCanonical :: CanonicalComplexType -> Property
+prop_reparseGlobal_complexType_roundtripCanonical ty =
+    prop_reparseGlobal_type_roundtripCanonical $
+      CanonicalType (C.TypeComplex (C.PrimFloating ty.unwrap))
+
+{-------------------------------------------------------------------------------
+  Canonical types
+-------------------------------------------------------------------------------}
+
+-- | A C type can have multiple textual representations, but only one is
+-- canonical. When we put any representation into the reparser, we expect to get
+-- the canonical representation out.
+--
+-- Each canonical representation corresponds to a unqiue value of our AST for C
+-- types.
+newtype CanonicalType = CanonicalType { unwrap :: C.Type PrePass }
+  deriving stock (Show, Eq)
+
+instance Arbitrary CanonicalType where
+  -- TODO: make this truly arbitrary
+  arbitrary = CanonicalType <$> oneof [
+      elements [
+          C.TypeQual C.QualConst (C.TypePointers 2 (C.TypePrim (C.PrimFloating C.PrimDouble)))
+        , C.TypePointers 1 (C.TypeIncompleteArray (C.TypePrim (C.PrimChar (C.PrimSignImplicit Nothing))))
+        ]
+    ]
+
+-- | A primitive C type can have multiple textual representations, but only one
+-- is canonical. When we put any representation into the reparser, we expect to
+-- get the canonical representation out.
+--
+-- Each canonical representation corresponds to a unqiue value of our AST for
+-- primitive C types.
+newtype CanonicalPrimType = CanonicalPrimType { unwrap :: C.PrimType }
+  deriving stock (Show, Eq)
+
+instance Arbitrary CanonicalPrimType where
+  arbitrary = elements enumerate
+
+-- | A complex C type can have multiple textual representations, but only one is
+-- canonical. When we put any representation into the reparser, we expect to get
+-- the canonical representation out.
+--
+-- Each canonical representation corresponds to a unqiue value of our AST for
+-- complex C types.
+newtype CanonicalComplexType = CanonicalComplexType { unwrap :: C.PrimFloatType }
+  deriving stock (Show, Eq)
+
+instance Arbitrary CanonicalComplexType where
+  arbitrary = elements enumerate
+
+{-------------------------------------------------------------------------------
+  Properties: non-canonical types
+-------------------------------------------------------------------------------}
+
+-- |
+--
+-- 'prop_reparseGlobal_type_nonCanonicalToCanonical' \(\tau\) is a property that
+-- checks that for a non-canonical C type \(\tau\) that we put into the reparser
+-- we get out a C type \(\sigma\) that is the canonical representation of
+-- \(\tau\).
+--
+-- \[
+--  \forall \tau, \sigma.
+--    isCanonical(\tau, \sigma) \implies
+--      \text{reparseGlobal} ~ (\tau ~ \texttt{x;}) = \sigma
+-- \]
+--
+prop_reparseGlobal_type_nonCanonicalToCanonical :: NonCanonicalType -> Property
+prop_reparseGlobal_type_nonCanonicalToCanonical ty =
+    prop_reparseGlobal
+      ty.representation
+      (Right (coercePass ty.canonical))
+
+-- | Variant of 'prop_reparseGlobal_type_nonCanonicalToCanonical' for
+-- /primitive/ C types
+prop_reparseGlobal_primType_nonCanonicalToCanonical :: NonCanonicalPrimType -> Property
+prop_reparseGlobal_primType_nonCanonicalToCanonical ty =
+    prop_reparseGlobal_type_nonCanonicalToCanonical $
+      NonCanonicalType {
+          representation = \var -> showString ty.representation . showSpace . showString var
+        , canonical = C.TypePrim ty.canonical
+        }
+
+-- | Variant of 'prop_reparseGlobal_type_nonCanonicalToCanonical' for /complex/
+-- C types
+prop_reparseGlobal_complexType_nonCanonicalToCanonical :: NonCanonicalComplexType -> Property
+prop_reparseGlobal_complexType_nonCanonicalToCanonical ty =
+    prop_reparseGlobal_type_nonCanonicalToCanonical $
+      NonCanonicalType {
+          representation = \var -> showString ty.representation . showSpace . showString var
+        , canonical = ty.canonical
+        }
+
+{-------------------------------------------------------------------------------
+  (Non-)canonical types
+-------------------------------------------------------------------------------}
+
+-- | A C type that is not guaranteed to be a a canonical type. See
+-- 'CanonicalType'.
+data NonCanonicalType = NonCanonicalType {
+    -- | A function of variable name to string
+    --
+    -- Some C types (like arrays) require printing characters before and after a
+    -- variable name. For example, an array-of-pointer-to-int:
+    --
+    -- > int (*x)[]
+    --
+    -- Hence, 'representation' is a function of variable name to string.
+    representation :: String -> ShowS
+  , canonical      :: C.Type PrePass
+  }
+
+instance Show NonCanonicalType where
+  showsPrec d ty = showParen (d > appPrec) $
+      showString "NonCanonicalType " . ty.representation ""
+
+instance Arbitrary NonCanonicalType where
+  -- TODO: make this truly arbitrary
+  arbitrary = elements [
+        NonCanonicalType {
+            representation = \var -> showString "_Bool " . showString var . showString " [3]"
+          , canonical = C.TypeConstArray 3 (C.TypePrim C.PrimBool)
+          }
+      ]
+
+-- | A primitive C type that is not guaranteed to be a a canonical type. See
+-- 'CanonicalPrimType'.
+data NonCanonicalPrimType = NonCanonicalPrimType {
+    representation :: String
+  , canonical      :: C.PrimType
+  }
+  deriving stock (Show, Eq)
+
+instance Arbitrary NonCanonicalPrimType where
+  arbitrary = elements enumerate
+
+-- | A complex C type that is not guaranteed to be a a canonical type. See
+-- 'CanonicalComplexType'.
+data NonCanonicalComplexType = NonCanonicalComplexType {
+    representation :: String
+  , canonical      :: C.Type PrePass
+  }
+  deriving stock (Show, Eq)
+
+instance Arbitrary NonCanonicalComplexType where
+  arbitrary = elements enumerate
+
+{-------------------------------------------------------------------------------
+  Properties: unsupported types
+-------------------------------------------------------------------------------}
+
+-- | Check that @long doubl@ and @long double _Complex@ are not supported
+prop_reparseGlobal_longDouble :: Property
+prop_reparseGlobal_longDouble = once $ conjoin [
+      prop_reparseGlobal (mkInput "long double") (Left (UpdateUnsupported "long double"))
+    , prop_reparseGlobal (mkInput "double long") (Left (UpdateUnsupported "long double"))
+    , prop_reparseGlobal (mkInput "long double _Complex") (Left (UpdateUnsupported "long double"))
+    , prop_reparseGlobal (mkInput "double long _Complex") (Left (UpdateUnsupported "long double"))
+    , prop_reparseGlobal (mkInput "long _Complex double") (Left (UpdateUnsupported "long double"))
+    , prop_reparseGlobal (mkInput "double _Complex long") (Left (UpdateUnsupported "long double"))
+    , prop_reparseGlobal (mkInput "_Complex long double") (Left (UpdateUnsupported "long double"))
+    , prop_reparseGlobal (mkInput "_Complex double long") (Left (UpdateUnsupported "long double"))
+    ]
+  where
+    mkInput typ = \var -> showString typ . showSpace . showString var
+
+{-------------------------------------------------------------------------------
+  Properties: basic
+-------------------------------------------------------------------------------}
+
+-- | Run the reparser and check that it has the expected output.
+prop_reparseGlobal ::
+     -- | Input: function of variable name to a string representing the type
+     -- applied to that variable.
+     (String -> ShowS)
+     -- | Expected output: either an error, or a reparsed type
+  -> Either Error (C.Type LanC)
+  -> Property
+prop_reparseGlobal input expectedOutput =
+    ioProperty $ do
+      -- The extent of a declaration, which the reparser receives, ends before
+      -- the @;@ terminating it.
+      tokens <- dropSemicolon <$> tokenize def contents
+      let flatTokens = FlatTokens {
+              flatten = flattenDefault tokens
+            , locStart = getLocation tokens
+            }
+          emptyEnv = LanC.ReparseEnv Map.empty Set.empty
+          output = LanC.reparseGlobal emptyEnv flatTokens
+      pure $
+        counterexample ("reparser input: " <> contents) $
+        tabulate "reparser input" [contents] $
+        expectedOutput === first removeCallstack output
+  where
+    contents = input "x" ";"
+
+    removeCallstack = \case
+        LanC.UpdateUnexpected _ str -> UpdateUnexpected str
+        LanC.UpdateUnsupported str  -> UpdateUnsupported str
+        LanC.UpdateSkipped str      -> UpdateSkipped str
+
+    dropSemicolon :: [Token SourcePath TokenSpelling] -> [Token SourcePath TokenSpelling]
+    dropSemicolon tokens = case reverse tokens of
+      t : ts | t.tokenSpelling.getTokenSpelling == ";" -> reverse ts
+      _otherwise -> panicPure "Expected a declaration terminated by ';'"
+
+    getLocation :: [Token SourcePath a] -> MultiLoc SourcePath
+    getLocation []    = panicPure "Unexpected empty list of tokens"
+    getLocation (t:_) = t.tokenExtent.rangeStart
+
+-- | The pass that comes just before the 'LanC' intermediate pass (of the
+-- @ReparseMacroExpansions@ pass)
+type PrePass = PrepareReparse
+
+-- | Copy of 'LanC.Error' without the callstack
+--
+-- We want to use an 'Eq' instance for 'LanC.Error' but it has a 'CallStack'
+-- field, and 'CallStack' does not have an 'Eq' instance. So we define our own
+-- version of 'LanC.Error' without the callstack.
+data Error =
+    UpdateUnexpected  String
+  | UpdateUnsupported String
+  | UpdateSkipped     String
+  deriving stock (Show, Eq)
+
+{-------------------------------------------------------------------------------
+  Enumerate
+-------------------------------------------------------------------------------}
+
+-- | Types for which all possible values can be enumerated
+class Enumerate a where
+  -- | Enumerate all possible values of a type
+  --
+  -- We advise to only define 'Enumerate' instances for types that are finite
+  -- (so that 'enumerate' can finish computing), and small(-ish) (to avoid
+  -- rampant combinatorial explosion).
+  enumerate :: [a]
+  default enumerate :: (Enum a, Bounded a) => [a]
+  enumerate = [minBound .. maxBound]
+
+instance Enumerate a => Enumerate (Maybe a) where
+  enumerate = concat [
+        pure Nothing
+      , Just <$> enumerate
+      ]
+
+{-------------------------------------------------------------------------------
+  Enumerate C types
+-------------------------------------------------------------------------------}
+
+instance Enumerate C.PrimType where
+  enumerate = concat [
+        C.PrimChar <$> enumerate
+      , C.PrimIntegral <$> enumerate <*> enumerate
+      , C.PrimFloating <$> enumerate
+      , pure C.PrimBool
+      ]
+
+instance Enumerate C.PrimIntType
+instance Enumerate C.PrimFloatType
+instance Enumerate C.PrimSign
+
+instance Enumerate C.PrimSignChar where
+  enumerate = concat [
+        C.PrimSignExplicit <$> enumerate
+        -- NOTE: we do not enumerate the @Just@ cases because they are printed
+        -- and reparsed the same way as the @Nothing@ cases.
+      , pure $ C.PrimSignImplicit Nothing
+      ]
+
+{-------------------------------------------------------------------------------
+  Enumerate canonical C types
+-------------------------------------------------------------------------------}
+
+instance Enumerate CanonicalPrimType where
+  enumerate = CanonicalPrimType <$> enumerate
+
+instance Enumerate CanonicalComplexType where
+  enumerate = CanonicalComplexType <$> enumerate
+
+{-------------------------------------------------------------------------------
+  Enumerate non-canonical C types
+-------------------------------------------------------------------------------}
+
+instance Enumerate NonCanonicalPrimType where
+  enumerate = List.nub $ concatMap permute canonicals
+    where
+      permute (str, canonical) = [
+            NonCanonicalPrimType (unwords strs') canonical
+          | strs' <- List.permutations $ words str
+          ]
+
+      canonicals = [
+            ( "char"
+            , C.PrimChar (C.PrimSignImplicit Nothing)
+            )
+          , ( "signed char"
+            , C.PrimChar (C.PrimSignExplicit C.Signed)
+            )
+          , ( "unsigned char"
+            , C.PrimChar (C.PrimSignExplicit C.Unsigned)
+            )
+          , ( "short"
+            , C.PrimIntegral C.PrimShort C.Signed
+            )
+          , ( "short int"
+            , C.PrimIntegral C.PrimShort C.Signed
+            )
+          , ( "signed short"
+            , C.PrimIntegral C.PrimShort C.Signed
+            )
+          , ( "signed short int"
+            , C.PrimIntegral C.PrimShort C.Signed
+            )
+          , ( "unsigned short"
+            , C.PrimIntegral C.PrimShort C.Unsigned
+            )
+          , ( "unsigned short int"
+            , C.PrimIntegral C.PrimShort C.Unsigned
+            )
+          , ( "int"
+            , C.PrimIntegral C.PrimInt C.Signed
+            )
+          , ( "signed"
+            , C.PrimIntegral C.PrimInt C.Signed
+            )
+          , ( "signed int"
+            , C.PrimIntegral C.PrimInt C.Signed
+            )
+          , ( "unsigned"
+            , C.PrimIntegral C.PrimInt C.Unsigned
+            )
+          , ( "unsigned int"
+            , C.PrimIntegral C.PrimInt C.Unsigned
+            )
+          , ( "long"
+            , C.PrimIntegral C.PrimLong C.Signed
+            )
+          , ( "long int"
+            , C.PrimIntegral C.PrimLong C.Signed
+            )
+          , ( "signed long"
+            , C.PrimIntegral C.PrimLong C.Signed
+            )
+          , ( "signed long int"
+            , C.PrimIntegral C.PrimLong C.Signed
+            )
+          , ( "unsigned long"
+            , C.PrimIntegral C.PrimLong C.Unsigned
+            )
+          , ( "unsigned long int"
+            , C.PrimIntegral C.PrimLong C.Unsigned
+            )
+          , ( "long long"
+            , C.PrimIntegral C.PrimLongLong C.Signed
+            )
+          , ( "long long int"
+            , C.PrimIntegral C.PrimLongLong C.Signed
+            )
+          , ( "signed long long"
+            , C.PrimIntegral C.PrimLongLong C.Signed
+            )
+          , ( "signed long long int"
+            , C.PrimIntegral C.PrimLongLong C.Signed
+            )
+          , ( "unsigned long long"
+            , C.PrimIntegral C.PrimLongLong C.Unsigned
+            )
+          , ( "unsigned long long int"
+            , C.PrimIntegral C.PrimLongLong C.Unsigned
+            )
+          , ( "float"
+            , C.PrimFloating C.PrimFloat
+            )
+          , ( "double"
+            , C.PrimFloating C.PrimDouble
+            )
+          -- NOTE: @long double@ is not supported by the reparser. See
+          -- 'prop_reparseGlobal_longDouble' for a dedicated test instead.
+          , ( "_Bool"
+            , C.PrimBool
+            )
+          ]
+
+instance Enumerate NonCanonicalComplexType where
+  enumerate = List.nub $ concatMap permute canonicals
+    where
+      permute (str, canonical) = [
+          NonCanonicalComplexType (unwords strs') canonical
+        | strs' <- List.permutations $ words str
+        ]
+
+      canonicals = [
+          ( "float _Complex"
+          , C.TypeComplex (C.PrimFloating C.PrimFloat)
+          )
+        , ( "double _Complex"
+          , C.TypeComplex (C.PrimFloating C.PrimDouble)
+          )
+          -- NOTE: @long double _Complex@ is not supported by the reparser. See
+          -- 'prop_reparseGlobal_longDouble' for a dedicated test instead.
+        ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Frontend/Pass/PrepareReparse.hs b/test/hs-bindgen/Test/HsBindgen/Frontend/Pass/PrepareReparse.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Frontend/Pass/PrepareReparse.hs
@@ -0,0 +1,161 @@
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Test.HsBindgen.Frontend.Pass.PrepareReparse (
+    tests
+  ) where
+
+import Prelude hiding (lex, print)
+
+import Data.Bifunctor (Bifunctor (second))
+import Data.Char (isSpace)
+import Data.List qualified as List
+import Data.List.NonEmpty (NonEmpty (..))
+import Data.List.NonEmpty qualified as NE
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.QuickCheck (Arbitrary (..), Arbitrary1 (..), Property,
+                              counterexample, elements, listOf, suchThat,
+                              testProperty, (===))
+import Text.Parsec (ParseError)
+
+import HsBindgen.Frontend.Pass.PrepareReparse.AST (Decl (..), Tag (..),
+                                                   TagName (..), TagType,
+                                                   Target (..))
+import HsBindgen.Frontend.Pass.PrepareReparse.Lexer (lex)
+import HsBindgen.Frontend.Pass.PrepareReparse.Parser (Parse, parse)
+import HsBindgen.Frontend.Pass.PrepareReparse.Printer (Print, print)
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Frontend.Pass.PrepareReparse" [
+      testProperty "prop_roundtripCommon @[Target]" $
+        prop_roundtripCommon @[Target]
+    , testProperty "prop_roundtripCommon @Target" $
+        prop_roundtripCommon @Target
+    , testProperty "prop_roundtripCommon @Decl" $
+        prop_roundtripCommon @Decl
+    , testProperty "prop_roundtripCommon @Tag" $
+        prop_roundtripCommon @Tag
+    , testProperty "prop_roundtripCommon @TagType" $
+        prop_roundtripCommon @TagType
+    , testProperty "prop_roundtripCommon @TagName" $
+        prop_roundtripCommon @TagName
+    ]
+
+{-------------------------------------------------------------------------------
+  Property
+-------------------------------------------------------------------------------}
+
+-- | Test that AST types that are common to 'PreHeader' and 'PostHeader' can
+-- rountrip through the printer, lexer, and parser.
+--
+-- \[
+--  \texttt{normalize} \dot \texttt{parse} \dot \texttt{lex} \dot \texttt{print}
+--     = \texttt{normalize}
+-- \]
+--
+-- Whitespace is not preserved verbatim, so we normalize the AST types on both
+-- sides of the equation.
+prop_roundtripCommon ::
+     forall a. (Print a, Parse a, Normalize a, Eq a, Show a)
+  => a -> Property
+prop_roundtripCommon x =
+    counterexample ("printed: " <> printed) $
+    counterexample ("tokenized: " <> show tokenized) $
+    counterexample ("parsed: " <> show parsed) $
+    lhs === rhs
+  where
+    lhs, rhs :: Either ParseError a
+    lhs = Right (normalize x)
+    rhs = second normalize parsed
+
+    printed = print x ""
+    tokenized = lex printed
+    parsed = parse =<< tokenized
+
+{-------------------------------------------------------------------------------
+  Normalize
+-------------------------------------------------------------------------------}
+
+class Normalize a where
+  normalize :: a -> a
+
+instance Normalize [Target] where
+  normalize xs = fmap normalize xs
+
+instance Normalize Target where
+  normalize (Target tag decl) = Target (normalize tag) (normalize decl)
+
+instance Normalize Decl where
+  normalize (Decl code) = Decl (normalize code)
+
+instance Normalize Tag where
+  normalize (Tag typ name) = Tag (normalize typ) (normalize name)
+
+instance Normalize TagType where
+  normalize = id
+
+instance Normalize TagName where
+  normalize (TagName s) = TagName $ normalize s
+
+instance Normalize String where
+  normalize s =
+      go $
+      map (\x -> if isSpace x then ' ' else x) $
+      List.dropWhile isSpace $
+      List.dropWhileEnd isSpace $
+      s
+    where
+      go [] = []
+      go (x : xs)
+        | x == ' ' = x : go (dropWhile (==' ') xs)
+        | otherwise = x : go xs
+
+{-------------------------------------------------------------------------------
+  Arbitrary
+-------------------------------------------------------------------------------}
+
+instance Arbitrary Target where
+  arbitrary = Target <$> arbitrary <*> arbitrary
+  shrink (Target x y) = uncurry Target <$> shrink (x, y)
+
+instance Arbitrary Decl where
+  arbitrary = Decl <$> liftArbitrary (arbitrary `suchThat` (/= '/'))
+  shrink (Decl x) = Decl <$> shrink x
+
+instance Arbitrary Tag where
+  arbitrary = Tag <$> arbitrary <*> arbitrary
+  shrink (Tag x y) = uncurry Tag <$> shrink (x, y)
+
+instance Arbitrary TagName where
+  arbitrary = TagName . NE.toList . (.unwrap) <$> liftArbitrary @MyNonEmpty f
+    where
+      f = elements $ concat [
+            [ 'a' .. 'z' ]
+          , [ 'A' .. 'Z' ]
+          , [ '0' .. '9' ]
+          ]
+
+-- 'NonEmpty' wrapper for compatibility with QuickCheck
+--
+-- QuickCheck implements 'Arbitrary' instances for 'NonEmpty' only since version
+-- 2.17
+newtype MyNonEmpty a = MyNonEmpty { unwrap :: NonEmpty a }
+
+instance Arbitrary a => Arbitrary (MyNonEmpty a) where
+  arbitrary = liftArbitrary arbitrary
+  shrink = liftShrink shrink
+
+instance Arbitrary1 MyNonEmpty where
+  liftArbitrary f = MyNonEmpty <$> ((:|) <$> f <*> listOf f)
+  liftShrink f (MyNonEmpty (x :| xs)) = [
+        MyNonEmpty (NE.fromList xs')
+      | xs' <- liftShrink f (x:xs)
+      , not (null xs')
+      ]
+
+instance Arbitrary TagType where
+  arbitrary = elements [minBound .. maxBound ]
+  shrink _ = [] -- TODO
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden.hs b/test/hs-bindgen/Test/HsBindgen/Golden.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden.hs
@@ -0,0 +1,60 @@
+-- | Golden tests
+module Test.HsBindgen.Golden (
+    tests
+  , allTestCases
+  , module Test.HsBindgen.Golden.Infra.TestCase
+  ) where
+
+import Test.Tasty
+
+import Test.HsBindgen.Golden.Arrays qualified as Arrays
+import Test.HsBindgen.Golden.Attributes qualified as Attributes
+import Test.HsBindgen.Golden.BindingSpecs qualified as BindingSpecs
+import Test.HsBindgen.Golden.Comprehensive qualified as Comprehensive
+import Test.HsBindgen.Golden.Declarations qualified as Declarations
+import Test.HsBindgen.Golden.Documentation qualified as Documentation
+import Test.HsBindgen.Golden.EdgeCases qualified as EdgeCases
+import Test.HsBindgen.Golden.Functions qualified as Functions
+import Test.HsBindgen.Golden.Globals qualified as Globals
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Golden.Infra.TestCaseTree
+import Test.HsBindgen.Golden.Macros qualified as Macros
+import Test.HsBindgen.Golden.Macros.Lang qualified as Macros.Lang
+import Test.HsBindgen.Golden.Macros.Redeclaration qualified as Macros.Redeclaration
+import Test.HsBindgen.Golden.Macros.Reparse qualified as Macros.Reparse
+import Test.HsBindgen.Golden.ProgramAnalysis qualified as ProgramAnalysis
+import Test.HsBindgen.Golden.Types qualified as Types
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: IO TestResources -> TestTree
+tests getTestResources = testTreeFor getTestResources testCaseTree
+
+testCaseTree :: TestCaseTree
+testCaseTree =
+    TestCaseSection "Test.HsBindgen.Golden" [
+        TestCases "arrays"          Arrays.testCases
+      , TestCases "attributes"      Attributes.testCases
+      , TestCases "bindingSpecs"    BindingSpecs.testCases
+      , TestCases "comprehensive"   Comprehensive.testCases
+      , TestCases "declarations"    Declarations.testCases
+      , TestCases "documentation"   Documentation.testCases
+      , TestCases "edgeCases"       EdgeCases.testCases
+      , TestCases "functions"       Functions.testCases
+      , TestCases "globals"         Globals.testCases
+      , TestCaseSection "macros" $ concat [
+            TestCaseLeafs Macros.testCases
+          , [ TestCaseSection "redeclaration" Macros.Redeclaration.testCases ]
+          , [ TestCaseSection "reparse"       Macros.Reparse.testCases ]
+          , [ TestCaseSection "languages"     Macros.Lang.testCases ]
+          ]
+      , TestCases "programAnalysis" ProgramAnalysis.testCases
+      , TestCases "types"           Types.testCases
+      ]
+
+-- | All test cases, for use by TH fixture compilation
+allTestCases :: [TestCase]
+allTestCases = flatten testCaseTree
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Arrays.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Arrays.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Arrays.hs
@@ -0,0 +1,161 @@
+-- | Golden tests: arrays
+module Test.HsBindgen.Golden.Arrays (testCases) where
+
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      test_array
+    , test_const_qualifier
+    , test_multi_dim
+    , test_failing_array_res_1
+    , test_failing_array_res_2
+    , test_failing_array_res_3
+    , test_failing_array_res_4
+    , test_failing_array_res_5
+    , test_failing_array_res_6
+    , test_failing_array_res_7
+    , test_failing_array_res_8
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test_array :: TestCase
+test_array =
+    defaultTest "arrays/array"
+      & #clangVersion   .~ Just (>= (19, 0, 0))
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+              Just $ Expected name
+            MatchDiagnosticOption "-Wno-extern-initializer" ->
+              Just Tolerated
+            MatchDiagnosticOption "-Wno-tentative-definition-array" ->
+              Just Tolerated
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          -- Duplicate symbols
+          "arr0"
+        , "arr3"
+        , "arr1"
+        , "arr6"
+        ]
+
+-- | @const@ qualifiers applied to arrays (through typedefs) should be
+-- represented in the bindings.
+test_const_qualifier :: TestCase
+test_const_qualifier = defaultTest "arrays/const_qualifier"
+
+test_multi_dim :: TestCase
+test_multi_dim = defaultTest "arrays/multi_dim"
+
+test_failing_array_res_1 :: TestCase
+test_failing_array_res_1 =
+    failingTestLibclangSimple "arrays/failing/array_res_1" $ \case
+      (matchDiagnosticSpelling "function cannot return array type" -> Just _diag) ->
+        Just $ Expected ()
+      TraceFrontend (FrontendClang _) ->
+        Just $ Tolerated
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+test_failing_array_res_2 :: TestCase
+test_failing_array_res_2 =
+    failingTestLibclangSimple "arrays/failing/array_res_2" $ \case
+      (matchDiagnosticSpelling "function cannot return array type" -> Just _diag) ->
+        Just $ Expected ()
+      TraceFrontend (FrontendClang _) ->
+        Just $ Tolerated
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+test_failing_array_res_3 :: TestCase
+test_failing_array_res_3 =
+    failingTestLibclangSimple "arrays/failing/array_res_3" $ \case
+      (matchDiagnosticSpelling "function cannot return array type" -> Just _diag) ->
+        Just $ Expected ()
+      TraceFrontend (FrontendClang _) ->
+        Just $ Tolerated
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+test_failing_array_res_4 :: TestCase
+test_failing_array_res_4 =
+    failingTestLibclangSimple "arrays/failing/array_res_4" $ \case
+      (matchDiagnosticSpelling "function cannot return array type" -> Just _diag) ->
+        Just $ Expected ()
+      TraceFrontend (FrontendClang _) ->
+        Just $ Tolerated
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+test_failing_array_res_5 :: TestCase
+test_failing_array_res_5 =
+    failingTestLibclangSimple "arrays/failing/array_res_5" $ \case
+      (matchDiagnosticSpelling "function cannot return array type" -> Just _diag) ->
+        Just $ Expected ()
+      TraceFrontend (FrontendClang _) ->
+        Just $ Tolerated
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+test_failing_array_res_6 :: TestCase
+test_failing_array_res_6 =
+    failingTestLibclangSimple "arrays/failing/array_res_6" $ \case
+      (matchDiagnosticSpelling "function cannot return array type" -> Just _diag) ->
+        Just $ Expected ()
+      TraceFrontend (FrontendClang _) ->
+        Just $ Tolerated
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+test_failing_array_res_7 :: TestCase
+test_failing_array_res_7 =
+    failingTestLibclangSimple "arrays/failing/array_res_7" $ \case
+      (matchDiagnosticSpelling "function cannot return array type" -> Just _diag) ->
+        Just $ Expected ()
+      TraceFrontend (FrontendClang _) ->
+        Just $ Tolerated
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+test_failing_array_res_8 :: TestCase
+test_failing_array_res_8 =
+    failingTestLibclangSimple "arrays/failing/array_res_8" $ \case
+      (matchDiagnosticSpelling "function cannot return array type" -> Just _diag) ->
+        Just $ Expected ()
+      TraceFrontend (FrontendClang _) ->
+        Just $ Tolerated
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Attributes.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Attributes.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Attributes.hs
@@ -0,0 +1,117 @@
+-- | Golden tests: attributes
+module Test.HsBindgen.Golden.Attributes (testCases) where
+
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      defaultTest "attributes/visibility/edge-cases/nested_types"
+    , defaultTest "attributes/visibility/types"
+    , test_asm
+    , test_attributes
+    , test_deprecated
+    , test_type_attributes
+    , test_visibility_functions
+    , test_visibility_variables
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test_asm :: TestCase
+test_asm =
+    defaultTest "attributes/asm"
+      & #clangVersion .~ Just (>= (18, 0, 0))
+      & #cStandard    .~ gnu23
+
+test_attributes :: TestCase
+test_attributes =
+    testDiagnostic "attributes/attributes" $ \diag ->
+      diagnosticCategoryText diag == "Nullability Issue"
+
+test_deprecated :: TestCase
+test_deprecated =
+  defaultTest "attributes/deprecated"
+    & #onFrontend .~ ( #selectionPredicate .~
+          BAnd
+            (BIf (SelectHeader FromMainHeaders))
+            (BNot (BIf (SelectDecl DeclDeprecated)))
+        )
+    & #tracePredicate .~ singleTracePredicate (\case
+            MatchNoDeclarations ->
+              Just $ Expected ()
+            _otherwise ->
+              Nothing
+          )
+
+test_type_attributes :: TestCase
+test_type_attributes =
+    testTraceSimple "attributes/type_attributes" $ \case
+      MatchSelect _name SelectDeprecated{} ->
+        Just $ Expected ()
+      _otherwise ->
+        Nothing
+
+test_visibility_functions :: TestCase
+test_visibility_functions =
+    defaultTest "attributes/visibility/functions"
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+              Just $ Expected name
+            MatchDelayed name ParseNonPublicVisibility{} ->
+              Just $ Expected name
+            MatchDiagnosticOption "-Wno-extern-initializer" ->
+              Just Tolerated
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          -- Problematic non-public visibility
+          "f2" , "f3" , "f4"
+        , "f12", "f13", "f14"
+
+          -- Duplicate symbols
+        , "f5" , "f6" , "f7" , "f8" , "f9"
+        , "f15", "f16", "f17", "f18", "f19"
+        ]
+
+test_visibility_variables :: TestCase
+test_visibility_variables =
+    defaultTest "attributes/visibility/variables"
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+              Just $ Expected name
+            MatchDelayed name ParseNonPublicVisibility{} ->
+              Just $ Expected name
+            MatchDiagnosticOption "-Wno-extern-initializer" ->
+              Just Tolerated
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          -- Problematic non-public visibility
+          "i12", "i13", "i14"
+          -- Duplicate symbols
+        , "i0" , "i1" , "i2" , "i3" , "i4"
+        , "i5" , "i6" , "i7" , "i8" , "i9"
+        , "i15", "i16", "i17", "i18", "i19"
+        ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/BindingSpecs.hs b/test/hs-bindgen/Test/HsBindgen/Golden/BindingSpecs.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/BindingSpecs.hs
@@ -0,0 +1,431 @@
+-- | Golden tests: binding specs
+module Test.HsBindgen.Golden.BindingSpecs (testCases) where
+
+import System.FilePath ((<.>), (</>))
+
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      test_omit_type
+      -- * Bugs / regression tests
+    , test_relative_include
+    , test_trans_dep_macro_trans_dep_missing
+    , test_trans_dep_typedef_trans_dep_missing
+      -- * Naming types
+    , test_name_squash_both
+    , test_name_squash_struct
+    , test_name_squash_typedef
+    , test_name_type
+      -- * C @enum@ specification
+    , test_enum_closed
+    , test_enum_open
+    , test_enum_mismatch
+      -- * Representation: emptydata
+    , test_rep_emptydata_staticsize
+      -- * Function arguments with typedefs
+    , test_fun_arg_typedef_array
+    , test_fun_arg_typedef_array_known_size
+    , test_fun_arg_typedef_enum
+    , test_fun_arg_typedef_function
+    , test_fun_arg_typedef_function_pointer
+    , test_fun_arg_typedef_struct
+    , test_fun_arg_typedef_union
+      -- * Function arguments with macros
+    , test_fun_arg_macro_array
+    , test_fun_arg_macro_array_known_size
+    , test_fun_arg_macro_enum
+    , test_fun_arg_macro_function
+    , test_fun_arg_macro_function_pointer
+    , test_fun_arg_macro_struct
+    , test_fun_arg_macro_union
+      -- * Standard library
+    , test_stdlib_instances_c11
+    , test_stdlib_instances_c23
+    , test_stdlib_bool_c23
+    , test_stdlib_return_values
+    ]
+
+{-------------------------------------------------------------------------------
+  Omit type
+-------------------------------------------------------------------------------}
+
+test_omit_type :: TestCase
+test_omit_type =
+    defaultTest "binding-specs/omit_type"
+      & #specPrescriptive .~
+          Just "test-artefacts/headers/golden/binding-specs/omit_type_p.yaml"
+
+{-------------------------------------------------------------------------------
+  Bugs / regression tests
+-------------------------------------------------------------------------------}
+
+-- | External binding specs match correctly when the same header is reached by
+--   different @#include@ paths (@core.h@ vs @../core.h@). See #2236.
+test_relative_include :: TestCase
+test_relative_include =
+    defaultTest "binding-specs/relative_include/sub/consumer"
+      & #specExternal .~
+          [ "test-artefacts/headers/golden/binding-specs/relative_include/sub/consumer.yaml"
+          ]
+      & #onFrontend .~
+          #selectionPredicate .~ BIf (SelectDecl (DeclNameMatches "widget_legacy_t|use_widget"))
+
+-- | External binding specifications for non-selected macro types should not
+--   lead to warnings/errors
+test_trans_dep_macro_trans_dep_missing :: TestCase
+test_trans_dep_macro_trans_dep_missing =
+    defaultTest "binding-specs/trans_dep/macro_trans_dep_missing"
+      & #specExternal .~
+          [ "test-artefacts/headers/golden/binding-specs/trans_dep/macro_trans_dep_missing.yaml"
+          ]
+      & #onFrontend .~
+          #selectionPredicate .~ BIf (SelectDecl (DeclNameMatches "B|foo"))
+      -- Macros should not fail to parse.
+      & #tracePredicate .~
+          multiTracePredicateCustomLogLevel @()
+            (getCustomLogLevel [EnableMacroWarnings]) [] (const Nothing)
+
+-- | External binding specifications for non-selected typedef types should not
+--   lead to warnings/errors
+test_trans_dep_typedef_trans_dep_missing :: TestCase
+test_trans_dep_typedef_trans_dep_missing =
+    defaultTest "binding-specs/trans_dep/typedef_trans_dep_missing"
+      & #specExternal .~
+          [ "test-artefacts/headers/golden/binding-specs/trans_dep/typedef_trans_dep_missing.yaml"
+          ]
+      & #onFrontend .~
+          #selectionPredicate .~ BIf (SelectDecl (DeclNameMatches "B|foo"))
+
+{-------------------------------------------------------------------------------
+  Naming types
+-------------------------------------------------------------------------------}
+
+-- | Naming a squashed type, specifying the name for both the struct and typedef
+test_name_squash_both :: TestCase
+test_name_squash_both =
+    defaultTest "binding-specs/name/squash_both"
+      & #specPrescriptive .~
+          Just "test-artefacts/headers/golden/binding-specs/name/squash_both_p.yaml"
+
+-- | Naming a squashed type, specifying the name for the struct
+test_name_squash_struct :: TestCase
+test_name_squash_struct =
+    defaultTest "binding-specs/name/squash_struct"
+      & #specPrescriptive .~
+          Just "test-artefacts/headers/golden/binding-specs/name/squash_struct_p.yaml"
+
+-- | Naming a squashed type, specifying the name for the typedef
+test_name_squash_typedef :: TestCase
+test_name_squash_typedef =
+    defaultTest "binding-specs/name/squash_typedef"
+      & #specPrescriptive .~
+          Just "test-artefacts/headers/golden/binding-specs/name/squash_typedef_p.yaml"
+
+-- | Naming a type
+test_name_type :: TestCase
+test_name_type =
+    defaultTest "binding-specs/name/type"
+      & #specPrescriptive .~
+          Just "test-artefacts/headers/golden/binding-specs/name/type_p.yaml"
+
+{-------------------------------------------------------------------------------
+  C @enum@ specification
+-------------------------------------------------------------------------------}
+
+test_enum_closed :: TestCase
+test_enum_closed =
+    defaultTest "binding-specs/enum/closed"
+      & #specPrescriptive .~
+          Just "test-artefacts/headers/golden/binding-specs/enum/closed_p.yaml"
+
+test_enum_open :: TestCase
+test_enum_open =
+    defaultTest "binding-specs/enum/open"
+      & #specPrescriptive .~
+          Just "test-artefacts/headers/golden/binding-specs/enum/open_p.yaml"
+
+test_enum_mismatch :: TestCase
+test_enum_mismatch =
+    testTraceSimple "binding-specs/enum/mismatch" auxTrace
+      & #specPrescriptive .~
+          Just "test-artefacts/headers/golden/binding-specs/enum/mismatch_p.yaml"
+  where
+    auxTrace :: TraceMsg -> Maybe (TraceExpectation ())
+    auxTrace traceMsg = do
+      declId <- case traceMsg of
+        TraceFrontend
+          (FrontendResolveBindingSpecs
+            (ResolveBindingSpecsEnumTypeMismatch declId)) -> Just declId
+        _otherwise -> Nothing
+      guard $ C.renderDeclId declId == "struct pt"
+      return $ Expected ()
+
+{-------------------------------------------------------------------------------
+  Representation: emptydata
+-------------------------------------------------------------------------------}
+
+-- | StaticSize instances for the emptydata representation
+--
+-- A single header exercises every emptydata case in one place: structs, unions,
+-- and enums (whose layout is known directly), typedefs resolved to a complete
+-- underlying type (directly, through a chain, and to a union), and the cases
+-- with no size available at this pass (a typedef to a primitive, an opaque
+-- forward declaration, and a macro naming a pointer).
+--
+-- The typedefs' underlying types live in an included header; program slicing
+-- keeps them out of the generated output.
+test_rep_emptydata_staticsize :: TestCase
+test_rep_emptydata_staticsize =
+    defaultTest "binding-specs/rep/emptydata/staticsize"
+      & #specPrescriptive .~
+          Just "test-artefacts/headers/golden/binding-specs/rep/emptydata/staticsize_p.yaml"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BIf (SelectHeader FromMainHeaders)
+          & #programSlicing .~ EnableProgramSlicing
+          )
+
+{-------------------------------------------------------------------------------
+  Function arguments with typedefs
+-------------------------------------------------------------------------------}
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a typedef with an underlying array type (of
+-- unknown size).
+--
+-- Arrays are passed by 'Ptr' to the first element of the array.
+test_fun_arg_typedef_array :: TestCase
+test_fun_arg_typedef_array =
+    test_fun_arg_typedef "binding-specs/fun_arg/typedef/array"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a typedef with an underlying array type of
+-- known size.
+--
+-- Arrays of known size are passed by 'Ptr' to the first element of the array.
+test_fun_arg_typedef_array_known_size :: TestCase
+test_fun_arg_typedef_array_known_size =
+    test_fun_arg_typedef "binding-specs/fun_arg/typedef/array_known_size"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a typedef with an underlying enum type.
+--
+-- Enums can be passed by value rather than by 'Ptr'.
+test_fun_arg_typedef_enum :: TestCase
+test_fun_arg_typedef_enum =
+    test_fun_arg_typedef "binding-specs/fun_arg/typedef/enum"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a typedef with an underlying function type.
+--
+-- Functions should be passed by 'FunPtr' rather than by 'Ptr'. Previously we
+-- had a bug where we doing the latter, see issue #1363.
+test_fun_arg_typedef_function :: TestCase
+test_fun_arg_typedef_function =
+    test_fun_arg_typedef "binding-specs/fun_arg/typedef/function"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a typedef with an underlying function pointer
+-- type.
+--
+-- Functions should be passed by 'FunPtr' rather than by 'Ptr'.
+test_fun_arg_typedef_function_pointer :: TestCase
+test_fun_arg_typedef_function_pointer =
+    test_fun_arg_typedef "binding-specs/fun_arg/typedef/function_pointer"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a typedef with an underlying struct type.
+--
+-- Structs should be passed by 'Ptr' rather than by value.
+test_fun_arg_typedef_struct :: TestCase
+test_fun_arg_typedef_struct =
+    test_fun_arg_typedef "binding-specs/fun_arg/typedef/struct"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a typedef with an underlying union type.
+--
+-- Union should be passed by 'Ptr' rather than by value.
+test_fun_arg_typedef_union :: TestCase
+test_fun_arg_typedef_union =
+    test_fun_arg_typedef "binding-specs/fun_arg/typedef/union"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a typedef.
+test_fun_arg_typedef :: FilePath -> TestCase
+test_fun_arg_typedef path =
+  defaultTest path
+      & #specExternal .~
+          [ "test-artefacts" </> "headers" </> "golden" </> path <.> "yaml"
+          ]
+      & #onFrontend .~
+          #selectionPredicate .~ test_fun_arg_typedef_selectionPredicate
+
+-- | Selection predicate for 'test_fun_arg_typedef' tests
+test_fun_arg_typedef_selectionPredicate :: Boolean SelectionPredicate
+test_fun_arg_typedef_selectionPredicate =
+    BOr (BIf $ SelectDecl (DeclNameMatches "\\b(A|B|C|D|E)$|My"))
+        (BIf $ SelectDecl (DeclNameMatches "(foo.*)|(bar.*)"))
+
+{-------------------------------------------------------------------------------
+  Function arguments with macros
+-------------------------------------------------------------------------------}
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a macro type with an underlying array type (of
+-- unknown size).
+--
+-- Arrays are passed by 'Ptr' to the first element of the array.
+test_fun_arg_macro_array :: TestCase
+test_fun_arg_macro_array =
+    test_fun_arg_macro "binding-specs/fun_arg/macro/array"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a macro type with an underlying array type of
+-- known size.
+--
+-- Arrays of known size are passed by 'Ptr' to the first element of the array.
+test_fun_arg_macro_array_known_size :: TestCase
+test_fun_arg_macro_array_known_size =
+    test_fun_arg_macro "binding-specs/fun_arg/macro/array_known_size"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a macro type with an underlying enum type.
+--
+-- Enums can be passed by value rather than by 'Ptr'.
+test_fun_arg_macro_enum :: TestCase
+test_fun_arg_macro_enum =
+    test_fun_arg_macro "binding-specs/fun_arg/macro/enum"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a macro type with an underlying function type.
+--
+-- Functions should be passed by 'FunPtr' rather than by 'Ptr'. Previously we
+-- had a bug where we doing the latter, see issue #1363.
+test_fun_arg_macro_function :: TestCase
+test_fun_arg_macro_function =
+    test_fun_arg_macro "binding-specs/fun_arg/macro/function"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a macro type with an underlying function
+-- pointer type.
+--
+-- Functions should be passed by 'FunPtr' rather than by 'Ptr'.
+test_fun_arg_macro_function_pointer :: TestCase
+test_fun_arg_macro_function_pointer =
+    test_fun_arg_macro "binding-specs/fun_arg/macro/function_pointer"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a macro type with an underlying struct type.
+--
+-- Structs should be passed by 'Ptr' rather than by value.
+test_fun_arg_macro_struct :: TestCase
+test_fun_arg_macro_struct =
+    test_fun_arg_macro "binding-specs/fun_arg/macro/struct"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a macro type with an underlying union type.
+--
+-- Union should be passed by 'Ptr' rather than by value.
+test_fun_arg_macro_union :: TestCase
+test_fun_arg_macro_union =
+    test_fun_arg_macro "binding-specs/fun_arg/macro/union"
+
+-- | Test that @hs-bindgen@ can detect whether an external binding reference in
+-- a function argument references a macro type.
+test_fun_arg_macro :: FilePath -> TestCase
+test_fun_arg_macro path =
+  defaultTest path
+      & #specExternal .~
+          [ "test-artefacts" </> "headers" </> "golden" </> path <.> "yaml"
+          ]
+      & #onFrontend .~
+          #selectionPredicate .~ test_fun_arg_macro_selectionPredicate
+      -- Macros should not fail to parse.
+      & #tracePredicate .~
+          multiTracePredicateCustomLogLevel @()
+            (getCustomLogLevel [EnableMacroWarnings]) [] (const Nothing)
+
+-- | Selection predicate for 'test_fun_arg_macro' tests
+test_fun_arg_macro_selectionPredicate :: Boolean SelectionPredicate
+test_fun_arg_macro_selectionPredicate =
+    BOr (BIf $ SelectDecl (DeclNameMatches "\\b(A|B|C|D|E)$|My"))
+        (BIf $ SelectDecl (DeclNameMatches "(foo.*)|(bar.*)"))
+
+{-------------------------------------------------------------------------------
+  Standard library
+-------------------------------------------------------------------------------}
+
+-- The following test variants examine "expectations" about how we handle
+-- @bool@.
+--
+-- | The translation of @bool@ involves unique pitfalls. Historically defined as
+-- a macro in @stdbool.h@, it became a primitive keyword in C23.
+--
+-- We translate @bool@ to 'HsBindgen.Runtime.LibC.CBool'.
+--
+-- Given the C header file
+--
+-- @
+-- #include <stdbool.h>
+-- typedef bool Foo;
+-- @
+--
+-- and @stdbool.h@
+--
+-- @
+-- #define bool _Bool
+-- @
+--
+-- Since @bool@ is a macro, @libclang@ will inform us about a macro expansion in
+-- the definition of @Foo@. That is, we always reparse the @bool@ macro in
+-- @Foo@.
+--
+-- The reparse environment depends on the C standard (in C23 we translate @bool@
+-- directly to the primitive boolean type).
+--
+-- **Case 1: C11**
+--
+-- The definition of @bool@ is added to the reparse environment; reparsing
+-- correctly recognizes @bool@ as an external reference, which gets matched
+-- against the external binding spec. We translate to
+-- 'HsBindgen.Runtime.LibC.CBool'.
+test_stdlib_instances_c11 :: TestCase
+test_stdlib_instances_c11 =
+    testVariant "binding-specs/stdlib/instances" (Just 1) "c11-parse-all"
+      & #cStandard  .~ c11
+
+-- **Case 2: C23**
+--
+-- The definition of @bool@ replaces the original keyword entry of the reparse
+-- environment; reparsing correctly recognizes @bool@ as an external reference,
+-- which gets matched against the external binding spec. We translate to
+-- 'HsBindgen.Runtime.LibC.CBool'.
+test_stdlib_instances_c23 :: TestCase
+test_stdlib_instances_c23 =
+    testVariant "binding-specs/stdlib/instances" (Just 1) "c23-parse-all"
+      & #clangVersion .~ Just (>= (18, 0, 0))
+      & #cStandard    .~ c23
+
+-- **Case 3: C23 without including @stdbool.h@**
+test_stdlib_bool_c23 :: TestCase
+test_stdlib_bool_c23 =
+    defaultTest "binding-specs/stdlib/bool"
+      & #clangVersion .~ Just (>= (18, 0, 0))
+      & #cStandard    .~ c23
+
+test_stdlib_return_values :: TestCase
+test_stdlib_return_values =
+    defaultTest "binding-specs/stdlib/return_values"
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Comprehensive.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Comprehensive.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Comprehensive.hs
@@ -0,0 +1,69 @@
+-- | Golden tests: comprehensive
+--
+-- These are larger test cases, possibly coming from external sources (such as
+-- reported issues).
+--
+-- We use 'OmitFieldPrefixes' for all of these tests, partly to have some more
+-- tests for skipping field prefixes, and partly because we think this is the way
+-- most people should use 'hs-bindgen'.
+module Test.HsBindgen.Golden.Comprehensive (testCases) where
+
+import HsBindgen.Config.Internal
+import HsBindgen.Doxygen (DoxygenMsg (..))
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = map omitFieldPrefixes [
+      test_c2hsc
+    , test_smoke
+    ]
+  where
+    omitFieldPrefixes :: TestCase -> TestCase
+    omitFieldPrefixes =
+      #onFrontend .~ ( #fieldNamingStrategy .~ OmitFieldPrefixes )
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test_c2hsc :: TestCase
+test_c2hsc =
+    defaultTest "comprehensive/c2hsc"
+      & #tracePredicate .~ multiTracePredicate expected trace
+  where
+    expected :: [C.DeclName]
+    expected = [
+        "ordinary_long_double"
+      , "ordinary_long_double_pointer"
+      , "ordinary_long_double_array"
+      , "ordinary_long_double_pointer_array"
+      , "struct ordinary_long_double_struct"
+      , "struct ordinary_long_double_pointer_struct"
+      , "struct ordinary_long_double_array_struct"
+      , "struct ordinary_long_double_pointer_array_struct"
+      ]
+
+    trace :: TraceMsg -> Maybe (TraceExpectation C.DeclName)
+    trace = \case
+      MatchDelayed name (ParseUnsupportedFloatType UnsupportedLongDouble) ->
+        Just $ Expected name
+      MatchDoxygen (DoxygenUnsupported _) ->
+        Just Tolerated
+      _otherwise ->
+        Nothing
+
+test_smoke :: TestCase
+test_smoke =
+    defaultTest "comprehensive/smoke"
+      & #cStandard .~ c99
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Declarations.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Declarations.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Declarations.hs
@@ -0,0 +1,193 @@
+-- | Golden tests: declarations
+module Test.HsBindgen.Golden.Declarations (testCases) where
+
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Analysis.DeclIndex (UnusableReason (..))
+import HsBindgen.Frontend.Pass.MangleNames.Error
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      -- Default tests
+      defaultTest "declarations/declarations_required_for_scoping"
+    , defaultTest "declarations/forward_declaration"
+    , defaultTest "declarations/opaque_declaration"
+      -- Bespoke tests
+    , test_declaration_unselected_b
+    , test_definitions
+    , test_duplicate_field_name_omit
+    , test_failing_tentative_definitions_linkage
+    , test_field_name_reuse_omit
+    , test_name_collision
+    , test_name_collision_aux
+    , test_redeclaration
+    , test_redeclaration_main_header
+    , test_select_scoping
+    , test_tentative_definitions
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test_declaration_unselected_b :: TestCase
+test_declaration_unselected_b =
+    testTraceMulti "declarations/declaration_unselected_b" declsWithMsgs $ \case
+      MatchSelect name (MatchTransMissing [MatchTransNotSelected]) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["f"]
+
+test_definitions :: TestCase
+test_definitions =
+    testTraceMulti "declarations/definitions" declsWithMsgs $ \case
+      MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["foo", "n"]
+
+test_duplicate_field_name_omit :: TestCase
+test_duplicate_field_name_omit =
+    defaultTest "declarations/duplicate_field_name_omit"
+      & #onFrontend      .~ (\cfg -> cfg
+            & #fieldNamingStrategy .~ OmitFieldPrefixes
+          )
+      & #tracePredicate  .~ multiTracePredicate declsWithMsgs (\case
+            MatchUnusable name (UnusableMangleNamesFailure (MangleNamesCollisionError DetectClashesDuplicateFieldName{})) ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct S"]
+
+test_failing_tentative_definitions_linkage :: TestCase
+test_failing_tentative_definitions_linkage =
+    failingTestLibclangMulti "declarations/failing/tentative_definitions_linkage" [(), ()] $ \case
+      (matchDiagnosticSpelling "non-static declaration of" -> Just _diag) ->
+        Just $ Expected ()
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+-- Under @OmitFieldPrefixes@ the generated module enables @NoFieldSelectors@, so
+-- an unprefixed field name does not generate a top-level selector and can freely
+-- coincide with a non-field declaration of the same name. Here @struct S@'s
+-- field @foo@ shares a name with a global @foo@, and @struct T@'s field @bar@
+-- with a function @bar@; none collide and all are generated and compile.
+test_field_name_reuse_omit :: TestCase
+test_field_name_reuse_omit =
+    defaultTest "declarations/field_name_reuse_omit"
+      & #onFrontend .~ (\cfg -> cfg
+            & #fieldNamingStrategy .~ OmitFieldPrefixes
+          )
+
+-- This tests https://github.com/well-typed/hs-bindgen/issues/1373 and
+-- https://github.com/well-typed/hs-bindgen/issues/2020.
+--
+-- It covers a cross-declaration collision (@union y@ vs @union Y@) and two
+-- intra-declaration collisions: @enum Color { Color }@, whose tag and
+-- enumerator share the C name; and @enum A { a }@ (issue #2020), where the tag
+-- and the case-mangled enumerator both produce the Haskell name @A@.
+test_name_collision :: TestCase
+test_name_collision =
+    testTraceMulti "declarations/name_collision" declsWithMsgs $ \case
+      MatchUnusable name (UnusableMangleNamesFailure (MangleNamesCollisionError DetectClashesCollision{})) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs =
+      ["union y", "union Y", "enum Color", "enum A", "struct S", "S_x"]
+
+-- This tests sweep-2 collision detection for names derived in pass 2:
+--
+-- * A struct with a flexible array member generates @Foo_Aux@ (the FLAM
+--   auxiliary type), which clashes with a top-level @foo_Aux@ declaration.
+--
+-- * A function-pointer typedef generates @Bar_Aux@ (the function-pointer
+--   auxiliary type), which clashes with a top-level @bar_Aux@ declaration.
+test_name_collision_aux :: TestCase
+test_name_collision_aux =
+    testTraceMulti "declarations/name_collision_aux" declsWithMsgs $ \case
+      MatchUnusable name (UnusableMangleNamesFailure (MangleNamesCollisionError DetectClashesCollision{})) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct foo", "foo_Aux", "bar", "bar_Aux"]
+
+test_redeclaration :: TestCase
+test_redeclaration =
+    defaultTest "declarations/redeclaration"
+      & #cStandard      .~ c11
+      & #tracePredicate .~ multiTracePredicate expected trace
+  where
+    expected :: [C.DeclName]
+    expected = ["x"]
+
+    trace :: TraceMsg -> Maybe (TraceExpectation C.DeclName)
+    trace = \case
+      MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+
+-- | A function declared in an included header and in the main header
+test_redeclaration_main_header :: TestCase
+test_redeclaration_main_header =
+    defaultTest "declarations/redeclaration_main_header"
+
+test_select_scoping :: TestCase
+test_select_scoping =
+    defaultTest "declarations/select_scoping"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BIf (SelectHeader FromMainHeaders)
+          )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name (MatchTransMissing [MatchTransNotSelected]) ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          "ParsedAndSelected2"
+        , "ParsedAndSelected3"
+        ]
+
+test_tentative_definitions :: TestCase
+test_tentative_definitions =
+    testTraceMulti "declarations/tentative_definitions" declsWithMsgs $ \case
+      MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+        Just $ Expected name
+      MatchDiagnosticOption "-Wno-extern-initializer" ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["i1", "i2", "i3", "i3"]
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Documentation.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Documentation.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Documentation.hs
@@ -0,0 +1,36 @@
+-- | Golden tests: documentation
+module Test.HsBindgen.Golden.Documentation (testCases) where
+
+import HsBindgen.Doxygen (DoxygenMsg (..))
+import HsBindgen.Imports
+
+import Test.Common.HsBindgen.Trace.Patterns (pattern MatchDoxygen)
+import Test.Common.HsBindgen.Trace.Predicate (TraceExpectation (..),
+                                              multiTracePredicate)
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      defaultTest "documentation/data_kind_pragma"
+    , test_doxygen_docs
+    , defaultTest "documentation/javadoc_banner"
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test_doxygen_docs :: TestCase
+test_doxygen_docs =
+    testTrace "documentation/doxygen_docs"
+      (multiTracePredicate @Text [] $ \case
+        MatchDoxygen (DoxygenUnsupported _) -> Just Tolerated
+        _otherwise -> Nothing
+      )
+      & #clangVersion .~ Just (>= (19, 0, 0))
+      & #cStandard .~ c99
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/EdgeCases.hs b/test/hs-bindgen/Test/HsBindgen/Golden/EdgeCases.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/EdgeCases.hs
@@ -0,0 +1,173 @@
+-- | Golden tests: edge cases
+module Test.HsBindgen.Golden.EdgeCases (testCases) where
+
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Analysis.DeclIndex (UnusableEntry (..),
+                                              UnusableReason (..))
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      -- Default tests
+      defaultTest "edge-cases/aux_funptr_newtypes"
+    , defaultTest "edge-cases/distilled_lib_1"
+    , defaultTest "edge-cases/enum_as_array_size"
+    , defaultTest "edge-cases/flam_functions"
+    , defaultTest "edge-cases/flam"
+    , defaultTest "edge-cases/mangle_fun_param_names"
+    , defaultTest "edge-cases/names"
+    , defaultTest "edge-cases/prelude_names"
+    , defaultTest "edge-cases/spec_examples"
+    , defaultTest "edge-cases/typedef_bitfield"
+    , defaultTest "edge-cases/typedef_void"
+    , defaultTest "edge-cases/unnamed_type_multiple_fields"
+    , defaultTest "edge-cases/unnamed_type_multiple_typedefs"
+    , defaultTest "edge-cases/uses_utf8"
+      -- Bespoke tests
+    , test_adios
+    , test_clang_generated_collision
+    , test_duplicate
+    , test_duplicate_record_field
+    , test_headers
+    , test_include_macro
+    , test_iterator
+    , test_ordinary_unnamed_decl
+    , test_select_no_match
+    , test_thread_local
+    , test_unsupported_builtin
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test_adios :: TestCase
+test_adios =
+    defaultTest "edge-cases/adios"
+      & #cStandard .~ c11
+
+test_clang_generated_collision :: TestCase
+test_clang_generated_collision =
+    defaultTest "edge-cases/clang_generated_collision"
+      & #clangVersion   .~ Just (>= (16, 0, 0))
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name SelectConflict{} ->
+              Just $ Expected name
+            MatchSelect _ (MatchTransMissing [MatchTransUnusable (UnusableConflict{})]) ->
+              Just Tolerated
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct foo"]
+
+test_duplicate :: TestCase
+test_duplicate =
+    defaultTest "edge-cases/duplicate"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BOr
+              (BIf $ SelectDecl (DeclNameMatches "function"))
+              (BIf $ SelectDecl (DeclNameMatches "duplicate"))
+          & #programSlicing .~ EnableProgramSlicing
+          )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name SelectConflict{} ->
+              Just $ Expected (name, "conflict")
+            MatchSelect name (MatchTransMissing [MatchTransUnusable UnusableConflict{}]) ->
+              Just $ Expected (name, "transitive conflict")
+            MatchUnusable name UnusableMangleNamesFailure{} ->
+              Just $ Expected (name, "mangle")
+            _otherwise ->
+               Nothing
+          )
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+          ("macro duplicate", "conflict")
+        , ("duplicate",       "conflict")
+        , ("function",        "transitive conflict")
+        , ("function",        "mangle")
+        ]
+
+test_duplicate_record_field :: TestCase
+test_duplicate_record_field =
+    defaultTest "edge-cases/duplicate_record_field"
+      & #onFrontend .~ (\cfg -> cfg
+            & #fieldNamingStrategy .~ OmitFieldPrefixes
+          )
+
+test_headers :: TestCase
+test_headers =
+    testTraceSimple "edge-cases/headers" $ \case
+      MatchNoDeclarations ->
+        Just $ Expected ()
+      _otherwise ->
+        Nothing
+
+test_include_macro :: TestCase
+test_include_macro =
+    defaultTest "edge-cases/include_macro_parent"
+      & #onFrontend .~ ( #selectionPredicate .~ BIf (SelectHeader FromAllHeaders) )
+
+test_iterator :: TestCase
+test_iterator =
+    defaultTest "edge-cases/iterator"
+      & #clangVersion .~ Just (>= (15, 0, 0))
+      & #cStandard    .~ c23
+      & #onBoot       .~ ( #clangArgs % #enableBlocks .~ True )
+
+test_ordinary_unnamed_decl :: TestCase
+test_ordinary_unnamed_decl =
+    defaultTest "edge-cases/ordinary_unnamed_decl_parent"
+      & #onFrontend .~ ( #selectionPredicate .~ BIf (SelectHeader FromAllHeaders) )
+
+test_select_no_match :: TestCase
+test_select_no_match =
+    defaultTest "edge-cases/select_no_match"
+      & #onFrontend .~ ( #selectionPredicate .~
+            BIf (SelectDecl (DeclNameMatches "this_pattern_will_never_match"))
+          )
+      & #tracePredicate .~ singleTracePredicate (\case
+            MatchNoDeclarations ->
+              Just $ Expected ()
+            _otherwise ->
+              Nothing
+          )
+
+test_thread_local :: TestCase
+test_thread_local =
+    defaultTest "edge-cases/thread_local"
+      & #clangVersion   .~ Just (>= (16, 0, 0))
+      & #cStandard    .~ c23
+      & #tracePredicate .~ singleTracePredicate (\case
+            MatchDelayed _name ParseUnsupportedTLS ->
+              Just $ Expected ()
+            _otherwise ->
+              Nothing
+          )
+
+test_unsupported_builtin :: TestCase
+test_unsupported_builtin =
+    testTraceMulti "edge-cases/unsupported_builtin" declsWithMsgs $ \case
+      MatchDelayed name (ParseUnsupportedBuiltin "__builtin_va_list") ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["va_list"]
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Functions.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Functions.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Functions.hs
@@ -0,0 +1,192 @@
+-- | Golden tests: functions
+module Test.HsBindgen.Golden.Functions (testCases) where
+
+import HsBindgen.Backend.Category
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Analysis.DeclIndex (UnusableReason (..))
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Predicate (Boolean (..))
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      -- Default tests
+      defaultTest "functions/callbacks"
+    , defaultTest "functions/circular_dependency_fun"
+    , defaultTest "functions/heap_types/struct_const_member"
+    , defaultTest "functions/heap_types/struct_const_typedef"
+    , defaultTest "functions/heap_types/struct_const"
+    , defaultTest "functions/heap_types/struct"
+    , defaultTest "functions/heap_types/union_const_member"
+    , defaultTest "functions/heap_types/union_const_typedef"
+    , defaultTest "functions/heap_types/union_const"
+    , defaultTest "functions/heap_types/union"
+    , defaultTest "functions/typedef_funptr"
+      -- Bespoke tests
+    , test_decls_in_signature
+    , test_fun_attributes
+    , test_fun_attributes_conflict
+    , test_hash_defines
+    , test_hash_defines_select_all
+    , test_libc_builtins
+    , test_not_visible_decl
+    , test_simple_func
+    , test_simple_func_rename
+    , test_varargs
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test_decls_in_signature :: TestCase
+test_decls_in_signature =
+    testTraceMulti "functions/decls_in_signature" declsWithMsgs $ \case
+      MatchDelayed name ParseDeclarationNotVisible{} ->
+        Just $ Expected name
+      MatchDelayed name ParseUnsupportedUnnamedInSignature{} ->
+        Just $ Expected name
+      MatchDiagnosticOption _diag ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["f1", "f2", "f3", "f4", "f5"]
+
+test_fun_attributes :: TestCase
+test_fun_attributes =
+    defaultTest "functions/fun_attributes"
+      & #clangVersion   .~ Just (>= (15, 0, 0))
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchDelayed name ParseUnsupportedVariadicFunction ->
+              Just $ Expected name
+            MatchDelayed name ParseNonPublicVisibility ->
+              Just $ Expected name
+            MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+              Just $ Expected name
+            MatchSelect name SelectDeprecated{} ->
+              Just $ Expected name
+            MatchUnusable name UnusableUnavailable ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          "my_printf"
+        , "i"
+        , "f3"
+        , "old_fn_deprecated"
+        , "old_fn_unavailable"
+        ]
+
+test_fun_attributes_conflict :: TestCase
+test_fun_attributes_conflict =
+    testTraceMulti "functions/fun_attributes_conflict" declsWithMsgs $ \case
+      MatchDiagnosticOption "-Wno-ignored-attributes" ->
+        Just Tolerated
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = []
+
+-- | @#define@ root directives reach the generation /and/ compilation stage
+--
+-- The header does not preprocess without @MY_SIZE@, so PP\/TH fixture
+-- compilation only succeeds if the directives are forwarded to the wrapper
+-- source.
+test_hash_defines :: TestCase
+test_hash_defines =
+    defaultTest "functions/hash_defines"
+      & #hashDefines .~ hashDefines
+
+-- | @--select-all@ selects root-header @#define@s
+--
+-- Without unwind tables, the Clang driver does not add
+-- @-D__GCC_HAVE_DWARF2_CFI_ASM=1@, which @--select-all@ would select too.
+test_hash_defines_select_all :: TestCase
+test_hash_defines_select_all =
+    testVariant "functions/hash_defines" (Just 1) "select_all"
+      & #hashDefines .~ hashDefines
+      & #onBoot      .~ ( #clangArgs % #argsAfter .~ [
+                              "-fno-asynchronous-unwind-tables"
+                            , "-fno-unwind-tables"
+                            ] )
+      & #onFrontend  .~ ( #selectionPredicate .~ BTrue)
+
+hashDefines :: [C.HashDefine]
+hashDefines = [
+      C.HashDefine "MY_FEATURE" "1"
+    , C.HashDefine "MY_SIZE"    "8"
+    , C.HashDefine "MY_EMPTY"   ""
+    ]
+
+test_libc_builtins :: TestCase
+test_libc_builtins =
+    defaultTest "functions/libc_builtins"
+      -- LLVM/Clang 22 reports __size_t as unexposed, so we skip these functions
+      & #clangVersion .~ Just (\(major, _minor, _patch) -> major /= 22)
+
+test_not_visible_decl :: TestCase
+test_not_visible_decl =
+    testTraceMulti "functions/not_visible_decl" declsWithMsgs $ \case
+      MatchDelayed name ParseDeclarationNotVisible{} ->
+        Just $ Expected name
+      MatchDelayed name ParseUnsupportedUnnamedInSignature{} ->
+        Just $ Expected name
+      MatchDiagnosticOption _diag ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["f", "g", "h"]
+
+test_simple_func :: TestCase
+test_simple_func =
+    defaultTest "functions/simple_func"
+      & #cStandard .~ c99
+
+test_simple_func_rename :: TestCase
+test_simple_func_rename =
+    testVariant "functions/simple_func" (Just 1) "rename"
+      & #cStandard .~ c99
+      & #onBackend .~ ( #categoryChoice .~ ByCategory {
+            cType = IncludeTypeCategory
+          , cSafe = ExcludeCategory
+          , cUnsafe = ExcludeCategory
+          , cFunPtr = IncludeTermCategory $ RenameTerm $ \t -> t <> "_random_user_specified_suffix"
+          , cGlobal = ExcludeCategory
+          })
+
+test_varargs :: TestCase
+test_varargs =
+    testTraceMulti "functions/varargs" declsWithMsgs $ \case
+      MatchDelayed name ParseUnsupportedVariadicFunction ->
+        Just $ Expected name
+      MatchDelayed name (
+        ParseUnderlyingTypeFailed
+          (C.PrelimDeclIdNamed (C.DeclName "va_list" C.NameKindOrdinary))
+          (ParseUnsupportedBuiltin "__builtin_va_list")
+        ) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["f", "g"]
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Globals.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Globals.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Globals.hs
@@ -0,0 +1,56 @@
+-- | Golden tests: globals
+module Test.HsBindgen.Golden.Globals (testCases) where
+
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      test_globals
+    , test_untagged
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test_globals :: TestCase
+test_globals =
+    testTraceMulti "globals/globals" declsWithMsgs $ \case
+      MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          -- non-extern non-static globals
+          "nesBinary"
+        , "nesBool"
+        , "nesCast"
+        , "nesCharacter"
+        , "nesCompound"
+        , "nesConditional"
+        , "nesFloating"
+        , "nesImaginary"
+        , "nesInitList"
+        , "nesInteger"
+        , "nesParen"
+        , "nesString1"
+        , "nesString2"
+        , "nesUnary"
+        , "some_global_struct"
+        , "streamBinary_len"
+        , "streamBinary"
+        ]
+
+test_untagged :: TestCase
+test_untagged = defaultTest "globals/untagged"
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/BindingSpec.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/BindingSpec.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/BindingSpec.hs
@@ -0,0 +1,49 @@
+-- | Golden test: generated binding specifications
+module Test.HsBindgen.Golden.Infra.Check.BindingSpec (check) where
+
+import Data.ByteString.UTF8 qualified as UTF8
+import System.FilePath ((<.>), (</>))
+import Test.Tasty (TestTree)
+
+import HsBindgen
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.BindingSpec.Gen qualified as BindingSpec
+
+import Test.Common.Util.Tasty
+import Test.Common.Util.Tasty.Golden
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+check :: IO TestResources -> TestCase -> TestTree
+check getTestResources test =
+    goldenAnsiDiff "bindingspec" fixture $ \report -> do
+      -- We compute the binding specification inside the artefact so that the
+      -- result does not mention the macro-language tag @l@ (which appears in
+      -- 'getDeclIndex' and 'HsDecls'); this keeps 'runTestHsBindgenSuccess'
+      -- polymorphic over the macro language.
+      output <-
+        runTestHsBindgenSuccess report getTestResources test $ do
+          includeGraph   <- getIncludeGraph
+          declIndex      <- getDeclIndex
+          getMainHeaders <- getGetMainHeaders
+          omitTypes      <- getOmittedTypes
+          squashedTypes  <- getSquashedTypes
+          hsDecls        <- HsDecls
+          pure $ UTF8.toString $
+            BindingSpec.genBindingSpec
+              BindingSpec.FormatYAML
+              "Example"
+              includeGraph
+              declIndex
+              getMainHeaders
+              omitTypes
+              squashedTypes
+              (concat hsDecls)
+      return $ ActualValue output
+  where
+    fixture :: FilePath
+    fixture = test.outputDir </> "bindingspec" <.> "yaml"
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/FailureBindgen.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/FailureBindgen.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/FailureBindgen.hs
@@ -0,0 +1,37 @@
+-- | Golden test: failing test cases
+--
+-- For failing test cases, we verify the trace messages.
+module Test.HsBindgen.Golden.Infra.Check.FailureBindgen (check) where
+
+import Test.Tasty (TestTree, askOption)
+import Test.Tasty.HUnit
+
+import HsBindgen
+
+import Test.Common.Util.Tasty.Golden
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+check :: IO TestResources -> TestCase -> TestTree
+check getTestResources test =
+    askOption $ \(Debug debug) -> do
+      let report :: String -> IO ()
+          report = case debug of
+            False -> const $ pure ()
+            True  -> putStrLn
+      testCase test.name $ do
+        eRes <- runTestHsBindgen report getTestResources test FinalDecls
+        case eRes of
+          Left  _ -> pure ()
+          Right r -> assertFailure (msgWith r)
+  where
+    msgWith :: Show b => b -> String
+    msgWith r = mconcat [
+        "Expected 'hs-bindgen' to fail, "
+      , "but it succeeded with the following list of declarations:\n"
+      , show r
+      ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/FailureLibclang.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/FailureLibclang.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/FailureLibclang.hs
@@ -0,0 +1,41 @@
+-- | Golden test: Failure (non-zero exit code)
+--
+-- Test for non-zero exit code
+module Test.HsBindgen.Golden.Infra.Check.FailureLibclang (check) where
+
+import Control.Exception (Exception (..), SomeException, handle, throw)
+import Test.Tasty (TestTree, askOption)
+import Test.Tasty.HUnit
+
+import HsBindgen
+import HsBindgen.Clang
+
+import Test.Common.Util.Tasty.Golden
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+check :: IO TestResources -> TestCase -> TestTree
+check getTestResources test =
+    askOption $ \(Debug debug) -> do
+      let report :: String -> IO ()
+          report = case debug of
+            False -> const $ pure ()
+            True  -> putStrLn
+      testCase test.name $
+        handle expectLibclangFailure $ do
+          eRes <- runTestHsBindgen report getTestResources test FinalDecls
+          assertFailure $ mconcat [
+              "expected 'hs-bindgen' to fail early, "
+            , "but it finished with the following result:\n"
+            , show eRes
+            ]
+
+  where
+    expectLibclangFailure :: SomeException -> IO ()
+    expectLibclangFailure e = case fromException e of
+      Just (_ :: LibclangException)  -> pure ()
+      _                              -> throw e
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/PP.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/PP.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/PP.hs
@@ -0,0 +1,115 @@
+-- | Golden test: pretty-printed Haskell code
+module Test.HsBindgen.Golden.Infra.Check.PP (check) where
+
+import Control.Monad (when)
+import Data.IORef
+import Data.List.NonEmpty qualified as NonEmpty
+import Optics.Core (view)
+import System.Directory (createDirectoryIfMissing)
+import System.FilePath ((</>))
+import Test.Tasty
+import Test.Tasty.HUnit (assertFailure)
+
+import HsBindgen (getBindingsMultiple)
+import HsBindgen hiding (getBindingsMultiple)
+import HsBindgen.Backend.Category
+import HsBindgen.Config
+import HsBindgen.Config.Internal
+import HsBindgen.Errors (panicIO)
+import HsBindgen.Language.Haskell qualified as Hs
+
+import Test.Common.Util.Tasty
+import Test.Common.Util.Tasty.Golden
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+-- Run @hs-bindgen@ once and share the result across all golden sub-tests via
+-- 'withResource'. Since 'runTestHsBindgen' returns an 'Either', the cached
+-- result is always available: the primary sub-test ('NonEmpty.head
+-- allCategories') reports the full error, while the others give a short
+-- cross-reference. Trace messages produced during the run (formatted by
+-- 'withTraceConfigPredicate') are captured in an 'IORef' so that they can be
+-- replayed through each sub-test's @report@ callback.
+check :: IO TestResources -> TestCase -> TestTree
+check getTestResources test =
+    withExampleDir $
+    askOption $ \runMode ->
+    let categories = case runMode of
+          Fast -> filter (/= CTerm CUnsafe) (NonEmpty.toList allCategories)
+          Full -> NonEmpty.toList allCategories
+    in withResource setupBindgen (\_ -> pure ()) $ \getResult ->
+       testGroup "pp" [
+         goldenAnsiDiff (show bc) (fixture bc) $ \report -> do
+           result <- getResult
+           let firstCategory = NonEmpty.head allCategories
+           case result of
+             Left e
+               -- The primary sub-test reports the full error. The other
+               -- sub-tests just reference it, avoiding redundant output.
+               | bc == firstCategory ->
+                 assertFailure $
+                   "Expected 'hs-bindgen' to succeed, but received an error: "
+                   ++ show e
+               | otherwise ->
+                 assertFailure $
+                   "hs-bindgen failed (see "
+                   ++ show firstCategory
+                   ++ " for details)"
+             Right (baseName, traceMessages, output) -> do
+               -- Replay trace messages through the golden test's @report@
+               -- callback, so that they appear in tasty's @--debug@ output.
+               mapM_ report traceMessages
+
+               -- A sanity check to make sure that that the modules we're rendering
+               -- have the expected @Example@ base name.
+               when (baseName /= "Example") $
+                 panicIO "The module base name should be Example!"
+
+               -- Render the Haskell module
+               let ppOutput = view (lensForCategory bc) output
+               return $ case ppOutput of
+                 Nothing -> ActualNoOutput
+                 Just x  -> ActualValue x
+       | (bc :: Category) <- categories
+       ]
+  where
+    setupBindgen ::
+         IO (Either BindgenError (BaseModuleName, [String], ByCategory_ (Maybe String)))
+    setupBindgen = do
+      traceMessages <- newIORef []
+      let collectTrace msg = modifyIORef' traceMessages (msg :)
+          mrc = ModuleRenderConfig {
+              qualifiedStyle = test.qualifiedStyle
+            }
+      result <- runTestHsBindgen collectTrace getTestResources test
+                  ((,) <$> ModuleBaseName <*> getBindingsMultiple mrc)
+      msgs <- reverse <$> readIORef traceMessages
+      pure $ fmap (\(baseName, output) -> (baseName, msgs, output)) result
+
+    -- === Filepaths
+    --
+    -- A golden test needs to know at which filepath to store its output
+    -- /before/ it actually runs the test, as it's typically static information.
+    -- As such, we can't rely on the invocation of @hs-bindgen@ to generate the
+    -- filepath names for us, so we redefine the logic for constructing
+    -- filepaths here.
+
+    -- | Everything except the top-level @Example.hs@ module is in the @Example@
+    -- directory.
+    withExampleDir :: TestTree -> TestTree
+    withExampleDir k =
+        withResource
+          (createDirectoryIfMissing False (test.outputDir </> "Example"))
+          (\_ -> pure ())
+          (\_ -> k)
+
+    -- | The names of sub-modules are based solely on the binding category
+    fixture :: Category -> FilePath
+    fixture bc = test.outputDir </> Hs.moduleNamePath moduleName
+      where
+        moduleName :: Hs.ModuleName
+        moduleName = fromBaseModuleName "Example" (Just bc)
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/TH.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/TH.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/Check/TH.hs
@@ -0,0 +1,604 @@
+{-# LANGUAGE CPP                   #-}
+{-# LANGUAGE TemplateHaskellQuotes #-}
+
+-- | Golden test: TH output
+module Test.HsBindgen.Golden.Infra.Check.TH (check) where
+
+import Control.Monad.State (MonadState)
+import Control.Monad.State.Strict (State, get, put, runState)
+import Data.Foldable qualified as Foldable
+import Data.Generics qualified as SYB
+import Data.Map.Strict qualified as Map
+import Language.Haskell.TH qualified as TH
+import Language.Haskell.TH.Ppr qualified as TH
+import Language.Haskell.TH.PprLib qualified as TH
+import Language.Haskell.TH.Syntax qualified as TH
+import System.FilePath (makeRelative, (<.>), (</>))
+import Test.Tasty hiding (after)
+import Text.SimplePrettyPrint (Pretty (..))
+import Text.SimplePrettyPrint qualified as PP
+
+import Clang.Version
+
+import HsBindgen
+import HsBindgen.Backend.Hs.Haddock.Documentation qualified as HsDoc
+import HsBindgen.Backend.HsModule.Pretty.Comment
+import HsBindgen.Config
+import HsBindgen.Config.Internal
+import HsBindgen.Guasi
+import HsBindgen.Imports
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.TH.Internal
+
+import Test.Common.Util.Tasty
+import Test.Common.Util.Tasty.Golden (ActualValue (..))
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+check :: IO TestResources -> TestCase -> TestTree
+check getTestResources test =
+    goldenAnsiDiff "th" fixture $ \report ->
+      if ghcAtLeast908 then do
+        let testTh =
+              test
+                & #onBackend %~ (. applyTestThCategoryChoice)
+        pkgroot <- (.packageRoot) <$> getTestResources
+        -- We do not have access to 'Q', and so have to compute the 'getThDecls'
+        -- artefact manually.
+        (deps, (dirs, decls)) <-
+          runTestHsBindgenSuccess report getTestResources testTh
+            ((,) <$> getDependencies <*> ((,) <$> RootDirectives <*> FinalDecls))
+
+        let fns :: FieldNamingStrategy
+            fns = (.fieldNamingStrategy) $ getTestFrontendConfig test
+            thDecls :: Qu [TH.Dec]
+            thDecls = uncurry (getThDecls fns deps dirs) $ Foldable.fold decls
+
+            (st, thdecs) = runQu thDecls
+
+            -- Here we might have headers outside of our package, but in our
+            -- test setup that SHOULD cause an error, as we use bundled stdlib.
+            -- And we will cause those on CI, which runs tests on different
+            -- systems.
+            output :: String
+            output = unlines $ concat [
+                [    "-- addDependentFile "
+                  ++ convertWindows (makeRelative pkgroot fp)
+                | fp <- st.dependencyFiles
+                ]
+              , [ "-- " ++ normalizeQuotes l
+                | src <- st.cSources, l <- lines src
+                ]
+              , [ show $ prettyWithDocumentationMap True st.docMap d
+                | d <- unqualNames thdecs
+                ]
+              ]
+
+        return $ ActualValue output
+      else
+        return $ ActualSkipped "ghc < 9.8"
+  where
+    fixture :: FilePath
+    fixture = test.outputDir </> "th" <.> "txt"
+
+    -- Clang version 19 uses <> for some reason.
+    --
+    -- If generating Golden tests from an older clang (e.g. 19) version then
+    -- this is needed.
+    --
+    normalizeQuotes :: String -> String
+    normalizeQuotes =
+      case runtimeClangVersion of
+        ClangVersionUnknown _ -> id
+        ClangVersion v
+          -- Put your clang version here
+          | v >= (19, 0, 0) -> go False
+          | otherwise       -> id
+      where
+        go _ [] = []
+        go False ('"':xs) = '<' : go True xs
+        go True ('"':xs) = '>' : go False xs
+        go inBracket (x:xs) = x : go inBracket xs
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: manipulate output
+-------------------------------------------------------------------------------}
+
+-- unqualify names, qualified names are noisy *and* GHC.Base names move
+unqualNames :: [TH.Dec] -> [TH.Dec]
+unqualNames = SYB.everywhere $ SYB.mkT mangleName
+  where
+    mangleName :: TH.Name -> TH.Name
+    mangleName n | n == ''()             = TH.Name (TH.OccName "Unit") TH.NameS
+    mangleName (TH.Name occ TH.NameG {}) = TH.Name occ TH.NameS
+    mangleName n                         = n
+
+convertWindows :: FilePath -> FilePath
+convertWindows = map f where
+  f '\\' = '/'
+  f c    = c
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: 'Qu' monad
+-------------------------------------------------------------------------------}
+
+-- | Deterministic monad with TH.Quote instance
+newtype Qu a = Qu (State QuState a)
+  deriving newtype (Functor, Applicative, Monad, MonadState QuState)
+
+data QuDecLoc = QuDecLoc {
+    ns :: Hs.Namespace
+  , nm :: String
+  }
+  deriving (Show, Eq, Ord, Generic)
+
+data QuFldLoc = QuFldLoc {
+    parent :: String
+  , field  :: String
+  }
+  deriving (Show, Eq, Ord, Generic)
+
+data QuDocLoc = QuD QuDecLoc | QuF QuFldLoc
+  deriving stock (Show, Eq, Ord, Generic)
+
+type QuDocMap = Map QuDocLoc HsDoc.Comment
+
+data QuState = QuState{
+      dependencyFiles  :: [FilePath]
+    , uniquenessNumber :: !Integer
+    , cSources         :: [String]
+    , docMap           :: QuDocMap
+    , guasiState       :: GuasiState
+    }
+  deriving stock (Show, Generic)
+
+emptyQuState :: QuState
+emptyQuState = QuState [] 0 [] Map.empty emptyGuasiState
+
+instance TH.Quote Qu where
+    newName n = do
+        q@QuState{ uniquenessNumber = u } <- get
+        put $! q { uniquenessNumber = u + 1 }
+        return $ TH.Name (TH.OccName n) (TH.NameU u)
+
+instance Guasi Qu where
+    getGuasi = (.guasiState) <$> get
+    putGuasi x = do
+        st <- get
+        put $! st & #guasiState .~ x
+
+    addCSource src = do
+        q@QuState{ cSources = csources } <- get
+        put $! q { cSources = csources ++ [src] }
+
+    addDependentFile fp = do
+        q@QuState{ dependencyFiles = depfiles } <- get
+        put $! q { dependencyFiles = depfiles ++ [fp] }
+
+    -- Note: we could mock these better, if we want to test error reporting
+    -- Currently (2025-04-15) we only report missing extensions,
+    -- so there isn't much to test.
+    extsEnabled = return []
+
+    -- In the test mock, we treat all external names as in scope (resolving to
+    -- an unqualified 'mkName') to avoid triggering error-reporting paths.
+    lookupTypeName str = return $ Just $ TH.mkName str
+
+    reportError _ = return ()
+
+    putLocalDoc :: forall ns. Hs.SingNamespace ns => Hs.Name ns -> HsDoc.Comment -> Qu ()
+    putLocalDoc nm cmt = do
+        q@QuState{ docMap = docMap } <- get
+        let loc = QuDecLoc (Hs.namespaceOf (Hs.singNamespace @ns)) (Hs.nameToStr nm)
+        put $!
+          q { docMap =
+                Map.insert (QuD loc) cmt docMap
+            }
+
+    putLocalFieldDoc _fns parent field s = do
+        q@QuState{ docMap = docMap } <- get
+        let loc = QuFldLoc parentStr fieldStr
+        put $!
+          q { docMap =
+                Map.insert (QuF loc) s docMap
+            }
+      where
+        parentStr, fieldStr :: String
+        parentStr = Hs.nameToStr parent
+        fieldStr  = Hs.nameToStr field
+
+runQu :: Qu a -> (QuState, a)
+runQu (Qu m) = case runState m emptyQuState of
+    (x, q) -> (q, x)
+
+{-------------------------------------------------------------------------------
+  Internal auxiliary: Template Haskell functions
+-------------------------------------------------------------------------------}
+
+-- | This function pretty prints 'TH.Dec' with their associated documentation.
+prettyWithDocumentationMap ::
+     Bool
+  -> QuDocMap
+  -> TH.Dec
+  -> TH.Doc
+prettyWithDocumentationMap isTop docMap dec =
+  case dec of
+    -- Compatibility with older TH version (removes braces from case expressions)
+
+    TH.ValD p r ds ->
+            formatDecDoc docMap dec
+      TH.$$ thCompatValD docMap p r ds
+
+    -- Declarations with associated documentation
+
+    TH.DataD cxt name tyvars mkind cons derivs ->
+            formatDecDoc docMap dec
+      TH.$$ ppTypeDef docMap "data" cxt (Just name) tyvars mkind cons derivs
+
+    TH.NewtypeD cxt name tyvars mkind con derivs ->
+            formatDecDoc docMap dec
+      TH.$$ ppTypeDef docMap "newtype" cxt (Just name) tyvars mkind [con] derivs
+
+    TH.ClassD cxt name tyvars fundeps decs ->
+            formatDecDoc docMap dec
+      TH.$$ thCompatClassD docMap name tyvars fundeps cxt decs
+
+    TH.InstanceD overlap cxt typ decs ->
+            formatDecDoc docMap dec
+      TH.$$ thCompatInstanceD docMap overlap cxt typ decs
+
+    -- The only reason foreign import pretty printer is overwritten here is
+    -- for our benefit of making the type signatures easier to read. It is
+    -- not what the default TH pretty printer would print.
+    TH.ForeignD (TH.ImportF callconv safety impent name typ) ->
+            formatDecDoc docMap dec
+      TH.$$ TH.hsep [ TH.text "foreign import"
+                    , pprCallconv callconv
+                    , pprSafety safety
+                    , TH.text (show impent)
+                    , TH.ppr name
+                    , TH.text "::"
+                    ]
+      TH.$$ TH.nest nestDepth (thCompatPprType typ)
+
+    _ ->    formatDecDoc docMap dec
+      TH.$$ TH.ppr_dec isTop dec
+
+-- | Helper function to lookup and format documentation
+--
+formatDecDoc :: QuDocMap -> TH.Dec -> TH.Doc
+formatDecDoc docMap thDec =
+  case getDecDocLoc thDec >>= (`Map.lookup` docMap) of
+    Nothing -> TH.empty
+    Just c  -> pure
+             $ PP.runCtxDoc PP.defaultContext (pretty (TopLevelComment c))
+
+{-------------------------------------------------------------------------------
+  TH Compatibility Functions
+
+  These functions provide compatibility with older Template Haskell versions.
+  They are extracted here to keep the main logic clean.
+-------------------------------------------------------------------------------}
+
+-- | Compatible version of 'TH.ValD' pretty-printing (removes braces from case
+-- expressions)
+--
+thCompatValD ::
+     QuDocMap
+  -> TH.Pat
+  -> TH.Body
+  -> [TH.Dec]
+  -> TH.Doc
+thCompatValD docMap p r ds =
+        TH.ppr p TH.<+> thCompatPprBody docMap True r
+  TH.$$ thCompatWhereClause docMap ds
+
+-- | Compatible version of 'TH.ClassD' pretty-printing
+--
+thCompatClassD ::
+     TH.PprFlag a
+  => QuDocMap
+  -> TH.Name
+  -> [TH.TyVarBndr a]
+  -> [TH.FunDep]
+  -> TH.Cxt
+  -> [TH.Dec]
+  -> TH.Doc
+thCompatClassD docMap name tyvars fundeps cxt decs =
+        TH.text "class" TH.<+> TH.pprCxt cxt
+                       TH.<+> TH.ppr name
+                       TH.<+> TH.hsep (map TH.ppr tyvars)
+                       TH.<+> TH.ppr fundeps
+  TH.$$ thCompatWhereClause docMap decs
+
+-- | Compatible version of 'TH.InstanceD' pretty-printing
+--
+thCompatInstanceD ::
+     QuDocMap
+  -> Maybe TH.Overlap
+  -> TH.Cxt
+  -> TH.Type
+  -> [TH.Dec]
+  -> TH.Doc
+thCompatInstanceD docMap overlap cxt typ decs =
+        TH.text "instance" TH.<+> maybe TH.empty TH.ppr_overlap overlap
+                          TH.<+> TH.pprCxt cxt
+                          TH.<+> TH.ppr typ
+  TH.$$ thCompatWhereClause docMap decs
+
+-- | Compatible version of where clause pretty-printing (removes braces from
+--   case expressions)
+--
+thCompatWhereClause :: QuDocMap -> [TH.Dec] -> TH.Doc
+thCompatWhereClause _ [] = TH.empty
+thCompatWhereClause docMap ds = TH.nest nestDepth
+                              $ TH.text "where"
+                         TH.<+> TH.vcat (map (prettyWithDocumentationMap False docMap) ds)
+
+-- | Compatible 'TH.Body' pretty-printing
+thCompatPprBody ::
+     QuDocMap
+  -> Bool
+  -> TH.Body
+  -> TH.Doc
+thCompatPprBody docMap eq body =
+  case body of
+    TH.GuardedB xs -> TH.nest nestDepth
+                   $ TH.vcat
+                   $ map (thCompatPprGuarded docMap eqDoc) xs
+    TH.NormalB  e  -> eqDoc TH.<+> thCompatPprExp docMap e
+  where eqDoc | eq        = TH.equals
+              | otherwise = TH.arrow
+
+-- | Compatible guarded expression pretty-printing
+--
+thCompatPprGuarded ::
+     QuDocMap
+  -> TH.Doc
+  -> (TH.Guard, TH.Exp)
+  -> TH.Doc
+thCompatPprGuarded docMap eqDoc (guard', expr) =
+  case guard' of
+    TH.NormalG guardExpr -> TH.bar
+                     TH.<+> thCompatPprExp docMap guardExpr
+                     TH.<+> eqDoc
+                     TH.<+> thCompatPprExp docMap expr
+    TH.PatG    stmts     ->
+            TH.bar TH.<+> TH.vcat (TH.punctuate TH.comma $ map TH.ppr stmts)
+      TH.$$ TH.nest nestDepth (eqDoc TH.<+> thCompatPprExp docMap expr)
+
+-- | No precedence 'TH.Exp' printer (compatible version)
+--
+-- We preserve #13856 pattern match
+--
+thCompatPprExp :: QuDocMap -> TH.Exp -> TH.Doc
+thCompatPprExp docMap expr =
+  case expr of
+    TH.LamE [] e -> thCompatPprExp docMap e -- #13856
+    TH.LamE ps e -> TH.char '\\' TH.<> TH.hsep (map (TH.pprPat TH.appPrec) ps)
+                                TH.<+> TH.text "->" TH.<+> thCompatPprExp docMap e
+    TH.CaseE e ms   ->
+            TH.text "case" TH.<+> thCompatPprExp docMap e TH.<+> TH.text "of"
+      TH.$$ semiSep (thCompatPprMatch docMap) ms
+    TH.LamCaseE ms  ->
+            TH.text "\\case"
+      TH.$$ semiSep (thCompatPprMatch docMap) ms
+    _               -> TH.ppr expr
+  where
+    semiSep f = TH.sep . TH.punctuate TH.semi . map f
+
+-- | Pretty-print Callconv for foreign imports
+pprCallconv :: TH.Callconv -> TH.Doc
+pprCallconv TH.CCall = TH.text "ccall"
+pprCallconv TH.StdCall = TH.text "stdcall"
+pprCallconv TH.CApi = TH.text "capi"
+pprCallconv TH.Prim = TH.text "prim"
+pprCallconv TH.JavaScript = TH.text "javascript"
+
+-- | Pretty-print Safety annotations for foreign imports
+pprSafety :: TH.Safety -> TH.Doc
+pprSafety TH.Safe = TH.text "safe"
+pprSafety TH.Unsafe = TH.text "unsafe"
+pprSafety TH.Interruptible = TH.text "interruptible"
+
+-- | Compatible version of type pretty-printing for foreign imports
+--
+-- Formats function types vertically with proper arrow alignment, matching the
+-- style used by the preprocessing renderer in HsModule/Render.hs
+thCompatPprType :: TH.Type -> TH.Doc
+thCompatPprType = go
+  where
+    go :: TH.Type -> TH.Doc
+    go ty =
+      case ty of
+        TH.ForallT tvs cxt body ->
+          TH.text "forall" TH.<+> TH.hsep (map TH.ppr tvs) TH.<> TH.text "."
+            TH.<+> (if null cxt then TH.empty else TH.pprCxt cxt TH.<+> TH.text "=>")
+            TH.<+> go body
+
+        TH.AppT (TH.AppT TH.ArrowT arg) res ->
+          -- Function type: format vertically with arrow alignment
+          TH.ppr arg
+            TH.$$ TH.nest (-3) (TH.text "->" TH.<+> go res)
+
+        _ -> TH.ppr ty
+
+-- | Compatible match pretty-printing
+thCompatPprMatch :: QuDocMap -> TH.Match -> TH.Doc
+thCompatPprMatch docMap (TH.Match p rhs ds) =
+        TH.pprMatchPat p TH.<+> thCompatPprBody docMap False rhs
+  TH.$$ thCompatWhereClause docMap ds
+
+{-------------------------------------------------------------------------------
+  Type Definition Pretty-Printing
+-------------------------------------------------------------------------------}
+
+-- | Pretty-print type definitions with documentation
+--
+ppTypeDef ::
+     TH.PprFlag a
+  => QuDocMap
+  -> String
+  -> TH.Cxt
+  -> Maybe TH.Name
+  -> [TH.TyVarBndr a]
+  -> Maybe TH.Kind
+  -> [TH.Con]
+  -> [TH.DerivClause]
+  -> TH.Doc
+ppTypeDef docMap s cxt mbName tyvars mkind cons derivs =
+  TH.sep [        TH.text s
+           TH.<+> TH.pprCxt cxt
+           TH.<+> case mbName of
+             Just name -> TH.pprName' TH.Applied name TH.<+> TH.hsep (map TH.ppr tyvars)
+             Nothing   -> TH.hsep (map TH.ppr tyvars)
+           TH.<+> ksigDoc TH.<+> maybeWhere
+         , TH.nest nestDepth (TH.vcat (pref $ map (ppCon docMap) cons))
+         , if null derivs
+              then TH.empty
+              else TH.nest nestDepth
+                 $ TH.vcat $ map TH.ppr_deriv_clause derivs
+      ]
+  where
+    pref :: [TH.Doc] -> [TH.Doc]
+    pref xs | isGadtDecl = xs
+    pref []              = [] -- No constructors; can't happen in H98
+    pref (d:ds)          = (TH.char '=' TH.<+> d):map (TH.bar TH.<+>) ds
+
+    maybeWhere :: TH.Doc
+    maybeWhere | isGadtDecl = TH.text "where"
+               | otherwise  = TH.empty
+
+    isGadtDecl :: Bool
+    isGadtDecl = not (null cons) && all isGadtCon cons
+        where isGadtCon TH.GadtC{}         = True
+              isGadtCon TH.RecGadtC{}      = True
+              isGadtCon (TH.ForallC _ _ x) = isGadtCon x
+              isGadtCon  _                 = False
+
+    ksigDoc = case mkind of
+                Nothing -> TH.empty
+                Just k  -> TH.dcolon TH.<+> TH.ppr k
+
+-- | Pretty print 'TH.Con' with documentation
+--
+ppCon :: QuDocMap -> TH.Con -> TH.Doc
+ppCon docMap con =
+  case con of
+    TH.RecC name fields ->
+            TH.ppr name TH.<+> ppRecordFields docMap name fields
+      TH.$$ getDoc docMap [mkCon name]
+
+    TH.ForallC _ _ innerCon ->
+            TH.ppr con
+      TH.$$ getDoc docMap (get_cons_names innerCon)
+
+    TH.RecGadtC names fields rtype ->
+            TH.commaSepApplied names TH.<+> TH.dcolon
+                                     TH.<+> ppGadtRecordFields docMap fields
+                                     TH.<+> TH.arrow
+                                     TH.<+> TH.ppr rtype
+      TH.$$ getDoc docMap (map mkCon names)
+
+    _ ->    TH.ppr con
+      TH.$$ getDoc docMap (get_cons_names con)
+
+-- | Pretty-print GADT record fields with documentation
+ppGadtRecordFields ::
+     QuDocMap
+  -> [TH.VarBangType]
+  -> TH.Doc
+ppGadtRecordFields docMap fields =
+  TH.braces $ TH.sep $ TH.punctuate TH.comma $ map ppField fields
+  where
+    ppField (fname, bang, ftype) =
+      let fieldBase = TH.pprName' TH.Applied fname TH.<+> TH.dcolon TH.<+>
+                      TH.pprBangType (bang, ftype)
+      in  fieldBase
+            TH.$$ getDoc docMap [mkCon fname]
+
+-- | Pretty-print record fields with documentation
+ppRecordFields ::
+     QuDocMap
+  -> TH.Name
+  -> [TH.VarBangType]
+  -> TH.Doc
+ppRecordFields docMap parent fields =
+  TH.braces $ TH.sep $ TH.punctuate TH.comma $ map ppField fields
+  where
+    ppField (fname, bang, ftype) =
+      let fieldBase = TH.pprName' TH.Applied fname TH.<+> TH.dcolon TH.<+>
+                      TH.pprBangType (bang, ftype)
+      in  fieldBase
+            TH.$$ getDoc docMap
+              [QuF $ QuFldLoc parentStr (TH.nameBase fname)]
+    parentStr = TH.nameBase parent
+
+-- | Aggregate all comments for each name and pretty print
+getDoc :: QuDocMap -> [QuDocLoc] -> TH.Doc
+getDoc docMap names =
+  case foldMap (\n -> Map.lookup n docMap) names of
+    Nothing -> TH.empty
+    Just c  -> pure
+             $ PP.runCtxDoc PP.defaultContext (pretty (PartOfDeclarationComment c))
+
+-- | Get constructor names (defined here as it's not in all TH versions)
+get_cons_names :: TH.Con -> [QuDocLoc]
+get_cons_names (TH.NormalC n _)     = [mkCon n]
+get_cons_names (TH.RecC n _)        = [mkCon n]
+get_cons_names (TH.InfixC _ n _)    = [mkCon n]
+get_cons_names (TH.ForallC _ _ c)   = get_cons_names c
+get_cons_names (TH.GadtC ns _ _)    = map mkCon ns
+get_cons_names (TH.RecGadtC ns _ _) = map mkCon ns
+
+{-------------------------------------------------------------------------------
+  DocLoc extraction
+-------------------------------------------------------------------------------}
+
+-- | Get DocLoc for declarations that can have attached documentation.
+getDecDocLoc :: TH.Dec -> Maybe QuDocLoc
+getDecDocLoc = \case
+    (TH.FunD n _)                        -> Just $ mkVar n
+    (TH.ValD (TH.VarP n) _ _)            -> Just $ mkVar n
+    (TH.DataD _ n _ _ _ _)               -> Just $ mkTyp n
+    (TH.NewtypeD _ n _ _ _ _)            -> Just $ mkTyp n
+    (TH.TySynD n _ _)                    -> Just $ mkTyp n
+    (TH.ClassD _ n _ _ _)                -> Just $ mkTyp n
+    (TH.SigD n _)                        -> Just $ mkVar n
+    (TH.ForeignD (TH.ImportF _ _ _ n _)) -> Just $ mkVar n
+    (TH.ForeignD (TH.ExportF _ _ n _))   -> Just $ mkVar n
+    (TH.PatSynSigD n _)                  -> Just $ mkCon n
+    TH.InstanceD{}                       -> Nothing
+    TH.StandaloneDerivD{}                -> Nothing
+    TH.PragmaD{}                         -> Nothing
+    TH.TySynInstD{}                      -> Nothing
+    TH.PatSynD{}                         -> Nothing
+    unhandledDec                         -> err unhandledDec
+  where
+    err d = error $ "getDecDocLoc: unhandled declaration type: " <> show d
+
+mkTyp, mkCon, mkVar :: TH.Name -> QuDocLoc
+mkTyp = QuD . QuDecLoc Hs.NsTypeConstr . TH.nameBase
+mkCon = QuD . QuDecLoc Hs.NsConstr     . TH.nameBase
+mkVar = QuD . QuDecLoc Hs.NsVar        . TH.nameBase
+
+{-------------------------------------------------------------------------------
+  Configuration
+-------------------------------------------------------------------------------}
+
+-- | Same as Template Haskell's
+--
+nestDepth :: Int
+nestDepth = 4
+
+-- | Skip TH for older ghc
+ghcAtLeast908 :: Bool
+#if __GLASGOW_HASKELL__ >=908
+ghcAtLeast908 = True
+#else
+ghcAtLeast908 = False
+#endif
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Infra/TestCase.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/TestCase.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/TestCase.hs
@@ -0,0 +1,374 @@
+-- | Configuring individual test cases (examples)
+--
+-- Intended for unqualified import.
+module Test.HsBindgen.Golden.Infra.TestCase (
+    -- * Definition
+    Outcome(..)
+  , TestCase(..)
+  , SomeMacroLang(..)
+  , macroLangCExpr
+  , macroLangEmpty
+  , macroLangRaw
+  , testInputDirectives
+    -- * Construction
+  , defaultTest
+  , defaultFailingTest
+  , defaultFailingTestLibclang
+    -- ** Successful tests
+  , testVariant
+  , mkTestVariant
+  , testTrace
+  , testTraceSimple
+  , testTraceMulti
+  , testDiagnostic
+    -- ** Failing tests
+  , failingTestTrace
+  , failingTestSimple
+  , failingTestMulti
+  , failingTestLibclangTrace
+  , failingTestLibclangSimple
+  , failingTestLibclangMulti
+    -- * Execution
+  , getTestBootConfig
+  , getTestFrontendConfig
+  , getTestBackendConfig
+  , runTestHsBindgen
+  , runTestHsBindgenSuccess
+  ) where
+
+import System.FilePath
+import Test.Tasty (TestName)
+import Test.Tasty.HUnit (assertFailure)
+
+import Clang.CStandard (ClangCStandard)
+import Clang.HighLevel.Types qualified as Clang
+
+import HsBindgen
+import HsBindgen.BindingSpec
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro qualified as Macro
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Definition
+-------------------------------------------------------------------------------}
+
+data Outcome =
+      -- | We expect the test to succeed (with or without output).
+      Success
+      -- | We expect the test to fail with 'hsBindgenE' returning a 'BindgenError'.
+    | FailureBindgen
+      -- | We expect the test to fail right after invoking `libclang`.
+    | FailureLibclang
+
+-- | The macro language a test runs with.
+--
+-- The concrete tag @l@ is existentially hidden so that different tests (and
+-- variants of the same test) can run with different macro languages. The macro
+-- language is built from the boot-detected 'ClangCStandard'.
+data SomeMacroLang =
+    forall l. Macro.HasTypes l =>
+      SomeMacroLang (ClangCStandard -> Macro.Lang l)
+
+-- | The default macro language, backed by @c-expr-dsl@.
+macroLangCExpr :: SomeMacroLang
+macroLangCExpr = SomeMacroLang Macro.cExpr
+
+-- | The 'Macro.Empty' macro language: recognizes no macros.
+macroLangEmpty :: SomeMacroLang
+macroLangEmpty = SomeMacroLang (const Macro.empty)
+
+-- | The 'Macro.Raw' macro language: translates macros to their tokens.
+macroLangRaw :: SomeMacroLang
+macroLangRaw = SomeMacroLang (const Macro.raw)
+
+data TestCase = TestCase {
+      -- | Name of the test (in the tasty test tree) and the input header
+      name :: TestName
+
+      -- | Name of the header file, e.g., "foo.h"
+    , inputHeader :: String
+
+      -- | Directory that the input header is in, relative to the package root
+    , inputDir :: FilePath
+
+      -- | Directory where output files should be stored, relative to the
+      -- package root
+    , outputDir :: FilePath
+
+      -- | Predicate for evaluating the trace messages
+    , tracePredicate :: TracePredicate Level TraceMsg
+
+      -- | Does this test have output, or does it fail?
+    , outcome :: Outcome
+
+      -- | Tests that require a specific @libclang@ version
+      --
+      -- If the predicate does not match, the test is skipped entirely.
+    , clangVersion :: Maybe ((Int, Int, Int) -> Bool)
+
+      -- | Configure the C standard for this test
+      --
+      -- In general, a feature should be tested with the /minimum/ standard that
+      -- supports the feature.  Additional tests with other standards may also
+      -- be provided, when appropriate.
+    , cStandard :: CStandard
+
+      -- | Modify the default boot test configuration
+    , onBoot :: BootConfig -> BootConfig
+
+      -- | Modify the default frontend test configuration
+    , onFrontend :: FrontendConfig -> FrontendConfig
+
+      -- | Modify the default backend test configuration
+    , onBackend :: BackendConfig -> BackendConfig
+
+      -- | Configure if the @stdlib@ binding specification should be used
+    , specStdlib :: EnableStdlibBindingSpec
+
+      -- | Modify the default external binding specification configuration
+    , specExternal :: [FilePath]
+
+      -- | Modify the default prescriptive binding specification configuration
+    , specPrescriptive :: Maybe FilePath
+
+      -- | In imports, put "qualified" before or after the module name
+    , qualifiedStyle :: QualifiedStyle
+
+      -- | @#define@s emitted before the input header
+    , hashDefines :: [C.HashDefine]
+
+      -- | The macro language to run this test with
+    , macroLang :: SomeMacroLang
+    }
+  deriving stock (Generic)
+
+{-------------------------------------------------------------------------------
+  Derived
+-------------------------------------------------------------------------------}
+
+-- | The root directives of a test: the @#define@s, then the input header
+testInputDirectives :: TestCase -> [C.UncheckedRootDirective]
+testInputDirectives test =
+    map C.DirectiveHashDefine test.hashDefines
+      ++ [C.DirectiveHashInclude test.inputHeader]
+
+{-------------------------------------------------------------------------------
+  Construction
+-------------------------------------------------------------------------------}
+
+defaultTest ::
+     String --  ^ Filepath to the header file without the @.h@ extension
+  -> TestCase
+defaultTest fp = TestCase{
+      name             = fp
+    , inputHeader      = fp <.> "h"
+    , inputDir         = "test-artefacts" </> "headers" </> "golden"
+    , outputDir        = "test-artefacts" </> "fixtures" </> fp
+    , tracePredicate   = defaultTracePredicate
+    , outcome          = Success
+    , clangVersion     = Nothing
+    , cStandard        = c89
+    , onBoot           = id
+    , onFrontend       = id
+    , onBackend        = id
+    , specStdlib       = EnableStdlibBindingSpec
+    , specExternal     = []
+    , specPrescriptive = Nothing
+    , qualifiedStyle   = def
+    , hashDefines      = []
+    , macroLang        = macroLangCExpr
+    }
+
+testVariant ::
+     String        -- ^ Filename without the @.h@ extension
+  -> Maybe Natural -- ^ Variant index
+  -> String        -- ^ Variant suffix, appended to the output directory
+  -> TestCase
+testVariant filename index suffix =
+    mkTestVariant index suffix $
+      defaultTest filename
+
+mkTestVariant ::
+     Maybe Natural -- ^ Variant index
+  -> String        -- ^ Variant suffix
+  -> TestCase
+  -> TestCase
+mkTestVariant index suffix test = test
+    & #name           %~ (++ indexInfix ++ "." ++ suffix)
+    & #outputDir      %~ (++ indexInfix ++ "." ++ suffix)
+  where
+    indexInfix = maybe "" (\n -> "." ++ show n) index
+
+testTrace :: String -> TracePredicate Level TraceMsg -> TestCase
+testTrace filename trace = defaultTest filename & #tracePredicate .~ trace
+
+testTraceSimple ::
+     String
+  -> (TraceMsg -> Maybe (TraceExpectation ()))
+  -> TestCase
+testTraceSimple filename trace =
+    testTrace filename $ singleTracePredicate trace
+
+testTraceMulti ::
+     (Ord b, RenderLabel b)
+  => String
+  -> [b]
+  -> (TraceMsg -> Maybe (TraceExpectation b))
+  -> TestCase
+testTraceMulti filename expected trace =
+    testTrace filename $ multiTracePredicate expected trace
+
+testDiagnostic ::
+     String
+  -> (Clang.Diagnostic -> Bool)
+  -> TestCase
+testDiagnostic filename p =
+    testTraceSimple filename $ \case
+      TraceFrontend (FrontendClang (ClangDiagnostic x))
+        | p x -> Just $ Expected ()
+      _otherwise -> Nothing
+
+{-------------------------------------------------------------------------------
+  Construction: failing tests
+-------------------------------------------------------------------------------}
+
+defaultFailingTest :: String -> TestCase
+defaultFailingTest filename =
+    defaultTest filename
+      & #outcome  .~ FailureBindgen
+      & #inputDir .~ "test-artefacts/headers/golden"
+
+failingTestTrace :: String -> TracePredicate Level TraceMsg -> TestCase
+failingTestTrace filename trace =
+    defaultFailingTest filename
+      & #tracePredicate .~ trace
+
+failingTestSimple ::
+     String
+  -> (TraceMsg -> Maybe (TraceExpectation ()))
+  -> TestCase
+failingTestSimple filename trace =
+    failingTestTrace filename $ singleTracePredicate trace
+
+failingTestMulti ::
+     (Ord a, RenderLabel a)
+  => String
+  -> [a]
+  -> (TraceMsg -> Maybe (TraceExpectation a))
+  -> TestCase
+failingTestMulti filename expected trace =
+    failingTestTrace filename $ multiTracePredicate expected trace
+
+defaultFailingTestLibclang :: String -> TestCase
+defaultFailingTestLibclang filename =
+    defaultTest filename
+      & #outcome  .~ FailureLibclang
+      & #inputDir .~ "test-artefacts/headers/golden"
+
+failingTestLibclangTrace :: String -> TracePredicate Level TraceMsg -> TestCase
+failingTestLibclangTrace filename trace =
+    defaultFailingTestLibclang filename
+      & #tracePredicate .~ trace
+
+failingTestLibclangSimple ::
+     String
+  -> (TraceMsg -> Maybe (TraceExpectation ()))
+  -> TestCase
+failingTestLibclangSimple filename trace =
+    failingTestLibclangTrace filename $ singleTracePredicate trace
+
+failingTestLibclangMulti ::
+     (Ord a, RenderLabel a)
+  => String
+  -> [a]
+  -> (TraceMsg -> Maybe (TraceExpectation a))
+  -> TestCase
+failingTestLibclangMulti filename expected trace =
+    failingTestLibclangTrace filename $ multiTracePredicate expected trace
+
+{-------------------------------------------------------------------------------
+  Execution
+-------------------------------------------------------------------------------}
+
+getTestBootConfig :: TestCase -> TestResources -> BootConfig
+getTestBootConfig test testResources = test.onBoot BootConfig {
+      clangArgs =
+        getTestClangArgsConfig test.cStandard [test.inputDir] testResources
+    , baseModule = "Example"
+    , bindingSpec = BindingSpecConfig {
+          stdlibSpec              = test.specStdlib
+        , compatibility           = BindingSpecStrict
+        , extBindingSpecs         =
+            map (testResources.packageRoot </>) test.specExternal
+        , prescriptiveBindingSpec =
+            (testResources.packageRoot </>) <$> test.specPrescriptive
+        }
+    }
+
+getTestFrontendConfig :: TestCase -> FrontendConfig
+getTestFrontendConfig test = test.onFrontend def
+
+getTestBackendConfig :: TestCase -> BackendConfig
+getTestBackendConfig test =
+    test.onBackend $ getTestDefaultBackendConfig test.name
+
+withTestTraceConfig ::
+     (String -> IO ())
+  -> TestCase
+  -> (TracerConfig Level TraceMsg -> IO a)
+  -> IO a
+withTestTraceConfig report test action =
+    withTraceConfigPredicate report test.tracePredicate $ \traceConfig ->
+      let traceConfig' = traceConfig
+      in  action traceConfig'
+
+-- | Run 'hsBindgen'.
+--
+-- The artefact is polymorphic in the macro-language tag @l@, so that the same
+-- artefact can be run with whichever macro language 'test' selects.
+runTestHsBindgen ::
+     forall a.
+     (String -> IO ())
+  -> IO TestResources
+  -> TestCase
+  -> (forall l. Macro.HasTypes l => Artefact l a)
+  -> IO (Either BindgenError a)
+runTestHsBindgen report getTestResources test artefacts = do
+    bootConfig <- getTestBootConfig test <$> getTestResources
+    let frontendConfig = getTestFrontendConfig test
+        backendConfig  = getTestBackendConfig test
+        bindgenConfig  = BindgenConfig bootConfig frontendConfig backendConfig
+    withTestTraceConfig report test $ \traceConfigUnsafe ->
+      case test.macroLang of
+        SomeMacroLang mkMacroLang ->
+          hsBindgenEMacroLang
+            (pure . mkMacroLang)
+            traceConfigUnsafe
+            quietTracerConfig
+            bindgenConfig
+            (testInputDirectives test)
+            artefacts
+
+runTestHsBindgenSuccess ::
+     forall b.
+     (String -> IO ())
+  -> IO TestResources
+  -> TestCase
+  -> (forall l. Macro.HasTypes l => Artefact l b)
+  -> IO b
+runTestHsBindgenSuccess report getTestResources test artefacts = do
+    eRes <- runTestHsBindgen report getTestResources test artefacts
+    case eRes of
+      Left er -> assertFailure (msgWith er)
+      Right r -> pure r
+  where
+    msgWith :: BindgenError -> String
+    msgWith e = "Expected 'hs-bindgen' to succeed, but received an error: " <> show e
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Infra/TestCaseTree.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/TestCaseTree.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Infra/TestCaseTree.hs
@@ -0,0 +1,87 @@
+{-# LANGUAGE CPP #-}
+
+#if defined(MIN_VERSION_GLASGOW_HASKELL)
+#if MIN_VERSION_GLASGOW_HASKELL(9,14,0,0)
+#define exportPattern data
+#else
+#define exportPattern pattern
+#endif
+#else
+#define exportPattern pattern
+#endif
+
+-- | Construct tasty test tree
+module Test.HsBindgen.Golden.Infra.TestCaseTree (
+    TestCaseTree (..)
+  , exportPattern TestCases
+  , exportPattern TestCaseLeafs
+  , testTreeFor
+  , flatten
+  ) where
+
+import System.Directory (createDirectoryIfMissing)
+import Test.Tasty (TestTree, testGroup, withResource)
+
+import Clang.Version (ClangVersion (ClangVersion, ClangVersionUnknown),
+                      runtimeClangVersion)
+
+import Test.HsBindgen.Golden.Infra.Check.BindingSpec qualified as BindingSpec
+import Test.HsBindgen.Golden.Infra.Check.FailureBindgen qualified as FailureBindgen
+import Test.HsBindgen.Golden.Infra.Check.FailureLibclang qualified as FailureLibclang
+import Test.HsBindgen.Golden.Infra.Check.PP qualified as PP
+import Test.HsBindgen.Golden.Infra.Check.TH qualified as TH
+import Test.HsBindgen.Golden.Infra.TestCase (Outcome (FailureBindgen, FailureLibclang, Success),
+                                             TestCase (clangVersion, name, outcome, outputDir))
+import Test.HsBindgen.Resources (TestResources)
+
+data TestCaseTree =
+    TestCaseSection String [TestCaseTree]
+  | TestCaseLeaf TestCase
+
+pattern TestCases :: String -> [TestCase] -> TestCaseTree
+pattern TestCases label cases = TestCaseSection label (TestCaseLeafs cases)
+
+pattern TestCaseLeafs :: [TestCase] -> [TestCaseTree]
+pattern TestCaseLeafs cases <- (fmap (\(TestCaseLeaf test) -> test) -> cases)
+  where TestCaseLeafs cases = fmap TestCaseLeaf cases
+
+testTreeFor :: IO TestResources -> TestCaseTree -> TestTree
+testTreeFor getTestResources = goTree
+  where
+    goTree :: TestCaseTree -> TestTree
+    goTree (TestCaseSection label sections) =
+        testGroup label $ map goTree sections
+    goTree (TestCaseLeaf test) = goCase test
+
+    goCase :: TestCase -> TestTree
+    goCase test
+      | Just versionPred <- test.clangVersion
+      , case runtimeClangVersion of
+          ClangVersion version  -> not (versionPred version)
+          ClangVersionUnknown _ -> True
+      = testGroup test.name []
+
+      | otherwise
+      = case test.outcome of
+          Success ->
+            withTestOutputDir test.outputDir $ testGroup test.name [
+                TH.check          getTestResources test
+              , PP.check          getTestResources test
+              , BindingSpec.check getTestResources test
+              ]
+          FailureBindgen ->
+            FailureBindgen.check getTestResources test
+          FailureLibclang ->
+            FailureLibclang.check getTestResources test
+
+    withTestOutputDir :: FilePath -> TestTree -> TestTree
+    withTestOutputDir outputDir k =
+        withResource
+          (createDirectoryIfMissing True outputDir)
+          (\_ -> pure ())
+          (\_ -> k)
+
+flatten :: TestCaseTree -> [TestCase]
+flatten = \case
+    TestCaseSection _ subTrees -> concatMap flatten subTrees
+    TestCaseLeaf leaf          -> [leaf]
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Macros.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Macros.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Macros.hs
@@ -0,0 +1,398 @@
+-- | Golden tests: macros
+module Test.HsBindgen.Golden.Macros (testCases) where
+
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Analysis.DeclIndex (UnusableReason (..))
+import HsBindgen.Frontend.Pass.Parse.IsPass (EmptyMacros (..))
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      -- Default tests
+      defaultTest "macros/issue_890"
+    , defaultTest "macros/keyword_params"
+    , defaultTest "macros/macro_functions"
+    , defaultTest "macros/macro_strings"
+    , defaultTest "macros/macro_type_ptr_qualifiers"
+    , defaultTest "macros/macro_type_void"
+    , defaultTest "macros/macro_typedef_struct"
+    , defaultTest "macros/macro_types"
+    , defaultTest "macros/object_like_as_function_like"
+    , defaultTest "macros/parse/first_parse_then_typecheck"
+    , defaultTest "macros/parse/macro_typedef_scope"
+    , defaultTest "macros/undef"
+      -- Bespoke tests
+    , test_command_line_uses
+    , test_command_line_uses_no_slicing
+    , test_command_line_redefined
+    , test_command_line_redefined_hash_define
+    , test_empty_body
+    , test_empty_body_parse
+    , test_gnu_variadic
+    , test_macro_comma
+    , test_macro_ext_binding_dep
+    , test_macro_resolution_log_level_default
+    , test_macro_resolution_log_level_warnings
+    , test_macro_type_unresolved_tagged
+    , test_macro_in_fundecl
+    , test_macro_in_fundecl_vs_typedef
+    , test_macro_redefines_global
+    , test_macros
+    , test_parse_simple
+    , test_parse_elaborate
+    , test_parse_intermittent_include
+    , test_parse_intermittent_include_conditional
+    , test_parse_macro_typedef_scope_multiple
+    , test_wrong_source_location
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+-- | Macros defined by @-D@ options are declarations
+--
+-- Program slicing selects the ones the header uses.
+test_command_line_uses :: TestCase
+test_command_line_uses =
+    defaultTest "macros/command_line/uses"
+      & #onBoot     .~ ( #clangArgs % #argsAfter .~ commandLineUsesArgs )
+      & #onFrontend .~ ( #programSlicing .~ EnableProgramSlicing )
+
+-- | Without program slicing, the default predicate does not select macros
+-- defined by @-D@ options, and so neither the declarations that use them
+test_command_line_uses_no_slicing :: TestCase
+test_command_line_uses_no_slicing =
+    testVariant "macros/command_line/uses" Nothing "no_slicing"
+      & #onBoot         .~ ( #clangArgs % #argsAfter .~ commandLineUsesArgs )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name (MatchTransMissing _) ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct S", "macro W"]
+
+commandLineUsesArgs :: [String]
+commandLineUsesArgs = ["-DT=int", "-DV=1", "-DF(x)=((x)+1)"]
+
+-- | A header redefines a macro defined by a @-D@ option: a conflict
+test_command_line_redefined :: TestCase
+test_command_line_redefined =
+    defaultTest "macros/command_line/redefined"
+      & #onBoot         .~ ( #clangArgs % #argsAfter .~ ["-DT=int"] )
+      & #tracePredicate .~ commandLineRedefinedTracePredicate
+
+-- | A header redefines a macro defined by a @#define@ root directive: a
+-- conflict
+test_command_line_redefined_hash_define :: TestCase
+test_command_line_redefined_hash_define =
+    testVariant "macros/command_line/redefined" Nothing "hash_define"
+      & #hashDefines    .~ [C.HashDefine "T" "int"]
+      & #tracePredicate .~ commandLineRedefinedTracePredicate
+
+commandLineRedefinedTracePredicate :: TracePredicate Level TraceMsg
+commandLineRedefinedTracePredicate =
+    multiTracePredicate declsWithMsgs $ \case
+      MatchDiagnosticCategory "Lexical or Preprocessor Issue" ->
+        Just $ Expected "redefinition"
+      MatchSelect _name SelectConflict{} ->
+        Just $ Expected "conflict"
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [String]
+    declsWithMsgs = ["redefinition", "conflict"]
+
+-- | An empty macro body is legal C, but by default we do not parse it.
+--
+-- See <https://github.com/well-typed/hs-bindgen/issues/2246>. Include guards
+-- have this shape, so 'DoNotParseEmptyMacros' keeps all four macros from
+-- reaching the macro language: they are reported as 'ParseMacroEmpty', and none
+-- of them counts towards the dropped-macro summary.
+test_empty_body :: TestCase
+test_empty_body =
+    testTraceMulti "macros/empty_body" (map NotParsed emptyMacroNames) $ \case
+      MatchUnusable name (UnusableParseFailure ParseMacroEmpty{}) ->
+        Just $ Expected (NotParsed name)
+      MatchMacrosDropped{} ->
+        Just Unexpected
+      _otherwise ->
+        Nothing
+
+-- | 'ParseEmptyMacros' passes empty macros on to the macro language.
+--
+-- Companion to 'test_empty_body': @CExpr@ has no expression to translate, so
+-- all four macros now fail like any other macro, and the summary counts them.
+-- The @.2.raw@ variant of this test generates bindings for them instead.
+test_empty_body_parse :: TestCase
+test_empty_body_parse =
+    testVariant "macros/empty_body" Nothing "parse_empty_macros"
+      & #onFrontend     .~ ( #emptyMacros .~ ParseEmptyMacros )
+      & #tracePredicate .~ multiTracePredicate expected (\case
+            MatchUnusable name (UnusableParseFailure ParseMacroErrorParse{}) ->
+              Just $ Expected (Declined name)
+            MatchMacrosDropped n ->
+              Just $ Expected (Dropped n)
+            _otherwise ->
+              Nothing
+          )
+  where
+    expected :: [EmptyBodyTrace]
+    expected = Dropped (length emptyMacroNames) : map Declined emptyMacroNames
+
+-- | The macros of the @macros/empty_body@ header
+emptyMacroNames :: [C.DeclName]
+emptyMacroNames = [
+      "macro EMPTY_OBJECT"
+    , "macro EMPTY_FUNCTION"
+    , "macro EMPTY_FUNCTION_PARAMS"
+    , "macro EMPTY_FUNCTION_VARIADIC"
+    ]
+
+-- | What we expect to be traced for a macro with an empty replacement list
+data EmptyBodyTrace =
+    -- | We did not attempt to parse the macro
+    NotParsed C.DeclName
+    -- | The macro language was given the macro, and declined it
+  | Declined C.DeclName
+    -- | Summary of the macros that failed to translate
+  | Dropped Int
+  deriving stock (Eq, Ord, Show)
+
+instance RenderLabel EmptyBodyTrace where
+  renderLabel = renderLabel . show
+
+-- | The C99 and the GNU named-variadic parameter lists are different macros.
+--
+-- @c-expr@ supports neither form, so the bindings only exist in the @raw@
+-- variant of this fixture; there, @GNU_VARIADIC(fmt, args...)@ must keep its
+-- own spelling, since the C99 form @GNU_VARIADIC(fmt, ...)@ would pass only
+-- @fmt@ on. See <https://github.com/well-typed/hs-bindgen/issues/2242>.
+test_gnu_variadic :: TestCase
+test_gnu_variadic =
+    testTraceMulti "macros/gnu_variadic" declsWithMsgs $ \case
+      MatchUnusable name (UnusableParseFailure ParseMacroErrorParse{}) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+        "macro C99_VARIADIC"
+      , "macro GNU_VARIADIC"
+      , "macro GNU_VARIADIC_ONLY"
+      ]
+
+-- | A comma in a macro body denotes a tuple, not the C comma operator.
+--
+-- See <https://github.com/well-typed/hs-bindgen/issues/2182>: C gives macro
+-- bodies no meaning of their own, and tuples support the argument-list idiom
+-- (@#define ARGS 1, 2@ used as @f(ARGS)@). Consequently, a comma expression
+-- does not compose with arithmetic; @ARITH@ is dropped with a parse failure.
+test_macro_comma :: TestCase
+test_macro_comma =
+    testTraceMulti "macros/macro_comma" ["macro ARITH"] $ \case
+      MatchUnusable name@"macro ARITH" (UnusableParseFailure ParseMacroErrorParse{}) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+
+test_macro_ext_binding_dep :: TestCase
+test_macro_ext_binding_dep =
+    defaultTest "macros/macro_ext_binding_dep"
+      & #specExternal .~
+          [ "test-artefacts/headers/golden/macros/macro_ext_binding_dep.yaml"
+          ]
+
+-- | Macro name-resolution failures are reported at 'Info' by default.
+--
+-- Regression test for <https://github.com/well-typed/hs-bindgen/issues/2147>:
+-- such failures are common in real headers (e.g. preprocessor-only operators),
+-- so they must not be warnings by default.
+test_macro_resolution_log_level_default :: TestCase
+test_macro_resolution_log_level_default =
+    testVariant "macros/macro_resolution_log_level" Nothing "default"
+      & #tracePredicate .~ multiTracePredicate expected (\trace -> case trace of
+            MatchUnusable name (UnusableMacroResolutionFailure{})
+              | getDefaultLogLevel trace == Info -> Just $ Expected name
+            _otherwise -> Nothing
+          )
+  where
+    expected :: [C.DeclName]
+    expected = ["macro UNRESOLVED_MACRO"]
+
+-- | 'EnableMacroWarnings' raises macro name-resolution failures to 'Warning'.
+--
+-- Companion to 'test_macro_resolution_log_level_default'; the predicate
+-- insists the (custom) log level is 'Warning'.
+test_macro_resolution_log_level_warnings :: TestCase
+test_macro_resolution_log_level_warnings =
+    testVariant "macros/macro_resolution_log_level" Nothing "enable_macro_warnings"
+      & #tracePredicate .~ multiTracePredicateCustomLogLevel customLogLevel
+          expected (\trace -> case trace of
+            MatchUnusable name (UnusableMacroResolutionFailure{})
+              | applyCustomLogLevel customLogLevel trace (getDefaultLogLevel trace)
+                  == Warning -> Just $ Expected name
+            MatchMacrosDropped{} -> Just Tolerated
+            _otherwise -> Nothing
+          )
+  where
+    customLogLevel = getCustomLogLevel [EnableMacroWarnings]
+
+    expected :: [C.DeclName]
+    expected = ["macro UNRESOLVED_MACRO"]
+
+test_macro_type_unresolved_tagged :: TestCase
+test_macro_type_unresolved_tagged =
+    testTraceMulti "macros/macro_type_unresolved_tagged" declsWithMsgs $ \case
+      MatchUnusable name@"struct Unparsable"
+        (UnusableParseFailure (ParseUnsupportedFloatType UnsupportedLongDouble)) ->
+        Just $ Expected (name, "select-parse-failure")
+      MatchSelect name@"macro PTR_UNPARSABLE" (TransitiveDependenciesMissing{}) ->
+        Just $ Expected (name, "select-transitive-dependencies-missing")
+      MatchUnusable name@"macro PTR_UNPARSABLE" (UnusableMangleNamesFailure{}) ->
+        Just $ Expected (name, "select-mangle-names-failure")
+      MatchUnusable name@"macro PTR_UNPARSABLE" (UnusableMacroResolutionFailure{}) ->
+        Just $ Expected (name, "macro-unresolved-tagged-type")
+      MatchUnusable name@"macro PTR_DOES_NOT_EXIST" (UnusableMacroResolutionFailure{}) ->
+        Just $ Expected (name, "macro-unresolved-tagged-type")
+      MatchUnusable name@"macro DOES_NOT_EXIST" (UnusableMacroResolutionFailure{}) ->
+        Just $ Expected (name, "macro-unresolved-tagged-type")
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+        ("struct Unparsable",        "select-parse-failure")
+      , ("macro PTR_UNPARSABLE",     "select-transitive-dependencies-missing")
+      , ("macro PTR_UNPARSABLE",     "select-mangle-names-failure")
+      , ("macro PTR_DOES_NOT_EXIST", "macro-unresolved-tagged-type")
+      , ("macro DOES_NOT_EXIST",     "macro-unresolved-tagged-type")
+      ]
+
+test_macro_in_fundecl :: TestCase
+test_macro_in_fundecl =
+    testTraceMulti "macros/macro_in_fundecl" declsWithMsgs $ \case
+      MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          -- Duplicate symbols
+          "bar1", "bar2", "bar3", "bar4"
+        , "baz1", "baz2", "baz3"
+        , "foo1", "foo2", "foo3"
+        , "quux"
+        , "wam"
+        ]
+
+test_macro_in_fundecl_vs_typedef :: TestCase
+test_macro_in_fundecl_vs_typedef =
+    testTraceMulti "macros/macro_in_fundecl_vs_typedef" declsWithMsgs $ \case
+      MatchDelayed name ParsePotentialDuplicateSymbol{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["quux1", "quux2", "wam1", "wam2"]
+
+test_macro_redefines_global :: TestCase
+test_macro_redefines_global =
+    testTraceMulti "macros/macro_redefines_global" declsWithMsgs $ \case
+      MatchSelect name SelectConflict{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+        "stdin"
+      , "macro stdin"
+      , "stdout"
+      , "macro stdout"
+      , "stderr"
+      , "macro stderr"
+      ]
+
+test_macros :: TestCase
+test_macros =
+    defaultTest "macros/macros"
+      & #cStandard .~ c23
+
+test_parse_simple :: TestCase
+test_parse_simple =
+    defaultTest "macros/parse/simple"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BIf (SelectHeader FromAllHeaders)
+          )
+
+test_parse_elaborate :: TestCase
+test_parse_elaborate =
+    defaultTest "macros/parse/elaborate"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BIf (SelectHeader FromAllHeaders)
+          )
+
+test_parse_intermittent_include :: TestCase
+test_parse_intermittent_include =
+    defaultTest "macros/parse/intermittent_include"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BIf (SelectHeader FromAllHeaders)
+          )
+
+test_parse_intermittent_include_conditional :: TestCase
+test_parse_intermittent_include_conditional =
+    defaultTest "macros/parse/intermittent_include_conditional"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BIf (SelectHeader FromAllHeaders)
+          )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchDiagnosticCategory "Lexical or Preprocessor Issue" ->
+              Just $ Expected ("FOO", "redefinition")
+            MatchSelect name SelectConflict{} ->
+              Just $ Expected (name, "conflict")
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+        ("FOO", "redefinition")
+      , ("macro FOO", "conflict")
+      ]
+
+test_parse_macro_typedef_scope_multiple :: TestCase
+test_parse_macro_typedef_scope_multiple =
+    defaultTest "macros/parse/macro_typedef_scope_multiple"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BIf (SelectHeader FromAllHeaders)
+          )
+
+test_wrong_source_location :: TestCase
+test_wrong_source_location =
+    defaultTest "macros/wrong_source_location"
+      -- Spelling location is only populated correctly on llvm >= 19.1.0;
+      -- older toolchains cannot disambiguate unnamed declarations
+      -- originating from the same macro expansion.
+      & #clangVersion .~ Just (>= (19, 1, 0))
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Macros/Lang.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Macros/Lang.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Macros/Lang.hs
@@ -0,0 +1,55 @@
+-- | Golden tests: macro fixtures run with the 'Macro.Empty' and 'Macro.Raw'
+--   macro languages.
+--
+-- These reuse the existing macro fixtures, but run them with the 'Empty' and
+-- 'Raw' macro languages. Output is stored alongside the @c-expr@ fixtures with
+-- test variant suffixes.
+--
+-- Trace messages are tolerated wholesale ('tolerateAll'): the 'Empty' and 'Raw'
+-- languages produces different traces than @c-expr@ (no macro typechecking or
+-- reparsing, but the same non-macro traces such as select conflicts), so the
+-- per-test @c-expr@ predicates do not carry over. The point of these tests is
+-- to compare the /generated bindings/.
+module Test.HsBindgen.Golden.Macros.Lang (testCases) where
+
+import HsBindgen.Imports
+
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Golden.Infra.TestCaseTree
+import Test.HsBindgen.Golden.Macros qualified as Macros
+import Test.HsBindgen.Golden.Macros.Redeclaration qualified as Redeclaration
+import Test.HsBindgen.Golden.Macros.Reparse qualified as Reparse
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCaseTree]
+testCases =
+    [ TestCaseSection "empty" $ TestCaseLeafs $ map emptyVariant macroTestCases
+    , TestCaseSection "raw"   $ TestCaseLeafs $ map rawVariant   macroTestCases
+    ]
+  where
+    emptyVariant = withMacroLangVariant 1 "empty" macroLangEmpty
+    rawVariant   = withMacroLangVariant 2 "raw"   macroLangRaw
+
+-- | The macro fixtures we reuse, in their @c-expr@ form.
+macroTestCases :: [TestCase]
+macroTestCases = concat [
+      Macros.testCases
+    , concatMap flatten Reparse.testCases
+    , concatMap flatten Redeclaration.testCases
+    ]
+
+-- | Turn a @c-expr@ macro test into another language variant.
+--
+-- Parsing configuration (C standard, @libclang@ version constraints, frontend
+-- tweaks, binding specs) is preserved, since it is independent of the macro
+-- language; only the macro language, output location and trace predicate
+-- change.
+withMacroLangVariant :: Natural -> String -> SomeMacroLang -> TestCase -> TestCase
+withMacroLangVariant index suffix macroLang test =
+    mkTestVariant (Just index) suffix test
+      & #macroLang      .~ macroLang
+      & #tracePredicate .~ tolerateAll
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Macros/Redeclaration.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Macros/Redeclaration.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Macros/Redeclaration.hs
@@ -0,0 +1,274 @@
+-- | Golden tests: macro redeclaration
+module Test.HsBindgen.Golden.Macros.Redeclaration (testCases) where
+
+import Control.Applicative
+
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Pass.PrepareReparse.IsPass.Msg (DelayedPrepareReparseMsg (PrepareReparseExpansionNotUnique))
+import HsBindgen.Frontend.Pass.ReparseMacroExpansions.IsPass.Msg
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Golden.Infra.TestCaseTree
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCaseTree]
+testCases = [
+      TestCaseLeaf test_def_undef_def
+    , TestCaseLeaf test_different
+    , TestCaseLeaf test_different_value
+    , TestCaseLeaf test_identical_semantics
+    , TestCaseLeaf test_identical_syntax
+    , TestCaseLeaf test_identical_value
+    , TestCaseLeaf test_main_header
+    , TestCaseLeaf test_noguard
+    , TestCaseLeaf test_same_line_tag_field
+    , TestCaseLeaf test_variadic
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test_def_undef_def :: TestCase
+test_def_undef_def =
+    defaultTest_custom "macros/redeclaration/def_undef_def"
+      & #tracePredicate .~ multiTracePredicate_custom expected trace
+  where
+    expected :: [C.DeclName]
+    expected = ["macro T", "foo", "foo", "foo", "bar", "bar", "bar"]
+
+    -- NOTE: though messages related to reparsing are most often info-level or
+    -- below, this predicate matches on all reparse-related trace messages so
+    -- that we can precisely assert that the messages make sense
+    trace :: TraceMsg -> Maybe (TraceExpectation C.DeclName)
+    trace = \case
+      MatchSelect name@"macro T" SelectConflict{} ->
+        Just $ Expected name
+      (matchDiagnosticSpelling "macro redefined" -> Just _diag) ->
+        Just $ Tolerated
+      MatchDelayedPrepareReparse name@"foo" PrepareReparseExpansionNotUnique{} ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"foo" (ReparseMacroExpansionUnknownType "T") ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"foo" ReparseMacroExpansionsLanC{} ->
+        Just $ Expected name
+      MatchDelayedPrepareReparse name@"bar" PrepareReparseExpansionNotUnique{} ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"bar" (ReparseMacroExpansionUnknownType "T") ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"bar" ReparseMacroExpansionsLanC{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+
+test_different :: TestCase
+test_different =
+    defaultTest_custom "macros/redeclaration/different"
+      & #tracePredicate .~ multiTracePredicate_custom expected trace
+  where
+    expected :: [C.DeclName]
+    expected = ["macro T", "foo", "foo", "foo", "bar", "bar", "bar"]
+
+    -- NOTE: though messages related to reparsing are most often info-level or
+    -- below, this predicate matches on all reparse-related trace messages so
+    -- that we can precisely assert that the messages make sense
+    trace :: TraceMsg -> Maybe (TraceExpectation C.DeclName)
+    trace = \case
+      MatchSelect name@"macro T" SelectConflict{} ->
+        Just $ Expected name
+      (matchDiagnosticSpelling "macro redefined" -> Just _diag) ->
+        Just $ Tolerated
+      MatchDelayedPrepareReparse name@"foo" PrepareReparseExpansionNotUnique{} ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"foo" (ReparseMacroExpansionUnknownType "T") ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"foo" ReparseMacroExpansionsLanC{} ->
+        Just $ Expected name
+      MatchDelayedPrepareReparse name@"bar" PrepareReparseExpansionNotUnique{} ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"bar" (ReparseMacroExpansionUnknownType "T") ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"bar" ReparseMacroExpansionsLanC{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+
+test_different_value :: TestCase
+test_different_value =
+    defaultTest_custom "macros/redeclaration/different_value"
+      & #tracePredicate .~ multiTracePredicate_custom expected trace
+  where
+    expected :: [C.DeclName]
+    expected = ["macro A"]
+
+    trace :: TraceMsg -> Maybe (TraceExpectation C.DeclName)
+    trace = \case
+      MatchSelect name@"macro A" SelectConflict{} ->
+        Just $ Expected name
+      (matchDiagnosticSpelling "macro redefined" -> Just _diag) ->
+        Just $ Tolerated
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+-- | The two definitions of @T@ are identical: @T@ is treated as defined once,
+-- and its expansion is unique.
+test_identical_semantics :: TestCase
+test_identical_semantics =
+    defaultTest_custom "macros/redeclaration/identical_semantics"
+
+test_identical_syntax :: TestCase
+test_identical_syntax =
+    defaultTest_custom "macros/redeclaration/identical_syntax"
+      & #tracePredicate .~ multiTracePredicate_custom expected trace
+  where
+    expected :: [C.DeclName]
+    expected = ["macro A", "macro T", "foo", "foo", "foo", "bar", "bar", "bar"]
+
+    -- NOTE: though messages related to reparsing are most often info-level or
+    -- below, this predicate matches on all reparse-related trace messages so
+    -- that we can precisely assert that the messages make sense
+    trace :: TraceMsg -> Maybe (TraceExpectation C.DeclName)
+    trace = \case
+      -- The definitions of @T@ are identical, but @T@ inherits the ambiguity
+      -- of @A@, so it conflicts too.
+      MatchSelect name@"macro A" SelectConflict{} ->
+        Just $ Expected name
+      MatchSelect name@"macro T" SelectConflict{} ->
+        Just $ Expected name
+      MatchDelayedPrepareReparse name@"foo" PrepareReparseExpansionNotUnique{} ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"foo" (ReparseMacroExpansionUnknownType "T") ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"foo" ReparseMacroExpansionsLanC{} ->
+        Just $ Expected name
+      MatchDelayedPrepareReparse name@"bar" PrepareReparseExpansionNotUnique{} ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"bar" (ReparseMacroExpansionUnknownType "T") ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"bar" ReparseMacroExpansionsLanC{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+
+test_identical_value :: TestCase
+test_identical_value =
+    defaultTest_custom "macros/redeclaration/identical_value"
+
+-- | A macro defined identically in an included header and in the main header
+test_main_header :: TestCase
+test_main_header =
+    defaultTest_custom "macros/redeclaration/main_header"
+
+-- | A header without include guard, included twice
+test_noguard :: TestCase
+test_noguard =
+    defaultTest_custom "macros/redeclaration/noguard"
+      -- @G@ is defined in @noguard_inner.h@, which is not a main header, so the
+      -- default selection predicate would deselect it.
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BIf (SelectHeader FromAllHeaders)
+          )
+
+-- | A tag macro expansion must not leak into a same-line field.
+--
+-- @A@ (redefined differently, hence ambiguous and conflicting) expands to the
+-- struct tag; @B@ expands to the field type. Only @B@ belongs to the field's
+-- reparse info, so no reparse-related messages should be emitted for the
+-- struct. The default predicate flags any such message as unexpected, so a
+-- regression of the same-line mis-attribution fails this test.
+test_same_line_tag_field :: TestCase
+test_same_line_tag_field =
+    defaultTest_custom "macros/redeclaration/same_line_tag_field"
+      & #tracePredicate .~ multiTracePredicate_custom expected trace
+  where
+    expected :: [C.DeclName]
+    expected = ["macro A"]
+
+    trace :: TraceMsg -> Maybe (TraceExpectation C.DeclName)
+    trace = \case
+      MatchSelect name@"macro A" SelectConflict{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+
+-- | Regression test for issue #2245, where variadic macros were parsed as
+-- object-like macros instead of function-like macros in the context of the
+-- @isExpansionUnique@ query
+--
+-- <https://github.com/well-typed/hs-bindgen/issues/2245>
+test_variadic :: TestCase
+test_variadic =
+    defaultTest_custom "macros/redeclaration/variadic"
+      & #tracePredicate .~ multiTracePredicate_custom expected trace
+  where
+    expected :: [C.DeclName]
+    expected = ["macro A", "macro ID", "T"]
+
+    trace :: TraceMsg -> Maybe (TraceExpectation C.DeclName)
+    trace = \case
+      MatchSelect name@"macro A" SelectConflict{} ->
+        Just $ Expected name
+      (MatchDelayed name@"macro ID" ParseMacroErrorParse{})  ->
+        Just $ Expected name
+      MatchDelayedReparseMacroExpansions name@"T" (ReparseMacroExpansionUnknownType "ID") ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+
+{-------------------------------------------------------------------------------
+  Custom
+-------------------------------------------------------------------------------}
+
+defaultTest_custom :: FilePath -> TestCase
+defaultTest_custom path =
+    defaultTest path
+      & #tracePredicate .~ defaultTracePredicate_custom
+
+defaultTracePredicate_custom :: TracePredicate Level TraceMsg
+defaultTracePredicate_custom = multiTracePredicate_custom @() [] (const Nothing)
+
+multiTracePredicate_custom :: forall b.
+     (Ord b, RenderLabel b)
+  => [b]
+  -> (TraceMsg -> Maybe (TraceExpectation b))
+  -> TracePredicate Level TraceMsg
+multiTracePredicate_custom expected predicate = multiTracePredicate expected predicate'
+  where
+    predicate' x = predicate x <|> defaultPredicate x
+
+    -- NOTE: though messages related to reparsing are most often info-level or
+    -- below, this predicate marks all reparse-related trace messages as
+    -- unexpected so that we can precisely test every message
+    defaultPredicate :: TraceMsg -> Maybe (TraceExpectation b)
+    defaultPredicate x
+      | getDefaultLogLevel x == Debug
+      = Just Tolerated
+      | otherwise
+      = case x of
+          -- Parse (macro)
+          MatchDelayed _info ParseMacroErrorParse{} ->
+            Just Unexpected
+          -- PrepareReparse
+          MatchImmediatePrepareReparse _ ->
+            Just Unexpected
+          MatchDelayedPrepareReparse _info _ ->
+            Just Unexpected
+          -- ReparseMacroExpansions
+          MatchImmediateReparseMacroExpansions _ ->
+            Just Unexpected
+          MatchDelayedReparseMacroExpansions _info _ ->
+            Just Unexpected
+          _ -> Nothing
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Macros/Reparse.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Macros/Reparse.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Macros/Reparse.hs
@@ -0,0 +1,134 @@
+-- | Golden tests: macro reparsing
+module Test.HsBindgen.Golden.Macros.Reparse (testCases) where
+
+import Control.Applicative
+
+import HsBindgen.Imports
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Golden.Infra.TestCaseTree
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCaseTree]
+testCases = [
+      TestCaseLeaf test
+    , TestCaseLeaf test_arithmetic_types
+    , TestCaseLeaf test_cref_attributes
+    , TestCaseLeaf test_defer_wrong
+    , TestCaseLeaf test_end_in_macro_arg
+    , TestCaseLeaf test_functions
+    , TestCaseLeaf test_gnu_attributes
+    , TestCases "nesting" [
+          defaultTest_nesting "macros/reparse/nesting"
+        , defaultTest_nesting "macros/reparse/nesting/struct_in_struct"
+        , defaultTest_nesting "macros/reparse/nesting/struct_in_typedef"
+        , defaultTest_nesting "macros/reparse/nesting/struct_in_union"
+        , defaultTest_nesting "macros/reparse/nesting/struct_in_variable"
+        , defaultTest_nesting "macros/reparse/nesting/union_in_struct"
+        , defaultTest_nesting "macros/reparse/nesting/union_in_typedef"
+        , defaultTest_nesting "macros/reparse/nesting/union_in_union"
+        , defaultTest_nesting "macros/reparse/nesting/union_in_variable"
+        ]
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+test :: TestCase
+test =
+    defaultTest "macros/reparse"
+        -- `bool` is a keyword.
+      & #clangVersion   .~ Just (>= (15, 0, 0))
+        -- `bool` is a keyword.
+      & #cStandard      .~ c23
+
+test_arithmetic_types :: TestCase
+test_arithmetic_types =
+    defaultTest "macros/reparse/arithmetic_types"
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchDelayed name@"f29"
+              (ParseUnsupportedFloatType UnsupportedLongDouble) ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs = ["f29"]
+
+test_cref_attributes :: TestCase
+test_cref_attributes =
+    defaultTest "macros/reparse/cref_attributes"
+      & #cStandard      .~ c23
+
+test_defer_wrong :: TestCase
+test_defer_wrong =
+    defaultTest "macros/reparse/defer_wrong"
+
+test_end_in_macro_arg :: TestCase
+test_end_in_macro_arg =
+    defaultTest "macros/reparse/end_in_macro_arg"
+
+test_functions :: TestCase
+test_functions =
+    defaultTest "macros/reparse/functions"
+      -- C99 required for inline functions
+      & #cStandard .~ c99
+
+test_gnu_attributes :: TestCase
+test_gnu_attributes =
+    defaultTest "macros/reparse/gnu_attributes"
+      & #cStandard      .~ c23
+
+{-------------------------------------------------------------------------------
+  Nesting
+-------------------------------------------------------------------------------}
+
+defaultTest_nesting :: FilePath -> TestCase
+defaultTest_nesting path =
+    defaultTest path
+      & #tracePredicate .~ defaultTracePredicate_nesting
+
+defaultTracePredicate_nesting :: TracePredicate Level TraceMsg
+defaultTracePredicate_nesting = multiTracePredicate_nesting @() [] (const Nothing)
+
+multiTracePredicate_nesting :: forall b.
+     (Ord b, RenderLabel b)
+  => [b]
+  -> (TraceMsg -> Maybe (TraceExpectation b))
+  -> TracePredicate Level TraceMsg
+multiTracePredicate_nesting expected predicate = multiTracePredicate expected predicate'
+  where
+    predicate' x = predicate x <|> defaultPredicate x
+
+    -- NOTE: though messages related to reparsing are most often info-level or
+    -- below, this predicate marks all reparse-related trace messages as
+    -- unexpected so that we can precisely test every message
+    defaultPredicate :: TraceMsg -> Maybe (TraceExpectation b)
+    defaultPredicate x
+      | getDefaultLogLevel x == Debug
+      = Just Tolerated
+      | otherwise
+      = case x of
+          -- Parse (macro)
+          MatchDelayed _info ParseMacroErrorParse{} ->
+            Just Unexpected
+          -- PrepareReparse
+          MatchImmediatePrepareReparse _ ->
+            Just Unexpected
+          MatchDelayedPrepareReparse _info _ ->
+            Just Unexpected
+          -- ReparseMacroExpansions
+          MatchImmediateReparseMacroExpansions _ ->
+            Just Unexpected
+          MatchDelayedReparseMacroExpansions _info _ ->
+            Just Unexpected
+          _ -> Nothing
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/ProgramAnalysis.hs b/test/hs-bindgen/Test/HsBindgen/Golden/ProgramAnalysis.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/ProgramAnalysis.hs
@@ -0,0 +1,611 @@
+-- | Golden tests: program analysis
+module Test.HsBindgen.Golden.ProgramAnalysis (testCases) where
+
+import HsBindgen.BindingSpec qualified as BindingSpec
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Analysis.DeclIndex (UnusableReason (..))
+import HsBindgen.Frontend.Pass.MangleNames.Error
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Frontend.Predicate
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Language.Haskell qualified as Hs
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      test_delay_traces
+      -- * Circular programs
+    , test_circular_includes
+    , test_circular_macro
+      -- * Program slicing
+    , test_program_slicing_macro_selected
+    , test_program_slicing_macro_unselected
+    , test_program_slicing_typedef_selected
+    , test_program_slicing_typedef_unselected
+    , test_program_slicing_selection
+    , test_program_slicing_simple
+      -- * Selection
+    , test_selection_bad
+    , test_selection_fail
+    , test_selection_fail_variant_1
+    , test_selection_fail_variant_2
+    , test_selection_fail_variant_3
+    , test_selection_foo
+    , test_selection_matches_c_names_1
+    , test_selection_matches_c_names_2
+    , test_selection_merge_traces
+    , test_selection_omit_external_a
+    , test_selection_omit_external_b
+    , test_selection_omit_prescriptive
+    , test_selection_squash
+      -- * Typedef analysis
+    , test_typedef_analysis
+    , test_typedef_block
+    , test_typedef_name_clash
+    , test_typedef_suffix_clash
+    ]
+
+{-------------------------------------------------------------------------------
+  Delay traces
+-------------------------------------------------------------------------------}
+
+test_delay_traces :: TestCase
+test_delay_traces =
+    defaultTest "program-analysis/delay_traces"
+      & #onFrontend .~ ( #selectionPredicate .~
+            -- NOTE: Matching for name kind is not good practice, but we want to
+            -- check if nested, but deselected declarations are correctly
+            -- assigned name kinds.
+            BOr
+              (BIf $ SelectDecl (DeclNameMatches "_function"))
+              (BOr
+                (BIf $ SelectDecl (DeclNameMatches "struct"))
+                (BIf $ SelectDecl (DeclNameMatches "union"))
+              )
+            )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchDelayed name (ParseUnsupportedFloatType UnsupportedLongDouble) ->
+              Just $ Expected name
+            MatchDelayed name ParseUnsupportedVariadicFunction ->
+              Just $ Expected name
+            MatchDelayed name ParseNestedDeclsFailed ->
+              Just $ Expected name
+            _otherwise ->
+               Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          "long_double_function"
+        , "var_arg_function"
+        , "struct long_double_s"
+        , "struct nested_long_double_s"
+        , "struct nested_long_double_u"
+          -- TODO https://github.com/well-typed/hs-bindgen/issues/1851
+          -- Why are the untagged nested structs not reported? Because
+          -- they are skipped by the FillUnnamedIds step?
+        ]
+
+{-------------------------------------------------------------------------------
+  Circularities
+-------------------------------------------------------------------------------}
+
+test_circular_includes :: TestCase
+test_circular_includes =
+    defaultTest "program-analysis/circular_includes"
+
+test_circular_macro :: TestCase
+test_circular_macro =
+    defaultTest "program-analysis/circular_macro"
+      & #tracePredicate .~
+          multiTracePredicateCustomLogLevel
+            -- We want to check macro traces.
+            (getCustomLogLevel [EnableMacroWarnings]) declsWithMsgs (\case
+                MatchUnusable name UnusableMacroTypecheckFailure{} ->
+                  Just $ Expected (name, "typecheck")
+                MatchSelect name TransitiveDependenciesMissing{} ->
+                  Just $ Expected (name, "transitive")
+                MatchMacrosDropped{} ->
+                  Just Tolerated
+                _otherwise ->
+                  Nothing
+              )
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+        ("macro A", "typecheck")
+      , ("macro A", "transitive")
+      , ("macro B", "typecheck")
+      , ("macro B", "transitive")
+      ]
+
+{-------------------------------------------------------------------------------
+  Program slicing
+-------------------------------------------------------------------------------}
+
+test_program_slicing_macro_selected :: TestCase
+test_program_slicing_macro_selected =
+    defaultTest "program-analysis/program-slicing/macro_selected"
+      & #onFrontend .~ (\cfg -> cfg
+            & #programSlicing .~ EnableProgramSlicing
+          )
+
+test_program_slicing_macro_unselected :: TestCase
+test_program_slicing_macro_unselected =
+    defaultTest "program-analysis/program-slicing/macro_unselected"
+      & #onFrontend .~ (\cfg -> cfg
+            & #programSlicing .~ DisableProgramSlicing
+          )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name TransitiveDependenciesMissing{} ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["foo"]
+
+test_program_slicing_typedef_selected :: TestCase
+test_program_slicing_typedef_selected =
+    defaultTest "program-analysis/program-slicing/typedef_selected"
+      & #onFrontend .~ (\cfg -> cfg
+            & #programSlicing .~ EnableProgramSlicing
+          )
+
+test_program_slicing_typedef_unselected :: TestCase
+test_program_slicing_typedef_unselected =
+    defaultTest "program-analysis/program-slicing/typedef_unselected"
+      & #onFrontend .~ (\cfg -> cfg
+            & #programSlicing .~ DisableProgramSlicing
+          )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name TransitiveDependenciesMissing{} ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["foo"]
+
+test_program_slicing_selection :: TestCase
+test_program_slicing_selection =
+    defaultTest "program-analysis/program_slicing_selection"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BOr
+              (BIf . SelectDecl $ DeclNameMatches "FileOperationRecord")
+              (BIf . SelectDecl $ DeclNameMatches "read_file_chunk")
+          & #programSlicing .~ EnableProgramSlicing
+          )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name (SelectStatusInfo (Selected SelectionRoot)) ->
+              Just $ Expected (name, "root")
+            MatchSelect name (SelectStatusInfo (Selected TransitiveDependency)) ->
+              Just $ Expected (name, "dependency")
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+          ("struct FileOperationRecord" , "root")
+        , ("read_file_chunk"            , "root")
+        , ("enum FileOperationStatus"   , "dependency")
+        ]
+
+-- Check that program slicing generates bindings for uint32_t and uint64_t if we
+-- only provide external binding specifications for uint64_t.
+test_program_slicing_simple :: TestCase
+test_program_slicing_simple =
+    defaultTest "program-analysis/program_slicing_simple"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BIf (SelectHeader FromMainHeaders)
+          & #programSlicing  .~ EnableProgramSlicing
+          )
+      & #specStdlib .~ BindingSpec.DisableStdlibBindingSpec
+      & #specExternal .~ [ "test-artefacts/headers/golden/program-analysis/program_slicing_simple.yaml" ]
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name (SelectStatusInfo (Selected SelectionRoot)) ->
+              Just $ Expected (name, "root")
+            MatchSelect name (SelectStatusInfo (Selected TransitiveDependency)) ->
+              Just $ Expected (name, "dependency")
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+          ("struct foo" , "root")
+        , ("bar"        , "root")
+        , ("uint32_t"   , "dependency")
+        ]
+
+{-------------------------------------------------------------------------------
+  Selection
+-------------------------------------------------------------------------------}
+
+test_selection_bad :: TestCase
+test_selection_bad =
+    testTraceMulti "program-analysis/selection_bad" declsWithMsgs $ \case
+      MatchSelect name MatchTransMissing{} ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    -- @f@ depends on user-defined @size_t@, which is not selected
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["f"]
+
+test_selection_fail :: TestCase
+test_selection_fail =
+    testTraceMulti "program-analysis/selection_fail" declsWithMsgs $ \case
+      MatchUnusable name UnusableParseFailure{} ->
+        Just $ Expected name
+      MatchSelect name (MatchTransMissing [MatchTransUnusable _unusable]) ->
+        Just $ Expected name
+      MatchSelect name (SelectStatusInfo (Selected SelectionRoot)) ->
+        Just $ Expected name
+      MatchUnusable name (UnusableMangleNamesFailure{}) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          "struct Fail"
+        , "struct Fail"
+        , "struct DependOnFailByValue"
+        , "struct DependOnFailByValue"
+        , "struct DependOnFailByReference"
+        , "struct DependOnFailByReference"
+        , "struct OkBefore"
+        , "struct OkAfter"
+        ]
+
+test_selection_fail_variant_1 :: TestCase
+test_selection_fail_variant_1 =
+    testVariant "program-analysis/selection_fail" (Just 1) "deselect_failed"
+      & #onFrontend .~ ( #selectionPredicate .~  BAnd
+            (       BIf $ SelectHeader   FromMainHeaders)
+            (BNot $ BIf $ SelectDecl   $ DeclNameMatches "struct Fail")
+          )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name (MatchTransMissing [MatchTransNotSelected]) ->
+              Just $ Expected name
+            MatchSelect name (SelectStatusInfo (Selected SelectionRoot)) ->
+              Just $ Expected name
+            MatchUnusable name (UnusableMangleNamesFailure{}) ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          "struct DependOnFailByValue"
+        , "struct DependOnFailByValue"
+        , "struct DependOnFailByReference"
+        , "struct DependOnFailByReference"
+        , "struct OkBefore"
+        , "struct OkAfter"
+        ]
+
+test_selection_fail_variant_2 :: TestCase
+test_selection_fail_variant_2 =
+    testVariant "program-analysis/selection_fail" (Just 2) "program_slicing"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BAnd
+              (       BIf $ SelectHeader   FromMainHeaders)
+              (BNot $ BIf $ SelectDecl   $ DeclNameMatches "struct Fail")
+          & #programSlicing .~ EnableProgramSlicing
+          )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+           MatchSelect name (MatchTransMissing [MatchTransUnusable _unusable]) ->
+             Just $ Expected name
+           MatchSelect name (SelectStatusInfo (Selected SelectionRoot)) ->
+             Just $ Expected name
+           MatchUnusable name (UnusableMangleNamesFailure{}) ->
+             Just $ Expected name
+           _otherwise ->
+             Nothing
+         )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = [
+          "struct DependOnFailByValue"
+        , "struct DependOnFailByValue"
+        , "struct DependOnFailByReference"
+        , "struct DependOnFailByReference"
+        , "struct OkBefore"
+        , "struct OkAfter"
+        ]
+
+test_selection_fail_variant_3 :: TestCase
+test_selection_fail_variant_3 =
+    testVariant "program-analysis/selection_fail" (Just 3) "select_ok"
+      & #onFrontend .~ (\cfg -> cfg
+          & #selectionPredicate .~ BAnd
+              (       BIf $ SelectDecl $ DeclNameMatches "struct OkBefore")
+              (BNot $ BIf $ SelectDecl $ DeclNameMatches "struct Fail")
+          & #programSlicing .~ EnableProgramSlicing
+          )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name (SelectStatusInfo (Selected SelectionRoot)) ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct OkBefore"]
+
+test_selection_foo :: TestCase
+test_selection_foo =
+    testTraceMulti "program-analysis/selection_foo" declsWithMsgs $ \case
+      MatchSelect _name (MatchTransMissing [_]) ->
+        Just $ Expected ("macro A", "foo_t not selected")
+
+      -- We get a transient name mangler failure here because @foo_t@ is
+      -- unsupported, and so, it is not mangled.
+      MatchUnusable _name UnusableMangleNamesFailure{} ->
+        Just $ Expected ("macro A", "foo_t not mangled")
+      MatchUnusable _name UnusableParseFailure{} ->
+        Just $ Expected ("f", "unsupported underlying type")
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+        ("macro A", "foo_t not selected")
+      , ("macro A", "foo_t not mangled")
+      , ("f", "unsupported underlying type")
+      ]
+
+test_selection_matches_c_names_1 :: TestCase
+test_selection_matches_c_names_1 =
+    testVariant "program-analysis/selection_matches_c_names" (Just 1) "positive_case"
+      & #specPrescriptive .~ Just "test-artefacts/headers/golden/program-analysis/selection_matches_c_names.yaml"
+      & #onFrontend .~ ( #selectionPredicate .~ predicate )
+  where
+    predicate :: Boolean SelectionPredicate
+    predicate =
+            BOr
+              (BIf (SelectDecl $ DeclNameMatches "FunctionWithAssignedHaskellNameByNameMangler"))
+              (BIf (SelectDecl $ DeclNameMatches "struct StructWithAssignedHaskellNameByPrescriptiveBindingSpecs"))
+
+test_selection_matches_c_names_2 :: TestCase
+test_selection_matches_c_names_2 =
+    testVariant "program-analysis/selection_matches_c_names" (Just 2) "negative_case"
+      & #specPrescriptive .~ Just "test-artefacts/headers/golden/program-analysis/selection_matches_c_names.yaml"
+      & #onFrontend .~ ( #selectionPredicate .~ predicate )
+      & #tracePredicate .~ singleTracePredicate (\case
+            MatchNoDeclarations ->
+              Just $ Expected ()
+            _otherwise ->
+              Nothing
+          )
+  where
+    predicate :: Boolean SelectionPredicate
+    predicate =
+            BOr
+              (BIf (SelectDecl $ DeclNameMatches "functionWithAssignedHaskellNameByNameMangler"))
+              (BIf (SelectDecl $ DeclNameMatches "NewName"))
+
+test_selection_merge_traces :: TestCase
+test_selection_merge_traces =
+    defaultTest "program-analysis/selection_merge_traces"
+      & #onFrontend .~ ( #selectionPredicate .~ predicate )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name (MatchTransMissing [_, _]) -> Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    predicate :: Boolean SelectionPredicate
+    predicate =
+            BAnd
+              (BIf (SelectHeader FromMainHeaders)) $
+            BAnd
+              (BNot (BIf (SelectDecl $ DeclNameMatches "struct X")))
+              (BNot (BIf (SelectDecl $ DeclNameMatches "struct Y")))
+
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["dependsOnXAndY"]
+
+test_selection_omit_external_a :: TestCase
+test_selection_omit_external_a =
+    defaultTest "program-analysis/selection_omit_external_a"
+      & #specExternal .~ ["test-artefacts/headers/golden/program-analysis/selection_omit_external.yaml"]
+      & #onFrontend .~ ( #programSlicing .~ EnableProgramSlicing )
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchResolveBindingSpecs (ResolveBindingSpecsOmittedType declId) ->
+              Just $ Expected declId.name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct Omitted"]
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1361>
+-- We should warn when we create bindings for a declaration omitted by an
+-- /external/ binding specification.
+test_selection_omit_external_b :: TestCase
+test_selection_omit_external_b =
+    defaultTest "program-analysis/selection_omit_external_b"
+      & #specExternal .~ ["test-artefacts/headers/golden/program-analysis/selection_omit_external.yaml"]
+      & #onFrontend   .~ ( #programSlicing .~  EnableProgramSlicing )
+
+test_selection_omit_prescriptive :: TestCase
+test_selection_omit_prescriptive =
+    defaultTest "program-analysis/selection_omit_prescriptive"
+      & #specPrescriptive .~ Just "test-artefacts/headers/golden/program-analysis/selection_omit_prescriptive.yaml"
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name (MatchTransMissing{}) ->
+              Just $ Expected (name, "select")
+            MatchUnusable name (UnusableMangleNamesFailure (MangleNamesResolutionError ResolveNamesUnderlyingDeclNotMangled{})) ->
+              Just $ Expected (name, "mangle")
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+          ("struct DirectlyDependsOnOmitted",   "mangle")
+        , ("struct DirectlyDependsOnOmitted",   "select")
+        , ("struct IndirectlyDependsOnOmitted", "select")
+        ]
+
+test_selection_squash :: TestCase
+test_selection_squash =
+    defaultTest "program-analysis/selection_squash_typedef"
+      & #tracePredicate .~ multiTracePredicate declsWithMsgs (\case
+            MatchSelect name (MatchTransMissing [MatchTransNotSelected]) ->
+              Just $ Expected name
+            _otherwise ->
+              Nothing
+          )
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["typedef_to_struct_a"]
+
+{-------------------------------------------------------------------------------
+  Typedef analysis
+-------------------------------------------------------------------------------}
+
+-- | Locally resolvable typedef/tag clashes: squashing and suffixing.
+--
+-- See also 'test_typedef_block' (the @-fblocks@ path) and
+-- 'test_typedef_name_clash' (clashes that are /not/ locally
+-- resolvable and are reported as failures).
+test_typedef_analysis :: TestCase
+test_typedef_analysis =
+    testTraceMulti "program-analysis/typedef_analysis" declsWithMsgs $ \case
+      MatchSelect name SelectMangleNamesSquashed{} ->
+        Just $ Expected (name, Nothing)
+      MatchMangle name (MangleNamesAssignedName new) ->
+        Just $ Expected (name, Just new.text)
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [(C.DeclName, Maybe Text)]
+    declsWithMsgs = [
+          ("struct struct1"  , Just "Struct1_t")
+        , ("struct1_t"       , Nothing)
+        , ("struct struct2"  , Just "Struct2_t")
+        , ("struct2_t"       , Nothing)
+        , ("struct struct3"  , Just "Struct3_t")
+        , ("struct3_t"       , Nothing)
+        , ("struct struct4"  , Just "Struct4_t")
+        , ("struct4_t"       , Nothing)
+        , ("struct struct6a" , Just "Struct6a_struct")
+        , ("struct struct6b" , Just "Struct6b_struct")
+        , ("struct8"         , Nothing)
+        , ("struct9"         , Nothing)
+        , ("struct struct10" , Just "Struct10_t")
+        , ("struct10_t"      , Nothing)
+        , ("struct struct11" , Just "Struct11_t")
+        , ("struct11_t"      , Nothing)
+        , ("struct struct12" , Just "Struct12_t")
+        , ("struct12_t"      , Nothing)
+          -- Tagged types referenced (and clashing by name) inside a
+          -- function-pointer typedef: suffixed via the return type ('foo') and
+          -- via an argument type ('bar').
+        , ("struct foo"      , Just "Foo_struct")
+        , ("struct bar"      , Just "Bar_struct")
+          -- A 'const' qualifier is transparent: the tagged type underneath
+          -- keeps its directness. Example 15 is a same-name direct alias and is
+          -- squashed (like example 8); in example 16 the qualifier wraps a
+          -- pointer, so the eponymous tag is reached through indirection and
+          -- suffixed (like example 6a).
+        , ("struct15"        , Nothing)
+        , ("struct struct16" , Just "Struct16_struct")
+        ]
+
+-- | Exercise the 'C.TypeBlock' path in 'taggedPayloads'.
+--
+-- Kept separate from 'test_typedef_analysis' because this
+-- header requires @-fblocks@.
+test_typedef_block :: TestCase
+test_typedef_block =
+    testTraceMulti "program-analysis/typedef_block" declsWithMsgs (\case
+          MatchMangle name (MangleNamesAssignedName new) ->
+            Just $ Expected (name, new.text)
+          _otherwise ->
+            Nothing
+        )
+      & #onBoot .~ ( #clangArgs % #enableBlocks .~ True )
+  where
+    declsWithMsgs :: [(C.DeclName, Text)]
+    declsWithMsgs = [
+          ("struct blk"    , "Blk_struct")
+        , ("struct blkarg" , "Blkarg_struct")
+        ]
+
+-- | Clash cases that the typedef analysis deliberately does NOT resolve
+-- locally; both colliding declarations are deselected via 'DetectClashesCollision'.
+--
+-- Complements 'test_typedef_analysis', which covers the cases
+-- that /are/ locally resolvable.
+test_typedef_name_clash :: TestCase
+test_typedef_name_clash =
+    testTraceMulti "program-analysis/typedef_name_clash" declsWithMsgs $ \case
+      MatchUnusable name (UnusableMangleNamesFailure (MangleNamesCollisionError DetectClashesCollision{})) ->
+        Just $ Expected (name, "collision")
+      MatchSelect name (TransitiveDependenciesMissing{}) ->
+        Just $ Expected (name, "transitivity")
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+          ("struct a_unrelated" , "collision")
+        , ("a_unrelated"        , "collision")
+        , ("struct a_fun"       , "collision")
+        , ("a_fun"              , "collision")
+        , ("struct b_clash"     , "collision")
+        , ("struct b_other"     , "collision")
+        , ("b_clash"            , "transitivity")
+        ]
+
+-- | The deterministic disambiguation suffix (@_struct@\/@_union@\/@_enum@) is
+-- never counter-disambiguated, so it can itself collide with an
+-- independently-named declaration. When it does, the name-mangler's collision
+-- check deselects /both/ colliding declarations (it does not invent a
+-- @_struct2@); the eponymous typedef then loses its dropped dependency.
+--
+-- Complements 'test_typedef_analysis' (the suffix in isolation)
+-- and 'test_typedef_name_clash' (clashes with no suffix
+-- involved).
+test_typedef_suffix_clash :: TestCase
+test_typedef_suffix_clash =
+    testTraceMulti "program-analysis/typedef_suffix_clash" declsWithMsgs $ \case
+      MatchUnusable name (UnusableMangleNamesFailure (MangleNamesCollisionError DetectClashesCollision{})) ->
+        Just $ Expected (name, "collision")
+      MatchSelect name (TransitiveDependenciesMissing{}) ->
+        Just $ Expected (name, "transitivity")
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [(C.DeclName, String)]
+    declsWithMsgs = [
+          -- Suffixed 'struct sfx' (Sfx_struct) vs real 'struct sfx_struct'.
+          ("struct sfx"        , "collision")
+        , ("struct sfx_struct" , "collision")
+        , ("sfx"               , "transitivity")
+          -- Suffixed 'union u' (U_union) vs real 'struct u_union'.
+        , ("union u"           , "collision")
+        , ("struct u_union"    , "collision")
+        , ("u"                 , "transitivity")
+        ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Golden/Types.hs b/test/hs-bindgen/Test/HsBindgen/Golden/Types.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Golden/Types.hs
@@ -0,0 +1,371 @@
+-- | Golden tests: types
+module Test.HsBindgen.Golden.Types (testCases) where
+
+import System.FilePath ((<.>), (</>))
+
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Config.Internal
+import HsBindgen.Frontend.Analysis.DeclIndex (UnusableReason (..))
+import HsBindgen.Frontend.Pass.MangleNames.Error
+import HsBindgen.Frontend.Pass.Parse.Msg
+import HsBindgen.Frontend.Pass.Select.IsPass
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.TraceMsg
+
+import Test.Common.HsBindgen.Trace.Patterns
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Test cases
+-------------------------------------------------------------------------------}
+
+testCases :: [TestCase]
+testCases = [
+      -- Default tests
+      defaultTest "types/anonymous/edge-cases/anon_in_nonanon"
+    , defaultTest "types/anonymous/edge-cases/bitfield"
+    , defaultTest "types/anonymous/edge-cases/duplicate_field_names"
+    , defaultTest "types/anonymous/edge-cases/padding"
+    , defaultTest "types/anonymous/struct_in_struct"
+    , defaultTest "types/anonymous/struct_in_union"
+    , defaultTest "types/anonymous/struct"
+    , defaultTest "types/anonymous/union_in_struct"
+    , defaultTest "types/anonymous/union_in_union"
+    , defaultTest "types/anonymous/union"
+    , defaultTest "types/complex/complex_non_float_test"
+    , defaultTest "types/complex/hsb_complex_test"
+    , defaultTest "types/complex/vector_test"
+    , defaultTest "types/enums/enum_cpp_syntax"
+    , defaultTest "types/enums/enum_unsigned_values"
+    , defaultTest "types/enums/enums"
+    , defaultTest "types/enums/nested_enums"
+    , defaultTest "types/enums/untagged_enum_toplevel"
+    , defaultTest "types/nested/nested_types"
+    , defaultTest "types/primitives/bool"
+    , defaultTest "types/primitives/fixedwidth"
+    , defaultTest "types/primitives/primitive_insts"
+    , defaultTest "types/primitives/primitive_types"
+    , defaultTest "types/qualifiers/const_typedefs"
+    , defaultTest "types/qualifiers/type_qualifiers"
+    , defaultTest "types/structs/circular_dependency_struct"
+    , defaultTest "types/structs/padding"
+    , defaultTest "types/structs/recursive_struct"
+    , defaultTest "types/structs/simple_structs"
+    , defaultTest "types/structs/struct_arg"
+    , defaultTest "types/structs/untagged"
+    , defaultTest "types/typedefs/auxiliary/function-pointer/array"
+    , defaultTest "types/typedefs/auxiliary/function-pointer/direct"
+    , defaultTest "types/typedefs/auxiliary/function-pointer/multi_level"
+    , defaultTest "types/typedefs/auxiliary/function-pointer/pointer"
+    , defaultTest "types/typedefs/auxiliary/function-pointer/qual"
+    , defaultTest "types/typedefs/typedef_vs_macro"
+    , defaultTest "types/unions/bitfields"
+    , defaultTest "types/unions/nested_unions"
+    , defaultTest "types/unions/unions"
+    ]
+      -- Indirect fields
+    ++ test_indirect_fields
+    ++ [
+      -- Bespoke tests
+      test_anonymous_edge_cases_drop_indirect_fields_1
+    , test_anonymous_edge_cases_drop_indirect_fields_2
+    , test_anonymous_edge_cases_empty_anon
+    , test_anonymous_edge_cases_multi_nesting
+    , test_anonymous_edge_cases_multi_nesting_omit_field_prefixes
+    , test_anonymous_edge_cases_reparse
+    , test_long_double
+    , test_primitives_bool_c23
+    , test_primitives_bool_macro_override
+    , test_primitives_bool_typedef_override
+    , test_primitives_least_fast
+    , test_scoping_deep_nesting
+    , test_scoping_nesting
+    , test_scoping_wide_nesting
+    , test_small_floats
+    , test_special_parse_failure_long_double
+    , test_structs_bitfields
+    , test_structs_omit_field_prefixes
+    , test_structs_post_qualified
+    , test_structs_tagged_vs_untagged
+    , test_structs_untagged_struct
+    , test_typedefs_auxiliary_function_pointer_block
+    , test_typedefs_typedefs
+    , test_typedefs_typenames
+    ]
+
+{-------------------------------------------------------------------------------
+  Indirect fields
+-------------------------------------------------------------------------------}
+
+-- | Tests related to indirect fields
+--
+-- Indirect fields are handled the same for structs as for unions, so it does
+-- not matter whether we nest structs or unions or a combination of them. We
+-- arbitrarily decided to use structs in these test headers.
+test_indirect_fields :: [TestCase]
+test_indirect_fields = [
+      defaultTest "types/anonymous/indirect-fields/multi_nesting_enum_tagged"
+    , defaultTest "types/anonymous/indirect-fields/multi_nesting_enum_untagged"
+    , defaultTest "types/anonymous/indirect-fields/multi_nesting_struct_tagged"
+    , defaultTest "types/anonymous/indirect-fields/multi_nesting_struct_untagged"
+    , defaultTest "types/anonymous/indirect-fields/multi_nesting_union_tagged"
+    , defaultTest "types/anonymous/indirect-fields/multi_nesting_union_untagged"
+    , defaultTest "types/anonymous/indirect-fields/single_nesting_enum_tagged"
+    , defaultTest "types/anonymous/indirect-fields/single_nesting_enum_untagged"
+    , defaultTest "types/anonymous/indirect-fields/single_nesting_struct_tagged"
+    , defaultTest "types/anonymous/indirect-fields/single_nesting_struct_untagged"
+    , defaultTest "types/anonymous/indirect-fields/single_nesting_union_tagged"
+    , defaultTest "types/anonymous/indirect-fields/single_nesting_union_untagged"
+    ]
+
+{-------------------------------------------------------------------------------
+  Individual test definitions
+-------------------------------------------------------------------------------}
+
+-- | Test that indirect fields are dropped if they would cross an external
+-- binding spec abstraction boundary
+test_anonymous_edge_cases_drop_indirect_fields_1 :: TestCase
+test_anonymous_edge_cases_drop_indirect_fields_1 =
+    defaultTest "types/anonymous/edge-cases/drop_indirect_fields"
+      & #name %~ (++ "_1")
+      & #outputDir %~ (++ "_1")
+      & #specExternal .~
+          [ "test-artefacts/headers/golden"
+            </> "types/anonymous/edge-cases/drop_indirect_fields_1"
+            <.> "ext" <.> "yaml"
+          ]
+      & #tracePredicate .~ multiTracePredicate expected trace
+  where
+    expected :: [(C.DeclName, C.ScopedName)]
+    expected = [
+        ("struct S", "x")
+      , ("struct S", "y")
+      , ("struct S_anon'anon'x", "x")
+      , ("struct S_anon'anon'x", "y")
+      ]
+
+    trace :: TraceMsg -> Maybe (TraceExpectation (C.DeclName, C.ScopedName))
+    trace = \case
+      MatchResolveBindingSpecs (ResolveBindingSpecsIndirectFieldDropped cDeclId cFieldName) ->
+        Just $ Expected (cDeclId.name, cFieldName)
+      _otherwise ->
+        Nothing
+
+-- | Test that indirect fields are dropped if they would cross an external
+-- binding spec abstraction boundary
+test_anonymous_edge_cases_drop_indirect_fields_2 :: TestCase
+test_anonymous_edge_cases_drop_indirect_fields_2 =
+    defaultTest "types/anonymous/edge-cases/drop_indirect_fields"
+      & #name %~ (++ "_2")
+      & #outputDir %~ (++ "_2")
+      & #specExternal .~
+          [ "test-artefacts/headers/golden"
+            </> "types/anonymous/edge-cases/drop_indirect_fields_2"
+            <.> "ext" <.> "yaml"
+          ]
+      & #tracePredicate .~ multiTracePredicate expected trace
+  where
+    expected :: [(C.DeclName, C.ScopedName)]
+    expected = [
+        ("struct S", "x")
+      , ("struct S", "y")
+      , ("struct S", "z")
+      ]
+
+    trace :: TraceMsg -> Maybe (TraceExpectation (C.DeclName, C.ScopedName))
+    trace = \case
+      MatchResolveBindingSpecs (ResolveBindingSpecsIndirectFieldDropped cDeclId cFieldName) ->
+        Just $ Expected (cDeclId.name, cFieldName)
+      _otherwise ->
+        Nothing
+
+test_anonymous_edge_cases_empty_anon :: TestCase
+test_anonymous_edge_cases_empty_anon =
+    testTraceMulti "types/anonymous/edge-cases/empty_anon" declsWithMsgs $ \case
+      MatchDelayedImplicitField "struct S1" UnsupportedEmptyAnon ->
+        Just $ Expected "struct S1"
+      MatchDelayed "struct S2" ParseNestedDeclsFailed ->
+        Just $ Expected "struct S2"
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct S1", "struct S2"]
+
+test_anonymous_edge_cases_multi_nesting :: TestCase
+test_anonymous_edge_cases_multi_nesting =
+    defaultTest "types/anonymous/edge-cases/multi_nesting"
+
+test_anonymous_edge_cases_multi_nesting_omit_field_prefixes :: TestCase
+test_anonymous_edge_cases_multi_nesting_omit_field_prefixes =
+    testVariant "types/anonymous/edge-cases/multi_nesting" Nothing "omit_field_prefixes"
+      & #onFrontend .~ ( #fieldNamingStrategy .~ OmitFieldPrefixes )
+
+-- | Test that indirect fields are reparsed
+test_anonymous_edge_cases_reparse :: TestCase
+test_anonymous_edge_cases_reparse =
+    defaultTest "types/anonymous/edge-cases/reparse"
+
+test_long_double :: TestCase
+test_long_double =
+    testTraceSimple "types/special/long_double" $ \case
+      MatchDelayed _name (ParseUnsupportedFloatType UnsupportedLongDouble) ->
+        Just $ Expected ()
+      _otherwise ->
+        Nothing
+
+test_primitives_bool_c23 :: TestCase
+test_primitives_bool_c23 =
+    defaultTest "types/primitives/bool_c23"
+      & #clangVersion .~ Just (>= (15, 0, 0))
+      & #cStandard    .~ c23
+
+-- | Test that when @bool@ is given a definition (via @#define@), it is /not/
+-- parsed as @PrimBool@ by @language-c@.
+test_primitives_bool_macro_override :: TestCase
+test_primitives_bool_macro_override =
+    defaultTest "types/primitives/bool_macro_override"
+      & #clangVersion .~ Just (>= (15, 0, 0))
+      & #cStandard    .~ c23
+
+-- | Test that when @bool@ is given a definition (via @typedef@), it is /not/
+-- parsed as @PrimBool@ by @language-c@.
+test_primitives_bool_typedef_override :: TestCase
+test_primitives_bool_typedef_override =
+    defaultTest "types/primitives/bool_typedef_override"
+
+test_primitives_least_fast :: TestCase
+test_primitives_least_fast =
+    defaultTest "types/primitives/least_fast"
+      & #onFrontend .~ ( #programSlicing .~ EnableProgramSlicing )
+
+test_scoping_deep_nesting :: TestCase
+test_scoping_deep_nesting =
+    testTraceMulti "types/scoping/deep_nesting" declsWithMsgs $ \case
+      MatchDelayed name@"struct foo" ParseNestedDeclsFailed ->
+        Just $ Expected name
+      MatchDelayed name@"struct bar"
+        (ParseUnsupportedFloatType UnsupportedLongDouble) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct foo", "struct bar"]
+
+test_scoping_nesting :: TestCase
+test_scoping_nesting =
+    testTraceMulti "types/scoping/nesting" declsWithMsgs $ \case
+      MatchDelayed name@"struct foo"
+        (ParseUnsupportedFloatType UnsupportedLongDouble) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct foo"]
+
+test_scoping_wide_nesting :: TestCase
+test_scoping_wide_nesting =
+    testTraceMulti "types/scoping/wide_nesting" declsWithMsgs $ \case
+      MatchDelayed name@"struct foo" ParseNestedDeclsFailed ->
+        Just $ Expected name
+      MatchDelayed name@"struct bar"
+        (ParseUnsupportedFloatType UnsupportedLongDouble) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["struct foo", "struct bar"]
+
+-- | Test that small floating-point types are unsupported, but do not crash us
+--
+-- Clang only supports @_Float16@ on x86 since version 15.
+test_small_floats :: TestCase
+test_small_floats =
+    testTraceMulti "types/special/small_floats" declsWithMsgs (\case
+      MatchDelayed name (ParseUnsupportedFloatType UnsupportedFloat16) ->
+        Just $ Expected name
+      MatchDelayed name (ParseUnsupportedFloatType UnsupportedHalf) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing)
+      & #clangVersion .~ Just (>= (15, 0, 0))
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["float16_t", "fp16_t", "struct small_floats", "fun"]
+
+test_special_parse_failure_long_double :: TestCase
+test_special_parse_failure_long_double =
+    testTraceMulti "types/special/parse_failure_long_double" declsWithMsgs $ \case
+      MatchDelayed name (ParseUnsupportedFloatType UnsupportedLongDouble) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["fun1", "struct struct1"]
+
+test_structs_tagged_vs_untagged :: TestCase
+test_structs_tagged_vs_untagged =
+    defaultTest "types/structs/tagged_vs_untagged"
+      & #clangVersion .~ Just (>= (19, 1, 0))
+
+test_structs_bitfields :: TestCase
+test_structs_bitfields =
+    defaultTest "types/structs/bitfields"
+      & #cStandard .~ c99  -- C99 required for inline functions
+
+test_structs_omit_field_prefixes :: TestCase
+test_structs_omit_field_prefixes =
+    testVariant "types/structs/simple_structs" Nothing "omit_field_prefixes"
+      & #onFrontend .~ ( #fieldNamingStrategy .~ OmitFieldPrefixes )
+
+test_structs_post_qualified :: TestCase
+test_structs_post_qualified =
+    testVariant "types/structs/simple_structs" Nothing "post_qualified"
+      & #qualifiedStyle .~ PostQualified
+
+test_structs_untagged_struct :: TestCase
+test_structs_untagged_struct =
+    testTraceSimple "types/structs/untagged_struct" $ \case
+      MatchDiagnosticCategory "Semantic Issue" ->
+        Just $ Expected ()
+      MatchNoDeclarations ->
+        Just $ Tolerated
+      _otherwise ->
+        Nothing
+
+test_typedefs_auxiliary_function_pointer_block :: TestCase
+test_typedefs_auxiliary_function_pointer_block =
+    defaultTest "types/typedefs/auxiliary/function-pointer/block"
+      & #clangVersion .~ Just (>= (15, 0, 0))
+      & #cStandard    .~ c23
+      & #onBoot       .~ ( #clangArgs % #enableBlocks .~ True )
+
+test_typedefs_typedefs :: TestCase
+test_typedefs_typedefs =
+    testTraceMulti "types/typedefs/typedefs" declsWithMsgs $ \case
+      MatchDelayed name ParseFunctionOfTypeTypedef ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["foo"]
+
+-- This tests https://github.com/well-typed/hs-bindgen/issues/1389.
+test_typedefs_typenames :: TestCase
+test_typedefs_typenames =
+    testTraceMulti "types/typedefs/typenames" declsWithMsgs $ \case
+      MatchUnusable name (UnusableMangleNamesFailure (MangleNamesCollisionError DetectClashesCollision{})) ->
+        Just $ Expected name
+      _otherwise ->
+        Nothing
+  where
+    declsWithMsgs :: [C.DeclName]
+    declsWithMsgs = ["enum foo", "foo"]
diff --git a/test/hs-bindgen/Test/HsBindgen/Integration/ExitCode.hs b/test/hs-bindgen/Test/HsBindgen/Integration/ExitCode.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Integration/ExitCode.hs
@@ -0,0 +1,106 @@
+module Test.HsBindgen.Integration.ExitCode (tests) where
+
+import Control.Exception (Exception (..), SomeException, handle)
+import System.Exit (ExitCode (..))
+import System.FilePath ((</>))
+import System.IO.Temp (withSystemTempDirectory)
+import System.Process (readProcessWithExitCode)
+import Test.Tasty
+import Test.Tasty.HUnit
+
+import HsBindgen.Artefact (Artefact (..))
+import HsBindgen.Clang (LibclangException)
+import HsBindgen.Imports
+
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Golden.Infra.TestCase
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: IO TestResources -> TestTree
+tests getTestResources = testGroup "Integration.ExitCode" [
+    testSuccessCase        getTestResources
+  , testUnresolvedInclude  getTestResources
+  , testSuccessCaseProcess getTestResources
+  , testUnresolvedIncludeProcess
+  ]
+
+-- | Test that should complete successfully
+testSuccessCase :: IO TestResources -> TestTree
+testSuccessCase getTestResources = testCase "success does not throw" $ do
+  let test =
+        defaultTest "functions/simple_func"
+          & #cStandard .~ c99
+      noReport = const $ pure ()
+  void $ runTestHsBindgenSuccess noReport getTestResources test FinalDecls
+
+-- | Test unresolved #include (issue #1197 scenario)
+--
+-- Should fail
+testUnresolvedInclude :: IO TestResources -> TestTree
+testUnresolvedInclude getTestResources = testCase "unresolved include throws exception" $ do
+  withSystemTempDirectory "hs-bindgen-test" $ \tmpDir -> do
+    let tempHeader = tmpDir </> "test-unresolved.h"
+    writeFile tempHeader "#include <nonexistent/totally-bogus-header-12345.h>\n"
+
+    let test =
+          -- Tolerate all traces - we want to test exception propagation
+          defaultFailingTest "test-unresolved"
+            & #inputDir       .~ tmpDir
+            & #tracePredicate .~ tolerateAll
+
+        noReport :: a -> IO ()
+        noReport = const $ pure ()
+
+        expectLibclangException :: SomeException -> IO ()
+        expectLibclangException e = case fromException e of
+          Just (_ :: LibclangException) -> pure ()
+          _                             -> throwIO e
+
+    handle expectLibclangException $ do
+      eRes <- runTestHsBindgen noReport getTestResources test FinalDecls
+      assertFailure $ mconcat [
+          "expected hs-bindgen to fail early, "
+        , "but it finished with the following result:\n"
+        , show eRes
+        ]
+
+-- | Test that actual process exit code
+testSuccessCaseProcess :: IO TestResources -> TestTree
+testSuccessCaseProcess getTestResources = testCase "success returns exit code 0" $ do
+  withSystemTempDirectory "hs-bindgen-test" $ \tmpDir -> do
+    root <- (.packageRoot) <$> getTestResources
+    let headerPath = root </> "test-artefacts/headers/golden/functions/simple_func.h"
+    (exitCode, _, _) <- readProcessWithExitCode "hs-bindgen-cli"
+                                               [ "preprocess"
+                                               , "--create-output-dirs"
+                                               , "--overwrite-files"
+                                               , "--hs-output-dir"
+                                               , tmpDir
+                                               , headerPath
+                                               ]
+                                               ""
+    exitCode @?= ExitSuccess
+
+-- | Test unresolved #include (the original issue scenario)
+testUnresolvedIncludeProcess :: TestTree
+testUnresolvedIncludeProcess = testCase "unresolved include returns non-zero" $ do
+  withSystemTempDirectory "hs-bindgen-test" $ \tmpDir -> do
+    -- Create a temporary header with unresolved include
+    let tempHeader = tmpDir </> "test-unresolved-include.h"
+    writeFile tempHeader "#include <nonexistent/totally-bogus-header-12345.h>\n"
+    (exitCode, _, _) <- readProcessWithExitCode "hs-bindgen-cli"
+                                               [ "preprocess"
+                                               , "--create-output-dirs"
+                                               , "--overwrite-files"
+                                               , "--hs-output-dir"
+                                               , tmpDir
+                                               , tempHeader
+                                               ]
+                                               ""
+    -- We specifically test for exit code 3 here; it means that the `hs-bindgen`
+    -- invocation of `libclang` has failed.
+    exitCode @?= ExitFailure 3
diff --git a/test/hs-bindgen/Test/HsBindgen/Integration/OverwritePolicy.hs b/test/hs-bindgen/Test/HsBindgen/Integration/OverwritePolicy.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Integration/OverwritePolicy.hs
@@ -0,0 +1,118 @@
+module Test.HsBindgen.Integration.OverwritePolicy (tests) where
+
+import System.Directory (createDirectory, doesFileExist)
+import System.Exit (ExitCode (..))
+import System.FilePath ((</>))
+import System.IO.Temp (withSystemTempDirectory)
+import System.Process (readProcessWithExitCode)
+import Test.Tasty
+import Test.Tasty.HUnit
+
+import Test.HsBindgen.Resources
+
+tests :: IO TestResources -> TestTree
+tests getTestResources = testGroup "Integration.OverwritePolicy" [
+    testDirPolicy                 getTestResources
+  , testFilePolicy                getTestResources
+  , testOverwritePolicies         getTestResources
+  , testBindingSpecCreateDirs     getTestResources
+  , testBindingSpecNoDirByDefault getTestResources
+  ]
+
+testDirPolicy :: IO TestResources -> TestTree
+testDirPolicy getTestResources = testCase "do not create output directory by default" $ do
+  withSystemTempDirectory "hs-bindgen-test" $ \tmpDir -> do
+    root <- (.packageRoot) <$> getTestResources
+    let headerPath = root </> "test-artefacts/headers/golden/functions/simple_func.h"
+        outDir = tmpDir </> "src"
+    (exitCode, _, _) <- readProcessWithExitCode "hs-bindgen-cli"
+                                               [ "preprocess"
+                                               , "--hs-output-dir"
+                                               , outDir
+                                               , headerPath
+                                               ]
+                                               ""
+    -- We specifically test for exit code 4 here; it means that `hs-bindgen` ran
+    -- to completion, but an error has ocurred.
+    exitCode @?= ExitFailure 4
+
+testFilePolicy :: IO TestResources -> TestTree
+testFilePolicy getTestResources = testCase "do not overwrite existing files by default" $ do
+  withSystemTempDirectory "hs-bindgen-test" $ \tmpDir -> do
+    root <- (.packageRoot) <$> getTestResources
+    let headerPath = root </> "test-artefacts/headers/golden/functions/simple_func.h"
+    -- Create a file that would be overwritten.
+    createDirectory $ tmpDir </> "Generated"
+    writeFile (tmpDir </> "Generated/Safe.hs") "Placeholder file"
+    (exitCode, _, _) <- readProcessWithExitCode "hs-bindgen-cli"
+                                               [ "preprocess"
+                                               , "--create-output-dirs"
+                                               , "--hs-output-dir"
+                                               , tmpDir
+                                               , headerPath
+                                               ]
+                                               ""
+    -- We specifically test for exit code 4 here; it means that `hs-bindgen` ran
+    -- to completion, but an error has ocurred.
+    exitCode @?= ExitFailure 4
+
+testOverwritePolicies :: IO TestResources -> TestTree
+testOverwritePolicies getTestResources = testCase "create directories and overwrite files if told by user" $ do
+  withSystemTempDirectory "hs-bindgen-test" $ \tmpDir -> do
+    root <- (.packageRoot) <$> getTestResources
+    let headerPath         = root </> "test-artefacts/headers/golden/functions/simple_func.h"
+        placeholderPath    = tmpDir </> "Generated/Safe.hs"
+        placeholderContent =  "Placeholder file"
+    -- Create a file that will be overwritten.
+    createDirectory $ tmpDir </> "Generated"
+    writeFile placeholderPath placeholderContent
+    (exitCode, _, _) <- readProcessWithExitCode "hs-bindgen-cli"
+                                               [ "preprocess"
+                                               , "--create-output-dirs"
+                                               , "--overwrite-files"
+                                               , "--hs-output-dir"
+                                               , tmpDir
+                                               , headerPath
+                                               ]
+                                               ""
+    exitCode @?= ExitSuccess
+    -- Check that the placeholder file content has changed.
+    content <- readFile placeholderPath
+    assertBool "placeholder content has changed" (content /= placeholderContent)
+
+testBindingSpecCreateDirs :: IO TestResources -> TestTree
+testBindingSpecCreateDirs getTestResources = testCase "--create-output-dirs creates dirs for --gen-binding-spec" $ do
+  withSystemTempDirectory "hs-bindgen-test" $ \tmpDir -> do
+    root <- (.packageRoot) <$> getTestResources
+    let headerPath      = root </> "test-artefacts/headers/golden/functions/simple_func.h"
+        bindingSpecPath = tmpDir </> "specs" </> "binding-spec.yaml"
+    (exitCode, _, _) <- readProcessWithExitCode "hs-bindgen-cli"
+                                               [ "preprocess"
+                                               , "--create-output-dirs"
+                                               , "--hs-output-dir"
+                                               , tmpDir
+                                               , "--gen-binding-spec"
+                                               , bindingSpecPath
+                                               , headerPath
+                                               ]
+                                               ""
+    exitCode @?= ExitSuccess
+    exists <- doesFileExist bindingSpecPath
+    assertBool "binding spec file was created" exists
+
+testBindingSpecNoDirByDefault :: IO TestResources -> TestTree
+testBindingSpecNoDirByDefault getTestResources = testCase "do not create --gen-binding-spec directory by default" $ do
+  withSystemTempDirectory "hs-bindgen-test" $ \tmpDir -> do
+    root <- (.packageRoot) <$> getTestResources
+    let headerPath      = root </> "test-artefacts/headers/golden/functions/simple_func.h"
+        bindingSpecPath = tmpDir </> "specs" </> "binding-spec.yaml"
+    (exitCode, _, _) <- readProcessWithExitCode "hs-bindgen-cli"
+                                               [ "preprocess"
+                                               , "--hs-output-dir"
+                                               , tmpDir
+                                               , "--gen-binding-spec"
+                                               , bindingSpecPath
+                                               , headerPath
+                                               ]
+                                               ""
+    exitCode @?= ExitFailure 4
diff --git a/test/hs-bindgen/Test/HsBindgen/Macro/CExpr.hs b/test/hs-bindgen/Test/HsBindgen/Macro/CExpr.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Macro/CExpr.hs
@@ -0,0 +1,80 @@
+-- | Tests for the glue between 'splitMacro' and @c-expr-dsl@
+--
+-- 'HsBindgen.Macro.cExpr' assembles a @c-expr-dsl@ macro from the split that
+-- 'HsBindgen.Macro.Syntax.splitMacro' produced and the body that
+-- @C.Expr.Parse.parseMacroBody@ parsed. These tests pin the two conventions the
+-- glue owns: the order of the parameters, and what happens to a variadic macro.
+module Test.HsBindgen.Macro.CExpr (tests) where
+
+import Data.Foldable (toList)
+import DeBruijn (idxToInt)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (Assertion, assertFailure, testCase, (@=?))
+
+import C.Expr.Syntax qualified as CExpr
+
+import Clang.CStandard (CStandard (C17), ClangCStandard (ClangCStandard),
+                        Gnu (DisableGnu))
+
+import HsBindgen.Macro (cExpr)
+import HsBindgen.Macro.Error (MacroParseError (..))
+import HsBindgen.Macro.Interface qualified as Macro
+import HsBindgen.Macro.Syntax (splitMacro)
+
+import Test.HsBindgen.Macro.Infra
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Macro.CExpr" [
+      testCase "#define CONST(X, Y) X" sourceOrder
+    , testCase "#define VA(...) 0" variadicDeclined
+    ]
+
+-- | Parameters reach @c-expr-dsl@ in source order
+--
+-- The glue passes them in source order and @parseMacroBody@ reverses them
+-- internally, so the /last/ parameter is the innermost binder: in
+-- @CONST(X, Y)@, the body @X@ is de Bruijn index 1, not 0. Nothing else states
+-- this, and it silently swaps the arguments of every function-like macro if it
+-- changes.
+sourceOrder :: Assertion
+sourceOrder =
+    case parse [ ident "CONST", punc "(", ident "X", punc ",", spc, ident "Y"
+               , punc ")", spc, ident "X"
+               ] of
+      Left err -> assertFailure err.macroParseError
+      Right CExpr.Macro{CExpr.macroParams = params, CExpr.macroExpr = body} -> do
+        ["X", "Y"] @=? toList params
+        case body of
+          CExpr.Term (CExpr.LocalParam idx) -> 1 @=? idxToInt idx
+          other -> assertFailure $
+            "expected a reference to a parameter, but got " ++ show other
+
+-- | A variadic macro is declined, with an explanation
+--
+-- @CExpr.Macro@ has no representation for @...@; without the check,
+-- @__VA_ARGS__@ would parse as a free variable and the macro would translate to
+-- something that quietly ignores the variadic arguments.
+variadicDeclined :: Assertion
+variadicDeclined =
+    case parse [ident "VA", punc "(", punc "...", punc ")", spc, lit "0"] of
+      Left err   -> "variadic macros are not supported" @=? err.macroParseError
+      Right mcro -> assertFailure $
+        "expected the macro to be declined, but got " ++ show mcro
+
+{-------------------------------------------------------------------------------
+  Auxiliary
+-------------------------------------------------------------------------------}
+
+-- | Split the pieces and hand the result to the @CExpr@ macro language
+parse :: [Piece] -> Either MacroParseError (CExpr.Macro ())
+parse pieces = do
+    raw    <- splitMacro (layout pieces)
+    parsed <- (cExpr cStd).parse raw
+    pure parsed.unwrap
+  where
+    cStd :: ClangCStandard
+    cStd = ClangCStandard C17 DisableGnu
diff --git a/test/hs-bindgen/Test/HsBindgen/Macro/Infra.hs b/test/hs-bindgen/Test/HsBindgen/Macro/Infra.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Macro/Infra.hs
@@ -0,0 +1,149 @@
+-- | Test infrastructure for the macro parsers
+--
+-- Builds @libclang@ token streams without running @libclang@: a macro
+-- definition is written as a list of 'Piece's, which 'layout' turns into tokens
+-- with the extents they would have in a source file.
+--
+-- The extents matter: 'HsBindgen.Macro.Syntax.splitMacro' tells a function-like
+-- macro from an object-like one by looking for white space before the @(@, so
+-- 'spc' is part of the input, not decoration.
+module Test.HsBindgen.Macro.Infra (
+    -- * Pieces of a macro definition
+    Piece
+  , comment
+  , ident
+  , kw
+  , lit
+  , punc
+  , spc
+    -- * Laying out tokens
+  , layout
+  , extentOf
+  ) where
+
+import Data.List.NonEmpty (NonEmpty ((:|)))
+import Data.List.NonEmpty qualified as NE
+import Data.Text (Text)
+import Data.Text qualified as Text
+
+import Clang.Enum.Simple (simpleEnum)
+import Clang.HighLevel.Types (MultiLoc (..), Range (..), SingleLoc (..),
+                              SourcePath, Token (..), TokenSpelling (..))
+import Clang.LowLevel.Core (CXCursorKind (CXCursor_UnexposedDecl),
+                            CXTokenKind (CXToken_Comment, CXToken_Identifier, CXToken_Keyword, CXToken_Literal, CXToken_Punctuation))
+
+{-------------------------------------------------------------------------------
+  Pieces of a macro definition
+-------------------------------------------------------------------------------}
+
+-- | A token of a macro definition, or the white space between two tokens
+data Piece =
+    PieceToken CXTokenKind Text
+  | PieceSpace
+
+-- | A comment
+--
+-- @libclang@ reports comments as tokens, so a comment between two tokens is not
+-- white space: it makes them non-adjacent /and/ it ends up in the body.
+comment :: Text -> Piece
+comment = PieceToken CXToken_Comment
+
+-- | An identifier
+ident :: Text -> Piece
+ident = PieceToken CXToken_Identifier
+
+-- | A C keyword
+--
+-- Which spellings @libclang@ reports as keywords rather than identifiers
+-- depends on the LLVM version and the C standard (@bool@ is the notorious one);
+-- here the classification is an input, so tests can pin either case.
+kw :: Text -> Piece
+kw = PieceToken CXToken_Keyword
+
+-- | A literal
+lit :: Text -> Piece
+lit = PieceToken CXToken_Literal
+
+-- | Punctuation
+--
+-- The spelling may contain a line continuation (@\\@ followed by a newline),
+-- which is how @libclang@ sometimes reports punctuation that a spliced line put
+-- next to the preceding token.
+punc :: Text -> Piece
+punc = PieceToken CXToken_Punctuation
+
+-- | A single space
+spc :: Piece
+spc = PieceSpace
+
+{-------------------------------------------------------------------------------
+  Laying out tokens
+-------------------------------------------------------------------------------}
+
+-- | Lay the pieces out as source text, starting at line 1, column 1
+--
+-- Each token gets the extent it would have there, ending one past its last
+-- character, as @libclang@ reports it.
+layout :: [Piece] -> [Token SourcePath TokenSpelling]
+layout = go SourceLoc{line = 1, column = 1, offset = 0}
+  where
+    go :: SourceLoc -> [Piece] -> [Token SourcePath TokenSpelling]
+    go _   []                           = []
+    go loc (PieceSpace        : pieces) = go (advance loc " ") pieces
+    go loc (PieceToken kind s : pieces) = mkToken kind s loc end : go end pieces
+      where
+        end = advance loc s
+
+-- | The extent spanned by laid-out tokens
+--
+-- 'HsBindgen.Macro.Syntax.MacroDefinition' and
+-- 'HsBindgen.Macro.Syntax.MacroInvocation' carry the range of the whole
+-- construct. No parser reads it, so any faithful range will do; an empty token
+-- list gets the start of the synthetic source.
+extentOf :: [Token SourcePath TokenSpelling] -> Range (MultiLoc SourcePath)
+extentOf = \case
+    []     -> Range start start
+    t : ts -> Range
+                (rangeStart (tokenExtent t))
+                (rangeEnd   (tokenExtent (NE.last (t :| ts))))
+  where
+    start :: MultiLoc SourcePath
+    start = multiLoc SourceLoc{line = 1, column = 1, offset = 0}
+
+-- | A location in the synthetic source text
+data SourceLoc = SourceLoc {
+      line   :: Int
+    , column :: Int
+    , offset :: Int
+    }
+
+-- | The location just past the given text, which may span lines
+advance :: SourceLoc -> Text -> SourceLoc
+advance loc text = SourceLoc {
+      line   = loc.line + Text.count "\n" text
+    , column = case Text.breakOnEnd "\n" text of
+                 ("", _)        -> loc.column + Text.length text
+                 (_, lastLine)  -> 1 + Text.length lastLine
+    , offset = loc.offset + Text.length text
+    }
+
+mkToken :: CXTokenKind -> Text -> SourceLoc -> SourceLoc -> Token SourcePath TokenSpelling
+mkToken kind spelling start end = Token {
+      tokenKind       = simpleEnum kind
+    , tokenSpelling   = TokenSpelling spelling
+    , tokenExtent     = Range (multiLoc start) (multiLoc end)
+    , tokenCursorKind = simpleEnum CXCursor_UnexposedDecl
+    }
+
+multiLoc :: SourceLoc -> (MultiLoc SourcePath)
+multiLoc loc = MultiLoc {
+      multiLocExpansion = SingleLoc {
+          singleLocPath   = "<test>"
+        , singleLocLine   = loc.line
+        , singleLocColumn = loc.column
+        , singleLocOffset = loc.offset
+        }
+    , multiLocPresumed  = Nothing
+    , multiLocSpelling  = Nothing
+    , multiLocFile      = Nothing
+    }
diff --git a/test/hs-bindgen/Test/HsBindgen/Macro/Syntax.hs b/test/hs-bindgen/Test/HsBindgen/Macro/Syntax.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Macro/Syntax.hs
@@ -0,0 +1,198 @@
+-- | Tests for 'splitMacro', the one language-independent macro parser
+--
+-- Every macro definition passes through it, so this is where the
+-- object-like\/function-like distinction, the parameter list grammar and the
+-- treatment of keywords are pinned down. The body is not interpreted here; it
+-- is returned verbatim.
+module Test.HsBindgen.Macro.Syntax (tests) where
+
+import Data.Text qualified as Text
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (Assertion, assertFailure, testCase, (@=?))
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Macro.Error (MacroParseError (..))
+import HsBindgen.Macro.Parse (spelling)
+import HsBindgen.Macro.Syntax (splitMacro)
+
+import Test.HsBindgen.Macro.Infra
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Macro.Syntax" [
+      testGroup "splitMacro" [
+          testGroup "object-like" [
+              testCase "#define FOO 1" $
+                splitsTo (Runtime.Macro.objectLike "FOO" ["1"]) [
+                    ident "FOO", spc, lit "1"
+                  ]
+            , testCase "#define FOO" $
+                splitsTo (Runtime.Macro.objectLike "FOO" []) [
+                    ident "FOO"
+                  ]
+              -- White space before the @(@ makes this object-like, with the
+              -- parentheses part of the body; see #1903.
+            , testCase "#define FOO (1)" $
+                splitsTo (Runtime.Macro.objectLike "FOO" ["(", "1", ")"]) [
+                    ident "FOO", spc, punc "(", lit "1", punc ")"
+                  ]
+            ]
+        , testGroup "function-like" [
+              testCase "#define ADD(x, y) x + y" $
+                splitsTo (Runtime.Macro.functionLike "ADD" ["x", "y"] ["x", "+", "y"]) [
+                    ident "ADD", punc "(", ident "x", punc ",", spc, ident "y", punc ")"
+                  , spc, ident "x", spc, punc "+", spc, ident "y"
+                  ]
+              -- Distinct from the object-like @#define NOW 0@: the empty
+              -- parameter list is 'Runtime.Macro.Params' @[] False@, not
+              -- 'Runtime.Macro.NoParams'.
+            , testCase "#define NOW() 0" $
+                splitsTo (Runtime.Macro.functionLike "NOW" [] ["0"]) [
+                    ident "NOW", punc "(", punc ")", spc, lit "0"
+                  ]
+            , testCase "#define IGNORE(x)" $
+                splitsTo (Runtime.Macro.functionLike "IGNORE" ["x"] []) [
+                    ident "IGNORE", punc "(", ident "x", punc ")"
+                  ]
+              -- C23 6.10.1p6 forbids repeating a parameter name and @clang@
+              -- rejects the definition, so this never reaches us through the
+              -- pipeline. The splitter splits; it does not validate C.
+            , testCase "#define F(x, x) x" $
+                splitsTo (Runtime.Macro.functionLike "F" ["x", "x"] ["x"]) [
+                    ident "F", punc "(", ident "x", punc ",", spc, ident "x"
+                  , punc ")", spc, ident "x"
+                  ]
+            ]
+        , testGroup "variadic" [
+              testCase "#define LOG(fmt, ...) fmt" $
+                splitsTo (Runtime.Macro.variadic "LOG" ["fmt"] ["fmt"]) [
+                    ident "LOG", punc "(", ident "fmt", punc ",", spc, punc "..."
+                  , punc ")", spc, ident "fmt"
+                  ]
+            , testCase "#define WARN(...) __VA_ARGS__" $
+                splitsTo (Runtime.Macro.variadic "WARN" [] ["__VA_ARGS__"]) [
+                    ident "WARN", punc "(", punc "...", punc ")"
+                  , spc, ident "__VA_ARGS__"
+                  ]
+              -- The GNU named variadic form: the name before the @...@ stands
+              -- for the trailing arguments, so it is not a named parameter.
+            , testCase "#define GNU(args...) args" $
+                splitsTo (Runtime.Macro.variadicNamed "GNU" [] "args" ["args"]) [
+                    ident "GNU", punc "(", ident "args", punc "...", punc ")"
+                  , spc, ident "args"
+                  ]
+            , testCase "#define GNU(fmt, args...) fmt" $
+                splitsTo (Runtime.Macro.variadicNamed "GNU" ["fmt"] "args" ["fmt"]) [
+                    ident "GNU", punc "(", ident "fmt", punc ",", spc, ident "args"
+                  , punc "...", punc ")", spc, ident "fmt"
+                  ]
+            ]
+        , testGroup "keywords" [
+              -- A macro definition may give a new meaning to a keyword, so the
+              -- name accepts one.
+              testCase "#define bool int" $
+                splitsTo (Runtime.Macro.objectLike "bool" ["int"]) [
+                    kw "bool", spc, kw "int"
+                  ]
+              -- A parameter may be a keyword too. Whether @libclang@ calls
+              -- @bool@ a keyword depends on the C standard, and the splitter
+              -- must not care; see 'Test.HsBindgen.Macro.Syntax.Clang', which
+              -- runs this definition under both.
+            , testCase "#define F(bool) bool" $
+                splitsTo (Runtime.Macro.functionLike "F" ["bool"] ["bool"]) [
+                    ident "F", punc "(", kw "bool", punc ")", spc, kw "bool"
+                  ]
+            ]
+        , testGroup "malformed" [
+              testCase "no tokens at all" $
+                failsToSplit []
+            , testCase "name is punctuation" $
+                failsToSplit [punc "+", spc, lit "1"]
+              -- Function-like, since there is no white space before the @(@,
+              -- and 1 is not a parameter name. Before the splitter this fell
+              -- back to an object-like macro with body @(1)@.
+            , testCase "#define FOO(1)" $
+                failsToSplit [
+                    ident "FOO", punc "(", lit "1", punc ")"
+                  ]
+            , testCase "#define F(x,) x" $
+                failsToSplit [
+                    ident "F", punc "(", ident "x", punc ",", punc ")"
+                  , spc, ident "x"
+                  ]
+            , testCase "#define F(..., x) x" $
+                failsToSplit [
+                    ident "F", punc "(", punc "...", punc ",", spc, ident "x", punc ")"
+                  , spc, ident "x"
+                  ]
+            , testCase "#define F(x x" $
+                failsToSplit [
+                    ident "F", punc "(", ident "x", spc, ident "x"
+                  ]
+            , testCase "#define F(" $
+                failsToSplit [
+                    ident "F", punc "("
+                  ]
+            , testCase "#define F(x" $
+                failsToSplit [
+                    ident "F", punc "(", ident "x"
+                  ]
+              -- The name must be an identifier or a keyword; a literal is
+              -- neither.
+            , testCase "#define 1 2" $
+                failsToSplit [
+                    lit "1", spc, lit "2"
+                  ]
+            ]
+          -- A comment is a token, not white space: it separates the name from
+          -- the @(@, and it stays in the body.
+        , testGroup "comments" [
+              testCase "#define FOO/*c*/(1)" $
+                splitsTo (Runtime.Macro.objectLike "FOO" ["/*c*/", "(", "1", ")"]) [
+                    ident "FOO", comment "/*c*/", punc "(", lit "1", punc ")"
+                  ]
+            ]
+          -- A line continuation splices the lines before the macro is parsed,
+          -- so the tokens around it are still adjacent. @libclang@ reports the
+          -- continuation as part of the punctuation token that follows it.
+        , testGroup "line continuations" [
+              testCase "between the name and the parameter list" $
+                splitsTo (Runtime.Macro.functionLike "F" ["x"] ["x"]) [
+                    ident "F", punc "\\\n(", ident "x", punc ")", spc, ident "x"
+                  ]
+            , testCase "inside the parameter list" $
+                splitsTo (Runtime.Macro.functionLike "F" ["x", "y"] ["x"]) [
+                    ident "F", punc "(", ident "x", punc "\\\n,", spc, ident "y"
+                  , punc ")", spc, ident "x"
+                  ]
+            ]
+        ]
+    ]
+
+{-------------------------------------------------------------------------------
+  Auxiliary
+-------------------------------------------------------------------------------}
+
+-- | Assert that the pieces split into the given macro
+--
+-- Only the spellings are compared; the splitter does not change them.
+splitsTo :: Runtime.Macro.Raw String -> [Piece] -> Assertion
+splitsTo expected pieces = Right expected @=? split pieces
+
+-- | Assert that the pieces do not split
+failsToSplit :: [Piece] -> Assertion
+failsToSplit pieces =
+    case split pieces of
+      Left _    -> return ()
+      Right raw -> assertFailure $
+        "expected a parse failure, but got " ++ show (Runtime.Macro.render raw)
+
+split :: [Piece] -> Either String (Runtime.Macro.Raw String)
+split pieces =
+    case splitMacro (layout pieces) of
+      Left  err -> Left err.macroParseError
+      Right raw -> Right $ Text.unpack . spelling <$> raw
diff --git a/test/hs-bindgen/Test/HsBindgen/Macro/Syntax/Clang.hs b/test/hs-bindgen/Test/HsBindgen/Macro/Syntax/Clang.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Macro/Syntax/Clang.hs
@@ -0,0 +1,322 @@
+-- | Tests for 'splitMacro' on token streams that @libclang@ actually produced
+--
+-- "Test.HsBindgen.Macro.Syntax" drives the same splitter with synthetic tokens
+-- laid out by "Test.HsBindgen.Macro.Infra". That layout is a /model/ of how
+-- @libclang@ assigns extents, and the model is load-bearing: the
+-- object-like\/function-like decision is an extent comparison. These tests
+-- validate the model by asserting the same 'Runtime.Macro.Raw' values against real
+-- tokens.
+--
+-- Malformed definitions are not repeated here. @clang@ rejects them outright
+-- (@#define F(x,) x@ is an error, not a macro we get to split), so they can only
+-- be expressed synthetically.
+module Test.HsBindgen.Macro.Syntax.Clang (tests) where
+
+import Data.Foldable (toList)
+import Data.Text (Text)
+import Data.Text qualified as Text
+import Test.Tasty (TestTree, testGroup, withResource)
+import Test.Tasty.HUnit (Assertion, assertFailure, testCase, (@=?))
+import Test.Tasty.QuickCheck (Arbitrary (arbitrary), Gen, Property, chooseInt,
+                              elements, frequency, ioProperty, listOf, resize,
+                              shuffle, testProperty, (===))
+
+import Clang.Args (ClangArgs (ClangArgs))
+import Clang.HighLevel.Types (SourcePath, Token, TokenSpelling)
+import Clang.Version (ClangVersion (ClangVersion), runtimeClangVersion)
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Macro.Error (MacroParseError (..))
+import HsBindgen.Macro.Parse (spelling)
+import HsBindgen.Macro.Syntax (splitMacro)
+
+import Test.HsBindgen.Clang (collectMacroTokens)
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Macro.Syntax.Clang" $
+      map testsFor standards
+   ++ [testProperty "prop_renderRoundtrips" prop_renderRoundtrips]
+
+-- | The definitions of one C standard, sharing a single @libclang@ invocation
+testsFor :: CStandard -> TestTree
+testsFor cStd =
+    withResource (collectMacroTokens (clangArgs cStd) header) (const (pure ())) $
+      \getMacros -> testGroup (show cStd) $
+          testCase "all definitions found" (allFound getMacros)
+        : [ testCase (label c) (checks getMacros c) | c <- cases ]
+        ++ [ testCase "line continuation inside a token spelling"
+               (continuationSpellings getMacros)
+           ]
+
+-- | The header driving all cases of one standard
+header :: String
+header = unlines $ map source cases
+
+{-------------------------------------------------------------------------------
+  C standards
+-------------------------------------------------------------------------------}
+
+-- | The standards the cases are run under
+--
+-- The standard decides which spellings @libclang@ reports as keywords rather
+-- than identifiers: @bool@ is a keyword under C23 and an identifier under C17.
+-- Running every case under both pins that the splitter is indifferent.
+data CStandard = C17 | C23
+
+instance Show CStandard where
+  show = \case
+      C17 -> "C17"
+      C23 -> "C23"
+
+clangArgs :: CStandard -> ClangArgs
+clangArgs = ClangArgs . pure . \case
+    C17 -> "-std=c17"
+    C23 -> "-std=c2x"
+
+standards :: [CStandard]
+standards = C17 : [C23 | c23Supported]
+  where
+    c23Supported :: Bool
+    c23Supported = case runtimeClangVersion of
+        ClangVersion v -> v >= (15, 0, 0)
+        _otherwise     -> False
+
+{-------------------------------------------------------------------------------
+  Cases
+-------------------------------------------------------------------------------}
+
+-- | A macro definition and the split it should produce
+--
+-- The source line is assembled from the name, so the name asserted against the
+-- cursor spelling and the name in the source cannot drift apart.
+data Case = Case {
+      name     :: Text
+      -- | Everything following the macro name, including any white space
+    , rest     :: String
+    , expected :: Runtime.Macro.Raw String
+    }
+
+source :: Case -> String
+source c = "#define " ++ Text.unpack c.name ++ c.rest
+
+-- | The source on one line, for use as a test name
+label :: Case -> String
+label = concatMap escape . source
+  where
+    escape :: Char -> String
+    escape '\n' = "\\n"
+    escape c    = [c]
+
+cases :: [Case]
+cases = [
+      -- Object-like
+      Case "FOO" " 1" $
+        Runtime.Macro.objectLike "FOO" ["1"]
+    , Case "EMPTY" "" $
+        Runtime.Macro.objectLike "EMPTY" []
+      -- White space before the @(@ makes this object-like, with the parentheses
+      -- part of the body; see #1903.
+    , Case "PARENS" " (1)" $
+        Runtime.Macro.objectLike "PARENS" ["(", "1", ")"]
+
+      -- Function-like
+    , Case "ADD" "(x, y) x + y" $
+        Runtime.Macro.functionLike "ADD" ["x", "y"] ["x", "+", "y"]
+      -- Distinct from an object-like macro: the empty parameter list is
+      -- 'Runtime.Macro.Params' @[] False@, not 'Runtime.Macro.NoParams'.
+    , Case "NOW" "() 0" $
+        Runtime.Macro.functionLike "NOW" [] ["0"]
+    , Case "IGNORE" "(x)" $
+        Runtime.Macro.functionLike "IGNORE" ["x"] []
+
+      -- Variadic
+    , Case "LOG" "(fmt, ...) fmt" $
+        Runtime.Macro.variadic "LOG" ["fmt"] ["fmt"]
+    , Case "WARN" "(...) __VA_ARGS__" $
+        Runtime.Macro.variadic "WARN" [] ["__VA_ARGS__"]
+      -- The GNU named variadic form: the name before the @...@ is not a
+      -- parameter of its own.
+    , Case "GNU" "(args...) args" $
+        Runtime.Macro.variadicNamed "GNU" [] "args" ["args"]
+    , Case "GNULOG" "(fmt, args...) fmt" $
+        Runtime.Macro.variadicNamed "GNULOG" ["fmt"] "args" ["fmt"]
+
+      -- A macro definition may give a new meaning to a keyword, so the name
+      -- accepts one; so does a parameter, which the preprocessor sees as a
+      -- pp-token either way.
+    , Case "bool" " int" $
+        Runtime.Macro.objectLike "bool" ["int"]
+    , Case "KWPARAM" "(bool) bool" $
+        Runtime.Macro.functionLike "KWPARAM" ["bool"] ["bool"]
+
+      -- The body is returned verbatim, whatever it contains
+    , Case "PASTE" "(a, b) a ## b" $
+        Runtime.Macro.functionLike "PASTE" ["a", "b"] ["a", "##", "b"]
+    , Case "STR" "(x) #x" $
+        Runtime.Macro.functionLike "STR" ["x"] ["#", "x"]
+    , Case "CALL" "(f) FOO(f)" $
+        Runtime.Macro.functionLike "CALL" ["f"] ["FOO", "(", "f", ")"]
+
+      -- A comment separates the name from the @(@, so the macro is object-like
+      -- and the comment is part of the body.
+    , Case "COMMENT" "/*c*/(1)" $
+        Runtime.Macro.objectLike "COMMENT" ["/*c*/", "(", "1", ")"]
+
+      -- A line continuation splices the lines before the macro is parsed, so
+      -- the @(@ is still adjacent to the name.
+    , continuation
+    , Case "CONTP" "(x, \\\n      y) x" $
+        Runtime.Macro.functionLike "CONTP" ["x", "y"] ["x"]
+    , continuationInParams
+    ]
+
+-- | A line continuation between the name and the parameter list
+--
+-- Singled out because 'continuationSpellings' asserts its token spellings.
+continuation :: Case
+continuation = Case "CONT" "\\\n(x) x" $
+    Runtime.Macro.functionLike "CONT" ["x"] ["x"]
+
+-- | A line continuation inside the parameter list
+--
+-- Singled out for the same reason as 'continuation'.
+continuationInParams :: Case
+continuationInParams = Case "CONTC" "(x\\\n, y) x" $
+    Runtime.Macro.functionLike "CONTC" ["x", "y"] ["x"]
+
+{-------------------------------------------------------------------------------
+  Assertions
+-------------------------------------------------------------------------------}
+
+type Macros = [(Text, [Token SourcePath TokenSpelling])]
+
+-- | @libclang@ reported a definition for every case, in source order
+allFound :: IO Macros -> Assertion
+allFound getMacros = do
+    macros <- getMacros
+    map (.name) cases @=? map fst macros
+
+checks :: IO Macros -> Case -> Assertion
+checks getMacros c = do
+    tokens <- tokensOf getMacros c
+    Right (Text.pack <$> c.expected) @=? split tokens
+
+-- | @libclang@ puts a line continuation inside the token that follows it
+--
+-- This is the observation 'HsBindgen.Macro.Parse.removeMultilines' exists for:
+-- without it the @(@ of @CONT@ would not compare equal to @\"(\"@ and the macro
+-- would come out object-like.
+continuationSpellings :: IO Macros -> Assertion
+continuationSpellings getMacros = do
+    nameToParen <- tokensOf getMacros continuation
+    ["CONT", "\\\n(", "x", ")", "x"] @=? map spelling nameToParen
+    inParams <- tokensOf getMacros continuationInParams
+    ["CONTC", "(", "x", "\\\n,", "y", ")", "x"] @=? map spelling inParams
+
+tokensOf :: IO Macros -> Case -> IO [Token SourcePath TokenSpelling]
+tokensOf getMacros c = do
+    macros <- getMacros
+    case lookup c.name macros of
+      Just tokens -> pure tokens
+      Nothing     -> assertFailure $
+        "libclang reported no definition of " ++ Text.unpack c.name
+
+-- | Split, keeping only the spellings; the splitter does not change them
+split :: [Token SourcePath TokenSpelling] -> Either String (Runtime.Macro.Raw Text)
+split tokens =
+    case splitMacro tokens of
+      Left  err -> Left err.macroParseError
+      Right raw -> Right $ spelling <$> raw
+
+{-------------------------------------------------------------------------------
+  Round trip
+-------------------------------------------------------------------------------}
+
+-- | 'Runtime.Macro.render' and 'splitMacro' are inverse
+--
+-- \[
+--   \text{splitMacro} ~ (\text{tokenize} ~ (\text{render} ~ r)) = r
+-- \]
+--
+-- Only in this direction: 'Runtime.Macro.render' is canonical, not faithful, so
+-- @#define ADD(x,y) x+y@ does not survive a round trip the other way round.
+-- 'Definitions' generates canonical values only.
+prop_renderRoundtrips :: Definitions -> Property
+prop_renderRoundtrips defs = ioProperty $ do
+    macros <- collectMacroTokens (clangArgs C17) (renderAll defs)
+    -- pure $ map Right defs.unwrap === map (split . snd) macros
+    pure $ [ Right (Text.pack <$> m) | m <- defs.unwrap ] === map (split . snd) macros
+
+-- | A header's worth of macro definitions
+--
+-- The names are made distinct, because @clang@ rejects a redefinition with a
+-- different body and this property is not about redefinition.
+newtype Definitions = Definitions { unwrap :: [Runtime.Macro.Raw String] }
+
+instance Show Definitions where
+  show = renderAll
+
+renderAll :: Definitions -> String
+renderAll defs = unlines $ map Runtime.Macro.render defs.unwrap
+
+instance Arbitrary Definitions where
+  arbitrary = Definitions . zipWith rename [0 :: Int ..] <$> listOf genMacro
+    where
+      rename :: Int -> Runtime.Macro.Raw String -> Runtime.Macro.Raw String
+      rename i raw = raw{Runtime.Macro.name = raw.name <> "_" <> show i}
+
+-- | A macro whose rendering @libclang@ tokenizes back to the same tokens
+--
+-- The body alphabet avoids everything that would not survive: no @#@ or @##@
+-- (@clang@ rejects both outside their proper context), no unterminated literal
+-- and no stray backslash. Adjacent tokens cannot merge, because
+-- 'Runtime.Macro.render' separates them with a space.
+genMacro :: Gen (Runtime.Macro.Raw String)
+genMacro = do
+    theName   <- elements ["A", "B", "FOO", "M", "x1"]
+    theParams <- genParams
+    theBody   <- resize 5 . listOf . elements $
+                   paramNames theParams ++ bodyAlphabet
+    pure Runtime.Macro.Raw{
+        Runtime.Macro.name   = theName
+      , Runtime.Macro.params = theParams
+      , Runtime.Macro.body   = theBody
+      }
+  where
+    genParams :: Gen (Runtime.Macro.Params String)
+    genParams = frequency [
+          (1, pure Runtime.Macro.NoParams)
+        , (3, Runtime.Macro.Params <$> genParamNames <*> genVariadic)
+        ]
+
+    -- @args@ is not in 'genParamNames', so the GNU name never repeats a
+    -- parameter.
+    genVariadic :: Gen (Runtime.Macro.Variadic String)
+    genVariadic = frequency [
+          (3, pure Runtime.Macro.NotVariadic)
+        , (1, pure Runtime.Macro.Ellipsis)
+        , (1, pure $ Runtime.Macro.NamedEllipsis "args")
+        ]
+
+    -- Distinct, because @clang@ rejects a repeated parameter name.
+    genParamNames :: Gen [String]
+    genParamNames = do
+      n <- chooseInt (0, 3)
+      take n <$> shuffle ["a", "b", "c", "x"]
+
+    -- Includes the GNU name, which is a parameter like any other.
+    paramNames :: Runtime.Macro.Params String -> [String]
+    paramNames Runtime.Macro.NoParams             = []
+    paramNames (Runtime.Macro.Params ps variadic) = ps ++ toList variadic
+
+    bodyAlphabet :: [String]
+    bodyAlphabet = [
+          "x", "y", "FOO"
+        , "0", "1", "42", "0x1f", "1.5", "\"s\"", "'c'"
+        , "+", "-", "*", "/", "(", ")", ",", "<", ">", "==", "&&"
+        ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Macro/UniqueExpansion.hs b/test/hs-bindgen/Test/HsBindgen/Macro/UniqueExpansion.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Macro/UniqueExpansion.hs
@@ -0,0 +1,471 @@
+{-# LANGUAGE RoleAnnotations #-}
+
+module Test.HsBindgen.Macro.UniqueExpansion (
+    tests
+  ) where
+
+import Data.Set qualified as Set
+import Data.Text (Text)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (Assertion, assertFailure, testCase, (@=?))
+import Test.Tasty.QuickCheck
+
+import Clang.HighLevel.Types (MultiLoc, Range, SourcePath)
+import Clang.Paths (RealPath (..), getSourcePathText)
+
+import HsBindgen.Runtime.Macro qualified as Runtime.Macro
+
+import HsBindgen.Macro.Syntax (MacroDefinition (..), MacroInvocation (..),
+                               splitMacro)
+import HsBindgen.Macro.UniqueExpansion
+import HsBindgen.Macro.UniqueExpansion.Types
+
+import Test.HsBindgen.Macro.Infra
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Macro.UniqueExpansion" [
+      testGroup "propIsExpansionUnique" [
+          testProperty "example1" example1
+        , testProperty "example2" example2
+        , testProperty "example3" example3
+        , testProperty "example4" example4
+        , testProperty "example5" example5
+        , testProperty "example6" example6
+          -- Undefined macros
+        , testProperty "example7"  example7
+        , testProperty "example8"  example8
+        , testProperty "example9"  example9
+        , testProperty "example10" example10
+        , testProperty "example11" example11
+          -- Variadic macros
+        , testProperty "example12" example12
+          -- Redefinitions
+        , testProperty "example13" example13
+        , testProperty "example14" example14
+        , testProperty "example15" example15
+        ]
+    , testGroup "redefinition" [
+          testCase "identical" $
+            Benign @=? redefinitionOf "A" [
+                mkDefinition "A" [] `withBody` ["1"]
+              , mkDefinition "A" [] `withBody` ["1"]
+              ]
+        , testCase "different" $
+            NotBenign @=? redefinitionOf "A" [
+                mkDefinition "A" [] `withBody` ["1"]
+              , mkDefinition "A" [] `withBody` ["2"]
+              ]
+          -- The definitions of @B@ are identical, but @B@ inherits the
+          -- ambiguity of @A@.
+        , testCase "identical, depending on an ambiguous macro" $
+            NotBenign @=? redefinitionOf "B" [
+                mkDefinition "A" [] `withBody` ["1"]
+              , mkDefinition "B" ["A"]
+              , mkDefinition "A" [] `withBody` ["2"]
+              , mkDefinition "B" ["A"]
+              ]
+        , testCase "name mismatch" $
+            NotBenign @=? redefinitionOfResults "A" [
+                liftDefinition $ mkDefinition "A" []
+              , nameMismatch "A"
+              ]
+        ]
+    , testGroup "parseDefinition" [
+          testCase "#define F(x) x + G" $
+            definitionParsesTo (mkDefinition "F" ["G"]) "F" [
+                ident "F", punc "(", ident "x", punc ")"
+              , spc, ident "x", spc, punc "+", spc, ident "G"
+              ]
+          -- A keyword is a name wherever a name may stand: as the macro's own
+          -- name, as a parameter, and in the body.
+        , testCase "#define F(bool) bool" $
+            definitionParsesTo (mkDefinition "F" []) "F" [
+                ident "F", punc "(", kw "bool", punc ")", spc, kw "bool"
+              ]
+        , testCase "#define bool int" $
+            definitionParsesTo (mkDefinition "bool" ["int"]) "bool" [
+                kw "bool", spc, kw "int"
+              ]
+          -- A name the body mentions twice is one dependency.
+        , testCase "#define A B + B" $
+            definitionParsesTo (mkDefinition "A" ["B"]) "A" [
+                ident "A", spc, ident "B", spc, punc "+", spc, ident "B"
+              ]
+          -- A parameter shadows the macro of the same name, so it is not a
+          -- dependency: the expansion of @F@ does not change when @A@ is
+          -- redefined.
+        , testCase "#define F(A) A" $
+            definitionParsesTo (mkDefinition "F" []) "F" [
+                ident "F", punc "(", ident "A", punc ")", spc, ident "A"
+              ]
+          -- The reserved names of a variadic macro stand for its arguments, so
+          -- they are parameters rather than dependencies.
+        , testCase "#define F(...) __VA_ARGS__ __VA_OPT__(,)" $
+            definitionParsesTo (mkDefinition "F" []) "F" [
+                ident "F", punc "(", punc "...", punc ")"
+              , spc, ident "__VA_ARGS__"
+              , spc, ident "__VA_OPT__", punc "(", punc ",", punc ")"
+              ]
+          -- In the GNU named-variadic form the name standing for the trailing
+          -- arguments is a parameter like any other.
+        , testCase "#define F(args...) g(args)" $
+            definitionParsesTo (mkDefinition "F" ["g"]) "F" [
+                ident "F", punc "(", ident "args", punc "...", punc ")"
+              , spc, ident "g", punc "(", ident "args", punc ")"
+              ]
+        , testCase "spelling of #define F(x) x + G" $
+            Right (Runtime.Macro.Raw "F" (Runtime.Macro.Params ["x"] Runtime.Macro.NotVariadic) ["x", "+", "G"])
+              @=? (.spelled) <$> (parseDefinition (mkMacroDefinition "F" [
+                      ident "F", punc "(", ident "x", punc ")"
+                    , spc, ident "x", spc, punc "+", spc, ident "G"
+                    ])).result
+          -- @libclang@ gives the name twice: as the cursor spelling and as the
+          -- first token. The split does not compare them, so this does.
+        , testCase "cursor spelling disagrees with the tokens" $
+            definitionFailsWith (NameMismatch "G" "F") "G" [
+                ident "F", spc, lit "1"
+              ]
+        , testCase "unsplittable definition" $
+            definitionFailsWithParseError "F" [
+                ident "F", punc "(", lit "1", punc ")"
+              ]
+        ]
+    , testGroup "parseInvocation" [
+          testCase "FOO" $
+            invocationParsesTo (Invocation "FOO" []) "FOO" [
+                ident "FOO"
+              ]
+        , testCase "F(a)" $
+            invocationParsesTo (Invocation "F" ["a"]) "F" [
+                ident "F", punc "(", ident "a", punc ")"
+              ]
+          -- Every name in the argument list is collected, however deeply
+          -- nested, and whatever it means there.
+        , testCase "F(1 + a, g(b))" $
+            invocationParsesTo (Invocation "F" ["a", "g", "b"]) "F" [
+                ident "F", punc "(", lit "1", spc, punc "+", spc, ident "a"
+              , punc ",", spc, ident "g", punc "(", ident "b", punc ")", punc ")"
+              ]
+          -- The invoked macro and its arguments may both be keywords, just as a
+          -- definition's name and parameters may be.
+        , testCase "bool" $
+            invocationParsesTo (Invocation "bool" []) "bool" [
+                kw "bool"
+              ]
+        , testCase "F(bool)" $
+            invocationParsesTo (Invocation "F" ["bool"]) "F" [
+                ident "F", punc "(", kw "bool", punc ")"
+              ]
+        , testCase "cursor spelling disagrees with the tokens" $
+            invocationFailsWith (NameMismatch "G" "F") "G" [
+                ident "F"
+              ]
+        , testCase "unbalanced parentheses" $
+            invocationFailsWithParseError "F" [
+                ident "F", punc "(", ident "a"
+              ]
+        ]
+    ]
+
+{-------------------------------------------------------------------------------
+  Parsing definitions and invocations
+
+  'parseDefinition' and 'parseInvocation' project a 'MacroDefinition' or
+  'MacroInvocation' onto the names it mentions; the examples above start from
+  the projections instead. The pieces are laid out as if they had been
+  tokenized from source; see "Test.HsBindgen.Macro.Infra".
+-------------------------------------------------------------------------------}
+
+-- | A definition as 'parseDefinition' reduces it
+--
+-- The definition is object-like, and its body spells its dependencies.
+mkDefinition :: Name -> [Name] -> Definition
+mkDefinition name deps = Definition{
+      name    = name
+    , deps    = Set.fromList deps
+    , spelled = Runtime.Macro.Raw {
+          name   = name.unwrap
+        , params = Runtime.Macro.NoParams
+        , body   = map (.unwrap) deps
+        }
+    }
+
+-- | Replace the spelled body, keeping the dependencies
+withBody :: Definition -> [Text] -> Definition
+withBody def body = def{spelled = def.spelled{Runtime.Macro.body = body}}
+
+-- | Compares the name and the dependencies; see "spelling of ..." for the rest
+definitionParsesTo :: Definition -> Text -> [Piece] -> Assertion
+definitionParsesTo expected name pieces =
+        Right (projection expected)
+    @=? projection <$> (parseDefinition (mkMacroDefinition name pieces)).result
+  where
+    projection :: Definition -> (Name, Set.Set Name)
+    projection def = (def.name, def.deps)
+
+definitionFailsWith :: Error -> Text -> [Piece] -> Assertion
+definitionFailsWith expected name pieces =
+    Left expected @=? (parseDefinition (mkMacroDefinition name pieces)).result
+
+definitionFailsWithParseError :: Text -> [Piece] -> Assertion
+definitionFailsWithParseError name pieces =
+    assertParseError (parseDefinition (mkMacroDefinition name pieces)).result
+
+invocationParsesTo :: Invocation -> Text -> [Piece] -> Assertion
+invocationParsesTo expected name pieces =
+    Right expected @=? (parseInvocation (mkMacroInvocation name pieces)).result
+
+invocationFailsWith :: Error -> Text -> [Piece] -> Assertion
+invocationFailsWith expected name pieces =
+    Left expected @=? (parseInvocation (mkMacroInvocation name pieces)).result
+
+invocationFailsWithParseError :: Text -> [Piece] -> Assertion
+invocationFailsWithParseError name pieces =
+    assertParseError (parseInvocation (mkMacroInvocation name pieces)).result
+
+-- | The message of a 'ParseError' is @parsec@'s, so only its shape is asserted
+assertParseError :: Show a => Either Error a -> Assertion
+assertParseError = \case
+    Left ParseError{} -> return ()
+    other             -> assertFailure $
+      "expected a parse error, but got " ++ show other
+
+-- | A definition as the @Parse@ pass records it
+--
+-- The name is the cursor spelling, which 'parseDefinition' compares against the
+-- tokens; the tokens are split by 'splitMacro', exactly as in the pass.
+mkMacroDefinition :: Text -> [Piece] -> MacroDefinition
+mkMacroDefinition name pieces = MacroDefinition {
+      name  = name
+    , macro = splitMacro (layout pieces)
+    }
+
+mkMacroInvocation :: Text -> [Piece] -> MacroInvocation
+mkMacroInvocation name pieces = MacroInvocation {
+      name     = name
+    , locRange = toRealPathRange (extentOf tokens)
+    , tokens   = tokens
+    }
+  where
+    tokens = layout pieces
+
+-- | Coerce the dummy @\<test\>@ SourcePath extent to RealPath.
+--
+-- Safe because the path is a test-only dummy that never hits disk or
+-- identity comparisons.
+toRealPathRange :: Range (MultiLoc SourcePath) -> Range (MultiLoc RealPath)
+toRealPathRange = fmap (fmap (RealPath . getSourcePathText))
+
+{-------------------------------------------------------------------------------
+  Properties
+-------------------------------------------------------------------------------}
+
+propIsExpansionUnique :: Bool -> [Definition] -> Invocation -> Property
+propIsExpansionUnique expected defs =
+    propIsExpansionUniqueResults expected (fmap liftDefinition defs)
+
+propIsExpansionUniqueResults ::
+     Bool
+  -> [ParseResult Definition]
+  -> Invocation
+  -> Property
+propIsExpansionUniqueResults expected defs inv =
+        expected
+    === isExpansionUnique
+          (ambiguity (analyseMacroDefinitions defs))
+          (liftInvocation inv)
+
+redefinitionOf :: Name -> [Definition] -> Redefinition
+redefinitionOf name defs = redefinitionOfResults name (fmap liftDefinition defs)
+
+redefinitionOfResults :: Name -> [ParseResult Definition] -> Redefinition
+redefinitionOfResults name defs =
+    redefinition (analyseMacroDefinitions defs) name
+
+-- | A definition whose name disagrees with the name @libclang@ reported for the
+-- cursor
+nameMismatch :: Name -> ParseResult Definition
+nameMismatch name = ParseResult name (Left (NameMismatch name.unwrap "X"))
+
+{-------------------------------------------------------------------------------
+  Unit tests
+
+  The definitions are already reduced to their dependencies; which names of a
+  definition are dependencies is 'parseDefinition''s business, tested above.
+-------------------------------------------------------------------------------}
+
+-- | Invoked object-like macro has no dependencies. Expansion is unique.
+example1 :: Property
+example1 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "A" []
+    defs = [
+        mkDefinition "A" []
+      ]
+
+-- | Invoked object-like macro has dependencies. Expansion is unique.
+example2 :: Property
+example2 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "B" []
+    defs = [
+        mkDefinition "A" []
+      , mkDefinition "B" ["A"]
+      ]
+
+-- | Invoked object-like macro has no dependencies. Invoked macro has two
+-- different definitions. Expansion is not unique.
+example3 :: Property
+example3 = once $ propIsExpansionUnique False defs inv
+  where
+    inv = Invocation "A" []
+    defs = [
+        mkDefinition "A" [] `withBody` ["1"]
+      , mkDefinition "A" [] `withBody` ["2"]
+      ]
+
+-- | Invoked macro has dependencies. Dependencies do not have unique expansions.
+-- Expansion is not unique.
+example4 :: Property
+example4 = once $ propIsExpansionUnique False defs inv
+  where
+    inv = Invocation "B" []
+    defs = [
+        mkDefinition "A" [] `withBody` ["1"]
+      , mkDefinition "A" [] `withBody` ["2"]
+      , mkDefinition "B" ["A"]
+      ]
+
+-- | Invoked function-like macro has no dependencies. Invoked with a argument
+-- that has a unique expansion. Expansion is unique.
+example5 :: Property
+example5 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "F" ["B"]
+    defs = [
+        mkDefinition "A" [] `withBody` ["1"]
+      , mkDefinition "A" [] `withBody` ["2"]
+      , mkDefinition "B" []
+      , mkDefinition "F" []
+      ]
+
+-- | Invoked function-like macro has no dependencies. Invoked with an argument
+-- that has no unique expansion. Expansion is not unique.
+example6 :: Property
+example6 = once $ propIsExpansionUnique False defs inv
+  where
+    inv = Invocation "F" ["A"]
+    defs = [
+        mkDefinition "A" [] `withBody` ["1"]
+      , mkDefinition "A" [] `withBody` ["2"]
+      , mkDefinition "B" []
+      , mkDefinition "F" []
+      ]
+
+--
+-- Undefined macros
+--
+
+-- | Invoked object-like macro is undefined. Expansion is unique.
+example7 :: Property
+example7 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "A" []
+    defs = [
+      ]
+
+-- | Invoked object-like macro has undefined dependencies. Expansion is unique.
+example8 :: Property
+example8 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "B" []
+    defs = [
+        mkDefinition "B" ["A"]
+      ]
+
+-- | Invoked function-like macro is undefined. Expansion is unique.
+example9 :: Property
+example9 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "F" ["A"]
+    defs = [
+        mkDefinition "A" []
+      ]
+
+-- | Invoked function-like macro has undefined dependencies. Expansion is
+-- unique.
+example10 :: Property
+example10 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "F" ["C"]
+    defs = [
+        mkDefinition "C" []
+      , mkDefinition "F" ["B"]
+      ]
+
+-- | Invoked function-like macro with an undefined argument. Expansion is unique.
+example11 :: Property
+example11 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "F" ["B"]
+    defs = [
+        mkDefinition "F" []
+      ]
+
+--
+-- Variadic macros
+--
+
+-- | Invoked function-like macro is variadic. All trailing arguments are
+-- checked. Expansion is unique.
+example12 :: Property
+example12 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "F" ["A", "B"]
+    defs = [
+        mkDefinition "A" []
+      , mkDefinition "B" []
+      , mkDefinition "F" []
+      ]
+
+--
+-- Redefinitions
+--
+
+-- | Invoked macro has two identical definitions. Expansion is unique.
+example13 :: Property
+example13 = once $ propIsExpansionUnique True defs inv
+  where
+    inv = Invocation "A" []
+    defs = [
+        mkDefinition "A" [] `withBody` ["1"]
+      , mkDefinition "A" [] `withBody` ["1"]
+      ]
+
+-- | Invoked macro has two identical definitions, but depends on a macro with
+-- two different definitions. Expansion is not unique.
+example14 :: Property
+example14 = once $ propIsExpansionUnique False defs inv
+  where
+    inv = Invocation "B" []
+    defs = [
+        mkDefinition "A" [] `withBody` ["Foo"]
+      , mkDefinition "B" ["A"]
+      , mkDefinition "A" [] `withBody` ["Bar"]
+      , mkDefinition "B" ["A"]
+      ]
+
+-- | Invoked macro depends on a macro whose definition could not be analysed,
+-- because its name disagrees with the cursor. Expansion is not unique.
+example15 :: Property
+example15 = once $ propIsExpansionUniqueResults False defs inv
+  where
+    inv = Invocation "B" []
+    defs = [
+        nameMismatch "A"
+      , liftDefinition $ mkDefinition "B" ["A"]
+      ]
diff --git a/test/hs-bindgen/Test/HsBindgen/PPFixtures.hs b/test/hs-bindgen/Test/HsBindgen/PPFixtures.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/PPFixtures.hs
@@ -0,0 +1,76 @@
+{-# LANGUAGE OverloadedRecordDot #-}
+
+-- | Test suite to verify that PP-generated fixture files compile successfully
+--
+-- This test suite compiles all PP fixture @.hs@ files in a single batch via
+-- direct @ghc@ invocation, verifying that the pretty-printed output produces
+-- valid Haskell. With @--haddock@, it also generates browsable Haddock
+-- documentation.
+--
+module Test.HsBindgen.PPFixtures (tests) where
+
+import Data.Sequence (Seq)
+import Data.Sequence qualified as Seq
+import System.FilePath (takeDirectory, (</>))
+import Test.Tasty
+import Test.Tasty.Runners (testPatternMatches)
+
+import Test.Common.Util.Tasty.Golden (RunMode (..))
+import Test.HsBindgen.Fixtures.Haddock (generateHaddockIndex)
+import Test.HsBindgen.Fixtures.TestCases (FixtureStatus (..), haddockOutputDir,
+                                          isCompile, mkFixtureTest)
+import Test.HsBindgen.Golden (allTestCases)
+import Test.HsBindgen.Golden.Infra.TestCase (TestCase (..))
+import Test.HsBindgen.PPFixtures.Compile (setupPPBatchCompile)
+import Test.HsBindgen.PPFixtures.TestCases (determinePPStatus)
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+-- | @pathPrefix@ is the path of 'testGroup' names from the test tree root
+-- to this point (e.g. @[\"test-hs-bindgen\"]@). 'testPatternMatches' needs
+-- full paths to replicate tasty's @-p@ filtering.
+tests :: Seq String -> IO TestResources -> TestTree
+tests pathPrefix getTestResources =
+    askOption $ \haddockMode ->
+    askOption $ \case
+      Fast -> testGroup "pp-fixtures" []
+      Full -> askOption $ \testPattern ->
+        withResource (setup testPattern haddockMode) (const $ return ()) $
+          \getResults ->
+            testGroup "pp-fixtures" $
+              map (mkFixtureTest "fixture-" "PP compilation"
+                    determinePPStatus getResults)
+                  allTestCases
+  where
+    setup testPattern haddockMode = do
+        testResources <- getTestResources
+        let repoRoot   = takeDirectory testResources.packageRoot
+            buildDir   = repoRoot </> "dist-newstyle" </> "fixtures"
+            haddockDir = haddockOutputDir haddockMode buildDir
+            -- Single pass: partition test cases into compiled and skipped
+            (compiled, skippedCount) = foldr classify ([], 0 :: Int) allTestCases
+            classify tc (cs, n)
+              | not (isCompile status)  = (cs, n + 1)
+              | not (matchesPattern tc) = (cs, n)
+              | otherwise               = (entry tc : cs, n)
+              where status = determinePPStatus tc
+            matchesPattern tc = testPatternMatches testPattern
+              (pathPrefix <> Seq.fromList ["pp-fixtures", tc.name])
+            entry tc =
+              ( tc.name
+              , testResources.packageRoot </> tc.outputDir
+              , determinePPStatus tc /= FixtureCompileNoOptcWerror
+              )
+
+        results <- setupPPBatchCompile repoRoot haddockDir compiled
+
+        -- Generate index page for haddock output
+        let compiledNames = map (\(n, _, _) -> n) compiled
+        case haddockDir of
+          Just dir -> generateHaddockIndex "fixture-" dir compiledNames skippedCount
+          Nothing  -> return ()
+
+        return results
diff --git a/test/hs-bindgen/Test/HsBindgen/PPFixtures/Compile.hs b/test/hs-bindgen/Test/HsBindgen/PPFixtures/Compile.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/PPFixtures/Compile.hs
@@ -0,0 +1,102 @@
+-- | Compilation of PP fixture modules via direct @ghc@ or @haddock@ invocation
+--
+module Test.HsBindgen.PPFixtures.Compile (
+    setupPPBatchCompile
+  , detectModules
+  ) where
+
+import Data.List (sort)
+import Data.Map.Strict (Map)
+import Data.Map.Strict qualified as Map
+import Data.Traversable (forM)
+import System.Directory (doesDirectoryExist, listDirectory)
+import System.FilePath (dropExtension, makeRelative, pathSeparator,
+                        takeExtension, (</>))
+import System.IO.Temp (withSystemTempDirectory)
+
+import Test.HsBindgen.Fixtures.Utils
+
+{-------------------------------------------------------------------------------
+  Setup
+-------------------------------------------------------------------------------}
+
+-- | Set up compilation (or haddock generation) of PP fixtures
+--
+-- Uses direct GHC compilation. When @haddockDir@ is @'Just' dir@, generates
+-- browsable Haddock documentation via @haddock --ghc --html@.
+--
+setupPPBatchCompile
+  :: FilePath
+     -- ^ Repo root (parent of hs-bindgen/)
+  -> Maybe FilePath
+     -- ^ Haddock output directory, or 'Nothing' for compile-only
+  -> [(String, FilePath, Bool)]
+     -- ^ (test name, absolute fixture dir, include @-optc-Werror@?)
+  -> IO (Map String (Either String ()))
+setupPPBatchCompile repoRoot mHaddockDir cases =
+    withSystemTempDirectory "hs-bindgen-pp-fixtures" $ \tmpDir -> do
+      (includeDirs, envFile) <- setupFixtureEnv repoRoot
+
+      -- Detect modules in each fixture directory
+      casesWithModules <- forM cases $ \(name, fixtureDir, optcWerror) -> do
+        mods <- detectModules fixtureDir
+        return (name, fixtureDir, mods, optcWerror)
+
+      let ghcOpts = sharedGhcOptions ++ ["-Werror"]
+          -- One compile job per fixture (ghc --make handles inter-module deps)
+          jobs =
+            [ ( "fixture-" ++ sanitizeLibName name
+              , fixtureDir
+              , mods
+              , if optcWerror then ["-optc-Werror"] else []
+              )
+            | (name, fixtureDir, mods, optcWerror) <- casesWithModules
+            , not (null mods)
+            ]
+
+      -- Compile all fixtures in parallel
+      buildResults <-
+        runDirectGhcBuild tmpDir envFile ghcOpts includeDirs mHaddockDir jobs
+
+      -- Include empty fixtures as vacuously passing
+      let emptyResults = Map.fromList
+            [ ("fixture-" ++ sanitizeLibName name, Right ())
+            | (name, _, mods, _) <- casesWithModules
+            , null mods
+            ]
+
+      return $ emptyResults <> buildResults
+
+{-------------------------------------------------------------------------------
+  Module detection
+-------------------------------------------------------------------------------}
+
+-- | Detect Haskell modules in a fixture directory
+--
+-- Recursively finds all @.hs@ files and converts paths to module names:
+-- @Example.hs@ -> @Example@, @Example\/Safe.hs@ -> @Example.Safe@.
+--
+detectModules :: FilePath -> IO [String]
+detectModules fixtureDir = do
+    hsFiles <- findHaskellFiles fixtureDir
+    return $ sort [ toModuleName (makeRelative fixtureDir f) | f <- hsFiles ]
+  where
+    toModuleName :: FilePath -> String
+    toModuleName = map sepToDot . dropExtension
+      where
+        sepToDot c | c == pathSeparator = '.'
+        sepToDot c = c
+
+-- | Recursively find all @.hs@ files in a directory
+findHaskellFiles :: FilePath -> IO [FilePath]
+findHaskellFiles dir = do
+    entries <- listDirectory dir
+    concat <$> mapM go entries
+  where
+    go :: FilePath -> IO [FilePath]
+    go entry = do
+        let path = dir </> entry
+        isDir <- doesDirectoryExist path
+        if isDir
+          then findHaskellFiles path
+          else return [ path | takeExtension entry == ".hs" ]
diff --git a/test/hs-bindgen/Test/HsBindgen/PPFixtures/TestCases.hs b/test/hs-bindgen/Test/HsBindgen/PPFixtures/TestCases.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/PPFixtures/TestCases.hs
@@ -0,0 +1,57 @@
+{-# LANGUAGE OverloadedRecordDot #-}
+
+-- | Test case definitions for PP fixture compilation
+--
+-- This module determines which golden test cases can be compiled as PP
+-- fixtures. Common skip logic lives in "Test.HsBindgen.Fixtures.TestCases";
+-- this module adds PP-specific checks.
+--
+module Test.HsBindgen.PPFixtures.TestCases (
+    determinePPStatus
+  ) where
+
+import Test.HsBindgen.Fixtures.TestCases
+import Test.HsBindgen.Golden.Infra.TestCase
+
+{-------------------------------------------------------------------------------
+  PP compilation status
+-------------------------------------------------------------------------------}
+
+-- | Determine if a test case should be compiled as a PP fixture
+--
+-- Uses 'commonFixtureStatus' for shared skip reasons, then applies
+-- PP-specific checks.
+--
+determinePPStatus :: TestCase -> FixtureStatus
+determinePPStatus tc
+  -- Common skip reasons (shared with TH)
+  | Just status <- commonFixtureStatus tc
+      = status
+  -- PP-specific empty fixtures (e.g. variant tests that are empty)
+  | tc.name `elem` ppExtraEmpty
+      = FixtureSkip "Empty fixture (no bindings generated)"
+  -- Known -Werror unclean fixtures
+  --
+  | tc.name `elem` knownWerrorUnclean
+      = FixtureCompileNoOptcWerror
+  | otherwise
+      = FixtureCompile
+  where
+    -- Empty fixtures not covered by the common list
+    ppExtraEmpty :: [String]
+    ppExtraEmpty = [
+        "program-analysis/selection_matches_c_names.2.negative_case"
+      ]
+
+    knownWerrorUnclean :: [String]
+    knownWerrorUnclean = [
+        "arrays/array"
+      , "edge-cases/adios"
+      , "attributes/visibility_attributes"
+      , "attributes/visibility/functions"
+      , "attributes/visibility/variables"
+      , "declarations/tentative_definitions"
+      , "macros/redeclaration/different"
+      , "macros/redeclaration/different.1.empty"
+      , "macros/redeclaration/different.2.raw"
+      ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Prop/Selection.hs b/test/hs-bindgen/Test/HsBindgen/Prop/Selection.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Prop/Selection.hs
@@ -0,0 +1,286 @@
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Test.HsBindgen.Prop.Selection (tests) where
+
+import Data.String (IsString (fromString))
+import Data.Text qualified as Text
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (Assertion, HasCallStack, testCase, (@?=))
+import Test.Tasty.QuickCheck (Arbitrary (arbitrary), CoArbitrary (coarbitrary),
+                              Fun, Function (function), Property,
+                              coarbitraryShow, elements, functionMap, oneof,
+                              pattern Fn, testProperty, (=/=), (===))
+
+import Clang.Paths
+
+import HsBindgen.Errors (panicPure)
+import HsBindgen.Frontend.Predicate
+import HsBindgen.IR.C qualified as C
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Prop.Selection" [
+      testGroup "matchSelect" [
+          testProperty "true"                  prop_selectTrue
+        , testProperty "false"                 prop_selectFalse
+        , testProperty "and"                   prop_selectAnd
+        , testProperty "or"                    prop_selectOr
+        , testProperty "not"                   prop_selectNot
+        , testProperty "no-header"             prop_selectNoHeader
+        , testProperty "from-main-headers"     prop_selectFromMainHeaders
+        , testProperty "from-main-header-dirs" prop_selectFromMainHeaderDirs
+        , testProperty "from-all-headers"      prop_selectFromAllHeaders
+        , testProperty "header-path/all"       prop_selectHeaderPathMatchesAll
+        , testProperty "header-path/needle"    prop_selectHeaderPathMatchesNeedle
+        , testProperty "decl-name/all"         prop_selectDeclNameMatchesAll
+        , testProperty "decl-name/needle"      prop_selectDeclNameMatchesNeedle
+        , testProperty "decl-deprecated"       prop_selectDeclMatchDeprecated
+        ]
+    , testGroup "mergeBooleans" [
+          testProperty "select/false"     (prop_mergeFalse    @SelectionPredicate)
+        , testProperty "select/add/true"  (prop_mergeAddTrue  @SelectionPredicate)
+        , testProperty "select/add/false" (prop_mergeAddFalse @SelectionPredicate)
+        , testCase     "true/pos"         mergeTruePos
+        , testCase     "true/neg"         mergeTrueNeg
+        , testCase     "deselect/one"     mergeDeselectOne
+        , testCase     "deselect/two"     mergeDeselectTwo
+        ]
+    ]
+
+{-------------------------------------------------------------------------------
+  Select pass selection properties
+-------------------------------------------------------------------------------}
+
+prop_selectTrue :: C.DeclPath -> C.DeclName -> C.Availability -> Bool
+prop_selectTrue path name availability =
+  matchSelect (const True) (const True) path name availability BTrue
+
+prop_selectFalse :: C.DeclPath -> C.DeclName -> C.Availability -> Bool
+prop_selectFalse path name availability =
+    not $ matchSelect (const True) (const True) path name availability BFalse
+
+prop_selectAnd
+  :: Fun RealPath Bool -> Fun RealPath Bool
+  -> C.DeclPath -> C.DeclName -> C.Availability
+  -> Boolean SelectionPredicate -> Boolean SelectionPredicate -> Bool
+prop_selectAnd (Fn isMainHeader) (Fn isInMainHeaderDir) path name availability p1 p2 =
+    let p1Res = matchSelect isMainHeader isInMainHeaderDir path name availability p1
+        p2Res = matchSelect isMainHeader isInMainHeaderDir path name availability p2
+        p1AndP2Res =
+          matchSelect isMainHeader isInMainHeaderDir path name availability (BAnd p1 p2)
+     in (p1Res && p2Res) == p1AndP2Res
+
+prop_selectOr
+  :: Fun RealPath Bool -> Fun RealPath Bool
+  -> C.DeclPath -> C.DeclName -> C.Availability
+  -> Boolean SelectionPredicate -> Boolean SelectionPredicate -> Bool
+prop_selectOr (Fn isMainHeader) (Fn isInMainHeaderDir) path name availability p1 p2 =
+    let p1Res = matchSelect isMainHeader isInMainHeaderDir path name availability p1
+        p2Res = matchSelect isMainHeader isInMainHeaderDir path name availability p2
+        p1OrP2Res =
+          matchSelect isMainHeader isInMainHeaderDir path name availability (BOr p1 p2)
+     in (p1Res || p2Res) == p1OrP2Res
+
+prop_selectNot
+  :: Fun RealPath Bool -> Fun RealPath Bool
+  -> C.DeclPath -> C.DeclName -> C.Availability
+  -> Boolean SelectionPredicate -> Property
+prop_selectNot (Fn isMainHeader) (Fn isInMainHeaderDir) path name availability p =
+      matchSelect isMainHeader isInMainHeaderDir path name availability p
+  =/= matchSelect isMainHeader isInMainHeaderDir path name availability (BNot p)
+
+-- | Outside a header, no header predicate matches
+prop_selectNoHeader ::
+     Fun RealPath Bool -> Fun RealPath Bool
+  -> C.DeclName -> C.Availability -> HeaderPathPredicate -> Bool
+prop_selectNoHeader (Fn isMainHeader) (Fn isInMainHeaderDir) name availability p =
+    not $ any
+      (\path -> matchSelect isMainHeader isInMainHeaderDir path name availability $
+        BIf (SelectHeader p))
+      [C.InRootHeader, C.OnCommandLine]
+
+prop_selectFromMainHeaders
+  :: Fun RealPath Bool -> RealPath -> C.DeclName -> C.Availability -> Bool
+prop_selectFromMainHeaders (Fn isMainHeader) rp name availability =
+  let p = BIf $ SelectHeader FromMainHeaders
+   in matchSelect isMainHeader unused (C.InHeader rp) name availability p == isMainHeader rp
+
+prop_selectFromMainHeaderDirs
+  :: Fun RealPath Bool -> RealPath -> C.DeclName -> C.Availability -> Bool
+prop_selectFromMainHeaderDirs (Fn isInMainHeaderDir) rp name availability =
+  let p = BIf $ SelectHeader FromMainHeaderDirs
+   in matchSelect unused isInMainHeaderDir (C.InHeader rp) name availability p
+        == isInMainHeaderDir rp
+
+prop_selectFromAllHeaders :: RealPath -> C.DeclName -> C.Availability -> Bool
+prop_selectFromAllHeaders rp name availability =
+  let p = BIf $ SelectHeader FromAllHeaders
+   in matchSelect unused unused (C.InHeader rp) name availability p
+
+prop_selectHeaderPathMatchesAll ::
+  RealPath -> C.DeclName -> C.Availability -> Bool
+prop_selectHeaderPathMatchesAll rp name availability =
+  let p = BIf $ SelectHeader (HeaderPathMatches ".*")
+   in matchSelect unused unused (C.InHeader rp) name availability p
+
+prop_selectHeaderPathMatchesNeedle ::
+  RealPath -> C.DeclName -> C.Availability -> Bool
+prop_selectHeaderPathMatchesNeedle rp name availability =
+  let pathT = getRealPathText rp
+      rp' = RealPath $ pathT <> "NEEDLE" <> pathT
+      p = BIf $ SelectHeader (HeaderPathMatches "NEEDLE")
+   in matchSelect unused unused (C.InHeader rp') name availability p
+
+prop_selectDeclNameMatchesAll ::
+  C.DeclPath -> C.DeclName -> C.Availability -> Bool
+prop_selectDeclNameMatchesAll path name availability =
+  let p = BIf $ SelectDecl (DeclNameMatches ".*")
+   in matchSelect unused unused path name availability p
+
+prop_selectDeclNameMatchesNeedle ::
+  C.DeclPath -> C.DeclName -> C.Availability -> Bool
+prop_selectDeclNameMatchesNeedle path declName availability =
+  let name  = declName.text
+      name' = C.DeclName (name <> "NEEDLE" <> name) declName.kind
+      p     = BIf $ SelectDecl (DeclNameMatches "NEEDLE")
+   in matchSelect unused unused path name' availability p
+
+prop_selectDeclMatchDeprecated ::
+  C.DeclPath -> C.DeclName -> C.Availability -> Bool
+prop_selectDeclMatchDeprecated path name availability =
+  let p = BIf $ SelectDecl DeclDeprecated
+   in matchSelect unused unused path name availability p
+        == (availability == C.Deprecated)
+
+{-------------------------------------------------------------------------------
+  Match tests and properties
+-------------------------------------------------------------------------------}
+
+prop_mergeFalse ::
+  (Eq a, Show a) => [Boolean a] -> Property
+prop_mergeFalse ps = mergeBooleans ps [] === BFalse
+
+prop_mergeAddTrue ::
+  (Eq a, Show a) => [Boolean a] -> [Boolean a] -> Property
+prop_mergeAddTrue ps qs =
+  mergeBooleans ps [BTrue] === mergeBooleans ps (BTrue : qs)
+
+prop_mergeAddFalse ::
+  (Eq a, Show a) => [Boolean a] -> [Boolean a] -> Property
+prop_mergeAddFalse ps qs =
+  mergeBooleans ps qs === mergeBooleans (BFalse : ps) qs
+
+mergeTruePos, mergeTrueNeg :: Assertion
+mergeTruePos =
+  mergeBooleans @HeaderPathPredicate []       [BTrue] @?= BTrue
+mergeTrueNeg =
+  mergeBooleans @HeaderPathPredicate [BFalse] [BTrue] @?= BTrue
+
+mergeDeselectOne :: Assertion
+mergeDeselectOne = mergeBooleans [p] [BTrue] @?= BNot p
+  where
+    p :: Boolean SelectionPredicate
+    p = BIf $ SelectDecl (DeclNameMatches "a")
+
+mergeDeselectTwo :: Assertion
+mergeDeselectTwo = mergeBooleans [pa, pb] [BTrue] @?= BAnd (BNot pa) (BNot pb)
+  where
+    pa, pb :: Boolean SelectionPredicate
+    pa = BIf $ SelectDecl (DeclNameMatches "a")
+    pb = BIf $ SelectDecl (DeclNameMatches "b")
+
+{-------------------------------------------------------------------------------
+  Helpers
+-------------------------------------------------------------------------------}
+
+instance Arbitrary RealPath where
+  arbitrary = RealPath . Text.pack <$> arbitrary
+
+instance Function RealPath where
+  function = functionMap
+               (Text.unpack . getRealPathText)
+               (RealPath . Text.pack)
+
+instance CoArbitrary RealPath where
+  coarbitrary = coarbitraryShow
+
+instance Arbitrary C.DeclPath where
+  arbitrary = oneof [
+      pure C.OnCommandLine
+    , pure C.InRootHeader
+    , C.InHeader <$> arbitrary
+    ]
+
+instance Arbitrary C.NameKind where
+  arbitrary = elements [minBound .. maxBound]
+
+instance Arbitrary C.DeclName where
+  arbitrary = C.DeclName <$> (Text.pack <$> arbitrary) <*> arbitrary
+
+instance Arbitrary C.Availability where
+  arbitrary = elements [minBound .. maxBound]
+
+instance Arbitrary a => Arbitrary (Boolean a) where
+  arbitrary = oneof [
+      pure BTrue
+    , pure BFalse
+    , BAnd <$> arbitrary <*> arbitrary
+    , BOr <$> arbitrary <*> arbitrary
+    , BNot <$> arbitrary
+    , BIf <$> arbitrary
+    ]
+
+instance Arbitrary SelectionPredicate where
+  arbitrary = oneof [
+      SelectHeader <$> arbitrary
+    , SelectDecl . DeclNameMatches <$> elements regexPatterns
+    , pure (SelectDecl DeclDeprecated)
+    ]
+
+instance Arbitrary HeaderPathPredicate where
+  arbitrary = oneof [
+      pure FromMainHeaders
+    , pure FromMainHeaderDirs
+    , pure FromAllHeaders
+    , HeaderPathMatches <$> elements regexPatterns
+    ]
+
+regexPatterns :: [Regex]
+regexPatterns = map fromString
+  [ -- Basic literals and character classes
+    "abc"
+  , "\\d+"
+  , "\\w*"
+  , "\\s?"
+  , "."
+  , "[aeiou]"
+  , "[^0-9]"
+  , "[a-z0-9]+"
+
+    -- Anchors and word boundaries
+  , "^start"
+  , "end$"
+  , "\\bword\\b"
+
+    -- Quantifiers
+  , "colou?r"
+  , "a{3}"
+  , "b{1,3}"
+
+    -- Alternation and grouping
+  , "cat|dog"
+  , "gr(a|e)y"
+  , "(abc)+"
+
+    -- Escaping and specific common patterns
+  , "foo\\.bar"
+  , "https?://"
+  , "[A-Za-z]+"
+  , "\\d{4}-\\d{2}-\\d{2}"
+
+    -- Edge cases
+  , ""
+  , "^$"
+  ]
+
+unused :: HasCallStack => a
+unused = panicPure "Unexpected use"
diff --git a/test/hs-bindgen/Test/HsBindgen/Resources.hs b/test/hs-bindgen/Test/HsBindgen/Resources.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Resources.hs
@@ -0,0 +1,155 @@
+-- | Test resources (for integration with tasty)
+--
+-- Intended for unqualified import.
+module Test.HsBindgen.Resources (
+    -- * C standards
+    CStandard
+  , c89
+  , gnu89
+  , c95
+  , c99
+  , gnu99
+  , c11
+  , gnu11
+  , c17
+  , gnu17
+  , c23
+  , gnu23
+    -- * Test resources
+  , TestResources(..)
+  , withTestResources
+  , getTestClangArgsConfig
+    -- * Backend configuration
+  , getTestDefaultBackendConfig
+  , getTestThBackendConfig
+  , applyTestThCategoryChoice
+  , testThCategoryChoice
+  ) where
+
+import System.FilePath ((</>))
+import Test.Tasty
+
+import HsBindgen.Backend.Category (ByCategory (..), Choice (..),
+                                   RenameTerm (..))
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Config.Internal
+import HsBindgen.Imports
+
+import Test.Common.Util.Cabal
+
+{-------------------------------------------------------------------------------
+  CStandard
+-------------------------------------------------------------------------------}
+
+-- | C standard string, as accepted by the Clang @-std@ option
+--
+-- To see what C standards are supported by a specific version of Clang, run
+-- @clang -x c -std=mediocrity -@ to get a list.  Note that deprecated C
+-- standard strings are not listed even though they are still supported.  For
+-- example, when using Clang 21, @c2x@ is /not/ listed because that version
+-- supports @c23@.  It still accepts @c2x@, however, treating it the same as
+-- @c23@.  Specifying @c2x@ in test configuration is a convenient way to make
+-- the test work across versions of Clang where some versions support @c2x@ but
+-- not @c23@.
+type CStandard = String
+
+c89, gnu89, c95 :: CStandard
+c89   = "c89"
+gnu89 = "gnu89"
+c95   = "iso9899:199409"
+
+c99, gnu99 :: CStandard
+c99   = "c99"
+gnu99 = "gnu99"
+
+c11, gnu11 :: CStandard
+c11   = "c11"
+gnu11 = "gnu11"
+
+c17, gnu17 :: CStandard
+c17   = "c17"
+gnu17 = "gnu17"
+
+c23, gnu23 :: CStandard
+c23   = "c2x"
+gnu23 = "gnu2x"
+
+{-------------------------------------------------------------------------------
+  TestResources
+-------------------------------------------------------------------------------}
+
+data TestResources = TestResources {
+      -- | Package root
+      packageRoot :: FilePath
+
+      -- | Common Clang arguments
+      --
+      -- This configures the Clang arguments that are common to all tests.
+    , clangArgsConfig :: ClangArgsConfig FilePath
+    }
+
+withTestResources :: (IO TestResources -> TestTree) -> TestTree
+withTestResources = withResource initTestResources freeTestResources
+  where
+    initTestResources :: IO TestResources
+    initTestResources = do
+      packageRoot <- findPackageDirectory "hs-bindgen"
+      return TestResources{
+          packageRoot     = packageRoot
+        , clangArgsConfig = def{
+              builtinIncDir    = BuiltinIncDirDisable
+            , extraIncludeDirs = [packageRoot </> "musl-include/x86_64"]
+            , argsAfter        = ["-target", "x86_64-pc-linux-musl"]
+            }
+        }
+
+    freeTestResources :: TestResources -> IO ()
+    freeTestResources _ = return ()
+
+getTestClangArgsConfig ::
+     CStandard
+  -> [FilePath]  -- ^ Include directories, relative to the package root
+  -> TestResources
+  -> ClangArgsConfig FilePath
+getTestClangArgsConfig cStandard includeDirs testResources =
+    testResources.clangArgsConfig{
+        -- NOTE: The C include search path is searched from left to right:
+        -- earlier flags overrule later flags.  We therefore configure the
+        -- test-specific include directories before the common include
+        -- directories.
+        extraIncludeDirs =
+             map ((</>) testResources.packageRoot) includeDirs
+          <> testResources.clangArgsConfig.extraIncludeDirs
+      , argsAfter =
+             testResources.clangArgsConfig.argsAfter
+          <> ["-std=" ++ cStandard]
+      }
+
+{-------------------------------------------------------------------------------
+  Backend configuration
+-------------------------------------------------------------------------------}
+
+getTestDefaultBackendConfig :: TestName -> BackendConfig
+getTestDefaultBackendConfig testName = def{
+      uniqueId = UniqueId (take 35 $ "test." <> testName)
+    }
+
+getTestThBackendConfig :: TestName -> BackendConfig
+getTestThBackendConfig testName =
+    (getTestDefaultBackendConfig testName) {
+        categoryChoice = testThCategoryChoice
+      }
+
+-- | Apply TH-specific category choice to an existing 'BackendConfig',
+-- preserving all other settings (e.g. 'fieldNamingStrategy').
+applyTestThCategoryChoice :: BackendConfig -> BackendConfig
+applyTestThCategoryChoice cfg = cfg { categoryChoice = testThCategoryChoice }
+
+testThCategoryChoice :: ByCategory Choice
+testThCategoryChoice = ByCategory {
+      cType   = IncludeTypeCategory
+    , cSafe   = IncludeTermCategory $ RenameTerm (<> "_safe")
+    , cUnsafe = IncludeTermCategory $ RenameTerm (<> "_unsafe")
+    , cFunPtr = IncludeTermCategory $ RenameTerm (<> "_funptr")
+    , cGlobal = IncludeTermCategory def
+    }
diff --git a/test/hs-bindgen/Test/HsBindgen/THFixtures.hs b/test/hs-bindgen/Test/HsBindgen/THFixtures.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/THFixtures.hs
@@ -0,0 +1,71 @@
+{-# LANGUAGE OverloadedRecordDot #-}
+
+-- | Test suite to verify that TH-generated bindings compile successfully
+--
+-- This test suite generates TH modules for each golden test fixture and
+-- compiles them all via direct @ghc@ invocation, verifying that the TH output
+-- produces valid Haskell. With @--haddock@, it also generates browsable
+-- Haddock documentation.
+--
+module Test.HsBindgen.THFixtures (tests) where
+
+import Data.Sequence (Seq)
+import Data.Sequence qualified as Seq
+import System.FilePath (takeDirectory, (</>))
+import Test.Tasty
+import Test.Tasty.Runners (testPatternMatches)
+
+import Test.Common.Util.Tasty.Golden (RunMode (..))
+import Test.HsBindgen.Fixtures.Haddock (generateHaddockIndex)
+import Test.HsBindgen.Fixtures.TestCases (haddockOutputDir, isCompile,
+                                          mkFixtureTest)
+import Test.HsBindgen.Golden (allTestCases)
+import Test.HsBindgen.Golden.Infra.TestCase (TestCase (..))
+import Test.HsBindgen.Resources
+import Test.HsBindgen.THFixtures.Compile (setupBatchCompile)
+import Test.HsBindgen.THFixtures.Generate (generateModule)
+import Test.HsBindgen.THFixtures.TestCases (determineTHStatus)
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+-- | @pathPrefix@ is the path of 'testGroup' names from the test tree root
+-- to this point (e.g. @[\"test-hs-bindgen\"]@). 'testPatternMatches' needs
+-- full paths to replicate tasty's @-p@ filtering.
+tests :: Seq String -> IO TestResources -> TestTree
+tests pathPrefix getTestResources =
+    askOption $ \haddockMode ->
+    askOption $ \case
+      Fast -> testGroup "th-fixtures" []
+      Full -> askOption $ \testPattern ->
+        withResource (setup testPattern haddockMode) (const $ return ()) $
+          \getResults ->
+            testGroup "th-fixtures" $
+              map (mkFixtureTest "th-fixture-" "TH compilation"
+                    determineTHStatus getResults)
+                  allTestCases
+  where
+    -- Only compile fixtures that match the @-p@ pattern. Without this,
+    -- 'withResource' compiles all fixtures regardless of @-p@.
+    setup testPattern haddockMode = do
+        testResources <- getTestResources
+        let repoRoot   = takeDirectory testResources.packageRoot
+            buildDir   = repoRoot </> "dist-newstyle" </> "fixtures"
+            haddockDir = haddockOutputDir haddockMode buildDir
+            (cases, skippedCount) = foldr classify ([], 0 :: Int) allTestCases
+            classify tc (cs, n)
+              | not (isCompile (determineTHStatus tc)) = (cs, n + 1)
+              | not (testPatternMatches testPattern
+                  (pathPrefix <> Seq.fromList ["th-fixtures", tc.name])) = (cs, n)
+              | otherwise = ((tc.name, generateModule testResources tc) : cs, n)
+
+        results <- setupBatchCompile repoRoot haddockDir cases
+
+        -- Generate index page for haddock output
+        let compiledNames = map fst cases
+        case haddockDir of
+          Just dir -> generateHaddockIndex "th-fixture-" dir compiledNames skippedCount
+          Nothing  -> return ()
+
+        return results
diff --git a/test/hs-bindgen/Test/HsBindgen/THFixtures/Compile.hs b/test/hs-bindgen/Test/HsBindgen/THFixtures/Compile.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/THFixtures/Compile.hs
@@ -0,0 +1,57 @@
+-- | Compilation of TH fixture modules via direct @ghc@ or @haddock@ invocation
+--
+module Test.HsBindgen.THFixtures.Compile (
+    setupBatchCompile
+  ) where
+
+import Data.Map.Strict (Map)
+import System.Directory (createDirectoryIfMissing)
+import System.FilePath ((</>))
+import System.IO.Temp (withSystemTempDirectory)
+
+import Test.HsBindgen.Fixtures.Utils
+
+{-------------------------------------------------------------------------------
+  Setup
+-------------------------------------------------------------------------------}
+
+-- | Set up compilation (or haddock generation) of TH fixtures
+--
+-- Uses direct GHC compilation. When @haddockDir@ is @'Just' dir@, generates
+-- browsable Haddock documentation via @haddock --ghc --html@.
+--
+setupBatchCompile
+  :: FilePath            -- ^ Repo root (parent of hs-bindgen/)
+  -> Maybe FilePath      -- ^ Haddock output directory, or 'Nothing' for compile-only
+  -> [(String, String)]  -- ^ (test name, module content)
+  -> IO (Map String (Either String ()))
+setupBatchCompile repoRoot mHaddockDir cases =
+    withSystemTempDirectory "hs-bindgen-th-fixtures" $ \tmpDir -> do
+      -- Write each module into its own subdirectory (all named Example,
+      -- so each needs a separate directory for GHC's -i search path)
+      mapM_ (writeTestModule tmpDir) cases
+
+      (includeDirs, envFile) <- setupFixtureEnv repoRoot
+
+      let ghcOpts = sharedGhcOptions ++ ["-Wno-unused-imports"]
+          jobs =
+            [ ( "th-fixture-" ++ sanitizeLibName name
+              , tmpDir </> sanitizeLibName name
+              , ["Example"]
+              , []
+              )
+            | (name, _) <- cases
+            ]
+
+      runDirectGhcBuild tmpDir envFile ghcOpts includeDirs mHaddockDir jobs
+
+{-------------------------------------------------------------------------------
+  Module writing
+-------------------------------------------------------------------------------}
+
+-- | Write a test module into its subdirectory
+writeTestModule :: FilePath -> (String, String) -> IO ()
+writeTestModule tmpDir (name, content) = do
+    let subDir = tmpDir </> sanitizeLibName name
+    createDirectoryIfMissing True subDir
+    writeFile (subDir </> "Example.hs") content
diff --git a/test/hs-bindgen/Test/HsBindgen/THFixtures/Generate.hs b/test/hs-bindgen/Test/HsBindgen/THFixtures/Generate.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/THFixtures/Generate.hs
@@ -0,0 +1,129 @@
+{-# LANGUAGE OverloadedRecordDot #-}
+
+-- | Generate TH modules for compilation testing
+--
+-- This module generates Haskell source files that use TH to generate bindings,
+-- similar to the pattern used in Test.TH.Test01.
+module Test.HsBindgen.THFixtures.Generate (
+    generateModule
+  ) where
+
+import Data.List qualified as List
+
+import HsBindgen.BindingSpec
+import HsBindgen.Config.ClangArgs (ClangArgsConfig (..))
+import HsBindgen.Config.Internal
+import HsBindgen.IR.C qualified as C
+
+import Test.HsBindgen.Golden.Infra.TestCase (TestCase (..), getTestBootConfig,
+                                             testInputDirectives)
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Module generation
+-------------------------------------------------------------------------------}
+
+-- | Generate a TH module source that will produce bindings when compiled
+generateModule :: TestResources -> TestCase -> String
+generateModule testResources tc = unlines $ List.intercalate [""] [
+      languagePragmas
+    , moduleHeader bootConfig
+    , imports
+    , letBlock bootConfig (testInputDirectives tc)
+    ]
+  where
+    bootConfig :: BootConfig
+    bootConfig = getTestBootConfig tc testResources
+
+-- The generator compiles under Haskell2010; every non-Haskell2010 feature
+-- the TH splice may expand to must be listed here.
+languagePragmas :: [String]
+languagePragmas = [
+      "{-# LANGUAGE DataKinds #-}"
+    , "{-# LANGUAGE DeriveGeneric #-}"
+    , "{-# LANGUAGE DerivingStrategies #-}"
+    , "{-# LANGUAGE DerivingVia #-}"
+    , "{-# LANGUAGE ExplicitForAll #-}"
+    , "{-# LANGUAGE FlexibleContexts #-}"
+    , "{-# LANGUAGE FlexibleInstances #-}"
+    , "{-# LANGUAGE GeneralizedNewtypeDeriving #-}"
+    , "{-# LANGUAGE ImportQualifiedPost #-}"
+    , "{-# LANGUAGE MagicHash #-}"
+    , "{-# LANGUAGE MultiParamTypeClasses #-}"
+    , "{-# LANGUAGE OverloadedLabels #-}"
+    , "{-# LANGUAGE OverloadedStrings #-}"
+    , "{-# LANGUAGE PatternSynonyms #-}"
+    , "{-# LANGUAGE StandaloneDeriving #-}"
+    , "{-# LANGUAGE TemplateHaskell #-}"
+    , "{-# LANGUAGE TypeApplications #-}"
+    , "{-# LANGUAGE TypeFamilies #-}"
+    , "{-# LANGUAGE TypeOperators #-}"
+    , "{-# LANGUAGE UnboxedTuples #-}"
+    , "{-# LANGUAGE UndecidableInstances #-}"
+    ]
+
+moduleHeader :: BootConfig -> [String]
+moduleHeader bootConfig = List.singleton $ unwords [
+      "module"
+    , baseModuleNameToString bootConfig.baseModule
+    , "where"
+    ]
+
+imports :: [String]
+imports = [
+      "import Foreign.C.Types"
+    , "import HsBindgen.Runtime.LibC qualified"
+    , "import HsBindgen.Runtime.Prelude qualified"
+    , "import HsBindgen.TH"
+    , "import Optics ((%), (&), (.~))"
+    ]
+
+letBlock :: BootConfig -> [C.UncheckedRootDirective] -> [String]
+letBlock bootConfig directives = [
+      "let cfg :: Config"
+    , "    cfg = def"
+    , "      & #clang % #builtinIncDir                 .~ " ++ builtinIncDir'
+    , "      & #clang % #extraIncludeDirs              .~ " ++ extraIncludeDirs'
+    , "      & #clang % #enableBlocks                  .~ " ++ enableBlocks'
+    , "      & #clang % #argsBefore                    .~ " ++ argsBefore'
+    , "      & #clang % #argsInner                     .~ " ++ argsInner'
+    , "      & #clang % #argsAfter                     .~ " ++ argsAfter'
+    , "      & #bindingSpec % #extBindingSpecs         .~ " ++ extBindingSpecs'
+    , "      & #bindingSpec % #prescriptiveBindingSpec .~ " ++ prescriptiveBindingSpec'
+    , "    thCategoryChoice :: ByCategory Choice"
+    , "    thCategoryChoice = ByCategory{"
+    , "        cType   = IncludeTypeCategory"
+    , "      , cSafe   = IncludeTermCategory $ RenameTerm (<> \"_safe\")"
+    , "      , cUnsafe = IncludeTermCategory $ RenameTerm (<> \"_unsafe\")"
+    , "      , cFunPtr = IncludeTermCategory $ RenameTerm (<> \"_funptr\")"
+    , "      , cGlobal = IncludeTermCategory def"
+    , "      }"
+    , "    cfgTh :: ConfigTH"
+    , "    cfgTh = def"
+    , "      & #categoryChoice .~ thCategoryChoice"
+    , " in withHsBindgen cfg cfgTh $ do"
+    ] ++ map (("      " ++) . renderDirective) directives
+  where
+    renderDirective :: C.UncheckedRootDirective -> String
+    renderDirective = \case
+      C.DirectiveHashInclude arg ->
+        "hashInclude " ++ show arg
+      C.DirectiveHashDefine hashDefine -> unwords [
+          "hashDefine"
+        , show hashDefine.name
+        , show hashDefine.value
+        ]
+
+    -- All type 'String':
+    builtinIncDir' = show bootConfig.clangArgs.builtinIncDir
+    extraIncludeDirs' = ("[" ++) . (++ "]") $ List.intercalate ", " [
+        "AbsDir " ++ show includeDir
+      | includeDir <- bootConfig.clangArgs.extraIncludeDirs
+      ]
+    enableBlocks' = show bootConfig.clangArgs.enableBlocks
+    argsBefore' = show bootConfig.clangArgs.argsBefore
+    argsInner' = show bootConfig.clangArgs.argsInner
+    argsAfter' = show bootConfig.clangArgs.argsAfter
+    extBindingSpecs' = show bootConfig.bindingSpec.extBindingSpecs
+    prescriptiveBindingSpec' =
+      show bootConfig.bindingSpec.prescriptiveBindingSpec
diff --git a/test/hs-bindgen/Test/HsBindgen/THFixtures/TestCases.hs b/test/hs-bindgen/Test/HsBindgen/THFixtures/TestCases.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/THFixtures/TestCases.hs
@@ -0,0 +1,79 @@
+{-# LANGUAGE CPP                #-}
+{-# LANGUAGE OverloadedRecordDot #-}
+
+-- | Test case definitions for TH fixture compilation
+--
+-- This module determines which golden test cases can be compiled as TH
+-- fixtures by importing the test case list from "Test.HsBindgen.Golden".
+--
+module Test.HsBindgen.THFixtures.TestCases (
+    determineTHStatus
+  ) where
+
+import Clang.Version
+
+import Test.HsBindgen.Fixtures.TestCases
+import Test.HsBindgen.Golden.Infra.TestCase
+
+{-------------------------------------------------------------------------------
+  TH compilation status
+-------------------------------------------------------------------------------}
+
+-- | Determine if a test case should be compiled as TH
+--
+-- Uses 'commonFixtureStatus' for shared skip reasons, then applies
+-- TH-specific checks.
+--
+determineTHStatus :: TestCase -> FixtureStatus
+determineTHStatus tc
+  -- Common skip reasons (shared with PP)
+  | Just status <- commonFixtureStatus tc
+      = status
+  -- Check clangVersion requirement
+  | Just versionPred <- tc.clangVersion
+  , case runtimeClangVersion of
+      ClangVersion version  -> not (versionPred version)
+      ClangVersionUnknown _ -> True
+      = FixtureSkip "Requires newer clang version"
+  -- Complex configuration (program slicing, disabled stdlib)
+  --
+  -- NOTE: These are TH-specific; PP fixture compilation handles
+  -- multi-module fixtures natively via @--category@ flags.
+  | tc.name `elem` complexConfig
+      = FixtureSkip "Complex configuration (program slicing, disabled stdlib)"
+  -- Generated names clash with the names the TH module itself imports, such
+  -- as its implicit "Prelude"; these are the user's responsibility, see
+  -- "Ambiguous ocurrence `reverse`" (#1571)
+  | tc.name `elem` userImportClashes
+      = FixtureSkip "Generated names clash with the imports of the TH module"
+  -- Windows-specific failures
+  | tc.name `elem` windowsSpecificFailures
+      = FixtureSkip "Windows-specific failure"
+  -- Variant tests (name contains a period followed by a number)
+  | isVariantTest tc.name
+      = FixtureSkip "Variant test (only base test compiled)"
+  | otherwise
+      = FixtureCompile
+  where
+    -- Non-NFC Unicode cannot be encoded in temp file paths on Windows
+    windowsSpecificFailures :: [String]
+#ifdef mingw32_HOST_OS
+    windowsSpecificFailures = [
+        "edge-cases/adios"
+      ]
+#else
+    windowsSpecificFailures = []
+#endif
+
+    userImportClashes :: [String]
+    userImportClashes = [
+        "edge-cases/prelude_names"
+      ]
+
+    complexConfig :: [String]
+    complexConfig = [
+        "globals/globals"
+      , "program-analysis/program_slicing_simple"
+      , "program-analysis/selection_omit_external_a"
+      , "program-analysis/selection_omit_external_b"
+      ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Unit/ClangArgs.hs b/test/hs-bindgen/Test/HsBindgen/Unit/ClangArgs.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Unit/ClangArgs.hs
@@ -0,0 +1,75 @@
+module Test.HsBindgen.Unit.ClangArgs (tests) where
+
+import Test.Tasty
+import Test.Tasty.HUnit
+
+import Clang.LowLevel.Core
+
+import HsBindgen.Clang
+import HsBindgen.Clang.ExtraClangArgs (splitArguments)
+import HsBindgen.Config.ClangArgs
+import HsBindgen.Imports
+import HsBindgen.Util.Tracer
+
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  List of tests
+-------------------------------------------------------------------------------}
+
+tests :: IO TestResources -> TestTree
+tests getTestResources = testGroup "Test.HsBindgen.Unit.ClangArgs" [
+      testCase "getTargetTriple" $ testGetTargetTriple getTestResources
+    , splitArgumentsTests
+    ]
+
+{-------------------------------------------------------------------------------
+  Target triple
+-------------------------------------------------------------------------------}
+
+testGetTargetTriple :: IO TestResources -> Assertion
+testGetTargetTriple getTestResources = do
+    clangArgs <-
+      (clangArgsConfigToClangArgs . (.clangArgsConfig)) <$> getTestResources
+    let setup = defaultClangSetup clangArgs $
+          ClangInputMemory "hs-bindgen-triple.h" ""
+
+    triple <- withTracePredicate noReport defaultTracePredicate $ \tracer ->
+      getTargetTriple tracer setup
+
+    triple @?= "x86_64-pc-linux-musl"
+  where
+    getTargetTriple :: Tracer ClangMsg -> ClangSetup -> IO Text
+    getTargetTriple tracer setup =
+        withClang tracer setup $ \unit ->
+          bracket
+            (clang_getTranslationUnitTargetInfo unit)
+            clang_TargetInfo_dispose
+            clang_TargetInfo_getTriple
+
+    noReport :: a -> IO ()
+    noReport = const $ pure ()
+
+{-------------------------------------------------------------------------------
+  Split arguments
+-------------------------------------------------------------------------------}
+
+splitArgumentsTests :: TestTree
+splitArgumentsTests = testGroup "splitStringArguments"
+    [ testCase "simple"       $ splitArguments "a b"                   @?= ["a", "b"]
+    , testCase "spacesPre"    $ splitArguments " \targ"                @?= ["arg"]
+    , testCase "spacesSuf1"   $ splitArguments "arg\t "                @?= ["arg"]
+    , testCase "spacesSuf2"   $ splitArguments "arg "                  @?= ["arg"]
+    , testCase "spaces1"      $ splitArguments "  \t  "                @?= []
+    , testCase "spaces2"      $ splitArguments " \t a b \t\n "         @?= ["a", "b"]
+    , testCase "escape1"      $ splitArguments "a\\ b"                 @?= ["a b"]
+    , testCase "escape2"      $ splitArguments "a1 arg\\ two a3"       @?= ["a1", "arg two", "a3"]
+    , testCase "escapedEsape" $ splitArguments "c\\\\d"                @?= ["c\\d"]
+    , testCase "escapedQuote" $ splitArguments "e\\\"f"                @?= ["e\"f"]
+    , testCase "escaped^2"    $ splitArguments "c\\\\d e\\\"f"         @?= ["c\\d", "e\"f"]
+    , testCase "escaped^3"    $ splitArguments " a\\ b c\\\\d e\\\"f " @?= ["a b", "c\\d", "e\"f"]
+    , testCase "quote1"       $ splitArguments "\"a b\""               @?= ["a b"]
+    , testCase "quote2"       $ splitArguments "a1 \"arg two\" a3"     @?= ["a1", "arg two", "a3"]
+    , testCase "escape&quote" $ splitArguments "a\\ \"b c\"\\ d"       @?= ["a b c d"]
+    ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Unit/Digraph.hs b/test/hs-bindgen/Test/HsBindgen/Unit/Digraph.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Unit/Digraph.hs
@@ -0,0 +1,670 @@
+module Test.HsBindgen.Unit.Digraph (tests) where
+
+import Control.Monad (forM_)
+import Data.Bifunctor (bimap, first)
+import Data.Char qualified as Char
+import Data.Digraph (Digraph)
+import Data.Digraph qualified as Digraph
+import Data.Foldable qualified as Foldable
+import Data.List qualified as List
+import Data.List.NonEmpty qualified as NonEmpty
+import Data.Map.Strict (Map)
+import Data.Map.Strict qualified as Map
+import Data.Set (Set)
+import Data.Set qualified as Set
+import Data.Tree qualified as Tree
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (Assertion, assertFailure, testCase, (@=?))
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Unit.Digraph" [
+      -- Construction
+      testTranspose
+      -- Insertion
+    , testInsertEdgeIfVerticesExist
+      -- Deletion/Update
+    , testDeleteEdgesFrom
+    , testDeleteEdgesTo
+    , testCombineParallelEdges
+    , testFilterEdges
+    , testFilterVerticesCombineEdges
+      -- Query
+    , testHasVertex
+    , testVertices
+    , testNeighbors
+    , testReaches
+    , testSort
+    , testSortBy
+    , testDfs
+    , testDff
+    , testDfFindMember
+    , testTraversePathFrom
+    , testFindEdges
+      -- Traversal
+    , testMapEdges
+    , testMapVerticesOutgoingEdges
+    ]
+
+--------------------------------------------------------------------------------
+
+type E = String
+type V = String
+type G = Digraph E V
+
+-- Empty graph
+graph0 :: G
+graph0 = Digraph.empty
+
+-- Test graph 1: no cycles
+--
+-- @
+-- flowchart TD
+--     v16
+--     v15
+--     v2
+--     v14
+--     v12
+--     v3
+--     v6
+--     v10
+--     v8
+--     v5
+--     v4
+--     v1
+--     v11
+--     v7
+--     v13
+--     v9
+--
+--     v16-->|a|v15
+--     v16-->|b|v2
+--     v2-->|c|v14
+--     v14-->|d|v12
+--     v14-->|e|v3
+--     v10-->|f|v14
+--     v8-->|g|v5
+--     v1-->|h|v11
+--     v1-->|i|v7
+--     v1-->|j|v13
+--     v7-->|k|v9
+-- @
+graph1E :: G
+graph1E = mkGraph graph1Vs graph1Es
+
+-- Test graph 1: vertices, ordered
+graph1Vs :: [V]
+graph1Vs = mkVs [16, 15, 2, 14, 12, 3, 6, 10, 8, 5, 4, 1, 11, 7, 13, 9]
+-- Indexes:       0   1  2   3   4  5  6   7  8  9 10 11  12 13  14 15
+
+-- Test graph 1: edges
+graph1Es :: [(E, (V, V))]
+graph1Es = map (fmap (bimap mkV mkV)) [
+      ("a", (16, 15))
+    , ("b", (16, 2))
+    , ("c", (2,  14))
+    , ("d", (14, 12))
+    , ("e", (14, 3))
+    , ("f", (10, 14))
+    , ("g", (8,  5))
+    , ("h", (1,  11))
+    , ("i", (1,  7))
+    , ("j", (1,  13))
+    , ("k", (7,  9))
+    ]
+
+-- Test graph 1: with vertices but no edges
+graph1V :: G
+graph1V = mkGraph graph1Vs []
+
+-- Test graph 2: graph with one cycle
+--
+-- @
+-- flowchart TD
+--     v3
+--     v2
+--     v1
+--
+--     v2-->|a|v3
+--     v3-->|b|v2
+--     v2-->|c|v1
+-- @
+graph2E :: G
+graph2E = mkGraph graph2Vs graph2Es
+
+-- Test graph 2: vertices, ordered
+graph2Vs :: [V]
+graph2Vs = mkVs [3, 2, 1]
+-- Indexes:      0  1  2
+
+-- Test graph 2: edges
+graph2Es :: [(E, (V, V))]
+graph2Es = map (fmap (bimap mkV mkV)) [
+      ("a", (2, 3))
+    , ("b", (3, 2))
+    , ("c", (2, 1))
+    ]
+
+-- Test graph 3: graph with multiple cycles
+--
+-- @
+-- flowchart TD
+--     v1
+--     v2
+--     v6
+--     v8
+--     v4
+--     v11
+--     v3
+--     v10
+--     v7
+--     v5
+--     v9
+--
+--     v2-->|a|v6
+--     v6-->|b|v2
+--     v2-->|c|v8
+--     v1-->|d|v8
+--     v8-->|e|v3
+--     v3-->|f|v7
+--     v7-->|g|v11
+--     v11-->|h|v8
+--     v7-->|i|v5
+--     v7-->|j|v9
+--     v6-->|k|v4
+--     v10-->|l|v4
+--     v4-->|m|v10
+-- @
+graph3E :: G
+graph3E = mkGraph graph3Vs graph3Es
+
+-- Test graph 3: vertices, ordered
+graph3Vs :: [V]
+graph3Vs = mkVs [1, 2, 6, 8, 4, 11, 3, 10, 7, 5, 9]
+-- Indexes:      0  1  2  3  4   5  6   7  8  9 10
+
+-- Test graph 3: edges
+graph3Es :: [(E, (V, V))]
+graph3Es = map (fmap (bimap mkV mkV)) [
+      ("a", ( 2,  6))
+    , ("b", ( 6,  2))
+    , ("c", ( 2,  8))
+    , ("d", ( 1,  8))
+    , ("e", ( 8,  3))
+    , ("f", ( 3,  7))
+    , ("g", ( 7, 11))
+    , ("h", (11,  8))
+    , ("i", ( 7,  5))
+    , ("j", ( 7,  9))
+    , ("k", ( 6,  4))
+    , ("l", (10,  4))
+    , ("m", ( 4, 10))
+    ]
+
+--------------------------------------------------------------------------------
+
+testTranspose :: TestTree
+testTranspose = testGroup "transpose" [
+      testCase "empty" $
+        graph0 @=? Digraph.transpose graph0
+    , testCase "no edges" $
+        graph1V @=? Digraph.transpose (Digraph.transpose graph1V)
+    , testCase "with edges" $
+        graph1E @=? Digraph.transpose (Digraph.transpose graph1E)
+    , testCase "with cycle" $
+        graph2E @=? Digraph.transpose (Digraph.transpose graph2E)
+    , testCase "with cycles" $
+        graph3E @=? Digraph.transpose (Digraph.transpose graph3E)
+    ]
+
+testInsertEdgeIfVerticesExist :: TestTree
+testInsertEdgeIfVerticesExist = testGroup "insertEdgeIfVerticesExist" [
+      testCase "both exist" $ do
+        let graphVs  = mkVs [1, 2]
+            graph    = mkGraph graphVs []
+            expected = mkGraph graphVs [("new", ("v1", "v2"))]
+        Digraph.InsertEdgeSuccess expected
+          @=? Digraph.insertEdgeIfVerticesExist "v1" "new" "v2" graph
+    , testCase "no source" $ do
+        let graph = mkGraph (mkVs [2]) []
+        Digraph.InsertEdgeSourceVertexNotFound "v1"
+          @=? Digraph.insertEdgeIfVerticesExist "v1" "new" "v2" graph
+    , testCase "no target" $ do
+        let graph = mkGraph (mkVs [1]) []
+        Digraph.InsertEdgeTargetVertexNotFound "v2"
+          @=? Digraph.insertEdgeIfVerticesExist "v1" "new" "v2" graph
+    ]
+
+testDeleteEdgesFrom :: TestTree
+testDeleteEdgesFrom = testGroup "deleteEdgesFrom" [
+      testCase "none" $
+        graph1E @=? Digraph.deleteEdgesFrom Set.empty graph1E
+    , testCase "unknown" $
+        graph1E @=? Digraph.deleteEdgesFrom (vSet [42]) graph1E
+    , testCase "orphan" $
+        graph1E @=? Digraph.deleteEdgesFrom (vSet [6]) graph1E
+    , testCase "leaf" $
+        graph1E @=? Digraph.deleteEdgesFrom (vSet [9]) graph1E
+    , testCase "one" $ do
+        let expected = mkGraph graph1Vs $ filter (\ p -> fst p /= "c") graph1Es
+        expected @=? Digraph.deleteEdgesFrom (vSet [2]) graph1E
+    , testCase "two" $ do
+        let expected = mkGraph graph1Vs $ filter (\ p -> fst p > "b") graph1Es
+        expected @=? Digraph.deleteEdgesFrom (vSet [16]) graph1E
+    ]
+
+testDeleteEdgesTo :: TestTree
+testDeleteEdgesTo = testGroup "deleteEdgesTo" [
+      testCase "none" $
+        graph1E @=? Digraph.deleteEdgesTo Set.empty graph1E
+    , testCase "unknown" $
+        graph1E @=? Digraph.deleteEdgesTo (vSet [42]) graph1E
+    , testCase "orphan" $
+        graph1E @=? Digraph.deleteEdgesTo (vSet [4]) graph1E
+    , testCase "root" $
+        graph1E @=? Digraph.deleteEdgesTo (vSet [8]) graph1E
+    , testCase "one" $ do
+        let expected = mkGraph graph1Vs $ filter (\ p -> fst p /= "i") graph1Es
+        expected @=? Digraph.deleteEdgesTo (vSet [7]) graph1E
+    , testCase "two" $ do
+        let expected = mkGraph graph1Vs $
+              filter (\ p -> fst p `notElem` ["c", "f"]) graph1Es
+        expected @=? Digraph.deleteEdgesTo (vSet [14]) graph1E
+    ]
+
+testCombineParallelEdges :: TestTree
+testCombineParallelEdges = testGroup "combineParallelEdges" [
+      testCase "empty" $
+        graph0 @=? Digraph.combineParallelEdges combine graph0
+    , testCase "single" $
+        graph1E @=? Digraph.combineParallelEdges combine graph1E
+    , testCase "multi" $
+        expected @=? Digraph.combineParallelEdges combine graph
+    ]
+  where
+    graphVs :: [V]
+    graphVs = mkVs [1, 2, 3]
+
+    graph :: G
+    graph = mkGraph graphVs $ map (fmap (bimap mkV mkV)) [
+        ("a", (2, 3))
+      , ("b", (2, 3))
+      , ("c", (2, 3))
+      , ("d", (3, 4))
+      , ("e", (2, 4))
+      , ("f", (2, 4))
+      ]
+
+    combine :: String -> String -> String
+    combine l r = l ++ ':' : r
+
+    expected :: G
+    expected = mkGraph graphVs $ map (fmap (bimap mkV mkV)) [
+        ("a:b:c", (2, 3))
+      , ("d",     (3, 4))
+      , ("e:f",   (2, 4))
+      ]
+
+testFilterEdges :: TestTree
+testFilterEdges = testGroup "filterEdges" [
+      testCase "empty" $
+        graph0 @=? Digraph.filterEdges (const True) graph0
+    , testCase "none" $
+        graph1E @=? Digraph.filterEdges (const True) graph1E
+    , testCase "all" $
+        graph1V @=? Digraph.filterEdges (const False) graph1E
+    , testCase "single" $ do
+        let p        = (<= "c")
+            expected = mkGraph graph1Vs $ filter (p . fst) graph1Es
+        expected @=? Digraph.filterEdges p graph1E
+    , testCase "multi" $ do
+        let p        = (`notElem` ["b", "e"])
+            expected = mkGraph graphVs $ filter (p . fst) graphEs
+        expected @=? Digraph.filterEdges p graph
+    ]
+  where
+    graphVs :: [V]
+    graphVs = mkVs [1, 2, 3]
+
+    graphEs :: [(E, (V, V))]
+    graphEs = map (fmap (bimap mkV mkV)) [
+        ("a", (2, 3))
+      , ("b", (2, 3))
+      , ("c", (2, 3))
+      , ("d", (3, 4))
+      , ("e", (2, 4))
+      , ("f", (2, 4))
+      ]
+
+    graph :: G
+    graph = mkGraph graphVs graphEs
+
+testFilterVerticesCombineEdges :: TestTree
+testFilterVerticesCombineEdges = testGroup "filterVerticesCombineEdges" [
+      testCase "empty" $
+        graph0 @=? Digraph.filterVerticesCombineEdges p (++) graph0
+    , testCase "no edges" $ do
+        let graph = Digraph.filterVerticesCombineEdges p (++) graph1V
+        filter p graph1Vs @=? Digraph.vertices graph
+    , testCase "with edges" $ do
+        let graph = Digraph.filterVerticesCombineEdges p (++) graph1E
+            vs    = Digraph.vertices graph
+        filter p graph1Vs @=? vs
+        forM_ vs $ \ v -> do
+          let ns = Digraph.neighbors v graph
+          case v of
+            "v1"  -> expect ns [(9, ["ik"]), (11, ["h"]), (13, ["j"])]
+            "v2"  -> expect ns []
+            "v3"  -> expect ns []
+            "v4"  -> expect ns []
+            "v5"  -> expect ns []
+            "v6"  -> expect ns []
+            "v7"  -> expect ns []
+            "v8"  -> expect ns [(5, ["g"])]
+            "v9"  -> expect ns []
+            "v10" -> expect ns [(3, ["fe"]), (12, ["fd"])]
+            "v11" -> expect ns []
+            "v12" -> expect ns []
+            "v13" -> expect ns []
+            "v14" -> expect ns []
+            "v15" -> expect ns []
+            "v16" -> expect ns [(3, ["bce"]), (12, ["bcd"]), (15, ["a"])]
+            _     -> assertFailure $ "unexpected vertex: " ++ v
+    ]
+  where
+    p :: String -> Bool
+    p = (`notElem` (mkVs [2, 7, 14]))
+
+    expect :: Map V (Set E) -> [(Int, [E])] -> Assertion
+    expect ns = (@=? ns) . Map.fromList . map (bimap mkV Set.fromList)
+
+testHasVertex :: TestTree
+testHasVertex = testGroup "hasVertex" [
+      testCase "empty"   $ False @=? Digraph.hasVertex "v42" graph0
+    , testCase "unknown" $ False @=? Digraph.hasVertex "v42" graph1E
+    , testCase "exists"  $ True  @=? Digraph.hasVertex "v6"  graph1E
+    ]
+
+testVertices :: TestTree
+testVertices = testGroup "vertices" [
+      testCase "empty"      $ []       @=? Digraph.vertices graph0
+    , testCase "no edges"   $ graph1Vs @=? Digraph.vertices graph1V
+    , testCase "with edges" $ graph1Vs @=? Digraph.vertices graph1E
+    ]
+
+testNeighbors :: TestTree
+testNeighbors = testGroup "neighbors" [
+      testCase "unknown" $
+        expect [] @=? Digraph.neighbors "v42" graph1E
+    , testCase "orphan" $
+        expect [] @=? Digraph.neighbors "v6" graph1E
+    , testCase "root" $
+        expect [(7, "i"), (11, "h"), (13, "j")]
+          @=? Digraph.neighbors "v1" graph1E
+    , testCase "mid" $
+        expect [(3, "e"), (12, "d")] @=? Digraph.neighbors "v14" graph1E
+    , testCase "leaf" $
+        expect [] @=? Digraph.neighbors "v5" graph1E
+    ]
+  where
+    expect :: [(Int, E)] -> Map V (Set E)
+    expect = Map.fromList . map (bimap mkV Set.singleton)
+
+testReaches :: TestTree
+testReaches = testGroup "reaches" [
+      testCase "empty" $
+        vSet [] @=? Digraph.reaches (vSet []) graph1E
+    , testCase "unknown" $
+        vSet [] @=? Digraph.reaches (vSet [42]) graph1E
+    , testCase "orphan" $
+        vSet [6] @=? Digraph.reaches (vSet [6]) graph1E
+    , testCase "root" $
+        vSet [1, 7, 9, 11, 13] @=? Digraph.reaches (vSet [1]) graph1E
+    , testCase "mid" $
+        vSet [3, 12, 14] @=? Digraph.reaches (vSet [14]) graph1E
+    , testCase "leaf" $
+        vSet [5] @=? Digraph.reaches (vSet [5]) graph1E
+    , testCase "multi" $
+        vSet [3, 4, 7, 9, 12, 14]
+          @=? Digraph.reaches (vSet [4, 7, 9, 14]) graph1E
+    ]
+
+testSort :: TestTree
+testSort = testGroup "sort" [
+      testCase "empty" $
+        [] @=? Digraph.sort graph0
+    , testCase "no edges" $
+        graph1Vs @=? Digraph.sort graph1V
+    , testCase "with edges" $ do
+        let expected =
+              mkVs [16, 15, 2, 6, 10, 14, 12, 3, 8, 5, 4, 1, 11, 7, 13, 9]
+        expected @=? Digraph.sort graph1E
+    , testCase "with cycle" $ do
+        let expected = mkVs [3, 2, 1]
+        expected @=? Digraph.sort graph2E
+    , testCase "with cycles" $ do
+        let expected = mkVs [1, 2, 6, 8, 11, 3, 7, 4, 10, 5, 9]
+        expected @=? Digraph.sort graph3E
+    ]
+
+testSortBy :: TestTree
+testSortBy = testGroup "sortBy" [
+      testCase "empty" $
+        [] @=? Digraph.sortBy cmp graph0
+    , testCase "no edges" $ do
+        let expected = List.sortBy cmp graph1Vs
+        expected @=? Digraph.sortBy cmp graph1V
+    , testCase "with edges" $ do
+        let expected =
+              mkVs [1, 4, 6, 7, 8, 5, 9, 10, 11, 13, 16, 2, 14, 3, 12, 15]
+        expected @=? Digraph.sortBy cmp graph1E
+    , testCase "with cycle" $ do
+        let expected = mkVs [2, 3, 1]
+        expected @=? Digraph.sortBy cmp graph2E
+    , testCase "with cycles" $ do
+        let expected = mkVs [1, 2, 6, 3, 7, 8, 11, 4, 10, 5, 9]
+        expected @=? Digraph.sortBy cmp graph3E
+    ]
+  where
+    cmp :: String -> String -> Ordering
+    cmp (_ : l) (_ : r) = compare (read @Int l) (read @Int r)
+    cmp l       r       = compare l r
+
+testDfs :: TestTree
+testDfs = testGroup "dfs" [
+      testCase "empty" $
+        [] @=? Digraph.dfs [] graph1E
+    , testCase "unknown" $
+        [] @=? Digraph.dfs ["v42"] graph1E
+    , testCase "order" $ do
+        let expected = map mkVs [
+                Tree.Node 4 []
+              , Tree.Node 10
+                  [ Tree.Node 14
+                      [ Tree.Node 12 []
+                      , Tree.Node 3 []
+                      ]
+                  ]
+              , Tree.Node 16
+                  [ Tree.Node 15 []
+                  , Tree.Node 2 []
+                  ]
+              ]
+        expected @=? Digraph.dfs (mkVs [4, 10, 16]) graph1E
+    , testCase "done" $ do
+        let expected = map mkVs [
+                Tree.Node 8
+                  [ Tree.Node 5 []
+                  ]
+              ]
+        expected @=? Digraph.dfs (mkVs [8, 5]) graph1E
+    ]
+
+testDff :: TestTree
+testDff = testGroup "dff" [
+      testCase "empty" $
+        [] @=? Digraph.dff graph0
+    , testCase "no edges" $
+        [Tree.Node v [] | v <- graph1Vs] @=? Digraph.dff graph1V
+    , testCase "with edges" $ do
+        let expected = map mkVs [
+                Tree.Node 16
+                  [ Tree.Node 15 []
+                  , Tree.Node 2
+                      [ Tree.Node 14
+                          [ Tree.Node 12 []
+                          , Tree.Node 3 []
+                          ]
+                      ]
+                  ]
+              , Tree.Node 6 []
+              , Tree.Node 10 []
+              , Tree.Node 8
+                  [ Tree.Node 5 []
+                  ]
+              , Tree.Node 4 []
+              , Tree.Node 1
+                  [ Tree.Node 11 []
+                  , Tree.Node 7
+                      [ Tree.Node 9 []
+                      ]
+                  , Tree.Node 13 []
+                  ]
+              ]
+        expected @=? Digraph.dff graph1E
+    ]
+
+testDfFindMember :: TestTree
+testDfFindMember = testGroup "dfFindMember" [
+      testCase "unknown" $
+        Nothing @=? Digraph.dfFindMember "v42" (vSet [42]) graph1E
+    , testCase "self" $
+        Just "v2" @=? Digraph.dfFindMember "v2" (vSet [1, 2]) graph1E
+    , testCase "child" $
+        Just "v14" @=? Digraph.dfFindMember "v2" (vSet [3, 12, 14]) graph1E
+    , testCase "descendent" $
+        Just "v9" @=? Digraph.dfFindMember "v1" (vSet [9, 13]) graph1E
+    , testCase "none" $
+        Nothing @=? Digraph.dfFindMember "v16" (vSet [4, 5, 10]) graph1E
+    ]
+
+testTraversePathFrom :: TestTree
+testTraversePathFrom = testGroup "traversePathFrom" [
+      testCase "orphan" $
+        [Nothing] @=? Digraph.traversePathFrom "v6" (step [1, 6]) graph1E
+    , testCase "all branches, some targets" $
+        [Just "v15:a", Just "v14:c"]
+          @=? Digraph.traversePathFrom "v16" (step [3, 6, 14, 15]) graph1E
+    , testCase "some branches, some targets" $
+        [Nothing, Just "v12:d", Nothing]
+          @=? Digraph.traversePathFrom "v16" (step [6, 12]) graph1E
+    , testCase "no branches, no targets" $
+        [Nothing, Nothing, Nothing]
+          @=? Digraph.traversePathFrom "v1" (step [3, 6]) graph1E
+    ]
+  where
+    step :: [Int] -> [(V, Set E)] -> [Either V (Maybe String)]
+    step targets = \case
+      [] -> [Right Nothing]
+      cs -> case List.partition ((`Set.member` vSet targets) . fst) cs of
+        (hits, misses) ->
+          map (Right . Just . renderHit) hits ++ map (Left . fst) misses
+
+    renderHit :: (V, Set E) -> String
+    renderHit (v, edges) = v ++ ':' : List.intercalate "," (Set.elems edges)
+
+testFindEdges :: TestTree
+testFindEdges = testGroup "findEdges" [
+      testCase "empty" $
+        Digraph.FindEdgesNone @=? Digraph.findEdges "v42" graph0
+    , testCase "unknown" $
+        Digraph.FindEdgesNone @=? Digraph.findEdges "v42" graph1E
+    , testCase "orphan" $
+        Digraph.FindEdgesNone @=? Digraph.findEdges "v6" graph1E
+    , testCase "leaf" $
+        Digraph.FindEdgesNone @=? Digraph.findEdges "v9" graph1E
+    , testCase "minimal" $
+        let expected =
+              Digraph.FindEdgesFound
+                (NonEmpty.fromList ["g"])
+                (NonEmpty.fromList ["g"])
+        in  expected @=? Digraph.findEdges "v8" graph1E
+    , testCase "root" $
+        let expected =
+              Digraph.FindEdgesFound
+                (NonEmpty.fromList ["a", "b"])
+                (NonEmpty.fromList ["a", "d", "e"])
+        in  expected @=? Digraph.findEdges "v16" graph1E
+    ]
+
+testMapEdges :: TestTree
+testMapEdges = testGroup "mapEdges" [
+      testCase "empty" $
+        graph0 @=? Digraph.mapEdges f graph0
+    , testCase "no edges" $
+        graph1V @=? Digraph.mapEdges f graph1V
+    , testCase "with edges" $ do
+        let expected = mkGraph graph1Vs $ map (first f) graph1Es
+        expected @=? Digraph.mapEdges f graph1E
+    ]
+  where
+    f :: E -> E
+    f = List.map Char.toUpper
+
+testMapVerticesOutgoingEdges :: TestTree
+testMapVerticesOutgoingEdges = testGroup "mapVerticesOutgoingEdges" [
+      testCase "empty" $
+        graph0 @=? Digraph.mapVerticesOutgoingEdges f graph0
+    , testCase "no edges" $
+        graph1V @=? Digraph.mapVerticesOutgoingEdges f graph1V
+    , testCase "with edges" $ do
+        let nameV = \case
+              "v1"  -> "v1:h,i,j"
+              "v2"  -> "v2:c"
+              "v7"  -> "v7:k"
+              "v8"  -> "v8:g"
+              "v10" -> "v10:f"
+              "v14" -> "v14:d,e"
+              "v16" -> "v16:a,b"
+              v     -> v
+            expected = mkGraphWith nameV id graph1Vs graph1Es
+        expected @=? Digraph.mapVerticesOutgoingEdges f graph1E
+    ]
+  where
+    f :: V -> Set E -> V
+    f v edges
+      | Set.null edges = v
+      | otherwise      = v ++ ':' : List.intercalate "," (Set.elems edges)
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+mkV :: Int -> V
+mkV = ('v' :) . show
+
+mkVs :: Functor f => f Int -> f V
+mkVs = fmap mkV
+
+vSet :: [Int] -> Set V
+vSet = Set.fromList . mkVs
+
+mkGraph :: [V] -> [(E, (V, V))] -> G
+mkGraph vs =
+    Foldable.foldl' insertEdge $
+      Foldable.foldl' (flip Digraph.insertVertex) Digraph.empty vs
+  where
+    insertEdge :: G -> (E, (V, V)) -> G
+    insertEdge g (e, (fromV, toV)) = Digraph.insertEdge fromV e toV g
+
+mkGraphWith :: (V -> V) -> (E -> E) -> [V] -> [(E, (V, V))] -> G
+mkGraphWith nameV nameE vs =
+    Foldable.foldl' insertEdge $
+      Foldable.foldl' (flip Digraph.insertVertex) Digraph.empty (map nameV vs)
+  where
+    insertEdge :: G -> (E, (V, V)) -> G
+    insertEdge g (e, (fromV, toV)) =
+      Digraph.insertEdge (nameV fromV) (nameE e) (nameV toV) g
diff --git a/test/hs-bindgen/Test/HsBindgen/Unit/Frontend.hs b/test/hs-bindgen/Test/HsBindgen/Unit/Frontend.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Unit/Frontend.hs
@@ -0,0 +1,187 @@
+module Test.HsBindgen.Unit.Frontend (tests) where
+
+import Data.List
+import System.FilePath ((</>))
+import Test.Tasty
+import Test.Tasty.HUnit
+
+import Clang.Version
+
+import HsBindgen.Boot
+import HsBindgen.Cache
+import HsBindgen.Config.Internal
+import HsBindgen.Errors
+import HsBindgen.Frontend
+import HsBindgen.Frontend.Pass.Parse.IsPass
+import HsBindgen.Frontend.Pass.Parse.Result
+import HsBindgen.Imports
+import HsBindgen.IR.C qualified as C
+import HsBindgen.Macro
+import HsBindgen.Macro qualified as Macro
+import HsBindgen.Macro.Syntax (MacroInvocation (..))
+import HsBindgen.TraceMsg
+import HsBindgen.Util.Tracer
+
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.HsBindgen.Resources
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: IO TestResources -> TestTree
+tests getTestResources = testGroup "Test.HsBindgen.Unit.Frontend" [
+      testGroup "Parse" [
+          testParseSourceOrder getTestResources
+        , testParseReparseInvocations getTestResources
+        ]
+    ]
+
+{-------------------------------------------------------------------------------
+  Parse pass tests
+-------------------------------------------------------------------------------}
+
+testParseSourceOrder :: IO TestResources -> TestTree
+testParseSourceOrder getTestResources =
+  testWhenClangVersion (>= (20, 1, 0)) "ParseSourceOrder" $ do
+    results <-
+      execFrontend
+        getTestResources
+        c89
+        ["test-artefacts" </> "headers" </> "golden" </> "macros" </> "parse"]
+        "elaborate.h"
+        getParseResults
+    -- The Clang driver may add @-D@ options of its own, such as
+    -- @-D__GCC_HAVE_DWARF2_CFI_ASM=1@.
+    let notFromCommandLine :: ParseResult CExpr Parse -> Bool
+        notFromCommandLine result = case getParseResultMaybeDecl result of
+          Just decl | C.FromCommandLine <- decl.info.origin -> False
+          _otherwise                                        -> True
+    declNamesWithSourceOrderIndex <- forM (filter notFromCommandLine results) $ \result ->
+      case getParseResultMaybeDecl result of
+        Nothing   -> assertFailure $ "parse failed: " ++ show result
+        Just decl -> do
+          case decl.info.sourceOrderIndex of
+            Nothing ->
+              panicPure $
+                "no source-order index for declaration " ++ show decl.info.id
+            Just idx ->
+              pure (show $ prettyForTrace decl.info.id, idx)
+    -- 'getParseResults' returns declarations in sequence order (libclang's
+    -- visitation order: macros first, then the rest).
+    let declNamesSequenceOrderActual :: [String]
+        declNamesSequenceOrderActual = map fst declNamesWithSourceOrderIndex
+        declNamesSequenceOrderExpected :: [String]
+        declNamesSequenceOrderExpected = [
+             "'macro OUTER_A'"
+           , "'macro INNER_A'"
+           , "'macro INNER_B'"
+           , "'macro OUTER_B'"
+           , "'macro OUTER_C'"
+           , "'outer_int'"
+           , "'inner_int'"
+           ]
+    assertEqual "sequence order"
+      declNamesSequenceOrderExpected
+      declNamesSequenceOrderActual
+    -- Sorting by the source-order index recovers source order.
+    let declNamesSourceOrderActual :: [String]
+        declNamesSourceOrderActual =
+          map fst $ sortOn snd declNamesWithSourceOrderIndex
+        declNamesSourceOrderExpected :: [String]
+        declNamesSourceOrderExpected = [
+            "'macro OUTER_A'"
+          , "'outer_int'"
+          , "'macro INNER_A'"
+          , "'macro INNER_B'"
+          , "'inner_int'"
+          , "'macro OUTER_B'"
+          , "'macro OUTER_C'"
+          ]
+    assertEqual "source order"
+      declNamesSourceOrderExpected
+      declNamesSourceOrderActual
+
+-- | The macro invocations recorded for reparsing a declaration are exactly
+-- those written in its source range
+testParseReparseInvocations :: IO TestResources -> TestTree
+testParseReparseInvocations getTestResources =
+  testCase "ParseReparseInvocations" $ do
+    results <-
+      execFrontend
+        getTestResources
+        c89
+        ["test-artefacts" </> "headers" </> "golden" </> "macros" </> "reparse"]
+        "end_in_macro_arg.h"
+        getParseResults
+    let invocationsActual :: [(String, [Text])]
+        invocationsActual = [
+            (show $ prettyForTrace decl.info.id, sort names)
+          | Just decl  <- map getParseResultMaybeDecl results
+          , Just names <- [reparseInvocations decl.kind]
+          ]
+        invocationsExpected :: [(String, [Text])]
+        invocationsExpected = [
+            ("'f'"  , ["PARAMS", "T", "T"])
+          , ("'g'"  , ["PARAMS", "U"])
+            -- @ID(;)@ starts right after the declaration
+          , ("'arr'", ["T"])
+          ]
+    forM_ invocationsExpected $ \(declName, expected) ->
+      assertEqual declName (Just expected) (lookup declName invocationsActual)
+  where
+    reparseInvocations :: C.DeclKind CExpr Parse -> Maybe [Text]
+    reparseInvocations = \case
+      C.DeclFunction function -> Just $ reparseInfoNames function.ann
+      C.DeclGlobal   global   -> Just $ reparseInfoNames global.ann
+      _otherwise              -> Nothing
+
+    reparseInfoNames :: ReparseInfo tokens -> [Text]
+    reparseInfoNames = \case
+      ReparseNeeded _ invocations -> map (.name) (toList invocations)
+      ReparseNotNeeded            -> []
+
+{-------------------------------------------------------------------------------
+  Auxiliary functions
+-------------------------------------------------------------------------------}
+
+testWhenClangVersion ::
+     ((Int, Int, Int) -> Bool)
+  -> TestName
+  -> Assertion
+  -> TestTree
+testWhenClangVersion p name assertion
+    | isRunnable = testCase  name assertion
+    | otherwise  = testGroup name []
+  where
+    isRunnable :: Bool
+    isRunnable = case runtimeClangVersion of
+      ClangVersion version  -> p version
+      ClangVersionUnknown _ -> False
+
+execFrontend ::
+     IO TestResources
+  -> CStandard
+  -> [FilePath]  -- ^ Include directories
+  -> FilePath    -- ^ Header
+  -> (FrontendArtefact CExpr -> IO a)
+  -> IO a
+execFrontend getTestResources cStdStr incDirs header k =
+    withTracePredicate noReport defaultTracePredicate $ \tracer -> do
+      clangArgs <- getTestClangArgsConfig cStdStr incDirs <$> getTestResources
+      let bootConfig     = BootConfig clangArgs def def
+          frontendConfig = def
+          backendConfig  = def{ uniqueId = UniqueId "test" }
+          config         = BindgenConfig bootConfig frontendConfig backendConfig
+          bootTracer     = contramap TraceBoot tracer
+          frontendTracer = contramap TraceFrontend tracer
+      bootArtefact     <- runBoot bootTracer (pure . Macro.cExpr) config
+                            [C.DirectiveHashInclude header]
+      frontendArtefact <- runFrontend frontendTracer frontendConfig bootArtefact
+      k frontendArtefact
+  where
+    noReport :: a -> IO ()
+    noReport = const $ pure ()
+
+getParseResults :: FrontendArtefact CExpr -> IO [ParseResult CExpr Parse]
+getParseResults = getCached . (.parse)
diff --git a/test/hs-bindgen/Test/HsBindgen/Unit/Pretty.hs b/test/hs-bindgen/Test/HsBindgen/Unit/Pretty.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Unit/Pretty.hs
@@ -0,0 +1,107 @@
+module Test.HsBindgen.Unit.Pretty (tests) where
+
+import Data.Text (Text)
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (Assertion, testCase, (@?=))
+import Text.SimplePrettyPrint (Pretty (..))
+
+import HsBindgen.Backend.HsModule.Pretty.Expr ()
+import HsBindgen.Backend.SHs.AST
+import HsBindgen.Language.Haskell qualified as Hs
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Unit.Pretty" [
+      tupleExprTests
+    , tupleTypeTests
+    ]
+
+tupleExprTests :: TestTree
+tupleExprTests =
+    testGroup "Tuple expressions" [
+        testCase "saturated 2-tuple"     $ testPretty tup2E  tup2R
+      , testCase "saturated 4-tuple"     $ testPretty tup4E  tup4R
+      , testCase "2-section"             $ testPretty sec2E  sec2R
+      , testCase "4-section"             $ testPretty sec4E  sec4R
+      , testCase "unsaturated 2-section" $ testPretty usec2E usec2R
+      , testCase "unsaturated 4-section" $ testPretty usec4E usec4R
+      ]
+  where
+    int :: Integer -> ClosedExpr
+    int n = (EIntegral n Nothing)
+
+    tup2E :: ClosedExpr
+    tup2R :: String
+    tup2E = EApp (EApp (EBoxedTup (Plus2 0)) (int 0)) (int 1)
+    tup2R = "(0, 1)"
+
+    tup4E :: ClosedExpr
+    tup4R :: String
+    tup4E = EApp (EApp (EApp (EApp (EBoxedTup (Plus2 2)) (int 0)) (int 1)) (int 2)) (int 3)
+    tup4R = "(0, 1, 2, 3)"
+
+    sec2E :: ClosedExpr
+    sec2R :: String
+    sec2E = EBoxedTup (Plus2 0)
+    sec2R = "(, )"
+
+    sec4E :: ClosedExpr
+    sec4R :: String
+    sec4E = EBoxedTup (Plus2 2)
+    sec4R = "(, , , )"
+
+    usec2E :: ClosedExpr
+    usec2R :: String
+    usec2E = EApp (EBoxedTup (Plus2 0)) (int 0)
+    usec2R = "(0, )"
+
+    usec4E :: ClosedExpr
+    usec4R :: String
+    usec4E = EApp (EApp (EBoxedTup (Plus2 2)) (int 0)) (int 1)
+    usec4R = "(0, 1, , )"
+
+tupleTypeTests :: TestTree
+tupleTypeTests =
+    testGroup "Tuple types" [
+        testCase "saturated 2-tuple"     $ testPretty tup2T  tup2R
+      , testCase "saturated 4-tuple"     $ testPretty tup4T  tup4R
+      , testCase "2-section"             $ testPretty sec2T  sec2R
+      , testCase "4-section"             $ testPretty sec4T  sec4R
+      , testCase "unsaturated 2-section" $ testPretty usec2T usec2R
+      , testCase "unsaturated 4-section" $ testPretty usec4T usec4R
+      ]
+  where
+    free :: Text -> SType ctx
+    free = TFree . Hs.UnsafeName
+
+    tup2T :: ClosedType
+    tup2R :: String
+    tup2T = TApp (TApp (TBoxedTup (Plus2 0)) (free "a")) (free "b")
+    tup2R = "(a, b)"
+
+    tup4T :: ClosedType
+    tup4R :: String
+    tup4T = TApp (TApp (TApp (TApp (TBoxedTup (Plus2 2)) (free "a")) (free "b")) (free "c")) (free "d")
+    tup4R = "(a, b, c, d)"
+
+    sec2T :: ClosedType
+    sec2R :: String
+    sec2T = TBoxedTup (Plus2 0)
+    sec2R = "(, )"
+
+    sec4T :: ClosedType
+    sec4R :: String
+    sec4T = TBoxedTup (Plus2 2)
+    sec4R = "(, , , )"
+
+    usec2T :: ClosedType
+    usec2R :: String
+    usec2T = TApp (TBoxedTup (Plus2 0)) (free "a")
+    usec2R = "(a, )"
+
+    usec4T :: ClosedType
+    usec4R :: String
+    usec4T = TApp (TApp (TBoxedTup (Plus2 2)) (free "a")) (free "b")
+    usec4R = "(a, b, , )"
+
+testPretty :: Pretty a => a -> String -> Assertion
+testPretty x res = show (pretty x) @?= res
diff --git a/test/hs-bindgen/Test/HsBindgen/Unit/RootDirective.hs b/test/hs-bindgen/Test/HsBindgen/Unit/RootDirective.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Unit/RootDirective.hs
@@ -0,0 +1,54 @@
+module Test.HsBindgen.Unit.RootDirective (tests) where
+
+import Test.Tasty
+import Test.Tasty.HUnit
+
+import HsBindgen.IR.C qualified as C
+
+{-------------------------------------------------------------------------------
+  List of tests
+-------------------------------------------------------------------------------}
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Unit.RootDirective" [
+      hashDefineToDirectiveTests
+    , renderRootDirectivesTests
+    ]
+
+{-------------------------------------------------------------------------------
+  HashDefine
+-------------------------------------------------------------------------------}
+
+-- | The rows of the correspondence table in t'C.HashDefine's haddock
+hashDefineToDirectiveTests :: TestTree
+hashDefineToDirectiveTests = testGroup "hashDefineToDirective" [
+      testCase "-D FOO"        $ render "FOO"    "1"   @?= "#define FOO 1"
+    , testCase "-D FOO=BAR"    $ render "FOO"    "BAR" @?= "#define FOO BAR"
+    , testCase "-D FOO="       $ render "FOO"    ""    @?= "#define FOO"
+    , testCase "-D 'FOO(x)=x'" $ render "FOO(x)" "x"   @?= "#define FOO(x) x"
+    ]
+  where
+    render :: String -> String -> String
+    render name value = C.hashDefineToDirective (C.HashDefine name value)
+
+{-------------------------------------------------------------------------------
+  RootDirective
+-------------------------------------------------------------------------------}
+
+renderRootDirectivesTests :: TestTree
+renderRootDirectivesTests = testGroup "renderRootDirectives" [
+      testCase "empty" $ C.renderRootDirectives [] @?= ""
+    , testCase "order preserved" $
+        C.renderRootDirectives [
+            C.DirectiveHashDefine  (C.HashDefine "A" "1")
+          , C.DirectiveHashInclude "a.h"
+          , C.DirectiveHashDefine  (C.HashDefine "B" "")
+          , C.DirectiveHashInclude "b.h"
+          ]
+          @?= unlines [
+              "#define A 1"
+            , "#include <a.h>"
+            , "#define B"
+            , "#include <b.h>"
+            ]
+    ]
diff --git a/test/hs-bindgen/Test/HsBindgen/Unit/Runtime.hs b/test/hs-bindgen/Test/HsBindgen/Unit/Runtime.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Unit/Runtime.hs
@@ -0,0 +1,48 @@
+-- | Guard test for the runtime-module name table
+-- ("HsBindgen.Backend.Runtime").
+--
+-- The explicit imports below pin every runtime module the table names. Renaming
+-- (or removing) one of these modules without updating the table breaks the
+-- build here, rather than silently emitting a bad import into generated code.
+--
+-- For most modules the table derives the path via Template Haskell from a name
+-- defined in the module, so it cannot go stale. The re-export-only modules
+-- (support, compat @HasField@, @LibC@) carry an explicit path in the table; the
+-- assertions below check those paths against the modules imported here.
+module Test.HsBindgen.Unit.Runtime (tests) where
+
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (testCase, (@?=))
+
+import HsBindgen.Runtime.LibC ()
+import HsBindgen.Runtime.Support ()
+import HsBindgen.Runtime.Support.CompatHasField ()
+
+import HsBindgen.Backend.Runtime qualified as Runtime
+import HsBindgen.Language.Haskell qualified as Hs
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Unit.Runtime" [
+      testCase "every module has a well-formed path" $
+        mapM_ assertWellFormed [minBound .. maxBound]
+    , testCase "re-export-only module paths" $ do
+        Runtime.moduleName Runtime.Support
+          @?= "HsBindgen.Runtime.Support"
+        Runtime.moduleName Runtime.CompatHasField
+          @?= "HsBindgen.Runtime.Support.CompatHasField"
+        Runtime.moduleName Runtime.LibC
+          @?= "HsBindgen.Runtime.LibC"
+    ]
+  where
+    -- A path is well-formed if it is a non-empty, dot-separated list of
+    -- non-empty components, each starting with an upper-case letter.
+    assertWellFormed :: Runtime.RuntimeModule -> IO ()
+    assertWellFormed rm =
+        isWellFormed (Hs.moduleNameToString (Runtime.moduleName rm)) @?= True
+      where
+        isWellFormed = all validComponent . splitOnDots
+        splitOnDots s = case break (== '.') s of
+          (c, '.' : rest) -> c : splitOnDots rest
+          (c, _)          -> [c]
+        validComponent []      = False
+        validComponent (c : _) = c `elem` ['A' .. 'Z']
diff --git a/test/hs-bindgen/Test/HsBindgen/Unit/Tracer.hs b/test/hs-bindgen/Test/HsBindgen/Unit/Tracer.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/Test/HsBindgen/Unit/Tracer.hs
@@ -0,0 +1,235 @@
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Test.HsBindgen.Unit.Tracer (tests) where
+
+import Data.Data (Typeable)
+import Data.Either (isLeft)
+import Data.IORef (readIORef)
+import Data.Proxy (Proxy (Proxy))
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.HUnit (Assertion, testCase, (@?), (@?=))
+import Test.Tasty.QuickCheck (Arbitrary (..), CoArbitrary, Fun, Function, Gen,
+                              Property, elements, pattern Fn, testProperty,
+                              (===))
+import Text.SimplePrettyPrint qualified as PP
+
+import HsBindgen.Util.Tracer
+
+import Test.Common.HsBindgen.Trace.Predicate
+import Test.Common.Util.Tasty
+
+{-------------------------------------------------------------------------------
+  Tests
+-------------------------------------------------------------------------------}
+
+tests :: TestTree
+tests = testGroup "Test.HsBindgen.Unit.Tracer" [
+      testGroup "DefaultLogLevel" [
+          testCase "none"    $ assertMaxLevel [] Debug
+        , testCase "warning" $ assertMaxLevel [wn] Warning
+        , testCase "error"   $ assertMaxLevel [er] Error
+        , testCase "error1"  $ assertMaxLevel [wn, er] Error
+        , testCase "error2"  $ assertMaxLevel [wn, er, wn] Error
+        , testCase "error3"  $ assertMaxLevel [er, wn] Error
+        ]
+    , testGroup "CustomLogLevel" [
+          testCase "none"     $ assertMaxLevelWithDegrade [] Debug
+        , testCase "warning"  $ assertMaxLevelWithDegrade [wn] Info
+        , testCase "warning1" $ assertMaxLevelWithDegrade [db, wn] Info
+        , testCase "warning2" $ assertMaxLevelWithDegrade [wn, db] Info
+        , testCase "warning3" $ assertMaxLevelWithDegrade [db, wn, db] Info
+        , testCase "error"    $ assertMaxLevelWithDegrade [er] Info
+        , testCase "error1"   $ assertMaxLevelWithDegrade [wn, er] Info
+        , testCase "error2"   $ assertMaxLevelWithDegrade [wn, er, wn] Info
+        , testCase "error3"   $ assertMaxLevelWithDegrade [er, wn] Info
+        , testGroup "semigroup" [
+            testProperty "const-log-level-last-wins"   prop_constLevelLastWins
+          , testProperty "adapt-log-level-associative" prop_adaptLevelAssociative
+          , testProperty "adapt-log-level-unit"        prop_adaptLevelUnit
+          ]
+        ]
+    , testGroup "LeftOnError" [
+          testCase "left" $ do
+              let tracerConf = quietTracerConfig {
+                      verbosity = Verbosity Debug
+                    }
+              res <- withTracer tracerConf $ \tracer -> do traceWith tracer $ withCallStack er
+              isLeft res @? "isLeft"
+        ]
+    , testGroup "withTracePredicate" [
+          testCase "ok-debug" $
+              withPred defaultTracePredicate $ \tracer ->
+                traceWith tracer $ withCallStack db
+        , testCase "ok-info" $
+              withPred defaultTracePredicate $ \tracer ->
+                traceWith tracer $ withCallStack info
+        , testCase "!ok-notice" $
+              withPred defaultTracePredicate $ \tracer ->
+                traceWith tracer $ withCallStack notice
+        , testCase "!ok-warning" $
+            assertException "Expected TraceExpectationException" proxy $
+              withPred defaultTracePredicate $ \tracer ->
+                traceWith tracer $ withCallStack wn
+        , testCase "!ok-error" $
+            assertException "Expected TraceExpectationException" proxy $
+              withPred defaultTracePredicate $ \tracer ->
+                traceWith tracer $ withCallStack er
+        , testCase "ok-custom-warning" $
+            withPred expectWar $
+              \tracer -> do
+                traceWith tracer $ withCallStack wn
+        , testCase "ok-custom-error" $
+            withPred expectErr $
+              \tracer -> do
+                traceWith tracer $ withCallStack er
+        , testCase "!ok-custom-too-many" $
+            assertException "Expected TraceExpectationException" proxy $
+              withPred expectWar $
+                \tracer -> do
+                  traceWith tracer $ withCallStack wn
+                  traceWith tracer $ withCallStack wn
+        , testCase "!ok-custom-too-few" $
+            assertException "Expected TraceExpectationException" proxy $
+              withPred expectWar $
+                \tracer -> do
+                  traceWith tracer $ withCallStack db
+        ]
+    ]
+  where
+    db        = TestDebug   "Debug message."
+    info      = TestInfo    "Info message."
+    notice    = TestNotice  "Notice message."
+    wn        = TestWarning "Warning!"
+    er        = TestError   "Error!"
+    proxy     = Proxy :: Proxy (TraceExpectationException TestTrace)
+    expectWar = singleTracePredicate $ \case
+      TestWarning _ -> Just $ Expected ()
+      _otherTrace   -> Nothing
+    expectErr = singleTracePredicate $ \case
+      TestError _   -> Just $ Expected ()
+      _otherTrace   -> Nothing
+
+    withPred :: (IsTrace Level a, Typeable a, Show a) =>
+      TracePredicate Level a -> (Tracer a -> IO b) -> IO b
+    withPred = withTracePredicate noReport
+
+    noReport :: a -> IO ()
+    noReport = const $ pure ()
+
+{-------------------------------------------------------------------------------
+  Internal: infrastructure for generating test traces
+-------------------------------------------------------------------------------}
+
+data TestTrace =
+    TestDebug String
+  | TestInfo String
+  | TestNotice String
+  | TestWarning String
+  | TestError String
+  deriving stock (Show, Eq)
+
+instance PrettyForTrace TestTrace where
+  prettyForTrace = \case
+    TestDebug   x -> PP.string x
+    TestInfo    x -> PP.string x
+    TestNotice  x -> PP.string x
+    TestWarning x -> PP.string x
+    TestError   x -> PP.string x
+
+instance IsTrace Level TestTrace where
+  getDefaultLogLevel = \case
+    TestDebug   _ -> Debug
+    TestInfo    _ -> Info
+    TestNotice  _ -> Notice
+    TestWarning _ -> Warning
+    TestError   _ -> Error
+  getSource  = const HsBindgen
+  getTraceId = const "test"
+
+assertMaxLevel :: [TestTrace] -> Level -> Assertion
+assertMaxLevel = assertMaxLevelWithCustomLogLevel mempty
+
+alwaysLevel :: Level -> CustomLogLevel Level a
+alwaysLevel level = CustomLogLevel $ const . const level
+
+assertMaxLevelWithDegrade :: [TestTrace] -> Level -> Assertion
+assertMaxLevelWithDegrade =
+  assertMaxLevelWithCustomLogLevel $ alwaysLevel Info
+
+assertMaxLevelWithCustomLogLevel
+  :: CustomLogLevel Level TestTrace -> [TestTrace] -> Level -> Assertion
+assertMaxLevelWithCustomLogLevel customLogLevel traces expectedLevel = do
+  lvl <- testTracerIO customLogLevel traces
+  lvl @?= expectedLevel
+
+testTracerIO :: CustomLogLevel Level TestTrace -> [TestTrace] -> IO Level
+testTracerIO customLogLevel traces = do
+  let tracerConfig :: TracerConfig Level TestTrace
+      tracerConfig = quietTracerConfig {
+          verbosity      = Verbosity Debug
+        , customLogLevel = customLogLevel
+        }
+  -- NB: Use and test the tracer functionality provided by @hs-bindgen:lib@,
+  -- and not by the tests (e.g., 'withTracePredicate').
+  (TracerState maxLogLevel) <- withTracerUnsafe tracerConfig $ \tracer ref -> do
+    mapM_ (traceWith tracer . withCallStack) traces
+    readIORef ref
+  pure maxLogLevel
+
+{-------------------------------------------------------------------------------
+  Property-based
+-------------------------------------------------------------------------------}
+
+instance Arbitrary Level where
+  arbitrary = elements [minBound .. maxBound]
+instance CoArbitrary Level
+instance Function Level
+
+newtype ConstCustomLogLevel = ConstCustomLogLevel (
+    CustomLogLevel Level TestTrace
+  )
+
+unConstCustomLogLevel :: ConstCustomLogLevel -> CustomLogLevel Level TestTrace
+unConstCustomLogLevel (ConstCustomLogLevel x) = x
+
+instance Show ConstCustomLogLevel where
+  show (ConstCustomLogLevel (CustomLogLevel f)) =
+    "ConstCustomLogLevel: " <> show (f (TestDebug "") Debug)
+
+instance Arbitrary ConstCustomLogLevel where
+  arbitrary = do
+    lvl <- arbitrary :: Gen Level
+    pure $ ConstCustomLogLevel $ CustomLogLevel $ \_ -> const lvl
+
+instance Arbitrary TestTrace where
+  arbitrary = do
+    c <- elements [TestDebug, TestInfo, TestNotice, TestWarning, TestError]
+    s <- arbitrary :: Gen String
+    pure $ c s
+
+apply :: IsTrace l a => CustomLogLevel l a -> a -> l
+apply (CustomLogLevel f) tr = f tr (getDefaultLogLevel tr)
+
+applys :: IsTrace l a => [CustomLogLevel l a] -> a -> l
+applys = apply . mconcat
+
+prop_constLevelLastWins ::
+  [ConstCustomLogLevel] -> ConstCustomLogLevel -> TestTrace -> Property
+prop_constLevelLastWins xs x tr =
+  applys (map unConstCustomLogLevel $ xs ++ [x]) tr
+  === apply (unConstCustomLogLevel x) tr
+
+prop_adaptLevelAssociative ::
+  Fun Level Level -> Fun Level Level -> Fun Level Level -> TestTrace -> Property
+prop_adaptLevelAssociative (Fn f1) (Fn f2) (Fn f3) tr =
+  apply (c1 <> (c2 <> c3)) tr === apply ((c1 <> c2) <> c3) tr
+  where toCustomLogLevel f = CustomLogLevel $ \_ lvl -> f lvl
+        c1 = toCustomLogLevel f1
+        c2 = toCustomLogLevel f2
+        c3 = toCustomLogLevel f3
+
+prop_adaptLevelUnit ::
+  Fun Level Level -> TestTrace -> Property
+prop_adaptLevelUnit (Fn f) tr =
+  apply (mconcat $ pure c) tr === apply c tr
+  where c = CustomLogLevel $ \_ lvl -> f lvl
diff --git a/test/hs-bindgen/test-hs-bindgen.hs b/test/hs-bindgen/test-hs-bindgen.hs
new file mode 100644
--- /dev/null
+++ b/test/hs-bindgen/test-hs-bindgen.hs
@@ -0,0 +1,63 @@
+module Main (main) where
+
+import Data.Sequence qualified as Seq
+import Test.Tasty
+
+import Test.HsBindgen.Frontend.LanguageC qualified as Frontend.LanguageC
+import Test.HsBindgen.Frontend.Pass.PrepareReparse qualified as Frontend.Pass.PrepareReparse
+import Test.HsBindgen.Golden qualified as Golden
+import Test.HsBindgen.Integration.ExitCode qualified as Integration.ExitCode
+import Test.HsBindgen.Integration.OverwritePolicy qualified as Integration.OverwritePolicy
+import Test.HsBindgen.Macro.CExpr qualified as Macro.CExpr
+import Test.HsBindgen.Macro.Syntax qualified as Macro.Syntax
+import Test.HsBindgen.Macro.Syntax.Clang qualified as Macro.Syntax.Clang
+import Test.HsBindgen.Macro.UniqueExpansion qualified as Macro.UniqueExpansion
+import Test.HsBindgen.PPFixtures qualified as PPFixtures
+import Test.HsBindgen.Prop.Selection qualified as Prop.Selection
+import Test.HsBindgen.Resources
+import Test.HsBindgen.THFixtures qualified as THFixtures
+import Test.HsBindgen.Unit.ClangArgs qualified as Unit.ClangArgs
+import Test.HsBindgen.Unit.Digraph qualified as Unit.Digraph
+import Test.HsBindgen.Unit.Frontend qualified as Unit.Frontend
+import Test.HsBindgen.Unit.Pretty qualified as Unit.Pretty
+import Test.HsBindgen.Unit.RootDirective qualified as Unit.RootDirective
+import Test.HsBindgen.Unit.Runtime qualified as Unit.Runtime
+import Test.HsBindgen.Unit.Tracer qualified as Unit.Tracer
+
+{-------------------------------------------------------------------------------
+  Main
+-------------------------------------------------------------------------------}
+
+main :: IO ()
+main = defaultMain $
+    withTestResources $ \testResources ->
+    testGroup "test-hs-bindgen" [
+        Frontend.LanguageC.tests
+      , Frontend.Pass.PrepareReparse.tests
+      , Macro.CExpr.tests
+      , Macro.Syntax.tests
+      , Macro.Syntax.Clang.tests
+      , Macro.UniqueExpansion.tests
+      , testGroup "unit tests" [
+            Unit.ClangArgs.tests testResources
+          , Unit.Digraph.tests
+          , Unit.Frontend.tests testResources
+          , Unit.Tracer.tests
+          , Unit.Pretty.tests
+          , Unit.RootDirective.tests
+          , Unit.Runtime.tests
+          ]
+      , testGroup "integration tests" [
+            Integration.ExitCode.tests testResources
+          , Integration.OverwritePolicy.tests testResources
+          ]
+      , testGroup "property tests" [
+            Prop.Selection.tests
+          ]
+      , testGroup "golden tests" [
+            Golden.tests testResources
+          ]
+        -- Path from root to here, for @-p@ pattern filtering.
+      , THFixtures.tests (Seq.fromList ["test-hs-bindgen"]) testResources
+      , PPFixtures.tests (Seq.fromList ["test-hs-bindgen"]) testResources
+      ]
diff --git a/test/literate/Test/Literate/Test01.lhs b/test/literate/Test/Literate/Test01.lhs
new file mode 100644
--- /dev/null
+++ b/test/literate/Test/Literate/Test01.lhs
@@ -0,0 +1,5 @@
+[ "-I", "test-artefacts/headers"
+, "--module=Test.Literate.Test01"
+, "--unique-id", "com.well-typed.hs-bindgen"
+, "test_01.h"
+]
diff --git a/test/literate/Test/Literate/Test02.lhs b/test/literate/Test/Literate/Test02.lhs
new file mode 100644
--- /dev/null
+++ b/test/literate/Test/Literate/Test02.lhs
@@ -0,0 +1,5 @@
+[ "-I", "test-artefacts/headers"
+, "--module=Test.Literate.Test02"
+, "--unique-id", "com.well-typed.hs-bindgen"
+, "test_02.h"
+]
diff --git a/test/literate/Test/Literate/TestPointer.lhs b/test/literate/Test/Literate/TestPointer.lhs
new file mode 100644
--- /dev/null
+++ b/test/literate/Test/Literate/TestPointer.lhs
@@ -0,0 +1,6 @@
+[ "-I", "test-artefacts/headers"
+, "--module=Test.Literate.TestPointer"
+, "--unique-id", "com.well-typed.hs-bindgen"
+, "--single-file", "--pointer", ""
+, "test_01.h"
+]
diff --git a/test/literate/Test/Literate/TestSafe.lhs b/test/literate/Test/Literate/TestSafe.lhs
new file mode 100644
--- /dev/null
+++ b/test/literate/Test/Literate/TestSafe.lhs
@@ -0,0 +1,6 @@
+[ "-I", "test-artefacts/headers"
+, "--module=Test.Literate.TestSafe"
+, "--unique-id", "com.well-typed.hs-bindgen"
+, "--single-file", "--safe", ""
+, "test_01.h"
+]
diff --git a/test/literate/Test/Literate/TestSafeAndUnsafe.lhs b/test/literate/Test/Literate/TestSafeAndUnsafe.lhs
new file mode 100644
--- /dev/null
+++ b/test/literate/Test/Literate/TestSafeAndUnsafe.lhs
@@ -0,0 +1,8 @@
+[ "-I", "test-artefacts/headers"
+, "--module=Test.Literate.TestSafeAndUnsafe"
+, "--unique-id", "com.well-typed.hs-bindgen"
+, "--single-file"
+, "--safe", "__safe"
+, "--unsafe", "__unsafe"
+, "test_01.h"
+]
diff --git a/test/literate/Test/Literate/TestUnsafe.lhs b/test/literate/Test/Literate/TestUnsafe.lhs
new file mode 100644
--- /dev/null
+++ b/test/literate/Test/Literate/TestUnsafe.lhs
@@ -0,0 +1,6 @@
+[ "-I", "test-artefacts/headers"
+, "--module=Test.Literate.TestUnsafe"
+, "--unique-id", "com.well-typed.hs-bindgen"
+, "--single-file", "--unsafe", ""
+, "test_01.h"
+]
diff --git a/test/literate/test-literate.hs b/test/literate/test-literate.hs
new file mode 100644
--- /dev/null
+++ b/test/literate/test-literate.hs
@@ -0,0 +1,71 @@
+module Main (main) where
+
+import Foreign
+import Foreign.C
+
+import Test.Literate.Test01 qualified as Test01
+import Test.Literate.Test02 qualified as Test02
+import Test.Literate.TestPointer qualified as TestPointer
+import Test.Literate.TestSafe qualified as TestSafe
+import Test.Literate.TestSafeAndUnsafe qualified as TestSafeAndUnsafe
+import Test.Literate.TestUnsafe qualified as TestUnsafe
+
+{-------------------------------------------------------------------------------
+  These are just sanity checks that literate mode works at all.
+
+  * Test01 and Test02 are the minimal hs-bindgen invocation
+  * TestSafe explicitly uses the @--safe@ option (which is anyway default)
+  * TestUnsafe is similar, but using @--unsafe@
+  * TestPointer similar again, using @--pointer@
+  * TestSafeAndUnsafe generates /both/ safe /and unsafe functions
+
+  NOTE: Although @--single-file@ is the default in literate mode, if users want
+  to override which categories they want, or use suffixes, then @--single-file@
+  must still be explicitly passed as an argument (otherwise the parser won't
+  accept arguments like @--safe@ and friends).
+-------------------------------------------------------------------------------}
+
+_test01_data :: Test01.StructBasic
+_test01_data = Test01.StructBasic 0 0
+
+_test01_fun :: CInt -> IO Test01.Thing
+_test01_fun = Test01.thing_fun_2
+
+_test02_data :: Test02.Event
+_test02_data = Test02.Event 0 nullPtr (CTime 0)
+
+_testSafe_data :: TestSafe.StructBasic
+_testSafe_data = TestSafe.StructBasic 0 0
+
+_testSafe_fun :: CInt -> IO TestSafe.Thing
+_testSafe_fun = TestSafe.thing_fun_2
+
+_testUnsafe_data :: TestUnsafe.StructBasic
+_testUnsafe_data = TestUnsafe.StructBasic 0 0
+
+_testUnsafe_fun :: CInt -> IO TestUnsafe.Thing
+_testUnsafe_fun = TestUnsafe.thing_fun_2
+
+_testPointer_data :: TestPointer.StructBasic
+_testPointer_data = TestPointer.StructBasic 0 0
+
+_testPointer_fun :: FunPtr (CInt -> IO TestPointer.Thing)
+_testPointer_fun = TestPointer.thing_fun_2
+
+_testSafeAndUnsafe_data :: TestSafeAndUnsafe.StructBasic
+_testSafeAndUnsafe_data = TestSafeAndUnsafe.StructBasic 0 0
+
+_testSafeAndUnsafe_fun_safe :: CInt -> IO TestSafeAndUnsafe.Thing
+_testSafeAndUnsafe_fun_safe = TestSafeAndUnsafe.thing_fun_2__safe
+
+_testSafeAndUnsafe_fun_unsafe :: CInt -> IO TestSafeAndUnsafe.Thing
+_testSafeAndUnsafe_fun_unsafe = TestSafeAndUnsafe.thing_fun_2__unsafe
+
+{-------------------------------------------------------------------------------
+  Main
+
+  The fact that this compiles at all suffices.
+-------------------------------------------------------------------------------}
+
+main :: IO ()
+main = return ()
diff --git a/test/th/Test/TH/RecordDot.hs b/test/th/Test/TH/RecordDot.hs
new file mode 100644
--- /dev/null
+++ b/test/th/Test/TH/RecordDot.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE OverloadedLabels #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+-- NOTE: This module tests if we can handle duplicate record fields with
+-- @OmitFieldPrefixes@.
+{-# LANGUAGE DuplicateRecordFields #-}
+{-# LANGUAGE OverloadedRecordDot #-}
+
+-- NOTE: This module also tests that we correctly attach documentation to record
+-- fields, avoiding errors of the form
+--
+-- @
+-- ‘Test.TH.RecordDot.x’ is not in scope at a reify
+-- @
+--
+-- Please ensure that the language extension "NoFieldSelectors" is enabled.
+{-# LANGUAGE NoFieldSelectors #-}
+
+-- {-# OPTIONS_GHC -ddump-splices -ddump-deriv -ddump-to-file #-}
+-- {-# OPTIONS_GHC -ddump-splices #-}
+
+module Test.TH.RecordDot where
+
+import Optics ((%), (&), (.~))
+import System.FilePath ((</>))
+
+import HsBindgen.TH
+
+let cfg :: Config
+    cfg = def
+      & #clang % #extraIncludeDirs .~ [PkgDir ("test-artefacts" </> "headers")]
+      & #fieldNamingStrategy       .~ OmitFieldPrefixes
+    cfgTh :: ConfigTH
+    cfgTh = def
+ in withHsBindgen cfg cfgTh $
+      hashInclude "duplicate_record_field.h"
diff --git a/test/th/Test/TH/StaticCounterA.hs b/test/th/Test/TH/StaticCounterA.hs
new file mode 100644
--- /dev/null
+++ b/test/th/Test/TH/StaticCounterA.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE OverloadedLabels #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE UnboxedTuples #-}
+
+module Test.TH.StaticCounterA where
+
+import Optics ((%), (&), (.~))
+import System.FilePath ((</>))
+
+import HsBindgen.Runtime.Support
+
+import HsBindgen.TH
+
+let cfg :: Config
+    cfg = def
+      & #clang % #extraIncludeDirs .~ [PkgDir ("test-artefacts" </> "headers")]
+    cfgTh :: ConfigTH
+    cfgTh = def
+ in withHsBindgen cfg cfgTh $
+      hashInclude "static_counter.h"
diff --git a/test/th/Test/TH/StaticCounterB.hs b/test/th/Test/TH/StaticCounterB.hs
new file mode 100644
--- /dev/null
+++ b/test/th/Test/TH/StaticCounterB.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE OverloadedLabels #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE UnboxedTuples #-}
+
+module Test.TH.StaticCounterB where
+
+import Optics ((%), (&), (.~))
+import System.FilePath ((</>))
+
+import HsBindgen.Runtime.Support
+
+import HsBindgen.TH
+
+let cfg :: Config
+    cfg = def
+      & #clang % #extraIncludeDirs .~ [PkgDir ("test-artefacts" </> "headers")]
+    cfgTh :: ConfigTH
+    cfgTh = def
+ in withHsBindgen cfg cfgTh $
+      hashInclude "static_counter.h"
diff --git a/test/th/Test/TH/Test01.hs b/test/th/Test/TH/Test01.hs
new file mode 100644
--- /dev/null
+++ b/test/th/Test/TH/Test01.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE OverloadedLabels #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+-- {-# OPTIONS_GHC -ddump-splices #-}
+
+module Test.TH.Test01 where
+
+import Optics ((%), (&), (.~))
+import System.FilePath ((</>))
+
+import HsBindgen.Runtime.Support
+
+import HsBindgen.TH
+
+let cfg :: Config
+    cfg = def
+      & #clang % #extraIncludeDirs .~ [PkgDir ("test-artefacts" </> "headers")]
+    cfgTh :: ConfigTH
+    cfgTh = def
+ in withHsBindgen cfg cfgTh $
+      hashInclude "test_01.h"
diff --git a/test/th/Test/TH/Test02.hs b/test/th/Test/TH/Test02.hs
new file mode 100644
--- /dev/null
+++ b/test/th/Test/TH/Test02.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE OverloadedLabels #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE UnboxedTuples #-}
+
+module Test.TH.Test02 where
+
+import Optics ((%), (&), (.~))
+import System.FilePath ((</>))
+
+import HsBindgen.Runtime.LibC qualified
+
+import HsBindgen.TH
+
+let cfg :: Config
+    cfg = def
+      & #clang % #extraIncludeDirs .~ [PkgDir ("test-artefacts" </> "headers")]
+    cfgTh :: ConfigTH
+    cfgTh = def
+ in withHsBindgen cfg cfgTh $
+      hashInclude "test_02.h"
diff --git a/test/th/test-th.hs b/test/th/test-th.hs
new file mode 100644
--- /dev/null
+++ b/test/th/test-th.hs
@@ -0,0 +1,272 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DerivingVia #-}
+{-# LANGUAGE OverloadedRecordDot #-}
+
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1575>
+-- Once we do FLAMs differently no orphans should be necessary anymore.
+{-# OPTIONS_GHC -Wno-orphans #-}
+
+module Main (main) where
+
+import Control.Exception
+import Data.Proxy
+import Data.Vector.Storable qualified as VS
+import Foreign
+import Foreign.C
+import Test.Tasty
+import Test.Tasty.HUnit
+
+import HsBindgen.Runtime.ConstantArray qualified as CA
+import HsBindgen.Runtime.FLAM qualified as FLAM
+import HsBindgen.Runtime.IsArray qualified as IsA
+import HsBindgen.Runtime.Prelude
+import HsBindgen.Runtime.PtrConst qualified as PtrConst
+import HsBindgen.Runtime.Union qualified as Union
+
+import Test.Common.Util.Tasty
+import Test.TH.StaticCounterA qualified as CounterA
+import Test.TH.StaticCounterB qualified as CounterB
+import Test.TH.Test01 qualified as Test01
+import Test.TH.Test02 qualified as Test02
+
+{-------------------------------------------------------------------------------
+  Test01
+-------------------------------------------------------------------------------}
+
+-- StructBasic is generated
+t01Val :: Test01.StructBasic
+t01Val = Test01.StructBasic
+    { Test01.structBasic_field1 = 0
+    , Test01.structBasic_field2 = 1
+    }
+
+-- .. and can be poked
+_t01PokeVal :: Ptr Test01.StructBasic -> IO ()
+_t01PokeVal ptr = poke ptr t01Val
+
+-- Macros
+_t01MyPlus :: CLong -> CLong -> CLong
+_t01MyPlus x y = Test01.pLUS x y
+
+-- Flexible array member (orphan instance)
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1575
+-- Once we do FLAMs differently this instance should be generated by bindgen.
+instance FLAM.NumElems CLong Test01.StructFLAM_Aux where
+    numElems x = fromIntegral (Test01.structFLAM_length x)
+
+-- Bounded and Enum orphan instances
+--
+-- TODO <https://github.com/well-typed/hs-bindgen/issues/1527>
+-- This should be generated by bindgen instead.
+deriving via AsCEnum Test01.EnumBasic  instance Bounded Test01.EnumBasic
+deriving via AsCEnum Test01.EnumBasic  instance Enum    Test01.EnumBasic
+deriving via AsCEnum Test01.EnumNeg    instance Bounded Test01.EnumNeg
+deriving via AsCEnum Test01.EnumNeg    instance Enum    Test01.EnumNeg
+deriving via AsCEnum Test01.EnumNonSeq instance Bounded Test01.EnumNonSeq
+deriving via AsCEnum Test01.EnumNonSeq instance Enum    Test01.EnumNonSeq
+deriving via AsCEnum Test01.EnumSame   instance Bounded Test01.EnumSame
+deriving via AsCEnum Test01.EnumSame   instance Enum    Test01.EnumSame
+
+-- Unit tests
+test01 :: TestTree
+test01 = testGroup "test_01"
+    [ testCase "constants" $ do
+        sizeOf (undefined :: Test01.StructBasic) @?= 8
+        alignment (undefined :: Test01.StructBasic) @?= 4
+
+        sizeOf (undefined :: Test01.StructFixedSizeArray) @?= 12
+        alignment (undefined :: Test01.StructFixedSizeArray)  @?= 4
+
+    , testCase "ConstantArray peek-poke-roundtrip" $ do
+        let s = Test01.StructFixedSizeArray 5 (CA.repeat 12)
+        s' <- alloca $ \ptr -> do
+            poke ptr s
+            peek ptr
+
+        s' @?= s
+
+    , testCase "Bitfield" $ do
+        let s = Test01.StructBitfield 5 1 1 2
+        s' <- alloca $ \ptr -> do
+            poke ptr s
+            peek ptr
+        s' @?= s
+
+    , testCase "function" $ do
+        res <- Test01.my_fma 2 3 5
+        res @?= 11
+
+    , testCase "flam" $ do
+        let n = 10
+        bracket (Test01.flam_alloc n) Test01.flam_free $ \ptr -> do
+            -- Peek.
+            struct <- readRaw ptr
+            struct.flam @?= VS.fromList [0..9]
+
+            -- Poke, Ok.
+            let v' = VS.fromList [10..19]
+            writeRaw ptr (struct { FLAM.flam = v' })
+            struct' <- readRaw ptr
+            struct'.flam @?= v'
+
+            -- Poke, error.
+            let vLengthMismatch = VS.fromList [0]
+            assertException "Expected FlamLengthMismatch" (Proxy :: Proxy FLAM.FlamLengthMismatch) $
+              writeRaw ptr (struct { FLAM.flam = vLengthMismatch })
+            struct'' <- readRaw ptr
+            struct''.flam @?= v'
+
+            -- Reverse.
+            structBeforeReverse <- readRaw ptr
+            Test01.reverse ptr
+            structAfterReverse <- readRaw ptr
+            assertEqual "reversed flam"
+              (structBeforeReverse.flam)
+              (VS.reverse structAfterReverse.flam)
+
+    , testCase "EnumBasic" $
+        [minBound..maxBound]
+          @?= [Test01.ENUM_BASIC_A, Test01.ENUM_BASIC_B, Test01.ENUM_BASIC_C]
+
+    , testCase "EnumNeg" $
+        [minBound..maxBound]
+          @?= [Test01.ENUM_NEG_A, Test01.ENUM_NEG_B, Test01.ENUM_NEG_C]
+
+    , testCase "EnumNonSeq" $
+        [minBound..maxBound]
+          @?= [ Test01.ENUM_NON_SEQ_A
+              , Test01.ENUM_NON_SEQ_B
+              , Test01.ENUM_NON_SEQ_C
+              ]
+
+    , testCase "EnumSame" $ do
+        Test01.ENUM_SAME_B @?= Test01.ENUM_SAME_C
+        [minBound..maxBound]
+          @?= [Test01.ENUM_SAME_A, Test01.ENUM_SAME_B, Test01.ENUM_SAME_D]
+
+    , testCase "struct-arg" $ do
+        res1 <- thing_fun_1 (Test01.Thing 10)
+        10 @?= res1
+
+        res2 <- Test01.thing_fun_1 (Test01.Thing 20)
+        20 @?= res2
+
+    , testCase "struct-res" $ do
+        res <- thing_fun_2 11
+        Test01.Thing 11 @?= res
+
+        res' <- Test01.thing_fun_2 22
+        Test01.Thing 22 @?= res'
+
+    , testCase "struct-arg-res" $ do
+        res <- thing_fun_3 (Test01.Thing 6)
+        Test01.Thing 12 @?= res
+
+        res' <- Test01.thing_fun_3 (Test01.Thing 6)
+        Test01.Thing 12 @?= res'
+
+    , testCase "union" $ do
+        let x :: Test01.LongLongOrDouble
+            x = Union.zero
+            l :: CLLong
+            l = x.longLongOrDouble_l
+            d :: CDouble
+            d = x.longLongOrDouble_d
+        l @?= 0
+        d @?= 0
+        let d' :: CDouble
+            d' = (Union.set @"longLongOrDouble_d" @Test01.LongLongOrDouble 3.5).longLongOrDouble_d
+            l' :: CLLong
+            l' = (Union.set @"longLongOrDouble_l" @Test01.LongLongOrDouble 10).longLongOrDouble_l
+        l' @?= 10
+        d' @?= 3.5
+
+    , testCase "fixed-size-array" $ do
+        let v = CA.repeat 4 :: ConstantArray 3 CInt
+        res <- IsA.withElemPtr v (\ptr -> Test01.sum3 5 (PtrConst.unsafeFromPtr ptr))
+        21 @?= res
+        [4,4,4] @?= CA.toList v -- modification in sum3 aren't visible in original array.
+
+        res' <- IsA.withElemPtr v (\ptr -> Test01.sum3 7 (PtrConst.unsafeFromPtr ptr))
+        23 @?= res'
+
+        let t = Test01.Triple v
+        res'' <- IsA.withElemPtr t (\ptr -> Test01.sum3b 9 (PtrConst.unsafeFromPtr ptr))
+        29 @?= res''
+    ]
+
+thing_fun_1 :: Test01.Thing -> IO CInt
+thing_fun_1 x = Test01.thing_fun_1 x
+
+thing_fun_2 :: CInt -> IO Test01.Thing
+thing_fun_2 x = Test01.thing_fun_2 x
+
+thing_fun_3 :: Test01.Thing -> IO Test01.Thing
+thing_fun_3 x = Test01.thing_fun_3 x
+
+{-------------------------------------------------------------------------------
+  Test02
+-------------------------------------------------------------------------------}
+
+-- Event is generated
+t02Val :: Test02.Event
+t02Val = Test02.Event
+    { Test02.event_id   = 42
+    , Test02.event_name = nullPtr
+    , Test02.event_time = CTime 1770276088
+    }
+
+-- Unit tests
+test02 :: TestTree
+test02 = testGroup "test_02"
+    [ testCase "Event peek-poke-roundtrip" $ do
+        x <- alloca $ \ptr -> do
+            poke ptr t02Val
+            peek ptr
+        x @?= t02Val
+    ]
+
+{-------------------------------------------------------------------------------
+  Static counter
+-------------------------------------------------------------------------------}
+
+testStaticCounter :: TestTree
+testStaticCounter = testGroup "static_counter"
+    [ testCase "independent static state" $ do
+        -- Reset both counters
+        CounterA.reset
+        CounterB.reset
+
+        -- Increment counter A a few times
+        a0 <- CounterA.count
+        a1 <- CounterA.count
+        a2 <- CounterA.count
+
+        a0 @?= 0
+        a1 @?= 1
+        a2 @?= 2
+
+        -- Counter B should be independent (still at 0)
+        b0 <- CounterB.count
+        b0 @?= 0
+
+        -- And counter B increments independently
+        b1 <- CounterB.count
+        b1 @?= 1
+
+        -- Counter A continues from where it left off
+        a3 <- CounterA.count
+        a3 @?= 3
+    ]
+
+{-------------------------------------------------------------------------------
+  Main
+-------------------------------------------------------------------------------}
+
+main :: IO ()
+main = defaultMain $ testGroup "test-th" [
+      test01
+    , test02
+    , testStaticCounter
+    ]
